CoinMP-1.8.3/0000755000175000017500000000000012600453457011322 5ustar renereneCoinMP-1.8.3/Makefile.in0000644000175000017500000006044112507770203013371 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. # Author: Andreas Waechter IBM 2006-04-13 # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : DIST_COMMON = README $(am__configure_deps) \ $(srcdir)/BuildTools/Makemain.inc $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS INSTALL \ config.guess config.sub depcomp install-sh ltmain.sh missing @HAVE_EXTERNALS_TRUE@am__append_1 = Dependencies @HAVE_EXTERNALS_TRUE@am__append_2 = .Dependencies-stamp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ COIN_SKIP_PROJECTS = @COIN_SKIP_PROJECTS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ 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@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_ct_STRIP = @ac_ct_STRIP@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign EXTRA_DIST = $(am__append_1) # EXTRA_DIST = doxydoc/doxygen.conf ######################################################################## # Subdirectories # ######################################################################## # subdirs is set by configure as the list of all subdirectories to recurse # into SUBDIRS = $(subdirs) ######################################################################## # Maintainer Stuff # ######################################################################## # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = coin_subdirs.txt $(am__append_2) \ $(VPATH_DISTCLEANFILES) DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) COIN_HAS_DOXYGEN = @COIN_HAS_DOXYGEN_TRUE@TRUE COIN_HAS_LATEX = @COIN_HAS_LATEX_TRUE@TRUE all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/BuildTools/Makemain.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ 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; } \ END { 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: ctags-recursive $(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; } \ END { 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) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/BuildTools @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-recursive ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ dist-tarZ dist-zip distcheck distclean distclean-generic \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-info-am ######################################################################## # Extra Targets # ######################################################################## test: all cd CoinMP; make test unitTest: test tests: all for dir in $(subdirs); do \ if test -r $$dir/test/Makefile; then \ (cd $$dir; make test) \ fi; \ done unitTests: tests doxydoc: cd $(srcdir); doxygen doxydoc/doxygen.conf .PHONY: test unitTest tests unitTests doxydoc doxygen-docs: if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ doxygen doxydoc/doxygen.conf;\ fi;\ fi pdf-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/latex"; then \ if test "$(COIN_HAS_LATEX)" = TRUE; then \ cd doxydoc/latex;\ $(MAKE) pdf;\ cd -;\ fi;\ fi;\ fi clean-doxygen-docs: if test -d "doxydoc/"; then \ cd doxydoc ;\ rm -rf html latex *.log *.tag;\ fi install-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc"; \ $(INSTALL_DATA) @coin_doxy_tagname@ "$(DESTDIR)$(DocInstallDir)/@coin_doxy_tagname@";\ if test -f "doxydoc/latex/refman.pdf"; then \ $(INSTALL_DATA) doxydoc/latex/refman.pdf "$(DESTDIR)$(DocInstallDir)";\ fi;\ if test -d "doxydoc/html"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/search/" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc/search/"; \ $(INSTALL_DATA) doxydoc/html/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc";\ $(INSTALL_DATA) doxydoc/html/search/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc/search";\ fi;\ fi;\ fi uninstall-doxygen-docs: if test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/"; then \ rm -rf "$(DESTDIR)$(DocInstallDir)/doxydoc/"; \ fi if test -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; then \ rm -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; \ fi all-doxygen-docs: for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) doxygen-docs) \ fi ; \ done ; clean-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) clean-doxygen-docs) \ fi ; \ done ; install-all-doxygen-docs: all-doxygen-docs for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) install-doxygen-docs) \ fi ; \ done ; uninstall-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) uninstall-doxygen-docs) \ fi ; \ done ; install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## # Make sure acinclude is using most recent coin.m4 @MAINTAINER_MODE_TRUE@$(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 @MAINTAINER_MODE_TRUE@ cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date @MAINTAINER_MODE_TRUE@$(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh @MAINTAINER_MODE_TRUE@ cp $< $@ # Take care of updating externals (if Dependencies file exists) @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@$(top_builddir)/Makefile: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@.Dependencies-stamp: $(srcdir)/Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); BuildTools/set_externals Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ touch .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@update-externals: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); svn update .PHONY: install-doc uninstall-doc update-externals # 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: CoinMP-1.8.3/Makefile.am0000644000175000017500000000277411617263737013377 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. ## $Id: Makefile.am 427 2011-08-06 16:12:15Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign EXTRA_DIST = # EXTRA_DIST = doxydoc/doxygen.conf ######################################################################## # Subdirectories # ######################################################################## # subdirs is set by configure as the list of all subdirectories to recurse # into SUBDIRS = $(subdirs) ######################################################################## # Extra Targets # ######################################################################## test: all cd CoinMP; make test unitTest: test tests: all for dir in $(subdirs); do \ if test -r $$dir/test/Makefile; then \ (cd $$dir; make test) \ fi; \ done unitTests: tests doxydoc: cd $(srcdir); doxygen doxydoc/doxygen.conf .PHONY: test unitTest tests unitTests doxydoc ######################################################################## # Maintainer Stuff # ######################################################################## # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = coin_subdirs.txt include BuildTools/Makemain.inc CoinMP-1.8.3/depcomp0000755000175000017500000003710010461157122012671 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/LICENSE0000644000175000017500000000043211043701323012312 0ustar renereneFor CoinMP license information, please see the LICENSE file in the CoinMP subdirectory. For licensing information for any other COIN-OR or third-party source code that was automatically checked out with CoinMP, please see the LICENSE file in the appropriate subdirectories. CoinMP-1.8.3/README0000644000175000017500000000042511043701323012167 0ustar renereneCoinMP README ============= For the CoinMP README file, please see the file CoinMP/README. For the README files of other COIN-OR projects included in this distribution, please see the README files in their associated subdirectories. Bjarni Kristjansson CoinMP-1.8.3/Dependencies0000644000175000017500000000067412463477146013652 0ustar renereneBuildTools https://projects.coin-or.org/svn/BuildTools/stable/0.8 CoinUtils https://projects.coin-or.org/svn/CoinUtils/stable/2.10/CoinUtils Clp https://projects.coin-or.org/svn/Clp/stable/1.16/Clp Osi https://projects.coin-or.org/svn/Osi/stable/0.107/Osi Cgl https://projects.coin-or.org/svn/Cgl/stable/0.59/Cgl Cbc https://projects.coin-or.org/svn/Cbc/stable/2.9/Cbc Data/Sample https://projects.coin-or.org/svn/Data/Sample/stable/1.2 CoinMP-1.8.3/config.sub0000755000175000017500000007772611032507331013315 0ustar renerene#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/BuildTools/0000755000175000017500000000000012600453454013377 5ustar renereneCoinMP-1.8.3/BuildTools/MSVisualStudio/0000755000175000017500000000000012600453454016272 5ustar renereneCoinMP-1.8.3/BuildTools/MSVisualStudio/v9/0000755000175000017500000000000012600453454016630 5ustar renereneCoinMP-1.8.3/BuildTools/MSVisualStudio/v9/BuildTools.vcproj0000644000175000017500000000534111572120430022130 0ustar renerene CoinMP-1.8.3/BuildTools/MSVisualStudio/v10/0000755000175000017500000000000012600453454016700 5ustar renereneCoinMP-1.8.3/BuildTools/MSVisualStudio/v10/Release.props0000755000175000017500000000061012052443620021340 0ustar renerene true CoinMP-1.8.3/BuildTools/MSVisualStudio/v10/Common.props0000755000175000017500000000135412204424023021211 0ustar renerene $(SolutionDir)$(Platform)-$(PlatformToolset)-$(Configuration)\ $(Platform)-$(PlatformToolset)-$(Configuration)\ Level3 true $(OutDir);%(AdditionalLibraryDirectories) CoinMP-1.8.3/BuildTools/MSVisualStudio/v10/Debug.props0000755000175000017500000000122012154626433021014 0ustar renerene MultiThreadedDebugDLL true EnableFastChecks Disabled true CoinMP-1.8.3/BuildTools/depcomp0000755000175000017500000003710010430173037014750 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/BuildTools/set_externals0000755000175000017500000001173411504414745016215 0ustar renerene#!/bin/sh # Copyright (C) 2007 International Business Machines and # Copyright (c) 2009 Lehigh University # All Rights Reserved. # This file is distributed under the Eclipse Public License. # It is part of the BuildTools project in COIN-OR (www.coin-or.org) # # $Id$ # # Adapted from prepare_new_release by Ted Ralphs, Lehigh Univ., 2009-07-07 # Modified: Lou Hafer SFU 2010-06-02 #set -x -v set -e # Know thy self. If there are no '/' chars in the command name, we're running # in the currrent directory. Otherwise, strip the command name, leaving the # prefix. Coin-functions is expected to live in the same directory. if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` else cmdDir='.' fi if test -r $cmdDir/coin-functions ; then . $cmdDir/coin-functions else echo "Cannot find utility functions file coin-functions; exiting." fi printHelp=0 exitValue=0 depFile= # stableExternals specifies externals which we do not want to convert to # releases, for whatever reason. stableExternals= if test "$#" -eq 0; then printHelp=1 else # Process the parameters. A parameter without an opening `-' is assumed to be # the dependency file. while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do case "$1" in -h* | --h*) printHelp=1 ;; -s* | --s*) if expr "$1" : '.*-s.*=.*' 2>&1 >/dev/null ; then stableExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift stableExternals=$1 fi ;; -*) echo "$0: unrecognised command line switch '"$1"'." printHelp=1 exitValue=1 ;; *) depFile=$1 ;; esac shift done fi # Find the most recent release for each stable external. Allow for the # possibility that a stable branch has no associated release, or that the # user has asked to keep the stable external. if test $printHelp = 0 && test $exitValue = 0; then if test -r $depFile; then rm -f Externals.releases echo '' echo '===> Converting stable externals to releases ...' echo '' ext_name= ext_url= for i in `cat $depFile`; do if test "$ext_name" = ""; then ext_name="$i" else ext_url=$i if expr "$ext_name" : '#.*' >/dev/null 2>&1 ; then echo "Skipping $ext_name." ext_name= continue fi if expr "$stableExternals" : '.*'"$ext_name"'.*' 2>&1 >/dev/null ; then echo " $ext_name $ext_url unchanged" else extType=`extractTypeFromURL $ext_url` if test "$extType" = invalid ; then echo '' echo "The external URL $ext_url appears to be invalid. Exiting." echo '' exit 3 fi if test "$extType" = stable ; then ext_majVer=`extractMajorFromURL $ext_url` ext_minVer=`extractMinorFromURL $ext_url` ext_rel_url=`bestRelease $ext_url $ext_majVer $ext_minVer` if test -z "$ext_rel_url" ; then echo "There is no release for $ext_url" echo "Keeping $ext_url" else # Normal (not BuildTools/ThirdParty/Data) need a directory name, # and it may differ from the project name. Carefully preserve it. # ThirdParty URLs include BuildTools ; both named for emphasis case $ext_rel_url in */BuildTools/* | */ThirdParty/* | */Data/* ) ;; *) ext_tail=`extractTailFromExt $ext_url` ext_rel_url=${ext_rel_url}${ext_tail} ;; esac echo "Replacing $ext_url with $ext_rel_url" ext_url=$ext_rel_url fi else echo "Keeping $ext_url" fi fi echo "$ext_name $ext_url" >>Externals.releases ext_name= fi done echo '' echo '===> Updating svn:externals property...' echo '' svn propset svn:externals -F Externals.releases . svn propget svn:externals . rm Externals.releases else # if test -r depFile echo "" echo "Dependency file does not exist or is unspecified..." echo "" printHelp=1 exitvalue=2 fi fi if test $printHelp = 1 ; then cat < Options: -s Suppress conversion from stable to release for the listed externals (comma-separated list of project names, e.g., -s Osi,Cbc). This script takes as input a dependency file containing a list of stable versions of COIN projects on separate lines in the form Recommended practice is to keep the set of stable externals in a file called "Dependencies" in the project's root directory. A temporary file called "Externals.releases" in the same form, but with the URL of each stable version replaced by the URL of the latest associated release is produced. From this file, the script will set the svn:externals variable. It does not do an update or commit the change. After the script runs, do an update and test build, then commit the change if you are happy. EOF else cat <. Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/BuildTools/commit_new_stable0000755000175000017500000001635711510516042017024 0ustar renerene#!/bin/sh # Copyright (C) 2010 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # It is part of the BuildTools project in COIN-OR (www.coin-or.org) # # $Id$ # # Adapted from commit_new_release by Lou Hafer, SFU, 100507. #set -x -v set -e # Know thy self. If there are no '/' chars in the command name, we're running # in the current directory. Otherwise, strip the command name, leaving the # prefix. Coin-functions is expected to live in the same directory. As of # the original version (100602), this script doesn't need coin-functions, # but this still has some value as a consistency check. if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` else cmdDir='.' fi cmdDir=`cd $cmdDir ; pwd` if test -r $cmdDir/coin-functions ; then . $cmdDir/coin-functions else echo "Cannot find utility functions file coin-functions; exiting." fi # We need at least one parameter. The default is a dry run (dryRun = 1). printHelp=0 dryRun=1 dirToCommit= if test "$#" -eq 0; then printHelp=1 else # Process the parameters. A parameter without an opening `-' is assumed to be # the spec for the directory to be committed. (Strip any trailing '/'. Some # people add it, but the script doesn't expect it.) while test $# -gt 0 && test $printHelp = 0 ; do case "$1" in -h* | --h*) printHelp=1 ;; -c* | --c*) dryRun=0 ;; -*) echo "$0: unrecognised command line switch '"$1"'." printHelp=1 ;; *) dirToCommit=`echo $1 | sed -e 's,/$,,'` ;; esac shift done fi # What are we committing? if test -z "$dirToCommit" ; then printHelp=1 fi if test $printHelp = 1 ; then cat < By default, commit_new_stable is a dry run, printing the commands that will be executed. When you're confident that everything looks right, use the -c (--commit) flag to commit the new stable branch. EOF exit 1 fi # Remember what was done during generation of the new stable. if test -r $dirToCommit/.new_stable_data; then . $dirToCommit/.new_stable_data else echo '' echo "Error: the file .new_stable_data is not present in $dirToCommit." echo 'Are you running commit_new_stable in the same directory where you' echo 'ran prepare_new_stable?' echo '' exit 1 fi # Confirm that we're in the proper directory. currDir=`pwd` if test "$currDir/$dirToCommit" != "$topBuildDir" ; then echo "According to $dirToCommit/.new_stable_data, the stable candidate was assembled" echo "in $topBuildDir." echo "You have asked to commit $currDir/$dirToCommit." echo "There is some confusion. Repository is unchanged." exit 1 fi # Change to the checkout directory. cd $coDir # If there are externals set on this directory, confirm that # .Externals.original is present so that we can restore them later. newStableExternals=`svn propget svn:externals .` if test -n "$newStableExternals" ; then if test -r .Externals.original ; then : else echo "This project has externals, but no .Externals.original file" echo "is present to restore them. Repository is unchanged." exit 1 fi fi # Make some short-form URLs by stripping the COIN URL base. srcURLshort=`echo $srcURL | sed -e "s,$coinURL/\(.*\),\1,"` newStableURLshort=`echo $newStableURL | sed -e "s,$coinURL/\(.*\),\1,"` # Do we have to svn add Dependencies? If this query comes up with a leading # `?', the answer is yes. If Dependencies is entirely absent or unchanged, # we'll get a null string. If it's modified, we'll have a leading `M'. dependStatus=`svn status Dependencies` if expr "$dependStatus" : '?.*Dependencies.*' >/dev/null 2>&1 ; then cmd='svn add Dependencies' echo $cmd if test $dryRun = 0 ; then eval $cmd fi fi # Now, do we really need to to a temporary commit? BuildTools is the poster # child, there are no changes at time of writing (100629). Do an svn status # on the checkout directory and see if anything comes up as modified. if svn status $coDir | egrep '^M' 2>&1 >/dev/null ; then doCommit=yes else doCommit=no fi if test $doCommit = yes ; then # Commit the stable back to its source URL so we can do a repository-side copy # to create the release. echo '' echo "===> Temporarily committing stable candidate to $srcURLshort ..." echo '' rev_num_before=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'` echo "Revision number before commit: $rev_num_before" cmd="svn ci -m \"temporarily committing stable candidate\"" echo $cmd if test $dryRun = 0 ; then eval $cmd fi # Update to confirm the commit. Avoid pulling in externals --- if we're # doing multiple commits of new stable branches, they may not exist. As it # stands, the main purpose of this call is to allow us to easily obtain the # current revision. # It might be useful to strengthen this and check that the value # is what we're expecting --- one greater than the revision before # commit. `--ignore-externals' could be made provisional on the existence # of all externals by passing a boolean through .new_release_data. This # would strengthen the update, in that the update would confirm existence # of the externals. cmd='svn update --ignore-externals' echo $cmd if test $dryRun = 0 ; then eval $cmd fi rev_num=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'` echo "Current revision number is: $rev_num" fi # End of preparatory commit. # Create the new stable branch with a repository-side copy. echo '' echo "===> Creating new stable branch $newStableURLshort from $srcURLshort (r$rev_num) ..." echo '' cmd="svn copy -m \"creating $newStableURLshort from $srcURLshort (r$rev_num).\" $srcURL $newStableURL" echo $cmd if test $dryRun = 0 ; then eval $cmd fi # Now restore the original stable branch. if test $doCommit = yes ; then # And restore the source to its original condition. Start by reverting # to the original externals. if test -r .Externals.original ; then echo '' echo '===> Restoring original externals ...' echo '' cmd="svn propset -F .Externals.original svn:externals ." echo $cmd if test $dryRun = 0 ; then eval $cmd rm .Externals.original fi fi # For every .bak file that we created, revert it. if test -n "$bak_files" ; then echo '' echo '===> Restoring modified files ...' echo '' for i in $bak_files; do cmd="cp $i.bak $i ; rm $i.bak" if test $dryRun = 1 ; then echo "$cmd" else eval $cmd fi done fi # Rebuild configure and Makefile.in files echo '' echo '===> Executing run_autotools to restore configuration files ...' echo '' curdir=`pwd` cd $topBuildDir cmd="./BuildTools/run_autotools" echo $cmd if test $dryRun = 0 ; then eval $cmd fi cd "$curdir" # Commit the restored source URL. echo '' echo "===> Committing restored $srcURLshort ..." echo '' cmd="svn ci -m \"restoring $srcURLshort\"" echo $cmd if test $dryRun = 0 ; then eval $cmd fi fi # End of restorative commit. cd $topBuildDir cmd="rm .new_stable_data" echo $cmd if test $dryRun = 0 ; then eval $cmd fi cd $startDir echo '' echo "Done, new stable $newStableURLshort created." echo '' echo "You can now delete the directory $topBuildDir including subdirectories" CoinMP-1.8.3/BuildTools/compile_f2c/0000755000175000017500000000000012600453454015561 5ustar renereneCoinMP-1.8.3/BuildTools/compile_f2c/README0000644000175000017500000000132711504414745016446 0ustar renereneThe files in this directory are intended to allow the compilation of Fortran 77 source files by combining the Fortran to C translator f2c (from netlib) and the Microsoft 'cl' C compiler under Cygwin and MSys. Please read the INSTALL file for instructions how to use this tool. After you installed this tool, you can use the script "compile_f2c" to compile Fortran 77 code. If you specify the flag "--enable-doscompile=msvc" for the configure script in COIN projects, it will automatically be used (unless a native Fortran compiler is found). The files in this directory are part of the BuildTools project of COIN-OR, https://projects.coin-or.org/BuildTools. The files are made available under the Eclipse Public License. CoinMP-1.8.3/BuildTools/compile_f2c/compile_f2c0000755000175000017500000000530211504414745017673 0ustar renerene#!/bin/sh # Copyright (C) 2007 International Business Machines. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # It is part of the BuildTools project in COIN-OR (www.coin-or.org) # ## $Id: compile_f2c 1950 2010-12-22 15:31:49Z andreasw $ # # Author: Andreas Waechter IBM 2007-06-09 ######################################################################## # Replace the following to the location of your vcf2c.lib library # Note that there must be no space before and after "=" f2clibdir=/usr/local/lib/libf2c #You should not have to change anything below this line ######################################################################## #Find out what the if test `which cygpath | wc -l` -eq 0; then CYGPATH_W=echo else CYGPATH_W='cygpath -w' fi if test "$F2C_CC" = ""; then F2C_CC=cl fi f2clib=`$CYGPATH_W $f2clibdir/vcf2c.lib` mainobj=`$CYGPATH_W $f2clibdir/main.obj` # Get rid of the \ f2clib=`echo $f2clib | sed -e s'!\\\\!/!g'` mainobj=`echo $mainobj | sed -e s'!\\\\!/!g'` if test "$#" -eq 1 && test "$1" = "-FLIBS"; then echo $f2clibdir/vcf2c.lib exit 0 fi cincs="-I`$CYGPATH_W $f2clibdir`" options= makedll= linkflags= incs= fsrc= objs= outfile= while test "$#" -gt 0 do arg="$1" shift if test "$outfile" = next; then outfile="$arg" else case "$arg" in -I*) incs="$incs $arg" ;; -o) if test "$outfile" != ""; then echo "There are more than two -o options" exit 1 fi outfile=next ;; -c) options="$options $arg" f2clib= mainobj= ;; -shared) makedll=yes linkflags="$linkflags -dll" ;; -def:*) linkflags="$linkflags $arg" ;; -*) options="$options $arg" ;; *.[fF]) fsrc="$fsrc $arg" ;; *) objs="$objs $arg" ;; esac fi done if test "$fsrc" = "" && test "$objs" = "" ; then echo "No source or object files given" exit 1 fi csrc= if test "$fsrc" != ""; then for f in $fsrc; do cf=`echo $f | sed -e 's|.[fF]$|.c|' -e 's|.*/||'` csrc="$csrc $cf" done echo f2c $incs $fsrc f2c $incs $fsrc f2c_status=$? if test $f2c_status != 0; then rm -f $csrc exit $f2c_status fi fi if test "$outfile"; then cout="-o `$CYGPATH_W $outfile`" fi if test x$makedll = xyes; then echo $F2C_CC $options $cincs $csrc $objs $cout $f2clib -link $linkflags $F2C_CC $options $cincs $csrc $objs $cout $f2clib -link $linkflags else echo $F2C_CC $options $cincs $csrc $objs $cout $mainobj $f2clib $F2C_CC $options $cincs $csrc $objs $cout $mainobj $f2clib fi cl_status=$? rm -f $csrc exit $cl_status CoinMP-1.8.3/BuildTools/compile_f2c/INSTALL0000644000175000017500000000411411053565746016623 0ustar renereneThe following instructions assume that you already set up Cygwin/Msys to know about the Microsoft 'cl' compiler and 'nmake'. 1. Download the f2c.exe Fortran to C compiler from netlib from http://www.netlib.org/f2c/mswin/f2c.exe.gz uncompress it, and put it somewhere in your PATH (e.g. into /usr/local/bin). Make sure it is executable. 2. Download the source code for the f2c runtime library from http://www.netlib.org/f2c/libf2c.zip and put it into a directory in which you want to have a subdirectory where you want to have the subdirectory "libf2c" containing the runtime library, e.g., into /usr/local/lib. Uncompress this file, for example by "unzip libf2c.zip" in a Cygwin or MSys window. 3. Compile the Fortran runtime library: In the source directory (libf2c), type 'nmake -f makefile.vc all' If you encounter an error during the compilation of "err.c" due to a missing unistd.h, edit the makefile.vc file and add -DNO_ISATTY to the CFLAGS (line 9). If you encounter an error during the compilation of "arithchk.c" (involving the "comptry.bat" file), edit the makefile.vc file and delete the word "comptry.bat" in the 4th from last line. NOTE: If you want to generate debug code (using --enable-debug with configure), you need to change the makefile.vc file: Change the definition of CFLAGS so that it no longer contains '-Ot1' but '-MTd' instead. 4. Edit the script "compile_f2c" in this directory so that the variable "f2clibdir" at the beginning is set to the directory containing the libf2c runtime library. (If you installed it in /usr/local/lib as suggested above, it is already defined correctly.) 5. Put the compile_f2c script somewhere into your path, e.g., into /usr/local/bin - make sure it is executable. 6. To test it, copy the lines at the end of this file into a Fortran source file (say, bla.f), and type compile_f2c -o f2ctest bla.f Running the executable f2ctest.exe hopefully makes you happy. ---------------------- 8< ---------------- program test write (*,*) "It works!" end CoinMP-1.8.3/BuildTools/run_autotools0000755000175000017500000003217611610272367016255 0ustar renerene#!/bin/sh # Copyright (C) 2006, 2007, 2008, 2009, 2010 International Business Machines # and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # It is part of the BuildTools project in COIN-OR (www.coin-or.org) # ## $Id: run_autotools 2365 2011-07-16 11:24:39Z stefan $ # # Author: Andreas Waechter IBM 2006-04-14 # Modified: Lou Hafer SFU 2010-06-11 # Mods to allow variations from standard package structure. Decision to # process a configure.ac file is based on presence of COIN macros. # Directories specified on the command line are recursively searched # for configure.ac files. Install-sh signals an independent unit. # Modified: Lou Hafer SFU 2010-07-08 # More mods to maintain flexibility but be a bit less aggressive about # forcing installation of autotools auxilliary scripts. Also add some # command line options and restore ability to specify individual # directories on the command line. # run_autotools takes care of running the autotools (automake, autoconf, # and helpers) and also makes a few arrangements for when configure and # libtool execute at configuration, build, and installation. # Run_autotools can be given a set of directories on the command line; if none # are specified, it assumes the current directory (`,'). Subdirectories are # searched for configure.ac files unless suppressed with the -nr option. # Autotools will consider a directory for processing if any AC_COIN_ macro is # present in the configure.ac file. Should it be necessary to fool this script # into processing a file that otherwise contains no COIN macros, just add a # line with AC_COIN_. The resulting list is winnowed to remove directories # specified in COIN_SKIP_PROJECTS. # Each directory processed gets a temporary link to BuildTools, unless a # BuildTools subdirectory is already present. Mostly this is a convenience, but # one thing makes it mandatory: Many Makefile.am files in COIN use an include # directive to pull in BuildTools/Makemain.inc. There's no way I (lh) can see # to alter the path that's hardcoded in the include directive. Just to make it # more interesting, COIN projects are generally constructed with the assumption # that BuildTools will be one or two directories up, so you'll see things like # `include ../BuildTools/Makemain.inc'. run_autotools doesn't understand this # hierarchy, so it keeps all those temporary BuildTools links until the very # end. That way, it works with the old-style COIN organisation where a # BuildTools directory is pulled in as an external in the top directory of a # package, and with the new-style independent organisation, where there may be # only a single copy of BuildTools out there somewhere. # If any subdirectory queued for processing is found to contain an install-sh # script, it is treated as an independent unit (i.e., you can run `make # install' from this directory) and the set of auxilliary scripts is refreshed # from BuildTools. You can force installation of install-sh and associated # scripts with the -i option. It's good to read the autoconf documentation for # AC_CONFIG_AUX_DIR if this doesn't make sense to you. # Make sure we bail out if there is an error set -e # Define a cleanup function. We'll set a trap below, just before we start to # do actual work. cleanupOnErrorExit () { for link in $buildtoolsLinks; do echo Trap: removing $link rm -f $link done cd $startDir } # Note that vanilla sh doesn't like negative exit values. # Determine the location of run_autotools. If there are no '/' chars in # the command name, we're running in the current directory (almost certainly # not what's wanted). Otherwise, strip the command name, leaving the prefix. # Convert the prefix to an absolute path, if needed, and clean it up, removing # `XXX/..', '/./', '//' sequences. startDir=`pwd` if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then runautotoolDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` else runautotoolDir='.' fi if expr "$runautotoolDir" : '/.*' >/dev/null 2>&1 ; then : else runautotoolDir=$startDir/$runautotoolDir fi while expr "$runautotoolDir" : '.*/\.\./.*' >/dev/null 2>&1 ; do runautotoolDir=`echo $runautotoolDir | sed -e 's,/[^/][^/]*/\.\./,/,'` done runautotoolDir=`echo $runautotoolDir | sed -e 's,/\./,/,g' -e 's,//,/,g'` # Make sure we're using the correct versions of the autotools. Failure to # satisfy this requirement is a fatal error. ver_autoconf='2.59' ver_automake='1.9.6' ver_libtool='1.5.22' EGREP='grep -E' # Check if the correct version of the autotools is used if test x$AUTOTOOLS_DIR = x; then AUTOTOOLS_DIR=$HOME fi grep_version=`echo $ver_autoconf | sed -e 's/\\./\\\\\\./g'` if autoconf --version > confauto.out 2>&1 ; then : ; else echo "autoconf $ver_autoconf not available" rm -f confauto.out exit 2 fi if $EGREP $grep_version confauto.out >/dev/null 2>&1; then :; else echo You are not using the correct version of autoconf rm -f confauto.out exit 2 fi rm -f confauto.out autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test $autoconf_dir = `cd $AUTOTOOLS_DIR/bin; pwd`; then :; else echo autoconf is not picked up from the correct location exit 2 fi grep_version=`echo $ver_automake | sed -e 's/\\./\\\\\\./g'` if automake --version > confauto.out 2>&1 ; then : ; else echo "automake $ver_automake not available" rm -f confauto.out exit 2 fi if $EGREP $grep_version confauto.out >/dev/null 2>&1; then :; else echo You are not using the correct version of automake rm -f confauto.out exit 2 fi rm -f confauto.out autoconf_dir=`which automake | sed -e 's=/automake=='` autoconf_dir=`cd $autoconf_dir; pwd` if test $autoconf_dir = `cd $AUTOTOOLS_DIR/bin; pwd`; then :; else echo automake is not picked up from the correct location exit 2 fi # Failure to find the correct version of libtool isn't fatal here, but # the user should be warned. grep_version=`echo $ver_libtool | sed -e 's/\\./\\\\\\./g'` ltfile=$AUTOTOOLS_DIR/share/libtool/ltmain.sh if test -r $ltfile; then :; else echo WARNING: Cannot find libtool shell $ltfile fi if $EGREP $grep_version $ltfile >/dev/null 2>&1; then :; else echo WARNING: You are not using the correct version of libtool fi # Set up to process parameters. No parameters is the default. printHelp=0 doRecurse=1 forceScripts=0 userSpecifiedDirs=0 dirsToProcess= # Process the parameters. A parameter without an opening `-' is assumed to be # a spec for a directory to be processed. while test $# -gt 0 && test $printHelp = 0 ; do case "$1" in -h* | --h* ) printHelp=1 ;; -nr* | --no-recursion ) doRecurse=0 ;; -i | --independent ) forceScripts=1 doRecurse=0 ;; -* ) echo "$0: unrecognised command line switch '"$1"'." printHelp=1 ;; * ) dirsToProcess="$dirsToProcess $1" userSpecifiedDirs=1 ;; esac shift done # Help? if test $printHelp = 1 ; then cat </dev/null 2>&1 ; then dirs="$dirs $dir" else echo " Skipping foreign configure.ac in $dir." fi done # Now compare against the skip entries in COIN_SKIP_PROJECTS. To match the # entries we just collected, add `./' to the front of each skip entry. candDirs=$dirs if test x${COIN_SKIP_PROJECTS+set} = xset ; then dirs= for dir in $COIN_SKIP_PROJECTS ; do skip_dirs="$skip_dirs ./$dir" done for dir in $candDirs ; do skip=0 for skipdir in $skip_dirs ; do if test $dir = $skipdir ; then skip=1 break fi done if test $skip = 0 ; then dirs="$dirs $dir" else echo " Skipping $dir listed in COIN_SKIP_PROJECTS." fi done fi fi # Set a trap so that we'll clean up any links on exit, for whatever reason. # Note that this executes on normal exit, too, so don't do anything rash. topLink= subLink= trap 'exit_status=$? cleanupOnErrorExit exit $exit_status' 0 # And now the main event. Process each directory. echo "Running autotools in $dirs" autotoolsFiles="config.guess config.sub depcomp install-sh ltmain.sh missing" m4Files="$AUTOTOOLS_DIR/share/aclocal/libtool.m4" buildtoolsLinks= for dir in $dirs; do if test -r $dir/configure.ac; then cd $dir echo "Processing $dir ..." # Do we need a BuildTools subdirectory here? The criteria is that install-sh # already exists, or Makefile.am (which may include Makemain.inc), or we're # forcing installation of the configure scripts. Assuming we need BuildTools, # what BuildTools should we use? If a BuildTools is already present, that's # it. Otherwise, assume that runautotooldDir is BuildTools. Allow that the # user may have linked to a BuildTools. needScripts=0 if test -f install-sh || test $forceScripts = 1 ; then needScripts=1 fi if test -f Makefile.am || test $needScripts = 1 ; then if test -d BuildTools || test -L BuildTools ; then createLink=0 toolsDir=`pwd`/BuildTools else createLink=1 toolsDir=$runautotoolDir fi echo " BuildTools directory: $toolsDir" # Test to be sure that run_autotools is coming from the BuildTools directory. if test $createLink = 0 && test "$toolsDir" != "$runautotoolDir" ; then echo "WARNING: using run_autotools from $runautotoolDir" echo " but BuildTools is $toolsDir." echo " Consider carefully if this is what you wanted to do." fi # coin.m4 should live in the same directory; failure is fatal. if test ! -r $toolsDir/coin.m4 ; then echo "Cannot find Coin autotools macro file $toolsDir/coin.m4." echo "It should be in the BuildTools directory." exit 1 fi # Install a link, if needed. if test $createLink = 1 ; then ln -s $toolsDir BuildTools buildtoolsLinks="$buildtoolsLinks `pwd`/BuildTools" echo " creating temporary link for ./BuildTools -> $toolsDir" fi # And refresh the autotools scripts, if needed. if test $needScripts = 1 ; then echo " refreshing autotools scripts in this directory." for file in $autotoolsFiles ; do cp BuildTools/$file . done fi fi # Get on with running the autotools. echo " creating acinclude.m4 in $dir" cat $m4Files $toolsDir/coin.m4 > acinclude.m4 echo " running aclocal in $dir" if test -d m4; then aclocal -I m4 || exit 1 else aclocal || exit 1 fi if grep AC_CONFIG_HEADER configure.ac >/dev/null 2>&1; then echo " running autoheader in $dir" autoheader || exit 1 fi echo " running automake in $dir" automake || exit 1 echo " running autoconf in $dir" autoconf || exit 1 cd $startDir else # Serious confusion! Should not reach here. echo "*** No configure.ac file in $dir - SKIPPING! ***" fi done # Remove the links. Yeah, the trap will do this, but it never hurts to clean # up properly. if test -n "$buildtoolsLinks" ; then echo "Removing temporary links to BuildTools." for link in $buildtoolsLinks ; do # echo " removing temporary link for BuildTools: $link" rm $link done buildtoolsLinks= fi exit CoinMP-1.8.3/BuildTools/Makemain.inc0000644000175000017500000001150512504673677015634 0ustar renerene# Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makemain.inc 3482 2015-03-26 03:06:39Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) COIN_HAS_DOXYGEN = @COIN_HAS_DOXYGEN_TRUE@TRUE COIN_HAS_LATEX = @COIN_HAS_LATEX_TRUE@TRUE doxygen-docs: if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ doxygen doxydoc/doxygen.conf;\ fi;\ fi pdf-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/latex"; then \ if test "$(COIN_HAS_LATEX)" = TRUE; then \ cd doxydoc/latex;\ $(MAKE) pdf;\ cd -;\ fi;\ fi;\ fi clean-doxygen-docs: if test -d "doxydoc/"; then \ cd doxydoc ;\ rm -rf html latex *.log *.tag;\ fi install-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc"; \ $(INSTALL_DATA) @coin_doxy_tagname@ "$(DESTDIR)$(DocInstallDir)/@coin_doxy_tagname@";\ if test -f "doxydoc/latex/refman.pdf"; then \ $(INSTALL_DATA) doxydoc/latex/refman.pdf "$(DESTDIR)$(DocInstallDir)";\ fi;\ if test -d "doxydoc/html"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/search/" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc/search/"; \ $(INSTALL_DATA) doxydoc/html/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc";\ $(INSTALL_DATA) doxydoc/html/search/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc/search";\ fi;\ fi;\ fi uninstall-doxygen-docs: if test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/"; then \ rm -rf "$(DESTDIR)$(DocInstallDir)/doxydoc/"; \ fi if test -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; then \ rm -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; \ fi all-doxygen-docs: for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) doxygen-docs) \ fi ; \ done ; clean-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) clean-doxygen-docs) \ fi ; \ done ; install-all-doxygen-docs: all-doxygen-docs for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) install-doxygen-docs) \ fi ; \ done ; uninstall-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) uninstall-doxygen-docs) \ fi ; \ done ; install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## if MAINTAINER_MODE # Make sure acinclude is using most recent coin.m4 $(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date $(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh cp $< $@ $(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing cp $< $@ $(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess cp $< $@ $(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub cp $< $@ $(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp cp $< $@ $(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh cp $< $@ # Take care of updating externals (if Dependencies file exists) if HAVE_EXTERNALS $(top_builddir)/Makefile: .Dependencies-stamp .Dependencies-stamp: $(srcdir)/Dependencies cd $(srcdir); BuildTools/set_externals Dependencies touch .Dependencies-stamp update-externals: .Dependencies-stamp cd $(srcdir); svn update endif endif if HAVE_EXTERNALS EXTRA_DIST += Dependencies DISTCLEANFILES += .Dependencies-stamp endif DISTCLEANFILES += $(VPATH_DISTCLEANFILES) .PHONY: install-doc uninstall-doc update-externals CoinMP-1.8.3/BuildTools/share/0000755000175000017500000000000012600453454014501 5ustar renereneCoinMP-1.8.3/BuildTools/share/config.site0000644000175000017500000002747311527752304016654 0ustar renerene# This file contains site-specific settings for the configure scripts. # It can be used to specify options that are otherwise given to the # configure script as command line arguments or environment variables. # # This file must be located either in $prefix/share or $prefix/etc, where # prefix is the installation location. For the COIN packages, this is # by default the directory where the configure of the main package is run, # unless the --prefix option was given to the configure script. # Alternatively, one can set the environment variable CONFIG_SITE to the full # path to this file. # # This template file also serves as documentation for many available # configure options for COIN-OR projects. Please be aware of the following # conventions that translate the command line format into the one for the # config.site file: # # Command line version config.site version # # --with-NAME1-NAME2 with_NAME1_NAME2=yes # --with-NAME1-NAME2="VALUE" with_NAME1_NAME2="VALUE" # --without-NAME1-NAME2 with_NAME1_NAME2=no # --enable-NAME1-NAME2 enable_NAME1_NAME2=yes # --enable-NAME1-NAME2="VALUE" enable_NAME1_NAME2="VALUE" # --disable-NAME1-NAME2 enable_NAME1_NAME2=no # # Here, "NAME1-NAME2" is some string corresponding to a particular option; # note that dashes (-) are converted into underscores(_). VALUE is the # string that is the actual argument to an option. # Other variables that are directly assigned in the configure command line, # such as CXX=g++, are also written in this way in the config.site file. # # Note: This is a /bin/sh script, setting variables. There must be no # space between "=" and the value, and if required, a quotation must be # used. # # In the following we show some arguments for configure that can be used # for the COIN configure scripts. ########################################################################## # C++ compiler choice and options # ########################################################################## # C++ compiler name #CXX=g++ # C++ compiler options, overwriting configure's default choice #CXXFLAGS='-O3 -pipe' # Additional C++ compiler options that are added to configure's default # choice #ADD_CXXFLAGS='-pg' # Additional preprocessor definitions for the C++ compiler #CXXDEFS='-DZEROFAULT' # Sometimes it is desirable to compile some projects in debug mode, # and some in default optimized mode (see also enable_debug_compile # below). In those cases, you can set the separate C++ compiler # options for optimized and debug compilation using the following # variables: #OPT_CXXFLAGS='-O3 -pipe' #DBG_CXXFLAGS='-g -pipe' # If you are using MPI, it is best to specify the underlying C++ # compiler for the configure script in CXX (so that it can figure out # the default compiler options and test them), but then to tell the # configure script the actual MPI compiler (wrapper) using the # following variable #MPICXX='mpiCC' # If a project's library is generated from C++, but the compilers used # for linking is a C or Fortran compiler, one has to provide this # compilers with the C++ runtime libraries. This is done with the # following variable: #CXXLIBS='-lstdc++ -lm' ########################################################################## # C compiler choice and options # ########################################################################## # C compiler name #CC=gcc # C compiler options, overwriting configure's default choice #CFLAGS='-O3 -pipe' # Additional C compiler options that are added to configure's default choice #ADD_CFLAGS='-pg' # Additional preprocessor definitions for the C compiler #CDEFS='-DZEROFAULT' # Sometimes it is desirable to compile some projects in debug mode, # and some in default optimized mode (see also enable_debug_compile # below). In those cases, you can set the separate C compiler # options for optimized and debug compilation using the following # variables: #OPT_CFLAGS='-O3 -pipe' #DBG_CFLAGS='-g -pipe' # If you are using MPI, it is best to specify the underlying C # compiler for the configure script in CC (so that it can figure out # the default compiler options and test them), but then to tell the # configure script the actual MPI compiler (wrapper) using the # following variable #MPICC='mpicc' ########################################################################## # Fortran compiler choice and options # ########################################################################## # Fortran compiler name #F77=gfortran # Fortran compiler options, overwriting configure's default choice #FFLAGS='-O3 -pipe' # Additional Fortran compiler options that are added to configure's default # choice #ADD_FFLAGS='-pg' # Sometimes it is desirable to compile some projects in debug mode, # and some in default optimized mode (see also enable_debug_compile # below). In those cases, you can set the separate Fortran compiler # options for optimized and debug compilation using the following # variables: #OPT_FFLAGS='-O3 -pipe' #DBG_FFLAGS='-g -pipe' # If you are using MPI, it is best to specify the underlying Fortran # compiler for the configure script in F77 (so that it can figure out # the default compiler options and test them), but then to tell the # configure script the actual MPI compiler (wrapper) using the # following variable #MPIF77='mpif77' ########################################################################## # Utility programs and their options # ########################################################################## # Program for creating and extracting archives #AR=ar # Program for listing symbols in a binary #NM=nm ########################################################################## # Flags for setting compilation and configuration modes # ########################################################################## ##### INSTALLATION LOCATION # This --prefix flag determines where the binaries etc. are going to # be installed. By default, this is equal to the directory where # 'configure' is run, so that the 'bin/', 'lib/' etc. directories are # created as subdirectories there. One could also choose other # destinations, but keep in mind that some COIN packages use the same # COIN "sub-projects", but possibly different and conflicting # versions. #prefix=$HOME/MyCOIN ##### COMPILATION MODE UNDER CYGWIN # This options can only be used under Cygwin, and it has the following # possible choices: # - mingw (default): Use the GNU compilers to compile binaries that # can be run independently of Cygwin (particularly without # Cygwin1.dll) # - msvc: Use the "native" Windows compilers, such as cl, ifort # - no: Use GNU compilers to generate Cygwin-specific binaries. #enable_doscompile=msvc ##### SKIPPING CONFIGURATION AND COMPILATION OF SUBPROJECTS # It is possible to skip the configuration and compilation of COIN # projects in a package, even when the source code for the subproject # is there. For this, list the directory names that are supposed to # be skipped in the variable #COIN_SKIP_PROJECTS="Bcp Couenne" ##### DEBUG COMPILATION # Switch on debug compilation for all projects. (Note that this will also # switch to the usage of static instead of shared libraries, see # enable_shared below) #enable_debug=yes # Switch on debug compilation only for a specific project is done with # the command line flag enable-debug-project, where "project" is the string # with the project name (say, Clp, for the example). #enable_debug_clp=yes # Similarly, if the global enable-debug is set, we can switch it off for a # particular project, using #enable_debug_clp=no # Each project can make use of a project-specific "checklevel". It # depends on the project manager, if and how this is used. The level # checklevel is specified with the --with-PROJECT-checklevel, where # PROJECT is the lower-case string of the project name. For Ipopt, # this looks like #with_ipopt_checklevel=1 # Each project can make use of a project-specific "verbosity" level. # It depends on the project manager, if and how this is used. The # level checklevel is specified with the --with-PROJECT-verbosity, # where PROJECT is the lower-case string of the project name. For # Ipopt, this looks like #with_ipopt_verbosity=1 ##### CREATING SHARED VS. STATIC LIBRARIES # By default, projects that are compiled in optimized mode, produce # shared libraries (if supported), and those compiled in debug mode, # produce static libraries. This behavior can be changed using the # following options: # disable shared mode: compile every library as static #enable_shared=no # disable static mode: compile every library as shared #enable_static=no # enable shared mode: compile always a shared library (possibly in # addition to a static one) #enable_shared=yes # enable shared mode: compile always a static library (possibly in # addition to a shared one) #enable_static=yes ##### MAINTAINER MODE # Project developers might want to make changes to the autotools files. # Using --enable-maintainer-mode enables a number of automatic updates, # including: # - regeneration of Makefiles if Makefile.am is changes, # - regeneration and rerunning of configure script if required # - updating the svn externals if the Externals file has changed #enable_maintainer_mode ########################################################################## # Third-Party Codes and Packages # ########################################################################## ##### GENERIC FLAGS # Use the following if we want to have configure check for GNU packages # (such as zlib, bzlib, and readline) #enable_gnu_packages=yes # To use some third-party libraries, such as LP solvers, one needs to # specify both the directory with all header files as well as the # linker flags for linking with the library. This is done with the # --with-LIB-incdir and --with-LIB-lib configure flags, where "LIB" is # replaced by the lower-case short-form of the library. A possibly # incomplete list of choices for LIB in the current COIN-OR projects is: # cplex, gurobi, mosek, soplex, xpress. # For Cplex, one might set the following: #with_cplex_incdir='/usr/ilog/cplex90/include/ilcplex' #with_cplex_lib='-L/usr/ilog/cplex90/lib/static_pic -lcplex -lpthread' ##### FLAGS FOR SPECIFIC LIBRARIES IN THIRDPARTY # For some third-party dependencies, COIN supports automatic build # procedures, for which the user can download the external source code # into appropriate subdirectories in a "ThirdParty" subdirectory. But # the user might want to specify locations of already precompiled versions # of those dependencies. Those flags are discussed next. ### BLAS # Flag indicating where to find Blas. If --with-blas is not used, # the configure script will try a few default locations of Blas, and # if it doesn't find Blas, it will test if the Blas source files are # in ThirdParty/Blas. If so, those will be compiled, otherwise we # assume that Blas is not available. # # Specify precompiled Blas libraries via linker flags: #with_blas="-lf77blas -latlas /usr/lib64/libg2c.so" # Specify that Blas should be compiled within the #with_blas=BUILD # Specify that Blas should not be used #with_blas=no ### LAPACK # Flag indicating where to find Lapack. If --with-lapack is not used, # the configure script will try a few default locations of Lapack, and # if it doesn't find Lapack, it will test if the Lapack source files are # in ThirdParty/Lapack. If so, those will be compiled, otherwise we # assume that Lapack is not available. # # Specify precompiled Lapack libraries via linker flags: #with_lapack="-L$HOME/lib -lmylapack" # Specify that Lapack should be compiled within the #with_lapack=BUILD # Specify that Lapack should not be used #with_lapack=no CoinMP-1.8.3/BuildTools/ltmain.sh0000755000175000017500000057753010430173037015236 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/BuildTools/config.guess0000755000175000017500000012706310637360060015726 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/BuildTools/commit_new_release0000755000175000017500000001673711510516042017174 0ustar renerene#!/bin/sh # Copyright (C) 2010 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # It is part of the BuildTools project in COIN-OR (www.coin-or.org) # # $Id: commit_new_release 2070 2011-01-04 04:03:46Z lou $ # # Author: Andreas Waechter IBM 2007-06-21 # Modified by: Lou Hafer SFU 2008-04-17 # Lou Hafer SFU 2010-06-29 major rewrite #set -x -v set -e # Know thy self. If there are no '/' chars in the command name, we're running # in the current directory. Otherwise, strip the command name, leaving the # prefix. Coin-functions is expected to live in the same directory. As of # the original version (100602), this script doesn't need coin-functions, # but this still has some value as a consistency check. if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` else cmdDir='.' fi cmdDir=`cd $cmdDir ; pwd` if test -r $cmdDir/coin-functions ; then . $cmdDir/coin-functions else echo "Cannot find utility functions file coin-functions; exiting." fi # We need at least one parameter. The default is a dry run (dryRun = 1). printHelp=0 dryRun=1 dirToCommit= if test "$#" -eq 0; then printHelp=1 else # Process the parameters. A parameter without an opening `-' is assumed to be # the spec for the directory to be committed. (Strip any trailing '/'. Some # people add it, but the script doesn't expect it.) while test $# -gt 0 && test $printHelp = 0 ; do case "$1" in -h* | --h*) printHelp=1 ;; -c* | --c*) dryRun=0 ;; -*) echo "$0: unrecognised command line switch '"$1"'." printHelp=1 ;; *) dirToCommit=`echo $1 | sed -e 's,/$,,'` ;; esac shift done fi # What are we committing? if test -z "$dirToCommit" ; then printHelp=1 fi if test $printHelp = 1 ; then cat < By default, commit_new_release is a dry run, printing the commands that will be executed. When you're confident that everything looks right, use the -c (--commit) flag to commit the release. EOF exit 1 fi # Remember what was done during generation of the new release. if test -r $dirToCommit/.new_release_data; then . $dirToCommit/.new_release_data else echo '' echo "Error: the file .new_release_data is not present in $dirToCommit." echo 'Are you running commit_new_release in the same directory where you' echo 'ran prepare_new_release?' echo '' exit 1 fi # Confirm that we're in the proper directory. currDir=`pwd` if test "$currDir/$dirToCommit" != "$topBuildDir" ; then echo "According to $dirToCommit/.new_release_data, the release candidate was assembled" echo "in $topBuildDir." echo "You have asked to commit $currDir/$dirToCommit." echo "There is some confusion. Repository is unchanged." exit 1 fi if test $dryRun = 1 ; then echo "Dry run; testing commit of $dirToCommit." else echo "Committing $dirToCommit." fi # Change to the checkout directory. cd $coDir # If there are externals set on this directory, confirm that # .Externals.original is present so that we can restore them later. releaseExternals=`svn propget svn:externals .` if test -n "$releaseExternals" ; then if test -r .Externals.original ; then : else echo "This project has externals, but no .Externals.original file" echo "is present to restore them. Repository is unchanged." exit 1 fi fi # Make some short-form URLs by stripping the COIN URL base. stableURLshort=`echo $stableURL | sed -e "s,$coinURL/\(.*\),\1,"` releaseURLshort=`echo $releaseURL | sed -e "s,$coinURL/\(.*\),\1,"` # Do we have to svn add Dependencies? If this query comes up with a leading # `?', the answer is yes. If Dependencies is entirely absent or unchanged, # we'll get a null string. If it's modified, we'll have a leading `M'. dependStatus=`svn status Dependencies` if expr "$dependStatus" : '?.*Dependencies.*' >/dev/null 2>&1 ; then cmd='svn add Dependencies' echo $cmd if test $dryRun = 0 ; then eval $cmd fi fi # Now, do we really need to to a temporary commit? BuildTools is the poster # child, there are no changes at time of writing (100629). Do an svn status # on the checkout directory and see if anything comes up as modified. if svn status $coDir | egrep '^M' 2>&1 >/dev/null ; then doCommit=yes else doCommit=no fi if test $doCommit = yes ; then # Commit the release to stable so we can do a repository-side copy to create # the release. echo '' echo "===> Temporarily committing release candidate to $stableURLshort ..." echo '' rev_num_before=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'` echo "Revision number before commit: $rev_num_before" cmd="svn ci -m \"temporarily committing release candidate\"" echo $cmd if test $dryRun = 0 ; then eval $cmd fi # Update to confirm the commit. Avoid pulling in externals --- if we're doing # multiple commits of new releases, they may not exist. As it stands, the # main purpose of this call is to allow us to easily obtain the current # revision. # It might be useful to strengthen this and check that the value # is what we're expecting --- one greater than the revision before # commit. `--ignore-externals' could be made provisional on the existence # of all externals by passing a boolean through .new_release_data. This # would strengthen the update, in that the update would confirm existence # of the externals. cmd='svn update --ignore-externals' echo $cmd if test $dryRun = 0 ; then eval $cmd fi rev_num=`svn info . | grep -E '^Revision:' | sed -e 's|Revision: ||'` echo "Current revision number is: $rev_num" fi # End preparatory commit. # Create the release with a repository-side copy. echo '' echo "===> Creating new release $releaseURLshort from $stableURLshort (rev $rev_num) ..." echo '' cmd="svn copy -m \"creating $releaseURLshort from $stableURLshort (rev $rev_num)\" $stableURL $releaseURL" echo $cmd if test $dryRun = 0 ; then eval $cmd fi # Restore the original stable branch. if test $doCommit = yes ; then # And restore the stable branch to its original condition. Start by reverting # to the original externals. if test -r .Externals.original ; then echo '' echo '===> Restoring original externals ...' echo '' cmd="svn propset -F .Externals.original svn:externals ." echo $cmd if test $dryRun = 0 ; then eval $cmd rm .Externals.original fi fi # For every .bak file that we created, revert it. if test -n "$bak_files" ; then echo '' echo '===> Restoring modified files ...' echo '' for i in $bak_files; do cmd="cp $i.bak $i ; rm $i.bak" if test $dryRun = 1 ; then echo "$cmd" else eval $cmd fi done fi # Rebuild configure and Makefile.in files. echo '' echo '===> Executing run_autotools to restore configuration files ...' echo '' curdir=`pwd` cd $topBuildDir cmd="./BuildTools/run_autotools" echo $cmd if test $dryRun = 0 ; then eval $cmd fi cd "$curdir" # Commit the restored stable branch. echo '' echo "===> Committing restored $stableURLshort ..." echo '' cmd="svn ci -m \"restoring $stableURLshort\"" echo $cmd if test $dryRun = 0 ; then eval $cmd fi fi # End restorative commit. cd $topBuildDir cmd="rm .new_release_data" if test $dryRun = 0 ; then eval $cmd fi cd $startDir echo '' echo "Done, new release $releaseURLshort created." echo '' echo "You can now delete the directory $topBuildDir including subdirectories" CoinMP-1.8.3/BuildTools/missing0000755000175000017500000002540610430173037015000 0ustar renerene#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/BuildTools/install-sh0000755000175000017500000002202110430173037015373 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/BuildTools/coin-functions0000644000175000017500000005022312467317470016272 0ustar renerene # Utility function definitions for the various COIN scripts. # Copyright (c) 2010 Lou Hafer Simon Fraser University # All Rights Reserved. # This file is distributed under the Eclipse Public License. # It is part of the BuildTools project in COIN-OR (www.coin-or.org) # # $Id$ # Functions to disassemble svn URLs and extract relevant bits, and utilities # to find the best (most recent) stable and release URLs, calculate libtool # version numbers, and compare URLs for compatibility based on major and minor # version. Complicated because we have to account for trunk/stable/release and # for the variant syntax of Data and ThirdParty URLs. For your normal project, # it's # https://projects.coin-or.org/svn/ProjName/trunk # https://projects.coin-or.org/svn/ProjName/stable/M.m # https://projects.coin-or.org/svn/ProjName/releases/M.m.r # with the proviso that sometimes it's # https://projects.coin-or.org/svn/ProjName/SubProj/trunk # etc. # For ThirdParty, it's just like a normal project, except the prefix string # is longer: # https://projects.coin-or.org/svn/BuildTools/ThirdParty/ProjName # Data is the real pain. Prior to 20101103 (1.0.x series), it had this form: # https://projects.coin-or.org/svn/Data/trunk/ProjName # https://projects.coin-or.org/svn/Data/stable/M.m/ProjName # https://projects.coin-or.org/svn/Data/releases/M.m.r/ProjName # After 20101103 (1.1 and subsequent), it uses the same layout as ThirdParty, # namely /Data/Projname/. Macros below # will cope, but really you should be using pre-1.1 Data anyway. # Extract the COIN base from the URL, up to svn. Just in case it ever changes. # usage: baseURL=`extractBaseURL $svnURL` extractBaseURL () { exbu_baseURL=`echo $1 | sed -n -e 's|\(.*/svn\)/.*$|\1|p'` echo "$exbu_baseURL" } # Extract branch type (trunk/stable/release) from the URL. # usage: branchType=`extractTypeFromURL $svnURL` extractTypeFromURL () { etfu_type="invalid" case "$1" in */trunk* ) etfu_type=trunk ;; */stable/* ) etfu_type=stable ;; */releases/* ) etfu_type=release ;; esac echo $etfu_type } # Determine if this is a `normal' URL, defined as not Data, ThirdParty, or # BuildTools itself. ThirdParty lives in BuildTools as of 100628, so the # condition is redundant. Returns yes or no. # 101105 Exclude CoinBazaar, which follows the Data pattern. May not be the # correct choice if any CoinBazaar projects use BuildTools # usage: isNormal=`isNormalURL $svnURL` isNormalURL () { case $1 in */BuildTools/* | */ThirdParty/* | */Data/* | */CoinBazaar/* ) echo "no" ;; *) echo "yes" ;; esac } # Extract the project from a svn URL. The trick, for `normal' projects, is to # handle CHiPPS, which has CHiPPS/Alps, Bcps, Blis. We can't assume the # project name does not contain '/'. The heuristic is to look for everything # between svn and one of trunk, stable, releases, or end of line. # usage: projName=`extractProjFromURL $svnURL` extractProjFromURL () { epfu_URL="$1" epfu_projPat='\([^/][^/]*\)' epfu_sfxPat='.*$' case "$epfu_URL" in */Data/trunk/* ) epfu_pfxPat=svn/Data/trunk/ ;; */Data/stable/* | */Data/releases/* ) epfu_pfxPat='svn/Data/[^/][^/]*/[0-9][0-9.]*/' ;; */Data/* ) epfu_pfxPat='svn/Data/' ;; */ThirdParty/* ) epfu_pfxPat=svn/BuildTools/ThirdParty/ ;; *) epfu_type=`extractTypeFromURL $epfu_URL` epfu_pfxPat='svn/' epfu_projPat='\(.*\)' case $epfu_type in trunk | stable | release ) epfu_sfxPat=$epfu_type'.*$' ;; * ) epfu_sfxPat='$' ;; esac ;; esac epfu_projName=`echo $epfu_URL | sed -n -e 's|.*/'$epfu_pfxPat$epfu_projPat$epfu_sfxPat'|\1|p'` epfu_projName=`echo $epfu_projName | sed -e 's|/$||'` echo "$epfu_projName" } # Extract the tail (directory) from a URL that specifies an external. Relevant # only for normal projects, where the external will be a subdirectory # of the project. Returns null for Data / ThirdParty / BuildTools. # usage: projName=`extractTailFromExt $extURL` extractTailFromExt () { etfe_tail= case "$1" in */Data/* ) ;; */BuildTools/ThirdParty/* ) ;; */BuildTools/* ) ;; */CoinBazaar/* ) ;; *) etfe_pfxPat= case "$1" in */trunk/* ) etfe_pfxPat='.*/trunk/' ;; */stable/* ) etfe_pfxPat='.*/stable/[0-9][0-9.]*/' ;; */releases/* ) etfe_pfxPat='.*/releases/[0-9][0-9.]*/' ;; esac etfe_tail=`echo $1 | sed -n -e 's|'$etfe_pfxPat'\(.*\)|\1|p'` ;; esac echo "$etfe_tail" } # CppAD uses a version string of the form YYYMMDD.rr. What a pain in the ass. # Hence the scattered exceptions below. # Extract the entire version string from a stable or release URL. Returns a # null string if handed a trunk URL or if there's no version in the URL. The # version number must have at least major.minor to match. # usage: version=`extractVersionFromURL $svnURL` extractVersionFromURL () { evfu_URL="$1" if expr "$evfu_URL" : '.*/stable/.*' >/dev/null 2>&1 || expr "$evfu_URL" : '.*/releases/.*' >/dev/null 2>&1 ; then if expr "$evfu_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then evfu_verPat='\([0-9][0-9.]*\)' else evfu_verPat='\([0-9][0-9]*\.[0-9][0-9.]*\)' fi evfu_sfxPat='.*$' evfu_proj=`extractProjFromURL $evfu_URL` case "$evfu_URL" in */Data/stable/* | */Data/releases/* ) evfu_pfxPat='svn/Data/[^/][^/]*/' ;; */ThirdParty/* ) evfu_pfxPat='svn/BuildTools/ThirdParty/[^/][^/]*/[^/][^/]*/' ;; */Data/* ) evfu_pfxPat='svn/Data/'$evfu_proj'/[^/][^/]*/' ;; *) evfu_pfxPat='svn/'$evfu_proj'/[^/][^/]*/' ;; esac evfu_verVer=`echo $1 | sed -n -e 's|.*/'$evfu_pfxPat$evfu_verPat$evfu_sfxPat'|\1|p'` echo "$evfu_verVer" else echo "" fi } # Replace the entire version string from a stable or release URL. A trunk # URL will be unmodified. newRev will not be accessed unless the URL is a # release. The version must have at least major.minor to match. # usage: newURL=`replaceVersionInURL $oldURL $newMajor $newMinor $newRev` # and just for CppAD, # usage: newURL=`replaceVersionInURL $oldURL $newMajor $newRev` replaceVersionInURL () { if expr "$1" : '.*/CppAD/.*' >/dev/null 2>&1 ; then isCppAD=yes else isCppAD=no fi if test $isCppAD = no ; then rviu_verPat='[0-9][0-9]*\.[0-9][0-9.]*' else rviu_verPat='[0-9][0-9.]*' fi if expr "$1" : '.*/stable/.*' >/dev/null 2>&1 ; then if test $isCppAD = no ; then rviu_newVersion=$2.$3 else rviu_newVersion=$2 fi elif expr "$1" : '.*/releases/.*' >/dev/null 2>&1 ; then if test $isCppAD = no ; then rviu_newVersion=$2.$3.$4 else rviu_newVersion=$2.$3 fi else rviu_newVersion= rviu_newURL=$1 fi if test -n "$rviu_newVersion" ; then rviu_newURL=`echo $1 | sed -n -e 's|^\(.*\)/'$rviu_verPat'\(.*\)$|\1/'$rviu_newVersion'\2|p'` fi echo $rviu_newURL } # Extract the major version number from a stable or release URL. Returns -1 if # handed a trunk URL or if there's no version in the URL # usage: majVer=`extractMajorFromURL $svnURL` extractMajorFromURL () { ejfu_URL="$1" if expr "$ejfu_URL" : '.*/stable/.*' >/dev/null 2>&1 || expr "$ejfu_URL" : '.*/releases/.*' >/dev/null 2>&1 ; then ejfu_majPat='\([0-9][0-9]*\)' if expr "$ejfu_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then ejfu_sfxPat='.*$' else ejfu_sfxPat='\.[0-9][0-9]*.*$' fi ejfu_proj=`extractProjFromURL $ejfu_URL` case "$ejfu_URL" in */Data/stable/* | */Data/releases/* ) ejfu_pfxPat='svn/Data/[^/][^/]*/' ;; */ThirdParty/* ) ejfu_pfxPat='svn/BuildTools/ThirdParty/[^/][^/]*/[^/][^/]*/' ;; */Data/* ) ejfu_pfxPat='svn/Data/'$ejfu_proj'/[^/][^/]*/' ;; *) ejfu_pfxPat='svn/'$ejfu_proj'/[^/][^/]*/' ;; esac ejfu_majVer=`echo $ejfu_URL | sed -n -e 's|.*/'$ejfu_pfxPat$ejfu_majPat$ejfu_sfxPat'|\1|p'` echo "$ejfu_majVer" else echo "-1" fi } # Extract the minor version number from a stable or release URL. Returns -1 if # handed a trunk URL or if there's no version in the URL. # The CppAD form (YYYYMMDD.rr) doesn't have a minor version number. # usage: minVer=`extractMinorFromURL $svnURL` extractMinorFromURL () { emfu_URL="$1" if expr "$emfu_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then echo "-1" elif expr "$emfu_URL" : '.*/stable/.*' >/dev/null 2>&1 || expr "$emfu_URL" : '.*/releases/.*' >/dev/null 2>&1 ; then emfu_minPat='[0-9][0-9]*\.\([0-9][0-9]*\)' emfu_sfxPat='.*$' emfu_proj=`extractProjFromURL $emfu_URL` case "$emfu_URL" in */Data/stable/* | */Data/releases/* ) emfu_pfxPat='svn/Data/[^/][^/]*/' ;; */ThirdParty/* ) emfu_pfxPat='svn/BuildTools/ThirdParty/[^/][^/]*/[^/][^/]*/' ;; */Data/* ) emfu_pfxPat='svn/Data/'$emfu_proj'/[^/][^/]*/' ;; *) emfu_pfxPat='svn/'$emfu_proj'/[^/][^/]*/' ;; esac emfu_minVer=`echo $emfu_URL | sed -n -e 's|.*/'$emfu_pfxPat$emfu_minPat$emfu_sfxPat'|\1|p'` echo "$emfu_minVer" else echo "-1" fi } # Extract the release (revision) number from a release URL. Returns -1 if # handed a trunk or stable URL # usage: minVer=`extractReleaseFromURL $svnURL` extractReleaseFromURL () { erfu_URL="$1" if expr "$erfu_URL" : '.*/releases/.*' >/dev/null 2>&1 ; then if expr "$erfu_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then erfu_relPat='[0-9][0-9]*\.\([0-9][0-9]*\)' else erfu_relPat='[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)' fi erfu_sfxPat='.*$' erfu_proj=`extractProjFromURL $erfu_URL` case "$erfu_URL" in */Data/releases/* ) erfu_pfxPat='svn/Data/[^/][^/]*/' ;; */ThirdParty/* ) erfu_pfxPat='svn/BuildTools/ThirdParty/[^/][^/]*/[^/][^/]*/' ;; */Data/*) erfu_pfxPat='svn/Data/'$erfu_proj'/[^/][^/]*/' ;; *) erfu_pfxPat='svn/'$erfu_proj'/[^/][^/]*/' ;; esac erfu_relVer=`echo $erfu_URL | sed -n -e 's|.*/'$erfu_pfxPat$erfu_relPat$erfu_sfxPat'|\1|p'` echo "$erfu_relVer" else echo "-1" fi } # Now some functions to locate the highest-numbered stable or release. # Return the URL of the most recent stable branch matching the parameters. # A value of -1 for major version is interpreted as `highest number' # Returns an empty string if no suitable stable branch exists. # usage: stableURL=`bestStable ` bestStable () { bstb_URL=$1 bstb_majVer=$2 # Construct a URL to send to the repository to list the stable branches. bstb_baseURL=`extractBaseURL $bstb_URL` bstb_proj=`extractProjFromURL $bstb_URL` case "$bstb_URL" in */Data/trunk/* ) bstb_listURL=$bstb_baseURL/Data/stable ;; */Data/* ) bstb_listURL=$bstb_baseURL/Data/$bstb_proj/stable ;; */ThirdParty/* ) bstb_listURL=$bstb_baseURL/BuildTools/ThirdParty/$bstb_proj/stable ;; * ) bstb_listURL=$bstb_baseURL/$bstb_proj/stable ;; esac bstb_rawls=`svn list $bstb_listURL | sort -nr -t. -k1,1 -k2,2` # echo "Raw ls: $bstb_rawls" # Filter the list of stable branches to remove any that do not match the # requested major version. Note that there's a / at the end of each URL. if test "$bstb_majVer" = "-1" ; then bstb_verPat='[0-9][0-9.]*/' elif expr "$bstb_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then bstb_verPat=$bstb_majVer'/' else bstb_verPat=$bstb_majVer'\.[0-9][0-9]*' fi bstb_filter= for bstb_ver in $bstb_rawls ; do if expr "$bstb_ver" : "$bstb_verPat" >/dev/null 2>&1 ; then bstb_filter="$bstb_filter $bstb_ver" fi done # echo "Filtered ls: $bstb_filter" # If there are any candidates left ... bstb_bestURL= if test -n "$bstb_filter" ; then # If we're dealing with old-style Data, we have to work a bit harder # to find our project. See if any of the filtered candidates contain # the correct project. case "$bstb_URL" in */Data/trunk/* | */Data/stable/* | */Data/releases/* ) bstb_projPat='.*'$bstb_proj'/.*' # echo "Pattern: $bstb_projPat" for bstb_ver in $bstb_filter ; do if expr "$bstb_ver" : "$bstb_verPat" >/dev/null 2>&1 ; then # echo " url: $bstb_listURL/$bstb_ver" bstb_svnls2="`svn list $bstb_listURL/$bstb_ver`" # echo " result: $bstb_svnls2" if expr "$bstb_svnls2" : "$bstb_projPat" >/dev/null 2>&1 ; then bstb_best=$bstb_ver # echo " best: $bstb_best" break fi fi done bstb_bestURL=$bstb_listURL/$bstb_best$bstb_proj ;; *) bstb_bestURL=`echo $bstb_filter | sed -n -e 's|\([^/]*/\).*$|\1|p'` bstb_bestURL=$bstb_listURL/$bstb_bestURL ;; esac fi echo $bstb_bestURL } # Return the URL of the most recent release matching the parameters. Returns # null if no suitable release exists. # A value of -1 for major or minor version is interpreted as `highest number' # A value of -1 for major version means that minor version is ignored. # usage: releaseURL=`bestRelease ` bestRelease () { bstb_URL=$1 bstb_majVer=$2 bstb_minVer=$3 # Construct a URL to send to the repository to list the releases. bstb_baseURL=`extractBaseURL $bstb_URL` bstb_proj=`extractProjFromURL $bstb_URL` case "$bstb_URL" in */Data/* ) bstb_listURL=$bstb_baseURL/Data/$bstb_proj/releases ;; */ThirdParty/* ) bstb_listURL=$bstb_baseURL/BuildTools/ThirdParty/$bstb_proj/releases ;; * ) bstb_listURL=$bstb_baseURL/$bstb_proj/releases ;; esac bstb_rawls=`svn list $bstb_listURL | sort -nr -t. -k1,1 -k2,2 -k3,3` # echo "Raw ls: $bstb_rawls" # Filter the list of releases to remove any that do not match the # requested major and minor version. if expr "$bstb_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then isCppAD=yes else isCppAD=no fi if test "$bstb_majVer" = "-1" ; then bstb_verPat='[0-9][0-9.]*/' else bstb_verPat=$bstb_majVer if test $isCppAD = no && test "$bstb_minVer" != "-1" ; then bstb_verPat="${bstb_verPat}\.$bstb_minVer" fi bstb_verPat="${bstb_verPat}"'\.[0-9][0-9]*/' fi # echo "Version pattern: $bstb_verPat" bstb_filter= for bstb_ver in $bstb_rawls ; do if expr "$bstb_ver" : "$bstb_verPat" >/dev/null 2>&1 ; then bstb_filter="$bstb_filter $bstb_ver" fi done # echo "Filtered ls: $bstb_filter" # If there are any candidates left ... bstb_bestURL= if test -n "$bstb_filter" ; then # If we're dealing with old-style Data, we have to work a bit harder to find our # project. See if any of the filtered candidates contain the correct # project. case "$bstb_URL" in */Data/trunk/* | */Data/stable/* | */Data/releases/* ) bstb_projPat='.*'$bstb_proj'/.*' # echo "Pattern: $bstb_projPat" for bstb_ver in $bstb_filter ; do if expr "$bstb_ver" : "$bstb_verPat" >/dev/null 2>&1 ; then # echo " url: $bstb_listURL/$bstb_ver" bstb_svnls2="`svn list $bstb_listURL/$bstb_ver`" # echo " result: $bstb_svnls2" if expr "$bstb_svnls2" : "$bstb_projPat" >/dev/null 2>&1 ; then bstb_best=$bstb_ver # echo " best: $bstb_best" break fi fi done bstb_bestURL=$bstb_listURL/$bstb_best$bstb_proj ;; *) bstb_bestURL=`echo $bstb_filter | sed -n -e 's|\([^/]*/\).*$|\1|p'` bstb_bestURL=$bstb_listURL/$bstb_bestURL ;; esac fi echo $bstb_bestURL } # Count the total number of stable branches for the project for the specified # major version number, up to the specified minor version number (libtool age). # Returns 0 if handed a trunk url, or if the url is BuildTools itself. # usage: calcLibtoolAge calcLibtoolAge () { cltc_URL=$1 cltc_majVer=$2 cltc_minVer=$3 # Construct a URL to send to the repository to list the stable branches. cltc_baseURL=`extractBaseURL $cltc_URL` cltc_proj=`extractProjFromURL $cltc_URL` case "$cltc_URL" in */Data/* ) cltc_listURL=$cltc_baseURL/Data/$cltc_proj/stable ;; */ThirdParty/* ) cltc_listURL=$cltc_baseURL/BuildTools/ThirdParty/$cltc_proj/stable ;; */BuildTools/* ) cltc_listURL= ;; * ) cltc_listURL=$cltc_baseURL/$cltc_proj/stable ;; esac # Run an ls and filter for standard stable branches (M.m or YYYYMMDD) if test -n "$cltc_listURL" ; then cltc_rawls=`svn list $cltc_listURL | sed -n -e '/[0-9][0-9.]/p'` # echo "Raw ls: $cltc_rawls" # Filter the list of stable branches to remove any that do not match the # requested major version. if expr "$cltc_URL" : '.*/CppAD/.*' >/dev/null 2>&1 ; then cltc_verPat=$cltc_majVer else cltc_verPat=$cltc_majVer'\.[0-9][0-9]*/' fi cltc_majfilter= for cltc_ver in $cltc_rawls ; do if expr "$cltc_ver" : "$cltc_verPat" >/dev/null 2>&1 ; then cltc_majfilter="$cltc_majfilter $cltc_ver" fi done # echo "Filtered ls (major version): $cltc_majfilter" # For the specific major version, filter the list that matched on major # version to remove any that exceed the minor version. cltc_minfilter= for cltc_ver in $cltc_majfilter ; do cltc_min=`echo $cltc_ver | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/'` if expr $cltc_min '<=' $cltc_minVer >/dev/null 2>&1 ; then cltc_minfilter="$cltc_minfilter $cltc_ver" fi done # echo "Filtered ls (minor version): $cltc_minfilter" cltc_cnt=`echo $cltc_minfilter | wc -w | sed -e 's/ //g'` else cltc_cnt=0 fi echo $cltc_cnt } # Count the total number of stable branches for the project up to the # specified major.minor version number (libtool current). Returns 0 if # handed a trunk url, or if the url is BuildTools itself. # usage: calcLibtoolCurrent calcLibtoolCurrent () { cltc_URL=$1 cltc_majVer=$2 cltc_minVer=$3 # Construct a URL to send to the repository to list the stable branches. cltc_baseURL=`extractBaseURL $cltc_URL` cltc_proj=`extractProjFromURL $cltc_URL` case "$cltc_URL" in */Data/* ) cltc_listURL=$cltc_baseURL/Data/$cltc_proj/stable ;; */ThirdParty/* ) cltc_listURL=$cltc_baseURL/BuildTools/ThirdParty/$cltc_proj/stable ;; */BuildTools/* ) cltc_listURL= ;; * ) cltc_listURL=$cltc_baseURL/$cltc_proj/stable ;; esac # Run an ls and filter for standard stable branches (M.m or YYYYMMDD) if test -n "$cltc_listURL" ; then cltc_rawls=`svn list $cltc_listURL | sed -n -e '/[0-9][0-9.]/p'` # echo "Raw ls: $cltc_rawls" # Filter the list of stable branches to find those with standard version # numbers. cltc_verPat='[0-9][0-9.]*/' cltc_stdfilter= for cltc_ver in $cltc_rawls ; do if expr "$cltc_ver" : "$cltc_verPat" >/dev/null 2>&1 ; then cltc_stdfilter="$cltc_stdfilter $cltc_ver" fi done # echo "Filtered ls (standard): $cltc_stdfilter" # Filter to remove major versions that exceed the specified version. cltc_majfilter= for cltc_ver in $cltc_stdfilter ; do cltc_maj=`echo $cltc_ver | sed -e 's/\([0-9][0-9]*\)\.[0-9].*/\1/'` if expr $cltc_maj '<=' $cltc_majVer >/dev/null 2>&1 ; then cltc_majfilter="$cltc_majfilter $cltc_ver" fi done # echo "Filtered ls (major version): $cltc_majfilter" # For the specific major version, filter the list that matched on major # version to remove any that exceed the minor version. cltc_minfilter= cltc_verPat='s/'$cltc_majVer'\.\([0-9][0-9]*\).*/\1/' for cltc_ver in $cltc_majfilter ; do cltc_min=`echo $cltc_ver | sed -e $cltc_verPat` if test $cltc_min = $cltc_ver || \ expr $cltc_min '<=' $cltc_minVer >/dev/null 2>&1 ; then cltc_minfilter="$cltc_minfilter $cltc_ver" fi done # echo "Filtered ls (minor version): $cltc_minfilter" cltc_cnt=`echo $cltc_minfilter | wc -w | sed -e 's/ //g'` else cltc_cnt=0 fi echo $cltc_cnt } # Function to compare the versions in a pair of URLs for equality. The criteria # is that the major and minor versions match. In theory, the release should # not matter. Probably should be a parameter. # usage: compareURLVersions compareURLVersions () { url1_major=`extractMajorFromURL $1` url1_minor=`extractMinorFromURL $1` url2_major=`extractMajorFromURL $2` url2_minor=`extractMinorFromURL $2` if test $url1_major = $url2_major && test $url1_minor = $url2_minor ; then echo "yes" else echo "no" fi } CoinMP-1.8.3/BuildTools/headers/0000755000175000017500000000000012600453454015012 5ustar renereneCoinMP-1.8.3/BuildTools/headers/configall_system_msc.h0000644000175000017500000001017311654311600021363 0ustar renerene/* This is the header file for the Microsoft compiler, defining all * system and compiler dependent configuration macros */ /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ /* #undef F77_DUMMY_MAIN */ #ifndef COIN_USE_F2C /* Define to a macro mangling the given C identifier (in lower and upper case), which must not contain underscores, for linking with Fortran. */ # define F77_FUNC(name,NAME) NAME /* As F77_FUNC, but for C identifiers containing underscores. */ # define F77_FUNC_(name,NAME) NAME #else /* Define to a macro mangling the given C identifier (in lower and upper case), which must not contain underscores, for linking with Fortran. */ # define F77_FUNC(name,NAME) name ## _ /* As F77_FUNC, but for C identifiers containing underscores. */ # define F77_FUNC_(name,NAME) name ## __ #endif /* Define if F77 and FC dummy `main' functions are identical. */ /* #undef FC_DUMMY_MAIN_EQ_F77 */ /* Define to 1 if you have the header file. */ /* #undef HAVE_ASSERT_H */ /* Define to 1 if you have the header file. */ #define HAVE_CASSERT 1 /* Define to 1 if you have the header file. */ #define HAVE_CCTYPE 1 /* Define to 1 if you have the header file. */ #define HAVE_CFLOAT 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_CIEEEFP */ /* Define to 1 if you have the header file. */ #define HAVE_CMATH 1 /* Define to 1 if you have the header file. */ #define HAVE_CSTDARG 1 /* Define to 1 if you have the header file. */ #define HAVE_CSTDIO 1 /* Define to 1 if you have the header file. */ #define HAVE_CSTDLIB 1 /* Define to 1 if you have the header file. */ #define HAVE_CSTRING 1 /* Define to 1 if you have the header file. */ #define HAVE_CTIME 1 /* Define to 1 if you have the header file. */ #define HAVE_CSTDDEF 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_CTYPE_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_DLFCN_H */ /* Define to 1 if function drand48 is available */ /* #undef HAVE_DRAND48 */ /* Define to 1 if you have the header file. */ /* #undef HAVE_FLOAT_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_IEEEFP_H */ /* Define to 1 if you have the header file. */ /* #define HAVE_INTTYPES_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_MATH_H */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if function rand is available */ #define HAVE_RAND 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_STDARG_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_STDINT_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_STDIO_H */ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if function std::rand is available */ #define HAVE_STD__RAND 1 /* Define to 1 if you have the header file. */ /* #define HAVE_STRINGS_H */ /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_TIME_H */ /* Define to 1 if you have the header file. */ /* #define HAVE_UNISTD_H */ /* Define to 1 if va_copy is avaliable */ /* #undef HAVE_VA_COPY */ /* Define to 1 if you have the header file. */ /* #undef HAVE_WINDOWS_H */ /* Define to 1 if you have the `_snprintf' function. */ #define HAVE__SNPRINTF 1 /* The size of a `double', as computed by sizeof. */ #define SIZEOF_DOUBLE 8 /* The size of a `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of a `int *', as computed by sizeof. */ #define SIZEOF_INT_P 4 /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 CoinMP-1.8.3/BuildTools/headers/configall_system.h0000644000175000017500000000072411063737131020527 0ustar renerene/* * This header file is included by the *Config.h in the individual * COIN packages when the code is compiled in a setting that doesn't * use the configure script (i.e., HAVE_CONFIG_H is not defined). * This header file includes the system and compile dependent header * file defining macros that depend on what compiler is used. */ #ifdef _MSC_VER # include "configall_system_msc.h" #else # error "Trying to use configall_system for unknown compiler." #endif CoinMP-1.8.3/BuildTools/prepare_new_stable0000755000175000017500000005276512214547251017205 0ustar renerene#!/bin/sh # Copyright (C) 2007 International Business Machines. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # It is part of the BuildTools project in COIN-OR (www.coin-or.org) # # $Id: prepare_new_stable 2947 2013-09-13 08:36:57Z stefan $ # # Adapted from prepare_new_release by Lou Hafer, SFU, 100507. #set -x -v set -e # Know thy self. If there are no '/' chars in the command name, we're running # in the current directory. Otherwise, strip the command name, leaving the # prefix. Coin-functions is expected to live in the same directory. if expr "$0" : '.*/.*' >/dev/null 2>&1 ; then cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` else cmdDir='.' fi cmdDir=`cd $cmdDir ; pwd` if test -r $cmdDir/coin-functions ; then . $cmdDir/coin-functions else echo "Cannot find utility functions file coin-functions; exiting." fi #################### end of function definitions ########################## # Note that plain sh does not accept negative exit values exitValue=0 # Specify the COIN URL base for convenience. coinURL="https://projects.coin-or.org/svn" # Begin parameter processing. printHelp=0 ignoreBuildToolsMismatch=no mismatchBTExternals= bumpMajor=0 suppressCheckout=0 # srcURL will be the parent for the stable we are building. We'll need to be # able to distinguish ThirdParty and Data builds, and BuildTools itself; they # require special handling. cmdBTURL points to a BuildTools source and is # required when srcURL specifies a ThirdParty or Data project --- we'll need to # assemble a temporary package while creating the stable candidate. srcURL= isThirdParty=no isData=no isBuildTools=no cmdBTURL= # trunkExternals specifies externals for which we want to do simultaneous # creation of stable branches. We will use the trunk as the external while # preparing and testing the stable candidate, changing the Dependencies file # to specify a (nonexistent) stable branch of the external at the last moment. trunkExternals= # exciseExternals specifies externals that should be removed when creating the # new stable branch. exciseExternals= # We need at least one parameter. if test "$#" -eq 0; then printHelp=1 else # Process the parameters. A parameter without an opening `-' is assumed to be # the spec for the source branch. while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do case "$1" in -h* | --h*) printHelp=1 ;; -i* | --i*) if expr "$1" : '.*-i.*=.*' 2>&1 >/dev/null ; then mismatchBTExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift mismatchBTExternals=$1 fi if test "x$mismatchBTExternals" = "xall" ; then ignoreBuildToolsMismatch=all else ignoreBuildToolsMismatch=partial fi ;; -m* | --m*) bumpMajor=1 ;; -p* | --p*) suppressCheckout=1 ;; -t* | --t*) if expr "$1" : '.*-t.*=.*' 2>&1 >/dev/null ; then trunkExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift trunkExternals=$1 fi ;; -x* | --x*) if expr "$1" : '.*-x.*=.*' 2>&1 >/dev/null ; then exciseExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift exciseExternals=$1 fi ;; -b* | --b*) if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then cmdBTURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift cmdBTURL=$1 fi if expr "$cmdBTURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then case $cmdBTURL in http*) ;; *) cmdBTURL=${coinURL}/$cmdBTURL ;; esac else echo '' echo "URL $cmdBTURL does not point to BuildTools." echo '' printHelp=1 exitValue=3 fi ;; -*) echo "$0: unrecognised command line switch '"$1"'." printHelp=1 exitValue=1 ;; *) srcURL=$1 case $srcURL in http* ) ;; BuildTools/ThirdParty/* ) srcURL=${coinURL}/$srcURL ;; ThirdParty/* ) srcURL=${coinURL}/BuildTools/$srcURL ;; * ) srcURL=${coinURL}/$srcURL ;; esac ;; esac shift done # Consistency check: Make sure that the source URL exists. Note that it's not # possible to specify a Data URL without including trunk/stable/release in the # URL. For others, helpfully append `trunk'. srcURL=`echo $srcURL | sed -e 's/\/$//'` urlType=`extractTypeFromURL "$srcURL"` if test $printHelp = 0 && test $exitValue = 0 ; then if svn list $srcURL 2>&1 >/dev/null ; then : else echo "Source URL $srcURL does not seem to exist." printHelp=1 exitValue=5 fi if test "$urlType" = invalid ; then srcURL=$srcURL/trunk urlType=trunk fi fi # Just what are we building? Order is important; BuildTools without ThirdParty # means we're actually doing a BuildTools stable. if test $printHelp = 0 && test $exitValue = 0 ; then case $srcURL in *ThirdParty* ) isThirdParty=yes ;; *BuildTools* ) isBuildTools=yes ;; *Data* ) isData=yes ;; *) ;; esac # If we're building a ThirdParty or Data release, we need a BuildTools URL. if test $isThirdParty = yes || test $isData = yes ; then if test -z "$cmdBTURL" ; then cmdBTURL=`bestRelease $coinURL/BuildTools -1 -1` echo "A BuildTools URL is required for Data or ThirdParty projects." echo "Using $cmdBTURL; override with -b" else if svn list $cmdBTURL 2>&1 >/dev/null ; then : else echo "BuildTools URL $cmdBTURL does not seem to exist." printHelp=1 exitValue=6 fi fi fi fi fi # if "$#" .eq 0 if test $printHelp = 1 ; then cat < This script will create a new stable branch from the head of the specified URL. Typically this will be the trunk, but it can be an existing stable branch. You can specify the entire URL, or just enter what comes after "https://projects.coin-or.org/svn". A typical example is prepare_new_stable Ipopt/trunk Options: -b URL for BuildTools; required to generate a release for a ThirdParty or Data project. -i Ignore BuildTools version mismatches for the listed externals (comma-separated list of project names, e.g., -i Osi,Cbc). '-i all' ignores all mismatches. -p Suppress checkout (useful for testing) -m Bump the major version number. -t Suppress conversion from trunk to stable for the listed externals (comma-separated list of project names). -x Remove the listed projects from the list of externals (comma-separated list of project names). This script will do the following: - Set the new stable version number as the next minor version number in the current major version number. Use the -m flag to bump the major version number. - Convert externals from trunk to the top stable branch. Externals which are currently stable or release are left untouched. Use -t to suppress the change from trunk to stable. Set_externals is then invoked to set release externals where available. - Check out externals. The BuildTools version used by externals (if any) is checked, and the script issues a warning if it doesn't match the version used by the source URL. - Run the scripts to download any ThirdParty code. - Run run_autotools to rebuild configure and make files. - Run configure, make, and make test - Tweak the externals to upgrade trunk (-t) dependencies to stable (you won't get to release in this case). If there is any error during these tasks the script will stop and you should examine the output. If the script completes without error, examine the output, particularly the output of the unit test ('make test') and the set of externals specified in the Dependencies file. Whether you start with Externals or Dependencies, the stable will have a proper Dependencies. Externals will be unmodified. This script does not make any changes to the repository. If you want to commit the new stable branch, run the "commit_new_stable" script, as described at the end of the output. EOF fi if test $exitValue != 0 || test $printHelp = 1 ; then exit $exitValue fi # End of parameter parsing. We have a source URL to work with. Tell the # user what we've seen. srcURL=`echo $srcURL | sed -e 's|/$||'` srcProj=`extractProjFromURL $srcURL` echo "Source URL..........: $srcURL" echo "Base project........: $srcProj" if test $isThirdParty = yes || test $isData = yes ; then echo "BuildTools URL......: $cmdBTURL" fi # Figure out the URL of the new stable branch. Consider that there may not be # any existing stable branches. topStableURL=`bestStable $srcURL -1` echo "Top stable URL......: ${topStableURL:-none}" if test -z "$topStableURL" ; then majVer=0 minVer=1 case "$srcURL" in */Data/* ) newStableURL=$coinURL/Data/stable/$majVer.$minVer/$srcProj ;; */ThirdParty/* ) newStableURL=$coinURL/BuildTools/ThirdParty/$srcProj/stable/$majVer.$minVer ;; * ) newStableURL=$coinURL/$srcProj/stable/$majVer.$minVer ;; esac else majVer=`extractMajorFromURL $topStableURL` if test $bumpMajor = 1 ; then majVer=`expr $majVer + 1` minVer=0 else minVer=`extractMinorFromURL $topStableURL` minVer=`expr $minVer + 1` fi newStableURL=`replaceVersionInURL $topStableURL $majVer $minVer` fi echo "New stable URL......: $newStableURL" newVersion=${majVer}.${minVer} # Construct a build directory name. topProjName=`echo $srcProj | sed -e 's|.*/\([^/]*\)$|\1|'` topBuildDir=${topProjName}-${newVersion} echo "Build directory.....: $topBuildDir" # Now decide where to check out code. if test $isThirdParty = yes; then coDir=$topBuildDir/Thirdparty/$srcProj elif test $isData = yes; then coDir=$topBuildDir/Data/$srcProj else coDir=$topBuildDir fi echo "Checkout directory..: $coDir" echo '' echo "===> Checking out source $srcURL without externals ..." echo '' cmd="svn co --ignore-externals $srcURL $coDir" if test $suppressCheckout = 1 ; then echo "Pretending to do: $cmd" else rm -rf $topBuildDir echo $cmd eval $cmd fi if test $isThirdParty = yes || test $isData = yes; then echo '' echo '===> Checking out BuildTools (Data or ThirdParty) ...' echo '' cmd="svn co $cmdBTURL $topBuildDir/BuildTools" if test $suppressCheckout = 1 ; then echo "Pretending to do: $cmd" else echo $cmd eval $cmd fi fi startDir=`pwd` coDir=`cd $coDir; pwd` topBuildDir=`cd $topBuildDir; pwd` cd $coDir # Find configure.ac files for the package and project and update the version. # We have no externals at this point, and no third-party code, so there will # be two files for a standard project, one for a ThirdParty or Data project. echo '' if test -d $topProjName ; then bak_files=`find $topProjName -name 'configure.ac'` fi if test -e configure.ac ; then bak_files="$bak_files configure.ac" fi echo "===> Creating backup (.bak) for configure.ac files..." for i in $bak_files; do cp $i $i.bak done # Take the attitude that [] around parameters in AC_INIT is optional, # it's the commas that count. This does make for a surpassing ugly regular # expression. A comma in the version string will cause a spectacular failure. # In AC_COIN_PROJECTDIR_INIT, take the attitude that the existing parameters # don't matter, we know what the release parameters should be. echo '' echo "===> Updating version numbers in configure.ac files" for i in $bak_files; do sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVersion\3,\4|" $i > bla mv bla $i svn diff $i done # Find config_proj_default.h. If there's a definition for PROJ_VERSION, adjust it and # add config_proj_default.h.bak to the list of files to be restored. topProjNameUC=`echo $topProjName | tr '[a-z]' '[A-Z]'` if test -d $topProjName ; then configFileLoc=`find $topProjName -name .svn -prune -o -name 'config_*_default.h' -print` fi echo "config File Loc: $configFileLoc" if test -n "$configFileLoc" ; then versionSym=${topProjNameUC}_VERSION echo '' echo "===> Updating $versionSym in $configFileLoc (if present)" echo '' mv $configFileLoc $configFileLoc.bak bak_files="$bak_files $configFileLoc" sed -e "s/# *define $versionSym .*\$/#define $versionSym \"$newVersion\"/" \ -e "s/# *define ${versionSym}_MAJOR .*\$/#define ${versionSym}_MAJOR $majVer/" \ -e "s/# *define ${versionSym}_MINOR .*\$/#define ${versionSym}_MINOR $minVer/" \ -e "s/# *define ${versionSym}_RELEASE .*\$/#define ${versionSym}_RELEASE 9999/" \ <$configFileLoc.bak >$configFileLoc svn diff $configFileLoc fi # Now generate a proper Dependencies file for the stable branch. References to # trunk will be converted to references to stable branches unless the reference # is to a project in the trunkExternals list (in which case it'll be converted # at the very end). References to releases are not changed. Each line in a # Dependencies file has the format . Normally, each entry # should be a stable branch. srcDepFile= for file in Dependencies Externals ; do if test -r $file ; then srcDepFile=$file break fi done if test -n "$srcDepFile" ; then # Save the externals property of the source, so we can just restore it after # the commit. Also save srcDepFile, because we may well modify it for the # stable branch, converting trunk externals to stable externals. svn propget svn:externals . > .Externals.original bak_files="$bak_files $srcDepFile" cp $srcDepFile $srcDepFile.bak echo '' echo "===> Checking externals in $srcDepFile ..." echo '' # We've just checked this out, no sense going back to the server for the # BuildTools version. Because of the intermediate variable, newline has # become space. srcExternals=`svn propget svn:externals .` srcBTURL=`echo $srcExternals | \ sed -n -e 's/.*BuildTools *https:\([^ ]*\) .*/https:\1/p'` if test -z "$srcBTURL" ; then srcBTURL="none" fi echo "Source BuildTools...: $srcBTURL" rm -f Dependencies ext_name= ext_url= buildtoolsMismatch=0 for i in `cat $srcDepFile.bak` ; do if test "$ext_name" = "" ; then ext_name=$i else ext_url=$i if expr "$ext_name" : '#.*' 2>&1 >/dev/null ; then echo " $ext_name $ext_url ==> skipped" ext_name= continue fi ext_urltype=`extractTypeFromURL $ext_url` ext_proj=`extractProjFromURL $ext_url` # See if this external should be dropped. if expr "$exciseExternals" : '.*'$ext_proj'.*' 2>&1 > /dev/null ; then echo " $ext_name $ext_url ==> excised" ext_name= continue fi ext_isNormalURL=`isNormalURL $ext_url` # Convert a trunk URL to stable unless it's listed in trunkExternals. if test $ext_urltype = trunk ; then if expr "$trunkExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then echo " $ext_name $ext_url ==> unchanged" else ext_oldurl=$ext_url ext_url=`bestStable $ext_url -1` # Normal (not BuildTools/ThirdParty/Data) need a directory name, # and it may differ from the project name. Carefully preserve it. if test $ext_isNormalURL = yes ; then ext_tail=`extractTailFromExt $ext_oldurl` ext_url=${ext_url}${ext_tail} fi echo " $ext_name $ext_oldurl ==> $ext_url" fi else echo " $ext_name $ext_url ==> unchanged" fi # Get the BuildTools URL for the external and compare to the BuildTools URL # for the source, assuming we have one and the external has one. if test $ext_isNormalURL = yes && test $ext_proj != BuildTools && test $srcBTURL != none ; then ext_url_notail=`echo $ext_url | sed -e 's,/[^/]*$,,'` extBTURL=`svn propget svn:externals $ext_url_notail` extBTURL=`echo $extBTURL | \ sed -n -e 's/^BuildTools *https:\([^ ]*\) *$/https:\1/p'` if test -n "$extBTURL" ; then testResult=`compareURLVersions "$srcBTURL" "$extBTURL"` if test $testResult = no ; then if test $ignoreBuildToolsMismatch = all || \ expr "$mismatchBTExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then echo " WARNING: BuildTools mismatch: $ext_url_notail uses $extBTURL" else buildtoolsMismatch=1 echo " ERROR: BuildTools mismatch: $ext_url_notail uses $extBTURL" fi fi fi fi echo "$ext_name $ext_url" >>Dependencies ext_name= echo '' fi done # If we have a BuildTools mismatch, exit. if test $buildtoolsMismatch = 1 ; then echo "Exiting due to BuildTools mismatches; use -i to ignore." exit 2 fi $cmdDir/set_externals Dependencies # Try three times to check out externals before conceding defeat. echo '' echo '===> Checking out externals ...' echo '' svn update || { echo "Retry 1 ... " ; svn update ; } || { echo "Retry 2 ... " ; svn update ; } || { echo "Checkout of externals failed. Aborting." ; exit 3 ; } # Run any scripts to acquire ThirdParty code. if test -d ThirdParty ; then echo '' echo '===> Downloading ThirdParty code ...' echo '' ext_name= ext_url= for i in `svn propget svn:externals .` ; do if test -z "$ext_name" ; then ext_name=$i else ext_url=$i if expr "$ext_name" : 'ThirdParty/.*' 2>&1 >/dev/null ; then cd $ext_name ext_proj=`extractProjFromURL $ext_url` getScript=get.$ext_proj if test -x "$getScript" ; then ./$getScript -y fi cd $coDir fi ext_name= fi done fi fi # Done processing externals. If this is a ThirdParty project, we still have # to run the get script. if test $isThirdParty = yes; then if test -x get.$srcProj ; then echo '' echo '===> Downloading third party code...' echo '' ./get.$srcProj -y fi fi # Run the autotools to update configure and make files echo '' echo '===> Running BuildTools/run_autotools ...' echo '' if test $isThirdParty = yes || test $isData = yes ; then cd ../.. ./BuildTools/run_autotools cd "$coDir" else ./BuildTools/run_autotools fi # Let's see if it works. We only run tests for non-ThirdParty, non-Data. DO NOT # turn on --enable-maintainer-mode in the initial configure command. At the # least, it's not needed. At the worst, as of 100526, it'll undo all the # careful work above to set externals. if test $isThirdParty != yes && test $isData != yes; then ( set -e echo '' echo '===> Creating build directory and running the configuration script...' echo '' mkdir build cd build cmd="$coDir/configure -C" echo $cmd eval $cmd echo '' echo '===> Compiling code...' echo '' cmd='make install' echo $cmd eval $cmd echo '' echo '===> Running the unit test...' echo '' echo '*******************************************************************************' echo '*** ***' echo '*** BEGIN OUTPUT OF MAKE TEST ***' echo '*** ***' echo '*******************************************************************************' echo '' cmd='make test' echo $cmd eval $cmd echo '' echo '*******************************************************************************' echo '*** ***' echo '*** END OUTPUT OF MAKE TEST ***' echo '*** ***' echo '*******************************************************************************' ) if test $? != 0; then echo '' echo 'Error during build or test' echo '' exit 3 fi fi # No fatal errors. Declare victory. echo '' echo '===> ALL TESTS PASSED' if test $isThirdParty != yes && test $isData != yes && test $isBuildTools != yes ; then echo '' echo 'Please review the output above, particularly the one of make test' fi echo '' # Do we need to plug in nonexistent stable branches for circular dependencies # tested with the trunk? If so, generate a new Dependencies. This is the only # reason trunk references should appear in the externals for a stable branch, # so we don't need to check further before removing them. if test -n "$trunkExternals" ; then echo '' echo "===> Grooming externals to remove trunk references used for testing." echo '' mv Dependencies Dependencies.temp.$$ ext_name= ext_url= for i in `cat Dependencies.temp.$$`; do if test "$ext_name" = ""; then ext_name="$i" else ext_url=$i ext_urltype=`extractTypeFromURL $ext_url` ext_proj=`extractProjFromURL $ext_url` if test $ext_urltype = trunk ; then ext_oldurl=$ext_url ext_url=`bestStable $ext_url -1` ext_majVer=`extractMajorFromURL $ext_url` ext_minVer=`extractMinorFromURL $ext_url` ext_minVer=`expr $ext_minVer + 1` ext_url=`replaceVersionInURL $ext_url $ext_majVer $ext_minVer` ext_isNormal=`isNormalURL $ext_url` if test $ext_isNormal = yes ; then ext_url="${ext_url}${ext_proj}" fi echo " $ext_name $ext_oldurl ==> $ext_url" fi echo "$ext_name $ext_url" >>Dependencies ext_name= fi done rm -f Dependencies.temp.$$ $cmdDir/set_externals Dependencies fi if test -r Dependencies ; then echo '' echo 'Also, please confirm the Externals are correct:' svn propget svn:externals fi echo '' echo 'After reviewing the output above, you can create a new stable by going into' echo 'the directory' echo '' echo " $startDir" echo '' echo "and run the commit_new_stable script" cd $topBuildDir # Record information for the commit_new_stable script. cat >.new_stable_data </dev/null 2>&1 ; then cmdDir=`echo $0 | sed -e 's,\(.*\)/[^/]*,\1,'` else cmdDir='.' fi cmdDir=`cd $cmdDir ; pwd` if test -r $cmdDir/coin-functions ; then . $cmdDir/coin-functions else echo "Cannot find utility functions file coin-functions; exiting." fi # Note that plain sh does not accept negative exit values exitValue=0 # Specify the COIN URL base for convenience. coinURL="https://projects.coin-or.org/svn" # Begin parameter processing. printHelp=0 ignoreBuildToolsMismatch=no mismatchBTExternals= suppressCheckout=0 # stableURL will be the stable branch that is the parent for the release we # are building. We'll need to be able to distinguish ThirdParty and Data # builds, and BuildTools itself; they require special handling. If a project # is not BuildTools, ThirdParty, or Data, it's `normal'. # SV: I think also ThirdParty projects should be treated as 'normal', so I changed that. stableURL= isThirdParty=no isData=no isBuildTools=no isNormal=yes # cmdBTURL is required when stableURL specifies a ThirdParty or Data # project --- we'll need to assemble a temporary package while creating the # release candidate. cmdBTURL= # stableExternals specifies externals for which we are doing simultaneous # releases. We will use the stable branch of the external while preparing # and testing this release candidate, changing svn:externals to specify a # (nonexistent) release of the external at the last moment. stableExternals= # exciseExternals specifies externals that should be removed when creating the # new release. exciseExternals= # We need at least one parameter. if test "$#" -eq 0; then printHelp=1 else # Process the parameters. A parameter without an opening `-' is assumed to be # the spec for the stable branch. while test $# -gt 0 && test $exitValue = 0 && test $printHelp = 0 ; do case "$1" in -h* | --h*) printHelp=1 ;; -i* | --i*) if expr "$1" : '.*-i.*=.*' 2>&1 >/dev/null ; then mismatchBTExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift mismatchBTExternals=$1 fi if test "x$mismatchBTExternals" = "xall" ; then ignoreBuildToolsMismatch=all else ignoreBuildToolsMismatch=partial fi ;; -p* | --p*) suppressCheckout=1 ;; -s* | --s*) if expr "$1" : '.*-s.*=.*' 2>&1 >/dev/null ; then stableExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift stableExternals=$1 fi ;; -x* | --x*) if expr "$1" : '.*-x.*=.*' 2>&1 >/dev/null ; then exciseExternals=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift exciseExternals=$1 fi ;; -b* | --b*) if expr "$1" : '.*-b.*=.*' 2>&1 >/dev/null ; then cmdBTURL=`echo $1 | sed -n -e 's/[^=]*=\(.*\)/\1/p'` else shift cmdBTURL=$1 fi if expr "$cmdBTURL" : '.*BuildTools.*' 2>&1 >/dev/null ; then case $cmdBTURL in http*) ;; *) cmdBTURL=${coinURL}/$cmdBTURL ;; esac else echo '' echo "URL $cmdBTURL does not point to BuildTools." echo '' printHelp=1 exitValue=3 fi ;; -*) echo "$0: unrecognised command line switch '"$1"'." printHelp=1 exitValue=1 ;; *) stableURL=$1 if expr "$stableURL" : '.*/stable/.*' 2>&1 >/dev/null ; then case $stableURL in http*) ;; BuildTools/ThirdParty/* ) stableURL=${coinURL}/$stableURL ;; ThirdParty/* ) stableURL=${coinURL}/BuildTools/$stableURL ;; CoinAll/* ) stableURL=${coinURL}/CoinBinary/$stableURL ;; *) stableURL=${coinURL}/$stableURL ;; esac else echo '' echo "URL $stableURL does not specify a stable release." echo '' printHelp=1 exitValue=2 fi ;; esac shift done # Consistency checks: Make sure that the stable URL exists. If we're building # a ThirdParty or Data release, we need a BuildTools URL. if test $printHelp = 0 && test $exitValue = 0 ; then if svn list $stableURL 2>&1 >/dev/null ; then : else echo "Stable URL $stableURL does not seem to exist." printHelp=1 exitValue=5 fi fi if test $printHelp = 0 && test $exitValue = 0 ; then case $stableURL in *ThirdParty/* ) isThirdParty=yes ;; *Data/* ) isData=yes ;; *BuildTools/* ) isBuildTools=yes isNormal=no ;; *) ;; esac if test $isThirdParty = yes || test $isData = yes ; then if test -z $cmdBTURL ; then echo "You must provide a BuildTools URL to build a ThirdParty or Data project." printHelp=1 exitValue=4 else if svn list $cmdBTURL 2>&1 >/dev/null ; then : else echo "BuildTools URL $cmdBTURL does not seem to exist." printHelp=1 exitValue=6 fi fi fi fi fi # if "$#" .eq 0 if test $printHelp = 1 ; then cat < [options] COIN standard practice is to generate periodic releases by taking a snapshot of the stable branch of the project. You can use this script to prepare a new release based on the specified stable branch. specifies the stable branch of your project to be used to create the new release. You can specify the entire URL, or you just enter what comes after "https://projects.coin-or.org/svn". A typical example is prepare_new_release Ipopt/stable/3.3 Options: -b URL for BuildTools; required to generate a release for a ThirdParty or Data project. -i Ignore BuildTools version mismatches for the listed externals (comma-separated list of project names, e.g., -i Osi,Cbc). '-i all' ignores all mismatches. -p Suppress checkout (useful for testing) -s Suppress conversion from stable to release for the listed externals (comma-separated list of project names). -x Remove the listed projects from the list of externals (comma-separated list of project names). This script will do the following: - Automatically determine the next release number (X.Y.0 if this is the first release for stable/X.Y, otherwise one greater than any existing release) - Check out a clean copy of the specified stable branch, without externals - Make sure that the svn:externals property points to releases, with the exception of projects in the list specified with -s. - Create a new package configure.ac file with the release version number specified in the AC_INIT macro. - Use the "get.*" scripts to download any ThirdParty code. - Execute run_autotools to update configure, Makefile.in, etc., to reflect the most recent release of BuildTools. - Run the configure script, compile the code, and run the unit test. - Replace stable externals for projects specified with -s with the appropriate (yet to be committed) release. If there is any error during these tasks the script will stop and you should examine the output. If the script completes without error, examine the output, particularly the output of the unit test ('make test') and the set of externals specified in the Dependencies file. This script does not make any changes to the repository. If you want to commit the new release, run the "commit_new_release" script, as described at the end of the output. EOF fi if test $exitValue != 0 || test $printHelp = 1 ; then exit $exitValue fi # End of parameter parsing. We have a stable URL to work with. Tell the # user what we've seen. stableURL=`echo $stableURL | sed -e 's|/$||'` stableProj=`extractProjFromURL $stableURL` majVer=`extractMajorFromURL $stableURL` minVer=`extractMinorFromURL $stableURL` stableVer=$majVer.$minVer echo "Stable URL..........: $stableURL" echo "Stable project......: $stableProj" echo "Stable branch.......: $stableVer" if test -n "$stableExternals" ; then echo "Stable externals....: $stableExternals." fi # Find out the most recent release (if any) for the stable branch, then # construct the revision number of the new release. If there are existing # releases, it's a matter of bumping the revision number and inserting the # new revision in the URL. Otherwise, we know the new revision is 0 and we # can simply tweak the stable URL. releaseURL=`bestRelease $stableURL $majVer $minVer | sed -e 's|/$||'` if test -n "$releaseURL" ; then curRel=`extractReleaseFromURL $releaseURL` existingURL=$releaseURL newRel=`expr $curRel + 1` else curRel=-1 releaseURL=`echo $stableURL | sed -e s/stable/releases/` existingURL="none" newRel=0 fi newVer=$majVer.$minVer.$newRel releaseURL=`replaceVersionInURL $releaseURL $majVer $minVer $newRel` echo "Top release URL.....: $existingURL" echo "New release URL.....: $releaseURL" # Relevant only if we're building ThirdParty or Data if test $isThirdParty = yes || test $isData = yes ; then echo "BuildTools URL......: $cmdBTURL" fi # We need a libtool version number only for normal projects if test $isNormal = yes ; then newLTCurrent=`calcLibtoolCurrent $stableURL $majVer $minVer` newLTRevision=$newRel newLTAge=`calcLibtoolAge $stableURL $majVer $minVer` # expr returns with status 1 if the result of the calculation is 0 # this leads to exiting this script, which is somewhat unexpected if test "$newLTAge" = 1 ; then newLTAge=0 else newLTAge=`expr $newLTAge - 1` fi newLTVer=${newLTCurrent}:${newLTRevision}:${newLTAge} echo "Libtool version.....: $newLTVer" fi # Now decide where to build and check out code. If the stable project name # contains a '/', strip it out to make the build and checkout directories. topProjName=`echo $stableProj | sed -e 's|.*/\([^/]*\)$|\1|'` topBuildDir="${topProjName}-${newVer}" if test $isThirdParty = yes; then coDir=$topBuildDir/Thirdparty/$stableProj elif test $isData = yes; then coDir=$topBuildDir/Data/$stableProj else coDir=$topBuildDir fi echo "Build directory.....: $topBuildDir" echo "Checkout directory..: $coDir" # Check out the stable branch that'll be the base of the new release. No # externals at this point. Creating a release of a ThirdParty or Data project # requires a bit of work, as we need to assemble a temporary package with a # BuildTools external. echo '' echo "===> Checking out stable release $stableVer without externals..." echo '' rm -rf $topBuildDir cmd="svn co --ignore-externals $stableURL $coDir" if test $suppressCheckout = 1 ; then echo "Pretending to do: $cmd" else rm -rf $topBuildDir echo $cmd eval $cmd fi if test $isThirdParty = yes || test $isData = yes; then echo '' echo '===> Checking out BuildTools (Data or ThirdParty) ...' echo '' cmd="svn co $cmdBTURL $topBuildDir/BuildTools" if test $suppressCheckout = 1 ; then echo "Pretending to do: $cmd" else echo $cmd eval $cmd fi fi startDir=`pwd` coDir=`cd $coDir; pwd` topBuildDir=`cd $topBuildDir; pwd` cd $coDir # Find configure.ac files for the package and project and update the version. # We have no externals or third-party code at this point, so there will be # two files for a normal project, one for a ThirdParty or Data project, and # none for BuildTools. echo '' echo "===> Checking for configure.ac files ..." if test -d $topProjName ; then bak_files=`find $topProjName -name 'configure.ac'` fi if test -e configure.ac ; then bak_files="$bak_files configure.ac" fi if test -n "$bak_files" ; then for i in $bak_files; do cp $i $i.bak done # Take the attitude that [] around parameters in AC_INIT is optional, # it's the commas that count. This does make for a surpassing ugly regular # expression. A comma in the version string will cause a spectacular failure. # In AC_COIN_PROJECTDIR_INIT, take the attitude that there is one parameter # with the PMs choosen project name which is preserved and we only add a # libtool version number afterwards. echo '' echo "===> Updating version numbers in configure.ac files ..." for i in $bak_files; do sed -e "s|AC_INIT\(.*\),\(\[*\)[^],]*\(\]*\),\(.*\)|AC_INIT\1,\2$newVer\3,\4|" $i > bla mv bla $i sed -e "s|AC_COIN_PROJECTDIR_INIT(\(.*\))|AC_COIN_PROJECTDIR_INIT\(\1,$newLTCurrent:$newLTRevision:$newLTAge\)|" $i > bla mv bla $i svn diff $i done else echo " ... none to process." fi # Find config_proj_default.h. If there's a definition for PROJ_VERSION, adjust it and # add config_proj_default.h.bak to the list of files to be restored. topProjNameUC=`echo $topProjName | tr '[a-z]' '[A-Z]'` if test -d $topProjName ; then configFileLoc=`find $topProjName -name .svn -prune -o -name 'config_*_default.h' -print` fi if test -n "$configFileLoc" ; then versionSym=${topProjNameUC}_VERSION echo '' echo "===> Updating $versionSym in $configFileLoc (if present)" echo '' mv $configFileLoc $configFileLoc.bak bak_files="$bak_files $configFileLoc" sed -e "s/# *define $versionSym .*\$/#define $versionSym \"$newVer\"/" \ -e "s/# *define ${versionSym}_MAJOR .*\$/#define ${versionSym}_MAJOR $majVer/" \ -e "s/# *define ${versionSym}_MINOR .*\$/#define ${versionSym}_MINOR $minVer/" \ -e "s/# *define ${versionSym}_RELEASE .*\$/#define ${versionSym}_RELEASE $newRel/" \ <$configFileLoc.bak >$configFileLoc svn diff $configFileLoc fi # The Dependencies file in a stable branch should contain only stable # and release references (trunk is flagged as an error below). The overall # algorithm is to convert svn:externals to use releases but leave Dependencies # with stables. In practice, this is accomplished by backing up Dependencies, # using Dependencies to assemble and set svn:externals, and finally restoring # Dependencies from the backup after all else is done. # Look for a file specifying externals. Preferably Dependencies, but check for # Externals just in case this is an unconverted project. srcDepFile= for file in Dependencies Externals ; do if test -r $file ; then srcDepFile=$file break fi done # Now generate the proper externals for the release. Each line in a # Dependencies file has the format . Normally, each # should be a stable branch. References to stable branches will be # converted to references to releases unless the reference is to a project # in the stableExternals list (in which case it'll be converted at the very # end). References to releases are not changed. References to trunk are an # error. Failure to find a release for an external not in the stableExternals # list is an error. Save the existing externals and srcDepFile, as we'll # probably change both. if test -n "$srcDepFile" ; then svn propget svn:externals . > .Externals.original bak_files="$bak_files $srcDepFile" cp $srcDepFile $srcDepFile.bak echo '' echo "===> Checking externals in $srcDepFile ..." echo '' # Because we're working directly from command output, the regular expression # must check for lines. ourBTURL=`svn propget svn:externals . | \ sed -n -e 's/^BuildTools *https:\([^ ]*\)$/https:\1/p'` if test -z "$ourBTURL" ; then ourBTURL=none fi echo "Our BuildTools...: $ourBTURL" rm -f Dependencies ext_name= ext_url= buildtoolsMismatch=0 for i in `cat $srcDepFile.bak`; do if test "$ext_name" = ""; then ext_name="$i" else ext_url=$i if expr "$ext_name" : '#.*' 2>&1 >/dev/null ; then echo " $ext_name $ext_url ==> skipped" ext_name= continue fi ext_urltype=`extractTypeFromURL $ext_url` ext_proj=`extractProjFromURL $ext_url` # See if this external should be dropped. if expr "$exciseExternals" : '.*'$ext_proj'.*' 2>&1 > /dev/null ; then echo " $ext_name $ext_url ==> excised" ext_name= continue fi # External must be a stable or a release. if test $ext_urltype != stable && test $ext_urltype != release ; then echo '' echo "===> The external URL $ext_url is not a stable branch or release. Exiting." echo '' exit 2 fi ext_isNormal=`isNormalURL $ext_url` # Convert stable branches to releases unless listed in stableExternals. # Existing releases are unchanged. if test $ext_urltype = stable ; then if expr "$stableExternals" : '.*'"$ext_proj"'.*' 2>&1 >/dev/null ; then echo " $ext_name $ext_url unchanged" ext_rel_url=$ext_url else ext_majVer=`extractMajorFromURL $ext_url` ext_minVer=`extractMinorFromURL $ext_url` ext_rel_url=`bestRelease $ext_url $ext_majVer $ext_minVer` if test -z "$ext_rel_url" ; then echo '' echo "===> No release for $ext_url. Exiting." echo '' exit 2 fi # Normal (not BuildTools/ThirdParty/Data) need a directory name, # and it may differ from the project name. Carefully preserve it. if test $ext_isNormal = yes ; then ext_tail=`extractTailFromExt $ext_url` ext_rel_url=${ext_rel_url}${ext_tail} fi echo " $ext_name $ext_url ==> $ext_rel_url" fi else ext_rel_url=$ext_url echo " $ext_name $ext_url ==> unchanged" fi # Get the BuildTools URL for the external and compare to the BuildTools URL # for the source, assuming we have one and the external has one. We only need # to do this for normal URLs, and we need to strip the tail. if test $ext_isNormal = yes && test $ext_proj != BuildTools && test $ourBTURL != none ; then ext_rel_url_notail=`echo $ext_rel_url | sed -e 's,/[^/]*$,,'` extBTURL=`svn propget svn:externals $ext_rel_url_notail` extBTURL=`echo $extBTURL | \ sed -n -e 's/^BuildTools *https:\([^ ]*\) *$/https:\1/p'` if test -n "$extBTURL" ; then testResult=`compareURLVersions "$ourBTURL" "$extBTURL"` if test $testResult = no ; then if test $ignoreBuildToolsMismatch = all || \ expr "$mismatchBTExternals" : '.*'$ext_proj'.*' 2>&1 >/dev/null ; then echo " WARNING: BuildTools mismatch: $ext_url_notail uses $extBTURL" else buildtoolsMismatch=1 echo " ERROR: BuildTools mismatch: $ext_url_notail uses $extBTURL" fi fi fi fi echo "$ext_name $ext_rel_url" >>Dependencies ext_name= echo '' fi done # If we have a BuildTools mismatch, exit. if test $buildtoolsMismatch = 1 ; then echo "Exiting due to BuildTools mismatches; use -i to ignore." exit 2 fi # Try to check out the externals. Try three times before failing. echo '' echo '===> Updating svn:externals property and checking out externals ...' echo '' svn propset svn:externals -F Dependencies . svn update || { echo "Retry 1 ... " ; svn update ; } || { echo "Retry 2 ... " ; svn update ; } || { echo "Checkout of externals failed. Aborting." ; exit 3 ; } if test -d ThirdParty ; then echo '' echo '===> Downloading ThirdParty code ...' echo '' ext_name= ext_url= for i in `svn propget svn:externals .` ; do if test -z "$ext_name" ; then ext_name="$i" else ext_url=$i if expr "$ext_name" : 'ThirdParty/.*' 2>&1 >/dev/null ; then cd $ext_name ext_proj=`extractProjFromURL $ext_url` getScript=get.$ext_proj if test -x "$getScript" ; then ./$getScript -y fi cd $coDir fi ext_name= fi done fi fi # Finally! Done processing externals. If this is a ThirdParty project, we # still have to run the get script, if there is one. isThirdPartyWithoutGet=no if test $isThirdParty = yes ; then if test -x get.$stableProj ; then echo '' echo '===> Downloading third party code ...' echo '' ./get.$stableProj -y else isThirdPartyWithoutGet=yes fi fi # Don't run run_autotools for BuildTools! if test $isBuildTools = no ; then echo '' echo '===> Running BuildTools/run_autotools ...' echo '' if test $isThirdParty = yes || test $isData = yes ; then cd ../.. ./BuildTools/run_autotools cd "$coDir" elif test $isNormal = yes ; then ./BuildTools/run_autotools fi fi # Let's see if it works. We only run tests for normal projects. DO NOT turn # on --enable-maintainer-mode in the initial configure command. At the least, # it's not needed. At the worst, as of 100526, it'll undo all the careful # work above to set externals. if test $isNormal = yes && test $isThirdPartyWithoutGet = no; then (set -e echo '' echo '===> Creating build directory and running the configuration script...' echo '' mkdir build cd build cmd="$coDir/configure -C" echo $cmd eval $cmd echo '' echo '===> Compiling code...' echo '' cmd='make install' echo $cmd eval $cmd echo '' echo '===> Running the unit test...' echo '' echo '*******************************************************************************' echo '*** ***' echo '*** BEGIN OUTPUT OF MAKE TEST ***' echo '*** ***' echo '*******************************************************************************' echo '' cmd='make test' echo $cmd eval $cmd echo '' echo '*******************************************************************************' echo '*** ***' echo '*** END OUTPUT OF MAKE TEST ***' echo '*** ***' echo '*******************************************************************************' ) if test $? != 0; then echo '' echo 'Error during build or test' echo '' exit 3 fi echo '' echo '===> ALL TESTS PASSED' fi echo '' if test $isNormal = yes && test $isThirdPartyWithoutGet = no; then echo 'Please review the output above, particularly the one of make test.' else echo 'Please review the output above.' fi echo '' # Do we need to plug in nonexistent releases for circular dependencies tested # with the stable versions? If so, generate a new Dependencies. This is the # only reason stable references should appear in the externals for a release, # so we don't need to check further before removing them. if test -n "$stableExternals" ; then echo "===> Grooming externals to remove stable externals used for testing ..." mv Dependencies Dependencies.temp.$$ ext_name= ext_url= for i in `cat Dependencies.temp.$$`; do if test "$ext_name" = ""; then ext_name="$i" else ext_url=$i ext_urltype=`extractTypeFromURL $ext_url` ext_proj=`extractProjFromURL $ext_url` if test $ext_urltype = stable ; then ext_rel_url=$ext_url ext_majVer=`extractMajorFromURL $ext_url` ext_minVer=`extractMinorFromURL $ext_url` ext_rel_url=`echo $ext_url | sed -e 's,/stable/,/releases/,'` ext_rel_url=`replaceVersionInURL $ext_rel_url $ext_majVer $ext_minVer 0` echo " $ext_name $ext_url ==> $ext_rel_url" else ext_rel_url=$ext_url fi echo "$ext_name $ext_rel_url" >>Dependencies ext_name= fi done rm -f Dependencies.temp.$$ svn propset -F Dependencies svn:externals . echo '' fi # If we had a Dependencies file to begin with, it contained references to # stable branches, and perhaps releases. This is the set of dependencies that # we want to commit in Dependencies, so reload $srcDepFile.bak into # Dependencies, now that we have svn:externals set to releases. if test -n "$srcDepFile" ; then cp $srcDepFile.bak Dependencies fi if test -r Dependencies ; then echo 'Also, please confirm the externals are correct:' svn propget svn:externals fi echo '' echo 'After reviewing the output above, you can create a new release by going into' echo 'the directory' echo '' echo " $startDir" echo '' echo "and run the commit_new_release script" cd $topBuildDir cat >.new_release_data </dev/null` if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then m4_toupper($1_SVN_REV)=`echo $svn_rev_tmp | sed -n -e 's/^@<:@0-9@:>@*://' -e 's/\(@<:@0-9@:>@\)@<:@^0-9@:>@*$/\1/p'` AC_DEFINE_UNQUOTED(m4_toupper($1_SVN_REV), $m4_toupper($1_SVN_REV), [SVN revision number of project]) fi fi ]) # Capture libtool library version, if given. m4_ifvaln([$2],[coin_libversion=$2],[]) ]) ########################################################################### # COIN_PROJECTDIR_INIT # ########################################################################### # This macro does everything that is required in the early part in the # configure script, such as defining a few variables. This should only be used # in the main directory of a project directory (the one which holds the src # directory for the project). The first parameter is the project name. The # second (optional) is the libtool library version (important for releases, # less so for stable or trunk). AC_DEFUN([AC_COIN_PROJECTDIR_INIT], [ # As backup, we make sure we don't loose an FLIBS if it has been set # by the user save_FLIBS="$FLIBS" # A useful makefile conditional that is always false AM_CONDITIONAL(ALWAYS_FALSE, false) # We set the following variable so that we know later in AC_COIN_FINALIZE # that we are in a project main directory coin_projectdir=yes # Set the project's version numbers AC_COIN_PROJECTVERSION($1, $2) ]) # AC_COIN_PROJECTDIR_INIT ########################################################################### # COIN_DEBUG_COMPILE # ########################################################################### # enable the configure flags --enable-debug and --enable-debug-prjct # (where prcjt is the name of the project in lower case) and set the # variable coin_debug_compile to true or false This is used by # COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77 to determine the # compilation flags. This macro also makes the switches # --with-prjct-verbosity and --with-prjct-checklevel available, which # define the preprocessor macros COIN_PRJCT_VERBOSITY and # COIN_PRJCT_CHECKLEVEL to the specified value (default is 0). # # The project specific flags are only made available, if one gives the # name of the project as first argument to this macro. AC_DEFUN([AC_COIN_DEBUG_COMPILE], [AC_BEFORE([$0],[AC_COIN_PROG_CXX])dnl AC_BEFORE([$0],[AC_COIN_PROG_CC])dnl AC_BEFORE([$0],[AC_COIN_PROG_F77])dnl AC_MSG_CHECKING([whether we want to compile in debug mode]) AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug], [compile all projects with debug options tests (implies --disable-shared)])], [case "${enableval}" in yes) coin_debug_compile=true if test "${enable_shared+set}" = set; then :; else enable_shared=no fi ;; no) coin_debug_compile=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; esac], [coin_debug_compile=false]) m4_ifvaln([$1], [AC_ARG_ENABLE(debug-m4_tolower($1), [AC_HELP_STRING([--enable-debug-m4_tolower($1)], [compile project $1 with debug compiler flags])], [case "${enableval}" in yes) coin_debug_compile=true ;; no) coin_debug_compile=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-m4_tolower($1)) ;; esac],[:]) ]) # m4_ifvaln([$1], if test $coin_debug_compile = true; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi m4_ifvaln([$1], [AC_ARG_WITH(m4_tolower($1)-verbosity, AC_HELP_STRING([--with-m4_tolower($1)-verbosity], [specify the debug verbosity level for project $1]), [if test "$withval" = yes; then withval=1 fi m4_tolower(coin_$1_verbosity)=$withval], [m4_tolower(coin_$1_verbosity)=0]) AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_VERBOSITY), m4_tolower($coin_$1_verbosity), [Define to the debug verbosity level (0 is no output)]) AC_ARG_WITH(m4_tolower($1)-checklevel, AC_HELP_STRING([--with-m4_tolower($1)-checklevel], [specify the sanity check level for project $1]), [if test "$withval" = yes; then withval=1 fi m4_tolower(coin_$1_checklevel)=$withval], [m4_tolower(coin_$1_checklevel)=0]) AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_CHECKLEVEL), m4_tolower($coin_$1_checklevel), [Define to the debug sanity check level (0 is no test)]) ]) # m4_ifvaln([$1], ]) # AC_COIN_DEBUG_COMPILE ########################################################################### # COIN_ENABLE_MSVC # ########################################################################### # This macro is invoked by any PROG_compiler macro to establish the # --enable-msvc option. # The job of this macro is to make sure the option is correct and # to set enable_msvc. Legal values are yes and no (disabled). # If set, assume the presence of cl/link. It's the user's responsibility to # make sure their PATH is correct. In particular, that MSVC link is found # and not cygwin link (we want to do code linking, not file linking). # It's the responsibility of individual PROG_compiler macros to ensure that # they correctly set the compiler search list and preprocess, compile, and # link flags. This is tied to compiler setup because in practice invocations # of the preprocessor and linker are made through the compiler. # For backward compatibility, we also check for --enable-doscompile=msvc. AC_DEFUN([AC_COIN_ENABLE_MSVC], [AC_REQUIRE([AC_CANONICAL_BUILD]) # for backward compatibility AC_ARG_ENABLE([doscompile],,[enable_doscompile=$enableval],[enable_doscompile=no]) AC_ARG_ENABLE([msvc], [AC_HELP_STRING([--enable-msvc], [Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin.])], [enable_msvc=$enableval], [enable_msvc=no if test "$enable_doscompile" = msvc ; then enable_msvc=yes elif test "$enable_doscompile" != no ; then AC_MSG_ERROR([--enable-doscompile=$enable_doscompile not supported anymore.]) fi ]) if test "$enable_msvc" = MD; then enable_shared=yes enable_msvc=yes fi if test "$enable_msvc" = yes; then case $build in *-cygwin* | *-mingw*) ;; *) AC_MSG_ERROR([--enable-msvc option makes sense only under Cygwin or MinGW]) ;; esac fi ]) ########################################################################### # COIN_PROG_CXX # ########################################################################### # Find the compile command by running AC_PROG_CXX (with compiler names for # different operating systems) and put it into CXX (unless it was given by the # user). Then find an appropriate value for CXXFLAGS. If either of CXXFLAGS or # PRJCT_CXXFLAGS is defined, that value is used (replace PRJCT with the upper # case name of this project). It is possible to provide additional -D flags # in the variable CXXDEFS, and additional compilation flags with ADD_CXXFLAGS. AC_DEFUN([AC_COIN_PROG_CXX], [AC_REQUIRE([AC_COIN_PROG_CC]) #Let's try if that overcomes configuration problem with VC++ 6.0 AC_REQUIRE([AC_COIN_ENABLE_MSVC]) AC_LANG_PUSH(C++) AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.]) AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options]) AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options]) AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options]) coin_has_cxx=yes save_cxxflags="$CXXFLAGS" # For *-*-solaris*, promote Studio/Workshop compiler to front of list. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl g++" else comps="g++ icl cl" fi ;; *-*-solaris*) comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; *-darwin*) comps="clang++ g++ c++ CC" ;; *-linux-gnu*) comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;; *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } # AC_MSG_NOTICE([C++ compiler candidates: $comps]) AC_PROG_CXX([$comps]) #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler #thus, we test here whether $CXX is actually working AC_LANG_PUSH(C++) AC_MSG_CHECKING([whether C++ compiler $CXX works]); AC_COMPILE_IFELSE( [AC_LANG_PROGRAM(, [int i=0;])], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) AC_MSG_ERROR(failed to find a C++ compiler or C++ compiler $CXX does not work)] ) AC_LANG_POP(C++) coin_cxx_is_cl=false # It seems that we need to cleanup something here for the Windows case "$CXX" in clang* | */clang*) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh mv confdefs.hh confdefs.h coin_cxx_is_cl=true ;; esac # add automake conditional so we can recognize cl compiler in makefile AM_CONDITIONAL(COIN_CXX_IS_CL, [test $coin_cxx_is_cl = true]) # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.]) fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CXXFLAGS="$save_cxxflags" # Check if a project specific CXXFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} if test x$coin_tmp = xset; then eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} fi fi if test x"$CXXFLAGS" = x; then # ToDo decide whether we want -DNDEBUG for optimization coin_add_cxxflags= coin_opt_cxxflags= coin_dbg_cxxflags= coin_warn_cxxflags= if test "$GXX" = "yes"; then case "$CXX" in icpc* | */icpc*) ;; *) # ToDo decide about unroll-loops coin_opt_cxxflags="-O3" coin_add_cxxflags="-pipe" coin_dbg_cxxflags="-g -O0" coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" ;; esac esac fi # Note that we do not need to cover GCC in the following tests. if test -z "$coin_opt_cxxflags"; then case $build in *-cygwin* | *-mingw*) case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -O2' coin_dbg_cxxflags='-MDd' else coin_opt_cxxflags='-MT -O2' coin_dbg_cxxflags='-MTd' fi coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -Ox' coin_dbg_cxxflags='-MDd -debug' else coin_opt_cxxflags='-MT -Ox' coin_dbg_cxxflags='-MTd -debug' fi coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CXX" in icpc* | */icpc*) coin_opt_cxxflags="-O3 -ip -mp1" coin_add_cxxflags="" coin_dbg_cxxflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CXXFLAGS= AC_TRY_LINK(,[int i=0; i++;],[], [coin_add_cxxflags="-i_dynamic $coin_add_cxxflags"]) ;; pgCC* | */pgCC*) coin_opt_cxxflags="-fast" coin_add_cxxflags="-Kieee -pc 64" coin_dbg_cxxflags="-g" ;; esac ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" coin_dbg_cxxflags="-g" ;; esac ;; *-hp-*) case "$CXX" in aCC* | */aCC* ) coin_opt_cxxflags="-O" coin_add_cxxflags="-AA" coin_dbg_cxxflags="-g" ;; esac ;; *-*-solaris*) coin_opt_cxxflags="-O4" coin_dbg_cxxflags="-g" ;; esac fi # Generic flag settings. If these don't work, add a case above. if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then coin_dbg_cxxflags="-g" fi if test -z "$coin_opt_cxxflags"; then # Try if -O option works if nothing else is set CXXFLAGS=-O AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"]) fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cxxflags" = xyes; then coin_warn_cxxflags= fi # Do final setup of flags based on values determined above. if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" fi DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test "$coin_debug_compile" = "true"; then CXXFLAGS="$DBG_CXXFLAGS" else CXXFLAGS="$OPT_CXXFLAGS" fi # Handle the case where CXXFLAGS was set externally. else CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$CXXFLAGS" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$CXXFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CXXFLAGS works save_CXXFLAGS="$CXXFLAGS" AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=]) if test -z "$CXXFLAGS"; then AC_MSG_WARN([The flags CXXFLAGS="$save_CXXFLAGS" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually.]) CXXFLAGS='-O' AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=]) if test -z "$CXXFLAGS"; then AC_MSG_WARN([This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.]) fi fi AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS]) AC_ARG_VAR(MPICXX,[C++ MPI Compiler]) if test x"$MPICXX" = x; then :; else AC_MSG_NOTICE([Will use MPI C++ compiler $MPICXX]) CXX="$MPICXX" fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac AC_LANG_POP(C++) ]) # AC_COIN_PROG_CXX ########################################################################### # COIN_CXXLIBS # ########################################################################### # Determine the C++ runtime libraries required for linking a C++ library # with a Fortran or C compiler. The result is available in CXXLIBS. AC_DEFUN([AC_COIN_CXXLIBS], [AC_REQUIRE([AC_PROG_CXX])dnl AC_LANG_PUSH(C++) AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler]) if test -z "$CXXLIBS"; then if test "$GXX" = "yes"; then case "$CXX" in icpc* | */icpc*) CXXLIBS="-lstdc++" ;; *) # clang uses libc++ as the default standard C++ library, not libstdc++ # this test is supposed to recognize whether the compiler is clang # AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ #ifndef _LIBCPP_VERSION choke me #endif ]])], [CXXLIBS="-lc++"], [CXXLIBS="-lstdc++ -lm"]) ;; esac else case $build in *-mingw32 | *-cygwin* ) case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL*) CXXLIBS=nothing;; esac;; *-linux-*) case "$CXX" in icpc* | */icpc*) CXXLIBS="-lstdc++" ;; pgCC* | */pgCC*) CXXLIBS="-lstd -lC -lc" ;; esac;; *-ibm-*) CXXLIBS="-lC -lc" ;; *-hp-*) CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc" ;; *-*-solaris*) CXXLIBS="-lCstd -lCrun" esac fi fi if test -z "$CXXLIBS"; then AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C).]) else AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".]) fi if test x"$CXXLIBS" = xnothing; then CXXLIBS= fi AC_LANG_POP(C++) ]) # AC_COIN_CXXLIBS ########################################################################### # COIN_CHECK_HEADER # ########################################################################### # This macro checks for a header file, but it does so without the # standard header. This avoids warning messages like: # # configure: WARNING: dlfcn.h: present but cannot be compiled # configure: WARNING: dlfcn.h: check for missing prerequisite headers? # configure: WARNING: dlfcn.h: see the Autoconf documentation # configure: WARNING: dlfcn.h: section "Present But Cannot Be Compiled" # configure: WARNING: dlfcn.h: proceeding with the preprocessor's result # configure: WARNING: dlfcn.h: in the future, the compiler will take precedence # My guess that the problem lay with CPPFLAGS seems to be correct. With this # macro reduced to a direct call to AC_CHECK_HEADERS, there are no warnings # now that CPPFLAGS contains -mno-cygwin when it needs it. -- lh, 061214 -- # AW 070609: I restored the previous version, since otherwise the warnings # still pop up for the cl compiler AC_DEFUN([AC_COIN_CHECK_HEADER], [#if test x"$4" = x; then # hdr="#include <$1>" #else # hdr="$4" #fi #AC_CHECK_HEADERS([$1],[$2],[$3],[$hdr]) AC_CHECK_HEADERS([$1],[$2],[$3],[$4]) ]) # AC_COIN_CHECK_HEADER ########################################################################### # COIN_CHECK_CXX_CHEADER # ########################################################################### # This macro checks for C header files that are used from C++. For a give # stub (e.g., math), it first checks if the C++ library (cmath) is available. # If it is, it defines HAVE_CMATH (or whatever the stub is). If it is not # available, it checks for the old C head (math.h) and defines HAVE_MATH_H # if that one exists. AC_DEFUN([AC_COIN_CHECK_CXX_CHEADER], [AC_LANG_PUSH(C++) AC_COIN_CHECK_HEADER([c$1],[$2],[$3],[$4]) if test "$ac_cv_header_c$1" != "yes"; then AC_COIN_CHECK_HEADER([$1.h],[$2],[$3],[$4]) fi AC_LANG_POP(C++) ]) # AC_COIN_CHECK_CXX_CHEADER ########################################################################### # COIN_PROG_CC # ########################################################################### # Find the compile command by running AC_PROG_CC (with compiler names # for different operating systems) and put it into CC (unless it was # given my the user), and find an appropriate value for CFLAGS. It is # possible to provide additional -D flags in the variable CDEFS. AC_DEFUN([AC_COIN_PROG_CC], [AC_REQUIRE([AC_COIN_ENABLE_MSVC]) AC_LANG_PUSH(C) # For consistency, we set the C compiler to the same value of the C++ # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" AC_MSG_WARN([C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX]) fi ;; esac fi AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.]) AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options]) AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options]) AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options]) coin_has_cc=yes save_cflags="$CFLAGS" # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. # Depending on the user's PATH, when Studio/Workshop cc is not present we may # find /usr/ucb/cc, which is almost certainly not a good choice for the C # compiler. In this case, put cc after gcc. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl gcc" else comps="gcc icl cl" fi ;; *-*-solaris*) AC_CHECK_PROG(sol_cc_compiler,cc,cc,[],[],/usr/ucb/cc) if test "$sol_cc_compiler" = "cc" ; then comps="cc xlc gcc pgcc icc" else comps="xlc gcc pgcc icc cc" fi ;; *-*-darwin*) comps="clang gcc cc" ;; *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;; *-linux-*) comps="xlc gcc cc pgcc icc" ;; *) comps="xlc_r xlc cc gcc pgcc icc" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } # AC_MSG_NOTICE([C compiler candidates: $comps]) AC_PROG_CC([$comps]) if test -z "$CC" ; then AC_MSG_ERROR([Failed to find a C compiler!]) fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.]) fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; esac AM_CONDITIONAL(COIN_CC_IS_CL, [test $coin_cc_is_cl = true]) # Check if a project specific CFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} if test x$coin_tmp = xset; then eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} fi fi if test x"$CFLAGS" = x; then coin_add_cflags= coin_opt_cflags= coin_dbg_cflags= coin_warn_cflags= if test "$GCC" = "yes"; then case "$CC" in icc* | */icc*) ;; *) coin_opt_cflags="-O3" coin_add_cflags="-pipe" coin_dbg_cflags="-g -O0" coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cflags="-pedantic-errors $coin_warn_cflags" ;; esac esac fi if test -z "$coin_opt_cflags"; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' coin_dbg_cflags='-MDd' else coin_opt_cflags='-MT -O2' coin_dbg_cflags='-MTd' fi coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -Ox' coin_dbg_cflags='-MDd -debug' else coin_opt_cflags='-MT -Ox' coin_dbg_cflags='-MTd -debug' fi coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CC" in icc* | */icc*) coin_opt_cflags="-O3 -ip -mp1" coin_add_cflags="" coin_dbg_cflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CFLAGS= AC_TRY_LINK([],[int i=0; i++;],[], [coin_add_cflags="-i_dynamic $coin_add_cflags"]) ;; pgcc* | */pgcc*) coin_opt_cflags="-fast" coin_add_cflags="-Kieee -pc 64" coin_dbg_cflags="-g" ;; esac ;; *-ibm-*) case "$CC" in xlc* | */xlc* | mpxlc* | */mpxlc*) coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_cflags="-g" ;; esac ;; *-hp-*) coin_opt_cflags="-O" coin_add_cflags="-Ae" coin_dbg_cflags="-g" ;; *-*-solaris*) coin_opt_cflags="-xO4" coin_dbg_cflags="-g" ;; *-sgi-*) coin_opt_cflags="-O -OPT:Olimit=0" coin_dbg_cflags="-g" ;; esac fi if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then coin_dbg_cflags="-g" fi if test -z "$coin_opt_cflags"; then # Try if -O option works if nothing else is set CFLAGS="-O" AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"]) fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cflags" = xyes; then coin_warn_cflags= fi if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" fi DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" if test "$coin_debug_compile" = "true"; then CFLAGS="$DBG_CFLAGS" else CFLAGS="$OPT_CFLAGS" fi else CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$CFLAGS" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$CFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CFLAGS works save_CFLAGS="$CFLAGS" AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=]) if test -z "$CFLAGS"; then AC_MSG_WARN([The value CFLAGS="$save_CFLAGS" do not work. I will now just try '-O', but you might want to set CFLAGS manually.]) CFLAGS='-O' AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=]) if test -z "$CFLAGS"; then AC_MSG_WARN([This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually.]) fi fi AC_MSG_NOTICE([C compiler options are: $CFLAGS]) AC_ARG_VAR(MPICC,[C MPI Compiler]) if test x"$MPICC" = x; then :; else AC_MSG_NOTICE([Will use MPI C compiler $MPICC]) CC="$MPICC" fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac AC_LANG_POP(C) ]) # AC_COIN_PROG_CC ########################################################################### # COIN_PROG_F77 # ########################################################################### # Find the compile command by running AC_PROG_F77 (with compiler names # for different operating systems) and put it into F77 (unless it was # given by the user), and find an appropriate value for FFLAGS AC_DEFUN([AC_COIN_PROG_F77], [AC_REQUIRE([AC_COIN_ENABLE_MSVC]) AC_REQUIRE([AC_COIN_PROG_CC]) AC_REQUIRE([AC_COIN_F77_COMPS]) AC_LANG_PUSH([Fortran 77]) AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options]) AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options]) AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options]) coin_has_f77=yes save_fflags="$FFLAGS" # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; } # This is a real belt-and-suspenders approach. AC_COIN_FIND_F77 will use # coin_f77_comps to see if there's a program that matches one of the names. # If there's no such program, F77 = unavailable. If we match the name, # feed AC_PROG_F77 the same search list, just to be sure it's a functioning # compiler. # AC_MSG_NOTICE([Fortran compiler candidates: $coin_f77_comps]) AC_COIN_FIND_F77 if test "$F77" != "unavailable" ; then AC_PROG_F77($coin_f77_comps) else AC_MSG_WARN([Failed to find a Fortran compiler!]) fi FFLAGS="$save_fflags" # Check if a project specific FFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set} if test x$coin_tmp = xset; then eval FFLAGS=\${${COIN_PRJCT}_FFLAGS} fi fi if test "$F77" != "unavailable" && test x"$FFLAGS" = x ; then coin_add_fflags= coin_opt_fflags= coin_dbg_fflags= coin_warn_fflags= if test "$G77" = "yes"; then coin_opt_fflags="-O3" coin_add_fflags="-pipe" coin_dbg_fflags="-g -O0" else case $build in *-cygwin* | *-mingw*) case $F77 in ifort* | */ifort* | IFORT* | */IFORT* ) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_fflags='-MD -O3' coin_dbg_fflags='-MDd -debug' else coin_opt_fflags='-MT -O3' coin_dbg_fflags='-MTd -debug' fi coin_add_fflags='-fpp -nologo' ;; compile_f2c*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_fflags='-MD -O2' coin_dbg_fflags='-MDd' else coin_opt_fflags='-MT -O2' coin_dbg_fflags='-MTd' fi coin_add_fflags='-nologo -wd4996' ;; esac ;; *-linux-*) case $F77 in ifc* | */ifc* | ifort* | */ifort*) coin_opt_fflags="-O3 -ip" coin_add_fflags="-cm -w90 -w95" coin_dbg_fflags="-g -CA -CB -CS" # Check if -i_dynamic is necessary (for new glibc library) FFLAGS= AC_TRY_LINK(,[ write(*,*) 'Hello world'],[], [coin_add_fflags="-i_dynamic $coin_add_fflags"]) ;; pgf77* | */pgf77* | pgf90* | */pgf90*) coin_opt_fflags="-fast" coin_add_fflags="-Kieee -pc 64" coin_dbg_fflags="-g" ;; esac ;; *-ibm-*) case "$F77" in xlf* | */xlf* | mpxlf* | */mpxlf* ) coin_opt_fflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_fflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_fflags="-g -C" ;; esac ;; *-hp-*) coin_opt_fflags="+O3" coin_add_fflags="+U77" coin_dbg_fflags="-C -g" ;; *-*-solaris*) coin_opt_fflags="-O4" coin_dbg_fflags="-g" ;; *-sgi-*) coin_opt_fflags="-O5 -OPT:Olimit=0" coin_dbg_fflags="-g" ;; esac fi if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then coin_dbg_fflags="-g" fi if test -z "$coin_opt_fflags"; then # Try if -O option works if nothing else is set FFLAGS=-O AC_TRY_LINK(,[ integer i], [coin_opt_fflags="-O"]) fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_fflags" = xyes; then coin_warn_fflags= fi if test x${DBG_FFLAGS+set} != xset; then DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags" fi if test x${OPT_FFLAGS+set} != xset; then OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags" fi DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS" OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS" if test "$coin_debug_compile" = "true"; then FFLAGS="$DBG_FFLAGS" else FFLAGS="$OPT_FFLAGS" fi else FFLAGS="$FFLAGS $ADD_FFLAGS" if test x${DBG_FFLAGS+set} != xset; then DBG_FFLAGS="$FFLAGS" fi if test x${OPT_FFLAGS+set} != xset; then OPT_FFLAGS="$FFLAGS" fi fi # Try if FFLAGS works if test "$F77" != "unavailable" ; then AC_TRY_LINK(,[ integer i],[],[FFLAGS=]) if test -z "$FFLAGS"; then AC_MSG_WARN([The flags FFLAGS="$FFLAGS" do not work. I will now just try '-O', but you might want to set FFLAGS manually.]) FFLAGS='-O' AC_TRY_LINK(,[ integer i],[],[FFLAGS=]) if test -z "$FFLAGS"; then AC_MSG_WARN([This value for FFLAGS does not work. I will continue with empty FFLAGS, but you might want to set FFLAGS manually.]) fi fi fi AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS]) AC_ARG_VAR(MPIF77,[Fortran MPI Compiler]) if test x"$MPIF77" = x; then :; else AC_MSG_NOTICE([Will use MPI Fortran compiler $MPIF77]) F77="$MPIF77" fi # correct the LD variable if we use the intel fortran compiler in windows case $build in *-cygwin* | *-mingw*) case "$F77" in ifort* | */ifort* | IFORT* | */IFORT*) LD=link ;; esac ;; esac AC_LANG_POP([Fortran 77]) ]) # AC_COIN_PROG_F77 ########################################################################### # COIN_F77_WRAPPERS # ########################################################################### # Calls autoconfs AC_F77_LIBRARY_LDFLAGS and does additional corrections to FLIBS. # Then calls AC_F77_WRAPPERS to get Fortran namemangling scheme. # # To ensure that the FLIBS are determined and corrected before linking against # Fortran compilers is attempted by other macros, we put it into an extra macro # and call it via AC_REQUIRE. This way it seems to be called before the macros # required by AC_F77_WRAPPERS. AC_DEFUN([_AC_COIN_F77_LIBRARY_LDFLAGS], [AC_BEFORE([AC_PROG_F77],[$0])dnl # get FLIBS AC_F77_LIBRARY_LDFLAGS orig_FLIBS="$FLIBS" # If FLIBS has been set by the user, we just restore its value here if test x"$save_FLIBS" != x; then FLIBS="$save_FLIBS" else # This is to correct a missing exclusion in autoconf 2.59 if test x"$FLIBS" != x; then my_flibs= for flag in $FLIBS; do case $flag in -lcrt*.o) ;; -lcygwin) ;; -lgcc*) ;; *) my_flibs="$my_flibs $flag" ;; esac done FLIBS="$my_flibs" fi case $build in # The following is a fix to define FLIBS for ifort on Windows # In its original version, it linked in libifcorert.lib or libifcorertd.lib on Windows/ifort explicitly. # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables. # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line. # Further, excluding libc.lib from the default libs seemed to be necessary only for VS < 8. # Since the corresponding flag seems to make more trouble than it avoids, it has been removed now. *-cygwin* | *-mingw*) case "$F77" in # ifort* | */ifort* | IFORT* | */IFORT*) # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib" # if "$coin_debug_compile" = true ; then # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib" # else # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib" # fi # ;; compile_f2c*) FLIBS=`$F77 -FLIBS` ;; esac;; *-hp-*) FLIBS="$FLIBS -lm";; *-ibm-*) FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;; *-linux-*) case "$F77" in pgf77* | */pgf77* | pgf90* | */pgf90*) # ask linker to go through the archives multiple times # (the Fortran compiler seems to do that automatically...) FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;; esac esac ac_cv_f77_libs="$FLIBS" fi if test "x$orig_FLIBS" != "x$FLIBS" ; then AC_MSG_NOTICE([Corrected Fortran libraries: $FLIBS]) fi ]) # _AC_COIN_F77_LIBRARY_LDFLAGS AC_DEFUN([AC_COIN_F77_WRAPPERS], [AC_BEFORE([AC_COIN_PROG_F77],[$0])dnl AC_REQUIRE([_AC_COIN_F77_LIBRARY_LDFLAGS])dnl AC_LANG_PUSH([Fortran 77]) AC_F77_WRAPPERS AC_LANG_POP([Fortran 77]) ]) # AC_COIN_F77_WRAPPERS ########################################################################### # COIN_FIND_F77 # ########################################################################### # Attempt to preempt autoconf by locating an appropriate F77 program. This # macro will not trigger a fatal error if a suitable compiler cannot be # found. It should be called before COIN_PROG_F77 or COIN_TRY_FLINK. AC_DEFUN([AC_COIN_FIND_F77], [AC_REQUIRE([AC_COIN_ENABLE_MSVC]) AC_REQUIRE([AC_COIN_F77_COMPS]) AC_MSG_NOTICE([Trying to determine Fortran compiler name]) AC_CHECK_TOOLS([F77],[$coin_f77_comps],[unavailable]) ]) # Auxilliary macro to make sure both COIN_PROG_F77 and COIN_FIND_F77 use # the same search lists for compiler names. # For *-*-solaris*, promote Studio/Workshop compilers to front of list. AC_DEFUN([AC_COIN_F77_COMPS], [case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then coin_f77_comps="ifort fl32 compile_f2c gfortran g95 g77" else coin_f77_comps="gfortran ifort g95 g77 fl32 compile_f2c" fi ;; *-*-solaris*) coin_f77_comps="f95 f90 g95 f77 xlf_r fort77 gfortran g77 pgf90 pgf77 ifort ifc frt af77" ;; *-linux-gnu*) coin_f77_comps="gfortran ifort g95 fort77 f77 g77 pgf90 pgf77 ifc frt af77 xlf_r" ;; *) coin_f77_comps="xlf_r fort77 gfortran ifort g95 f77 g77 pgf90 pgf77 ifc frt af77" ;; esac ]) ########################################################################### # COIN_INIT_AUTOMAKE # ########################################################################### # This macro calls the regular INIT_AUTOMAKE and MAINTAINER_MODE # macros, and defines additional variables and makefile conditionals, # that are used in the maintainer parts of the makfile. It also # checks if the correct versions of the autotools are used. # # This also defines the AC_SUBST variables: # abs_source_dir absolute path to source code for this package # abs_bin_dir absolute path to the directory where binaries are # going to be installed (prefix/bin) # abs_lib_dir absolute path to the directory where libraries are # going to be installed (prefix/lib) # abs_include_dir absolute path to the directory where the header files # are installed (prefix/include) AC_DEFUN([AC_COIN_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_EGREP]) AC_REQUIRE([AC_PROG_LN_S]) # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake AM_INIT_AUTOMAKE AM_MAINTAINER_MODE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) AC_SUBST(LIBTOOLM4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME AC_CACHE_CHECK([whether we are using the correct autotools], [ac_cv_use_correct_autotools], [ac_cv_use_correct_autotools=check]) if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf AC_CHECK_PROG([have_autoconf],[autoconf],[yes],[no]) if test $have_autoconf = no; then AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find autoconf in your path.]) fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of autoconf]) autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then AC_MSG_RESULT([yes]) else rm -f confauto.out AC_MSG_RESULT([no]) AC_MSG_ERROR([You don't have the correct version of autoconf as the first one in your path.]) fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location AC_MSG_CHECKING([whether autoconf is coming from the correct location]) autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then AC_MSG_RESULT([yes]) else rm -f confauto.out AC_MSG_RESULT([no]) AC_MSG_ERROR([The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.]) fi # Check if we have automake AC_CHECK_PROG([have_automake],[automake],[yes],[no]) if test $have_automake = no; then AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find automake in your path.]) fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of automake]) automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then AC_MSG_RESULT([yes]) else rm -f confauto.out AC_MSG_RESULT([no]) AC_MSG_ERROR([You don't have the correct version of automake as the first one in your path.]) fi rm -f confauto.out # Check if the executable automake is picked up from the correct location AC_MSG_CHECKING([whether automake is coming from the correct location]) automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then AC_MSG_RESULT([yes]) else rm -f confauto.out AC_MSG_RESULT([no]) AC_MSG_ERROR([The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.]) fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` AC_COIN_CHECK_FILE([$want_dir/libtool/ltmain.sh], [have_ltmain=yes], [have_ltmain=no]) AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of libtool.]) if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([You don't have the correct version of libtool.]) fi else AC_MSG_RESULT([no]) AC_MSG_ERROR([I cannot find the ltmain.sh file.]) fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi AC_COIN_CHECK_FILE([$want_dir/aclocal/libtool.m4], [LIBTOOLM4="$want_dir/aclocal/libtool.m4"], [AC_MSG_ERROR([I cannot find the libtool.m4 file.])]) # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https AC_CHECK_PROG([have_svn],[svn],[yes],[no]) if test x$have_svn = xyes; then AC_CACHE_CHECK([whether svn understands https], [ac_cv_svn_understands_https], [svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out]) fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else AC_MSG_ERROR(Cannot find the BuildTools directory, better disable maintainer mode.) fi fi fi AC_SUBST(BUILDTOOLSDIR) # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AC_SUBST(AUX_DIR) AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` AC_SUBST(abs_source_dir) # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` AC_SUBST(abs_lib_dir) abs_lib_dir=$full_prefix/lib AC_SUBST(abs_include_dir) abs_include_dir=$full_prefix/include AC_SUBST(abs_bin_dir) abs_bin_dir=$full_prefix/bin AM_CONDITIONAL(HAVE_EXTERNALS, test $coin_have_externals = yes && test x$have_svn = xyes) # AC_MSG_NOTICE([End automake initialisation.]) ]) # AC_COIN_INIT_AUTOMAKE ########################################################################### # COIN_CREATE_LIBTOOL # ########################################################################### # This does all the tests necessary to create the libtool script in the # package base directory. If this is used, then the COIN_INIT_AUTO_TOOLS # test in the subdirectories will be able to skip the libtool tests and # just use the one in the package base directory. m4_define([AC_COIN_CREATE_LIBTOOL], [AC_CANONICAL_BUILD # Check if user wants to produce debugging code AC_COIN_DEBUG_COMPILE # Get the name of the C compiler and appropriate compiler options AC_COIN_PROG_CC # Get the name of the C++ compiler and appropriate compiler options AC_COIN_PROG_CXX # Get the name of the Fortran compiler and appropriate compiler options AC_COIN_PROG_F77 # Initialize automake and libtool # AC_MSG_NOTICE([Calling INIT_AUTO_TOOLS from CREATE_LIBTOOL.]) AC_COIN_INIT_AUTO_TOOLS # AC_MSG_NOTICE([Finished INIT_AUTO_TOOLS from CREATE_LIBTOOL.]) ]) ########################################################################### # COIN_INIT_AUTO_TOOLS # ########################################################################### # Initialize the auto tools automake and libtool, with all # modifications we want for COIN packages. # # RPATH_FLAGS link flags for hardcoding path to shared objects # This is a trick to have this code before AC_COIN_PROG_LIBTOOL AC_DEFUN([AC_COIN_DISABLE_STATIC], [ coin_disable_shared=no # Test if force_shared has been set if test "x$1" = xforce_shared; then if test x$enable_shared = xno; then AC_MSG_ERROR([Shared libraries are disabled by user, but this is not feasible with the given options]) fi enable_shared=yes; else case $build in *-cygwin* | *-mingw*) coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in clang* ) AC_MSG_WARN([Building of DLLs not supported in this configuration.]) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) AC_MSG_NOTICE([Building of DLLs not supported in this configuration.]) ;; *gcc*) if test x"$enable_dependency_linking" = xyes; then coin_disable_shared=no else AC_MSG_WARN([Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built]) fi ;; *) AC_MSG_WARN([Building of DLLs not supported in this configuration.]) ;; esac fi ;; *-aix*) coin_disable_shared=yes platform=AIX if test x"$enable_shared" = xyes; then AC_MSG_WARN([Shared objects are not supported.]) fi ;; esac fi if test x"$coin_disable_shared" = xyes; then if test x"$enable_shared" = xyes; then : else # we don't disable shared, because it was not selected anyway coin_disable_shared=no fi enable_shared=no fi # By default, we only want the shared objects to be compiled AC_DISABLE_STATIC ]) m4_define([AC_COIN_INIT_AUTO_TOOLS], [{AC_BEFORE([AC_COIN_PROG_CXX],[$0]) AC_BEFORE([AC_COIN_PROG_CC],[$0]) AC_BEFORE([AC_COIN_PROG_F77],[$0]) # START AC_COIN_DISABLE_STATIC([$1]) # Initialize automake AC_COIN_INIT_AUTOMAKE LIBTOOL= if test -f ../libtool; then coin_config_dir=.. LIBTOOL='$(SHELL) $(top_builddir)/../libtool' fi if test "x$LIBTOOL" = x; then if test -f ../../libtool; then coin_config_dir=../.. LIBTOOL='$(SHELL) $(top_builddir)/../../libtool' fi fi if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) # Stuff for libtool AC_COIN_PROG_LIBTOOL # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) # set RPATH_FLAGS to the compiler link flags required to hardcode location # of the shared objects AC_COIN_RPATH_FLAGS([$abs_lib_dir]) else AC_MSG_NOTICE([Using libtool script in directory $coin_config_dir]) # get all missing information from the config.log file # output variables and defines as_save_IFS=$IFS IFS=' ' for oneline in `cat $coin_config_dir/config.status`; do case "$oneline" in # First some automake conditionals s,@am__fastdep* | s,@AR@* | s,@CPP@* | s,@CPPFLAGS@* | s,@CXXCPP@* | \ s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \ s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \ s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; s,@DEFS@* ) command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; esac done IFS=$as_save_IFS # And some defines (assuming here that the packages base dir # doesn't have a config.h file for word in $defsline; do # echo word $word case $word in -DHAVE_@<:@A-Z_@:>@*_H=1 | -DSTDC_HEADERS=1 ) i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` # echo dd $i echo $i >>confdefs.h ;; esac done fi # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) AC_ARG_ENABLE([dependency-linking], [AC_HELP_STRING([--disable-dependency-linking], [disable linking library dependencies into shared libraries])], [dependency_linking="$enableval"], [dependency_linking=auto]) if test "$dependency_linking" = auto; then # On Cygwin and AIX, building DLLs doesn't work dependency_linking=no if test x"$coin_disable_shared" = xno; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) dependency_linking=no ;; *gcc*) dependency_linking=yes ;; *) dependency_linking=yes ;; esac ;; *) dependency_linking=yes ;; esac fi fi if test "$dependency_linking" = yes ; then LT_LDFLAGS="-no-undefined" else LT_LDFLAGS= fi AM_CONDITIONAL(DEPENDENCY_LINKING, [test "$dependency_linking" = yes]) # Check if we want to set the library version AC_MSG_CHECKING([if library version is set]) if test x"$coin_libversion" != x; then LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion" AC_MSG_RESULT([$coin_libversion]) else AC_MSG_RESULT([no]) fi AC_SUBST(LT_LDFLAGS) #END }]) ########################################################################### # COIN_PATCH_LIBTOOL_CYGWIN # ########################################################################### # Patches to libtool for cygwin. Lots for cl, a few for GCC. # For cl: # - cygpath is not correctly quoted in fix_srcfile_path # - paths generated for .lib files is not run through cygpath -w AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN], [ case "$CXX" in clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? AC_MSG_NOTICE(Applying patches to libtool for CLANG compiler) sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) AC_MSG_NOTICE(Applying patches to libtool for cl compiler) sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%lib /OUT:%lib -OUT:%' \ -e "s%cygpath -w%$CYGPATH_W%" \ -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$[]1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$[]1"'); done%' \ -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$[]1"') '"$mydos2unix"'%' \ -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ libtool > conftest.bla ;; *) AC_MSG_NOTICE(Applying patches to libtool for GNU compiler) sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; esac mv conftest.bla libtool chmod 755 libtool ]) # COIN_PATCH_LIBTOOL_CYGWIN ########################################################################### # COIN_PATCH_LIBTOOL_SOLARIS # ########################################################################### # If we want to do a 64-bit build with GCC on Solaris, the system search # libraries need to point to 64-bit subdirectories. If they do not already do # that, fix them. This patch is evolving, as are GCC compilers. GCC 4.2.1 # reports the correct search list, given the correct call. GCC 4.1.1 does not. # `Correct call' means -m64 is specified. `Correct search list' seems to amount # to prepending the list of 64-bit subdirectories to the 32-bit directories. # Both SPARC and x86 have this issue, but a different hardware id string is # required depending on the underlying CPU. The macro executes isainfo to get # the string. This will fail, of course, if we're cross-compiling. The # alternative is to fail on a regular basis each time a new CPU identifier is # needed. This macro will also fail if the search list reported with # -print-search-dirs differs between the C, C++, and Fortran compilers; each # have their own setting in libtool. If GCC reports the correct search list # given the -m64 flag, the best solution is to define CC='gcc -m64', and # similarly for CXX, F77, so that libtool will make the correct call. ########################################################################### AC_DEFUN([AC_COIN_PATCH_LIBTOOL_SOLARIS], [ if test "$GCC" = yes && \ (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then hdwisa=`isainfo | sed -e 's/\(@<:@^ @:>@*\) .*$/\1/'` if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then AC_MSG_NOTICE([Applying patches to libtool for 64-bit GCC compilation]) fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then # AC_MSG_NOTICE(Compensating for broken gcc) for lib in $fixlibtmp ; do if test -d "${lib}${hdwisa}" ; then syslibpath64="$syslibpath64 ${lib}${hdwisa}/" fi done syslibpath64="${syslibpath64} ${fixlibtmp}" else syslibpath64="$fixlibtmp" fi sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi # AC_MSG_NOTICE(Result is ) # $EGREP 'sys_lib_search_path_spec=' libtool fi ]) # COIN_PATCH_LIBTOOL_SOLARIS ########################################################################### # COIN_PROG_LIBTOOL # ########################################################################### # Setup the libtool stuff together with any modifications to make it # work on additional platforms AC_DEFUN([AC_COIN_PROG_LIBTOOL], [# No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- # AC_REQUIRE([AC_COIN_DLFCN_H]) # NEW: If libtool exists in the directory higher up, we use that one # instead of creating a new one # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED # out in front of this macro body. You'll notice that LIBTOOL is already # defined here. We'll have to count on this macro not being called if libtool # already exists, or at least move the libtool fixes outside the conditional. # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".]) # This test is therefore removed. -- lh, 061214 -- # if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Calling PROG_LIBTOOL.]) AC_PROG_LIBTOOL # AC_MSG_NOTICE([Finished PROG_LIBTOOL.]) AC_SUBST(ac_c_preproc_warn_flag) AC_SUBST(ac_cxx_preproc_warn_flag) AC_MSG_NOTICE([Build is "$build".]) mydos2unix='| dos2unix' case $build in *-mingw*) CYGPATH_W=echo mydos2unix= ;; esac case $build in # Here we need to check if -m32 is specified. If so, we need to correct # sys_lib_search_path_spec *-cygwin* | *-mingw*) AC_COIN_PATCH_LIBTOOL_CYGWIN ;; *x86_64-*) if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then AC_MSG_NOTICE(Applying patches to libtool for 32bit compilation) sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi ;; *-solaris*) AC_COIN_PATCH_LIBTOOL_SOLARIS ;; # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. *-darwin*) AC_MSG_NOTICE(Applying patches to libtool for Darwin) sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool ;; esac # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of # the macro. -- lh, 061214 -- # fi # AC_MSG_NOTICE([End libtool initialisation.]) ]) # AC_COIN_PROG_LIBTOOL # This is a trick to force the check for the dlfcn header to be done before # the checks for libtool # No longer needed now that CPPFLAGS is correctly set. -- lh, 061214 -- # ACDEFUN([AC_COIN_DLFCN_H], # [AC_LANG_PUSH(C) # AC_COIN_CHECK_HEADER([dlfcn.h]) # AC_LANG_POP(C) # ]) # AC_COIN_DLFCN_H ########################################################################### # COIN_RPATH_FLAGS # ########################################################################### # This macro, in case shared objects are used, defines a variable # RPATH_FLAGS that can be used by the linker to hardwire the library # search path for the given directories. This is useful for example # Makefiles AC_DEFUN([AC_COIN_RPATH_FLAGS], [RPATH_FLAGS= if test $enable_shared = yes; then case $build in *-linux-*) if test "$GXX" = "yes"; then RPATH_FLAGS= for dir in $1; do RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" done fi ;; *-darwin*) RPATH_FLAGS=nothing ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) RPATH_FLAGS=nothing ;; esac ;; *-hp-*) RPATH_FLAGS=nothing ;; *-mingw32) RPATH_FLAGS=nothing ;; *-*-solaris*) RPATH_FLAGS= for dir in $1; do RPATH_FLAGS="$RPATH_FLAGS -R$dir" done esac if test "$RPATH_FLAGS" = ""; then AC_MSG_WARN([Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually.]) fi if test "$RPATH_FLAGS" = "nothing"; then RPATH_FLAGS= fi fi AC_SUBST(RPATH_FLAGS) ]) # AC_COIN_RPATH_FLAGS ########################################################################### # COIN_LINK_INPUT_CMD # ########################################################################### # This macro determines which command should be used to "link" files # that are input to the generated executables. On Windows, the codes # using the native Windows system libraries, cannot understand symbolic # links, and a copy should be used instead of 'ln -s'. # The result is stored in coin_link_input_cmd AC_DEFUN([AC_COIN_LINK_INPUT_CMD], [AC_REQUIRE([AC_PROG_LN_S]) AC_BEFORE([AC_COIN_PROG_CC], [$0]) AC_BEFORE([AC_COIN_ENABLE_MSVC], [$0]) AC_MSG_CHECKING([which command should be used to link input files]) coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac AC_MSG_RESULT($coin_link_input_cmd) ]) ########################################################################### # COIN_FINALIZE # ########################################################################### # This macro should be called at the very end of the configure.ac file. # It creates the output files (by using AC_OUTPUT), and might do some other # things (such as generating links to data files in a VPATH configuration). # It also prints the "success" message. # Note: If the variable coin_skip_ac_output is set to yes, then no output # files are written. AC_DEFUN([AC_COIN_FINALIZE], [ AC_REQUIRE([AC_COIN_LINK_INPUT_CMD]) if test x$coin_skip_ac_output != xyes; then # library extension AC_SUBST(LIBEXT) case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration AC_SUBST(VPATH_DISTCLEANFILES) VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" AC_SUBST(ABSBUILDDIR) fi AC_OUTPUT if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then AC_MSG_NOTICE(Copying data files for VPATH configuration) else AC_MSG_NOTICE(Creating VPATH links for data files) fi for file in $coin_vpath_link_files; do dir=`AS_DIRNAME(["./$file"])` if test -d $dir; then : ; else AS_MKDIR_P($dir) fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi AC_MSG_NOTICE([In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting]) if test x$coin_projectdir = xyes; then AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful]) else AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful]) fi else AC_MSG_NOTICE([No configuration of $PACKAGE_NAME necessary]) fi ]) #AC_COIN_FINALIZE ########################################################################### # COIN_VPATH_LINK # ########################################################################### # This macro queues source files that need to be available in the build # directory. In a VPATH configuration, the files will be made available by # symbolic link or copy (when the platform does not support links). The list # is processed by COIN_FINALIZE. The parameter is a whitespace-separated # list of files. AC_DEFUN([AC_COIN_VPATH_LINK], [ AC_REQUIRE([AC_COIN_CHECK_VPATH]) # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="$1" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi ]) #AC_COIN_VPATH_LINK ########################################################################### # COIN_ENABLE_GNU_PACKAGES # ########################################################################### # This macro defined the --enable-gnu-packages flag. This can be used # to check if a user wants to compile GNU packges (such as readline) # into the executable. By default, GNU packages are disabled. AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES], [AC_ARG_ENABLE([gnu-packages], [AC_HELP_STRING([--enable-gnu-packages], [compile with GNU packages (disabled by default)])], [coin_enable_gnu=$enableval], [coin_enable_gnu=no]) ]) # AC_COIN_ENABLE_GNU_PACKAGES ####################################################################### # COIN_CHECK_LIBM # ####################################################################### # For a (space separated) list of arguments X, this macro adds the flags # for linking against the math library to a X_LIBS and X_PCLIBS. AC_DEFUN([AC_COIN_CHECK_LIBM], [AC_BEFORE([AC_COIN_PROG_CC],[$0]) if test $coin_cc_is_cl != true ; then coin_foreach_w([myvar], [$1], [ m4_toupper(myvar)_LIBS="-lm $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_PCLIBS="-lm $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS_INSTALLED="-lm $m4_toupper(myvar)_LIBS_INSTALLED" ]) fi ]) # AC_COIN_CHECK_LIBM ########################################################################### # COIN_CHECK_GNU_ZLIB # ########################################################################### # This macro checks for the libz library. If found, it sets the automake # conditional COIN_HAS_ZLIB and defines the C preprocessor variable # COIN_HAS_ZLIB. Further, for a (space separated) list of arguments X, # it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED. # TODO the macro name should be changed to AC_COIN_CHECK_ZLIB AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB], [ AC_BEFORE([AC_COIN_PROG_CXX],[$0]) AC_BEFORE([AC_COIN_PROG_CC],[$0]) AC_BEFORE([AC_COIN_PROG_F77],[$0]) AC_BEFORE([$0],[AC_COIN_FINALIZE]) coin_has_zlib=no AC_ARG_ENABLE([zlib], [AC_HELP_STRING([--disable-zlib],[do not compile with compression library zlib])], [coin_enable_zlib=$enableval], [coin_enable_zlib=yes]) if test $coin_enable_zlib = yes; then AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes]) if test $coin_has_zlib = yes; then AC_CHECK_LIB([z],[gzopen],[:],[coin_has_zlib=no]) fi if test $coin_has_zlib = yes; then coin_foreach_w([myvar], [$1], [ m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_PCLIBS="-lz $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS_INSTALLED="-lz $m4_toupper(myvar)_LIBS_INSTALLED" ]) AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available]) fi fi AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes) ]) # AC_COIN_CHECK_GNU_ZLIB ########################################################################### # COIN_CHECK_GNU_BZLIB # ########################################################################### # This macro checks for the libbz2 library. If found, it defines the C # preprocessor variable COIN_HAS_BZLIB. Further, for a (space separated) list # of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED. # TODO the macro name should be changed to AC_COIN_CHECK_BZLIB AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB], [ AC_BEFORE([AC_COIN_PROG_CXX],[$0]) AC_BEFORE([AC_COIN_PROG_CC],[$0]) AC_BEFORE([AC_COIN_PROG_F77],[$0]) AC_BEFORE([$0],[AC_COIN_FINALIZE]) AC_ARG_ENABLE([bzlib], [AC_HELP_STRING([--disable-bzlib],[do not compile with compression library bzlib])], [coin_enable_bzlib=$enableval], [coin_enable_bzlib=yes]) coin_has_bzlib=no if test $coin_enable_bzlib = yes; then AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes]) if test $coin_has_bzlib = yes; then AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],[:],[coin_has_bzlib=no]) fi if test $coin_has_bzlib = yes; then coin_foreach_w([myvar], [$1], [ m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_PCLIBS="-lbz2 $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS_INSTALLED="-lbz2 $m4_toupper(myvar)_LIBS_INSTALLED" ]) AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available]) fi fi ]) # AC_COIN_CHECK_GNU_BZLIB ########################################################################### # COIN_CHECK_GNU_READLINE # ########################################################################### # This macro checks for GNU's readline. It verifies that the header # readline/readline.h is available, and that the -lreadline library # contains "readline". It is assumed that #include is included # in the source file before the #include # If found, it defines the C preprocessor variable COIN_HAS_READLINE. # Further, for a (space separated) list of arguments X, it adds the # linker flag to the variable X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED. AC_DEFUN([AC_COIN_CHECK_GNU_READLINE], [AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES]) AC_BEFORE([AC_COIN_PROG_CXX],[$0]) AC_BEFORE([AC_COIN_PROG_CC],[$0]) AC_BEFORE([AC_COIN_PROG_F77],[$0]) AC_BEFORE([$0],[AC_COIN_FINALIZE]) coin_has_readline=no if test $coin_enable_gnu = yes; then AC_COIN_CHECK_HEADER([readline/readline.h], [coin_has_readline=yes],[], [#include ]) coin_save_LIBS="$LIBS" LIBS= # First we check if tputs and friends are available if test $coin_has_readline = yes; then AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[], [coin_has_readline=no]) fi # Now we check for readline if test $coin_has_readline = yes; then AC_CHECK_LIB([readline],[readline],[:],[coin_has_readline=no]) fi if test $coin_has_readline = yes; then coin_foreach_w([myvar], [$1], [ m4_toupper(myvar)_LIBS="-lreadline $LIBS $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_PCLIBS="-lreadline $LIBS $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS_INSTALLED="-lreadline $LIBS $m4_toupper(myvar)_LIBS_INSTALLED" ]) AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available]) fi LIBS="$coin_save_LIBS" fi ]) # AC_COIN_CHECK_GNU_READLINE ########################################################################### # COIN_CHECK_GMP # ########################################################################### # This macro checks for the gmp library. If found, it defines the C # preprocessor variable COIN_HAS_GMP. Further, for a (space separated) list # of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED. AC_DEFUN([AC_COIN_CHECK_GMP], [ AC_BEFORE([AC_COIN_PROG_CXX],[$0]) AC_BEFORE([AC_COIN_PROG_CC],[$0]) AC_BEFORE([AC_COIN_PROG_F77],[$0]) AC_BEFORE([$0],[AC_COIN_FINALIZE]) AC_ARG_ENABLE([gmp], [AC_HELP_STRING([--disable-gmp],[do not compile with GNU multiple precision library])], [coin_enable_gmp=$enableval], [coin_enable_gmp=yes]) coin_has_gmp=no if test $coin_enable_gmp = yes; then AC_COIN_CHECK_HEADER([gmp.h],[AC_CHECK_LIB([gmp],[__gmpz_init],[coin_has_gmp=yes])]) if test $coin_has_gmp = yes ; then coin_foreach_w([myvar], [$1], [ m4_toupper(myvar)_LIBS="-lgmp $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_PCLIBS="-lgmp $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS_INSTALLED="-lgmp $m4_toupper(myvar)_LIBS_INSTALLED" ]) AC_DEFINE([COIN_HAS_GMP],[1],[Define to 1 if GMP is available]) fi fi ]) # AC_COIN_CHECK_GMP ########################################################################### # COIN_CHECK_ISFINITE # ########################################################################### # This macro checks for a usable implementation of a function to check # whether a given floating point number is finite. # If a function is found, then the macro defines the symbol # toupper($1)_C_FINITE to the name of this function. AC_DEFUN([AC_COIN_CHECK_ISFINITE],[ AC_LANG_PUSH(C++) AC_COIN_CHECK_CXX_CHEADER(math) AC_COIN_CHECK_CXX_CHEADER(float) AC_COIN_CHECK_CXX_CHEADER(ieeefp) COIN_C_FINITE= AC_CHECK_DECL([isfinite],[COIN_C_FINITE=isfinite],,[ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif]) if test -z "$COIN_C_FINITE"; then AC_CHECK_DECL([finite],[COIN_C_FINITE=finite],,[ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif]) if test -z "$COIN_C_FINITE"; then AC_CHECK_DECL([_finite],[COIN_C_FINITE=_finite],,[ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif]) fi fi if test -z "$COIN_C_FINITE"; then AC_MSG_WARN(Cannot find C-function for checking Inf.) else AC_DEFINE_UNQUOTED(COIN_C_FINITE,[$COIN_C_FINITE], [Define to be the name of C-function for Inf check]) fi AC_LANG_POP(C++) ]) ########################################################################### # COIN_CHECK_ISNAN # ########################################################################### # This macro checks for a usable implementation of a function to check # whether a given floating point number represents NaN. # If a function is found, then the macro defines the symbol COIN_C_ISNAN # to the name of this function. AC_DEFUN([AC_COIN_CHECK_ISNAN],[ AC_LANG_PUSH(C++) AC_COIN_CHECK_CXX_CHEADER(math) AC_COIN_CHECK_CXX_CHEADER(float) AC_COIN_CHECK_CXX_CHEADER(ieeefp) COIN_C_ISNAN= AC_CHECK_DECL([isnan],[COIN_C_ISNAN=isnan],,[ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif]) # It appears that for some systems (e.g., Mac OSX), cmath will provide only # std::isnan, and bare isnan will be unavailable. Typically we need a parameter # in the test to allow C++ to do overload resolution. if test -z "$COIN_C_ISNAN"; then AC_CHECK_DECL([std::isnan(42.42)],[COIN_C_ISNAN=std::isnan],,[ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif]) fi if test -z "$COIN_C_ISNAN"; then AC_CHECK_DECL([_isnan],[COIN_C_ISNAN=_isnan],,[ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif]) fi if test -z "$COIN_C_ISNAN"; then AC_CHECK_DECL([isnand],[COIN_C_ISNAN=isnand],,[ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif]) fi if test -z "$COIN_C_ISNAN"; then AC_MSG_WARN(Cannot find C-function for checking NaN.) else AC_DEFINE_UNQUOTED(COIN_C_ISNAN,[$COIN_C_ISNAN], [Define to be the name of C-function for NaN check]) fi AC_LANG_POP(C++) ]) ########################################################################### # COIN_DATA_PATH # ########################################################################### # This macro defines a preprocessor macro with the absolute path to a # subdirectory of Data. The argument of this macro is the name of the # subdirectory (in correct case), and the name of the macro is # COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of # the directory. The path ends with a separator ("/" for linux and # '\\' for Windows). The default value for this path can be # overwritten with the input variable with the same name # (COIN_DATA_DIR_PATH). At this point we chech only for the # $srcdir/../Data subdirectory. AC_DEFUN([AC_COIN_DATA_PATH], [AC_MSG_CHECKING([absolute path to data directory $1]) AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory]) if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd` fi # Under Cygwin, use Windows path. Add separator case $build in *-cygwin*) m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\ ;; *) m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/" ;; esac if test -d $m4_toupper(COIN_DATA_$1_PATH); then AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"], [Define to absolute path for Data subdirectory $1]) AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH)) else AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist) fi ]) # AC_COIN_DATA_PATH ########################################################################### # COIN_LINK_FROM_FILELIST # ########################################################################### # This macro creates links (or copies, if necessary) to files listed # as content in a text file (second argument) into a target directory # (first argument), which is created if it doesn't exist yet. If s link # already exists, nothing happens. AC_DEFUN([AC_COIN_LINKCOPY_FROM_FILELIST], [cmd="$3" if test -r $srcdir/$2 ; then my_target_dir="$1" my_link_files=`cat $srcdir/$2` my_dirname=`AS_DIRNAME($2)` # if test -e $my_target_dir; then : ; else # AS_MKDIR_P($my_target_dir) # fi for i in $my_link_files; do #rm -rf $my_target_dir/$i if test -e $my_target_dir/$i; then : ; else dirn2=`AS_DIRNAME($my_target_dir/$i)` if test -d $dirn2; then : ; else AS_MKDIR_P($dirn2) fi $cmd $abs_source_dir/$my_dirname/$i $my_target_dir/$i fi done else AC_MSG_WARN([File list file $2 missing!]) fi ]) AC_DEFUN([AC_COIN_LINK_FROM_FILELIST], [ AC_REQUIRE([AC_COIN_LINK_INPUT_CMD]) echo Creating links in $1 ... AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, $coin_link_input_cmd) ]) ########################################################################### # COIN_COPY_FROM_FILELIST # ########################################################################### # Like COIN_LINK_FROM_FILELIST, but copies the files. AC_DEFUN([AC_COIN_COPY_FROM_FILELIST], [ echo Creating copies in $1 ... AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, [cp]) ]) ########################################################################### # COIN_EXAMPLE_FILES # ########################################################################### # This macro determines the names of the example files (using the # argument in an "ls" command) and sets up the variables EXAMPLE_FILES # and EXAMPLE_CLEAN_FILES. If this is a VPATH configuration, it also # creates soft links to the example files. AC_DEFUN([AC_COIN_EXAMPLE_FILES], [AC_REQUIRE([AC_COIN_CHECK_VPATH]) AC_REQUIRE([AC_COIN_ENABLE_MSVC]) AC_REQUIRE([AC_PROG_LN_S]) files=`cd $srcdir; ls $1` # We need to do the following loop to make sure that are no newlines # in the variable for file in $files; do EXAMPLE_FILES="$EXAMPLE_FILES $file" done if test $coin_vpath_config = yes; then lnkcmd= if test "$enable_msvc" = yes; then lnkcmd=cp fi case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) lnkcmd=cp ;; esac if test "x$lnkcmd" = xcp; then AC_MSG_NOTICE([Copying example files ($1)]) else AC_MSG_NOTICE([Creating links to the example files ($1)]) lnkcmd="$LN_S" fi for file in $EXAMPLE_FILES; do rm -f $file $lnkcmd $srcdir/$file $file done EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES $1" else EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES" fi # In case there are compressed files, we create a variable with the # uncompressed names EXAMPLE_UNCOMPRESSED_FILES= for file in $EXAMPLE_FILES; do case $file in *.gz) EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" ;; esac done AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES) AC_SUBST(EXAMPLE_FILES) AC_SUBST(EXAMPLE_CLEAN_FILES) ]) #AC_COIN_EXAMPLE_FILES ########################################################################### # COIN_CHECK_USER_LIBRARY # ########################################################################### # This macro sets up usage of a user library with header files. The assumption # is that the header file(s) and library do not reside in standard system # directories, hence both the include directory and link flags must be # specified. There are two mandatory arguments and two optional arguments. # # The first argument (mandatory) should be a name (LibraryName) for the # library. The second argument (mandatory) should be an abbreviation in # upper case letters (LBRY) for the library. Ultimately, the macro will # specify two variables, LBRYINCDIR and LBRYLIB, to be substituted in files # generated during configuration; a preprocessor symbol COIN_HAS_LBRY; and a # matching automake conditional COIN_HAS_LBRY. LBRYINCDIR should specify the # directory containing include files for the library. LBRYLIB should specify # the flags necessary to link to the library. A variable coin_has_lbry will # be set to true or false, as appropriate. A variable lbry_libcheck will be # be set to yes or no; no indicates link checks should not be attempted. # # The macro defines three configure arguments, --with-libraryname-incdir, # --with-libraryname-lib, and --disable-libraryname-libcheck, by converting # LibraryName to lower case. # # LBRYINCDIR and LBRYLIB can be specified as environment variables or as # part of the configure command using --with-libraryname-incdir and # --with-libraryname-lib, respectively. Command line arguments override # environment variables. # # If a third argument is given, it should specify a file in LBRYINCDIR. The # macro will check for the presence of the file. If a fourth argument is given, # it should specify a function name, `fname'. The macro will attempt to link a # trivial program containing a parameterless call to the function, `fname()', # using the LBRYLIB flags. The link check uses C as the language; this has been # adequate to date but has limitations. It is possible to disable the link # check by specifying --disable-libraryname-libcheck. This is a workaround for # instances where the link check does not work properly, for whatever reason. # If you're trying to link to a Fortran library, consider using F77_FUNC or # FC_FUNC to obtain a mangled fname appropriate for use from C code. For a C++ # library, you're on your own unless the library declares some function with # extern "C" linkage. Otherwise, you'll have to somehow find the mangled C++ # name. # A fifth argument can be specified to include linker flags that may be required # to sucessfully perform the linking check. # # An optional sixth argument can be given to specify a list of targets. # For each target X, the variables X_LIBS and X_PCLIBS will be extended by $LBRYLIB, # if the library has been found and seems to work. AC_DEFUN([AC_COIN_CHECK_USER_LIBRARY], [ AC_REQUIRE([AC_COIN_PROJECTDIR_INIT]) AC_MSG_CHECKING(if user provides library for $1) # Check for header file directory AC_ARG_WITH(m4_tolower($1)-incdir, AS_HELP_STRING([--with-m4_tolower($1)-incdir], [specify the header file directory for library $1]), [$2INCDIR=`cd $withval; pwd`]) # Check for library directory AC_ARG_WITH(m4_tolower($1)-lib, AS_HELP_STRING([--with-m4_tolower($1)-lib], [specify the flags used to link with the library $1]), [$2LIB=$withval]) # Switch to disable library check if requested AC_ARG_ENABLE(m4_tolower($1)-libcheck, AS_HELP_STRING([--disable-m4_tolower($1)-libcheck], [skip the link check at configuration time]), [m4_tolower($1)_libcheck=$enableval], [m4_tolower($1)_libcheck=yes]) # At this point, if we're going to use the library, both LBRYINCDIR and # LBRYLIB must be defined and not empty. if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then AC_MSG_ERROR([You need to specify both an include directory and link flags to use library $1. Use --with-m4_tolower($1)-incdir of environment variable $$2INCDIR to specify the include directory. Use --with-m4_tolower($1)-lib or environment variable $$2LIB to specify link flags.]) fi m4_tolower(coin_has_$2)=true AC_MSG_RESULT(yes) else m4_tolower(coin_has_$2)=false AC_MSG_RESULT(no) fi # If we have instructions for use, consider header and link checks. if test $m4_tolower(coin_has_$2) = true; then # If argument 3 (file) is given, check for the file. Typically this will be a # header file, but that's not assumed. m4_ifval([$3], [AC_COIN_CHECK_FILE([$$2INCDIR/$3],[], [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])]) # Now see if we can link the function. There are arguments for and against # assuming argument 3 is a header file declaring the function. A correct # function declaration is the main argument in favour. Having to cope with # possible dependencies or other oddities are the main arguments against. # Force the use of C as the best single choice amongst C++, C, and Fortran. # Obviously, this has limits. m4_ifvaln([$4], [if test x"$m4_tolower($1)_libcheck" != xno; then coin_save_LIBS="$LIBS" LIBS="$$2LIB $5" coin_$2_link=no AC_LANG_PUSH(C) for fnm in $4 ; do AC_MSG_CHECKING([whether symbol $fnm is available with $2]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$fnm()]])], [AC_MSG_RESULT(yes) coin_$2_link=yes break], [AC_MSG_RESULT(no)]) done AC_LANG_POP(C) LIBS="$coin_save_LIBS" if test x"$coin_$2_link" != xyes ; then AC_MSG_ERROR([Cannot find symbol(s) $4 with $2]) fi fi]) # If we make it this far, we've verified the file and linked the function. Add # the necessary link flags to $6_{PC}LIBS and define the preprocessor symbol # COIN_HAS_LBRY. coin_foreach_w([myvar], [$6], [ m4_toupper(myvar)_LIBS="$$2LIB $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_PCLIBS="$$2LIB $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS_INSTALLED="$$2LIB $m4_toupper(myvar)_LIBS_INSTALLED" ]) AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available]) fi # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the # automake conditional. These actions must occur unconditionally. AC_SUBST($2INCDIR) AC_SUBST($2LIB) AM_CONDITIONAL(COIN_HAS_$2, test $m4_tolower(coin_has_$2) = true) ]) #AC_COIN_CHECK_USER_LIBRARY ########################################################################### # COIN_TRY_FLINK # ########################################################################### # Auxilliary macro to test if a Fortran function name can be linked, # given the current settings of LIBS. We determine from the context, what # the currently active programming language is, and cast the name accordingly. # The first argument is the name of the function/subroutine, in small letters, # the second argument are the actions taken when the test works, and the # third argument are the actions taken if the test fails. AC_DEFUN([AC_COIN_TRY_FLINK], [case $ac_ext in f) AC_TRY_LINK(,[ call $1],[$2],[$3]) ;; c) AC_F77_FUNC($1,cfunc$1) if test x"$coin_need_flibs" = xyes; then flink_try=no; else AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()], [flink_try=yes],[flink_try=no]) fi if test $flink_try = yes; then $2 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()], [LIBS="$flink_save_libs" coin_need_flibs=yes $2 ], [LIBS="$flink_save_libs" $3]) else $3 fi fi ;; cc|cpp) AC_F77_FUNC($1,cfunc$1) if test x"$coin_need_flibs" = xyes; then flink_try=no; else AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()], [flink_try=yes],[flink_try=no]) fi if test $flink_try = yes; then $2 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()], [LIBS="$flink_save_libs" coin_need_flibs=yes $2 ], [LIBS="$flink_save_libs" $3]) else $3 fi fi ;; esac ]) # AC_COIN_TRY_FLINK ########################################################################### # COIN_DOXYGEN # ########################################################################### # # This macro determines the configuration information for doxygen, the tool # used to generate online documentation of COIN code. It takes one parameter, # a list of projects (mixed-case, to match the directory names) that should # be processed as external tag files. E.g., COIN_DOXYGEN([Clp Osi]). # # This macro will define the following variables: # coin_have_doxygen Yes if doxygen is found, no otherwise # coin_doxy_usedot Defaults to `yes'; --with-dot will still check to see # if dot is available # coin_doxy_tagname Name of doxygen tag file (placed in doxydoc directory) # coin_doxy_logname Name of doxygen log file (placed in doxydoc directory) # coin_doxy_tagfiles List of doxygen tag files used to reference other # doxygen documentation # coin_doxy_excludes Directories to exclude from doxygen processing AC_DEFUN([AC_COIN_DOXYGEN], [ AC_MSG_NOTICE([configuring doxygen documentation options]) # Check to see if doxygen is available. AC_CHECK_PROG([coin_have_doxygen],[doxygen],[yes],[no]) AC_CHECK_PROG([coin_have_latex],[latex],[yes],[no]) # Look for the dot tool from the graphviz package, unless the user has # disabled it. AC_ARG_WITH([dot], AS_HELP_STRING([--with-dot], [use dot (from graphviz) when creating documentation with doxygen if available; --without-dot to disable]), [],[withval=yes]) if test x"$withval" = xno ; then coin_doxy_usedot=NO AC_MSG_CHECKING([for dot ]) AC_MSG_RESULT([disabled]) else AC_CHECK_PROG([coin_doxy_usedot],[dot],[YES],[NO]) fi # Generate a tag file name and a log file name AC_SUBST([coin_doxy_tagname],[doxydoc/${PACKAGE}_doxy.tag]) AC_SUBST([coin_doxy_logname],[doxydoc/${PACKAGE}_doxy.log]) AM_CONDITIONAL(COIN_HAS_DOXYGEN, [test $coin_have_doxygen = yes]) AM_CONDITIONAL(COIN_HAS_LATEX, [test $coin_have_latex = yes]) # Process the list of project names and massage them into possible doxygen # doc'n directories. Prefer 1) classic external, source processed using # a project-specific doxygen.conf, we use the tag file; 2) classic # external, source processed using package doxygen.conf; 3) installed # doxydoc. Alternatives 1) and 2) are only possible if the directory will be # configured, which we can't know unless this is the package base configure, # since coin_subdirs is only set there. Hence it's sufficient to check for # membership. If we use a tag file from a classic external, exclude the # source from doxygen processing when doxygen runs in the base directory. coin_doxy_tagfiles= coin_doxy_excludes= tmp="$1" for proj in $tmp ; do lc_proj=`echo $proj | [tr [A-Z] [a-z]]` AC_MSG_CHECKING([for doxygen doc'n for $proj ]) doxytag=${lc_proj}_doxy.tag doxyfound=no # proj will be configured, hence doxydoc present in build tree doxysrcdir="${srcdir}/../${proj}" # AC_MSG_NOTICE([Considering $doxysrcdir (base)]) if test -d "$doxysrcdir" ; then # with a doxydoc directory? doxydir="$doxysrcdir/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (base)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) if test -d "$doxydir" ; then # use tag file; don't process source doxydir="../${proj}/doxydoc" coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=../../$doxydir/html" AC_MSG_RESULT([$doxydir (tag)]) coin_doxy_excludes="$coin_doxy_excludes */${proj}" else # will process the source -- nothing further to be done here AC_MSG_RESULT([$doxysrcdir (src)]) fi doxyfound=yes fi # Not built, fall back to installed tag file if test $doxyfound = no ; then eval doxydir="${datadir}/coin/doc/${proj}/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (install)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html" AC_MSG_RESULT([$doxydir (tag)]) fi done AC_SUBST([coin_doxy_tagfiles]) AC_SUBST([coin_doxy_excludes]) ]) # AC_COIN_DOXYGEN ########################################################################### # COIN_HAS_PKGCONFIG # ########################################################################### # This macro checks whether a pkg-config tool with a minimal version number # is available. If so, then the variable PKGCONFIG is set to its path. # If not, PKGCONFIG is set to "". The minimal version number can be given # as first parameter, by default it is 0.16.0, since COIN-OR .pc files now # include an URL field, which breaks pkg-config version <= 0.15. # This macro is a modified version of PKG_PROG_PKG_CONFIG in pkg.m4. # Further, the AM_CONDITIONAL COIN_HAS_PKGCONFIG is set and PKGCONFIG is # AC_SUBST'ed. Finally, if this setup belongs to a project directory, then # the search path for .pc files is assembled from the value of # $PKG_CONFIG_PATH, the values of --prefix, --coin-instdir, and the directories # named in a file ../coin_subdirs.txt or ../../coin_subdirs.txt in a variable # COIN_PKG_CONFIG_PATH, which is also AC_SUBST'ed. For a path xxx given in the # coin-subdirs.txt, also the directory xxx/pkgconfig is added, if existing. AC_DEFUN([AC_COIN_HAS_PKGCONFIG], [AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_ENABLE([pkg-config], [AC_HELP_STRING([--disable-pkg-config],[disable use of pkg-config (if available)])], [use_pkgconfig="$enableval"], [if test x$coin_cc_is_cl = xtrue; then use_pkgconfig=no else use_pkgconfig=yes fi]) if test $use_pkgconfig = yes ; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_CHECK_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.16.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi # check if pkg-config supports the short-errors flag if test -n "$PKG_CONFIG" && \ $PKG_CONFIG --atleast-pkgconfig-version 0.20; then pkg_short_errors=" --short-errors " else pkg_short_errors="" fi fi AM_CONDITIONAL([COIN_HAS_PKGCONFIG], [test -n "$PKG_CONFIG"]) AC_SUBST(PKG_CONFIG) # assemble pkg-config search path for installed projects COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" # let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there # best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig, # unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}... if test "x${prefix}" = xNONE ; then COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" else COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi AC_ARG_WITH([coin-instdir], AC_HELP_STRING([--with-coin-instdir], [prefix of installation directory for precompiled COIN packages]), [if test -d "$withval"; then : ; else AC_MSG_ERROR([argument for --with-coin-instdir not a directory]) fi COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" ],[]) AC_SUBST(COIN_PKG_CONFIG_PATH) # assemble additional pkg-config search paths for uninstalled projects if test x$coin_projectdir = xyes ; then # if we are in a project setup, then in a classic setup, we want to find uninstalled projects # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory # unfortunately, if the user set prefix, then we do not know where the project base directory is located # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data) COIN_PKG_CONFIG_PATH_UNINSTALLED= if test -f ../coin_subdirs.txt ; then for i in `cat ../coin_subdirs.txt` ; do if test -d ../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi if test -f ../../coin_subdirs.txt ; then for i in `cat ../../coin_subdirs.txt` ; do if test -d ../../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi AC_SUBST(COIN_PKG_CONFIG_PATH_UNINSTALLED) fi if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then AC_MSG_WARN([Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config.]) fi ]) ########################################################################### # COIN_PKG_CHECK_PROJECT_EXISTS # ########################################################################### # COIN_PKG_CHECK_PROJECT_EXISTS(PROJECT, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular project exists. Similar # to PKG_CHECK_MODULES(), but set only the variables $1_VERSION and $1_PKG_ERRORS variables # AC_DEFUN([AC_COIN_PKG_CHECK_PROJECT_EXISTS], [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG]) if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "m4_tolower($1)"; then m4_toupper($1)[]_VERSION=`$PKG_CONFIG --modversion "m4_tolower($1)" 2>/dev/null` m4_ifval([$2], [$2], [:]) else m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "m4_tolower($1)"` $3 fi else AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config") fi ]) ########################################################################### # COIN_PKG_CHECK_MODULE_EXISTS # ########################################################################### # COIN_PKG_CHECK_MODULES_EXISTS(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of packages exists. # Similar to PKG_CHECK_MODULES(), but set only the variable $1_VERSIONS and $1_PKG_ERRORS # AC_DEFUN([AC_COIN_PKG_CHECK_MODULE_EXISTS], [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG]) if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "$2"; then m4_toupper($1)[]_VERSIONS=`$PKG_CONFIG --modversion "$2" 2>/dev/null | tr '\n' ' '` $3 else m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$2"` $4 fi else AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config") fi ]) ########################################################################### # COIN_PKG_HAS_MODULE # ########################################################################### # COIN_PKG_HAS_MODULE(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Checks whether pkg-config files for a given set of packages is available. # If so, sets MODULE_CFLAGS, MODULE_LIBS, and MODULES_DATA and executes ACTION-IF-FOUND. # If not, then ACTION-IF-NOT-FOUND is executed. # A reason for not finding a package is stored in MODULE_PKG_ERRORS # # -------------------------------------------------------------- AC_DEFUN([AC_COIN_PKG_HAS_MODULE], [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG]) AC_COIN_PKG_CHECK_MODULE_EXISTS([$1],[$2], [ cflags=`$PKG_CONFIG --cflags "$2" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command [cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`] fi m4_toupper($1)[]_CFLAGS="$cflags" m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "$2" 2>/dev/null` m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "$2" 2>/dev/null` $3 ], [ $4 ]) ])# PKG_CHECK_MODULES ########################################################################### # COIN_MAIN_PACKAGEDIR # ########################################################################### # This macro substitutes COIN_MAIN_SUBDIR. # If $2/$1 or $1 is in COIN_SKIP_PROJECTS, do nothing. # If --with-$1-lib, --with-$1-incdir, or --with-$1-datadir is given, then assume that the package is installed. # Otherwise, if the directory $2/$1 and the file $2/$1/$3 exist, check whether $2/$1/configure exists. # If so, include this directory into the list of directories where configure and make recourse into. # tolower(coin_has_$1) is set to "no" if the project source is not available or will not be compiled. # Otherwise, it will be set to "yes". AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],[ AC_MSG_CHECKING([whether source of project $1 is available and should be compiled]) m4_tolower(coin_has_$1)=notGiven coin_reason= # check if user wants to skip project in any case AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration]) if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "$1"; then m4_tolower(coin_has_$1)="no" coin_reason="$1 has been specified in COIN_SKIP_PROJECTS" fi m4_ifval($2,[ if test $dir = "$2/$1"; then m4_tolower(coin_has_$1)="no" coin_reason="$2/$1 has been specified in COIN_SKIP_PROJECTS" fi]) done fi if test "$m4_tolower(coin_has_$1)" != no; then AC_ARG_WITH([m4_tolower($1)],, [if test "$withval" = no ; then m4_tolower(coin_has_$1)="no" coin_reason="--without-m4_tolower($1) has been specified" fi ]) fi if test "$m4_tolower(coin_has_$1)" != no; then AC_ARG_WITH([m4_tolower($1)-lib], AC_HELP_STRING([--with-m4_tolower($1)-lib], [linker flags for using project $1]), [if test "$withval" = no ; then m4_tolower(coin_has_$1)="no" coin_reason="--without-m4_tolower($1)-lib has been specified" else m4_tolower(coin_has_$1)="no" coin_reason="--with-m4_tolower($1)-lib has been specified" fi], []) fi if test "$m4_tolower(coin_has_$1)" != no; then AC_ARG_WITH([m4_tolower($1)-incdir], AC_HELP_STRING([--with-m4_tolower($1)-incdir], [directory with header files for using project $1]), [if test "$withval" = no ; then m4_tolower(coin_has_$1)="no" coin_reason="--without-m4_tolower($1)-incdir has been specified" else m4_tolower(coin_has_$1)="no" coin_reason="--with-m4_tolower($1)-incdir has been specified" fi], []) fi if test "$m4_tolower(coin_has_$1)" != no; then AC_ARG_WITH([m4_tolower($1)-datadir], AC_HELP_STRING([--with-m4_tolower($1)-datadir], [directory with data files for using project $1]), [if test "$withval" = no ; then m4_tolower(coin_has_$1)="no" coin_reason="--without-m4_tolower($1)-datadir has been specified" else m4_tolower(coin_has_$1)="no" coin_reason="--with-m4_tolower($1)-datadir has been specified" fi], []) fi m4_if(m4_tolower($1), blas, [ if test $m4_tolower(coin_has_$1) != no; then #--with-blas can overwrite --with-blas-lib, and can be set to BUILD to enforce building blas AC_ARG_WITH([blas], AC_HELP_STRING([--with-blas], [specify BLAS library (or BUILD to enforce use of ThirdParty/Blas)]), [if test x"$withval" = "xno" ; then coin_has_blas="no" coin_reason="--without-blas has been specified" elif test x"$withval" != "xBUILD" ; then coin_has_blas="no" coin_reason="--with-blas has been specified" fi], []) fi ]) m4_if(m4_tolower($1), lapack, [ if test $m4_tolower(coin_has_$1) != no; then #--with-lapack can overwrite --with-lapack-lib, and can be set to BUILD to enforce building lapack AC_ARG_WITH([lapack], AC_HELP_STRING([--with-lapack], [specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack)]), [if test x"$withval" = "xno" ; then coin_has_lapack="no" coin_reason="--without-lapack has been specified" elif test x"$withval" != "xBUILD" ; then coin_has_lapack="no" coin_reason="--with-lapack has been specified" fi], []) fi ]) # check if project is available in present directory if test "$m4_tolower(coin_has_$1)" = notGiven; then m4_tolower(coin_has_$1)=no if test -d $srcdir/m4_ifval($2,[$2/],)$1; then coin_reason="source in m4_ifval($2,[$2/],)$1" # If a third argument is given, then we have to check if one one the files given in that third argument is present. # If none of the files in the third argument is available, then we consider the project directory as non-existing. # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient. m4_ifvaln([$3], [for i in $srcdir/m4_ifval($2,[$2/],)$1/$3; do if test -r $i; then m4_tolower(coin_has_$1)="yes" else m4_tolower(coin_has_$1)="no" coin_reason="source file $i not available" break fi done], [ m4_tolower(coin_has_$1)="yes" ]) fi fi if test -z "$coin_reason" ; then AC_MSG_RESULT([$m4_tolower(coin_has_$1)]) else AC_MSG_RESULT([$m4_tolower(coin_has_$1), $coin_reason]) fi if test "$m4_tolower(coin_has_$1)" = yes ; then if test -r $srcdir/m4_ifval($2,[$2/],)$1/configure; then coin_subdirs="$coin_subdirs m4_ifval($2,[$2/],)$1" AC_CONFIG_SUBDIRS(m4_ifval($2,[$2/],)$1) fi fi ]) ########################################################################### # COIN_CHECK_PACKAGE # ########################################################################### # This macro checks for the existance of a COIN-OR package and provides compiler and linker flags to compile against this package. # A package can consists of one or more COIN-OR or other projects. # It defines the PACKAGE_CFLAGS, PACKAGE_LIBS, PACKAGE_DEPENDENCIES, and PACKAGE_DATA variables, referring to the compiler and linker # flags to use when linking against this module, the libraries the package depends on, and the directories where the module data resists. # The difference between PACKAGE_LIBS and PACKAGE_DEPENDENCIES is that PACKAGE_DEPENDENCIES does not contain arguments starting with '-', # so it can be used to setup the _DEPENDENCIES variable in a Makefile.am. # It also defines a COIN_HAS_PACKAGE preprocessor macro and makefile conditional. # Further, tolower(coin_has_$1) is set to "yes". # If a list of build targets using this projects is given in the third argument, # then the compiler and linker variables and .pc file setup variable corresponding to this build target # are extended with the values for this package. # That is, for each build target X, the variables X_CFLAGS, X_LIBS, X_DEPENDENCIES, X_PCLIBS, X_PCREQUIRES are setup, # whereas the last two specify the values to put into the "Libs:" and "Requires:" fields of the .pc file, resp. # # The first argument should be the name (PACKAGE) of the package (in correct lower # and upper case). # The second argument should be a (space separated) list of projects which this # package consists of. Optionally, required version numbers can be added. # The optional third argument should be a (space separated) list of build targets # which use this package, if available. # # It is also possible to specify a preinstalled version of this package # or to specify only the linker and compiler flags and data directory. # # If the user did not specify --with-$1-... flags and pkg-config is not available, # COIN_CHECK_PACKAGE_FALLBACK($1, $2, $3) is called. AC_DEFUN([AC_COIN_CHECK_PACKAGE], [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG]) AC_MSG_CHECKING([for COIN-OR package $1]) m4_tolower(coin_has_$1)=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "$1"; then m4_tolower(coin_has_$1)=skipping fi done fi if test "$m4_tolower(coin_has_$1)" != skipping; then AC_ARG_WITH([m4_tolower($1)],, [if test "$withval" = no ; then m4_tolower(coin_has_$1)=skipping fi ]) fi m4_toupper($1_LIBS)= m4_toupper($1_CFLAGS)= m4_toupper($1_DATA)= m4_toupper($1_DEPENDENCIES)= m4_toupper($1_PCLIBS)= m4_toupper($1_PCREQUIRES)= AC_SUBST(m4_toupper($1_LIBS)) AC_SUBST(m4_toupper($1_CFLAGS)) AC_SUBST(m4_toupper($1_DATA)) AC_SUBST(m4_toupper($1_DEPENDENCIES)) AC_SUBST(m4_toupper($1_LIBS_INSTALLED)) AC_SUBST(m4_toupper($1_CFLAGS_INSTALLED)) AC_SUBST(m4_toupper($1_DATA_INSTALLED)) coin_foreach_w([myvar], [$3], [ AC_SUBST(m4_toupper(myvar)_CFLAGS) AC_SUBST(m4_toupper(myvar)_LIBS) AC_SUBST(m4_toupper(myvar)_PCLIBS) AC_SUBST(m4_toupper(myvar)_PCREQUIRES) AC_SUBST(m4_toupper(myvar)_DEPENDENCIES) AC_SUBST(m4_toupper(myvar)_CFLAGS_INSTALLED) AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED) ]) #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $m4_tolower(coin_has_$1) != skipping; then AC_ARG_WITH([m4_tolower($1)-lib], AC_HELP_STRING([--with-m4_tolower($1)-lib], [linker flags for using package $1]), [if test "$withval" = no ; then m4_tolower(coin_has_$1)=skipping else m4_tolower(coin_has_$1)=yes m4_toupper($1_LIBS)="$withval" m4_toupper($1_PCLIBS)="$withval" coin_foreach_w([myvar], [$3], [ m4_toupper(myvar)_PCLIBS="$withval $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS="$withval $m4_toupper(myvar)_LIBS" ]) # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then m4_toupper($1_LIBS_INSTALLED)="$withval" coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_LIBS_INSTALLED="$withval $m4_toupper(myvar)_LIBS_INSTALLED"]) fi fi ], []) fi if test $m4_tolower(coin_has_$1) != skipping; then AC_ARG_WITH([m4_tolower($1)-incdir], AC_HELP_STRING([--with-m4_tolower($1)-incdir], [directory with header files for using package $1]), [if test "$withval" = no ; then m4_tolower(coin_has_$1)=skipping else m4_tolower(coin_has_$1)=yes m4_toupper($1_CFLAGS)="-I`${CYGPATH_W} $withval`" coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS="-I`${CYGPATH_W} $withval` $m4_toupper(myvar)_CFLAGS"]) # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then m4_toupper($1_CFLAGS_INSTALLED)="$m4_toupper($1_CFLAGS)" coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1_CFLAGS) $m4_toupper(myvar)_CFLAGS_INSTALLED"]) fi fi ], []) fi if test $m4_tolower(coin_has_$1) != skipping; then AC_ARG_WITH([m4_tolower($1)-datadir], AC_HELP_STRING([--with-m4_tolower($1)-datadir], [directory with data files for using package $1]), [if test "$withval" = no ; then m4_tolower(coin_has_$1)=skipping else m4_tolower(coin_has_$1)=yes m4_toupper($1_DATA)="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then m4_toupper($1_DATA_INSTALLED)="$withval" fi fi ], []) fi if test $m4_tolower(coin_has_$1) = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic AC_COIN_PKG_HAS_MODULE([$1],[$2], [ m4_tolower(coin_has_$1)=yes AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS]) # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']` fi m4_toupper($1_PCREQUIRES)="$2" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in $3 coin_foreach_w([myvar], [$3], [ m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES" m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS" m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS" ]) ], [ m4_tolower(coin_has_$1)=notGiven AC_MSG_RESULT([not given: $m4_toupper($1)_PKG_ERRORS]) ]) # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else AC_MSG_RESULT([skipped check via pkg-config, redirect to fallback]) AC_COIN_CHECK_PACKAGE_FALLBACK([$1], [$2], [$3]) fi else AC_MSG_RESULT([$m4_tolower(coin_has_$1)]) fi if test $m4_tolower(coin_has_$1) != skipping && test $m4_tolower(coin_has_$1) != notGiven ; then AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available]) AC_ARG_ENABLE([interpackage-dependencies], AC_HELP_STRING([--disable-interpackage-dependencies], [disables deduction of Makefile dependencies from package linker flags]), [], [enable_interpackage_dependencies=yes]) if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) m4_toupper($1)_DEPENDENCIES=`echo " $m4_toupper($1)_LIBS" | [sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g']` coin_foreach_w([myvar], [$3], [ m4_toupper(myvar)_DEPENDENCIES=`echo " $m4_toupper(myvar)_LIBS " | [sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g']` ]) fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$m4_toupper($1)_CFLAGS" ; then AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS]) fi if test -n "$m4_toupper($1)_LIBS" ; then AC_MSG_NOTICE([$1 LIBS are $m4_toupper($1)_LIBS]) fi if test -n "$m4_toupper($1)_DEPENDENCIES" ; then AC_MSG_NOTICE([$1 DEPENDENCIES are $m4_toupper($1)_DEPENDENCIES]) fi if test -n "$m4_toupper($1)_DATA" ; then AC_MSG_NOTICE([$1 DATA is $m4_toupper($1)_DATA]) fi if test -n "$m4_toupper($1)_PCLIBS" ; then AC_MSG_NOTICE([$1 PCLIBS are $m4_toupper($1)_PCLIBS]) fi if test -n "$m4_toupper($1)_PCREQUIRES" ; then AC_MSG_NOTICE([$1 PCREQUIRES are $m4_toupper($1)_PCREQUIRES]) fi coin_foreach_w([myvar], [$3], [ AC_MSG_NOTICE([myvar CFLAGS are $m4_toupper(myvar)_CFLAGS]) AC_MSG_NOTICE([myvar LIBS are $m4_toupper(myvar)_LIBS]) AC_MSG_NOTICE([myvar DEPENDENCIES are $m4_toupper(myvar)_DEPENDENCIES]) ]) fi fi # Define the Makefile conditional AM_CONDITIONAL(m4_toupper(COIN_HAS_$1), [test $m4_tolower(coin_has_$1) != notGiven && test $m4_tolower(coin_has_$1) != skipping]) ]) # AC_COIN_CHECK_PACKAGE ########################################################################### # COIN_CHECK_PACKAGE_FALLBACK # ########################################################################### # This macro is used by COIN_CHECK_PACKAGE, if it fails to find a package # because pkg-config was disabled or is not available. # # For each project xxx specified in $2, it searches for a xxx-uninstalled.pc # file in the directories specified in $COIN_PKG_CONFIG_PATH_UNINSTALLED. The # latter variable is setup by COIN_HAS_PKGCONFIG and consists of the content # of the coin_subdirs.txt file which has been created by configure in the # base directory. The content of xxx-uninstalled.pc is parsed in order # to defines the variables PACKAGE_CFLAGS, PACKAGE_LIBS, and PACKAGE_DATA, # referring to the compiler and linker flags to use when linking against this # package and the directory where the package data resists. Further, for each # build target X specified in the third argument, the variables X_CFLAGS and # X_LIBS are extended with the compiler and linker flags of this package and # the variables X_PCLIBS and X_PCREQUIRES are extended by the list of linker # flags and dependent projects as needed to setup a .pc file. The macros # checks also dependencies of $2. Note that the PACKAGE_DATA variable is # set to the content of datadir of the first .pc file that is parsed. # Finally, for each X in the third argument, also variables # X_CFLAGS_INSTALLED and X_LIBS_INSTALLED are setup. They contain the compiler # and linker flags for X when all projects have been installed. Their content # is assembled from the .pc files that correspond to installed projects. I.e., # whenever a file proj-uninstalled.pc is parsed, then also a corresponding # proj.pc file is parsed for compiler and linker flags, if available in the # same directory. # Similar, a variable PACKAGE_DATA_INSTALLED is setup to the content of datadir # of the first .pc file that is parsed. # # If .pc files for all projects in $2 and their dependencies is found, # tolower(coin_has_$1) is set to "yes". Otherwise, if some dependency # is not found, tolower(coin_has_$1) is set to "notGiven". Further, a # COIN_HAS_PACKAGE preprocessor macro and a makefile conditional are defined. # # The first argument should be the name (PACKAGE) of the package (in correct # lower and upper case). The second argument should be the base names of the # projects .pc file which define this package. The optional third argument # should be a (space separated) list of build targets which use this package, # if available. # # $1 is not checked for $COIN_SKIP_PROJECTS, since we only look into # $COIN_PKG_CONFIG_PATH_UNINSTALLED. When the content of this variable was # setup in the base directory, $COIN_SKIP_PROJECTS has already been considered. AC_DEFUN([AC_COIN_CHECK_PACKAGE_FALLBACK], [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG]) AC_MSG_CHECKING([for COIN-OR package $1 (fallback)]) m4_tolower(coin_has_$1)=notGiven m4_toupper($1_LIBS)= m4_toupper($1_LIBS_INSTALLED)= m4_toupper($1_CFLAGS)= m4_toupper($1_CFLAGS_INSTALLED)= m4_toupper($1_DATA)= m4_toupper($1_DATA_INSTALLED)= m4_toupper($1_PCLIBS)= m4_toupper($1_PCREQUIRES)= # initial list of dependencies is "$2", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="m4_bpatsubsts([$2], [?!?=[ ]*[^ ]+])" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else AC_MSG_WARN([Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples.]) pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=[`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'`] # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=[`echo $projtoprocess | sed -e "s/$proj/$projrequires/"`] # read DATA from $pcfile, if _DATA is still empty if test "x$m4_toupper($1_DATA)" = x ; then projdatadir= [pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile`] eval `sh -c "$pcfilemod"` m4_toupper($1_DATA)="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else AC_MSG_RESULT([no, dependency $proj not available]) allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$m4_toupper($1_DATA_INSTALLED)" = x ; then projdatadir= [pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile`] eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi m4_toupper($1_DATA_INSTALLED)="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^[ ]*//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`] # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`] fi m4_toupper($1_CFLAGS)="$projcflags $m4_toupper($1_CFLAGS)" # set LIBS variable m4_toupper($1_LIBS)="$projlibs $m4_toupper($1_LIBS)" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`] # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`] fi m4_toupper($1_CFLAGS_INSTALLED)="$projcflags $m4_toupper($1_CFLAGS_INSTALLED)" # set LIBS variable m4_toupper($1_LIBS_INSTALLED)="$projlibs $m4_toupper($1_LIBS_INSTALLED)" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up m4_tolower(coin_has_$1)=yes AC_MSG_RESULT([yes]) AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available]) # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']` m4_toupper($1_LIBS_INSTALLED)=`echo " $m4_toupper($1_LIBS_INSTALLED)" | [sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g']` fi m4_toupper($1_PCREQUIRES)="$2" coin_foreach_w([myvar], [$3], [ m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES" m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS" m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1)_CFLAGS_INSTALLED $m4_toupper(myvar)_CFLAGS_INSTALLED" m4_toupper(myvar)_LIBS_INSTALLED="$m4_toupper($1)_LIBS_INSTALLED $m4_toupper(myvar)_LIBS_INSTALLED" ]) fi AM_CONDITIONAL(m4_toupper(COIN_HAS_$1), [test $m4_tolower(coin_has_$1) != notGiven && test $m4_tolower(coin_has_$1) != skipping]) ]) # AC_COIN_CHECK_PACKAGE_FALLBACK ########################################################################### # COIN_CHECK_PACKAGE_BLAS # ########################################################################### # This macro checks for a library containing the BLAS library. It # 1. checks the --with-blas argument # 2. if --with-blas=BUILD has been specified goes to point 5 # 3. if --with-blas has been specified to a working library, sets BLAS_LIBS # to its value # 4. tries standard libraries # 5. calls COIN_CHECK_PACKAGE(Blas, [coinblas], [$1]) to check for # ThirdParty/Blas # The makefile conditional and preprocessor macro COIN_HAS_BLAS is defined. # BLAS_LIBS is set to the flags required to link with a Blas library. # For each build target X in $1, X_LIBS is extended with $BLAS_LIBS. # In case 3 and 4, the flags to link to Blas are added to X_PCLIBS too. # In case 5, Blas is added to X_PCREQUIRES. AC_DEFUN([AC_COIN_CHECK_PACKAGE_BLAS], [ AC_ARG_WITH([blas], AC_HELP_STRING([--with-blas], [specify BLAS library (or BUILD to enforce use of ThirdParty/Blas)]), [use_blas="$withval"], [use_blas=]) # if user specified --with-blas-lib, then we should give COIN_CHECK_PACKAGE # preference AC_ARG_WITH([blas-lib],,[use_blas=BUILD]) # Check if user supplied option makes sense if test x"$use_blas" != x; then if test "$use_blas" = "BUILD"; then # we come to this later : elif test "$use_blas" != "no"; then AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works]) coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="$use_blas $LIBS" AC_COIN_TRY_FLINK([daxpy], [if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi AC_MSG_RESULT([yes: $use_blas])], [AC_MSG_RESULT([no]) AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])]) LIBS="$coin_save_LIBS" fi else # Try to autodetect the library for blas based on build system #AC_MSG_CHECKING([default locations for BLAS]) case $build in *-sgi-*) AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS]) coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lcomplib.sgimath $LIBS" AC_COIN_TRY_FLINK([daxpy], [use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi AC_MSG_RESULT([yes: $use_blas]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" ;; # Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio # cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't # recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims # that CC and cc will understand -library in Studio 13. The main extra # function of -xlic_lib and -library is to arrange for the Fortran run-time # libraries to be linked for C++ and C. We can arrange that explicitly. *-*-solaris*) AC_MSG_CHECKING([for BLAS in libsunperf]) coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lsunperf $FLIBS $LIBS" AC_COIN_TRY_FLINK([daxpy], [use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi AC_MSG_RESULT([yes: $use_blas]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" ;; *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_save_LIBS="$LIBS" AC_MSG_CHECKING([for BLAS in MKL (32bit)]) LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS" AC_COIN_TRY_FLINK([daxpy], [use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' AC_MSG_RESULT([yes: $use_blas]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" if test "x$use_blas" = x ; then AC_MSG_CHECKING([for BLAS in MKL (64bit)]) LIBS="mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib $LIBS" AC_COIN_TRY_FLINK([daxpy], [use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' AC_MSG_RESULT([yes: $use_blas]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" fi ;; esac ;; *-darwin*) AC_MSG_CHECKING([for BLAS in Veclib]) coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-framework Accelerate $LIBS" AC_COIN_TRY_FLINK([daxpy], [use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi AC_MSG_RESULT([yes: $use_blas]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" ;; esac if test -z "$use_blas" ; then AC_MSG_CHECKING([whether -lblas has BLAS]) coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lblas $LIBS" AC_COIN_TRY_FLINK([daxpy], [use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi AC_MSG_RESULT([yes: $use_blas]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" fi # If we have no other ideas, consider building BLAS. if test -z "$use_blas" ; then use_blas=BUILD fi fi if test "x$use_blas" = xBUILD ; then AC_COIN_CHECK_PACKAGE(Blas, [coinblas], [$1]) elif test "x$use_blas" != x && test "$use_blas" != no; then coin_has_blas=yes AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 0]) AC_DEFINE([COIN_HAS_BLAS],[1], [If defined, the BLAS Library is available.]) BLAS_LIBS="$use_blas" BLAS_CFLAGS= BLAS_DATA= AC_SUBST(BLAS_LIBS) AC_SUBST(BLAS_CFLAGS) AC_SUBST(BLAS_DATA) coin_foreach_w([myvar], [$1], [ m4_toupper(myvar)_PCLIBS="$BLAS_LIBS $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS="$BLAS_LIBS $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_LIBS_INSTALLED="$BLAS_LIBS $m4_toupper(myvar)_LIBS_INSTALLED" ]) else coin_has_blas=no AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 1]) fi coin_foreach_w([myvar], [$1], [ AC_SUBST(m4_toupper(myvar)_PCLIBS) AC_SUBST(m4_toupper(myvar)_LIBS) AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED) ]) ]) # AC_COIN_CHECK_PACKAGE_BLAS ########################################################################### # COIN_CHECK_PACKAGE_LAPACK # ########################################################################### # This macro checks for a library containing the LAPACK library. It # 1. checks the --with-lapack argument # 2. if --with-lapack=BUILD has been specified goes to point 5 # 3. if --with-lapack has been specified to a working library, sets # LAPACK_LIBS to its value # 4. tries standard libraries # 5. calls COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]) to check for # ThirdParty/Lapack # The makefile conditional and preprocessor macro COIN_HAS_LAPACK is defined. # LAPACK_LIBS is set to the flags required to link with a Lapack library. # For each build target X in $1, X_LIBS is extended with $LAPACK_LIBS. # In case 3 and 4, the flags to link to Lapack are added to X_PCLIBS too. # In case 5, Lapack is added to X_PCREQUIRES. # # TODO: Lapack usually depends on Blas, so if we check for a system lapack library, # shouldn't we include AC_COIN_CHECK_PACKAGE_BLAS first? # However, if we look for coinlapack via AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]), # then we will get Blas as dependency of coinlapack. AC_DEFUN([AC_COIN_CHECK_PACKAGE_LAPACK], [ AC_ARG_WITH([lapack], AC_HELP_STRING([--with-lapack], [specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack)]), [use_lapack=$withval], [use_lapack=]) #if user specified --with-lapack-lib, then we should give COIN_HAS_PACKAGE preference AC_ARG_WITH([lapack-lib],,[use_lapack=BUILD]) # Check if user supplied option makes sense if test x"$use_lapack" != x; then if test "$use_lapack" = "BUILD"; then # we come to this later : elif test "$use_lapack" != no; then AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works]) coin_need_flibs=no use_lapack="$use_lapack $BLAS_LIBS" coin_save_LIBS="$LIBS" LIBS="$use_lapack $LIBS" AC_COIN_TRY_FLINK([dsyev], [if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi AC_MSG_RESULT([yes: $use_lapack]) ], [AC_MSG_RESULT([no]) AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])]) LIBS="$coin_save_LIBS" fi else if test x$coin_has_blas = xyes; then # First try to see if LAPACK is already available with BLAS library AC_MSG_CHECKING([whether LAPACK is already available with BLAS library]) coin_save_LIBS="$LIBS" coin_need_flibs=no LIBS="$BLAS_LIBS $LIBS" AC_COIN_TRY_FLINK([dsyev], [use_lapack="$BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi AC_MSG_RESULT([yes: $use_lapack]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" fi if test -z "$use_lapack"; then # Try to autodetect the library for lapack based on build system case $build in # TODO: Is this check actually needed here, since -lcomplib.sigmath should have been recognized as Blas library, # and above it is checked whether the Blas library already contains Lapack *-sgi-*) AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK]) coin_save_LIBS="$LIBS" coin_need_flibs=no LIBS="-lcomplib.sgimath $BLAS_LIBS $LIBS" AC_COIN_TRY_FLINK([dsyev], [use_lapack="-lcomplib.sgimath $BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi AC_MSG_RESULT([yes: $use_lapack]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" ;; # See comments in COIN_CHECK_PACKAGE_BLAS. # TODO: Is this check actually needed here, since -lsunperf should have been recognized as Blas library, # and above it is checked whether the Blas library already contains Lapack *-*-solaris*) AC_MSG_CHECKING([for LAPACK in libsunperf]) coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lsunperf $BLAS_LIBS $FLIBS $LIBS" AC_COIN_TRY_FLINK([dsyev], [use_lapack='-lsunperf $BLAS_LIBS' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi AC_MSG_RESULT([yes: $use_lapack]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" ;; # On cygwin, do this check only if doscompile is disabled. The prebuilt library # will want to link with cygwin, hence won't run standalone in DOS. esac fi if test -z "$use_lapack" ; then AC_MSG_CHECKING([whether -llapack has LAPACK]) coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-llapack $BLAS_LIBS $LIBS" AC_COIN_TRY_FLINK([dsyev], [use_lapack='-llapack' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi AC_MSG_RESULT([yes: $use_lapack]) ], [AC_MSG_RESULT([no])]) LIBS="$coin_save_LIBS" fi # If we have no other ideas, consider building LAPACK. if test -z "$use_lapack" ; then use_lapack=BUILD fi fi if test "x$use_lapack" = xBUILD ; then AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]) elif test "x$use_lapack" != x && test "$use_lapack" != no; then coin_has_lapack=yes AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 0]) AC_DEFINE([COIN_HAS_LAPACK],[1], [If defined, the LAPACK Library is available.]) LAPACK_LIBS="$use_lapack" LAPACK_CFLAGS= LAPACK_DATA= AC_SUBST(LAPACK_LIBS) AC_SUBST(LAPACK_CFLAGS) AC_SUBST(LAPACK_DATA) coin_foreach_w([myvar], [$1], [ m4_toupper(myvar)_PCLIBS="$LAPACK_LIBS $m4_toupper(myvar)_PCLIBS" m4_toupper(myvar)_LIBS="$LAPACK_LIBS $m4_toupper(myvar)_LIBS" m4_toupper(myvar)_LIBS_INSTALLED="$LAPACK_LIBS $m4_toupper(myvar)_LIBS_INSTALLED" ]) else coin_has_lapack=no AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 1]) fi coin_foreach_w([myvar], [$1], [ AC_SUBST(m4_toupper(myvar)_PCLIBS) AC_SUBST(m4_toupper(myvar)_LIBS) AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED) ]) ]) # AC_COIN_CHECK_PACKAGE_LAPACK CoinMP-1.8.3/Osi/0000755000175000017500000000000012600453455012052 5ustar renereneCoinMP-1.8.3/Osi/Makefile.in0000644000175000017500000011454112506051753014125 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ @COIN_HAS_CPX_TRUE@am__append_1 = src/OsiCpx @COIN_HAS_CPX_TRUE@am__append_2 = osi-cplex.pc @COIN_HAS_GLPK_TRUE@am__append_3 = src/OsiGlpk @COIN_HAS_GLPK_TRUE@am__append_4 = osi-glpk.pc @COIN_HAS_MSK_TRUE@am__append_5 = src/OsiMsk @COIN_HAS_MSK_TRUE@am__append_6 = osi-mosek.pc @COIN_HAS_XPR_TRUE@am__append_7 = src/OsiXpr @COIN_HAS_XPR_TRUE@am__append_8 = osi-xpress.pc @COIN_HAS_GRB_TRUE@am__append_9 = src/OsiGrb @COIN_HAS_GRB_TRUE@am__append_10 = osi-gurobi.pc @COIN_HAS_SOPLEX_TRUE@am__append_11 = src/OsiSpx @COIN_HAS_SOPLEX_TRUE@am__append_12 = osi-soplex.pc # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball @ALWAYS_FALSE@am__append_13 = test DIST_COMMON = README $(am__configure_deps) \ $(srcdir)/BuildTools/Makemain.inc $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/osi-uninstalled.pc.in \ $(srcdir)/osi-unittests-uninstalled.pc.in \ $(srcdir)/osi-unittests.pc.in $(srcdir)/osi.pc.in \ $(top_srcdir)/configure $(top_srcdir)/doxydoc/doxygen.conf.in \ $(top_srcdir)/examples/Makefile.in \ $(top_srcdir)/src/OsiCpx/osi-cplex-uninstalled.pc.in \ $(top_srcdir)/src/OsiCpx/osi-cplex.pc.in \ $(top_srcdir)/src/OsiGlpk/osi-glpk-uninstalled.pc.in \ $(top_srcdir)/src/OsiGlpk/osi-glpk.pc.in \ $(top_srcdir)/src/OsiGrb/osi-gurobi-uninstalled.pc.in \ $(top_srcdir)/src/OsiGrb/osi-gurobi.pc.in \ $(top_srcdir)/src/OsiMsk/osi-mosek-uninstalled.pc.in \ $(top_srcdir)/src/OsiMsk/osi-mosek.pc.in \ $(top_srcdir)/src/OsiSpx/osi-soplex-uninstalled.pc.in \ $(top_srcdir)/src/OsiSpx/osi-soplex.pc.in \ $(top_srcdir)/src/OsiXpr/osi-xpress-uninstalled.pc.in \ $(top_srcdir)/src/OsiXpr/osi-xpress.pc.in AUTHORS config.guess \ config.sub depcomp install-sh ltmain.sh missing @HAVE_EXTERNALS_TRUE@am__append_14 = Dependencies @HAVE_EXTERNALS_TRUE@am__append_15 = .Dependencies-stamp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Osi/config.h \ $(top_builddir)/src/Osi/config_osi.h CONFIG_CLEAN_FILES = examples/Makefile osi.pc osi-uninstalled.pc \ osi-unittests.pc osi-unittests-uninstalled.pc osi-cplex.pc \ osi-cplex-uninstalled.pc osi-glpk.pc osi-glpk-uninstalled.pc \ osi-gurobi.pc osi-gurobi-uninstalled.pc osi-mosek.pc \ osi-mosek-uninstalled.pc osi-xpress.pc \ osi-xpress-uninstalled.pc osi-soplex.pc \ osi-soplex-uninstalled.pc doxydoc/doxygen.conf SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(pkgconfiglibdir)" pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) DATA = $(pkgconfiglib_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = src/Osi src/OsiCommonTest src/OsiCpx src/OsiGlpk \ src/OsiMsk src/OsiXpr src/OsiGrb src/OsiSpx test DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories and installation of .pc files # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = osi.pc osi-unittests.pc $(am__append_2) \ $(am__append_4) $(am__append_6) $(am__append_8) \ $(am__append_10) $(am__append_12) SUBDIRS = src/Osi src/OsiCommonTest $(am__append_1) $(am__append_3) \ $(am__append_5) $(am__append_7) $(am__append_9) \ $(am__append_11) $(am__append_13) ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = examples/basic2.cpp examples/basic.cpp examples/build.cpp \ examples/Makefile.in examples/parameters.cpp \ examples/query.cpp examples/README examples/specific.cpp \ $(am__append_14) ######################################################################## # Installation of the addlibs file # ######################################################################## addlibsdir = $(DESTDIR)$(datadir)/coin/doc/Osi ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = $(am__append_15) $(VPATH_DISTCLEANFILES) DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) COIN_HAS_DOXYGEN = @COIN_HAS_DOXYGEN_TRUE@TRUE COIN_HAS_LATEX = @COIN_HAS_LATEX_TRUE@TRUE all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/BuildTools/Makemain.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) examples/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi.pc: $(top_builddir)/config.status $(srcdir)/osi.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/osi-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-unittests.pc: $(top_builddir)/config.status $(srcdir)/osi-unittests.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-unittests-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/osi-unittests-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-cplex.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiCpx/osi-cplex.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-cplex-uninstalled.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiCpx/osi-cplex-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-glpk.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiGlpk/osi-glpk.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-glpk-uninstalled.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiGlpk/osi-glpk-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-gurobi.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiGrb/osi-gurobi.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-gurobi-uninstalled.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiGrb/osi-gurobi-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-mosek.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiMsk/osi-mosek.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-mosek-uninstalled.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiMsk/osi-mosek-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-xpress.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiXpr/osi-xpress.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-xpress-uninstalled.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiXpr/osi-xpress-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-soplex.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiSpx/osi-soplex.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-soplex-uninstalled.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiSpx/osi-soplex-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ doxydoc/doxygen.conf: $(top_builddir)/config.status $(top_srcdir)/doxydoc/doxygen.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ 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; } \ END { 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: ctags-recursive $(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; } \ END { 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) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/BuildTools $(distdir)/doxydoc $(distdir)/examples $(distdir)/src/OsiCpx $(distdir)/src/OsiGlpk $(distdir)/src/OsiGrb $(distdir)/src/OsiMsk $(distdir)/src/OsiSpx $(distdir)/src/OsiXpr @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfiglibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-exec-am: install-exec-local install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-local \ uninstall-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-local \ clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-libtool distclean-local \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-exec install-exec-am \ install-exec-local install-info install-info-am install-man \ install-pkgconfiglibDATA install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-libtool \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-hook uninstall-info-am \ uninstall-local uninstall-pkgconfiglibDATA ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc install-data-hook: @$(mkdir_p) "$(addlibsdir)" @COIN_HAS_PKGCONFIG_TRUE@ PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ @COIN_HAS_PKGCONFIG_TRUE@ $(PKG_CONFIG) --libs osi > $(addlibsdir)/osi_addlibs.txt @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libOsi.lib @OSILIB_LIBS_INSTALLED@" > $(addlibsdir)/osi_addlibs.txt @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lOsi @OSILIB_LIBS_INSTALLED@ > $(addlibsdir)/osi_addlibs.txt uninstall-hook: rm -f $(addlibsdir)/osi_addlibs.txt doxygen-docs: if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ doxygen doxydoc/doxygen.conf;\ fi;\ fi pdf-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/latex"; then \ if test "$(COIN_HAS_LATEX)" = TRUE; then \ cd doxydoc/latex;\ $(MAKE) pdf;\ cd -;\ fi;\ fi;\ fi clean-doxygen-docs: if test -d "doxydoc/"; then \ cd doxydoc ;\ rm -rf html latex *.log *.tag;\ fi install-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc"; \ $(INSTALL_DATA) @coin_doxy_tagname@ "$(DESTDIR)$(DocInstallDir)/@coin_doxy_tagname@";\ if test -f "doxydoc/latex/refman.pdf"; then \ $(INSTALL_DATA) doxydoc/latex/refman.pdf "$(DESTDIR)$(DocInstallDir)";\ fi;\ if test -d "doxydoc/html"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/search/" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc/search/"; \ $(INSTALL_DATA) doxydoc/html/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc";\ $(INSTALL_DATA) doxydoc/html/search/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc/search";\ fi;\ fi;\ fi uninstall-doxygen-docs: if test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/"; then \ rm -rf "$(DESTDIR)$(DocInstallDir)/doxydoc/"; \ fi if test -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; then \ rm -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; \ fi all-doxygen-docs: for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) doxygen-docs) \ fi ; \ done ; clean-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) clean-doxygen-docs) \ fi ; \ done ; install-all-doxygen-docs: all-doxygen-docs for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) install-doxygen-docs) \ fi ; \ done ; uninstall-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) uninstall-doxygen-docs) \ fi ; \ done ; install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## # Make sure acinclude is using most recent coin.m4 @MAINTAINER_MODE_TRUE@$(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 @MAINTAINER_MODE_TRUE@ cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date @MAINTAINER_MODE_TRUE@$(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh @MAINTAINER_MODE_TRUE@ cp $< $@ # Take care of updating externals (if Dependencies file exists) @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@$(top_builddir)/Makefile: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@.Dependencies-stamp: $(srcdir)/Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); BuildTools/set_externals Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ touch .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@update-externals: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); svn update .PHONY: install-doc uninstall-doc update-externals # 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: CoinMP-1.8.3/Osi/examples/0000755000175000017500000000000012600453455013670 5ustar renereneCoinMP-1.8.3/Osi/examples/Makefile.in0000644000175000017500000001072212101340333015721 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # $Id: Makefile.in 1881 2013-01-28 00:05:47Z stefan $ ########################################################################## # You can modify this example makefile to fit for your own program. # # Usually, you only need to change CHANGEME entries below. # ########################################################################## # CHANGEME # To compile other examples, either change the following line, or add the # argument DRIVER=filename_without_extension to make, e.g., # `make DRIVER=parameters' DRIVER = basic # CHANGME # This should be the name of your executable; change if you want a name # that's different from the file name. EXE = $(DRIVER)@EXEEXT@ # CHANGEME # OBJS should include all object files necessary to build your program. For # the examples, only one file is needed for each example. You will probably # have more as your code grows. OBJS = $(DRIVER).@OBJEXT@ # CHANGEME # Additional libraries. The examples require only the COIN libraries specified # as LIBS below. You may need more. ADDLIBS = # CHANGEME # Additional flags for compilation (e.g., include flags). As for libraries, # the examples require only COIN include files, specified as part of CXXFLAGS # below. ADDINCFLAGS = # CHANGEME # Directory to the sources for the (example) problem definition files. VPATH # is used if you are building in a different directory than the source. This # can be handy for various reasons; if none occur to you, don't worry about # it. SRCDIR = @srcdir@ VPATH = @srcdir@ ########################################################################## # Usually, you don't have to change anything below. Note that if you # # change certain compiler options, you might have to recompile the # # package. # ########################################################################## COIN_HAS_PKGCONFIG = @COIN_HAS_PKGCONFIG_TRUE@TRUE COIN_CXX_IS_CL = @COIN_CXX_IS_CL_TRUE@TRUE COIN_HAS_SAMPLE = @COIN_HAS_SAMPLE_TRUE@TRUE COIN_HAS_NETLIB = @COIN_HAS_NETLIB_TRUE@TRUE # C++ Compiler command CXX = @CXX@ # C++ Compiler options CXXFLAGS = @CXXFLAGS@ @OSI_EXAMPLES_SOLVER_CFLAGS@ \ -DOSIXXXhpp=\"@OSI_EXAMPLES_SOLVER_NAME@.hpp\" -DOSIXXX=@OSI_EXAMPLES_SOLVER_NAME@ # Sample data directory ifeq ($(COIN_HAS_SAMPLE), TRUE) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) CXXFLAGS += -DSAMPLEDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatasample`\" else CXXFLAGS += -DSAMPLEDIR=\"@SAMPLE_DATA_INSTALLED@\" endif endif # Netlib data directory ifeq ($(COIN_HAS_NETLIB), TRUE) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) CXXFLAGS += -DNETLIBDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatanetlib`\" else CXXFLAGS += -DNETLIBDIR=\"@NETLIB_DATA_INSTALLED@\" endif endif # additional C++ Compiler options for linking CXXLINKFLAGS = @RPATH_FLAGS@ # Include directories (we use the CYGPATH_W variables to allow compilation with Windows compilers) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags @OSI_EXAMPLES_SOLVER_PCNAME@ osi` else INCL = @OSILIB_CFLAGS_INSTALLED@ endif INCL += $(ADDINCFLAGS) # Linker flags ifeq ($(COIN_HAS_PKGCONFIG), TRUE) LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs @OSI_EXAMPLES_SOLVER_PCNAME@ osi` else ifeq ($(COIN_CXX_IS_CL), TRUE) LIBS = -link -libpath:`$(CYGPATH_W) @abs_lib_dir@` libOsi.lib @OSI_EXAMPLES_SOLVER_LIBS@ @OSILIB_LIBS_INSTALLED@ else LIBS = -L@abs_lib_dir@ -lOsi @OSI_EXAMPLES_SOLVER_LIBS@ @OSILIB_LIBS_INSTALLED@ endif endif # The following is necessary under cygwin, if native compilers are used CYGPATH_W = @CYGPATH_W@ all: $(EXE) .SUFFIXES: .cpp .c .o .obj $(EXE): $(OBJS) bla=;\ for file in $(OBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \ $(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $@ $$bla $(LIBS) $(ADDLIBS) clean: rm -rf $(EXE) $(OBJS) .cpp.o: $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$< .cpp.obj: $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi` .c.o: $(CC) $(CFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$< .c.obj: $(CC) $(CFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi` CoinMP-1.8.3/Osi/examples/README0000644000175000017500000000044711603614254014553 0ustar renereneThese examples are from the OSI tutorial at INFORMS Atlanta 2003 by Brady Hunsaker and the workshop section on OSI given by Matthew Saltzman at CORS/INFORMS Banff 2004. The accompanying slides and handouts can be found at http://www.coin-or.org/Presentations/CORSINFORMSWorkshop04/index.html CoinMP-1.8.3/Osi/examples/basic.cpp0000644000175000017500000000233312130536345015454 0ustar renerene// Bare bones example of using COIN-OR OSI #include #include OSIXXXhpp int main(void) { // Create a problem pointer. We use the base class here. OsiSolverInterface *si; // When we instantiate the object, we need a specific derived class. si = new OSIXXX; // Read in an mps file. This one's from the MIPLIB library. #if defined(SAMPLEDIR) si->readMps(SAMPLEDIR "/p0033"); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif // Solve the (relaxation of the) problem si->initialSolve(); // Check the solution if ( si->isProvenOptimal() ) { std::cout << "Found optimal solution!" << std::endl; std::cout << "Objective value is " << si->getObjValue() << std::endl; int n = si->getNumCols(); const double* solution = si->getColSolution(); // We can then print the solution or could examine it. for( int i = 0; i < n && i < 5; ++i ) std::cout << si->getColName(i) << " = " << solution[i] << std::endl; if( 5 < n ) std::cout << "..." << std::endl; } else { std::cout << "Didn't find optimal solution." << std::endl; // Could then check other status functions. } return 0; } CoinMP-1.8.3/Osi/examples/opbdp_solve.cpp0000644000175000017500000003467512130536345016725 0ustar renerene// Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. #include "OsiConfig.h" #include #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinTime.hpp" #include "opbdp_solve.hpp" #include "PBCS.h" // Not threadsafe static unsigned int ** opbdp_solution=NULL; static int opbdp_number_solutions=0; static int opbdp_maximum_solutions=0; static int size_solution=0; static PBCS *save_pbcs=NULL; void opbdp_save_solution(OrdInt & sol) { if (opbdp_number_solutions==opbdp_maximum_solutions) { opbdp_maximum_solutions = opbdp_maximum_solutions*2+100; unsigned int ** temp = new unsigned int * [opbdp_maximum_solutions]; CoinMemcpyN(opbdp_solution,opbdp_number_solutions,temp); CoinZeroN(temp+opbdp_number_solutions,opbdp_maximum_solutions-opbdp_number_solutions); delete [] opbdp_solution; opbdp_solution=temp; } unsigned int * array = new unsigned int [size_solution]; CoinZeroN(array,size_solution); opbdp_solution[opbdp_number_solutions++]=array; sol.first(); while(!sol.last()) { int var = sol.next(); if (var > 0) setAtOne(var-1,array,true); } OrdInt Fixed = save_pbcs->get_fixed(); Fixed.first(); while(!Fixed.last()) { int flit = Fixed.next(); if (flit > 0) setAtOne(flit-1,array,true); } // add hidden ones due to equations save_pbcs->Eq.first(); while(!save_pbcs->Eq.last()) { int l = save_pbcs->Eq.next(); int r = save_pbcs->Eq(l); if (sol.member(r) || Fixed.member(r)) setAtOne(l-1,array,true); else if (sol.member(-r) || Fixed.member(-r)) setAtOne(l-1,array,true); // just positives are added } } //------------------------------------------------------------------- // Returns the greatest common denominator of two // positive integers, a and b, found using Euclid's algorithm //------------------------------------------------------------------- static int gcd(int a, int b) { int remainder = -1; // make sure a<=b (will always remain so) if(a > b) { // Swap a and b int temp = a; a = b; b = temp; } // if zero then gcd is nonzero (zero may occur in rhs of packed) if (!a) { if (b) { return b; } else { printf("**** gcd given two zeros!!\n"); abort(); } } while (remainder) { remainder = b % a; b = a; a = remainder; } return b; } static int solve(const OsiSolverInterface * model,PBCS & pbcs, OrdInt & sol) { int numberColumns = model->getNumCols(); size_solution = (numberColumns+31)/32; int numberRows = model->getNumRows(); bool all01=true; int i; const double * objective = model->getObjCoefficients(); double infinity = model->getInfinity(); const CoinPackedMatrix * matrix = model->getMatrixByRow(); const double * columnLower = model->getColLower(); const double * columnUpper = model->getColUpper(); const double * rowLower = model->getRowLower(); const double * rowUpper = model->getRowUpper(); for (i = 0; i < numberColumns; i++) { if (!model->isInteger(i)||columnLower[i]<0.0||columnUpper[i]>1.0) { all01=false; break; } } if (!all01) return -1; // Get scale factors to make integral const int * column = matrix->getIndices(); const int * rowLength = matrix->getVectorLengths(); const CoinBigIndex * rowStart = matrix->getVectorStarts(); const double * elementByRow = matrix->getElements(); // objective not too important double maximumObjElement = 0.0 ; for (i = 0 ; i < numberColumns ; i++) maximumObjElement = CoinMax(maximumObjElement,fabs(objective[i])) ; int objGood = 0 ; double objMultiplier = 2520.0 ; bool good=true; if (maximumObjElement) { while (10.0*objMultiplier*maximumObjElement < 1.0e9) objMultiplier *= 10.0 ; if (maximumObjElement*2520>=1.0e9) objMultiplier=1.0; double tolerance = 1.0e-9*objMultiplier; for (i = 0 ; i < numberColumns ; i++) { double value=fabs(objective[i])*objMultiplier ; if (!value) continue; int nearest = (int) floor(value+0.5) ; if (fabs(value-floor(value+0.5)) > tolerance) { // just take for now objGood = 1 ; good=false; break ; } else if (!objGood) { objGood = nearest ; } else { objGood = gcd(objGood,nearest) ; } } objMultiplier /= objGood; if (!good) { printf("Unable to scale objective correctly - maximum %g\n", maximumObjElement); objMultiplier = 1.0e7/maximumObjElement; } } else { objMultiplier=0.0; // no objective } double maximumElement=0.0; // now real stuff for (i=0;i=1.0e8) elMultiplier=1.0; double tolerance = 1.0e-8*elMultiplier; good=true; for (i=0;i tolerance) { elGood = 0 ; good=false; break ; } else if (!elGood) { elGood = nearest ; } else { elGood = gcd(elGood,nearest) ; } } } if (rowUpper[i]!=infinity) { double value=fabs(rowUpper[i])*elMultiplier ; if (value) { int nearest = (int) floor(value+0.5) ; if (fabs(value-floor(value+0.5)) > tolerance) { elGood = 0 ; good=false; break ; } else if (!elGood) { elGood = nearest ; } else { elGood = gcd(elGood,nearest) ; } } } for (CoinBigIndex j=rowStart[i];j tolerance) { elGood = 0 ; good=false; break ; } else if (!elGood) { elGood = nearest ; } else { elGood = gcd(elGood,nearest) ; } } } if (!good) return -1; // no good // multiplier elMultiplier /= elGood; double objOffset=0.0; model->getDblParam(OsiObjOffset,objOffset); int doMax= (model->getObjSense()<0.0) ? 1 : 0; printf("Objective multiplier is %g, element mutiplier %g, offset %g\n", objMultiplier,elMultiplier,objOffset); Products objf; Atoms atoms; save_pbcs = & pbcs; pbcs.set_atoms(&atoms); pbcs.set_enum_heuristic(0); for (i=0;i 1) std::cout << "Big M coefficient reduction changed " << changed << " coefficients"<0) { const double * objective = model->getObjCoefficients(); double objOffset=0.0; model->getDblParam(OsiObjOffset,objOffset); int numberColumns = model->getNumCols(); double * solution = new double [numberColumns]; CoinZeroN(solution,numberColumns); sol.first(); while(!sol.last()) { int var = sol.next(); if (var > 0) solution[var-1]=1.0; } OrdInt Fixed = pbcs.get_fixed(); Fixed.first(); while(!Fixed.last()) { int flit = Fixed.next(); if (flit > 0) solution[flit-1]=1.0; } // add hidden ones due to equations pbcs.Eq.first(); while(!pbcs.Eq.last()) { int l = pbcs.Eq.next(); int r = pbcs.Eq(l); if (sol.member(r) || Fixed.member(r)) solution[l-1]=1.0; else if (sol.member(-r) || Fixed.member(-r)) solution[l-1]=1.0; // just positives are added } numberFound=1; double objValue = - objOffset; for (int i=0;igetObjSense()>0 ? "minimum" : "maximum")<<" of "<setObjValue(objValue); model->setColSolution(solution); delete [] solution; } else if (!numberFound) { std::cout << "Constraint Set is unsatisfiable"<0||opbdp_number_solutions) { // all solutions numberFound = opbdp_number_solutions; return opbdp_solution; } else { // no solution return NULL; } } CoinMP-1.8.3/Osi/examples/build.cpp0000644000175000017500000000567512130536345015506 0ustar renerene// Example of using COIN-OR OSI, building the instance internally // with sparse matrix object #include #include OSIXXXhpp #include "CoinPackedMatrix.hpp" #include "CoinPackedVector.hpp" int main(void) { // Create a problem pointer. We use the base class here. OsiSolverInterface *si; // When we instantiate the object, we need a specific derived class. si = new OSIXXX; // Build our own instance from scratch /* * This section adapted from Matt Galati's example * on the COIN-OR Tutorial website. * * Problem from Bertsimas, Tsitsiklis page 21 * * optimal solution: x* = (1,1) * * minimize -1 x0 - 1 x1 * s.t 1 x0 + 2 x1 <= 3 * 2 x0 + 1 x1 <= 3 * x0 >= 0 * x1 >= 0 */ int n_cols = 2; double *objective = new double[n_cols];//the objective coefficients double *col_lb = new double[n_cols];//the column lower bounds double *col_ub = new double[n_cols];//the column upper bounds //Define the objective coefficients. //minimize -1 x0 - 1 x1 objective[0] = -1.0; objective[1] = -1.0; //Define the variable lower/upper bounds. // x0 >= 0 => 0 <= x0 <= infinity // x1 >= 0 => 0 <= x1 <= infinity col_lb[0] = 0.0; col_lb[1] = 0.0; col_ub[0] = si->getInfinity(); col_ub[1] = si->getInfinity(); int n_rows = 2; double *row_lb = new double[n_rows]; //the row lower bounds double *row_ub = new double[n_rows]; //the row upper bounds //Define the constraint matrix. CoinPackedMatrix *matrix = new CoinPackedMatrix(false,0,0); matrix->setDimensions(0, n_cols); //1 x0 + 2 x1 <= 3 => -infinity <= 1 x0 + 2 x2 <= 3 CoinPackedVector row1; row1.insert(0, 1.0); row1.insert(1, 2.0); row_lb[0] = -1.0 * si->getInfinity(); row_ub[0] = 3.0; matrix->appendRow(row1); //2 x0 + 1 x1 <= 3 => -infinity <= 2 x0 + 1 x1 <= 3 CoinPackedVector row2; row2.insert(0, 2.0); row2.insert(1, 1.0); row_lb[1] = -1.0 * si->getInfinity(); row_ub[1] = 3.0; matrix->appendRow(row2); //load the problem to OSI si->loadProblem(*matrix, col_lb, col_ub, objective, row_lb, row_ub); //write the MPS file to a file called example.mps si->writeMps("example"); // Solve the (relaxation of the) problem si->initialSolve(); // Check the solution if ( si->isProvenOptimal() ) { std::cout << "Found optimal solution!" << std::endl; std::cout << "Objective value is " << si->getObjValue() << std::endl; int n = si->getNumCols(); const double* solution = si->getColSolution(); // We can then print the solution or could examine it. for( int i = 0; i < n; ++i ) std::cout << si->getColName(i) << " = " << solution[i] << std::endl; } else { std::cout << "Didn't find optimal solution." << std::endl; // Could then check other status functions. } return 0; } CoinMP-1.8.3/Osi/examples/query.cpp0000644000175000017500000000416212101340333015526 0ustar renerene// Example of using COIN-OR OSI // Demonstrates some problem and solution query methods #include #include OSIXXXhpp int main(void) { // Create a problem pointer. We use the base class here. OsiSolverInterface *si; // When we instantiate the object, we need a specific derived class. si = new OSIXXX; // Read in an mps file. This one's from the MIPLIB library. #if defined(SAMPLEDIR) si->readMps(SAMPLEDIR "/p0033"); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif // Display some information about the instance int nrows = si->getNumRows(); int ncols = si->getNumCols(); int nelem = si->getNumElements(); std::cout << "This problem has " << nrows << " rows, " << ncols << " columns, and " << nelem << " nonzeros." << std::endl; double const *upper_bounds = si->getColUpper(); std::cout << "The upper bound on the first column is " << upper_bounds[0] << std::endl; // All information about the instance is available with similar methods // Solve the (relaxation of the) problem si->initialSolve(); // Check the solution if ( si->isProvenOptimal() ) { std::cout << "Found optimal solution!" << std::endl; std::cout << "Objective value is " << si->getObjValue() << std::endl; // Examine solution int n = si->getNumCols(); const double *solution; solution = si->getColSolution(); std::cout << "Solution: "; for (int i = 0; i < n; i++) std::cout << solution[i] << " "; std::cout << std::endl; std::cout << "It took " << si->getIterationCount() << " iterations" << " to solve." << std::endl; } else { std::cout << "Didn't find optimal solution." << std::endl; // Check other status functions. What happened? if (si->isProvenPrimalInfeasible()) std::cout << "Problem is proven to be infeasible." << std::endl; if (si->isProvenDualInfeasible()) std::cout << "Problem is proven dual infeasible." << std::endl; if (si->isIterationLimitReached()) std::cout << "Reached iteration limit." << std::endl; } return 0; } CoinMP-1.8.3/Osi/examples/readconic.cpp0000644000175000017500000000475012223503721016322 0ustar renerene// $Id: readconic.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinMpsIO.hpp" int main (int argc, const char *argv[]) { CoinMpsIO m_MpsData; int nOfSOS; CoinSet ** SOS = NULL; std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/conic.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int status = m_MpsData.readMps( mpsFileName.c_str(), "", nOfSOS, SOS ); assert (!status); int * columnStart = NULL; int * columnIdx = NULL; double * elements = NULL; status = m_MpsData.readQuadraticMps(NULL, columnStart, columnIdx, elements, 0); assert (!status); int nOfCones; int * coneStart = NULL; int * coneIdx = NULL; int * coneType = NULL; status = m_MpsData.readConicMps(NULL, coneStart, coneIdx, coneType, nOfCones); assert (!status); if (nOfSOS) { printf("%d SOS sets\n",nOfSOS); for (int iSOS=0;iSOSnumberEntries(); printf("Set %d has %d entries - type %d\n",iSOS,numberEntries,SOS[iSOS]->setType()); const int * which = SOS[iSOS]->which(); const double * weights = SOS[iSOS]->weights(); for (int i=0;i #include OSIXXXhpp int main(void) { // Create a problem pointer. We use the base class here. OsiSolverInterface *si; // When we instantiate the object, we need a specific derived class. si = new OSIXXX; // Read in an mps file. This one's from the MIPLIB library. #if defined(SAMPLEDIR) si->readMps(SAMPLEDIR "/p0033"); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif // Display some information about the instance int nrows = si->getNumRows(); int ncols = si->getNumCols(); int nelem = si->getNumElements(); std::cout << "This problem has " << nrows << " rows, " << ncols << " columns, and " << nelem << " nonzeros." << std::endl; double const * upper_bounds = si->getColUpper(); std::cout << "The upper bound on the first column is " << upper_bounds[0] << std::endl; // All information about the instance is available with similar methods // Before solving, indicate some parameters si->setIntParam( OsiMaxNumIteration, 10); si->setDblParam( OsiPrimalTolerance, 0.001 ); // Can also read parameters std::string solver; si->getStrParam( OsiSolverName, solver ); std::cout << "About to solve with: " << solver << std::endl; // Solve the (relaxation of the) problem si->initialSolve(); // Check the solution if ( si->isProvenOptimal() ) { std::cout << "Found optimal solution!" << std::endl; std::cout << "Objective value is " << si->getObjValue() << std::endl; // Examine solution int n = si->getNumCols(); const double *solution; solution = si->getColSolution(); std::cout << "Solution: "; for (int i = 0; i < n; i++) std::cout << solution[i] << " "; std::cout << std::endl; std::cout << "It took " << si->getIterationCount() << " iterations" << " to solve." << std::endl; } else { std::cout << "Didn't find optimal solution." << std::endl; // Check other status functions. What happened? if (si->isProvenPrimalInfeasible()) std::cout << "Problem is proven to be infeasible." << std::endl; if (si->isProvenDualInfeasible()) std::cout << "Problem is proven dual infeasible." << std::endl; if (si->isIterationLimitReached()) std::cout << "Reached iteration limit." << std::endl; } return 0; } CoinMP-1.8.3/Osi/examples/opbdp_solve.hpp0000644000175000017500000000273111403136004016704 0ustar renerene// Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. #ifndef OsiOpbdpSolve_H #define OsiOpbdpSolve_H #include #include "OsiSolverInterface.hpp" /** Solve pure 0-1 with integral coefficients etc (or can be made by scaling) using opdbp The solution will be set in model If no solution then returns 0, if not suitable returns -1 */ int solveOpbdp(OsiSolverInterface * model); /** Find all solutions of a pure 0-1 with integral coefficients etc (or can be made by scaling) using opdbp Returns an array of bit solution vectors. i is 1 if bit set (see below) If no solution then numberFound will be 0, if not suitable -1 This needs the line at about 206 of EnumerateOpt.cpp local_maximum = value + 1; // try to reach that one! replaced by if (verbosity!=-1) { local_maximum = value + 1; // try to reach that one! } else { local_maximum = 0; void opbdp_save_solution(OrdInt & sol); OrdInt sol = last_solution.to_OrdInt(); opbdp_save_solution(sol); // save solution } */ unsigned int ** solveOpbdp(const OsiSolverInterface * model,int & numberFound); inline bool atOne(int i,unsigned int * array) { return ((array[i>>5]>>(i&31))&1)!=0; } inline void setAtOne(int i,unsigned int * array,bool trueFalse) { unsigned int & value = array[i>>5]; int bit = i&31; if (trueFalse) value |= (1< CoinMP-1.8.3/Osi/MSVisualStudio/v9/Osi.sln0000644000175000017500000002106312130536345016553 0ustar renereneMicrosoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "libOsi\libOsi.vcproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v9\libCoinUtils\libCoinUtils.vcproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesBasic", "OsiExamplesBasic\OsiExamplesBasic.vcproj", "{B874A948-B5F4-4501-9735-BD9586C5216D}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesBuild", "OsiExamplesBuild\OsiExamplesBuild.vcproj", "{1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesParameters", "OsiExamplesParameters\OsiExamplesParameters.vcproj", "{C0F44D7F-B535-44DC-9125-515E813A1753}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesQuery", "OsiExamplesQuery\OsiExamplesQuery.vcproj", "{E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesSpecific", "OsiExamplesSpecific\OsiExamplesSpecific.vcproj", "{B5A702D5-C5F7-40EE-99E0-A500AE91528A}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "libOsiCommonTest\libOsiCommonTest.vcproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiUnitTest", "OsiUnitTest\OsiUnitTest.vcproj", "{0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {109D6E6F-6D91-460F-86AE-DF27400E09A9} = {109D6E6F-6D91-460F-86AE-DF27400E09A9} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {B349E853-2E2B-468E-8853-184ACD948678}.Debug|Win32.ActiveCfg = Debug|Win32 {B349E853-2E2B-468E-8853-184ACD948678}.Debug|x64.ActiveCfg = Debug|Win32 {B349E853-2E2B-468E-8853-184ACD948678}.Release|Win32.ActiveCfg = Release|Win32 {B349E853-2E2B-468E-8853-184ACD948678}.Release|Win32.Build.0 = Release|Win32 {B349E853-2E2B-468E-8853-184ACD948678}.Release|x64.ActiveCfg = Release|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Debug|Win32.ActiveCfg = Debug|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Debug|x64.ActiveCfg = Debug|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Release|Win32.ActiveCfg = Release|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Release|Win32.Build.0 = Release|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Release|x64.ActiveCfg = Release|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Debug|Win32.ActiveCfg = Debug|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Debug|x64.ActiveCfg = Debug|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Release|Win32.ActiveCfg = Release|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Release|Win32.Build.0 = Release|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Release|x64.ActiveCfg = Release|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Debug|Win32.ActiveCfg = Debug|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Debug|x64.ActiveCfg = Debug|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Release|Win32.ActiveCfg = Release|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Release|Win32.Build.0 = Release|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Release|x64.ActiveCfg = Release|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Debug|Win32.ActiveCfg = Debug|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Debug|x64.ActiveCfg = Debug|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Release|Win32.ActiveCfg = Release|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Release|Win32.Build.0 = Release|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Release|x64.ActiveCfg = Release|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Debug|Win32.ActiveCfg = Debug|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Debug|x64.ActiveCfg = Debug|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Release|Win32.ActiveCfg = Release|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Release|Win32.Build.0 = Release|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Release|x64.ActiveCfg = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.ActiveCfg = Debug|Win32 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.Build.0 = Debug|Win32 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.ActiveCfg = Debug|x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.Build.0 = Debug|x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.ActiveCfg = Release|Win32 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.Build.0 = Release|Win32 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.ActiveCfg = Release|x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiUnitTest/0000755000175000017500000000000012600453455017535 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiUnitTest/OsiUnitTest.vcproj0000644000175000017500000001732111475606620023223 0ustar renerene CoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesSpecific/0000755000175000017500000000000012600453455021202 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesSpecific/OsiExamplesSpecific.vcproj0000644000175000017500000001046311122615267026331 0ustar renerene CoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesBasic/0000755000175000017500000000000012600453455020476 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesBasic/OsiExamplesBasic.vcproj0000644000175000017500000001045311122615267025120 0ustar renerene CoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesQuery/0000755000175000017500000000000012600453455020562 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesQuery/OsiExamplesQuery.vcproj0000644000175000017500000001047111122615267025270 0ustar renerene CoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesBuild/0000755000175000017500000000000012600453455020514 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesBuild/OsiExamplesBuild.vcproj0000644000175000017500000001044411122615267025154 0ustar renerene CoinMP-1.8.3/Osi/MSVisualStudio/v9/libOsiCommonTest/0000755000175000017500000000000012600453455020535 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v9/libOsiCommonTest/libOsiCommonTest.vcproj0000644000175000017500000001635211475326621025226 0ustar renerene CoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesParameters/0000755000175000017500000000000012600453455021560 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v9/OsiExamplesParameters/OsiExamplesParameters.vcproj0000644000175000017500000001047511122615267027270 0ustar renerene CoinMP-1.8.3/Osi/MSVisualStudio/v10/0000755000175000017500000000000012600453455015353 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/libOsi/0000755000175000017500000000000012600453455016574 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/libOsi/libOsi.vcxproj0000644000175000017500000002571212130312011021415 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149} StaticLibrary StaticLibrary StaticLibrary StaticLibrary <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks _DEBUG;%(PreprocessorDefinitions) 0x0409 true X64 ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks Level3 true ProgramDatabase _DEBUG;%(PreprocessorDefinitions) 0x0409 true ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true true NDEBUG;%(PreprocessorDefinitions) 0x0409 true X64 Default ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true NDEBUG;%(PreprocessorDefinitions) 0x0409 true CoinMP-1.8.3/Osi/MSVisualStudio/v10/Osi.sln0000644000175000017500000001435512130536345016631 0ustar renereneMicrosoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "libOsi\libOsi.vcxproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v10\libCoinUtils\libCoinUtils.vcxproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesBasic", "OsiExamplesBasic\OsiExamplesBasic.vcxproj", "{B874A948-B5F4-4501-9735-BD9586C5216D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesBuild", "OsiExamplesBuild\OsiExamplesBuild.vcxproj", "{1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesParameters", "OsiExamplesParameters\OsiExamplesParameters.vcxproj", "{C0F44D7F-B535-44DC-9125-515E813A1753}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesQuery", "OsiExamplesQuery\OsiExamplesQuery.vcxproj", "{E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesSpecific", "OsiExamplesSpecific\OsiExamplesSpecific.vcxproj", "{B5A702D5-C5F7-40EE-99E0-A500AE91528A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "libOsiCommonTest\libOsiCommonTest.vcxproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiUnitTest", "OsiUnitTest\OsiUnitTest.vcxproj", "{0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {B349E853-2E2B-468E-8853-184ACD948678}.Debug|Win32.ActiveCfg = Debug|Win32 {B349E853-2E2B-468E-8853-184ACD948678}.Debug|x64.ActiveCfg = Debug|Win32 {B349E853-2E2B-468E-8853-184ACD948678}.Release|Win32.ActiveCfg = Release|Win32 {B349E853-2E2B-468E-8853-184ACD948678}.Release|x64.ActiveCfg = Release|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Debug|Win32.ActiveCfg = Debug|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Debug|x64.ActiveCfg = Debug|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Release|Win32.ActiveCfg = Release|Win32 {B874A948-B5F4-4501-9735-BD9586C5216D}.Release|x64.ActiveCfg = Release|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Debug|Win32.ActiveCfg = Debug|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Debug|x64.ActiveCfg = Debug|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Release|Win32.ActiveCfg = Release|Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Release|x64.ActiveCfg = Release|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Debug|Win32.ActiveCfg = Debug|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Debug|x64.ActiveCfg = Debug|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Release|Win32.ActiveCfg = Release|Win32 {C0F44D7F-B535-44DC-9125-515E813A1753}.Release|x64.ActiveCfg = Release|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Debug|Win32.ActiveCfg = Debug|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Debug|x64.ActiveCfg = Debug|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Release|Win32.ActiveCfg = Release|Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Release|x64.ActiveCfg = Release|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Debug|Win32.ActiveCfg = Debug|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Debug|x64.ActiveCfg = Debug|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Release|Win32.ActiveCfg = Release|Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Release|x64.ActiveCfg = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.ActiveCfg = Debug|Win32 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.Build.0 = Debug|Win32 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.ActiveCfg = Debug|x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.Build.0 = Debug|x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.ActiveCfg = Release|Win32 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.Build.0 = Release|Win32 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.ActiveCfg = Release|x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiUnitTest/0000755000175000017500000000000012600453455017605 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiUnitTest/OsiUnitTest.vcxproj0000644000175000017500000003027112101652430023445 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C} OsiUnitTest Application Unicode false false Application Unicode false Application Unicode false false Application Unicode false <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset Disabled ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) OSI_BUILD;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;COIN_MSVS;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level3 ProgramDatabase $(OutDir);%(AdditionalLibraryDirectories) true true MachineX86 libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;%(AdditionalDependencies) false X64 Disabled ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) OSI_BUILD;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;COIN_MSVS;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level3 ProgramDatabase $(OutDir);%(AdditionalLibraryDirectories) true true MachineX64 libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;%(AdditionalDependencies) false ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) OSI_BUILD;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;COIN_MSVS;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase $(OutDir);%(AdditionalLibraryDirectories) true MachineX86 libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;%(AdditionalDependencies) false X64 ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) OSI_BUILD;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;COIN_MSVS;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase $(OutDir);%(AdditionalLibraryDirectories) true MachineX64 libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;%(AdditionalDependencies) false {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {109d6e6f-6d91-460f-86ae-df27400e09a9} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false CoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesSpecific/0000755000175000017500000000000012600453455021252 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesSpecific/OsiExamplesSpecific.vcxproj0000644000175000017500000001472712101652430026567 0ustar renerene Debug Win32 Release Win32 {B5A702D5-C5F7-40EE-99E0-A500AE91528A} Win32Proj Application MultiByte Application MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset Disabled ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level3 EditAndContinue $(OutDir)OsiExamplesSpecific.exe true $(OutDir)OsiExamplesSpecific.pdb Console false MachineX86 ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level3 ProgramDatabase $(OutDir)OsiExamplesSpecific.exe true Console true true false MachineX86 {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false CoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesBasic/0000755000175000017500000000000012600453455020546 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesBasic/OsiExamplesBasic.vcxproj0000644000175000017500000001474312101652430025355 0ustar renerene Debug Win32 Release Win32 {B874A948-B5F4-4501-9735-BD9586C5216D} OsiExamplesBasic Win32Proj Application MultiByte Application MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset Disabled ..\..\..\src\OsiClp;..\..\..\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level3 EditAndContinue $(OutDir)OsiExamplesBasic.exe true $(OutDir)OsiExamplesBasic.pdb Console false MachineX86 ..\..\..\src\OsiClp;..\..\..\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level3 ProgramDatabase $(OutDir)OsiExamplesBasic.exe true Console true true false MachineX86 {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false CoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesQuery/0000755000175000017500000000000012600453455020632 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesQuery/OsiExamplesQuery.vcxproj0000644000175000017500000001476112101652430025525 0ustar renerene Debug Win32 Release Win32 {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C} OsiExamplesQuery Win32Proj Application MultiByte Application MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset Disabled ..\..\..\src\OsiClp;..\..\..\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level3 EditAndContinue $(OutDir)OsiExamplesQuery.exe true $(OutDir)OsiExamplesQuery.pdb Console false MachineX86 ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level3 ProgramDatabase $(OutDir)OsiExamplesQuery.exe true Console true true false MachineX86 {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false CoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesBuild/0000755000175000017500000000000012600453455020564 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesBuild/OsiExamplesBuild.vcxproj0000644000175000017500000001471312101652430025406 0ustar renerene Debug Win32 Release Win32 {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4} Win32Proj Application MultiByte Application MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset Disabled ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level3 EditAndContinue $(OutDir)OsiExamplesBuild.exe true $(OutDir)OsiExamplesBuild.pdb Console false MachineX86 ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level3 ProgramDatabase $(OutDir)OsiExamplesBuild.exe true Console true true false MachineX86 {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false CoinMP-1.8.3/Osi/MSVisualStudio/v10/libOsiCommonTest/0000755000175000017500000000000012600453455020605 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/libOsiCommonTest/libOsiCommonTest.vcxproj0000644000175000017500000002364412130312011025441 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9} libOsiCommonTest StaticLibrary false StaticLibrary StaticLibrary false StaticLibrary <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level3 ProgramDatabase %(AdditionalLibraryDirectories) X64 ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) OSI_BUILD;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level3 ProgramDatabase %(AdditionalLibraryDirectories) ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase %(AdditionalLibraryDirectories) X64 ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) OSI_BUILD;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase %(AdditionalLibraryDirectories) {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false CoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesParameters/0000755000175000017500000000000012600453455021630 5ustar renereneCoinMP-1.8.3/Osi/MSVisualStudio/v10/OsiExamplesParameters/OsiExamplesParameters.vcxproj0000644000175000017500000001473712101652430027524 0ustar renerene Debug Win32 Release Win32 {C0F44D7F-B535-44DC-9125-515E813A1753} Win32Proj Application MultiByte Application MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset Disabled ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level3 EditAndContinue $(OutDir)OsiExamplesParameters.exe true $(OutDir)OsiExamplesParameters.pdb Console false MachineX86 ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level3 ProgramDatabase $(OutDir)OsiExamplesParameters.exe true Console true true false MachineX86 {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false CoinMP-1.8.3/Osi/Makefile.am0000644000175000017500000000703512465466761014130 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1996 2015-02-07 19:56:33Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories and installation of .pc files # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = osi.pc osi-unittests.pc SUBDIRS = src/Osi src/OsiCommonTest if COIN_HAS_CPX SUBDIRS += src/OsiCpx pkgconfiglib_DATA += osi-cplex.pc endif if COIN_HAS_GLPK SUBDIRS += src/OsiGlpk pkgconfiglib_DATA += osi-glpk.pc endif if COIN_HAS_MSK SUBDIRS += src/OsiMsk pkgconfiglib_DATA += osi-mosek.pc endif if COIN_HAS_XPR SUBDIRS += src/OsiXpr pkgconfiglib_DATA += osi-xpress.pc endif if COIN_HAS_GRB SUBDIRS += src/OsiGrb pkgconfiglib_DATA += osi-gurobi.pc endif if COIN_HAS_SOPLEX SUBDIRS += src/OsiSpx pkgconfiglib_DATA += osi-soplex.pc endif # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball if ALWAYS_FALSE SUBDIRS += test endif ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = \ examples/basic2.cpp \ examples/basic.cpp \ examples/build.cpp \ examples/Makefile.in \ examples/parameters.cpp \ examples/query.cpp \ examples/README \ examples/specific.cpp ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc ######################################################################## # Installation of the addlibs file # ######################################################################## addlibsdir = $(DESTDIR)$(datadir)/coin/doc/Osi install-data-hook: @$(mkdir_p) "$(addlibsdir)" if COIN_HAS_PKGCONFIG PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ $(PKG_CONFIG) --libs osi > $(addlibsdir)/osi_addlibs.txt else if COIN_CXX_IS_CL echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libOsi.lib @OSILIB_LIBS_INSTALLED@" > $(addlibsdir)/osi_addlibs.txt else echo -L@abs_lib_dir@ -lOsi @OSILIB_LIBS_INSTALLED@ > $(addlibsdir)/osi_addlibs.txt endif endif uninstall-hook: rm -f $(addlibsdir)/osi_addlibs.txt ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = include BuildTools/Makemain.inc CoinMP-1.8.3/Osi/depcomp0000755000175000017500000003710011405216166013426 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Osi/LICENSE0000644000175000017500000002622711507173764013077 0ustar renereneEclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. CoinMP-1.8.3/Osi/README0000644000175000017500000000571211507173764012746 0ustar renereneOPEN SOLVER INTERFACE LIBRARY README ============================= In this README, 1. 'coin-Osi' is the full path to the directory in which you have dowloaded Osi. 2. 'build' is the full path to the directory used for the installation of Osi. It might be coin-Osi or some other directory of your choosing. OVERVIEW ======== Welcome to the COIN-OR Open Solver Interface Library (Osi). Osi is distributed under the Eclipse Public License Version 1.0 and is freely redistributable. All source code and documentation is copyright by International Business Machines Corporation and (many) others. This README file may be distributed freely. The COIN-OR Open Solver Interface Library is a collection of solver interfaces (SIs) that provide a common interface --- the OSI API --- for all the supported solvers. Each SI is in a separate directory. The authors of each SI are listed in the AUTHORS file in the subdirectory. The names of maintainers and contributors to the base OsiSolverInterface code are listed in the AUTHORS file in this (Osi) directory. For more information, see the Osi Trac page (see below). OSI TRAC PAGE ============= https://projects.coin-or.org/Osi INSTALLATION ============ If you have downloaded the Osi package in the local directory coin-Osi, please see the INSTALL file in coin-Osi (the parent directory of this directory, unless you've changed the default Coin package directory structure) for instructions on how to install the entire package. If you have obtained Osi by downloading some other package, Osi will be installed as part of the installation of that package. See the INSTALL file in the main directory of the package (again, the parent directory of this directory). SUPPORT ======= 1. Authors See the AUTHORS file. 2. Project Managers The main project managers are Lou Hafer, lou@cs.sfu.ca Matt Saltzmann, mjs@clemson.edu Lots of others help out. 3. Mailing List Casual discussion of Osi can usually be found in the coin-discuss mailing list. Serious discussion occurs in the coin-osi-devel mailing list. To subscribe to either, go to http://list.coin-or.org/mailman/listinfo and follow the links. 4. Bug Reports Bug reports should be reported by creating a ticket at https://projects.coin-or.org/Osi/newticket You will need to create a login id. We apologise for the hassle, but it's the only way to avoid spammers. The more you can tell us about the bug (version of Osi, compiler version, operating system, etc.) the better the chance that we can duplicate your bug and fix it. It's helpful if you leave a valid email address, in case we need to contact you for more information. You can also report bugs on the mailing lists, but you're at the mercy of the memory of the developers. Once that email gets filed, well, out of sight, out of mind. 5. Requests for Enhancements As for bugs, please create a ticket. Or, join the coin-osi-devel list and lobby directly. CoinMP-1.8.3/Osi/osi.pc.in0000644000175000017500000000045411510106235013566 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: Osi Description: COIN-OR Open Solver Interface URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsi @OSILIB_PCLIBS@ Cflags: -I${includedir} Requires: @OSILIB_PCREQUIRES@ CoinMP-1.8.3/Osi/config.sub0000755000175000017500000007772611405216166014056 0ustar renerene#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Osi/osi-uninstalled.pc.in0000644000175000017500000000044711573725230016123 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/Osi Name: Osi Description: COIN-OR Open Solver Interface URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsi.la @OSILIB_PCLIBS@ Cflags: -I@abs_source_dir@/src/Osi -I@ABSBUILDDIR@/src/Osi Requires: @OSILIB_PCREQUIRES@ CoinMP-1.8.3/Osi/osi-unittests.pc.in0000644000175000017500000000046211510106235015625 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiUnitTests Description: COIN-OR Open Solver Interface Common Unit Tests URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiCommonTests Cflags: -I${includedir} Requires: osi CoinMP-1.8.3/Osi/configure0000755000175000017500000340046012600104755013764 0ustar renerene#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for Osi 0.107.6. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # # Copyright 2006 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package Coin which is distributed # under the Eclipse Public License. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='Osi' PACKAGE_TARNAME='osi' PACKAGE_VERSION='0.107.6' PACKAGE_STRING='Osi 0.107.6' PACKAGE_BUGREPORT='osi@list.coin-or.org' ac_unique_file="src/Osi/OsiAuxInfo.cpp" ac_default_prefix=`pwd` # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os ALWAYS_FALSE_TRUE ALWAYS_FALSE_FALSE have_svnversion OSI_SVN_REV CDEFS ADD_CFLAGS DBG_CFLAGS OPT_CFLAGS sol_cc_compiler CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT COIN_CC_IS_CL_TRUE COIN_CC_IS_CL_FALSE MPICC CXXDEFS ADD_CXXFLAGS DBG_CXXFLAGS OPT_CXXFLAGS CXX CXXFLAGS ac_ct_CXX COIN_CXX_IS_CL_TRUE COIN_CXX_IS_CL_FALSE MPICXX EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOLM4 have_autoconf have_automake have_svn BUILDTOOLSDIR AUX_DIR abs_source_dir abs_lib_dir abs_include_dir abs_bin_dir HAVE_EXTERNALS_TRUE HAVE_EXTERNALS_FALSE host host_cpu host_vendor host_os ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ac_c_preproc_warn_flag ac_cxx_preproc_warn_flag RPATH_FLAGS DEPENDENCY_LINKING_TRUE DEPENDENCY_LINKING_FALSE LT_LDFLAGS PKG_CONFIG ac_ct_PKG_CONFIG COIN_HAS_PKGCONFIG_TRUE COIN_HAS_PKGCONFIG_FALSE COIN_PKG_CONFIG_PATH COIN_PKG_CONFIG_PATH_UNINSTALLED COINUTILS_LIBS COINUTILS_CFLAGS COINUTILS_DATA COINUTILS_DEPENDENCIES COINUTILS_LIBS_INSTALLED COINUTILS_CFLAGS_INSTALLED COINUTILS_DATA_INSTALLED OSILIB_CFLAGS OSILIB_LIBS OSILIB_PCLIBS OSILIB_PCREQUIRES OSILIB_DEPENDENCIES OSILIB_CFLAGS_INSTALLED OSILIB_LIBS_INSTALLED COIN_HAS_COINUTILS_TRUE COIN_HAS_COINUTILS_FALSE GLPK_LIBS GLPK_CFLAGS GLPK_DATA GLPK_DEPENDENCIES GLPK_LIBS_INSTALLED GLPK_CFLAGS_INSTALLED GLPK_DATA_INSTALLED OSIGLPKLIB_CFLAGS OSIGLPKLIB_LIBS OSIGLPKLIB_PCLIBS OSIGLPKLIB_PCREQUIRES OSIGLPKLIB_DEPENDENCIES OSIGLPKLIB_CFLAGS_INSTALLED OSIGLPKLIB_LIBS_INSTALLED COIN_HAS_GLPK_TRUE COIN_HAS_GLPK_FALSE SOPLEX_LIBS SOPLEX_CFLAGS SOPLEX_DATA SOPLEX_DEPENDENCIES SOPLEX_LIBS_INSTALLED SOPLEX_CFLAGS_INSTALLED SOPLEX_DATA_INSTALLED OSISPXLIB_CFLAGS OSISPXLIB_LIBS OSISPXLIB_PCLIBS OSISPXLIB_PCREQUIRES OSISPXLIB_DEPENDENCIES OSISPXLIB_CFLAGS_INSTALLED OSISPXLIB_LIBS_INSTALLED COIN_HAS_SOPLEX_TRUE COIN_HAS_SOPLEX_FALSE SAMPLE_LIBS SAMPLE_CFLAGS SAMPLE_DATA SAMPLE_DEPENDENCIES SAMPLE_LIBS_INSTALLED SAMPLE_CFLAGS_INSTALLED SAMPLE_DATA_INSTALLED COIN_HAS_SAMPLE_TRUE COIN_HAS_SAMPLE_FALSE NETLIB_LIBS NETLIB_CFLAGS NETLIB_DATA NETLIB_DEPENDENCIES NETLIB_LIBS_INSTALLED NETLIB_CFLAGS_INSTALLED NETLIB_DATA_INSTALLED COIN_HAS_NETLIB_TRUE COIN_HAS_NETLIB_FALSE CPXINCDIR CPXLIB COIN_HAS_CPX_TRUE COIN_HAS_CPX_FALSE MSKINCDIR MSKLIB COIN_HAS_MSK_TRUE COIN_HAS_MSK_FALSE XPRINCDIR XPRLIB COIN_HAS_XPR_TRUE COIN_HAS_XPR_FALSE GRBINCDIR GRBLIB COIN_HAS_GRB_TRUE COIN_HAS_GRB_FALSE OSI_EXAMPLES_SOLVER_NAME OSI_EXAMPLES_SOLVER_CFLAGS OSI_EXAMPLES_SOLVER_LIBS OSI_EXAMPLES_SOLVER_PCNAME coin_have_doxygen coin_have_latex coin_doxy_usedot coin_doxy_tagname coin_doxy_logname COIN_HAS_DOXYGEN_TRUE COIN_HAS_DOXYGEN_FALSE COIN_HAS_LATEX_TRUE COIN_HAS_LATEX_FALSE coin_doxy_tagfiles coin_doxy_excludes LIBEXT VPATH_DISTCLEANFILES ABSBUILDDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CDEFS_set=${CDEFS+set} ac_env_CDEFS_value=$CDEFS ac_cv_env_CDEFS_set=${CDEFS+set} ac_cv_env_CDEFS_value=$CDEFS ac_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_cv_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_cv_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_cv_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_cv_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_cv_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_cv_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_MPICC_set=${MPICC+set} ac_env_MPICC_value=$MPICC ac_cv_env_MPICC_set=${MPICC+set} ac_cv_env_MPICC_value=$MPICC ac_env_CXXDEFS_set=${CXXDEFS+set} ac_env_CXXDEFS_value=$CXXDEFS ac_cv_env_CXXDEFS_set=${CXXDEFS+set} ac_cv_env_CXXDEFS_value=$CXXDEFS ac_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_cv_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_cv_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_cv_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_cv_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_cv_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_cv_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_MPICXX_set=${MPICXX+set} ac_env_MPICXX_value=$MPICXX ac_cv_env_MPICXX_set=${MPICXX+set} ac_cv_env_MPICXX_value=$MPICXX ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP ac_env_F77_set=${F77+set} ac_env_F77_value=$F77 ac_cv_env_F77_set=${F77+set} ac_cv_env_F77_value=$F77 ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_env_PKG_CONFIG_value=$PKG_CONFIG ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Osi 0.107.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Osi 0.107.6:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug compile all projects with debug options tests (implies --disable-shared) --enable-debug-osi compile project Osi with debug compiler flags --enable-msvc Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin. --enable-static[=PKGS] build static libraries [default=no] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-dependency-linking disable linking library dependencies into shared libraries --disable-pkg-config disable use of pkg-config (if available) --disable-interpackage-dependencies disables deduction of Makefile dependencies from package linker flags --disable-cplex-libcheck skip the link check at configuration time --disable-mosek-libcheck skip the link check at configuration time --disable-xpress-libcheck skip the link check at configuration time --disable-gurobi-libcheck skip the link check at configuration time Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-osi-verbosity specify the debug verbosity level for project Osi --with-osi-checklevel specify the sanity check level for project Osi --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-coin-instdir prefix of installation directory for precompiled COIN packages --with-coinutils-lib linker flags for using package CoinUtils --with-coinutils-incdir directory with header files for using package CoinUtils --with-coinutils-datadir directory with data files for using package CoinUtils --with-glpk-lib linker flags for using package Glpk --with-glpk-incdir directory with header files for using package Glpk --with-glpk-datadir directory with data files for using package Glpk --with-soplex-lib linker flags for using package SoPlex --with-soplex-incdir directory with header files for using package SoPlex --with-soplex-datadir directory with data files for using package SoPlex --with-sample-lib linker flags for using package Sample --with-sample-incdir directory with header files for using package Sample --with-sample-datadir directory with data files for using package Sample --with-netlib-lib linker flags for using package Netlib --with-netlib-incdir directory with header files for using package Netlib --with-netlib-datadir directory with data files for using package Netlib --with-cplex-incdir specify the header file directory for library Cplex --with-cplex-lib specify the flags used to link with the library Cplex --with-mosek-incdir specify the header file directory for library Mosek --with-mosek-lib specify the flags used to link with the library Mosek --with-xpress-incdir specify the header file directory for library Xpress --with-xpress-lib specify the flags used to link with the library Xpress --with-gurobi-incdir specify the header file directory for library Gurobi --with-gurobi-lib specify the flags used to link with the library Gurobi --with-dot use dot (from graphviz) when creating documentation with doxygen if available; --without-dot to disable Some influential environment variables: CDEFS Additional -D flags to be used when compiling C code. ADD_CFLAGS Additional C compiler options DBG_CFLAGS Debug C compiler options OPT_CFLAGS Optimize C compiler options CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory MPICC C MPI Compiler CXXDEFS Additional -D flags to be used when compiling C++ code. ADD_CXXFLAGS Additional C++ compiler options DBG_CXXFLAGS Debug C++ compiler options OPT_CXXFLAGS Optimize C++ compiler options CXX C++ compiler command CXXFLAGS C++ compiler flags MPICXX C++ MPI Compiler CPP C preprocessor CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags PKG_CONFIG path to pkg-config utility Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Osi configure 0.107.6 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Osi $as_me 0.107.6, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # List one file in the package so that the configure script can test # whether the package is actually there # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # A bit of initial setup # As backup, we make sure we don't loose an FLIBS if it has been set # by the user save_FLIBS="$FLIBS" # A useful makefile conditional that is always false if false; then ALWAYS_FALSE_TRUE= ALWAYS_FALSE_FALSE='#' else ALWAYS_FALSE_TRUE='#' ALWAYS_FALSE_FALSE= fi # We set the following variable so that we know later in AC_COIN_FINALIZE # that we are in a project main directory coin_projectdir=yes # Set the project's version numbers cat >>confdefs.h <<_ACEOF #define OSI_VERSION "$PACKAGE_VERSION" _ACEOF coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'` coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'` coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'` if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi cat >>confdefs.h <<_ACEOF #define OSI_VERSION_MAJOR $coin_majorver _ACEOF cat >>confdefs.h <<_ACEOF #define OSI_VERSION_MINOR $coin_minorver _ACEOF cat >>confdefs.h <<_ACEOF #define OSI_VERSION_RELEASE $coin_releasever _ACEOF # We use the following variable to have a string with the upper case # version of the project name COIN_PRJCT=OSI # Set the project's SVN revision number. The complicated sed expression # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up # as a single number. # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svnversion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svnversion"; then ac_cv_prog_have_svnversion="$have_svnversion" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svnversion="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svnversion" && ac_cv_prog_have_svnversion="no" fi fi have_svnversion=$ac_cv_prog_have_svnversion if test -n "$have_svnversion"; then echo "$as_me:$LINENO: result: $have_svnversion" >&5 echo "${ECHO_T}$have_svnversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$have_svnversion" = xyes; then svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null` if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then OSI_SVN_REV=`echo $svn_rev_tmp | sed -n -e 's/^[0-9]*://' -e 's/\([0-9]\)[^0-9]*$/\1/p'` cat >>confdefs.h <<_ACEOF #define OSI_SVN_REV $OSI_SVN_REV _ACEOF fi fi # Capture libtool library version, if given. coin_libversion=13:6:12 # Check if user wants to produce debugging code echo "$as_me:$LINENO: checking whether we want to compile in debug mode" >&5 echo $ECHO_N "checking whether we want to compile in debug mode... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" case "${enableval}" in yes) coin_debug_compile=true if test "${enable_shared+set}" = set; then :; else enable_shared=no fi ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug" >&2;} { (exit 1); exit 1; }; } ;; esac else coin_debug_compile=false fi; # Check whether --enable-debug-osi or --disable-debug-osi was given. if test "${enable_debug_osi+set}" = set; then enableval="$enable_debug_osi" case "${enableval}" in yes) coin_debug_compile=true ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug-osi" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug-osi" >&2;} { (exit 1); exit 1; }; } ;; esac else : fi; # m4_ifvaln([Osi], if test $coin_debug_compile = true; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Check whether --with-osi-verbosity or --without-osi-verbosity was given. if test "${with_osi_verbosity+set}" = set; then withval="$with_osi_verbosity" if test "$withval" = yes; then withval=1 fi coin_osi_verbosity=$withval else coin_osi_verbosity=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_OSI_VERBOSITY $coin_osi_verbosity _ACEOF # Check whether --with-osi-checklevel or --without-osi-checklevel was given. if test "${with_osi_checklevel+set}" = set; then withval="$with_osi_checklevel" if test "$withval" = yes; then withval=1 fi coin_osi_checklevel=$withval else coin_osi_checklevel=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_OSI_CHECKLEVEL $coin_osi_checklevel _ACEOF # m4_ifvaln([Osi], # Get the name of the C++ compiler and appropriate compiler options # for backward compatibility # Check whether --enable-doscompile or --disable-doscompile was given. if test "${enable_doscompile+set}" = set; then enableval="$enable_doscompile" enable_doscompile=$enableval else enable_doscompile=no fi; # Check whether --enable-msvc or --disable-msvc was given. if test "${enable_msvc+set}" = set; then enableval="$enable_msvc" enable_msvc=$enableval else enable_msvc=no if test "$enable_doscompile" = msvc ; then enable_msvc=yes elif test "$enable_doscompile" != no ; then { { echo "$as_me:$LINENO: error: --enable-doscompile=$enable_doscompile not supported anymore." >&5 echo "$as_me: error: --enable-doscompile=$enable_doscompile not supported anymore." >&2;} { (exit 1); exit 1; }; } fi fi; if test "$enable_msvc" = MD; then enable_shared=yes enable_msvc=yes fi if test "$enable_msvc" = yes; then case $build in *-cygwin* | *-mingw*) ;; *) { { echo "$as_me:$LINENO: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&5 echo "$as_me: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&2;} { (exit 1); exit 1; }; } ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # For consistency, we set the C compiler to the same value of the C++ # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" { echo "$as_me:$LINENO: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&5 echo "$as_me: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&2;} fi ;; esac fi coin_has_cc=yes save_cflags="$CFLAGS" # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. # Depending on the user's PATH, when Studio/Workshop cc is not present we may # find /usr/ucb/cc, which is almost certainly not a good choice for the C # compiler. In this case, put cc after gcc. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl gcc" else comps="gcc icl cl" fi ;; *-*-solaris*) # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_sol_cc_compiler+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$sol_cc_compiler"; then ac_cv_prog_sol_cc_compiler="$sol_cc_compiler" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_sol_cc_compiler="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_sol_cc_compiler shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set sol_cc_compiler to just the basename; use the full file name. shift ac_cv_prog_sol_cc_compiler="$as_dir/$ac_word${1+' '}$@" fi fi fi fi sol_cc_compiler=$ac_cv_prog_sol_cc_compiler if test -n "$sol_cc_compiler"; then echo "$as_me:$LINENO: result: $sol_cc_compiler" >&5 echo "${ECHO_T}$sol_cc_compiler" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$sol_cc_compiler" = "cc" ; then comps="cc xlc gcc pgcc icc" else comps="xlc gcc pgcc icc cc" fi ;; *-*-darwin*) comps="clang gcc cc" ;; *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;; *-linux-*) comps="xlc gcc cc pgcc icc" ;; *) comps="xlc_r xlc cc gcc pgcc icc" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } # AC_MSG_NOTICE([C compiler candidates: $comps]) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -z "$CC" ; then { { echo "$as_me:$LINENO: error: Failed to find a C compiler!" >&5 echo "$as_me: error: Failed to find a C compiler!" >&2;} { (exit 1); exit 1; }; } fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; esac if test $coin_cc_is_cl = true; then COIN_CC_IS_CL_TRUE= COIN_CC_IS_CL_FALSE='#' else COIN_CC_IS_CL_TRUE='#' COIN_CC_IS_CL_FALSE= fi # Check if a project specific CFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} if test x$coin_tmp = xset; then eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} fi fi if test x"$CFLAGS" = x; then coin_add_cflags= coin_opt_cflags= coin_dbg_cflags= coin_warn_cflags= if test "$GCC" = "yes"; then case "$CC" in icc* | */icc*) ;; *) coin_opt_cflags="-O3" coin_add_cflags="-pipe" coin_dbg_cflags="-g -O0" coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cflags="-pedantic-errors $coin_warn_cflags" ;; esac esac fi if test -z "$coin_opt_cflags"; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' coin_dbg_cflags='-MDd' else coin_opt_cflags='-MT -O2' coin_dbg_cflags='-MTd' fi coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -Ox' coin_dbg_cflags='-MDd -debug' else coin_opt_cflags='-MT -Ox' coin_dbg_cflags='-MTd -debug' fi coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CC" in icc* | */icc*) coin_opt_cflags="-O3 -ip -mp1" coin_add_cflags="" coin_dbg_cflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cflags="-i_dynamic $coin_add_cflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgcc* | */pgcc*) coin_opt_cflags="-fast" coin_add_cflags="-Kieee -pc 64" coin_dbg_cflags="-g" ;; esac ;; *-ibm-*) case "$CC" in xlc* | */xlc* | mpxlc* | */mpxlc*) coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_cflags="-g" ;; esac ;; *-hp-*) coin_opt_cflags="-O" coin_add_cflags="-Ae" coin_dbg_cflags="-g" ;; *-*-solaris*) coin_opt_cflags="-xO4" coin_dbg_cflags="-g" ;; *-sgi-*) coin_opt_cflags="-O -OPT:Olimit=0" coin_dbg_cflags="-g" ;; esac fi if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then coin_dbg_cflags="-g" fi if test -z "$coin_opt_cflags"; then # Try if -O option works if nothing else is set CFLAGS="-O" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cflags" = xyes; then coin_warn_cflags= fi if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" fi DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" if test "$coin_debug_compile" = "true"; then CFLAGS="$DBG_CFLAGS" else CFLAGS="$OPT_CFLAGS" fi else CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$CFLAGS" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$CFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CFLAGS works save_CFLAGS="$CFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&2;} CFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C compiler options are: $CFLAGS" >&5 echo "$as_me: C compiler options are: $CFLAGS" >&6;} if test x"$MPICC" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C compiler $MPICC" >&5 echo "$as_me: Will use MPI C compiler $MPICC" >&6;} CC="$MPICC" fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #Let's try if that overcomes configuration problem with VC++ 6.0 ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_has_cxx=yes save_cxxflags="$CXXFLAGS" # For *-*-solaris*, promote Studio/Workshop compiler to front of list. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl g++" else comps="g++ icl cl" fi ;; *-*-solaris*) comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; *-darwin*) comps="clang++ g++ c++ CC" ;; *-linux-gnu*) comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;; *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } # AC_MSG_NOTICE([C++ compiler candidates: $comps]) ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler #thus, we test here whether $CXX is actually working ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking whether C++ compiler $CXX works" >&5 echo $ECHO_N "checking whether C++ compiler $CXX works... $ECHO_C" >&6; cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&5 echo "$as_me: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_cxx_is_cl=false # It seems that we need to cleanup something here for the Windows case "$CXX" in clang* | */clang*) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh mv confdefs.hh confdefs.h coin_cxx_is_cl=true ;; esac # add automake conditional so we can recognize cl compiler in makefile if test $coin_cxx_is_cl = true; then COIN_CXX_IS_CL_TRUE= COIN_CXX_IS_CL_FALSE='#' else COIN_CXX_IS_CL_TRUE='#' COIN_CXX_IS_CL_FALSE= fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CXXFLAGS="$save_cxxflags" # Check if a project specific CXXFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} if test x$coin_tmp = xset; then eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} fi fi if test x"$CXXFLAGS" = x; then # ToDo decide whether we want -DNDEBUG for optimization coin_add_cxxflags= coin_opt_cxxflags= coin_dbg_cxxflags= coin_warn_cxxflags= if test "$GXX" = "yes"; then case "$CXX" in icpc* | */icpc*) ;; *) # ToDo decide about unroll-loops coin_opt_cxxflags="-O3" coin_add_cxxflags="-pipe" coin_dbg_cxxflags="-g -O0" coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" ;; esac esac fi # Note that we do not need to cover GCC in the following tests. if test -z "$coin_opt_cxxflags"; then case $build in *-cygwin* | *-mingw*) case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -O2' coin_dbg_cxxflags='-MDd' else coin_opt_cxxflags='-MT -O2' coin_dbg_cxxflags='-MTd' fi coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -Ox' coin_dbg_cxxflags='-MDd -debug' else coin_opt_cxxflags='-MT -Ox' coin_dbg_cxxflags='-MTd -debug' fi coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CXX" in icpc* | */icpc*) coin_opt_cxxflags="-O3 -ip -mp1" coin_add_cxxflags="" coin_dbg_cxxflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CXXFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cxxflags="-i_dynamic $coin_add_cxxflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgCC* | */pgCC*) coin_opt_cxxflags="-fast" coin_add_cxxflags="-Kieee -pc 64" coin_dbg_cxxflags="-g" ;; esac ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" coin_dbg_cxxflags="-g" ;; esac ;; *-hp-*) case "$CXX" in aCC* | */aCC* ) coin_opt_cxxflags="-O" coin_add_cxxflags="-AA" coin_dbg_cxxflags="-g" ;; esac ;; *-*-solaris*) coin_opt_cxxflags="-O4" coin_dbg_cxxflags="-g" ;; esac fi # Generic flag settings. If these don't work, add a case above. if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then coin_dbg_cxxflags="-g" fi if test -z "$coin_opt_cxxflags"; then # Try if -O option works if nothing else is set CXXFLAGS=-O cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cxxflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cxxflags" = xyes; then coin_warn_cxxflags= fi # Do final setup of flags based on values determined above. if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" fi DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test "$coin_debug_compile" = "true"; then CXXFLAGS="$DBG_CXXFLAGS" else CXXFLAGS="$OPT_CXXFLAGS" fi # Handle the case where CXXFLAGS was set externally. else CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$CXXFLAGS" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$CXXFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CXXFLAGS works save_CXXFLAGS="$CXXFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&2;} CXXFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C++ compiler options are: $CXXFLAGS" >&5 echo "$as_me: C++ compiler options are: $CXXFLAGS" >&6;} if test x"$MPICXX" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C++ compiler $MPICXX" >&5 echo "$as_me: Will use MPI C++ compiler $MPICXX" >&6;} CXX="$MPICXX" fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Initialize automake and libtool { # START coin_disable_shared=no # Test if force_shared has been set if test "x" = xforce_shared; then if test x$enable_shared = xno; then { { echo "$as_me:$LINENO: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&5 echo "$as_me: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&2;} { (exit 1); exit 1; }; } fi enable_shared=yes; else case $build in *-cygwin* | *-mingw*) coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in clang* ) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Building of DLLs not supported in this configuration." >&5 echo "$as_me: Building of DLLs not supported in this configuration." >&6;} ;; *gcc*) if test x"$enable_dependency_linking" = xyes; then coin_disable_shared=no else { echo "$as_me:$LINENO: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&5 echo "$as_me: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&2;} fi ;; *) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; esac fi ;; *-aix*) coin_disable_shared=yes platform=AIX if test x"$enable_shared" = xyes; then { echo "$as_me:$LINENO: WARNING: Shared objects are not supported." >&5 echo "$as_me: WARNING: Shared objects are not supported." >&2;} fi ;; esac fi if test x"$coin_disable_shared" = xyes; then if test x"$enable_shared" = xyes; then : else # we don't disable shared, because it was not selected anyway coin_disable_shared=no fi enable_shared=no fi # By default, we only want the shared objects to be compiled # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=no fi; # Initialize automake echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='osi' VERSION='0.107.6' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi depcc="$CXX" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME echo "$as_me:$LINENO: checking whether we are using the correct autotools" >&5 echo $ECHO_N "checking whether we are using the correct autotools... $ECHO_C" >&6 if test "${ac_cv_use_correct_autotools+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_correct_autotools=check fi echo "$as_me:$LINENO: result: $ac_cv_use_correct_autotools" >&5 echo "${ECHO_T}$ac_cv_use_correct_autotools" >&6 if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_autoconf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_autoconf"; then ac_cv_prog_have_autoconf="$have_autoconf" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_autoconf="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_autoconf" && ac_cv_prog_have_autoconf="no" fi fi have_autoconf=$ac_cv_prog_have_autoconf if test -n "$have_autoconf"; then echo "$as_me:$LINENO: result: $have_autoconf" >&5 echo "${ECHO_T}$have_autoconf" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_autoconf = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of autoconf" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of autoconf... $ECHO_C" >&6 autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of autoconf as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of autoconf as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location echo "$as_me:$LINENO: checking whether autoconf is coming from the correct location" >&5 echo $ECHO_N "checking whether autoconf is coming from the correct location... $ECHO_C" >&6 autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if we have automake # Extract the first word of "automake", so it can be a program name with args. set dummy automake; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_automake+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_automake"; then ac_cv_prog_have_automake="$have_automake" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_automake="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_automake" && ac_cv_prog_have_automake="no" fi fi have_automake=$ac_cv_prog_have_automake if test -n "$have_automake"; then echo "$as_me:$LINENO: result: $have_automake" >&5 echo "${ECHO_T}$have_automake" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_automake = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of automake" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of automake... $ECHO_C" >&6 automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of automake as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of automake as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable automake is picked up from the correct location echo "$as_me:$LINENO: checking whether automake is coming from the correct location" >&5 echo $ECHO_N "checking whether automake is coming from the correct location... $ECHO_C" >&6 automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` if test -r $want_dir/libtool/ltmain.sh; then have_ltmain=yes : else have_ltmain=no : fi echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of libtool." >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of libtool.... $ECHO_C" >&6 if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of libtool." >&5 echo "$as_me: error: You don't have the correct version of libtool." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: I cannot find the ltmain.sh file." >&5 echo "$as_me: error: I cannot find the ltmain.sh file." >&2;} { (exit 1); exit 1; }; } fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi if test -r $want_dir/aclocal/libtool.m4; then LIBTOOLM4="$want_dir/aclocal/libtool.m4" : else { { echo "$as_me:$LINENO: error: I cannot find the libtool.m4 file." >&5 echo "$as_me: error: I cannot find the libtool.m4 file." >&2;} { (exit 1); exit 1; }; } : fi # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https # Extract the first word of "svn", so it can be a program name with args. set dummy svn; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svn"; then ac_cv_prog_have_svn="$have_svn" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svn="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svn" && ac_cv_prog_have_svn="no" fi fi have_svn=$ac_cv_prog_have_svn if test -n "$have_svn"; then echo "$as_me:$LINENO: result: $have_svn" >&5 echo "${ECHO_T}$have_svn" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$have_svn = xyes; then echo "$as_me:$LINENO: checking whether svn understands https" >&5 echo $ECHO_N "checking whether svn understands https... $ECHO_C" >&6 if test "${ac_cv_svn_understands_https+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out fi echo "$as_me:$LINENO: result: $ac_cv_svn_understands_https" >&5 echo "${ECHO_T}$ac_cv_svn_understands_https" >&6 fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else { { echo "$as_me:$LINENO: error: Cannot find the BuildTools directory" >&5 echo "$as_me: error: Cannot find the BuildTools directory" >&2;} { (exit better disable maintainer mode.); exit better disable maintainer mode.; }; } fi fi fi # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` abs_lib_dir=$full_prefix/lib abs_include_dir=$full_prefix/include abs_bin_dir=$full_prefix/bin if test $coin_have_externals = yes && test x$have_svn = xyes; then HAVE_EXTERNALS_TRUE= HAVE_EXTERNALS_FALSE='#' else HAVE_EXTERNALS_TRUE='#' HAVE_EXTERNALS_FALSE= fi # AC_MSG_NOTICE([End automake initialisation.]) LIBTOOL= if test -f ../libtool; then coin_config_dir=.. LIBTOOL='$(SHELL) $(top_builddir)/../libtool' fi if test "x$LIBTOOL" = x; then if test -f ../../libtool; then coin_config_dir=../.. LIBTOOL='$(SHELL) $(top_builddir)/../../libtool' fi fi if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) # Stuff for libtool # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi; echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done fi SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix4* | aix5*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | kfreebsd*-gnu | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 5843 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to osi@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done F77=$ac_ct_F77 fi # Provide some information about the compiler. echo "$as_me:6977:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 else echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux*) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6 else echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 fi echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6 if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6 objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAGIC_CMD=: fi fi fi ;; esac enable_dlopen=no enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default fi; test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8044: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8048: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8312: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8316: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 if test x"$lt_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works=yes fi else lt_prog_compiler_static_works=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 if test x"$lt_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8416: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:8420: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix3*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs=no ;; esac fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var" || \ test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which library types will actually be built echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags or --without-tags was given. if test "${with_tags+set}" = set; then withval="$with_tags" tagnames="$withval" fi; if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_CXX=yes else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_CXX=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_CXX='+b $libdir' ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix3*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. We must also pass each convience library through # to the system linker between allextract/defaultextract. # The C++ compiler will combine linker options so we # cannot just pass the convience library names through # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix3*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; solaris*) case $cc_basename in CC*) # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. postdeps_CXX='-lCstd -lCrun' ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13205: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:13209: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_CXX=yes fi else lt_prog_compiler_static_works_CXX=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 if test x"$lt_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13309: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:13313: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var_CXX" || \ test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6 if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_CXX" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code=" subroutine t\n return\n end\n" # Code to be used in simple link tests lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14879: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14883: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_F77=yes fi else lt_prog_compiler_static_works_F77=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 if test x"$lt_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14983: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:14987: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix3*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_F77=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_F77=yes else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_F77=no ;; esac fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var_F77" || \ test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6 if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_F77" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no old_archive_cmds_GCJ=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17190: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17194: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_GCJ='-Qoption ld ';; *) lt_prog_compiler_wl_GCJ='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; unicos*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_can_build_shared_GCJ=no ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17458: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17462: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_GCJ=yes fi else lt_prog_compiler_static_works_GCJ=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17562: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:17566: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix3*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_GCJ=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = no; then runpath_var= hardcode_libdir_flag_spec_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_GCJ=yes else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_GCJ=no ;; esac fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6 test "$ld_shlibs_GCJ" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ pic_flag=$lt_prog_compiler_pic_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var_GCJ" || \ test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6 if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_GCJ" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_RC" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion # No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- # AC_REQUIRE([AC_COIN_DLFCN_H]) # NEW: If libtool exists in the directory higher up, we use that one # instead of creating a new one # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED # out in front of this macro body. You'll notice that LIBTOOL is already # defined here. We'll have to count on this macro not being called if libtool # already exists, or at least move the libtool fixes outside the conditional. # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".]) # This test is therefore removed. -- lh, 061214 -- # if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Calling PROG_LIBTOOL.]) # AC_MSG_NOTICE([Finished PROG_LIBTOOL.]) { echo "$as_me:$LINENO: Build is \"$build\"." >&5 echo "$as_me: Build is \"$build\"." >&6;} mydos2unix='| dos2unix' case $build in *-mingw*) CYGPATH_W=echo mydos2unix= ;; esac case $build in # Here we need to check if -m32 is specified. If so, we need to correct # sys_lib_search_path_spec *-cygwin* | *-mingw*) case "$CXX" in clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? { echo "$as_me:$LINENO: Applying patches to libtool for CLANG compiler" >&5 echo "$as_me: Applying patches to libtool for CLANG compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Applying patches to libtool for cl compiler" >&5 echo "$as_me: Applying patches to libtool for cl compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%lib /OUT:%lib -OUT:%' \ -e "s%cygpath -w%$CYGPATH_W%" \ -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$1"'); done%' \ -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$1"') '"$mydos2unix"'%' \ -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ libtool > conftest.bla ;; *) { echo "$as_me:$LINENO: Applying patches to libtool for GNU compiler" >&5 echo "$as_me: Applying patches to libtool for GNU compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; esac mv conftest.bla libtool chmod 755 libtool ;; *x86_64-*) if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then { echo "$as_me:$LINENO: Applying patches to libtool for 32bit compilation" >&5 echo "$as_me: Applying patches to libtool for 32bit compilation" >&6;} sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi ;; *-solaris*) if test "$GCC" = yes && \ (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then hdwisa=`isainfo | sed -e 's/\([^ ]*\) .*$/\1/'` if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then { echo "$as_me:$LINENO: Applying patches to libtool for 64-bit GCC compilation" >&5 echo "$as_me: Applying patches to libtool for 64-bit GCC compilation" >&6;} fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then # AC_MSG_NOTICE(Compensating for broken gcc) for lib in $fixlibtmp ; do if test -d "${lib}${hdwisa}" ; then syslibpath64="$syslibpath64 ${lib}${hdwisa}/" fi done syslibpath64="${syslibpath64} ${fixlibtmp}" else syslibpath64="$fixlibtmp" fi sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi # AC_MSG_NOTICE(Result is ) # $EGREP 'sys_lib_search_path_spec=' libtool fi ;; # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. *-darwin*) { echo "$as_me:$LINENO: Applying patches to libtool for Darwin" >&5 echo "$as_me: Applying patches to libtool for Darwin" >&6;} sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool ;; esac # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of # the macro. -- lh, 061214 -- # fi # AC_MSG_NOTICE([End libtool initialisation.]) # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) # set RPATH_FLAGS to the compiler link flags required to hardcode location # of the shared objects RPATH_FLAGS= if test $enable_shared = yes; then case $build in *-linux-*) if test "$GXX" = "yes"; then RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" done fi ;; *-darwin*) RPATH_FLAGS=nothing ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) RPATH_FLAGS=nothing ;; esac ;; *-hp-*) RPATH_FLAGS=nothing ;; *-mingw32) RPATH_FLAGS=nothing ;; *-*-solaris*) RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -R$dir" done esac if test "$RPATH_FLAGS" = ""; then { echo "$as_me:$LINENO: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&5 echo "$as_me: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&2;} fi if test "$RPATH_FLAGS" = "nothing"; then RPATH_FLAGS= fi fi else { echo "$as_me:$LINENO: Using libtool script in directory $coin_config_dir" >&5 echo "$as_me: Using libtool script in directory $coin_config_dir" >&6;} # get all missing information from the config.log file # output variables and defines as_save_IFS=$IFS IFS=' ' for oneline in `cat $coin_config_dir/config.status`; do case "$oneline" in # First some automake conditionals s,@am__fastdep* | s,@AR@* | s,@CPP@* | s,@CPPFLAGS@* | s,@CXXCPP@* | \ s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \ s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \ s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; s,@DEFS@* ) command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; esac done IFS=$as_save_IFS # And some defines (assuming here that the packages base dir # doesn't have a config.h file for word in $defsline; do # echo word $word case $word in -DHAVE_[A-Z_]*_H=1 | -DSTDC_HEADERS=1 ) i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` # echo dd $i echo $i >>confdefs.h ;; esac done fi # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) # Check whether --enable-dependency-linking or --disable-dependency-linking was given. if test "${enable_dependency_linking+set}" = set; then enableval="$enable_dependency_linking" dependency_linking="$enableval" else dependency_linking=auto fi; if test "$dependency_linking" = auto; then # On Cygwin and AIX, building DLLs doesn't work dependency_linking=no if test x"$coin_disable_shared" = xno; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) dependency_linking=no ;; *gcc*) dependency_linking=yes ;; *) dependency_linking=yes ;; esac ;; *) dependency_linking=yes ;; esac fi fi if test "$dependency_linking" = yes ; then LT_LDFLAGS="-no-undefined" else LT_LDFLAGS= fi if test "$dependency_linking" = yes; then DEPENDENCY_LINKING_TRUE= DEPENDENCY_LINKING_FALSE='#' else DEPENDENCY_LINKING_TRUE='#' DEPENDENCY_LINKING_FALSE= fi # Check if we want to set the library version echo "$as_me:$LINENO: checking if library version is set" >&5 echo $ECHO_N "checking if library version is set... $ECHO_C" >&6 if test x"$coin_libversion" != x; then LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion" echo "$as_me:$LINENO: result: $coin_libversion" >&5 echo "${ECHO_T}$coin_libversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi #END } ############################################################################# # COIN-OR components # ############################################################################# # Check whether --enable-pkg-config or --disable-pkg-config was given. if test "${enable_pkg_config+set}" = set; then enableval="$enable_pkg_config" use_pkgconfig="$enableval" else if test x$coin_cc_is_cl = xtrue; then use_pkgconfig=no else use_pkgconfig=yes fi fi; if test $use_pkgconfig = yes ; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PKG_CONFIG=$ac_cv_prog_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_PKG_CONFIG"; then ac_ct_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_PKG_CONFIG"; then ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG if test -n "$ac_ct_PKG_CONFIG"; then echo "$as_me:$LINENO: result: $ac_ct_PKG_CONFIG" >&5 echo "${ECHO_T}$ac_ct_PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi PKG_CONFIG=$ac_ct_PKG_CONFIG else PKG_CONFIG="$ac_cv_prog_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.16.0 echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 PKG_CONFIG="" fi fi # check if pkg-config supports the short-errors flag if test -n "$PKG_CONFIG" && \ $PKG_CONFIG --atleast-pkgconfig-version 0.20; then pkg_short_errors=" --short-errors " else pkg_short_errors="" fi fi if test -n "$PKG_CONFIG"; then COIN_HAS_PKGCONFIG_TRUE= COIN_HAS_PKGCONFIG_FALSE='#' else COIN_HAS_PKGCONFIG_TRUE='#' COIN_HAS_PKGCONFIG_FALSE= fi # assemble pkg-config search path for installed projects COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" # let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there # best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig, # unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}... if test "x${prefix}" = xNONE ; then COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" else COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi # Check whether --with-coin-instdir or --without-coin-instdir was given. if test "${with_coin_instdir+set}" = set; then withval="$with_coin_instdir" if test -d "$withval"; then : ; else { { echo "$as_me:$LINENO: error: argument for --with-coin-instdir not a directory" >&5 echo "$as_me: error: argument for --with-coin-instdir not a directory" >&2;} { (exit 1); exit 1; }; } fi COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi; # assemble additional pkg-config search paths for uninstalled projects if test x$coin_projectdir = xyes ; then # if we are in a project setup, then in a classic setup, we want to find uninstalled projects # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory # unfortunately, if the user set prefix, then we do not know where the project base directory is located # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data) COIN_PKG_CONFIG_PATH_UNINSTALLED= if test -f ../coin_subdirs.txt ; then for i in `cat ../coin_subdirs.txt` ; do if test -d ../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi if test -f ../../coin_subdirs.txt ; then for i in `cat ../../coin_subdirs.txt` ; do if test -d ../../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi fi if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then { echo "$as_me:$LINENO: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&5 echo "$as_me: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&2;} fi echo "$as_me:$LINENO: checking for COIN-OR package CoinUtils" >&5 echo $ECHO_N "checking for COIN-OR package CoinUtils... $ECHO_C" >&6 coin_has_coinutils=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "CoinUtils"; then coin_has_coinutils=skipping fi done fi if test "$coin_has_coinutils" != skipping; then # Check whether --with-m4_tolower(CoinUtils) or --without-m4_tolower(CoinUtils) was given. if test "${with_coinutils+set}" = set; then withval="$with_coinutils" if test "$withval" = no ; then coin_has_coinutils=skipping fi fi; fi COINUTILS_LIBS= COINUTILS_CFLAGS= COINUTILS_DATA= COINUTILS_DEPENDENCIES= COINUTILS_PCLIBS= COINUTILS_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-lib or --without-m4_tolower(CoinUtils)-lib was given. if test "${with_coinutils_lib+set}" = set; then withval="$with_coinutils_lib" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_LIBS="$withval" COINUTILS_PCLIBS="$withval" OSILIB_PCLIBS="$withval $OSILIB_PCLIBS" OSILIB_LIBS="$withval $OSILIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_LIBS_INSTALLED="$withval" OSILIB_LIBS_INSTALLED="$withval $OSILIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-incdir or --without-m4_tolower(CoinUtils)-incdir was given. if test "${with_coinutils_incdir+set}" = set; then withval="$with_coinutils_incdir" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_CFLAGS="-I`${CYGPATH_W} $withval`" OSILIB_CFLAGS="-I`${CYGPATH_W} $withval` $OSILIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_CFLAGS_INSTALLED="$COINUTILS_CFLAGS" OSILIB_CFLAGS_INSTALLED="$COINUTILS_CFLAGS $OSILIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-datadir or --without-m4_tolower(CoinUtils)-datadir was given. if test "${with_coinutils_datadir+set}" = set; then withval="$with_coinutils_datadir" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_coinutils = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinutils"; then COINUTILS_VERSIONS=`$PKG_CONFIG --modversion "coinutils" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinutils" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS="$cflags" COINUTILS_LIBS=`$PKG_CONFIG --libs "coinutils" 2>/dev/null` COINUTILS_DATA=`$PKG_CONFIG --variable=datadir "coinutils" 2>/dev/null` coin_has_coinutils=yes echo "$as_me:$LINENO: result: yes: $COINUTILS_VERSIONS" >&5 echo "${ECHO_T}yes: $COINUTILS_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then COINUTILS_LIBS=`echo " $COINUTILS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi COINUTILS_PCREQUIRES="coinutils" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in OsiLib OSILIB_PCREQUIRES="coinutils $OSILIB_PCREQUIRES" OSILIB_CFLAGS="$COINUTILS_CFLAGS $OSILIB_CFLAGS" OSILIB_LIBS="$COINUTILS_LIBS $OSILIB_LIBS" else COINUTILS_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinutils"` coin_has_coinutils=notGiven echo "$as_me:$LINENO: result: not given: $COINUTILS_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $COINUTILS_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module CoinUtils without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module CoinUtils without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package CoinUtils (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package CoinUtils (fallback)... $ECHO_C" >&6 coin_has_coinutils=notGiven COINUTILS_LIBS= COINUTILS_LIBS_INSTALLED= COINUTILS_CFLAGS= COINUTILS_CFLAGS_INSTALLED= COINUTILS_DATA= COINUTILS_DATA_INSTALLED= COINUTILS_PCLIBS= COINUTILS_PCREQUIRES= # initial list of dependencies is "coinutils", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinutils" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$COINUTILS_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` COINUTILS_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$COINUTILS_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi COINUTILS_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS="$projcflags $COINUTILS_CFLAGS" # set LIBS variable COINUTILS_LIBS="$projlibs $COINUTILS_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS_INSTALLED="$projcflags $COINUTILS_CFLAGS_INSTALLED" # set LIBS variable COINUTILS_LIBS_INSTALLED="$projlibs $COINUTILS_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_coinutils=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_COINUTILS 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then COINUTILS_LIBS=`echo " $COINUTILS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` COINUTILS_LIBS_INSTALLED=`echo " $COINUTILS_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi COINUTILS_PCREQUIRES="coinutils" OSILIB_PCREQUIRES="coinutils $OSILIB_PCREQUIRES" OSILIB_CFLAGS="$COINUTILS_CFLAGS $OSILIB_CFLAGS" OSILIB_LIBS="$COINUTILS_LIBS $OSILIB_LIBS" OSILIB_CFLAGS_INSTALLED="$COINUTILS_CFLAGS_INSTALLED $OSILIB_CFLAGS_INSTALLED" OSILIB_LIBS_INSTALLED="$COINUTILS_LIBS_INSTALLED $OSILIB_LIBS_INSTALLED" fi if test $coin_has_coinutils != notGiven && test $coin_has_coinutils != skipping; then COIN_HAS_COINUTILS_TRUE= COIN_HAS_COINUTILS_FALSE='#' else COIN_HAS_COINUTILS_TRUE='#' COIN_HAS_COINUTILS_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_coinutils" >&5 echo "${ECHO_T}$coin_has_coinutils" >&6 fi if test $coin_has_coinutils != skipping && test $coin_has_coinutils != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_COINUTILS 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) COINUTILS_DEPENDENCIES=`echo " $COINUTILS_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` OSILIB_DEPENDENCIES=`echo " $OSILIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$COINUTILS_CFLAGS" ; then { echo "$as_me:$LINENO: CoinUtils CFLAGS are $COINUTILS_CFLAGS" >&5 echo "$as_me: CoinUtils CFLAGS are $COINUTILS_CFLAGS" >&6;} fi if test -n "$COINUTILS_LIBS" ; then { echo "$as_me:$LINENO: CoinUtils LIBS are $COINUTILS_LIBS" >&5 echo "$as_me: CoinUtils LIBS are $COINUTILS_LIBS" >&6;} fi if test -n "$COINUTILS_DEPENDENCIES" ; then { echo "$as_me:$LINENO: CoinUtils DEPENDENCIES are $COINUTILS_DEPENDENCIES" >&5 echo "$as_me: CoinUtils DEPENDENCIES are $COINUTILS_DEPENDENCIES" >&6;} fi if test -n "$COINUTILS_DATA" ; then { echo "$as_me:$LINENO: CoinUtils DATA is $COINUTILS_DATA" >&5 echo "$as_me: CoinUtils DATA is $COINUTILS_DATA" >&6;} fi if test -n "$COINUTILS_PCLIBS" ; then { echo "$as_me:$LINENO: CoinUtils PCLIBS are $COINUTILS_PCLIBS" >&5 echo "$as_me: CoinUtils PCLIBS are $COINUTILS_PCLIBS" >&6;} fi if test -n "$COINUTILS_PCREQUIRES" ; then { echo "$as_me:$LINENO: CoinUtils PCREQUIRES are $COINUTILS_PCREQUIRES" >&5 echo "$as_me: CoinUtils PCREQUIRES are $COINUTILS_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: OsiLib CFLAGS are $OSILIB_CFLAGS" >&5 echo "$as_me: OsiLib CFLAGS are $OSILIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: OsiLib LIBS are $OSILIB_LIBS" >&5 echo "$as_me: OsiLib LIBS are $OSILIB_LIBS" >&6;} { echo "$as_me:$LINENO: OsiLib DEPENDENCIES are $OSILIB_DEPENDENCIES" >&5 echo "$as_me: OsiLib DEPENDENCIES are $OSILIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_coinutils != notGiven && test $coin_has_coinutils != skipping; then COIN_HAS_COINUTILS_TRUE= COIN_HAS_COINUTILS_FALSE='#' else COIN_HAS_COINUTILS_TRUE='#' COIN_HAS_COINUTILS_FALSE= fi if test $coin_has_coinutils != yes ; then { { echo "$as_me:$LINENO: error: Required package CoinUtils not available." >&5 echo "$as_me: error: Required package CoinUtils not available." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for COIN-OR package Glpk" >&5 echo $ECHO_N "checking for COIN-OR package Glpk... $ECHO_C" >&6 coin_has_glpk=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Glpk"; then coin_has_glpk=skipping fi done fi if test "$coin_has_glpk" != skipping; then # Check whether --with-m4_tolower(Glpk) or --without-m4_tolower(Glpk) was given. if test "${with_glpk+set}" = set; then withval="$with_glpk" if test "$withval" = no ; then coin_has_glpk=skipping fi fi; fi GLPK_LIBS= GLPK_CFLAGS= GLPK_DATA= GLPK_DEPENDENCIES= GLPK_PCLIBS= GLPK_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-lib or --without-m4_tolower(Glpk)-lib was given. if test "${with_glpk_lib+set}" = set; then withval="$with_glpk_lib" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_LIBS="$withval" GLPK_PCLIBS="$withval" OSIGLPKLIB_PCLIBS="$withval $OSIGLPKLIB_PCLIBS" OSIGLPKLIB_LIBS="$withval $OSIGLPKLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_LIBS_INSTALLED="$withval" OSIGLPKLIB_LIBS_INSTALLED="$withval $OSIGLPKLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-incdir or --without-m4_tolower(Glpk)-incdir was given. if test "${with_glpk_incdir+set}" = set; then withval="$with_glpk_incdir" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_CFLAGS="-I`${CYGPATH_W} $withval`" OSIGLPKLIB_CFLAGS="-I`${CYGPATH_W} $withval` $OSIGLPKLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_CFLAGS_INSTALLED="$GLPK_CFLAGS" OSIGLPKLIB_CFLAGS_INSTALLED="$GLPK_CFLAGS $OSIGLPKLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-datadir or --without-m4_tolower(Glpk)-datadir was given. if test "${with_glpk_datadir+set}" = set; then withval="$with_glpk_datadir" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_glpk = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinglpk"; then GLPK_VERSIONS=`$PKG_CONFIG --modversion "coinglpk" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinglpk" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS="$cflags" GLPK_LIBS=`$PKG_CONFIG --libs "coinglpk" 2>/dev/null` GLPK_DATA=`$PKG_CONFIG --variable=datadir "coinglpk" 2>/dev/null` coin_has_glpk=yes echo "$as_me:$LINENO: result: yes: $GLPK_VERSIONS" >&5 echo "${ECHO_T}yes: $GLPK_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GLPK_LIBS=`echo " $GLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi GLPK_PCREQUIRES="coinglpk" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in OsiGlpkLib OSIGLPKLIB_PCREQUIRES="coinglpk $OSIGLPKLIB_PCREQUIRES" OSIGLPKLIB_CFLAGS="$GLPK_CFLAGS $OSIGLPKLIB_CFLAGS" OSIGLPKLIB_LIBS="$GLPK_LIBS $OSIGLPKLIB_LIBS" else GLPK_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinglpk"` coin_has_glpk=notGiven echo "$as_me:$LINENO: result: not given: $GLPK_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $GLPK_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Glpk without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Glpk without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Glpk (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Glpk (fallback)... $ECHO_C" >&6 coin_has_glpk=notGiven GLPK_LIBS= GLPK_LIBS_INSTALLED= GLPK_CFLAGS= GLPK_CFLAGS_INSTALLED= GLPK_DATA= GLPK_DATA_INSTALLED= GLPK_PCLIBS= GLPK_PCREQUIRES= # initial list of dependencies is "coinglpk", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinglpk" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$GLPK_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` GLPK_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$GLPK_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi GLPK_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS="$projcflags $GLPK_CFLAGS" # set LIBS variable GLPK_LIBS="$projlibs $GLPK_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS_INSTALLED="$projcflags $GLPK_CFLAGS_INSTALLED" # set LIBS variable GLPK_LIBS_INSTALLED="$projlibs $GLPK_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_glpk=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GLPK 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GLPK_LIBS=`echo " $GLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` GLPK_LIBS_INSTALLED=`echo " $GLPK_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi GLPK_PCREQUIRES="coinglpk" OSIGLPKLIB_PCREQUIRES="coinglpk $OSIGLPKLIB_PCREQUIRES" OSIGLPKLIB_CFLAGS="$GLPK_CFLAGS $OSIGLPKLIB_CFLAGS" OSIGLPKLIB_LIBS="$GLPK_LIBS $OSIGLPKLIB_LIBS" OSIGLPKLIB_CFLAGS_INSTALLED="$GLPK_CFLAGS_INSTALLED $OSIGLPKLIB_CFLAGS_INSTALLED" OSIGLPKLIB_LIBS_INSTALLED="$GLPK_LIBS_INSTALLED $OSIGLPKLIB_LIBS_INSTALLED" fi if test $coin_has_glpk != notGiven && test $coin_has_glpk != skipping; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_glpk" >&5 echo "${ECHO_T}$coin_has_glpk" >&6 fi if test $coin_has_glpk != skipping && test $coin_has_glpk != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GLPK 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) GLPK_DEPENDENCIES=`echo " $GLPK_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` OSIGLPKLIB_DEPENDENCIES=`echo " $OSIGLPKLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$GLPK_CFLAGS" ; then { echo "$as_me:$LINENO: Glpk CFLAGS are $GLPK_CFLAGS" >&5 echo "$as_me: Glpk CFLAGS are $GLPK_CFLAGS" >&6;} fi if test -n "$GLPK_LIBS" ; then { echo "$as_me:$LINENO: Glpk LIBS are $GLPK_LIBS" >&5 echo "$as_me: Glpk LIBS are $GLPK_LIBS" >&6;} fi if test -n "$GLPK_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Glpk DEPENDENCIES are $GLPK_DEPENDENCIES" >&5 echo "$as_me: Glpk DEPENDENCIES are $GLPK_DEPENDENCIES" >&6;} fi if test -n "$GLPK_DATA" ; then { echo "$as_me:$LINENO: Glpk DATA is $GLPK_DATA" >&5 echo "$as_me: Glpk DATA is $GLPK_DATA" >&6;} fi if test -n "$GLPK_PCLIBS" ; then { echo "$as_me:$LINENO: Glpk PCLIBS are $GLPK_PCLIBS" >&5 echo "$as_me: Glpk PCLIBS are $GLPK_PCLIBS" >&6;} fi if test -n "$GLPK_PCREQUIRES" ; then { echo "$as_me:$LINENO: Glpk PCREQUIRES are $GLPK_PCREQUIRES" >&5 echo "$as_me: Glpk PCREQUIRES are $GLPK_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: OsiGlpkLib CFLAGS are $OSIGLPKLIB_CFLAGS" >&5 echo "$as_me: OsiGlpkLib CFLAGS are $OSIGLPKLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: OsiGlpkLib LIBS are $OSIGLPKLIB_LIBS" >&5 echo "$as_me: OsiGlpkLib LIBS are $OSIGLPKLIB_LIBS" >&6;} { echo "$as_me:$LINENO: OsiGlpkLib DEPENDENCIES are $OSIGLPKLIB_DEPENDENCIES" >&5 echo "$as_me: OsiGlpkLib DEPENDENCIES are $OSIGLPKLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_glpk != notGiven && test $coin_has_glpk != skipping; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package SoPlex" >&5 echo $ECHO_N "checking for COIN-OR package SoPlex... $ECHO_C" >&6 coin_has_soplex=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "SoPlex"; then coin_has_soplex=skipping fi done fi if test "$coin_has_soplex" != skipping; then # Check whether --with-m4_tolower(SoPlex) or --without-m4_tolower(SoPlex) was given. if test "${with_soplex+set}" = set; then withval="$with_soplex" if test "$withval" = no ; then coin_has_soplex=skipping fi fi; fi SOPLEX_LIBS= SOPLEX_CFLAGS= SOPLEX_DATA= SOPLEX_DEPENDENCIES= SOPLEX_PCLIBS= SOPLEX_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_soplex != skipping; then # Check whether --with-m4_tolower(SoPlex)-lib or --without-m4_tolower(SoPlex)-lib was given. if test "${with_soplex_lib+set}" = set; then withval="$with_soplex_lib" if test "$withval" = no ; then coin_has_soplex=skipping else coin_has_soplex=yes SOPLEX_LIBS="$withval" SOPLEX_PCLIBS="$withval" OSISPXLIB_PCLIBS="$withval $OSISPXLIB_PCLIBS" OSISPXLIB_LIBS="$withval $OSISPXLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SOPLEX_LIBS_INSTALLED="$withval" OSISPXLIB_LIBS_INSTALLED="$withval $OSISPXLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_soplex != skipping; then # Check whether --with-m4_tolower(SoPlex)-incdir or --without-m4_tolower(SoPlex)-incdir was given. if test "${with_soplex_incdir+set}" = set; then withval="$with_soplex_incdir" if test "$withval" = no ; then coin_has_soplex=skipping else coin_has_soplex=yes SOPLEX_CFLAGS="-I`${CYGPATH_W} $withval`" OSISPXLIB_CFLAGS="-I`${CYGPATH_W} $withval` $OSISPXLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SOPLEX_CFLAGS_INSTALLED="$SOPLEX_CFLAGS" OSISPXLIB_CFLAGS_INSTALLED="$SOPLEX_CFLAGS $OSISPXLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_soplex != skipping; then # Check whether --with-m4_tolower(SoPlex)-datadir or --without-m4_tolower(SoPlex)-datadir was given. if test "${with_soplex_datadir+set}" = set; then withval="$with_soplex_datadir" if test "$withval" = no ; then coin_has_soplex=skipping else coin_has_soplex=yes SOPLEX_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SOPLEX_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_soplex = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinsoplex"; then SOPLEX_VERSIONS=`$PKG_CONFIG --modversion "coinsoplex" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinsoplex" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SOPLEX_CFLAGS="$cflags" SOPLEX_LIBS=`$PKG_CONFIG --libs "coinsoplex" 2>/dev/null` SOPLEX_DATA=`$PKG_CONFIG --variable=datadir "coinsoplex" 2>/dev/null` coin_has_soplex=yes echo "$as_me:$LINENO: result: yes: $SOPLEX_VERSIONS" >&5 echo "${ECHO_T}yes: $SOPLEX_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SOPLEX_LIBS=`echo " $SOPLEX_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi SOPLEX_PCREQUIRES="coinsoplex" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in OsiSpxLib OSISPXLIB_PCREQUIRES="coinsoplex $OSISPXLIB_PCREQUIRES" OSISPXLIB_CFLAGS="$SOPLEX_CFLAGS $OSISPXLIB_CFLAGS" OSISPXLIB_LIBS="$SOPLEX_LIBS $OSISPXLIB_LIBS" else SOPLEX_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinsoplex"` coin_has_soplex=notGiven echo "$as_me:$LINENO: result: not given: $SOPLEX_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $SOPLEX_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module SoPlex without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module SoPlex without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package SoPlex (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package SoPlex (fallback)... $ECHO_C" >&6 coin_has_soplex=notGiven SOPLEX_LIBS= SOPLEX_LIBS_INSTALLED= SOPLEX_CFLAGS= SOPLEX_CFLAGS_INSTALLED= SOPLEX_DATA= SOPLEX_DATA_INSTALLED= SOPLEX_PCLIBS= SOPLEX_PCREQUIRES= # initial list of dependencies is "coinsoplex", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinsoplex" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$SOPLEX_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` SOPLEX_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$SOPLEX_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi SOPLEX_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SOPLEX_CFLAGS="$projcflags $SOPLEX_CFLAGS" # set LIBS variable SOPLEX_LIBS="$projlibs $SOPLEX_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SOPLEX_CFLAGS_INSTALLED="$projcflags $SOPLEX_CFLAGS_INSTALLED" # set LIBS variable SOPLEX_LIBS_INSTALLED="$projlibs $SOPLEX_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_soplex=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SOPLEX 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SOPLEX_LIBS=`echo " $SOPLEX_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` SOPLEX_LIBS_INSTALLED=`echo " $SOPLEX_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi SOPLEX_PCREQUIRES="coinsoplex" OSISPXLIB_PCREQUIRES="coinsoplex $OSISPXLIB_PCREQUIRES" OSISPXLIB_CFLAGS="$SOPLEX_CFLAGS $OSISPXLIB_CFLAGS" OSISPXLIB_LIBS="$SOPLEX_LIBS $OSISPXLIB_LIBS" OSISPXLIB_CFLAGS_INSTALLED="$SOPLEX_CFLAGS_INSTALLED $OSISPXLIB_CFLAGS_INSTALLED" OSISPXLIB_LIBS_INSTALLED="$SOPLEX_LIBS_INSTALLED $OSISPXLIB_LIBS_INSTALLED" fi if test $coin_has_soplex != notGiven && test $coin_has_soplex != skipping; then COIN_HAS_SOPLEX_TRUE= COIN_HAS_SOPLEX_FALSE='#' else COIN_HAS_SOPLEX_TRUE='#' COIN_HAS_SOPLEX_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_soplex" >&5 echo "${ECHO_T}$coin_has_soplex" >&6 fi if test $coin_has_soplex != skipping && test $coin_has_soplex != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SOPLEX 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) SOPLEX_DEPENDENCIES=`echo " $SOPLEX_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` OSISPXLIB_DEPENDENCIES=`echo " $OSISPXLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$SOPLEX_CFLAGS" ; then { echo "$as_me:$LINENO: SoPlex CFLAGS are $SOPLEX_CFLAGS" >&5 echo "$as_me: SoPlex CFLAGS are $SOPLEX_CFLAGS" >&6;} fi if test -n "$SOPLEX_LIBS" ; then { echo "$as_me:$LINENO: SoPlex LIBS are $SOPLEX_LIBS" >&5 echo "$as_me: SoPlex LIBS are $SOPLEX_LIBS" >&6;} fi if test -n "$SOPLEX_DEPENDENCIES" ; then { echo "$as_me:$LINENO: SoPlex DEPENDENCIES are $SOPLEX_DEPENDENCIES" >&5 echo "$as_me: SoPlex DEPENDENCIES are $SOPLEX_DEPENDENCIES" >&6;} fi if test -n "$SOPLEX_DATA" ; then { echo "$as_me:$LINENO: SoPlex DATA is $SOPLEX_DATA" >&5 echo "$as_me: SoPlex DATA is $SOPLEX_DATA" >&6;} fi if test -n "$SOPLEX_PCLIBS" ; then { echo "$as_me:$LINENO: SoPlex PCLIBS are $SOPLEX_PCLIBS" >&5 echo "$as_me: SoPlex PCLIBS are $SOPLEX_PCLIBS" >&6;} fi if test -n "$SOPLEX_PCREQUIRES" ; then { echo "$as_me:$LINENO: SoPlex PCREQUIRES are $SOPLEX_PCREQUIRES" >&5 echo "$as_me: SoPlex PCREQUIRES are $SOPLEX_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: OsiSpxLib CFLAGS are $OSISPXLIB_CFLAGS" >&5 echo "$as_me: OsiSpxLib CFLAGS are $OSISPXLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: OsiSpxLib LIBS are $OSISPXLIB_LIBS" >&5 echo "$as_me: OsiSpxLib LIBS are $OSISPXLIB_LIBS" >&6;} { echo "$as_me:$LINENO: OsiSpxLib DEPENDENCIES are $OSISPXLIB_DEPENDENCIES" >&5 echo "$as_me: OsiSpxLib DEPENDENCIES are $OSISPXLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_soplex != notGiven && test $coin_has_soplex != skipping; then COIN_HAS_SOPLEX_TRUE= COIN_HAS_SOPLEX_FALSE='#' else COIN_HAS_SOPLEX_TRUE='#' COIN_HAS_SOPLEX_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Sample" >&5 echo $ECHO_N "checking for COIN-OR package Sample... $ECHO_C" >&6 coin_has_sample=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Sample"; then coin_has_sample=skipping fi done fi if test "$coin_has_sample" != skipping; then # Check whether --with-m4_tolower(Sample) or --without-m4_tolower(Sample) was given. if test "${with_sample+set}" = set; then withval="$with_sample" if test "$withval" = no ; then coin_has_sample=skipping fi fi; fi SAMPLE_LIBS= SAMPLE_CFLAGS= SAMPLE_DATA= SAMPLE_DEPENDENCIES= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-lib or --without-m4_tolower(Sample)-lib was given. if test "${with_sample_lib+set}" = set; then withval="$with_sample_lib" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_LIBS="$withval" SAMPLE_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-incdir or --without-m4_tolower(Sample)-incdir was given. if test "${with_sample_incdir+set}" = set; then withval="$with_sample_incdir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_CFLAGS_INSTALLED="$SAMPLE_CFLAGS" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-datadir or --without-m4_tolower(Sample)-datadir was given. if test "${with_sample_datadir+set}" = set; then withval="$with_sample_datadir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatasample"; then SAMPLE_VERSIONS=`$PKG_CONFIG --modversion "coindatasample" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatasample" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$cflags" SAMPLE_LIBS=`$PKG_CONFIG --libs "coindatasample" 2>/dev/null` SAMPLE_DATA=`$PKG_CONFIG --variable=datadir "coindatasample" 2>/dev/null` coin_has_sample=yes echo "$as_me:$LINENO: result: yes: $SAMPLE_VERSIONS" >&5 echo "${ECHO_T}yes: $SAMPLE_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi SAMPLE_PCREQUIRES="coindatasample" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else SAMPLE_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatasample"` coin_has_sample=notGiven echo "$as_me:$LINENO: result: not given: $SAMPLE_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $SAMPLE_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Sample without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Sample without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Sample (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Sample (fallback)... $ECHO_C" >&6 coin_has_sample=notGiven SAMPLE_LIBS= SAMPLE_LIBS_INSTALLED= SAMPLE_CFLAGS= SAMPLE_CFLAGS_INSTALLED= SAMPLE_DATA= SAMPLE_DATA_INSTALLED= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= # initial list of dependencies is "coindatasample", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatasample" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$SAMPLE_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` SAMPLE_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$SAMPLE_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi SAMPLE_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$projcflags $SAMPLE_CFLAGS" # set LIBS variable SAMPLE_LIBS="$projlibs $SAMPLE_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS_INSTALLED="$projcflags $SAMPLE_CFLAGS_INSTALLED" # set LIBS variable SAMPLE_LIBS_INSTALLED="$projlibs $SAMPLE_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_sample=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` SAMPLE_LIBS_INSTALLED=`echo " $SAMPLE_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi SAMPLE_PCREQUIRES="coindatasample" fi if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_sample" >&5 echo "${ECHO_T}$coin_has_sample" >&6 fi if test $coin_has_sample != skipping && test $coin_has_sample != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) SAMPLE_DEPENDENCIES=`echo " $SAMPLE_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$SAMPLE_CFLAGS" ; then { echo "$as_me:$LINENO: Sample CFLAGS are $SAMPLE_CFLAGS" >&5 echo "$as_me: Sample CFLAGS are $SAMPLE_CFLAGS" >&6;} fi if test -n "$SAMPLE_LIBS" ; then { echo "$as_me:$LINENO: Sample LIBS are $SAMPLE_LIBS" >&5 echo "$as_me: Sample LIBS are $SAMPLE_LIBS" >&6;} fi if test -n "$SAMPLE_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&5 echo "$as_me: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&6;} fi if test -n "$SAMPLE_DATA" ; then { echo "$as_me:$LINENO: Sample DATA is $SAMPLE_DATA" >&5 echo "$as_me: Sample DATA is $SAMPLE_DATA" >&6;} fi if test -n "$SAMPLE_PCLIBS" ; then { echo "$as_me:$LINENO: Sample PCLIBS are $SAMPLE_PCLIBS" >&5 echo "$as_me: Sample PCLIBS are $SAMPLE_PCLIBS" >&6;} fi if test -n "$SAMPLE_PCREQUIRES" ; then { echo "$as_me:$LINENO: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&5 echo "$as_me: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Netlib" >&5 echo $ECHO_N "checking for COIN-OR package Netlib... $ECHO_C" >&6 coin_has_netlib=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Netlib"; then coin_has_netlib=skipping fi done fi if test "$coin_has_netlib" != skipping; then # Check whether --with-m4_tolower(Netlib) or --without-m4_tolower(Netlib) was given. if test "${with_netlib+set}" = set; then withval="$with_netlib" if test "$withval" = no ; then coin_has_netlib=skipping fi fi; fi NETLIB_LIBS= NETLIB_CFLAGS= NETLIB_DATA= NETLIB_DEPENDENCIES= NETLIB_PCLIBS= NETLIB_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-lib or --without-m4_tolower(Netlib)-lib was given. if test "${with_netlib_lib+set}" = set; then withval="$with_netlib_lib" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_LIBS="$withval" NETLIB_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-incdir or --without-m4_tolower(Netlib)-incdir was given. if test "${with_netlib_incdir+set}" = set; then withval="$with_netlib_incdir" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_CFLAGS_INSTALLED="$NETLIB_CFLAGS" fi fi fi; fi if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-datadir or --without-m4_tolower(Netlib)-datadir was given. if test "${with_netlib_datadir+set}" = set; then withval="$with_netlib_datadir" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_netlib = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatanetlib"; then NETLIB_VERSIONS=`$PKG_CONFIG --modversion "coindatanetlib" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatanetlib" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS="$cflags" NETLIB_LIBS=`$PKG_CONFIG --libs "coindatanetlib" 2>/dev/null` NETLIB_DATA=`$PKG_CONFIG --variable=datadir "coindatanetlib" 2>/dev/null` coin_has_netlib=yes echo "$as_me:$LINENO: result: yes: $NETLIB_VERSIONS" >&5 echo "${ECHO_T}yes: $NETLIB_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then NETLIB_LIBS=`echo " $NETLIB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi NETLIB_PCREQUIRES="coindatanetlib" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else NETLIB_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatanetlib"` coin_has_netlib=notGiven echo "$as_me:$LINENO: result: not given: $NETLIB_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $NETLIB_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Netlib without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Netlib without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Netlib (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Netlib (fallback)... $ECHO_C" >&6 coin_has_netlib=notGiven NETLIB_LIBS= NETLIB_LIBS_INSTALLED= NETLIB_CFLAGS= NETLIB_CFLAGS_INSTALLED= NETLIB_DATA= NETLIB_DATA_INSTALLED= NETLIB_PCLIBS= NETLIB_PCREQUIRES= # initial list of dependencies is "coindatanetlib", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatanetlib" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$NETLIB_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` NETLIB_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$NETLIB_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi NETLIB_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS="$projcflags $NETLIB_CFLAGS" # set LIBS variable NETLIB_LIBS="$projlibs $NETLIB_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS_INSTALLED="$projcflags $NETLIB_CFLAGS_INSTALLED" # set LIBS variable NETLIB_LIBS_INSTALLED="$projlibs $NETLIB_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_netlib=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NETLIB 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then NETLIB_LIBS=`echo " $NETLIB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` NETLIB_LIBS_INSTALLED=`echo " $NETLIB_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi NETLIB_PCREQUIRES="coindatanetlib" fi if test $coin_has_netlib != notGiven && test $coin_has_netlib != skipping; then COIN_HAS_NETLIB_TRUE= COIN_HAS_NETLIB_FALSE='#' else COIN_HAS_NETLIB_TRUE='#' COIN_HAS_NETLIB_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_netlib" >&5 echo "${ECHO_T}$coin_has_netlib" >&6 fi if test $coin_has_netlib != skipping && test $coin_has_netlib != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NETLIB 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) NETLIB_DEPENDENCIES=`echo " $NETLIB_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$NETLIB_CFLAGS" ; then { echo "$as_me:$LINENO: Netlib CFLAGS are $NETLIB_CFLAGS" >&5 echo "$as_me: Netlib CFLAGS are $NETLIB_CFLAGS" >&6;} fi if test -n "$NETLIB_LIBS" ; then { echo "$as_me:$LINENO: Netlib LIBS are $NETLIB_LIBS" >&5 echo "$as_me: Netlib LIBS are $NETLIB_LIBS" >&6;} fi if test -n "$NETLIB_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Netlib DEPENDENCIES are $NETLIB_DEPENDENCIES" >&5 echo "$as_me: Netlib DEPENDENCIES are $NETLIB_DEPENDENCIES" >&6;} fi if test -n "$NETLIB_DATA" ; then { echo "$as_me:$LINENO: Netlib DATA is $NETLIB_DATA" >&5 echo "$as_me: Netlib DATA is $NETLIB_DATA" >&6;} fi if test -n "$NETLIB_PCLIBS" ; then { echo "$as_me:$LINENO: Netlib PCLIBS are $NETLIB_PCLIBS" >&5 echo "$as_me: Netlib PCLIBS are $NETLIB_PCLIBS" >&6;} fi if test -n "$NETLIB_PCREQUIRES" ; then { echo "$as_me:$LINENO: Netlib PCREQUIRES are $NETLIB_PCREQUIRES" >&5 echo "$as_me: Netlib PCREQUIRES are $NETLIB_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_netlib != notGiven && test $coin_has_netlib != skipping; then COIN_HAS_NETLIB_TRUE= COIN_HAS_NETLIB_FALSE='#' else COIN_HAS_NETLIB_TRUE='#' COIN_HAS_NETLIB_FALSE= fi ############################################################################# # Third party solvers # ############################################################################# # Check which third party solvers are available. Cplex detection has been # tested on a semi-regular basis, and Mosek detection most likely works. For # the rest, it's anyone's guess. -- lh, 080529 -- # fixed detection of Mosek and Xpress -- stefan, 091003 (linux32, gcc) -- echo "$as_me:$LINENO: checking if user provides library for Cplex" >&5 echo $ECHO_N "checking if user provides library for Cplex... $ECHO_C" >&6 # Check for header file directory # Check whether --with-cplex-incdir or --without-cplex-incdir was given. if test "${with_cplex_incdir+set}" = set; then withval="$with_cplex_incdir" CPXINCDIR=`cd $withval; pwd` fi; # Check for library directory # Check whether --with-cplex-lib or --without-cplex-lib was given. if test "${with_cplex_lib+set}" = set; then withval="$with_cplex_lib" CPXLIB=$withval fi; # Switch to disable library check if requested # Check whether --enable-cplex-libcheck or --disable-cplex-libcheck was given. if test "${enable_cplex_libcheck+set}" = set; then enableval="$enable_cplex_libcheck" cplex_libcheck=$enableval else cplex_libcheck=yes fi; # At this point, if we're going to use the library, both LBRYINCDIR and # LBRYLIB must be defined and not empty. if test x"$CPXINCDIR" != x || test x"$CPXLIB" != x; then if test x"$CPXINCDIR" = x || test x"$CPXLIB" = x; then { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Cplex. Use --with-cplex-incdir of environment variable $CPXINCDIR to specify the include directory. Use --with-cplex-lib or environment variable $CPXLIB to specify link flags." >&5 echo "$as_me: error: You need to specify both an include directory and link flags to use library Cplex. Use --with-cplex-incdir of environment variable $CPXINCDIR to specify the include directory. Use --with-cplex-lib or environment variable $CPXLIB to specify link flags." >&2;} { (exit 1); exit 1; }; } fi coin_has_cpx=true echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else coin_has_cpx=false echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # If we have instructions for use, consider header and link checks. if test $coin_has_cpx = true; then # If argument 3 (file) is given, check for the file. Typically this will be a # header file, but that's not assumed. if test -r $CPXINCDIR/cplex.h; then : else { { echo "$as_me:$LINENO: error: Cannot find file cplex.h in $CPXINCDIR" >&5 echo "$as_me: error: Cannot find file cplex.h in $CPXINCDIR" >&2;} { (exit 1); exit 1; }; } : fi # Now see if we can link the function. There are arguments for and against # assuming argument 3 is a header file declaring the function. A correct # function declaration is the main argument in favour. Having to cope with # possible dependencies or other oddities are the main arguments against. # Force the use of C as the best single choice amongst C++, C, and Fortran. # Obviously, this has limits. if test x"$cplex_libcheck" != xno; then coin_save_LIBS="$LIBS" LIBS="$CPXLIB " coin_CPX_link=no ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for fnm in CPXgetstat ; do echo "$as_me:$LINENO: checking whether symbol $fnm is available with CPX" >&5 echo $ECHO_N "checking whether symbol $fnm is available with CPX... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $fnm() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 coin_CPX_link=yes break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$coin_save_LIBS" if test x"$coin_CPX_link" != xyes ; then { { echo "$as_me:$LINENO: error: Cannot find symbol(s) CPXgetstat with CPX" >&5 echo "$as_me: error: Cannot find symbol(s) CPXgetstat with CPX" >&2;} { (exit 1); exit 1; }; } fi fi # If we make it this far, we've verified the file and linked the function. Add # the necessary link flags to _{PC}LIBS and define the preprocessor symbol # COIN_HAS_LBRY. cat >>confdefs.h <<\_ACEOF #define COIN_HAS_CPX 1 _ACEOF fi # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the # automake conditional. These actions must occur unconditionally. if test $coin_has_cpx = true; then COIN_HAS_CPX_TRUE= COIN_HAS_CPX_FALSE='#' else COIN_HAS_CPX_TRUE='#' COIN_HAS_CPX_FALSE= fi echo "$as_me:$LINENO: checking if user provides library for Mosek" >&5 echo $ECHO_N "checking if user provides library for Mosek... $ECHO_C" >&6 # Check for header file directory # Check whether --with-mosek-incdir or --without-mosek-incdir was given. if test "${with_mosek_incdir+set}" = set; then withval="$with_mosek_incdir" MSKINCDIR=`cd $withval; pwd` fi; # Check for library directory # Check whether --with-mosek-lib or --without-mosek-lib was given. if test "${with_mosek_lib+set}" = set; then withval="$with_mosek_lib" MSKLIB=$withval fi; # Switch to disable library check if requested # Check whether --enable-mosek-libcheck or --disable-mosek-libcheck was given. if test "${enable_mosek_libcheck+set}" = set; then enableval="$enable_mosek_libcheck" mosek_libcheck=$enableval else mosek_libcheck=yes fi; # At this point, if we're going to use the library, both LBRYINCDIR and # LBRYLIB must be defined and not empty. if test x"$MSKINCDIR" != x || test x"$MSKLIB" != x; then if test x"$MSKINCDIR" = x || test x"$MSKLIB" = x; then { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Mosek. Use --with-mosek-incdir of environment variable $MSKINCDIR to specify the include directory. Use --with-mosek-lib or environment variable $MSKLIB to specify link flags." >&5 echo "$as_me: error: You need to specify both an include directory and link flags to use library Mosek. Use --with-mosek-incdir of environment variable $MSKINCDIR to specify the include directory. Use --with-mosek-lib or environment variable $MSKLIB to specify link flags." >&2;} { (exit 1); exit 1; }; } fi coin_has_msk=true echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else coin_has_msk=false echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # If we have instructions for use, consider header and link checks. if test $coin_has_msk = true; then # If argument 3 (file) is given, check for the file. Typically this will be a # header file, but that's not assumed. if test -r $MSKINCDIR/mosek.h; then : else { { echo "$as_me:$LINENO: error: Cannot find file mosek.h in $MSKINCDIR" >&5 echo "$as_me: error: Cannot find file mosek.h in $MSKINCDIR" >&2;} { (exit 1); exit 1; }; } : fi # Now see if we can link the function. There are arguments for and against # assuming argument 3 is a header file declaring the function. A correct # function declaration is the main argument in favour. Having to cope with # possible dependencies or other oddities are the main arguments against. # Force the use of C as the best single choice amongst C++, C, and Fortran. # Obviously, this has limits. if test x"$mosek_libcheck" != xno; then coin_save_LIBS="$LIBS" LIBS="$MSKLIB " coin_MSK_link=no ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for fnm in MSK_makeenv ; do echo "$as_me:$LINENO: checking whether symbol $fnm is available with MSK" >&5 echo $ECHO_N "checking whether symbol $fnm is available with MSK... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $fnm() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 coin_MSK_link=yes break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$coin_save_LIBS" if test x"$coin_MSK_link" != xyes ; then { { echo "$as_me:$LINENO: error: Cannot find symbol(s) MSK_makeenv with MSK" >&5 echo "$as_me: error: Cannot find symbol(s) MSK_makeenv with MSK" >&2;} { (exit 1); exit 1; }; } fi fi # If we make it this far, we've verified the file and linked the function. Add # the necessary link flags to _{PC}LIBS and define the preprocessor symbol # COIN_HAS_LBRY. cat >>confdefs.h <<\_ACEOF #define COIN_HAS_MSK 1 _ACEOF fi # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the # automake conditional. These actions must occur unconditionally. if test $coin_has_msk = true; then COIN_HAS_MSK_TRUE= COIN_HAS_MSK_FALSE='#' else COIN_HAS_MSK_TRUE='#' COIN_HAS_MSK_FALSE= fi echo "$as_me:$LINENO: checking if user provides library for Xpress" >&5 echo $ECHO_N "checking if user provides library for Xpress... $ECHO_C" >&6 # Check for header file directory # Check whether --with-xpress-incdir or --without-xpress-incdir was given. if test "${with_xpress_incdir+set}" = set; then withval="$with_xpress_incdir" XPRINCDIR=`cd $withval; pwd` fi; # Check for library directory # Check whether --with-xpress-lib or --without-xpress-lib was given. if test "${with_xpress_lib+set}" = set; then withval="$with_xpress_lib" XPRLIB=$withval fi; # Switch to disable library check if requested # Check whether --enable-xpress-libcheck or --disable-xpress-libcheck was given. if test "${enable_xpress_libcheck+set}" = set; then enableval="$enable_xpress_libcheck" xpress_libcheck=$enableval else xpress_libcheck=yes fi; # At this point, if we're going to use the library, both LBRYINCDIR and # LBRYLIB must be defined and not empty. if test x"$XPRINCDIR" != x || test x"$XPRLIB" != x; then if test x"$XPRINCDIR" = x || test x"$XPRLIB" = x; then { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Xpress. Use --with-xpress-incdir of environment variable $XPRINCDIR to specify the include directory. Use --with-xpress-lib or environment variable $XPRLIB to specify link flags." >&5 echo "$as_me: error: You need to specify both an include directory and link flags to use library Xpress. Use --with-xpress-incdir of environment variable $XPRINCDIR to specify the include directory. Use --with-xpress-lib or environment variable $XPRLIB to specify link flags." >&2;} { (exit 1); exit 1; }; } fi coin_has_xpr=true echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else coin_has_xpr=false echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # If we have instructions for use, consider header and link checks. if test $coin_has_xpr = true; then # If argument 3 (file) is given, check for the file. Typically this will be a # header file, but that's not assumed. if test -r $XPRINCDIR/xprs.h; then : else { { echo "$as_me:$LINENO: error: Cannot find file xprs.h in $XPRINCDIR" >&5 echo "$as_me: error: Cannot find file xprs.h in $XPRINCDIR" >&2;} { (exit 1); exit 1; }; } : fi # Now see if we can link the function. There are arguments for and against # assuming argument 3 is a header file declaring the function. A correct # function declaration is the main argument in favour. Having to cope with # possible dependencies or other oddities are the main arguments against. # Force the use of C as the best single choice amongst C++, C, and Fortran. # Obviously, this has limits. if test x"$xpress_libcheck" != xno; then coin_save_LIBS="$LIBS" LIBS="$XPRLIB " coin_XPR_link=no ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for fnm in XPRSinit ; do echo "$as_me:$LINENO: checking whether symbol $fnm is available with XPR" >&5 echo $ECHO_N "checking whether symbol $fnm is available with XPR... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $fnm() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 coin_XPR_link=yes break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$coin_save_LIBS" if test x"$coin_XPR_link" != xyes ; then { { echo "$as_me:$LINENO: error: Cannot find symbol(s) XPRSinit with XPR" >&5 echo "$as_me: error: Cannot find symbol(s) XPRSinit with XPR" >&2;} { (exit 1); exit 1; }; } fi fi # If we make it this far, we've verified the file and linked the function. Add # the necessary link flags to _{PC}LIBS and define the preprocessor symbol # COIN_HAS_LBRY. cat >>confdefs.h <<\_ACEOF #define COIN_HAS_XPR 1 _ACEOF fi # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the # automake conditional. These actions must occur unconditionally. if test $coin_has_xpr = true; then COIN_HAS_XPR_TRUE= COIN_HAS_XPR_FALSE='#' else COIN_HAS_XPR_TRUE='#' COIN_HAS_XPR_FALSE= fi echo "$as_me:$LINENO: checking if user provides library for Gurobi" >&5 echo $ECHO_N "checking if user provides library for Gurobi... $ECHO_C" >&6 # Check for header file directory # Check whether --with-gurobi-incdir or --without-gurobi-incdir was given. if test "${with_gurobi_incdir+set}" = set; then withval="$with_gurobi_incdir" GRBINCDIR=`cd $withval; pwd` fi; # Check for library directory # Check whether --with-gurobi-lib or --without-gurobi-lib was given. if test "${with_gurobi_lib+set}" = set; then withval="$with_gurobi_lib" GRBLIB=$withval fi; # Switch to disable library check if requested # Check whether --enable-gurobi-libcheck or --disable-gurobi-libcheck was given. if test "${enable_gurobi_libcheck+set}" = set; then enableval="$enable_gurobi_libcheck" gurobi_libcheck=$enableval else gurobi_libcheck=yes fi; # At this point, if we're going to use the library, both LBRYINCDIR and # LBRYLIB must be defined and not empty. if test x"$GRBINCDIR" != x || test x"$GRBLIB" != x; then if test x"$GRBINCDIR" = x || test x"$GRBLIB" = x; then { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Gurobi. Use --with-gurobi-incdir of environment variable $GRBINCDIR to specify the include directory. Use --with-gurobi-lib or environment variable $GRBLIB to specify link flags." >&5 echo "$as_me: error: You need to specify both an include directory and link flags to use library Gurobi. Use --with-gurobi-incdir of environment variable $GRBINCDIR to specify the include directory. Use --with-gurobi-lib or environment variable $GRBLIB to specify link flags." >&2;} { (exit 1); exit 1; }; } fi coin_has_grb=true echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else coin_has_grb=false echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # If we have instructions for use, consider header and link checks. if test $coin_has_grb = true; then # If argument 3 (file) is given, check for the file. Typically this will be a # header file, but that's not assumed. if test -r $GRBINCDIR/gurobi_c.h; then : else { { echo "$as_me:$LINENO: error: Cannot find file gurobi_c.h in $GRBINCDIR" >&5 echo "$as_me: error: Cannot find file gurobi_c.h in $GRBINCDIR" >&2;} { (exit 1); exit 1; }; } : fi # Now see if we can link the function. There are arguments for and against # assuming argument 3 is a header file declaring the function. A correct # function declaration is the main argument in favour. Having to cope with # possible dependencies or other oddities are the main arguments against. # Force the use of C as the best single choice amongst C++, C, and Fortran. # Obviously, this has limits. if test x"$gurobi_libcheck" != xno; then coin_save_LIBS="$LIBS" LIBS="$GRBLIB " coin_GRB_link=no ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for fnm in GRBloadenv ; do echo "$as_me:$LINENO: checking whether symbol $fnm is available with GRB" >&5 echo $ECHO_N "checking whether symbol $fnm is available with GRB... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $fnm() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 coin_GRB_link=yes break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$coin_save_LIBS" if test x"$coin_GRB_link" != xyes ; then { { echo "$as_me:$LINENO: error: Cannot find symbol(s) GRBloadenv with GRB" >&5 echo "$as_me: error: Cannot find symbol(s) GRBloadenv with GRB" >&2;} { (exit 1); exit 1; }; } fi fi # If we make it this far, we've verified the file and linked the function. Add # the necessary link flags to _{PC}LIBS and define the preprocessor symbol # COIN_HAS_LBRY. cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GRB 1 _ACEOF fi # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the # automake conditional. These actions must occur unconditionally. if test $coin_has_grb = true; then COIN_HAS_GRB_TRUE= COIN_HAS_GRB_FALSE='#' else COIN_HAS_GRB_TRUE='#' COIN_HAS_GRB_FALSE= fi ############################################################################# # Examples solver # ############################################################################# # choose a solver interface that can be used in the examples if test $coin_has_glpk = yes ; then OSI_EXAMPLES_SOLVER_NAME=OsiGlpkSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="$GLPK_CFLAGS" OSI_EXAMPLES_SOLVER_LIBS="-lOsiGlpk $GLPK_LIBS_INSTALLED" OSI_EXAMPLES_SOLVER_PCNAME=osi-glpk elif test $coin_has_cpx = true ; then OSI_EXAMPLES_SOLVER_NAME=OsiCpxSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="-I$CPXINCDIR" OSI_EXAMPLES_SOLVER_LIBS="-lOsiCpx $CPXLIB" OSI_EXAMPLES_SOLVER_PCNAME=osi-cplex elif test $coin_has_grb = true ; then OSI_EXAMPLES_SOLVER_NAME=OsiGrbSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="-I$GRBINCDIR" OSI_EXAMPLES_SOLVER_LIBS="-lOsiGrb $GRBLIB" OSI_EXAMPLES_SOLVER_PCNAME=osi-gurobi elif test $coin_has_msk = true ; then OSI_EXAMPLES_SOLVER_NAME=OsiMskSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="-I$MSKINCDIR" OSI_EXAMPLES_SOLVER_LIBS="-lOsiMsk $MSKLIB" OSI_EXAMPLES_SOLVER_PCNAME=osi-mosek elif test $coin_has_xpr = true ; then OSI_EXAMPLES_SOLVER_NAME=OsiXprSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="-I$XPRINCDIR" OSI_EXAMPLES_SOLVER_LIBS="-lOsiXpr $XPRLIB" OSI_EXAMPLES_SOLVER_PCNAME=osi-xpress elif test $coin_has_soplex = yes ; then OSI_EXAMPLES_SOLVER_NAME=OsiSpxSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="$SOPLEX_CFLAGS" OSI_EXAMPLES_SOLVER_LIBS="-lOsiSpx $SOPLEX_LIBS_INSTALLED" OSI_EXAMPLES_SOLVER_PCNAME=osi-soplex else { echo "$as_me:$LINENO: WARNING: No solver available, examples will not work." >&5 echo "$as_me: WARNING: No solver available, examples will not work." >&2;} fi # adjust linker flags for (i)cl compiler if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSI_EXAMPLES_SOLVER_LIBS=`echo " $OSI_EXAMPLES_SOLVER_LIBS" | sed -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi ############################################################################# # Configuration options for individual OSIs # ############################################################################# # If any of the tests performed in this section actually require the presence # of the solver (file presence, link checks, etc.) be sure to guard the call. # We assume that GLPK is not too old cat >>confdefs.h <<\_ACEOF #define GLPK_HAS_INTOPT 1 _ACEOF ############################################################################# # Check for doxygen # ############################################################################# { echo "$as_me:$LINENO: configuring doxygen documentation options" >&5 echo "$as_me: configuring doxygen documentation options" >&6;} # Check to see if doxygen is available. # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_doxygen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_doxygen"; then ac_cv_prog_coin_have_doxygen="$coin_have_doxygen" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_doxygen="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_doxygen" && ac_cv_prog_coin_have_doxygen="no" fi fi coin_have_doxygen=$ac_cv_prog_coin_have_doxygen if test -n "$coin_have_doxygen"; then echo "$as_me:$LINENO: result: $coin_have_doxygen" >&5 echo "${ECHO_T}$coin_have_doxygen" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_latex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_latex"; then ac_cv_prog_coin_have_latex="$coin_have_latex" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_latex="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_latex" && ac_cv_prog_coin_have_latex="no" fi fi coin_have_latex=$ac_cv_prog_coin_have_latex if test -n "$coin_have_latex"; then echo "$as_me:$LINENO: result: $coin_have_latex" >&5 echo "${ECHO_T}$coin_have_latex" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Look for the dot tool from the graphviz package, unless the user has # disabled it. # Check whether --with-dot or --without-dot was given. if test "${with_dot+set}" = set; then withval="$with_dot" else withval=yes fi; if test x"$withval" = xno ; then coin_doxy_usedot=NO echo "$as_me:$LINENO: checking for dot " >&5 echo $ECHO_N "checking for dot ... $ECHO_C" >&6 echo "$as_me:$LINENO: result: disabled" >&5 echo "${ECHO_T}disabled" >&6 else # Extract the first word of "dot", so it can be a program name with args. set dummy dot; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_doxy_usedot+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_doxy_usedot"; then ac_cv_prog_coin_doxy_usedot="$coin_doxy_usedot" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_doxy_usedot="YES" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_doxy_usedot" && ac_cv_prog_coin_doxy_usedot="NO" fi fi coin_doxy_usedot=$ac_cv_prog_coin_doxy_usedot if test -n "$coin_doxy_usedot"; then echo "$as_me:$LINENO: result: $coin_doxy_usedot" >&5 echo "${ECHO_T}$coin_doxy_usedot" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi # Generate a tag file name and a log file name coin_doxy_tagname=doxydoc/${PACKAGE}_doxy.tag coin_doxy_logname=doxydoc/${PACKAGE}_doxy.log if test $coin_have_doxygen = yes; then COIN_HAS_DOXYGEN_TRUE= COIN_HAS_DOXYGEN_FALSE='#' else COIN_HAS_DOXYGEN_TRUE='#' COIN_HAS_DOXYGEN_FALSE= fi if test $coin_have_latex = yes; then COIN_HAS_LATEX_TRUE= COIN_HAS_LATEX_FALSE='#' else COIN_HAS_LATEX_TRUE='#' COIN_HAS_LATEX_FALSE= fi # Process the list of project names and massage them into possible doxygen # doc'n directories. Prefer 1) classic external, source processed using # a project-specific doxygen.conf, we use the tag file; 2) classic # external, source processed using package doxygen.conf; 3) installed # doxydoc. Alternatives 1) and 2) are only possible if the directory will be # configured, which we can't know unless this is the package base configure, # since coin_subdirs is only set there. Hence it's sufficient to check for # membership. If we use a tag file from a classic external, exclude the # source from doxygen processing when doxygen runs in the base directory. coin_doxy_tagfiles= coin_doxy_excludes= tmp="CoinUtils" for proj in $tmp ; do lc_proj=`echo $proj | tr [A-Z] [a-z]` echo "$as_me:$LINENO: checking for doxygen doc'n for $proj " >&5 echo $ECHO_N "checking for doxygen doc'n for $proj ... $ECHO_C" >&6 doxytag=${lc_proj}_doxy.tag doxyfound=no # proj will be configured, hence doxydoc present in build tree doxysrcdir="${srcdir}/../${proj}" # AC_MSG_NOTICE([Considering $doxysrcdir (base)]) if test -d "$doxysrcdir" ; then # with a doxydoc directory? doxydir="$doxysrcdir/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (base)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) if test -d "$doxydir" ; then # use tag file; don't process source doxydir="../${proj}/doxydoc" coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=../../$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 coin_doxy_excludes="$coin_doxy_excludes */${proj}" else # will process the source -- nothing further to be done here echo "$as_me:$LINENO: result: $doxysrcdir (src)" >&5 echo "${ECHO_T}$doxysrcdir (src)" >&6 fi doxyfound=yes fi # Not built, fall back to installed tag file if test $doxyfound = no ; then eval doxydir="${datadir}/coin/doc/${proj}/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (install)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 fi done ############################################################################# # System header # ############################################################################# ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cmath],[],[],[$hdr]) for ac_header in cmath do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to osi@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cmath" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([math.h],[],[],[$hdr]) for ac_header in math.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to osi@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cfloat],[],[],[$hdr]) for ac_header in cfloat do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to osi@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cfloat" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([float.h],[],[],[$hdr]) for ac_header in float.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to osi@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cieeefp],[],[],[$hdr]) for ac_header in cieeefp do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to osi@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cieeefp" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([ieeefp.h],[],[],[$hdr]) for ac_header in ieeefp.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to osi@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) ac_config_files="$ac_config_files Makefile examples/Makefile src/Osi/Makefile src/OsiCpx/Makefile src/OsiGlpk/Makefile src/OsiMsk/Makefile src/OsiXpr/Makefile src/OsiGrb/Makefile src/OsiSpx/Makefile src/OsiCommonTest/Makefile test/Makefile osi.pc osi-uninstalled.pc osi-unittests.pc osi-unittests-uninstalled.pc" if test $coin_has_cpx = true ; then ac_config_files="$ac_config_files osi-cplex.pc:src/OsiCpx/osi-cplex.pc.in osi-cplex-uninstalled.pc:src/OsiCpx/osi-cplex-uninstalled.pc.in" fi if test $coin_has_glpk = yes ; then ac_config_files="$ac_config_files osi-glpk.pc:src/OsiGlpk/osi-glpk.pc.in osi-glpk-uninstalled.pc:src/OsiGlpk/osi-glpk-uninstalled.pc.in" fi if test $coin_has_grb = true ; then ac_config_files="$ac_config_files osi-gurobi.pc:src/OsiGrb/osi-gurobi.pc.in osi-gurobi-uninstalled.pc:src/OsiGrb/osi-gurobi-uninstalled.pc.in" fi if test $coin_has_msk = true ; then ac_config_files="$ac_config_files osi-mosek.pc:src/OsiMsk/osi-mosek.pc.in osi-mosek-uninstalled.pc:src/OsiMsk/osi-mosek-uninstalled.pc.in" fi if test $coin_has_xpr = true ; then ac_config_files="$ac_config_files osi-xpress.pc:src/OsiXpr/osi-xpress.pc.in osi-xpress-uninstalled.pc:src/OsiXpr/osi-xpress-uninstalled.pc.in" fi if test $coin_has_soplex = yes ; then ac_config_files="$ac_config_files osi-soplex.pc:src/OsiSpx/osi-soplex.pc.in osi-soplex-uninstalled.pc:src/OsiSpx/osi-soplex-uninstalled.pc.in" fi ac_config_files="$ac_config_files doxydoc/doxygen.conf" # Here put the location and name of the configuration header file ac_config_headers="$ac_config_headers src/Osi/config.h src/Osi/config_osi.h" # Finally, we let configure write all the output... echo "$as_me:$LINENO: checking which command should be used to link input files" >&5 echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac echo "$as_me:$LINENO: result: $coin_link_input_cmd" >&5 echo "${ECHO_T}$coin_link_input_cmd" >&6 if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${ALWAYS_FALSE_TRUE}" && test -z "${ALWAYS_FALSE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CC_IS_CL_TRUE}" && test -z "${COIN_CC_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CXX_IS_CL_TRUE}" && test -z "${COIN_CXX_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_EXTERNALS_TRUE}" && test -z "${HAVE_EXTERNALS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${DEPENDENCY_LINKING_TRUE}" && test -z "${DEPENDENCY_LINKING_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_PKGCONFIG_TRUE}" && test -z "${COIN_HAS_PKGCONFIG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_COINUTILS_TRUE}" && test -z "${COIN_HAS_COINUTILS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_COINUTILS_TRUE}" && test -z "${COIN_HAS_COINUTILS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SOPLEX_TRUE}" && test -z "${COIN_HAS_SOPLEX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SOPLEX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SOPLEX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SOPLEX_TRUE}" && test -z "${COIN_HAS_SOPLEX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SOPLEX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SOPLEX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NETLIB_TRUE}" && test -z "${COIN_HAS_NETLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NETLIB_TRUE}" && test -z "${COIN_HAS_NETLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_CPX_TRUE}" && test -z "${COIN_HAS_CPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_CPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_CPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_MSK_TRUE}" && test -z "${COIN_HAS_MSK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_MSK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_MSK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_XPR_TRUE}" && test -z "${COIN_HAS_XPR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_XPR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_XPR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GRB_TRUE}" && test -z "${COIN_HAS_GRB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GRB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GRB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_DOXYGEN_TRUE}" && test -z "${COIN_HAS_DOXYGEN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LATEX_TRUE}" && test -z "${COIN_HAS_LATEX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by Osi $as_me 0.107.6, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Osi config.status 0.107.6 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "src/Osi/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Osi/Makefile" ;; "src/OsiCpx/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiCpx/Makefile" ;; "src/OsiGlpk/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiGlpk/Makefile" ;; "src/OsiMsk/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiMsk/Makefile" ;; "src/OsiXpr/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiXpr/Makefile" ;; "src/OsiGrb/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiGrb/Makefile" ;; "src/OsiSpx/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiSpx/Makefile" ;; "src/OsiCommonTest/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiCommonTest/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "osi.pc" ) CONFIG_FILES="$CONFIG_FILES osi.pc" ;; "osi-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-uninstalled.pc" ;; "osi-unittests.pc" ) CONFIG_FILES="$CONFIG_FILES osi-unittests.pc" ;; "osi-unittests-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-unittests-uninstalled.pc" ;; "osi-cplex.pc" ) CONFIG_FILES="$CONFIG_FILES osi-cplex.pc:src/OsiCpx/osi-cplex.pc.in" ;; "osi-cplex-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-cplex-uninstalled.pc:src/OsiCpx/osi-cplex-uninstalled.pc.in" ;; "osi-glpk.pc" ) CONFIG_FILES="$CONFIG_FILES osi-glpk.pc:src/OsiGlpk/osi-glpk.pc.in" ;; "osi-glpk-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-glpk-uninstalled.pc:src/OsiGlpk/osi-glpk-uninstalled.pc.in" ;; "osi-gurobi.pc" ) CONFIG_FILES="$CONFIG_FILES osi-gurobi.pc:src/OsiGrb/osi-gurobi.pc.in" ;; "osi-gurobi-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-gurobi-uninstalled.pc:src/OsiGrb/osi-gurobi-uninstalled.pc.in" ;; "osi-mosek.pc" ) CONFIG_FILES="$CONFIG_FILES osi-mosek.pc:src/OsiMsk/osi-mosek.pc.in" ;; "osi-mosek-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-mosek-uninstalled.pc:src/OsiMsk/osi-mosek-uninstalled.pc.in" ;; "osi-xpress.pc" ) CONFIG_FILES="$CONFIG_FILES osi-xpress.pc:src/OsiXpr/osi-xpress.pc.in" ;; "osi-xpress-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-xpress-uninstalled.pc:src/OsiXpr/osi-xpress-uninstalled.pc.in" ;; "osi-soplex.pc" ) CONFIG_FILES="$CONFIG_FILES osi-soplex.pc:src/OsiSpx/osi-soplex.pc.in" ;; "osi-soplex-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-soplex-uninstalled.pc:src/OsiSpx/osi-soplex-uninstalled.pc.in" ;; "doxydoc/doxygen.conf" ) CONFIG_FILES="$CONFIG_FILES doxydoc/doxygen.conf" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "src/Osi/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/Osi/config.h" ;; "src/Osi/config_osi.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/Osi/config_osi.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@ALWAYS_FALSE_TRUE@,$ALWAYS_FALSE_TRUE,;t t s,@ALWAYS_FALSE_FALSE@,$ALWAYS_FALSE_FALSE,;t t s,@have_svnversion@,$have_svnversion,;t t s,@OSI_SVN_REV@,$OSI_SVN_REV,;t t s,@CDEFS@,$CDEFS,;t t s,@ADD_CFLAGS@,$ADD_CFLAGS,;t t s,@DBG_CFLAGS@,$DBG_CFLAGS,;t t s,@OPT_CFLAGS@,$OPT_CFLAGS,;t t s,@sol_cc_compiler@,$sol_cc_compiler,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@COIN_CC_IS_CL_TRUE@,$COIN_CC_IS_CL_TRUE,;t t s,@COIN_CC_IS_CL_FALSE@,$COIN_CC_IS_CL_FALSE,;t t s,@MPICC@,$MPICC,;t t s,@CXXDEFS@,$CXXDEFS,;t t s,@ADD_CXXFLAGS@,$ADD_CXXFLAGS,;t t s,@DBG_CXXFLAGS@,$DBG_CXXFLAGS,;t t s,@OPT_CXXFLAGS@,$OPT_CXXFLAGS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@COIN_CXX_IS_CL_TRUE@,$COIN_CXX_IS_CL_TRUE,;t t s,@COIN_CXX_IS_CL_FALSE@,$COIN_CXX_IS_CL_FALSE,;t t s,@MPICXX@,$MPICXX,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBTOOLM4@,$LIBTOOLM4,;t t s,@have_autoconf@,$have_autoconf,;t t s,@have_automake@,$have_automake,;t t s,@have_svn@,$have_svn,;t t s,@BUILDTOOLSDIR@,$BUILDTOOLSDIR,;t t s,@AUX_DIR@,$AUX_DIR,;t t s,@abs_source_dir@,$abs_source_dir,;t t s,@abs_lib_dir@,$abs_lib_dir,;t t s,@abs_include_dir@,$abs_include_dir,;t t s,@abs_bin_dir@,$abs_bin_dir,;t t s,@HAVE_EXTERNALS_TRUE@,$HAVE_EXTERNALS_TRUE,;t t s,@HAVE_EXTERNALS_FALSE@,$HAVE_EXTERNALS_FALSE,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@CXXCPP@,$CXXCPP,;t t s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@ac_c_preproc_warn_flag@,$ac_c_preproc_warn_flag,;t t s,@ac_cxx_preproc_warn_flag@,$ac_cxx_preproc_warn_flag,;t t s,@RPATH_FLAGS@,$RPATH_FLAGS,;t t s,@DEPENDENCY_LINKING_TRUE@,$DEPENDENCY_LINKING_TRUE,;t t s,@DEPENDENCY_LINKING_FALSE@,$DEPENDENCY_LINKING_FALSE,;t t s,@LT_LDFLAGS@,$LT_LDFLAGS,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@ac_ct_PKG_CONFIG@,$ac_ct_PKG_CONFIG,;t t s,@COIN_HAS_PKGCONFIG_TRUE@,$COIN_HAS_PKGCONFIG_TRUE,;t t s,@COIN_HAS_PKGCONFIG_FALSE@,$COIN_HAS_PKGCONFIG_FALSE,;t t s,@COIN_PKG_CONFIG_PATH@,$COIN_PKG_CONFIG_PATH,;t t s,@COIN_PKG_CONFIG_PATH_UNINSTALLED@,$COIN_PKG_CONFIG_PATH_UNINSTALLED,;t t s,@COINUTILS_LIBS@,$COINUTILS_LIBS,;t t s,@COINUTILS_CFLAGS@,$COINUTILS_CFLAGS,;t t s,@COINUTILS_DATA@,$COINUTILS_DATA,;t t s,@COINUTILS_DEPENDENCIES@,$COINUTILS_DEPENDENCIES,;t t s,@COINUTILS_LIBS_INSTALLED@,$COINUTILS_LIBS_INSTALLED,;t t s,@COINUTILS_CFLAGS_INSTALLED@,$COINUTILS_CFLAGS_INSTALLED,;t t s,@COINUTILS_DATA_INSTALLED@,$COINUTILS_DATA_INSTALLED,;t t s,@OSILIB_CFLAGS@,$OSILIB_CFLAGS,;t t s,@OSILIB_LIBS@,$OSILIB_LIBS,;t t s,@OSILIB_PCLIBS@,$OSILIB_PCLIBS,;t t s,@OSILIB_PCREQUIRES@,$OSILIB_PCREQUIRES,;t t s,@OSILIB_DEPENDENCIES@,$OSILIB_DEPENDENCIES,;t t s,@OSILIB_CFLAGS_INSTALLED@,$OSILIB_CFLAGS_INSTALLED,;t t s,@OSILIB_LIBS_INSTALLED@,$OSILIB_LIBS_INSTALLED,;t t s,@COIN_HAS_COINUTILS_TRUE@,$COIN_HAS_COINUTILS_TRUE,;t t s,@COIN_HAS_COINUTILS_FALSE@,$COIN_HAS_COINUTILS_FALSE,;t t s,@GLPK_LIBS@,$GLPK_LIBS,;t t s,@GLPK_CFLAGS@,$GLPK_CFLAGS,;t t s,@GLPK_DATA@,$GLPK_DATA,;t t s,@GLPK_DEPENDENCIES@,$GLPK_DEPENDENCIES,;t t s,@GLPK_LIBS_INSTALLED@,$GLPK_LIBS_INSTALLED,;t t s,@GLPK_CFLAGS_INSTALLED@,$GLPK_CFLAGS_INSTALLED,;t t s,@GLPK_DATA_INSTALLED@,$GLPK_DATA_INSTALLED,;t t s,@OSIGLPKLIB_CFLAGS@,$OSIGLPKLIB_CFLAGS,;t t s,@OSIGLPKLIB_LIBS@,$OSIGLPKLIB_LIBS,;t t s,@OSIGLPKLIB_PCLIBS@,$OSIGLPKLIB_PCLIBS,;t t s,@OSIGLPKLIB_PCREQUIRES@,$OSIGLPKLIB_PCREQUIRES,;t t s,@OSIGLPKLIB_DEPENDENCIES@,$OSIGLPKLIB_DEPENDENCIES,;t t s,@OSIGLPKLIB_CFLAGS_INSTALLED@,$OSIGLPKLIB_CFLAGS_INSTALLED,;t t s,@OSIGLPKLIB_LIBS_INSTALLED@,$OSIGLPKLIB_LIBS_INSTALLED,;t t s,@COIN_HAS_GLPK_TRUE@,$COIN_HAS_GLPK_TRUE,;t t s,@COIN_HAS_GLPK_FALSE@,$COIN_HAS_GLPK_FALSE,;t t s,@SOPLEX_LIBS@,$SOPLEX_LIBS,;t t s,@SOPLEX_CFLAGS@,$SOPLEX_CFLAGS,;t t s,@SOPLEX_DATA@,$SOPLEX_DATA,;t t s,@SOPLEX_DEPENDENCIES@,$SOPLEX_DEPENDENCIES,;t t s,@SOPLEX_LIBS_INSTALLED@,$SOPLEX_LIBS_INSTALLED,;t t s,@SOPLEX_CFLAGS_INSTALLED@,$SOPLEX_CFLAGS_INSTALLED,;t t s,@SOPLEX_DATA_INSTALLED@,$SOPLEX_DATA_INSTALLED,;t t s,@OSISPXLIB_CFLAGS@,$OSISPXLIB_CFLAGS,;t t s,@OSISPXLIB_LIBS@,$OSISPXLIB_LIBS,;t t s,@OSISPXLIB_PCLIBS@,$OSISPXLIB_PCLIBS,;t t s,@OSISPXLIB_PCREQUIRES@,$OSISPXLIB_PCREQUIRES,;t t s,@OSISPXLIB_DEPENDENCIES@,$OSISPXLIB_DEPENDENCIES,;t t s,@OSISPXLIB_CFLAGS_INSTALLED@,$OSISPXLIB_CFLAGS_INSTALLED,;t t s,@OSISPXLIB_LIBS_INSTALLED@,$OSISPXLIB_LIBS_INSTALLED,;t t s,@COIN_HAS_SOPLEX_TRUE@,$COIN_HAS_SOPLEX_TRUE,;t t s,@COIN_HAS_SOPLEX_FALSE@,$COIN_HAS_SOPLEX_FALSE,;t t s,@SAMPLE_LIBS@,$SAMPLE_LIBS,;t t s,@SAMPLE_CFLAGS@,$SAMPLE_CFLAGS,;t t s,@SAMPLE_DATA@,$SAMPLE_DATA,;t t s,@SAMPLE_DEPENDENCIES@,$SAMPLE_DEPENDENCIES,;t t s,@SAMPLE_LIBS_INSTALLED@,$SAMPLE_LIBS_INSTALLED,;t t s,@SAMPLE_CFLAGS_INSTALLED@,$SAMPLE_CFLAGS_INSTALLED,;t t s,@SAMPLE_DATA_INSTALLED@,$SAMPLE_DATA_INSTALLED,;t t s,@COIN_HAS_SAMPLE_TRUE@,$COIN_HAS_SAMPLE_TRUE,;t t s,@COIN_HAS_SAMPLE_FALSE@,$COIN_HAS_SAMPLE_FALSE,;t t s,@NETLIB_LIBS@,$NETLIB_LIBS,;t t s,@NETLIB_CFLAGS@,$NETLIB_CFLAGS,;t t s,@NETLIB_DATA@,$NETLIB_DATA,;t t s,@NETLIB_DEPENDENCIES@,$NETLIB_DEPENDENCIES,;t t s,@NETLIB_LIBS_INSTALLED@,$NETLIB_LIBS_INSTALLED,;t t s,@NETLIB_CFLAGS_INSTALLED@,$NETLIB_CFLAGS_INSTALLED,;t t s,@NETLIB_DATA_INSTALLED@,$NETLIB_DATA_INSTALLED,;t t s,@COIN_HAS_NETLIB_TRUE@,$COIN_HAS_NETLIB_TRUE,;t t s,@COIN_HAS_NETLIB_FALSE@,$COIN_HAS_NETLIB_FALSE,;t t s,@CPXINCDIR@,$CPXINCDIR,;t t s,@CPXLIB@,$CPXLIB,;t t s,@COIN_HAS_CPX_TRUE@,$COIN_HAS_CPX_TRUE,;t t s,@COIN_HAS_CPX_FALSE@,$COIN_HAS_CPX_FALSE,;t t s,@MSKINCDIR@,$MSKINCDIR,;t t s,@MSKLIB@,$MSKLIB,;t t s,@COIN_HAS_MSK_TRUE@,$COIN_HAS_MSK_TRUE,;t t s,@COIN_HAS_MSK_FALSE@,$COIN_HAS_MSK_FALSE,;t t s,@XPRINCDIR@,$XPRINCDIR,;t t s,@XPRLIB@,$XPRLIB,;t t s,@COIN_HAS_XPR_TRUE@,$COIN_HAS_XPR_TRUE,;t t s,@COIN_HAS_XPR_FALSE@,$COIN_HAS_XPR_FALSE,;t t s,@GRBINCDIR@,$GRBINCDIR,;t t s,@GRBLIB@,$GRBLIB,;t t s,@COIN_HAS_GRB_TRUE@,$COIN_HAS_GRB_TRUE,;t t s,@COIN_HAS_GRB_FALSE@,$COIN_HAS_GRB_FALSE,;t t s,@OSI_EXAMPLES_SOLVER_NAME@,$OSI_EXAMPLES_SOLVER_NAME,;t t s,@OSI_EXAMPLES_SOLVER_CFLAGS@,$OSI_EXAMPLES_SOLVER_CFLAGS,;t t s,@OSI_EXAMPLES_SOLVER_LIBS@,$OSI_EXAMPLES_SOLVER_LIBS,;t t s,@OSI_EXAMPLES_SOLVER_PCNAME@,$OSI_EXAMPLES_SOLVER_PCNAME,;t t s,@coin_have_doxygen@,$coin_have_doxygen,;t t s,@coin_have_latex@,$coin_have_latex,;t t s,@coin_doxy_usedot@,$coin_doxy_usedot,;t t s,@coin_doxy_tagname@,$coin_doxy_tagname,;t t s,@coin_doxy_logname@,$coin_doxy_logname,;t t s,@COIN_HAS_DOXYGEN_TRUE@,$COIN_HAS_DOXYGEN_TRUE,;t t s,@COIN_HAS_DOXYGEN_FALSE@,$COIN_HAS_DOXYGEN_FALSE,;t t s,@COIN_HAS_LATEX_TRUE@,$COIN_HAS_LATEX_TRUE,;t t s,@COIN_HAS_LATEX_FALSE@,$COIN_HAS_LATEX_FALSE,;t t s,@coin_doxy_tagfiles@,$coin_doxy_tagfiles,;t t s,@coin_doxy_excludes@,$coin_doxy_excludes,;t t s,@LIBEXT@,$LIBEXT,;t t s,@VPATH_DISTCLEANFILES@,$VPATH_DISTCLEANFILES,;t t s,@ABSBUILDDIR@,$ABSBUILDDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then { echo "$as_me:$LINENO: Copying data files for VPATH configuration" >&5 echo "$as_me: Copying data files for VPATH configuration" >&6;} else { echo "$as_me:$LINENO: Creating VPATH links for data files" >&5 echo "$as_me: Creating VPATH links for data files" >&6;} fi for file in $coin_vpath_link_files; do dir=`(dirname "./$file") 2>/dev/null || $as_expr X"./$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"./$file" : 'X\(//\)[^/]' \| \ X"./$file" : 'X\(//\)$' \| \ X"./$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"./$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test -d $dir; then : ; else { if $as_mkdir_p; then mkdir -p $dir else as_dir=$dir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dir" >&5 echo "$as_me: error: cannot create directory $dir" >&2;} { (exit 1); exit 1; }; }; } fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi { echo "$as_me:$LINENO: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&5 echo "$as_me: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&6;} if test x$coin_projectdir = xyes; then { echo "$as_me:$LINENO: Configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} else { echo "$as_me:$LINENO: Main configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Main configuration of $PACKAGE_NAME successful" >&6;} fi else { echo "$as_me:$LINENO: No configuration of $PACKAGE_NAME necessary" >&5 echo "$as_me: No configuration of $PACKAGE_NAME necessary" >&6;} fi CoinMP-1.8.3/Osi/ltmain.sh0000755000175000017500000057753011405216166013714 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/Osi/config.guess0000755000175000017500000012706311405216166014401 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Osi/osi-unittests-uninstalled.pc.in0000644000175000017500000000045111507670402020153 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/OsiCommonTest Name: OsiUnitTests Description: COIN-OR Open Solver Interface Common Unit Tests URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsiCommonTests.la Cflags: -I@abs_source_dir@/src/OsiCommonTest Requires: osi CoinMP-1.8.3/Osi/test/0000755000175000017500000000000012600453455013031 5ustar renereneCoinMP-1.8.3/Osi/test/OsiMskSolverInterfaceTest.cpp0000644000175000017500000007302311612351731020617 0ustar renerene/* Unit test for OsiMsk. This file is licensed under the terms of Eclipse Public License (EPL). */ #include "CoinPragma.hpp" #include "OsiConfig.h" //#include //#include #include "OsiUnitTests.hpp" #include "OsiMskSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" // Added so build windows build with dsp files works, // when not building with gurobi. #ifdef COIN_HAS_MSK #include "mosek.h" //-------------------------------------------------------------------------- void OsiMskSolverInterfaceUnitTest( const std::string & mpsDir, const std::string & netlibDir ) { unsigned int numInstancesStart = OsiMskSolverInterface::getNumInstances(); // Test default constructor { OsiMskSolverInterface m; OSIUNITTEST_ASSERT_ERROR(m.obj_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.collower_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colupper_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.coltype_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.coltypesize_ == 0, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsense_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rhs_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowrange_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowlower_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowupper_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colsol_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsol_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByCol_ == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getNumCols() == 0, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getApplicationData() == NULL, {}, "mosek", "default constructor"); OSIUNITTEST_ASSERT_ERROR(OsiMskSolverInterface::getNumInstances() == numInstancesStart+1, {}, "mosek", "number of instances during first test"); int i=2346; m.setApplicationData(&i); OSIUNITTEST_ASSERT_ERROR(*((int *)(m.getApplicationData())) == i, {}, "mosek", "default constructor"); } OSIUNITTEST_ASSERT_ERROR(OsiMskSolverInterface::getNumInstances() == numInstancesStart, {}, "mosek", "number of instances after first test"); { CoinRelFltEq eq; OsiMskSolverInterface m; OSIUNITTEST_ASSERT_ERROR(OsiMskSolverInterface::getNumInstances() == numInstancesStart+1, {}, "mosek", "number of instances"); std::string fn = mpsDir+"exmip1"; m.readMps(fn.c_str(),"mps"); { OSIUNITTEST_ASSERT_ERROR(m.getNumCols() == 8, {}, "mosek", "exmip1 read"); const CoinPackedMatrix * colCopy = m.getMatrixByCol(); OSIUNITTEST_ASSERT_ERROR(colCopy->getNumCols() == 8, {}, "mosek", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getMajorDim() == 8, {}, "mosek", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getNumRows() == 5, {}, "mosek", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getMinorDim() == 5, {}, "mosek", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getVectorLengths()[7] == 2, {}, "mosek", "exmip1 matrix"); CoinPackedMatrix revColCopy; revColCopy.reverseOrderedCopyOf(*colCopy); CoinPackedMatrix rev2ColCopy; rev2ColCopy.reverseOrderedCopyOf(revColCopy); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getNumCols() == 8, {}, "mosek", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getMajorDim() == 8, {}, "mosek", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getNumRows() == 5, {}, "mosek", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getMinorDim() == 5, {}, "mosek", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getVectorLengths()[7] == 2, {}, "mosek", "twice reverse matrix copy"); } // Test copy constructor and assignment operator { OsiMskSolverInterface lhs; { OsiMskSolverInterface im(m); OsiMskSolverInterface imC1(im); OSIUNITTEST_ASSERT_ERROR(imC1.getNumCols() == im.getNumCols(), {}, "mosek", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumRows() == im.getNumRows(), {}, "mosek", "copy constructor"); OsiMskSolverInterface imC2(im); OSIUNITTEST_ASSERT_ERROR(imC2.getNumCols() == im.getNumCols(), {}, "mosek", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumRows() == im.getNumRows(), {}, "mosek", "copy constructor"); lhs = imC2; } // Test that lhs has correct values even though rhs has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols() == m.getNumCols(), {}, "mosek", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows() == m.getNumRows(), {}, "mosek", "copy constructor"); } // Test clone { OsiMskSolverInterface mosekSi(m); OsiSolverInterface * siPtr = &mosekSi; OsiSolverInterface * siClone = siPtr->clone(); OsiMskSolverInterface * mosekClone = dynamic_cast(siClone); OSIUNITTEST_ASSERT_ERROR(mosekClone != NULL, {}, "mosek", "clone"); OSIUNITTEST_ASSERT_ERROR(mosekClone->getNumRows() == mosekSi.getNumRows(), {}, "mosek", "clone"); OSIUNITTEST_ASSERT_ERROR(mosekClone->getNumCols() == m.getNumCols(), {}, "mosek", "clone"); delete siClone; } // test infinity { OsiMskSolverInterface si; OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == MSK_INFINITY, {}, "mosek", "value for infinity"); } { OsiMskSolverInterface mosekSi(m); int nc = mosekSi.getNumCols(); int nr = mosekSi.getNumRows(); const double * cl = mosekSi.getColLower(); const double * cu = mosekSi.getColUpper(); const double * rl = mosekSi.getRowLower(); const double * ru = mosekSi.getRowUpper(); OSIUNITTEST_ASSERT_ERROR(nc == 8, return, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(nr == 5, return, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cu[1],4.1), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cu[2],1.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(rl[0],2.5), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(rl[4],3.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(ru[1],2.1), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(ru[4],15.), {}, "mosek", "read and copy exmip1"); double newCs[8] = {1., 2., 3., 4., 5., 6., 7., 8.}; mosekSi.setColSolution(newCs); const double * cs = mosekSi.getColSolution(); OSIUNITTEST_ASSERT_ERROR(eq(cs[0],1.0), {}, "mosek", "set col solution"); OSIUNITTEST_ASSERT_ERROR(eq(cs[7],8.0), {}, "mosek", "set col solution"); { OsiMskSolverInterface solnSi(mosekSi); const double * cs = solnSi.getColSolution(); OSIUNITTEST_ASSERT_ERROR(eq(cs[0],1.0), {}, "mosek", "set col solution and copy"); OSIUNITTEST_ASSERT_ERROR(eq(cs[7],8.0), {}, "mosek", "set col solution and copy"); } OSIUNITTEST_ASSERT_ERROR(!eq(cl[3],1.2345), {}, "mosek", "set col lower"); mosekSi.setColLower( 3, 1.2345 ); OSIUNITTEST_ASSERT_ERROR( eq(cl[3],1.2345), {}, "mosek", "set col lower"); OSIUNITTEST_ASSERT_ERROR(!eq(cu[4],10.2345), {}, "mosek", "set col upper"); mosekSi.setColUpper( 4, 10.2345 ); OSIUNITTEST_ASSERT_ERROR( eq(cu[4],10.2345), {}, "mosek", "set col upper"); OSIUNITTEST_ASSERT_ERROR(eq(mosekSi.getObjCoefficients()[0], 1.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(mosekSi.getObjCoefficients()[1], 0.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(mosekSi.getObjCoefficients()[2], 0.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(mosekSi.getObjCoefficients()[3], 0.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(mosekSi.getObjCoefficients()[4], 2.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(mosekSi.getObjCoefficients()[5], 0.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(mosekSi.getObjCoefficients()[6], 0.0), {}, "mosek", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(mosekSi.getObjCoefficients()[7],-1.0), {}, "mosek", "read and copy exmip1"); } // Test getMatrixByRow method { const OsiMskSolverInterface si(m); const CoinPackedMatrix * smP = si.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim() == 5, return, "mosek", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "mosek", "getMatrixByRow: num elements"); CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[0], 3.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[1], 1.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[2], -2.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[3], -1.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[4], -1.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[5], 2.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[6], 1.1), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[7], 1.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[8], 1.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[9], 2.8), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "mosek", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "mosek", "getMatrixByRow: elements"); const int * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "mosek", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "mosek", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "mosek", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "mosek", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "mosek", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "mosek", "getMatrixByRow: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "mosek", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "mosek", "getMatrixByRow: indices"); } //-------------- // Test rowsense, rhs, rowrange, getMatrixByRow { OsiMskSolverInterface lhs; { OsiMskSolverInterface siC1(m); OSIUNITTEST_ASSERT_WARNING(siC1.obj_ == NULL, {}, "mosek", "objective"); OSIUNITTEST_ASSERT_WARNING(siC1.collower_ == NULL, {}, "mosek", "col lower"); OSIUNITTEST_ASSERT_WARNING(siC1.colupper_ == NULL, {}, "mosek", "col upper"); OSIUNITTEST_ASSERT_WARNING(siC1.rowrange_ == NULL, {}, "mosek", "row range"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsense_ == NULL, {}, "mosek", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1.rowlower_ == NULL, {}, "mosek", "row lower"); OSIUNITTEST_ASSERT_WARNING(siC1.rowupper_ == NULL, {}, "mosek", "row upper"); OSIUNITTEST_ASSERT_WARNING(siC1.rhs_ == NULL, {}, "mosek", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1.matrixByRow_ == NULL, {}, "mosek", "matrix by row"); OSIUNITTEST_ASSERT_WARNING(siC1.colsol_ == NULL, {}, "mosek", "col solution"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsol_ == NULL, {}, "mosek", "row solution"); const char * siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "mosek", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "mosek", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "mosek", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "mosek", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "mosek", "row sense"); const double * siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "mosek", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "mosek", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "mosek", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "mosek", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "mosek", "right hand side"); const double * siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "mosek", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "mosek", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "mosek", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "mosek", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "mosek", "row range"); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "mosek", "matrix by row"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "mosek", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "mosek", "matrix by row: num elements"); const double * ev = siC1mbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "mosek", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "mosek", "matrix by row: elements"); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "mosek", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "mosek", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "mosek", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "mosek", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "mosek", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "mosek", "matrix by row: vector starts"); const int * ei = siC1mbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "mosek", "matrix by row: indices"); OSIUNITTEST_ASSERT_WARNING(siC1rs == siC1.getRowSense(), {}, "mosek", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "mosek", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1rr == siC1.getRowRange(), {}, "mosek", "row range"); // Change MOSEK Model by adding free row OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb( COIN_DBL_MAX); OsiCuts cuts; cuts.insert(rc); siC1.applyCuts(cuts); // Since model was changed, test that cached data is now freed. OSIUNITTEST_ASSERT_ERROR(siC1.obj_ == NULL, {}, "mosek", "objective"); OSIUNITTEST_ASSERT_ERROR(siC1.collower_ == NULL, {}, "mosek", "col lower"); OSIUNITTEST_ASSERT_ERROR(siC1.colupper_ == NULL, {}, "mosek", "col upper"); OSIUNITTEST_ASSERT_ERROR(siC1.rowrange_ == NULL, {}, "mosek", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsense_ == NULL, {}, "mosek", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowlower_ == NULL, {}, "mosek", "row lower"); OSIUNITTEST_ASSERT_ERROR(siC1.rowupper_ == NULL, {}, "mosek", "row upper"); OSIUNITTEST_ASSERT_ERROR(siC1.rhs_ == NULL, {}, "mosek", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByRow_ == NULL, {}, "mosek", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByCol_ == NULL, {}, "mosek", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.colsol_ == NULL, {}, "mosek", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsol_ == NULL, {}, "mosek", "free cached data after adding row"); siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "mosek", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "mosek", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "mosek", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "mosek", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "mosek", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "mosek", "row sense after adding row"); siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "mosek", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "mosek", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "mosek", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "mosek", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "mosek", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "mosek", "right hand side after adding row"); siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "mosek", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "mosek", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "mosek", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "mosek", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "mosek", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "mosek", "row range after adding row"); lhs = siC1; } // Test that lhs has correct values even though siC1 has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.obj_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.collower_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.colupper_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowrange_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsense_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowlower_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowupper_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rhs_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByRow_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByCol_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.colsol_ == NULL, {}, "mosek", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsol_ == NULL, {}, "mosek", "freed origin after assignment"); const char * lhsrs = lhs.getRowSense(); OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "mosek", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "mosek", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "mosek", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "mosek", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "mosek", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "mosek", "row sense after assignment"); const double * lhsrhs = lhs.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "mosek", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "mosek", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "mosek", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "mosek", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "mosek", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "mosek", "right hand side after assignment"); const double *lhsrr = lhs.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "mosek", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "mosek", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "mosek", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "mosek", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "mosek", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "mosek", "row range after assignment"); const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "mosek", "matrix by row after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "mosek", "matrix by row after assignment: major dim"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "mosek", "matrix by row after assignment: num elements"); const double * ev = lhsmbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "mosek", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "mosek", "matrix by row after assignment: elements"); const CoinBigIndex * mi = lhsmbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "mosek", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "mosek", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "mosek", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "mosek", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "mosek", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "mosek", "matrix by row after assignment: vector starts"); const int * ei = lhsmbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "mosek", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "mosek", "matrix by row after assignment: indices"); } OSIUNITTEST_ASSERT_ERROR(OsiMskSolverInterface::getNumInstances() == numInstancesStart+1, {}, "mosek", "number of instances"); } OSIUNITTEST_ASSERT_ERROR(OsiMskSolverInterface::getNumInstances() == numInstancesStart, {}, "mosek", "number of instances at finish"); // Do common solverInterface testing by calling the // base class testing method. { OsiMskSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir); } } #endif CoinMP-1.8.3/Osi/test/Makefile.in0000644000175000017500000006203212506051753015101 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ noinst_PROGRAMS = unitTest$(EXEEXT) # Depending of what solvers are available, we add the corresponding files, # libraries and include dirs @COIN_HAS_CPX_TRUE@am__append_1 = OsiCpxSolverInterfaceTest.cpp @COIN_HAS_CPX_TRUE@am__append_2 = -I`$(CYGPATH_W) $(CPXINCDIR)` \ @COIN_HAS_CPX_TRUE@ -I`$(CYGPATH_W) $(srcdir)/../src/OsiCpx` @COIN_HAS_CPX_TRUE@am__append_3 = ../src/OsiCpx/libOsiCpx.la @COIN_HAS_CPX_TRUE@am__append_4 = ../src/OsiCpx/libOsiCpx.la @COIN_HAS_CPX_TRUE@am__append_5 = $(CPXLIB) @COIN_HAS_GLPK_TRUE@am__append_6 = OsiGlpkSolverInterfaceTest.cpp @COIN_HAS_GLPK_TRUE@am__append_7 = $(GLPK_CFLAGS) \ @COIN_HAS_GLPK_TRUE@ -I`$(CYGPATH_W) $(srcdir)/../src/OsiGlpk` @COIN_HAS_GLPK_TRUE@am__append_8 = ../src/OsiGlpk/libOsiGlpk.la @COIN_HAS_GLPK_TRUE@am__append_9 = ../src/OsiGlpk/libOsiGlpk.la @COIN_HAS_GLPK_TRUE@am__append_10 = $(GLPK_LIBS) @COIN_HAS_MSK_TRUE@am__append_11 = OsiMskSolverInterfaceTest.cpp @COIN_HAS_MSK_TRUE@am__append_12 = -I`$(CYGPATH_W) $(MSKINCDIR)` \ @COIN_HAS_MSK_TRUE@ -I`$(CYGPATH_W) $(srcdir)/../src/OsiMsk` @COIN_HAS_MSK_TRUE@am__append_13 = ../src/OsiMsk/libOsiMsk.la @COIN_HAS_MSK_TRUE@am__append_14 = ../src/OsiMsk/libOsiMsk.la @COIN_HAS_MSK_TRUE@am__append_15 = $(MSKLIB) @COIN_HAS_XPR_TRUE@am__append_16 = OsiXprSolverInterfaceTest.cpp @COIN_HAS_XPR_TRUE@am__append_17 = -I`$(CYGPATH_W) $(XPRINCDIR)` \ @COIN_HAS_XPR_TRUE@ -I`$(CYGPATH_W) $(srcdir)/../src/OsiXpr` @COIN_HAS_XPR_TRUE@am__append_18 = ../src/OsiXpr/libOsiXpr.la @COIN_HAS_XPR_TRUE@am__append_19 = ../src/OsiXpr/libOsiXpr.la @COIN_HAS_XPR_TRUE@am__append_20 = $(XPRLIB) @COIN_HAS_GRB_TRUE@am__append_21 = OsiGrbSolverInterfaceTest.cpp @COIN_HAS_GRB_TRUE@am__append_22 = -I`$(CYGPATH_W) $(GRBINCDIR)` \ @COIN_HAS_GRB_TRUE@ -I`$(CYGPATH_W) $(srcdir)/../src/OsiGrb` @COIN_HAS_GRB_TRUE@am__append_23 = ../src/OsiGrb/libOsiGrb.la @COIN_HAS_GRB_TRUE@am__append_24 = ../src/OsiGrb/libOsiGrb.la @COIN_HAS_GRB_TRUE@am__append_25 = $(GRBLIB) @COIN_HAS_SOPLEX_TRUE@am__append_26 = OsiSpxSolverInterfaceTest.cpp @COIN_HAS_SOPLEX_TRUE@am__append_27 = $(SOPLEX_CFLAGS) \ @COIN_HAS_SOPLEX_TRUE@ -I`$(CYGPATH_W) $(srcdir)/../src/OsiSpx` @COIN_HAS_SOPLEX_TRUE@am__append_28 = ../src/OsiSpx/libOsiSpx.la @COIN_HAS_SOPLEX_TRUE@am__append_29 = ../src/OsiSpx/libOsiSpx.la @COIN_HAS_SOPLEX_TRUE@am__append_30 = $(SOPLEX_LIBS) @COIN_HAS_SAMPLE_TRUE@am__append_31 = -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` @COIN_HAS_NETLIB_TRUE@am__append_32 = -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testOsiSolverInterface subdir = test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Osi/config.h \ $(top_builddir)/src/Osi/config_osi.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) am__unitTest_SOURCES_DIST = unitTest.cpp OsiTestSolver.cpp \ OsiTestSolverInterface.cpp OsiTestSolverInterfaceIO.cpp \ OsiTestSolverInterfaceTest.cpp OsiCpxSolverInterfaceTest.cpp \ OsiGlpkSolverInterfaceTest.cpp OsiMskSolverInterfaceTest.cpp \ OsiXprSolverInterfaceTest.cpp OsiGrbSolverInterfaceTest.cpp \ OsiSpxSolverInterfaceTest.cpp @COIN_HAS_CPX_TRUE@am__objects_1 = \ @COIN_HAS_CPX_TRUE@ OsiCpxSolverInterfaceTest.$(OBJEXT) @COIN_HAS_GLPK_TRUE@am__objects_2 = \ @COIN_HAS_GLPK_TRUE@ OsiGlpkSolverInterfaceTest.$(OBJEXT) @COIN_HAS_MSK_TRUE@am__objects_3 = \ @COIN_HAS_MSK_TRUE@ OsiMskSolverInterfaceTest.$(OBJEXT) @COIN_HAS_XPR_TRUE@am__objects_4 = \ @COIN_HAS_XPR_TRUE@ OsiXprSolverInterfaceTest.$(OBJEXT) @COIN_HAS_GRB_TRUE@am__objects_5 = \ @COIN_HAS_GRB_TRUE@ OsiGrbSolverInterfaceTest.$(OBJEXT) @COIN_HAS_SOPLEX_TRUE@am__objects_6 = \ @COIN_HAS_SOPLEX_TRUE@ OsiSpxSolverInterfaceTest.$(OBJEXT) am_unitTest_OBJECTS = unitTest.$(OBJEXT) OsiTestSolver.$(OBJEXT) \ OsiTestSolverInterface.$(OBJEXT) \ OsiTestSolverInterfaceIO.$(OBJEXT) \ OsiTestSolverInterfaceTest.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_5) $(am__objects_6) unitTest_OBJECTS = $(am_unitTest_OBJECTS) @COIN_HAS_CPX_TRUE@am__DEPENDENCIES_1 = ../src/OsiCpx/libOsiCpx.la @COIN_HAS_GLPK_TRUE@am__DEPENDENCIES_2 = ../src/OsiGlpk/libOsiGlpk.la @COIN_HAS_MSK_TRUE@am__DEPENDENCIES_3 = ../src/OsiMsk/libOsiMsk.la @COIN_HAS_XPR_TRUE@am__DEPENDENCIES_4 = ../src/OsiXpr/libOsiXpr.la @COIN_HAS_GRB_TRUE@am__DEPENDENCIES_5 = ../src/OsiGrb/libOsiGrb.la @COIN_HAS_SOPLEX_TRUE@am__DEPENDENCIES_6 = ../src/OsiSpx/libOsiSpx.la am__DEPENDENCIES_7 = 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(unitTest_SOURCES) DIST_SOURCES = $(am__unitTest_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ $(am__append_5) $(am__append_10) $(am__append_15) \ $(am__append_20) $(am__append_25) $(am__append_30) LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign unitTest_SOURCES = unitTest.cpp OsiTestSolver.cpp \ OsiTestSolverInterface.cpp OsiTestSolverInterfaceIO.cpp \ OsiTestSolverInterfaceTest.cpp $(am__append_1) $(am__append_6) \ $(am__append_11) $(am__append_16) $(am__append_21) \ $(am__append_26) # List libraries of COIN projects unitTest_LDADD = ../src/OsiCommonTest/libOsiCommonTests.la \ $(am__append_3) $(am__append_8) $(am__append_13) \ $(am__append_18) $(am__append_23) $(am__append_28) \ ../src/Osi/libOsi.la $(OSILIB_LIBS) unitTest_DEPENDENCIES = ../src/OsiCommonTest/libOsiCommonTests.la \ $(am__append_4) $(am__append_9) $(am__append_14) \ $(am__append_19) $(am__append_24) $(am__append_29) \ ../src/Osi/libOsi.la $(OSILIB_DEPENDENCIES) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src/Osi` -I`$(CYGPATH_W) \ $(srcdir)/../src/OsiCommonTest` $(COINUTILS_CFLAGS) \ $(am__append_2) $(am__append_7) $(am__append_12) \ $(am__append_17) $(am__append_22) $(am__append_27) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi unittestflags = $(am__append_31) $(am__append_32) ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = *.mps *.mps.gz *.lp test2out *.out.gz *.out all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 test/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign test/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done unitTest$(EXEEXT): $(unitTest_OBJECTS) $(unitTest_DEPENDENCIES) @rm -f unitTest$(EXEEXT) $(CXXLINK) $(unitTest_LDFLAGS) $(unitTest_OBJECTS) $(unitTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiCpxSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiGlpkSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiGrbSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiMskSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiSpxSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiTestSolver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiTestSolverInterface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiTestSolverInterfaceIO.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiTestSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiXprSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unitTest.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 $(PROGRAMS) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: 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: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS 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-exec \ install-exec-am install-info install-info-am install-man \ 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 \ uninstall-info-am test: unitTest$(EXEEXT) ./unitTest$(EXEEXT) $(unittestflags) .PHONY: test # 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: CoinMP-1.8.3/Osi/test/Makefile.am0000644000175000017500000000745211621722556015100 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1800 2011-08-14 10:37:34Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # unitTest for Coin # ######################################################################## noinst_PROGRAMS = unitTest unitTest_SOURCES = unitTest.cpp \ OsiTestSolver.cpp \ OsiTestSolverInterface.cpp \ OsiTestSolverInterfaceIO.cpp \ OsiTestSolverInterfaceTest.cpp # List libraries of COIN projects unitTest_LDADD = ../src/OsiCommonTest/libOsiCommonTests.la unitTest_DEPENDENCIES = ../src/OsiCommonTest/libOsiCommonTests.la # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../src/Osi` \ -I`$(CYGPATH_W) $(srcdir)/../src/OsiCommonTest` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi # Depending of what solvers are available, we add the corresponding files, # libraries and include dirs if COIN_HAS_CPX unitTest_SOURCES += OsiCpxSolverInterfaceTest.cpp AM_CPPFLAGS += -I`$(CYGPATH_W) $(CPXINCDIR)` \ -I`$(CYGPATH_W) $(srcdir)/../src/OsiCpx` unitTest_LDADD += ../src/OsiCpx/libOsiCpx.la unitTest_DEPENDENCIES += ../src/OsiCpx/libOsiCpx.la LIBS += $(CPXLIB) endif if COIN_HAS_GLPK unitTest_SOURCES += OsiGlpkSolverInterfaceTest.cpp AM_CPPFLAGS += $(GLPK_CFLAGS) \ -I`$(CYGPATH_W) $(srcdir)/../src/OsiGlpk` unitTest_LDADD += ../src/OsiGlpk/libOsiGlpk.la unitTest_DEPENDENCIES += ../src/OsiGlpk/libOsiGlpk.la LIBS += $(GLPK_LIBS) endif if COIN_HAS_MSK unitTest_SOURCES += OsiMskSolverInterfaceTest.cpp AM_CPPFLAGS += -I`$(CYGPATH_W) $(MSKINCDIR)` \ -I`$(CYGPATH_W) $(srcdir)/../src/OsiMsk` unitTest_LDADD += ../src/OsiMsk/libOsiMsk.la unitTest_DEPENDENCIES += ../src/OsiMsk/libOsiMsk.la LIBS += $(MSKLIB) endif if COIN_HAS_XPR unitTest_SOURCES += OsiXprSolverInterfaceTest.cpp AM_CPPFLAGS += -I`$(CYGPATH_W) $(XPRINCDIR)` \ -I`$(CYGPATH_W) $(srcdir)/../src/OsiXpr` unitTest_LDADD += ../src/OsiXpr/libOsiXpr.la unitTest_DEPENDENCIES += ../src/OsiXpr/libOsiXpr.la LIBS += $(XPRLIB) endif if COIN_HAS_GRB unitTest_SOURCES += OsiGrbSolverInterfaceTest.cpp AM_CPPFLAGS += -I`$(CYGPATH_W) $(GRBINCDIR)` \ -I`$(CYGPATH_W) $(srcdir)/../src/OsiGrb` unitTest_LDADD += ../src/OsiGrb/libOsiGrb.la unitTest_DEPENDENCIES += ../src/OsiGrb/libOsiGrb.la LIBS += $(GRBLIB) endif if COIN_HAS_SOPLEX unitTest_SOURCES += OsiSpxSolverInterfaceTest.cpp AM_CPPFLAGS += $(SOPLEX_CFLAGS) \ -I`$(CYGPATH_W) $(srcdir)/../src/OsiSpx` unitTest_LDADD += ../src/OsiSpx/libOsiSpx.la unitTest_DEPENDENCIES += ../src/OsiSpx/libOsiSpx.la LIBS += $(SOPLEX_LIBS) endif unitTest_LDADD += ../src/Osi/libOsi.la $(OSILIB_LIBS) unitTest_DEPENDENCIES += ../src/Osi/libOsi.la $(OSILIB_DEPENDENCIES) unittestflags = if COIN_HAS_SAMPLE unittestflags += -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` endif if COIN_HAS_NETLIB unittestflags += -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testOsiSolverInterface endif test: unitTest$(EXEEXT) ./unitTest$(EXEEXT) $(unittestflags) .PHONY: test ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = *.mps *.mps.gz *.lp test2out *.out.gz *.out CoinMP-1.8.3/Osi/test/OsiXprSolverInterfaceTest.cpp0000644000175000017500000006431211612354477020651 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This file is licensed under the terms of Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "OsiConfig.h" //#include #include "OsiUnitTests.hpp" #include "OsiXprSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" // Added so build windows build with dsp files works, // when not building with xpress. #ifdef COIN_HAS_XPR #define __ANSIC_ #include #undef __ANSIC_ //----------------------------------------------------------------------- // Test XPRESS-MP solution methods. void OsiXprSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir) { unsigned int numInstancesStart = OsiXprSolverInterface::getNumInstances(); // Test default constructor { OsiXprSolverInterface m; OSIUNITTEST_ASSERT_ERROR(m.xprProbname_ == "", {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.collower_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colupper_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.vartype_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsense_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rhs_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowrange_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowlower_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowupper_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowprice_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colsol_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsol_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByCol_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.ivarind_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.ivartype_ == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getNumCols() == 0, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getApplicationData() == NULL, {}, "xpress", "default constructor"); OSIUNITTEST_ASSERT_ERROR(OsiXprSolverInterface::getNumInstances() == numInstancesStart+1, {}, "xpress", "number of instances during first test"); int i=2346; m.setApplicationData(&i); OSIUNITTEST_ASSERT_ERROR(*((int *)(m.getApplicationData())) == i, {}, "xpress", "default constructor"); } OSIUNITTEST_ASSERT_ERROR(OsiXprSolverInterface::getNumInstances() == numInstancesStart, {}, "xpress", "number of instances after first test"); { CoinRelFltEq eq; OsiXprSolverInterface m; OSIUNITTEST_ASSERT_ERROR(OsiXprSolverInterface::getNumInstances() == numInstancesStart+1, {}, "xpress", "number of instances"); std::string fn = mpsDir+"exmip1"; m.readMps(fn.c_str()); // This assert fails on windows because fn is mixed case and xprProbname_is uppercase. //OSIUNITTEST_ASSERT_ERROR( m.xprProbname_ == fn, {}, "xpress", "exmip1 problem name" ); // Test copy constructor and assignment operator { OsiXprSolverInterface lhs; { OsiXprSolverInterface im(m); OsiXprSolverInterface imC1(im); OSIUNITTEST_ASSERT_ERROR(imC1.getNumCols() == im.getNumCols(), {}, "xpress", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumRows() == im.getNumRows(), {}, "xpress", "copy constructor"); OsiXprSolverInterface imC2(im); OSIUNITTEST_ASSERT_ERROR(imC2.getNumCols() == im.getNumCols(), {}, "xpress", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumRows() == im.getNumRows(), {}, "xpress", "copy constructor"); lhs = imC2; } // Test that lhs has correct values even though rhs has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols() == m.getNumCols(), {}, "xpress", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows() == m.getNumRows(), {}, "xpress", "copy constructor"); } // Test clone { OsiXprSolverInterface xpressSi(m); OsiSolverInterface * siPtr = &xpressSi; OsiSolverInterface * siClone = siPtr->clone(); OsiXprSolverInterface * xpressClone = dynamic_cast(siClone); OSIUNITTEST_ASSERT_ERROR(xpressClone != NULL, {}, "xpress", "clone"); OSIUNITTEST_ASSERT_ERROR(xpressClone->getNumRows() == xpressSi.getNumRows(), {}, "xpress", "clone"); OSIUNITTEST_ASSERT_ERROR(xpressClone->getNumCols() == m.getNumCols(), {}, "xpress", "clone"); delete siClone; } // Test infinity { OsiXprSolverInterface si; OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == XPRS_PLUSINFINITY, {}, "xpress", "value for infinity"); } { OsiXprSolverInterface xpressSi(m); int nc = xpressSi.getNumCols(); int nr = xpressSi.getNumRows(); const double * cl = xpressSi.getColLower(); const double * cu = xpressSi.getColUpper(); const double * rl = xpressSi.getRowLower(); const double * ru = xpressSi.getRowUpper(); OSIUNITTEST_ASSERT_ERROR(nc == 8, return, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(nr == 5, return, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cu[1],4.1), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cu[2],1.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(rl[0],2.5), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(rl[4],3.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(ru[1],2.1), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(ru[4],15.), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(!eq(cl[3],1.2345), {}, "xpress", "set col lower"); xpressSi.setColLower( 3, 1.2345 ); OSIUNITTEST_ASSERT_ERROR( eq(cl[3],1.2345), {}, "xpress", "set col lower"); OSIUNITTEST_ASSERT_ERROR(!eq(cu[4],10.2345), {}, "xpress", "set col upper"); xpressSi.setColUpper( 4, 10.2345 ); OSIUNITTEST_ASSERT_ERROR( eq(cu[4],10.2345), {}, "xpress", "set col upper"); OSIUNITTEST_ASSERT_ERROR(eq(xpressSi.getObjCoefficients()[0], 1.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(xpressSi.getObjCoefficients()[1], 0.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(xpressSi.getObjCoefficients()[2], 0.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(xpressSi.getObjCoefficients()[3], 0.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(xpressSi.getObjCoefficients()[4], 2.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(xpressSi.getObjCoefficients()[5], 0.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(xpressSi.getObjCoefficients()[6], 0.0), {}, "xpress", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(xpressSi.getObjCoefficients()[7],-1.0), {}, "xpress", "read and copy exmip1"); } // Test getMatrixByRow method { const OsiXprSolverInterface si(m); const CoinPackedMatrix * smP = si.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim() == 5, return, "xpress", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "xpress", "getMatrixByRow: num elements"); CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[0], 3.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[1], 1.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[2], -2.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[3], -1.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[4], -1.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[5], 2.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[6], 1.1), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[7], 1.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[8], 1.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[9], 2.8), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "xpress", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "xpress", "getMatrixByRow: elements"); const int * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "xpress", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "xpress", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "xpress", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "xpress", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "xpress", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "xpress", "getMatrixByRow: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "xpress", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "xpress", "getMatrixByRow: indices"); } //-------------- // Test rowsense, rhs, rowrange, getMatrixByRow { OsiXprSolverInterface lhs; { OsiXprSolverInterface siC1(m); OSIUNITTEST_ASSERT_WARNING(siC1.rowrange_ == NULL, {}, "xpress", "row range"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsense_ == NULL, {}, "xpress", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1.rhs_ == NULL, {}, "xpress", "right hand side"); assert( m.rowrange_==NULL ); assert( m.rowsense_==NULL ); assert( m.rhs_==NULL ); const char * siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "xpress", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "xpress", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "xpress", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "xpress", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "xpress", "row sense"); const double * siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "xpress", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "xpress", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "xpress", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "xpress", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "xpress", "right hand side"); const double * siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "xpress", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "xpress", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "xpress", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "xpress", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "xpress", "row range"); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "xpress", "matrix by row"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "xpress", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "xpress", "matrix by row: num elements"); const double * ev = siC1mbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "xpress", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "xpress", "matrix by row: elements"); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "xpress", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "xpress", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "xpress", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "xpress", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "xpress", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "xpress", "matrix by row: vector starts"); const int * ei = siC1mbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "xpress", "matrix by row: indices"); OSIUNITTEST_ASSERT_WARNING(siC1rs == siC1.getRowSense(), {}, "xpress", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "xpress", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1rr == siC1.getRowRange(), {}, "xpress", "row range"); // Change XPRESS Model by adding free row OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb( COIN_DBL_MAX); OsiCuts cuts; cuts.insert(rc); siC1.applyCuts(cuts); // Since model was changed, test that cached data is now freed. OSIUNITTEST_ASSERT_ERROR(siC1.rowrange_ == NULL, {}, "xpress", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsense_ == NULL, {}, "xpress", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rhs_ == NULL, {}, "xpress", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByRow_ == NULL, {}, "xpress", "free cached data after adding row"); siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "xpress", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "xpress", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "xpress", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "xpress", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "xpress", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "xpress", "row sense after adding row"); siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "xpress", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "xpress", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "xpress", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "xpress", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "xpress", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "xpress", "right hand side after adding row"); siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "xpress", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "xpress", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "xpress", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "xpress", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "xpress", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "xpress", "row range after adding row"); lhs = siC1; } // Test that lhs has correct values even though siC1 has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.rowrange_ == NULL, {}, "xpress", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsense_ == NULL, {}, "xpress", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rhs_ == NULL, {}, "xpress", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByRow_ == NULL, {}, "xpress", "freed origin after assignment"); const char * lhsrs = lhs.getRowSense(); OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "xpress", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "xpress", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "xpress", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "xpress", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "xpress", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "xpress", "row sense after assignment"); const double * lhsrhs = lhs.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "xpress", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "xpress", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "xpress", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "xpress", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "xpress", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "xpress", "right hand side after assignment"); const double *lhsrr = lhs.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "xpress", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "xpress", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "xpress", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "xpress", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "xpress", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "xpress", "row range after assignment"); const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "xpress", "matrix by row after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "xpress", "matrix by row after assignment: major dim"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "xpress", "matrix by row after assignment: num elements"); const double * ev = lhsmbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "xpress", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "xpress", "matrix by row after assignment: elements"); const CoinBigIndex * mi = lhsmbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "xpress", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "xpress", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "xpress", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "xpress", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "xpress", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "xpress", "matrix by row after assignment: vector starts"); const int * ei = lhsmbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "xpress", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "xpress", "matrix by row after assignment: indices"); } OSIUNITTEST_ASSERT_ERROR(OsiXprSolverInterface::getNumInstances() == numInstancesStart+1, {}, "xpress", "number of instances"); } OSIUNITTEST_ASSERT_ERROR(OsiXprSolverInterface::getNumInstances() == numInstancesStart, {}, "xpress", "number of instances at finish"); // Do common solverInterface testing by calling the // base class testing method. { OsiXprSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir); } } #endif CoinMP-1.8.3/Osi/test/unitTest.cpp0000644000175000017500000003042312104023262015342 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // Test individual classes or groups of classes // This file is licensed under the terms of Eclipse Public License (EPL). // $Id: unitTest.cpp 1891 2013-02-04 21:22:58Z stefan $ #include "CoinPragma.hpp" #include "OsiConfig.h" #include #include "OsiUnitTests.hpp" #include "OsiSolverInterface.hpp" #include "OsiTestSolverInterface.hpp" using namespace OsiUnitTest; /* Currently the Osi unit test is configured to exercise only the external solvers. The Osi interfaces for Coin solvers have been moved out to the project's repository and each has its own private Osi unit test. This unit test will include as many external solvers as are available. If none of them are available, the OsiTestSolver (currently a clone of Vol) will be used. If any other solver is available, its presence will disable use of the test solver. You can disable it manually by undefining USETESTSOLVER. You may want to use the Osi unit test to compare two or more Coin solvers. In particular, OsiSolverInterfaceMpsUnitTest, which runs the Netlib problem set, is set up for exactly this sort of comparison. To take advantage of it, you'll need to edit this file and Makefile in order to get it to work. */ #define USETESTSOLVER /* Some convenient undef's, to make it easy to isolate a particular solver. Uncomment to disable a solver that's included in the build. Leave them commented if you're happy with running the unitTest for all solvers in the build. */ // #undef COIN_HAS_XPR // #undef COIN_HAS_CPX // #undef COIN_HAS_GLPK // #undef COIN_HAS_MSK // #undef COIN_HAS_GRB // #undef COIN_HAS_SOPLEX #ifdef COIN_HAS_XPR #include "OsiXprSolverInterface.hpp" #ifdef USETESTSOLVER #undef USETESTSOLVER #endif #endif #ifdef COIN_HAS_CPX #include "OsiCpxSolverInterface.hpp" #undef USETESTSOLVER #ifdef USETESTSOLVER #undef USETESTSOLVER #endif #endif #ifdef COIN_HAS_GLPK #include "OsiGlpkSolverInterface.hpp" #ifdef USETESTSOLVER #undef USETESTSOLVER #endif #endif #ifdef COIN_HAS_MSK #include "OsiMskSolverInterface.hpp" #ifdef USETESTSOLVER #undef USETESTSOLVER #endif #endif #ifdef COIN_HAS_GRB #include "OsiGrbSolverInterface.hpp" #ifdef USETESTSOLVER #undef USETESTSOLVER #endif #endif #ifdef COIN_HAS_SOPLEX #include "OsiSpxSolverInterface.hpp" #ifdef USETESTSOLVER #undef USETESTSOLVER #endif #endif #ifdef USETESTSOLVER #include "OsiTestSolverInterface.hpp" #endif //---------------------------------------------------------------- // to see parameter list, call unitTest -usage //---------------------------------------------------------------- int main (int argc, const char *argv[]) { /* Start off with various bits of initialisation that don't really belong anywhere else. First off, synchronise C++ stream i/o with C stdio. This makes debugging output a bit more comprehensible. It still suffers from interleave of cout (stdout) and cerr (stderr), but -nobuf deals with that. */ std::ios::sync_with_stdio() ; /* Suppress an popup window that Windows shows in response to a crash. See note at head of file. */ WindowsErrorPopupBlocker(); /* Might as well make use of this convenient Xpress feature. */ #ifdef COIN_HAS_XPR OsiXprSolverInterface::setLogFileName("xprCallTrace.txt"); #endif /* Process command line parameters. */ std::map parms ; if (processParameters(argc,argv,parms) == false) return 1; std::string mpsDir = parms["-mpsDir"] ; std::string netlibDir = parms["-netlibDir"] ; /* Test Osi{Row,Col}Cut routines. */ #ifdef COIN_HAS_XPR { OsiXprSolverInterface xprSi; testingMessage( "Testing OsiRowCut with OsiXprSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&xprSi,mpsDir), {}, xprSi, "rowcut unittest"); } { OsiXprSolverInterface xprSi; testingMessage( "Testing OsiColCut with OsiXprSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&xprSi,mpsDir), {}, xprSi, "colcut unittest"); } { OsiXprSolverInterface xprSi; testingMessage( "Testing OsiRowCutDebugger with OsiXprSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&xprSi,mpsDir), {}, xprSi, "rowcut debugger unittest"); } #endif #ifdef COIN_HAS_CPX { OsiCpxSolverInterface cpxSi; testingMessage( "Testing OsiRowCut with OsiCpxSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&cpxSi,mpsDir), {}, cpxSi, "rowcut unittest"); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing OsiColCut with OsiCpxSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&cpxSi,mpsDir), {}, cpxSi, "colcut unittest"); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing OsiRowCutDebugger with OsiCpxSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&cpxSi,mpsDir), {}, cpxSi, "rowcut debugger unittest"); } #endif #ifdef USETESTSOLVER { OsiTestSolverInterface testSi; testingMessage( "Testing OsiRowCut with OsiTestSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&testSi,mpsDir), {}, testSi, "rowcut unittest"); } { OsiTestSolverInterface testSi; testingMessage( "Testing OsiColCut with OsiTestSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&testSi,mpsDir), {}, testSi, "colcut unittest"); } #endif #ifdef COIN_HAS_GLPK { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing OsiRowCut with OsiGlpkSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&glpkSi,mpsDir), {}, glpkSi, "rowcut unittest"); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing OsiColCut with OsiGlpkSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&glpkSi,mpsDir), {}, glpkSi, "colcut unittest"); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing OsiRowCutDebugger with OsiGlpkSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&glpkSi,mpsDir), {}, glpkSi, "rowcut debugger unittest"); } #endif #ifdef COIN_HAS_MSK { OsiMskSolverInterface MskSi; testingMessage( "Testing OsiRowCut with OsiMskSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&MskSi,mpsDir), {}, MskSi, "rowcut unittest"); } { OsiMskSolverInterface MskSi; testingMessage( "Testing OsiColCut with OsiMskSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&MskSi,mpsDir), {}, MskSi, "colcut unittest"); } { OsiMskSolverInterface MskSi; testingMessage( "Testing OsiRowCutDebugger with OsiMskSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&MskSi,mpsDir), {}, MskSi, "rowcut debugger unittest"); } #endif #ifdef COIN_HAS_GRB { OsiGrbSolverInterface grbSi; testingMessage( "Testing OsiRowCut with OsiGrbSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&grbSi,mpsDir), {}, grbSi, "rowcut unittest"); } { OsiGrbSolverInterface grbSi; testingMessage( "Testing OsiColCut with OsiGrbSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&grbSi,mpsDir), {}, grbSi, "colcut unittest"); } { OsiGrbSolverInterface grbSi; testingMessage( "Testing OsiRowCutDebugger with OsiGrbSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&grbSi,mpsDir), {}, grbSi, "rowcut debugger unittest"); } #endif #ifdef COIN_HAS_SOPLEX { OsiSpxSolverInterface spxSi; testingMessage( "Testing OsiRowCut with OsiSpxSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&spxSi,mpsDir), {}, spxSi, "rowcut unittest"); } { OsiSpxSolverInterface spxSi; testingMessage( "Testing OsiColCut with OsiSpxSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&spxSi,mpsDir), {}, spxSi, "colcut unittest"); } { OsiSpxSolverInterface spxSi; testingMessage( "Testing OsiRowCutDebugger with OsiSpxSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&spxSi,mpsDir), {}, spxSi, "rowcut debugger unittest"); } #endif testingMessage( "Testing OsiCuts\n" ); OSIUNITTEST_CATCH_ERROR(OsiCutsUnitTest(), {}, "osi", "osicuts unittest"); /* Testing OsiCuts only? A useful option when doing memory access and leak checks. Keeps the run time to something reasonable. */ if (parms.find("-cutsOnly") != parms.end()) { testingMessage( "Stopping after OsiCuts tests.\n" ); return 0; } /* Run the OsiXXX class test for each solver. It's up to the solver implementor to decide whether or not to run OsiSolverInterfaceCommonUnitTest. Arguably this should be required. */ #ifdef COIN_HAS_XPR testingMessage( "Testing OsiXprSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiXprSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "xpress", "osixpr unittest"); #endif #ifdef COIN_HAS_CPX testingMessage( "Testing OsiCpxSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiCpxSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "cplex", "osicpx unittest"); #endif #ifdef USETESTSOLVER testingMessage( "Testing OsiTestSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiTestSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "vol", "ositestsolver unittest"); #endif #ifdef COIN_HAS_GLPK testingMessage( "Testing OsiGlpkSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiGlpkSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "glpk", "osiglpk unittest"); #endif #ifdef COIN_HAS_MSK testingMessage( "Testing OsiMskSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiMskSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "mosek", "osimsk unittest"); #endif #ifdef COIN_HAS_GRB testingMessage( "Testing OsiGrbSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiGrbSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "gurobi", "osigrb unittest"); #endif #ifdef COIN_HAS_SOPLEX testingMessage( "Testing OsiSpxSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiSpxSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "soplex", "osispx unittest"); #endif /* Each solver has run its specialised unit test. Check now to see if we need to run through the Netlib problems. */ if (parms.find("-testOsiSolverInterface") != parms.end()) { // Create vector of solver interfaces std::vector vecSi; # if COIN_HAS_XPR OsiSolverInterface * xprSi = new OsiXprSolverInterface; vecSi.push_back(xprSi); # endif # if COIN_HAS_CPX OsiSolverInterface * cpxSi = new OsiCpxSolverInterface; vecSi.push_back(cpxSi); # endif # if COIN_HAS_GLPK OsiSolverInterface * glpkSi = new OsiGlpkSolverInterface; glpkSi->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry) ; glpkSi->setHintParam(OsiDoReducePrint,true,OsiHintDo) ; vecSi.push_back(glpkSi); # endif # if COIN_HAS_MSK OsiSolverInterface * MskSi = new OsiMskSolverInterface; vecSi.push_back(MskSi); # endif # if COIN_HAS_GRB OsiSolverInterface * grbSi = new OsiGrbSolverInterface; vecSi.push_back(grbSi); # endif # if COIN_HAS_SOPLEX OsiSolverInterface * spxSi = new OsiSpxSolverInterface; vecSi.push_back(spxSi); # endif # ifdef USETESTSOLVER /* The test solver is normally Vol, which can't do any of the netlib problems. So let's not try. */ { std::string solverName ; OsiSolverInterface * testSi = new OsiTestSolverInterface; testSi->getStrParam(OsiSolverName,solverName) ; if (solverName != "vol") { vecSi.push_back(testSi); } else { testingMessage("Test solver vol cannot do Netlib. Skipping.\n") ; } } # endif if (vecSi.size() > 0) { testingMessage( "Testing OsiSolverInterface on Netlib problems.\n" ); OSIUNITTEST_CATCH_ERROR(OsiSolverInterfaceMpsUnitTest(vecSi,netlibDir), {}, "osi", "netlib unittest"); } unsigned int i; for (i=0; i nerrors_expected) std::cerr << "Tests completed with " << nerrors - nerrors_expected << " unexpected errors." << std::endl ; else std::cerr << "All tests completed successfully\n"; return nerrors - nerrors_expected; } CoinMP-1.8.3/Osi/test/OsiTestSolverInterfaceTest.cpp0000644000175000017500000000120311575423733021005 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This file is licensed under the terms of Eclipse Public License (EPL). #include "OsiTestSolverInterface.hpp" #include "OsiUnitTests.hpp" //############################################################################# //-------------------------------------------------------------------------- void OsiTestSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir) { // Do common solverInterface testing { OsiTestSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir); } } CoinMP-1.8.3/Osi/test/OsiCpxSolverInterfaceTest.cpp0000644000175000017500000006520311612344643020624 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for CPLEX // author: Tobias Pfender // Konrad-Zuse-Zentrum Berlin (Germany) // date: 09/25/2000 // license: this file may be freely distributed under the terms of EPL // comments: please scan this file for '???' and read the comments //----------------------------------------------------------------------------- // Copyright (C) 2000, Tobias Pfender, International Business Machines // Corporation and others. All Rights Reserved. #include "CoinPragma.hpp" #include "OsiConfig.h" //#include //#include #include "OsiUnitTests.hpp" #include "OsiCpxSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" // Added so build windows build with dsp files works, // when not building with cplex. #ifdef COIN_HAS_CPX #include "cplex.h" void OsiCpxSolverInterfaceUnitTest( const std::string & mpsDir, const std::string & netlibDir ) { // Test default constructor { OsiCpxSolverInterface m; OSIUNITTEST_ASSERT_ERROR(m.obj_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.collower_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colupper_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.coltype_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.coltypesize_ == 0, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsense_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rhs_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowrange_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowlower_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowupper_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colsol_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsol_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByCol_ == NULL, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getNumCols() == 0, {}, "cplex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getApplicationData() == NULL, {}, "cplex", "default constructor"); int i=2346; m.setApplicationData(&i); OSIUNITTEST_ASSERT_ERROR(*((int *)(m.getApplicationData())) == i, {}, "cplex", "default constructor"); } { CoinRelFltEq eq; OsiCpxSolverInterface m; std::string fn = mpsDir+"exmip1"; m.readMps(fn.c_str(),"mps"); { OSIUNITTEST_ASSERT_ERROR(m.getNumCols() == 8, {}, "cplex", "exmip1 read"); const CoinPackedMatrix * colCopy = m.getMatrixByCol(); OSIUNITTEST_ASSERT_ERROR(colCopy->getNumCols() == 8, {}, "cplex", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getMajorDim() == 8, {}, "cplex", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getNumRows() == 5, {}, "cplex", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getMinorDim() == 5, {}, "cplex", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getVectorLengths()[7] == 2, {}, "cplex", "exmip1 matrix"); CoinPackedMatrix revColCopy; revColCopy.reverseOrderedCopyOf(*colCopy); CoinPackedMatrix rev2ColCopy; rev2ColCopy.reverseOrderedCopyOf(revColCopy); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getNumCols() == 8, {}, "cplex", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getMajorDim() == 8, {}, "cplex", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getNumRows() == 5, {}, "cplex", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getMinorDim() == 5, {}, "cplex", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getVectorLengths()[7] == 2, {}, "cplex", "twice reverse matrix copy"); } // Test copy constructor and assignment operator { OsiCpxSolverInterface lhs; { OsiCpxSolverInterface im(m); OsiCpxSolverInterface imC1(im); OSIUNITTEST_ASSERT_ERROR(imC1.lp_ != im.lp_, {}, "cplex", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumCols() == im.getNumCols(), {}, "cplex", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumRows() == im.getNumRows(), {}, "cplex", "copy constructor"); OsiCpxSolverInterface imC2(im); OSIUNITTEST_ASSERT_ERROR(imC2.lp_ != im.lp_, {}, "cplex", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumCols() == im.getNumCols(), {}, "cplex", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumRows() == im.getNumRows(), {}, "cplex", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.lp_ != imC2.lp_, {}, "cplex", "copy constructor"); lhs = imC2; } // Test that lhs has correct values even though rhs has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.lp_ != m.lp_, {}, "cplex", "assignment operator"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols() == m.getNumCols(), {}, "cplex", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows() == m.getNumRows(), {}, "cplex", "copy constructor"); } // Test clone { OsiCpxSolverInterface cplexSi(m); OsiSolverInterface * siPtr = &cplexSi; OsiSolverInterface * siClone = siPtr->clone(); OsiCpxSolverInterface * cplexClone = dynamic_cast(siClone); OSIUNITTEST_ASSERT_ERROR(cplexClone != NULL, {}, "cplex", "clone"); OSIUNITTEST_ASSERT_ERROR(cplexClone->lp_ != cplexSi.lp_, {}, "cplex", "clone"); OSIUNITTEST_ASSERT_ERROR(cplexClone->getNumRows() == cplexSi.getNumRows(), {}, "cplex", "clone"); OSIUNITTEST_ASSERT_ERROR(cplexClone->getNumCols() == m.getNumCols(), {}, "cplex", "clone"); delete siClone; } // test infinity { OsiCpxSolverInterface si; OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == CPX_INFBOUND, {}, "cplex", "value for infinity"); } // Test getMatrixByRow method { const OsiCpxSolverInterface si(m); const CoinPackedMatrix * smP = si.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim() == 5, return, "cplex", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "cplex", "getMatrixByRow: num elements"); CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[0], 3.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[1], 1.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[2], -2.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[3], -1.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[4], -1.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[5], 2.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[6], 1.1), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[7], 1.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[8], 1.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[9], 2.8), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "cplex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cplex", "getMatrixByRow: elements"); const int * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "cplex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "cplex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "cplex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "cplex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cplex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cplex", "getMatrixByRow: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cplex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cplex", "getMatrixByRow: indices"); } //-------------- // Test rowsense, rhs, rowrange, getMatrixByRow { OsiCpxSolverInterface lhs; { OsiCpxSolverInterface siC1(m); OSIUNITTEST_ASSERT_WARNING(siC1.obj_ == NULL, {}, "cplex", "objective"); OSIUNITTEST_ASSERT_WARNING(siC1.collower_ == NULL, {}, "cplex", "col lower"); OSIUNITTEST_ASSERT_WARNING(siC1.colupper_ == NULL, {}, "cplex", "col upper"); OSIUNITTEST_ASSERT_WARNING(siC1.rowrange_ == NULL, {}, "cplex", "row range"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsense_ == NULL, {}, "cplex", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1.rowlower_ == NULL, {}, "cplex", "row lower"); OSIUNITTEST_ASSERT_WARNING(siC1.rowupper_ == NULL, {}, "cplex", "row upper"); OSIUNITTEST_ASSERT_WARNING(siC1.rhs_ == NULL, {}, "cplex", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1.matrixByRow_ == NULL, {}, "cplex", "matrix by row"); OSIUNITTEST_ASSERT_WARNING(siC1.colsol_ != NULL, {}, "cplex", "col solution"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsol_ != NULL, {}, "cplex", "row solution"); const char * siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "cplex", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "cplex", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "cplex", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "cplex", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "cplex", "row sense"); const double * siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "cplex", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "cplex", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "cplex", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "cplex", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "cplex", "right hand side"); const double * siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "cplex", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "cplex", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "cplex", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "cplex", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "cplex", "row range"); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "cplex", "matrix by row"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "cplex", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "cplex", "matrix by row: num elements"); const double * ev = siC1mbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "cplex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cplex", "matrix by row: elements"); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "cplex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "cplex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "cplex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "cplex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cplex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cplex", "matrix by row: vector starts"); const int * ei = siC1mbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cplex", "matrix by row: indices"); OSIUNITTEST_ASSERT_WARNING(siC1rs == siC1.getRowSense(), {}, "cplex", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "cplex", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1rr == siC1.getRowRange(), {}, "cplex", "row range"); // Change CPLEX Model by adding free row OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb( COIN_DBL_MAX); OsiCuts cuts; cuts.insert(rc); siC1.applyCuts(cuts); // Since model was changed, test that cached data is now freed. OSIUNITTEST_ASSERT_ERROR(siC1.obj_ == NULL, {}, "cplex", "objective"); OSIUNITTEST_ASSERT_ERROR(siC1.collower_ == NULL, {}, "cplex", "col lower"); OSIUNITTEST_ASSERT_ERROR(siC1.colupper_ == NULL, {}, "cplex", "col upper"); OSIUNITTEST_ASSERT_ERROR(siC1.rowrange_ == NULL, {}, "cplex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsense_ == NULL, {}, "cplex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowlower_ == NULL, {}, "cplex", "row lower"); OSIUNITTEST_ASSERT_ERROR(siC1.rowupper_ == NULL, {}, "cplex", "row upper"); OSIUNITTEST_ASSERT_ERROR(siC1.rhs_ == NULL, {}, "cplex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByRow_ == NULL, {}, "cplex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByCol_ == NULL, {}, "cplex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.colsol_ == NULL, {}, "cplex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsol_ == NULL, {}, "cplex", "free cached data after adding row"); siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "cplex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "cplex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "cplex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "cplex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "cplex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "cplex", "row sense after adding row"); siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "cplex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "cplex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "cplex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "cplex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "cplex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "cplex", "right hand side after adding row"); siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "cplex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "cplex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "cplex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "cplex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "cplex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "cplex", "row range after adding row"); lhs = siC1; } // Test that lhs has correct values even though siC1 has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.obj_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.collower_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.colupper_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowrange_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsense_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowlower_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowupper_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rhs_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByRow_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByCol_ == NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.colsol_ != NULL, {}, "cplex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsol_ != NULL, {}, "cplex", "freed origin after assignment"); const char * lhsrs = lhs.getRowSense(); OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "cplex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "cplex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "cplex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "cplex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "cplex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "cplex", "row sense after assignment"); const double * lhsrhs = lhs.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "cplex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "cplex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "cplex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "cplex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "cplex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "cplex", "right hand side after assignment"); const double *lhsrr = lhs.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "cplex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "cplex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "cplex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "cplex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "cplex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "cplex", "row range after assignment"); const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "cplex", "matrix by row after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "cplex", "matrix by row after assignment: major dim"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "cplex", "matrix by row after assignment: num elements"); const double * ev = lhsmbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "cplex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cplex", "matrix by row after assignment: elements"); const CoinBigIndex * mi = lhsmbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "cplex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "cplex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "cplex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "cplex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cplex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cplex", "matrix by row after assignment: vector starts"); const int * ei = lhsmbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cplex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cplex", "matrix by row after assignment: indices"); } } // Do common solverInterface testing by calling the // base class testing method. { OsiCpxSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir); } } #endif CoinMP-1.8.3/Osi/test/OsiTestSolverInterface.hpp0000644000175000017500000010172111575423733020160 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This file is licensed under the terms of Eclipse Public License (EPL). // this is a copy of OsiVolSolverInterface (trunk rev. 1466) renamed to OsiTestSolverInterface #ifndef OsiTestSolverInterface_H #define OsiTestSolverInterface_H #include #include "OsiTestSolver.hpp" #include "CoinPackedMatrix.hpp" #include "OsiSolverInterface.hpp" static const double OsiTestInfinity = 1.0e31; //############################################################################# /** Vol(ume) Solver Interface Instantiation of OsiTestSolverInterface for the Volume Algorithm */ class OsiTestSolverInterface : virtual public OsiSolverInterface, public VOL_user_hooks { friend void OsiTestSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); private: class OsiVolMatrixOneMinusOne_ { int majorDim_; int minorDim_; int plusSize_; int * plusInd_; int * plusStart_; int * plusLength_; int minusSize_; int * minusInd_; int * minusStart_; int * minusLength_; public: OsiVolMatrixOneMinusOne_(const CoinPackedMatrix& m); ~OsiVolMatrixOneMinusOne_(); void timesMajor(const double* x, double* y) const; }; public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound() { throw CoinError("Sorry, the Volume Algorithm doesn't implement B&B", "branchAndBound", "OsiTestSolverInterface"); } //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Set a string parameter bool setStrParam(OsiStrParam key, const std::string & value); // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ //@{ /*! \brief Get an empty warm start object This routine returns an empty warm start object. Its purpose is to provide a way to give a client a warm start object of the appropriate type, which can resized and modified as desired. */ virtual CoinWarmStart *getEmptyWarmStart () const ; /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching).
The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const { return rowMatrixCurrent_? rowMatrix_.getNumCols() : colMatrix_.getNumCols(); } /// Get number of rows virtual int getNumRows() const { return rowMatrixCurrent_? rowMatrix_.getNumRows() : colMatrix_.getNumRows(); } /// Get number of nonzero elements virtual int getNumElements() const { return rowMatrixCurrent_? rowMatrix_.getNumElements() : colMatrix_.getNumElements(); } /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const { return collower_; } /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const { return colupper_; } /** Get pointer to array[getNumRows()] of row constraint senses.
  • 'L' <= constraint
  • 'E' = constraint
  • 'G' >= constraint
  • 'R' ranged constraint
  • 'N' free constraint
*/ virtual const char * getRowSense() const { return rowsense_; } /** Get pointer to array[getNumRows()] of rows right-hand sides
  • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
  • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'N' then rhs()[i] == 0.0
*/ virtual const double * getRightHandSide() const { return rhs_; } /** Get pointer to array[getNumRows()] of row ranges.
  • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
  • if rowsense()[i] != 'R' then rowrange()[i] is undefined
*/ virtual const double * getRowRange() const { return rowrange_; } /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const { return rowlower_; } /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const { return rowupper_; } /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const { return objcoeffs_; } /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const { return objsense_; } /// Return true if column is continuous virtual bool isContinuous(int colNumber) const; #if 0 /// Return true if column is binary virtual bool isBinary(int colNumber) const; /** Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ virtual bool isInteger(int colNumber) const; /// Return true if column is general integer virtual bool isIntegerNonBinary(int colNumber) const; /// Return true if column is binary and not fixed at either bound virtual bool isFreeBinary(int colNumber) const; #endif /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const { return OsiTestInfinity; } //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const { return colsol_; } /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const { return rowprice_; } /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const { return rc_; } /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const { return lhs_; } /// Get objective function value virtual double getObjValue() const { #if 1 // This does not pass unitTest if getObjValue is called before solve return lagrangeanCost_; #else return OsiSolverInterface::getObjValue(); #endif } /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const { return volprob_.iter(); } /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay = false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; #if 0 /** Get indices of solution vector which are integer variables presently at fractional values */ virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const; #endif //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ) { objcoeffs_[elementIndex] = elementValue; } using OsiSolverInterface::setColLower ; /** Set a single column lower bound
Use -COIN_DBL_MAX for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ) { collower_[elementIndex] = elementValue; } using OsiSolverInterface::setColUpper ; /** Set a single column upper bound
Use COIN_DBL_MAX for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ) { colupper_[elementIndex] = elementValue; } /** Set a single column lower and upper bound */ virtual void setColBounds( int elementIndex, double lower, double upper ) { collower_[elementIndex] = lower; colupper_[elementIndex] = upper; } /** Set the bounds on a number of columns simultaneously
The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound
Use -COIN_DBL_MAX for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ) { rowlower_[elementIndex] = elementValue; convertBoundToSense(elementValue, rowupper_[elementIndex], rowsense_[elementIndex], rhs_[elementIndex], rowrange_[elementIndex]); } /** Set a single row upper bound
Use COIN_DBL_MAX for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ) { rowupper_[elementIndex] = elementValue; convertBoundToSense(rowlower_[elementIndex], elementValue, rowsense_[elementIndex], rhs_[elementIndex], rowrange_[elementIndex]); } /** Set a single row lower and upper bound */ virtual void setRowBounds( int elementIndex, double lower, double upper ) { rowlower_[elementIndex] = lower; rowupper_[elementIndex] = upper; convertBoundToSense(lower, upper, rowsense_[elementIndex], rhs_[elementIndex], rowrange_[elementIndex]); } /** Set the type of a single row
*/ virtual void setRowType(int index, char sense, double rightHandSide, double range) { rowsense_[index] = sense; rhs_[index] = rightHandSide; rowrange_[index] = range; convertSenseToBound(sense, rightHandSide, range, rowlower_[index], rowupper_[index]); } /** Set the bounds on a number of rows simultaneously
The default implementation just invokes setRowLower() and setRowUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
The default implementation just invokes setRowType() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose any characteristics changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s ) { objsense_ = s < 0 ? -1.0 : 1.0; } /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ using OsiSolverInterface::addCol ; /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); using OsiSolverInterface::addCols ; /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); #if 0 /** */ virtual void addCols(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj); #endif /** */ virtual void deleteCols(const int num, const int * colIndices); using OsiSolverInterface::addRow ; /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); using OsiSolverInterface::addRows ; /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); #if 0 /** */ virtual void addRows(const CoinPackedMatrix& matrix, const double* rowlb, const double* rowub); /** */ virtual void addRows(const CoinPackedMatrix& matrix, const char* rowsen, const double* rowrhs, const double* rowrng); #endif /** */ virtual void deleteRows(const int num, const int * rowIndices); //----------------------------------------------------------------------- #if 0 /** Apply a collection of cuts.
Only cuts which have an effectiveness >= effectivenessLb are applied.
  • ReturnCode.numberIneffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
  • ReturnCode.numberInconsistent() -- number of invalid cuts
  • ReturnCode.numberInconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
  • ReturnCode.numberInfeasible() -- number of cuts that would make this integer model infeasible
  • ReturnCode.numberApplied() -- number of integer cuts which were applied to the integer model
  • cs.size() == numberIneffective() + numberInconsistent() + numberInconsistentWrtIntegerModel() + numberInfeasible() + nubmerApplied()
*/ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); #endif //@} //@} //--------------------------------------------------------------------------- protected: /**@name Helper methods for problem input */ void initFromRlbRub(const int rownum, const double* rowlb, const double* rowub); void initFromRhsSenseRange(const int rownum, const char* rowsen, const double* rowrhs, const double* rowrng); void initFromClbCubObj(const int colnum, const double* collb, const double* colub, const double* obj); public: /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient
*/ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • obj: all variables have 0 objective coefficient
  • rowsen: all rows are >=
  • rowrhs: all right hand sides are 0
  • rowrng: 0 for the ranged rows
*/ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); using OsiSolverInterface::readMps ; /** Read an mps file from the given filename */ virtual int readMps(const char *filename, const char *extension = "mps"); /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; //@} //--------------------------------------------------------------------------- /**@name OSL specific public interfaces */ //@{ /// Get pointer to Vol model VOL_problem* volprob() { return &volprob_; } //@} //--------------------------------------------------------------------------- /**@name Constructors and destructors */ //@{ /// Default Constructor OsiTestSolverInterface (); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiTestSolverInterface (const OsiTestSolverInterface &); /// Assignment operator OsiTestSolverInterface & operator=(const OsiTestSolverInterface& rhs); /// Destructor virtual ~OsiTestSolverInterface (); //@} //--------------------------------------------------------------------------- protected: ///@name Protected methods //@{ /** Apply a row cut (append to constraint matrix). */ virtual void applyRowCut(const OsiRowCut& rc); /** Apply a column cut (adjust one or more bounds). */ virtual void applyColCut(const OsiColCut& cc); //@} //--------------------------------------------------------------------------- private: /**@name Methods of VOL_user_hooks */ //@{ /// compute reduced costs virtual int compute_rc(const VOL_dvector& u, VOL_dvector& rc); /// Solve the subproblem for the subgradient step. virtual int solve_subproblem(const VOL_dvector& dual, const VOL_dvector& rc, double& lcost, VOL_dvector& x, VOL_dvector& v, double& pcost); /** Starting from the primal vector x, run a heuristic to produce an integer solution. This is not done in LP solving. */ virtual int heuristics(const VOL_problem& /*p*/, const VOL_dvector& /*x*/, double& heur_val) { heur_val = COIN_DBL_MAX; return 0; } //@} //--------------------------------------------------------------------------- private: /**@name Private helper methods */ //@{ /** Update the row ordered matrix from the column ordered one */ void updateRowMatrix_() const; /** Update the column ordered matrix from the row ordered one */ void updateColMatrix_() const; /** Test whether the Volume Algorithm can be applied to the given problem. */ void checkData_() const; /** Compute the reduced costs (rc) with respect to the dual values given in u. */ void compute_rc_(const double* u, double* rc) const; /** A method deleting every member data */ void gutsOfDestructor_(); /** A method allocating sufficient space for the rim vectors corresponding to the rows. */ void rowRimAllocator_(); /** A method allocating sufficient space for the rim vectors corresponding to the columns. */ void colRimAllocator_(); /** Reallocate the rim arrays corresponding to the rows. */ void rowRimResize_(const int newSize); /** Reallocate the rim arrays corresponding to the columns. */ void colRimResize_(const int newSize); /** For each row convert LB/UB style row constraints to sense/rhs style. */ void convertBoundsToSenses_(); /** For each row convert sense/rhs style row constraints to LB/UB style. */ void convertSensesToBounds_(); /** test whether the given matrix is 0/1/-1 entries only. */ bool test_zero_one_minusone_(const CoinPackedMatrix& m) const; //@} //--------------------------------------------------------------------------- private: //--------------------------------------------------------------------------- /**@name The problem matrix in row and column ordered forms
Note that at least one of the matrices is always current. */ //@{ /// A flag indicating whether the row ordered matrix is up-to-date mutable bool rowMatrixCurrent_; /// The problem matrix in a row ordered form mutable CoinPackedMatrix rowMatrix_; /// A flag indicating whether the column ordered matrix is up-to-date mutable bool colMatrixCurrent_; /// The problem matrix in a column ordered form mutable CoinPackedMatrix colMatrix_; //@} //--------------------------------------------------------------------------- /**@name Data members used when 0/1/-1 matrix is detected */ //@{ /// An indicator whether the matrix is 0/1/-1 bool isZeroOneMinusOne_; /// The row ordered matrix without the elements OsiVolMatrixOneMinusOne_* rowMatrixOneMinusOne_; /// The column ordered matrix without the elements OsiVolMatrixOneMinusOne_* colMatrixOneMinusOne_; //@} //--------------------------------------------------------------------------- /**@name The rim vectors */ //@{ /// Pointer to dense vector of structural variable upper bounds double *colupper_; /// Pointer to dense vector of structural variable lower bounds double *collower_; /// Pointer to dense vector of bool to indicate if column is continuous bool *continuous_; /// Pointer to dense vector of slack variable upper bounds double *rowupper_; /// Pointer to dense vector of slack variable lower bounds double *rowlower_; /// Pointer to dense vector of row sense indicators char *rowsense_; /// Pointer to dense vector of row right-hand side values double *rhs_; /** Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows). */ double *rowrange_; /// Pointer to dense vector of objective coefficients double *objcoeffs_; //@} //--------------------------------------------------------------------------- /// Sense of objective (1 for min; -1 for max) double objsense_; //--------------------------------------------------------------------------- /**@name The solution */ //@{ /// Pointer to dense vector of primal structural variable values double *colsol_; /// Pointer to dense vector of dual row variable values double *rowprice_; /// Pointer to dense vector of reduced costs double *rc_; /// Pointer to dense vector of left hand sides (row activity levels) double *lhs_; /// The Lagrangean cost, a lower bound on the objective value double lagrangeanCost_; //@} //--------------------------------------------------------------------------- /** An array to store the hotstart information between solveHotStart() calls */ double *rowpriceHotStart_; /// allocated size of the row related rim vectors int maxNumrows_; /// allocated size of the column related rim vectors int maxNumcols_; /// The volume solver VOL_problem volprob_; }; /** A function that tests the methods in the OsiTestSolverInterface class. */ void OsiTestSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Osi/test/OsiTestSolverInterfaceIO.cpp0000644000175000017500000003067011536304054020376 0ustar renerene// Copyright (C) 2001, International Business Machines // Corporation and others. All Rights Reserved. // This file is licensed under the terms of Eclipse Public License (EPL). // this is a copy of OsiVolSolverInterface (trunk rev. 1466) renamed to OsiTestSolverInterface #include "CoinPragma.hpp" #include #include #include "CoinHelperFunctions.hpp" #include "CoinMpsIO.hpp" #include "OsiTestSolverInterface.hpp" //############################################################################# void OsiTestSolverInterface::initFromRlbRub(const int rownum, const double* rowlb, const double* rowub) { if (maxNumrows_ > 0) { rowRimAllocator_(); if (rowub) { CoinDisjointCopyN(rowub, rownum, rowupper_); } else { CoinFillN(rowupper_, rownum, getInfinity()); } if (rowlb) { CoinDisjointCopyN(rowlb, rownum, rowlower_); } else { CoinFillN(rowlower_, rownum, -getInfinity()); } // Set the initial dual solution CoinFillN(rowprice_, rownum, 0.0); convertBoundsToSenses_(); } } //############################################################################# void OsiTestSolverInterface::initFromRhsSenseRange(const int rownum, const char* rowsen, const double* rowrhs, const double* rowrng) { if (maxNumrows_ > 0) { rowRimAllocator_(); if (rowsen) { CoinDisjointCopyN(rowsen, rownum, rowsense_); } else { CoinFillN(rowsense_, rownum, 'G'); } if (rowrhs) { CoinDisjointCopyN(rowrhs, rownum, rhs_); } else { CoinFillN(rhs_, rownum, 0.0); } if (rowrng) { CoinDisjointCopyN(rowrng, rownum, rowrange_); } else { CoinFillN(rowrange_, rownum, 0.0); } // Set the initial dual solution CoinFillN(rowprice_, rownum, 0.0); convertSensesToBounds_(); } } //############################################################################# void OsiTestSolverInterface::initFromClbCubObj(const int colnum, const double* collb, const double* colub, const double* obj) { if (maxNumcols_ > 0) { colRimAllocator_(); if (colub) { CoinDisjointCopyN(colub, colnum, colupper_); } else { CoinFillN(colupper_, colnum, getInfinity()); } if (collb) { CoinDisjointCopyN(collb, colnum, collower_); } else { CoinFillN(collower_, colnum, 0.0); } CoinFillN(continuous_,colnum,true); if (obj) { CoinDisjointCopyN(obj, colnum, objcoeffs_); } else { CoinFillN(objcoeffs_, colnum, 0.0); } int c; for ( c=0; c((1+colMatrix_.getExtraGap()) * colMatrix_.getMinorDim()); } else { rowMatrix_.setExtraGap(matrix.getExtraGap()); rowMatrix_.setExtraMajor(matrix.getExtraMajor()); rowMatrix_ = matrix; rowMatrixCurrent_ = true; colMatrixCurrent_ = false; maxNumcols_ = static_cast((1+rowMatrix_.getExtraGap()) * rowMatrix_.getMinorDim()); maxNumrows_ = rowMatrix_.getMaxMajorDim(); } initFromRlbRub(rownum, rowlb, rowub); initFromClbCubObj(colnum, collb, colub, obj); } //----------------------------------------------------------------------- void OsiTestSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub) { gutsOfDestructor_(); const int rownum = matrix->getNumRows(); const int colnum = matrix->getNumCols(); maxNumcols_ = colnum; maxNumrows_ = rownum; if (matrix->isColOrdered()) { colMatrix_.swap(*matrix); colMatrixCurrent_ = true; rowMatrixCurrent_ = false; } else { rowMatrix_.swap(*matrix); rowMatrixCurrent_ = true; colMatrixCurrent_ = false; } delete matrix; matrix = 0; rowupper_ = rowub; rowub = 0; rowlower_ = rowlb; rowlb = 0; colupper_ = colub; colub = 0; collower_ = collb; collb = 0; objcoeffs_ = obj; obj = 0; if (maxNumrows_ > 0) { if (!rowupper_) { rowupper_ = new double[maxNumrows_]; CoinFillN(rowupper_, rownum, getInfinity()); } if (!rowlower_) { rowlower_ = new double[maxNumrows_]; CoinFillN(rowlower_, rownum, -getInfinity()); } rowsense_ = new char[maxNumrows_]; rhs_ = new double[maxNumrows_]; rowrange_ = new double[maxNumrows_]; rowprice_ = new double[maxNumrows_]; lhs_ = new double[maxNumrows_]; // Set the initial dual solution CoinFillN(rowprice_, rownum, 0.0); convertBoundsToSenses_(); } if (maxNumcols_ > 0) { if (!colupper_) { colupper_ = new double[maxNumcols_]; CoinFillN(colupper_, colnum, getInfinity()); } if (!collower_) { collower_ = new double[maxNumcols_]; CoinFillN(collower_, colnum, -getInfinity()); } if (!objcoeffs_) { objcoeffs_ = new double[maxNumcols_]; CoinFillN(objcoeffs_, colnum, -getInfinity()); } colsol_ = new double[maxNumcols_]; int c; for ( c=0; c((1+colMatrix_.getExtraGap()) * colMatrix_.getMinorDim()); } else { rowMatrix_ = matrix; rowMatrixCurrent_ = true; colMatrixCurrent_ = false; maxNumcols_ = static_cast((1+rowMatrix_.getExtraGap()) * rowMatrix_.getMinorDim()); maxNumrows_ = rowMatrix_.getMaxMajorDim(); } initFromRhsSenseRange(rownum, rowsen, rowrhs, rowrng); initFromClbCubObj(colnum, collb, colub, obj); } //----------------------------------------------------------------------- void OsiTestSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng) { gutsOfDestructor_(); const int rownum = matrix->getNumRows(); const int colnum = matrix->getNumCols(); maxNumcols_ = colnum; maxNumrows_ = rownum; if (matrix->isColOrdered()) { colMatrix_.swap(*matrix); colMatrixCurrent_ = true; rowMatrixCurrent_ = false; } else { rowMatrix_.swap(*matrix); rowMatrixCurrent_ = true; colMatrixCurrent_ = false; } delete matrix; matrix = 0; rowsense_ = rowsen; rowsen = 0; rhs_ = rowrhs; rowrhs = 0; rowrange_ = rowrng; rowrng = 0; colupper_ = colub; colub = 0; collower_ = collb; collb = 0; objcoeffs_ = obj; obj = 0; if (maxNumrows_ > 0) { if (!rowsense_) { rowsense_ = new char[maxNumrows_]; CoinFillN(rowsense_, rownum, 'G'); } if (!rhs_) { rhs_ = new double[maxNumrows_]; CoinFillN(rhs_, rownum, 0.0); } if (!rowrange_) { rowrange_ = new double[maxNumrows_]; CoinFillN(rowrange_, rownum, 0.0); } rowlower_ = new double[maxNumrows_]; rowupper_ = new double[maxNumrows_]; rowprice_ = new double[maxNumrows_]; lhs_ = new double[maxNumrows_]; // Set the initial dual solution CoinFillN(rowprice_, rownum, 0.0); convertSensesToBounds_(); } if (maxNumcols_ > 0) { if (!colupper_) { colupper_ = new double[maxNumcols_]; CoinFillN(colupper_, colnum, getInfinity()); } if (!collower_) { collower_ = new double[maxNumcols_]; CoinFillN(collower_, colnum, -getInfinity()); } if (!objcoeffs_) { objcoeffs_ = new double[maxNumcols_]; CoinFillN(objcoeffs_, colnum, -getInfinity()); } colsol_ = new double[maxNumcols_]; int c; for ( c=0; c((1+colMatrix_.getExtraGap()) * colMatrix_.getMinorDim()); initFromRlbRub(numrows, rowlb, rowub); initFromClbCubObj(numcols, collb, colub, obj); } //----------------------------------------------------------------------- void OsiTestSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) { gutsOfDestructor_(); colMatrix_.copyOf(true, numrows, numcols, start[numcols], value, index, start, 0); colMatrixCurrent_ = true; rowMatrixCurrent_ = false; maxNumcols_ = colMatrix_.getMaxMajorDim(); maxNumrows_ = static_cast((1+colMatrix_.getExtraGap()) * colMatrix_.getMinorDim()); initFromRhsSenseRange(numrows, rowsen, rowrhs, rowrng); initFromClbCubObj(numcols, collb, colub, obj); } //----------------------------------------------------------------------- int OsiTestSolverInterface::readMps(const char *filename, const char *extension) { CoinMpsIO reader; reader.setInfinity(getInfinity()); int retVal = reader.readMps(filename, extension); if (retVal == 0) { loadProblem(*reader.getMatrixByCol(), reader.getColLower(),reader.getColUpper(), reader.getObjCoefficients(), reader.getRowLower(),reader.getRowUpper()); int nc = getNumCols(); assert (continuous_); CoinFillN(continuous_, nc, true); } return retVal; } //----------------------------------------------------------------------- void OsiTestSolverInterface::writeMps(const char *filename, const char *extension, double /*objSense*/) const { CoinMpsIO writer; writer.setMpsData(*getMatrixByCol(), getInfinity(), getColLower(), getColUpper(), getObjCoefficients(), reinterpret_cast (NULL) /*integrality*/, getRowLower(), getRowUpper(), reinterpret_cast (NULL) /*colnam*/, reinterpret_cast (NULL) /*rownam*/); std::string fname = filename; if (extension) { if (extension[0] != '\0' && extension[0] != '.') fname += "." ; } fname += extension; writer.writeMps(fname.c_str()); } CoinMP-1.8.3/Osi/test/OsiTestSolver.cpp0000644000175000017500000004334112101340333016311 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This file is licensed under the terms of Eclipse Public License (EPL). #include #include #include #include #include #include "OsiTestSolver.hpp" //############################################################################# /// Usage: v=w; where w is a VOL_dvector VOL_dvector& VOL_dvector::operator=(const VOL_dvector& w) { if (this == &w) return *this; delete[] v; const int wsz = w.size(); if (wsz == 0) { v = 0; sz = 0; } else { v = new double[sz = wsz]; for (int i = sz - 1; i >= 0; --i) v[i] = w[i]; } return *this; } /// Usage v=w; where w is a double. It copies w in every entry of v VOL_dvector& VOL_dvector::operator=(const double w) { for (int i = sz - 1; i >= 0; --i) v[i] = w; return *this; } //############################################################################# /// Usage: v=w; where w is a VOL_ivector VOL_ivector& VOL_ivector::operator=(const VOL_ivector& w) { if (this == &w) return *this; delete[] v; const int wsz = w.size(); if (wsz == 0) { v = 0; sz = 0; } else { v = new int[sz = wsz]; for (int i = sz - 1; i >= 0; --i) v[i] = w[i]; } return *this; } /// Usage v=w; where w is an int. It copies w in every entry of v VOL_ivector& VOL_ivector::operator=(const int w) { for (int i = sz - 1; i >= 0; --i) v[i] = w; return *this; } //############################################################################ /// find maximum absolute value of the primal violations void VOL_primal::find_max_viol(const VOL_dvector& dual_lb, const VOL_dvector& dual_ub) { const int nc = v.size(); viol = 0; for ( int i = 0; i < nc; ++i ) { if ( (v[i] > 0.0 && dual_ub[i] != 0.0) || (v[i] < 0.0 && dual_lb[i] != 0.0) ) viol = VolMax(viol, VolAbs(v[i])); } } //############################################################################ /// Dual step. It takes a step in the direction v // lcost is a member of VOL_dual void VOL_dual::step(const double target, const double lambda, const VOL_dvector& dual_lb, const VOL_dvector& dual_ub, const VOL_dvector& v) { const int nc = u.size(); int i; double viol = 0.0; for (i = 0; i < nc; ++i) { if (( v[i] > 0.0 && u[i] < dual_ub[i] ) || ( v[i] < 0.0 && u[i] > dual_lb[i] )) { viol += v[i] * v[i]; } } const double stp = viol == 0.0 ? 0.0 : (target - lcost) / viol * lambda; for (i = 0; i < nc; ++i) { if (( v[i] > 0.0 && u[i] < dual_ub[i] ) || ( v[i] < 0.0 && u[i] > dual_lb[i] )) { u[i] += stp * v[i]; if (u[i] < dual_lb[i]) u[i] = dual_lb[i]; else if (u[i] > dual_ub[i]) u[i] = dual_ub[i]; } } } /// ascent = inner product(v, u - last_u) double VOL_dual::ascent(const VOL_dvector& v, const VOL_dvector& last_u) const { const int nc = u.size(); int i; double asc = 0.0; for (i = 0; i < nc; ++i) asc += v[i] * (u[i] - last_u[i]); return asc; } /** compute xrc. This is (c - u A) * ( xstar - x ). This is just miscellaneous information, it is not used in the algorithm. */ void VOL_dual::compute_xrc(const VOL_dvector& xstar, const VOL_dvector& x, const VOL_dvector& rc) { const int nc = x.size(); xrc = 0; for (int i = 0; i < nc; ++i) { xrc += rc[i] * (xstar[i] - x[i]); } } //############################################################################ /** Computing inner products. It computes v * ( alpha v + (1-alpha) h), v * h, v * v, h * h. Here v is the subgradient direction, and h is the conjugate direction. */ VOL_vh::VOL_vh(const double alpha, const VOL_dvector& dual_lb, const VOL_dvector& dual_ub, const VOL_dvector& v, const VOL_dvector& vstar, const VOL_dvector& u) : hh(0), norm(0), vh(0), asc(0) { int i; const int nc = vstar.size(); double vv; for (i = 0; i < nc; ++i) { const double vi = v[i]; const double vsi = vstar[i]; vv = alpha * vi + (1.0 - alpha) * vsi; if (u[i] == 0.0 && dual_lb[i] == 0.0 && vv <= 0.0) continue; if (u[i] == 0.0 && dual_ub[i] == 0.0 && vv >= 0.0) continue; asc += vi * vv; vh += vi * vsi; norm += vi * vi; hh += vsi * vsi; } } //############################################################################ /** Computes indicators for printing. They are v2=vstar * vstar, asc= v*v, vu= vstar * u, vabs = sum( abs(vstar[i]))/m, v2= sum( vstar[i]^2) / m. */ VOL_indc::VOL_indc(const VOL_dvector& dual_lb, const VOL_dvector& dual_ub, const VOL_primal& primal, const VOL_primal& pstar, const VOL_dual& dual) { v2 = vu = vabs = asc = 0.0; const VOL_dvector v = primal.v; const VOL_dvector vstar = pstar.v; const VOL_dvector u = dual.u; int i; const int nc = vstar.size(); for (i = 0; i < nc; ++i) { if (u[i] == 0.0 && dual_lb[i] == 0.0 && vstar[i] <= 0.0) continue; if (u[i] == 0.0 && dual_ub[i] == 0.0 && vstar[i] >= 0.0) continue; v2 += vstar[i] * vstar[i]; asc += v[i] * v[i]; vu -= vstar[i] * u[i]; vabs += VolAbs(vstar[i]); } v2 = sqrt(v2) / nc; vabs /= nc; } //############################################################################ // reading parameters that control the algorithm void VOL_problem::read_params(const char* filename) { char s[100]; FILE* infile = fopen(filename, "r"); if (!infile) { printf("Failure to open file: %s\n", filename); abort(); } while (fgets(s, 100, infile)) { const size_t len = strlen(s) - 1; if (s[len] == '\n') s[len] = 0; std::string ss(s); if (ss.find("temp_dualfile") == 0) { size_t i = ss.find("="); size_t i1 = ss.length()-i-1; std::string sss = ss.substr(i+1,i1); parm.temp_dualfile = new char[sss.length() + 1]; memcpy(parm.temp_dualfile, sss.c_str(), sss.length()); parm.temp_dualfile[sss.length()] = 0; } else if (ss.find("ubinit") == 0) { size_t i = ss.find("="); parm.ubinit = atof(&s[i+1]); } else if (ss.find("printflag") == 0) { size_t i = ss.find("="); parm.printflag = atoi(&s[i+1]); } else if (ss.find("printinvl") == 0) { size_t i = ss.find("="); parm.printinvl = atoi(&s[i+1]); } else if (ss.find("maxsgriters") == 0) { size_t i = ss.find("="); parm.maxsgriters = atoi(&s[i+1]); } else if (ss.find("heurinvl") == 0) { size_t i = ss.find("="); parm.heurinvl = atoi(&s[i+1]); } else if (ss.find("greentestinvl") == 0) { size_t i = ss.find("="); parm.greentestinvl = atoi(&s[i+1]); } else if (ss.find("yellowtestinvl") == 0) { size_t i = ss.find("="); parm.yellowtestinvl = atoi(&s[i+1]); } else if (ss.find("redtestinvl") == 0) { size_t i = ss.find("="); parm.redtestinvl = atoi(&s[i+1]); } else if (ss.find("lambdainit") == 0) { size_t i = ss.find("="); parm.lambdainit = atof(&s[i+1]); } else if (ss.find("alphainit") == 0) { size_t i = ss.find("="); parm.alphainit = atof(&s[i+1]); } else if (ss.find("alphamin") == 0) { size_t i = ss.find("="); parm.alphamin = atof(&s[i+1]); } else if (ss.find("alphafactor") == 0) { size_t i = ss.find("="); parm.alphafactor = atof(&s[i+1]); } else if (ss.find("alphaint") == 0) { size_t i = ss.find("="); parm.alphaint = atoi(&s[i+1]); } else if (ss.find("primal_abs_precision") == 0) { size_t i = ss.find("="); parm.primal_abs_precision = atof(&s[i+1]); // } else if (ss.find("primal_rel_precision") == 0) { // size_t i = ss.find("="); // parm.primal_rel_precision = atof(&s[i+1]); } else if (ss.find("gap_abs_precision") == 0) { size_t i = ss.find("="); parm.gap_abs_precision = atof(&s[i+1]); } else if (ss.find("gap_rel_precision") == 0) { size_t i = ss.find("="); parm.gap_rel_precision = atof(&s[i+1]); } else if (ss.find("ascent_check_invl") == 0) { size_t i = ss.find("="); parm.ascent_check_invl = atoi(&s[i+1]); } else if (ss.find("minimum_rel_ascent") == 0) { size_t i = ss.find("="); parm.minimum_rel_ascent = atoi(&s[i+1]); } else if (ss.find("granularity") == 0) { size_t i = ss.find("="); parm.granularity = atof(&s[i+1]); } } fclose(infile); } //############################################################################# void VOL_problem::set_default_parm() { parm.lambdainit = 0.1; parm.alphainit = 0.01; parm.alphamin = 0.001; parm.alphafactor = 0.5; parm.ubinit = COIN_DBL_MAX; parm.primal_abs_precision = 0.02; // parm.primal_rel_precision = 0.01; parm.gap_abs_precision = 0.0; parm.gap_rel_precision = 0.001; parm.granularity = 0.0; parm.minimum_rel_ascent = 0.0001; parm.ascent_first_check = 500; parm.ascent_check_invl = 100; parm.maxsgriters = 2000; parm.printflag = 3; parm.printinvl = 50; parm.heurinvl = 100000000; parm.greentestinvl = 1; parm.yellowtestinvl = 2; parm.redtestinvl = 10; parm.alphaint = 80; parm.temp_dualfile = 0; } //############################################################################# VOL_problem::VOL_problem() : alpha_(-1), lambda_(-1), iter_(0), value(-1), psize(-1), dsize(-1) { set_default_parm(); } // VOL_problem::VOL_problem(const char *filename) : alpha_(-1), lambda_(-1), iter_(0), value(-1), psize(-1), dsize(-1) { set_default_parm(); read_params(filename); } //###################################################################### VOL_problem::~VOL_problem() { delete[] parm.temp_dualfile; } //###################################################################### /// print information about the current iteration void VOL_problem::print_info(const int iter, const VOL_primal& primal, const VOL_primal& pstar, const VOL_dual& dual) { VOL_indc indc(dual_lb, dual_ub, primal, pstar, dual); printf("%i. L=%f P=%f vu=%f infeas=%f\n asc=%f vmax=%f P-vu=%f xrc =%f\n", iter, dual.lcost, pstar.value, indc.vu, indc.v2, indc.asc, pstar.viol, pstar.value - indc.vu, dual.xrc); } //###################################################################### /// this is the Volume Algorithm int VOL_problem::solve(VOL_user_hooks& hooks, const bool use_preset_dual) { if (initialize(use_preset_dual) < 0) // initialize several parameters return -1; double best_ub = parm.ubinit; // upper bound int retval = 0; VOL_dvector rc(psize); // reduced costs VOL_dual dual(dsize); // dual vector dual.u = dsol; VOL_primal primal(psize, dsize); // primal vector retval = hooks.compute_rc(dual.u, rc); // compute reduced costs if (retval < 0) return -1; // solve relaxed problem retval = hooks.solve_subproblem(dual.u, rc, dual.lcost, primal.x, primal.v, primal.value); if (retval < 0) return -1; // set target for the lagrangian value double target = readjust_target(-COIN_DBL_MAX/2, dual.lcost); // find primal violation primal.find_max_viol(dual_lb, dual_ub); // this may be left out for speed VOL_primal pstar(primal); // set pstar=primal pstar.find_max_viol(dual_lb, dual_ub); // set violation of pstar dual.compute_xrc(pstar.x, primal.x, rc); // compute xrc // VOL_dual dstar(dual); // dstar is the best dual solution so far VOL_dual dlast(dual); // set dlast=dual iter_ = 0; if (parm.printflag) print_info(iter_, primal, pstar, dual); VOL_swing swing; VOL_alpha_factor alpha_factor; double * lcost_sequence = new double[parm.ascent_check_invl]; const int ascent_first_check = VolMax(parm.ascent_first_check, parm.ascent_check_invl); for (iter_ = 1; iter_ <= parm.maxsgriters; ++iter_) { // main iteration dlast = dual; // take a dual step dual.step(target, lambda_, dual_lb, dual_ub, pstar.v); // compute reduced costs retval = hooks.compute_rc(dual.u, rc); if (retval < 0) break; // solve relaxed problem retval = hooks.solve_subproblem(dual.u, rc, dual.lcost, primal.x, primal.v, primal.value); if (retval < 0) break; // set the violation of primal primal.find_max_viol(dual_lb, dual_ub); // this may be left out for speed dual.compute_xrc(pstar.x, primal.x, rc); // compute xrc if (dual.lcost > dstar.lcost) { dstar = dual; // update dstar } // check if target should be updated target = readjust_target(target, dstar.lcost); // compute inner product between the new subgradient and the // last direction. This to decide among green, yellow, red const double ascent = dual.ascent(primal.v, dlast.u); // green, yellow, red swing.cond(dlast, dual.lcost, ascent, iter_); // change lambda if needed lambda_ *= swing.lfactor(parm, lambda_, iter_); if (iter_ % parm.alphaint == 0) { // change alpha if needed const double fact = alpha_factor.factor(parm, dstar.lcost, alpha_); if (fact != 1.0 && (parm.printflag & 2)) { printf(" ------------decreasing alpha to %f\n", alpha_*fact); } alpha_ *= fact; } // convex combination with new primal vector pstar.cc(power_heur(primal, pstar, dual), primal); pstar.find_max_viol(dual_lb, dual_ub); // find maximum violation of pstar if (swing.rd) dual = dstar; // if there is no improvement reset dual=dstar if ((iter_ % parm.printinvl == 0) && parm.printflag) { // printing iteration information print_info(iter_, primal, pstar, dual); swing.print(); } if (iter_ % parm.heurinvl == 0) { // run primal heuristic double ub = COIN_DBL_MAX; retval = hooks.heuristics(*this, pstar.x, ub); if (retval < 0) break; if (ub < best_ub) best_ub = ub; } // save dual solution every 500 iterations if (iter_ % 500 == 0 && parm.temp_dualfile != 0) { FILE* outfile = fopen(parm.temp_dualfile, "w"); const VOL_dvector& u = dstar.u; const int m = u.size(); for (int i = 0; i < m; ++i) { fprintf(outfile, "%i %f\n", i+1, u[i]); } fclose(outfile); } // test terminating criteria const bool primal_feas = (pstar.viol < parm.primal_abs_precision); //const double gap = VolAbs(pstar.value - dstar.lcost); const double gap = pstar.value - dstar.lcost; const bool small_gap = VolAbs(dstar.lcost) < 0.0001 ? (gap < parm.gap_abs_precision) : ( (gap < parm.gap_abs_precision) || (gap/VolAbs(dstar.lcost) < parm.gap_rel_precision) ); // test optimality if (primal_feas && small_gap){ if (parm.printflag) printf(" small lp gap \n"); break; } // test proving integer optimality if (best_ub - dstar.lcost < parm.granularity){ if (parm.printflag) printf(" small ip gap \n"); break; } // test for non-improvement const int k = iter_ % parm.ascent_check_invl; if (iter_ > ascent_first_check) { if (dstar.lcost - lcost_sequence[k] < VolAbs(lcost_sequence[k]) * parm.minimum_rel_ascent){ if (parm.printflag) printf(" small improvement \n"); break; } } lcost_sequence[k] = dstar.lcost; } delete[] lcost_sequence; if (parm.printflag) print_info(iter_, primal, pstar, dual); // set solution to return value = dstar.lcost; psol = pstar.x; dsol = dstar.u; viol = pstar.v; return retval; } /// A function to initialize a few variables int VOL_problem::initialize(const bool use_preset_dual) { // setting bounds for dual variables if (dual_lb.size() > 0) { if (dual_lb.size() != dsize) { printf("size inconsistent (dual_lb)\n"); return -1; } } else { // fill it with -infinity dual_lb.allocate(dsize); dual_lb = - COIN_DBL_MAX; } if (dual_ub.size() > 0) { if (dual_ub.size() != dsize) { printf("size inconsistent (dual_ub)\n"); return -1; } } else { // fill it with infinity dual_ub.allocate(dsize); dual_ub = COIN_DBL_MAX; } // setting initial values for parameters alpha_ = parm.alphainit; lambda_ = parm.lambdainit; // check if there is an initial dual solution if (use_preset_dual) { if (dsol.size() != dsize) { printf("size inconsistent (dsol)\n"); return -1; } } else { dsol.clear(); dsol.allocate(dsize); dsol = 0.0; } return 0; } /// Here we increase the target once we get within 5% of it double VOL_problem::readjust_target(const double oldtarget, const double lcost) const { double target = oldtarget; if (lcost >= target - VolAbs(target) * 0.05) { if (VolAbs(lcost) < 10.0) { target = 10.0; } else { target += 0.025 * VolAbs(target); target = VolMax(target, lcost + 0.05 * VolAbs(lcost)); } if (target != oldtarget && (parm.printflag & 2)) { printf(" **** readjusting target!!! new target = %f *****\n", target); } } return target; } /** Here we decide the value of alpha_fb to be used in the convex combination. More details of this are in doc.ps IN: alpha, primal, pstar, dual OUT: pstar = alpha_fb * pstar + (1 - alpha_fb) * primal */ double VOL_problem::power_heur(const VOL_primal& primal, const VOL_primal& pstar, const VOL_dual& dual) const { const double alpha = alpha_; VOL_vh prod(alpha, dual_lb, dual_ub, primal.v, pstar.v, dual.u); double a_asc = (alpha * prod.norm - prod.vh) / (prod.norm - prod.vh); double alpha_fb; if (prod.norm + prod.hh - 2.0 * prod.vh > 0.0) alpha_fb = (prod.hh - prod.vh) / (prod.norm + prod.hh - 2.0 * prod.vh); else alpha_fb = alpha; if (alpha_fb > alpha) alpha_fb = alpha; if (alpha_fb < a_asc) alpha_fb = a_asc; if (alpha_fb > 1.0) alpha_fb = alpha; if (alpha_fb < 0.0) alpha_fb = alpha / 10.0; return alpha_fb; } CoinMP-1.8.3/Osi/test/OsiGrbSolverInterfaceTest.cpp0000644000175000017500000007440412101340333020571 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for GUROBI // template: OSI Cplex Interface written by T. Achterberg // author: Stefan Vigerske // Humboldt University Berlin // license: this file may be freely distributed under the terms of EPL // comments: please scan this file for '???' and 'TODO' and read the comments //----------------------------------------------------------------------------- // Copyright (C) 2009 Humboldt University Berlin and others. // Corporation and others. All Rights Reserved. #include "CoinPragma.hpp" #include "OsiConfig.h" //#include //#include #include "OsiUnitTests.hpp" #include "OsiGrbSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" // Added so build windows build with dsp files works, // when not building with gurobi. #ifdef COIN_HAS_GRB #include "gurobi_c.h" //-------------------------------------------------------------------------- void OsiGrbSolverInterfaceUnitTest( const std::string & mpsDir, const std::string & netlibDir ) { // Test default constructor { OsiGrbSolverInterface m; OSIUNITTEST_ASSERT_ERROR(m.obj_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.collower_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colupper_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.coltype_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colspace_ == 0, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsense_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rhs_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowrange_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowlower_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowupper_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colsol_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsol_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByCol_ == NULL, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getNumCols() == 0, {}, "gurobi", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getApplicationData() == NULL, {}, "gurobi", "default constructor"); int i=2346; m.setApplicationData(&i); OSIUNITTEST_ASSERT_ERROR(*((int *)(m.getApplicationData())) == i, {}, "gurobi", "default constructor"); } { CoinRelFltEq eq; OsiGrbSolverInterface m; std::string fn = mpsDir+"exmip1"; m.readMps(fn.c_str(),"mps"); { OSIUNITTEST_ASSERT_ERROR(m.getNumCols() == 8, {}, "gurobi", "exmip1 read"); const CoinPackedMatrix * colCopy = m.getMatrixByCol(); OSIUNITTEST_ASSERT_ERROR(colCopy->getNumCols() == 8, {}, "gurobi", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getMajorDim() == 8, {}, "gurobi", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getNumRows() == 5, {}, "gurobi", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getMinorDim() == 5, {}, "gurobi", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getVectorLengths()[7] == 2, {}, "gurobi", "exmip1 matrix"); CoinPackedMatrix revColCopy; revColCopy.reverseOrderedCopyOf(*colCopy); CoinPackedMatrix rev2ColCopy; rev2ColCopy.reverseOrderedCopyOf(revColCopy); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getNumCols() == 8, {}, "gurobi", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getMajorDim() == 8, {}, "gurobi", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getNumRows() == 5, {}, "gurobi", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getMinorDim() == 5, {}, "gurobi", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getVectorLengths()[7] == 2, {}, "gurobi", "twice reverse matrix copy"); } // Test copy constructor and assignment operator { OsiGrbSolverInterface lhs; { OsiGrbSolverInterface im(m); OsiGrbSolverInterface imC1(im); OSIUNITTEST_ASSERT_ERROR(imC1.lp_ != im.lp_, {}, "gurobi", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumCols() == im.getNumCols(), {}, "gurobi", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumRows() == im.getNumRows(), {}, "gurobi", "copy constructor"); OsiGrbSolverInterface imC2(im); OSIUNITTEST_ASSERT_ERROR(imC2.lp_ != im.lp_, {}, "gurobi", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumCols() == im.getNumCols(), {}, "gurobi", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumRows() == im.getNumRows(), {}, "gurobi", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.lp_ != imC2.lp_, {}, "gurobi", "copy constructor"); lhs = imC2; } // Test that lhs has correct values even though rhs has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.lp_ != m.lp_, {}, "gurobi", "assignment operator"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols() == m.getNumCols(), {}, "gurobi", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows() == m.getNumRows(), {}, "gurobi", "copy constructor"); } // Test clone { OsiGrbSolverInterface gurobiSi(m); OsiSolverInterface * siPtr = &gurobiSi; OsiSolverInterface * siClone = siPtr->clone(); OsiGrbSolverInterface * gurobiClone = dynamic_cast(siClone); OSIUNITTEST_ASSERT_ERROR(gurobiClone != NULL, {}, "gurobi", "clone"); OSIUNITTEST_ASSERT_ERROR(gurobiClone->lp_ != gurobiSi.lp_, {}, "gurobi", "clone"); OSIUNITTEST_ASSERT_ERROR(gurobiClone->getNumRows() == gurobiSi.getNumRows(), {}, "gurobi", "clone"); OSIUNITTEST_ASSERT_ERROR(gurobiClone->getNumCols() == m.getNumCols(), {}, "gurobi", "clone"); delete siClone; } // test infinity { OsiGrbSolverInterface si; OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == GRB_INFINITY, {}, "gurobi", "value for infinity"); } { OsiGrbSolverInterface gurobiSi(m); int nc = gurobiSi.getNumCols(); int nr = gurobiSi.getNumRows(); const double * cl = gurobiSi.getColLower(); const double * cu = gurobiSi.getColUpper(); const double * rl = gurobiSi.getRowLower(); const double * ru = gurobiSi.getRowUpper(); OSIUNITTEST_ASSERT_ERROR(nc == 8, return, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(nr == 5, return, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cu[1],4.1), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cu[2],1.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(rl[0],2.5), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(rl[4],3.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(ru[1],2.1), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(ru[4],15.), {}, "gurobi", "read and copy exmip1"); double newCs[8] = {1., 2., 3., 4., 5., 6., 7., 8.}; gurobiSi.setColSolution(newCs); const double * cs = gurobiSi.getColSolution(); OSIUNITTEST_ASSERT_ERROR(eq(cs[0],1.0), {}, "gurobi", "set col solution"); OSIUNITTEST_ASSERT_ERROR(eq(cs[7],8.0), {}, "gurobi", "set col solution"); #if 0 // TODO set and copy of solutions not supported by OsiGrb currently { OsiGrbSolverInterface solnSi(gurobiSi); const double * cs = solnSi.getColSolution(); OSIUNITTEST_ASSERT_ERROR(eq(cs[0],1.0), {}, "gurobi", "set col solution and copy"); OSIUNITTEST_ASSERT_ERROR(eq(cs[7],8.0), {}, "gurobi", "set col solution and copy"); } #endif OSIUNITTEST_ASSERT_ERROR(!eq(cl[3],1.2345), {}, "gurobi", "set col lower"); gurobiSi.setColLower( 3, 1.2345 ); OSIUNITTEST_ASSERT_ERROR( eq(cl[3],1.2345), {}, "gurobi", "set col lower"); OSIUNITTEST_ASSERT_ERROR(!eq(cu[4],10.2345), {}, "gurobi", "set col upper"); gurobiSi.setColUpper( 4, 10.2345 ); OSIUNITTEST_ASSERT_ERROR( eq(cu[4],10.2345), {}, "gurobi", "set col upper"); OSIUNITTEST_ASSERT_ERROR(eq(gurobiSi.getObjCoefficients()[0], 1.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(gurobiSi.getObjCoefficients()[1], 0.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(gurobiSi.getObjCoefficients()[2], 0.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(gurobiSi.getObjCoefficients()[3], 0.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(gurobiSi.getObjCoefficients()[4], 2.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(gurobiSi.getObjCoefficients()[5], 0.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(gurobiSi.getObjCoefficients()[6], 0.0), {}, "gurobi", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(gurobiSi.getObjCoefficients()[7],-1.0), {}, "gurobi", "read and copy exmip1"); } // Test getMatrixByRow method { const OsiGrbSolverInterface si(m); const CoinPackedMatrix * smP = si.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim() == 5, return, "gurobi", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "gurobi", "getMatrixByRow: num elements"); CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[0], 3.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[1], 1.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[2], -2.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[3], -1.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[4], -1.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[5], 2.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[6], 1.1), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[7], 1.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[8], 1.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[9], 2.8), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "gurobi", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "gurobi", "getMatrixByRow: elements"); const int * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "gurobi", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "gurobi", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "gurobi", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "gurobi", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "gurobi", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "gurobi", "getMatrixByRow: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "gurobi", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "gurobi", "getMatrixByRow: indices"); } //-------------- // Test rowsense, rhs, rowrange, getMatrixByRow { OsiGrbSolverInterface lhs; { OsiGrbSolverInterface siC1(m); OSIUNITTEST_ASSERT_WARNING(siC1.obj_ == NULL, {}, "gurobi", "objective"); OSIUNITTEST_ASSERT_WARNING(siC1.collower_ == NULL, {}, "gurobi", "col lower"); OSIUNITTEST_ASSERT_WARNING(siC1.colupper_ == NULL, {}, "gurobi", "col upper"); OSIUNITTEST_ASSERT_WARNING(siC1.rowrange_ == NULL, {}, "gurobi", "row range"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsense_ == NULL, {}, "gurobi", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1.rowlower_ == NULL, {}, "gurobi", "row lower"); OSIUNITTEST_ASSERT_WARNING(siC1.rowupper_ == NULL, {}, "gurobi", "row upper"); OSIUNITTEST_ASSERT_WARNING(siC1.rhs_ == NULL, {}, "gurobi", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1.matrixByRow_ == NULL, {}, "gurobi", "matrix by row"); //TODO OSIUNITTEST_ASSERT_WARNING(siC1.colsol_ != NULL, {}, "gurobi", "col solution"); //TODO OSIUNITTEST_ASSERT_WARNING(siC1.rowsol_ != NULL, {}, "gurobi", "row solution"); const char * siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "gurobi", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "gurobi", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "gurobi", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "gurobi", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "gurobi", "row sense"); const double * siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "gurobi", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "gurobi", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "gurobi", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "gurobi", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "gurobi", "right hand side"); const double * siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "gurobi", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "gurobi", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "gurobi", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "gurobi", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "gurobi", "row range"); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "gurobi", "matrix by row"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "gurobi", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "gurobi", "matrix by row: num elements"); const double * ev = siC1mbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "gurobi", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "gurobi", "matrix by row: elements"); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "gurobi", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "gurobi", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "gurobi", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "gurobi", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "gurobi", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "gurobi", "matrix by row: vector starts"); const int * ei = siC1mbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "gurobi", "matrix by row: indices"); OSIUNITTEST_ASSERT_WARNING(siC1rs == siC1.getRowSense(), {}, "gurobi", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "gurobi", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1rr == siC1.getRowRange(), {}, "gurobi", "row range"); #if 0 // TODO: free rows not really supported by OsiGrb // Change GUROBI Model by adding free row OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb( COIN_DBL_MAX); OsiCuts cuts; cuts.insert(rc); siC1.applyCuts(cuts); // Since model was changed, test that cached data is now freed. OSIUNITTEST_ASSERT_ERROR(siC1.obj_ == NULL, {}, "gurobi", "objective"); OSIUNITTEST_ASSERT_ERROR(siC1.collower_ == NULL, {}, "gurobi", "col lower"); OSIUNITTEST_ASSERT_ERROR(siC1.colupper_ == NULL, {}, "gurobi", "col upper"); OSIUNITTEST_ASSERT_ERROR(siC1.rowrange_ == NULL, {}, "gurobi", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsense_ == NULL, {}, "gurobi", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowlower_ == NULL, {}, "gurobi", "row lower"); OSIUNITTEST_ASSERT_ERROR(siC1.rowupper_ == NULL, {}, "gurobi", "row upper"); OSIUNITTEST_ASSERT_ERROR(siC1.rhs_ == NULL, {}, "gurobi", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByRow_ == NULL, {}, "gurobi", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByCol_ == NULL, {}, "gurobi", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.colsol_ == NULL, {}, "gurobi", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsol_ == NULL, {}, "gurobi", "free cached data after adding row"); siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "gurobi", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "gurobi", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "gurobi", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "gurobi", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "gurobi", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "gurobi", "row sense after adding row"); siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "gurobi", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "gurobi", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "gurobi", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "gurobi", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "gurobi", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "gurobi", "right hand side after adding row"); siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "gurobi", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "gurobi", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "gurobi", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "gurobi", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "gurobi", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "gurobi", "row range after adding row"); #endif lhs = siC1; } // Test that lhs has correct values even though siC1 has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.obj_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.collower_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.colupper_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowrange_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsense_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowlower_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowupper_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rhs_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByRow_ == NULL, {}, "gurobi", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByCol_ == NULL, {}, "gurobi", "freed origin after assignment"); //TODO OSIUNITTEST_ASSERT_ERROR(lhs.colsol_ != NULL, {}, "gurobi", "freed origin after assignment"); //TODO OSIUNITTEST_ASSERT_ERROR(lhs.rowsol_ != NULL, {}, "gurobi", "freed origin after assignment"); #if 0 // TODO: free rows not really supported by OsiGrb const char * lhsrs = lhs.getRowSense(); OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "gurobi", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "gurobi", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "gurobi", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "gurobi", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "gurobi", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "gurobi", "row sense after assignment"); const double * lhsrhs = lhs.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "gurobi", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "gurobi", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "gurobi", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "gurobi", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "gurobi", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "gurobi", "right hand side after assignment"); const double *lhsrr = lhs.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "gurobi", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "gurobi", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "gurobi", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "gurobi", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "gurobi", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "gurobi", "row range after assignment"); const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "gurobi", "matrix by row after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "gurobi", "matrix by row after assignment: major dim"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "gurobi", "matrix by row after assignment: num elements"); const double * ev = lhsmbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "gurobi", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "gurobi", "matrix by row after assignment: elements"); const CoinBigIndex * mi = lhsmbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "gurobi", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "gurobi", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "gurobi", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "gurobi", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "gurobi", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "gurobi", "matrix by row after assignment: vector starts"); const int * ei = lhsmbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "gurobi", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "gurobi", "matrix by row after assignment: indices"); #endif } } // Do common solverInterface testing by calling the // base class testing method. { OsiGrbSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir); } } #endif CoinMP-1.8.3/Osi/test/OsiSpxSolverInterfaceTest.cpp0000644000175000017500000006665612346347404020664 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for SOPLEX // author: Tobias Pfender // Konrad-Zuse-Zentrum Berlin (Germany) // license: this file may be freely distributed under the terms of EPL // date: 01/17/2002 //----------------------------------------------------------------------------- // Copyright (C) 2002, Tobias Pfender, International Business Machines // Corporation and others. All Rights Reserved. // // Last edit: $Id: OsiSpxSolverInterfaceTest.cpp 1967 2014-06-12 16:02:12Z stefan $ #include "CoinPragma.hpp" #include "OsiConfig.h" // Added so windows build with dsp files works, // when not building with soplex. #ifdef COIN_HAS_SOPLEX #include "OsiUnitTests.hpp" #include "OsiRowCut.hpp" #include "OsiCuts.hpp" #include "CoinFloatEqual.hpp" #include "CoinPackedMatrix.hpp" //#include #ifndef SOPLEX_LEGACY #define SOPLEX_LEGACY #endif // to check for value of infinity #include "soplex.h" // it's important to include this header after soplex.h #include "OsiSpxSolverInterface.hpp" void OsiSpxSolverInterfaceUnitTest( const std::string & mpsDir, const std::string & netlibDir ) { // Test default constructor { OsiSpxSolverInterface m; OSIUNITTEST_ASSERT_ERROR(m.soplex_ != NULL, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getNumCols() == 0, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsense_ == NULL, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rhs_ == NULL, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowrange_ == NULL, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colsol_ == NULL, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsol_ == NULL, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_ == NULL, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByCol_ == NULL, {}, "SoPlex", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getApplicationData() == NULL, {}, "SoPlex", "default constructor"); int i=2346; m.setApplicationData(&i); OSIUNITTEST_ASSERT_ERROR(*((int *)(m.getApplicationData())) == i, {}, "SoPlex", "set application data"); } { CoinRelFltEq eq; OsiSpxSolverInterface m; std::string fn = mpsDir+"exmip1"; m.readMps(fn.c_str(),"mps"); // int ad = 13579; // m.setApplicationData(&ad); // OSIUNITTEST_ASSERT_ERROR(*((int *)(m.getApplicationData())) == ad, {}, "SoPlex", "set application data"); { const CoinPackedMatrix * colCopy = m.getMatrixByCol(); OSIUNITTEST_ASSERT_ERROR(colCopy->getNumCols() == 8, {}, "SoPlex", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getMajorDim() == 8, {}, "SoPlex", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getNumRows() == 5, {}, "SoPlex", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getMinorDim() == 5, {}, "SoPlex", "exmip1 matrix"); OSIUNITTEST_ASSERT_ERROR(colCopy->getVectorLengths()[7] == 2, {}, "SoPlex", "exmip1 matrix"); CoinPackedMatrix revColCopy; revColCopy.reverseOrderedCopyOf(*colCopy); CoinPackedMatrix rev2ColCopy; rev2ColCopy.reverseOrderedCopyOf(revColCopy); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getNumCols() == 8, {}, "SoPlex", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getMajorDim() == 8, {}, "SoPlex", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getNumRows() == 5, {}, "SoPlex", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getMinorDim() == 5, {}, "SoPlex", "twice reverse matrix copy"); OSIUNITTEST_ASSERT_ERROR(rev2ColCopy.getVectorLengths()[7] == 2, {}, "SoPlex", "twice reverse matrix copy"); } // Test copy constructor and assignment operator { OsiSpxSolverInterface lhs; { OsiSpxSolverInterface im(m); OsiSpxSolverInterface imC1(im); OsiSpxSolverInterface imC2(im); lhs = imC2; } // Test that lhs has correct values even though rhs has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols() == m.getNumCols(), {}, "SoPlex", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows() == m.getNumRows(), {}, "SoPlex", "copy constructor"); } // Test clone { OsiSpxSolverInterface soplexSi(m); OsiSolverInterface * siPtr = &soplexSi; OsiSolverInterface * siClone = siPtr->clone(); OsiSpxSolverInterface * soplexClone = dynamic_cast(siClone); OSIUNITTEST_ASSERT_ERROR(soplexClone != NULL, {}, "SoPlex", "clone"); OSIUNITTEST_ASSERT_ERROR(soplexClone->getNumRows() == soplexSi.getNumRows(), {}, "SoPlex", "clone"); OSIUNITTEST_ASSERT_ERROR(soplexClone->getNumCols() == m.getNumCols(), {}, "SoPlex", "clone"); delete siClone; } // test infinity { OsiSpxSolverInterface si; OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == soplex::infinity, {}, "SoPlex", "value for infinity"); } { OsiSpxSolverInterface soplexSi(m); int nc = soplexSi.getNumCols(); int nr = soplexSi.getNumRows(); const double * cl = soplexSi.getColLower(); const double * cu = soplexSi.getColUpper(); const double * rl = soplexSi.getRowLower(); const double * ru = soplexSi.getRowUpper(); OSIUNITTEST_ASSERT_ERROR(nc == 8, return, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(nr == 5, return, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cu[1],4.1), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(cu[2],1.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(rl[0],2.5), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(rl[4],3.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(ru[1],2.1), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(ru[4],15.), {}, "SoPlex", "read and copy exmip1"); double newCs[8] = {1., 2., 3., 4., 5., 6., 7., 8.}; soplexSi.setColSolution(newCs); const double * cs = soplexSi.getColSolution(); OSIUNITTEST_ASSERT_ERROR(eq(cs[0],1.0), {}, "SoPlex", "set col solution"); OSIUNITTEST_ASSERT_ERROR(eq(cs[7],8.0), {}, "SoPlex", "set col solution"); { OsiSpxSolverInterface solnSi(soplexSi); const double * cs = solnSi.getColSolution(); OSIUNITTEST_ASSERT_ERROR(eq(cs[0],1.0), {}, "SoPlex", "set col solution and copy"); OSIUNITTEST_ASSERT_ERROR(eq(cs[7],8.0), {}, "SoPlex", "set col solution and copy"); } OSIUNITTEST_ASSERT_ERROR(!eq(cl[3],1.2345), {}, "SoPlex", "set col lower"); soplexSi.setColLower( 3, 1.2345 ); OSIUNITTEST_ASSERT_ERROR( eq(cl[3],1.2345), {}, "SoPlex", "set col lower"); OSIUNITTEST_ASSERT_ERROR(!eq(cu[4],10.2345), {}, "SoPlex", "set col upper"); soplexSi.setColUpper( 4, 10.2345 ); OSIUNITTEST_ASSERT_ERROR( eq(cu[4],10.2345), {}, "SoPlex", "set col upper"); OSIUNITTEST_ASSERT_ERROR(eq(soplexSi.getObjCoefficients()[0], 1.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(soplexSi.getObjCoefficients()[1], 0.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(soplexSi.getObjCoefficients()[2], 0.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(soplexSi.getObjCoefficients()[3], 0.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(soplexSi.getObjCoefficients()[4], 2.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(soplexSi.getObjCoefficients()[5], 0.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(soplexSi.getObjCoefficients()[6], 0.0), {}, "SoPlex", "read and copy exmip1"); OSIUNITTEST_ASSERT_ERROR(eq(soplexSi.getObjCoefficients()[7],-1.0), {}, "SoPlex", "read and copy exmip1"); } // Test getMatrixByRow method { const OsiSpxSolverInterface si(m); const CoinPackedMatrix * smP = si.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim() == 5, return, "SoPlex", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "SoPlex", "getMatrixByRow: num elements"); CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[0], 3.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[1], 1.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[2], -2.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[3], -1.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[4], -1.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[5], 2.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[6], 1.1), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[7], 1.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[8], 1.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[9], 2.8), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "SoPlex", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "SoPlex", "getMatrixByRow: elements"); const int * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "SoPlex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "SoPlex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "SoPlex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "SoPlex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "SoPlex", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "SoPlex", "getMatrixByRow: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "SoPlex", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "SoPlex", "getMatrixByRow: indices"); } //-------------- // Test rowsense, rhs, rowrange, getMatrixByRow { OsiSpxSolverInterface lhs; { OsiSpxSolverInterface siC1(m); OSIUNITTEST_ASSERT_WARNING(siC1.rowrange_ == NULL, {}, "SoPlex", "row range"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsense_ == NULL, {}, "SoPlex", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1.rhs_ == NULL, {}, "SoPlex", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1.matrixByRow_ == NULL, {}, "SoPlex", "matrix by row"); OSIUNITTEST_ASSERT_WARNING(siC1.colsol_ == NULL, {}, "SoPlex", "col solution"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsol_ == NULL, {}, "SoPlex", "row solution"); const char * siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "SoPlex", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "SoPlex", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "SoPlex", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "SoPlex", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "SoPlex", "row sense"); const double * siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "SoPlex", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "SoPlex", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "SoPlex", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "SoPlex", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "SoPlex", "right hand side"); const double * siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "SoPlex", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "SoPlex", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "SoPlex", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "SoPlex", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "SoPlex", "row range"); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "SoPlex", "matrix by row"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "SoPlex", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "SoPlex", "matrix by row: num elements"); const double * ev = siC1mbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "SoPlex", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "SoPlex", "matrix by row: elements"); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "SoPlex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "SoPlex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "SoPlex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "SoPlex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "SoPlex", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "SoPlex", "matrix by row: vector starts"); const int * ei = siC1mbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "SoPlex", "matrix by row: indices"); OSIUNITTEST_ASSERT_WARNING(siC1rs == siC1.getRowSense(), {}, "SoPlex", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "SoPlex", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1rr == siC1.getRowRange(), {}, "SoPlex", "row range"); // Change SOPLEX Model by adding free row OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb( COIN_DBL_MAX); OsiCuts cuts; cuts.insert(rc); siC1.applyCuts(cuts); // Since model was changed, test that cached data is now freed. OSIUNITTEST_ASSERT_ERROR(siC1.rowrange_ == NULL, {}, "SoPlex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsense_ == NULL, {}, "SoPlex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rhs_ == NULL, {}, "SoPlex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByRow_ == NULL, {}, "SoPlex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByCol_ == NULL, {}, "SoPlex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.colsol_ == NULL, {}, "SoPlex", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsol_ == NULL, {}, "SoPlex", "free cached data after adding row"); siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "SoPlex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "SoPlex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "SoPlex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "SoPlex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "SoPlex", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "SoPlex", "row sense after adding row"); siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "SoPlex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "SoPlex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "SoPlex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "SoPlex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "SoPlex", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "SoPlex", "right hand side after adding row"); siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "SoPlex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "SoPlex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "SoPlex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "SoPlex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "SoPlex", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "SoPlex", "row range after adding row"); lhs = siC1; } // Test that lhs has correct values even though siC1 has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.rowrange_ == NULL, {}, "SoPlex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsense_ == NULL, {}, "SoPlex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rhs_ == NULL, {}, "SoPlex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByRow_ == NULL, {}, "SoPlex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByCol_ == NULL, {}, "SoPlex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.colsol_ == NULL, {}, "SoPlex", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsol_ == NULL, {}, "SoPlex", "freed origin after assignment"); const char * lhsrs = lhs.getRowSense(); OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "SoPlex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "SoPlex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "SoPlex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "SoPlex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "SoPlex", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "SoPlex", "row sense after assignment"); const double * lhsrhs = lhs.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "SoPlex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "SoPlex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "SoPlex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "SoPlex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "SoPlex", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "SoPlex", "right hand side after assignment"); const double *lhsrr = lhs.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "SoPlex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "SoPlex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "SoPlex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "SoPlex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "SoPlex", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "SoPlex", "row range after assignment"); const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "SoPlex", "matrix by row after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "SoPlex", "matrix by row after assignment: major dim"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "SoPlex", "matrix by row after assignment: num elements"); const double * ev = lhsmbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "SoPlex", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "SoPlex", "matrix by row after assignment: elements"); const CoinBigIndex * mi = lhsmbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "SoPlex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "SoPlex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "SoPlex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "SoPlex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "SoPlex", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "SoPlex", "matrix by row after assignment: vector starts"); const int * ei = lhsmbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "SoPlex", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "SoPlex", "matrix by row after assignment: indices"); } //-------------- } // Do common solverInterface testing by calling the // base class testing method. { OsiSpxSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir); } } #endif CoinMP-1.8.3/Osi/test/OsiTestSolverInterface.cpp0000644000175000017500000011402711510425067020145 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This file is licensed under the terms of Eclipse Public License (EPL). // this is a copy of OsiVolSolverInterface (trunk rev. 1466) renamed to OsiTestSolverInterface #include "CoinPragma.hpp" #include #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinWarmStartDual.hpp" #include "OsiTestSolverInterface.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" //####################################################################### // Private helper methods //####################################################################### void OsiTestSolverInterface::updateRowMatrix_() const { if (! rowMatrixCurrent_) { rowMatrix_.reverseOrderedCopyOf(colMatrix_); rowMatrixCurrent_ = true; } } void OsiTestSolverInterface::updateColMatrix_() const { if (! colMatrixCurrent_) { colMatrix_.reverseOrderedCopyOf(rowMatrix_); colMatrixCurrent_ = true; } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::checkData_() const { int i; for (i = getNumRows() - 1; i >= 0; --i) { if (rowlower_[i] > -1.0e20 && rowupper_[i] < 1.0e20 && rowlower_[i] != rowupper_[i]) throw CoinError("Volume algorithm is unable to handle ranged rows", "checkData_", "OsiTestSolverInterface"); } for (i = getNumCols() - 1; i >= 0; --i) { if (collower_[i] < -1.0e20 || colupper_[i] > 1.0e20) throw CoinError("Volume algorithm is unable to handle infinite bounds", "checkData_", "OsiTestSolverInterface"); } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::compute_rc_(const double* u, double* rc) const { if (isZeroOneMinusOne_) { rowMatrixOneMinusOne_->timesMajor(u, rc); } else { rowMatrix_.transposeTimes(u, rc); } const int psize = getNumCols(); std::transform(rc, rc+psize, objcoeffs_, rc, std::minus()); std::transform(rc, rc+psize, rc, std::negate()); } //############################################################################# bool OsiTestSolverInterface::test_zero_one_minusone_(const CoinPackedMatrix& m) const { const int vecnum = m.getMajorDim(); const double* elem = m.getElements(); const int* start = m.getVectorStarts(); const int* length = m.getVectorLengths(); int i, j; for (i = 0; i < vecnum; ++i) { for (j = start[i] + length[i] - 1; j >= start[i]; --j) { const double val = elem[j]; if (val != 1.0 && val != 0.0 && val != -1.0) { return false; } } } return true; } //----------------------------------------------------------------------------- OsiTestSolverInterface::OsiVolMatrixOneMinusOne_:: OsiVolMatrixOneMinusOne_(const CoinPackedMatrix& m) { const int major = m.getMajorDim(); const double* elem = m.getElements(); const int* ind = m.getIndices(); const int* start = m.getVectorStarts(); const int* length = m.getVectorLengths(); majorDim_ = major; minorDim_ = m.getMinorDim(); plusSize_ = 0; minusSize_ = 0; int i, j; for (i = 0; i < major; ++i) { for (j = start[i] + length[i] - 1; j >= start[i]; --j) { const double val = elem[j]; if (val == 1.0) { ++plusSize_; } else if (val == -1.0) { ++minusSize_; } } } if (plusSize_ > 0) { plusInd_ = new int[plusSize_]; } if (minusSize_ > 0) { minusInd_ = new int[minusSize_]; } plusStart_ = new int[major]; plusLength_ = new int[major]; minusStart_ = new int[major]; minusLength_ = new int[major]; plusSize_ = 0; minusSize_ = 0; for (i = 0; i < major; ++i) { plusStart_[i] = plusSize_; minusStart_[i] = minusSize_; const int last = start[i] + length[i]; for (j = start[i]; j < last; ++j) { const double val = elem[j]; if (val == 1.0) { plusInd_[plusSize_++] = ind[j]; } else if (val == -1.0) { minusInd_[minusSize_++] = ind[j]; } } plusLength_[i] = plusSize_ - plusStart_[i]; minusLength_[i] = minusSize_ - minusStart_[i]; } if (plusSize_ == 0) { delete[] plusStart_; plusStart_ = NULL; delete[] plusLength_; plusLength_ = NULL; } if (minusSize_ == 0) { delete[] minusStart_; minusStart_ = NULL; delete[] minusLength_; minusLength_ = NULL; } } //----------------------------------------------------------------------------- OsiTestSolverInterface::OsiVolMatrixOneMinusOne_:: ~OsiVolMatrixOneMinusOne_() { if (plusSize_ > 0) { delete[] plusInd_; plusInd_ = NULL; delete[] plusStart_; plusStart_ = NULL; delete[] plusLength_; plusLength_ = NULL; } if (minusSize_ > 0) { delete[] minusInd_; minusInd_ = NULL; delete[] minusStart_; minusStart_ = NULL; delete[] minusLength_; minusLength_ = NULL; } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::OsiVolMatrixOneMinusOne_:: timesMajor(const double* x, double* y) const { memset(y, 0, minorDim_ * sizeof(double)); int i; if (plusSize_ > 0 && minusSize_ > 0) { for (i = majorDim_ - 1; i >= 0; --i) { const double x_i = x[i]; if (x_i != 0.0) { const int* vecInd = plusInd_ + plusStart_[i]; int j; for ( j = plusLength_[i] - 1; j >= 0; --j) y[vecInd[j]] += x_i; vecInd = minusInd_ + minusStart_[i]; for ( j = minusLength_[i] - 1; j >= 0; --j) y[vecInd[j]] -= x_i; } } return; } if (plusSize_ > 0) { for (i = majorDim_ - 1; i >= 0; --i) { const double x_i = x[i]; if (x_i != 0.0) { const int* vecInd = plusInd_ + plusStart_[i]; for (int j = plusLength_[i] - 1; j >= 0; --j) y[vecInd[j]] += x_i; } } return; } if (minusSize_ > 0) { for (i = majorDim_ - 1; i >= 0; --i) { const double x_i = x[i]; if (x_i != 0.0) { const int* vecInd = minusInd_ + minusStart_[i]; for (int j = minusLength_[i] - 1; j >= 0; --j) y[vecInd[j]] -= x_i; } } return; } } //############################################################################# void OsiTestSolverInterface::gutsOfDestructor_() { rowMatrix_.clear(); colMatrix_.clear(); rowMatrixCurrent_ = true; colMatrixCurrent_ = true; delete[] colupper_; colupper_ = 0; delete[] collower_; collower_ = 0; delete[] continuous_; continuous_ = 0; delete[] rowupper_; rowupper_ = 0; delete[] rowlower_; rowlower_ = 0; delete[] rowsense_; rowsense_ = 0; delete[] rhs_; rhs_ = 0; delete[] rowrange_; rowrange_ = 0; delete[] objcoeffs_; objcoeffs_ = 0; delete[] colsol_; colsol_ = 0; delete[] rowprice_; rowprice_ = 0; delete[] rowpriceHotStart_; rowpriceHotStart_ = 0; delete[] rc_; rc_ = 0; delete[] lhs_; lhs_ = 0; lagrangeanCost_ = 0.0; maxNumrows_ = 0; maxNumcols_ = 0; } //############################################################################# void OsiTestSolverInterface::rowRimAllocator_() { rowupper_ = new double[maxNumrows_]; rowlower_ = new double[maxNumrows_]; rowsense_ = new char[maxNumrows_]; rhs_ = new double[maxNumrows_]; rowrange_ = new double[maxNumrows_]; rowprice_ = new double[maxNumrows_]; lhs_ = new double[maxNumrows_]; } //----------------------------------------------------------------------------- void OsiTestSolverInterface::colRimAllocator_() { colupper_ = new double[maxNumcols_]; collower_ = new double[maxNumcols_]; continuous_ = new bool[maxNumcols_]; objcoeffs_ = new double[maxNumcols_]; colsol_ = new double[maxNumcols_]; rc_ = new double[maxNumcols_]; } //----------------------------------------------------------------------------- void OsiTestSolverInterface::rowRimResize_(const int newSize) { if (newSize > maxNumrows_) { double* rub = rowupper_; double* rlb = rowlower_; char* sense = rowsense_; double* right = rhs_; double* range = rowrange_; double* dual = rowprice_; double* left = lhs_; maxNumrows_ = CoinMax(1000, (newSize * 5) / 4); rowRimAllocator_(); const int rownum = getNumRows(); CoinDisjointCopyN(rub , rownum, rowupper_); CoinDisjointCopyN(rlb , rownum, rowlower_); CoinDisjointCopyN(sense, rownum, rowsense_); CoinDisjointCopyN(right, rownum, rhs_); CoinDisjointCopyN(range, rownum, rowrange_); CoinDisjointCopyN(dual , rownum, rowprice_); CoinDisjointCopyN(left , rownum, lhs_); delete[] rub; delete[] rlb; delete[] sense; delete[] right; delete[] range; delete[] dual; delete[] left; } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::colRimResize_(const int newSize) { if (newSize > maxNumcols_) { double* cub = colupper_; double* clb = collower_; bool* cont = continuous_; double* obj = objcoeffs_; double* sol = colsol_; double* rc = rc_; maxNumcols_ = CoinMax(1000, (newSize * 5) / 4); colRimAllocator_(); const int colnum = getNumCols(); CoinDisjointCopyN(cub , colnum, colupper_); CoinDisjointCopyN(clb , colnum, collower_); CoinDisjointCopyN(cont, colnum, continuous_); CoinDisjointCopyN(obj , colnum, objcoeffs_); CoinDisjointCopyN(sol , colnum, colsol_); CoinDisjointCopyN(rc , colnum, rc_); delete[] cub; delete[] clb; delete[] cont; delete[] obj; delete[] sol; delete[] rc; } } //############################################################################# void OsiTestSolverInterface::convertBoundsToSenses_() { for (int i = getNumRows() - 1; i >= 0; --i ) { convertBoundToSense(rowlower_[i], rowupper_[i], rowsense_[i], rhs_[i], rowrange_[i]); } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::convertSensesToBounds_() { for (int i = getNumRows() - 1; i >= 0; --i) { convertSenseToBound(rowsense_[i], rhs_[i], rowrange_[i], rowlower_[i], rowupper_[i]); } } //############################################################################# // Here are the routines implementing the virtual methods inherited from // VOL_user_hooks. //############################################################################# int OsiTestSolverInterface::compute_rc(const VOL_dvector& u, VOL_dvector& rc) { compute_rc_(u.v, rc.v); return 0; } //----------------------------------------------------------------------- int OsiTestSolverInterface::solve_subproblem(const VOL_dvector& dual, const VOL_dvector& rc, double& lcost, VOL_dvector& x, VOL_dvector& v, double& pcost) { int i; const int psize = x.size(); for (i = 0; i < psize; ++i) { x[i] = (rc[i] >= 0.0) ? collower_[i] : colupper_[i]; } const int dsize = v.size(); lcost = (std::inner_product(rhs_, rhs_ + dsize, dual.v, 0.0) + std::inner_product(x.v, x.v + psize, rc.v, 0.0) ); if (isZeroOneMinusOne_) { colMatrixOneMinusOne_->timesMajor(x.v, v.v); } else { colMatrix_.times(x.v, v.v); } std::transform(v.v, v.v+dsize, rhs_, v.v, std::minus()); std::transform(v.v, v.v+dsize, v.v, std::negate()); pcost = std::inner_product(x.v, x.v + psize, objcoeffs_, 0.0); return 0; } //############################################################################# // Solve methods //############################################################################# void OsiTestSolverInterface::initialSolve() { // set every entry to 0.0 in the dual solution CoinFillN(rowprice_, getNumRows(), 0.0); resolve(); } //----------------------------------------------------------------------------- void OsiTestSolverInterface::resolve() { int i; checkData_(); // Only one of these can do any work updateRowMatrix_(); updateColMatrix_(); const int dsize = getNumRows(); const int psize = getNumCols(); // Negate the objective coefficients if necessary if (objsense_ < 0) { std::transform(objcoeffs_, objcoeffs_+psize, objcoeffs_, std::negate()); } // Set the lb/ub on the duals volprob_.dual_lb.allocate(dsize); volprob_.dual_ub.allocate(dsize); double * dlb = volprob_.dual_lb.v; double * dub = volprob_.dual_ub.v; for (i = 0; i < dsize; ++i) { dlb[i] = rowupper_[i] < getInfinity() ? -1.0e31 : 0.0; dub[i] = rowlower_[i] > -getInfinity() ? 1.0e31 : 0.0; } volprob_.dsize = dsize; volprob_.psize = psize; // Set the dual starting point VOL_dvector& dsol = volprob_.dsol; dsol.allocate(dsize); std::transform(rowprice_, rowprice_+dsize, dsol.v, std::bind2nd(std::multiplies(), objsense_)); // adjust the dual vector (if necessary) to be sure it's feasible double * dv = dsol.v; for (i = 0; i < dsize; ++i) { if (dv[i] < dlb[i]) { dv[i] = dlb[i]; } else if (dv[i] > dub[i]) { dv[i] = dub[i]; } } // If requested, check whether the matrix contains anything but 0/1/-1 #if 0 isZeroOneMinusOne_ = false; #else isZeroOneMinusOne_ = test_zero_one_minusone_(colMatrix_); if (isZeroOneMinusOne_) { colMatrixOneMinusOne_ = new OsiVolMatrixOneMinusOne_(colMatrix_); rowMatrixOneMinusOne_ = new OsiVolMatrixOneMinusOne_(rowMatrix_); } #endif volprob_.solve(*this, true); // extract the solution // the lower bound on the objective value lagrangeanCost_ = objsense_ * volprob_.value; // the primal solution CoinDisjointCopyN(volprob_.psol.v, psize, colsol_); // Reset the objective coefficients if necessary if (objsense_ < 0) { std::transform(objcoeffs_, objcoeffs_ + psize, objcoeffs_, std::negate()); // also, multiply the dual solution by -1 std::transform(volprob_.dsol.v, volprob_.dsol.v+dsize, rowprice_, std::negate()); } else { // now we just have to copy the dual CoinDisjointCopyN(volprob_.dsol.v, dsize, rowprice_); } // Compute the reduced costs compute_rc_(rowprice_, rc_); // Compute the left hand side (row activity levels) if (isZeroOneMinusOne_) { colMatrixOneMinusOne_->timesMajor(colsol_, lhs_); } else { colMatrix_.times(colsol_, lhs_); } if (isZeroOneMinusOne_) { delete colMatrixOneMinusOne_; colMatrixOneMinusOne_ = NULL; delete rowMatrixOneMinusOne_; rowMatrixOneMinusOne_ = NULL; } } //############################################################################# // Parameter related methods //############################################################################# bool OsiTestSolverInterface::setIntParam(OsiIntParam key, int value) { switch (key) { case OsiMaxNumIteration: if (value < 0) return false; volprob_.parm.maxsgriters = value; break; case OsiMaxNumIterationHotStart: if (value < 0) return false; OsiSolverInterface::setIntParam(key, value); break; case OsiLastIntParam: return false; default: return false; } return true; } //----------------------------------------------------------------------------- bool OsiTestSolverInterface::setDblParam(OsiDblParam key, double value) { switch (key) { case OsiDualObjectiveLimit: volprob_.parm.ubinit = value; break; case OsiPrimalObjectiveLimit: // not applicable return false; case OsiDualTolerance: // only ~0 is applicable, so accept only 1e-50 ... return (value == 1e-50); case OsiPrimalTolerance: if (value < 1e-04 || value > 1e-1) return false; volprob_.parm.primal_abs_precision = value; break; case OsiObjOffset: return OsiSolverInterface::setDblParam(key, value); case OsiLastDblParam: return false; default: return false; } return true; } //----------------------------------------------------------------------------- bool OsiTestSolverInterface::setStrParam(OsiStrParam key, const std::string & value) { bool retval=false; switch (key) { case OsiSolverName: return false; case OsiProbName: OsiSolverInterface::setStrParam(key,value); return retval = true; case OsiLastStrParam: return false; default: return false; } return false; } //----------------------------------------------------------------------------- bool OsiTestSolverInterface::getIntParam(OsiIntParam key, int& value) const { switch (key) { case OsiMaxNumIteration: value = volprob_.parm.maxsgriters; break; case OsiMaxNumIterationHotStart: OsiSolverInterface::getIntParam(key, value); break; case OsiLastIntParam: return false; default: return false; } return true; } //----------------------------------------------------------------------------- bool OsiTestSolverInterface::getDblParam(OsiDblParam key, double& value) const { switch (key) { case OsiDualObjectiveLimit: value = volprob_.parm.ubinit; break; case OsiPrimalObjectiveLimit: // not applicable return false; case OsiDualTolerance: // not applicable, but must return almost 0 value = 1e-50; break; case OsiPrimalTolerance: value = volprob_.parm.primal_abs_precision; break; case OsiObjOffset: OsiSolverInterface::getDblParam(key, value); break; case OsiLastDblParam: return false; default: return false; } return true; } //----------------------------------------------------------------------------- bool OsiTestSolverInterface::getStrParam(OsiStrParam key, std::string & value) const { switch (key) { case OsiProbName: OsiSolverInterface::getStrParam(key, value); return true; case OsiSolverName: value = "vol"; return true; case OsiLastStrParam: return false; default: return false; } return false; } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# bool OsiTestSolverInterface::isAbandoned() const { // *THINK*: see the *THINK* in isProvenOptimal() return false; } bool OsiTestSolverInterface::isProvenOptimal() const { // if exited before reaching the iteration limit it is declared optimal // *THINK*: Granted, it can exit because the dual value is not improving. // *THINK*: Should that be "abandoned"? But then it'll be abandoned way too // *THINK*: frequently... return (! isDualObjectiveLimitReached() && volprob_.iter() < volprob_.parm.maxsgriters); } bool OsiTestSolverInterface::isProvenPrimalInfeasible() const { // LL: *FIXME* : at the moment the volume can't detect primal infeasibility. // LL: *FIXME* : The dual will go to infinity. return false; } bool OsiTestSolverInterface::isProvenDualInfeasible() const { // LL: *FIXME* : at the moment the volume assumes dual feasibility... return false; } bool OsiTestSolverInterface::isPrimalObjectiveLimitReached() const { // The volume algorithm doesn't know anything about the primal; only the // dual is monotone return false; } bool OsiTestSolverInterface::isDualObjectiveLimitReached() const { return volprob_.parm.ubinit - volprob_.value < volprob_.parm.granularity; } bool OsiTestSolverInterface::isIterationLimitReached() const { return volprob_.iter() >= volprob_.parm.maxsgriters; } //############################################################################# // WarmStart related methods //############################################################################# CoinWarmStart* OsiTestSolverInterface::getEmptyWarmStart () const { return (dynamic_cast(new CoinWarmStartDual())) ; } CoinWarmStart* OsiTestSolverInterface::getWarmStart() const { return new CoinWarmStartDual(getNumRows(), rowprice_); } //----------------------------------------------------------------------------- bool OsiTestSolverInterface::setWarmStart(const CoinWarmStart* warmstart) { const CoinWarmStartDual* ws = dynamic_cast(warmstart); if (! ws) return false; const int ws_size = ws->size(); if (ws_size != getNumRows() && ws_size != 0) { throw CoinError("wrong dual warmstart size", "setWarmStart", "OsiTestSolverInterface"); } CoinDisjointCopyN(ws->dual(), ws_size, rowprice_); return true; } //############################################################################# // HotStart related methods //############################################################################# void OsiTestSolverInterface::markHotStart() { delete[] rowpriceHotStart_; rowpriceHotStart_ = new double[getNumRows()]; CoinDisjointCopyN(rowprice_, getNumRows(), rowpriceHotStart_); } void OsiTestSolverInterface::solveFromHotStart() { int itlimOrig = volprob_.parm.maxsgriters; getIntParam(OsiMaxNumIterationHotStart, volprob_.parm.maxsgriters); CoinDisjointCopyN(rowpriceHotStart_, getNumRows(), rowprice_); resolve(); volprob_.parm.maxsgriters = itlimOrig; } void OsiTestSolverInterface::unmarkHotStart() { delete[] rowpriceHotStart_; rowpriceHotStart_ = NULL; } //############################################################################# // Problem information methods (original data) //############################################################################# bool OsiTestSolverInterface::isContinuous(int colNumber) const { assert( continuous_!=NULL ); if ( continuous_[colNumber] ) return true; return false; } //----------------------------------------------------------------------------- const CoinPackedMatrix * OsiTestSolverInterface::getMatrixByRow() const { updateRowMatrix_(); return &rowMatrix_; } //----------------------------------------------------------------------- const CoinPackedMatrix * OsiTestSolverInterface::getMatrixByCol() const { updateColMatrix_(); return &colMatrix_; } //############################################################################# // Problem information methods (results) //############################################################################# std::vector OsiTestSolverInterface::getDualRays(int /*maxNumRays*/, bool /*fullRay*/) const { // *FIXME* : must write the method -LL throw CoinError("method is not yet written", "getDualRays", "OsiTestSolverInterface"); return std::vector(); } //------------------------------------------------------------------ std::vector OsiTestSolverInterface::getPrimalRays(int /*maxNumRays*/) const { // *FIXME* : must write the method -LL throw CoinError("method is not yet written", "getPrimalRays", "OsiTestSolverInterface"); return std::vector(); } //############################################################################# // Problem modifying methods (rim vectors) //############################################################################# //----------------------------------------------------------------------------- void OsiTestSolverInterface::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { while (indexFirst < indexLast) { const int ind = *indexFirst; collower_[ind] = boundList[0]; colupper_[ind] = boundList[1]; ++indexFirst; boundList += 2; } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { if (indexLast - indexFirst < getNumRows() / 3) { while (indexFirst < indexLast) { setRowBounds(*indexFirst, boundList[0], boundList[1]); ++indexFirst; boundList += 2; } } else { // it's better to convert everything at once while (indexFirst < indexLast) { const int ind = *indexFirst; rowlower_[ind] = boundList[0]; rowupper_[ind] = boundList[1]; ++indexFirst; boundList += 2; } convertBoundsToSenses_(); } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { if (indexLast - indexFirst < getNumRows() / 3) { while (indexFirst < indexLast) { setRowType(*indexFirst++, *senseList++, *rhsList++, *rangeList++); } } else { // it's better to convert everything at once while (indexFirst < indexLast) { const int ind = *indexFirst++; rowsense_[ind] = *senseList++; rhs_[ind] = *rhsList++; rowrange_[ind] = *rangeList++; } convertSensesToBounds_(); } } //############################################################################# void OsiTestSolverInterface::setContinuous(int index) { assert(continuous_ != NULL); if (index < 0 || index > getNumCols()) { throw CoinError("Index out of bound.", "setContinuous", "OsiTestSolverInterface"); } continuous_[index] = true; } //----------------------------------------------------------------------- void OsiTestSolverInterface::setInteger(int index) { assert(continuous_ != NULL); if (index < 0 || index > getNumCols()) { throw CoinError("Index out of bound.", "setContinuous", "OsiTestSolverInterface"); } continuous_[index] = false; } //----------------------------------------------------------------------- void OsiTestSolverInterface::setContinuous(const int* indices, int len) { assert(continuous_ != NULL); const int colnum = getNumCols(); int i; for (i = len - 1; i >= 0; --i) { if (indices[i] < 0 || indices[i] > colnum) { throw CoinError("Index out of bound.", "setContinuous", "OsiTestSolverInterface"); } } for (i = len - 1; i >= 0; --i) { continuous_[indices[i]] = true; } } //----------------------------------------------------------------------- void OsiTestSolverInterface::setInteger(const int* indices, int len) { assert(continuous_ != NULL); const int colnum = getNumCols(); int i; for (i = len - 1; i >= 0; --i) { if (indices[i] < 0 || indices[i] > colnum) { throw CoinError("Index out of bound.", "setContinuous", "OsiTestSolverInterface"); } } for (i = len - 1; i >= 0; --i) { continuous_[indices[i]] = false; } } //############################################################################# void OsiTestSolverInterface::setColSolution(const double *colsol) { CoinDisjointCopyN(colsol, getNumCols(), colsol_); // Compute the left hand side (row activity levels) if (isZeroOneMinusOne_) { colMatrixOneMinusOne_->timesMajor(colsol_, lhs_); } else { colMatrix_.times(colsol_, lhs_); } } //----------------------------------------------------------------------- void OsiTestSolverInterface::setRowPrice(const double *rowprice) { CoinDisjointCopyN(rowprice, getNumRows(), rowprice_); compute_rc_(rowprice_, rc_); } //############################################################################# // Problem modifying methods (matrix) //############################################################################# void OsiTestSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { const int colnum = getNumCols(); colRimResize_(colnum + 1); collower_[colnum] = collb; colupper_[colnum] = colub; objcoeffs_[colnum] = obj; continuous_[colnum] = true; colsol_[colnum] = fabs(collb) 0) { const int colnum = getNumCols(); colRimResize_(colnum + numcols); CoinDisjointCopyN(collb, numcols, collower_ + colnum); CoinDisjointCopyN(colub, numcols, colupper_ + colnum); CoinDisjointCopyN(obj, numcols, objcoeffs_ + colnum); CoinFillN(continuous_ + colnum, numcols, true); int c; for ( c=0; c 0) { int * delPos = new int[num]; CoinDisjointCopyN(columnIndices, num, delPos); std::sort(delPos, delPos + num); const int delNum = static_cast(std::unique(delPos, delPos + num) - delPos); const int colnum = getNumCols(); CoinDeleteEntriesFromArray(collower_, collower_ + colnum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(colupper_, colupper_ + colnum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(objcoeffs_, objcoeffs_ + colnum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(continuous_, continuous_ + colnum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(colsol_, colsol_ + colnum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(rc_, rc_ + colnum, delPos, delPos + delNum); updateColMatrix_(); colMatrix_.deleteCols(delNum, delPos); rowMatrixCurrent_ = false; } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { const int rownum = getNumRows(); rowRimResize_(rownum + 1); rowlower_[rownum] = rowlb; rowupper_[rownum] = rowub; convertBoundToSense(rowlb, rowub, rowsense_[rownum], rhs_[rownum], rowrange_[rownum]); rowprice_[rownum] = 0.0; lhs_[rownum] = 0.0; updateRowMatrix_(); rowMatrix_.appendRow(vec); colMatrixCurrent_ = false; } //----------------------------------------------------------------------------- void OsiTestSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { const int rownum = getNumRows(); rowRimResize_(rownum + 1); rowsense_[rownum] = rowsen; rhs_[rownum] = rowrhs; rowrange_[rownum] = rowrng; convertSenseToBound(rowsen, rowrhs, rowrng, rowlower_[rownum], rowupper_[rownum]); rowprice_[rownum] = 0.0; lhs_[rownum] = 0.0; updateRowMatrix_(); rowMatrix_.appendRow(vec); colMatrixCurrent_ = false; } //----------------------------------------------------------------------------- void OsiTestSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub) { if (numrows > 0) { const int rownum = getNumRows(); rowRimResize_(rownum + numrows); CoinDisjointCopyN(rowlb, numrows, rowlower_ + rownum); CoinDisjointCopyN(rowub, numrows, rowupper_ + rownum); for (int i = rownum + numrows - 1; i >= rownum; --i) { convertBoundToSense(rowlower_[i], rowupper_[i], rowsense_[i], rhs_[i], rowrange_[i]); } CoinFillN(rowprice_ + rownum, numrows, 0.0); CoinFillN(lhs_ + rownum, numrows, 0.0); updateRowMatrix_(); rowMatrix_.appendRows(numrows, rows); colMatrixCurrent_ = false; } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng) { if (numrows > 0) { const int rownum = getNumRows(); rowRimResize_(rownum + numrows); CoinDisjointCopyN(rowsen, numrows, rowsense_ + rownum); CoinDisjointCopyN(rowrhs, numrows, rhs_ + rownum); CoinDisjointCopyN(rowrng, numrows, rowrange_ + rownum); for (int i = rownum + numrows - 1; i >= rownum; --i) { convertSenseToBound(rowsense_[i], rhs_[i], rowrange_[i], rowlower_[i], rowupper_[i]); } CoinFillN(rowprice_ + rownum, numrows, 0.0); CoinFillN(lhs_ + rownum, numrows, 0.0); updateRowMatrix_(); rowMatrix_.appendRows(numrows, rows); colMatrixCurrent_ = false; } } //----------------------------------------------------------------------------- void OsiTestSolverInterface::deleteRows(const int num, const int * rowIndices) { if (num > 0) { int * delPos = new int[num]; CoinDisjointCopyN(rowIndices, num, delPos); std::sort(delPos, delPos + num); const int delNum = static_cast(std::unique(delPos, delPos + num) - delPos); const int rownum = getNumRows(); CoinDeleteEntriesFromArray(rowlower_, rowlower_ + rownum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(rowupper_, rowupper_ + rownum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(rowsense_, rowsense_ + rownum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(rowrange_, rowrange_ + rownum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(rhs_, rhs_ + rownum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(rowprice_, rowprice_ + rownum, delPos, delPos + delNum); CoinDeleteEntriesFromArray(lhs_, lhs_ + rownum, delPos, delPos + delNum); updateRowMatrix_(); rowMatrix_.deleteRows(delNum, delPos); colMatrixCurrent_ = false; delete[] delPos; } } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# OsiTestSolverInterface::OsiTestSolverInterface () : rowMatrixCurrent_(true), rowMatrix_(), colMatrixCurrent_(true), colMatrix_(), isZeroOneMinusOne_(false), colupper_(0), collower_(0), continuous_(0), rowupper_(0), rowlower_(0), rowsense_(0), rhs_(0), rowrange_(0), objcoeffs_(0), objsense_(1.0), colsol_(0), rowprice_(0), rc_(0), lhs_(0), lagrangeanCost_(0.0), rowpriceHotStart_(0), maxNumrows_(0), maxNumcols_(0), volprob_() { volprob_.parm.granularity = 0.0; } //----------------------------------------------------------------------- OsiSolverInterface * OsiTestSolverInterface::clone(bool copyData) const { return copyData ? new OsiTestSolverInterface(*this) : new OsiTestSolverInterface(); } //----------------------------------------------------------------------- OsiTestSolverInterface::OsiTestSolverInterface(const OsiTestSolverInterface& x) : OsiSolverInterface(x), rowMatrixCurrent_(true), rowMatrix_(), colMatrixCurrent_(true), colMatrix_(), isZeroOneMinusOne_(false), colupper_(0), collower_(0), continuous_(0), rowupper_(0), rowlower_(0), rowsense_(0), rhs_(0), rowrange_(0), objcoeffs_(0), objsense_(1.0), colsol_(0), rowprice_(0), rc_(0), lhs_(0), lagrangeanCost_(0.0), rowpriceHotStart_(0), maxNumrows_(0), maxNumcols_(0), volprob_() { operator=(x); volprob_.parm.granularity = 0.0; } //----------------------------------------------------------------------- OsiTestSolverInterface& OsiTestSolverInterface::operator=(const OsiTestSolverInterface& rhs) { if (&rhs == this) return *this; OsiSolverInterface::operator=(rhs); gutsOfDestructor_(); rowMatrixCurrent_ = rhs.rowMatrixCurrent_; if (rowMatrixCurrent_) rowMatrix_ = rhs.rowMatrix_; colMatrixCurrent_ = rhs.colMatrixCurrent_; if (colMatrixCurrent_) colMatrix_ = rhs.colMatrix_; if (rhs.maxNumrows_) { maxNumrows_ = rhs.maxNumrows_; rowRimAllocator_(); const int rownum = getNumRows(); CoinDisjointCopyN(rhs.rowupper_, rownum, rowupper_); CoinDisjointCopyN(rhs.rowlower_, rownum, rowlower_); CoinDisjointCopyN(rhs.rowsense_, rownum, rowsense_); CoinDisjointCopyN(rhs.rhs_, rownum, rhs_); CoinDisjointCopyN(rhs.rowrange_, rownum, rowrange_); CoinDisjointCopyN(rhs.rowprice_, rownum, rowprice_); CoinDisjointCopyN(rhs.lhs_, rownum, lhs_); } if (rhs.maxNumcols_) { maxNumcols_ = rhs.maxNumcols_; colRimAllocator_(); const int colnum = getNumCols(); CoinDisjointCopyN(rhs.colupper_, colnum, colupper_); CoinDisjointCopyN(rhs.collower_, colnum, collower_); CoinDisjointCopyN(rhs.continuous_, colnum, continuous_); CoinDisjointCopyN(rhs.objcoeffs_, colnum, objcoeffs_); CoinDisjointCopyN(rhs.colsol_, colnum, colsol_); CoinDisjointCopyN(rhs.rc_, colnum, rc_); } volprob_.parm.granularity = 0.0; return *this; } //----------------------------------------------------------------------- OsiTestSolverInterface::~OsiTestSolverInterface () { gutsOfDestructor_(); } //############################################################################# // Applying cuts //############################################################################# void OsiTestSolverInterface::applyRowCut(const OsiRowCut& rc) { const int rownum = getNumRows(); const double lb = rc.lb(); const double ub = rc.ub(); rowRimResize_(rownum + 1); rowprice_[rownum] = 0.0; rowlower_[rownum] = lb; rowupper_[rownum] = ub; convertBoundToSense(lb, ub, rowsense_[rownum], rhs_[rownum], rowrange_[rownum]); updateRowMatrix_(); rowMatrix_.appendRow(rc.row()); colMatrixCurrent_ = false; } //----------------------------------------------------------------------- void OsiTestSolverInterface::applyColCut(const OsiColCut& cc) { int i; const double* lb_elem = cc.lbs().getElements(); const int* lb_ind = cc.lbs().getIndices(); for (i = cc.lbs().getNumElements() - 1; i >= 0; --i) { collower_[lb_ind[i]] = CoinMax(collower_[lb_ind[i]], lb_elem[i]); } const double* ub_elem = cc.ubs().getElements(); const int* ub_ind = cc.ubs().getIndices(); for (i = cc.ubs().getNumElements() - 1; i >= 0; --i) { colupper_[ub_ind[i]] = CoinMin(colupper_[ub_ind[i]], ub_elem[i]); } } //############################################################################# CoinMP-1.8.3/Osi/test/OsiTestSolver.hpp0000644000175000017500000005247412243675677016362 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This file is licensed under the terms of Eclipse Public License (EPL). // this is a copy of VolVolume (stable/1.1 rev. 233) #ifndef __OSITESTSOLVER_HPP__ #define __OSITESTSOLVER_HPP__ #include #include #include #include #include #include "CoinFinite.hpp" #ifndef VOL_DEBUG // When VOL_DEBUG is 1, we check vector indices #define VOL_DEBUG 0 #endif template static inline T VolMax(register const T x, register const T y) { return ((x) > (y)) ? (x) : (y); } template static inline T VolAbs(register const T x) { return ((x) > 0) ? (x) : -(x); } //############################################################################ #if defined(VOL_DEBUG) && (VOL_DEBUG != 0) #define VOL_TEST_INDEX(i, size) \ { \ if ((i) < 0 || (i) >= (size)) { \ printf("bad VOL_?vector index\n"); \ abort(); \ } \ } #define VOL_TEST_SIZE(size) \ { \ if (s <= 0) { \ printf("bad VOL_?vector size\n"); \ abort(); \ } \ } #else #define VOL_TEST_INDEX(i, size) #define VOL_TEST_SIZE(size) #endif //############################################################################ class VOL_dvector; class VOL_ivector; class VOL_primal; class VOL_dual; class VOL_swing; class VOL_alpha_factor; class VOL_vh; class VOL_indc; class VOL_user_hooks; class VOL_problem; //############################################################################ /** This class contains the parameters controlling the Volume Algorithm */ struct VOL_parms { /** initial value of lambda */ double lambdainit; /** initial value of alpha */ double alphainit; /** minimum value for alpha */ double alphamin; /** when little progress is being done, we multiply alpha by alphafactor */ double alphafactor; /** initial upper bound of the value of an integer solution */ double ubinit; /** accept if max abs viol is less than this */ double primal_abs_precision; /** accept if abs gap is less than this */ double gap_abs_precision; /** accept if rel gap is less than this */ double gap_rel_precision; /** terminate if best_ub - lcost < granularity */ double granularity; /** terminate if the relative increase in lcost through ascent_check_invl steps is less than this */ double minimum_rel_ascent; /** when to check for sufficient relative ascent the first time */ int ascent_first_check; /** through how many iterations does the relative ascent have to reach a minimum */ int ascent_check_invl; /** maximum number of iterations */ int maxsgriters; /** controls the level of printing. The flag should the the 'OR'-d value of the following options:
  • 0 - print nothing
  • 1 - print iteration information
  • 2 - add lambda information
  • 4 - add number of Red, Yellow, Green iterations
Default: 3 */ int printflag; /** controls how often do we print */ int printinvl; /** controls how often we run the primal heuristic */ int heurinvl; /** how many consecutive green iterations are allowed before changing lambda */ int greentestinvl; /** how many consecutive yellow iterations are allowed before changing lambda */ int yellowtestinvl; /** how many consecutive red iterations are allowed before changing lambda */ int redtestinvl; /** number of iterations before we check if alpha should be decreased */ int alphaint; /** name of file for saving dual solution */ char* temp_dualfile; }; //############################################################################ /** vector of doubles. It is used for most vector operations. Note: If VOL_DEBUG is #defined to be 1 then each time an entry is accessed in the vector the index of the entry is tested for nonnegativity and for being less than the size of the vector. It's good to turn this on while debugging, but in final runs it should be turned off (beause of the performance hit). */ class VOL_dvector { public: /** The array holding the vector */ double* v; /** The size of the vector */ int sz; public: /** Construct a vector of size s. The content of the vector is undefined. */ VOL_dvector(const int s) { VOL_TEST_SIZE(s); v = new double[sz = s]; } /** Default constructor creates a vector of size 0. */ VOL_dvector() : v(0), sz(0) {} /** Copy constructor makes a replica of x. */ VOL_dvector(const VOL_dvector& x) : v(0), sz(0) { sz = x.sz; if (sz > 0) { v = new double[sz]; std::copy(x.v, x.v + sz, v); } } /** The destructor deletes the data array. */ ~VOL_dvector() { delete[] v; } /** Return the size of the vector. */ inline int size() const {return sz;} /** Return a reference to the i-th entry. */ inline double& operator[](const int i) { VOL_TEST_INDEX(i, sz); return v[i]; } /** Return the i-th entry. */ inline double operator[](const int i) const { VOL_TEST_INDEX(i, sz); return v[i]; } /** Delete the content of the vector and replace it with a vector of length 0. */ inline void clear() { delete[] v; v = 0; sz = 0; } /** Convex combination. Replace the current vector v with v = (1-gamma) v + gamma w. */ inline void cc(const double gamma, const VOL_dvector& w) { if (sz != w.sz) { printf("bad VOL_dvector sizes\n"); abort(); } double * p_v = v - 1; const double * p_w = w.v - 1; const double * const p_e = v + sz; const double one_gamma = 1.0 - gamma; while ( ++p_v != p_e ){ *p_v = one_gamma * (*p_v) + gamma * (*++p_w); } } /** delete the current vector and allocate space for a vector of size s. */ inline void allocate(const int s) { VOL_TEST_SIZE(s); delete[] v; v = new double[sz = s]; } /** swaps the vector with w. */ inline void swap(VOL_dvector& w) { std::swap(v, w.v); std::swap(sz, w.sz); } /** Copy w into the vector. */ VOL_dvector& operator=(const VOL_dvector& w); /** Replace every entry in the vector with w. */ VOL_dvector& operator=(const double w); }; //----------------------------------------------------------------------------- /** vector of ints. It's used to store indices, it has similar functions as VOL_dvector. Note: If VOL_DEBUG is #defined to be 1 then each time an entry is accessed in the vector the index of the entry is tested for nonnegativity and for being less than the size of the vector. It's good to turn this on while debugging, but in final runs it should be turned off (beause of the performance hit). */ class VOL_ivector { public: /** The array holding the vector. */ int* v; /** The size of the vector. */ int sz; public: /** Construct a vector of size s. The content of the vector is undefined. */ VOL_ivector(const int s) { VOL_TEST_SIZE(s); v = new int[sz = s]; } /** Default constructor creates a vector of size 0. */ VOL_ivector() : v(0), sz(0) {} /** Copy constructor makes a replica of x. */ VOL_ivector(const VOL_ivector& x) { sz = x.sz; if (sz > 0) { v = new int[sz]; std::copy(x.v, x.v + sz, v); } } /** The destructor deletes the data array. */ ~VOL_ivector(){ delete [] v; } /** Return the size of the vector. */ inline int size() const { return sz; } /** Return a reference to the i-th entry. */ inline int& operator[](const int i) { VOL_TEST_INDEX(i, sz); return v[i]; } /** Return the i-th entry. */ inline int operator[](const int i) const { VOL_TEST_INDEX(i, sz); return v[i]; } /** Delete the content of the vector and replace it with a vector of length 0. */ inline void clear() { delete[] v; v = 0; sz = 0; } /** delete the current vector and allocate space for a vector of size s. */ inline void allocate(const int s) { VOL_TEST_SIZE(s); delete[] v; v = new int[sz = s]; } /** swaps the vector with w. */ inline void swap(VOL_ivector& w) { std::swap(v, w.v); std::swap(sz, w.sz); } /** Copy w into the vector. */ VOL_ivector& operator=(const VOL_ivector& v); /** Replace every entry in the vector with w. */ VOL_ivector& operator=(const int w); }; //############################################################################ // A class describing a primal solution. This class is used only internally class VOL_primal { public: // objective value of this primal solution double value; // the largest of the v[i]'s double viol; // primal solution VOL_dvector x; // v=b-Ax, for the relaxed constraints VOL_dvector v; VOL_primal(const int psize, const int dsize) : x(psize), v(dsize) {} VOL_primal(const VOL_primal& primal) : value(primal.value), viol(primal.viol), x(primal.x), v(primal.v) {} ~VOL_primal() {} inline VOL_primal& operator=(const VOL_primal& p) { if (this == &p) return *this; value = p.value; viol = p.viol; x = p.x; v = p.v; return *this; } // convex combination. data members in this will be overwritten // convex combination between two primal solutions // x <-- alpha x + (1 - alpha) p.x // v <-- alpha v + (1 - alpha) p.v inline void cc(const double alpha, const VOL_primal& p) { value = alpha * p.value + (1.0 - alpha) * value; x.cc(alpha, p.x); v.cc(alpha, p.v); } // find maximum of v[i] void find_max_viol(const VOL_dvector& dual_lb, const VOL_dvector& dual_ub); }; //----------------------------------------------------------------------------- // A class describing a dual solution. This class is used only internally class VOL_dual { public: // lagrangian value double lcost; // reduced costs * (pstar-primal) double xrc; // this information is only printed // dual vector VOL_dvector u; VOL_dual(const int dsize) : u(dsize) { u = 0.0;} VOL_dual(const VOL_dual& dual) : lcost(dual.lcost), xrc(dual.xrc), u(dual.u) {} ~VOL_dual() {} inline VOL_dual& operator=(const VOL_dual& p) { if (this == &p) return *this; lcost = p.lcost; xrc = p.xrc; u = p.u; return *this; } // dual step void step(const double target, const double lambda, const VOL_dvector& dual_lb, const VOL_dvector& dual_ub, const VOL_dvector& v); double ascent(const VOL_dvector& v, const VOL_dvector& last_u) const; void compute_xrc(const VOL_dvector& pstarx, const VOL_dvector& primalx, const VOL_dvector& rc); }; //############################################################################ /* here we check whether an iteration is green, yellow or red. Also according to this information we decide whether lambda should be changed */ class VOL_swing { private: VOL_swing(const VOL_swing&); VOL_swing& operator=(const VOL_swing&); public: enum condition {green, yellow, red} lastswing; int lastgreeniter, lastyellowiter, lastrediter; int ngs, nrs, nys; int rd; VOL_swing() { lastgreeniter = lastyellowiter = lastrediter = 0; ngs = nrs = nys = 0; } ~VOL_swing(){} inline void cond(const VOL_dual& dual, const double lcost, const double ascent, const int iter) { double eps = 1.e-3; if (ascent > 0.0 && lcost > dual.lcost + eps) { lastswing = green; lastgreeniter = iter; ++ngs; rd = 0; } else { if (ascent <= 0 && lcost > dual.lcost) { lastswing = yellow; lastyellowiter = iter; ++nys; rd = 0; } else { lastswing = red; lastrediter = iter; ++nrs; rd = 1; } } } inline double lfactor(const VOL_parms& parm, const double lambda, const int iter) { double lambdafactor = 1.0; double eps = 5.e-4; int cons; switch (lastswing) { case green: cons = iter - VolMax(lastyellowiter, lastrediter); if (parm.printflag & 4) printf(" G: Consecutive Gs = %3d\n\n", cons); if (cons >= parm.greentestinvl && lambda < 2.0) { lastgreeniter = lastyellowiter = lastrediter = iter; lambdafactor = 2.0; if (parm.printflag & 2) printf("\n ---- increasing lamda to %g ----\n\n", lambda * lambdafactor); } break; case yellow: cons = iter - VolMax(lastgreeniter, lastrediter); if (parm.printflag & 4) printf(" Y: Consecutive Ys = %3d\n\n", cons); if (cons >= parm.yellowtestinvl) { lastgreeniter = lastyellowiter = lastrediter = iter; lambdafactor = 1.1; if (parm.printflag & 2) printf("\n **** increasing lamda to %g *****\n\n", lambda * lambdafactor); } break; case red: cons = iter - VolMax(lastgreeniter, lastyellowiter); if (parm.printflag & 4) printf(" R: Consecutive Rs = %3d\n\n", cons); if (cons >= parm.redtestinvl && lambda > eps) { lastgreeniter = lastyellowiter = lastrediter = iter; lambdafactor = 0.67; if (parm.printflag & 2) printf("\n **** decreasing lamda to %g *****\n\n", lambda * lambdafactor); } break; } return lambdafactor; } inline void print() { printf("**** G= %i, Y= %i, R= %i ****\n", ngs, nys, nrs); ngs = nrs = nys = 0; } }; //############################################################################ /* alpha should be decreased if after some number of iterations the objective has increased less that 1% */ class VOL_alpha_factor { private: VOL_alpha_factor(const VOL_alpha_factor&); VOL_alpha_factor& operator=(const VOL_alpha_factor&); public: double lastvalue; VOL_alpha_factor() {lastvalue = -COIN_DBL_MAX;} ~VOL_alpha_factor() {} inline double factor(const VOL_parms& parm, const double lcost, const double alpha) { if (alpha < parm.alphamin) return 1.0; register const double ll = VolAbs(lcost); const double x = ll > 10 ? (lcost-lastvalue)/ll : (lcost-lastvalue); lastvalue = lcost; return (x <= 0.01) ? parm.alphafactor : 1.0; } }; //############################################################################ /* here we compute the norm of the conjugate direction -hh-, the norm of the subgradient -norm-, the inner product between the subgradient and the last conjugate direction -vh-, and the inner product between the new conjugate direction and the subgradient */ class VOL_vh { private: VOL_vh(const VOL_vh&); VOL_vh& operator=(const VOL_vh&); public: double hh; double norm; double vh; double asc; VOL_vh(const double alpha, const VOL_dvector& dual_lb, const VOL_dvector& dual_ub, const VOL_dvector& v, const VOL_dvector& vstar, const VOL_dvector& u); ~VOL_vh(){} }; //############################################################################ /* here we compute different parameter to be printed. v2 is the square of the norm of the subgradient. vu is the inner product between the dual variables and the subgradient. vabs is the maximum absolute value of the violations of pstar. asc is the inner product between the conjugate direction and the subgradient */ class VOL_indc { private: VOL_indc(const VOL_indc&); VOL_indc& operator=(const VOL_indc&); public: double v2; double vu; double vabs; double asc; public: VOL_indc(const VOL_dvector& dual_lb, const VOL_dvector& dual_ub, const VOL_primal& primal, const VOL_primal& pstar, const VOL_dual& dual); ~VOL_indc() {} }; //############################################################################# /** The user hooks should be overridden by the user to provide the problem specific routines for the volume algorithm. The user should derive a class ... for all hooks: return value of -1 means that volume should quit */ class VOL_user_hooks { public: virtual ~VOL_user_hooks() {} public: // for all hooks: return value of -1 means that volume should quit /** compute reduced costs @param u (IN) the dual variables @param rc (OUT) the reduced cost with respect to the dual values */ virtual int compute_rc(const VOL_dvector& u, VOL_dvector& rc) = 0; /** Solve the subproblem for the subgradient step. @param dual (IN) the dual variables @param rc (IN) the reduced cost with respect to the dual values @param lcost (OUT) the lagrangean cost with respect to the dual values @param x (OUT) the primal result of solving the subproblem @param v (OUT) b-Ax for the relaxed constraints @param pcost (OUT) the primal objective value of x */ virtual int solve_subproblem(const VOL_dvector& dual, const VOL_dvector& rc, double& lcost, VOL_dvector& x, VOL_dvector& v, double& pcost) = 0; /** Starting from the primal vector x, run a heuristic to produce an integer solution @param x (IN) the primal vector @param heur_val (OUT) the value of the integer solution (return COIN_DBL_MAX here if no feas sol was found */ virtual int heuristics(const VOL_problem& p, const VOL_dvector& x, double& heur_val) = 0; }; //############################################################################# /** This class holds every data for the Volume Algorithm and its solve method must be invoked to solve the problem. The INPUT fields must be filled out completely before solve is invoked. dsol have to be filled out if and only if the last argument to solve is true. */ class VOL_problem { private: VOL_problem(const VOL_problem&); VOL_problem& operator=(const VOL_problem&); void set_default_parm(); // ############ INPUT fields ######################## public: /**@name Constructors and destructor */ //@{ /** Default constructor. */ VOL_problem(); /** Create a a VOL_problem object and read in the parameters from filename. */ VOL_problem(const char *filename); /** Destruct the object. */ ~VOL_problem(); //@} /**@name Method to solve the problem. */ //@{ /** Solve the problem using the hooks. Any information needed in the hooks must be stored in the structure user_data points to. */ int solve(VOL_user_hooks& hooks, const bool use_preset_dual = false); //@} private: /**@name Internal data (may be inquired for) */ //@{ /** value of alpha */ double alpha_; /** value of lambda */ double lambda_; // This union is here for padding (so that data members would be // double-aligned on x86 CPU union { /** iteration number */ int iter_; double __pad0; }; //@} public: /**@name External data (containing the result after solve) */ //@{ /** final lagrangian value (OUTPUT) */ double value; /** final dual solution (INPUT/OUTPUT) */ VOL_dvector dsol; /** final primal solution (OUTPUT) */ VOL_dvector psol; /** violations (b-Ax) for the relaxed constraints */ VOL_dvector viol; //@} /**@name External data (may be changed by the user before calling solve) */ //@{ /** The parameters controlling the Volume Algorithm (INPUT) */ VOL_parms parm; /** length of primal solution (INPUT) */ int psize; /** length of dual solution (INPUT) */ int dsize; /** lower bounds for the duals (if 0 length, then filled with -inf) (INPUT) */ VOL_dvector dual_lb; /** upper bounds for the duals (if 0 length, then filled with +inf) (INPUT) */ VOL_dvector dual_ub; //@} public: /**@name Methods returning final data */ //@{ /** returns the iteration number */ int iter() const { return iter_; } /** returns the value of alpha */ double alpha() const { return alpha_; } /** returns the value of lambda */ double lambda() const { return lambda_; } //@} private: /**@name Private methods used internally */ //@{ /** Read in the parameters from the file filename. */ void read_params(const char* filename); /** initializes duals, bounds for the duals, alpha, lambda */ int initialize(const bool use_preset_dual); /** print volume info every parm.printinvl iterations */ void print_info(const int iter, const VOL_primal& primal, const VOL_primal& pstar, const VOL_dual& dual); /** Checks if lcost is close to the target, if so it increases the target. Close means that we got within 5% of the target. */ double readjust_target(const double oldtarget, const double lcost) const; /** Here we decide the value of alpha1 to be used in the convex combination. The new pstar will be computed as
pstar = alpha1 * pstar + (1 - alpha1) * primal
More details of this are in doc.ps.
IN: alpha, primal, pstar, dual
@return alpha1 */ double power_heur(const VOL_primal& primal, const VOL_primal& pstar, const VOL_dual& dual) const; //@} }; #endif CoinMP-1.8.3/Osi/test/OsiGlpkSolverInterfaceTest.cpp0000644000175000017500000012162011612344643020763 0ustar renerene// Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // Copyright (C) 2004 University of Pittsburgh // University of Pittsburgh coding done by Brady Hunsaker // This file is licensed under the terms of Eclipse Public License (EPL). // OsiGlpkSolverInterfaceTest.cpp adapted from OsiClpSolverInterfaceTest.cpp // on 2004/10/16 // Check for ??? to see tests that aren't working correctly. // Also note that OsiPresolve doesn't appear to work with OsiGlpk. This // needs to be examined. #include "CoinPragma.hpp" #include "OsiConfig.h" //#include //#include //#include //#include #include "OsiUnitTests.hpp" #include "OsiGlpkSolverInterface.hpp" #include "OsiRowCut.hpp" #include "OsiCuts.hpp" #include "CoinFloatEqual.hpp" // Added so windows build with dsp files works, // when not building with glpk. #ifdef COIN_HAS_GLPK void OsiGlpkSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir) { // Test default constructor { OsiGlpkSolverInterface m; OSIUNITTEST_ASSERT_ERROR(m.obj_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.collower_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colupper_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.ctype_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsense_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rhs_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowrange_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowlower_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowupper_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.colsol_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.rowsol_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.matrixByCol_ == NULL, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(m.getApplicationData() == NULL, {}, "glpk", "default constructor"); int i=2346; m.setApplicationData(&i); OSIUNITTEST_ASSERT_ERROR(*((int *)(m.getApplicationData())) == i, {}, "glpk", "default constructor"); } { CoinRelFltEq eq; OsiGlpkSolverInterface m; std::string fn = mpsDir+"exmip1"; m.readMps(fn.c_str(),"mps"); { OsiGlpkSolverInterface im; OSIUNITTEST_ASSERT_ERROR(im.getNumCols() == 0, {}, "glpk", "default constructor"); OSIUNITTEST_ASSERT_ERROR(im.getModelPtr() != NULL, {}, "glpk", "default constructor"); // Test reset im.reset(); OSIUNITTEST_ASSERT_ERROR(m.obj_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.collower_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.colupper_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.ctype_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.rowsense_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.rhs_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.rowrange_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.rowlower_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.rowupper_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.colsol_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.rowsol_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.matrixByCol_ == NULL, {}, "glpk", "reset"); OSIUNITTEST_ASSERT_ERROR(m.getApplicationData() == NULL, {}, "glpk", "reset"); } // Test copy constructor and assignment operator { OsiGlpkSolverInterface lhs; { OsiGlpkSolverInterface im(m); OsiGlpkSolverInterface imC1(im); OSIUNITTEST_ASSERT_ERROR(imC1.getModelPtr() != im.getModelPtr(), {}, "glpk", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumCols() == im.getNumCols(), {}, "glpk", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumRows() == im.getNumRows(), {}, "glpk", "copy constructor"); OsiGlpkSolverInterface imC2(im); OSIUNITTEST_ASSERT_ERROR(imC2.getModelPtr() != im.getModelPtr(), {}, "glpk", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumCols() == im.getNumCols(), {}, "glpk", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumRows() == im.getNumRows(), {}, "glpk", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getModelPtr() != imC2.getModelPtr(), {}, "glpk", "copy constructor"); lhs = imC2; } // Test that lhs has correct values even though rhs has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.getModelPtr() != m.getModelPtr(), {}, "glpk", "assignment operator"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols() == m.getNumCols(), {}, "glpk", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows() == m.getNumRows(), {}, "glpk", "copy constructor"); } // Test clone { OsiGlpkSolverInterface glpkSi(m); OsiSolverInterface * siPtr = &glpkSi; OsiSolverInterface * siClone = siPtr->clone(); OsiGlpkSolverInterface * glpkClone = dynamic_cast(siClone); OSIUNITTEST_ASSERT_ERROR(glpkClone != NULL, {}, "glpk", "clone"); OSIUNITTEST_ASSERT_ERROR(glpkClone->getModelPtr() != glpkSi.getModelPtr(), {}, "glpk", "clone"); OSIUNITTEST_ASSERT_ERROR(glpkClone->getNumRows() == glpkSi.getNumRows(), {}, "glpk", "clone"); OSIUNITTEST_ASSERT_ERROR(glpkClone->getNumCols() == glpkSi.getNumCols(), {}, "glpk", "clone"); delete siClone; } // test infinity { OsiGlpkSolverInterface si; OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == COIN_DBL_MAX, {}, "glpk", "infinity"); } #if 0 // ??? These index error 'throw's aren't in OsiGlpk // Test some catches { OsiGlpkSolverInterface solver; try { solver.setObjCoeff(0,0.0); } catch (CoinError e) { std::cout<<"Correct throw"<getMajorDim() == 5, return, "glpk", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "glpk", "getMatrixByRow: num elements"); CoinRelFltEq eq; const double * ev = smP->getElements(); // GLPK returns each row in reverse order. This is consistent with // the sparse matrix format but is not what most solvers do. That's // why this section is different. OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4], 3.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3], 1.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1],-1.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0],-1.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 2.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 1.1), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], 2.8), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9],-1.2), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 5.6), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "glpk", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 1.9), {}, "glpk", "getMatrixByRow: elements"); const CoinBigIndex * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "glpk", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "glpk", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "glpk", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "glpk", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "glpk", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "glpk", "getMatrixByRow: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 0, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 1, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 4, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 7, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 1, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 2, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 2, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 5, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 3, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 6, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 0, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "glpk", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 7, {}, "glpk", "getMatrixByRow: indices"); } // Test adding several cuts { OsiGlpkSolverInterface fim; std::string fn = mpsDir+"exmip1"; fim.readMps(fn.c_str(),"mps"); // exmip1.mps has 2 integer variables with index 2 & 3 fim.initialSolve(); OsiRowCut cuts[3]; // Generate one ineffective cut plus two trivial cuts int c; int nc = fim.getNumCols(); int *inx = new int[nc]; for (c=0;cgetMajorDim() == 8, return, "glpk", "getMatrixByCol: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getMinorDim() == 5, return, "glpk", "getMatrixByCol: minor dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "glpk", "getMatrixByCol: number of elements"); OSIUNITTEST_ASSERT_ERROR(smP->getSizeVectorStarts() == 9, return, "glpk", "getMatrixByCol: vector starts size"); CoinRelFltEq eq; const double * ev = smP->getElements(); // Unlike row-ordered matrices, GLPK does column-ordered the "normal" way OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 5.6), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2], 1.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3], 2.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4], 1.1), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 1.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6],-2.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 2.8), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8],-1.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 1.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], 1.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11],-1.2), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12],-1.0), {}, "glpk", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "glpk", "getMatrixByCol: elements"); const CoinBigIndex * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "glpk", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 2, {}, "glpk", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 4, {}, "glpk", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 6, {}, "glpk", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 8, {}, "glpk", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 10, {}, "glpk", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[6] == 11, {}, "glpk", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[7] == 12, {}, "glpk", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[8] == 14, {}, "glpk", "getMatrixByCol: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 4, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 0, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 1, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 1, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 2, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 0, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 3, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 0, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 4, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 2, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 3, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 0, {}, "glpk", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 4, {}, "glpk", "getMatrixByCol: indices"); } //-------------- // Test rowsense, rhs, rowrange, matrixByRow { OsiGlpkSolverInterface lhs; { #if 0 // FIXME ??? these won't work because the copy constructor changes the values in m OSIUNITTEST_ASSERT_ERROR(m.rowrange_ == NULL, {}, "glpk", "???"); OSIUNITTEST_ASSERT_ERROR(m.rowsense_ == NULL, {}, "glpk", "???"); OSIUNITTEST_ASSERT_ERROR(m.rhs_ == NULL, {}, "glpk", "???"); OSIUNITTEST_ASSERT_ERROR(m.matrixByRow_ == NULL, {}, "glpk", "???"); #endif OsiGlpkSolverInterface siC1(m); OSIUNITTEST_ASSERT_WARNING(siC1.rowrange_ == NULL, {}, "glpk", "row range"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsense_ == NULL, {}, "glpk", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1.rhs_ == NULL, {}, "glpk", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1.matrixByRow_ == NULL, {}, "glpk", "matrix by row"); const char * siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "glpk", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "glpk", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "glpk", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "glpk", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "glpk", "row sense"); const double * siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "glpk", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "glpk", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "glpk", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "glpk", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "glpk", "right hand side"); const double * siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "glpk", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "glpk", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "glpk", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "glpk", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "glpk", "row range"); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "glpk", "matrix by row"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "glpk", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "glpk", "matrix by row: num elements"); const double * ev = siC1mbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4], 3.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3], 1.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1],-1.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0],-1.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 2.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 1.1), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], 2.8), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9],-1.2), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 5.6), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "glpk", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 1.9), {}, "glpk", "matrix by row: elements"); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "glpk", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "glpk", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "glpk", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "glpk", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "glpk", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "glpk", "matrix by row: vector starts"); const int * ei = siC1mbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 0, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 1, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 4, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 7, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 1, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 2, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 2, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 5, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 3, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 6, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 0, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 7, {}, "glpk", "matrix by row: indices"); OSIUNITTEST_ASSERT_WARNING(siC1rs == siC1.getRowSense(), {}, "glpk", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "glpk", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1rr == siC1.getRowRange(), {}, "glpk", "row range"); // Change glpk Model by adding free row OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb( COIN_DBL_MAX); OsiCuts cuts; cuts.insert(rc); siC1.applyCuts(cuts); // Since model was changed, test that cached data is now freed. OSIUNITTEST_ASSERT_ERROR(siC1.rowrange_ == NULL, {}, "glpk", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsense_ == NULL, {}, "glpk", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rhs_ == NULL, {}, "glpk", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.matrixByRow_ == NULL, {}, "glpk", "free cached data after adding row"); siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "glpk", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "glpk", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "glpk", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "glpk", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "glpk", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "glpk", "row sense after adding row"); siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "glpk", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "glpk", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "glpk", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "glpk", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "glpk", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "glpk", "right hand side after adding row"); siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "glpk", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "glpk", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "glpk", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "glpk", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "glpk", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "glpk", "row range after adding row"); lhs = siC1; } // Test that lhs has correct values even though siC1 has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.rowrange_ == NULL, {}, "glpk", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsense_ == NULL, {}, "glpk", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rhs_ == NULL, {}, "glpk", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByRow_ == NULL, {}, "glpk", "freed origin after assignment"); const char * lhsrs = lhs.getRowSense(); OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "glpk", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "glpk", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "glpk", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "glpk", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "glpk", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "glpk", "row sense after assignment"); const double * lhsrhs = lhs.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "glpk", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "glpk", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "glpk", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "glpk", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "glpk", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "glpk", "right hand side after assignment"); const double *lhsrr = lhs.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "glpk", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "glpk", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "glpk", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "glpk", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "glpk", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "glpk", "row range after assignment"); const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, return, "glpk", "matrix by row after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "glpk", "matrix by row after assignment: major dim"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "glpk", "matrix by row after assignment: num elements"); const double * ev = lhsmbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4], 3.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3], 1.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1],-1.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0],-1.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 2.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 1.1), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], 2.8), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9],-1.2), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 5.6), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "glpk", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 1.9), {}, "glpk", "matrix by row after assignment: elements"); const CoinBigIndex * mi = lhsmbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "glpk", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "glpk", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "glpk", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "glpk", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "glpk", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "glpk", "matrix by row after assignment: vector starts"); const int * ei = lhsmbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 0, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 1, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 4, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 7, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 1, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 2, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 2, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 5, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 3, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 6, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 0, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "glpk", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 7, {}, "glpk", "matrix by row after assignment: indices"); } } // Test add/delete columns { OsiGlpkSolverInterface m; std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); double inf = m.getInfinity(); CoinPackedVector c0; c0.insert(0, 4); c0.insert(1, 1); m.addCol(c0, 0, inf, 3); m.initialSolve(); double objValue = m.getObjValue(); CoinRelFltEq eq(1.0e-2); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "glpk", "add/delete columns: first optimal value"); // Try deleting first column that's nonbasic at lower bound (0). int * d = new int[1]; CoinWarmStartBasis *cwsb = dynamic_cast(m.getWarmStart()) ; OSIUNITTEST_ASSERT_ERROR(cwsb != NULL, {}, "glpk", "add/delete columns: have warm start basis"); CoinWarmStartBasis::Status stati ; int iCol ; for (iCol = 0 ; iCol < cwsb->getNumStructural() ; iCol++) { stati = cwsb->getStructStatus(iCol) ; if (stati == CoinWarmStartBasis::atLowerBound) break ; } d[0]=iCol; m.deleteCols(1,d); delete [] d; delete cwsb; d=NULL; m.resolve(); objValue = m.getObjValue(); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "glpk", "add/delete columns: optimal value after deleting nonbasic column"); // Try deleting column we added. If basic, go to initialSolve as deleting // basic variable trashes basis required for warm start. iCol = m.getNumCols()-1; cwsb = dynamic_cast(m.getWarmStart()) ; stati = cwsb->getStructStatus(iCol) ; delete cwsb; m.deleteCols(1,&iCol); if (stati == CoinWarmStartBasis::basic) { m.initialSolve() ; } else { m.resolve(); } objValue = m.getObjValue(); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "glpk", "add/delete columns: optimal value after deleting added column"); } #if 0 // ??? Simplex routines not adapted to OsiGlpk yet // Solve an lp by hand { OsiGlpkSolverInterface m; std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); m.setObjSense(-1.0); m.getModelPtr()->messageHandler()->setLogLevel(4); m.initialSolve(); m.getModelPtr()->factorization()->maximumPivots(5); m.setObjSense(1.0); // enable special mode m.enableSimplexInterface(true); // we happen to know that variables are 0-1 and rows are L int numberIterations=0; int numberColumns = m.getNumCols(); int numberRows = m.getNumRows(); double * fakeCost = new double[numberColumns]; double * duals = new double [numberRows]; double * djs = new double [numberColumns]; const double * solution = m.getColSolution(); memcpy(fakeCost,m.getObjCoefficients(),numberColumns*sizeof(double)); while (1) { const double * dj; const double * dual; if ((numberIterations&1)==0) { // use given ones dj = m.getReducedCost(); dual = m.getRowPrice(); } else { // create dj = djs; dual = duals; m.getReducedGradient(djs,duals,fakeCost); } int i; int colIn=9999; int direction=1; double best=1.0e-6; // find most negative reduced cost // Should check basic - but should be okay on this problem for (i=0;ibest) { direction=-1; best=value; colIn=-i-1; } } for (i=0;ibest&&solution[i]>1.0-1.0e-6) { direction=-1; best=value; colIn=i; } } if (colIn==9999) break; // should be optimal int colOut; int outStatus; double theta; OSIUNITTEST_ASSERT_ERROR(m.primalPivotResult(colIn,direction,colOut,outStatus,theta,NULL) == 0, {}, "glpk", "simplex routines"); printf("out %d, direction %d theta %g\n", colOut,outStatus,theta); numberIterations++; } delete [] fakeCost; delete [] duals; delete [] djs; // exit special mode m.disableSimplexInterface(); m.getModelPtr()->messageHandler()->setLogLevel(4); m.resolve(); OSIUNITTEST_ASSERT_ERROR(m.getIterationCount() == 0, {}, "glpk", "simplex routines"); m.setObjSense(-1.0); m.initialSolve(); } // Solve an lp when interface is on { OsiGlpkSolverInterface m; std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); // enable special mode m.setHintParam(OsiDoScale,false,OsiHintDo); m.setHintParam(OsiDoPresolveInInitial,false,OsiHintDo); m.setHintParam(OsiDoDualInInitial,false,OsiHintDo); m.setHintParam(OsiDoPresolveInResolve,false,OsiHintDo); m.setHintParam(OsiDoDualInResolve,false,OsiHintDo); m.enableSimplexInterface(true); m.initialSolve(); } // Check tableau stuff when simplex interface is on { OsiGlpkSolverInterface m; /* Wolsey : Page 130 max 4x1 - x2 7x1 - 2x2 <= 14 x2 <= 3 2x1 - 2x2 <= 3 x1 in Z+, x2 >= 0 */ double inf_ = m.getInfinity(); int n_cols = 2; int n_rows = 3; double obj[2] = {-4.0, 1.0}; double collb[2] = {0.0, 0.0}; double colub[2] = {inf_, inf_}; double rowlb[3] = {-inf_, -inf_, -inf_}; double rowub[3] = {14.0, 3.0, 3.0}; int rowIndices[5] = {0, 2, 0, 1, 2}; int colIndices[5] = {0, 0, 1, 1, 1}; double elements[5] = {7.0, 2.0, -2.0, 1.0, -2.0}; CoinPackedMatrix M(true, rowIndices, colIndices, elements, 5); m.loadProblem(M, collb, colub, obj, rowlb, rowub); m.enableSimplexInterface(true); m.initialSolve(); //check that the tableau matches wolsey (B-1 A) // slacks in second part of binvA double * binvA = (double*) malloc((n_cols+n_rows) * sizeof(double)); printf("B-1 A"); for(int i = 0; i < n_rows; i++){ m.getBInvARow(i, binvA,binvA+n_cols); printf("\nrow: %d -> ",i); for(int j=0; j < n_cols+n_rows; j++){ printf("%g, ", binvA[j]); } } printf("\n"); m.disableSimplexInterface(); free(binvA); } #endif /* Read in exmip1 and solve it with verbose output setting. */ { OsiGlpkSolverInterface osi ; std::cout << "Boosting verbosity.\n" ; osi.setHintParam(OsiDoReducePrint,false,OsiForceDo) ; std::string exmpsfile = mpsDir+"exmip1" ; std::string probname ; std::cout << "Reading mps file \"" << exmpsfile << "\"\n" ; osi.readMps(exmpsfile.c_str(), "mps") ; OSIUNITTEST_ASSERT_ERROR(osi.getStrParam(OsiProbName,probname), {}, "glpk", "get problem name"); std::cout << "Solving " << probname << " ... \n" ; osi.initialSolve() ; double val = osi.getObjValue() ; std::cout << "And the answer is " << val << ".\n" ; OSIUNITTEST_ASSERT_ERROR(fabs(val - 3.23) < 0.01, {}, "glpk", "solve exmip1"); } // Do common solverInterface testing { OsiGlpkSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir); } } #endif CoinMP-1.8.3/Osi/CHANGELOG0000644000175000017500000001134312536245674013300 0ustar renerene09/06/2015 OsiSpx - added compatibility with SoPlex 2.2 - added OsiSpx::getLpPtr() 12/06/2014 OsiSpx - added compatibility with SoPlex 2.0 (using SoPlex legacy interface) 10/02/2014 OsiMsk - fixed bug in OsiMsk::getPrimalRays() when number of rows < number of columns 17/01/2014 OsiGrb - fixed bug in OsiGrb::deleteCols() where the columns types got lost 11/18/2013 OsiMsk - changed MIP optimizer to Mosek's own conic MIP optimizer, if Mosek version >= 7 09/11/2013 OsiCpx - fixed getIterationCount() for MIPs (use CPXgetmipitcnt instead of CPXgetitcnt) 08/30/2013 OsiGrb - fixed bug in getObjectiveCoefficients and getBasisStatus for LPs without ranged rows 08/23/2013 OsiGrb - fixed bug in deleting row or column names when deleting several rows/columns at once 04/02/2013 OsiMsk - update to work with Mosek 7, too (contributed by Erling D. Andersen) 02/02/2013 OsiUnitTest - replace macro for asserting a condition and collecting its outcome by a function to improve compilation speed (contributed by Victor Zverovich) 29/11/2012 OsiMsk - added getRescode() to get result code of last MSK_optimize call 21/11/2012 OsiCpx - calling setWarmStart with a too small basis now disables the use of an advanced basis for the next LP solve 20/11/2012 OsiGlpk, OsiCpx - workaround problem in Glpk with empty problem name (patch by Bertrand Le Cun) - not using CPXsolninfo for MIPs with CPLEX < 11.0 anymore 25/07/2012 OsiGrb - fix mipstart option in OsiGrb: pass only values for discrete variables to Gurobi 26/11/2011 OsiGrb - add implementation of OsiGrb::applyCuts that batches the row cuts before transfering them to Gurobi 12/11/2011 OsiSpx - add resolve with cleared basis if solve fails with exception (which may be due to a singular startbasis), needs SoPlex >= 1.5.0.7 03/09/2011 OsiMsk - fix bug in one loadProblem method when NULL was passed as row range array 30/07/2011 Osi - fix writing LP files with names: the objective name was not copied, leading to a segfault in CoinLpIO 30/07/2011 OsiSpx, OsiGlpk - allow NULLs for row* arguments in some loadProblem call 28/07/2011 OsiSpx - invert dual ray in getDualRays to match Osi definition when testing infeasibility proof 12/07/2011 MSVisualStudio - updated MSVC++ v10 project files to catch up with buildsystem changes 25/06/2011 Osi - add generic implementations of is{Primal,Dual}ObjectiveLimitReached 25/06/2011 OsiCommonTest - add unittest command line parameter -onerror to specify behaviour in case of a failing test 23/06/2011 OsiMsk - add isLicenseError() to check whether last solve was abandoned due to a mosek licensing issue 22/06/2011 OsiCpx - fix handling of primal/dual objective limit so it correctly takes objoffset into account - preserve objective sense also when empty model is loaded - make sure getWarmStart returns proper atlower/atupper status for inequalities 13/06/2011 OsiCommonTest, unittest - removed now redundant counting of unittest failures, so test functions now return void 03/06/2011 OsiMsk - fix caching flags (bitwise negation is ~, not !) - free all cached data when loading problem - fix getDualRay and getPrimalRay so they should return a ray now - fixed various further issues in unittest, so OsiMsk passes it now 15/05/2011 OsiXpr - added option (mipstart) to pass column solution as initial solution to a MIP solve 30/04/2011 OsiCpx, OsiGrb - added option (mipstart) to pass column solution as initial solution to a MIP solve 29/04/2011 OsiMsk - fix loss of Mosek task when copying OsiMsk 25/04/2011 OsiSpx - add methods to set/get/check timelimit - fix bug in solve methods where cached result vectors where not cleared - fix setWarmStart to swap status for slack variables as in getWarmStart - fix caching flags (bitwise negation is ~, not !) - redirect set/get name discipline to base class - fix primal/dual objective limit: take objoffset into account, correct check if limit changed after solve - getColSolution and getObjValue now return lower bound and value in lower bound before solve 01/04/2011 OsiGlpk - if initial basis is invalid or singular in initialSolve or resolve, construct advanced basis and try again 31/03/2011 OsiGrb - fixed handling of free variables in setWarmStart 30/03/2011 OsiGrb - fixed memory leak in loadProblem 21/03/2011 OsiCommonTest, unittest - add classes TestOutcome{s} to collect outcome of unittests - add macros to simplify asserts and exception catching and storing results as TestOutcome - change general and OsiGlpk tests to use new macros - return number of unexpected errors as return code of unittest - add parameter -verbosity to unittest to specify amount of output of unittests - a bit cleanup 21/03/2011 started CHANGELOG CoinMP-1.8.3/Osi/missing0000755000175000017500000002540611405216166013456 0ustar renerene#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Osi/install-sh0000755000175000017500000002202111405216166014051 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Osi/configure.ac0000644000175000017500000002055012600104755014336 0ustar renerene# Copyright (C) 2006 International Business Machines. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: configure.ac 2031 2015-09-21 22:51:25Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 ############################################################################# # Names and other basic things # ############################################################################# AC_PREREQ(2.59) AC_INIT([Osi],[0.107.6],[osi@list.coin-or.org]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License.]) # List one file in the package so that the configure script can test # whether the package is actually there AC_CONFIG_SRCDIR(src/Osi/OsiAuxInfo.cpp) # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. AC_PREFIX_DEFAULT([`pwd`]) ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type AC_CANONICAL_BUILD # A bit of initial setup AC_COIN_PROJECTDIR_INIT(Osi,13:6:12) # Check if user wants to produce debugging code AC_COIN_DEBUG_COMPILE(Osi) # Get the name of the C++ compiler and appropriate compiler options AC_COIN_PROG_CXX # Initialize automake and libtool AC_COIN_INIT_AUTO_TOOLS ############################################################################# # COIN-OR components # ############################################################################# AC_COIN_CHECK_PACKAGE(CoinUtils, [coinutils], [OsiLib]) if test $coin_has_coinutils != yes ; then AC_MSG_ERROR([Required package CoinUtils not available.]) fi AC_COIN_CHECK_PACKAGE(Glpk, [coinglpk], [OsiGlpkLib]) AC_COIN_CHECK_PACKAGE(SoPlex, [coinsoplex],[OsiSpxLib]) AC_COIN_CHECK_PACKAGE(Sample, [coindatasample]) AC_COIN_CHECK_PACKAGE(Netlib, [coindatanetlib]) ############################################################################# # Third party solvers # ############################################################################# # Check which third party solvers are available. Cplex detection has been # tested on a semi-regular basis, and Mosek detection most likely works. For # the rest, it's anyone's guess. -- lh, 080529 -- # fixed detection of Mosek and Xpress -- stefan, 091003 (linux32, gcc) -- AC_COIN_CHECK_USER_LIBRARY([Cplex], [CPX],[cplex.h], [CPXgetstat]) AC_COIN_CHECK_USER_LIBRARY([Mosek], [MSK],[mosek.h], [MSK_makeenv]) AC_COIN_CHECK_USER_LIBRARY([Xpress],[XPR],[xprs.h], [XPRSinit]) AC_COIN_CHECK_USER_LIBRARY([Gurobi],[GRB],[gurobi_c.h],[GRBloadenv]) ############################################################################# # Examples solver # ############################################################################# # choose a solver interface that can be used in the examples if test $coin_has_glpk = yes ; then OSI_EXAMPLES_SOLVER_NAME=OsiGlpkSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="$GLPK_CFLAGS" OSI_EXAMPLES_SOLVER_LIBS="-lOsiGlpk $GLPK_LIBS_INSTALLED" OSI_EXAMPLES_SOLVER_PCNAME=osi-glpk elif test $coin_has_cpx = true ; then OSI_EXAMPLES_SOLVER_NAME=OsiCpxSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="-I$CPXINCDIR" OSI_EXAMPLES_SOLVER_LIBS="-lOsiCpx $CPXLIB" OSI_EXAMPLES_SOLVER_PCNAME=osi-cplex elif test $coin_has_grb = true ; then OSI_EXAMPLES_SOLVER_NAME=OsiGrbSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="-I$GRBINCDIR" OSI_EXAMPLES_SOLVER_LIBS="-lOsiGrb $GRBLIB" OSI_EXAMPLES_SOLVER_PCNAME=osi-gurobi elif test $coin_has_msk = true ; then OSI_EXAMPLES_SOLVER_NAME=OsiMskSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="-I$MSKINCDIR" OSI_EXAMPLES_SOLVER_LIBS="-lOsiMsk $MSKLIB" OSI_EXAMPLES_SOLVER_PCNAME=osi-mosek elif test $coin_has_xpr = true ; then OSI_EXAMPLES_SOLVER_NAME=OsiXprSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="-I$XPRINCDIR" OSI_EXAMPLES_SOLVER_LIBS="-lOsiXpr $XPRLIB" OSI_EXAMPLES_SOLVER_PCNAME=osi-xpress elif test $coin_has_soplex = yes ; then OSI_EXAMPLES_SOLVER_NAME=OsiSpxSolverInterface OSI_EXAMPLES_SOLVER_CFLAGS="$SOPLEX_CFLAGS" OSI_EXAMPLES_SOLVER_LIBS="-lOsiSpx $SOPLEX_LIBS_INSTALLED" OSI_EXAMPLES_SOLVER_PCNAME=osi-soplex else AC_MSG_WARN([No solver available, examples will not work.]) fi # adjust linker flags for (i)cl compiler if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then [OSI_EXAMPLES_SOLVER_LIBS=`echo " $OSI_EXAMPLES_SOLVER_LIBS" | sed -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'`] fi AC_SUBST(OSI_EXAMPLES_SOLVER_NAME) AC_SUBST(OSI_EXAMPLES_SOLVER_CFLAGS) AC_SUBST(OSI_EXAMPLES_SOLVER_LIBS) AC_SUBST(OSI_EXAMPLES_SOLVER_PCNAME) ############################################################################# # Configuration options for individual OSIs # ############################################################################# # If any of the tests performed in this section actually require the presence # of the solver (file presence, link checks, etc.) be sure to guard the call. # We assume that GLPK is not too old AC_DEFINE(GLPK_HAS_INTOPT, [1], [Define to 1 if GLPK has the advanced B&B solver lpx_intopt]) ############################################################################# # Check for doxygen # ############################################################################# AC_COIN_DOXYGEN(CoinUtils) ############################################################################# # System header # ############################################################################# AC_COIN_CHECK_CXX_CHEADER(math) AC_COIN_CHECK_CXX_CHEADER(float) AC_COIN_CHECK_CXX_CHEADER(ieeefp) ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) AC_CONFIG_FILES([Makefile examples/Makefile src/Osi/Makefile src/OsiCpx/Makefile src/OsiGlpk/Makefile src/OsiMsk/Makefile src/OsiXpr/Makefile src/OsiGrb/Makefile src/OsiSpx/Makefile src/OsiCommonTest/Makefile test/Makefile osi.pc osi-uninstalled.pc osi-unittests.pc osi-unittests-uninstalled.pc]) if test $coin_has_cpx = true ; then AC_CONFIG_FILES([osi-cplex.pc:src/OsiCpx/osi-cplex.pc.in osi-cplex-uninstalled.pc:src/OsiCpx/osi-cplex-uninstalled.pc.in]) fi if test $coin_has_glpk = yes ; then AC_CONFIG_FILES([osi-glpk.pc:src/OsiGlpk/osi-glpk.pc.in osi-glpk-uninstalled.pc:src/OsiGlpk/osi-glpk-uninstalled.pc.in]) fi if test $coin_has_grb = true ; then AC_CONFIG_FILES([osi-gurobi.pc:src/OsiGrb/osi-gurobi.pc.in osi-gurobi-uninstalled.pc:src/OsiGrb/osi-gurobi-uninstalled.pc.in]) fi if test $coin_has_msk = true ; then AC_CONFIG_FILES([osi-mosek.pc:src/OsiMsk/osi-mosek.pc.in osi-mosek-uninstalled.pc:src/OsiMsk/osi-mosek-uninstalled.pc.in]) fi if test $coin_has_xpr = true ; then AC_CONFIG_FILES([osi-xpress.pc:src/OsiXpr/osi-xpress.pc.in osi-xpress-uninstalled.pc:src/OsiXpr/osi-xpress-uninstalled.pc.in]) fi if test $coin_has_soplex = yes ; then AC_CONFIG_FILES([osi-soplex.pc:src/OsiSpx/osi-soplex.pc.in osi-soplex-uninstalled.pc:src/OsiSpx/osi-soplex-uninstalled.pc.in]) fi AC_CONFIG_FILES([doxydoc/doxygen.conf]) # Here put the location and name of the configuration header file AC_CONFIG_HEADER([src/Osi/config.h src/Osi/config_osi.h]) # Finally, we let configure write all the output... AC_COIN_FINALIZE CoinMP-1.8.3/Osi/doxydoc/0000755000175000017500000000000012600453455013523 5ustar renereneCoinMP-1.8.3/Osi/doxydoc/doxygen.conf.in0000644000175000017500000017400012231275137016455 0ustar renerene# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doxydoc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = "@abs_top_srcdir@/" # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = @coin_doxy_logname@ #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @abs_top_srcdir@/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.hpp \ *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.svn* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 3 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = YES # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = YES # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = letter # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = @coin_doxy_tagfiles@ # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = @coin_doxy_tagname@ # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = YES # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = @coin_doxy_usedot@ # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES CoinMP-1.8.3/Osi/src/0000755000175000017500000000000012600453455012641 5ustar renereneCoinMP-1.8.3/Osi/src/OsiGrb/0000755000175000017500000000000012600453455014026 5ustar renereneCoinMP-1.8.3/Osi/src/OsiGrb/Makefile.in0000644000175000017500000005454612506051753016111 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2009 Stefan Vigerske and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/OsiGrb DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Osi/config.h \ $(top_builddir)/src/Osi/config_osi.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libOsiGrb_la_LIBADD = am_libOsiGrb_la_OBJECTS = OsiGrbSolverInterface.lo libOsiGrb_la_OBJECTS = $(am_libOsiGrb_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsiGrb_la_SOURCES) DIST_SOURCES = $(libOsiGrb_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiGrb ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiGrb.la # List all source files for this library, including headers libOsiGrb_la_SOURCES = OsiGrbSolverInterface.cpp OsiGrbSolverInterface.hpp # This is for libtool (on Windows) libOsiGrb_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../Osi` \ -I`$(CYGPATH_W) $(GRBINCDIR)` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiGrbSolverInterface.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/OsiGrb/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/OsiGrb/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsiGrb.la: $(libOsiGrb_la_OBJECTS) $(libOsiGrb_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsiGrb_la_LDFLAGS) $(libOsiGrb_la_OBJECTS) $(libOsiGrb_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiGrbSolverInterface.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool 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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # 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: CoinMP-1.8.3/Osi/src/OsiGrb/osi-gurobi-uninstalled.pc.in0000644000175000017500000000044011507670402021352 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/OsiGrb Name: OsiGurobi Description: COIN-OR Open Solver Interface for Gurobi URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsiGrb.la @GRBLIB@ Cflags: -I@abs_source_dir@/src/OsiGrb -I@GRBINCDIR@ Requires: osi CoinMP-1.8.3/Osi/src/OsiGrb/Makefile.am0000644000175000017500000000302412101340333016043 0ustar renerene# Copyright (C) 2009 Stefan Vigerske and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1881 2013-01-28 00:05:47Z stefan $ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiGrb ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiGrb.la # List all source files for this library, including headers libOsiGrb_la_SOURCES = OsiGrbSolverInterface.cpp OsiGrbSolverInterface.hpp # This is for libtool (on Windows) libOsiGrb_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../Osi` \ -I`$(CYGPATH_W) $(GRBINCDIR)` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiGrbSolverInterface.hpp CoinMP-1.8.3/Osi/src/OsiGrb/osi-gurobi.pc.in0000644000175000017500000000046711510106235017033 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiGurobi Description: COIN-OR Open Solver Interface for Gurobi URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiGrb @GRBLIB@ Cflags: -I${includedir} -I@GRBINCDIR@ Requires: osi CoinMP-1.8.3/Osi/src/OsiGrb/OsiGrbSolverInterface.hpp0000644000175000017500000010167111664213777020760 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for Gurobi // template: OSI Cplex Interface written by T. Achterberg // author: Stefan Vigerske // Humboldt University Berlin // date: 09/02/2009 // license: this file may be freely distributed under the terms of EPL // comments: please scan this file for '???' and read the comments //----------------------------------------------------------------------------- // Copyright (C) 2009 Humboldt University Berlin and others. // All Rights Reserved. // $Id: OsiGrbSolverInterface.hpp 1830 2011-11-26 16:46:55Z stefan $ #ifndef OsiGrbSolverInterface_H #define OsiGrbSolverInterface_H #include #include "OsiSolverInterface.hpp" typedef struct _GRBmodel GRBmodel; typedef struct _GRBenv GRBenv; /** Gurobi Solver Interface Instantiation of OsiGrbSolverInterface for Gurobi */ class OsiGrbSolverInterface : virtual public OsiSolverInterface { friend void OsiGrbSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound(); //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Set a string parameter bool setStrParam(OsiStrParam key, const std::string & value); // Set a hint parameter bool setHintParam(OsiHintParam key, bool yesNo = true, OsiHintStrength strength = OsiHintTry, void* = NULL); // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; // Get a hint parameter bool getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength, void*& otherInformation) const; // Get a hint parameter bool getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength) const; // Get a hint parameter bool getHintParam(OsiHintParam key, bool& yesNo) const; // Set mipstart option (pass column solution to CPLEX before MIP start) void setMipStart(bool value) { domipstart = value; } // Get mipstart option value bool getMipStart() const { return domipstart; } //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ //@{ /*! \brief Get an empty warm start object This routine returns an empty CoinWarmStartBasis object. Its purpose is to provide a way to give a client a warm start basis object of the appropriate type, which can resized and modified as desired. */ CoinWarmStart* getEmptyWarmStart() const; /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching).
The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const; /// Get number of rows virtual int getNumRows() const; /// Get number of nonzero elements virtual int getNumElements() const; /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const; /** Get pointer to array[getNumRows()] of row constraint senses.
  • 'L': <= constraint
  • 'E': = constraint
  • 'G': >= constraint
  • 'R': ranged constraint
  • 'N': free constraint
*/ virtual const char * getRowSense() const; /** Get pointer to array[getNumRows()] of rows right-hand sides
  • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
  • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'N' then rhs()[i] == 0.0
*/ virtual const double * getRightHandSide() const; /** Get pointer to array[getNumRows()] of row ranges.
  • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
  • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
*/ virtual const double * getRowRange() const; /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const; /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const; /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const; /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const; /// Return true if column is continuous virtual bool isContinuous(int colNumber) const; /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const; //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const; /// Get objective function value virtual double getObjValue() const; /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const; /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay=false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff(int elementIndex, double elementValue); /** Set a a set of objective function coefficients */ virtual void setObjCoeffSet(const int* indexFirst, const int* indexLast, const double* coeffList); using OsiSolverInterface::setColLower; /** Set a single column lower bound
Use -COIN_DBL_MAX for -infinity. */ virtual void setColLower(int elementIndex, double elementValue); using OsiSolverInterface::setColUpper; /** Set a single column upper bound
Use COIN_DBL_MAX for infinity. */ virtual void setColUpper(int elementIndex, double elementValue); /** Set a single column lower and upper bound
The default implementation just invokes setColLower() and setColUpper() */ virtual void setColBounds(int elementIndex, double lower, double upper); /** Set the bounds on a number of columns simultaneously
The default implementation just invokes setCollower() and setColupper() over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound
Use -COIN_DBL_MAX for -infinity. */ virtual void setRowLower(int elementIndex, double elementValue); /** Set a single row upper bound
Use COIN_DBL_MAX for infinity. */ virtual void setRowUpper(int elementIndex, double elementValue); /** Set a single row lower and upper bound
The default implementation just invokes setRowLower() and setRowUpper() */ virtual void setRowBounds(int elementIndex, double lower, double upper); /** Set the type of a single row
*/ virtual void setRowType(int index, char sense, double rightHandSide, double range); /** Set the bounds on a number of rows simultaneously
The default implementation just invokes setRowLower() and setRowUpper() over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
The default implementation just invokes setRowType() and over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose type changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); //@} //------------------------------------------------------------------------- /**@name Naming methods */ //@{ /*! \brief Set a row name */ virtual void setRowName(int ndx, std::string name) ; /*! \brief Set a column name */ virtual void setColName(int ndx, std::string name) ; //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s); /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ using OsiSolverInterface::addCol; /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); using OsiSolverInterface::addCols; /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); /** */ virtual void deleteCols(const int num, const int * colIndices); using OsiSolverInterface::addRow; /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); using OsiSolverInterface::addRows; /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); /** */ virtual void deleteRows(const int num, const int * rowIndices); //@} //@} //--------------------------------------------------------------------------- /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient
*/ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • obj: all variables have 0 objective coefficient
  • rowsen: all rows are >=
  • rowrhs: all right hand sides are 0
  • rowrng: 0 for the ranged rows
*/ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); using OsiSolverInterface::readMps; /** Read an mps file from the given filename */ virtual int readMps(const char *filename, const char *extension = "mps"); /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; //@} //--------------------------------------------------------------------------- /**@name Gurobi specific public interfaces */ //@{ /** Get pointer to Gurobi model and free all specified cached data entries (combined with logical or-operator '|' ): */ enum keepCachedFlag { /// discard all cached data (default) KEEPCACHED_NONE = 0, /// column information: objective values, lower and upper bounds, variable types KEEPCACHED_COLUMN = 1, /// row information: right hand sides, ranges and senses, lower and upper bounds for row KEEPCACHED_ROW = 2, /// problem matrix: matrix ordered by column and by row KEEPCACHED_MATRIX = 4, /// LP solution: primal and dual solution, reduced costs, row activities KEEPCACHED_RESULTS = 8, /// only discard cached LP solution KEEPCACHED_PROBLEM = KEEPCACHED_COLUMN | KEEPCACHED_ROW | KEEPCACHED_MATRIX, /// keep all cached data (similar to getMutableLpPtr()) KEEPCACHED_ALL = KEEPCACHED_PROBLEM | KEEPCACHED_RESULTS, /// free only cached column and LP solution information FREECACHED_COLUMN = KEEPCACHED_PROBLEM & ~KEEPCACHED_COLUMN, /// free only cached row and LP solution information FREECACHED_ROW = KEEPCACHED_PROBLEM & ~KEEPCACHED_ROW, /// free only cached matrix and LP solution information FREECACHED_MATRIX = KEEPCACHED_PROBLEM & ~KEEPCACHED_MATRIX, /// free only cached LP solution information FREECACHED_RESULTS = KEEPCACHED_ALL & ~KEEPCACHED_RESULTS }; GRBmodel* getLpPtr(int keepCached = KEEPCACHED_NONE); //@{ /// Method to access Gurobi environment pointer GRBenv* getEnvironmentPtr() const; /// Return whether the current Gurobi environment runs in demo mode. bool isDemoLicense() const; //@} /// return a vector of variable types (continous, binary, integer) const char* getCtype() const; /**@name Static instance counter methods */ /** Gurobi has a context which must be created prior to all other Gurobi calls. This method:
  • Increments by 1 the number of uses of the Gurobi environment.
  • Creates the Gurobi context when the number of uses is change to 1 from 0.
*/ static void incrementInstanceCounter(); /** Gurobi has a context which should be deleted after Gurobi calls. This method:
  • Decrements by 1 the number of uses of the Gurobi environment.
  • Deletes the Gurobi context when the number of uses is change to 0 from 1.
*/ static void decrementInstanceCounter(); /// sets the global gurobi environment to a user given one static void setEnvironment(GRBenv* globalenv); /// Return the number of instances of instantiated objects using Gurobi services. static unsigned int getNumInstances(); //@} //@} /**@name Constructors and destructor */ //@{ /// Default Constructor OsiGrbSolverInterface(bool use_local_env = false); /// Constructor that takes a gurobi environment and assumes membership OsiGrbSolverInterface(GRBenv* localgrbenv); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiGrbSolverInterface(const OsiGrbSolverInterface&); /// Assignment operator OsiGrbSolverInterface& operator=(const OsiGrbSolverInterface& rhs); /// Destructor virtual ~OsiGrbSolverInterface(); /// Resets as if default constructor virtual void reset(); //@} /***************************************************************************/ /**@name OsiSimplexInterface methods Gurobi adds a slack with coeff +1 in "<=" and "=" constraints, with coeff -1 in ">=", slack being non negative. We switch in order to get a "Clp tableau" where all the slacks have coefficient +1 in the original tableau. If a slack for ">=" is non basic, invB is not changed; column of the slack in the optimal tableau is flipped. If a slack for ">=" is basic, corresp. row of invB is flipped; whole row of the optimal tableau is flipped; then whole column for the slack in opt tableau is flipped. Ranged rows are not supported. It might work, but no garantee is given. */ //@{ /** Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none */ virtual int canDoSimplexInterface() const; using OsiSolverInterface::enableSimplexInterface; /** Useless function, defined only for compatibility with OsiSimplexInterface */ virtual void enableSimplexInterface(int doingPrimal) { } ; /** Useless function, defined only for compatibility with OsiSimplexInterface */ virtual void disableSimplexInterface() { } ; /** Useless function, defined only for compatibility with OsiSimplexInterface */ virtual void enableFactorization() const { } ; /** Useless function, defined only for compatibility with OsiSimplexInterface */ virtual void disableFactorization() const { } ; ///Returns true if a basis is available virtual bool basisIsAvailable() const; /** Returns a basis status of the structural/artificial variables At present as warm start i.e 0: free, 1: basic, 2: upper, 3: lower */ virtual void getBasisStatus(int* cstat, int* rstat) const; // ///Get a row of the tableau (slack part in slack if not NULL) // virtual void getBInvARow(int row, double* z, double * slack=NULL) const; // // ///Get a row of the basis inverse // virtual void getBInvRow(int row, double* z) const; // // ///Get a column of the tableau // virtual void getBInvACol(int col, double* vec) const; // // ///Get a column of the basis inverse // virtual void getBInvCol(int col, double* vec) const; // // /** Get indices of the pivot variable in each row // (order of indices corresponds to the // order of elements in a vector retured by getBInvACol() and // getBInvCol()). // */ // virtual void getBasics(int* index) const; /// switches Gurobi to prob type LP void switchToLP(); /// switches Gurobi to prob type MIP void switchToMIP(); //@} /***************************************************************************/ /***************************************************************************/ /** Apply a collection of cuts. Only cuts which have an effectiveness >= effectivenessLb are applied.
  • ReturnCode.getNumineffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
  • ReturnCode.getNuminconsistent() -- number of invalid cuts
  • ReturnCode.getNuminconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
  • ReturnCode.getNuminfeasible() -- number of cuts that would make this integer model infeasible
  • ReturnCode.getNumApplied() -- number of integer cuts which were applied to the integer model
  • cs.size() == getNumineffective() + getNuminconsistent() + getNuminconsistentWrtIntegerModel() + getNuminfeasible() + getNumApplied()
*/ virtual OsiSolverInterface::ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); protected: /**@name Protected methods */ //@{ /// Apply a row cut. Return true if cut was applied. virtual void applyRowCut(const OsiRowCut & rc); /** Apply a column cut (bound adjustment). Return true if cut was applied. */ virtual void applyColCut(const OsiColCut & cc); //@} private: /**@name Private static class functions */ //@{ /// resizes coltype_, colmap_O2G, colmap_G2O vectors to be able to store at least minsize elements void resizeColSpace(int minsize); /// frees colsize_ vector void freeColSpace(); /// resizes colmap_G2O vector to be able to store at least minsize (auxiliary) elements void resizeAuxColSpace(int minsize); /// resizes auxcolind vector to current number of rows and inits values to -1 void resizeAuxColIndSpace(); //@} /**@name Private static class data */ //@{ /// Gurobi environment pointer static GRBenv* globalenv_; /// whether OsiGrb has created the global environment (and thus should free it) static bool globalenv_is_ours; /// Number of instances using the global Gurobi environment static unsigned int numInstances_; //@} /**@name Private methods */ //@{ /// Get LP Pointer for const methods GRBmodel* getMutableLpPtr() const; /// The real work of a copy constructor (used by copy and assignment) void gutsOfCopy(const OsiGrbSolverInterface & source); /// The real work of the constructor void gutsOfConstructor(); /// The real work of the destructor void gutsOfDestructor(); /// free cached column rim vectors void freeCachedColRim(); /// free cached row rim vectors void freeCachedRowRim(); /// free cached result vectors void freeCachedResults(); /// free cached matrices void freeCachedMatrix(); /// free all cached data (except specified entries, see getLpPtr()) void freeCachedData(int keepCached = KEEPCACHED_NONE); /// free all allocated memory void freeAllMemory(); /// converts a normal row into a ranged row by adding an auxiliary variable void convertToRangedRow(int rowidx, double rhs, double range); /// converts a ranged row into a normal row by removing its auxiliary variable void convertToNormalRow(int rowidx, char sense, double rhs); //@} /**@name Private member data */ //@{ /// Gurobi environment used only by this class instance mutable GRBenv* localenv_; /// Gurobi model represented by this class instance mutable GRBmodel* lp_; /// Hotstart information int *hotStartCStat_; int hotStartCStatSize_; int *hotStartRStat_; int hotStartRStatSize_; int hotStartMaxIteration_; /// OSI name discipline int nameDisc_; /**@name Cached information derived from the Gurobi model */ //@{ /// Pointer to objective vector mutable double *obj_; /// Pointer to dense vector of variable lower bounds mutable double *collower_; /// Pointer to dense vector of variable lower bounds mutable double *colupper_; /// Pointer to dense vector of row sense indicators mutable char *rowsense_; /// Pointer to dense vector of row right-hand side values mutable double *rhs_; /// Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) mutable double *rowrange_; /// Pointer to dense vector of row lower bounds mutable double *rowlower_; /// Pointer to dense vector of row upper bounds mutable double *rowupper_; /// Pointer to primal solution vector mutable double *colsol_; /// Pointer to dual solution vector mutable double *rowsol_; /// Pointer to reduced cost vector mutable double *redcost_; /// Pointer to row activity (slack) vector mutable double *rowact_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByRow_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByCol_; //@} /**@name Additional information needed for storing MIP problems and handling ranged rows */ //@{ /// Stores whether we currently see the problem as a MIP mutable bool probtypemip_; /// Whether to pass a column solution to CPLEX before starting MIP solve (copymipstart) bool domipstart; /// Size of allocated memory for coltype_, colmap_O2G, and (with offset auxcolspace) colmap_G2O. int colspace_; /// Pointer to dense vector of variable types (continous, binary, integer) char *coltype_; /// Number of auxiliary columns in Gurobi model for handling of ranged rows int nauxcols; /// Size of allocated memory for colmap_G2O that exceeds colspace_ int auxcolspace; /// Maps variable indices from Osi to Gurobi /// Is NULL if there are no ranged rows! (assume identity mapping then) int* colmap_O2G; /// Maps variable indices from Gurobi to Osi /// A negative value indicates that a variable is an auxiliary variable that was added to handle a ranged row /// -colmap_G2O[i]-1 gives the index of the ranged row in this case /// Is NULL if there are no ranged rows! (assume identity mapping then) int* colmap_G2O; /// Current length of auxcolind array. int auxcolindspace; /// Gives for each row the index of the corresponding auxiliary variable, if it is a ranged row. /// Otherwise, gives -1. /// Is NULL if there are no ranged rows! (assume -1 for each row then) int* auxcolind; //@} }; //############################################################################# /** A function that tests the methods in the OsiGrbSolverInterface class. */ void OsiGrbSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Osi/src/OsiGrb/OsiGrbSolverInterface.cpp0000644000175000017500000035770112266233230020743 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for Gurobi // template: OSI Cplex Interface written by T. Achterberg // author: Stefan Vigerske // Humboldt University Berlin // license: this file may be freely distributed under the terms of EPL // comments: please scan this file for '???' and 'TODO' and read the comments //----------------------------------------------------------------------------- // Copyright (C) 2009 Humboldt University Berlin and others. // All Rights Reserved. // $Id: OsiGrbSolverInterface.cpp 1957 2014-01-17 13:56:40Z stefan $ #include #include #include #include #include "CoinPragma.hpp" #include "CoinError.hpp" #include "OsiConfig.h" #include "OsiGrbSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" extern "C" { #include "gurobi_c.h" } /* A utility definition which allows for easy suppression of unused variable warnings from GCC. */ #ifndef UNUSED # if defined(__GNUC__) # define UNUSED __attribute__((unused)) # else # define UNUSED # endif #endif //#define DEBUG 1 #ifdef DEBUG #define debugMessage printf("line %4d: ", __LINE__) & printf #else #define debugMessage if( false ) printf #endif #define GUROBI_CALL(m, x) do \ { \ int _retcode; \ if( (_retcode = (x)) != 0 ) \ { \ char s[1001]; \ if (OsiGrbSolverInterface::globalenv_) \ { \ sprintf( s, "Error <%d> from GUROBI function call: ", _retcode ); \ strncat(s, GRBgeterrormsg(OsiGrbSolverInterface::globalenv_), 1000); \ } \ else \ sprintf( s, "Error <%d> from GUROBI function call (no license?).", _retcode ); \ debugMessage("%s:%d: %s", __FILE__, __LINE__, s); \ throw CoinError( s, m, "OsiGrbSolverInterface", __FILE__, __LINE__ ); \ } \ } \ while( false ) template struct CompileTimeAssert; template<> struct CompileTimeAssert {}; #if GRB_VERSION_MAJOR < 4 #define GRB_METHOD_DUAL GRB_LPMETHOD_DUAL #define GRB_METHOD_PRIMAL GRB_LPMETHOD_PRIMAL #define GRB_INT_PAR_METHOD GRB_INT_PAR_LPMETHOD #endif //############################################################################# // A couple of helper functions //############################################################################# inline void freeCacheDouble( double*& ptr ) { if( ptr != NULL ) { delete [] ptr; ptr = NULL; } } inline void freeCacheChar( char*& ptr ) { if( ptr != NULL ) { delete [] ptr; ptr = NULL; } } inline void freeCacheMatrix( CoinPackedMatrix*& ptr ) { if( ptr != NULL ) { delete ptr; ptr = NULL; } } void OsiGrbSolverInterface::switchToLP( void ) { debugMessage("OsiGrbSolverInterface::switchToLP()\n"); if( probtypemip_ ) { GRBmodel* lp = getMutableLpPtr(); int nc = getNumCols(); char* contattr = new char[nc]; CoinFillN(contattr, nc, 'C'); GUROBI_CALL( "switchToLP", GRBsetcharattrarray(lp, GRB_CHAR_ATTR_VTYPE, 0, nc, contattr) ); delete[] contattr; probtypemip_ = false; } } void OsiGrbSolverInterface::switchToMIP( void ) { debugMessage("OsiGrbSolverInterface::switchToMIP()\n"); if( !probtypemip_ ) { GRBmodel* lp = getMutableLpPtr(); int nc = getNumCols(); assert(coltype_ != NULL); GUROBI_CALL( "switchToMIP", GRBsetcharattrarray(lp, GRB_CHAR_ATTR_VTYPE, 0, nc, coltype_) ); probtypemip_ = true; } } void OsiGrbSolverInterface::resizeColSpace( int minsize ) { debugMessage("OsiGrbSolverInterface::resizeColSpace()\n"); if( minsize > colspace_ ) { int newcolspace = 2*colspace_; if( minsize > newcolspace ) newcolspace = minsize; char* newcoltype = new char[newcolspace]; if( coltype_ != NULL ) { CoinDisjointCopyN( coltype_, colspace_, newcoltype ); delete[] coltype_; } coltype_ = newcoltype; if( colmap_O2G != NULL ) { int* newcolmap_O2G = new int[newcolspace]; CoinDisjointCopyN( colmap_O2G, colspace_, newcolmap_O2G ); delete[] colmap_O2G; colmap_O2G = newcolmap_O2G; } if( colmap_G2O != NULL ) { int* newcolmap_G2O = new int[newcolspace + auxcolspace]; CoinDisjointCopyN( colmap_G2O, colspace_ + auxcolspace, newcolmap_G2O ); delete[] colmap_G2O; colmap_G2O = newcolmap_G2O; } colspace_ = newcolspace; } assert(minsize == 0 || coltype_ != NULL); assert(colspace_ >= minsize); } void OsiGrbSolverInterface::freeColSpace() { debugMessage("OsiGrbSolverInterface::freeColSpace()\n"); if( colspace_ > 0 ) { delete[] coltype_; delete[] colmap_O2G; delete[] colmap_G2O; coltype_ = NULL; colmap_O2G = NULL; colmap_G2O = NULL; colspace_ = 0; auxcolspace = 0; } assert(coltype_ == NULL); assert(colmap_O2G == NULL); assert(colmap_G2O == NULL); } void OsiGrbSolverInterface::resizeAuxColSpace(int minsize) { debugMessage("OsiGrbSolverInterface::resizeAuxColSpace()\n"); if( minsize > auxcolspace ) { int newauxcolspace = 2*auxcolspace; if( minsize > newauxcolspace ) newauxcolspace = minsize; if( colmap_G2O != NULL ) { int* newcolmap_G2O = new int[colspace_ + newauxcolspace]; CoinDisjointCopyN( colmap_G2O, colspace_ + auxcolspace, newcolmap_G2O ); delete[] colmap_G2O; colmap_G2O = newcolmap_G2O; } auxcolspace = newauxcolspace; } } /// resizes auxcolind vector to current number of rows and inits values to -1 void OsiGrbSolverInterface::resizeAuxColIndSpace() { debugMessage("OsiGrbSolverInterface::resizeAuxColIndSpace()\n"); int numrows = getNumRows(); if( auxcolindspace < numrows ) { int newspace = 2*auxcolindspace; if( numrows > newspace ) newspace = numrows; int* newauxcolind = new int[newspace]; if( auxcolindspace > 0 ) CoinDisjointCopyN( auxcolind, auxcolindspace, newauxcolind ); for( int i = auxcolindspace; i < newspace; ++i ) newauxcolind[i] = -1; delete[] auxcolind; auxcolind = newauxcolind; auxcolindspace = newspace; } } //############################################################################# // Solve methods //############################################################################# void OsiGrbSolverInterface::initialSolve() { debugMessage("OsiGrbSolverInterface::initialSolve()\n"); bool takeHint; OsiHintStrength strength; int prevalgorithm = -1; switchToLP(); GRBmodel* lp = getLpPtr( OsiGrbSolverInterface::FREECACHED_RESULTS ); /* set whether dual or primal, if hint has been given */ getHintParam(OsiDoDualInInitial,takeHint,strength); if (strength != OsiHintIgnore) { GUROBI_CALL( "initialSolve", GRBgetintparam(GRBgetenv(lp), GRB_INT_PAR_METHOD, &prevalgorithm) ); GUROBI_CALL( "initialSolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_METHOD, takeHint ? GRB_METHOD_DUAL : GRB_METHOD_PRIMAL) ); } /* set whether presolve or not */ int presolve = GRB_PRESOLVE_AUTO; getHintParam(OsiDoPresolveInInitial,takeHint,strength); if (strength != OsiHintIgnore) presolve = takeHint ? GRB_PRESOLVE_AUTO : GRB_PRESOLVE_OFF; GUROBI_CALL( "initialSolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_PRESOLVE, presolve) ); /* set whether output or not */ GUROBI_CALL( "initialSolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_OUTPUTFLAG, (messageHandler()->logLevel() > 0)) ); /* optimize */ GUROBI_CALL( "initialSolve", GRBoptimize(lp) ); /* reoptimize without presolve if status unclear */ int stat; GUROBI_CALL( "initialSolve", GRBgetintattr(lp, GRB_INT_ATTR_STATUS, &stat) ); if (stat == GRB_INF_OR_UNBD && presolve != GRB_PRESOLVE_OFF) { GUROBI_CALL( "initialSolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_OFF) ); GUROBI_CALL( "initialSolve", GRBoptimize(lp) ); GUROBI_CALL( "initialSolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_PRESOLVE, presolve) ); } /* reset method parameter, if changed */ if( prevalgorithm != -1 ) GUROBI_CALL( "initialSolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_METHOD, prevalgorithm) ); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::resolve() { debugMessage("OsiGrbSolverInterface::resolve()\n"); bool takeHint; OsiHintStrength strength; int prevalgorithm = -1; switchToLP(); GRBmodel* lp = getLpPtr( OsiGrbSolverInterface::FREECACHED_RESULTS ); /* set whether primal or dual */ getHintParam(OsiDoDualInResolve,takeHint,strength); if (strength != OsiHintIgnore) { GUROBI_CALL( "resolve", GRBgetintparam(GRBgetenv(lp), GRB_INT_PAR_METHOD, &prevalgorithm) ); GUROBI_CALL( "resolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_METHOD, takeHint ? GRB_METHOD_DUAL : GRB_METHOD_PRIMAL) ); } /* set whether presolve or not */ int presolve = GRB_PRESOLVE_OFF; getHintParam(OsiDoPresolveInResolve,takeHint,strength); if (strength != OsiHintIgnore) presolve = takeHint ? GRB_PRESOLVE_AUTO : GRB_PRESOLVE_OFF; GUROBI_CALL( "resolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_PRESOLVE, presolve) ); /* set whether output or not */ GUROBI_CALL( "resolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_OUTPUTFLAG, (messageHandler()->logLevel() > 0)) ); /* optimize */ GUROBI_CALL( "resolve", GRBoptimize(lp) ); /* reoptimize if status unclear */ int stat; GUROBI_CALL( "resolve", GRBgetintattr(lp, GRB_INT_ATTR_STATUS, &stat) ); if (stat == GRB_INF_OR_UNBD && presolve != GRB_PRESOLVE_OFF) { GUROBI_CALL( "resolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_PRESOLVE, GRB_PRESOLVE_OFF) ); GUROBI_CALL( "resolve", GRBoptimize(lp) ); GUROBI_CALL( "resolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_PRESOLVE, presolve) ); } /* reset method parameter, if changed */ if( prevalgorithm != -1 ) GUROBI_CALL( "initialSolve", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_METHOD, prevalgorithm) ); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::branchAndBound() { debugMessage("OsiGrbSolverInterface::branchAndBound()\n"); switchToMIP(); if( colsol_ != NULL && domipstart ) { int* discridx = new int[getNumIntegers()]; double* discrval = new double[getNumIntegers()]; int j = 0; for( int i = 0; i < getNumCols() && j < getNumIntegers(); ++i ) { if( !isInteger(i) && !isBinary(i) ) continue; discridx[j] = i; discrval[j] = colsol_[i]; ++j; } assert(j == getNumIntegers()); GUROBI_CALL( "branchAndBound", GRBsetdblattrlist(getMutableLpPtr(), GRB_DBL_ATTR_START, getNumIntegers(), discridx, discrval) ); delete[] discridx; delete[] discrval; } GRBmodel* lp = getLpPtr( OsiGrbSolverInterface::FREECACHED_RESULTS ); GUROBI_CALL( "branchAndBound", GRBsetintparam(GRBgetenv(lp), GRB_INT_PAR_OUTPUTFLAG, (messageHandler()->logLevel() > 0)) ); GUROBI_CALL( "branchAndBound", GRBoptimize( lp ) ); } //############################################################################# // Parameter related methods //############################################################################# bool OsiGrbSolverInterface::setIntParam(OsiIntParam key, int value) { debugMessage("OsiGrbSolverInterface::setIntParam(%d, %d)\n", key, value); switch (key) { case OsiMaxNumIteration: if( GRBsetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_ITERATIONLIMIT, (double)value) != 0 ) { *messageHandler() << "Warning: Setting GUROBI iteration limit to" << value << "failed." << CoinMessageEol; if (OsiGrbSolverInterface::globalenv_) *messageHandler() << "\t GUROBI error message: " << GRBgeterrormsg(OsiGrbSolverInterface::globalenv_) << CoinMessageEol; return false; } return true; case OsiMaxNumIterationHotStart: if( value >= 0 ) { hotStartMaxIteration_ = value; return true; } return false; case OsiNameDiscipline: if( value < 0 || value > 3 ) return false; nameDisc_ = value; return true; case OsiLastIntParam: default: return false; } } //----------------------------------------------------------------------------- bool OsiGrbSolverInterface::setDblParam(OsiDblParam key, double value) { debugMessage("OsiGrbSolverInterface::setDblParam(%d, %g)\n", key, value); switch (key) { // Gurobi does not have primal or dual objective limits // case OsiDualObjectiveLimit: // break; // case OsiPrimalObjectiveLimit: // break; case OsiDualTolerance: if( GRBsetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_OPTIMALITYTOL, value) != 0 ) { *messageHandler() << "Warning: Setting GUROBI dual (i.e., optimality) tolerance to" << value << "failed." << CoinMessageEol; if (OsiGrbSolverInterface::globalenv_) *messageHandler() << "\t GUROBI error message: " << GRBgeterrormsg(OsiGrbSolverInterface::globalenv_) << CoinMessageEol; return false; } return true; case OsiPrimalTolerance: if( GRBsetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_FEASIBILITYTOL, value) != 0 ) { *messageHandler() << "Warning: Setting GUROBI primal (i.e., feasiblity) tolerance to" << value << "failed." << CoinMessageEol; if (OsiGrbSolverInterface::globalenv_) *messageHandler() << "\t GUROBI error message: " << GRBgeterrormsg(OsiGrbSolverInterface::globalenv_) << CoinMessageEol; return false; } return true; case OsiObjOffset: return OsiSolverInterface::setDblParam(key,value); case OsiLastDblParam: default: return false; } } //----------------------------------------------------------------------------- bool OsiGrbSolverInterface::setStrParam(OsiStrParam key, const std::string & value) { debugMessage("OsiGrbSolverInterface::setStrParam(%d, %s)\n", key, value.c_str()); switch (key) { case OsiProbName: GUROBI_CALL( "setStrParam", GRBsetstrattr(getLpPtr(), GRB_STR_ATTR_MODELNAME, const_cast(value.c_str())) ); return true; case OsiSolverName: case OsiLastStrParam: default: return false; } } // Set a hint parameter bool OsiGrbSolverInterface::setHintParam(OsiHintParam key, bool yesNo, OsiHintStrength strength, void* otherInfo) { debugMessage("OsiGrbSolverInterface::setHintParam(%d, %d)\n", key, yesNo); if( key == OsiDoScale ) { GUROBI_CALL( "setHintParam", GRBsetintparam(GRBgetenv(getMutableLpPtr()), GRB_INT_PAR_SCALEFLAG, yesNo) ); OsiSolverInterface::setHintParam(key, yesNo, strength, otherInfo); return true; } return OsiSolverInterface::setHintParam(key, yesNo, strength, otherInfo); } //----------------------------------------------------------------------------- bool OsiGrbSolverInterface::getIntParam(OsiIntParam key, int& value) const { debugMessage("OsiGrbSolverInterface::getIntParam(%d)\n", key); switch (key) { case OsiMaxNumIteration: double dblval; GUROBI_CALL( "getIntParam", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getIntParam", GRBgetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_ITERATIONLIMIT, &dblval) ); value = (int) dblval; return true; case OsiMaxNumIterationHotStart: value = hotStartMaxIteration_; return true; case OsiNameDiscipline: value = nameDisc_; return true; case OsiLastIntParam: default: return false; } } //----------------------------------------------------------------------------- bool OsiGrbSolverInterface::getDblParam(OsiDblParam key, double& value) const { debugMessage("OsiGrbSolverInterface::getDblParam(%d)\n", key); GUROBI_CALL( "getDblParam", GRBupdatemodel(getMutableLpPtr()) ); switch (key) { // Gurobi does not have primal or dual objective limits // case OsiDualObjectiveLimit: // break; // case OsiPrimalObjectiveLimit: // break; case OsiDualTolerance: GUROBI_CALL( "getDblParam", GRBgetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_OPTIMALITYTOL, &value) ); return true; case OsiPrimalTolerance: GUROBI_CALL( "getDblParam", GRBgetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_FEASIBILITYTOL, &value) ); return true; case OsiObjOffset: return OsiSolverInterface::getDblParam(key, value); case OsiLastDblParam: default: return false; } } //----------------------------------------------------------------------------- bool OsiGrbSolverInterface::getStrParam(OsiStrParam key, std::string & value) const { debugMessage("OsiGrbSolverInterface::getStrParam(%d)\n", key); switch (key) { case OsiProbName: { char* name = NULL; GUROBI_CALL( "getStrParam", GRBgetstrattr(getMutableLpPtr(), GRB_STR_ATTR_MODELNAME, &name) ); assert(name != NULL); value = name; return true; } case OsiSolverName: value = "gurobi"; return true; case OsiLastStrParam: default: return false; } } // Get a hint parameter bool OsiGrbSolverInterface::getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength, void*& otherInformation) const { debugMessage("OsiGrbSolverInterface::getHintParam[1](%d)\n", key); if( key == OsiDoScale ) { OsiSolverInterface::getHintParam(key, yesNo, strength, otherInformation); GUROBI_CALL( "getHintParam", GRBupdatemodel(getMutableLpPtr()) ); int value; GUROBI_CALL( "getHintParam", GRBgetintparam(GRBgetenv(getMutableLpPtr()), GRB_INT_PAR_SCALEFLAG, &value) ); yesNo = value; return true; } return OsiSolverInterface::getHintParam(key, yesNo, strength, otherInformation); } // Get a hint parameter bool OsiGrbSolverInterface::getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength) const { debugMessage("OsiGrbSolverInterface::getHintParam[2](%d)\n", key); if( key == OsiDoScale ) { OsiSolverInterface::getHintParam(key, yesNo, strength); GUROBI_CALL( "getHintParam", GRBupdatemodel(getMutableLpPtr()) ); int value; GUROBI_CALL( "getHintParam", GRBgetintparam(GRBgetenv(getMutableLpPtr()), GRB_INT_PAR_SCALEFLAG, &value) ); yesNo = value; return true; } return OsiSolverInterface::getHintParam(key, yesNo, strength); } // Get a hint parameter bool OsiGrbSolverInterface::getHintParam(OsiHintParam key, bool& yesNo) const { debugMessage("OsiGrbSolverInterface::getHintParam[3](%d)\n", key); if( key == OsiDoScale ) { OsiSolverInterface::getHintParam(key, yesNo); GUROBI_CALL( "getHintParam", GRBupdatemodel(getMutableLpPtr()) ); int value; GUROBI_CALL( "getHintParam", GRBgetintparam(GRBgetenv(getMutableLpPtr()), GRB_INT_PAR_SCALEFLAG, &value) ); yesNo = value; return true; } return OsiSolverInterface::getHintParam(key, yesNo); } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# bool OsiGrbSolverInterface::isAbandoned() const { debugMessage("OsiGrbSolverInterface::isAbandoned()\n"); GUROBI_CALL( "isAbandoned", GRBupdatemodel(getMutableLpPtr()) ); int stat; GUROBI_CALL( "isAbandoned", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_STATUS, &stat) ); return ( stat == GRB_LOADED || stat == GRB_NUMERIC || stat == GRB_INTERRUPTED ); } bool OsiGrbSolverInterface::isProvenOptimal() const { debugMessage("OsiGrbSolverInterface::isProvenOptimal()\n"); GUROBI_CALL( "isProvenOptimal", GRBupdatemodel(getMutableLpPtr()) ); int stat; GUROBI_CALL( "isProvenOptimal", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_STATUS, &stat) ); return (stat == GRB_OPTIMAL); } bool OsiGrbSolverInterface::isProvenPrimalInfeasible() const { debugMessage("OsiGrbSolverInterface::isProvenPrimalInfeasible()\n"); GUROBI_CALL( "isProvenPrimalInfeasible", GRBupdatemodel(getMutableLpPtr()) ); int stat; GUROBI_CALL( "isProvenPrimalInfeasible", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_STATUS, &stat) ); return (stat == GRB_INFEASIBLE); } bool OsiGrbSolverInterface::isProvenDualInfeasible() const { debugMessage("OsiGrbSolverInterface::isProvenDualInfeasible()\n"); GUROBI_CALL( "isProvenDualInfeasible", GRBupdatemodel(getMutableLpPtr()) ); int stat; GUROBI_CALL( "isProvenDualInfeasible", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_STATUS, &stat) ); return (stat == GRB_UNBOUNDED); } bool OsiGrbSolverInterface::isPrimalObjectiveLimitReached() const { debugMessage("OsiGrbSolverInterface::isPrimalObjectiveLimitReached()\n"); return false; } bool OsiGrbSolverInterface::isDualObjectiveLimitReached() const { debugMessage("OsiGrbSolverInterface::isDualObjectiveLimitReached()\n"); return false; } bool OsiGrbSolverInterface::isIterationLimitReached() const { debugMessage("OsiGrbSolverInterface::isIterationLimitReached()\n"); GUROBI_CALL( "isIterationLimitReached", GRBupdatemodel(getMutableLpPtr()) ); int stat; GUROBI_CALL( "isIterationLimitReached", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_STATUS, &stat) ); return (stat == GRB_ITERATION_LIMIT); } //############################################################################# // WarmStart related methods //############################################################################# CoinWarmStart* OsiGrbSolverInterface::getEmptyWarmStart () const { return (dynamic_cast(new CoinWarmStartBasis())) ; } // below we assume that getBasisStatus uses the same values as the warm start enum, i.e. 0: free, 1: basic, 2: upper, 3: lower static CompileTimeAssert UNUSED change_In_Enum_CoinWarmStartBasis_Status_free_breaks_this_function; static CompileTimeAssert UNUSED change_In_Enum_CoinWarmStartBasis_Status_basic_breaks_this_function; static CompileTimeAssert UNUSED change_In_Enum_CoinWarmStartBasis_Status_upper_breaks_this_function; static CompileTimeAssert UNUSED change_In_Enum_CoinWarmStartBasis_Status_lower_breaks_this_function; CoinWarmStart* OsiGrbSolverInterface::getWarmStart() const { debugMessage("OsiGrbSolverInterface::getWarmStart()\n"); assert(!probtypemip_); if( !basisIsAvailable() ) return NULL; CoinWarmStartBasis* ws = NULL; int numcols = getNumCols(); int numrows = getNumRows(); int *cstat = new int[numcols]; int *rstat = new int[numrows]; int i; #if 1 getBasisStatus(cstat, rstat); ws = new CoinWarmStartBasis; ws->setSize( numcols, numrows ); for( i = 0; i < numrows; ++i ) ws->setArtifStatus( i, CoinWarmStartBasis::Status(rstat[i]) ); for( i = 0; i < numcols; ++i ) ws->setStructStatus( i, CoinWarmStartBasis::Status(cstat[i]) ); #else GUROBI_CALL( "getWarmStart", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getWarmStart", GRBgetintattrarray(getMutableLpPtr(), GRB_INT_ATTR_VBASIS, 0, numcols, cstat) ); GUROBI_CALL( "getWarmStart", GRBgetintattrarray(getMutableLpPtr(), GRB_INT_ATTR_CBASIS, 0, numrows, rstat) ); ws = new CoinWarmStartBasis; ws->setSize( numcols, numrows ); char sense; for( i = 0; i < numrows; ++i ) { switch( rstat[i] ) { case GRB_BASIC: ws->setArtifStatus( i, CoinWarmStartBasis::basic ); break; case GRB_NONBASIC_LOWER: case GRB_NONBASIC_UPPER: GUROBI_CALL( "getWarmStart", GRBgetcharattrelement(getMutableLpPtr(), GRB_CHAR_ATTR_SENSE, i, &sense) ); ws->setArtifStatus( i, (sense == '>' ? CoinWarmStartBasis::atUpperBound : CoinWarmStartBasis::atLowerBound) ); break; default: // unknown row status delete ws; delete[] rstat; delete[] cstat; return NULL; } } for( i = 0; i < numcols; ++i ) { switch( cstat[i] ) { case GRB_BASIC: ws->setStructStatus( i, CoinWarmStartBasis::basic ); break; case GRB_NONBASIC_LOWER: ws->setStructStatus( i, CoinWarmStartBasis::atLowerBound ); break; case GRB_NONBASIC_UPPER: ws->setStructStatus( i, CoinWarmStartBasis::atUpperBound ); break; case GRB_SUPERBASIC: ws->setStructStatus( i, CoinWarmStartBasis::isFree ); break; default: // unknown column status delete[] rstat; delete[] cstat; delete ws; return NULL; } } #endif delete[] cstat; delete[] rstat; return ws; } //----------------------------------------------------------------------------- bool OsiGrbSolverInterface::setWarmStart(const CoinWarmStart* warmstart) { debugMessage("OsiGrbSolverInterface::setWarmStart(%p)\n", (void*)warmstart); const CoinWarmStartBasis* ws = dynamic_cast(warmstart); int numcols, numrows, i, oi; int *stat; if( !ws ) return false; numcols = ws->getNumStructural(); numrows = ws->getNumArtificial(); if( numcols != getNumCols() || numrows != getNumRows() ) return false; switchToLP(); stat = new int[numcols + nauxcols > numrows ? numcols + nauxcols : numrows]; for( i = 0; i < numrows; ++i ) { switch( ws->getArtifStatus( i ) ) { case CoinWarmStartBasis::basic: stat[i] = GRB_BASIC; break; case CoinWarmStartBasis::atLowerBound: case CoinWarmStartBasis::atUpperBound: stat[i] = GRB_NONBASIC_LOWER; break; case CoinWarmStartBasis::isFree: stat[i] = GRB_SUPERBASIC; break; default: // unknown row status delete[] stat; return false; } } GUROBI_CALL( "setWarmStart", GRBsetintattrarray(getLpPtr(OsiGrbSolverInterface::FREECACHED_RESULTS), GRB_INT_ATTR_CBASIS, 0, numrows, stat) ); for( i = 0; i < numcols + nauxcols; ++i ) { oi = colmap_G2O ? colmap_G2O[i] : i; if( oi >= 0 ) { /* normal variable */ switch( ws->getStructStatus( oi ) ) { case CoinWarmStartBasis::basic: stat[i] = GRB_BASIC; break; case CoinWarmStartBasis::atLowerBound: stat[i] = GRB_NONBASIC_LOWER; break; case CoinWarmStartBasis::atUpperBound: stat[i] = GRB_NONBASIC_UPPER; break; case CoinWarmStartBasis::isFree: stat[i] = GRB_SUPERBASIC; break; default: // unknown col status delete[] stat; return false; } } else { /* auxiliary variable, derive status from status of corresponding ranged row */ switch( ws->getArtifStatus( -oi-1 ) ) { case CoinWarmStartBasis::basic: stat[i] = GRB_BASIC; break; case CoinWarmStartBasis::atLowerBound: stat[i] = GRB_NONBASIC_LOWER; break; case CoinWarmStartBasis::atUpperBound: stat[i] = GRB_NONBASIC_UPPER; break; case CoinWarmStartBasis::isFree: stat[i] = GRB_SUPERBASIC; break; default: // unknown col status delete[] stat; return false; } } } GUROBI_CALL( "setWarmStart", GRBsetintattrarray(getLpPtr(OsiGrbSolverInterface::FREECACHED_RESULTS), GRB_INT_ATTR_VBASIS, 0, numcols+nauxcols, stat) ); delete[] stat; return true; } //############################################################################# // Hotstart related methods (primarily used in strong branching) //############################################################################# void OsiGrbSolverInterface::markHotStart() { debugMessage("OsiGrbSolverInterface::markHotStart()\n"); int numcols, numrows; assert(!probtypemip_); numcols = getNumCols() + nauxcols; numrows = getNumRows(); if( numcols > hotStartCStatSize_ ) { delete[] hotStartCStat_; hotStartCStatSize_ = static_cast( 1.2 * static_cast( numcols + nauxcols ) ); // get some extra space for future hot starts hotStartCStat_ = new int[hotStartCStatSize_]; } if( numrows > hotStartRStatSize_ ) { delete[] hotStartRStat_; hotStartRStatSize_ = static_cast( 1.2 * static_cast( numrows ) ); // get some extra space for future hot starts hotStartRStat_ = new int[hotStartRStatSize_]; } GUROBI_CALL( "markHotStart", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "markHotStart", GRBgetintattrarray(getMutableLpPtr(), GRB_INT_ATTR_VBASIS, 0, numcols + nauxcols, hotStartCStat_) ); GUROBI_CALL( "markHotStart", GRBgetintattrarray(getMutableLpPtr(), GRB_INT_ATTR_CBASIS, 0, numrows, hotStartRStat_) ); } void OsiGrbSolverInterface::solveFromHotStart() { debugMessage("OsiGrbSolverInterface::solveFromHotStart()\n"); double maxiter; switchToLP(); assert( getNumCols() <= hotStartCStatSize_ ); assert( getNumRows() <= hotStartRStatSize_ ); GUROBI_CALL( "solveFromHotStart", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "solveFromHotStart", GRBsetintattrarray(getLpPtr(OsiGrbSolverInterface::FREECACHED_RESULTS), GRB_INT_ATTR_CBASIS, 0, getNumRows(), hotStartRStat_ ) ); GUROBI_CALL( "solveFromHotStart", GRBsetintattrarray(getLpPtr(OsiGrbSolverInterface::FREECACHED_RESULTS), GRB_INT_ATTR_VBASIS, 0, getNumCols() + nauxcols, hotStartCStat_ ) ); GUROBI_CALL( "solveFromHotStart", GRBgetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_ITERATIONLIMIT, &maxiter) ); GUROBI_CALL( "solveFromHotStart", GRBsetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_ITERATIONLIMIT, (double)hotStartMaxIteration_) ); resolve(); GUROBI_CALL( "solveFromHotStart", GRBsetdblparam(GRBgetenv(getMutableLpPtr()), GRB_DBL_PAR_ITERATIONLIMIT, maxiter) ); } void OsiGrbSolverInterface::unmarkHotStart() { debugMessage("OsiGrbSolverInterface::unmarkHotStart()\n"); // ??? be lazy with deallocating memory and do nothing here, deallocate memory in the destructor } //############################################################################# // Problem information methods (original data) //############################################################################# //------------------------------------------------------------------ // Get number of rows, columns, elements, ... //------------------------------------------------------------------ int OsiGrbSolverInterface::getNumCols() const { debugMessage("OsiGrbSolverInterface::getNumCols()\n"); int numcols; GUROBI_CALL( "getNumCols", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getNumCols", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_NUMVARS, &numcols) ); numcols -= nauxcols; return numcols; } int OsiGrbSolverInterface::getNumRows() const { debugMessage("OsiGrbSolverInterface::getNumRows()\n"); int numrows; GUROBI_CALL( "getNumRows", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getNumRows", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_NUMCONSTRS, &numrows) ); return numrows; } int OsiGrbSolverInterface::getNumElements() const { debugMessage("OsiGrbSolverInterface::getNumElements()\n"); int numnz; GUROBI_CALL( "getNumElements", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getNumElements", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_NUMNZS, &numnz) ); /* each auxiliary column contributes one nonzero element to exactly one row */ numnz -= nauxcols; return numnz; } //------------------------------------------------------------------ // Get pointer to rim vectors //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getColLower() const { debugMessage("OsiGrbSolverInterface::getColLower()\n"); if( collower_ == NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { collower_ = new double[ncols]; GUROBI_CALL( "getColLower", GRBupdatemodel(getMutableLpPtr()) ); if( nauxcols ) GUROBI_CALL( "getColLower", GRBgetdblattrlist(getMutableLpPtr(), GRB_DBL_ATTR_LB, ncols, colmap_O2G, collower_) ); else GUROBI_CALL( "getColLower", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_LB, 0, ncols, collower_) ); } } return collower_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getColUpper() const { debugMessage("OsiGrbSolverInterface::getColUpper()\n"); if( colupper_ == NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { colupper_ = new double[ncols]; GUROBI_CALL( "getColUpper", GRBupdatemodel(getMutableLpPtr()) ); if( nauxcols ) GUROBI_CALL( "getColUpper", GRBgetdblattrlist(getMutableLpPtr(), GRB_DBL_ATTR_UB, ncols, colmap_O2G, colupper_) ); else GUROBI_CALL( "getColUpper", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_UB, 0, ncols, colupper_) ); } } return colupper_; } //------------------------------------------------------------------ const char * OsiGrbSolverInterface::getRowSense() const { debugMessage("OsiGrbSolverInterface::getRowSense()\n"); if ( rowsense_==NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rowsense_ = new char[nrows]; GUROBI_CALL( "getRowSense", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getRowSense", GRBgetcharattrarray(getMutableLpPtr(), GRB_CHAR_ATTR_SENSE, 0, nrows, rowsense_) ); for (int i = 0; i < nrows; ++i) { if( auxcolind && auxcolind[i] >= 0 ) { assert(rowsense_[i] == GRB_EQUAL); rowsense_[i] = 'R'; continue; } switch (rowsense_[i]) { case GRB_LESS_EQUAL: rowsense_[i] = 'L'; break; case GRB_GREATER_EQUAL: rowsense_[i] = 'G'; break; case GRB_EQUAL: rowsense_[i] = 'E'; break; } } } } return rowsense_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getRightHandSide() const { debugMessage("OsiGrbSolverInterface::getRightHandSide()\n"); if ( rhs_ == NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rhs_ = new double[nrows]; GUROBI_CALL( "getRightHandSide", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getRightHandSide", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_RHS, 0, nrows, rhs_) ); /* for ranged rows, we give the rhs of the aux. variable used to represent the range of this row as row rhs */ if( nauxcols ) for( int i = 0; i < nrows; ++i ) if( auxcolind[i] >= 0 ) GUROBI_CALL( "getRightHandSide", GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_UB, auxcolind[i], &rhs_[i]) ); } } return rhs_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getRowRange() const { debugMessage("OsiGrbSolverInterface::getRowRange()\n"); if ( rowrange_==NULL ) { int nrows = getNumRows(); if (nrows > 0) rowrange_ = CoinCopyOfArrayOrZero((double*)NULL, nrows); if( nauxcols ) { double auxlb, auxub; for( int i = 0; i < nrows; ++i ) if( auxcolind[i] >= 0 ) { GUROBI_CALL( "getRowRange", GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_LB, auxcolind[i], &auxlb) ); GUROBI_CALL( "getRowRange", GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_UB, auxcolind[i], &auxub) ); rowrange_[i] = auxub - auxlb; } } } return rowrange_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getRowLower() const { debugMessage("OsiGrbSolverInterface::getRowLower()\n"); if ( rowlower_ == NULL ) { int nrows = getNumRows(); if ( nrows > 0 ) { const char* rowsense = getRowSense(); rowlower_ = new double[nrows]; double rhs; double dum1; for ( int i = 0; i < nrows; ++i ) { if( auxcolind && auxcolind[i] >= 0 ) { assert(rowsense[i] == 'R'); GUROBI_CALL( "getRowLower", GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_LB, auxcolind[i], &rowlower_[i]) ); } else { GUROBI_CALL( "getRowLower", GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_RHS, i, &rhs) ); convertSenseToBound( rowsense[i], rhs, 0.0, rowlower_[i], dum1 ); } } } } return rowlower_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getRowUpper() const { debugMessage("OsiGrbSolverInterface::getRowUpper()\n"); if ( rowupper_ == NULL ) { int nrows = getNumRows(); if ( nrows > 0 ) { const char* rowsense = getRowSense(); rowupper_ = new double[nrows]; double rhs; double dum1; for ( int i = 0; i < nrows; ++i ) { if( auxcolind && auxcolind[i] >= 0 ) { assert(rowsense[i] == 'R'); GUROBI_CALL( "getRowUpper", GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_UB, auxcolind[i], &rowupper_[i]) ); } else { GUROBI_CALL( "getRowUpper", GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_RHS, i, &rhs) ); convertSenseToBound( rowsense[i], rhs, 0.0, dum1, rowupper_[i] ); } } } } return rowupper_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getObjCoefficients() const { debugMessage("OsiGrbSolverInterface::getObjCoefficients()\n"); if ( obj_==NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { obj_ = new double[ncols]; GUROBI_CALL( "getObjCoefficients", GRBupdatemodel(getMutableLpPtr()) ); if( nauxcols ) GUROBI_CALL( "getObjCoefficients", GRBgetdblattrlist(getMutableLpPtr(), GRB_DBL_ATTR_OBJ, ncols, colmap_O2G, obj_) ); else GUROBI_CALL( "getObjCoefficients", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_OBJ, 0, ncols, obj_) ); } } return obj_; } //------------------------------------------------------------------ double OsiGrbSolverInterface::getObjSense() const { debugMessage("OsiGrbSolverInterface::getObjSense()\n"); int sense; GUROBI_CALL( "getObjSense", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getObjSense", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_MODELSENSE, &sense) ); return (double)sense; } //------------------------------------------------------------------ // Return information on integrality //------------------------------------------------------------------ bool OsiGrbSolverInterface::isContinuous( int colNumber ) const { debugMessage("OsiGrbSolverInterface::isContinuous(%d)\n", colNumber); return getCtype()[colNumber] == 'C'; } //------------------------------------------------------------------ // Row and column copies of the matrix ... //------------------------------------------------------------------ const CoinPackedMatrix * OsiGrbSolverInterface::getMatrixByRow() const { debugMessage("OsiGrbSolverInterface::getMatrixByRow()\n"); if ( matrixByRow_ == NULL ) { int nrows = getNumRows(); int ncols = getNumCols(); if ( nrows == 0 ) { matrixByRow_ = new CoinPackedMatrix(); matrixByRow_->setDimensions(0, ncols); return matrixByRow_; } int nelems; int *starts = new int [nrows + 1]; int *len = new int [nrows]; GUROBI_CALL( "getMatrixByRow", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getMatrixByRow", GRBgetconstrs(getMutableLpPtr(), &nelems, NULL, NULL, NULL, 0, nrows) ); assert( nelems == getNumElements() + nauxcols ); int *indices = new int [nelems]; double *elements = new double[nelems]; GUROBI_CALL( "getMatrixByRow", GRBgetconstrs(getMutableLpPtr(), &nelems, starts, indices, elements, 0, nrows) ); matrixByRow_ = new CoinPackedMatrix(); // Should be able to pass null for length of packed matrix, // assignMatrix does not seem to allow (even though documentation say it is possible to do this). // For now compute the length. starts[nrows] = nelems; for ( int i = 0; i < nrows; ++i ) len[i] = starts[i+1] - starts[i]; matrixByRow_->assignMatrix( false /* not column ordered */, ncols + nauxcols, nrows, nelems, elements, indices, starts, len); if( nauxcols ) { // delete auxiliary columns from matrix int* auxcols = new int[nauxcols]; int j = 0; for( int i = 0; i < ncols + nauxcols; ++i ) if( colmap_G2O[i] < 0 ) auxcols[j++] = i; assert(j == nauxcols); matrixByRow_->deleteCols(nauxcols, auxcols); delete[] auxcols; assert(matrixByRow_->getNumElements() == getNumElements()); assert(matrixByRow_->getMinorDim() <= ncols); } } return matrixByRow_; } //------------------------------------------------------------------ const CoinPackedMatrix * OsiGrbSolverInterface::getMatrixByCol() const { debugMessage("OsiGrbSolverInterface::getMatrixByCol()\n"); if ( matrixByCol_ == NULL ) { int nrows = getNumRows(); int ncols = getNumCols(); matrixByCol_ = new CoinPackedMatrix(); if ( ncols > 0 ) { int nelems; int *starts = new int [ncols + nauxcols + 1]; int *len = new int [ncols + nauxcols]; GUROBI_CALL( "getMatrixByCol", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getMatrixByCol", GRBgetvars(getMutableLpPtr(), &nelems, NULL, NULL, NULL, 0, ncols + nauxcols) ); int *indices = new int [nelems]; double *elements = new double[nelems]; GUROBI_CALL( "getMatrixByCol", GRBgetvars(getMutableLpPtr(), &nelems, starts, indices, elements, 0, ncols + nauxcols) ); // Should be able to pass null for length of packed matrix, // assignMatrix does not seem to allow (even though documentation say it is possible to do this). // For now compute the length. starts[ncols + nauxcols] = nelems; for ( int i = 0; i < ncols + nauxcols; i++ ) len[i] = starts[i+1] - starts[i]; matrixByCol_->assignMatrix( true /* column ordered */, nrows, ncols + nauxcols, nelems, elements, indices, starts, len); assert( matrixByCol_->getNumCols() == ncols + nauxcols ); assert( matrixByCol_->getNumRows() == nrows ); if( nauxcols ) { // delete auxiliary columns from matrix int* auxcols = new int[nauxcols]; int j = 0; for( int i = 0; i < ncols + nauxcols; ++i ) if( colmap_G2O[i] < 0 ) auxcols[j++] = i; assert(j == nauxcols); matrixByCol_->deleteCols(nauxcols, auxcols); delete[] auxcols; assert(matrixByCol_->getNumElements() == getNumElements()); assert(matrixByCol_->getMajorDim() <= ncols); assert(matrixByCol_->getMinorDim() <= nrows); } } else matrixByCol_->setDimensions(nrows, ncols); } return matrixByCol_; } //------------------------------------------------------------------ // Get solver's value for infinity //------------------------------------------------------------------ double OsiGrbSolverInterface::getInfinity() const { debugMessage("OsiGrbSolverInterface::getInfinity()\n"); return GRB_INFINITY; } //############################################################################# // Problem information methods (results) //############################################################################# // *FIXME*: what should be done if a certain vector doesn't exist??? const double * OsiGrbSolverInterface::getColSolution() const { debugMessage("OsiGrbSolverInterface::getColSolution()\n"); if( colsol_ == NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { colsol_ = new double[ncols]; GUROBI_CALL( "getColSolution", GRBupdatemodel(getMutableLpPtr()) ); if ( GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_X, 0, colsol_) == 0 ) { // if a solution is available, get it if( nauxcols ) GUROBI_CALL( "getColSolution", GRBgetdblattrlist(getMutableLpPtr(), GRB_DBL_ATTR_X, ncols, colmap_O2G, colsol_) ); else GUROBI_CALL( "getColSolution", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_X, 0, ncols, colsol_) ); } else { *messageHandler() << "Warning: OsiGrbSolverInterface::getColSolution() called, but no solution available! Returning lower bounds, but they may be at -infinity. Be aware!" << CoinMessageEol; if (OsiGrbSolverInterface::globalenv_) *messageHandler() << "\t GUROBI error message: " << GRBgeterrormsg(OsiGrbSolverInterface::globalenv_) << CoinMessageEol; if( nauxcols ) GUROBI_CALL( "getColSolution", GRBgetdblattrlist(getMutableLpPtr(), GRB_DBL_ATTR_LB, ncols, colmap_O2G, colsol_) ); else GUROBI_CALL( "getColSolution", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_LB, 0, ncols, colsol_) ); } } } return colsol_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getRowPrice() const { debugMessage("OsiGrbSolverInterface::getRowPrice()\n"); if( rowsol_==NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rowsol_ = new double[nrows]; GUROBI_CALL( "getRowPrice", GRBupdatemodel(getMutableLpPtr()) ); if ( GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_PI, 0, rowsol_) == 0 ) { GUROBI_CALL( "getRowPrice", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_PI, 0, nrows, rowsol_) ); } else { *messageHandler() << "Warning: OsiGrbSolverInterface::getRowPrice() called, but no solution available! Returning 0.0. Be aware!" << CoinMessageEol; if (OsiGrbSolverInterface::globalenv_) *messageHandler() << "\t GUROBI error message: " << GRBgeterrormsg(OsiGrbSolverInterface::globalenv_) << CoinMessageEol; CoinZeroN(rowsol_, nrows); } //??? what is the dual value for a ranged row? } } return rowsol_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getReducedCost() const { debugMessage("OsiGrbSolverInterface::getReducedCost()\n"); if( redcost_==NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { redcost_ = new double[ncols]; GUROBI_CALL( "getReducedCost", GRBupdatemodel(getMutableLpPtr()) ); if ( GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_RC, 0, redcost_) == 0 ) { // if reduced costs are available, get them if( nauxcols ) GUROBI_CALL( "getReducedCost", GRBgetdblattrlist(getMutableLpPtr(), GRB_DBL_ATTR_RC, ncols, colmap_O2G, redcost_) ); else GUROBI_CALL( "getReducedCost", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_RC, 0, ncols, redcost_) ); } else { *messageHandler() << "Warning: OsiGrbSolverInterface::getReducedCost() called, but no solution available! Returning 0.0. Be aware!" << CoinMessageEol; if (OsiGrbSolverInterface::globalenv_) *messageHandler() << "\t GUROBI error message: " << GRBgeterrormsg(OsiGrbSolverInterface::globalenv_) << CoinMessageEol; CoinZeroN(redcost_, ncols); } } } return redcost_; } //------------------------------------------------------------------ const double * OsiGrbSolverInterface::getRowActivity() const { debugMessage("OsiGrbSolverInterface::getRowActivity()\n"); if( rowact_==NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rowact_ = new double[nrows]; GUROBI_CALL( "getRowActivity", GRBupdatemodel(getMutableLpPtr()) ); if ( GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_SLACK, 0, rowact_) == 0 ) { GUROBI_CALL( "getRowActivity", GRBgetdblattrarray(getMutableLpPtr(), GRB_DBL_ATTR_SLACK, 0, nrows, rowact_) ); for( int r = 0; r < nrows; ++r ) { if( nauxcols && auxcolind[r] >= 0 ) { GUROBI_CALL( "getRowActivity", GRBgetdblattrelement(getMutableLpPtr(), GRB_DBL_ATTR_X, auxcolind[r], &rowact_[r]) ); } else rowact_[r] = getRightHandSide()[r] - rowact_[r]; } } else { *messageHandler() << "Warning: OsiGrbSolverInterface::getRowActivity() called, but no solution available! Returning 0.0. Be aware!" << CoinMessageEol; if (OsiGrbSolverInterface::globalenv_) *messageHandler() << "\t GUROBI error message: " << GRBgeterrormsg(OsiGrbSolverInterface::globalenv_) << CoinMessageEol; CoinZeroN(rowact_, nrows); } } } return rowact_; } //------------------------------------------------------------------ double OsiGrbSolverInterface::getObjValue() const { debugMessage("OsiGrbSolverInterface::getObjValue()\n"); double objval = 0.0; GUROBI_CALL( "getObjValue", GRBupdatemodel(getMutableLpPtr()) ); if( GRBgetdblattr(getMutableLpPtr(), GRB_DBL_ATTR_OBJVAL, &objval) == 0 ) { // Adjust objective function value by constant term in objective function double objOffset; getDblParam(OsiObjOffset,objOffset); objval = objval - objOffset; } else { *messageHandler() << "Warning: OsiGrbSolverInterface::getObjValue() called, but probably no solution available! Returning 0.0. Be aware!" << CoinMessageEol; if (OsiGrbSolverInterface::globalenv_) *messageHandler() << "\t GUROBI error message: " << GRBgeterrormsg(OsiGrbSolverInterface::globalenv_) << CoinMessageEol; } return objval; } //------------------------------------------------------------------ int OsiGrbSolverInterface::getIterationCount() const { debugMessage("OsiGrbSolverInterface::getIterationCount()\n"); double itercnt; GUROBI_CALL( "getIterationCount", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "getIterationCount", GRBgetdblattr(getMutableLpPtr(), GRB_DBL_ATTR_ITERCOUNT, &itercnt) ); return (int)itercnt; } //------------------------------------------------------------------ std::vector OsiGrbSolverInterface::getDualRays(int maxNumRays, bool fullRay) const { debugMessage("OsiGrbSolverInterface::getDualRays(%d,%s)\n", maxNumRays, fullRay?"true":"false"); if (fullRay == true) { throw CoinError("Full dual rays not yet implemented.","getDualRays", "OsiGrbSolverInterface"); } OsiGrbSolverInterface solver(*this); const int numcols = getNumCols(); const int numrows = getNumRows(); int* index = new int[CoinMax(numcols,numrows)]; int i; for ( i = CoinMax(numcols,numrows)-1; i >= 0; --i) { index[i] = i; } double* obj = new double[CoinMax(numcols,2*numrows)]; CoinFillN(obj, numcols, 0.0); solver.setObjCoeffSet(index, index+numcols, obj); double* clb = new double[2*numrows]; double* cub = new double[2*numrows]; const double plusone = 1.0; const double minusone = -1.0; const char* sense = getRowSense(); const CoinPackedVectorBase** cols = new const CoinPackedVectorBase*[numrows]; int newcols = 0; for (i = 0; i < numrows; ++i) { switch (sense[i]) { case 'L': cols[newcols++] = new CoinShallowPackedVector(1, &index[i], &minusone, false); break; case 'G': cols[newcols++] = new CoinShallowPackedVector(1, &index[i], &plusone, false); break; case 'R': cols[newcols++] = new CoinShallowPackedVector(1, &index[i], &minusone, false); cols[newcols++] = new CoinShallowPackedVector(1, &index[i], &plusone, false); break; case 'N': case 'E': break; } } CoinFillN(obj, newcols, 1.0); CoinFillN(clb, newcols, 0.0); CoinFillN(cub, newcols, getInfinity()); solver.addCols(newcols, cols, clb, cub, obj); delete[] index; delete[] cols; delete[] clb; delete[] cub; delete[] obj; solver.setObjSense(1.0); // minimize solver.initialSolve(); const double* solverpi = solver.getRowPrice(); double* pi = new double[numrows]; for ( i = numrows - 1; i >= 0; --i) { pi[i] = -solverpi[i]; } return std::vector(1, pi); } //------------------------------------------------------------------ std::vector OsiGrbSolverInterface::getPrimalRays(int maxNumRays) const { debugMessage("OsiGrbSolverInterface::getPrimalRays(%d)\n", maxNumRays); return std::vector(); } //############################################################################# // Problem modifying methods (rim vectors) //############################################################################# void OsiGrbSolverInterface::setObjCoeff( int elementIndex, double elementValue ) { debugMessage("OsiGrbSolverInterface::setObjCoeff(%d, %g)\n", elementIndex, elementValue); GUROBI_CALL( "setObjCoeff", GRBsetdblattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_OBJ, nauxcols ? colmap_O2G[elementIndex] : elementIndex, elementValue) ); if(obj_ != NULL) obj_[elementIndex] = elementValue; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setObjCoeffSet(const int* indexFirst, const int* indexLast, const double* coeffList) { debugMessage("OsiGrbSolverInterface::setObjCoeffSet(%p, %p, %p)\n", (void*)indexFirst, (void*)indexLast, (void*)coeffList); const int cnt = (int)(indexLast - indexFirst); if( cnt == 0 ) return; if( cnt == 1 ) { setObjCoeff(*indexFirst, *coeffList); return; } assert(cnt > 1); if( nauxcols ) { int* indices = new int[cnt]; for( int i = 0; i < cnt; ++i ) indices[i] = colmap_O2G[indexFirst[i]]; GUROBI_CALL( "setObjCoeffSet", GRBsetdblattrlist(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_OBJ, cnt, indices, const_cast(coeffList)) ); delete[] indices; } else { GUROBI_CALL( "setObjCoeffSet", GRBsetdblattrlist(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_OBJ, cnt, const_cast(indexFirst), const_cast(coeffList)) ); } if (obj_ != NULL) for (int i = 0; i < cnt; ++i) obj_[indexFirst[i]] = coeffList[i]; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setColLower(int elementIndex, double elementValue) { debugMessage("OsiGrbSolverInterface::setColLower(%d, %g)\n", elementIndex, elementValue); GUROBI_CALL( "setColLower", GRBsetdblattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_LB, nauxcols ? colmap_O2G[elementIndex] : elementIndex, elementValue) ); if(collower_ != NULL) collower_[elementIndex] = elementValue; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setColUpper(int elementIndex, double elementValue) { debugMessage("OsiGrbSolverInterface::setColUpper(%d, %g)\n", elementIndex, elementValue); GUROBI_CALL( "setColUpper", GRBsetdblattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_UB, nauxcols ? colmap_O2G[elementIndex] : elementIndex, elementValue) ); if(colupper_ != NULL) colupper_[elementIndex] = elementValue; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setColBounds( int elementIndex, double lower, double upper ) { debugMessage("OsiGrbSolverInterface::setColBounds(%d, %g, %g)\n", elementIndex, lower, upper); setColLower(elementIndex, lower); setColUpper(elementIndex, upper); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { debugMessage("OsiGrbSolverInterface::setColSetBounds(%p, %p, %p)\n", (void*)indexFirst, (void*)indexLast, (void*)boundList); const int cnt = (int)(indexLast - indexFirst); if (cnt == 0) return; if (cnt == 1) { setColLower(*indexFirst, boundList[0]); setColUpper(*indexFirst, boundList[1]); return; } assert(cnt > 1); double* lbList = new double[cnt]; double* ubList = new double[cnt]; int* indices = nauxcols ? new int[cnt] : NULL; for (int i = 0; i < cnt; ++i) { lbList[i] = boundList[2*i]; ubList[i] = boundList[2*i+1]; if( indices ) indices[i] = colmap_O2G[indexFirst[i]]; if(collower_ != NULL) collower_[indexFirst[i]] = boundList[2*i]; if(colupper_ != NULL) colupper_[indexFirst[i]] = boundList[2*i+1]; } GUROBI_CALL( "setColSetBounds", GRBsetdblattrlist(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_LB, cnt, indices ? indices : const_cast(indexFirst), lbList) ); GUROBI_CALL( "setColSetBounds", GRBsetdblattrlist(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_UB, cnt, indices ? indices : const_cast(indexFirst), ubList) ); delete[] lbList; delete[] ubList; delete[] indices; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setRowLower( int i, double elementValue ) { debugMessage("OsiGrbSolverInterface::setRowLower(%d, %g)\n", i, elementValue); double rhs = getRightHandSide()[i]; double range = getRowRange()[i]; char sense = getRowSense()[i]; double lower = 0, upper = 0; convertSenseToBound( sense, rhs, range, lower, upper ); if( lower != elementValue ) { convertBoundToSense( elementValue, upper, sense, rhs, range ); setRowType( i, sense, rhs, range ); } } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setRowUpper( int i, double elementValue ) { debugMessage("OsiGrbSolverInterface::setRowUpper(%d, %g)\n", i, elementValue); double rhs = getRightHandSide()[i]; double range = getRowRange()[i]; char sense = getRowSense()[i]; double lower = 0, upper = 0; convertSenseToBound( sense, rhs, range, lower, upper ); if( upper != elementValue ) { convertBoundToSense( lower, elementValue, sense, rhs, range ); setRowType( i, sense, rhs, range ); } } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setRowBounds( int elementIndex, double lower, double upper ) { debugMessage("OsiGrbSolverInterface::setRowBounds(%d, %g, %g)\n", elementIndex, lower, upper); double rhs, range; char sense; convertBoundToSense( lower, upper, sense, rhs, range ); setRowType( elementIndex, sense, rhs, range ); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setRowType(int i, char sense, double rightHandSide, double range) { debugMessage("OsiGrbSolverInterface::setRowType(%d, %c, %g, %g)\n", i, sense, rightHandSide, range); GUROBI_CALL( "setRowType", GRBupdatemodel(getMutableLpPtr()) ); if( nauxcols && auxcolind[i] >= 0 ) { // so far, row i is a ranged row switch (sense) { case 'R': // row i was ranged row and remains a ranged row assert(range > 0); GUROBI_CALL( "setRowType", GRBsetdblattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_LB, auxcolind[i], rightHandSide - range) ); GUROBI_CALL( "setRowType", GRBsetdblattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_UB, auxcolind[i], rightHandSide ) ); break; case 'N': case 'L': case 'G': case 'E': convertToNormalRow(i, sense, rightHandSide); break; default: std::cerr << "Unknown row sense: " << sense << std::endl; exit(-1); } } else if (sense == 'R') { convertToRangedRow(i, rightHandSide, range); } else { char grbsense; switch (sense) { case 'N': grbsense = GRB_LESS_EQUAL; rightHandSide = getInfinity(); break; case 'L': grbsense = GRB_LESS_EQUAL; break; case 'G': grbsense = GRB_GREATER_EQUAL; break; case 'E': grbsense = GRB_EQUAL; break; default: std::cerr << "Unknown row sense: " << sense << std::endl; exit(-1); } GUROBI_CALL( "setRowType", GRBsetcharattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_CHAR_ATTR_SENSE, i, grbsense ) ); GUROBI_CALL( "setRowType", GRBsetdblattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_RHS, i, rightHandSide) ); } if(rowsense_ != NULL) rowsense_[i] = sense; if(rhs_ != NULL) rhs_[i] = rightHandSide; if (rowlower_ != NULL || rowupper_ != NULL) { double dummy; convertSenseToBound(sense, rightHandSide, range, rowlower_ ? rowlower_[i] : dummy, rowupper_ ? rowupper_[i] : dummy); } } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { debugMessage("OsiGrbSolverInterface::setRowSetBounds(%p, %p, %p)\n", (void*)indexFirst, (void*)indexLast, (void*)boundList); const long int cnt = indexLast - indexFirst; if (cnt <= 0) return; char* sense = new char[cnt]; double* rhs = new double[cnt]; double* range = new double[cnt]; for (int i = 0; i < cnt; ++i) convertBoundToSense(boundList[2*i], boundList[2*i+1], sense[i], rhs[i], range[i]); setRowSetTypes(indexFirst, indexLast, sense, rhs, range); delete[] range; delete[] rhs; delete[] sense; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { debugMessage("OsiGrbSolverInterface::setRowSetTypes(%p, %p, %p, %p, %p)\n", (void*)indexFirst, (void*)indexLast, (void*)senseList, (void*)rhsList, (void*)rangeList); const int cnt = (int)(indexLast - indexFirst); if (cnt == 0) return; if (cnt == 1) { setRowType(*indexFirst, *senseList, *rhsList, *rangeList); return; } assert(cnt > 0); GUROBI_CALL( "setRowSetTypes", GRBupdatemodel(getMutableLpPtr()) ); char* grbsense = new char[cnt]; double* rhs = new double[cnt]; for (int i = 0; i < cnt; ++i) { rhs[i] = rhsList[i]; if( nauxcols && auxcolind[indexFirst[i]] >= 0 ) { // so far, row is a ranged row switch (senseList[i]) { case 'R': // row i was ranged row and remains a ranged row assert(rangeList[i] > 0); GUROBI_CALL( "setRowSetTypes", GRBsetdblattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_LB, auxcolind[indexFirst[i]], rhsList[i] - rangeList[i]) ); GUROBI_CALL( "setRowSetTypes", GRBsetdblattrelement(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), GRB_DBL_ATTR_UB, auxcolind[indexFirst[i]], rhsList[i] ) ); grbsense[i] = GRB_EQUAL; rhs[i] = 0.0; break; case 'N': convertToNormalRow(indexFirst[i], senseList[i], rhsList[i]); grbsense[i] = GRB_LESS_EQUAL; rhs[i] = getInfinity(); break; case 'L': convertToNormalRow(indexFirst[i], senseList[i], rhsList[i]); grbsense[i] = GRB_LESS_EQUAL; break; case 'G': convertToNormalRow(indexFirst[i], senseList[i], rhsList[i]); grbsense[i] = GRB_GREATER_EQUAL; break; case 'E': convertToNormalRow(indexFirst[i], senseList[i], rhsList[i]); grbsense[i] = GRB_EQUAL; break; default: std::cerr << "Unknown row sense: " << senseList[i] << std::endl; exit(-1); } } else if (senseList[i] == 'R') { convertToRangedRow(indexFirst[i], rhsList[i], rangeList[i]); grbsense[i] = GRB_EQUAL; rhs[i] = 0.0; } else { switch (senseList[i]) { case 'N': grbsense[i] = GRB_LESS_EQUAL; rhs[i] = getInfinity(); break; case 'L': grbsense[i] = GRB_LESS_EQUAL; break; case 'G': grbsense[i] = GRB_GREATER_EQUAL; break; case 'E': grbsense[i] = GRB_EQUAL; break; default: std::cerr << "Unknown row sense: " << senseList[i] << std::endl; exit(-1); } } if(rowsense_ != NULL) rowsense_[indexFirst[i]] = senseList[i]; if(rhs_ != NULL) rhs_[indexFirst[i]] = senseList[i] == 'N' ? getInfinity() : rhsList[i]; } GUROBI_CALL( "setRowSetTypes", GRBsetcharattrlist(getLpPtr(OsiGrbSolverInterface::KEEPCACHED_ROW), GRB_CHAR_ATTR_SENSE, cnt, const_cast(indexFirst), grbsense) ); GUROBI_CALL( "setRowSetTypes", GRBsetdblattrlist(getLpPtr(OsiGrbSolverInterface::KEEPCACHED_ROW), GRB_DBL_ATTR_RHS, cnt, const_cast(indexFirst), rhs) ); delete[] rhs; delete[] grbsense; } //############################################################################# void OsiGrbSolverInterface::setContinuous(int index) { debugMessage("OsiGrbSolverInterface::setContinuous(%d)\n", index); assert(coltype_ != NULL); assert(colspace_ >= getNumCols()); coltype_[index] = GRB_CONTINUOUS; if ( probtypemip_ ) { GUROBI_CALL( "setContinuous", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "setContinuous", GRBsetcharattrelement(getMutableLpPtr(), GRB_CHAR_ATTR_VTYPE, nauxcols ? colmap_O2G[index] : index, GRB_CONTINUOUS) ); } } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setInteger(int index) { debugMessage("OsiGrbSolverInterface::setInteger(%d)\n", index); assert(coltype_ != NULL); assert(colspace_ >= getNumCols()); if( getColLower()[index] == 0.0 && getColUpper()[index] == 1.0 ) coltype_[index] = GRB_BINARY; else coltype_[index] = GRB_INTEGER; if ( probtypemip_ ) { GUROBI_CALL( "setInteger", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "setInteger", GRBsetcharattrelement(getMutableLpPtr(), GRB_CHAR_ATTR_VTYPE, nauxcols ? colmap_O2G[index] : index, coltype_[index]) ); } } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setContinuous(const int* indices, int len) { debugMessage("OsiGrbSolverInterface::setContinuous(%p, %d)\n", (void*)indices, len); for( int i = 0; i < len; ++i ) setContinuous(indices[i]); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setInteger(const int* indices, int len) { debugMessage("OsiGrbSolverInterface::setInteger(%p, %d)\n", (void*)indices, len); for( int i = 0; i < len; ++i ) setInteger(indices[i]); } //############################################################################# void OsiGrbSolverInterface::setRowName(int ndx, std::string name) { debugMessage("OsiGrbSolverInterface::setRowName\n"); if (ndx < 0 || ndx >= getNumRows()) return; int nameDiscipline ; getIntParam(OsiNameDiscipline, nameDiscipline); if (nameDiscipline == 0) return; OsiSolverInterface::setRowName(ndx, name); GUROBI_CALL( "setRowName", GRBsetstrattrelement(getLpPtr(), GRB_STR_ATTR_CONSTRNAME, ndx, const_cast(name.c_str())) ); } void OsiGrbSolverInterface::setColName(int ndx, std::string name) { debugMessage("OsiGrbSolverInterface::setColName\n"); if (ndx < 0 || ndx >= getNumCols()) return; int nameDiscipline ; getIntParam(OsiNameDiscipline, nameDiscipline); if (nameDiscipline == 0) return; OsiSolverInterface::setColName(ndx, name); GUROBI_CALL( "setColName", GRBsetstrattrelement(getLpPtr(), GRB_STR_ATTR_VARNAME, nauxcols ? colmap_O2G[ndx] : ndx, const_cast(name.c_str())) ); } //############################################################################# void OsiGrbSolverInterface::setObjSense(double s) { debugMessage("OsiGrbSolverInterface::setObjSense(%g)\n", s); GUROBI_CALL( "setObjSense", GRBsetintattr(getLpPtr( OsiGrbSolverInterface::FREECACHED_RESULTS ), GRB_INT_ATTR_MODELSENSE, (int)s) ); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setColSolution(const double * cs) { debugMessage("OsiGrbSolverInterface::setColSolution(%p)\n", (void*)cs); int nc = getNumCols(); if( cs == NULL ) freeCachedResults(); else if( nc > 0 ) { // If colsol isn't allocated, then allocate it if ( colsol_ == NULL ) colsol_ = new double[nc]; // Copy in new col solution. CoinDisjointCopyN( cs, nc, colsol_ ); //*messageHandler() << "OsiGrb::setColSolution: Gurobi does not allow setting the column solution. Command is ignored." << CoinMessageEol; } } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::setRowPrice(const double * rs) { debugMessage("OsiGrbSolverInterface::setRowPrice(%p)\n", (void*)rs); int nr = getNumRows(); if( rs == NULL ) freeCachedResults(); else if( nr > 0 ) { // If rowsol isn't allocated, then allocate it if ( rowsol_ == NULL ) rowsol_ = new double[nr]; // Copy in new row solution. CoinDisjointCopyN( rs, nr, rowsol_ ); *messageHandler() << "OsiGrb::setRowPrice: Gurobi does not allow setting the row price. Command is ignored." << CoinMessageEol; } } //############################################################################# // Problem modifying methods (matrix) //############################################################################# void OsiGrbSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { debugMessage("OsiGrbSolverInterface::addCol(%p, %g, %g, %g)\n", (void*)&vec, collb, colub, obj); int nc = getNumCols(); assert(colspace_ >= nc); resizeColSpace(nc + 1); coltype_[nc] = GRB_CONTINUOUS; GUROBI_CALL( "addCol", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "addCol", GRBaddvar(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_ROW ), vec.getNumElements(), const_cast(vec.getIndices()), const_cast(vec.getElements()), obj, collb, colub, coltype_[nc], NULL) ); if( nauxcols ) { colmap_O2G[nc] = nc + nauxcols; colmap_G2O[nc + nauxcols] = nc; } } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj) { debugMessage("OsiGrbSolverInterface::addCols(%d, %p, %p, %p, %p)\n", numcols, (void*)cols, (void*)collb, (void*)colub, (void*)obj); int nc = getNumCols(); assert(colspace_ >= nc); resizeColSpace(nc + numcols); CoinFillN(&coltype_[nc], numcols, GRB_CONTINUOUS); int i; int nz = 0; for (i = 0; i < numcols; ++i) nz += cols[i]->getNumElements(); int* index = new int[nz]; double* elem = new double[nz]; int* start = new int[numcols+1]; nz = 0; start[0] = 0; for (i = 0; i < numcols; ++i) { const CoinPackedVectorBase* col = cols[i]; const int len = col->getNumElements(); CoinDisjointCopyN(col->getIndices(), len, index+nz); CoinDisjointCopyN(col->getElements(), len, elem+nz); nz += len; start[i+1] = nz; } GUROBI_CALL( "addCols", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "addCols", GRBaddvars(getLpPtr(OsiGrbSolverInterface::KEEPCACHED_ROW), numcols, nz, start, index, elem, const_cast(obj), const_cast(collb), const_cast(colub), NULL, NULL) ); delete[] start; delete[] elem; delete[] index; if( nauxcols ) for( i = 0; i < numcols; ++i ) { colmap_O2G[nc+i] = nc+i + nauxcols; colmap_G2O[nc+i + nauxcols] = nc+i; } } static int intcompare(const void* p1, const void* p2) { return (*(const int*)p1) - (*(const int*)p2); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::deleteCols(const int num, const int * columnIndices) { debugMessage("OsiGrbSolverInterface::deleteCols(%d, %p)\n", num, (void*)columnIndices); if( num == 0 ) return; GUROBI_CALL( "deleteCols", GRBupdatemodel(getMutableLpPtr()) ); int* ind = NULL; if( nauxcols ) { int nc = getNumCols(); ind = new int[num]; // translate into gurobi indices and sort for( int i = 0; i < num; ++i ) ind[i] = colmap_O2G[columnIndices[i]]; qsort((void*)ind, num, sizeof(int), intcompare); // delete indices in gurobi GUROBI_CALL( "deleteCols", GRBdelvars(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_ROW ), num, ind) ); nc -= num; // update colmap_G2O and auxcolind int offset = 0; int j = 0; for( int i = ind[0]; i < nc + nauxcols; ++i ) { if( j < num && i == ind[j] ) { // variable i has been deleted, increase offset by 1 assert(colmap_G2O[i] >= 0); ++offset; while( j < num && i == ind[j] ) ++j; } // variable from position i+offset has moved to position i if( colmap_G2O[i+offset] >= 0 ) { // if variable at (hithero) position i+offset was a regular variable, then it is now stored at position i // substract offset since variable indices also changed in Osi colmap_G2O[i] = colmap_G2O[i+offset] - offset; assert(colmap_G2O[i] >= 0); // update also colmap_O2G colmap_O2G[colmap_G2O[i]] = i; } else { // if variable at (hithero) position i+offset was an auxiliary variable, then the corresponding row index is now stored at position i int rngrowidx = -colmap_G2O[i+offset]-1; assert(auxcolind[rngrowidx] == i+offset); colmap_G2O[i] = colmap_G2O[i+offset]; // update also auxcolind to point to position i now auxcolind[rngrowidx] = i; } } } else { GUROBI_CALL( "deleteCols", GRBdelvars(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_ROW ), num, const_cast(columnIndices)) ); } #ifndef NDEBUG if( nauxcols ) { int nc = getNumCols(); int nr = getNumRows(); for( int i = 0; i < nc + nauxcols; ++i ) { assert(i >= nc || colmap_G2O[colmap_O2G[i]] == i); assert(colmap_G2O[i] < 0 || colmap_O2G[colmap_G2O[i]] == i); assert(colmap_G2O[i] >= 0 || -colmap_G2O[i]-1 < nr); assert(colmap_G2O[i] >= 0 || auxcolind[-colmap_G2O[i]-1] == i); } } #endif if( !getColNames().empty() || coltype_ != NULL ) { if( ind == NULL ) ind = new int[num]; memcpy(ind, columnIndices, num * sizeof(int)); qsort((void*)ind, num, sizeof(int), intcompare); if( !getColNames().empty() ) for( int i = num-1; i >= 0; --i ) deleteColNames(ind[i], 1); if( coltype_ != NULL ) { int offset = 0; for( int i = 0; i <= getNumCols(); ++i ) { // variable i+offset was deleted if( offset < num && ind[offset] == i+offset ) ++offset; // move column type from position i+offset to i coltype_[i] = coltype_[i+offset]; } } } delete[] ind; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { debugMessage("OsiGrbSolverInterface::addRow(%p, %g, %g)\n", (void*)&vec, rowlb, rowub); char sense; double rhs, range; convertBoundToSense( rowlb, rowub, sense, rhs, range ); addRow( vec, sense, rhs, range ); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { debugMessage("OsiGrbSolverInterface::addRow(%p, %c, %g, %g)\n", (void*)&vec, rowsen, rowrhs, rowrng); char grbsense; double rhs = rowrhs; switch( rowsen ) { case 'R': /* ranged rows are added as equality rows first, and then an auxiliary variable is added */ assert(rowrng > 0.0); grbsense = GRB_EQUAL; rhs = 0.0; break; case 'N': grbsense = GRB_LESS_EQUAL; rhs = getInfinity(); break; case 'L': grbsense = GRB_LESS_EQUAL; break; case 'G': grbsense = GRB_GREATER_EQUAL; break; case 'E': grbsense = GRB_EQUAL; break; default: std::cerr << "Unknown row sense: " << rowsen << std::endl; exit(-1); } GUROBI_CALL( "addRow", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "addRow", GRBaddconstr(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_COLUMN ), vec.getNumElements(), const_cast(vec.getIndices()), const_cast(vec.getElements()), grbsense, rhs, NULL) ); if( rowsen == 'R' ) convertToRangedRow(getNumRows()-1, rowrhs, rowrng); else if( nauxcols ) resizeAuxColIndSpace(); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub) { debugMessage("OsiGrbSolverInterface::addRows(%d, %p, %p, %p)\n", numrows, (void*)rows, (void*)rowlb, (void*)rowub); int i; int nz = 0; for (i = 0; i < numrows; ++i) nz += rows[i]->getNumElements(); int* index = new int[nz]; double* elem = new double[nz]; int* start = new int[numrows+1]; char* grbsense = new char[numrows]; double* rhs = new double[numrows]; double range; bool haverangedrows = false; nz = 0; start[0] = 0; for (i = 0; i < numrows; ++i) { const CoinPackedVectorBase* row = rows[i]; const int len = row->getNumElements(); CoinDisjointCopyN(row->getIndices(), len, index+nz); CoinDisjointCopyN(row->getElements(), len, elem+nz); nz += len; start[i+1] = nz; convertBoundToSense( rowlb[i], rowub[i], grbsense[i], rhs[i], range ); if (range || grbsense[i] == 'R') { grbsense[i] = 'E'; rhs[i] = 0.0; haverangedrows = true; } switch (grbsense[i]) { case 'N': grbsense[i] = GRB_LESS_EQUAL; rhs[i] = getInfinity(); break; case 'L': grbsense[i] = GRB_LESS_EQUAL; break; case 'G': grbsense[i] = GRB_GREATER_EQUAL; break; case 'E': grbsense[i] = GRB_EQUAL; break; } } GUROBI_CALL( "addRows", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "addRows", GRBaddconstrs(getLpPtr(OsiGrbSolverInterface::KEEPCACHED_ROW), numrows, nz, start, index, elem, grbsense, rhs, NULL) ); delete[] start; delete[] elem; delete[] index; delete[] grbsense; delete[] rhs; if( haverangedrows ) { int nr = getNumRows() - numrows; for( i = 0; i < numrows; ++i ) if( rowlb[i] > getInfinity() && rowub[i] < getInfinity() && rowub[i] - rowlb[i] > 0.0 ) convertToRangedRow(nr + i, rowub[i], rowub[i] - rowlb[i]); } else if( nauxcols ) resizeAuxColIndSpace(); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng) { debugMessage("OsiGrbSolverInterface::addRows(%d, %p, %p, %p, %p)\n", numrows, (void*)rows, (void*)rowsen, (void*)rowrhs, (void*)rowrng); int i; int nz = 0; for (i = 0; i < numrows; ++i) nz += rows[i]->getNumElements(); int* index = new int[nz]; double* elem = new double[nz]; int* start = new int[numrows+1]; char* grbsense = new char[numrows]; double* rhs = new double[numrows]; bool haverangedrows = false; nz = 0; start[0] = 0; for (i = 0; i < numrows; ++i) { const CoinPackedVectorBase* row = rows[i]; const int len = row->getNumElements(); CoinDisjointCopyN(row->getIndices(), len, index+nz); CoinDisjointCopyN(row->getElements(), len, elem+nz); nz += len; start[i+1] = nz; rhs[i] = rowrhs[i]; switch (rowsen[i]) { case 'R': assert(rowrng[i] > 0.0); grbsense[i] = GRB_EQUAL; rhs[i] = 0.0; haverangedrows = true; break; case 'N': grbsense[i] = GRB_LESS_EQUAL; rhs[i] = getInfinity(); break; case 'L': grbsense[i] = GRB_LESS_EQUAL; break; case 'G': grbsense[i] = GRB_GREATER_EQUAL; break; case 'E': grbsense[i] = GRB_EQUAL; break; } } GUROBI_CALL( "addRows", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "addRows", GRBaddconstrs(getLpPtr(OsiGrbSolverInterface::KEEPCACHED_ROW), numrows, nz, start, index, elem, grbsense, rhs, NULL) ); delete[] start; delete[] elem; delete[] index; delete[] grbsense; delete[] rhs; if( haverangedrows ) { int nr = getNumRows() - numrows; for( i = 0; i < numrows; ++i ) if( rowsen[i] == 'R' ) convertToRangedRow(nr + i, rowrhs[i], rowrng[i]); } else if( nauxcols ) resizeAuxColIndSpace(); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::deleteRows(const int num, const int * rowIndices) { debugMessage("OsiGrbSolverInterface::deleteRows(%d, %p)\n", num, (void*)rowIndices); if( nauxcols ) { // check if a ranged row should be deleted; if so, then convert it into a normal row first for( int i = 0; i < num; ++i ) { if( auxcolind[rowIndices[i]] >= 0 ) convertToNormalRow(rowIndices[i], 'E', 0.0); } } GUROBI_CALL( "deleteRows", GRBdelconstrs(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_COLUMN ), num, const_cast(rowIndices)) ); if( nauxcols == 0 && getRowNames().empty() ) return; int* ind = CoinCopyOfArray(rowIndices, num); qsort((void*)ind, num, sizeof(int), intcompare); if( nauxcols ) { int nr = getNumRows(); int offset = 0; int j = 0; for( int i = 0; i < nr; ++i ) { if( j < num && i == ind[j] ) { ++offset; while( j < num && i == ind[j] ) ++j; } auxcolind[i] = auxcolind[i + offset]; if( auxcolind[i] >= 0 ) colmap_G2O[auxcolind[i]] = - i - 1; } } #ifndef NDEBUG if( nauxcols ) { int nc = getNumCols(); int nr = getNumRows(); for( int i = 0; i < nc + nauxcols; ++i ) { assert(i >= nc || colmap_G2O[colmap_O2G[i]] == i); assert(colmap_G2O[i] < 0 || colmap_O2G[colmap_G2O[i]] == i); assert(colmap_G2O[i] >= 0 || -colmap_G2O[i]-1 < nr); assert(colmap_G2O[i] >= 0 || auxcolind[-colmap_G2O[i]-1] == i); } } #endif if( !getRowNames().empty() ) for( int i = num-1; i >=0; --i ) deleteRowNames(ind[i], 1); delete[] ind; } //############################################################################# // Methods to input a problem //############################################################################# void OsiGrbSolverInterface::loadProblem( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { debugMessage("OsiGrbSolverInterface::loadProblem(1)(%p, %p, %p, %p, %p, %p)\n", (void*)&matrix, (void*)collb, (void*)colub, (void*)obj, (void*)rowlb, (void*)rowub); const double inf = getInfinity(); int nrows = matrix.getNumRows(); char * rowSense = new char [nrows]; double * rowRhs = new double[nrows]; double * rowRange = new double[nrows]; int i; for ( i = nrows - 1; i >= 0; --i ) { const double lower = rowlb ? rowlb[i] : -inf; const double upper = rowub ? rowub[i] : inf; convertBoundToSense( lower, upper, rowSense[i], rowRhs[i], rowRange[i] ); } loadProblem( matrix, collb, colub, obj, rowSense, rowRhs, rowRange ); delete [] rowSense; delete [] rowRhs; delete [] rowRange; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub ) { debugMessage("OsiGrbSolverInterface::assignProblem()\n"); loadProblem( *matrix, collb, colub, obj, rowlb, rowub ); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowlb; rowlb = 0; delete[] rowub; rowub = 0; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::loadProblem( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { debugMessage("OsiGrbSolverInterface::loadProblem(2)(%p, %p, %p, %p, %p, %p, %p)\n", (void*)&matrix, (void*)collb, (void*)colub, (void*)obj, (void*)rowsen, (void*)rowrhs, (void*)rowrng); int nc = matrix.getNumCols(); int nr = matrix.getNumRows(); int i; char* myrowsen = new char[nr]; double* myrowrhs = new double[nr]; bool haverangedrows = false; for ( i = 0; i < nr; ++i ) { if (rowrhs) myrowrhs[i] = rowrhs[i]; else myrowrhs[i] = 0.0; if (rowsen) switch (rowsen[i]) { case 'R': assert( rowrng && rowrng[i] > 0.0 ); myrowsen[i] = GRB_EQUAL; myrowrhs[i] = 0.0; haverangedrows = true; break; case 'N': myrowsen[i] = GRB_LESS_EQUAL; myrowrhs[i] = getInfinity(); break; case 'L': myrowsen[i] = GRB_LESS_EQUAL; break; case 'G': myrowsen[i] = GRB_GREATER_EQUAL; break; case 'E': myrowsen[i] = GRB_EQUAL; break; } else myrowsen[i] = 'G'; } // Set column values to defaults if NULL pointer passed double * clb; double * cub; double * ob; if ( collb != NULL ) clb = const_cast(collb); else { clb = new double[nc]; CoinFillN(clb, nc, 0.0); } if ( colub!=NULL ) cub = const_cast(colub); else { cub = new double[nc]; CoinFillN(cub, nc, getInfinity()); } if ( obj!=NULL ) ob = const_cast(obj); else { ob = new double[nc]; CoinFillN(ob, nc, 0.0); } bool freeMatrixRequired = false; CoinPackedMatrix * m = NULL; if( !matrix.isColOrdered() ) { m = new CoinPackedMatrix(); m->reverseOrderedCopyOf(matrix); freeMatrixRequired = true; } else m = const_cast(&matrix); // up to GUROBI 2.0.1, GUROBI may give an "Index is out of range" error if the constraint matrix has uninitalized "gaps" #if (GRB_VERSION_MAJOR < 2) || (GRB_VERSION_MAJOR == 2 && GRB_VERSION_MINOR == 0 && GRB_VERSION_TECHNICAL <= 1) if ( m->hasGaps() ) { if( freeMatrixRequired ) { m->removeGaps(); } else { m = new CoinPackedMatrix(matrix); if( m->hasGaps() ) m->removeGaps(); freeMatrixRequired = true; } } #endif assert( nc == m->getNumCols() ); assert( nr == m->getNumRows() ); assert( m->isColOrdered() ); int modelsense; GUROBI_CALL( "loadProblem", GRBupdatemodel(getMutableLpPtr()) ); GUROBI_CALL( "loadProblem", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_MODELSENSE, &modelsense) ); std::string pn; getStrParam(OsiProbName, pn); gutsOfDestructor(); // kill old LP, if any GUROBI_CALL( "loadProblem", GRBloadmodel(getEnvironmentPtr(), &lp_, const_cast(pn.c_str()), nc, nr, modelsense, 0.0, ob, const_cast(myrowsen), myrowrhs, const_cast(m->getVectorStarts()), const_cast(m->getVectorLengths()), const_cast(m->getIndices()), const_cast(m->getElements()), const_cast(clb), const_cast(cub), NULL, NULL, NULL) ); // GUROBI up to version 2.0.1 may return a scaled LP after GRBoptimize when requesting it via GRBgetvars #if (GRB_VERSION_MAJOR < 2) || (GRB_VERSION_MAJOR == 2 && GRB_VERSION_MINOR == 0 && GRB_VERSION_TECHNICAL <= 1) setHintParam(OsiDoScale, false); #endif delete[] myrowsen; delete[] myrowrhs; if ( collb == NULL ) delete[] clb; if ( colub == NULL ) delete[] cub; if ( obj == NULL ) delete[] ob; if ( freeMatrixRequired ) delete m; resizeColSpace(nc); CoinFillN(coltype_, nc, GRB_CONTINUOUS); if( haverangedrows ) { assert(rowrhs); assert(rowrng); assert(rowsen); for ( i = 0; i < nr; ++i ) if( rowsen[i] == 'R' ) convertToRangedRow(i, rowrhs[i], rowrng[i]); } } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng ) { debugMessage("OsiGrbSolverInterface::assignProblem()\n"); loadProblem( *matrix, collb, colub, obj, rowsen, rowrhs, rowrng ); delete matrix; matrix = NULL; delete[] collb; collb = NULL; delete[] colub; colub = NULL; delete[] obj; obj = NULL; delete[] rowsen; rowsen = NULL; delete[] rowrhs; rowrhs = NULL; delete[] rowrng; rowrng = NULL; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { debugMessage("OsiGrbSolverInterface::loadProblem(3)()\n"); const double inf = getInfinity(); char * rowSense = new char [numrows]; double * rowRhs = new double[numrows]; double * rowRange = new double[numrows]; for ( int i = numrows - 1; i >= 0; --i ) { const double lower = rowlb ? rowlb[i] : -inf; const double upper = rowub ? rowub[i] : inf; convertBoundToSense( lower, upper, rowSense[i], rowRhs[i], rowRange[i] ); } loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowSense, rowRhs, rowRange); delete [] rowSense; delete [] rowRhs; delete [] rowRange; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { debugMessage("OsiGrbSolverInterface::loadProblem(4)(%d, %d, %p, %p, %p, %p, %p, %p, %p, %p, %p)\n", numcols, numrows, (void*)start, (void*)index, (void*)value, (void*)collb, (void*)colub, (void*)obj, (void*)rowsen, (void*)rowrhs, (void*)rowrng); int nc = numcols; int nr = numrows; int i; char* myrowsen = new char[nr]; double* myrowrhs = new double[nr]; bool haverangedrows = false; for ( i=0; i 0.0); myrowsen[i] = GRB_EQUAL; myrowrhs[i] = 0.0; haverangedrows = true; break; case 'N': myrowsen[i] = GRB_LESS_EQUAL; myrowrhs[i] = getInfinity(); break; case 'L': myrowsen[i] = GRB_LESS_EQUAL; break; case 'G': myrowsen[i] = GRB_GREATER_EQUAL; break; case 'E': myrowsen[i] = GRB_EQUAL; break; } else myrowsen[i] = 'G'; } // Set column values to defaults if NULL pointer passed double * clb; double * cub; double * ob; if ( collb != NULL ) clb = const_cast(collb); else { clb = new double[nc]; CoinFillN(clb, nc, 0.0); } if ( colub!=NULL ) cub = const_cast(colub); else { cub = new double[nc]; CoinFillN(cub, nc, getInfinity()); } if ( obj!=NULL ) ob = const_cast(obj); else { ob = new double[nc]; CoinFillN(ob, nc, 0.0); } int* len = new int[nc]; for (i = 0; i < nc; ++i) len[i] = start[i+1] - start[i]; GUROBI_CALL( "loadProblem", GRBupdatemodel(getMutableLpPtr()) ); int modelsense; GUROBI_CALL( "loadProblem", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_MODELSENSE, &modelsense) ); std::string pn; getStrParam(OsiProbName, pn); gutsOfDestructor(); // kill old LP, if any GUROBI_CALL( "loadProblem", GRBloadmodel(getEnvironmentPtr(), &lp_, const_cast(pn.c_str()), nc, nr, modelsense, 0.0, ob, myrowsen, myrowrhs, const_cast(start), len, const_cast(index), const_cast(value), const_cast(clb), const_cast(cub), NULL, NULL, NULL) ); // GUROBI up to version 2.0.1 may return a scaled LP after GRBoptimize when requesting it via GRBgetvars #if (GRB_VERSION_MAJOR < 2) || (GRB_VERSION_MAJOR == 2 && GRB_VERSION_MINOR == 0 && GRB_VERSION_TECHNICAL <= 1) setHintParam(OsiDoScale, false); #endif delete[] myrowsen; delete[] myrowrhs; if ( collb == NULL ) delete[] clb; if ( colub == NULL ) delete[] cub; if ( obj == NULL ) delete[] ob; delete[] len; resizeColSpace(nc); CoinFillN(coltype_, nc, GRB_CONTINUOUS); if( haverangedrows ) { assert(rowrhs); assert(rowrng); assert(rowsen); for ( i = 0; i < nr; ++i ) if( rowsen[i] == 'R' ) convertToRangedRow(i, rowrhs[i], rowrng[i]); } } //----------------------------------------------------------------------------- // Read mps files //----------------------------------------------------------------------------- int OsiGrbSolverInterface::readMps( const char * filename, const char * extension ) { debugMessage("OsiGrbSolverInterface::readMps(%s, %s)\n", filename, extension); // just call base class method return OsiSolverInterface::readMps(filename,extension); } //----------------------------------------------------------------------------- // Write mps files //----------------------------------------------------------------------------- void OsiGrbSolverInterface::writeMps( const char * filename, const char * extension, double objSense ) const { debugMessage("OsiGrbSolverInterface::writeMps(%s, %s, %g)\n", filename, extension, objSense); std::string f(filename); std::string e(extension); std::string fullname = f + "." + e; //TODO give row and column names? writeMpsNative(fullname.c_str(), NULL, NULL); // do not call Gurobi's MPS writer, because // 1. it only writes mps if the extension is mps // 2. the instance in Gurobi may have extra columns due to reformulated ranged rows, that may be confusing // GUROBI_CALL( "writeMps", GRBwrite(getMutableLpPtr(), const_cast(fullname.c_str())) ); } //############################################################################# // CPX specific public interfaces //############################################################################# GRBenv* OsiGrbSolverInterface::getEnvironmentPtr() const { assert( localenv_ != NULL || globalenv_ != NULL ); return localenv_ ? localenv_ : globalenv_; } GRBmodel* OsiGrbSolverInterface::getLpPtr( int keepCached ) { freeCachedData( keepCached ); return getMutableLpPtr(); } /// Return whether the current Gurobi environment runs in demo mode. bool OsiGrbSolverInterface::isDemoLicense() const { debugMessage("OsiGrbSolverInterface::isDemoLicense()\n"); GRBenv* env = getEnvironmentPtr(); GRBmodel* testlp; // a Gurobi demo license allows to solve only models with up to 500 variables // thus, let's try to create and solve a model with 1000 variables GUROBI_CALL( "isDemoLicense", GRBnewmodel(env, &testlp, "licensetest", 1000, NULL, NULL, NULL, NULL, NULL) ); // GUROBI_CALL( "resolve", GRBsetintparam(GRBgetenv(testlp), GRB_INT_PAR_PRESOLVE, presolve) ); int rc = GRBoptimize(testlp); if(rc == GRB_ERROR_SIZE_LIMIT_EXCEEDED) return true; GUROBI_CALL( "isDemoLicense", rc ); GRBfreemodel(testlp); return false; } //----------------------------------------------------------------------------- const char * OsiGrbSolverInterface::getCtype() const { debugMessage("OsiGrbSolverInterface::getCtype()\n"); return coltype_; } //############################################################################# // Static instance counter methods //############################################################################# void OsiGrbSolverInterface::incrementInstanceCounter() { if ( numInstances_ == 0 && !globalenv_) { GUROBI_CALL( "incrementInstanceCounter", GRBloadenv( &globalenv_, NULL ) ); assert( globalenv_ != NULL ); globalenv_is_ours = true; } numInstances_++; } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::decrementInstanceCounter() { assert( numInstances_ != 0 ); assert( globalenv_ != NULL ); numInstances_--; if ( numInstances_ == 0 && globalenv_is_ours) { GRBfreeenv( globalenv_ ); globalenv_ = NULL; } } //----------------------------------------------------------------------------- unsigned int OsiGrbSolverInterface::getNumInstances() { return numInstances_; } void OsiGrbSolverInterface::setEnvironment(GRBenv* globalenv) { if (numInstances_) { assert(globalenv_); throw CoinError("Cannot set global GUROBI environment, since some OsiGrb instance is still using it.", "setEnvironment", "OsiGrbSolverInterface", __FILE__, __LINE__); } assert(!globalenv_ || !globalenv_is_ours); globalenv_ = globalenv; globalenv_is_ours = false; } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiGrbSolverInterface::OsiGrbSolverInterface(bool use_local_env) : OsiSolverInterface(), localenv_(NULL), lp_(NULL), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(1000000), // ??? default iteration limit for strong branching is large nameDisc_(0), obj_(NULL), collower_(NULL), colupper_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), rowlower_(NULL), rowupper_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL), probtypemip_(false), domipstart(false), colspace_(0), coltype_(NULL), nauxcols(0), auxcolspace(0), colmap_O2G(NULL), colmap_G2O(NULL), auxcolindspace(0), auxcolind(NULL) { debugMessage("OsiGrbSolverInterface::OsiGrbSolverInterface()\n"); if (use_local_env) { GUROBI_CALL( "OsiGrbSolverInterface", GRBloadenv( &localenv_, NULL ) ); assert( localenv_ != NULL ); } else incrementInstanceCounter(); gutsOfConstructor(); // change Osi default to Gurobi default setHintParam(OsiDoDualInInitial,true,OsiHintTry); } OsiGrbSolverInterface::OsiGrbSolverInterface(GRBenv* localgrbenv) : OsiSolverInterface(), localenv_(localgrbenv), lp_(NULL), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(1000000), // ??? default iteration limit for strong branching is large nameDisc_(0), obj_(NULL), collower_(NULL), colupper_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), rowlower_(NULL), rowupper_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL), probtypemip_(false), domipstart(false), colspace_(0), coltype_(NULL), nauxcols(0), auxcolspace(0), colmap_O2G(NULL), colmap_G2O(NULL), auxcolindspace(0), auxcolind(NULL) { debugMessage("OsiGrbSolverInterface::OsiGrbSolverInterface()\n"); if (localenv_ == NULL) { // if user called this constructor with NULL pointer, we assume that he meant that a local environment should be created GUROBI_CALL( "OsiGrbSolverInterface", GRBloadenv( &localenv_, NULL ) ); assert( localenv_ != NULL ); } gutsOfConstructor(); // change Osi default to Gurobi default setHintParam(OsiDoDualInInitial,true,OsiHintTry); } //---------------------------------------------------------------- // Clone //---------------------------------------------------------------- OsiSolverInterface * OsiGrbSolverInterface::clone(bool copyData) const { debugMessage("OsiGrbSolverInterface::clone(%d)\n", copyData); return( new OsiGrbSolverInterface( *this ) ); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiGrbSolverInterface::OsiGrbSolverInterface( const OsiGrbSolverInterface & source ) : OsiSolverInterface(source), localenv_(NULL), lp_(NULL), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(source.hotStartMaxIteration_), nameDisc_(source.nameDisc_), obj_(NULL), collower_(NULL), colupper_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), rowlower_(NULL), rowupper_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL), probtypemip_(false), domipstart(false), colspace_(0), coltype_(NULL), nauxcols(0), auxcolspace(0), colmap_O2G(NULL), colmap_G2O(NULL), auxcolindspace(0), auxcolind(NULL) { debugMessage("OsiGrbSolverInterface::OsiGrbSolverInterface(%p)\n", (void*)&source); if (source.localenv_) { GUROBI_CALL( "OsiGrbSolverInterface", GRBloadenv( &localenv_, NULL ) ); assert( localenv_ != NULL ); } else incrementInstanceCounter(); gutsOfConstructor(); gutsOfCopy( source ); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiGrbSolverInterface::~OsiGrbSolverInterface() { debugMessage("OsiGrbSolverInterface::~OsiGrbSolverInterface()\n"); gutsOfDestructor(); if (localenv_) { GRBfreeenv( localenv_ ); } else decrementInstanceCounter(); } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiGrbSolverInterface& OsiGrbSolverInterface::operator=( const OsiGrbSolverInterface& rhs ) { debugMessage("OsiGrbSolverInterface::operator=(%p)\n", (void*)&rhs); if (this != &rhs) { OsiSolverInterface::operator=( rhs ); gutsOfDestructor(); gutsOfConstructor(); if ( rhs.lp_ !=NULL ) gutsOfCopy( rhs ); } return *this; } //############################################################################# // Applying cuts //############################################################################# OsiSolverInterface::ApplyCutsReturnCode OsiGrbSolverInterface::applyCuts(const OsiCuts & cs, double effectivenessLb) { debugMessage("OsiGrbSolverInterface::applyCuts(%p)\n", (void*)&cs); OsiSolverInterface::ApplyCutsReturnCode retVal; int i; // Loop once for each column cut for ( i = 0; i < cs.sizeColCuts(); i ++ ) { if ( cs.colCut(i).effectiveness() < effectivenessLb ) { retVal.incrementIneffective(); continue; } if ( !cs.colCut(i).consistent() ) { retVal.incrementInternallyInconsistent(); continue; } if ( !cs.colCut(i).consistent(*this) ) { retVal.incrementExternallyInconsistent(); continue; } if ( cs.colCut(i).infeasible(*this) ) { retVal.incrementInfeasible(); continue; } applyColCut( cs.colCut(i) ); retVal.incrementApplied(); } // Loop once for each row cut int nToApply = 0; size_t space = 0; for ( i = 0; i < cs.sizeRowCuts(); i ++ ) { if ( cs.rowCut(i).effectiveness() < effectivenessLb ) { retVal.incrementIneffective(); continue; } if ( !cs.rowCut(i).consistent() ) { retVal.incrementInternallyInconsistent(); continue; } if ( !cs.rowCut(i).consistent(*this) ) { retVal.incrementExternallyInconsistent(); continue; } if ( cs.rowCut(i).infeasible(*this) ) { retVal.incrementInfeasible(); continue; } nToApply++; space += cs.rowCut(i).row().getNumElements(); retVal.incrementApplied(); } int base_row = getNumRows(); int base_col = getNumCols() + nauxcols; //now apply row cuts jointly int* start = new int[nToApply + 1]; int* indices = new int[space]; double* values = new double[space]; double* lower = new double[nToApply]; double* upper = new double[nToApply]; int cur = 0; int r = 0; int nTrulyRanged = nToApply; for ( i = 0; i < cs.sizeRowCuts(); i ++ ) { if ( cs.rowCut(i).effectiveness() < effectivenessLb ) { continue; } if ( !cs.rowCut(i).consistent() ) { continue; } if ( !cs.rowCut(i).consistent(*this) ) { continue; } if ( cs.rowCut(i).infeasible(*this) ) { continue; } start[r] = cur; const OsiRowCut & rowCut = cs.rowCut(i); lower[r] = rowCut.lb(); upper[r] = rowCut.ub(); std::cerr << "range " << lower[r] << " - " << upper[r] << std::endl; if( lower[r] <= -getInfinity() ) { lower[r] = -GRB_INFINITY; nTrulyRanged--; } else if (upper[r] >= getInfinity() ) { upper[r] = GRB_INFINITY; nTrulyRanged--; } for (int k = 0; k < rowCut.row().getNumElements(); k++) { values[cur + k] = rowCut.row().getElements()[k]; indices[cur + k] = rowCut.row().getIndices()[k]; } r++; cur += rowCut.row().getNumElements(); } start[nToApply] = cur; int nPrevVars = getNumCols(); GUROBI_CALL( "applyRowCuts", GRBaddrangeconstrs( getLpPtr( OsiGrbSolverInterface::KEEPCACHED_COLUMN ), nToApply, static_cast(space), start, indices, values, lower, upper, NULL) ); GUROBI_CALL( "applyRowCuts", GRBupdatemodel(getMutableLpPtr()) ); // store correspondence between ranged rows and new variables added by Gurobi int nNewVars = getNumCols() - nPrevVars; if (nNewVars != nTrulyRanged) { std::cerr << "ERROR in applying cuts for Gurobi: " << __FILE__ << " : " << "line " << __LINE__ << " . Exiting" << std::endl; exit(-1); } if (nTrulyRanged > 0) { if( nauxcols == 0 ) { // this is the first ranged row assert(colmap_O2G == NULL); assert(colmap_G2O == NULL); assert(colspace_ >= getNumCols()); auxcolspace = nTrulyRanged; colmap_G2O = new int[colspace_ + auxcolspace]; CoinIotaN(colmap_G2O, colspace_ + auxcolspace, 0); colmap_O2G = CoinCopyOfArray(colmap_G2O, colspace_); } else { assert(colmap_O2G != NULL); assert(colmap_G2O != NULL); resizeAuxColSpace( nauxcols + nTrulyRanged); } nauxcols += nTrulyRanged; resizeAuxColIndSpace(); int next = 0; for (int k = 0; k < nToApply; k++) { if (lower[k] > -GRB_INFINITY && upper[k] < GRB_INFINITY) { auxcolind[base_row + next] = base_col + next; colmap_G2O[auxcolind[base_row + next]] = - (base_row + next) - 1; next++; } } } delete[] start; delete[] indices; delete[] values; delete[] lower; delete[] upper; return retVal; } void OsiGrbSolverInterface::applyColCut( const OsiColCut & cc ) { debugMessage("OsiGrbSolverInterface::applyColCut(%p)\n", (void*)&cc); const double * gurobiColLB = getColLower(); const double * gurobiColUB = getColUpper(); const CoinPackedVector & lbs = cc.lbs(); const CoinPackedVector & ubs = cc.ubs(); int i; for( i = 0; i < lbs.getNumElements(); ++i ) if ( lbs.getElements()[i] > gurobiColLB[lbs.getIndices()[i]] ) setColLower( lbs.getIndices()[i], lbs.getElements()[i] ); for( i = 0; i < ubs.getNumElements(); ++i ) if ( ubs.getElements()[i] < gurobiColUB[ubs.getIndices()[i]] ) setColUpper( ubs.getIndices()[i], ubs.getElements()[i] ); } //----------------------------------------------------------------------------- void OsiGrbSolverInterface::applyRowCut( const OsiRowCut & rowCut ) { debugMessage("OsiGrbSolverInterface::applyRowCut(%p)\n", (void*)&rowCut); double rhs = 0.0; char sns; double lb = rowCut.lb(); double ub = rowCut.ub(); bool isrange = false; if( lb <= -getInfinity() && ub >= getInfinity() ) // free constraint { rhs = getInfinity(); sns = GRB_LESS_EQUAL; } else if( lb <= -getInfinity() ) // <= constraint { rhs = ub; sns = GRB_LESS_EQUAL; } else if( ub >= getInfinity() ) // >= constraint { rhs = lb; sns = GRB_GREATER_EQUAL; } else if( ub == lb ) // = constraint { rhs = ub; sns = GRB_EQUAL; } else // range constraint { rhs = 0.0; sns = GRB_EQUAL; isrange = true; } GUROBI_CALL( "applyRowCut", GRBaddconstr( getLpPtr( OsiGrbSolverInterface::KEEPCACHED_COLUMN ), rowCut.row().getNumElements(), const_cast( rowCut.row().getIndices() ), const_cast( rowCut.row().getElements() ), sns, rhs, NULL) ); if( isrange ) { convertToRangedRow(getNumRows()-1, ub, ub - lb); } else if( nauxcols ) resizeAuxColIndSpace(); } //############################################################################# // Private methods (non-static and static) and static data //############################################################################# //------------------------------------------------------------------ // Static data //------------------------------------------------------------------ GRBenv* OsiGrbSolverInterface::globalenv_ = NULL; bool OsiGrbSolverInterface::globalenv_is_ours = true; unsigned int OsiGrbSolverInterface::numInstances_ = 0; //------------------------------------------------------------------- // Get pointer to GRBmodel*. // const methods should use getMutableLpPtr(). // non-const methods should use getLpPtr(). //------------------------------------------------------------------- GRBmodel* OsiGrbSolverInterface::getMutableLpPtr() const { if ( lp_ == NULL ) { assert(getEnvironmentPtr() != NULL); GUROBI_CALL( "getMutableLpPtr", GRBnewmodel(getEnvironmentPtr(), &lp_, "OsiGrb_problem", 0, NULL, NULL, NULL, NULL, NULL) ); assert( lp_ != NULL ); // GUROBI up to version 2.0.1 may return a scaled LP after GRBoptimize when requesting it via GRBgetvars #if (GRB_VERSION_MAJOR < 2) || (GRB_VERSION_MAJOR == 2 && GRB_VERSION_MINOR == 0 && GRB_VERSION_TECHNICAL <= 1) GUROBI_CALL( "getMutableLpPtr", GRBsetintparam(GRBgetenv(lp_), GRB_INT_PAR_SCALEFLAG, 0) ); #endif } return lp_; } //------------------------------------------------------------------- void OsiGrbSolverInterface::gutsOfCopy( const OsiGrbSolverInterface & source ) { // Set Rim and constraints const double* obj = source.getObjCoefficients(); const double* rhs = source.getRightHandSide(); const char* sense = source.getRowSense(); const CoinPackedMatrix * cols = source.getMatrixByCol(); const double* lb = source.getColLower(); const double* ub = source.getColUpper(); loadProblem(*cols,lb,ub,obj,sense,rhs,source.getRowRange()); // Set Objective Sense setObjSense(source.getObjSense()); // Set Objective Constant double dblParam; source.getDblParam(OsiObjOffset,dblParam) ; setDblParam(OsiObjOffset,dblParam) ; // Set MIP information resizeColSpace(source.colspace_); CoinDisjointCopyN( source.coltype_, source.colspace_, coltype_ ); // Set Problem name std::string strParam; source.getStrParam(OsiProbName,strParam) ; setStrParam(OsiProbName,strParam) ; // Set Solution - not supported by Gurobi // setColSolution(source.getColSolution()); // setRowPrice(source.getRowPrice()); } //------------------------------------------------------------------- void OsiGrbSolverInterface::gutsOfConstructor() { } //------------------------------------------------------------------- void OsiGrbSolverInterface::gutsOfDestructor() { debugMessage("OsiGrbSolverInterface::gutsOfDestructor()\n"); if ( lp_ != NULL ) { GUROBI_CALL( "gutsOfDestructor", GRBfreemodel(lp_) ); lp_ = NULL; freeAllMemory(); } assert( lp_==NULL ); assert( obj_==NULL ); assert( collower_==NULL ); assert( colupper_==NULL ); assert( rowsense_==NULL ); assert( rhs_==NULL ); assert( rowrange_==NULL ); assert( rowlower_==NULL ); assert( rowupper_==NULL ); assert( colsol_==NULL ); assert( rowsol_==NULL ); assert( redcost_==NULL ); assert( rowact_==NULL ); assert( matrixByRow_==NULL ); assert( matrixByCol_==NULL ); assert( coltype_==NULL ); assert( colspace_==0 ); assert( auxcolspace == 0); assert( auxcolindspace == 0 ); } //------------------------------------------------------------------- /// free cached vectors void OsiGrbSolverInterface::freeCachedColRim() { freeCacheDouble( obj_ ); freeCacheDouble( collower_ ); freeCacheDouble( colupper_ ); assert( obj_==NULL ); assert( collower_==NULL ); assert( colupper_==NULL ); } void OsiGrbSolverInterface::freeCachedRowRim() { freeCacheChar( rowsense_ ); freeCacheDouble( rhs_ ); freeCacheDouble( rowrange_ ); freeCacheDouble( rowlower_ ); freeCacheDouble( rowupper_ ); assert( rowsense_==NULL ); assert( rhs_==NULL ); assert( rowrange_==NULL ); assert( rowlower_==NULL ); assert( rowupper_==NULL ); } void OsiGrbSolverInterface::freeCachedMatrix() { freeCacheMatrix( matrixByRow_ ); freeCacheMatrix( matrixByCol_ ); assert( matrixByRow_==NULL ); assert( matrixByCol_==NULL ); } void OsiGrbSolverInterface::freeCachedResults() { freeCacheDouble( colsol_ ); freeCacheDouble( rowsol_ ); freeCacheDouble( redcost_ ); freeCacheDouble( rowact_ ); assert( colsol_==NULL ); assert( rowsol_==NULL ); assert( redcost_==NULL ); assert( rowact_==NULL ); } void OsiGrbSolverInterface::freeCachedData( int keepCached ) { if( !(keepCached & OsiGrbSolverInterface::KEEPCACHED_COLUMN) ) freeCachedColRim(); if( !(keepCached & OsiGrbSolverInterface::KEEPCACHED_ROW) ) freeCachedRowRim(); if( !(keepCached & OsiGrbSolverInterface::KEEPCACHED_MATRIX) ) freeCachedMatrix(); if( !(keepCached & OsiGrbSolverInterface::KEEPCACHED_RESULTS) ) freeCachedResults(); } void OsiGrbSolverInterface::freeAllMemory() { freeCachedData(); if( hotStartCStat_ != NULL ) delete[] hotStartCStat_; if( hotStartRStat_ != NULL ) delete[] hotStartRStat_; hotStartCStat_ = NULL; hotStartCStatSize_ = 0; hotStartRStat_ = NULL; hotStartRStatSize_ = 0; freeColSpace(); delete[] auxcolind; auxcolind = NULL; auxcolindspace = 0; } /// converts a normal row into a ranged row by adding an auxiliary variable void OsiGrbSolverInterface::convertToRangedRow(int rowidx, double rhs, double range) { debugMessage("OsiGrbSolverInterface::convertToRangedRow()\n"); assert(rowidx >= 0); assert(rowidx < getNumRows()); assert(rhs > -getInfinity()); assert(rhs < getInfinity()); assert(range > 0.0); assert(range < getInfinity()); if( nauxcols == 0 ) { // row rowidx is the first ranged row assert(colmap_O2G == NULL); assert(colmap_G2O == NULL); assert(colspace_ >= getNumCols()); auxcolspace = 1; colmap_G2O = new int[colspace_ + auxcolspace]; CoinIotaN(colmap_G2O, colspace_ + auxcolspace, 0); colmap_O2G = CoinCopyOfArray(colmap_G2O, colspace_); } else { assert(colmap_O2G != NULL); assert(colmap_G2O != NULL); resizeAuxColSpace( nauxcols + 1); } resizeAuxColIndSpace(); assert(auxcolind[rowidx] == -1); /* not a ranged row yet */ GUROBI_CALL( "convertToRangedRow", GRBupdatemodel(getMutableLpPtr()) ); double minusone = -1.0; GUROBI_CALL( "convertToRangedRow", GRBaddvar(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_PROBLEM ), 1, &rowidx, &minusone, 0.0, rhs-range, rhs, GRB_CONTINUOUS, NULL) ); auxcolind[rowidx] = getNumCols() + nauxcols - 1; colmap_G2O[auxcolind[rowidx]] = -rowidx - 1; ++nauxcols; #ifndef NDEBUG if( nauxcols ) { int nc = getNumCols(); int nr = getNumRows(); for( int i = 0; i < nc + nauxcols; ++i ) { assert(i >= nc || colmap_G2O[colmap_O2G[i]] == i); assert(colmap_G2O[i] < 0 || colmap_O2G[colmap_G2O[i]] == i); assert(colmap_G2O[i] >= 0 || -colmap_G2O[i]-1 < nr); assert(colmap_G2O[i] >= 0 || auxcolind[-colmap_G2O[i]-1] == i); } } #endif } /// converts a ranged row into a normal row by removing its auxiliary variable void OsiGrbSolverInterface::convertToNormalRow(int rowidx, char sense, double rhs) { debugMessage("OsiGrbSolverInterface::convertToNormalRow()\n"); assert(rowidx >= 0); assert(rowidx < getNumRows()); int auxvar = auxcolind[rowidx]; assert(nauxcols); assert(auxvar >= 0); assert(colmap_G2O[auxvar] == -rowidx - 1); GUROBI_CALL( "convertToNormalRow", GRBupdatemodel(getMutableLpPtr()) ); /* row rowidx should be an ordinary equality row with rhs == 0 now */ GUROBI_CALL( "convertToNormalRow", GRBdelvars(getLpPtr( OsiGrbSolverInterface::KEEPCACHED_ROW ), 1, &auxcolind[rowidx]) ); auxcolind[rowidx] = -1; if( nauxcols > 1 ) { int nc = getNumCols(); for(int i = auxvar; i < nc; ++i) { if( colmap_O2G[i] > auxvar ) --colmap_O2G[i]; colmap_G2O[i] = colmap_G2O[i+1]; } for(int i = nc; i < nc + nauxcols; ++i) colmap_G2O[i] = colmap_G2O[i+1]; int nr = getNumRows(); for(int i = 0; i < nr; ++i) if( auxcolind[i] > auxvar ) --auxcolind[i]; --nauxcols; } else { // no ranged rows left delete[] colmap_O2G; delete[] colmap_G2O; delete[] auxcolind; auxcolspace = 0; auxcolindspace = 0; nauxcols = 0; } setRowType(rowidx, sense, rhs, 0.0); #ifndef NDEBUG if( nauxcols ) { int nc = getNumCols(); int nr = getNumRows(); for( int i = 0; i < nc + nauxcols; ++i ) { assert(i >= nc || colmap_G2O[colmap_O2G[i]] == i); assert(colmap_G2O[i] < 0 || colmap_O2G[colmap_G2O[i]] == i); assert(colmap_G2O[i] >= 0 || -colmap_G2O[i]-1 < nr); assert(colmap_G2O[i] >= 0 || auxcolind[-colmap_G2O[i]-1] == i); } } #endif } //############################################################################# // Resets as if default constructor void OsiGrbSolverInterface::reset() { setInitialData(); // clear base class gutsOfDestructor(); } /**********************************************************************/ /* Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none */ int OsiGrbSolverInterface::canDoSimplexInterface() const { return 0; } /**********************************************************************/ bool OsiGrbSolverInterface::basisIsAvailable() const { if (getNumCols() == 0) return true; GUROBI_CALL( "basisIsAvailable", GRBupdatemodel(getMutableLpPtr()) ); int status; GUROBI_CALL( "basisIsAvailable", GRBgetintattr(getMutableLpPtr(), GRB_INT_ATTR_STATUS, &status) ); if (status == GRB_LOADED || status == GRB_INFEASIBLE || status == GRB_INF_OR_UNBD || status == GRB_UNBOUNDED) return false; int dum; return GRBgetintattrelement(getMutableLpPtr(), GRB_INT_ATTR_VBASIS, 0, &dum) == 0; } /* Osi return codes: 0: free 1: basic 2: upper 3: lower */ void OsiGrbSolverInterface::getBasisStatus(int* cstat, int* rstat) const { int numcols = getNumCols(); int numrows = getNumRows(); GUROBI_CALL( "getBasisStatus", GRBupdatemodel(getMutableLpPtr()) ); if( nauxcols ) GUROBI_CALL( "getBasisStatus", GRBgetintattrlist(getMutableLpPtr(), GRB_INT_ATTR_VBASIS, numcols, colmap_O2G, cstat) ); else GUROBI_CALL( "getBasisStatus", GRBgetintattrarray(getMutableLpPtr(), GRB_INT_ATTR_VBASIS, 0, numcols, cstat) ); for (int i = 0; i < numcols; ++i) switch (cstat[i]) { case GRB_BASIC: cstat[i] = 1; break; case GRB_NONBASIC_LOWER: cstat[i] = 3; break; case GRB_NONBASIC_UPPER: cstat[i] = 2; break; case GRB_SUPERBASIC: cstat[i] = 0; break; } GUROBI_CALL( "getBasisStatus", GRBgetintattrarray(getMutableLpPtr(), GRB_INT_ATTR_CBASIS, 0, numrows, rstat) ); char sense; for (int i = 0; i < numrows; ++i) { if( nauxcols && auxcolind[i] >= 0 ) { /* if the row is a ranged row, then we take the basis status from the corresponding auxiliary column is this correct??? */ int auxcolstat; GUROBI_CALL( "getBasisStatus", GRBgetintattrelement(getMutableLpPtr(), GRB_INT_ATTR_VBASIS, auxcolind[i], &auxcolstat) ); switch( auxcolstat ) { case GRB_BASIC: rstat[i] = 1; break; case GRB_NONBASIC_LOWER: rstat[i] = 3; break; case GRB_NONBASIC_UPPER: rstat[i] = 2; break; case GRB_SUPERBASIC: rstat[i] = 0; break; } } else { switch (rstat[i]) { case GRB_SUPERBASIC: rstat[i] = 0; break; case GRB_BASIC: rstat[i] = 1; break; case GRB_NONBASIC_LOWER: case GRB_NONBASIC_UPPER: GUROBI_CALL( "getBasisStatus", GRBgetcharattrelement(getMutableLpPtr(), GRB_CHAR_ATTR_SENSE, i, &sense) ); rstat[i] = (sense == '>' ? 2 : 3); break; } } } } CoinMP-1.8.3/Osi/src/OsiMsk/0000755000175000017500000000000012600453455014046 5ustar renereneCoinMP-1.8.3/Osi/src/OsiMsk/osi-mosek.pc.in0000644000175000017500000000046511510106235016700 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiMosek Description: COIN-OR Open Solver Interface for Mosek URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiMsk @MSKLIB@ Cflags: -I${includedir} -I@MSKINCDIR@ Requires: osi CoinMP-1.8.3/Osi/src/OsiMsk/Makefile.in0000644000175000017500000005466312506051753016131 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/OsiMsk DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Osi/config.h \ $(top_builddir)/src/Osi/config_osi.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libOsiMsk_la_LIBADD = am_libOsiMsk_la_OBJECTS = OsiMskSolverInterface.lo libOsiMsk_la_OBJECTS = $(am_libOsiMsk_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsiMsk_la_SOURCES) DIST_SOURCES = $(libOsiMsk_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiMsk # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiMsk.la # List all source files for this library, including headers libOsiMsk_la_SOURCES = \ OsiMskSolverInterface.cpp OsiMskSolverInterface.hpp # This is for libtool (on Windows) libOsiMsk_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../Osi` \ -I`$(CYGPATH_W) $(MSKINCDIR)` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiMskSolverInterface.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/OsiMsk/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/OsiMsk/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsiMsk.la: $(libOsiMsk_la_OBJECTS) $(libOsiMsk_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsiMsk_la_LDFLAGS) $(libOsiMsk_la_OBJECTS) $(libOsiMsk_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiMskSolverInterface.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool 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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # 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: CoinMP-1.8.3/Osi/src/OsiMsk/Makefile.am0000644000175000017500000000314011621722556016103 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1800 2011-08-14 10:37:34Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiMsk # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiMsk.la # List all source files for this library, including headers libOsiMsk_la_SOURCES = \ OsiMskSolverInterface.cpp OsiMskSolverInterface.hpp # This is for libtool (on Windows) libOsiMsk_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../Osi` \ -I`$(CYGPATH_W) $(MSKINCDIR)` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiMskSolverInterface.hpp CoinMP-1.8.3/Osi/src/OsiMsk/OsiMskSolverInterface.cpp0000644000175000017500000044507712276110647021016 0ustar renerene/* Osi interface for Mosek ver. 7.0 Lower versions are not supported ----------------------------------------------------------------------------- name: OSI Interface for MOSEK ----------------------------------------------------------------------------- This code is licensed under the terms of the Eclipse Public License (EPL). Originally developed by Bo Jensen from MOSEK ApS. No longer a maintainer. */ #include #include #include #include #include "OsiConfig.h" #include "CoinPragma.hpp" #include "CoinError.hpp" #include "CoinFinite.hpp" #include "OsiMskSolverInterface.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" #include "mosek.h" #define MSK_OSI_DEBUG_LEVEL 0 #ifndef NDEBUG #define MSK_OSI_ASSERT_LEVEL 0 #else #define MSK_OSI_ASSERT_LEVEL 4 #endif #define MSK_DO_MOSEK_LOG 0 #define debugMessage printf //Choose algorithm to be default in initial solve #define INITIAL_SOLVE MSK_OPTIMIZER_FREE //Choose algorithm to be default in resolve #define RESOLVE_SOLVE MSK_OPTIMIZER_FREE_SIMPLEX // Unset this flag to disable the warnings from interface. #define MSK_WARNING_ON #undef getc //############################################################################# // A couple of helper functions //############################################################################# // Free memory pointet to by a double pointer inline void freeCacheDouble( double*& ptr ) { if( ptr != NULL ) { delete [] ptr; ptr = NULL; } } // Free memory pointet to by a char pointer inline void freeCacheChar( char*& ptr ) { if( ptr != NULL ) { delete [] ptr; ptr = NULL; } } // Free memory pointet to by a CoinPackedMatrix pointer inline void freeCacheMatrix( CoinPackedMatrix*& ptr ) { if( ptr != NULL ) { delete ptr; ptr = NULL; } } // Function used to connect MOSEK to stream #if MSK_VERSION_MAJOR >= 7 static void MSKAPI printlog(void *ptr, const char* s) #else static void MSKAPI printlog(void *ptr, char* s) #endif { printf("%s",s); } static void MSKAPI OsiMskStreamFuncLog(MSKuserhandle_t handle, MSKCONST char* str) { if (handle) { if (((CoinMessageHandler*)handle)->logLevel() >= 1) ((CoinMessageHandler*)handle)->message(0, "MSK", str, ' ') << CoinMessageEol; } else { printf(str); printf("\n"); } } static void MSKAPI OsiMskStreamFuncWarning(MSKuserhandle_t handle, MSKCONST char* str) { if (handle) { if (((CoinMessageHandler*)handle)->logLevel() >= 0) ((CoinMessageHandler*)handle)->message(0, "MSK", str, ' ') << CoinMessageEol; } else { printf(str); printf("\n"); } } static void MSKAPI OsiMskStreamFuncError(MSKuserhandle_t handle, MSKCONST char* str) { if (handle) { ((CoinMessageHandler*)handle)->message(0, "MSK", str, ' ') << CoinMessageEol; } else { fprintf(stderr, str); fprintf(stderr, "\n"); } } // Prints a error message and throws a exception static inline void checkMSKerror( int err, std::string mskfuncname, std::string osimethod ) { if( err != MSK_RES_OK ) { char s[100]; sprintf( s, "%s returned error %d", mskfuncname.c_str(), err ); std::cout << "ERROR: " << s << " (" << osimethod << " in OsiMskSolverInterface)" << std::endl; throw CoinError( s, osimethod.c_str(), "OsiMskSolverInterface" ); } } // Prints a error message and throws a exception static inline void MSKassert(int assertlevel, int test, std::string assertname, std::string osimethod ) { if( assertlevel > MSK_OSI_ASSERT_LEVEL && !test ) { char s[100]; sprintf( s, "%s", assertname.c_str()); std::cout << "Assert: " << s << " (" << osimethod << " in OsiMskSolverInterface)" << std::endl; throw CoinError( s, osimethod.c_str(), "OsiMskSolverInterface" ); } } // Prints a warning message, can be shut off by undefining MSK_WARNING_ON static inline void OsiMSK_warning(std::string osimethod, std::string warning) { std::cout << "OsiMsk_warning: "<= 0 ) { rlb = rowrhs - rowrng; rub = rowrhs; } else { rlb = rowrhs; rub = rowrhs + rowrng; } rtag = MSK_BK_RA; break; case 'N': rlb = -MSK_INFINITY; rub = MSK_INFINITY; rtag = MSK_BK_FR; break; default: MSKassert(3,1,"Unknown rowsen","MskConvertSenseToBound"); } } // Converts a set of bounds to MSK boundkeys static inline void MskConvertColBoundToTag(const double collb, const double colub, double &clb, double &cub, int &ctag) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin MskConvertColBoundToTag()\n"); #endif if(collb > -MSK_INFINITY && colub < MSK_INFINITY) { ctag = MSK_BK_RA; clb = collb; cub = colub; } else if(collb <= - MSK_INFINITY && colub < MSK_INFINITY) { ctag = MSK_BK_UP; clb = -MSK_INFINITY; cub = colub; } else if(collb > - MSK_INFINITY && colub >= MSK_INFINITY) { ctag = MSK_BK_LO; clb = collb; cub = MSK_INFINITY; } else if(collb <= -MSK_INFINITY && colub >= MSK_INFINITY) { ctag = MSK_BK_FR; clb = -MSK_INFINITY; cub = MSK_INFINITY; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End MskConvertColBoundToTag()\n"); #endif } // Returns true if "solution" is defined in MOSEK, where solution can be basic, interior or // integer resp. (MSK_SOL_BAS), (MSK_SOL_ITR) or (MSK_SOL_ITG). bool OsiMskSolverInterface::definedSolution(int solution) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::definedSolution() %p\n",(void*)this); #endif int err, res; err = MSK_solutiondef(getMutableLpPtr(), (MSKsoltypee) solution, &res); checkMSKerror(err,"MSK_solutiondef","definedSolution"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::definedSolution()\n"); #endif return ( res != MSK_RES_OK); } // Returns the flag for solver currently switched on in MOSEK resp. (MSK_OPTIMIZER_FREE), // (MSK_OPTIMIZER_INTPNT), (MSK_OPTIMIZER_PRIMAL_SIMPLEX), (MSK_OPTIMIZER_MIXED_INT), or // (MSK_OPTIMIZER_MIXED_INT_CONIC). // MOSEK also has Conic and nonconvex solvers, but these are for obvious reasons not // an option in the Osi interface. int OsiMskSolverInterface::solverUsed() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::solverUsed()\n"); #endif #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::solverUsed()\n"); #endif return MSKsolverused_; } // Switch the MOSEK solver to LP uses default solver specified by 'InitialSolver' void OsiMskSolverInterface::switchToLP( void ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::switchToLP()\n"); #endif int err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_MIO_MODE, MSK_MIO_MODE_IGNORED); checkMSKerror(err,"MSK_putintparam","switchToLp"); probtypemip_ = false; #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::switchToLP()\n"); #endif } // Switch the MOSEK solver to MIP. void OsiMskSolverInterface::switchToMIP( void ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::switchToMIP()\n"); #endif int err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_MIO_MODE, MSK_MIO_MODE_SATISFIED); checkMSKerror(err,"MSK_putintparam","switchToMIP"); #if MSK_VERSION_MAJOR >= 7 err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, MSK_OPTIMIZER_MIXED_INT_CONIC); #else err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, MSK_OPTIMIZER_MIXED_INT); #endif checkMSKerror(err,"MSK_putintparam","switchToMIP"); probtypemip_ = true; #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::switchToMIP()\n"); #endif } // Resize the coltype array. void OsiMskSolverInterface::resizeColType( int minsize ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::resizeColType()\n"); #endif if( minsize > coltypesize_ ) { int newcoltypesize = 2*coltypesize_; if( minsize > newcoltypesize ) newcoltypesize = minsize; char *newcoltype = new char[newcoltypesize]; if( coltype_ != NULL ) { CoinDisjointCopyN( coltype_, coltypesize_, newcoltype ); delete[] coltype_; } coltype_ = newcoltype; coltypesize_ = newcoltypesize; } MSKassert(3,minsize == 0 || coltype_ != NULL,"Unknown rowsen","MskConvertSenseToBound"); MSKassert(3,coltypesize_ >= minsize,"coltypesize_ >= minsize","MskConvertSenseToBound"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::resizeColType()\n"); #endif } // Free coltype array void OsiMskSolverInterface::freeColType() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::freeColType()\n"); #endif if( coltypesize_ > 0 ) { delete[] coltype_; coltype_ = NULL; coltypesize_ = 0; } MSKassert(3,coltype_ == NULL,"coltype_ == NULL","freeColType"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::freeColType()\n"); #endif } //############################################################################# // Solve methods //############################################################################# //----------------------------------------------------------------------------- // Free cached results and optimize the LP problem in task void OsiMskSolverInterface::initialSolve() { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::initialSolve() %p\n", (void*)this); #endif if( definedSolution( MSK_SOL_BAS ) == true ) { resolve(); } else { int err,solver; err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_SIM_HOTSTART, MSK_SIM_HOTSTART_STATUS_KEYS); checkMSKerror(err,"MSK_putintparam","initialsolve"); err = MSK_getintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, &solver); checkMSKerror(err,"MSK_getintparam","initialsolve"); switchToLP(); err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, INITIAL_SOLVE); checkMSKerror(err,"MSK_putintparam","initialSolve"); err = MSK_getintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, &MSKsolverused_); checkMSKerror(err,"MSK_getintparam","initialsolve"); #if MSK_DO_MOSEK_LOG > 0 err = MSK_putintparam( getMutableLpPtr(),MSK_IPAR_LOG_SIM,MSK_DO_MOSEK_LOG); checkMSKerror(err,"MSK_putintparam","initialsolve"); #endif Mskerr = MSK_optimize(getLpPtr( OsiMskSolverInterface::FREECACHED_RESULTS )); #if MSK_DO_MOSEK_LOG > 0 err = MSK_solutionsummary( getMutableLpPtr(),MSK_STREAM_LOG); checkMSKerror(err,"MSK_solutionsummary","initialsolve"); #endif err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, solver); checkMSKerror(err,"MSK_putintparam","initialsolve"); } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::initialSolve()\n"); #endif } //----------------------------------------------------------------------------- // Resolves an LP problem. void OsiMskSolverInterface::resolve() { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::resolve %p\n", (void*)this); #endif if( definedSolution( MSK_SOL_BAS ) == true ) { int err,solver; err = MSK_getintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, &solver); checkMSKerror(err,"MSK_getintparam","resolve"); switchToLP(); err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_SIM_HOTSTART, MSK_SIM_HOTSTART_STATUS_KEYS); checkMSKerror(err,"MSK_putintparam","resolve"); err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, RESOLVE_SOLVE); checkMSKerror(err,"MSK_putintparam","resolve"); #if 0 err = MSK_putintparam( getMutableLpPtr(), MSK_IPAR_SIM_MAX_ITERATIONS, 20000000 ); #endif err = MSK_getintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, &MSKsolverused_); checkMSKerror(err,"MSK_getintparam","resolve"); #if MSK_DO_MOSEK_LOG > 0 err = MSK_putintparam( getMutableLpPtr(),MSK_IPAR_LOG,MSK_DO_MOSEK_LOG); checkMSKerror(err,"MSK_putintparam","resolve"); err = MSK_putintparam( getMutableLpPtr(),MSK_IPAR_LOG_SIM,MSK_DO_MOSEK_LOG); checkMSKerror(err,"MSK_putintparam","resolve"); #endif Mskerr = MSK_optimize(getLpPtr( OsiMskSolverInterface::FREECACHED_RESULTS )); #if MSK_DO_MOSEK_LOG > 0 err = MSK_solutionsummary( getMutableLpPtr(),MSK_STREAM_LOG); printf("Mskerr : %d\n",Mskerr); #endif err = MSK_putintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, solver); checkMSKerror(err,"MSK_putintparam","resolve"); } else { initialSolve(); } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::resolve... press any key to continue\n"); getchar(); #endif } //----------------------------------------------------------------------------- // Resolves an MIP problem with MOSEK MIP solver. void OsiMskSolverInterface::branchAndBound() { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::branchAndBound()\n"); #endif switchToMIP(); int err = MSK_getintparam(getMutableLpPtr(), MSK_IPAR_OPTIMIZER, &MSKsolverused_); checkMSKerror(err,"MSK_getintparam","branchAndBound"); Mskerr = MSK_optimize(getLpPtr( OsiMskSolverInterface::FREECACHED_RESULTS )); #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::branchAndBound()\n"); #endif } //############################################################################# // Parameter related methods //############################################################################# //----------------------------------------------------------------------------- // Sets a int parameter in MOSEK bool OsiMskSolverInterface::setIntParam(OsiIntParam key, int value) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setIntParam(%d, %d)\n", key, value); #endif bool retval = false; switch (key) { case OsiMaxNumIteration: retval = (MSK_putintparam(getMutableLpPtr(), MSK_IPAR_SIM_MAX_ITERATIONS, value ) == MSK_RES_OK); break; case OsiMaxNumIterationHotStart: if (value < 0) { retval = false; } else { hotStartMaxIteration_ = value; retval = true; } break; case OsiNameDiscipline: retval = false; break; case OsiLastIntParam: retval = false; break; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setIntParam(%d, %d)\n", key, value); #endif return retval; } //----------------------------------------------------------------------------- // Sets a double parameter in MOSEK. bool OsiMskSolverInterface::setDblParam(OsiDblParam key, double value) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setDblParam(%d, %g)\n", key, value); #endif bool retval = false; switch (key) { case OsiDualObjectiveLimit: if( getObjSense() == +1 ) // Minimize retval = ( MSK_putdouparam( getMutableLpPtr(), MSK_DPAR_UPPER_OBJ_CUT, value ) == MSK_RES_OK ); // min else retval = ( MSK_putdouparam( getMutableLpPtr(), MSK_DPAR_LOWER_OBJ_CUT, value ) == MSK_RES_OK ); // max break; case OsiPrimalObjectiveLimit: if( getObjSense() == +1 ) // Minimize retval = ( MSK_putdouparam( getMutableLpPtr(), MSK_DPAR_LOWER_OBJ_CUT, value ) == MSK_RES_OK ); // min else retval = ( MSK_putdouparam( getMutableLpPtr(), MSK_DPAR_UPPER_OBJ_CUT, value ) == MSK_RES_OK ); // max break; case OsiDualTolerance: retval = ( MSK_putdouparam( getMutableLpPtr(), MSK_DPAR_BASIS_TOL_S, value ) == MSK_RES_OK ); break; case OsiPrimalTolerance: retval = ( MSK_putdouparam( getMutableLpPtr(), MSK_DPAR_BASIS_TOL_X, value ) == MSK_RES_OK ); break; case OsiObjOffset: ObjOffset_ = value; retval = true; break; case OsiLastDblParam: retval = false; break; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setDblParam(%d, %g)\n", key, value); #endif return retval; } //----------------------------------------------------------------------------- // Sets a string parameter in MOSEK. bool OsiMskSolverInterface::setStrParam(OsiStrParam key, const std::string & value) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setStrParam(%d, %s)\n", key, value.c_str()); #endif bool retval=false; switch (key) { case OsiProbName: OsiSolverInterface::setStrParam(key,value); return retval = true; case OsiSolverName: return false; case OsiLastStrParam: return false; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setStrParam(%d, %s)\n", key, value.c_str()); #endif return retval; } //----------------------------------------------------------------------------- // Gets a int parameter in MOSEK. bool OsiMskSolverInterface::getIntParam(OsiIntParam key, int& value) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getIntParam(%d)\n", key); #endif bool retval = false; switch (key) { case OsiMaxNumIteration: retval = (MSK_getintparam(getMutableLpPtr(), MSK_IPAR_SIM_MAX_ITERATIONS, &value ) == MSK_RES_OK); break; case OsiMaxNumIterationHotStart: value = hotStartMaxIteration_; retval = true; break; case OsiNameDiscipline: value = 0; retval = false; break; case OsiLastIntParam: retval = false; break; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getIntParam(%d)\n", key); #endif return retval; } //----------------------------------------------------------------------------- // Get a double parameter in MOSEK. bool OsiMskSolverInterface::getDblParam(OsiDblParam key, double& value) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getDblParam(%d)\n", key); #endif bool retval = false; switch (key) { case OsiDualObjectiveLimit: if( getObjSense() == +1 ) retval = ( MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_UPPER_OBJ_CUT, &value ) == MSK_RES_OK ); // max else retval = ( MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_LOWER_OBJ_CUT, &value ) == MSK_RES_OK ); // min break; case OsiPrimalObjectiveLimit: if( getObjSense() == +1 ) retval = ( MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_LOWER_OBJ_CUT, &value ) == MSK_RES_OK ); // min else retval = ( MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_UPPER_OBJ_CUT, &value ) == MSK_RES_OK ); // max break; case OsiDualTolerance: retval = ( MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_BASIS_TOL_S, &value ) == MSK_RES_OK ); break; case OsiPrimalTolerance: retval = ( MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_BASIS_TOL_X, &value ) == MSK_RES_OK ); break; case OsiObjOffset: value = ObjOffset_; retval = true; break; case OsiLastDblParam: retval = false; break; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getDblParam(%d)\n", key); #endif return retval; } //----------------------------------------------------------------------------- // Gets a string parameter from MOSEK bool OsiMskSolverInterface::getStrParam(OsiStrParam key, std::string & value) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getStrParam(%d)\n", key); #endif switch (key) { case OsiProbName: OsiSolverInterface::getStrParam(key, value); break; case OsiSolverName: value = "MOSEK"; break; case OsiLastStrParam: return false; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getStrParam(%d)\n", key); #endif return true; } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# //----------------------------------------------------------------------------- // Returns true if solver abandoned in last call to solver. // Mosek does not use this functionality bool OsiMskSolverInterface::isAbandoned() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isAbandoned()\n"); debugMessage("isAbandoned() %d\n",(Mskerr != MSK_RES_OK)); debugMessage("End OsiMskSolverInterface::isAbandoned()\n"); #endif return (Mskerr != MSK_RES_OK); } //----------------------------------------------------------------------------- // Returns true if "solution" available is proved to be optimal, where "solution" in LP // could be both interior and basic, checks for both. bool OsiMskSolverInterface::isProvenOptimal() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isProvenOptimal()\n"); #endif int err; MSKsolstae status; MSKsoltypee solution; if( probtypemip_ == false) { if( definedSolution( MSK_SOL_BAS ) == true ) solution = MSK_SOL_BAS; else { if( definedSolution( MSK_SOL_ITR ) == true ) solution = MSK_SOL_ITR; else return false; } } else { if( definedSolution( MSK_SOL_ITG ) == true ) solution = MSK_SOL_ITG; else return false; } err = MSK_getsolution(getMutableLpPtr(), solution, NULL, &status, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror(err,"MSK_getsolution","isProvenOptimal"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Solution type , %d status %d \n ",(status == MSK_SOL_STA_OPTIMAL), status) ; debugMessage("End OsiMskSolverInterface::isProvenOptimal()\n"); #endif return ( status == MSK_SOL_STA_OPTIMAL || status == MSK_SOL_STA_INTEGER_OPTIMAL); } //----------------------------------------------------------------------------- // Returns true if a certificate of primal inf. exits bool OsiMskSolverInterface::isProvenPrimalInfeasible() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isProvenPrimalInfeasible()\n"); #endif int err; MSKsolstae status; MSKsoltypee solution; if( probtypemip_ == false) { if( definedSolution( MSK_SOL_BAS ) == true ) solution = MSK_SOL_BAS; else { if( definedSolution( MSK_SOL_ITR ) == true ) solution = MSK_SOL_ITR; else return false; } } else { if( definedSolution( MSK_SOL_ITG ) == true) solution = MSK_SOL_ITG; else return false; } err = MSK_getsolution(getMutableLpPtr(), solution, NULL, &status, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror(err,"MSK_getsolution","isProvenPrimalInfeasible"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("isProvenPrimalInfeasible %d \n",(status == MSK_SOL_STA_PRIM_INFEAS_CER)); debugMessage("End OsiMskSolverInterface::isProvenPrimalInfeasible()\n"); #endif return ( status == MSK_SOL_STA_PRIM_INFEAS_CER ); } //----------------------------------------------------------------------------- // Should return true if a certificate of dual inf. exits // But COIN does not support this feature thus we return false bool OsiMskSolverInterface::isProvenDualInfeasible() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isProvenDualInfeasible()\n"); #endif int err; MSKsolstae status; MSKsoltypee solution; if( probtypemip_ == false ) { if( definedSolution( MSK_SOL_BAS ) == true ) solution = MSK_SOL_BAS; else { if( definedSolution( MSK_SOL_ITR ) == true ) solution = MSK_SOL_ITR; else return false; } } else { if( definedSolution( MSK_SOL_ITG ) == true) solution = MSK_SOL_ITG; else return false; } err = MSK_getsolution(getMutableLpPtr(), solution, NULL, &status, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); checkMSKerror(err,"MSK_getsolution","isProvenDualInfeasible"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("isProvenDualInfeasible %d \n",(status == MSK_SOL_STA_DUAL_INFEAS_CER)); debugMessage("End OsiMskSolverInterface::isProvenDualInfeasible()\n"); #endif return ( status == MSK_SOL_STA_DUAL_INFEAS_CER ); } //----------------------------------------------------------------------------- // Returns true if primal objective limit is reached. Checks the objective sense // first. bool OsiMskSolverInterface::isPrimalObjectiveLimitReached() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isPrimalObjectiveLimitReached()\n"); #endif if( Mskerr == MSK_RES_TRM_OBJECTIVE_RANGE ) { int err; double obj = getObjValue(),value=MSK_INFINITY; if( getObjSense() == +1 ) { err = MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_LOWER_OBJ_CUT, &value); checkMSKerror(err,"MSK_getdouparam","isPrimalObjectiveLimitReached"); } else { err = MSK_getdouparam(getMutableLpPtr(), MSK_DPAR_UPPER_OBJ_CUT, &value ); checkMSKerror(err,"MSK_getdouparam","isPrimalObjectiveLimitReached"); obj = -obj; value = -value; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("primal objective value %-16.10e , lowerbound %-16.10e , reached %d \n",obj,value,(value <= obj)); debugMessage("End OsiMskSolverInterface::isPrimalObjectiveLimitReached()\n"); #endif return ( !( value == MSK_INFINITY || value == -MSK_INFINITY ) && value > obj ); } else { if( Mskerr == MSK_RES_OK ) { if( definedSolution( MSK_SOL_BAS ) == true ) { int err; double obj = getObjValue(),value=MSK_INFINITY; if( getObjSense() == +1 ) { err = MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_LOWER_OBJ_CUT, &value); checkMSKerror(err,"MSK_getdouparam","isPrimalObjectiveLimitReached"); return (obj < value); } else { err = MSK_getdouparam(getMutableLpPtr(), MSK_DPAR_UPPER_OBJ_CUT, &value ); checkMSKerror(err,"MSK_getdouparam","isPrimalObjectiveLimitReached"); obj = -obj; value = -value; return (obj < value); } } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::isPrimalObjectiveLimitReached()\n"); #endif return false; } } //----------------------------------------------------------------------------- // Returns true if dual objective limit is reached. Checks the objective sense // first. bool OsiMskSolverInterface::isDualObjectiveLimitReached() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isDualObjectiveLimitReached()\n"); #endif if( Mskerr == MSK_RES_TRM_OBJECTIVE_RANGE ) { int err; double obj = getObjValue(),value=MSK_INFINITY; if( getObjSense() == +1 ) { err = MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_UPPER_OBJ_CUT, &value); checkMSKerror(err,"MSK_getdouparam","isDualObjectiveLimitReached"); } else { err = MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_LOWER_OBJ_CUT, &value ); checkMSKerror(err,"MSK_getdouparam","isDualObjectiveLimitReached"); obj = -obj; value = -value; } checkMSKerror( err, "MSK_getdouparam", "isPrimalObjectiveLimitReached" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("dual objective value %f , lowerbound %f , reached %i \n",obj,value,(value <= obj)); debugMessage("End OsiMskSolverInterface::isDualObjectiveLimitReached()\n"); #endif return ( !( value == MSK_INFINITY || value == -MSK_INFINITY ) && value <= obj ); } else { if( Mskerr == MSK_RES_OK ) { if( definedSolution( MSK_SOL_BAS ) == true ) { int err; double obj = getObjValue(),value=MSK_INFINITY; if( getObjSense() == +1 ) { err = MSK_getdouparam( getMutableLpPtr(), MSK_DPAR_UPPER_OBJ_CUT, &value); checkMSKerror(err,"MSK_getdouparam","isDualObjectiveLimitReached"); return (obj > value); } else { err = MSK_getdouparam(getMutableLpPtr(), MSK_DPAR_LOWER_OBJ_CUT, &value ); checkMSKerror(err,"MSK_getdouparam","isDualObjectiveLimitReached"); obj = -obj; value = -value; return (obj > value); } } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::isDualObjectiveLimitReached()\n"); #endif return false; } } //----------------------------------------------------------------------------- // Returns true if iteration number used in last call to optimize eq. max number for // the solver used. bool OsiMskSolverInterface::isIterationLimitReached() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isIterationLimitReached()\n"); #endif #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("iteration limit reached %d \n",Mskerr); debugMessage("End OsiMskSolverInterface::isIterationLimitReached()\n"); #endif return Mskerr == MSK_RES_TRM_MAX_ITERATIONS; } //----------------------------------------------------------------------------- // Returns true if a license problem occured in last call to optimize. bool OsiMskSolverInterface::isLicenseError() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isLicenseError()\n"); #endif #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("license error %d \n",Mskerr); debugMessage("End OsiMskSolverInterface::isLicenseError()\n"); #endif return Mskerr >= MSK_RES_ERR_LICENSE && Mskerr <= MSK_RES_ERR_LICENSE_NO_SERVER_SUPPORT; } //############################################################################# // WarmStart related methods //############################################################################# // Get an empty warm start object CoinWarmStart* OsiMskSolverInterface::getEmptyWarmStart () const { return (dynamic_cast(new CoinWarmStartBasis())) ; } //----------------------------------------------------------------------------- // Get warm start, returns NULL pointer if not available CoinWarmStart* OsiMskSolverInterface::getWarmStart() const { CoinWarmStartBasis* ws = NULL; int numbas = 0,numcols = getNumCols(),numrows = getNumRows(),*skx,*skc, err, i,*bkc,*bkx; double *blc,*buc,*blx,*bux,*xc,*xx; bool skip = false; #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::getWarmStart numcols %d numrows %d %p\n",numcols,numrows, (void*)this); #endif skx = new int[numcols]; skc = new int[numrows]; bkc = new int[numrows]; blc = new double[numrows]; buc = new double[numrows]; xc = new double[numrows]; bkx = new int[numcols]; blx = new double[numcols]; bux = new double[numcols]; xx = new double[numcols]; err = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_CON, 0, numrows, (MSKboundkeye*)bkc, (MSKrealt*)blc, (MSKrealt*)buc); checkMSKerror( err, "MSK_getsolution", "getWarmStart" ); err = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_VAR, 0, numcols, (MSKboundkeye*)bkx, (MSKrealt*)blx, (MSKrealt*)bux); checkMSKerror( err, "MSK_getsolution", "getWarmStart" ); MSKassert(3,!probtypemip_,"!probtypemip_","getWarmStart"); if( definedSolution( MSK_SOL_BAS ) == true ) { err = MSK_getsolution(getMutableLpPtr(), MSK_SOL_BAS, NULL, NULL, (MSKstakeye*)skc, (MSKstakeye*)skx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror( err, "MSK_getsolution", "getWarmStart" ); } else { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("No basic solution in OsiMskSolverInterface::getWarmStart()\n"); #endif /* No basic solution stored choose slack basis */ /* Otherwise the unittest can not be passed */ ws = new CoinWarmStartBasis; ws->setSize( numcols, numrows ); for( i = 0; i < numrows; ++i ) ws->setArtifStatus( i, CoinWarmStartBasis::basic ); numbas = numrows; for( i = 0; i < numcols; ++i ) { switch(bkx[i]) { case MSK_BK_RA: case MSK_BK_LO: ws->setStructStatus( i, CoinWarmStartBasis::atLowerBound ); break; case MSK_BK_FX: case MSK_BK_UP: ws->setStructStatus( i, CoinWarmStartBasis::atUpperBound ); break; case MSK_BK_FR: ws->setStructStatus( i, CoinWarmStartBasis::isFree ); break; default: checkMSKerror( 1, "Wrong bound key", "getWarmStart" ); } } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::getWarmStart()\n"); #endif delete[] skc; delete[] skx; delete[] bkc; delete[] blc; delete[] buc; delete[] xc; delete[] bkx; delete[] blx; delete[] bux; delete[] xx; /* Leave function */ return ws; } if( err == MSK_RES_OK ) { /* Status keys should be defined */ ws = new CoinWarmStartBasis; MSKassert(3,ws != NULL,"1) ws != NULL","getWarmStart"); ws->setSize( numcols, numrows ); for( i = 0; i < numrows && ws != NULL; ++i ) { switch( skc[i] ) { case MSK_SK_UNK: case MSK_SK_BAS: /* Warning : Slacks in Osi and Mosek er negated */ ws->setArtifStatus( i, CoinWarmStartBasis::basic ); ++numbas; break; case MSK_SK_LOW: /* Warning : Slacks in Osi and Mosek er negated */ ws->setArtifStatus( i, CoinWarmStartBasis::atUpperBound ); break; case MSK_SK_FIX: case MSK_SK_UPR: /* Warning : Slacks in Osi and Mosek er negated */ ws->setArtifStatus( i, CoinWarmStartBasis::atLowerBound ); break; case MSK_SK_SUPBAS: ws->setArtifStatus( i, CoinWarmStartBasis::isFree ); break; default: // unknown row status delete ws; ws = NULL; skip = true; checkMSKerror( 1, "Wrong slack status key", "getWarmStart" ); break; } } if( skip == false ) { for( i = 0; i < numcols && ws != NULL; ++i ) { switch( skx[i] ) { case MSK_SK_UNK: case MSK_SK_BAS: ++numbas; ws->setStructStatus( i, CoinWarmStartBasis::basic ); break; case MSK_SK_FIX: case MSK_SK_LOW: ws->setStructStatus( i, CoinWarmStartBasis::atLowerBound ); break; case MSK_SK_UPR: ws->setStructStatus( i, CoinWarmStartBasis::atUpperBound ); break; case MSK_SK_SUPBAS: ws->setStructStatus( i, CoinWarmStartBasis::isFree ); break; default: // unknown column status delete ws; ws = NULL; checkMSKerror( 1, "Wrong variable status key", "getWarmStart" ); break; } } } } delete[] skx; delete[] skc; delete[] bkc; delete[] blc; delete[] buc; delete[] xc; delete[] bkx; delete[] blx; delete[] bux; delete[] xx; MSKassert(3,ws!=NULL,"2) ws!=NULL","getWarmStart"); #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::getWarmStart() (%p) numcols %d numrows %d numbas %d\n",(void*)(ws),numcols,numrows,numbas); #endif return ws; } //----------------------------------------------------------------------------- // Set warm start bool OsiMskSolverInterface::setWarmStart(const CoinWarmStart* warmstart) { const CoinWarmStartBasis* ws = dynamic_cast(warmstart); int numcols, numrows, i, restat,numbas=0; int *skx, *skc, *bkc, *bkx; bool retval = false, skip = false; if( !ws ) return false; numcols = ws->getNumStructural(); numrows = ws->getNumArtificial(); #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::setWarmStart(%p) this = %p numcols %d numrows %d\n", (void *)warmstart,(void*)this,numcols,numrows); #endif if( numcols != getNumCols() || numrows != getNumRows() ) return false; switchToLP(); skx = new int[numcols]; skc = new int[numrows]; bkc = new int[numrows]; restat = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_CON, 0, numrows, (MSKboundkeye*) (bkc), NULL, NULL); checkMSKerror( restat, "MSK_getboundslice", "setWarmStart" ); for( i = 0; i < numrows; ++i ) { switch( ws->getArtifStatus( i ) ) { case CoinWarmStartBasis::basic: skc[i] = MSK_SK_BAS; ++numbas; break; /* Warning : Slacks in Osi and Mosek er negated */ case CoinWarmStartBasis::atUpperBound: switch(bkc[i]) { case MSK_BK_LO: case MSK_BK_RA: skc[i] = MSK_SK_LOW; break; case MSK_BK_FX: skc[i] = MSK_SK_FIX; break; default: skc[i] = MSK_SK_UNK; break; } break; /* Warning : Slacks in Osi and Mosek er negated */ case CoinWarmStartBasis::atLowerBound: switch(bkc[i]) { case MSK_BK_UP: case MSK_BK_RA: skc[i] = MSK_SK_UPR; break; case MSK_BK_FX: skc[i] = MSK_SK_FIX; break; default: skc[i] = MSK_SK_UNK; break; } break; case CoinWarmStartBasis::isFree: skc[i] = MSK_SK_SUPBAS; break; default: // unknown row status retval = false; skip = true; MSKassert(3,1,"Unkown rowstatus","setWarmStart"); break; } } delete[] bkc; if( skip == false ) { bkx = new int[numcols]; restat = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_VAR, 0, numcols, (MSKboundkeye*) (bkx), NULL, NULL); checkMSKerror( restat, "MSK_getboundslice", "setWarmStart" ); for( i = 0; i < numcols; ++i ) { switch( ws->getStructStatus( i ) ) { case CoinWarmStartBasis::basic: skx[i] = MSK_SK_BAS; ++numbas; break; case CoinWarmStartBasis::atLowerBound: switch(bkx[i]) { case MSK_BK_LO: case MSK_BK_RA: skx[i] = MSK_SK_LOW; break; case MSK_BK_FX: skx[i] = MSK_SK_FIX; default: skx[i] = MSK_SK_UNK; break; } break; case CoinWarmStartBasis::atUpperBound: switch(bkx[i]) { case MSK_BK_UP: case MSK_BK_RA: skx[i] = MSK_SK_UPR; break; case MSK_BK_FX: skx[i] = MSK_SK_FIX; default: skx[i] = MSK_SK_UNK; break; } break; case CoinWarmStartBasis::isFree: skx[i] = MSK_SK_SUPBAS; break; default: // unknown col status retval = false; skip = true; MSKassert(3,1,"Unkown col status","setWarmStart"); break; } } delete[] bkx; } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("OsiMskSolverInterface::setWarmStart(%p) numcols %d numrows %d numbas %d\n", (void *)warmstart,numcols,numrows,numbas); #endif #if 0 MSKassert(3,numbas == numrows,"Wrong number of basis variables","setWarmStart"); #endif if( skip == false ) { restat = MSK_putsolution( getLpPtr( OsiMskSolverInterface::FREECACHED_RESULTS ), MSK_SOL_BAS, (MSKstakeye*) (skc), (MSKstakeye*) (skx), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); delete[] skx; delete[] skc; } else { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Skipping setting values in OsiMskSolverInterface::setWarmStart()\n"); #endif #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::setWarmStart(%p)\n", (void *)warmstart); #endif delete[] skx; delete[] skc; return false; } retval = (restat == MSK_RES_OK); #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::setWarmStart(%p)\n", (void *)warmstart); #endif return retval; } //############################################################################# // Hotstart related methods (primarily used in strong branching) //############################################################################# //----------------------------------------------------------------------------- // Mark hot start void OsiMskSolverInterface::markHotStart() { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::markHotStart()\n"); #endif int err; int numcols, numrows; MSKassert(3,!probtypemip_,"probtypemip_","markHotStart"); numcols = getNumCols(); numrows = getNumRows(); if( numcols > hotStartCStatSize_ ) { delete[] hotStartCStat_; hotStartCStatSize_ = static_cast( 1.0 * static_cast( numcols ) ); // get some extra space for future hot starts hotStartCStat_ = new int[hotStartCStatSize_]; } if( numrows > hotStartRStatSize_ ) { delete[] hotStartRStat_; hotStartRStatSize_ = static_cast( 1.0 * static_cast( numrows ) ); // get some extra space for future hot starts hotStartRStat_ = new int[hotStartRStatSize_]; } err = MSK_getsolution(getMutableLpPtr(), MSK_SOL_BAS, NULL, NULL, (MSKstakeye*) (hotStartRStat_), (MSKstakeye*) (hotStartCStat_), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror( err, "MSK_getsolution", "markHotStart" ); #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::markHotStart()\n"); #endif } //----------------------------------------------------------------------------- // Solve from a hot start void OsiMskSolverInterface::solveFromHotStart() { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::solveFromHotStart()\n"); #endif int err; int maxiter; switchToLP(); MSKassert(3,getNumCols() <= hotStartCStatSize_,"getNumCols() <= hotStartCStatSize_","solveFromHotStart"); MSKassert(3,getNumRows() <= hotStartRStatSize_,"getNumRows() <= hotStartRStatSize_","solveFromHotStart"); err = MSK_putsolution(getLpPtr( OsiMskSolverInterface::FREECACHED_RESULTS ), MSK_SOL_BAS, (MSKstakeye*) (hotStartRStat_), (MSKstakeye*) (hotStartCStat_), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror( err, "MSK_putsolution", "solveFromHotStart" ); err = MSK_getintparam( getMutableLpPtr(), MSK_IPAR_SIM_MAX_ITERATIONS, &maxiter ); checkMSKerror( err, "MSK_getintparam", "solveFromHotStart" ); err = MSK_putintparam( getMutableLpPtr(), MSK_IPAR_SIM_MAX_ITERATIONS, hotStartMaxIteration_ ); checkMSKerror( err, "MSK_putintparam", "solveFromHotStart" ); resolve(); err = MSK_putintparam( getMutableLpPtr(), MSK_IPAR_SIM_MAX_ITERATIONS, maxiter ); checkMSKerror( err, "MSK_putintparam", "solveFromHotStart" ); #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::solveFromHotStart()\n"); #endif } //----------------------------------------------------------------------------- // Unmark a hot start void OsiMskSolverInterface::unmarkHotStart() { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::unmarkHotStart()\n"); #endif freeCachedData(); if( hotStartCStat_ != NULL ) delete[] hotStartCStat_; if( hotStartRStat_ != NULL ) delete[] hotStartRStat_; hotStartCStat_ = NULL; hotStartCStatSize_ = 0; hotStartRStat_ = NULL; hotStartRStatSize_ = 0; #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::unmarkHotStart()\n"); #endif } //############################################################################# // Problem information methods (original data) //############################################################################# //----------------------------------------------------------------------------- // Returns number of columns in MOSEK task int OsiMskSolverInterface::getNumCols() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getNumCols()\n"); #endif int numcol, err; err = MSK_getnumvar(getMutableLpPtr(),&numcol); checkMSKerror( err, "MSK_getnumvar", "getNumCols" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getNumCols()\n"); #endif return numcol; } //----------------------------------------------------------------------------- // Returns number of rows in MOSEK task int OsiMskSolverInterface::getNumRows() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getNumRows()\n"); #endif int numrow, err; err = MSK_getnumcon(getMutableLpPtr(),&numrow); checkMSKerror( err, "MSK_getnumcon", "getNumRows" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getNumRows()\n"); #endif return numrow; } //----------------------------------------------------------------------------- // Returns number of non-zeroes (in matrix) in MOSEK task int OsiMskSolverInterface::getNumElements() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getNumElements()\n"); #endif int numnon, err; err = MSK_getnumanz(getMutableLpPtr(),&numnon); checkMSKerror( err, "MSK_getnumanz", "getNumElements" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getNumElements()\n"); #endif return numnon; } //----------------------------------------------------------------------------- // Returns lower bounds on columns in MOSEK task const double * OsiMskSolverInterface::getColLower() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getColLower()\n"); #endif if(collower_ == NULL ) { int ncols = getNumCols(); MSKassert(3,colupper_ == NULL,"colupper_","getColLower"); if( ncols > 0 ) { if(colupper_ == NULL) colupper_ = new double[ncols]; if(collower_ == NULL) collower_ = new double[ncols]; int *dummy_tags = new int[ncols]; int err = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_VAR, (MSKidxt)0, (MSKidxt)ncols, (MSKboundkeye*) (dummy_tags), collower_, colupper_); checkMSKerror(err, "MSK_getboundslice","getColUpper"); for( int k = 0; k < ncols; ++k ) { if( dummy_tags[k] == MSK_BK_UP || dummy_tags[k] == MSK_BK_FR ) { /* No lower */ collower_[k] = -getInfinity(); } if( dummy_tags[k] == MSK_BK_LO || dummy_tags[k] == MSK_BK_FR ) { /* No upper */ colupper_[k] = getInfinity(); } } delete[] dummy_tags; } else { if(colupper_ != NULL) delete [] colupper_; if(collower_ != NULL) delete [] collower_; colupper_ = collower_ = NULL; } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getColLower()\n"); #endif return collower_; } //----------------------------------------------------------------------------- // Returns upper bounds on columns in MOSEK task const double * OsiMskSolverInterface::getColUpper() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getColUpper()\n"); #endif if( colupper_ == NULL ) { int ncols = getNumCols(); MSKassert(3,collower_ == NULL,"collower_ == NULL","getColUpper"); if( ncols > 0 ) { if(colupper_ == NULL) colupper_ = new double[ncols]; if(collower_ == NULL) collower_ = new double[ncols]; int *dummy_tags = new int[ncols]; int err = MSK_getboundslice( getMutableLpPtr(), MSK_ACC_VAR, (MSKidxt)0, (MSKidxt)ncols, (MSKboundkeye*) (dummy_tags), collower_, colupper_); checkMSKerror(err,"MSK_getboundslice","getColUpper"); delete[] dummy_tags; } else { if(colupper_ != NULL) delete [] colupper_; if(collower_ != NULL) delete [] collower_; colupper_ = collower_ = NULL; } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getColUpper()\n"); #endif return colupper_; } //----------------------------------------------------------------------------- // Returns rowsense in MOSEK task, call getRightHandSide to produce triplets. const char * OsiMskSolverInterface::getRowSense() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getRowSense()\n"); #endif if( rowsense_==NULL ) { getRightHandSide(); if( getNumRows() != 0 ) MSKassert(3,rowsense_!=NULL,"rowsense_!=NULL","getRowSense"); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getRowSense()\n"); #endif return rowsense_; } //----------------------------------------------------------------------------- // Returns the RHS in triplet form. MOSEK uses always boundkeys instead of the // triplet, so we have to convert back to triplet. const double * OsiMskSolverInterface::getRightHandSide() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getRightHandSide()\n"); #endif if(rowsense_ == NULL) { int nr = getNumRows(); if ( nr != 0 ) { MSKassert(3,(rhs_ == NULL) && (rowrange_ == NULL),"(rhs_ == NULL) && (rowrange_ == NULL)","getRightHandSide"); rowsense_ = new char[nr]; rhs_ = new double[nr]; rowrange_ = new double[nr]; const double * lb = getRowLower(); const double * ub = getRowUpper(); int i; for ( i=0; i 3 debugMessage("End OsiMskSolverInterface::getRightHandSide()\n"); #endif return rhs_; } //----------------------------------------------------------------------------- // Returns rowrange in MOSEK task, call getRightHandSide to produce triplets. const double * OsiMskSolverInterface::getRowRange() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getRowRange()\n"); #endif if( rowrange_ == NULL ) { getRightHandSide(); MSKassert(3,rowrange_!=NULL || getNumRows() == 0,"rowrange_!=NULL || getNumRows() == 0","getRowRange"); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getRowRange()\n"); #endif return rowrange_; } //----------------------------------------------------------------------------- // Returns lower bounds on rows in MOSEK task. const double * OsiMskSolverInterface::getRowLower() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getRowLower()\n"); #endif if( rowlower_ == NULL ) { MSKassert(3,rowupper_ == NULL,"rowupper_ == NULL","getRowLower"); int nrows = getNumRows(); if( nrows > 0 ) { rowlower_ = new double[nrows]; rowupper_ = new double[nrows]; int *dummy_tags = new int[nrows]; int err = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_CON, (MSKidxt)0, (MSKidxt)nrows, (MSKboundkeye*) (dummy_tags), rowlower_, rowupper_); checkMSKerror(err,"MSK_getboundslice","getRowLower"); delete[] dummy_tags; } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getRowLower()\n"); #endif return rowlower_; } //----------------------------------------------------------------------------- // Returns upper bounds on rows in MOSEK task. const double * OsiMskSolverInterface::getRowUpper() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getRowUpper()\n"); #endif if( rowupper_ == NULL ) { MSKassert(3,rowlower_ == NULL,"probtypemip_","getRowUpper"); int nrows = getNumRows(); if( nrows > 0 ) { rowupper_ = new double[nrows]; rowlower_ = new double[nrows]; int *dummy_tags = new int[nrows]; int err = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_CON, (MSKidxt)0, (MSKidxt)nrows, (MSKboundkeye*) (dummy_tags), rowlower_, rowupper_); checkMSKerror(err,"MSK_getboundslice","getRowUpper"); delete[] dummy_tags; } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getRowUpper()\n"); #endif return rowupper_; } //----------------------------------------------------------------------------- // Returns objective coefficient in MOSEK task. const double * OsiMskSolverInterface::getObjCoefficients() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getObjCoefficients()\n"); #endif if( obj_ == NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { obj_ = new double[ncols]; int err = MSK_getc( getMutableLpPtr(), obj_ ); checkMSKerror( err, "MSK_getc", "getObjCoefficients" ); } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getObjCoefficients()\n"); #endif return obj_; } //----------------------------------------------------------------------------- // Returns the direction of optimization double OsiMskSolverInterface::getObjSense() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getObjSense()\n"); #endif int err; MSKobjsensee objsen; err = MSK_getobjsense(getMutableLpPtr(), &objsen); checkMSKerror(err,"MSK_getintparam","getObjSense"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getObjSense()\n"); #endif if( objsen == MSK_OBJECTIVE_SENSE_MAXIMIZE ) return -1.0; else return +1.0; } //----------------------------------------------------------------------------- // Returns true if variabel is set to continuous bool OsiMskSolverInterface::isContinuous( int colNumber ) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::isContinuous(%d)\n", colNumber); debugMessage("End OsiMskSolverInterface::isContinuous(%d)\n", colNumber); #endif return getCtype()[colNumber] == 'C'; } //----------------------------------------------------------------------------- // Returns a Coin matrix by row const CoinPackedMatrix * OsiMskSolverInterface::getMatrixByRow() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getMatrixByRow()\n"); #endif if ( matrixByRow_ == NULL ) { int nc, nr, nz, *sub, *ptrb, *ptre, surp, *len; double *val; nc = getNumCols(); nr = getNumRows(); nz = surp = getNumElements(); ptrb = new int[nr+1]; ptre = new int[nr]; sub = new int[nz]; val = new double[nz]; len = new int[nr]; ptrb[nr] = nz; int err = MSK_getaslice(getMutableLpPtr(), MSK_ACC_CON, 0, nr, nz, &surp, ptrb, ptre, sub, val); checkMSKerror(err, "MSK_getaslice", "getMatrixByRow"); for(int i=0; iassignMatrix(false , nc, nr, nz, val, sub, ptrb, len); MSKassert(3,matrixByRow_->getNumCols()==nc,"matrixByRow_->getNumCols()==nc","getMatrixByRow"); MSKassert(3,matrixByRow_->getNumRows()==nr,"matrixByRow_->getNumRows()==nr","getMatrixByRow"); delete[] ptrb; delete[] ptre; delete[] sub; delete[] val; delete[] len; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getMatrixByRow()\n"); #endif return matrixByRow_; } //----------------------------------------------------------------------------- // Returns a Coin matrix by column const CoinPackedMatrix * OsiMskSolverInterface::getMatrixByCol() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getMatrixByCol()\n"); #endif if ( matrixByCol_ == NULL ) { int nc, nr, nz, *sub, *ptrb, *ptre, surp, *len; double *val; nc = getNumCols(); nr = getNumRows(); nz = surp = getNumElements(); ptrb = new int[nc+1]; ptre = new int[nc]; sub = new int[nz]; val = new double[nz]; len = new int[nc]; ptrb[nc] = nz; int err = MSK_getaslice(getMutableLpPtr(), MSK_ACC_VAR, 0, nc, nz, &surp, ptrb, ptre, sub, val); checkMSKerror(err, "MSK_getaslice", "getMatrixByCol"); for(int i=0; iassignMatrix(true , nr, nc, nz, val, sub, ptrb, len); MSKassert(3,matrixByCol_->getNumCols()==nc,"matrixByCol_->getNumCols()==nc","getMatrixByCol"); MSKassert(3,matrixByCol_->getNumRows()==nr,"matrixByCol_->getNumRows()==nr","getMatrixByCol"); delete[] ptrb; delete[] ptre; delete[] sub; delete[] val; delete[] len; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getMatrixByCol()\n"); #endif return matrixByCol_; } //----------------------------------------------------------------------------- // Returns the infinity level used in MOSEK. double OsiMskSolverInterface::getInfinity() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getInfinity()\n"); debugMessage("End OsiMskSolverInterface::getInfinity()\n"); #endif return MSK_INFINITY; } //############################################################################# // Problem information methods (results) //############################################################################# //----------------------------------------------------------------------------- // Returns the current col solution. const double * OsiMskSolverInterface::getColSolution() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getColSolution() %p\n",(void*)this); #endif if( colsol_ != NULL ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("colsol_ != NULL\n"); #endif return colsol_; } int i; int nc = getNumCols(); if( nc > 0 ) { MSKsoltypee solution = MSK_SOL_END; if(colsol_ == NULL) colsol_ = new double[nc]; if( probtypemip_ == false) { if( definedSolution( MSK_SOL_BAS ) == true ) solution = MSK_SOL_BAS; else if( definedSolution( MSK_SOL_ITR) == true ) solution = MSK_SOL_ITR; } else if( definedSolution( MSK_SOL_ITG ) == true ) solution = MSK_SOL_ITG; if ( solution == MSK_SOL_END ) { double const *cl=getColLower(),*cu=getColLower(); /* this is just plain stupid, but needed to pass unit test */ for( i = 0; i < nc; ++i ) { if( cl[i] > -getInfinity() ) { colsol_[i] = cl[i]; } else if( cu[i] < getInfinity() ) { colsol_[i] = cu[i]; } else { colsol_[i] = 0.0; } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("colsol_ truncated to zero due to no solution\n"); debugMessage("probtypemip_ %d\n",probtypemip_); #endif return colsol_; } int err = MSK_getsolution(getMutableLpPtr(), solution, NULL, NULL, NULL, NULL, NULL, NULL, colsol_, NULL, NULL, NULL, NULL, NULL, NULL ); checkMSKerror(err,"MSK_getsolution","getColSolution"); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getColSolution()\n"); #endif return colsol_; } //----------------------------------------------------------------------------- // Returns the row price / dual variabels in MOSEK task const double * OsiMskSolverInterface::getRowPrice() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getRowPrice()\n"); #endif if( rowsol_ == NULL ) { int i; int nr = getNumRows(); if( nr > 0 ) { MSKsoltypee solution = MSK_SOL_END; rowsol_ = new double[nr]; if( definedSolution( MSK_SOL_BAS ) == true ) solution = MSK_SOL_BAS; else if( definedSolution( MSK_SOL_ITR) == true ) solution = MSK_SOL_ITR; if ( solution == MSK_SOL_END ) { for( i = 0; i < nr; ++i ) rowsol_[i] = 0.0; return rowsol_; } int err = MSK_getsolution(getMutableLpPtr(), solution, NULL, NULL, NULL, NULL, NULL, NULL, NULL, rowsol_, NULL, NULL, NULL, NULL, NULL); checkMSKerror( err, "MSK_getsolution", "getRowPrice" ); } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getRowPrice()\n"); #endif return rowsol_; } //----------------------------------------------------------------------------- // Returns the reduced cost in MOSEK task. const double * OsiMskSolverInterface::getReducedCost() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getReducedCost()\n"); #endif if( redcost_ == NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { MSKsoltypee solution = MSK_SOL_END; if( definedSolution( MSK_SOL_BAS ) == true ) solution = MSK_SOL_BAS; else if( definedSolution( MSK_SOL_ITR) == true ) solution = MSK_SOL_ITR; if ( solution == MSK_SOL_END ) return NULL; redcost_ = new double[ncols]; double *slx = new double[ncols]; double *sux = new double[ncols]; int err = MSK_getsolution(getMutableLpPtr(), solution, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, slx, sux, NULL); // Calculate reduced cost for(int i = 0; i < ncols; i++) redcost_[i] = slx[i]-sux[i]; delete[] slx; delete[] sux; checkMSKerror( err, "MSK_getsolution", "getReducedCost" ); } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getReducedCost()\n"); #endif return redcost_; } //----------------------------------------------------------------------------- // Returns the rowactivity in MOSEK task. const double * OsiMskSolverInterface::getRowActivity() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getRowActivity()\n"); #endif if( rowact_ == NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rowact_ = new double[nrows]; const double *x = getColSolution() ; const CoinPackedMatrix *mtx = getMatrixByRow() ; mtx->times(x,rowact_) ; } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getRowActivity()\n"); #endif return rowact_; } //----------------------------------------------------------------------------- // Returns the objective for defined solution in MOSEK task. double OsiMskSolverInterface::getObjValue() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getObjValue()\n"); #endif double objval = OsiSolverInterface::getObjValue(); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getObjValue()\n"); #endif return objval; } //----------------------------------------------------------------------------- // Returns the iteration used in last call to optimize. Notice that the cross // over phase in interior methods is not returned, when interior point is // used, only the interior point iterations. int OsiMskSolverInterface::getIterationCount() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getIterationCount()\n"); #endif int nr = 0, solver, err; int nrp=0; solver = solverUsed(); if( solver == MSK_OPTIMIZER_PRIMAL_SIMPLEX ) { { err = MSK_getintinf(getMutableLpPtr(), MSK_IINF_SIM_PRIMAL_ITER, &nr); checkMSKerror(err,"MSK_getintinf","getIterationsCount"); } } else if( solver == MSK_OPTIMIZER_DUAL_SIMPLEX ) { { err = MSK_getintinf(getMutableLpPtr(), MSK_IINF_SIM_DUAL_ITER, &nr); checkMSKerror(err,"MSK_getintinf","getIterationsCount"); } } else if( solver == MSK_OPTIMIZER_FREE_SIMPLEX ) { { err = MSK_getintinf(getMutableLpPtr(), MSK_IINF_SIM_DUAL_ITER, &nr); checkMSKerror(err,"MSK_getintinf","getIterationsCount"); err = MSK_getintinf(getMutableLpPtr(), MSK_IINF_SIM_PRIMAL_ITER, &nrp); checkMSKerror(err,"MSK_getintinf","getIterationsCount"); nr = nr+nrp; } } else if( solver == MSK_OPTIMIZER_INTPNT ) { { err = MSK_getintinf(getMutableLpPtr(), MSK_IINF_INTPNT_ITER, &nr); checkMSKerror(err,"MSK_getintinf","getIterationsCount"); } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getIterationCount()\n"); #endif return nr; } //----------------------------------------------------------------------------- // Returns one dual ray std::vector OsiMskSolverInterface::getDualRays(int maxNumRays, bool fullRay) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getDualRays(%d,%s)\n", maxNumRays, fullRay?"true":"false"); #endif if (fullRay == true) { throw CoinError("Full dual rays not yet implemented.","getDualRays", "OsiMskSolverInterface"); } OsiMskSolverInterface solver(*this); int numrows = getNumRows(), r; MSKsolstae status; MSKsoltypee solution; if( probtypemip_ == false ) { if( definedSolution( MSK_SOL_BAS ) == true ) solution = MSK_SOL_BAS; else { if( definedSolution( MSK_SOL_ITR ) == true ) solution = MSK_SOL_ITR; else return std::vector(); } } else { if( definedSolution( MSK_SOL_ITG ) == true ) solution = MSK_SOL_ITG; else return std::vector(); } double *farkasray = new double[numrows]; r = MSK_getsolution(getMutableLpPtr(), solution, NULL, &status, NULL, NULL, NULL, NULL, NULL, farkasray, NULL, NULL, NULL, NULL, NULL); checkMSKerror( r, "MSK_getsolution", "getDualRays" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getDualRays(%d)\n", maxNumRays); #endif if( status != MSK_SOL_STA_PRIM_INFEAS_CER ) { delete[] farkasray; return std::vector(); } else return std::vector(1, farkasray); } //----------------------------------------------------------------------------- // Returns one primal ray std::vector OsiMskSolverInterface::getPrimalRays(int maxNumRays) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getPrimalRays(%d)\n", maxNumRays); #endif OsiMskSolverInterface solver(*this); int numcols = getNumCols(), r; MSKsolstae status; MSKsoltypee solution; if( probtypemip_ == false ) { if( definedSolution( MSK_SOL_BAS ) == true ) solution = MSK_SOL_BAS; else { if( definedSolution( MSK_SOL_ITR ) == true ) solution = MSK_SOL_ITR; else return std::vector(); } } else { if( definedSolution( MSK_SOL_ITG ) == true ) solution = MSK_SOL_ITG; else return std::vector(); } double *farkasray = new double[numcols]; r = MSK_getsolution(getMutableLpPtr(), solution, NULL, &status, NULL, NULL, NULL, NULL, farkasray, NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror( r, "MSK_getsolution", "getPrimalRays" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getPrimalRays(%d)\n", maxNumRays); #endif if( status != MSK_SOL_STA_DUAL_INFEAS_CER ) { delete[] farkasray; return std::vector(); } else return std::vector(1, farkasray); } //############################################################################# // Problem modifying methods (rim vectors) //############################################################################# //----------------------------------------------------------------------------- // Sets a variabels objective coeff. void OsiMskSolverInterface::setObjCoeff( int elementIndex, double elementValue ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setObjCoeff(%d, %g)\n", elementIndex, elementValue); #endif const double *oldobj; if( redcost_ && !obj_ ) oldobj = getObjCoefficients(); else oldobj = obj_; int err = MSK_putclist(getMutableLpPtr(), 1, &elementIndex, &elementValue); checkMSKerror(err, "MSK_putclist", "setObjCoeff"); if( obj_ ) { if( redcost_ ) { redcost_[elementIndex] += elementValue-oldobj[elementIndex]; obj_[elementIndex] = elementValue; } else { obj_[elementIndex] = elementValue; } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setObjCoeff(%d, %g)\n", elementIndex, elementValue); #endif } //----------------------------------------------------------------------------- // Sets a list of objective coeff. void OsiMskSolverInterface::setObjCoeffSet(const int* indexFirst, const int* indexLast, const double* coeffList) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setObjCoeffSet(%p, %p, %p)\n", (void *)indexFirst, (void *)indexLast, (void *)coeffList); #endif const double *oldobj; const long int cnt = indexLast - indexFirst; if( redcost_ && !obj_ ) oldobj = getObjCoefficients(); else oldobj = obj_; int err = MSK_putclist(getMutableLpPtr(), static_cast(cnt), const_cast(indexFirst), const_cast(coeffList)); checkMSKerror(err, "MSK_putclist", "setObjCoeffSet"); if( obj_ ) { if( redcost_ ) { for( int j = 0; j < cnt; ++j) { redcost_[j] += coeffList[indexFirst[j]]-oldobj[j]; obj_[j] = coeffList[indexFirst[j]]; } } else { for( int j = 0; j < cnt; ++j) { obj_[j] = coeffList[indexFirst[j]]; } } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setObjCoeffSet(%p, %p, %p)\n", (void *)indexFirst, (void *)indexLast, (void *)coeffList); #endif } //----------------------------------------------------------------------------- // Sets lower bound on one specific column void OsiMskSolverInterface::setColLower(int elementIndex, double elementValue) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setColLower(%d, %g)\n", elementIndex, elementValue); #endif int finite = 1; if( elementValue <= -getInfinity() ) finite = 0; int err = MSK_chgbound(getMutableLpPtr(), MSK_ACC_VAR, elementIndex, 1, /*It is a lower bound*/ finite, /* Is it finite */ elementValue); checkMSKerror( err, "MSK_chgbound", "setColLower" ); if( collower_ != NULL ) collower_[elementIndex] = elementValue; #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setColLower(%d, %g)\n", elementIndex, elementValue); #endif } //----------------------------------------------------------------------------- // Sets upper bound on one specific column. void OsiMskSolverInterface::setColUpper(int elementIndex, double elementValue) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setColUpper(%d, %g)\n", elementIndex, elementValue); #endif int finite = 1; if( elementValue >= getInfinity() ) finite = 0; int err = MSK_chgbound( getMutableLpPtr(), MSK_ACC_VAR, elementIndex, 0, /* It is a upper bound */ finite, /* Is it finite */ elementValue); checkMSKerror( err, "MSK_chgbound", "setColUpper" ); if( colupper_ != NULL ) colupper_[elementIndex] = elementValue; #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setColUpper(%d, %g)\n", elementIndex, elementValue); #endif } //----------------------------------------------------------------------------- // Sets upper and lower bound on one specific column void OsiMskSolverInterface::setColBounds( int elementIndex, double lower, double upper ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setColBounds(%d, %g, %g)\n", elementIndex, lower, upper); #endif setColLower(elementIndex, lower); setColUpper(elementIndex, upper); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setColBounds(%d, %g, %g)\n", elementIndex, lower, upper); #endif } //----------------------------------------------------------------------------- // Sets upper and lower bounds on a list of columns. Due to the strange storage of // boundlist, it is not possible to change all the bounds in one call to MOSEK, // so the standard method is used. void OsiMskSolverInterface::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setColSetBounds(%p, %p, %p)\n", (void *)indexFirst, (void *)indexLast, (void *)boundList); #endif OsiSolverInterface::setColSetBounds( indexFirst, indexLast, boundList ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setColSetBounds(%p, %p, %p)\n", (void *)indexFirst, (void *)indexLast, (void *)boundList); #endif } //----------------------------------------------------------------------------- // Sets the lower bound on a row void OsiMskSolverInterface::setRowLower( int i, double elementValue ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setRowLower(%d, %g)\n", i, elementValue); #endif double rhs = getRightHandSide()[i]; double range = getRowRange()[i]; char sense = getRowSense()[i]; double lower=-MSK_INFINITY, upper=MSK_INFINITY; convertSenseToBound( sense, rhs, range, lower, upper ); if( lower != elementValue ) { convertBoundToSense( elementValue, upper, sense, rhs, range ); setRowType( i, sense, rhs, range ); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setRowLower(%d, %g)\n", i, elementValue); #endif } //----------------------------------------------------------------------------- // Sets the upper bound on a row void OsiMskSolverInterface::setRowUpper( int i, double elementValue ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setRowUpper(%d, %g)\n", i, elementValue); #endif double rhs = getRightHandSide()[i]; double range = getRowRange()[i]; char sense = getRowSense()[i]; double lower=-MSK_INFINITY, upper=MSK_INFINITY; convertSenseToBound( sense, rhs, range, lower, upper ); if( upper != elementValue ) { convertBoundToSense( lower, elementValue, sense, rhs, range ); setRowType( i, sense, rhs, range ); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setRowUpper(%d, %g)\n", i, elementValue); #endif } //----------------------------------------------------------------------------- // Sets the upper and lower bound on a row void OsiMskSolverInterface::setRowBounds( int elementIndex, double lower, double upper ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setRowBounds(%d, %g, %g)\n", elementIndex, lower, upper); #endif double rhs, range; char sense; convertBoundToSense( lower, upper, sense, rhs, range ); setRowType( elementIndex, sense, rhs, range ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setRowBounds(%d, %g, %g)\n", elementIndex, lower, upper); #endif } //----------------------------------------------------------------------------- // Sets the triplet on a row void OsiMskSolverInterface::setRowType(int i, char sense, double rightHandSide,double range) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setRowType(%d, %c, %g, %g)\n", i, sense, rightHandSide, range); #endif double rub=MSK_INFINITY,rlb=-MSK_INFINITY; int rtag=MSK_BK_FR; MskConvertSenseToBound(sense, range, rightHandSide, rlb, rub, rtag); int err = MSK_putbound(getMutableLpPtr(), MSK_ACC_CON, i, (MSKboundkeye)rtag, rlb, rub); if( rowsense_ != NULL ) rowsense_[i] = sense; if( rowrange_ != NULL ) rowrange_[i] = range; if( rhs_ != NULL ) rhs_[i] = rightHandSide; checkMSKerror( err, "MSK_putbound", "setRowType" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setRowType(%d, %c, %g, %g)\n", i, sense, rightHandSide, range); #endif } //----------------------------------------------------------------------------- // Set upper og lower bounds for a lisit of rows. Due to the strange storage of // boundlist, it is not possible to change all the bounds in one call to MOSEK, // so the standard method is used. void OsiMskSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setRowSetBounds(%p, %p, %p)\n", (void *)indexFirst, (void *)indexLast, (void *)boundList); #endif const long int cnt = indexLast - indexFirst; if (cnt <= 0) return; for (int i = 0; i < cnt; ++i) setRowBounds(indexFirst[i], boundList[2*i], boundList[2*i+1]); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setRowSetBounds(%p, %p, %p)\n", (void *)indexFirst, (void *)indexLast, (void *)boundList); #endif } //----------------------------------------------------------------------------- // Set triplets for a list of rows void OsiMskSolverInterface::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setRowSetTypes(%p, %p, %p, %p, %p)\n", (void *)indexFirst, (void *)indexLast, (void *)senseList, (void *)rhsList, (void *)rangeList); #endif const long int cnt = indexLast - indexFirst; if (cnt <= 0) return; for (int i = 0; i < cnt; ++i) setRowType(indexFirst[i], senseList[i], rhsList[i], rangeList[i]); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setRowSetTypes(%p, %p, %p, %p, %p)\n", (void *)indexFirst, (void *)indexLast, (void *)senseList, (void *)rhsList, (void *)rangeList); #endif } //----------------------------------------------------------------------------- // Sets a variabel to continuous void OsiMskSolverInterface::setContinuous(int index) { int numcols = getNumCols(); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setContinuous(%d)\n", index); #endif MSKassert(3,coltype_ != NULL,"coltype_ != NULL","setContinuous"); MSKassert(3,coltypesize_ >= getNumCols(),"coltypesize_ >= getNumCols()","setContinuous"); coltype_[index] = 'C'; if( index < numcols ) { int err = MSK_putvartype( getMutableLpPtr(), index, MSK_VAR_TYPE_CONT); checkMSKerror( err, "MSK_putvartype", "setContinuous" ); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setContinuous(%d)\n", index); #endif } //----------------------------------------------------------------------------- // Sets a variabel to integer void OsiMskSolverInterface::setInteger(int index) { int numcols = getNumCols(); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setInteger(%d)\n", index); #endif MSKassert(3,coltype_ != NULL,"coltype_ != NULL","setInteger"); MSKassert(3,coltypesize_ >= getNumCols(),"coltypesize_ >= getNumCols()","setInteger"); coltype_[index] = 'I'; if( index < numcols ) { int err = MSK_putvartype( getMutableLpPtr(), index, MSK_VAR_TYPE_INT); checkMSKerror( err, "MSK_putvartype", "setInteger" ); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setInteger(%d)\n", index); #endif } //----------------------------------------------------------------------------- // Sets a list of variables to continuous void OsiMskSolverInterface::setContinuous(const int* indices, int len) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setContinuous(%p, %d)\n", (void *)indices, len); #endif for( int i = 0; i < len; ++i ) setContinuous(indices[i]); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setContinuous(%p, %d)\n", (void *)indices, len); #endif } //----------------------------------------------------------------------------- // Sets a list of variables to integer void OsiMskSolverInterface::setInteger(const int* indices, int len) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setInteger(%p, %d)\n", (void *)indices, len); #endif for( int i = 0; i < len; ++i ) setInteger(indices[i]); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setInteger(%p, %d)\n", (void *)indices, len); #endif } //----------------------------------------------------------------------------- // Sets the direction of optimization void OsiMskSolverInterface::setObjSense(double s) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::setObjSense(%g)\n", s); #endif int err; double pre; pre = getObjSense(); if( s == +1.0 ) { err = MSK_putobjsense(getMutableLpPtr(), MSK_OBJECTIVE_SENSE_MINIMIZE); } else { err = MSK_putobjsense(getMutableLpPtr(), MSK_OBJECTIVE_SENSE_MAXIMIZE); } checkMSKerror(err,"MSK_putintparam","setObjSense"); if( pre != s ) { /* A hack to pass unit test, ugly as hell */ /* When objective sense is changed then reset obj cuts */ if( s > 0 ) { setDblParam(OsiPrimalObjectiveLimit,-COIN_DBL_MAX) ; setDblParam(OsiDualObjectiveLimit,COIN_DBL_MAX) ; } else { setDblParam(OsiPrimalObjectiveLimit,COIN_DBL_MAX) ; setDblParam(OsiDualObjectiveLimit,-COIN_DBL_MAX) ; } } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::setObjSense(%g)\n", s); #endif } //----------------------------------------------------------------------------- // Sets the col solution. This is very fuzzy WE LIKE STATUS KEYS not numerical values i.e superbasics or basic !!!. void OsiMskSolverInterface::setColSolution(const double * cs) { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::setColSolution %p\n", (void*)this); #endif int err,nc = getNumCols(),nr = getNumRows(), numbas = 0; MSKstakeye *tskc,*tskx; MSKboundkeye *tbkx,*tbkc; MSKrealt *tblx,*tbux,*tblc,*tbuc; double *txc; if( cs == NULL ) { freeCachedResults(); } else if( nc > 0 ) { if( colsol_ != NULL ) delete[] colsol_; colsol_ = new double[nc]; CoinDisjointCopyN( cs, nc, colsol_ ); tbkx = new MSKboundkeye[nc]; tskx = new MSKstakeye[nc]; tblx = new MSKrealt[nc]; tbux = new MSKrealt[nc]; tskc = new MSKstakeye[nr]; txc = new double[nr]; tbkc = new MSKboundkeye[nr]; tblc = new MSKrealt[nr]; tbuc = new MSKrealt[nr]; const CoinPackedMatrix *mtx = getMatrixByCol() ; assert(mtx->getNumCols() == nc); assert(mtx->getNumRows() == nr); mtx->times(cs,txc) ; /* Negate due to different Osi and Mosek slack representation */ for( int i = 0; i < nr; ++i ) { txc[i] = -txc[i]; tskc[i] = MSK_SK_UNK; } err = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_CON, 0, nr, tbkc, tblc, tbuc); checkMSKerror( err, "MSK_getboundslice", "setColsolution" ); err = MSK_getboundslice(getMutableLpPtr(), MSK_ACC_VAR, 0, nc, tbkx, tblx, tbux); checkMSKerror( err, "MSK_getboundslice", "setColsolution" ); if( definedSolution( MSK_SOL_BAS ) == true ) { err = MSK_getsolution(getMutableLpPtr(), MSK_SOL_BAS, NULL, NULL, tskc, tskx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror(err,"MSK_getsolution","setColSol"); } for( int i = 0; i < nr; ++i ) { if( tbkc[i] == MSK_BK_FX && tblc[i] == txc[i] ) { tskc[i] = MSK_SK_FIX; } else if( ( tbkc[i] == MSK_BK_LO || tbkc[i] == MSK_BK_RA ) && tblc[i] == txc[i] ) { tskc[i] = MSK_SK_LOW; } else if( ( tbkc[i] == MSK_BK_UP || tbkc[i] == MSK_BK_RA ) && tbuc[i] == txc[i] ) { tskc[i] = MSK_SK_UPR; } else if( tbkc[i] == MSK_BK_FR && txc[i] == 0.0 ) { tskc[i] = MSK_SK_SUPBAS; } else { #if 0 printf("Slack : %d bkc : %d blc : %-16.10e buc : %-16.10e xc : %-16.10e\n", i,tbkc[i],tblc[i],tbuc[i],txc[i]); #endif ++numbas; tskc[i] = MSK_SK_BAS; } } for( int j = 0; j < nc; ++j ) { if( tbkx[j] == MSK_BK_FX && tblx[j] == cs[j] ) { tskx[j] = MSK_SK_FIX; } else if( ( tbkx[j] == MSK_BK_LO || tbkx[j] == MSK_BK_RA ) && tblx[j] == cs[j] ) { tskx[j] = MSK_SK_LOW; } else if( ( tbkx[j] == MSK_BK_UP || tbkx[j] == MSK_BK_RA ) && tbux[j] == cs[j] ) { tskx[j] = MSK_SK_UPR; } else if( ( tbkx[j] == MSK_BK_FR && cs[j] == 0.0 ) || numbas >= nr ) { tskx[j] = MSK_SK_SUPBAS; } else { #if 0 printf("Org %d : bkx : %d blx : %-16.10e bux : %-16.10e xx : %-16.10e\n", j,tbkx[j],tblx[j],tbux[j],cs[j]); #endif tskx[j] = MSK_SK_BAS; } } err = MSK_putsolution(getMutableLpPtr(), MSK_SOL_BAS, tskc, tskx, NULL, (MSKrealt*) txc, const_cast(cs), NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror(err,"MSK_putsolution","setColSol"); MSKassert(3,definedSolution( MSK_SOL_BAS ) == true,"definedSolution( MSK_SOL_BAS ) == true","setColSolution"); delete [] tbkx; delete [] tblx; delete [] tbux; delete [] tskx; delete [] tskc; delete [] txc; delete [] tbkc; delete [] tblc; delete [] tbuc; } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::setColSolution(%p)\n", (void *)cs); #endif } //----------------------------------------------------------------------------- // Sets the rowprices. void OsiMskSolverInterface::setRowPrice(const double * rs) { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::setRowPrice(%p)\n", (void *)rs); #endif int err,nr = getNumRows(),nc = getNumCols(); MSKstakeye *tskc,*tskx; MSKrealt *tslc,*tsuc,*tslx,*tsux,sn,*txc,*txx; double *redcost; if( rs == NULL ) freeCachedResults(); else if( nr > 0 ) { if ( rowsol_ == NULL ) rowsol_ = new double[nr]; colsol_ = new double[nc]; tskc = new MSKstakeye[nr]; tslc = new MSKrealt[nr]; tsuc = new MSKrealt[nr]; txc = new MSKrealt[nr]; tskx = new MSKstakeye[nc]; tslx = new MSKrealt[nc]; tsux = new MSKrealt[nc]; txx = new MSKrealt[nc]; redcost = new double[nc]; CoinDisjointCopyN( rs, nr, rowsol_ ); /* Calc reduced costs */ const CoinPackedMatrix *mtx = getMatrixByCol() ; mtx->transposeTimes(rs,redcost) ; for( int j = 0; j < nc; ++j ) { redcost[j] = getObjCoefficients()[j]-redcost[j]; tslx[j] = CoinMax(0.0,redcost[j]); tsux[j] = CoinMax(0.0,-redcost[j]); } if( definedSolution( MSK_SOL_BAS ) == true ) { for( int i = 0; i < nr; ++i ) { err = MSK_getsolutioni(getMutableLpPtr(), MSK_ACC_CON, i, MSK_SOL_BAS, &tskc[i], &txc[i], &tslc[i], &tsuc[i], &sn); tslc[i] = CoinMax(0.0,rowsol_[i]); tsuc[i] = CoinMax(0.0,-rowsol_[i]); checkMSKerror(err,"MSK_putsolutioni","setRowPrice"); } err = MSK_getsolution(getMutableLpPtr(), MSK_SOL_BAS, NULL, NULL, NULL, tskx, NULL, NULL, txx, NULL, NULL, NULL, NULL, NULL, NULL); checkMSKerror(err,"MSK_getsolution","setRowPrice"); err = MSK_putsolution(getMutableLpPtr(), MSK_SOL_BAS, tskc, tskx, NULL, txc, txx, rowsol_, tslc, tsuc, tslx, tsux, NULL); checkMSKerror(err,"MSK_putsolution","setRowPrice"); } else { for( int i = 0; i < nr; ++i ) { tslc[i] = CoinMax(0.0,rowsol_[i]); tsuc[i] = CoinMax(0.0,-rowsol_[i]); tskc[i] = MSK_SK_UNK; } for( int i = 0; i < nc; ++i ) { tskx[i] = MSK_SK_UNK; txx[i] = 0.0; } err = MSK_putsolution(getMutableLpPtr(), MSK_SOL_BAS, tskc, tskx, NULL, NULL, NULL, rowsol_, tslc, tsuc, tslx, tsux, NULL); checkMSKerror(err,"MSK_putsolution","setRowPrice"); } for( int i = 0; i < nc; ++i ) { colsol_[i] = txx[i]; } delete [] tskc; delete [] tslc; delete [] tsuc; delete [] txc; delete [] tskx; delete [] tslx; delete [] tsux; delete [] txx; delete [] redcost; } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::setRowPrice(%p)\n", (void *)rs); #endif } //############################################################################# // Problem modifying methods (matrix) //############################################################################# //----------------------------------------------------------------------------- // Adds a column to the MOSEK task void OsiMskSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::addCol(%p, %g, %g, %g)\n", (void *)&vec, collb, colub, obj); #endif int nc = getNumCols(); MSKassert(3,coltypesize_ >= nc,"coltypesize_ >= nc","addCol"); resizeColType(nc + 1); coltype_[nc] = 'C'; int ends = vec.getNumElements(); MSKboundkeye tag; MSKtask_t task=getLpPtr(); double inf = getInfinity(); if(collb > -inf && colub >= inf) tag = MSK_BK_LO; else if(collb <= -inf && colub < inf) tag = MSK_BK_UP; else if(collb > -inf && colub < inf) tag = MSK_BK_RA; else if(collb <= -inf && colub >= inf) tag = MSK_BK_FR; else throw CoinError("Bound error", "addCol", "OsiMSKSolverInterface"); #if MSK_VERSION_MAJOR >= 7 int err; MSKint32t j; err = MSK_getnumvar(task,&j); if ( err==MSK_RES_OK ) err = MSK_appendvars(task,1); if ( err==MSK_RES_OK ) err = MSK_putcj(task,j,obj); if ( err==MSK_RES_OK ) err = MSK_putacol(task,j,ends,const_cast(vec.getIndices()),const_cast(vec.getElements())); if ( err==MSK_RES_OK ) err = MSK_putvarbound(task,j,tag,collb,colub); #else int start = 0; int err = MSK_appendvars(task, 1, const_cast (&obj), &start, &ends, const_cast(vec.getIndices()), const_cast(vec.getElements()), (&tag), const_cast (&collb), const_cast (&colub)); #endif checkMSKerror( err, "MSK_appendvars", "addCol" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::addCol(%p, %g, %g, %g)\n", (void *)&vec, collb, colub, obj); #endif } //----------------------------------------------------------------------------- // Adds a list of columns to the MOSEK task void OsiMskSolverInterface::addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::addCols(%d, %p, %p, %p, %p)\n", numcols, (void *)cols, (void *)collb, (void *)colub, (void *)obj); #endif int i, nz = 0, err = MSK_RES_OK; // For efficiency we put hints on the total future size err = MSK_getmaxnumanz(getLpPtr(), &nz); checkMSKerror( err, "MSK_getmaxanz", "addCols" ); for( i = 0; i < numcols; ++i) nz += cols[i]->getNumElements(); err = MSK_putmaxnumanz(getLpPtr(), nz); checkMSKerror( err, "MSK_putmaxanz", "addCols" ); err = MSK_putmaxnumvar(getLpPtr(), numcols+getNumCols()); checkMSKerror( err, "MSK_putmaxnumvar", "addCols" ); for( i = 0; i < numcols; ++i ) addCol( *(cols[i]), collb[i], colub[i], obj[i] ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::addCols(%d, %p, %p, %p, %p)\n", numcols, (void *)cols, (void *)collb, (void *)colub, (void *)obj); #endif } //----------------------------------------------------------------------------- // Deletes a list of columns from the MOSEK task void OsiMskSolverInterface::deleteCols(const int num, const int * columnIndices) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::deleteCols(%d, %p)\n", num, (void *)columnIndices); #endif #if MSK_VERSION_MAJOR >= 7 int err; err = MSK_removevars(getLpPtr( OsiMskSolverInterface::KEEPCACHED_ROW ), num, const_cast(columnIndices)); checkMSKerror( err, "MSK_removevars", "deleteCols" ); #else int err; err = MSK_remove(getLpPtr( OsiMskSolverInterface::KEEPCACHED_ROW ), MSK_ACC_VAR, num, const_cast(columnIndices)); checkMSKerror( err, "MSK_remove", "deleteCols" ); #endif #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::deleteCols(%d, %p)\n", num, (void *)columnIndices); #endif } //----------------------------------------------------------------------------- // Adds a row in bound form to the MOSEK task void OsiMskSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::addRow(%p, %g, %g)\n", (void *)&vec, rowlb, rowub); #endif getNumRows(); int ends = vec.getNumElements(); double inf = getInfinity(); MSKboundkeye tag; MSKtask_t task = getLpPtr( OsiMskSolverInterface::KEEPCACHED_COLUMN ); if(rowlb > -inf && rowub >= inf) tag = MSK_BK_LO; else if(rowlb <= -inf && rowub < inf) tag = MSK_BK_UP; else if(rowlb > -inf && rowub < inf) tag = MSK_BK_RA; else if(rowlb <= -inf && rowub >= inf) tag = MSK_BK_FR; else throw CoinError("Bound error", "addRow", "OsiMSKSolverInterface"); #if MSK_VERSION_MAJOR >= 7 int err; MSKint32t i; err = MSK_getnumcon(task,&i); if ( err==MSK_RES_OK ) err = MSK_appendcons(task,1); if ( err==MSK_RES_OK ) err = MSK_putconbound(task,i,tag,rowlb,rowub); if ( err==MSK_RES_OK ) err = MSK_putarow(task,i,ends, const_cast(vec.getIndices()), const_cast(vec.getElements())); #else int start = 0; int err = MSK_appendcons(task, 1, &start, &ends, const_cast(vec.getIndices()), const_cast(vec.getElements()), (&tag), const_cast (&rowlb), const_cast (&rowub)); #endif checkMSKerror( err, "MSK_appendcons", "addRow" ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::addRow(%p, %g, %g)\n", (void *)&vec, rowlb, rowub); #endif } //----------------------------------------------------------------------------- // Adds a row in triplet form to the MOSEK task void OsiMskSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::addRow(%p, %c, %g, %g)\n", (void *)&vec, rowsen, rowrhs, rowrng); #endif int rtag=MSK_BK_FR; double lb=-MSK_INFINITY,ub=MSK_INFINITY; MskConvertSenseToBound( rowsen, rowrng, rowrhs, lb, ub, rtag ); addRow(vec, lb, ub); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::addRow(%p, %c, %g, %g)\n", (void *)&vec, rowsen, rowrhs, rowrng); #endif } //----------------------------------------------------------------------------- // Adds a serie of rows in bound form to the MOSEK task void OsiMskSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::addRows(%d, %p, %p, %p)\n", numrows, (void *)rows, (void *)rowlb, (void *)rowub); #endif int i,nz = 0, err = MSK_RES_OK; // For efficiency we put hints on the total future size err = MSK_getmaxnumanz( getLpPtr(), &nz); checkMSKerror( err, "MSK_getmaxanz", "addRows" ); for( i = 0; i < numrows; ++i) nz += rows[i]->getNumElements(); err = MSK_putmaxnumanz(getLpPtr(), nz); checkMSKerror( err, "MSK_putmaxanz", "addRows" ); err = MSK_putmaxnumcon(getLpPtr(), numrows+getNumRows()); checkMSKerror( err, "MSK_putmaxnumcon", "addRows" ); for( i = 0; i < numrows; ++i ) addRow( *(rows[i]), rowlb[i], rowub[i] ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::addRows(%d, %p, %p, %p)\n", numrows, (void *)rows, (void *)rowlb, (void *)rowub); #endif } //----------------------------------------------------------------------------- // Adds a list of rows in triplet form to the MOSEK task void OsiMskSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::addRows(%d, %p, %p, %p, %p)\n", numrows, (void *)rows, (void *)rowsen, (void *)rowrhs, (void *)rowrng); #endif int i, err = MSK_RES_OK, nz = 0; // For efficiency we put hints on the total future size for( i = 0; i < numrows; ++i) nz += rows[i]->getNumElements(); err = MSK_putmaxnumanz( getLpPtr(), nz); checkMSKerror( err, "MSK_putmaxanz", "addRows" ); err = MSK_putmaxnumcon( getLpPtr(), numrows); checkMSKerror( err, "MSK_putmaxnumcon", "addRows" ); for( i = 0; i < numrows; ++i ) addRow( *(rows[i]), rowsen[i], rowrhs[i], rowrng[i] ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::addRows(%d, %p, %p, %p, %p)\n", numrows, (void *)rows, (void *)rowsen, (void *)rowrhs, (void *)rowrng); #endif } //----------------------------------------------------------------------------- // Deletes a list of rows the MOSEK task void OsiMskSolverInterface::deleteRows(const int num, const int * rowIndices) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::deleteRows(%d, %p)\n", num, (void *)rowIndices); #endif int err; #if MSK_VERSION_MAJOR >= 7 err = MSK_removecons(getLpPtr( OsiMskSolverInterface::KEEPCACHED_COLUMN ), num, const_cast(rowIndices)); checkMSKerror( err, "MSK_removecons", "deleteRows" ); #else err = MSK_remove(getLpPtr( OsiMskSolverInterface::KEEPCACHED_COLUMN ), MSK_ACC_CON, num, const_cast(rowIndices)); checkMSKerror( err, "MSK_remove", "deleteRows" ); #endif #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::deleteRows(%d, %p)\n", num, (void *)rowIndices); #endif } //############################################################################# // Methods to input a problem //############################################################################# //----------------------------------------------------------------------------- // Loads a problem. Should have its "own" implementation so we don't have to convert // to triplet, since this is convertet back in the load function called. But // for simplicity, this is not done. void OsiMskSolverInterface::loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::loadProblem(%p, %p, %p, %p, %p, %p)\n", (void *)&matrix, (void *)collb, (void *)colub, (void *)obj, (void *)rowlb, (void *)rowub); #endif const double inf = getInfinity(); int nrows = matrix.getNumRows(); char * rowSense; double * rowRhs; double * rowRange; if( nrows ) { rowSense = new char [nrows]; rowRhs = new double[nrows]; rowRange = new double[nrows]; } else { rowSense = NULL; rowRhs = NULL; rowRange = NULL; } int i; if( rowlb == NULL && rowub == NULL) for ( i = nrows - 1; i >= 0; --i ) convertBoundToSense( -inf, inf, rowSense[i], rowRhs[i], rowRange[i] ); else if( rowlb == NULL) for ( i = nrows - 1; i >= 0; --i ) convertBoundToSense( -inf, rowub[i], rowSense[i], rowRhs[i], rowRange[i] ); else if( rowub == NULL) for ( i = nrows - 1; i >= 0; --i ) convertBoundToSense( rowlb[i], inf, rowSense[i], rowRhs[i], rowRange[i] ); else for ( i = nrows - 1; i >= 0; --i ) convertBoundToSense( rowlb[i], rowub[i], rowSense[i], rowRhs[i], rowRange[i] ); loadProblem( matrix, collb, colub, obj, rowSense, rowRhs, rowRange ); if( nrows ) { delete [] rowSense; delete [] rowRhs; delete [] rowRange; } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::loadProblem(%p, %p, %p, %p, %p, %p)\n", (void *)&matrix, (void *)collb, (void *)colub, (void *)obj, (void *)rowlb, (void *)rowub); #endif } //----------------------------------------------------------------------------- // Loads a problem void OsiMskSolverInterface::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::assignProblem()\n"); #endif loadProblem( *matrix, collb, colub, obj, rowlb, rowub ); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowlb; rowlb = 0; delete[] rowub; rowub = 0; #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::assignProblem()\n"); #endif } //----------------------------------------------------------------------------- // Loads a problem void OsiMskSolverInterface::loadProblem( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { int nc=matrix.getNumCols(); int nr=matrix.getNumRows(); #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::loadProblem(%p, %p, %p, %p, %p, %p, %p) numcols : %d numrows : %d\n", (void *)&matrix, (void *)collb, (void *)colub, (void *)obj, (void *)rowsen, (void *)rowrhs, (void *)rowrng,nc,nr); #endif if( nr == 0 && nc == 0 ) gutsOfDestructor(); else { /* Warning input pointers can be NULL */ int i,j; double * ob; int * rtag = NULL; double * rlb = NULL; double * rub = NULL; int * ctag = NULL; int * cends = NULL; const int *len; const int *start; double * clb = NULL; double * cub = NULL; if( obj != NULL ) ob=const_cast(obj); else { ob = new double[nc]; CoinFillN(ob, nc, 0.0); } if( nr ) { rtag = new int[nr]; rlb = new double[nr]; rub = new double[nr]; } if( rowsen && rowrng && rowrhs ) { for( i=0; i < nr; i++ ) MskConvertSenseToBound( rowsen[i], rowrng[i], rowrhs[i], rlb[i], rub[i], rtag[i]); } else { for( i=0; i < nr; i++ ) { rlb[i] = 0.0; rub[i] = MSK_INFINITY; rtag[i] = MSK_BK_LO; } } bool freeMatrixRequired = false; CoinPackedMatrix * m = NULL; if( !matrix.isColOrdered() ) { m = new CoinPackedMatrix(); m->reverseOrderedCopyOf(matrix); freeMatrixRequired = true; } else m = const_cast(&matrix); MSKassert(3,nc == m->getNumCols(),"nc == m->getNumCols()","loadProblem"); MSKassert(3,nr == m->getNumRows(),"nr == m->getNumRows()","loadProblem"); MSKassert(3,m->isColOrdered(),"m->isColOrdered()","loadProblem"); double inf =getInfinity(); if( nc ) { ctag = new int[nc]; cends = new int[nc]; clb = new double[nc]; cub = new double[nc]; } len = (m->getVectorLengths()); start = (m->getVectorStarts()); if( collb == NULL && colub == NULL ) { for(j=0; j < nc; j++) { cends[j] = start[j] + len[j]; MskConvertColBoundToTag(0, inf, clb[j], cub[j], ctag[j]); } } else if( collb == NULL ) { for(j=0; j < nc; j++) { cends[j] = start[j] + len[j]; MskConvertColBoundToTag( 0, colub[j], clb[j], cub[j], ctag[j]); } } else if( colub == NULL ) { for(j=0; j < nc; j++) { cends[j] = start[j] + len[j]; MskConvertColBoundToTag(collb[j], inf, clb[j], cub[j], ctag[j]); } } else { for(j=0; j < nc; j++) { cends[j] = start[j] + len[j]; MskConvertColBoundToTag( collb[j], colub[j], clb[j], cub[j], ctag[j]); } } int err=MSK_inputdata(getLpPtr( OsiMskSolverInterface::KEEPCACHED_NONE ), nr, nc, nr, nc, ob, 0.0, const_cast(m->getVectorStarts()), cends, const_cast(m->getIndices()), const_cast(m->getElements()), (MSKboundkeye*)rtag, rlb, rub, (MSKboundkeye*)ctag, clb, cub); checkMSKerror( err, "MSK_inputdata", "loadProblem" ); if( obj == NULL ) delete[] ob; if( nr ) { delete[] rtag; delete[] rlb; delete[] rub; } if( nc ) { delete[] ctag; delete[] clb; delete[] cub; delete[] cends; } if ( freeMatrixRequired ) delete m; resizeColType(nc); CoinFillN(coltype_, nc, 'C'); } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::loadProblem(%p, %p, %p, %p, %p, %p, %p)\n", (void *)&matrix, (void *)collb, (void *)colub, (void *)obj, (void *)rowsen, (void *)rowrhs, (void *)rowrng); #endif } //----------------------------------------------------------------------------- // Assigns a problem void OsiMskSolverInterface::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::assignProblem()\n"); #endif loadProblem( *matrix, collb, colub, obj, rowsen, rowrhs, rowrng ); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowsen; rowsen = 0; delete[] rowrhs; rowrhs = 0; delete[] rowrng; rowrng = 0; #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::assignProblem()\n"); #endif } //----------------------------------------------------------------------------- // Loads a problem void OsiMskSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::loadProblem() numcols : %d numrows : %d\n",numcols,numrows); #endif const double inf = getInfinity(); char * rowSense = new char [numrows]; double * rowRhs = new double[numrows]; double * rowRange = new double[numrows]; for ( int i = numrows - 1; i >= 0; --i ) { const double lower = rowlb ? rowlb[i] : -inf; const double upper = rowub ? rowub[i] : inf; convertBoundToSense( lower, upper, rowSense[i], rowRhs[i], rowRange[i] ); } loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowSense, rowRhs, rowRange); delete [] rowSense; delete [] rowRhs; delete [] rowRange; #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::loadProblem()\n"); #endif } //----------------------------------------------------------------------------- // Loads a problem void OsiMskSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::loadProblem(%d, %d, %p, %p, %p, %p, %p, %p, %p, %p, %p)\n", numcols, numrows, (void *)start, (void *)index, (void *)value, (void *)collb, (void *)colub, (void *)obj, (void *)rowsen,(void *)rowrhs, (void *)rowrng); #endif const int nc = numcols; const int nr = numrows; if( nr == 0 && nc == 0 ) gutsOfDestructor(); else { MSKassert(3,rowsen != NULL,"rowsen != NULL","loadProblem"); MSKassert(3,rowrhs != NULL,"rowrhs != NULL","loadProblem"); int i,j; double * ob; int * rtag =NULL; double * rlb = NULL; double * rub = NULL; int * ctag =NULL; int * cends = NULL; double * clb = NULL; double * cub = NULL; if( obj != NULL ) ob=const_cast(obj); else { ob = new double[nc]; CoinFillN(ob, nc, 0.0); } if( nr ) { rtag = new int[nr]; rlb = new double[nr]; rub = new double[nr]; } for( i=0; i < nr; i++ ) MskConvertSenseToBound( rowsen[i], rowrng != NULL ? rowrng[i] : 0.0, rowrhs[i], rlb[i], rub[i], rtag[i]); double inf = getInfinity(); if( nc ) { ctag = new int[nc]; cends = new int[nc]; clb = new double[nc]; cub = new double[nc]; } if( collb == NULL && colub == NULL ) for(j=0; j < nc; j++) { cends[j] = start[j+1]; MskConvertColBoundToTag(0, inf, clb[j], cub[j], ctag[j]); } else if( collb == NULL ) for(j=0; j < nc; j++) { cends[j] = start[j+1]; MskConvertColBoundToTag( 0, colub[j], clb[j], cub[j], ctag[j]); } else if( colub == NULL ) for(j=0; j < nc; j++) { cends[j] = start[j+1]; MskConvertColBoundToTag(collb[j], inf, clb[j], cub[j], ctag[j]); } else for(j=0; j < nc; j++) { cends[j] = start[j+1]; MskConvertColBoundToTag( collb[j], colub[j], clb[j], cub[j], ctag[j]); } int err=MSK_inputdata(getLpPtr( OsiMskSolverInterface::KEEPCACHED_NONE ), nr, nc, nr, nc, ob, 0.0, const_cast(start), cends, const_cast(index), const_cast(value), (MSKboundkeye*)rtag, rlb, rub, (MSKboundkeye*)ctag, clb, cub); checkMSKerror( err, "MSK_inputdata", "loadProblem3" ); if( obj == NULL ) delete[] ob; if( nr ) { delete[] rtag; delete[] rlb; delete[] rub; } if( nc ) { delete[] ctag; delete[] cends; delete[] clb; delete[] cub; } resizeColType(nc); CoinFillN(coltype_, nc, 'C'); } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::loadProblem(%d, %d, %p, %p, %p, %p, %p, %p, %p, %p, %p)\n", numcols, numrows, (void *)start, (void *)index, (void *)value, (void *)collb, (void *)colub, (void *)obj, (void *)rowsen, (void *)rowrhs, (void *)rowrng); #endif } //----------------------------------------------------------------------------- // Reads a MPS file with Coin native MPS reader. If marked code is switch on // then MOSEK file reader is used, and .gz files can be read aswell. int OsiMskSolverInterface::readMps(const char * filename, const char * extension ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::readMps(%s, %s) %p\n", filename, extension,(void*)this); debugMessage("End OsiMskSolverInterface::readMps(%s, %s)\n", filename, extension); #endif return OsiSolverInterface::readMps(filename,extension); } //----------------------------------------------------------------------------- // Writes the problem in MPS format, uses MOSEK writer. void OsiMskSolverInterface::writeMps( const char * filename, const char * extension, double objSense ) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::writeMps(%s, %s, %g)\n", filename, extension, objSense); #endif std::string f(filename); std::string e(extension); std::string fullname = f + "." + e; OsiSolverInterface::writeMpsNative(fullname.c_str(),NULL, NULL, 0, 2, objSense); #if 0 int err = MSK_writedata( getMutableLpPtr(), const_cast( fullname.c_str() )); checkMSKerror( err, "MSK_writedatafile", "writeMps" ); #endif #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::writeMps(%s, %s, %g)\n", filename, extension, objSense); #endif } void OsiMskSolverInterface::passInMessageHandler(CoinMessageHandler * handler) { OsiSolverInterface::passInMessageHandler(handler); MSK_linkfunctotaskstream(getMutableLpPtr(), MSK_STREAM_LOG, messageHandler(), OsiMskStreamFuncLog); MSK_linkfunctotaskstream(getMutableLpPtr(), MSK_STREAM_ERR, messageHandler(), OsiMskStreamFuncWarning); MSK_linkfunctotaskstream(getMutableLpPtr(), MSK_STREAM_WRN, messageHandler(), OsiMskStreamFuncError); } //############################################################################# // MSK specific public interfaces //############################################################################# //----------------------------------------------------------------------------- // Returns MOSEK task in the interface object MSKenv_t OsiMskSolverInterface::getEnvironmentPtr() { MSKassert(3,env_ != NULL,"probtypemip_","getEnvironmentPtr"); return env_; } //----------------------------------------------------------------------------- // Returns MOSEK task in the interface object MSKtask_t OsiMskSolverInterface::getLpPtr( int keepCached ) { freeCachedData( keepCached ); return getMutableLpPtr(); } //----------------------------------------------------------------------------- // Returns the coltype_ array const char * OsiMskSolverInterface::getCtype() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getCtype()\n"); debugMessage("End OsiMskSolverInterface::getCtype()\n"); #endif return coltype_; } //############################################################################# // Static instance counter methods //############################################################################# //----------------------------------------------------------------------------- // Increment the instance count, so we know when to close and open MOSEK. void OsiMskSolverInterface::incrementInstanceCounter() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::incrementInstanceCounter()\n"); #endif if ( numInstances_ == 0 ) { int err=0; #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("creating new Mosek environment\n"); #endif #if MSK_VERSION_MAJOR >= 7 err = MSK_makeenv(&env_,NULL); #else err = MSK_makeenv(&env_,NULL,NULL,NULL,NULL); #endif checkMSKerror( err, "MSK_makeenv", "incrementInstanceCounter" ); err = MSK_linkfunctoenvstream(env_, MSK_STREAM_LOG, NULL, printlog); checkMSKerror( err, "MSK_linkfunctoenvstream", "incrementInstanceCounter" ); err = MSK_initenv(env_); checkMSKerror( err, "MSK_initenv", "incrementInstanceCounter" ); } numInstances_++; #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::incrementInstanceCounter()\n"); #endif } //----------------------------------------------------------------------------- // Decrement the instance count, so we know when to close and open MOSEK. void OsiMskSolverInterface::decrementInstanceCounter() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::decrementInstanceCounter()\n"); #endif MSKassert(3,numInstances_ != 0,"numInstances_ != 0","decrementInstanceCounter"); numInstances_--; if ( numInstances_ == 0 ) { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("deleting Mosek environment\n"); #endif int err = MSK_deleteenv(&env_); checkMSKerror( err, "MSK_deleteenv", "decrementInstanceCounter" ); env_ = NULL; } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::decrementInstanceCounter()\n"); #endif } //----------------------------------------------------------------------------- // Returns the number of OsiMskSolverInterface objects in play unsigned int OsiMskSolverInterface::getNumInstances() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getNumInstances()\n"); debugMessage("End OsiMskSolverInterface::getNumInstances()\n"); #endif return numInstances_; } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //----------------------------------------------------------------------------- // Constructor OsiMskSolverInterface::OsiMskSolverInterface(MSKenv_t mskenv) : OsiSolverInterface(), Mskerr(MSK_RES_OK), ObjOffset_(0.0), InitialSolver(INITIAL_SOLVE), task_(NULL), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(1000000), obj_(NULL), collower_(NULL), colupper_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), rowlower_(NULL), rowupper_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL), coltype_(NULL), coltypesize_(0), probtypemip_(false) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::OsiMskSolverinterface()\n"); #endif if (mskenv) { if (env_) { throw CoinError("Already have a global Mosek environment. Cannot use second one.", "OsiMskSolverInterface", "OsiMskSolverInterface"); } env_ = mskenv; ++numInstances_; } else incrementInstanceCounter(); gutsOfConstructor(); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::OsiMskSolverinterface()\n"); #endif } //----------------------------------------------------------------------------- // Clone from one to another object OsiSolverInterface * OsiMskSolverInterface::clone(bool copyData) const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::clone(%d)\n", copyData); debugMessage("End OsiMskSolverInterface::clone(%d)\n", copyData); #endif return( new OsiMskSolverInterface( *this ) ); } //----------------------------------------------------------------------------- // Copy constructor OsiMskSolverInterface::OsiMskSolverInterface( const OsiMskSolverInterface & source ) : OsiSolverInterface(source), Mskerr(MSK_RES_OK), MSKsolverused_(INITIAL_SOLVE), ObjOffset_(source.ObjOffset_), InitialSolver(INITIAL_SOLVE), task_(NULL), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(source.hotStartMaxIteration_), obj_(NULL), collower_(NULL), colupper_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), rowlower_(NULL), rowupper_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL), coltype_(NULL), coltypesize_(0), probtypemip_(false) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::OsiMskSolverInterface from (%p) to %p\n", (void *)&source,(void*)this); #endif incrementInstanceCounter(); gutsOfConstructor(); gutsOfCopy( source ); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::OsiMskSolverInterface(%p)\n", (void *)&source); #endif } //----------------------------------------------------------------------------- // Destructor OsiMskSolverInterface::~OsiMskSolverInterface() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::~OsiMskSolverInterface()\n"); #endif gutsOfDestructor(); decrementInstanceCounter(); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::~OsiMskSolverInterface()\n"); #endif } //----------------------------------------------------------------------------- // Assign operator OsiMskSolverInterface& OsiMskSolverInterface::operator=( const OsiMskSolverInterface& rhs ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::operator=(%p)\n", (void *)&rhs); #endif if (this != &rhs) { OsiSolverInterface::operator=( rhs ); gutsOfDestructor(); gutsOfConstructor(); if ( rhs.task_ !=NULL ) gutsOfCopy( rhs ); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::operator=(%p)\n", (void *)&rhs); #endif return *this; } //############################################################################# // Applying cuts //############################################################################# //----------------------------------------------------------------------------- // Apply col cut void OsiMskSolverInterface::applyColCut( const OsiColCut & cc ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::applyColCut(%p)\n", (void *)&cc); #endif double * MskColLB = new double[getNumCols()]; double * MskColUB = new double[getNumCols()]; const CoinPackedVector & lbs = cc.lbs(); const CoinPackedVector & ubs = cc.ubs(); int i; for( i = 0; i < getNumCols(); ++i ) { MskColLB[i] = getColLower()[i]; MskColUB[i] = getColUpper()[i]; } for( i = 0; i < lbs.getNumElements(); ++i ) if ( lbs.getElements()[i] > MskColLB[lbs.getIndices()[i]] ) setColLower( lbs.getIndices()[i], lbs.getElements()[i] ); for( i = 0; i < ubs.getNumElements(); ++i ) if ( ubs.getElements()[i] < MskColUB[ubs.getIndices()[i]] ) setColUpper( ubs.getIndices()[i], ubs.getElements()[i] ); delete[] MskColLB; delete[] MskColUB; #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::applyColCut(%p)\n", (void *)&cc); #endif } //----------------------------------------------------------------------------- // Apply row cut void OsiMskSolverInterface::applyRowCut( const OsiRowCut & rowCut ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::applyRowCut(%p)\n", (void *)&rowCut); #endif const CoinPackedVector & row=rowCut.row(); addRow(row , rowCut.lb(),rowCut.ub()); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::applyRowCut(%p)\n", (void *)&rowCut); #endif } //############################################################################# // Private methods (non-static and static) and static data //############################################################################# unsigned int OsiMskSolverInterface::numInstances_ = 0; MSKenv_t OsiMskSolverInterface::env_=NULL; //----------------------------------------------------------------------------- // Returns MOSEK task in object MSKtask_t OsiMskSolverInterface::getMutableLpPtr() const { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::getMutableLpPtr()\n"); #endif if ( task_ == NULL ) { MSKassert(3,env_ != NULL,"env_ == NULL","getMutableLpPtr"); int err = MSK_makeemptytask(env_,&task_); checkMSKerror(err, "MSK_makeemptytask","getMutableLpPtr"); err = MSK_linkfunctotaskstream(task_, MSK_STREAM_LOG, messageHandler(), OsiMskStreamFuncLog); checkMSKerror( err, "MSK_linkfunctotaskstream", "getMutableLpPtr" ); err = MSK_linkfunctotaskstream(task_, MSK_STREAM_WRN, messageHandler(), OsiMskStreamFuncWarning); checkMSKerror( err, "MSK_linkfunctotaskstream", "getMutableLpPtr" ); err = MSK_linkfunctotaskstream(task_, MSK_STREAM_ERR, messageHandler(), OsiMskStreamFuncError); checkMSKerror( err, "MSK_linkfunctotaskstream", "getMutableLpPtr" ); err = MSK_putintparam(task_, MSK_IPAR_WRITE_GENERIC_NAMES, MSK_ON); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); err = MSK_putintparam(task_, MSK_IPAR_PRESOLVE_USE, MSK_ON); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); err = MSK_putintparam(task_, MSK_IPAR_WRITE_DATA_FORMAT, MSK_DATA_FORMAT_MPS); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); err = MSK_putintparam(task_, MSK_IPAR_WRITE_GENERIC_NAMES, MSK_ON); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); #if MSK_DO_MOSEK_LOG > 0 char file[] = "MOSEK.log"; err = MSK_linkfiletotaskstream(task_, MSK_STREAM_LOG, file, 0); checkMSKerror( err, "MSK_linkfiletotaskstream", "getMutableLpPtr" ); err = MSK_putintparam(task_, MSK_IPAR_LOG, 100); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); err = MSK_putintparam(task_, MSK_IPAR_LOG_SIM, 100); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); err = MSK_putintparam(task_, MSK_IPAR_LOG_INTPNT, 100); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); #else err = MSK_putintparam(task_, MSK_IPAR_LOG, 100); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); #endif err = MSK_putintparam(task_,MSK_IPAR_SIM_SOLVE_FORM,MSK_SOLVE_PRIMAL); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); err = MSK_putintparam(task_,MSK_IPAR_SIM_HOTSTART,MSK_SIM_HOTSTART_STATUS_KEYS); checkMSKerror(err,"MSK_putintparam","getMutableLpPtr()"); std::string pn; getStrParam(OsiProbName,pn); MSK_puttaskname( task_, const_cast(pn.c_str()) ); checkMSKerror(err,"MSK_puttaskname","getMutableLpPtr()"); } #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::getMutableLpPtr()\n"); #endif return task_; } //----------------------------------------------------------------------------- // Makes a copy void OsiMskSolverInterface::gutsOfCopy( const OsiMskSolverInterface & source ) { #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("Begin OsiMskSolverInterface::gutsOfCopy()\n"); #endif int err; InitialSolver = source.InitialSolver; MSKassert(3, task_ == NULL, "task_ == NULL", "gutsOfCopy"); err = MSK_clonetask(source.getMutableLpPtr(),&task_); checkMSKerror( err, "MSK_clonetask", "gutsOfCopy" ); // Set MIP information resizeColType(source.coltypesize_); CoinDisjointCopyN( source.coltype_, source.coltypesize_, coltype_ ); // Updates task MIP information for( int k = 0; k < source.coltypesize_; ++k ) { switch(coltype_[k]) { case 'I': setInteger(k); break; case 'C': setContinuous(k); break; } } #if MSK_OSI_DEBUG_LEVEL > 1 debugMessage("End OsiMskSolverInterface::gutsOfCopy()\n"); #endif } //----------------------------------------------------------------------------- // Empty function void OsiMskSolverInterface::gutsOfConstructor() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::gutsOfConstructor()\n"); #endif #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::gutsOfConstructor()\n"); #endif } //----------------------------------------------------------------------------- // Function called from destructor void OsiMskSolverInterface::gutsOfDestructor() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::gutsOfDestructor()\n"); #endif freeCachedData(KEEPCACHED_NONE); if ( task_ != NULL ) { MSK_unlinkfuncfromtaskstream(getMutableLpPtr(), MSK_STREAM_LOG); MSK_unlinkfuncfromtaskstream(getMutableLpPtr(), MSK_STREAM_ERR); MSK_unlinkfuncfromtaskstream(getMutableLpPtr(), MSK_STREAM_WRN); int err = MSK_deletetask(&task_); checkMSKerror( err, "MSK_deletetask", "gutsOfDestructor" ); task_ = NULL; freeAllMemory(); } MSKassert(3,task_==NULL,"task_==NULL","gutsOfDestructor"); MSKassert(3,obj_==NULL,"obj_==NULL","gutsOfDestructor"); MSKassert(3,collower_==NULL,"collower_==NULL","gutsOfDestructor"); MSKassert(3,colupper_==NULL,"colupper_==NULL","gutsOfDestructor"); MSKassert(3,rowsense_==NULL,"rowsense_==NULL","gutsOfDestructor"); MSKassert(3,rhs_==NULL,"rhs_==NULL","gutsOfDestructor"); MSKassert(3,rowrange_==NULL,"rowrange_==NULL","gutsOfDestructor"); MSKassert(3,rowlower_==NULL,"rowlower_==NULL","gutsOfDestructor"); MSKassert(3,rowupper_==NULL,"rowupper_==NULL","gutsOfDestructor"); MSKassert(3,colsol_==NULL,"colsol_==NULL","gutsOfDestructor"); MSKassert(3,rowsol_==NULL,"rowsol_==NULL","gutsOfDestructor"); MSKassert(3,redcost_==NULL,"redcost_==NULL","gutsOfDestructor"); MSKassert(3,rowact_==NULL,"rowact_==NULL","gutsOfDestructor"); MSKassert(3,matrixByRow_==NULL,"probtypemip_","gutsOfDestructor"); MSKassert(3,matrixByCol_==NULL,"matrixByCol_==NULL","gutsOfDestructor"); MSKassert(3,coltype_==NULL,"coltype_==NULL","gutsOfDestructor"); MSKassert(3,coltypesize_==0,"coltypesize_==0","gutsOfDestructor"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::gutsOfDestructor()\n"); #endif } //----------------------------------------------------------------------------- // Free function void OsiMskSolverInterface::freeCachedColRim() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::freeCachedColRim()\n"); #endif freeCacheDouble( obj_ ); freeCacheDouble( collower_ ); freeCacheDouble( colupper_ ); MSKassert(3,obj_==NULL,"obj_==NULL","freeCachedColRim"); MSKassert(3,collower_==NULL,"collower_==NULL","freeCachedColRim"); MSKassert(3,colupper_==NULL,"colupper_==NULL","freeCachedColRim"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::freeCachedColRim()\n"); #endif } //----------------------------------------------------------------------------- // Free function void OsiMskSolverInterface::freeCachedRowRim() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::freeCachedRowRim()\n"); #endif freeCacheChar( rowsense_ ); freeCacheDouble( rhs_ ); freeCacheDouble( rowrange_ ); freeCacheDouble( rowlower_ ); freeCacheDouble( rowupper_ ); MSKassert(3,rowsense_==NULL,"rowsense_==NULL","freeCachedRowRim"); MSKassert(3,rhs_==NULL,"rhs_==NULL","freeCachedRowRim"); MSKassert(3,rowrange_==NULL,"rowrange_==NULL","freeCachedRowRim"); MSKassert(3,rowlower_==NULL,"rowlower_==NULL","freeCachedRowRim"); MSKassert(3,rowupper_==NULL,"rowupper_==NULL","freeCachedRowRim"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::freeCachedRowRim()\n"); #endif } //----------------------------------------------------------------------------- // Free function void OsiMskSolverInterface::freeCachedMatrix() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::freeCachedMatrix()\n"); #endif freeCacheMatrix( matrixByRow_ ); freeCacheMatrix( matrixByCol_ ); MSKassert(3,matrixByRow_==NULL,"matrixByRow_==NULL","freeCachedMatrix"); MSKassert(3,matrixByCol_==NULL,"matrixByCol_==NULL","freeCachedMatrix"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::freeCachedMatrix()\n"); #endif } //----------------------------------------------------------------------------- // Free function void OsiMskSolverInterface::freeCachedResults() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::freeCachedResults()\n"); #endif freeCacheDouble( colsol_ ); freeCacheDouble( rowsol_ ); freeCacheDouble( redcost_ ); freeCacheDouble( rowact_ ); MSKassert(3,colsol_==NULL,"colsol_==NULL","freeCachedResults"); MSKassert(3,rowsol_==NULL,"rowsol_==NULL","freeCachedResults"); MSKassert(3,redcost_==NULL,"redcost_==NULL","freeCachedResults"); MSKassert(3,rowact_==NULL,"rowact_==NULL","freeCachedResults"); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::freeCachedResults()\n"); #endif } //----------------------------------------------------------------------------- // Free function void OsiMskSolverInterface::freeCachedData( int keepCached ) { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::freeCachedResults()\n"); #endif if( !(keepCached & OsiMskSolverInterface::KEEPCACHED_COLUMN) ) freeCachedColRim(); if( !(keepCached & OsiMskSolverInterface::KEEPCACHED_ROW) ) freeCachedRowRim(); if( !(keepCached & OsiMskSolverInterface::KEEPCACHED_MATRIX) ) freeCachedMatrix(); if( !(keepCached & OsiMskSolverInterface::KEEPCACHED_RESULTS) ) freeCachedResults(); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::freeCachedResults()\n"); #endif } //----------------------------------------------------------------------------- // Free function void OsiMskSolverInterface::freeAllMemory() { #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("Begin OsiMskSolverInterface::freeCachedResults()\n"); #endif freeCachedData(); if( hotStartCStat_ != NULL ) delete[] hotStartCStat_; if( hotStartRStat_ != NULL ) delete[] hotStartRStat_; hotStartCStat_ = NULL; hotStartCStatSize_ = 0; hotStartRStat_ = NULL; hotStartRStatSize_ = 0; freeColType(); #if MSK_OSI_DEBUG_LEVEL > 3 debugMessage("End OsiMskSolverInterface::freeCachedResults()\n"); #endif } CoinMP-1.8.3/Osi/src/OsiMsk/osi-mosek-uninstalled.pc.in0000644000175000017500000000043611507670402021226 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/OsiMsk Name: OsiMosek Description: COIN-OR Open Solver Interface for Mosek URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsiMsk.la @MSKLIB@ Cflags: -I@abs_source_dir@/src/OsiMsk -I@MSKINCDIR@ Requires: osi CoinMP-1.8.3/Osi/src/OsiMsk/OsiMskSolverInterface.hpp0000644000175000017500000007530412055732267021016 0ustar renerene// Osi interface for Mosek ver. 5.0 // Lower versions are not supported //----------------------------------------------------------------------------- // name: OSI Interface for MOSEK // author: Bo Jensen // email: support@MOSEK.com //----------------------------------------------------------------------------- // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiMskSolverInterface_H #define OsiMskSolverInterface_H #include "OsiSolverInterface.hpp" typedef void* MSKtask_t; typedef void* MSKenv_t; /* MOSEK Solver Interface Instantiation of OsiMskSolverInterface for MOSEK */ class OsiMskSolverInterface : virtual public OsiSolverInterface { friend void OsiMskSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound(); //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Set a string parameter bool setStrParam(OsiStrParam key, const std::string & value); // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; /// Has there been a license problem? virtual bool isLicenseError() const; /// Get rescode return of last Mosek optimizer call int getRescode() const { return Mskerr; } //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ /*! \brief Get an empty warm start object This routine returns an empty CoinWarmStartBasis object. Its purpose is to provide a way to give a client a warm start basis object of the appropriate type, which can resized and modified as desired. */ CoinWarmStart* getEmptyWarmStart () const; //@{ /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching).
The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const; /// Get number of rows virtual int getNumRows() const; /// Get number of nonzero elements virtual int getNumElements() const; /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const; /** Get pointer to array[getNumRows()] of row constraint senses.
  • 'L': <= constraint
  • 'E': = constraint
  • 'G': >= constraint
  • 'R': ranged constraint
  • 'N': free constraint
*/ virtual const char * getRowSense() const; /** Get pointer to array[getNumRows()] of rows right-hand sides
  • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
  • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'N' then rhs()[i] == 0.0
*/ virtual const double * getRightHandSide() const; /** Get pointer to array[getNumRows()] of row ranges.
  • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
  • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
*/ virtual const double * getRowRange() const; /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const; /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const; /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const; /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const; /// Return true if column is continuous virtual bool isContinuous(int colNumber) const; #if 0 /// Return true if column is binary virtual bool isBinary(int columnNumber) const; /** Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ virtual bool isInteger(int columnNumber) const; /// Return true if column is general integer virtual bool isIntegerNonBinary(int columnNumber) const; /// Return true if column is binary and not fixed at either bound virtual bool isFreeBinary(int columnNumber) const; #endif /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const; //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const; /// Get objective function value virtual double getObjValue() const; /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const; /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay=false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; #if 0 /** Get vector of indices of solution which are integer variables presently at fractional values */ virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const; #endif //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ); /** Set a a set of objective function coefficients */ virtual void setObjCoeffSet(const int* indexFirst, const int* indexLast, const double* coeffList); /** Set a single column lower bound
Use -COIN_DBL_MAX for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ); /** Set a single column upper bound
Use COIN_DBL_MAX for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound
The default implementation just invokes setColLower() and setColUpper() */ virtual void setColBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
The default implementation just invokes setCollower() and setColupper() over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound
Use -COIN_DBL_MAX for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
Use COIN_DBL_MAX for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ); /** Set a single row lower and upper bound
The default implementation just invokes setRowLower() and setRowUpper() */ virtual void setRowBounds( int elementIndex, double lower, double upper ); /** Set the type of a single row
*/ virtual void setRowType(int index, char sense, double rightHandSide, double range); /** Set the bounds on a number of rows simultaneously
The default implementation just invokes setRowLower() and setRowUpper() over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
The default implementation just invokes setRowType() and over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose type changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s); /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); /** */ virtual void deleteCols(const int num, const int * colIndices); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); /** */ virtual void deleteRows(const int num, const int * rowIndices); #if 0 // ??? implemented in OsiSolverInterface //----------------------------------------------------------------------- /** Apply a collection of cuts.
Only cuts which have an effectiveness >= effectivenessLb are applied.
  • ReturnCode.numberIneffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
  • ReturnCode.numberInconsistent() -- number of invalid cuts
  • ReturnCode.numberInconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
  • ReturnCode.numberInfeasible() -- number of cuts that would make this integer model infeasible
  • ReturnCode.numberApplied() -- number of integer cuts which were applied to the integer model
  • cs.size() == numberIneffective() + numberInconsistent() + numberInconsistentWrtIntegerModel() + numberInfeasible() + nubmerApplied()
*/ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); #endif //@} //@} //--------------------------------------------------------------------------- /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient
*/ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • obj: all variables have 0 objective coefficient
  • rowsen: all rows are >=
  • rowrhs: all right hand sides are 0
  • rowrng: 0 for the ranged rows
*/ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Read an mps file from the given filename */ virtual int readMps(const char *filename, const char *extension = "mps"); /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; //@} /**@name Message handling */ //@{ /** Pass in a message handler It is the client's responsibility to destroy a message handler installed by this routine; it will not be destroyed when the solver interface is destroyed. */ void passInMessageHandler(CoinMessageHandler * handler); //@} //--------------------------------------------------------------------------- /**@name MOSEK specific public interfaces */ //@{ /** Get pointer to MOSEK model and free all specified cached data entries (combined with logical or-operator '|' ): */ enum keepCachedFlag { /// discard all cached data (default) KEEPCACHED_NONE = 0, /// column information: objective values, lower and upper bounds, variable types KEEPCACHED_COLUMN = 1, /// row information: right hand sides, ranges and senses, lower and upper bounds for row KEEPCACHED_ROW = 2, /// problem matrix: matrix ordered by column and by row KEEPCACHED_MATRIX = 4, /// LP solution: primal and dual solution, reduced costs, row activities KEEPCACHED_RESULTS = 8, /// only discard cached LP solution KEEPCACHED_PROBLEM = KEEPCACHED_COLUMN | KEEPCACHED_ROW | KEEPCACHED_MATRIX, /// keep all cached data (similar to getMutableLpPtr()) KEEPCACHED_ALL = KEEPCACHED_PROBLEM | KEEPCACHED_RESULTS, /// free only cached column and LP solution information FREECACHED_COLUMN = KEEPCACHED_PROBLEM & ~KEEPCACHED_COLUMN, /// free only cached row and LP solution information FREECACHED_ROW = KEEPCACHED_PROBLEM & ~KEEPCACHED_ROW, /// free only cached matrix and LP solution information FREECACHED_MATRIX = KEEPCACHED_PROBLEM & ~KEEPCACHED_MATRIX, /// free only cached LP solution information FREECACHED_RESULTS = KEEPCACHED_ALL & ~KEEPCACHED_RESULTS }; MSKtask_t getLpPtr( int keepCached = KEEPCACHED_NONE ); //@{ /// Method to access MOSEK environment pointer MSKenv_t getEnvironmentPtr(); //@} /// return a vector of variable types (continous, binary, integer) const char* getCtype() const; /**@name Static instance counter methods */ /** MOSEK has a context which must be created prior to all other MOSEK calls. This method:
  • Increments by 1 the number of uses of the MOSEK environment.
  • Creates the MOSEK context when the number of uses is change to 1 from 0.
*/ static void incrementInstanceCounter(); /** MOSEK has a context which should be deleted after MOSEK calls. This method:
  • Decrements by 1 the number of uses of the MOSEK environment.
  • Deletes the MOSEK context when the number of uses is change to 0 from 1.
*/ static void decrementInstanceCounter(); /// Return the number of instances of instantiated objects using MOSEK services. static unsigned int getNumInstances(); //@} //@} /**@name Constructors and destructor */ //@{ /// Default Constructor /// optional argument mskenv can be used to reach in an initialized user environment /// OsiMsk assumes membership of mskenv, so it will be freed when the last instanciation of OsiMsk is deleted OsiMskSolverInterface(MSKenv_t mskenv = NULL); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiMskSolverInterface( const OsiMskSolverInterface& ); /// Assignment operator OsiMskSolverInterface& operator=( const OsiMskSolverInterface& rhs ); /// Destructor virtual ~OsiMskSolverInterface(); //@} protected: /**@name Protected methods */ //@{ /// Apply a row cut. Return true if cut was applied. virtual void applyRowCut( const OsiRowCut & rc ); /** Apply a column cut (bound adjustment). Return true if cut was applied. */ virtual void applyColCut( const OsiColCut & cc ); //@} private: /**@name Private static class functions */ //@{ /// switches MOSEK to prob type LP void switchToLP(); /// switches MOSEK to prob type MIP void switchToMIP(); /// resizes coltype_ vector to be able to store at least minsize elements void resizeColType( int minsize ); /// frees colsize_ vector void freeColType(); bool definedSolution(int solution) const; int solverUsed() const; //@} /**@name Private static class data */ //@{ /// MOSEK environment pointer static MSKenv_t env_ ; /// Number of live problem instances //static unsigned int numInstances_; //@} static unsigned int numInstances_; /**@name Private methods */ //@{ int Mskerr; int MSKsolverused_; double ObjOffset_; int InitialSolver; /// Get task Pointer for const methods public: MSKtask_t getMutableLpPtr() const; /// The real work of a copy constructor (used by copy and assignment) void gutsOfCopy( const OsiMskSolverInterface & source ); /// The real work of the constructor void gutsOfConstructor(); /// The real work of the destructor void gutsOfDestructor(); /// free cached column rim vectors void freeCachedColRim(); /// free cached row rim vectors void freeCachedRowRim(); /// free cached result vectors void freeCachedResults(); /// free cached matrices void freeCachedMatrix(); /// free all cached data (except specified entries, see getLpPtr()) void freeCachedData( int keepCached = KEEPCACHED_NONE ); /// free all allocated memory void freeAllMemory(); /**@name Private member data */ //@{ /// MOSEK model represented by this class instance mutable MSKtask_t task_; /// Hotstart information int *hotStartCStat_; int hotStartCStatSize_; int *hotStartRStat_; int hotStartRStatSize_; int hotStartMaxIteration_; /**@name Cached information derived from the MOSEK model */ //@{ /// Pointer to objective vector mutable double *obj_; /// Pointer to dense vector of variable lower bounds mutable double *collower_; /// Pointer to dense vector of variable lower bounds mutable double *colupper_; /// Pointer to dense vector of row sense indicators mutable char *rowsense_; /// Pointer to dense vector of row right-hand side values mutable double *rhs_; /// Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) mutable double *rowrange_; /// Pointer to dense vector of row lower bounds mutable double *rowlower_; /// Pointer to dense vector of row upper bounds mutable double *rowupper_; /// Pointer to primal solution vector mutable double *colsol_; /// Pointer to dual solution vector mutable double *rowsol_; /// Pointer to reduced cost vector mutable double *redcost_; /// Pointer to row activity (slack) vector mutable double *rowact_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByRow_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByCol_; //@} /**@name Additional information needed for storing MIP problems */ //@{ /// Pointer to dense vector of variable types (continous, binary, integer) char *coltype_; /// Size of allocated memory for coltype_ int coltypesize_; /// Stores whether MOSEK' prob type is currently set to MIP mutable bool probtypemip_; //@} }; //############################################################################# /** A function that tests the methods in the OsiMskSolverInterface class */ void OsiMskSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Osi/src/OsiCpx/0000755000175000017500000000000012600453455014046 5ustar renereneCoinMP-1.8.3/Osi/src/OsiCpx/Makefile.in0000644000175000017500000005466312506051753016131 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/OsiCpx DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Osi/config.h \ $(top_builddir)/src/Osi/config_osi.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libOsiCpx_la_LIBADD = am_libOsiCpx_la_OBJECTS = OsiCpxSolverInterface.lo libOsiCpx_la_OBJECTS = $(am_libOsiCpx_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsiCpx_la_SOURCES) DIST_SOURCES = $(libOsiCpx_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiCpx # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiCpx.la # List all source files for this library, including headers libOsiCpx_la_SOURCES = \ OsiCpxSolverInterface.cpp OsiCpxSolverInterface.hpp # This is for libtool (on Windows) libOsiCpx_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(CPXINCDIR)` \ -I`$(CYGPATH_W) $(srcdir)/../Osi` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiCpxSolverInterface.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/OsiCpx/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/OsiCpx/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsiCpx.la: $(libOsiCpx_la_OBJECTS) $(libOsiCpx_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsiCpx_la_LDFLAGS) $(libOsiCpx_la_OBJECTS) $(libOsiCpx_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiCpxSolverInterface.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool 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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # 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: CoinMP-1.8.3/Osi/src/OsiCpx/osi-cplex.pc.in0000644000175000017500000000046511510106235016675 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiCplex Description: COIN-OR Open Solver Interface for CPLEX URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiCpx @CPXLIB@ Cflags: -I${includedir} -I@CPXINCDIR@ Requires: osi CoinMP-1.8.3/Osi/src/OsiCpx/Makefile.am0000644000175000017500000000314011621722556016103 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1800 2011-08-14 10:37:34Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiCpx # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiCpx.la # List all source files for this library, including headers libOsiCpx_la_SOURCES = \ OsiCpxSolverInterface.cpp OsiCpxSolverInterface.hpp # This is for libtool (on Windows) libOsiCpx_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(CPXINCDIR)` \ -I`$(CYGPATH_W) $(srcdir)/../Osi` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiCpxSolverInterface.hpp CoinMP-1.8.3/Osi/src/OsiCpx/osi-cplex-uninstalled.pc.in0000644000175000017500000000043611507670402021223 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/OsiCpx Name: OsiCplex Description: COIN-OR Open Solver Interface for CPLEX URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsiCpx.la @CPXLIB@ Cflags: -I@abs_source_dir@/src/OsiCpx -I@CPXINCDIR@ Requires: osi CoinMP-1.8.3/Osi/src/OsiCpx/OsiCpxSolverInterface.cpp0000644000175000017500000034234512574576363021024 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for CPLEX // author: Tobias Pfender // Konrad-Zuse-Zentrum Berlin (Germany) // email: pfender@zib.de // date: 09/25/2000 // license: this file may be freely distributed under the terms of EPL // comments: please scan this file for '???' and read the comments //----------------------------------------------------------------------------- // Copyright (C) 2000, Tobias Pfender, International Business Machines // Corporation and others. All Rights Reserved. #include #include #include #include #include "CoinPragma.hpp" #include "OsiCpxSolverInterface.hpp" #include "cplex.h" // CPLEX 10.0 removed CPXERR_NO_INT_SOLN #if !defined(CPXERR_NO_INT_SOLN) #define CPXERR_NO_INT_SOLN CPXERR_NO_SOLN #endif // #define DEBUG 1 #ifdef DEBUG #define debugMessage printf #else #define debugMessage if( false ) printf #endif //############################################################################# // A couple of helper functions //############################################################################# inline void freeCacheDouble( double*& ptr ) { if( ptr != NULL ) { delete [] ptr; ptr = NULL; } } inline void freeCacheChar( char*& ptr ) { if( ptr != NULL ) { delete [] ptr; ptr = NULL; } } inline void freeCacheMatrix( CoinPackedMatrix*& ptr ) { if( ptr != NULL ) { delete ptr; ptr = NULL; } } static inline void checkCPXerror( int err, std::string cpxfuncname, std::string osimethod ) { if( err != 0 ) { char s[100]; sprintf( s, "%s returned error %d", cpxfuncname.c_str(), err ); #ifdef DEBUG std::cerr << "ERROR: " << s << " (" << osimethod << " in OsiCpxSolverInterface)" << std::endl; #endif throw CoinError( s, osimethod.c_str(), "OsiCpxSolverInterface" ); } } static bool incompletemessage = false; static void CPXPUBLIC OsiCpxMessageCallbackPrint(CoinMessageHandler* handler, const char* msg) { /* cplex adds the newlines into their message, while the coin message handler like to add its own newlines * we treat the cases where there is a newline in the beginning or no newline at the end separately * TODO a better way is to scan msg for newlines and to send each line to the handler separately */ if( msg[0] == '\n' ) { if (incompletemessage) { *handler << CoinMessageEol; incompletemessage = false; } else handler->message(0, "CPX", " ", ' ') << CoinMessageEol; ++msg; if(!*msg) return; } size_t len = strlen(msg); assert(len > 0); if( msg[len-1] == '\n') { (const_cast(msg))[len-1] = '\0'; if (incompletemessage) { *handler << msg << CoinMessageEol; incompletemessage = false; } else handler->message(0, "CPX", msg, ' ') << CoinMessageEol; } else { handler->message(0, "CPX", msg, ' '); incompletemessage = true; } } static void CPXPUBLIC OsiCpxMessageCallbackResultLog(void* handle, const char* msg) { if (!*msg) return; if (handle) { if( ((CoinMessageHandler*)handle)->logLevel() >= 1 ) OsiCpxMessageCallbackPrint((CoinMessageHandler*)handle, msg); } else { printf(msg); } } static void CPXPUBLIC OsiCpxMessageCallbackWarning(void* handle, const char* msg) { if (handle) { if( ((CoinMessageHandler*)handle)->logLevel() >= 0 ) OsiCpxMessageCallbackPrint((CoinMessageHandler*)handle, msg); } else { printf(msg); } } static void CPXPUBLIC OsiCpxMessageCallbackError(void* handle, const char* msg) { if (handle) { OsiCpxMessageCallbackPrint((CoinMessageHandler*)handle, msg); } else { fprintf(stderr, msg); } } void OsiCpxSolverInterface::switchToLP( void ) { debugMessage("OsiCpxSolverInterface::switchToLP()\n"); if( probtypemip_ ) { CPXLPptr lp = getMutableLpPtr(); #if CPX_VERSION >= 800 assert(CPXgetprobtype(env_,lp) == CPXPROB_MILP); #else assert(CPXgetprobtype(env_,lp) == CPXPROB_MIP); #endif int err = CPXchgprobtype( env_, lp, CPXPROB_LP ); checkCPXerror( err, "CPXchgprobtype", "switchToLP" ); probtypemip_ = false; } } void OsiCpxSolverInterface::switchToMIP( void ) { debugMessage("OsiCpxSolverInterface::switchToMIP()\n"); if( !probtypemip_ ) { CPXLPptr lp = getMutableLpPtr(); int nc = getNumCols(); int *cindarray = new int[nc]; assert(CPXgetprobtype(env_,lp) == CPXPROB_LP); assert(coltype_ != NULL); for( int i = 0; i < nc; ++i ) cindarray[i] = i; #if CPX_VERSION >= 800 int err = CPXchgprobtype( env_, lp, CPXPROB_MILP ); #else int err = CPXchgprobtype( env_, lp, CPXPROB_MIP ); #endif checkCPXerror( err, "CPXchgprobtype", "switchToMIP" ); err = CPXchgctype( env_, lp, nc, cindarray, coltype_ ); checkCPXerror( err, "CPXchgctype", "switchToMIP" ); delete[] cindarray; probtypemip_ = true; } } void OsiCpxSolverInterface::resizeColType( int minsize ) { debugMessage("OsiCpxSolverInterface::resizeColType()\n"); if( minsize > coltypesize_ ) { int newcoltypesize = 2*coltypesize_; if( minsize > newcoltypesize ) newcoltypesize = minsize; char *newcoltype = new char[newcoltypesize]; if( coltype_ != NULL ) { CoinDisjointCopyN( coltype_, coltypesize_, newcoltype ); delete[] coltype_; } coltype_ = newcoltype; coltypesize_ = newcoltypesize; } assert(minsize == 0 || coltype_ != NULL); assert(coltypesize_ >= minsize); } void OsiCpxSolverInterface::freeColType() { debugMessage("OsiCpxSolverInterface::freeColType()\n"); if( coltypesize_ > 0 ) { delete[] coltype_; coltype_ = NULL; coltypesize_ = 0; } assert(coltype_ == NULL); } //############################################################################# // Solve methods //############################################################################# void OsiCpxSolverInterface::initialSolve() { debugMessage("OsiCpxSolverInterface::initialSolve()\n"); switchToLP(); bool takeHint; OsiHintStrength strength; int algorithm = 0; getHintParam(OsiDoDualInInitial,takeHint,strength); if (strength!=OsiHintIgnore) algorithm = takeHint ? -1 : 1; int presolve = 1; getHintParam(OsiDoPresolveInInitial,takeHint,strength); if (strength!=OsiHintIgnore) presolve = takeHint ? 1 : 0; CPXLPptr lp = getLpPtr( OsiCpxSolverInterface::FREECACHED_RESULTS ); if (presolve) CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_ON ); else CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_OFF ); // if (messageHandler()->logLevel() == 0) // CPXsetintparam( env_, CPX_PARAM_SCRIND, CPX_OFF ); // else // CPXsetintparam( env_, CPX_PARAM_SCRIND, CPX_ON ); if (messageHandler()->logLevel() == 0) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 0 ); else if (messageHandler()->logLevel() == 1) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 1 ); else if (messageHandler()->logLevel() > 1) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 2 ); CPXsetintparam( env_, CPX_PARAM_ADVIND, !disableadvbasis ); double objoffset; double primalobjlimit; double dualobjlimit; getDblParam(OsiObjOffset, objoffset); getDblParam(OsiPrimalObjectiveLimit, primalobjlimit); getDblParam(OsiDualObjectiveLimit, dualobjlimit); if (getObjSense() == +1) { if (primalobjlimit < COIN_DBL_MAX) CPXsetdblparam(env_, CPX_PARAM_OBJLLIM, primalobjlimit + objoffset); if (dualobjlimit > -COIN_DBL_MAX) CPXsetdblparam(env_, CPX_PARAM_OBJULIM, dualobjlimit + objoffset); } else { if (primalobjlimit > -COIN_DBL_MAX) CPXsetdblparam(env_, CPX_PARAM_OBJULIM, primalobjlimit + objoffset); if (dualobjlimit < COIN_DBL_MAX) CPXsetdblparam(env_, CPX_PARAM_OBJLLIM, dualobjlimit + objoffset); } int term; switch( algorithm ) { default: case 0: term = CPXlpopt(env_, lp); #if CPX_VERSION >= 800 checkCPXerror( term, "CPXlpopt", "initialSolve" ); #endif break; case 1: term = CPXprimopt( env_, lp ); #if CPX_VERSION >= 800 checkCPXerror( term, "CPXprimopt", "initialSolve" ); #endif break; case -1: term = CPXdualopt( env_, lp ); #if CPX_VERSION >= 800 checkCPXerror( term, "CPXdualopt", "initialSolve" ); #endif break; } /* If the problem is found infeasible during presolve, resolve it to get a proper term code */ #if CPX_VERSION >= 800 int stat = CPXgetstat( env_, getMutableLpPtr() ); if (stat == CPX_STAT_INForUNBD && presolve) { CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_OFF ); switch( algorithm ) { default: case 0: term = CPXlpopt(env_, lp); checkCPXerror( term, "CPXlpopt", "initialSolve" ); break; case 1: term = CPXprimopt( env_, lp ); checkCPXerror( term, "CPXprimopt", "initialSolve" ); break; case -1: term = CPXdualopt( env_, lp ); checkCPXerror( term, "CPXdualopt", "initialSolve" ); break; } CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_ON ); } #else if (term == CPXERR_PRESLV_INForUNBD && presolve) { CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_OFF ); switch( algorithm ) { default: case 0: term = CPXlpopt(env_, lp); break; case 1: term = CPXprimopt( env_, lp ); break; case -1: term = CPXdualopt( env_, lp ); break; } CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_ON ); } #endif disableadvbasis = false; } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::resolve() { debugMessage("OsiCpxSolverInterface::resolve()\n"); switchToLP(); bool takeHint; OsiHintStrength strength; int algorithm = 0; getHintParam(OsiDoDualInResolve,takeHint,strength); if (strength!=OsiHintIgnore) algorithm = takeHint ? -1 : 1; int presolve = 0; getHintParam(OsiDoPresolveInResolve,takeHint,strength); if (strength!=OsiHintIgnore) presolve = takeHint ? 1 : 0; CPXLPptr lp = getLpPtr( OsiCpxSolverInterface::FREECACHED_RESULTS ); if (presolve) CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_ON ); else CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_OFF ); // if (messageHandler()->logLevel() == 0) // CPXsetintparam( env_, CPX_PARAM_SCRIND, CPX_OFF ); // else // CPXsetintparam( env_, CPX_PARAM_SCRIND, CPX_ON ); if (messageHandler()->logLevel() == 0) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 0 ); else if (messageHandler()->logLevel() == 1) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 1 ); else if (messageHandler()->logLevel() > 1) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 2 ); CPXsetintparam( env_, CPX_PARAM_ADVIND, !disableadvbasis ); int term; switch( algorithm ) { default: case 0: term = CPXlpopt(env_, lp); #if CPX_VERSION >= 800 checkCPXerror( term, "CPXlpopt", "resolve" ); #endif break; case 1: term = CPXprimopt( env_, lp ); #if CPX_VERSION >= 800 checkCPXerror( term, "CPXprimopt", "resolve" ); #endif break; case -1: term = CPXdualopt( env_, lp ); #if CPX_VERSION >= 800 checkCPXerror( term, "CPXdualopt", "resolve" ); #endif break; } /* If the problem is found infeasible during presolve, resolve it to get a proper term code */ #if CPX_VERSION >= 800 int stat = CPXgetstat( env_, getMutableLpPtr() ); if (stat == CPX_STAT_INForUNBD && presolve){ CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_OFF ); switch( algorithm ) { default: case 0: term = CPXlpopt(env_, lp); checkCPXerror( term, "CPXlpopt", "resolve" ); break; case 1: term = CPXprimopt( env_, lp ); checkCPXerror( term, "CPXprimopt", "resolve" ); break; case -1: term = CPXdualopt( env_, lp ); checkCPXerror( term, "CPXdualopt", "resolve" ); break; } CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_ON ); } #else if (term == CPXERR_PRESLV_INForUNBD && presolve){ CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_OFF ); switch( algorithm ) { default: case 0: term = CPXlpopt(env_, lp); checkCPXerror( term, "CPXlpopt", "resolve" ); break; case 1: term = CPXprimopt( env_, lp ); checkCPXerror( term, "CPXprimopt", "resolve" ); break; case -1: term = CPXdualopt( env_, lp ); checkCPXerror( term, "CPXdualopt", "resolve" ); break; } CPXsetintparam( env_, CPX_PARAM_PREIND, CPX_ON ); } #endif disableadvbasis = false; } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::branchAndBound() { int term; debugMessage("OsiCpxSolverInterface::branchAndBound()\n"); switchToMIP(); if( colsol_ != NULL && domipstart ) { int ncols = getNumCols(); int* ind = new int[ncols]; CoinIotaN(ind, ncols, 0); term = CPXcopymipstart(env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_ALL ), ncols, ind, colsol_); checkCPXerror(term, "CPXcopymipstart", "branchAndBound"); delete[] ind; CPXsetintparam( env_, CPX_PARAM_ADVIND, CPX_ON ); } else CPXsetintparam( env_, CPX_PARAM_ADVIND, CPX_OFF ); CPXLPptr lp = getLpPtr( OsiCpxSolverInterface::FREECACHED_RESULTS ); // if (messageHandler()->logLevel() == 0) // CPXsetintparam( env_, CPX_PARAM_SCRIND, CPX_OFF ); // else // CPXsetintparam( env_, CPX_PARAM_SCRIND, CPX_ON ); if (messageHandler()->logLevel() == 0) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 0 ); else if (messageHandler()->logLevel() == 1) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 1 ); else if (messageHandler()->logLevel() > 1) CPXsetintparam( env_, CPX_PARAM_SIMDISPLAY, 2 ); term = CPXmipopt( env_, lp ); checkCPXerror( term, "CPXmipopt", "branchAndBound" ); } //############################################################################# // Parameter related methods //############################################################################# bool OsiCpxSolverInterface::setIntParam(OsiIntParam key, int value) { debugMessage("OsiCpxSolverInterface::setIntParam(%d, %d)\n", key, value); bool retval = false; switch (key) { case OsiMaxNumIteration: retval = ( CPXsetintparam( env_, CPX_PARAM_ITLIM, value ) == 0 ); // ??? OsiMaxNumIteration == #Simplex-iterations ??? break; case OsiMaxNumIterationHotStart: if( value >= 0 ) { hotStartMaxIteration_ = value; retval = true; } else retval = false; break; case OsiNameDiscipline: retval = OsiSolverInterface::setIntParam(key,value); break; case OsiLastIntParam: retval = false; break; default: retval = false ; break ; } return retval; } //----------------------------------------------------------------------------- bool OsiCpxSolverInterface::setDblParam(OsiDblParam key, double value) { debugMessage("OsiCpxSolverInterface::setDblParam(%d, %g)\n", key, value); bool retval = false; switch (key) { case OsiDualTolerance: retval = ( CPXsetdblparam( env_, CPX_PARAM_EPOPT, value ) == 0 ); // ??? OsiDualTolerance == CPLEX Optimality tolerance ??? break; case OsiPrimalTolerance: retval = ( CPXsetdblparam( env_, CPX_PARAM_EPRHS, value ) == 0 ); // ??? OsiPrimalTolerance == CPLEX Feasibility tolerance ??? break; case OsiDualObjectiveLimit: case OsiPrimalObjectiveLimit: case OsiObjOffset: retval = OsiSolverInterface::setDblParam(key,value); break; case OsiLastDblParam: retval = false; break; default: retval = false ; break ; } return retval; } //----------------------------------------------------------------------------- bool OsiCpxSolverInterface::setStrParam(OsiStrParam key, const std::string & value) { debugMessage("OsiCpxSolverInterface::setStrParam(%d, %s)\n", key, value.c_str()); bool retval=false; switch (key) { case OsiProbName: OsiSolverInterface::setStrParam(key,value); return retval = true; case OsiSolverName: return false; case OsiLastStrParam: return false; default: return false ; } return false; } //----------------------------------------------------------------------------- bool OsiCpxSolverInterface::getIntParam(OsiIntParam key, int& value) const { debugMessage("OsiCpxSolverInterface::getIntParam(%d)\n", key); bool retval = false; switch (key) { case OsiMaxNumIteration: retval = ( CPXgetintparam( env_, CPX_PARAM_ITLIM, &value ) == 0 ); // ??? OsiMaxNumIteration == #Simplex-iterations ??? break; case OsiMaxNumIterationHotStart: value = hotStartMaxIteration_; retval = true; break; case OsiNameDiscipline: retval = OsiSolverInterface::getIntParam(key,value); break; case OsiLastIntParam: retval = false; break; default: retval = false ; break ; } return retval; } //----------------------------------------------------------------------------- bool OsiCpxSolverInterface::getDblParam(OsiDblParam key, double& value) const { debugMessage("OsiCpxSolverInterface::getDblParam(%d)\n", key); bool retval = false; switch (key) { case OsiDualTolerance: retval = ( CPXgetdblparam( env_, CPX_PARAM_EPOPT, &value ) == 0 ); // ??? OsiDualTolerance == CPLEX Optimality tolerance ??? break; case OsiPrimalTolerance: retval = ( CPXgetdblparam( env_, CPX_PARAM_EPRHS, &value ) == 0 ); // ??? OsiPrimalTolerance == CPLEX Feasibility tolerance ??? break; case OsiDualObjectiveLimit: case OsiPrimalObjectiveLimit: case OsiObjOffset: retval = OsiSolverInterface::getDblParam(key, value); break; case OsiLastDblParam: retval = false; break; default: retval = false ; break ; } return retval; } //----------------------------------------------------------------------------- bool OsiCpxSolverInterface::getStrParam(OsiStrParam key, std::string & value) const { debugMessage("OsiCpxSolverInterface::getStrParam(%d)\n", key); switch (key) { case OsiProbName: OsiSolverInterface::getStrParam(key, value); break; case OsiSolverName: value = "cplex"; break; case OsiLastStrParam: return false; default: return false ; } return true; } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# bool OsiCpxSolverInterface::isAbandoned() const { debugMessage("OsiCpxSolverInterface::isAbandoned()\n"); int stat = CPXgetstat( env_, getMutableLpPtr() ); #if CPX_VERSION >= 800 return (stat == 0 || stat == CPX_STAT_NUM_BEST || stat == CPX_STAT_ABORT_USER); #else return (stat == 0 || stat == CPX_NUM_BEST_FEAS || stat == CPX_NUM_BEST_INFEAS || stat == CPX_ABORT_FEAS || stat == CPX_ABORT_INFEAS || stat == CPX_ABORT_CROSSOVER); #endif } bool OsiCpxSolverInterface::isProvenOptimal() const { debugMessage("OsiCpxSolverInterface::isProvenOptimal()\n"); int stat = CPXgetstat( env_, getMutableLpPtr() ); #if CPX_VERSION >= 800 return ((probtypemip_ == false && (stat == CPX_STAT_OPTIMAL || stat == CPX_STAT_OPTIMAL_INFEAS)) || (probtypemip_ == true && (stat == CPXMIP_OPTIMAL || stat == CPXMIP_OPTIMAL_TOL))); #else return ((probtypemip_ == false && (stat == CPX_OPTIMAL || stat == CPX_OPTIMAL_INFEAS)) || (probtypemip_ == true && stat == CPXMIP_OPTIMAL)); #endif } bool OsiCpxSolverInterface::isProvenPrimalInfeasible() const { debugMessage("OsiCpxSolverInterface::isProvenPrimalInfeasible()\n"); int stat = CPXgetstat( env_, getMutableLpPtr() ); #if CPX_VERSION >= 800 // In CPLEX 8, the return code is with respect // to the original problem, regardless of the algorithm used to solve it // --tkr 7/31/03 return (stat == CPX_STAT_INFEASIBLE); // return (method == CPX_ALG_PRIMAL && stat == CPX_STAT_INFEASIBLE || // method == CPX_ALG_DUAL && stat == CPX_STAT_UNBOUNDED); #else int method = CPXgetmethod( env_, getMutableLpPtr() ); return ((method == CPX_ALG_PRIMAL && stat == CPX_INFEASIBLE) || (method == CPX_ALG_DUAL && stat == CPX_UNBOUNDED) || stat == CPX_ABORT_PRIM_INFEAS || stat == CPX_ABORT_PRIM_DUAL_INFEAS); #endif } bool OsiCpxSolverInterface::isProvenDualInfeasible() const { debugMessage("OsiCpxSolverInterface::isProvenDualInfeasible()\n"); int stat = CPXgetstat( env_, getMutableLpPtr() ); #if CPX_VERSION >= 800 // In CPLEX 8, the return code is with respect // to the original problem, regardless of the algorithm used to solve it // --tkr 7/31/03 return (stat == CPX_STAT_UNBOUNDED); //return (method == CPX_ALG_PRIMAL && stat == CPX_STAT_UNBOUNDED || // method == CPX_ALG_DUAL && stat == CPX_STAT_INFEASIBLE); #else int method = CPXgetmethod( env_, getMutableLpPtr() ); return ((method == CPX_ALG_PRIMAL && stat == CPX_UNBOUNDED) || (method == CPX_ALG_DUAL && stat == CPX_INFEASIBLE) || stat == CPX_ABORT_DUAL_INFEAS || stat == CPX_ABORT_PRIM_DUAL_INFEAS); #endif } bool OsiCpxSolverInterface::isPrimalObjectiveLimitReached() const { debugMessage("OsiCpxSolverInterface::isPrimalObjectiveLimitReached()\n"); int stat = CPXgetstat( env_, getMutableLpPtr() ); int method = CPXgetmethod( env_, getMutableLpPtr() ); #if CPX_VERSION >= 800 return method == CPX_ALG_PRIMAL && stat == CPX_STAT_ABORT_OBJ_LIM; #else return method == CPX_ALG_PRIMAL && stat == CPX_OBJ_LIM; #endif } bool OsiCpxSolverInterface::isDualObjectiveLimitReached() const { debugMessage("OsiCpxSolverInterface::isDualObjectiveLimitReached()\n"); int stat = CPXgetstat( env_, getMutableLpPtr() ); int method = CPXgetmethod( env_, getMutableLpPtr() ); #if CPX_VERSION >= 800 return method == CPX_ALG_DUAL && stat == CPX_STAT_ABORT_OBJ_LIM; #else return method == CPX_ALG_DUAL && stat == CPX_OBJ_LIM; #endif } bool OsiCpxSolverInterface::isIterationLimitReached() const { debugMessage("OsiCpxSolverInterface::isIterationLimitReached()\n"); int stat = CPXgetstat( env_, getMutableLpPtr() ); #if CPX_VERSION >= 800 return stat == CPX_STAT_ABORT_IT_LIM; #else return stat == CPX_IT_LIM_FEAS || stat == CPX_IT_LIM_INFEAS; #endif } //############################################################################# // WarmStart related methods //############################################################################# CoinWarmStart* OsiCpxSolverInterface::getEmptyWarmStart () const { return (dynamic_cast(new CoinWarmStartBasis())) ; } CoinWarmStart* OsiCpxSolverInterface::getWarmStart() const { debugMessage("OsiCpxSolverInterface::getWarmStart()\n"); if( probtypemip_ ) return getEmptyWarmStart(); CoinWarmStartBasis* ws = NULL; int numcols = getNumCols(); int numrows = getNumRows(); int *cstat = new int[numcols]; int *rstat = new int[numrows]; char* sense = new char[numrows]; int restat, i; restat = CPXgetsense(env_, getMutableLpPtr(), sense, 0, numrows-1); if( restat == 0 ) restat = CPXgetbase( env_, getMutableLpPtr(), cstat, rstat ); if( restat == 0 ) { ws = new CoinWarmStartBasis; ws->setSize( numcols, numrows ); for( i = 0; i < numrows; ++i ) { switch( rstat[i] ) { case CPX_BASIC: ws->setArtifStatus( i, CoinWarmStartBasis::basic ); break; case CPX_AT_LOWER: if(sense[i] == 'G') ws->setArtifStatus( i, CoinWarmStartBasis::atUpperBound ); else ws->setArtifStatus( i, CoinWarmStartBasis::atLowerBound ); break; case CPX_AT_UPPER: if(sense[i] == 'L') ws->setArtifStatus( i, CoinWarmStartBasis::atLowerBound ); else ws->setArtifStatus( i, CoinWarmStartBasis::atUpperBound ); break; default: // unknown row status delete ws; ws = NULL; goto TERMINATE; } } for( i = 0; i < numcols; ++i ) { switch( cstat[i] ) { case CPX_BASIC: ws->setStructStatus( i, CoinWarmStartBasis::basic ); break; case CPX_AT_LOWER: ws->setStructStatus( i, CoinWarmStartBasis::atLowerBound ); break; case CPX_AT_UPPER: ws->setStructStatus( i, CoinWarmStartBasis::atUpperBound ); break; case CPX_FREE_SUPER: ws->setStructStatus( i, CoinWarmStartBasis::isFree ); break; default: // unknown column status delete ws; ws = NULL; goto TERMINATE; } } } TERMINATE: delete[] cstat; delete[] rstat; delete[] sense; return ws; } //----------------------------------------------------------------------------- bool OsiCpxSolverInterface::setWarmStart(const CoinWarmStart* warmstart) { debugMessage("OsiCpxSolverInterface::setWarmStart(%p)\n", (void*)warmstart); const CoinWarmStartBasis* ws = dynamic_cast(warmstart); int numcols, numrows, i, restat; int *cstat, *rstat; bool retval = false; if( !ws ) return false; numcols = getNumCols(); numrows = getNumRows(); /* if too small warm start information is given, we take this as a sign to disable a warm start in the next LP solve */ if( ws->getNumStructural() < numcols || ws->getNumArtificial() < numrows ) { disableadvbasis = true; return false; } switchToLP(); cstat = new int[numcols]; rstat = new int[numrows]; for( i = 0; i < numrows; ++i ) { switch( ws->getArtifStatus( i ) ) { case CoinWarmStartBasis::basic: rstat[i] = CPX_BASIC; break; case CoinWarmStartBasis::atLowerBound: rstat[i] = CPX_AT_LOWER; break; case CoinWarmStartBasis::atUpperBound: rstat[i] = CPX_AT_UPPER; break; default: // unknown row status retval = false; goto TERMINATE; } } for( i = 0; i < numcols; ++i ) { switch( ws->getStructStatus( i ) ) { case CoinWarmStartBasis::basic: cstat[i] = CPX_BASIC; break; case CoinWarmStartBasis::atLowerBound: cstat[i] = CPX_AT_LOWER; break; case CoinWarmStartBasis::atUpperBound: cstat[i] = CPX_AT_UPPER; break; case CoinWarmStartBasis::isFree: cstat[i] = CPX_FREE_SUPER; break; default: // unknown row status retval = false; goto TERMINATE; } } // *FIXME* : can this be getMutableLpPtr() ? Does any cached data change by // *FIXME* : setting warmstart? Or at least wouldn't it be sufficient to // *FIXME* : clear the cached results but not the problem data? // -> is fixed by using FREECACHED_RESULTS; only cached solution will be discarded restat = CPXcopybase( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_RESULTS ), cstat, rstat ); retval = (restat == 0); TERMINATE: delete[] cstat; delete[] rstat; return retval; } //############################################################################# // Hotstart related methods (primarily used in strong branching) //############################################################################# void OsiCpxSolverInterface::markHotStart() { debugMessage("OsiCpxSolverInterface::markHotStart()\n"); int err; int numcols, numrows; assert(!probtypemip_); numcols = getNumCols(); numrows = getNumRows(); if( numcols > hotStartCStatSize_ ) { delete[] hotStartCStat_; hotStartCStatSize_ = static_cast( 1.2 * static_cast( numcols ) ); // get some extra space for future hot starts hotStartCStat_ = new int[hotStartCStatSize_]; } if( numrows > hotStartRStatSize_ ) { delete[] hotStartRStat_; hotStartRStatSize_ = static_cast( 1.2 * static_cast( numrows ) ); // get some extra space for future hot starts hotStartRStat_ = new int[hotStartRStatSize_]; } err = CPXgetbase( env_, getMutableLpPtr(), hotStartCStat_, hotStartRStat_ ); checkCPXerror( err, "CPXgetbase", "markHotStart" ); } void OsiCpxSolverInterface::solveFromHotStart() { debugMessage("OsiCpxSolverInterface::solveFromHotStart()\n"); int err; int maxiter; switchToLP(); assert( getNumCols() <= hotStartCStatSize_ ); assert( getNumRows() <= hotStartRStatSize_ ); err = CPXcopybase( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_RESULTS ), hotStartCStat_, hotStartRStat_ ); checkCPXerror( err, "CPXcopybase", "solveFromHotStart" ); err = CPXgetintparam( env_, CPX_PARAM_ITLIM, &maxiter ); checkCPXerror( err, "CPXgetintparam", "solveFromHotStart" ); err = CPXsetintparam( env_, CPX_PARAM_ITLIM, hotStartMaxIteration_ ); checkCPXerror( err, "CPXsetintparam", "solveFromHotStart" ); resolve(); err = CPXsetintparam( env_, CPX_PARAM_ITLIM, maxiter ); checkCPXerror( err, "CPXsetintparam", "solveFromHotStart" ); } void OsiCpxSolverInterface::unmarkHotStart() { debugMessage("OsiCpxSolverInterface::unmarkHotStart()\n"); // ??? be lazy with deallocating memory and do nothing here, deallocate memory in the destructor } //############################################################################# // Problem information methods (original data) //############################################################################# //------------------------------------------------------------------ // Get number of rows, columns, elements, ... //------------------------------------------------------------------ int OsiCpxSolverInterface::getNumCols() const { debugMessage("OsiCpxSolverInterface::getNumCols()\n"); return CPXgetnumcols( env_, getMutableLpPtr() ); } int OsiCpxSolverInterface::getNumRows() const { debugMessage("OsiCpxSolverInterface::getNumRows()\n"); return CPXgetnumrows( env_, getMutableLpPtr() ); } int OsiCpxSolverInterface::getNumElements() const { debugMessage("OsiCpxSolverInterface::getNumElements()\n"); return CPXgetnumnz( env_, getMutableLpPtr() ); } //------------------------------------------------------------------ // Get pointer to rim vectors //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getColLower() const { debugMessage("OsiCpxSolverInterface::getColLower()\n"); if( collower_ == NULL ) { int ncols = CPXgetnumcols( env_, getMutableLpPtr() ); if( ncols > 0 ) { collower_ = new double[ncols]; CPXgetlb( env_, getMutableLpPtr(), collower_, 0, ncols-1 ); } } return collower_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getColUpper() const { debugMessage("OsiCpxSolverInterface::getColUpper()\n"); if( colupper_ == NULL ) { int ncols = CPXgetnumcols( env_, getMutableLpPtr() ); if( ncols > 0 ) { colupper_ = new double[ncols]; CPXgetub( env_, getMutableLpPtr(), colupper_, 0, ncols-1 ); } } return colupper_; } //------------------------------------------------------------------ const char * OsiCpxSolverInterface::getRowSense() const { debugMessage("OsiCpxSolverInterface::getRowSense()\n"); if ( rowsense_==NULL ) { // rowsense is determined with rhs, so invoke rhs getRightHandSide(); assert( rowsense_!=NULL || getNumRows() == 0 ); } return rowsense_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getRightHandSide() const { debugMessage("OsiCpxSolverInterface::getRightHandSide()\n"); if ( rhs_==NULL ) { CPXLPptr lp = getMutableLpPtr(); int nrows = getNumRows(); if( nrows > 0 ) { rhs_ = new double[nrows]; CPXgetrhs( env_, lp, rhs_, 0, nrows-1 ); assert( rowrange_ == NULL ); rowrange_ = new double[nrows]; CPXgetrngval( env_, lp, rowrange_, 0, nrows-1 ); assert( rowsense_ == NULL ); rowsense_ = new char[nrows]; CPXgetsense( env_, lp, rowsense_, 0, nrows-1 ); double inf = getInfinity(); int i; for ( i = 0; i < nrows; ++i ) { if ( rowsense_[i] != 'R' ) rowrange_[i]=0.0; else { if ( rhs_[i] <= -inf ) { rowsense_[i] = 'N'; rowrange_[i] = 0.0; rhs_[i] = 0.0; } else { if( rowrange_[i] >= 0.0 ) rhs_[i] = rhs_[i] + rowrange_[i]; else rowrange_[i] = -rowrange_[i]; } } } } } return rhs_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getRowRange() const { debugMessage("OsiCpxSolverInterface::getRowRange()\n"); if ( rowrange_==NULL ) { // rowrange is determined with rhs, so invoke rhs getRightHandSide(); assert( rowrange_!=NULL || getNumRows() == 0 ); } return rowrange_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getRowLower() const { debugMessage("OsiCpxSolverInterface::getRowLower()\n"); if ( rowlower_ == NULL ) { int nrows = getNumRows(); const char *rowsense = getRowSense(); const double *rhs = getRightHandSide(); const double *rowrange = getRowRange(); if ( nrows > 0 ) { rowlower_ = new double[nrows]; double dum1; for ( int i = 0; i < nrows; i++ ) convertSenseToBound( rowsense[i], rhs[i], rowrange[i], rowlower_[i], dum1 ); } } return rowlower_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getRowUpper() const { debugMessage("OsiCpxSolverInterface::getRowUpper()\n"); if ( rowupper_ == NULL ) { int nrows = getNumRows(); const char *rowsense = getRowSense(); const double *rhs = getRightHandSide(); const double *rowrange = getRowRange(); if ( nrows > 0 ) { rowupper_ = new double[nrows]; double dum1; for ( int i = 0; i < nrows; i++ ) convertSenseToBound( rowsense[i], rhs[i], rowrange[i], dum1, rowupper_[i] ); } } return rowupper_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getObjCoefficients() const { debugMessage("OsiCpxSolverInterface::getObjCoefficients()\n"); if ( obj_==NULL ) { int ncols = CPXgetnumcols( env_, getMutableLpPtr() ); if( ncols > 0 ) { obj_ = new double[ncols]; int err = CPXgetobj( env_, getMutableLpPtr(), obj_, 0, ncols-1 ); checkCPXerror( err, "CPXgetobj", "getObjCoefficients" ); } } return obj_; } //------------------------------------------------------------------ double OsiCpxSolverInterface::getObjSense() const { debugMessage("OsiCpxSolverInterface::getObjSense()\n"); if( CPXgetobjsen( env_, getMutableLpPtr() ) == CPX_MIN ) return +1.0; else return -1.0; } //------------------------------------------------------------------ // Return information on integrality //------------------------------------------------------------------ bool OsiCpxSolverInterface::isContinuous( int colNumber ) const { debugMessage("OsiCpxSolverInterface::isContinuous(%d)\n", colNumber); return getCtype()[colNumber] == 'C'; } //------------------------------------------------------------------ // Row and column copies of the matrix ... //------------------------------------------------------------------ const CoinPackedMatrix * OsiCpxSolverInterface::getMatrixByRow() const { debugMessage("OsiCpxSolverInterface::getMatrixByRow()\n"); if ( matrixByRow_ == NULL ) { int nrows = getNumRows(); int ncols = getNumCols(); int nelems; int *starts = new int [nrows + 1]; int *len = new int [nrows]; int requiredSpace; CPXgetrows( env_, getMutableLpPtr(), &nelems, starts, NULL, NULL, 0, &requiredSpace, 0, nrows-1 ); assert( -requiredSpace == getNumElements() ); int *indices = new int [-requiredSpace]; double *elements = new double[-requiredSpace]; CPXgetrows( env_, getMutableLpPtr(), &nelems, starts, indices, elements, -requiredSpace, &requiredSpace, 0, nrows-1 ); assert( requiredSpace == 0 ); matrixByRow_ = new CoinPackedMatrix(); // Should be able to pass null for length of packed matrix, // assignMatrix does not seem to allow (even though documentation // say it is possible to do this). // For now compute the length. starts[nrows] = nelems; for ( int i = 0; i < nrows; ++i ) len[i]=starts[i+1] - starts[i]; matrixByRow_->assignMatrix( false /* not column ordered */, ncols, nrows, nelems, elements, indices, starts, len /*NULL*/); } return matrixByRow_; } //------------------------------------------------------------------ const CoinPackedMatrix * OsiCpxSolverInterface::getMatrixByCol() const { debugMessage("OsiCpxSolverInterface::getMatrixByCol()\n"); if ( matrixByCol_ == NULL ) { int nrows = getNumRows(); int ncols = getNumCols(); int nelems; int *starts = new int [ncols + 1]; int *len = new int [ncols]; int requiredSpace; CPXgetcols( env_, getMutableLpPtr(), &nelems, starts, NULL, NULL, 0, &requiredSpace, 0, ncols-1 ); assert( -requiredSpace == getNumElements() ); int *indices = new int [-requiredSpace]; double *elements = new double[-requiredSpace]; CPXgetcols( env_, getMutableLpPtr(), &nelems, starts, indices, elements, -requiredSpace, &requiredSpace, 0, ncols-1 ); assert( requiredSpace == 0); matrixByCol_ = new CoinPackedMatrix(); // Should be able to pass null for length of packed matrix, // assignMatrix does not seem to allow (even though documentation // say it is possible to do this). // For now compute the length. starts[ncols] = nelems; for ( int i = 0; i < ncols; i++ ) len[i]=starts[i+1] - starts[i]; matrixByCol_->assignMatrix( true /* column ordered */, nrows, ncols, nelems, elements, indices, starts, len /*NULL*/); assert( matrixByCol_->getNumCols()==ncols ); assert( matrixByCol_->getNumRows()==nrows ); } return matrixByCol_; } //------------------------------------------------------------------ // Get solver's value for infinity //------------------------------------------------------------------ double OsiCpxSolverInterface::getInfinity() const { debugMessage("OsiCpxSolverInterface::getInfinity()\n"); return CPX_INFBOUND; } //############################################################################# // Problem information methods (results) //############################################################################# // *FIXME*: what should be done if a certain vector doesn't exist??? const double * OsiCpxSolverInterface::getColSolution() const { debugMessage("OsiCpxSolverInterface::getColSolution()\n"); if( colsol_==NULL ) { CPXLPptr lp = getMutableLpPtr(); int ncols = CPXgetnumcols( env_, lp ); if( ncols > 0 ) { colsol_ = new double[ncols]; if( probtypemip_ ) { #if CPX_VERSION >= 1100 int solntype; CPXsolninfo(env_, lp, NULL, &solntype, NULL, NULL); if( solntype != CPX_NO_SOLN ) { int err = CPXgetmipx( env_, lp, colsol_, 0, ncols-1 ); checkCPXerror( err, "CPXgetmipx", "getColSolution" ); } else { CoinFillN( colsol_, ncols, 0.0 ); } #else int err = CPXgetmipx( env_, lp, colsol_, 0, ncols-1 ); if ( err == CPXERR_NO_INT_SOLN ) CoinFillN( colsol_, ncols, 0.0 ); else checkCPXerror( err, "CPXgetmipx", "getColSolution" ); #endif } else { int solntype; CPXsolninfo(env_, lp, NULL, &solntype, NULL, NULL); if( solntype != CPX_NO_SOLN ) { int err = CPXgetx( env_, lp, colsol_, 0, ncols-1 ); checkCPXerror( err, "CPXgetx", "getColSolution" ); } else { CoinFillN( colsol_, ncols, 0.0 ); } } } } return colsol_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getRowPrice() const { debugMessage("OsiCpxSolverInterface::getRowPrice()\n"); if( rowsol_==NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rowsol_ = new double[nrows]; int solntype; /* check if a solution exists, if Cplex >= 11.0 */ #if CPX_VERSION >= 1100 CPXsolninfo(env_, getMutableLpPtr(), NULL, &solntype, NULL, NULL); #else solntype = CPX_BASIC_SOLN; #endif if( solntype != CPX_NO_SOLN ) { int err = CPXgetpi( env_, getMutableLpPtr(), rowsol_, 0, nrows-1 ); checkCPXerror( err, "CPXgetpi", "getRowPrice" ); } else { CoinFillN( rowsol_, nrows, 0.0 ); } } } return rowsol_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getReducedCost() const { debugMessage("OsiCpxSolverInterface::getReducedCost()\n"); if( redcost_==NULL ) { int ncols = CPXgetnumcols( env_, getMutableLpPtr() ); if( ncols > 0 ) { redcost_ = new double[ncols]; int solntype; /* check if a solution exists, if Cplex >= 11.0 */ #if CPX_VERSION >= 1100 CPXsolninfo(env_, getMutableLpPtr(), NULL, &solntype, NULL, NULL); #else solntype = CPX_BASIC_SOLN; #endif if( solntype != CPX_NO_SOLN ) { int err = CPXgetdj( env_, getMutableLpPtr(), redcost_, 0, ncols-1 ); checkCPXerror( err, "CPXgetdj", "getReducedCost" ); } else { CoinFillN( redcost_, ncols, 0.0 ); } } } return redcost_; } //------------------------------------------------------------------ const double * OsiCpxSolverInterface::getRowActivity() const { debugMessage("OsiCpxSolverInterface::getRowActivity()\n"); if( rowact_==NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rowact_ = new double[nrows]; int solntype; if( probtypemip_ ) { /* check if a solution exists, if Cplex >= 11.0 */ #if CPX_VERSION >= 1100 CPXsolninfo(env_, getMutableLpPtr(), NULL, &solntype, NULL, NULL); if( solntype != CPX_NO_SOLN ) { double *rowslack = new double[nrows]; int err = CPXgetmipslack( env_, getMutableLpPtr(), rowslack, 0, nrows-1 ); checkCPXerror( err, "CPXgetmipslack", "getRowActivity" ); } else { CoinFillN( rowact_, nrows, 0.0 ); } #else double *rowslack = new double[nrows]; int err = CPXgetmipslack( env_, getMutableLpPtr(), rowslack, 0, nrows-1 ); if ( err == CPXERR_NO_SOLN || err == CPXERR_NO_INT_SOLN ) { CoinFillN( rowact_, nrows, 0.0 ); } else { checkCPXerror( err, "CPXgetmipslack", "getRowActivity" ); for( int r = 0; r < nrows; ++r ) rowact_[r] = getRightHandSide()[r] - rowslack[r]; } delete[] rowslack; #endif } else { CPXsolninfo(env_, getMutableLpPtr(), NULL, &solntype, NULL, NULL); if( solntype != CPX_NO_SOLN ) { int err = CPXgetax( env_, getMutableLpPtr(), rowact_, 0, nrows-1 ); checkCPXerror( err, "CPXgetax", "getRowActivity" ); } else { CoinFillN( rowact_, nrows, 0.0 ); } } } } return rowact_; } //------------------------------------------------------------------ double OsiCpxSolverInterface::getObjValue() const { debugMessage("OsiCpxSolverInterface::getObjValue()\n"); double objval = 0.0; int err; int solntype; CPXLPptr lp = getMutableLpPtr(); if( probtypemip_ ) { #if CPX_VERSION >= 1100 CPXsolninfo(env_, lp, NULL, &solntype, NULL, NULL); if( solntype != CPX_NO_SOLN ) { err = CPXgetmipobjval( env_, lp, &objval); checkCPXerror( err, "CPXgetmipobjval", "getObjValue" ); } else { // => return 0.0 as objective value (?? is this the correct behaviour ??) objval = 0.0; } #else err = CPXgetmipobjval( env_, lp, &objval); if( err == CPXERR_NO_INT_SOLN ) // => return 0.0 as objective value (?? is this the correct behaviour ??) objval = 0.0; else checkCPXerror( err, "CPXgetmipobjval", "getObjValue" ); #endif } else { CPXsolninfo(env_, lp, NULL, &solntype, NULL, NULL); if( solntype != CPX_NO_SOLN ) { err = CPXgetobjval( env_, lp, &objval ); checkCPXerror( err, "CPXgetobjval", "getObjValue" ); } else { // => return 0.0 as objective value (?? is this the correct behaviour ??) objval = 0.0; } } // Adjust objective function value by constant term in objective function double objOffset; getDblParam(OsiObjOffset,objOffset); objval -= objOffset; return objval; } //------------------------------------------------------------------ int OsiCpxSolverInterface::getIterationCount() const { debugMessage("OsiCpxSolverInterface::getIterationCount()\n"); // CPXgetitcnt prints an error if no solution exists, so check before, if Cplex >= 11.0 #if CPX_VERSION >= 1100 int solntype; CPXsolninfo(env_, getMutableLpPtr(), NULL, &solntype, NULL, NULL); if( solntype == CPX_NO_SOLN ) return 0; #endif if( probtypemip_ ) return CPXgetmipitcnt( env_, getMutableLpPtr() ); else return CPXgetitcnt( env_, getMutableLpPtr() ); } //------------------------------------------------------------------ std::vector OsiCpxSolverInterface::getDualRays(int maxNumRays, bool fullRay) const { debugMessage("OsiCpxSolverInterface::getDualRays(%d,%s)\n", maxNumRays, fullRay?"true":"false"); if (fullRay == true) { throw CoinError("Full dual rays not yet implemented.","getDualRays", "OsiCpxSolverInterface"); } OsiCpxSolverInterface solver(*this); const int numcols = getNumCols(); const int numrows = getNumRows(); int* index = new int[CoinMax(numcols,numrows)]; int i; for ( i = CoinMax(numcols,numrows)-1; i >= 0; --i) { index[i] = i; } double* obj = new double[CoinMax(numcols,2*numrows)]; CoinFillN(obj, numcols, 0.0); solver.setObjCoeffSet(index, index+numcols, obj); double* clb = new double[2*numrows]; double* cub = new double[2*numrows]; const double plusone = 1.0; const double minusone = -1.0; const char* sense = getRowSense(); const CoinPackedVectorBase** cols = new const CoinPackedVectorBase*[2*numrows]; int newcols = 0; for (i = 0; i < numrows; ++i) { switch (sense[i]) { case 'L': cols[newcols++] = new CoinShallowPackedVector(1, &index[i], &minusone, false); break; case 'G': cols[newcols++] = new CoinShallowPackedVector(1, &index[i], &plusone, false); break; case 'R': cols[newcols++] = new CoinShallowPackedVector(1, &index[i], &minusone, false); cols[newcols++] = new CoinShallowPackedVector(1, &index[i], &plusone, false); break; case 'N': break; } } CoinFillN(obj, newcols, 1.0); CoinFillN(clb, newcols, 0.0); CoinFillN(cub, newcols, getInfinity()); solver.addCols(newcols, cols, clb, cub, obj); delete[] index; delete[] cols; delete[] clb; delete[] cub; delete[] obj; solver.setObjSense(1.0); // minimize solver.initialSolve(); const double* solverpi = solver.getRowPrice(); double* pi = new double[numrows]; for ( i = numrows - 1; i >= 0; --i) { pi[i] = -solverpi[i]; } return std::vector(1, pi); } //------------------------------------------------------------------ std::vector OsiCpxSolverInterface::getPrimalRays(int maxNumRays) const { debugMessage("OsiCpxSolverInterface::getPrimalRays(%d)\n", maxNumRays); double *ray = new double[getNumCols()]; int err = CPXgetray(env_, getMutableLpPtr(), ray); checkCPXerror(err, "CPXgetray", "getPrimalRays"); return std::vector(1, ray); } //############################################################################# // Problem modifying methods (rim vectors) //############################################################################# void OsiCpxSolverInterface::setObjCoeff( int elementIndex, double elementValue ) { debugMessage("OsiCpxSolverInterface::setObjCoeff(%d, %g)\n", elementIndex, elementValue); // int err = CPXchgobj(env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_COLUMN ), 1, &elementIndex, &elementValue); int err = CPXchgobj(env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_PROBLEM ), 1, &elementIndex, &elementValue); checkCPXerror(err, "CPXchgobj", "setObjCoeff"); if(obj_ != NULL) { obj_[elementIndex] = elementValue; } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setObjCoeffSet(const int* indexFirst, const int* indexLast, const double* coeffList) { debugMessage("OsiCpxSolverInterface::setObjCoeffSet(%p, %p, %p)\n", (void*)indexFirst, (void*)indexLast, (void*)coeffList); const long int cnt = indexLast - indexFirst; // int err = CPXchgobj(env_, // getLpPtr(OsiCpxSolverInterface::FREECACHED_COLUMN), cnt, // const_cast(indexFirst), // const_cast(coeffList)); int err = CPXchgobj(env_, getLpPtr(OsiCpxSolverInterface::KEEPCACHED_PROBLEM), static_cast(cnt), const_cast(indexFirst), const_cast(coeffList)); checkCPXerror(err, "CPXchgobj", "setObjCoeffSet"); if (obj_ != NULL) { for (int i = 0; i < cnt; ++i) { obj_[indexFirst[i]] = coeffList[i]; } } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setColLower(int elementIndex, double elementValue) { debugMessage("OsiCpxSolverInterface::setColLower(%d, %g)\n", elementIndex, elementValue); char c = 'L'; // int err = CPXchgbds( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_COLUMN ), 1, &elementIndex, &c, &elementValue ); int err = CPXchgbds( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_PROBLEM ), 1, &elementIndex, &c, &elementValue ); checkCPXerror( err, "CPXchgbds", "setColLower" ); if(collower_ != NULL) { collower_[elementIndex] = elementValue; } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setColUpper(int elementIndex, double elementValue) { debugMessage("OsiCpxSolverInterface::setColUpper(%d, %g)\n", elementIndex, elementValue); char c = 'U'; // int err = CPXchgbds( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_COLUMN ), 1, &elementIndex, &c, &elementValue ); int err = CPXchgbds( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_PROBLEM ), 1, &elementIndex, &c, &elementValue ); checkCPXerror( err, "CPXchgbds", "setColUpper" ); if(colupper_ != NULL) { colupper_[elementIndex] = elementValue; } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setColBounds( int elementIndex, double lower, double upper ) { debugMessage("OsiCpxSolverInterface::setColBounds(%d, %g, %g)\n", elementIndex, lower, upper); char c[2] = { 'L', 'U' }; int ind[2]; double bd[2]; int err; ind[0] = elementIndex; ind[1] = elementIndex; bd[0] = lower; bd[1] = upper; // err = CPXchgbds( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_COLUMN ), 2, ind, c, bd ); err = CPXchgbds( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_PROBLEM ), 2, ind, c, bd ); checkCPXerror( err, "CPXchgbds", "setColBounds" ); if(collower_ != NULL) { collower_[elementIndex] = lower; } if(colupper_ != NULL) { colupper_[elementIndex] = upper; } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { debugMessage("OsiCpxSolverInterface::setColSetBounds(%p, %p, %p)\n", (void*)indexFirst, (void*)indexLast, (void*)boundList); const long int cnt = indexLast - indexFirst; if (cnt <= 0) return; char* c = new char[2*cnt]; int* ind = new int[2*cnt]; for (int i = 0; i < cnt; ++i) { register const int j = 2 * i; c[j] = 'L'; c[j+1] = 'U'; const int colind = indexFirst[i]; ind[j] = colind; ind[j+1] = colind; if(collower_ != NULL) { collower_[colind] = boundList[2 * i]; } if(colupper_ != NULL) { colupper_[colind] = boundList[2 * i + 1]; } } // int err = CPXchgbds( env_, // getLpPtr(OsiCpxSolverInterface::FREECACHED_ROW ), // 2*cnt, ind, c, // const_cast(boundList) ); int err = CPXchgbds( env_, getLpPtr(OsiCpxSolverInterface::KEEPCACHED_PROBLEM), 2*static_cast(cnt), ind, c, const_cast(boundList) ); checkCPXerror( err, "CPXchgbds", "setColSetBounds" ); delete[] ind; delete[] c; // OsiSolverInterface::setColSetBounds( indexFirst, indexLast, boundList ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setRowLower( int i, double elementValue ) { debugMessage("OsiCpxSolverInterface::setRowLower(%d, %g)\n", i, elementValue); double rhs = getRightHandSide()[i]; double range = getRowRange()[i]; char sense = getRowSense()[i]; double lower = 0, upper = 0; convertSenseToBound( sense, rhs, range, lower, upper ); if( lower != elementValue ) { convertBoundToSense( elementValue, upper, sense, rhs, range ); setRowType( i, sense, rhs, range ); } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setRowUpper( int i, double elementValue ) { debugMessage("OsiCpxSolverInterface::setRowUpper(%d, %g)\n", i, elementValue); double rhs = getRightHandSide()[i]; double range = getRowRange()[i]; char sense = getRowSense()[i]; double lower = 0, upper = 0; convertSenseToBound( sense, rhs, range, lower, upper ); if( upper != elementValue ) { convertBoundToSense( lower, elementValue, sense, rhs, range ); setRowType( i, sense, rhs, range ); } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setRowBounds( int elementIndex, double lower, double upper ) { debugMessage("OsiCpxSolverInterface::setRowBounds(%d, %g, %g)\n", elementIndex, lower, upper); double rhs, range; char sense; convertBoundToSense( lower, upper, sense, rhs, range ); setRowType( elementIndex, sense, rhs, range ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setRowType(int i, char sense, double rightHandSide, double range) { debugMessage("OsiCpxSolverInterface::setRowType(%d, %c, %g, %g)\n", i, sense, rightHandSide, range); int err; // in CPLEX, ranged constraints are interpreted as rhs <= coeff*x <= rhs+range, which is different from Osi double cpxrhs = rightHandSide; if (sense == 'R') { assert( range >= 0.0 ); cpxrhs -= range; } if (sense == 'N') { sense = 'R'; cpxrhs = -getInfinity(); range = 2*getInfinity(); } /************** err = CPXchgsense( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_ROW ), 1, &i, &sense ); checkCPXerror( err, "CPXchgsense", "setRowType" ); err = CPXchgrhs( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_ROW ), 1, &i, &rightHandSide ); checkCPXerror( err, "CPXchgrhs", "setRowType" ); err = CPXchgrngval( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_ROW ), 1, &i, &range ); checkCPXerror( err, "CPXchgrngval", "setRowType" ); ***************/ err = CPXchgsense( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_PROBLEM ), 1, &i, &sense ); checkCPXerror( err, "CPXchgsense", "setRowType" ); if(rowsense_ != NULL) { rowsense_[i] = sense; } err = CPXchgrhs( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_PROBLEM ), 1, &i, &cpxrhs ); checkCPXerror( err, "CPXchgrhs", "setRowType" ); if(rhs_ != NULL) { rhs_[i] = rightHandSide; } err = CPXchgrngval( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_PROBLEM ), 1, &i, &range ); checkCPXerror( err, "CPXchgrngval", "setRowType" ); if(rowrange_ != NULL) { rowrange_[i] = range; } if (rowlower_ != NULL || rowupper_ != NULL) { double dummy; convertSenseToBound(sense, rightHandSide, range, rowlower_ ? rowlower_[i] : dummy, rowupper_ ? rowupper_[i] : dummy); } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { debugMessage("OsiCpxSolverInterface::setRowSetBounds(%p, %p, %p)\n", (void*)indexFirst, (void*)indexLast, (void*)boundList); const long int cnt = indexLast - indexFirst; if (cnt <= 0) return; char* sense = new char[cnt]; double* rhs = new double[cnt]; double* range = new double[cnt]; for (int i = 0; i < cnt; ++i) { convertBoundToSense(boundList[2*i], boundList[2*i+1], sense[i], rhs[i], range[i]); } setRowSetTypes(indexFirst, indexLast, sense, rhs, range); delete[] range; delete[] rhs; delete[] sense; // OsiSolverInterface::setRowSetBounds( indexFirst, indexLast, boundList ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { debugMessage("OsiCpxSolverInterface::setRowSetTypes(%p, %p, %p, %p, %p)\n", (void*)indexFirst, (void*)indexLast, (void*)senseList, (void*)rhsList, (void*)rangeList); const long int cnt = indexLast - indexFirst; if (cnt <= 0) return; char* sense = new char[cnt]; double* rhs = new double[cnt]; double* range = new double[cnt]; int* rangeind = new int[cnt]; int rangecnt = 0; for (int i = 0; i < cnt; ++i) { sense[i] = senseList[i]; rhs[i] = rhsList[i]; if (sense[i] == 'R') { assert(rangeList[i] >= 0.0); rhs[i] -= rangeList[i]; rangeind[rangecnt] = indexFirst[i]; range[rangecnt] = rangeList[i]; ++rangecnt; } if (sense[i] == 'N') { sense[i] = 'R'; rhs[i] = -getInfinity(); rangeind[rangecnt] = indexFirst[i]; range[rangecnt] = 2*getInfinity(); ++rangecnt; } } int err; /****************** err = CPXchgsense(env_, getLpPtr(OsiCpxSolverInterface::FREECACHED_ROW), cnt, const_cast(indexFirst), sense); checkCPXerror( err, "CPXchgsense", "setRowSetTypes" ); err = CPXchgrhs(env_, getLpPtr(OsiCpxSolverInterface::FREECACHED_ROW), cnt, const_cast(indexFirst), rhs); checkCPXerror( err, "CPXchgrhs", "setRowSetTypes" ); err = CPXchgrngval(env_, getLpPtr(OsiCpxSolverInterface::FREECACHED_ROW), rangecnt, rangeind, range); checkCPXerror( err, "CPXchgrngval", "setRowSetTypes" ); ********************/ err = CPXchgsense(env_, getLpPtr(OsiCpxSolverInterface::KEEPCACHED_ROW), static_cast(cnt), const_cast(indexFirst), sense); checkCPXerror( err, "CPXchgsense", "setRowSetTypes" ); err = CPXchgrhs(env_, getLpPtr(OsiCpxSolverInterface::FREECACHED_ROW), static_cast(cnt), const_cast(indexFirst), rhs); checkCPXerror( err, "CPXchgrhs", "setRowSetTypes" ); err = CPXchgrngval(env_, getLpPtr(OsiCpxSolverInterface::FREECACHED_ROW), rangecnt, rangeind, range); checkCPXerror( err, "CPXchgrngval", "setRowSetTypes" ); int j; if(rowsense_ != NULL) { for(j=0; j= getNumCols()); coltype_[index] = 'C'; if ( probtypemip_ ) { CPXLPptr lp = getMutableLpPtr(); int err; err = CPXchgctype( env_, lp, 1, &index, &coltype_[index] ); checkCPXerror( err, "CPXchgctype", "setContinuous" ); } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setInteger(int index) { debugMessage("OsiCpxSolverInterface::setInteger(%d)\n", index); assert(coltype_ != NULL); assert(coltypesize_ >= getNumCols()); if( getColLower()[index] == 0.0 && getColUpper()[index] == 1.0 ) coltype_[index] = 'B'; else coltype_[index] = 'I'; if ( probtypemip_ ) { CPXLPptr lp = getMutableLpPtr(); int err; err = CPXchgctype( env_, lp, 1, &index, &coltype_[index] ); checkCPXerror( err, "CPXchgctype", "setInteger" ); } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setContinuous(const int* indices, int len) { debugMessage("OsiCpxSolverInterface::setContinuous(%p, %d)\n", (void*)indices, len); for( int i = 0; i < len; ++i ) setContinuous(indices[i]); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setInteger(const int* indices, int len) { debugMessage("OsiCpxSolverInterface::setInteger(%p, %d)\n", (void*)indices, len); for( int i = 0; i < len; ++i ) setInteger(indices[i]); } //############################################################################# void OsiCpxSolverInterface::setObjSense(double s) { debugMessage("OsiCpxSolverInterface::setObjSense(%g)\n", s); if( s == +1.0 ) CPXchgobjsen( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_RESULTS ), CPX_MIN ); else CPXchgobjsen( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_RESULTS ), CPX_MAX ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setColSolution(const double * cs) { debugMessage("OsiCpxSolverInterface::setColSolution(%p)\n", (void*)cs); int nc = getNumCols(); if( cs == NULL ) freeCachedResults(); else if( nc > 0 ) { // If colsol isn't allocated, then allocate it if ( colsol_ == NULL ) colsol_ = new double[nc]; // Copy in new col solution. CoinDisjointCopyN( cs, nc, colsol_ ); // CPLEX < 7.0 doesn't support setting a col solution without a row solution // -> if a row solution exists or CPLEX version >= 7, then pass into CPLEX #if CPX_VERSION < 700 if ( rowsol_ != NULL ) #endif { int err = CPXcopystart( env_, getMutableLpPtr(), NULL, NULL, const_cast( colsol_ ), const_cast( rowsol_ ), NULL, NULL ); checkCPXerror( err, "CPXcopystart", "setColSolution" ); } } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::setRowPrice(const double * rs) { debugMessage("OsiCpxSolverInterface::setRowPrice(%p)\n", (void*)rs); int nr = getNumRows(); if( rs == NULL ) freeCachedResults(); else if( nr > 0 ) { // If rowsol isn't allocated, then allocate it if ( rowsol_ == NULL ) rowsol_ = new double[nr]; // Copy in new row solution. CoinDisjointCopyN( rs, nr, rowsol_ ); // if a col solution exists, then pass into CPLEX if ( colsol_ != NULL ) { int err = CPXcopystart( env_, getMutableLpPtr(), NULL, NULL, const_cast( colsol_ ), const_cast( rowsol_ ), NULL, NULL ); checkCPXerror( err, "CPXcopystart", "setRowPrice" ); } } } //############################################################################# // Problem modifying methods (matrix) //############################################################################# void OsiCpxSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { debugMessage("OsiCpxSolverInterface::addCol(%p, %g, %g, %g)\n", (void*)&vec, collb, colub, obj); int nc = getNumCols(); assert(coltypesize_ >= nc); resizeColType(nc + 1); coltype_[nc] = 'C'; int err; int cmatbeg[2] = {0, vec.getNumElements()}; err = CPXaddcols( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_ROW ), 1, vec.getNumElements(), const_cast(&obj), cmatbeg, const_cast(vec.getIndices()), const_cast(vec.getElements()), const_cast(&collb), const_cast(&colub), NULL ); checkCPXerror( err, "CPXaddcols", "addCol" ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj) { debugMessage("OsiCpxSolverInterface::addCols(%d, %p, %p, %p, %p)\n", numcols, (void*)cols, (void*)collb, (void*)colub, (void*)obj); int nc = getNumCols(); assert(coltypesize_ >= nc); resizeColType(nc + numcols); CoinFillN(&coltype_[nc], numcols, 'C'); int i; int nz = 0; for (i = 0; i < numcols; ++i) nz += cols[i]->getNumElements(); int* index = new int[nz]; double* elem = new double[nz]; int* start = new int[numcols+1]; nz = 0; start[0] = 0; for (i = 0; i < numcols; ++i) { const CoinPackedVectorBase* col = cols[i]; const int len = col->getNumElements(); CoinDisjointCopyN(col->getIndices(), len, index+nz); CoinDisjointCopyN(col->getElements(), len, elem+nz); nz += len; start[i+1] = nz; } int err = CPXaddcols(env_, getLpPtr(OsiCpxSolverInterface::KEEPCACHED_ROW), numcols, nz, const_cast(obj), start, index, elem, const_cast(collb), const_cast(colub), NULL ); checkCPXerror( err, "CPXaddcols", "addCols" ); delete[] start; delete[] elem; delete[] index; // int i; // for( i = 0; i < numcols; ++i ) // addCol( *(cols[i]), collb[i], colub[i], obj[i] ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::deleteCols(const int num, const int * columnIndices) { debugMessage("OsiCpxSolverInterface::deleteCols(%d, %p)\n", num, (void*)columnIndices); int ncols = getNumCols(); int *delstat = new int[ncols]; int i, err; CoinFillN(delstat, ncols, 0); for( i = 0; i < num; ++i ) delstat[columnIndices[i]] = 1; err = CPXdelsetcols( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_ROW ), delstat ); checkCPXerror( err, "CPXdelsetcols", "deleteCols" ); for( i = 0; i < ncols; ++i ) { assert(delstat[i] <= i); if( delstat[i] != -1 ) coltype_[delstat[i]] = coltype_[i]; } delete[] delstat; //--- //--- MVG: took from OsiClp for updating names //--- int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; if (num && nameDiscipline) { // Very clumsy (and inefficient) - need to sort and then go backwards in ? chunks int * indices = CoinCopyOfArray(columnIndices,num); std::sort(indices,indices+num); int num2 = num; while (num2) { int next = indices[num2-1]; int firstDelete = num2-1; int i; for (i = num2-2; i>=0; --i) { if (indices[i]+1 == next) { --next; firstDelete = i; } else { break; } } OsiSolverInterface::deleteColNames(indices[firstDelete],num2-firstDelete); num2 = firstDelete; assert (num2>=0); } delete [] indices; } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { debugMessage("OsiCpxSolverInterface::addRow(%p, %g, %g)\n", (void*)&vec, rowlb, rowub); char sense; double rhs, range; convertBoundToSense( rowlb, rowub, sense, rhs, range ); addRow( vec, sense, rhs, range ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { debugMessage("OsiCpxSolverInterface::addRow(%p, %c, %g, %g)\n", (void*)&vec, rowsen, rowrhs, rowrng); int err; int rmatbeg = 0; double rhs; double range; char sense = rowsen; switch( rowsen ) { case 'R': assert( rowrng >= 0.0 ); rhs = rowrhs - rowrng; range = rowrng; break; case 'N': sense = 'R'; rhs = -getInfinity(); range = 2*getInfinity(); break; default: rhs = rowrhs; range = 0.0; } err = CPXaddrows( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_COLUMN ), 0, 1, vec.getNumElements(), &rhs, &sense, &rmatbeg, const_cast(vec.getIndices()), const_cast(vec.getElements()), NULL, NULL ); checkCPXerror( err, "CPXaddrows", "addRow" ); if( sense == 'R' ) { int row = getNumRows() - 1; err = CPXchgrngval( env_, getLpPtr( OsiCpxSolverInterface::FREECACHED_ROW ), 1, &row, &range ); checkCPXerror( err, "CPXchgrngval", "addRow" ); } } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub) { debugMessage("OsiCpxSolverInterface::addRows(%d, %p, %p, %p)\n", numrows, (void*)rows, (void*)rowlb, (void*)rowub); int i; for( i = 0; i < numrows; ++i ) addRow( *(rows[i]), rowlb[i], rowub[i] ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng) { debugMessage("OsiCpxSolverInterface::addRows(%d, %p, %p, %p, %p)\n", numrows, (void*)rows, (void*)rowsen, (void*)rowrhs, (void*)rowrng); int i; for( i = 0; i < numrows; ++i ) addRow( *(rows[i]), rowsen[i], rowrhs[i], rowrng[i] ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::deleteRows(const int num, const int * rowIndices) { debugMessage("OsiCpxSolverInterface::deleteRows(%d, %p)\n", num, (void*)rowIndices); int nrows = getNumRows(); int *delstat = new int[nrows]; int i, err; CoinFillN( delstat, nrows, 0 ); for( i = 0; i < num; ++i ) delstat[rowIndices[i]] = 1; err = CPXdelsetrows( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_COLUMN ), delstat ); checkCPXerror( err, "CPXdelsetrows", "deleteRows" ); delete[] delstat; //--- //--- SV: took from OsiClp for updating names //--- int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; if (num && nameDiscipline) { // Very clumsy (and inefficient) - need to sort and then go backwards in ? chunks int * indices = CoinCopyOfArray(rowIndices,num); std::sort(indices,indices+num); int num2=num; while (num2) { int next = indices[num2-1]; int firstDelete = num2-1; int i; for (i = num2-2; i>=0; --i) { if (indices[i]+1 == next) { --next; firstDelete = i; } else { break; } } OsiSolverInterface::deleteRowNames(indices[firstDelete],num2-firstDelete); num2 = firstDelete; assert(num2 >= 0); } delete [] indices; } } //############################################################################# // Methods to input a problem //############################################################################# void OsiCpxSolverInterface::loadProblem( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { debugMessage("OsiCpxSolverInterface::loadProblem(1)(%p, %p, %p, %p, %p, %p)\n", (void*)&matrix, (void*)collb, (void*)colub, (void*)obj, (void*)rowlb, (void*)rowub); const double inf = getInfinity(); int nrows = matrix.getNumRows(); char * rowSense = new char [nrows]; double * rowRhs = new double[nrows]; double * rowRange = new double[nrows]; int i; for ( i = nrows - 1; i >= 0; --i ) { const double lower = rowlb ? rowlb[i] : -inf; const double upper = rowub ? rowub[i] : inf; convertBoundToSense( lower, upper, rowSense[i], rowRhs[i], rowRange[i] ); } loadProblem( matrix, collb, colub, obj, rowSense, rowRhs, rowRange ); delete [] rowSense; delete [] rowRhs; delete [] rowRange; } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub ) { debugMessage("OsiCpxSolverInterface::assignProblem()\n"); loadProblem( *matrix, collb, colub, obj, rowlb, rowub ); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowlb; rowlb = 0; delete[] rowub; rowub = 0; } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::loadProblem( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { debugMessage("OsiCpxSolverInterface::loadProblem(2)(%p, %p, %p, %p, %p, %p, %p)\n", (void*)&matrix, (void*)collb, (void*)colub, (void*)obj, (void*)rowsen, (void*)rowrhs, (void*)rowrng); char *lclRowsen = NULL ; double *lclRowrhs = NULL ; int nc=matrix.getNumCols(); int nr=matrix.getNumRows(); if( nr == 0 && nc == 0 ) { // empty LP if (lp_ != NULL) { // kill old LP int objDirection = CPXgetobjsen( env_, getMutableLpPtr() ); int err = CPXfreeprob( env_, &lp_ ); checkCPXerror( err, "CPXfreeprob", "loadProblem" ); lp_ = NULL; freeAllMemory(); CPXchgobjsen(env_, getLpPtr(), objDirection); } return; } if (nr == 0) { int objDirection = CPXgetobjsen( env_, getMutableLpPtr() ); if (lp_ != NULL) { // kill old LP int err = CPXfreeprob( env_, &lp_ ); checkCPXerror( err, "CPXfreeprob", "loadProblem" ); lp_ = NULL; freeAllMemory(); } // getLpPtr() call will create new LP int err = CPXnewcols( env_, getLpPtr(), nc, obj, collb, colub, NULL, NULL); checkCPXerror( err, "CPXcopylp", "loadProblem" ); CPXchgobjsen(env_, getLpPtr(), objDirection); return; } if (rowsen == NULL) { lclRowsen = new char[nr] ; CoinFillN(lclRowsen,nr,'G') ; rowsen = lclRowsen ; } if (rowrhs == NULL) { lclRowrhs = new double[nr] ; CoinFillN(lclRowrhs,nr,0.0) ; rowrhs = lclRowrhs ; } int i; // Set column values to defaults if NULL pointer passed double * clb; double * cub; double * ob; double * rr = NULL; double * rhs; if ( collb!=NULL ) clb=const_cast(collb); else { clb = new double[nc]; CoinFillN(clb, nc, 0.0); } if ( colub!=NULL ) cub=const_cast(colub); else { cub = new double[nc]; CoinFillN(cub, nc, getInfinity()); } if ( obj!=NULL ) ob=const_cast(obj); else { ob = new double[nc]; CoinFillN(ob, nc, 0.0); } if ( rowrng != NULL ) { rhs = new double[nr]; rr = new double[nr]; for ( i=0; i= 0 ) { rhs[i] = rowrhs[i] - rowrng[i]; rr[i] = rowrng[i]; } else { rhs[i] = rowrhs[i]; rr[i] = -rowrng[i]; } } else { rhs[i] = rowrhs[i]; rr[i] = 0.0; } } } else rhs = const_cast(rowrhs); bool freeMatrixRequired = false; CoinPackedMatrix * m = NULL; if ( !matrix.isColOrdered() ) { m = new CoinPackedMatrix(); m->reverseOrderedCopyOf(matrix); freeMatrixRequired = true; } else m = const_cast(&matrix); assert( nc == m->getNumCols() ); assert( nr == m->getNumRows() ); assert( m->isColOrdered() ); int objDirection = CPXgetobjsen( env_, getMutableLpPtr() ); int err = CPXcopylp( env_, getLpPtr(), nc, nr, // Leave ObjSense alone(set to current value). objDirection, ob, rhs, const_cast(rowsen), const_cast(m->getVectorStarts()), const_cast(m->getVectorLengths()), const_cast(m->getIndices()), const_cast(m->getElements()), const_cast(clb), const_cast(cub), rr ); checkCPXerror( err, "CPXcopylp", "loadProblem" ); if ( collb == NULL ) delete[] clb; if ( colub == NULL ) delete[] cub; if ( obj == NULL ) delete[] ob; if ( rowrng != NULL ) { delete[] rr; delete[] rhs; } if ( freeMatrixRequired ) delete m; resizeColType(nc); CoinFillN(coltype_, nc, 'C'); if (lclRowsen != NULL) delete[] lclRowsen ; if (lclRowrhs != NULL) delete[] lclRowrhs ; } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng ) { debugMessage("OsiCpxSolverInterface::assignProblem()\n"); loadProblem( *matrix, collb, colub, obj, rowsen, rowrhs, rowrng ); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowsen; rowsen = 0; delete[] rowrhs; rowrhs = 0; delete[] rowrng; rowrng = 0; } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { debugMessage("OsiCpxSolverInterface::loadProblem(3)()\n"); const double inf = getInfinity(); char * rowSense = new char [numrows]; double * rowRhs = new double[numrows]; double * rowRange = new double[numrows]; for ( int i = numrows - 1; i >= 0; --i ) { const double lower = rowlb ? rowlb[i] : -inf; const double upper = rowub ? rowub[i] : inf; convertBoundToSense( lower, upper, rowSense[i], rowRhs[i], rowRange[i] ); } loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowSense, rowRhs, rowRange); delete [] rowSense; delete [] rowRhs; delete [] rowRange; } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { debugMessage("OsiCpxSolverInterface::loadProblem(4)(%d, %d, %p, %p, %p, %p, %p, %p, %p, %p, %p)\n", numcols, numrows, (void*)start, (void*)index, (void*)value, (void*)collb, (void*)colub, (void*)obj, (void*)rowsen, (void*)rowrhs, (void*)rowrng); const int nc = numcols; const int nr = numrows; if( nr == 0 && nc == 0 ) { // empty LP if (lp_ != NULL) { // kill old LP int objDirection = CPXgetobjsen( env_, getMutableLpPtr() ); int err = CPXfreeprob( env_, &lp_ ); checkCPXerror( err, "CPXfreeprob", "loadProblem" ); lp_ = NULL; freeAllMemory(); CPXchgobjsen(env_, getLpPtr(), objDirection); } return; } if (nr == 0) { int objDirection = CPXgetobjsen( env_, getMutableLpPtr() ); if (lp_ != NULL) { // kill old LP int err = CPXfreeprob( env_, &lp_ ); checkCPXerror( err, "CPXfreeprob", "loadProblem" ); lp_ = NULL; freeAllMemory(); } // getLpPtr() call will create new LP int err = CPXnewcols( env_, getLpPtr(), nc, obj, collb, colub, NULL, NULL); checkCPXerror( err, "CPXcopylp", "loadProblem" ); CPXchgobjsen(env_, getLpPtr(), objDirection); return; } char *lclRowsen = NULL ; double *lclRowrhs = NULL ; if (rowsen == NULL) { lclRowsen = new char[nr] ; CoinFillN(lclRowsen,nr,'G') ; rowsen = lclRowsen ; } if (rowrhs == NULL) { lclRowrhs = new double[nr] ; CoinFillN(lclRowrhs,nr,0.0) ; } int i; // Set column values to defaults if NULL pointer passed int * len = new int[nc]; double * clb = new double[nc]; double * cub = new double[nc]; double * ob = new double[nc]; double * rr = new double[nr]; double * rhs = new double[nr]; char * sen = new char[nr]; for (i = 0; i < nc; ++i) { len[i] = start[i+1] - start[i]; } if ( collb != NULL ) CoinDisjointCopyN(collb, nc, clb); else CoinFillN(clb, nc, 0.0); if ( colub!=NULL ) CoinDisjointCopyN(colub, nc, cub); else CoinFillN(cub, nc, getInfinity()); if ( obj!=NULL ) CoinDisjointCopyN(obj, nc, ob); else CoinFillN(ob, nc, 0.0); if ( rowrng != NULL ) { for ( i=0; i= 0 ) { rhs[i] = rowrhs[i] - rowrng[i]; rr[i] = rowrng[i]; } else { rhs[i] = rowrhs[i]; rr[i] = -rowrng[i]; } } else { rhs[i] = rowrhs[i]; rr[i] = 0.0; } } } else { CoinDisjointCopyN(rowrhs, nr, rhs); } CoinDisjointCopyN(rowsen, nr, sen); int objDirection = CPXgetobjsen( env_, getMutableLpPtr() ); int err = CPXcopylp( env_, getLpPtr(), nc, nr, // Leave ObjSense alone(set to current value). objDirection, ob, rhs, sen, const_cast(start), len, const_cast(index), const_cast(value), clb, cub, rr); checkCPXerror( err, "CPXcopylp", "loadProblem" ); delete[] len; delete[] clb; delete[] cub; delete[] ob; delete[] rr; delete[] rhs; delete[] sen; if (lclRowsen != NULL) delete[] lclRowsen ; if (lclRowrhs != NULL) delete[] lclRowrhs ; resizeColType(nc); CoinFillN(coltype_, nc, 'C'); } //----------------------------------------------------------------------------- // Read mps files //----------------------------------------------------------------------------- int OsiCpxSolverInterface::readMps( const char * filename, const char * extension ) { debugMessage("OsiCpxSolverInterface::readMps(%s, %s)\n", filename, extension); #if 0 std::string f(filename); std::string e(extension); std::string fullname = f + "." + e; int err = CPXreadcopyprob( env_, getLpPtr(), const_cast( fullname.c_str() ), NULL ); checkCPXerror( err, "CPXreadcopyprob", "readMps" ); #endif // just call base class method return OsiSolverInterface::readMps(filename,extension); } //----------------------------------------------------------------------------- // Write mps files //----------------------------------------------------------------------------- void OsiCpxSolverInterface::writeMps( const char * filename, const char * extension, double objSense ) const { debugMessage("OsiCpxSolverInterface::writeMps(%s, %s, %g)\n", filename, extension, objSense); // *FIXME* : this will not output ctype information to the MPS file char filetype[4] = "MPS"; std::string f(filename); std::string e(extension); std::string fullname = f + "." + e; int err = CPXwriteprob( env_, getMutableLpPtr(), const_cast( fullname.c_str() ), filetype ); checkCPXerror( err, "CPXwriteprob", "writeMps" ); } void OsiCpxSolverInterface::passInMessageHandler(CoinMessageHandler * handler) { int err; CPXCHANNELptr cpxresults; CPXCHANNELptr cpxwarning; CPXCHANNELptr cpxerror; CPXCHANNELptr cpxlog; err = CPXgetchannels(env_, &cpxresults, &cpxwarning, &cpxerror, &cpxlog); checkCPXerror( err, "CPXgetchannels", "gutsOfConstructor" ); err = CPXdelfuncdest(env_, cpxresults, messageHandler(), OsiCpxMessageCallbackResultLog); checkCPXerror( err, "CPXdelfuncdest", "gutsOfConstructor" ); err = CPXdelfuncdest(env_, cpxlog, messageHandler(), OsiCpxMessageCallbackResultLog); checkCPXerror( err, "CPXdelfuncdest", "gutsOfConstructor" ); err = CPXdelfuncdest(env_, cpxwarning, messageHandler(), OsiCpxMessageCallbackWarning); checkCPXerror( err, "CPXdelfuncdest", "gutsOfConstructor" ); err = CPXdelfuncdest(env_, cpxerror, messageHandler(), OsiCpxMessageCallbackError); checkCPXerror( err, "CPXdelfuncdest", "gutsOfConstructor" ); OsiSolverInterface::passInMessageHandler(handler); err = CPXaddfuncdest(env_, cpxresults, messageHandler(), OsiCpxMessageCallbackResultLog); checkCPXerror( err, "CPXaddfuncdest", "gutsOfConstructor" ); err = CPXaddfuncdest(env_, cpxlog, messageHandler(), OsiCpxMessageCallbackResultLog); checkCPXerror( err, "CPXaddfuncdest", "gutsOfConstructor" ); err = CPXaddfuncdest(env_, cpxwarning, messageHandler(), OsiCpxMessageCallbackWarning); checkCPXerror( err, "CPXaddfuncdest", "gutsOfConstructor" ); err = CPXaddfuncdest(env_, cpxerror, messageHandler(), OsiCpxMessageCallbackError); checkCPXerror( err, "CPXaddfuncdest", "gutsOfConstructor" ); } //############################################################################# // CPX specific public interfaces //############################################################################# CPXENVptr OsiCpxSolverInterface::getEnvironmentPtr() { assert( env_ != NULL ); return env_; } CPXLPptr OsiCpxSolverInterface::getLpPtr( int keepCached ) { freeCachedData( keepCached ); return getMutableLpPtr(); } //----------------------------------------------------------------------------- const char * OsiCpxSolverInterface::getCtype() const { debugMessage("OsiCpxSolverInterface::getCtype()\n"); return coltype_; } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiCpxSolverInterface::OsiCpxSolverInterface() : OsiSolverInterface(), env_(NULL), lp_(NULL), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(1000000), // ??? default iteration limit for strong branching is large obj_(NULL), collower_(NULL), colupper_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), rowlower_(NULL), rowupper_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL), coltype_(NULL), coltypesize_(0), probtypemip_(false), domipstart(false), disableadvbasis(false) { debugMessage("OsiCpxSolverInterface::OsiCpxSolverInterface()\n"); gutsOfConstructor(); } //---------------------------------------------------------------- // Clone //---------------------------------------------------------------- OsiSolverInterface * OsiCpxSolverInterface::clone(bool copyData) const { debugMessage("OsiCpxSolverInterface::clone(%d)\n", copyData); return( new OsiCpxSolverInterface( *this ) ); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiCpxSolverInterface::OsiCpxSolverInterface( const OsiCpxSolverInterface & source ) : OsiSolverInterface(source), env_(NULL), lp_(NULL), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(source.hotStartMaxIteration_), obj_(NULL), collower_(NULL), colupper_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), rowlower_(NULL), rowupper_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL), coltype_(NULL), coltypesize_(0), probtypemip_(false), domipstart(false), disableadvbasis(false) { debugMessage("OsiCpxSolverInterface::OsiCpxSolverInterface(%p)\n", (void*)&source); gutsOfConstructor(); gutsOfCopy( source ); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiCpxSolverInterface::~OsiCpxSolverInterface() { debugMessage("OsiCpxSolverInterface::~OsiCpxSolverInterface()\n"); gutsOfDestructor(); } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiCpxSolverInterface& OsiCpxSolverInterface::operator=( const OsiCpxSolverInterface& rhs ) { debugMessage("OsiCpxSolverInterface::operator=(%p)\n", (void*)&rhs); if (this != &rhs) { OsiSolverInterface::operator=( rhs ); gutsOfDestructor(); gutsOfConstructor(); if ( rhs.lp_ !=NULL ) gutsOfCopy( rhs ); } return *this; } //############################################################################# // Applying cuts //############################################################################# void OsiCpxSolverInterface::applyColCut( const OsiColCut & cc ) { debugMessage("OsiCpxSolverInterface::applyColCut(%p)\n", (void*)&cc); const double * cplexColLB = getColLower(); const double * cplexColUB = getColUpper(); const CoinPackedVector & lbs = cc.lbs(); const CoinPackedVector & ubs = cc.ubs(); int i; for( i = 0; i < lbs.getNumElements(); ++i ) if ( lbs.getElements()[i] > cplexColLB[lbs.getIndices()[i]] ) setColLower( lbs.getIndices()[i], lbs.getElements()[i] ); for( i = 0; i < ubs.getNumElements(); ++i ) if ( ubs.getElements()[i] < cplexColUB[ubs.getIndices()[i]] ) setColUpper( ubs.getIndices()[i], ubs.getElements()[i] ); } //----------------------------------------------------------------------------- void OsiCpxSolverInterface::applyRowCut( const OsiRowCut & rowCut ) { debugMessage("OsiCpxSolverInterface::applyRowCut(%p)\n", (void*)&rowCut); int err = 0; double rhs = 0.0; double rng = 0.0; char sns; double lb = rowCut.lb(); double ub = rowCut.ub(); if( lb <= -getInfinity() && ub >= getInfinity() ) // free constraint { rhs = -getInfinity(); rng = 2*getInfinity(); // CPLEX doesn't support free constraints sns = 'R'; // -> implement them as ranged rows with infinite bounds } else if( lb <= -getInfinity() ) // <= constraint { rhs = ub; sns = 'L'; } else if( ub >= getInfinity() ) // >= constraint { rhs = lb; sns = 'G'; } else if( ub == lb ) // = constraint { rhs = ub; sns = 'E'; } else // range constraint { rhs = lb; rng = ub - lb; sns = 'R'; } int rmatbeg = 0; err = CPXaddrows( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_COLUMN ), 0, 1, rowCut.row().getNumElements(), &rhs, &sns, &rmatbeg, const_cast( rowCut.row().getIndices() ), const_cast( rowCut.row().getElements() ), NULL, NULL ); checkCPXerror( err, "CPXaddrows", "applyRowCut" ); if( sns == 'R' ) { err = CPXchgcoef( env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_COLUMN ), CPXgetnumrows(env_, getLpPtr( OsiCpxSolverInterface::KEEPCACHED_COLUMN ))-1, -2, rng ); checkCPXerror( err, "CPXchgcoef", "applyRowCut" ); } } //############################################################################# // Private methods (non-static and static) and static data //############################################################################# //------------------------------------------------------------------- // Get pointer to CPXLPptr. // const methods should use getMutableLpPtr(). // non-const methods should use getLpPtr(). //------------------------------------------------------------------- CPXLPptr OsiCpxSolverInterface::getMutableLpPtr() const { if ( lp_ == NULL ) { int err; assert(env_ != NULL); #if 0 //char pn[] = "OSI_CPLEX"; lp_ = CPXcreateprob( env_, &err, pn ); #else std::string pn; getStrParam(OsiProbName,pn); lp_ = CPXcreateprob( env_, &err, const_cast(pn.c_str()) ); #endif checkCPXerror( err, "CPXcreateprob", "getMutableLpPtr" ); // err = CPXchgprobtype(env_,lp_,CPXPROB_LP); // checkCPXerror( err, "CPXchgprobtype", "getMutableLpPtr" ); assert( lp_ != NULL ); } return lp_; } //------------------------------------------------------------------- CPXENVptr OsiCpxSolverInterface::getMutableEnvironmentPtr() const { assert( env_ != NULL ); return env_; } //------------------------------------------------------------------- void OsiCpxSolverInterface::gutsOfCopy( const OsiCpxSolverInterface & source ) { // Set Objective Sense setObjSense(source.getObjSense()); // Set Rim and constraints const double* obj = source.getObjCoefficients(); const double* rhs = source.getRightHandSide(); const char* sense = source.getRowSense(); const CoinPackedMatrix * cols = source.getMatrixByCol(); const double* lb = source.getColLower(); const double* ub = source.getColUpper(); loadProblem(*cols,lb,ub,obj,sense,rhs,source.getRowRange()); // Set MIP information resizeColType(source.coltypesize_); CoinDisjointCopyN( source.coltype_, source.coltypesize_, coltype_ ); // Set Solution setColSolution(source.getColSolution()); setRowPrice(source.getRowPrice()); // Should also copy row and col names. #if 0 char** cname = new char*[numcols]; char* cnamestore = NULL; int surplus; err = CPXgetcolname( env_, source.lp_, cname, NULL, 0, &surplus, 0, numcols-1 ); if( err != CPXERR_NO_NAMES ) { cnamestore = new char[-surplus]; err = CPXgetcolname( env_, source.lp_, cname, cnamestore, -surplus, &surplus, 0, numcols-1 ); checkCPXerror( err, "CPXgetcolname", "gutsOfCopy" ); assert( surplus == 0 ); } else { delete [] cname; cname = NULL; } char** rname = new char*[numrows]; char* rnamestore = NULL; err = CPXgetrowname( env_, source.lp_, rname, NULL, 0, &surplus, 0, numrows-1 ); if( err != CPXERR_NO_NAMES ) { rnamestore = new char[-surplus]; err = CPXgetrowname( env_, source.lp_, rname, rnamestore, -surplus, &surplus, 0, numrows-1 ); checkCPXerror( err, "CPXgetrowname", "gutsOfCopy" ); assert( surplus == 0 ); } else { delete [] rname; rname = NULL; } err = CPXcopylpwnames( env_, getLpPtr(), numcols, numrows, objsen, const_cast(obj), const_cast(rhs), const_cast(sense), const_cast(cols->vectorStarts()), const_cast(cols->vectorLengths()), const_cast(cols->indices()), const_cast(cols->elements()), const_cast(lb), const_cast(ub), rng, cname, rname); checkCPXerror( err, "CPXcopylpwnames", "gutsOfCopy" ); if( rname != NULL ) { delete [] rnamestore; delete [] rname; } if( cname != NULL ) { delete [] cnamestore; delete [] cname; } delete [] rng; #endif } //------------------------------------------------------------------- void OsiCpxSolverInterface::gutsOfConstructor() { int err; #if CPX_VERSION >= 800 env_ = CPXopenCPLEX( &err ); #else env_ = CPXopenCPLEXdevelop( &err ); #endif checkCPXerror( err, "CPXopenCPLEXdevelop", "gutsOfConstructor" ); assert( env_ != NULL ); CPXCHANNELptr cpxresults; CPXCHANNELptr cpxwarning; CPXCHANNELptr cpxerror; CPXCHANNELptr cpxlog; err = CPXgetchannels(env_, &cpxresults, &cpxwarning, &cpxerror, &cpxlog); checkCPXerror( err, "CPXgetchannels", "gutsOfConstructor" ); err = CPXaddfuncdest(env_, cpxresults, messageHandler(), OsiCpxMessageCallbackResultLog); checkCPXerror( err, "CPXaddfuncdest", "gutsOfConstructor" ); err = CPXaddfuncdest(env_, cpxlog, messageHandler(), OsiCpxMessageCallbackResultLog); checkCPXerror( err, "CPXaddfuncdest", "gutsOfConstructor" ); err = CPXaddfuncdest(env_, cpxwarning, messageHandler(), OsiCpxMessageCallbackWarning); checkCPXerror( err, "CPXaddfuncdest", "gutsOfConstructor" ); err = CPXaddfuncdest(env_, cpxerror, messageHandler(), OsiCpxMessageCallbackError); checkCPXerror( err, "CPXaddfuncdest", "gutsOfConstructor" ); /* turn off all output to screen */ err = CPXsetintparam( env_, CPX_PARAM_SCRIND, CPX_OFF ); checkCPXerror( err, "CPXsetintparam", "gutsOfConstructor" ); #if 0 // CPXcreateprob was moved to getLpPtr() method. lp_ = CPXcreateprob( env_, &err, "OSI_CPLEX" ); checkCPXerror( err, "CPXcreateprob", "gutsOfConstructor" ); // err = CPXchgprobtype(env_,lp_,CPXPROB_LP); // checkCPXerror( err, "CPXchgprobtype", "getMutableLpPtr" ); assert( lp_ != NULL ); #endif } //------------------------------------------------------------------- void OsiCpxSolverInterface::gutsOfDestructor() { if ( lp_ != NULL ) { int err = CPXfreeprob( env_, &lp_ ); checkCPXerror( err, "CPXfreeprob", "gutsOfDestructor" ); lp_=NULL; freeAllMemory(); } if ( env_ != NULL ) { int err = CPXcloseCPLEX( &env_ ); checkCPXerror( err, "CPXcloseCPLEX", "gutsOfDestructor" ); env_ = NULL; } assert( lp_==NULL ); assert( env_==NULL ); assert( obj_==NULL ); assert( collower_==NULL ); assert( colupper_==NULL ); assert( rowsense_==NULL ); assert( rhs_==NULL ); assert( rowrange_==NULL ); assert( rowlower_==NULL ); assert( rowupper_==NULL ); assert( colsol_==NULL ); assert( rowsol_==NULL ); assert( redcost_==NULL ); assert( rowact_==NULL ); assert( matrixByRow_==NULL ); assert( matrixByCol_==NULL ); assert( coltype_==NULL ); assert( coltypesize_==0 ); } //------------------------------------------------------------------- /// free cached vectors void OsiCpxSolverInterface::freeCachedColRim() { freeCacheDouble( obj_ ); freeCacheDouble( collower_ ); freeCacheDouble( colupper_ ); assert( obj_==NULL ); assert( collower_==NULL ); assert( colupper_==NULL ); } void OsiCpxSolverInterface::freeCachedRowRim() { freeCacheChar( rowsense_ ); freeCacheDouble( rhs_ ); freeCacheDouble( rowrange_ ); freeCacheDouble( rowlower_ ); freeCacheDouble( rowupper_ ); assert( rowsense_==NULL ); assert( rhs_==NULL ); assert( rowrange_==NULL ); assert( rowlower_==NULL ); assert( rowupper_==NULL ); } void OsiCpxSolverInterface::freeCachedMatrix() { freeCacheMatrix( matrixByRow_ ); freeCacheMatrix( matrixByCol_ ); assert( matrixByRow_==NULL ); assert( matrixByCol_==NULL ); } void OsiCpxSolverInterface::freeCachedResults() { freeCacheDouble( colsol_ ); freeCacheDouble( rowsol_ ); freeCacheDouble( redcost_ ); freeCacheDouble( rowact_ ); assert( colsol_==NULL ); assert( rowsol_==NULL ); assert( redcost_==NULL ); assert( rowact_==NULL ); } void OsiCpxSolverInterface::freeCachedData( int keepCached ) { if( !(keepCached & OsiCpxSolverInterface::KEEPCACHED_COLUMN) ) freeCachedColRim(); if( !(keepCached & OsiCpxSolverInterface::KEEPCACHED_ROW) ) freeCachedRowRim(); if( !(keepCached & OsiCpxSolverInterface::KEEPCACHED_MATRIX) ) freeCachedMatrix(); if( !(keepCached & OsiCpxSolverInterface::KEEPCACHED_RESULTS) ) freeCachedResults(); } void OsiCpxSolverInterface::freeAllMemory() { freeCachedData(); if( hotStartCStat_ != NULL ) delete[] hotStartCStat_; if( hotStartRStat_ != NULL ) delete[] hotStartRStat_; hotStartCStat_ = NULL; hotStartCStatSize_ = 0; hotStartRStat_ = NULL; hotStartRStatSize_ = 0; freeColType(); } //############################################################################# // Resets as if default constructor void OsiCpxSolverInterface::reset() { setInitialData(); // clear base class if (lp_ != NULL) { // kill old LP int err = CPXfreeprob( env_, &lp_ ); checkCPXerror( err, "CPXfreeprob", "loadProblem" ); lp_ = NULL; freeAllMemory(); } } #if CPX_VERSION >= 900 /**********************************************************************/ /* Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none */ int OsiCpxSolverInterface::canDoSimplexInterface() const { return 1; } /**********************************************************************/ bool OsiCpxSolverInterface::basisIsAvailable() const { CPXLPptr lp = getMutableLpPtr(); int solnmethod, solntype, pfeasind, dfeasind; int status = CPXsolninfo (env_, lp, &solnmethod, &solntype, &pfeasind, &dfeasind); if(status) { return false; } if(solntype == CPX_BASIC_SOLN) { return true; } return false; } /**********************************************************************/ /* CPLEX return codes: For cstat: CPX_AT_LOWER 0 : variable at lower bound CPX_BASIC 1 : variable is basic CPX_AT_UPPER 2 : variable at upper bound CPX_FREE_SUPER 3 : variable free and non-basic For rstat: Non ranged rows: CPX_AT_LOWER 0 : associated slack/surplus/artificial variable non-basic at value 0.0 CPX_BASIC 1 : associated slack/surplus/artificial variable basic Ranged rows: CPX_AT_LOWER 0 : associated slack/surplus/artificial variable non-basic at its lower bound CPX_BASIC 1 : associated slack/surplus/artificial variable basic CPX_AT_UPPER 2 : associated slack/surplus/artificial variable non-basic at upper bound Cplex adds a slack with coeff +1 in <= and =, with coeff -1 in >=, slack being non negative. We switch in order to get a "Clp tableau" where all the slacks have coeff +1. If a slack for >= is non basic, invB is not changed; column of the slack in opt tableau is flipped. If slack for >= is basic, corresp. row of invB is flipped; whole row of opt tableau is flipped; then whole column for the slack in opt tableau is flipped. */ /* Osi return codes: 0: free 1: basic 2: upper 3: lower */ void OsiCpxSolverInterface::getBasisStatus(int* cstat, int* rstat) const { CPXLPptr lp = getMutableLpPtr(); int status = CPXgetbase(env_, lp, cstat, rstat); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBasisStatus(): Unable to get base\n"); exit(1); } int ncol = getNumCols(); int nrow = getNumRows(); const int objsense = (int)getObjSense(); const double *dual = getRowPrice(); const double *row_act = getRowActivity(); const double *rowLower = getRowLower(); const double *rowUpper = getRowUpper(); char *sense = new char[nrow]; status = CPXgetsense(env_, lp, sense, 0, nrow-1); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBasisStatus(): Unable to get sense for the rows\n"); exit(1); } for(int i=0; i 0) { rstat[i] = 2; } } if(sense[i] == 'R') { if(rowUpper[i] > rowLower[i] + 1e-6) { if(row_act[i] < rowUpper[i] - 1e-6) { rstat[i] = 2; } } else { if(dual[i] > 0) { rstat[i] = 2; } } } if(sense[i] == 'G') { rstat[i] = 2; } break; case 1: break; case 2: if(sense[i] == 'E') { if(dual[i] < 0) { rstat[i] = 3; } } if(sense[i] == 'R') { if(rowUpper[i] > rowLower[i] + 1e-6) { if(row_act[i] > rowLower[i] + 1e-6) { rstat[i] = 3; } } else { if(dual[i] < 0) { rstat[i] = 3; } } } break; default: printf("### ERROR: OsiCpxSolverInterface::getBasisStatus(): unknown row status: %d\n", rstat[i]); break; } } } else { // objsense == -1 for(int i=0; i rowLower[i] + 1e-6) { if(row_act[i] < rowUpper[i] - 1e-6) { rstat[i] = 2; } } else { if(dual[i] < 0) { rstat[i] = 2; } } } if(sense[i] == 'G') { rstat[i] = 2; } break; case 1: break; case 2: if(sense[i] == 'E') { if(dual[i] > 0) { rstat[i] = 3; } } if(sense[i] == 'R') { if(rowUpper[i] > rowLower[i] + 1e-6) { if(row_act[i] > rowLower[i] + 1e-6) { rstat[i] = 3; } } else { if(dual[i] > 0) { rstat[i] = 3; } } } break; default: printf("### ERROR: OsiCpxSolverInterface::getBasisStatus(): unknown row status: %d\n", rstat[i]); break; } } } delete[] sense; } /**********************************************************************/ void OsiCpxSolverInterface::getBInvARow(int row, double* z, double * slack) const { CPXLPptr lp = getMutableLpPtr(); int nrow = getNumRows(); int ncol = getNumCols(); char *sense =new char[nrow]; int status = CPXgetsense(env_, lp, sense, 0, nrow-1); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBInvARow(): Unable to get senses for the rows\n"); exit(1); } status = CPXbinvarow(env_, lp, row, z); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBInvARow(): Unable to get row %d of the tableau\n", row); exit(1); } if(slack != NULL) { status = CPXbinvrow(env_, lp, row, slack); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBInvARow(): Unable to get row %d of B inverse\n", row); exit(1); } // slack contains now the row of BInv(cplex); // slack(cplex) is obtained by flipping in slack all entries for >= constr // slack(clp) is obtained by flipping the same entries in slack(cplex) // i.e. slack(clp) is the current slack. } if(sense[row] == 'G') { int *ind_bas = new int[nrow]; int ind_slack = ncol+row; getBasics(ind_bas); for(int i=0; i=ncol) { // binv row corresponds to a slack variable int Arow=ind_bas[row]-ncol; // Arow is the number of the row in the problem matrix which this slack belongs to char sense; status = CPXgetsense(env_, lp, &sense, Arow, Arow); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBInvRow(): Unable to get senses for row %d\n", Arow); exit(1); } if(sense == 'G') { // slack has coeff -1 in Cplex; thus row in binv must be flipped for(int j=0; j ncol && sense[ind_bas[i]-ncol] == 'G') vec[i] = -vec[i]; // slack for row is basic; whole row must be flipped delete[] sense; delete[] ind_bas; } /* getBInvACol */ /**********************************************************************/ void OsiCpxSolverInterface::getBInvCol(int col, double* vec) const { CPXLPptr lp = getMutableLpPtr(); int status = CPXbinvcol(env_, lp, col, vec); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBInvCol(): Unable to get column %d of the basis inverse\n", col); exit(1); } int nrow = getNumRows(); int ncol = getNumCols(); char *sense =new char[nrow]; status = CPXgetsense(env_, lp, sense, 0, nrow-1); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBInvCol(): Unable to get senses for the rows\n"); exit(1); } int *ind_bas = new int[nrow]; getBasics(ind_bas); for(int i=0; i ncol && sense[ind_bas[i]-ncol] == 'G') vec[i] = -vec[i]; // slack for row i is basic; whole row must be flipped delete[] sense; delete[] ind_bas; } /* getBInvCol */ /**********************************************************************/ void OsiCpxSolverInterface::getBasics(int* index) const { int ncol = getNumCols(); int nrow = getNumRows(); CPXLPptr lp = getMutableLpPtr(); double *cplex_trash = new double[nrow]; int status = CPXgetbhead(env_, lp, index, cplex_trash); if(status) { printf("### ERROR: OsiCpxSolverInterface::getBasics(): Unable to get basis head\n"); exit(1); } for(int i=0; i= 900 */ /**********************************************************************/ /* Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none */ int OsiCpxSolverInterface::canDoSimplexInterface() const { return 0; } /**********************************************************************/ bool OsiCpxSolverInterface::basisIsAvailable() const { printf("### ERROR: OsiCpxSolverInterface::basisIsAvailable(): Cplex version lower than 9.0\n"); exit(1); return false; } /**********************************************************************/ void OsiCpxSolverInterface::getBasisStatus(int* cstat, int* rstat) const { printf("### ERROR: OsiCpxSolverInterface::getBasisStatus(): Cplex version lower than 9.0\n"); exit(1); } /**********************************************************************/ void OsiCpxSolverInterface::getBInvARow(int row, double* z, double * slack) const { printf("### ERROR: OsiCpxSolverInterface::getBInvARow(): Cplex version lower than 9.0\n"); exit(1); } /* getBInvARow */ /**********************************************************************/ void OsiCpxSolverInterface::getBInvRow(int row, double* z) const { printf("### ERROR: OsiCpxSolverInterface::getBInvRow(): Cplex version lower than 9.0\n"); exit(1); } /* getBInvRow */ /**********************************************************************/ void OsiCpxSolverInterface::getBInvACol(int col, double* vec) const { printf("### ERROR: OsiCpxSolverInterface::getBInvACol(): Cplex version lower than 9.0\n"); exit(1); } /* getBInvACol */ /**********************************************************************/ void OsiCpxSolverInterface::getBInvCol(int col, double* vec) const { printf("### ERROR: OsiCpxSolverInterface::getBInvCol(): Cplex version lower than 9.0\n"); exit(1); } /* getBInvCol */ /**********************************************************************/ void OsiCpxSolverInterface::getBasics(int* index) const { printf("### ERROR: OsiCpxSolverInterface::getBasics(): Cplex version lower than 9.0\n"); exit(1); } /* getBasics */ #endif /* not CPX_VERSION >= 900 */ CoinMP-1.8.3/Osi/src/OsiCpx/OsiCpxSolverInterface.hpp0000644000175000017500000010167712574576363021032 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for CPLEX // author: Tobias Pfender // Konrad-Zuse-Zentrum Berlin (Germany) // email: pfender@zib.de // date: 09/25/2000 // license: this file may be freely distributed under the terms of EPL // comments: please scan this file for '???' and read the comments //----------------------------------------------------------------------------- // Copyright (C) 2000, Tobias Pfender, International Business Machines // Corporation and others. All Rights Reserved. #ifndef OsiCpxSolverInterface_H #define OsiCpxSolverInterface_H #include "OsiSolverInterface.hpp" #include "CoinWarmStartBasis.hpp" #include "OsiColCut.hpp" #include "OsiRowCut.hpp" typedef struct cpxlp* CPXLPptr; typedef struct cpxenv* CPXENVptr; /** CPLEX Solver Interface Instantiation of OsiCpxSolverInterface for CPLEX */ class OsiCpxSolverInterface : virtual public OsiSolverInterface { friend void OsiCpxSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound(); //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Set a string parameter bool setStrParam(OsiStrParam key, const std::string & value); // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; // Set mipstart option (pass column solution to CPLEX before MIP start) void setMipStart(bool value) { domipstart = value; } // Get mipstart option value bool getMipStart() const { return domipstart; } //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ //@{ /*! \brief Get an empty warm start object This routine returns an empty CoinWarmStartBasis object. Its purpose is to provide a way to give a client a warm start basis object of the appropriate type, which can resized and modified as desired. */ CoinWarmStart *getEmptyWarmStart () const; /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching).
The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const; /// Get number of rows virtual int getNumRows() const; /// Get number of nonzero elements virtual int getNumElements() const; /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const; /** Get pointer to array[getNumRows()] of row constraint senses.
  • 'L': <= constraint
  • 'E': = constraint
  • 'G': >= constraint
  • 'R': ranged constraint
  • 'N': free constraint
*/ virtual const char * getRowSense() const; /** Get pointer to array[getNumRows()] of rows right-hand sides
  • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
  • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
  • if rowsense()[i] == 'N' then rhs()[i] == 0.0
*/ virtual const double * getRightHandSide() const; /** Get pointer to array[getNumRows()] of row ranges.
  • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
  • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
*/ virtual const double * getRowRange() const; /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const; /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const; /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const; /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const; /// Return true if column is continuous virtual bool isContinuous(int colNumber) const; #if 0 /// Return true if column is binary virtual bool isBinary(int columnNumber) const; /** Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ virtual bool isInteger(int columnNumber) const; /// Return true if column is general integer virtual bool isIntegerNonBinary(int columnNumber) const; /// Return true if column is binary and not fixed at either bound virtual bool isFreeBinary(int columnNumber) const; #endif /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const; //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const; /// Get objective function value virtual double getObjValue() const; /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const; /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay = false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
NOTE for users of solver interfaces:
It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; #if 0 /** Get vector of indices of solution which are integer variables presently at fractional values */ virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const; #endif //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ); /** Set a a set of objective function coefficients */ virtual void setObjCoeffSet(const int* indexFirst, const int* indexLast, const double* coeffList); using OsiSolverInterface::setColLower ; /** Set a single column lower bound
Use -COIN_DBL_MAX for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ); using OsiSolverInterface::setColUpper ; /** Set a single column upper bound
Use COIN_DBL_MAX for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound
The default implementation just invokes setColLower() and setColUpper() */ virtual void setColBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
The default implementation just invokes setCollower() and setColupper() over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound
Use -COIN_DBL_MAX for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
Use COIN_DBL_MAX for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ); /** Set a single row lower and upper bound
The default implementation just invokes setRowLower() and setRowUpper() */ virtual void setRowBounds( int elementIndex, double lower, double upper ); /** Set the type of a single row
*/ virtual void setRowType(int index, char sense, double rightHandSide, double range); /** Set the bounds on a number of rows simultaneously
The default implementation just invokes setRowLower() and setRowUpper() over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
The default implementation just invokes setRowType() and over and over again. @param [indexfirst,indexLast] contains the indices of the constraints whose type changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s); /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ using OsiSolverInterface::addCol ; /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); using OsiSolverInterface::addCols ; /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); /** */ virtual void deleteCols(const int num, const int * colIndices); using OsiSolverInterface::addRow ; /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); using OsiSolverInterface::addRows ; /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); /** */ virtual void deleteRows(const int num, const int * rowIndices); #if 0 // ??? implemented in OsiSolverInterface //----------------------------------------------------------------------- /** Apply a collection of cuts.
Only cuts which have an effectiveness >= effectivenessLb are applied.
  • ReturnCode.numberIneffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
  • ReturnCode.numberInconsistent() -- number of invalid cuts
  • ReturnCode.numberInconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
  • ReturnCode.numberInfeasible() -- number of cuts that would make this integer model infeasible
  • ReturnCode.numberApplied() -- number of integer cuts which were applied to the integer model
  • cs.size() == numberIneffective() + numberInconsistent() + numberInconsistentWrtIntegerModel() + numberInfeasible() + nubmerApplied()
*/ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); #endif //@} //@} //--------------------------------------------------------------------------- /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient
*/ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • obj: all variables have 0 objective coefficient
  • rowsen: all rows are >=
  • rowrhs: all right hand sides are 0
  • rowrng: 0 for the ranged rows
*/ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); using OsiSolverInterface::readMps ; /** Read an mps file from the given filename */ virtual int readMps(const char *filename, const char *extension = "mps"); /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; //@} /**@name Message handling */ //@{ /** Pass in a message handler It is the client's responsibility to destroy a message handler installed by this routine; it will not be destroyed when the solver interface is destroyed. */ void passInMessageHandler(CoinMessageHandler * handler); //@} //--------------------------------------------------------------------------- /**@name CPLEX specific public interfaces */ //@{ /** Get pointer to CPLEX model and free all specified cached data entries (combined with logical or-operator '|' ): */ enum keepCachedFlag { /// discard all cached data (default) KEEPCACHED_NONE = 0, /// column information: objective values, lower and upper bounds, variable types KEEPCACHED_COLUMN = 1, /// row information: right hand sides, ranges and senses, lower and upper bounds for row KEEPCACHED_ROW = 2, /// problem matrix: matrix ordered by column and by row KEEPCACHED_MATRIX = 4, /// LP solution: primal and dual solution, reduced costs, row activities KEEPCACHED_RESULTS = 8, /// only discard cached LP solution KEEPCACHED_PROBLEM = KEEPCACHED_COLUMN | KEEPCACHED_ROW | KEEPCACHED_MATRIX, /// keep all cached data (similar to getMutableLpPtr()) KEEPCACHED_ALL = KEEPCACHED_PROBLEM | KEEPCACHED_RESULTS, /// free only cached column and LP solution information FREECACHED_COLUMN = KEEPCACHED_PROBLEM & ~KEEPCACHED_COLUMN, /// free only cached row and LP solution information FREECACHED_ROW = KEEPCACHED_PROBLEM & ~KEEPCACHED_ROW, /// free only cached matrix and LP solution information FREECACHED_MATRIX = KEEPCACHED_PROBLEM & ~KEEPCACHED_MATRIX, /// free only cached LP solution information FREECACHED_RESULTS = KEEPCACHED_ALL & ~KEEPCACHED_RESULTS }; CPXLPptr getLpPtr( int keepCached = KEEPCACHED_NONE ); //@{ /// Method to access CPLEX environment pointer CPXENVptr getEnvironmentPtr(); //@} /// return a vector of variable types (continous, binary, integer) const char* getCtype() const; /**@name Constructors and destructor */ //@{ /// Default Constructor OsiCpxSolverInterface(); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiCpxSolverInterface( const OsiCpxSolverInterface& ); /// Assignment operator OsiCpxSolverInterface& operator=( const OsiCpxSolverInterface& rhs ); /// Destructor virtual ~OsiCpxSolverInterface(); /// Resets as if default constructor virtual void reset(); //@} /***************************************************************************/ /**@name OsiSimplexInterface methods Cplex adds a slack with coeff +1 in "<=" and "=" constraints, with coeff -1 in ">=", slack being non negative. We switch in order to get a "Clp tableau" where all the slacks have coefficient +1 in the original tableau. If a slack for ">=" is non basic, invB is not changed; column of the slack in the optimal tableau is flipped. If a slack for ">=" is basic, corresp. row of invB is flipped; whole row of the optimal tableau is flipped; then whole column for the slack in opt tableau is flipped. Ranged rows are not supported. It might work, but no garantee is given. Code implemented only for Cplex9.0 and higher, lower version number of Cplex will abort the code. */ //@{ /** Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none */ virtual int canDoSimplexInterface() const; using OsiSolverInterface::enableSimplexInterface ; /** Useless function, defined only for compatibility with OsiSimplexInterface */ virtual void enableSimplexInterface(int doingPrimal) {}; /** Useless function, defined only for compatibility with OsiSimplexInterface */ virtual void disableSimplexInterface() {}; /** Useless function, defined only for compatibility with OsiSimplexInterface */ virtual void enableFactorization() const {}; /** Useless function, defined only for compatibility with OsiSimplexInterface */ virtual void disableFactorization() const {}; ///Returns true if a basis is available virtual bool basisIsAvailable() const; /** Returns a basis status of the structural/artificial variables At present as warm start i.e 0: free, 1: basic, 2: upper, 3: lower */ virtual void getBasisStatus(int* cstat, int* rstat) const; ///Get a row of the tableau (slack part in slack if not NULL) virtual void getBInvARow(int row, double* z, double * slack=NULL) const; ///Get a row of the basis inverse virtual void getBInvRow(int row, double* z) const; ///Get a column of the tableau virtual void getBInvACol(int col, double* vec) const; ///Get a column of the basis inverse virtual void getBInvCol(int col, double* vec) const; /** Get indices of the pivot variable in each row (order of indices corresponds to the order of elements in a vector retured by getBInvACol() and getBInvCol()). */ virtual void getBasics(int* index) const; /// switches CPLEX to prob type LP void switchToLP(); /// switches CPLEX to prob type MIP void switchToMIP(); //@} /***************************************************************************/ protected: /// Get LP Pointer for const methods CPXLPptr getMutableLpPtr() const; /// Get Environment Pointer for const methods CPXENVptr getMutableEnvironmentPtr() const; /**@name Protected methods */ //@{ /// Apply a row cut. Return true if cut was applied. virtual void applyRowCut( const OsiRowCut & rc ); /** Apply a column cut (bound adjustment). Return true if cut was applied. */ virtual void applyColCut( const OsiColCut & cc ); //@} private: /**@name Private static class functions */ //@{ /// resizes coltype_ vector to be able to store at least minsize elements void resizeColType( int minsize ); /// frees colsize_ vector void freeColType(); //@} /**@name Private methods */ //@{ /// The real work of a copy constructor (used by copy and assignment) void gutsOfCopy( const OsiCpxSolverInterface & source ); /// The real work of the constructor void gutsOfConstructor(); /// The real work of the destructor void gutsOfDestructor(); /// free cached column rim vectors void freeCachedColRim(); /// free cached row rim vectors void freeCachedRowRim(); /// free cached result vectors void freeCachedResults(); /// free cached matrices void freeCachedMatrix(); /// free all cached data (except specified entries, see getLpPtr()) void freeCachedData( int keepCached = KEEPCACHED_NONE ); /// free all allocated memory void freeAllMemory(); //@} /**@name Private member data */ //@{ /// CPLEX environment used in this class instance mutable CPXENVptr env_; /// CPLEX model represented by this class instance mutable CPXLPptr lp_; /// Hotstart information int *hotStartCStat_; int hotStartCStatSize_; int *hotStartRStat_; int hotStartRStatSize_; int hotStartMaxIteration_; /**@name Cached information derived from the CPLEX model */ //@{ /// Pointer to objective vector mutable double *obj_; /// Pointer to dense vector of variable lower bounds mutable double *collower_; /// Pointer to dense vector of variable lower bounds mutable double *colupper_; /// Pointer to dense vector of row sense indicators mutable char *rowsense_; /// Pointer to dense vector of row right-hand side values mutable double *rhs_; /// Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) mutable double *rowrange_; /// Pointer to dense vector of row lower bounds mutable double *rowlower_; /// Pointer to dense vector of row upper bounds mutable double *rowupper_; /// Pointer to primal solution vector mutable double *colsol_; /// Pointer to dual solution vector mutable double *rowsol_; /// Pointer to reduced cost vector mutable double *redcost_; /// Pointer to row activity (slack) vector mutable double *rowact_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByRow_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByCol_; //@} /**@name Additional information needed for storing MIP problems */ //@{ /// Pointer to dense vector of variable types (continous, binary, integer) char *coltype_; /// Size of allocated memory for coltype_ int coltypesize_; /// Stores whether CPLEX' prob type is currently set to MIP mutable bool probtypemip_; /// Whether to pass a column solution to CPLEX before starting MIP solve (copymipstart) bool domipstart; /// Whether to disable use of advanced basis (if given) bool disableadvbasis; //@} }; //############################################################################# /** A function that tests the methods in the OsiCpxSolverInterface class. */ void OsiCpxSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Osi/src/OsiCommonTest/0000755000175000017500000000000012600453455015404 5ustar renereneCoinMP-1.8.3/Osi/src/OsiCommonTest/OsiRowCutDebuggerTest.cpp0000644000175000017500000001101611541753202022306 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "OsiUnitTests.hpp" #include "OsiRowCutDebugger.hpp" //-------------------------------------------------------------------------- // test cut debugger methods. void OsiRowCutDebuggerUnitTest(const OsiSolverInterface * baseSiP, const std::string & mpsDir) { CoinRelFltEq eq; // Test default constructor { OsiRowCutDebugger r; OSIUNITTEST_ASSERT_ERROR(r.integerVariable_ == NULL, {}, "osirowcutdebugger", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.knownSolution_ == NULL, {}, "osirowcutdebugger", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.numberColumns_ == 0, {}, "osirowcutdebugger", "default constructor"); } { // Get non trivial instance OsiSolverInterface * imP = baseSiP->clone(); std::string fn = mpsDir+"exmip1"; imP->readMps(fn.c_str(),"mps"); OSIUNITTEST_ASSERT_ERROR(imP->getNumRows() == 5, {}, "osirowcutdebugger", "read exmip1"); /* Activate the debugger. The garbled name here is deliberate; the debugger should isolate the portion of the string between '/' and '.' (in normal use, this would be the base file name, stripped of the prefix and extension). */ imP->activateRowCutDebugger("ab cd /x/ /exmip1.asc"); int i; // return debugger const OsiRowCutDebugger * debugger = imP->getRowCutDebugger(); OSIUNITTEST_ASSERT_ERROR(debugger != NULL, {}, "osirowcutdebugger", "return debugger"); OSIUNITTEST_ASSERT_ERROR(debugger->numberColumns_ == 8, {}, "osirowcutdebugger", "return debugger"); const bool type[]={0,0,1,1,0,0,0,0}; const double values[]= {2.5, 0, 1, 1, 0.5, 3, 0, 0.26315789473684253}; CoinPackedVector objCoefs(8,imP->getObjCoefficients()); bool type_ok = true; #if 0 for (i=0;i<8;i++) type_ok &= type[i] == debugger->integerVariable_[i]; OSIUNITTEST_ASSERT_ERROR(type_ok, {}, "osirowcutdebugger", "???"); #endif double objValue = objCoefs.dotProduct(values); double debuggerObjValue = objCoefs.dotProduct(debugger->knownSolution_); OSIUNITTEST_ASSERT_ERROR(eq(objValue, debuggerObjValue), {}, "osirowcutdebugger", "objective value"); OsiRowCutDebugger rhs; { OsiRowCutDebugger rC1(*debugger); OSIUNITTEST_ASSERT_ERROR(rC1.numberColumns_ == 8, {}, "osirowcutdebugger", "copy constructor"); type_ok = true; for (i=0;i<8;i++) type_ok &= type[i] == rC1.integerVariable_[i]; OSIUNITTEST_ASSERT_ERROR(type_ok, {}, "osirowcutdebugger", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(eq(objValue,objCoefs.dotProduct(rC1.knownSolution_)), {}, "osirowcutdebugger", "copy constructor"); rhs = rC1; OSIUNITTEST_ASSERT_ERROR(rhs.numberColumns_ == 8, {}, "osirowcutdebugger", "assignment operator"); type_ok = true; for (i=0;i<8;i++) type_ok &= type[i] == rhs.integerVariable_[i]; OSIUNITTEST_ASSERT_ERROR(type_ok, {}, "osirowcutdebugger", "assignment operator"); OSIUNITTEST_ASSERT_ERROR(eq(objValue,objCoefs.dotProduct(rhs.knownSolution_)), {}, "osirowcutdebugger", "assignment operator"); } // Test that rhs has correct values even though lhs has gone out of scope OSIUNITTEST_ASSERT_ERROR(rhs.numberColumns_ == 8, {}, "osirowcutdebugger", "assignment operator"); type_ok = true; for (i=0;i<8;i++) type_ok &= type[i] == rhs.integerVariable_[i]; OSIUNITTEST_ASSERT_ERROR(type_ok, {}, "osirowcutdebugger", "assignment operator"); OSIUNITTEST_ASSERT_ERROR(eq(objValue,objCoefs.dotProduct(rhs.knownSolution_)), {}, "osirowcutdebugger", "assignment operator"); OsiRowCut cut[2]; const int ne = 3; int inx[ne] = { 0, 2, 3 }; double el[ne] = { 1., 1., 1. }; cut[0].setRow(ne,inx,el); cut[0].setUb(5.); el[1]=5; cut[1].setRow(ne,inx,el); cut[1].setUb(5); OsiCuts cs; cs.insert(cut[0]); cs.insert(cut[1]); OSIUNITTEST_ASSERT_ERROR(!debugger->invalidCut(cut[0]), {}, "osirowcutdebugger", "recognize (in)valid cut"); OSIUNITTEST_ASSERT_ERROR( debugger->invalidCut(cut[1]), {}, "osirowcutdebugger", "recognize (in)valid cut"); OSIUNITTEST_ASSERT_ERROR(debugger->validateCuts(cs,0,2) == 1, {}, "osirowcutdebugger", "recognize (in)valid cut"); OSIUNITTEST_ASSERT_ERROR(debugger->validateCuts(cs,0,1) == 0, {}, "osirowcutdebugger", "recognize (in)valid cut"); delete imP; } } CoinMP-1.8.3/Osi/src/OsiCommonTest/Makefile.in0000644000175000017500000005710712506051753017463 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Lou Hafer SFU 2010-11-20 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/OsiCommonTest DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Osi/config.h \ $(top_builddir)/src/Osi/config_osi.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libOsiCommonTests_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) \ @DEPENDENCY_LINKING_TRUE@ ../Osi/libOsi.la am_libOsiCommonTests_la_OBJECTS = OsiColCutTest.lo OsiCutsTest.lo \ OsiRowCutDebuggerTest.lo OsiRowCutTest.lo OsiSimplexAPITest.lo \ OsiNetlibTest.lo OsiUnitTestUtils.lo OsiSolverInterfaceTest.lo libOsiCommonTests_la_OBJECTS = $(am_libOsiCommonTests_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsiCommonTests_la_SOURCES) DIST_SOURCES = $(libOsiCommonTests_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # Common Test library for Osi # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in $libdir lib_LTLIBRARIES = libOsiCommonTests.la # List all source files for this library, including headers libOsiCommonTests_la_SOURCES = \ OsiCommonTests.hpp \ OsiColCutTest.cpp \ OsiCutsTest.cpp \ OsiRowCutDebuggerTest.cpp \ OsiRowCutTest.cpp \ OsiSimplexAPITest.cpp \ OsiNetlibTest.cpp \ OsiUnitTestUtils.cpp \ OsiSolverInterfaceTest.cpp # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libOsiCommonTests_la_LIBADD = $(OSILIB_LIBS) ../Osi/libOsi.la # Libtool flags libOsiCommonTests_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../Osi` $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, includecoindir = $(includedir)/coin includecoin_HEADERS = OsiUnitTests.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/OsiCommonTest/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/OsiCommonTest/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsiCommonTests.la: $(libOsiCommonTests_la_OBJECTS) $(libOsiCommonTests_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsiCommonTests_la_LDFLAGS) $(libOsiCommonTests_la_OBJECTS) $(libOsiCommonTests_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiColCutTest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiCutsTest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiNetlibTest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiRowCutDebuggerTest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiRowCutTest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiSimplexAPITest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiSolverInterfaceTest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiUnitTestUtils.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool 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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # 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: CoinMP-1.8.3/Osi/src/OsiCommonTest/Makefile.am0000644000175000017500000000346612243462564017455 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1942 2013-11-21 19:56:36Z stefan $ # Author: Lou Hafer SFU 2010-11-20 AUTOMAKE_OPTIONS = foreign ######################################################################## # Common Test library for Osi # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in $libdir lib_LTLIBRARIES = libOsiCommonTests.la # List all source files for this library, including headers libOsiCommonTests_la_SOURCES = \ OsiCommonTests.hpp \ OsiColCutTest.cpp \ OsiCutsTest.cpp \ OsiRowCutDebuggerTest.cpp \ OsiRowCutTest.cpp \ OsiSimplexAPITest.cpp \ OsiNetlibTest.cpp \ OsiUnitTestUtils.cpp \ OsiSolverInterfaceTest.cpp # List all additionally required libraries if DEPENDENCY_LINKING libOsiCommonTests_la_LIBADD = $(OSILIB_LIBS) ../Osi/libOsi.la endif # Libtool flags libOsiCommonTests_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../Osi` $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, includecoindir = $(includedir)/coin includecoin_HEADERS = OsiUnitTests.hpp CoinMP-1.8.3/Osi/src/OsiCommonTest/OsiSimplexAPITest.cpp0000644000175000017500000005647712101340333021403 0ustar renerene/* Copyright (C) 2000 -- 2010, Lou Hafer, International Business Machines, and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #include "CoinPragma.hpp" #include "OsiUnitTests.hpp" #include "OsiConfig.h" /* #include "CoinTime.hpp" #include #include #include #include #include #include #include */ #include "CoinHelperFunctions.hpp" #include "CoinFinite.hpp" #include "CoinFloatEqual.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "OsiSolverInterface.hpp" using namespace OsiUnitTest ; /* Helper methods for the OSI simplex API test. */ namespace { /* Test that the given vector is a unit vector with a 1 in the specified index position */ bool isUnitVector (int /* ndx */, int len, double *vec) { bool retval = false ; CoinAbsFltEq fltEq ; int nzCount = 0 ; int oneCount = 0 ; int onePosn = -1 ; for (int j = 0 ; j < len ; j++) { if (!fltEq(vec[j],0.0)) { nzCount++ ; if (fltEq(vec[j],1.0)) { oneCount++ ; onePosn = j ; } } } if (nzCount == 1 && oneCount == 1 && onePosn >= 0) { retval = true ; } if (OsiUnitTest::verbosity >= 2 && !retval) { if (nzCount > oneCount) { std::cout << " Vector contains " << nzCount-oneCount << " elements that are neither 1.0 or 0.0." << std::endl ; } if (oneCount > 1) { std::cout << " Vector contains " << oneCount << " elements that are 1.0." << std::endl ; } if (oneCount < 1) { std::cout << " Vector contains no elements that are 1.0." << std::endl ; } } return (retval) ; } /* Build a constraint system in basis order. Assumes that enableFactorization has been called. Indirect test of getBasics, because if the basis columns are loaded incorrectly, checks that B inv(B) = I will surely fail. */ CoinPackedMatrix *buildBasisMatrix (const OsiSolverInterface *si) { std::string solverName ; si->getStrParam(OsiSolverName,solverName) ; CoinPackedMatrix *basisMtx = new CoinPackedMatrix() ; const CoinPackedMatrix *mtx = si->getMatrixByCol() ; int m = si->getNumRows() ; int n = si->getNumCols() ; int *basicIndices = new int[m] ; si->getBasics(basicIndices) ; for (int i = 0 ; i < m ; i++) { int j = basicIndices[i] ; if (j < n) { if (OsiUnitTest::verbosity >= 2) { std::cout << " Retrieving column " << j << " for basis pos'n " << i << "." << std::endl ; } CoinShallowPackedVector col = mtx->getVector(j) ; basisMtx->appendCol(col) ; } else { j -= n ; if (OsiUnitTest::verbosity >= 2) { std::cout << " Fabricating e<" << j << "> for basis pos'n " << i << "." << std::endl ; } CoinPackedVector ei = CoinPackedVector(1,&j,1.0) ; basisMtx->appendCol(ei) ; } } return (basisMtx) ; } /* Test columns beta = inv(B)e of the basis inverse by calculating B beta and checking that the result is the appropriate unit vector. Also tests getBasics, because we use it to build the basis matrix. It's assumed that the si passed as a parameter is ready for tableau queries: a problem has been loaded and solved to optimality and enableFactorization has been called. */ void testBInvCol (const OsiSolverInterface *si) { std::string solverName ; si->getStrParam(OsiSolverName,solverName) ; int m = si->getNumRows() ; std::cout << " Testing getBInvCol ... " << std::endl; CoinPackedMatrix *basisMtx = buildBasisMatrix(si) ; /* Fetch beta, calculate B beta, k = 0, ..., m-1, and check that we have the appropriate unit vector. */ double *betak = new double[m] ; double *ek = new double[m] ; for (int k = 0 ; k < m ; k++) { CoinFillN(betak,m,COIN_DBL_MAX) ; CoinFillN(ek,m,COIN_DBL_MAX) ; OSIUNITTEST_CATCH_ERROR(si->getBInvCol(k,betak), {}, solverName, "testBInvCol"); basisMtx->times(betak,ek) ; OSIUNITTEST_ASSERT_ERROR(isUnitVector(k,m,ek), if (OsiUnitTest::verbosity >= 1) { std::cout << " " << "B beta<" << k << "> != e<" << k << ">." << std::endl ; }, solverName, "testBInvCol"); } delete[] betak ; delete[] ek ; delete basisMtx ; } /* Test rows beta = einv(B) of the basis inverse by calculating betaB and checking that the result is the appropriate unit vector. Also tests getBasics, because we need it to build the basis matrix. It's assumed that the si passed as a parameter is ready for tableau queries: a problem has been loaded and solved to optimality and enableFactorization has been called. */ void testBInvRow (const OsiSolverInterface *si) { std::string solverName ; si->getStrParam(OsiSolverName,solverName) ; int m = si->getNumRows() ; std::cout << " Testing getBInvRow ... " << std::endl; /* Should construct in row-major form for transposeTimes, but efficiency is not all that big an issue here. */ CoinPackedMatrix *basisMtx = buildBasisMatrix(si) ; /* Fetch beta, calculate beta B, i = 0, ..., m-1, and check that we have the appropriate unit vector. */ double *betai = new double[m] ; double *ei = new double[m] ; for (int i = 0 ; i < m ; i++) { CoinFillN(betai,m,COIN_DBL_MAX) ; CoinFillN(ei,m,COIN_DBL_MAX) ; OSIUNITTEST_CATCH_ERROR(si->getBInvRow(i,betai), {}, solverName, "testBInvRow"); basisMtx->transposeTimes(betai,ei) ; OSIUNITTEST_ASSERT_ERROR(isUnitVector(i,m,ei), if (OsiUnitTest::verbosity >= 1) { std::cout << " " << "beta<" << i << ">B != e<" << i << ">." << std::endl ; }, solverName, "testBInvRow"); } delete[] betai ; delete[] ei ; delete basisMtx ; } /* Test columns abar = inv(B) a by checking that B abar = a. It's assumed that the si passed as a parameter is ready for tableau queries: a problem has been loaded and solved to optimality and enableFactorization has been called. */ void testBInvACol (const OsiSolverInterface *si) { std::string solverName ; si->getStrParam(OsiSolverName,solverName) ; int n = si->getNumCols() ; int m = si->getNumRows() ; std::cout << " Testing getBInvACol ... " << std::endl; CoinPackedMatrix *basisMtx = buildBasisMatrix(si) ; const CoinPackedMatrix *mtx = si->getMatrixByCol() ; /* Fetch abar, calculate B abar, k = 0, ..., n-1, and check that the result is a. */ double *abarj = new double[m] ; double *aj = new double[m] ; for (int j = 0 ; j < n ; j++) { CoinFillN(abarj,m,COIN_DBL_MAX) ; CoinFillN(aj,m,COIN_DBL_MAX) ; OSIUNITTEST_CATCH_ERROR(si->getBInvACol(j,abarj), {}, solverName, "testBInvACol"); basisMtx->times(abarj,aj) ; const CoinShallowPackedVector pv = mtx->getVector(j) ; OSIUNITTEST_ASSERT_ERROR(isEquivalent(pv,m,aj), if (OsiUnitTest::verbosity >= 1) { std::cout << " " << "B abar<" << j << "> != a<" << j << ">." << std::endl ; }, solverName, "testBInvACol"); } delete[] abarj ; delete[] aj ; delete basisMtx ; } /* Test rows abar = e(inv(B)(A I)). This is an awkward thing to check, because there's no analog to the column identity B abar = a. Go with brute force: Build inv(B)A row by row with getBInvARow and check it against inv(B)A built column by column with getBInvACol. (Clearly, testBInvACol should run first.) e(inv(B)I) is of course beta = einv(B), so we can just check that betaB = e. It's assumed that the si passed as a parameter is ready for tableau queries: a problem has been loaded and solved to optimality and enableFactorization has been called. */ void testBInvARow (const OsiSolverInterface *si) { std::string solverName ; si->getStrParam(OsiSolverName,solverName) ; int n = si->getNumCols() ; int m = si->getNumRows() ; std::cout << " Testing getBInvARow ... " << std::endl; CoinPackedMatrix *basisMtx = buildBasisMatrix(si) ; /* Construct inv(B)A by column, then change over to row-major ordering so we can compare with the version build from tableau rows. Interesting quirk here: Turns out p0033's tableau has no nonzeros in rows with index 6 or 15. Because of that, when abarj is converted to row-major, it has only 15 rows, and that causes isEquivalent2 to fail. So force the full size. */ CoinPackedMatrix abarjMtx ; double *abarj = new double[m] ; for (int j = 0 ; j < n ; j++) { si->getBInvACol(j,abarj) ; CoinPackedVector pkv ; pkv.setFullNonZero(m,abarj) ; abarjMtx.appendCol(pkv) ; } delete[] abarj ; abarjMtx.reverseOrdering() ; abarjMtx.setDimensions(m,n) ; if (OsiUnitTest::verbosity >= 1) { std::cout << " Col-major tableau is " << abarjMtx.getNumRows() << " x " << abarjMtx.getNumCols() << " with " << abarjMtx.getNumElements() << " elements." << std::endl ; } /* Construct inv(B)A by row. Check the vectors returned for inv(B)I = beta as we go. */ CoinPackedMatrix abariMtx ; abariMtx.reverseOrdering() ; double *abari = new double[n] ; double *betai = new double[m] ; double *ei = new double[m] ; for (int i = 0 ; i < m ; i++) { CoinFillN(abari,n,COIN_DBL_MAX) ; CoinFillN(betai,m,COIN_DBL_MAX) ; OSIUNITTEST_CATCH_ERROR(si->getBInvARow(i,abari,betai), {}, solverName, "testBInvARow"); CoinPackedVector pkv ; pkv.setFullNonZero(n,abari) ; if (OsiUnitTest::verbosity >= 2) { std::cout << " Adding" ; const int *indices = pkv.getIndices() ; for (int v = 0 ; v < pkv.getNumElements() ; v++) { std::cout << " (" << i << "," << indices[v] << ")" ; } std::cout << std::endl ; if (!isEquivalent(pkv,n,abari)) std::cout << " !! packed abari != full abari !!" << std::endl ; } abariMtx.appendRow(pkv) ; basisMtx->transposeTimes(betai,ei) ; OSIUNITTEST_ASSERT_ERROR(isUnitVector(i,m,ei), if (OsiUnitTest::verbosity >= 1) { std::cout << " " << "beta<" << i << ">B != e<" << i << ">." << std::endl ; }, solverName, "testBInvARow"); } abariMtx.setDimensions(m,n) ; if (OsiUnitTest::verbosity >= 2) { std::cout << " Row-major tableau is " << abariMtx.getNumRows() << " x " << abariMtx.getNumCols() << " with " << abariMtx.getNumElements() << " elements." << std::endl ; } delete[] abari ; delete[] betai ; delete[] ei ; delete basisMtx ; /* Check that the two matrices are equivalent. isEquivalent2 will report differences, but we won't get a good count. But then, one error is all we need to report. */ OSIUNITTEST_ASSERT_ERROR(abariMtx.isEquivalent2(abarjMtx), {}, solverName, "testBInvARow: tableaus built by rows and columns match"); } /* Test the row and column duals returned by getReducedGradient. ** This method requires that the solver have an optimal solution in hand. ** The method checks the values returned by getReducedGradient against the values held in the solver (getRowPrice, getReducedCost) and tests that the sign of the reduced costs matches the status of the architectural variables. None of these are guaranteed unless the problem has been solved to optimality. The validity of the test hinges on the assumption that an implementor will just do the calculations for the given c rather than try to determine if the answer held in the solver is valid for the given c. * For row duals, test that y = cinv(B), using getBInvCol (already tested) to obtain the columns of the basis inverse. Also check that we agree with getRowPrice. * For column duals (aka reduced costs), test that cbar = c - yN, using the duals we've just checked. Also check that we agree with getReducedCost. Cross-check the sign of the reduced costs against the status vector returned by getBasisStatus. It's assumed that the si passed as a parameter is ready for tableau queries: a problem has been loaded and solved to optimality and enableFactorization has been called. */ void testReducedGradient (const OsiSolverInterface *si) { std::string solverName ; si->getStrParam(OsiSolverName,solverName) ; int n = si->getNumCols() ; int m = si->getNumRows() ; double objSense = si->getObjSense() ; std::cout << " Testing getReducedGradient ... " ; /* Acquire the solver's notion of current duals and reduced costs before we do anything else. */ const double *yGold = si->getRowPrice() ; const double *cbarGold = si->getReducedCost() ; /* Acquire the basis and build c, the vector of basic cost coefficients. For logicals (basicIndices[k] >= n) assume a zero coefficient. */ int *basicIndices = new int[m] ; si->getBasics(basicIndices) ; const double *c = si->getObjCoefficients() ; double *cB = new double[m] ; for (int k = 0 ; k < m ; k++) { int j = basicIndices[k] ; if (j < n) { if (OsiUnitTest::verbosity >= 2) { std::cout << " Retrieving c<" << j << "> = " << c[j] << " for basis pos'n " << k << "." << std::endl ; } cB[k] = c[j] ; } else { if (OsiUnitTest::verbosity >= 2) { std::cout << " Assuming c = " << 0.0 << " for basis pos'n " << k << "." << std::endl ; } cB[k] = 0.0 ; } } delete[] basicIndices ; /* Call getReducedGradient to get duals and reduced costs. */ double *cbar = new double[n] ; double *y = new double[m] ; OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si->getReducedGradient(cbar,y,c), delete[] cbar; delete[] y; return, solverName, "testReducedGradient", TestOutcome::ERROR, solverName == "cplex"); /* Run through the columns of the basis. Retrieve beta, calculate dot(c,beta) and check that all three sources of y agree. */ double *betaj = new double[m] ; CoinRelFltEq eq ; for (int k = 0 ; k < m ; k++) { double yk = 0.0 ; si->getBInvCol(k,betaj) ; for (int i = 0 ; i < m ; i++) { yk += cB[i]*betaj[i] ; } OSIUNITTEST_ASSERT_ERROR(eq(y[k],yGold[k]), if (OsiUnitTest::verbosity >= 1) std::cout << " " << y[k] << " = y<" << k << "> != yGold<" << k << "> = " << yGold[k] << ", diff = " << y[k]-yGold[k] << "." << std::endl, solverName, "testReducedGradient"); OSIUNITTEST_ASSERT_ERROR(eq(y[k],yk), if (OsiUnitTest::verbosity >= 1) std::cout << " " << y[k] << " = y<" << k << "> != cbeta<" << k << "> = " << yk << ", diff = " << y[k]-yk << "." << std::endl, solverName, "testReducedGradient"); } delete[] cB ; delete[] betaj ; /* Now that we're confident the duals are correct, use them to calculate cbar as c-yN and check that all sources for cbar agree. Also check that the sign is correct given the status of the variable. There's no need to differentiate basic and nonbasic columns here. */ int *archStatus = new int[n] ; int *logStatus = new int[m] ; si->getBasisStatus(archStatus,logStatus) ; double dualTol ; si->getDblParam(OsiDualTolerance,dualTol) ; const int OsiSimplex_isFree = 0 ; const int OsiSimplex_basic = 1 ; const int OsiSimplex_nbub = 2 ; const int OsiSimplex_nblb = 3 ; std::string statNames[] = { "NBFR", "B", "NBUB", "NBLB" } ; const CoinPackedMatrix *mtx = si->getMatrixByCol() ; double *cbarCalc = new double[n] ; mtx->transposeTimes(y,cbarCalc) ; std::transform(c,c+n,cbarCalc,cbarCalc,std::minus()) ; for (int j = 1 ; j < n ; j++) { double cbarj = cbar[j] ; int statj = archStatus[j] ; if (OsiUnitTest::verbosity >= 2) std::cout << " x<" << j << "> " << statNames[statj] << ", cbar<" << j << "> = " << cbarj << "." << std::endl ; OSIUNITTEST_ASSERT_ERROR(eq(cbarj,cbarGold[j]), if (OsiUnitTest::verbosity >= 1) std::cout << " " << cbarj << " = cbar<" << j << "> != cbarGold<" << j << "> = " << cbarGold[j] << ", diff = " << cbarj-cbarGold[j] << "." << std::endl, solverName, "testReducedGradient"); OSIUNITTEST_ASSERT_ERROR(eq(cbarj,cbarCalc[j]), if (OsiUnitTest::verbosity >= 1) std::cout << " " << cbarj << " = cbar<" << j << "> != c<" << j << "> - ya<" << j << "> = " << cbarCalc[j] << ", diff = " << cbarj-cbarCalc[j] << "." << std::endl, solverName, "testReducedGradient"); double testcbarj = objSense*cbarj ; switch (statj) { case OsiSimplex_nbub: { OSIUNITTEST_ASSERT_ERROR(testcbarj <= dualTol, if (OsiUnitTest::verbosity >= 1) std::cout << " cbar<" << j << "> = " << cbarj << " has the wrong sign for a NBUB variable." << std::endl, solverName, "testReducedGradient"); break ; } case OsiSimplex_nblb: { OSIUNITTEST_ASSERT_ERROR(testcbarj >= -dualTol, if (OsiUnitTest::verbosity >= 1) std::cout << " cbar<" << j << "> = " << cbarj << " has the wrong sign for a NBLB variable." << std::endl, solverName, "testReducedGradient"); break ; } case OsiSimplex_isFree: { OSIUNITTEST_ASSERT_ERROR(CoinAbs(testcbarj) <= dualTol, if (OsiUnitTest::verbosity >= 1) std::cout << " cbar<" << j << "> = " << cbarj << " should be zero for a NBFR variable." << std::endl, solverName, "testReducedGradient"); break ; } case OsiSimplex_basic: { OSIUNITTEST_ASSERT_ERROR(CoinAbs(testcbarj) <= dualTol, if (OsiUnitTest::verbosity >= 1) std::cout << " cbar<" << j << "> = " << cbarj << " should be zero for a basic variable." << std::endl, solverName, "testReducedGradient"); break ; } default: { break ; } } } delete[] y ; delete[] cbar ; delete[] cbarCalc ; delete[] archStatus ; delete[] logStatus ; } /* Test the mode 2 portion of the simplex API. Solve an lp by hand */ void testSimplexMode2 (const OsiSolverInterface *emptySi, std::string sampleDir) { OsiSolverInterface * si = emptySi->clone(); std::string solverName; si->getStrParam(OsiSolverName,solverName); std::string fn = sampleDir+"p0033"; si->readMps(fn.c_str(),"mps"); si->setObjSense(-1.0); si->initialSolve(); si->setObjSense(1.0); // enable special mode si->enableSimplexInterface(true); // we happen to know that variables are 0-1 and rows are L int numberIterations=0; int numberColumns = si->getNumCols(); int numberRows = si->getNumRows(); double * fakeCost = new double[numberColumns]; double * duals = new double [numberRows]; double * djs = new double [numberColumns]; const double * solution = si->getColSolution(); memcpy(fakeCost,si->getObjCoefficients(),numberColumns*sizeof(double)); while (1) { const double * dj; const double * dual; if ((numberIterations&1)==0) { // use given ones dj = si->getReducedCost(); dual = si->getRowPrice(); } else { // create dj = djs; dual = duals; si->getReducedGradient(djs,duals,fakeCost); } int i; int colIn=9999; int direction=1; double best=1.0e-6; // find most negative reduced cost // Should check basic - but should be okay on this problem for (i=0;ibest) { direction=-1; best=value; colIn=-i-1; } } for (i=0;ibest&&solution[i]>1.0-1.0e-6) { direction=-1; best=value; colIn=i; } } if (colIn==9999) break; // should be optimal int colOut; int outStatus; double theta; OSIUNITTEST_ASSERT_ERROR(!si->primalPivotResult(colIn,direction,colOut,outStatus,theta,NULL), break, solverName, "testSimplexMode2"); printf("out %d, direction %d theta %g\n", colOut,outStatus,theta); numberIterations++; } delete [] fakeCost; delete [] duals; delete [] djs; // exit special mode si->disableSimplexInterface(); si->resolve(); OSIUNITTEST_ASSERT_ERROR(!si->getIterationCount(), {}, solverName, "testSimplexMode2: resolve after disable simplex interface"); si->setObjSense(-1.0); si->initialSolve(); std::cout<clone(); std::string solverName; si->getStrParam(OsiSolverName,solverName); si->setHintParam(OsiDoReducePrint,true,OsiHintDo) ; /* Read p0033 and check that there's no optimal basis prior to solving. */ std::string fn = sampleDir+"p0033"; si->readMps(fn.c_str(),"mps"); OSIUNITTEST_ASSERT_ERROR(!si->basisIsAvailable(), if (OsiUnitTest::verbosity >= 1) std::cout << " " << solverName << " shows no optimal basis before initial solve." << std::endl, *si, "testSimplexMode1: basis before solve"); /* Solve as minimisation problem. */ si->setObjSense(1.0) ; si->initialSolve(); OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return, *si, "testSimplexMode1: solve p0033"); if (OsiUnitTest::verbosity >= 1) { std::cout << " " << solverName << " solved p0033 z = " << si->getObjValue() << "." << std::endl ; } /* Now get tough. Resolve, first as maximisation, then minimisation. Enable the tableau interface and check the methods. */ double minmax[] = { -1.0, 1.0 } ; for (int ndx = 0 ; ndx < 2 ; ndx++) { si->setObjSense(minmax[ndx]) ; std::cout << " " << ((minmax[ndx] < 0)?"maximisation ...":"minimisation") << " ..." << std::endl ; si->resolve() ; OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return, *si, "testSimplexMode1: resolve p0033"); if (OsiUnitTest::verbosity >= 1) { std::cout << " " << solverName << ((si->getObjSense() < 0)?" maximised":" minimised") << " p0033 z = " << si->getObjValue() << "." << std::endl ; } OSIUNITTEST_ASSERT_ERROR(si->basisIsAvailable(), {}, *si, "testSimplexMode1: basis available after resolve"); if (OsiUnitTest::verbosity >= 1 && si->basisIsAvailable()) { std::cout << " " << solverName << " shows optimal basis after resolve." << std::endl ; } /* Enable simplex mode 1. */ si->enableFactorization() ; /* Test the various methods. */ testBInvCol(si) ; testBInvRow(si) ; testBInvACol(si) ; testBInvARow(si) ; testReducedGradient(si) ; /* Disable simplex mode 1. */ si->disableFactorization() ; } /* Trash this solver and we're finished. */ delete si ; } } // end file-local namespace namespace OsiUnitTest { /* Test a solver's implementation of the OSI simplex API. */ void testSimplexAPI (const OsiSolverInterface *emptySi, const std::string &sampleDir) { OsiSolverInterface *si = emptySi->clone() ; std::string solverName; si->getStrParam(OsiSolverName,solverName); /* Do the tests only if the solver implements the simplex API. */ if (si->canDoSimplexInterface() == 0) { OSIUNITTEST_ADD_OUTCOME(solverName, "testSimplexAPI", "skipped test", OsiUnitTest::TestOutcome::NOTE, true); std::cout << solverName << " has no OsiSimplex API." << std::endl ; return; } /* Test the mode 1 (tableau access) portion of the API. */ if (si->canDoSimplexInterface() >= 1) { std::cout << "Testing Simplex API mode 1 for " << solverName << " ... " << std::endl ; testSimplexMode1(emptySi,sampleDir) ; } /* Test the mode 2 (pivot-by-pivot control) portion of the API. */ if (si->canDoSimplexInterface() >= 2) { std::cout << "Testing Simplex API mode 2 for " << solverName << " ... " << std::endl ; testSimplexMode2(emptySi,sampleDir) ; } else { OSIUNITTEST_ADD_OUTCOME(solverName, "testSimplexAPI mode 2", "skipped test", OsiUnitTest::TestOutcome::NOTE, true); std::cout << solverName << " does not implement Simplex API mode 2." << std::endl ; } } } /* namespace OsiUnitTest */ CoinMP-1.8.3/Osi/src/OsiCommonTest/OsiUnitTestUtils.cpp0000644000175000017500000004656712101340333021367 0ustar renerene/* Copyright (C) 2000 -- 2010, Lou Hafer, International Business Machines, and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #include "CoinPragma.hpp" #include "OsiUnitTests.hpp" #include "OsiConfig.h" /* #include "CoinTime.hpp" #include #include #include #include #include #include #include */ #include "OsiSolverInterface.hpp" #include "CoinFloatEqual.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" /* #include "CoinPackedVector.hpp" #include "CoinWarmStartBasis.hpp" #include "OsiRowCut.hpp" #include "OsiCuts.hpp" #include "OsiPresolve.hpp" */ namespace OsiUnitTest { unsigned int verbosity = 0; unsigned int haltonerror = 0; TestOutcomes outcomes; //############################################################################# // Helper routines for messages. //############################################################################# /* If anyone is feeling ambitious, it'd be a really good idea to handle i/o for the unittest by way of a standard CoinMessageHandler. Might require a bit of tweaking in CoinMessageHandler. */ // A helper function to write out a message about a test failure void failureMessage( const std::string & solverName, const std::string & message ) { std::string messageText; messageText = "*** "; messageText += solverName + "SolverInterface testing issue: "; messageText += message; // flush stdout so that error messages are properly interleaved. std::cout.flush() ; std::cerr << messageText.c_str() << std::endl; } void failureMessage( const OsiSolverInterface & si, const std::string & message ) { std::string solverName; si.getStrParam(OsiSolverName, solverName); failureMessage(solverName, message); } void failureMessage( const std::string & solverName, const std::string &testname, const std::string &testcond) { std::string messageText; messageText = "*** "; messageText += solverName + "SolverInterface testing issue: "; messageText += testname + " failed: " + testcond; // flush stdout so that error messages are properly interleaved. std::cout.flush() ; std::cerr << messageText.c_str() << std::endl; } void failureMessage( const OsiSolverInterface & si, const std::string &testname, const std::string &testcond) { std::string solverName; si.getStrParam(OsiSolverName, solverName); failureMessage(solverName, testname, testcond); } /* Display message on stderr. Flush cout buffer before printing the message, so that output comes out in order in spite of buffered cout. */ void testingMessage( const char * const msg ) { std::cout.flush() ; std::cerr << msg; } //############################################################################# // Vector comparison utility. //############################################################################# // A helper function to compare the equivalence of two vectors bool equivalentVectors (const OsiSolverInterface * si1, const OsiSolverInterface * si2, double tol, const double * v1, const double * v2, int size) { bool retVal = true; double infty1 = si1->getInfinity(); double infty2 = si2->getInfinity(); CoinRelFltEq eq(tol) ; int i; /* Both values must be the same infinity or equal within the specified tolerance. Otherwise we have failure. */ for (i = 0 ; i < size ; i++ ) { if (!(v1[i] <= -infty1 && v2[i] <= -infty2) && !(v1[i] >= infty1 && v2[i] >= infty2) && !eq(v1[i], v2[i]) ) { std::cout.flush() ; std::cerr << "eq " << i << " " << v1[i] << " " << v2[i] << std::endl; retVal = false; break; } } return retVal; } /* Check a packed vector for equality with a full vector. The algorithm is to first confirm that the elements of the packed vector are present in the full vector, then scan the full vector to make sure there are no additional nonzeros. */ bool isEquivalent (const CoinPackedVectorBase &pv, int n, const double *fv) { int pvCnt = pv.getNumElements() ; const int *indices = pv.getIndices() ; const double *elems = pv.getElements() ; bool retval = true ; CoinRelFltEq eq ; for (int v = 0 ; v < pvCnt ; v++) { int k = indices[v] ; if (!eq(elems[v], fv[k])) { retval = false ; break ; } } if (retval == true) { int fvCnt = 0 ; for (int k = 0 ; k < n ; k++) { if (!eq(fv[k], 0.0)) fvCnt++ ; } if (fvCnt != pvCnt) retval = false ; } return (retval) ; } /* Method to compare the problem representation held by a pair of solver interfaces. */ bool compareProblems (OsiSolverInterface *osi1, OsiSolverInterface *osi2) { bool areEquiv = true ; std::string si1Name, si2Name ; osi1->getStrParam(OsiSolverName, si1Name) ; osi2->getStrParam(OsiSolverName, si2Name) ; // Compare row and column counts int colCnt = 0 ; if (osi1->getNumCols() != osi2->getNumCols()) { std::cerr << " Unequal column count, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } else { colCnt = osi1->getNumCols() ; } int rowCnt = 0 ; if (osi1->getNumRows() != osi2->getNumRows()) { std::cerr << " Unequal row count, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } else { rowCnt = osi1->getNumRows() ; } // Compare column bounds areEquiv = equivalentVectors(osi1, osi2, 1.e-10, osi1->getColLower(), osi2->getColLower(), colCnt) ; if (areEquiv == false) { std::cerr << " Unequal column lower bounds, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } areEquiv = equivalentVectors(osi1, osi2, 1.e-10, osi1->getColUpper(), osi2->getColUpper(), colCnt) ; if (areEquiv == false) { std::cerr << " Unequal column upper bounds, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } // Compare row bounds areEquiv = equivalentVectors(osi1, osi2, 1.e-10, osi1->getRowLower(), osi2->getRowLower(), rowCnt) ; if (areEquiv == false) { std::cerr << " Unequal row lower bounds, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } areEquiv = equivalentVectors(osi1, osi2, 1.e-10, osi1->getRowUpper(), osi2->getRowUpper(), rowCnt) ; if (areEquiv == false) { std::cerr << " Unequal row lower bounds, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } // Compare row sense { const char *rowSense1 = osi1->getRowSense() ; const char *rowSense2 = osi2->getRowSense() ; areEquiv = true ; for (int r = 0 ; r < rowCnt && areEquiv == true ; r++) { if (rowSense1[r] != rowSense2[r]) { areEquiv = false ; } } if (areEquiv == false) { std::cerr << " Unequal row sense, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } } // Compare row rhs areEquiv = equivalentVectors(osi1, osi2, 1.e-10, osi1->getRightHandSide(), osi2->getRightHandSide(), rowCnt) ; if (areEquiv == false) { std::cerr << " Unequal right-hand-side, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } // Compare range areEquiv = equivalentVectors(osi1, osi2, 1.e-10, osi1->getRowRange(), osi2->getRowRange(), rowCnt) ; if (areEquiv == false) { std::cerr << " Unequal row range, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } // Compare objective sense if (osi1->getObjSense() != osi2->getObjSense()) { std::cerr << " Unequal objective sense, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } // Compare objective coefficients areEquiv = equivalentVectors(osi1, osi2, 1.e-10, osi1->getObjCoefficients(), osi2->getObjCoefficients(), colCnt) ; if (areEquiv == false) { std::cerr << " Unequal objective coefficients, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } // Compare number of elements if (osi1->getNumElements() != osi2->getNumElements()) { std::cerr << " Unequal number of constraint matrix coefficients, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } // Compare constraint matrix, for both row-major and column-major orderings { const CoinPackedMatrix *rmm1 = osi1->getMatrixByRow() ; const CoinPackedMatrix *rm = osi2->getMatrixByRow() ; if (!rmm1->isEquivalent(*rm)) { std::cerr << " Unequal constraint matrix, row-major ordering, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } const CoinPackedMatrix *cmm1 = osi1->getMatrixByCol() ; const CoinPackedMatrix *cm = osi2->getMatrixByCol() ; if (!cmm1->isEquivalent(*cm)) { std::cerr << " Unequal constraint matrix, column-major ordering, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } } // Check column types { areEquiv = true ; for (int j = 0 ; j < colCnt && areEquiv == true ; j++) { if (osi1->isContinuous(j) != osi2->isContinuous(j)) areEquiv = false ; if (osi1->isBinary(j) != osi2->isBinary(j)) areEquiv = false ; if (osi1->isIntegerNonBinary(j) != osi2->isIntegerNonBinary(j)) areEquiv = false ; if (osi1->isFreeBinary(j) != osi2->isFreeBinary(j)) areEquiv = false ; if (osi1->isInteger(j) != osi2->isInteger(j)) areEquiv = false ; } if (areEquiv == false) { std::cerr << " Unequal variable type, " << si1Name << " vs. " << si2Name << std::endl ; return (false) ; } } return (true) ; } bool processParameters (int argc, const char **argv, std::map& parms, const std::map& ignorekeywords) { /* Initialise the parameter keywords. */ std::set definedKeyWords; definedKeyWords.insert("-cerr2cout"); definedKeyWords.insert("-mpsDir"); definedKeyWords.insert("-netlibDir"); definedKeyWords.insert("-miplib3Dir"); definedKeyWords.insert("-testOsiSolverInterface"); definedKeyWords.insert("-nobuf"); definedKeyWords.insert("-cutsOnly"); definedKeyWords.insert("-verbosity"); definedKeyWords.insert("-onerror"); /* Set default values for data directories. */ const char dirsep = CoinFindDirSeparator() ; std::string pathTmp ; pathTmp = ".." ; pathTmp += dirsep ; pathTmp += ".." ; pathTmp += dirsep ; pathTmp += "Data" ; pathTmp += dirsep ; # ifdef COIN_MSVS // Visual Studio builds are deeper pathTmp = "..\\..\\" + pathTmp ; # endif parms["-mpsDir"] = pathTmp + "Sample" ; parms["-netlibDir"] = pathTmp + "Netlib" ; parms["-miplib3Dir"] = pathTmp + "miplib3" ; /* Read the command line parameters and fill a map of parameter keys and associated data. The parser allows for parameters which are only a keyword, or parameters of the form keyword=value (no spaces). */ for (int i = 1 ; i < argc ; i++) { std::string parm(argv[i]) ; std::string key, value ; std::string::size_type eqPos = parm.find('='); if (eqPos == std::string::npos) { key = parm ; } else { key = parm.substr(0, eqPos) ; value = parm.substr(eqPos + 1) ; } /* * Should the specified key be ignored? */ if (ignorekeywords.find(key) != ignorekeywords.end()) { assert(ignorekeywords.find(key)->second >= 0); i += ignorekeywords.find(key)->second; continue; } /* Is the specified key valid? */ if (definedKeyWords.find(key) == definedKeyWords.end()) { if( key != "-usage" && key != "-help" ) std::cerr << "Undefined parameter \"" << key << "\"." << std::endl ; std::cerr << "Usage: unitTest [-nobuf] [-mpsDir=V1] [-netlibDir=V2] [-miplibDir=V3] [-testOsiSolverInterface] [-cutsOnly] [-verbosity=num]" << std::endl ; std::cerr << " where:" << std::endl ; std::cerr << " -cerr2cout: redirect cerr to cout; sometimes useful to synchronise cout & cerr." << std::endl; std::cerr << " -mpsDir: directory containing mps test files." << std::endl << " Default value V1=\"../../Data/Sample\"" << std::endl; std::cerr << " -netlibDir: directory containing netlib files." << std::endl << " Default value V2=\"../../Data/Netlib\"" << std::endl; std::cerr << " -miplib3Dir: directory containing miplib3 files." << std::endl << " Default value V3=\"../../Data/miplib3\"" << std::endl; std::cerr << " -testOsiSolverInterface: run each OSI on the netlib problem set." << std::endl << " Default is to not run the netlib problem set." << std::endl; std::cerr << " -cutsOnly: If specified, only OsiCut tests are run." << std::endl; std::cerr << " -nobuf: use unbuffered output." << std::endl << " Default is buffered output." << std::endl; std::cerr << " -verbosity: verbosity level of tests output (0-2)." << std::endl << " Default is 0 (minimal output)." << std::endl; std::cerr << " -onerror: behaviour in case of failing test (continue, wait, stop)." << std::endl << " Default is continue." << std::endl; return false; } /* Valid keyword; stash the value for later reference. */ parms[key] = value; } /* Tack the directory separator onto the data directories so we don't have to worry about it later. */ if( parms["-mpsDir"].length() > 0 ) parms["-mpsDir"] += dirsep ; if( parms["-netlibDir"].length() > 0 ) parms["-netlibDir"] += dirsep ; if( parms["-miplib3"].length() > 0 ) parms["-miplib3Dir"] += dirsep ; /* Did the user request unbuffered i/o? It seems we need to go after this through stdio --- using pubsetbuf(0,0) on the C++ streams has no discernible affect. Nor, for that matter, did setting the unitbuf flag on the streams. Why? At a guess, sync_with_stdio connects the streams to the stdio buffers, and the C++ side isn't programmed to change them? */ if (parms.find("-nobuf") != parms.end()) { // std::streambuf *coutBuf, *cerrBuf ; // coutBuf = std::cout.rdbuf() ; // coutBuf->pubsetbuf(0,0) ; // cerrBuf = std::cerr.rdbuf() ; // cerrBuf->pubsetbuf(0,0) ; setbuf(stderr, 0); setbuf(stdout, 0); } /* Did the user request a redirect for cerr? This must occur before any i/o is performed. */ if (parms.find("-cerr2cout") != parms.end()) std::cerr.rdbuf(std::cout.rdbuf()); /* * Did the user set a verbosity level? */ if (parms.find("-verbosity") != parms.end()) { char* endptr; std::string verbstring = parms["-verbosity"]; unsigned long verblevel = strtoul(verbstring.c_str(), &endptr, 10); if( *endptr != '\0' || verblevel < 0) { std::cerr << "verbosity level must be a nonnegative number" << std::endl; return false; } OsiUnitTest::verbosity = static_cast(verblevel); } /* * Did the user specify what to do in case of a failure? */ if (parms.find("-onerror") != parms.end()) { std::string onerror = parms["-onerror"]; if( onerror == "continue" ) OsiUnitTest::haltonerror = 0; else if( onerror == "wait" ) OsiUnitTest::haltonerror = 1; else if( onerror == "stop" ) OsiUnitTest::haltonerror = 2; else { std::cerr << "-onerror must be specified with either 'continue', 'wait', or 'stop'" << std::endl; return false; } } return true; } std::string TestOutcome::SeverityLevelName[LAST] = { "NOTE", "PASSED", "WARNING", "ERROR" }; void TestOutcome::print() const { printf("%-10s", SeverityLevelName[severity].c_str()); printf("%-10s", component.c_str()); printf("%s", testname.c_str()); printf("\n"); if( expected ) printf(" (expected) "); else printf(" "); printf("%s\n", testcond.c_str()); printf(" "); printf("%s:%d\n", filename.c_str(), linenumber); // printf("\n"); } void TestOutcomes::add(const OsiSolverInterface& si, std::string tst, const char* cond, TestOutcome::SeverityLevel sev, const char* file, int line, bool exp) { std::string solverName; si.getStrParam(OsiSolverName, solverName); push_back(TestOutcome(solverName, tst, cond, sev, file, line, exp)); } void TestOutcomes::print() const { int count[TestOutcome::LAST]; int expected[TestOutcome::LAST]; for( int i = 0; i < TestOutcome::LAST; ++i ) { count[i] = 0; expected[i] = 0; } /* Walk the list, counting entries at each severity level. Print if verbosity level is high enough. */ for (const_iterator it(begin()); it != end(); ++it) { ++count[it->severity]; if (it->expected) ++expected[it->severity]; if ((it->severity != TestOutcome::PASSED || OsiUnitTest::verbosity >= 2) && (it->severity != TestOutcome::NOTE || OsiUnitTest::verbosity >= 1)) it->print(); } /// Print summary counts for (int i = 0; i < TestOutcome::LAST; ++i) printf("Severity %-10s: %4d thereof expected: %4d\n", TestOutcome::SeverityLevelName[i].c_str(), count[i], expected[i]); } void TestOutcomes::getCountBySeverity(TestOutcome::SeverityLevel sev, int& total, int& expected) const { assert(sev >= 0); assert(sev < TestOutcome::LAST); total = 0; expected = 0; for( const_iterator it(begin()); it != end(); ++it ) { if( it->severity != sev ) continue; ++total; if( it->expected ) ++expected; } } } // end OsiUnitTest namespace CoinMP-1.8.3/Osi/src/OsiCommonTest/OsiUnitTests.hpp0000644000175000017500000003313212103226617020530 0ustar renerene// Copyright (C) 2010 // All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file OsiUnitTests.hpp Utility methods for OSI unit tests. */ #ifndef OSISOLVERINTERFACETEST_HPP_ #define OSISOLVERINTERFACETEST_HPP_ #include #include #include #include #include #include #include #include class OsiSolverInterface; class CoinPackedVectorBase; /** A function that tests that a lot of problems given in MPS files (mostly the NETLIB problems) solve properly with all the specified solvers. * * The routine creates a vector of NetLib problems (problem name, objective, * various other characteristics), and a vector of solvers to be tested. * * Each solver is run on each problem. The run is deemed successful if the * solver reports the correct problem size after loading and returns the * correct objective value after optimization. * If multiple solvers are available, the results are compared pairwise against * the results reported by adjacent solvers in the solver vector. Due to * limitations of the volume solver, it must be the last solver in vecEmptySiP. */ void OsiSolverInterfaceMpsUnitTest (const std::vector & vecEmptySiP, const std::string& mpsDir); /** A function that tests the methods in the OsiSolverInterface class. * Some time ago, if this method is compiled with optimization, * the compilation took 10-15 minutes and the machine pages (has 256M core memory!)... */ void OsiSolverInterfaceCommonUnitTest (const OsiSolverInterface* emptySi, const std::string& mpsDir, const std::string& netlibDir); /** A function that tests the methods in the OsiColCut class. */ void OsiColCutUnitTest (const OsiSolverInterface * baseSiP, const std::string & mpsDir); /** A function that tests the methods in the OsiRowCut class. */ void OsiRowCutUnitTest (const OsiSolverInterface * baseSiP, const std::string & mpsDir); /** A function that tests the methods in the OsiRowCutDebugger class. */ void OsiRowCutDebuggerUnitTest (const OsiSolverInterface * siP, const std::string & mpsDir); /** A function that tests the methods in the OsiCuts class. */ void OsiCutsUnitTest(); /// A namespace so we can define a few `global' variables to use during tests. namespace OsiUnitTest { class TestOutcomes; /*! \brief Verbosity level of unit tests 0 (default) for minimal output; larger numbers produce more output */ extern unsigned int verbosity; /*! \brief Behaviour on failing a test - 0 (= default) continue - 1 press any key to continue - 2 stop with abort() */ extern unsigned int haltonerror; /*! \brief Test outcomes A global TestOutcomes object to store test outcomes during the run of the unit test for an OSI. */ extern TestOutcomes outcomes; /*! \brief Print an error message Formatted as "XxxSolverInterface testing issue: message" where Xxx is the string provided as \p solverName. Flushes std::cout before printing to std::cerr. */ void failureMessage(const std::string &solverName, const std::string &message) ; /// \overload void failureMessage(const OsiSolverInterface &si, const std::string &message) ; /*! \brief Print an error message, specifying the test name and condition Formatted as "XxxSolverInterface testing issue: testname failed: testcond" where Xxx is the OsiStrParam::OsiSolverName parameter of the \p si. Flushes std::cout before printing to std::cerr. */ void failureMessage(const std::string &solverName, const std::string &testname, const std::string &testcond) ; /// \overload void failureMessage(const OsiSolverInterface &si, const std::string &testname, const std::string &testcond) ; /*! \brief Print a message. Prints the message as given. Flushes std::cout before printing to std::cerr. */ void testingMessage(const char *const msg) ; /*! \brief Utility method to check equality Tests for equality using CoinRelFltEq with tolerance \p tol. Understands the notion of solver infinity and obtains the value for infinity from the solver interfaces supplied as parameters. */ bool equivalentVectors(const OsiSolverInterface * si1, const OsiSolverInterface * si2, double tol, const double * v1, const double * v2, int size) ; /*! \brief Compare two problems for equality Compares the problems held in the two solvers: constraint matrix, row and column bounds, column type, and objective. Rows are checked using upper and lower bounds and using sense, bound, and range. */ bool compareProblems(OsiSolverInterface *osi1, OsiSolverInterface *osi2) ; /*! \brief Compare a packed vector with an expanded vector Checks that all values present in the packed vector are present in the full vector and checks that there are no extra entries in the full vector. Uses CoinRelFltEq with the default tolerance. */ bool isEquivalent(const CoinPackedVectorBase &pv, int n, const double *fv) ; /*! \brief Process command line parameters. An unrecognised keyword which is not in the \p ignorekeywords map will trigger the help message and a return value of false. For each keyword in \p ignorekeywords, you can specify the number of following parameters that should be ignored. This should be replaced with the one of the standard CoinUtils parameter mechanisms. */ bool processParameters (int argc, const char **argv, std::map& parms, const std::map& ignorekeywords = std::map()); /// A single test outcome record. class TestOutcome { public: /// Test result typedef enum { NOTE = 0, PASSED = 1, WARNING = 2, ERROR = 3, LAST = 4 } SeverityLevel; /// Print strings for SeverityLevel static std::string SeverityLevelName[LAST]; /// Name of component under test std::string component; /// Name of test std::string testname; /// Condition being tested std::string testcond; /// Test result SeverityLevel severity; /// Set to true if problem is expected bool expected; /// Name of code file where test executed std::string filename; /// Line number in code file where test executed int linenumber; /// Standard constructor TestOutcome(const std::string& comp, const std::string& tst, const char* cond, SeverityLevel sev, const char* file, int line, bool exp = false) : component(comp),testname(tst),testcond(cond),severity(sev), expected(exp),filename(file),linenumber(line) { } /// Print the test outcome void print() const; }; /// Utility class to maintain a list of test outcomes. class TestOutcomes : public std::list { public: /// Add an outcome to the list void add(std::string comp, std::string tst, const char* cond, TestOutcome::SeverityLevel sev, const char* file, int line, bool exp = false) { push_back(TestOutcome(comp,tst,cond,sev,file,line,exp)); } /*! \brief Add an outcome to the list Get the component name from the solver interface. */ void add(const OsiSolverInterface& si, std::string tst, const char* cond, TestOutcome::SeverityLevel sev, const char* file, int line, bool exp = false); /// Print the list of outcomes void print() const; /*! \brief Count total and expected outcomes at given severity level Given a severity level, walk the list of outcomes and count the total number of outcomes at this severity level and the number expected. */ void getCountBySeverity(TestOutcome::SeverityLevel sev, int& total, int& expected) const; }; /// Convert parameter to a string (stringification) #define OSIUNITTEST_QUOTEME_(x) #x /// Convert to string with one level of expansion of the parameter #define OSIUNITTEST_QUOTEME(x) OSIUNITTEST_QUOTEME_(x) template bool OsiUnitTestAssertSeverityExpected( bool condition, const char * condition_str, const char *filename, int line, const Component& component, const std::string& testname, TestOutcome::SeverityLevel severity, bool expected) { if (condition) { OsiUnitTest::outcomes.add(component, testname, condition_str, OsiUnitTest::TestOutcome::PASSED, filename, line, false); if (OsiUnitTest::verbosity >= 2) { std::ostringstream successmsg; successmsg << __FILE__ << ":" << __LINE__ << ": " << testname << " (condition \'" << condition_str << "\') passed.\n"; OsiUnitTest::testingMessage(successmsg.str().c_str()); } return true; } OsiUnitTest::outcomes.add(component, testname, condition_str, severity, filename, line, expected); OsiUnitTest::failureMessage(component, testname, condition_str); switch (OsiUnitTest::haltonerror) { case 2: { if (severity >= OsiUnitTest::TestOutcome::ERROR ) std::abort(); break; } case 1: { std::cout << std::endl << "press any key to continue..." << std::endl; std::getchar(); break ; } default: ; } return false; } /// Add a test outcome to the list held in OsiUnitTest::outcomes #define OSIUNITTEST_ADD_OUTCOME(component,testname,testcondition,severity,expected) \ OsiUnitTest::outcomes.add(component,testname,testcondition,severity,\ __FILE__,__LINE__,expected) /*! \brief Test for a condition and record the result Test \p condition and record the result in OsiUnitTest::outcomes. If it succeeds, record the result as OsiUnitTest::TestOutcome::PASSED and print a message for OsiUnitTest::verbosity >= 2. If it fails, record the test as failed with \p severity and \p expected and react as specified by OsiUnitTest::haltonerror. \p failurecode is executed when failure is not fatal. */ #define OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(condition,failurecode,component,\ testname, severity, expected) \ { \ if (!OsiUnitTestAssertSeverityExpected(condition, #condition, \ __FILE__, __LINE__, component, testname, severity, expected)) { \ failurecode; \ } \ } /*! \brief Perform a test with severity OsiUnitTest::TestOutcome::ERROR, failure not expected. */ #define OSIUNITTEST_ASSERT_ERROR(condition, failurecode, component, testname) \ OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(condition,failurecode,component,testname,\ OsiUnitTest::TestOutcome::ERROR,false) /*! \brief Perform a test with severity OsiUnitTest::TestOutcome::WARNING, failure not expected. */ #define OSIUNITTEST_ASSERT_WARNING(condition, failurecode, component, testname) \ OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(condition,failurecode,component,testname,\ OsiUnitTest::TestOutcome::WARNING,false) /*! \brief Perform a test surrounded by a try/catch block \p trycode is executed in a try/catch block; if there's no throw the test is deemed to have succeeded and is recorded in OsiUnitTest::outcomes with status OsiUnitTest::TestOutcome::PASSED. If the \p trycode throws a CoinError, the failure is recorded with status \p severity and \p expected and the value of OsiUnitTest::haltonerror is consulted. If the failure is not fatal, \p catchcode is executed. If any other error is thrown, the failure is recorded as for a CoinError and \p catchcode is executed (haltonerror is not consulted). */ #define OSIUNITTEST_CATCH_SEVERITY_EXPECTED(trycode, catchcode, component, testname,\ severity, expected) \ { \ try { \ trycode; \ OSIUNITTEST_ADD_OUTCOME(component,testname,#trycode " did not throw exception",\ OsiUnitTest::TestOutcome::PASSED,false); \ if (OsiUnitTest::verbosity >= 2) { \ std::string successmsg( __FILE__ ":" OSIUNITTEST_QUOTEME(__LINE__) ": "); \ successmsg = successmsg + testname; \ successmsg = successmsg + " (code \'" #trycode "\') did not throw exception"; \ successmsg = successmsg + ".\n" ; \ OsiUnitTest::testingMessage(successmsg.c_str()); \ } \ } catch (CoinError& e) { \ std::stringstream errmsg; \ errmsg << #trycode " threw CoinError: " << e.message(); \ if (e.className().length() > 0) \ errmsg << " in " << e.className(); \ if (e.methodName().length() > 0) \ errmsg << " in " << e.methodName(); \ if (e.lineNumber() >= 0) \ errmsg << " at " << e.fileName() << ":" << e.lineNumber(); \ OSIUNITTEST_ADD_OUTCOME(component,testname,errmsg.str().c_str(),\ severity,expected); \ OsiUnitTest::failureMessage(component,testname,errmsg.str().c_str()); \ switch(OsiUnitTest::haltonerror) { \ case 2: \ { if (severity >= OsiUnitTest::TestOutcome::ERROR) abort(); break; } \ case 1: \ { std::cout << std::endl << "press any key to continue..." << std::endl; \ getchar(); \ break ; } \ default: ; \ } \ catchcode; \ } catch (...) { \ std::string errmsg; \ errmsg = #trycode; \ errmsg = errmsg + " threw unknown exception"; \ OSIUNITTEST_ADD_OUTCOME(component,testname,errmsg.c_str(),severity,false); \ OsiUnitTest::failureMessage(component,testname,errmsg.c_str()); \ catchcode; \ } \ } /*! \brief Perform a try/catch test with severity OsiUnitTest::TestOutcome::ERROR, failure not expected. */ #define OSIUNITTEST_CATCH_ERROR(trycode, catchcode, component, testname) \ OSIUNITTEST_CATCH_SEVERITY_EXPECTED(trycode, catchcode, component, testname, OsiUnitTest::TestOutcome::ERROR, false) /*! \brief Perform a try/catch test with severity OsiUnitTest::TestOutcome::WARNING, failure not expected. */ #define OSIUNITTEST_CATCH_WARNING(trycode, catchcode, component, testname) \ OSIUNITTEST_CATCH_SEVERITY_EXPECTED(trycode, catchcode, component, testname, OsiUnitTest::TestOutcome::WARNING, false) } // end namespace OsiUnitTest #endif /*OSISOLVERINTERFACETEST_HPP_*/ CoinMP-1.8.3/Osi/src/OsiCommonTest/OsiNetlibTest.cpp0000644000175000017500000003052212101340333020624 0ustar renerene/* Copyright (C) 2000 -- 2010, Lou Hafer, International Business Machines, and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #include "CoinPragma.hpp" #include "OsiUnitTests.hpp" #include "OsiConfig.h" #include "CoinTime.hpp" #include "CoinFloatEqual.hpp" /* #include #include #include #include #include #include #include */ #include "OsiSolverInterface.hpp" /*! \brief Run solvers on NetLib problems. The routine creates a vector of NetLib problems (problem name, objective, various other characteristics), and a vector of solvers to be tested. Each solver is run on each problem. The run is deemed successful if the solver reports the correct problem size after loading and returns the correct objective value after optimization. If multiple solvers are available, the results are compared pairwise against the results reported by adjacent solvers in the solver vector. Due to limitations of the volume solver, it must be the last solver in vecEmptySiP. */ void OsiSolverInterfaceMpsUnitTest (const std::vector & vecEmptySiP, const std::string & mpsDir) { int i ; unsigned int m ; /* Vectors to hold test problem names and characteristics. The objective value after optimization (objValue) must agree to the specified tolerance (objValueTol). */ std::vector mpsName ; std::vector minObj ; std::vector nRows ; std::vector nCols ; std::vector objValue ; std::vector objValueTol ; /* And a macro to make the vector creation marginally readable. */ #define PUSH_MPS(zz_mpsName_zz,zz_minObj_zz,\ zz_nRows_zz,zz_nCols_zz,zz_objValue_zz,zz_objValueTol_zz) \ mpsName.push_back(zz_mpsName_zz) ; \ minObj.push_back(zz_minObj_zz) ; \ nRows.push_back(zz_nRows_zz) ; \ nCols.push_back(zz_nCols_zz) ; \ objValueTol.push_back(zz_objValueTol_zz) ; \ objValue.push_back(zz_objValue_zz) ; /* Load up the problem vector. Note that the row counts here include the objective function. */ PUSH_MPS("25fv47",true,822,1571,5.5018458883E+03,1.0e-10) PUSH_MPS("80bau3b",true,2263,9799,9.8722419241E+05,1.e-10) PUSH_MPS("adlittle",true,57,97,2.2549496316e+05,1.e-10) PUSH_MPS("afiro",true,28,32,-4.6475314286e+02,1.e-10) PUSH_MPS("agg",true,489,163,-3.5991767287e+07,1.e-10) PUSH_MPS("agg2",true,517,302,-2.0239252356e+07,1.e-10) PUSH_MPS("agg3",true,517,302,1.0312115935e+07,1.e-10) PUSH_MPS("bandm",true,306,472,-1.5862801845e+02,1.e-10) PUSH_MPS("beaconfd",true,174,262,3.3592485807e+04,1.e-10) PUSH_MPS("blend",true,75,83,-3.0812149846e+01,1.e-10) PUSH_MPS("bnl1",true,644,1175,1.9776295615E+03,1.e-10) PUSH_MPS("bnl2",true,2325,3489,1.8112365404e+03,1.e-10) PUSH_MPS("boeing1",true,/*351*/352,384,-3.3521356751e+02,1.e-10) PUSH_MPS("boeing2",true,167,143,-3.1501872802e+02,1.e-10) PUSH_MPS("bore3d",true,234,315,1.3730803942e+03,1.e-10) PUSH_MPS("brandy",true,221,249,1.5185098965e+03,1.e-10) PUSH_MPS("capri",true,272,353,2.6900129138e+03,1.e-10) PUSH_MPS("cycle",true,1904,2857,-5.2263930249e+00,1.e-9) PUSH_MPS("czprob",true,930,3523,2.1851966989e+06,1.e-10) PUSH_MPS("d2q06c",true,2172,5167,122784.21557456,1.e-7) PUSH_MPS("d6cube",true,416,6184,3.1549166667e+02,1.e-8) PUSH_MPS("degen2",true,445,534,-1.4351780000e+03,1.e-10) PUSH_MPS("degen3",true,1504,1818,-9.8729400000e+02,1.e-10) PUSH_MPS("dfl001",true,6072,12230,1.1266396047E+07,1.e-5) PUSH_MPS("e226",true,224,282,(-18.751929066+7.113),1.e-10) // NOTE: Objective function has constant of 7.113 PUSH_MPS("etamacro",true,401,688,-7.5571521774e+02 ,1.e-6) PUSH_MPS("fffff800",true,525,854,5.5567961165e+05,1.e-6) PUSH_MPS("finnis",true,498,614,1.7279096547e+05,1.e-6) PUSH_MPS("fit1d",true,25,1026,-9.1463780924e+03,1.e-10) PUSH_MPS("fit1p",true,628,1677,9.1463780924e+03,1.e-10) PUSH_MPS("fit2d",true,26,10500,-6.8464293294e+04,1.e-10) PUSH_MPS("fit2p",true,3001,13525,6.8464293232e+04,1.e-9) PUSH_MPS("forplan",true,162,421,-6.6421873953e+02,1.e-6) PUSH_MPS("ganges",true,1310,1681,-1.0958636356e+05,1.e-5) PUSH_MPS("gfrd-pnc",true,617,1092,6.9022359995e+06,1.e-10) PUSH_MPS("greenbea",true,2393,5405,/*-7.2462405908e+07*/-72555248.129846,1.e-10) PUSH_MPS("greenbeb",true,2393,5405,/*-4.3021476065e+06*/-4302260.2612066,1.e-10) PUSH_MPS("grow15",true,301,645,-1.0687094129e+08,1.e-10) PUSH_MPS("grow22",true,441,946,-1.6083433648e+08,1.e-10) PUSH_MPS("grow7",true,141,301,-4.7787811815e+07,1.e-10) PUSH_MPS("israel",true,175,142,-8.9664482186e+05,1.e-10) PUSH_MPS("kb2",true,44,41,-1.7499001299e+03,1.e-10) PUSH_MPS("lotfi",true,154,308,-2.5264706062e+01,1.e-10) PUSH_MPS("maros",true,847,1443,-5.8063743701e+04,1.e-10) PUSH_MPS("maros-r7",true,3137,9408,1.4971851665e+06,1.e-10) PUSH_MPS("modszk1",true,688,1620,3.2061972906e+02,1.e-10) PUSH_MPS("nesm",true,663,2923,1.4076073035e+07,1.e-5) PUSH_MPS("perold",true,626,1376,-9.3807580773e+03,1.e-6) PUSH_MPS("pilot",true,1442,3652,/*-5.5740430007e+02*/-557.48972927292,5.e-5) PUSH_MPS("pilot4",true,411,1000,-2.5811392641e+03,1.e-6) PUSH_MPS("pilot87",true,2031,4883,3.0171072827e+02,1.e-4) PUSH_MPS("pilotnov",true,976,2172,-4.4972761882e+03,1.e-10) // ?? PUSH_MPS("qap8",true,913,1632,2.0350000000e+02,1.e-10) // ?? PUSH_MPS("qap12",true,3193,8856,5.2289435056e+02,1.e-10) // ?? PUSH_MPS("qap15",true,6331,22275,1.0409940410e+03,1.e-10) PUSH_MPS("recipe",true,92,180,-2.6661600000e+02,1.e-10) PUSH_MPS("sc105",true,106,103,-5.2202061212e+01,1.e-10) PUSH_MPS("sc205",true,206,203,-5.2202061212e+01,1.e-10) PUSH_MPS("sc50a",true,51,48,-6.4575077059e+01,1.e-10) PUSH_MPS("sc50b",true,51,48,-7.0000000000e+01,1.e-10) PUSH_MPS("scagr25",true,472,500,-1.4753433061e+07,1.e-10) PUSH_MPS("scagr7",true,130,140,-2.3313892548e+06,1.e-6) PUSH_MPS("scfxm1",true,331,457,1.8416759028e+04,1.e-10) PUSH_MPS("scfxm2",true,661,914,3.6660261565e+04,1.e-10) PUSH_MPS("scfxm3",true,991,1371,5.4901254550e+04,1.e-10) PUSH_MPS("scorpion",true,389,358,1.8781248227e+03,1.e-10) PUSH_MPS("scrs8",true,491,1169,9.0429998619e+02,1.e-5) PUSH_MPS("scsd1",true,78,760,8.6666666743e+00,1.e-10) PUSH_MPS("scsd6",true,148,1350,5.0500000078e+01,1.e-10) PUSH_MPS("scsd8",true,398,2750,9.0499999993e+02,1.e-8) PUSH_MPS("sctap1",true,301,480,1.4122500000e+03,1.e-10) PUSH_MPS("sctap2",true,1091,1880,1.7248071429e+03,1.e-10) PUSH_MPS("sctap3",true,1481,2480,1.4240000000e+03,1.e-10) PUSH_MPS("seba",true,516,1028,1.5711600000e+04,1.e-10) PUSH_MPS("share1b",true,118,225,-7.6589318579e+04,1.e-10) PUSH_MPS("share2b",true,97,79,-4.1573224074e+02,1.e-10) PUSH_MPS("shell",true,537,1775,1.2088253460e+09,1.e-10) PUSH_MPS("ship04l",true,403,2118,1.7933245380e+06,1.e-10) PUSH_MPS("ship04s",true,403,1458,1.7987147004e+06,1.e-10) PUSH_MPS("ship08l",true,779,4283,1.9090552114e+06,1.e-10) PUSH_MPS("ship08s",true,779,2387,1.9200982105e+06,1.e-10) PUSH_MPS("ship12l",true,1152,5427,1.4701879193e+06,1.e-10) PUSH_MPS("ship12s",true,1152,2763,1.4892361344e+06,1.e-10) PUSH_MPS("sierra",true,1228,2036,1.5394362184e+07,1.e-10) PUSH_MPS("stair",true,357,467,-2.5126695119e+02,1.e-10) PUSH_MPS("standata",true,360,1075,1.2576995000e+03,1.e-10) // GUB PUSH_MPS("standgub",true,362,1184,1257.6995,1.e-10) PUSH_MPS("standmps",true,468,1075,1.4060175000E+03,1.e-10) PUSH_MPS("stocfor1",true,118,111,-4.1131976219E+04,1.e-10) PUSH_MPS("stocfor2",true,2158,2031,-3.9024408538e+04,1.e-10) // ?? PUSH_MPS("stocfor3",true,16676,15695,-3.9976661576e+04,1.e-10) // ?? PUSH_MPS("truss",true,1001,8806,4.5881584719e+05,1.e-10) PUSH_MPS("tuff",true,334,587,2.9214776509e-01,1.e-10) PUSH_MPS("vtpbase",true,199,203,1.2983146246e+05,1.e-10) PUSH_MPS("wood1p",true,245,2594,1.4429024116e+00,5.e-5) PUSH_MPS("woodw",true,1099,8405,1.3044763331E+00,1.e-10) #undef PUSH_MPS const unsigned int numProblems = static_cast(mpsName.size()) ; /* Create vectors to hold solver interfaces, the name of each solver interface, the current state of processing, and statistics about the number of problems solved and the time taken. */ const int numSolvers = static_cast(vecEmptySiP.size()) ; std::vector vecSiP(numSolvers) ; std::vector siName(numSolvers) ; std::vector siStage(numSolvers) ; std::vector numProbSolved(numSolvers) ; std::vector timeTaken(numSolvers) ; for (i = 0 ; i < numSolvers ; i++) { siName[i] = "unknown" ; numProbSolved[i] = 0 ; timeTaken[i] = 0.0 ; } /* For each problem, create a fresh clone of the `empty' solvers from vecEmptySiP, then proceed in stages: read the MPS file, solve the problem, check the solution. If there are multiple solvers in vecSiP, the results of each solver are compared with its neighbors in the vector. */ for (m = 0 ; m < numProblems ; m++) { std::cout << " processing mps file: " << mpsName[m] << " (" << m+1 << " out of " << numProblems << ")" << std::endl ; /* Stage 0: Create fresh solver clones. */ int solversReadMpsFile = 0 ; for (i = numSolvers-1 ; i >= 0 ; --i) { vecSiP[i] = vecEmptySiP[i]->clone() ; vecSiP[i]->getStrParam(OsiSolverName,siName[i]) ; siStage[i] = 0 ; } /* Stage 1: Read the MPS file into each solver interface. As a basic check, make sure the size of the constraint matrix is correct. */ for (i = 0 ; i < numSolvers ; i++) { std::string fn = mpsDir+mpsName[m] ; vecSiP[i]->readMps(fn.c_str(),"mps") ; if (minObj[m]) vecSiP[i]->setObjSense(1.0) ; else vecSiP[i]->setObjSense(-1.0) ; int nr = vecSiP[i]->getNumRows() ; int nc = vecSiP[i]->getNumCols() ; if (nr == nRows[m]-1 && nc == nCols[m]) { siStage[i] = 1 ; solversReadMpsFile++ ; } } /* If more than one solver succeeded, compare representations. */ if (solversReadMpsFile > 0) { // Find an initial pair to compare int s1 ; for (s1 = 0 ; s1 < numSolvers-1 && siStage[s1] < 1 ; s1++) ; int s2 ; for (s2 = s1+1 ; s2 < numSolvers && siStage[s2] < 1 ; s2++) ; while (s2 < numSolvers) { std::cout << " comparing problem representation for " << siName[s1] << " and " << siName[s2] << " ..." ; if (OsiUnitTest::compareProblems(vecSiP[s1],vecSiP[s2])) std::cout << " ok." << std::endl; s1 = s2 ; for (s2++ ; s2 < numSolvers && siStage[s2] < 1 ; s2++) ; } } /* Stage 2: Ask each solver that successfully read the problem to solve it, then check the return code and objective. */ for (i = 0 ; i < numSolvers ; ++i) { if (siStage[i] < 1) continue ; double startTime = CoinCpuTime() ; OSIUNITTEST_CATCH_ERROR(vecSiP[i]->initialSolve(), continue, *vecSiP[i], "netlib " + mpsName[m]); double timeOfSolution = CoinCpuTime()-startTime; OSIUNITTEST_ASSERT_ERROR(vecSiP[i]->isProvenOptimal(), {}, *vecSiP[i], "netlib " + mpsName[m]); if (vecSiP[i]->isProvenOptimal()) { double soln = vecSiP[i]->getObjValue(); CoinRelFltEq eq(objValueTol[m]) ; OSIUNITTEST_ASSERT_ERROR(eq(soln,objValue[m]), std::cerr << soln << " != " << objValue[m] << "; error = " << fabs(objValue[m]-soln), *vecSiP[i], "netlib " + mpsName[m]); if (eq(soln,objValue[m])) { std::cout << " " << siName[i] << " " << soln << " = " << objValue[m] << ", " << vecSiP[i]->getIterationCount() << " iters; okay" ; numProbSolved[i]++ ; } std::cout << " - took " << timeOfSolution << " seconds." << std::endl; timeTaken[i] += timeOfSolution; } else { std::cout.flush() ; std::cerr << " " << siName[i] << "; error " ; if (vecSiP[i]->isProvenPrimalInfeasible()) std::cerr << "primal infeasible" ; else if (vecSiP[i]->isIterationLimitReached()) std::cerr << "iteration limit" ; else if (vecSiP[i]->isAbandoned()) std::cerr << "abandoned" ; else std::cerr << "unknown" ; } } /* Delete the used solver interfaces so we can reload fresh clones for the next problem. */ for (i = 0 ; i < numSolvers ; i++) delete vecSiP[i] ; } /* Print a summary for each solver. */ for (i = 0 ; i < numSolvers ; i++) { std::cout << siName[i] << " solved " << numProbSolved[i] << " out of " << numProblems << " and took " << timeTaken[i] << " seconds." << std::endl ; } } CoinMP-1.8.3/Osi/src/OsiCommonTest/OsiColCutTest.cpp0000644000175000017500000002555011541753202020617 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //#include //#include //#include #include "CoinPragma.hpp" #include "OsiUnitTests.hpp" #include "OsiColCut.hpp" //-------------------------------------------------------------------------- void OsiColCutUnitTest(const OsiSolverInterface * baseSiP, const std::string & mpsDir) { // Test default constructor { OsiColCut r; OSIUNITTEST_ASSERT_ERROR(r.lbs_.getIndices() == NULL, {}, "osicolcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.lbs_.getElements() == NULL, {}, "osicolcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.lbs_.getNumElements() == 0, {}, "osicolcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.lbs().getNumElements() == 0, {}, "osicolcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.ubs_.getIndices() == NULL, {}, "osicolcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.ubs_.getElements() == NULL, {}, "osicolcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.ubs_.getNumElements() == 0, {}, "osicolcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.ubs().getNumElements() == 0, {}, "osicolcut", "default constructor"); } // Test set and get methods const int ne = 4; int inx[ne] = { 1, 3, 4, 7 }; double el[ne] = { 1.2, 3.4, 5.6, 7.8 }; const int ne3 = 0; int * inx3=NULL; double * el3= NULL; { OsiColCut r; // Test setting/getting bounds r.setLbs( ne, inx, el ); r.setEffectiveness(222.); OSIUNITTEST_ASSERT_ERROR(r.lbs().getNumElements() == ne, return, "osicolcut", "setting bounds"); bool bounds_ok = true; for ( int i=0; iclone(); std::string fn = mpsDir+"exmip1"; imP->readMps(fn.c_str(),"mps"); OSIUNITTEST_ASSERT_ERROR(!r.consistent(*imP), {}, "osicolcut", "consistent"); delete imP; } { const int ne = 1; int inx[ne] = { 100 }; double el[ne] = { 1.2 }; const int ne1 = 2; int inx1[ne1] = { 50, 100 }; double el1[ne1] = { 100., 1. }; OsiColCut r; r.setUbs( ne, inx, el ); r.setLbs( ne1, inx1, el1 ); OSIUNITTEST_ASSERT_ERROR(r.consistent(), {}, "osicolcut", "consistent"); } { // Test consistent(IntegerModel) method. OsiSolverInterface * imP = baseSiP->clone(); std::string fn = mpsDir+"exmip1"; imP->readMps(fn.c_str(),"mps"); OsiColCut cut; const int ne=1; int inx[ne]={20}; double el[ne]={0.25}; cut.setLbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(!cut.consistent(*imP), {}, "osicolcut", "consistent(IntegerModel)"); cut.setLbs(0,NULL,NULL); cut.setUbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(!cut.consistent(*imP), {}, "osicolcut", "consistent(IntegerModel)"); inx[0]=4; cut.setLbs(ne,inx,el); cut.setUbs(0,NULL,NULL); OSIUNITTEST_ASSERT_ERROR( cut.consistent(*imP), {}, "osicolcut", "consistent(IntegerModel)"); el[0]=4.5; cut.setLbs(0,NULL,NULL); cut.setUbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( cut.consistent(*imP), {}, "osicolcut", "consistent(IntegerModel)"); cut.setLbs(ne,inx,el); cut.setUbs(0,NULL,NULL); OSIUNITTEST_ASSERT_ERROR( cut.consistent(*imP), {}, "osicolcut", "consistent(IntegerModel)"); OSIUNITTEST_ASSERT_ERROR( cut.infeasible(*imP), {}, "osicolcut", "infeasible(IntegerModel)"); el[0]=3.0; cut.setLbs(ne,inx,el); cut.setUbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( cut.consistent(*imP), {}, "osicolcut", "consistent(IntegerModel)"); delete imP; } { //Test infeasible(im) method // Test consistent(IntegerModel) method. OsiSolverInterface * imP = baseSiP->clone(); std::string fn = mpsDir+"exmip1"; imP->readMps(fn.c_str(),"mps"); OsiColCut cut; const int ne=1; int inx[ne]={4}; double el[ne]={4.5}; cut.setLbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( cut.infeasible(*imP), {}, "osicolcut", "infeasible(IntegerModel)"); el[0]=0.25; cut.setLbs(0,NULL,NULL); cut.setUbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( cut.infeasible(*imP), {}, "osicolcut", "infeasible(IntegerModel)"); el[0]=3.0; cut.setLbs(ne,inx,el); cut.setUbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(!cut.infeasible(*imP), {}, "osicolcut", "infeasible(IntegerModel)"); delete imP; } { //Test violation double solution[]={1.0}; OsiColCut cut; const int ne=1; int inx[ne]={0}; double el[ne]={4.5}; cut.setLbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( cut.violated(solution), {}, "osicolcut", "violated"); el[0]=0.25; cut.setLbs(0,NULL,NULL); cut.setUbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( cut.violated(solution), {}, "osicolcut", "violated"); el[0]=1.0; cut.setLbs(ne,inx,el); cut.setUbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(!cut.violated(solution), {}, "osicolcut", "violated"); } } CoinMP-1.8.3/Osi/src/OsiCommonTest/OsiSolverInterfaceTest.cpp0000644000175000017500000055156412130072766022536 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* !! MAINTAINERS PLEASE READ !! The OSI unit test is gradually undergoing a conversion. Over time, the goal is to factor the original monolith into separate files and routines. Individual routines should collect test outcomes in the global OsiUnitTest::outcomes object using the OSIUNITTEST_* macros defined in OsiUnitTests.hpp. Ideally, the implementor of an OsiXXX could indicated expected failures, to avoid the current practice of modifying the unit test to avoid attempting the test for a particular OsiXXX. The original approach was to use asserts in tests; the net effect is that the unit test chokes and dies as soon as something goes wrong. The current approach is to soldier on until something has gone wrong which makes further testing pointless if OsiUnitTest::haltonerror is set to 0, to hold and ask the user for pressing a key if OsiUnitTest::haltonerror is set to 1, and to stop immediately if OsiUnitTest::haltonerror is set to 2 (but only in case of an error, not for warnings). The general idea is to return the maximum amount of useful information with each run. The OsiUnitTest::verbosity variable should be used to decide on the amount of information to be printed. At level 0, only minimal output should be printed, at level 1, more information about failed tests should be printed, while at level 2, also information on passed tests and other details should be printed. If you work on this code, please keep these conventions in mind: * Tests should be encapsulated in subroutines. If you have a moment, factor something out of the main routine --- it'd be nice to get it down under 500 lines. * All local helper routines should be defined in the file-local namespace. * This unit test is meant as a certification that OsiXXX correctly implements the OSI API specification. Don't step around it! If OsiXXX is not capable of meeting a particular requirement and you edit the unit test code to avoid the test, don't just sweep it under the rug! Print a failure message saying the test has been skipped, or something else informative. OsiVol is the worst offender for this (the underlying algorithm is not simplex and imposes serious limitations on the type of lp that vol can handle). Any simplex-oriented solver should *NOT* be exempted from any test. If it's pointless to even try, print a failure message. -- lh, 08.01.07, 10.08.26 -- */ #include "CoinPragma.hpp" #include "OsiConfig.h" #include #include #include #include #include #include /* A utility definition which allows for easy suppression of unused variable warnings from GCC. Handy in this environment, where we're constantly def'ing things in and out. */ #ifndef UNUSED # if defined(__GNUC__) # define UNUSED __attribute__((unused)) # else # define UNUSED # endif #endif #include "OsiUnitTests.hpp" #include "OsiSolverInterface.hpp" #include "CoinTime.hpp" #include "CoinFloatEqual.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" #include "OsiRowCut.hpp" #include "OsiCuts.hpp" #include "OsiPresolve.hpp" /* Define helper routines in the file-local namespace. */ namespace OsiUnitTest { extern void testSimplexAPI(const OsiSolverInterface* emptySi, const std::string& mpsDir); } using namespace OsiUnitTest ; namespace { //############################################################################# // A routine to build a CoinPackedMatrix matching the exmip1 example. //############################################################################# const CoinPackedMatrix *BuildExmip1Mtx () /* Simple function to build a packed matrix for the exmip1 example used in tests. The function exists solely to hide the intermediate variables. Probably could be written as an initialised declaration. See COIN/Mps/Sample/exmip1.mps for a human-readable presentation. Don't forget to dispose of the matrix when you're done with it. Ordered triples seem easiest. They're listed in row-major order. */ { int rowndxs[] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4 } ; int colndxs[] = { 0, 1, 3, 4, 7, 1, 2, 2, 5, 3, 6, 0, 4, 7 } ; double coeffs[] = { 3.0, 1.0, -2.0, -1.0, -1.0, 2.0, 1.1, 1.0, 1.0, 2.8, -1.2, 5.6, 1.0, 1.9 } ; CoinPackedMatrix *mtx = new CoinPackedMatrix(true,&rowndxs[0],&colndxs[0],&coeffs[0],14) ; return (mtx) ; } //############################################################################# // Short tests contributed by Vivian DeSmedt. Thanks! //############################################################################# /* DeSmedt Problem #1 Initially, max 3*x1 + x2 x* = [ 5 0 ] 2*x1 + x2 <= 10 row_act = [ 10 5 ] x1 + 3*x2 <= 15 Test for solver status, expected solution, row activity. Then change objective to [1 1], resolve, check again for solver status, expected solution [3 4] and expected row activity [10 15]. */ bool test1VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedMatrix m; m.transpose(); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); m.appendRow(r0); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); m.appendRow(r1); int numcol = 2; double *obj = new double[numcol]; obj[0] = 3; obj[1] = 1; double *collb = new double[numcol]; collb[0] = 0; collb[1] = 0; double *colub = new double[numcol]; colub[0] = inf; colub[1] = inf; int numrow = 2; double *rowlb = new double[numrow]; rowlb[0] = -inf; rowlb[1] = -inf; double *rowub = new double[numrow]; rowub[0] = 10; rowub[1] = 15; s->loadProblem(m, collb, colub, obj, rowlb, rowub); delete [] obj; delete [] collb; delete [] colub; delete [] rowlb; delete [] rowub; s->setObjSense(-1); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001, s->getColSolution(), solution1, 2); const double activity1[] = {10, 5}; ret = ret && equivalentVectors(s,s,0.0001, s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001, s->getColSolution(), solution2, 2); const double activity2[] = {10, 15}; ret = ret && equivalentVectors(s,s,0.0001, s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test2VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedMatrix m; m.transpose(); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); m.appendRow(r0); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); m.appendRow(r1); CoinPackedVector r2; r2.insert(0, 1); r2.insert(1, 1); m.appendRow(r2); int numcol = 2; double *obj = new double[numcol]; obj[0] = 3; obj[1] = 1; double *collb = new double[numcol]; collb[0] = 0; collb[1] = 0; double *colub = new double[numcol]; colub[0] = inf; colub[1] = inf; int numrow = 3; double *rowlb = new double[numrow]; rowlb[0] = -inf; rowlb[1] = -inf; rowlb[2] = 1; double *rowub = new double[numrow]; rowub[0] = 10; rowub[1] = 15; rowub[2] = inf; s->loadProblem(m, collb, colub, obj, rowlb, rowub); delete [] obj; delete [] collb; delete [] colub; delete [] rowlb; delete [] rowub; s->setObjSense(-1); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001, s->getColSolution(), solution1, 2); const double activity1[] = {10, 5, 5}; ret = ret && equivalentVectors(s,s,0.0001, s->getRowActivity(), activity1, 3); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001, s->getColSolution(), solution2, 2); const double activity2[] = {10, 15, 7}; ret = ret && equivalentVectors(s,s,0.0001, s->getRowActivity(), activity2, 3); return ret; } //-------------------------------------------------------------------------- bool test3VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; //double inf = s->getInfinity(); CoinPackedVector empty; s->addCol(empty, 0, 10, 3); s->addCol(empty, 0, 10, 1); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); s->addRow(r0, 0, 10); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); s->addRow(r1, 0, 15); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {10, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {10, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test4VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedVector empty; s->addCol(empty, 0, inf, 3); s->addCol(empty, 0, inf, 1); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); s->addRow(r0, -inf, 10); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); s->addRow(r1, -inf, 15); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {10, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {10, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- /* Constructs the system max 3x1 + x2 -inf <= 2x1 + x2 <= 10 -inf <= x1 + 3x2 <= 15 The optimal solution is unbounded. Objective is then changed to max x1 + x2 which has a bounded optimum at x1 = 3, x2 = 4. */ bool test5VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedVector empty; s->addCol(empty, -inf, inf, 3); s->addCol(empty, -inf, inf, 1); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); s->addRow(r0, -inf, 10); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); s->addRow(r1, -inf, 15); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && !s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && s->isProvenDualInfeasible(); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {10, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test6VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedVector empty; s->addCol(empty, 0, inf, 3); s->addCol(empty, 0, inf, 1); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); s->addRow(r0, 0, 10); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); s->addRow(r1, 0, 15); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {10, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {10, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test7VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedVector empty; s->addCol(empty, 4, inf, 3); s->addCol(empty, 3, inf, 1); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); s->addRow(r0, 0, 10); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); s->addRow(r1, 0, 15); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && !s->isProvenOptimal(); ret = ret && s->isProvenPrimalInfeasible(); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && !s->isProvenOptimal(); ret = ret && s->isProvenPrimalInfeasible(); return ret; } //-------------------------------------------------------------------------- bool test8VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedVector empty; s->addCol(empty, -inf, inf, 3); s->addCol(empty, -inf, inf, 1); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); s->addRow(r0, 0, 10); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); s->addRow(r1, 0, 15); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {6, -2}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {10, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {10, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test9VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedVector empty; s->addCol(empty, -inf, inf, 3); s->addCol(empty, -inf, inf, 1); CoinPackedVector r0; r0.insert(0, 2); r0.insert(1, 1); s->addRow(r0, 0, 10); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); s->addRow(r1, 0, 15); CoinPackedVector r2; r2.insert(0, 1); r2.insert(1, 4); s->addRow(r2, 12, inf); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {4, 2}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {10, 10, 12}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 3); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {10, 15, 19}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 3); return ret; } //-------------------------------------------------------------------------- bool test10VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); int numcols = 2; int numrows = 2; const CoinBigIndex start[] = {0, 2, 4}; const int index[] = {0, 1, 0, 1}; const double value[] = {4, 1, 2, 3}; const double collb[] = {0, 0}; const double colub[] = {inf, inf}; double obj[] = {3, 1}; char rowsen[] = {'R', 'R'}; double rowrhs[] = {20, 15}; double rowrng[] = {20, 15}; s->loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowsen, rowrhs, rowrng); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {20, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {20, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test11VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); int numcols = 2; int numrows = 2; const CoinBigIndex start[] = {0, 2, 4}; const int index[] = {0, 1, 0, 1}; const double value[] = {4, 1, 2, 3}; const double collb[] = {0, 0}; const double colub[] = {inf, inf}; double obj[] = {3, 1}; double rowlb[] = {0, 0}; double rowub[] = {20, 15}; s->loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {20, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {20, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test12VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedMatrix m; m.transpose(); CoinPackedVector r0; r0.insert(0, 4); r0.insert(1, 2); m.appendRow(r0); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); m.appendRow(r1); int numcol = 2; double *obj = new double[numcol]; obj[0] = 3; obj[1] = 1; double *collb = new double[numcol]; collb[0] = 0; collb[1] = 0; double *colub = new double[numcol]; colub[0] = inf; colub[1] = inf; int numrow = 2; double *rowlb = new double[numrow]; rowlb[0] = 0; rowlb[1] = 0; double *rowub = new double[numrow]; rowub[0] = 20; rowub[1] = 15; s->loadProblem(m, collb, colub, obj, rowlb, rowub); delete [] obj; delete [] collb; delete [] colub; delete [] rowlb; delete [] rowub; s->setObjSense(-1); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {20, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {20, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test13VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedMatrix m; CoinPackedVector c0; c0.insert(0, 4); c0.insert(1, 1); m.appendCol(c0); CoinPackedVector c1; c1.insert(0, 2); c1.insert(1, 3); m.appendCol(c1); int numcol = 2; double *obj = new double[numcol]; obj[0] = 3; obj[1] = 1; double *collb = new double[numcol]; collb[0] = 0; collb[1] = 0; double *colub = new double[numcol]; colub[0] = inf; colub[1] = inf; int numrow = 2; double *rowlb = new double[numrow]; rowlb[0] = 0; rowlb[1] = 0; double *rowub = new double[numrow]; rowub[0] = 20; rowub[1] = 15; s->loadProblem(m, collb, colub, obj, rowlb, rowub); delete [] obj; delete [] collb; delete [] colub; delete [] rowlb; delete [] rowub; s->setObjSense(-1); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {20, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {20, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test14VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedVector empty; s->addCol(empty, 0, inf, 3); s->addCol(empty, 0, inf, 1); CoinPackedVector r0; r0.insert(0, 4); r0.insert(1, 2); s->addRow(r0, 0, 20); CoinPackedVector r1; r1.insert(0, 1); r1.insert(1, 3); s->addRow(r1, 0, 15); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {20, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {20, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } //-------------------------------------------------------------------------- bool test15VivianDeSmedt(OsiSolverInterface *s) { bool ret = true; double inf = s->getInfinity(); CoinPackedVector empty; s->addRow(empty, 0, 20); s->addRow(empty, 0, 15); CoinPackedVector c0; c0.insert(0, 4); c0.insert(1, 1); s->addCol(c0, 0, inf, 3); CoinPackedVector c1; c1.insert(0, 2); c1.insert(1, 3); s->addCol(c1, 0, inf, 1); s->setObjSense(-1); s->writeMps("test"); s->initialSolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution1[] = {5, 0}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution1, 2); const double activity1[] = {20, 5}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity1, 2); s->setObjCoeff(0, 1); s->setObjCoeff(1, 1); s->resolve(); ret = ret && s->isProvenOptimal(); ret = ret && !s->isProvenPrimalInfeasible(); ret = ret && !s->isProvenDualInfeasible(); const double solution2[] = {3, 4}; ret = ret && equivalentVectors(s,s,0.0001,s->getColSolution(), solution2, 2); const double activity2[] = {20, 15}; ret = ret && equivalentVectors(s,s,0.0001,s->getRowActivity(), activity2, 2); return ret; } /* Another test case submitted by Vivian De Smedt. The test is to modify the objective function and check that the solver's optimum point tracks correctly. The initial problem is max 3*x1 + x2 s.t. 2*x1 + x2 <= 10 x1 + 3*x2 <= 15 with optimum z* = 15 at (x1,x2) = (5,0). Then the objective is changed to x1 + x2, with new optimum z* = 7 at (3,4). The volume algorithm doesn't return exact solution values, so relax the test for correctness when we're checking the solution. */ void changeObjAndResolve (const OsiSolverInterface *emptySi) { OsiSolverInterface *s = emptySi->clone() ; double dEmpty = 0 ; int iEmpty = 0 ; CoinBigIndex iEmpty2 = 0 ; /* Establish an empty problem. Establish empty columns with bounds and objective coefficient only. Finally, insert constraint coefficients and set for maximisation. */ s->loadProblem(0,0,&iEmpty2,&iEmpty,&dEmpty, &dEmpty,&dEmpty,&dEmpty,&dEmpty,&dEmpty) ; CoinPackedVector c ; s->addCol(c,0,10,3) ; s->addCol(c,0,10,1) ; double inf = s->getInfinity() ; CoinPackedVector r1 ; r1.insert(0,2) ; r1.insert(1,1) ; s->addRow(r1,-inf,10) ; r1.clear() ; r1.insert(0,1) ; r1.insert(1,3) ; s->addRow(r1,-inf,15) ; s->setObjSense(-1) ; /* Optimise for 3*x1 + x2 and check for correctness. */ s->initialSolve() ; const double *colSol = s->getColSolution() ; OSIUNITTEST_ASSERT_ERROR(colSol[0] >= 4.5, {}, *s, "changeObjAndResolve"); OSIUNITTEST_ASSERT_ERROR(colSol[1] <= 0.5, {}, *s, "changeObjAndResolve"); /* Set objective to x1 + x2 and reoptimise. */ s->setObjCoeff(0,1) ; s->setObjCoeff(1,1) ; s->resolve() ; colSol = s->getColSolution() ; OSIUNITTEST_ASSERT_ERROR(colSol[0] >= 2.3 && colSol[0] <= 3.7, {}, *s, "changeObjAndResolve"); OSIUNITTEST_ASSERT_ERROR(colSol[1] >= 3.5 && colSol[1] <= 4.5, {}, *s, "changeObjAndResolve"); delete s ; } /* This code is taken from some bug reports of Sebastian Nowozin. It demonstrates some issues he had with OsiClp. https://projects.coin-or.org/Osi/ticket/54 https://projects.coin-or.org/Osi/ticket/55 https://projects.coin-or.org/Osi/ticket/56 https://projects.coin-or.org/Osi/ticket/58 The short summary is that enabling/disabling the level 2 simplex interface (controllable pivoting) with an empty constraint matrix caused problems. For solvers that don't support simplex level 2, all we're testing is constraint system mods and resolve. Query (lh): The original comments with this code referred to use of Binv to generate cuts Binv et al. are level 1 simplex interface routines. Perhaps the test should use level 1. */ bool test16SebastianNowozin(OsiSolverInterface *si) { CoinAbsFltEq fltEq ; CoinPackedMatrix* matrix = new CoinPackedMatrix(false,0,0) ; matrix->setDimensions(0,4) ; double objective[] = { 0.1, 0.2, -0.1, -0.2 } ; double varLB[] = { 0.0, 0.0, 0.0, 0.0 } ; double varUB[] = { 1.0, 1.0, 1.0, 1.0 } ; si->loadProblem(*matrix, varLB, varUB, objective, NULL, NULL) ; delete matrix ; /* Set objective sense prior to objective, just to catch the unwary. */ si->setObjSense(1) ; si->setObjective(objective) ; /* The code provided with ticket 54 is illegal --- this first call cannot be resolve(). The first solve must be an initialSolve, for the benefit of solvers which use it for initialisation. -- lh, 080903 -- */ si->initialSolve() ; OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return false, *si, "test16SebastianNowozin initial solve"); OSIUNITTEST_ASSERT_ERROR(fltEq(si->getObjValue(),-0.3), return false, *si, "test16SebastianNowozin initial solve"); /* Expected: primal = [ 0 0 1 1 ] */ OSIUNITTEST_ASSERT_ERROR(si->getColSolution() != NULL, return false, *si, "test16SebastianNowozin initial solve"); /* Simulate a constraint generation interval that will require the simplex interface. Enable, then disable level 2 simplex interface (controllable pivoting), if the solver has it. */ if (si->canDoSimplexInterface() >= 2) { OSIUNITTEST_CATCH_ERROR(si->enableFactorization(), return false, *si, "test16SebastianNowozin initial solve"); OSIUNITTEST_CATCH_ERROR(si->enableSimplexInterface(true), return false, *si, "test16SebastianNowozin initial solve"); // try // { si->enableFactorization() ; // si->enableSimplexInterface(true) ; } // catch (CoinError e) // { std::string errmsg ; // errmsg = "first enableFactorization or enableSimplexInterface" ; // errmsg = errmsg + " threw CoinError: " + e.message() ; // OSIUNITTEST_ADD_OUTCOME(*si, "test16SebastianNowozin first enableFactorization or enableSimplexInterface", errmsg.c_str(), TestOutcome::ERROR, false); // failureMessage(*si,errmsg) ; // return (false) ; } // OSIUNITTEST_ADD_OUTCOME(*si, "test16SebastianNowozin first enableFactorization or enableSimplexInterface", "no exception", TestOutcome::PASSED, false); // (...) constraint generation here si->disableFactorization() ; } /* Add two constraints and resolve */ CoinPackedVector row1 ; // x_2 + x_3 - x_0 <= 0 row1.insert(0,-1.0) ; row1.insert(2,1.0) ; row1.insert(3,1.0) ; si->addRow(row1,-si->getInfinity(),0.0) ; CoinPackedVector row2 ; // x_0 + x_1 - x_3 <= 0 row2.insert(0,1.0) ; row2.insert(1,1.0) ; row2.insert(3,-1.0) ; si->addRow(row2,-si->getInfinity(),0.0) ; si->resolve() ; OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return false, *si, "test16SebastianNowozin first resolve"); OSIUNITTEST_ASSERT_ERROR(fltEq(si->getObjValue(),-0.1), return false, *si, "test16SebastianNowozin first resolve"); /* Expected: primal = [ 1 0 0 1 ] */ OSIUNITTEST_ASSERT_ERROR(si->getColSolution() != NULL, return false, *si, "test16SebastianNowozin first resolve"); /* Simulate another constraint generation run. */ if (si->canDoSimplexInterface() >= 2) { OSIUNITTEST_CATCH_ERROR(si->enableFactorization(), return false, *si, "test16SebastianNowozin first resolve"); OSIUNITTEST_CATCH_ERROR(si->enableSimplexInterface(true), return false, *si, "test16SebastianNowozin first resolve"); // try // { si->enableFactorization() ; // si->enableSimplexInterface(true) ; } // catch (CoinError e) // { std::string errmsg ; // errmsg = "second enableFactorization or enableSimplexInterface" ; // errmsg = errmsg + " threw CoinError: " + e.message() ; // failureMessage(*si,errmsg) ; // OSIUNITTEST_ADD_OUTCOME(*si, "test16SebastianNowozin second enableFactorization or enableSimplexInterface", errmsg.c_str(), TestOutcome::ERROR, false); // return (false) ; } // OSIUNITTEST_ADD_OUTCOME(*si, "test16SebastianNowozin second enableFactorization or enableSimplexInterface", "no exception", TestOutcome::PASSED, false); // (...) constraint generation here si->disableFactorization() ; } /* Remove a constraint, add .15 to the objective coefficients, and resolve. */ int rows_to_delete_arr[] = { 0 } ; si->deleteRows(1,rows_to_delete_arr) ; std::transform(objective,objective+4,objective, std::bind2nd(std::plus(),0.15)) ; si->setObjective(objective) ; si->resolve() ; OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return false, *si, "test16SebastianNowozin second resolve"); OSIUNITTEST_ASSERT_ERROR(fltEq(si->getObjValue(),-0.05), return false, *si, "test16SebastianNowozin second resolve"); /* Expected: obj = [ .25 .35 .05 -.05], primal = [ 0 0 0 1 ] */ OSIUNITTEST_ASSERT_ERROR(si->getColSolution() != NULL, return false, *si, "test16SebastianNowozin second resolve"); return true; } /* This code checks an issue reported by Sebastian Nowozin in OsiClp ticket 57. He said that OsiClpSolverInterface::getReducedGradient() requires a prior call to both enableSimplexInterface(true) and enableFactorization(), but only checks/asserts the simplex interface. Same comment as test16 --- would simplex level 1 suffice? */ bool test17SebastianNowozin(OsiSolverInterface *si) { if (si->canDoSimplexInterface() < 2) { return (true) ; } CoinPackedMatrix *matrix = new CoinPackedMatrix(false,0,0) ; matrix->setDimensions(0,4) ; double objective[] = { 0.1, 0.2, -0.1, -0.2, } ; double varLB[] = { 0.0, 0.0, 0.0, 0.0, } ; double varUB[] = { 1.0, 1.0, 1.0, 1.0, } ; si->loadProblem(*matrix,varLB,varUB,objective,NULL,NULL) ; si->setObjSense(1) ; delete matrix ; CoinPackedVector row1 ; // x_2 + x_3 - x_0 <= 0 row1.insert(0,-1.0) ; row1.insert(2,1.0) ; row1.insert(3,1.0) ; si->addRow(row1,-si->getInfinity(),0.0) ; si->initialSolve() ; OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return false, *si, "test17SebastianNowozin"); if (!si->isProvenOptimal()) return false; /* Unlike test16, here we do not call si->enableFactorization() first. */ OSIUNITTEST_CATCH_ERROR(si->enableSimplexInterface(true), return false, *si, "test17SebastianNowozin"); /* Now check that getReducedGradient works. */ double dummy[4] = { 1., 1., 1., 1.} ; OSIUNITTEST_CATCH_ERROR(si->getReducedGradient(dummy,dummy,dummy), return false, *si, "test17SebastianNowozin"); return true; } //############################################################################# // Routines to test various feature groups //############################################################################# /*! \brief Test row and column name manipulation emptySi should be an empty solver interface, fn the path to the exmpi1 example. */ void testNames (const OsiSolverInterface *emptySi, std::string fn) { bool recognisesOsiNames = true ; bool ok ; OsiSolverInterface *si = emptySi->clone() ; std::string exmip1ObjName = "OBJ" ; OsiSolverInterface::OsiNameVec exmip1RowNames(0) ; exmip1RowNames.push_back("ROW01") ; exmip1RowNames.push_back("ROW02") ; exmip1RowNames.push_back("ROW03") ; exmip1RowNames.push_back("ROW04") ; exmip1RowNames.push_back("ROW05") ; OsiSolverInterface::OsiNameVec exmip1ColNames(0) ; exmip1ColNames.push_back("COL01") ; exmip1ColNames.push_back("COL02") ; exmip1ColNames.push_back("COL03") ; exmip1ColNames.push_back("COL04") ; exmip1ColNames.push_back("COL05") ; exmip1ColNames.push_back("COL06") ; exmip1ColNames.push_back("COL07") ; exmip1ColNames.push_back("COL08") ; testingMessage("Testing row/column name handling ...") ; /* Try to get the solver name, but don't immediately abort. */ std::string solverName = "Unknown solver" ; OSIUNITTEST_ASSERT_WARNING(si->getStrParam(OsiSolverName,solverName) == true, {}, solverName, "testNames: getStrParam(OsiSolverName)"); /* Checking default names. dfltRowColName is pretty liberal about indices, but they should never be negative. Since default row/column names are a letter plus n digits, asking for a length of 5 on the objective gets you a leading 'O' plus five more letters. */ std::string dfltName = si->dfltRowColName('o',0,5) ; std::string expName = "OBJECT" ; OSIUNITTEST_ASSERT_WARNING(dfltName == expName, {}, solverName, "testNames: default objective name"); dfltName = si->dfltRowColName('r',-1,5) ; expName = "!!invalid Row -1!!" ; OSIUNITTEST_ASSERT_WARNING(dfltName == expName, {}, solverName, "testNames: default name for invalid row"); dfltName = si->dfltRowColName('c',-1,5) ; expName = "!!invalid Col -1!!" ; OSIUNITTEST_ASSERT_WARNING(dfltName == expName, {}, solverName, "testNames: default name for invalid col"); /* Start by telling the SI to use lazy names and see if it comes up with the right names from the MPS file. There's no point in proceeding further if we can't read an MPS file. */ // std::cout << "Testing lazy names from MPS input file." << std::endl ; OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(si->setIntParam(OsiNameDiscipline, 1) == true, recognisesOsiNames = false, solverName, "testNames: switch to lazy names", TestOutcome::NOTE, false); OSIUNITTEST_ASSERT_ERROR(si->readMps(fn.c_str(),"mps") == 0, delete si; return, solverName, "testNames: read MPS"); OsiSolverInterface::OsiNameVec rowNames ; int rowNameCnt ; OsiSolverInterface::OsiNameVec colNames ; int colNameCnt ; int m = si->getNumRows() ; if (recognisesOsiNames) { std::string objName = si->getObjName() ; OSIUNITTEST_ASSERT_WARNING(objName == exmip1ObjName, {}, solverName, "testNames lazy names: objective name"); OSIUNITTEST_ASSERT_WARNING(si->getRowName(m) == exmip1ObjName, {}, solverName, "testNames lazy names: name of one after last row is objective name"); rowNames = si->getRowNames() ; rowNameCnt = static_cast(rowNames.size()) ; OSIUNITTEST_ASSERT_WARNING(rowNameCnt == static_cast(exmip1RowNames.size()), {}, solverName, "testNames lazy names: row names count"); ok = true ; for (int i = 0 ; i < rowNameCnt ; i++) { if (rowNames[i] != exmip1RowNames[i]) { ok = false ; std::cout << "ERROR! " ; std::cout << "Row " << i << " is \"" << rowNames[i] << "\" expected \"" << exmip1RowNames[i] << "\"." << std::endl; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: row names"); colNames = si->getColNames() ; colNameCnt = static_cast(colNames.size()) ; OSIUNITTEST_ASSERT_WARNING(colNameCnt == static_cast(exmip1ColNames.size()), {}, solverName, "testNames lazy names: column names count"); ok = true ; for (int j = 0 ; j < colNameCnt ; j++) { if (colNames[j] != exmip1ColNames[j]) { ok = false ; std::cout << "ERROR! " ; std::cout << "Column " << j << " is " << colNames[j] << "\" expected \"" << exmip1ColNames[j] << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: column names"); /* Switch back to name discipline 0. We should revert to default names. Failure to switch back to discipline 0 after successfully switching to discipline 1 is some sort of internal confusion in the Osi; abort the test. */ // std::cout << "Switching to no names (aka default names)." << std::endl ; OSIUNITTEST_ASSERT_WARNING(si->setIntParam(OsiNameDiscipline, 0) == true, delete si; return, solverName, "testNames: switch to no names"); } /* This block of tests for default names should pass even if the underlying Osi doesn't recognise OsiNameDiscipline. When using default names, name vectors are not necessary, hence should have size zero. */ rowNames = si->getRowNames() ; OSIUNITTEST_ASSERT_WARNING(rowNames.size() == 0, {}, solverName, "testNames no names: row names count"); ok = true ; for (int i = 0 ; i < m ; i++) { if (si->getRowName(i) != si->dfltRowColName('r',i)) { ok = false ; std::cout << "ERROR! " ; std::cout << "Row " << i << " is \"" << si->getRowName(i) << "\" expected \"" << si->dfltRowColName('r',i) << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames no names: row names"); colNames = si->getColNames() ; OSIUNITTEST_ASSERT_WARNING(colNames.size() == 0, {}, solverName, "testNames no names: column names count"); int n = si->getNumCols() ; ok = true ; for (int j = 0 ; j < n ; j++) { if (si->getColName(j) != si->dfltRowColName('c',j)) { ok = false ; std::cout << "ERROR! " ; std::cout << "Column " << j << " is \"" << si->getColName(j) << "\" expected \"" << si->dfltRowColName('c',j) << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames no names: column names"); /* This is as much as we can ask if the underlying solver doesn't recognise OsiNameDiscipline. Return if that's the case. */ if (!recognisesOsiNames) { delete si ; return; } /* Switch back to lazy names. The previous names should again be available. */ // std::cout << "Switching back to lazy names." << std::endl ; OSIUNITTEST_ASSERT_WARNING(si->setIntParam(OsiNameDiscipline,1) == true, delete si; return, solverName, "testNames: switch to lazy names"); rowNames = si->getRowNames() ; rowNameCnt = static_cast(rowNames.size()) ; OSIUNITTEST_ASSERT_WARNING(rowNameCnt == static_cast(exmip1RowNames.size()), {}, solverName, "testNames lazy names: row names count"); ok = true ; for (int i = 0 ; i < rowNameCnt ; i++) { if (rowNames[i] != exmip1RowNames[i]) { ok = false ; std::cout << "ERROR! " ; std::cout << "Row " << i << " is \"" << rowNames[i] << "\" expected \"" << exmip1RowNames[i] << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: row names"); colNames = si->getColNames() ; colNameCnt = static_cast(colNames.size()) ; OSIUNITTEST_ASSERT_WARNING(colNameCnt == static_cast(exmip1ColNames.size()), {}, solverName, "testNames lazy names: column names count"); ok = true ; for (int j = 0 ; j < colNameCnt ; j++) { if (colNames[j] != exmip1ColNames[j]) { ok = false ; std::cout << "ERROR! " ; std::cout << "Column " << j << " is " << colNames[j] << "\" expected \"" << exmip1ColNames[j] << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: column names"); /* Add a row. We should see no increase in the size of the row name vector, and asking for the name of the new row should return a default name. */ int nels = 5 ; int indices[5] = { 0, 2, 3, 5, 7 } ; double els[5] = { 1.0, 3.0, 4.0, 5.0, 42.0 } ; CoinPackedVector newRow(nels,indices,els) ; si->addRow(newRow,-4.2, .42) ; OSIUNITTEST_ASSERT_WARNING(si->getNumRows() == m+1, delete si; return, solverName, "testNames lazy names: added a row"); rowNames = si->getRowNames() ; rowNameCnt = static_cast(rowNames.size()) ; OSIUNITTEST_ASSERT_WARNING(rowNameCnt == m, {}, solverName, "testNames lazy names: row names count after row addition"); OSIUNITTEST_ASSERT_WARNING(si->getRowName(m) == si->dfltRowColName('r',m), {}, solverName, "testNames lazy names: default name for added row"); /* Now set a name for the row. */ std::string newRowName = "NewRow" ; si->setRowName(m,newRowName) ; OSIUNITTEST_ASSERT_WARNING(si->getRowName(m) == newRowName, {}, solverName, "testNames lazy names: setting new row name"); /* Ok, who are we really talking with? Delete row 0 and see if the names change appropriately. Since deleteRows is pure virtual, the names will change only if the underlying OsiXXX supports names (i.e., it must make a call to deleteRowNames). */ // std::cout << "Testing row deletion." << std::endl ; si->deleteRows(1,indices) ; rowNames = si->getRowNames() ; rowNameCnt = static_cast(rowNames.size()) ; OSIUNITTEST_ASSERT_WARNING(rowNameCnt == m, {}, solverName, "testNames lazy names: row names count after deleting row"); ok = true ; for (int i = 0 ; i < rowNameCnt ; i++) { std::string expected ; if (i != m-1) { expected = exmip1RowNames[i+1] ; } else { expected = newRowName ; } if (rowNames[i] != expected) { ok = false ; std::cout << "ERROR! " ; std::cout << "Row " << i << " is \"" << rowNames[i] << "\" expected \"" << expected << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: row names after deleting row"); /* Add/delete a column and do the same tests. Expected results as above. */ nels = 3 ; indices[0] = 0 ; indices[1] = 2 ; indices[2] = 4 ; els[0] = 1.0 ; els[1] = 4.0 ; els[2] = 24.0 ; CoinPackedVector newCol(nels,indices,els) ; si->addCol(newCol,-4.2, .42, 42.0) ; OSIUNITTEST_ASSERT_ERROR(si->getNumCols() == n+1, delete si; return, solverName, "testNames lazy names: columns count after adding column"); colNames = si->getColNames() ; colNameCnt = static_cast(colNames.size()) ; OSIUNITTEST_ASSERT_WARNING(colNameCnt == n, {}, solverName, "testNames lazy names: columns names count after adding column"); OSIUNITTEST_ASSERT_WARNING(si->getColName(n) == si->dfltRowColName('c',n), {}, solverName, "testNames lazy names default column name after adding column"); std::string newColName = "NewCol" ; si->setColName(n,newColName) ; OSIUNITTEST_ASSERT_WARNING(si->getColName(n) == newColName, {}, solverName, "testNames lazy names: setting column name"); // std::cout << "Testing column deletion." << std::endl ; si->deleteCols(1,indices) ; colNames = si->getColNames() ; colNameCnt = static_cast(colNames.size()) ; OSIUNITTEST_ASSERT_WARNING(colNameCnt == n, {}, solverName, "testNames lazy names: column names count after deleting column"); ok = true ; for (int j = 0 ; j < colNameCnt ; j++) { std::string expected ; if (j != n-1) { expected = exmip1ColNames[j+1] ; } else { expected = newColName ; } if (colNames[j] != expected) { ok = false ; std::cout << "ERROR! " ; std::cout << "Column " << j << " is \"" << colNames[j] << "\" expected \"" << expected << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: column names after deleting column"); /* Interchange row and column names. */ // std::cout << "Testing bulk replacement of names." << std::endl ; si->setRowNames(exmip1ColNames,0,3,2) ; rowNames = si->getRowNames() ; rowNameCnt = static_cast(rowNames.size()) ; OSIUNITTEST_ASSERT_WARNING(rowNameCnt == m, {}, solverName, "testNames lazy names: row names count after bulk replace"); ok = true ; for (int i = 0 ; i < rowNameCnt ; i++) { std::string expected ; if (i < 2) { expected = exmip1RowNames[i+1] ; } else if (i >= 2 && i <= 4) { expected = exmip1ColNames[i-2] ; } else { expected = newRowName ; } if (rowNames[i] != expected) { ok = false ; std::cout << "ERROR! " ; std::cout << "Row " << i << " is \"" << rowNames[i] << "\" expected \"" << expected << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: row names after bulk replace"); si->setColNames(exmip1RowNames,3,2,0) ; colNames = si->getColNames() ; colNameCnt = static_cast(colNames.size()) ; OSIUNITTEST_ASSERT_WARNING(colNameCnt == n, {}, solverName, "testNames lazy names: column names count after bulk replace"); ok = true ; for (int j = 0 ; j < colNameCnt ; j++) { std::string expected ; if (j < 2) { expected = exmip1RowNames[j+3] ; } else if (j >= 2 && j <= 6) { expected = exmip1ColNames[j+1] ; } else { expected = newColName ; } if (colNames[j] != expected) { ok = false ; std::cout << "ERROR! " ; std::cout << "Column " << j << " is \"" << colNames[j] << "\" expected \"" << expected << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: column names after bulk replace"); /* Delete a few row and column names (directly, as opposed to deleting rows or columns). Names should shift downward. */ // std::cout << "Testing name deletion." << std::endl ; si->deleteRowNames(0,2) ; rowNames = si->getRowNames() ; rowNameCnt = static_cast(rowNames.size()) ; OSIUNITTEST_ASSERT_WARNING(rowNameCnt == m-2, {}, solverName, "testNames lazy names: row names count after deleting 2 rows"); ok = true ; for (int i = 0 ; i < rowNameCnt ; i++) { std::string expected ; if (i < rowNameCnt) { expected = exmip1ColNames[i] ; } if (rowNames[i] != expected) { ok = false ; std::cout << "ERROR! " ; std::cout << "Row " << i << " is \"" << rowNames[i] << "\" expected \"" << expected << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: row names after deleting 2 rows"); si->deleteColNames(5,3) ; colNames = si->getColNames() ; colNameCnt = static_cast(colNames.size()) ; OSIUNITTEST_ASSERT_WARNING(colNameCnt == n-3, {}, solverName, "testNames lazy names: column names count after deleting 3 columns"); ok = true ; for (int j = 0 ; j < colNameCnt ; j++) { std::string expected ; if (j < 2) { expected = exmip1RowNames[j+3] ; } else if (j >= 2 && j < colNameCnt) { expected = exmip1ColNames[j+1] ; } if (colNames[j] != expected) { ok = false ; std::cout << "ERROR! " ; std::cout << "Column " << j << " is \"" << colNames[j] << "\" expected \"" << expected << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames lazy names: column names after deleting 3 columns"); /* Finally, switch to full names, and make sure we retrieve full length vectors. */ // std::cout << "Switching to full names." << std::endl ; OSIUNITTEST_ASSERT_WARNING(si->setIntParam(OsiNameDiscipline,2), delete si; return, solverName, "testNames lazy names: change name discipline"); m = si->getNumRows() ; rowNames = si->getRowNames() ; rowNameCnt = static_cast(rowNames.size()) ; OSIUNITTEST_ASSERT_WARNING(rowNameCnt == m+1, {}, solverName, "testNames full names: row names count"); OSIUNITTEST_ASSERT_WARNING(rowNames[m] == exmip1ObjName, {}, solverName, "testNames full names: objective name"); ok = true ; for (int i = 0 ; i < rowNameCnt-1 ; i++) { std::string expected ; if (i < 3) { expected = exmip1ColNames[i] ; } else { expected = si->dfltRowColName('r',i) ; } if (rowNames[i] != expected) { ok = false ; std::cout << "ERROR! " ; std::cout << "Row " << i << " is \"" << rowNames[i] << "\" expected \"" << expected << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames full names: row names"); n = si->getNumCols() ; colNames = si->getColNames() ; colNameCnt = static_cast(colNames.size()) ; OSIUNITTEST_ASSERT_WARNING(colNameCnt == n, {}, solverName, "testNames full names: column names count"); ok = true ; for (int j = 0 ; j < colNameCnt ; j++) { std::string expected ; if (j < 2) { expected = exmip1RowNames[j+3] ; } else if (j >= 2 && j <= 4) { expected = exmip1ColNames[j+1] ; } else { expected = si->dfltRowColName('c',j) ; } if (colNames[j] != expected) { ok = false ; std::cout << "ERROR! " ; std::cout << "Column " << j << " is " << colNames[j] << "\" expected \"" << expected << "\"." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, {}, solverName, "testNames full names: column names"); delete si ; } //-------------------------------------------------------------------------- /*! \brief Tests for a solution imposed by the user. Checks the routines setColSolution (primal variables) and setRowSolution (dual variables). Goes on to check that getReducedCost and getRowActivity use the imposed solution. The prototype OSI supplied as the parameter should be loaded with a smallish problem. */ void testSettingSolutions (OsiSolverInterface &proto) { OsiSolverInterface *si = proto.clone() ; bool allOK = true ; int i ; int m = si->getNumRows() ; int n = si->getNumCols() ; double mval,cval,rval ; const double *rowVec,*colVec,*objVec ; double *colShouldBe = new double [m] ; double *rowShouldBe = new double [n] ; CoinAbsFltEq fltEq ; testingMessage("Checking that solver can set row and column solutions ...") ; /* Create dummy solution vectors. */ double *dummyColSol = new double[n] ; for (i = 0 ; i < n ; i++) { dummyColSol[i] = i + .5 ; } double *dummyRowSol = new double[m] ; for (i = 0 ; i < m ; i++ ) { dummyRowSol[i] = i - .5 ; } /* First the values we can set directly: primal (column) and dual (row) solutions. The osi should copy the vector, hence the pointer we get back should not be the pointer we supply. But it's reasonable to expect exact equality, as no arithmetic should be performed. */ si->setColSolution(dummyColSol) ; OSIUNITTEST_ASSERT_ERROR(dummyColSol != si->getColSolution(), allOK = false, *si, "setting solutions: solver should not return original pointer"); rowVec = si->getColSolution() ; bool ok = true ; for (i = 0 ; i < n ; i++) { mval = rowVec[i] ; rval = dummyColSol[i] ; if (mval != rval) { ok = false ; std::cout << "x<" << i << "> = " << mval << ", expecting " << rval << ", |error| = " << (mval-rval) << "." << std::endl ; } } OSIUNITTEST_ASSERT_ERROR(ok == true, allOK = false, *si, "setting solutions: solver stored column solution correctly"); si->setRowPrice(dummyRowSol) ; OSIUNITTEST_ASSERT_ERROR(dummyRowSol != si->getRowPrice(), allOK = false, *si, "setting solutions: solver should not return original pointer"); colVec = si->getRowPrice() ; if( colVec != NULL ) { ok = true ; for (i = 0 ; i < m ; i++) { mval = colVec[i] ; cval = dummyRowSol[i] ; if (mval != cval) { ok = false ; std::cout << "y<" << i << "> = " << mval << ", expecting " << cval << ", |error| = " << (mval-cval) << "." << std::endl ; } } } else ok = false; OSIUNITTEST_ASSERT_ERROR(ok == true, allOK = false, *si, "setting solutions: solver stored row price correctly"); /* Now let's get serious. Check that reduced costs and row activities match the values we just specified for row and column solutions. Absolute equality cannot be assumed here. Reduced costs first: c - yA */ rowVec = si->getReducedCost() ; objVec = si->getObjCoefficients() ; const CoinPackedMatrix *mtx = si->getMatrixByCol() ; mtx->transposeTimes(dummyRowSol,rowShouldBe) ; if( rowVec != NULL ) { ok = true ; for (i = 0 ; i < n ; i++) { mval = rowVec[i] ; rval = objVec[i] - rowShouldBe[i] ; if (!fltEq(mval,rval)) { ok = false ; std::cout << "cbar<" << i << "> = " << mval << ", expecting " << rval << ", |error| = " << (mval-rval) << "." << std::endl ; } } } else ok = false; OSIUNITTEST_ASSERT_WARNING(ok == true, allOK = false, *si, "setting solutions: reduced costs from solution set with setRowPrice"); /* Row activity: Ax */ colVec = si->getRowActivity() ; mtx->times(dummyColSol,colShouldBe) ; ok = true ; for (i = 0 ; i < m ; i++) { mval = colVec[i] ; cval = colShouldBe[i] ; if (!fltEq(mval,cval)) { ok = false ; std::cout << "lhs<" << i << "> = " << mval << ", expecting " << cval << ", |error| = " << (mval-cval) << "." << std::endl ; } } OSIUNITTEST_ASSERT_WARNING(ok == true, allOK = false, *si, "setting solutions: row activity from solution set with setColSolution"); if (allOK) { testingMessage(" ok.\n") ; } else { failureMessage(*si,"Errors handling imposed column/row solutions.") ; } delete [] dummyColSol ; delete [] colShouldBe ; delete [] dummyRowSol ; delete [] rowShouldBe ; delete si ; return ; } //-------------------------------------------------------------------------- /*! \brief Helper routines to test OSI parameters. A set of helper routines to test integer, double, and hint parameter set/get routines. */ bool testIntParam(OsiSolverInterface * si, int k, int val) { int i = 123456789, orig = 123456789; bool ret; OsiIntParam key = static_cast(k); si->getIntParam(key, orig); if (si->setIntParam(key, val)) { ret = (si->getIntParam(key, i) == true) && (i == val); } else { ret = (si->getIntParam(key, i) == true) && (i == orig); } return ret; } bool testDblParam(OsiSolverInterface * si, int k, double val) { double d = 123456789.0, orig = 123456789.0; bool ret; OsiDblParam key = static_cast(k); si->getDblParam(key, orig); if (si->setDblParam(key, val)) { ret = (si->getDblParam(key, d) == true) && (d == val); } else { ret = (si->getDblParam(key, d) == true) && (d == orig); } return ret; } bool testHintParam(OsiSolverInterface * si, int k, bool sense, OsiHintStrength strength, int *throws) /* Tests for proper behaviour of [set,get]HintParam methods. The initial get tests the return value to see if the hint is implemented; the values returned for sense and strength are not checked. If the hint is implemented, a pair of set/get calls is performed at the strength specified by the parameter. The set can return true or, at strength OsiForceDo, throw an exception if the solver cannot comply. The rationale would be that only OsiForceDo must be obeyed, so anything else should return true regardless of whether the solver followed the hint. The test checks that the value and strength returned by getHintParam matches the previous call to setHintParam. This is arguably wrong --- one can argue that it should reflect the solver's ability to comply with the hint. But that's how the OSI interface standard has evolved up to now. If the hint is not implemented, attempting to set the hint should return false, or throw an exception at strength OsiForceDo. The testing code which calls testHintParam is set up so that a successful return is defined as true if the hint is implemented, false if it is not. Information printing is suppressed; uncomment and recompile if you want it. */ { bool post_sense ; OsiHintStrength post_strength ; bool ret ; OsiHintParam key = static_cast(k) ; if (si->getHintParam(key,post_sense,post_strength)) { ret = false ; std::ostringstream tstname; tstname << "testHintParam: hint " << static_cast(key) << " sense " << sense << " strength " << static_cast(strength); if( strength == OsiForceDo ) { try { if (si->setHintParam(key,sense,strength)) { ret = (si->getHintParam(key,post_sense,post_strength) == true) && (post_strength == strength) && (post_sense == sense); } } catch( CoinError& e ) { std::cout << tstname.str() << " catched CoinError exception " << e.message() << std::endl; ret = true; (*throws)++; } } else { OSIUNITTEST_CATCH_WARNING( if (si->setHintParam(key,sense,strength)) { ret = (si->getHintParam(key,post_sense,post_strength) == true) && (post_strength == strength) && (post_sense == sense); }, (*throws)++; ret = (strength == OsiForceDo), *si, tstname.str() ); } } else { ret = true ; std::ostringstream tstname; tstname << "testHintParam: hint " << static_cast(key) << " sense " << sense << " strength " << static_cast(strength); OSIUNITTEST_CATCH_WARNING(ret = si->setHintParam(key,sense,strength), (*throws)++; ret = !(strength == OsiForceDo), *si, tstname.str()); } return ret ; } /* Test functionality related to the objective function: * Does the solver properly handle a constant offset? * Does the solver properly handle primal and dual objective limits? This routine only checks for the correct answers. It does not check whether the solver stops early due to objective limits. * Does the solver properly handle minimisation / maximisation via setObjSense? The return value is the number of failures recorded by the routine. */ void testObjFunctions (const OsiSolverInterface *emptySi, const std::string &mpsDir) { OsiSolverInterface *si = emptySi->clone() ; CoinRelFltEq eq ; int i ; std::cout << "Testing functionality related to the objective." << std::endl ; std::string solverName = "Unknown solver" ; si->getStrParam(OsiSolverName,solverName) ; /* Check for default objective sense. This should be minimisation. */ OSIUNITTEST_ASSERT_ERROR(si->getObjSense() == 1.0 || si->getObjSense() == -1.0, {}, solverName, "testObjFunctions: default objective sense is determinant value"); OSIUNITTEST_ASSERT_WARNING(si->getObjSense() == 1.0, {}, solverName, "testObjFunctions: default objective sense is minimization"); /* Read in e226; chosen because it has an offset defined in the mps file. We can't continue if we can't read the test problem. */ std::string fn = mpsDir+"e226" ; OSIUNITTEST_ASSERT_ERROR(si->readMps(fn.c_str(),"mps") == 0, delete si; return, solverName, "testObjFunctions: read MPS"); /* Solve and test for the correct objective value. */ si->initialSolve() ; double objValue = si->getObjValue() ; double objNoOffset = -18.751929066 ; double objOffset = +7.113 ; OSIUNITTEST_ASSERT_ERROR(eq(objValue,(objNoOffset+objOffset)), {}, solverName, "testObjFunctions: getObjValue with constant in objective"); /* Test objective limit methods. If no limit has been specified, they should return false. */ OSIUNITTEST_ASSERT_ERROR(!si->isPrimalObjectiveLimitReached(), {}, solverName, "testObjFunctions: isPrimalObjectiveLimitReached without limit (min)"); OSIUNITTEST_ASSERT_ERROR(!si->isDualObjectiveLimitReached(), {}, solverName, "testObjFunctions: isDualObjectiveLimitReached without limit (min)"); /* One could think that also no limit should be reached in case of maximization. * However, by default primal and dual limits are not unset, but set to plus or minus infinity. * So, if we change the objective sense, we need to remember to set also the limits to a nonlimiting value. */ si->setObjSense(-1.0) ; si->setDblParam(OsiPrimalObjectiveLimit, COIN_DBL_MAX); si->setDblParam(OsiDualObjectiveLimit, -COIN_DBL_MAX); OSIUNITTEST_ASSERT_ERROR(!si->isPrimalObjectiveLimitReached(), {}, solverName, "testObjFunctions: isPrimalObjectiveLimitReached without limit (max)"); OSIUNITTEST_ASSERT_ERROR(!si->isDualObjectiveLimitReached(), {}, solverName, "testObjFunctions: isDualObjectiveLimitReached without limit (max)"); si->setObjSense(1.0) ; si->setDblParam(OsiPrimalObjectiveLimit, -COIN_DBL_MAX); si->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); /* Test objective limit methods. There's no attempt to see if the solver stops early when given a limit that's tighter than the optimal objective. All we're doing here is checking that the routines return the correct value when the limits are exceeded. For minimisation (maximisation) the primal limit represents an acceptable level of `goodness'; to be true, we should be below (above) it. The dual limit represents an unacceptable level of `badness'; to be true, we should be above (below) it. The loop performs two iterations, first for maximisation, then for minimisation. For maximisation, z* = 111.65096. The second iteration is sort of redundant, but it does test the ability to switch back to minimisation. */ double expectedObj[2] = { 111.650960689, objNoOffset+objOffset } ; double primalObjLim[2] = { 100.0, -5.0 } ; double dualObjLim[2] = { 120.0, -15.0 } ; double optSense[2] = { -1.0, 1.0 } ; for (i = 0 ; i <= 1 ; i++) { si->setObjSense(optSense[i]) ; // reset objective limits to infinity si->setDblParam(OsiPrimalObjectiveLimit, -optSense[i] * COIN_DBL_MAX); si->setDblParam(OsiDualObjectiveLimit, optSense[i] * COIN_DBL_MAX); si->initialSolve() ; objValue = si->getObjValue() ; OSIUNITTEST_ASSERT_ERROR(eq(objValue,expectedObj[i]), {}, solverName, "testObjFunctions: optimal value during max/min switch"); si->setDblParam(OsiPrimalObjectiveLimit,primalObjLim[i]) ; si->setDblParam(OsiDualObjectiveLimit,dualObjLim[i]) ; OSIUNITTEST_ASSERT_WARNING(si->isPrimalObjectiveLimitReached(), {}, solverName, "testObjFunctions: primal objective limit"); OSIUNITTEST_ASSERT_WARNING(si->isDualObjectiveLimitReached(), {}, solverName, "testObjFunctions: dual objective limit"); } delete si ; si = 0 ; /* Finally, check that the objective sense is treated as a parameter of the solver, not a property of the problem. The test clones emptySi, inverts the default objective sense, clones a second solver, then loads and optimises e226. */ si = emptySi->clone() ; double dfltSense = si->getObjSense() ; dfltSense = -dfltSense ; si->setObjSense(dfltSense) ; OsiSolverInterface *si2 = si->clone() ; delete si ; si = NULL ; OSIUNITTEST_ASSERT_ERROR(si2->getObjSense() == dfltSense, {}, solverName, "testObjFunctions: objective sense preserved by clone"); OSIUNITTEST_ASSERT_ERROR(si2->readMps(fn.c_str(),"mps") == 0, delete si; return, solverName, "testObjFunctions: 2nd read MPS"); OSIUNITTEST_ASSERT_ERROR(si2->getObjSense() == dfltSense, {}, solverName, "testObjFunctions: objective sense preserved by problem load"); si2->initialSolve() ; if (dfltSense < 0) { i = 0 ; } else { i = 1 ; } objValue = si2->getObjValue() ; OSIUNITTEST_ASSERT_ERROR(eq(objValue,expectedObj[i]), {}, solverName, "testObjFunctions: optimal value of load problem after set objective sense"); delete si2 ; } /* Check that solver returns the proper status for artificial variables. The OSI convention is that this status should be reported as if the artificial uses a positive coefficient. Specifically: ax <= b ==> ax + s = b, 0 <= s <= infty ax >= b ==> ax + s = b, -infty <= s <= 0 If the constraint is tight at optimum, then the status should be atLowerBound for a <= constraint, atUpperBound for a >= constraint. The test problem is x1 >= -5 (c0) x1 <= 2 (c1) x2 >= 44 (c2) x2 <= 51 (c3) This is evaluated for two objectives, so that we have all combinations of tight constraints under minimisation and maximisation. max x1-x2 min x1-x2 obj -42 -56 c0 basic upper c1 lower basic c2 upper basic c3 basic lower */ void testArtifStatus (const OsiSolverInterface *emptySi) { OsiSolverInterface *si = emptySi->clone() ; double infty = si->getInfinity() ; testingMessage("Testing status for artificial variables.\n") ; /* Set up the example problem in packed column-major vector format and load it into the solver. */ int colCnt = 2 ; int rowCnt = 4 ; int indices[] = {0, 1, 2, 3} ; double coeffs[] = {1.0, 1.0, 1.0, 1.0} ; CoinBigIndex starts[] = {0, 2, 4} ; double obj[] = {1.0, -1.0} ; double vubs[] = { infty, infty } ; double vlbs[] = { -infty, -infty } ; double rubs[] = { infty, 2.0, infty, 51.0 } ; double rlbs[] = { -5.0, -infty, 44.0, -infty } ; std::string contype[] = { ">=", "<=", ">=", "<=" } ; std::string statCode[] = { "isFree", "basic", "atUpperBound", "atLowerBound" } ; std::string sense[] = { "maximise", "minimise" } ; si->loadProblem(colCnt,rowCnt, starts,indices,coeffs,vlbs,vubs,obj,rlbs,rubs) ; /* Vectors for objective sense and correct answers. Maximise first. */ double objSense[] = { -1.0, 1.0 } ; double zopt[] = { -42.0, -56 } ; CoinWarmStartBasis::Status goodStatus[] = { CoinWarmStartBasis::basic, CoinWarmStartBasis::atLowerBound, CoinWarmStartBasis::atUpperBound, CoinWarmStartBasis::basic, CoinWarmStartBasis::atUpperBound, CoinWarmStartBasis::basic, CoinWarmStartBasis::basic, CoinWarmStartBasis::atLowerBound } ; /* Get to work. Open a loop, set the objective sense, solve the problem, and then check the results: We should have an optimal solution, with the correct objective. We should be able to ask for a warm start basis, and it should show the correct status. */ CoinRelFltEq eq ; for (int iter = 0 ; iter <= 1 ; iter++) { si->setObjSense(objSense[iter]) ; si->initialSolve() ; OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), {}; continue, *si, "testArtifStatus: initial solve"); OSIUNITTEST_ASSERT_ERROR(eq(si->getObjValue(),zopt[iter]), {}; continue, *si, "testArtifStatus: initial solve optimal value"); CoinWarmStart *ws = si->getWarmStart() ; CoinWarmStartBasis *wsb = dynamic_cast(ws) ; OSIUNITTEST_ASSERT_ERROR(wsb != NULL, {}; continue, *si, "testArtifStatus: initial solve warm start basis"); CoinWarmStartBasis::Status stati ; bool ok = true; for (int i = 0 ; i < rowCnt ; i++) { stati = wsb->getArtifStatus(i) ; if (stati != goodStatus[iter*rowCnt+i]) { ok = false; std::cout << "Incorrect status " << statCode[stati] << " for " << contype[i] << " constraint c" << i << " (" << sense[iter] << "), expected " << statCode[goodStatus[iter*rowCnt+i]] << "." << std::endl; } } OSIUNITTEST_ASSERT_ERROR(ok == true, {}, *si, "testArtifStatus: artifical variable status"); delete ws ; } /* Clean up. */ delete si ; } /* This method checks [cbar cbar] = [c-yB c-yN] = [0 (c - yN)] for the architectural variables. (But note there's no need to discriminate between basic and nonbasic columns in the tests below.) This provides a moderately strong check on the correctness of y (getRowPrice) and cbar (getReducedCosts). The method also checks that the sign of cbar is appropriate for the status of the variables. */ void testReducedCosts (const OsiSolverInterface *emptySi, const std::string &sampleDir) { OsiSolverInterface *si = emptySi->clone() ; std::string solverName; si->getStrParam(OsiSolverName,solverName); si->setHintParam(OsiDoReducePrint,true,OsiHintDo) ; std::cout << "Testing duals and reduced costs ... " ; /* Read p0033 and solve to optimality (minimisation). */ std::string fn = sampleDir+"p0033"; si->readMps(fn.c_str(),"mps"); si->setObjSense(1.0) ; si->initialSolve(); OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return, solverName, "testReducedCosts: solving p0033"); if (OsiUnitTest::verbosity >= 1) { std::cout << " " << solverName << " solved p0033 z = " << si->getObjValue() << "." << std::endl ; } /* Get the unchanging components: size, matrix, objective. */ int n = si->getNumCols() ; double *cbarCalc = new double[n] ; double dualTol ; si->getDblParam(OsiDualTolerance,dualTol) ; CoinRelFltEq eq ; std::string statNames[] = { "NBFR", "B", "NBUB", "NBLB" } ; /* Resolve, first as maximisation, then minimisation, and do the tests. */ double minmax[] = { -1.0, 1.0 } ; for (int ndx = 0 ; ndx < 2 ; ndx++) { si->setObjSense(minmax[ndx]) ; si->resolve() ; OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return, solverName, "testReducedCosts: solving p0033 after changing objective sense"); if (OsiUnitTest::verbosity >= 1) { std::cout << " " << solverName << ((si->getObjSense() < 0)?" maximised":" minimised") << " p0033 z = " << si->getObjValue() << "." << std::endl ; } /* Retrieve status, duals, and reduced costs. Calculate c - yA. */ const CoinPackedMatrix *mtx = si->getMatrixByCol() ; const double *c = si->getObjCoefficients() ; const CoinWarmStartBasis *wsb = dynamic_cast(si->getWarmStart()) ; double dir = si->getObjSense() ; const double *y = si->getRowPrice() ; const double *cbar = si->getReducedCost() ; mtx->transposeTimes(y,cbarCalc) ; std::transform(c,c+n,cbarCalc,cbarCalc,std::minus()) ; /* Walk the architecturals and check that cbar = c - ya and has the correct sign given the status and objective sense (max/min). */ bool cbarCalcj_ok = true; bool testcbarj_ok = true; for (int j = 0 ; j < n ; j++) { CoinWarmStartBasis::Status statj = wsb->getStructStatus(j) ; double cbarj = cbar[j] ; double cbarCalcj = cbarCalc[j] ; if (OsiUnitTest::verbosity >= 1) { std::cout << " x<" << j << "> " << statNames[statj] << ", cbar<" << j << "> = " << cbarj << "." << std::endl ; } if (!eq(cbarj,cbarCalcj)) { cbarCalcj_ok = false; if (OsiUnitTest::verbosity >= 1) { std::cout << " " << cbarj << " = cbar<" << j << "> != c<" << j << "> - ya<" << j << "> = " << cbarCalcj << ", diff = " << cbarj-cbarCalcj << "." << std::endl ; } } double testcbarj = dir*cbarj ; switch (statj) { case CoinWarmStartBasis::atUpperBound: { if (testcbarj > dualTol) { testcbarj_ok = false; if (OsiUnitTest::verbosity >= 1) { std::cout << " cbar<" << j << "> = " << cbarj << " has the wrong sign for a NBUB variable." << std::endl ; } } break ; } case CoinWarmStartBasis::atLowerBound: { if (testcbarj < -dualTol) { testcbarj_ok = false; if (OsiUnitTest::verbosity >= 1) { std::cout << " cbar<" << j << "> = " << cbarj << " has the wrong sign for a NBLB variable." << std::endl ; } } break ; } case CoinWarmStartBasis::isFree: { if (CoinAbs(testcbarj) > dualTol) { testcbarj_ok = false; if (OsiUnitTest::verbosity >= 1) { std::cout << " cbar<" << j << "> = " << cbarj << " should be zero for a NBFR variable." << std::endl ; } } break ; } case CoinWarmStartBasis::basic: { if (CoinAbs(testcbarj) > dualTol) { testcbarj_ok = false; if (OsiUnitTest::verbosity >= 1) { std::cout << " cbar<" << j << "> = " << cbarj << " should be zero for a basic variable." << std::endl ; } } break ; } default: { break ; } } } OSIUNITTEST_ASSERT_ERROR(cbarCalcj_ok == true, {}, solverName, "testReducedCosts: reduced costs"); OSIUNITTEST_ASSERT_ERROR(testcbarj_ok == true, {}, solverName, "testReducedCosts: basis status of structural variable"); delete wsb ; } delete[] cbarCalc ; } /* Test the writeMps and writeMpsNative functions by loading a problem, writing it out to a file, reloading it, and solving. Implicitly assumes readMps has already been tested. fn should be the path to exmip1. */ void testWriteMps (const OsiSolverInterface *emptySi, std::string fn) { testingMessage("Testing writeMps and writeMpsNative.\n") ; CoinRelFltEq eq(1.0e-8) ; OsiSolverInterface *si1 = emptySi->clone(); OsiSolverInterface *si2 = emptySi->clone(); OsiSolverInterface *si3 = emptySi->clone(); /* Sanity test. Read in exmip1 and do an initialSolve. */ OSIUNITTEST_ASSERT_ERROR(si1->readMps(fn.c_str(),"mps") == 0, return, *si1, "testWriteMps: read MPS"); bool solved = true; OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si1->initialSolve(), solved = false, *si1, "testWriteMps: solving LP", TestOutcome::ERROR, e.className() == "OsiVolSolverInterface" || e.className() == "OsiTestSolverInterface"); double soln = si1->getObjValue(); /* Write a test output file with writeMpsNative, then read and solve. See if we get the right answer. FIXME: Really, this test should verify values --- Vol could participate in that (lh, 070726). */ si1->writeMpsNative("test.out",NULL,NULL); OSIUNITTEST_ASSERT_ERROR(si2->readMps("test.out","") == 0, return, *si1, "testWriteMps: read LP written by writeMpsNative"); if (solved) { OSIUNITTEST_CATCH_ERROR(si2->initialSolve(), return, *si1, "testWriteMps: solving LP written by writeMpsNative"); OSIUNITTEST_ASSERT_ERROR(eq(soln,si2->getObjValue()), return, *si1, "testWriteMps: solving LP written by writeMpsNative"); } /* Repeat with writeMps. */ si1->writeMps("test2","out"); OSIUNITTEST_ASSERT_ERROR(si3->readMps("test2.out","") == 0, return, *si1, "testWriteMps: read LP written by writeMps"); if (solved) { OSIUNITTEST_CATCH_ERROR(si3->initialSolve(), return, *si1, "testWriteMps: solving LP written by writeMps"); OSIUNITTEST_ASSERT_ERROR(eq(soln,si3->getObjValue()), return, *si1, "testWriteMps: solving LP written by writeMps"); } /* Clean up. */ delete si1; delete si2; delete si3; } /* Test writeLp and writeLpNative. Same sequence as for testWriteMps, above. Implicitly assumes readLp has been tested, but in fact that's not the case at present (lh, 070726). */ void testWriteLp (const OsiSolverInterface *emptySi, std::string fn) { testingMessage("Testing writeLp and writeLpNative.\n") ; CoinRelFltEq eq(1.0e-8) ; OsiSolverInterface * si1 = emptySi->clone(); OsiSolverInterface * si2 = emptySi->clone(); OsiSolverInterface * si3 = emptySi->clone(); OSIUNITTEST_ASSERT_ERROR(si1->readMps(fn.c_str(),"mps") == 0, return, *si1, "testWriteLp: read MPS"); bool solved = true; OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si1->initialSolve(), solved = false, *si1, "testWriteLp: solving LP", TestOutcome::ERROR, e.className() == "OsiVolSolverInterface" || e.className() == "OsiTestSolverInterface"); double soln = si1->getObjValue(); si1->writeLpNative("test.lp",NULL,NULL,1.0e-9,10,8); OSIUNITTEST_ASSERT_ERROR(si2->readLp("test.lp") == 0, return, *si1, "testWriteLp: read LP written by writeLpNative"); if (solved) { OSIUNITTEST_CATCH_ERROR(si2->initialSolve(), return, *si1, "testWriteLp: solving LP written by writeLpNative"); OSIUNITTEST_ASSERT_ERROR(eq(soln,si2->getObjValue()), return, *si1, "testWriteLp: solving LP written by writeLpNative"); } si1->writeLp("test2"); OSIUNITTEST_ASSERT_ERROR(si3->readLp("test2.lp") == 0, return, *si1, "testWriteLp: read LP written by writeLp"); if (solved) { OSIUNITTEST_CATCH_ERROR(si3->initialSolve(), return, *si1, "testWriteLp: solving LP written by writeLp"); OSIUNITTEST_ASSERT_ERROR(eq(soln,si3->getObjValue()), return, *si1, "testWriteLp: solving LP written by writeLp"); } delete si1; delete si2; delete si3; } /* Test load and assign problem. The first batch of tests loads up eight solvers, using each variant of loadProblem and assignProblem, runs initialSolve for all, then checks all values for all variants. */ void testLoadAndAssignProblem (const OsiSolverInterface *emptySi, const OsiSolverInterface *exmip1Si) { CoinRelFltEq eq(1.0e-8) ; std::string solverName; if( !emptySi->getStrParam(OsiSolverName, solverName) ) solverName == "unknown"; /* Test each variant of loadProblem and assignProblem. Clone a whack of solvers and use one for each variant. Then run initialSolve() on each solver. Then check that all values are as they should be. Note that we are not testing the variants that supply the matrix as a set of vectors (row/col starts, col/row indices, coefficients). To be really thorough, we should do another eight ... */ { testingMessage("Testing loadProblem and assignProblem methods.\n") ; OsiSolverInterface * base = exmip1Si->clone(); OsiSolverInterface * si1 = emptySi->clone(); OsiSolverInterface * si2 = emptySi->clone(); OsiSolverInterface * si3 = emptySi->clone(); OsiSolverInterface * si4 = emptySi->clone(); OsiSolverInterface * si5 = emptySi->clone(); OsiSolverInterface * si6 = emptySi->clone(); OsiSolverInterface * si7 = emptySi->clone(); OsiSolverInterface * si8 = emptySi->clone(); si1->loadProblem(*base->getMatrixByCol(), base->getColLower(),base->getColUpper(), base->getObjCoefficients(), base->getRowSense(),base->getRightHandSide(), base->getRowRange()); si2->loadProblem(*base->getMatrixByRow(), base->getColLower(),base->getColUpper(), base->getObjCoefficients(), base->getRowSense(),base->getRightHandSide(), base->getRowRange()); si3->loadProblem(*base->getMatrixByCol(), base->getColLower(),base->getColUpper(), base->getObjCoefficients(), base->getRowLower(),base->getRowUpper() ); si4->loadProblem(*base->getMatrixByCol(), base->getColLower(),base->getColUpper(), base->getObjCoefficients(), base->getRowLower(),base->getRowUpper() ); { double objOffset; base->getDblParam(OsiObjOffset,objOffset); si1->setDblParam(OsiObjOffset,objOffset); si2->setDblParam(OsiObjOffset,objOffset); si3->setDblParam(OsiObjOffset,objOffset); si4->setDblParam(OsiObjOffset,objOffset); si5->setDblParam(OsiObjOffset,objOffset); si6->setDblParam(OsiObjOffset,objOffset); si7->setDblParam(OsiObjOffset,objOffset); si8->setDblParam(OsiObjOffset,objOffset); } /* Assign methods should set their parameters to NULL, so check for that. */ CoinPackedMatrix * pm = new CoinPackedMatrix(*base->getMatrixByCol()); double * clb = new double[base->getNumCols()]; std::copy(base->getColLower(), base->getColLower()+base->getNumCols(),clb); double * cub = new double[base->getNumCols()]; std::copy(base->getColUpper(), base->getColUpper()+base->getNumCols(),cub); double * objc = new double[base->getNumCols()]; std::copy(base->getObjCoefficients(), base->getObjCoefficients()+base->getNumCols(),objc); double * rlb = new double[base->getNumRows()]; std::copy(base->getRowLower(), base->getRowLower()+base->getNumRows(),rlb); double * rub = new double[base->getNumRows()]; std::copy(base->getRowUpper(), base->getRowUpper()+base->getNumRows(),rub); si5->assignProblem(pm,clb,cub,objc,rlb,rub); OSIUNITTEST_ASSERT_ERROR(pm == NULL, return, solverName, "testLoadAndAssignProblem: si5 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(clb == NULL, return, solverName, "testLoadAndAssignProblem: si5 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(cub == NULL, return, solverName, "testLoadAndAssignProblem: si5 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(objc == NULL, return, solverName, "testLoadAndAssignProblem: si5 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rlb == NULL, return, solverName, "testLoadAndAssignProblem: si5 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rub == NULL, return, solverName, "testLoadAndAssignProblem: si5 assignProblem should set parameters to NULL"); pm = new CoinPackedMatrix(*base->getMatrixByRow()); clb = new double[base->getNumCols()]; std::copy(base->getColLower(), base->getColLower()+base->getNumCols(),clb); cub = new double[base->getNumCols()]; std::copy(base->getColUpper(), base->getColUpper()+base->getNumCols(),cub); objc = new double[base->getNumCols()]; std::copy(base->getObjCoefficients(), base->getObjCoefficients()+base->getNumCols(),objc); rlb = new double[base->getNumRows()]; std::copy(base->getRowLower(), base->getRowLower()+base->getNumRows(),rlb); rub = new double[base->getNumRows()]; std::copy(base->getRowUpper(), base->getRowUpper()+base->getNumRows(),rub); si6->assignProblem(pm,clb,cub,objc,rlb,rub); OSIUNITTEST_ASSERT_ERROR(pm == NULL, return, solverName, "testLoadAndAssignProblem: si6 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(clb == NULL, return, solverName, "testLoadAndAssignProblem: si6 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(cub == NULL, return, solverName, "testLoadAndAssignProblem: si6 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(objc == NULL, return, solverName, "testLoadAndAssignProblem: si6 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rlb == NULL, return, solverName, "testLoadAndAssignProblem: si6 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rub == NULL, return, solverName, "testLoadAndAssignProblem: si6 assignProblem should set parameters to NULL"); pm = new CoinPackedMatrix(*base->getMatrixByCol()); clb = new double[base->getNumCols()]; std::copy(base->getColLower(), base->getColLower()+base->getNumCols(),clb); cub = new double[base->getNumCols()]; std::copy(base->getColUpper(), base->getColUpper()+base->getNumCols(),cub); objc = new double[base->getNumCols()]; std::copy(base->getObjCoefficients(), base->getObjCoefficients()+base->getNumCols(),objc); char * rsen = new char[base->getNumRows()]; std::copy(base->getRowSense(), base->getRowSense()+base->getNumRows(),rsen); double * rhs = new double[base->getNumRows()]; std::copy(base->getRightHandSide(), base->getRightHandSide()+base->getNumRows(),rhs); double * rng = new double[base->getNumRows()]; std::copy(base->getRowRange(), base->getRowRange()+base->getNumRows(),rng); si7->assignProblem(pm,clb,cub,objc,rsen,rhs,rng); OSIUNITTEST_ASSERT_ERROR(pm == NULL, return, solverName, "testLoadAndAssignProblem: si7 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(clb == NULL, return, solverName, "testLoadAndAssignProblem: si7 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(cub == NULL, return, solverName, "testLoadAndAssignProblem: si7 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(objc == NULL, return, solverName, "testLoadAndAssignProblem: si7 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rsen == NULL, return, solverName, "testLoadAndAssignProblem: si7 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rhs == NULL, return, solverName, "testLoadAndAssignProblem: si7 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rng == NULL, return, solverName, "testLoadAndAssignProblem: si7 assignProblem should set parameters to NULL"); pm = new CoinPackedMatrix(*base->getMatrixByCol()); clb = new double[base->getNumCols()]; std::copy(base->getColLower(), base->getColLower()+base->getNumCols(),clb); cub = new double[base->getNumCols()]; std::copy(base->getColUpper(), base->getColUpper()+base->getNumCols(),cub); objc = new double[base->getNumCols()]; std::copy(base->getObjCoefficients(), base->getObjCoefficients()+base->getNumCols(),objc); rsen = new char[base->getNumRows()]; std::copy(base->getRowSense(), base->getRowSense()+base->getNumRows(),rsen); rhs = new double[base->getNumRows()]; std::copy(base->getRightHandSide(), base->getRightHandSide()+base->getNumRows(),rhs); rng = new double[base->getNumRows()]; std::copy(base->getRowRange(), base->getRowRange()+base->getNumRows(),rng); si8->assignProblem(pm,clb,cub,objc,rsen,rhs,rng); OSIUNITTEST_ASSERT_ERROR(pm == NULL, return, solverName, "testLoadAndAssignProblem: si8 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(clb == NULL, return, solverName, "testLoadAndAssignProblem: si8 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(cub == NULL, return, solverName, "testLoadAndAssignProblem: si8 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(objc == NULL, return, solverName, "testLoadAndAssignProblem: si8 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rsen == NULL, return, solverName, "testLoadAndAssignProblem: si8 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rhs == NULL, return, solverName, "testLoadAndAssignProblem: si8 assignProblem should set parameters to NULL"); OSIUNITTEST_ASSERT_ERROR(rng == NULL, return, solverName, "testLoadAndAssignProblem: si8 assignProblem should set parameters to NULL"); // Create an indices vector CoinPackedVector basePv,pv; OSIUNITTEST_ASSERT_ERROR(base->getNumCols()<10, return, solverName, "testLoadAndAssignProblem"); OSIUNITTEST_ASSERT_ERROR(base->getNumRows()<10, return, solverName, "testLoadAndAssignProblem"); int indices[10]; int i; for (i=0; i<10; i++) indices[i]=i; // Test solve methods. // Vol solver interface is expected to throw // an error if the data has a ranged row. // Prepare test that there is non-zero range basePv.setFull(base->getNumRows(),base->getRowRange()); pv.setConstant( base->getNumRows(), indices, 0.0 ); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(base->initialSolve(), return, *base, "testLoadAndAssignProblem: base initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si1->initialSolve(), return, *base, "testLoadAndAssignProblem: si1 initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si2->initialSolve(), return, *base, "testLoadAndAssignProblem: si2 initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si3->initialSolve(), return, *base, "testLoadAndAssignProblem: si3 initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si4->initialSolve(), return, *base, "testLoadAndAssignProblem: si4 initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si5->initialSolve(), return, *base, "testLoadAndAssignProblem: si5 initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si6->initialSolve(), return, *base, "testLoadAndAssignProblem: si6 initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si7->initialSolve(), return, *base, "testLoadAndAssignProblem: si7 initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); OSIUNITTEST_CATCH_SEVERITY_EXPECTED(si8->initialSolve(), return, *base, "testLoadAndAssignProblem: si8 initialSolve", TestOutcome::ERROR, solverName == "vol" && !basePv.isEquivalent(pv)); // Test collower basePv.setVector(base->getNumCols(),indices,base->getColLower()); pv.setVector( si1->getNumCols(),indices, si1->getColLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si1 column lower bounds"); pv.setVector( si2->getNumCols(),indices, si2->getColLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si2 column lower bounds"); pv.setVector( si3->getNumCols(),indices, si3->getColLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si3 column lower bounds"); pv.setVector( si4->getNumCols(),indices, si4->getColLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si4 column lower bounds"); pv.setVector( si5->getNumCols(),indices, si5->getColLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si5 column lower bounds"); pv.setVector( si6->getNumCols(),indices, si6->getColLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si6 column lower bounds"); pv.setVector( si7->getNumCols(),indices, si7->getColLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si7 column lower bounds"); pv.setVector( si8->getNumCols(),indices, si8->getColLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si8 column lower bounds"); // Test colupper basePv.setVector(base->getNumCols(),indices,base->getColUpper()); pv.setVector( si1->getNumCols(),indices, si1->getColUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si1 column upper bounds"); pv.setVector( si2->getNumCols(),indices, si2->getColUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si2 column upper bounds"); pv.setVector( si3->getNumCols(),indices, si3->getColUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si3 column upper bounds"); pv.setVector( si4->getNumCols(),indices, si4->getColUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si4 column upper bounds"); pv.setVector( si5->getNumCols(),indices, si5->getColUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si5 column upper bounds"); pv.setVector( si6->getNumCols(),indices, si6->getColUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si6 column upper bounds"); pv.setVector( si7->getNumCols(),indices, si7->getColUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si7 column upper bounds"); pv.setVector( si8->getNumCols(),indices, si8->getColUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si8 column upper bounds"); // Test getObjCoefficients basePv.setVector(base->getNumCols(),indices,base->getObjCoefficients()); pv.setVector( si1->getNumCols(),indices, si1->getObjCoefficients()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si1 objective coefficients"); pv.setVector( si2->getNumCols(),indices, si2->getObjCoefficients()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si2 objective coefficients"); pv.setVector( si3->getNumCols(),indices, si3->getObjCoefficients()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si3 objective coefficients"); pv.setVector( si4->getNumCols(),indices, si4->getObjCoefficients()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si4 objective coefficients"); pv.setVector( si5->getNumCols(),indices, si5->getObjCoefficients()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si5 objective coefficients"); pv.setVector( si6->getNumCols(),indices, si6->getObjCoefficients()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si6 objective coefficients"); pv.setVector( si7->getNumCols(),indices, si7->getObjCoefficients()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si7 objective coefficients"); pv.setVector( si8->getNumCols(),indices, si8->getObjCoefficients()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si8 objective coefficients"); // Test rowrhs basePv.setFull(base->getNumRows(),base->getRightHandSide()); pv.setFull( si1->getNumRows(), si1->getRightHandSide()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si1 right hand side"); pv.setFull( si2->getNumRows(), si2->getRightHandSide()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si2 right hand side"); pv.setFull( si3->getNumRows(), si3->getRightHandSide()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si3 right hand side"); pv.setFull( si4->getNumRows(), si4->getRightHandSide()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si4 right hand side"); pv.setFull( si5->getNumRows(), si5->getRightHandSide()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si5 right hand side"); pv.setFull( si6->getNumRows(), si6->getRightHandSide()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si6 right hand side"); pv.setFull( si7->getNumRows(), si7->getRightHandSide()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si7 right hand side"); pv.setFull( si8->getNumRows(), si8->getRightHandSide()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si8 right hand side"); // Test rowrange basePv.setFull(base->getNumRows(),base->getRowRange()); pv.setFull( si1->getNumRows(), si1->getRowRange()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si1 row range"); pv.setFull( si2->getNumRows(), si2->getRowRange()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si2 row range"); pv.setFull( si3->getNumRows(), si3->getRowRange()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si3 row range"); pv.setFull( si4->getNumRows(), si4->getRowRange()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si4 row range"); pv.setFull( si5->getNumRows(), si5->getRowRange()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si5 row range"); pv.setFull( si6->getNumRows(), si6->getRowRange()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si6 row range"); pv.setFull( si7->getNumRows(), si7->getRowRange()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si7 row range"); pv.setFull( si8->getNumRows(), si8->getRowRange()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si8 row range"); // Test row sense { const char * cb = base->getRowSense(); const char * c1 = si1->getRowSense(); const char * c2 = si2->getRowSense(); const char * c3 = si3->getRowSense(); const char * c4 = si4->getRowSense(); const char * c5 = si5->getRowSense(); const char * c6 = si6->getRowSense(); const char * c7 = si7->getRowSense(); const char * c8 = si8->getRowSense(); int nr = base->getNumRows(); bool rowsense_ok1 = true; bool rowsense_ok2 = true; bool rowsense_ok3 = true; bool rowsense_ok4 = true; bool rowsense_ok5 = true; bool rowsense_ok6 = true; bool rowsense_ok7 = true; bool rowsense_ok8 = true; for ( i=0; igetNumRows(),indices,base->getRowLower()); pv.setVector( si1->getNumRows(),indices, si1->getRowLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si1 row lower bounds"); pv.setVector( si2->getNumRows(),indices, si2->getRowLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si2 row lower bounds"); pv.setVector( si3->getNumRows(),indices, si3->getRowLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si3 row lower bounds"); pv.setVector( si4->getNumRows(),indices, si4->getRowLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si4 row lower bounds"); pv.setVector( si5->getNumRows(),indices, si5->getRowLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si5 row lower bounds"); pv.setVector( si6->getNumRows(),indices, si6->getRowLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si6 row lower bounds"); pv.setVector( si7->getNumRows(),indices, si7->getRowLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si7 row lower bounds"); pv.setVector( si8->getNumRows(),indices, si8->getRowLower()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si8 row lower bounds"); // Test rowupper basePv.setVector(base->getNumRows(),indices,base->getRowUpper()); pv.setVector( si1->getNumRows(),indices, si1->getRowUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si1 row upper bounds"); pv.setVector( si2->getNumRows(),indices, si2->getRowUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si2 row upper bounds"); pv.setVector( si3->getNumRows(),indices, si3->getRowUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si3 row upper bounds"); pv.setVector( si4->getNumRows(),indices, si4->getRowUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si4 row upper bounds"); pv.setVector( si5->getNumRows(),indices, si5->getRowUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si5 row upper bounds"); pv.setVector( si6->getNumRows(),indices, si6->getRowUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si6 row upper bounds"); pv.setVector( si7->getNumRows(),indices, si7->getRowUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si7 row upper bounds"); pv.setVector( si8->getNumRows(),indices, si8->getRowUpper()); OSIUNITTEST_ASSERT_ERROR(basePv.isEquivalent(pv), return, solverName, "testLoadAndAssignProblem: si8 row upper bounds"); // Test Constraint Matrix OSIUNITTEST_ASSERT_ERROR(base->getMatrixByCol()->isEquivalent(*si1->getMatrixByCol()), return, solverName, "testLoadAndAssignProblem: si1 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByRow()->isEquivalent(*si1->getMatrixByRow()), return, solverName, "testLoadAndAssignProblem: si1 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByCol()->isEquivalent(*si2->getMatrixByCol()), return, solverName, "testLoadAndAssignProblem: si2 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByRow()->isEquivalent(*si2->getMatrixByRow()), return, solverName, "testLoadAndAssignProblem: si2 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByCol()->isEquivalent(*si3->getMatrixByCol()), return, solverName, "testLoadAndAssignProblem: si3 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByRow()->isEquivalent(*si3->getMatrixByRow()), return, solverName, "testLoadAndAssignProblem: si3 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByCol()->isEquivalent(*si4->getMatrixByCol()), return, solverName, "testLoadAndAssignProblem: si4 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByRow()->isEquivalent(*si4->getMatrixByRow()), return, solverName, "testLoadAndAssignProblem: si4 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByCol()->isEquivalent(*si5->getMatrixByCol()), return, solverName, "testLoadAndAssignProblem: si5 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByRow()->isEquivalent(*si5->getMatrixByRow()), return, solverName, "testLoadAndAssignProblem: si5 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByCol()->isEquivalent(*si6->getMatrixByCol()), return, solverName, "testLoadAndAssignProblem: si6 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByRow()->isEquivalent(*si6->getMatrixByRow()), return, solverName, "testLoadAndAssignProblem: si6 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByCol()->isEquivalent(*si7->getMatrixByCol()), return, solverName, "testLoadAndAssignProblem: si7 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByRow()->isEquivalent(*si7->getMatrixByRow()), return, solverName, "testLoadAndAssignProblem: si7 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByCol()->isEquivalent(*si8->getMatrixByCol()), return, solverName, "testLoadAndAssignProblem: si8 constraint matrix"); OSIUNITTEST_ASSERT_ERROR(base->getMatrixByRow()->isEquivalent(*si8->getMatrixByRow()), return, solverName, "testLoadAndAssignProblem: si8 constraint matrix"); // Test Objective Value OSIUNITTEST_ASSERT_ERROR(eq(base->getObjValue(),si1->getObjValue()), return, solverName, "testLoadAndAssignProblem: si1 objective value"); OSIUNITTEST_ASSERT_ERROR(eq(base->getObjValue(),si2->getObjValue()), return, solverName, "testLoadAndAssignProblem: si2 objective value"); OSIUNITTEST_ASSERT_ERROR(eq(base->getObjValue(),si3->getObjValue()), return, solverName, "testLoadAndAssignProblem: si3 objective value"); OSIUNITTEST_ASSERT_ERROR(eq(base->getObjValue(),si4->getObjValue()), return, solverName, "testLoadAndAssignProblem: si4 objective value"); OSIUNITTEST_ASSERT_ERROR(eq(base->getObjValue(),si5->getObjValue()), return, solverName, "testLoadAndAssignProblem: si5 objective value"); OSIUNITTEST_ASSERT_ERROR(eq(base->getObjValue(),si6->getObjValue()), return, solverName, "testLoadAndAssignProblem: si6 objective value"); OSIUNITTEST_ASSERT_ERROR(eq(base->getObjValue(),si7->getObjValue()), return, solverName, "testLoadAndAssignProblem: si7 objective value"); OSIUNITTEST_ASSERT_ERROR(eq(base->getObjValue(),si8->getObjValue()), return, solverName, "testLoadAndAssignProblem: si8 objective value"); // Clean-up delete si8; delete si7; delete si6; delete si5; delete si4; delete si3; delete si2; delete si1; delete base; } /* The OSI interface spec says any of the parameters to loadProblem can default to null. Let's see if that works. Test the rowub, rowlb and sense, rhs, range variants. Arguably we should check all variants again, but let's hope that OSI implementors carry things over from one variant to another. For Gurobi, this does not work. Since Gurobi does not know about free rows (rowtype 'N'), OsiGrb translates free rows into 'L' (lower-equal) rows with a -infty right-hand side. This makes some of the tests below fail. Ok, gurobi has quirks. As do other solvers. But those quirks should be hidden from users of OsiGrb -- i.e., the translation should be done within OsiGrb, and should not be visible to the user (or this test). That's the point of OSI. It's an implementation failure and should not be swept under the rug here. -- lh, 100826 -- OsiGrb does quite some attempts to hide this translation from the user, need to check further what could be done. -- sv, 110306 -- ps: it's just coincidence that I actually see your messages here... */ if (solverName != "gurobi") { int i ; OsiSolverInterface * si1 = emptySi->clone(); OsiSolverInterface * si2 = emptySi->clone(); si1->loadProblem(*exmip1Si->getMatrixByCol(),NULL,NULL,NULL,NULL,NULL); si2->loadProblem(*exmip1Si->getMatrixByCol(),NULL,NULL,NULL,NULL,NULL,NULL); // Test column settings OSIUNITTEST_ASSERT_ERROR(si1->getNumCols() == exmip1Si->getNumCols(), return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); bool collower_ok = true; bool colupper_ok = true; bool colobjcoef_ok = true; for ( i=0; igetNumCols(); i++ ) { collower_ok &= eq(si1->getColLower()[i],0.0); colupper_ok &= eq(si1->getColUpper()[i],si1->getInfinity()); colobjcoef_ok &= eq(si1->getObjCoefficients()[i],0.0); } OSIUNITTEST_ASSERT_ERROR(collower_ok == true, return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(colupper_ok == true, return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(colobjcoef_ok == true, return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); // Test row settings OSIUNITTEST_ASSERT_ERROR(si1->getNumRows() == exmip1Si->getNumRows(), return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); const double * rh = si1->getRightHandSide(); const double * rr = si1->getRowRange(); const char * rs = si1->getRowSense(); const double * rl = si1->getRowLower(); const double * ru = si1->getRowUpper(); bool rowrhs_ok = true; bool rowrange_ok = true; bool rowsense_ok = true; bool rowlower_ok = true; bool rowupper_ok = true; for ( i=0; igetNumRows(); i++ ) { rowrhs_ok &= eq(rh[i],0.0); rowrange_ok &= eq(rr[i],0.0); rowsense_ok &= 'N'==rs[i]; rowlower_ok &= eq(rl[i],-si1->getInfinity()); rowupper_ok &= eq(ru[i], si1->getInfinity()); } OSIUNITTEST_ASSERT_ERROR(rowrhs_ok == true, return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(rowrange_ok == true, return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(rowsense_ok == true, return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(rowlower_ok == true, return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(rowupper_ok == true, return, solverName, "testLoadAndAssignProblem: si1 loadProblem with matrix only"); // And repeat for si2 OSIUNITTEST_ASSERT_ERROR(si2->getNumCols() == exmip1Si->getNumCols(), return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); collower_ok = true; colupper_ok = true; colobjcoef_ok = true; for ( i=0; igetNumCols(); i++ ) { collower_ok &= eq(si2->getColLower()[i],0.0); colupper_ok &= eq(si2->getColUpper()[i],si2->getInfinity()); colobjcoef_ok &= eq(si2->getObjCoefficients()[i],0.0); } OSIUNITTEST_ASSERT_ERROR(collower_ok == true, return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(colupper_ok == true, return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(colobjcoef_ok == true, return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); // OSIUNITTEST_ASSERT_ERROR(si2->getNumRows() == exmip1Si->getNumRows(), return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); rh = si2->getRightHandSide(); rr = si2->getRowRange(); rs = si2->getRowSense(); rl = si2->getRowLower(); ru = si2->getRowUpper(); rowrhs_ok = true; rowrange_ok = true; rowsense_ok = true; rowlower_ok = true; rowupper_ok = true; for ( i=0; igetNumRows(); i++ ) { rowrhs_ok &= eq(rh[i],0.0); rowrange_ok &= eq(rr[i],0.0); rowsense_ok &= 'G'==rs[i]; rowlower_ok &= eq(rl[i],0.0); rowupper_ok &= eq(ru[i],si2->getInfinity()); } OSIUNITTEST_ASSERT_ERROR(rowrhs_ok == true, return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(rowrange_ok == true, return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(rowsense_ok == true, return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(rowlower_ok == true, return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); OSIUNITTEST_ASSERT_ERROR(rowupper_ok == true, return, solverName, "testLoadAndAssignProblem: si2 loadProblem with matrix only"); delete si1; delete si2; } else { failureMessage(solverName, "OsiGrb exposes inability to handle 'N' constraints (expected).") ; OSIUNITTEST_ADD_OUTCOME(solverName, "testLoadAndAssignProblem", "ability to handle 'N' constraints", TestOutcome::ERROR, true); } /* Load problem with row rhs, sense and range, but leave column bounds and objective at defaults. A belt-and-suspenders kind of test. Arguably we should have the symmetric case, with column bounds valid and row values at default. */ { int i ; OsiSolverInterface * si = emptySi->clone(); si->loadProblem(*exmip1Si->getMatrixByRow(), NULL,NULL,NULL, exmip1Si->getRowSense(), exmip1Si->getRightHandSide(), exmip1Si->getRowRange()); // Test column settings OSIUNITTEST_ASSERT_ERROR(si->getNumCols()==exmip1Si->getNumCols(), return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); bool collower_ok = true; bool colupper_ok = true; bool colobjcoef_ok = true; for ( i=0; igetNumCols(); i++ ) { collower_ok &= eq(si->getColLower()[i],0.0); colupper_ok &= eq(si->getColUpper()[i],si->getInfinity()); colobjcoef_ok &= eq(si->getObjCoefficients()[i],0.0); } OSIUNITTEST_ASSERT_ERROR(collower_ok == true, return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); OSIUNITTEST_ASSERT_ERROR(colupper_ok == true, return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); OSIUNITTEST_ASSERT_ERROR(colobjcoef_ok == true, return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); // Test row settings OSIUNITTEST_ASSERT_ERROR(si->getNumRows()==exmip1Si->getNumRows(), return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); bool rowrhs_ok = true; bool rowrange_ok = true; bool rowsense_ok = true; bool rowlower_ok = true; bool rowupper_ok = true; for ( i=0; igetNumRows(); i++ ) { rowrhs_ok &= eq(si->getRightHandSide()[i], exmip1Si->getRightHandSide()[i]); rowrange_ok &= eq(si->getRowRange()[i], exmip1Si->getRowRange()[i]); rowsense_ok &= si->getRowSense()[i]==exmip1Si->getRowSense()[i]; char s = si->getRowSense()[i]; if ( s=='G' ) { rowlower_ok &= eq(si->getRowLower()[i], exmip1Si->getRightHandSide()[i]); rowupper_ok &= eq(si->getRowUpper()[i], si->getInfinity()); } else if ( s=='L' ) { rowlower_ok &= eq(si->getRowLower()[i], -si->getInfinity()); rowupper_ok &= eq(si->getRowUpper()[i], exmip1Si->getRightHandSide()[i]); } else if ( s=='E' ) { rowlower_ok &= eq(si->getRowLower()[i], si->getRowUpper()[i]); rowupper_ok &= eq(si->getRowUpper()[i], exmip1Si->getRightHandSide()[i]); } else if ( s=='N' ) { rowlower_ok &= eq(si->getRowLower()[i], -si->getInfinity()); rowupper_ok &= eq(si->getRowUpper()[i], si->getInfinity()); } else if ( s=='R' ) { rowlower_ok &= eq(si->getRowLower()[i], exmip1Si->getRightHandSide()[i] - exmip1Si->getRowRange()[i]); rowupper_ok &= eq(si->getRowUpper()[i], exmip1Si->getRightHandSide()[i]); } } OSIUNITTEST_ASSERT_ERROR(rowrhs_ok == true, return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); OSIUNITTEST_ASSERT_ERROR(rowrange_ok == true, return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); OSIUNITTEST_ASSERT_ERROR(rowsense_ok == true, return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); OSIUNITTEST_ASSERT_ERROR(rowlower_ok == true, return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); OSIUNITTEST_ASSERT_ERROR(rowupper_ok == true, return, solverName, "testLoadAndAssignProblem: loadProblem with matrix and row bounds only"); delete si; } return ; } /* Test adding rows and columns to an empty constraint system. */ void testAddToEmptySystem (const OsiSolverInterface *emptySi, bool volSolverInterface) { CoinRelFltEq eq(1.0e-7) ; std::string solverName = "Unknown solver" ; emptySi->getStrParam(OsiSolverName,solverName) ; /* Add rows to an empty system. Begin by creating empty columns, then add some rows. */ { OsiSolverInterface * si = emptySi->clone(); int i; //Matrix int column[]={0,1,2}; double row1E[]={4.0,7.0,5.0}; double row2E[]={7.0,4.0,5.0}; CoinPackedVector row1(3,column,row1E); CoinPackedVector row2(3,column,row2E); double objective[]={5.0,6.0,5.5}; { // Add empty columns for (i=0;i<3;i++) { const CoinPackedVector reqdBySunCC ; si->addCol(reqdBySunCC,0.0,10.0,objective[i]) ; } // Add rows si->addRow(row1,2.0,100.0); si->addRow(row2,2.0,100.0); // Vol can not solve problem of this form if ( !volSolverInterface ) { // solve si->initialSolve(); OSIUNITTEST_ASSERT_ERROR(eq(si->getObjValue(),2.0), {}, solverName, "testAddToEmptySystem: getObjValue after adding empty columns"); } } delete si; } // Test adding rows to NULL - alternative row vector format { OsiSolverInterface * si = emptySi->clone(); int i; //Matrix int column[]={0,1,2,0,1,2}; double row1E[]={4.0,7.0,5.0}; double row2E[]={7.0,4.0,5.0}; double row12E[]={4.0,7.0,5.0,7.0,4.0,5.0}; int starts[]={0,3,6}; double ub[]={100.0,100.0}; double objective[]={5.0,6.0,5.5}; { // Add empty columns for (i=0;i<3;i++) { const CoinPackedVector reqdBySunCC ; si->addCol(reqdBySunCC,0.0,10.0,objective[i]) ; } // Add rows si->addRows(2,starts,column,row12E,NULL,ub); // and again si->addRow(3,column,row1E,2.0,100.0); si->addRow(3,column,row2E,2.0,100.0); // Vol can not solve problem of this form if ( !volSolverInterface ) { // solve si->initialSolve(); OSIUNITTEST_ASSERT_ERROR(eq(si->getObjValue(),2.0), {}, solverName, "testAddToEmptySystem: getObjValue after adding empty columns and then rows"); } } delete si; } /* Add columns to an empty system. Start by creating empty rows, then add some columns. */ { OsiSolverInterface * si = emptySi->clone(); int i; //Matrix int row[]={0,1}; double col1E[]={4.0,7.0}; double col2E[]={7.0,4.0}; double col3E[]={5.0,5.0}; CoinPackedVector col1(2,row,col1E); CoinPackedVector col2(2,row,col2E); CoinPackedVector col3(2,row,col3E); double objective[]={5.0,6.0,5.5}; { // Add empty rows for (i=0;i<2;i++) { const CoinPackedVector reqdBySunCC ; si->addRow(reqdBySunCC,2.0,100.0) ; } // Add columns if ( volSolverInterface ) { // FIXME: this test could be done w/ the volume, but the rows must not be ranged. OSIUNITTEST_ADD_OUTCOME(solverName, "testAddToEmptySystem", "addCol adds columns to NULL", TestOutcome::WARNING, true); failureMessage(solverName,"addCol add columns to null"); } else { si->addCol(col1,0.0,10.0,objective[0]); si->addCol(col2,0.0,10.0,objective[1]); si->addCol(col3,0.0,10.0,objective[2]); // solve si->initialSolve(); CoinRelFltEq eq(1.0e-7) ; OSIUNITTEST_ASSERT_ERROR(eq(si->getObjValue(),2.0), {}, solverName, "testAddToEmptySystem: getObjValue after adding empty rows and then columns"); } } delete si; } // Test adding columns to NULL - alternative column vector format { OsiSolverInterface * si = emptySi->clone(); int i; //Matrix int row[]={0,1}; double col1E[]={4.0,7.0}; double col23E[]={7.0,4.0,5.0,5.0}; int row23E[]={0,1,0,1}; int start23E[]={0,2,4}; double ub23E[]={10.0,10.0}; double objective[]={5.0,6.0,5.5}; { // Add empty rows for (i=0;i<2;i++) { const CoinPackedVector reqdBySunCC ; si->addRow(reqdBySunCC,2.0,100.0) ; } // Add columns if ( volSolverInterface ) { // FIXME: this test could be done w/ the volume, but the rows must not be ranged. OSIUNITTEST_ADD_OUTCOME(solverName, "testAddToEmptySystem", "addCol adds columns to NULL", TestOutcome::WARNING, true); } else { si->addCols(2,start23E,row23E,col23E,NULL,ub23E,objective+1); si->addCol(2,row,col1E,0.0,10.0,objective[0]); // solve si->initialSolve(); OSIUNITTEST_ASSERT_ERROR(eq(si->getObjValue(),2.0), {}, solverName, "testAddToEmptySystem: getObjValue after adding empty rows and then columns (alternative format)"); } } delete si; } } /* OsiPresolve has the property that it will report the correct (untransformed) objective for the presolved problem. Test OsiPresolve by checking the objective that we get by optimising the presolved problem. Then postsolve to get back to the original problem statement and check that we have the same objective without further iterations. This is much more a check on OsiPresolve than on the OsiXXX under test. OsiPresolve simply calls the underlying OsiXXX when it needs to solve a model. All the work involved with presolve and postsolve transforms is handled in OsiPresolve. The problems are a selection of problems from Data/Sample. In particular, e226 is in the list by virtue of having a constant offset (7.113) defined for the objective, and p0201 is in the list because presolve (as of 071015) finds no reductions. The objective for finnis (1.7279106559e+05) is not the same as the objective used by Netlib (1.7279096547e+05), but solvers clp, dylp, glpk, and cplex agree that it's correct. This test could be made stronger, but more brittle, by checking for the expected size of the constraint system after presolve. It would also be good to add a maximisation problem and check for signs of reduced costs and duals. Returns the number of errors encountered. */ int testOsiPresolve (const OsiSolverInterface *emptySi, const std::string &sampleDir) { typedef std::pair probPair ; std::vector sampleProbs ; sampleProbs.push_back(probPair("brandy",1.5185098965e+03)) ; sampleProbs.push_back(probPair("e226",(-18.751929066+7.113))) ; //#ifdef COIN_HAS_GRB // // for the demo license of Gurobi, model "finnis" is too large, so we skip it in this case // if( dynamic_cast(emptySi) && dynamic_cast(emptySi)->isDemoLicense() ) // std::cout << "Skip model finnis in test of OsiPresolve with Gurobi, since we seem to have only a demo license of Gurobi." << std::endl; // else //#endif sampleProbs.push_back(probPair("finnis",1.7279106559e+05)) ; sampleProbs.push_back(probPair("p0201",6875)) ; CoinRelFltEq eq(1.0e-8) ; int errs = 0 ; int warnings = 0; std::string solverName = "Unknown solver" ; OSIUNITTEST_ASSERT_ERROR(emptySi->getStrParam(OsiSolverName,solverName) == true, ++errs, solverName, "testOsiPresolve: getStrParam(OsiSolverName)"); std::cout << "Testing OsiPresolve ... " << std::endl ; for (unsigned i = 0 ; i < sampleProbs.size() ; i++) { OsiSolverInterface * si = emptySi->clone(); if (!si->setIntParam(OsiNameDiscipline,1)) std::cout << " attempt to switch to lazy names failed." ; std::string mpsName = sampleProbs[i].first ; double correctObj = sampleProbs[i].second ; std::cout << " testing presolve on " << mpsName << "." << std::endl ; std::string fn = sampleDir+mpsName ; OSIUNITTEST_ASSERT_ERROR(si->readMps(fn.c_str(),"mps") == 0, delete si; ++errs; continue, solverName, "testOsiPresolve: read MPS"); /* Set up for presolve. Allow very slight (1.0e-8) bound relaxation to retain feasibility. Discard integrality information (false) and limit the number of presolve passes to 5. */ OsiSolverInterface *presolvedModel ; OsiPresolve pinfo ; presolvedModel = pinfo.presolvedModel(*si,1.0e-8,false,5) ; OSIUNITTEST_ASSERT_ERROR(presolvedModel != NULL, delete si; ++errs; continue, solverName, "testOsiPresolve"); /* Optimise the presolved model and check the objective. We need to turn off any native presolve, which may or may not affect the objective. */ presolvedModel->setHintParam(OsiDoPresolveInInitial,false,OsiHintDo) ; presolvedModel->initialSolve() ; OSIUNITTEST_ASSERT_ERROR(eq(correctObj,presolvedModel->getObjValue()), delete si; ++errs; continue, solverName, "testOsiPresolve"); /* Postsolve to return to the original formulation. The presolvedModel should no longer be needed once we've executed postsolve. Check that we get the correct objective without iterations. As before, turn off any native presolve. */ pinfo.postsolve(true) ; delete presolvedModel ; si->setHintParam(OsiDoPresolveInResolve,false,OsiHintDo) ; si->resolve() ; OSIUNITTEST_ASSERT_ERROR(eq(correctObj,si->getObjValue()), ++errs, solverName, "testOsiPresolve: postsolve objective value"); OSIUNITTEST_ASSERT_WARNING(si->getIterationCount() == 0, ++warnings, solverName, "testOsiPresolve: postsolve number of iterations"); delete si ; } if (errs == 0) { std::cout << "OsiPresolve test ok with " << warnings << " warnings." << std::endl ; } else { failureMessage(solverName,"errors during OsiPresolve test.") ; } return (errs) ; } /* Test the values returned by an empty solver interface. */ void testEmptySi (const OsiSolverInterface *emptySi) { std::string solverName; const OsiSolverInterface *si = emptySi->clone() ; std::cout << "Testing empty solver interface ... " << std::endl ; si->getStrParam(OsiSolverName,solverName) ; OSIUNITTEST_ASSERT_ERROR(si->getNumRows() == 0, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getNumCols() == 0, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getNumElements() == 0, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getColLower() == NULL, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getColUpper() == NULL, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getColSolution() == NULL, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getObjCoefficients() == NULL, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getRowRange() == NULL, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getRightHandSide() == NULL, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getRowSense() == NULL, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getRowLower() == NULL, {}, solverName, "testEmptySi"); OSIUNITTEST_ASSERT_ERROR(si->getRowUpper() == NULL, {}, solverName, "testEmptySi"); delete si ; } /* This routine uses the problem galenet (included in Data/Sample) to check getDualRays. Galenet is a primal infeasible flow problem: s1: t14 <= 20 s2: t24 + t25 <= 20 s3: t35 <= 20 n4: t14 + t24 - t46 - t47 = 0 n5: t25 + t35 - t57 - t58 = 0 d6: t46 >= 10 d7: t47 + t57 >= 20 d8: t58 >= 30 t14,t58 <= 30 tt24, t57 <= 20 t25, t35, t46 <= 10 t47 <= 2 Galenet is the original form, with mixed explicit constraints and implicit bound constraints. Galenetbnds is the same problem, but with implicit bounds converted to explicit constraints and all constraints converted to inequalities so that the algebraic test still works. The routine doesn't actually test for specific dual rays; rather, it tests for rA >= 0 and rb < 0, on the assumption that the dual constraint system matches the canonical form min yb yA >= c. (More accurately, on the assumption that the sign convention of the ray is correct for the canonical form.) The strategy is to check first for the ability to return a ray with row and column components, then a ray with row components only. If both of these result in a throw, conclude that the solver does not implement getDualRays. */ void testDualRays (const OsiSolverInterface *emptySi, const std::string &sampleDir) { unsigned int rayNdx,raysReturned ; bool hasGetDualRays = false ; std::string solverName ; OsiSolverInterface *si = 0 ; std::vector rays ; const int raysRequested = 5 ; const std::string mpsNames[] = { "galenet", "galenetbnds" } ; const bool rayTypes[] = { true, false } ; std::cout << "Testing getDualRays ..." << std::endl ; /* Figure out what we can test. getDualRays only makes sense after solving a problem, so the strategy is to solve galenet and try for full rays. If that fails, solve galenetbnds and try for row-component rays. If that fails, conclude that the solver doesn't implement getDualRays. */ for (int iter = 0 ; iter <= 1 ; iter++) { const bool fullRay = rayTypes[iter] ; const std::string mpsName = mpsNames[iter] ; const std::string fn = sampleDir+mpsName ; si = emptySi->clone() ; si->getStrParam(OsiSolverName,solverName) ; std::cout << " checking if " << solverName << " implements getDualRays(maxRays" << ((fullRay == true)?",true":"") << ") ... " ; si->setIntParam(OsiNameDiscipline,1) ; OSIUNITTEST_ASSERT_ERROR(si->readMps(fn.c_str(),"mps") == 0, delete si; return, solverName, "testDualRays: read MPS"); /* Solve and report the result. We should be primal infeasible, and not optimal. Specify maximisation just for kicks. */ si->setObjSense(-1.0) ; si->setHintParam(OsiDoPresolveInInitial,false,OsiHintDo) ; si->setHintParam(OsiDoReducePrint,true,OsiHintDo) ; si->initialSolve() ; OSIUNITTEST_ASSERT_ERROR(!si->isProvenOptimal(), {}, solverName, "testDualRays: infeasible instance not proven optimal"); OSIUNITTEST_ASSERT_ERROR( si->isProvenPrimalInfeasible(), {}, solverName, "testDualRays: recognize infeasiblity of instance"); /* Try a call to getDualRays. If the call throws, abort this iteration and try again. */ try { rays = si->getDualRays(raysRequested,fullRay) ; hasGetDualRays = true ; std::cout << "yes." << std::endl ; } catch (CoinError& err) { std::cout << "no." << std::endl ; delete si ; si = 0 ; continue ; } /* We have rays. Check to see how many. There should be at least one, and no more than the number requested. If there are none, bail out now. */ raysReturned = static_cast(rays.size()) ; OSIUNITTEST_ASSERT_ERROR(raysReturned >= 1, break, solverName, "testDualRays: number of returned rays"); OSIUNITTEST_ASSERT_WARNING(static_cast(raysReturned) <= raysRequested, {}, solverName, "testDualRays: number of returned rays"); /* Do a bit of setup before checking each ray. If we're dealing with a full ray, we'll need variable bounds, solution value, and status. Acquire the bounds arrays, and acquire a warm start object so we can ask for column status. Failure to retrieve a warm start aborts the test. */ unsigned int m,n,i,j ; m = si->getNumRows() ; n = si->getNumCols() ; unsigned int rayLen = m ; CoinWarmStartBasis *wsb = 0 ; const double *vlbs= 0 ; const double *vubs = 0 ; const double *xvals = 0 ; const double *rhs = si->getRightHandSide() ; const char* sense = si->getRowSense(); if (fullRay == true) { rayLen += n ; wsb = dynamic_cast(si->getWarmStart()) ; OSIUNITTEST_ASSERT_ERROR(wsb != NULL, break, solverName, "testDualRays: get warmstart basis"); vlbs = si->getColLower() ; vubs = si->getColUpper() ; xvals = si->getColSolution() ; } double tol ; si->getDblParam(OsiDualTolerance,tol) ; double *rA = new double[rayLen] ; /* Open a loop to check each ray for validity. */ for (rayNdx = 0 ; rayNdx < raysReturned ; rayNdx++) { double *ray = rays[rayNdx] ; if (OsiUnitTest::verbosity >= 2) { std::cout << " Ray[" << rayNdx << "]: " << std::endl ; for (i = 0 ; i < m ; i++) { if (fabs(ray[i]) > tol) { std::cout << " " << si->getRowName(i) << " [" << i << "]: " << ray[i] << "\t rhs: " << rhs[i] << "\t sense: " << sense[i] << std::endl ; } } if (fullRay == true) { for (j = 0 ; j < n ; j++) { if (fabs(ray[m+j]) > tol) { std::cout << " " << si->getColName(j) << " [" << j << "]: " << ray[m+j] << std::endl ; } } } } /* Check that the ray is not identically zero. */ for (i = 0 ; i < rayLen ; i++) { if (fabs(ray[i]) > tol) break ; } OSIUNITTEST_ASSERT_ERROR(i < rayLen, continue, solverName, "testDualRays: ray should not be zero"); /* Check that dot(r,b) < 0. For the first m components this is a straightforward dot product. If we're dealing with column components, we need to synthesize the coefficient on-the-fly. There can be at most one nonzero associated with an out-of-bound basic primal, which corresponds to the nonbasic dual that's driving the ray. */ double rdotb = 0.0 ; int nzoobCnt = 0 ; for (i = 0 ; i < m ; i++) { rdotb += rhs[i]*ray[i] ; } if (fullRay == true) { CoinWarmStartBasis::Status statj ; for (j = 0 ; j < n ; j++) { statj = wsb->getStructStatus(j) ; switch (statj) { case CoinWarmStartBasis::atUpperBound: { rdotb += vubs[j]*ray[m+j] ; break ; } case CoinWarmStartBasis::atLowerBound: { rdotb += (-vlbs[j])*ray[m+j] ; break ; } case CoinWarmStartBasis::basic: { if (ray[m+j] != 0) { nzoobCnt++ ; OSIUNITTEST_ASSERT_ERROR(xvals[j] > vubs[j] || xvals[j] < vlbs[j], break, solverName, "testDualRays: xval outside bounds for nonzero ray entry"); if (xvals[j] > vubs[j]) { rdotb += vubs[j]*ray[m+j] ; } else if (xvals[j] < vlbs[j]) { rdotb += (-vlbs[j])*ray[m+j] ; } } break ; } default: { OSIUNITTEST_ASSERT_ERROR(fabs(ray[i]) <= tol, {}, solverName, "testDualRays: zero ray entry for basic variables"); break ; } } } OSIUNITTEST_ASSERT_ERROR(nzoobCnt <= 1, {}, solverName, "testDualRays: at most one nonzero ray entry for basic variables"); } if (OsiUnitTest::verbosity >= 2) std::cout << "dot(r,b) = " << rdotb << std::endl; OSIUNITTEST_ASSERT_ERROR(rdotb < 0, {}, solverName, "testDualRays: ray points into right direction"); /* On to rA >= 0. As with dot(r,b), it's trivially easy to do the calculation for explicit constraints, but we have to synthesize the coefficients corresponding to bounded variables on-the-fly. Upper bounds look like x <= u, lower bounds -x <= -l. No need to repeat the ray coefficient tests. */ CoinFillN(rA,m,0.0) ; si->getMatrixByCol()->transposeTimes(ray,rA) ; if (fullRay == true) { CoinWarmStartBasis::Status statj ; for (j = 0 ; j < n ; j++) { statj = wsb->getStructStatus(j) ; switch (statj) { case CoinWarmStartBasis::atUpperBound: { rA[j] += ray[m+j] ; break ; } case CoinWarmStartBasis::atLowerBound: { rA[j] += -ray[m+j] ; break ; } case CoinWarmStartBasis::basic: { if (ray[m+j] != 0) { if (xvals[j] > vubs[j]) rA[j] += ray[m+j] ; else if (xvals[j] < vlbs[j]) rA[j] += -ray[m+j] ; } break ; } default: { break ; } } } } bool badVal = false ; for (j = 0 ; j < n ; j++) { if (rA[j] < -tol) { std::cout << " " << solverName << ": ray[" << rayNdx << "] fails rA >= 0 for column " << j << " with value " << rA[j] << "." << std::endl; badVal = true ; } } OSIUNITTEST_ASSERT_ERROR(badVal == false, {}, solverName, "testDualRays: rA >= 0"); if (badVal == true && OsiUnitTest::verbosity >= 2) { std::cout << " Ray[" << rayNdx << "]: " << std::endl ; for (i = 0 ; i < m ; i++) { if (fabs(ray[i]) > tol) { std::cout << " [" << i << "]: " << ray[i] << std::endl ; } } } } /* Clean up. */ delete [] rA ; for (rayNdx = 0 ; rayNdx < raysReturned ; rayNdx++) { delete [] rays[rayNdx] ; } delete si ; } /* Report the result and we're done. */ OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(hasGetDualRays, {}, solverName, "testDualRays: getDualRays is implemented", TestOutcome::NOTE, false); if (hasGetDualRays == false) { testingMessage(" *** WARNING *** getDualRays is unimplemented.\n") ; } } } // end file-local namespace //############################################################################# // The main event //############################################################################# /* The order of tests should be examined. As it stands, we test immediately for the ability to read an mps file and bail if we can't do it. But quite a few tests could be performed without reading an mps file. -- lh, 080107 -- Gradually, oh so gradually, the Osi unit test is converting to produce some information about failed tests, and this routine now returns a count. Whenever you revise a test, please take the time to produce a count of errors. */ void OsiSolverInterfaceCommonUnitTest(const OsiSolverInterface* emptySi, const std::string & mpsDir, const std::string & /* netlibDir */) { CoinRelFltEq eq ; /* Test if the si knows its name. The name will be used for displaying messages when testing. */ std::string solverName ; { OsiSolverInterface *si = emptySi->clone() ; solverName = "Unknown Solver" ; OSIUNITTEST_ASSERT_ERROR(si->getStrParam(OsiSolverName,solverName), {}, solverName, "getStrParam(OsiSolverName) supported"); OSIUNITTEST_ASSERT_ERROR(solverName != "Unknown Solver", {}, solverName, "solver knows its name"); delete si ; } { std::string temp = ": running common unit tests.\n" ; temp = solverName + temp ; testingMessage(temp.c_str()) ; } /* Set a variable so we can easily determine which solver interface we're testing. This is so that we can easily decide to omit a test when it's beyond the capability of a solver. */ bool volSolverInterface UNUSED = (solverName == "vol"); bool dylpSolverInterface UNUSED = (solverName == "dylp"); bool glpkSolverInterface UNUSED = (solverName == "glpk"); bool xprSolverInterface UNUSED = (solverName == "xpress"); bool symSolverInterface UNUSED = (solverName == "sym"); bool grbSolverInterface UNUSED = (solverName == "gurobi"); bool cpxSolverInterface UNUSED = (solverName == "cplex"); bool spxSolverInterface UNUSED = (solverName == "soplex"); /* Test values returned by an empty solver interface. */ testEmptySi(emptySi) ; /* See if we can read an MPS file. We're dead in the water if we can't do this. */ std::string fn = mpsDir+"exmip1" ; OsiSolverInterface *exmip1Si = emptySi->clone() ; OSIUNITTEST_ASSERT_ERROR(exmip1Si->readMps(fn.c_str(),"mps") == 0, return, *exmip1Si, "read MPS file"); /* Test that the solver correctly handles row and column names. */ testNames(emptySi,fn) ; /* Test constants in objective function, dual and primal objective limit functions, objective sense (max/min). Do not perform test if Vol solver, because it requires problems of a special form and can not solve netlib e226. */ if ( !volSolverInterface ) { testObjFunctions(emptySi,mpsDir) ; } else { OSIUNITTEST_ADD_OUTCOME(solverName, "testObjFunctions", "skipped test for OsiVol", OsiUnitTest::TestOutcome::NOTE, true); } // Test that problem was loaded correctly { int nc = exmip1Si->getNumCols(); int nr = exmip1Si->getNumRows(); OSIUNITTEST_ASSERT_ERROR(nc == 8, return, *exmip1Si, "problem read correctly: number of columns"); OSIUNITTEST_ASSERT_ERROR(nr == 5, return, *exmip1Si, "problem read correctly: number of rows"); const char * exmip1Sirs = exmip1Si->getRowSense(); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[0]=='G', {}, *exmip1Si, "problem read correctly: row sense"); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[1]=='L', {}, *exmip1Si, "problem read correctly: row sense"); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[2]=='E', {}, *exmip1Si, "problem read correctly: row sense"); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[3]=='R', {}, *exmip1Si, "problem read correctly: row sense"); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[4]=='R', {}, *exmip1Si, "problem read correctly: row sense"); const double * exmip1Sirhs = exmip1Si->getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[0],2.5), {}, *exmip1Si, "problem read correctly: row rhs"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[1],2.1), {}, *exmip1Si, "problem read correctly: row rhs"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[2],4.0), {}, *exmip1Si, "problem read correctly: row rhs"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[3],5.0), {}, *exmip1Si, "problem read correctly: row rhs"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[4],15.), {}, *exmip1Si, "problem read correctly: row rhs"); const double * exmip1Sirr = exmip1Si->getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[0],0.0), {}, *exmip1Si, "problem read correctly: row range"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[1],0.0), {}, *exmip1Si, "problem read correctly: row range"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[2],0.0), {}, *exmip1Si, "problem read correctly: row range"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[3],5.0-1.8), {}, *exmip1Si, "problem read correctly: row range"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[4],15.0-3.0), {}, *exmip1Si, "problem read correctly: row range"); const CoinPackedMatrix *goldByCol = BuildExmip1Mtx() ; CoinPackedMatrix goldmtx ; goldmtx.reverseOrderedCopyOf(*goldByCol) ; delete goldByCol ; CoinPackedMatrix pm; pm.setExtraGap(0.0); pm.setExtraMajor(0.0); pm = *exmip1Si->getMatrixByRow(); pm.removeGaps(); OSIUNITTEST_ASSERT_ERROR(goldmtx.isEquivalent(pm), {}, *exmip1Si, "problem read correctly: matrix by row"); const double * cl = exmip1Si->getColLower(); OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, *exmip1Si, "problem read correctly: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, *exmip1Si, "problem read correctly: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[2],0.0), {}, *exmip1Si, "problem read correctly: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[3],0.0), {}, *exmip1Si, "problem read correctly: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[4],0.5), {}, *exmip1Si, "problem read correctly: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[5],0.0), {}, *exmip1Si, "problem read correctly: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[6],0.0), {}, *exmip1Si, "problem read correctly: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[7],0.0), {}, *exmip1Si, "problem read correctly: columns lower bounds"); const double * cu = exmip1Si->getColUpper(); OSIUNITTEST_ASSERT_ERROR(eq(cu[0],exmip1Si->getInfinity()), {}, *exmip1Si, "problem read correctly: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[1],4.1), {}, *exmip1Si, "problem read correctly: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[2],1.0), {}, *exmip1Si, "problem read correctly: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[3],1.0), {}, *exmip1Si, "problem read correctly: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[4],4.0), {}, *exmip1Si, "problem read correctly: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[5],exmip1Si->getInfinity()), {}, *exmip1Si, "problem read correctly: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[6],exmip1Si->getInfinity()), {}, *exmip1Si, "problem read correctly: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[7],4.3), {}, *exmip1Si, "problem read correctly: columns upper bounds"); const double * rl = exmip1Si->getRowLower(); OSIUNITTEST_ASSERT_ERROR(eq(rl[0],2.5), {}, *exmip1Si, "problem read correctly: rows lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(rl[1],-exmip1Si->getInfinity()), {}, *exmip1Si, "problem read correctly: rows lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(rl[2],4.0), {}, *exmip1Si, "problem read correctly: rows lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(rl[3],1.8), {}, *exmip1Si, "problem read correctly: rows lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(rl[4],3.0), {}, *exmip1Si, "problem read correctly: rows lower bounds"); const double * ru = exmip1Si->getRowUpper(); OSIUNITTEST_ASSERT_ERROR(eq(ru[0],exmip1Si->getInfinity()), {}, *exmip1Si, "problem read correctly: rows upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(ru[1],2.1), {}, *exmip1Si, "problem read correctly: rows upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(ru[2],4.0), {}, *exmip1Si, "problem read correctly: rows upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(ru[3],5.0), {}, *exmip1Si, "problem read correctly: rows upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(ru[4],15.), {}, *exmip1Si, "problem read correctly: rows upper bounds"); const double * objCoef = exmip1Si->getObjCoefficients(); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[0], 1.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[1], 0.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[2], 0.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[3], 0.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[4], 2.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[5], 0.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[6], 0.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[7],-1.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); // make sure col solution is something reasonable, // that is between upper and lower bounds const double * cs = exmip1Si->getColSolution(); int c; bool okColSol=true; //double inf = exmip1Si->getInfinity(); for ( c=0; c=inf ) okColSol=false; } OSIUNITTEST_ASSERT_WARNING(okColSol, {}, *exmip1Si, "column solution before solve"); // Test that objective value is correct // FIXME: the test checks the primal value. vol fails this, because vol // considers the dual value to be the objective value /* gurobi fails this, because gurobi does not have a solution before a model is solved (which makes sense, I (SV) think) Eh, well, you can argue the point, but the current OSI spec requires that there be a valid solution from the point that the problem is loaded. Nothing says it needs to be a good solution. -- lh, 100826 -- */ double correctObjValue = CoinPackedVector(nc,objCoef).dotProduct(cs); double siObjValue = exmip1Si->getObjValue(); OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(eq(correctObjValue,siObjValue), {}, *exmip1Si, "solution value before solve", TestOutcome::WARNING, solverName == "Vol"); } // Test matrixByCol method { const CoinPackedMatrix *goldmtx = BuildExmip1Mtx() ; OsiSolverInterface & si = *exmip1Si->clone(); CoinPackedMatrix sm = *si.getMatrixByCol(); sm.removeGaps(); OSIUNITTEST_ASSERT_ERROR(goldmtx->isEquivalent(sm), {}, solverName, "getMatrixByCol"); delete goldmtx ; // Test getting and setting of objective offset double objOffset; OSIUNITTEST_ASSERT_ERROR(si.getDblParam(OsiObjOffset,objOffset), {}, solverName, "getDblParam(OsiObjOffset)"); OSIUNITTEST_ASSERT_ERROR(eq(objOffset, 0.0), {}, solverName, "objective offset 0 for exmip1"); OSIUNITTEST_ASSERT_ERROR(si.setDblParam(OsiObjOffset,3.21), {}, solverName, "setDblParam(OsiObjOffset)"); si.getDblParam(OsiObjOffset,objOffset); OSIUNITTEST_ASSERT_ERROR(eq(objOffset, 3.21), {}, solverName, "storing objective offset"); delete &si; } // Test clone { OsiSolverInterface * si2; int ad = 13579; { OsiSolverInterface * si1 = exmip1Si->clone(); int ad = 13579; si1->setApplicationData(&ad); OSIUNITTEST_ASSERT_ERROR(*(static_cast(si1->getApplicationData())) == ad, {}, solverName, "storing application data"); si2 = si1->clone(); delete si1; } OSIUNITTEST_ASSERT_ERROR(*(static_cast(si2->getApplicationData())) == ad, {}, solverName, "cloning of application data"); int nc = si2->getNumCols(); int nr = si2->getNumRows(); OSIUNITTEST_ASSERT_ERROR(nc == 8, return, *exmip1Si, "problem cloned: number of columns"); OSIUNITTEST_ASSERT_ERROR(nr == 5, return, *exmip1Si, "problem cloned: number of rows"); const char * exmip1Sirs = si2->getRowSense(); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[0]=='G', {}, solverName, "problem cloned: row sense"); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[1]=='L', {}, solverName, "problem cloned: row sense"); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[2]=='E', {}, solverName, "problem cloned: row sense"); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[3]=='R', {}, solverName, "problem cloned: row sense"); OSIUNITTEST_ASSERT_ERROR(exmip1Sirs[4]=='R', {}, solverName, "problem cloned: row sense"); const double * exmip1Sirhs = si2->getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[0],2.5), {}, solverName, "problem cloned: row rhs"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[1],2.1), {}, solverName, "problem cloned: row rhs"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[2],4.0), {}, solverName, "problem cloned: row rhs"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[3],5.0), {}, solverName, "problem cloned: row rhs"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirhs[4],15.), {}, solverName, "problem cloned: row rhs"); const double * exmip1Sirr = si2->getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[0],0.0), {}, solverName, "problem cloned: row range"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[1],0.0), {}, solverName, "problem cloned: row range"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[2],0.0), {}, solverName, "problem cloned: row range"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[3],5.0-1.8), {}, solverName, "problem cloned: row range"); OSIUNITTEST_ASSERT_ERROR(eq(exmip1Sirr[4],15.0-3.0), {}, solverName, "problem cloned: row range"); const CoinPackedMatrix *goldByCol = BuildExmip1Mtx() ; CoinPackedMatrix goldmtx ; goldmtx.reverseOrderedCopyOf(*goldByCol) ; CoinPackedMatrix pm; pm.setExtraGap(0.0); pm.setExtraMajor(0.0); pm = *si2->getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(goldmtx.isEquivalent(pm), {}, solverName, "problem cloned: matrix by row"); delete goldByCol ; const double * cl = si2->getColLower(); OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, solverName, "problem cloned: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, solverName, "problem cloned: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[2],0.0), {}, solverName, "problem cloned: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[3],0.0), {}, solverName, "problem cloned: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[4],0.5), {}, solverName, "problem cloned: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[5],0.0), {}, solverName, "problem cloned: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[6],0.0), {}, solverName, "problem cloned: columns lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cl[7],0.0), {}, solverName, "problem cloned: columns lower bounds"); const double * cu = si2->getColUpper(); OSIUNITTEST_ASSERT_ERROR(eq(cu[0],exmip1Si->getInfinity()), {}, solverName, "problem cloned: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[1],4.1), {}, solverName, "problem cloned: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[2],1.0), {}, solverName, "problem cloned: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[3],1.0), {}, solverName, "problem cloned: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[4],4.0), {}, solverName, "problem cloned: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[5],exmip1Si->getInfinity()), {}, solverName, "problem cloned: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[6],exmip1Si->getInfinity()), {}, solverName, "problem cloned: columns upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(cu[7],4.3), {}, solverName, "problem cloned: columns upper bounds"); const double * rl = si2->getRowLower(); OSIUNITTEST_ASSERT_ERROR(eq(rl[0],2.5), {}, solverName, "problem cloned: rows lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(rl[1],-exmip1Si->getInfinity()), {}, solverName, "problem cloned: rows lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(rl[2],4.0), {}, solverName, "problem cloned: rows lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(rl[3],1.8), {}, solverName, "problem cloned: rows lower bounds"); OSIUNITTEST_ASSERT_ERROR(eq(rl[4],3.0), {}, solverName, "problem cloned: rows lower bounds"); const double * ru = si2->getRowUpper(); OSIUNITTEST_ASSERT_ERROR(eq(ru[0],exmip1Si->getInfinity()), {}, solverName, "problem cloned: rows upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(ru[1],2.1), {}, solverName, "problem cloned: rows upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(ru[2],4.0), {}, solverName, "problem cloned: rows upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(ru[3],5.0), {}, solverName, "problem cloned: rows upper bounds"); OSIUNITTEST_ASSERT_ERROR(eq(ru[4],15.), {}, solverName, "problem cloned: rows upper bounds"); const double * objCoef = exmip1Si->getObjCoefficients(); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[0], 1.0), {}, solverName, "problem cloned: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[1], 0.0), {}, solverName, "problem cloned: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[2], 0.0), {}, solverName, "problem cloned: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[3], 0.0), {}, solverName, "problem cloned: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[4], 2.0), {}, solverName, "problem cloned: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[5], 0.0), {}, solverName, "problem cloned: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[6], 0.0), {}, solverName, "problem cloned: objective coefficients"); OSIUNITTEST_ASSERT_ERROR(eq(objCoef[7],-1.0), {}, solverName, "problem cloned: objective coefficients"); // make sure col solution is something reasonable, // that is between upper and lower bounds const double * cs = exmip1Si->getColSolution(); int c; bool okColSol=true; //double inf = exmip1Si->getInfinity(); for ( c=0; c=inf ) okColSol=false; } OSIUNITTEST_ASSERT_WARNING(okColSol, {}, solverName, "problem cloned: column solution before solve"); // Test getting of objective offset double objOffset; OSIUNITTEST_ASSERT_ERROR(si2->getDblParam(OsiObjOffset,objOffset), {}, solverName, "problem cloned: getDblParam(OsiObjOffset)"); OSIUNITTEST_ASSERT_ERROR(eq(objOffset, 0.0), {}, solverName, "problem cloned: objective offset 0.0"); delete si2; } // end of clone testing // Test apply cuts method { OsiSolverInterface & im = *(exmip1Si->clone()); OsiCuts cuts; // Generate some cuts { // Get number of rows and columns in model int nr = im.getNumRows(); int nc = im.getNumCols(); OSIUNITTEST_ASSERT_ERROR(nr == 5, return, solverName, "apply cuts: number of rows"); OSIUNITTEST_ASSERT_ERROR(nc == 8, return, solverName, "apply cuts: number of columns"); // Generate a valid row cut from thin air int c; { int *inx = new int[nc]; for (c=0;c(c))*(static_cast(c)); OsiRowCut rc; rc.setRow(nc,inx,el); rc.setLb(-100.); rc.setUb(100.); rc.setEffectiveness(22); cuts.insert(rc); delete[]el; delete[]inx; } // Generate valid col cut from thin air { const double * oslColLB = im.getColLower(); const double * oslColUB = im.getColUpper(); int *inx = new int[nc]; for (c=0;csetEffectiveness(-1.); cuts.insert(rcP); OSIUNITTEST_ASSERT_ERROR(rcP == NULL, {}, solverName, "apply cuts: insert row cut keeps pointer"); OsiColCut * ccP= new OsiColCut; ccP->setEffectiveness(-12.); cuts.insert(ccP); OSIUNITTEST_ASSERT_ERROR(ccP == NULL, {}, solverName, "apply cuts: insert column cut keeps pointer"); } { //Generate inconsistent Row cut OsiRowCut rc; const int ne=1; int inx[ne]={-10}; double el[ne]={2.5}; rc.setRow(ne,inx,el); rc.setLb(3.); rc.setUb(4.); OSIUNITTEST_ASSERT_ERROR(!rc.consistent(), {}, solverName, "apply cuts: inconsistent row cut"); cuts.insert(rc); } { //Generate inconsistent col cut OsiColCut cc; const int ne=1; int inx[ne]={-10}; double el[ne]={2.5}; cc.setUbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(!cc.consistent(), {}, solverName, "apply cuts: inconsistent column cut"); cuts.insert(cc); } { // Generate row cut which is inconsistent for model m OsiRowCut rc; const int ne=1; int inx[ne]={10}; double el[ne]={2.5}; rc.setRow(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( rc.consistent(), {}, solverName, "apply cuts: row cut inconsistent for model only"); OSIUNITTEST_ASSERT_ERROR(!rc.consistent(im), {}, solverName, "apply cuts: row cut inconsistent for model only"); cuts.insert(rc); } { // Generate col cut which is inconsistent for model m OsiColCut cc; const int ne=1; int inx[ne]={30}; double el[ne]={2.0}; cc.setLbs(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( cc.consistent(), {}, solverName, "apply cuts: column cut inconsistent for model only"); OSIUNITTEST_ASSERT_ERROR(!cc.consistent(im), {}, solverName, "apply cuts: column cut inconsistent for model only"); cuts.insert(cc); } { // Generate col cut which is infeasible OsiColCut cc; const int ne=1; int inx[ne]={0}; double el[ne]={2.0}; cc.setUbs(ne,inx,el); cc.setEffectiveness(1000.); OSIUNITTEST_ASSERT_ERROR(cc.consistent(), {}, solverName, "apply cuts: column cut infeasible for model"); OSIUNITTEST_ASSERT_ERROR(cc.consistent(im), {}, solverName, "apply cuts: column cut infeasible for model"); OSIUNITTEST_ASSERT_ERROR(cc.infeasible(im), {}, solverName, "apply cuts: column cut infeasible for model"); cuts.insert(cc); } } OSIUNITTEST_ASSERT_ERROR(cuts.sizeRowCuts() == 4, {}, solverName, "apply cuts: number of stored row cuts"); OSIUNITTEST_ASSERT_ERROR(cuts.sizeColCuts() == 5, {}, solverName, "apply cuts: number of stored column cuts"); { OsiSolverInterface::ApplyCutsReturnCode rc = im.applyCuts(cuts); OSIUNITTEST_ASSERT_ERROR(rc.getNumIneffective() == 2, {}, solverName, "apply cuts: number of row cuts found ineffective"); OSIUNITTEST_ASSERT_ERROR(rc.getNumApplied() == 2, {}, solverName, "apply cuts: number of row cuts applied"); OSIUNITTEST_ASSERT_ERROR(rc.getNumInfeasible() == 1, {}, solverName, "apply cuts: number of row cuts found infeasible"); OSIUNITTEST_ASSERT_ERROR(rc.getNumInconsistentWrtIntegerModel() == 2, {}, solverName, "apply cuts: number of row cuts found inconsistent wr.t. integer model"); OSIUNITTEST_ASSERT_ERROR(rc.getNumInconsistent() == 2, {}, solverName, "apply cuts: number of row cuts found inconsistent"); OSIUNITTEST_ASSERT_ERROR(cuts.sizeCuts() == rc.getNumIneffective() + rc.getNumApplied() + rc.getNumInfeasible() + rc.getNumInconsistentWrtIntegerModel() + rc.getNumInconsistent(), {}, solverName, "apply cuts: consistent count of row cuts"); } delete &im; } // end of apply cut method testing /* Test setting primal (column) and row (dual) solutions, and test that reduced cost and row activity match. GUROBI does not support setting solutions (only basis can be set), so we skip this test. This is a failure of the implementation of OsiGrb. Most solvers do not allow you to simply set a solution by giving primal values, it needs to be handled in the OsiXXX. That's what OsiGrb should do. See longer rant where OsiGrb exposes Gurobi's inability to handle 'N' constraints. Here, run the tests and see the error messages. Shouldn't cause failure because we're not yet properly counting errors. -- lh, 100826 -- */ testSettingSolutions(*exmip1Si) ; // Test column type methods // skip for vol since it does not support this function if ( volSolverInterface ) { OSIUNITTEST_ADD_OUTCOME(solverName, "testing column type methods", "skipped test for OsiVol", TestOutcome::NOTE, true); } else { OsiSolverInterface & fim = *(emptySi->clone()); std::string fn = mpsDir+"exmip1"; fim.readMps(fn.c_str(),"mps"); // exmip1.mps has 2 integer variables with index 2 & 3 OSIUNITTEST_ASSERT_ERROR( fim.getNumIntegers() == 2, {}, solverName, "column type methods: number of integers"); OSIUNITTEST_ASSERT_ERROR( fim.isContinuous(0), {}, solverName, "column type methods: isContinuous"); OSIUNITTEST_ASSERT_ERROR( fim.isContinuous(1), {}, solverName, "column type methods: isContinuous"); OSIUNITTEST_ASSERT_ERROR(!fim.isContinuous(2), {}, solverName, "column type methods: isContinuous"); OSIUNITTEST_ASSERT_ERROR(!fim.isContinuous(3), {}, solverName, "column type methods: isContinuous"); OSIUNITTEST_ASSERT_ERROR( fim.isContinuous(4), {}, solverName, "column type methods: isContinuous"); OSIUNITTEST_ASSERT_ERROR(!fim.isInteger(0), {}, solverName, "column type methods: isInteger"); OSIUNITTEST_ASSERT_ERROR(!fim.isInteger(1), {}, solverName, "column type methods: isInteger"); OSIUNITTEST_ASSERT_ERROR( fim.isInteger(2), {}, solverName, "column type methods: isInteger"); OSIUNITTEST_ASSERT_ERROR( fim.isInteger(3), {}, solverName, "column type methods: isInteger"); OSIUNITTEST_ASSERT_ERROR(!fim.isInteger(4), {}, solverName, "column type methods: isInteger"); OSIUNITTEST_ASSERT_ERROR(!fim.isBinary(0), {}, solverName, "column type methods: isBinary"); OSIUNITTEST_ASSERT_ERROR(!fim.isBinary(1), {}, solverName, "column type methods: isBinary"); OSIUNITTEST_ASSERT_ERROR( fim.isBinary(2), {}, solverName, "column type methods: isBinary"); OSIUNITTEST_ASSERT_ERROR( fim.isBinary(3), {}, solverName, "column type methods: isBinary"); OSIUNITTEST_ASSERT_ERROR(!fim.isBinary(4), {}, solverName, "column type methods: isBinary"); OSIUNITTEST_ASSERT_ERROR(!fim.isIntegerNonBinary(0), {}, solverName, "column type methods: isIntegerNonBinary"); OSIUNITTEST_ASSERT_ERROR(!fim.isIntegerNonBinary(1), {}, solverName, "column type methods: isIntegerNonBinary"); OSIUNITTEST_ASSERT_ERROR(!fim.isIntegerNonBinary(2), {}, solverName, "column type methods: isIntegerNonBinary"); OSIUNITTEST_ASSERT_ERROR(!fim.isIntegerNonBinary(3), {}, solverName, "column type methods: isIntegerNonBinary"); OSIUNITTEST_ASSERT_ERROR(!fim.isIntegerNonBinary(4), {}, solverName, "column type methods: isIntegerNonBinary"); // Test fractionalIndices do { double sol[]={1.0, 2.0, 2.9, 3.0, 4.0,0.0,0.0,0.0}; fim.setColSolution(sol); OsiVectorInt fi = fim.getFractionalIndices(1e-5); OSIUNITTEST_ASSERT_ERROR(fi.size() == 1, break, solverName, "column type methods: getFractionalIndices"); OSIUNITTEST_ASSERT_ERROR(fi[0] == 2, {}, solverName, "column type methods: getFractionalIndices"); // Set integer variables very close to integer values sol[2]=5 + .00001/2.; sol[3]=8 - .00001/2.; fim.setColSolution(sol); fi = fim.getFractionalIndices(1e-5); OSIUNITTEST_ASSERT_ERROR(fi.size() == 0, {}, solverName, "column type methods: getFractionalIndices"); // Set integer variables close, but beyond tolerances sol[2]=5 + .00001*2.; sol[3]=8 - .00001*2.; fim.setColSolution(sol); fi = fim.getFractionalIndices(1e-5); OSIUNITTEST_ASSERT_ERROR(fi.size() == 2, break, solverName, "column type methods: getFractionalIndices"); OSIUNITTEST_ASSERT_ERROR(fi[0] == 2, {}, solverName, "column type methods: getFractionalIndices"); OSIUNITTEST_ASSERT_ERROR(fi[1] == 3, {}, solverName, "column type methods: getFractionalIndices"); } while(false); // Change data so column 2 & 3 are integerNonBinary fim.setColUpper(2,5.0); fim.setColUpper(3,6.0); OSIUNITTEST_ASSERT_ERROR(eq(fim.getColUpper()[2],5.0), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(eq(fim.getColUpper()[3],6.0), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(!fim.isBinary(0), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(!fim.isBinary(1), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(!fim.isBinary(2), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(!fim.isBinary(3), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(!fim.isBinary(4), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(fim.getNumIntegers() == 2, {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(!fim.isIntegerNonBinary(0), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(!fim.isIntegerNonBinary(1), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR( fim.isIntegerNonBinary(2), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR( fim.isIntegerNonBinary(3), {}, solverName, "column type methods: convert binary to integer variable"); OSIUNITTEST_ASSERT_ERROR(!fim.isIntegerNonBinary(4), {}, solverName, "column type methods: convert binary to integer variable"); delete &fim; } /* Test load and assign methods, and do an initialSolve while we have the problem loaded. This routine also puts some stress on cloning --- it creates nine simultaneous clones of the OSI under test. */ testLoadAndAssignProblem(emptySi,exmip1Si) ; testAddToEmptySystem(emptySi,volSolverInterface) ; /* Test write methods. */ testWriteMps(emptySi,fn) ; testWriteLp(emptySi,fn) ; /* Test the simplex portion of the OSI interface. */ testSimplexAPI(emptySi,mpsDir) ; // Add a Laci suggested test case // Load in a problem as column ordered matrix, // extract the row ordered copy, // add a row, // extract the row ordered copy again and test whether it's ok. // (the same can be done with reversing the role // of row and column ordered.) { OsiSolverInterface * si = emptySi->clone(); si->loadProblem( *(exmip1Si->getMatrixByCol()), exmip1Si->getColLower(), exmip1Si->getColUpper(), exmip1Si->getObjCoefficients(), exmip1Si->getRowSense(), exmip1Si->getRightHandSide(), exmip1Si->getRowRange() ); CoinPackedMatrix pm1 = *(si->getMatrixByRow()); // Get a row of the matrix to make a cut const CoinShallowPackedVector neededBySunCC = exmip1Si->getMatrixByRow()->getVector(1) ; CoinPackedVector pv = neededBySunCC ; pv.setElement(0,3.14*pv.getElements()[0]); OsiRowCut rc; rc.setRow( pv ); rc.setLb( exmip1Si->getRowLower()[1]-0.5 ); rc.setUb( exmip1Si->getRowUpper()[1]-0.5 ); OsiCuts cuts; cuts.insert(rc); si->applyCuts(cuts); CoinPackedMatrix pm2 = *(si->getMatrixByRow()); OSIUNITTEST_ASSERT_ERROR(pm1.getNumRows()==pm2.getNumRows()-1, {}, solverName, "switching from column to row ordering: added row"); int i; for( i=0; iclone(); si->loadProblem( *(exmip1Si->getMatrixByRow()), exmip1Si->getColLower(), exmip1Si->getColUpper(), exmip1Si->getObjCoefficients(), exmip1Si->getRowLower(), exmip1Si->getRowUpper() ); CoinPackedMatrix pm1 = *(si->getMatrixByCol()); // Get a row of the matrix to make a cut const CoinShallowPackedVector neededBySunCC = exmip1Si->getMatrixByRow()->getVector(1) ; CoinPackedVector pv = neededBySunCC ; pv.setElement(0,3.14*pv.getElements()[0]); OsiRowCut rc; rc.setRow( pv ); rc.setLb( exmip1Si->getRowLower()[1]-0.5 ); rc.setUb( exmip1Si->getRowUpper()[1]-0.5 ); OsiCuts cuts; cuts.insert(rc); si->applyCuts(cuts); CoinPackedMatrix pm2 = *(si->getMatrixByCol()); OSIUNITTEST_ASSERT_ERROR(pm1.isColOrdered(), {}, solverName, "switching from row to column ordering"); OSIUNITTEST_ASSERT_ERROR(pm2.isColOrdered(), {}, solverName, "switching from row to column ordering"); OSIUNITTEST_ASSERT_ERROR(pm1.getNumRows()==pm2.getNumRows()-1, {}, solverName, "switching from row to column ordering: added row"); CoinPackedMatrix pm1ByRow; pm1ByRow.reverseOrderedCopyOf(pm1); CoinPackedMatrix pm2ByRow; pm2ByRow.reverseOrderedCopyOf(pm2); OSIUNITTEST_ASSERT_ERROR(!pm1ByRow.isColOrdered(), {}, solverName, "switching from row to column ordering"); OSIUNITTEST_ASSERT_ERROR(!pm2ByRow.isColOrdered(), {}, solverName, "switching from row to column ordering"); OSIUNITTEST_ASSERT_ERROR(pm1ByRow.getNumRows() == pm2ByRow.getNumRows()-1, {}, solverName, "switching from row to column ordering"); OSIUNITTEST_ASSERT_ERROR(pm1.getNumRows() == pm1ByRow.getNumRows(), {}, solverName, "switching from row to column ordering"); OSIUNITTEST_ASSERT_ERROR(pm2.getNumRows() == pm2ByRow.getNumRows(), {}, solverName, "switching from row to column ordering"); int i; for( i=0; iclone(); int i; int ival; double dval; bool hint; OsiHintStrength hintStrength; OSIUNITTEST_ASSERT_ERROR(si->getIntParam (OsiLastIntParam, ival) == false, {}, solverName, "parameter methods: retrieve last int param"); OSIUNITTEST_ASSERT_ERROR(si->getDblParam (OsiLastDblParam, dval) == false, {}, solverName, "parameter methods: retrieve last double param"); OSIUNITTEST_ASSERT_ERROR(si->getHintParam(OsiLastHintParam, hint) == false, {}, solverName, "parameter methods: retrieve last hint param"); OSIUNITTEST_ASSERT_ERROR(si->setIntParam (OsiLastIntParam, 0) == false, {}, solverName, "parameter methods: set last int param"); OSIUNITTEST_ASSERT_ERROR(si->setDblParam (OsiLastDblParam, 0.0) == false, {}, solverName, "parameter methods: set last double param"); OSIUNITTEST_ASSERT_ERROR(si->setHintParam(OsiLastHintParam, false) == false, {}, solverName, "parameter methods: set last hint param"); bool param_ok = true; for (i = 0; i < OsiLastIntParam; ++i) { const bool exists = si->getIntParam(static_cast(i), ival); // existence and test should result in the same param_ok &= (!exists ^ testIntParam(si, i, -1)); param_ok &= (!exists ^ testIntParam(si, i, 0)); param_ok &= (!exists ^ testIntParam(si, i, 1)); param_ok &= (!exists ^ testIntParam(si, i, 9999999)); param_ok &= (!exists ^ testIntParam(si, i, COIN_INT_MAX)); if (exists) param_ok &= (si->getIntParam(static_cast(i), ival)); } OSIUNITTEST_ASSERT_ERROR(param_ok == true, {}, solverName, "parameter methods: test intparam"); param_ok = true; for (i = 0; i < OsiLastDblParam; ++i) { const bool exists = si->getDblParam(static_cast(i), dval); // existence and test should result in the same param_ok &= (!exists ^ testDblParam(si, i, -1e50)); param_ok &= (!exists ^ testDblParam(si, i, -1e10)); param_ok &= (!exists ^ testDblParam(si, i, -1)); param_ok &= (!exists ^ testDblParam(si, i, -1e-4)); param_ok &= (!exists ^ testDblParam(si, i, -1e-15)); param_ok &= (!exists ^ testDblParam(si, i, 1e50)); param_ok &= (!exists ^ testDblParam(si, i, 1e10)); param_ok &= (!exists ^ testDblParam(si, i, 1)); param_ok &= (!exists ^ testDblParam(si, i, 1e-4)); param_ok &= (!exists ^ testDblParam(si, i, 1e-15)); if (exists) param_ok &= (si->setDblParam(static_cast(i), dval)); } OSIUNITTEST_ASSERT_ERROR(param_ok == true, {}, solverName, "parameter methods: test dblparam"); // test hints --- see testHintParam for detailed explanation. { int throws = 0 ; param_ok = true; for (i = 0 ; i < OsiLastHintParam ; ++i) { const bool exists = si->getHintParam(static_cast(i),hint,hintStrength) ; param_ok &= (!exists ^ testHintParam(si,i,true,OsiHintIgnore,&throws)) ; param_ok &= (!exists ^ testHintParam(si,i,true,OsiHintTry,&throws)) ; param_ok &= (!exists ^ testHintParam(si,i,false,OsiHintTry,&throws)) ; param_ok &= (!exists ^ testHintParam(si,i,true,OsiHintDo,&throws)) ; param_ok &= (!exists ^ testHintParam(si,i,false,OsiHintDo,&throws)) ; param_ok &= (!exists ^ testHintParam(si,i,true,OsiForceDo,&throws)) ; param_ok &= (!exists ^ testHintParam(si,i,false,OsiForceDo,&throws)) ; } std::cout.flush() ; std::cerr << "Checked " << static_cast(OsiLastHintParam) << " hints x (true, false) at strength OsiForceDo; " << throws << " throws." << std::endl ; OSIUNITTEST_ASSERT_ERROR(param_ok == true, {}, solverName, "parameter methods: test hintparam"); } delete si; } /* A test to see if resolve gets the correct answer after changing the objective. Safe for Vol, as the result is checked by testing an interval on the primal solution. */ changeObjAndResolve(emptySi) ; /* Test OsiPresolve. This is a `bolt on' presolve, distinct from any presolve that might be innate to the solver. */ if ( !volSolverInterface && !symSolverInterface ) { testOsiPresolve(emptySi,mpsDir) ; } else { OSIUNITTEST_ADD_OUTCOME(solverName, "testOsiPresolved", "skipped test", OsiUnitTest::TestOutcome::NOTE, true); } /* Do a check to see if the solver returns the correct status for artificial variables. See the routine for detailed comments. Vol has no basis, hence no status. */ if (!volSolverInterface && !symSolverInterface) testArtifStatus(emptySi) ; else OSIUNITTEST_ADD_OUTCOME(solverName, "testArtifStatus", "skipped test", OsiUnitTest::TestOutcome::NOTE, true); // Perform tests that are embodied in functions if ( !volSolverInterface && !symSolverInterface) { typedef bool (*TestFunction)(OsiSolverInterface*); std::vector > test_functions; test_functions.push_back(std::pair(&test1VivianDeSmedt, "test1VivianDeSmedt")); test_functions.push_back(std::pair(&test2VivianDeSmedt, "test2VivianDeSmedt")); test_functions.push_back(std::pair(&test3VivianDeSmedt, "test3VivianDeSmedt")); test_functions.push_back(std::pair(&test4VivianDeSmedt, "test4VivianDeSmedt")); test_functions.push_back(std::pair(&test5VivianDeSmedt, "test5VivianDeSmedt")); test_functions.push_back(std::pair(&test6VivianDeSmedt, "test6VivianDeSmedt")); test_functions.push_back(std::pair(&test7VivianDeSmedt, "test7VivianDeSmedt")); test_functions.push_back(std::pair(&test8VivianDeSmedt, "test8VivianDeSmedt")); test_functions.push_back(std::pair(&test9VivianDeSmedt, "test9VivianDeSmedt")); test_functions.push_back(std::pair(&test10VivianDeSmedt,"test10VivianDeSmedt")); test_functions.push_back(std::pair(&test11VivianDeSmedt,"test11VivianDeSmedt")); test_functions.push_back(std::pair(&test12VivianDeSmedt,"test12VivianDeSmedt")); test_functions.push_back(std::pair(&test13VivianDeSmedt,"test13VivianDeSmedt")); test_functions.push_back(std::pair(&test14VivianDeSmedt,"test14VivianDeSmedt")); test_functions.push_back(std::pair(&test15VivianDeSmedt,"test15VivianDeSmedt")); test_functions.push_back(std::pair(&test16SebastianNowozin,"test16SebastianNowozin")); test_functions.push_back(std::pair(&test17SebastianNowozin,"test17SebastianNowozin")); unsigned int i; for (i = 0; i < test_functions.size(); ++i) { OsiSolverInterface *s = emptySi->clone(); const char * testName = test_functions[i].second; { bool test = test_functions[i].first(s); OSIUNITTEST_ASSERT_ERROR(test == true, {}, solverName, testName); } delete s; } } else OSIUNITTEST_ADD_OUTCOME(solverName, "test*VivianDeSmedt and test*SebastianNowozin", "skipped test", OsiUnitTest::TestOutcome::NOTE, true); /* Test duals and reduced costs, then dual rays. Vol doesn't react well to either test. */ if (!volSolverInterface && !symSolverInterface) { testReducedCosts(emptySi,mpsDir) ; testDualRays(emptySi,mpsDir) ; } else { OSIUNITTEST_ADD_OUTCOME(solverName, "testReducedCosts", "skipped test", OsiUnitTest::TestOutcome::NOTE, true); OSIUNITTEST_ADD_OUTCOME(solverName, "testDualRays", "skipped test", OsiUnitTest::TestOutcome::NOTE, true); } } /* Orphan comment? If anyone happens to poke at the code that this belongs to, move it. My (lh) guess is it should go somewhere in the deSmedt tests. I just haven't made time to check them all. And I really do want to find this. It'd be a great test case for the dual ray routine. With this matrix we have a primal/dual infeas problem. Leaving the first row makes it primal feas, leaving the first col makes it dual feas. All vars are >= 0 obj: -1 2 -3 4 -5 (min) 0 -1 0 0 -2 >= 1 1 0 -3 0 4 >= -2 0 3 0 -5 0 >= 3 0 0 5 0 -6 >= -4 2 -4 0 6 0 >= 5 */ CoinMP-1.8.3/Osi/src/OsiCommonTest/OsiCutsTest.cpp0000644000175000017500000002645411541753202020350 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "OsiUnitTests.hpp" #include "OsiCuts.hpp" //-------------------------------------------------------------------------- void OsiCutsUnitTest() { CoinRelFltEq eq; // Test default constructor { OsiCuts r; OSIUNITTEST_ASSERT_ERROR(r.colCutPtrs_.empty(), {}, "osicuts", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.rowCutPtrs_.empty(), {}, "osicuts", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.sizeColCuts() == 0, {}, "osicuts", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.sizeRowCuts() == 0, {}, "osicuts", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.sizeCuts() == 0, {}, "osicuts", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.mostEffectiveCutPtr() == NULL, {}, "osicuts", "default constructor"); } // Create some cuts OsiRowCut rcv[5]; OsiColCut ccv[5]; OsiCuts cuts; int i; for ( i=0; i<5; i++ ) { rcv[i].setEffectiveness(100.+i); ccv[i].setEffectiveness(200.+i); cuts.insert(rcv[i]); cuts.insert(ccv[i]); } OsiCuts rhs; { OsiCuts cs; // test inserting & accessing cut for ( i = 0; i < 5; i++ ) { OSIUNITTEST_ASSERT_ERROR(cs.sizeRowCuts() == i, {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(cs.sizeCuts() == 2*i, {}, "osicuts", "inserting and accessing cuts"); cs.insert(rcv[i]); OSIUNITTEST_ASSERT_ERROR(cs.sizeRowCuts() == i+1, {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(cs.sizeCuts() == 2*i+1, {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(cs.rowCut(i) == rcv[i], {}, "osicuts", "inserting and accessing cuts"); #if 0 const OsiCut * cp = cs.cutPtr(2*i); OSIUNITTEST_ASSERT_ERROR(cs.rowCut(i).effectiveness() == cp->effectiveness(), {}, "osicuts", "inserting and accessing cuts"); const OsiRowCut * rcP = dynamic_cast( cp ); OSIUNITTEST_ASSERT_ERROR(rcP != NULL, {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(*rcP == rcv[i], {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(dynamic_cast(cs.cutPtr(2*i)) == NULL, {}, "osicuts", "inserting and accessing cuts"); #endif OSIUNITTEST_ASSERT_ERROR(cs.sizeColCuts() == i, {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(cs.sizeCuts() == 2*i+1, {}, "osicuts", "inserting and accessing cuts"); cs.insert(ccv[i]); OSIUNITTEST_ASSERT_ERROR(cs.sizeColCuts() == i+1, {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(cs.sizeCuts() == 2*i+2, {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(cs.colCut(i) == ccv[i], {}, "osicuts", "inserting and accessing cuts"); #if 0 OSIUNITTEST_ASSERT_ERROR(dynamic_cast(cs.cutPtr(2*i+1)) == NULL, {}, "osicuts", "inserting and accessing cuts"); ccP = dynamic_cast( cs.cutPtr(2*i+1) ); OSIUNITTEST_ASSERT_ERROR(ccP != NULL, {}, "osicuts", "inserting and accessing cuts"); OSIUNITTEST_ASSERT_ERROR(*ccP == ccv[i], {}, "osicuts", "inserting and accessing cuts"); #endif OSIUNITTEST_ASSERT_ERROR(eq(cs.mostEffectiveCutPtr()->effectiveness(),200.0+i), {}, "osicuts", "inserting and accessing cuts"); } // Test inserting collection of OsiCuts { OsiCuts cs; cs.insert(cuts); OSIUNITTEST_ASSERT_ERROR(cs.sizeColCuts() == 5, {}, "osicuts", "inserting collection of cuts"); OSIUNITTEST_ASSERT_ERROR(cs.sizeRowCuts() == 5, {}, "osicuts", "inserting collection of cuts"); OSIUNITTEST_ASSERT_ERROR(cs.sizeCuts() == 10, {}, "osicuts", "inserting collection of cuts"); } /* Test handling of cut pointers. Create a vector of cut pointers, then add them to the collection. Dump the row cuts, then add again. The cut objects should be deleted when the OsiCuts object is deleted at the end of the block. This test should be monitored with some flavour of runtime access checking to be sure that cuts are not freed twice or not freed at all. */ { OsiCuts cs; OsiRowCut *rcPVec[5] ; OsiColCut *ccPVec[5] ; for (i = 0 ; i < 5 ; i++) { rcPVec[i] = rcv[i].clone() ; ccPVec[i] = ccv[i].clone() ; } // test inserting cut ptr & accessing cut for ( i=0; i<5; i++ ) { OSIUNITTEST_ASSERT_ERROR(cs.sizeRowCuts() == i, {}, "osicuts", "handling of cut pointers"); OsiRowCut * rcP = rcPVec[i] ; OSIUNITTEST_ASSERT_ERROR(rcP != NULL, {}, "osicuts", "handling of cut pointers"); cs.insert(rcP); OSIUNITTEST_ASSERT_ERROR(rcP == NULL, {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(cs.sizeRowCuts() == i+1, {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(cs.rowCut(i) == rcv[i], {}, "osicuts", "handling of cut pointers"); OsiColCut * ccP = ccPVec[i] ; OSIUNITTEST_ASSERT_ERROR(ccP != NULL, {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(cs.sizeColCuts() == i, {}, "osicuts", "handling of cut pointers"); cs.insert(ccP); OSIUNITTEST_ASSERT_ERROR(ccP == NULL, {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(cs.sizeColCuts() == i+1, {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(cs.colCut(i) == ccv[i], {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(eq(cs.mostEffectiveCutPtr()->effectiveness(),200.0+i), {}, "osicuts", "handling of cut pointers"); } cs.dumpCuts() ; // row cuts only for ( i=0; i<5; i++ ) { OSIUNITTEST_ASSERT_ERROR(cs.sizeRowCuts() == i, {}, "osicuts", "handling of cut pointers"); OsiRowCut * rcP = rcPVec[i] ; OSIUNITTEST_ASSERT_ERROR(rcP != NULL, {}, "osicuts", "handling of cut pointers"); cs.insert(rcP); OSIUNITTEST_ASSERT_ERROR(rcP == NULL, {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(cs.sizeRowCuts() == i+1, {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(cs.rowCut(i) == rcv[i], {}, "osicuts", "handling of cut pointers"); OSIUNITTEST_ASSERT_ERROR(cs.sizeColCuts() == 5, {}, "osicuts", "handling of cut pointers"); } } // Test copy constructor OsiCuts csC(cs); OSIUNITTEST_ASSERT_ERROR(csC.sizeRowCuts() == 5, {}, "osicuts", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(csC.sizeColCuts() == 5, {}, "osicuts", "copy constructor"); bool copy_ok = true; for ( i=0; i<5; i++ ) { copy_ok &= csC.rowCut(i) == rcv[i]; copy_ok &= csC.colCut(i) == ccv[i]; copy_ok &= csC.rowCut(i) == cs.rowCut(i); copy_ok &= csC.colCut(i) == cs.colCut(i);; } OSIUNITTEST_ASSERT_ERROR(copy_ok, {}, "osicuts", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(eq(csC.mostEffectiveCutPtr()->effectiveness(),204.0), {}, "osicuts", "copy constructor"); rhs = cs; } // Test results of assignment operation bool ok = true; for ( i=0; i<5; i++ ) { ok &= rhs.rowCut(i) == rcv[i]; ok &= rhs.colCut(i) == ccv[i]; } OSIUNITTEST_ASSERT_ERROR(ok, {}, "osicuts", "assignment operator"); OSIUNITTEST_ASSERT_ERROR(eq(rhs.mostEffectiveCutPtr()->effectiveness(),204.0), {}, "osicuts", "assignment operator"); // Test removing cuts { OsiCuts t(rhs); OSIUNITTEST_ASSERT_ERROR(t.sizeRowCuts() == 5, {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.sizeColCuts() == 5, {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(eq(rhs.mostEffectiveCutPtr()->effectiveness(),204.0), {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(eq( t.mostEffectiveCutPtr()->effectiveness(),204.0), {}, "osicuts", "removing cuts"); t.eraseRowCut(3); OSIUNITTEST_ASSERT_ERROR(t.sizeRowCuts() == 4, {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.sizeColCuts() == 5, {}, "osicuts", "removing cuts"); bool ok = true; for ( i=0; i<5; i++ ) ok &= t.colCut(i) == ccv[i]; OSIUNITTEST_ASSERT_ERROR(ok, {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.rowCut(0) == rcv[0], {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.rowCut(1) == rcv[1], {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.rowCut(2) == rcv[2], {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.rowCut(3) == rcv[4], {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(eq(t.mostEffectiveCutPtr()->effectiveness(),204.0), {}, "osicuts", "removing cuts"); t.eraseColCut(4); OSIUNITTEST_ASSERT_ERROR(t.sizeRowCuts() == 4, {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.sizeColCuts() == 4, {}, "osicuts", "removing cuts"); ok = true; for ( i=0; i<4; i++ ) ok &= t.colCut(i) == ccv[i]; OSIUNITTEST_ASSERT_ERROR(ok, {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.rowCut(0) == rcv[0], {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.rowCut(1) == rcv[1], {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.rowCut(2) == rcv[2], {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(t.rowCut(3) == rcv[4], {}, "osicuts", "removing cuts"); OSIUNITTEST_ASSERT_ERROR(eq(t.mostEffectiveCutPtr()->effectiveness(),203.0), {}, "osicuts", "removing cuts"); } // sorting cuts { OsiCuts t(rhs); OSIUNITTEST_ASSERT_ERROR(t.sizeRowCuts() == 5, {}, "osicuts", "sorting cuts"); OSIUNITTEST_ASSERT_ERROR(t.sizeColCuts() == 5, {}, "osicuts", "sorting cuts"); t.rowCut(0).setEffectiveness(9.); t.rowCut(1).setEffectiveness(1.); t.rowCut(2).setEffectiveness(7.); t.rowCut(3).setEffectiveness(3.); t.rowCut(4).setEffectiveness(5.); t.colCut(0).setEffectiveness(2.); t.colCut(1).setEffectiveness(8.); t.colCut(2).setEffectiveness(4.); t.colCut(3).setEffectiveness(6.); t.colCut(4).setEffectiveness(.5); double totEff=1.+2.+3.+4.+5.+6.+7.+8.+9.+0.5; { // Test iterator over all cuts double sumEff=0.; for ( OsiCuts::iterator it=t.begin(); it!=t.end(); ++it ) { double eff=(*it)->effectiveness(); sumEff+= eff; } OSIUNITTEST_ASSERT_ERROR(sumEff == totEff, {}, "osicuts", "sorting cuts"); } t.sort(); bool colcutsort_ok = true; for ( i=1; i<5; i++ ) colcutsort_ok &= t.colCut(i-1)>t.colCut(i); OSIUNITTEST_ASSERT_ERROR(colcutsort_ok, {}, "osicuts", "sorting cuts"); bool rowcutsort_ok = true; for ( i=1; i<5; i++ ) rowcutsort_ok &= t.rowCut(i-1)>t.rowCut(i); OSIUNITTEST_ASSERT_ERROR(rowcutsort_ok, {}, "osicuts", "sorting cuts"); { // Test iterator over all cuts double sumEff=0.; for ( OsiCuts::iterator it=t.begin(); it!=t.end(); ++it ) { sumEff+= (*it)->effectiveness(); } OSIUNITTEST_ASSERT_ERROR(sumEff == totEff, {}, "osicuts", "sorting cuts"); } { OsiCuts::iterator it=t.begin(); OsiCut * cm1 = *it; ++it; bool sort_ok = true; for( ; it!=t.end(); it++ ) { OsiCut * c = *it; sort_ok &= (*cm1)>(*c); cm1 = c; } OSIUNITTEST_ASSERT_ERROR(sort_ok, {}, "osicuts", "sorting cuts"); } } } CoinMP-1.8.3/Osi/src/OsiCommonTest/OsiRowCutTest.cpp0000644000175000017500000003314411556575357020672 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "OsiUnitTests.hpp" #include "OsiRowCut.hpp" #include "CoinFloatEqual.hpp" //-------------------------------------------------------------------------- void OsiRowCutUnitTest(const OsiSolverInterface * baseSiP, const std::string & mpsDir) { CoinRelFltEq eq; // Test default constructor { OsiRowCut r; OSIUNITTEST_ASSERT_ERROR(r.row_.getIndices() == NULL, {}, "osirowcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.row_.getElements() == NULL, {}, "osirowcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.row_.getNumElements() == 0, {}, "osirowcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.lb_ == -COIN_DBL_MAX, {}, "osirowcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.ub_ == COIN_DBL_MAX, {}, "osirowcut", "default constructor"); OSIUNITTEST_ASSERT_ERROR(r.effectiveness() == 0.0, {}, "osirowcut", "default constructor"); } // Test set and get methods const int ne = 4; int inx[ne] = { 1, 3, 4, 7 }; double el[ne] = { 1.2, 3.4, 5.6, 7.8 }; { OsiRowCut r; // Test setting getting bounds r.setLb(65.432); r.setUb(123.45); OSIUNITTEST_ASSERT_ERROR(r.lb() == 65.432, {}, "osirowcut", "set bounds"); OSIUNITTEST_ASSERT_ERROR(r.ub() == 123.45, {}, "osirowcut", "set bounds"); // Test setting/getting of effectiveness,timesUsed,timesTested r.setEffectiveness(45.); OSIUNITTEST_ASSERT_ERROR(r.effectiveness() == 45.0, {}, "osirowcut", "set effectivenesss"); // Test setting/getting elements with int* & float* vectors r.setRow( ne, inx, el ); OSIUNITTEST_ASSERT_ERROR(r.row().getNumElements() == ne, return, "osirowcut", "set row"); bool row_ok = true; for ( int i=0; i rc), {}, "osirowcut", "operator >"); OSIUNITTEST_ASSERT_ERROR(!(rc > c), {}, "osirowcut", "operator >"); } { OsiRowCut c(rc); const int ne1 = 4; int inx1[ne] = { 1, 3, 4, 7 }; double el1[ne] = { 1.2, 3.4, 5.6, 7.9 }; c.setRow(ne1,inx1,el1); OSIUNITTEST_ASSERT_ERROR(!(c == rc), {}, "osirowcut", "operator =="); OSIUNITTEST_ASSERT_ERROR( c != rc , {}, "osirowcut", "operator !="); OSIUNITTEST_ASSERT_ERROR(!(rc < c), {}, "osirowcut", "operator <"); } { OsiRowCut c(rc); c.setEffectiveness(3.); OSIUNITTEST_ASSERT_ERROR(!(c == rc), {}, "osirowcut", "operator =="); OSIUNITTEST_ASSERT_ERROR( c != rc , {}, "osirowcut", "operator !="); OSIUNITTEST_ASSERT_ERROR(!(c < rc), {}, "osirowcut", "operator <"); OSIUNITTEST_ASSERT_ERROR( (rc < c), {}, "osirowcut", "operator <"); OSIUNITTEST_ASSERT_ERROR( (c > rc), {}, "osirowcut", "operator >"); OSIUNITTEST_ASSERT_ERROR(!(rc > c), {}, "osirowcut", "operator >"); } { OsiRowCut c(rc); c.setLb(4.0); OSIUNITTEST_ASSERT_ERROR(!(c == rc), {}, "osirowcut", "operator =="); OSIUNITTEST_ASSERT_ERROR( c != rc , {}, "osirowcut", "operator !="); } { OsiRowCut c(rc); c.setUb(5.0); OSIUNITTEST_ASSERT_ERROR(!(c == rc), {}, "osirowcut", "operator =="); OSIUNITTEST_ASSERT_ERROR( c != rc , {}, "osirowcut", "operator !="); } } #ifndef COIN_NOTEST_DUPLICATE { // Test consistent OsiSolverInterface * imP = baseSiP->clone(); std::string fn = mpsDir+"exmip1"; OSIUNITTEST_ASSERT_ERROR(imP->readMps(fn.c_str(),"mps") == 0, {}, "osirowcut", "read MPS"); OsiRowCut c; const int ne = 3; int inx[ne] = { -1, 5, 4 }; double el[ne] = { 1., 1., 1. }; c.setRow(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(!c.consistent(), {}, "osirowcut", "consistent"); inx[0]=5; #if 0 c.setRow(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(!c.consistent(), {}, "osirowcut", "consistent"); #else bool errorThrown = false; try { c.setRow(ne,inx,el); } catch (CoinError e) { errorThrown = true; } OSIUNITTEST_ASSERT_ERROR(errorThrown == true, {}, "osirowcut", "duplicate entries"); #endif inx[0]=3; c.setRow(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(c.consistent(), {}, "osirowcut", "consistent"); c.setLb(5.); c.setUb(5.); OSIUNITTEST_ASSERT_ERROR(c.consistent(), {}, "osirowcut", "consistent"); c.setLb(5.5); OSIUNITTEST_ASSERT_ERROR(c.consistent(), {}, "osirowcut", "consistent"); OSIUNITTEST_ASSERT_ERROR(c.infeasible(*imP), {}, "osirowcut", "infeasible"); delete imP; } #endif { // Test consistent(IntegerModel) method. OsiSolverInterface * imP = baseSiP->clone(); std::string fn = mpsDir+"exmip1"; OSIUNITTEST_ASSERT_ERROR(imP->readMps(fn.c_str(),"mps") == 0, {}, "osirowcut", "read MPS"); OsiRowCut cut; const int ne = 3; int inx[ne] = { 3, 5, 4 }; double el[ne] = { 1., 1., 1. }; cut.setRow(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(cut.consistent(), {}, "osirowcut", "consistent"); inx[0]=7; cut.setRow(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(cut.consistent(*imP), {}, "osirowcut", "consistent(IntegerModel)"); inx[0]=8; cut.setRow(ne,inx,el); OSIUNITTEST_ASSERT_ERROR( cut.consistent(), {}, "osirowcut", "consistent(IntegerModel)"); OSIUNITTEST_ASSERT_ERROR(!cut.consistent(*imP), {}, "osirowcut", "consistent(IntegerModel)"); delete imP; } { //Test infeasible(im) method OsiSolverInterface * imP = baseSiP->clone(); std::string fn = mpsDir+"exmip1"; OSIUNITTEST_ASSERT_ERROR(imP->readMps(fn.c_str(),"mps") == 0, {}, "osirowcut", "read MPS"); OsiRowCut cut; const int ne = 3; int inx[ne] = { 3, 5, 4 }; double el[ne] = { 1., 1., 1. }; cut.setRow(ne,inx,el); OSIUNITTEST_ASSERT_ERROR(!cut.infeasible(*imP), {}, "osirowcut", "infeasible(IntegerModel)"); OsiRowCut c1; OSIUNITTEST_ASSERT_ERROR(!c1.infeasible(*imP), {}, "osirowcut", "infeasible(IntegerModel)"); OSIUNITTEST_ASSERT_ERROR( c1.consistent(), {}, "osirowcut", "consistent"); OSIUNITTEST_ASSERT_ERROR( c1.consistent(*imP), {}, "osirowcut", "consistent(IntegerModel)"); delete imP; } { //Test violation double solution[]={1.0,1.0,1.0,2.0,2.0,2.0}; OsiRowCut cut; const int ne = 3; int inx[ne] = { 3, 5, 4 }; double el[ne] = { 1., 1., 1. }; cut.setRow(ne,inx,el); cut.setUb(5.); OSIUNITTEST_ASSERT_ERROR(cut.violated(solution), {}, "osirowcut", "violation"); cut.setLb(5.); cut.setUb(10.); OSIUNITTEST_ASSERT_ERROR(!cut.violated(solution), {}, "osirowcut", "violation"); cut.setLb(6.1); OSIUNITTEST_ASSERT_ERROR( cut.violated(solution), {}, "osirowcut", "violation"); } } CoinMP-1.8.3/Osi/src/Osi/0000755000175000017500000000000012600453455013373 5ustar renereneCoinMP-1.8.3/Osi/src/Osi/Makefile.in0000644000175000017500000006232512506051753015450 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2010 Lou Hafer # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Lou Hafer SFU 2010-07-29 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/Osi DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/config_osi.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h config_osi.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libOsi_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) am_libOsi_la_OBJECTS = OsiAuxInfo.lo OsiBranchingObject.lo \ OsiChooseVariable.lo OsiColCut.lo OsiCut.lo OsiCuts.lo \ OsiNames.lo OsiPresolve.lo OsiRowCut.lo OsiRowCutDebugger.lo \ OsiSolverBranch.lo OsiSolverInterface.lo libOsi_la_OBJECTS = $(am_libOsi_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsi_la_SOURCES) DIST_SOURCES = $(libOsi_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsi # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in $libdir lib_LTLIBRARIES = libOsi.la # List all source files for this library, including headers libOsi_la_SOURCES = \ OsiConfig.h \ OsiAuxInfo.cpp OsiAuxInfo.hpp \ OsiBranchingObject.cpp OsiBranchingObject.hpp \ OsiChooseVariable.cpp OsiChooseVariable.hpp \ OsiColCut.cpp OsiColCut.hpp \ OsiCollections.hpp \ OsiCut.cpp OsiCut.hpp \ OsiCuts.cpp OsiCuts.hpp \ OsiNames.cpp \ OsiPresolve.cpp OsiPresolve.hpp \ OsiRowCut.cpp OsiRowCut.hpp \ OsiRowCutDebugger.cpp OsiRowCutDebugger.hpp \ OsiSolverBranch.cpp OsiSolverBranch.hpp \ OsiSolverInterface.cpp OsiSolverInterface.hpp \ OsiSolverParameters.hpp # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libOsi_la_LIBADD = $(OSILIB_LIBS) # This is for libtool libOsi_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags. AM_CPPFLAGS = $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation. # This "cygpath" stuff is necessary to compile with native compilers on Windows. DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'includedir/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ OsiAuxInfo.hpp \ OsiBranchingObject.hpp \ OsiChooseVariable.hpp \ OsiColCut.hpp \ OsiCollections.hpp \ OsiCut.hpp \ OsiCuts.hpp \ OsiPresolve.hpp \ OsiRowCut.hpp \ OsiRowCutDebugger.hpp \ OsiSolverBranch.hpp \ OsiSolverInterface.hpp \ OsiSolverParameters.hpp all: config.h config_osi.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/Osi/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Osi/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/Osi/config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ config_osi.h: stamp-h2 @if test ! -f $@; then \ rm -f stamp-h2; \ $(MAKE) stamp-h2; \ else :; fi stamp-h2: $(srcdir)/config_osi.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status src/Osi/config_osi.h distclean-hdr: -rm -f config.h stamp-h1 config_osi.h stamp-h2 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsi.la: $(libOsi_la_OBJECTS) $(libOsi_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsi_la_LDFLAGS) $(libOsi_la_OBJECTS) $(libOsi_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiAuxInfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiBranchingObject.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiChooseVariable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiColCut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiCut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiCuts.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiNames.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiPresolve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiRowCut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiRowCutDebugger.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiSolverBranch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiSolverInterface.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in config_osi.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_osi.h.in $(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; } \ END { 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) config.h.in config_osi.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_osi.h.in $(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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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) config.h config_osi.h installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-exec-local install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am \ install-exec-local install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local install-exec-local: $(install_sh_DATA) config_osi.h $(DESTDIR)$(includecoindir)/OsiConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/OsiConfig.h # 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: CoinMP-1.8.3/Osi/src/Osi/OsiRowCut.cpp0000644000175000017500000002112211556575357016012 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include "CoinPragma.hpp" #include "CoinFinite.hpp" #include "OsiRowCut.hpp" #ifndef OSI_INLINE_ROWCUT_METHODS // //------------------------------------------------------------------- // // Set/Get lower & upper bounds // //------------------------------------------------------------------- double OsiRowCut::lb() const { return lb_; } void OsiRowCut::setLb(double lb) { lb_ = lb; } double OsiRowCut::ub() const { return ub_; } void OsiRowCut::setUb(double ub) { ub_ = ub; } //------------------------------------------------------------------- // Set row elements //------------------------------------------------------------------- void OsiRowCut::setRow(int size, const int* colIndices, const double* elements, bool testForDuplicateIndex) { row_.setVector(size, colIndices, elements, testForDuplicateIndex); } void OsiRowCut::setRow( const CoinPackedVector & v ) { row_ = v; } //------------------------------------------------------------------- // Get the row //------------------------------------------------------------------- const CoinPackedVector & OsiRowCut::row() const { return row_; } //------------------------------------------------------------------- // Get the row for changing //------------------------------------------------------------------- CoinPackedVector & OsiRowCut::mutableRow() { return row_; } //---------------------------------------------------------------- // == operator //------------------------------------------------------------------- bool OsiRowCut::operator==(const OsiRowCut& rhs) const { if ( this->OsiCut::operator!=(rhs) ) return false; if ( row() != rhs.row() ) return false; if ( lb() != rhs.lb() ) return false; if ( ub() != rhs.ub() ) return false; return true; } bool OsiRowCut::operator!=(const OsiRowCut& rhs) const { return !( (*this)==rhs ); } //---------------------------------------------------------------- // consistent & infeasible //------------------------------------------------------------------- bool OsiRowCut::consistent() const { const CoinPackedVector& r = row(); r.duplicateIndex("consistent", "OsiRowCut"); if ( r.getMinIndex() < 0 ) return false; return true; } bool OsiRowCut::consistent(const OsiSolverInterface& im) const { const CoinPackedVector& r = row(); if ( r.getMaxIndex() >= im.getNumCols() ) return false; return true; } bool OsiRowCut::infeasible(const OsiSolverInterface &) const { if ( lb() > ub() ) return true; return false; } #endif /* Returns infeasibility of the cut with respect to solution passed in i.e. is positive if cuts off that solution. solution is getNumCols() long.. */ double OsiRowCut::violated(const double * solution) const { int i; double sum = 0.0; const int* column = row_.getIndices(); int number = row_.getNumElements(); const double* element = row_.getElements(); for ( i = 0; i < number; i++ ) { int colIndx = column[i]; sum += solution[colIndx] * element[i]; } if ( sum > ub_ ) return sum-ub_; else if ( sum < lb_ ) return lb_-sum; else return 0.0; } //------------------------------------------------------------------- // Row sense, rhs, range //------------------------------------------------------------------- char OsiRowCut::sense() const { if ( lb_ == ub_ ) return 'E'; else if ( lb_ == -COIN_DBL_MAX && ub_ == COIN_DBL_MAX ) return 'N'; else if ( lb_ == -COIN_DBL_MAX ) return 'L'; else if ( ub_ == COIN_DBL_MAX ) return 'G'; else return 'R'; } double OsiRowCut::rhs() const { if ( lb_ == ub_ ) return ub_; else if ( lb_ == -COIN_DBL_MAX && ub_ == COIN_DBL_MAX ) return 0.0; else if ( lb_ == -COIN_DBL_MAX ) return ub_; else if ( ub_ == COIN_DBL_MAX ) return lb_; else return ub_; } double OsiRowCut::range() const { if ( lb_ == ub_ ) return 0.0; else if ( lb_ == -COIN_DBL_MAX && ub_ == COIN_DBL_MAX ) return 0.0; else if ( lb_ == -COIN_DBL_MAX ) return 0.0; else if ( ub_ == COIN_DBL_MAX ) return 0.0; else return ub_ - lb_; } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiRowCut::OsiRowCut () : OsiCut(), row_(), lb_(-COIN_DBL_MAX), ub_( COIN_DBL_MAX) { //#ifdef NDEBUG //row_.setTestForDuplicateIndex(false); //#endif } //------------------------------------------------------------------- // Ownership constructor //------------------------------------------------------------------- OsiRowCut::OsiRowCut(double cutlb, double cutub, int capacity, int size, int *&colIndices, double *&elements): OsiCut(), row_(capacity, size, colIndices, elements), lb_(cutlb), ub_(cutub) {} //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiRowCut::OsiRowCut (const OsiRowCut & source) : OsiCut(source), row_(source.row_), lb_(source.lb_), ub_(source.ub_) { // Nothing to do here } //---------------------------------------------------------------- // Clone //---------------------------------------------------------------- OsiRowCut * OsiRowCut::clone() const { return (new OsiRowCut(*this)); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiRowCut::~OsiRowCut () { // Nothing to do here } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiRowCut & OsiRowCut::operator=(const OsiRowCut& rhs) { if ( this != &rhs ) { OsiCut::operator=(rhs); row_ = rhs.row_; lb_ = rhs.lb_; ub_ = rhs.ub_; } return *this; } //---------------------------------------------------------------- // Print //------------------------------------------------------------------- void OsiRowCut::print() const { int i; std::cout << "Row cut has " << row_.getNumElements() << " elements"; if ( lb_ < -1.0e20 && ub_<1.0e20 ) std::cout << " with upper rhs of " << ub_; else if ( lb_ > -1.0e20 && ub_ > 1.0e20 ) std::cout << " with lower rhs of " << lb_; else std::cout << " !!! with lower, upper rhs of " << lb_ << " and " << ub_; std::cout << std::endl; for ( i = 0; i < row_.getNumElements(); i++ ) { int colIndx = row_.getIndices()[i]; double element = row_.getElements()[i]; if ( i > 0 && element > 0 ) std::cout << " +"; std::cout << element << " * x" << colIndx << " "; } std::cout << std::endl; } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiRowCut2::OsiRowCut2(int row) : OsiRowCut(), whichRow_(row) { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiRowCut2::OsiRowCut2(const OsiRowCut2 & source) : OsiRowCut(source), whichRow_(source.whichRow_) { // Nothing to do here } //---------------------------------------------------------------- // Clone //---------------------------------------------------------------- OsiRowCut * OsiRowCut2::clone() const { return (new OsiRowCut2(*this)); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiRowCut2::~OsiRowCut2 () { // Nothing to do here } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiRowCut2 & OsiRowCut2::operator=(const OsiRowCut2& rhs) { if ( this != &rhs ) { OsiRowCut::operator = (rhs); whichRow_ = rhs.whichRow_; } return *this; } CoinMP-1.8.3/Osi/src/Osi/OsiBranchingObject.hpp0000644000175000017500000007551412101340333017577 0ustar renerene// Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiBranchingObject_H #define OsiBranchingObject_H #include #include #include #include "CoinError.hpp" #include "CoinTypes.hpp" class OsiSolverInterface; class OsiSolverBranch; class OsiBranchingObject; class OsiBranchingInformation; //############################################################################# //This contains the abstract base class for an object and for branching. //It also contains a simple integer class //############################################################################# /** Abstract base class for `objects'. The branching model used in Osi is based on the idea of an object. In the abstract, an object is something that has a feasible region, can be evaluated for infeasibility, can be branched on (i.e., there's some constructive action to be taken to move toward feasibility), and allows comparison of the effect of branching. This class (OsiObject) is the base class for an object. To round out the branching model, the class OsiBranchingObject describes how to perform a branch, and the class OsiBranchDecision describes how to compare two OsiBranchingObjects. To create a new type of object you need to provide three methods: #infeasibility(), #feasibleRegion(), and #createBranch(), described below. This base class is primarily virtual to allow for any form of structure. Any form of discontinuity is allowed. As there is an overhead in getting information from solvers and because other useful information is available there is also an OsiBranchingInformation class which can contain pointers to information. If used it must at minimum contain pointers to current value of objective, maximum allowed objective and pointers to arrays for bounds and solution and direction of optimization. Also integer and primal tolerance. Classes which inherit might have other information such as depth, number of solutions, pseudo-shadow prices etc etc. May be easier just to throw in here - as I keep doing */ class OsiObject { public: /// Default Constructor OsiObject (); /// Copy constructor OsiObject ( const OsiObject &); /// Assignment operator OsiObject & operator=( const OsiObject& rhs); /// Clone virtual OsiObject * clone() const=0; /// Destructor virtual ~OsiObject (); /** Infeasibility of the object This is some measure of the infeasibility of the object. 0.0 indicates that the object is satisfied. The preferred branching direction is returned in whichWay, where for normal two-way branching 0 is down, 1 is up This is used to prepare for strong branching but should also think of case when no strong branching The object may also compute an estimate of cost of going "up" or "down". This will probably be based on pseudo-cost ideas This should also set mutable infeasibility_ and whichWay_ This is for instant re-use for speed Default for this just calls infeasibility with OsiBranchingInformation NOTE - Convention says that an infeasibility of COIN_DBL_MAX means object has worked out it can't be satisfied! */ double infeasibility(const OsiSolverInterface * solver,int &whichWay) const ; // Faster version when more information available virtual double infeasibility(const OsiBranchingInformation * info, int &whichWay) const =0; // This does NOT set mutable stuff virtual double checkInfeasibility(const OsiBranchingInformation * info) const; /** For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. Returns measure of how much it had to move solution to make feasible */ virtual double feasibleRegion(OsiSolverInterface * solver) const ; /** For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. Returns measure of how much it had to move solution to make feasible Faster version */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const =0; /** Create a branching object and indicate which way to branch first. The branching object has to know how to create branches (fix variables, etc.) */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * /*info*/, int /*way*/) const {throw CoinError("Need code","createBranch","OsiBranchingObject"); return NULL; } /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const {return true;} /** \brief Return true if object can take part in move to nearest heuristic */ virtual bool canMoveToNearest() const {return false;} /** Column number if single column object -1 otherwise, Used by heuristics */ virtual int columnNumber() const; /// Return Priority - note 1 is highest priority inline int priority() const { return priority_;} /// Set priority inline void setPriority(int priority) { priority_ = priority;} /** \brief Return true if branch should only bound variables */ virtual bool boundBranch() const {return true;} /// Return true if knows how to deal with Pseudo Shadow Prices virtual bool canHandleShadowPrices() const { return false;} /// Return maximum number of ways branch may have inline int numberWays() const { return numberWays_;} /// Set maximum number of ways branch may have inline void setNumberWays(int numberWays) { numberWays_ = static_cast(numberWays) ; } /** Return preferred way to branch. If two then way=0 means down and 1 means up, otherwise way points to preferred branch */ inline void setWhichWay(int way) { whichWay_ = static_cast(way) ; } /** Return current preferred way to branch. If two then way=0 means down and 1 means up, otherwise way points to preferred branch */ inline int whichWay() const { return whichWay_;} /// Get pre-emptive preferred way of branching - -1 off, 0 down, 1 up (for 2-way) virtual int preferredWay() const { return -1;} /// Return infeasibility inline double infeasibility() const { return infeasibility_;} /// Return "up" estimate (default 1.0e-5) virtual double upEstimate() const; /// Return "down" estimate (default 1.0e-5) virtual double downEstimate() const; /** Reset variable bounds to their original values. Bounds may be tightened, so it may be good to be able to reset them to their original values. */ virtual void resetBounds(const OsiSolverInterface * ) {} /** Change column numbers after preprocessing */ virtual void resetSequenceEtc(int , const int * ) {} /// Updates stuff like pseudocosts before threads virtual void updateBefore(const OsiObject * ) {} /// Updates stuff like pseudocosts after threads finished virtual void updateAfter(const OsiObject * , const OsiObject * ) {} protected: /// data /// Computed infeasibility mutable double infeasibility_; /// Computed preferred way to branch mutable short whichWay_; /// Maximum number of ways on branch short numberWays_; /// Priority int priority_; }; /// Define a class to add a bit of complexity to OsiObject /// This assumes 2 way branching class OsiObject2 : public OsiObject { public: /// Default Constructor OsiObject2 (); /// Copy constructor OsiObject2 ( const OsiObject2 &); /// Assignment operator OsiObject2 & operator=( const OsiObject2& rhs); /// Destructor virtual ~OsiObject2 (); /// Set preferred way of branching - -1 off, 0 down, 1 up (for 2-way) inline void setPreferredWay(int value) {preferredWay_=value;} /// Get preferred way of branching - -1 off, 0 down, 1 up (for 2-way) virtual int preferredWay() const { return preferredWay_;} protected: /// Preferred way of branching - -1 off, 0 down, 1 up (for 2-way) int preferredWay_; /// "Infeasibility" on other way mutable double otherInfeasibility_; }; /** \brief Abstract branching object base class In the abstract, an OsiBranchingObject contains instructions for how to branch. We want an abstract class so that we can describe how to branch on simple objects (e.g., integers) and more exotic objects (e.g., cliques or hyperplanes). The #branch() method is the crucial routine: it is expected to be able to step through a set of branch arms, executing the actions required to create each subproblem in turn. The base class is primarily virtual to allow for a wide range of problem modifications. See OsiObject for an overview of the two classes (OsiObject and OsiBranchingObject) which make up Osi's branching model. */ class OsiBranchingObject { public: /// Default Constructor OsiBranchingObject (); /// Constructor OsiBranchingObject (OsiSolverInterface * solver, double value); /// Copy constructor OsiBranchingObject ( const OsiBranchingObject &); /// Assignment operator OsiBranchingObject & operator=( const OsiBranchingObject& rhs); /// Clone virtual OsiBranchingObject * clone() const=0; /// Destructor virtual ~OsiBranchingObject (); /// The number of branch arms created for this branching object inline int numberBranches() const {return numberBranches_;} /// The number of branch arms left for this branching object inline int numberBranchesLeft() const {return numberBranches_-branchIndex_;} /// Increment the number of branch arms left for this branching object inline void incrementNumberBranchesLeft() { numberBranches_ ++;} /** Set the number of branch arms left for this branching object Just for forcing */ inline void setNumberBranchesLeft(int /*value*/) {/*assert (value==1&&!branchIndex_);*/ numberBranches_=1;} /// Decrement the number of branch arms left for this branching object inline void decrementNumberBranchesLeft() {branchIndex_++;} /** \brief Execute the actions required to branch, as specified by the current state of the branching object, and advance the object's state. Returns change in guessed objective on next branch */ virtual double branch(OsiSolverInterface * solver)=0; /** \brief Execute the actions required to branch, as specified by the current state of the branching object, and advance the object's state. Returns change in guessed objective on next branch */ virtual double branch() {return branch(NULL);} /** \brief Return true if branch should fix variables */ virtual bool boundBranch() const {return true;} /** Get the state of the branching object This is just the branch index */ inline int branchIndex() const {return branchIndex_;} /** Set the state of the branching object. */ inline void setBranchingIndex(int branchIndex) { branchIndex_ = static_cast(branchIndex) ; } /// Current value inline double value() const {return value_;} /// Return pointer back to object which created inline const OsiObject * originalObject() const {return originalObject_;} /// Set pointer back to object which created inline void setOriginalObject(const OsiObject * object) {originalObject_=object;} /** Double checks in case node can change its mind! Returns objective value Can change objective etc */ virtual void checkIsCutoff(double ) {} /// For debug int columnNumber() const; /** \brief Print something about branch - only if log level high */ virtual void print(const OsiSolverInterface * =NULL) const {} protected: /// Current value - has some meaning about branch double value_; /// Pointer back to object which created const OsiObject * originalObject_; /** Number of branches */ int numberBranches_; /** The state of the branching object. i.e. branch index This starts at 0 when created */ short branchIndex_; }; /* This contains information This could also contain pseudo shadow prices or information for dealing with computing and trusting pseudo-costs */ class OsiBranchingInformation { public: /// Default Constructor OsiBranchingInformation (); /** Useful Constructor (normalSolver true if has matrix etc etc) copySolution true if constructot should make a copy */ OsiBranchingInformation (const OsiSolverInterface * solver, bool normalSolver,bool copySolution=false); /// Copy constructor OsiBranchingInformation ( const OsiBranchingInformation &); /// Assignment operator OsiBranchingInformation & operator=( const OsiBranchingInformation& rhs); /// Clone virtual OsiBranchingInformation * clone() const; /// Destructor virtual ~OsiBranchingInformation (); // Note public public: /// data /** State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no solution but many nodes */ int stateOfSearch_; /// Value of objective function (in minimization sense) double objectiveValue_; /// Value of objective cutoff (in minimization sense) double cutoff_; /// Direction 1.0 for minimization, -1.0 for maximization double direction_; /// Integer tolerance double integerTolerance_; /// Primal tolerance double primalTolerance_; /// Maximum time remaining before stopping on time double timeRemaining_; /// Dual to use if row bound violated (if negative then pseudoShadowPrices off) double defaultDual_; /// Pointer to solver mutable const OsiSolverInterface * solver_; /// The number of columns int numberColumns_; /// Pointer to current lower bounds on columns mutable const double * lower_; /// Pointer to current solution mutable const double * solution_; /// Pointer to current upper bounds on columns mutable const double * upper_; /// Highly optional target (hot start) solution const double * hotstartSolution_; /// Pointer to duals const double * pi_; /// Pointer to row activity const double * rowActivity_; /// Objective const double * objective_; /// Pointer to current lower bounds on rows const double * rowLower_; /// Pointer to current upper bounds on rows const double * rowUpper_; /// Elements in column copy of matrix const double * elementByColumn_; /// Column starts const CoinBigIndex * columnStart_; /// Column lengths const int * columnLength_; /// Row indices const int * row_; /** Useful region of length CoinMax(numberColumns,2*numberRows) This is allocated and deleted before OsiObject::infeasibility It is zeroed on entry and should be so on exit It only exists if defaultDual_>=0.0 */ double * usefulRegion_; /// Useful index region to go with usefulRegion_ int * indexRegion_; /// Number of solutions found int numberSolutions_; /// Number of branching solutions found (i.e. exclude heuristics) int numberBranchingSolutions_; /// Depth in tree int depth_; /// TEMP bool owningSolution_; }; /// This just adds two-wayness to a branching object class OsiTwoWayBranchingObject : public OsiBranchingObject { public: /// Default constructor OsiTwoWayBranchingObject (); /** Create a standard tw0-way branch object Specifies a simple two-way branch. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ OsiTwoWayBranchingObject (OsiSolverInterface *solver,const OsiObject * originalObject, int way , double value) ; /// Copy constructor OsiTwoWayBranchingObject ( const OsiTwoWayBranchingObject &); /// Assignment operator OsiTwoWayBranchingObject & operator= (const OsiTwoWayBranchingObject& rhs); /// Destructor virtual ~OsiTwoWayBranchingObject (); using OsiBranchingObject::branch ; /** \brief Sets the bounds for the variable according to the current arm of the branch and advances the object state to the next arm. state. Returns change in guessed objective on next branch */ virtual double branch(OsiSolverInterface * solver)=0; inline int firstBranch() const { return firstBranch_; } /// Way returns -1 on down +1 on up inline int way() const { return !branchIndex_ ? firstBranch_ : -firstBranch_;} protected: /// Which way was first branch -1 = down, +1 = up int firstBranch_; }; /// Define a single integer class class OsiSimpleInteger : public OsiObject2 { public: /// Default Constructor OsiSimpleInteger (); /// Useful constructor - passed solver index OsiSimpleInteger (const OsiSolverInterface * solver, int iColumn); /// Useful constructor - passed solver index and original bounds OsiSimpleInteger (int iColumn, double lower, double upper); /// Copy constructor OsiSimpleInteger ( const OsiSimpleInteger &); /// Clone virtual OsiObject * clone() const; /// Assignment operator OsiSimpleInteger & operator=( const OsiSimpleInteger& rhs); /// Destructor virtual ~OsiSimpleInteger (); using OsiObject::infeasibility ; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int & whichWay) const; using OsiObject::feasibleRegion ; /** Set bounds to fix the variable at the current (integer) value. Given an integer value, set the lower and upper bounds to fix the variable. Returns amount it had to move variable. */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** Creates a branching object The preferred direction is set by \p way, 0 for down, 1 for up. */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; /// Set solver column number inline void setColumnNumber(int value) {columnNumber_=value;} /** Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics */ virtual int columnNumber() const; /// Original bounds inline double originalLowerBound() const { return originalLower_;} inline void setOriginalLowerBound(double value) { originalLower_=value;} inline double originalUpperBound() const { return originalUpper_;} inline void setOriginalUpperBound(double value) { originalUpper_=value;} /** Reset variable bounds to their original values. Bounds may be tightened, so it may be good to be able to reset them to their original values. */ virtual void resetBounds(const OsiSolverInterface * solver) ; /** Change column numbers after preprocessing */ virtual void resetSequenceEtc(int numberColumns, const int * originalColumns); /// Return "up" estimate (default 1.0e-5) virtual double upEstimate() const; /// Return "down" estimate (default 1.0e-5) virtual double downEstimate() const; /// Return true if knows how to deal with Pseudo Shadow Prices virtual bool canHandleShadowPrices() const { return false;} protected: /// data /// Original lower bound double originalLower_; /// Original upper bound double originalUpper_; /// Column number in solver int columnNumber_; }; /** Simple branching object for an integer variable This object can specify a two-way branch on an integer variable. For each arm of the branch, the upper and lower bounds on the variable can be independently specified. 0 -> down, 1-> up. */ class OsiIntegerBranchingObject : public OsiTwoWayBranchingObject { public: /// Default constructor OsiIntegerBranchingObject (); /** Create a standard floor/ceiling branch object Specifies a simple two-way branch. Let \p value = x*. One arm of the branch will be lb <= x <= floor(x*), the other ceil(x*) <= x <= ub. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ OsiIntegerBranchingObject (OsiSolverInterface *solver,const OsiSimpleInteger * originalObject, int way , double value) ; /** Create a standard floor/ceiling branch object Specifies a simple two-way branch in a more flexible way. One arm of the branch will be lb <= x <= downUpperBound, the other upLowerBound <= x <= ub. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ OsiIntegerBranchingObject (OsiSolverInterface *solver,const OsiSimpleInteger * originalObject, int way , double value, double downUpperBound, double upLowerBound) ; /// Copy constructor OsiIntegerBranchingObject ( const OsiIntegerBranchingObject &); /// Assignment operator OsiIntegerBranchingObject & operator= (const OsiIntegerBranchingObject& rhs); /// Clone virtual OsiBranchingObject * clone() const; /// Destructor virtual ~OsiIntegerBranchingObject (); using OsiBranchingObject::branch ; /** \brief Sets the bounds for the variable according to the current arm of the branch and advances the object state to the next arm. state. Returns change in guessed objective on next branch */ virtual double branch(OsiSolverInterface * solver); using OsiBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(const OsiSolverInterface * solver=NULL); protected: // Probably could get away with just value which is already stored /// Lower [0] and upper [1] bounds for the down arm (way_ = -1) double down_[2]; /// Lower [0] and upper [1] bounds for the up arm (way_ = 1) double up_[2]; }; /** Define Special Ordered Sets of type 1 and 2. These do not have to be integer - so do not appear in lists of integers. which_ points columns of matrix */ class OsiSOS : public OsiObject2 { public: // Default Constructor OsiSOS (); /** Useful constructor - which are indices and weights are also given. If null then 0,1,2.. type is SOS type */ OsiSOS (const OsiSolverInterface * solver, int numberMembers, const int * which, const double * weights, int type=1); // Copy constructor OsiSOS ( const OsiSOS &); /// Clone virtual OsiObject * clone() const; // Assignment operator OsiSOS & operator=( const OsiSOS& rhs); // Destructor virtual ~OsiSOS (); using OsiObject::infeasibility ; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info,int & whichWay) const; using OsiObject::feasibleRegion ; /** Set bounds to fix the variable at the current (integer) value. Given an integer value, set the lower and upper bounds to fix the variable. Returns amount it had to move variable. */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** Creates a branching object The preferred direction is set by \p way, 0 for down, 1 for up. */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; /// Return "up" estimate (default 1.0e-5) virtual double upEstimate() const; /// Return "down" estimate (default 1.0e-5) virtual double downEstimate() const; /// Redoes data when sequence numbers change virtual void resetSequenceEtc(int numberColumns, const int * originalColumns); /// Number of members inline int numberMembers() const {return numberMembers_;} /// Members (indices in range 0 ... numberColumns-1) inline const int * members() const {return members_;} /// SOS type inline int sosType() const {return sosType_;} /// SOS type inline int setType() const {return sosType_;} /** Array of weights */ inline const double * weights() const { return weights_;} /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const {return (sosType_==1&&integerValued_);} /// Set whether set is integer valued or not inline void setIntegerValued(bool yesNo) { integerValued_=yesNo;} /// Return true if knows how to deal with Pseudo Shadow Prices virtual bool canHandleShadowPrices() const { return true;} /// Set number of members inline void setNumberMembers(int value) {numberMembers_=value;} /// Members (indices in range 0 ... numberColumns-1) inline int * mutableMembers() const {return members_;} /// Set SOS type inline void setSosType(int value) {sosType_=value;} /** Array of weights */ inline double * mutableWeights() const { return weights_;} protected: /// data /// Members (indices in range 0 ... numberColumns-1) int * members_; /// Weights double * weights_; /// Number of members int numberMembers_; /// SOS type int sosType_; /// Whether integer valued bool integerValued_; }; /** Branching object for Special ordered sets */ class OsiSOSBranchingObject : public OsiTwoWayBranchingObject { public: // Default Constructor OsiSOSBranchingObject (); // Useful constructor OsiSOSBranchingObject (OsiSolverInterface * solver, const OsiSOS * originalObject, int way, double separator); // Copy constructor OsiSOSBranchingObject ( const OsiSOSBranchingObject &); // Assignment operator OsiSOSBranchingObject & operator=( const OsiSOSBranchingObject& rhs); /// Clone virtual OsiBranchingObject * clone() const; // Destructor virtual ~OsiSOSBranchingObject (); using OsiBranchingObject::branch ; /// Does next branch and updates state virtual double branch(OsiSolverInterface * solver); using OsiBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(const OsiSolverInterface * solver=NULL); private: /// data }; /** Lotsize class */ class OsiLotsize : public OsiObject2 { public: // Default Constructor OsiLotsize (); /* Useful constructor - passed model index. Also passed valid values - if range then pairs */ OsiLotsize (const OsiSolverInterface * solver, int iColumn, int numberPoints, const double * points, bool range=false); // Copy constructor OsiLotsize ( const OsiLotsize &); /// Clone virtual OsiObject * clone() const; // Assignment operator OsiLotsize & operator=( const OsiLotsize& rhs); // Destructor virtual ~OsiLotsize (); using OsiObject::infeasibility ; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int & whichWay) const; using OsiObject::feasibleRegion ; /** Set bounds to contain the current solution. More precisely, for the variable associated with this object, take the value given in the current solution, force it within the current bounds if required, then set the bounds to fix the variable at the integer nearest the solution value. Returns amount it had to move variable. */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** Creates a branching object The preferred direction is set by \p way, 0 for down, 1 for up. */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; /// Set solver column number inline void setColumnNumber(int value) {columnNumber_=value;} /** Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics */ virtual int columnNumber() const; /** Reset original upper and lower bound values from the solver. Handy for updating bounds held in this object after bounds held in the solver have been tightened. */ virtual void resetBounds(const OsiSolverInterface * solver); /** Finds range of interest so value is feasible in range range_ or infeasible between hi[range_] and lo[range_+1]. Returns true if feasible. */ bool findRange(double value, double integerTolerance) const; /** Returns floor and ceiling */ virtual void floorCeiling(double & floorLotsize, double & ceilingLotsize, double value, double tolerance) const; /// Original bounds inline double originalLowerBound() const { return bound_[0];} inline double originalUpperBound() const { return bound_[rangeType_*numberRanges_-1];} /// Type - 1 points, 2 ranges inline int rangeType() const { return rangeType_;} /// Number of points inline int numberRanges() const { return numberRanges_;} /// Ranges inline double * bound() const { return bound_;} /** Change column numbers after preprocessing */ virtual void resetSequenceEtc(int numberColumns, const int * originalColumns); /// Return "up" estimate (default 1.0e-5) virtual double upEstimate() const; /// Return "down" estimate (default 1.0e-5) virtual double downEstimate() const; /// Return true if knows how to deal with Pseudo Shadow Prices virtual bool canHandleShadowPrices() const { return true;} /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const {return false;} private: /// data /// Column number in model int columnNumber_; /// Type - 1 points, 2 ranges int rangeType_; /// Number of points int numberRanges_; // largest gap double largestGap_; /// Ranges double * bound_; /// Current range mutable int range_; }; /** Lotsize branching object This object can specify a two-way branch on an integer variable. For each arm of the branch, the upper and lower bounds on the variable can be independently specified. Variable_ holds the index of the integer variable in the integerVariable_ array of the model. */ class OsiLotsizeBranchingObject : public OsiTwoWayBranchingObject { public: /// Default constructor OsiLotsizeBranchingObject (); /** Create a lotsize floor/ceiling branch object Specifies a simple two-way branch. Let \p value = x*. One arm of the branch will be is lb <= x <= valid range below(x*), the other valid range above(x*) <= x <= ub. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ OsiLotsizeBranchingObject (OsiSolverInterface *solver,const OsiLotsize * originalObject, int way , double value) ; /// Copy constructor OsiLotsizeBranchingObject ( const OsiLotsizeBranchingObject &); /// Assignment operator OsiLotsizeBranchingObject & operator= (const OsiLotsizeBranchingObject& rhs); /// Clone virtual OsiBranchingObject * clone() const; /// Destructor virtual ~OsiLotsizeBranchingObject (); using OsiBranchingObject::branch ; /** \brief Sets the bounds for the variable according to the current arm of the branch and advances the object state to the next arm. state. Returns change in guessed objective on next branch */ virtual double branch(OsiSolverInterface * solver); using OsiBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(const OsiSolverInterface * solver=NULL); protected: /// Lower [0] and upper [1] bounds for the down arm (way_ = -1) double down_[2]; /// Lower [0] and upper [1] bounds for the up arm (way_ = 1) double up_[2]; }; #endif CoinMP-1.8.3/Osi/src/Osi/Makefile.am0000644000175000017500000000460212243462564015435 0ustar renerene# Copyright (C) 2010 Lou Hafer # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1942 2013-11-21 19:56:36Z stefan $ # Author: Lou Hafer SFU 2010-07-29 AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsi # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in $libdir lib_LTLIBRARIES = libOsi.la # List all source files for this library, including headers libOsi_la_SOURCES = \ OsiConfig.h \ OsiAuxInfo.cpp OsiAuxInfo.hpp \ OsiBranchingObject.cpp OsiBranchingObject.hpp \ OsiChooseVariable.cpp OsiChooseVariable.hpp \ OsiColCut.cpp OsiColCut.hpp \ OsiCollections.hpp \ OsiCut.cpp OsiCut.hpp \ OsiCuts.cpp OsiCuts.hpp \ OsiNames.cpp \ OsiPresolve.cpp OsiPresolve.hpp \ OsiRowCut.cpp OsiRowCut.hpp \ OsiRowCutDebugger.cpp OsiRowCutDebugger.hpp \ OsiSolverBranch.cpp OsiSolverBranch.hpp \ OsiSolverInterface.cpp OsiSolverInterface.hpp \ OsiSolverParameters.hpp # List all additionally required libraries if DEPENDENCY_LINKING libOsi_la_LIBADD = $(OSILIB_LIBS) endif # This is for libtool libOsi_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags. AM_CPPFLAGS = $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation. # This "cygpath" stuff is necessary to compile with native compilers on Windows. DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'includedir/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ OsiAuxInfo.hpp \ OsiBranchingObject.hpp \ OsiChooseVariable.hpp \ OsiColCut.hpp \ OsiCollections.hpp \ OsiCut.hpp \ OsiCuts.hpp \ OsiPresolve.hpp \ OsiRowCut.hpp \ OsiRowCutDebugger.hpp \ OsiSolverBranch.hpp \ OsiSolverInterface.hpp \ OsiSolverParameters.hpp install-exec-local: $(install_sh_DATA) config_osi.h $(DESTDIR)$(includecoindir)/OsiConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/OsiConfig.h CoinMP-1.8.3/Osi/src/Osi/OsiChooseVariable.cpp0000644000175000017500000010735612101340333017436 0ustar renerene// Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include "CoinPragma.hpp" #include "OsiSolverInterface.hpp" #include "OsiAuxInfo.hpp" #include "OsiSolverBranch.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinPackedMatrix.hpp" #include "CoinTime.hpp" #include "CoinSort.hpp" #include "CoinFinite.hpp" #include "OsiChooseVariable.hpp" using namespace std; OsiChooseVariable::OsiChooseVariable() : goodObjectiveValue_(COIN_DBL_MAX), upChange_(0.0), downChange_(0.0), goodSolution_(NULL), list_(NULL), useful_(NULL), solver_(NULL), status_(-1), bestObjectIndex_(-1), bestWhichWay_(-1), firstForcedObjectIndex_(-1), firstForcedWhichWay_(-1), numberUnsatisfied_(0), numberStrong_(0), numberOnList_(0), numberStrongDone_(0), numberStrongIterations_(0), numberStrongFixed_(0), trustStrongForBound_(true), trustStrongForSolution_(true) { } OsiChooseVariable::OsiChooseVariable(const OsiSolverInterface * solver) : goodObjectiveValue_(COIN_DBL_MAX), upChange_(0.0), downChange_(0.0), goodSolution_(NULL), solver_(solver), status_(-1), bestObjectIndex_(-1), bestWhichWay_(-1), firstForcedObjectIndex_(-1), firstForcedWhichWay_(-1), numberUnsatisfied_(0), numberStrong_(0), numberOnList_(0), numberStrongDone_(0), numberStrongIterations_(0), numberStrongFixed_(0), trustStrongForBound_(true), trustStrongForSolution_(true) { // create useful arrays int numberObjects = solver_->numberObjects(); list_ = new int [numberObjects]; useful_ = new double [numberObjects]; } OsiChooseVariable::OsiChooseVariable(const OsiChooseVariable & rhs) { goodObjectiveValue_ = rhs.goodObjectiveValue_; upChange_ = rhs.upChange_; downChange_ = rhs.downChange_; status_ = rhs.status_; bestObjectIndex_ = rhs.bestObjectIndex_; bestWhichWay_ = rhs.bestWhichWay_; firstForcedObjectIndex_ = rhs.firstForcedObjectIndex_; firstForcedWhichWay_ = rhs.firstForcedWhichWay_; numberUnsatisfied_ = rhs.numberUnsatisfied_; numberStrong_ = rhs.numberStrong_; numberOnList_ = rhs.numberOnList_; numberStrongDone_ = rhs.numberStrongDone_; numberStrongIterations_ = rhs.numberStrongIterations_; numberStrongFixed_ = rhs.numberStrongFixed_; trustStrongForBound_ = rhs.trustStrongForBound_; trustStrongForSolution_ = rhs.trustStrongForSolution_; solver_ = rhs.solver_; if (solver_) { int numberObjects = solver_->numberObjects(); int numberColumns = solver_->getNumCols(); if (rhs.goodSolution_) { goodSolution_ = CoinCopyOfArray(rhs.goodSolution_,numberColumns); } else { goodSolution_ = NULL; } list_ = CoinCopyOfArray(rhs.list_,numberObjects); useful_ = CoinCopyOfArray(rhs.useful_,numberObjects); } else { goodSolution_ = NULL; list_ = NULL; useful_ = NULL; } } OsiChooseVariable & OsiChooseVariable::operator=(const OsiChooseVariable & rhs) { if (this != &rhs) { delete [] goodSolution_; delete [] list_; delete [] useful_; goodObjectiveValue_ = rhs.goodObjectiveValue_; upChange_ = rhs.upChange_; downChange_ = rhs.downChange_; status_ = rhs.status_; bestObjectIndex_ = rhs.bestObjectIndex_; bestWhichWay_ = rhs.bestWhichWay_; firstForcedObjectIndex_ = rhs.firstForcedObjectIndex_; firstForcedWhichWay_ = rhs.firstForcedWhichWay_; numberUnsatisfied_ = rhs.numberUnsatisfied_; numberStrong_ = rhs.numberStrong_; numberOnList_ = rhs.numberOnList_; numberStrongDone_ = rhs.numberStrongDone_; numberStrongIterations_ = rhs.numberStrongIterations_; numberStrongFixed_ = rhs.numberStrongFixed_; trustStrongForBound_ = rhs.trustStrongForBound_; trustStrongForSolution_ = rhs.trustStrongForSolution_; solver_ = rhs.solver_; if (solver_) { int numberObjects = solver_->numberObjects(); int numberColumns = solver_->getNumCols(); if (rhs.goodSolution_) { goodSolution_ = CoinCopyOfArray(rhs.goodSolution_,numberColumns); } else { goodSolution_ = NULL; } list_ = CoinCopyOfArray(rhs.list_,numberObjects); useful_ = CoinCopyOfArray(rhs.useful_,numberObjects); } else { goodSolution_ = NULL; list_ = NULL; useful_ = NULL; } } return *this; } OsiChooseVariable::~OsiChooseVariable () { delete [] goodSolution_; delete [] list_; delete [] useful_; } // Clone OsiChooseVariable * OsiChooseVariable::clone() const { return new OsiChooseVariable(*this); } // Set solver and redo arrays void OsiChooseVariable::setSolver (const OsiSolverInterface * solver) { solver_ = solver; delete [] list_; delete [] useful_; // create useful arrays int numberObjects = solver_->numberObjects(); list_ = new int [numberObjects]; useful_ = new double [numberObjects]; } // Initialize int OsiChooseVariable::setupList ( OsiBranchingInformation *info, bool initialize) { if (initialize) { status_=-2; delete [] goodSolution_; bestObjectIndex_=-1; numberStrongDone_=0; numberStrongIterations_ = 0; numberStrongFixed_ = 0; goodSolution_ = NULL; goodObjectiveValue_ = COIN_DBL_MAX; } numberOnList_=0; numberUnsatisfied_=0; int numberObjects = solver_->numberObjects(); assert (numberObjects); double check = 0.0; int checkIndex=0; int bestPriority=COIN_INT_MAX; // pretend one strong even if none int maximumStrong= numberStrong_ ? CoinMin(numberStrong_,numberObjects) : 1; int putOther = numberObjects; int i; for (i=0;isolver_->objects(); // Say feasible bool feasible = true; for ( i=0;iinfeasibility(info,way); if (value>0.0) { numberUnsatisfied_++; if (value==COIN_DBL_MAX) { // infeasible feasible=false; break; } int priorityLevel = object[i]->priority(); // Better priority? Flush choices. if (priorityLevel=0) { int iObject = list_[j]; list_[j]=-1; useful_[j]=0.0; list_[--putOther]=iObject; } } bestPriority = priorityLevel; check=0.0; } if (priorityLevel==bestPriority) { if (value>check) { //add to list int iObject = list_[checkIndex]; if (iObject>=0) list_[--putOther]=iObject; // to end list_[checkIndex]=i; useful_[checkIndex]=value; // find worst check=COIN_DBL_MAX; for (int j=0;j=0) { if (useful_[j]=0) { list_[numberOnList_]=list_[i]; useful_[numberOnList_++]=-useful_[i]; } } if (numberOnList_) { // Sort CoinSort_2(useful_,useful_+numberOnList_,list_); // move others i = numberOnList_; for (;putOtherobject(bestObjectIndex_)->whichWay(); firstForcedObjectIndex_ = -1; firstForcedWhichWay_ =-1; return 0; } else { return 1; } } // Returns true if solution looks feasible against given objects bool OsiChooseVariable::feasibleSolution(const OsiBranchingInformation * info, const double * solution, int numberObjects, const OsiObject ** objects) { bool satisfied=true; const double * saveSolution = info->solution_; info->solution_ = solution; for (int i=0;icheckInfeasibility(info); if (value>0.0) { satisfied=false; break; } } info->solution_ = saveSolution; return satisfied; } // Saves a good solution void OsiChooseVariable::saveSolution(const OsiSolverInterface * solver) { delete [] goodSolution_; int numberColumns = solver->getNumCols(); goodSolution_ = CoinCopyOfArray(solver->getColSolution(),numberColumns); goodObjectiveValue_ = solver->getObjSense()*solver->getObjValue(); } // Clears out good solution after use void OsiChooseVariable::clearGoodSolution() { delete [] goodSolution_; goodSolution_ = NULL; goodObjectiveValue_ = COIN_DBL_MAX; } /* This is a utility function which does strong branching on a list of objects and stores the results in OsiHotInfo.objects. On entry the object sequence is stored in the OsiHotInfo object and maybe more. It returns - -1 - one branch was infeasible both ways 0 - all inspected - nothing can be fixed 1 - all inspected - some can be fixed (returnCriterion==0) 2 - may be returning early - one can be fixed (last one done) (returnCriterion==1) 3 - returning because max time */ int OsiChooseStrong::doStrongBranching( OsiSolverInterface * solver, OsiBranchingInformation *info, int numberToDo, int returnCriterion) { // Might be faster to extend branch() to return bounds changed double * saveLower = NULL; double * saveUpper = NULL; int numberColumns = solver->getNumCols(); solver->markHotStart(); const double * lower = info->lower_; const double * upper = info->upper_; saveLower = CoinCopyOfArray(info->lower_,numberColumns); saveUpper = CoinCopyOfArray(info->upper_,numberColumns); numResults_=0; int returnCode=0; double timeStart = CoinCpuTime(); for (int iDo=0;iDobranchingObject(); assert (branch->numberBranches()==2); /* Try the first direction. Each subsequent call to branch() performs the specified branch and advances the branch object state to the next branch alternative.) */ OsiSolverInterface * thisSolver = solver; if (branch->boundBranch()) { // ordinary branch->branch(solver); // maybe we should check bounds for stupidities here? solver->solveFromHotStart() ; } else { // adding cuts or something thisSolver = solver->clone(); branch->branch(thisSolver); // set hot start iterations int limit; thisSolver->getIntParam(OsiMaxNumIterationHotStart,limit); thisSolver->setIntParam(OsiMaxNumIteration,limit); thisSolver->resolve(); } // can check if we got solution // status is 0 finished, 1 infeasible and 2 unfinished and 3 is solution int status0 = result->updateInformation(thisSolver,info,this); numberStrongIterations_ += thisSolver->getIterationCount(); if (status0==3) { // new solution already saved if (trustStrongForSolution_) { info->cutoff_ = goodObjectiveValue_; status0=0; } } if (solver!=thisSolver) delete thisSolver; // Restore bounds for (int j=0;jsetColLower(j,saveLower[j]); if (saveUpper[j] != upper[j]) solver->setColUpper(j,saveUpper[j]); } /* Try the next direction */ thisSolver = solver; if (branch->boundBranch()) { // ordinary branch->branch(solver); // maybe we should check bounds for stupidities here? solver->solveFromHotStart() ; } else { // adding cuts or something thisSolver = solver->clone(); branch->branch(thisSolver); // set hot start iterations int limit; thisSolver->getIntParam(OsiMaxNumIterationHotStart,limit); thisSolver->setIntParam(OsiMaxNumIteration,limit); thisSolver->resolve(); } // can check if we got solution // status is 0 finished, 1 infeasible and 2 unfinished and 3 is solution int status1 = result->updateInformation(thisSolver,info,this); numberStrongDone_++; numberStrongIterations_ += thisSolver->getIterationCount(); if (status1==3) { // new solution already saved if (trustStrongForSolution_) { info->cutoff_ = goodObjectiveValue_; status1=0; } } if (solver!=thisSolver) delete thisSolver; // Restore bounds for (int j=0;jsetColLower(j,saveLower[j]); if (saveUpper[j] != upper[j]) solver->setColUpper(j,saveUpper[j]); } /* End of evaluation for this candidate variable. Possibilities are: * Both sides below cutoff; this variable is a candidate for branching. * Both sides infeasible or above the objective cutoff: no further action here. Break from the evaluation loop and assume the node will be purged by the caller. * One side below cutoff: Install the branch (i.e., fix the variable). Possibly break from the evaluation loop and assume the node will be reoptimised by the caller. */ numResults_++; if (status0==1&&status1==1) { // infeasible returnCode=-1; break; // exit loop } else if (status0==1||status1==1) { numberStrongFixed_++; if (!returnCriterion) { returnCode=1; } else { returnCode=2; break; } } bool hitMaxTime = ( CoinCpuTime()-timeStart > info->timeRemaining_); if (hitMaxTime) { returnCode=3; break; } } delete [] saveLower; delete [] saveUpper; // Delete the snapshot solver->unmarkHotStart(); return returnCode; } // Given a candidate fill in useful information e.g. estimates void OsiChooseVariable::updateInformation(const OsiBranchingInformation *info, int , OsiHotInfo * hotInfo) { int index = hotInfo->whichObject(); assert (indexnumberObjects()); //assert (branch<2); OsiObject ** object = info->solver_->objects(); upChange_ = object[index]->upEstimate(); downChange_ = object[index]->downEstimate(); } #if 1 // Given a branch fill in useful information e.g. estimates void OsiChooseVariable::updateInformation( int index, int branch, double , double , int ) { assert (indexnumberObjects()); assert (branch<2); OsiObject ** object = solver_->objects(); if (branch) upChange_ = object[index]->upEstimate(); else downChange_ = object[index]->downEstimate(); } #endif //############################################################################## void OsiPseudoCosts::gutsOfDelete() { if (numberObjects_ > 0) { numberObjects_ = 0; numberBeforeTrusted_ = 0; delete[] upTotalChange_; upTotalChange_ = NULL; delete[] downTotalChange_; downTotalChange_ = NULL; delete[] upNumber_; upNumber_ = NULL; delete[] downNumber_; downNumber_ = NULL; } } void OsiPseudoCosts::gutsOfCopy(const OsiPseudoCosts& rhs) { numberObjects_ = rhs.numberObjects_; numberBeforeTrusted_ = rhs.numberBeforeTrusted_; if (numberObjects_ > 0) { upTotalChange_ = CoinCopyOfArray(rhs.upTotalChange_,numberObjects_); downTotalChange_ = CoinCopyOfArray(rhs.downTotalChange_,numberObjects_); upNumber_ = CoinCopyOfArray(rhs.upNumber_,numberObjects_); downNumber_ = CoinCopyOfArray(rhs.downNumber_,numberObjects_); } } OsiPseudoCosts::OsiPseudoCosts() : upTotalChange_(NULL), downTotalChange_(NULL), upNumber_(NULL), downNumber_(NULL), numberObjects_(0), numberBeforeTrusted_(0) { } OsiPseudoCosts::~OsiPseudoCosts() { gutsOfDelete(); } OsiPseudoCosts::OsiPseudoCosts(const OsiPseudoCosts& rhs) : upTotalChange_(NULL), downTotalChange_(NULL), upNumber_(NULL), downNumber_(NULL), numberObjects_(0), numberBeforeTrusted_(0) { gutsOfCopy(rhs); } OsiPseudoCosts& OsiPseudoCosts::operator=(const OsiPseudoCosts& rhs) { if (this != &rhs) { gutsOfDelete(); gutsOfCopy(rhs); } return *this; } void OsiPseudoCosts::initialize(int n) { gutsOfDelete(); numberObjects_ = n; if (numberObjects_ > 0) { upTotalChange_ = new double [numberObjects_]; downTotalChange_ = new double [numberObjects_]; upNumber_ = new int [numberObjects_]; downNumber_ = new int [numberObjects_]; CoinZeroN(upTotalChange_,numberObjects_); CoinZeroN(downTotalChange_,numberObjects_); CoinZeroN(upNumber_,numberObjects_); CoinZeroN(downNumber_,numberObjects_); } } //############################################################################## OsiChooseStrong::OsiChooseStrong() : OsiChooseVariable(), shadowPriceMode_(0), pseudoCosts_(), results_(NULL), numResults_(0) { } OsiChooseStrong::OsiChooseStrong(const OsiSolverInterface * solver) : OsiChooseVariable(solver), shadowPriceMode_(0), pseudoCosts_(), results_(NULL), numResults_(0) { // create useful arrays pseudoCosts_.initialize(solver_->numberObjects()); } OsiChooseStrong::OsiChooseStrong(const OsiChooseStrong & rhs) : OsiChooseVariable(rhs), shadowPriceMode_(rhs.shadowPriceMode_), pseudoCosts_(rhs.pseudoCosts_), results_(NULL), numResults_(0) { } OsiChooseStrong & OsiChooseStrong::operator=(const OsiChooseStrong & rhs) { if (this != &rhs) { OsiChooseVariable::operator=(rhs); shadowPriceMode_ = rhs.shadowPriceMode_; pseudoCosts_ = rhs.pseudoCosts_; delete[] results_; results_ = NULL; numResults_ = 0; } return *this; } OsiChooseStrong::~OsiChooseStrong () { delete[] results_; } // Clone OsiChooseVariable * OsiChooseStrong::clone() const { return new OsiChooseStrong(*this); } #define MAXMIN_CRITERION 0.85 // Initialize int OsiChooseStrong::setupList ( OsiBranchingInformation *info, bool initialize) { if (initialize) { status_=-2; delete [] goodSolution_; bestObjectIndex_=-1; numberStrongDone_=0; numberStrongIterations_ = 0; numberStrongFixed_ = 0; goodSolution_ = NULL; goodObjectiveValue_ = COIN_DBL_MAX; } numberOnList_=0; numberUnsatisfied_=0; int numberObjects = solver_->numberObjects(); if (numberObjects>pseudoCosts_.numberObjects()) { // redo useful arrays pseudoCosts_.initialize(numberObjects); } double check = -COIN_DBL_MAX; int checkIndex=0; int bestPriority=COIN_INT_MAX; int maximumStrong= CoinMin(numberStrong_,numberObjects) ; int putOther = numberObjects; int i; for (i=0;isolver_->objects(); // Get average pseudo costs and see if pseudo shadow prices possible int shadowPossible=shadowPriceMode_; if (shadowPossible) { for ( i=0;icanHandleShadowPrices()) { shadowPossible=0; break; } } if (shadowPossible) { int numberRows = solver_->getNumRows(); const double * pi = info->pi_; double sumPi=0.0; for (i=0;i (numberRows); // and scale back sumPi *= 0.01; info->defaultDual_ = sumPi; // switch on int numberColumns = solver_->getNumCols(); int size = CoinMax(numberColumns,2*numberRows); info->usefulRegion_ = new double [size]; CoinZeroN(info->usefulRegion_,size); info->indexRegion_ = new int [size]; } } double sumUp=0.0; double numberUp=0.0; double sumDown=0.0; double numberDown=0.0; const double* upTotalChange = pseudoCosts_.upTotalChange(); const double* downTotalChange = pseudoCosts_.downTotalChange(); const int* upNumber = pseudoCosts_.upNumber(); const int* downNumber = pseudoCosts_.downNumber(); const int numberBeforeTrusted = pseudoCosts_.numberBeforeTrusted(); for ( i=0;iinfeasibility(info,way); if (value>0.0) { numberUnsatisfied_++; if (value==COIN_DBL_MAX) { // infeasible feasible=false; break; } int priorityLevel = object[i]->priority(); #if 0 for (int k=0;k<3;k++) { if (priorityLevel==pri[k]) priCount[k]++; } #endif // Better priority? Flush choices. if (priorityLevel=0;j--) { if (list_[j]>=0) { int iObject = list_[j]; list_[j]=-1; useful_[j]=0.0; list_[--putOther]=iObject; } } maximumStrong = CoinMin(maximumStrong,putOther); bestPriority = priorityLevel; check=-COIN_DBL_MAX; checkIndex=0; } if (priorityLevel==bestPriority) { // Modify value sumUp = upTotalChange[i]+1.0e-30; numberUp = upNumber[i]; sumDown = downTotalChange[i]+1.0e-30; numberDown = downNumber[i]; double upEstimate = object[i]->upEstimate(); double downEstimate = object[i]->downEstimate(); if (shadowPossible<2) { upEstimate = numberUp ? ((upEstimate*sumUp)/numberUp) : (upEstimate*upMultiplier); if (numberUpcheck) { //add to list int iObject = list_[checkIndex]; if (iObject>=0) { assert (list_[putOther-1]<0); list_[--putOther]=iObject; // to end } list_[checkIndex]=i; assert (checkIndex=0) { if (useful_[j]=0) { list_[numberOnList_]=list_[i]; useful_[numberOnList_++]=-useful_[i]; } } if (numberOnList_) { // Sort CoinSort_2(useful_,useful_+numberOnList_,list_); // move others i = numberOnList_; for (;putOtherdefaultDual_ = -1.0; // switch off delete [] info->usefulRegion_; delete [] info->indexRegion_; return numberUnsatisfied_; } void OsiChooseStrong::resetResults(int num) { delete[] results_; numResults_ = 0; results_ = new OsiHotInfo[num]; } /* Choose a variable Returns - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from whichObject() and whichWay() We can pick up a forced branch (can change bound) from whichForcedObject() and whichForcedWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution() */ int OsiChooseStrong::chooseVariable( OsiSolverInterface * solver, OsiBranchingInformation *info, bool fixVariables) { if (numberUnsatisfied_) { const double* upTotalChange = pseudoCosts_.upTotalChange(); const double* downTotalChange = pseudoCosts_.downTotalChange(); const int* upNumber = pseudoCosts_.upNumber(); const int* downNumber = pseudoCosts_.downNumber(); int numberBeforeTrusted = pseudoCosts_.numberBeforeTrusted(); // Somehow we can get here with it 0 ! if (!numberBeforeTrusted) { numberBeforeTrusted=5; pseudoCosts_.setNumberBeforeTrusted(numberBeforeTrusted); } int numberLeft = CoinMin(numberStrong_-numberStrongDone_,numberUnsatisfied_); int numberToDo=0; resetResults(numberLeft); int returnCode=0; bestObjectIndex_ = -1; bestWhichWay_ = -1; firstForcedObjectIndex_ = -1; firstForcedWhichWay_ =-1; double bestTrusted=-COIN_DBL_MAX; for (int i=0;iobjects(), iObject); } else { const OsiObject * obj = solver->object(iObject); double upEstimate = (upTotalChange[iObject]*obj->upEstimate())/upNumber[iObject]; double downEstimate = (downTotalChange[iObject]*obj->downEstimate())/downNumber[iObject]; double value = MAXMIN_CRITERION*CoinMin(upEstimate,downEstimate) + (1.0-MAXMIN_CRITERION)*CoinMax(upEstimate,downEstimate); if (value > bestTrusted) { bestObjectIndex_=iObject; bestWhichWay_ = upEstimate>downEstimate ? 0 : 1; bestTrusted = value; } } } int numberFixed=0; if (numberToDo) { returnCode = doStrongBranching(solver, info, numberToDo, 1); if (returnCode>=0&&returnCode<=2) { if (returnCode) { returnCode=4; if (bestObjectIndex_>=0) returnCode=3; } for (int i=0;i=0); upEstimate = results_[i].upChange(); } else { // infeasible - just say expensive if (info->cutoff_<1.0e50) upEstimate = 2.0*(info->cutoff_-info->objectiveValue_); else upEstimate = 2.0*fabs(info->objectiveValue_); if (firstForcedObjectIndex_ <0) { firstForcedObjectIndex_ = iObject; firstForcedWhichWay_ =0; } numberFixed++; if (fixVariables) { const OsiObject * obj = solver->object(iObject); OsiBranchingObject * branch = obj->createBranch(solver,info,0); branch->branch(solver); delete branch; } } double downEstimate; if (results_[i].downStatus()!=1) { assert (results_[i].downStatus()>=0); downEstimate = results_[i].downChange(); } else { // infeasible - just say expensive if (info->cutoff_<1.0e50) downEstimate = 2.0*(info->cutoff_-info->objectiveValue_); else downEstimate = 2.0*fabs(info->objectiveValue_); if (firstForcedObjectIndex_ <0) { firstForcedObjectIndex_ = iObject; firstForcedWhichWay_ =1; } numberFixed++; if (fixVariables) { const OsiObject * obj = solver->object(iObject); OsiBranchingObject * branch = obj->createBranch(solver,info,1); branch->branch(solver); delete branch; } } double value = MAXMIN_CRITERION*CoinMin(upEstimate,downEstimate) + (1.0-MAXMIN_CRITERION)*CoinMax(upEstimate,downEstimate); if (value>bestTrusted) { bestTrusted = value; bestObjectIndex_ = iObject; bestWhichWay_ = upEstimate>downEstimate ? 0 : 1; // but override if there is a preferred way const OsiObject * obj = solver->object(iObject); if (obj->preferredWay()>=0&&obj->infeasibility()) bestWhichWay_ = obj->preferredWay(); if (returnCode) returnCode=2; } } } else if (returnCode==3) { // max time - just choose one bestObjectIndex_ = list_[0]; bestWhichWay_ = 0; returnCode=0; } } else { bestObjectIndex_=list_[0]; } if ( bestObjectIndex_ >=0 ) { OsiObject * obj = solver->objects()[bestObjectIndex_]; obj->setWhichWay( bestWhichWay_); } if (numberFixed==numberUnsatisfied_&&numberFixed) returnCode=4; return returnCode; } else { return 1; } } // Given a candidate fill in useful information e.g. estimates void OsiPseudoCosts::updateInformation(const OsiBranchingInformation *info, int branch, OsiHotInfo * hotInfo) { int index = hotInfo->whichObject(); assert (indexsolver_->numberObjects()); const OsiObject * object = info->solver_->object(index); assert (object->upEstimate()>0.0&&object->downEstimate()>0.0); assert (branch<2); if (branch) { if (hotInfo->upStatus()!=1) { assert (hotInfo->upStatus()>=0); upTotalChange_[index] += hotInfo->upChange()/object->upEstimate(); upNumber_[index]++; } else { #if 0 // infeasible - just say expensive if (info->cutoff_<1.0e50) upTotalChange_[index] += 2.0*(info->cutoff_-info->objectiveValue_)/object->upEstimate(); else upTotalChange_[index] += 2.0*fabs(info->objectiveValue_)/object->upEstimate(); #endif } } else { if (hotInfo->downStatus()!=1) { assert (hotInfo->downStatus()>=0); downTotalChange_[index] += hotInfo->downChange()/object->downEstimate(); downNumber_[index]++; } else { #if 0 // infeasible - just say expensive if (info->cutoff_<1.0e50) downTotalChange_[index] += 2.0*(info->cutoff_-info->objectiveValue_)/object->downEstimate(); else downTotalChange_[index] += 2.0*fabs(info->objectiveValue_)/object->downEstimate(); #endif } } } #if 1 // Given a branch fill in useful information e.g. estimates void OsiPseudoCosts::updateInformation(int index, int branch, double changeInObjective, double changeInValue, int status) { //assert (indexnumberObjects()); assert (branch<2); assert (changeInValue>0.0); assert (branch<2); if (branch) { if (status!=1) { assert (status>=0); upTotalChange_[index] += changeInObjective/changeInValue; upNumber_[index]++; } } else { if (status!=1) { assert (status>=0); downTotalChange_[index] += changeInObjective/changeInValue; downNumber_[index]++; } } } #endif OsiHotInfo::OsiHotInfo() : originalObjectiveValue_(COIN_DBL_MAX), changes_(NULL), iterationCounts_(NULL), statuses_(NULL), branchingObject_(NULL), whichObject_(-1) { } OsiHotInfo::OsiHotInfo(OsiSolverInterface * solver, const OsiBranchingInformation * info, const OsiObject * const * objects, int whichObject) : originalObjectiveValue_(COIN_DBL_MAX), whichObject_(whichObject) { originalObjectiveValue_ = info->objectiveValue_; const OsiObject * object = objects[whichObject_]; // create object - "down" first branchingObject_ = object->createBranch(solver,info,0); // create arrays int numberBranches = branchingObject_->numberBranches(); changes_ = new double [numberBranches]; iterationCounts_ = new int [numberBranches]; statuses_ = new int [numberBranches]; CoinZeroN(changes_,numberBranches); CoinZeroN(iterationCounts_,numberBranches); CoinFillN(statuses_,numberBranches,-1); } OsiHotInfo::OsiHotInfo(const OsiHotInfo & rhs) { originalObjectiveValue_ = rhs.originalObjectiveValue_; whichObject_ = rhs.whichObject_; if (rhs.branchingObject_) { branchingObject_ = rhs.branchingObject_->clone(); int numberBranches = branchingObject_->numberBranches(); changes_ = CoinCopyOfArray(rhs.changes_,numberBranches); iterationCounts_ = CoinCopyOfArray(rhs.iterationCounts_,numberBranches); statuses_ = CoinCopyOfArray(rhs.statuses_,numberBranches); } else { branchingObject_ = NULL; changes_ = NULL; iterationCounts_ = NULL; statuses_ = NULL; } } OsiHotInfo & OsiHotInfo::operator=(const OsiHotInfo & rhs) { if (this != &rhs) { delete branchingObject_; delete [] changes_; delete [] iterationCounts_; delete [] statuses_; originalObjectiveValue_ = rhs.originalObjectiveValue_; whichObject_ = rhs.whichObject_; if (rhs.branchingObject_) { branchingObject_ = rhs.branchingObject_->clone(); int numberBranches = branchingObject_->numberBranches(); changes_ = CoinCopyOfArray(rhs.changes_,numberBranches); iterationCounts_ = CoinCopyOfArray(rhs.iterationCounts_,numberBranches); statuses_ = CoinCopyOfArray(rhs.statuses_,numberBranches); } else { branchingObject_ = NULL; changes_ = NULL; iterationCounts_ = NULL; statuses_ = NULL; } } return *this; } OsiHotInfo::~OsiHotInfo () { delete branchingObject_; delete [] changes_; delete [] iterationCounts_; delete [] statuses_; } // Clone OsiHotInfo * OsiHotInfo::clone() const { return new OsiHotInfo(*this); } /* Fill in useful information after strong branch */ int OsiHotInfo::updateInformation( const OsiSolverInterface * solver, const OsiBranchingInformation * info, OsiChooseVariable * choose) { int iBranch = branchingObject_->branchIndex()-1; assert (iBranch>=0&&iBranchnumberBranches()); iterationCounts_[iBranch] += solver->getIterationCount(); int status; if (solver->isProvenOptimal()) status=0; // optimal else if (solver->isIterationLimitReached() &&!solver->isDualObjectiveLimitReached()) status=2; // unknown else status=1; // infeasible // Could do something different if we can't trust double newObjectiveValue = solver->getObjSense()*solver->getObjValue(); changes_[iBranch] =CoinMax(0.0,newObjectiveValue-originalObjectiveValue_); // we might have got here by primal if (choose->trustStrongForBound()) { if (!status&&newObjectiveValue>=info->cutoff_) { status=1; // infeasible changes_[iBranch] = 1.0e100; } } statuses_[iBranch] = status; if (!status&&choose->trustStrongForSolution()&&newObjectiveValuegoodObjectiveValue()) { // check if solution const OsiSolverInterface * saveSolver = info->solver_; info->solver_=solver; const double * saveLower = info->lower_; info->lower_ = solver->getColLower(); const double * saveUpper = info->upper_; info->upper_ = solver->getColUpper(); // also need to make sure bounds OK as may not be info solver #if 0 if (saveSolver->getMatrixByCol()) { const CoinBigIndex * columnStart = info->columnStart_; assert (saveSolver->getMatrixByCol()->getVectorStarts()==columnStart); } #endif if (choose->feasibleSolution(info,solver->getColSolution(),solver->numberObjects(), const_cast (solver->objects()))) { // put solution somewhere choose->saveSolution(solver); status=3; } info->solver_=saveSolver; info->lower_ = saveLower; info->upper_ = saveUpper; } // Now update - possible strong branching info choose->updateInformation( info,iBranch,this); return status; } CoinMP-1.8.3/Osi/src/Osi/OsiRowCut.hpp0000644000175000017500000002050511575423733016012 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiRowCut_H #define OsiRowCut_H #include "CoinPackedVector.hpp" #include "OsiCollections.hpp" #include "OsiCut.hpp" //#define OSI_INLINE_ROWCUT_METHODS #ifdef OSI_INLINE_ROWCUT_METHODS #define OsiRowCut_inline inline #else #define OsiRowCut_inline #endif /** Row Cut Class A row cut has:
  • a lower bound
  • an upper bound
  • a vector of row elements
*/ class OsiRowCut : public OsiCut { friend void OsiRowCutUnitTest(const OsiSolverInterface * baseSiP, const std::string & mpsDir); public: /**@name Row bounds */ //@{ /// Get lower bound OsiRowCut_inline double lb() const; /// Set lower bound OsiRowCut_inline void setLb(double lb); /// Get upper bound OsiRowCut_inline double ub() const; /// Set upper bound OsiRowCut_inline void setUb(double ub); //@} /**@name Row rhs, sense, range */ //@{ /// Get sense ('E', 'G', 'L', 'N', 'R') char sense() const; /// Get right-hand side double rhs() const; /// Get range (ub - lb for 'R' rows, 0 otherwise) double range() const; //@} //------------------------------------------------------------------- /**@name Row elements */ //@{ /// Set row elements OsiRowCut_inline void setRow( int size, const int * colIndices, const double * elements, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /// Set row elements from a packed vector OsiRowCut_inline void setRow( const CoinPackedVector & v ); /// Get row elements OsiRowCut_inline const CoinPackedVector & row() const; /// Get row elements for changing OsiRowCut_inline CoinPackedVector & mutableRow() ; //@} /**@name Comparison operators */ //@{ #if __GNUC__ != 2 using OsiCut::operator== ; #endif /** equal - true if lower bound, upper bound, row elements, and OsiCut are equal. */ OsiRowCut_inline bool operator==(const OsiRowCut& rhs) const; #if __GNUC__ != 2 using OsiCut::operator!= ; #endif /// not equal OsiRowCut_inline bool operator!=(const OsiRowCut& rhs) const; //@} //---------------------------------------------------------------- /**@name Sanity checks on cut */ //@{ /** Returns true if the cut is consistent. This checks to ensure that:
  • The row element vector does not have duplicate indices
  • The row element vector indices are >= 0
*/ OsiRowCut_inline bool consistent() const; /** Returns true if cut is consistent with respect to the solver interface's model. This checks to ensure that
  • The row element vector indices are < the number of columns in the model
*/ OsiRowCut_inline bool consistent(const OsiSolverInterface& im) const; /** Returns true if the row cut itself is infeasible and cannot be satisfied. This checks whether
  • the lower bound is strictly greater than the upper bound.
*/ OsiRowCut_inline bool infeasible(const OsiSolverInterface &im) const; /** Returns infeasibility of the cut with respect to solution passed in i.e. is positive if cuts off that solution. solution is getNumCols() long.. */ virtual double violated(const double * solution) const; //@} /**@name Arithmetic operators. Apply CoinPackedVector methods to the vector */ //@{ /// add value to every vector entry void operator+=(double value) { row_ += value; } /// subtract value from every vector entry void operator-=(double value) { row_ -= value; } /// multiply every vector entry by value void operator*=(double value) { row_ *= value; } /// divide every vector entry by value void operator/=(double value) { row_ /= value; } //@} /// Allow access row sorting function void sortIncrIndex() {row_.sortIncrIndex();} /**@name Constructors and destructors */ //@{ /// Assignment operator OsiRowCut & operator=( const OsiRowCut& rhs); /// Copy constructor OsiRowCut ( const OsiRowCut &); /// Clone virtual OsiRowCut * clone() const; /// Default Constructor OsiRowCut (); /** \brief Ownership Constructor This constructor assumes ownership of the vectors passed as parameters for indices and elements. \p colIndices and \p elements will be NULL on return. */ OsiRowCut(double cutlb, double cutub, int capacity, int size, int *&colIndices, double *&elements); /// Destructor virtual ~OsiRowCut (); //@} /**@name Debug stuff */ //@{ /// Print cuts in collection virtual void print() const ; //@} private: /**@name Private member data */ //@{ /// Row elements CoinPackedVector row_; /// Row lower bound double lb_; /// Row upper bound double ub_; //@} }; #ifdef OSI_INLINE_ROWCUT_METHODS //------------------------------------------------------------------- // Set/Get lower & upper bounds //------------------------------------------------------------------- double OsiRowCut::lb() const { return lb_; } void OsiRowCut::setLb(double lb) { lb_ = lb; } double OsiRowCut::ub() const { return ub_; } void OsiRowCut::setUb(double ub) { ub_ = ub; } //------------------------------------------------------------------- // Set row elements //------------------------------------------------------------------- void OsiRowCut::setRow(int size, const int * colIndices, const double * elements) { row_.setVector(size,colIndices,elements); } void OsiRowCut::setRow( const CoinPackedVector & v ) { row_ = v; } //------------------------------------------------------------------- // Get the row //------------------------------------------------------------------- const CoinPackedVector & OsiRowCut::row() const { return row_; } //------------------------------------------------------------------- // Get the row so we can change //------------------------------------------------------------------- CoinPackedVector & OsiRowCut::mutableRow() { return row_; } //---------------------------------------------------------------- // == operator //------------------------------------------------------------------- bool OsiRowCut::operator==(const OsiRowCut& rhs) const { if ( this->OsiCut::operator!=(rhs) ) return false; if ( row() != rhs.row() ) return false; if ( lb() != rhs.lb() ) return false; if ( ub() != rhs.ub() ) return false; return true; } bool OsiRowCut::operator!=(const OsiRowCut& rhs) const { return !( (*this)==rhs ); } //---------------------------------------------------------------- // consistent & infeasible //------------------------------------------------------------------- bool OsiRowCut::consistent() const { const CoinPackedVector & r=row(); r.duplicateIndex("consistent", "OsiRowCut"); if ( r.getMinIndex() < 0 ) return false; return true; } bool OsiRowCut::consistent(const OsiSolverInterface& im) const { const CoinPackedVector & r=row(); if ( r.getMaxIndex() >= im.getNumCols() ) return false; return true; } bool OsiRowCut::infeasible(const OsiSolverInterface &im) const { if ( lb() > ub() ) return true; return false; } #endif /** Row Cut Class which refers back to row which created it. It may be useful to strengthen a row rather than add a cut. To do this we need to know which row is strengthened. This trivial extension to OsiRowCut does that. */ class OsiRowCut2 : public OsiRowCut { public: /**@name Which row */ //@{ /// Get row inline int whichRow() const { return whichRow_;} /// Set row inline void setWhichRow(int row) { whichRow_=row;} //@} /**@name Constructors and destructors */ //@{ /// Assignment operator OsiRowCut2 & operator=( const OsiRowCut2& rhs); /// Copy constructor OsiRowCut2 ( const OsiRowCut2 &); /// Clone virtual OsiRowCut * clone() const; /// Default Constructor OsiRowCut2 (int row=-1); /// Destructor virtual ~OsiRowCut2 (); //@} private: /**@name Private member data */ //@{ /// Which row int whichRow_; //@} }; #endif CoinMP-1.8.3/Osi/src/Osi/OsiSolverBranch.cpp0000644000175000017500000003425611552534623017156 0ustar renerene// Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinHelperFunctions.hpp" #include "CoinWarmStartBasis.hpp" #include "OsiConfig.h" #include "CoinFinite.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include #include #include //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiSolverBranch::OsiSolverBranch () : indices_(NULL), bound_(NULL) { memset(start_,0,sizeof(start_)); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiSolverBranch::OsiSolverBranch (const OsiSolverBranch & rhs) { memcpy(start_,rhs.start_,sizeof(start_)); int size = start_[4]; if (size) { indices_ = CoinCopyOfArray(rhs.indices_,size); bound_ = CoinCopyOfArray(rhs.bound_,size); } else { indices_=NULL; bound_=NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiSolverBranch::~OsiSolverBranch () { delete [] indices_; delete [] bound_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiSolverBranch & OsiSolverBranch::operator=(const OsiSolverBranch& rhs) { if (this != &rhs) { delete [] indices_; delete [] bound_; memcpy(start_,rhs.start_,sizeof(start_)); int size = start_[4]; if (size) { indices_ = CoinCopyOfArray(rhs.indices_,size); bound_ = CoinCopyOfArray(rhs.bound_,size); } else { indices_=NULL; bound_=NULL; } } return *this; } //----------------------------------------------------------------------------- // add simple branch //----------------------------------------------------------------------------- void OsiSolverBranch::addBranch(int iColumn, double value) { delete [] indices_; delete [] bound_; indices_ = new int[2]; bound_ = new double[2]; indices_[0]=iColumn; indices_[1]=iColumn; start_[0]=0; start_[1]=0; start_[2]=1; bound_[0]=floor(value); start_[3]=2; bound_[1]=ceil(value); start_[4]=2; assert (bound_[0]!=bound_[1]); } //----------------------------------------------------------------------------- // Add bounds - way =-1 is first , +1 is second //----------------------------------------------------------------------------- void OsiSolverBranch::addBranch(int way,int numberTighterLower, const int * whichLower, const double * newLower, int numberTighterUpper, const int * whichUpper, const double * newUpper) { assert (way==-1||way==1); int numberNew = numberTighterLower+numberTighterUpper; int base = way+1; // will be 0 or 2 int numberNow = start_[4-base]-start_[2-base]; int * tempI = new int[numberNow+numberNew]; double * tempD = new double[numberNow+numberNew]; int putNew = (way==-1) ? 0 : start_[2]; int putNow = (way==-1) ? numberNew : 0; memcpy(tempI+putNow,indices_+start_[2-base],numberNow*sizeof(int)); memcpy(tempD+putNow,bound_+start_[2-base],numberNow*sizeof(double)); memcpy(tempI+putNew,whichLower,numberTighterLower*sizeof(int)); memcpy(tempD+putNew,newLower,numberTighterLower*sizeof(double)); putNew += numberTighterLower; memcpy(tempI+putNew,whichUpper,numberTighterUpper*sizeof(int)); memcpy(tempD+putNew,newUpper,numberTighterUpper*sizeof(double)); delete [] indices_; indices_ = tempI; delete [] bound_; bound_ = tempD; int numberOldLower = start_[3-base]-start_[2-base]; int numberOldUpper = start_[4-base]-start_[3-base]; start_[0]=0; if (way==-1) { start_[1] = numberTighterLower; start_[2] = start_[1] + numberTighterUpper; start_[3] = start_[2] + numberOldLower; start_[4] = start_[3] + numberOldUpper; } else { start_[1] = numberOldLower; start_[2] = start_[1] + numberOldUpper; start_[3] = start_[2] + numberTighterLower; start_[4] = start_[3] + numberTighterUpper; } } //----------------------------------------------------------------------------- // Add bounds - way =-1 is first , +1 is second //----------------------------------------------------------------------------- void OsiSolverBranch::addBranch(int way,int numberColumns, const double * oldLower, const double * newLower2, const double * oldUpper, const double * newUpper2) { assert (way==-1||way==1); // find int i; int * whichLower = new int[numberColumns]; double * newLower = new double[numberColumns]; int numberTighterLower=0; for (i=0;ioldLower[i]) { whichLower[numberTighterLower]=i; newLower[numberTighterLower++]=newLower2[i]; } } int * whichUpper = new int[numberColumns]; double * newUpper = new double[numberColumns]; int numberTighterUpper=0; for (i=0;ivalue+primalTolerance) { feasible=false; break; } } else { abort(); // do later (other stuff messed up anyway - e.g. CBC) } } if (feasible) break; // OK this way } return feasible; } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiSolverResult::OsiSolverResult () : objectiveValue_(COIN_DBL_MAX), primalSolution_(NULL), dualSolution_(NULL) { } //------------------------------------------------------------------- // Constructor from solver //------------------------------------------------------------------- OsiSolverResult::OsiSolverResult (const OsiSolverInterface & solver,const double * lowerBefore, const double * upperBefore) : objectiveValue_(COIN_DBL_MAX), primalSolution_(NULL), dualSolution_(NULL) { if (solver.isProvenOptimal()&&!solver.isDualObjectiveLimitReached()) { objectiveValue_ = solver.getObjValue()*solver.getObjSense(); CoinWarmStartBasis * basis = dynamic_cast (solver.getWarmStart()); assert (basis); basis_ = * basis; delete basis; int numberRows = basis_.getNumArtificial(); int numberColumns = basis_.getNumStructural(); assert (numberColumns==solver.getNumCols()); assert (numberRows==solver.getNumRows()); primalSolution_ = CoinCopyOfArray(solver.getColSolution(),numberColumns); dualSolution_ = CoinCopyOfArray(solver.getRowPrice(),numberRows); fixed_.addBranch(-1,numberColumns,lowerBefore,solver.getColLower(), upperBefore,solver.getColUpper()); } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiSolverResult::OsiSolverResult (const OsiSolverResult & rhs) { objectiveValue_ = rhs.objectiveValue_; basis_ = rhs.basis_; fixed_ = rhs.fixed_; int numberRows = basis_.getNumArtificial(); int numberColumns = basis_.getNumStructural(); if (numberColumns) { primalSolution_ = CoinCopyOfArray(rhs.primalSolution_,numberColumns); dualSolution_ = CoinCopyOfArray(rhs.dualSolution_,numberRows); } else { primalSolution_=NULL; dualSolution_=NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiSolverResult::~OsiSolverResult () { delete [] primalSolution_; delete [] dualSolution_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiSolverResult & OsiSolverResult::operator=(const OsiSolverResult& rhs) { if (this != &rhs) { delete [] primalSolution_; delete [] dualSolution_; objectiveValue_ = rhs.objectiveValue_; basis_ = rhs.basis_; fixed_ = rhs.fixed_; int numberRows = basis_.getNumArtificial(); int numberColumns = basis_.getNumStructural(); if (numberColumns) { primalSolution_ = CoinCopyOfArray(rhs.primalSolution_,numberColumns); dualSolution_ = CoinCopyOfArray(rhs.dualSolution_,numberRows); } else { primalSolution_=NULL; dualSolution_=NULL; } } return *this; } // Create result void OsiSolverResult::createResult(const OsiSolverInterface & solver, const double * lowerBefore, const double * upperBefore) { delete [] primalSolution_; delete [] dualSolution_; if (solver.isProvenOptimal()&&!solver.isDualObjectiveLimitReached()) { objectiveValue_ = solver.getObjValue()*solver.getObjSense(); CoinWarmStartBasis * basis = dynamic_cast (solver.getWarmStart()); assert (basis); basis_ = * basis; int numberRows = basis_.getNumArtificial(); int numberColumns = basis_.getNumStructural(); assert (numberColumns==solver.getNumCols()); assert (numberRows==solver.getNumRows()); primalSolution_ = CoinCopyOfArray(solver.getColSolution(),numberColumns); dualSolution_ = CoinCopyOfArray(solver.getRowPrice(),numberRows); fixed_.addBranch(-1,numberColumns,lowerBefore,solver.getColLower(), upperBefore,solver.getColUpper()); } else { // infeasible objectiveValue_ = COIN_DBL_MAX; basis_ = CoinWarmStartBasis();; primalSolution_=NULL; dualSolution_=NULL; } } // Restore result void OsiSolverResult::restoreResult(OsiSolverInterface & solver) const { //solver.setObjValue(objectiveValue_)*solver.getObjSense(); solver.setWarmStart(&basis_); solver.setColSolution(primalSolution_); solver.setRowPrice(dualSolution_); fixed_.applyBounds(solver,-1); } CoinMP-1.8.3/Osi/src/Osi/config_osi_default.h0000644000175000017500000000110712600104755017362 0ustar renerene /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC PUBLIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Version number of project */ #define OSI_VERSION "0.107.6" /* Major Version number of project */ #define OSI_VERSION_MAJOR 0 /* Minor Version number of project */ #define OSI_VERSION_MINOR 107 /* Release Version number of project */ #define OSI_VERSION_RELEASE 6 CoinMP-1.8.3/Osi/src/Osi/OsiCut.cpp0000644000175000017500000000345311510425067015307 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "OsiCut.hpp" //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiCut::OsiCut () : effectiveness_(0.), globallyValid_(0) //timesUsed_(0), //timesTested_(0) { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiCut::OsiCut ( const OsiCut & source) : effectiveness_(source.effectiveness_), globallyValid_(source.globallyValid_) //timesUsed_(source.timesUsed_), //timesTested_(source.timesTested_) { // nothing to do here } #if 0 //---------------------------------------------------------------- // Clone //---------------------------------------------------------------- OsiCut * OsiCut::clone() const { return (new OsiCut(*this));} #endif //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiCut::~OsiCut () { // nothing to do here } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiCut & OsiCut::operator=(const OsiCut& rhs) { if (this != &rhs) { effectiveness_=rhs.effectiveness_; globallyValid_ = rhs.globallyValid_; //timesUsed_=rhs.timesUsed_; //timesTested_=rhs.timesTested_; } return *this; } CoinMP-1.8.3/Osi/src/Osi/OsiPresolve.cpp0000644000175000017500000014036312471574120016357 0ustar renerene// Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Debug compile symbols for CoinPresolve. PRESOLVE_CONSISTENCY, PRESOLVE_DEBUG, and PRESOLVE_SUMMARY control consistency checking and debugging in the continuous presolve. See the comments in CoinPresolvePsdebug.hpp. DO NOT just define the symbols here in this file. Unless these symbols are consistent across all presolve code, you'll get something between garbage and a core dump. */ #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinFinite.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" #include "OsiSolverInterface.hpp" #include "OsiPresolve.hpp" #include "CoinPresolveMatrix.hpp" #if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 || PRESOLVE_SUMMARY > 0 #include "CoinPresolvePsdebug.hpp" #include "CoinPresolveMonitor.hpp" #endif #include "CoinPresolveEmpty.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolveSingleton.hpp" #include "CoinPresolveDoubleton.hpp" #include "CoinPresolveTripleton.hpp" #include "CoinPresolveZeros.hpp" #include "CoinPresolveSubst.hpp" #include "CoinPresolveForcing.hpp" #include "CoinPresolveDual.hpp" #include "CoinPresolveTighten.hpp" #include "CoinPresolveUseless.hpp" #include "CoinPresolveDupcol.hpp" #include "CoinPresolveImpliedFree.hpp" #include "CoinPresolveIsolated.hpp" #include "CoinMessage.hpp" OsiPresolve::OsiPresolve() : originalModel_(NULL), presolvedModel_(NULL), nonLinearValue_(0.0), originalColumn_(NULL), originalRow_(NULL), paction_(0), ncols_(0), nrows_(0), nelems_(0), presolveActions_(0), numberPasses_(5) { } OsiPresolve::~OsiPresolve() { gutsOfDestroy(); } // Gets rid of presolve actions (e.g.when infeasible) void OsiPresolve::gutsOfDestroy() { const CoinPresolveAction *paction = paction_; while (paction) { const CoinPresolveAction *next = paction->next; delete paction; paction = next; } delete [] originalColumn_; delete [] originalRow_; paction_=NULL; originalColumn_=NULL; originalRow_=NULL; } /* This version of presolve returns a pointer to a new presolved model. NULL if infeasible doStatus controls activities required to transform an existing solution to match the presolved problem. I'd (lh) argue that this should default to false, but to maintain previous behaviour it defaults to true. Really, this is only useful if you've already optimised before applying presolve and also want to work with the solution after presolve. I think that this is the less common case. The more common situation is to apply presolve before optimising. */ OsiSolverInterface * OsiPresolve::presolvedModel(OsiSolverInterface & si, double feasibilityTolerance, bool keepIntegers, int numberPasses, const char * prohibited, bool doStatus, const char * rowProhibited) { ncols_ = si.getNumCols(); nrows_ = si.getNumRows(); nelems_ = si.getNumElements(); numberPasses_ = numberPasses; double maxmin = si.getObjSense(); originalModel_ = &si; delete [] originalColumn_; originalColumn_ = new int[ncols_]; delete [] originalRow_; originalRow_ = new int[nrows_]; int i; for (i=0;isetContinuous(i); } CoinPresolveMatrix prob(ncols_, maxmin, presolvedModel_, nrows_, nelems_,doStatus,nonLinearValue_,prohibited, rowProhibited); // make sure row solution correct if (doStatus) { double *colels = prob.colels_; int *hrow = prob.hrow_; CoinBigIndex *mcstrt = prob.mcstrt_; int *hincol = prob.hincol_; int ncols = prob.ncols_; double * csol = prob.sol_; double * acts = prob.acts_; int nrows = prob.nrows_; int colx; memset(acts,0,nrows*sizeof(double)); for (colx = 0; colx < ncols; ++colx) { double solutionValue = csol[colx]; for (int i=mcstrt[colx]; i 0 if (doStatus) { int basicCnt = 0 ; int basicColumns = 0; int i ; CoinPresolveMatrix::Status status ; for (i = 0 ; i < prob.ncols_ ; i++) { status = prob.getColumnStatus(i); if (status == CoinPrePostsolveMatrix::basic) basicColumns++ ; } basicCnt = basicColumns; for (i = 0 ; i < prob.nrows_ ; i++) { status = prob.getRowStatus(i); if (status == CoinPrePostsolveMatrix::basic) basicCnt++ ; } # if PRESOLVE_DEBUG > 0 presolve_check_nbasic(&prob) ; # endif if (basicCnt>prob.nrows_) { // Take out slacks double * acts = prob.acts_; double * rlo = prob.rlo_; double * rup = prob.rup_; double infinity = si.getInfinity(); for (i = 0 ; i < prob.nrows_ ; i++) { status = prob.getRowStatus(i); if (status == CoinPrePostsolveMatrix::basic) { basicCnt-- ; double down = acts[i]-rlo[i]; double up = rup[i]-acts[i]; if (CoinMin(up,down)setColSolution(prob.sol_); CoinWarmStartBasis *basis = dynamic_cast(presolvedModel_->getEmptyWarmStart()); basis->resize(prob.nrows_,prob.ncols_); int i; for (i=0;i (prob.getColumnStatus(i)); basis->setStructStatus(i,status); } for (i=0;i (prob.getRowStatus(i)); basis->setArtifStatus(i,status); } presolvedModel_->setWarmStart(basis); delete basis ; delete [] prob.sol_; delete [] prob.acts_; delete [] prob.colstat_; prob.sol_=NULL; prob.acts_=NULL; prob.colstat_=NULL; } /* Copy original column and row information from the CoinPresolveMatrix object so it'll be available for postsolve. */ int ncolsNow = presolvedModel_->getNumCols(); memcpy(originalColumn_,prob.originalColumn_,ncolsNow*sizeof(int)); delete [] prob.originalColumn_; prob.originalColumn_=NULL; int nrowsNow = presolvedModel_->getNumRows(); memcpy(originalRow_,prob.originalRow_,nrowsNow*sizeof(int)); delete [] prob.originalRow_; prob.originalRow_=NULL; // now clean up integer variables. This can modify original { int numberChanges=0; const double * lower0 = originalModel_->getColLower(); const double * upper0 = originalModel_->getColUpper(); const double * lower = presolvedModel_->getColLower(); const double * upper = presolvedModel_->getColUpper(); for (i=0;iisInteger(i)) continue; int iOriginal = originalColumn_[i]; double lowerValue0 = lower0[iOriginal]; double upperValue0 = upper0[iOriginal]; double lowerValue = ceil(lower[i]-1.0e-5); double upperValue = floor(upper[i]+1.0e-5); presolvedModel_->setColBounds(i,lowerValue,upperValue); if (lowerValue>upperValue) { numberChanges++; CoinMessageHandler *hdlr = presolvedModel_->messageHandler() ; hdlr->message(COIN_PRESOLVE_COLINFEAS,msgs) << iOriginal << lowerValue << upperValue << CoinMessageEol ; result=1; } else { if (lowerValue>lowerValue0+1.0e-8) { originalModel_->setColLower(iOriginal,lowerValue); numberChanges++; } if (upperValuesetColUpper(iOriginal,upperValue); numberChanges++; } } } if (numberChanges) { CoinMessageHandler *hdlr = presolvedModel_->messageHandler() ; hdlr->message(COIN_PRESOLVE_INTEGERMODS,msgs) << numberChanges << CoinMessageEol; // we can't go round again in integer if dupcols if (!result && totalPasses > 0 && (prob.presolveOptions_&0x80000000) == 0) { result = -1; // round again const CoinPresolveAction *paction = paction_; while (paction) { const CoinPresolveAction *next = paction->next; delete paction; paction = next; } paction_=NULL; } } } } else if (prob.status_ != 0) { // infeasible or unbounded result = 1 ; } } if (!result) { int nrowsAfter = presolvedModel_->getNumRows(); int ncolsAfter = presolvedModel_->getNumCols(); CoinBigIndex nelsAfter = presolvedModel_->getNumElements(); CoinMessageHandler *hdlr = presolvedModel_->messageHandler() ; hdlr->message(COIN_PRESOLVE_STATS,msgs) << nrowsAfter << -(nrows_-nrowsAfter) << ncolsAfter << -(ncols_-ncolsAfter) << nelsAfter << -(nelems_-nelsAfter) << CoinMessageEol ; } else { gutsOfDestroy(); delete presolvedModel_; presolvedModel_=NULL; } return presolvedModel_; } // Return pointer to presolved model OsiSolverInterface * OsiPresolve::model() const { return presolvedModel_; } // Return pointer to original model OsiSolverInterface * OsiPresolve::originalModel() const { return originalModel_; } void OsiPresolve::postsolve(bool updateStatus) { // Messages CoinMessages msgs = CoinMessage(presolvedModel_->messages().language()) ; CoinMessageHandler *hdlr = presolvedModel_->messageHandler() ; if (!presolvedModel_->isProvenOptimal()) { hdlr->message(COIN_PRESOLVE_NONOPTIMAL,msgs) << CoinMessageEol ; } // this is the size of the original problem const int ncols0 = ncols_ ; const int nrows0 = nrows_ ; const CoinBigIndex nelems0 = nelems_ ; // reality check assert(ncols0 == originalModel_->getNumCols()) ; assert(nrows0 == originalModel_->getNumRows()) ; // this is the reduced problem int ncols = presolvedModel_->getNumCols() ; int nrows = presolvedModel_->getNumRows() ; double *acts = new double [nrows0] ; double *sol = new double [ncols0] ; CoinZeroN(acts,nrows0) ; CoinZeroN(sol,ncols0) ; unsigned char *rowstat = NULL ; unsigned char *colstat = NULL ; CoinWarmStartBasis *presolvedBasis = dynamic_cast(presolvedModel_->getWarmStart()) ; if (!presolvedBasis) updateStatus = false ; if (updateStatus) { colstat = new unsigned char[ncols0+nrows0] ; # ifdef ZEROFAULT memset(colstat,0,((ncols0+nrows0)*sizeof(char))) ; # endif rowstat = colstat+ncols0 ; for (int i = 0 ; i < ncols ; i++) { colstat[i] = presolvedBasis->getStructStatus(i) ; } for (int i = 0 ; i < nrows ; i++) { rowstat[i] = presolvedBasis->getArtifStatus(i) ; } } delete presolvedBasis ; # if PRESOLVE_CONSISTENCY > 0 if (updateStatus) { int basicCnt = 0 ; for (int i = 0 ; i < ncols ; i++) { if (colstat[i] == CoinWarmStartBasis::basic) basicCnt++ ; } for (int i = 0 ; i < nrows ; i++) { if (rowstat[i] == CoinWarmStartBasis::basic) basicCnt++ ; } assert (basicCnt == nrows) ; } # endif /* Postsolve back to the original problem. The CoinPostsolveMatrix object assumes ownership of sol, acts, colstat, and rowstat. */ CoinPostsolveMatrix prob(presolvedModel_,ncols0,nrows0,nelems0, presolvedModel_->getObjSense(), sol,acts,colstat,rowstat) ; postsolve(prob) ; # if PRESOLVE_CONSISTENCY > 0 if (updateStatus) { int basicCnt = 0 ; for (int i = 0 ; i < ncols0 ; i++) { if (prob.getColumnStatus(i) == CoinPrePostsolveMatrix::basic) basicCnt++ ; } for (int i = 0 ; i < nrows0 ; i++) { if (prob.getRowStatus(i) == CoinPrePostsolveMatrix::basic) basicCnt++ ; } assert (basicCnt == nrows0) ; } # endif originalModel_->setColSolution(sol) ; if (updateStatus) { CoinWarmStartBasis *basis = dynamic_cast(presolvedModel_->getEmptyWarmStart()) ; basis->setSize(ncols0,nrows0) ; for (int i = 0 ; i < ncols0 ; i++) { CoinWarmStartBasis::Status status = static_cast(prob.getColumnStatus(i)) ; assert(status != CoinWarmStartBasis::atLowerBound || originalModel_->getColLower()[i] > -originalModel_->getInfinity()) ; assert(status != CoinWarmStartBasis::atUpperBound || originalModel_->getColUpper()[i] < originalModel_->getInfinity()) ; basis->setStructStatus(i,status); } # if PRESOLVE_DEBUG > 0 /* Do a thorough check of row and column solutions. There should be no inconsistencies at this point. */ std::cout << "Checking solution before transferring basis." << std::endl ; presolve_check_sol(&prob,2,2,2) ; int errs = 0 ; # endif for (int i = 0 ; i < nrows0 ; i++) { CoinWarmStartBasis::Status status = static_cast(prob.getRowStatus(i)) ; basis->setArtifStatus(i,status); } originalModel_->setWarmStart(basis); delete basis ; } } // return pointer to original columns const int * OsiPresolve::originalColumns() const { return originalColumn_; } // return pointer to original rows const int * OsiPresolve::originalRows() const { return originalRow_; } // Set pointer to original model void OsiPresolve::setOriginalModel(OsiSolverInterface * model) { originalModel_=model; } #if 0 // A lazy way to restrict which transformations are applied // during debugging. static int ATOI(const char *name) { return true; #if PRESOLVE_DEBUG > 0 || PRESOLVE_SUMMARY > 0 if (getenv(name)) { int val = atoi(getenv(name)); printf("%s = %d\n", name, val); return (val); } else { if (strcmp(name,"off")) return (true); else return (false); } #else return (true); #endif } #endif #if PRESOLVE_DEBUG > 0 // Anonymous namespace for debug routines namespace { /* A control routine for debug checks --- keeps down the clutter in doPresolve. Each time it's called, it prints a list of transforms applied since the last call, then does checks. */ void check_and_tell (const CoinPresolveMatrix *const prob, const CoinPresolveAction *first, const CoinPresolveAction *&mark) { const CoinPresolveAction *current ; if (first != mark) { printf("PRESOLVE: applied") ; for (current = first ; current != mark && current != 0 ; current = current->next) { printf(" %s",current->name()) ; } printf("\n") ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; mark = first ; } return ; } /* At a guess, this code is intended to allow a known solution to be checked against presolve progress. Pulled it into the local debug namespace, but really should be integrated with CoinPresolvePsdebug. At the least, needs a method to conveniently set debugSolution. -- lh, 110605 -- */ double *debugSolution = NULL ; int debugNumberColumns = -1 ; int counter = 1000000 ; bool break2 (CoinPresolveMatrix *prob) { if (counter > 0) printf("break2: counter %d\n",counter) ; counter-- ; if (debugSolution && prob->ncols_ == debugNumberColumns) { for (int i = 0 ; i < prob->ncols_ ; i++) { double value = debugSolution[i] ; if (value < prob->clo_[i]) { printf("%d inf %g %g %g\n",i,prob->clo_[i],value,prob->cup_[i]) ; } else if (value > prob->cup_[i]) { printf("%d inf %g %g %g\n",i,prob->clo_[i],value,prob->cup_[i]) ; } } } if (!counter) { printf("skipping next and all\n") ; } return (counter <= 0) ; } } // end anonymous namespace for debug routines #endif #if PRESOLVE_DEBUG > 0 # define possibleBreak if (break2(prob)) break # define possibleSkip if (!break2(prob)) #else # define possibleBreak # define possibleSkip #endif // This is the presolve loop. // It is a separate virtual function so that it can be easily // customized by subclassing CoinPresolve. const CoinPresolveAction *OsiPresolve::presolve(CoinPresolveMatrix *prob) { paction_ = 0 ; prob->status_ = 0 ; // say feasible # if PRESOLVE_DEBUG > 0 const CoinPresolveAction *pactiond = 0 ; presolve_check_sol(prob,2,1,1) ; // CoinPresolveMonitor *monitor = new CoinPresolveMonitor(prob,true,22) ; CoinPresolveMonitor *monitor = 0 ; # endif /* Transfer costs off of singleton variables, and also between integer variables when advantageous. transferCosts is defined in CoinPresolveFixed.cpp */ if ((presolveActions_&0x04) != 0) { transferCosts(prob) ; # if PRESOLVE_DEBUG > 0 if (monitor) monitor->checkAndTell(prob) ; # endif } /* Fix variables before we get into the main transform loop. */ paction_ = make_fixed(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif // if integers then switch off dual stuff // later just do individually bool doDualStuff = true ; if ((presolveActions_&0x01) == 0) { int ncol = presolvedModel_->getNumCols() ; for (int i = 0 ; i < ncol ; i++) if (presolvedModel_->isInteger(i)) doDualStuff = false ; } # if PRESOLVE_CONSISTENCY > 0 presolve_links_ok(prob) ; # endif /* If we're feasible, set up for the main presolve transform loop. */ if (!prob->status_) { # if 0 /* This block is used during debugging. See ATOI to see how it works. Some editing will be required to turn it all on. */ bool slackd = ATOI("SLACKD")!=0; //bool forcing = ATOI("FORCING")!=0; bool doubleton = ATOI("DOUBLETON")!=0; bool forcing = ATOI("off")!=0; bool ifree = ATOI("off")!=0; bool zerocost = ATOI("off")!=0; bool dupcol = ATOI("off")!=0; bool duprow = ATOI("off")!=0; bool dual = ATOI("off")!=0; # else # if 1 // normal operation --- all transforms enabled bool slackSingleton = true; bool slackd = true; bool doubleton = true; bool tripleton = true; bool forcing = true; bool ifree = true; bool zerocost = true; bool dupcol = true; bool duprow = true; bool dual = doDualStuff; # else // compile time selection of transforms. bool slackSingleton = true; bool slackd = false; bool doubleton = true; bool tripleton = true; bool forcing = true; bool ifree = false; bool zerocost = false; bool dupcol = false; bool duprow = false; bool dual = false; # endif # endif /* Process OsiPresolve options. Set corresponding CoinPresolve options and control variables here. */ // Switch off some stuff if would annoy set partitioning etc if ((presolveActions_&0x02) != 0) { doubleton = false; tripleton = false; ifree = false; } // stop x+y+z=1 if ((presolveActions_&0x08) != 0) prob->setPresolveOptions(prob->presolveOptions()|0x04) ; // switch on stuff which can't be unrolled easily if ((presolveActions_&0x10) != 0) prob->setPresolveOptions(prob->presolveOptions()|0x10) ; // switch on gub stuff (unimplemented as of 110605 -- lh --) if ((presolveActions_&0x20) != 0) prob->setPresolveOptions(prob->presolveOptions()|0x20) ; // allow duplicate column processing for integer columns if ((presolveActions_&0x01) != 0) prob->setPresolveOptions(prob->presolveOptions()|0x01) ; /* Set [rows,cols]ToDo to process all rows & cols unless there are specific prohibitions. */ prob->initColsToDo() ; prob->initRowsToDo() ; /* Try to remove duplicate rows and columns. */ if (dupcol) { possibleSkip ; paction_ = dupcol_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 if (monitor) monitor->checkAndTell(prob) ; # endif } if (duprow) { possibleSkip ; paction_ = duprow_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 if (monitor) monitor->checkAndTell(prob) ; # endif } /* The main loop starts with a minor loop that does inexpensive presolve transforms until convergence. At each iteration of this loop, next[Rows,Cols]ToDo is copied over to [rows,cols]ToDo. Then there's a block to set [rows,cols]ToDo to examine all rows & cols, followed by executions of expensive transforms. Then we come back around for another iteration of the main loop. [rows,cols]ToDo is not reset as we come back around, so we dive into the inexpensive loop set up to process all. lastDropped is a count of total number of rows dropped by presolve. Used as an additional criterion to end the main presolve loop. */ int lastDropped = 0 ; prob->pass_ = 0 ; for (int iLoop = 0 ; iLoop < numberPasses_ ; iLoop++) { # if PRESOLVE_SUMMARY > 0 std::cout << "Starting major pass " << (iLoop+1) << std::endl ; # endif const CoinPresolveAction *const paction0 = paction_ ; // #define IMPLIED 3 #ifdef IMPLIED int fill_level = 3 ; # define IMPLIED2 1 # if IMPLIED != 3 # if IMPLIED > 0 && IMPLIED < 11 fill_level = IMPLIED ; printf("** fill_level == %d !\n",fill_level) ; # endif # if IMPLIED > 11 && IMPLIED < 21 fill_level = -(IMPLIED-10) ; printf("** fill_level == %d !\n",fill_level); # endif # endif #else // look for substitutions with no fill int fill_level = 2 ; #endif int whichPass = 0 ; /* Apply inexpensive transforms until convergence or infeasible/unbounded. */ while (true) { whichPass++ ; prob->pass_++ ; const CoinPresolveAction *const paction1 = paction_ ; if (slackd) { bool notFinished = true ; while (notFinished) { possibleBreak ; paction_ = slack_doubleton_action::presolve(prob,paction_,notFinished) ; } # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } if (zerocost) { possibleBreak ; paction_ = do_tighten_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } if (dual && whichPass == 1) { possibleBreak; // this can also make E rows so do one bit here paction_ = remove_dual_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } if (doubleton) { possibleBreak ; paction_ = doubleton_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } if (tripleton) { possibleBreak ; paction_ = tripleton_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } if (forcing) { possibleBreak; paction_ = forcing_constraint_action::presolve(prob, paction_); # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } if (ifree && (whichPass%5) == 1) { possibleBreak ; paction_ = implied_free_action::presolve(prob,paction_,fill_level) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } # if PRESOLVE_CONSISTENCY > 0 presolve_links_ok(prob) ; presolve_no_zeros(prob) ; presolve_consistent(prob) ; # endif /* Set up for next pass. Original comment adds: later do faster if many changes i.e. memset and memcpy */ prob->stepRowsToDo() ; # if PRESOLVE_DEBUG > 0 int rowCheck = -1 ; bool rowFound = false ; for (int i = 0 ; i < prob->numberRowsToDo_ ; i++) { int index = prob->rowsToDo_[i]; if (index == rowCheck) { std::cout << " row " << index << " on list after pass " << whichPass << std::endl ; rowFound = true ; } } if (!rowFound && rowCheck >= 0) prob->rowsToDo_[prob->numberRowsToDo_++] = rowCheck ; # endif prob->stepColsToDo() ; # if PRESOLVE_DEBUG > 0 int colCheck = -1 ; bool colFound = false ; for (int i = 0 ; i < prob->numberNextColsToDo_ ; i++) { int index = prob->colsToDo_[i] ; if (index == colCheck) { std::cout << " col " << index << " on list after pass " << whichPass << std::endl ; colFound = true ; } } if (!colFound && colCheck >= 0) prob->colsToDo_[prob->numberColsToDo_++] = colCheck ; # endif /* Break if nothing happened (no postsolve actions queued). The check for fill_level > 0 is a hack to allow repeating the loop with some modified fill level (playing with negative values). fill_level = 0 (as set in other places) will clearly be a problem. -- lh, 110605 -- */ if (paction_ == paction1 && fill_level > 0) break ; } /* End of inexpensive transform loop. Reset [rows,cols]ToDo to process all rows and columns unless there are specfic prohibitions. */ prob->initRowsToDo() ; prob->initColsToDo() ; /* Try expensive presolve transforms. Original comment adds: this caused world.mps to run into numerical difficulties */ # if PRESOLVE_SUMMARY > 0 std::cout << "Starting expensive." << std::endl ; # endif /* Try and fix variables at upper or lower bound by calculating bounds on the dual variables and propagating them to the reduced costs. Every other iteration, see if this has created free variables. */ if (dual) { for (int itry = 0 ; itry < 5 ; itry++) { const CoinPresolveAction *const paction2 = paction_ ; possibleBreak ; paction_ = remove_dual_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; if (ifree) { #ifdef IMPLIED # if IMPLIED2 == 0 int fill_level = 0 ; // switches off substitution # elif IMPLIED2 != 99 int fill_level = IMPLIED2 ; # endif #endif if ((itry&1) == 0) { possibleBreak ; paction_ = implied_free_action::presolve(prob,paction_,fill_level) ; } # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } if (paction_ == paction2) break ; } } else if (ifree) { /* Just check for free variables. */ #ifdef IMPLIED # if IMPLIED2 == 0 int fill_level = 0 ; // switches off substitution # elif IMPLIED2 != 99 int fill_level = IMPLIED2 ; # endif #endif possibleBreak ; paction_ = implied_free_action::presolve(prob,paction_,fill_level) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } /* Check if other transformations have produced duplicate rows or columns. */ if (dupcol) { possibleBreak ; paction_ = dupcol_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } if (duprow) { possibleBreak ; paction_ = duprow_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif if (prob->status_) break ; } // Will trigger abort due to unimplemented postsolve -- lh, 110605 -- if ((presolveActions_&0x20) != 0) { possibleBreak ; paction_ = gubrow_action::presolve(prob,paction_) ; } /* Count the number of empty rows and see if we've made progress in this pass. */ bool stopLoop = false ; { const int *const hinrow = prob->hinrow_ ; int numberDropped = 0 ; for (int i = 0 ; i < nrows_ ; i++) if (!hinrow[i]) numberDropped++ ; # if PRESOLVE_DEBUG > 0 std::cout << " " << (numberDropped-lastDropped) << " rows dropped in pass " << iLoop << "." << std::endl ; # endif if (numberDropped == lastDropped) stopLoop = true ; else lastDropped = numberDropped ; } /* Check for singleton variables that can act like a logical, allowing a row to be transformed from an equality to an inequality. The third parameter allows for costs for the existing logicals. This is apparently used by clp; consult the clp presolve before implementing it here. -- lh, 110605 -- Original comment: Do this here as not very loopy */ if (slackSingleton) { possibleBreak ; paction_ = slack_singleton_action::presolve(prob,paction_,NULL) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif } # if PRESOLVE_DEBUG > 0 presolve_check_sol(prob,1) ; # endif if (paction_ == paction0 || stopLoop) break ; } // End of major pass loop } /* Final cleanup: drop zero coefficients from the matrix, then drop empty rows and columns. */ if (!prob->status_) { paction_ = drop_zero_coefficients(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; if (monitor) monitor->checkAndTell(prob) ; # endif paction_ = drop_empty_cols_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; # endif paction_ = drop_empty_rows_action::presolve(prob,paction_) ; # if PRESOLVE_DEBUG > 0 check_and_tell(prob,paction_,pactiond) ; # endif } /* Not feasible? Say something and clean up. */ CoinMessageHandler *hdlr = prob->messageHandler() ; CoinMessages msgs = CoinMessage(prob->messages().language()); if (prob->status_) { if (prob->status_ == 1) hdlr->message(COIN_PRESOLVE_INFEAS,msgs) << prob->feasibilityTolerance_ << CoinMessageEol ; else if (prob->status_ == 2) hdlr->message(COIN_PRESOLVE_UNBOUND,msgs) << CoinMessageEol ; else hdlr->message(COIN_PRESOLVE_INFEASUNBOUND,msgs) << CoinMessageEol ; gutsOfDestroy() ; } return (paction_) ; } /* We could have implemented this by having each postsolve routine directly call the next one, but this makes it easier to add debugging checks. */ void OsiPresolve::postsolve (CoinPostsolveMatrix &prob) { const CoinPresolveAction *paction = paction_; # if PRESOLVE_DEBUG > 0 std::cout << "Begin POSTSOLVING." << std::endl ; if (prob.colstat_) { presolve_check_nbasic(&prob) ; presolve_check_sol(&prob,2,2,2) ; } presolve_check_duals(&prob) ; # endif while (paction) { # if PRESOLVE_DEBUG > 0 std::cout << "POSTSOLVING " << paction->name() << std::endl ; # endif paction->postsolve(&prob); # if PRESOLVE_DEBUG > 0 if (prob.colstat_) { presolve_check_nbasic(&prob) ; presolve_check_sol(&prob,2,2,2) ; } # endif paction = paction->next ; # if PRESOLVE_DEBUG > 0 presolve_check_duals(&prob); # endif } # if PRESOLVE_DEBUG > 0 std::cout << "End POSTSOLVING" << std::endl ; # endif # if PRESOLVE_DEBUG > 0 for (int j = 0 ; j < prob.ncols_ ; j++) { if (!prob.cdone_[j]) { printf("!cdone[%d]\n", j) ; abort() ; } } for (int i = 0 ; i < prob.nrows_ ; i++) { if (!prob.rdone_[i]) { printf("!rdone[%d]\n", i) ; abort() ; } } for (int j = 0 ; j < prob.ncols_ ; j++) { if (prob.sol_[j] < -1e10 || prob.sol_[j] > 1e10) printf("!!!%d %g\n",j,prob.sol_[j]) ; } # endif /* Put back duals. Flip sign for maximisation problems. */ double maxmin = originalModel_->getObjSense() ; if (maxmin < 0.0) { double *pi = prob.rowduals_ ; for (int i = 0 ; i < nrows_ ; i++) pi[i] = -pi[i] ; } originalModel_->setRowPrice(prob.rowduals_) ; } static inline double getTolerance(const OsiSolverInterface *si, OsiDblParam key) { double tol; if (!si->getDblParam(key,tol)) { CoinPresolveAction::throwCoinError("getDblParam failed", "CoinPrePostsolveMatrix::CoinPrePostsolveMatrix") ; } return (tol) ; } // Assumptions: // 1. nrows>=m.getNumRows() // 2. ncols>=m.getNumCols() // // In presolve, these values are equal. // In postsolve, they may be inequal, since the reduced problem // may be smaller, but we need room for the large problem. // ncols may be larger than si.getNumCols() in postsolve, // this at that point si will be the reduced problem, // but we need to reserve enough space for the original problem. CoinPrePostsolveMatrix::CoinPrePostsolveMatrix(const OsiSolverInterface * si, int ncols_in, int nrows_in, CoinBigIndex nelems_in) : ncols_(si->getNumCols()), nelems_(si->getNumElements()), ncols0_(ncols_in), nrows0_(nrows_in), bulkRatio_(2.0), mcstrt_(new CoinBigIndex[ncols_in+1]), hincol_(new int[ncols_in+1]), cost_(new double[ncols_in]), clo_(new double[ncols_in]), cup_(new double[ncols_in]), rlo_(new double[nrows_in]), rup_(new double[nrows_in]), originalColumn_(new int[ncols_in]), originalRow_(new int[nrows_in]), ztolzb_(getTolerance(si, OsiPrimalTolerance)), ztoldj_(getTolerance(si, OsiDualTolerance)), maxmin_(si->getObjSense()), handler_(0), defaultHandler_(false), messages_() { bulk0_ = static_cast(bulkRatio_*nelems_in) ; hrow_ = new int [bulk0_] ; colels_ = new double[bulk0_] ; si->getDblParam(OsiObjOffset,originalOffset_); int ncols = si->getNumCols(); int nrows = si->getNumRows(); setMessageHandler(si->messageHandler()) ; CoinDisjointCopyN(si->getColLower(), ncols, clo_); CoinDisjointCopyN(si->getColUpper(), ncols, cup_); CoinDisjointCopyN(si->getObjCoefficients(), ncols, cost_); CoinDisjointCopyN(si->getRowLower(), nrows, rlo_); CoinDisjointCopyN(si->getRowUpper(), nrows, rup_); int i; // initialize and clean up bounds double infinity = si->getInfinity(); if (infinity!=COIN_DBL_MAX) { for (i=0;i= 0; --i) { if (start[i+1] - start[i] != length[i]) break; } return (! (i >= 0)); } CoinPresolveMatrix::CoinPresolveMatrix(int ncols0_in, double maxmin, // end prepost members OsiSolverInterface * si, // rowrep int nrows_in, CoinBigIndex nelems_in, bool doStatus, double nonLinearValue, const char * prohibited, const char * rowProhibited) : CoinPrePostsolveMatrix(si,ncols0_in,nrows_in,nelems_in), clink_(new presolvehlink[ncols0_in+1]), rlink_(new presolvehlink[nrows_in+1]), dobias_(0.0), // temporary init mrstrt_(new CoinBigIndex[nrows_in+1]), hinrow_(new int[nrows_in+1]), integerType_(new unsigned char[ncols0_in]), anyInteger_(false), tuning_(false), startTime_(0.0), feasibilityTolerance_(0.0), status_(-1), maxSubstLevel_(3), colsToDo_(new int [ncols0_in]), numberColsToDo_(0), nextColsToDo_(new int[ncols0_in]), numberNextColsToDo_(0), rowsToDo_(new int [nrows_in]), numberRowsToDo_(0), nextRowsToDo_(new int[nrows_in]), numberNextRowsToDo_(0), presolveOptions_(0) { rowels_ = new double [bulk0_] ; hcol_ = new int [bulk0_] ; nrows_ = si->getNumRows() ; const CoinBigIndex bufsize = static_cast(bulkRatio_*nelems_in) ; // Set up change bits rowChanged_ = new unsigned char[nrows_]; memset(rowChanged_,0,nrows_); colChanged_ = new unsigned char[ncols_]; memset(colChanged_,0,ncols_); const CoinPackedMatrix * m1 = si->getMatrixByCol(); // The coefficient matrix is a big hunk of stuff. // Do the copy here to try to avoid running out of memory. const CoinBigIndex * start = m1->getVectorStarts(); const int * length = m1->getVectorLengths(); const int * row = m1->getIndices(); const double * element = m1->getElements(); int icol,nel=0; mcstrt_[0]=0; for (icol=0;icolZTOLDP) { hrow_[nel]=row[j]; colels_[nel++]=element[j]; } } hincol_[icol]=nel-mcstrt_[icol]; mcstrt_[icol+1]=nel; } // same thing for row rep CoinPackedMatrix * m = new CoinPackedMatrix(); m->reverseOrderedCopyOf(*si->getMatrixByCol()); // do by hand because of zeros m->removeGaps(); CoinDisjointCopyN(m->getVectorStarts(), nrows_, mrstrt_); mrstrt_[nrows_] = nelems_; CoinDisjointCopyN(m->getVectorLengths(), nrows_, hinrow_); CoinDisjointCopyN(m->getIndices(), nelems_, hcol_); CoinDisjointCopyN(m->getElements(), nelems_, rowels_); start = m->getVectorStarts(); length = m->getVectorLengths(); const int * column = m->getIndices(); element = m->getElements(); // out zeros int irow; nel=0; mrstrt_[0]=0; for (irow=0;irowZTOLDP) { hcol_[nel]=column[j]; rowels_[nel++]=element[j]; } } hinrow_[irow]=nel-mrstrt_[irow]; mrstrt_[irow+1]=nel; } nelems_=nel; delete m; { int i; int numberIntegers=0; for (i=0;iisInteger(i)) { integerType_[i] = 1; numberIntegers++; } else { integerType_[i] = 0; } } anyInteger_ = (numberIntegers!=0); } // Set up prohibited bits if needed if (nonLinearValue) { anyProhibited_ = true; for (icol=0;icolgetColSolution() ; memcpy(sol_,presol,ncols_*sizeof(double));; acts_ = new double [nrows_]; memcpy(acts_,si->getRowActivity(),nrows_*sizeof(double)); CoinWarmStartBasis * basis = dynamic_cast(si->getWarmStart()); colstat_ = new unsigned char [nrows_+ncols_]; rowstat_ = colstat_+ncols_; // If basis is NULL then put in all slack basis if (basis&&basis->getNumStructural()==ncols_) { int i; for (i=0;igetStructStatus(i); } for (i=0;igetArtifStatus(i); } } else { int i; // no basis for (i=0;i 0 presolve_consistent(this) ; # endif } // avoid compiler warnings about unused variables #if PRESOLVE_SUMMARY > 0 void CoinPresolveMatrix::update_model(OsiSolverInterface * si, int nrows0, int ncols0, CoinBigIndex nelems0) #else void CoinPresolveMatrix::update_model(OsiSolverInterface * si, int /*nrows0*/, int /*ncols0*/, CoinBigIndex /*nelems0*/) #endif { int nels=0; int i; if (si->getObjSense() < 0.0) { for (int i=0;iloadProblem(m, clo_, cup_, cost_, rlo_, rup_); for ( i=0; isetInteger(i); else si->setContinuous(i); } si->setDblParam(OsiObjOffset,originalOffset_-dobias_); # if PRESOLVE_SUMMARY > 0 std::cout << "New ncol/nrow/nels: " << ncols_ << "(-" << ncols0-ncols_ << ") " << nrows_ << "(-" << nrows0-nrows_ << ") " << si->getNumElements() << "(-" << nelems0-si->getNumElements() << ") " << std::endl ; # endif } //////////////// POSTSOLVE CoinPostsolveMatrix::CoinPostsolveMatrix(OsiSolverInterface* si, int ncols0_in, int nrows0_in, CoinBigIndex nelems0, double maxmin, // end prepost members double *sol_in, double *acts_in, unsigned char *colstat_in, unsigned char *rowstat_in) : CoinPrePostsolveMatrix(si, ncols0_in, nrows0_in, nelems0), /* Used only to mark processed columns and rows so that debugging routines know what to check. */ # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 cdone_(new char[ncols0_in]), rdone_(new char[nrows0_in]) # else cdone_(0), rdone_(0) # endif { /* The CoinPrePostsolveMatrix constructor will set bulk0_ to bulkRatio_*nelems0. By default, bulkRatio_ is 2. This is certainly larger than absolutely necessary, but good for efficiency (minimises the need to compress the bulk store). The main storage arrays for the threaded column-major representation (hrow_, colels_, link_) should be allocated to this size. */ free_list_ = 0 ; maxlink_ = bulk0_ ; link_ = new int[maxlink_] ; nrows_ = si->getNumRows() ; ncols_ = si->getNumCols() ; sol_=sol_in; rowduals_=NULL; acts_=acts_in; rcosts_=NULL; colstat_=colstat_in; rowstat_=rowstat_in; // this is the *reduced* model, which is probably smaller int ncols1 = ncols_ ; int nrows1 = nrows_ ; const CoinPackedMatrix * m = si->getMatrixByCol(); #if 0 if (! isGapFree(*m)) { CoinPresolveAction::throwCoinError("Matrix not gap free", "CoinPostsolveMatrix"); } #endif const CoinBigIndex nelemsr = m->getNumElements(); if (isGapFree(*m)) { CoinDisjointCopyN(m->getVectorStarts(), ncols1, mcstrt_); CoinZeroN(mcstrt_+ncols1,ncols0_-ncols1); mcstrt_[ncols_] = nelems0; // points to end of bulk store CoinDisjointCopyN(m->getVectorLengths(),ncols1, hincol_); CoinDisjointCopyN(m->getIndices(), nelemsr, hrow_); CoinDisjointCopyN(m->getElements(), nelemsr, colels_); } else { CoinPackedMatrix* mm = new CoinPackedMatrix(*m); if( mm->hasGaps()) mm->removeGaps(); assert(nelemsr == mm->getNumElements()); CoinDisjointCopyN(mm->getVectorStarts(), ncols1, mcstrt_); CoinZeroN(mcstrt_+ncols1,ncols0_-ncols1); mcstrt_[ncols_] = nelems0; // points to end of bulk store CoinDisjointCopyN(mm->getVectorLengths(),ncols1, hincol_); CoinDisjointCopyN(mm->getIndices(), nelemsr, hrow_); CoinDisjointCopyN(mm->getElements(), nelemsr, colels_); } # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 memset(cdone_, -1, ncols0_); memset(rdone_, -1, nrows0_); # endif rowduals_ = new double[nrows0_]; CoinDisjointCopyN(si->getRowPrice(), nrows1, rowduals_); rcosts_ = new double[ncols0_]; CoinDisjointCopyN(si->getReducedCost(), ncols1, rcosts_); #if PRESOLVE_DEBUG > 0 // check accuracy of reduced costs (rcosts_ is recalculated reduced costs) si->getMatrixByCol()->transposeTimes(rowduals_,rcosts_) ; const double *obj = si->getObjCoefficients() ; const double *dj = si->getReducedCost() ; { int i; for (i=0;igetColSolution(), ncols1, sol_); CoinDisjointCopyN(si->getRowActivity(), nrows1, acts_) ; si->setDblParam(OsiObjOffset,originalOffset_); for (int j=0; j0) link_[kce-1] = NO_LINK ; } if (maxlink_>0) { int ml = maxlink_; for (CoinBigIndex k=nelemsr; k 0 || PRESOLVE_CONSISTENCY > 0 /* These are used to track the action of postsolve transforms during debugging. */ CoinFillN(cdone_,ncols1,PRESENT_IN_REDUCED) ; CoinZeroN(cdone_+ncols1,ncols0_in-ncols1) ; CoinFillN(rdone_,nrows1,PRESENT_IN_REDUCED) ; CoinZeroN(rdone_+nrows1,nrows0_in-nrows1) ; # endif } CoinMP-1.8.3/Osi/src/Osi/OsiConfig.h0000644000175000017500000000242412101340333015410 0ustar renerene/* Copyright (C) 2011 * All Rights Reserved. * This code is published under the Eclipse Public License. * * $Id: OsiConfig.h 1881 2013-01-28 00:05:47Z stefan $ * * Include file for the configuration of Osi. * * On systems where the code is configured with the configure script * (i.e., compilation is always done with HAVE_CONFIG_H defined), this * header file includes the automatically generated header file. * * On systems that are compiled in other ways (e.g., with the * Developer Studio), a header files is included to define those * macros that depend on the operating system and the compiler. The * macros that define the configuration of the particular user setting * (e.g., presence of other COIN-OR packages or third party code) are set * by the files config_*default.h. The project maintainer needs to remember * to update these file and choose reasonable defines. * A user can modify the default setting by editing the config_*default.h files. */ #ifndef __OSICONFIG_H__ #define __OSICONFIG_H__ #ifdef HAVE_CONFIG_H #ifdef OSI_BUILD #include "config.h" #else #include "config_osi.h" #endif #else /* HAVE_CONFIG_H */ #ifdef OSI_BUILD #include "config_default.h" #else #include "config_osi_default.h" #endif #endif /* HAVE_CONFIG_H */ #endif /*__OSICONFIG_H__*/ CoinMP-1.8.3/Osi/src/Osi/config.h.in0000644000175000017500000000613611573725230015425 0ustar renerene/* src/Osi/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if the CoinUtils package is available */ #undef COIN_HAS_COINUTILS /* Define to 1 if the Cplex package is available */ #undef COIN_HAS_CPX /* Define to 1 if the Glpk package is available */ #undef COIN_HAS_GLPK /* Define to 1 if the Gurobi package is available */ #undef COIN_HAS_GRB /* Define to 1 if the Mosek package is available */ #undef COIN_HAS_MSK /* Define to 1 if the Netlib package is available */ #undef COIN_HAS_NETLIB /* Define to 1 if the Sample package is available */ #undef COIN_HAS_SAMPLE /* Define to 1 if the SoPlex package is available */ #undef COIN_HAS_SOPLEX /* Define to 1 if the Xpress package is available */ #undef COIN_HAS_XPR /* Define to the debug sanity check level (0 is no test) */ #undef COIN_OSI_CHECKLEVEL /* Define to the debug verbosity level (0 is no output) */ #undef COIN_OSI_VERBOSITY /* Define to 1 if GLPK has the advanced B&B solver lpx_intopt */ #undef GLPK_HAS_INTOPT /* Define to 1 if you have the header file. */ #undef HAVE_CFLOAT /* Define to 1 if you have the header file. */ #undef HAVE_CIEEEFP /* Define to 1 if you have the header file. */ #undef HAVE_CMATH /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the header file. */ #undef HAVE_IEEEFP_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* SVN revision number of project */ #undef OSI_SVN_REV /* Version number of project */ #undef OSI_VERSION /* Major Version number of project */ #undef OSI_VERSION_MAJOR /* Minor Version number of project */ #undef OSI_VERSION_MINOR /* Release Version number of project */ #undef OSI_VERSION_RELEASE /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION CoinMP-1.8.3/Osi/src/Osi/OsiSolverInterface.hpp0000644000175000017500000023223212300430504017641 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiSolverInterface_H #define OsiSolverInterface_H #include #include #include #include "CoinTypes.hpp" #include "CoinMessageHandler.hpp" #include "CoinPackedVectorBase.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStart.hpp" #include "CoinFinite.hpp" #include "CoinError.hpp" #include "OsiCollections.hpp" #include "OsiSolverParameters.hpp" class CoinSnapshot; class CoinLpIO; class CoinMpsIO; class OsiCuts; class OsiAuxInfo; class OsiRowCut; class OsiRowCutDebugger; class CoinSet; class CoinBuild; class CoinModel; class OsiSolverBranch; class OsiSolverResult; class OsiObject; //############################################################################# /*! \brief Abstract Base Class for describing an interface to a solver. Many OsiSolverInterface query methods return a const pointer to the requested read-only data. If the model data is changed or the solver is called, these pointers may no longer be valid and should be refreshed by invoking the member function to obtain an updated copy of the pointer. For example: \code OsiSolverInterface solverInterfacePtr ; const double * ruBnds = solverInterfacePtr->getRowUpper(); solverInterfacePtr->applyCuts(someSetOfCuts); // ruBnds is no longer a valid pointer and must be refreshed ruBnds = solverInterfacePtr->getRowUpper(); \endcode Querying a problem that has no data associated with it will result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. */ class OsiSolverInterface { friend void OsiSolverInterfaceCommonUnitTest( const OsiSolverInterface* emptySi, const std::string & mpsDir, const std::string & netlibDir); friend void OsiSolverInterfaceMpsUnitTest( const std::vector & vecSiP, const std::string & mpsDir); public: /// Internal class for obtaining status from the applyCuts method class ApplyCutsReturnCode { friend class OsiSolverInterface; friend class OsiClpSolverInterface; friend class OsiGrbSolverInterface; public: ///@name Constructors and desctructors //@{ /// Default constructor ApplyCutsReturnCode(): intInconsistent_(0), extInconsistent_(0), infeasible_(0), ineffective_(0), applied_(0) {} /// Copy constructor ApplyCutsReturnCode(const ApplyCutsReturnCode & rhs): intInconsistent_(rhs.intInconsistent_), extInconsistent_(rhs.extInconsistent_), infeasible_(rhs.infeasible_), ineffective_(rhs.ineffective_), applied_(rhs.applied_) {} /// Assignment operator ApplyCutsReturnCode & operator=(const ApplyCutsReturnCode& rhs) { if (this != &rhs) { intInconsistent_ = rhs.intInconsistent_; extInconsistent_ = rhs.extInconsistent_; infeasible_ = rhs.infeasible_; ineffective_ = rhs.ineffective_; applied_ = rhs.applied_; } return *this; } /// Destructor ~ApplyCutsReturnCode(){} //@} /**@name Accessing return code attributes */ //@{ /// Number of logically inconsistent cuts inline int getNumInconsistent() const {return intInconsistent_;} /// Number of cuts inconsistent with the current model inline int getNumInconsistentWrtIntegerModel() const {return extInconsistent_;} /// Number of cuts that cause obvious infeasibility inline int getNumInfeasible() const {return infeasible_;} /// Number of redundant or ineffective cuts inline int getNumIneffective() const {return ineffective_;} /// Number of cuts applied inline int getNumApplied() const {return applied_;} //@} private: /**@name Private methods */ //@{ /// Increment logically inconsistent cut counter inline void incrementInternallyInconsistent(){intInconsistent_++;} /// Increment model-inconsistent counter inline void incrementExternallyInconsistent(){extInconsistent_++;} /// Increment infeasible cut counter inline void incrementInfeasible(){infeasible_++;} /// Increment ineffective cut counter inline void incrementIneffective(){ineffective_++;} /// Increment applied cut counter inline void incrementApplied(){applied_++;} //@} ///@name Private member data //@{ /// Counter for logically inconsistent cuts int intInconsistent_; /// Counter for model-inconsistent cuts int extInconsistent_; /// Counter for infeasible cuts int infeasible_; /// Counter for ineffective cuts int ineffective_; /// Counter for applied cuts int applied_; //@} }; //--------------------------------------------------------------------------- ///@name Solve methods //@{ /// Solve initial LP relaxation virtual void initialSolve() = 0; /*! \brief Resolve an LP relaxation after problem modification Note the `re-' in `resolve'. initialSolve() should be used to solve the problem for the first time. */ virtual void resolve() = 0; /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound() = 0; #ifdef CBC_NEXT_VERSION /* Would it make sense to collect all of these routines in a `MIP Helper' section? It'd make it easier for users and implementors to find them. */ /** Solve 2**N (N==depth) problems and return solutions and bases. There are N branches each of which changes bounds on both sides as given by branch. The user should provide an array of (empty) results which will be filled in. See OsiSolveResult for more details (in OsiSolveBranch.?pp) but it will include a basis and primal solution. The order of results is left to right at feasible leaf nodes so first one is down, down, ..... Returns number of feasible leaves. Also sets number of solves done and number of iterations. This is provided so a solver can do faster. If forceBranch true then branch done even if satisfied */ virtual int solveBranches(int depth,const OsiSolverBranch * branch, OsiSolverResult * result, int & numberSolves, int & numberIterations, bool forceBranch=false); #endif //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. When a set method returns false, the original value (if any) should be unchanged. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. \note There is a default implementation of the set/get methods, namely to store/retrieve the given value using an array in the base class. A specific solver implementation can use this feature, for example, to store parameters that should be used later on. Implementors of a solver interface should overload these functions to provide the proper interface to and accurately reflect the capabilities of a specific solver. The format for hints is slightly different in that a boolean specifies the sense of the hint and an enum specifies the strength of the hint. Hints should be initialised when a solver is instantiated. (See OsiSolverParameters.hpp for defined hint parameters and strength.) When specifying the sense of the hint, a value of true means to work with the hint, false to work against it. For example,
  • \code setHintParam(OsiDoScale,true,OsiHintTry) \endcode is a mild suggestion to the solver to scale the constraint system.
  • \code setHintParam(OsiDoScale,false,OsiForceDo) \endcode tells the solver to disable scaling, or throw an exception if it cannot comply.
As another example, a solver interface could use the value and strength of the \c OsiDoReducePrint hint to adjust the amount of information printed by the interface and/or solver. The extent to which a solver obeys hints is left to the solver. The value and strength returned by \c getHintParam will match the most recent call to \c setHintParam, and will not necessarily reflect the solver's ability to comply with the hint. If the hint strength is \c OsiForceDo, the solver is required to throw an exception if it cannot perform the specified action. \note As with the other set/get methods, there is a default implementation which maintains arrays in the base class for hint sense and strength. The default implementation does not store the \c otherInformation pointer, and always throws an exception for strength \c OsiForceDo. Implementors of a solver interface should override these functions to provide the proper interface to and accurately reflect the capabilities of a specific solver. */ //@{ //! Set an integer parameter virtual bool setIntParam(OsiIntParam key, int value) { if (key == OsiLastIntParam) return (false) ; intParam_[key] = value; return true; } //! Set a double parameter virtual bool setDblParam(OsiDblParam key, double value) { if (key == OsiLastDblParam) return (false) ; dblParam_[key] = value; return true; } //! Set a string parameter virtual bool setStrParam(OsiStrParam key, const std::string & value) { if (key == OsiLastStrParam) return (false) ; strParam_[key] = value; return true; } /*! \brief Set a hint parameter The \c otherInformation parameter can be used to pass in an arbitrary block of information which is interpreted by the OSI and the underlying solver. Users are cautioned that this hook is solver-specific. Implementors: The default implementation completely ignores \c otherInformation and always throws an exception for OsiForceDo. This is almost certainly not the behaviour you want; you really should override this method. */ virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void * /*otherInformation*/ = NULL) { if (key==OsiLastHintParam) return false; hintParam_[key] = yesNo; hintStrength_[key] = strength; if (strength == OsiForceDo) throw CoinError("OsiForceDo illegal", "setHintParam", "OsiSolverInterface"); return true; } //! Get an integer parameter virtual bool getIntParam(OsiIntParam key, int& value) const { if (key == OsiLastIntParam) return (false) ; value = intParam_[key]; return true; } //! Get a double parameter virtual bool getDblParam(OsiDblParam key, double& value) const { if (key == OsiLastDblParam) return (false) ; value = dblParam_[key]; return true; } //! Get a string parameter virtual bool getStrParam(OsiStrParam key, std::string& value) const { if (key == OsiLastStrParam) return (false) ; value = strParam_[key]; return true; } /*! \brief Get a hint parameter (all information) Return all available information for the hint: sense, strength, and any extra information associated with the hint. Implementors: The default implementation will always set \c otherInformation to NULL. This is almost certainly not the behaviour you want; you really should override this method. */ virtual bool getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength, void *& otherInformation) const { if (key==OsiLastHintParam) return false; yesNo = hintParam_[key]; strength = hintStrength_[key]; otherInformation=NULL; return true; } /*! \brief Get a hint parameter (sense and strength only) Return only the sense and strength of the hint. */ virtual bool getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength) const { if (key==OsiLastHintParam) return false; yesNo = hintParam_[key]; strength = hintStrength_[key]; return true; } /*! \brief Get a hint parameter (sense only) Return only the sense (true/false) of the hint. */ virtual bool getHintParam(OsiHintParam key, bool& yesNo) const { if (key==OsiLastHintParam) return false; yesNo = hintParam_[key]; return true; } /*! \brief Copy all parameters in this section from one solver to another Note that the current implementation also copies the appData block, message handler, and rowCutDebugger. Arguably these should have independent copy methods. */ void copyParameters(OsiSolverInterface & rhs); /** \brief Return the integrality tolerance of the underlying solver. We should be able to get an integrality tolerance, but until that time just use the primal tolerance \todo This method should be replaced; it's architecturally wrong. This should be an honest dblParam with a keyword. Underlying solvers that do not support integer variables should return false for set and get on this parameter. Underlying solvers that support integrality should add this to the parameters they support, using whatever tolerance is appropriate. -lh, 091021- */ inline double getIntegerTolerance() const { return dblParam_[OsiPrimalTolerance];} //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there numerical difficulties? virtual bool isAbandoned() const = 0; /// Is optimality proven? virtual bool isProvenOptimal() const = 0; /// Is primal infeasibility proven? virtual bool isProvenPrimalInfeasible() const = 0; /// Is dual infeasibility proven? virtual bool isProvenDualInfeasible() const = 0; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const = 0; //@} //--------------------------------------------------------------------------- /** \name Warm start methods Note that the warm start methods return a generic CoinWarmStart object. The precise characteristics of this object are solver-dependent. Clients who wish to maintain a maximum degree of solver independence should take care to avoid unnecessary assumptions about the properties of a warm start object. */ //@{ /*! \brief Get an empty warm start object This routine returns an empty warm start object. Its purpose is to provide a way for a client to acquire a warm start object of the appropriate type for the solver, which can then be resized and modified as desired. */ virtual CoinWarmStart *getEmptyWarmStart () const = 0 ; /** \brief Get warm start information. Return warm start information for the current state of the solver interface. If there is no valid warm start information, an empty warm start object wil be returned. */ virtual CoinWarmStart* getWarmStart() const = 0; /** \brief Get warm start information. Return warm start information for the current state of the solver interface. If there is no valid warm start information, an empty warm start object wil be returned. This does not necessarily create an object - may just point to one. must Delete set true if user should delete returned object. */ virtual CoinWarmStart* getPointerToWarmStart(bool & mustDelete) ; /** \brief Set warm start information. Return true or false depending on whether the warm start information was accepted or not. By definition, a call to setWarmStart with a null parameter should cause the solver interface to refresh its warm start information from the underlying solver. */ virtual bool setWarmStart(const CoinWarmStart* warmstart) = 0; //@} //--------------------------------------------------------------------------- /**@name Hot start methods Primarily used in strong branching. The user can create a hot start object --- a snapshot of the optimization process --- then reoptimize over and over again, starting from the same point. \note
  • Between hot started optimizations only bound changes are allowed.
  • The copy constructor and assignment operator should NOT copy any hot start information.
  • The default implementation simply extracts a warm start object in \c markHotStart, resets to the warm start object in \c solveFromHotStart, and deletes the warm start object in \c unmarkHotStart. Actual solver implementations are encouraged to do better.
*/ //@{ /// Create a hot start snapshot of the optimization process. virtual void markHotStart(); /// Optimize starting from the hot start snapshot. virtual void solveFromHotStart(); /// Delete the hot start snapshot. virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem query methods Querying a problem that has no data associated with it will result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /// Get the number of columns virtual int getNumCols() const = 0; /// Get the number of rows virtual int getNumRows() const = 0; /// Get the number of nonzero elements virtual int getNumElements() const = 0; /// Get the number of integer variables virtual int getNumIntegers() const ; /// Get a pointer to an array[getNumCols()] of column lower bounds virtual const double * getColLower() const = 0; /// Get a pointer to an array[getNumCols()] of column upper bounds virtual const double * getColUpper() const = 0; /*! \brief Get a pointer to an array[getNumRows()] of row constraint senses.
  • 'L': <= constraint
  • 'E': = constraint
  • 'G': >= constraint
  • 'R': ranged constraint
  • 'N': free constraint
*/ virtual const char * getRowSense() const = 0; /*! \brief Get a pointer to an array[getNumRows()] of row right-hand sides
  • if getRowSense()[i] == 'L' then getRightHandSide()[i] == getRowUpper()[i]
  • if getRowSense()[i] == 'G' then getRightHandSide()[i] == getRowLower()[i]
  • if getRowSense()[i] == 'R' then getRightHandSide()[i] == getRowUpper()[i]
  • if getRowSense()[i] == 'N' then getRightHandSide()[i] == 0.0
*/ virtual const double * getRightHandSide() const = 0; /*! \brief Get a pointer to an array[getNumRows()] of row ranges.
  • if getRowSense()[i] == 'R' then getRowRange()[i] == getRowUpper()[i] - getRowLower()[i]
  • if getRowSense()[i] != 'R' then getRowRange()[i] is 0.0
*/ virtual const double * getRowRange() const = 0; /// Get a pointer to an array[getNumRows()] of row lower bounds virtual const double * getRowLower() const = 0; /// Get a pointer to an array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const = 0; /*! \brief Get a pointer to an array[getNumCols()] of objective function coefficients. */ virtual const double * getObjCoefficients() const = 0; /*! \brief Get the objective function sense - 1 for minimisation (default) - -1 for maximisation */ virtual double getObjSense() const = 0; /// Return true if the variable is continuous virtual bool isContinuous(int colIndex) const = 0; /// Return true if the variable is binary virtual bool isBinary(int colIndex) const; /*! \brief Return true if the variable is integer. This method returns true if the variable is binary or general integer. */ virtual bool isInteger(int colIndex) const; /// Return true if the variable is general integer virtual bool isIntegerNonBinary(int colIndex) const; /// Return true if the variable is binary and not fixed virtual bool isFreeBinary(int colIndex) const; /*! \brief Return an array[getNumCols()] of column types \deprecated See #getColType */ inline const char *columnType(bool refresh=false) const { return getColType(refresh); } /*! \brief Return an array[getNumCols()] of column types - 0 - continuous - 1 - binary - 2 - general integer If \p refresh is true, the classification of integer variables as binary or general integer will be reevaluated. If the current bounds are [0,1], or if the variable is fixed at 0 or 1, it will be classified as binary, otherwise it will be classified as general integer. */ virtual const char * getColType(bool refresh=false) const; /// Get a pointer to a row-wise copy of the matrix virtual const CoinPackedMatrix * getMatrixByRow() const = 0; /// Get a pointer to a column-wise copy of the matrix virtual const CoinPackedMatrix * getMatrixByCol() const = 0; /*! \brief Get a pointer to a mutable row-wise copy of the matrix. Returns NULL if the request is not meaningful (i.e., the OSI will not recognise any modifications to the matrix). */ virtual CoinPackedMatrix * getMutableMatrixByRow() const {return NULL;} /*! \brief Get a pointer to a mutable column-wise copy of the matrix Returns NULL if the request is not meaningful (i.e., the OSI will not recognise any modifications to the matrix). */ virtual CoinPackedMatrix * getMutableMatrixByCol() const {return NULL;} /// Get the solver's value for infinity virtual double getInfinity() const = 0; //@} /**@name Solution query methods */ //@{ /// Get a pointer to an array[getNumCols()] of primal variable values virtual const double * getColSolution() const = 0; /** Get a pointer to an array[getNumCols()] of primal variable values guaranteed to be between the column lower and upper bounds. */ virtual const double * getStrictColSolution(); /// Get pointer to array[getNumRows()] of dual variable values virtual const double * getRowPrice() const = 0; /// Get a pointer to an array[getNumCols()] of reduced costs virtual const double * getReducedCost() const = 0; /** Get a pointer to array[getNumRows()] of row activity levels. The row activity for a row is the left-hand side evaluated at the current solution. */ virtual const double * getRowActivity() const = 0; /// Get the objective function value. virtual double getObjValue() const = 0; /** Get the number of iterations it took to solve the problem (whatever `iteration' means to the solver). */ virtual int getIterationCount() const = 0; /** Get as many dual rays as the solver can provide. In case of proven primal infeasibility there should (with high probability) be at least one. The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. \note Implementors of solver interfaces note that the double pointers in the vector should point to arrays of length getNumRows() (fullRay = false) or (getNumRows()+getNumCols()) (fullRay = true) and they should be allocated with new[]. \note Clients of solver interfaces note that it is the client's responsibility to free the double pointers in the vector using delete[]. Clients are reminded that a problem can be dual and primal infeasible. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay = false) const = 0; /** Get as many primal rays as the solver can provide. In case of proven dual infeasibility there should (with high probability) be at least one. \note Implementors of solver interfaces note that the double pointers in the vector should point to arrays of length getNumCols() and they should be allocated with new[]. \note Clients of solver interfaces note that it is the client's responsibility to free the double pointers in the vector using delete[]. Clients are reminded that a problem can be dual and primal infeasible. */ virtual std::vector getPrimalRays(int maxNumRays) const = 0; /** Get vector of indices of primal variables which are integer variables but have fractional values in the current solution. */ virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const; //@} //------------------------------------------------------------------------- /**@name Methods to modify the objective, bounds, and solution For functions which take a set of indices as parameters (\c setObjCoeffSet(), \c setColSetBounds(), \c setRowSetBounds(), \c setRowSetTypes()), the parameters follow the C++ STL iterator convention: \c indexFirst points to the first index in the set, and \c indexLast points to a position one past the last index in the set. */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ) = 0; /** Set a set of objective function coefficients */ virtual void setObjCoeffSet(const int* indexFirst, const int* indexLast, const double* coeffList); /** Set the objective coefficients for all columns. array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed. */ virtual void setObjective(const double * array); /** Set the objective function sense. Use 1 for minimisation (default), -1 for maximisation. \note Implementors note that objective function sense is a parameter of the OSI, not a property of the problem. Objective sense can be set prior to problem load and should not be affected by loading a new problem. */ virtual void setObjSense(double s) = 0; /** Set a single column lower bound. Use -getInfinity() for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ) = 0; /** Set the lower bounds for all columns. array [getNumCols()] is an array of values for the lower bounds. This defaults to a series of set operations and is here for speed. */ virtual void setColLower(const double * array); /** Set a single column upper bound. Use getInfinity() for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ) = 0; /** Set the upper bounds for all columns. array [getNumCols()] is an array of values for the upper bounds. This defaults to a series of set operations and is here for speed. */ virtual void setColUpper(const double * array); /** Set a single column lower and upper bound. The default implementation just invokes setColLower() and setColUpper() */ virtual void setColBounds( int elementIndex, double lower, double upper ) { setColLower(elementIndex, lower); setColUpper(elementIndex, upper); } /** Set the upper and lower bounds of a set of columns. The default implementation just invokes setColBounds() over and over again. For each column, boundList must contain both a lower and upper bound, in that order. */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound. Use -getInfinity() for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ) = 0; /** Set a single row upper bound. Use getInfinity() for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ) = 0; /** Set a single row lower and upper bound. The default implementation just invokes setRowLower() and setRowUpper() */ virtual void setRowBounds( int elementIndex, double lower, double upper ) { setRowLower(elementIndex, lower); setRowUpper(elementIndex, upper); } /** Set the bounds on a set of rows. The default implementation just invokes setRowBounds() over and over again. For each row, boundList must contain both a lower and upper bound, in that order. */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a single row */ virtual void setRowType(int index, char sense, double rightHandSide, double range) = 0; /** Set the type of a set of rows. The default implementation just invokes setRowType() over and over again. */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); /** Set the primal solution variable values colsol[getNumCols()] is an array of values for the primal variables. These values are copied to memory owned by the solver interface object or the solver. They will be returned as the result of getColSolution() until changed by another call to setColSolution() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double *colsol) = 0; /** Set dual solution variable values rowprice[getNumRows()] is an array of values for the dual variables. These values are copied to memory owned by the solver interface object or the solver. They will be returned as the result of getRowPrice() until changed by another call to setRowPrice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice) = 0; /** Fix variables at bound based on reduced cost For variables currently at bound, fix the variable at bound if the reduced cost exceeds the gap. Return the number of variables fixed. If justInteger is set to false, the routine will also fix continuous variables, but the test still assumes a delta of 1.0. */ virtual int reducedCostFix(double gap, bool justInteger=true); //@} //------------------------------------------------------------------------- /**@name Methods to set variable type */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index) = 0; /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index) = 0; /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); //@} //------------------------------------------------------------------------- //------------------------------------------------------------------------- /*! \brief Data type for name vectors. */ typedef std::vector OsiNameVec ; /*! \name Methods for row and column names Osi defines three name management disciplines: `auto names' (0), `lazy names' (1), and `full names' (2). See the description of #OsiNameDiscipline for details. Changing the name discipline (via setIntParam()) will not automatically add or remove name information, but setting the discipline to auto will make existing information inaccessible until the discipline is reset to lazy or full. By definition, a row index of getNumRows() (i.e., one larger than the largest valid row index) refers to the objective function. OSI users and implementors: While the OSI base class can define an interface and provide rudimentary support, use of names really depends on support by the OsiXXX class to ensure that names are managed correctly. If an OsiXXX class does not support names, it should return false for calls to getIntParam() or setIntParam() that reference OsiNameDiscipline. */ //@{ /*! \brief Generate a standard name of the form Rnnnnnnn or Cnnnnnnn Set \p rc to 'r' for a row name, 'c' for a column name. The `nnnnnnn' part is generated from ndx and will contain 7 digits by default, padded with zeros if necessary. As a special case, ndx = getNumRows() is interpreted as a request for the name of the objective function. OBJECTIVE is returned, truncated to digits+1 characters to match the row and column names. */ virtual std::string dfltRowColName(char rc, int ndx, unsigned digits = 7) const ; /*! \brief Return the name of the objective function */ virtual std::string getObjName (unsigned maxLen = static_cast(std::string::npos)) const ; /*! \brief Set the name of the objective function */ virtual inline void setObjName (std::string name) { objName_ = name ; } /*! \brief Return the name of the row. The routine will always return some name, regardless of the name discipline or the level of support by an OsiXXX derived class. Use maxLen to limit the length. */ virtual std::string getRowName(int rowIndex, unsigned maxLen = static_cast(std::string::npos)) const ; /*! \brief Return a pointer to a vector of row names If the name discipline (#OsiNameDiscipline) is auto, the return value will be a vector of length zero. If the name discipline is lazy, the vector will contain only names supplied by the client and will be no larger than needed to hold those names; entries not supplied will be null strings. In particular, the objective name is not included in the vector for lazy names. If the name discipline is full, the vector will have getNumRows() names, either supplied or generated, plus one additional entry for the objective name. */ virtual const OsiNameVec &getRowNames() ; /*! \brief Set a row name Quietly does nothing if the name discipline (#OsiNameDiscipline) is auto. Quietly fails if the row index is invalid. */ virtual void setRowName(int ndx, std::string name) ; /*! \brief Set multiple row names The run of len entries starting at srcNames[srcStart] are installed as row names starting at row index tgtStart. The base class implementation makes repeated calls to setRowName. */ virtual void setRowNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart) ; /*! \brief Delete len row names starting at index tgtStart The specified row names are removed and the remaining row names are copied down to close the gap. */ virtual void deleteRowNames(int tgtStart, int len) ; /*! \brief Return the name of the column The routine will always return some name, regardless of the name discipline or the level of support by an OsiXXX derived class. Use maxLen to limit the length. */ virtual std::string getColName(int colIndex, unsigned maxLen = static_cast(std::string::npos)) const ; /*! \brief Return a pointer to a vector of column names If the name discipline (#OsiNameDiscipline) is auto, the return value will be a vector of length zero. If the name discipline is lazy, the vector will contain only names supplied by the client and will be no larger than needed to hold those names; entries not supplied will be null strings. If the name discipline is full, the vector will have getNumCols() names, either supplied or generated. */ virtual const OsiNameVec &getColNames() ; /*! \brief Set a column name Quietly does nothing if the name discipline (#OsiNameDiscipline) is auto. Quietly fails if the column index is invalid. */ virtual void setColName(int ndx, std::string name) ; /*! \brief Set multiple column names The run of len entries starting at srcNames[srcStart] are installed as column names starting at column index tgtStart. The base class implementation makes repeated calls to setColName. */ virtual void setColNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart) ; /*! \brief Delete len column names starting at index tgtStart The specified column names are removed and the remaining column names are copied down to close the gap. */ virtual void deleteColNames(int tgtStart, int len) ; /*! \brief Set row and column names from a CoinMpsIO object. Also sets the name of the objective function. If the name discipline is auto, you get what you asked for. This routine does not use setRowName or setColName. */ void setRowColNames(const CoinMpsIO &mps) ; /*! \brief Set row and column names from a CoinModel object. If the name discipline is auto, you get what you asked for. This routine does not use setRowName or setColName. */ void setRowColNames(CoinModel &mod) ; /*! \brief Set row and column names from a CoinLpIO object. Also sets the name of the objective function. If the name discipline is auto, you get what you asked for. This routine does not use setRowName or setColName. */ void setRowColNames(CoinLpIO &mod) ; //@} //------------------------------------------------------------------------- //------------------------------------------------------------------------- /**@name Methods to modify the constraint system. Note that new columns are added as continuous variables. */ //@{ /** Add a column (primal variable) to the problem. */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) = 0; /*! \brief Add a named column (primal variable) to the problem. The default implementation adds the column, then changes the name. This can surely be made more efficient within an OsiXXX class. */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj, std::string name) ; /** Add a column (primal variable) to the problem. */ virtual void addCol(int numberElements, const int* rows, const double* elements, const double collb, const double colub, const double obj) ; /*! \brief Add a named column (primal variable) to the problem. The default implementation adds the column, then changes the name. This can surely be made more efficient within an OsiXXX class. */ virtual void addCol(int numberElements, const int* rows, const double* elements, const double collb, const double colub, const double obj, std::string name) ; /** Add a set of columns (primal variables) to the problem. The default implementation simply makes repeated calls to addCol(). */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); /** Add a set of columns (primal variables) to the problem. The default implementation simply makes repeated calls to addCol(). */ virtual void addCols(const int numcols, const int* columnStarts, const int* rows, const double* elements, const double* collb, const double* colub, const double* obj); /// Add columns using a CoinBuild object void addCols(const CoinBuild & buildObject); /** Add columns from a model object. returns -1 if object in bad state (i.e. has row information) otherwise number of errors modelObject non const as can be regularized as part of build */ int addCols(CoinModel & modelObject); #if 0 /** */ virtual void addCols(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj); #endif /** \brief Remove a set of columns (primal variables) from the problem. The solver interface for a basis-oriented solver will maintain valid warm start information if all deleted variables are nonbasic. */ virtual void deleteCols(const int num, const int * colIndices) = 0; /*! \brief Add a row (constraint) to the problem. */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) = 0; /*! \brief Add a named row (constraint) to the problem. The default implementation adds the row, then changes the name. This can surely be made more efficient within an OsiXXX class. */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub, std::string name) ; /*! \brief Add a row (constraint) to the problem. */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) = 0; /*! \brief Add a named row (constraint) to the problem. The default implementation adds the row, then changes the name. This can surely be made more efficient within an OsiXXX class. */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng, std::string name) ; /*! Add a row (constraint) to the problem. Converts to addRow(CoinPackedVectorBase&,const double,const double). */ virtual void addRow(int numberElements, const int *columns, const double *element, const double rowlb, const double rowub) ; /*! Add a set of rows (constraints) to the problem. The default implementation simply makes repeated calls to addRow(). */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** Add a set of rows (constraints) to the problem. The default implementation simply makes repeated calls to addRow(). */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); /** Add a set of rows (constraints) to the problem. The default implementation simply makes repeated calls to addRow(). */ virtual void addRows(const int numrows, const int *rowStarts, const int *columns, const double *element, const double *rowlb, const double *rowub); /// Add rows using a CoinBuild object void addRows(const CoinBuild &buildObject); /*! Add rows from a CoinModel object. Returns -1 if the object is in the wrong state (i.e., has column-major information), otherwise the number of errors. The modelObject is not const as it can be regularized as part of the build. */ int addRows(CoinModel &modelObject); #if 0 /** */ virtual void addRows(const CoinPackedMatrix& matrix, const double* rowlb, const double* rowub); /** */ virtual void addRows(const CoinPackedMatrix& matrix, const char* rowsen, const double* rowrhs, const double* rowrng); #endif /** \brief Delete a set of rows (constraints) from the problem. The solver interface for a basis-oriented solver will maintain valid warm start information if all deleted rows are loose. */ virtual void deleteRows(const int num, const int * rowIndices) = 0; /** \brief Replace the constraint matrix I (JJF) am getting annoyed because I can't just replace a matrix. The default behavior of this is do nothing so only use where that would not matter, e.g. strengthening a matrix for MIP. */ virtual void replaceMatrixOptional(const CoinPackedMatrix & ) {} /** \brief Replace the constraint matrix And if it does matter (not used at present) */ virtual void replaceMatrix(const CoinPackedMatrix & ) {abort();} /** \brief Save a copy of the base model If solver wants it can save a copy of "base" (continuous) model here. */ virtual void saveBaseModel() {} /** \brief Reduce the constraint system to the specified number of constraints. If solver wants it can restore a copy of "base" (continuous) model here. \note The name is somewhat misleading. Implementors should consider the opportunity to optimise behaviour in the common case where \p numberRows is exactly the number of original constraints. Do not, however, neglect the possibility that \p numberRows does not equal the number of original constraints. */ virtual void restoreBaseModel(int numberRows); //----------------------------------------------------------------------- /** Apply a collection of cuts. Only cuts which have an effectiveness >= effectivenessLb are applied.
  • ReturnCode.getNumineffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
  • ReturnCode.getNuminconsistent() -- number of invalid cuts
  • ReturnCode.getNuminconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
  • ReturnCode.getNuminfeasible() -- number of cuts that would make this integer model infeasible
  • ReturnCode.getNumApplied() -- number of integer cuts which were applied to the integer model
  • cs.size() == getNumineffective() + getNuminconsistent() + getNuminconsistentWrtIntegerModel() + getNuminfeasible() + getNumApplied()
*/ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); /** Apply a collection of row cuts which are all effective. applyCuts seems to do one at a time which seems inefficient. Would be even more efficient to pass an array of pointers. */ virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts); /** Apply a collection of row cuts which are all effective. This is passed in as an array of pointers. */ virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts); /// Deletes branching information before columns deleted void deleteBranchingInfo(int numberDeleted, const int * which); //@} //--------------------------------------------------------------------------- /**@name Methods for problem input and output */ //@{ /*! \brief Load in a problem by copying the arguments. The constraints on the rows are given by lower and upper bounds. If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient
Note that the default values for rowub and rowlb produce the constraint -infty <= ax <= infty. This is probably not what you want. */ virtual void loadProblem (const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) = 0; /*! \brief Load in a problem by assuming ownership of the arguments. The constraints on the rows are given by lower and upper bounds. For default argument values see the matching loadProblem method. \warning The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem (CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub) = 0; /*! \brief Load in a problem by copying the arguments. The constraints on the rows are given by sense/rhs/range triplets. If a pointer is 0 then the following values are the default:
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • obj: all variables have 0 objective coefficient
  • rowsen: all rows are >=
  • rowrhs: all right hand sides are 0
  • rowrng: 0 for the ranged rows
Note that the default values for rowsen, rowrhs, and rowrng produce the constraint ax >= 0. */ virtual void loadProblem (const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) = 0; /*! \brief Load in a problem by assuming ownership of the arguments. The constraints on the rows are given by sense/rhs/range triplets. For default argument values see the matching loadProblem method. \warning The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem (CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng) = 0; /*! \brief Load in a problem by copying the arguments. The constraint matrix is is specified with standard column-major column starts / row indices / coefficients vectors. The constraints on the rows are given by lower and upper bounds. The matrix vectors must be gap-free. Note that start must have numcols+1 entries so that the length of the last column can be calculated as start[numcols]-start[numcols-1]. See the previous loadProblem method using rowlb and rowub for default argument values. */ virtual void loadProblem (const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) = 0; /*! \brief Load in a problem by copying the arguments. The constraint matrix is is specified with standard column-major column starts / row indices / coefficients vectors. The constraints on the rows are given by sense/rhs/range triplets. The matrix vectors must be gap-free. Note that start must have numcols+1 entries so that the length of the last column can be calculated as start[numcols]-start[numcols-1]. See the previous loadProblem method using sense/rhs/range for default argument values. */ virtual void loadProblem (const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) = 0; /*! \brief Load a model from a CoinModel object. Return the number of errors encountered. The modelObject parameter cannot be const as it may be changed as part of process. If keepSolution is true will try and keep warmStart. */ virtual int loadFromCoinModel (CoinModel & modelObject, bool keepSolution=false); /*! \brief Read a problem in MPS format from the given filename. The default implementation uses CoinMpsIO::readMps() to read the MPS file and returns the number of errors encountered. */ virtual int readMps (const char *filename, const char *extension = "mps") ; /*! \brief Read a problem in MPS format from the given full filename. This uses CoinMpsIO::readMps() to read the MPS file and returns the number of errors encountered. It also may return an array of set information */ virtual int readMps (const char *filename, const char*extension, int & numberSets, CoinSet ** & sets); /*! \brief Read a problem in GMPL format from the given filenames. The default implementation uses CoinMpsIO::readGMPL(). This capability is available only if the third-party package Glpk is installed. */ virtual int readGMPL (const char *filename, const char *dataname=NULL); /*! \brief Write the problem in MPS format to the specified file. If objSense is non-zero, a value of -1.0 causes the problem to be written with a maximization objective; +1.0 forces a minimization objective. If objSense is zero, the choice is left to the implementation. */ virtual void writeMps (const char *filename, const char *extension = "mps", double objSense=0.0) const = 0; /*! \brief Write the problem in MPS format to the specified file with more control over the output. Row and column names may be null. formatType is
  • 0 - normal
  • 1 - extra accuracy
  • 2 - IEEE hex
Returns non-zero on I/O error */ int writeMpsNative (const char *filename, const char ** rowNames, const char ** columnNames, int formatType=0,int numberAcross=2, double objSense=0.0, int numberSOS=0, const CoinSet * setInfo=NULL) const ; /***********************************************************************/ // Lp files /** Write the problem into an Lp file of the given filename with the specified extension. Coefficients with value less than epsilon away from an integer value are written as integers. Write at most numberAcross monomials on a line. Write non integer numbers with decimals digits after the decimal point. The written problem is always a minimization problem. If the current problem is a maximization problem, the intended objective function for the written problem is the current objective function multiplied by -1. If the current problem is a minimization problem, the intended objective function for the written problem is the current objective function. If objSense < 0, the intended objective function is multiplied by -1 before writing the problem. It is left unchanged otherwise. Write objective function name and constraint names if useRowNames is true. This version calls writeLpNative(). */ virtual void writeLp(const char *filename, const char *extension = "lp", double epsilon = 1e-5, int numberAcross = 10, int decimals = 5, double objSense = 0.0, bool useRowNames = true) const; /** Write the problem into the file pointed to by the parameter fp. Other parameters are similar to those of writeLp() with first parameter filename. */ virtual void writeLp(FILE *fp, double epsilon = 1e-5, int numberAcross = 10, int decimals = 5, double objSense = 0.0, bool useRowNames = true) const; /** Write the problem into an Lp file. Parameters are similar to those of writeLp(), but in addition row names and column names may be given. Parameter rowNames may be NULL, in which case default row names are used. If rowNames is not NULL, it must have exactly one entry per row in the problem and one additional entry (rowNames[getNumRows()] with the objective function name. These getNumRows()+1 entries must be distinct. If this is not the case, default row names are used. In addition, format restrictions are imposed on names (see CoinLpIO::is_invalid_name() for details). Similar remarks can be made for the parameter columnNames which must either be NULL or have exactly getNumCols() distinct entries. Write objective function name and constraint names if useRowNames is true. */ int writeLpNative(const char *filename, char const * const * const rowNames, char const * const * const columnNames, const double epsilon = 1.0e-5, const int numberAcross = 10, const int decimals = 5, const double objSense = 0.0, const bool useRowNames = true) const; /** Write the problem into the file pointed to by the parameter fp. Other parameters are similar to those of writeLpNative() with first parameter filename. */ int writeLpNative(FILE *fp, char const * const * const rowNames, char const * const * const columnNames, const double epsilon = 1.0e-5, const int numberAcross = 10, const int decimals = 5, const double objSense = 0.0, const bool useRowNames = true) const; /// Read file in LP format from file with name filename. /// See class CoinLpIO for description of this format. virtual int readLp(const char *filename, const double epsilon = 1e-5); /// Read file in LP format from the file pointed to by fp. /// See class CoinLpIO for description of this format. int readLp(FILE *fp, const double epsilon = 1e-5); //@} //--------------------------------------------------------------------------- /**@name Miscellaneous */ //@{ /** Check two models against each other. Return nonzero if different. Ignore names if that set. (Note initial version does not check names) May modify both models by cleaning up */ int differentModel(OsiSolverInterface & other, bool ignoreNames=true); #ifdef COIN_SNAPSHOT /// Return a CoinSnapshot virtual CoinSnapshot * snapshot(bool createArrays=true) const; #endif #ifdef COIN_FACTORIZATION_INFO /// Return number of entries in L part of current factorization virtual CoinBigIndex getSizeL() const; /// Return number of entries in U part of current factorization virtual CoinBigIndex getSizeU() const; #endif //@} //--------------------------------------------------------------------------- /**@name Setting/Accessing application data */ //@{ /** Set application data. This is a pointer that the application can store into and retrieve from the solver interface. This field is available for the application to optionally define and use. */ void setApplicationData (void * appData); /** Create a clone of an Auxiliary Information object. The base class just stores an application data pointer but can be more general. Application data pointer is designed for one user while this can be extended to cope with more general extensions. */ void setAuxiliaryInfo(OsiAuxInfo * auxiliaryInfo); /// Get application data void * getApplicationData() const; /// Get pointer to auxiliary info object OsiAuxInfo * getAuxiliaryInfo() const; //@} //--------------------------------------------------------------------------- /**@name Message handling See the COIN library documentation for additional information about COIN message facilities. */ //@{ /** Pass in a message handler It is the client's responsibility to destroy a message handler installed by this routine; it will not be destroyed when the solver interface is destroyed. */ virtual void passInMessageHandler(CoinMessageHandler * handler); /// Set language void newLanguage(CoinMessages::Language language); inline void setLanguage(CoinMessages::Language language) {newLanguage(language);} /// Return a pointer to the current message handler inline CoinMessageHandler * messageHandler() const {return handler_;} /// Return the current set of messages inline CoinMessages messages() {return messages_;} /// Return a pointer to the current set of messages inline CoinMessages * messagesPointer() {return &messages_;} /// Return true if default handler inline bool defaultHandler() const { return defaultHandler_;} //@} //--------------------------------------------------------------------------- /**@name Methods for dealing with discontinuities other than integers. Osi should be able to know about SOS and other types. This is an optional section where such information can be stored. */ //@{ /** \brief Identify integer variables and create corresponding objects. Record integer variables and create an OsiSimpleInteger object for each one. All existing OsiSimpleInteger objects will be destroyed. If justCount then no objects created and we just store numberIntegers_ */ void findIntegers(bool justCount); /** \brief Identify integer variables and SOS and create corresponding objects. Record integer variables and create an OsiSimpleInteger object for each one. All existing OsiSimpleInteger objects will be destroyed. If the solver supports SOS then do the same for SOS. If justCount then no objects created and we just store numberIntegers_ Returns number of SOS */ virtual int findIntegersAndSOS(bool justCount); /// Get the number of objects inline int numberObjects() const { return numberObjects_;} /// Set the number of objects inline void setNumberObjects(int number) { numberObjects_=number;} /// Get the array of objects inline OsiObject ** objects() const { return object_;} /// Get the specified object const inline OsiObject * object(int which) const { return object_[which];} /// Get the specified object inline OsiObject * modifiableObject(int which) const { return object_[which];} /// Delete all object information void deleteObjects(); /** Add in object information. Objects are cloned; the owner can delete the originals. */ void addObjects(int numberObjects, OsiObject ** objects); /** Use current solution to set bounds so current integer feasible solution will stay feasible. Only feasible bounds will be used, even if current solution outside bounds. The amount of such violation will be returned (and if small can be ignored) */ double forceFeasible(); //@} //--------------------------------------------------------------------------- /*! @name Methods related to testing generated cuts See the documentation for OsiRowCutDebugger for additional details. */ //@{ /*! \brief Activate the row cut debugger. If \p modelName is in the set of known models then all cuts are checked to see that they do NOT cut off the optimal solution known to the debugger. */ virtual void activateRowCutDebugger (const char *modelName); /*! \brief Activate the row cut debugger using a full solution array. Activate the debugger for a model not included in the debugger's internal database. Cuts will be checked to see that they do NOT cut off the given solution. \p solution must be a full solution vector, but only the integer variables need to be correct. The debugger will fill in the continuous variables by solving an lp relaxation with the integer variables fixed as specified. If the given values for the continuous variables should be preserved, set \p keepContinuous to true. */ virtual void activateRowCutDebugger(const double *solution, bool enforceOptimality = true); /*! \brief Get the row cut debugger provided the solution known to the debugger is within the feasible region held in the solver. If there is a row cut debugger object associated with model AND if the solution known to the debugger is within the solver's current feasible region (i.e., the column bounds held in the solver are compatible with the known solution) then a pointer to the debugger is returned which may be used to test validity of cuts. Otherwise NULL is returned */ const OsiRowCutDebugger *getRowCutDebugger() const; /*! \brief Get the row cut debugger object Return the row cut debugger object if it exists. One common usage of this method is to obtain a debugger object in order to execute OsiRowCutDebugger::redoSolution (so that the stored solution is again compatible with the problem held in the solver). */ OsiRowCutDebugger * getRowCutDebuggerAlways() const; //@} /*! \name OsiSimplexInterface \brief Simplex Interface Methods for an advanced interface to a simplex solver. The interface comprises two groups of methods. Group 1 contains methods for tableau access. Group 2 contains methods for dictating individual simplex pivots. */ //@{ /*! \brief Return the simplex implementation level. The return codes are: - 0: the simplex interface is not implemented. - 1: the Group 1 (tableau access) methods are implemented. - 2: the Group 2 (pivoting) methods are implemented The codes are cumulative - a solver which implements Group 2 also implements Group 1. */ virtual int canDoSimplexInterface() const ; //@} /*! \name OsiSimplex Group 1 \brief Tableau access methods. This group of methods provides access to rows and columns of the basis inverse and to rows and columns of the tableau. */ //@{ /*! \brief Prepare the solver for the use of tableau access methods. Prepares the solver for the use of the tableau access methods, if any such preparation is required. The \c const attribute is required due to the places this method may be called (e.g., within CglCutGenerator::generateCuts()). */ virtual void enableFactorization() const ; /*! \brief Undo the effects of #enableFactorization. */ virtual void disableFactorization() const ; /*! \brief Check if an optimal basis is available. Returns true if the problem has been solved to optimality and a basis is available. This should be used to see if the tableau access operations are possible and meaningful. \note Implementors please note that this method may be called before #enableFactorization. */ virtual bool basisIsAvailable() const ; /// Synonym for #basisIsAvailable inline bool optimalBasisIsAvailable() const { return basisIsAvailable() ; } /*! \brief Retrieve status information for column and row variables. This method returns status as integer codes:
  • 0: free
  • 1: basic
  • 2: nonbasic at upper bound
  • 3: nonbasic at lower bound
The #getWarmStart method provides essentially the same functionality for a simplex-oriented solver, but the implementation details are very different. \note Logical variables associated with rows are all assumed to have +1 coefficients, so for a <= constraint the logical will be at lower bound if the constraint is tight. \note Implementors may choose to implement this method as a wrapper which converts a CoinWarmStartBasis to the requested representation. */ virtual void getBasisStatus(int* cstat, int* rstat) const ; /*! \brief Set the status of column and row variables and update the basis factorization and solution. Status information should be coded as documented for #getBasisStatus. Returns 0 if all goes well, 1 if something goes wrong. This method differs from #setWarmStart in the format of the input and in its immediate effect. Think of it as #setWarmStart immediately followed by #resolve, but no pivots are allowed. \note Implementors may choose to implement this method as a wrapper that calls #setWarmStart and #resolve if the no pivot requirement can be satisfied. */ virtual int setBasisStatus(const int* cstat, const int* rstat) ; /*! \brief Calculate duals and reduced costs for the given objective coefficients. The solver's objective coefficient vector is not changed. */ virtual void getReducedGradient(double* columnReducedCosts, double* duals, const double* c) const ; /*! \brief Get a row of the tableau If \p slack is not null, it will be loaded with the coefficients for the artificial (logical) variables (i.e., the row of the basis inverse). */ virtual void getBInvARow(int row, double* z, double* slack = NULL) const ; /*! \brief Get a row of the basis inverse */ virtual void getBInvRow(int row, double* z) const ; /*! \brief Get a column of the tableau */ virtual void getBInvACol(int col, double* vec) const ; /*! \brief Get a column of the basis inverse */ virtual void getBInvCol(int col, double* vec) const ; /*! \brief Get indices of basic variables If the logical (artificial) for row i is basic, the index should be coded as (#getNumCols + i). The order of indices must match the order of elements in the vectors returned by #getBInvACol and #getBInvCol. */ virtual void getBasics(int* index) const ; //@} /*! \name OsiSimplex Group 2 \brief Pivoting methods This group of methods provides for control of individual pivots by a simplex solver. */ //@{ /**Enables normal operation of subsequent functions. This method is supposed to ensure that all typical things (like reduced costs, etc.) are updated when individual pivots are executed and can be queried by other methods. says whether will be doing primal or dual */ virtual void enableSimplexInterface(bool doingPrimal) ; ///Undo whatever setting changes the above method had to make virtual void disableSimplexInterface() ; /** Perform a pivot by substituting a colIn for colOut in the basis. The status of the leaving variable is given in outStatus. Where 1 is to upper bound, -1 to lower bound Return code was undefined - now for OsiClp is 0 for okay, 1 if inaccuracy forced re-factorization (should be okay) and -1 for singular factorization */ virtual int pivot(int colIn, int colOut, int outStatus) ; /** Obtain a result of the primal pivot Outputs: colOut -- leaving column, outStatus -- its status, t -- step size, and, if dx!=NULL, *dx -- primal ray direction. Inputs: colIn -- entering column, sign -- direction of its change (+/-1). Both for colIn and colOut, artificial variables are index by the negative of the row index minus 1. Return code (for now): 0 -- leaving variable found, -1 -- everything else? Clearly, more informative set of return values is required Primal and dual solutions are updated */ virtual int primalPivotResult(int colIn, int sign, int& colOut, int& outStatus, double& t, CoinPackedVector* dx); /** Obtain a result of the dual pivot (similar to the previous method) Differences: entering variable and a sign of its change are now the outputs, the leaving variable and its statuts -- the inputs If dx!=NULL, then *dx contains dual ray Return code: same */ virtual int dualPivotResult(int& colIn, int& sign, int colOut, int outStatus, double& t, CoinPackedVector* dx) ; //@} //--------------------------------------------------------------------------- ///@name Constructors and destructors //@{ /// Default Constructor OsiSolverInterface(); /** Clone The result of calling clone(false) is defined to be equivalent to calling the default constructor OsiSolverInterface(). */ virtual OsiSolverInterface * clone(bool copyData = true) const = 0; /// Copy constructor OsiSolverInterface(const OsiSolverInterface &); /// Assignment operator OsiSolverInterface & operator=(const OsiSolverInterface& rhs); /// Destructor virtual ~OsiSolverInterface (); /** Reset the solver interface. A call to reset() returns the solver interface to the same state as it would have if it had just been constructed by calling the default constructor OsiSolverInterface(). */ virtual void reset(); //@} //--------------------------------------------------------------------------- protected: ///@name Protected methods //@{ /** Apply a row cut (append to the constraint matrix). */ virtual void applyRowCut( const OsiRowCut & rc ) = 0; /** Apply a column cut (adjust the bounds of one or more variables). */ virtual void applyColCut( const OsiColCut & cc ) = 0; /** A quick inlined function to convert from the lb/ub style of constraint definition to the sense/rhs/range style */ inline void convertBoundToSense(const double lower, const double upper, char& sense, double& right, double& range) const; /** A quick inlined function to convert from the sense/rhs/range style of constraint definition to the lb/ub style */ inline void convertSenseToBound(const char sense, const double right, const double range, double& lower, double& upper) const; /** A quick inlined function to force a value to be between a minimum and a maximum value */ template inline T forceIntoRange(const T value, const T lower, const T upper) const { return value < lower ? lower : (value > upper ? upper : value); } /** Set OsiSolverInterface object state for default constructor This routine establishes the initial values of data fields in the OsiSolverInterface object when the object is created using the default constructor. */ void setInitialData(); //@} ///@name Protected member data //@{ /*! \brief Pointer to row cut debugger object Mutable so that we can update the solution held in the debugger while maintaining const'ness for the Osi object. */ mutable OsiRowCutDebugger * rowCutDebugger_; // Why not just make useful stuff protected? /// Message handler CoinMessageHandler * handler_; /** Flag to say if the currrent handler is the default handler. Indicates if the solver interface object is responsible for destruction of the handler (true) or if the client is responsible (false). */ bool defaultHandler_; /// Messages CoinMessages messages_; /// Number of integers int numberIntegers_; /// Total number of objects int numberObjects_; /// Integer and ... information (integer info normally at beginning) OsiObject ** object_; /** Column type 0 - continuous 1 - binary (may get fixed later) 2 - general integer (may get fixed later) */ mutable char * columnType_; //@} //--------------------------------------------------------------------------- private: ///@name Private member data //@{ /// Pointer to user-defined data structure - and more if user wants OsiAuxInfo * appDataEtc_; /// Array of integer parameters int intParam_[OsiLastIntParam]; /// Array of double parameters double dblParam_[OsiLastDblParam]; /// Array of string parameters std::string strParam_[OsiLastStrParam]; /// Array of hint parameters bool hintParam_[OsiLastHintParam]; /// Array of hint strengths OsiHintStrength hintStrength_[OsiLastHintParam]; /** Warm start information used for hot starts when the default hot start implementation is used. */ CoinWarmStart* ws_; /// Column solution satisfying lower and upper column bounds std::vector strictColSolution_; /// Row names OsiNameVec rowNames_ ; /// Column names OsiNameVec colNames_ ; /// Objective name std::string objName_ ; //@} }; //############################################################################# /** A quick inlined function to convert from the lb/ub style of constraint definition to the sense/rhs/range style */ inline void OsiSolverInterface::convertBoundToSense(const double lower, const double upper, char& sense, double& right, double& range) const { double inf = getInfinity(); range = 0.0; if (lower > -inf) { if (upper < inf) { right = upper; if (upper==lower) { sense = 'E'; } else { sense = 'R'; range = upper - lower; } } else { sense = 'G'; right = lower; } } else { if (upper < inf) { sense = 'L'; right = upper; } else { sense = 'N'; right = 0.0; } } } //----------------------------------------------------------------------------- /** A quick inlined function to convert from the sense/rhs/range style of constraint definition to the lb/ub style */ inline void OsiSolverInterface::convertSenseToBound(const char sense, const double right, const double range, double& lower, double& upper) const { double inf=getInfinity(); switch (sense) { case 'E': lower = upper = right; break; case 'L': lower = -inf; upper = right; break; case 'G': lower = right; upper = inf; break; case 'R': lower = right - range; upper = right; break; case 'N': lower = -inf; upper = inf; break; } } #endif CoinMP-1.8.3/Osi/src/Osi/OsiAuxInfo.hpp0000644000175000017500000001776711510425067016147 0ustar renerene// Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiAuxInfo_H #define OsiAuxInfo_H class OsiSolverInterface; //############################################################################# /** This class allows for a more structured use of algorithmic tweaking to an OsiSolverInterface. It is designed to replace the simple use of appData_ pointer. This has been done to make it easier to use NonLinear solvers and other exotic beasts in a branch and bound mode. After this class definition there is one for a derived class for just such a purpose. */ class OsiAuxInfo { public: // Default Constructor OsiAuxInfo (void * appData = NULL); // Copy Constructor OsiAuxInfo (const OsiAuxInfo & rhs); // Destructor virtual ~OsiAuxInfo(); /// Clone virtual OsiAuxInfo * clone() const; /// Assignment operator OsiAuxInfo & operator=(const OsiAuxInfo& rhs); /// Get application data inline void * getApplicationData() const { return appData_;} protected: /// Pointer to user-defined data structure void * appData_; }; //############################################################################# /** This class allows for the use of more exotic solvers e.g. Non-Linear or Volume. You can derive from this although at present I can't see the need. */ class OsiBabSolver : public OsiAuxInfo { public: // Default Constructor OsiBabSolver (int solverType=0); // Copy Constructor OsiBabSolver (const OsiBabSolver & rhs); // Destructor virtual ~OsiBabSolver(); /// Clone virtual OsiAuxInfo * clone() const; /// Assignment operator OsiBabSolver & operator=(const OsiBabSolver& rhs); /// Update solver inline void setSolver(const OsiSolverInterface * solver) { solver_ = solver;} /// Update solver inline void setSolver(const OsiSolverInterface & solver) { solver_ = &solver;} /** returns 0 if no heuristic solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value numberColumns is size of newSolution */ int solution(double & objectiveValue, double * newSolution, int numberColumns); /** Set solution and objective value. Number of columns and optimization direction taken from current solver. Size of solution is numberColumns (may be padded or truncated in function) */ void setSolution(const double * solution, int numberColumns, double objectiveValue); /** returns true if the object stores a solution, false otherwise. If there is a solution then solutionValue and solution will be filled out as well. In that case the user needs to allocate solution to be a big enough array. */ bool hasSolution(double & solutionValue, double * solution); /** Sets solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or similar - can't compute objective value just from solution check solver to see if feasible and what objective value is - may also return heuristic solution 3 - NLP solver or similar - can't compute objective value just from solution check this (rather than solver) to see if feasible and what objective value is. Using Outer Approximation so called lp based - may also return heuristic solution 4 - normal solver but cuts are needed for integral solution */ inline void setSolverType(int value) { solverType_=value;} /** gets solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or similar - can't compute objective value just from solution check this (rather than solver) to see if feasible and what objective value is - may also return heuristic solution 3 - NLP solver or similar - can't compute objective value just from solution check this (rather than solver) to see if feasible and what objective value is. Using Outer Approximation so called lp based - may also return heuristic solution 4 - normal solver but cuts are needed for integral solution */ inline int solverType() const { return solverType_;} /** Return true if getting solution may add cuts so hot start etc will be obsolete */ inline bool solutionAddsCuts() const { return solverType_==3;} /// Return true if we should try cuts at root even if looks satisfied inline bool alwaysTryCutsAtRootNode() const { return solverType_==4;} /** Returns true if can use solver objective or feasible values, otherwise use mipBound etc */ inline bool solverAccurate() const { return solverType_==0||solverType_==2||solverType_==4;} /// Returns true if can use reduced costs for fixing inline bool reducedCostsAccurate() const { return solverType_==0||solverType_==4;} /// Get objective (well mip bound) double mipBound() const; /// Returns true if node feasible bool mipFeasible() const; /// Set mip bound (only used for some solvers) inline void setMipBound(double value) { mipBound_ = value;} /// Get objective value of saved solution inline double bestObjectiveValue() const { return bestObjectiveValue_;} /// Says whether we want to try cuts at all inline bool tryCuts() const { return solverType_!=2;} /// Says whether we have a warm start (so can do strong branching) inline bool warmStart() const { return solverType_!=2;} /** Get bit mask for odd actions of solvers 1 - solution or bound arrays may move in mysterious ways e.g. cplex 2 - solver may want bounds before branch */ inline int extraCharacteristics() const { return extraCharacteristics_;} /** Set bit mask for odd actions of solvers 1 - solution or bound arrays may move in mysterious ways e.g. cplex 2 - solver may want bounds before branch */ inline void setExtraCharacteristics(int value) { extraCharacteristics_=value;} /// Pointer to lower bounds before branch (only if extraCharacteristics set) inline const double * beforeLower() const { return beforeLower_;} /// Set pointer to lower bounds before branch (only if extraCharacteristics set) inline void setBeforeLower(const double * array) { beforeLower_ = array;} /// Pointer to upper bounds before branch (only if extraCharacteristics set) inline const double * beforeUpper() const { return beforeUpper_;} /// Set pointer to upper bounds before branch (only if extraCharacteristics set) inline void setBeforeUpper(const double * array) { beforeUpper_ = array;} protected: /// Objective value of best solution (if there is one) (minimization) double bestObjectiveValue_; /// Current lower bound on solution ( if > 1.0e50 infeasible) double mipBound_; /// Solver to use for getting/setting solutions etc const OsiSolverInterface * solver_; /// Best integer feasible solution double * bestSolution_; /// Pointer to lower bounds before branch (only if extraCharacteristics set) const double * beforeLower_; /// Pointer to upper bounds before branch (only if extraCharacteristics set) const double * beforeUpper_; /** Solver type 0 - normal LP solver 1 - DW - may also return heuristic solutions 2 - NLP solver or similar - can't compute objective value just from solution check this (rather than solver) to see if feasible and what objective value is - may also return heuristic solution 3 - NLP solver or similar - can't compute objective value just from solution check this (rather than solver) to see if feasible and what objective value is. Using Outer Approximation so called lp based - may also return heuristic solution */ int solverType_; /// Size of solution int sizeSolution_; /** Bit mask for odd actions of solvers 1 - solution or bound arrays may move in mysterious ways e.g. cplex 2 - solver may want bounds before branch */ int extraCharacteristics_; }; #endif CoinMP-1.8.3/Osi/src/Osi/OsiSolverBranch.hpp0000644000175000017500000000777511552534623017171 0ustar renerene// Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiSolverBranch_H #define OsiSolverBranch_H class OsiSolverInterface; #include "CoinWarmStartBasis.hpp" //############################################################################# /** Solver Branch Class This provides information on a branch as a set of tighter bounds on both ways */ class OsiSolverBranch { public: ///@name Add and Get methods //@{ /// Add a simple branch (i.e. first sets ub of floor(value), second lb of ceil(value)) void addBranch(int iColumn, double value); /// Add bounds - way =-1 is first , +1 is second void addBranch(int way,int numberTighterLower, const int * whichLower, const double * newLower, int numberTighterUpper, const int * whichUpper, const double * newUpper); /// Add bounds - way =-1 is first , +1 is second void addBranch(int way,int numberColumns,const double * oldLower, const double * newLower, const double * oldUpper, const double * newUpper); /// Apply bounds void applyBounds(OsiSolverInterface & solver,int way) const; /// Returns true if current solution satsifies one side of branch bool feasibleOneWay(const OsiSolverInterface & solver) const; /// Starts inline const int * starts() const { return start_;} /// Which variables inline const int * which() const { return indices_;} /// Bounds inline const double * bounds() const { return bound_;} //@} ///@name Constructors and destructors //@{ /// Default Constructor OsiSolverBranch(); /// Copy constructor OsiSolverBranch(const OsiSolverBranch & rhs); /// Assignment operator OsiSolverBranch & operator=(const OsiSolverBranch & rhs); /// Destructor ~OsiSolverBranch (); //@} private: ///@name Private member data //@{ /// Start of lower first, upper first, lower second, upper second int start_[5]; /// Column numbers (if >= numberColumns treat as rows) int * indices_; /// New bounds double * bound_; //@} }; //############################################################################# /** Solver Result Class This provides information on a result as a set of tighter bounds on both ways */ class OsiSolverResult { public: ///@name Add and Get methods //@{ /// Create result void createResult(const OsiSolverInterface & solver,const double * lowerBefore, const double * upperBefore); /// Restore result void restoreResult(OsiSolverInterface & solver) const; /// Get basis inline const CoinWarmStartBasis & basis() const { return basis_;} /// Objective value (as minimization) inline double objectiveValue() const { return objectiveValue_;} /// Primal solution inline const double * primalSolution() const { return primalSolution_;} /// Dual solution inline const double * dualSolution() const { return dualSolution_;} /// Extra fixed inline const OsiSolverBranch & fixed() const { return fixed_;} //@} ///@name Constructors and destructors //@{ /// Default Constructor OsiSolverResult(); /// Constructor from solver OsiSolverResult(const OsiSolverInterface & solver,const double * lowerBefore, const double * upperBefore); /// Copy constructor OsiSolverResult(const OsiSolverResult & rhs); /// Assignment operator OsiSolverResult & operator=(const OsiSolverResult & rhs); /// Destructor ~OsiSolverResult (); //@} private: ///@name Private member data //@{ /// Value of objective (if >= OsiSolverInterface::getInfinity() then infeasible) double objectiveValue_; /// Warm start information CoinWarmStartBasis basis_; /// Primal solution (numberColumns) double * primalSolution_; /// Dual solution (numberRows) double * dualSolution_; /// Which extra variables have been fixed (only way==-1 counts) OsiSolverBranch fixed_; //@} }; #endif CoinMP-1.8.3/Osi/src/Osi/OsiAuxInfo.cpp0000644000175000017500000001062311552534623016127 0ustar renerene// Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "OsiSolverInterface.hpp" #include "OsiAuxInfo.hpp" // Default Constructor OsiAuxInfo::OsiAuxInfo(void * appData) : appData_(appData) { } // Destructor OsiAuxInfo::~OsiAuxInfo () { } // Clone OsiAuxInfo * OsiAuxInfo::clone() const { return new OsiAuxInfo(*this); } // Copy constructor OsiAuxInfo::OsiAuxInfo(const OsiAuxInfo & rhs) : appData_(rhs.appData_) { } OsiAuxInfo & OsiAuxInfo::operator=(const OsiAuxInfo &rhs) { if (this != &rhs) { appData_ = rhs.appData_; } return *this; } // Default Constructor OsiBabSolver::OsiBabSolver(int solverType) :OsiAuxInfo(), bestObjectiveValue_(1.0e100), mipBound_(-1.0e100), solver_(NULL), bestSolution_(NULL), beforeLower_(NULL), beforeUpper_(NULL), solverType_(solverType), sizeSolution_(0), extraCharacteristics_(0) { } // Destructor OsiBabSolver::~OsiBabSolver () { delete [] bestSolution_; } // Clone OsiAuxInfo * OsiBabSolver::clone() const { return new OsiBabSolver(*this); } // Copy constructor OsiBabSolver::OsiBabSolver(const OsiBabSolver & rhs) : OsiAuxInfo(rhs), bestObjectiveValue_(rhs.bestObjectiveValue_), mipBound_(rhs.mipBound_), solver_(rhs.solver_), bestSolution_(NULL), beforeLower_(rhs.beforeLower_), beforeUpper_(rhs.beforeUpper_), solverType_(rhs.solverType_), sizeSolution_(rhs.sizeSolution_), extraCharacteristics_(rhs.extraCharacteristics_) { if (rhs.bestSolution_) { assert (solver_); bestSolution_ = CoinCopyOfArray(rhs.bestSolution_,sizeSolution_); } } OsiBabSolver & OsiBabSolver::operator=(const OsiBabSolver &rhs) { if (this != &rhs) { OsiAuxInfo::operator=(rhs); delete [] bestSolution_; solver_ = rhs.solver_; solverType_ = rhs.solverType_; bestObjectiveValue_ = rhs.bestObjectiveValue_; bestSolution_ = NULL; mipBound_ = rhs.mipBound_; sizeSolution_ = rhs.sizeSolution_; extraCharacteristics_ = rhs.extraCharacteristics_; beforeLower_ = rhs.beforeLower_; beforeUpper_ = rhs.beforeUpper_; if (rhs.bestSolution_) { assert (solver_); bestSolution_ = CoinCopyOfArray(rhs.bestSolution_,sizeSolution_); } } return *this; } // Returns 1 if solution, 0 if not int OsiBabSolver::solution(double & solutionValue, double * betterSolution, int numberColumns) { if (!solver_) return 0; //printf("getSol %x solution_address %x - value %g\n", // this,bestSolution_,bestObjectiveValue_); if (bestObjectiveValue_getNumCols(); memcpy(solution,bestSolution_,numberColumns*sizeof(double)); solutionValue = bestObjectiveValue_; return true; } // set solution void OsiBabSolver::setSolution(const double * solution, int numberColumns, double objectiveValue) { assert (solver_); // just in case size has changed delete [] bestSolution_; sizeSolution_ = CoinMin(solver_->getNumCols(),numberColumns); bestSolution_ = new double [sizeSolution_]; CoinZeroN(bestSolution_,sizeSolution_); CoinMemcpyN(solution,CoinMin(sizeSolution_,numberColumns),bestSolution_); bestObjectiveValue_ = objectiveValue*solver_->getObjSense(); } // Get objective (well mip bound) double OsiBabSolver::mipBound() const { assert (solver_); if (solverType_!=3) return solver_->getObjSense()*solver_->getObjValue(); else return mipBound_; } // Returns true if node feasible bool OsiBabSolver::mipFeasible() const { assert (solver_); if (solverType_==0) return true; else if (solverType_!=3) return solver_->isProvenOptimal(); else return mipBound_<1.0e50; } CoinMP-1.8.3/Osi/src/Osi/OsiSolverParameters.hpp0000644000175000017500000001113611670247610020057 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiSolverParameters_H #define OsiSolverParameters_H enum OsiIntParam { /*! \brief Iteration limit for initial solve and resolve. The maximum number of iterations (whatever that means for the given solver) the solver can execute in the OsiSolverinterface::initialSolve() and OsiSolverinterface::resolve() methods before terminating. */ OsiMaxNumIteration = 0, /*! \brief Iteration limit for hot start The maximum number of iterations (whatever that means for the given solver) the solver can execute in the OsiSolverinterface::solveFromHotStart() method before terminating. */ OsiMaxNumIterationHotStart, /*! \brief Handling of row and column names. The name discipline specifies how the solver will handle row and column names: - 0: Auto names: Names cannot be set by the client. Names of the form Rnnnnnnn or Cnnnnnnn are generated on demand when a name for a specific row or column is requested; nnnnnnn is derived from the row or column index. Requests for a vector of names return a vector with zero entries. - 1: Lazy names: Names supplied by the client are retained. Names of the form Rnnnnnnn or Cnnnnnnn are generated on demand if no name has been supplied by the client. Requests for a vector of names return a vector sized to the largest index of a name supplied by the client; some entries in the vector may be null strings. - 2: Full names: Names supplied by the client are retained. Names of the form Rnnnnnnn or Cnnnnnnn are generated on demand if no name has been supplied by the client. Requests for a vector of names return a vector sized to match the constraint system, and all entries will contain either the name specified by the client or a generated name. */ OsiNameDiscipline, /*! \brief End marker. Used by OsiSolverInterface to allocate a fixed-sized array to store integer parameters. */ OsiLastIntParam } ; enum OsiDblParam { /*! \brief Dual objective limit. This is to be used as a termination criteria in algorithms where the dual objective changes monotonically (e.g., dual simplex, volume algorithm). */ OsiDualObjectiveLimit = 0, /*! \brief Primal objective limit. This is to be used as a termination criteria in algorithms where the primal objective changes monotonically (e.g., primal simplex) */ OsiPrimalObjectiveLimit, /*! \brief Dual feasibility tolerance. The maximum amount a dual constraint can be violated and still be considered feasible. */ OsiDualTolerance, /*! \brief Primal feasibility tolerance. The maximum amount a primal constraint can be violated and still be considered feasible. */ OsiPrimalTolerance, /** The value of any constant term in the objective function. */ OsiObjOffset, /*! \brief End marker. Used by OsiSolverInterface to allocate a fixed-sized array to store double parameters. */ OsiLastDblParam }; enum OsiStrParam { /*! \brief The name of the loaded problem. This is the string specified on the Name card of an mps file. */ OsiProbName = 0, /*! \brief The name of the solver. This parameter is read-only. */ OsiSolverName, /*! \brief End marker. Used by OsiSolverInterface to allocate a fixed-sized array to store string parameters. */ OsiLastStrParam }; enum OsiHintParam { /** Whether to do a presolve in initialSolve */ OsiDoPresolveInInitial = 0, /** Whether to use a dual algorithm in initialSolve. The reverse is to use a primal algorithm */ OsiDoDualInInitial, /** Whether to do a presolve in resolve */ OsiDoPresolveInResolve, /** Whether to use a dual algorithm in resolve. The reverse is to use a primal algorithm */ OsiDoDualInResolve, /** Whether to scale problem */ OsiDoScale, /** Whether to create a non-slack basis (only in initialSolve) */ OsiDoCrash, /** Whether to reduce amount of printout, e.g., for branch and cut */ OsiDoReducePrint, /** Whether we are in branch and cut - so can modify behavior */ OsiDoInBranchAndCut, /** Just a marker, so that OsiSolverInterface can allocate a static sized array to store parameters. */ OsiLastHintParam }; enum OsiHintStrength { /** Ignore hint (default) */ OsiHintIgnore = 0, /** This means it is only a hint */ OsiHintTry, /** This means do hint if at all possible */ OsiHintDo, /** And this means throw an exception if not possible */ OsiForceDo }; #endif CoinMP-1.8.3/Osi/src/Osi/OsiCut.hpp0000644000175000017500000001652311552534623015323 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiCut_H #define OsiCut_H #include "OsiCollections.hpp" #include "OsiSolverInterface.hpp" /** Base Class for cut. The Base cut class contains:
  • a measure of the cut's effectivness
*/ /* COIN_NOTEST_DUPLICATE is rooted in CoinUtils. Check there before you meddle here. */ #ifdef COIN_FAST_CODE #ifndef COIN_NOTEST_DUPLICATE #define COIN_NOTEST_DUPLICATE #endif #endif #ifndef COIN_NOTEST_DUPLICATE #define COIN_DEFAULT_VALUE_FOR_DUPLICATE true #else #define COIN_DEFAULT_VALUE_FOR_DUPLICATE false #endif class OsiCut { public: //------------------------------------------------------------------- /**@name Effectiveness */ //@{ /// Set effectiveness inline void setEffectiveness( double e ); /// Get effectiveness inline double effectiveness() const; //@} /**@name GloballyValid */ //@{ /// Set globallyValid (nonzero true) inline void setGloballyValid( bool trueFalse ) { globallyValid_=trueFalse ? 1 : 0;} inline void setGloballyValid( ) { globallyValid_=1;} inline void setNotGloballyValid( ) { globallyValid_=0;} /// Get globallyValid inline bool globallyValid() const { return globallyValid_!=0;} /// Set globallyValid as integer (nonzero true) inline void setGloballyValidAsInteger( int trueFalse ) { globallyValid_=trueFalse;} /// Get globallyValid inline int globallyValidAsInteger() const { return globallyValid_;} //@} /**@name Debug stuff */ //@{ /// Print cuts in collection virtual void print() const {} //@} #if 0 / **@name Times used */ / /@{ / // Set times used inline void setTimesUsed( int t ); / // Increment times used inline void incrementTimesUsed(); / // Get times used inline int timesUsed() const; / /@} / **@name Times tested */ / /@{ / // Set times tested inline void setTimesTested( int t ); / // Increment times tested inline void incrementTimesTested(); / // Get times tested inline int timesTested() const; / /@} #endif //---------------------------------------------------------------- /**@name Comparison operators */ //@{ ///equal. 2 cuts are equal if there effectiveness are equal inline virtual bool operator==(const OsiCut& rhs) const; /// not equal inline virtual bool operator!=(const OsiCut& rhs) const; /// less than. True if this.effectiveness < rhs.effectiveness inline virtual bool operator< (const OsiCut& rhs) const; /// less than. True if this.effectiveness > rhs.effectiveness inline virtual bool operator> (const OsiCut& rhs) const; //@} //---------------------------------------------------------------- // consistent() - returns true if the cut is consistent with repect to itself. // This might include checks to ensure that a packed vector // itself does not have a negative index. // consistent(const OsiSolverInterface& si) - returns true if cut is consistent with // respect to the solver interface's model. This might include a check to // make sure a column index is not greater than the number // of columns in the problem. // infeasible(const OsiSolverInterface& si) - returns true if the cut is infeasible // "with respect to itself". This might include a check to ensure // the lower bound is greater than the upper bound, or if the // cut simply replaces bounds that the new bounds are feasible with // respect to the old bounds. //----------------------------------------------------------------- /**@name Sanity checks on cut */ //@{ /** Returns true if the cut is consistent with respect to itself, without considering any data in the model. For example, it might check to ensure that a column index is not negative. */ inline virtual bool consistent() const=0; /** Returns true if cut is consistent when considering the solver interface's model. For example, it might check to ensure that a column index is not greater than the number of columns in the model. Assumes consistent() is true. */ inline virtual bool consistent(const OsiSolverInterface& si) const=0; /** Returns true if the cut is infeasible "with respect to itself" and cannot be satisfied. This method does NOT check whether adding the cut to the solver interface's model will make the -model- infeasble. A cut which returns !infeasible(si) may very well make the model infeasible. (Of course, adding a cut with returns infeasible(si) will make the model infeasible.) The "with respect to itself" is in quotes becaues in the case where the cut simply replaces existing bounds, it may make sense to test infeasibility with respect to the current bounds held in the solver interface's model. For example, if the cut has a single variable in it, it might check that the maximum of new and existing lower bounds is greater than the minium of the new and existing upper bounds. Assumes that consistent(si) is true.
Infeasible cuts can be a useful mechanism for a cut generator to inform the solver interface that its detected infeasibility of the problem. */ inline virtual bool infeasible(const OsiSolverInterface &si) const=0; /** Returns infeasibility of the cut with respect to solution passed in i.e. is positive if cuts off that solution. solution is getNumCols() long.. */ virtual double violated(const double * solution) const=0; //@} protected: /**@name Constructors and destructors */ //@{ /// Default Constructor OsiCut (); /// Copy constructor OsiCut ( const OsiCut &); /// Assignment operator OsiCut & operator=( const OsiCut& rhs); /// Destructor virtual ~OsiCut (); //@} private: /**@name Private member data */ //@{ /// Effectiveness double effectiveness_; /// If cut has global validity i.e. can be used anywhere in tree int globallyValid_; #if 0 /// Times used int timesUsed_; /// Times tested int timesTested_; #endif //@} }; //------------------------------------------------------------------- // Set/Get member data //------------------------------------------------------------------- void OsiCut::setEffectiveness(double e) { effectiveness_=e; } double OsiCut::effectiveness() const { return effectiveness_; } #if 0 void OsiCut::setTimesUsed( int t ) { timesUsed_=t; } void OsiCut::incrementTimesUsed() { timesUsed_++; } int OsiCut::timesUsed() const { return timesUsed_; } void OsiCut::setTimesTested( int t ) { timesTested_=t; } void OsiCut::incrementTimesTested() { timesTested_++; } int OsiCut::timesTested() const{ return timesTested_; } #endif //---------------------------------------------------------------- // == operator //------------------------------------------------------------------- bool OsiCut::operator==(const OsiCut& rhs) const { return effectiveness()==rhs.effectiveness(); } bool OsiCut::operator!=(const OsiCut& rhs) const { return !( (*this)==rhs ); } bool OsiCut::operator< (const OsiCut& rhs) const { return effectiveness() (const OsiCut& rhs) const { return effectiveness()>rhs.effectiveness(); } #endif CoinMP-1.8.3/Osi/src/Osi/OsiCollections.hpp0000644000175000017500000000147611510425067017042 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiCollections_H #define OsiCollections_H #include //Forward declarations class OsiColCut; class OsiRowCut; class OsiCut; /* Collection Classes */ /**@name Typedefs for Standard Template Library collections of Osi Objects. */ //@{ /// Vector of int typedef std::vector OsiVectorInt; /// Vector of double typedef std::vector OsiVectorDouble; /// Vector of OsiColCut pointers typedef std::vector OsiVectorColCutPtr; /// Vector of OsiRowCut pointers typedef std::vector OsiVectorRowCutPtr; /// Vector of OsiCut pointers typedef std::vector OsiVectorCutPtr; //@} #endif CoinMP-1.8.3/Osi/src/Osi/config_default.h0000644000175000017500000000240012101340333016473 0ustar renerene /* include the COIN-OR-wide system specific configure header */ #include "configall_system.h" /* include the public project specific macros */ #include "config_osi_default.h" /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Define to the debug sanity check level (0 is no test) */ #define COIN_OSI_CHECKLEVEL 0 /* Define to the debug verbosity level (0 is no output) */ #define COIN_OSI_VERBOSITY 0 /* Define to 1 if the CoinUtils package is used. * Don't undef this unless you really know what you're doing. */ #define COIN_HAS_COINUTILS 1 /* Define to 1 if the Cplex package is used */ /* #define COIN_HAS_CPX 1 */ /* Define to 1 if the Glpk package is used */ /* #define COIN_HAS_GLPK 1 */ /* Define to 1 if the Gurobi package is used */ /* #define COIN_HAS_GRB 1 */ /* Define to 1 if the Mosek package is used */ /* #define COIN_HAS_MSK 1 */ /* Define to 1 if the SoPlex package is used */ /* #define COIN_HAS_SPX 1 */ /* Define to 1 if the Xpress package is used */ /* #define COIN_HAS_XPR 1 */ CoinMP-1.8.3/Osi/src/Osi/OsiColCut.hpp0000644000175000017500000002053511575423733015763 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiColCut_H #define OsiColCut_H #include #include "CoinPackedVector.hpp" #include "OsiCollections.hpp" #include "OsiCut.hpp" /** Column Cut Class Column Cut Class has:
  • a sparse vector of column lower bounds
  • a sparse vector of column upper bounds
*/ class OsiColCut : public OsiCut { friend void OsiColCutUnitTest(const OsiSolverInterface * baseSiP, const std::string & mpsDir); public: //---------------------------------------------------------------- /**@name Setting column bounds */ //@{ /// Set column lower bounds inline void setLbs( int nElements, const int * colIndices, const double * lbElements ); /// Set column lower bounds from a packed vector inline void setLbs( const CoinPackedVector & lbs ); /// Set column upper bounds inline void setUbs( int nElements, const int * colIndices, const double * ubElements ); /// Set column upper bounds from a packed vector inline void setUbs( const CoinPackedVector & ubs ); //@} //---------------------------------------------------------------- /**@name Getting column bounds */ //@{ /// Get column lower bounds inline const CoinPackedVector & lbs() const; /// Get column upper bounds inline const CoinPackedVector & ubs() const; //@} /**@name Comparison operators */ //@{ #if __GNUC__ != 2 using OsiCut::operator== ; #endif /** equal - true if lower bounds, upper bounds, and OsiCut are equal. */ inline virtual bool operator==(const OsiColCut& rhs) const; #if __GNUC__ != 2 using OsiCut::operator!= ; #endif /// not equal inline virtual bool operator!=(const OsiColCut& rhs) const; //@} //---------------------------------------------------------------- /**@name Sanity checks on cut */ //@{ /** Returns true if the cut is consistent with respect to itself. This checks to ensure that:
  • The bound vectors do not have duplicate indices,
  • The bound vectors indices are >=0
*/ inline virtual bool consistent() const; /** Returns true if cut is consistent with respect to the solver interface's model. This checks to ensure that the lower & upperbound packed vectors:
  • do not have an index >= the number of column is the model.
*/ inline virtual bool consistent(const OsiSolverInterface& im) const; /** Returns true if the cut is infeasible with respect to its bounds and the column bounds in the solver interface's models. This checks whether:
  • the maximum of the new and existing lower bounds is strictly greater than the minimum of the new and existing upper bounds.
*/ inline virtual bool infeasible(const OsiSolverInterface &im) const; /** Returns infeasibility of the cut with respect to solution passed in i.e. is positive if cuts off that solution. solution is getNumCols() long.. */ virtual double violated(const double * solution) const; //@} //---------------------------------------------------------------- /**@name Constructors and destructors */ //@{ /// Assignment operator OsiColCut & operator=( const OsiColCut& rhs); /// Copy constructor OsiColCut ( const OsiColCut &); /// Default Constructor OsiColCut (); /// Clone virtual OsiColCut * clone() const; /// Destructor virtual ~OsiColCut (); //@} /**@name Debug stuff */ //@{ /// Print cuts in collection virtual void print() const; //@} private: /**@name Private member data */ //@{ /// Lower bounds CoinPackedVector lbs_; /// Upper bounds CoinPackedVector ubs_; //@} }; //------------------------------------------------------------------- // Set lower & upper bound vectors //------------------------------------------------------------------- void OsiColCut::setLbs( int size, const int * colIndices, const double * lbElements ) { lbs_.setVector(size,colIndices,lbElements); } // void OsiColCut::setUbs( int size, const int * colIndices, const double * ubElements ) { ubs_.setVector(size,colIndices,ubElements); } // void OsiColCut::setLbs( const CoinPackedVector & lbs ) { lbs_ = lbs; } // void OsiColCut::setUbs( const CoinPackedVector & ubs ) { ubs_ = ubs; } //------------------------------------------------------------------- // Get Column Lower Bounds and Column Upper Bounds //------------------------------------------------------------------- const CoinPackedVector & OsiColCut::lbs() const { return lbs_; } // const CoinPackedVector & OsiColCut::ubs() const { return ubs_; } //---------------------------------------------------------------- // == operator //------------------------------------------------------------------- bool OsiColCut::operator==( const OsiColCut& rhs) const { if ( this->OsiCut::operator!=(rhs) ) return false; if ( lbs() != rhs.lbs() ) return false; if ( ubs() != rhs.ubs() ) return false; return true; } // bool OsiColCut::operator!=( const OsiColCut& rhs) const { return !( (*this)==rhs ); } //---------------------------------------------------------------- // consistent & infeasible //------------------------------------------------------------------- bool OsiColCut::consistent() const { const CoinPackedVector & lb = lbs(); const CoinPackedVector & ub = ubs(); // Test for consistent cut. // Are packed vectors consistent? lb.duplicateIndex("consistent", "OsiColCut"); ub.duplicateIndex("consistent", "OsiColCut"); if ( lb.getMinIndex() < 0 ) return false; if ( ub.getMinIndex() < 0 ) return false; return true; } // bool OsiColCut::consistent(const OsiSolverInterface& im) const { const CoinPackedVector & lb = lbs(); const CoinPackedVector & ub = ubs(); // Test for consistent cut. if ( lb.getMaxIndex() >= im.getNumCols() ) return false; if ( ub.getMaxIndex() >= im.getNumCols() ) return false; return true; } #if 0 bool OsiColCut::feasible(const OsiSolverInterface &im) const { const double * oldColLb = im.getColLower(); const double * oldColUb = im.getColUpper(); const CoinPackedVector & cutLbs = lbs(); const CoinPackedVector & cutUbs = ubs(); int i; for ( i=0; i oldColLb[colIndx] ) newLb = cutLbs.elements()[i]; else newLb = oldColLb[colIndx]; double newUb = oldColUb[colIndx]; if ( cutUbs.indexExists(colIndx) ) if ( cutUbs[colIndx] < newUb ) newUb = cutUbs[colIndx]; if ( newLb > newUb ) return false; } for ( i=0; i newLb ) newLb = cutLbs[colIndx]; if ( newUb < newLb ) return false; } return true; } #endif bool OsiColCut::infeasible(const OsiSolverInterface &im) const { const double * oldColLb = im.getColLower(); const double * oldColUb = im.getColUpper(); const CoinPackedVector & cutLbs = lbs(); const CoinPackedVector & cutUbs = ubs(); int i; for ( i=0; i oldColLb[colIndx] ? cutLbs.getElements()[i] : oldColLb[colIndx]; double newUb = oldColUb[colIndx]; if ( cutUbs.isExistingIndex(colIndx) ) if ( cutUbs[colIndx] < newUb ) newUb = cutUbs[colIndx]; if ( newLb > newUb ) return true; } for ( i=0; i newLb ) newLb = cutLbs[colIndx]; if ( newUb < newLb ) return true; } return false; } #endif CoinMP-1.8.3/Osi/src/Osi/OsiRowCutDebugger.cpp0000644000175000017500000016105412130072766017451 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" #include "OsiRowCutDebugger.hpp" /* Check if any cuts cut off the known solution. If so then print offending cuts and return non-zero code */ int OsiRowCutDebugger::validateCuts (const OsiCuts & cs, int first, int last) const { int nbad=0; int i; const double epsilon=1.0e-8; const int nRowCuts = CoinMin(cs.sizeRowCuts(),last); for (i=first; iub + epsilon ||sum < lb - epsilon) { double violation=CoinMax(sum-ub,lb-sum); std::cout<<"Cut "<1.0e-9) { std::cout<<"( "<ub + epsilon ||sum < lb - epsilon) { double violation=CoinMax(sum-ub,lb-sum); std::cout<<"Cut with "<1.0e-9) { std::cout<<"( "<colupper[i]+1.0e-12) { printf("Infeasible bounds for %d - %g, %g\n", i,collower[i],colupper[i]); } if (si.isInteger(i)) { // value of integer variable in solution double value=knownSolution_[i]; if (value>colupper[i]+1.0e-3 || value colupper[j]+1.0e-3 || value < collower[j]-1.0e-3) { if (bad[0] < 0) { bad[0] = j ; } else { bad[1] = j ; } ok = false ; std::cout << "* " ; } if (value || !ok) std::cout << j << " " << value << std::endl ; } } for (int i = 0 ; i < 2 ; i++) { if (bad[i] >= 0) { int j = bad[i] ; std::cout << "BAD " << j << " " << collower[j] << " <= " << knownSolution_[j] << " <= " << colupper[j] << std::endl ; } } return (badVars) ; } else { // no information return -1; } } /* Activate a row cut debugger using the name of the model. A known optimal solution will be used to validate cuts. See the source below for the set of known problems. Most are miplib3. Returns true if the debugger is successfully activated. */ bool OsiRowCutDebugger::activate( const OsiSolverInterface & si, const char * model) { // set to true to print an activation message const bool printActivationNotice = false ; int i; //get rid of any arrays delete [] integerVariable_; delete [] knownSolution_; numberColumns_ = 0; int expectedNumberColumns = 0; enum {undefined, pure0_1, continuousWith0_1, generalMip } probType; // Convert input parameter model to be lowercase and // only consider characters between '/' and '.' std::string modelL; //name in lowercase for (i=0;i (strlen(model));i++) { char value=static_cast(tolower(model[i])); if (value=='/') { modelL.erase(); } else if (value=='.') { break; } else { modelL.append(1,value); } } CoinPackedVector intSoln; probType = undefined; //-------------------------------------------------------- // // Define additional problems by adding it as an additional // "else if ( modelL == '???' ) { ... }" // stanza below. // // Assign values to probType and intSoln. // // probType - pure0_1, continuousWith0_1, or generalMip // // intSoln - // when probType is pure0_1 // intSoln contains the indices of the variables // at 1 in the optimal solution // when probType is continuousWith0_1 // intSoln contains the indices of integer // variables at one in the optimal solution // when probType is generalMip // intSoln contains the the indices of the integer // variables and their value in the optimal solution //-------------------------------------------------------- // exmip1 if ( modelL == "exmip1" ) { probType=continuousWith0_1; intSoln.insert(2,1.); intSoln.insert(3,1.); expectedNumberColumns=8; } // p0033 else if ( modelL == "p0033" ) { probType=pure0_1; // Alternate solution -- 21,23 replace 22. // int intIndicesAt1[]={ 0,6,7,9,13,17,18,21,23,24,25,26,27,28,29 }; int intIndicesAt1[]={ 0,6,7,9,13,17,18,22,24,25,26,27,28,29 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=33; } // flugpl else if ( modelL == "flugpl" ) { probType=generalMip; int intIndicesV[] = { 1 , 3 , 4 , 6 , 7 , 9 ,10 ,12 ,13 ,15 }; double intSolnV[] = { 6.,60., 6.,60.,16.,70., 7.,70.,12.,75.}; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=18; } // enigma else if ( modelL == "enigma" ) { probType=pure0_1; int intIndicesAt1[]={ 0,18,25,36,44,59,61,77,82,93 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=100; } // mod011 else if ( modelL == "mod011" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 10,29,32,40,58,77,80,88 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=10958; } // probing else if ( modelL == "probing" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 1, 18, 33, 59 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=149; } // mas76 else if ( modelL == "mas76" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 4,11,13,18,42,46,48,52,85,93,114,119,123,128,147}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=151; } // ltw3 else if ( modelL == "ltw3" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 20,23,24,26,32,33,40,47 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=48; } // mod008 else if ( modelL == "mod008" ) { probType=pure0_1; int intIndicesAt1[]={1,59,83,116,123}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=319; } // mod010 else if ( modelL == "mod010" ) { probType=pure0_1; int intIndicesAt1[]={2,9,16,22,26,50,65,68,82,86,102,145, 149,158,181,191,266,296,376,479,555,625,725,851,981, 1030,1095,1260,1321,1339,1443,1459,1568,1602,1780,1856, 1951,2332,2352,2380,2471,2555,2577,2610,2646,2647}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=2655; } // modglob else if ( modelL == "modglob" ) { probType=continuousWith0_1; int intIndicesAt1[]={204,206,208,212,216,218,220,222,230,232, 234,236,244,248,250,254,256,258,260,262,264,266,268,274, 278,282,284,286,288}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=422; } // p0201 else if ( modelL == "p0201" ) { probType=pure0_1; int intIndicesAt1[]={8,10,21,38,39,56,60,74,79,92,94,110,111, 128,132,146,151,164,166,182,183,200}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=201; } // p0282 else if ( modelL == "p0282" ) { probType=pure0_1; int intIndicesAt1[]={3,11,91,101,103,117,155,169,191,199,215, 223,225,237,240,242,243,244,246,248,251,254,256,257,260, 262,263,273,275,276,277,280,281}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=282; } // p0548 else if ( modelL == "p0548" ) { probType=pure0_1; int intIndicesAt1[]={2,3,13,14,17,23,24,43,44,47,61,62,74,75, 81,82,92,93,96,98,105,120,126,129,140,141,153,154,161,162, 165,177,182,184,189,192,193,194,199,200,209,214,215,218,222, 226,234,239,247,256,257,260,274,286,301,305,306,314,317,318, 327,330,332,334,336,340,347,349,354,358,368,369,379,380,385, 388,389,390,393,394,397,401,402,406,407,417,419,420,423,427, 428,430,437,439,444,446,447,450,451,452,472,476,477,480,488, 491,494,500,503,508,509,510,511,512,515,517,518,519,521,522, 523,525,526,527,528,529,530,531,532,533,536,537,538,539,541, 542,545,547}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=548; } // p2756 else if ( modelL == "p2756" ) { probType=pure0_1; int intIndicesAt1[]={7,25,50,63,69,71,81,124,164,208,210,212,214, 220,266,268,285,299,301,322,362,399,455,464,468,475,518,574, 588,590,612,632,652,679,751,767,794,819,838,844,892,894,913, 919,954,966,996,998,1021,1027,1044,1188,1230,1248,1315,1348, 1366,1367,1420,1436,1473,1507,1509,1521,1555,1558,1607,1659, 1715,1746,1761,1789,1800,1844,1885,1913,1916,1931,1992,2002, 2050,2091,2155,2158,2159,2197,2198,2238,2264,2292,2318,2481, 2496,2497,2522,2531,2573,2583,2587,2588,2596,2635,2637,2639, 2643,2645,2651,2653,2672,2675,2680,2683,2708,2727,2730,2751}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=2756; } /* nw04 It turns out that the NAME line in nw04.mps distributed in miplib is actually NW-capital O-4. Who'd a thunk it? -- lh, 110402 -- */ else if ( modelL == "nw04" || modelL == "nwo4" ) { probType=pure0_1; int intIndicesAt1[]={ 231 ,1792 ,1980 ,7548 ,21051 ,28514 ,53087 ,53382 ,76917 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=87482; } // bell3a else if ( modelL == "bell3a" ) { probType=generalMip; int intIndicesV[]={61,62,65,66,67,68,69,70}; double intSolnV[] = {4.,21.,4.,4.,6.,1.,25.,8.}; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=133; } // 10teams else if ( modelL == "10teams" ) { probType=continuousWith0_1; int intIndicesAt1[]={236,298,339,379,443,462,520,576,616,646,690, 749,778,850,878,918,986,996,1065,1102,1164,1177,1232,1281,1338, 1358,1421,1474,1522,1533,1607,1621,1708,1714,1775,1835,1887, 1892,1945,1989}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=2025; } // rentacar else if ( modelL == "rentacar" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 9502 ,9505 ,9507 ,9511 ,9512 ,9513 ,9514 ,9515 ,9516 ,9521 , 9522 ,9526 ,9534 ,9535 ,9536 ,9537 ,9542 ,9543 ,9544 ,9548 , 9550 ,9554 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=9557; } // qiu else if ( modelL == "qiu" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 0 ,5 ,8 ,9 ,11 ,13 ,16 ,17 ,19 ,20 , 24 ,28 ,32 ,33 ,35 ,37 ,40 ,47 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=840; } // pk1 else if ( modelL == "pk1" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 1 ,4 ,5 ,6 ,7 ,11 ,13 ,16 ,17 ,23 , 24 ,27 ,28 ,34 ,35 ,37 ,43 ,44 ,45 ,46 , 47 ,51 ,52 ,54 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=86; } // pp08a else if ( modelL == "pp08a" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 177 ,179 ,181 ,183 ,185 ,190 ,193 ,195 ,197 ,199 , 202 ,204 ,206 ,208 ,216 ,220 ,222 ,229 ,235 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=240; } // pp08aCUTS else if ( modelL == "pp08acuts" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 177 ,179 ,181 ,183 ,185 ,190 ,193 ,195 ,197 ,199 , 202 ,204 ,206 ,208 ,216 ,220 ,222 ,229 ,235 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=240; } // danoint else if ( modelL == "danoint" ) { probType=continuousWith0_1; int intIndicesAt1[]={3,5,8,11,15,21,24,25,31,34,37,42,46,48,51,56}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=521; } // dcmulti else if ( modelL == "dcmulti" ) { probType=continuousWith0_1; int intIndicesAt1[]={2,3,11,14,15,16,21,24,28,34,35,36,39,40,41,42, 45,52,53,60,61,64,65,66,67}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=548; } // egout else if ( modelL == "egout" ) { probType=continuousWith0_1; int intIndicesAt1[]={0,3,5,7,8,9,11,12,13,15,16,17,18,20,21,22, 23,24,25,26,27,28,29,32,34,36,37,38,39,40,42,43,44,45,46,47, 48,49,52,53,54}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=141; } // fixnet6 else if ( modelL == "fixnet6" ) { probType=continuousWith0_1; int intIndicesAt1[]={1,16,23,31,37,51,64,179,200,220,243,287, 375,413,423,533,537,574,688,690,693,712,753,773,778,783,847}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=878; } // khb05250 else if ( modelL == "khb05250" ) { probType=continuousWith0_1; int intIndicesAt1[]={1,3,8,11,12,15,16,17,18,21,22,23}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=1350; } // lseu else if ( modelL == "lseu" ) { probType=pure0_1; int intIndicesAt1[]={0,1,6,13,26,33,38,43,50,52,63,65,85}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=89; } // air03 else if ( modelL == "air03" ) { probType=pure0_1; int intIndicesAt1[]={ 1, 3, 5, 13, 14, 28, 38, 49, 75, 76, 151, 185, 186, 271, 370, 466, 570, 614, 732, 819, 1151, 1257, 1490, 2303, 2524, 3301, 3616, 4129, 4390, 4712, 5013, 5457, 5673, 6436, 7623, 8122, 8929, 10689, 10694, 10741, 10751 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=10757; } // air04 else if ( modelL == "air04" ) { probType=pure0_1; int intIndicesAt1[]={ 0, 1, 3, 4, 5, 6, 7, 9, 11, 12, 13, 17, 19, 20, 21, 25, 26, 27, 28, 29, 32, 35, 36, 39, 40, 42, 44, 45, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 60, 63, 64, 66, 67, 68, 73, 74, 80, 81, 83, 85, 87, 92, 93, 94, 95, 99, 101, 102, 105, 472, 616, 680, 902, 1432, 1466, 1827, 2389, 2535, 2551, 2883, 3202, 3215, 3432, 3438, 3505, 3517, 3586, 3811, 3904, 4092, 4685, 4700, 4834, 4847, 4892, 5189, 5211, 5394, 5878, 6045, 6143, 6493, 6988, 7511, 7664, 7730, 7910, 8041, 8350, 8615, 8635, 8670 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=8904; } // air05 else if ( modelL == "air05" ) { probType=pure0_1; int intIndicesAt1[]={ 2, 4, 5, 6, 7, 8, 9, 10, 14, 15, 19, 20, 25, 34, 35, 37, 39, 40, 41, 42, 43, 44, 45, 47, 48, 50, 52, 55, 57, 58, 66, 72, 105, 218, 254, 293, 381, 695, 1091, 1209, 1294, 1323, 1348, 1580, 1769, 2067, 2156, 2162, 2714, 2732, 3113, 3131, 3145, 3323, 3398, 3520, 3579, 4295, 5025, 5175, 5317, 5340, 6324, 6504, 6645, 6809 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=7195; } // seymour else if ( modelL == "seymour" ) { probType=pure0_1; int intIndicesAt1[]= { 1, 2, 3, 5, 6, 7, 9, 11, 12, 16, 18, 22, 23, 25, 27, 31, 32, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 49, 50, 51, 52, 54, 55, 56, 58, 61, 63, 65, 67, 68, 69, 70, 71, 75, 79, 81, 82, 84, 85, 86, 87, 88, 89, 91, 93, 95, 97, 98, 99, 100, 101, 102, 103, 106, 108, 112, 116, 118, 119, 120, 122, 123, 124, 125, 126, 129, 130, 132, 135, 137, 140, 141, 142, 143, 144, 148, 150, 151, 154, 156, 159, 160, 162, 163, 164, 165, 167, 169, 170, 174, 177, 178, 180, 181, 182, 183, 188, 189, 192, 194, 200, 201, 202, 203, 204, 211, 214, 218, 226, 227, 228, 231, 232, 237, 240, 242, 244, 247, 248, 249, 251, 253, 256, 257, 259, 261, 264, 265, 266, 268, 270, 272, 278, 280, 284, 286, 288, 289, 291, 292, 296, 299, 302, 305, 307, 308, 311, 312, 313, 314, 315, 316, 317, 319, 321, 325, 328, 332, 334, 335, 337, 338, 339, 340, 343, 346, 355, 357, 358, 365, 369, 372, 373, 374, 375, 376, 378, 381, 383, 386, 392, 396, 399, 402, 403, 412, 416, 419, 424, 425, 426, 427, 430, 431, 432, 436, 437, 438, 440, 441, 443, 450, 451, 452, 453, 456, 460, 461, 462, 467, 469, 475, 476, 477, 478, 479, 485, 486, 489, 491, 493, 498, 500, 501, 508, 513, 515, 516, 518, 519, 520, 524, 527, 541, 545, 547, 548, 559, 562, 563, 564, 566, 567, 570, 572, 575, 576, 582, 583, 587, 589, 595, 599, 602, 610, 611, 615, 622, 631, 646, 647, 649, 652, 658, 662, 665, 667, 671, 676, 679, 683, 685, 686, 688, 689, 691, 699, 705, 709, 711, 712, 716, 721, 722, 724, 726, 729, 732, 738, 739, 741, 745, 746, 747, 749, 752, 757, 765, 767, 768, 775, 779, 780, 791, 796, 798, 808, 809, 812, 813, 817, 819, 824, 825, 837, 839, 849, 851, 852, 857, 865, 874, 883, 885, 890, 897, 902, 907, 913, 915, 923, 924, 927, 931, 933, 936, 938, 941, 945, 949, 961, 970, 971, 978, 984, 985, 995, 997, 999, 1001, 1010, 1011, 1012, 1025, 1027, 1035, 1043, 1055, 1056, 1065, 1077, 1089, 1091, 1096, 1100, 1104, 1112, 1126, 1130, 1131, 1132, 1134, 1136, 1143, 1149, 1162, 1163, 1164, 1183, 1184, 1191, 1200, 1201, 1209, 1215, 1220, 1226, 1228, 1229, 1233, 1241, 1243, 1244, 1258, 1277, 1279, 1285, 1291, 1300, 1303, 1306, 1311, 1320, 1323, 1333, 1344, 1348, 1349, 1351, 1356, 1363, 1364, 1365, 1366}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=1372; } // stein27 else if ( modelL == "stein27" ) { probType=pure0_1; int intIndicesAt1[]={0,1,3,4,5,6,7,8,9,11,13,16,17,19,21,22,25,26}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=27; } // stein45 else if ( modelL == "stein45" ) { probType=pure0_1; int intIndicesAt1[]={0,1,4,5,6,7,8,9,10,11,14,17,18,19,21,23,24,25,26,28, 31,32,33,36,37,39,40,42,43,44}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=45; } // misc03 else if ( modelL == "misc03" ) { probType=continuousWith0_1; int intIndicesAt1[]={4,40,62,75,99,114,127,134,147,148,150, 152,154,155,157}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=160; } // misc06 else if ( modelL == "misc06" ) { probType=continuousWith0_1; int intIndicesAt1[]={ 1557 ,1560 ,1561 ,1580 ,1585 ,1588 ,1589 ,1614 ,1615 ,1616 , 1617 ,1626 ,1630 ,1631 ,1642 ,1643 ,1644 ,1645 ,1650 ,1654 , 1658 ,1659 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=1808; } // misc07 else if ( modelL == "misc07" ) { probType=continuousWith0_1; int intIndicesAt1[]={21,27,57,103,118,148,185,195,205,209,243, 245,247,249,251,253,255,257}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=260; } // rgn else if ( modelL == "rgn" ) { probType=continuousWith0_1; int intIndicesAt1[]={16 ,49 ,72 ,92 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=180; } // mitre else if ( modelL == "mitre" ) { probType=pure0_1; int intIndicesAt1[]={ 4,37,67,93,124,154,177,209,240,255,287,319,340, 372,403,425,455,486,516,547,579,596,628,661,676, 713,744,758,795,825,851,881,910,933,963,993,1021, 1052,1082,1111,1141,1172,1182,1212,1242,1272,1303, 1332,1351,1382,1414,1445,1478,1508,1516,1546,1576, 1601,1632,1662,1693,1716,1749,1781,1795,1828,1860, 1876,1909,1940,1962,1994,2027,2058,2091,2122,2128, 2161,2192,2226,2261,2290,2304,2339,2369,2393,2426, 2457,2465,2500,2529,2555,2590,2619,2633,2665,2696, 2728,2760,2792,2808,2838,2871,2896,2928,2960,2981, 3014,3045,3065,3098,3127,3139,3170,3200,3227,3260, 3292,3310,3345,3375,3404,3437,3467,3482,3513,3543, 3558,3593,3623,3653,3686,3717,3730,3762,3794,3814, 3845,3877,3901,3936,3966,3988,4019,4049,4063,4096, 4126,4153,4186,4216,4245,4276,4306,4318,4350,4383, 4402,4435,4464,4486,4519,4550,4578,4611,4641,4663, 4695,4726,4738,4768,4799,4830,4863,4892,4919,4950, 4979,4991,5024,5054,5074,5107,5137,5165,5198,5228, 5244,5275,5307,5325,5355,5384,5406,5436,5469,5508, 5538,5568,5585,5615,5646,5675,5705,5734,5745,5774, 5804,5836,5865,5895,5924,5954,5987,6001,6033,6064, 6096,6126,6155,6172,6202,6232,6250,6280,6309,6328, 6361,6392,6420,6450,6482,6500,6531,6561,6598,6629, 6639,6669,6699,6731,6762,6784,6814,6844,6861,6894, 6924,6955,6988,7018,7042,7075,7105,7116,7149,7179, 7196,7229,7258,7282,7312,7345,7376,7409,7438,7457, 7487,7520,7534,7563,7593,7624,7662,7692,7701,7738, 7769,7794,7827,7857,7872,7904,7935,7960,7990,8022, 8038,8071,8101,8137,8167,8199,8207,8240,8269,8301, 8334,8363,8387,8420,8450,8470,8502,8534,8550,8580, 8610,8639,8669,8699,8709,8741,8772,8803,8834,8867, 8883,8912,8942,8973,9002,9032,9061,9094,9124,9128, 9159,9201,9232,9251,9280,9310,9333,9338,9405,9419, 9423,9428,9465,9472,9482,9526,9639,9644,9666,9673, 9729,9746,9751,9819,9832,9833,9894,9911,9934,9990, 10007,10012,10083,10090,10095,10137,10176,10177, 10271,10279,10280,10288,10292,10298,10299,10319, 10351,10490,10505,10553,10571,10579,10600,10612, 10683,10688}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=10724; } // cap6000 else if ( modelL == "cap6000" ) { probType=pure0_1; int intIndicesAt1[]={ 46 ,141 ,238 ,250 ,253 ,257 ,260 ,261 ,266 ,268 , 270 ,274 ,277 ,280 ,289 ,292 ,296 ,297 ,300 ,305 , 306 ,310 ,314 ,317 ,319 ,321 ,324 ,329 ,332 ,333 , 336 ,339 ,343 ,345 ,350 ,353 ,354 ,357 ,361 ,364 , 367 ,370 ,372 ,376 ,379 ,381 ,386 ,387 ,392 ,395 , 397 ,400 ,402 ,405 ,410 ,413 ,416 ,419 ,420 ,425 , 427 ,430 ,434 ,436 ,441 ,444 ,447 ,451 ,454 ,456 , 459 ,463 ,467 ,468 ,473 ,474 ,479 ,480 ,483 ,488 , 490 ,493 ,496 ,499 ,501 ,506 ,509 ,511 ,522 ,536 , 537 ,552 ,563 ,565 ,569 ,571 ,574 ,576 ,580 ,582 , 588 ,591 ,596 ,597 ,601 ,607 ,609 ,613 ,616 ,618 , 621 ,626 ,632 ,634 ,644 ,647 ,648 ,658 ,661 ,663 , 668 ,670 ,680 ,688 ,691 ,695 ,698 ,699 ,703 ,713 , 721 ,723 ,730 ,740 ,742 ,746 ,751 ,755 ,757 ,760 , 765 ,770 ,775 ,777 ,781 ,785 ,792 ,796 ,801 ,804 , 812 ,821 ,826 ,834 ,838 ,840 ,844 ,872 ,881 ,883 , 887 ,888 ,899 ,904 ,906 ,917 ,919 ,931 ,938 ,945 , 948 ,953 ,958 ,962 ,963 ,970 ,976 ,979 ,981 ,997 , 1000 ,1004 ,1005 ,1009 ,1013 ,1014 ,1024 ,1026 ,1034 ,1039 , 1055 ,1061 ,1069 ,1076 ,1078 ,1084 ,1089 ,1099 ,1101 ,1104 , 1109 ,1111 ,1124 ,1127 ,1129 ,1133 ,1138 ,1140 ,1145 ,1148 , 1149 ,1159 ,1166 ,1167 ,1171 ,1180 ,1187 ,1194 ,1197 ,1205 , 1224 ,1228 ,1246 ,1255 ,1261 ,1269 ,1275 ,1286 ,1289 ,1291 , 1311 ,1390 ,1406 ,1410 ,1413 ,1418 ,1427 ,1435 ,1440 ,1446 , 1453 ,1455 ,1468 ,1477 ,1479 ,1486 ,1492 ,1502 ,1508 ,1509 , 1525 ,1551 ,1559 ,1591 ,1643 ,1657 ,1660 ,1662 ,1677 ,1710 , 1719 ,1752 ,1840 ,1862 ,1870 ,1891 ,1936 ,1986 ,2087 ,2178 , 2203 ,2212 ,2311 ,2503 ,2505 ,2530 ,2532 ,2557 ,2561 ,2564 , 2567 ,2571 ,2578 ,2581 ,2588 ,2591 ,2594 ,2595 ,2598 ,2603 , 2605 ,2616 ,2620 ,2624 ,2630 ,2637 ,2643 ,2647 ,2654 ,2656 , 2681 ,2689 ,2699 ,2703 ,2761 ,2764 ,2867 ,2871 ,2879 ,2936 , 2971 ,3024 ,3076 ,3094 ,3119 ,3378 ,3435 ,3438 ,3446 ,3476 , 3570 ,3605 ,3646 ,3702 ,3725 ,3751 ,3755 ,3758 ,3760 ,3764 , 3765 ,3770 ,3773 ,3776 ,3779 ,3782 ,3784 ,3788 ,3791 ,3792 , 3796 ,3799 ,3803 ,3804 ,3807 ,3811 ,3814 ,3816 ,3821 ,3823 , 3826 ,3830 ,3831 ,3836 ,3838 ,3840 ,3844 ,3847 ,3851 ,3852 , 3855 ,3859 ,3863 ,3864 ,3867 ,3895 ,3921 ,3948 ,3960 ,3970 , 3988 ,4026 ,4032 ,4035 ,4036 ,4038 ,4041 ,4042 ,4045 ,4046 , 4048 ,4050 ,4053 ,4055 ,4057 ,4058 ,4060 ,4063 ,4065 ,4067 , 4069 ,4071 ,4072 ,4075 ,4076 ,4079 ,4081 ,4082 ,4085 ,4087 , 4088 ,4090 ,4092 ,4094 ,4097 ,4099 ,4100 ,4102 ,4104 ,4107 , 4109 ,4111 ,4113 ,4114 ,4207 ,4209 ,4213 ,4216 ,4220 ,4227 , 4233 ,4238 ,4240 ,4248 ,4253 ,4259 ,4260 ,4267 ,4268 ,4273 , 4280 ,4284 ,4290 ,4292 ,4295 ,4301 ,4303 ,4311 ,4319 ,4326 , 4329 ,4332 ,4335 ,4336 ,4344 ,4349 ,4351 ,4355 ,4363 ,4371 , 4372 ,4378 ,4388 ,4401 ,4409 ,4413 ,4417 ,4420 ,4435 ,4441 , 4451 ,4458 ,4463 ,4468 ,4474 ,4478 ,4482 ,4483 ,4488 ,4497 , 4499 ,4522 ,4614 ,4626 ,4645 ,4648 ,4751 ,4755 ,4758 ,4759 , 4763 ,4840 ,4846 ,4859 ,4865 ,4883 ,4943 ,4970 ,5030 ,5084 , 5124 ,5181 ,5224 ,5236 ,5238 ,5328 ,5362 ,5375 ,5378 ,5434 , 5478 ,5483 ,5562 ,5581 ,5586 ,5591 ,5644 ,5684 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=6000; } // gen else if ( modelL == "gen" ) { probType=generalMip; int intIndicesV[]={15,34,35,36,37,38,39,40,41,42,43,44,45,57,58, 59,60,61,62,63,64,65,66,67,68,69,84,85,86,87,88,89,90,91,92, 93,107,108,109,110,111,112,113,114,120,121,122,123,124,125, 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140, 141,142,143,432,433,434,435,436}; double intSolnV[] = {1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1., 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1., 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1., 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,23.,12.,11.,14.,16.}; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=870; } // dsbmip else if ( modelL == "dsbmip" ) { probType=generalMip; int intIndicesV[]={ 1694 ,1695 ,1696 ,1697 ,1698 ,1699 ,1700 ,1701 ,1702 ,1703 , 1729 ,1745 ,1748 ,1751 ,1753 ,1754 ,1758 ,1760 ,1766 ,1771 , 1774 ,1777 ,1781 ,1787 ,1792 ,1796 ,1800 ,1805 ,1811 ,1817 , 1819 ,1821 ,1822 ,1824 ,1828 ,1835 ,1839 ,1841 ,1844 ,1845 , 1851 ,1856 ,1860 ,1862 ,1864 ,1869 ,1875 ,1883 }; double intSolnV[]={ 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. }; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=1886; } // gesa2 else if ( modelL == "gesa2" ) { probType=generalMip; int intIndicesV[]={ 323 ,324 ,336 ,337 ,349 ,350 ,362 ,363 ,375 ,376 , 388 ,389 ,401 ,402 ,414 ,415 ,423 ,424 ,426 ,427 , 428 ,436 ,437 ,439 ,440 ,441 ,449 ,450 ,452 ,453 , 454 ,462 ,463 ,465 ,466 ,467 ,475 ,476 ,478 ,479 , 480 ,489 ,491 ,492 ,493 ,502 ,504 ,505 ,506 ,514 , 515 ,517 ,518 ,519 ,527 ,528 ,530 ,531 ,532 ,537 , 538 ,540 ,541 ,543 ,544 ,545 ,550 ,551 ,553 ,554 , 556 ,557 ,558 ,563 ,564 ,566 ,567 ,569 ,570 ,571 , 573 ,577 ,579 ,580 ,582 ,583 ,584 ,592 ,593 ,595 , 596 ,597 ,605 ,606 ,608 ,609 ,610 ,622 ,623 ,1130 , 1131 ,1134 ,1135 ,1138 ,1139 ,1142 ,1143 ,1146 ,1147 ,1150 , 1151 ,1154 ,1155 ,1158 ,1159 ,1161 ,1162 ,1165 ,1166 ,1169 , 1170 ,1173 ,1174 ,1177 ,1178 ,1182 ,1183 ,1185 ,1186 ,1189 , 1190 ,1193 ,1194 ,1196 ,1197 ,1200 ,1201 ,1204 ,1205 ,1209 , 1210 ,1213 ,1214 ,1218 ,1222 ,1223 }; double intSolnV[]={ 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,2. ,1. , 2. ,3. ,2. ,2. ,1. ,2. ,3. ,2. ,2. ,1. , 2. ,3. ,2. ,2. ,1. ,2. ,2. ,2. ,2. ,1. , 2. ,2. ,2. ,1. ,2. ,2. ,2. ,1. ,2. ,1. , 2. ,2. ,1. ,2. ,2. ,2. ,2. ,1. ,2. ,1. , 4. ,3. ,3. ,2. ,1. ,2. ,1. ,4. ,3. ,3. , 2. ,1. ,2. ,1. ,4. ,3. ,3. ,2. ,1. ,2. , 1. ,4. ,3. ,3. ,2. ,1. ,2. ,3. ,3. ,2. , 1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. ,2. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. }; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=1224; } // gesa2_o else if ( modelL == "gesa2_o" ) { probType=generalMip; int intIndicesV[]={ 315 ,316 ,328 ,329 ,341 ,342 ,354 ,355 ,367 ,368 , 380 ,381 ,393 ,394 ,406 ,407 ,419 ,420 ,423 ,427 , 428 ,432 ,433 ,436 ,440 ,441 ,445 ,446 ,449 ,453 , 454 ,458 ,459 ,462 ,466 ,467 ,471 ,472 ,475 ,479 , 480 ,484 ,485 ,492 ,493 ,497 ,498 ,505 ,506 ,510 , 511 ,514 ,518 ,519 ,523 ,524 ,527 ,531 ,532 ,536 , 537 ,539 ,540 ,543 ,544 ,545 ,549 ,550 ,552 ,553 , 556 ,557 ,558 ,562 ,563 ,565 ,566 ,569 ,570 ,571 , 575 ,576 ,577 ,579 ,582 ,583 ,584 ,588 ,589 ,592 , 596 ,597 ,601 ,602 ,605 ,609 ,610 ,614 ,615 ,735 , 739 ,740 ,748 ,826 ,839 ,851 ,852 ,855 ,856 ,889 , 1136 ,1137 ,1138 ,1139 ,1140 ,1142 ,1143 ,1144 ,1145 ,1146 , 1147 ,1148 ,1149 ,1152 ,1153 ,1154 ,1155 ,1156 ,1157 ,1158 , 1159 ,1165 ,1175 ,1193 ,1194 ,1195 ,1200 ,1201 ,1202 ,1203 , 1204 ,1205 ,1206 ,1207 ,1208 ,1209 ,1210 ,1211 ,1212 ,1213 , 1214 ,1215 ,1216 ,1220 ,1221 ,1222 ,1223 }; double intSolnV[]={ 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , 2. ,1. ,2. ,3. ,2. ,2. ,1. ,2. ,3. ,2. , 2. ,1. ,2. ,3. ,2. ,2. ,1. ,2. ,2. ,2. , 2. ,1. ,2. ,2. ,2. ,1. ,2. ,2. ,2. ,1. , 2. ,1. ,2. ,2. ,1. ,2. ,2. ,2. ,2. ,1. , 2. ,1. ,3. ,4. ,3. ,2. ,1. ,2. ,1. ,3. , 4. ,3. ,2. ,1. ,2. ,1. ,3. ,4. ,3. ,2. , 1. ,2. ,1. ,3. ,4. ,3. ,2. ,1. ,2. ,3. , 3. ,2. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. , 2. ,2. ,2. ,1. ,1. ,1. ,1. ,4. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. }; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=1224; } // gesa3 else if ( modelL == "gesa3" ) { probType=generalMip; int intIndicesV[]={ 298 ,299 ,310 ,311 ,322 ,323 ,334 ,335 ,346 ,347 , 358 ,359 ,365 ,370 ,371 ,377 ,378 ,380 ,382 ,383 , 389 ,390 ,392 ,394 ,395 ,401 ,402 ,404 ,405 ,406 , 407 ,413 ,414 ,416 ,417 ,418 ,419 ,425 ,426 ,428 , 429 ,430 ,431 ,437 ,438 ,440 ,441 ,442 ,443 ,449 , 450 ,452 ,454 ,455 ,461 ,462 ,464 ,466 ,467 ,473 , 474 ,476 ,478 ,479 ,485 ,486 ,488 ,490 ,491 ,497 , 498 ,500 ,502 ,503 ,509 ,510 ,512 ,514 ,515 ,521 , 522 ,524 ,526 ,527 ,533 ,534 ,536 ,538 ,539 ,545 , 546 ,548 ,550 ,551 ,557 ,558 ,560 ,562 ,563 ,569 , 572 ,574 ,575 ,1058 ,1059 ,1062 ,1063 ,1066 ,1067 ,1070 , 1071 ,1074 ,1075 ,1078 ,1079 ,1082 ,1083 ,1086 ,1087 ,1090 , 1091 ,1094 ,1095 ,1098 ,1099 ,1102 ,1103 ,1106 ,1107 ,1110 , 1111 ,1114 ,1115 ,1118 ,1119 ,1122 ,1123 ,1126 ,1127 ,1130 , 1131 ,1134 ,1135 ,1138 ,1139 ,1142 ,1143 ,1146 ,1147 ,1150 , 1151 }; double intSolnV[]={ 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , 1. ,2. ,1. ,1. ,2. ,2. ,1. ,1. ,1. ,2. , 2. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,2. ,1. , 2. ,2. ,1. ,2. ,2. ,1. ,2. ,2. ,1. ,2. , 2. ,1. ,2. ,2. ,1. ,2. ,1. ,1. ,2. ,2. , 1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. ,2. ,2. , 1. ,2. ,1. ,2. ,4. ,1. ,2. ,1. ,2. ,4. , 2. ,4. ,1. ,2. ,4. ,2. ,4. ,1. ,2. ,4. , 2. ,4. ,1. ,2. ,4. ,1. ,4. ,1. ,2. ,3. , 1. ,3. ,1. ,2. ,2. ,1. ,2. ,1. ,2. ,1. , 1. ,1. ,2. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. }; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=1152; } // gesa3_o else if ( modelL == "gesa3_o" ) { probType=generalMip; int intIndicesV[]={ 291 ,292 ,303 ,304 ,315 ,316 ,327 ,328 ,339 ,340 , 351 ,352 ,361 ,363 ,364 ,373 ,374 ,375 ,376 ,379 , 385 ,386 ,387 ,388 ,391 ,397 ,398 ,399 ,400 ,403 , 407 ,409 ,410 ,411 ,412 ,415 ,419 ,421 ,422 ,423 , 424 ,427 ,431 ,433 ,434 ,435 ,436 ,439 ,443 ,445 , 446 ,447 ,448 ,451 ,457 ,458 ,459 ,460 ,463 ,469 , 470 ,471 ,472 ,475 ,481 ,482 ,483 ,484 ,487 ,493 , 494 ,495 ,496 ,499 ,505 ,506 ,507 ,508 ,511 ,517 , 518 ,519 ,520 ,523 ,529 ,530 ,531 ,532 ,535 ,541 , 542 ,543 ,544 ,547 ,553 ,554 ,555 ,556 ,559 ,565 , 566 ,567 ,568 ,578 ,590 ,602 ,614 ,626 ,638 ,649 , 650 ,661 ,662 ,667 ,674 ,686 ,695 ,698 ,710 ,722 , 734 ,746 ,758 ,769 ,770 ,782 ,787 ,794 ,806 ,818 , 830 ,842 ,854 ,1080 ,1081 ,1082 ,1083 ,1084 ,1085 ,1086 , 1087 ,1088 ,1089 ,1090 ,1091 ,1092 ,1093 ,1094 ,1095 ,1096 , 1097 ,1098 ,1099 ,1100 ,1101 ,1102 ,1103 ,1128 ,1129 ,1130 , 1131 ,1132 ,1133 ,1134 ,1135 ,1136 ,1137 ,1138 ,1139 ,1140 , 1141 ,1142 ,1143 ,1144 ,1145 ,1146 ,1147 ,1148 ,1149 ,1150 , 1151 }; double intSolnV[]={ 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , 1. ,2. ,1. ,1. ,2. ,2. ,1. ,1. ,2. ,1. , 2. ,2. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. , 2. ,2. ,2. ,1. ,2. ,1. ,2. ,2. ,2. ,1. , 2. ,1. ,2. ,2. ,2. ,1. ,2. ,1. ,1. ,2. , 2. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. ,2. , 2. ,1. ,2. ,1. ,4. ,2. ,1. ,2. ,1. ,4. , 4. ,1. ,2. ,2. ,4. ,4. ,1. ,2. ,2. ,4. , 4. ,1. ,2. ,2. ,4. ,4. ,1. ,2. ,1. ,3. , 3. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. ,1. , 1. ,1. ,2. ,4. ,4. ,4. ,4. ,4. ,4. ,1. , 4. ,1. ,4. ,1. ,4. ,4. ,2. ,4. ,4. ,4. , 4. ,4. ,4. ,2. ,4. ,4. ,1. ,4. ,4. ,4. , 4. ,4. ,4. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. }; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=1152; } // noswot else if ( modelL == "noswot_z" ) { probType=generalMip; int intIndicesV[]={1}; double intSolnV[]={1.0}; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=128; } // qnet1 else if ( modelL == "qnet1" ) { probType=generalMip; int intIndicesV[]={ 61 ,69 ,79 ,81 ,101 ,104 ,111 ,115 ,232 ,265 , 267 ,268 ,269 ,285 ,398 ,412 ,546 ,547 ,556 ,642 , 709 ,718 ,721 ,741 ,760 ,1073 ,1077 ,1084 ,1097 ,1100 , 1104 ,1106 ,1109 ,1248 ,1259 ,1260 ,1263 ,1265 ,1273 ,1274 , 1276 ,1286 ,1291 ,1302 ,1306 ,1307 ,1316 ,1350 ,1351 ,1363 , 1366 ,1368 ,1371 ,1372 ,1380 ,1381 ,1385 ,1409 }; double intSolnV[]={ 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,2. ,1. ,1. ,1. ,1. ,3. , 1. ,2. ,1. ,1. ,1. ,1. ,6. ,3. ,1. ,1. , 5. ,2. ,1. ,2. ,2. ,1. ,2. ,1. }; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=1541; } // qnet1_o (? marginally different from qnet1) else if ( modelL == "qnet1_o" ) { probType=generalMip; int intIndicesV[]={ 61 ,69 ,79 ,81 ,101 ,106 ,111 ,114 ,115 ,232 , 266 ,267 ,268 ,269 ,277 ,285 ,398 ,412 ,546 ,547 , 556 ,642 ,709 ,718 ,721 ,741 ,760 ,1073 ,1077 ,1084 , 1097 ,1100 ,1104 ,1106 ,1109 ,1248 ,1259 ,1260 ,1263 ,1265 , 1273 ,1274 ,1276 ,1286 ,1291 ,1302 ,1306 ,1307 ,1316 ,1350 , 1351 ,1363 ,1366 ,1368 ,1371 ,1372 ,1380 ,1381 ,1385 ,1409 }; double intSolnV[]={ 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , 1. ,1. ,1. ,1. ,1. ,1. ,2. ,1. ,1. ,1. , 1. ,3. ,1. ,2. ,1. ,1. ,1. ,1. ,6. ,3. , 1. ,1. ,5. ,2. ,1. ,2. ,2. ,1. ,2. ,1. }; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=1541; } // gt2 else if ( modelL == "gt2" ) { probType=generalMip; int intIndicesV[]={82,85,88,92,94,95,102,103,117,121,122,128, 141,146,151,152,165,166,176,179}; double intSolnV[] = {1.,3.,1.,5.,2.,1.,1.,2.,2.,2.,1.,2.,1.,1., 2.,1.,1.,6.,1.,1.}; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=188; } // fiber else if ( modelL == "fiber" ) { probType=continuousWith0_1; int intIndicesAt1[]={36,111,190,214,235,270,338,346,372,386, 421,424,441,470,473,483,484,498,580,594,597,660,689,735, 742,761,762,776,779,817,860,1044,1067,1122,1238}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=1298; } // vpm1 else if ( modelL == "vpm1" ) { probType=continuousWith0_1; int intIndicesAt1[]= { 180,181,182,185,195,211,214,226,231,232,244,251,263,269, 285,294,306,307,314, 319}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=378; } // vpm2 else if ( modelL == "vpm2" ) { probType=continuousWith0_1; int intIndicesAt1[]= {170,173,180,181,182,185,193,194,196,213,219,220,226, 245,251,262,263,267,269,273,288,289,294,319,320}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=378; } // markshare1 else if ( modelL == "markshare1" ) { probType=continuousWith0_1; int intIndicesAt1[]= {12 ,13 ,17 ,18 ,22 ,27 ,28 ,29 ,33 ,34 ,35 ,36 , 39 ,42 ,43 ,44 ,46 ,47 ,49 ,51 ,52 ,53 ,54 ,55 ,59 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=62; } // markshare2 else if ( modelL == "markshare2" ) { probType=continuousWith0_1; int intIndicesAt1[]= {16 ,21 ,25 ,26 ,29 ,30 ,31 ,32 ,34 ,35 , 37 ,40 ,42 ,44 ,45 ,47 ,48 ,52 ,53 ,57 , 58 ,59 ,60 ,61 ,62 ,63 ,65 ,71 ,73 }; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=74; } // l152lav else if ( modelL == "l152lav" ) { probType=pure0_1; int intIndicesAt1[]={1,16,30,33,67,111,165,192,198,321,411,449, 906,961,981,1052,1075,1107,1176,1231,1309,1415,1727,1847, 1902,1917,1948,1950}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); expectedNumberColumns=1989; } // bell5 else if ( modelL == "bell5" ) { probType=generalMip; int intIndicesV[]={ 0 ,1 ,2 ,3 ,4 ,6 ,33 ,34 ,36 ,47 , 48 ,49 ,50 ,51 ,52 ,53 ,54 ,56 }; double intSolnV[]={ 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,11. ,2. , 38. ,2. ,498. ,125. ,10. ,17. ,41. ,19. }; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=104; } // blend2 else if ( modelL == "blend2" ) { probType=generalMip; int intIndicesV[]={24,35,44,45,46,52,63,64,70,71,76,84,85, 132,134,151,152,159,164,172,173,289,300,309,310,311, 317,328,329,335,336,341,349,350}; double intSolnV[] = {2.,1.,1.,1.,1.,1.,1.,1.,2.,1.,1.,1., 2.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1., 1.,1.,1.,1.,1.,1.,1.,1.,1.}; int vecLen = sizeof(intIndicesV)/sizeof(int); intSoln.setVector(vecLen,intIndicesV,intSolnV); expectedNumberColumns=353; } // seymour1 else if ( modelL == "seymour_1" ) { probType=continuousWith0_1; int intIndicesAt1[]= {0,2,3,4,6,7,8,11,12,15,18,22,23,25,27,31,32,34,35,36,37,39,40,41,42,44,45,46,49,51,54,55,56,58,61,62,63,65,67,68,69,70,71,75,79,81,82,84,85,86,87,88,89,91,93,94,95,97,98,99,101,102,103,104,106,108,110,111,112,116,118,119,120,122,123,125,126,128,129,130,131,135,140,141,142,143,144,148,149,151,152,153,156,158,160,162,163,164,165,167,169,170,173,177,178,179,181,182,186,188,189,192,193,200,201,202,203,204,211,214,218,226,227,228,231,233,234,235,238,242,244,246,249,251,252,254,257,259,260,263,266,268,270,271,276,278,284,286,288,289,291,292,299,305,307,308,311,313,315,316,317,319,321,325,328,332,334,335,337,338,340,343,346,347,354,355,357,358,365,369,372,373,374,375,376,379,381,383,386,392,396,399,402,403,412,416,423,424,425,427,430,431,432,436,437,438,440,441,443,449,450,451,452}; int numIndices = sizeof(intIndicesAt1)/sizeof(int); intSoln.setConstant(numIndices,intIndicesAt1,1.0); probType=generalMip; expectedNumberColumns=1372; } // check to see if the model parameter is // a known problem. if ( probType != undefined && si.getNumCols() == expectedNumberColumns) { // Specified model is a known problem numberColumns_ = si.getNumCols(); integerVariable_= new bool[numberColumns_]; knownSolution_=new double[numberColumns_]; //CoinFillN(integerVariable_, numberColumns_,0); //CoinFillN(knownSolution_,numberColumns_,0.0); if ( probType == pure0_1 ) { // mark all variables as integer CoinFillN(integerVariable_,numberColumns_,true); // set solution to 0.0 for all not mentioned CoinFillN(knownSolution_,numberColumns_,0.0); // mark column solution that have value 1 for ( i=0; igetMatrixByCol()->isEquivalent(*si.getMatrixByCol())); // Loop once for each column looking for integer variables for (i=0;iisInteger(i)) { // integer variable found integerVariable_[i]=true; // Determine optimal solution value for integer i // from values saved in intSoln and probType. double soln; if ( probType==continuousWith0_1 ) { // Since 0_1 problem, had better be binary assert( siCopy->isBinary(i) ); // intSoln only contains integers with optimal value of 1 if ( intSoln.isExistingIndex(i) ) { soln = 1.0; assert( intSoln[i]==1. ); } else { soln = 0.0; } } else { // intSoln only contains integers with nonzero optimal values if ( intSoln.isExistingIndex(i) ) { soln = intSoln[i]; assert( intSoln[i]>=1. ); } else { soln = 0.0; } } // Set bounds in copyied problem to fix variable to its solution siCopy->setColUpper(i,soln); siCopy->setColLower(i,soln); } else { // this is not an integer variable integerVariable_[i]=false; } } // All integers have been fixed at optimal value. // Now solve to get continuous values #if 0 assert( siCopy->getNumRows()==5); assert( siCopy->getNumCols()==8); int r,c; for ( r=0; rgetNumRows(); r++ ) { std::cerr <<"rhs[" <rhs())[r] <getNumCols(); c++ ) { std::cerr <<"collower[" <collower())[c] <colupper())[c] <setWarmStart(&allSlack); siCopy->setHintParam(OsiDoScale,false); siCopy->initialSolve(); #if 0 for ( c=0; cgetNumCols(); c++ ) { std::cerr <<"colsol[" <colsol())[c] <getObjValue(),3.2368421052632)); #endif assert (siCopy->isProvenOptimal()); knownValue_ = siCopy->getObjValue(); // Save column solution CoinCopyN(siCopy->getColSolution(),numberColumns_,knownSolution_); delete siCopy; } } else if (printActivationNotice) { if (probType != undefined && si.getNumCols() != expectedNumberColumns) { std::cout << std::endl << " OsiRowCutDebugger::activate: expected " << expectedNumberColumns << " cols but see " << si.getNumCols() << "; cannot activate." << std::endl ; } else { std::cout << " OsiRowCutDebugger::activate: unrecognised problem " << model << "; cannot activate." << std::endl ; } } //if (integerVariable_!=NULL) si.rowCutDebugger_=this; return (integerVariable_!=NULL); } /* Activate a row cut debugger using a full solution array. It's up to the user to get it correct. Returns true if the debugger is activated. The solution array must be getNumCols() in length, but only the entries for integer variables need to be correct. keepContinuous defaults to false, but in some uses (nonlinear solvers, for example) it's useful to keep the given values, as they reflect constraints that are not present in the linear relaxation. */ bool OsiRowCutDebugger::activate (const OsiSolverInterface &si, const double *solution, bool keepContinuous) { // set true to get a debug message about activation const bool printActivationNotice = false ; int i ; //get rid of any arrays delete [] integerVariable_ ; delete [] knownSolution_ ; OsiSolverInterface *siCopy = si.clone() ; numberColumns_ = siCopy->getNumCols() ; integerVariable_ = new bool[numberColumns_] ; knownSolution_ = new double[numberColumns_] ; /* Fix the integer variables from the supplied solution (making sure that the values are integer). */ for (i = 0 ; i < numberColumns_ ; i++) { if (siCopy->isInteger(i)) { integerVariable_[i] = true ; double soln = floor(solution[i]+0.5) ; siCopy->setColUpper(i,soln) ; siCopy->setColLower(i,soln) ; } else { integerVariable_[i] = false ; } } /* Solve the lp relaxation, then cache the primal solution and objective. If we're preserving the values of the given continuous variables, we can't trust the solver's calculation of the objective; it may well be using different values for the continuous variables. */ siCopy->setHintParam(OsiDoScale,false); //siCopy->writeMps("bad.mps") ; siCopy->initialSolve() ; if (keepContinuous == false) { if (siCopy->isProvenOptimal()) { CoinCopyN(siCopy->getColSolution(),numberColumns_,knownSolution_) ; knownValue_ = siCopy->getObjValue() ; if (printActivationNotice) { std::cout << std::endl << "OsiRowCutDebugger::activate: activated (opt), z = " << knownValue_ << std::endl ; } } else { if (printActivationNotice) { std::cout << std::endl << "OsiRowCutDebugger::activate: solution was not optimal; " << "cannot activate." << std::endl ; } delete [] integerVariable_ ; delete [] knownSolution_ ; integerVariable_ = NULL ; knownSolution_ = NULL ; knownValue_ = COIN_DBL_MAX ; } } else { CoinCopyN(solution,numberColumns_,knownSolution_) ; const double *c = siCopy->getObjCoefficients() ; knownValue_ = 0.0 ; for (int j = 0 ; j < numberColumns_ ; j++) { knownValue_ += c[j]*solution[j] ; } knownValue_ = knownValue_*siCopy->getObjSense() ; if (printActivationNotice) { std::cout << std::endl << "OsiRowCutDebugger::activate: activated, z = " << knownValue_ << std::endl ; } } delete siCopy; return (integerVariable_ != NULL) ; } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiRowCutDebugger::OsiRowCutDebugger () :knownValue_(COIN_DBL_MAX), numberColumns_(0), integerVariable_(NULL), knownSolution_(NULL) { // nothing to do here } //------------------------------------------------------------------- // Alternate Constructor with model name //------------------------------------------------------------------- // Constructor with name of model OsiRowCutDebugger::OsiRowCutDebugger ( const OsiSolverInterface & si, const char * model) :knownValue_(COIN_DBL_MAX), numberColumns_(0), integerVariable_(NULL), knownSolution_(NULL) { activate(si,model); } // Constructor with full solution (only integers need be correct) OsiRowCutDebugger::OsiRowCutDebugger (const OsiSolverInterface &si, const double *solution, bool enforceOptimality) :knownValue_(COIN_DBL_MAX), numberColumns_(0), integerVariable_(NULL), knownSolution_(NULL) { activate(si,solution,enforceOptimality); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiRowCutDebugger::OsiRowCutDebugger (const OsiRowCutDebugger & source) : knownValue_(COIN_DBL_MAX), numberColumns_(0), integerVariable_(NULL), knownSolution_(NULL) { // copy if (source.active()) { assert(source.integerVariable_ != NULL); assert(source.knownSolution_ != NULL); knownValue_ = source.knownValue_; numberColumns_=source.numberColumns_; integerVariable_=new bool[numberColumns_]; knownSolution_=new double[numberColumns_]; CoinCopyN(source.integerVariable_, numberColumns_, integerVariable_ ); CoinCopyN(source.knownSolution_, numberColumns_, knownSolution_); } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiRowCutDebugger::~OsiRowCutDebugger () { // free memory delete [] integerVariable_; delete [] knownSolution_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiRowCutDebugger & OsiRowCutDebugger::operator=(const OsiRowCutDebugger& rhs) { if (this != &rhs) { delete [] integerVariable_; delete [] knownSolution_; knownValue_ = COIN_DBL_MAX; // copy if (rhs.active()) { assert(rhs.integerVariable_ != NULL); assert(rhs.knownSolution_ != NULL); knownValue_ = rhs.knownValue_; numberColumns_ = rhs.numberColumns_; integerVariable_ = new bool[numberColumns_]; knownSolution_ = new double[numberColumns_]; CoinCopyN(rhs.integerVariable_,numberColumns_,integerVariable_ ); CoinCopyN(rhs.knownSolution_,numberColumns_,knownSolution_); } } return *this; } /* Edit a solution after column changes (typically column deletion and/or transposition due to preprocessing). Given an array which translates current column indices to original column indices, shrink the solution to match. The transform is irreversible (in the sense that the debugger doesn't keep a record of the changes). */ void OsiRowCutDebugger::redoSolution(int numberColumns,const int * originalColumns) { const bool printRecalcMessage = false ; assert (numberColumns<=numberColumns_); if (numberColumns #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinMpsIO.hpp" #include "CoinMessage.hpp" #include "CoinWarmStart.hpp" #ifdef COIN_SNAPSHOT #include "CoinSnapshot.hpp" #endif #include "OsiSolverInterface.hpp" #ifdef CBC_NEXT_VERSION #include "OsiSolverBranch.hpp" #endif #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "OsiRowCutDebugger.hpp" #include "OsiAuxInfo.hpp" #include "OsiBranchingObject.hpp" #include #include "CoinFinite.hpp" #include "CoinBuild.hpp" #include "CoinModel.hpp" #include "CoinLpIO.hpp" //############################################################################# // Hotstart related methods (primarily used in strong branching) // It is assumed that only bounds (on vars/constraints) can change between // markHotStart() and unmarkHotStart() //############################################################################# void OsiSolverInterface::markHotStart() { delete ws_; ws_ = getWarmStart(); } void OsiSolverInterface::solveFromHotStart() { setWarmStart(ws_); resolve(); } void OsiSolverInterface::unmarkHotStart() { delete ws_; ws_ = NULL; } //############################################################################# // Get indices of solution vector which are integer variables presently at // fractional values //############################################################################# OsiVectorInt OsiSolverInterface::getFractionalIndices(const double etol) const { const int colnum = getNumCols(); OsiVectorInt frac; CoinAbsFltEq eq(etol); for (int i = 0; i < colnum; ++i) { if (isInteger(i)) { const double ci = getColSolution()[i]; const double distanceFromInteger = ci - floor(ci + 0.5); if (! eq(distanceFromInteger, 0.0)) frac.push_back(i); } } return frac; } int OsiSolverInterface::getNumElements() const { return getMatrixByRow()->getNumElements(); } //############################################################################# // Methods for determining the type of column variable. // The method isContinuous() is presently implemented in the derived classes. // The methods below depend on isContinuous and the values // stored in the column bounds. //############################################################################# bool OsiSolverInterface::isBinary(int colIndex) const { if ( isContinuous(colIndex) ) return false; const double * cu = getColUpper(); const double * cl = getColLower(); if ( (cu[colIndex]== 1 || cu[colIndex]== 0) && (cl[colIndex]== 0 || cl[colIndex]==1) ) return true; else return false; } //############################################################################# // Method for getting a column solution that is guaranteed to be // between the column lower and upper bounds. // // This method is was introduced for Cgl. Osi developers can // improve performance for their favorite solvers by // overriding this method and providing an implementation that caches // strictColSolution_. //############################################################################# const double * OsiSolverInterface::getStrictColSolution() { const double * colSolution = getColSolution(); const double * colLower = getColLower(); const double * colUpper = getColUpper(); const int numCols = getNumCols(); strictColSolution_.clear(); strictColSolution_.insert(strictColSolution_.end(),colSolution, colSolution+numCols); for (int i=numCols-1; i> 0; --i){ if (colSolution[i] <= colUpper[i]){ if (colSolution[i] >= colLower[i]){ continue; } else { strictColSolution_[i] = colLower[i]; } } else { strictColSolution_[i] = colUpper[i]; } } return &strictColSolution_[0]; } //----------------------------------------------------------------------------- bool OsiSolverInterface::isInteger(int colIndex) const { return !isContinuous(colIndex); } //----------------------------------------------------------------------------- /* Return number of integer variables. OSI implementors really should replace this one, it's generally trivial from within the OSI, but this is the only safe way to do it generically. */ int OsiSolverInterface::getNumIntegers () const { if (numberIntegers_>=0) { // we already know return numberIntegers_; } else { // work out const int numCols = getNumCols() ; int numIntegers = 0 ; for (int i = 0 ; i < numCols ; ++i) { if (!isContinuous(i)) { numIntegers++ ; } } return (numIntegers) ; } } //----------------------------------------------------------------------------- bool OsiSolverInterface::isIntegerNonBinary(int colIndex) const { if ( isInteger(colIndex) && !isBinary(colIndex) ) return true; else return false; } //----------------------------------------------------------------------------- bool OsiSolverInterface::isFreeBinary(int colIndex) const { if ( isContinuous(colIndex) ) return false; const double * cu = getColUpper(); const double * cl = getColLower(); if ( (cu[colIndex]== 1) && (cl[colIndex]== 0) ) return true; else return false; } /* Return array of column length 0 - continuous 1 - binary (may get fixed later) 2 - general integer (may get fixed later) */ const char * OsiSolverInterface::getColType(bool refresh) const { if (!columnType_||refresh) { const int numCols = getNumCols() ; if (!columnType_) columnType_ = new char [numCols]; const double * cu = getColUpper(); const double * cl = getColLower(); for (int i = 0 ; i < numCols ; ++i) { if (!isContinuous(i)) { if ((cu[i]== 1 || cu[i]== 0) && (cl[i]== 0 || cl[i]==1)) columnType_[i]=1; else columnType_[i]=2; } else { columnType_[i]=0; } } } return columnType_; } /* ############################################################################### Built-in methods for problem modification Some of these can surely be reimplemented more efficiently given knowledge of the derived OsiXXX data structures, but we can't make assumptions here. For others, it's less clear. Given standard vector data structures in the underlying OsiXXX, likely the only possible gain is avoiding a method call. ############################################################################### */ void OsiSolverInterface::setObjCoeffSet(const int* indexFirst, const int* indexLast, const double* coeffList) { const std::ptrdiff_t cnt = indexLast - indexFirst; for (std::ptrdiff_t i = 0; i < cnt; ++i) { setObjCoeff(indexFirst[i], coeffList[i]); } } //----------------------------------------------------------------------------- void OsiSolverInterface::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { while (indexFirst != indexLast) { setColBounds(*indexFirst, boundList[0], boundList[1]); ++indexFirst; boundList += 2; } } //----------------------------------------------------------------------------- void OsiSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { while (indexFirst != indexLast) { setRowBounds(*indexFirst, boundList[0], boundList[1]); ++indexFirst; boundList += 2; } } //----------------------------------------------------------------------------- void OsiSolverInterface::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { while (indexFirst != indexLast) { setRowType(*indexFirst++, *senseList++, *rhsList++, *rangeList++); } } //----------------------------------------------------------------------------- void OsiSolverInterface::setContinuous(const int* indices, int len) { for (int i = 0; i < len; ++i) { setContinuous(indices[i]); } } //----------------------------------------------------------------------------- void OsiSolverInterface::setInteger(const int* indices, int len) { for (int i = 0; i < len; ++i) { setInteger(indices[i]); } } //----------------------------------------------------------------------------- /* Set the objective coefficients for all columns array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed. */ void OsiSolverInterface::setObjective(const double * array) { int n=getNumCols(); for (int i=0;i=0); addCol(number, rows+start, elements+start, collb ? collb[i] : 0.0, colub ? colub[i] : infinity, obj ? obj[i] : 0.0); } } //----------------------------------------------------------------------------- // Add columns from a build object void OsiSolverInterface::addCols(const CoinBuild & buildObject) { assert (buildObject.type()==1); // check correct int number = buildObject.numberColumns(); if (number) { CoinPackedVectorBase ** columns= new CoinPackedVectorBase * [number]; int iColumn; double * objective = new double [number]; double * lower = new double [number]; double * upper = new double [number]; for (iColumn=0;iColumn1.0e30) columnUpper[iColumn]=infinity; if (columnLower[iColumn]<-1.0e30) columnLower[iColumn]=-infinity; } const int * row = matrix.getIndices(); const int * columnLength = matrix.getVectorLengths(); const CoinBigIndex * columnStart = matrix.getVectorStarts(); const double * element = matrix.getElements(); CoinPackedVectorBase ** columns= new CoinPackedVectorBase * [numberColumns2]; assert (columnLower); for (iColumn=0;iColumnmessage(CLP_BAD_STRING_VALUES,messages_) // <message(CLP_COMPLICATED_MODEL,messages_) //<=0); addRow(number, columns+start, elements+start, rowlb ? rowlb[i] : -infinity, rowub ? rowub[i] : infinity); } } void OsiSolverInterface::addRows(const int numrows, const CoinPackedVectorBase* const* rows, const double* rowlb, const double* rowub) { for (int i = 0; i < numrows; ++i) { addRow(*rows[i], rowlb[i], rowub[i]); } } void OsiSolverInterface::addRows(const int numrows, const CoinPackedVectorBase* const* rows, const char* rowsen, const double* rowrhs, const double* rowrng) { for (int i = 0; i < numrows; ++i) { addRow(*rows[i], rowsen[i], rowrhs[i], rowrng[i]); } } //----------------------------------------------------------------------------- void OsiSolverInterface::addRows(const CoinBuild & buildObject) { int number = buildObject.numberRows(); if (number) { CoinPackedVectorBase ** rows= new CoinPackedVectorBase * [number]; int iRow; double * lower = new double [number]; double * upper = new double [number]; for (iRow=0;iRow1.0e30) rowUpper[iRow]=infinity; if (rowLower[iRow]<-1.0e30) rowLower[iRow]=-infinity; } // matrix by rows matrix.reverseOrdering(); const int * column = matrix.getIndices(); const int * rowLength = matrix.getVectorLengths(); const CoinBigIndex * rowStart = matrix.getVectorStarts(); const double * element = matrix.getElements(); CoinPackedVectorBase ** rows= new CoinPackedVectorBase * [numberRows2]; assert (rowLower); for (iRow=0;iRowmessage(CLP_BAD_STRING_VALUES,messages_) // <message(CLP_COMPLICATED_MODEL,messages_) //<1.0e30) columnUpper[iColumn]=infinity; if (columnLower[iColumn]<-1.0e30) columnLower[iColumn]=-infinity; } for (iRow=0;iRow1.0e30) rowUpper[iRow]=infinity; if (rowLower[iRow]<-1.0e30) rowLower[iRow]=-infinity; } CoinWarmStart * ws = getWarmStart(); bool restoreBasis = keepSolution && numberRows&&numberRows==getNumRows()&& numberColumns==getNumCols(); loadProblem(matrix, columnLower, columnUpper, objective, rowLower, rowUpper); setRowColNames(modelObject) ; if (restoreBasis) setWarmStart(ws); delete ws; // Do integers if wanted assert(integerType); for (int iColumn=0;iColumnmessage(CLP_BAD_STRING_VALUES,messages_) // <getApplicationData(); } void OsiSolverInterface::setAuxiliaryInfo(OsiAuxInfo * auxiliaryInfo) { delete appDataEtc_; appDataEtc_ = auxiliaryInfo->clone(); } // Get pointer to auxiliary info object OsiAuxInfo * OsiSolverInterface::getAuxiliaryInfo() const { return appDataEtc_; } //############################################################################# // Methods related to Row Cut Debuggers //############################################################################# //------------------------------------------------------------------- // Activate Row Cut Debugger
// If the model name passed is on list of known models // then all cuts are checked to see that they do NOT cut // off the known optimal solution. void OsiSolverInterface::activateRowCutDebugger (const char * modelName) { delete rowCutDebugger_; rowCutDebugger_=NULL; // so won't use in new rowCutDebugger_ = new OsiRowCutDebugger(*this,modelName); } /* Activate debugger using full solution array. Only integer values need to be correct. Up to user to get it correct. */ void OsiSolverInterface::activateRowCutDebugger (const double * solution, bool keepContinuous) { delete rowCutDebugger_; rowCutDebugger_=NULL; // so won't use in new rowCutDebugger_ = new OsiRowCutDebugger(*this,solution,keepContinuous); } //------------------------------------------------------------------- // Get Row Cut Debugger
// If there is a row cut debugger object associated with // model AND if the known optimal solution is within the // current feasible region then a pointer to the object is // returned which may be used to test validity of cuts. // Otherwise NULL is returned const OsiRowCutDebugger * OsiSolverInterface::getRowCutDebugger() const { if (rowCutDebugger_&&rowCutDebugger_->onOptimalPath(*this)) { return rowCutDebugger_; } else { return NULL; } } // If you want to get debugger object even if not on optimal path then use this OsiRowCutDebugger * OsiSolverInterface::getRowCutDebuggerAlways() const { if (rowCutDebugger_&&rowCutDebugger_->active()) { return rowCutDebugger_; } else { return NULL; } } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiSolverInterface::OsiSolverInterface () : rowCutDebugger_(NULL), handler_(NULL), defaultHandler_(true), columnType_(NULL), appDataEtc_(NULL), ws_(NULL) { setInitialData(); } // Set data for default constructor void OsiSolverInterface::setInitialData() { delete rowCutDebugger_; rowCutDebugger_ = NULL; delete ws_; ws_ = NULL; delete appDataEtc_; appDataEtc_ = new OsiAuxInfo(); if (defaultHandler_) { delete handler_; handler_ = NULL; } defaultHandler_=true; delete [] columnType_; columnType_ = NULL; intParam_[OsiMaxNumIteration] = 9999999; intParam_[OsiMaxNumIterationHotStart] = 9999999; intParam_[OsiNameDiscipline] = 0; // Dual objective limit is acceptable `badness'; for minimisation, COIN_DBL_MAX dblParam_[OsiDualObjectiveLimit] = COIN_DBL_MAX; // Primal objective limit is desired `goodness'; for minimisation, -COIN_DBL_MAX dblParam_[OsiPrimalObjectiveLimit] = -COIN_DBL_MAX; dblParam_[OsiDualTolerance] = 1e-6; dblParam_[OsiPrimalTolerance] = 1e-6; dblParam_[OsiObjOffset] = 0.0; strParam_[OsiProbName] = "OsiDefaultName"; strParam_[OsiSolverName] = "Unknown Solver"; handler_ = new CoinMessageHandler(); messages_ = CoinMessage(); // initialize all hints int hint; for (hint=OsiDoPresolveInInitial;hintclone(); if ( rhs.rowCutDebugger_!=NULL ) rowCutDebugger_ = new OsiRowCutDebugger(*rhs.rowCutDebugger_); defaultHandler_ = rhs.defaultHandler_; if (defaultHandler_) { handler_ = new CoinMessageHandler(*rhs.handler_); } else { handler_ = rhs.handler_; } messages_ = CoinMessages(rhs.messages_); CoinDisjointCopyN(rhs.intParam_, OsiLastIntParam, intParam_); CoinDisjointCopyN(rhs.dblParam_, OsiLastDblParam, dblParam_); CoinDisjointCopyN(rhs.strParam_, OsiLastStrParam, strParam_); CoinDisjointCopyN(rhs.hintParam_, OsiLastHintParam, hintParam_); CoinDisjointCopyN(rhs.hintStrength_, OsiLastHintParam, hintStrength_); // objects numberObjects_=rhs.numberObjects_; numberIntegers_=rhs.numberIntegers_; if (numberObjects_) { object_ = new OsiObject * [numberObjects_]; for (int i=0;iclone(); } else { object_=NULL; } // names rowNames_ = rhs.rowNames_ ; colNames_ = rhs.colNames_ ; objName_ = rhs.objName_ ; // NULL as number of columns not known columnType_ = NULL; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiSolverInterface::~OsiSolverInterface () { // delete debugger - should be safe as only ever returned const delete rowCutDebugger_; rowCutDebugger_ = NULL; delete ws_; ws_ = NULL; delete appDataEtc_; if (defaultHandler_) { delete handler_; handler_ = NULL; } for (int i=0;iclone(); delete rowCutDebugger_; if ( rhs.rowCutDebugger_!=NULL ) rowCutDebugger_ = new OsiRowCutDebugger(*rhs.rowCutDebugger_); else rowCutDebugger_ = NULL; CoinDisjointCopyN(rhs.intParam_, OsiLastIntParam, intParam_); CoinDisjointCopyN(rhs.dblParam_, OsiLastDblParam, dblParam_); CoinDisjointCopyN(rhs.strParam_, OsiLastStrParam, strParam_); CoinDisjointCopyN(rhs.hintParam_, OsiLastHintParam, hintParam_); CoinDisjointCopyN(rhs.hintStrength_, OsiLastHintParam, hintStrength_); delete ws_; ws_ = NULL; if (defaultHandler_) { delete handler_; handler_ = NULL; } defaultHandler_ = rhs.defaultHandler_; if (defaultHandler_) { handler_ = new CoinMessageHandler(*rhs.handler_); } else { handler_ = rhs.handler_; } // objects int i; for (i=0;iclone(); } else { object_=NULL; } // names rowNames_ = rhs.rowNames_ ; colNames_ = rhs.colNames_ ; objName_ = rhs.objName_ ; delete [] columnType_; // NULL as number of columns not known columnType_ = NULL; } return *this; } //----------------------------------------------------------------------------- // Read mps files //----------------------------------------------------------------------------- int OsiSolverInterface::readMps(const char * filename, const char * extension) { CoinMpsIO m; int logLvl = handler_->logLevel() ; if (logLvl > 1) { m.messageHandler()->setLogLevel(handler_->logLevel()) ; } else { m.messageHandler()->setLogLevel(0) ; } m.setInfinity(getInfinity()); int numberErrors = m.readMps(filename,extension); handler_->message(COIN_SOLVER_MPS,messages_) <message(COIN_SOLVER_MPS,messages_) <message(COIN_SOLVER_MPS,messages_) < getObjSense() * dualobjlimit; else return false; } // copy all parameters in this section from one solver to another void OsiSolverInterface::copyParameters(OsiSolverInterface & rhs) { /* We should think about this block of code. appData, rowCutDebugger, and handler_ are not part of the standard parameter data. Arguably copy actions for them belong in the base Osi.clone() or as separate methods. -lh, 091021- */ delete appDataEtc_; appDataEtc_ = rhs.appDataEtc_->clone(); delete rowCutDebugger_; if ( rhs.rowCutDebugger_!=NULL ) rowCutDebugger_ = new OsiRowCutDebugger(*rhs.rowCutDebugger_); else rowCutDebugger_ = NULL; if (defaultHandler_) { delete handler_; } /* Is this correct? Shouldn't we clone a non-default handler instead of simply assigning the pointer? -lh, 091021- */ defaultHandler_ = rhs.defaultHandler_; if (defaultHandler_) { handler_ = new CoinMessageHandler(*rhs.handler_); } else { handler_ = rhs.handler_; } CoinDisjointCopyN(rhs.intParam_, OsiLastIntParam, intParam_); CoinDisjointCopyN(rhs.dblParam_, OsiLastDblParam, dblParam_); CoinDisjointCopyN(rhs.strParam_, OsiLastStrParam, strParam_); CoinDisjointCopyN(rhs.hintParam_, OsiLastHintParam, hintParam_); CoinDisjointCopyN(rhs.hintStrength_, OsiLastHintParam, hintStrength_); } // Resets as if default constructor void OsiSolverInterface::reset() { // Throw an exception throw CoinError("Needs coding for this interface", "reset", "OsiSolverInterface"); } /*Enables normal operation of subsequent functions. This method is supposed to ensure that all typical things (like reduced costs, etc.) are updated when individual pivots are executed and can be queried by other methods. says whether will be doing primal or dual */ void OsiSolverInterface::enableSimplexInterface(bool ) {} //Undo whatever setting changes the above method had to make void OsiSolverInterface::disableSimplexInterface() {} /* Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none */ int OsiSolverInterface::canDoSimplexInterface() const { return 0; } /* Tells solver that calls to getBInv etc are about to take place. Underlying code may need mutable as this may be called from CglCut:;generateCuts which is const. If that is too horrific then each solver e.g. BCP or CBC will have to do something outside main loop. */ void OsiSolverInterface::enableFactorization() const { // Throw an exception throw CoinError("Needs coding for this interface", "enableFactorization", "OsiSolverInterface"); } // and stop void OsiSolverInterface::disableFactorization() const { // Throw an exception throw CoinError("Needs coding for this interface", "disableFactorization", "OsiSolverInterface"); } //Returns true if a basis is available bool OsiSolverInterface::basisIsAvailable() const { return false; } /* (JJF ?date?) The following two methods may be replaced by the methods of OsiSolverInterface using OsiWarmStartBasis if: 1. OsiWarmStartBasis resize operation is implemented more efficiently and 2. It is ensured that effects on the solver are the same (lh 100818) 1. CoinWarmStartBasis is the relevant resize, and John's right, it needs to be reworked. The problem is that when new columns or rows are added, the new space is initialised two bits at a time. It needs to be done in bulk. There are other problems with CoinWarmStartBasis that should be addressed at the same time. 2. setWarmStart followed by resolve should do it. */ void OsiSolverInterface::getBasisStatus(int* , int* ) const { // Throw an exception throw CoinError("Needs coding for this interface", "getBasisStatus", "OsiSolverInterface"); } /* Set the status of structural/artificial variables and factorize, update solution etc NOTE artificials are treated as +1 elements so for <= rhs artificial will be at lower bound if constraint is tight */ int OsiSolverInterface::setBasisStatus(const int* , const int* ) { // Throw an exception throw CoinError("Needs coding for this interface", "setBasisStatus", "OsiSolverInterface"); } /* Perform a pivot by substituting a colIn for colOut in the basis. The status of the leaving variable is given in statOut. Where 1 is to upper bound, -1 to lower bound */ int OsiSolverInterface::pivot(int , int , int ) { // Throw an exception throw CoinError("Needs coding for this interface", "pivot", "OsiSolverInterface"); } /* Obtain a result of the primal pivot Outputs: colOut -- leaving column, outStatus -- its status, t -- step size, and, if dx!=NULL, *dx -- primal ray direction. Inputs: colIn -- entering column, sign -- direction of its change (+/-1). Both for colIn and colOut, artificial variables are index by the negative of the row index minus 1. Return code (for now): 0 -- leaving variable found, -1 -- everything else? Clearly, more informative set of return values is required Primal and dual solutions are updated */ int OsiSolverInterface::primalPivotResult(int, int , int& , int& , double& , CoinPackedVector* ) { // Throw an exception throw CoinError("Needs coding for this interface", "primalPivotResult", "OsiSolverInterface"); } /* Obtain a result of the dual pivot (similar to the previous method) Differences: entering variable and a sign of its change are now the outputs, the leaving variable and its statuts -- the inputs If dx!=NULL, then *dx contains dual ray Return code: same */ int OsiSolverInterface::dualPivotResult(int& , int& , int , int , double& , CoinPackedVector* ) { // Throw an exception throw CoinError("Needs coding for this interface", "dualPivotResult", "OsiSolverInterface"); } //Get the reduced gradient for the cost vector c void OsiSolverInterface::getReducedGradient(double* , double * , const double * ) const { // Throw an exception throw CoinError("Needs coding for this interface", "getReducedGradient", "OsiSolverInterface"); } //Get a row of the tableau (slack part in slack if not NULL) void OsiSolverInterface::getBInvARow(int , double* , double * ) const { // Throw an exception throw CoinError("Needs coding for this interface", "getBInvARow", "OsiSolverInterface"); } //Get a row of the basis inverse void OsiSolverInterface::getBInvRow(int , double* ) const { // Throw an exception throw CoinError("Needs coding for this interface", "getBInvRow", "OsiSolverInterface"); } //Get a column of the tableau void OsiSolverInterface::getBInvACol(int , double* ) const { // Throw an exception throw CoinError("Needs coding for this interface", "getBInvACol", "OsiSolverInterface"); } //Get a column of the basis inverse void OsiSolverInterface::getBInvCol(int , double* ) const { // Throw an exception throw CoinError("Needs coding for this interface", "getBInvCol", "OsiSolverInterface"); } /* Get warm start information. Return warm start information for the current state of the solver interface. If there is no valid warm start information, an empty warm start object wil be returned. This does not necessarily create an object - may just point to one. must Delete set true if user should delete returned object. OsiClp version always returns pointer and false. */ CoinWarmStart* OsiSolverInterface::getPointerToWarmStart(bool & mustDelete) { mustDelete = true; return getWarmStart(); } /* Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBInvACol() and getBInvCol()). */ void OsiSolverInterface::getBasics(int* ) const { // Throw an exception throw CoinError("Needs coding for this interface", "getBasics", "OsiSolverInterface"); } /* Check two models against each other. Return nonzero if different. Ignore names if that set. May modify both models by cleaning up */ int OsiSolverInterface::differentModel(OsiSolverInterface & other, bool /*ignoreNames*/) { // set reasonable defaults bool takeHint; OsiHintStrength strength; // Switch off printing if asked to bool gotHint = (getHintParam(OsiDoReducePrint,takeHint,strength)); assert (gotHint); bool printStuff=true; if (strength!=OsiHintIgnore&&takeHint) printStuff=false; int returnCode=0; int numberRows = getNumRows(); int numberColumns = getNumCols(); int numberIntegers = getNumIntegers(); if (numberRows!=other.getNumRows()||numberColumns!=other.getNumCols()) { if (printStuff) printf("** Mismatch on size, this has %d rows, %d columns - other has %d rows, %d columns\n", numberRows,numberColumns,other.getNumRows(),other.getNumCols()); return 1000; } if (numberIntegers!=other.getNumIntegers()) { if (printStuff) printf("** Mismatch on number of integers, this has %d - other has %d\n", numberIntegers,other.getNumIntegers()); return 1001; } int numberErrors1=0; int numberErrors2=0; for (int i=0;igetNumElements()==other.getNumElements()) { if (!matrix->isEquivalent(*matrix2,tolerance)) { returnCode+=100; if (printStuff) printf("Two matrices are not same\n"); } } else { returnCode+=200; if (printStuff) printf("Two matrices are not same - %d elements and %d elements\n", matrix->getNumElements(),matrix2->getNumElements()); } return returnCode; } #ifdef COIN_SNAPSHOT // Fill in a CoinSnapshot CoinSnapshot * OsiSolverInterface::snapshot(bool createArrays) const { CoinSnapshot * snap = new CoinSnapshot(); // scalars snap->setObjSense(getObjSense()); snap->setInfinity(getInfinity()); snap->setObjValue(getObjValue()); double objOffset=0.0; getDblParam(OsiObjOffset,objOffset); snap->setObjOffset(objOffset); snap->setDualTolerance(dblParam_[OsiDualTolerance]); snap->setPrimalTolerance(dblParam_[OsiPrimalTolerance]); snap->setIntegerTolerance(getIntegerTolerance()); snap->setIntegerUpperBound(dblParam_[OsiDualObjectiveLimit]); if (createArrays) { snap->loadProblem(*getMatrixByCol(),getColLower(),getColUpper(), getObjCoefficients(),getRowLower(), getRowUpper()); snap->createRightHandSide(); // Solution snap->setColSolution(getColSolution(),true); snap->setRowPrice(getRowPrice(),true); snap->setReducedCost(getReducedCost(),true); snap->setRowActivity(getRowActivity(),true); } else { snap->setNumCols(getNumCols()); snap->setNumRows(getNumRows()); snap->setNumElements(getNumElements()); snap->setMatrixByCol(getMatrixByCol(),false); snap->setColLower(getColLower(),false); snap->setColUpper(getColUpper(),false); snap->setObjCoefficients(getObjCoefficients(),false); snap->setRowLower(getRowLower(),false); snap->setRowUpper(getRowUpper(),false); // Solution snap->setColSolution(getColSolution(),false); snap->setRowPrice(getRowPrice(),false); snap->setReducedCost(getReducedCost(),false); snap->setRowActivity(getRowActivity(),false); } // If integer then create array (which snapshot has to own); int numberColumns = getNumCols(); char * type = new char[numberColumns]; int numberIntegers=0; for (int i=0;isetColType(type,true); else snap->setNumIntegers(0); delete [] type; return snap; } #endif /* Identify integer variables and create corresponding objects. Record integer variables and create an OsiSimpleInteger object for each one. All existing OsiSimpleInteger objects will be destroyed. New */ void OsiSolverInterface::findIntegers(bool justCount) { numberIntegers_=0; int numberColumns = getNumCols(); int iColumn; for (iColumn=0;iColumn(object_[iObject]) ; if (obj) numberIntegers++; } // if same number return if (numberIntegers_==numberIntegers) return; // space for integers int * marked = new int[numberColumns]; for (iColumn=0;iColumn(oldObject[iObject]) ; if (obj) { iColumn = obj->columnNumber(); assert (iColumn>=0&&iColumn=0) object_[numberObjects_++] = oldObject[iObject]; else object_[numberObjects_++] = new OsiSimpleInteger(this,iColumn); } } // Now append other objects for (iObject = 0;iObject(oldObject[iObject]) ; if (!obj) object_[numberObjects_++] = oldObject[iObject]; } // Delete old array (just array) delete [] oldObject; delete [] marked; } /* Identify integer variables and SOS and create corresponding objects. Record integer variables and create an OsiSimpleInteger object for each one. All existing OsiSimpleInteger objects will be destroyed. If the solver supports SOS then do the same for SOS. If justCount then no objects created and we just store numberIntegers_ Returns number of SOS */ int OsiSolverInterface::findIntegersAndSOS(bool justCount) { findIntegers(justCount); return 0; } // Delete all object information void OsiSolverInterface::deleteObjects() { for (int i=0;i=0 if using existing simple integer and >=numberColumns if using new integer */ int * mark = new int[numberColumns]; int i; for (i=0;i(objects[i]) ; if (obj) { int iColumn = obj->columnNumber(); mark[iColumn]=i+numberColumns; newIntegers++; } } // and existing for (i=0;i(object_[i]) ; if (obj) { int iColumn = obj->columnNumber(); if (mark[iColumn]<0) { newIntegers++; newNumberObjects++; mark[iColumn]=i; } else { // But delete existing delete object_[i]; object_[i]=NULL; } } else { newNumberObjects++; } } numberIntegers_ = newIntegers; OsiObject ** temp = new OsiObject * [newNumberObjects]; // Put integers first newIntegers=0; numberIntegers_=0; for (i=0;i=0) { if (!isInteger(i)) { newIntegers++; setInteger(i); } if (whichclone(); } numberIntegers_++; } } int n=numberIntegers_; // Now rest of old for (i=0;i(object_[i]) ; if (!obj) { temp[n++]=object_[i]; } } } // and rest of new for (i=0;i(objects[i]) ; if (!obj) { temp[n++]=objects[i]->clone(); } } delete [] mark; delete [] object_; object_ = temp; numberObjects_ = newNumberObjects; } // Deletes branching information before columns deleted void OsiSolverInterface::deleteBranchingInfo(int numberDeleted, const int * which) { if (numberObjects_) { int numberColumns = getNumCols(); // mark is -1 if deleted and new number if not deleted int * mark = new int[numberColumns]; int i; int iColumn; for (i=0;i=0&&iColumn=0) { mark[i]=iColumn; iColumn++; } } int oldNumberObjects = numberObjects_; numberIntegers_=0; numberObjects_=0; for (i=0;i(object_[i]) ; if (obj) { iColumn = obj->columnNumber(); int jColumn = mark[iColumn]; if (jColumn>=0) { obj->setColumnNumber(jColumn); object_[numberObjects_++]=obj; numberIntegers_++; } else { delete obj; } } else { // not integer - all I know about is SOS OsiSOS * obj = dynamic_cast (object_[i]) ; if (obj) { int oldNumberMembers=obj->numberMembers(); int numberMembers=0; double * weight = obj->mutableWeights(); int * members = obj->mutableMembers(); for (int k=0;k=0) { members[numberMembers]=jColumn; weight[numberMembers++]=weight[k]; } } if (numberMembers) { obj->setNumberMembers(numberMembers); object_[numberObjects_++]=obj; } } } } delete [] mark; } else { findIntegers(false); } } /* Use current solution to set bounds so current integer feasible solution will stay feasible. Only feasible bounds will be used, even if current solution outside bounds. The amount of such violation will be returned (and if small can be ignored) */ double OsiSolverInterface::forceFeasible() { /* Run through the objects and use feasibleRegion() to set variable bounds so as to fix the variables specified in the objects at their value in this solution. Since the object list contains (at least) one object for every integer variable, this has the effect of fixing all integer variables. */ int i; // Can't guarantee has matrix const OsiBranchingInformation info(this,false,false); double infeasibility=0.0; for (i=0;ifeasibleRegion(this,&info); return infeasibility; } /* For variables currently at bound, fix at bound if reduced cost >= gap Returns number fixed */ int OsiSolverInterface::reducedCostFix(double gap, bool justInteger) { double direction = getObjSense() ; double tolerance; getDblParam(OsiPrimalTolerance,tolerance) ; if (gap<=0.0) return 0; const double *lower = getColLower() ; const double *upper = getColUpper() ; const double *solution = getColSolution() ; const double *reducedCost = getReducedCost() ; int numberFixed = 0 ; int numberColumns = getNumCols(); for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++) { if (isInteger(iColumn)||!justInteger) { double djValue = direction*reducedCost[iColumn] ; if (upper[iColumn]-lower[iColumn] > tolerance) { if (solution[iColumn] < lower[iColumn]+tolerance && djValue > gap) { setColUpper(iColumn,lower[iColumn]) ; numberFixed++ ; } else if (solution[iColumn] > upper[iColumn]-tolerance && -djValue > gap) { setColLower(iColumn,upper[iColumn]) ; numberFixed++ ; } } } } return numberFixed; } #ifdef COIN_FACTORIZATION_INFO // Return number of entries in L part of current factorization CoinBigIndex OsiSolverInterface::getSizeL() const { return -1; } // Return number of entries in U part of current factorization CoinBigIndex OsiSolverInterface::getSizeU() const { return -1; } #endif #ifdef CBC_NEXT_VERSION /* Solve 2**N (N==depth) problems and return solutions and bases. There are N branches each of which changes bounds on both sides as given by branch. The user should provide an array of (empty) results which will be filled in. See OsiSolveResult for more details (in OsiSolveBranch.?pp) but it will include a basis and primal solution. The order of results is left to right at feasible leaf nodes so first one is down, down, ..... Returns number of feasible leaves. Also sets number of solves done and number of iterations. This is provided so a solver can do faster. If forceBranch true then branch done even if satisfied */ int OsiSolverInterface::solveBranches(int depth,const OsiSolverBranch * branch, OsiSolverResult * result, int & numberSolves, int & numberIterations, bool forceBranch) { int * stack = new int [depth]; CoinWarmStart ** basis = new CoinWarmStart * [depth]; int iDepth; for (iDepth=0;iDepth=0) { if (iDepth==0) { // finished finished=true; break; } stack[iDepth]=-1; iDepth--; } if (!finished) { stack[iDepth]=1; } } } delete [] stack; for (iDepth=0;iDepth
  • Create a copy of the original problem.
  • Subject the copy to a series of transformations (the presolve methods) to produce a presolved model. Each transformation is also expected to provide a method to reverse the transformation (the postsolve method). The postsolve methods are collected in a linked list; the postsolve method for the final presolve transformation is at the head of the list.
  • Hand the presolved problem to the solver for optimization.
  • Apply the collected postsolve methods to the presolved problem and solution, restating the solution in terms of the original problem.
  • The COIN presolve algorithms are unaware of OSI. The OsiPresolve class takes care of the interface. Given an OsiSolverInterface \c origModel, it will take care of creating a clone properly loaded with the presolved problem and ready for optimization. After optimization, it will apply postsolve transformations and load the result back into \c origModel. Assuming a problem has been loaded into an \c OsiSolverInterface \c origModel, a bare-bones application looks like this: \code OsiPresolve pinfo ; OsiSolverInterface *presolvedModel ; // Return an OsiSolverInterface loaded with the presolved problem. presolvedModel = pinfo.presolvedModel(*origModel,1.0e-8,false,numberPasses) ; presolvedModel->initialSolve() ; // Restate the solution and load it back into origModel. pinfo.postsolve(true) ; delete presolvedModel ; \endcode */ class OsiPresolve { public: /// Default constructor (empty object) OsiPresolve(); /// Virtual destructor virtual ~OsiPresolve(); /*! \brief Create a new OsiSolverInterface loaded with the presolved problem. This method implements the first two steps described in the class documentation. It clones \c origModel and applies presolve transformations, storing the resulting list of postsolve transformations. It returns a pointer to a new OsiSolverInterface loaded with the presolved problem, or NULL if the problem is infeasible or unbounded. If \c keepIntegers is true then bounds may be tightened in the original. Bounds will be moved by up to \c feasibilityTolerance to try and stay feasible. When \c doStatus is true, the current solution will be transformed to match the presolved model. This should be paired with postsolve(). It is up to the client to destroy the returned OsiSolverInterface, after calling postsolve(). This method is virtual. Override this method if you need to customize the steps of creating a model to apply presolve transformations. In some sense, a wrapper for presolve(CoinPresolveMatrix*). */ virtual OsiSolverInterface *presolvedModel(OsiSolverInterface & origModel, double feasibilityTolerance=0.0, bool keepIntegers=true, int numberPasses=5, const char * prohibited=NULL, bool doStatus=true, const char * rowProhibited=NULL); /*! \brief Restate the solution to the presolved problem in terms of the original problem and load it into the original model. postsolve() restates the solution in terms of the original problem and updates the original OsiSolverInterface supplied to presolvedModel(). If the problem has not been solved to optimality, there are no guarantees. If you are using an algorithm like simplex that has a concept of a basic solution, then set updateStatus The advantage of going back to the original problem is that it will be exactly as it was, i.e., 0.0 will not become 1.0e-19. Note that if you modified the original problem after presolving, then you must ``undo'' these modifications before calling postsolve(). In some sense, a wrapper for postsolve(CoinPostsolveMatrix&). */ virtual void postsolve(bool updateStatus=true); /*! \brief Return a pointer to the presolved model. */ OsiSolverInterface * model() const; /// Return a pointer to the original model OsiSolverInterface * originalModel() const; /// Set the pointer to the original model void setOriginalModel(OsiSolverInterface *model); /// Return a pointer to the original columns const int * originalColumns() const; /// Return a pointer to the original rows const int * originalRows() const; /// Return number of rows in original model inline int getNumRows() const { return nrows_;} /// Return number of columns in original model inline int getNumCols() const { return ncols_;} /** "Magic" number. If this is non-zero then any elements with this value may change and so presolve is very limited in what can be done to the row and column. This is for non-linear problems. */ inline void setNonLinearValue(double value) { nonLinearValue_ = value;} inline double nonLinearValue() const { return nonLinearValue_;} /*! \brief Fine control over presolve actions Set/clear the following bits to allow or suppress actions: - 0x01 allow duplicate column processing on integer columns and dual stuff on integers - 0x02 switch off actions which can change +1 to something else (doubleton, tripleton, implied free) - 0x04 allow transfer of costs from singletons and between integer variables (when advantageous) - 0x08 do not allow x+y+z=1 transform - 0x10 allow actions that don't easily unroll - 0x20 allow dubious gub element reduction GUB element reduction is only partially implemented in CoinPresolve (see gubrow_action) and willl cause an abort at postsolve. It's not clear what's meant by `dual stuff on integers'. -- lh, 110605 -- */ inline void setPresolveActions(int action) { presolveActions_ = (presolveActions_&0xffff0000)|(action&0xffff);} private: /*! Original model (solver interface loaded with the original problem). Must not be destroyed until after postsolve(). */ OsiSolverInterface * originalModel_; /*! Presolved model (solver interface loaded with the presolved problem) Must be destroyed by the client (using delete) after postsolve(). */ OsiSolverInterface * presolvedModel_; /*! "Magic" number. If this is non-zero then any elements with this value may change and so presolve is very limited in what can be done to the row and column. This is for non-linear problems. One could also allow for cases where sign of coefficient is known. */ double nonLinearValue_; /// Original column numbers int * originalColumn_; /// Original row numbers int * originalRow_; /// The list of transformations applied. const CoinPresolveAction *paction_; /*! \brief Number of columns in original model. The problem will expand back to its former size as postsolve transformations are applied. It is efficient to allocate data structures for the final size of the problem rather than expand them as needed. */ int ncols_; /*! \brief Number of rows in original model. */ int nrows_; /*! \brief Number of nonzero matrix coefficients in the original model. */ CoinBigIndex nelems_; /** Whether we want to skip dual part of presolve etc. 1 bit allows duplicate column processing on integer columns and dual stuff on integers 4 transfers costs to integer variables */ int presolveActions_; /// Number of major passes int numberPasses_; protected: /*! \brief Apply presolve transformations to the problem. Handles the core activity of applying presolve transformations. If you want to apply the individual presolve routines differently, or perhaps add your own to the mix, define a derived class and override this method */ virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob); /*! \brief Reverse presolve transformations to recover the solution to the original problem. Handles the core activity of applying postsolve transformations. Postsolving is pretty generic; just apply the transformations in reverse order. You will probably only be interested in overriding this method if you want to add code to test for consistency while debugging new presolve techniques. */ virtual void postsolve(CoinPostsolveMatrix &prob); /*! \brief Destroys queued postsolve actions. E.g., when presolve() determines the problem is infeasible, so that it will not be necessary to actually solve the presolved problem and convert the result back to the original problem. */ void gutsOfDestroy(); }; #endif CoinMP-1.8.3/Osi/src/Osi/OsiNames.cpp0000644000175000017500000006100312101340333015577 0ustar renerene// Copyright (C) 2007, Lou Hafer and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "OsiSolverInterface.hpp" #include "CoinLpIO.hpp" #include "CoinMpsIO.hpp" #include "CoinModel.hpp" /* These routines support three name disciplines: 0: No names: No name information is retained. rowNames_ and colNames_ are always vectors of length 0. Requests for individual names will return a name of the form RowNNN or ColNNN, generated on request. 1: Lazy names: Name information supplied by the client is retained. rowNames_ and colNames_ are sized to be large enough to hold names supplied by the client, and no larger. If the client has left holes, those entries will contain a null string. Requests for individual names will return the name supplied by the client, or a generated name. Requests for a vector of names will return a reference to rowNames_ or colNames_, with no modification. This mode is intended for applications like branch-and-cut, where the client is only interested in the original constraint system and could care less about names for generated constraints and variables. The various read[Mps,GMPL,Lp] routines capture the names that are part of the input format. If the client is building from scratch, they'll need to supply the names as they install constraints and variables. 2: Full names: From the client's point of view, this looks exactly like lazy names, except that when a vector of names is requested, the vector is always sized to match the constraint system and all entries have names (either supplied or generated). Internally, full names looks just like lazy names, with the exception that if the client requests one of the name vectors, we generate the full version on the spot and keep it around for further use. This approach sidesteps some ugly implementation issues. The base routines to add a row or column, or load a problem from matrices, are pure virtual. There's just no way to guarantee we can keep the name vectors up-to-date with each modification. Nor do we want to be in the business of generating a name as soon as the row or column appears, only to have our generated name immediately overridden by the client. Arguably these magic numbers should be an enum, but that's not the current OSI style. */ namespace { /* Generate a `name' that's really an error message. A separate routine strictly for standardisation and ease of use. The 'u' code is intended to be used when a routine is expecting one of 'r' or 'c' and saw something else. */ std::string invRowColName (char rcd, int ndx) { std::ostringstream buildName ; buildName << "!!invalid " ; switch (rcd) { case 'r': { buildName << "Row " << ndx << "!!" ; break ; } case 'c': { buildName << "Col " << ndx << "!!" ; break ; } case 'd': { buildName << "Discipline " << ndx << "!!" ; break ; } case 'u': { buildName << "Row/Col " << ndx << "!!" ; break ; } default: { buildName << "!!Internal Confusion!!" ; break ; } } return (buildName.str()) ; } /* Adjust the allocated capacity of the name vectors, if they're sufficiently far off (more than 1000 elements). Use this routine only if you don't need the current contents of the vectors. The `assignment & swap' bit is a trick lifted from Stroustrop 16.3.8 to make sure we really give back some space. */ void reallocRowColNames (OsiSolverInterface::OsiNameVec &rowNames, int m, OsiSolverInterface::OsiNameVec &colNames, int n) { int rowCap = static_cast(rowNames.capacity()) ; int colCap = static_cast(colNames.capacity()) ; if (rowCap-m > 1000) { rowNames.resize(m) ; OsiSolverInterface::OsiNameVec tmp = rowNames ; rowNames.swap(tmp) ; } else if (rowCap < m) { rowNames.reserve(m) ; } assert(rowNames.capacity() >= static_cast(m)) ; if (colCap-n > 1000) { colNames.resize(n) ; OsiSolverInterface::OsiNameVec tmp = colNames ; colNames.swap(tmp) ; } else if (colCap < n) { colNames.reserve(n) ; } assert(colNames.capacity() >= static_cast(n)) ; return ; } /* It's handy to have a 0-length name vector hanging around to use as a return value when the name discipline = auto. Then we don't have to worry about what's actually occupying rowNames_ or colNames_. */ const OsiSolverInterface::OsiNameVec zeroLengthNameVec(0) ; } /* Generate the default RNNNNNNN/CNNNNNNN. This is a separate routine so that it's available to generate names for new rows and columns. If digits is nonzero, it's used, otherwise the default is 7 digits after the initial R or C. If rc = 'o', return the default name for the objective function. Yes, it's true that ndx = m is (by definition) supposed to refer to the objective function. But ... we're often calling this routine to get a name *before* installing the row. Unless you want all your rows to be named OBJECTIVE, something different is needed here. */ std::string OsiSolverInterface::dfltRowColName (char rc, int ndx, unsigned digits) const { std::ostringstream buildName ; if (!(rc == 'r' || rc == 'c' || rc == 'o')) { return (invRowColName('u',ndx)) ; } if (ndx < 0) { return (invRowColName(rc,ndx)) ; } if (digits <= 0) { digits = 7 ; } if (rc == 'o') { std::string dfltObjName = "OBJECTIVE" ; buildName << dfltObjName.substr(0,digits+1) ; } else { buildName << ((rc == 'r')?"R":"C") ; buildName << std::setw(digits) << std::setfill('0') ; buildName << ndx ; } return buildName.str() ; } /* Return the name of the objective function. */ std::string OsiSolverInterface::getObjName (unsigned maxLen) const { std::string name ; if (objName_.length() == 0) { name = dfltRowColName('o',0,maxLen) ; } else { name = objName_.substr(0,maxLen) ; } return (name) ; } /* Return a row name, according to the current name discipline, truncated if necessary. If the row index is out of range, the name becomes an error message. By definition, ndx = getNumRows() (i.e., one greater than the largest valid row index) is the objective function. */ std::string OsiSolverInterface::getRowName (int ndx, unsigned maxLen) const { int nameDiscipline ; std::string name ; /* Check for valid row index. */ int m = getNumRows() ; if (ndx < 0 || ndx > m) { name = invRowColName('r',ndx) ; return (name) ; } /* The objective is kept separately, so we don't always have an entry at index m in the names vector. If no name is set, return the default. */ if (ndx == m) { return (getObjName(maxLen)) ; } /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Find/generate the proper name, based on discipline. */ switch (nameDiscipline) { case 0: { name = dfltRowColName('r',ndx) ; break ; } case 1: case 2: { name = "" ; if (static_cast(ndx) < rowNames_.size()) name = rowNames_[ndx] ; if (name.length() == 0) name = dfltRowColName('r',ndx) ; break ; } default: { name = invRowColName('d',nameDiscipline) ; return (name) ; } } /* Return the (possibly truncated) substring. The default for maxLen is npos (no truncation). */ return (name.substr(0,maxLen)) ; } /* Return the vector of row names. The vector we need depends on the name discipline: 0: return a vector of length 0 1: return rowNames_, no tweaking required 2: Check that rowNames_ is complete. Generate a complete vector on the spot if we need it. */ const OsiSolverInterface::OsiNameVec &OsiSolverInterface::getRowNames () { int nameDiscipline ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Return the proper vector, as described at the head of the routine. If we need to generate a full vector, resize the existing vector and scan, filling in entries as required. */ switch (nameDiscipline) { case 0: { return (zeroLengthNameVec) ; } case 1: { return (rowNames_) ; } case 2: { int m = getNumRows() ; if (rowNames_.size() < static_cast(m+1)) { rowNames_.resize(m+1) ; } for (int i = 0 ; i < m ; i++) { if (rowNames_[i].length() == 0) { rowNames_[i] = dfltRowColName('r',i) ; } } if (rowNames_[m].length() == 0) { rowNames_[m] = getObjName() ; } return (rowNames_) ; } default: { /* quietly fail */ return (zeroLengthNameVec) ; } } /* We should never reach here. */ assert(false) ; return (zeroLengthNameVec) ; } /* Return a column name, according to the current name discipline, truncated if necessary. If the column index is out of range, the name becomes an error message. */ std::string OsiSolverInterface::getColName (int ndx, unsigned maxLen) const { int nameDiscipline ; std::string name ; /* Check for valid column index. */ if (ndx < 0 || ndx >= getNumCols()) { name = invRowColName('c',ndx) ; return (name) ; } /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Find/generate the proper name, based on discipline. */ switch (nameDiscipline) { case 0: { name = dfltRowColName('c',ndx) ; break ; } case 1: case 2: { name = "" ; if (static_cast(ndx) < colNames_.size()) name = colNames_[ndx] ; if (name.length() == 0) name = dfltRowColName('c',ndx) ; break ; } default: { name = invRowColName('d',nameDiscipline) ; return (name) ; } } /* Return the (possibly truncated) substring. The default for maxLen is npos (no truncation). */ return (name.substr(0,maxLen)) ; } /* Return the vector of column names. The vector we need depends on the name discipline: 0: return a vector of length 0 1: return colNames_, no tweaking required 2: Check that colNames_ is complete. Generate a complete vector on the spot if we need it. */ const OsiSolverInterface::OsiNameVec &OsiSolverInterface::getColNames () { int nameDiscipline ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Return the proper vector, as described at the head of the routine. If we need to generate a full vector, resize the existing vector and scan, filling in entries as required. */ switch (nameDiscipline) { case 0: { return (zeroLengthNameVec) ; } case 1: { return (colNames_) ; } case 2: { int n = getNumCols() ; if (colNames_.size() < static_cast(n)) { colNames_.resize(n) ; } for (int j = 0 ; j < n ; j++) { if (colNames_[j].length() == 0) { colNames_[j] = dfltRowColName('c',j) ; } } return (colNames_) ; } default: { /* quietly fail */ return (zeroLengthNameVec) ; } } /* We should never reach here. */ assert(false) ; return (zeroLengthNameVec) ; } /* Set a single row name. Quietly does nothing if the index or name discipline is invalid. */ void OsiSolverInterface::setRowName (int ndx, std::string name) { int nameDiscipline ; /* Quietly do nothing if the index is out of bounds. This should be changed, but what's our error convention, eh? There's no precedent in OsiSolverInterface.cpp. */ if (ndx < 0 || ndx >= getNumRows()) { return ; } /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Do the right thing, according to the discipline. */ switch (nameDiscipline) { case 0: { break ; } case 1: case 2: { if (static_cast(ndx) > rowNames_.capacity()) { rowNames_.resize(ndx+1) ; } else if (static_cast(ndx) >= rowNames_.size()) { rowNames_.resize(ndx+1) ; } rowNames_[ndx] = name ; break ; } default: { break ; } } return ; } /* Set a run of row names. Quietly fail if the specified indices are invalid. On the target side, [tgtStart, tgtStart+len-1] must be in the range [0,m-1], where m is the number of rows. On the source side, srcStart must be zero or greater. If we run off the end of srcNames, we just generate default names. */ void OsiSolverInterface::setRowNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart) { int nameDiscipline ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* If the name discipline is auto, we're already done. */ if (nameDiscipline == 0) { return ; } /* A little self-protection. Check that we're within [0,m-1] on the target side, and that srcStart is zero or greater. Quietly fail if the indices don't fit. */ int m = getNumRows() ; if (tgtStart < 0 || tgtStart+len > m) { return ; } if (srcStart < 0) { return ; } int srcLen = static_cast(srcNames.size()) ; /* Load 'em up. */ int srcNdx = srcStart ; int tgtNdx = tgtStart ; for ( ; tgtNdx < tgtStart+len ; srcNdx++,tgtNdx++) { if (srcNdx < srcLen) { setRowName(tgtNdx,srcNames[srcNdx]) ; } else { setRowName(tgtNdx,dfltRowColName('r',tgtNdx)) ; } } return ; } /* Delete one or more row names. */ void OsiSolverInterface::deleteRowNames (int tgtStart, int len) { int nameDiscipline ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* If the name discipline is auto, we're done. */ if (nameDiscipline == 0) { return ; } /* Trim the range to names that exist in the name vector. If we're doing lazy names, it's quite likely that we don't need to do any work. */ int lastNdx = static_cast(rowNames_.size()) ; if (tgtStart < 0 || tgtStart >= lastNdx) { return ; } if (tgtStart+len > lastNdx) { len = lastNdx-tgtStart ; } /* Erase the names. */ OsiNameVec::iterator firstIter,lastIter ; firstIter = rowNames_.begin()+tgtStart ; lastIter = firstIter+len ; rowNames_.erase(firstIter,lastIter) ; return ; } /* Set a single column name. Quietly does nothing if the index or name discipline is invalid. */ void OsiSolverInterface::setColName (int ndx, std::string name) { int nameDiscipline ; /* Quietly do nothing if the index is out of bounds. This should be changed, but what's our error convention, eh? There's no precedent in OsiSolverInterface.cpp. */ if (ndx < 0 || ndx >= getNumCols()) { return ; } /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Do the right thing, according to the discipline. */ switch (nameDiscipline) { case 0: { break ; } case 1: case 2: { if (static_cast(ndx) > colNames_.capacity()) { colNames_.resize(ndx+1) ; } else if (static_cast(ndx) >= colNames_.size()) { colNames_.resize(ndx+1) ; } colNames_[ndx] = name ; break ; } default: { break ; } } return ; } /* Set a run of column names. Quietly fail if the specified indices are invalid. On the target side, [tgtStart, tgtStart+len-1] must be in the range [0,n-1], where n is the number of columns. On the source side, srcStart must be zero or greater. If we run off the end of srcNames, we just generate default names. */ void OsiSolverInterface::setColNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart) { int nameDiscipline ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* If the name discipline is auto, we're already done. */ if (nameDiscipline == 0) { return ; } /* A little self-protection. Check that we're within [0,m-1] on the target side, and that srcStart is zero or greater. Quietly fail if the indices don't fit. */ int n = getNumCols() ; if (tgtStart < 0 || tgtStart+len > n) { return ; } if (srcStart < 0) { return ; } int srcLen = static_cast(srcNames.size()) ; /* Load 'em up. */ int srcNdx = srcStart ; int tgtNdx = tgtStart ; for ( ; tgtNdx < tgtStart+len ; srcNdx++,tgtNdx++) { if (srcNdx < srcLen) { setColName(tgtNdx,srcNames[srcNdx]) ; } else { setColName(tgtNdx,dfltRowColName('c',tgtNdx)) ; } } return ; } /* Delete one or more column names. Quietly fail if firstNdx is less than zero or if firstNdx+len is greater than the number of columns. */ void OsiSolverInterface::deleteColNames (int tgtStart, int len) { int nameDiscipline ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* If the name discipline is auto, we're done. */ if (nameDiscipline == 0) { return ; } /* Trim the range to names that exist in the name vector. If we're doing lazy names, it's quite likely that we don't need to do any work. */ int lastNdx = static_cast(colNames_.size()) ; if (tgtStart < 0 || tgtStart >= lastNdx) { return ; } if (tgtStart+len > lastNdx) { len = lastNdx-tgtStart ; } /* Erase the names. */ OsiNameVec::iterator firstIter,lastIter ; firstIter = colNames_.begin()+tgtStart ; lastIter = firstIter+len ; colNames_.erase(firstIter,lastIter) ; return ; } /* Install the name information from a CoinMpsIO object. */ void OsiSolverInterface::setRowColNames (const CoinMpsIO &mps) { int nameDiscipline,m,n ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Whatever happens, we're about to clean out the current name vectors. Decide on an appropriate size and call reallocRowColNames to adjust capacity. */ if (nameDiscipline == 0) { m = 0 ; n = 0 ; } else { m = mps.getNumRows() ; n = mps.getNumCols() ; } reallocRowColNames(rowNames_,m,colNames_,n) ; /* If name discipline is auto, we're done already. Otherwise, load 'em up. If I understand MPS correctly, names are required. */ if (nameDiscipline != 0) { rowNames_.resize(m) ; for (int i = 0 ; i < m ; i++) { rowNames_[i] = mps.rowName(i) ; } objName_ = mps.getObjectiveName() ; colNames_.resize(n) ; for (int j = 0 ; j < n ; j++) { colNames_[j] = mps.columnName(j) ; } } return ; } /* Install the name information from a CoinModel object. CoinModel does not maintain a name for the objective function (in fact, it has no concept of objective function). */ void OsiSolverInterface::setRowColNames (CoinModel &mod) { int nameDiscipline,m,n ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Whatever happens, we're about to clean out the current name vectors. Decide on an appropriate size and call reallocRowColNames to adjust capacity. */ if (nameDiscipline == 0) { m = 0 ; n = 0 ; } else { m = mod.rowNames()->numberItems() ; n = mod.columnNames()->numberItems() ; } reallocRowColNames(rowNames_,m,colNames_,n) ; /* If name discipline is auto, we're done already. Otherwise, load 'em up. As best I can see, there's no guarantee that we'll have names for all rows and columns, so we need to pay attention. */ if (nameDiscipline != 0) { int maxRowNdx=-1, maxColNdx=-1 ; const char *const *names = mod.rowNames()->names() ; rowNames_.resize(m) ; for (int i = 0 ; i < m ; i++) { std::string nme = names[i] ; if (nme.length() == 0) { if (nameDiscipline == 2) { nme = dfltRowColName('r',i) ; } } if (nme.length() > 0) { maxRowNdx = i ; } rowNames_[i] = nme ; } rowNames_.resize(maxRowNdx+1) ; names = mod.columnNames()->names() ; colNames_.resize(n) ; for (int j = 0 ; j < n ; j++) { std::string nme = names[j] ; if (nme.length() == 0) { if (nameDiscipline == 2) { nme = dfltRowColName('c',j) ; } } if (nme.length() > 0) { maxColNdx = j ; } colNames_[j] = nme ; } colNames_.resize(maxColNdx+1) ; } /* And we're done. */ return ; } /* Install the name information from a CoinLpIO object. Nearly identical to the previous routine, but we start from a different object. */ void OsiSolverInterface::setRowColNames (CoinLpIO &mod) { int nameDiscipline,m,n ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* Whatever happens, we're about to clean out the current name vectors. Decide on an appropriate size and call reallocRowColNames to adjust capacity. */ if (nameDiscipline == 0) { m = 0 ; n = 0 ; } else { m = mod.getNumRows() ; n = mod.getNumCols() ; } reallocRowColNames(rowNames_,m,colNames_,n) ; /* If name discipline is auto, we're done already. Otherwise, load 'em up. I have no idea whether we can guarantee valid names for all rows and columns, so we need to pay attention. */ if (nameDiscipline != 0) { int maxRowNdx=-1, maxColNdx=-1 ; const char *const *names = mod.getRowNames() ; rowNames_.resize(m) ; for (int i = 0 ; i < m ; i++) { std::string nme = names[i] ; if (nme.length() == 0) { if (nameDiscipline == 2) { nme = dfltRowColName('r',i) ; } } if (nme.length() > 0) { maxRowNdx = i ; } rowNames_[i] = nme ; } rowNames_.resize(maxRowNdx+1) ; objName_ = mod.getObjName() ; names = mod.getColNames() ; colNames_.resize(n) ; for (int j = 0 ; j < n ; j++) { std::string nme = names[j] ; if (nme.length() == 0) { if (nameDiscipline == 2) { nme = dfltRowColName('c',j) ; } } if (nme.length() > 0) { maxColNdx = j ; } colNames_[j] = nme ; } colNames_.resize(maxColNdx+1) ; } /* And we're done. */ return ; } CoinMP-1.8.3/Osi/src/Osi/OsiColCut.cpp0000644000175000017500000000656611510425067015755 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "OsiColCut.hpp" #include #include #include //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiColCut::OsiColCut() : OsiCut(), lbs_(), ubs_() { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiColCut::OsiColCut(const OsiColCut & source) : OsiCut(source), lbs_(source.lbs_), ubs_(source.ubs_) { // Nothing to do here } //---------------------------------------------------------------- // Clone //---------------------------------------------------------------- OsiColCut * OsiColCut::clone() const { return (new OsiColCut(*this)); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiColCut::~OsiColCut () { // Nothing to do here } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiColCut & OsiColCut::operator=(const OsiColCut& rhs) { if (this != &rhs) { OsiCut::operator=(rhs); lbs_=rhs.lbs_; ubs_=rhs.ubs_; } return *this; } //---------------------------------------------------------------- // Print //------------------------------------------------------------------- void OsiColCut::print() const { const CoinPackedVector & cutLbs = lbs(); const CoinPackedVector & cutUbs = ubs(); int i; std::cout<<"Column cut has " <= "<solution[colIndx]) sum += newLb - solution[colIndx]; } column = cutUbs.getIndices(); number = cutUbs.getNumElements(); bound = cutUbs.getElements(); for ( i=0; i #include #include #include //#define OSI_DEBUG #include "OsiSolverInterface.hpp" #include "OsiBranchingObject.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" #include "CoinFinite.hpp" // Default Constructor OsiObject::OsiObject() :infeasibility_(0.0), whichWay_(0), numberWays_(2), priority_(1000) { } // Destructor OsiObject::~OsiObject () { } // Copy constructor OsiObject::OsiObject ( const OsiObject & rhs) { infeasibility_ = rhs.infeasibility_; whichWay_ = rhs.whichWay_; priority_ = rhs.priority_; numberWays_ = rhs.numberWays_; } // Assignment operator OsiObject & OsiObject::operator=( const OsiObject& rhs) { if (this!=&rhs) { infeasibility_ = rhs.infeasibility_; whichWay_ = rhs.whichWay_; priority_ = rhs.priority_; numberWays_ = rhs.numberWays_; } return *this; } // Return "up" estimate (default 1.0e-5) double OsiObject::upEstimate() const { return 1.0e-5; } // Return "down" estimate (default 1.0e-5) double OsiObject::downEstimate() const { return 1.0e-5; } // Column number if single column object -1 otherwise int OsiObject::columnNumber() const { return -1; } // Infeasibility - large is 0.5 double OsiObject::infeasibility(const OsiSolverInterface * solver, int & preferredWay) const { // Can't guarantee has matrix OsiBranchingInformation info(solver,false,false); return infeasibility(&info,preferredWay); } // This does NOT set mutable stuff double OsiObject::checkInfeasibility(const OsiBranchingInformation * info) const { int way; double saveInfeasibility = infeasibility_; short int saveWhichWay = whichWay_ ; double value = infeasibility(info,way); infeasibility_ = saveInfeasibility; whichWay_ = saveWhichWay; return value; } /* For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. Returns measure of how much it had to move solution to make feasible */ double OsiObject::feasibleRegion(OsiSolverInterface * solver) const { // Can't guarantee has matrix OsiBranchingInformation info(solver,false,false); return feasibleRegion(solver,&info); } // Default Constructor OsiObject2::OsiObject2() : OsiObject(), preferredWay_(-1), otherInfeasibility_(0.0) { } // Destructor OsiObject2::~OsiObject2 () { } // Copy constructor OsiObject2::OsiObject2 ( const OsiObject2 & rhs) : OsiObject(rhs), preferredWay_(rhs.preferredWay_), otherInfeasibility_ (rhs.otherInfeasibility_) { } // Assignment operator OsiObject2 & OsiObject2::operator=( const OsiObject2& rhs) { if (this!=&rhs) { OsiObject::operator=(rhs); preferredWay_ = rhs.preferredWay_; otherInfeasibility_ = rhs.otherInfeasibility_; } return *this; } // Default Constructor OsiBranchingObject::OsiBranchingObject() { originalObject_=NULL; branchIndex_=0; value_=0.0; numberBranches_=2; } // Useful constructor OsiBranchingObject::OsiBranchingObject (OsiSolverInterface * , double value) { originalObject_=NULL; branchIndex_=0; value_=value; numberBranches_=2; } // Copy constructor OsiBranchingObject::OsiBranchingObject ( const OsiBranchingObject & rhs) { originalObject_=rhs.originalObject_; branchIndex_=rhs.branchIndex_; value_=rhs.value_; numberBranches_=rhs.numberBranches_; } // Assignment operator OsiBranchingObject & OsiBranchingObject::operator=( const OsiBranchingObject& rhs) { if (this != &rhs) { originalObject_=rhs.originalObject_; branchIndex_=rhs.branchIndex_; value_=rhs.value_; numberBranches_=rhs.numberBranches_; } return *this; } // Destructor OsiBranchingObject::~OsiBranchingObject () { } // For debug int OsiBranchingObject::columnNumber() const { if (originalObject_) return originalObject_->columnNumber(); else return -1; } /** Default Constructor */ OsiBranchingInformation::OsiBranchingInformation () : objectiveValue_(COIN_DBL_MAX), cutoff_(COIN_DBL_MAX), direction_(COIN_DBL_MAX), integerTolerance_(1.0e-7), primalTolerance_(1.0e-7), timeRemaining_(COIN_DBL_MAX), defaultDual_(-1.0), solver_(NULL), numberColumns_(0), lower_(NULL), solution_(NULL), upper_(NULL), hotstartSolution_(NULL), pi_(NULL), rowActivity_(NULL), objective_(NULL), rowLower_(NULL), rowUpper_(NULL), elementByColumn_(NULL), columnStart_(NULL), columnLength_(NULL), row_(NULL), usefulRegion_(NULL), indexRegion_(NULL), numberSolutions_(0), numberBranchingSolutions_(0), depth_(0), owningSolution_(false) { } /** Useful constructor */ OsiBranchingInformation::OsiBranchingInformation (const OsiSolverInterface * solver, bool /*normalSolver*/, bool owningSolution) : timeRemaining_(COIN_DBL_MAX), defaultDual_(-1.0), solver_(solver), hotstartSolution_(NULL), usefulRegion_(NULL), indexRegion_(NULL), numberSolutions_(0), numberBranchingSolutions_(0), depth_(0), owningSolution_(owningSolution) { direction_ = solver_->getObjSense(); objectiveValue_ = solver_->getObjValue(); objectiveValue_ *= direction_; solver_->getDblParam(OsiDualObjectiveLimit,cutoff_) ; cutoff_ *= direction_; integerTolerance_ = solver_->getIntegerTolerance(); solver_->getDblParam(OsiPrimalTolerance,primalTolerance_) ; numberColumns_ = solver_->getNumCols(); lower_ = solver_->getColLower(); if (owningSolution_) solution_ = CoinCopyOfArray(solver_->getColSolution(),numberColumns_); else solution_ = solver_->getColSolution(); upper_ = solver_->getColUpper(); pi_ = solver_->getRowPrice(); rowActivity_ = solver_->getRowActivity(); objective_ = solver_->getObjCoefficients(); rowLower_ = solver_->getRowLower(); rowUpper_ = solver_->getRowUpper(); const CoinPackedMatrix* matrix = solver_->getMatrixByCol(); if (matrix) { // Column copy of matrix if matrix exists elementByColumn_ = matrix->getElements(); row_ = matrix->getIndices(); columnStart_ = matrix->getVectorStarts(); columnLength_ = matrix->getVectorLengths(); } else { // Matrix does not exist elementByColumn_ = NULL; row_ = NULL; columnStart_ = NULL; columnLength_ = NULL; } } // Copy constructor OsiBranchingInformation::OsiBranchingInformation ( const OsiBranchingInformation & rhs) { objectiveValue_ = rhs.objectiveValue_; cutoff_ = rhs.cutoff_; direction_ = rhs.direction_; integerTolerance_ = rhs.integerTolerance_; primalTolerance_ = rhs.primalTolerance_; timeRemaining_ = rhs.timeRemaining_; defaultDual_ = rhs.defaultDual_; solver_ = rhs.solver_; numberColumns_ = rhs.numberColumns_; lower_ = rhs.lower_; owningSolution_ = rhs.owningSolution_; if (owningSolution_) solution_ = CoinCopyOfArray(rhs.solution_,numberColumns_); else solution_ = rhs.solution_; upper_ = rhs.upper_; hotstartSolution_ = rhs.hotstartSolution_; pi_ = rhs.pi_; rowActivity_ = rhs.rowActivity_; objective_ = rhs.objective_; rowLower_ = rhs.rowLower_; rowUpper_ = rhs.rowUpper_; elementByColumn_ = rhs.elementByColumn_; row_ = rhs.row_; columnStart_ = rhs.columnStart_; columnLength_ = rhs.columnLength_; usefulRegion_ = rhs.usefulRegion_; assert (!usefulRegion_); indexRegion_ = rhs.indexRegion_; numberSolutions_ = rhs.numberSolutions_; numberBranchingSolutions_ = rhs.numberBranchingSolutions_; depth_ = rhs.depth_; } // Clone OsiBranchingInformation * OsiBranchingInformation::clone() const { return new OsiBranchingInformation(*this); } // Assignment operator OsiBranchingInformation & OsiBranchingInformation::operator=( const OsiBranchingInformation& rhs) { if (this!=&rhs) { objectiveValue_ = rhs.objectiveValue_; cutoff_ = rhs.cutoff_; direction_ = rhs.direction_; integerTolerance_ = rhs.integerTolerance_; primalTolerance_ = rhs.primalTolerance_; timeRemaining_ = rhs.timeRemaining_; defaultDual_ = rhs.defaultDual_; numberColumns_ = rhs.numberColumns_; lower_ = rhs.lower_; owningSolution_ = rhs.owningSolution_; if (owningSolution_) { solution_ = CoinCopyOfArray(rhs.solution_,numberColumns_); delete [] solution_; } else { solution_ = rhs.solution_; } upper_ = rhs.upper_; hotstartSolution_ = rhs.hotstartSolution_; pi_ = rhs.pi_; rowActivity_ = rhs.rowActivity_; objective_ = rhs.objective_; rowLower_ = rhs.rowLower_; rowUpper_ = rhs.rowUpper_; elementByColumn_ = rhs.elementByColumn_; row_ = rhs.row_; columnStart_ = rhs.columnStart_; columnLength_ = rhs.columnLength_; usefulRegion_ = rhs.usefulRegion_; assert (!usefulRegion_); indexRegion_ = rhs.indexRegion_; numberSolutions_ = rhs.numberSolutions_; numberBranchingSolutions_ = rhs.numberBranchingSolutions_; depth_ = rhs.depth_; } return *this; } // Destructor OsiBranchingInformation::~OsiBranchingInformation () { if (owningSolution_) delete[] solution_; } // Default Constructor OsiTwoWayBranchingObject::OsiTwoWayBranchingObject() :OsiBranchingObject() { firstBranch_=0; } // Useful constructor OsiTwoWayBranchingObject::OsiTwoWayBranchingObject (OsiSolverInterface * solver, const OsiObject * object, int way , double value) :OsiBranchingObject(solver,value) { originalObject_ = object; firstBranch_=way; } // Copy constructor OsiTwoWayBranchingObject::OsiTwoWayBranchingObject ( const OsiTwoWayBranchingObject & rhs) :OsiBranchingObject(rhs) { firstBranch_=rhs.firstBranch_; } // Assignment operator OsiTwoWayBranchingObject & OsiTwoWayBranchingObject::operator=( const OsiTwoWayBranchingObject& rhs) { if (this != &rhs) { OsiBranchingObject::operator=(rhs); firstBranch_=rhs.firstBranch_; } return *this; } // Destructor OsiTwoWayBranchingObject::~OsiTwoWayBranchingObject () { } /********* Simple Integers *******************************/ /** Default Constructor Equivalent to an unspecified binary variable. */ OsiSimpleInteger::OsiSimpleInteger () : OsiObject2(), originalLower_(0.0), originalUpper_(1.0), columnNumber_(-1) { } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ OsiSimpleInteger::OsiSimpleInteger (const OsiSolverInterface * solver, int iColumn) : OsiObject2() { columnNumber_ = iColumn ; originalLower_ = solver->getColLower()[columnNumber_] ; originalUpper_ = solver->getColUpper()[columnNumber_] ; } // Useful constructor - passed solver index and original bounds OsiSimpleInteger::OsiSimpleInteger ( int iColumn, double lower, double upper) : OsiObject2() { columnNumber_ = iColumn ; originalLower_ = lower; originalUpper_ = upper; } // Copy constructor OsiSimpleInteger::OsiSimpleInteger ( const OsiSimpleInteger & rhs) :OsiObject2(rhs) { columnNumber_ = rhs.columnNumber_; originalLower_ = rhs.originalLower_; originalUpper_ = rhs.originalUpper_; } // Clone OsiObject * OsiSimpleInteger::clone() const { return new OsiSimpleInteger(*this); } // Assignment operator OsiSimpleInteger & OsiSimpleInteger::operator=( const OsiSimpleInteger& rhs) { if (this!=&rhs) { OsiObject2::operator=(rhs); columnNumber_ = rhs.columnNumber_; originalLower_ = rhs.originalLower_; originalUpper_ = rhs.originalUpper_; } return *this; } // Destructor OsiSimpleInteger::~OsiSimpleInteger () { } /* Reset variable bounds to their original values. Bounds may be tightened, so it may be good to be able to reset them to their original values. */ void OsiSimpleInteger::resetBounds(const OsiSolverInterface * solver) { originalLower_ = solver->getColLower()[columnNumber_] ; originalUpper_ = solver->getColUpper()[columnNumber_] ; } // Redoes data when sequence numbers change void OsiSimpleInteger::resetSequenceEtc(int numberColumns, const int * originalColumns) { int i; for (i=0;isolution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); double nearest = floor(value+(1.0-0.5)); if (nearest>value) { whichWay=1; } else { whichWay=0; } infeasibility_ = fabs(value-nearest); double returnValue = infeasibility_; if (infeasibility_<=info->integerTolerance_) { otherInfeasibility_ = 1.0; returnValue = 0.0; } else if (info->defaultDual_<0.0) { otherInfeasibility_ = 1.0-infeasibility_; } else { const double * pi = info->pi_; const double * activity = info->rowActivity_; const double * lower = info->rowLower_; const double * upper = info->rowUpper_; const double * element = info->elementByColumn_; const int * row = info->row_; const CoinBigIndex * columnStart = info->columnStart_; const int * columnLength = info->columnLength_; double direction = info->direction_; double downMovement = value - floor(value); double upMovement = 1.0-downMovement; double valueP = info->objective_[columnNumber_]*direction; CoinBigIndex start = columnStart[columnNumber_]; CoinBigIndex end = start + columnLength[columnNumber_]; double upEstimate = 0.0; double downEstimate = 0.0; if (valueP>0.0) upEstimate = valueP*upMovement; else downEstimate -= valueP*downMovement; double tolerance = info->primalTolerance_; for (CoinBigIndex j=start;j1.0e20) assert (pi[iRow]>=-1.0e-4); valueP = pi[iRow]*direction; double el2 = element[j]; double value2 = valueP*el2; double u=0.0; double d=0.0; if (value2>0.0) u = value2; else d = -value2; // if up makes infeasible then make at least default double newUp = activity[iRow] + upMovement*el2; if (newUp>upper[iRow]+tolerance||newUpdefaultDual_); upEstimate += u*upMovement; // if down makes infeasible then make at least default double newDown = activity[iRow] - downMovement*el2; if (newDown>upper[iRow]+tolerance||newDowndefaultDual_); downEstimate += d*downMovement; } if (downEstimate>=upEstimate) { infeasibility_ = CoinMax(1.0e-12,upEstimate); otherInfeasibility_ = CoinMax(1.0e-12,downEstimate); whichWay = 1; } else { infeasibility_ = CoinMax(1.0e-12,downEstimate); otherInfeasibility_ = CoinMax(1.0e-12,upEstimate); whichWay = 0; } returnValue = infeasibility_; } if (preferredWay_>=0&&returnValue) whichWay = preferredWay_; whichWay_ = static_cast(whichWay) ; return returnValue; } // This looks at solution and sets bounds to contain solution /** More precisely: it first forces the variable within the existing bounds, and then tightens the bounds to fix the variable at the nearest integer value. */ double OsiSimpleInteger::feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const { double value = info->solution_[columnNumber_]; double newValue = CoinMax(value, info->lower_[columnNumber_]); newValue = CoinMin(newValue, info->upper_[columnNumber_]); newValue = floor(newValue+0.5); solver->setColLower(columnNumber_,newValue); solver->setColUpper(columnNumber_,newValue); return fabs(value-newValue); } /* Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics */ int OsiSimpleInteger::columnNumber() const { return columnNumber_; } // Creates a branching object OsiBranchingObject * OsiSimpleInteger::createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const { double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); assert (info->upper_[columnNumber_]>info->lower_[columnNumber_]); #ifndef NDEBUG double nearest = floor(value+0.5); assert (fabs(value-nearest)>info->integerTolerance_); #endif OsiBranchingObject * branch = new OsiIntegerBranchingObject(solver,this,way, value); return branch; } // Return "down" estimate double OsiSimpleInteger::downEstimate() const { if (whichWay_) return 1.0-infeasibility_; else return infeasibility_; } // Return "up" estimate double OsiSimpleInteger::upEstimate() const { if (!whichWay_) return 1.0-infeasibility_; else return infeasibility_; } // Default Constructor OsiIntegerBranchingObject::OsiIntegerBranchingObject() :OsiTwoWayBranchingObject() { down_[0] = 0.0; down_[1] = 0.0; up_[0] = 0.0; up_[1] = 0.0; } // Useful constructor OsiIntegerBranchingObject::OsiIntegerBranchingObject (OsiSolverInterface * solver, const OsiSimpleInteger * object, int way , double value) :OsiTwoWayBranchingObject(solver,object, way, value) { int iColumn = object->columnNumber(); down_[0] = solver->getColLower()[iColumn]; down_[1] = floor(value_); up_[0] = ceil(value_); up_[1] = solver->getColUpper()[iColumn]; } /* Create a standard floor/ceiling branch object Specifies a simple two-way branch in a more flexible way. One arm of the branch will be lb <= x <= downUpperBound, the other upLowerBound <= x <= ub. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ OsiIntegerBranchingObject::OsiIntegerBranchingObject (OsiSolverInterface * solver, const OsiSimpleInteger * object, int way , double value, double downUpperBound, double upLowerBound) :OsiTwoWayBranchingObject(solver,object, way, value) { int iColumn = object->columnNumber(); down_[0] = solver->getColLower()[iColumn]; down_[1] = downUpperBound; up_[0] = upLowerBound; up_[1] = solver->getColUpper()[iColumn]; } // Copy constructor OsiIntegerBranchingObject::OsiIntegerBranchingObject ( const OsiIntegerBranchingObject & rhs) :OsiTwoWayBranchingObject(rhs) { down_[0] = rhs.down_[0]; down_[1] = rhs.down_[1]; up_[0] = rhs.up_[0]; up_[1] = rhs.up_[1]; } // Assignment operator OsiIntegerBranchingObject & OsiIntegerBranchingObject::operator=( const OsiIntegerBranchingObject& rhs) { if (this != &rhs) { OsiTwoWayBranchingObject::operator=(rhs); down_[0] = rhs.down_[0]; down_[1] = rhs.down_[1]; up_[0] = rhs.up_[0]; up_[1] = rhs.up_[1]; } return *this; } OsiBranchingObject * OsiIntegerBranchingObject::clone() const { return (new OsiIntegerBranchingObject(*this)); } // Destructor OsiIntegerBranchingObject::~OsiIntegerBranchingObject () { } /* Perform a branch by adjusting the bounds of the specified variable. Note that each arm of the branch advances the object to the next arm by advancing the value of branchIndex_. Providing new values for the variable's lower and upper bounds for each branching direction gives a little bit of additional flexibility and will be easily extensible to multi-way branching. Returns change in guessed objective on next branch */ double OsiIntegerBranchingObject::branch(OsiSolverInterface * solver) { const OsiSimpleInteger * obj = dynamic_cast (originalObject_) ; assert (obj); int iColumn = obj->columnNumber(); double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; int way = (!branchIndex_) ? (2*firstBranch_-1) : -(2*firstBranch_-1); if (0) { printf("branching %s on %d bounds %g %g / %g %g\n", (way==-1) ? "down" :"up",iColumn, down_[0],down_[1],up_[0],up_[1]); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); for (int i=0;i<8;i++) printf(" [%d (%g,%g)]",i,lower[i],upper[i]); printf("\n"); } if (way<0) { #ifdef OSI_DEBUG { double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; printf("branching down on var %d: [%g,%g] => [%g,%g]\n", iColumn,olb,oub,down_[0],down_[1]) ; } #endif solver->setColLower(iColumn,down_[0]); solver->setColUpper(iColumn,down_[1]); } else { #ifdef OSI_DEBUG { double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; printf("branching up on var %d: [%g,%g] => [%g,%g]\n", iColumn,olb,oub,up_[0],up_[1]) ; } #endif solver->setColLower(iColumn,up_[0]); solver->setColUpper(iColumn,up_[1]); } double nlb = solver->getColLower()[iColumn]; if (nlbsetColLower(iColumn,olb); } double nub = solver->getColUpper()[iColumn]; if (nub>oub) { #ifndef NDEBUG printf("bad ub change for column %d from %g to %g\n",iColumn,oub,nub); #endif solver->setColUpper(iColumn,oub); } #ifndef NDEBUG if (nlboub-1.0e-8) printf("bad null change for column %d - bounds %g,%g\n",iColumn,olb,oub); #endif branchIndex_++; return 0.0; } // Print what would happen void OsiIntegerBranchingObject::print(const OsiSolverInterface * solver) { const OsiSimpleInteger * obj = dynamic_cast (originalObject_) ; assert (obj); int iColumn = obj->columnNumber(); int way = (!branchIndex_) ? (2*firstBranch_-1) : -(2*firstBranch_-1); if (way<0) { { double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; printf("OsiInteger would branch down on var %d : [%g,%g] => [%g,%g]\n", iColumn,olb,oub,down_[0],down_[1]) ; } } else { { double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; printf("OsiInteger would branch up on var %d : [%g,%g] => [%g,%g]\n", iColumn,olb,oub,up_[0],up_[1]) ; } } } // Default Constructor OsiSOS::OsiSOS () : OsiObject2(), members_(NULL), weights_(NULL), numberMembers_(0), sosType_(-1), integerValued_(false) { } // Useful constructor (which are indices) OsiSOS::OsiSOS (const OsiSolverInterface * , int numberMembers, const int * which, const double * weights, int type) : OsiObject2(), numberMembers_(numberMembers), sosType_(type) { integerValued_ = type==1; // not strictly true - should check problem if (numberMembers_) { members_ = new int[numberMembers_]; weights_ = new double[numberMembers_]; memcpy(members_,which,numberMembers_*sizeof(int)); if (weights) { memcpy(weights_,weights,numberMembers_*sizeof(double)); } else { for (int i=0;i0&&sosType_<3); } // Copy constructor OsiSOS::OsiSOS ( const OsiSOS & rhs) :OsiObject2(rhs) { numberMembers_ = rhs.numberMembers_; sosType_ = rhs.sosType_; integerValued_ = rhs.integerValued_; if (numberMembers_) { members_ = new int[numberMembers_]; weights_ = new double[numberMembers_]; memcpy(members_,rhs.members_,numberMembers_*sizeof(int)); memcpy(weights_,rhs.weights_,numberMembers_*sizeof(double)); } else { members_ = NULL; weights_ = NULL; } } // Clone OsiObject * OsiSOS::clone() const { return new OsiSOS(*this); } // Assignment operator OsiSOS & OsiSOS::operator=( const OsiSOS& rhs) { if (this!=&rhs) { OsiObject2::operator=(rhs); delete [] members_; delete [] weights_; numberMembers_ = rhs.numberMembers_; sosType_ = rhs.sosType_; integerValued_ = rhs.integerValued_; if (numberMembers_) { members_ = new int[numberMembers_]; weights_ = new double[numberMembers_]; memcpy(members_,rhs.members_,numberMembers_*sizeof(int)); memcpy(weights_,rhs.weights_,numberMembers_*sizeof(double)); } else { members_ = NULL; weights_ = NULL; } } return *this; } // Destructor OsiSOS::~OsiSOS () { delete [] members_; delete [] weights_; } // Infeasibility - large is 0.5 double OsiSOS::infeasibility(const OsiBranchingInformation * info,int & whichWay) const { int j; int firstNonZero=-1; int lastNonZero = -1; int firstNonFixed=-1; int lastNonFixed = -1; const double * solution = info->solution_; //const double * lower = info->lower_; const double * upper = info->upper_; //double largestValue=0.0; double integerTolerance = info->integerTolerance_; double primalTolerance = info->primalTolerance_; double weight = 0.0; double sum =0.0; // check bounds etc double lastWeight=-1.0e100; for (j=0;j=weights_[j]-1.0e-12) throw CoinError("Weights too close together in SOS","infeasibility","OsiSOS"); lastWeight = weights_[j]; if (upper[iColumn]) { double value = CoinMax(0.0,solution[iColumn]); if (value>integerTolerance) { // Possibly due to scaling a fixed variable might slip through #ifdef COIN_DEVELOP if (value>upper[iColumn]+10.0*primalTolerance) printf("** Variable %d (%d) has value %g and upper bound of %g\n", iColumn,j,value,upper[iColumn]); #endif if (value>upper[iColumn]) { value=upper[iColumn]; } sum += value; weight += weights_[j]*value; if (firstNonZero<0) firstNonZero=j; lastNonZero=j; } if (firstNonFixed<0) firstNonFixed=j; lastNonFixed=j; } } whichWay=1; whichWay_=1; if (lastNonZero-firstNonZero>=sosType_) { // find where to branch assert (sum>0.0); // probably best to use pseudo duals double value = lastNonZero-firstNonZero+1; value *= 0.5/static_cast (numberMembers_); infeasibility_=value; otherInfeasibility_=1.0-value; if (info->defaultDual_>=0.0) { // Using pseudo shadow prices weight /= sum; int iWhere; for (iWhere=firstNonZero;iWhere=weights_[iWhere+1]-weight) lastDown++; // But make sure OK if (lastDown==firstNonFixed) { lastDown ++; } else if (lastDown==lastNonFixed) { lastDown --; } firstUp=lastDown; } // Now get current contribution and compute weight for end points double weightDown = 0.0; double weightUp = 0.0; const double * element = info->elementByColumn_; const int * row = info->row_; const CoinBigIndex * columnStart = info->columnStart_; const int * columnLength = info->columnLength_; double direction = info->direction_; const double * objective = info->objective_; // Compute where we would move to double objValue=0.0; double * useful = info->usefulRegion_; int * index = info->indexRegion_; int n=0; for (j=firstNonZero;j<=lastNonZero;j++) { int iColumn = members_[j]; double multiplier = solution[iColumn]; if (j>=lastDown) weightDown += multiplier; if (j<=firstUp) weightUp += multiplier; if (multiplier>0.0) { objValue += objective[iColumn]*multiplier; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j=start;jpi_; const double * activity = info->rowActivity_; const double * lower = info->rowLower_; const double * upper = info->rowUpper_; int numberRows = info->solver_->getNumRows(); double * useful2 = useful+numberRows; int * index2 = index+numberRows; for (int i=0;i<2;i++) { double obj=0.0; int n2=0; for (j=startX[i];j<=endX[i];j++) { int iColumn = members_[j]; double multiplier = solution[iColumn]; if (iColumn==check[i]) multiplier=fakeSolution[i]; if (multiplier>0.0) { obj += objective[iColumn]*multiplier; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j=start;j0.0) ? obj : 0.0; for (j=0;j1.0e20) assert (valueP>=-1.0e-4); double value2 = valueP*movement; double thisEstimate = (value2>0.0) ? value2 : 0; // if makes infeasible then make at least default double newValue = activity[iRow] + movement; if (newValue>upper[iRow]+primalTolerance||newValuedefaultDual_); estimate += thisEstimate; } for (j=0;j1.0e20) assert (valueP>=-1.0e-4); double value2 = valueP*movement; double thisEstimate = (value2>0.0) ? value2 : 0; // if makes infeasible then make at least default double newValue = activity[iRow] + movement; if (newValue>upper[iRow]+primalTolerance||newValuedefaultDual_); estimate += thisEstimate; } } // store in fakeSolution fakeSolution[i]=estimate; } double downEstimate = fakeSolution[0]; double upEstimate = fakeSolution[1]; if (downEstimate>=upEstimate) { infeasibility_ = CoinMax(1.0e-12,upEstimate); otherInfeasibility_ = CoinMax(1.0e-12,downEstimate); whichWay = 1; } else { infeasibility_ = CoinMax(1.0e-12,downEstimate); otherInfeasibility_ = CoinMax(1.0e-12,upEstimate); whichWay = 0; } whichWay_=static_cast(whichWay); value=infeasibility_; } return value; } else { infeasibility_=0.0; otherInfeasibility_=1.0; return 0.0; // satisfied } } // This looks at solution and sets bounds to contain solution double OsiSOS::feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const { int j; int firstNonZero=-1; int lastNonZero = -1; const double * solution = info->solution_; //const double * lower = info->lower_; const double * upper = info->upper_; double sum =0.0; // Find largest one or pair double movement=0.0; if (sosType_==1) { for (j=0;jsum&&upper[iColumn]) { firstNonZero=j; sum=value; } } lastNonZero=firstNonZero; } else { // type 2 for (j=1;jsum) { if (upper[iColumn]||upper[jColumn]) { firstNonZero=upper[jColumn] ? j-1 : j; lastNonZero=upper[iColumn] ? j : j-1; sum=value; } } } } for (j=0;jlastNonZero) { int iColumn = members_[j]; double value = CoinMax(0.0,solution[iColumn]); movement += value; solver->setColUpper(iColumn,0.0); } } return movement; } // Redoes data when sequence numbers change void OsiSOS::resetSequenceEtc(int numberColumns, const int * originalColumns) { int n2=0; for (int j=0;jsolution_; double tolerance = info->primalTolerance_; const double * upper = info->upper_; int firstNonFixed=-1; int lastNonFixed=-1; int firstNonZero=-1; int lastNonZero = -1; double weight = 0.0; double sum =0.0; for (j=0;jtolerance) { weight += weights_[j]*value; if (firstNonZero<0) firstNonZero=j; lastNonZero=j; } } } assert (lastNonZero-firstNonZero>=sosType_) ; // find where to branch assert (sum>0.0); weight /= sum; int iWhere; double separator=0.0; for (iWhere=firstNonZero;iWhere(originalObject_) ; assert (set); int way = (!branchIndex_) ? (2*firstBranch_-1) : -(2*firstBranch_-1); branchIndex_++; int numberMembers = set->numberMembers(); const int * which = set->members(); const double * weights = set->weights(); //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); // *** for way - up means fix all those in down section if (way<0) { int i; for ( i=0;i value_) break; } assert (isetColUpper(which[i],0.0); } else { int i; for ( i=0;i= value_) break; else solver->setColUpper(which[i],0.0); } assert (i(originalObject_) ; assert (set); int way = (!branchIndex_) ? (2*firstBranch_-1) : -(2*firstBranch_-1); int numberMembers = set->numberMembers(); const int * which = set->members(); const double * weights = set->weights(); //const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); int first=numberMembers; int last=-1; int numberFixed=0; int numberOther=0; int i; for ( i=0;i value_) break; else if (bound) numberOther++; } assert (i= value_) break; else if (bound) numberFixed++; } assert (i %d (%g), %d would be fixed, %d other way\n", value_,which[first],weights[first],which[last],weights[last],numberFixed,numberOther); } /** Default Constructor */ OsiLotsize::OsiLotsize () : OsiObject2(), columnNumber_(-1), rangeType_(0), numberRanges_(0), largestGap_(0), bound_(NULL), range_(0) { } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ OsiLotsize::OsiLotsize (const OsiSolverInterface * , int iColumn, int numberPoints, const double * points, bool range) : OsiObject2() { assert (numberPoints>0); columnNumber_ = iColumn ; // sort ranges int * sort = new int[numberPoints]; double * weight = new double [numberPoints]; int i; if (range) { rangeType_=2; } else { rangeType_=1; } for (i=0;i=bound_[0]); for (i=1;i=thisLo); if (thisLo>hi) { bound_[2*numberRanges_]=thisLo; bound_[2*numberRanges_+1]=thisHi; numberRanges_++; hi=thisHi; } else { //overlap hi=CoinMax(hi,thisHi); bound_[2*numberRanges_-1]=hi; } } // and for safety bound_[2*numberRanges_]=bound_[2*numberRanges_-2]; bound_[2*numberRanges_+1]=bound_[2*numberRanges_-1]; for (i=1;i0&&rangeType_<3); bound_= new double [(numberRanges_+1)*rangeType_]; memcpy(bound_,rhs.bound_,(numberRanges_+1)*rangeType_*sizeof(double)); } else { bound_=NULL; } } // Clone OsiObject * OsiLotsize::clone() const { return new OsiLotsize(*this); } // Assignment operator OsiLotsize & OsiLotsize::operator=( const OsiLotsize& rhs) { if (this!=&rhs) { OsiObject2::operator=(rhs); columnNumber_ = rhs.columnNumber_; rangeType_ = rhs.rangeType_; numberRanges_ = rhs.numberRanges_; largestGap_ = rhs.largestGap_; delete [] bound_; range_ = rhs.range_; if (numberRanges_) { assert (rangeType_>0&&rangeType_<3); bound_= new double [(numberRanges_+1)*rangeType_]; memcpy(bound_,rhs.bound_,(numberRanges_+1)*rangeType_*sizeof(double)); } else { bound_=NULL; } } return *this; } // Destructor OsiLotsize::~OsiLotsize () { delete [] bound_; } /* Finds range of interest so value is feasible in range range_ or infeasible between hi[range_] and lo[range_+1]. Returns true if feasible. */ bool OsiLotsize::findRange(double value, double integerTolerance) const { assert (range_>=0&&range_bound_[iLo]-integerTolerance&&valuebound_[iHi]-integerTolerance&&value>1; } //points while (!found) { if (value=bound_[range_-1]) { // found range_--; break; } else { iHi = range_; } } else { if (value>1; } if (value-bound_[range_]<=bound_[range_+1]-value) { infeasibility = value-bound_[range_]; } else { infeasibility = bound_[range_+1]-value; if (infeasibilitybound_[2*iLo]-integerTolerance&&value=bound_[2*iHi]-integerTolerance) { range_=iHi; found=true; } else { range_ = (iLo+iHi)>>1; } //points while (!found) { if (value=bound_[2*range_-2]) { // found range_--; break; } else { iHi = range_; } } else { if (value>1; } if (value>=bound_[2*range_]-integerTolerance&&value<=bound_[2*range_+1]+integerTolerance) infeasibility=0.0; else if (value-bound_[2*range_+1]fabs(value-ceilingLotsize)) { floorLotsize=bound_[range_+1]; ceilingLotsize=bound_[range_+2]; } } else { // ranges assert (value>=bound_[2*range_+1]); floorLotsize=bound_[2*range_+1]; ceilingLotsize=bound_[2*range_+2]; } } // Infeasibility - large is 0.5 double OsiLotsize::infeasibility(const OsiBranchingInformation * info, int & preferredWay) const { const double * solution = info->solution_; const double * lower = info->lower_; const double * upper = info->upper_; double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); double integerTolerance = info->integerTolerance_; /*printf("%d %g %g %g %g\n",columnNumber_,value,lower[columnNumber_], solution[columnNumber_],upper[columnNumber_]);*/ assert (value>=bound_[0]-integerTolerance &&value<=bound_[rangeType_*numberRanges_-1]+integerTolerance); infeasibility_=0.0; bool feasible = findRange(value,integerTolerance); if (!feasible) { if (rangeType_==1) { if (value-bound_[range_]= 0 Used by heuristics */ int OsiLotsize::columnNumber() const { return columnNumber_; } /* Set bounds to contain the current solution. More precisely, for the variable associated with this object, take the value given in the current solution, force it within the current bounds if required, then set the bounds to fix the variable at the integer nearest the solution value. Returns amount it had to move variable. */ double OsiLotsize::feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const { const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * solution = info->solution_; double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); findRange(value,info->integerTolerance_); double nearest; if (rangeType_==1) { nearest = bound_[range_]; solver->setColLower(columnNumber_,nearest); solver->setColUpper(columnNumber_,nearest); } else { // ranges solver->setColLower(columnNumber_,bound_[2*range_]); solver->setColUpper(columnNumber_,bound_[2*range_+1]); if (value>bound_[2*range_+1]) nearest=bound_[2*range_+1]; else if (valueintegerTolerance_); #endif return fabs(value-nearest); } // Creates a branching object // Creates a branching object OsiBranchingObject * OsiLotsize::createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const { const double * solution = info->solution_; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); assert (!findRange(value,info->integerTolerance_)); return new OsiLotsizeBranchingObject(solver,this,way, value); } /* Bounds may be tightened, so it may be good to be able to refresh the local copy of the original bounds. */ void OsiLotsize::resetBounds(const OsiSolverInterface * ) { } // Return "down" estimate double OsiLotsize::downEstimate() const { if (whichWay_) return otherInfeasibility_; else return infeasibility_; } // Return "up" estimate double OsiLotsize::upEstimate() const { if (!whichWay_) return otherInfeasibility_; else return infeasibility_; } // Redoes data when sequence numbers change void OsiLotsize::resetSequenceEtc(int numberColumns, const int * originalColumns) { int i; for (i=0;icolumnNumber(); down_[0] = solver->getColLower()[iColumn]; double integerTolerance = solver->getIntegerTolerance(); originalObject->floorCeiling(down_[1],up_[0],value,integerTolerance); up_[1] = solver->getColUpper()[iColumn]; } // Copy constructor OsiLotsizeBranchingObject::OsiLotsizeBranchingObject ( const OsiLotsizeBranchingObject & rhs) :OsiTwoWayBranchingObject(rhs) { down_[0] = rhs.down_[0]; down_[1] = rhs.down_[1]; up_[0] = rhs.up_[0]; up_[1] = rhs.up_[1]; } // Assignment operator OsiLotsizeBranchingObject & OsiLotsizeBranchingObject::operator=( const OsiLotsizeBranchingObject& rhs) { if (this != &rhs) { OsiTwoWayBranchingObject::operator=(rhs); down_[0] = rhs.down_[0]; down_[1] = rhs.down_[1]; up_[0] = rhs.up_[0]; up_[1] = rhs.up_[1]; } return *this; } OsiBranchingObject * OsiLotsizeBranchingObject::clone() const { return (new OsiLotsizeBranchingObject(*this)); } // Destructor OsiLotsizeBranchingObject::~OsiLotsizeBranchingObject () { } /* Perform a branch by adjusting the bounds of the specified variable. Note that each arm of the branch advances the object to the next arm by advancing the value of way_. Providing new values for the variable's lower and upper bounds for each branching direction gives a little bit of additional flexibility and will be easily extensible to multi-way branching. */ double OsiLotsizeBranchingObject::branch(OsiSolverInterface * solver) { const OsiLotsize * obj = dynamic_cast (originalObject_) ; assert (obj); int iColumn = obj->columnNumber(); int way = (!branchIndex_) ? (2*firstBranch_-1) : -(2*firstBranch_-1); if (way<0) { #ifdef OSI_DEBUG { double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; printf("branching down on var %d: [%g,%g] => [%g,%g]\n", iColumn,olb,oub,down_[0],down_[1]) ; } #endif solver->setColLower(iColumn,down_[0]); solver->setColUpper(iColumn,down_[1]); } else { #ifdef OSI_DEBUG { double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; printf("branching up on var %d: [%g,%g] => [%g,%g]\n", iColumn,olb,oub,up_[0],up_[1]) ; } #endif solver->setColLower(iColumn,up_[0]); solver->setColUpper(iColumn,up_[1]); } branchIndex_++; return 0.0; } // Print void OsiLotsizeBranchingObject::print(const OsiSolverInterface * solver) { const OsiLotsize * obj = dynamic_cast (originalObject_) ; assert (obj); int iColumn = obj->columnNumber(); int way = (!branchIndex_) ? (2*firstBranch_-1) : -(2*firstBranch_-1); if (way<0) { { double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; printf("branching down on var %d: [%g,%g] => [%g,%g]\n", iColumn,olb,oub,down_[0],down_[1]) ; } } else { { double olb,oub ; olb = solver->getColLower()[iColumn] ; oub = solver->getColUpper()[iColumn] ; printf("branching up on var %d: [%g,%g] => [%g,%g]\n", iColumn,olb,oub,up_[0],up_[1]) ; } } } CoinMP-1.8.3/Osi/src/Osi/OsiChooseVariable.hpp0000644000175000017500000004552612101340333017443 0ustar renerene// Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiChooseVariable_H #define OsiChooseVariable_H #include #include #include "CoinWarmStartBasis.hpp" #include "OsiBranchingObject.hpp" class OsiSolverInterface; class OsiHotInfo; /** This class chooses a variable to branch on The base class just chooses the variable and direction without strong branching but it has information which would normally be used by strong branching e.g. to re-enter having fixed a variable but using same candidates for strong branching. The flow is : a) initialize the process. This decides on strong branching list and stores indices of all infeasible objects b) do strong branching on list. If list is empty then just choose one candidate and return without strong branching. If not empty then go through list and return best. However we may find that the node is infeasible or that we can fix a variable. If so we return and it is up to user to call again (after fixing a variable). */ class OsiChooseVariable { public: /// Default Constructor OsiChooseVariable (); /// Constructor from solver (so we can set up arrays etc) OsiChooseVariable (const OsiSolverInterface * solver); /// Copy constructor OsiChooseVariable (const OsiChooseVariable &); /// Assignment operator OsiChooseVariable & operator= (const OsiChooseVariable& rhs); /// Clone virtual OsiChooseVariable * clone() const; /// Destructor virtual ~OsiChooseVariable (); /** Sets up strong list and clears all if initialize is true. Returns number of infeasibilities. If returns -1 then has worked out node is infeasible! */ virtual int setupList ( OsiBranchingInformation *info, bool initialize); /** Choose a variable Returns - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from bestObjectIndex() and bestWhichWay() We can pick up a forced branch (can change bound) from firstForcedObjectIndex() and firstForcedWhichWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution() If fixVariables is true then 2,3,4 are all really same as problem changed */ virtual int chooseVariable( OsiSolverInterface * solver, OsiBranchingInformation *info, bool fixVariables); /// Returns true if solution looks feasible against given objects virtual bool feasibleSolution(const OsiBranchingInformation * info, const double * solution, int numberObjects, const OsiObject ** objects); /// Saves a good solution void saveSolution(const OsiSolverInterface * solver); /// Clears out good solution after use void clearGoodSolution(); /// Given a candidate fill in useful information e.g. estimates virtual void updateInformation( const OsiBranchingInformation *info, int branch, OsiHotInfo * hotInfo); #if 1 /// Given a branch fill in useful information e.g. estimates virtual void updateInformation( int whichObject, int branch, double changeInObjective, double changeInValue, int status); #endif /// Objective value for feasible solution inline double goodObjectiveValue() const { return goodObjectiveValue_;} /// Estimate of up change or change on chosen if n-way inline double upChange() const { return upChange_;} /// Estimate of down change or max change on other possibilities if n-way inline double downChange() const { return downChange_;} /// Good solution - deleted by finalize inline const double * goodSolution() const { return goodSolution_;} /// Index of chosen object inline int bestObjectIndex() const { return bestObjectIndex_;} /// Set index of chosen object inline void setBestObjectIndex(int value) { bestObjectIndex_ = value;} /// Preferred way of chosen object inline int bestWhichWay() const { return bestWhichWay_;} /// Set preferred way of chosen object inline void setBestWhichWay(int value) { bestWhichWay_ = value;} /// Index of forced object inline int firstForcedObjectIndex() const { return firstForcedObjectIndex_;} /// Set index of forced object inline void setFirstForcedObjectIndex(int value) { firstForcedObjectIndex_ = value;} /// Preferred way of forced object inline int firstForcedWhichWay() const { return firstForcedWhichWay_;} /// Set preferred way of forced object inline void setFirstForcedWhichWay(int value) { firstForcedWhichWay_ = value;} /// Get the number of objects unsatisfied at this node - accurate on first pass inline int numberUnsatisfied() const {return numberUnsatisfied_;} /// Number of objects to choose for strong branching inline int numberStrong() const { return numberStrong_;} /// Set number of objects to choose for strong branching inline void setNumberStrong(int value) { numberStrong_ = value;} /// Number left on strong list inline int numberOnList() const { return numberOnList_;} /// Number of strong branches actually done inline int numberStrongDone() const { return numberStrongDone_;} /// Number of strong iterations actually done inline int numberStrongIterations() const { return numberStrongIterations_;} /// Number of strong branches which changed bounds inline int numberStrongFixed() const { return numberStrongFixed_;} /// List of candidates inline const int * candidates() const { return list_;} /// Trust results from strong branching for changing bounds inline bool trustStrongForBound() const { return trustStrongForBound_;} /// Set trust results from strong branching for changing bounds inline void setTrustStrongForBound(bool yesNo) { trustStrongForBound_ = yesNo;} /// Trust results from strong branching for valid solution inline bool trustStrongForSolution() const { return trustStrongForSolution_;} /// Set trust results from strong branching for valid solution inline void setTrustStrongForSolution(bool yesNo) { trustStrongForSolution_ = yesNo;} /// Set solver and redo arrays void setSolver (const OsiSolverInterface * solver); /** Return status - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from bestObjectIndex() and bestWhichWay() We can pick up a forced branch (can change bound) from firstForcedObjectIndex() and firstForcedWhichWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution() */ inline int status() const { return status_;} inline void setStatus(int value) { status_ = value;} protected: // Data /// Objective value for feasible solution double goodObjectiveValue_; /// Estimate of up change or change on chosen if n-way double upChange_; /// Estimate of down change or max change on other possibilities if n-way double downChange_; /// Good solution - deleted by finalize double * goodSolution_; /// List of candidates int * list_; /// Useful array (for sorting etc) double * useful_; /// Pointer to solver const OsiSolverInterface * solver_; /* Status - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates */ int status_; /// Index of chosen object int bestObjectIndex_; /// Preferred way of chosen object int bestWhichWay_; /// Index of forced object int firstForcedObjectIndex_; /// Preferred way of forced object int firstForcedWhichWay_; /// The number of objects unsatisfied at this node. int numberUnsatisfied_; /// Number of objects to choose for strong branching int numberStrong_; /// Number left on strong list int numberOnList_; /// Number of strong branches actually done int numberStrongDone_; /// Number of strong iterations actually done int numberStrongIterations_; /// Number of bound changes due to strong branching int numberStrongFixed_; /// List of unsatisfied objects - first numberOnList_ for strong branching /// Trust results from strong branching for changing bounds bool trustStrongForBound_; /// Trust results from strong branching for valid solution bool trustStrongForSolution_; }; /** This class is the placeholder for the pseudocosts used by OsiChooseStrong. It can also be used by any other pseudocost based strong branching algorithm. */ class OsiPseudoCosts { protected: // Data /// Total of all changes up double * upTotalChange_; /// Total of all changes down double * downTotalChange_; /// Number of times up int * upNumber_; /// Number of times down int * downNumber_; /// Number of objects (could be found from solver) int numberObjects_; /// Number before we trust int numberBeforeTrusted_; private: void gutsOfDelete(); void gutsOfCopy(const OsiPseudoCosts& rhs); public: OsiPseudoCosts(); virtual ~OsiPseudoCosts(); OsiPseudoCosts(const OsiPseudoCosts& rhs); OsiPseudoCosts& operator=(const OsiPseudoCosts& rhs); /// Number of times before trusted inline int numberBeforeTrusted() const { return numberBeforeTrusted_; } /// Set number of times before trusted inline void setNumberBeforeTrusted(int value) { numberBeforeTrusted_ = value; } /// Initialize the pseudocosts with n entries void initialize(int n); /// Give the number of objects for which pseudo costs are stored inline int numberObjects() const { return numberObjects_; } /** @name Accessor methods to pseudo costs data */ //@{ inline double* upTotalChange() { return upTotalChange_; } inline const double* upTotalChange() const { return upTotalChange_; } inline double* downTotalChange() { return downTotalChange_; } inline const double* downTotalChange() const { return downTotalChange_; } inline int* upNumber() { return upNumber_; } inline const int* upNumber() const { return upNumber_; } inline int* downNumber() { return downNumber_; } inline const int* downNumber() const { return downNumber_; } //@} /// Given a candidate fill in useful information e.g. estimates virtual void updateInformation(const OsiBranchingInformation *info, int branch, OsiHotInfo * hotInfo); #if 1 /// Given a branch fill in useful information e.g. estimates virtual void updateInformation( int whichObject, int branch, double changeInObjective, double changeInValue, int status); #endif }; /** This class chooses a variable to branch on This chooses the variable and direction with reliability strong branching. The flow is : a) initialize the process. This decides on strong branching list and stores indices of all infeasible objects b) do strong branching on list. If list is empty then just choose one candidate and return without strong branching. If not empty then go through list and return best. However we may find that the node is infeasible or that we can fix a variable. If so we return and it is up to user to call again (after fixing a variable). */ class OsiChooseStrong : public OsiChooseVariable { public: /// Default Constructor OsiChooseStrong (); /// Constructor from solver (so we can set up arrays etc) OsiChooseStrong (const OsiSolverInterface * solver); /// Copy constructor OsiChooseStrong (const OsiChooseStrong &); /// Assignment operator OsiChooseStrong & operator= (const OsiChooseStrong& rhs); /// Clone virtual OsiChooseVariable * clone() const; /// Destructor virtual ~OsiChooseStrong (); /** Sets up strong list and clears all if initialize is true. Returns number of infeasibilities. If returns -1 then has worked out node is infeasible! */ virtual int setupList ( OsiBranchingInformation *info, bool initialize); /** Choose a variable Returns - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from bestObjectIndex() and bestWhichWay() We can pick up a forced branch (can change bound) from firstForcedObjectIndex() and firstForcedWhichWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution() If fixVariables is true then 2,3,4 are all really same as problem changed */ virtual int chooseVariable( OsiSolverInterface * solver, OsiBranchingInformation *info, bool fixVariables); /** Pseudo Shadow Price mode 0 - off 1 - use if no strong info 2 - use if strong not trusted 3 - use even if trusted */ inline int shadowPriceMode() const { return shadowPriceMode_;} /// Set Shadow price mode inline void setShadowPriceMode(int value) { shadowPriceMode_ = value;} /** Accessor method to pseudo cost object*/ const OsiPseudoCosts& pseudoCosts() const { return pseudoCosts_; } /** Accessor method to pseudo cost object*/ OsiPseudoCosts& pseudoCosts() { return pseudoCosts_; } /** A feww pass-through methods to access members of pseudoCosts_ as if they were members of OsiChooseStrong object */ inline int numberBeforeTrusted() const { return pseudoCosts_.numberBeforeTrusted(); } inline void setNumberBeforeTrusted(int value) { pseudoCosts_.setNumberBeforeTrusted(value); } inline int numberObjects() const { return pseudoCosts_.numberObjects(); } protected: /** This is a utility function which does strong branching on a list of objects and stores the results in OsiHotInfo.objects. On entry the object sequence is stored in the OsiHotInfo object and maybe more. It returns - -1 - one branch was infeasible both ways 0 - all inspected - nothing can be fixed 1 - all inspected - some can be fixed (returnCriterion==0) 2 - may be returning early - one can be fixed (last one done) (returnCriterion==1) 3 - returning because max time */ int doStrongBranching( OsiSolverInterface * solver, OsiBranchingInformation *info, int numberToDo, int returnCriterion); /** Clear out the results array */ void resetResults(int num); protected: /** Pseudo Shadow Price mode 0 - off 1 - use and multiply by strong info 2 - use */ int shadowPriceMode_; /** The pseudo costs for the chooser */ OsiPseudoCosts pseudoCosts_; /** The results of the strong branching done on the candidates where the pseudocosts were not sufficient */ OsiHotInfo* results_; /** The number of OsiHotInfo objetcs that contain information */ int numResults_; }; /** This class contains the result of strong branching on a variable When created it stores enough information for strong branching */ class OsiHotInfo { public: /// Default Constructor OsiHotInfo (); /// Constructor from useful information OsiHotInfo ( OsiSolverInterface * solver, const OsiBranchingInformation *info, const OsiObject * const * objects, int whichObject); /// Copy constructor OsiHotInfo (const OsiHotInfo &); /// Assignment operator OsiHotInfo & operator= (const OsiHotInfo& rhs); /// Clone virtual OsiHotInfo * clone() const; /// Destructor virtual ~OsiHotInfo (); /** Fill in useful information after strong branch. Return status */ int updateInformation( const OsiSolverInterface * solver, const OsiBranchingInformation * info, OsiChooseVariable * choose); /// Original objective value inline double originalObjectiveValue() const { return originalObjectiveValue_;} /// Up change - invalid if n-way inline double upChange() const { assert (branchingObject_->numberBranches()==2); return changes_[1];} /// Down change - invalid if n-way inline double downChange() const { assert (branchingObject_->numberBranches()==2); return changes_[0];} /// Set up change - invalid if n-way inline void setUpChange(double value) { assert (branchingObject_->numberBranches()==2); changes_[1] = value;} /// Set down change - invalid if n-way inline void setDownChange(double value) { assert (branchingObject_->numberBranches()==2); changes_[0] = value;} /// Change on way k inline double change(int k) const { return changes_[k];} /// Up iteration count - invalid if n-way inline int upIterationCount() const { assert (branchingObject_->numberBranches()==2); return iterationCounts_[1];} /// Down iteration count - invalid if n-way inline int downIterationCount() const { assert (branchingObject_->numberBranches()==2); return iterationCounts_[0];} /// Iteration count on way k inline int iterationCount(int k) const { return iterationCounts_[k];} /// Up status - invalid if n-way inline int upStatus() const { assert (branchingObject_->numberBranches()==2); return statuses_[1];} /// Down status - invalid if n-way inline int downStatus() const { assert (branchingObject_->numberBranches()==2); return statuses_[0];} /// Set up status - invalid if n-way inline void setUpStatus(int value) { assert (branchingObject_->numberBranches()==2); statuses_[1] = value;} /// Set down status - invalid if n-way inline void setDownStatus(int value) { assert (branchingObject_->numberBranches()==2); statuses_[0] = value;} /// Status on way k inline int status(int k) const { return statuses_[k];} /// Branching object inline OsiBranchingObject * branchingObject() const { return branchingObject_;} inline int whichObject() const { return whichObject_;} protected: // Data /// Original objective value double originalObjectiveValue_; /// Objective changes double * changes_; /// Iteration counts int * iterationCounts_; /** Status -1 - not done 0 - feasible and finished 1 - infeasible 2 - not finished */ int * statuses_; /// Branching object OsiBranchingObject * branchingObject_; /// Which object on list int whichObject_; }; #endif CoinMP-1.8.3/Osi/src/Osi/OsiCuts.cpp0000644000175000017500000002272011510425067015470 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "OsiCuts.hpp" //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiCuts::OsiCuts () : rowCutPtrs_(), colCutPtrs_() { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiCuts::OsiCuts (const OsiCuts & source) : rowCutPtrs_(), colCutPtrs_() { gutsOfCopy( source ); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiCuts::~OsiCuts () { gutsOfDestructor(); } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiCuts & OsiCuts::operator=(const OsiCuts& rhs) { if (this != &rhs) { gutsOfDestructor(); gutsOfCopy( rhs ); } return *this; } //------------------------------------------------------------------- void OsiCuts::gutsOfCopy(const OsiCuts& source) { assert( sizeRowCuts()==0 ); assert( sizeColCuts()==0 ); assert( sizeCuts()==0 ); int i; int ne = source.sizeRowCuts(); for (i=0; i(rowCutPtrs_.size()); for (i=0; igloballyValidAsInteger()!=2) delete rowCutPtrs_[i]; } rowCutPtrs_.clear(); ne = static_cast(colCutPtrs_.size()); for (i=0; igloballyValidAsInteger()!=2) delete colCutPtrs_[i]; } colCutPtrs_.clear(); assert( sizeRowCuts()==0 ); assert( sizeColCuts()==0 ); assert( sizeCuts() ==0 ); } //------------------------------------------------------------ // // Embedded iterator class implementation // //------------------------------------------------------------ OsiCuts::iterator::iterator(OsiCuts& cuts) : cuts_(cuts), rowCutIndex_(-1), colCutIndex_(-1), cutP_(NULL) { this->operator++(); } OsiCuts::iterator::iterator(const OsiCuts::iterator &src) : cuts_(src.cuts_), rowCutIndex_(src.rowCutIndex_), colCutIndex_(src.colCutIndex_), cutP_(src.cutP_) { // nothing to do here } OsiCuts::iterator & OsiCuts::iterator::operator=(const OsiCuts::iterator &rhs) { if (this != &rhs) { cuts_=rhs.cuts_; rowCutIndex_=rhs.rowCutIndex_; colCutIndex_=rhs.colCutIndex_; cutP_=rhs.cutP_; } return *this; } OsiCuts::iterator::~iterator() { //nothing to do } OsiCuts::iterator OsiCuts::iterator::begin() { rowCutIndex_=-1; colCutIndex_=-1; this->operator++(); return *this; } OsiCuts::iterator OsiCuts::iterator::end() { rowCutIndex_=cuts_.sizeRowCuts(); colCutIndex_=cuts_.sizeColCuts()-1; cutP_=NULL; return *this; } OsiCuts::iterator OsiCuts::iterator::operator++() { cutP_ = NULL; // Are there any more row cuts to consider? if ( (rowCutIndex_+1)>=cuts_.sizeRowCuts() ) { // Only column cuts left. colCutIndex_++; // Only update cutP if there is a column cut. // This is necessary for the iterator to work for // OsiCuts that don't have any cuts. if ( cuts_.sizeColCuts() > 0 && colCutIndex_=cuts_.sizeColCuts() ) { // Only row cuts left rowCutIndex_++; if ( rowCutIndex_nextRowCutE ) { colCutIndex_++; cutP_=cuts_.colCutPtr(colCutIndex_); } else { rowCutIndex_++; cutP_=cuts_.rowCutPtr(rowCutIndex_); } } return *this; } //------------------------------------------------------------ // // Embedded const_iterator class implementation // //------------------------------------------------------------ OsiCuts::const_iterator::const_iterator(const OsiCuts& cuts) : cutsPtr_(&cuts), rowCutIndex_(-1), colCutIndex_(-1), cutP_(NULL) { this->operator++(); } OsiCuts::const_iterator::const_iterator(const OsiCuts::const_iterator &src) : cutsPtr_(src.cutsPtr_), rowCutIndex_(src.rowCutIndex_), colCutIndex_(src.colCutIndex_), cutP_(src.cutP_) { // nothing to do here } OsiCuts::const_iterator & OsiCuts::const_iterator::operator=(const OsiCuts::const_iterator &rhs) { if (this != &rhs) { cutsPtr_=rhs.cutsPtr_; rowCutIndex_=rhs.rowCutIndex_; colCutIndex_=rhs.colCutIndex_; cutP_=rhs.cutP_; } return *this; } OsiCuts::const_iterator::~const_iterator() { //nothing to do } OsiCuts::const_iterator OsiCuts::const_iterator::begin() { rowCutIndex_=-1; colCutIndex_=-1; this->operator++(); return *this; } OsiCuts::const_iterator OsiCuts::const_iterator::end() { rowCutIndex_=cutsPtr_->sizeRowCuts(); colCutIndex_=cutsPtr_->sizeColCuts()-1; cutP_=NULL; return *this; } OsiCuts::const_iterator OsiCuts::const_iterator::operator++() { cutP_ = NULL; // Are there any more row cuts to consider? if ( (rowCutIndex_+1)>=cutsPtr_->sizeRowCuts() ) { // Only column cuts left. colCutIndex_++; // Only update cutP if there is a column cut. // This is necessary for the iterator to work for // OsiCuts that don't have any cuts. if ( cutsPtr_->sizeRowCuts() > 0 && colCutIndex_sizeColCuts() ) cutP_= cutsPtr_->colCutPtr(colCutIndex_); } // Are there any more col cuts to consider? else if ( (colCutIndex_+1)>=cutsPtr_->sizeColCuts() ) { // Only row cuts left rowCutIndex_++; if ( rowCutIndex_sizeRowCuts() ) cutP_= cutsPtr_->rowCutPtr(rowCutIndex_); } // There are still Row & column cuts left to consider else { double nextColCutE=cutsPtr_->colCut(colCutIndex_+1).effectiveness(); double nextRowCutE=cutsPtr_->rowCut(rowCutIndex_+1).effectiveness(); if ( nextColCutE>nextRowCutE ) { colCutIndex_++; cutP_=cutsPtr_->colCutPtr(colCutIndex_); } else { rowCutIndex_++; cutP_=cutsPtr_->rowCutPtr(rowCutIndex_); } } return *this; } /* Insert a row cut unless it is a duplicate (CoinAbsFltEq)*/ void OsiCuts::insertIfNotDuplicate( OsiRowCut & rc , CoinAbsFltEq treatAsSame) { double newLb = rc.lb(); double newUb = rc.ub(); CoinPackedVector vector = rc.row(); int numberElements =vector.getNumElements(); int * newIndices = vector.getIndices(); double * newElements = vector.getElements(); CoinSort_2(newIndices,newIndices+numberElements,newElements); bool notDuplicate=true; int numberRowCuts = sizeRowCuts(); for ( int i =0; irow().getNumElements()!=numberElements) continue; if (!treatAsSame(cutPtr->lb(),newLb)) continue; if (!treatAsSame(cutPtr->ub(),newUb)) continue; const CoinPackedVector * thisVector = &(cutPtr->row()); const int * indices = thisVector->getIndices(); const double * elements = thisVector->getElements(); int j; for(j=0;jsetLb(newLb); newCutPtr->setUb(newUb); newCutPtr->setRow(vector); rowCutPtrs_.push_back(newCutPtr); } } /* Insert a row cut unless it is a duplicate (CoinRelFltEq)*/ void OsiCuts::insertIfNotDuplicate( OsiRowCut & rc , CoinRelFltEq treatAsSame) { double newLb = rc.lb(); double newUb = rc.ub(); CoinPackedVector vector = rc.row(); int numberElements =vector.getNumElements(); int * newIndices = vector.getIndices(); double * newElements = vector.getElements(); CoinSort_2(newIndices,newIndices+numberElements,newElements); bool notDuplicate=true; int numberRowCuts = sizeRowCuts(); for ( int i =0; irow().getNumElements()!=numberElements) continue; if (!treatAsSame(cutPtr->lb(),newLb)) continue; if (!treatAsSame(cutPtr->ub(),newUb)) continue; const CoinPackedVector * thisVector = &(cutPtr->row()); const int * indices = thisVector->getIndices(); const double * elements = thisVector->getElements(); int j; for(j=0;jsetLb(newLb); newCutPtr->setUb(newUb); newCutPtr->setRow(vector); rowCutPtrs_.push_back(newCutPtr); } } CoinMP-1.8.3/Osi/src/Osi/OsiRowCutDebugger.hpp0000644000175000017500000001373111575423733017462 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiRowCutDebugger_H #define OsiRowCutDebugger_H /*! \file OsiRowCutDebugger.hpp \brief Provides a facility to validate cut constraints to ensure that they do not cut off a given solution. */ #include #include "OsiCuts.hpp" #include "OsiSolverInterface.hpp" /*! \brief Validate cuts against a known solution OsiRowCutDebugger provides a facility for validating cuts against a known solution for a problem. The debugger knows an optimal solution for many of the miplib3 problems. Check the source for #activate(const OsiSolverInterface&,const char*) in OsiRowCutDebugger.cpp for the full set of known problems. A full solution vector can be supplied as a parameter with (#activate(const OsiSolverInterface&,const double*,bool)). Only the integer values need to be valid. The default behaviour is to solve an lp relaxation with the integer variables fixed to the specified values and use the optimal solution to fill in the continuous variables in the solution. The debugger can be instructed to preserve the continuous variables (useful when debugging solvers where the linear relaxation doesn't capture all the constraints). Note that the solution must match the problem held in the solver interface. If you want to use the row cut debugger on a problem after applying presolve transformations, your solution must match the presolved problem. (But see #redoSolution().) */ class OsiRowCutDebugger { friend void OsiRowCutDebuggerUnitTest(const OsiSolverInterface * siP, const std::string & mpsDir); public: /*! @name Validate Row Cuts Check that the specified cuts do not cut off the known solution. */ //@{ /*! \brief Check that the set of cuts does not cut off the solution known to the debugger. Check if any generated cuts cut off the solution known to the debugger! If so then print offending cuts. Return the number of invalid cuts. */ virtual int validateCuts(const OsiCuts & cs, int first, int last) const; /*! \brief Check that the cut does not cut off the solution known to the debugger. Return true if cut is invalid */ virtual bool invalidCut(const OsiRowCut & rowcut) const; /*! \brief Returns true if the solution held in the solver is compatible with the known solution. More specifically, returns true if the known solution satisfies the column bounds held in the solver. */ bool onOptimalPath(const OsiSolverInterface &si) const; //@} /*! @name Activate the Debugger The debugger is considered to be active when it holds a known solution. */ //@{ /*! \brief Activate a debugger using the name of a problem. The debugger knows an optimal solution for most of miplib3. Check the source code for the full list. Returns true if the debugger is successfully activated. */ bool activate(const OsiSolverInterface &si, const char *model) ; /*! \brief Activate a debugger using a full solution array. The solution must have one entry for every variable, but only the entries for integer values are used. By default the debugger will solve an lp relaxation with the integer variables fixed and fill in values for the continuous variables from this solution. If the debugger should preserve the given values for the continuous variables, set \p keepContinuous to \c true. Returns true if debugger activates successfully. */ bool activate(const OsiSolverInterface &si, const double* solution, bool keepContinuous = false) ; /// Returns true if the debugger is active bool active() const; //@} /*! @name Query or Manipulate the Known Solution */ //@{ /// Return the known solution inline const double * optimalSolution() const { return knownSolution_;} /// Return the number of columns in the known solution inline int numberColumns() const { return (numberColumns_) ; } /// Return the value of the objective for the known solution inline double optimalValue() const { return knownValue_;} /*! \brief Edit the known solution to reflect column changes Given a translation array \p originalColumns[numberColumns] which can translate current column indices to original column indices, this method will edit the solution held in the debugger so that it matches the current set of columns. Useful when the original problem is preprocessed prior to cut generation. The debugger does keep a record of the changes. */ void redoSolution(int numberColumns, const int *originalColumns); /// Print optimal solution (returns -1 bad debug, 0 on optimal, 1 not) int printOptimalSolution(const OsiSolverInterface & si) const; //@} /**@name Constructors and Destructors */ //@{ /// Default constructor - no checking OsiRowCutDebugger (); /*! \brief Constructor with name of model. See #activate(const OsiSolverInterface&,const char*). */ OsiRowCutDebugger(const OsiSolverInterface &si, const char *model) ; /*! \brief Constructor with full solution. See #activate(const OsiSolverInterface&,const double*,bool). */ OsiRowCutDebugger(const OsiSolverInterface &si, const double *solution, bool enforceOptimality = false) ; /// Copy constructor OsiRowCutDebugger(const OsiRowCutDebugger &); /// Assignment operator OsiRowCutDebugger& operator=(const OsiRowCutDebugger& rhs); /// Destructor virtual ~OsiRowCutDebugger (); //@} private: // Private member data /**@name Private member data */ //@{ /// Value of known solution double knownValue_; /*! \brief Number of columns in known solution This must match the number of columns reported by the solver. */ int numberColumns_; /// array specifying integer variables bool * integerVariable_; /// array specifying known solution double * knownSolution_; //@} }; #endif CoinMP-1.8.3/Osi/src/Osi/OsiCuts.hpp0000644000175000017500000003320112574605610015476 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiCuts_H #define OsiCuts_H #include "CoinPragma.hpp" #include #include #include "OsiCollections.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinFloatEqual.hpp" /** Collections of row cuts and column cuts */ class OsiCuts { friend void OsiCutsUnitTest(); public: /**@name Iterator classes */ //@{ /** Iterator This is a class for iterating over the collection of cuts. */ class iterator { friend class OsiCuts; public: iterator(OsiCuts& cuts); iterator(const iterator & src); iterator & operator=( const iterator& rhs); ~iterator (); OsiCut* operator*() const { return cutP_; } iterator operator++(); iterator operator++(int) { iterator temp = *this; ++*this; return temp; } bool operator==(const iterator& it) const { return (colCutIndex_+rowCutIndex_)==(it.colCutIndex_+it.rowCutIndex_); } bool operator!=(const iterator& it) const { return !((*this)==it); } bool operator<(const iterator& it) const { return (colCutIndex_+rowCutIndex_)<(it.colCutIndex_+it.rowCutIndex_); } private: iterator(); // *THINK* : how to inline these without sticking the code here (ugly...) iterator begin(); iterator end(); OsiCuts& cuts_; int rowCutIndex_; int colCutIndex_; OsiCut * cutP_; }; /** Const Iterator This is a class for iterating over the collection of cuts. */ class const_iterator { friend class OsiCuts; public: typedef std::forward_iterator_tag iterator_category; typedef OsiCut* value_type; typedef size_t difference_type; typedef OsiCut ** pointer; typedef OsiCut *& reference; public: const_iterator(const OsiCuts& cuts); const_iterator(const const_iterator & src); const_iterator & operator=( const const_iterator& rhs); ~const_iterator (); const OsiCut* operator*() const { return cutP_; } const_iterator operator++(); const_iterator operator++(int) { const_iterator temp = *this; ++*this; return temp; } bool operator==(const const_iterator& it) const { return (colCutIndex_+rowCutIndex_)==(it.colCutIndex_+it.rowCutIndex_); } bool operator!=(const const_iterator& it) const { return !((*this)==it); } bool operator<(const const_iterator& it) const { return (colCutIndex_+rowCutIndex_)<(it.colCutIndex_+it.rowCutIndex_); } private: inline const_iterator(); // *THINK* : how to inline these without sticking the code here (ugly...) const_iterator begin(); const_iterator end(); const OsiCuts * cutsPtr_; int rowCutIndex_; int colCutIndex_; const OsiCut * cutP_; }; //@} //------------------------------------------------------------------- // // Cuts class definition begins here: // //------------------------------------------------------------------- /** \name Inserting a cut into collection */ //@{ /** \brief Insert a row cut */ inline void insert( const OsiRowCut & rc ); /** \brief Insert a row cut unless it is a duplicate - cut may get sorted. Duplicate is defined as CoinAbsFltEq says same*/ void insertIfNotDuplicate( OsiRowCut & rc , CoinAbsFltEq treatAsSame=CoinAbsFltEq(1.0e-12) ); /** \brief Insert a row cut unless it is a duplicate - cut may get sorted. Duplicate is defined as CoinRelFltEq says same*/ void insertIfNotDuplicate( OsiRowCut & rc , CoinRelFltEq treatAsSame ); /** \brief Insert a column cut */ inline void insert( const OsiColCut & cc ); /** \brief Insert a row cut. The OsiCuts object takes control of the cut object. On return, \c rcPtr is NULL. */ inline void insert( OsiRowCut * & rcPtr ); /** \brief Insert a column cut. The OsiCuts object takes control of the cut object. On return \c ccPtr is NULL. */ inline void insert( OsiColCut * & ccPtr ); #if 0 inline void insert( OsiCut * & cPtr ); #endif /** \brief Insert a set of cuts */ inline void insert(const OsiCuts & cs); //@} /**@name Number of cuts in collection */ //@{ /// Number of row cuts in collection inline int sizeRowCuts() const; /// Number of column cuts in collection inline int sizeColCuts() const; /// Number of cuts in collection inline int sizeCuts() const; //@} /**@name Debug stuff */ //@{ /// Print cuts in collection inline void printCuts() const; //@} /**@name Get a cut from collection */ //@{ /// Get pointer to i'th row cut inline OsiRowCut * rowCutPtr(int i); /// Get const pointer to i'th row cut inline const OsiRowCut * rowCutPtr(int i) const; /// Get pointer to i'th column cut inline OsiColCut * colCutPtr(int i); /// Get const pointer to i'th column cut inline const OsiColCut * colCutPtr(int i) const; /// Get reference to i'th row cut inline OsiRowCut & rowCut(int i); /// Get const reference to i'th row cut inline const OsiRowCut & rowCut(int i) const; /// Get reference to i'th column cut inline OsiColCut & colCut(int i); /// Get const reference to i'th column cut inline const OsiColCut & colCut(int i) const; /// Get const pointer to the most effective cut inline const OsiCut * mostEffectiveCutPtr() const; /// Get pointer to the most effective cut inline OsiCut * mostEffectiveCutPtr(); //@} /**@name Deleting cut from collection */ //@{ /// Remove i'th row cut from collection inline void eraseRowCut(int i); /// Remove i'th column cut from collection inline void eraseColCut(int i); /// Get pointer to i'th row cut and remove ptr from collection inline OsiRowCut * rowCutPtrAndZap(int i); /*! \brief Clear all row cuts without deleting them Handy in case one wants to use CGL without managing cuts in one of the OSI containers. Client is ultimately responsible for deleting the data structures holding the row cuts. */ inline void dumpCuts() ; /*! \brief Selective delete and clear for row cuts. Deletes the cuts specified in \p to_erase then clears remaining cuts without deleting them. A hybrid of eraseRowCut(int) and dumpCuts(). Client is ultimately responsible for deleting the data structures for row cuts not specified in \p to_erase. */ inline void eraseAndDumpCuts(const std::vector to_erase) ; //@} /**@name Sorting collection */ //@{ /// Cuts with greatest effectiveness are first. inline void sort(); //@} /**@name Iterators Example of using an iterator to sum effectiveness of all cuts in the collection.
         double sumEff=0.0;
         for ( OsiCuts::iterator it=cuts.begin(); it!=cuts.end(); ++it )
               sumEff+= (*it)->effectiveness();
         
    */ //@{ /// Get iterator to beginning of collection inline iterator begin() { iterator it(*this); it.begin(); return it; } /// Get const iterator to beginning of collection inline const_iterator begin() const { const_iterator it(*this); it.begin(); return it; } /// Get iterator to end of collection inline iterator end() { iterator it(*this); it.end(); return it; } /// Get const iterator to end of collection inline const_iterator end() const { const_iterator it(*this); it.end(); return it; } //@} /**@name Constructors and destructors */ //@{ /// Default constructor OsiCuts (); /// Copy constructor OsiCuts ( const OsiCuts &); /// Assignment operator OsiCuts & operator=( const OsiCuts& rhs); /// Destructor virtual ~OsiCuts (); //@} private: //*@name Function operator for sorting cuts by efectiveness */ //@{ class OsiCutCompare { public: /// Function for sorting cuts by effectiveness inline bool operator()(const OsiCut * c1P,const OsiCut * c2P) { return c1P->effectiveness() > c2P->effectiveness(); } }; //@} /**@name Private methods */ //@{ /// Copy internal data void gutsOfCopy( const OsiCuts & source ); /// Delete internal data void gutsOfDestructor(); //@} /**@name Private member data */ //@{ /// Vector of row cuts pointers OsiVectorRowCutPtr rowCutPtrs_; /// Vector of column cuts pointers OsiVectorColCutPtr colCutPtrs_; //@} }; //------------------------------------------------------------------- // insert cuts into collection //------------------------------------------------------------------- void OsiCuts::insert( const OsiRowCut & rc ) { OsiRowCut * newCutPtr = rc.clone(); //assert(dynamic_cast(newCutPtr) != NULL ); rowCutPtrs_.push_back(static_cast(newCutPtr)); } void OsiCuts::insert( const OsiColCut & cc ) { OsiColCut * newCutPtr = cc.clone(); //assert(dynamic_cast(newCutPtr) != NULL ); colCutPtrs_.push_back(static_cast(newCutPtr)); } void OsiCuts::insert( OsiRowCut* & rcPtr ) { rowCutPtrs_.push_back(rcPtr); rcPtr = NULL; } void OsiCuts::insert( OsiColCut* &ccPtr ) { colCutPtrs_.push_back(ccPtr); ccPtr = NULL; } #if 0 void OsiCuts::insert( OsiCut* & cPtr ) { OsiRowCut * rcPtr = dynamic_cast(cPtr); if ( rcPtr != NULL ) { insert( rcPtr ); cPtr = rcPtr; } else { OsiColCut * ccPtr = dynamic_cast(cPtr); assert( ccPtr != NULL ); insert( ccPtr ); cPtr = ccPtr; } } #endif // LANNEZ SEBASTIEN added Thu May 25 01:22:51 EDT 2006 void OsiCuts::insert(const OsiCuts & cs) { for (OsiCuts::const_iterator it = cs.begin (); it != cs.end (); it++) { const OsiRowCut * rCut = dynamic_cast (*it); const OsiColCut * cCut = dynamic_cast (*it); assert (rCut || cCut); if (rCut) insert (*rCut); else insert (*cCut); } } //------------------------------------------------------------------- // sort //------------------------------------------------------------------- void OsiCuts::sort() { std::sort(colCutPtrs_.begin(),colCutPtrs_.end(),OsiCutCompare()); std::sort(rowCutPtrs_.begin(),rowCutPtrs_.end(),OsiCutCompare()); } //------------------------------------------------------------------- // Get number of in collections //------------------------------------------------------------------- int OsiCuts::sizeRowCuts() const { return static_cast(rowCutPtrs_.size()); } int OsiCuts::sizeColCuts() const { return static_cast(colCutPtrs_.size()); } int OsiCuts::sizeCuts() const { return static_cast(sizeRowCuts()+sizeColCuts()); } //---------------------------------------------------------------- // Get i'th cut from the collection //---------------------------------------------------------------- const OsiRowCut * OsiCuts::rowCutPtr(int i) const { return rowCutPtrs_[i]; } const OsiColCut * OsiCuts::colCutPtr(int i) const { return colCutPtrs_[i]; } OsiRowCut * OsiCuts::rowCutPtr(int i) { return rowCutPtrs_[i]; } OsiColCut * OsiCuts::colCutPtr(int i) { return colCutPtrs_[i]; } const OsiRowCut & OsiCuts::rowCut(int i) const { return *rowCutPtr(i); } const OsiColCut & OsiCuts::colCut(int i) const { return *colCutPtr(i); } OsiRowCut & OsiCuts::rowCut(int i) { return *rowCutPtr(i); } OsiColCut & OsiCuts::colCut(int i) { return *colCutPtr(i); } //---------------------------------------------------------------- // Get most effective cut from collection //---------------------------------------------------------------- const OsiCut * OsiCuts::mostEffectiveCutPtr() const { const_iterator b=begin(); const_iterator e=end(); return *(std::min_element(b,e,OsiCutCompare())); } OsiCut * OsiCuts::mostEffectiveCutPtr() { iterator b=begin(); iterator e=end(); //return *(std::min_element(b,e,OsiCutCompare())); OsiCut * retVal = NULL; double maxEff = COIN_DBL_MIN; for ( OsiCuts::iterator it=b; it!=e; ++it ) { if (maxEff < (*it)->effectiveness() ) { maxEff = (*it)->effectiveness(); retVal = *it; } } return retVal; } //---------------------------------------------------------------- // Print all cuts //---------------------------------------------------------------- void OsiCuts::printCuts() const { // do all column cuts first int i; int numberColCuts=sizeColCuts(); for (i=0;iprint(); } int numberRowCuts=sizeRowCuts(); for (i=0;iprint(); } } //---------------------------------------------------------------- // Erase i'th cut from the collection //---------------------------------------------------------------- void OsiCuts::eraseRowCut(int i) { delete rowCutPtrs_[i]; rowCutPtrs_.erase( rowCutPtrs_.begin()+i ); } void OsiCuts::eraseColCut(int i) { delete colCutPtrs_[i]; colCutPtrs_.erase( colCutPtrs_.begin()+i ); } /// Get pointer to i'th row cut and remove ptr from collection OsiRowCut * OsiCuts::rowCutPtrAndZap(int i) { OsiRowCut * cut = rowCutPtrs_[i]; rowCutPtrs_[i]=NULL; rowCutPtrs_.erase( rowCutPtrs_.begin()+i ); return cut; } void OsiCuts::dumpCuts() { rowCutPtrs_.clear() ; } void OsiCuts::eraseAndDumpCuts(const std::vector to_erase) { for (unsigned i=0; i= 1.4.2c // authors: Tobias Pfender // Ambros Gleixner // Wei Huang // Konrad-Zuse-Zentrum Berlin (Germany) // date: 01/16/2002 // license: this file may be freely distributed under the terms of EPL //----------------------------------------------------------------------------- // Copyright (C) 2002, Tobias Pfender, International Business Machines // Corporation and others. All Rights Reserved. // Last edit: $Id: OsiSpxSolverInterface.cpp 2019 2015-06-11 08:50:04Z stefan $ #include "CoinPragma.hpp" #include #include #include #include #include #include "CoinError.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" #ifndef SOPLEX_LEGACY #define SOPLEX_LEGACY #endif #include "soplex.h" // it's important to include this header after soplex.h #include "OsiSpxSolverInterface.hpp" //############################################################################# // A couple of helper functions //############################################################################# inline void freeCacheDouble( double*& ptr ) { if( ptr != NULL ) { delete [] ptr; ptr = NULL; } } inline void freeCacheChar( char*& ptr ) { if( ptr != NULL ) { delete [] ptr; ptr = NULL; } } inline void freeCacheMatrix( CoinPackedMatrix*& ptr ) { if( ptr != NULL ) { delete ptr; ptr = NULL; } } inline void throwSPXerror( std::string error, std::string osimethod ) { std::cout << "ERROR: " << error << " (" << osimethod << " in OsiSpxSolverInterface)" << std::endl; throw CoinError( error.c_str(), osimethod.c_str(), "OsiSpxSolverInterface" ); } //############################################################################# // Solve methods //############################################################################# void OsiSpxSolverInterface::initialSolve() { bool takeHint; OsiHintStrength strength; // by default we use dual simplex // unless we get the hint to use primal simplex bool dual = true; getHintParam(OsiDoDualInInitial,takeHint,strength); if (strength!=OsiHintIgnore) dual = takeHint; // always use column representation if( soplex_->rep() != soplex::SPxSolver::COLUMN ) soplex_->setRep( soplex::SPxSolver::COLUMN ); // set algorithm type if( dual ) { if( soplex_->type() != soplex::SPxSolver::LEAVE ) soplex_->setType( soplex::SPxSolver::LEAVE ); } else { if( soplex_->type() != soplex::SPxSolver::ENTER ) soplex_->setType( soplex::SPxSolver::ENTER ); } // set dual objective limit double dualobjlimit; OsiSolverInterface::getDblParam(OsiDualObjectiveLimit, dualobjlimit); if( fabs(dualobjlimit) < getInfinity() ) { double objoffset; OsiSolverInterface::getDblParam(OsiDualObjectiveLimit, objoffset); dualobjlimit += objoffset; } soplex_->setTerminationValue( dualobjlimit ); // solve try { soplex_->solve(); } catch (soplex::SPxException e) { *messageHandler() << "SoPlex initial solve failed with exception " << e.what() << CoinMessageEol; #if (SOPLEX_VERSION >= 160) || (SOPLEX_SUBVERSION >= 7) try { *messageHandler() << "Retry with cleared basis" << CoinMessageEol; soplex_->clearBasis(); soplex_->solve(); } catch (soplex::SPxException e) { *messageHandler() << "SoPlex initial solve with cleared basis failed with exception " << e.what() << CoinMessageEol; } #endif } freeCachedResults(); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::resolve() { bool takeHint; OsiHintStrength strength; // by default we use dual simplex // unless we get the hint to use primal simplex bool dual = true; getHintParam(OsiDoDualInResolve,takeHint,strength); if (strength!=OsiHintIgnore) dual = takeHint; // always use column representation if( soplex_->rep() != soplex::SPxSolver::COLUMN ) soplex_->setRep( soplex::SPxSolver::COLUMN ); // set algorithm type if( dual ) { if( soplex_->type() != soplex::SPxSolver::LEAVE ) soplex_->setType( soplex::SPxSolver::LEAVE ); } else { if( soplex_->type() != soplex::SPxSolver::ENTER ) soplex_->setType( soplex::SPxSolver::ENTER ); } // set dual objective limit double dualobjlimit; OsiSolverInterface::getDblParam(OsiDualObjectiveLimit, dualobjlimit); if( fabs(dualobjlimit) < getInfinity() ) { double objoffset; OsiSolverInterface::getDblParam(OsiDualObjectiveLimit, objoffset); dualobjlimit += objoffset; } soplex_->setTerminationValue( dualobjlimit ); // solve try { soplex_->solve(); } catch (soplex::SPxException e) { *messageHandler() << "SoPlex resolve failed with exception " << e.what() << CoinMessageEol; #if (SOPLEX_VERSION >= 160) || (SOPLEX_SUBVERSION >= 7) try { *messageHandler() << "Retry with cleared basis" << CoinMessageEol; soplex_->clearBasis(); soplex_->solve(); } catch (soplex::SPxException e) { *messageHandler() << "SoPlex resolve with cleared basis failed with exception " << e.what() << CoinMessageEol; } #endif } freeCachedResults(); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::branchAndBound() { throwSPXerror( "SoPlex does not provide an internal branch and bound procedure", "branchAndBound" ); } //############################################################################# // Parameter related methods //############################################################################# bool OsiSpxSolverInterface::setIntParam(OsiIntParam key, int value) { bool retval = false; try { switch (key) { case OsiMaxNumIteration: soplex_->setTerminationIter( value ); retval = true; break; case OsiMaxNumIterationHotStart: if( value >= 0 ) { hotStartMaxIteration_ = value; retval = true; } else retval = false; break; case OsiLastIntParam: retval = false; break; case OsiNameDiscipline: retval = OsiSolverInterface::setIntParam(key,value); break; } } catch (soplex::SPxException e) { *messageHandler() << "OsiSpx::setDblParam failed with exception " << e.what() << CoinMessageEol; retval = false; } return retval; } //----------------------------------------------------------------------------- bool OsiSpxSolverInterface::setDblParam(OsiDblParam key, double value) { bool retval = false; try { switch (key) { case OsiDualObjectiveLimit: retval = OsiSolverInterface::setDblParam(key,value); break; case OsiPrimalObjectiveLimit: retval = OsiSolverInterface::setDblParam(key,value); break; case OsiDualTolerance: // SoPlex doesn't support different deltas for primal and dual soplex_->setDelta( value ); retval = true; break; case OsiPrimalTolerance: // SoPlex doesn't support different deltas for primal and dual soplex_->setDelta( value ); retval = true; break; case OsiObjOffset: retval = OsiSolverInterface::setDblParam(key,value); break; case OsiLastDblParam: retval = false; break; } } catch (soplex::SPxException e) { *messageHandler() << "OsiSpx::setDblParam failed with exception " << e.what() << CoinMessageEol; retval = false; } return retval; } void OsiSpxSolverInterface::setTimeLimit(double value) { soplex_->setTerminationTime(value); } //----------------------------------------------------------------------------- bool OsiSpxSolverInterface::getIntParam(OsiIntParam key, int& value) const { bool retval = false; switch (key) { case OsiMaxNumIteration: value = soplex_->terminationIter(); retval = true; break; case OsiMaxNumIterationHotStart: value = hotStartMaxIteration_; retval = true; break; case OsiLastIntParam: retval = false; break; case OsiNameDiscipline: retval = OsiSolverInterface::getIntParam(key,value); break; } return retval; } //----------------------------------------------------------------------------- bool OsiSpxSolverInterface::getDblParam(OsiDblParam key, double& value) const { bool retval = false; switch (key) { case OsiDualObjectiveLimit: retval = OsiSolverInterface::getDblParam(key, value); break; case OsiPrimalObjectiveLimit: retval = OsiSolverInterface::getDblParam(key, value); break; case OsiDualTolerance: value = soplex_->delta(); retval = true; break; case OsiPrimalTolerance: value = soplex_->delta(); retval = true; break; case OsiObjOffset: retval = OsiSolverInterface::getDblParam(key, value); break; case OsiLastDblParam: retval = false; break; } return retval; } bool OsiSpxSolverInterface::getStrParam(OsiStrParam key, std::string & value) const { switch (key) { case OsiSolverName: value = "SoPlex"; return true; default: ; } return false; } double OsiSpxSolverInterface::getTimeLimit() const { return soplex_->terminationTime(); } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# bool OsiSpxSolverInterface::isAbandoned() const { int stat = soplex_->status(); return ( stat == soplex::SPxSolver::SINGULAR || stat == soplex::SPxSolver::ERROR ); } bool OsiSpxSolverInterface::isProvenOptimal() const { int stat = soplex_->status(); return ( stat == soplex::SPxSolver::OPTIMAL ); } bool OsiSpxSolverInterface::isProvenPrimalInfeasible() const { int stat = soplex_->status(); return ( stat == soplex::SPxSolver::INFEASIBLE ); } bool OsiSpxSolverInterface::isProvenDualInfeasible() const { int stat = soplex_->status(); return ( stat == soplex::SPxSolver::UNBOUNDED ); } bool OsiSpxSolverInterface::isDualObjectiveLimitReached() const { if( soplex_->status() == soplex::SPxSolver::ABORT_VALUE ) return true; return OsiSolverInterface::isDualObjectiveLimitReached(); } bool OsiSpxSolverInterface::isIterationLimitReached() const { return ( soplex_->status() == soplex::SPxSolver::ABORT_ITER ); } bool OsiSpxSolverInterface::isTimeLimitReached() const { return ( soplex_->status() == soplex::SPxSolver::ABORT_TIME ); } //############################################################################# // WarmStart related methods //############################################################################# CoinWarmStart* OsiSpxSolverInterface::getWarmStart() const { CoinWarmStartBasis* ws = NULL; int numcols = getNumCols(); int numrows = getNumRows(); int i; ws = new CoinWarmStartBasis(); ws->setSize( numcols, numrows ); if( soplex_->status() <= soplex::SPxSolver::NO_PROBLEM ) return ws; // The OSI standard assumes the artificial slack variables to have positive coefficients. SoPlex uses the convention // Ax - s = 0, lhs <= s <= rhs, so we have to invert the ON_LOWER and ON_UPPER statuses. for( i = 0; i < numrows; ++i ) { switch( soplex_->getBasisRowStatus( i ) ) { case soplex::SPxSolver::BASIC: ws->setArtifStatus( i, CoinWarmStartBasis::basic ); break; case soplex::SPxSolver::FIXED: case soplex::SPxSolver::ON_LOWER: ws->setArtifStatus( i, CoinWarmStartBasis::atUpperBound ); break; case soplex::SPxSolver::ON_UPPER: ws->setArtifStatus( i, CoinWarmStartBasis::atLowerBound ); break; case soplex::SPxSolver::ZERO: ws->setArtifStatus( i, CoinWarmStartBasis::isFree ); break; default: throwSPXerror( "invalid row status", "getWarmStart" ); break; } } for( i = 0; i < numcols; ++i ) { switch( soplex_->getBasisColStatus( i ) ) { case soplex::SPxSolver::BASIC: ws->setStructStatus( i, CoinWarmStartBasis::basic ); break; case soplex::SPxSolver::FIXED: case soplex::SPxSolver::ON_LOWER: ws->setStructStatus( i, CoinWarmStartBasis::atLowerBound ); break; case soplex::SPxSolver::ON_UPPER: ws->setStructStatus( i, CoinWarmStartBasis::atUpperBound ); break; case soplex::SPxSolver::ZERO: ws->setStructStatus( i, CoinWarmStartBasis::isFree ); break; default: throwSPXerror( "invalid column status", "getWarmStart" ); break; } } return ws; } //----------------------------------------------------------------------------- bool OsiSpxSolverInterface::setWarmStart(const CoinWarmStart* warmstart) { const CoinWarmStartBasis* ws = dynamic_cast(warmstart); int numcols, numrows, i; soplex::SPxSolver::VarStatus *cstat, *rstat; bool retval = false; if( !ws ) return false; numcols = ws->getNumStructural(); numrows = ws->getNumArtificial(); if( numcols != getNumCols() || numrows != getNumRows() ) return false; cstat = new soplex::SPxSolver::VarStatus[numcols]; rstat = new soplex::SPxSolver::VarStatus[numrows]; // The OSI standard assumes the artificial slack variables to have positive coefficients. SoPlex uses the convention // Ax - s = 0, lhs <= s <= rhs, so we have to invert the atLowerBound and atUpperBound statuses. for( i = 0; i < numrows; ++i ) { switch( ws->getArtifStatus( i ) ) { case CoinWarmStartBasis::basic: rstat[i] = soplex::SPxSolver::BASIC; break; case CoinWarmStartBasis::atLowerBound: rstat[i] = soplex::SPxSolver::ON_UPPER; break; case CoinWarmStartBasis::atUpperBound: rstat[i] = soplex::SPxSolver::ON_LOWER; break; case CoinWarmStartBasis::isFree: rstat[i] = soplex::SPxSolver::ZERO; break; default: // unknown row status retval = false; goto TERMINATE; } } for( i = 0; i < numcols; ++i ) { switch( ws->getStructStatus( i ) ) { case CoinWarmStartBasis::basic: cstat[i] = soplex::SPxSolver::BASIC; break; case CoinWarmStartBasis::atLowerBound: cstat[i] = soplex::SPxSolver::ON_LOWER; break; case CoinWarmStartBasis::atUpperBound: cstat[i] = soplex::SPxSolver::ON_UPPER; break; case CoinWarmStartBasis::isFree: cstat[i] = soplex::SPxSolver::ZERO; break; default: // unknown column status retval = false; goto TERMINATE; } } try { soplex_->setBasis( rstat, cstat ); } catch (soplex::SPxException e) { std::cerr << "SoPlex setting starting basis failed with exception " << e.what() << std::endl; retval = false; goto TERMINATE; } retval = true; TERMINATE: delete[] cstat; delete[] rstat; return retval; } //############################################################################# // Hotstart related methods (primarily used in strong branching) //############################################################################# void OsiSpxSolverInterface::markHotStart() { int numcols, numrows; numcols = getNumCols(); numrows = getNumRows(); if( numcols > hotStartCStatSize_ ) { delete[] reinterpret_cast(hotStartCStat_); hotStartCStatSize_ = static_cast( 1.2 * static_cast( numcols ) ); // get some extra space for future hot starts hotStartCStat_ = reinterpret_cast(new soplex::SPxSolver::VarStatus[hotStartCStatSize_]); } if( numrows > hotStartRStatSize_ ) { delete[] reinterpret_cast(hotStartRStat_); hotStartRStatSize_ = static_cast( 1.2 * static_cast( numrows ) ); // get some extra space for future hot starts hotStartRStat_ = reinterpret_cast(new soplex::SPxSolver::VarStatus[hotStartRStatSize_]); } soplex_->getBasis( reinterpret_cast(hotStartRStat_), reinterpret_cast(hotStartCStat_) ); } void OsiSpxSolverInterface::solveFromHotStart() { int maxiter; assert( getNumCols() <= hotStartCStatSize_ ); assert( getNumRows() <= hotStartRStatSize_ ); // @todo why the hotstart basis is not set here ????? //soplex_->setBasis( reinterpret_cast(hotStartRStat_), reinterpret_cast(hotStartCStat_) ); maxiter = soplex_->terminationIter(); soplex_->setTerminationIter( hotStartMaxIteration_ ); resolve(); soplex_->setTerminationIter( maxiter ); } void OsiSpxSolverInterface::unmarkHotStart() { // be lazy with deallocating memory and do nothing here, deallocate memory in the destructor } //############################################################################# // Problem information methods (original data) //############################################################################# //------------------------------------------------------------------ // Get number of rows, columns, elements, ... //------------------------------------------------------------------ int OsiSpxSolverInterface::getNumCols() const { return soplex_->nCols(); } int OsiSpxSolverInterface::getNumRows() const { return soplex_->nRows(); } int OsiSpxSolverInterface::getNumElements() const { #if 0 return soplex_->nNzos(); #else int retVal = 0; int nrows = getNumRows(); int row; for( row = 0; row < nrows; ++row ) { const soplex::SVector& rowvec = soplex_->rowVector( row ); retVal += rowvec.size(); } return retVal; #endif } //------------------------------------------------------------------ // Get pointer to rim vectors //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getColLower() const { const double * retVal = NULL; if ( getNumCols()!=0 ) retVal = soplex_->lower().get_const_ptr(); return retVal; } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getColUpper() const { const double * retVal = NULL; if ( getNumCols()!=0 ) retVal = soplex_->upper().get_const_ptr(); return retVal; } //------------------------------------------------------------------ const char * OsiSpxSolverInterface::getRowSense() const { if ( rowsense_ == NULL ) { // rowsense is determined with rhs, so invoke rhs getRightHandSide(); assert( rowsense_ != NULL || getNumRows() == 0 ); } return rowsense_; } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getRightHandSide() const { if ( rhs_ == NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { int row; assert( rowrange_ == NULL ); assert( rowsense_ == NULL ); rhs_ = new double[nrows]; rowrange_ = new double[nrows]; rowsense_ = new char[nrows]; for( row = 0; row < nrows; ++row ) convertBoundToSense( soplex_->lhs( row ), soplex_->rhs( row ), rowsense_[row], rhs_[row], rowrange_[row] ); } } return rhs_; } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getRowRange() const { if ( rowrange_==NULL ) { // rowrange is determined with rhs, so invoke rhs getRightHandSide(); assert( rowrange_ != NULL || getNumRows() == 0 ); } return rowrange_; } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getRowLower() const { const double * retVal = NULL; if ( getNumRows() != 0 ) retVal = soplex_->lhs().get_const_ptr(); return retVal; } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getRowUpper() const { const double * retVal = NULL; if ( getNumRows() != 0 ) retVal = soplex_->rhs().get_const_ptr(); return retVal; } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getObjCoefficients() const { const double * retVal = NULL; if( obj_ == NULL ) { if ( getNumCols()!=0 ) { obj_ = new soplex::DVector( getNumCols() ); soplex_->getObj( *obj_ ); retVal = obj_->get_const_ptr(); } } else { retVal = obj_->get_const_ptr(); } return retVal; } //------------------------------------------------------------------ double OsiSpxSolverInterface::getObjSense() const { switch( soplex_->spxSense() ) { case soplex::SPxLP::MINIMIZE: return +1.0; case soplex::SPxLP::MAXIMIZE: return -1.0; default: throwSPXerror( "invalid optimization sense", "getObjSense" ); return 0.0; } } //------------------------------------------------------------------ // Return information on integrality //------------------------------------------------------------------ bool OsiSpxSolverInterface::isContinuous( int colNumber ) const { return( spxintvars_->number( colNumber ) < 0 ); } //------------------------------------------------------------------ // Row and column copies of the matrix ... //------------------------------------------------------------------ const CoinPackedMatrix * OsiSpxSolverInterface::getMatrixByRow() const { if( matrixByRow_ == NULL ) { int nrows = getNumRows(); int ncols = getNumCols(); int nelems = getNumElements(); double *elements = new double [nelems]; int *indices = new int [nelems]; int *starts = new int [nrows+1]; int *len = new int [nrows]; int row, i, elem; elem = 0; for( row = 0; row < nrows; ++row ) { const soplex::SVector& rowvec = soplex_->rowVector( row ); starts[row] = elem; len [row] = rowvec.size(); for( i = 0; i < len[row]; ++i, ++elem ) { assert( elem < nelems ); elements[elem] = rowvec.value( i ); indices [elem] = rowvec.index( i ); } } starts[nrows] = elem; assert( elem == nelems ); matrixByRow_ = new CoinPackedMatrix(); matrixByRow_->assignMatrix( false /* not column ordered */, ncols, nrows, nelems, elements, indices, starts, len ); } return matrixByRow_; } //------------------------------------------------------------------ const CoinPackedMatrix * OsiSpxSolverInterface::getMatrixByCol() const { if( matrixByCol_ == NULL ) { int nrows = getNumRows(); int ncols = getNumCols(); int nelems = getNumElements(); double *elements = new double [nelems]; int *indices = new int [nelems]; int *starts = new int [ncols+1]; int *len = new int [ncols]; int col, i, elem; elem = 0; for( col = 0; col < ncols; ++col ) { const soplex::SVector& colvec = soplex_->colVector( col ); starts[col] = elem; len [col] = colvec.size(); for( i = 0; i < len[col]; ++i, ++elem ) { assert( elem < nelems ); elements[elem] = colvec.value( i ); indices [elem] = colvec.index( i ); } } starts[ncols] = elem; assert( elem == nelems ); matrixByCol_ = new CoinPackedMatrix(); matrixByCol_->assignMatrix( true /* column ordered */, nrows, ncols, nelems, elements, indices, starts, len ); } return matrixByCol_; } //------------------------------------------------------------------ // Get solver's value for infinity //------------------------------------------------------------------ double OsiSpxSolverInterface::getInfinity() const { return soplex::infinity; } //############################################################################# // Problem information methods (results) //############################################################################# // *FIXME*: what should be done if a certain vector doesn't exist??? const double * OsiSpxSolverInterface::getColSolution() const { if( colsol_ == NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { colsol_ = new soplex::DVector( ncols ); if( isProvenOptimal() ) soplex_->getPrimal( *colsol_ ); else *colsol_ = soplex_->lower(); } else return NULL; } return colsol_->get_const_ptr(); } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getRowPrice() const { if( rowsol_ == NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rowsol_ = new soplex::DVector( nrows ); if( isProvenOptimal() ) soplex_->getDual( *rowsol_ ); else rowsol_->clear(); } else return NULL; } return rowsol_->get_const_ptr(); } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getReducedCost() const { if( redcost_ == NULL ) { int ncols = getNumCols(); if( ncols > 0 ) { redcost_ = new soplex::DVector( ncols ); if( isProvenOptimal() ) soplex_->getRedCost( *redcost_ ); else redcost_->clear(); } else return NULL; } return redcost_->get_const_ptr(); } //------------------------------------------------------------------ const double * OsiSpxSolverInterface::getRowActivity() const { if( rowact_ == NULL ) { int nrows = getNumRows(); if( nrows > 0 ) { rowact_ = new soplex::DVector( nrows ); if( isProvenOptimal() ) soplex_->getSlacks( *rowact_ ); else rowact_->clear(); } else return NULL; } return rowact_->get_const_ptr(); } //------------------------------------------------------------------ double OsiSpxSolverInterface::getObjValue() const { double objval; switch( soplex_->status() ) { case soplex::SPxSolver::OPTIMAL: case soplex::SPxSolver::UNBOUNDED: case soplex::SPxSolver::INFEASIBLE: objval = soplex_->objValue(); break; default: { const double* colsol = getColSolution(); const double* objcoef = getObjCoefficients(); int ncols = getNumCols(); objval = 0.0; for( int i = 0; i < ncols; ++i ) objval += colsol[i] * objcoef[i]; break; } } // Adjust objective function value by constant term in objective function double objOffset; getDblParam(OsiObjOffset,objOffset); objval = objval - objOffset; return objval; } //------------------------------------------------------------------ int OsiSpxSolverInterface::getIterationCount() const { return soplex_->iteration(); } //------------------------------------------------------------------ std::vector OsiSpxSolverInterface::getDualRays(int maxNumRays, bool fullRay) const { if (fullRay == true) { throw CoinError("Full dual rays not yet implemented.","getDualRays", "OsiSpxSolverInterface"); } std::vector ret = std::vector(); if (soplex_->status() == soplex::SPxSolver::INFEASIBLE && maxNumRays > 0) { ret.push_back(new double[getNumRows()]); soplex::Vector proof(getNumRows(), ret[0]); soplex_->getDualfarkas(proof); for (int i = 0; i < getNumRows(); ++i) ret[0][i] *= -1.0; } return ret; } //------------------------------------------------------------------ std::vector OsiSpxSolverInterface::getPrimalRays(int maxNumRays) const { // *FIXME* : must write the method throw CoinError("method is not yet written", "getPrimalRays", "OsiSpxSolverInterface"); return std::vector(); } //############################################################################# // Problem modifying methods (rim vectors) //############################################################################# void OsiSpxSolverInterface::setObjCoeff( int elementIndex, double elementValue ) { soplex_->changeObj( elementIndex, elementValue ); freeCachedData( OsiSpxSolverInterface::FREECACHED_COLUMN ); } void OsiSpxSolverInterface::setColLower(int elementIndex, double elementValue) { soplex_->changeLower( elementIndex, elementValue ); freeCachedData( OsiSpxSolverInterface::FREECACHED_COLUMN ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setColUpper(int elementIndex, double elementValue) { soplex_->changeUpper( elementIndex, elementValue ); freeCachedData( OsiSpxSolverInterface::FREECACHED_COLUMN ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setColBounds( int elementIndex, double lower, double upper ) { soplex_->changeBounds( elementIndex, lower, upper ); freeCachedData( OsiSpxSolverInterface::FREECACHED_COLUMN ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setRowLower( int i, double elementValue ) { soplex_->changeLhs( i, elementValue ); freeCachedData( OsiSpxSolverInterface::FREECACHED_ROW ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setRowUpper( int i, double elementValue ) { soplex_->changeRhs( i, elementValue ); freeCachedData( OsiSpxSolverInterface::FREECACHED_ROW ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setRowBounds( int elementIndex, double lower, double upper ) { soplex_->changeRange( elementIndex, lower, upper ); freeCachedData( OsiSpxSolverInterface::FREECACHED_ROW ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setRowType(int i, char sense, double rightHandSide, double range) { double lower = 0.0; double upper = 0.0; convertSenseToBound( sense, rightHandSide, range, lower, upper ); setRowBounds( i, lower, upper ); } //############################################################################# void OsiSpxSolverInterface::setContinuous(int index) { int pos = spxintvars_->number( index ); if( pos >= 0 ) { spxintvars_->remove( pos ); freeCachedData( OsiSpxSolverInterface::FREECACHED_COLUMN ); } } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setInteger(int index) { int pos = spxintvars_->number( index ); if( pos < 0 ) { spxintvars_->addIdx( index ); freeCachedData( OsiSpxSolverInterface::FREECACHED_COLUMN ); } } //############################################################################# void OsiSpxSolverInterface::setObjSense(double s) { if( s != getObjSense() ) { if( s == +1.0 ) soplex_->changeSense( soplex::SPxLP::MINIMIZE ); else soplex_->changeSense( soplex::SPxLP::MAXIMIZE ); freeCachedData( OsiSpxSolverInterface::FREECACHED_RESULTS ); } } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setColSolution(const double * cs) { int col; int ncols = getNumCols(); if( colsol_ != NULL ) delete colsol_; if( ncols > 0 && cs != NULL ) { colsol_ = new soplex::DVector( ncols ); for( col = 0; col < ncols; ++col ) (*colsol_)[col] = cs[col]; } else colsol_ = NULL; } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::setRowPrice(const double * rs) { int row; int nrows = getNumRows(); if( rowsol_ != NULL ) delete rowsol_; if( nrows > 0 && rs != NULL ) { rowsol_ = new soplex::DVector( nrows ); for( row = 0; row < nrows; ++row ) (*rowsol_)[row] = rs[row]; } else rowsol_ = NULL; } //############################################################################# // Problem modifying methods (matrix) //############################################################################# void OsiSpxSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { soplex::DSVector colvec; colvec.add( vec.getNumElements(), vec.getIndices(), vec.getElements() ); soplex_->addCol( soplex::LPCol( obj, colvec, colub, collb ) ); freeCachedData( OsiSpxSolverInterface::KEEPCACHED_ROW ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::deleteCols(const int num, const int * columnIndices) { soplex_->removeCols( const_cast(columnIndices), num ); freeCachedData( OsiSpxSolverInterface::KEEPCACHED_ROW ); // took from OsiClp for updating names int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; if (num && nameDiscipline) { // Very clumsy (and inefficient) - need to sort and then go backwards in ? chunks int * indices = CoinCopyOfArray(columnIndices,num); std::sort(indices,indices+num); int num2 = num; while (num2) { int next = indices[num2-1]; int firstDelete = num2-1; int i; for (i = num2-2; i>=0; --i) { if (indices[i]+1 == next) { --next; firstDelete = i; } else { break; } } OsiSolverInterface::deleteColNames(indices[firstDelete],num2-firstDelete); num2 = firstDelete; assert (num2>=0); } delete [] indices; } } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { soplex::DSVector rowvec; rowvec.add( vec.getNumElements(), vec.getIndices(), vec.getElements() ); soplex_->addRow( soplex::LPRow( rowlb, rowvec, rowub ) ); freeCachedData( OsiSpxSolverInterface::KEEPCACHED_COLUMN ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { double rowlb = 0.0; double rowub = 0.0; convertSenseToBound( rowsen, rowrhs, rowrng, rowlb, rowub ); addRow( vec, rowlb, rowub ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::deleteRows(const int num, const int * rowIndices) { soplex_->removeRows( const_cast(rowIndices), num ); freeCachedData( OsiSpxSolverInterface::KEEPCACHED_COLUMN ); // took from OsiClp for updating names int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; if (num && nameDiscipline) { // Very clumsy (and inefficient) - need to sort and then go backwards in ? chunks int * indices = CoinCopyOfArray(rowIndices,num); std::sort(indices,indices+num); int num2=num; while (num2) { int next = indices[num2-1]; int firstDelete = num2-1; int i; for (i = num2-2; i>=0; --i) { if (indices[i]+1 == next) { --next; firstDelete = i; } else { break; } } OsiSolverInterface::deleteRowNames(indices[firstDelete],num2-firstDelete); num2 = firstDelete; assert(num2 >= 0); } delete [] indices; } } //############################################################################# // Methods to input a problem //############################################################################# void OsiSpxSolverInterface::loadProblem( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { int ncols = matrix.getNumCols(); int nrows = matrix.getNumRows(); const int *length = matrix.getVectorLengths(); const int *start = matrix.getVectorStarts(); const double *elem = matrix.getElements(); const int *index = matrix.getIndices(); double *thecollb, *thecolub, *theobj, *therowlb, *therowub; // create defaults if parameter is NULL if( collb == NULL ) { thecollb = new double[ncols]; CoinFillN( thecollb, ncols, 0.0 ); } else thecollb = const_cast(collb); if( colub == NULL ) { thecolub = new double[ncols]; CoinFillN( thecolub, ncols, getInfinity() ); } else thecolub = const_cast(colub); if( obj == NULL ) { theobj = new double[ncols]; CoinFillN( theobj, ncols, 0.0 ); } else theobj = const_cast(obj); if( rowlb == NULL ) { therowlb = new double[nrows]; CoinFillN( therowlb, nrows, -getInfinity() ); } else therowlb = const_cast(rowlb); if( rowub == NULL ) { therowub = new double[nrows]; CoinFillN( therowub, nrows, +getInfinity() ); } else therowub = const_cast(rowub); // copy problem into soplex_ soplex_->clear(); spxintvars_->clear(); freeCachedData( OsiSpxSolverInterface::KEEPCACHED_NONE ); if( matrix.isColOrdered() ) { int row, col, pos; soplex::LPRowSet rowset( nrows, 0 ); soplex::DSVector rowvec; soplex::LPColSet colset( ncols, matrix.getNumElements() ); soplex::DSVector colvec; /* insert empty rows */ rowvec.clear(); for( row = 0; row < nrows; ++row ) rowset.add( therowlb[row], rowvec, therowub[row] ); soplex_->addRows( rowset ); /* create columns */ for( col = 0; col < ncols; ++col ) { pos = start[col]; colvec.clear(); colvec.add( length[col], &(index[pos]), &(elem[pos]) ); colset.add( theobj[col], thecollb[col], colvec, thecolub[col] ); } soplex_->addCols( colset ); // soplex_->changeRange( soplex::Vector( nrows, therowlb ), soplex::Vector( nrows, therowub ) ); } else { int row, col, pos; soplex::LPRowSet rowset( nrows, matrix.getNumElements() ); soplex::DSVector rowvec; soplex::LPColSet colset( ncols, 0 ); soplex::DSVector colvec; /* insert empty columns */ colvec.clear(); for( col = 0; col < ncols; ++col ) colset.add( theobj[col], thecollb[col], colvec, thecolub[col] ); soplex_->addCols( colset ); /* create rows */ for( row = 0; row < nrows; ++row ) { pos = start[row]; rowvec.clear(); rowvec.add( length[row], &(index[pos]), &(elem[pos]) ); rowset.add( therowlb[row], rowvec, therowub[row] ); } soplex_->addRows( rowset ); // soplex_->changeObj( soplex::Vector( ncols, theobj ) ); // soplex_->changeBounds( soplex::Vector( ncols, thecollb ), soplex::Vector( ncols, thecolub ) ); } // switch sense to minimization problem soplex_->changeSense( soplex::SPxSolver::MINIMIZE ); // delete default arrays if neccessary if( collb == NULL ) delete[] thecollb; if( colub == NULL ) delete[] thecolub; if( obj == NULL ) delete[] theobj; if( rowlb == NULL ) delete[] therowlb; if( rowub == NULL ) delete[] therowub; } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub ) { loadProblem( *matrix, collb, colub, obj, rowlb, rowub ); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowlb; rowlb = 0; delete[] rowub; rowub = 0; } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::loadProblem( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { int nrows = matrix.getNumRows(); double* rowlb = new double[nrows]; double* rowub = new double[nrows]; int row; char *therowsen; double *therowrhs, *therowrng; if( rowsen == NULL ) { therowsen = new char[nrows]; CoinFillN( therowsen, nrows, 'G' ); } else therowsen = const_cast(rowsen); if( rowrhs == NULL ) { therowrhs = new double[nrows]; CoinFillN( therowrhs, nrows, 0.0 ); } else therowrhs = const_cast(rowrhs); if( rowrng == NULL ) { therowrng = new double[nrows]; CoinFillN( therowrng, nrows, 0.0 ); } else therowrng = const_cast(rowrng); for( row = 0; row < nrows; ++row ) convertSenseToBound( therowsen[row], therowrhs[row], therowrng[row], rowlb[row], rowub[row] ); loadProblem( matrix, collb, colub, obj, rowlb, rowub ); if( rowsen == NULL ) delete[] therowsen; if( rowrhs == NULL ) delete[] therowrhs; if( rowrng == NULL ) delete[] therowrng; delete[] rowlb; delete[] rowub; } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng ) { loadProblem( *matrix, collb, colub, obj, rowsen, rowrhs, rowrng ); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowsen; rowsen = 0; delete[] rowrhs; rowrhs = 0; delete[] rowrng; rowrng = 0; } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { int col, pos; soplex::LPColSet colset( numcols, start[numcols] ); soplex::DSVector colvec; soplex_->clear(); spxintvars_->clear(); freeCachedData( OsiSpxSolverInterface::KEEPCACHED_NONE ); for( col = 0; col < numcols; ++col ) { pos = start[col]; colvec.clear(); colvec.add( start[col+1] - pos, &(index[pos]), &(value[pos]) ); colset.add( obj[col], collb[col], colvec, colub[col] ); } soplex_->addCols( colset ); soplex_->changeRange( soplex::Vector( numrows, const_cast(rowlb) ), soplex::Vector( numrows, const_cast(rowub) ) ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { double* rowlb = new double[numrows]; double* rowub = new double[numrows]; int row; for( row = 0; row < numrows; ++row ) convertSenseToBound( rowsen != NULL ? rowsen[row] : 'G', rowrhs != NULL ? rowrhs[row] : 0.0, rowrng != NULL ? rowrng[row] : 0.0, rowlb[row], rowub[row] ); loadProblem( numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub ); delete[] rowlb; delete[] rowub; } //----------------------------------------------------------------------------- // Read mps files //----------------------------------------------------------------------------- int OsiSpxSolverInterface::readMps( const char * filename, const char * extension ) { #if 0 std::string f(filename); std::string e(extension); std::string fullname = f + "." + e; std::ifstream file(fullname.c_str()); if (!file.good()) { std::cerr << "Error opening file " << fullname << " for reading!" << std::endl; return 1; } soplex_->clear(); if( !soplex_->readMPS(file, NULL, NULL, NULL) ) throwSPXerror( "error reading file <" + fullname + ">", "readMps" ); #endif // we preserve the objective sense independent of the problem which is read soplex::SPxLP::SPxSense objsen = soplex_->spxSense(); int retval = OsiSolverInterface::readMps(filename,extension); soplex_->changeSense(objsen); return retval; } //----------------------------------------------------------------------------- // Write mps files //----------------------------------------------------------------------------- void OsiSpxSolverInterface::writeMps( const char * filename, const char * extension, double objSense) const { std::string f(filename); std::string e(extension); std::string fullname = f+"."+e; std::ofstream file(fullname.c_str()); if (!file.good()) { std::cerr << "Error opening file " << fullname << " for writing!" << std::endl; return; } soplex::DIdxSet integers(getNumIntegers()); for (int i = 0; i < getNumCols(); ++i) if (isInteger(i)) integers.addIdx(i); soplex_->writeMPS(file, NULL, NULL, &integers); } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiSpxSolverInterface::OsiSpxSolverInterface () : OsiSolverInterface(), #if SOPLEX_VERSION >= 220 spxout_(new soplex::SPxOut), soplex_(new soplex::SoPlex(*spxout_, soplex::SPxSolver::ENTER, soplex::SPxSolver::COLUMN)), // default is primal simplex algorithm #else spxout_(NULL), soplex_(new soplex::SoPlex(soplex::SPxSolver::ENTER, soplex::SPxSolver::COLUMN)), // default is primal simplex algorithm #endif spxintvars_(new soplex::DIdxSet()), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(1000000), // ??? default iteration limit for strong branching is large obj_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL) { #if SOPLEX_VERSION >= 220 #ifndef NDEBUG spxout_->setVerbosity(soplex::SPxOut::INFO1); #else spxout_->setVerbosity(soplex::SPxOut::DEBUG); #endif #else #ifndef NDEBUG soplex::Param::setVerbose( 3 ); #else soplex::Param::setVerbose( 2 ); #endif #endif // SoPlex default objective sense is maximization, thus we explicitly set it to minimization soplex_->changeSense( soplex::SPxLP::MINIMIZE ); } //---------------------------------------------------------------- // Clone //---------------------------------------------------------------- OsiSolverInterface * OsiSpxSolverInterface::clone(bool copyData) const { return( new OsiSpxSolverInterface( *this ) ); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiSpxSolverInterface::OsiSpxSolverInterface( const OsiSpxSolverInterface & source ) : OsiSolverInterface(source), soplex_(new soplex::SoPlex(*source.soplex_)), spxintvars_(new soplex::DIdxSet(*source.spxintvars_)), hotStartCStat_(NULL), hotStartCStatSize_(0), hotStartRStat_(NULL), hotStartRStatSize_(0), hotStartMaxIteration_(source.hotStartMaxIteration_), obj_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), colsol_(NULL), rowsol_(NULL), redcost_(NULL), rowact_(NULL), matrixByRow_(NULL), matrixByCol_(NULL) { if (source.colsol_ != NULL) setColSolution(source.getColSolution()); if (source.rowsol_ != NULL) setRowPrice(source.getRowPrice()); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiSpxSolverInterface::~OsiSpxSolverInterface () { freeAllMemory(); } //------------------------------------------------------------------- // SPX specific public interfaces //------------------------------------------------------------------- soplex::SoPlex* OsiSpxSolverInterface::getLpPtr( int keepCached ) { freeCachedData( keepCached ); return soplex_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiSpxSolverInterface& OsiSpxSolverInterface::operator=( const OsiSpxSolverInterface& source ) { if (this != &source) { freeAllMemory(); OsiSolverInterface::operator=( source ); spxintvars_ = new soplex::DIdxSet(*source.spxintvars_); soplex_ = new soplex::SoPlex(*source.soplex_); if (source.colsol_ != NULL) setColSolution(source.getColSolution()); if (source.rowsol_ != NULL) setRowPrice(source.getRowPrice()); hotStartMaxIteration_ = source.hotStartMaxIteration_; } return *this; } //############################################################################# // Applying cuts //############################################################################# void OsiSpxSolverInterface::applyColCut( const OsiColCut & cc ) { const double * soplexColLB = getColLower(); const double * soplexColUB = getColUpper(); const CoinPackedVector & lbs = cc.lbs(); const CoinPackedVector & ubs = cc.ubs(); int i; for( i = 0; i < lbs.getNumElements(); ++i ) if ( lbs.getElements()[i] > soplexColLB[lbs.getIndices()[i]] ) setColLower( lbs.getIndices()[i], lbs.getElements()[i] ); for( i = 0; i < ubs.getNumElements(); ++i ) if ( ubs.getElements()[i] < soplexColUB[ubs.getIndices()[i]] ) setColUpper( ubs.getIndices()[i], ubs.getElements()[i] ); } //----------------------------------------------------------------------------- void OsiSpxSolverInterface::applyRowCut( const OsiRowCut & rowCut ) { addRow( rowCut.row(), rowCut.lb(), rowCut.ub() ); } //############################################################################# // Private methods (non-static and static) //############################################################################# //------------------------------------------------------------------- /// free cached vectors void OsiSpxSolverInterface::freeCachedColRim() { delete obj_; obj_ = NULL; } void OsiSpxSolverInterface::freeCachedRowRim() { freeCacheChar ( rowsense_ ); freeCacheDouble( rhs_ ); freeCacheDouble( rowrange_ ); assert( rowsense_ == NULL ); assert( rhs_ == NULL ); assert( rowrange_ == NULL ); } void OsiSpxSolverInterface::freeCachedMatrix() { freeCacheMatrix( matrixByRow_ ); freeCacheMatrix( matrixByCol_ ); assert( matrixByRow_ == NULL ); assert( matrixByCol_ == NULL ); } void OsiSpxSolverInterface::freeCachedResults() { delete colsol_; delete rowsol_; delete redcost_; delete rowact_; colsol_ = NULL; rowsol_ = NULL; redcost_ = NULL; rowact_ = NULL; } void OsiSpxSolverInterface::freeCachedData( int keepCached ) { if( !(keepCached & OsiSpxSolverInterface::KEEPCACHED_COLUMN) ) freeCachedColRim(); if( !(keepCached & OsiSpxSolverInterface::KEEPCACHED_ROW) ) freeCachedRowRim(); if( !(keepCached & OsiSpxSolverInterface::KEEPCACHED_MATRIX) ) freeCachedMatrix(); if( !(keepCached & OsiSpxSolverInterface::KEEPCACHED_RESULTS) ) freeCachedResults(); } void OsiSpxSolverInterface::freeAllMemory() { freeCachedData(); delete[] reinterpret_cast(hotStartCStat_); delete[] reinterpret_cast(hotStartRStat_); hotStartCStat_ = NULL; hotStartCStatSize_ = 0; hotStartRStat_ = NULL; hotStartRStatSize_ = 0; delete soplex_; #if SOPLEX_VERSION >= 220 delete spxout_; #endif delete spxintvars_; } CoinMP-1.8.3/Osi/src/OsiSpx/OsiSpxSolverInterface.hpp0000644000175000017500000007006612536245674021063 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for SoPlex >= 1.4.2c // authors: Tobias Pfender // Ambros Gleixner // Wei Huang // Konrad-Zuse-Zentrum Berlin (Germany) // email: pfender@zib.de // date: 01/16/2002 // license: this file may be freely distributed under the terms of the EPL //----------------------------------------------------------------------------- // Copyright (C) 2002, Tobias Pfender, International Business Machines // Corporation and others. All Rights Reserved. // Last edit: $Id: OsiSpxSolverInterface.hpp 2019 2015-06-11 08:50:04Z stefan $ #ifndef OsiSpxSolverInterface_H #define OsiSpxSolverInterface_H #include #include "OsiSolverInterface.hpp" #include "CoinWarmStartBasis.hpp" #ifndef _SOPLEX_H_ /* forward declarations so the header can be compiled without having to include soplex.h * however, these declaration work only for SoPlex < 2.0, so we do them only if soplex.h hasn't been included already */ namespace soplex { class DIdxSet; class DVector; class SPxOut; class SoPlex; } #endif /** SoPlex Solver Interface Instantiation of OsiSpxSolverInterface for SoPlex */ class OsiSpxSolverInterface : virtual public OsiSolverInterface { friend void OsiSpxSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound(); //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; // Set timelimit void setTimeLimit(double value); // Get timelimit double getTimeLimit() const; //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; // Is the given primal objective limit reached? - use implementation from OsiSolverInterface /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; /// Time limit reached? virtual bool isTimeLimitReached() const; //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ //@{ /// Get empty warm start object inline CoinWarmStart *getEmptyWarmStart () const { return (dynamic_cast(new CoinWarmStartBasis())) ; } /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching).
    The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
    NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const; /// Get number of rows virtual int getNumRows() const; /// Get number of nonzero elements virtual int getNumElements() const; /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const; /** Get pointer to array[getNumRows()] of row constraint senses.
    • 'L': <= constraint
    • 'E': = constraint
    • 'G': >= constraint
    • 'R': ranged constraint
    • 'N': free constraint
    */ virtual const char * getRowSense() const; /** Get pointer to array[getNumRows()] of rows right-hand sides
    • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
    • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'N' then rhs()[i] == 0.0
    */ virtual const double * getRightHandSide() const; /** Get pointer to array[getNumRows()] of row ranges.
    • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
    • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
    */ virtual const double * getRowRange() const; /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const; /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const; /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const; /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const; /// Return true if column is continuous virtual bool isContinuous(int colNumber) const; #if 0 /// Return true if column is binary virtual bool isBinary(int columnNumber) const; /** Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ virtual bool isInteger(int columnNumber) const; /// Return true if column is general integer virtual bool isIntegerNonBinary(int columnNumber) const; /// Return true if column is binary and not fixed at either bound virtual bool isFreeBinary(int columnNumber) const; #endif /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const; //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const; /// Get objective function value virtual double getObjValue() const; /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const; /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay=false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; #if 0 /** Get vector of indices of solution which are integer variables presently at fractional values */ virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const; #endif //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ); /** Set a single column lower bound
    Use -COIN_DBL_MAX for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ); /** Set a single column upper bound
    Use COIN_DBL_MAX for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound
    The default implementation just invokes setColLower and setColUpper */ virtual void setColBounds( int elementIndex, double lower, double upper ); #if 0 // we are using the default implementation of OsiSolverInterface /** Set the bounds on a number of columns simultaneously
    The default implementation just invokes setCollower and setColupper over and over again. @param [indexfirst,indexLast) contains the indices of the constraints whose either bound changes @param indexList the indices of those variables @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); #endif /** Set a single row lower bound
    Use -COIN_DBL_MAX for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
    Use COIN_DBL_MAX for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ); /** Set a single row lower and upper bound
    The default implementation just invokes setRowUower and setRowUpper */ virtual void setRowBounds( int elementIndex, double lower, double upper ); /** Set the type of a single row
    */ virtual void setRowType(int index, char sense, double rightHandSide, double range); #if 0 // we are using the default implementation of OsiSolverInterface /** Set the bounds on a number of rows simultaneously
    The default implementation just invokes setRowlower and setRowupper over and over again. @param [indexfirst,indexLast) contains the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
    The default implementation just invokes setRowtype and over and over again. @param [indexfirst,indexLast) contains the indices of the constraints whose type changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); #endif //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); #if 0 // we are using the default implementation of OsiSolverInterface /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); #endif //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s); /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
    Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); #if 0 // we are using the default implementation of OsiSolverInterface /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); #endif /** */ virtual void deleteCols(const int num, const int * colIndices); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); #if 0 // we are using the default implementation of OsiSolverInterface /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); #endif /** */ virtual void deleteRows(const int num, const int * rowIndices); #if 0 // we are using the default implementation of OsiSolverInterface //----------------------------------------------------------------------- /** Apply a collection of cuts.
    Only cuts which have an effectiveness >= effectivenessLb are applied.
    • ReturnCode.numberIneffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
    • ReturnCode.numberInconsistent() -- number of invalid cuts
    • ReturnCode.numberInconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
    • ReturnCode.numberInfeasible() -- number of cuts that would make this integer model infeasible
    • ReturnCode.numberApplied() -- number of integer cuts which were applied to the integer model
    • cs.size() == numberIneffective() + numberInconsistent() + numberInconsistentWrtIntegerModel() + numberInfeasible() + nubmerApplied()
    */ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); #endif //@} //@} //--------------------------------------------------------------------------- /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • obj: all variables have 0 objective coefficient
    • rowsen: all rows are >=
    • rowrhs: all right hand sides are 0
    • rowrng: 0 for the ranged rows
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Read an mps file from the given filename */ virtual int readMps(const char *filename, const char *extension = "mps"); /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; //@} //--------------------------------------------------------------------------- /**@name Constructors and destructor */ //@{ /// Default Constructor OsiSpxSolverInterface(); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiSpxSolverInterface( const OsiSpxSolverInterface& ); /// Assignment operator OsiSpxSolverInterface& operator=( const OsiSpxSolverInterface& rhs ); /// Destructor virtual ~OsiSpxSolverInterface(); //@} enum keepCachedFlag { /// discard all cached data (default) KEEPCACHED_NONE = 0, /// column information: objective values, lower and upper bounds, variable types KEEPCACHED_COLUMN = 1, /// row information: right hand sides, ranges and senses, lower and upper bounds for row KEEPCACHED_ROW = 2, /// problem matrix: matrix ordered by column and by row KEEPCACHED_MATRIX = 4, /// LP solution: primal and dual solution, reduced costs, row activities KEEPCACHED_RESULTS = 8, /// only discard cached LP solution KEEPCACHED_PROBLEM = KEEPCACHED_COLUMN | KEEPCACHED_ROW | KEEPCACHED_MATRIX, /// keep all cached data (similar to getMutableLpPtr()) KEEPCACHED_ALL = KEEPCACHED_PROBLEM | KEEPCACHED_RESULTS, /// free only cached column and LP solution information FREECACHED_COLUMN = KEEPCACHED_PROBLEM & ~KEEPCACHED_COLUMN, /// free only cached row and LP solution information FREECACHED_ROW = KEEPCACHED_PROBLEM & ~KEEPCACHED_ROW, /// free only cached matrix and LP solution information FREECACHED_MATRIX = KEEPCACHED_PROBLEM & ~KEEPCACHED_MATRIX, /// free only cached LP solution information FREECACHED_RESULTS = KEEPCACHED_ALL & ~KEEPCACHED_RESULTS }; soplex::SoPlex* getLpPtr( int keepCached = KEEPCACHED_NONE ); soplex::SPxOut* getSPxOut() { return spxout_; } protected: /**@name Protected methods */ //@{ /// Apply a row cut. Return true if cut was applied. virtual void applyRowCut( const OsiRowCut & rc ); /** Apply a column cut (bound adjustment). Return true if cut was applied. */ virtual void applyColCut( const OsiColCut & cc ); //@} /**@name Protected member data */ //@{ /// SoPlex output object soplex::SPxOut *spxout_; /// SoPlex solver object soplex::SoPlex *soplex_; //@} private: /**@name Private methods */ //@{ /// free cached column rim vectors void freeCachedColRim(); /// free cached row rim vectors void freeCachedRowRim(); /// free cached result vectors void freeCachedResults(); /// free cached matrices void freeCachedMatrix(); /// free all cached data (except specified entries, see getLpPtr()) void freeCachedData( int keepCached = KEEPCACHED_NONE ); /// free all allocated memory void freeAllMemory(); //@} /**@name Private member data */ //@{ /// indices of integer variables soplex::DIdxSet *spxintvars_; /// Hotstart information void* hotStartCStat_; int hotStartCStatSize_; void* hotStartRStat_; int hotStartRStatSize_; int hotStartMaxIteration_; /**@name Cached information derived from the SoPlex model */ //@{ /// Pointer to objective Vector mutable soplex::DVector *obj_; /// Pointer to dense vector of row sense indicators mutable char *rowsense_; /// Pointer to dense vector of row right-hand side values mutable double *rhs_; /// Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) mutable double *rowrange_; /// Pointer to primal solution vector mutable soplex::DVector *colsol_; /// Pointer to dual solution vector mutable soplex::DVector *rowsol_; /// Pointer to reduced cost vector mutable soplex::DVector *redcost_; /// Pointer to row activity (slack) vector mutable soplex::DVector *rowact_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByRow_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByCol_; //@} //@} }; //############################################################################# /** A function that tests the methods in the OsiSpxSolverInterface class. */ void OsiSpxSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Osi/src/OsiSpx/osi-soplex.pc.in0000644000175000017500000000051211564020404017107 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiSoplex Description: COIN-OR Open Solver Interface for SoPlex URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiSpx @OSISPXLIB_PCLIBS@ Cflags: -I${includedir} Requires: osi @OSISPXLIB_PCREQUIRES@ CoinMP-1.8.3/Osi/src/OsiGlpk/0000755000175000017500000000000012600453455014211 5ustar renereneCoinMP-1.8.3/Osi/src/OsiGlpk/Makefile.in0000644000175000017500000005527212506051753016271 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/OsiGlpk DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Osi/config.h \ $(top_builddir)/src/Osi/config_osi.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libOsiGlpk_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) \ @DEPENDENCY_LINKING_TRUE@ ../Osi/libOsi.la am_libOsiGlpk_la_OBJECTS = OsiGlpkSolverInterface.lo libOsiGlpk_la_OBJECTS = $(am_libOsiGlpk_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsiGlpk_la_SOURCES) DIST_SOURCES = $(libOsiGlpk_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiGlpk # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiGlpk.la # List all source files for this library, including headers libOsiGlpk_la_SOURCES = \ OsiGlpkSolverInterface.cpp OsiGlpkSolverInterface.hpp # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libOsiGlpk_la_LIBADD = $(OSILIB_LIBS) ../Osi/libOsi.la # This is for libtool libOsiGlpk_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../Osi` $(COINUTILS_CFLAGS) $(GLPK_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiGlpkSolverInterface.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/OsiGlpk/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/OsiGlpk/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsiGlpk.la: $(libOsiGlpk_la_OBJECTS) $(libOsiGlpk_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsiGlpk_la_LDFLAGS) $(libOsiGlpk_la_OBJECTS) $(libOsiGlpk_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiGlpkSolverInterface.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool 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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # 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: CoinMP-1.8.3/Osi/src/OsiGlpk/Makefile.am0000644000175000017500000000330612243462564016253 0ustar renerene# Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1942 2013-11-21 19:56:36Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiGlpk # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiGlpk.la # List all source files for this library, including headers libOsiGlpk_la_SOURCES = \ OsiGlpkSolverInterface.cpp OsiGlpkSolverInterface.hpp # List all additionally required libraries if DEPENDENCY_LINKING libOsiGlpk_la_LIBADD = $(OSILIB_LIBS) ../Osi/libOsi.la endif # This is for libtool libOsiGlpk_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../Osi` $(COINUTILS_CFLAGS) $(GLPK_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiGlpkSolverInterface.hpp CoinMP-1.8.3/Osi/src/OsiGlpk/OsiGlpkSolverInterface.cpp0000644000175000017500000027121412126117465021311 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for GLPK //----------------------------------------------------------------------------- // Copyright (C) 2001, 2002 Vivian De Smedt // Copyright (C) 2002, 2003 Braden Hunsaker // Copyright (C) 2003, 2004 University of Pittsburgh // Copyright (C) 2004 Joseph Young // Copyright (C) 2007 Lou Hafer // University of Pittsburgh coding done by Brady Hunsaker // All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // // Comments: // // Areas that may need work in the code are marked with '???'. // // As of version 4.7, GLPK problems can be of class LPX_LP or LPX_MIP. // The difference is that LPX_MIP problems have a separate MIP data block, // and certain functions are only allowed for LPX_MIP problems. // // In (much) earlier versions of GLPK, if an LPX_MIP problem was // changed back into a LPX_LP problem, then the MIP data was lost, // including which columns are integer. However, LPX_MIP problems // still had access to LP information (like lpx_get_status). // // It appears that this behavior is no longer true in version 4.7. // Therefore it may be worthwhile to adjust the interface to change // the class of the problem as needed. For the time being, however, // all OSI problems are set to type LPX_MIP. The only trick is // differentiating when the user calls status routines like // isProvenOptimal(). For now, we assume that the user is referring // to the most recent solution call. We add an extra variable, // bbWasLast_, to the class to record which solution call was most // recent (lp or mip). // // Possible areas of improvement // ----------------------------- // // Methods that are not implemented: // // getPrimalRays, getDualRays // // Methods that are implemented, but do not do what you probably expect: // // setColSolution, setRowPrice // // Many methods have not been attempted to be improved (for speed) // to take advantage of how GLPK works. The emphasis has been on // making things functional and not too messy. There's plenty of room // for more efficient implementations. // /* Various bits and pieces of knowledge that are handy when working on OsiGlpk. Glpk uses 1-based indexing. Be careful. Primal and dual solutions may be set by the user. This means that getColSolution and getRowPrice are obliged to return the cached solution vector whenever it's available. Various other routines which calculate values based on primal and dual solutions must also use the cached vectors. On the other hand, we don't want to be rebuilding the cache with every call to the solver. The approach is that a call to the solver removes the cached values. Subsequent calls to retrieve solution values will repopulate the cache by interrogating glpk. */ #include #include #include #include #include extern "C" { #include "glpk.h" } #ifndef GLP_PROB_DEFINED #define GLP_PROB_DEFINED #endif #include "CoinError.hpp" #include "CoinPragma.hpp" #include "OsiConfig.h" #include "OsiGlpkSolverInterface.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" /* Grab the COIN standard finite infinity from CoinFinite.hpp. Also set a zero tolerance, so we can set clean zeros in computed reduced costs and row activities. The value 1.0e-9 is lifted from glpk --- this is the value that it uses when the LPX_K_ROUND parameter is active. */ #include "CoinFinite.hpp" namespace { const double CoinInfinity = COIN_DBL_MAX ; const double GlpkZeroTol = 1.0e-9 ; } /* Cut names down to a reasonable size. */ #define OGSI OsiGlpkSolverInterface /* A few defines to control execution tracing. OGSI_TRACK_SOLVERS track creation, copy, deletion of OGSI objects OGSI_TRACK_FRESH track how a solution is made stale/fresh OGSI_VERBOSITY enables warnings when > 0; probably should be converted to honest messages for message handler */ #define OGSI_TRACK_SOLVERS 0 #define OGSI_TRACK_FRESH 0 #define OGSI_VERBOSITY 0 //############################################################################# // File-local methods //############################################################################# namespace { /* Convenience routine for generating error messages. Who knows, maybe it'll get used eventually :-). */ inline void checkGLPKerror (int err, std::string glpkfuncname, std::string osimethod) { if (err != 0) { char s[100] ; sprintf(s,"%s returned error %d",glpkfuncname.c_str(),err) ; std::cout << "ERROR: " << s << " (" << osimethod << " in OsiGlpkSolverInterface)" << std::endl ; throw CoinError(s,osimethod.c_str(),"OsiGlpkSolverInterface") ; } return ; } } // end file-local namespace //############################################################################# // Solve methods //############################################################################# /* Solve an LP from scratch. */ void OGSI::initialSolve() { # if OGSI_TRACK_FRESH > 0 std::cout << "OGSI(" << std::hex << this << std::dec << ")::initialSolve." << std::endl ; # endif LPX *model = getMutableModelPtr() ; /* Prep. Toss any cached solution information. */ freeCachedData(OGSI::FREECACHED_RESULTS) ; /* Solve the lp. */ int err = lpx_simplex(model) ; // for Glpk, a solve fails if the initial basis is invalid or singular // thus, we construct a (advanced) basis first and try again #ifdef LPX_E_BADB if (err == LPX_E_BADB) { lpx_adv_basis(model); err = lpx_simplex(model) ; } else #endif if (err == LPX_E_SING || err == LPX_E_FAULT) { lpx_adv_basis(model); err = lpx_simplex(model) ; } iter_used_ = lpx_get_int_parm(model, LPX_K_ITCNT) ; /* Sort out the various state indications. When the presolver is turned on, lpx_simplex() will not be able to tell whether the objective function has hit it's upper or lower limit, and does not return OBJLL or OBJUL. The code for these cases should be beefed up to check the objective against the limit. The codes NOPFS and NODFS are returned only when the presolver is used. If we ever reach the default case, we're deeply confused. */ isIterationLimitReached_ = false ; isTimeLimitReached_ = false; isAbandoned_ = false ; isPrimInfeasible_ = false ; isDualInfeasible_ = false ; isFeasible_ = false ; isObjLowerLimitReached_ = false ; isObjUpperLimitReached_ = false ; switch (err) { case LPX_E_OK: { break ; } case LPX_E_ITLIM: { isIterationLimitReached_ = true ; break ; } case LPX_E_OBJLL: { isObjLowerLimitReached_ = true ; break ; } case LPX_E_OBJUL: { isObjUpperLimitReached_ = true ; break ; } case LPX_E_TMLIM: { isTimeLimitReached_ = true ; } // no break here, so we still report abandoned case LPX_E_FAULT: case LPX_E_SING: #ifdef LPX_E_BADB case LPX_E_BADB: #endif { isAbandoned_ = true ; break ; } case LPX_E_NOPFS: { isPrimInfeasible_ = true ; break ; } case LPX_E_NODFS: { isDualInfeasible_ = true ; break ; } default: { assert(false) ; } } switch (lpx_get_status(model)) { case LPX_OPT: case LPX_FEAS: { isFeasible_ = true ; break ; } default: { } } // Record that simplex was most recent bbWasLast_ = 0 ; return ; } //----------------------------------------------------------------------------- void OGSI::resolve() { # if OGSI_TRACK_FRESH > 0 std::cout << "OGSI(" << std::hex << this << std::dec << ")::resolve." << std::endl ; # endif LPX *model = getMutableModelPtr() ; freeCachedData(OGSI::FREECACHED_RESULTS) ; // lpx_simplex will use the current basis if possible int err = lpx_simplex(model) ; // for Glpk, a solve fails if the initial basis is invalid or singular // thus, we construct a (advanced) basis first and try again #ifdef LPX_E_BADB if (err == LPX_E_BADB) { lpx_adv_basis(model); err = lpx_simplex(model) ; } else #endif if (err == LPX_E_SING || err == LPX_E_FAULT) { lpx_adv_basis(model); err = lpx_simplex(model) ; } iter_used_ = lpx_get_int_parm(model,LPX_K_ITCNT) ; isIterationLimitReached_ = false ; isTimeLimitReached_ = false ; isAbandoned_ = false ; isObjLowerLimitReached_ = false ; isObjUpperLimitReached_ = false ; isPrimInfeasible_ = false ; isDualInfeasible_ = false ; isFeasible_ = false ; switch (err) { case LPX_E_OK: { break ; } case LPX_E_ITLIM: { isIterationLimitReached_ = true ; break ; } case LPX_E_OBJLL: { isObjLowerLimitReached_ = true ; break ; } case LPX_E_OBJUL: { isObjUpperLimitReached_ = true ; break ; } case LPX_E_TMLIM: { isTimeLimitReached_ = true ; } // no break here, so we still report abandoned case LPX_E_FAULT: case LPX_E_SING: #ifdef LPX_E_BADB case LPX_E_BADB: #endif { isAbandoned_ = true ; break ; } case LPX_E_NOPFS: { isPrimInfeasible_ = true ; break ; } case LPX_E_NODFS: { isDualInfeasible_ = true ; break ; } default: { assert(false) ; } } switch (lpx_get_status(model)) { case LPX_OPT: case LPX_FEAS: { isFeasible_ = true ; break ; } default: { } } // Record that simplex was most recent bbWasLast_ = 0 ; return ; } //----------------------------------------------------------------------------- /* Call glpk's built-in MIP solver. Any halfway recent version (from glpk 4.4, at least) will have lpx_intopt, a branch-and-cut solver. The presence of cut generators is more recent. */ void OGSI::branchAndBound () { LPX *model = getMutableModelPtr() ; /* Destroy cached data. */ freeCachedData(OGSI::FREECACHED_RESULTS) ; /* Assuming we have integer variables in the model, call the best MIP solver we can manage. lpx_intopt does not require an optimal LP solution as a starting point, so we can call it directly. lpx_integer needs an initial optimal solution to the relaxation. */ if (lpx_get_num_int(model)) { int err = LPX_E_FAULT ; # ifdef GLPK_HAS_INTOPT err = lpx_intopt(model) ; # else if (lpx_get_status(model) != LPX_OPT) { initialSolve() ; } err = lpx_integer(model) ; # endif /* We have a result. What is it? Start with a positive attitude and revise as needed. The various LPX_E_* and LPX_I_* defines are stable back as far as glpk-4.4. When we get LPX_E_OK (MIP terminated normally), we need to look more closely. LPX_I_OPT indicates a proven optimal integer solution. LPX_I_NOFEAS indicates that there is no integer feasible solution. LPX_I_UNDEF says the MIP solution is undefined. LPX_I_FEAS says that in integer feasible solution was found but not proven optimal (termination of search due to some limit is the common cause). It's not clear what to do with LPX_I_UNDEF; currently, it is not really reflected in termination status. LPX_I_FEAS is reflected by the OsiGlpk specific method isFeasible(). Various other codes are returned by lpx_intopt (lpx_integer returns a subset of these). LPX_E_NOPFS (LPX_E_NODFS) indicate no primal (dual) feasible solution; detected at the root, either by presolve or when attempting the root relaxation. LPX_E_ITLIM (LPX_E_TMLIM) indicate iteration (time) limit reached. Osi doesn't provide for time limit, so lump it in with iteration limit (an arguable choice, but seems better than the alternatives) and have extra method isTimeLimitReached(). LPX_E_SING (lp solver failed due to singular basis) is legimately characterised as abandoned. LPX_E_FAULT indicates a structural problem (problem not of class MIP, or an integer variable has a non-integer bound), which really translates into internal confusion in OsiGlpk. Previous comments expressed uncertainty about the iteration count. This should be checked at some point. -- lh, 070709 -- */ iter_used_ = lpx_get_int_parm(model,LPX_K_ITCNT) ; isIterationLimitReached_ = false ; isTimeLimitReached_ = false ; isAbandoned_ = false ; isPrimInfeasible_ = false ; isDualInfeasible_ = false ; isFeasible_ = false ; isObjLowerLimitReached_ = false ; isObjUpperLimitReached_ = false ; switch (err) { case LPX_E_OK: #ifdef LPX_E_MIPGAP case LPX_E_MIPGAP: #endif { break ; } case LPX_E_NOPFS: { isPrimInfeasible_ = true ; break ; } case LPX_E_NODFS: { isDualInfeasible_ = true ; break ; } case LPX_E_TMLIM: { isTimeLimitReached_ = true ; } // no break case LPX_E_ITLIM: { isIterationLimitReached_ = true ; break ; } case LPX_E_SING: { isAbandoned_ = true ; break ; } case LPX_E_FAULT: { assert(false) ; break ; } default: { assert(false) ; break ; } } //check this also if err!=LPX_E_OPT, so we know about feasibility in case time/resource limit is reached int mip_status = lpx_mip_status(model) ; switch (mip_status) { case LPX_I_OPT: { isFeasible_ = true ; break ; } case LPX_I_NOFEAS: { isPrimInfeasible_ = true ; break ; } case LPX_I_UNDEF: { break ; } case LPX_I_FEAS: { isFeasible_ = true ; break ; } default: { assert(false) ; break ; } } /* The final action is to note that our last call to glpk was the MIP solver. */ bbWasLast_ = 1 ; } /* Not a MIP (no integer variables). Call the LP solver. Since we can call branchAndBound with no initial LP solution, initialSolve is appropriate here. (But for glpk, it actually makes no difference --- lpx_simplex makes the decision on how to proceed.) */ else { initialSolve() ; } return ; } //############################################################################# // Parameter related methods //############################################################################# /* When we set parameters, we have to stash them locally as well as pushing them into the LPX object. The trouble comes when loading a new problem. If the LPX object is already loaded with a problem, the easiest approach is to simply delete it and start fresh. But then we lose all the parameters that are held in the LPX object. By keeping a copy, we have a way to recover. Really, we should be keeping these values in the OSI base class arrays, but the amount of storage involved is too small to provide motivation to change from the present setup. */ bool OGSI::setIntParam (OsiIntParam key, int value) { bool retval = false ; switch (key) { case OsiMaxNumIteration: { if (value >= 0) { maxIteration_ = value ; lpx_set_int_parm(lp_,LPX_K_ITLIM,value) ; retval = true ; } else { retval = false ; } break ; } case OsiMaxNumIterationHotStart: { if (value >= 0) { hotStartMaxIteration_ = value ; retval = true ; } else { retval = false ; } break ; } case OsiNameDiscipline: { if (value < 0 || value > 3) { retval = false ; } else { nameDisc_ = value ; retval = true ; } break ; } case OsiLastIntParam: { retval = false ; break ; } } return (retval) ; } //----------------------------------------------------------------------------- /* Self-protection is required here --- glpk will fault if handed a value it doesn't like. */ bool OGSI::setDblParam (OsiDblParam key, double value) { bool retval = false ; switch (key) { case OsiDualObjectiveLimit: // as of 4.7, GLPK only uses this if it does dual simplex { dualObjectiveLimit_ = value ; if (getObjSense() == 1) // minimization { lpx_set_real_parm(lp_,LPX_K_OBJUL,value) ; } else // maximization { lpx_set_real_parm(lp_,LPX_K_OBJLL,value) ; } retval = true ; break ; } case OsiPrimalObjectiveLimit: // as of 4.7, GLPK only uses this if it does dual simplex { primalObjectiveLimit_ = value ; if (getObjSense() == 1) { lpx_set_real_parm(lp_,LPX_K_OBJLL,value) ; } else { lpx_set_real_parm(lp_,LPX_K_OBJUL,value) ; } retval = true ; break ; } case OsiDualTolerance: { if (value >= 0 && value <= .001) { dualTolerance_ = value; lpx_set_real_parm(lp_,LPX_K_TOLDJ,value) ; retval = true ; } else { retval = false ; } break ; } case OsiPrimalTolerance: { if (value >= 0 && value <= .001) { primalTolerance_ = value ; lpx_set_real_parm(lp_,LPX_K_TOLBND,value) ; retval = true ; } else { retval = false ; } break ; } case OsiObjOffset: { objOffset_ = value ; lpx_set_obj_coef(lp_,0,value) ; retval = true ; break ; } case OsiLastDblParam: { retval = false ; break ; } } return (retval) ; } //----------------------------------------------------------------------------- bool OGSI::setStrParam (OsiStrParam key, const std::string &value) { bool retval = false ; switch (key) { case OsiProbName: { probName_ = value ; if (probName_.length() == 0) probName_ = "Pb"; lpx_set_prob_name(lp_,const_cast(value.c_str())) ; retval = true ; break ; } case OsiSolverName: { retval = true ; break ; } case OsiLastStrParam: { break ; } } return (retval) ; } //----------------------------------------------------------------------------- namespace { /*! A helper routine to deal with hints where glpk lacks any flexibility --- the facility is unimplemented, or always on. Failure is defined as OsiForceDo in the wrong direction; in this case an error is thrown. If the routine returns, then either the hint is compatible with glpk's capabilities, or it can be ignored. */ void unimp_hint (CoinMessageHandler *hdl, bool glpkSense, bool hintSense, OsiHintStrength hintStrength, const char *msgString) { if (glpkSense != hintSense) { std::string message = "glpk " ; if (glpkSense == true) { message += "cannot disable " ; } else { message += "does not support " ; } message += msgString ; *hdl << message << CoinMessageEol ; if (hintStrength == OsiForceDo) { throw CoinError(message,"setHintParam","OsiDylpSolverInterface") ; } } return ; } } // end file-local namespace bool OGSI::setHintParam (OsiHintParam key, bool sense, OsiHintStrength strength, void *info) /* OSI provides arrays for the sense and strength. OGSI provides the array for info. */ { bool retval = false ; CoinMessageHandler *msgHdl = messageHandler() ; /* Check for out of range. */ if (key >= OsiLastHintParam) return (false) ; /* Set the hint in the OSI structures. Unlike the other set*Param routines, setHintParam will return false for key == OsiLastHintParam. Unfortunately, it'll also throw for strength = OsiForceDo, without setting a return value. We need to catch that throw. */ try { retval = OsiSolverInterface::setHintParam(key,sense,strength) ; } catch (CoinError&) { retval = (strength == OsiForceDo) ; } if (retval == false) return (false) ; info_[key] = info ; /* Did the client say `ignore this'? Who are we to argue. */ if (strength == OsiHintIgnore) return (true) ; /* We have a valid hint which would be impolite to simply ignore. Deal with it as best we can. But say something if we're ignoring the hint. This is under construction. For the present, we don't distinguish between initial solve and resolve. */ switch (key) { case OsiDoPresolveInInitial: case OsiDoPresolveInResolve: { if (sense == false) { if (strength >= OsiHintTry) lpx_set_int_parm(lp_,LPX_K_PRESOL,0) ; } else { lpx_set_int_parm(lp_,LPX_K_PRESOL,1) ; } retval = true ; break ; } case OsiDoDualInInitial: case OsiDoDualInResolve: { unimp_hint(msgHdl,false,sense,strength,"exclusive use of dual simplex") ; if (sense == false) { if (strength >= OsiHintDo) lpx_set_int_parm(lp_,LPX_K_DUAL,0) ; } else { lpx_set_int_parm(lp_,LPX_K_DUAL,1) ; } retval = true ; break ; } case OsiDoCrash: { unimp_hint(msgHdl,false,sense,strength,"basis crash") ; retval = true ; break ; } case OsiDoInBranchAndCut: { unimp_hint(msgHdl,false,sense,strength,"do in branch and cut") ; retval = true ; break ; } /* 0 is no scaling, 3 is geometric mean followed by equilibration. */ case OsiDoScale: { if (sense == false) { if (strength >= OsiHintTry) lpx_set_int_parm(lp_,LPX_K_SCALE,0) ; } else { lpx_set_int_parm(lp_,LPX_K_SCALE,3) ; } retval = true ; break ; } /* Glpk supports four levels, 0 (no output), 1 (errors only), 2 (normal), and 3 (normal plus informational). */ case OsiDoReducePrint: { if (sense == true) { if (strength <= OsiHintTry) { lpx_set_int_parm(lp_,LPX_K_MSGLEV,1) ; } else { lpx_set_int_parm(lp_,LPX_K_MSGLEV,0) ; } } else { if (strength <= OsiHintTry) { lpx_set_int_parm(lp_,LPX_K_MSGLEV,2) ; } else { lpx_set_int_parm(lp_,LPX_K_MSGLEV,3) ; } } int logLevel = lpx_get_int_parm(lp_,LPX_K_MSGLEV) ; messageHandler()->setLogLevel(logLevel) ; retval = true ; break ; } /* The OSI spec says that unimplemented options (and, by implication, hints) should return false. In the case of a hint, however, we can ignore anything except OsiForceDo, so usability says we should anticipate new hints and set this up so the solver doesn't break. So return true. */ default: { unimp_hint(msgHdl,!sense,sense,strength,"unrecognized hint") ; retval = true ; break ; } } return (retval) ; } //----------------------------------------------------------------------------- bool OGSI::getIntParam( OsiIntParam key, int& value ) const { bool retval = false; switch( key ) { case OsiMaxNumIteration: value = maxIteration_; retval = true; break; case OsiMaxNumIterationHotStart: value = hotStartMaxIteration_; retval = true; break; case OsiNameDiscipline: value = nameDisc_; retval = true; break; case OsiLastIntParam: retval = false; break; } return retval; } //----------------------------------------------------------------------------- bool OGSI::getDblParam( OsiDblParam key, double& value ) const { bool retval = false; switch( key ) { case OsiDualObjectiveLimit: value = dualObjectiveLimit_; retval = true; break; case OsiPrimalObjectiveLimit: value = primalObjectiveLimit_; retval = true; break; case OsiDualTolerance: value = dualTolerance_; retval = true; break; case OsiPrimalTolerance: value = primalTolerance_; retval = true; break; case OsiObjOffset: value = lpx_get_obj_coef(getMutableModelPtr(),0); retval = true; break; case OsiLastDblParam: retval = false; break; } return retval; } bool OGSI::getStrParam(OsiStrParam key, std::string & value) const { // bool retval = false; switch (key) { case OsiProbName: value = lpx_get_prob_name( getMutableModelPtr() ); break; case OsiSolverName: value = "glpk"; break; case OsiLastStrParam: return false; } return true; } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# bool OGSI::isAbandoned() const { return isAbandoned_; } bool OGSI::isProvenOptimal() const { LPX *model = getMutableModelPtr(); if( bbWasLast_ == 0 ) { int stat = lpx_get_status( model ); return stat == LPX_OPT; } else { int stat = lpx_mip_status( model ); return stat == LPX_I_OPT; } } bool OGSI::isProvenPrimalInfeasible() const { LPX *model = getMutableModelPtr(); if(isPrimInfeasible_==true) return true; if( bbWasLast_ == 0 ) return lpx_get_prim_stat( model ) == LPX_P_NOFEAS; else return lpx_mip_status( model ) == LPX_I_NOFEAS; } bool OGSI::isProvenDualInfeasible() const { LPX *model = getMutableModelPtr(); if(isDualInfeasible_==true) return true; if( bbWasLast_ == 0 ) return lpx_get_dual_stat( model ) == LPX_D_NOFEAS; else // Not sure what to do for MIPs; does it just mean unbounded? // ??? for now, return false return false; } /* This should return true if the solver stopped on the primal limit, or if the current objective is better than the primal limit. getObjSense == 1 is minimisation, -1 is maximisation. */ bool OGSI::isPrimalObjectiveLimitReached() const { bool retval = false ; double obj = getObjValue() ; double objlim ; getDblParam(OsiPrimalObjectiveLimit,objlim) ; if (getObjSense() == 1) { if (isObjLowerLimitReached_ || obj < objlim) { retval = true ; } } else { if (isObjUpperLimitReached_ || obj > objlim) { retval = true ; } } return (retval) ; } /* This should return true if the solver stopped on the dual limit, or if the current objective is worse than the dual limit. */ bool OGSI::isDualObjectiveLimitReached() const { bool retval = false ; double obj = getObjValue() ; double objlim ; getDblParam(OsiDualObjectiveLimit,objlim) ; if (getObjSense() == 1) { if (isObjUpperLimitReached_ || obj > objlim) { retval = true ; } } else { if (isObjLowerLimitReached_ || obj < objlim) { retval = true ; } } return (retval) ; } bool OGSI::isIterationLimitReached() const { return isIterationLimitReached_; } bool OGSI::isTimeLimitReached() const { return isTimeLimitReached_; } bool OGSI::isFeasible() const { return isFeasible_; } //############################################################################# // WarmStart related methods //############################################################################# /* Return a warm start object matching the current state of the solver. Nonbasic fixed variables (LPX_NS) are translated to CWSB::atLowerBound. */ CoinWarmStart *OGSI::getWarmStart() const { /* Create an empty basis and size it to the correct dimensions. */ CoinWarmStartBasis *ws = new CoinWarmStartBasis() ; int numcols = getNumCols() ; int numrows = getNumRows() ; ws->setSize(numcols,numrows) ; /* Walk the rows. Retrieve the status information from the glpk model and store it in the CWSB object. The convention in Osi regarding the status of a row when on bounds is different from Glpk. Thus, Glpk's at-lower-bound will be mapped to Osi's at-upper-bound and Glpk's at-upper-bound will be mapped to Osi's at-lower-bound. */ for (int i = 0 ; i < numrows ; i++) { int stati = lpx_get_row_stat(lp_,i+1) ; switch (stati) { case LPX_BS: { ws->setArtifStatus(i,CoinWarmStartBasis::basic) ; break ; } case LPX_NS: case LPX_NL: { ws->setArtifStatus(i,CoinWarmStartBasis::atUpperBound) ; break ; } case LPX_NU: { ws->setArtifStatus(i,CoinWarmStartBasis::atLowerBound) ; break ; } case LPX_NF: { ws->setArtifStatus(i,CoinWarmStartBasis::isFree) ; break ; } default: { assert(false) ; break ; } } } /* And repeat for the columns. */ for (int j = 0 ; j < numcols ; j++) { int statj = lpx_get_col_stat(lp_,j+1) ; switch (statj) { case LPX_BS: { ws->setStructStatus(j,CoinWarmStartBasis::basic) ; break ; } case LPX_NS: case LPX_NL: { ws->setStructStatus(j,CoinWarmStartBasis::atLowerBound) ; break ; } case LPX_NU: { ws->setStructStatus(j,CoinWarmStartBasis::atUpperBound) ; break ; } case LPX_NF: { ws->setStructStatus(j,CoinWarmStartBasis::isFree) ; break ; } default: { assert(false) ; break ; } } } return (ws) ; } //----------------------------------------------------------------------------- /* Set the given warm start information in the solver. By definition, a null warmstart parameter is interpreted as `refresh warm start information from the solver.' Since OGSI does not cache warm start information, no action is required. The convention in Osi regarding the status of a row when on bounds is different from Glpk. Thus, Osi's at-upper-bound will be mapped to Glpk's at-lower-bound and Osi's at-lower-bound will be mapped to Glpk's at-upper-bound. */ bool OGSI::setWarmStart (const CoinWarmStart* warmstart) { /* If this is a simple refresh request, we're done. */ if (warmstart == 0) { return (true) ; } /* Check that the parameter is a CWSB of the appropriate size. */ const CoinWarmStartBasis *ws = dynamic_cast(warmstart) ; if (ws == 0) { return false ; } int numcols = ws->getNumStructural() ; int numrows = ws->getNumArtificial() ; if (numcols != getNumCols() || numrows != getNumRows()) { return (false) ; } /* Looks like a basis. Translate to the appropriate codes for glpk and install. Row status first (logical/artificial variables), then column status (architectural variables). */ for (int i = 0 ; i < numrows ; i++) { int stati ; switch (ws->getArtifStatus(i)) { case CoinWarmStartBasis::basic: { stati = LPX_BS ; break ; } case CoinWarmStartBasis::atLowerBound: { stati = LPX_NU ; break ; } case CoinWarmStartBasis::atUpperBound: { stati = LPX_NL ; break ; } case CoinWarmStartBasis::isFree: { stati = LPX_NF ; break ; } default: { assert(false) ; return (false) ; } } lpx_set_row_stat(lp_,i+1,stati) ; } for (int j = 0 ; j < numcols ; j++) { int statj ; switch (ws->getStructStatus(j)) { case CoinWarmStartBasis::basic: { statj = LPX_BS ; break ; } case CoinWarmStartBasis::atLowerBound: { statj = LPX_NL ; break ; } case CoinWarmStartBasis::atUpperBound: { statj = LPX_NU ; break ; } case CoinWarmStartBasis::isFree: { statj = LPX_NF ; break ; } default: { assert(false) ; return (false) ; } } lpx_set_col_stat(lp_,j+1,statj) ; } return (true) ; } //############################################################################# // Hotstart related methods (primarily used in strong branching) //############################################################################# void OGSI::markHotStart() { LPX *model = getMutableModelPtr(); int numcols, numrows; numcols = getNumCols(); numrows = getNumRows(); if( numcols > hotStartCStatSize_ ) { delete[] hotStartCStat_; delete [] hotStartCVal_; delete [] hotStartCDualVal_; hotStartCStatSize_ = static_cast( 1.2 * static_cast( numcols ) ); // get some extra space for future hot starts hotStartCStat_ = new int[hotStartCStatSize_]; hotStartCVal_ = new double[hotStartCStatSize_]; hotStartCDualVal_ = new double[hotStartCStatSize_]; } int j; for( j = 0; j < numcols; j++ ) { int stat; double val; double dualVal; stat=lpx_get_col_stat(model,j); val=lpx_get_col_prim(model,j); dualVal=lpx_get_col_dual(model,j); hotStartCStat_[j] = stat; hotStartCVal_[j] = val; hotStartCDualVal_[j] = dualVal; } if( numrows > hotStartRStatSize_ ) { delete [] hotStartRStat_; delete [] hotStartRVal_; delete [] hotStartRDualVal_; hotStartRStatSize_ = static_cast( 1.2 * static_cast( numrows ) ); // get some extra space for future hot starts hotStartRStat_ = new int[hotStartRStatSize_]; hotStartRVal_ = new double[hotStartRStatSize_]; hotStartRDualVal_ = new double[hotStartRStatSize_]; } int i; for( i = 0; i < numrows; i++ ) { int stat; double val; double dualVal; stat=lpx_get_row_stat(model,i+1); val=lpx_get_row_prim(model,i+1); dualVal=lpx_get_row_dual(model,i+1); hotStartRStat_[i] = stat; hotStartRVal_[i] = val; hotStartRDualVal_[i] = dualVal; } } //----------------------------------------------------------------------------- void OGSI::solveFromHotStart() { # if OGSI_TRACK_FRESH > 0 std::cout << "OGSI(" << std::hex << this << std::dec << ")::solveFromHotStart." << std::endl ; # endif LPX *model = getMutableModelPtr(); int numcols, numrows; numcols = getNumCols(); numrows = getNumRows(); assert( numcols <= hotStartCStatSize_ ); assert( numrows <= hotStartRStatSize_ ); int j; for( j = 0; j < numcols; j++ ) { lpx_set_col_stat( model, j+1, hotStartCStat_[j]); } int i; for( i = 0; i < numrows; i++ ) { lpx_set_row_stat( model, i+1, hotStartRStat_[i]); } freeCachedData( OGSI::FREECACHED_RESULTS ); int maxIteration = maxIteration_; maxIteration_ = hotStartMaxIteration_; resolve(); maxIteration_ = maxIteration; } //----------------------------------------------------------------------------- void OGSI::unmarkHotStart() { // ??? be lazy with deallocating memory and do nothing here, deallocate memory in the destructor. } //############################################################################# // Problem information methods (original data) //############################################################################# //----------------------------------------------------------------------------- // Get number of rows, columns, elements, ... //----------------------------------------------------------------------------- int OGSI::getNumCols() const { return lpx_get_num_cols( getMutableModelPtr() ); } int OGSI::getNumRows() const { return lpx_get_num_rows( getMutableModelPtr() ); } int OGSI::getNumElements() const { return lpx_get_num_nz( getMutableModelPtr() ); } //----------------------------------------------------------------------------- // Get pointer to rim vectors //------------------------------------------------------------------ const double * OGSI::getColLower() const { LPX *model = getMutableModelPtr(); if( collower_ == NULL ) { assert( colupper_ == NULL ); int numcols = getNumCols(); if( numcols > 0 ) { collower_ = new double[numcols]; colupper_ = new double[numcols]; } double inf = getInfinity(); int i; for( i = 0; i < numcols; i++) { int type; double lb; double ub; type=lpx_get_col_type(model,i+1); lb=lpx_get_col_lb(model,i+1); ub=lpx_get_col_ub(model,i+1); switch ( type ) { case LPX_FR: lb = -inf; ub = inf; break; case LPX_LO: ub = inf; break; case LPX_UP: lb = -inf; break; case LPX_FX: case LPX_DB: break; default: assert( false ); break; } collower_[i] = lb; colupper_[i] = ub; } } return collower_; } //----------------------------------------------------------------------------- const double * OGSI::getColUpper() const { if( colupper_ == NULL ) { getColLower(); //assert( colupper_ != NULL ); // Could be null if no columns. } return colupper_; } //----------------------------------------------------------------------------- const char * OGSI::getRowSense() const { // Could be in OsiSolverInterfaceImpl. if( rowsense_ == NULL ) { assert( rhs_ == NULL && rowrange_ == NULL ); int numrows = getNumRows(); if( numrows > 0 ) { rowsense_ = new char[numrows]; rhs_ = new double[numrows]; rowrange_ = new double[numrows]; } const double *rowlower = getRowLower(); const double *rowupper = getRowUpper(); int i; for( i = 0; i < numrows; i++ ) { char sense; double right; double range; convertBoundToSense( rowlower[i], rowupper[i], sense, right, range ); rowsense_[i] = sense; rhs_[i] = right; rowrange_[i] = range; } } return rowsense_; } //----------------------------------------------------------------------------- const double * OGSI::getRightHandSide() const { if( rhs_ == NULL ) { getRowSense(); //assert( rhs_ != NULL ); // Could be null if no rows. } return rhs_; } //----------------------------------------------------------------------------- const double * OGSI::getRowRange() const { if( rowrange_ == NULL ) { getRowSense(); //assert( rowrange_ != NULL ); // Could be null if no rows. } return rowrange_; } //----------------------------------------------------------------------------- const double * OGSI::getRowLower() const { LPX *model = getMutableModelPtr(); if( rowlower_ == NULL ) { assert( rowupper_ == NULL ); int numrows = getNumRows(); if( numrows > 0 ) { rowlower_ = new double[numrows]; rowupper_ = new double[numrows]; } int i; for( i = 0; i < numrows; i++ ) { double inf = getInfinity(); int type; double lb; double ub; type=lpx_get_row_type(model,i+1); lb=lpx_get_row_lb(model,i+1); ub=lpx_get_row_ub(model,i+1); switch( type ) { case LPX_FR: lb = -inf; ub = inf; break; case LPX_LO: ub = inf; break; case LPX_UP: lb = -inf; break; case LPX_DB: case LPX_FX: break; default: assert( false ); break; } rowlower_[i] = lb; rowupper_[i] = ub; } } return rowlower_; } //----------------------------------------------------------------------------- const double * OGSI::getRowUpper() const { if( rowupper_ == NULL ) { getRowLower(); //assert( rowupper_ != NULL ); // Could be null if no rows. } return rowupper_; } //----------------------------------------------------------------------------- const double * OGSI::getObjCoefficients() const { if( obj_ == NULL ) { LPX *model = getMutableModelPtr(); int numcols = getNumCols(); if( numcols > 0 ) { obj_ = new double[numcols]; } int i; for( i = 0; i < numcols; i++ ) { obj_[i] = lpx_get_obj_coef( model, i + 1); } } return obj_; } //----------------------------------------------------------------------------- double OGSI::getObjSense() const { if (lpx_get_obj_dir(lp_) == LPX_MIN) { return (+1.0) ; } else if (lpx_get_obj_dir(lp_) == LPX_MAX) { return (-1.0) ; } else // internal confusion { assert(false) ; return (0) ; } } //----------------------------------------------------------------------------- // Return information on integrality //----------------------------------------------------------------------------- bool OGSI::isContinuous( int colNumber ) const { return lpx_get_col_kind( getMutableModelPtr(), colNumber+1 ) == LPX_CV; } //----------------------------------------------------------------------------- // Row and column copies of the matrix ... //----------------------------------------------------------------------------- const CoinPackedMatrix * OGSI::getMatrixByRow() const { if( matrixByRow_ == NULL ) { LPX *model = getMutableModelPtr(); matrixByRow_ = new CoinPackedMatrix(); matrixByRow_->transpose(); // converts to row-order matrixByRow_->setDimensions( 0, getNumCols() ); int numcols = getNumCols(); int *colind = new int[numcols+1]; double *colelem = new double[numcols+1]; int i; for( i = 0; i < getNumRows(); i++ ) { int colsize = lpx_get_mat_row( model, i+1, colind, colelem); int j; for( j = 1; j <= colsize; j++ ) { --colind[j]; } // Note: lpx_get_mat_row apparently may return the // elements in decreasing order. This differs from // people's standard expectations but is not an error. matrixByRow_->appendRow( colsize, colind+1, colelem+1 ); } delete [] colind; delete [] colelem; if( numcols ) matrixByRow_->removeGaps(); } return matrixByRow_; } //----------------------------------------------------------------------------- const CoinPackedMatrix * OGSI::getMatrixByCol() const { if( matrixByCol_ == NULL ) { LPX *model = getMutableModelPtr(); matrixByCol_ = new CoinPackedMatrix(); matrixByCol_->setDimensions( getNumRows(), 0 ); int numrows = getNumRows(); int *rowind = new int[numrows+1]; double *rowelem = new double[numrows+1]; int j; for( j = 0; j < getNumCols(); j++ ) { int rowsize = lpx_get_mat_col( model, j+1, rowind, rowelem); int i; for( i = 1; i <= rowsize; i++ ) { --rowind[i]; } matrixByCol_->appendCol( rowsize, rowind+1, rowelem+1 ); } delete [] rowind; delete [] rowelem; if( numrows ) matrixByCol_->removeGaps(); } return matrixByCol_; } //----------------------------------------------------------------------------- // Get solver's value for infinity //----------------------------------------------------------------------------- double OGSI::getInfinity() const { return (CoinInfinity) ; } //############################################################################# // Problem information methods (results) //############################################################################# /* Retrieve column solution, querying solver if we don't have a cached solution. Refresh reduced costs while we're here. Reduced costs may or may not already exist (user can create a reduced cost vector by supplying duals (row price) and asking for reduced costs). Appropriate calls depend on whether last call to solver was simplex or branch-and-bound. */ const double *OGSI::getColSolution() const { /* Use the cached solution vector, if present. If we have no constraint system, return 0. */ if (colsol_ != 0) { return (colsol_) ; } int numcols = getNumCols() ; if (numcols == 0) { return (0) ; } colsol_ = new double[numcols] ; if (redcost_ != 0) delete [] redcost_ ; { redcost_ = new double[numcols] ; } /* Grab the problem status. */ int probStatus ; if (bbWasLast_) { probStatus = lpx_mip_status(lp_) ; } else { probStatus = lpx_get_status(lp_) ; } /* If the problem hasn't been solved, glpk returns zeros, but OSI requires that the solution be within bound. getColLower() will ensure both upper and lower bounds are present. There's an implicit assumption that we're feasible (i.e., collower[j] < colupper[j]). Solution values will be 0.0 unless that's outside the bounds. */ if (probStatus == LPX_UNDEF || probStatus == LPX_I_UNDEF) { getColLower() ; int j ; for (j = 0 ; j < numcols ; j++) { colsol_[j] = 0.0 ; if (collower_[j] > 0.0) { colsol_[j] = collower_[j] ; } else if (colupper_[j] < 0.0) { colsol_[j] = colupper_[j] ; } } } /* We should have a defined solution. For simplex, refresh the reduced costs as well as the primal solution. Remove infinitesimals from the results. */ else if (bbWasLast_ == 0) { int j ; for (j = 0 ; j < numcols ; j++) { colsol_[j] = lpx_get_col_prim(lp_,j+1) ; if (fabs(colsol_[j]) < GlpkZeroTol) { colsol_[j] = 0.0 ; } redcost_[j] = lpx_get_col_dual(lp_,j+1) ; if (fabs(redcost_[j]) < GlpkZeroTol) { redcost_[j] = 0.0 ; } } } /* Last solve was branch-and-bound. Set the reduced costs to 0. Remove infinitesimals from the results. */ else { int j ; for (j = 0 ; j < numcols ; j++) { colsol_[j] = lpx_mip_col_val(lp_,j+1) ; if (fabs(colsol_[j]) < GlpkZeroTol) { colsol_[j] = 0.0 ; } redcost_[j] = 0.0 ; } } return (colsol_) ; } //----------------------------------------------------------------------------- /* Acquire the row solution (dual variables). The user can set this independently, so use the cached copy if it's present. */ const double *OGSI::getRowPrice() const { /* If we have a cached solution, use it. If the constraint system is empty, return 0. Otherwise, allocate a new vector. */ if (rowsol_ != 0) { return (rowsol_) ; } int numrows = getNumRows() ; if (numrows == 0) { return (0) ; } rowsol_ = new double[numrows] ; /* For simplex, we have dual variables. For MIP, just set them to zero. Remove infinitesimals from the results. */ if (bbWasLast_ == 0) { int i ; for (i = 0 ; i < numrows; i++) { rowsol_[i] = lpx_get_row_dual(lp_,i+1) ; if (fabs(rowsol_[i]) < GlpkZeroTol) { rowsol_[i] = 0.0 ; } } } else { int i ; for (i = 0 ; i < numrows ; i++) { rowsol_[i] = 0 ; } } return (rowsol_) ; } //----------------------------------------------------------------------------- /* It's tempting to dive into glpk for this, but ... the client may have used setRowPrice(), and it'd be nice to return reduced costs that agree with the duals. To use glpk's routine (lpx_get_col_dual), the interface needs to track the origin of the dual (row price) values. */ const double * OGSI::getReducedCost() const { /* Return the cached copy, if it exists. */ if (redcost_ != 0) { return (redcost_) ; } /* We need to calculate. Make sure we have a constraint system, then allocate a vector and initialise it with the objective coefficients. */ int n = getNumCols() ; if (n == 0) { return (0) ; } redcost_ = new double[n] ; CoinDisjointCopyN(getObjCoefficients(),n,redcost_) ; /* Try and acquire dual variables. */ const double *y = getRowPrice() ; if (!y) { return (redcost_) ; } /* Acquire the constraint matrix and calculate y*A. */ const CoinPackedMatrix *mtx = getMatrixByCol() ; double *yA = new double[n] ; mtx->transposeTimes(y,yA) ; /* Calculate c-yA and remove infinitesimals from the result. */ for (int j = 0 ; j < n ; j++) { redcost_[j] -= yA[j] ; if (fabs(redcost_[j]) < GlpkZeroTol) { redcost_[j] = 0 ; } } delete[] yA ; return (redcost_) ; } //----------------------------------------------------------------------------- /* As with getReducedCost, we need to be mindful that the primal solution may have been set by the client. As it happens, however, glpk has no equivalent routine, so there's no temptation to resist. */ const double *OGSI::getRowActivity() const { /* Return the cached copy, if it exists. */ if (rowact_) { return (rowact_) ; } /* We need to calculate. Make sure we have a constraint system, then allocate a vector and initialise it with the objective coefficients. */ int m = getNumRows() ; if (m == 0) { return (0) ; } rowact_ = new double[m] ; /* Acquire primal variables. */ const double *x = getColSolution() ; if (!x) { CoinZeroN(rowact_,m) ; return (rowact_) ; } /* Acquire the constraint matrix and calculate A*x. */ const CoinPackedMatrix *mtx = getMatrixByRow() ; mtx->times(x,rowact_) ; /* Remove infinitesimals from the result. */ for (int i = 0 ; i < m ; i++) { if (fabs(rowact_[i]) < GlpkZeroTol) { rowact_[i] = 0 ; } } return (rowact_) ; } //----------------------------------------------------------------------------- double OGSI::getObjValue() const { return OsiSolverInterface::getObjValue(); } //----------------------------------------------------------------------------- int OGSI::getIterationCount() const { return iter_used_; } //----------------------------------------------------------------------------- std::vector OGSI::getDualRays(int /*maxNumRays*/, bool /*fullRay*/) const { // ??? not yet implemented. throw CoinError("method is not yet implemented", "getDualRays", "OsiGlpkSolverInterface"); return std::vector(); } //----------------------------------------------------------------------------- std::vector OGSI::getPrimalRays(int /*maxNumRays*/) const { // ??? not yet implemented. throw CoinError("method is not yet implemented", "getPrimalRays", "OsiGlpkSolverInterface"); return std::vector(); } //############################################################################# // Problem modifying methods (rim vectors) //############################################################################# /* Yes, I know the OSI spec says that pointers returned by get*() routines are valid only as long as the data is unchanged. But in practice, client code (in particular, portions of Cgl and Cbc) expects that simple changes to rim vector values will not invalidate pointers returned by the various get*() routines. So, for example, modifying an objective coefficient should not free the cached copies of the objective and column bounds. They should be updated on-the-fly. This is exactly the opposite of the original OsiGlpk design, hence this warning. Beyond that, it's helpful for an OSI to hold on to the current solution as long as possible. So, for example, a bounds change that does not make the current solution infeasible should not trash the cached solution. -- lh, 070326 */ void OGSI::setObjCoeff (int j, double cj) { assert(j >= 0 && j < getNumCols()) ; /* Remove the solution. Arguably the only thing that we should remove here is the cached reduced cost. */ freeCachedData(OGSI::KEEPCACHED_PROBLEM) ; /* Push the changed objective down to glpk. */ lpx_set_obj_coef(lp_,j+1,cj) ; if (obj_) { obj_[j] = cj ; } return ; } //----------------------------------------------------------------------------- void OGSI::setColLower (int j, double lbj) { /* Get the upper bound, so we can call setColBounds. glpk reports 0 for an infinite bound, so we need to check the status and possibly correct. */ double inf = getInfinity() ; int type = lpx_get_col_type(lp_,j+1) ; double ubj = lpx_get_col_ub(lp_,j+1) ; switch (type) { case LPX_UP: case LPX_DB: case LPX_FX: { break ; } case LPX_FR: case LPX_LO: { ubj = inf ; break ; } default: { assert (false) ; } } # if OGSI_TRACK_FRESH > 0 /* Check if this bound really invalidates the current solution. This check will give false positives because OsiGlpk needs a notion of `valid solution from solver'. getColSolution will always return something, even if it has to make it up on the spot. */ { const double *x = getColSolution() ; if (x) { if (x[j] < lbj-GlpkZeroTol) { std::cout << "OGSI(" << std::hex << this << std::dec << ")::setColLower: new bound " << lbj << " exceeds current value " << x[j] << " by " << (lbj-x[j]) << "." << std::endl ; } } } # endif setColBounds(j,lbj,ubj) ; return ; } //----------------------------------------------------------------------------- void OGSI::setColUpper (int j, double ubj) { /* Get the lower bound, so we can call setColBounds. glpk reports 0 for an infinite bound, so we need to check the status and possibly correct. */ double inf = getInfinity() ; int type = lpx_get_col_type(lp_,j+1) ; double lbj = lpx_get_col_lb(lp_,j+1) ; switch (type) { case LPX_LO: case LPX_DB: case LPX_FX: { break ; } case LPX_FR: case LPX_UP: { lbj = inf ; break ; } default: { assert (false) ; } } # if OGSI_TRACK_FRESH > 0 /* Check if this bound really invalidates the current solution. This check will give false positives because OsiGlpk needs a notion of `valid solution from solver'. getColSolution will always return something, even if it has to make it up on the spot. */ { const double *x = getColSolution() ; if (x) { if (x[j] > ubj+GlpkZeroTol) { std::cout << "OGSI(" << std::hex << this << std::dec << ")::setColUpper: new bound " << ubj << " exceeds current value " << x[j] << " by " << (x[j]-ubj) << "." << std::endl ; } } } # endif setColBounds(j,lbj,ubj) ; return ; } //----------------------------------------------------------------------------- /* Yes, in theory, we shouldn't need to worry about maintaining those cached column bounds over changes to the problem. See the note at the top of this section. */ void OGSI::setColBounds (int j, double lower, double upper) { assert(j >= 0 && j < getNumCols()) ; /* Free only the cached solution. Keep the cached structural variables. */ freeCachedData(OGSI::KEEPCACHED_PROBLEM) ; /* Figure out what type we should use for glpk. */ double inf = getInfinity() ; int type ; if (lower == upper) { type = LPX_FX ; } else if (lower > -inf && upper < inf) { type = LPX_DB ; } else if (lower > -inf) { type = LPX_LO ; } else if (upper < inf) { type = LPX_UP ; } else { type = LPX_FR ; } /* Push the bound change down into the solver. 1-based addressing. */ int statj = lpx_get_col_stat(lp_,j+1) ; lpx_set_col_bnds(lp_,j+1,type,lower,upper) ; lpx_set_col_stat(lp_,j+1,statj) ; statj = lpx_get_col_stat(lp_,j+1) ; /* Correct the cached upper and lower bound vectors, if present. */ if (collower_) { collower_[j] = lower ; } if (colupper_) { colupper_[j] = upper ; } return ; } //----------------------------------------------------------------------------- void OGSI::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { OsiSolverInterface::setColSetBounds( indexFirst, indexLast, boundList ); } //----------------------------------------------------------------------------- void OGSI::setRowLower( int elementIndex, double elementValue ) { // Could be in OsiSolverInterfaceImpl. double inf = getInfinity(); int type; double lb; double ub; type=lpx_get_row_type(getMutableModelPtr(),elementIndex+1); ub=lpx_get_row_ub(getMutableModelPtr(),elementIndex+1); lb = elementValue; switch( type ) { case LPX_UP: case LPX_DB: case LPX_FX: break; case LPX_FR: case LPX_LO: ub = inf; break; default: assert( false ); } setRowBounds( elementIndex, lb, ub ); } //----------------------------------------------------------------------------- void OGSI::setRowUpper( int elementIndex, double elementValue ) { // Could be in OsiSolverInterfaceImpl. double inf = getInfinity(); int type; double lb; double ub; type=lpx_get_row_type(getMutableModelPtr(),elementIndex+1); lb=lpx_get_row_lb(getMutableModelPtr(),elementIndex+1); ub = elementValue; switch( type ) { case LPX_LO: case LPX_DB: case LPX_FX: break; case LPX_FR: case LPX_UP: lb = -inf; break; default: assert( false ); } setRowBounds( elementIndex, lb, ub ); } //----------------------------------------------------------------------------- /* As with setColBounds, just changing the bounds should not invalidate the current rim vectors. */ void OGSI::setRowBounds (int i, double lower, double upper) { /* Free only the row and column solution, keep the cached structural vectors. */ freeCachedData(OGSI::KEEPCACHED_PROBLEM) ; /* Figure out the correct row type for glpk and push the change down into the solver. 1-based addressing. */ double inf = getInfinity() ; int type ; if( lower == upper) { type = LPX_FX ; } else if (lower > -inf && upper < inf) { type = LPX_DB ; } else if (lower > -inf) { type = LPX_LO ; } else if (upper < inf) { type = LPX_UP ; } else { type = LPX_FR ; } lpx_set_row_bnds(lp_,i+1,type,lower,upper) ; /* Update cached vectors, if they exist. */ if (rowlower_) { rowlower_[i] = lower ; } if (rowupper_) { rowupper_[i] = upper ; } return ; } //----------------------------------------------------------------------------- void OGSI::setRowType(int elementIndex, char sense, double rightHandSide, double range) { // Could be in OsiSolverInterfaceImpl. double lower = 0.0 ; double upper = 0.0 ; convertSenseToBound( sense, rightHandSide, range, lower, upper ); setRowBounds( elementIndex, lower, upper ); } //----------------------------------------------------------------------------- void OGSI::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { // Could be in OsiSolverInterface (should'nt be implemeted at here). OsiSolverInterface::setRowSetBounds( indexFirst, indexLast, boundList ); } //----------------------------------------------------------------------------- void OGSI::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { // Could be in OsiSolverInterface (should'nt be implemeted at here). OsiSolverInterface::setRowSetTypes( indexFirst, indexLast, senseList, rhsList, rangeList ); } //############################################################################# void OGSI::setContinuous(int index) { LPX *model = getMutableModelPtr(); freeCachedData( OGSI::FREECACHED_COLUMN ); lpx_set_col_kind( model, index+1, LPX_CV ); } //----------------------------------------------------------------------------- void OGSI::setInteger (int index) { LPX *model = getMutableModelPtr() ; freeCachedData(OGSI::FREECACHED_COLUMN) ; lpx_set_col_kind(model,index+1,LPX_IV) ; /* Temporary hack to correct upper bounds on general integer variables. CoinMpsIO insists on forcing a bound of 1e30 for general integer variables with no upper bound. This causes several cut generators (MIR, MIR2) to fail. Put the bound back to infinity. -- lh, 070530 -- double uj = getColUpper()[index] ; if (uj >= 1e30) { setColUpper(index,getInfinity()) ; } */ return ; } //----------------------------------------------------------------------------- void OGSI::setContinuous(const int* indices, int len) { // Could be in OsiSolverInterfaceImpl. int i; for( i = 0; i < len; i++ ) { setContinuous( indices[i] ); } } //----------------------------------------------------------------------------- void OGSI::setInteger(const int* indices, int len) { // Could be in OsiSolverInterfaceImpl. int i; for( i = 0; i < len; i++ ) { setInteger( indices[i] ); } } //############################################################################# /* Opt for the natural sense (minimisation) unless the user is clear that maximisation is what's desired. */ void OGSI::setObjSense(double s) { freeCachedData(OGSI::FREECACHED_RESULTS) ; if (s <= -1.0) { lpx_set_obj_dir(lp_,LPX_MAX) ; } else { lpx_set_obj_dir(lp_,LPX_MIN) ; } return ; } //----------------------------------------------------------------------------- void OGSI::setColSolution(const double * cs) { // You probably don't want to use this function. You probably want // setWarmStart instead. // This implementation changes the cached information, // BUT DOES NOT TELL GLPK about the changes. In that sense, it's not // really useful. It is added to conform to current OSI expectations. // Other results (such as row prices) might not make sense with this // new solution, but we can't free all the results we have, since the // row prices may have already been set with setRowPrice. if (cs == 0) delete [] colsol_; else { int nc = getNumCols(); if (colsol_ == 0) colsol_ = new double[nc]; // Copy in new col solution. CoinDisjointCopyN( cs, nc, colsol_ ); } } //----------------------------------------------------------------------------- void OGSI::setRowPrice(const double * rs) { // You probably don't want to use this function. You probably want // setWarmStart instead. // This implementation changes the cached information, // BUT DOES NOT TELL GLPK about the changes. In that sense, it's not // really useful. It is added to conform to current OSI expectations. // Other results (such as column solutions) might not make sense with this // new solution, but we can't free all the results we have, since the // column solutions may have already been set with setColSolution. if (rs == 0) delete [] rowsol_; else { int nr = getNumRows(); if (rowsol_ == 0) rowsol_ = new double[nr]; // Copy in new col solution. CoinDisjointCopyN( rs, nr, rowsol_ ); } } //############################################################################# // Problem modifying methods (matrix) //############################################################################# void OGSI::addCol (const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { // Note: GLPK expects only non-zero coefficients will be given in // lpx_set_mat_col and will abort if there are any zeros. So any // zeros must be removed prior to calling lpx_set_mat_col. LPX *model = getMutableModelPtr(); freeCachedData(OGSI::KEEPCACHED_ROW); lpx_add_cols( model, 1 ); int numcols = getNumCols(); setColBounds( numcols-1, collb, colub ); setObjCoeff( numcols-1, obj ); int i; // For GLPK, we don't want the arrays to start at 0 // We also need to weed out any 0.0 coefficients const int *indices = vec.getIndices(); const double *elements = vec.getElements(); int numrows = getNumRows(); int *indices_adj = new int[1+vec.getNumElements()]; double *elements_adj = new double[1+vec.getNumElements()]; int count = 0; for( i = 0; i < vec.getNumElements(); i++ ) { if (elements[i] != 0.0) { if ( indices[i]+1 > numrows ) { lpx_add_rows( model, indices[i]+1 - numrows ); numrows = indices[i]+1; // ??? could do this more efficiently with a single call based on the max } count++; // GLPK arrays start at 1 indices_adj[count] = indices[i] + 1; elements_adj[count] = elements[i]; } } lpx_set_mat_col( model, numcols, count, indices_adj, elements_adj ); delete [] indices_adj; delete [] elements_adj; # if OGSI_TRACK_FRESH > 2 std::cout << "OGSI(" << std::hex << this << std::dec << ")::addCol: new column." << std::endl ; # endif } //----------------------------------------------------------------------------- void OGSI::addCols (const int numcols, const CoinPackedVectorBase *const *cols, const double *collb, const double *colub, const double *obj) { // ??? We could do this more efficiently now // Could be in OsiSolverInterfaceImpl. int i; for( i = 0; i < numcols; ++i ) addCol( *(cols[i]), collb[i], colub[i], obj[i] ); } //----------------------------------------------------------------------------- void OGSI::deleteCols(const int num, const int * columnIndices) { int *columnIndicesPlus1 = new int[num+1]; LPX *model = getMutableModelPtr(); freeCachedData( OGSI::KEEPCACHED_ROW ); for( int i = 0; i < num; i++ ) { columnIndicesPlus1[i+1]=columnIndices[i]+1; deleteColNames(columnIndices[i],1); } lpx_del_cols(model,num,columnIndicesPlus1); delete [] columnIndicesPlus1; # if OGSI_TRACK_FRESH > 0 std::cout << "OGSI(" << std::hex << this << std::dec << ")::deleteCols: deleted " << num << "columns." << std::endl ; # endif } //----------------------------------------------------------------------------- void OGSI::addRow (const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { // Note: GLPK expects only non-zero coefficients will be given in // lpx_set_mat_row and will abort if there are any zeros. So any // zeros must be removed prior to calling lpx_set_mat_row. LPX *model = getMutableModelPtr(); freeCachedData( OGSI::KEEPCACHED_COLUMN ); lpx_add_rows( model, 1 ); int numrows = getNumRows(); setRowBounds( numrows-1, rowlb, rowub ); int i; const int *indices = vec.getIndices(); const double *elements = vec.getElements(); int numcols = getNumCols(); // For GLPK, we don't want the arrays to start at 0 // Also, we need to weed out any 0.0 elements int *indices_adj = new int[1+vec.getNumElements()]; double *elements_adj = new double[1+vec.getNumElements()]; int count = 0; for( i = 0; i < vec.getNumElements(); i++ ) { if ( elements[i] != 0.0 ) { if ( indices[i]+1 > numcols ) { // ??? Could do this more efficiently with a single call lpx_add_cols( model, indices[i]+1 - numcols ); numcols = indices[i]+1; } count++; elements_adj[count] = elements[i]; indices_adj[count] = indices[i] + 1; } } lpx_set_mat_row( model, numrows, count, indices_adj, elements_adj ); delete [] indices_adj; delete [] elements_adj; # if OGSI_TRACK_FRESH > 0 std::cout << "OGSI(" << std::hex << this << std::dec << ")::addRow: new row." << std::endl ; # endif } //----------------------------------------------------------------------------- void OGSI::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { // Could be in OsiSolverInterfaceImpl. double lb = 0.0 ; double ub = 0.0 ; convertSenseToBound( rowsen, rowrhs, rowrng, lb, ub); addRow( vec, lb, ub ); } //----------------------------------------------------------------------------- void OGSI::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub) { // ??? Could do this more efficiently now // Could be in OsiSolverInterfaceImpl. int i; for( i = 0; i < numrows; ++i ) addRow( *(rows[i]), rowlb[i], rowub[i] ); } //----------------------------------------------------------------------------- void OGSI::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng) { // Could be in OsiSolverInterfaceImpl. int i; for( i = 0; i < numrows; ++i ) addRow( *(rows[i]), rowsen[i], rowrhs[i], rowrng[i] ); } //----------------------------------------------------------------------------- /* There's an expectation that a valid basis will be maintained across row deletions. Fortunately, glpk will do this automagically as long as we play by the rules and delete only slack constraints. If we delete a constraint with a nonbasic slack, we're in trouble. */ void OGSI::deleteRows (const int num, const int *osiIndices) { int *glpkIndices = new int[num+1] ; int i,ndx ; /* Arguably, column results remain valid across row deletion. */ freeCachedData(OGSI::KEEPCACHED_COLUMN) ; /* Glpk uses 1-based indexing, so convert the array of indices. While we're doing that, delete the row names. */ for (ndx = 0 ; ndx < num ; ndx++) { glpkIndices[ndx+1] = osiIndices[ndx]+1 ; deleteRowNames(osiIndices[ndx],1) ; } /* See if we're about to do damage. If we delete a row with a nonbasic slack, we'll have an excess of basic variables. */ int notBasic = 0 ; for (ndx = 1 ; ndx <= num ; ndx++) { i = glpkIndices[ndx] ; int stati = lpx_get_row_stat(lp_,i) ; if (stati != LPX_BS) { notBasic++ ; } } if (notBasic) { # if OGSI_VERBOSITY > 1 std::cout << "OGSI(" << std::hex << this << std::dec << ")::deleteRows: deleting " << notBasic << " tight constraints; " << "basis is no longer valid." << std::endl ; # endif } /* Tell glpk to delete the rows. */ lpx_del_rows(lp_,num,glpkIndices) ; delete [] glpkIndices ; # if OGSI_TRACK_FRESH > 0 std::cout << "OGSI(" << std::hex << this << std::dec << ")::deleteRows: deleted " << num << " rows." << std::endl ; # endif return ; } //############################################################################# // Methods to input a problem //############################################################################# void OGSI::loadProblem (const CoinPackedMatrix &matrix, const double *collb_parm, const double *colub_parm, const double *obj_parm, const double *rowlb_parm, const double *rowub_parm) { # if OGSI_TRACK_FRESH > 0 std::cout << "OGSI(" << std::hex << this << std::dec << ")::loadProblem." << std::endl ; # endif /* There's always an existing LPX object. If it's empty, we can simply load in the new data. If it's non-empty, easiest to delete it and start afresh. When we do this, we need to reload parameters. For hints, it's easiest to grab from the existing LPX structure. In any event, get rid of cached data in the OsiGlpk object. */ if (lpx_get_num_cols(lp_) != 0 || lpx_get_num_rows(lp_) != 0) { int presolVal = lpx_get_int_parm(lp_,LPX_K_PRESOL) ; int usedualVal = lpx_get_int_parm(lp_,LPX_K_DUAL) ; int scaleVal = lpx_get_int_parm(lp_,LPX_K_SCALE) ; int logVal = lpx_get_int_parm(lp_,LPX_K_MSGLEV) ; # if OGSI_TRACK_FRESH > 0 std::cout << " emptying LPX(" << std::hex << lp_ << std::dec << "), " # endif lpx_delete_prob(lp_) ; lp_ = lpx_create_prob() ; assert(lp_) ; # if OGSI_TRACK_FRESH > 0 std::cout << "loading LPX(" << std::hex << lp_ << std::dec << ")." << std::endl ; # endif lpx_set_class(lp_,LPX_MIP) ; lpx_set_int_parm(lp_,LPX_K_ITLIM,maxIteration_) ; if (getObjSense() == 1) // minimization { lpx_set_real_parm(lp_,LPX_K_OBJUL,dualObjectiveLimit_) ; lpx_set_real_parm(lp_,LPX_K_OBJLL,primalObjectiveLimit_) ; } else // maximization { lpx_set_real_parm(lp_,LPX_K_OBJLL,dualObjectiveLimit_) ; lpx_set_real_parm(lp_,LPX_K_OBJUL,primalObjectiveLimit_) ; } lpx_set_real_parm(lp_,LPX_K_TOLDJ,dualTolerance_) ; lpx_set_real_parm(lp_,LPX_K_TOLBND,primalTolerance_) ; lpx_set_obj_coef(lp_,0,objOffset_) ; lpx_set_prob_name(lp_,const_cast(probName_.c_str())) ; lpx_set_int_parm(lp_,LPX_K_PRESOL,presolVal) ; lpx_set_int_parm(lp_,LPX_K_DUAL,usedualVal) ; lpx_set_int_parm(lp_,LPX_K_SCALE,scaleVal) ; lpx_set_int_parm(lp_,LPX_K_MSGLEV,logVal) ; messageHandler()->setLogLevel(logVal) ; } freeCachedData(OGSI::KEEPCACHED_NONE) ; double inf = getInfinity() ; int m = matrix.getNumRows() ; int n = matrix.getNumCols() ; int i,j ; double *zeroVec,*infVec,*negInfVec ; const double *collb,*colub,*obj,*rowlb,*rowub ; /* Check if we need default values for any of the vectors, and set up accordingly. */ if (collb_parm == 0 || obj_parm == 0) { zeroVec = new double [n] ; CoinZeroN(zeroVec,n) ; } else { zeroVec = 0 ; } if (colub_parm == 0 || rowub_parm == 0) { if (colub_parm == 0 && rowub_parm == 0) { j = CoinMax(m,n) ; } else if (colub_parm == 0) { j = n ; } else { j = m ; } infVec = new double [j] ; CoinFillN(infVec,j,inf) ; } else { infVec = 0 ; } if (rowlb_parm == 0) { negInfVec = new double [m] ; CoinFillN(negInfVec,m,-inf) ; } else { negInfVec = 0 ; } if (collb_parm == 0) { collb = zeroVec ; } else { collb = collb_parm ; } if (colub_parm == 0) { colub = infVec ; } else { colub = colub_parm ; } if (obj_parm == 0) { obj = zeroVec ; } else { obj = obj_parm ; } if (rowlb_parm == 0) { rowlb = negInfVec ; } else { rowlb = rowlb_parm ; } if (rowub_parm == 0) { rowub = infVec ; } else { rowub = rowub_parm ; } /* The actual load. */ if (matrix.isColOrdered()) { for (j = 0 ; j < n ; j++) { const CoinShallowPackedVector reqdBySunCC = matrix.getVector(j) ; addCol(reqdBySunCC,collb[j],colub[j],obj[j]) ; } // Make sure there are enough rows if (m > getNumRows()) { lpx_add_rows(lp_,m-getNumRows()) ; } for (i = 0 ; i < m ; i++) { setRowBounds(i,rowlb[i],rowub[i]) ; } } else { for (i = 0 ; i < m ; i++) { const CoinShallowPackedVector reqdBySunCC = matrix.getVector(i) ; addRow(reqdBySunCC,rowlb[i],rowub[i]) ; } // Make sure there are enough columns if (n > getNumCols()) { lpx_add_cols(lp_,n-getNumCols()) ; } for (j = 0 ; j < n ; j++) { setColBounds(j,collb[j],colub[j]) ; setObjCoeff(j,obj[j]) ; } } /* Cleanup. */ if (zeroVec) delete[] zeroVec ; if (infVec) delete[] infVec ; if (negInfVec) delete[] negInfVec ; return ; } //----------------------------------------------------------------------------- void OGSI::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub ) { // Could be in OsiSolverInterfaceImpl. loadProblem( *matrix, collb, colub, obj, rowlb, rowub ); delete matrix; matrix = NULL; delete[] collb; collb = NULL; delete[] colub; colub = NULL; delete[] obj; obj = NULL; delete[] rowlb; rowlb = NULL; delete[] rowub; rowub = NULL; } //----------------------------------------------------------------------------- void OGSI::loadProblem( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { // Could be in OsiSolverInterfaceImpl. int numrows = matrix.getNumRows(); double * rowlb = new double[numrows]; double * rowub = new double[numrows]; int i; for( i = numrows - 1; i >= 0; --i ) { convertSenseToBound( rowsen ? rowsen[i]:'G', rowrhs ? rowrhs[i]:0.0, rowrng ? rowrng[i]:0.0, rowlb[i], rowub[i] ); } loadProblem( matrix, collb, colub, obj, rowlb, rowub ); delete [] rowlb; delete [] rowub; } //----------------------------------------------------------------------------- void OGSI::assignProblem( CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng ) { // Could be in OsiSolverInterfaceImpl. loadProblem( *matrix, collb, colub, obj, rowsen, rowrhs, rowrng ); delete matrix; matrix = NULL; delete[] collb; collb = NULL; delete[] colub; colub = NULL; delete[] obj; obj = NULL; delete[] rowsen; rowsen = NULL; delete[] rowrhs; rowrhs = NULL; delete[] rowrng; rowrng = NULL; } //----------------------------------------------------------------------------- void OGSI::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { freeCachedData( OGSI::KEEPCACHED_NONE ); LPX *model = getMutableModelPtr(); double inf = getInfinity(); // Can't send 0 to lpx_add_xxx if (numcols > 0) lpx_add_cols( model, numcols ); if (numrows > 0) lpx_add_rows( model, numrows ); // How many elements? Column-major, so indices of start are columns int numelem = start[ numcols ]; // int numelem = 0; // while ( index[numelem] != 0 ) // numelem++; int *index_adj = new int[1+numelem]; double *value_adj = new double[1+numelem]; int i; for ( i=1; i <= numelem; i++) { index_adj[i] = index[i-1] + 1; value_adj[i] = value[i-1]; } for( i = 0; i < numcols; i++ ) { setColBounds( i, collb ? collb[i]:0.0, colub ? colub[i]:inf ); lpx_set_mat_col( model, i+1, start[i+1]-start[i], &(index_adj[start[i]]), &(value_adj[start[i]]) ); setObjCoeff( i, obj ? obj[i]:0.0 ); } int j; for( j = 0; j < numrows; j++ ) { setRowBounds( j, rowlb ? rowlb[j]:-inf, rowub ? rowub[j]:inf ); } delete [] index_adj; delete [] value_adj; } //----------------------------------------------------------------------------- void OGSI::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) { double * rowlb = new double[numrows]; double * rowub = new double[numrows]; for (int i = numrows-1; i >= 0; --i) { convertSenseToBound(rowsen != NULL ? rowsen[i] : 'G', rowrhs != NULL ? rowrhs[i] : 0.0, rowrng != NULL ? rowrng[i] : 0.0, rowlb[i], rowub[i]); } loadProblem( numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub ); delete[] rowlb; delete[] rowub; } //----------------------------------------------------------------------------- // Read mps files //----------------------------------------------------------------------------- /* Call OSI::readMps, which will parse the mps file and call OsiGlpk::loadProblem. */ int OGSI::readMps (const char *filename, const char *extension) { int retval = OsiSolverInterface::readMps(filename,extension); return (retval) ; } //----------------------------------------------------------------------------- // Write mps files //----------------------------------------------------------------------------- void OGSI::writeMps( const char * filename, const char * extension, double /*objSense*/ ) const { // Could be in OsiSolverInterfaceImpl. #if 1 std::string f( filename ); std::string e( extension ); std::string fullname = f + "." + e; lpx_write_mps( getMutableModelPtr(), const_cast( fullname.c_str() )); #else // Fall back on native MPS writer. // These few lines of code haven't been tested. 2004/10/15 std::string f( filename ); std::string e( extension ); std::string fullname = f + "." + e; OsiSolverInterface::writeMpsNative(fullname.c_str(), NULL, NULL, 0, 2, objSense); #endif } //############################################################################ // GLPK-specific methods //############################################################################ // Get a pointer to the instance LPX * OGSI::getModelPtr () { freeCachedResults(); return lp_; } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //----------------------------------------------------------------------------- // Default Constructor //----------------------------------------------------------------------------- OGSI::OsiGlpkSolverInterface () : OsiSolverInterface() { gutsOfConstructor(); incrementInstanceCounter(); # if OGSI_TRACK_SOLVERS > 0 std::cout << "OGSI(" << std::hex << this << std::dec << "): default constructor." << std::endl ; # endif } //----------------------------------------------------------------------------- // Clone //----------------------------------------------------------------------------- OsiSolverInterface * OGSI::clone(bool copyData) const { # if OGSI_TRACK_SOLVERS > 0 std::cout << "OGSI(" << std::hex << this << std::dec << "): cloning." << std::endl ; # endif if (copyData) return( new OsiGlpkSolverInterface( *this ) ); else return( new OsiGlpkSolverInterface() ); } //----------------------------------------------------------------------------- // Copy constructor //----------------------------------------------------------------------------- OGSI::OsiGlpkSolverInterface( const OsiGlpkSolverInterface & source ) : OsiSolverInterface(source) { gutsOfConstructor(); gutsOfCopy( source ); incrementInstanceCounter(); # if OGSI_TRACK_SOLVERS > 0 std::cout << "OGSI(" << std::hex << this << "): copy from " << &source << std::dec << "." << std::endl ; # endif } //----------------------------------------------------------------------------- // Destructor //----------------------------------------------------------------------------- OGSI::~OsiGlpkSolverInterface () { gutsOfDestructor(); decrementInstanceCounter(); # if OGSI_TRACK_SOLVERS > 0 std::cout << "OGSI(" << std::hex << this << std::dec << "): destructor." << std::endl ; # endif } // Resets // ??? look over this carefully to be sure it is correct void OGSI::reset() { setInitialData(); // this is from the base class OsiSolverInterface gutsOfDestructor(); gutsOfConstructor() ; # if OGSI_TRACK_SOLVERS > 0 std::cout << "OGSI(" << std::hex << this << std::dec << "): reset." << std::endl ; # endif return ; } //----------------------------------------------------------------------------- // Assignment operator //----------------------------------------------------------------------------- OsiGlpkSolverInterface& OGSI::operator=( const OsiGlpkSolverInterface& rhs ) { if( this != &rhs ) { OsiSolverInterface::operator=( rhs ); gutsOfDestructor(); gutsOfConstructor(); if( rhs.lp_ != NULL ) gutsOfCopy( rhs ); } # if OGSI_TRACK_SOLVERS > 0 std::cout << "OGSI(" << std::hex << this << "): assign from " << &rhs << std::dec << "." << std::endl ; # endif return *this; } //############################################################################# // Applying cuts //############################################################################# void OGSI::applyColCut( const OsiColCut & cc ) { // Could be in OsiSolverInterfaceImpl. const double * colLb = getColLower(); const double * colUb = getColUpper(); const CoinPackedVector & lbs = cc.lbs(); const CoinPackedVector & ubs = cc.ubs(); int i; #if 0 // replaced (JJF) because colLb and colUb are invalidated by sets for( i = 0; i < lbs.getNumElements(); ++i ) if( lbs.getElements()[i] > colLb[lbs.getIndices()[i]] ) setColLower( lbs.getIndices()[i], lbs.getElements()[i] ); for( i = 0; i < ubs.getNumElements(); ++i ) if( ubs.getElements()[i] < colUb[ubs.getIndices()[i]] ) setColUpper( ubs.getIndices()[i], ubs.getElements()[i] ); #else double inf = getInfinity(); int type; // lower bounds for( i = 0; i < lbs.getNumElements(); ++i ) { int column = lbs.getIndices()[i]; double lower = lbs.getElements()[i]; double upper = colUb[column]; if( lower > colLb[column] ) { // update cached version as well collower_[column] = lower; if( lower == upper ) type = LPX_FX; else if( lower > -inf && upper < inf ) type = LPX_DB; else if( lower > -inf ) type = LPX_LO; else if( upper < inf) type = LPX_UP; else type = LPX_FR; lpx_set_col_bnds( getMutableModelPtr(), column+1, type, lower, upper ); } } // lower bounds for( i = 0; i < ubs.getNumElements(); ++i ) { int column = ubs.getIndices()[i]; double upper = ubs.getElements()[i]; double lower = colLb[column]; if( upper < colUb[column] ) { // update cached version as well colupper_[column] = upper; if( lower == upper ) type = LPX_FX; else if( lower > -inf && upper < inf ) type = LPX_DB; else if( lower > -inf ) type = LPX_LO; else if( upper < inf) type = LPX_UP; else type = LPX_FR; lpx_set_col_bnds( getMutableModelPtr(), column+1, type, lower, upper ); } } #endif } //----------------------------------------------------------------------------- void OGSI::applyRowCut( const OsiRowCut & rowCut ) { // Could be in OsiSolverInterfaceImpl. addRow( rowCut.row(), rowCut.lb(), rowCut.ub() ); } //############################################################################# // Private methods (non-static and static) and static data //############################################################################# LPX * OGSI::getMutableModelPtr( void ) const { return lp_; } /* This routine must work even if there's no problem loaded in the solver. */ void OGSI::gutsOfCopy (const OsiGlpkSolverInterface &source) { LPX *srclpx = source.lp_ ; LPX *lpx = lp_ ; double dblParam ; int intParam ; std::string strParam ; /* Copy information from the source OSI that a user might change before loading a problem: objective sense and offset, other OSI parameters. Use the get/set parameter calls here to hide pushing information into the LPX object. */ setObjSense(source.getObjSense()) ; source.getDblParam(OsiObjOffset,dblParam) ; setDblParam(OsiObjOffset,dblParam) ; source.getIntParam(OsiNameDiscipline,intParam) ; setIntParam(OsiNameDiscipline,intParam) ; source.getIntParam(OsiMaxNumIteration,intParam) ; setIntParam(OsiMaxNumIteration,intParam) ; source.getIntParam(OsiMaxNumIterationHotStart,intParam) ; setIntParam(OsiMaxNumIterationHotStart,intParam) ; source.getDblParam(OsiPrimalObjectiveLimit,dblParam) ; setDblParam(OsiPrimalObjectiveLimit,dblParam) ; source.getDblParam(OsiDualObjectiveLimit,dblParam) ; setDblParam(OsiDualObjectiveLimit,dblParam) ; source.getDblParam(OsiPrimalTolerance,dblParam) ; setDblParam(OsiPrimalTolerance,dblParam) ; source.getDblParam(OsiDualTolerance,dblParam) ; setDblParam(OsiDualTolerance,dblParam) ; /* For hints, we need to be a little more circumspect, so as not to pump out a bunch of warnings. Pull parameters from the source LPX object and load into the copy. The actual values of the hint parameters (sense & strength) are held up on the parent OSI object, so we don't need to worry about copying them. */ intParam = lpx_get_int_parm(srclpx,LPX_K_PRESOL) ; lpx_set_int_parm(lpx,LPX_K_PRESOL,intParam) ; intParam = lpx_get_int_parm(srclpx,LPX_K_DUAL) ; lpx_set_int_parm(lpx,LPX_K_DUAL,intParam) ; intParam = lpx_get_int_parm(srclpx,LPX_K_SCALE) ; lpx_set_int_parm(lpx,LPX_K_SCALE,intParam) ; /* Printing is a bit more complicated. Pull the parameter and set the log level in the message handler and set the print parameter in glpk. */ intParam = lpx_get_int_parm(srclpx,LPX_K_MSGLEV) ; lpx_set_int_parm(lpx,LPX_K_MSGLEV,intParam) ; messageHandler()->setLogLevel(intParam) ; # ifdef LPX_K_USECUTS intParam=lpx_get_int_parm(lp_,LPX_K_USECUTS); lpx_set_int_parm(lp_,LPX_K_USECUTS,intParam); # endif /* Now --- do we have a problem loaded? If not, we're done. */ int n = source.getNumCols() ; int m = source.getNumRows() ; assert(m >= 0 && n >= 0) ; if (m == 0 && n == 0) { # if OGSI_TRACK_SOLVERS > 0 std::cout << " no problem loaded." << std::endl ; # endif return ; } /* We have rows and/or columns, so we need to transfer the problem. Do a few parameters and status fields that may have changed if a problem is loaded. Then pull the problem information and load it into the lpx object for this OSI. Information on integrality must be copied over separately. */ source.getStrParam(OsiProbName,strParam) ; setStrParam(OsiProbName,strParam) ; bbWasLast_ = source.bbWasLast_ ; iter_used_ = source.iter_used_ ; const double *obj = source.getObjCoefficients() ; const CoinPackedMatrix *cols = source.getMatrixByCol() ; const double *lb = source.getColLower() ; const double *ub = source.getColUpper() ; const double *rlb = source.getRowLower() ; const double *rub = source.getRowUpper() ; loadProblem(*cols,lb,ub,obj,rlb,rub) ; int i,j ; for (j = 0 ; j < n ; j++) { if (source.isInteger(j)) { setInteger(j) ; } } /* Copy the solution information. We need to be a bit careful here. Even though the source has something loaded as a problem, there's no guarantee that we've even called glpk, so we can't consult glpk directly for solution values. */ setColSolution(source.getColSolution()) ; setRowPrice(source.getRowPrice()) ; /* We can, however, consult it directly for variable status: glpk initialises this information as soon as columns and/or rows are created. Of course, that applies to the problem we've just created, too. If we're just copying nonsense, then don't bother. Once we've copied the status into the new lpx object, do the warm-up. */ if (lpx_get_status(srclpx) != LPX_UNDEF) { for (j = 1 ; j <= n ; j++) { int statj = lpx_get_col_stat(srclpx,j) ; lpx_set_col_stat(lpx,j,statj) ; } for (i = 1 ; i <= m ; i++) { int stati = lpx_get_row_stat(srclpx,i) ; lpx_set_row_stat(lpx,i,stati) ; } #ifndef NDEBUG int retval = lpx_warm_up(lpx) ; #endif # if OGSI_TRACK_SOLVERS > 1 std::cout << " lpx_warm_up returns " << retval << "." << std::endl ; # endif assert(retval == LPX_E_OK) ; } return ; } //----------------------------------------------------------------------------- void OGSI::gutsOfConstructor() { bbWasLast_ = 0; iter_used_ = 0; obj_ = NULL; collower_ = NULL; colupper_ = NULL; ctype_ = NULL; rowsense_ = NULL; rhs_ = NULL; rowrange_ = NULL; rowlower_ = NULL; rowupper_ = NULL; colsol_ = NULL; rowsol_ = NULL; redcost_ = NULL; rowact_ = NULL; matrixByRow_ = NULL; matrixByCol_ = NULL; maxIteration_ = COIN_INT_MAX; hotStartMaxIteration_ = 0; nameDisc_ = 0; dualObjectiveLimit_ = getInfinity() ; primalObjectiveLimit_ = -getInfinity() ; dualTolerance_ = 1.0e-6; primalTolerance_ = 1.0e-6; objOffset_ = 0.0 ; probName_ = "" ; hotStartCStat_ = NULL; hotStartCStatSize_ = 0; hotStartRStat_ = NULL; hotStartRStatSize_ = 0; isIterationLimitReached_ = false; isTimeLimitReached_ = false; isAbandoned_ = false; isPrimInfeasible_ = false; isDualInfeasible_ = false; isObjLowerLimitReached_ = false ; isObjUpperLimitReached_ = false ; isFeasible_ = false; lp_ = lpx_create_prob(); assert( lp_ != NULL ); // Make all problems MIPs. See note at top of file. lpx_set_class( lp_, LPX_MIP ); // Push OSI parameters down into LPX object. lpx_set_int_parm(lp_,LPX_K_ITLIM,maxIteration_) ; if (getObjSense() == 1.0) // minimization { lpx_set_real_parm(lp_,LPX_K_OBJUL,dualObjectiveLimit_) ; lpx_set_real_parm(lp_,LPX_K_OBJLL,primalObjectiveLimit_) ; } else // maximization { lpx_set_real_parm(lp_,LPX_K_OBJLL,dualObjectiveLimit_) ; lpx_set_real_parm(lp_,LPX_K_OBJUL,-primalObjectiveLimit_) ; } lpx_set_real_parm(lp_,LPX_K_TOLDJ,dualTolerance_) ; lpx_set_real_parm(lp_,LPX_K_TOLBND,primalTolerance_) ; lpx_set_obj_coef(lp_,0,objOffset_) ; lpx_set_prob_name(lp_,const_cast(probName_.c_str())) ; /* Stefan: with the new simplex algorithm in Glpk 4.31, some netlib instances (e.g., dfl001) take very long or get into a cycle. Thus, let's try to leave parameters onto their defaults. */ // lpx_set_int_parm(lp_,LPX_K_PRESOL,0) ; // lpx_set_int_parm(lp_,LPX_K_DUAL,1) ; // lpx_set_int_parm(lp_,LPX_K_SCALE,3) ; /* Printing is a bit more complicated. Set the log level in the handler and set the print parameter in glpk. */ lpx_set_int_parm(lp_,LPX_K_MSGLEV,1) ; messageHandler()->setLogLevel(1) ; /* Enable cuts if they're available. This is a bit of a pain, as the interface has changed since it was first introduced in 4.9. LPX_K_USECUTS appears in 4.9; the parameter value appears to be unused in this version. LPX_C_ALL appears in 4.10. */ # ifdef LPX_K_USECUTS # ifdef LPX_C_ALL lpx_set_int_parm(lp_,LPX_K_USECUTS,LPX_C_ALL) ; # else lpx_set_int_parm(lp_,LPX_K_USECUTS,0) ; # endif # endif } //----------------------------------------------------------------------------- void OGSI::gutsOfDestructor() { if( lp_ != NULL ) { lpx_delete_prob( lp_ ); lp_=NULL; freeAllMemory(); } assert( lp_ == NULL ); assert( obj_ == NULL ); assert( collower_ == NULL ); assert( colupper_ == NULL ); assert( ctype_ == NULL ); assert( rowsense_ == NULL ); assert( rhs_ == NULL ); assert( rowrange_ == NULL ); assert( rowlower_ == NULL ); assert( rowupper_ == NULL ); assert( colsol_ == NULL ); assert( rowsol_ == NULL ); assert( redcost_ == NULL ); assert( rowact_ == NULL ); assert( matrixByRow_ == NULL ); assert( matrixByCol_ == NULL ); } //----------------------------------------------------------------------------- // free cached vectors //----------------------------------------------------------------------------- void OGSI::freeCachedColRim() { delete [] ctype_; delete [] obj_; delete [] collower_; delete [] colupper_; ctype_ = NULL; obj_ = NULL; collower_ = NULL; colupper_ = NULL; } //----------------------------------------------------------------------------- void OGSI::freeCachedRowRim() { delete [] rowsense_; delete [] rhs_; delete [] rowrange_; delete [] rowlower_; delete [] rowupper_; rowsense_ = NULL; rhs_ = NULL; rowrange_ = NULL; rowlower_ = NULL; rowupper_ = NULL; } //----------------------------------------------------------------------------- void OGSI::freeCachedMatrix() { delete matrixByRow_; delete matrixByCol_; matrixByRow_ = NULL; matrixByCol_ = NULL; } //----------------------------------------------------------------------------- void OGSI::freeCachedResults() { iter_used_ = 0; isAbandoned_ = false; isIterationLimitReached_ = false; isTimeLimitReached_ = false; isPrimInfeasible_ = false; isDualInfeasible_ = false; isFeasible_ = false; delete [] colsol_; delete [] rowsol_; delete [] redcost_; delete [] rowact_; colsol_ = NULL; rowsol_ = NULL; redcost_ = NULL; rowact_ = NULL; } //----------------------------------------------------------------------------- void OGSI::freeCachedData( int keepCached ) { if( !(keepCached & OGSI::KEEPCACHED_COLUMN) ) freeCachedColRim(); if( !(keepCached & OGSI::KEEPCACHED_ROW) ) freeCachedRowRim(); if( !(keepCached & OGSI::KEEPCACHED_MATRIX) ) freeCachedMatrix(); if( !(keepCached & OGSI::KEEPCACHED_RESULTS) ) freeCachedResults(); } //----------------------------------------------------------------------------- void OGSI::freeAllMemory() { freeCachedData(OGSI::KEEPCACHED_NONE); delete[] hotStartCStat_; delete[] hotStartRStat_; hotStartCStat_ = NULL; hotStartCStatSize_ = 0; hotStartRStat_ = NULL; hotStartRStatSize_ = 0; } //----------------------------------------------------------------------------- /*! Set the objective function name. */ void OGSI::setObjName (std::string name) { OsiSolverInterface::setObjName(name) ; lpx_set_obj_name(lp_,const_cast(name.c_str())) ; } /*! Set a row name. Make sure both glpk and OSI see the same name. */ void OGSI::setRowName (int ndx, std::string name) { int nameDiscipline ; /* Quietly do nothing if the index is out of bounds. */ if (ndx < 0 || ndx >= getNumRows()) { return ; } /* Get the name discipline. Quietly do nothing if it's auto. */ (void) getIntParam(OsiNameDiscipline,nameDiscipline) ; if (nameDiscipline == 0) { return ; } /* Set the name in the OSI base, then in the consys structure. */ OsiSolverInterface::setRowName(ndx,name) ; lpx_set_row_name(lp_,ndx+1,const_cast(name.c_str())) ; return ; } /*! Set a column name. Make sure both glpk and OSI see the same name. */ void OGSI::setColName (int ndx, std::string name) { int nameDiscipline ; /* Quietly do nothing if the index is out of bounds. */ if (ndx < 0 || ndx >= getNumCols()) { return ; } /* Get the name discipline. Quietly do nothing if it's auto. */ (void) getIntParam(OsiNameDiscipline,nameDiscipline) ; if (nameDiscipline == 0) { return ; } /* Set the name in the OSI base, then in the consys structure. */ OsiSolverInterface::setColName(ndx,name) ; lpx_set_col_name(lp_,ndx+1,const_cast(name.c_str())) ; return ; } //----------------------------------------------------------------------------- unsigned int OsiGlpkSolverInterface::numInstances_ = 0; void OsiGlpkSolverInterface::decrementInstanceCounter() { assert( numInstances_ != 0 ); if ( --numInstances_ == 0 ) glp_free_env(); } CoinMP-1.8.3/Osi/src/OsiGlpk/osi-glpk-uninstalled.pc.in0000644000175000017500000000046611507670402021213 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/OsiGlpk Name: OsiGlpk Description: COIN-OR Open Solver Interface for GLPK URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsiGlpk.la @OSIGLPKLIB_PCLIBS@ Cflags: -I@abs_source_dir@/src/OsiGlpk Requires: osi @OSIGLPKLIB_PCREQUIRES@ CoinMP-1.8.3/Osi/src/OsiGlpk/osi-glpk.pc.in0000644000175000017500000000051111510106235016652 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiGlpk Description: COIN-OR Open Solver Interface for GLPK URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiGlpk @OSIGLPKLIB_PCLIBS@ Cflags: -I${includedir} Requires: osi @OSIGLPKLIB_PCREQUIRES@ CoinMP-1.8.3/Osi/src/OsiGlpk/OsiGlpkSolverInterface.hpp0000644000175000017500000010121712126117465021311 0ustar renerene//----------------------------------------------------------------------------- // name: OSI Interface for GLPK //----------------------------------------------------------------------------- // Copyright (C) 2001, Vivian De Smedt, Braden Hunsaker // Copyright (C) 2003 University of Pittsburgh // University of Pittsburgh coding done by Brady Hunsaker // All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiGlpkSolverInterface_H #define OsiGlpkSolverInterface_H #include #include "OsiSolverInterface.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" /** GPLK Solver Interface Instantiation of OsiGlpkSolverInterface for GPLK */ #ifndef LPX #define LPX glp_prob #endif #ifndef GLP_PROB_DEFINED #define GLP_PROB_DEFINED // Glpk < 4.48: typedef struct { double _opaque_prob[100]; } glp_prob; // Glpk 4.48: typedef struct glp_prob glp_prob; #endif class OsiGlpkSolverInterface : virtual public OsiSolverInterface { friend void OsiGlpkSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound(); //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Set a string parameter bool setStrParam(OsiStrParam key, const std::string & value); // Set a hint parameter bool setHintParam(OsiHintParam key, bool sense = true, OsiHintStrength strength = OsiHintTry, void *info = 0) ; // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; /// Time limit reached? virtual bool isTimeLimitReached() const; /// (Integer) Feasible solution found? virtual bool isFeasible() const; //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ //@{ /*! \brief Get an empty warm start object This routine returns an empty CoinWarmStartBasis object. Its purpose is to provide a way to give a client a warm start basis object of the appropriate type, which can resized and modified as desired. */ inline CoinWarmStart *getEmptyWarmStart () const { return (dynamic_cast(new CoinWarmStartBasis())) ; } /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching).
    The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
    NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const; /// Get number of rows virtual int getNumRows() const; /// Get number of nonzero elements virtual int getNumElements() const; /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const; /** Get pointer to array[getNumRows()] of row constraint senses.
    • 'L': <= constraint
    • 'E': = constraint
    • 'G': >= constraint
    • 'R': ranged constraint
    • 'N': free constraint
    */ virtual const char * getRowSense() const; /** Get pointer to array[getNumRows()] of rows right-hand sides
    • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
    • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'N' then rhs()[i] == 0.0
    */ virtual const double * getRightHandSide() const; /** Get pointer to array[getNumRows()] of row ranges.
    • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
    • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
    */ virtual const double * getRowRange() const; /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const; /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const; /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const; /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const; /// Return true if column is continuous virtual bool isContinuous(int colNumber) const; #if 0 /// Return true if column is binary virtual bool isBinary(int columnNumber) const; /** Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ virtual bool isInteger(int columnNumber) const; /// Return true if column is general integer virtual bool isIntegerNonBinary(int columnNumber) const; /// Return true if column is binary and not fixed at either bound virtual bool isFreeBinary(int columnNumber) const; #endif /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const; //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const; /// Get objective function value virtual double getObjValue() const; /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const; /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay=false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; #if 0 /** Get vector of indices of solution which are integer variables presently at fractional values */ virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const; #endif //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ); using OsiSolverInterface::setColLower ; /** Set a single column lower bound
    Use -COIN_DBL_MAX for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ); using OsiSolverInterface::setColUpper ; /** Set a single column upper bound
    Use COIN_DBL_MAX for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound
    The default implementation just invokes setColLower() and setColUpper() */ virtual void setColBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
    The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound
    Use -COIN_DBL_MAX for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
    Use COIN_DBL_MAX for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ); /** Set a single row lower and upper bound
    The default implementation just invokes setRowLower() and setRowUpper() */ virtual void setRowBounds( int elementIndex, double lower, double upper ); /** Set the type of a single row
    */ virtual void setRowType(int index, char sense, double rightHandSide, double range); /** Set the bounds on a number of rows simultaneously
    The default implementation just invokes setRowLower() and setRowUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
    The default implementation just invokes setRowType() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose any characteristics changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s); /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
    Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ using OsiSolverInterface::addCol ; /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); using OsiSolverInterface::addCols ; /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); /** */ virtual void deleteCols(const int num, const int * colIndices); using OsiSolverInterface::addRow ; /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); using OsiSolverInterface::addRows ; /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); /** */ virtual void deleteRows(const int num, const int * rowIndices); #if 0 // ??? implemented in OsiSolverInterface //----------------------------------------------------------------------- /** Apply a collection of cuts.
    Only cuts which have an effectiveness >= effectivenessLb are applied.
    • ReturnCode.numberIneffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
    • ReturnCode.numberInconsistent() -- number of invalid cuts
    • ReturnCode.numberInconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
    • ReturnCode.numberInfeasible() -- number of cuts that would make this integer model infeasible
    • ReturnCode.numberApplied() -- number of integer cuts which were applied to the integer model
    • cs.size() == numberIneffective() + numberInconsistent() + numberInconsistentWrtIntegerModel() + numberInfeasible() + nubmerApplied()
    */ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); #endif //@} //@} //--------------------------------------------------------------------------- /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • obj: all variables have 0 objective coefficient
    • rowsen: all rows are >=
    • rowrhs: all right hand sides are 0
    • rowrng: 0 for the ranged rows
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); using OsiSolverInterface::readMps ; /** Read an mps file from the given filename */ virtual int readMps(const char *filename, const char *extension = "mps"); /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; //@} //--------------------------------------------------------------------------- /*! \name Methods for row and column names. Only the set methods need to be overridden to ensure consistent names between OsiGlpk and the OSI base class. */ //@{ /*! \brief Set the objective function name */ void setObjName (std::string name) ; /*! \brief Set a row name Quietly does nothing if the name discipline (#OsiNameDiscipline) is auto. Quietly fails if the row index is invalid. */ void setRowName(int ndx, std::string name) ; /*! \brief Set a column name Quietly does nothing if the name discipline (#OsiNameDiscipline) is auto. Quietly fails if the column index is invalid. */ void setColName(int ndx, std::string name) ; //@} //--------------------------------------------------------------------------- /**@name GLPK specific public interfaces */ //@{ enum keepCachedFlag { /// discard all cached data (default) KEEPCACHED_NONE = 0, /// column information: objective values, lower and upper bounds, variable types KEEPCACHED_COLUMN = 1, /// row information: right hand sides, ranges and senses, lower and upper bounds for row KEEPCACHED_ROW = 2, /// problem matrix: matrix ordered by column and by row KEEPCACHED_MATRIX = 4, /// LP solution: primal and dual solution, reduced costs, row activities KEEPCACHED_RESULTS = 8, /// only discard cached LP solution KEEPCACHED_PROBLEM = KEEPCACHED_COLUMN | KEEPCACHED_ROW | KEEPCACHED_MATRIX, /// keep all cached data (similar to getMutableLpPtr()) KEEPCACHED_ALL = KEEPCACHED_PROBLEM | KEEPCACHED_RESULTS, /// free only cached column and LP solution information FREECACHED_COLUMN = KEEPCACHED_PROBLEM & ~KEEPCACHED_COLUMN, /// free only cached row and LP solution information FREECACHED_ROW = KEEPCACHED_PROBLEM & ~KEEPCACHED_ROW, /// free only cached matrix and LP solution information FREECACHED_MATRIX = KEEPCACHED_PROBLEM & ~KEEPCACHED_MATRIX, /// free only cached LP solution information FREECACHED_RESULTS = KEEPCACHED_ALL & ~KEEPCACHED_RESULTS }; /// Get pointer to GLPK model LPX * getModelPtr(); //@} /**@name Static instance counter methods */ /** GLPK has a context which must be freed after all GLPK LPs (or MIPs) are freed. * It is automatically created when the first LP is created. This method:
    • Increments by 1 the number of uses of the GLPK environment.
    */ static void incrementInstanceCounter() { ++numInstances_; } /** GLPK has a context which must be freed after all GLPK LPs (or MIPs) are freed. This method:
    • Decrements by 1 the number of uses of the GLPK environment.
    • Deletes the GLPK environment when the number of uses is change to 0 from 1.
    */ static void decrementInstanceCounter(); /// Return the number of LP/MIP instances of instantiated objects using the GLPK environment. static unsigned int getNumInstances() { return numInstances_; } //@} /**@name Constructors and destructor */ //@{ /// Default Constructor OsiGlpkSolverInterface(); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiGlpkSolverInterface( const OsiGlpkSolverInterface& ); /// Assignment operator OsiGlpkSolverInterface& operator=( const OsiGlpkSolverInterface& rhs ); /// Destructor virtual ~OsiGlpkSolverInterface(); /// Resets as if default constructor virtual void reset(); //@} protected: /**@name Protected methods */ //@{ /// Apply a row cut. Return true if cut was applied. virtual void applyRowCut( const OsiRowCut & rc ); /** Apply a column cut (bound adjustment). Return true if cut was applied. */ virtual void applyColCut( const OsiColCut & cc ); /// Pointer to the model LPX * getMutableModelPtr() const; //@} private: /**@name Private methods */ //@{ /// The real work of a copy constructor (used by copy and assignment) void gutsOfCopy( const OsiGlpkSolverInterface & source ); /// The real work of the constructor void gutsOfConstructor(); /// The real work of the destructor void gutsOfDestructor(); /// free cached column rim vectors void freeCachedColRim(); /// free cached row rim vectors void freeCachedRowRim(); /// free cached result vectors void freeCachedResults(); /// free cached matrices void freeCachedMatrix(); /// free all cached data (except specified entries, see getLpPtr()) void freeCachedData( int keepCached = KEEPCACHED_NONE ); /// free all allocated memory void freeAllMemory(); /// Just for testing purposes void printBounds(); /// Fill cached collumn bounds void fillColBounds() const; //@} /**@name Private member data */ //@{ /// GPLK model represented by this class instance mutable LPX* lp_; /// number of GLPK instances currently in use (counts only those created by OsiGlpk) static unsigned int numInstances_; // Remember whether simplex or b&b was most recently done // 0 = simplex; 1 = b&b int bbWasLast_; // Int parameters. /// simplex iteration limit (per call to solver) int maxIteration_; /// simplex iteration limit (for hot start) int hotStartMaxIteration_; /// OSI name discipline int nameDisc_; // Double parameters. /// dual objective limit (measure of badness; stop if we're worse) double dualObjectiveLimit_; /// primal objective limit (measure of goodness; stop if we're better) double primalObjectiveLimit_; /// dual feasibility tolerance double dualTolerance_; /// primal feasibility tolerance double primalTolerance_; /// constant offset for objective function double objOffset_; // String parameters /// Problem name std::string probName_; /*! \brief Array for info blocks associated with hints. */ mutable void *info_[OsiLastHintParam] ; /// Hotstart information /// size of column status and value arrays int hotStartCStatSize_; /// column status array int *hotStartCStat_; /// primal variable values double *hotStartCVal_; /// dual variable values double *hotStartCDualVal_; /// size of row status and value arrays int hotStartRStatSize_; /// row status array int *hotStartRStat_; /// row slack values double *hotStartRVal_; /// row dual values double *hotStartRDualVal_; // Status information /// glpk stopped on iteration limit bool isIterationLimitReached_; /// glpk stopped on time limit bool isTimeLimitReached_; /// glpk abandoned the problem bool isAbandoned_; /*! \brief glpk stopped on lower objective limit When minimising, this is the primal limit; when maximising, the dual limit. */ bool isObjLowerLimitReached_; /*! \brief glpk stopped on upper objective limit When minimising, this is the dual limit; when maximising, the primal limit. */ bool isObjUpperLimitReached_; /// glpk declared the problem primal infeasible bool isPrimInfeasible_; /// glpk declared the problem dual infeasible bool isDualInfeasible_; /// glpk declared the problem feasible bool isFeasible_; /**@name Cached information derived from the GLPK model */ //@{ /// Number of iterations mutable int iter_used_; /// Pointer to objective vector mutable double *obj_; /// Pointer to dense vector of variable lower bounds mutable double *collower_; /// Pointer to dense vector of variable lower bounds mutable double *colupper_; /// Pointer to dense vector of variable types (continous, binary, integer) mutable char *ctype_; /// Pointer to dense vector of row sense indicators mutable char *rowsense_; /// Pointer to dense vector of row right-hand side values mutable double *rhs_; /// Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) mutable double *rowrange_; /// Pointer to dense vector of row lower bounds mutable double *rowlower_; /// Pointer to dense vector of row upper bounds mutable double *rowupper_; /// Pointer to primal solution vector mutable double *colsol_; /// Pointer to dual solution vector mutable double *rowsol_; /// Pointer to reduced cost vector mutable double *redcost_; /// Pointer to row activity (slack) vector mutable double *rowact_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByRow_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByCol_; //@} //@} }; //############################################################################# /** A function that tests the methods in the OsiGlpkSolverInterface class. */ void OsiGlpkSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif // OsiGlpkSolverInterface_H CoinMP-1.8.3/Osi/src/OsiXpr/0000755000175000017500000000000012600453455014065 5ustar renereneCoinMP-1.8.3/Osi/src/OsiXpr/Makefile.in0000644000175000017500000005501712506051753016142 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/OsiXpr DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Osi/config.h \ $(top_builddir)/src/Osi/config_osi.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libOsiXpr_la_LIBADD = am_libOsiXpr_la_OBJECTS = OsiXprSolverInterface.lo libOsiXpr_la_OBJECTS = $(am_libOsiXpr_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsiXpr_la_SOURCES) DIST_SOURCES = $(libOsiXpr_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SOPLEX_FALSE = @COIN_HAS_SOPLEX_FALSE@ COIN_HAS_SOPLEX_TRUE = @COIN_HAS_SOPLEX_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPXINCDIR = @CPXINCDIR@ CPXLIB = @CPXLIB@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRBINCDIR = @GRBINCDIR@ GRBLIB = @GRBLIB@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSKINCDIR = @MSKINCDIR@ MSKLIB = @MSKLIB@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSIGLPKLIB_CFLAGS = @OSIGLPKLIB_CFLAGS@ OSIGLPKLIB_CFLAGS_INSTALLED = @OSIGLPKLIB_CFLAGS_INSTALLED@ OSIGLPKLIB_DEPENDENCIES = @OSIGLPKLIB_DEPENDENCIES@ OSIGLPKLIB_LIBS = @OSIGLPKLIB_LIBS@ OSIGLPKLIB_LIBS_INSTALLED = @OSIGLPKLIB_LIBS_INSTALLED@ OSIGLPKLIB_PCLIBS = @OSIGLPKLIB_PCLIBS@ OSIGLPKLIB_PCREQUIRES = @OSIGLPKLIB_PCREQUIRES@ OSILIB_CFLAGS = @OSILIB_CFLAGS@ OSILIB_CFLAGS_INSTALLED = @OSILIB_CFLAGS_INSTALLED@ OSILIB_DEPENDENCIES = @OSILIB_DEPENDENCIES@ OSILIB_LIBS = @OSILIB_LIBS@ OSILIB_LIBS_INSTALLED = @OSILIB_LIBS_INSTALLED@ OSILIB_PCLIBS = @OSILIB_PCLIBS@ OSILIB_PCREQUIRES = @OSILIB_PCREQUIRES@ OSISPXLIB_CFLAGS = @OSISPXLIB_CFLAGS@ OSISPXLIB_CFLAGS_INSTALLED = @OSISPXLIB_CFLAGS_INSTALLED@ OSISPXLIB_DEPENDENCIES = @OSISPXLIB_DEPENDENCIES@ OSISPXLIB_LIBS = @OSISPXLIB_LIBS@ OSISPXLIB_LIBS_INSTALLED = @OSISPXLIB_LIBS_INSTALLED@ OSISPXLIB_PCLIBS = @OSISPXLIB_PCLIBS@ OSISPXLIB_PCREQUIRES = @OSISPXLIB_PCREQUIRES@ OSI_EXAMPLES_SOLVER_CFLAGS = @OSI_EXAMPLES_SOLVER_CFLAGS@ OSI_EXAMPLES_SOLVER_LIBS = @OSI_EXAMPLES_SOLVER_LIBS@ OSI_EXAMPLES_SOLVER_NAME = @OSI_EXAMPLES_SOLVER_NAME@ OSI_EXAMPLES_SOLVER_PCNAME = @OSI_EXAMPLES_SOLVER_PCNAME@ OSI_SVN_REV = @OSI_SVN_REV@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOPLEX_CFLAGS = @SOPLEX_CFLAGS@ SOPLEX_CFLAGS_INSTALLED = @SOPLEX_CFLAGS_INSTALLED@ SOPLEX_DATA = @SOPLEX_DATA@ SOPLEX_DATA_INSTALLED = @SOPLEX_DATA_INSTALLED@ SOPLEX_DEPENDENCIES = @SOPLEX_DEPENDENCIES@ SOPLEX_LIBS = @SOPLEX_LIBS@ SOPLEX_LIBS_INSTALLED = @SOPLEX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPRINCDIR = @XPRINCDIR@ XPRLIB = @XPRLIB@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiXpr # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiXpr.la # List all source files for this library, including headers libOsiXpr_la_SOURCES = \ OsiXprSolverInterface.cpp OsiXprSolverInterface.hpp # This is for libtool (on Windows) libOsiXpr_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. # "top_srcdir" refers to the basic directory for the main package that is # being compiled. AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../Osi` \ -I`$(CYGPATH_W) $(XPRINCDIR)` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiXprSolverInterface.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/OsiXpr/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/OsiXpr/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsiXpr.la: $(libOsiXpr_la_OBJECTS) $(libOsiXpr_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsiXpr_la_LDFLAGS) $(libOsiXpr_la_OBJECTS) $(libOsiXpr_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiXprSolverInterface.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool 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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # 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: CoinMP-1.8.3/Osi/src/OsiXpr/Makefile.am0000644000175000017500000000327411621722556016132 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1800 2011-08-14 10:37:34Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiXpr # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiXpr.la # List all source files for this library, including headers libOsiXpr_la_SOURCES = \ OsiXprSolverInterface.cpp OsiXprSolverInterface.hpp # This is for libtool (on Windows) libOsiXpr_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. # "top_srcdir" refers to the basic directory for the main package that is # being compiled. AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../Osi` \ -I`$(CYGPATH_W) $(XPRINCDIR)` \ $(COINUTILS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Osi ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiXprSolverInterface.hpp CoinMP-1.8.3/Osi/src/OsiXpr/OsiXprSolverInterface.hpp0000644000175000017500000007356011575423733021057 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiXprSolverInterface_H #define OsiXprSolverInterface_H #include #include #include "OsiSolverInterface.hpp" typedef struct xo_prob_struct* XPRSprob; //############################################################################# /** XPRESS-MP Solver Interface Instantiation of OsiSolverInterface for XPRESS-MP */ class OsiXprSolverInterface : virtual public OsiSolverInterface { friend void OsiXprSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound(); //@} /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Set a string parameter bool setStrParam(OsiStrParam key, const std::string & value); // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; // Set mipstart option (pass column solution to XPRESS before MIP start) void setMipStart(bool value) { domipstart = value; } // Get mipstart option value bool getMipStart() const { return domipstart; } //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ //@{ /// Get empty warm start object CoinWarmStart *getEmptyWarmStart () const; /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching).
    The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
    NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const; /// Get number of rows virtual int getNumRows() const; /// Get number of nonzero elements virtual int getNumElements() const; /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const; /** Get pointer to array[getNumRows()] of row constraint senses.
    • 'L': <= constraint
    • 'E': = constraint
    • 'G': >= constraint
    • 'R': ranged constraint
    • 'N': free constraint
    */ virtual const char * getRowSense() const; /** Get pointer to array[getNumRows()] of rows right-hand sides
    • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
    • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'N' then rhs()[i] == 0.0
    */ virtual const double * getRightHandSide() const; /** Get pointer to array[getNumRows()] of row ranges.
    • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
    • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
    */ virtual const double * getRowRange() const; /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const; /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const; /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const; /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const; /// Return true if variable is continuous virtual bool isContinuous(int colIndex) const; #if 0 /// Return true if variable is binary virtual bool isBinary(int colIndex) const; /** Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ virtual bool isInteger(int colIndex) const; /// Return true if variable is general integer virtual bool isIntegerNonBinary(int colIndex) const; /// Return true if variable is binary and not fixed at either bound virtual bool isFreeBinary(int colIndex) const; #endif /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const; //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const; /// Get objective function value virtual double getObjValue() const; /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const; /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay=false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; #if 0 /** Get vector of indices of solution which are integer variables presently at fractional values */ virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05) const; #endif //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ); /** Set a single column lower bound
    Use -COIN_DBL_MAX for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ); /** Set a single column upper bound
    Use COIN_DBL_MAX for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound
    The default implementation just invokes setColLower() and setColUpper() */ virtual void setColBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
    The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound
    Use -COIN_DBL_MAX for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
    Use COIN_DBL_MAX for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ); /** Set a single row lower and upper bound
    The default implementation just invokes setRowLower() and setRowUpper() */ virtual void setRowBounds( int elementIndex, double lower, double upper ); /** Set the type of a single row
    */ virtual void setRowType(int index, char sense, double rightHandSide, double range); /** Set the bounds on a number of rows simultaneously
    The default implementation just invokes setRowLower() and setRowUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
    The default implementation just invokes setRowType() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose any characteristics changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s); /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
    Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); /** */ virtual void deleteCols(const int num, const int * colIndices); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); /** */ virtual void deleteRows(const int num, const int * rowIndices); #if 0 //----------------------------------------------------------------------- /** Apply a collection of cuts.
    Only cuts which have an effectiveness >= effectivenessLb are applied.
    • ReturnCode.numberIneffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
    • ReturnCode.numberInconsistent() -- number of invalid cuts
    • ReturnCode.numberInconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
    • ReturnCode.numberInfeasible() -- number of cuts that would make this integer model infeasible
    • ReturnCode.numberApplied() -- number of integer cuts which were applied to the integer model
    • cs.size() == numberIneffective() + numberInconsistent() + numberInconsistentWrtIntegerModel() + numberInfeasible() + nubmerApplied()
    */ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); //@} //@} #endif //--------------------------------------------------------------------------- /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • obj: all variables have 0 objective coefficient
    • rowsen: all rows are >=
    • rowrhs: all right hand sides are 0
    • rowrng: 0 for the ranged rows
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Read an mps file from the given filename */ virtual int readMps(const char *filename, const char *extension = "mps"); /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; //@} /**@name Message handling */ //@{ /** Pass in a message handler It is the client's responsibility to destroy a message handler installed by this routine; it will not be destroyed when the solver interface is destroyed. */ void passInMessageHandler(CoinMessageHandler * handler); //@} //--------------------------------------------------------------------------- /**@name XPRESS specific public interfaces */ //@{ /**@name Static instance counter methods */ //@{ /** XPRESS has a context that must be created prior to all other XPRESS calls. This method:
    • Increments by 1 the number of uses of the XPRESS environment.
    • Creates the XPRESS context when the number of uses is changed to 1 from 0.
    */ static void incrementInstanceCounter(); /** XPRESS has a context that should be deleted after XPRESS calls. This method:
    • Decrements by 1 the number of uses of the XPRESS environment.
    • Deletes the XPRESS context when the number of uses is change to 0 from 1.
    */ static void decrementInstanceCounter(); /** Return the number of instances of instantiated objects using XPRESS services. */ static unsigned int getNumInstances(); /** Return a pointer to the XPRESS problem */ XPRSprob getLpPtr() { return prob_; } //@} /// Return XPRESS-MP Version number static int version(); /**@name Log File */ //@{ static int iXprCallCount_; /// Get logfile FILE * static FILE * getLogFilePtr(); /**Set logfile name. The logfile is an attempt to capture the calls to Xpress functions for debugging. */ static void setLogFileName( const char * filename ); //@} //@} /**@name Constructors and destructors */ //@{ /// Default Constructor OsiXprSolverInterface (int newrows = 50, int newnz = 100); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiXprSolverInterface (const OsiXprSolverInterface &); /// Assignment operator OsiXprSolverInterface & operator=(const OsiXprSolverInterface& rhs); /// Destructor virtual ~OsiXprSolverInterface (); //@} protected: /**@name Protected methods */ //@{ /// Apply a row cut. Return true if cut was applied. virtual void applyRowCut( const OsiRowCut & rc ); /** Apply a column cut (bound adjustment). Return true if cut was applied. */ virtual void applyColCut( const OsiColCut & cc ); //@} private: /**@name Private static class data */ //@{ /// Name of the logfile static const char * logFileName_; /// The FILE* to the logfile static FILE * logFilePtr_; /// Number of live problem instances static unsigned int numInstances_; /// Counts calls to incrementInstanceCounter() static unsigned int osiSerial_; //@} /**@name Private methods */ //@{ /// The real work of a copy constructor (used by copy and assignment) void gutsOfCopy( const OsiXprSolverInterface & source ); /// The real work of a constructor (used by construct and assignment) void gutsOfConstructor(); /// The real work of a destructor (used by copy and assignment) void gutsOfDestructor(); /// Destroy cached copy of solution data (whenever it changes) void freeSolution(); /** Destroy cached copies of problem and solution data (whenever they change) */ void freeCachedResults(); /// Number of integer variables in the problem int getNumIntVars() const; /**@name Methods to support for XPRESS-MP multiple matrix facility */ //@{ /// Build cached copy of variable types void getVarTypes() const; /** Save the current problem in XPRESS (if necessary) and make this problem current (restore if necessary). */ void activateMe() const; /** Save and restore are necessary if there is data associated with this problem. Also, queries to a problem with no data should respond sensibly; XPRESS query results are undefined. */ bool isDataLoaded() const; //@} //@} /**@name Private member data */ //@{ /**@name Data to support for XPRESS-MP multiple matrix facility */ //@{ mutable XPRSprob prob_; /// XPRESS problem name (should be unique for each saved problem) mutable std::string xprProbname_; //@} /**@name Cached copies of XPRESS-MP problem data */ //@{ /** Pointer to row-wise copy of problem matrix coefficients.
    Note that XPRESS keeps the objective row in the problem matrix, so row indices and counts are adjusted accordingly. */ mutable CoinPackedMatrix *matrixByRow_; mutable CoinPackedMatrix *matrixByCol_; /// Pointer to dense vector of structural variable upper bounds mutable double *colupper_; /// Pointer to dense vector of structural variable lower bounds mutable double *collower_; /// Pointer to dense vector of slack variable upper bounds mutable double *rowupper_; /// Pointer to dense vector of slack variable lower bounds mutable double *rowlower_; /// Pointer to dense vector of row sense indicators mutable char *rowsense_; /// Pointer to dense vector of row right-hand side values mutable double *rhs_; /** Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) */ mutable double *rowrange_; /// Pointer to dense vector of objective coefficients mutable double *objcoeffs_; /// Sense of objective (1 for min; -1 for max) mutable double objsense_; /// Pointer to dense vector of primal structural variable values mutable double *colsol_; /// Pointer to dense vector of primal slack variable values mutable double *rowsol_; /// Pointer to dense vector of primal slack variable values mutable double *rowact_; /// Pointer to dense vector of dual row variable values mutable double *rowprice_; /// Pointer to dense vector of dual column variable values mutable double *colprice_; /// Pointer to list of indices of XPRESS "global" variables mutable int *ivarind_; /** Pointer to list of global variable types:
    • 'B': binary variable
    • 'I': general integer variable (but might have 0-1 bounds)
    • 'P': partial integer variable (not currently supported)
    • 'S': sem-continuous variable (not currently supported)
    */ mutable char *ivartype_; /** Pointer to dense vector of variable types (as above, or 'C' for continuous) */ mutable char *vartype_; /** Indicates whether the last solve was for a MIP or an LP. */ mutable bool lastsolvewasmip; //@} //@} /// Whether to pass a column solution to XPRESS before starting MIP solve (loadmipsol) bool domipstart; }; //############################################################################# /** A function that tests the methods in the OsiXprSolverInterface class. */ void OsiXprSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Osi/src/OsiXpr/osi-xpress-uninstalled.pc.in0000644000175000017500000000044011507670402021446 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/OsiXpr Name: OsiXpress Description: COIN-OR Open Solver Interface for Xpress URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsiXpr.la @XPRLIB@ Cflags: -I@abs_source_dir@/src/OsiXpr -I@XPRINCDIR@ Requires: osi CoinMP-1.8.3/Osi/src/OsiXpr/OsiXprSolverInterface.cpp0000644000175000017500000022076311630504165021040 0ustar renerene// copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* OPEN: have a look at the OPEN tags */ /* OPEN: read/set more controls ... */ #include #include #include #include "CoinPragma.hpp" #define __ANSIC_ #include #undef __ANSIC_ #include "OsiXprSolverInterface.hpp" #include "CoinHelperFunctions.hpp" #include "OsiCuts.hpp" #include "OsiColCut.hpp" #include "CoinPackedMatrix.hpp" #include "OsiRowCut.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinMessage.hpp" //#define DEBUG static void XPRS_CC OsiXprMessageCallback(XPRSprob prob, void *vUserDat, const char *msg, int msgLen, int msgType) { if (vUserDat) { if (msgType < 0 ) { ((CoinMessageHandler*)vUserDat)->finish(); } else { /* CoinMessageHandler does not recognize that a "\0" string means that a newline should be printed. * So we let it print a space (followed by a newline). */ if (((CoinMessageHandler*)vUserDat)->logLevel() > 0) ((CoinMessageHandler*)vUserDat)->message(0, "XPRS", *msg ? msg : " ", ' ') << CoinMessageEol; } } else { if (msgType < 0) { fflush(stdout); } else { printf("%.*s\n", msgLen, msg); fflush(stdout); } } } static void reporterror(const char *fname, int iline, int ierr) { fprintf( stdout, "ERROR: %s in line %d error %d occured\n", fname, iline, ierr ); } #define XPRS_CHECKED(function, args) do { \ int _nReturn; \ if( (_nReturn = function args ) !=0 ) { \ reporterror (#function,__LINE__,_nReturn); \ } \ } while (0) //############################################################################# // Solve methods //############################################################################# void OsiXprSolverInterface::initialSolve() { freeSolution(); #if XPVERSION <= 20 if ( objsense_ == 1.0 ) { XPRS_CHECKED( XPRSminim, (prob_,"l") ); } else if ( objsense_ == -1.0 ) { XPRS_CHECKED( XPRSmaxim, (prob_,"l")); } #else XPRS_CHECKED( XPRSlpoptimize, (prob_, "l") ); #endif lastsolvewasmip = false; } //----------------------------------------------------------------------------- void OsiXprSolverInterface::resolve() { freeSolution(); #if XPVERSION <= 20 if ( objsense_ == 1.0 ) { XPRS_CHECKED( XPRSminim, (prob_,"dl") ); } else if ( objsense_ == -1.0 ) { XPRS_CHECKED( XPRSmaxim, (prob_,"dl") ) ; } #else XPRS_CHECKED( XPRSlpoptimize, (prob_, "dl") ); #endif lastsolvewasmip = false; } //----------------------------------------------------------------------------- void OsiXprSolverInterface::branchAndBound(){ int status; if( colsol_ != NULL && domipstart ) { XPRS_CHECKED( XPRSloadmipsol, (prob_, colsol_, &status) ); /* status = 0 .. accepted * = 1 .. infeasible * = 2 .. cutoff * = 3 .. LP reoptimization interrupted */ } freeSolution(); #if XPVERSION <= 20 /* XPRSglobal cannot be called if there is no LP relaxation available yet * -> solve LP relaxation first, if no LP solution available */ XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); if (status != XPRS_LP_OPTIMAL) initialSolve(); XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); if (status != XPRS_LP_OPTIMAL) { messageHandler()->message(0, "XPRS", "XPRESS failed to solve LP relaxation; cannot call XPRSglobal", ' ') << CoinMessageEol; return; } #else XPRS_CHECKED( XPRSmipoptimize, (prob_, "") ); #endif lastsolvewasmip = true; } //############################################################################# // Parameter related methods //############################################################################# bool OsiXprSolverInterface::setIntParam(OsiIntParam key, int value) { bool retval = false; switch (key) { case OsiMaxNumIteration: retval = XPRSsetintcontrol(prob_,XPRS_LPITERLIMIT, value) == 0; break; case OsiMaxNumIterationHotStart: retval = false; break; case OsiLastIntParam: retval = false; break; case OsiNameDiscipline: retval = false; break; } return retval; } //----------------------------------------------------------------------------- /* OPEN: more dbl parameters ... */ bool OsiXprSolverInterface::setDblParam(OsiDblParam key, double value) { bool retval = false; switch (key) { case OsiDualObjectiveLimit: retval = XPRSsetdblcontrol(prob_,XPRS_MIPABSCUTOFF, value) == 0; break; case OsiPrimalObjectiveLimit: retval = false; break; case OsiDualTolerance: retval = XPRSsetdblcontrol(prob_, XPRS_FEASTOL, value) == 0; break; case OsiPrimalTolerance: retval = XPRSsetdblcontrol(prob_, XPRS_FEASTOL, value) == 0; break; case OsiObjOffset: return OsiSolverInterface::setDblParam(key, value); case OsiLastDblParam: retval = false; break; } return retval; } //----------------------------------------------------------------------------- bool OsiXprSolverInterface::setStrParam(OsiStrParam key, const std::string & value) { bool retval=false; switch (key) { case OsiProbName: /* OPEN: what does this mean */ OsiSolverInterface::setStrParam(key,value); return retval = true; case OsiLastStrParam: return false; case OsiSolverName: return false; } return false; } //----------------------------------------------------------------------------- bool OsiXprSolverInterface::getIntParam(OsiIntParam key, int& value) const { bool retval = false; switch (key) { case OsiMaxNumIteration: /* OPEN: the return value was logically wrong */ retval = XPRSgetintcontrol(prob_,XPRS_LPITERLIMIT, &value) == 0; break; case OsiMaxNumIterationHotStart: retval = false; break; case OsiLastIntParam: retval = false; break; case OsiNameDiscipline: retval = false; break; } return retval; } //----------------------------------------------------------------------------- bool OsiXprSolverInterface::getDblParam(OsiDblParam key, double& value) const { bool retval = false; switch (key) { case OsiDualObjectiveLimit: retval = XPRSgetdblcontrol(prob_,XPRS_MIPABSCUTOFF, &value) == 0; break; case OsiPrimalObjectiveLimit: retval = false; break; case OsiDualTolerance: retval = XPRSgetdblcontrol(prob_, XPRS_FEASTOL, &value) == 0; break; case OsiPrimalTolerance: retval = XPRSgetdblcontrol(prob_, XPRS_FEASTOL, &value) == 0; break; case OsiObjOffset: retval = OsiSolverInterface::getDblParam(key, value); break; case OsiLastDblParam: retval = false; break; } return retval; } //----------------------------------------------------------------------------- bool OsiXprSolverInterface::getStrParam(OsiStrParam key, std::string & value) const { bool retval = false; switch (key) { case OsiProbName: OsiSolverInterface::getStrParam(key, value); retval = true; break; case OsiSolverName: value = "xpress"; retval = true; break; case OsiLastStrParam: retval = false; } return retval; } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# bool OsiXprSolverInterface::isAbandoned() const { int status, glstat; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_MIPSTATUS, &glstat) ); return status == XPRS_LP_UNFINISHED // LP unfinished || glstat == XPRS_MIP_NO_SOL_FOUND // global search incomplete -- no int sol || glstat == XPRS_MIP_SOLUTION; // global search incomplete -- int sol found } bool OsiXprSolverInterface::isProvenOptimal() const { int status, glstat; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_MIPSTATUS, &glstat) ); return status == XPRS_LP_OPTIMAL // LP optimal || status == XPRS_LP_CUTOFF // LP obj worse than cutoff || glstat == XPRS_MIP_OPTIMAL; // global search complete -- int found } bool OsiXprSolverInterface::isProvenPrimalInfeasible() const { int status; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); return status == XPRS_LP_INFEAS; // LP infeasible } bool OsiXprSolverInterface::isProvenDualInfeasible() const { int status; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); return status == XPRS_LP_UNBOUNDED; // LP Unbounded } bool OsiXprSolverInterface::isPrimalObjectiveLimitReached() const { /* OPEN: what does that mean */ return false; // N/A in XOSL } bool OsiXprSolverInterface::isDualObjectiveLimitReached() const { int status; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); return status == XPRS_LP_CUTOFF_IN_DUAL; // LP cut off in dual } bool OsiXprSolverInterface::isIterationLimitReached() const { int itrlim, itcnt; XPRS_CHECKED( XPRSgetintcontrol, (prob_,XPRS_LPITERLIMIT, &itrlim) ); XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_SIMPLEXITER, &itcnt) ); return itcnt >= itrlim; } //############################################################################# // WarmStart related methods //############################################################################# CoinWarmStart* OsiXprSolverInterface::getEmptyWarmStart () const { return (dynamic_cast(new CoinWarmStartBasis())); } CoinWarmStart* OsiXprSolverInterface::getWarmStart() const { int pstat, retstat; /* OPEN: what does this mean */ XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_PRESOLVESTATE, &pstat) ); if ( (pstat & 128) == 0 ) return NULL; CoinWarmStartBasis *ws = NULL; int numcols = getNumCols(); int numrows = getNumRows(); const double *lb = getColLower(); double infty = getInfinity(); int *rstatus = new int[numrows]; int *cstatus = new int[numcols]; retstat = XPRSgetbasis(prob_,rstatus, cstatus); if ( retstat == 0 ) { int i; ws = new CoinWarmStartBasis; ws->setSize( numcols, numrows ); for( i = 0; i < numrows; i++ ) { switch( rstatus[i] ) { case 0: ws->setArtifStatus(i, CoinWarmStartBasis::atLowerBound); break; case 1: ws->setArtifStatus(i, CoinWarmStartBasis::basic); break; case 2: ws->setArtifStatus(i, CoinWarmStartBasis::atUpperBound); break; case 3: ws->setArtifStatus(i, CoinWarmStartBasis::isFree); break; default: // unknown row status delete ws; ws = NULL; goto TERMINATE; } } for( i = 0; i < numcols; i++ ) { switch( cstatus[i] ) { case 0: if ( lb[i] <= -infty ) ws->setStructStatus(i, CoinWarmStartBasis::isFree); else ws->setStructStatus(i, CoinWarmStartBasis::atLowerBound); break; case 1: ws->setStructStatus( i, CoinWarmStartBasis::basic ); break; case 2: ws->setStructStatus( i, CoinWarmStartBasis::atUpperBound ); break; case 3: ws->setStructStatus(i, CoinWarmStartBasis::isFree); break; default: // unknown column status delete ws; ws = NULL; goto TERMINATE; } } } TERMINATE: delete[] cstatus; delete[] rstatus; return ws; } //----------------------------------------------------------------------------- bool OsiXprSolverInterface::setWarmStart(const CoinWarmStart* warmstart) { const CoinWarmStartBasis* ws = dynamic_cast(warmstart); if ( !ws ) return false; int numcols = ws->getNumStructural(); int numrows = ws->getNumArtificial(); if ( numcols != getNumCols() || numrows != getNumRows() ) return false; bool retval; int retstat; int *cstatus = new int[numcols]; int *rstatus = new int[numrows]; int i; for ( i = 0; i < numrows; i++ ) { switch( ws->getArtifStatus(i) ) { case CoinWarmStartBasis::atLowerBound: rstatus[i] = 0; break; case CoinWarmStartBasis::basic: rstatus[i] = 1; break; case CoinWarmStartBasis::atUpperBound: rstatus[i] = 2; break; default: // unknown row status retval = false; goto TERMINATE; } } for( i = 0; i < numcols; i++ ) { switch( ws->getStructStatus(i) ) { case CoinWarmStartBasis::atLowerBound: case CoinWarmStartBasis::isFree: cstatus[i] = 0; break; case CoinWarmStartBasis::basic: cstatus[i] = 1; break; case CoinWarmStartBasis::atUpperBound: cstatus[i] = 2; break; default: // unknown row status retval = false; goto TERMINATE; } } retstat = XPRSloadbasis(prob_,rstatus, cstatus); retval = (retstat == 0); TERMINATE: delete[] cstatus; delete[] rstatus; return retval; } //############################################################################# // Hotstart related methods (primarily used in strong branching) //############################################################################# void OsiXprSolverInterface::markHotStart() { // *FIXME* : do better... -LL OsiSolverInterface::markHotStart(); } void OsiXprSolverInterface::solveFromHotStart() { // *FIXME* : do better... -LL OsiSolverInterface::solveFromHotStart(); } void OsiXprSolverInterface::unmarkHotStart() { // *FIXME* : do better... -LL OsiSolverInterface::unmarkHotStart(); } //############################################################################# // Problem information methods (original data) //############################################################################# //------------------------------------------------------------------ // Get number of rows and columns //------------------------------------------------------------------ int OsiXprSolverInterface::getNumCols() const { if ( !isDataLoaded() ) return 0; int ncols; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_ORIGINALCOLS, &ncols) ); return ncols; } //----------------------------------------------------------------------------- int OsiXprSolverInterface::getNumRows() const { if ( !isDataLoaded() ) return 0; int nrows; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_ORIGINALROWS, &nrows) ); return nrows; } //----------------------------------------------------------------------------- int OsiXprSolverInterface::getNumElements() const { if ( !isDataLoaded() ) return 0; int retVal; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_ELEMS, &retVal) ); return retVal; } //------------------------------------------------------------------ // Get pointer to rim vectors //------------------------------------------------------------------ const double * OsiXprSolverInterface::getColLower() const { if ( collower_ == NULL ) { if ( isDataLoaded() ) { int ncols = getNumCols(); if ( ncols > 0 ) { collower_ = new double[ncols]; XPRS_CHECKED( XPRSgetlb, (prob_,collower_, 0, ncols - 1) ); } } } return collower_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getColUpper() const { if ( colupper_ == NULL ) { if ( isDataLoaded() ) { int ncols = getNumCols(); if ( ncols > 0 ) { colupper_ = new double[ncols]; XPRS_CHECKED( XPRSgetub, (prob_,colupper_, 0, ncols - 1) ); } } } return colupper_; } //----------------------------------------------------------------------------- const char * OsiXprSolverInterface::getRowSense() const { if ( rowsense_ == NULL ) { if ( isDataLoaded() ) { int nrows = getNumRows(); if ( nrows > 0 ) { rowsense_ = new char[nrows]; XPRS_CHECKED( XPRSgetrowtype, (prob_,rowsense_, 0, nrows - 1) ); } } } return rowsense_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getRightHandSide() const { if ( rhs_ == NULL ) { if ( isDataLoaded() ) { int nrows = getNumRows(); if ( nrows > 0 ) { rhs_ = new double[nrows]; XPRS_CHECKED( XPRSgetrhs, (prob_,rhs_, 0, nrows - 1) ); // Make sure free rows have rhs of zero const char * rs = getRowSense(); int nr = getNumRows(); int i; for ( i = 0; i < nr; i++ ) { if ( rs[i] == 'N' ) rhs_[i]=0.0; } } } } return rhs_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getRowRange() const { if ( rowrange_ == NULL ) { if ( isDataLoaded() ) { int nrows = getNumRows(); if ( nrows > 0 ) { rowrange_ = new double[nrows]; XPRS_CHECKED( XPRSgetrhsrange, (prob_,rowrange_, 0, nrows - 1) ); // Make sure non-R rows have range of 0.0 // XPRESS seems to set N and L rows to a range of Infinity const char * rs = getRowSense(); int nr = getNumRows(); int i; for ( i = 0; i < nr; i++ ) { if ( rs[i] != 'R' ) rowrange_[i] = 0.0; } } } } return rowrange_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getRowLower() const { if ( rowlower_ == NULL ) { int nrows = getNumRows(); const char *rowsense = getRowSense(); const double *rhs = getRightHandSide(); const double *rowrange = getRowRange(); if ( nrows > 0 ) { rowlower_ = new double[nrows]; double dum1; for ( int i = 0; i < nrows; i++ ) { convertSenseToBound(rowsense[i], rhs[i], rowrange[i], rowlower_[i], dum1); } } } return rowlower_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getRowUpper() const { if ( rowupper_ == NULL ) { int nrows = getNumRows(); const char *rowsense = getRowSense(); const double *rhs = getRightHandSide(); const double *rowrange = getRowRange(); if ( nrows > 0 ) { rowupper_ = new double[nrows]; double dum1; for ( int i = 0; i < nrows; i++ ) { convertSenseToBound(rowsense[i], rhs[i], rowrange[i], dum1, rowupper_[i]); } } } return rowupper_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getObjCoefficients() const { if ( objcoeffs_ == NULL ) { if ( isDataLoaded() ) { int ncols = getNumCols(); if ( ncols > 0 ) { objcoeffs_ = new double[ncols]; XPRS_CHECKED( XPRSgetobj, (prob_,objcoeffs_, 0, ncols - 1) ); } } } return objcoeffs_; } //----------------------------------------------------------------------------- double OsiXprSolverInterface::getObjSense() const { return objsense_; } //----------------------------------------------------------------------------- // Return information on integrality //----------------------------------------------------------------------------- bool OsiXprSolverInterface::isContinuous(int colNumber) const { getVarTypes(); //std::cerr <<"OsiXprSolverInterface::isContinuous " <colupper(); const double *collower = this->collower(); getVarTypes(); return isBinary(colNumber) && colupper[colNumber] != collower[colNumber]; } #endif //------------------------------------------------------------------ // Row and column copies of the matrix ... //------------------------------------------------------------------ const CoinPackedMatrix * OsiXprSolverInterface::getMatrixByRow() const { if ( matrixByRow_ == NULL ) { if ( isDataLoaded() ) { int nrows = getNumRows(); int ncols = getNumCols(); int nelems; XPRS_CHECKED( XPRSgetrows, (prob_,NULL, NULL, NULL, 0, &nelems, 0, nrows - 1) ); int *start = new int [nrows + 1]; int *length = new int [nrows]; int *index = new int [nelems]; double *element = new double[nelems]; XPRS_CHECKED( XPRSgetrows, (prob_,start, index, element, nelems, &nelems, 0, nrows - 1) ); std::adjacent_difference(start + 1, start + (nrows+1), length); matrixByRow_ = new CoinPackedMatrix(true,0,0); // (mjs) No gaps! // Gaps =><= presolve. matrixByRow_->assignMatrix(false /* not column ordered */, ncols, nrows, nelems, element, index, start, length); } else { matrixByRow_ = new CoinPackedMatrix(true,0,0); // (mjs) No gaps! matrixByRow_->reverseOrdering(); } } return matrixByRow_; } //----------------------------------------------------------------------------- const CoinPackedMatrix * OsiXprSolverInterface::getMatrixByCol() const { if ( matrixByCol_ == NULL ) { matrixByCol_ = new CoinPackedMatrix(*getMatrixByRow()); matrixByCol_->reverseOrdering(); } return matrixByCol_; } //------------------------------------------------------------------ // Get solver's value for infinity //------------------------------------------------------------------ double OsiXprSolverInterface::getInfinity() const { return XPRS_PLUSINFINITY; } //############################################################################# // Problem information methods (results) //############################################################################# const double * OsiXprSolverInterface::getColSolution() const { if ( colsol_ == NULL ) { if ( isDataLoaded() ) { int status; int nc = getNumCols(); if ( nc > 0 ) { colsol_ = new double[nc]; if( lastsolvewasmip ) { XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_MIPSTATUS, &status) ); if( status == XPRS_MIP_SOLUTION || status == XPRS_MIP_OPTIMAL ) XPRS_CHECKED( XPRSgetmipsol, (prob_,colsol_, NULL) ); else XPRS_CHECKED( XPRSgetlb, (prob_,colsol_, 0, nc-1) ); } else { XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); if( status == XPRS_LP_OPTIMAL ) XPRS_CHECKED( XPRSgetlpsol, (prob_,colsol_, NULL, NULL, NULL) ); else XPRS_CHECKED( XPRSgetlb, (prob_,colsol_, 0, nc-1) ); } } } } return colsol_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getRowPrice() const { if ( rowprice_ == NULL ) { if ( isDataLoaded() ) { int nr = getNumRows(); if ( nr > 0 ) { int status; rowprice_ = new double[nr]; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); if( status == XPRS_LP_OPTIMAL ) XPRS_CHECKED( XPRSgetlpsol, (prob_,NULL, NULL, rowprice_, NULL) ); else memset(rowprice_, 0, nr * sizeof(double)); } } } return rowprice_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getReducedCost() const { if ( colprice_ == NULL ) { if ( isDataLoaded() ) { int status; int nc = getNumCols(); colprice_ = new double[nc]; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); if( status == XPRS_LP_OPTIMAL ) XPRS_CHECKED( XPRSgetlpsol, (prob_,NULL, NULL,NULL, colprice_) ); else memset(colprice_, 0, nc * sizeof(double)); } } return colprice_; } //----------------------------------------------------------------------------- const double * OsiXprSolverInterface::getRowActivity() const { if( rowact_ == NULL ) { if ( isDataLoaded() ) { int nrows = getNumRows(); if( nrows > 0 ) { int status; int i; const double* rhs = getRightHandSide(); rowact_ = new double[nrows]; if( lastsolvewasmip ) { XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_MIPSTATUS, &status) ); if( status == XPRS_MIP_SOLUTION || status == XPRS_MIP_OPTIMAL ) { XPRS_CHECKED( XPRSgetmipsol, (prob_,NULL,rowact_) ); for ( i = 0; i < nrows; i++ ) rowact_[i] = rhs[i] - rowact_[i]; } else memset(rowact_, 0, nrows * sizeof(double)); } else { XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); if( status == XPRS_LP_OPTIMAL ) { XPRS_CHECKED( XPRSgetlpsol, (prob_,NULL, rowact_, NULL, NULL) ); for ( i = 0; i < nrows; i++ ) rowact_[i] = rhs[i] - rowact_[i]; } else memset(rowact_, 0, nrows * sizeof(double)); } #if 0 /* OPEN: why do we need the presolve state here ??? */ XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_PRESOLVESTATE, &status) ); if ( status == 7 ) { int i; XPRS_CHECKED( XPRSgetsol, (prob_,NULL, rowact_, NULL, NULL) ); for ( i = 0; i < nrows; i++ ) rowact_[i] = rhs[i] - rowact_[i]; } else { CoinFillN(rowact_, nrows, 0.0); } #endif } } } return rowact_; } //----------------------------------------------------------------------------- double OsiXprSolverInterface::getObjValue() const { double objvalue = 0; double objconstant = 0; if ( isDataLoaded() ) { int status; if( lastsolvewasmip ) { XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_MIPSTATUS, &status) ); if( status == XPRS_MIP_SOLUTION || status == XPRS_MIP_OPTIMAL ) XPRS_CHECKED( XPRSgetdblattrib, (prob_, XPRS_MIPOBJVAL, &objvalue) ); else objvalue = CoinPackedVector(getNumCols(), getObjCoefficients()).dotProduct(getColSolution()); } else { XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_LPSTATUS, &status) ); if( status == XPRS_LP_OPTIMAL ) XPRS_CHECKED( XPRSgetdblattrib, (prob_, XPRS_LPOBJVAL, &objvalue) ); else objvalue = CoinPackedVector(getNumCols(), getObjCoefficients()).dotProduct(getColSolution()); } OsiSolverInterface::getDblParam(OsiObjOffset, objconstant); // Constant offset is not saved with the xpress representation, // but it has to be returned from here anyway. } return objvalue - objconstant; } //----------------------------------------------------------------------------- int OsiXprSolverInterface::getIterationCount() const { int itcnt; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_SIMPLEXITER, &itcnt) ); return itcnt; } //----------------------------------------------------------------------------- std::vector OsiXprSolverInterface::getDualRays(int maxNumRays, bool fullRay) const { // *FIXME* : must write the method -LL throw CoinError("method is not yet written", "getDualRays", "OsiXprSolverInterface"); return std::vector(); } //----------------------------------------------------------------------------- std::vector OsiXprSolverInterface::getPrimalRays(int maxNumRays) const { #if 0 // *FIXME* : Still need to expand column into full ncols-length vector const int nrows = getNumRows(); int nrspar; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_SPAREROWS, &nrspar) ); int junb; int retcode; retcode = XPRSgetunbvec(prob_,&junb); if ( retcode != 0 ) return std::vector(0, (double *) NULL);; double *ray = new double[nrows]; if ( junb < nrows ) { // it's a slack int i; for ( i = 0; i < nrows; i++ ) ray[i] = 0.0; ray[junb] = 1.0; XPRS_CHECKED( XPRSftran, (prob_,ray) ); } else if ( junb >= nrows + nrspar && junb < nrows + nrspar + getNumCols() ){ // it's a structural variable int *mstart = new int[nrows]; int *mrowind = new int[nrows]; double *dmatval = new double[nrows]; int nelt; int jcol = junb - nrows - nrspar; XPRS_CHECKED( XPRSgetcols, (prob_,mstart, mrowind, dmatval, nrows, &nelt, jcol, jcol) ); /* Unpack into the zeroed array y */ int i, ielt; for ( i = 0; i < nrows; i++ ) ray[i] = 0.0; for ( ielt = 0; ielt < nelt; ielt++ ) ray[mrowind[ielt]] = dmatval[ielt]; XPRS_CHECKED( XPRSftran, (prob_,ray) ); delete [] mstart; delete [] mrowind; delete [] dmatval; } else { // it's an error retcode = 1; } if ( retcode == 0 ) return std::vector(1, ray); else { delete ray; return std::vector(0, (double *) NULL); } #endif // *FIXME* : must write the method -LL throw CoinError("method is not yet written", "getPrimalRays", "OsiXprSolverInterface"); return std::vector(); } //----------------------------------------------------------------------------- #if 0 OsiVectorInt OsiXprSolverInterface::getFractionalIndices(const double etol) const { OsiVectorInt retVal; int numInts = numintvars(); const double *sol = colsol(); getVarTypes(); OsiRelFltEq eq(etol); for ( int i = 0; i < numInts; i++ ) { double colSolElem = sol[ivarind_[i]]; double distanceFromInteger = colSolElem - floor(colSolElem + 0.5); if ( !eq( distanceFromInteger, 0.0 ) ) retVal.push_back(ivarind_[i]); } return retVal; } #endif //############################################################################# // Problem modifying methods (rim vectors) //############################################################################# void OsiXprSolverInterface::setObjCoeff( int elementIndex, double elementValue ) { if ( isDataLoaded() ) { XPRS_CHECKED( XPRSchgobj, (prob_,1, &elementIndex, &elementValue) ); freeCachedResults(); } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setColLower( int elementIndex, double elementValue ) { if ( isDataLoaded() ) { char boundType = 'L'; getVarTypes(); if ( vartype_ && vartype_[elementIndex] == 'B' && (elementValue != 0.0 && elementValue != 1.0) ) { char elementType = 'I'; XPRS_CHECKED( XPRSchgcoltype, (prob_,1, &elementIndex, &elementType) ); } XPRS_CHECKED( XPRSchgbounds, (prob_,1, &elementIndex, &boundType, &elementValue) ); freeCachedResults(); // delete [] collower_; // collower_ = NULL; } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setColUpper( int elementIndex, double elementValue ) { if ( isDataLoaded() ) { char boundType = 'U'; getVarTypes(); XPRS_CHECKED( XPRSchgbounds, (prob_,1, &elementIndex, &boundType, &elementValue) ); if ( vartype_ && vartype_[elementIndex] == 'B' && (elementValue != 0.0 && elementValue != 1.0) ) { char elementType = 'I'; XPRS_CHECKED( XPRSchgcoltype, (prob_,1, &elementIndex, &elementType) ); } freeCachedResults(); // delete [] colupper_; // colupper_ = NULL; } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setColBounds(const int elementIndex, double lower, double upper ) { if ( isDataLoaded() ) { char qbtype[2] = { 'L', 'U' }; int mindex[2]; double bnd[2]; getVarTypes(); mindex[0] = elementIndex; mindex[1] = elementIndex; bnd[0] = lower; bnd[1] = upper; XPRS_CHECKED( XPRSchgbounds, (prob_,2, mindex, qbtype, bnd) ); if ( vartype_ && vartype_[mindex[0]] == 'B' && !((lower == 0.0 && upper == 0.0) || (lower == 1.0 && upper == 1.0) || (lower == 0.0 && upper == 1.0)) ) { char elementType = 'I'; XPRS_CHECKED( XPRSchgcoltype, (prob_,1, &mindex[0], &elementType) ); } freeCachedResults(); // delete [] colupper_; // colupper_ = NULL; } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { OsiSolverInterface::setColSetBounds(indexFirst, indexLast, boundList); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setRowLower( int elementIndex, double elementValue ) { double rhs = getRightHandSide()[elementIndex]; double range = getRowRange()[elementIndex]; char sense = getRowSense()[elementIndex]; double lower = 0, upper = 0; convertSenseToBound(sense, rhs, range, lower, upper); if( lower != elementValue ) { convertBoundToSense(elementValue, upper, sense, rhs, range); setRowType(elementIndex, sense, rhs, range); // freeCachedResults(); --- invoked in setRowType() } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setRowUpper( int elementIndex, double elementValue ) { double rhs = getRightHandSide()[elementIndex]; double range = getRowRange()[elementIndex]; char sense = getRowSense()[elementIndex]; double lower = 0, upper = 0; convertSenseToBound( sense, rhs, range, lower, upper ); if( upper != elementValue ) { convertBoundToSense(lower, elementValue, sense, rhs, range); setRowType(elementIndex, sense, rhs, range); // freeCachedResults(); --- invoked in setRowType() } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setRowBounds( int elementIndex, double lower, double upper ) { double rhs, range; char sense; convertBoundToSense( lower, upper, sense, rhs, range ); setRowType( elementIndex, sense, rhs, range ); // freeCachedRowRim(); --- invoked in setRowType() } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setRowType(int index, char sense, double rightHandSide, double range) { if ( isDataLoaded() ) { int mindex[1] = {index}; char qrtype[1] = {sense}; double rhs[1] = {rightHandSide}; double rng[1] = {range}; XPRS_CHECKED( XPRSchgrowtype, (prob_,1, mindex, qrtype) ); XPRS_CHECKED( XPRSchgrhs, (prob_,1, mindex, rhs) ); // range is properly defined only for range-type rows, so we call XPRSchgrhsrange only for ranged rows if (sense == 'R') XPRS_CHECKED( XPRSchgrhsrange, (prob_,1, mindex, rng) ); freeCachedResults(); } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { OsiSolverInterface::setRowSetBounds(indexFirst, indexLast, boundList); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { OsiSolverInterface::setRowSetTypes(indexFirst, indexLast, senseList, rhsList, rangeList); } //############################################################################# void OsiXprSolverInterface::setContinuous(int index) { if ( isDataLoaded() ) { int pstat; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_PRESOLVESTATE, &pstat) ); if ( (pstat & 6) == 0 ) { // not presolved char qctype = 'C'; XPRS_CHECKED( XPRSchgcoltype, (prob_,1, &index, &qctype) ); freeCachedResults(); } } } void OsiXprSolverInterface::setInteger(int index) { if ( isDataLoaded() ) { int pstat; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_PRESOLVESTATE, &pstat) ); if ( (pstat & 6) == 0 ) { // not presolved char qctype; if ( getColLower()[index] == 0.0 && getColUpper()[index] == 1.0 ) qctype = 'B'; else qctype = 'I'; XPRS_CHECKED( XPRSchgcoltype, (prob_,1, &index, &qctype) ); freeCachedResults(); } } } void OsiXprSolverInterface::setContinuous(const int* indices, int len) { if ( isDataLoaded() ) { int pstat; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_PRESOLVESTATE, &pstat) ); if ( (pstat & 6) == 0 ) { // not presolved char *qctype = new char[len]; CoinFillN(qctype, len, 'C'); XPRS_CHECKED( XPRSchgcoltype, (prob_,len, const_cast(indices), qctype) ); freeCachedResults(); delete[] qctype; } } } void OsiXprSolverInterface::setInteger(const int* indices, int len) { if ( isDataLoaded() ) { int pstat; XPRS_CHECKED( XPRSgetintattrib, (prob_,XPRS_PRESOLVESTATE, &pstat) ); if ( (pstat & 6) == 0 ) { // not presolved char *qctype = new char[len]; const double* clb = getColLower(); const double* cub = getColUpper(); for ( int i = 0; i < len; i++ ) { if ( clb[indices[i]] == 0.0 && cub[indices[i]] == 1.0 ) qctype[i] = 'B'; else qctype[i] = 'I'; } XPRS_CHECKED( XPRSchgcoltype, (prob_,len, const_cast(indices), qctype) ); freeCachedResults(); delete[] qctype; } } } //############################################################################# void OsiXprSolverInterface::setObjSense(double s) { assert(s == 1.0 || s == -1.0); objsense_ = s; XPRS_CHECKED( XPRSchgobjsense, (prob_, (int)s) ); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setColSolution(const double *colsol) { freeSolution(); colsol_ = new double[getNumCols()]; for ( int i = 0; i < getNumCols(); i++ ) colsol_[i] = colsol[i]; } //----------------------------------------------------------------------------- void OsiXprSolverInterface::setRowPrice(const double *rowprice) { freeSolution(); rowprice_ = new double[getNumRows()]; for ( int i = 0; i < getNumRows(); i++ ) rowprice_[i] = rowprice[i]; } //############################################################################# // Problem modifying methods (matrix) //############################################################################# void OsiXprSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { if ( isDataLoaded() ) { freeCachedResults(); int mstart = 0; XPRS_CHECKED( XPRSaddcols, (prob_,1, vec.getNumElements(), const_cast(&obj), &mstart, const_cast(vec.getIndices()), const_cast(vec.getElements()), const_cast(&collb), const_cast(&colub)) ); } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj) { // freeCachedResults(); for( int i = 0; i < numcols; i++ ) addCol( *(cols[i]), collb[i], colub[i], obj[i] ); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::deleteCols(const int num, const int *columnIndices) { freeCachedResults(); XPRS_CHECKED( XPRSdelcols, (prob_,num, const_cast(columnIndices)) ); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { // freeCachedResults(); -- will be invoked char sense; double rhs, range; convertBoundToSense(rowlb, rowub, sense, rhs, range); addRow(vec, sense, rhs, range); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { freeCachedResults(); int mstart[2] = {0, vec.getNumElements()}; XPRS_CHECKED( XPRSaddrows, (prob_,1, vec.getNumElements(), const_cast(&rowsen), const_cast(&rowrhs), const_cast(&rowrng), mstart, const_cast(vec.getIndices()), const_cast(vec.getElements())) ); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub) { // *FIXME* : must write the method -LL throw CoinError("method is not yet written", "addRows", "OsiXprSolverInterface"); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng) { // *FIXME* : must write the method -LL throw CoinError("method is not yet written", "addRows", "OsiXprSolverInterface"); } //----------------------------------------------------------------------------- void OsiXprSolverInterface::deleteRows(const int num, const int * rowIndices) { freeCachedResults(); XPRS_CHECKED( XPRSdelrows, (prob_,num, const_cast(rowIndices)) ); } //############################################################################# // Methods to input a problem //############################################################################# void OsiXprSolverInterface::loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { const double inf = getInfinity(); char * rowSense = new char [matrix.getNumRows()]; double * rowRhs = new double[matrix.getNumRows()]; double * rowRange = new double[matrix.getNumRows()]; int i; for ( i = matrix.getNumRows() - 1; i >= 0; --i) { double rlb; if ( rowlb!=NULL ) rlb = rowlb[i]; else rlb = -inf; double rub; if ( rowub!=NULL ) rub = rowub[i]; else rub = inf; convertBoundToSense(rlb,rub,rowSense[i],rowRhs[i],rowRange[i]); #if 0 if ( rlb==rub ) { rowSense[i]='E'; rowRhs[i] =rlb; rowRange[i]=0.0; continue; } if ( rlb<=-inf && rub>=inf ) { rowSense[i]='N'; rowRhs[i] =inf; rowRange[i]=0.0; continue; } if ( rlb<=-inf && !(rub>=inf) ) { rowSense[i]='L'; rowRhs[i] =rub; rowRange[i]=0.0; continue; } if ( !(rlb<=-inf) && rub>=inf ) { rowSense[i]='G'; rowRhs[i] =rlb; rowRange[i]=0.0; continue; } if ( !(rlb<=-inf) && !(rub>=inf) ) { rowSense[i]='R'; rowRhs[i] =rub; rowRange[i]=rub-rlb; continue; } #endif } loadProblem(matrix, collb, colub, obj, rowSense, rowRhs, rowRange ); delete [] rowSense; delete [] rowRhs; delete [] rowRange; } //----------------------------------------------------------------------------- void OsiXprSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub) { loadProblem(*matrix, collb, colub, obj, rowlb, rowub); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowlb; rowlb = 0; delete[] rowub; rowub = 0; } //----------------------------------------------------------------------------- // #define OSIXPR_ADD_OBJ_ROW void OsiXprSolverInterface::loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) { freeCachedResults(); int i; char* rsen; double* rrhs; // Set column values to defaults if NULL pointer passed int nc=matrix.getNumCols(); int nr=matrix.getNumRows(); double * clb; double * cub; double * ob; if ( collb!=NULL ) { clb=const_cast(collb); } else { clb = new double[nc]; for( i=0; i(colub); else { cub = new double[nc]; for( i=0; i(obj); else { ob = new double[nc]; for( i=0; i(rowsen); else { rsen = new char[nr]; for( i = 0; i < nr; ++i ) rsen[i] = 'G'; } if ( rowrhs != NULL ) rrhs = const_cast(rowrhs); else { rrhs = new double[nr]; for( i = 0; i < nr; ++i ) rrhs[i] = 0.0; } bool freeMatrixRequired = false; CoinPackedMatrix * m = NULL; if ( !matrix.isColOrdered() ) { m = new CoinPackedMatrix(true,0,0); // (mjs) No gaps! m->reverseOrderedCopyOf(matrix); freeMatrixRequired = true; } else { m = const_cast(&matrix); } // Generate a problem name char probName[256]; sprintf(probName, "Prob%i", osiSerial_); nc = m->getNumCols(); nr = m->getNumRows(); if ( getLogFilePtr()!=NULL ) { fprintf(getLogFilePtr(),"{\n"); fprintf(getLogFilePtr()," char rowsen[%d];\n",nr); for ( i=0; igetVectorStarts()[i]); fprintf(getLogFilePtr()," int vectorLengths[%d];\n",nc); for ( i=0; igetVectorLengths()[i]); fprintf(getLogFilePtr()," int indices[%d];\n",m->getVectorStarts()[nc]); for ( i=0; igetVectorStarts()[nc]; i++ ) fprintf(getLogFilePtr()," indices[%d]=%d;\n",i,m->getIndices()[i]); fprintf(getLogFilePtr()," double elements[%d];\n",m->getVectorStarts()[nc]); for ( i=0; igetVectorStarts()[nc]; i++ ) fprintf(getLogFilePtr()," elements[%d]=%f;\n",i,m->getElements()[i]); fprintf(getLogFilePtr(),"}\n"); } int iret = XPRSloadlp( prob_, probName, nc, nr, const_cast(rsen), const_cast(rrhs), const_cast(rowrng), ob, const_cast(m->getVectorStarts()), const_cast(m->getVectorLengths()), const_cast(m->getIndices()), const_cast(m->getElements()), clb, cub ); setStrParam(OsiProbName,probName); if ( iret != 0 ) XPRSgetintattrib(prob_,XPRS_ERRORCODE, &iret); assert( iret == 0 ); char pname[256]; // Problem names can be 200 chars in XPRESS 12 XPRS_CHECKED( XPRSgetprobname,(prob_,pname) ); xprProbname_ = pname; if ( collb==NULL ) delete[] clb; if ( colub==NULL ) delete[] cub; if ( obj ==NULL ) delete[] ob; if ( rowsen==NULL ) delete[] rsen; if ( rowrhs==NULL ) delete[] rrhs; if (freeMatrixRequired) { delete m; } } //----------------------------------------------------------------------------- void OsiXprSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng) { loadProblem(*matrix, collb, colub, obj, rowsen, rowrhs, rowrng); delete matrix; matrix = 0; delete[] collb; collb = 0; delete[] colub; colub = 0; delete[] obj; obj = 0; delete[] rowsen; rowsen = 0; delete[] rowrhs; rowrhs = 0; delete[] rowrng; rowrng = 0; } //----------------------------------------------------------------------------- void OsiXprSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub ) { const double inf = getInfinity(); char * rowSense = new char [numrows]; double * rowRhs = new double[numrows]; double * rowRange = new double[numrows]; for ( int i = numrows - 1; i >= 0; --i ) { const double lower = rowlb ? rowlb[i] : -inf; const double upper = rowub ? rowub[i] : inf; convertBoundToSense( lower, upper, rowSense[i], rowRhs[i], rowRange[i] ); } loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowSense, rowRhs, rowRange); delete [] rowSense; delete [] rowRhs; delete [] rowRange; } //----------------------------------------------------------------------------- void OsiXprSolverInterface::loadProblem(const int numcols, const int numrows, const int* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng ) { freeCachedResults(); int i; // Set column values to defaults if NULL pointer passed int nc = numcols; int nr = numrows; int * len = new int[nc+1]; double * clb; double * cub; double * ob; char* rsen; double* rrhs; std::adjacent_difference(start, start + (nc+1), len); if ( collb!=NULL ) { clb=const_cast(collb); } else { clb = new double[nc]; for( i=0; i(colub); else { cub = new double[nc]; for( i=0; i(obj); else { ob = new double[nc]; for( i=0; i(rowsen); else { rsen = new char[nr]; for( i = 0; i < nr; ++i ) rsen[i] = 'G'; } if ( rowrhs != NULL ) rrhs = const_cast(rowrhs); else { rrhs = new double[nr]; for( i = 0; i < nr; ++i ) rrhs[i] = 0.0; } // Generate a problem name char probName[256]; sprintf(probName, "Prob%i", osiSerial_); if ( getLogFilePtr()!=NULL ) { fprintf(getLogFilePtr(),"{\n"); fprintf(getLogFilePtr()," char rowsen[%d];\n",nr); for ( i=0; i(rsen), const_cast(rrhs), const_cast(rowrng), ob, const_cast(start), const_cast(len+1), const_cast(index), const_cast(value), clb, cub ); setStrParam(OsiProbName,probName); if ( iret != 0 ) XPRSgetintattrib(prob_,XPRS_ERRORCODE, &iret); assert( iret == 0 ); char pname[256]; // Problem names can be 200 chars in XPRESS 12 XPRS_CHECKED( XPRSgetprobname, (prob_,pname) ); xprProbname_ = pname; if ( collb == NULL ) delete[] clb; if ( colub == NULL ) delete[] cub; if ( obj == NULL ) delete[] ob; if ( rowsen== NULL ) delete[] rsen; if ( rowrhs== NULL ) delete[] rrhs; delete[] len; } //----------------------------------------------------------------------------- // Read mps files //----------------------------------------------------------------------------- int OsiXprSolverInterface::readMps(const char *filename, const char *extension) { #if 0 if (getLogFilePtr()!=NULL) { fprintf(getLogFilePtr(),"{\n"); fprintf(getLogFilePtr()," XPRSreadprob(prob_,\"%s\");\n",filename); fprintf(getLogFilePtr()," int namlen;\n"); fprintf(getLogFilePtr()," XPRSgetintcontrol(prob_,XPRS_NAMELENGTH,&namlen);\n"); fprintf(getLogFilePtr()," namlen *= 8;\n"); } // Read Mps file. // XPRESS generates its own file extensions, so we ignore any supplied. int iret = XPRSreadprob(prob_,filename); if ( iret != 0 ) XPRSgetintattrib(prob_,XPRS_ERRORCODE, &iret); assert( iret == 0 ); // Get length of Mps names int namlen; XPRSgetintattrib(prob_,XPRS_NAMELENGTH, &namlen); namlen *= 8; if (getLogFilePtr()!=NULL) { fprintf(getLogFilePtr()," char objRowName[%d],rowName[%d];\n",namlen,namlen); fprintf(getLogFilePtr()," XPRSgetstrcontrol(prob_,XPRS_MPSOBJNAME, objRowName);\n"); fprintf(getLogFilePtr()," int nr;\n"); fprintf(getLogFilePtr()," XPRSsetintcontrol(prob_,XPRS_ROWS, &nr);"); } // Allocate space to hold row names. char * objRowName = new char[namlen+1]; char * rowName = new char[namlen+1]; // Get name of objective row. // If "" returned, then first N row is objective row XPRSgetstrcontrol(prob_,XPRS_MPSOBJNAME,objRowName); // Get number of rows int nr; XPRSgetintattrib(prob_,XPRS_ROWS, &nr); if (getLogFilePtr()!=NULL) { fprintf(getLogFilePtr()," char rs[%d];\n",nr); fprintf(getLogFilePtr()," XPRSgetrowtype(prob_,rs, 0, %d);\n",nr-1); } // Get row sense. char * rs = new char[nr]; XPRSgetrowtype(prob_,rs, 0, nr - 1); // Loop once for each row looking for objective row int i; for ( i=0; i 0 && newnz > 0 ) { XPRS_CHECKED( XPRSsetintcontrol,(prob_,XPRS_EXTRAROWS, newrows) ); XPRS_CHECKED( XPRSsetintcontrol, (prob_,XPRS_EXTRAELEMS, newnz) ); } } //---------------------------------------------------------------- // Clone //---------------------------------------------------------------- OsiSolverInterface * OsiXprSolverInterface::clone(bool copyData) const { return (new OsiXprSolverInterface(*this)); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiXprSolverInterface:: OsiXprSolverInterface (const OsiXprSolverInterface & source) : OsiSolverInterface(source), prob_(NULL), matrixByRow_(NULL), matrixByCol_(NULL), colupper_(NULL), collower_(NULL), rowupper_(NULL), rowlower_(NULL), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), objcoeffs_(NULL), objsense_(source.objsense_), colsol_(NULL), rowsol_(NULL), rowact_(NULL), rowprice_(NULL), colprice_(NULL), ivarind_(NULL), ivartype_(NULL), vartype_(NULL), domipstart(false) { incrementInstanceCounter(); xprProbname_ = ""; gutsOfConstructor(); gutsOfCopy(source); // Other values remain NULL until requested } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiXprSolverInterface::~OsiXprSolverInterface () { gutsOfDestructor(); XPRSdestroyprob(prob_); decrementInstanceCounter(); } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiXprSolverInterface & OsiXprSolverInterface::operator=(const OsiXprSolverInterface& rhs) { if ( this != &rhs ) { OsiSolverInterface::operator=(rhs); osiSerial_++; // even though numInstances_ doesn't change gutsOfDestructor(); gutsOfCopy(rhs); } return *this; } //############################################################################# // Applying cuts //############################################################################# void OsiXprSolverInterface::applyColCut( const OsiColCut & cc ) { const double *collower = getColLower(); const double *colupper = getColUpper(); const CoinPackedVector & lbs = cc.lbs(); const CoinPackedVector & ubs = cc.ubs(); int *index = new int [lbs.getNumElements() + ubs.getNumElements()]; char *btype = new char [lbs.getNumElements() + ubs.getNumElements()]; double *value = new double[lbs.getNumElements() + ubs.getNumElements()]; int i, nbds; for ( i = nbds = 0; i < lbs.getNumElements(); i++, nbds++ ) { index[nbds] = lbs.getIndices()[i]; btype[nbds] = 'L'; value[nbds] = (collower[index[nbds]] > lbs.getElements()[i]) ? collower[index[nbds]] : lbs.getElements()[i]; } for ( i = 0; i < ubs.getNumElements(); i++, nbds++ ) { index[nbds] = ubs.getIndices()[i]; btype[nbds] = 'U'; value[nbds] = (colupper[index[nbds]] < ubs.getElements()[i]) ? colupper[index[nbds]] : ubs.getElements()[i]; } if (getLogFilePtr()!=NULL) { fprintf(getLogFilePtr(),"{\n"); fprintf(getLogFilePtr()," int index[%d];\n",nbds); fprintf(getLogFilePtr()," char btype[%d];\n",nbds); fprintf(getLogFilePtr()," double value[%d];\n",nbds); for ( i=0; i(row.getIndices()), const_cast(row.getElements())); assert( rc == 0 ); freeCachedResults(); } //############################################################################# // Private methods //############################################################################# void OsiXprSolverInterface::gutsOfCopy( const OsiXprSolverInterface & source ) { if ( source.xprProbname_ != "" ) { // source has data std::ostringstream pname; pname << xprProbname_ << "#" << osiSerial_ <<'\0'; xprProbname_ = pname.str(); // sprintf(xprProbname_, "%s#%d", source.xprProbname_, osiSerial_); // std::cout << "Problem " << xprProbname_ << " copied to matrix "; XPRS_CHECKED( XPRScopyprob, ( prob_, source.prob_, xprProbname_.c_str() ) ); XPRS_CHECKED( XPRScopycontrols, ( prob_, source.prob_ ) ); /* if the callbacks are used, a XPRScopycallbacks needs to be added */ } } //------------------------------------------------------------------- void OsiXprSolverInterface::gutsOfConstructor() { XPRS_CHECKED( XPRScreateprob, (&prob_) ); XPRS_CHECKED( XPRSsetcbmessage, (prob_, OsiXprMessageCallback, messageHandler()) ); /* always create an empty problem to initialize all data structures * since the user had no chance to pass in his own message handler, we turn off the output for the following operation */ int outputlog; XPRS_CHECKED( XPRSgetintcontrol, (prob_, XPRS_OUTPUTLOG, &outputlog) ); XPRS_CHECKED( XPRSsetintcontrol, (prob_, XPRS_OUTPUTLOG, 0) ); int istart = 0; XPRS_CHECKED( XPRSloadlp, ( prob_, "empty", 0, 0, NULL, NULL, NULL, NULL, &istart, NULL, NULL, NULL, NULL, NULL) ); XPRS_CHECKED( XPRSchgobjsense, (prob_, (int)objsense_) ); XPRS_CHECKED( XPRSsetintcontrol, (prob_, XPRS_OUTPUTLOG, outputlog) ); //OPEN: only switched off for debugging //XPRS_CHECKED( XPRSsetlogfile, (prob_,"xpress.log") ); // **FIXME** (mjs) Integer problems require solution file or callback to save // optimal solution. The quick fix is to leave the default solutionfile setting, // but implementing a callback would be better. // XPRS_CHECKED( XPRSsetintcontrol, (prob_, XPRS_SOLUTIONFILE,0) ); // XPRS_CHECKED( XPRSsetintcontrol, ( prob_, XPRS_PRESOLVE, 0) ); lastsolvewasmip = false; } //------------------------------------------------------------------- void OsiXprSolverInterface::gutsOfDestructor() { freeCachedResults(); assert(matrixByRow_ == NULL); assert(matrixByCol_ == NULL); assert(colupper_ == NULL); assert(collower_ == NULL); assert(rowupper_ == NULL); assert(rowlower_ == NULL); assert(rowsense_ == NULL); assert(rhs_ == NULL); assert(rowrange_ == NULL); assert(objcoeffs_ == NULL); assert(colsol_ == NULL); assert(rowsol_ == NULL); assert(rowprice_ == NULL); assert(colprice_ == NULL); assert(rowact_ == NULL); assert(vartype_ == NULL); } //------------------------------------------------------------------- void OsiXprSolverInterface::freeSolution() { delete [] colsol_; colsol_ = NULL; delete [] rowsol_; rowsol_ = NULL; delete [] rowact_; rowact_ = NULL; delete [] rowprice_; rowprice_ = NULL; delete [] colprice_; colprice_ = NULL; } //------------------------------------------------------------------- void OsiXprSolverInterface::freeCachedResults() { delete matrixByRow_; matrixByRow_ = NULL; delete matrixByCol_; matrixByCol_ = NULL; delete [] colupper_; colupper_ = NULL; delete [] collower_; collower_ = NULL; delete [] rowupper_; rowupper_ = NULL; delete [] rowlower_; rowlower_ = NULL; delete [] rowsense_; rowsense_ = NULL; delete [] rhs_; rhs_ = NULL; delete [] rowrange_; rowrange_ = NULL; delete [] objcoeffs_; objcoeffs_ = NULL; freeSolution(); delete [] ivarind_; ivarind_ = NULL; delete [] ivartype_; ivartype_ = NULL; delete [] vartype_; vartype_ = NULL; } //------------------------------------------------------------------- // Set up lists of integer variables //------------------------------------------------------------------- int OsiXprSolverInterface::getNumIntVars() const { int nintvars = 0, nsets = 0; if ( isDataLoaded() ) { XPRS_CHECKED( XPRSgetglobal, (prob_,&nintvars, &nsets, NULL, NULL, NULL, NULL, NULL, NULL, NULL) ); } return nintvars; } void OsiXprSolverInterface::getVarTypes() const { int nintvars = getNumIntVars(); int nsets; int ncols = getNumCols(); if ( vartype_ == NULL && nintvars > 0 ) { if (getLogFilePtr()!=NULL) { fprintf(getLogFilePtr(),"{\n"); fprintf(getLogFilePtr()," int nintvars = %d;\n",nintvars); fprintf(getLogFilePtr()," int nsets;\n"); fprintf(getLogFilePtr()," char ivartype[%d];\n",nintvars); fprintf(getLogFilePtr()," char ivarind[%d];\n",nintvars); fprintf(getLogFilePtr(),"}\n"); } ivartype_ = new char[nintvars]; ivarind_ = new int[nintvars]; XPRS_CHECKED( XPRSgetglobal, (prob_,&nintvars, &nsets, ivartype_, ivarind_, NULL, NULL, NULL, NULL, NULL) ); // Currently, only binary and integer vars are supported. vartype_ = new char[ncols]; int i, j; for ( i = j = 0; j < ncols; j++ ) { if ( i < nintvars && j == ivarind_[i] ) { vartype_[j] = ivartype_[i]; i++; } else vartype_[j] = 'C'; } } } bool OsiXprSolverInterface::isDataLoaded() const { int istatus; XPRS_CHECKED( XPRSgetintattrib, ( prob_, XPRS_MIPSTATUS, &istatus ) ); istatus &= XPRS_MIP_NOT_LOADED; return istatus == 0; } //############################################################################# CoinMP-1.8.3/Osi/src/OsiXpr/osi-xpress.pc.in0000644000175000017500000000046711510106235017127 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiXpress Description: COIN-OR Open Solver Interface for Xpress URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiXpr @XPRLIB@ Cflags: -I${includedir} -I@XPRINCDIR@ Requires: osi CoinMP-1.8.3/Osi/AUTHORS0000644000175000017500000000027710625200560013120 0ustar renereneFasano, J.P. Forrest, John J. Hafer, Lou Ladanyi, Laszlo Lannez, Sebastien (OsiCuts insert method) Margot, Francois Saltzman, Matt Ralphs, Ted Walton, Philip (trait specification of OsiCuts) CoinMP-1.8.3/Cgl/0000755000175000017500000000000012600453456012026 5ustar renereneCoinMP-1.8.3/Cgl/Makefile.in0000644000175000017500000010547612506321416014103 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball @ALWAYS_FALSE@am__append_1 = test DIST_COMMON = README $(am__configure_deps) \ $(srcdir)/BuildTools/Makemain.inc $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/cgl-uninstalled.pc.in \ $(srcdir)/cgl.pc.in $(top_srcdir)/configure \ $(top_srcdir)/doxydoc/doxygen.conf.in \ $(top_srcdir)/examples/Makefile.in AUTHORS config.guess \ config.sub depcomp install-sh ltmain.sh missing @HAVE_EXTERNALS_TRUE@am__append_2 = Dependencies @HAVE_EXTERNALS_TRUE@am__append_3 = .Dependencies-stamp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = examples/Makefile cgl.pc cgl-uninstalled.pc \ doxydoc/doxygen.conf SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(pkgconfiglibdir)" pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) DATA = $(pkgconfiglib_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = src test DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src $(am__append_1) ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = examples/cgl1.cpp examples/cgl_data_test.cpp \ examples/Makefile.in $(am__append_2) ######################################################################## # Installation of the addlibs file # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = cgl.pc addlibsdir = $(DESTDIR)$(datadir)/coin/doc/Cgl ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = $(am__append_3) $(VPATH_DISTCLEANFILES) DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) COIN_HAS_DOXYGEN = @COIN_HAS_DOXYGEN_TRUE@TRUE COIN_HAS_LATEX = @COIN_HAS_LATEX_TRUE@TRUE all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/BuildTools/Makemain.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) examples/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ cgl.pc: $(top_builddir)/config.status $(srcdir)/cgl.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ cgl-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/cgl-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ doxydoc/doxygen.conf: $(top_builddir)/config.status $(top_srcdir)/doxydoc/doxygen.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ 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; } \ END { 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: ctags-recursive $(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; } \ END { 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) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/BuildTools $(distdir)/doxydoc $(distdir)/examples @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfiglibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-exec-am: install-exec-local install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-local \ uninstall-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-local \ clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-libtool distclean-local \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-exec install-exec-am \ install-exec-local install-info install-info-am install-man \ install-pkgconfiglibDATA install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-libtool \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-hook uninstall-info-am \ uninstall-local uninstall-pkgconfiglibDATA ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc install-data-hook: @$(mkdir_p) "$(addlibsdir)" @COIN_HAS_PKGCONFIG_TRUE@ PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ @COIN_HAS_PKGCONFIG_TRUE@ $(PKG_CONFIG) --libs cgl > $(addlibsdir)/cgl_addlibs.txt @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCgl.lib @CGLLIB_LIBS_INSTALLED@" > $(addlibsdir)/cgl_addlibs.txt @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lCgl @CGLLIB_LIBS_INSTALLED@ > $(addlibsdir)/cgl_addlibs.txt uninstall-hook: rm -f $(addlibsdir)/cgl_addlibs.txt doxygen-docs: if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ doxygen doxydoc/doxygen.conf;\ fi;\ fi pdf-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/latex"; then \ if test "$(COIN_HAS_LATEX)" = TRUE; then \ cd doxydoc/latex;\ $(MAKE) pdf;\ cd -;\ fi;\ fi;\ fi clean-doxygen-docs: if test -d "doxydoc/"; then \ cd doxydoc ;\ rm -rf html latex *.log *.tag;\ fi install-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc"; \ $(INSTALL_DATA) @coin_doxy_tagname@ "$(DESTDIR)$(DocInstallDir)/@coin_doxy_tagname@";\ if test -f "doxydoc/latex/refman.pdf"; then \ $(INSTALL_DATA) doxydoc/latex/refman.pdf "$(DESTDIR)$(DocInstallDir)";\ fi;\ if test -d "doxydoc/html"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/search/" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc/search/"; \ $(INSTALL_DATA) doxydoc/html/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc";\ $(INSTALL_DATA) doxydoc/html/search/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc/search";\ fi;\ fi;\ fi uninstall-doxygen-docs: if test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/"; then \ rm -rf "$(DESTDIR)$(DocInstallDir)/doxydoc/"; \ fi if test -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; then \ rm -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; \ fi all-doxygen-docs: for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) doxygen-docs) \ fi ; \ done ; clean-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) clean-doxygen-docs) \ fi ; \ done ; install-all-doxygen-docs: all-doxygen-docs for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) install-doxygen-docs) \ fi ; \ done ; uninstall-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) uninstall-doxygen-docs) \ fi ; \ done ; install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## # Make sure acinclude is using most recent coin.m4 @MAINTAINER_MODE_TRUE@$(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 @MAINTAINER_MODE_TRUE@ cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date @MAINTAINER_MODE_TRUE@$(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh @MAINTAINER_MODE_TRUE@ cp $< $@ # Take care of updating externals (if Dependencies file exists) @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@$(top_builddir)/Makefile: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@.Dependencies-stamp: $(srcdir)/Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); BuildTools/set_externals Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ touch .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@update-externals: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); svn update .PHONY: install-doc uninstall-doc update-externals # 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: CoinMP-1.8.3/Cgl/examples/0000755000175000017500000000000012600453455013643 5ustar renereneCoinMP-1.8.3/Cgl/examples/Makefile.in0000644000175000017500000000662012130021123015671 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # $Id: Makefile.in 726 2006-04-17 04:16:00Z andreasw $ ########################################################################## # You can modify this example makefile to fit for your own program. # # Usually, you only need to change the five CHANGEME entries below. # ########################################################################## # To compile other examples, either changed the following line, or # add the argument DRIVER=filename_without_extension to make DRIVER = cgl1 # CHANGEME: This should be the name of your executable EXE = $(DRIVER)@EXEEXT@ # CHANGEME: Here is the name of all object files corresponding to the source # code that you wrote in order to define the problem statement OBJS = $(DRIVER).@OBJEXT@ # CHANGEME: Additional libraries ADDLIBS = # CHANGEME: Additional flags for compilation (e.g., include flags) ADDINCFLAGS = # CHANGEME: Directory to the sources for the (example) problem definition # files SRCDIR = @srcdir@ VPATH = @srcdir@ ########################################################################## # Usually, you don't have to change anything below. Note that if you # # change certain compiler options, you might have to recompile the # # package. # ########################################################################## COIN_HAS_PKGCONFIG = @COIN_HAS_PKGCONFIG_TRUE@TRUE COIN_CXX_IS_CL = @COIN_CXX_IS_CL_TRUE@TRUE COIN_HAS_SAMPLE = @COIN_HAS_SAMPLE_TRUE@TRUE # C++ Compiler command CXX = @CXX@ # C++ Compiler options CXXFLAGS = @CXXFLAGS@ # additional C++ Compiler options for linking CXXLINKFLAGS = @RPATH_FLAGS@ # Sample data directory ifeq ($(COIN_HAS_SAMPLE), TRUE) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) CXXFLAGS += -DSAMPLEDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatasample`\" else CXXFLAGS += -DSAMPLEDIR=\"@SAMPLE_DATA_INSTALLED@\" endif endif # Include directories (we use the CYGPATH_W variables to allow compilation with Windows compilers) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags cgl` else INCL = @CGLLIB_CFLAGS_INSTALLED@ endif INCL += $(ADDINCFLAGS) # Linker flags ifeq ($(COIN_HAS_PKGCONFIG), TRUE) LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs cgl` else ifeq ($(COIN_CXX_IS_CL), TRUE) LIBS = -link -libpath:`$(CYGPATH_W) @abs_lib_dir@` libCgl.lib @CGLLIB_LIBS_INSTALLED@ else LIBS = -L@abs_lib_dir@ -lCgl @CGLLIB_LIBS_INSTALLED@ endif endif # The following is necessary under cygwin, if native compilers are used CYGPATH_W = @CYGPATH_W@ all: $(EXE) .SUFFIXES: .cpp .c .o .obj $(EXE): $(OBJS) bla=;\ for file in $(OBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \ $(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $@ $$bla $(ADDLIBS) $(LIBS) clean: rm -rf $(EXE) $(OBJS) .cpp.o: $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$< .cpp.obj: $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi` .c.o: $(CC) $(CFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$< .c.obj: $(CC) $(CFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi` CoinMP-1.8.3/Cgl/examples/cgl_data_test.cpp0000644000175000017500000001102412122356574017145 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include "OsiSolverInterface.hpp" #include "OsiSolverParameters.hpp" #include "OsiClpSolverInterface.hpp" #include "CglRedSplit.hpp" #include "CglRedSplit2.hpp" int main(int argc, char **argv) { char *f_name_lp, *last_dot_pos, f_name[256], *f_name_pos; int i, ncol; if((argc < 2) || (argc > 2)) { printf("### ERROR: main(): Usage: One of the following\ncgl_data_test input_file_name.mps\ncgl_data_test input_file_name.lp\n"); exit(1); } f_name_lp = strdup(argv[1]); f_name_pos = strrchr(f_name_lp, '/'); if(f_name_pos != NULL) { strcpy(f_name, &(f_name_pos[1])); } else { strcpy(f_name, f_name_lp); } last_dot_pos = strrchr(f_name, '.'); if(last_dot_pos != NULL) { last_dot_pos = '\0'; } // Do for both RedSplit and RedSplit2 { OsiClpSolverInterface *clp = new OsiClpSolverInterface; clp->messageHandler()->setLogLevel(0); if(strcmp(&(f_name_lp[strlen(f_name_lp)-3]), ".lp") == 0) { clp->readLp(f_name_lp); } else { if(strcmp(&(f_name_lp[strlen(f_name_lp)-4]), ".mps") == 0) { clp->readMps(f_name_lp); } else { printf("### ERROR: unrecognized file type\n"); exit(1); } } ncol = clp->getNumCols(); clp->initialSolve(); printf("LP value: %12.2f\n", clp->getObjValue()); OsiCuts cuts; // Define parameters for CglRedSplit generator CglParam cpar; cpar.setMAX_SUPPORT(ncol+1); CglRedSplitParam rspar(cpar); // Create a cut generator with the given parameters CglRedSplit cutGen(rspar); char *colType = new char[ncol]; for(i=0; iisContinuous(i)) { colType[i] = 'C'; } else { colType[i] = 'I'; } } int round, max_rounds = 10; for(round=0; roundapplyRowCuts(ncuts, newRowCuts); delete[] newRowCuts; printf("round %4d: %4d generated cuts new objective value: %12.2f\n", round, ncuts, clp->getObjValue()); clp->resolve(); if(clp->isAbandoned()) { printf("###ERROR: Numerical difficulties in Solver\n"); exit(1); } if(clp->isProvenPrimalInfeasible()) { printf("### WARNING: Problem is infeasible\n"); exit(1); } } delete clp; delete[] colType; } { OsiClpSolverInterface *clp = new OsiClpSolverInterface; clp->messageHandler()->setLogLevel(0); if(strcmp(&(f_name_lp[strlen(f_name_lp)-3]), ".lp") == 0) { clp->readLp(f_name_lp); } else { if(strcmp(&(f_name_lp[strlen(f_name_lp)-4]), ".mps") == 0) { clp->readMps(f_name_lp); } else { printf("### ERROR: unrecognized file type\n"); exit(1); } } ncol = clp->getNumCols(); clp->initialSolve(); printf("LP value: %12.2f\n", clp->getObjValue()); OsiCuts cuts; // Define parameters for CglRedSplit2 generator CglParam cpar; cpar.setMAX_SUPPORT(ncol+1); CglRedSplit2Param rspar(cpar); // Create a cut generator with the given parameters CglRedSplit2 cutGen(rspar); char *colType = new char[ncol]; for(i=0; iisContinuous(i)) { colType[i] = 'C'; } else { colType[i] = 'I'; } } int round, max_rounds = 10; for(round=0; roundapplyRowCuts(ncuts, newRowCuts); delete[] newRowCuts; printf("round %4d: %4d generated cuts new objective value: %12.2f\n", round, ncuts, clp->getObjValue()); clp->resolve(); if(clp->isAbandoned()) { printf("###ERROR: Numerical difficulties in Solver\n"); exit(1); } if(clp->isProvenPrimalInfeasible()) { printf("### WARNING: Problem is infeasible\n"); exit(1); } } delete clp; delete[] colType; } free(f_name_lp); return(0); } CoinMP-1.8.3/Cgl/examples/cgl1.cpp0000644000175000017500000001616011510726535015202 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //----------------------------------------------------- // Simple example usage of the cut generation library. // // This sample program iteratively tightens a // given formulation by adding cuts, then calls // branch-and-bound to solve the tightened // formulation. // // usage: // cgl1 mpsFileName objectiveSense // where: // mpsFileName: Name of an mps file (without the // file extension) // objectiveSense: min for minimization, // max for maximization. // example: // cgl1 ../../Data/Sample/p0033 min //----------------------------------------------------- // The knapsack cut generator assumes the primal solution is feasible. #include #include #include #include "CoinError.hpp" #include "OsiCuts.hpp" #include "OsiClpSolverInterface.hpp" //#include "OsiOslSolverInterface.hpp" #include "CoinWarmStartBasis.hpp" #include #include "CglKnapsackCover.hpp" #include "CglSimpleRounding.hpp" using std::cerr; using std::cout; using std::endl; using std::string; int main(int argc, const char *argv[]) { // If no parms specified then use these string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc == 1) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif string objSense = "min"; // Make sure a file name and objective sense or nothing // were specified if ( argc!=1 && argc!=3 ) { cerr <<"Incorrect number of command line parameters." <(si.getWarmStart()) ; assert (basis); int nDelete=0; for (int i=numberRows;igetArtifStatus(i); if (status == CoinWarmStartBasis::basic) del[nDelete++] = i; } delete basis; if (nDelete) { si.deleteRows(nDelete,del); // should take zero iterations si.resolve(); cout << nDelete << " rows deleted as basic - resolve took " << si.getIterationCount() <<" iterations" < CoinMP-1.8.3/Cgl/MSVisualStudio/v9/Cgl.sln0000644000175000017500000001305511527572763016520 0ustar renerene Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCgl", "libCgl\libCgl.vcproj", "{DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CglUnitTest", "CglUnitTest\CglUnitTest.vcproj", "{2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}" ProjectSection(ProjectDependencies) = postProject {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} = {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} {02D45875-A8CF-41B9-990B-3699C0ECFE10} = {02D45875-A8CF-41B9-990B-3699C0ECFE10} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v9\libCoinUtils\libCoinUtils.vcproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "..\..\..\Osi\MSVisualStudio\v9\libOsi\libOsi.vcproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libClp", "..\..\..\Clp\MSVisualStudio\v9\libClp\libClp.vcproj", "{4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiClp", "..\..\..\Clp\MSVisualStudio\v9\libOsiClp\libOsiClp.vcproj", "{02D45875-A8CF-41B9-990B-3699C0ECFE10}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.ActiveCfg = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.Build.0 = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.ActiveCfg = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.Build.0 = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.ActiveCfg = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.Build.0 = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.ActiveCfg = Release|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.Build.0 = Release|x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Debug|Win32.ActiveCfg = Debug|Win32 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Debug|Win32.Build.0 = Debug|Win32 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Debug|x64.ActiveCfg = Debug|x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Debug|x64.Build.0 = Debug|x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Release|Win32.ActiveCfg = Release|Win32 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Release|Win32.Build.0 = Release|Win32 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Release|x64.ActiveCfg = Release|x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.Build.0 = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.ActiveCfg = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.Build.0 = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.Build.0 = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.ActiveCfg = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.Build.0 = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.Build.0 = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.ActiveCfg = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.Build.0 = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.Build.0 = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.ActiveCfg = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Cgl/MSVisualStudio/v9/CglUnitTest/0000755000175000017500000000000012600453456017464 5ustar renereneCoinMP-1.8.3/Cgl/MSVisualStudio/v9/CglUnitTest/CglUnitTest.vcproj0000644000175000017500000002553511475617142023133 0ustar renerene CoinMP-1.8.3/Cgl/MSVisualStudio/v10/0000755000175000017500000000000012600453456015327 5ustar renereneCoinMP-1.8.3/Cgl/MSVisualStudio/v10/libCgl/0000755000175000017500000000000012600453456016523 5ustar renereneCoinMP-1.8.3/Cgl/MSVisualStudio/v10/libCgl/libCgl.vcxproj0000644000175000017500000014605012130554343021335 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} libCgl StaticLibrary StaticLibrary StaticLibrary StaticLibrary <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\src\CglDuplicateRow;..\..\..\src\CglMixedIntegerRounding;..\..\..\src\CglMixedIntegerRounding2;..\..\..\src\CglFlowCover;..\..\..\src\CglClique;..\..\..\src\CglOddHole;..\..\..\src\CglKnapsackCover;..\..\..\src\CglGomory;..\..\..\src\CglPreProcess;..\..\..\src\CglRedSplit;..\..\..\src\CglResidualCapacity;..\..\..\src\CglProbing;..\..\..\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS true true true Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 true ..\..\..\src\CglDuplicateRow;..\..\..\src\CglMixedIntegerRounding;..\..\..\src\CglMixedIntegerRounding2;..\..\..\src\CglFlowCover;..\..\..\src\CglClique;..\..\..\src\CglOddHole;..\..\..\src\CglKnapsackCover;..\..\..\src\CglGomory;..\..\..\src\CglPreProcess;..\..\..\src\CglRedSplit;..\..\..\src\CglResidualCapacity;..\..\..\src\CglProbing;..\..\..\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS _DEBUG;%(PreprocessorDefinitions) 0x0409 true X64 Default ..\..\..\src\CglDuplicateRow;..\..\..\src\CglMixedIntegerRounding;..\..\..\src\CglMixedIntegerRounding2;..\..\..\src\CglFlowCover;..\..\..\src\CglClique;..\..\..\src\CglOddHole;..\..\..\src\CglKnapsackCover;..\..\..\src\CglGomory;..\..\..\src\CglPreProcess;..\..\..\src\CglRedSplit;..\..\..\src\CglResidualCapacity;..\..\..\src\CglProbing;..\..\..\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 true X64 ..\..\..\src\CglDuplicateRow;..\..\..\src\CglMixedIntegerRounding;..\..\..\src\CglMixedIntegerRounding2;..\..\..\src\CglFlowCover;..\..\..\src\CglClique;..\..\..\src\CglOddHole;..\..\..\src\CglKnapsackCover;..\..\..\src\CglGomory;..\..\..\src\CglPreProcess;..\..\..\src\CglRedSplit;..\..\..\src\CglResidualCapacity;..\..\..\src\CglProbing;..\..\..\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS true EnableFastChecks true Level3 true ProgramDatabase Default _DEBUG;%(PreprocessorDefinitions) 0x0409 true Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) CoinMP-1.8.3/Cgl/MSVisualStudio/v10/Cgl.sln0000644000175000017500000001212011540154466016547 0ustar renerene Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCgl", "libCgl\libCgl.vcxproj", "{DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CglUnitTest", "CglUnitTest\CglUnitTest.vcxproj", "{2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v10\libCoinUtils\libCoinUtils.vcxproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "..\..\..\Osi\MSVisualStudio\v10\libOsi\libOsi.vcxproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libClp", "..\..\..\Clp\MSVisualStudio\v10\libClp\libClp.vcxproj", "{4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiClp", "..\..\..\Clp\MSVisualStudio\v10\libOsiClp\libOsiClp.vcxproj", "{02D45875-A8CF-41B9-990B-3699C0ECFE10}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.ActiveCfg = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.Build.0 = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.ActiveCfg = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.Build.0 = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.ActiveCfg = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.Build.0 = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.ActiveCfg = Release|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.Build.0 = Release|x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Debug|Win32.ActiveCfg = Debug|Win32 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Debug|Win32.Build.0 = Debug|Win32 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Debug|x64.ActiveCfg = Debug|x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Debug|x64.Build.0 = Debug|x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Release|Win32.ActiveCfg = Release|Win32 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Release|Win32.Build.0 = Release|Win32 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Release|x64.ActiveCfg = Release|x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.Build.0 = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.ActiveCfg = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.Build.0 = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.Build.0 = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.ActiveCfg = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.Build.0 = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.Build.0 = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.ActiveCfg = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.Build.0 = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.Build.0 = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.ActiveCfg = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Cgl/MSVisualStudio/v10/CglUnitTest/0000755000175000017500000000000012600453456017534 5ustar renereneCoinMP-1.8.3/Cgl/MSVisualStudio/v10/CglUnitTest/CglUnitTest.vcxproj0000644000175000017500000004032712101652407023355 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {2775A6EA-AAC5-4A94-BCDF-CE353DCCA7BE} CglUnitTest Win32Proj Application Unicode true Application Unicode Application Unicode true Application Unicode <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset Disabled ..\..\..\src\CglClique;..\..\..\src\CglDuplicateRow;..\..\..\src\CglFlowCover;..\..\..\src\CglGomory;..\..\..\src\CglKnapsackCover;..\..\..\src\CglLandP;..\..\..\src\CglMixedIntegerRounding;..\..\..\src\CglMixedIntegerRounding2;..\..\..\src\CglOddHole;..\..\..\src\CglPreProcess;..\..\..\src\CglProbing;..\..\..\src\CglRedSplit;..\..\..\src\CglResidualCapacity;..\..\..\src\CglSimpleRounding;..\..\..\src\CglTwomir;..\..\..\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;COIN_HAS_OSICLP;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";TESTDIR="..\\..\\..\\test\\CglTestData";%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 EditAndContinue true Console MachineX86 $(OutDir) libCoinUtils.lib;libOsi.lib;libClp.lib;libOsiClp.lib;libCgl.lib;%(AdditionalDependencies) false MaxSpeed true ..\..\..\src\CglClique;..\..\..\src\CglDuplicateRow;..\..\..\src\CglFlowCover;..\..\..\src\CglGomory;..\..\..\src\CglKnapsackCover;..\..\..\src\CglLandP;..\..\..\src\CglMixedIntegerRounding;..\..\..\src\CglMixedIntegerRounding2;..\..\..\src\CglOddHole;..\..\..\src\CglPreProcess;..\..\..\src\CglProbing;..\..\..\src\CglRedSplit;..\..\..\src\CglResidualCapacity;..\..\..\src\CglSimpleRounding;..\..\..\src\CglTwomir;..\..\..\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;COIN_HAS_OSICLP;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";TESTDIR="..\\..\\..\\test\\CglTestData";%(PreprocessorDefinitions) MultiThreadedDLL true Level3 ProgramDatabase true Console true true MachineX86 $(OutDir) libCoinUtils.lib;libOsi.lib;libClp.lib;libOsiClp.lib;libCgl.lib;%(AdditionalDependencies) false X64 Disabled ..\..\..\src\CglClique;..\..\..\src\CglDuplicateRow;..\..\..\src\CglFlowCover;..\..\..\src\CglGomory;..\..\..\src\CglKnapsackCover;..\..\..\src\CglLandP;..\..\..\src\CglMixedIntegerRounding;..\..\..\src\CglMixedIntegerRounding2;..\..\..\src\CglOddHole;..\..\..\src\CglPreProcess;..\..\..\src\CglProbing;..\..\..\src\CglRedSplit;..\..\..\src\CglResidualCapacity;..\..\..\src\CglSimpleRounding;..\..\..\src\CglTwomir;..\..\..\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;COIN_HAS_OSICLP;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";TESTDIR="..\\..\\..\\test\\CglTestData";%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 ProgramDatabase true Console MachineX64 $(OutDir) libCoinUtils.lib;libOsi.lib;libClp.lib;libOsiClp.lib;libCgl.lib;%(AdditionalDependencies) false X64 MaxSpeed true ..\..\..\src\CglClique;..\..\..\src\CglDuplicateRow;..\..\..\src\CglFlowCover;..\..\..\src\CglGomory;..\..\..\src\CglKnapsackCover;..\..\..\src\CglLandP;..\..\..\src\CglMixedIntegerRounding;..\..\..\src\CglMixedIntegerRounding2;..\..\..\src\CglOddHole;..\..\..\src\CglPreProcess;..\..\..\src\CglProbing;..\..\..\src\CglRedSplit;..\..\..\src\CglResidualCapacity;..\..\..\src\CglSimpleRounding;..\..\..\src\CglTwomir;..\..\..\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;COIN_HAS_OSICLP;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";TESTDIR="..\\..\\..\\test\\CglTestData";%(PreprocessorDefinitions) MultiThreadedDLL true Level3 ProgramDatabase true Console true true MachineX64 $(OutDir) libCoinUtils.lib;libOsi.lib;libClp.lib;libOsiClp.lib;libCgl.lib;%(AdditionalDependencies) false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false {02d45875-a8cf-41b9-990b-3699c0ecfe10} false {c4867f15-438d-4ff8-8388-62fbaaa9786c} false true false false false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false {dbea3904-f0b8-408a-9e1a-6497febe8c42} false CoinMP-1.8.3/Cgl/Makefile.am0000644000175000017500000000562312465466745014106 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1256 2015-02-07 19:56:21Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball if ALWAYS_FALSE SUBDIRS += test endif ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = examples/cgl1.cpp \ examples/cgl_data_test.cpp \ examples/Makefile.in ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc ######################################################################## # Installation of the addlibs file # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = cgl.pc addlibsdir = $(DESTDIR)$(datadir)/coin/doc/Cgl install-data-hook: @$(mkdir_p) "$(addlibsdir)" if COIN_HAS_PKGCONFIG PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ $(PKG_CONFIG) --libs cgl > $(addlibsdir)/cgl_addlibs.txt else if COIN_CXX_IS_CL echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCgl.lib @CGLLIB_LIBS_INSTALLED@" > $(addlibsdir)/cgl_addlibs.txt else echo -L@abs_lib_dir@ -lCgl @CGLLIB_LIBS_INSTALLED@ > $(addlibsdir)/cgl_addlibs.txt endif endif uninstall-hook: rm -f $(addlibsdir)/cgl_addlibs.txt ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = include BuildTools/Makemain.inc CoinMP-1.8.3/Cgl/depcomp0000755000175000017500000003710011405215371013376 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Cgl/LICENSE0000644000175000017500000002622711507177625013052 0ustar renereneEclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. CoinMP-1.8.3/Cgl/README0000644000175000017500000000363111507177625012717 0ustar renereneCUT GENERATION LIBRARY README ============================= In this document, the following names are used: 1. 'coin-Cgl' is the full path to the directory in which you have dowloaded Cgl. 2. 'build' is the full path to the directory used for the installation of Cgl. It might be coin-Cgl or any other directory of your choosing. OVERVIEW ======== Welcome to the COIN-OR Cut Generator Library (Cgl). Cgl is distributed under the Eclipse Public License Version 1.0 and is freely redistributable. All source code and documentation is copyright by International Business Machines Corporation and others. This README file may be distributed freely. The COIN-OR Cut Generation Library is a collection of cut generators that can be used with other COIN-OR projects that make use of cuts, such as, among others, the linear solver Clp or the mixed integer linear programming solvers Cbc or BCP. Each cut generator is in a separate directory with its own maintainer. Maintainer names are listed in the AUTHORS file in the Cgl directory. For more information, see the Cgl Trac page (see below). CGL TRAC PAGE ============= https://projects.coin-or.org/Cgl INSTALLATION ============ If you have downloaded the Cgl package in the local directory coin-Cgl, please see the INSTALL file in coin-Cgl for a guide to install this package. If you have obtained Cgl by downloading another package, Cgl should be installed as part of the installation of that package. See the INSTALL file in the main directory of the package. SUPPORT ======= 1. Authors See the AUTHORS file. 2. Project Managers Robin Lougee-Heimer, robinlh@us.ibm.com Francois Margot, fmargot@andrew.cmu.edu 3. Mailing List Cgl users should use the Cgl mailing list. To subscribe, go to http://list.coin-or.org/mailman/listinfo/cgl 4. Bug Reports Bug reports should be posted to the Cgl mailing list and/or on the Cgl Trac page. CoinMP-1.8.3/Cgl/cgl.pc.in0000644000175000017500000000045511510106537013522 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: CGL Description: COIN-OR Cut Generation Library URL: https://projects.coin-or.org/Cgl Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lCgl @CGLLIB_PCLIBS@ Cflags: -I${includedir} Requires: @CGLLIB_PCREQUIRES@ CoinMP-1.8.3/Cgl/config.sub0000755000175000017500000007772611405215371014026 0ustar renerene#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Cgl/configure0000755000175000017500000357176512600266515013763 0ustar renerene#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for Cgl 0.59.7. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # # Copyright 2006 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package Coin which is distributed # under the Eclipse Public License. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='Cgl' PACKAGE_TARNAME='cgl' PACKAGE_VERSION='0.59.7' PACKAGE_STRING='Cgl 0.59.7' PACKAGE_BUGREPORT='cgl@list.coin-or.org' ac_unique_file="src/CglMessage.hpp" ac_default_prefix=`pwd` # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os ALWAYS_FALSE_TRUE ALWAYS_FALSE_FALSE have_svnversion CGL_SVN_REV CDEFS ADD_CFLAGS DBG_CFLAGS OPT_CFLAGS sol_cc_compiler CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT COIN_CC_IS_CL_TRUE COIN_CC_IS_CL_FALSE MPICC CXXDEFS ADD_CXXFLAGS DBG_CXXFLAGS OPT_CXXFLAGS CXX CXXFLAGS ac_ct_CXX COIN_CXX_IS_CL_TRUE COIN_CXX_IS_CL_FALSE MPICXX EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOLM4 have_autoconf have_automake have_svn BUILDTOOLSDIR AUX_DIR abs_source_dir abs_lib_dir abs_include_dir abs_bin_dir HAVE_EXTERNALS_TRUE HAVE_EXTERNALS_FALSE host host_cpu host_vendor host_os ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ac_c_preproc_warn_flag ac_cxx_preproc_warn_flag RPATH_FLAGS DEPENDENCY_LINKING_TRUE DEPENDENCY_LINKING_FALSE LT_LDFLAGS PKG_CONFIG ac_ct_PKG_CONFIG COIN_HAS_PKGCONFIG_TRUE COIN_HAS_PKGCONFIG_FALSE COIN_PKG_CONFIG_PATH COIN_PKG_CONFIG_PATH_UNINSTALLED COINUTILS_LIBS COINUTILS_CFLAGS COINUTILS_DATA COINUTILS_DEPENDENCIES COINUTILS_LIBS_INSTALLED COINUTILS_CFLAGS_INSTALLED COINUTILS_DATA_INSTALLED CGLLIB_CFLAGS CGLLIB_LIBS CGLLIB_PCLIBS CGLLIB_PCREQUIRES CGLLIB_DEPENDENCIES CGLLIB_CFLAGS_INSTALLED CGLLIB_LIBS_INSTALLED COIN_HAS_COINUTILS_TRUE COIN_HAS_COINUTILS_FALSE OSI_LIBS OSI_CFLAGS OSI_DATA OSI_DEPENDENCIES OSI_LIBS_INSTALLED OSI_CFLAGS_INSTALLED OSI_DATA_INSTALLED COIN_HAS_OSI_TRUE COIN_HAS_OSI_FALSE SAMPLE_LIBS SAMPLE_CFLAGS SAMPLE_DATA SAMPLE_DEPENDENCIES SAMPLE_LIBS_INSTALLED SAMPLE_CFLAGS_INSTALLED SAMPLE_DATA_INSTALLED COIN_HAS_SAMPLE_TRUE COIN_HAS_SAMPLE_FALSE OSICLP_LIBS OSICLP_CFLAGS OSICLP_DATA OSICLP_DEPENDENCIES OSICLP_LIBS_INSTALLED OSICLP_CFLAGS_INSTALLED OSICLP_DATA_INSTALLED COIN_HAS_OSICLP_TRUE COIN_HAS_OSICLP_FALSE OSICPX_LIBS OSICPX_CFLAGS OSICPX_DATA OSICPX_DEPENDENCIES OSICPX_LIBS_INSTALLED OSICPX_CFLAGS_INSTALLED OSICPX_DATA_INSTALLED COIN_HAS_OSICPX_TRUE COIN_HAS_OSICPX_FALSE OSIGLPK_LIBS OSIGLPK_CFLAGS OSIGLPK_DATA OSIGLPK_DEPENDENCIES OSIGLPK_LIBS_INSTALLED OSIGLPK_CFLAGS_INSTALLED OSIGLPK_DATA_INSTALLED COIN_HAS_OSIGLPK_TRUE COIN_HAS_OSIGLPK_FALSE OSIMSK_LIBS OSIMSK_CFLAGS OSIMSK_DATA OSIMSK_DEPENDENCIES OSIMSK_LIBS_INSTALLED OSIMSK_CFLAGS_INSTALLED OSIMSK_DATA_INSTALLED COIN_HAS_OSIMSK_TRUE COIN_HAS_OSIMSK_FALSE OSIXPR_LIBS OSIXPR_CFLAGS OSIXPR_DATA OSIXPR_DEPENDENCIES OSIXPR_LIBS_INSTALLED OSIXPR_CFLAGS_INSTALLED OSIXPR_DATA_INSTALLED COIN_HAS_OSIXPR_TRUE COIN_HAS_OSIXPR_FALSE OSIVOL_LIBS OSIVOL_CFLAGS OSIVOL_DATA OSIVOL_DEPENDENCIES OSIVOL_LIBS_INSTALLED OSIVOL_CFLAGS_INSTALLED OSIVOL_DATA_INSTALLED COIN_HAS_OSIVOL_TRUE COIN_HAS_OSIVOL_FALSE OSIDYLP_LIBS OSIDYLP_CFLAGS OSIDYLP_DATA OSIDYLP_DEPENDENCIES OSIDYLP_LIBS_INSTALLED OSIDYLP_CFLAGS_INSTALLED OSIDYLP_DATA_INSTALLED COIN_HAS_OSIDYLP_TRUE COIN_HAS_OSIDYLP_FALSE CGL_SUBDIRS CGL_SUBLIBS coin_have_doxygen coin_have_latex coin_doxy_usedot coin_doxy_tagname coin_doxy_logname COIN_HAS_DOXYGEN_TRUE COIN_HAS_DOXYGEN_FALSE COIN_HAS_LATEX_TRUE COIN_HAS_LATEX_FALSE coin_doxy_tagfiles coin_doxy_excludes LIBEXT VPATH_DISTCLEANFILES ABSBUILDDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CDEFS_set=${CDEFS+set} ac_env_CDEFS_value=$CDEFS ac_cv_env_CDEFS_set=${CDEFS+set} ac_cv_env_CDEFS_value=$CDEFS ac_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_cv_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_cv_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_cv_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_cv_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_cv_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_cv_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_MPICC_set=${MPICC+set} ac_env_MPICC_value=$MPICC ac_cv_env_MPICC_set=${MPICC+set} ac_cv_env_MPICC_value=$MPICC ac_env_CXXDEFS_set=${CXXDEFS+set} ac_env_CXXDEFS_value=$CXXDEFS ac_cv_env_CXXDEFS_set=${CXXDEFS+set} ac_cv_env_CXXDEFS_value=$CXXDEFS ac_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_cv_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_cv_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_cv_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_cv_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_cv_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_cv_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_MPICXX_set=${MPICXX+set} ac_env_MPICXX_value=$MPICXX ac_cv_env_MPICXX_set=${MPICXX+set} ac_cv_env_MPICXX_value=$MPICXX ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP ac_env_F77_set=${F77+set} ac_env_F77_value=$F77 ac_cv_env_F77_set=${F77+set} ac_cv_env_F77_value=$F77 ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_env_PKG_CONFIG_value=$PKG_CONFIG ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Cgl 0.59.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Cgl 0.59.7:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug compile all projects with debug options tests (implies --disable-shared) --enable-debug-cgl compile project Cgl with debug compiler flags --enable-msvc Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin. --enable-static[=PKGS] build static libraries [default=no] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-dependency-linking disable linking library dependencies into shared libraries --disable-pkg-config disable use of pkg-config (if available) --disable-interpackage-dependencies disables deduction of Makefile dependencies from package linker flags Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-cgl-verbosity specify the debug verbosity level for project Cgl --with-cgl-checklevel specify the sanity check level for project Cgl --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-coin-instdir prefix of installation directory for precompiled COIN packages --with-coinutils-lib linker flags for using package CoinUtils --with-coinutils-incdir directory with header files for using package CoinUtils --with-coinutils-datadir directory with data files for using package CoinUtils --with-osi-lib linker flags for using package Osi --with-osi-incdir directory with header files for using package Osi --with-osi-datadir directory with data files for using package Osi --with-sample-lib linker flags for using package Sample --with-sample-incdir directory with header files for using package Sample --with-sample-datadir directory with data files for using package Sample --with-osiclp-lib linker flags for using package OsiClp --with-osiclp-incdir directory with header files for using package OsiClp --with-osiclp-datadir directory with data files for using package OsiClp --with-osicpx-lib linker flags for using package OsiCpx --with-osicpx-incdir directory with header files for using package OsiCpx --with-osicpx-datadir directory with data files for using package OsiCpx --with-osiglpk-lib linker flags for using package OsiGlpk --with-osiglpk-incdir directory with header files for using package OsiGlpk --with-osiglpk-datadir directory with data files for using package OsiGlpk --with-osimsk-lib linker flags for using package OsiMsk --with-osimsk-incdir directory with header files for using package OsiMsk --with-osimsk-datadir directory with data files for using package OsiMsk --with-osixpr-lib linker flags for using package OsiXpr --with-osixpr-incdir directory with header files for using package OsiXpr --with-osixpr-datadir directory with data files for using package OsiXpr --with-osivol-lib linker flags for using package OsiVol --with-osivol-incdir directory with header files for using package OsiVol --with-osivol-datadir directory with data files for using package OsiVol --with-osidylp-lib linker flags for using package OsiDyLP --with-osidylp-incdir directory with header files for using package OsiDyLP --with-osidylp-datadir directory with data files for using package OsiDyLP --with-dot use dot (from graphviz) when creating documentation with doxygen if available; --without-dot to disable Some influential environment variables: CDEFS Additional -D flags to be used when compiling C code. ADD_CFLAGS Additional C compiler options DBG_CFLAGS Debug C compiler options OPT_CFLAGS Optimize C compiler options CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory MPICC C MPI Compiler CXXDEFS Additional -D flags to be used when compiling C++ code. ADD_CXXFLAGS Additional C++ compiler options DBG_CXXFLAGS Debug C++ compiler options OPT_CXXFLAGS Optimize C++ compiler options CXX C++ compiler command CXXFLAGS C++ compiler flags MPICXX C++ MPI Compiler CPP C preprocessor CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags PKG_CONFIG path to pkg-config utility Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Cgl configure 0.59.7 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Cgl $as_me 0.59.7, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # List one file in the package so that the configure script can test # whether the package is actually there # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. # As backup, we make sure we don't loose an FLIBS if it has been set # by the user save_FLIBS="$FLIBS" # A useful makefile conditional that is always false if false; then ALWAYS_FALSE_TRUE= ALWAYS_FALSE_FALSE='#' else ALWAYS_FALSE_TRUE='#' ALWAYS_FALSE_FALSE= fi # We set the following variable so that we know later in AC_COIN_FINALIZE # that we are in a project main directory coin_projectdir=yes # Set the project's version numbers cat >>confdefs.h <<_ACEOF #define CGL_VERSION "$PACKAGE_VERSION" _ACEOF coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'` coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'` coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'` if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi cat >>confdefs.h <<_ACEOF #define CGL_VERSION_MAJOR $coin_majorver _ACEOF cat >>confdefs.h <<_ACEOF #define CGL_VERSION_MINOR $coin_minorver _ACEOF cat >>confdefs.h <<_ACEOF #define CGL_VERSION_RELEASE $coin_releasever _ACEOF # We use the following variable to have a string with the upper case # version of the project name COIN_PRJCT=CGL # Set the project's SVN revision number. The complicated sed expression # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up # as a single number. # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svnversion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svnversion"; then ac_cv_prog_have_svnversion="$have_svnversion" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svnversion="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svnversion" && ac_cv_prog_have_svnversion="no" fi fi have_svnversion=$ac_cv_prog_have_svnversion if test -n "$have_svnversion"; then echo "$as_me:$LINENO: result: $have_svnversion" >&5 echo "${ECHO_T}$have_svnversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$have_svnversion" = xyes; then svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null` if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then CGL_SVN_REV=`echo $svn_rev_tmp | sed -n -e 's/^[0-9]*://' -e 's/\([0-9]\)[^0-9]*$/\1/p'` cat >>confdefs.h <<_ACEOF #define CGL_SVN_REV $CGL_SVN_REV _ACEOF fi fi # Capture libtool library version, if given. coin_libversion=10:7:9 # Check if user wants to produce debugging code echo "$as_me:$LINENO: checking whether we want to compile in debug mode" >&5 echo $ECHO_N "checking whether we want to compile in debug mode... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" case "${enableval}" in yes) coin_debug_compile=true if test "${enable_shared+set}" = set; then :; else enable_shared=no fi ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug" >&2;} { (exit 1); exit 1; }; } ;; esac else coin_debug_compile=false fi; # Check whether --enable-debug-cgl or --disable-debug-cgl was given. if test "${enable_debug_cgl+set}" = set; then enableval="$enable_debug_cgl" case "${enableval}" in yes) coin_debug_compile=true ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug-cgl" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug-cgl" >&2;} { (exit 1); exit 1; }; } ;; esac else : fi; # m4_ifvaln([Cgl], if test $coin_debug_compile = true; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Check whether --with-cgl-verbosity or --without-cgl-verbosity was given. if test "${with_cgl_verbosity+set}" = set; then withval="$with_cgl_verbosity" if test "$withval" = yes; then withval=1 fi coin_cgl_verbosity=$withval else coin_cgl_verbosity=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_CGL_VERBOSITY $coin_cgl_verbosity _ACEOF # Check whether --with-cgl-checklevel or --without-cgl-checklevel was given. if test "${with_cgl_checklevel+set}" = set; then withval="$with_cgl_checklevel" if test "$withval" = yes; then withval=1 fi coin_cgl_checklevel=$withval else coin_cgl_checklevel=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_CGL_CHECKLEVEL $coin_cgl_checklevel _ACEOF # m4_ifvaln([Cgl], # Get the name of the C++ compiler and appropriate compiler options # for backward compatibility # Check whether --enable-doscompile or --disable-doscompile was given. if test "${enable_doscompile+set}" = set; then enableval="$enable_doscompile" enable_doscompile=$enableval else enable_doscompile=no fi; # Check whether --enable-msvc or --disable-msvc was given. if test "${enable_msvc+set}" = set; then enableval="$enable_msvc" enable_msvc=$enableval else enable_msvc=no if test "$enable_doscompile" = msvc ; then enable_msvc=yes elif test "$enable_doscompile" != no ; then { { echo "$as_me:$LINENO: error: --enable-doscompile=$enable_doscompile not supported anymore." >&5 echo "$as_me: error: --enable-doscompile=$enable_doscompile not supported anymore." >&2;} { (exit 1); exit 1; }; } fi fi; if test "$enable_msvc" = MD; then enable_shared=yes enable_msvc=yes fi if test "$enable_msvc" = yes; then case $build in *-cygwin* | *-mingw*) ;; *) { { echo "$as_me:$LINENO: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&5 echo "$as_me: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&2;} { (exit 1); exit 1; }; } ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # For consistency, we set the C compiler to the same value of the C++ # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" { echo "$as_me:$LINENO: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&5 echo "$as_me: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&2;} fi ;; esac fi coin_has_cc=yes save_cflags="$CFLAGS" # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. # Depending on the user's PATH, when Studio/Workshop cc is not present we may # find /usr/ucb/cc, which is almost certainly not a good choice for the C # compiler. In this case, put cc after gcc. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl gcc" else comps="gcc icl cl" fi ;; *-*-solaris*) # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_sol_cc_compiler+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$sol_cc_compiler"; then ac_cv_prog_sol_cc_compiler="$sol_cc_compiler" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_sol_cc_compiler="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_sol_cc_compiler shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set sol_cc_compiler to just the basename; use the full file name. shift ac_cv_prog_sol_cc_compiler="$as_dir/$ac_word${1+' '}$@" fi fi fi fi sol_cc_compiler=$ac_cv_prog_sol_cc_compiler if test -n "$sol_cc_compiler"; then echo "$as_me:$LINENO: result: $sol_cc_compiler" >&5 echo "${ECHO_T}$sol_cc_compiler" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$sol_cc_compiler" = "cc" ; then comps="cc xlc gcc pgcc icc" else comps="xlc gcc pgcc icc cc" fi ;; *-*-darwin*) comps="clang gcc cc" ;; *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;; *-linux-*) comps="xlc gcc cc pgcc icc" ;; *) comps="xlc_r xlc cc gcc pgcc icc" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } # AC_MSG_NOTICE([C compiler candidates: $comps]) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -z "$CC" ; then { { echo "$as_me:$LINENO: error: Failed to find a C compiler!" >&5 echo "$as_me: error: Failed to find a C compiler!" >&2;} { (exit 1); exit 1; }; } fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; esac if test $coin_cc_is_cl = true; then COIN_CC_IS_CL_TRUE= COIN_CC_IS_CL_FALSE='#' else COIN_CC_IS_CL_TRUE='#' COIN_CC_IS_CL_FALSE= fi # Check if a project specific CFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} if test x$coin_tmp = xset; then eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} fi fi if test x"$CFLAGS" = x; then coin_add_cflags= coin_opt_cflags= coin_dbg_cflags= coin_warn_cflags= if test "$GCC" = "yes"; then case "$CC" in icc* | */icc*) ;; *) coin_opt_cflags="-O3" coin_add_cflags="-pipe" coin_dbg_cflags="-g -O0" coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cflags="-pedantic-errors $coin_warn_cflags" ;; esac esac fi if test -z "$coin_opt_cflags"; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' coin_dbg_cflags='-MDd' else coin_opt_cflags='-MT -O2' coin_dbg_cflags='-MTd' fi coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -Ox' coin_dbg_cflags='-MDd -debug' else coin_opt_cflags='-MT -Ox' coin_dbg_cflags='-MTd -debug' fi coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CC" in icc* | */icc*) coin_opt_cflags="-O3 -ip -mp1" coin_add_cflags="" coin_dbg_cflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cflags="-i_dynamic $coin_add_cflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgcc* | */pgcc*) coin_opt_cflags="-fast" coin_add_cflags="-Kieee -pc 64" coin_dbg_cflags="-g" ;; esac ;; *-ibm-*) case "$CC" in xlc* | */xlc* | mpxlc* | */mpxlc*) coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_cflags="-g" ;; esac ;; *-hp-*) coin_opt_cflags="-O" coin_add_cflags="-Ae" coin_dbg_cflags="-g" ;; *-*-solaris*) coin_opt_cflags="-xO4" coin_dbg_cflags="-g" ;; *-sgi-*) coin_opt_cflags="-O -OPT:Olimit=0" coin_dbg_cflags="-g" ;; esac fi if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then coin_dbg_cflags="-g" fi if test -z "$coin_opt_cflags"; then # Try if -O option works if nothing else is set CFLAGS="-O" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cflags" = xyes; then coin_warn_cflags= fi if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" fi DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" if test "$coin_debug_compile" = "true"; then CFLAGS="$DBG_CFLAGS" else CFLAGS="$OPT_CFLAGS" fi else CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$CFLAGS" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$CFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CFLAGS works save_CFLAGS="$CFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&2;} CFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C compiler options are: $CFLAGS" >&5 echo "$as_me: C compiler options are: $CFLAGS" >&6;} if test x"$MPICC" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C compiler $MPICC" >&5 echo "$as_me: Will use MPI C compiler $MPICC" >&6;} CC="$MPICC" fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #Let's try if that overcomes configuration problem with VC++ 6.0 ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_has_cxx=yes save_cxxflags="$CXXFLAGS" # For *-*-solaris*, promote Studio/Workshop compiler to front of list. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl g++" else comps="g++ icl cl" fi ;; *-*-solaris*) comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; *-darwin*) comps="clang++ g++ c++ CC" ;; *-linux-gnu*) comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;; *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } # AC_MSG_NOTICE([C++ compiler candidates: $comps]) ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler #thus, we test here whether $CXX is actually working ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking whether C++ compiler $CXX works" >&5 echo $ECHO_N "checking whether C++ compiler $CXX works... $ECHO_C" >&6; cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&5 echo "$as_me: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_cxx_is_cl=false # It seems that we need to cleanup something here for the Windows case "$CXX" in clang* | */clang*) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh mv confdefs.hh confdefs.h coin_cxx_is_cl=true ;; esac # add automake conditional so we can recognize cl compiler in makefile if test $coin_cxx_is_cl = true; then COIN_CXX_IS_CL_TRUE= COIN_CXX_IS_CL_FALSE='#' else COIN_CXX_IS_CL_TRUE='#' COIN_CXX_IS_CL_FALSE= fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CXXFLAGS="$save_cxxflags" # Check if a project specific CXXFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} if test x$coin_tmp = xset; then eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} fi fi if test x"$CXXFLAGS" = x; then # ToDo decide whether we want -DNDEBUG for optimization coin_add_cxxflags= coin_opt_cxxflags= coin_dbg_cxxflags= coin_warn_cxxflags= if test "$GXX" = "yes"; then case "$CXX" in icpc* | */icpc*) ;; *) # ToDo decide about unroll-loops coin_opt_cxxflags="-O3" coin_add_cxxflags="-pipe" coin_dbg_cxxflags="-g -O0" coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" ;; esac esac fi # Note that we do not need to cover GCC in the following tests. if test -z "$coin_opt_cxxflags"; then case $build in *-cygwin* | *-mingw*) case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -O2' coin_dbg_cxxflags='-MDd' else coin_opt_cxxflags='-MT -O2' coin_dbg_cxxflags='-MTd' fi coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -Ox' coin_dbg_cxxflags='-MDd -debug' else coin_opt_cxxflags='-MT -Ox' coin_dbg_cxxflags='-MTd -debug' fi coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CXX" in icpc* | */icpc*) coin_opt_cxxflags="-O3 -ip -mp1" coin_add_cxxflags="" coin_dbg_cxxflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CXXFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cxxflags="-i_dynamic $coin_add_cxxflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgCC* | */pgCC*) coin_opt_cxxflags="-fast" coin_add_cxxflags="-Kieee -pc 64" coin_dbg_cxxflags="-g" ;; esac ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" coin_dbg_cxxflags="-g" ;; esac ;; *-hp-*) case "$CXX" in aCC* | */aCC* ) coin_opt_cxxflags="-O" coin_add_cxxflags="-AA" coin_dbg_cxxflags="-g" ;; esac ;; *-*-solaris*) coin_opt_cxxflags="-O4" coin_dbg_cxxflags="-g" ;; esac fi # Generic flag settings. If these don't work, add a case above. if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then coin_dbg_cxxflags="-g" fi if test -z "$coin_opt_cxxflags"; then # Try if -O option works if nothing else is set CXXFLAGS=-O cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cxxflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cxxflags" = xyes; then coin_warn_cxxflags= fi # Do final setup of flags based on values determined above. if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" fi DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test "$coin_debug_compile" = "true"; then CXXFLAGS="$DBG_CXXFLAGS" else CXXFLAGS="$OPT_CXXFLAGS" fi # Handle the case where CXXFLAGS was set externally. else CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$CXXFLAGS" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$CXXFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CXXFLAGS works save_CXXFLAGS="$CXXFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&2;} CXXFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C++ compiler options are: $CXXFLAGS" >&5 echo "$as_me: C++ compiler options are: $CXXFLAGS" >&6;} if test x"$MPICXX" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C++ compiler $MPICXX" >&5 echo "$as_me: Will use MPI C++ compiler $MPICXX" >&6;} CXX="$MPICXX" fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Initialize automake and libtool { # START coin_disable_shared=no # Test if force_shared has been set if test "x" = xforce_shared; then if test x$enable_shared = xno; then { { echo "$as_me:$LINENO: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&5 echo "$as_me: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&2;} { (exit 1); exit 1; }; } fi enable_shared=yes; else case $build in *-cygwin* | *-mingw*) coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in clang* ) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Building of DLLs not supported in this configuration." >&5 echo "$as_me: Building of DLLs not supported in this configuration." >&6;} ;; *gcc*) if test x"$enable_dependency_linking" = xyes; then coin_disable_shared=no else { echo "$as_me:$LINENO: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&5 echo "$as_me: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&2;} fi ;; *) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; esac fi ;; *-aix*) coin_disable_shared=yes platform=AIX if test x"$enable_shared" = xyes; then { echo "$as_me:$LINENO: WARNING: Shared objects are not supported." >&5 echo "$as_me: WARNING: Shared objects are not supported." >&2;} fi ;; esac fi if test x"$coin_disable_shared" = xyes; then if test x"$enable_shared" = xyes; then : else # we don't disable shared, because it was not selected anyway coin_disable_shared=no fi enable_shared=no fi # By default, we only want the shared objects to be compiled # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=no fi; # Initialize automake echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='cgl' VERSION='0.59.7' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi depcc="$CXX" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME echo "$as_me:$LINENO: checking whether we are using the correct autotools" >&5 echo $ECHO_N "checking whether we are using the correct autotools... $ECHO_C" >&6 if test "${ac_cv_use_correct_autotools+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_correct_autotools=check fi echo "$as_me:$LINENO: result: $ac_cv_use_correct_autotools" >&5 echo "${ECHO_T}$ac_cv_use_correct_autotools" >&6 if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_autoconf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_autoconf"; then ac_cv_prog_have_autoconf="$have_autoconf" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_autoconf="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_autoconf" && ac_cv_prog_have_autoconf="no" fi fi have_autoconf=$ac_cv_prog_have_autoconf if test -n "$have_autoconf"; then echo "$as_me:$LINENO: result: $have_autoconf" >&5 echo "${ECHO_T}$have_autoconf" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_autoconf = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of autoconf" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of autoconf... $ECHO_C" >&6 autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of autoconf as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of autoconf as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location echo "$as_me:$LINENO: checking whether autoconf is coming from the correct location" >&5 echo $ECHO_N "checking whether autoconf is coming from the correct location... $ECHO_C" >&6 autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if we have automake # Extract the first word of "automake", so it can be a program name with args. set dummy automake; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_automake+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_automake"; then ac_cv_prog_have_automake="$have_automake" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_automake="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_automake" && ac_cv_prog_have_automake="no" fi fi have_automake=$ac_cv_prog_have_automake if test -n "$have_automake"; then echo "$as_me:$LINENO: result: $have_automake" >&5 echo "${ECHO_T}$have_automake" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_automake = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of automake" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of automake... $ECHO_C" >&6 automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of automake as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of automake as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable automake is picked up from the correct location echo "$as_me:$LINENO: checking whether automake is coming from the correct location" >&5 echo $ECHO_N "checking whether automake is coming from the correct location... $ECHO_C" >&6 automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` if test -r $want_dir/libtool/ltmain.sh; then have_ltmain=yes : else have_ltmain=no : fi echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of libtool." >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of libtool.... $ECHO_C" >&6 if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of libtool." >&5 echo "$as_me: error: You don't have the correct version of libtool." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: I cannot find the ltmain.sh file." >&5 echo "$as_me: error: I cannot find the ltmain.sh file." >&2;} { (exit 1); exit 1; }; } fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi if test -r $want_dir/aclocal/libtool.m4; then LIBTOOLM4="$want_dir/aclocal/libtool.m4" : else { { echo "$as_me:$LINENO: error: I cannot find the libtool.m4 file." >&5 echo "$as_me: error: I cannot find the libtool.m4 file." >&2;} { (exit 1); exit 1; }; } : fi # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https # Extract the first word of "svn", so it can be a program name with args. set dummy svn; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svn"; then ac_cv_prog_have_svn="$have_svn" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svn="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svn" && ac_cv_prog_have_svn="no" fi fi have_svn=$ac_cv_prog_have_svn if test -n "$have_svn"; then echo "$as_me:$LINENO: result: $have_svn" >&5 echo "${ECHO_T}$have_svn" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$have_svn = xyes; then echo "$as_me:$LINENO: checking whether svn understands https" >&5 echo $ECHO_N "checking whether svn understands https... $ECHO_C" >&6 if test "${ac_cv_svn_understands_https+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out fi echo "$as_me:$LINENO: result: $ac_cv_svn_understands_https" >&5 echo "${ECHO_T}$ac_cv_svn_understands_https" >&6 fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else { { echo "$as_me:$LINENO: error: Cannot find the BuildTools directory" >&5 echo "$as_me: error: Cannot find the BuildTools directory" >&2;} { (exit better disable maintainer mode.); exit better disable maintainer mode.; }; } fi fi fi # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` abs_lib_dir=$full_prefix/lib abs_include_dir=$full_prefix/include abs_bin_dir=$full_prefix/bin if test $coin_have_externals = yes && test x$have_svn = xyes; then HAVE_EXTERNALS_TRUE= HAVE_EXTERNALS_FALSE='#' else HAVE_EXTERNALS_TRUE='#' HAVE_EXTERNALS_FALSE= fi # AC_MSG_NOTICE([End automake initialisation.]) LIBTOOL= if test -f ../libtool; then coin_config_dir=.. LIBTOOL='$(SHELL) $(top_builddir)/../libtool' fi if test "x$LIBTOOL" = x; then if test -f ../../libtool; then coin_config_dir=../.. LIBTOOL='$(SHELL) $(top_builddir)/../../libtool' fi fi if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) # Stuff for libtool # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi; echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done fi SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix4* | aix5*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | kfreebsd*-gnu | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 5845 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to cgl@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done F77=$ac_ct_F77 fi # Provide some information about the compiler. echo "$as_me:6979:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 else echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux*) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6 else echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 fi echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6 if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6 objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAGIC_CMD=: fi fi fi ;; esac enable_dlopen=no enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default fi; test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8046: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8050: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8314: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8318: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 if test x"$lt_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works=yes fi else lt_prog_compiler_static_works=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 if test x"$lt_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8418: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:8422: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix3*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs=no ;; esac fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var" || \ test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which library types will actually be built echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags or --without-tags was given. if test "${with_tags+set}" = set; then withval="$with_tags" tagnames="$withval" fi; if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_CXX=yes else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_CXX=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_CXX='+b $libdir' ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix3*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. We must also pass each convience library through # to the system linker between allextract/defaultextract. # The C++ compiler will combine linker options so we # cannot just pass the convience library names through # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix3*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; solaris*) case $cc_basename in CC*) # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. postdeps_CXX='-lCstd -lCrun' ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13207: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:13211: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_CXX=yes fi else lt_prog_compiler_static_works_CXX=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 if test x"$lt_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13311: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:13315: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var_CXX" || \ test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6 if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_CXX" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code=" subroutine t\n return\n end\n" # Code to be used in simple link tests lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14881: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14885: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_F77=yes fi else lt_prog_compiler_static_works_F77=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 if test x"$lt_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14985: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:14989: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix3*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_F77=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_F77=yes else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_F77=no ;; esac fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var_F77" || \ test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6 if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_F77" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no old_archive_cmds_GCJ=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17192: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17196: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_GCJ='-Qoption ld ';; *) lt_prog_compiler_wl_GCJ='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; unicos*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_can_build_shared_GCJ=no ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17460: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17464: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_GCJ=yes fi else lt_prog_compiler_static_works_GCJ=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17564: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:17568: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix3*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_GCJ=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = no; then runpath_var= hardcode_libdir_flag_spec_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_GCJ=yes else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_GCJ=no ;; esac fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6 test "$ld_shlibs_GCJ" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ pic_flag=$lt_prog_compiler_pic_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var_GCJ" || \ test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6 if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_GCJ" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_RC" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion # No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- # AC_REQUIRE([AC_COIN_DLFCN_H]) # NEW: If libtool exists in the directory higher up, we use that one # instead of creating a new one # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED # out in front of this macro body. You'll notice that LIBTOOL is already # defined here. We'll have to count on this macro not being called if libtool # already exists, or at least move the libtool fixes outside the conditional. # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".]) # This test is therefore removed. -- lh, 061214 -- # if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Calling PROG_LIBTOOL.]) # AC_MSG_NOTICE([Finished PROG_LIBTOOL.]) { echo "$as_me:$LINENO: Build is \"$build\"." >&5 echo "$as_me: Build is \"$build\"." >&6;} mydos2unix='| dos2unix' case $build in *-mingw*) CYGPATH_W=echo mydos2unix= ;; esac case $build in # Here we need to check if -m32 is specified. If so, we need to correct # sys_lib_search_path_spec *-cygwin* | *-mingw*) case "$CXX" in clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? { echo "$as_me:$LINENO: Applying patches to libtool for CLANG compiler" >&5 echo "$as_me: Applying patches to libtool for CLANG compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Applying patches to libtool for cl compiler" >&5 echo "$as_me: Applying patches to libtool for cl compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%lib /OUT:%lib -OUT:%' \ -e "s%cygpath -w%$CYGPATH_W%" \ -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$1"'); done%' \ -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$1"') '"$mydos2unix"'%' \ -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ libtool > conftest.bla ;; *) { echo "$as_me:$LINENO: Applying patches to libtool for GNU compiler" >&5 echo "$as_me: Applying patches to libtool for GNU compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; esac mv conftest.bla libtool chmod 755 libtool ;; *x86_64-*) if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then { echo "$as_me:$LINENO: Applying patches to libtool for 32bit compilation" >&5 echo "$as_me: Applying patches to libtool for 32bit compilation" >&6;} sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi ;; *-solaris*) if test "$GCC" = yes && \ (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then hdwisa=`isainfo | sed -e 's/\([^ ]*\) .*$/\1/'` if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then { echo "$as_me:$LINENO: Applying patches to libtool for 64-bit GCC compilation" >&5 echo "$as_me: Applying patches to libtool for 64-bit GCC compilation" >&6;} fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then # AC_MSG_NOTICE(Compensating for broken gcc) for lib in $fixlibtmp ; do if test -d "${lib}${hdwisa}" ; then syslibpath64="$syslibpath64 ${lib}${hdwisa}/" fi done syslibpath64="${syslibpath64} ${fixlibtmp}" else syslibpath64="$fixlibtmp" fi sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi # AC_MSG_NOTICE(Result is ) # $EGREP 'sys_lib_search_path_spec=' libtool fi ;; # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. *-darwin*) { echo "$as_me:$LINENO: Applying patches to libtool for Darwin" >&5 echo "$as_me: Applying patches to libtool for Darwin" >&6;} sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool ;; esac # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of # the macro. -- lh, 061214 -- # fi # AC_MSG_NOTICE([End libtool initialisation.]) # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) # set RPATH_FLAGS to the compiler link flags required to hardcode location # of the shared objects RPATH_FLAGS= if test $enable_shared = yes; then case $build in *-linux-*) if test "$GXX" = "yes"; then RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" done fi ;; *-darwin*) RPATH_FLAGS=nothing ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) RPATH_FLAGS=nothing ;; esac ;; *-hp-*) RPATH_FLAGS=nothing ;; *-mingw32) RPATH_FLAGS=nothing ;; *-*-solaris*) RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -R$dir" done esac if test "$RPATH_FLAGS" = ""; then { echo "$as_me:$LINENO: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&5 echo "$as_me: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&2;} fi if test "$RPATH_FLAGS" = "nothing"; then RPATH_FLAGS= fi fi else { echo "$as_me:$LINENO: Using libtool script in directory $coin_config_dir" >&5 echo "$as_me: Using libtool script in directory $coin_config_dir" >&6;} # get all missing information from the config.log file # output variables and defines as_save_IFS=$IFS IFS=' ' for oneline in `cat $coin_config_dir/config.status`; do case "$oneline" in # First some automake conditionals s,@am__fastdep* | s,@AR@* | s,@CPP@* | s,@CPPFLAGS@* | s,@CXXCPP@* | \ s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \ s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \ s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; s,@DEFS@* ) command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; esac done IFS=$as_save_IFS # And some defines (assuming here that the packages base dir # doesn't have a config.h file for word in $defsline; do # echo word $word case $word in -DHAVE_[A-Z_]*_H=1 | -DSTDC_HEADERS=1 ) i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` # echo dd $i echo $i >>confdefs.h ;; esac done fi # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) # Check whether --enable-dependency-linking or --disable-dependency-linking was given. if test "${enable_dependency_linking+set}" = set; then enableval="$enable_dependency_linking" dependency_linking="$enableval" else dependency_linking=auto fi; if test "$dependency_linking" = auto; then # On Cygwin and AIX, building DLLs doesn't work dependency_linking=no if test x"$coin_disable_shared" = xno; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) dependency_linking=no ;; *gcc*) dependency_linking=yes ;; *) dependency_linking=yes ;; esac ;; *) dependency_linking=yes ;; esac fi fi if test "$dependency_linking" = yes ; then LT_LDFLAGS="-no-undefined" else LT_LDFLAGS= fi if test "$dependency_linking" = yes; then DEPENDENCY_LINKING_TRUE= DEPENDENCY_LINKING_FALSE='#' else DEPENDENCY_LINKING_TRUE='#' DEPENDENCY_LINKING_FALSE= fi # Check if we want to set the library version echo "$as_me:$LINENO: checking if library version is set" >&5 echo $ECHO_N "checking if library version is set... $ECHO_C" >&6 if test x"$coin_libversion" != x; then LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion" echo "$as_me:$LINENO: result: $coin_libversion" >&5 echo "${ECHO_T}$coin_libversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi #END } ############################################################################# # COIN-OR components # ############################################################################# # Check whether --enable-pkg-config or --disable-pkg-config was given. if test "${enable_pkg_config+set}" = set; then enableval="$enable_pkg_config" use_pkgconfig="$enableval" else if test x$coin_cc_is_cl = xtrue; then use_pkgconfig=no else use_pkgconfig=yes fi fi; if test $use_pkgconfig = yes ; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PKG_CONFIG=$ac_cv_prog_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_PKG_CONFIG"; then ac_ct_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_PKG_CONFIG"; then ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG if test -n "$ac_ct_PKG_CONFIG"; then echo "$as_me:$LINENO: result: $ac_ct_PKG_CONFIG" >&5 echo "${ECHO_T}$ac_ct_PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi PKG_CONFIG=$ac_ct_PKG_CONFIG else PKG_CONFIG="$ac_cv_prog_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.16.0 echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 PKG_CONFIG="" fi fi # check if pkg-config supports the short-errors flag if test -n "$PKG_CONFIG" && \ $PKG_CONFIG --atleast-pkgconfig-version 0.20; then pkg_short_errors=" --short-errors " else pkg_short_errors="" fi fi if test -n "$PKG_CONFIG"; then COIN_HAS_PKGCONFIG_TRUE= COIN_HAS_PKGCONFIG_FALSE='#' else COIN_HAS_PKGCONFIG_TRUE='#' COIN_HAS_PKGCONFIG_FALSE= fi # assemble pkg-config search path for installed projects COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" # let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there # best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig, # unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}... if test "x${prefix}" = xNONE ; then COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" else COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi # Check whether --with-coin-instdir or --without-coin-instdir was given. if test "${with_coin_instdir+set}" = set; then withval="$with_coin_instdir" if test -d "$withval"; then : ; else { { echo "$as_me:$LINENO: error: argument for --with-coin-instdir not a directory" >&5 echo "$as_me: error: argument for --with-coin-instdir not a directory" >&2;} { (exit 1); exit 1; }; } fi COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi; # assemble additional pkg-config search paths for uninstalled projects if test x$coin_projectdir = xyes ; then # if we are in a project setup, then in a classic setup, we want to find uninstalled projects # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory # unfortunately, if the user set prefix, then we do not know where the project base directory is located # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data) COIN_PKG_CONFIG_PATH_UNINSTALLED= if test -f ../coin_subdirs.txt ; then for i in `cat ../coin_subdirs.txt` ; do if test -d ../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi if test -f ../../coin_subdirs.txt ; then for i in `cat ../../coin_subdirs.txt` ; do if test -d ../../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi fi if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then { echo "$as_me:$LINENO: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&5 echo "$as_me: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&2;} fi echo "$as_me:$LINENO: checking for COIN-OR package CoinUtils" >&5 echo $ECHO_N "checking for COIN-OR package CoinUtils... $ECHO_C" >&6 coin_has_coinutils=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "CoinUtils"; then coin_has_coinutils=skipping fi done fi if test "$coin_has_coinutils" != skipping; then # Check whether --with-m4_tolower(CoinUtils) or --without-m4_tolower(CoinUtils) was given. if test "${with_coinutils+set}" = set; then withval="$with_coinutils" if test "$withval" = no ; then coin_has_coinutils=skipping fi fi; fi COINUTILS_LIBS= COINUTILS_CFLAGS= COINUTILS_DATA= COINUTILS_DEPENDENCIES= COINUTILS_PCLIBS= COINUTILS_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-lib or --without-m4_tolower(CoinUtils)-lib was given. if test "${with_coinutils_lib+set}" = set; then withval="$with_coinutils_lib" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_LIBS="$withval" COINUTILS_PCLIBS="$withval" CGLLIB_PCLIBS="$withval $CGLLIB_PCLIBS" CGLLIB_LIBS="$withval $CGLLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_LIBS_INSTALLED="$withval" CGLLIB_LIBS_INSTALLED="$withval $CGLLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-incdir or --without-m4_tolower(CoinUtils)-incdir was given. if test "${with_coinutils_incdir+set}" = set; then withval="$with_coinutils_incdir" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_CFLAGS="-I`${CYGPATH_W} $withval`" CGLLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CGLLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_CFLAGS_INSTALLED="$COINUTILS_CFLAGS" CGLLIB_CFLAGS_INSTALLED="$COINUTILS_CFLAGS $CGLLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-datadir or --without-m4_tolower(CoinUtils)-datadir was given. if test "${with_coinutils_datadir+set}" = set; then withval="$with_coinutils_datadir" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_coinutils = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinutils"; then COINUTILS_VERSIONS=`$PKG_CONFIG --modversion "coinutils" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinutils" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS="$cflags" COINUTILS_LIBS=`$PKG_CONFIG --libs "coinutils" 2>/dev/null` COINUTILS_DATA=`$PKG_CONFIG --variable=datadir "coinutils" 2>/dev/null` coin_has_coinutils=yes echo "$as_me:$LINENO: result: yes: $COINUTILS_VERSIONS" >&5 echo "${ECHO_T}yes: $COINUTILS_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then COINUTILS_LIBS=`echo " $COINUTILS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi COINUTILS_PCREQUIRES="coinutils" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CglLib CGLLIB_PCREQUIRES="coinutils $CGLLIB_PCREQUIRES" CGLLIB_CFLAGS="$COINUTILS_CFLAGS $CGLLIB_CFLAGS" CGLLIB_LIBS="$COINUTILS_LIBS $CGLLIB_LIBS" else COINUTILS_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinutils"` coin_has_coinutils=notGiven echo "$as_me:$LINENO: result: not given: $COINUTILS_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $COINUTILS_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module CoinUtils without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module CoinUtils without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package CoinUtils (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package CoinUtils (fallback)... $ECHO_C" >&6 coin_has_coinutils=notGiven COINUTILS_LIBS= COINUTILS_LIBS_INSTALLED= COINUTILS_CFLAGS= COINUTILS_CFLAGS_INSTALLED= COINUTILS_DATA= COINUTILS_DATA_INSTALLED= COINUTILS_PCLIBS= COINUTILS_PCREQUIRES= # initial list of dependencies is "coinutils", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinutils" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$COINUTILS_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` COINUTILS_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$COINUTILS_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi COINUTILS_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS="$projcflags $COINUTILS_CFLAGS" # set LIBS variable COINUTILS_LIBS="$projlibs $COINUTILS_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS_INSTALLED="$projcflags $COINUTILS_CFLAGS_INSTALLED" # set LIBS variable COINUTILS_LIBS_INSTALLED="$projlibs $COINUTILS_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_coinutils=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_COINUTILS 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then COINUTILS_LIBS=`echo " $COINUTILS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` COINUTILS_LIBS_INSTALLED=`echo " $COINUTILS_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi COINUTILS_PCREQUIRES="coinutils" CGLLIB_PCREQUIRES="coinutils $CGLLIB_PCREQUIRES" CGLLIB_CFLAGS="$COINUTILS_CFLAGS $CGLLIB_CFLAGS" CGLLIB_LIBS="$COINUTILS_LIBS $CGLLIB_LIBS" CGLLIB_CFLAGS_INSTALLED="$COINUTILS_CFLAGS_INSTALLED $CGLLIB_CFLAGS_INSTALLED" CGLLIB_LIBS_INSTALLED="$COINUTILS_LIBS_INSTALLED $CGLLIB_LIBS_INSTALLED" fi if test $coin_has_coinutils != notGiven && test $coin_has_coinutils != skipping; then COIN_HAS_COINUTILS_TRUE= COIN_HAS_COINUTILS_FALSE='#' else COIN_HAS_COINUTILS_TRUE='#' COIN_HAS_COINUTILS_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_coinutils" >&5 echo "${ECHO_T}$coin_has_coinutils" >&6 fi if test $coin_has_coinutils != skipping && test $coin_has_coinutils != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_COINUTILS 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) COINUTILS_DEPENDENCIES=`echo " $COINUTILS_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CGLLIB_DEPENDENCIES=`echo " $CGLLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$COINUTILS_CFLAGS" ; then { echo "$as_me:$LINENO: CoinUtils CFLAGS are $COINUTILS_CFLAGS" >&5 echo "$as_me: CoinUtils CFLAGS are $COINUTILS_CFLAGS" >&6;} fi if test -n "$COINUTILS_LIBS" ; then { echo "$as_me:$LINENO: CoinUtils LIBS are $COINUTILS_LIBS" >&5 echo "$as_me: CoinUtils LIBS are $COINUTILS_LIBS" >&6;} fi if test -n "$COINUTILS_DEPENDENCIES" ; then { echo "$as_me:$LINENO: CoinUtils DEPENDENCIES are $COINUTILS_DEPENDENCIES" >&5 echo "$as_me: CoinUtils DEPENDENCIES are $COINUTILS_DEPENDENCIES" >&6;} fi if test -n "$COINUTILS_DATA" ; then { echo "$as_me:$LINENO: CoinUtils DATA is $COINUTILS_DATA" >&5 echo "$as_me: CoinUtils DATA is $COINUTILS_DATA" >&6;} fi if test -n "$COINUTILS_PCLIBS" ; then { echo "$as_me:$LINENO: CoinUtils PCLIBS are $COINUTILS_PCLIBS" >&5 echo "$as_me: CoinUtils PCLIBS are $COINUTILS_PCLIBS" >&6;} fi if test -n "$COINUTILS_PCREQUIRES" ; then { echo "$as_me:$LINENO: CoinUtils PCREQUIRES are $COINUTILS_PCREQUIRES" >&5 echo "$as_me: CoinUtils PCREQUIRES are $COINUTILS_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CglLib CFLAGS are $CGLLIB_CFLAGS" >&5 echo "$as_me: CglLib CFLAGS are $CGLLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CglLib LIBS are $CGLLIB_LIBS" >&5 echo "$as_me: CglLib LIBS are $CGLLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CglLib DEPENDENCIES are $CGLLIB_DEPENDENCIES" >&5 echo "$as_me: CglLib DEPENDENCIES are $CGLLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_coinutils != notGiven && test $coin_has_coinutils != skipping; then COIN_HAS_COINUTILS_TRUE= COIN_HAS_COINUTILS_FALSE='#' else COIN_HAS_COINUTILS_TRUE='#' COIN_HAS_COINUTILS_FALSE= fi if test $coin_has_coinutils != yes ; then { { echo "$as_me:$LINENO: error: Required package CoinUtils not available." >&5 echo "$as_me: error: Required package CoinUtils not available." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for COIN-OR package Osi" >&5 echo $ECHO_N "checking for COIN-OR package Osi... $ECHO_C" >&6 coin_has_osi=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Osi"; then coin_has_osi=skipping fi done fi if test "$coin_has_osi" != skipping; then # Check whether --with-m4_tolower(Osi) or --without-m4_tolower(Osi) was given. if test "${with_osi+set}" = set; then withval="$with_osi" if test "$withval" = no ; then coin_has_osi=skipping fi fi; fi OSI_LIBS= OSI_CFLAGS= OSI_DATA= OSI_DEPENDENCIES= OSI_PCLIBS= OSI_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osi != skipping; then # Check whether --with-m4_tolower(Osi)-lib or --without-m4_tolower(Osi)-lib was given. if test "${with_osi_lib+set}" = set; then withval="$with_osi_lib" if test "$withval" = no ; then coin_has_osi=skipping else coin_has_osi=yes OSI_LIBS="$withval" OSI_PCLIBS="$withval" CGLLIB_PCLIBS="$withval $CGLLIB_PCLIBS" CGLLIB_LIBS="$withval $CGLLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSI_LIBS_INSTALLED="$withval" CGLLIB_LIBS_INSTALLED="$withval $CGLLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_osi != skipping; then # Check whether --with-m4_tolower(Osi)-incdir or --without-m4_tolower(Osi)-incdir was given. if test "${with_osi_incdir+set}" = set; then withval="$with_osi_incdir" if test "$withval" = no ; then coin_has_osi=skipping else coin_has_osi=yes OSI_CFLAGS="-I`${CYGPATH_W} $withval`" CGLLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CGLLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSI_CFLAGS_INSTALLED="$OSI_CFLAGS" CGLLIB_CFLAGS_INSTALLED="$OSI_CFLAGS $CGLLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_osi != skipping; then # Check whether --with-m4_tolower(Osi)-datadir or --without-m4_tolower(Osi)-datadir was given. if test "${with_osi_datadir+set}" = set; then withval="$with_osi_datadir" if test "$withval" = no ; then coin_has_osi=skipping else coin_has_osi=yes OSI_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSI_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osi = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi"; then OSI_VERSIONS=`$PKG_CONFIG --modversion "osi" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSI_CFLAGS="$cflags" OSI_LIBS=`$PKG_CONFIG --libs "osi" 2>/dev/null` OSI_DATA=`$PKG_CONFIG --variable=datadir "osi" 2>/dev/null` coin_has_osi=yes echo "$as_me:$LINENO: result: yes: $OSI_VERSIONS" >&5 echo "${ECHO_T}yes: $OSI_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSI_LIBS=`echo " $OSI_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSI_PCREQUIRES="osi" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CglLib CGLLIB_PCREQUIRES="osi $CGLLIB_PCREQUIRES" CGLLIB_CFLAGS="$OSI_CFLAGS $CGLLIB_CFLAGS" CGLLIB_LIBS="$OSI_LIBS $CGLLIB_LIBS" else OSI_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi"` coin_has_osi=notGiven echo "$as_me:$LINENO: result: not given: $OSI_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSI_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Osi without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Osi without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Osi (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Osi (fallback)... $ECHO_C" >&6 coin_has_osi=notGiven OSI_LIBS= OSI_LIBS_INSTALLED= OSI_CFLAGS= OSI_CFLAGS_INSTALLED= OSI_DATA= OSI_DATA_INSTALLED= OSI_PCLIBS= OSI_PCREQUIRES= # initial list of dependencies is "osi", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSI_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSI_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSI_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSI_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSI_CFLAGS="$projcflags $OSI_CFLAGS" # set LIBS variable OSI_LIBS="$projlibs $OSI_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSI_CFLAGS_INSTALLED="$projcflags $OSI_CFLAGS_INSTALLED" # set LIBS variable OSI_LIBS_INSTALLED="$projlibs $OSI_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osi=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSI 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSI_LIBS=`echo " $OSI_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSI_LIBS_INSTALLED=`echo " $OSI_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSI_PCREQUIRES="osi" CGLLIB_PCREQUIRES="osi $CGLLIB_PCREQUIRES" CGLLIB_CFLAGS="$OSI_CFLAGS $CGLLIB_CFLAGS" CGLLIB_LIBS="$OSI_LIBS $CGLLIB_LIBS" CGLLIB_CFLAGS_INSTALLED="$OSI_CFLAGS_INSTALLED $CGLLIB_CFLAGS_INSTALLED" CGLLIB_LIBS_INSTALLED="$OSI_LIBS_INSTALLED $CGLLIB_LIBS_INSTALLED" fi if test $coin_has_osi != notGiven && test $coin_has_osi != skipping; then COIN_HAS_OSI_TRUE= COIN_HAS_OSI_FALSE='#' else COIN_HAS_OSI_TRUE='#' COIN_HAS_OSI_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osi" >&5 echo "${ECHO_T}$coin_has_osi" >&6 fi if test $coin_has_osi != skipping && test $coin_has_osi != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSI 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSI_DEPENDENCIES=`echo " $OSI_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CGLLIB_DEPENDENCIES=`echo " $CGLLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSI_CFLAGS" ; then { echo "$as_me:$LINENO: Osi CFLAGS are $OSI_CFLAGS" >&5 echo "$as_me: Osi CFLAGS are $OSI_CFLAGS" >&6;} fi if test -n "$OSI_LIBS" ; then { echo "$as_me:$LINENO: Osi LIBS are $OSI_LIBS" >&5 echo "$as_me: Osi LIBS are $OSI_LIBS" >&6;} fi if test -n "$OSI_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Osi DEPENDENCIES are $OSI_DEPENDENCIES" >&5 echo "$as_me: Osi DEPENDENCIES are $OSI_DEPENDENCIES" >&6;} fi if test -n "$OSI_DATA" ; then { echo "$as_me:$LINENO: Osi DATA is $OSI_DATA" >&5 echo "$as_me: Osi DATA is $OSI_DATA" >&6;} fi if test -n "$OSI_PCLIBS" ; then { echo "$as_me:$LINENO: Osi PCLIBS are $OSI_PCLIBS" >&5 echo "$as_me: Osi PCLIBS are $OSI_PCLIBS" >&6;} fi if test -n "$OSI_PCREQUIRES" ; then { echo "$as_me:$LINENO: Osi PCREQUIRES are $OSI_PCREQUIRES" >&5 echo "$as_me: Osi PCREQUIRES are $OSI_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CglLib CFLAGS are $CGLLIB_CFLAGS" >&5 echo "$as_me: CglLib CFLAGS are $CGLLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CglLib LIBS are $CGLLIB_LIBS" >&5 echo "$as_me: CglLib LIBS are $CGLLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CglLib DEPENDENCIES are $CGLLIB_DEPENDENCIES" >&5 echo "$as_me: CglLib DEPENDENCIES are $CGLLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_osi != notGiven && test $coin_has_osi != skipping; then COIN_HAS_OSI_TRUE= COIN_HAS_OSI_FALSE='#' else COIN_HAS_OSI_TRUE='#' COIN_HAS_OSI_FALSE= fi if test $coin_has_osi != yes ; then { { echo "$as_me:$LINENO: error: Required package Osi not available." >&5 echo "$as_me: error: Required package Osi not available." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for COIN-OR package Sample" >&5 echo $ECHO_N "checking for COIN-OR package Sample... $ECHO_C" >&6 coin_has_sample=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Sample"; then coin_has_sample=skipping fi done fi if test "$coin_has_sample" != skipping; then # Check whether --with-m4_tolower(Sample) or --without-m4_tolower(Sample) was given. if test "${with_sample+set}" = set; then withval="$with_sample" if test "$withval" = no ; then coin_has_sample=skipping fi fi; fi SAMPLE_LIBS= SAMPLE_CFLAGS= SAMPLE_DATA= SAMPLE_DEPENDENCIES= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-lib or --without-m4_tolower(Sample)-lib was given. if test "${with_sample_lib+set}" = set; then withval="$with_sample_lib" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_LIBS="$withval" SAMPLE_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-incdir or --without-m4_tolower(Sample)-incdir was given. if test "${with_sample_incdir+set}" = set; then withval="$with_sample_incdir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_CFLAGS_INSTALLED="$SAMPLE_CFLAGS" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-datadir or --without-m4_tolower(Sample)-datadir was given. if test "${with_sample_datadir+set}" = set; then withval="$with_sample_datadir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatasample"; then SAMPLE_VERSIONS=`$PKG_CONFIG --modversion "coindatasample" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatasample" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$cflags" SAMPLE_LIBS=`$PKG_CONFIG --libs "coindatasample" 2>/dev/null` SAMPLE_DATA=`$PKG_CONFIG --variable=datadir "coindatasample" 2>/dev/null` coin_has_sample=yes echo "$as_me:$LINENO: result: yes: $SAMPLE_VERSIONS" >&5 echo "${ECHO_T}yes: $SAMPLE_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi SAMPLE_PCREQUIRES="coindatasample" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else SAMPLE_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatasample"` coin_has_sample=notGiven echo "$as_me:$LINENO: result: not given: $SAMPLE_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $SAMPLE_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Sample without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Sample without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Sample (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Sample (fallback)... $ECHO_C" >&6 coin_has_sample=notGiven SAMPLE_LIBS= SAMPLE_LIBS_INSTALLED= SAMPLE_CFLAGS= SAMPLE_CFLAGS_INSTALLED= SAMPLE_DATA= SAMPLE_DATA_INSTALLED= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= # initial list of dependencies is "coindatasample", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatasample" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$SAMPLE_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` SAMPLE_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$SAMPLE_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi SAMPLE_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$projcflags $SAMPLE_CFLAGS" # set LIBS variable SAMPLE_LIBS="$projlibs $SAMPLE_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS_INSTALLED="$projcflags $SAMPLE_CFLAGS_INSTALLED" # set LIBS variable SAMPLE_LIBS_INSTALLED="$projlibs $SAMPLE_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_sample=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` SAMPLE_LIBS_INSTALLED=`echo " $SAMPLE_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi SAMPLE_PCREQUIRES="coindatasample" fi if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_sample" >&5 echo "${ECHO_T}$coin_has_sample" >&6 fi if test $coin_has_sample != skipping && test $coin_has_sample != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) SAMPLE_DEPENDENCIES=`echo " $SAMPLE_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$SAMPLE_CFLAGS" ; then { echo "$as_me:$LINENO: Sample CFLAGS are $SAMPLE_CFLAGS" >&5 echo "$as_me: Sample CFLAGS are $SAMPLE_CFLAGS" >&6;} fi if test -n "$SAMPLE_LIBS" ; then { echo "$as_me:$LINENO: Sample LIBS are $SAMPLE_LIBS" >&5 echo "$as_me: Sample LIBS are $SAMPLE_LIBS" >&6;} fi if test -n "$SAMPLE_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&5 echo "$as_me: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&6;} fi if test -n "$SAMPLE_DATA" ; then { echo "$as_me:$LINENO: Sample DATA is $SAMPLE_DATA" >&5 echo "$as_me: Sample DATA is $SAMPLE_DATA" >&6;} fi if test -n "$SAMPLE_PCLIBS" ; then { echo "$as_me:$LINENO: Sample PCLIBS are $SAMPLE_PCLIBS" >&5 echo "$as_me: Sample PCLIBS are $SAMPLE_PCLIBS" >&6;} fi if test -n "$SAMPLE_PCREQUIRES" ; then { echo "$as_me:$LINENO: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&5 echo "$as_me: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi # Clp can be used by CglLandP echo "$as_me:$LINENO: checking for COIN-OR package OsiClp" >&5 echo $ECHO_N "checking for COIN-OR package OsiClp... $ECHO_C" >&6 coin_has_osiclp=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiClp"; then coin_has_osiclp=skipping fi done fi if test "$coin_has_osiclp" != skipping; then # Check whether --with-m4_tolower(OsiClp) or --without-m4_tolower(OsiClp) was given. if test "${with_osiclp+set}" = set; then withval="$with_osiclp" if test "$withval" = no ; then coin_has_osiclp=skipping fi fi; fi OSICLP_LIBS= OSICLP_CFLAGS= OSICLP_DATA= OSICLP_DEPENDENCIES= OSICLP_PCLIBS= OSICLP_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osiclp != skipping; then # Check whether --with-m4_tolower(OsiClp)-lib or --without-m4_tolower(OsiClp)-lib was given. if test "${with_osiclp_lib+set}" = set; then withval="$with_osiclp_lib" if test "$withval" = no ; then coin_has_osiclp=skipping else coin_has_osiclp=yes OSICLP_LIBS="$withval" OSICLP_PCLIBS="$withval" CGLLIB_PCLIBS="$withval $CGLLIB_PCLIBS" CGLLIB_LIBS="$withval $CGLLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSICLP_LIBS_INSTALLED="$withval" CGLLIB_LIBS_INSTALLED="$withval $CGLLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_osiclp != skipping; then # Check whether --with-m4_tolower(OsiClp)-incdir or --without-m4_tolower(OsiClp)-incdir was given. if test "${with_osiclp_incdir+set}" = set; then withval="$with_osiclp_incdir" if test "$withval" = no ; then coin_has_osiclp=skipping else coin_has_osiclp=yes OSICLP_CFLAGS="-I`${CYGPATH_W} $withval`" CGLLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CGLLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSICLP_CFLAGS_INSTALLED="$OSICLP_CFLAGS" CGLLIB_CFLAGS_INSTALLED="$OSICLP_CFLAGS $CGLLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_osiclp != skipping; then # Check whether --with-m4_tolower(OsiClp)-datadir or --without-m4_tolower(OsiClp)-datadir was given. if test "${with_osiclp_datadir+set}" = set; then withval="$with_osiclp_datadir" if test "$withval" = no ; then coin_has_osiclp=skipping else coin_has_osiclp=yes OSICLP_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSICLP_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osiclp = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-clp"; then OSICLP_VERSIONS=`$PKG_CONFIG --modversion "osi-clp" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-clp" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSICLP_CFLAGS="$cflags" OSICLP_LIBS=`$PKG_CONFIG --libs "osi-clp" 2>/dev/null` OSICLP_DATA=`$PKG_CONFIG --variable=datadir "osi-clp" 2>/dev/null` coin_has_osiclp=yes echo "$as_me:$LINENO: result: yes: $OSICLP_VERSIONS" >&5 echo "${ECHO_T}yes: $OSICLP_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSICLP_LIBS=`echo " $OSICLP_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSICLP_PCREQUIRES="osi-clp" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CglLib CGLLIB_PCREQUIRES="osi-clp $CGLLIB_PCREQUIRES" CGLLIB_CFLAGS="$OSICLP_CFLAGS $CGLLIB_CFLAGS" CGLLIB_LIBS="$OSICLP_LIBS $CGLLIB_LIBS" else OSICLP_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-clp"` coin_has_osiclp=notGiven echo "$as_me:$LINENO: result: not given: $OSICLP_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSICLP_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiClp without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiClp without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiClp (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiClp (fallback)... $ECHO_C" >&6 coin_has_osiclp=notGiven OSICLP_LIBS= OSICLP_LIBS_INSTALLED= OSICLP_CFLAGS= OSICLP_CFLAGS_INSTALLED= OSICLP_DATA= OSICLP_DATA_INSTALLED= OSICLP_PCLIBS= OSICLP_PCREQUIRES= # initial list of dependencies is "osi-clp", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-clp" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSICLP_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSICLP_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSICLP_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSICLP_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSICLP_CFLAGS="$projcflags $OSICLP_CFLAGS" # set LIBS variable OSICLP_LIBS="$projlibs $OSICLP_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSICLP_CFLAGS_INSTALLED="$projcflags $OSICLP_CFLAGS_INSTALLED" # set LIBS variable OSICLP_LIBS_INSTALLED="$projlibs $OSICLP_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osiclp=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSICLP 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSICLP_LIBS=`echo " $OSICLP_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSICLP_LIBS_INSTALLED=`echo " $OSICLP_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSICLP_PCREQUIRES="osi-clp" CGLLIB_PCREQUIRES="osi-clp $CGLLIB_PCREQUIRES" CGLLIB_CFLAGS="$OSICLP_CFLAGS $CGLLIB_CFLAGS" CGLLIB_LIBS="$OSICLP_LIBS $CGLLIB_LIBS" CGLLIB_CFLAGS_INSTALLED="$OSICLP_CFLAGS_INSTALLED $CGLLIB_CFLAGS_INSTALLED" CGLLIB_LIBS_INSTALLED="$OSICLP_LIBS_INSTALLED $CGLLIB_LIBS_INSTALLED" fi if test $coin_has_osiclp != notGiven && test $coin_has_osiclp != skipping; then COIN_HAS_OSICLP_TRUE= COIN_HAS_OSICLP_FALSE='#' else COIN_HAS_OSICLP_TRUE='#' COIN_HAS_OSICLP_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osiclp" >&5 echo "${ECHO_T}$coin_has_osiclp" >&6 fi if test $coin_has_osiclp != skipping && test $coin_has_osiclp != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSICLP 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSICLP_DEPENDENCIES=`echo " $OSICLP_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CGLLIB_DEPENDENCIES=`echo " $CGLLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSICLP_CFLAGS" ; then { echo "$as_me:$LINENO: OsiClp CFLAGS are $OSICLP_CFLAGS" >&5 echo "$as_me: OsiClp CFLAGS are $OSICLP_CFLAGS" >&6;} fi if test -n "$OSICLP_LIBS" ; then { echo "$as_me:$LINENO: OsiClp LIBS are $OSICLP_LIBS" >&5 echo "$as_me: OsiClp LIBS are $OSICLP_LIBS" >&6;} fi if test -n "$OSICLP_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiClp DEPENDENCIES are $OSICLP_DEPENDENCIES" >&5 echo "$as_me: OsiClp DEPENDENCIES are $OSICLP_DEPENDENCIES" >&6;} fi if test -n "$OSICLP_DATA" ; then { echo "$as_me:$LINENO: OsiClp DATA is $OSICLP_DATA" >&5 echo "$as_me: OsiClp DATA is $OSICLP_DATA" >&6;} fi if test -n "$OSICLP_PCLIBS" ; then { echo "$as_me:$LINENO: OsiClp PCLIBS are $OSICLP_PCLIBS" >&5 echo "$as_me: OsiClp PCLIBS are $OSICLP_PCLIBS" >&6;} fi if test -n "$OSICLP_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiClp PCREQUIRES are $OSICLP_PCREQUIRES" >&5 echo "$as_me: OsiClp PCREQUIRES are $OSICLP_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CglLib CFLAGS are $CGLLIB_CFLAGS" >&5 echo "$as_me: CglLib CFLAGS are $CGLLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CglLib LIBS are $CGLLIB_LIBS" >&5 echo "$as_me: CglLib LIBS are $CGLLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CglLib DEPENDENCIES are $CGLLIB_DEPENDENCIES" >&5 echo "$as_me: CglLib DEPENDENCIES are $CGLLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_osiclp != notGiven && test $coin_has_osiclp != skipping; then COIN_HAS_OSICLP_TRUE= COIN_HAS_OSICLP_FALSE='#' else COIN_HAS_OSICLP_TRUE='#' COIN_HAS_OSICLP_FALSE= fi ############################################################################# # Solvers for unittesting # ############################################################################# # These are not really required for the compilation of Cgl, but we # need to know which are available in order to compile the unitTest # correctly. echo "$as_me:$LINENO: checking for COIN-OR package OsiCpx" >&5 echo $ECHO_N "checking for COIN-OR package OsiCpx... $ECHO_C" >&6 coin_has_osicpx=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiCpx"; then coin_has_osicpx=skipping fi done fi if test "$coin_has_osicpx" != skipping; then # Check whether --with-m4_tolower(OsiCpx) or --without-m4_tolower(OsiCpx) was given. if test "${with_osicpx+set}" = set; then withval="$with_osicpx" if test "$withval" = no ; then coin_has_osicpx=skipping fi fi; fi OSICPX_LIBS= OSICPX_CFLAGS= OSICPX_DATA= OSICPX_DEPENDENCIES= OSICPX_PCLIBS= OSICPX_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osicpx != skipping; then # Check whether --with-m4_tolower(OsiCpx)-lib or --without-m4_tolower(OsiCpx)-lib was given. if test "${with_osicpx_lib+set}" = set; then withval="$with_osicpx_lib" if test "$withval" = no ; then coin_has_osicpx=skipping else coin_has_osicpx=yes OSICPX_LIBS="$withval" OSICPX_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSICPX_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osicpx != skipping; then # Check whether --with-m4_tolower(OsiCpx)-incdir or --without-m4_tolower(OsiCpx)-incdir was given. if test "${with_osicpx_incdir+set}" = set; then withval="$with_osicpx_incdir" if test "$withval" = no ; then coin_has_osicpx=skipping else coin_has_osicpx=yes OSICPX_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSICPX_CFLAGS_INSTALLED="$OSICPX_CFLAGS" fi fi fi; fi if test $coin_has_osicpx != skipping; then # Check whether --with-m4_tolower(OsiCpx)-datadir or --without-m4_tolower(OsiCpx)-datadir was given. if test "${with_osicpx_datadir+set}" = set; then withval="$with_osicpx_datadir" if test "$withval" = no ; then coin_has_osicpx=skipping else coin_has_osicpx=yes OSICPX_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSICPX_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osicpx = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-cplex"; then OSICPX_VERSIONS=`$PKG_CONFIG --modversion "osi-cplex" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-cplex" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSICPX_CFLAGS="$cflags" OSICPX_LIBS=`$PKG_CONFIG --libs "osi-cplex" 2>/dev/null` OSICPX_DATA=`$PKG_CONFIG --variable=datadir "osi-cplex" 2>/dev/null` coin_has_osicpx=yes echo "$as_me:$LINENO: result: yes: $OSICPX_VERSIONS" >&5 echo "${ECHO_T}yes: $OSICPX_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSICPX_LIBS=`echo " $OSICPX_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSICPX_PCREQUIRES="osi-cplex" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else OSICPX_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-cplex"` coin_has_osicpx=notGiven echo "$as_me:$LINENO: result: not given: $OSICPX_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSICPX_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiCpx without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiCpx without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiCpx (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiCpx (fallback)... $ECHO_C" >&6 coin_has_osicpx=notGiven OSICPX_LIBS= OSICPX_LIBS_INSTALLED= OSICPX_CFLAGS= OSICPX_CFLAGS_INSTALLED= OSICPX_DATA= OSICPX_DATA_INSTALLED= OSICPX_PCLIBS= OSICPX_PCREQUIRES= # initial list of dependencies is "osi-cplex", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-cplex" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSICPX_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSICPX_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSICPX_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSICPX_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSICPX_CFLAGS="$projcflags $OSICPX_CFLAGS" # set LIBS variable OSICPX_LIBS="$projlibs $OSICPX_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSICPX_CFLAGS_INSTALLED="$projcflags $OSICPX_CFLAGS_INSTALLED" # set LIBS variable OSICPX_LIBS_INSTALLED="$projlibs $OSICPX_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osicpx=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSICPX 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSICPX_LIBS=`echo " $OSICPX_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSICPX_LIBS_INSTALLED=`echo " $OSICPX_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSICPX_PCREQUIRES="osi-cplex" fi if test $coin_has_osicpx != notGiven && test $coin_has_osicpx != skipping; then COIN_HAS_OSICPX_TRUE= COIN_HAS_OSICPX_FALSE='#' else COIN_HAS_OSICPX_TRUE='#' COIN_HAS_OSICPX_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osicpx" >&5 echo "${ECHO_T}$coin_has_osicpx" >&6 fi if test $coin_has_osicpx != skipping && test $coin_has_osicpx != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSICPX 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSICPX_DEPENDENCIES=`echo " $OSICPX_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSICPX_CFLAGS" ; then { echo "$as_me:$LINENO: OsiCpx CFLAGS are $OSICPX_CFLAGS" >&5 echo "$as_me: OsiCpx CFLAGS are $OSICPX_CFLAGS" >&6;} fi if test -n "$OSICPX_LIBS" ; then { echo "$as_me:$LINENO: OsiCpx LIBS are $OSICPX_LIBS" >&5 echo "$as_me: OsiCpx LIBS are $OSICPX_LIBS" >&6;} fi if test -n "$OSICPX_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiCpx DEPENDENCIES are $OSICPX_DEPENDENCIES" >&5 echo "$as_me: OsiCpx DEPENDENCIES are $OSICPX_DEPENDENCIES" >&6;} fi if test -n "$OSICPX_DATA" ; then { echo "$as_me:$LINENO: OsiCpx DATA is $OSICPX_DATA" >&5 echo "$as_me: OsiCpx DATA is $OSICPX_DATA" >&6;} fi if test -n "$OSICPX_PCLIBS" ; then { echo "$as_me:$LINENO: OsiCpx PCLIBS are $OSICPX_PCLIBS" >&5 echo "$as_me: OsiCpx PCLIBS are $OSICPX_PCLIBS" >&6;} fi if test -n "$OSICPX_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiCpx PCREQUIRES are $OSICPX_PCREQUIRES" >&5 echo "$as_me: OsiCpx PCREQUIRES are $OSICPX_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_osicpx != notGiven && test $coin_has_osicpx != skipping; then COIN_HAS_OSICPX_TRUE= COIN_HAS_OSICPX_FALSE='#' else COIN_HAS_OSICPX_TRUE='#' COIN_HAS_OSICPX_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package OsiGlpk" >&5 echo $ECHO_N "checking for COIN-OR package OsiGlpk... $ECHO_C" >&6 coin_has_osiglpk=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiGlpk"; then coin_has_osiglpk=skipping fi done fi if test "$coin_has_osiglpk" != skipping; then # Check whether --with-m4_tolower(OsiGlpk) or --without-m4_tolower(OsiGlpk) was given. if test "${with_osiglpk+set}" = set; then withval="$with_osiglpk" if test "$withval" = no ; then coin_has_osiglpk=skipping fi fi; fi OSIGLPK_LIBS= OSIGLPK_CFLAGS= OSIGLPK_DATA= OSIGLPK_DEPENDENCIES= OSIGLPK_PCLIBS= OSIGLPK_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osiglpk != skipping; then # Check whether --with-m4_tolower(OsiGlpk)-lib or --without-m4_tolower(OsiGlpk)-lib was given. if test "${with_osiglpk_lib+set}" = set; then withval="$with_osiglpk_lib" if test "$withval" = no ; then coin_has_osiglpk=skipping else coin_has_osiglpk=yes OSIGLPK_LIBS="$withval" OSIGLPK_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIGLPK_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osiglpk != skipping; then # Check whether --with-m4_tolower(OsiGlpk)-incdir or --without-m4_tolower(OsiGlpk)-incdir was given. if test "${with_osiglpk_incdir+set}" = set; then withval="$with_osiglpk_incdir" if test "$withval" = no ; then coin_has_osiglpk=skipping else coin_has_osiglpk=yes OSIGLPK_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIGLPK_CFLAGS_INSTALLED="$OSIGLPK_CFLAGS" fi fi fi; fi if test $coin_has_osiglpk != skipping; then # Check whether --with-m4_tolower(OsiGlpk)-datadir or --without-m4_tolower(OsiGlpk)-datadir was given. if test "${with_osiglpk_datadir+set}" = set; then withval="$with_osiglpk_datadir" if test "$withval" = no ; then coin_has_osiglpk=skipping else coin_has_osiglpk=yes OSIGLPK_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIGLPK_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osiglpk = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-glpk"; then OSIGLPK_VERSIONS=`$PKG_CONFIG --modversion "osi-glpk" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-glpk" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIGLPK_CFLAGS="$cflags" OSIGLPK_LIBS=`$PKG_CONFIG --libs "osi-glpk" 2>/dev/null` OSIGLPK_DATA=`$PKG_CONFIG --variable=datadir "osi-glpk" 2>/dev/null` coin_has_osiglpk=yes echo "$as_me:$LINENO: result: yes: $OSIGLPK_VERSIONS" >&5 echo "${ECHO_T}yes: $OSIGLPK_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIGLPK_LIBS=`echo " $OSIGLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSIGLPK_PCREQUIRES="osi-glpk" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else OSIGLPK_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-glpk"` coin_has_osiglpk=notGiven echo "$as_me:$LINENO: result: not given: $OSIGLPK_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSIGLPK_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiGlpk without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiGlpk without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiGlpk (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiGlpk (fallback)... $ECHO_C" >&6 coin_has_osiglpk=notGiven OSIGLPK_LIBS= OSIGLPK_LIBS_INSTALLED= OSIGLPK_CFLAGS= OSIGLPK_CFLAGS_INSTALLED= OSIGLPK_DATA= OSIGLPK_DATA_INSTALLED= OSIGLPK_PCLIBS= OSIGLPK_PCREQUIRES= # initial list of dependencies is "osi-glpk", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-glpk" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSIGLPK_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSIGLPK_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSIGLPK_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSIGLPK_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIGLPK_CFLAGS="$projcflags $OSIGLPK_CFLAGS" # set LIBS variable OSIGLPK_LIBS="$projlibs $OSIGLPK_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIGLPK_CFLAGS_INSTALLED="$projcflags $OSIGLPK_CFLAGS_INSTALLED" # set LIBS variable OSIGLPK_LIBS_INSTALLED="$projlibs $OSIGLPK_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osiglpk=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIGLPK 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIGLPK_LIBS=`echo " $OSIGLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSIGLPK_LIBS_INSTALLED=`echo " $OSIGLPK_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSIGLPK_PCREQUIRES="osi-glpk" fi if test $coin_has_osiglpk != notGiven && test $coin_has_osiglpk != skipping; then COIN_HAS_OSIGLPK_TRUE= COIN_HAS_OSIGLPK_FALSE='#' else COIN_HAS_OSIGLPK_TRUE='#' COIN_HAS_OSIGLPK_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osiglpk" >&5 echo "${ECHO_T}$coin_has_osiglpk" >&6 fi if test $coin_has_osiglpk != skipping && test $coin_has_osiglpk != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIGLPK 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSIGLPK_DEPENDENCIES=`echo " $OSIGLPK_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSIGLPK_CFLAGS" ; then { echo "$as_me:$LINENO: OsiGlpk CFLAGS are $OSIGLPK_CFLAGS" >&5 echo "$as_me: OsiGlpk CFLAGS are $OSIGLPK_CFLAGS" >&6;} fi if test -n "$OSIGLPK_LIBS" ; then { echo "$as_me:$LINENO: OsiGlpk LIBS are $OSIGLPK_LIBS" >&5 echo "$as_me: OsiGlpk LIBS are $OSIGLPK_LIBS" >&6;} fi if test -n "$OSIGLPK_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiGlpk DEPENDENCIES are $OSIGLPK_DEPENDENCIES" >&5 echo "$as_me: OsiGlpk DEPENDENCIES are $OSIGLPK_DEPENDENCIES" >&6;} fi if test -n "$OSIGLPK_DATA" ; then { echo "$as_me:$LINENO: OsiGlpk DATA is $OSIGLPK_DATA" >&5 echo "$as_me: OsiGlpk DATA is $OSIGLPK_DATA" >&6;} fi if test -n "$OSIGLPK_PCLIBS" ; then { echo "$as_me:$LINENO: OsiGlpk PCLIBS are $OSIGLPK_PCLIBS" >&5 echo "$as_me: OsiGlpk PCLIBS are $OSIGLPK_PCLIBS" >&6;} fi if test -n "$OSIGLPK_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiGlpk PCREQUIRES are $OSIGLPK_PCREQUIRES" >&5 echo "$as_me: OsiGlpk PCREQUIRES are $OSIGLPK_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_osiglpk != notGiven && test $coin_has_osiglpk != skipping; then COIN_HAS_OSIGLPK_TRUE= COIN_HAS_OSIGLPK_FALSE='#' else COIN_HAS_OSIGLPK_TRUE='#' COIN_HAS_OSIGLPK_FALSE= fi #AC_COIN_CHECK_PACKAGE(OsiGrb, [osi-gurobi]) echo "$as_me:$LINENO: checking for COIN-OR package OsiMsk" >&5 echo $ECHO_N "checking for COIN-OR package OsiMsk... $ECHO_C" >&6 coin_has_osimsk=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiMsk"; then coin_has_osimsk=skipping fi done fi if test "$coin_has_osimsk" != skipping; then # Check whether --with-m4_tolower(OsiMsk) or --without-m4_tolower(OsiMsk) was given. if test "${with_osimsk+set}" = set; then withval="$with_osimsk" if test "$withval" = no ; then coin_has_osimsk=skipping fi fi; fi OSIMSK_LIBS= OSIMSK_CFLAGS= OSIMSK_DATA= OSIMSK_DEPENDENCIES= OSIMSK_PCLIBS= OSIMSK_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osimsk != skipping; then # Check whether --with-m4_tolower(OsiMsk)-lib or --without-m4_tolower(OsiMsk)-lib was given. if test "${with_osimsk_lib+set}" = set; then withval="$with_osimsk_lib" if test "$withval" = no ; then coin_has_osimsk=skipping else coin_has_osimsk=yes OSIMSK_LIBS="$withval" OSIMSK_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIMSK_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osimsk != skipping; then # Check whether --with-m4_tolower(OsiMsk)-incdir or --without-m4_tolower(OsiMsk)-incdir was given. if test "${with_osimsk_incdir+set}" = set; then withval="$with_osimsk_incdir" if test "$withval" = no ; then coin_has_osimsk=skipping else coin_has_osimsk=yes OSIMSK_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIMSK_CFLAGS_INSTALLED="$OSIMSK_CFLAGS" fi fi fi; fi if test $coin_has_osimsk != skipping; then # Check whether --with-m4_tolower(OsiMsk)-datadir or --without-m4_tolower(OsiMsk)-datadir was given. if test "${with_osimsk_datadir+set}" = set; then withval="$with_osimsk_datadir" if test "$withval" = no ; then coin_has_osimsk=skipping else coin_has_osimsk=yes OSIMSK_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIMSK_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osimsk = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-mosek"; then OSIMSK_VERSIONS=`$PKG_CONFIG --modversion "osi-mosek" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-mosek" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIMSK_CFLAGS="$cflags" OSIMSK_LIBS=`$PKG_CONFIG --libs "osi-mosek" 2>/dev/null` OSIMSK_DATA=`$PKG_CONFIG --variable=datadir "osi-mosek" 2>/dev/null` coin_has_osimsk=yes echo "$as_me:$LINENO: result: yes: $OSIMSK_VERSIONS" >&5 echo "${ECHO_T}yes: $OSIMSK_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIMSK_LIBS=`echo " $OSIMSK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSIMSK_PCREQUIRES="osi-mosek" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else OSIMSK_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-mosek"` coin_has_osimsk=notGiven echo "$as_me:$LINENO: result: not given: $OSIMSK_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSIMSK_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiMsk without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiMsk without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiMsk (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiMsk (fallback)... $ECHO_C" >&6 coin_has_osimsk=notGiven OSIMSK_LIBS= OSIMSK_LIBS_INSTALLED= OSIMSK_CFLAGS= OSIMSK_CFLAGS_INSTALLED= OSIMSK_DATA= OSIMSK_DATA_INSTALLED= OSIMSK_PCLIBS= OSIMSK_PCREQUIRES= # initial list of dependencies is "osi-mosek", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-mosek" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSIMSK_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSIMSK_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSIMSK_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSIMSK_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIMSK_CFLAGS="$projcflags $OSIMSK_CFLAGS" # set LIBS variable OSIMSK_LIBS="$projlibs $OSIMSK_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIMSK_CFLAGS_INSTALLED="$projcflags $OSIMSK_CFLAGS_INSTALLED" # set LIBS variable OSIMSK_LIBS_INSTALLED="$projlibs $OSIMSK_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osimsk=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIMSK 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIMSK_LIBS=`echo " $OSIMSK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSIMSK_LIBS_INSTALLED=`echo " $OSIMSK_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSIMSK_PCREQUIRES="osi-mosek" fi if test $coin_has_osimsk != notGiven && test $coin_has_osimsk != skipping; then COIN_HAS_OSIMSK_TRUE= COIN_HAS_OSIMSK_FALSE='#' else COIN_HAS_OSIMSK_TRUE='#' COIN_HAS_OSIMSK_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osimsk" >&5 echo "${ECHO_T}$coin_has_osimsk" >&6 fi if test $coin_has_osimsk != skipping && test $coin_has_osimsk != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIMSK 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSIMSK_DEPENDENCIES=`echo " $OSIMSK_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSIMSK_CFLAGS" ; then { echo "$as_me:$LINENO: OsiMsk CFLAGS are $OSIMSK_CFLAGS" >&5 echo "$as_me: OsiMsk CFLAGS are $OSIMSK_CFLAGS" >&6;} fi if test -n "$OSIMSK_LIBS" ; then { echo "$as_me:$LINENO: OsiMsk LIBS are $OSIMSK_LIBS" >&5 echo "$as_me: OsiMsk LIBS are $OSIMSK_LIBS" >&6;} fi if test -n "$OSIMSK_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiMsk DEPENDENCIES are $OSIMSK_DEPENDENCIES" >&5 echo "$as_me: OsiMsk DEPENDENCIES are $OSIMSK_DEPENDENCIES" >&6;} fi if test -n "$OSIMSK_DATA" ; then { echo "$as_me:$LINENO: OsiMsk DATA is $OSIMSK_DATA" >&5 echo "$as_me: OsiMsk DATA is $OSIMSK_DATA" >&6;} fi if test -n "$OSIMSK_PCLIBS" ; then { echo "$as_me:$LINENO: OsiMsk PCLIBS are $OSIMSK_PCLIBS" >&5 echo "$as_me: OsiMsk PCLIBS are $OSIMSK_PCLIBS" >&6;} fi if test -n "$OSIMSK_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiMsk PCREQUIRES are $OSIMSK_PCREQUIRES" >&5 echo "$as_me: OsiMsk PCREQUIRES are $OSIMSK_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_osimsk != notGiven && test $coin_has_osimsk != skipping; then COIN_HAS_OSIMSK_TRUE= COIN_HAS_OSIMSK_FALSE='#' else COIN_HAS_OSIMSK_TRUE='#' COIN_HAS_OSIMSK_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package OsiXpr" >&5 echo $ECHO_N "checking for COIN-OR package OsiXpr... $ECHO_C" >&6 coin_has_osixpr=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiXpr"; then coin_has_osixpr=skipping fi done fi if test "$coin_has_osixpr" != skipping; then # Check whether --with-m4_tolower(OsiXpr) or --without-m4_tolower(OsiXpr) was given. if test "${with_osixpr+set}" = set; then withval="$with_osixpr" if test "$withval" = no ; then coin_has_osixpr=skipping fi fi; fi OSIXPR_LIBS= OSIXPR_CFLAGS= OSIXPR_DATA= OSIXPR_DEPENDENCIES= OSIXPR_PCLIBS= OSIXPR_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osixpr != skipping; then # Check whether --with-m4_tolower(OsiXpr)-lib or --without-m4_tolower(OsiXpr)-lib was given. if test "${with_osixpr_lib+set}" = set; then withval="$with_osixpr_lib" if test "$withval" = no ; then coin_has_osixpr=skipping else coin_has_osixpr=yes OSIXPR_LIBS="$withval" OSIXPR_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIXPR_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osixpr != skipping; then # Check whether --with-m4_tolower(OsiXpr)-incdir or --without-m4_tolower(OsiXpr)-incdir was given. if test "${with_osixpr_incdir+set}" = set; then withval="$with_osixpr_incdir" if test "$withval" = no ; then coin_has_osixpr=skipping else coin_has_osixpr=yes OSIXPR_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIXPR_CFLAGS_INSTALLED="$OSIXPR_CFLAGS" fi fi fi; fi if test $coin_has_osixpr != skipping; then # Check whether --with-m4_tolower(OsiXpr)-datadir or --without-m4_tolower(OsiXpr)-datadir was given. if test "${with_osixpr_datadir+set}" = set; then withval="$with_osixpr_datadir" if test "$withval" = no ; then coin_has_osixpr=skipping else coin_has_osixpr=yes OSIXPR_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIXPR_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osixpr = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-xpress"; then OSIXPR_VERSIONS=`$PKG_CONFIG --modversion "osi-xpress" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-xpress" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIXPR_CFLAGS="$cflags" OSIXPR_LIBS=`$PKG_CONFIG --libs "osi-xpress" 2>/dev/null` OSIXPR_DATA=`$PKG_CONFIG --variable=datadir "osi-xpress" 2>/dev/null` coin_has_osixpr=yes echo "$as_me:$LINENO: result: yes: $OSIXPR_VERSIONS" >&5 echo "${ECHO_T}yes: $OSIXPR_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIXPR_LIBS=`echo " $OSIXPR_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSIXPR_PCREQUIRES="osi-xpress" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else OSIXPR_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-xpress"` coin_has_osixpr=notGiven echo "$as_me:$LINENO: result: not given: $OSIXPR_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSIXPR_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiXpr without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiXpr without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiXpr (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiXpr (fallback)... $ECHO_C" >&6 coin_has_osixpr=notGiven OSIXPR_LIBS= OSIXPR_LIBS_INSTALLED= OSIXPR_CFLAGS= OSIXPR_CFLAGS_INSTALLED= OSIXPR_DATA= OSIXPR_DATA_INSTALLED= OSIXPR_PCLIBS= OSIXPR_PCREQUIRES= # initial list of dependencies is "osi-xpress", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-xpress" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSIXPR_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSIXPR_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSIXPR_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSIXPR_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIXPR_CFLAGS="$projcflags $OSIXPR_CFLAGS" # set LIBS variable OSIXPR_LIBS="$projlibs $OSIXPR_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIXPR_CFLAGS_INSTALLED="$projcflags $OSIXPR_CFLAGS_INSTALLED" # set LIBS variable OSIXPR_LIBS_INSTALLED="$projlibs $OSIXPR_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osixpr=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIXPR 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIXPR_LIBS=`echo " $OSIXPR_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSIXPR_LIBS_INSTALLED=`echo " $OSIXPR_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSIXPR_PCREQUIRES="osi-xpress" fi if test $coin_has_osixpr != notGiven && test $coin_has_osixpr != skipping; then COIN_HAS_OSIXPR_TRUE= COIN_HAS_OSIXPR_FALSE='#' else COIN_HAS_OSIXPR_TRUE='#' COIN_HAS_OSIXPR_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osixpr" >&5 echo "${ECHO_T}$coin_has_osixpr" >&6 fi if test $coin_has_osixpr != skipping && test $coin_has_osixpr != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIXPR 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSIXPR_DEPENDENCIES=`echo " $OSIXPR_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSIXPR_CFLAGS" ; then { echo "$as_me:$LINENO: OsiXpr CFLAGS are $OSIXPR_CFLAGS" >&5 echo "$as_me: OsiXpr CFLAGS are $OSIXPR_CFLAGS" >&6;} fi if test -n "$OSIXPR_LIBS" ; then { echo "$as_me:$LINENO: OsiXpr LIBS are $OSIXPR_LIBS" >&5 echo "$as_me: OsiXpr LIBS are $OSIXPR_LIBS" >&6;} fi if test -n "$OSIXPR_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiXpr DEPENDENCIES are $OSIXPR_DEPENDENCIES" >&5 echo "$as_me: OsiXpr DEPENDENCIES are $OSIXPR_DEPENDENCIES" >&6;} fi if test -n "$OSIXPR_DATA" ; then { echo "$as_me:$LINENO: OsiXpr DATA is $OSIXPR_DATA" >&5 echo "$as_me: OsiXpr DATA is $OSIXPR_DATA" >&6;} fi if test -n "$OSIXPR_PCLIBS" ; then { echo "$as_me:$LINENO: OsiXpr PCLIBS are $OSIXPR_PCLIBS" >&5 echo "$as_me: OsiXpr PCLIBS are $OSIXPR_PCLIBS" >&6;} fi if test -n "$OSIXPR_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiXpr PCREQUIRES are $OSIXPR_PCREQUIRES" >&5 echo "$as_me: OsiXpr PCREQUIRES are $OSIXPR_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_osixpr != notGiven && test $coin_has_osixpr != skipping; then COIN_HAS_OSIXPR_TRUE= COIN_HAS_OSIXPR_FALSE='#' else COIN_HAS_OSIXPR_TRUE='#' COIN_HAS_OSIXPR_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package OsiVol" >&5 echo $ECHO_N "checking for COIN-OR package OsiVol... $ECHO_C" >&6 coin_has_osivol=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiVol"; then coin_has_osivol=skipping fi done fi if test "$coin_has_osivol" != skipping; then # Check whether --with-m4_tolower(OsiVol) or --without-m4_tolower(OsiVol) was given. if test "${with_osivol+set}" = set; then withval="$with_osivol" if test "$withval" = no ; then coin_has_osivol=skipping fi fi; fi OSIVOL_LIBS= OSIVOL_CFLAGS= OSIVOL_DATA= OSIVOL_DEPENDENCIES= OSIVOL_PCLIBS= OSIVOL_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osivol != skipping; then # Check whether --with-m4_tolower(OsiVol)-lib or --without-m4_tolower(OsiVol)-lib was given. if test "${with_osivol_lib+set}" = set; then withval="$with_osivol_lib" if test "$withval" = no ; then coin_has_osivol=skipping else coin_has_osivol=yes OSIVOL_LIBS="$withval" OSIVOL_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIVOL_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osivol != skipping; then # Check whether --with-m4_tolower(OsiVol)-incdir or --without-m4_tolower(OsiVol)-incdir was given. if test "${with_osivol_incdir+set}" = set; then withval="$with_osivol_incdir" if test "$withval" = no ; then coin_has_osivol=skipping else coin_has_osivol=yes OSIVOL_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIVOL_CFLAGS_INSTALLED="$OSIVOL_CFLAGS" fi fi fi; fi if test $coin_has_osivol != skipping; then # Check whether --with-m4_tolower(OsiVol)-datadir or --without-m4_tolower(OsiVol)-datadir was given. if test "${with_osivol_datadir+set}" = set; then withval="$with_osivol_datadir" if test "$withval" = no ; then coin_has_osivol=skipping else coin_has_osivol=yes OSIVOL_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIVOL_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osivol = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-vol"; then OSIVOL_VERSIONS=`$PKG_CONFIG --modversion "osi-vol" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-vol" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIVOL_CFLAGS="$cflags" OSIVOL_LIBS=`$PKG_CONFIG --libs "osi-vol" 2>/dev/null` OSIVOL_DATA=`$PKG_CONFIG --variable=datadir "osi-vol" 2>/dev/null` coin_has_osivol=yes echo "$as_me:$LINENO: result: yes: $OSIVOL_VERSIONS" >&5 echo "${ECHO_T}yes: $OSIVOL_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIVOL_LIBS=`echo " $OSIVOL_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSIVOL_PCREQUIRES="osi-vol" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else OSIVOL_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-vol"` coin_has_osivol=notGiven echo "$as_me:$LINENO: result: not given: $OSIVOL_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSIVOL_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiVol without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiVol without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiVol (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiVol (fallback)... $ECHO_C" >&6 coin_has_osivol=notGiven OSIVOL_LIBS= OSIVOL_LIBS_INSTALLED= OSIVOL_CFLAGS= OSIVOL_CFLAGS_INSTALLED= OSIVOL_DATA= OSIVOL_DATA_INSTALLED= OSIVOL_PCLIBS= OSIVOL_PCREQUIRES= # initial list of dependencies is "osi-vol", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-vol" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSIVOL_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSIVOL_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSIVOL_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSIVOL_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIVOL_CFLAGS="$projcflags $OSIVOL_CFLAGS" # set LIBS variable OSIVOL_LIBS="$projlibs $OSIVOL_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIVOL_CFLAGS_INSTALLED="$projcflags $OSIVOL_CFLAGS_INSTALLED" # set LIBS variable OSIVOL_LIBS_INSTALLED="$projlibs $OSIVOL_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osivol=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIVOL 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIVOL_LIBS=`echo " $OSIVOL_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSIVOL_LIBS_INSTALLED=`echo " $OSIVOL_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSIVOL_PCREQUIRES="osi-vol" fi if test $coin_has_osivol != notGiven && test $coin_has_osivol != skipping; then COIN_HAS_OSIVOL_TRUE= COIN_HAS_OSIVOL_FALSE='#' else COIN_HAS_OSIVOL_TRUE='#' COIN_HAS_OSIVOL_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osivol" >&5 echo "${ECHO_T}$coin_has_osivol" >&6 fi if test $coin_has_osivol != skipping && test $coin_has_osivol != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIVOL 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSIVOL_DEPENDENCIES=`echo " $OSIVOL_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSIVOL_CFLAGS" ; then { echo "$as_me:$LINENO: OsiVol CFLAGS are $OSIVOL_CFLAGS" >&5 echo "$as_me: OsiVol CFLAGS are $OSIVOL_CFLAGS" >&6;} fi if test -n "$OSIVOL_LIBS" ; then { echo "$as_me:$LINENO: OsiVol LIBS are $OSIVOL_LIBS" >&5 echo "$as_me: OsiVol LIBS are $OSIVOL_LIBS" >&6;} fi if test -n "$OSIVOL_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiVol DEPENDENCIES are $OSIVOL_DEPENDENCIES" >&5 echo "$as_me: OsiVol DEPENDENCIES are $OSIVOL_DEPENDENCIES" >&6;} fi if test -n "$OSIVOL_DATA" ; then { echo "$as_me:$LINENO: OsiVol DATA is $OSIVOL_DATA" >&5 echo "$as_me: OsiVol DATA is $OSIVOL_DATA" >&6;} fi if test -n "$OSIVOL_PCLIBS" ; then { echo "$as_me:$LINENO: OsiVol PCLIBS are $OSIVOL_PCLIBS" >&5 echo "$as_me: OsiVol PCLIBS are $OSIVOL_PCLIBS" >&6;} fi if test -n "$OSIVOL_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiVol PCREQUIRES are $OSIVOL_PCREQUIRES" >&5 echo "$as_me: OsiVol PCREQUIRES are $OSIVOL_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_osivol != notGiven && test $coin_has_osivol != skipping; then COIN_HAS_OSIVOL_TRUE= COIN_HAS_OSIVOL_FALSE='#' else COIN_HAS_OSIVOL_TRUE='#' COIN_HAS_OSIVOL_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package OsiDyLP" >&5 echo $ECHO_N "checking for COIN-OR package OsiDyLP... $ECHO_C" >&6 coin_has_osidylp=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiDyLP"; then coin_has_osidylp=skipping fi done fi if test "$coin_has_osidylp" != skipping; then # Check whether --with-m4_tolower(OsiDyLP) or --without-m4_tolower(OsiDyLP) was given. if test "${with_osidylp+set}" = set; then withval="$with_osidylp" if test "$withval" = no ; then coin_has_osidylp=skipping fi fi; fi OSIDYLP_LIBS= OSIDYLP_CFLAGS= OSIDYLP_DATA= OSIDYLP_DEPENDENCIES= OSIDYLP_PCLIBS= OSIDYLP_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osidylp != skipping; then # Check whether --with-m4_tolower(OsiDyLP)-lib or --without-m4_tolower(OsiDyLP)-lib was given. if test "${with_osidylp_lib+set}" = set; then withval="$with_osidylp_lib" if test "$withval" = no ; then coin_has_osidylp=skipping else coin_has_osidylp=yes OSIDYLP_LIBS="$withval" OSIDYLP_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIDYLP_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osidylp != skipping; then # Check whether --with-m4_tolower(OsiDyLP)-incdir or --without-m4_tolower(OsiDyLP)-incdir was given. if test "${with_osidylp_incdir+set}" = set; then withval="$with_osidylp_incdir" if test "$withval" = no ; then coin_has_osidylp=skipping else coin_has_osidylp=yes OSIDYLP_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIDYLP_CFLAGS_INSTALLED="$OSIDYLP_CFLAGS" fi fi fi; fi if test $coin_has_osidylp != skipping; then # Check whether --with-m4_tolower(OsiDyLP)-datadir or --without-m4_tolower(OsiDyLP)-datadir was given. if test "${with_osidylp_datadir+set}" = set; then withval="$with_osidylp_datadir" if test "$withval" = no ; then coin_has_osidylp=skipping else coin_has_osidylp=yes OSIDYLP_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSIDYLP_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osidylp = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-dylp"; then OSIDYLP_VERSIONS=`$PKG_CONFIG --modversion "osi-dylp" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-dylp" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIDYLP_CFLAGS="$cflags" OSIDYLP_LIBS=`$PKG_CONFIG --libs "osi-dylp" 2>/dev/null` OSIDYLP_DATA=`$PKG_CONFIG --variable=datadir "osi-dylp" 2>/dev/null` coin_has_osidylp=yes echo "$as_me:$LINENO: result: yes: $OSIDYLP_VERSIONS" >&5 echo "${ECHO_T}yes: $OSIDYLP_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIDYLP_LIBS=`echo " $OSIDYLP_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSIDYLP_PCREQUIRES="osi-dylp" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else OSIDYLP_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-dylp"` coin_has_osidylp=notGiven echo "$as_me:$LINENO: result: not given: $OSIDYLP_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSIDYLP_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiDyLP without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiDyLP without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiDyLP (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiDyLP (fallback)... $ECHO_C" >&6 coin_has_osidylp=notGiven OSIDYLP_LIBS= OSIDYLP_LIBS_INSTALLED= OSIDYLP_CFLAGS= OSIDYLP_CFLAGS_INSTALLED= OSIDYLP_DATA= OSIDYLP_DATA_INSTALLED= OSIDYLP_PCLIBS= OSIDYLP_PCREQUIRES= # initial list of dependencies is "osi-dylp", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-dylp" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSIDYLP_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSIDYLP_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSIDYLP_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSIDYLP_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIDYLP_CFLAGS="$projcflags $OSIDYLP_CFLAGS" # set LIBS variable OSIDYLP_LIBS="$projlibs $OSIDYLP_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSIDYLP_CFLAGS_INSTALLED="$projcflags $OSIDYLP_CFLAGS_INSTALLED" # set LIBS variable OSIDYLP_LIBS_INSTALLED="$projlibs $OSIDYLP_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osidylp=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIDYLP 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSIDYLP_LIBS=`echo " $OSIDYLP_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSIDYLP_LIBS_INSTALLED=`echo " $OSIDYLP_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSIDYLP_PCREQUIRES="osi-dylp" fi if test $coin_has_osidylp != notGiven && test $coin_has_osidylp != skipping; then COIN_HAS_OSIDYLP_TRUE= COIN_HAS_OSIDYLP_FALSE='#' else COIN_HAS_OSIDYLP_TRUE='#' COIN_HAS_OSIDYLP_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osidylp" >&5 echo "${ECHO_T}$coin_has_osidylp" >&6 fi if test $coin_has_osidylp != skipping && test $coin_has_osidylp != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSIDYLP 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSIDYLP_DEPENDENCIES=`echo " $OSIDYLP_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSIDYLP_CFLAGS" ; then { echo "$as_me:$LINENO: OsiDyLP CFLAGS are $OSIDYLP_CFLAGS" >&5 echo "$as_me: OsiDyLP CFLAGS are $OSIDYLP_CFLAGS" >&6;} fi if test -n "$OSIDYLP_LIBS" ; then { echo "$as_me:$LINENO: OsiDyLP LIBS are $OSIDYLP_LIBS" >&5 echo "$as_me: OsiDyLP LIBS are $OSIDYLP_LIBS" >&6;} fi if test -n "$OSIDYLP_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiDyLP DEPENDENCIES are $OSIDYLP_DEPENDENCIES" >&5 echo "$as_me: OsiDyLP DEPENDENCIES are $OSIDYLP_DEPENDENCIES" >&6;} fi if test -n "$OSIDYLP_DATA" ; then { echo "$as_me:$LINENO: OsiDyLP DATA is $OSIDYLP_DATA" >&5 echo "$as_me: OsiDyLP DATA is $OSIDYLP_DATA" >&6;} fi if test -n "$OSIDYLP_PCLIBS" ; then { echo "$as_me:$LINENO: OsiDyLP PCLIBS are $OSIDYLP_PCLIBS" >&5 echo "$as_me: OsiDyLP PCLIBS are $OSIDYLP_PCLIBS" >&6;} fi if test -n "$OSIDYLP_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiDyLP PCREQUIRES are $OSIDYLP_PCREQUIRES" >&5 echo "$as_me: OsiDyLP PCREQUIRES are $OSIDYLP_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_osidylp != notGiven && test $coin_has_osidylp != skipping; then COIN_HAS_OSIDYLP_TRUE= COIN_HAS_OSIDYLP_FALSE='#' else COIN_HAS_OSIDYLP_TRUE='#' COIN_HAS_OSIDYLP_FALSE= fi #AC_COIN_CHECK_PACKAGE(OsiSpx, [osi-soplex]) ############################################################################# # System header # ############################################################################# ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cmath],[],[],[$hdr]) for ac_header in cmath do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to cgl@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cmath" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([math.h],[],[],[$hdr]) for ac_header in math.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to cgl@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cfloat],[],[],[$hdr]) for ac_header in cfloat do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to cgl@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cfloat" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([float.h],[],[],[$hdr]) for ac_header in float.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to cgl@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cieeefp],[],[],[$hdr]) for ac_header in cieeefp do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to cgl@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cieeefp" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([ieeefp.h],[],[],[$hdr]) for ac_header in ieeefp.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to cgl@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ############################################################################# # Determine list of all Cgl subprojects # ############################################################################# # In order to avoid that one has to update this configure.ac and the # Makefile.am whenever a new cut generator is added, we automatically determine # the list of all subdirectories of src with a Makefile.in (CGL_SUBDIRS), # and also a list of all sublibraries relative to src (CGL_SUBLIBS) that # can be used in the src/Makefile.am. (It is still necessary to manually # add an entry to write the Makefile in the AC_CONFIG_FILES list below.) curr_dir=`pwd` cd $srcdir/src for file in `ls */Makefile.in`; do newdir=`echo $file | sed -e s%/Makefile.in%% | sed -e s%^./%% ` CGL_SUBDIRS="$CGL_SUBDIRS $newdir" CGL_SUBLIBS="$CGL_SUBLIBS $newdir/lib${newdir}.la" done cd $curr_dir ############################################################################# # Check for doxygen # ############################################################################# { echo "$as_me:$LINENO: configuring doxygen documentation options" >&5 echo "$as_me: configuring doxygen documentation options" >&6;} # Check to see if doxygen is available. # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_doxygen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_doxygen"; then ac_cv_prog_coin_have_doxygen="$coin_have_doxygen" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_doxygen="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_doxygen" && ac_cv_prog_coin_have_doxygen="no" fi fi coin_have_doxygen=$ac_cv_prog_coin_have_doxygen if test -n "$coin_have_doxygen"; then echo "$as_me:$LINENO: result: $coin_have_doxygen" >&5 echo "${ECHO_T}$coin_have_doxygen" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_latex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_latex"; then ac_cv_prog_coin_have_latex="$coin_have_latex" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_latex="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_latex" && ac_cv_prog_coin_have_latex="no" fi fi coin_have_latex=$ac_cv_prog_coin_have_latex if test -n "$coin_have_latex"; then echo "$as_me:$LINENO: result: $coin_have_latex" >&5 echo "${ECHO_T}$coin_have_latex" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Look for the dot tool from the graphviz package, unless the user has # disabled it. # Check whether --with-dot or --without-dot was given. if test "${with_dot+set}" = set; then withval="$with_dot" else withval=yes fi; if test x"$withval" = xno ; then coin_doxy_usedot=NO echo "$as_me:$LINENO: checking for dot " >&5 echo $ECHO_N "checking for dot ... $ECHO_C" >&6 echo "$as_me:$LINENO: result: disabled" >&5 echo "${ECHO_T}disabled" >&6 else # Extract the first word of "dot", so it can be a program name with args. set dummy dot; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_doxy_usedot+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_doxy_usedot"; then ac_cv_prog_coin_doxy_usedot="$coin_doxy_usedot" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_doxy_usedot="YES" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_doxy_usedot" && ac_cv_prog_coin_doxy_usedot="NO" fi fi coin_doxy_usedot=$ac_cv_prog_coin_doxy_usedot if test -n "$coin_doxy_usedot"; then echo "$as_me:$LINENO: result: $coin_doxy_usedot" >&5 echo "${ECHO_T}$coin_doxy_usedot" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi # Generate a tag file name and a log file name coin_doxy_tagname=doxydoc/${PACKAGE}_doxy.tag coin_doxy_logname=doxydoc/${PACKAGE}_doxy.log if test $coin_have_doxygen = yes; then COIN_HAS_DOXYGEN_TRUE= COIN_HAS_DOXYGEN_FALSE='#' else COIN_HAS_DOXYGEN_TRUE='#' COIN_HAS_DOXYGEN_FALSE= fi if test $coin_have_latex = yes; then COIN_HAS_LATEX_TRUE= COIN_HAS_LATEX_FALSE='#' else COIN_HAS_LATEX_TRUE='#' COIN_HAS_LATEX_FALSE= fi # Process the list of project names and massage them into possible doxygen # doc'n directories. Prefer 1) classic external, source processed using # a project-specific doxygen.conf, we use the tag file; 2) classic # external, source processed using package doxygen.conf; 3) installed # doxydoc. Alternatives 1) and 2) are only possible if the directory will be # configured, which we can't know unless this is the package base configure, # since coin_subdirs is only set there. Hence it's sufficient to check for # membership. If we use a tag file from a classic external, exclude the # source from doxygen processing when doxygen runs in the base directory. coin_doxy_tagfiles= coin_doxy_excludes= tmp="CoinUtils" for proj in $tmp ; do lc_proj=`echo $proj | tr [A-Z] [a-z]` echo "$as_me:$LINENO: checking for doxygen doc'n for $proj " >&5 echo $ECHO_N "checking for doxygen doc'n for $proj ... $ECHO_C" >&6 doxytag=${lc_proj}_doxy.tag doxyfound=no # proj will be configured, hence doxydoc present in build tree doxysrcdir="${srcdir}/../${proj}" # AC_MSG_NOTICE([Considering $doxysrcdir (base)]) if test -d "$doxysrcdir" ; then # with a doxydoc directory? doxydir="$doxysrcdir/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (base)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) if test -d "$doxydir" ; then # use tag file; don't process source doxydir="../${proj}/doxydoc" coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=../../$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 coin_doxy_excludes="$coin_doxy_excludes */${proj}" else # will process the source -- nothing further to be done here echo "$as_me:$LINENO: result: $doxysrcdir (src)" >&5 echo "${ECHO_T}$doxysrcdir (src)" >&6 fi doxyfound=yes fi # Not built, fall back to installed tag file if test $doxyfound = no ; then eval doxydir="${datadir}/coin/doc/${proj}/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (install)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 fi done ############################################################################## # Finishing up by writing all the output # ############################################################################## # Install files for unitTest echo "$as_me:$LINENO: checking whether this is a VPATH configuration" >&5 echo $ECHO_N "checking whether this is a VPATH configuration... $ECHO_C" >&6 if test `cd $srcdir; pwd` != `pwd`; then coin_vpath_config=yes; else coin_vpath_config=no; fi echo "$as_me:$LINENO: result: $coin_vpath_config" >&5 echo "${ECHO_T}$coin_vpath_config" >&6 # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="test/CglTestData/capPlan1.mps test/CglTestData/l152lav.mps test/CglTestData/egout.mps test/CglTestData/lseu.mps" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi # Here list all the files that configure should create (except for the # configuration header file) ac_config_files="$ac_config_files Makefile examples/Makefile src/Makefile src/CglAllDifferent/Makefile src/CglClique/Makefile src/CglDuplicateRow/Makefile src/CglFlowCover/Makefile src/CglGMI/Makefile src/CglGomory/Makefile src/CglKnapsackCover/Makefile src/CglLandP/Makefile src/CglLiftAndProject/Makefile src/CglMixedIntegerRounding/Makefile src/CglMixedIntegerRounding2/Makefile src/CglOddHole/Makefile src/CglPreProcess/Makefile src/CglProbing/Makefile src/CglRedSplit/Makefile src/CglRedSplit2/Makefile src/CglResidualCapacity/Makefile src/CglSimpleRounding/Makefile src/CglTwomir/Makefile src/CglZeroHalf/Makefile test/Makefile cgl.pc cgl-uninstalled.pc" ac_config_files="$ac_config_files doxydoc/doxygen.conf" # Here put the location and name of the configuration header file ac_config_headers="$ac_config_headers src/config.h src/config_cgl.h" # Finally, we let configure write all the output... echo "$as_me:$LINENO: checking which command should be used to link input files" >&5 echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac echo "$as_me:$LINENO: result: $coin_link_input_cmd" >&5 echo "${ECHO_T}$coin_link_input_cmd" >&6 if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${ALWAYS_FALSE_TRUE}" && test -z "${ALWAYS_FALSE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CC_IS_CL_TRUE}" && test -z "${COIN_CC_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CXX_IS_CL_TRUE}" && test -z "${COIN_CXX_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_EXTERNALS_TRUE}" && test -z "${HAVE_EXTERNALS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${DEPENDENCY_LINKING_TRUE}" && test -z "${DEPENDENCY_LINKING_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_PKGCONFIG_TRUE}" && test -z "${COIN_HAS_PKGCONFIG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_COINUTILS_TRUE}" && test -z "${COIN_HAS_COINUTILS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_COINUTILS_TRUE}" && test -z "${COIN_HAS_COINUTILS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSI_TRUE}" && test -z "${COIN_HAS_OSI_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSI\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSI\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSI_TRUE}" && test -z "${COIN_HAS_OSI_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSI\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSI\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSICLP_TRUE}" && test -z "${COIN_HAS_OSICLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSICLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSICLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSICLP_TRUE}" && test -z "${COIN_HAS_OSICLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSICLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSICLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSICPX_TRUE}" && test -z "${COIN_HAS_OSICPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSICPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSICPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSICPX_TRUE}" && test -z "${COIN_HAS_OSICPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSICPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSICPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIGLPK_TRUE}" && test -z "${COIN_HAS_OSIGLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIGLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIGLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIGLPK_TRUE}" && test -z "${COIN_HAS_OSIGLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIGLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIGLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIMSK_TRUE}" && test -z "${COIN_HAS_OSIMSK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIMSK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIMSK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIMSK_TRUE}" && test -z "${COIN_HAS_OSIMSK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIMSK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIMSK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIXPR_TRUE}" && test -z "${COIN_HAS_OSIXPR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIXPR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIXPR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIXPR_TRUE}" && test -z "${COIN_HAS_OSIXPR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIXPR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIXPR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIVOL_TRUE}" && test -z "${COIN_HAS_OSIVOL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIVOL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIVOL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIVOL_TRUE}" && test -z "${COIN_HAS_OSIVOL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIVOL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIVOL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIDYLP_TRUE}" && test -z "${COIN_HAS_OSIDYLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIDYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIDYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSIDYLP_TRUE}" && test -z "${COIN_HAS_OSIDYLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSIDYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSIDYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_DOXYGEN_TRUE}" && test -z "${COIN_HAS_DOXYGEN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LATEX_TRUE}" && test -z "${COIN_HAS_LATEX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by Cgl $as_me 0.59.7, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Cgl config.status 0.59.7 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/CglAllDifferent/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglAllDifferent/Makefile" ;; "src/CglClique/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglClique/Makefile" ;; "src/CglDuplicateRow/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglDuplicateRow/Makefile" ;; "src/CglFlowCover/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglFlowCover/Makefile" ;; "src/CglGMI/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglGMI/Makefile" ;; "src/CglGomory/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglGomory/Makefile" ;; "src/CglKnapsackCover/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglKnapsackCover/Makefile" ;; "src/CglLandP/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglLandP/Makefile" ;; "src/CglLiftAndProject/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglLiftAndProject/Makefile" ;; "src/CglMixedIntegerRounding/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglMixedIntegerRounding/Makefile" ;; "src/CglMixedIntegerRounding2/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglMixedIntegerRounding2/Makefile" ;; "src/CglOddHole/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglOddHole/Makefile" ;; "src/CglPreProcess/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglPreProcess/Makefile" ;; "src/CglProbing/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglProbing/Makefile" ;; "src/CglRedSplit/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglRedSplit/Makefile" ;; "src/CglRedSplit2/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglRedSplit2/Makefile" ;; "src/CglResidualCapacity/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglResidualCapacity/Makefile" ;; "src/CglSimpleRounding/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglSimpleRounding/Makefile" ;; "src/CglTwomir/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglTwomir/Makefile" ;; "src/CglZeroHalf/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/CglZeroHalf/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "cgl.pc" ) CONFIG_FILES="$CONFIG_FILES cgl.pc" ;; "cgl-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES cgl-uninstalled.pc" ;; "doxydoc/doxygen.conf" ) CONFIG_FILES="$CONFIG_FILES doxydoc/doxygen.conf" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "src/config_cgl.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config_cgl.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@ALWAYS_FALSE_TRUE@,$ALWAYS_FALSE_TRUE,;t t s,@ALWAYS_FALSE_FALSE@,$ALWAYS_FALSE_FALSE,;t t s,@have_svnversion@,$have_svnversion,;t t s,@CGL_SVN_REV@,$CGL_SVN_REV,;t t s,@CDEFS@,$CDEFS,;t t s,@ADD_CFLAGS@,$ADD_CFLAGS,;t t s,@DBG_CFLAGS@,$DBG_CFLAGS,;t t s,@OPT_CFLAGS@,$OPT_CFLAGS,;t t s,@sol_cc_compiler@,$sol_cc_compiler,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@COIN_CC_IS_CL_TRUE@,$COIN_CC_IS_CL_TRUE,;t t s,@COIN_CC_IS_CL_FALSE@,$COIN_CC_IS_CL_FALSE,;t t s,@MPICC@,$MPICC,;t t s,@CXXDEFS@,$CXXDEFS,;t t s,@ADD_CXXFLAGS@,$ADD_CXXFLAGS,;t t s,@DBG_CXXFLAGS@,$DBG_CXXFLAGS,;t t s,@OPT_CXXFLAGS@,$OPT_CXXFLAGS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@COIN_CXX_IS_CL_TRUE@,$COIN_CXX_IS_CL_TRUE,;t t s,@COIN_CXX_IS_CL_FALSE@,$COIN_CXX_IS_CL_FALSE,;t t s,@MPICXX@,$MPICXX,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBTOOLM4@,$LIBTOOLM4,;t t s,@have_autoconf@,$have_autoconf,;t t s,@have_automake@,$have_automake,;t t s,@have_svn@,$have_svn,;t t s,@BUILDTOOLSDIR@,$BUILDTOOLSDIR,;t t s,@AUX_DIR@,$AUX_DIR,;t t s,@abs_source_dir@,$abs_source_dir,;t t s,@abs_lib_dir@,$abs_lib_dir,;t t s,@abs_include_dir@,$abs_include_dir,;t t s,@abs_bin_dir@,$abs_bin_dir,;t t s,@HAVE_EXTERNALS_TRUE@,$HAVE_EXTERNALS_TRUE,;t t s,@HAVE_EXTERNALS_FALSE@,$HAVE_EXTERNALS_FALSE,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@CXXCPP@,$CXXCPP,;t t s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@ac_c_preproc_warn_flag@,$ac_c_preproc_warn_flag,;t t s,@ac_cxx_preproc_warn_flag@,$ac_cxx_preproc_warn_flag,;t t s,@RPATH_FLAGS@,$RPATH_FLAGS,;t t s,@DEPENDENCY_LINKING_TRUE@,$DEPENDENCY_LINKING_TRUE,;t t s,@DEPENDENCY_LINKING_FALSE@,$DEPENDENCY_LINKING_FALSE,;t t s,@LT_LDFLAGS@,$LT_LDFLAGS,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@ac_ct_PKG_CONFIG@,$ac_ct_PKG_CONFIG,;t t s,@COIN_HAS_PKGCONFIG_TRUE@,$COIN_HAS_PKGCONFIG_TRUE,;t t s,@COIN_HAS_PKGCONFIG_FALSE@,$COIN_HAS_PKGCONFIG_FALSE,;t t s,@COIN_PKG_CONFIG_PATH@,$COIN_PKG_CONFIG_PATH,;t t s,@COIN_PKG_CONFIG_PATH_UNINSTALLED@,$COIN_PKG_CONFIG_PATH_UNINSTALLED,;t t s,@COINUTILS_LIBS@,$COINUTILS_LIBS,;t t s,@COINUTILS_CFLAGS@,$COINUTILS_CFLAGS,;t t s,@COINUTILS_DATA@,$COINUTILS_DATA,;t t s,@COINUTILS_DEPENDENCIES@,$COINUTILS_DEPENDENCIES,;t t s,@COINUTILS_LIBS_INSTALLED@,$COINUTILS_LIBS_INSTALLED,;t t s,@COINUTILS_CFLAGS_INSTALLED@,$COINUTILS_CFLAGS_INSTALLED,;t t s,@COINUTILS_DATA_INSTALLED@,$COINUTILS_DATA_INSTALLED,;t t s,@CGLLIB_CFLAGS@,$CGLLIB_CFLAGS,;t t s,@CGLLIB_LIBS@,$CGLLIB_LIBS,;t t s,@CGLLIB_PCLIBS@,$CGLLIB_PCLIBS,;t t s,@CGLLIB_PCREQUIRES@,$CGLLIB_PCREQUIRES,;t t s,@CGLLIB_DEPENDENCIES@,$CGLLIB_DEPENDENCIES,;t t s,@CGLLIB_CFLAGS_INSTALLED@,$CGLLIB_CFLAGS_INSTALLED,;t t s,@CGLLIB_LIBS_INSTALLED@,$CGLLIB_LIBS_INSTALLED,;t t s,@COIN_HAS_COINUTILS_TRUE@,$COIN_HAS_COINUTILS_TRUE,;t t s,@COIN_HAS_COINUTILS_FALSE@,$COIN_HAS_COINUTILS_FALSE,;t t s,@OSI_LIBS@,$OSI_LIBS,;t t s,@OSI_CFLAGS@,$OSI_CFLAGS,;t t s,@OSI_DATA@,$OSI_DATA,;t t s,@OSI_DEPENDENCIES@,$OSI_DEPENDENCIES,;t t s,@OSI_LIBS_INSTALLED@,$OSI_LIBS_INSTALLED,;t t s,@OSI_CFLAGS_INSTALLED@,$OSI_CFLAGS_INSTALLED,;t t s,@OSI_DATA_INSTALLED@,$OSI_DATA_INSTALLED,;t t s,@COIN_HAS_OSI_TRUE@,$COIN_HAS_OSI_TRUE,;t t s,@COIN_HAS_OSI_FALSE@,$COIN_HAS_OSI_FALSE,;t t s,@SAMPLE_LIBS@,$SAMPLE_LIBS,;t t s,@SAMPLE_CFLAGS@,$SAMPLE_CFLAGS,;t t s,@SAMPLE_DATA@,$SAMPLE_DATA,;t t s,@SAMPLE_DEPENDENCIES@,$SAMPLE_DEPENDENCIES,;t t s,@SAMPLE_LIBS_INSTALLED@,$SAMPLE_LIBS_INSTALLED,;t t s,@SAMPLE_CFLAGS_INSTALLED@,$SAMPLE_CFLAGS_INSTALLED,;t t s,@SAMPLE_DATA_INSTALLED@,$SAMPLE_DATA_INSTALLED,;t t s,@COIN_HAS_SAMPLE_TRUE@,$COIN_HAS_SAMPLE_TRUE,;t t s,@COIN_HAS_SAMPLE_FALSE@,$COIN_HAS_SAMPLE_FALSE,;t t s,@OSICLP_LIBS@,$OSICLP_LIBS,;t t s,@OSICLP_CFLAGS@,$OSICLP_CFLAGS,;t t s,@OSICLP_DATA@,$OSICLP_DATA,;t t s,@OSICLP_DEPENDENCIES@,$OSICLP_DEPENDENCIES,;t t s,@OSICLP_LIBS_INSTALLED@,$OSICLP_LIBS_INSTALLED,;t t s,@OSICLP_CFLAGS_INSTALLED@,$OSICLP_CFLAGS_INSTALLED,;t t s,@OSICLP_DATA_INSTALLED@,$OSICLP_DATA_INSTALLED,;t t s,@COIN_HAS_OSICLP_TRUE@,$COIN_HAS_OSICLP_TRUE,;t t s,@COIN_HAS_OSICLP_FALSE@,$COIN_HAS_OSICLP_FALSE,;t t s,@OSICPX_LIBS@,$OSICPX_LIBS,;t t s,@OSICPX_CFLAGS@,$OSICPX_CFLAGS,;t t s,@OSICPX_DATA@,$OSICPX_DATA,;t t s,@OSICPX_DEPENDENCIES@,$OSICPX_DEPENDENCIES,;t t s,@OSICPX_LIBS_INSTALLED@,$OSICPX_LIBS_INSTALLED,;t t s,@OSICPX_CFLAGS_INSTALLED@,$OSICPX_CFLAGS_INSTALLED,;t t s,@OSICPX_DATA_INSTALLED@,$OSICPX_DATA_INSTALLED,;t t s,@COIN_HAS_OSICPX_TRUE@,$COIN_HAS_OSICPX_TRUE,;t t s,@COIN_HAS_OSICPX_FALSE@,$COIN_HAS_OSICPX_FALSE,;t t s,@OSIGLPK_LIBS@,$OSIGLPK_LIBS,;t t s,@OSIGLPK_CFLAGS@,$OSIGLPK_CFLAGS,;t t s,@OSIGLPK_DATA@,$OSIGLPK_DATA,;t t s,@OSIGLPK_DEPENDENCIES@,$OSIGLPK_DEPENDENCIES,;t t s,@OSIGLPK_LIBS_INSTALLED@,$OSIGLPK_LIBS_INSTALLED,;t t s,@OSIGLPK_CFLAGS_INSTALLED@,$OSIGLPK_CFLAGS_INSTALLED,;t t s,@OSIGLPK_DATA_INSTALLED@,$OSIGLPK_DATA_INSTALLED,;t t s,@COIN_HAS_OSIGLPK_TRUE@,$COIN_HAS_OSIGLPK_TRUE,;t t s,@COIN_HAS_OSIGLPK_FALSE@,$COIN_HAS_OSIGLPK_FALSE,;t t s,@OSIMSK_LIBS@,$OSIMSK_LIBS,;t t s,@OSIMSK_CFLAGS@,$OSIMSK_CFLAGS,;t t s,@OSIMSK_DATA@,$OSIMSK_DATA,;t t s,@OSIMSK_DEPENDENCIES@,$OSIMSK_DEPENDENCIES,;t t s,@OSIMSK_LIBS_INSTALLED@,$OSIMSK_LIBS_INSTALLED,;t t s,@OSIMSK_CFLAGS_INSTALLED@,$OSIMSK_CFLAGS_INSTALLED,;t t s,@OSIMSK_DATA_INSTALLED@,$OSIMSK_DATA_INSTALLED,;t t s,@COIN_HAS_OSIMSK_TRUE@,$COIN_HAS_OSIMSK_TRUE,;t t s,@COIN_HAS_OSIMSK_FALSE@,$COIN_HAS_OSIMSK_FALSE,;t t s,@OSIXPR_LIBS@,$OSIXPR_LIBS,;t t s,@OSIXPR_CFLAGS@,$OSIXPR_CFLAGS,;t t s,@OSIXPR_DATA@,$OSIXPR_DATA,;t t s,@OSIXPR_DEPENDENCIES@,$OSIXPR_DEPENDENCIES,;t t s,@OSIXPR_LIBS_INSTALLED@,$OSIXPR_LIBS_INSTALLED,;t t s,@OSIXPR_CFLAGS_INSTALLED@,$OSIXPR_CFLAGS_INSTALLED,;t t s,@OSIXPR_DATA_INSTALLED@,$OSIXPR_DATA_INSTALLED,;t t s,@COIN_HAS_OSIXPR_TRUE@,$COIN_HAS_OSIXPR_TRUE,;t t s,@COIN_HAS_OSIXPR_FALSE@,$COIN_HAS_OSIXPR_FALSE,;t t s,@OSIVOL_LIBS@,$OSIVOL_LIBS,;t t s,@OSIVOL_CFLAGS@,$OSIVOL_CFLAGS,;t t s,@OSIVOL_DATA@,$OSIVOL_DATA,;t t s,@OSIVOL_DEPENDENCIES@,$OSIVOL_DEPENDENCIES,;t t s,@OSIVOL_LIBS_INSTALLED@,$OSIVOL_LIBS_INSTALLED,;t t s,@OSIVOL_CFLAGS_INSTALLED@,$OSIVOL_CFLAGS_INSTALLED,;t t s,@OSIVOL_DATA_INSTALLED@,$OSIVOL_DATA_INSTALLED,;t t s,@COIN_HAS_OSIVOL_TRUE@,$COIN_HAS_OSIVOL_TRUE,;t t s,@COIN_HAS_OSIVOL_FALSE@,$COIN_HAS_OSIVOL_FALSE,;t t s,@OSIDYLP_LIBS@,$OSIDYLP_LIBS,;t t s,@OSIDYLP_CFLAGS@,$OSIDYLP_CFLAGS,;t t s,@OSIDYLP_DATA@,$OSIDYLP_DATA,;t t s,@OSIDYLP_DEPENDENCIES@,$OSIDYLP_DEPENDENCIES,;t t s,@OSIDYLP_LIBS_INSTALLED@,$OSIDYLP_LIBS_INSTALLED,;t t s,@OSIDYLP_CFLAGS_INSTALLED@,$OSIDYLP_CFLAGS_INSTALLED,;t t s,@OSIDYLP_DATA_INSTALLED@,$OSIDYLP_DATA_INSTALLED,;t t s,@COIN_HAS_OSIDYLP_TRUE@,$COIN_HAS_OSIDYLP_TRUE,;t t s,@COIN_HAS_OSIDYLP_FALSE@,$COIN_HAS_OSIDYLP_FALSE,;t t s,@CGL_SUBDIRS@,$CGL_SUBDIRS,;t t s,@CGL_SUBLIBS@,$CGL_SUBLIBS,;t t s,@coin_have_doxygen@,$coin_have_doxygen,;t t s,@coin_have_latex@,$coin_have_latex,;t t s,@coin_doxy_usedot@,$coin_doxy_usedot,;t t s,@coin_doxy_tagname@,$coin_doxy_tagname,;t t s,@coin_doxy_logname@,$coin_doxy_logname,;t t s,@COIN_HAS_DOXYGEN_TRUE@,$COIN_HAS_DOXYGEN_TRUE,;t t s,@COIN_HAS_DOXYGEN_FALSE@,$COIN_HAS_DOXYGEN_FALSE,;t t s,@COIN_HAS_LATEX_TRUE@,$COIN_HAS_LATEX_TRUE,;t t s,@COIN_HAS_LATEX_FALSE@,$COIN_HAS_LATEX_FALSE,;t t s,@coin_doxy_tagfiles@,$coin_doxy_tagfiles,;t t s,@coin_doxy_excludes@,$coin_doxy_excludes,;t t s,@LIBEXT@,$LIBEXT,;t t s,@VPATH_DISTCLEANFILES@,$VPATH_DISTCLEANFILES,;t t s,@ABSBUILDDIR@,$ABSBUILDDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then { echo "$as_me:$LINENO: Copying data files for VPATH configuration" >&5 echo "$as_me: Copying data files for VPATH configuration" >&6;} else { echo "$as_me:$LINENO: Creating VPATH links for data files" >&5 echo "$as_me: Creating VPATH links for data files" >&6;} fi for file in $coin_vpath_link_files; do dir=`(dirname "./$file") 2>/dev/null || $as_expr X"./$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"./$file" : 'X\(//\)[^/]' \| \ X"./$file" : 'X\(//\)$' \| \ X"./$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"./$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test -d $dir; then : ; else { if $as_mkdir_p; then mkdir -p $dir else as_dir=$dir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dir" >&5 echo "$as_me: error: cannot create directory $dir" >&2;} { (exit 1); exit 1; }; }; } fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi { echo "$as_me:$LINENO: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&5 echo "$as_me: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&6;} if test x$coin_projectdir = xyes; then { echo "$as_me:$LINENO: Configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} else { echo "$as_me:$LINENO: Main configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Main configuration of $PACKAGE_NAME successful" >&6;} fi else { echo "$as_me:$LINENO: No configuration of $PACKAGE_NAME necessary" >&5 echo "$as_me: No configuration of $PACKAGE_NAME necessary" >&6;} fi CoinMP-1.8.3/Cgl/ltmain.sh0000755000175000017500000057753011405215371013664 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/Cgl/config.guess0000755000175000017500000012706311405215371014351 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Cgl/test/0000755000175000017500000000000012600453455013004 5ustar renereneCoinMP-1.8.3/Cgl/test/Makefile.in0000644000175000017500000005262212506321416015054 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ noinst_PROGRAMS = unitTest$(EXEEXT) @COIN_HAS_SAMPLE_TRUE@am__append_1 = -DSAMPLEDIR=\"`$(CYGPATH_W) @SAMPLE_DATA@ | sed -e 's/\\\\/\\\\\\\\/g'`\" subdir = test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) am_unitTest_OBJECTS = unitTest.$(OBJEXT) unitTest_OBJECTS = $(am_unitTest_OBJECTS) am__DEPENDENCIES_1 = 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(unitTest_SOURCES) DIST_SOURCES = $(unitTest_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign unitTest_SOURCES = unitTest.cpp # List libraries we need to link in unitTest_LDADD = ../src/libCgl.la $(CGLLIB_LIBS) $(OSICLP_LIBS) \ $(OSICPX_LIBS) $(OSIDYLP_LIBS) $(OSIGLPK_LIBS) $(OSIMSK_LIBS) \ $(OSIVOL_LIBS) $(OSIXPR_LIBS) unitTest_DEPENDENCIES = ../src/libCgl.la $(CGLLIB_DEPENDENCIES) \ $(OSICLP_DEPENDENCIES) $(OSICPX_DEPENDENCIES) \ $(OSIDYLP_DEPENDENCIES) $(OSIGLPK_DEPENDENCIES) \ $(OSIMSK_DEPENDENCIES) $(OSIVOL_DEPENDENCIES) \ $(OSIXPR_DEPENDENCIES) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows # Depending of what solvers are available, we add the corresponding files, # libraries and include dirs # For solvers not available, the variables should just resolve to an empty string, # so it's no harm to list them all AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglFlowCover` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglGomory` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglKnapsackCover` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglLandP` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglOddHole` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglProbing` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglMixedIntegerRounding` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglMixedIntegerRounding2` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglResidualCapacity` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglRedSplit` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglRedSplit2` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglTwomir` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglClique` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglSimpleRounding` -I`$(CYGPATH_W) \ $(srcdir)/../src/CglZeroHalf` $(CGLLIB_CFLAGS) $(am__append_1) \ $(OSICLP_CFLAGS) $(OSICPX_CFLAGS) $(OSIDYLP_CFLAGS) \ $(OSIGLPK_CFLAGS) $(OSIMSK_CFLAGS) $(OSIVOL_CFLAGS) \ $(OSIXPR_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 test/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign test/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done unitTest$(EXEEXT): $(unitTest_OBJECTS) $(unitTest_DEPENDENCIES) @rm -f unitTest$(EXEEXT) $(CXXLINK) $(unitTest_LDFLAGS) $(unitTest_OBJECTS) $(unitTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unitTest.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 $(PROGRAMS) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: 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: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS 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-exec \ install-exec-am install-info install-info-am install-man \ 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 \ uninstall-info-am test: unitTest$(EXEEXT) ./unitTest$(EXEEXT) .PHONY: test # 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: CoinMP-1.8.3/Cgl/test/Makefile.am0000644000175000017500000000606712130020311015024 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1110 2013-04-06 13:19:05Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # unitTest for Cgl # ######################################################################## noinst_PROGRAMS = unitTest unitTest_SOURCES = unitTest.cpp # List libraries we need to link in unitTest_LDADD = ../src/libCgl.la $(CGLLIB_LIBS) unitTest_DEPENDENCIES = ../src/libCgl.la $(CGLLIB_DEPENDENCIES) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../src` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglFlowCover` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglGomory` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglKnapsackCover` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglLandP` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglOddHole` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglProbing` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglMixedIntegerRounding` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglMixedIntegerRounding2` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglResidualCapacity` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglRedSplit` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglRedSplit2` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglTwomir` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglClique` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglSimpleRounding` \ -I`$(CYGPATH_W) $(srcdir)/../src/CglZeroHalf` \ $(CGLLIB_CFLAGS) if COIN_HAS_SAMPLE AM_CPPFLAGS += -DSAMPLEDIR=\"`$(CYGPATH_W) @SAMPLE_DATA@ | sed -e 's/\\\\/\\\\\\\\/g'`\" endif # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src # Depending of what solvers are available, we add the corresponding files, # libraries and include dirs # For solvers not available, the variables should just resolve to an empty string, # so it's no harm to list them all AM_CPPFLAGS += $(OSICLP_CFLAGS) $(OSICPX_CFLAGS) $(OSIDYLP_CFLAGS) $(OSIGLPK_CFLAGS) $(OSIMSK_CFLAGS) $(OSIVOL_CFLAGS) $(OSIXPR_CFLAGS) unitTest_LDADD += $(OSICLP_LIBS) $(OSICPX_LIBS) $(OSIDYLP_LIBS) $(OSIGLPK_LIBS) $(OSIMSK_LIBS) $(OSIVOL_LIBS) $(OSIXPR_LIBS) unitTest_DEPENDENCIES += $(OSICLP_DEPENDENCIES) $(OSICPX_DEPENDENCIES) $(OSIDYLP_DEPENDENCIES) $(OSIGLPK_DEPENDENCIES) $(OSIMSK_DEPENDENCIES) $(OSIVOL_DEPENDENCIES) $(OSIXPR_DEPENDENCIES) test: unitTest$(EXEEXT) ./unitTest$(EXEEXT) .PHONY: test ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = CoinMP-1.8.3/Cgl/test/unitTest.cpp0000644000175000017500000003742412130025154015326 0ustar renerene// $Id: unitTest.cpp 1114 2013-04-06 14:00:12Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Test individual classes or groups of classes #include "CoinPragma.hpp" #include "CglConfig.h" #include #include #include #include #include #ifdef COIN_HAS_OSICPX #include #endif #ifdef COIN_HAS_OSIXPR #include #endif #ifdef COIN_HAS_OSICLP #include #endif #ifdef COIN_HAS_OSIDYLP #include #endif #ifdef COIN_HAS_OSIGLPK #include #endif #ifdef COIN_HAS_OSIVOL #include #endif #include "CglSimpleRounding.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglProbing.hpp" #include "CglGomory.hpp" #include "CglLandP.hpp" #include "CglMixedIntegerRounding.hpp" #include "CglMixedIntegerRounding2.hpp" #include "CglResidualCapacity.hpp" #include "CglRedSplit.hpp" #include "CglRedSplit2.hpp" #include "CglTwomir.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglZeroHalf.hpp" // Function Prototypes. Function definitions is in this file. void testingMessage( const char * const msg ); // Command line parameters are directories containing data files. // You must specify both mpsDir and testDir, in order. // If not specified, then "../../Data/Sample/" and // "CglTestData/" are used int main (int argc, const char *argv[]) { // Initialize directories containing data files. std::string mpsDir; std::string testDir; const char dirsep = CoinFindDirSeparator(); if (dirsep == '/') { #ifdef SAMPLEDIR mpsDir = SAMPLEDIR "/" ; #else mpsDir = "../../Data/Sample/"; #endif #ifdef TESTDIR testDir = TESTDIR "/" ; #else testDir = "CglTestData/"; #endif } else { #ifdef SAMPLEDIR mpsDir = SAMPLEDIR "\\" ; #else mpsDir = "..\\..\\Data\\Sample\\"; #endif #ifdef TESTDIR testDir = TESTDIR "\\"; #else testDir = "CglTestData\\"; #endif } // Check for command line override if (argc >= 2) { mpsDir = argv[1]; mpsDir += dirsep; if (argc >= 3) { testDir = argv[2]; testDir += dirsep; } } #ifdef COIN_HAS_OSICPX { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglGomory with OsiCpxSolverInterface\n" ); CglGomoryUnitTest(&cpxSi,mpsDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglSimpleRounding with OsiCpxSolverInterface\n" ); CglSimpleRoundingUnitTest(&cpxSi,mpsDir); } if(0) // Test does not work with Cplex { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglKnapsackCover with OsiCpxSolverInterface\n" ); CglKnapsackCoverUnitTest(&cpxSi,mpsDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglOddHole with OsiCpxSolverInterface\n" ); CglOddHoleUnitTest(&cpxSi,mpsDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglProbing with OsiCpxSolverInterface\n" ); CglProbingUnitTest(&cpxSi,mpsDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglMixedIntegerRounding with OsiCpxSolverInterface\n" ); CglMixedIntegerRoundingUnitTest(&cpxSi, testDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglMixedIntegerRounding2 with OsiCpxSolverInterface\n" ); CglMixedIntegerRounding2UnitTest(&cpxSi, testDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglResidualCapacity with OsiCpxSolverInterface\n" ); CglResidualCapacityUnitTest(&cpxSi, testDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglRedSplit with OsiCpxSolverInterface\n" ); CglRedSplitUnitTest(&cpxSi, mpsDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglTwomir with OsiCpxSolverInterface\n" ); CglTwomirUnitTest(&cpxSi, testDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglClique with OsiCpxSolverInterface\n" ); CglCliqueUnitTest(&cpxSi, testDir); } { OsiCpxSolverInterface cpxSi; testingMessage( "Testing CglFlowCover with OsiCpxSolverInterface\n" ); CglFlowCoverUnitTest(&cpxSi, testDir); } #endif #ifdef COIN_HAS_OSIXPR { OsiXprSolverInterface xprSi; testingMessage( "Testing CglGomory with OsiXprSolverInterface\n" ); CglGomoryUnitTest(&xprSi,mpsDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglSimpleRounding with OsiXprSolverInterface\n" ); CglSimpleRoundingUnitTest(&xprSi,mpsDir); } if(0) { OsiXprSolverInterface xprSi; testingMessage( "Testing CglKnapsackCover with OsiXprSolverInterface\n" ); CglKnapsackCoverUnitTest(&xprSi,mpsDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglOddHole with OsiXprSolverInterface\n" ); CglOddHoleUnitTest(&xprSi,mpsDir); } if(0) // Does not work with Xpress { OsiXprSolverInterface xprSi; testingMessage( "Testing CglProbing with OsiXprSolverInterface\n" ); CglProbingUnitTest(&xprSi,mpsDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglMixedIntegerRounding with OsiXprSolverInterface\n" ); CglMixedIntegerRoundingUnitTest(&xprSi, testDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglMixedIntegerRounding2 with OsiXprSolverInterface\n" ); CglMixedIntegerRounding2UnitTest(&xprSi, testDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglResidualCapacity with OsiXprSolverInterface\n" ); CglResidualCapacityUnitTest(&xprSi, testDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglTwomir with OsiXprSolverInterface\n" ); CglTwomirUnitTest(&xprSi, testDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglClique with OsiXprSolverInterface\n" ); CglCliqueUnitTest(&xprSi, testDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglFlowCover with OsiXprSolverInterface\n" ); CglFlowCoverUnitTest(&xprSi, testDir); } { OsiXprSolverInterface xprSi; testingMessage( "Testing CglZeroHalf with OsiXprSolverInterface\n" ); CglZeroHalfUnitTest(&xprSi, testDir); } #endif #ifdef COIN_HAS_OSICLP { OsiClpSolverInterface clpSi; testingMessage( "Testing CglGomory with OsiClpSolverInterface\n" ); CglGomoryUnitTest(&clpSi,mpsDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglLandp with OsiClpSolverInterface\n" ); CglLandPUnitTest(&clpSi,mpsDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglSimpleRounding with OsiClpSolverInterface\n" ); CglSimpleRoundingUnitTest(&clpSi,mpsDir); } if (0) { OsiClpSolverInterface clpSi; testingMessage( "Testing CglKnapsackCover with OsiClpSolverInterface\n" ); CglKnapsackCoverUnitTest(&clpSi,mpsDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglOddHole with OsiClpSolverInterface\n" ); CglOddHoleUnitTest(&clpSi,mpsDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglProbing with OsiClpSolverInterface\n" ); CglProbingUnitTest(&clpSi,mpsDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglMixedIntegerRounding with OsiClpSolverInterface\n" ); CglMixedIntegerRoundingUnitTest(&clpSi, testDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglMixedIntegerRounding2 with OsiClpSolverInterface\n" ); CglMixedIntegerRounding2UnitTest(&clpSi, testDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglResidualCapacity with OsiClpSolverInterface\n" ); CglResidualCapacityUnitTest(&clpSi, testDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglRedSplit with OsiClpSolverInterface\n" ); CglRedSplitUnitTest(&clpSi, mpsDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglRedSplit2 with OsiClpSolverInterface\n" ); CglRedSplit2UnitTest(&clpSi, mpsDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglTwomir with OsiClpSolverInterface\n" ); CglTwomirUnitTest(&clpSi, testDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglClique with OsiClpSolverInterface\n" ); CglCliqueUnitTest(&clpSi, testDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglFlowCover with OsiClpSolverInterface\n" ); CglFlowCoverUnitTest(&clpSi, testDir); } { OsiClpSolverInterface clpSi; testingMessage( "Testing CglZeroHalf with OsiClpSolverInterface\n" ); CglZeroHalfUnitTest(&clpSi, testDir); } #endif #ifdef COIN_HAS_OSIDYLP { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglGomory with OsiDylpSolverInterface\n" ); CglGomoryUnitTest(&dylpSi,mpsDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglSimpleRounding with OsiDylpSolverInterface\n" ); CglSimpleRoundingUnitTest(&dylpSi,mpsDir); } if (0) { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglKnapsackCover with OsiDylpSolverInterface\n" ); CglKnapsackCoverUnitTest(&dylpSi,mpsDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglOddHole with OsiDylpSolverInterface\n" ); CglOddHoleUnitTest(&dylpSi,mpsDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglProbing with OsiDylpSolverInterface\n" ); CglProbingUnitTest(&dylpSi,mpsDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglMixedIntegerRounding with OsiDylpSolverInterface\n" ); CglMixedIntegerRoundingUnitTest(&dylpSi, testDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglMixedIntegerRounding2 with OsiDylpSolverInterface\n" ); CglMixedIntegerRounding2UnitTest(&dylpSi, testDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglResidualCapacity with OsiDylpSolverInterface\n" ); CglResidualCapacityUnitTest(&dylpSi, testDir); } if (0) // needs partial OsiSimplex { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglRedSplit with OsiDylpSolverInterface\n" ); CglRedSplitUnitTest(&dylpSi, mpsDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglTwomir with OsiDylpSolverInterface\n" ); CglTwomirUnitTest(&dylpSi, testDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglClique with OsiDylpSolverInterface\n" ); CglCliqueUnitTest(&dylpSi, testDir); } { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglFlowCover with OsiDylpSolverInterface\n" ); CglFlowCoverUnitTest(&dylpSi, testDir); } if (0) { OsiDylpSolverInterface dylpSi; testingMessage( "Testing CglZeroHalf with OsiDylpSolverInterface\n" ); CglZeroHalfUnitTest(&dylpSi, testDir); } #endif #ifdef COIN_HAS_OSIGLPK { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglGomory with OsiGlpkSolverInterface\n" ); CglGomoryUnitTest(&glpkSi,mpsDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglSimpleRounding with OsiGlpkSolverInterface\n" ); CglSimpleRoundingUnitTest(&glpkSi,mpsDir); } if (0) { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglKnapsackCover with OsiGlpkSolverInterface\n" ); CglKnapsackCoverUnitTest(&glpkSi,mpsDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglOddHole with OsiGlpkSolverInterface\n" ); CglOddHoleUnitTest(&glpkSi,mpsDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglProbing with OsiGlpkSolverInterface\n" ); CglProbingUnitTest(&glpkSi,mpsDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglMixedIntegerRounding with OsiGlpkSolverInterface\n" ); CglMixedIntegerRoundingUnitTest(&glpkSi, testDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglMixedIntegerRounding2 with OsiGlpkSolverInterface\n" ); CglMixedIntegerRounding2UnitTest(&glpkSi, testDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglResidualCapacity with OsiGlpkSolverInterface\n" ); CglResidualCapacityUnitTest(&glpkSi, testDir); } if (0) // needs partial OsiSimplex { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglRedSplit with OsiGlpkSolverInterface\n" ); CglRedSplitUnitTest(&glpkSi, mpsDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglTwomir with OsiGlpkSolverInterface\n" ); CglTwomirUnitTest(&glpkSi, testDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglClique with OsiGlpkSolverInterface\n" ); CglCliqueUnitTest(&glpkSi, testDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglFlowCover with OsiGlpkSolverInterface\n" ); CglFlowCoverUnitTest(&glpkSi, testDir); } { OsiGlpkSolverInterface glpkSi; testingMessage( "Testing CglZeroHalf with OsiGlpkSolverInterface\n" ); CglZeroHalfUnitTest(&glpkSi, testDir); } #endif #ifdef COIN_HAS_OSIVOL if(0) // p0033: LP not solved to optimality: Finds 2142 versus 2520 { OsiVolSolverInterface volSi; testingMessage( "Testing CglGomory with OsiVolSolverInterface\n" ); CglGomoryUnitTest(&volSi,mpsDir); } if(0) // Not expected number of cuts; might come from different solution? { OsiVolSolverInterface volSi; testingMessage( "Testing CglSimpleRounding with OsiVolSolverInterface\n" ); CglSimpleRoundingUnitTest(&volSi,mpsDir); } if(0) // tp3: LP not solved to optimality: Finds 97.1842 versus 97.185 { OsiVolSolverInterface volSi; testingMessage( "Testing CglKnapsackCover with OsiVolSolverInterface\n" ); CglKnapsackCoverUnitTest(&volSi,mpsDir); } { OsiVolSolverInterface volSi; testingMessage( "Testing CglOddHole with OsiVolSolverInterface\n" ); CglOddHoleUnitTest(&volSi,mpsDir); } if(0) // Not expected number of elements in cut; might come from different solution? { OsiVolSolverInterface volSi; testingMessage( "Testing CglProbing with OsiVolSolverInterface\n" ); CglProbingUnitTest(&volSi,mpsDir); } if(0) // Throw CoinError since solver can not handle infinite bounds { OsiVolSolverInterface volSi; testingMessage( "Testing CglMixedIntegerRounding with OsiVolSolverInterface\n" ); CglMixedIntegerRoundingUnitTest(&volSi, testDir); } if(0) // Throw CoinError since solver can not handle infinite bounds { OsiVolSolverInterface volSi; testingMessage( "Testing CglMixedIntegerRounding2 with OsiVolSolverInterface\n" ); CglMixedIntegerRounding2UnitTest(&volSi, testDir); } if(0) // Throw CoinError since solver can not handle infinite bounds { OsiVolSolverInterface volSi; testingMessage( "Testing CglResidualCapacity with OsiVolSolverInterface\n" ); CglResidualCapacityUnitTest(&volSi, testDir); } if(0) // Throw CoinError since solver can not handle infinite bounds { OsiVolSolverInterface volSi; testingMessage( "Testing CglTwomir with OsiVolSolverInterface\n" ); CglTwomirUnitTest(&volSi, testDir); } if(0) // No cuts found { OsiVolSolverInterface volSi; testingMessage( "Testing CglClique with OsiVolSolverInterface\n" ); CglCliqueUnitTest(&volSi, testDir); } if(0) // Throw CoinError since solver can not handle infinite bounds { OsiVolSolverInterface volSi; testingMessage( "Testing CglFlowCover with OsiVolSolverInterface\n" ); CglFlowCoverUnitTest(&volSi, testDir); } #endif testingMessage( "All tests completed successfully\n" ); return 0; } // Display message on stdout and stderr void testingMessage( const char * const msg ) { std::cout <, 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Cgl/install-sh0000755000175000017500000002202111405215371014021 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Cgl/configure.ac0000644000175000017500000001505412600266515014317 0ustar renerene# Copyright (C) 2006 International Business Machines. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: configure.ac 1312 2015-09-22 15:01:33Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 ############################################################################# # Names and other basic things # ############################################################################# AC_PREREQ(2.59) AC_INIT([Cgl],[0.59.7],[cgl@list.coin-or.org]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License.]) # List one file in the package so that the configure script can test # whether the package is actually there AC_CONFIG_SRCDIR(src/CglMessage.hpp) # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. AC_PREFIX_DEFAULT([`pwd`]) ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type AC_CANONICAL_BUILD # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. AC_COIN_PROJECTDIR_INIT(Cgl,10:7:9) # Check if user wants to produce debugging code AC_COIN_DEBUG_COMPILE(Cgl) # Get the name of the C++ compiler and appropriate compiler options AC_COIN_PROG_CXX # Initialize automake and libtool AC_COIN_INIT_AUTO_TOOLS ############################################################################# # COIN-OR components # ############################################################################# AC_COIN_CHECK_PACKAGE(CoinUtils, [coinutils], [CglLib]) if test $coin_has_coinutils != yes ; then AC_MSG_ERROR([Required package CoinUtils not available.]) fi AC_COIN_CHECK_PACKAGE(Osi, [osi], [CglLib]) if test $coin_has_osi != yes ; then AC_MSG_ERROR([Required package Osi not available.]) fi AC_COIN_CHECK_PACKAGE(Sample, [coindatasample]) # Clp can be used by CglLandP AC_COIN_CHECK_PACKAGE(OsiClp, [osi-clp], [CglLib]) ############################################################################# # Solvers for unittesting # ############################################################################# # These are not really required for the compilation of Cgl, but we # need to know which are available in order to compile the unitTest # correctly. AC_COIN_CHECK_PACKAGE(OsiCpx, [osi-cplex]) AC_COIN_CHECK_PACKAGE(OsiGlpk, [osi-glpk]) #AC_COIN_CHECK_PACKAGE(OsiGrb, [osi-gurobi]) AC_COIN_CHECK_PACKAGE(OsiMsk, [osi-mosek]) AC_COIN_CHECK_PACKAGE(OsiXpr, [osi-xpress]) AC_COIN_CHECK_PACKAGE(OsiVol, [osi-vol]) AC_COIN_CHECK_PACKAGE(OsiDyLP, [osi-dylp]) #AC_COIN_CHECK_PACKAGE(OsiSpx, [osi-soplex]) ############################################################################# # System header # ############################################################################# AC_COIN_CHECK_CXX_CHEADER(math) AC_COIN_CHECK_CXX_CHEADER(float) AC_COIN_CHECK_CXX_CHEADER(ieeefp) ############################################################################# # Determine list of all Cgl subprojects # ############################################################################# # In order to avoid that one has to update this configure.ac and the # Makefile.am whenever a new cut generator is added, we automatically determine # the list of all subdirectories of src with a Makefile.in (CGL_SUBDIRS), # and also a list of all sublibraries relative to src (CGL_SUBLIBS) that # can be used in the src/Makefile.am. (It is still necessary to manually # add an entry to write the Makefile in the AC_CONFIG_FILES list below.) AC_SUBST(CGL_SUBDIRS) AC_SUBST(CGL_SUBLIBS) curr_dir=`pwd` cd $srcdir/src for file in `ls */Makefile.in`; do newdir=`echo $file | sed -e s%/Makefile.in%% | sed -e s%^./%% ` CGL_SUBDIRS="$CGL_SUBDIRS $newdir" CGL_SUBLIBS="$CGL_SUBLIBS $newdir/lib${newdir}.la" done cd $curr_dir ############################################################################# # Check for doxygen # ############################################################################# AC_COIN_DOXYGEN(CoinUtils) ############################################################################## # Finishing up by writing all the output # ############################################################################## # Install files for unitTest AC_COIN_VPATH_LINK([test/CglTestData/capPlan1.mps test/CglTestData/l152lav.mps test/CglTestData/egout.mps test/CglTestData/lseu.mps]) # Here list all the files that configure should create (except for the # configuration header file) AC_CONFIG_FILES([Makefile examples/Makefile src/Makefile src/CglAllDifferent/Makefile src/CglClique/Makefile src/CglDuplicateRow/Makefile src/CglFlowCover/Makefile src/CglGMI/Makefile src/CglGomory/Makefile src/CglKnapsackCover/Makefile src/CglLandP/Makefile src/CglLiftAndProject/Makefile src/CglMixedIntegerRounding/Makefile src/CglMixedIntegerRounding2/Makefile src/CglOddHole/Makefile src/CglPreProcess/Makefile src/CglProbing/Makefile src/CglRedSplit/Makefile src/CglRedSplit2/Makefile src/CglResidualCapacity/Makefile src/CglSimpleRounding/Makefile src/CglTwomir/Makefile src/CglZeroHalf/Makefile test/Makefile cgl.pc cgl-uninstalled.pc]) AC_CONFIG_FILES([doxydoc/doxygen.conf]) # Here put the location and name of the configuration header file AC_CONFIG_HEADER([src/config.h src/config_cgl.h]) # Finally, we let configure write all the output... AC_COIN_FINALIZE CoinMP-1.8.3/Cgl/doxydoc/0000755000175000017500000000000012600453455013476 5ustar renereneCoinMP-1.8.3/Cgl/doxydoc/doxygen.conf.in0000644000175000017500000017377512231275132016445 0ustar renerene# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doxydoc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = "@abs_top_srcdir@" # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = @coin_doxy_logname@ #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @abs_top_srcdir@/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.hpp \ *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.svn* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 3 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = YES # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = YES # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = letter # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = @coin_doxy_tagfiles@ # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = @coin_doxy_tagname@ # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = YES # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = @coin_doxy_usedot@ # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES CoinMP-1.8.3/Cgl/cgl-uninstalled.pc.in0000644000175000017500000000200612122056610016030 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src Name: CGL Description: COIN-OR Cut Generation Library URL: https://projects.coin-or.org/Cgl Version: @PACKAGE_VERSION@ Libs: ${libdir}/libCgl.la @CGLLIB_PCLIBS@ Cflags: -I@abs_source_dir@/src -I@abs_source_dir@/src/CglAllDifferent -I@abs_source_dir@/src/CglClique -I@abs_source_dir@/src/CglDuplicateRow -I@abs_source_dir@/src/CglFlowCover -I@abs_source_dir@/src/CglGMI -I@abs_source_dir@/src/CglGomory -I@abs_source_dir@/src/CglKnapsackCover -I@abs_source_dir@/src/CglLandP -I@abs_source_dir@/src/CglLiftAndProject -I@abs_source_dir@/src/CglMixedIntegerRounding -I@abs_source_dir@/src/CglMixedIntegerRounding2 -I@abs_source_dir@/src/CglOddHole -I@abs_source_dir@/src/CglPreProcess -I@abs_source_dir@/src/CglProbing -I@abs_source_dir@/src/CglRedSplit -I@abs_source_dir@/src/CglRedSplit2 -I@abs_source_dir@/src/CglResidualCapacity -I@abs_source_dir@/src/CglSimpleRounding -I@abs_source_dir@/src/CglTwomir -I@abs_source_dir@/src/CglZeroHalf -I@ABSBUILDDIR@/src Requires: @CGLLIB_PCREQUIRES@ CoinMP-1.8.3/Cgl/src/0000755000175000017500000000000012600453456012615 5ustar renereneCoinMP-1.8.3/Cgl/src/CglStored.hpp0000644000175000017500000000632312130102162015177 0ustar renerene// $Id: CglStored.hpp 1119 2013-04-06 20:24:18Z stefan $ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglStored_H #define CglStored_H #include #include "CglCutGenerator.hpp" class CoinWarmStartBasis; class CglTreeProbingInfo; /** Stored Cut Generator Class */ class CglStored : public CglCutGenerator { public: /**@name Generate Cuts */ //@{ /** Generate Mixed Integer Stored cuts for the model of the solver interface, si. Insert the generated cuts into OsiCut, cs. This generator just looks at previously stored cuts and inserts any that are violated by enough */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Change criterion on whether to include cut. Violations of more than this will be added to current cut list (default 1.0e-5) */ //@{ /// Set inline void setRequiredViolation(double value) { requiredViolation_=value;} /// Get inline double getRequiredViolation() const { return requiredViolation_;} /// Takes over ownership of probing info inline void setProbingInfo(CglTreeProbingInfo * info) { probingInfo_ = info;} //@} /**@name Cut stuff */ //@{ /// Add cuts void addCut(const OsiCuts & cs); /// Add a row cut void addCut(const OsiRowCut & cut); /// Add a row cut from a packed vector void addCut(double lb, double ub, const CoinPackedVector & vector); /// Add a row cut from elements void addCut(double lb, double ub, int size, const int * colIndices, const double * elements); inline int sizeRowCuts() const { return cuts_.sizeRowCuts();} const OsiRowCut * rowCutPointer(int index) const { return cuts_.rowCutPtr(index);} /// Save stuff void saveStuff(double bestObjective, const double * bestSolution, const double * lower, const double * upper); /// Best solution (or NULL) inline const double * bestSolution() const { return bestSolution_;} /// Best objective double bestObjective() const; /// Tight lower bounds const double * tightLower() const { return bounds_;} /// Tight upper bounds const double * tightUpper() const { return bounds_+numberColumns_;} //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglStored (int numberColumns=0); /// Copy constructor CglStored (const CglStored & rhs); /// Constructor from file CglStored (const char * fileName); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglStored & operator=(const CglStored& rhs); /// Destructor virtual ~CglStored (); //@} protected: // Protected member methods // Protected member data /**@name Protected member data */ //@{ /// Only add if more than this requiredViolation double requiredViolation_; /// Pointer to probing information CglTreeProbingInfo * probingInfo_; /// Cuts OsiCuts cuts_; /// Number of columns in model int numberColumns_; /// Best solution (objective at end) double * bestSolution_; /// Tight bounds double * bounds_; //@} }; #endif CoinMP-1.8.3/Cgl/src/CglAllDifferent/0000755000175000017500000000000012600453456015602 5ustar renereneCoinMP-1.8.3/Cgl/src/CglAllDifferent/Makefile.in0000644000175000017500000005434712506321416017657 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglAllDifferent DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglAllDifferent_la_LIBADD = am_libCglAllDifferent_la_OBJECTS = CglAllDifferent.lo libCglAllDifferent_la_OBJECTS = $(am_libCglAllDifferent_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglAllDifferent_la_SOURCES) DIST_SOURCES = $(libCglAllDifferent_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglAllDifferent # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglAllDifferent.la # List all source files for this library, including headers libCglAllDifferent_la_SOURCES = CglAllDifferent.cpp CglAllDifferent.hpp # This is for libtool (on Windows) libCglAllDifferent_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglAllDifferent.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglAllDifferent/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglAllDifferent/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglAllDifferent.la: $(libCglAllDifferent_la_OBJECTS) $(libCglAllDifferent_la_DEPENDENCIES) $(CXXLINK) $(libCglAllDifferent_la_LDFLAGS) $(libCglAllDifferent_la_OBJECTS) $(libCglAllDifferent_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglAllDifferent.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglAllDifferent/Makefile.am0000644000175000017500000000321611621724114017632 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglAllDifferent # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglAllDifferent.la # List all source files for this library, including headers libCglAllDifferent_la_SOURCES = CglAllDifferent.cpp CglAllDifferent.hpp # This is for libtool (on Windows) libCglAllDifferent_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglAllDifferent.hpp CoinMP-1.8.3/Cgl/src/CglAllDifferent/CglAllDifferent.cpp0000644000175000017500000004005312130103340021253 0ustar renerene// Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include //#define PRINT_DEBUG //#define CGL_DEBUG 1 //#undef NDEBUG #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" #include "OsiRowCutDebugger.hpp" #include "CglAllDifferent.hpp" #ifdef CGL_DEBUG // A declaration is required somewhere, eh? I'm assuming static so the value // carries over between calls to generateCuts. namespace { int nPath = 0 ; } #endif //------------------------------------------------------------------- // Generate cuts //------------------------------------------------------------------- void CglAllDifferent::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo ) { #ifndef NDEBUG int nCols=si.getNumCols(); #endif int i; const double * lower = si.getColLower(); const double * upper = si.getColUpper(); #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&debugger->onOptimalPath(si)) { printf("On optimal path %d\n",nPath); nPath++; int nCols=si.getNumCols(); const double * solution = si.getColSolution(); const double * optimal = debugger->optimalSolution(); const double * objective = si.getObjCoefficients(); double objval1=0.0,objval2=0.0; for (i=0;i1 printf("%d %g %g %g %g\n",i,lower[i],solution[i],upper[i],optimal[i]); #endif objval1 += solution[i]*objective[i]; objval2 += optimal[i]*objective[i]; assert(optimal[i]>=lower[i]&&optimal[i]<=upper[i]); } printf("current obj %g, integer %g\n",objval1,objval2); } #endif int * lo = new int[numberDifferent_]; int * up = new int[numberDifferent_]; for (i=0;i (lower[iColumn]); assert (floor(lower[iColumn]+0.5)==lower[iColumn]); up[i] = static_cast (upper[iColumn]); assert (floor(upper[iColumn]+0.5)==upper[iColumn]); assert (up[i]>=lo[i]); } // We are going to assume we can just have one big 2d array! // Could save by going to bits // also could skip sets where all are fixed // could do some of above by separate first pass // once a variable fixed - can take out of list // so need to redo complete stuff (including temp which_) every big pass int offset = COIN_INT_MAX; int maxValue = -COIN_INT_MAX; int numberLook=0; // copies //int * which = new int [numberTotal]; //int * start = new int [numberSets_+1]; for (i=0;i (gap) * numberDifferent_; if (size>1.0e7) { if (logLevel_) printf("Only looking at %d sets\n",numberLook); break; } } // Which sets a variable is in int * back = new int [start_[numberSets_]]; int * backStart = new int[numberDifferent_+1]; memset(backStart,0,(numberDifferent_+1)*sizeof(int)); int numberTotal = start_[numberLook]; for (i=0;i=0) { if (check[alreadyFixed[k]]==0) { check[alreadyFixed[k]]=1; continue; } else { // infeasible infeasible=true; i=numberLook; break; } } char * allowed = possible + k*gap; int n=0; for (int jj=0;jj= 0 kLook=0; for (j=kLook;jfixed) finished=false; // try again } // Could try two sets if (infeasible) { // create infeasible cut OsiRowCut rc; rc.setLb(COIN_DBL_MAX); rc.setUb(0.0); cs.insert(rc); } else { // check to see if can tighten bounds CoinPackedVector lbs; CoinPackedVector ubs; int nTightened=0; for (i=0;ilo[i]) { lbs.insert(iColumn,static_cast (firstLo+offset)); nTightened++; } if (lastUp+offset (lastUp+offset)); nTightened++; } } if (nTightened) { OsiColCut cc; cc.setUbs(ubs); cc.setLbs(lbs); cc.setEffectiveness(100.0); cs.insert(cc); } } //delete [] which; //delete [] start; delete [] first; delete [] stack; delete [] bitmap; delete [] check; delete [] alreadyFixed; delete [] back; delete [] backStart; delete [] possible; delete [] lo; delete [] up; } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglAllDifferent::CglAllDifferent () : CglCutGenerator(), numberSets_(0), numberDifferent_(0), maxLook_(2), logLevel_(0), start_(NULL), which_(NULL), originalWhich_(NULL) { } //------------------------------------------------------------------- // Useful Constructor //------------------------------------------------------------------- CglAllDifferent::CglAllDifferent (int numberSets, const int * starts, const int * which) : CglCutGenerator(), numberSets_(numberSets), maxLook_(2), logLevel_(0), start_(NULL), which_(NULL), originalWhich_(NULL) { if (numberSets_>0) { int n = starts[numberSets_]; start_ = CoinCopyOfArray(starts,numberSets_+1); originalWhich_ = CoinCopyOfArray(which,n); which_ = new int[n]; int i; int maxValue=-1; for (i=0;i=0); maxValue = CoinMax(iColumn,maxValue); } maxValue++; int * translate = new int[maxValue]; for (i=0;i=0); which_[i]=iColumn; } delete [] translate; } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglAllDifferent::CglAllDifferent ( const CglAllDifferent & rhs) : CglCutGenerator(rhs), numberSets_(rhs.numberSets_), numberDifferent_(rhs.numberDifferent_), maxLook_(rhs.maxLook_), logLevel_(rhs.logLevel_) { if (numberSets_) { int n = rhs.start_[numberSets_]; start_ = CoinCopyOfArray(rhs.start_,numberSets_+1); which_ = CoinCopyOfArray(rhs.which_,n); originalWhich_ = CoinCopyOfArray(rhs.originalWhich_,n); } else { start_=NULL; which_=NULL; originalWhich_=NULL; } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglAllDifferent::clone() const { return new CglAllDifferent(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglAllDifferent::~CglAllDifferent () { // free memory delete [] start_; delete [] which_; delete [] originalWhich_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglAllDifferent & CglAllDifferent::operator=( const CglAllDifferent& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); // free memory delete [] start_; delete [] which_; delete [] originalWhich_; numberSets_ = rhs.numberSets_; numberDifferent_ = rhs.numberDifferent_; maxLook_ = rhs.maxLook_; logLevel_ = rhs.logLevel_; if (numberSets_) { int n = rhs.start_[numberSets_]; start_ = CoinCopyOfArray(rhs.start_,numberSets_+1); which_ = CoinCopyOfArray(rhs.which_,n); originalWhich_ = CoinCopyOfArray(rhs.originalWhich_,n); } else { start_=NULL; which_=NULL; originalWhich_=NULL; } } return *this; } /// This can be used to refresh any inforamtion void CglAllDifferent::refreshSolver(OsiSolverInterface * ) { } // Create C++ lines to get to current state std::string CglAllDifferent::generateCpp( FILE * fp) { CglAllDifferent other; fprintf(fp,"0#include \"CglAllDifferent.hpp\"\n"); fprintf(fp,"3 CglAllDifferent allDifferent;\n"); if (logLevel_!=other.logLevel_) fprintf(fp,"3 allDifferent.setLogLevel(%d);\n",logLevel_); else fprintf(fp,"4 allDifferent.setLogLevel(%d);\n",logLevel_); if (maxLook_!=other.maxLook_) fprintf(fp,"3 allDifferent.setMaxLook(%d);\n",maxLook_); else fprintf(fp,"4 allDifferent.setMaxLook(%d);\n",maxLook_); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 allDifferent.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 allDifferent.setAggressiveness(%d);\n",getAggressiveness()); return "allDifferent"; } CoinMP-1.8.3/Cgl/src/CglAllDifferent/CglAllDifferent.hpp0000644000175000017500000000552512130102162021266 0ustar renerene// Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglAllDifferent_H #define CglAllDifferent_H #include #include "CglCutGenerator.hpp" /** AllDifferent Cut Generator Class This has a number of sets. All the members in each set are general integer variables which have to be different from all others in the set. At present this only generates column cuts At present it is very primitive compared to proper CSP implementations */ class CglAllDifferent : public CglCutGenerator { public: /**@name Generate Cuts */ //@{ /** This fixes (or reduces bounds) on sets of all different variables */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglAllDifferent (); /// Useful constructot CglAllDifferent(int numberSets, const int * starts, const int * which); /// Copy constructor CglAllDifferent ( const CglAllDifferent &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglAllDifferent & operator=( const CglAllDifferent& rhs); /// Destructor virtual ~CglAllDifferent (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); /// This can be used to refresh any inforamtion virtual void refreshSolver(OsiSolverInterface * solver); /** Returns true if may generate Row cuts in tree (rather than root node). Used so know if matrix will change in tree. Really meant so column cut generators can still be active without worrying code. Default is true */ virtual bool mayGenerateRowCutsInTree() const { return false;} //@} /**@name Sets and Gets */ //@{ /// Set log level inline void setLogLevel(int value) { logLevel_=value;} /// Get log level inline int getLogLevel() const { return logLevel_;} /// Set Maximum number of sets to look at at once inline void setMaxLook(int value) { maxLook_=value;} /// Get Maximum number of sets to look at at once inline int getMaxLook() const { return maxLook_;} //@} private: // Private member methods /**@name */ //@{ //@} // Private member data /**@name Private member data */ //@{ /// Number of sets int numberSets_; /// Total number of variables in all different sets int numberDifferent_; /// Maximum number of sets to look at at once int maxLook_; /// Log level - 0 none, 1 - a bit, 2 - more details int logLevel_; /// Start of each set int * start_; /// Members (0,1,....) not as in original model int * which_; /// Original members int * originalWhich_; //@} }; #endif CoinMP-1.8.3/Cgl/src/Makefile.in0000644000175000017500000007141612506321416014666 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ @DEPENDENCY_LINKING_TRUE@am__append_1 = $(CGLLIB_LIBS) subdir = src DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/config_cgl.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h config_cgl.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) am_libCgl_la_OBJECTS = CglCutGenerator.lo CglMessage.lo CglStored.lo \ CglParam.lo CglTreeInfo.lo libCgl_la_OBJECTS = $(am_libCgl_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCgl_la_SOURCES) DIST_SOURCES = $(libCgl_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign # We need to recurse into all Cgl subproject subdirectories SUBDIRS = $(CGL_SUBDIRS) ######################################################################## # libCgl # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in the $libdir directory lib_LTLIBRARIES = libCgl.la # List all source files for this library, including headers libCgl_la_SOURCES = \ CglConfig.h \ CglCutGenerator.cpp CglCutGenerator.hpp\ CglMessage.cpp CglMessage.hpp \ CglStored.cpp CglStored.hpp \ CglParam.cpp CglParam.hpp \ CglTreeInfo.cpp CglTreeInfo.hpp # This is for libtool (on Windows) libCgl_la_LDFLAGS = $(LT_LDFLAGS) # We want to have all the sublibraries from the Cgl subprojects collected into # this library libCgl_la_LIBADD = $(CGL_SUBLIBS) $(am__append_1) # Since automake is not doing this on its own, we need to declare the # dependencies to the subdirectory libraries here libCgl_la_DEPENDENCIES = $(CGL_SUBLIBS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ CglCutGenerator.hpp \ CglMessage.hpp \ CglStored.hpp \ CglParam.hpp \ CglTreeInfo.hpp all: config.h config_cgl.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ config_cgl.h: stamp-h2 @if test ! -f $@; then \ rm -f stamp-h2; \ $(MAKE) stamp-h2; \ else :; fi stamp-h2: $(srcdir)/config_cgl.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status src/config_cgl.h distclean-hdr: -rm -f config.h stamp-h1 config_cgl.h stamp-h2 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libCgl.la: $(libCgl_la_OBJECTS) $(libCgl_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libCgl_la_LDFLAGS) $(libCgl_la_OBJECTS) $(libCgl_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglCutGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglMessage.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglParam.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglStored.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglTreeInfo.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in config_cgl.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in config_cgl.h.in $(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; } \ END { 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: ctags-recursive $(HEADERS) $(SOURCES) config.h.in config_cgl.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_cgl.h.in $(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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h config_cgl.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-exec-local install-libLTLIBRARIES install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-libLTLIBRARIES clean-libtool \ clean-recursive ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-recursive distclean-tags distdir \ dvi dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-exec-local install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local install-exec-local: $(install_sh_DATA) config_cgl.h $(DESTDIR)$(includecoindir)/CglConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/CglConfig.h # 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: CoinMP-1.8.3/Cgl/src/CglZeroHalf/0000755000175000017500000000000012600453456014755 5ustar renereneCoinMP-1.8.3/Cgl/src/CglZeroHalf/Makefile.in0000644000175000017500000005472612506321416017033 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglZeroHalf DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglZeroHalf_la_LIBADD = am_libCglZeroHalf_la_OBJECTS = CglZeroHalf.lo Cgl012cut.lo \ CglZeroHalfTest.lo libCglZeroHalf_la_OBJECTS = $(am_libCglZeroHalf_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglZeroHalf_la_SOURCES) DIST_SOURCES = $(libCglZeroHalf_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglZeroHalf # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglZeroHalf.la # List all source files for this library, including headers libCglZeroHalf_la_SOURCES = \ CglZeroHalf.cpp CglZeroHalf.hpp \ Cgl012cut.cpp Cgl012cut.hpp \ CglZeroHalfTest.cpp # This is for libtool libCglZeroHalf_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. # "top_srcdir" refers to the basic directory for the main package that is # being compiled. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglZeroHalf.hpp Cgl012cut.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglZeroHalf/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglZeroHalf/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglZeroHalf.la: $(libCglZeroHalf_la_OBJECTS) $(libCglZeroHalf_la_DEPENDENCIES) $(CXXLINK) $(libCglZeroHalf_la_LDFLAGS) $(libCglZeroHalf_la_OBJECTS) $(libCglZeroHalf_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cgl012cut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglZeroHalf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglZeroHalfTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglZeroHalf/Makefile.am0000644000175000017500000000340312252026756017013 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1165 2013-12-11 09:18:38Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglZeroHalf # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglZeroHalf.la # List all source files for this library, including headers libCglZeroHalf_la_SOURCES = \ CglZeroHalf.cpp CglZeroHalf.hpp \ Cgl012cut.cpp Cgl012cut.hpp \ CglZeroHalfTest.cpp # This is for libtool libCglZeroHalf_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. # "top_srcdir" refers to the basic directory for the main package that is # being compiled. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglZeroHalf.hpp Cgl012cut.hpp CoinMP-1.8.3/Cgl/src/CglZeroHalf/Cgl012cut.hpp0000644000175000017500000004136012231270471017130 0ustar renerene// $Id: Cgl012cut.hpp 1149 2013-10-21 18:23:53Z tkr $ // Copyright (C) 2010, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /** @file 012cut.h Include file for C coded 0-1/2 separator */ #ifndef CGL012CUT #define CGL012CUT #include #include #include #define CGL_NEW_SHORT #ifndef CGL_NEW_SHORT typedef /* arc */ struct arc_st { int len; /* length of the arc */ struct node_st *head; /* head node */ } arc; typedef /* node */ struct node_st { arc *first; /* first outgoing arc */ int dist; /* tentative shortest path length */ struct node_st *parent; /* parent pointer */ struct node_st *next; /* next node in queue */ struct node_st *prev; /* previous node in queue */ int status; /* status of node */ int temp; /* for temporary labels */ int index; /* index of the node in the graph */ } node; #endif typedef struct { int length; // Length of arc int to; // To node } cgl_arc; typedef struct { cgl_arc * firstArc; // First outgoing arc int parentNode; // Parent node in shortest path int index; // Which node I am int distanceBack; // Distance back to source } cgl_node; typedef struct { int nnodes; // Number of nodes in graph int narcs; // Number of arcs in graph cgl_node * nodes; cgl_arc * arcs; } cgl_graph; /* #define PRINT */ /* #define PRINT_CUTS */ #define REDUCTION typedef struct { int mr; /* number of rows in the ILP matrix */ int mc; /* number of columns in the ILP matrix */ int mnz; /* number of nonzero's in the ILP matrix */ int *mtbeg; /* starting position of each row in arrays mtind and mtval */ int *mtcnt; /* number of entries of each row in arrays mtind and mtval */ int *mtind; /* column indices of the nonzero entries of the ILP matrix */ int *mtval; /* values of the nonzero entries of the ILP matrix */ int *vlb; /* lower bounds on the variables */ int *vub; /* upper bounds on the variables */ int *mrhs; /* right hand sides of the constraints */ char *msense; /* senses of the constraints: 'L', 'G' or 'E' */ const double *xstar; /* current optimal solution of the LP relaxation */ } ilp; typedef struct { int mr; /* number of rows in the parity ILP matrix */ int mc; /* number of columns in the parity ILP matrix */ int mnz; /* number of 1's in the parity ILP matrix */ int *mtbeg; /* starting position of each row in arrays mtind and mtval */ int *mtcnt; /* number of entries of each row in arrays mtind and mtval */ int *mtind; /* column indices of the 1's of the parity ILP matrix */ short int *mrhs; /* right hand side parity of the constraints */ double *xstar; /* current optimal solution of the LP relaxation */ double *slack; /* slack of the constraints w.r.t. xstar */ short int *row_to_delete; /* flag for marking rows not to be considered */ short int *col_to_delete; /* flag for marking columns not to be considered */ int *gcd; /* greatest common divisor of each row in the input ILP matrix */ short int *possible_weak; /* possible weakening types of each column */ short int *type_even_weak; /* type of even weakening of each column (lower or upper bound weakening) */ short int *type_odd_weak; /* type of odd weakening of each column (lower or upper bound weakening) */ double *loss_even_weak; /* loss for the even weakening of each column */ double *loss_odd_weak; /* loss for the odd weakening of each column */ double *min_loss_by_weak; /* minimum loss for the weakening of each column */ } parity_ilp; typedef struct { int nweak; /* number of variables weakened */ int *var; /* list of variables weakened */ short int *type; /* type of weakening (lower or upper bound weakening) */ } info_weak; typedef struct { int endpoint1, endpoint2; /* endpoints of the edge */ double weight; /* edge weight */ short int parity; /* edge parity (even or odd) */ int constr; /* constraint associated with the edge */ info_weak *weak; /* weakening information */ } edge; typedef struct { int nnodes; /* number of nodes */ int nedges; /* number of edges */ int *nodes; /* indexes of the ILP columns corresponding to the nodes */ int *ind; /* indexes of the nodes corresponding to the ILP columns */ edge **even_adj_list; /* pointers to the even edges */ edge **odd_adj_list; /* pointers to the odd edges */ } separation_graph; #ifndef CGL_NEW_SHORT typedef struct { int nnodes; /* number of nodes */ int narcs; /* number of arcs */ node *nodes; /* array of the nodes - see "types_db.h" */ arc *arcs; /* array of the arcs - see "types_db.h" */ } auxiliary_graph; #else typedef struct { int nnodes; /* number of nodes */ int narcs; /* number of arcs */ cgl_node *nodes; /* array of the nodes - see "types_db.h" */ cgl_arc *arcs; /* array of the arcs - see "types_db.h" */ } auxiliary_graph; #endif typedef struct { long dist; /* distance from/to root */ int pred; /* index of the predecessor */ } short_path_node; typedef struct { double weight; /* overall weight of the cycle */ int length; /* number of edges in the cycle */ edge **edge_list; /* list of edges in the cycle */ } cycle; typedef struct { int cnum; /* overall number of cycles */ cycle **list; /* pointers to the cycles in the list */ } cycle_list; typedef struct { int n_of_constr; /* number of constraints combined to get the cut */ int *constr_list; /* list of the constraints combined */ short int *in_constr_list; /* flag saying whether a given constraint is in the list of constraints of the cut (IN) or not (OUT) */ int cnzcnt; /* overall number of nonzero's in the cut */ int *cind; /* column indices of the nonzero entries of the cut */ int *cval; /* values of the nonzero entries of the cut */ int crhs; /* right hand side of the cut */ char csense; /* sense of the cut: 'L', 'G' or 'E' */ double violation; /* violation of the cut w.r.t. the current LP solution */ } cut; typedef struct { int cnum; /* overall number of cuts */ cut **list; /* pointers to the cuts in the list */ } cut_list; typedef struct { int n_of_constr; /* number of constraints combined to get the cut */ int *constr_list; /* list of the constraints combined */ int code; /* identifier of the cut */ int n_it_violated; /* number of consecutive iterations (starting from the last and going backward) in which the cut was violated by the LP solution */ int it_found; /* iteration in which the cut was separated */ double score; /* score of the cut, used to choose wich cut should be added to the current LP (if any) */ } pool_cut; typedef struct { int cnum; /* overall number of cuts */ pool_cut **list; /* pointers to the cuts in the list */ int *ncod; /* number of cuts with a given code in the pool */ } pool_cut_list; typedef struct { int *ccoef; /* coefficients of the cut */ int crhs; /* right hand side of the cut */ int pool_index; /* index of the cut in the pool */ double score; /* cut score (to be maximized) */ } select_cut; typedef struct { int n_it_zero; /* number of consecutive iterations (starting from the last and going backward) in which each variable took the value 0 in the LP solution */ } log_var; /** 012Cut Generator Class This class is to make Cgl01cut thread safe etc */ class Cgl012Cut { public: /**@name Generate Cuts */ //@{ int sep_012_cut( /* INPUT parameters: */ int mr, /* number of rows in the ILP matrix */ int mc, /* number of columns in the ILP matrix */ int mnz, /* number of nonzero's in the ILP matrix */ int *mtbeg, /* starting position of each row in arrays mtind and mtval */ int *mtcnt, /* number of entries of each row in arrays mtind and mtval */ int *mtind, /* column indices of the nonzero entries of the ILP matrix */ int *mtval, /* values of the nonzero entries of the ILP matrix */ int *vlb, /* lower bounds on the variables */ int *vub, /* upper bounds on the variables */ int *mrhs, /* right hand sides of the constraints */ char *msense, /* senses of the constraints: 'L', 'G' or 'E' */ const double *xstar, /* current optimal solution of the LP relaxation */ bool aggressive, /* flag asking whether as many cuts as possible are required on output (TRUE) or not (FALSE) */ /* OUTPUT parameters (the memory for the vectors is allocated INTERNALLY by the procedure: if some memory is already allocated, it is FREED): */ int *cnum, /* number of violated 0-1/2 cuts identified by the procedure */ int *cnzcnt, /* overall number of nonzero's in the cuts */ int **cbeg, /* starting position of each cut in arrays cind and cval */ int **ccnt, /* number of entries of each cut in arrays cind and cval */ int **cind, /* column indices of the nonzero entries of the cuts */ int **cval, /* values of the nonzero entries of the cuts */ int **crhs, /* right hand sides of the cuts */ char **csense /* senses of the cuts: 'L', 'G' or 'E' */ /* NOTE that all the numerical input/output vectors are INTEGER (with the exception of xstar), since the procedure is intended to work with pure ILP's, and that the ILP matrix has to be given on input in ROW format. */ ); void ilp_load( int mr, /* number of rows in the ILP matrix */ int mc, /* number of columns in the ILP matrix */ int mnz, /* number of nonzero's in the ILP matrix */ int *mtbeg, /* starting position of each row in arrays mtind and mtval */ int *mtcnt, /* number of entries of each row in arrays mtind and mtval */ int *mtind, /* column indices of the nonzero entries of the ILP matrix */ int *mtval, /* values of the nonzero entries of the ILP matrix */ int *vlb, /* lower bounds on the variables */ int *vub, /* upper bounds on the variables */ int *mrhs, /* right hand sides of the constraints */ char *msense /* senses of the constraints: 'L', 'G' or 'E' */ ); void free_ilp(); /* alloc_parity_ilp: allocate the memory for the parity ILP data structure */ void alloc_parity_ilp( int mr, /* number of rows in the ILP matrix */ int mc, /* number of columns in the ILP matrix */ int mnz /* number of nonzero's in the ILP matrix */ ); void free_parity_ilp(); void initialize_log_var(); /* free_log_var */ void free_log_var(); private: /* best_weakening: find the best upper/lower bound weakening of a set of variables */ int best_weakening( int n_to_weak, /* number of variables to weaken */ int *vars_to_weak, /* indices of the variables to weaken */ short int original_parity, /* original parity of the constraint to weaken */ double original_slack, /* original slack of the constraint to weaken */ double *best_even_slack, /* best possible slack of a weakened constraint with even right-hand-side */ double *best_odd_slack, /* best possible slack of a weakened constraint with odd right-hand-side */ info_weak **info_even_weak, /* weakening information about the best possible even weakened constraint */ info_weak **info_odd_weak, /* weakening information about the best possible odd weakened constraint */ short int only_odd, /* flag which tells whether only an odd weakening is of interest (TRUE) or both weakenings are (FALSE) */ short int only_viol /* flag which tells whether only an inequality of slack smaller than MAX_SLACK is of interest (TRUE) otherwise (FALSE) */ ); /* best_cut: find the coefficients, the rhs and the violation of the best possible cut that can be obtained by weakening a given set of coefficients to even and a rhs to odd, dividing by 2 and rounding */ short int best_cut( int *ccoef, /* vector of the coefficients */ int *crhs, /* pointer to rhs value */ double *violation, /* violation of the cut */ short int update, /* TRUE/FALSE: if TRUE, the new ccoef and crhs are given on output */ short int only_viol /* flag which tells whether only an inequality of slack smaller than MAX_SLACK is of interest (TRUE) otherwise (FALSE) */ ); /* get_cut: extract a hopefully violated cut from an odd cycle of the separation graph */ cut *get_cut( cycle *s_cyc /* shortest odd cycles identified in the separation graph */ ); /* update_log_var: update the log information for the problem variables */ void update_log_var(); /* basic_separation: try to identify violated 0-1/2 cuts by using the original procedure described in Caprara and Fischetti's MP paper */ cut_list *basic_separation(); /* score_by_moving: compute the score of the best cut obtainable from the current local search solution by inserting/deleting a constraint */ double score_by_moving( int i, /* constraint to be moved */ short int itype, /* type of move - ADD or DEL */ double thresh /* minimum value of an interesting score */ ); /* modify_current: update the current local search solution by inserting/ deleting a constraint */ void modify_current( int i, /* constraint to be moved */ short int itype /* type of move - ADD or DEL */ ); /* best neighbour: find the cut to be added/deleted from the current solution among those allowed by the tabu rules */ short int best_neighbour(cut_list *out_cuts /* list of the violated cuts found */); /* add_tight_constraint: initialize the current cut by adding a tight constraint to it */ void add_tight_constraint(); /* tabu_012: try to identify violated 0-1/2 cuts by a simple tabu search procedure adapted from that used by Battiti and Protasi for finding large cliques */ cut_list *tabu_012(); /* initialize: initialize the data structures for local search */ void initialize(); /* restart: perform a restart of the search - IMPORTANT: in the current implementation vector last_moved is not cleared at restart */ void restart(short int failure /* flag forcing the restart if some trouble occurred */); void print_constr(int i /* constraint to be printed */); void print_parity_ilp(); /* get_parity_ilp: construct an internal data structure containing all the information which can be useful for 0-1/2 cut separation */ void get_parity_ilp(); /* initialize_sep_graph: allocate and initialize the data structure to contain the information associated with a separation graph */ separation_graph *initialize_sep_graph(); void print_cut(cut *v_cut); /* get_ori_cut_coef: get the coefficients of a cut, before dividing by 2 and rounding, starting from the list of the constraints combined to get the cut */ short int get_ori_cut_coef( int n_of_constr, /* number of constraints combined */ int *constr_list, /* list of the constraints combined */ int *ccoef, /* cut left hand side coefficients */ int *crhs, /* cut right hand side */ short int only_viol /* flag which tells whether only an inequality of slack smaller than MAX_SLACK is of interest (TRUE) otherwise (FALSE) */ ); /* define_cut: construct a cut data structure from a vector of coefficients and a right-hand-side */ cut *define_cut( int *ccoef, /* coefficients of the cut */ int crhs /* right hand side of the cut */ ); /* cut_score: define the score of a (violated) cut */ double cut_score( int *ccoef, /* cut left hand side coefficients */ int crhs, /* cut right hand side */ double viol, /* cut violation */ short int only_viol /* flag which tells whether only an inequality of slack smaller than MAX_SLACK is of interest (TRUE) otherwise (FALSE) */ ); /* get_current_cut: return a cut data type with the information about the current cut of the search procedure */ cut *get_current_cut(); /* print_cur_cut: display cur_cut on output */ void print_cur_cut(); void print_cut_list(cut_list *cuts); //@} public: /**@name Constructors and destructors */ //@{ /// Default constructor Cgl012Cut (); /// Copy constructor Cgl012Cut ( const Cgl012Cut &); /// Assignment operator Cgl012Cut & operator=( const Cgl012Cut& rhs); /// Destructor virtual ~Cgl012Cut (); //@} private: // Private member methods /**@name Private methods */ //@{ //@} /**@name Private member data */ //@{ ilp *inp_ilp; /* input ILP data structure */ parity_ilp *p_ilp; /* parity ILP data structure */ int iter; double gap; double maxgap; int errorNo; int sep_iter; /* number of the current separation iteration */ log_var **vlog; /* information about the value attained by the variables in the last iterations, used to possibly set to 0 some coefficient > 0 in a cut to be added */ bool aggr; /* flag saying whether as many cuts as possible are required from the separation procedure (TRUE) or not (FALSE) */ //@} }; #endif CoinMP-1.8.3/Cgl/src/CglZeroHalf/CglZeroHalf.cpp0000644000175000017500000003452212405350442017621 0ustar renerene// $Id: CglZeroHalf.cpp 1222 2014-09-14 17:32:18Z forrest $ // Copyright (C) 2010, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include "CoinPragma.hpp" #include "CglZeroHalf.hpp" #include "CoinPackedVector.hpp" #include "CoinSort.hpp" #include "CoinPackedMatrix.hpp" //------------------------------------------------------------- void CglZeroHalf::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) { if (mnz_) { int cnum=0,cnzcnt=0; int *cbeg=NULL, *ccnt=NULL,*cind=NULL,*cval=NULL,*crhs=NULL; char *csense=NULL; const double * solution = si.getColSolution(); if ((flags_&1)==0) { // redo bounds const double * columnLower = si.getColLower(); const double * columnUpper = si.getColUpper(); int numberColumns = si.getNumCols(); for (int iColumn=0;iColumn (ceil(lo)); double up = columnUpper[iColumn]; if (up>COIN_INT_MAX) up=COIN_INT_MAX; iup= static_cast (floor(up)); vlb_[iColumn]=ilo; vub_[iColumn]=iup; } } } if (true) { cutInfo_.sep_012_cut(mr_,mc_,mnz_, mtbeg_,mtcnt_, mtind_, mtval_, vlb_, vub_, mrhs_, msense_, solution, info.inTree ? false : true, &cnum,&cnzcnt, &cbeg,&ccnt,&cind,&cval,&crhs,&csense); } else { int k = 4*mr_+2*mnz_; int * temp = new int[k]; int * mtbeg = temp; int * mtcnt = mtbeg + mr_; int * mtind = mtcnt+mr_; int * mtval = mtind+mnz_; int * mrhs = mtval+mnz_; char * msense = reinterpret_cast (mrhs+mr_); int i; k=0; int kel=0; for (i=0;ikel2) { mtcnt[k]=kel-kel2; mtbeg[k]=kel2; mrhs[k]=rhs; msense[k++]=msense_[i]; } } if (kel) { cutInfo_.sep_012_cut(k,mc_,kel, mtbeg,mtcnt, mtind, mtval, vlb_, vub_, mrhs, msense, solution, info.inTree ? false : true, &cnum,&cnzcnt, &cbeg,&ccnt,&cind,&cval,&crhs,&csense); } delete [] temp; } if (cnum) { // add cuts double * element = new double[mc_]; for (int i=0;i1.0e-6) cs.insert(rc); //else //printf("violation of %g\n",violation); } delete [] element; free(cbeg); free(ccnt); free(cind); free(cval); free(crhs); free(csense); } } } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglZeroHalf::CglZeroHalf () : CglCutGenerator(), mr_(0), mc_(0), mnz_(0), mtbeg_(NULL), mtcnt_(NULL), mtind_(NULL), mtval_(NULL), vlb_(NULL), vub_(NULL), mrhs_(NULL), msense_(NULL), flags_(0) { cutInfo_=Cgl012Cut(); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglZeroHalf::CglZeroHalf ( const CglZeroHalf & source) : CglCutGenerator(source), mtbeg_(NULL), mtcnt_(NULL), mtind_(NULL), mtval_(NULL), vlb_(NULL), vub_(NULL), mrhs_(NULL), msense_(NULL), flags_(source.flags_) { mr_ = source.mr_; mc_ = source.mc_; mnz_ = source.mnz_; if (mr_) { mtbeg_ = CoinCopyOfArray(source.mtbeg_,mr_); mtcnt_ = CoinCopyOfArray(source.mtcnt_,mr_); mtind_ = CoinCopyOfArray(source.mtind_,mnz_); mtval_ = CoinCopyOfArray(source.mtval_,mnz_); vlb_ = CoinCopyOfArray(source.vlb_,mc_); vub_ = CoinCopyOfArray(source.vub_,mc_); mrhs_ = CoinCopyOfArray(source.mrhs_,mr_); msense_ = CoinCopyOfArray(source.msense_,mr_); } //cutInfo_ = Cgl012Cut(source.cutInfo_); cutInfo_ = Cgl012Cut(); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglZeroHalf::clone() const { return new CglZeroHalf(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglZeroHalf::~CglZeroHalf () { delete [] mtbeg_; delete [] mtcnt_; delete [] mtind_; delete [] mtval_; delete [] vlb_; delete [] vub_; delete [] mrhs_; delete [] msense_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglZeroHalf & CglZeroHalf::operator=( const CglZeroHalf& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); delete [] mtbeg_; delete [] mtcnt_; delete [] mtind_; delete [] mtval_; delete [] vlb_; delete [] vub_; delete [] mrhs_; delete [] msense_; mr_ = rhs.mr_; mc_ = rhs.mc_; mnz_ = rhs.mnz_; flags_ = rhs.flags_; if (mr_) { mtbeg_ = CoinCopyOfArray(rhs.mtbeg_,mr_); mtcnt_ = CoinCopyOfArray(rhs.mtcnt_,mr_); mtind_ = CoinCopyOfArray(rhs.mtind_,mnz_); mtval_ = CoinCopyOfArray(rhs.mtval_,mnz_); vlb_ = CoinCopyOfArray(rhs.vlb_,mc_); vub_ = CoinCopyOfArray(rhs.vub_,mc_); mrhs_ = CoinCopyOfArray(rhs.mrhs_,mr_); msense_ = CoinCopyOfArray(rhs.msense_,mr_); } else { mtbeg_ = NULL; mtcnt_ = NULL; mtind_ = NULL; mtval_ = NULL; vlb_ = NULL; vub_ = NULL; mrhs_ = NULL; msense_ = NULL; } //cutInfo_=Cgl012Cut(rhs.cutInfo_); cutInfo_=Cgl012Cut(); } return *this; } void CglZeroHalf::refreshSolver(OsiSolverInterface * solver) { if (!solver||!solver->getNumRows()) return; // no solver delete [] mtbeg_; delete [] mtcnt_; delete [] mtind_; delete [] mtval_; delete [] vlb_; delete [] vub_; delete [] mrhs_; delete [] msense_; mr_ = 0; mc_ = 0; mnz_ = 0; mtbeg_ = NULL; mtcnt_ = NULL; mtind_ = NULL; mtval_ = NULL; vlb_ = NULL; vub_ = NULL; mrhs_ = NULL; msense_ = NULL; cutInfo_.free_log_var(); cutInfo_.free_parity_ilp(); cutInfo_.free_ilp(); CoinPackedMatrix rowCopy(*solver->getMatrixByRow()); const int * column = rowCopy.getIndices(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const int * rowLength = rowCopy.getVectorLengths(); const double * rowElements = rowCopy.getElements(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int iColumn,iRow; // count number of possible int numberColumns = solver->getNumCols(); int numberRows = solver->getNumRows(); vlb_ = new int [numberColumns]; vub_ = new int [numberColumns]; for (iColumn=0;iColumnisInteger(iColumn)) { double lo = columnLower[iColumn]; if (lo<-COIN_INT_MAX) lo=-COIN_INT_MAX; ilo= static_cast (ceil(lo)); double up = columnUpper[iColumn]; if (up>COIN_INT_MAX) up=COIN_INT_MAX; iup= static_cast (floor(up)); } else { ilo=COIN_INT_MAX; iup=-COIN_INT_MAX; } vlb_[iColumn]=ilo; vub_[iColumn]=iup; } for (iRow=0;iRow0); for (CoinBigIndex j=rowStart[iRow]; j1.0e-15) { // not integer coefficient good=false; break; } } } double lo = rowLower[iRow]; double up = rowUpper[iRow]; int iType=1; double rhs=1.0e20; if (lo>-1.0e20) { if (fabs(lo-floor(lo+0.5))>1.0e-15) { // not integer coefficient good=false; } rhs=fabs(lo); if (up<1.0e20) { rhs=CoinMax(fabs(lo),fabs(up)); if (lo!=up) iType=2; // ranged so make copy if (fabs(up-floor(up+0.5))>1.0e-12) { // not integer coefficient good=false; } } } else if (up<1.0e20) { rhs=fabs(up); if (up<1.0e20) { if (fabs(up-floor(up+0.5))>1.0e-12) { // not integer coefficient good=false; } } } if (good&&rhs0); for (CoinBigIndex j=rowStart[iRow]; j1.0e-15) { // not integer coefficient good=false; break; } } } double lo = rowLower[iRow]; double up = rowUpper[iRow]; int iType=1; double rhs=1.0e20; if (lo>-1.0e20) { if (fabs(lo-floor(lo+0.5))>1.0e-15) { // not integer coefficient good=false; } rhs=fabs(lo); if (up<1.0e20) { rhs=CoinMax(fabs(lo),fabs(up)); if (lo!=up) iType=2; // ranged so make copy if (fabs(up-floor(up+0.5))>1.0e-12) { // not integer coefficient good=false; } } } else if (up<1.0e20) { rhs=fabs(up); if (up<1.0e20) { if (fabs(up-floor(up+0.5))>1.0e-12) { // not integer coefficient good=false; } } } if (good&&rhs (floor(value+0.5)); if (iValue) { mtind_[mnz_]=jColumn; mtval_[mnz_++]=iValue; } } mtcnt_[mr_]=mnz_-mtbeg_[mr_]; if (iType==1) { if (lo>-1.0e20) { mrhs_[mr_]=static_cast (floor(lo+0.5)); msense_[mr_]='G'; } else { mrhs_[mr_]=static_cast (floor(up+0.5)); msense_[mr_]='L'; } mr_++; } else { // ranged! mrhs_[mr_]=static_cast (floor(lo+0.5)); msense_[mr_]='G'; int k = mnz_-mtbeg_[mr_]; mr_++; mtbeg_[mr_]=mnz_; memcpy(mtind_+mnz_,mtind_+mnz_-k,k*sizeof(int)); memcpy(mtval_+mnz_,mtval_+mnz_-k,k*sizeof(int)); mnz_+= mtcnt_[mr_-1]; mtcnt_[mr_]=mnz_-mtbeg_[mr_]; mrhs_[mr_]=static_cast (floor(up+0.5)); msense_[mr_]='L'; mr_++; } } } assert(saveMr==mr_); assert(saveMnz==mnz_); cutInfo_.ilp_load(mr_,mc_,mnz_,mtbeg_,mtcnt_,mtind_,mtval_, vlb_,vub_,mrhs_,msense_); cutInfo_.alloc_parity_ilp(mr_,mc_,mnz_); cutInfo_.initialize_log_var(); } else { // no good delete [] vlb_; delete [] vub_; vlb_ = NULL; vub_ = NULL; mr_=0; mnz_=0; } } // Create C++ lines to get to current state std::string CglZeroHalf::generateCpp( FILE * fp) { CglZeroHalf other; fprintf(fp,"0#include \"CglZeroHalf.hpp\"\n"); fprintf(fp,"3 CglZeroHalf zeroHalf;\n"); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 zeroHalf.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 zeroHalf.setAggressiveness(%d);\n",getAggressiveness()); return "zeroHalf"; } #include #include //bool operator() (cgl_node * x, cgl_node * y) { bool best(cgl_node * x, cgl_node * y) { return (x->distanceBack>y->distanceBack); } #ifndef CGL_NEW_SHORT void cglShortestPath(cgl_graph * graph, int source, int maximumLength) #else void cglShortestPath(auxiliary_graph * graph, int source, int maximumLength) #endif { int numberNodes=graph->nnodes; #define HEAP #ifndef HEAP int * candidate = new int [numberNodes]; #endif cgl_node * nodes = graph->nodes; int i; for ( i=0;i nodes_; for ( i=0;i0) { #ifdef HEAP cgl_node * bestNode = nodes_.front(); int iNode = bestNode->index; std::pop_heap(nodes_.begin(), nodes_.end(), best); nodes_.pop_back(); if (nodes[iNode].distanceBack==COIN_INT_MAX) break; numberCandidates--; #else int best=-1; int bestDistance=COIN_INT_MAX; for (i=0;ito; int dist = arc->length; if (thisDistance+dist #include "CoinPragma.hpp" #include "CglZeroHalf.hpp" //#include "CglKnapsackCover.hpp" #include //-------------------------------------------------------------------------- // test the zero half cut generators methods. void CglZeroHalfUnitTest( const OsiSolverInterface * baseSiP, const std::string mpsDir ) { // Test default constructor { CglZeroHalf cg; } // Test copy & assignment { CglZeroHalf rhs; { CglZeroHalf cg; CglZeroHalf cgC(cg); rhs=cg; } } // Test generate cuts method on lseu { CglZeroHalf cg; OsiSolverInterface * siP = baseSiP->clone(); std::string fn = mpsDir+"lseu.mps"; siP->readMps(fn.c_str(),""); // test if there if (!siP->getNumRows()) { printf("** Unable to find lseu in %s\n", mpsDir.c_str()); return; } siP->initialSolve(); cg.refreshSolver(siP); OsiCuts cuts; cg.generateCuts(*siP,cuts); // lseu is the optimal solution to lseu // Optimal IP solution to lseu int objIndices[13]={0,1,6,13,26,33,38,43,50,52,63,65,85}; CoinPackedVector lseu(13,objIndices,1.0); // test that none of the generated cuts // chops off the optimal solution int nRowCuts = cuts.sizeRowCuts(); OsiRowCut rcut; CoinPackedVector rpv; int i; for (i=0; igetObjValue(); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("Final LP min=%f\n\n",lpRelaxAfter); #endif printf("Zero cuts %d\n",nRowCuts); if (!(lpRelaxBefore < lpRelaxAfter)){ printf("***Warning: Bound did not improve after addition of cut.\n"); printf("***This can happen, but is generally not expected\n"); }else{ printf("Good zero %s\n",fn.c_str()); } delete siP; } } CoinMP-1.8.3/Cgl/src/CglZeroHalf/Cgl012cut.cpp0000644000175000017500000034413412405350442017130 0ustar renerene// $Id: Cgl012cut.cpp 1222 2014-09-14 17:32:18Z forrest $ // Copyright (C) 2010, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /** @file 012cut.c Definition file for C coded 0-1/2 separator */ #include "CoinFinite.hpp" #include "CoinTime.hpp" #include "Cgl012cut.hpp" #include "CglZeroHalf.hpp" static int MAX_CUTS = 10000000; //#define PRINT_TABU //#define PRINT_CUTS //#define PRINT_TIME //#define TIME /* #define TIME */ #undef TIME #define TRUE 1 #define FALSE 0 #define ODD 1 #define EVEN 0 #define NONE -1 #define BOTH 2 #define IN 1 #define OUT 0 #define ADD 1 #define DEL 0 #define LOWER_BOUND 0 #define UPPER_BOUND 1 #define EPS 0.0001 /* small tolerance */ //#define EPS 0.000001 /* small tolerance */ #define ZERO 0.000001 /* estimated accuracy for doubles */ //#define ZERO 0.0001 /* estimated accuracy for doubles */ #define INF 1000000000.0 #define IINF 1000000000 #define MAX_SLACK 1.0 #define MAX_LOSS 1.0 #define MAX_CYCLE_WEIGHT 1.0 #define MIN_VIOLATION 0.001 #define MIN_SCORE_RANGE 10.0 #define MAX_SCORE_RANGE ZERO /* 1.0 */ #define ISCALE 10000 //#define MAX_CUTS 10 #define MAX_CUT_POOL 10000 #define MAX_CUT_COD 10000 #define MAX_ITER_POOL 100 #define CLEAN_THRESH 0.9 #define MANY_IT_ZERO 10 #define mod2(I) ( I % 2 == 0 ? 0 : 1 ) #ifdef TIME static float tot_basic_sep_time = 0.0; /* total time spent for basic separation */ static float avg_basic_sep_time; /* average time per iteration spent for basic separation */ static float total_time = 0.0; /* total time spent in the separation */ static float prep_time = 0.0; /* time spent for the definition of the parity ILP data structure */ static float weak_time = 0.0; /* time spent for the construction of the separation graph by weakening */ static float aux_time = 0.0; /* time spent for the definition of the auxiliary graph */ static float path_time = 0.0; /* time spent in the computation of the shortest paths */ static float cycle_time = 0.0; /* time spent in the determination of the shortest cycles */ static float cut_time = 0.0; /* time spent in the determination of the violated cuts */ static float bw_time = 0.0; /* time spent in best_weakening */ static float coef_time = 0.0; /* time spent in the initial computation of coef in get_cut */ static float pool_time = 0.0; /* time spent for the addition and extraction of cuts from the pool */ static int cut_ncalls = 0; /* number of calls to get_cut */ static float tabu_time = 0.0; /* time spent within tabu search */ float ti, tf, td, tti, ttf, tsi, tsf, tii, tff, tpi, tpf, ttabi, ttabf; void second_(float *t) {*t=CoinCpuTime();} #endif /* #endif */ /* global data structures */ #define CGGGGG #ifndef CGGGGG static ilp *inp_ilp; /* input ILP data structure */ static parity_ilp *p_ilp; /* parity ILP data structure */ #endif #ifdef PRINT_CUTS /* utility subroutines */ void print_int_vect(char *s,int *v,int n) { int i; printf("integer vector %s:",s); for ( i = 0; i < n; i++ ) printf(" %d",v[i]); printf("\n"); } void print_short_int_vect(char *s,short int *v,int n) { int i; printf("short integer vector %s:",s); for ( i = 0; i < n; i++ ) printf(" %d",v[i]); printf("\n"); } void print_double_vect(char *s,double *v,int n) { int i; printf("double vector %s:",s); for ( i = 0; i < n; i++ ) printf(" %f",v[i]); printf("\n"); } #endif void alloc_error(char *s) { printf("\n Warning: Not enough memory to allocate %s\n",s); printf("\n Cannot proceed with 0-1/2 cut separation\n"); exit(FALSE); } /* double2int: compute the integer equivalent of a double */ int double2int(double x) { if ( x > IINF ) return (IINF); if ( x < - IINF ) return (- IINF); if ( x < ZERO && x > - ZERO ) return(0); if ( x > 0.0 ) return(static_cast (x + ZERO)); return(static_cast (x - ZERO)); } /* gcd: compute the greatest common divisor of two integers */ int gcd(int a,int b) { int c; if ( a < 0 ) a = - a; if ( b < 0 ) b = - b; if ( a < b ) { c = a; a = b; b = c; } while ( b != 0 ) { c = a % b; a = b; b = c; } return(a); } /* ILP data structures subroutines */ /* ilp_load: load the input ILP into an internal data structure */ void Cgl012Cut::ilp_load( int mr, /* number of rows in the ILP matrix */ int mc, /* number of columns in the ILP matrix */ int mnz, /* number of nonzero's in the ILP matrix */ int *mtbeg, /* starting position of each row in arrays mtind and mtval */ int *mtcnt, /* number of entries of each row in arrays mtind and mtval */ int *mtind, /* column indices of the nonzero entries of the ILP matrix */ int *mtval, /* values of the nonzero entries of the ILP matrix */ int *vlb, /* lower bounds on the variables */ int *vub, /* upper bounds on the variables */ int *mrhs, /* right hand sides of the constraints */ char *msense /* senses of the constraints: 'L', 'G' or 'E' */ ) { inp_ilp = reinterpret_cast (calloc(1,sizeof(ilp))); if ( inp_ilp == NULL ) alloc_error(const_cast("inp_ilp")); inp_ilp->mr = mr; inp_ilp->mc = mc; inp_ilp->mnz = mnz; inp_ilp->mtbeg = mtbeg; inp_ilp->mtcnt = mtcnt; inp_ilp->mtind = mtind; inp_ilp->mtval = mtval; inp_ilp->vlb = vlb; inp_ilp->vub = vub; inp_ilp->mrhs = mrhs; inp_ilp->msense = msense; } void Cgl012Cut::free_ilp() { free(inp_ilp); inp_ilp=NULL; } #ifdef PRINT_CUTS void Cgl012Cut::print_constr(int i /* constraint to be printed */) { printf("\n content of constraint %d: nzcnt = %d, rhs = %d, sense = %c, slack = %f\n", i, inp_ilp->mtcnt[i], inp_ilp->mrhs[i], inp_ilp->msense[i], p_ilp->slack[i]); print_int_vect(const_cast("ind"),inp_ilp->mtind + inp_ilp->mtbeg[i],inp_ilp->mtcnt[i]); print_int_vect(const_cast("val"),inp_ilp->mtval + inp_ilp->mtbeg[i],inp_ilp->mtcnt[i]); } #endif /* alloc_parity_ilp: allocate the memory for the parity ILP data structure */ void Cgl012Cut::alloc_parity_ilp( int mr, /* number of rows in the ILP matrix */ int mc, /* number of columns in the ILP matrix */ int mnz /* number of nonzero's in the ILP matrix */ ) { p_ilp = reinterpret_cast (calloc(1,sizeof(parity_ilp))); if ( p_ilp == NULL ) alloc_error(const_cast("p_ilp")); p_ilp->mtbeg = reinterpret_cast (calloc(mr,sizeof(int))); if ( p_ilp->mtbeg == NULL ) alloc_error(const_cast("p_ilp->mtbeg")); p_ilp->mtcnt = reinterpret_cast (calloc(mr,sizeof(int))); if ( p_ilp->mtcnt == NULL ) alloc_error(const_cast("p_ilp->mtcnt")); p_ilp->mtind = reinterpret_cast (calloc(mnz,sizeof(int))); if ( p_ilp->mtind == NULL ) alloc_error(const_cast("p_ilp->mtind")); p_ilp->mrhs = reinterpret_cast (calloc(mr,sizeof(short int))); if ( p_ilp->mrhs== NULL ) alloc_error(const_cast("p_ilp->mrhs")); p_ilp->xstar = reinterpret_cast (calloc(mc,sizeof(double))); if ( p_ilp->xstar== NULL ) alloc_error(const_cast("p_ilp->xstar")); p_ilp->slack = reinterpret_cast (calloc(mr,sizeof(double))); if ( p_ilp->slack == NULL ) alloc_error(const_cast("p_ilp->slack")); p_ilp->row_to_delete = reinterpret_cast (calloc(mr,sizeof(short int))); if ( p_ilp->row_to_delete == NULL ) alloc_error(const_cast("p_ilp->row_to_delete")); p_ilp->col_to_delete = reinterpret_cast (calloc(mc,sizeof(short int))); if ( p_ilp->col_to_delete == NULL ) alloc_error(const_cast("p_ilp->col_to_delete")); p_ilp->gcd = reinterpret_cast (calloc(mr,sizeof(int))); if ( p_ilp->gcd == NULL ) alloc_error(const_cast("p_ilp->gcd")); p_ilp->possible_weak = reinterpret_cast (calloc(mc,sizeof(short int))); if ( p_ilp->possible_weak == NULL ) alloc_error(const_cast("p_ilp->possible_weak")); p_ilp->type_even_weak = reinterpret_cast (calloc(mc,sizeof(short int))); if ( p_ilp->type_even_weak == NULL ) alloc_error(const_cast("p_ilp->type_even_weak")); p_ilp->type_odd_weak = reinterpret_cast (calloc(mc,sizeof(short int))); if ( p_ilp->type_odd_weak == NULL ) alloc_error(const_cast("p_ilp->type_odd_weak")); p_ilp->loss_even_weak = reinterpret_cast (calloc(mc,sizeof(double))); if ( p_ilp->loss_even_weak == NULL ) alloc_error(const_cast("p_ilp->loss_even_weak")); p_ilp->loss_odd_weak = reinterpret_cast (calloc(mc,sizeof(double))); if ( p_ilp->loss_odd_weak == NULL ) alloc_error(const_cast("p_ilp->loss_odd_weak")); p_ilp->min_loss_by_weak = reinterpret_cast (calloc(mc,sizeof(double))); if ( p_ilp->min_loss_by_weak == NULL ) alloc_error(const_cast("p_ilp->min_loss_by_weak")); p_ilp->mr=mr; p_ilp->mc=mc; p_ilp->mnz=mnz; } #ifdef PRINT_CUTS void Cgl012Cut::print_parity_ilp() { printf("\n content of parity_ilp data structure: mc = %d, mr = %d, mnz = %d\n", p_ilp->mc,p_ilp->mr,p_ilp->mnz); print_int_vect(const_cast("mtbeg"),p_ilp->mtbeg,p_ilp->mr); print_int_vect(const_cast("mtcnt"),p_ilp->mtcnt,p_ilp->mr); print_int_vect(const_cast("mtind"),p_ilp->mtind,p_ilp->mnz); print_short_int_vect(const_cast("mrhs"),p_ilp->mrhs,p_ilp->mr); print_double_vect(const_cast("xstar"),p_ilp->xstar,p_ilp->mc); print_double_vect(const_cast("slack"),p_ilp->slack,p_ilp->mr); print_short_int_vect(const_cast("row_to_delete"),p_ilp->row_to_delete,p_ilp->mr); print_short_int_vect(const_cast("col_to_delete"),p_ilp->col_to_delete,p_ilp->mc); print_int_vect(const_cast("gcd"),p_ilp->gcd,p_ilp->mr); print_short_int_vect(const_cast("possible_weak"),p_ilp->possible_weak,p_ilp->mc); print_short_int_vect(const_cast("type_even_weak"),p_ilp->type_even_weak,p_ilp->mc); print_short_int_vect(const_cast("type_odd_weak"),p_ilp->type_odd_weak,p_ilp->mc); print_double_vect(const_cast("loss_even_weak"),p_ilp->loss_even_weak,p_ilp->mc); print_double_vect(const_cast("loss_odd_weak"),p_ilp->loss_odd_weak,p_ilp->mc); print_double_vect(const_cast("min_loss_by_weak"),p_ilp->min_loss_by_weak,p_ilp->mc); } #endif void Cgl012Cut::free_parity_ilp() { if (p_ilp) { free(p_ilp->mtbeg); free(p_ilp->mtcnt); free(p_ilp->mtind); free(p_ilp->mrhs); free(p_ilp->xstar); free(p_ilp->slack); free(p_ilp->row_to_delete); free(p_ilp->col_to_delete); free(p_ilp->gcd); free(p_ilp->possible_weak); free(p_ilp->type_even_weak); free(p_ilp->type_odd_weak); free(p_ilp->loss_even_weak); free(p_ilp->loss_odd_weak); free(p_ilp->min_loss_by_weak); free(p_ilp); p_ilp=NULL; } } /* alloc_info_weak: allocate memory for the weakening info data structure */ info_weak *alloc_info_weak(int nweak /* number of variables to be weakened */) { info_weak *i_weak; i_weak = reinterpret_cast (calloc(1,sizeof(info_weak))); if ( i_weak == NULL ) alloc_error(const_cast("i_weak")); if ( nweak > 0 ) { i_weak->var = reinterpret_cast (calloc(nweak,sizeof(int))); if ( i_weak->var == NULL ) alloc_error(const_cast("i_weak->var")); i_weak->type = reinterpret_cast (calloc(nweak,sizeof(short int))); if ( i_weak->type == NULL ) alloc_error(const_cast("i_weak->type")); } return(i_weak); } #ifdef PRINT_CUTS void print_info_weak(info_weak *i_weak) { printf("\n content of info_weak: nweak = %d\n",i_weak->nweak); if ( i_weak->nweak > 0 ) { print_int_vect(const_cast("var"),i_weak->var,i_weak->nweak); print_short_int_vect(const_cast("type"),i_weak->type,i_weak->nweak); } } #endif void free_info_weak(info_weak *i_weak) { if ( i_weak->nweak > 0 ) { free(i_weak->var); free(i_weak->type); } free(i_weak); } /* get_parity_ilp: construct an internal data structure containing all the information which can be useful for 0-1/2 cut separation */ void Cgl012Cut::get_parity_ilp() { int i, j, h, ij, aij, cnti, cnttot, begi, begh, ofsj, gcdi, ubj, lbj; double slacki, xstarj, loss_upper, loss_lower; short int parity_col_removed, equalih; /* allocate the memory for the parity ILP data structure */ //alloc_parity_ilp(inp_ilp->mr,inp_ilp->mc,inp_ilp->mnz); p_ilp->mr = inp_ilp->mr; p_ilp->mc = inp_ilp->mc; /* mark the variables equal to their lower/upper bound */ parity_col_removed = 0; for ( j = 0; j < inp_ilp->mc; j++ ) { xstarj = p_ilp->xstar[j] = inp_ilp->xstar[j]; ubj = inp_ilp->vub[j]; lbj = inp_ilp->vlb[j]; if ( xstarj > static_cast (ubj - ZERO) ) { /* variable at its upper bound */ p_ilp->col_to_delete[j] = TRUE; if ( mod2(ubj) == ODD ) { p_ilp->possible_weak[j] = ODD; p_ilp->type_odd_weak[j] = UPPER_BOUND; p_ilp->loss_odd_weak[j] = 0.0; if ( parity_col_removed == EVEN ) parity_col_removed = ODD; else parity_col_removed = EVEN; } else { p_ilp->possible_weak[j] = EVEN; p_ilp->type_even_weak[j] = UPPER_BOUND; p_ilp->loss_even_weak[j] = 0.0; } p_ilp->min_loss_by_weak[j] = 0.0; } else if ( xstarj < static_cast (lbj) + ZERO ) { /* variable at its lower bound */ p_ilp->col_to_delete[j] = TRUE; if ( mod2(lbj) == ODD ) { p_ilp->possible_weak[j] = ODD; p_ilp->type_odd_weak[j] = LOWER_BOUND; p_ilp->loss_odd_weak[j] = 0.0; p_ilp->min_loss_by_weak[j] = 0.0; if ( parity_col_removed == EVEN ) parity_col_removed = ODD; else parity_col_removed = EVEN; } else { p_ilp->possible_weak[j] = EVEN; p_ilp->type_even_weak[j] = LOWER_BOUND; p_ilp->loss_even_weak[j] = 0.0; p_ilp->min_loss_by_weak[j] = 0.0; } p_ilp->min_loss_by_weak[j] = 0.0; } else { /* variable neither at its lower nor at its upper bound */ p_ilp->col_to_delete[j] = FALSE; loss_upper = static_cast (ubj) - xstarj; loss_lower = xstarj - static_cast (lbj); if ( ( loss_upper > MAX_LOSS ) && ( loss_lower > MAX_LOSS ) ) /* no weakening for the variable */ p_ilp->possible_weak[j] = NONE; else if ( loss_upper > MAX_LOSS ) { /* lower weakening only */ if ( mod2(lbj) == EVEN ) { p_ilp->possible_weak[j] = EVEN; p_ilp->type_even_weak[j] = LOWER_BOUND; p_ilp->loss_even_weak[j] = loss_lower; } else { p_ilp->possible_weak[j] = ODD; p_ilp->type_odd_weak[j] = LOWER_BOUND; p_ilp->loss_odd_weak[j] = loss_lower; } } else if ( loss_lower > MAX_LOSS ) { /* upper weakening only */ if ( mod2(ubj) == EVEN ) { p_ilp->possible_weak[j] = EVEN; p_ilp->type_even_weak[j] = UPPER_BOUND; p_ilp->loss_even_weak[j] = loss_upper; } else { p_ilp->possible_weak[j] = ODD; p_ilp->type_odd_weak[j] = UPPER_BOUND; p_ilp->loss_odd_weak[j] = loss_upper; } } else if ( mod2(ubj) == mod2(lbj) ) { /* lower and upper bound have the same parity: choose the best weakening */ if ( mod2(ubj) == EVEN ) { p_ilp->possible_weak[j] = EVEN; if ( loss_lower <= loss_upper ) { p_ilp->type_even_weak[j] = LOWER_BOUND; p_ilp->loss_even_weak[j] = loss_lower; } else { p_ilp->type_even_weak[j] = UPPER_BOUND; p_ilp->loss_even_weak[j] = loss_upper; } } else { p_ilp->possible_weak[j] = ODD; if ( loss_lower <= loss_upper ) { p_ilp->type_odd_weak[j] = LOWER_BOUND; p_ilp->loss_odd_weak[j] = loss_lower; } else { p_ilp->type_odd_weak[j] = UPPER_BOUND; p_ilp->loss_odd_weak[j] = loss_upper; } } } else { /* lower and upper bound have different parities: consider both weakenings */ p_ilp->possible_weak[j] = BOTH; if ( mod2(ubj) == EVEN ) { p_ilp->type_even_weak[j] = UPPER_BOUND; p_ilp->loss_even_weak[j] = loss_upper; p_ilp->type_odd_weak[j] = LOWER_BOUND; p_ilp->loss_odd_weak[j] = loss_lower; } else { p_ilp->type_even_weak[j] = LOWER_BOUND; p_ilp->loss_even_weak[j] = loss_lower; p_ilp->type_odd_weak[j] = UPPER_BOUND; p_ilp->loss_odd_weak[j] = loss_upper; } } if ( loss_upper > loss_lower ) p_ilp->min_loss_by_weak[j] = loss_lower; else p_ilp->min_loss_by_weak[j] = loss_upper; } } /* scan the constraints and delete those which are trivially useless in the 0-1/2 cut separation */ cnttot = 0; for ( i = 0; i < inp_ilp->mr; i++ ) { begi = inp_ilp->mtbeg[i]; /* compute the row slack and the GCD of the entries of the row */ slacki = static_cast (inp_ilp->mrhs[i]); gcdi = inp_ilp->mrhs[i]; for ( ofsj = 0; ofsj < inp_ilp->mtcnt[i]; ofsj++ ) { ij = begi + ofsj; j = inp_ilp->mtind[ij]; aij = inp_ilp->mtval[ij]; slacki -= static_cast (aij ) * ( inp_ilp->xstar[j] ); gcdi = gcd(gcdi,aij); } if ( inp_ilp->msense[i] == 'G' ) slacki = -slacki; if ( slacki < -ZERO || ( inp_ilp->msense[i] == 'E' && slacki > ZERO ) ) { #ifdef COIN_DEVELOP printf("\n Warning: constraint %d in the model is violated:\n",i); printf("\n 0-1/2 cut separation is not possible\n"); printf("\nnumber of nonzero's %d\n",inp_ilp->mtcnt[i]); printf("nonzero's (col,coef,xstar) "); for (ofsj=0;ofsjmtcnt[i];ofsj++) printf("(%d,%d,%f) ", inp_ilp->mtind[begi+ofsj], inp_ilp->mtval[begi+ofsj], inp_ilp->xstar[inp_ilp->mtind[begi+ofsj]]); printf("\n"); printf("sense %c and rhs %d and slack %.5e\n",inp_ilp->msense[i],inp_ilp->mrhs[i], slacki); #endif //exit(0); slacki = INF; } p_ilp->slack[i] = slacki; /* mark the rows with slack greater than the maximum allowed */ if ( slacki > MAX_SLACK - EPS ) p_ilp->row_to_delete[i] = TRUE; else p_ilp->row_to_delete[i] = FALSE; /* store the odd entries in the (possibly scaled) row i */ //if ( gcdi != 1 ) //printf("Warning: constraint %d with nonprime coefficients\n",i); p_ilp->gcd[i] = gcdi; p_ilp->mrhs[i] = mod2(( inp_ilp->mrhs[i] / gcdi )); p_ilp->mtbeg[i] = cnttot; cnti = 0; for ( ofsj = 0; ofsj < inp_ilp->mtcnt[i]; ofsj++ ) { ij = begi + ofsj; j = inp_ilp->mtind[ij]; aij = mod2(( inp_ilp->mtval[ij] / gcdi )); if ( aij == ODD ) { if ( ! p_ilp->col_to_delete[j] ) { p_ilp->mtind[cnttot] = j; cnti++; cnttot++; } else if ( p_ilp->possible_weak[j] == ODD ) { if ( p_ilp->mrhs[i] == EVEN ) p_ilp->mrhs[i] = ODD; else p_ilp->mrhs[i] = EVEN; } } } p_ilp->mtcnt[i] = cnti; if ( cnti == 0 ) /* (scaled) row with even entries only */ p_ilp->row_to_delete[i] = TRUE; else { if ( cnti == 1 && slacki < EPS ) { /* the row could be deleted */ #ifdef PRINT printf("get_parity_ilp: row %d could be deleted since it\n",i); printf("has only one odd entry and is tight, but it is not ...\n"); #endif } } } p_ilp->mnz = cnttot; #ifdef REDUCTION /* remove identical rows in the parity matrix */ /* very trivial implementation */ for ( i = 0; i < p_ilp->mr; i++ ) for ( h = i+1; h < p_ilp->mr; h++ ) if ( ( p_ilp->mrhs[i] == p_ilp->mrhs[h] ) && ( p_ilp->mtcnt[i] == p_ilp->mtcnt[h] ) && ( ! p_ilp->row_to_delete[i] ) && ( ! p_ilp->row_to_delete[h] ) ) { begi = p_ilp->mtbeg[i]; begh = p_ilp->mtbeg[h]; equalih = TRUE; for ( ofsj = 0; ofsj < p_ilp->mtcnt[i]; ofsj++ ) /* the check assumes the indexes of the columns associated with each row are ordered in p_ilp->mtind[] ... */ if ( p_ilp->mtind[begi+ofsj] != p_ilp->mtind[begh+ofsj] ) { equalih = FALSE; break; } if ( equalih ) { if ( p_ilp->slack[h] > p_ilp->slack[i] ) p_ilp->row_to_delete[h] = TRUE; else p_ilp->row_to_delete[i] = TRUE; } } /* check for the existence of separate connected components in the parity matrix row intersection graph */ /* not implemented so far - if ever, the availability of the parity matrix in column form also would be really convenient */ #endif } /* separation graph subroutines */ #define SG_EDGE_INDEX(s_graph,J,K) ( ((J) < (K)) ? ( (s_graph->nnodes * (J)) - (((J)+1)*(J)/2) + (K) - (J) -1 ) : ( (s_graph->nnodes * (K)) - (((K)+1)*(K)/2) + (J) - (K) -1 ) ) /* initialize_sep_graph: allocate and initialize the data structure to contain the information associated with a separation graph */ separation_graph *Cgl012Cut::initialize_sep_graph() { int maxnodes, maxedges, nnodes, j, jk; int *nodes, *ind; separation_graph *s_graph; s_graph = reinterpret_cast (calloc(1,sizeof(separation_graph))); if ( s_graph == NULL ) alloc_error(const_cast("s_graph")); maxnodes = p_ilp->mc + 1; nnodes = 0; nodes = reinterpret_cast (calloc(maxnodes,sizeof(int))); if ( nodes == NULL ) alloc_error(const_cast("nodes")); ind = reinterpret_cast (calloc(maxnodes,sizeof(int))); if ( ind == NULL ) alloc_error(const_cast("ind")); for ( j = 0; j < p_ilp->mc; j++ ) if ( ! p_ilp->col_to_delete[j] ) { /* variable not removed from the separation problem */ nodes[nnodes] = j; ind[j] = nnodes; nnodes++; } /* take into account the special node */ nodes[nnodes] = maxnodes - 1; ind[maxnodes-1] = nnodes; nnodes++; s_graph->nnodes = nnodes; s_graph->nedges = 0; s_graph->nodes = reinterpret_cast (malloc(nnodes*sizeof(int))); if ( s_graph->nodes == NULL ) alloc_error(const_cast("s_graph->nodes")); for ( j = 0; j < nnodes; j++ ) s_graph->nodes[j] = nodes[j]; free(nodes); s_graph->ind = reinterpret_cast (malloc(maxnodes*sizeof(int))); if ( s_graph->ind == NULL ) alloc_error(const_cast("s_graph->ind")); for ( j = 0; j < maxnodes; j++ ) s_graph->ind[j] = ind[j]; free(ind); maxedges = (nnodes * (nnodes - 1)) / 2; s_graph->even_adj_list = reinterpret_cast (malloc(maxedges*sizeof(edge *))); if ( s_graph->even_adj_list == NULL ) alloc_error(const_cast("s_graph->even_adj_list")); s_graph->odd_adj_list = reinterpret_cast (malloc(maxedges*sizeof(edge *))); if ( s_graph->odd_adj_list == NULL ) alloc_error(const_cast("s_graph->odd_adj_list")); for ( jk = 0; jk < maxedges; jk++ ) s_graph->even_adj_list[jk] = s_graph->odd_adj_list[jk] = NULL; return(s_graph); } /* update_weight_sep_graph: consider a new edge obtained from the (weakened) parity ILP and (possibly) add it to the separation graph */ separation_graph *update_weight_sep_graph( int j, int k, /* endpoints of the new edge */ double weight, /* weight of the new edge */ short int parity, /* parity of the new edge */ int i, /* constraint associated with the new edge */ info_weak *i_weak, /* information associated with the weakening */ separation_graph *s_graph /* separation graph to be updated */ ) { int indj, indk, indjk; edge *old_edge, *new_edge; indj = s_graph->ind[j]; indk = s_graph->ind[k]; indjk = SG_EDGE_INDEX(s_graph,indj,indk); if ( parity == EVEN ) old_edge = s_graph->even_adj_list[indjk]; else old_edge = s_graph->odd_adj_list[indjk]; if ( old_edge == NULL ) { /* edge is not in the graph */ new_edge = reinterpret_cast (calloc(1,sizeof(edge))); if ( new_edge == NULL ) alloc_error(const_cast("new_edge")); new_edge->endpoint1 = indj; new_edge->endpoint2 = indk; new_edge->weight = weight; new_edge->parity = parity; new_edge->constr = i; new_edge->weak = i_weak; (s_graph->nedges)++; if ( parity == EVEN ) s_graph->even_adj_list[indjk] = new_edge; else s_graph->odd_adj_list[indjk] = new_edge; } else { /* edge is already in the graph */ if ( old_edge->weight > weight ) { /* replace the old edge */ old_edge->weight = weight; old_edge->constr = i; free_info_weak(old_edge->weak); old_edge->weak = i_weak; } else { /* keep the old edge */ free_info_weak(i_weak); } } return(s_graph); } #ifdef PRINT_CUTS void print_edge(edge *e) { printf("\n content of edge: endpoint1 = %d, endpoint2 = %d, weight = %f, parity = %d, constr = %d\n", e->endpoint1,e->endpoint2,e->weight,e->parity,e->constr); print_info_weak(e->weak); } #endif void free_edge(edge *e) { if ( e->weak != NULL ) free_info_weak(e->weak); free(e); } #ifdef PRINT_CUTS void print_sep_graph(separation_graph *s_graph) { int nnodes, maxedges, jk; nnodes = s_graph->nnodes; maxedges = (nnodes * (nnodes - 1)) / 2; printf("\n content of separation_graph: nnodes = %d, nedges = %d\n", nnodes, s_graph->nedges); print_int_vect(const_cast("nodes"),s_graph->nodes,nnodes); print_int_vect(const_cast("ind"),s_graph->ind,nnodes); for ( jk = 0; jk < maxedges; jk++ ) { if ( s_graph->even_adj_list[jk] != NULL ) print_edge(s_graph->even_adj_list[jk]); if ( s_graph->odd_adj_list[jk] != NULL ) print_edge(s_graph->odd_adj_list[jk]); } } #endif void free_sep_graph(separation_graph *s_graph) { int nnodes, maxedges, jk; nnodes = s_graph->nnodes; maxedges = (nnodes * (nnodes - 1)) / 2; for ( jk = 0; jk < maxedges; jk++ ) { if ( s_graph->even_adj_list[jk] != NULL ) free_edge(s_graph->even_adj_list[jk]); if ( s_graph->odd_adj_list[jk] != NULL ) free_edge(s_graph->odd_adj_list[jk]); } free(s_graph->nodes); free(s_graph->ind); free(s_graph->even_adj_list); free(s_graph->odd_adj_list); free(s_graph); } /* auxiliary graph subroutines - depend on the shortest path code used */ #ifndef CGL_NEW_SHORT // will error if we get here #include "Cgldikbd.c" #endif #define AG_TWIN1(J) 2 * J #define AG_TWIN2(J) 2 * J + 1 #define AG_MATE(J) 2 * static_cast ( J / 2 ) + ( J % 2 == EVEN ? 1 : 0 ) #define AG_TYPE(J,K) ( (J % 2) == (K % 2) ? EVEN : ODD ) #define SG_ORIG(J) static_cast (J / 2) /* define_aux_graph: construct the auxiliary graph for the shortest path computation - the data structure is based on that used by Cherkassky, Goldberg and Radzik's shortest path codes */ auxiliary_graph *define_aux_graph(separation_graph *s_graph /* input separation graph */) { int j, k, indjk, auxj1, auxj2, auxk1, auxk2, noutj, totoutj, narcs; edge *s_edge; auxiliary_graph *a_graph; a_graph = reinterpret_cast (calloc(1,sizeof(auxiliary_graph))); if ( a_graph == NULL ) alloc_error(const_cast("a_graph")); a_graph->nnodes = 2 * s_graph->nnodes; a_graph->narcs = 4 * s_graph->nedges; #ifndef CGL_NEW_SHORT a_graph->nodes = reinterpret_cast (calloc((a_graph->nnodes + 1),sizeof(node))); #else a_graph->nodes = reinterpret_cast (calloc((a_graph->nnodes + 1),sizeof(cgl_node))); #endif if ( a_graph->nodes == NULL ) alloc_error(const_cast("a_graph->nodes")); #ifndef CGL_NEW_SHORT a_graph->arcs = reinterpret_cast (calloc(((a_graph->narcs) + 1),sizeof(arc))); #else a_graph->arcs = reinterpret_cast (calloc(((a_graph->narcs) + 1),sizeof(cgl_arc))); #endif if ( a_graph->arcs == NULL ) alloc_error(const_cast("a_graph->arcs")); narcs = 0; for ( j = 0; j < s_graph->nnodes; j++ ) { /* count the number of edges incident with j in the separation graph */ totoutj = 0; for ( k = 0; k < s_graph->nnodes; k++ ) if ( k != j ) { indjk = SG_EDGE_INDEX(s_graph,j,k); if ( s_graph->even_adj_list[indjk] != NULL ) totoutj++; if ( s_graph->odd_adj_list[indjk] != NULL ) totoutj++; } auxj1 = AG_TWIN1(j); auxj2 = AG_TWIN2(j); a_graph->nodes[auxj1].index = auxj1; a_graph->nodes[auxj2].index = auxj2; #ifndef CGL_NEW_SHORT a_graph->nodes[auxj1].first = &(a_graph->arcs[narcs]); a_graph->nodes[auxj2].first = &(a_graph->arcs[narcs+totoutj]); #else a_graph->nodes[auxj1].firstArc = &(a_graph->arcs[narcs]); a_graph->nodes[auxj2].firstArc = &(a_graph->arcs[narcs+totoutj]); #endif /* add the edges as arcs outgoing from j to the auxiliary graph */ noutj = 0; for ( k = 0; k < s_graph->nnodes; k++ ) { if ( k != j ) { auxk1 = AG_TWIN1(k); auxk2 = AG_TWIN2(k); indjk = SG_EDGE_INDEX(s_graph,j,k); s_edge = s_graph->even_adj_list[indjk]; if ( s_edge != NULL ) { /* there is an even edge between j and k */ #ifndef CGL_NEW_SHORT a_graph->arcs[narcs].len = a_graph->arcs[narcs+totoutj].len = (int) (s_edge->weight * ISCALE); a_graph->arcs[narcs].head = &(a_graph->nodes[auxk1]); a_graph->arcs[narcs+totoutj].head = &(a_graph->nodes[auxk2]); #else a_graph->arcs[narcs].length = a_graph->arcs[narcs+totoutj].length = static_cast (s_edge->weight * ISCALE); a_graph->arcs[narcs].to = auxk1; a_graph->arcs[narcs+totoutj].to = auxk2; #endif narcs++; noutj++; } s_edge = s_graph->odd_adj_list[indjk]; if ( s_edge != NULL ) { /* there is an odd edge between j and k */ #ifndef CGL_NEW_SHORT a_graph->arcs[narcs].len = a_graph->arcs[narcs+totoutj].len = (int) (s_edge->weight * ISCALE); a_graph->arcs[narcs].head = &(a_graph->nodes[auxk2]); a_graph->arcs[narcs+totoutj].head = &(a_graph->nodes[auxk1]); #else a_graph->arcs[narcs].length = a_graph->arcs[narcs+totoutj].length = static_cast (s_edge->weight * ISCALE); a_graph->arcs[narcs].to = auxk2; a_graph->arcs[narcs+totoutj].to = auxk1; #endif /* this looks really useless - to be removed ... if ( noutj == 0 ) { a_graph->nodes[auxj1].first = &(a_graph->arcs[narcs]); a_graph->nodes[auxj2].first = &(a_graph->arcs[narcs+totoutj]); } ... */ narcs++; noutj++; } } } narcs += totoutj; } #ifndef CGL_NEW_SHORT a_graph->nodes[a_graph->nnodes].first = &(a_graph->arcs[narcs]); #else a_graph->nodes[a_graph->nnodes].firstArc = &(a_graph->arcs[narcs]); #endif return(a_graph); } /* cancel_node_aux_graph: remove the node j in the separation graph from the auxiliary graph - all the outgoing arc lengths are set to a large value */ auxiliary_graph *cancel_node_aux_graph( int j, /* index of the node in the separation graph */ auxiliary_graph *a_graph /* auxiliary graph to be updated */ ) { int auxj1, auxj2; #ifndef CGL_NEW_SHORT arc *arc_ptr; #else cgl_arc *arc_ptr; #endif auxj1 = AG_TWIN1(j); auxj2 = AG_TWIN2(j); #ifndef CGL_NEW_SHORT for ( arc_ptr = a_graph->nodes[auxj1].first; arc_ptr < a_graph->nodes[auxj1+1].first; arc_ptr++ ) (*arc_ptr).len = ISCALE; for ( arc_ptr = a_graph->nodes[auxj2].first; arc_ptr < a_graph->nodes[auxj2+1].first; arc_ptr++ ) (*arc_ptr).len = ISCALE; #else for ( arc_ptr = a_graph->nodes[auxj1].firstArc; arc_ptr < a_graph->nodes[auxj1+1].firstArc; arc_ptr++ ) (*arc_ptr).length = ISCALE; for ( arc_ptr = a_graph->nodes[auxj2].firstArc; arc_ptr < a_graph->nodes[auxj2+1].firstArc; arc_ptr++ ) (*arc_ptr).length = ISCALE; #endif return(a_graph); } #ifdef PRINT_CUTS #ifndef CGL_NEW_SHORT void print_node(node *n) { printf("\n content of node (addr = %d): first = %d, dist = %d, parent = %d, next = %d, prev = %d, status = %d\n", (int)n,(int)(*n).first,(*n).dist,(int)(*n).parent,(int)(*n).next,(int)(*n).prev, (*n).status); } void print_arc(arc *a) { printf("\n content of arc (addr = %d): len = %d, head = %d\n", (int)a,(*a).len,(int)(*a).head); } void print_node_vect(char *s,node *v,int n) { int i; printf("node vector %s:",s); for ( i = 0; i < n; i++ ) print_node(&v[i]); printf("\n"); } void print_arc_vect(char *s,arc *v,int n) { int i; printf("arc vector %s:",s); for ( i = 0; i < n; i++ ) print_arc(&v[i]); printf("\n"); } #else void print_node(cgl_node *n) { printf("\n content of node (addr = %p): first = %p, dist = %d, parent = %p\n", reinterpret_cast(n), reinterpret_cast((*n).firstArc), (*n).distanceBack, static_cast((*n).parentNode)); } void print_arc(cgl_arc *a) { printf("\n content of arc (addr = %p): len = %d, head = %d\n", reinterpret_cast(a),(*a).length,static_cast((*a).to)); } void print_node_vect(char *s,cgl_node *v,int n) { int i; printf("node vector %s:",s); for ( i = 0; i < n; i++ ) print_node(&v[i]); printf("\n"); } void print_arc_vect(char *s,cgl_arc *v,int n) { int i; printf("arc vector %s:",s); for ( i = 0; i < n; i++ ) print_arc(&v[i]); printf("\n"); } #endif void print_aux_graph(auxiliary_graph *a_graph) { printf("\n content of auxiliary graph: nnodes = %d, narcs = %d\n", a_graph->nnodes,a_graph->narcs); print_node_vect(const_cast("nodes"),a_graph->nodes,a_graph->nnodes); print_arc_vect(const_cast("nodes"),a_graph->arcs,a_graph->narcs); } #endif void free_aux_graph(auxiliary_graph *a_graph) { free(a_graph->nodes); free(a_graph->arcs); free(a_graph); } /* odd cycles management subroutines */ /* simple_cycle: check whether a given cycle is simple (and therefore may correspond to a non-dominated ineq.) */ short int simple_cycle(cycle *s_cyc /* cycle to be checked */) { int i, e, maxnodes; int *cnt; maxnodes = 0; for ( e = 0; e < s_cyc->length; e++ ) { if (!s_cyc->edge_list[e]) { // bad maxnodes=-1; abort();//break; } i = s_cyc->edge_list[e]->endpoint1; if ( i > maxnodes ) maxnodes = i; i = s_cyc->edge_list[e]->endpoint2; if ( i > maxnodes ) maxnodes = i; } if (maxnodes<0) return FALSE; cnt = reinterpret_cast (calloc(maxnodes+1,sizeof(int))); if ( cnt == NULL ) alloc_error(const_cast("cnt")); //for ( i = 0; i <= maxnodes; i++ ) cnt[i] = 0; for ( e = 0; e < s_cyc->length; e++ ) { i = s_cyc->edge_list[e]->endpoint1; cnt[i]++; if ( cnt[i] > 2 ) { free(cnt); return(FALSE); } i = s_cyc->edge_list[e]->endpoint2; cnt[i]++; if ( cnt[i] > 2 ) { free(cnt); return(FALSE); } } free(cnt); return(TRUE); } /* same_cycle: check whether two cycles are identical (assumes the first nodes of the cycles coincide) */ short int same_cycle(cycle *s_cyc1, cycle *s_cyc2 /* cycles to be compared */) { int e, eb; short int same; if ( s_cyc1->length != s_cyc2->length ) return(FALSE); /* check the cycles in the same direction ... */ same = TRUE; for ( e = 0; e < s_cyc1->length; e++ ) { if ( s_cyc1->edge_list[e] != s_cyc2->edge_list[e] ) { same = FALSE; break; } } if ( same ) return(TRUE); /* ... and in reverse direction */ same = TRUE; for ( e = 0, eb = s_cyc2->length - 1; e < s_cyc1->length; e++, eb-- ) { if ( s_cyc1->edge_list[e] != s_cyc2->edge_list[eb] ) { same = FALSE; break; } } if ( same ) return(TRUE); return(FALSE); } #ifdef PRINT_CUTS void print_cycle(cycle *s_cycle) { int e; printf("\n content of cycle: weight = %f, length = %d\n", s_cycle->weight,s_cycle->length); for ( e = 0; e < s_cycle->length; e++ ) print_edge(s_cycle->edge_list[e]); } #endif void free_cycle(cycle *s_cycle) { free(s_cycle->edge_list); free(s_cycle); } /* initialize_cycle_list: allocate and initialize the cycle list data structure */ cycle_list *initialize_cycle_list(int max_cyc /* maximum number of cycles in the list */) { cycle_list *s_cycle_list; s_cycle_list = reinterpret_cast (calloc(1,sizeof(cycle_list))); if ( s_cycle_list == NULL ) alloc_error(const_cast("s_cycle_list")); s_cycle_list->cnum = 0; s_cycle_list->list = reinterpret_cast (calloc(max_cyc,sizeof(cycle *))); if ( s_cycle_list->list == NULL ) alloc_error(const_cast("s_cycle_list->list")); return(s_cycle_list); } /* add_cycle_to_list: add a new cycle to the cycle list data structure (if not already in the list) */ cycle_list *add_cycle_to_list( cycle *s_cycle, /* pointer to the cycle to be added to the list */ cycle_list *s_cycle_list /* input cycle list to be updated */ ) { int c; if ( ! simple_cycle(s_cycle) ) { free_cycle(s_cycle); return(s_cycle_list); } for ( c = 0; c < s_cycle_list->cnum; c++ ) if ( same_cycle(s_cycle,s_cycle_list->list[c]) ) { free_cycle(s_cycle); return(s_cycle_list); } s_cycle_list->list[s_cycle_list->cnum] = s_cycle; (s_cycle_list->cnum)++; return(s_cycle_list); } void free_cycle_list(cycle_list *s_cycle_list) { int c; for ( c = 0; c < s_cycle_list->cnum; c++ ) free_cycle(s_cycle_list->list[c]); free(s_cycle_list->list); free(s_cycle_list); } #ifdef PRINT_CUTS void print_cycle_list(cycle_list *s_cycle_list) { int c; printf("\n content of cycle_list: cnum = %d\n",s_cycle_list->cnum); for ( c = 0; c < s_cycle_list->cnum; c++ ) print_cycle(s_cycle_list->list[c]); } #endif /* get_shortest_odd_cycle_list: computation of the shortest odd cycles visiting a certain node in the separation graph, and each other possible intermediate node, using the auxiliary graph data structure for the shortest path computation - all the cycles in the list are different from each other */ cycle_list *get_shortest_odd_cycle_list( int j, /* first node to be visited by the odd cycle */ separation_graph *s_graph, /* current separation graph */ auxiliary_graph *a_graph /* auxiliary graph for the shortest path computation */ ) { int source, sink, curr, pred, totedges, k, t, kt; double weight; #ifndef CGL_NEW_SHORT //node *source_ptr, *sink_ptr, *first_ptr; #else //cgl_node *source_ptr, *sink_ptr, *first_ptr; #endif edge *curr_edge; short_path_node *forw_arb, *backw_arb; cycle *s_cycle; cycle_list *s_cycle_list; #ifdef TIME second_(&tsi); #endif s_cycle_list = initialize_cycle_list((a_graph->nnodes)-2); source = AG_TWIN1(j); sink = AG_TWIN2(j); //source_ptr = &(a_graph->nodes[source]); //sink_ptr = &(a_graph->nodes[sink]); //first_ptr = &(a_graph->nodes[0]); /* compute the shortest path arborescence rooted at source and the shortest path arborescence rooted at sink (that comes for free due to symmetry) and store them (the path information is hidden into aux_graph) */ #ifdef TIME second_(&ti); #endif #ifndef CGL_NEW_SHORT { int nNodes = a_graph->nnodes; int nArcs = a_graph->narcs; cgl_arc * arcs = new cgl_arc [nArcs]; for (int i=0;iarcs[i].len; arcs[i].to=a_graph->arcs[i].head->index; } cgl_node * nodes = new cgl_node[nNodes+1]; for (int i=0;inodes[i].first-a_graph->arcs; nodes[i].firstArc=arcs+iArc; nodes[i].index=i; } int iArc = a_graph->nodes[nNodes].first-a_graph->arcs; nodes[nNodes].firstArc=arcs+iArc; cgl_graph graph; graph.nnodes=nNodes; graph.narcs=nArcs; graph.nodes=nodes; graph.arcs=arcs; cglShortestPath(&graph,source,ISCALE); dikbd(a_graph->nnodes,first_ptr,source_ptr,ISCALE); for ( k = 0; k < a_graph->nnodes; k++ ) { if ( a_graph->nodes[k].parent != NULL ) { int distance1 = a_graph->nodes[k].dist; int distance2 = graph.nodes[k].distanceBack; assert (distance1==distance2); } else { // printf("null parent %d\n",k); } } } #else cglShortestPath(a_graph,source,ISCALE); #endif #ifdef TIME second_(&tf); path_time += tf - ti; #endif forw_arb = reinterpret_cast (calloc(a_graph->nnodes,sizeof(short_path_node))); if ( forw_arb == NULL ) alloc_error(const_cast("forw_arb")); for ( k = 0; k < a_graph->nnodes; k++ ) { #ifndef CGL_NEW_SHORT if ( a_graph->nodes[k].parent != NULL ) { forw_arb[k].dist = a_graph->nodes[k].dist; forw_arb[k].pred = a_graph->nodes[k].parent->index; } #else if ( a_graph->nodes[k].parentNode >=0 ) { forw_arb[k].dist = a_graph->nodes[k].distanceBack; forw_arb[k].pred = a_graph->nodes[k].parentNode; } #endif else { forw_arb[k].dist = COIN_INT_MAX; forw_arb[k].pred = NONE; } } backw_arb = reinterpret_cast (calloc(a_graph->nnodes,sizeof(short_path_node))); if ( backw_arb == NULL ) alloc_error(const_cast("backw_arb")); for ( k = 0; k < a_graph->nnodes; k++ ) { #ifndef CGL_NEW_SHORT if ( a_graph->nodes[k].parent != NULL ) { backw_arb[AG_MATE(k)].dist = a_graph->nodes[k].dist; backw_arb[AG_MATE(k)].pred = AG_MATE(a_graph->nodes[k].parent->index); } #else if ( a_graph->nodes[k].parentNode >=0) { backw_arb[AG_MATE(k)].dist = a_graph->nodes[k].distanceBack; backw_arb[AG_MATE(k)].pred = AG_MATE(a_graph->nodes[k].parentNode); } #endif else { backw_arb[AG_MATE(k)].dist = COIN_INT_MAX; backw_arb[AG_MATE(k)].pred = NONE; } } #ifdef USELESS /* compute second the shortest path anti-arborescence rooted at sink (which coincides with the arborescence since aux_graph is symmetrical) and store it */ #ifdef TIME second_(&ti); #endif cc = dikbd(a_graph->nnodes,first_ptr,sink_ptr,ISCALE); #ifdef TIME second_(&tf); path_time += tf - ti; #endif backw_arb = (short_path_node *) calloc(a_graph->nnodes,sizeof(short_path_node)); if ( backw_arb == NULL ) alloc_error("backw_arb"); for ( k = 0; k < a_graph->nnodes; k++ ) { backw_arb[k].dist = a_graph->nodes[k].dist; backw_arb[k].pred = a_graph->nodes[k].parent->index; } #endif /* consider each possible intermediate node in aux_graph */ for ( k = 0; k < s_graph->nnodes; k++ ) { if ( k != j ) { for ( t = 1; t <= 2; t++ ) { if ( t == 1 ) kt = AG_TWIN1(k); else kt = AG_TWIN2(k); weight = (static_cast (forw_arb[kt].dist + backw_arb[kt].dist)) / (static_cast (ISCALE)); if ( weight < MAX_CYCLE_WEIGHT + EPS ) { totedges = 0; /* count how many edges are in the forward path from source ... */ curr = kt; do { if (curr<0) { totedges=-1; break; } curr = forw_arb[curr].pred; totedges++; } while ( curr != source ); if (totedges>=0) { /* ... and in the backward path to sink */ curr = kt; do { if (curr<0) { totedges=-1; break; } curr = backw_arb[curr].pred; totedges++; } while ( curr != sink ); } if (totedges>0) { s_cycle = reinterpret_cast (calloc(1,sizeof(cycle))); if ( s_cycle == NULL ) alloc_error(const_cast("s_cycle")); s_cycle->weight = weight; s_cycle->length = totedges; s_cycle->edge_list = reinterpret_cast (calloc(totedges,sizeof(edge *))); if ( s_cycle->edge_list == NULL ) alloc_error(const_cast("s_cycle->edge_list")); /* define the set of edges corresponding to the paths in sep_graph */ totedges = 0; /* forward path from source ... */ curr = kt; do { pred = forw_arb[curr].pred; if ( AG_TYPE(pred,curr) == EVEN ) curr_edge = s_graph->even_adj_list [SG_EDGE_INDEX(s_graph,SG_ORIG(curr),SG_ORIG(pred))]; else curr_edge = s_graph->odd_adj_list [SG_EDGE_INDEX(s_graph,SG_ORIG(curr),SG_ORIG(pred))]; s_cycle->edge_list[totedges] = curr_edge; curr = pred; totedges++; } while ( curr != source ); /* ... and backward path to sink */ curr = kt; do { pred = backw_arb[curr].pred; if ( AG_TYPE(pred,curr) == EVEN ) curr_edge = s_graph->even_adj_list [SG_EDGE_INDEX(s_graph,SG_ORIG(curr),SG_ORIG(pred))]; else curr_edge = s_graph->odd_adj_list [SG_EDGE_INDEX(s_graph,SG_ORIG(curr),SG_ORIG(pred))]; s_cycle->edge_list[totedges] = curr_edge; curr = pred; totedges++; } while ( curr != sink ); /* insert the new cycle in the list */ s_cycle_list = add_cycle_to_list(s_cycle,s_cycle_list); } } } } } free(forw_arb); free(backw_arb); #ifdef TIME second_(&tsf); cycle_time += tsf - tsi; #endif return(s_cycle_list); } /* cut management subroutines */ /* initialize_cut_list: allocate and initialize the cut list data structure */ cut_list *initialize_cut_list(int max_cut /* maximum number of cuts in the list */) { cut_list *cuts; cuts = reinterpret_cast (calloc(1,sizeof(cut_list))); if ( cuts == NULL ) alloc_error(const_cast("cuts")); cuts->cnum = 0; cuts->list = reinterpret_cast (calloc(max_cut,sizeof(cut *))); return(cuts); } #ifdef PRINT_CUTS void Cgl012Cut::print_cut(cut *v_cut) { printf("\n content of cut: n_of_constr = %d, cnzcnt = %d, crhs = %d, csense = %c, violation = %f\n", v_cut->n_of_constr,v_cut->cnzcnt,v_cut->crhs,v_cut->csense,v_cut->violation); print_int_vect(const_cast("cind"),v_cut->cind,v_cut->cnzcnt); print_int_vect(const_cast("cval"),v_cut->cval,v_cut->cnzcnt); if ( v_cut->constr_list != NULL ) print_int_vect(const_cast("constr_list"),v_cut->constr_list,v_cut->n_of_constr); if ( v_cut->in_constr_list != NULL ) print_short_int_vect(const_cast("in_constr_list"),v_cut->in_constr_list,inp_ilp->mr); ; } void Cgl012Cut::print_cut_list(cut_list *cuts) { int c; printf("\n content of cut_list: cnum = %d\n",cuts->cnum); for ( c = 0; c < cuts->cnum; c++ ) print_cut(cuts->list[c]); } #endif void free_cut(cut *v_cut) { if ( v_cut->constr_list != NULL ) free(v_cut->constr_list); if ( v_cut->in_constr_list != NULL ) free(v_cut->in_constr_list); if ( v_cut->cind != NULL ) free(v_cut->cind); if ( v_cut->cval != NULL ) free(v_cut->cval); free(v_cut); } void free_cut_list(cut_list *cuts) { int c; for ( c = 0; c < cuts->cnum; c++ ) if ( cuts->list[c] != NULL ) free_cut(cuts->list[c]); free(cuts->list); free(cuts); } /* get_ori_cut_coef: get the coefficients of a cut, before dividing by 2 and rounding, starting from the list of the constraints combined to get the cut */ short int Cgl012Cut::get_ori_cut_coef( int n_of_constr, /* number of constraints combined */ int *constr_list, /* list of the constraints combined */ int *ccoef, /* cut left hand side coefficients */ int *crhs, /* cut right hand side */ short int only_viol /* flag which tells whether only an inequality of slack smaller than MAX_SLACK is of interest (TRUE) otherwise (FALSE) */ ) { int h, i, begi, gcdi, ofsj; double tot_slack; /* fast check of the possible violation of the cut */ if ( only_viol ) { tot_slack = 0.0; for ( h = 0; h < n_of_constr; h++ ) { tot_slack += p_ilp->slack[constr_list[h]]; if ( tot_slack > MAX_SLACK - EPS ) return(FALSE); } } //for ( j = 0; j < inp_ilp->mc; j++ ) //ccoef[j] = 0; memset(ccoef,0,inp_ilp->mc*sizeof(int)); (*crhs) = 0; for ( h = 0; h < n_of_constr; h++ ) { i = constr_list[h]; begi = inp_ilp->mtbeg[i]; gcdi = p_ilp->gcd[i]; if ( inp_ilp->msense[i] != 'G' ) { if ( gcdi == 1 ) { for ( ofsj = 0; ofsj < inp_ilp->mtcnt[i]; ofsj++ ) ccoef[inp_ilp->mtind[begi+ofsj]] += inp_ilp->mtval[begi+ofsj]; (*crhs) += inp_ilp->mrhs[i]; } else { for ( ofsj = 0; ofsj < inp_ilp->mtcnt[i]; ofsj++ ) ccoef[inp_ilp->mtind[begi+ofsj]] += inp_ilp->mtval[begi+ofsj] / gcdi; (*crhs) += inp_ilp->mrhs[i] / gcdi; } } else { if ( gcdi == 1 ) { for ( ofsj = 0; ofsj < inp_ilp->mtcnt[i]; ofsj++ ) ccoef[inp_ilp->mtind[begi+ofsj]] -= inp_ilp->mtval[begi+ofsj]; (*crhs) -= inp_ilp->mrhs[i]; } else { for ( ofsj = 0; ofsj < inp_ilp->mtcnt[i]; ofsj++ ) ccoef[inp_ilp->mtind[begi+ofsj]] -= inp_ilp->mtval[begi+ofsj] / gcdi; (*crhs) -= inp_ilp->mrhs[i] / gcdi; } } } return(TRUE); } /* best_cut: find the coefficients, the rhs and the violation of the best possible cut that can be obtained by weakening a given set of coefficients to even and a rhs to odd, dividing by 2 and rounding */ short int Cgl012Cut::best_cut( int *ccoef, /* vector of the coefficients */ int *crhs, /* pointer to rhs value */ double *violation, /* violation of the cut */ short int update, /* TRUE/FALSE: if TRUE, the new ccoef and crhs are given on output */ short int only_viol /* flag which tells whether only an inequality of slack smaller than MAX_SLACK is of interest (TRUE) otherwise (FALSE) */ ) { int j, n_to_weak; short int original_parity; double original_slack, best_even_slack, best_odd_slack; int *vars_to_weak; info_weak *info_even_weak, *info_odd_weak; /* choose the best weakening for the variables whose coefficient is not odd - this hopefully produces a stronger cut than that associated with the weakened inequalities to define the edges */ vars_to_weak = reinterpret_cast (calloc(inp_ilp->mc,sizeof(int))); if ( vars_to_weak == NULL ) alloc_error(const_cast("vars_to_weak")); n_to_weak = 0; original_slack = 0.0; for ( j = 0; j < inp_ilp->mc; j++ ) { if ( ccoef[j] != 0 ) { if ( mod2(ccoef[j]) == ODD ) { vars_to_weak[n_to_weak] = j; n_to_weak++; } original_slack -= inp_ilp->xstar[j] * static_cast (ccoef[j]); } } original_slack += static_cast (*crhs); if ( original_slack > MAX_SLACK - EPS ) { free(vars_to_weak); return(FALSE); } original_parity = mod2(*crhs); if ( best_weakening(n_to_weak,vars_to_weak, original_parity,original_slack, &best_even_slack,&best_odd_slack, &info_even_weak,&info_odd_weak, TRUE,only_viol) == ODD ) { *violation = ( 1.0 - best_odd_slack ) / 2.0; if ( ! update ) { /* new ccoef and rhs are not required on output */ free(vars_to_weak); free_info_weak(info_odd_weak); return(TRUE); } /* update ccoef and crhs according to the best odd weakening */ for ( j = 0; j < n_to_weak; j++ ) if ( info_odd_weak->type[j] == LOWER_BOUND ) { ccoef[vars_to_weak[j]]--; *crhs -= inp_ilp->vlb[vars_to_weak[j]]; } else { ccoef[vars_to_weak[j]]++; *crhs += inp_ilp->vub[vars_to_weak[j]]; } /* compute and check the correctness of the cut coefficients */ for ( j = 0; j < inp_ilp->mc; j++ ) { if ( mod2(ccoef[j]) == ODD ) { printf("!!! Error 2 in weakening a cut !!!\n"); exit(0); } if ( ccoef[j] != 0 ) ccoef[j] /= 2; } if ( mod2(*crhs) == EVEN ) { printf("!!! Error 1 in weakening a cut !!!\n"); exit(0); } *crhs = (*crhs - 1) / 2; free(vars_to_weak); free_info_weak(info_odd_weak); return(TRUE); } else { free(vars_to_weak); return(FALSE); } } /* define_cut: construct a cut data structure from a vector of coefficients and a right-hand-side */ cut *Cgl012Cut::define_cut( int *ccoef, /* coefficients of the cut */ int crhs /* right hand side of the cut */ ) { int cnzcnt, j; cut *v_cut; v_cut = reinterpret_cast (calloc(1,sizeof(cut))); if ( v_cut == NULL ) alloc_error(const_cast("v_cut")); v_cut->crhs = crhs; cnzcnt = 0; for ( j = 0; j < inp_ilp->mc; j++ ) if ( ccoef[j] != 0 ) cnzcnt++; v_cut->cnzcnt = cnzcnt; v_cut->csense = 'L'; v_cut->cind = reinterpret_cast (calloc(cnzcnt,sizeof(int))); if ( v_cut->cind == NULL ) alloc_error(const_cast("v_cut->cind")); v_cut->cval = reinterpret_cast (calloc(cnzcnt,sizeof(int))); if ( v_cut->cval == NULL ) alloc_error(const_cast("v_cut->cval")); cnzcnt = 0; v_cut->violation = 0.0; for ( j = 0; j < inp_ilp->mc; j++ ) if ( ccoef[j] != 0 ) { v_cut->cind[cnzcnt] = j; v_cut->cval[cnzcnt] = ccoef[j]; v_cut->violation += inp_ilp->xstar[j] * static_cast (ccoef[j]); cnzcnt++; } v_cut->violation -= static_cast (crhs); return(v_cut); } /* get_cut: extract a hopefully violated cut from an odd cycle of the separation graph */ cut *Cgl012Cut::get_cut( cycle *s_cyc /* shortest odd cycles identified in the separation graph */ ) { int i, e, crhs; short int ok; /* short int original_parity; */ double violation; /* double original_slack, best_even_slack, best_odd_slack; */ int *ccoef /*, *vars_to_weak */ ; /* info_weak *info_even_weak, *info_odd_weak; */ cut *v_cut; int ncomb; int *comb; short int *flag_comb; #ifndef CGGGGG static int iter = 0; static double gap, maxgap = 0.0; #endif #ifdef TIME second_(&tsi); cut_ncalls++; #endif /* compute the cut obtained by adding-up all the constraints corresponding to edges in the cycle, in their non-weak form */ #ifdef TIME second_(&tii); #endif ccoef = reinterpret_cast (calloc(inp_ilp->mc,sizeof(int))); if ( ccoef == NULL ) alloc_error(const_cast("ccoef")); ncomb = 0; comb = reinterpret_cast (calloc(inp_ilp->mr,sizeof(int))); if ( comb == NULL ) alloc_error(const_cast("comb")); flag_comb = reinterpret_cast (calloc(inp_ilp->mr,sizeof(short int))); if ( flag_comb == NULL ) alloc_error(const_cast("flag_comb")); #if 0 // no need to as calloc used for ( i = 0; i < inp_ilp->mr; i++ ) flag_comb[i] = OUT; for ( j = 0; j < inp_ilp->mc; j++ ) ccoef[j] = 0; #endif crhs = 0; for ( e = 0; e < s_cyc->length; e++ ) { i = (s_cyc->edge_list[e])->constr; if ( i >= 0 ) { /* the edge is not associated with a bound constraint */ comb[ncomb] = i; ncomb++; flag_comb[i] = IN; } } ok = get_ori_cut_coef(ncomb,comb,ccoef,&crhs,TRUE); #ifdef TIME second_(&tff); coef_time += tff - tii; #endif ok = ok && best_cut(ccoef,&crhs,&violation,TRUE,TRUE); if ( ! ok ) { free(ccoef); free(comb); free(flag_comb); #ifdef TIME second_(&tsf); cut_time += tsf - tsi; #endif return(NULL); } v_cut = define_cut(ccoef,crhs); iter++; if ( v_cut->violation > violation + EPS || v_cut->violation < violation - EPS ) { //printf("Error in violation check\n"); //printf("v_cut->violation %f violation %f gap %f maxgap (previous) %f\n", // v_cut->violation,violation,v_cut->violation-violation,maxgap); //printf("iter %d\n",iter); //exit(0); free_cut(v_cut); free(ccoef); free(comb); free(flag_comb); errorNo=1; return(NULL); } gap = v_cut->violation - violation; if ( gap < 0.0 ) gap = -gap; if ( gap > maxgap ) maxgap = gap; v_cut->n_of_constr = ncomb; v_cut->constr_list = comb; v_cut->in_constr_list = flag_comb; free(ccoef); #ifdef TIME second_(&tsf); cut_time += tsf - tsi; #endif return(v_cut); } /* cut_score: define the score of a (violated) cut */ double Cgl012Cut::cut_score( int *ccoef, /* cut left hand side coefficients */ int crhs, /* cut right hand side */ double viol, /* cut violation */ short int only_viol /* flag which tells whether only an inequality of slack smaller than MAX_SLACK is of interest (TRUE) otherwise (FALSE) */ ) { int j, norm; /* very simple score: violation divided/multiplied by the lhs norm */ if ( only_viol && viol < MIN_VIOLATION ) return(-INF); norm = 0; for ( j = 0; j < p_ilp->mc; j++ ) { if ( ccoef[j] != 0 ) norm += ccoef[j] * ccoef[j]; } if ( viol > 0.0 ) return (viol / sqrt(static_cast (norm))); else return (viol * sqrt(static_cast (norm))); } /* same_cut: check whether two cuts are identical - not too clever (assumes the sparse coefficients are sorted by column index) */ short int same_cut(cut *cut1, cut *cut2 /* cuts to be compared */) { int j; if ( cut1->cnzcnt != cut2->cnzcnt ) return(FALSE); if ( cut1->crhs != cut2->crhs ) return(FALSE); if ( cut1->csense != cut2->csense ) return(FALSE); for ( j = 0; j < cut1->cnzcnt; j++ ) { if ( cut1->cind[j] != cut2->cind[j] ) return(FALSE); if ( cut1->cval[j] != cut2->cval[j] ) return(FALSE); } return(TRUE); } /* add_cut_to_list: adds a cut to a list after checking that a copy of the same cut is not already in the list - no checking is made about cuts dominating each other or implied by other cuts in the list plus the constraints of the original problem */ cut_list *add_cut_to_list( cut *v_cut, /* pointer to the violated cut to be added to the list */ cut_list *cuts /* input cut list to be updated */ ) { int c; for ( c = 0; c < cuts->cnum; c++ ) { if ( same_cut(v_cut,cuts->list[c]) ) { free_cut(v_cut); return(cuts); } } cuts->list[cuts->cnum] = v_cut; cuts->cnum++; return(cuts); } /* getcuts: pick the 0-1/2 cuts in the list and give them on output */ void getcuts( cut_list *cuts, /* input cut list */ int *cnum, /* number of violated 0-1/2 cuts identified by the procedure */ int *cnzcnt, /* overall number of nonzero's in the cuts */ int **cbeg, /* starting position of each cut in arrays cind and cval */ int **ccnt, /* number of entries of each cut in arrays cind and cval */ int **cind, /* column indices of the nonzero entries of the cuts */ int **cval, /* values of the nonzero entries of the cuts */ int **crhs, /* right hand sides of the cuts */ char **csense /* senses of the cuts: 'L', 'G' or 'E' */ ) { int i, ofsj, count; cut *cut_ptr; /* allocate the memory for the output vectors */ (*cnum) = cuts->cnum; (*cnzcnt) = 0; for ( i = 0; i < cuts->cnum; i++ ) (*cnzcnt) += (cuts->list[i])->cnzcnt; /* if ( (*cbeg) != NULL ) free(*cbeg); */ (*cbeg) = reinterpret_cast (calloc((*cnum),sizeof(int))); if ( (*cbeg) == NULL ) alloc_error(const_cast("*cbeg")); /* if ( (*ccnt) != NULL ) free(*ccnt); */ (*ccnt) = reinterpret_cast (calloc((*cnum),sizeof(int))); if ( (*ccnt) == NULL ) alloc_error(const_cast("*ccnt")); /* if ( (*crhs) != NULL ) free(*crhs); */ (*crhs) = reinterpret_cast (calloc((*cnum),sizeof(int))); if ( (*crhs) == NULL ) alloc_error(const_cast("*crhs")); /* if ( (*csense) != NULL ) free(*csense); */ (*csense) = reinterpret_cast (calloc((*cnum),sizeof(char))); if ( (*csense) == NULL ) alloc_error(const_cast("*csense")); /* if ( (*cind) != NULL ) free(*cind); */ (*cind) = reinterpret_cast (calloc((*cnzcnt),sizeof(int))); if ( (*cind) == NULL ) alloc_error(const_cast("*cind")); /* if ( (*cval) != NULL ) free(*cval); */ (*cval) = reinterpret_cast (calloc((*cnzcnt),sizeof(int))); if ( (*cval) == NULL ) alloc_error(const_cast("*cval")); /* transfer the cuts information into the output data structures */ count = 0; for ( i = 0; i < cuts->cnum; i++ ) { cut_ptr = cuts->list[i]; (*cbeg)[i] = count; (*ccnt)[i] = cut_ptr->cnzcnt; (*crhs)[i] = cut_ptr->crhs; (*csense)[i] = cut_ptr->csense; for ( ofsj = 0; ofsj < cut_ptr->cnzcnt; ofsj++ ) { (*cind)[count] = cut_ptr->cind[ofsj]; (*cval)[count] = cut_ptr->cval[ofsj]; count++; } } } /* actual separation subroutines */ /* best_weakening: find the best upper/lower bound weakening of a set of variables */ int Cgl012Cut::best_weakening( int n_to_weak, /* number of variables to weaken */ int *vars_to_weak, /* indices of the variables to weaken */ short int original_parity, /* original parity of the constraint to weaken */ double original_slack, /* original slack of the constraint to weaken */ double *best_even_slack, /* best possible slack of a weakened constraint with even right-hand-side */ double *best_odd_slack, /* best possible slack of a weakened constraint with odd right-hand-side */ info_weak **info_even_weak, /* weakening information about the best possible even weakened constraint */ info_weak **info_odd_weak, /* weakening information about the best possible odd weakened constraint */ short int only_odd, /* flag which tells whether only an odd weakening is of interest (TRUE) or both weakenings are (FALSE) */ short int only_viol /* flag which tells whether only an inequality of slack smaller than MAX_SLACK is of interest (TRUE) otherwise (FALSE) */ ) { int nweak, cntweak, ofsl, l; short int flag_even, flag_odd, ok_even, ok_odd; double best_even_e, best_even_o, best_odd_e, best_odd_o; short int *type_even_weak, *type_odd_weak, *switch_even_weak, *switch_odd_weak; #ifdef TIME second_(&tii); #endif type_even_weak = reinterpret_cast (calloc(p_ilp->mc,sizeof(short int))); if (type_even_weak == NULL ) alloc_error(const_cast("type_even_weak")); switch_even_weak = reinterpret_cast (calloc(p_ilp->mc,sizeof(short int))); if (switch_even_weak == NULL ) alloc_error(const_cast("switch_even_weak")); type_odd_weak = reinterpret_cast (calloc(p_ilp->mc,sizeof(short int))); if (type_odd_weak == NULL ) alloc_error(const_cast("type_odd_weak")); switch_odd_weak = reinterpret_cast (calloc(p_ilp->mc,sizeof(short int))); if (switch_odd_weak == NULL ) alloc_error(const_cast("switch_odd_weak")); if ( original_parity == EVEN ) { (*best_even_slack) = original_slack; (*best_odd_slack) = INF; } else { (*best_odd_slack) = original_slack; (*best_even_slack) = INF; } nweak = 0; for ( ofsl = 0; ofsl < n_to_weak; ofsl++ ) { l = vars_to_weak[nweak]; if ( p_ilp->possible_weak[l] == NONE ) { free(type_even_weak); free(type_odd_weak); free(switch_even_weak); free(switch_odd_weak); #ifdef TIME second_(&tff); bw_time += tff - tii; #endif return(NONE); } else if ( p_ilp->possible_weak[l] == EVEN ) { /* only even weakening of l is possible */ (*best_even_slack) += p_ilp->loss_even_weak[l]; type_even_weak[nweak] = p_ilp->type_even_weak[l]; switch_even_weak[nweak] = FALSE; (*best_odd_slack) += p_ilp->loss_even_weak[l]; type_odd_weak[nweak] = p_ilp->type_even_weak[l]; switch_odd_weak[nweak] = FALSE; } else if ( p_ilp->possible_weak[l] == ODD ) { /* only odd weakening of l is possible */ best_even_e = (*best_even_slack); best_odd_o = (*best_odd_slack); (*best_even_slack) = best_odd_o + p_ilp->loss_odd_weak[l]; type_even_weak[nweak] = p_ilp->type_odd_weak[l]; switch_even_weak[nweak] = TRUE; (*best_odd_slack) = best_even_e + p_ilp->loss_odd_weak[l]; type_odd_weak[nweak] = p_ilp->type_odd_weak[l]; switch_odd_weak[nweak] = TRUE; } else { /* both weakenings of l are possible */ best_even_e = (*best_even_slack) + p_ilp->loss_even_weak[l]; best_even_o = (*best_odd_slack) + p_ilp->loss_odd_weak[l]; best_odd_e = (*best_odd_slack) + p_ilp->loss_even_weak[l]; best_odd_o = (*best_even_slack) + p_ilp->loss_odd_weak[l]; if ( best_even_e <= best_even_o ) { (*best_even_slack) = best_even_e; type_even_weak[nweak] = p_ilp->type_even_weak[l]; switch_even_weak[nweak] = FALSE; } else { (*best_even_slack) = best_even_o; type_even_weak[nweak] = p_ilp->type_odd_weak[l]; switch_even_weak[nweak] = TRUE; } if ( best_odd_e <= best_odd_o ) { (*best_odd_slack) = best_odd_e; type_odd_weak[nweak] = p_ilp->type_even_weak[l]; switch_odd_weak[nweak] = FALSE; } else { (*best_odd_slack) = best_odd_o; type_odd_weak[nweak] = p_ilp->type_odd_weak[l]; switch_odd_weak[nweak] = TRUE; } } if ( ( only_viol ) && ( (*best_even_slack) > MAX_SLACK - EPS ) && ( (*best_odd_slack) > MAX_SLACK - EPS ) ) { free(type_even_weak); free(type_odd_weak); free(switch_even_weak); free(switch_odd_weak); #ifdef TIME second_(&tff); bw_time += tff - tii; #endif return(NONE); } nweak++; } /* construct the weakening vectors associated with the best even and odd pairs (if the associated slack is not too big) */ if ( (! only_odd) && ( ( (*best_even_slack) <= MAX_SLACK - EPS ) || ( (! only_viol) && (*best_even_slack) <= INF - EPS ) ) ) { ok_even = TRUE; (*info_even_weak) = alloc_info_weak(nweak); (*info_even_weak)->nweak = nweak; flag_even = EVEN; cntweak = nweak; for ( ofsl = n_to_weak - 1; ofsl >= 0; ofsl-- ) { cntweak--; (*info_even_weak)->var[cntweak] = vars_to_weak[ofsl]; if ( flag_even == EVEN ) { (*info_even_weak)->type[cntweak] = type_even_weak[cntweak]; if ( switch_even_weak[cntweak] ) flag_even = ODD; } else { (*info_even_weak)->type[cntweak] = type_odd_weak[cntweak]; if ( switch_odd_weak[cntweak] ) flag_even = EVEN; } } } else ok_even = FALSE; if ( ( (*best_odd_slack) <= MAX_SLACK - EPS ) || ( (! only_viol) && (*best_odd_slack) <= INF - EPS ) ) { ok_odd = TRUE; (*info_odd_weak) = alloc_info_weak(nweak); (*info_odd_weak)->nweak = nweak; flag_odd = ODD; cntweak = nweak; for ( ofsl = n_to_weak - 1; ofsl >= 0; ofsl-- ) { cntweak--; (*info_odd_weak)->var[cntweak] = vars_to_weak[ofsl]; if ( flag_odd == EVEN ) { (*info_odd_weak)->type[cntweak] = type_even_weak[cntweak]; if ( switch_even_weak[cntweak] ) flag_odd = ODD; } else { (*info_odd_weak)->type[cntweak] = type_odd_weak[cntweak]; if ( switch_odd_weak[cntweak] ) flag_odd = EVEN; } } } else ok_odd = FALSE; free(type_even_weak); free(type_odd_weak); free(switch_even_weak); free(switch_odd_weak); #ifdef TIME second_(&tff); bw_time += tff - tii; #endif if ( ok_odd && ok_even ) return(BOTH); if ( ok_even ) return(EVEN); if ( ok_odd ) return(ODD); return(NONE); } /* basic_separation: try to identify violated 0-1/2 cuts by using the original procedure described in Caprara and Fischetti's MP paper */ cut_list *Cgl012Cut::basic_separation() { int i, j, k, l, begi, special, ofsj, ofsk, ofsl, n_to_weak, c; short int parity, original_parity, ok_weak; double weight, original_slack, best_even_slack, best_odd_slack; int *vars_to_weak; info_weak *info_even_weak, *info_odd_weak, *i_weak; separation_graph *sep_graph; auxiliary_graph *aux_graph; cycle_list *short_cycle_list; cut *violated_cut; cut_list *out_cuts; /* construct the separation graph by the standard weakening procedure */ #ifdef PRINT print_parity_ilp(); #endif #ifdef TIME second_(&td); #endif #ifdef PRINT_TIME printf("... time elapsed at the beginning of basic_separation: %f\n",td - tti); #endif #ifdef TIME second_(&td); #endif #ifdef PRINT_TIME printf("... time elapsed before initialize_sep_graph: %f\n",td - tti); #endif sep_graph = initialize_sep_graph(); special = p_ilp->mc; #ifdef TIME second_(&td); #endif #ifdef PRINT_TIME printf("... time elapsed before weakening: %f\n",td - tti); #endif /* edges associated with actual constraints in the ILP */ for ( i = 0; i < p_ilp->mr; i++ ) { if ( ! p_ilp->row_to_delete[i] ) { begi = p_ilp->mtbeg[i]; if ( p_ilp->mtcnt[i] == 1 ) { /* row with one odd entry only: edge j -- special */ weight = p_ilp->slack[i]; if ( weight < MAX_SLACK - EPS ) { j = p_ilp->mtind[begi]; parity = p_ilp->mrhs[i]; i_weak = alloc_info_weak(0); sep_graph = update_weight_sep_graph (j,special,weight,parity,i,i_weak,sep_graph); } } else if ( p_ilp->mtcnt[i] == 2 ) { /* row with two odd entries only: edge j -- k */ weight = p_ilp->slack[i]; if ( weight < MAX_SLACK - EPS ) { j = p_ilp->mtind[begi]; k = p_ilp->mtind[begi+1]; parity = p_ilp->mrhs[i]; i_weak = alloc_info_weak(0); sep_graph = update_weight_sep_graph (j,k,weight,parity,i,i_weak,sep_graph); } } else { /* row with three or more odd entries: weakening for all 1's pairs */ for ( ofsj = 0; ofsj < p_ilp->mtcnt[i]; ofsj++ ) { for ( ofsk = ofsj + 1; ofsk < p_ilp->mtcnt[i]; ofsk++ ) { /* edge(s) j -- k */ j = p_ilp->mtind[begi+ofsj]; k = p_ilp->mtind[begi+ofsk]; original_slack = p_ilp->slack[i]; original_parity = p_ilp->mrhs[i]; n_to_weak = 0; vars_to_weak = reinterpret_cast (calloc(inp_ilp->mc,sizeof(int))); if ( vars_to_weak == NULL ) alloc_error(const_cast("vars_to_weak")); for ( ofsl = 0; ofsl < p_ilp->mtcnt[i]; ofsl++ ) if ( ofsl != ofsj && ofsl != ofsk ) { l = p_ilp->mtind[begi+ofsl]; vars_to_weak[n_to_weak] = l; n_to_weak++; } ok_weak = best_weakening(n_to_weak,vars_to_weak, original_parity,original_slack, &best_even_slack,&best_odd_slack, &info_even_weak,&info_odd_weak, FALSE,TRUE); free(vars_to_weak); if ( ok_weak == NONE ) goto EXITJK; if ( ok_weak == BOTH || ok_weak == EVEN ) { if ( best_even_slack < MAX_SLACK - EPS ) { weight = best_even_slack; parity = EVEN; sep_graph = update_weight_sep_graph (j,k,weight,parity,i,info_even_weak,sep_graph); } } if ( ok_weak == BOTH || ok_weak == ODD ) { if ( best_odd_slack < MAX_SLACK - EPS ) { weight = best_odd_slack; parity = ODD; sep_graph = update_weight_sep_graph (j,k,weight,parity,i,info_odd_weak,sep_graph); } } EXITJK:; } } } } } /* edges associated with the bound constraints (probably useless but necessary in some cases */ for ( j = 0; j < p_ilp->mc; j++ ) { if ( ! p_ilp->col_to_delete[j] ) { weight = p_ilp->xstar[j] - inp_ilp->vlb[j]; if ( weight < MAX_SLACK - EPS ) { parity = mod2(inp_ilp->vlb[j]); i_weak = alloc_info_weak(0); sep_graph = update_weight_sep_graph (j,special,weight,parity,NONE,i_weak,sep_graph); } weight = inp_ilp->vub[j] - p_ilp->xstar[j]; if ( weight < MAX_SLACK - EPS ) { parity = mod2(inp_ilp->vub[j]); i_weak = alloc_info_weak(0); sep_graph = update_weight_sep_graph (j,special,weight,parity,NONE,i_weak,sep_graph); } } } #ifdef TIME second_(&tf); weak_time += tf - ti; #endif /* construct the auxiliary graph for the shortest path computation and compute the smallest cost odd cycle visiting each node - this part is strongly dependent on the data structure used by the shortest path subroutine used */ #ifdef PRINT print_sep_graph(sep_graph); #endif #ifdef TIME second_(&ti); #endif #ifdef TIME second_(&td); #endif #ifdef PRINT_TIME printf("... time elapsed before define_aux_graph: %f\n",td - tti); #endif aux_graph = define_aux_graph(sep_graph); #ifdef TIME second_(&tf); aux_time += tf - ti; #endif #ifdef PRINT print_aux_graph(aux_graph); #endif /* exit(1); */ #ifdef TIME second_(&td); #endif #ifdef PRINT_TIME printf("... time elapsed before cycles and cuts: %f\n",td - tti); printf("%d nodes on list\n",sep_graph->nnodes); #endif out_cuts = initialize_cut_list(MAX_CUTS); for ( j = 0; j < sep_graph->nnodes; j++ ) { short_cycle_list = get_shortest_odd_cycle_list(j,sep_graph,aux_graph); if ( short_cycle_list == NULL ) goto EXIT_NODE; #ifdef PRINT print_cycle_list(short_cycle_list); #endif for ( c = 0; c < short_cycle_list->cnum; c++ ) { violated_cut = get_cut(short_cycle_list->list[c]); if ( violated_cut == NULL ) { if (!errorNo) continue; else break; } #ifdef PRINT print_cut(violated_cut); #endif if ( violated_cut->violation > MIN_VIOLATION + EPS ) { /* violated 0-1/2 cut found */ out_cuts = add_cut_to_list(violated_cut,out_cuts); if ( out_cuts->cnum >= MAX_CUTS ) { free_cycle_list(short_cycle_list); goto EXIT_CUTS; } } else free_cut(violated_cut); } /* remove the current node from the auxiliary graph */ EXIT_NODE: aux_graph = cancel_node_aux_graph(j,aux_graph); free_cycle_list(short_cycle_list); } EXIT_CUTS: free_sep_graph(sep_graph); free_aux_graph(aux_graph); #ifdef PRINT_CUTS print_cut_list(out_cuts); #endif #ifdef TIME second_(&td); #endif #ifdef PRINT_TIME printf("... time elapsed at the end of basic_separation: %f\n",td - tti); #endif return(out_cuts); } /* 012cut: main procedure for 0-1/2 cut separation first release: Aug 12 1996 last revision: Jun 10 1997 */ /* static data structures for log information about separation */ #ifndef CGGGGG static int sep_iter = 0; /* number of the current separation iteration */ //#define POOL #ifdef POOL static pool_cut_list *pool = NULL; /* information about the cuts separated so far, used to decide when they should be added to the current LP */ #endif static log_var **vlog = NULL; /* information about the value attained by the variables in the last iterations, used to possibly set to 0 some coefficient > 0 in a cut to be added */ static bool aggr; /* flag saying whether as many cuts as possible are required from the separation procedure (TRUE) or not (FALSE) */ #endif /* include the reactive local search heuristic */ //was #include "Cgltabu_012.c" //start include "Cgltabu_012.c" #define MAX_TABU_ITER 100 #define NUM_HASH_ENTRIES MAX_CUT_POOL /* initial length of the tabu list */ #define IN_PROHIB_PERIOD 3 #define MAX_TIME_FACTOR 3 /* data structure for the current local search solution */ typedef struct { int n_of_constr; /* number of constraints in the current cut */ short int *in_constr_list; /* flag saying whether a given constraint is in the list of constraints of the cut (IN) or not (OUT) */ int *non_weak_coef; /* coefficients of the cut before weakening */ int non_weak_rhs; /* coefficient of the rhs before weakening */ double slack_sum; /* sum of the slacks of the constraints in the cut */ double min_weak_loss; /* minimum loss by weakening the non even coefficients */ int one_norm; /* 1-norm of the lhs, i.e. sum of the absolute values of the coefficients */ short int ok; /* logical flag telling whether the cut could be weakened to a 0-1/2 cut or not - if false the two fields below have no meaning */ int *coef; /* actual coefficients of the cut */ int rhs; /* actual rhs of the cut */ double violation; /* violation of the cut */ } tabu_cut; /* data structure for the hash table used in memory reaction */ typedef struct h_e { int n_of_el; /* number of components to be considered */ short int *flag_vect; /* vector of flags for the components */ int last_vis; /* last iteration when this element was visited */ struct h_e *next; /* pointer to the next element in the hash chain */ } hash_element; typedef hash_element **hash_table; /* global variables for local search */ int n; /* number of variables in the ILP */ int m; /* number of constraints in the ILP */ int it; /* number of tabu search iterations so far */ tabu_cut *cur_cut; /* information about the current cut in local search */ int *last_moved; /* last iteration when a given constraint was added/ deleted from the list of constraints of the cut */ int last_it_add; /* last iteration when a cut was added to the list */ int last_it_restart; /* last iteration when a restart was performed */ int prohib_period; /* current prohibition period */ int last_prohib_period_mod; /* last iteration where prohibition period was modified */ hash_table hash_tab; /* hash table */ int A; /* parameter A in Battiti and Protasi */ int B; /* parameter B in Battiti and Protasi */ float elapsed_time; /* time elapsed since the beginning of the current tabu search call */ /* clear_cur_cut: clear the current solution (no constraint in the cut) */ void clear_cur_cut() { int i, j; cur_cut->n_of_constr = 0; cur_cut->rhs = 0; cur_cut->non_weak_rhs = 0; cur_cut->violation = 0.0; cur_cut->slack_sum = 0.0; cur_cut->min_weak_loss = 0.0; cur_cut->one_norm = 0; for ( j = 0; j < n; j++ ) { cur_cut->coef[j] = 0; cur_cut->non_weak_coef[j] = 0; } for ( i = 0; i < m; i++ ) { cur_cut->in_constr_list[i] = OUT; } cur_cut->ok = FALSE; } /* initialize_cur_cut: allocate the memory for cur_cut */ void initialize_cur_cut() { cur_cut = reinterpret_cast (calloc(1,sizeof(tabu_cut))); if ( cur_cut == NULL ) alloc_error(const_cast("cur_cut")); cur_cut->coef = reinterpret_cast (calloc(n,sizeof(int))); if ( cur_cut->coef == NULL ) alloc_error(const_cast("cur_cut->coef")); cur_cut->non_weak_coef = reinterpret_cast (calloc(n,sizeof(int))); if ( cur_cut->non_weak_coef == NULL ) alloc_error(const_cast("cur_cut->non_weak_coef")); cur_cut->in_constr_list = reinterpret_cast (calloc(m,sizeof(short int))); if ( cur_cut->in_constr_list == NULL ) alloc_error(const_cast("cur_cut->in_constr_list")); clear_cur_cut(); } /* free_cur_cut: free the memory for cur_cut */ void free_cur_cut() { free(cur_cut->coef); free(cur_cut->non_weak_coef); free(cur_cut->in_constr_list); free(cur_cut); } #ifdef PRINT_TABU /* print_cur_cut: display cur_cut on output */ void Cgl012Cut::print_cur_cut() { int i, j; printf("iteration %d prohib_period %d\n",it,prohib_period); printf("\n content of cur_cut data structure: n_of_constr = %d, ok = %d\n", cur_cut->n_of_constr, cur_cut->ok); for ( i = 0; i < m; i++ ) if ( cur_cut->in_constr_list[i] == IN ) printf("constr. %d\n",i); /* printf(" list of constraints:\n"); for ( i = 0; i < m; i++ ) if ( cur_cut->in_constr_list[i] == IN ) print_constr(i); print_int_vect("non_weak_coef",cur_cut->non_weak_coef,n); printf(" non_weak_rhs = %d\n",cur_cut->non_weak_rhs); print_int_vect("coef",cur_cut->coef,n); printf(" rhs = %d\n",cur_cut->rhs); */ for ( j = 0 /* , viol = - (double) cur_cut->rhs */ ; j < n; j++ ) if ( ( p_ilp->xstar[j] > ZERO || p_ilp->xstar[j] < -ZERO ) && cur_cut->non_weak_coef[j] != 0 ) { printf("var. %d xstar %f non_weak_coef %d coef %d\n", j, p_ilp->xstar[j], cur_cut->non_weak_coef[j], cur_cut->coef[j]); /* viol += p_ilp->xstar[j] * cur_cut->coef[j]; */ } printf("rhs %d viol %f slack_sum %f min_weak_loss %f one_norm %d\n", cur_cut->rhs, cur_cut->violation, cur_cut->slack_sum, cur_cut->min_weak_loss, cur_cut->one_norm); } #endif /* same_short_vect: check whether two short int vectors have the same content */ short int same_short_vect( int n_of_el, /* number of components in the vectors */ short int *vec_1, short int *vec_2 /* vectors to be checked */ ) { int i; for ( i = 0; i < n_of_el; i++ ) if ( vec_1[i] != vec_2[i] ) return(FALSE); return(TRUE); } /* initialize_hash_table: allocate the memory for the hash table */ void initialize_hash_table() { int i; hash_tab = reinterpret_cast (calloc(NUM_HASH_ENTRIES,sizeof(hash_element *))); if ( hash_tab == NULL ) alloc_error(const_cast("hash_tab")); for ( i = 0; i < NUM_HASH_ENTRIES; i++ ) hash_tab[i] = NULL; } /* clear_hash_table: clear the current hash table */ void clear_hash_table() { int i; hash_element *hash_ptr, *hash_el; for ( i = 0; i < NUM_HASH_ENTRIES; i++ ) { if ( hash_tab[i] != NULL ) { hash_ptr = hash_tab[i]; do { hash_el = hash_ptr->next; free(hash_ptr->flag_vect); free(hash_ptr); hash_ptr = hash_el; } while ( hash_ptr != NULL ); hash_tab[i] = NULL; } } } /* free_hash_table: deallocate the memory for the hash table */ void free_hash_table() { clear_hash_table(); free(hash_tab); } /* hash_addr: compute the hash address associated with the current cut */ int hash_addr( int n_of_el, /* number of elements to be considered */ short int *flag_vect /* vector of flags for the elements */ ) { int i, addr; /* very simple algorithm: just add-up the squared indices of the IN elements */ addr = 0; for ( i = 0; i < n_of_el; i++ ) if ( flag_vect[i] == IN ) addr += i * i; return(addr % NUM_HASH_ENTRIES); } /* hash_search: search for the current cut in the hash list of all cuts - if found return TRUE and update the last iteration the cut was found */ short int hash_search(int *cyc_len /* length of the cycle if the current cut is found */) { int addr; hash_element *hash_el; addr = hash_addr(m,cur_cut->in_constr_list); hash_el = hash_tab[addr]; while ( hash_el != NULL ) { if ( same_short_vect(m,cur_cut->in_constr_list,hash_el->flag_vect) ) { *cyc_len = it - hash_el->last_vis; hash_el->last_vis = it; return(TRUE); } hash_el = hash_el->next; } return(FALSE); } /* hash_insert: insert a new cut in the hash list of all cuts */ void hash_insert() { int addr, i; hash_element *hash_el, *hash_ptr; addr = hash_addr(m,cur_cut->in_constr_list); hash_el = reinterpret_cast (calloc(1,sizeof(hash_element))); if ( hash_el == NULL ) alloc_error(const_cast("hash_el")); hash_el->n_of_el = m; hash_el->last_vis = it; hash_el->next = NULL; hash_el->flag_vect = reinterpret_cast (calloc(m,sizeof(short int))); if ( hash_el->flag_vect == NULL ) alloc_error(const_cast("hash_el->flag_vect")); for ( i = 0; i < m; i++ ) hash_el->flag_vect[i] = cur_cut->in_constr_list[i]; if ( hash_tab[addr] == NULL ) hash_tab[addr] = hash_el; else { hash_ptr = hash_tab[addr]; while ( hash_ptr->next != NULL ) { #if 0 /* this check can be omitted to save time */ if ( same_short_vect(m,cur_cut->in_constr_list,hash_ptr->flag_vect) ) { printf("attempt to insert in the hash an already present cut\n"); exit(0); } #endif hash_ptr = hash_ptr->next; } hash_ptr->next = hash_el; } } /* increase_prohib_period: implemented as in Battiti and Protasi */ void increase_prohib_period() { if ( prohib_period * 1.1 > prohib_period + 1 ) if ( prohib_period * 1.1 < m - 2 ) prohib_period = static_cast (prohib_period*1.1); else prohib_period = m - 2; else if ( prohib_period + 1 < m - 2 ) prohib_period += 1; else prohib_period = m - 2; last_prohib_period_mod = it; } /* decrease_prohib_period: implemented as in Battiti and Protasi */ void decrease_prohib_period() { if ( prohib_period * 0.9 < prohib_period - 1 ) if ( prohib_period * 0.9 > IN_PROHIB_PERIOD ) prohib_period = static_cast (prohib_period* 0.9); else prohib_period = IN_PROHIB_PERIOD; else if ( prohib_period - 1 > IN_PROHIB_PERIOD ) prohib_period -= 1; else prohib_period = IN_PROHIB_PERIOD; last_prohib_period_mod = it; } /* allowed: check if moving (adding/deleting) a given constraint is not a tabu move */ short int allowed(int i /* constraint to be checked */) { if ( last_moved[i] < it - prohib_period ) { if ( cur_cut->in_constr_list[i] == IN ) { if ( cur_cut->n_of_constr > 1 ) return(TRUE); else return(FALSE); } else { if ( cur_cut->n_of_constr < m - 1 ) return(TRUE); else return(FALSE); } } else return(FALSE); } /* in_cur_cut: check whether a given constraint is in the list of constraints defining the current cut */ short int in_cur_cut(int i /* constraint to be checked */) { if ( cur_cut->in_constr_list[i] == OUT ) return(FALSE); else return(TRUE); } /* tabu_score: define the score of a potential new cut */ double tabu_score( int *ccoef, /* cut left hand side coefficients */ int crhs, /* cut right hand side */ double viol, /* cut violation */ double norm /* cut norm - 1-norm is used below */ ) { /* very simple score: violation divided/multiplied by the lhs 1-norm */ if ( norm == 0 ) norm = 1; if ( viol > 0.0 ) return (viol / norm); else return (viol * norm); } /* score_by_moving: compute the score of the best cut obtainable from the current local search solution by inserting/deleting a constraint */ double Cgl012Cut::score_by_moving( int i, /* constraint to be moved */ short int itype, /* type of move - ADD or DEL */ double thresh /* minimum value of an interesting score */ ) { #define PENALTY_NON_WEAKABLE -1.0 #define FAST_SCORE_EVAL 1 int j, begi, gcdi, ofsj, ij, crhs, one_norm, support_inter; short int flag_gt, ok; double slack_sum, weak_loss, score, viol; int *new_coef, *ccoef; begi = inp_ilp->mtbeg[i]; gcdi = p_ilp->gcd[i]; /* fast check - optimistic evaluation of the score */ slack_sum = cur_cut->slack_sum; if ( itype == ADD ) slack_sum += p_ilp->slack[i] / static_cast (gcdi); else slack_sum -= p_ilp->slack[i] / static_cast (gcdi); viol = ( 1.0 - slack_sum ) / 2.0; score = tabu_score(NULL,0,viol,1.0); /* printf("Score estimate 1 %f Threshold %f\n",score,thresh); */ if ( score < thresh + ZERO ) { return (score); } /* discard the cuts that have empty support intersection with the current one */ support_inter = 0; for ( ofsj = 0, ij = begi; ofsj < inp_ilp->mtcnt[i]; ofsj++, ij++ ) if ( cur_cut->non_weak_coef[inp_ilp->mtind[ij]] !=0 ) support_inter++; if ( support_inter == 0 ) return(-INF); /* compute the new cut coefficients and rhs (before weakening) */ new_coef = reinterpret_cast (calloc(inp_ilp->mtcnt[i],sizeof(int))); if ( new_coef == NULL ) alloc_error(const_cast("new_coef")); if ( ( itype == ADD && inp_ilp->msense[i] != 'G' ) || ( itype == DEL && inp_ilp->msense[i] == 'G' ) ) flag_gt = 1; else flag_gt = -1; if ( flag_gt == 1 ) { if ( gcdi == 1 ) { for ( ofsj = 0, ij = begi; ofsj < inp_ilp->mtcnt[i]; ofsj++, ij++ ) { j = inp_ilp->mtind[ij]; new_coef[ofsj] = cur_cut->non_weak_coef[j] + inp_ilp->mtval[ij]; } crhs = cur_cut->non_weak_rhs + inp_ilp->mrhs[i]; } else { for ( ofsj = 0, ij = begi; ofsj < inp_ilp->mtcnt[i]; ofsj++, ij++ ) { j = inp_ilp->mtind[ij]; new_coef[ofsj] = cur_cut->non_weak_coef[j] + inp_ilp->mtval[ij] / gcdi; } crhs = cur_cut->non_weak_rhs + inp_ilp->mrhs[i] / gcdi; } } else { if ( gcdi == 1 ) { for ( ofsj = 0, ij= begi; ofsj < inp_ilp->mtcnt[i]; ofsj++, ij++ ) { j = inp_ilp->mtind[ij]; new_coef[ofsj] = cur_cut->non_weak_coef[j] - inp_ilp->mtval[ij]; } crhs = cur_cut->non_weak_rhs - inp_ilp->mrhs[i]; } else { for ( ofsj = 0, ij = begi; ofsj < inp_ilp->mtcnt[i]; ofsj++, ij++ ) { j = inp_ilp->mtind[ij]; new_coef[ofsj] = cur_cut->non_weak_coef[j] - inp_ilp->mtval[ij] / gcdi; } crhs = cur_cut->non_weak_rhs - inp_ilp->mrhs[i] / gcdi; } } /* other - relatively fast - check by optimistic evaluation of the cut score */ weak_loss = cur_cut->min_weak_loss; one_norm = cur_cut->one_norm; for ( ofsj = 0, ij = begi; ofsj < inp_ilp->mtcnt[i]; ofsj++, ij++ ) { j = inp_ilp->mtind[ij]; if ( cur_cut->coef[j] > 0 ) one_norm -= cur_cut->coef[j]; else one_norm += cur_cut->coef[j]; if ( new_coef[ofsj] >= 2 ) one_norm += new_coef[ofsj] / 2; else one_norm -= new_coef[ofsj] / 2; if ( mod2(cur_cut->non_weak_coef[j]) == ODD ) { if ( mod2(new_coef[ofsj]) == EVEN ) weak_loss -= p_ilp->min_loss_by_weak[j]; } else { if ( mod2(new_coef[ofsj]) == ODD ) weak_loss += p_ilp->min_loss_by_weak[j]; } } viol = ( 1.0 - slack_sum - weak_loss ) / 2.0; score = tabu_score(NULL,0,viol,static_cast (one_norm)); /* printf("Score estimate 2 %f Threshold %f\n",score,thresh); */ if ( score < thresh + ZERO || FAST_SCORE_EVAL ) { free(new_coef); return (score); } /* get the actual cut coefficients and the violation of the best cut obtainable trough weakening */ ccoef = reinterpret_cast (calloc(n,sizeof(int))); if ( ccoef == NULL ) alloc_error(const_cast("ccoef")); for ( j = 0; j < n; j++ ) ccoef[j] = cur_cut->non_weak_coef[j]; for ( ofsj = 0; ofsj < inp_ilp->mtcnt[i]; ofsj++ ) { ij = begi + ofsj; j = inp_ilp->mtind[ij]; ccoef[j] = new_coef[ofsj]; } ok = best_cut(ccoef,&crhs,&viol,FALSE,FALSE); if ( ok ) score = tabu_score(ccoef,crhs,viol,static_cast (one_norm)); else { viol = ( - slack_sum - weak_loss ) / 2.0; score = PENALTY_NON_WEAKABLE + tabu_score(ccoef,crhs,viol,static_cast (one_norm)); } /* printf("Score actual %f Threshold %f\n",score,thresh); */ free(new_coef); free(ccoef); return(score); } /* modify_current: update the current local search solution by inserting/ deleting a constraint */ void Cgl012Cut::modify_current( int i, /* constraint to be moved */ short int itype /* type of move - ADD or DEL */ ) { int j, begi, gcdi, ofsj, ij; short int flag_gt; if ( itype == ADD ) { cur_cut->n_of_constr++; cur_cut->in_constr_list[i] = IN; } else { cur_cut->n_of_constr--; cur_cut->in_constr_list[i] = OUT; } last_moved[i] = it; /* compute the new cut coefficients and rhs (before weakening) */ if ( ( itype == ADD && inp_ilp->msense[i] != 'G' ) || ( itype == DEL && inp_ilp->msense[i] == 'G' ) ) flag_gt = 1; else flag_gt = -1; begi = inp_ilp->mtbeg[i]; gcdi = p_ilp->gcd[i]; for ( ofsj = 0; ofsj < inp_ilp->mtcnt[i]; ofsj++ ) { ij = begi + ofsj; j = inp_ilp->mtind[ij]; /* the '*' and '/' operations can be saved by writing some more code ... */ cur_cut->non_weak_coef[j] += flag_gt * (inp_ilp->mtval[ij] / gcdi); } cur_cut->non_weak_rhs += flag_gt * (inp_ilp->mrhs[i] / gcdi); if ( itype == ADD ) cur_cut->slack_sum += p_ilp->slack[i] / static_cast (gcdi); else cur_cut->slack_sum -= p_ilp->slack[i] / static_cast (gcdi); /* get the best possible cut */ cur_cut->min_weak_loss = 0.0; for ( j = 0; j < n; j++ ) { cur_cut->coef[j] = cur_cut->non_weak_coef[j]; if ( mod2(cur_cut->coef[j]) == ODD ) cur_cut->min_weak_loss += p_ilp->min_loss_by_weak[j]; } cur_cut->rhs = cur_cut->non_weak_rhs; cur_cut->ok = best_cut(cur_cut->coef,&cur_cut->rhs,&cur_cut->violation,TRUE,FALSE); cur_cut->one_norm = 0; for ( j = 0; j < n; j++ ) { if ( cur_cut->coef[j] > 0 ) cur_cut->one_norm += cur_cut->coef[j]; else cur_cut->one_norm -= cur_cut->coef[j]; } } /* get_current_cut: return a cut data type with the information about the current cut of the search procedure */ cut *Cgl012Cut::get_current_cut() { int i, j, nz; /*double viol;*/ cut *cut_ptr; cut_ptr = reinterpret_cast (calloc(1,sizeof(cut))); if ( cut_ptr == NULL ) alloc_error(const_cast("cut_ptr")); cut_ptr->crhs = cur_cut->rhs; cut_ptr->csense = 'L'; /* count the number of nonzeroes in the cut */ for ( j = 0, nz = 0; j < n; j++ ) if ( cur_cut->coef[j] != 0 ) nz++; cut_ptr->cnzcnt = nz; cut_ptr->cind = reinterpret_cast (calloc(nz,sizeof(int))); if ( cut_ptr->cind == NULL ) alloc_error(const_cast("cut_ptr->cind")); cut_ptr->cval = reinterpret_cast (calloc(nz,sizeof(int))); if ( cut_ptr->cval == NULL ) alloc_error(const_cast("cut_ptr->cval")); nz = 0; /*viol = 0.0;*/ for ( j = 0; j < n; j++ ) { if ( cur_cut->coef[j] != 0 ) { cut_ptr->cind[nz] = j; cut_ptr->cval[nz] = cur_cut->coef[j]; nz++; /* viol += p_ilp->xstar[j] * (double) cur_cut->coef[j]; */ } } /* viol -= (double) cur_cut->rhs; */ /* cut_ptr->violation = viol; */ cut_ptr->violation = cur_cut->violation; cut_ptr->n_of_constr = 0; cut_ptr->constr_list = reinterpret_cast (calloc(inp_ilp->mr,sizeof(int))); if ( cut_ptr->constr_list == NULL ) alloc_error(const_cast("cut_ptr->constr_list")); cut_ptr->in_constr_list = reinterpret_cast (calloc(inp_ilp->mr,sizeof(short int))); if ( cut_ptr->in_constr_list == NULL ) alloc_error(const_cast("cut_ptr->in_constr_list")); for ( i = 0; i < m; i++ ) { if ( cur_cut->in_constr_list[i] == IN ) { cut_ptr->in_constr_list[i] = IN; cut_ptr->constr_list[cut_ptr->n_of_constr] = i; (cut_ptr->n_of_constr)++; } else cut_ptr->in_constr_list[i] = OUT; } return(cut_ptr); } /* best neighbour: find the cut to be added/deleted from the current solution among those allowed by the tabu rules */ short int Cgl012Cut::best_neighbour(cut_list *out_cuts /* list of the violated cuts found */) { int i, ibest; short int itype, itypebest=-1; double score, max_score; cut *new_cut; /* cycle through all the constraints in your problem ... */ max_score = -INF; ibest = NONE; for ( i = 0; i < m; i++ ) { if ( ! p_ilp->row_to_delete[i] && allowed(i) ) { if ( in_cur_cut(i) ) { /* constraint i is in the current set of constraints (those defining the current cut) */ itype = DEL; } else { /* constraint i is not in the current set of constraints (those defining the current cut) */ itype = ADD; } score = score_by_moving(i,itype,max_score); if ( score > max_score ) { /* best cut found in this iteration: store it */ ibest = i; itypebest = itype; max_score = score; } } } /* for ( i = 0; i < m; i++ ) */ if ( ibest == NONE ) { #ifdef PRINT_TABU printf("No move could be performed by best_neighbour\n"); #endif return(TRUE); } modify_current(ibest,itypebest); if ( cur_cut->violation > MIN_VIOLATION + EPS ) { #ifdef PRINT_TABU printf("... adding the current cut to the output list - it = %d viol = %f\n",it, cur_cut->violation); #endif new_cut = get_current_cut(); out_cuts = add_cut_to_list(new_cut,out_cuts); last_it_add = it; } return(FALSE); } /* memory_reaction: perform the long term reaction by cheching whether the current solution has already been visited or the best solution has not been updated for too many iterations */ void memory_reaction() { int cycle_length; if ( hash_search(&cycle_length) ) { if ( cycle_length < 2 * ( m - 1 ) ) { increase_prohib_period(); return; } } else hash_insert(); if ( it - last_prohib_period_mod > B ) decrease_prohib_period(); } /* add_tight_constraint: initialize the current cut by adding a tight constraint to it */ void Cgl012Cut::add_tight_constraint() { int i, ntight; double smin=COIN_DBL_MAX; abort(); int *tight; ntight = 0; tight = reinterpret_cast (calloc(m,sizeof(int))); if ( tight == NULL ) alloc_error(const_cast("tight")); for ( i = 0; i < m; i++ ) { /* search for the tightest constraint never added to cut */ if ( last_moved[i] < 0 && p_ilp->slack[i] < smin ) { if ( p_ilp->slack[i] < ZERO ) { /* tight constraint */ smin = ZERO; tight[ntight] = i; ntight++; } else { /* best constraint so far */ smin = p_ilp->slack[i]; tight[0] = i; ntight = 1; } } } if ( ntight > 0 ) i = tight[rand() % ntight]; /* if all constraints have already been in cur_cut choose first at random */ else i = rand() % m; free(tight); modify_current(i,ADD); } /* initialize: initialize the data structures for local search */ void Cgl012Cut::initialize() { int i; m = inp_ilp->mr; n = inp_ilp->mc; it = 0; last_it_add = 0; last_it_restart = 0; last_prohib_period_mod = 0; prohib_period = IN_PROHIB_PERIOD; initialize_cur_cut(); last_moved = reinterpret_cast (calloc(m,sizeof(int))); if ( last_moved == NULL ) alloc_error(const_cast("last_moved")); for ( i = 0; i < m; i++ ) { last_moved[i] = -COIN_INT_MAX; } initialize_hash_table(); add_tight_constraint(); A = m; B = 10 * m; } /* restart: perform a restart of the search - IMPORTANT: in the current implementation vector last_moved is not cleared at restart */ void Cgl012Cut::restart(short int failure /* flag forcing the restart if some trouble occurred */) { if ( failure || ( it - last_it_add > A && it - last_it_restart > A ) ) { /* perform restart */ last_it_restart = it; prohib_period = IN_PROHIB_PERIOD; last_prohib_period_mod = it; clear_hash_table(); clear_cur_cut(); add_tight_constraint(); } } /* free_memory: free the memory used by local search */ void free_memory() { free_cur_cut(); free(last_moved); free_hash_table(); } /* tabu_012: try to identify violated 0-1/2 cuts by a simple tabu search procedure adapted from that used by Battiti and Protasi for finding large cliques */ cut_list *Cgl012Cut::tabu_012() { short int failure; cut_list *out_cuts; out_cuts = initialize_cut_list(MAX_CUTS); initialize(); it = 0; do { memory_reaction(); failure = best_neighbour(out_cuts); #ifdef PRINT_TABU print_cur_cut(); #endif it++; restart(failure); } while ( out_cuts->cnum < MAX_CUTS && it < MAX_TABU_ITER ); free_memory(); #ifdef PRINT_TABU printf("Number of violated cuts found by Tabu Search %d\n",out_cuts->cnum); printf("Tabu Search timings: best_neighbour %f score_by_moving %f coefficient %f best_cut %f\n", time_best_neigh, time_scor_by_mov, time_coef, time_best_cut); #endif return(out_cuts); } //end include "Cgltabu_012.c" #ifdef POOL /* same_pool_cut: check whether two pool cuts are in fact the same cut */ short int same_pool_cut(pool_cut *p_cut1, pool_cut *p_cut2) { int c; if ( p_cut1->n_of_constr != p_cut2->n_of_constr ) return(FALSE); if ( p_cut1->code != p_cut2->code ) return(FALSE); /* assumes constr_list is sorted for increasing/decreasing constraint index */ for ( c = 1; c < p_cut1->n_of_constr; c++ ) if ( p_cut1->constr_list[c] != p_cut2->constr_list[c] ) return(FALSE); return(TRUE); } /* free_pool_cut: free the memory for a non-empty pool cut */ void free_pool_cut(pool_cut *p_cut) { if ( p_cut == NULL ) return; if ( p_cut->constr_list != NULL ) free(p_cut->constr_list); free(p_cut); } /* initialize_pool: initialize the pool data structure */ void initialize_pool() { pool = (pool_cut_list *) calloc(1,sizeof(pool_cut_list)); if ( pool == NULL ) alloc_error(const_cast("pool")); pool->cnum = 0; pool->list = (pool_cut **) calloc(MAX_CUT_POOL,sizeof(pool_cut *)); if ( pool->list == NULL ) alloc_error(const_cast("pool->list")); pool->ncod = (int *) calloc(MAX_CUT_COD,sizeof(int)); if ( pool->ncod == NULL ) alloc_error(const_cast("pool->ncod")); } /* free_pool: free the memory used by the pool */ void free_pool() { int c; if ( pool == NULL ) return; for ( c = 0; c < pool->cnum; c++ ) free_pool_cut(pool->list[c]); free(pool); } /* clean_pool: remove form the pool the cuts which are inactive since a large number of iterations */ void clean_pool() { int c, d; /* the pool compression could be implemented more efficiently */ for ( c = 0; c < pool->cnum; c++ ) { if ( pool->list[c]->it_found > MAX_ITER_POOL ) { free_pool_cut(pool->list[c]); pool->list[c] = NULL; for ( d = c ; d < pool->cnum; d++ ) pool->list[d] = pool->list[d + 1]; (pool->cnum)--; } } } /* insert_cut_in_pool: add a cut to the pool if there is space */ void insert_cut_in_pool(pool_cut *p_cut) { if ( pool->cnum == MAX_CUT_POOL ) { #ifdef COIN_DEVELOP printf("Warning: pool is full and separated cuts cannot be added\n"); #endif return; } pool->list[pool->cnum] = p_cut; (pool->cnum)++; (pool->ncod[p_cut->code])++; } /* cut_is_in_pool: check whether a given cut is already in the pool */ short int cut_is_in_pool(cut *v_cut) { int c, i, cod; short int equal; short int *flag_v; pool_cut *p_cut; /* print_cut(v_cut); printf("checking for a cut in the pool ...\n"); */ cod = hash_addr(inp_ilp->mr,v_cut->in_constr_list); if ( pool->ncod[cod] == 0 ) return(FALSE); /* trivial sequential search */ /* printf("... sequential search needed ...\n"); */ flag_v = (short int *) calloc(inp_ilp->mr,sizeof(short int)); if ( flag_v == NULL ) alloc_error(const_cast("flag_v")); for ( c = 0; c < pool->cnum; c++ ) { if ( pool->list[c]->code != cod ) continue; p_cut = pool->list[c]; equal = TRUE; for ( i = 0; i < inp_ilp->mr; i++ ) flag_v[i] = OUT; for ( i = 0; i < p_cut->n_of_constr; i++ ) flag_v[p_cut->constr_list[i]] = IN; for ( i = 0; i < inp_ilp->mr; i++ ) { if ( v_cut->in_constr_list[i] != flag_v[i] ) { equal = FALSE; break; } } if ( equal ) { free(flag_v); /* printf("... cut was in the pool!\n"); */ return(TRUE); } } return(FALSE); } /* good_pool_cut: check whether the current cut is worth adding to the pool */ short int good_pool_cut(cut *v_cut) { /* no check performed */ return(TRUE); } /* add_cuts_to_pool: add the cuts separated to the pool structure */ void add_cuts_to_pool(cut_list *out_cuts) { int i, c; cut *v_cut; pool_cut *p_cut; /* float ti, tf, tti, ttf; */ /* static float tcutis = 0.0, taddcut = 0.0; */ /* second_(&tti); */ if ( pool == NULL ) initialize_pool(); if ( pool->cnum >= MAX_CUT_POOL * CLEAN_THRESH ) clean_pool(); for ( i = 0; i < out_cuts->cnum; i++ ) { v_cut = out_cuts->list[i]; /* second_(&ti); */ if ( cut_is_in_pool(v_cut) ) { /* second_(&tf); */ /* tcutis += tf - ti; */ continue; } else { /* second_(&tf); */ /* tcutis += tf - ti; */ } if ( good_pool_cut(v_cut) ) { /* add the cut to the pool list */ p_cut = (pool_cut *) calloc(1,sizeof(pool_cut)); if ( p_cut == NULL ) alloc_error(const_cast("p_cut")); p_cut->n_of_constr = v_cut->n_of_constr; p_cut->constr_list = (int *) calloc(v_cut->n_of_constr,sizeof(int)); if ( p_cut->constr_list == NULL ) alloc_error(const_cast("p_cut->constr_list")); for ( c = 0; c < v_cut->n_of_constr; c++ ) p_cut->constr_list[c] = v_cut->constr_list[c]; p_cut->code = hash_addr(inp_ilp->mr,v_cut->in_constr_list); p_cut->n_it_violated = 0; p_cut->it_found = sep_iter; insert_cut_in_pool(p_cut); } } /* second_(&ttf); */ /* taddcut += ttf - tti; */ /* printf("add_cuts_to_pool: tcutis %f taddcut %f\n",tcutis,taddcut); */ } /* interesting_var: decides whether a variable is relevant in the separation or not */ short int interesting_var(int j /* variable to be evaluated */) { /* return ( vlog[j]->n_it_zero < MANY_IT_ZERO ); */ /* if ( aggr ) return (TRUE); */ return( ! p_ilp->col_to_delete[j] ); } /* get_cuts_from_pool: select from the pool a convenient set of violated constraints to be added to the current LP */ static double max_score_ever = ZERO; /* maximum score of a violated cut during the whole cutting plane procedure */ #define MIN_CUT_SCORE ( max_score_ever / MIN_SCORE_RANGE ) #define MAX_CUT_SCORE ( max_score_ever / MAX_SCORE_RANGE ) #define MIN_IT_VIOL 2 cut_list *get_cuts_from_pool( short int after_sep /* flag telling whether the pool is searched after a new separation in which case only new cuts are checked */ ) { int c, crhs, j, k, l, maxc, n_interest_var; double viol, score, maxscore, min_cut_score, max_cut_score; short int ok; int *interest_var, *ccoef; short int *added; pool_cut *p_cut; select_cut **best_var_cut; cut *a_cut; cut_list *add_cuts; /* float ti, tf, tti, ttf; */ /* static float tgetcut = 0.0, talloc = 0.0, tgetcoef = 0.0, tbestcut = 0.0, tscore = 0.0, tupdbest = 0.0, tadd = 0.0; */ /* second_(&tti); */ if ( pool == NULL ) { add_cuts = initialize_cut_list(1); return(add_cuts); } /* in the current implementation, the cut with best score with nonzero coefficient for each "interesting" variable is added to the current LP, provided the cut satisfies some requirements (violation, depth, etc.) */ /* define the set of the interesting variables */ interest_var = (int *) calloc(p_ilp->mc,sizeof(int)); if ( interest_var == NULL ) alloc_error(const_cast("interest_var")); n_interest_var = 0; for ( j = 0; j < p_ilp->mc; j++ ) { if ( interesting_var(j) ) { interest_var[n_interest_var] = j; n_interest_var++; } } best_var_cut = (select_cut **) calloc(n_interest_var,sizeof(select_cut *)); if ( best_var_cut == NULL ) alloc_error(const_cast("best_var_cut")); for ( k = 0; k < n_interest_var; k++ ) { best_var_cut[k] = (select_cut *) calloc(1,sizeof(select_cut)); if ( best_var_cut[k] == NULL ) alloc_error(const_cast("best_var_cut[k]")); best_var_cut[k]->ccoef = (int *) calloc(p_ilp->mc,sizeof(int)); if ( best_var_cut[k]->ccoef == NULL ) alloc_error(const_cast("best_var_cut[k]->ccoef")); best_var_cut[k]->score = -INF; } /* find the cuts with the best scores and the list of the cuts violated by the current fractional point */ maxscore = -INF; ccoef = (int *) calloc(p_ilp->mc,sizeof(int)); if ( ccoef == NULL ) alloc_error(const_cast("ccoef")); /* second_(&tf); */ /* talloc += tf - tti; */ min_cut_score = MIN_CUT_SCORE; max_cut_score = MAX_CUT_SCORE; for ( c = 0; c < pool->cnum; c++ ) { p_cut = pool->list[c]; /* if a new separation was made before the call check only new cuts */ if ( after_sep && p_cut->it_found != sep_iter ) continue; /* determine the actual coefficients of the cut */ /* second_(&ti); */ ok = get_ori_cut_coef(p_cut->n_of_constr,p_cut->constr_list, ccoef,&crhs,TRUE); /* second_(&tf); */ /* tgetcoef += tf - ti; */ /* second_(&ti); */ ok = ok && best_cut(ccoef,&crhs,&viol,TRUE,TRUE); /* second_(&tf); */ /* tbestcut += tf - ti; */ if ( ok && viol > MIN_VIOLATION ) { (p_cut->n_it_violated)++; /* second_(&ti); */ score = cut_score(ccoef,crhs,viol,TRUE); if ( score > maxscore ) { maxscore = score; maxc = c; } /* second_(&tf); */ /* tscore += tf - ti; */ if ( ! aggr ) { if ( score < min_cut_score ) continue; if ( score < max_cut_score && p_cut->n_it_violated < MIN_IT_VIOL ) continue; } /* second_(&ti); */ for ( k = 0; k < n_interest_var; k++ ) { j = interest_var[k]; if ( ccoef[j] != 0 && best_var_cut[k]->score < score ) { best_var_cut[k]->score = score; for ( l = 0; l < p_ilp->mc; l++ ) best_var_cut[k]->ccoef[l] = ccoef[l]; best_var_cut[k]->crhs = crhs; best_var_cut[k]->pool_index = c; } } /* second_(&tf); */ /* tupdbest += tf - ti; */ } else p_cut->n_it_violated = 0; } free(ccoef); /* printf("maxscore of a cut : %f ever: %f\n",maxscore,max_score_ever); */ if ( maxscore > max_score_ever ) max_score_ever = maxscore; /* second_(&ti); */ add_cuts = initialize_cut_list(n_interest_var); added = (short int *) calloc(pool->cnum,sizeof(short int)); if ( added == NULL ) alloc_error(const_cast("added")); for ( c = 0; c < pool->cnum; c++ ) added[c] = FALSE; for ( k = 0; k < n_interest_var; k++ ) { j = interest_var[k]; if ( ! added[best_var_cut[k]->pool_index] && best_var_cut[k]->score >= MIN_CUT_SCORE ) { /* add the cut to the cut list on output */ a_cut = define_cut(best_var_cut[k]->ccoef,best_var_cut[k]->crhs); add_cuts = add_cut_to_list(a_cut,add_cuts); added[best_var_cut[k]->pool_index] = TRUE; } free(best_var_cut[k]->ccoef); free(best_var_cut[k]); } free(best_var_cut); free(interest_var); free(added); /* second_(&tf); */ /* tadd += tf - ti; */ /* second_(&ttf); */ /* tgetcut += ttf - tti; */ /* printf("get_cuts_from_pool: talloc %f tgetcoef %f tbestcut %f tscore %f tupdbest %f tadd %f tgetcut %f\n",talloc,tgetcoef,tbestcut,tscore,tupdbest,tadd,tgetcut); */ return(add_cuts); } #endif /* initialize_log_var: initialize the log information for the problem variables */ void Cgl012Cut::initialize_log_var() { int j; if (!vlog) { if (p_ilp->mc) { vlog = reinterpret_cast (calloc(p_ilp->mc,sizeof(log_var *))); if ( vlog == NULL ) alloc_error(const_cast("vlog")); for ( j = 0; j < p_ilp->mc; j++ ) { vlog[j] = reinterpret_cast (calloc(1,sizeof(log_var))); if ( vlog[j] == NULL ) alloc_error(const_cast("vlog[j]")); vlog[j]->n_it_zero = 0; } } } else { // just initialize counts for ( j = 0; j < p_ilp->mc; j++ ) { vlog[j]->n_it_zero = 0; } } } /* free_log_var */ void Cgl012Cut::free_log_var() { if (vlog) { int j; for ( j = 0; j < p_ilp->mc; j++ ) free(vlog[j]); free(vlog); vlog=NULL; } } /* update_log_var: update the log information for the problem variables */ void Cgl012Cut::update_log_var() { int j; /* so far one counts only the number of consecutive iterations with 0 value for each variable */ if ( vlog == NULL ) initialize_log_var(); for ( j = 0; j < p_ilp->mc; j++ ) { if ( p_ilp->xstar[j] < ZERO && p_ilp->xstar[j] > - ZERO ) vlog[j]->n_it_zero++; else vlog[j]->n_it_zero = 0; } } /* the final implementation should use the following additional functions: init_sep_012_cut: defines the inp_ilp and p_ilp data structures and initializes pool and vlog sep_012_cut: updates inp_ilp and p_ilp, performs separation and pool management kill_sep_012_cut: frees all the permanent memory (inp_ilp, p_ilp, pool, vlog, etc.) */ int Cgl012Cut::sep_012_cut( /* INPUT parameters: */ int mr, /* number of rows in the ILP matrix */ int mc, /* number of columns in the ILP matrix */ int mnz, /* number of nonzero's in the ILP matrix */ int *mtbeg, /* starting position of each row in arrays mtind and mtval */ int *mtcnt, /* number of entries of each row in arrays mtind and mtval */ int *mtind, /* column indices of the nonzero entries of the ILP matrix */ int *mtval, /* values of the nonzero entries of the ILP matrix */ int *vlb, /* lower bounds on the variables */ int *vub, /* upper bounds on the variables */ int *mrhs, /* right hand sides of the constraints */ char *msense, /* senses of the constraints: 'L', 'G' or 'E' */ const double *xstar, /* current optimal solution of the LP relaxation */ bool aggressive, /* flag asking whether as many cuts as possible are required on output (TRUE) or not (FALSE) */ /* OUTPUT parameters (the memory for the vectors is allocated INTERNALLY by the procedure: if some memory is already allocated, it is FREED): */ int *cnum, /* number of violated 0-1/2 cuts identified by the procedure */ int *cnzcnt, /* overall number of nonzero's in the cuts */ int **cbeg, /* starting position of each cut in arrays cind and cval */ int **ccnt, /* number of entries of each cut in arrays cind and cval */ int **cind, /* column indices of the nonzero entries of the cuts */ int **cval, /* values of the nonzero entries of the cuts */ int **crhs, /* right hand sides of the cuts */ char **csense /* senses of the cuts: 'L', 'G' or 'E' */ /* NOTE that all the numerical input/output vectors are INTEGER (with the exception of xstar), since the procedure is intended to work with pure ILP's, and that the ILP matrix has to be given on input in ROW format. */ ) { #ifdef TIME float tbasi, tbasf; #endif errorNo=0; cut_list *out_cuts, *add_cuts; #ifdef TIME second_(&tti); #endif aggr = aggressive; /* load the input ILP into an internal data structure */ //ilp_load(mr,mc,mnz,mtbeg,mtcnt,mtind,mtval, // vlb,vub,mrhs,msense); inp_ilp->xstar = xstar; /* construct an internal data structure containing all the information which can be useful for 0-1/2 cut separation - this may in fact be done only at the first call of the separation procedure */ #ifdef TIME second_(&ti); #endif get_parity_ilp(); /* print_double_vect("xstar",p_ilp->xstar,p_ilp->mc); print_parity_ilp(); */ #ifdef TIME second_(&tf); prep_time += tf - ti; #endif if ( p_ilp->mnz == 0 ) { #ifdef COIN_DEVELOP printf("Warning: no significant constraint for 0-1/2 cut separation\n"); printf("... end separation\n"); #endif //free_ilp(); //free_parity_ilp(); #ifdef TIME second_(&ttf); total_time += ttf - tti; #endif return(FALSE); } /* print_double_vect("xstar",p_ilp->xstar,p_ilp->mc); */ sep_iter++; update_log_var(); #ifdef POOL /* search for possible violated cuts in the pool */ #ifdef TIME second_(&tpi); #endif add_cuts = get_cuts_from_pool(FALSE); #ifdef TIME second_(&tpf); pool_time += tpf - tpi; #ifdef PRINT_TIME printf("... time elapsed at the end of get_cuts_from_pool: %f\n",tpf - tti); #endif #endif if ( add_cuts->cnum == 0 ) { free_cut_list(add_cuts); } else { /* printf("Violated cuts found in the pool - no separation procedure used\n"); */ goto free_memory; } #endif /* try to identify violated 0-1/2 cuts by using the original procedure described in Caprara and Fischetti's MP paper */ #ifdef TIME second_(&tbasi); #endif out_cuts = basic_separation(); #ifdef TIME second_(&tbasf); tot_basic_sep_time += tbasf - tbasi; avg_basic_sep_time = tot_basic_sep_time / (float) sep_iter; #endif //#define TABU_SEARCH #ifdef TABU_SEARCH /* try to identify violated cuts by tabu search if none was found */ if ( out_cuts->cnum == 0 ) { free_cut_list(out_cuts); #ifdef TIME second_(&ttabi); #endif out_cuts = tabu_012(); #ifdef TIME second_(&ttabf); tabu_time += ttabf - ttabi; #endif } #endif #ifdef POOL /* add the cuts separated to the pool */ #ifdef TIME second_(&tpi); #endif add_cuts_to_pool(out_cuts); free_cut_list(out_cuts); /* select from the pool a convenient set of violated constraints to be added to the current LP */ add_cuts = get_cuts_from_pool(TRUE); #ifdef TIME second_(&tpf); pool_time += tpf - tpi; #ifdef PRINT_TIME printf("... time elapsed at the end of get_cuts_from_pool: %f\n",tpf - tti); #endif #endif #else /* give on output the cuts separated */ add_cuts = out_cuts; #endif //free_ilp(); //free_parity_ilp(); #ifdef TIME second_(&ttf); total_time += ttf - tti; #endif if ( add_cuts->cnum > 0 ) { getcuts(add_cuts,cnum,cnzcnt,cbeg,ccnt,cind,cval,crhs,csense); /* print_cut_list(add_cuts); */ free_cut_list(add_cuts); return(TRUE); } else { free_cut_list(add_cuts); return(FALSE); } } #ifdef TIME /* print_times: print the timings of the separation procedure */ void print_times() { printf("... separation timings \n"); printf("times total: %f prep: %f weak: %f aux: %f path: %f cycle: %f cut: %f (%d calls) bw: %f coef: %f pool: %f tabu: %f\n", total_time, prep_time, weak_time, aux_time, path_time, cycle_time, cut_time, cut_ncalls, bw_time, coef_time, pool_time, tabu_time); } #endif //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- Cgl012Cut::Cgl012Cut () : inp_ilp(NULL), p_ilp(NULL), iter(0), gap(0.0), maxgap(0.0), errorNo(0), sep_iter(0), vlog(NULL), aggr(true) { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- Cgl012Cut::Cgl012Cut (const Cgl012Cut & rhs) : inp_ilp(NULL), p_ilp(NULL), iter(rhs.iter), gap(rhs.gap), maxgap(rhs.maxgap), errorNo(rhs.errorNo), sep_iter(rhs.sep_iter), vlog(NULL), aggr(rhs.aggr) { if (rhs.p_ilp||rhs.vlog||inp_ilp) abort(); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- Cgl012Cut::~Cgl012Cut () { free_log_var(); free_parity_ilp(); free_ilp(); } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- Cgl012Cut & Cgl012Cut::operator=( const Cgl012Cut& rhs) { if (this != &rhs) { if (rhs.p_ilp||rhs.vlog||inp_ilp) abort(); free_log_var(); free_parity_ilp(); free_ilp(); #if 0 inp_ilp = reinterpret_cast (calloc(1,sizeof(ilp))); if ( inp_ilp == NULL ) alloc_error(const_cast("inp_ilp")); inp_ilp->mr = rhs.inp_ilp->mr; inp_ilp->mc = rhs.inp_ilp->mc; inp_ilp->mnz = rhs.inp_ilp->mnz; inp_ilp->mtbeg = rhs.inp_ilp->mtbeg; inp_ilp->mtcnt = rhs.inp_ilp->mtcnt; inp_ilp->mtind = rhs.inp_ilp->mtind; inp_ilp->mtval = rhs.inp_ilp->mtval; inp_ilp->vlb = rhs.inp_ilp->vlb; inp_ilp->vub = rhs.inp_ilp->vub; inp_ilp->mrhs = rhs.inp_ilp->mrhs; inp_ilp->msense = rhs.inp_ilp->msense; #endif iter = rhs.iter; gap = rhs.gap; maxgap = rhs.maxgap; errorNo = rhs.errorNo; sep_iter = rhs.sep_iter; aggr = rhs.aggr; } return *this; } CoinMP-1.8.3/Cgl/src/CglZeroHalf/CglZeroHalf.hpp0000644000175000017500000000704112130104031017604 0ustar renerene// $Id: CglZeroHalf.hpp 1122 2013-04-06 20:39:53Z stefan $ // Copyright (C) 2010, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglZeroHalf_H #define CglZeroHalf_H #include #include "CglCutGenerator.hpp" #include "CoinPackedMatrix.hpp" #include "Cgl012cut.hpp" /** Zero Half Cut Generator Class This class generates zero half cuts via the following method: See - G. Andreello, A. Caprara, M. Fischetti, “Embedding Cuts in a Branch and Cut Framework: a Computational Study with {0,1/2}-Cutsâ€, INFORMS Journal on Computing 19(2), 229-238, 2007. */ class CglZeroHalf : public CglCutGenerator { friend void CglZeroHalfUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /**@name Generate Cuts */ //@{ /** Generate zero half cuts for the model accessed through the solver interface. Insert generated cuts into the cut set cs. */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Sets and Gets */ //@{ /// Get flags inline int getFlags() const { return flags_;} /// Set flags inline void setFlags(int value) { flags_ = value;} //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglZeroHalf (); /// Copy constructor CglZeroHalf ( const CglZeroHalf &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglZeroHalf & operator=( const CglZeroHalf& rhs); /// Destructor virtual ~CglZeroHalf (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); /// This can be used to refresh any information virtual void refreshSolver(OsiSolverInterface * solver); //@} private: // Private member methods /**@name Private methods */ //@{ //@} /**@name Private member data */ //@{ /// number of rows in the ILP matrix int mr_; /// number of columns in the ILP matrix int mc_; /// number of nonzero's in the ILP matrix int mnz_; /// starting position of each row in arrays mtind and mtval int *mtbeg_; /// number of entries of each row in arrays mtind and mtval int *mtcnt_; /// column indices of the nonzero entries of the ILP matrix int *mtind_; /// values of the nonzero entries of the ILP matrix int *mtval_; /// lower bounds on the variables int *vlb_; /// upper bounds on the variables int *vub_; /// right hand sides of the constraints int *mrhs_; /// senses of the constraints: 'L', 'G' or 'E' char *msense_; /// Cgl012Cut object to make thread safe Cgl012Cut cutInfo_; /** Flags 1 bit - global cuts */ int flags_; //@} }; /// A simple Dijkstra shortest path - make better later #ifndef CGL_NEW_SHORT void cglShortestPath(cgl_graph * graph, int source, int maximumLength); #else void cglShortestPath(auxiliary_graph * graph, int source, int maximumLength); #endif //############################################################################# /** A function that tests the methods in the CglZeroHalf class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglZeroHalfUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); #endif CoinMP-1.8.3/Cgl/src/Makefile.am0000644000175000017500000000452412243462625014657 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1159 2013-11-21 19:57:09Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign # We need to recurse into all Cgl subproject subdirectories SUBDIRS = $(CGL_SUBDIRS) ######################################################################## # libCgl # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in the $libdir directory lib_LTLIBRARIES = libCgl.la # List all source files for this library, including headers libCgl_la_SOURCES = \ CglConfig.h \ CglCutGenerator.cpp CglCutGenerator.hpp\ CglMessage.cpp CglMessage.hpp \ CglStored.cpp CglStored.hpp \ CglParam.cpp CglParam.hpp \ CglTreeInfo.cpp CglTreeInfo.hpp # This is for libtool (on Windows) libCgl_la_LDFLAGS = $(LT_LDFLAGS) # We want to have all the sublibraries from the Cgl subprojects collected into # this library libCgl_la_LIBADD = $(CGL_SUBLIBS) if DEPENDENCY_LINKING libCgl_la_LIBADD += $(CGLLIB_LIBS) endif # Since automake is not doing this on its own, we need to declare the # dependencies to the subdirectory libraries here libCgl_la_DEPENDENCIES = $(CGL_SUBLIBS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ CglCutGenerator.hpp \ CglMessage.hpp \ CglStored.hpp \ CglParam.hpp \ CglTreeInfo.hpp install-exec-local: $(install_sh_DATA) config_cgl.h $(DESTDIR)$(includecoindir)/CglConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/CglConfig.h CoinMP-1.8.3/Cgl/src/CglOddHole/0000755000175000017500000000000012600453455014560 5ustar renereneCoinMP-1.8.3/Cgl/src/CglOddHole/CglOddHole.hpp0000644000175000017500000001124012130102162017213 0ustar renerene// $Id: CglOddHole.hpp 1119 2013-04-06 20:24:18Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglOddHole_H #define CglOddHole_H #include #include "CglCutGenerator.hpp" /** Odd Hole Cut Generator Class */ class CglOddHole : public CglCutGenerator { friend void CglOddHoleUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /**@name Generate Cuts */ //@{ /** Generate odd hole cuts for the model of the solver interface, si. This looks at all rows of type sum x(i) <= 1 (or == 1) (x 0-1) and sees if there is an odd cycle cut. See Grotschel, Lovasz and Schrijver (1988) for method. This is then lifted by using the corresponding Chvatal cut i.e. Take all rows in cycle and add them together. RHS will be odd so weaken all odd coefficients so 1.0 goes to 0.0 etc - then constraint is sum even(j)*x(j) <= odd which can be replaced by sum (even(j)/2)*x(j) <= (odd-1.0)/2. A similar cut can be generated for sum x(i) >= 1. Insert the generated cuts into OsiCut, cs. This is only done for rows with unsatisfied 0-1 variables. If there are many of these it will be slow. Improvements would do a randomized subset and also speed up shortest path algorithm used. */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Create Row List */ //@{ /// Create a list of rows which might yield cuts /// this is to speed up process /// The possible parameter is a list to cut down search void createRowList( const OsiSolverInterface & si, const int * possible=NULL); /// This version passes in a list - 1 marks possible void createRowList(int numberRows, const int * whichRow); //@} /**@name Create Clique List */ //@{ /// Create a list of extra row cliques which may not be in matrix /// At present these are classical cliques void createCliqueList(int numberCliques, const int * cliqueStart, const int * cliqueMember); //@} /**@name Number Possibilities */ //@{ /// Returns how many rows might give odd hole cuts int numberPossible(); //@} /**@name Gets and Sets */ //@{ /// Minimum violation double getMinimumViolation() const; void setMinimumViolation(double value); /// Minimum violation per entry double getMinimumViolationPer() const; void setMinimumViolationPer(double value); /// Maximum number of entries in a cut int getMaximumEntries() const; void setMaximumEntries(int value); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglOddHole (); /// Copy constructor CglOddHole ( const CglOddHole &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglOddHole & operator=( const CglOddHole& rhs); /// Destructor virtual ~CglOddHole (); /// This can be used to refresh any inforamtion virtual void refreshSolver(OsiSolverInterface * solver); //@} private: // Private member methods /**@name Private methods */ //@{ /// Generate cuts from matrix copy and solution /// If packed true then <=1 rows, otherwise >=1 rows. void generateCuts(const OsiRowCutDebugger * debugger, const CoinPackedMatrix & rowCopy, const double * solution, const double * dj, OsiCuts & cs, const int * suitableRow, const int * fixedColumn,const CglTreeInfo info, bool packed); //@} // Private member data /**@name Private member data */ //@{ /// list of suitableRows int * suitableRows_; /// start of each clique int * startClique_; /// clique members int * member_; /// epsilon double epsilon_; /// 1-epsilon double onetol_; /// Minimum violation double minimumViolation_; /// Minimum violation per entry double minimumViolationPer_; /// Maximum number of entries in a cut int maximumEntries_; /// number of rows when suitability tested int numberRows_; /// number of cliques int numberCliques_; //@} }; //############################################################################# /** A function that tests the methods in the CglOddHole class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglOddHoleUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); #endif CoinMP-1.8.3/Cgl/src/CglOddHole/Makefile.in0000644000175000017500000005434312506321416016632 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglOddHole DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglOddHole_la_LIBADD = am_libCglOddHole_la_OBJECTS = CglOddHole.lo CglOddHoleTest.lo libCglOddHole_la_OBJECTS = $(am_libCglOddHole_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglOddHole_la_SOURCES) DIST_SOURCES = $(libCglOddHole_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglOddHole # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglOddHole.la # List all source files for this library, including headers libCglOddHole_la_SOURCES = CglOddHole.cpp CglOddHole.hpp CglOddHoleTest.cpp # This is for libtool (on Windows) libCglOddHole_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglOddHole.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglOddHole/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglOddHole/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglOddHole.la: $(libCglOddHole_la_OBJECTS) $(libCglOddHole_la_DEPENDENCIES) $(CXXLINK) $(libCglOddHole_la_LDFLAGS) $(libCglOddHole_la_OBJECTS) $(libCglOddHole_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglOddHole.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglOddHoleTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglOddHole/Makefile.am0000644000175000017500000000317611621724114016616 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglOddHole # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglOddHole.la # List all source files for this library, including headers libCglOddHole_la_SOURCES = CglOddHole.cpp CglOddHole.hpp CglOddHoleTest.cpp # This is for libtool (on Windows) libCglOddHole_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglOddHole.hpp CoinMP-1.8.3/Cgl/src/CglOddHole/CglOddHole.cpp0000644000175000017500000005423212130103340017215 0ustar renerene// $Id: CglOddHole.cpp 1120 2013-04-06 20:34:40Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "OsiRowCutDebugger.hpp" #include "CglOddHole.hpp" //#define CGL_DEBUG // We may want to sort cut typedef struct {double dj;double element; int sequence;} double_double_int_triple; class double_double_int_triple_compare { public: bool operator() (double_double_int_triple x , double_double_int_triple y) const { return ( x.dj < y.dj); } }; //------------------------------------------------------------------------------- // Generate three cycle cuts //------------------------------------------------------------------- void CglOddHole::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) { // Get basic problem information int nRows=si.getNumRows(); int nCols=si.getNumCols(); const CoinPackedMatrix * rowCopy = si.getMatrixByRow(); // Could do cliques and extra OSL cliques // For moment just easy ones // If no information exists then get a list of suitable rows // If it does then suitable rows are subset of information CglOddHole temp; int * checkRow = new int[nRows]; int i; if (!suitableRows_) { for (i=0;igetIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * collower = si.getColLower(); const double * colupper = si.getColUpper(); int * suitable = temp.suitableRows_; // At present I am using new and delete as easier to see arrays in debugger int * fixed = new int[nCols]; // mark fixed columns for (i=0;ionetol_) { solution[i]=1.0; fixed[i]=+1; } } else { //mark as fixed even if not (can not intersect any interesting rows) solution[i]=0.0; fixed[i]=3; } } // first do packed const double * rowlower = si.getRowLower(); const double * rowupper = si.getRowUpper(); for (i=0;i1.001) suitable[i]=-1; for (k=rowStart[i]; konOptimalPath(si)) debugger = NULL; #else const OsiRowCutDebugger * debugger = NULL; #endif temp.generateCuts(debugger, *rowCopy,solution, si.getReducedCost(),cs,suitable,fixed,info,true); // now cover //if no >= then skip bool doCover=false; int nsuitable=0; for (i=0;i1.001) doCover=true; for (k=rowStart[i]; k1.1) { suitable[i]=-1; //say no good } else { nsuitable++; } } } if (doCover&&nsuitable) temp.generateCuts(debugger, *rowCopy,solution,si.getReducedCost(), cs,suitable,fixed,info,false); delete [] checkRow; delete [] solution; delete [] fixed; } void CglOddHole::generateCuts(const OsiRowCutDebugger * /*debugger*/, const CoinPackedMatrix & rowCopy, const double * solution, const double * dj, OsiCuts & cs, const int * suitableRow, const int * fixedColumn, const CglTreeInfo info, bool packed) { CoinPackedMatrix columnCopy = rowCopy; columnCopy.reverseOrdering(); // Get basic problem information int nRows=columnCopy.getNumRows(); int nCols=columnCopy.getNumCols(); const int * column = rowCopy.getIndices(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const int * rowLength = rowCopy.getVectorLengths(); const int * row = columnCopy.getIndices(); const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); const int * columnLength = columnCopy.getVectorLengths(); // we need only look at suitable rows and variables with unsatisfied 0-1 // lookup from true row to compressed matrix int * mrow = new int[nRows]; // lookup from true column to compressed int * lookup = new int[nCols]; // number of columns in compressed matrix int nSmall=0; int i; //do lookup from true sequence to compressed int n=0; for (i=0;i0) { mrow[i]=n++; } else { mrow[i]=-1; } } for (i=0;i (malloc(maxels*sizeof(double))); // arc i.e. j which can be reached from i int * to= reinterpret_cast (malloc(maxels*sizeof(int))); //original row for each arc int * rowfound=reinterpret_cast (malloc(maxels*sizeof(int))); // start of each column int * starts=new int[2*nSmall+1]; starts[0]=0; // useful array for marking if already connected int * mark =new int[nSmall2]; memset(mark,0,nSmall2*sizeof(int)); n=0; //number of elements in matrix for (i=0;i=0) { // column in compressed matrix int k; double dd=1.0000001-solution[i]; mark[icol]=1; // reallocate if matrix reached size limit if (n+nCols>maxels) { maxels*=2; cost=reinterpret_cast (realloc(cost,maxels*sizeof(double))); to=reinterpret_cast (realloc(to,maxels*sizeof(int))); rowfound=reinterpret_cast (realloc(rowfound,maxels*sizeof(int))); } // get all other connected variables for (k=columnStart[i];k=0) { int j; for (j=rowStart[irow];j=0&&!mark[kcol]) { cost[n]=dd-solution[jcol]; to[n]=kcol; rowfound[n++]=irow;//original row mark[kcol]=1; } } } } starts[icol+1]=n; // zero out markers for next column mark[icol]=0; for (k=starts[icol];k=nSmall) abort(); mark[to[k]]=0; } } } //if cover then change sign - otherwise make sure positive if (packed) { for (i=0;imaxels) { maxels=2*n; cost=reinterpret_cast (realloc(cost,maxels*sizeof(double))); to=reinterpret_cast (realloc(to,maxels*sizeof(int))); rowfound=reinterpret_cast (realloc(rowfound,maxels*sizeof(int))); } /* copy and make bipartite*/ for (i=0;irandomDouble(); } } else { CoinSeedRandom(13579); for (i=0;i (malloc(maxcuts*sizeof(double))); // to clean (should not be needed) int * clean = new int[nSmall2]; int * candidate = new int[CoinMax(nSmall2,nCols)]; double * element = new double[nCols]; // in case we want to sort double_double_int_triple * sortit = new double_double_int_triple [nCols]; memset(mark,0,nSmall2*sizeof(int)); int * countcol = new int[nCols]; memset(countcol,0,nCols*sizeof(int)); int bias = packed ? 0 : 1; //amount to add before halving // If nSmall large then should do a randomized subset // Improvement 1 int icol; for (icol=0;icol=nSmall) { jjcol=jcol-nSmall; } else { jjcol=jcol; } #ifdef CGL_DEBUG printf(" %d",jjcol); #endif if (mark[jjcol]) { // good=false; // probably means this is from another cycle (will have been found) // one of cycles must be zero cost // printf("variable already on chain!\n"); } else { mark[jjcol]=1; clean[nclean++]=jjcol; candidate[ii++]=jcol; #ifdef CGL_DEBUG assert (ii<=nSmall2); #endif } } #ifdef CGL_DEBUG printf("\n"); #endif for (j=0;j0;k--) { int jk,kk=candidate[k]; int ix=0; for (jk=starts[kk];jk>1; double rhs=nrow2; if (!packed) rhs++; // +1 for cover ii=0; for (k=0;k>1; if (ihalf) { element[ii]=ihalf; sum+=solution[jcol]*element[ii]; /*printf("%d %g %g\n",jcol,element[ii],sumall[jcol]);*/ candidate[ii++]=jcol; } countcol[jcol]=0; } } #ifdef CGL_DEBUG printf("\n"); #endif OsiRowCut rc; double violation=0.0; if (packed) { violation = sum-rhs; rc.setLb(-COIN_DBL_MAX); rc.setUb(rhs); } else { // other way for cover violation = rhs-sum; rc.setUb(COIN_DBL_MAX); rc.setLb(rhs); } if (violation (ii) * minimumViolationPer_>violation|| ii>maximumEntries_) { #ifdef CGL_DEBUG printf("why no cut\n"); #endif if (packed) { // sort and see if we can get down to length // relax by taking out ones with solution 0.0 nincut=ii; for (k=0;k (realloc(hash,maxcuts*sizeof(double))); } hash[ncuts++]=value; rc.setRow(ii,candidate,element); #ifdef CGL_DEBUG printf("sum %g rhs %g %d\n",sum,rhs,ii); if (debugger) assert(!debugger->invalidCut(rc)); #endif cs.insert(rc); } } } /* end of adding cut */ } } } delete [] countcol; delete [] element; delete [] candidate; delete [] sortit; delete [] clean; delete [] path; delete [] stack; free(hash); delete [] check; delete [] mark; delete [] starts; delete [] lookup; delete [] mrow; free(rowfound); free(to); free(cost); } // Create a list of rows which might yield cuts // The possible parameter is a list to cut down search void CglOddHole::createRowList( const OsiSolverInterface & si, const int * possible) { // Get basic problem information int nRows=si.getNumRows(); const CoinPackedMatrix * rowCopy = si.getMatrixByRow(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); int rowIndex; delete [] suitableRows_; numberRows_=nRows; const double * rowElements = rowCopy->getElements(); const double * rowupper = si.getRowUpper(); const double * rowlower = si.getRowLower(); const double * collower = si.getColLower(); const double * colupper = si.getColUpper(); suitableRows_=new int[nRows]; if (possible) { memcpy(suitableRows_,possible,nRows*sizeof(int)); } else { int i; for (i=0;iepsilon_) { // could allow general integer variables but unlikely if (!si.isBinary(thisCol) ) { goodRow=false; break; } if (fabs(rowElements[i]-1.0)>epsilon_) { goodRow=false; break; } } else { rhs1 -= collower[thisCol]*rowElements[i]; rhs2 -= collower[thisCol]*rowElements[i]; } } if (fabs(rhs1-1.0)>epsilon_&&fabs(rhs2-1.0)>epsilon_) { goodRow=false; } if (goodRow) { suitableRows_[rowIndex]=1; } else { suitableRows_[rowIndex]=0; } } } } /// This version passes in a list - 1 marks possible void CglOddHole::createRowList(int numberRows, const int * whichRow) { suitableRows_=new int [numberRows]; numberRows_=numberRows; memcpy(suitableRows_,whichRow,numberRows*sizeof(int)); } // Create a list of extra row cliques which may not be in matrix // At present these are classical cliques void CglOddHole::createCliqueList(int numberCliques, const int * cliqueStart, const int * cliqueMember) { numberCliques_=numberCliques; startClique_=new int[numberCliques_+1]; memcpy(startClique_,cliqueStart,(numberCliques_+1)*sizeof(int)); int length=startClique_[numberCliques_]; member_=new int[length]; memcpy(member_,cliqueMember,length*sizeof(int)); } // Returns how many rows might give three cycle cuts int CglOddHole::numberPossible() { int i,n=0; for (i=0;i1.0e-8&&value<=0.5) minimumViolation_=value; } // Minimum violation per entry double CglOddHole::getMinimumViolationPer() const { return minimumViolationPer_; } void CglOddHole::setMinimumViolationPer(double value) { if (value>1.0e-8&&value<=0.25) minimumViolationPer_=value; } // Maximum number of entries in a cut int CglOddHole::getMaximumEntries() const { return maximumEntries_; } void CglOddHole::setMaximumEntries(int value) { if (value>2) maximumEntries_=value; } // This can be used to refresh any inforamtion void CglOddHole::refreshSolver(OsiSolverInterface * ) { } CoinMP-1.8.3/Cgl/src/CglOddHole/CglOddHoleTest.cpp0000644000175000017500000000573512130104031020057 0ustar renerene// $Id: CglOddHoleTest.cpp 1122 2013-04-06 20:39:53Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CoinPackedMatrix.hpp" #include "CglOddHole.hpp" //-------------------------------------------------------------------------- // test EKKsolution methods. void CglOddHoleUnitTest( const OsiSolverInterface * baseSiP, const std::string mpsDir ) { CoinRelFltEq eq(0.000001); // Test default constructor { CglOddHole aGenerator; } // Test copy & assignment { CglOddHole rhs; { CglOddHole bGenerator; CglOddHole cGenerator(bGenerator); rhs=bGenerator; } } // test on simple case { const int nRows=3; const int nCols=3; const int nEls=6; const double elem[]={1.0,1.0,1.0,1.0,1.0,1.0}; const int row[]={0,1,0,2,1,2}; const CoinBigIndex start[]={0,2,4}; const int len[]={2,2,2}; CoinPackedMatrix matrix(true,nRows,nCols,nEls,elem,row,start,len); const double sol[]={0.5,0.5,0.5}; const double dj[]={0,0,0}; const int which[]={1,1,1}; const int fixed[]={0,0,0}; OsiCuts cs; CglOddHole test1; CglTreeInfo info; info.randomNumberGenerator=NULL; test1.generateCuts(NULL,matrix,sol,dj,cs,which,fixed,info,true); CoinPackedVector check; int index[] = {0,1,2}; double el[] = {1,1,1}; check.setVector(3,index,el); //assert (cs.sizeRowCuts()==2); assert (cs.sizeRowCuts()==1); // sort Elements in increasing order CoinPackedVector rpv=cs.rowCut(0).row(); rpv.sortIncrIndex(); assert (check==rpv); } // Testcase /u/rlh/osl2/mps/scOneInt.mps // Model has 3 continous, 2 binary, and 1 general // integer variable. { OsiSolverInterface * siP = baseSiP->clone(); std::string fn = mpsDir+"scOneInt"; siP->readMps(fn.c_str(),"mps"); #if 0 CglOddHole cg; int nCols=siP->getNumCols(); // Test the siP methods for detecting // variable type int numCont=0, numBinary=0, numIntNonBinary=0, numInt=0; for (int thisCol=0; thisColisContinuous(thisCol) ) numCont++; if ( siP->isBinary(thisCol) ) numBinary++; if ( siP->isIntegerNonBinary(thisCol) ) numIntNonBinary++; if ( siP->isInteger(thisCol) ) numInt++; } assert(numCont==3); assert(numBinary==2); assert(numIntNonBinary==1); assert(numInt==3); // Test initializeCutGenerator siP->initialSolve(); assert(xstar !=NULL); for (i=0; igetNumRows(); for (i=0; igetMatrixByRow()->getVectorSize(i); assert(vectorsize==2); } kccg.cleanUpCutGenerator(complement,xstar); #endif delete siP; } } CoinMP-1.8.3/Cgl/src/CglTwomir/0000755000175000017500000000000012600453455014523 5ustar renereneCoinMP-1.8.3/Cgl/src/CglTwomir/Makefile.in0000644000175000017500000005442712506321416016600 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ @COIN_HAS_OSICLP_TRUE@am__append_1 = $(OSICLP_CFLAGS) subdir = src/CglTwomir DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglTwomir_la_LIBADD = am_libCglTwomir_la_OBJECTS = CglTwomir.lo CglTwomirTest.lo libCglTwomir_la_OBJECTS = $(am_libCglTwomir_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglTwomir_la_SOURCES) DIST_SOURCES = $(libCglTwomir_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglTwomir # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglTwomir.la # List all source files for this library, including headers libCglTwomir_la_SOURCES = CglTwomir.cpp CglTwomir.hpp CglTwomirTest.cpp # This is for libtool (on Windows) libCglTwomir_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) \ $(OSI_CFLAGS) $(am__append_1) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglTwomir.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglTwomir/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglTwomir/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglTwomir.la: $(libCglTwomir_la_OBJECTS) $(libCglTwomir_la_DEPENDENCIES) $(CXXLINK) $(libCglTwomir_la_LDFLAGS) $(libCglTwomir_la_OBJECTS) $(libCglTwomir_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglTwomir.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglTwomirTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglTwomir/Makefile.am0000644000175000017500000000326712122056610016556 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1105 2013-03-19 12:43:52Z forrest $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglTwomir # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglTwomir.la # List all source files for this library, including headers libCglTwomir_la_SOURCES = CglTwomir.cpp CglTwomir.hpp CglTwomirTest.cpp # This is for libtool (on Windows) libCglTwomir_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) if COIN_HAS_OSICLP AM_CPPFLAGS += $(OSICLP_CFLAGS) endif # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglTwomir.hpp CoinMP-1.8.3/Cgl/src/CglTwomir/CglTwomirTest.cpp0000644000175000017500000000425012130103340017756 0ustar renerene// $Id: CglTwomirTest.cpp 1120 2013-04-06 20:34:40Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglTwomir.hpp" void CglTwomirUnitTest(const OsiSolverInterface *baseSiP, const std::string mpsDir) { // Test default constructor { CglTwomir aGenerator; } // Test copy & assignment { CglTwomir rhs; { CglTwomir bGenerator; CglTwomir cGenerator(bGenerator); rhs=bGenerator; } } // Test get/set methods { CglTwomir getset; int gtmin = getset.getTmin() + 1; int gtmax = getset.getTmax() + 1; getset.setMirScale(gtmin, gtmax); double gtmin2 = getset.getTmin(); double gtmax2 = getset.getTmax(); assert(gtmin == gtmin2); assert(gtmax == gtmax2); int gamax = 2 * getset.getAmax() + 1; getset.setAMax(gamax); int gamax2 = getset.getAmax(); assert(gamax == gamax2); } // Test generateCuts { CglTwomir gct; OsiSolverInterface *siP = baseSiP->clone(); std::string fn = mpsDir+"capPlan1"; std::string fn2 = mpsDir+"capPlan1.mps"; FILE *in_f = fopen(fn2.c_str(), "r"); if(in_f == NULL) { std::cout<<"Can not open file "<readMps(fn.c_str(),"mps"); siP->initialSolve(); double lpRelax = siP->getObjValue(); OsiCuts cs; gct.generateCuts(*siP, cs); int nRowCuts = cs.sizeRowCuts(); std::cout<<"There are "< 0); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cs); siP->resolve(); double lpRelaxAfter= siP->getObjValue(); std::cout<<"Initial LP value: "< #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "OsiRowCutDebugger.hpp" #include "CoinFactorization.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinFinite.hpp" #include "CoinPackedMatrix.hpp" #include "OsiRowCutDebugger.hpp" #include "CoinWarmStartBasis.hpp" #include "CglTwomir.hpp" class CoinWarmStartBasis; #define COIN_HAS_CLP_TWOMIR #ifdef COIN_HAS_CLP_TWOMIR #include "OsiClpSolverInterface.hpp" #endif #undef DGG_DEBUG_DGG //#define DGG_DEBUG_DGG 1 //#define CGL_DEBUG //#define CGL_DEBUG_ZERO #define q_max data->cparams.q_max #define q_min data->cparams.q_min #define t_max data->cparams.t_max #define t_min data->cparams.t_min #define a_max data->cparams.a_max #define max_elements data->cparams.max_elements #ifdef CGL_DEBUG // Declarations and defines for debug build. #define talk true namespace { const OsiSolverInterface *six ; } void write_cut( DGG_constraint_t *cut){ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! printf("2mir_test: cut: !!!!!!!!!!!!!!!!!!!!!!!***********************************\n"); for (int i=0; inz; i++) { printf(" %12.10f x[%d] ", cut->coeff[i],cut->index[i]);} printf(" >= %12.10f \n", cut->rhs); } void testus( DGG_constraint_t *cut){ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // const OsiRowCutDebugger debugg(*six, "flugpl.mps"); const OsiRowCutDebugger debugg(*six, "egout.mps"); const OsiRowCutDebugger *debugger = &debugg; if (debugger&&!debugger->onOptimalPath(*six)) return; OsiRowCut rowcut; rowcut.setRow(cut->nz, cut->index, cut->coeff); rowcut.setUb(DBL_MAX); rowcut.setLb(cut->rhs); if(debugger->invalidCut(rowcut)){ write_cut(cut); //assert(0); } } #else // CGL_DEBUG #define talk false #endif // CGL_DEBUG //------------------------------------------------------------------- // Generate cuts //------------------------------------------------------------------- void CglTwomir::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info ) { # ifdef CGL_DEBUG //!!!!!!!!!!!!!!!!!! six = &si; # endif const double * colUpper = si.getColUpper(); const double * colLower = si.getColLower(); const OsiSolverInterface * useSolver; #ifdef COIN_HAS_CLP_TWOMIR double * objective = NULL; OsiClpSolverInterface * clpSolver = dynamic_cast(originalSolver_); int numberOriginalRows; int numberColumns=si.getNumCols(); int twomirType=0; if (!clpSolver) { #endif useSolver=&si; // Temp - check if free variables int ncol = useSolver->getNumCols(); int numberFree=0; for (int i=0;i1.0e20) numberFree++; } if (numberFree) { #ifdef COIN_DEVELOP if (!info.inTree&&!info.pass) printf("CglTwoMir - %d free variables - returning\n",numberFree); #endif return; } #ifdef COIN_HAS_CLP_TWOMIR } else { useSolver = originalSolver_; assert (twomirType_); // check simplex is plausible if (!clpSolver->getNumRows()||numberColumns!=clpSolver->getNumCols()) { delete originalSolver_; originalSolver_=si.clone(); clpSolver = dynamic_cast(originalSolver_); assert (clpSolver); useSolver = originalSolver_; } ClpSimplex * simplex = clpSolver->getModelPtr(); numberOriginalRows = simplex->numberRows(); int numberRows = si.getNumRows(); assert (numberOriginalRows<=numberRows); // only do if different (unless type 2x) twomirType = twomirType_%10; int whenToDo = twomirType_/10; if (whenToDo==2 ||(numberRows>numberOriginalRows && whenToDo==1 && (info.options&512)==0) || ((info.options&1024)!=0 && (info.options&512)==0)) { // bounds const double * solution = si.getColSolution(); memcpy(simplex->columnLower(),colLower,numberColumns*sizeof(double)); memcpy(simplex->columnUpper(),colUpper,numberColumns*sizeof(double)); for (int i=0;i1.0e20) { double lower=-COIN_DBL_MAX; double upper=COIN_DBL_MAX; if (solution[i]>0.0) lower=-1.0e10; else upper=1.0e10; originalSolver_->setColLower(i,lower); originalSolver_->setColUpper(i,upper); } } double * obj = simplex->objective(); objective = CoinCopyOfArray(obj,numberColumns); const double * pi = si.getRowPrice(); const CoinPackedMatrix * rowCopy = si.getMatrixByRow(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * rowElements = rowCopy->getElements(); const double * rowLower = si.getRowLower(); const double * rowUpper = si.getRowUpper(); int numberCopy; int numberAdd; double * rowLower2 = NULL; double * rowUpper2 = NULL; int * column2 = NULL; CoinBigIndex * rowStart2 = NULL; double * rowElements2 = NULL; char * copy = new char [numberRows-numberOriginalRows]; memset(copy,0,numberRows-numberOriginalRows); if (twomirType==2) { numberCopy=0; numberAdd=0; for (int iRow=numberOriginalRows;iRow0.5) obj[i] -= randomNumber*0.001*fabs(obj[i]); else obj[i] += randomNumber*0.001*fabs(obj[i]); } } #endif if (numberCopy) { clpSolver->addRows(numberCopy, rowStart2,column2,rowElements2, rowLower2,rowUpper2); delete [] rowLower2 ; delete [] rowUpper2 ; delete [] column2 ; delete [] rowStart2 ; delete [] rowElements2 ; } delete [] copy; memcpy(simplex->primalColumnSolution(),si.getColSolution(), numberColumns*sizeof(double)); CoinWarmStart * warmstart = si.getWarmStart(); CoinWarmStartBasis* warm = dynamic_cast(warmstart); warm->resize(simplex->numberRows(),numberColumns); clpSolver->setBasis(*warm); delete warm; simplex->setDualObjectiveLimit(COIN_DBL_MAX); simplex->setLogLevel(0); clpSolver->resolve(); //printf("Trying - %d its status %d objs %g %g - with offset %g\n", // simplex->numberIterations(),simplex->status(), // simplex->objectiveValue(),si.getObjValue(),simplex->objectiveValue()+offset); //simplex->setLogLevel(0); if (simplex->status()) { //printf("BAD status %d\n",simplex->status()); //clpSolver->writeMps("clp"); //si.writeMps("si"); delete [] objective; objective=NULL; useSolver=&si; } } } #endif useSolver->getStrParam(OsiProbName,probname_) ; int numberRowCutsBefore = cs.sizeRowCuts(); DGG_list_t cut_list; DGG_list_init (&cut_list); DGG_data_t* data = DGG_getData(reinterpret_cast (useSolver)); // Note that the lhs variables are hash defines to data->cparams.* q_max = q_max_; q_min = q_min_; t_max = t_max_; t_min = t_min_; a_max = a_max_; max_elements = info.inTree ? max_elements_ : max_elements_root_; data->gomory_threshold = info.inTree ? away_ : awayAtRoot_; if (!info.inTree) { //const CoinPackedMatrix * columnCopy = useSolver->getMatrixByCol(); //int numberColumns=columnCopy->getNumCols(); if (!info.pass||(info.options&32)!=0) { max_elements=useSolver->getNumCols(); //} else { //int numberRows=columnCopy.getNumRows(); //int numberElements=columnCopy->getNumElements(); //if (max_elements>500&&numberElements>10*numberColumns) //max_elements=numberColumns; } } if (!do_mir_) t_max = t_min - 1; if (!do_2mir_) q_max = q_min - 1; if (do_tab_ && info.level < 1 && info.pass < 6) DGG_generateTabRowCuts( &cut_list, data, reinterpret_cast (useSolver) ); if (do_form_) DGG_generateFormulationCuts( &cut_list, data, reinterpret_cast (useSolver), info.formulation_rows, randomNumberGenerator_); #ifdef CGL_DEBUG const OsiRowCutDebugger debugg(si,probname_.c_str()) ; const OsiRowCutDebugger *debugger = &debugg; if (debugger&&!debugger->onOptimalPath(si)) debugger = NULL; else {if(talk) printf ("2mir_test: debug success\n");} #endif int i; for ( i=0; inznz; i++) { if (!cut->coeff[i]) nZero++; } #ifdef CGL_DEBUG_ZERO if (nZero) { printf("Cut "); for( int i=0; i < cut->nz; i++) { printf("%d %g ",cut->index[i],cut->coeff[i]); } printf("\n"); } #endif if (nZero) { #ifdef CGL_DEBUG_ZERO printf("TwoMir cut had %d zero coefficients!\n",nZero); #endif } else { #ifdef CBC_CHECK_CUT double rhs = cut->rhs; int * cutIndex = cut->index; double * packed = cut->coeff; int i,number2=cut->nz; int number=0; double largest=0.0; double smallest=1.0e30; const double *colUpper = useSolver->getColUpper(); const double *colLower = useSolver->getColLower(); bool goodCut=true; for (i=0;i0.0) rhs -= value*colUpper[iColumn]; else rhs += value*colLower[iColumn]; } else { // throw away goodCut=false; break; } } else { int iColumn = cutIndex[i]; if (colUpper[iColumn]!=colLower[iColumn]) { largest=CoinMax(largest,value); smallest=CoinMin(smallest,value); cutIndex[number]=cutIndex[i]; packed[number++]=packed[i]; } else { // fixed so subtract out rhs -= packed[i]*colLower[iColumn]; } } } if (largest<5.0e9*smallest&&goodCut) { rowcut.setRow(number, cutIndex, packed); rowcut.setUb(COIN_DBL_MAX); rowcut.setLb(rhs); cs.insert(rowcut); } #else rowcut.setRow(cut->nz, cut->index, cut->coeff); rowcut.setUb(DBL_MAX); rowcut.setLb(cut->rhs); cs.insert(rowcut); #endif } #ifdef CGL_DEBUG if (debugger) { if (debugger->invalidCut(rowcut)) { write_cut(cut); printf ("2mir_test: debug failed, mayday, mayday **********************************\n");} //assert(0); } //assert(!debugger->invalidCut(rowcut)); #endif } } for ( i=0; irow().getNumElements(); if (length<=max_elements_) cs.rowCutPtr(i)->setGloballyValid(); } } #ifdef COIN_HAS_CLP_TWOMIR if (objective) { int numberRowCutsAfter = cs.sizeRowCuts(); ClpSimplex * simplex = clpSolver->getModelPtr(); memcpy(simplex->objective(),objective,numberColumns*sizeof(double)); delete [] objective; // take out locally useless cuts const double * solution = si.getColSolution(); double primalTolerance = 1.0e-7; for (int k = numberRowCutsAfter - 1; k >= numberRowCutsBefore; k--) { const OsiRowCut * thisCut = cs.rowCutPtr(k) ; double sum = 0.0; int n = thisCut->row().getNumElements(); const int * column = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); assert (n); for (int i = 0; i < n; i++) { double value = element[i]; sum += value * solution[column[i]]; } if (sum > thisCut->ub() + primalTolerance) { sum = sum - thisCut->ub(); } else if (sum < thisCut->lb() - primalTolerance) { sum = thisCut->lb() - sum; } else { sum = 0.0; } if (!sum) { // take out cs.eraseRowCut(k); } } #ifdef CLP_INVESTIGATE2 printf("OR %p pass %d inTree %c - %d cuts (but %d deleted)\n", originalSolver_,info.pass,info.inTree?'Y':'N', numberRowCutsAfter-numberRowCutsBefore, numberRowCutsAfter-cs.sizeRowCuts()); #endif } int numberRowCutsAfter = cs.sizeRowCuts(); if (!info.inTree) { for (int i=numberRowCutsBefore;isetGloballyValid(); } } if (twomirType==2) { // back to original int numberRows = clpSolver->getNumRows(); if (numberRows>numberOriginalRows) { int numberDelete = numberRows-numberOriginalRows; int * delRow = new int [numberDelete]; for (int i=0;ideleteRows(numberDelete,delRow); delete [] delRow; } } #endif } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglTwomir::CglTwomir () : CglCutGenerator(), probname_(), randomNumberGenerator_(987654321),originalSolver_(NULL), away_(0.0005),awayAtRoot_(0.0005),twomirType_(0), do_mir_(true), do_2mir_(true), do_tab_(true), do_form_(true), t_min_(1), t_max_(1), q_min_(1), q_max_(1), a_max_(2),max_elements_(50000), max_elements_root_(50000),form_nrows_(0) {} //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglTwomir::CglTwomir (const CglTwomir & source) : CglCutGenerator(source), randomNumberGenerator_(source.randomNumberGenerator_), originalSolver_(NULL), away_(source.away_), awayAtRoot_(source.awayAtRoot_), twomirType_(source.twomirType_), do_mir_(source.do_mir_), do_2mir_(source.do_2mir_), do_tab_(source.do_tab_), do_form_(source.do_form_), t_min_(source.t_min_), t_max_(source.t_max_), q_min_(source.q_min_), q_max_(source.q_max_), a_max_(source.a_max_), max_elements_(source.max_elements_), max_elements_root_(source.max_elements_root_), form_nrows_(source.form_nrows_) { probname_ = source.probname_ ; if (source.originalSolver_) originalSolver_ = source.originalSolver_->clone(); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglTwomir::clone() const { return new CglTwomir(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglTwomir::~CglTwomir () { delete originalSolver_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglTwomir & CglTwomir::operator=(const CglTwomir& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); randomNumberGenerator_ = rhs.randomNumberGenerator_; away_=rhs.away_; awayAtRoot_=rhs.awayAtRoot_; twomirType_ = rhs.twomirType_; delete originalSolver_; if (rhs.originalSolver_) originalSolver_ = rhs.originalSolver_->clone(); else originalSolver_=NULL; do_mir_=rhs.do_mir_; do_2mir_=rhs.do_2mir_; do_tab_=rhs.do_tab_; do_form_=rhs.do_form_; t_min_=rhs.t_min_; t_max_=rhs.t_max_; q_min_=rhs.q_min_; q_max_=rhs.q_max_; a_max_=rhs.a_max_; max_elements_=rhs.max_elements_; max_elements_root_ = rhs.max_elements_root_; form_nrows_=rhs.form_nrows_; } return *this; } // Pass in a copy of original solver (clone it) void CglTwomir::passInOriginalSolver(OsiSolverInterface * solver) { delete originalSolver_; if (solver) { if (!twomirType_) twomirType_=1; originalSolver_ = solver->clone(); originalSolver_->setHintParam(OsiDoDualInResolve, false, OsiHintDo); // Temp - check if free variables const double *colUpper = originalSolver_->getColUpper(); const double *colLower = originalSolver_->getColLower(); int ncol = originalSolver_->getNumCols(); int numberFree=0; for (int i=0;i1.0e20) numberFree++; } if (numberFree) printf("CglTwoMir - %d free variables - take care\n",numberFree); } else { twomirType_=0; originalSolver_=NULL; } } int DGG_freeData( DGG_data_t *data ) { free(data->info); free(data->lb); free(data->ub); free(data->x); free(data->rc); free(data); return 0; } DGG_data_t* DGG_getData(const void *osi_ptr ) { DGG_data_t *data = NULL; const OsiSolverInterface *si = reinterpret_cast (osi_ptr); data = reinterpret_cast (malloc( sizeof(DGG_data_t)) ); /* retrieve basis information */ CoinWarmStart *startbasis = si->getWarmStart(); const CoinWarmStartBasis *basis = dynamic_cast(startbasis); /* retrieve bounds information */ const double *colUpper = si->getColUpper(); const double *colLower = si->getColLower(); const double *rowUpper = si->getRowUpper(); const double *rowLower = si->getRowLower(); const double *redCost = si->getReducedCost(); const double *dualVal = si->getRowPrice(); /* retrieve current optimal solution */ const double *colSolut = si->getColSolution(); /* retrieve the matrix in row format */ const CoinPackedMatrix *rowMatrixPtr = si->getMatrixByRow(); const int *rowBeg = 0, *rowCnt = 0, *rowInd = 0; const double *rowMat; rowBeg = rowMatrixPtr->getVectorStarts(); rowCnt = rowMatrixPtr->getVectorLengths(); rowMat = rowMatrixPtr->getElements(); rowInd = rowMatrixPtr->getIndices(); /* set number of columns and number of rows */ data->ncol = si->getNumCols(); data->nrow = si->getNumRows(); /* set ninteger */ data->ninteger = 0; /* allocate memory for the arrays in 'data' */ data->info = reinterpret_cast (malloc( sizeof(int)*(data->ncol+data->nrow)) ); data->lb = reinterpret_cast (malloc( sizeof(double)*(data->ncol+data->nrow)) ); data->ub = reinterpret_cast (malloc( sizeof(double)*(data->ncol+data->nrow)) ); data->x = reinterpret_cast (malloc( sizeof(double)*(data->ncol+data->nrow)) ); data->rc = reinterpret_cast (malloc( sizeof(double)*(data->ncol+data->nrow)) ); memset(data->info, 0, sizeof(int)*(data->ncol+data->nrow)); /* set parameters for column variables */ data->nbasic_col = 0; for(int i=0; i < data->ncol; i++){ /* is variable basic */ if ( basis->getStructStatus(i) == CoinWarmStartBasis::basic ){ data->nbasic_col++; DGG_setIsBasic(data,i); } #if DGG_DEBUG_DGG { int error = 0; if ( basis->getStructStatus(i) != CoinWarmStartBasis::basic ) if ( fabs(colSolut[i] - colUpper[i]) > DGG_BOUND_THRESH ) if ( fabs(colSolut[i] - colLower[i]) > DGG_BOUND_THRESH ){ fprintf(stdout, "WARNING!!!! : "); fprintf(stdout, "variable %d non-basic, lb = %f, ub = %f, x = %f\n", i, colLower[i], colUpper[i], colSolut[i]); error+=1; } if (error) fprintf(stdout, "\nFOUND %d errors. BYE.\n", error); } #endif /* set variable bounds*/ data->lb[i] = colLower[i]; data->ub[i] = colUpper[i]; /* is variable integer */ if ( si->isInteger(i) ){ data->ninteger++; DGG_setIsInteger(data,i); /* tighten variable bounds*/ data->lb[i] = ceil(colLower[i]); data->ub[i] = floor(colUpper[i]); } /* set x value */ data->x[i] = colSolut[i]; /* WARNING: remember to set rc!! Its not set!! */ data->rc[i] = redCost[i]; } /* set parameters for row variables */ /* slack variables (row variables) work as follows: for a ranged constraint, b_dw < ax < b_up, define a variable s so that 1) if b_up is not infinity: ax + s = b_up, 0 < s < b_up - b_dw 2) if b_up is infinity: ax - s = b_dw, 0 < s < b_up - b_dw */ { int i,j; double activity; data->nbasic_row = 0; for(i=0, j=data->ncol; i < data->nrow; i++, j++){ /* check if the row is an equality constraint */ if ( fabs( rowUpper[i] - rowLower[i] ) <= DGG_BOUND_THRESH ) DGG_setEqualityConstraint(data,j); /* check if the row is bounded above/below and define variable bounds */ if ( rowUpper[i] < COIN_DBL_MAX ) DGG_setIsConstraintBoundedAbove(data,j); if ( rowLower[i] > -1*COIN_DBL_MAX ) DGG_setIsConstraintBoundedBelow(data,j); data->lb[j] = 0.0; if (DGG_isConstraintBoundedAbove(data,j) && DGG_isConstraintBoundedBelow(data,j)) data->ub[j] = rowUpper[i] - rowLower[i]; else data->ub[j] = COIN_DBL_MAX; /* compute row activity. for this we need to go to the row in question, and multiply all the coefficients times their respective variables. For the moment, we will store the inverse of this value in the 'x' field (since it is in fact a partial computation of it) */ { int k; activity = 0.0; for(k=rowBeg[i]; k < rowBeg[i]+rowCnt[i]; k++) activity += rowMat[k]*colSolut[rowInd[k]]; } /* compute x value */ if ( DGG_isConstraintBoundedAbove(data,j) ) data->x[j] = rowUpper[i] - activity; else data->x[j] = activity - rowLower[i]; if ( data->x[j] < -DGG_NULL_SLACK ){ #if DGG_DEBUG_DGG int k; double norm = 0.0, min = DBL_MAX, amin = DBL_MAX, max = DBL_MIN; printf("** warning: row %d has negative slack!\n", i); for(k=rowBeg[i]; k < rowBeg[i]+rowCnt[i]; k++){ norm += rowMat[k]*rowMat[k]; if ( fabs(rowMat[k]) < amin ) amin = fabs(rowMat[k]); if ( rowMat[k] < min ) min = rowMat[k]; if ( rowMat[k] > max ) max = rowMat[k]; } norm = sqrt(norm); printf("min = %f amin = %f max = %f\n", min, amin, max); printf("rlower = %f activity = %f\n", rowLower[i], activity); printf("norm = %f (b-ax) = %f\n", norm, (rowLower[i] - activity)); printf("steepn = %f\n", (rowLower[i] - activity)/norm); #endif } data->rc[j] = dualVal[i]; #if DGG_DEBUG_SOLVER DGG_IF_EXIT( !DGG_isConstraintBoundedAbove(data,j) && !DGG_isConstraintBoundedBelow(data,j), 1, "some row is not bounded above or below"); #endif /* is variable basic */ if ( basis->getArtifStatus(i) == CoinWarmStartBasis::basic ){ data->nbasic_row++; DGG_setIsBasic(data,j); } /* is variable integer. For this we need to go to the row in question, and check that the rhs is integer, and that all of the coefficients and variables participating in the constraint are also integer. */ { int k; if( DGG_isConstraintBoundedAbove(data,j)) { if ( frac_part(rowUpper[i]) > DGG_INTEGRALITY_THRESH ) goto DONE_ROW; } else if ( frac_part(rowLower[i]) > DGG_INTEGRALITY_THRESH ) goto DONE_ROW; for(k=rowBeg[i]; k < rowBeg[i]+rowCnt[i]; k++) if ( frac_part(rowMat[k]) > DGG_INTEGRALITY_THRESH || !DGG_isInteger(data, rowInd[k])) goto DONE_ROW; DGG_setIsInteger(data, j); data->ninteger++; } DONE_ROW:; /* set variable bounds: careful!! Later, remember to adjust the INFINITY to a DGG standard (to deal with neq solvers). */ /* WARNING: remember to set rc!! Its not set!! */ } } /* CLEANUP */ delete basis; return data; } DGG_constraint_t* DGG_getSlackExpression(const void *osi_ptr, DGG_data_t* data, int row_index) { DGG_constraint_t *row = 0; int i,j; /* retrieve the matrix in row format */ const OsiSolverInterface *si = reinterpret_cast (osi_ptr); const CoinPackedMatrix *rowMatrixPtr = si->getMatrixByRow(); const int *rowBeg = 0, *rowCnt = 0, *rowInd = 0; const double *rowMat; const double *rowUpper; const double *rowLower; row = DGG_newConstraint(data->ncol); rowBeg = rowMatrixPtr->getVectorStarts(); rowCnt = rowMatrixPtr->getVectorLengths(); rowMat = rowMatrixPtr->getElements(); rowInd = rowMatrixPtr->getIndices(); rowUpper = si->getRowUpper(); rowLower = si->getRowLower(); #if DGG_DEBUG_DGG if ( row_index < 0 || row_index > data->nrow ) DGG_THROW(0, "bad row index"); #endif /* copy the information into the row ADT */ row->nz = rowCnt[row_index]; for(j=0, i=rowBeg[row_index]; i < rowBeg[row_index]+rowCnt[row_index]; i++, j++){ row->coeff[j] = rowMat[i]; row->index[j] = rowInd[i]; if (DGG_isConstraintBoundedAbove (data, data->ncol + row_index)) row->coeff[j] = -row->coeff[j]; } row->sense = '?'; if ( DGG_isConstraintBoundedAbove(data, data->ncol + row_index) ) row->rhs = rowUpper[row_index]; else row->rhs = -rowLower[row_index]; return row; } int DGG_getTableauConstraint( int index, const void *osi_ptr, DGG_data_t *data, DGG_constraint_t* tabrow, const int * colIsBasic, const int * /*rowIsBasic*/, CoinFactorization & factorization, int mode ) { #if DGG_DEBUG_DGG /* ensure that the index corresponds to a basic variable */ if ( !DGG_isBasic(data, index) ) DGG_THROW(1, "index is non-basic"); /* ensure that the index corresponds to a column variable */ if ( index < 0 || index > (data->ncol - 1) ) DGG_THROW(1, "index not a column variable"); #endif /* obtain pointer to solver interface */ const OsiSolverInterface *si = reinterpret_cast (osi_ptr); DGG_TEST(!si, 1, "null OsiSolverInterfave"); /* obtain address of the LP matrix */ const CoinPackedMatrix *colMatrixPtr = si->getMatrixByCol(); const int* colBeg = colMatrixPtr->getVectorStarts(); const int* colCnt = colMatrixPtr->getVectorLengths(); const int* colInd = colMatrixPtr->getIndices(); const double* colMat = colMatrixPtr->getElements(); /* obtain row right-hand-sides */ const double *rowUpper = si->getRowUpper(); const double *rowLower = si->getRowLower(); /* allocate memory for constraint in non-sparse form */ int nz = 0; double *value = NULL, rhs = 0.0; value = reinterpret_cast(malloc(sizeof(double)*(data->nrow+data->ncol))); memset(value, 0, sizeof(double)*(data->nrow+data->ncol)); /* obtain the tableau row coefficients for all variables */ /* note: we could speed this up by only computing non-basic variables */ { int i, j, cnt = 0; double one = 1.0; CoinIndexedVector work; CoinIndexedVector array; work.reserve(data->nrow); array.reserve(data->nrow); array.setVector(1,&colIsBasic[index],&one); factorization.updateColumnTranspose ( &work, &array ); int * arrayRows = array.getIndices(); double *arrayElements = array.denseVector(); cnt = array.getNumElements(); /* compute column (structural) variable coefficients */ for(j = 0; j < data->ncol; j++) { value[j] = 0.0; for(i=colBeg[j]; i < colBeg[j]+colCnt[j]; i++) value[j] += colMat[i]*arrayElements[ colInd[i] ]; } #if DGG_DEBUG_SOLVER /* check pivot */ if ( fabs(value[index] - 1.0) > DGG_INTEGRALITY_THRESH ) DGG_THROW(1, "pivot is not one"); #endif /* compute row variable (slack/logical) variable coefficients */ for(j = 0; j < cnt; j++){ if ( DGG_isEqualityConstraint(data,data->ncol + arrayRows[j]) && !mode ) value[ data->ncol + arrayRows[j] ] = 0.0; else if ( DGG_isConstraintBoundedAbove(data, data->ncol + arrayRows[j]) ) value[ data->ncol + arrayRows[j] ] = arrayElements[ arrayRows[j] ]; else value[ data->ncol + arrayRows[j] ] = -1*arrayElements[ arrayRows[j] ]; } /* compute rhs */ rhs = 0.0; for(i=0; i < cnt; i++){ if ( DGG_isConstraintBoundedAbove(data,data->ncol + arrayRows[i]) ) rhs += arrayElements[arrayRows[i]]*rowUpper[arrayRows[i]]; else rhs += arrayElements[arrayRows[i]]*rowLower[arrayRows[i]]; } /* free 'work' and 'array' ?? do the empty functions do it?? they are not cleared in CglGomory. Is that due to a mistake? Is it done on purpose? */ /* work.empty(); array.empty(); */ } /* count non-zeroes */ nz = 0; int j; for( j=0; jncol+data->nrow; j++){ if ( fabs(value[j]) > DGG_MIN_TABLEAU_COEFFICIENT ) nz += 1; } /* put in sparse constraint format */ /* technical issue: should we let max_nz == nz or should we instead set max_nz == (nrow+ncol). The advantage of the latter approach is that later, when we substitute the slacks, the denser column will not require us to re-allocate memory */ tabrow->max_nz = nz; if (tabrow->coeff) free(tabrow->coeff); if (tabrow->index) free(tabrow->index); tabrow->coeff = reinterpret_cast (malloc(sizeof(double)*nz)); tabrow->index = reinterpret_cast (malloc(sizeof(int)*nz)); tabrow->nz = 0; for( j = 0; j < data->ncol + data->nrow; j++) if ( fabs(value[j]) > DGG_MIN_TABLEAU_COEFFICIENT ){ tabrow->coeff[tabrow->nz] = value[j]; tabrow->index[tabrow->nz] = j; tabrow->nz += 1; } tabrow->sense = 'E'; tabrow->rhs = rhs; /* CLEANUP */ free(value); return 0; } int DGG_getFormulaConstraint( int da_row, const void *osi_ptr, DGG_data_t *data, DGG_constraint_t* form_row ) { /* ensure that the da_row corresponds to a row */ if ( data->nrow <= da_row || 0> da_row) DGG_THROW(1, "row out of range..."); /* obtain pointer to solver interface */ const OsiSolverInterface *si = reinterpret_cast (osi_ptr); //DGG_TEST(!si, 1, "null OsiSolverInterfave"); /* obtain address of the LP matrix */ const CoinPackedMatrix *rowMatrixPtr = si->getMatrixByRow(); const int* rowBeg = rowMatrixPtr->getVectorStarts(); const int* rowCnt = rowMatrixPtr->getVectorLengths(); const int* rowInd = rowMatrixPtr->getIndices(); const double* rowMat = rowMatrixPtr->getElements(); /* obtain row right-hand-sides */ const double *rowUpper = si->getRowUpper(); const double *rowLower = si->getRowLower(); int nz = rowCnt[da_row]; form_row->nz = nz; form_row->max_nz = nz+1; int i; for( i=0; i < nz; i++) form_row->coeff[i] = rowMat[rowBeg[da_row]+i]; for( i=0; i < nz; i++) form_row->index[i] = rowInd[rowBeg[da_row]+i]; if ( DGG_isConstraintBoundedAbove(data,data->ncol + da_row) ){ form_row->rhs = rowUpper[da_row]; form_row->sense = 'L'; } else{ form_row->rhs = rowLower[da_row]; form_row->sense = 'G'; } if ( DGG_isEqualityConstraint(data,data->ncol + da_row) ) form_row->sense = 'E'; /* now add slack/surplus if there is one */ if ( DGG_isEqualityConstraint(data,data->ncol + da_row) == 0 ){ form_row->index[nz] = data->ncol + da_row; if ( DGG_isConstraintBoundedAbove(data, data->ncol + da_row) ) form_row->coeff[nz] = 1; else form_row->coeff[nz] = -1; form_row->nz +=1; } return 0; } //--------------------------------------------------------------- //--------------------------------------------------------------- //--------------------------------------------------------------- //--------------------------------------------------------------- //--------------------------------------------------------------- /******************** CONSTRAINT ADTs *****************************************/ DGG_constraint_t* DGG_newConstraint(int max_arrays) { DGG_constraint_t *c = NULL; if (max_arrays <= 0) return NULL; c = reinterpret_cast (malloc(sizeof(DGG_constraint_t))); c->nz = 0; c->max_nz = max_arrays; c->rhs = 0.0; c->sense = '?'; c->coeff = NULL; c->index = NULL; c->coeff = reinterpret_cast(malloc(sizeof(double)*max_arrays)); c->index = reinterpret_cast(malloc(sizeof(int)*max_arrays)); return c; } void DGG_freeConstraint(DGG_constraint_t *c) { if (c == NULL) return; if (c->coeff) free(c->coeff); if (c->index) free(c->index); free(c); } DGG_constraint_t *DGG_copyConstraint(DGG_constraint_t* c) { DGG_constraint_t *nc = NULL; if (!c || c->max_nz <= 0) return nc; nc = DGG_newConstraint(c->max_nz); if (nc == NULL) return nc; nc->nz = c->nz; nc->rhs = c->rhs; nc->sense = c->sense; memcpy(nc->coeff, c->coeff, sizeof(double)*nc->nz); memcpy(nc->index, c->index, sizeof(int)*nc->nz); return nc; } void DGG_scaleConstraint(DGG_constraint_t *c, int t) { int i; c->rhs *= t; if (t < 0){ if (c->sense == 'G') c->sense = 'L'; else if (c->sense == 'L') c->sense = 'G'; } for(i=0; inz; i++) c->coeff[i] *= t; } void DGG_list_init (DGG_list_t *l) { l->n = 0; l->c = NULL; l->ctype = NULL; l->alpha = NULL; } void DGG_list_free(DGG_list_t *l) { if (l->c != NULL) free (l->c); if (l->ctype != NULL) free (l->ctype); if (l->alpha != NULL) free (l->alpha); } int DGG_list_addcut (DGG_list_t *l, DGG_constraint_t *cut, int ctype, double alpha) { l->n ++; l->c = reinterpret_cast(realloc (l->c, l->n * sizeof(DGG_constraint_t *))); l->ctype = reinterpret_cast(realloc (l->ctype, l->n * sizeof (int))); l->alpha = reinterpret_cast(realloc (l->alpha, l->n * sizeof (double))); if (l->c == NULL || l->ctype == NULL || l->alpha == NULL){ printf ("No memory, bailing out\n"); return -1; } l->c[l->n - 1] = cut; l->ctype[l->n - 1] = ctype; l->alpha[l->n - 1] = alpha; return 0; } void DGG_list_delcut (DGG_list_t *l, int i) { if (i >= l->n && i < 0) return; DGG_freeConstraint (l->c[i]); l->c[i] = l->c[l->n - 1]; l->ctype[i] = l->ctype[l->n - 1]; l->alpha[i] = l->alpha[l->n - 1]; l->n --; } /******************* CONSTRAINT MANIPULATION **********************************/ /* VARIABLES CLOSE TO UPPER BOUNDS: we will substitute: x' = (u - x); hence the constraint will change from ax ~ b to -ax' ~ b - au note: the new bounds of x' will be, 0 <= x' <= u - l VARIABLES CLOSE TO LOWER BOUNDS: we will substitute: x' = (x - l); hence, the constraint will change from ax ~ b to ax' ~ b - al. note: some variable lower bounds may have changed when doing the complement in the previous stage - this must be taken into account. note: the new bounds of x' will be, 0 <= x' <= u - l */ int DGG_transformConstraint( DGG_data_t *data, double **x_out, double **rc_out, char **isint_out, DGG_constraint_t *constraint ) { double half; double *px = reinterpret_cast (malloc( sizeof(double)*constraint->max_nz )); double *rc = reinterpret_cast (malloc( sizeof(double)*constraint->max_nz )); char *pi = reinterpret_cast (malloc( sizeof(char) *constraint->max_nz )); { int i, idx; for(i=0; i < constraint->nz; i++){ idx = constraint->index[i]; px[i] = data->x[idx]; rc[i] = data->rc[idx]; pi[i] = static_cast(DGG_isInteger(data, idx)); half = (data->ub[idx] - data->lb[idx]) / 2; if ( data->ub[idx] - data->x[idx] < half ){ px[i] = data->ub[idx] - data->x[idx]; if (fabs(px[i]) <= DGG_BOUND_THRESH) px[i] = 0.0; constraint->rhs -= constraint->coeff[i]*data->ub[idx]; constraint->coeff[i] *= -1; } else { px[i] = data->x[idx] - data->lb[idx]; if (fabs(px[i]) <= DGG_BOUND_THRESH) px[i] = 0.0; constraint->rhs -= constraint->coeff[i]*data->lb[idx]; } } } *x_out = px; *rc_out = rc; *isint_out = pi; #if DGG_DEBUG_DGG DGG_TEST(DGG_isConstraintViolated(data, constraint), 1, "bad transformation"); #endif return 0; } int DGG_unTransformConstraint( DGG_data_t *data, DGG_constraint_t *constraint ) { int i, idx; double half; for(i=0; i < constraint->nz; i++){ idx = constraint->index[i]; half = (data->ub[idx] - data->lb[idx]) / 2; if ( data->ub[idx] - data->x[idx] < half ){ constraint->rhs -= constraint->coeff[i]*data->ub[idx]; constraint->coeff[i] *= -1; } else constraint->rhs += constraint->coeff[i]*data->lb[idx]; } return 0; } int DGG_substituteSlacks( const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *cut ) { int i,j, lnz; double *lcut, lrhs; DGG_constraint_t *row=NULL; /* lcut will store all the column coefficients. allocate space and init. */ lcut = reinterpret_cast(malloc(sizeof(double)*data->ncol)); memset(lcut, 0, sizeof(double)*data->ncol); /* initialize lrhs */ lrhs = cut->rhs; /* set coefficients in lcut */ /* technical: we could speed this up by re-using allocated memory for row->coeff and row->index */ for(i=0; i < cut->nz; i++){ if ( cut->index[i] < data->ncol ) lcut[ cut->index[i] ] += cut->coeff[i]; else{ row = DGG_getSlackExpression(solver_ptr, data, (cut->index[i] - data->ncol)); for(j=0; j < row->nz; j++) lcut[ row->index[j] ] += row->coeff[j]*cut->coeff[i]; lrhs -= row->rhs*cut->coeff[i]; DGG_freeConstraint(row); } } /* count nz in new constraint */ lnz = 0; for(i=0; i < data->ncol; i++) if ( fabs(lcut[i]) > DGG_MIN_TABLEAU_COEFFICIENT ) lnz += 1; /* free row->coeff and row->index, and re-allocate */ free(cut->coeff); cut->coeff = 0; free(cut->index); cut->index = 0; cut->nz = lnz; cut->max_nz = lnz; if (lnz) { cut->coeff = reinterpret_cast (malloc( sizeof(double)*lnz )); cut->index = reinterpret_cast (malloc( sizeof(int)*lnz )); } /* set new constraint */ lnz = 0; for(i=0; i < data->ncol; i++){ if ( fabs(lcut[i]) > DGG_MIN_TABLEAU_COEFFICIENT ){ cut->coeff[lnz] = lcut[i]; cut->index[lnz] = i; lnz += 1; } } cut->rhs = lrhs; free(lcut); return 0; } int DGG_nicefyConstraint( const void * /*solver_ptr*/, DGG_data_t *data, DGG_constraint_t *cut) { double min_coef = COIN_DBL_MAX, max_coef = COIN_DBL_MIN; DGG_TEST(cut->sense == 'L', 1, "can't nicefy an L constraint"); int i; for( i=0; inz; i++) // first clean out noise if( fabs(cut->coeff[i]) < DGG_NICEFY_MIN_ABSVALUE) cut->coeff[i] = 0; for( i=0; inz; i++){ if( DGG_isInteger(data, cut->index[i])){// look at integral vars. double aht = ABOV(cut->coeff[i]); double ub = data->ub[ cut->index[i]]; if(aht < DGG_NICEFY_MIN_FIX){// coefficient = integer + epsylon cut->coeff[i] = floor( cut->coeff[i]); double ahtu = aht * ub; if(ahturhs -= ahtu;// safely remove the fractional part else cut->coeff[i] += DGG_NICEFY_MIN_FIX; // inflate the fractional part } else if (1-aht < DGG_NICEFY_MIN_FIX) // coefficient = integer - epsylon cut->coeff[i] = ceil( cut->coeff[i]); }// done with integers else // now look at continuous variables if ( cut->coeff[i] < DGG_NICEFY_MIN_ABSVALUE) // delete all negative and noise cut->coeff[i] = 0.0; else if(cut->coeff[i] < DGG_NICEFY_MIN_FIX) {// coefficient = epsylon double au = cut->coeff[i] * data->ub[ cut->index[i]]; if(aucoeff[i] = 0.0; cut->rhs -= au; } else cut->coeff[i] = DGG_NICEFY_MIN_FIX; // inflate the coefficient }// done with continuous variables too double abs_coef = fabs(cut->coeff[i]); min_coef = DGG_MIN(min_coef, abs_coef); max_coef = DGG_MAX(max_coef, abs_coef); } cut->sense = 'G'; /* if ( max_coef > DGG_NICEFY_MAX_RATIO*min_coef ) // kill the cut if numbers are all over the place cut->nz = 0; */ return 0; } /******************* CUT GENERATION *******************************************/ int DGG_generateTabRowCuts( DGG_list_t *cut_list, DGG_data_t *data, const void *solver_ptr ) { int k, rval = 0; DGG_constraint_t *base = NULL; int nc = cut_list->n; base = DGG_newConstraint(data->ncol + data->nrow); if(talk) printf ("2mir_test: generating tab row cuts\n"); /* allocate memory for basic column/row indicators */ int *rowIsBasic = 0, *colIsBasic = 0; rowIsBasic = reinterpret_cast(malloc(sizeof(int)*data->nrow)); colIsBasic = reinterpret_cast(malloc(sizeof(int)*data->ncol)); /* initialize the IsBasic arrays with -1 / 1 values indicating where the basic rows and columns are. NOTE: WE could do this only once and keep it in osi_data at the expense of space!! */ int i; for( i=0; incol; i++){ if ( DGG_isBasic(data,i) ) colIsBasic[i] = 1; else colIsBasic[i] = -1; } for( i=0; inrow; i++){ if ( DGG_isBasic(data,i+data->ncol) ) rowIsBasic[i] = 1; else rowIsBasic[i] = -1; } /* obtain factorization */ CoinFactorization factorization; /* obtain address of the LP matrix */ const OsiSolverInterface *si = reinterpret_cast (solver_ptr); const CoinPackedMatrix *colMatrixPtr = si->getMatrixByCol(); rval = factorization.factorize(*colMatrixPtr, rowIsBasic, colIsBasic); /* 0 = okay. -1 = singular. -2 = too many in basis. -99 = memory. */ DGG_TEST2(rval, 1, "factorization error = %d", rval); for(k=0; kncol; k++){ if (!(DGG_isBasic(data, k) && DGG_isInteger(data,k))) continue; double frac = frac_part (data->x[k]); if (frac < data->gomory_threshold || frac > 1-data->gomory_threshold) continue; base->nz = 0; rval = DGG_getTableauConstraint(k, solver_ptr, data, base, colIsBasic,rowIsBasic,factorization,0); DGG_CHECKRVAL(rval, rval); if (base->nz == 0){ printf ("2mir_test: why does constraint not exist ?\n"); continue; } if (base->nz > 500) continue; rval = DGG_generateCutsFromBase(base, cut_list, data, solver_ptr); DGG_CHECKRVAL(rval, rval); } free(rowIsBasic); free(colIsBasic); if(talk) printf ("2mir_test: generated %d tab cuts\n", cut_list->n - nc); fflush (stdout); DGG_freeConstraint(base); return rval; } int DGG_generateFormulationCuts( DGG_list_t *cut_list, DGG_data_t *data, const void *solver_ptr, int nrows, CoinThreadRandom & generator) { int k, rval = 0; DGG_constraint_t *base = NULL; int num_rows = (data->nrow < nrows) ? data->nrow : nrows; int nc = cut_list->n; base = DGG_newConstraint(data->ncol + data->nrow); if(talk) printf ("2mir_test: generating form row cuts %d\n", num_rows); for(k=0; knz = 0; rval = DGG_getFormulaConstraint(k, solver_ptr, data, base); DGG_CHECKRVAL1(rval, rval); //printf ("generating formulation for row %d\n", k); rval = DGG_generateFormulationCutsFromBase(base, data->x[data->ncol+k], cut_list, data, solver_ptr, generator); DGG_CHECKRVAL1(rval, rval); if (base->nz == 0){ #ifdef COIN_DEVELOP printf ("why does constraint not exist ?\n"); #endif continue; } } CLEANUP: if(talk) printf ("2mir_test: generated %d form cuts\n", cut_list->n - nc); fflush (stdout); DGG_freeConstraint(base); return rval; } int DGG_generateFormulationCutsFromBase( DGG_constraint_t *base, double slack, DGG_list_t *cut_list, DGG_data_t *data, const void *solver_ptr, CoinThreadRandom & generator) { int i, p, rval; int int_skala; double skala; int num_inlist = 0; int* skala_list = reinterpret_cast (malloc( sizeof(int)*base->nz )); char *isint = NULL; double *xout = NULL, *rcout = NULL; DGG_constraint_t *scaled_base = NULL; int tot_int = 0; double prob_choose = 0.0; rval = DGG_transformConstraint(data, &xout, &rcout, &isint, base); DGG_CHECKRVAL1(rval, rval); for(p = 0; p < base->nz; p++) if(isint[p]) tot_int ++; if (tot_int == 0) goto CLEANUP; prob_choose = 5.0/tot_int; for(p = 0; p < base->nz; p++) { if(isint[p]) if(generator.randomDouble() < prob_choose){ if(xout[p]<0.01) continue; skala =fabs(base->coeff[p]); if(skala<0.01) continue; // check if slack is too large if (fabs(slack/skala) > 0.5) continue; scaled_base = DGG_copyConstraint(base); DGG_CHECKRVAL1((scaled_base == NULL),-1); if(base->sense == 'L') { skala = -skala; scaled_base->sense = 'G'; } int_skala = int(100*skala); for(i = 0; i< num_inlist; i++) if(int_skala == skala_list[i]) goto END_LOOP; skala_list[num_inlist++] = int_skala; scaled_base->rhs = base->rhs/skala; for(i = 0; inz; i++) scaled_base->coeff[i] = base->coeff[i] / skala; rval = DGG_unTransformConstraint(data, scaled_base); DGG_CHECKRVAL1(rval, rval); rval = DGG_generateCutsFromBase(scaled_base, cut_list, data, solver_ptr); DGG_CHECKRVAL1(rval, rval); END_LOOP: DGG_freeConstraint(scaled_base); scaled_base = NULL; } } CLEANUP: if (isint) free(isint); if (xout) free(xout); if (rcout) free(rcout); if (skala_list) free(skala_list); if (scaled_base != NULL) DGG_freeConstraint (scaled_base); return rval; } int DGG_generateCutsFromBase( DGG_constraint_t *orig_base, DGG_list_t *cut_list, DGG_data_t *data, const void *solver_ptr ) { int rval = 0; int t; double *x = NULL, *rc = NULL; char *isint = NULL; DGG_constraint_t *base = NULL; bool not_nicefied = true; int new_pos = cut_list->n; // DGG_constraint_t *keep_origbase = DGG_copyConstraint(orig_base); //for debug only ------ if (orig_base->sense == 'L') return 0; if (orig_base->nz == 0) return 0; rval = DGG_transformConstraint(data, &x, &rc, &isint, orig_base); double frac = frac_part(orig_base->rhs); //printf ("frac = %.7f, r %.7f, fr %.7f\n", frac, orig_base->rhs, floor(orig_base->rhs)); if (rval || frac < data->gomory_threshold || frac > 1-data->gomory_threshold){ free (x); free (rc); free (isint); return 0; } int min_t = t_min; int min_q = q_min; if (orig_base->sense == 'G' && min_t < 1) min_t = 1; if (orig_base->sense == 'G' && min_q < 1) min_q = 1; if (min_q > 0 && min_t > 0 ) { not_nicefied = false; rval = DGG_nicefyConstraint(solver_ptr, data, orig_base); DGG_CHECKRVAL(rval, rval); if (orig_base->nz == 0){ if(talk) printf ("2mir_test: Nicefy returns empty constraint\n"); rval = 0; goto CLEANUP; } } for(t = min_t; t <= t_max ; t++){ if (t == 0) continue; base = DGG_copyConstraint(orig_base); DGG_TEST(!base, 1, "error making copy of base"); DGG_scaleConstraint (base, t); if(not_nicefied){ rval = DGG_nicefyConstraint(solver_ptr, data, base); DGG_CHECKRVAL(rval, rval); if (base->nz == 0){ if(talk) printf ("2mir_test: Nicefy returns empty constraint\n"); goto MIR_DONE; } } if ( DGG_isBaseTrivial(data, base) ) goto MIR_DONE; rval = DGG_addMirToList(base, isint, x, cut_list, data, orig_base); DGG_CHECKRVAL(rval, rval); MIR_DONE: DGG_freeConstraint(base); } for( t = min_q; t <= q_max; t++ ){ if (t == 0) continue; base = DGG_copyConstraint(orig_base); DGG_TEST(!base, 1, "error making copy of base"); DGG_scaleConstraint (base, t); if(not_nicefied){ rval = DGG_nicefyConstraint(solver_ptr, data, base); DGG_CHECKRVAL(rval, rval); if (base->nz == 0){ if(talk) printf ("2mir_test: Nicefy returns empty constraint\n"); goto TWOMIR_DONE; } } if ( DGG_isBaseTrivial(data, base) ) goto TWOMIR_DONE; rval = DGG_add2stepToList(base, isint, x, rc, cut_list, data, orig_base); DGG_CHECKRVAL(rval, rval); TWOMIR_DONE: DGG_freeConstraint(base); } int i; for ( i = cut_list->n-1; i>=new_pos; i--){ DGG_constraint_t *lcut = cut_list->c[i]; rval = DGG_unTransformConstraint(data, lcut); DGG_CHECKRVAL(rval, rval); rval = DGG_substituteSlacks(solver_ptr, data, lcut); DGG_CHECKRVAL(rval, rval); if ( !DGG_isCutDesirable(lcut, data) ){ DGG_list_delcut (cut_list, i); continue; } //else testus(lcut);//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /* if ( data->opt_x && DGG_cutsOffPoint(data->opt_x, lcut) ){ //DGG_cutDisplay_sparse(data, data->opt_x, lcut, stdout); DGG_TEST(1,1, "new cut is infeasible for optimal solution\n"); } */ } CLEANUP: if (x) free(x); if (rc) free (rc); if (isint) free(isint); return 0; } int DGG_addMirToList ( DGG_constraint_t *base, char *isint, double * /*x*/, DGG_list_t *list, DGG_data_t * /*data*/, DGG_constraint_t * /*orig_base*/ ) { int rval = 0; DGG_constraint_t *cut = NULL; rval = DGG_buildMir(isint, base, &cut); DGG_CHECKRVAL(rval, rval); DGG_list_addcut(list, cut, DGG_TMIR_CUT, 0.0); return 0; } int DGG_add2stepToList ( DGG_constraint_t *base, char *isint, double * /*x*/, double *rc, DGG_list_t *list, DGG_data_t *data, DGG_constraint_t * /*orig_base*/ ) { int rval; DGG_constraint_t *cut = NULL; int i; double norm_val, best_norm_val, best_norm_alpha=-1.0; double rc_val, best_rc_val, best_rc_alpha=-1.0; double vht, bht, alpha; best_rc_val = best_norm_val = COIN_DBL_MAX; bht = ABOV(base->rhs); double best_rc = 0; for(i=0; inz; i++) if (isint[i]) best_rc = CoinMax(best_rc, fabs(rc[i])); double rc_cutoff = best_rc / 10; for(i=0; inz; i++){ if (!isint[i]) continue; if (fabs(rc[i]) <= rc_cutoff) continue; //too unimportant vht = ABOV(base->coeff[i]); if(vht >= bht) continue; // too big if(vht < bht/a_max) continue; // too small alpha = vht; int kk = 1; while ( !DGG_is2stepValid(alpha, bht) && bht/alpha <= a_max) { alpha = vht/kk; kk++; if (kk>1000) break; } if ( !DGG_is2stepValid(alpha, bht) ) continue; rval = DGG_build2step(alpha, isint, base, &cut); DGG_CHECKRVAL(rval, rval); rc_val = COIN_DBL_MAX; // this gives a lower bound on obj. fn. improvement for(i=0; inz; i++) if(cut->coeff[i]> 1E-6){ rc_val = CoinMin(rc_val, fabs(rc[i])/cut->coeff[i]); } rc_val *= cut->rhs; norm_val = 0; // this is the square of the L2 norm for(i=0; inz; i++) if(cut->coeff[i]> 1E-6){ norm_val += (cut->coeff[i]*cut->coeff[i]); } norm_val /= cut->rhs * cut->rhs; if (rc_val < best_rc_val ) { best_rc_val = rc_val; best_rc_alpha = alpha; } if (norm_val < best_norm_val ) { best_norm_val = norm_val; best_norm_alpha = alpha; } DGG_freeConstraint(cut); } if( best_rc_val> 1E-6 && best_rc_alpha != -1.0){ rval = DGG_build2step(best_rc_alpha, isint, base, &cut); DGG_CHECKRVAL(rval, rval); DGG_list_addcut(list, cut, DGG_2STEP_CUT, best_rc_alpha); } else if (best_norm_alpha != -1.0){ rval = DGG_build2step(best_norm_alpha, isint, base, &cut); DGG_CHECKRVAL(rval, rval); DGG_list_addcut(list, cut, DGG_2STEP_CUT, best_norm_alpha); } return 0; } int DGG_buildMir( char *isint, DGG_constraint_t *base, DGG_constraint_t **cut_out ) { int i, lnz = 0; double b = (base->rhs); double bht = ABOV(b); double bup = ceil(b); DGG_constraint_t *tmir = NULL; DGG_TEST( base->sense == 'L', 1, "this form not valid for L"); DGG_TEST( base->nz == 0, 1, "base must have some coefficients\n"); tmir = DGG_newConstraint( base->nz ); tmir->sense = 'G'; tmir->rhs = bht * bup; for(i=0; inz; i++){ double v = base->coeff[i]; if (!isint[i]) { if (v > 0.0) tmir->coeff[lnz] = v; else tmir->coeff[lnz] = 0.0; } else { double vht = ABOV(v); DGG_IF_EXIT( vht<0, 1, "negative vht"); tmir->coeff[lnz] = bht * floor(v) + DGG_MIN(bht,vht); } tmir->index[lnz] = base->index[i]; lnz += 1; } tmir->nz = lnz; *cut_out = tmir; return 0; } int DGG_build2step( double alpha, char *isint, DGG_constraint_t *base, DGG_constraint_t **cut_out ) { DGG_constraint_t *tmir = 0; int i, lnz = 0; double vht, bht, bup, rho, tau, k; double b = (base->rhs); DGG_TEST( base->sense == 'L', 1, "this form not valid for L"); DGG_TEST( base->nz == 0, 1, "base must have some coefficients\n"); bht = ABOV(b); bup = ceil(b); tau = ceil(bht/alpha); rho = bht - alpha*floor(bht/alpha); /* ensure bht > alpha > 0 */ DGG_TEST3( (bht <= alpha) || (alpha <= 0.0), 1, "bad alpha (%f) / bht (%f) pair", alpha, bht); /* ensure that we are not in a limiting case */ DGG_TEST( DGG_is_a_multiple_of_b(alpha, bht), 1, "can't generate simple 2mir in limiting case"); /* ensure that rho is not zero */ DGG_TEST2( rho < DGG_MIN_RHO, 1, "rho (%f) too small", rho); /* initialize constraint */ tmir = DGG_newConstraint( base->nz ); tmir->rhs = bup*tau*rho; tmir->sense = 'G'; /* compute cut coefficients */ for(i=0; inz; i++){ double v = base->coeff[i]; if (!isint[i]) { if (v > 0.0) tmir->coeff[lnz] = v; else tmir->coeff[lnz] = 0.0; } else { vht = v - floor(v); DGG_IF_EXIT( vht < 0.0, 1, "negative vht"); k = DGG_MIN(tau-1,floor(vht/alpha)); tmir->coeff[lnz] = floor(v)*tau*rho + k*rho + DGG_MIN(rho,vht-k*alpha); } tmir->index[lnz] = base->index[i]; lnz += 1; } tmir->nz = lnz; *cut_out = tmir; return 0; } /******************* TEST / DEBUGGING ROUTINES ********************************/ /* DGG_is2stepValid: checks that: bht > alpha > 0 (1/alpha) >= tau > (bht/alpha) */ int DGG_is2stepValid(double alpha, double bht) { /* d */ double tau; /* ensure that alpha is not null or negative */ if ( alpha < DGG_MIN_ALPHA ) return 0; /* compute tau and tau_lim */ tau = ceil( bht / alpha ); /* make sure alpha is not a divisor of bht */ if ( DGG_is_a_multiple_of_b(alpha, bht) ) return 0; /* page 15, definition 12 */ /* check if alpha is admissible for simple-2-step-tmir */ if ( (bht > alpha) && (alpha > 0.0) ) if ( (1/alpha) >= tau ) return 1; /* not admissible */ return 0; } /* checks that its worth doing a 1MIR on the constraint. More precisely, - Is the RHS null? - Are there any integer variables set at fractional values? */ int DGG_isBaseTrivial(DGG_data_t *d, DGG_constraint_t* c) { /* is rhs sufficiently fractional */ if ( frac_part(ABOV(c->rhs)) < d->gomory_threshold ) return 1; if ( (1.0 - frac_part(ABOV(c->rhs))) < d->gomory_threshold ) return 1; return 0; } /* tests lhs vs rhs of a constraint */ int DGG_isConstraintViolated(DGG_data_t *d, DGG_constraint_t *c) { double lhs = DGG_cutLHS(c, d->x); double rhs = c->rhs; /* compare LHS and RHS */ if (c->sense == 'G') if ( lhs > (rhs - DGG_NULL_SLACK) ) return 0; if (c->sense == 'L') if ( lhs < (rhs + DGG_NULL_SLACK) ) return 0; if (c->sense == 'E') if ( fabs(lhs - rhs) < DGG_NULL_SLACK ) return 0; return 0; } double DGG_cutLHS(DGG_constraint_t *c, double *x) { int i; double lhs = 0.0; for(i=0; i < c->nz; i++) lhs += c->coeff[i]*x[c->index[i]]; return lhs; } int DGG_isCutDesirable(DGG_constraint_t *c, DGG_data_t *d) { double lhs, rhs; lhs = DGG_cutLHS(c, d->x); rhs = c->rhs; if (c->nz > 500) return 0; /* if the cut is not violated, return 0 */ if (c->sense == 'G') if ( lhs > (rhs - DGG_NULL_SLACK) ) return 0; if (c->sense == 'L') if ( lhs < (rhs + DGG_NULL_SLACK) ) return 0; if (c->sense == 'E') if ( fabs(lhs - rhs) < DGG_NULL_SLACK ) return 0; return 1; } /******************** SIMPLE MACROS AND FUNCTIONS *****************************/ int DGG_is_even(double vht, double bht, int tau, int q) { double v2 = V2I(bht, tau, q); if ( vht > v2 ) return 1; return 0; } double frac_part(double value) { return value-floor(value); } int DGG_is_a_multiple_of_b(double a, double b) { double c = b/a; if ( (b - a*floor(c)) < DGG_MIN_RHO ) return 1; return 0; } int DGG_cutsOffPoint(double *x, DGG_constraint_t *cut) { int i; double LHS = 0.0; for(i=0; i < cut->nz; i++) LHS += cut->coeff[i]*(x[ cut->index[i] ]); //fprintf(stdout, "LHS = %f, SENSE = %c, RHS = %f\n", LHS, cut->sense, cut->rhs); if ( cut->sense == 'E' ) if ( fabs(LHS - cut->rhs) > DGG_NULL_SLACK ) goto BAD; if (cut->sense == 'G' ) if ( (cut->rhs - LHS) > DGG_NULL_SLACK ) goto BAD; if (cut->sense == 'L' ) if ( (LHS - cut->rhs) > DGG_NULL_SLACK ) goto BAD; return 0; BAD: fprintf(stdout, "LHS = %f, SENSE = %c, RHS = %f\n", LHS, cut->sense, cut->rhs); DGG_TEST(1, 1, "found a bad cut!"); return 0; } // Returns true if needs optimal basis to do cuts bool CglTwomir::needsOptimalBasis() const { return true; } // Away stuff void CglTwomir::setAway(double value) { if (value>0.0&&value<=0.5) away_=value; } double CglTwomir::getAway() const { return away_; } // Away stuff at root void CglTwomir::setAwayAtRoot(double value) { if (value>0.0&&value<=0.5) awayAtRoot_=value; } double CglTwomir::getAwayAtRoot() const { return awayAtRoot_; } // This can be used to refresh any information void CglTwomir::refreshSolver(OsiSolverInterface * solver) { if (originalSolver_) { delete originalSolver_; originalSolver_ = solver->clone(); } } // Create C++ lines to get to current state std::string CglTwomir::generateCpp( FILE * fp) { CglTwomir other; fprintf(fp,"0#include \"CglTwomir.hpp\"\n"); fprintf(fp,"3 CglTwomir twomir;\n"); if (t_min_!=other.t_min_||t_max_!=other.t_max_) fprintf(fp,"3 twomir.setMirScale(%d,%d);\n",t_min_,t_max_); else fprintf(fp,"4 twomir.setMirScale(%d,%d);\n",t_min_,t_max_); if (q_min_!=other.q_min_||q_max_!=other.q_max_) fprintf(fp,"3 twomir.setTwomirScale(%d,%d);\n",q_min_,q_max_); else fprintf(fp,"4 twomir.setTwomirScale(%d,%d);\n",q_min_,q_max_); if (do_mir_!=other.do_mir_||do_2mir_!=other.do_2mir_|| do_tab_!=other.do_tab_||do_form_!=other.do_form_) fprintf(fp,"3 twomir.setCutTypes(%s,%s,%s,%s);\n", do_mir_ ? "true" : "false", do_2mir_ ? "true" : "false", do_tab_ ? "true" : "false", do_form_ ? "true" : "false"); else fprintf(fp,"4 twomir.setCutTypes(%s,%s,%s,%s);\n", do_mir_ ? "true" : "false", do_2mir_ ? "true" : "false", do_tab_ ? "true" : "false", do_form_ ? "true" : "false"); if (a_max_!=other.a_max_) fprintf(fp,"3 twomir.setAMax(%d);\n",a_max_); else fprintf(fp,"4 twomir.setAMax(%d);\n",a_max_); if (max_elements_!=other.max_elements_) fprintf(fp,"3 twomir.setMaxElements(%d);\n",max_elements_); else fprintf(fp,"4 twomir.setMaxElements(%d);\n",max_elements_); if (max_elements_root_!=other.max_elements_root_) fprintf(fp,"3 twomir.setMaxElementsRoot(%d);\n",max_elements_root_); else fprintf(fp,"4 twomir.setMaxElementsRoot(%d);\n",max_elements_root_); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 twomir.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 twomir.setAggressiveness(%d);\n",getAggressiveness()); return "twomir"; } CoinMP-1.8.3/Cgl/src/CglTwomir/CglTwomir.hpp0000644000175000017500000004435512130102162017136 0ustar renerene// $Id: CglTwomir.hpp 1119 2013-04-06 20:24:18Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglTwomir_H #define CglTwomir_H #include #include "CglCutGenerator.hpp" #include "CoinFactorization.hpp" typedef struct { int nz; /* current length of arrays index[] and coeff[] */ int max_nz; /* max length of arrays index[] and coeff[] */ double *coeff; /* coefficient of each variable in the constraint */ int *index; /* index of the variable (value in 0 ... nrow+ncol) */ double rhs; /* rhs of the constraint */ char sense; /* ?? is it necessary */ } DGG_constraint_t; typedef struct{ int n; DGG_constraint_t **c; int *ctype; double *alpha; } DGG_list_t; /******************** BASIS INFORMATION ADTs **********************************/ typedef struct{ int q_min; int q_max; int t_min; int t_max; int a_max; int max_elements; } cutParams; typedef struct { double gomory_threshold; /* factional variable must be this away from int */ int ncol, /* number of columns in LP */ nrow, /* number of constaints in LP */ ninteger; /* number of integer variables in LP */ int nbasic_col, /* number of basic columns in the LP */ nbasic_row; /* number of basic rows in the LP */ /* the following arrays are all of size (ncol+nrow) */ int *info; /* description of each variable (see below) */ double *lb; /* specifies the lower bound (if any) of each variable */ double *ub; /* specifies the upper bound (if any) of each variable */ double *x; /* current solution */ double *rc; /* current reduced cost */ double *opt_x; cutParams cparams; } DGG_data_t; /* the following macros allow us to decode the info of the DGG_data type. The encoding is as follows, bit 1 : if the variable is basic or not (non-basic). bit 2 : if the variable is integer or or not (rational). bit 3 : if the variable is structural or not (artifical). bit 4 : if the variable is non-basic and at its upper bound (else if non-basic at lower bound). */ #define DGG_isBasic(data,idx) ((data->info[idx])&1) #define DGG_isInteger(data,idx) ((data->info[idx] >> 1)&1) #define DGG_isStructural(data,idx) ((data->info[idx] >> 2)&1) #define DGG_isEqualityConstraint(data,idx) ((data->info[idx] >> 3)&1) #define DGG_isNonBasicAtUB(data,idx) ((data->info[idx] >> 4)&1) #define DGG_isNonBasicAtLB(data,idx) ((data->info[idx] >> 5)&1) #define DGG_isConstraintBoundedAbove(data,idx) ((data->info[idx] >> 6)&1) #define DGG_isConstraintBoundedBelow(data,idx) ((data->info[idx] >> 7)&1) #define DGG_setIsBasic(data,idx) ((data->info[idx]) |= 1) #define DGG_setIsInteger(data,idx) ((data->info[idx]) |= (1<<1)) #define DGG_setIsStructural(data,idx) ((data->info[idx]) |= (1<<2)) #define DGG_setEqualityConstraint(data,idx) ((data->info[idx]) |= (1<<3)) #define DGG_setIsNonBasicAtUB(data,idx) ((data->info[idx]) |= (1<<4)) #define DGG_setIsNonBasicAtLB(data,idx) ((data->info[idx]) |= (1<<5)) #define DGG_setIsConstraintBoundedAbove(data,idx) ((data->info[idx]) |= (1<<6)) #define DGG_setIsConstraintBoundedBelow(data,idx) ((data->info[idx]) |= (1<<7)) class CoinWarmStartBasis; /** Twostep MIR Cut Generator Class */ class CglTwomir : public CglCutGenerator { friend void CglTwomirUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /// Problem name std::string probname_; /**@name Generate Cuts */ //@{ /** Generate Two step MIR cuts either from the tableau rows or from the formulation rows */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /// Return true if needs optimal basis to do cuts (will return true) virtual bool needsOptimalBasis() const; /**@name Change criterion on which scalings to use (default = 1,1,1,1) */ //@{ /// Set void setMirScale (int tmin, int tmax) {t_min_ = tmin; t_max_ = tmax;} void setTwomirScale (int qmin, int qmax) {q_min_ = qmin; q_max_ = qmax;} void setAMax (int a) {a_max_ = a;} void setMaxElements (int n) {max_elements_ = n;} void setMaxElementsRoot (int n) {max_elements_root_ = n;} void setCutTypes (bool mir, bool twomir, bool tab, bool form) { do_mir_ = mir; do_2mir_ = twomir; do_tab_ = tab; do_form_ = form;} void setFormulationRows (int n) {form_nrows_ = n;} /// Get int getTmin() const {return t_min_;} int getTmax() const {return t_max_;} int getQmin() const {return q_min_;} int getQmax() const {return q_max_;} int getAmax() const {return a_max_;} int getMaxElements() const {return max_elements_;} int getMaxElementsRoot() const {return max_elements_root_;} int getIfMir() const { return do_mir_;} int getIfTwomir() const { return do_2mir_;} int getIfTableau() const { return do_tab_;} int getIfFormulation() const { return do_form_;} //@} /**@name Change criterion on which variables to look at. All ones more than "away" away from integrality will be investigated (default 0.05) */ //@{ /// Set away void setAway(double value); /// Get away double getAway() const; /// Set away at root void setAwayAtRoot(double value); /// Get away at root double getAwayAtRoot() const; /// Return maximum length of cut in tree virtual int maximumLengthOfCutInTree() const { return max_elements_;} //@} /**@name Change way TwoMir works */ //@{ /// Pass in a copy of original solver (clone it) void passInOriginalSolver(OsiSolverInterface * solver); /// Returns original solver inline OsiSolverInterface * originalSolver() const { return originalSolver_;} /// Set type - 0 normal, 1 add original matrix one, 2 replace inline void setTwomirType(int type) { twomirType_=type;} /// Return type inline int twomirType() const { return twomirType_;} //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglTwomir (); /// Copy constructor CglTwomir (const CglTwomir &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglTwomir & operator=(const CglTwomir& rhs); /// Destructor virtual ~CglTwomir (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); /// This can be used to refresh any inforamtion virtual void refreshSolver(OsiSolverInterface * solver); //@} private: // Private member data /**@name Private member data */ //@{ /// Threadsafe random number generator CoinThreadRandom randomNumberGenerator_; /// Original solver OsiSolverInterface * originalSolver_; /// Only investigate if more than this away from integrality double away_; /// Only investigate if more than this away from integrality (at root) double awayAtRoot_; /// Type - 0 normal, 1 add original matrix one, 2 replace int twomirType_; bool do_mir_; bool do_2mir_; bool do_tab_; bool do_form_; int t_min_; /// t_min - first value of t to use for tMIR inequalities int t_max_; /// t_max - last value of t to use for tMIR inequalities int q_min_; /// q_min - first value of t to use for 2-Step tMIR inequalities int q_max_; /// q_max - last value of t to use for 2-Step tMIR inequalities int a_max_; /// a_max - maximum value of bhat/alpha int max_elements_; /// Maximum number of elements in cut int max_elements_root_; /// Maximum number of elements in cut at root int form_nrows_; //number of rows on which formulation cuts will be generated //@} }; //############################################################################# /* #include #include #include #include #include #include #include */ /******************** DEBUG DEFINITIONS ***************************************/ #define DGG_DEBUG_DGG 1 #define DGG_TRACE_ERRORS 0 #define DGG_DISPLAY 0 #define DGG_AUTO_CHECK_CUT_OFF_OPTIMAL 1 /******************** CONFIGURATION DEFAULTS **********************************/ #define DGG_DEFAULT_METHOD 2 #define DGG_DEFAULT_TMIN 1 #define DGG_DEFAULT_TMAX 1 #define DGG_DEFAULT_TAUMIN 2 #define DGG_DEFAULT_TAUMAX 6 #define DGG_DEFAULT_MAX_CUTS 500 #define DGG_DEFAULT_IMPROVEMENT_THRESH 0.001 #define DGG_DEFAULT_NBELOW_THRESH INT_MAX #define DGG_DEFAULT_NROOT_ROUNDS 2 #define DGG_DEFAULT_NEGATIVE_SCALED_TWOSTEPS 0 #define DGG_DEFAULT_ALPHA_RULE 0 #define DGG_DEFAULT_CUT_INC 250 #define DGG_DEFAULT_CUT_FORM 0 #define DGG_DEFAULT_NICEFY 0 #define DGG_DEFAULT_ONLY_DELAYED 0 #define DGG_DEFAULT_DELAYED_FREQ 9999999 #define DGG_DEFAULT_LPROWS_FREQ 9999999 #define DGG_DEFAULT_WHICH_FORMULATION_CUTS 2 /******************** SOLVER CONFIGURATION DEFINITIONS ************************/ #define DGG_OSI 0 #define DGG_CPX 1 #define DGG_QSO 2 /* determines the solver to be used */ #define DGG_SOLVER DGG_OSI /* adds checking routines to make sure solver works as expected */ #define DGG_DEBUG_SOLVER 0 /* turn off screen output from solver */ #define DGG_SOLVER_SCREEN_FLAG 0 /******************** CUT DEFINITIONS *****************************************/ /* internal names for cut types */ #define DGG_TMIR_CUT 1 #define DGG_2STEP_CUT 2 /* internal names for alpha-selection rules */ #define DGG_ALPHA_MIN_SUM 0 #define DGG_ALPHA_RANDOM_01 1 #define DGG_ALPHA_RANDOM_COEFF 2 #define DGG_ALPHA_ALL 3 #define DGG_ALPHA_MAX_STEEP 5 /******************** PRECISION & NUMERICAL ISSUES DEFINITIONS ****************/ /* how steep a cut must be before adding it to the lp */ #define DGG_MIN_STEEPNESS 1.0e-4 #define DGG_MAX_L2NORM 1.0e7 /* 0 = min steepness, 1 = max norm */ #define DGG_NORM_CRITERIA 1 /* internal representation of +infinity */ #define UB_MAX DBL_MAX /* used to define how fractional a basic-integer variable must be before choosing to use it to generate a TMIR cut on. OSI's default is 1.0e-7 */ #define DGG_GOMORY_THRESH 0.005 #define DGG_RHS_THRESH 0.005 /* used for comparing variables to their upper bounds. OSI's default is 1.0e-7. We set it to 1.0e6 because e-7 seems too sensitive. In fact, with e-7 the problem dsbmip.mps complains. */ #define DGG_BOUND_THRESH 1.0e-6 /* used for comparing the lhs (activity) value of a tableau row with the rhs. This is only used for debugging purposes. */ #define DGG_EQUALITY_THRESH 1.0e-5 /* used for comparing a variable's lower bound to 0.0 and determining if we need to shift the variable */ #define DGG_SHIFT_THRESH 1.0e-6 /* used for determing how far from an integer is still an integer. This value is used for comparing coefficients to integers. OSI's default is 1.0e-10. */ #define DGG_INTEGRALITY_THRESH 1.0e-10 /* the min value that a coeff can have in the tableau row before being set to zero. */ #define CBC_CHECK_CUT #ifndef CBC_CHECK_CUT #define DGG_MIN_TABLEAU_COEFFICIENT 1.0e-8 #else #define DGG_MIN_TABLEAU_COEFFICIENT 1.0e-12 #endif /* smallest value rho is allowed to have for a simple 2-step MIR (ie: not an extended two-step MIR) */ #define DGG_MIN_RHO 1.0e-7 #define DGG_MIN_ALPHA 1.0e-7 /* when a slack is null: used to check if a cut is satisfied or not. */ #define DGG_NULL_SLACK 1.0e-5 /* nicefy constants */ #define DGG_NICEFY_MIN_ABSVALUE 1.0e-13 #define DGG_NICEFY_MIN_FIX 1.0e-7 #define DGG_NICEFY_MAX_PADDING 1.0e-6 #define DGG_NICEFY_MAX_RATIO 1.0e9 /******************** ERROR-CATCHING MACROS ***********************************/ #if DGG_TRACE_ERRORS > 0 #define __DGG_PRINT_LOC__(F) fprintf(((F==0)?stdout:F), " in %s (%s:%d)\n", __func__, __FILE__, __LINE__) #define DGG_THROW(A,REST...) {\ fprintf(stdout, ##REST); \ __DGG_PRINT_LOC__(stdout); \ return (A);} #define DGG_IF_EXIT(A,B,REST...) {\ if(A) {\ fprintf(stdout, ##REST); \ __DGG_PRINT_LOC__(stdout); \ exit(B);}} #define DGG_CHECKRVAL(A,B) {\ if(A) {\ __DGG_PRINT_LOC__(stdout); \ return B; } } #define DGG_CHECKRVAL1(A,B) {\ if(A) {\ __DGG_PRINT_LOC__(stdout); \ rval = B; goto CLEANUP; } } #define DGG_WARNING(A, REST...) {\ if(A) {\ fprintf(stdout, ##REST); \ __DGG_PRINT_LOC__(stdout); \ }} #define DGG_TEST(A,B,REST...) {\ if(A) DGG_THROW(B,##REST) } #define DGG_TEST2(A,B,C,REST) {DGG_TEST(A,B,C,REST) } #define DGG_TEST3(A,B,C,D,REST) {DGG_TEST(A,B,C,D,REST) } #else #define DGG_IF_EXIT(A,B,REST) {if(A) {fprintf(stdout, REST);exit(B);}} #define DGG_THROW(A,B) return(A) #define DGG_CHECKRVAL(A,B) { if(A) return(B); } #define DGG_CHECKRVAL1(A,B){ if(A) { rval = B; goto CLEANUP; } } #define DGG_TEST(A,B,REST) { if(A) return(B);} #define DGG_TEST2(A,B,REST,C) { DGG_TEST(A,B,REST) } #define DGG_TEST3(A,B,REST,C,D) { DGG_TEST(A,B,REST) } #endif /******************** SIMPLE MACROS AND FUNCTIONS *****************************/ #define DGG_MIN(a,b) ( (ab)?a:b ) #define KREM(vht,alpha,tau) (DGG_MIN( ceil(vht / alpha), tau ) - 1) #define LMIN(vht, d, bht) (DGG_MIN( floor(d*bht/bht), d)) #define ABOV(v) (v - floor(v)) #define QINT(vht,bht,tau) ( (int)floor( (vht*(tau-1))/bht ) ) #define V2I(bht,tau,i) ( ((i+1)*bht / tau) ) int DGG_is_even(double vht, double bht, int tau, int q); double frac_part(double value); int DGG_is_a_multiple_of_b(double a, double b); /* free function for DGG_data_t. Frees internal arrays and data structure */ int DGG_freeData( DGG_data_t *data ); /******************** CONSTRAINT ADTs *****************************************/ DGG_constraint_t* DGG_newConstraint(int max_arrays); void DGG_freeConstraint(DGG_constraint_t *c); DGG_constraint_t *DGG_copyConstraint(DGG_constraint_t *c); void DGG_scaleConstraint(DGG_constraint_t *c, int t); /******************** CONFIGURATION *******************************************/ void DGG_list_init (DGG_list_t *l); int DGG_list_addcut (DGG_list_t *l, DGG_constraint_t *cut, int ctype, double alpha); void DGG_list_delcut (DGG_list_t *l, int i); void DGG_list_free(DGG_list_t *l); /******************* SOLVER SPECIFIC METHODS **********************************/ DGG_data_t *DGG_getData(const void *solver_ptr); /******************* CONSTRAINT MANIPULATION **********************************/ /* DGG_transformConstraint: manipulates a constraint in the following way: packs everything in output 1 - variables at their upper bounds are substituted for their complements. This is done by adjusting the coefficients and the right hand side (simple substitution). 2 - variables with non-zero lower bounds are shifted. */ int DGG_transformConstraint( DGG_data_t *data, double **x_out, double **rc_out, char **isint_out, DGG_constraint_t *constraint ); /* DGG_unTransformConstraint : 1 - Undoes step (1) of DGG_transformConstraint 2 - Undoes step (2) of DGG_transformConstraint */ int DGG_unTransformConstraint( DGG_data_t *data, DGG_constraint_t *constraint ); /* substitutes each slack variable by the structural variables which define it. This function, hence, changes the constraint 'cut'. */ int DGG_substituteSlacks( const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *cut ); int DGG_nicefyConstraint( const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *cut); /******************* CUT GENERATION *******************************************/ int DGG_getFormulaConstraint( int row_idx, const void *solver_ptr, DGG_data_t *data, DGG_constraint_t* row ); int DGG_getTableauConstraint( int index, const void *solver_ptr, DGG_data_t *data, DGG_constraint_t* tabrow, const int * colIsBasic, const int * rowIsBasic, CoinFactorization & factorization, int mode ); DGG_constraint_t* DGG_getSlackExpression(const void *solver_ptr, DGG_data_t* data, int row_index); int DGG_generateTabRowCuts( DGG_list_t *list, DGG_data_t *data, const void *solver_ptr ); int DGG_generateFormulationCuts( DGG_list_t *list, DGG_data_t *data, const void *solver_ptr, int nrows, CoinThreadRandom & generator); int DGG_generateFormulationCutsFromBase( DGG_constraint_t *base, double slack, DGG_list_t *list, DGG_data_t *data, const void *solver_ptr, CoinThreadRandom & generator); int DGG_generateCutsFromBase( DGG_constraint_t *base, DGG_list_t *list, DGG_data_t *data, const void *solver_ptr ); int DGG_buildMir( char *isint, DGG_constraint_t *base, DGG_constraint_t **cut_out ); int DGG_build2step( double alpha, char *isint, DGG_constraint_t *base, DGG_constraint_t **cut_out ); int DGG_addMirToList ( DGG_constraint_t *base, char *isint, double *x, DGG_list_t *list, DGG_data_t *data, DGG_constraint_t *orig_base ); int DGG_add2stepToList ( DGG_constraint_t *base, char *isint, double *x, double *rc, DGG_list_t *list, DGG_data_t *data, DGG_constraint_t *orig_base ); /******************* CUT INFORMATION ******************************************/ double DGG_cutLHS(DGG_constraint_t *c, double *x); int DGG_isCutDesirable(DGG_constraint_t *c, DGG_data_t *d); /******************* TEST / DEBUGGING ROUTINES ********************************/ int DGG_isConstraintViolated(DGG_data_t *d, DGG_constraint_t *c); int DGG_isBaseTrivial(DGG_data_t *d, DGG_constraint_t* c); int DGG_is2stepValid(double alpha, double bht); int DGG_cutsOffPoint(double *x, DGG_constraint_t *cut); //############################################################################# /** A function that tests the methods in the CglTwomir class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglTwomirUnitTest(const OsiSolverInterface * siP, const std::string mpdDir); #endif CoinMP-1.8.3/Cgl/src/CglParam.hpp0000644000175000017500000000457012130104031014776 0ustar renerene// Name: CglParam.hpp // Author: Francois Margot // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // email: fmargot@andrew.cmu.edu // Date: 11/24/06 // // $Id: CglParam.hpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //----------------------------------------------------------------------------- // Copyright (C) 2006, Francois Margot and others. All Rights Reserved. #ifndef CglParam_H #define CglParam_H #include "CglConfig.h" #include "CoinFinite.hpp" /** Class collecting parameters for all cut generators. Each generator may have a derived class to add parameters. Each generator might also set different default values for the parameters in CglParam. */ class CglParam { public: /**@name Public Set/get methods */ //@{ /** Set INFINIT */ virtual void setINFINIT(const double inf); /** Get value of INFINIT */ inline double getINFINIT() const {return INFINIT;} /** Set EPS */ virtual void setEPS(const double eps); /** Get value of EPS */ inline double getEPS() const {return EPS;} /** Set EPS_COEFF */ virtual void setEPS_COEFF(const double eps_c); /** Get value of EPS_COEFF */ inline double getEPS_COEFF() const {return EPS_COEFF;} /** Set MAX_SUPPORT */ virtual void setMAX_SUPPORT(const int max_s); /** Get value of MAX_SUPPORT */ inline int getMAX_SUPPORT() const {return MAX_SUPPORT;} //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglParam(const double inf = COIN_DBL_MAX, const double eps = 1e-6, const double eps_c = 1e-5, const int max_s = COIN_INT_MAX); /// Copy constructor CglParam(const CglParam&); /// Clone virtual CglParam* clone() const; /// Assignment operator CglParam& operator=(const CglParam &rhs); /// Destructor virtual ~CglParam(); //@} protected: // Protected member data /**@name Protected member data */ //@{ // Value for infinity. Default: COIN_DBL_MAX. double INFINIT; // EPSILON for double comparisons. Default: 1e-6. double EPS; // Returned cuts do not have coefficients with absolute value smaller // than EPS_COEFF. Default: 1e-5. double EPS_COEFF; /** Maximum number of non zero coefficients in a generated cut; Default: COIN_INT_MAX */ int MAX_SUPPORT; //@} }; #endif CoinMP-1.8.3/Cgl/src/CglResidualCapacity/0000755000175000017500000000000012600453456016471 5ustar renereneCoinMP-1.8.3/Cgl/src/CglResidualCapacity/Makefile.in0000644000175000017500000005473112506321416020543 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglResidualCapacity DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglResidualCapacity_la_LIBADD = am_libCglResidualCapacity_la_OBJECTS = CglResidualCapacity.lo \ CglResidualCapacityTest.lo libCglResidualCapacity_la_OBJECTS = \ $(am_libCglResidualCapacity_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglResidualCapacity_la_SOURCES) DIST_SOURCES = $(libCglResidualCapacity_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglResidualCapacity # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglResidualCapacity.la # List all source files for this library, including headers libCglResidualCapacity_la_SOURCES = CglResidualCapacity.cpp CglResidualCapacity.hpp CglResidualCapacityTest.cpp # This is for libtool (on Windows) libCglResidualCapacity_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglResidualCapacity.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglResidualCapacity/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglResidualCapacity/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglResidualCapacity.la: $(libCglResidualCapacity_la_OBJECTS) $(libCglResidualCapacity_la_DEPENDENCIES) $(CXXLINK) $(libCglResidualCapacity_la_LDFLAGS) $(libCglResidualCapacity_la_OBJECTS) $(libCglResidualCapacity_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglResidualCapacity.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglResidualCapacityTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglResidualCapacity/Makefile.am0000644000175000017500000000330211621724114020515 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglResidualCapacity # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglResidualCapacity.la # List all source files for this library, including headers libCglResidualCapacity_la_SOURCES = CglResidualCapacity.cpp CglResidualCapacity.hpp CglResidualCapacityTest.cpp # This is for libtool (on Windows) libCglResidualCapacity_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglResidualCapacity.hpp CoinMP-1.8.3/Cgl/src/CglResidualCapacity/CglResidualCapacity.cpp0000644000175000017500000004710112130104031023030 0ustar renerene// LAST EDIT: //----------------------------------------------------------------------------- // Implementation of Residual Capacity Inequalities // Francisco Barahona (barahon@us.ibm.com) // // date: May 18 2006 //----------------------------------------------------------------------------- // Copyright (C) 2004, International Business Machines Corporation and others. // All Rights Reserved. // This code is published under the Eclipse Public License. //#include //#include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinPackedVector.hpp" #include "CglResidualCapacity.hpp" //#define CGL_DEBUG 1 //----------------------------------------------------------------------------- // Generate Mixed Integer Rounding inequality //------------------------------------------------------------------- void CglResidualCapacity::generateCuts(const OsiSolverInterface& si, OsiCuts& cs, const CglTreeInfo /*info*/) { // If the LP or integer presolve is used, then need to redo preprocessing // everytime this function is called. Otherwise, just do once. bool preInit = false; bool preReso = false; si.getHintParam(OsiDoPresolveInInitial, preInit); si.getHintParam(OsiDoPresolveInResolve, preReso); if (preInit == false && preReso == false && doPreproc_ == -1 ) { // Do once if (doneInitPre_ == false) { resCapPreprocess(si); doneInitPre_ = true; } } else if ( doPreproc_ == 1 ){ // Do everytime resCapPreprocess(si); doneInitPre_ = true; } else if (doneInitPre_ == false) { resCapPreprocess(si); doneInitPre_ = true; } const double* xlp = si.getColSolution(); // LP solution const double* colUpperBound = si.getColUpper(); // vector of upper bounds const double* colLowerBound = si.getColLower(); // vector of lower bounds // get matrix by row const CoinPackedMatrix & tempMatrixByRow = *si.getMatrixByRow(); CoinPackedMatrix matrixByRow; matrixByRow.submatrixOf(tempMatrixByRow, numRows_, indRows_); const double* LHS = si.getRowActivity(); const double* coefByRow = matrixByRow.getElements(); const int* colInds = matrixByRow.getIndices(); const int* rowStarts = matrixByRow.getVectorStarts(); const int* rowLengths = matrixByRow.getVectorLengths(); generateResCapCuts(si, xlp, colUpperBound, colLowerBound, matrixByRow, LHS, coefByRow, colInds, rowStarts, rowLengths, cs); } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglResidualCapacity::CglResidualCapacity () : CglCutGenerator() { gutsOfConstruct(1.0e-6); } //------------------------------------------------------------------- // Alternate Constructor //------------------------------------------------------------------- CglResidualCapacity::CglResidualCapacity (const double epsilon) : CglCutGenerator() { gutsOfConstruct(epsilon); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglResidualCapacity::CglResidualCapacity ( const CglResidualCapacity & rhs) : CglCutGenerator(rhs) { gutsOfCopy(rhs); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglResidualCapacity::clone() const { return new CglResidualCapacity(*this); } //------------------------------------------------------------------ // Assignment operator //------------------------------------------------------------------- CglResidualCapacity & CglResidualCapacity::operator=(const CglResidualCapacity& rhs) { if (this != &rhs) { gutsOfDelete(); CglCutGenerator::operator=(rhs); gutsOfCopy(rhs); } return *this; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglResidualCapacity::~CglResidualCapacity () { gutsOfDelete(); } //------------------------------------------------------------------- // Construct //------------------------------------------------------------------- void CglResidualCapacity::gutsOfConstruct (const double epsilon) { EPSILON_ = epsilon; TOLERANCE_ = 1.0e-4; doPreproc_ = -1; numRows_ = 0; numCols_ = 0; doneInitPre_ = false; rowTypes_ = 0; indRows_ = 0; sense_=NULL; RHS_=NULL; numRowL_ = 0; indRowL_ = 0; numRowG_ = 0; indRowG_ = 0; } //------------------------------------------------------------------- // Delete //------------------------------------------------------------------- void CglResidualCapacity::gutsOfDelete () { if (rowTypes_ != 0) { delete [] rowTypes_; rowTypes_ = 0; } if (indRows_ != 0) { delete [] indRows_; indRows_ = 0; } if (indRowL_ != 0) { delete [] indRowL_; indRowL_ = 0; } if (indRowG_ != 0) { delete [] indRowG_; indRowG_ = 0; } if (sense_ !=NULL) { delete [] sense_; sense_=NULL;} if (RHS_ !=NULL) { delete [] RHS_; RHS_=NULL;} } //------------------------------------------------------------------- // Copy //------------------------------------------------------------------- void CglResidualCapacity::gutsOfCopy (const CglResidualCapacity& rhs) { EPSILON_ = rhs.EPSILON_; TOLERANCE_ = rhs.TOLERANCE_; doPreproc_ = rhs.doPreproc_; numRows_ = rhs.numRows_; numCols_ = rhs.numCols_; doneInitPre_ = rhs.doneInitPre_; numRowL_ = rhs.numRowL_; numRowG_ = rhs.numRowG_; if (numRows_ > 0) { rowTypes_ = new RowType [numRows_]; CoinDisjointCopyN(rhs.rowTypes_, numRows_, rowTypes_); indRows_ = new int [numRows_]; CoinDisjointCopyN(rhs.indRows_, numRows_, indRows_); sense_ = CoinCopyOfArray(rhs.sense_,numRows_); RHS_ = CoinCopyOfArray(rhs.RHS_,numRows_); } else { rowTypes_ = 0; indRows_ = 0; sense_=NULL; RHS_=NULL; } if (numRowL_ > 0) { indRowL_ = new int [numRowL_]; CoinDisjointCopyN(rhs.indRowL_, numRowL_, indRowL_); } else { indRowL_ = 0; } if (numRowG_ > 0) { indRowG_ = new int [numRowG_]; CoinDisjointCopyN(rhs.indRowG_, numRowG_, indRowG_); } else { indRowG_ = 0; } } //------------------------------------------------------------------- // Do preprocessing // It determines the type of each row. //------------------------------------------------------------------- void CglResidualCapacity:: resCapPreprocess(const OsiSolverInterface& si) { // get matrix stored by row const CoinPackedMatrix & matrixByRow = *si.getMatrixByRow(); numRows_ = si.getNumRows(); numCols_ = si.getNumCols(); const double* coefByRow = matrixByRow.getElements(); const int* colInds = matrixByRow.getIndices(); const int* rowStarts = matrixByRow.getVectorStarts(); const int* rowLengths = matrixByRow.getVectorLengths(); const double * colLowerBound = si.getColLower(); const double * colUpperBound = si.getColUpper(); // Get copies of sense and RHS so we can modify if ranges if (sense_) { delete [] sense_; delete [] RHS_; } sense_ = CoinCopyOfArray(si.getRowSense(),numRows_); RHS_ = CoinCopyOfArray(si.getRightHandSide(),numRows_); if (rowTypes_ != 0) { delete [] rowTypes_; rowTypes_ = 0; } rowTypes_ = new RowType [numRows_]; // Destructor will free memory // Summarize the row type infomation. int numOTHER = 0; int numL = 0; int numG = 0; int numB = 0; int iRow; const double* rowActivity = si.getRowActivity(); const double* rowLower = si.getRowLower(); const double* rowUpper = si.getRowUpper(); for (iRow = 0; iRow < numRows_; ++iRow) { // If range then choose which to use if (sense_[iRow]=='R') { if (rowActivity[iRow]-rowLower[iRow]< rowUpper[iRow]-rowActivity[iRow]) { // treat as G row RHS_[iRow]=rowLower[iRow]; sense_[iRow]='G'; } else { // treat as L row RHS_[iRow]=rowUpper[iRow]; sense_[iRow]='L'; } } // get the type of a row const RowType rowType = determineRowType(si, rowLengths[iRow], colInds+rowStarts[iRow], coefByRow+rowStarts[iRow], sense_[iRow], RHS_[iRow], colLowerBound, colUpperBound); // store the type of the current row rowTypes_[iRow] = rowType; // Summarize information about row types switch(rowType) { case ROW_OTHER: ++numOTHER; break; case ROW_L: ++numL; break; case ROW_G: ++numG; break; case ROW_BOTH: ++numB; break; default: throw CoinError("Unknown row type", "ResidualCapacityPreprocess", "CglResidualCapacity"); } } // allocate memory for vector of indices of all rows if (indRows_ != 0) { delete [] indRows_; indRows_ = 0; } if (numRows_ > 0) indRows_ = new int [numRows_]; // Destructor will free memory // allocate memory for vector of indices of rows of type ROW_L and ROW_BOTH numRowL_ = numL + numB; if (indRowL_ != 0) { delete [] indRowL_; indRowL_ = 0; } if (numRowL_ > 0) indRowL_ = new int [numRowL_]; // Destructor will free memory // allocate memory for vector of indices of rows of type ROW_G and ROW_BOTH numRowG_ = numG + numB; if (indRowG_ != 0) { delete [] indRowG_; indRowG_ = 0; } if (numRowG_ > 0) indRowG_ = new int [numRowG_]; // Destructor will free memory #if CGL_DEBUG std::cout << "The num of rows = " << numRows_ << std::endl; std::cout << "Summary of Row Type" << std::endl; std::cout << "numL = " << numL << std::endl; std::cout << "numG = " << numG << std::endl; #endif int countL = 0; int countG = 0; for ( iRow = 0; iRow < numRows_; ++iRow) { RowType rowType = rowTypes_[iRow]; // fill the vector indRows_ with the indices of all rows indRows_[iRow] = iRow; // fill the vector indRowL_ with the indices of the rows of type ROW_L and ROW_BOTH if (rowType == ROW_L || rowType == ROW_BOTH) { indRowL_[countL] = iRow; countL++; } // fill the vector indRowG_ with the indices of rows of type ROW_G and ROW_BOTH if (rowType == ROW_G || rowType == ROW_BOTH) { indRowG_[countG] = iRow; countG++; } } } //------------------------------------------------------------------- // Determine the type of a given row //------------------------------------------------------------------- CglResidualCapacity::RowType CglResidualCapacity::determineRowType(const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const char sense, const double rhs, const double* colLowerBound, const double* colUpperBound) const { if (rowLen == 0) return ROW_OTHER; RowType rowType = ROW_OTHER; double *negCoef; bool flagL, flagG, flag1, flag2; switch (sense) { case 'L': flagL=treatAsLessThan(si, rowLen, ind, coef, rhs, colLowerBound, colUpperBound); if ( flagL ) rowType=ROW_L; break; case 'G': negCoef = new double[rowLen]; for ( int i=0; i < rowLen; ++i ) negCoef[i]=-coef[i]; flagG=treatAsLessThan(si, rowLen, ind, negCoef, -rhs, colLowerBound, colUpperBound); if ( flagG ) rowType=ROW_G; delete [] negCoef; break; case 'E': flag1=treatAsLessThan(si, rowLen, ind, coef, rhs, colLowerBound, colUpperBound); negCoef = new double[rowLen]; for ( int i=0; i < rowLen; ++i ) negCoef[i]=-coef[i]; flag2=treatAsLessThan(si, rowLen, ind, negCoef, -rhs, colLowerBound, colUpperBound); delete [] negCoef; if ( flag1 && !flag2 ) rowType=ROW_L; if ( !flag1 && flag2 ) rowType=ROW_G; if ( flag1 && flag2 ) rowType=ROW_BOTH; break; default: throw CoinError("Unknown sense", "determineRowType", "CglResidualCapacity"); } return rowType; } //-------------------------------------------- // determine if an ineq of type <= is a good candidate //-------------------------------------------- bool CglResidualCapacity::treatAsLessThan(const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const double /*rhs*/, const double* colLowerBound, const double* colUpperBound) const { bool intFound=false; bool contFound=false; bool goodIneq=true; double intCoef=-1; // look for a_1 c_1 + + a_k c_k - d z_1 - - d z_p <= b // where c_i continuous, z_j integer for ( int i = 0; i < rowLen; ++i ) { if ( coef[i] > EPSILON_ || !si.isInteger(ind[i]) ) { if ( colLowerBound[ind[i]] < -EPSILON_ || colUpperBound[ind[i]] > 1.e10 ){ // cont var with too big bounds goodIneq=false; break; } else contFound=true; } else if ( !intFound && coef[i] < -EPSILON_ && si.isInteger(ind[i]) ){ intFound=true; intCoef=coef[i]; continue; } else if ( intFound && coef[i] < -EPSILON_ && si.isInteger(ind[i]) && fabs( coef[i] - intCoef ) > EPSILON_ ){ goodIneq=false; break; } } if ( contFound && intFound && goodIneq ) return true; else return false; } //------------------------------------------------------------------- // Generate Residual capacity cuts //------------------------------------------------------------------- void CglResidualCapacity::generateResCapCuts( const OsiSolverInterface& si, const double* xlp, const double* colUpperBound, const double* colLowerBound, const CoinPackedMatrix& /*matrixByRow*/, const double* /*LHS*/, const double* coefByRow, const int* colInds, const int* rowStarts, const int* rowLengths, OsiCuts& cs ) const { #if CGL_DEBUG // OPEN FILE std::ofstream fout("stats.dat"); #endif for (int iRow = 0; iRow < numRowL_; ++iRow) { int rowToUse=indRowL_[iRow]; OsiRowCut resCapCut; // Find a most violated residual capacity ineq bool hasCut = resCapSeparation(si, rowLengths[rowToUse], colInds+rowStarts[rowToUse], coefByRow+rowStarts[rowToUse], RHS_[rowToUse], xlp, colUpperBound, colLowerBound, resCapCut); // if a cut was found, insert it into cs if (hasCut) { #if CGL_DEBUG std::cout << "Res. cap. cut generated " << std::endl; #endif cs.insert(resCapCut); } } for (int iRow = 0; iRow < numRowG_; ++iRow) { int rowToUse=indRowG_[iRow]; OsiRowCut resCapCut; const int rowLen=rowLengths[rowToUse]; double *negCoef= new double[rowLen]; const int rStart=rowStarts[rowToUse]; for ( int i=0; i < rowLen; ++i ) negCoef[i]=-coefByRow[rStart+i]; // Find a most violated residual capacity ineq bool hasCut = resCapSeparation(si, rowLengths[rowToUse], colInds+rowStarts[rowToUse], negCoef, -RHS_[rowToUse], xlp, colUpperBound, colLowerBound, resCapCut); delete [] negCoef; // if a cut was found, insert it into cs if (hasCut) { #if CGL_DEBUG std::cout << "Res. cap. cut generated " << std::endl; #endif cs.insert(resCapCut); } } #if CGL_DEBUG // CLOSE FILE fout.close(); #endif return; } //------------------------------------------------------------------- // separation algorithm //------------------------------------------------------------------- bool CglResidualCapacity::resCapSeparation(const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const double rhs, const double *xlp, const double* colUpperBound, const double* /*colLowerBound*/, OsiRowCut& resCapCut) const { // process original row to create row in canonical form std::vector positionIntVar; double ybar=0.0; double *xbar; double intCoef=-1; double *newRowCoef; int *positionContVar; double newRowRHS; int contCount=0; for ( int i = 0; i < rowLen; ++i ) { if ( coef[i] < -EPSILON_ && si.isInteger(ind[i]) ){ intCoef=-coef[i]; ybar+=xlp[ind[i]]; positionIntVar.push_back(i); } else ++contCount; } xbar = new double [contCount]; newRowCoef = new double [contCount]; positionContVar = new int [contCount]; contCount=0; newRowRHS=rhs; for ( int i = 0; i < rowLen; ++i ) if ( coef[i] > EPSILON_ || !si.isInteger(ind[i]) ){ newRowCoef[contCount]=coef[i]*colUpperBound[ind[i]]; xbar[contCount]=xlp[ind[i]]/colUpperBound[ind[i]]; if ( newRowCoef[contCount] < -EPSILON_ ){ // complement newRowCoef[contCount] = -newRowCoef[contCount]; xbar[contCount] = 1.0 - xbar[contCount]; newRowRHS+= newRowCoef[contCount]; } positionContVar[contCount++]=i; } // now separate std::vector setSbar; const double lambda = ybar - floor(ybar); double sumCoef=0.0; for ( int i = 0; i < contCount; ++i ) if ( xbar[i] > lambda ){ setSbar.push_back(i); sumCoef+=newRowCoef[i]; } const int sSize = static_cast(setSbar.size()); bool generated; if ( sSize == 0 ) generated=false; // no cut else { // generate cut const double mu= ceil( (sumCoef - newRowRHS)/intCoef ); double r = sumCoef - newRowRHS - intCoef * floor( (sumCoef - newRowRHS)/intCoef ); const int numInt = static_cast(positionIntVar.size()); const int cutLen = sSize + numInt; int* cutInd = new int [cutLen]; double* cutCoef = new double [cutLen]; double violation=0.0; double complCoef=0.0; // load continuous variables for ( int i = 0; i < sSize; ++i ){ const int newRowPosition=setSbar[i]; const int originalRowPosition=positionContVar[newRowPosition]; cutInd[i]=ind[originalRowPosition]; cutCoef[i]=coef[originalRowPosition]; if ( cutCoef[i] < -EPSILON_ ) complCoef+= cutCoef[i]*colUpperBound[ind[originalRowPosition]]; violation+=cutCoef[i]*xlp[ind[originalRowPosition]]; } // load integer variables for ( int i = 0; i < numInt; ++i ){ const int originalRowPosition=positionIntVar[i]; cutInd[i+sSize]=ind[originalRowPosition]; cutCoef[i+sSize]= - r; violation+=cutCoef[i+sSize]*xlp[ind[originalRowPosition]]; } double cutRHS=(sumCoef - r * mu) + complCoef; violation-=cutRHS; if ( violation > TOLERANCE_ ){ resCapCut.setRow(cutLen, cutInd, cutCoef); resCapCut.setLb(-1.0 * si.getInfinity()); resCapCut.setUb(cutRHS); resCapCut.setEffectiveness(violation); generated=true; #if 0 std::cout << "coef "; for(int i=0; i #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglResidualCapacity.hpp" void CglResidualCapacityUnitTest(const OsiSolverInterface *baseSiP, const std::string mpsDir) { // Test default constructor { CglResidualCapacity aGenerator; } // Test copy & assignment { CglResidualCapacity rhs; { CglResidualCapacity bGenerator; CglResidualCapacity cGenerator(bGenerator); rhs=bGenerator; } } // Test get/set methods { CglResidualCapacity getset; double geps = 10 * getset.getEpsilon(); getset.setEpsilon(geps); double geps2 = getset.getEpsilon(); assert(geps == geps2); double gtol = 10 * getset.getTolerance(); getset.setTolerance(gtol); double gtol2 = getset.getTolerance(); assert(gtol == gtol2); int gpre = getset.getDoPreproc(); gpre = (gpre + 1) % 3 - 1; getset.setDoPreproc(gpre); int gpre2 = getset.getDoPreproc(); assert(gpre == gpre2); } // Test generateCuts { CglResidualCapacity gct; OsiSolverInterface *siP = baseSiP->clone(); std::string fn = mpsDir+"capPlan1"; std::string fn2 = mpsDir+"capPlan1.mps"; FILE *in_f = fopen(fn2.c_str(), "r"); if(in_f == NULL) { std::cout<<"Can not open file "<readMps(fn.c_str(),"mps"); siP->initialSolve(); double lpRelax = siP->getObjValue(); OsiCuts cs; gct.setDoPreproc(1); // Needed for DyLP gct.generateCuts(*siP, cs); int nRowCuts = cs.sizeRowCuts(); std::cout<<"There are "< 0); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cs); siP->resolve(); double lpRelaxAfter= siP->getObjValue(); std::cout<<"Initial LP value: "< #include //#include #include "CoinError.hpp" #include "CglCutGenerator.hpp" //============================================================================= #ifndef CGL_DEBUG #define CGL_DEBUG 0 #endif //============================================================================= //============================================================================= /** Residual Capacity Inequalities Cut Generator Class References: T Magnanti, P Mirchandani, R Vachani, "The convex hull of two core capacitated network design problems," Math Programming 60 (1993), 233-250. A Atamturk, D Rajan, "On splittable and unsplittable flow capacitated network design arc-set polyhedra," Math Programming 92 (2002), 315-333. **/ class CglResidualCapacity : public CglCutGenerator { friend void CglResidualCapacityUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); private: //--------------------------------------------------------------------------- // Enumeration constants that describe the various types of rows enum RowType { /** row of the type a_1 c_1 + + a_k c_k - d z_1 - - d z_p <= b, where c_i are continuous variables and z_j are integer variables */ ROW_L, /** row of the type -a_1 c_1 - - a_k c_k + d z_1 + + d z_p >= b, where c_i are continuous variables and z_j are integer variables */ ROW_G, /** equation that can be treated as ROW_L and ROW_G */ ROW_BOTH, /** Other types of rows */ ROW_OTHER }; public: /**@name Get and Set Parameters */ //@{ /// Set Epsilon void setEpsilon(double value); /// Get Epsilon double getEpsilon() const; /// Set Tolerance void setTolerance(double value); /// Get Tolerance double getTolerance() const; /// Set doPreproc void setDoPreproc(int value); /// Get doPreproc bool getDoPreproc() const; //@} /**@name Generate Cuts */ //@{ /** Generate Residual Capacity cuts for the model data contained in si. The generated cuts are inserted in the collection of cuts cs. */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} //--------------------------------------------------------------------------- /**@name Constructors and destructors */ //@{ /// Default constructor CglResidualCapacity (); /// Alternate Constructor CglResidualCapacity ( const double tolerance ); /// Copy constructor CglResidualCapacity ( const CglResidualCapacity &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglResidualCapacity & operator=( const CglResidualCapacity& rhs); /// Destructor virtual ~CglResidualCapacity (); /// This is to refresh preprocessing virtual void refreshPrep(); //@} private: //-------------------------------------------------------------------------- // Private member methods // Construct void gutsOfConstruct ( const double tolerance); // Delete void gutsOfDelete(); // Copy void gutsOfCopy (const CglResidualCapacity& rhs); // Do preprocessing. // It determines the type of each row. // It may change sense and RHS for ranged rows void resCapPreprocess(const OsiSolverInterface& si); // Determine the type of a given row. RowType determineRowType(const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const char sense, const double rhs, const double* colLowerBound, const double* colUpperBound) const; // helps the function above bool treatAsLessThan(const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const double rhs, const double* colLowerBound, const double* colUpperBound) const; // Generate Residual Capacity cuts void generateResCapCuts( const OsiSolverInterface& si, const double* xlp, const double* colUpperBound, const double* colLowerBound, const CoinPackedMatrix& matrixByRow, const double* LHS, const double* coefByRow, const int* colInds, const int* rowStarts, const int* rowLengths, OsiCuts& cs ) const; // Residual Capacity separation bool resCapSeparation(const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const double rhs, const double *xlp, const double* colUpperBound, const double* colLowerBound, OsiRowCut& resCapCut) const; private: //--------------------------------------------------------------------------- // Private member data /** Tolerance used for numerical purposes, default value: 1.e-6 **/ double EPSILON_; /** If violation of a cut is greater that this number, the cut is accepted, default value: 1.e-4 **/ double TOLERANCE_; /** Controls the preprocessing of the matrix to identify rows suitable for cut generation.
    • -1: preprocess according to solver settings;
    • 0: Do preprocessing only if it has not yet been done;
    • 1: Do preprocessing.
    Default value: -1 **/ int doPreproc_; // The number of rows of the problem. int numRows_; // The number columns of the problem. int numCols_; // Indicates whether preprocessing has been done. bool doneInitPre_; // Array with the row types of the rows in the model. RowType* rowTypes_; // The indices of the rows of the initial matrix int* indRows_; // Sense of rows (modified if ranges) char * sense_; // RHS of rows (modified if ranges) double * RHS_; // The number of rows of type ROW_L int numRowL_; // The indices of the rows of type ROW_L int* indRowL_; // The number of rows of type ROW_G int numRowG_; // The indices of the rows of type ROW_G int* indRowG_; }; //############################################################################# /** A function that tests the methods in the CglResidualCapacity class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglResidualCapacityUnitTest(const OsiSolverInterface * siP, const std::string mpdDir); #endif CoinMP-1.8.3/Cgl/src/CglCutGenerator.hpp0000644000175000017500000000652412130102162016344 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglCutGenerator_H #define CglCutGenerator_H #include "OsiCuts.hpp" #include "OsiSolverInterface.hpp" #include "CglTreeInfo.hpp" //------------------------------------------------------------------- // // Abstract base class for generating cuts. // //------------------------------------------------------------------- /// /** Cut Generator Base Class This is an abstract base class for generating cuts. A specific cut generator will inherit from this class. */ class CglCutGenerator { public: /**@name Generate Cuts */ //@{ /** Generate cuts for the model data contained in si. The generated cuts are inserted into and returned in the collection of cuts cs. */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo())=0; //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglCutGenerator (); /// Copy constructor CglCutGenerator ( const CglCutGenerator &); /// Clone virtual CglCutGenerator * clone() const = 0; /// Assignment operator CglCutGenerator & operator=(const CglCutGenerator& rhs); /// Destructor virtual ~CglCutGenerator (); /** Create C++ lines to set the generator in the current state. The output must be parsed by the calling code, as each line starts with a key indicating the following:
    0: must be kept (for #includes etc)
    3: Set to changed (not default) values
    4: Set to default values (redundant)
    Keys 1, 2, 5, 6, 7, 8 are defined, but not applicable to cut generators. */ virtual std::string generateCpp( FILE * ) {return "";} /// This can be used to refresh any information virtual void refreshSolver(OsiSolverInterface * ) {} //@} /**@name Gets and Sets */ //@{ /** Get Aggressiveness - 0 = neutral, 100 is normal root node. Really just a hint to cut generator */ inline int getAggressiveness() const { return aggressive_;} /** Set Aggressiveness - 0 = neutral, 100 is normal root node. Really just a hint to cut generator */ inline void setAggressiveness(int value) { aggressive_=value;} /// Set whether can do global cuts inline void setGlobalCuts(bool trueOrFalse) { canDoGlobalCuts_ = trueOrFalse;} /// Say whether can do global cuts inline bool canDoGlobalCuts() const {return canDoGlobalCuts_;} /** Returns true if may generate Row cuts in tree (rather than root node). Used so know if matrix will change in tree. Really meant so column cut generators can still be active without worrying code. Default is true */ virtual bool mayGenerateRowCutsInTree() const; /// Return true if needs optimal basis to do cuts virtual bool needsOptimalBasis() const; /// Return maximum length of cut in tree virtual int maximumLengthOfCutInTree() const { return COIN_INT_MAX;} //@} // test this class //static void unitTest(); // private: /** Aggressiveness - 0 = neutral, 100 is normal root node. Really just a hint to cut generator */ int aggressive_; /// True if can do global cuts i.e. no general integers bool canDoGlobalCuts_; }; #endif CoinMP-1.8.3/Cgl/src/CglTreeInfo.hpp0000644000175000017500000001430512306400264015462 0ustar renerene// $Id: CglTreeInfo.hpp 1201 2014-03-07 17:24:04Z forrest $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglTreeInfo_H #define CglTreeInfo_H #include "OsiCuts.hpp" #include "OsiSolverInterface.hpp" #include "CoinHelperFunctions.hpp" class CglStored; /** Information about where the cut generator is invoked from. */ class CglTreeInfo { public: /// The level of the search tree node int level; /** How many times the cut generator was already invoked in this search tree node */ int pass; /** The number of rows in the original formulation. Some generators may not want to consider already generated rows when generating new ones. */ int formulation_rows; /** Options 1 - treat costed integers as important 2 - switch off some stuff as variables semi-integer 4 - set global cut flag if at root node 8 - set global cut flag if at root node and first pass 16 - set global cut flag and make cuts globally valid 32 - last round of cuts did nothing - maybe be more aggressive 64 - in preprocessing stage 128 - looks like solution 256 - want alternate cuts 512 - in sub tree (i.e. parent model) 1024 - in must call again mode or after everything mode */ int options; /// Set true if in tree (to avoid ambiguity at first branch) bool inTree; /** Replacement array. Before Branch and Cut it may be beneficial to strengthen rows rather than adding cuts. If this array is not NULL then the cut generator can place a pointer to the stronger cut in this array which is number of rows in size. A null (i.e. zero elements and free rhs) cut indicates that the row is useless and can be removed. The calling function can then replace those rows. */ OsiRowCut ** strengthenRow; /// Optional pointer to thread specific random number generator CoinThreadRandom * randomNumberGenerator; /// Default constructor CglTreeInfo (); /// Copy constructor CglTreeInfo ( const CglTreeInfo &); /// Clone virtual CglTreeInfo * clone() const; /// Assignment operator CglTreeInfo & operator=( const CglTreeInfo& rhs); /// Destructor virtual ~CglTreeInfo (); /// Take action if cut generator can fix a variable (toValue -1 for down, +1 for up) virtual bool fixes(int , int , int ,bool) {return false;} /** Initalizes fixing arrays etc - returns >0 if we want to save info 0 if we don't and -1 if is to be used */ virtual int initializeFixing(const OsiSolverInterface * ) {return 0;} }; /** Derived class to pick up probing info. */ typedef struct { //unsigned int oneFixed:1; // nonzero if variable to 1 fixes all //unsigned int sequence:31; // variable (in matrix) (but also see cliqueRow_) unsigned int fixes; } CliqueEntry; class CglTreeProbingInfo : public CglTreeInfo { public: /// Default constructor CglTreeProbingInfo (); /// Constructor from model CglTreeProbingInfo (const OsiSolverInterface * model); /// Copy constructor CglTreeProbingInfo ( const CglTreeProbingInfo &); /// Clone virtual CglTreeInfo * clone() const; /// Assignment operator CglTreeProbingInfo & operator=( const CglTreeProbingInfo& rhs); /// Destructor virtual ~CglTreeProbingInfo (); OsiSolverInterface * analyze(const OsiSolverInterface & si, int createSolver=0, int numberExtraCliques=0,const int * starts=NULL, const CliqueEntry * entries=NULL,const char * type=NULL); /** Take action if cut generator can fix a variable (toValue -1 for down, +1 for up) Returns true if still room, false if not */ virtual bool fixes(int variable, int toValue, int fixedVariable,bool fixedToLower); /** Initalizes fixing arrays etc - returns >0 if we want to save info 0 if we don't and -1 if is to be used */ virtual int initializeFixing(const OsiSolverInterface * model) ; /// Fix entries in a solver using implications int fixColumns(OsiSolverInterface & si) const; /// Fix entries in a solver using implications for one variable int fixColumns(int iColumn, int value, OsiSolverInterface & si) const; /// Packs down entries int packDown(); /// Generate cuts from implications void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) const; /// Entries for fixing variables inline CliqueEntry * fixEntries() { convert(); return fixEntry_;} /// Starts of integer variable going to zero inline int * toZero() { convert(); return toZero_;} /// Starts of integer variable going to one inline int * toOne() { convert(); return toOne_;} /// List of 0-1 integer variables inline int * integerVariable() const { return integerVariable_;} /// Backward look up inline int * backward() const { return backward_;} /// Number of variables inline int numberVariables() const { return numberVariables_;} /// Number of 0-1 variables inline int numberIntegers() const { return numberIntegers_;} private: /// Converts to ordered void convert(); protected: /// Entries for fixing variables CliqueEntry * fixEntry_; /// Starts of integer variable going to zero int * toZero_; /// Starts of integer variable going to one int * toOne_; /// List of 0-1 integer variables int * integerVariable_; /// Backward look up int * backward_; /// Entries for fixing variable when collecting int * fixingEntry_; /// Number of variables int numberVariables_; /// Number of 0-1 variables int numberIntegers_; /// Maximum number in fixEntry_ int maximumEntries_; /// Number entries in fixingEntry_ (and fixEntry_) or -2 if correct style int numberEntries_; }; inline int sequenceInCliqueEntry(const CliqueEntry & cEntry) { return cEntry.fixes&0x7fffffff;} inline void setSequenceInCliqueEntry(CliqueEntry & cEntry,int sequence) { cEntry.fixes = sequence|(cEntry.fixes&0x80000000);} inline bool oneFixesInCliqueEntry(const CliqueEntry & cEntry) { return (cEntry.fixes&0x80000000)!=0;} inline void setOneFixesInCliqueEntry(CliqueEntry & cEntry,bool oneFixes) { cEntry.fixes = (oneFixes ? 0x80000000 : 0)|(cEntry.fixes&0x7fffffff);} #endif CoinMP-1.8.3/Cgl/src/CglGMI/0000755000175000017500000000000012600453456013657 5ustar renereneCoinMP-1.8.3/Cgl/src/CglGMI/Makefile.in0000644000175000017500000005424712506321416015733 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglGMI DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglGMI_la_LIBADD = am_libCglGMI_la_OBJECTS = CglGMI.lo CglGMIParam.lo libCglGMI_la_OBJECTS = $(am_libCglGMI_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglGMI_la_SOURCES) DIST_SOURCES = $(libCglGMI_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglGMI # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglGMI.la # List all source files for this library, including headers libCglGMI_la_SOURCES = \ CglGMI.cpp CglGMI.hpp \ CglGMIParam.cpp CglGMIParam.hpp # This is for libtool (on Windows) libCglGMI_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglGMI.hpp CglGMIParam.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglGMI/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglGMI/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglGMI.la: $(libCglGMI_la_OBJECTS) $(libCglGMI_la_DEPENDENCIES) $(CXXLINK) $(libCglGMI_la_LDFLAGS) $(libCglGMI_la_OBJECTS) $(libCglGMI_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglGMI.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglGMIParam.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglGMI/Makefile.am0000644000175000017500000000321312130104031015666 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglGMI # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglGMI.la # List all source files for this library, including headers libCglGMI_la_SOURCES = \ CglGMI.cpp CglGMI.hpp \ CglGMIParam.cpp CglGMIParam.hpp # This is for libtool (on Windows) libCglGMI_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglGMI.hpp CglGMIParam.hpp CoinMP-1.8.3/Cgl/src/CglGMI/CglGMIParam.cpp0000644000175000017500000001475712130104031016400 0ustar renerene// Name: CglGMIParam.hpp // Author: Giacomo Nannicini // Singapore University of Technology and Design // email: nannicini@sutd.edu.sg // based on CglRedSplitParam.cpp by Francois Margot // Date: 11/17/09 //----------------------------------------------------------------------------- // Copyright (C) 2009, Giacomo Nannicini and others. All Rights Reserved. #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CglGMIParam.hpp" /***********************************************************************/ void CglGMIParam::setAway(double value) { if (value > 0.0 && value <= 0.5) { AWAY = value; } else { printf("### WARNING: CglGMIParam::setAWAY(): value: %f ignored\n", value); } } /***********************************************************************/ void CglGMIParam::setEPS_ELIM(double value) { if (value >= 0) { EPS_ELIM = value; } else { printf("### WARNING: CglGMIParam::setEPS_ELIM(): value: %f ignored\n", value); } } /* setEPS_ELIM */ /***********************************************************************/ void CglGMIParam::setEPS_RELAX_ABS(double value) { if (value >= 0) { EPS_RELAX_ABS = value; } else { printf("### WARNING: CglGMIParam::setEPS_RELAX_ABS(): value: %f ignored\n", value); } } /* setEPS_RELAX_ABS */ /***********************************************************************/ void CglGMIParam::setEPS_RELAX_REL(double value) { if (value >= 0) { EPS_RELAX_REL = value; } else { printf("### WARNING: CglGMIParam::setEPS_RELAX_REL(): value: %f ignored\n", value); } } /* setEPS_RELAX_REL */ /***********************************************************************/ void CglGMIParam::setMAXDYN(double value) { if (value >= 1.0) { MAXDYN = value; } else { printf("### WARNING: CglGMI::setMAXDYN(): value: %f ignored\n", value); } } /* setMAXDYN */ /***********************************************************************/ void CglGMIParam::setMINVIOL(double value) { if (value >= 0.0) { MINVIOL = value; } else { printf("### WARNING: CglGMIParam::setMINVIOL(): value: %f ignored\n", value); } } /* setMINVIOL */ /***********************************************************************/ void CglGMIParam::setMAX_SUPPORT_REL(double value) { if (value >= 0.0 && value <= 1.0) { MAX_SUPPORT_REL = value; } else { printf("### WARNING: CglGMIParam::setMAX_SUPPORT_REL(): value: %f ignored\n", value); } } /* setMAX_SUPPORT_REL */ /***********************************************************************/ void CglGMIParam::setUSE_INTSLACKS(bool value) { USE_INTSLACKS = value; } /* setUSE_INTSLACKS */ /***********************************************************************/ void CglGMIParam::setCHECK_DUPLICATES(bool value) { CHECK_DUPLICATES = value; } /* setCHECK_DUPLICATES */ /***********************************************************************/ void CglGMIParam::setINTEGRAL_SCALE_CONT(bool value) { INTEGRAL_SCALE_CONT = value; } /* setINTEGRAL_SCALE_CONT */ /***********************************************************************/ void CglGMIParam::setENFORCE_SCALING(bool value) { ENFORCE_SCALING = value; } /* setENFORCE_SCALING */ /***********************************************************************/ void CglGMIParam::setCLEAN_PROC(CleaningProcedure value) { CLEAN_PROC = value; } /* setCLEAN_PROC */ /***********************************************************************/ CglGMIParam::CglGMIParam(double eps, double away, double eps_coeff, double eps_el, double eps_relax_abs, double eps_relax_rel, double max_dyn, double min_viol, int max_supp_abs, double max_supp_rel, CleaningProcedure clean_proc, bool use_int_slacks, bool check_duplicates, bool integral_scale_cont, bool enforce_scaling) : CglParam(COIN_DBL_MAX, eps, eps_coeff, max_supp_abs), AWAY(away), EPS_ELIM(eps_el), EPS_RELAX_ABS(eps_relax_abs), EPS_RELAX_REL(eps_relax_rel), MAXDYN(max_dyn), MINVIOL(min_viol), MAX_SUPPORT_REL(max_supp_rel), CLEAN_PROC(clean_proc), USE_INTSLACKS(use_int_slacks), CHECK_DUPLICATES(check_duplicates), INTEGRAL_SCALE_CONT(integral_scale_cont), ENFORCE_SCALING(enforce_scaling) {} /***********************************************************************/ CglGMIParam::CglGMIParam(CglParam &source, double away, double eps_el, double eps_ra, double eps_rr, double max_dyn, double min_viol, double max_supp_rel, CleaningProcedure clean_proc, bool use_int_slacks, bool check_duplicates, bool integral_scale_cont, bool enforce_scaling) : CglParam(source), AWAY(away), EPS_ELIM(eps_el), EPS_RELAX_ABS(eps_ra), EPS_RELAX_REL(eps_rr), MAXDYN(max_dyn), MINVIOL(min_viol), MAX_SUPPORT_REL(max_supp_rel), CLEAN_PROC(clean_proc), USE_INTSLACKS(use_int_slacks), CHECK_DUPLICATES(check_duplicates), INTEGRAL_SCALE_CONT(integral_scale_cont), ENFORCE_SCALING(enforce_scaling) {} /***********************************************************************/ CglGMIParam::CglGMIParam(const CglGMIParam &source) : CglParam(source), AWAY(source.AWAY), EPS_ELIM(source.EPS_ELIM), EPS_RELAX_ABS(source.EPS_RELAX_ABS), EPS_RELAX_REL(source.EPS_RELAX_REL), MAXDYN(source.MAXDYN), MINVIOL(source.MINVIOL), MAX_SUPPORT_REL(source.MAX_SUPPORT_REL), CLEAN_PROC(source.CLEAN_PROC), USE_INTSLACKS(source.USE_INTSLACKS), CHECK_DUPLICATES(source.CHECK_DUPLICATES), INTEGRAL_SCALE_CONT(source.INTEGRAL_SCALE_CONT), ENFORCE_SCALING(source.ENFORCE_SCALING) {} /***********************************************************************/ CglGMIParam* CglGMIParam::clone() const { return new CglGMIParam(*this); } /***********************************************************************/ CglGMIParam& CglGMIParam::operator=(const CglGMIParam &rhs) { if(this != &rhs) { CglParam::operator=(rhs); AWAY = rhs.AWAY; EPS_ELIM = rhs.EPS_ELIM; EPS_RELAX_ABS = rhs.EPS_RELAX_ABS; EPS_RELAX_REL = rhs.EPS_RELAX_REL; MAXDYN = rhs.MAXDYN; MINVIOL = rhs.MINVIOL; MAX_SUPPORT_REL = rhs.MAX_SUPPORT_REL; CLEAN_PROC = rhs.CLEAN_PROC; USE_INTSLACKS = rhs.USE_INTSLACKS; CHECK_DUPLICATES = rhs.CHECK_DUPLICATES; INTEGRAL_SCALE_CONT = rhs.INTEGRAL_SCALE_CONT; ENFORCE_SCALING = rhs.ENFORCE_SCALING; } return *this; } /***********************************************************************/ CglGMIParam::~CglGMIParam() {} CoinMP-1.8.3/Cgl/src/CglGMI/CglGMI.hpp0000644000175000017500000002656112130104031015420 0ustar renerene// Last edit: 02/05/2013 // // Name: CglGMI.hpp // Author: Giacomo Nannicini // Singapore University of Technology and Design, Singapore // email: nannicini@sutd.edu.sg // Date: 11/17/09 //----------------------------------------------------------------------------- // Copyright (C) 2009, Giacomo Nannicini. All Rights Reserved. #ifndef CglGMI_H #define CglGMI_H #include "CglCutGenerator.hpp" #include "CglGMIParam.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinFactorization.hpp" /* Enable tracking of rejection of cutting planes. If this is disabled, the cut generator is slightly faster. If defined, it enables proper use of setTrackRejection and related functions. */ //#define TRACK_REJECT /* Debug output */ //#define GMI_TRACE /* Debug output: print optimal tableau */ //#define GMI_TRACETAB /* Print reason for cut rejection, whenever a cut is discarded */ //#define GMI_TRACE_CLEAN /** Gomory cut generator with several cleaning procedures, used to test * the numerical safety of the resulting cuts */ class CglGMI : public CglCutGenerator { friend void CglGMIUnitTest(const OsiSolverInterface * siP, const std::string mpdDir); public: /** Public enum: all possible reasons for cut rejection */ enum RejectionType{ failureFractionality, failureDynamism, failureViolation, failureSupport, failureScale }; /**@name generateCuts */ //@{ /** Generate Gomory Mixed-Integer cuts for the model of the solver interface si. Insert the generated cuts into OsiCuts cs. Warning: This generator currently works only with the Lp solvers Clp or Cplex9.0 or higher. It requires access to the optimal tableau and optimal basis inverse and makes assumptions on the way slack variables are added by the solver. The Osi implementations for Clp and Cplex verify these assumptions. When calling the generator, the solver interface si must contain an optimized problem and information related to the optimal basis must be available through the OsiSolverInterface methods (si->optimalBasisIsAvailable() must return 'true'). It is also essential that the integrality of structural variable i can be obtained using si->isInteger(i). */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /// Return true if needs optimal basis to do cuts (will return true) virtual bool needsOptimalBasis() const { return true; } //@} /**@name Common Methods */ //@{ // Function for checking equality with user tolerance inline bool areEqual(double x, double y, double epsAbs = 1e-12, double epsRel = 1e-12) { return (fabs((x) - (y)) <= std::max(epsAbs, epsRel * std::max(fabs(x), fabs(y)))); } // Function for checking is a number is zero inline bool isZero(double x, double epsZero = 1e-20) { return (fabs(x) <= epsZero); } // Function for checking if a number is integer inline bool isIntegerValue(double x, double intEpsAbs = 1e-9, double intEpsRel = 1e-15) { return (fabs((x) - floor((x)+0.5)) <= std::max(intEpsAbs, intEpsRel * fabs(x))); } //@} /**@name Public Methods */ //@{ // Set the parameters to the values of the given CglGMIParam object. void setParam(const CglGMIParam &source); // Return the CglGMIParam object of the generator. inline CglGMIParam getParam() const {return param;} inline CglGMIParam & getParam() {return param;} // Compute entries of is_integer. void computeIsInteger(); /// Print the current simplex tableau void printOptTab(OsiSolverInterface *solver) const; /// Set/get tracking of the rejection of cutting planes. /// Note that all rejection related functions will not do anything /// unless the generator is compiled with the define GMI_TRACK_REJECTION void setTrackRejection(bool value); bool getTrackRejection(); /// Get number of cuts rejected for given reason; see above int getNumberRejectedCuts(RejectionType reason); /// Reset counters for cut rejection tracking; see above void resetRejectionCounters(); /// Get total number of generated cuts since last resetRejectionCounters() int getNumberGeneratedCuts(); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglGMI(); /// Constructor with specified parameters CglGMI(const CglGMIParam ¶m); /// Copy constructor CglGMI(const CglGMI &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglGMI & operator=(const CglGMI& rhs); /// Destructor virtual ~CglGMI(); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} private: // Private member methods /**@name Private member methods */ //@{ // Method generating the cuts after all CglGMI members are properly set. void generateCuts(OsiCuts & cs); /// Compute the fractional part of value, allowing for small error. inline double aboveInteger(double value) const; /// Compute the fractionalities involved in the cut, and the cut rhs. /// Returns true if cut is accepted, false if discarded inline bool computeCutFractionality(double varRhs, double& cutRhs); /// Compute the cut coefficient on a given variable inline double computeCutCoefficient(double rowElem, int index); /// Use multiples of the initial inequalities to cancel out the coefficient /// on a slack variables. inline void eliminateSlack(double cutElem, int cutIndex, double* cut, double& cutRhs, const double *elements, const int *rowStart, const int *indices, const int *rowLength, const double *rhs); /// Change the sign of the coefficients of the non basic /// variables at their upper bound. inline void flip(double& rowElem, int rowIndex); /// Change the sign of the coefficients of the non basic /// variables at their upper bound and do the translations restoring /// the original bounds. Modify the right hand side /// accordingly. Two functions: one for original variables, one for slacks. inline void unflipOrig(double& rowElem, int rowIndex, double& rowRhs); inline void unflipSlack(double& rowElem, int rowIndex, double& rowRhs, const double* slack_val); /// Pack a row of ncol elements inline void packRow(double* row, double* rowElem, int* rowIndex, int& rowNz); /// Clean the cutting plane; the cleaning procedure does several things /// like removing small coefficients, scaling, and checks several /// acceptance criteria. If this returns false, the cut should be discarded. /// There are several cleaning procedures available, that can be selected /// via the parameter param.setCLEANING_PROCEDURE(int value) bool cleanCut(double* cutElem, int* cutIndex, int& cutNz, double& cutRhs, const double* xbar); /// Cut cleaning procedures: return true if successfull, false if /// cut should be discarded by the caller of if problems encountered /// Check the violation bool checkViolation(const double* cutElem, const int* cutIndex, int cutNz, double cutrhs, const double* xbar); /// Check the dynamism bool checkDynamism(const double* cutElem, const int* cutIndex, int cutNz); /// Check the support bool checkSupport(int cutNz); /// Remove small coefficients and adjust the rhs accordingly bool removeSmallCoefficients(double* cutElem, int* cutIndex, int& cutNz, double& cutRhs); /// Adjust the rhs by relaxing by a small amount (relative or absolute) void relaxRhs(double& rhs); /// Scale the cutting plane in different ways; /// scaling_type possible values: /// 0 : scale to obtain integral cut /// 1 : scale based on norm, to obtain cut norm equal to ncol /// 2 : scale to obtain largest coefficient equal to 1 bool scaleCut(double* cutElem, int* cutIndex, int cutNz, double& cutRhs, int scalingType); /// Scale the cutting plane in order to generate integral coefficients bool scaleCutIntegral(double* cutElem, int* cutIndex, int cutNz, double& cutRhs); /// Compute the nearest rational number; used by scale_row_integral bool nearestRational(double val, double maxdelta, long maxdnom, long& numerator, long& denominator); /// Compute the greatest common divisor long computeGcd(long a, long b); /// print a vector of integers void printvecINT(const char *vecstr, const int *x, int n) const; /// print a vector of doubles: dense form void printvecDBL(const char *vecstr, const double *x, int n) const; /// print a vector of doubles: sparse form void printvecDBL(const char *vecstr, const double *elem, const int * index, int nz) const; /// Recompute the simplex tableau for want of a better accuracy. /// Requires an empty CoinFactorization object to do the computations, /// and two empty (already allocated) arrays which will contain /// the basis indices on exit. Returns 0 if successfull. int factorize(CoinFactorization & factorization, int* colBasisIndex, int* rowBasisIndex); //@} // Private member data /**@name Private member data */ //@{ /// Object with CglGMIParam members. CglGMIParam param; /// Number of rows ( = number of slack variables) in the current LP. int nrow; /// Number of structural variables in the current LP. int ncol; /// Lower bounds for structural variables const double *colLower; /// Upper bounds for structural variables const double *colUpper; /// Lower bounds for constraints const double *rowLower; /// Upper bounds for constraints const double *rowUpper; /// Righ hand side for constraints (upper bound for ranged constraints). const double *rowRhs; /// Characteristic vectors of structural integer variables or continuous /// variables currently fixed to integer values. bool *isInteger; /// Current basis status: columns int *cstat; /// Current basis status: rows int *rstat; /// Pointer on solver. Reset by each call to generateCuts(). OsiSolverInterface *solver; /// Pointer on point to separate. Reset by each call to generateCuts(). const double *xlp; /// Pointer on row activity. Reset by each call to generateCuts(). const double *rowActivity; /// Pointer on matrix of coefficient ordered by rows. /// Reset by each call to generateCuts(). const CoinPackedMatrix *byRow; /// Pointer on matrix of coefficient ordered by columns. /// Reset by each call to generateCuts(). const CoinPackedMatrix *byCol; /// Fractionality of the cut and related quantities. double f0; double f0compl; double ratiof0compl; #if defined(TRACK_REJECT) || defined (TRACK_REJECT_SIMPLE) /// Should we track the reason of each cut rejection? bool trackRejection; /// Number of failures by type int fracFail; int dynFail; int violFail; int suppFail; int smallCoeffFail; int scaleFail; /// Total number of generated cuts int numGeneratedCuts; #endif //@} }; //############################################################################# /** A function that tests the methods in the CglGMI class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglGMIUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); #endif CoinMP-1.8.3/Cgl/src/CglGMI/CglGMI.cpp0000644000175000017500000012345212456230005015424 0ustar renerene// Last edit: 02/05/2013 // // Name: CglGMI.cpp // Author: Giacomo Nannicini // Singapore University of Technology and Design, Singapore // email: nannicini@sutd.edu.sg // Date: 11/17/09 //----------------------------------------------------------------------------- // Copyright (C) 2009, Giacomo Nannicini. All Rights Reserved. #include #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "OsiSolverInterface.hpp" #include "OsiRowCutDebugger.hpp" #include "CoinFactorization.hpp" #include "CglGMI.hpp" #include "CoinFinite.hpp" #include "CoinRational.hpp" //------------------------------------------------------------------- // Generate GMI cuts //------------------------------------------------------------------- /***************************************************************************/ CglGMI::CglGMI() : CglCutGenerator(), param(), nrow(0), ncol(0), colLower(NULL), colUpper(NULL), rowLower(NULL), rowUpper(NULL), rowRhs(NULL), isInteger(NULL), cstat(NULL), rstat(NULL), solver(NULL), xlp(NULL), rowActivity(NULL), byRow(NULL), byCol(NULL), f0(0.0), f0compl(0.0), ratiof0compl(0.0) #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE , trackRejection(false), fracFail(0), dynFail(0), violFail(0), suppFail(0), scaleFail(0), numGeneratedCuts(0) #endif { } /***************************************************************************/ CglGMI::CglGMI(const CglGMIParam ¶meters) : CglCutGenerator(), param(parameters), nrow(0), ncol(0), colLower(NULL), colUpper(NULL), rowLower(NULL), rowUpper(NULL), rowRhs(NULL), isInteger(NULL), cstat(NULL), rstat(NULL), solver(NULL), xlp(NULL), rowActivity(NULL), byRow(NULL), byCol(NULL), f0(0.0), f0compl(0.0), ratiof0compl(0.0) #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE , trackRejection(false), fracFail(0), dynFail(0), violFail(0), suppFail(0), scaleFail(0), numGeneratedCuts(0) #endif { } /***************************************************************************/ CglGMI::CglGMI(const CglGMI& rhs) : CglCutGenerator(rhs), param(rhs.param), nrow(rhs.nrow), ncol(rhs.ncol), colLower(rhs.colLower), colUpper(rhs.colUpper), rowLower(rhs.rowLower), rowUpper(rhs.rowUpper), rowRhs(rhs.rowRhs), isInteger(rhs.isInteger), cstat(rhs.cstat), rstat(rhs.rstat), solver(rhs.solver), xlp(rhs.xlp), rowActivity(rhs.rowActivity), byRow(rhs.byRow), byCol(rhs.byCol), f0(rhs.f0), f0compl(rhs.f0compl), ratiof0compl(rhs.ratiof0compl) #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE , trackRejection(rhs.trackRejection), fracFail(rhs.fracFail), dynFail(rhs.dynFail), violFail(rhs.violFail), suppFail(rhs.suppFail), scaleFail(rhs.scaleFail), numGeneratedCuts(rhs.numGeneratedCuts) #endif { } /***************************************************************************/ CglGMI & CglGMI::operator=(const CglGMI& rhs) { if(this != &rhs){ CglCutGenerator::operator=(rhs); param = rhs.param; nrow = rhs.nrow; ncol = rhs.ncol; colLower = rhs.colLower; colUpper = rhs.colUpper; rowLower = rhs.rowLower; rowUpper = rhs.rowUpper; rowRhs = rhs.rowRhs; isInteger = rhs.isInteger; cstat = rhs.cstat; rstat = rhs.rstat; solver = rhs.solver; xlp = rhs.xlp; rowActivity = rhs.rowActivity; byRow = rhs.byRow; byCol = rhs.byCol; f0 = rhs.f0; f0compl = rhs.f0compl; ratiof0compl = rhs.ratiof0compl; #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE trackRejection = rhs.trackRejection; fracFail = rhs.fracFail; dynFail = rhs.dynFail; violFail = rhs.violFail; suppFail = rhs.suppFail; scaleFail = rhs.scaleFail; numGeneratedCuts = rhs.numGeneratedCuts; #endif } return *this; } /***************************************************************************/ CglGMI::~CglGMI() { } /*********************************************************************/ CglCutGenerator * CglGMI::clone() const { return new CglGMI(*this); } /***************************************************************************/ // Returns (value - floor) inline double CglGMI::aboveInteger(double value) const { return (value - floor(value)); } /* aboveInteger */ /**********************************************************/ void CglGMI::printvecINT(const char *vecstr, const int *x, int n) const { int num, fromto, upto; num = (n/10) + 1; printf("%s :\n", vecstr); for (int j = 0; j < num; ++j) { fromto = 10*j; upto = 10 * (j+1); if(n <= upto) upto = n; for (int i = fromto; i < upto; ++i) printf(" %4d", x[i]); printf("\n"); } printf("\n"); } /* printvecINT */ /**********************************************************/ void CglGMI::printvecDBL(const char *vecstr, const double *x, int n) const { int num, fromto, upto; num = (n/10) + 1; printf("%s :\n", vecstr); for (int j = 0; j < num; ++j) { fromto = 10*j; upto = 10 * (j+1); if(n <= upto) upto = n; for (int i = fromto; i < upto; ++i) printf(" %7.3f", x[i]); printf("\n"); } printf("\n"); } /* printvecDBL */ /**********************************************************/ void CglGMI::printvecDBL(const char *vecstr, const double *elem, const int * index, int nz) const { printf("%s\n", vecstr); int written = 0; for (int j = 0; j < nz; ++j) { written += printf("%d:%.3f ", index[j], elem[j]); if (written > 70) { printf("\n"); written = 0; } } if (written > 0) { printf("\n"); } } /* printvecDBL */ /************************************************************************/ inline bool CglGMI::computeCutFractionality(double varRhs, double& cutRhs) { f0 = aboveInteger(varRhs); f0compl = 1 - f0; if (f0 < param.getAway() || f0compl < param.getAway()) return false; ratiof0compl = f0/f0compl; cutRhs = -f0; return true; } /* computeCutFractionality */ /************************************************************************/ inline double CglGMI::computeCutCoefficient(double rowElem, int index) { // See Wolsey "Integer Programming" (1998), p. 130, fourth line from top // after correcting typo (Proposition 8.8), flipping all signs to get <=. if (index < ncol && isInteger[index]) { double f = aboveInteger(rowElem); if(f > f0) { return (-((1-f) * ratiof0compl)); } else { return (-f); } } else{ if(rowElem < 0) { return (rowElem*ratiof0compl); } else { return (-rowElem); } } } /* computeCutCoefficient */ /************************************************************************/ inline void CglGMI::eliminateSlack(double cutElem, int index, double* cut, double& cutRhs, const double *elements, const int *rowStart, const int *indices, const int *rowLength, const double *rhs) { // now i is where coefficients on slack variables begin; // eliminate the slacks int rowpos = index - ncol; if(fabs(cutElem) > param.getEPS_ELIM()) { if (areEqual(rowLower[rowpos], rowUpper[rowpos], param.getEPS(), param.getEPS())) { // "almost" fixed slack, we'll just skip it return; } int upto = rowStart[rowpos] + rowLength[rowpos]; for (int j = rowStart[rowpos]; j < upto; ++j) { cut[indices[j]] -= cutElem * elements[j]; } cutRhs -= cutElem * rhs[rowpos]; } } /* eliminateSlack */ /************************************************************************/ inline void CglGMI::flip(double& rowElem, int index) { if ((index < ncol && cstat[index] == 2) || (index >= ncol && rstat[index-ncol] == 2)) { rowElem = -rowElem; } } /* flip */ /************************************************************************/ inline void CglGMI::unflipOrig(double& rowElem, int index, double& rowRhs) { if (cstat[index] == 2) { // structural variable at upper bound rowElem = -rowElem; rowRhs += rowElem*colUpper[index]; } else if (cstat[index] == 3) { // structural variable at lower bound rowRhs += rowElem*colLower[index]; } } /* unflipOrig */ /************************************************************************/ inline void CglGMI::unflipSlack(double& rowElem, int index, double& rowRhs, const double* slackVal) { if (rstat[index-ncol] == 2) { // artificial variable at upper bound rowElem = -rowElem; rowRhs += rowElem*slackVal[index-ncol]; } else if (rstat[index-ncol] == 3) { // artificial variable at lower bound rowRhs += rowElem*slackVal[index-ncol]; } } /* unflipSlack */ /************************************************************************/ inline void CglGMI::packRow(double* row, double* rowElem, int* rowIndex, int& rowNz) { rowNz = 0; for (int i = 0; i < ncol; ++i) { if (!isZero(fabs(row[i]))) { rowElem[rowNz] = row[i]; rowIndex[rowNz] = i; rowNz++; } } } /************************************************************************/ bool CglGMI::cleanCut(double* cutElem, int* cutIndex, int& cutNz, double& cutRhs, const double* xbar) { CglGMIParam::CleaningProcedure cleanProc = param.getCLEAN_PROC(); if (cleanProc == CglGMIParam::CP_CGLLANDP1) { if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } relaxRhs(cutRhs); removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedure CP_CGLLANDP1 */ else if (cleanProc == CglGMIParam::CP_CGLLANDP2) { if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } relaxRhs(cutRhs); if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!scaleCut(cutElem, cutIndex, cutNz, cutRhs, 1) && param.getENFORCE_SCALING()) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedure CP_CGLLANDP2 */ else if (cleanProc == CglGMIParam::CP_CGLREDSPLIT) { if (!scaleCut(cutElem, cutIndex, cutNz, cutRhs, 3) && param.getENFORCE_SCALING()) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } relaxRhs(cutRhs); } /* end of cleaning procedure CP_CGLREDSPLIT */ else if (cleanProc == CglGMIParam::CP_INTEGRAL_CUTS) { removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!scaleCut(cutElem, cutIndex, cutNz, cutRhs, 0) && param.getENFORCE_SCALING()) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedure CP_INTEGRAL_CUTS */ else if (cleanProc == CglGMIParam::CP_CGLLANDP1_INT) { if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } // scale cut so that it becomes integral, if possible if (!scaleCut(cutElem, cutIndex, cutNz, cutRhs, 0)) { if (param.getENFORCE_SCALING()){ #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } else { // If cannot scale to integral and not enforcing, relax rhs // (as per CglLandP cleaning procedure) relaxRhs(cutRhs); } } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedure CP_CGLLANDP1_INT */ else if (cleanProc == CglGMIParam::CP_CGLLANDP1_SCALEMAX || cleanProc == CglGMIParam::CP_CGLLANDP1_SCALERHS) { if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } if (// Try to scale cut, but do not discard if cannot scale ((cleanProc == CglGMIParam::CP_CGLLANDP1_SCALEMAX && !scaleCut(cutElem, cutIndex, cutNz, cutRhs, 1)) || (cleanProc == CglGMIParam::CP_CGLLANDP1_SCALERHS && !scaleCut(cutElem, cutIndex, cutNz, cutRhs, 2))) && param.getENFORCE_SCALING()) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } relaxRhs(cutRhs); removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedures CP_CGLLANDP1_SCALEMAX and CG_CGLLANDP1_SCALERHS */ return true; } /************************************************************************/ bool CglGMI::checkViolation(const double* cutElem, const int* cutIndex, int cutNz, double cutrhs, const double* xbar) { double lhs = 0.0; for (int i = 0; i < cutNz; ++i) { lhs += cutElem[i]*xbar[cutIndex[i]]; } double violation = lhs - cutrhs; if (fabs(cutrhs) > 1) { violation /= fabs(cutrhs); } if (violation >= param.getMINVIOL()) { return true; } else{ #if defined GMI_TRACE_CLEAN printf("Cut lhs %g, rhs %g, violation %g; cut discarded\n", lhs, cutrhs, violation); #endif return false; } } /* checkViolation */ /************************************************************************/ bool CglGMI::checkDynamism(const double* cutElem, const int* cutIndex, int cutNz) { double min = param.getINFINIT(); double max = 0.0; double val = 0.0; for (int i = 0; i < cutNz; ++i) { if (!isZero(cutElem[i])) { val = fabs(cutElem[i]); min = CoinMin(min, val); max = CoinMax(max, val); } } if (max > min*param.getMAXDYN()) { #if defined GMI_TRACE_CLEAN printf("Max elem %g, min elem %g, dyn %g; cut discarded\n", max, min, max/min); #endif return false; } else{ return true; } } /* checkDynamism */ /************************************************************************/ bool CglGMI::checkSupport(int cutNz) { if (cutNz > param.getMAX_SUPPORT_ABS() + param.getMAX_SUPPORT_REL()*ncol) { #if defined GMI_TRACE_CLEAN printf("Support %d; cut discarded\n", cutNz); #endif return false; } else{ return true; } } /************************************************************************/ bool CglGMI::removeSmallCoefficients(double* cutElem, int* cutIndex, int& cutNz, double& cutRhs) { double value, absval; int currPos = 0; int col; for (int i = 0; i < cutNz; ++i) { col = cutIndex[i]; value = cutElem[i]; absval = fabs(value); if (!isZero(absval) && absval <= param.getEPS_COEFF()) { // small coefficient: remove and adjust rhs if possible if ((value > 0.0) && (colLower[col] > -param.getINFINIT())) { cutRhs -= value * colLower[col]; } else if ((value < 0.0) && (colUpper[col] < param.getINFINIT())) { cutRhs -= value * colUpper[col]; } } else if (absval > param.getEPS_COEFF()) { if (currPos < i) { cutElem[currPos] = cutElem[i]; cutIndex[currPos] = cutIndex[i]; } currPos++; } } cutNz = currPos; return true; } /************************************************************************/ void CglGMI::relaxRhs(double& rhs) { if(param.getEPS_RELAX_REL() > 0.0) { rhs += fabs(rhs) * param.getEPS_RELAX_REL() + param.getEPS_RELAX_ABS(); } else{ rhs += param.getEPS_RELAX_ABS(); } } /************************************************************************/ bool CglGMI::scaleCut(double* cutElem, int* cutIndex, int cutNz, double& cutRhs, int scalingType) { /// scalingType possible values: /// 0 : scale to obtain integral cut /// 1 : scale to obtain largest coefficient equal to 1 /// 2 : scale to obtain rhs equal to 1 /// 3 : scale based on norm, to obtain cut norm equal to ncol /// Returns true if scaling is successful. if (scalingType == 0) { return scaleCutIntegral(cutElem, cutIndex, cutNz, cutRhs); } else if (scalingType == 1) { double max = fabs(cutRhs); for (int i = 0; i < cutNz; ++i) { if (!isZero(cutElem[i])) { max = CoinMax(max, fabs(cutElem[i])); } } if (max < param.getEPS() || max > param.getMAXDYN()) { #if defined GMI_TRACE_CLEAN printf("Scale %g; %g %g cut discarded\n", max, param.getEPS(), 1/param.getMAXDYN()); #endif return false; } else{ for (int i = 0; i < cutNz; ++i) { cutElem[i] /= max; } cutRhs /= max; return true; } } else if (scalingType == 2) { double max = fabs(cutRhs); if (max < param.getEPS() || max > param.getMAXDYN()) { #if defined GMI_TRACE_CLEAN printf("Scale %g; %g %g cut discarded\n", max, param.getEPS(), 1/param.getMAXDYN()); #endif return false; } else{ for (int i = 0; i < cutNz; ++i) { cutElem[i] /= max; } cutRhs /= max; return true; } } else if (scalingType == 3) { int support = 0; double norm = 0.0; for (int i = 0; i < cutNz; ++i) { if (!isZero(fabs(cutElem[i]))) { support++; norm += cutElem[i]*cutElem[i]; } } double scale = sqrt(norm / support); if ((scale < 0.02) || (scale > 100)) { #if defined GMI_TRACE_CLEAN printf("Scale %g; cut discarded\n", scale); #endif return false; } else{ for (int i = 0; i < cutNz; ++i) { cutElem[i] /= scale; } cutRhs /= scale; return true; } } return false; } /* scaleCut */ /************************************************************************/ bool CglGMI::scaleCutIntegral(double* cutElem, int* cutIndex, int cutNz, double& cutRhs) { long gcd, lcm; double maxdelta = param.getEPS(); double maxscale = 1000; long maxdnom = 1000; long numerator = 0, denominator = 0; // Initialize gcd and lcm CoinRational r = CoinRational(cutRhs, maxdelta, maxdnom); if (r.getNumerator() != 0){ gcd = labs(r.getNumerator()); lcm = r.getDenominator(); } else{ #if defined GMI_TRACE_CLEAN printf("Cannot compute rational number, scaling procedure aborted\n"); #endif return false; } for (int i = 0; i < cutNz; ++i) { if (solver->isContinuous(cutIndex[i]) && !param.getINTEGRAL_SCALE_CONT()) { continue; } CoinRational r = CoinRational(cutElem[i], maxdelta, maxdnom); if (r.getNumerator() != 0){ gcd = computeGcd(gcd, r.getNumerator()); lcm *= r.getDenominator()/(computeGcd(lcm,r.getDenominator())); } else{ #if defined GMI_TRACE_CLEAN printf("Cannot compute rational number, scaling procedure aborted\n"); #endif return false; } } double scale = ((double)lcm)/((double)gcd); if (fabs(scale) > maxscale) { #if defined GMI_TRACE_CLEAN printf("Scaling factor too large, scaling procedure aborted\n"); #endif return false; } // Looks like we have a good scaling factor; scale and return; for (int i = 0; i < cutNz; ++i) { cutElem[i] *= scale; } cutRhs *= scale; return true; } /* scaleCutIntegral */ /************************************************************************/ long CglGMI::computeGcd(long a, long b) { // This is the standard Euclidean algorithm for gcd long remainder = 1; // Make sure a<=b (will always remain so) if (a > b) { // Swap a and b long temp = a; a = b; b = temp; } // If zero then gcd is nonzero if (!a) { if (b) { return b; } else { printf("### WARNING: CglGMI::computeGcd() given two zeroes!\n"); exit(1); } } while (remainder) { remainder = b % a; b = a; a = remainder; } return b; } /* computeGcd */ /************************************************************************/ void CglGMI::generateCuts(const OsiSolverInterface &si, OsiCuts & cs, const CglTreeInfo ) { solver = const_cast(&si); if (solver == NULL) { printf("### WARNING: CglGMI::generateCuts(): no solver available.\n"); return; } if (!solver->optimalBasisIsAvailable()) { printf("### WARNING: CglGMI::generateCuts(): no optimal basis available.\n"); return; } #if defined OSI_TABLEAU if (!solver->canDoSimplexInterface()) { printf("### WARNING: CglGMI::generateCuts(): solver does not provide simplex tableau.\n"); printf("### WARNING: CglGMI::generateCuts(): recompile without OSI_TABLEAU.\n"); return; } #endif // Get basic problem information from solver ncol = solver->getNumCols(); nrow = solver->getNumRows(); colLower = solver->getColLower(); colUpper = solver->getColUpper(); rowLower = solver->getRowLower(); rowUpper = solver->getRowUpper(); rowRhs = solver->getRightHandSide(); xlp = solver->getColSolution(); rowActivity = solver->getRowActivity(); byRow = solver->getMatrixByRow(); byCol = solver->getMatrixByCol(); generateCuts(cs); } /* generateCuts */ /************************************************************************/ void CglGMI::generateCuts(OsiCuts &cs) { isInteger = new bool[ncol]; computeIsInteger(); cstat = new int[ncol]; rstat = new int[nrow]; solver->getBasisStatus(cstat, rstat); // 0: free 1: basic // 2: upper 3: lower #if defined GMI_TRACETAB printvecINT("cstat", cstat, ncol); printvecINT("rstat", rstat, nrow); #endif // list of basic integer fractional variables int *listFracBasic = new int[nrow]; int numFracBasic = 0; for (int i = 0; i < ncol; ++i) { // j is the variable which is basic in row i if ((cstat[i] == 1) && (isInteger[i])) { if (CoinMin(aboveInteger(xlp[i]), 1-aboveInteger(xlp[i])) > param.getAway()) { listFracBasic[numFracBasic] = i; numFracBasic++; } #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE else if (trackRejection) { // Say that we tried to generate a cut, but it was discarded // because of small fractionality if (!isIntegerValue(xlp[i])) { fracFail++; numGeneratedCuts++; } } #endif } } #if defined GMI_TRACE printf("CglGMI::generateCuts() : %d fractional rows\n", numFracBasic); #endif if (numFracBasic == 0) { delete[] listFracBasic; delete[] cstat; delete[] rstat; delete[] isInteger; return; } // there are rows with basic integer fractional variables, so we can // generate cuts // Basis index for columns and rows; each element is -1 if corresponding // variable is nonbasic, and contains the basis index if basic. // The basis index is the row in which the variable is basic. int* colBasisIndex = new int[ncol]; int* rowBasisIndex = new int[nrow]; #if defined OSI_TABLEAU memset(colBasisIndex, -1, ncol*sizeof(int)); memset(rowBasisIndex, -1, nrow*sizeof(int)); solver->enableFactorization(); int* basicVars = new int[nrow]; solver->getBasics(basicVars); for (int i = 0; i < nrow; ++i) { if (basicVars[i] < ncol) { colBasisIndex[basicVars[i]] = i; } else { rowBasisIndex[basicVars[i] - ncol] = i; } } #else CoinFactorization factorization; if (factorize(factorization, colBasisIndex, rowBasisIndex)) { printf("### WARNING: CglGMI::generateCuts(): error during factorization!\n"); return; } #endif // cut in sparse form double* cutElem = new double[ncol]; int* cutIndex = new int[ncol]; int cutNz = 0; double cutRhs; // cut in dense form double* cut = new double[ncol]; double *slackVal = new double[nrow]; for (int i = 0; i < nrow; ++i) { slackVal[i] = rowRhs[i] - rowActivity[i]; } #if defined OSI_TABLEAU // Column part and row part of a row of the simplex tableau double* tableauColPart = new double[ncol]; double* tableauRowPart = new double[nrow]; #else // Need some more data for simplex tableau computation const int * row = byCol->getIndices(); const CoinBigIndex * columnStart = byCol->getVectorStarts(); const int * columnLength = byCol->getVectorLengths(); const double * columnElements = byCol->getElements(); // Create work arrays for factorization // two vectors for updating: the first one is needed to do the computations // but we do not use it, the second one contains a row of the basis inverse CoinIndexedVector work; CoinIndexedVector array; // Make sure they large enough work.reserve(nrow); array.reserve(nrow); int * arrayRows = array.getIndices(); double * arrayElements = array.denseVector(); // End of code to create work arrays double one = 1.0; #endif // Matrix elements by row for slack substitution const double *elements = byRow->getElements(); const int *rowStart = byRow->getVectorStarts(); const int *indices = byRow->getIndices(); const int *rowLength = byRow->getVectorLengths(); // Indices of basic and slack variables, and cut elements int iBasic, slackIndex; double cutCoeff; double rowElem; // Now generate the cuts: obtain a row of the simplex tableau // where an integer variable is basic and fractional, and compute the cut for (int i = 0; i < numFracBasic; ++i) { if (!computeCutFractionality(xlp[listFracBasic[i]], cutRhs)) { // cut is discarded because of the small fractionalities involved #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { // Say that we tried to generate a cut, but it was discarded // because of small fractionality fracFail++; numGeneratedCuts++; } #endif continue; } // the variable listFracBasic[i] is basic in row iBasic iBasic = colBasisIndex[listFracBasic[i]]; #if defined GMI_TRACE printf("Row %d with var %d basic, f0 = %f\n", i, listFracBasic[i], f0); #endif #if defined OSI_TABLEAU solver->getBInvARow(iBasic, tableauColPart, tableauRowPart); #else array.clear(); array.setVector(1, &iBasic, &one); factorization.updateColumnTranspose (&work, &array); int numberInArray=array.getNumElements(); #endif // reset the cut memset(cut, 0, ncol*sizeof(double)); // columns for (int j = 0; j < ncol; ++j) { if ((colBasisIndex[j] >= 0) || (areEqual(colLower[j], colUpper[j], param.getEPS(), param.getEPS()))) { // Basic or fixed variable -- skip continue; } #ifdef OSI_TABLEAU rowElem = tableauColPart[j]; #else rowElem = 0.0; // add in row of tableau for (int h = columnStart[j]; h < columnStart[j]+columnLength[j]; ++h) { rowElem += columnElements[h]*arrayElements[row[h]]; } #endif if (!isZero(fabs(rowElem))) { // compute cut coefficient flip(rowElem, j); cutCoeff = computeCutCoefficient(rowElem, j); if (isZero(cutCoeff)) { continue; } unflipOrig(cutCoeff, j, cutRhs); cut[j] = cutCoeff; #if defined GMI_TRACE printf("var %d, row %f, cut %f\n", j, rowElem, cutCoeff); #endif } } // now do slacks part #if defined OSI_TABLEAU for (int j = 0 ; j < nrow; ++j) { // index of the row corresponding to the slack variable slackIndex = j; if (rowBasisIndex[j] >= 0) { // Basic variable -- skip it continue; } rowElem = tableauRowPart[j]; #else for (int j = 0 ; j < numberInArray ; ++j) { // index of the row corresponding to the slack variable slackIndex = arrayRows[j]; rowElem = arrayElements[slackIndex]; #endif if (!isZero(fabs(rowElem))) { slackIndex += ncol; // compute cut coefficient flip(rowElem, slackIndex); cutCoeff = computeCutCoefficient(rowElem, slackIndex); if (isZero(fabs(cutCoeff))) { continue; } unflipSlack(cutCoeff, slackIndex, cutRhs, slackVal); eliminateSlack(cutCoeff, slackIndex, cut, cutRhs, elements, rowStart, indices, rowLength, rowRhs); #if defined GMI_TRACE printf("var %d, row %f, cut %f\n", slackIndex, rowElem, cutCoeff); #endif } } packRow(cut, cutElem, cutIndex, cutNz); if (cutNz == 0) continue; #if defined GMI_TRACE printvecDBL("final cut:", cutElem, cutIndex, cutNz); printf("cutRhs: %f\n", cutRhs); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { numGeneratedCuts++; } #endif if (cleanCut(cutElem, cutIndex, cutNz, cutRhs, xlp) && cutNz > 0) { OsiRowCut rc; rc.setRow(cutNz, cutIndex, cutElem); rc.setLb(-param.getINFINIT()); rc.setUb(cutRhs); if (!param.getCHECK_DUPLICATES()) { cs.insert(rc); } else{ cs.insertIfNotDuplicate(rc, CoinAbsFltEq(param.getEPS_COEFF())); } } } #if defined GMI_TRACE printf("CglGMI::generateCuts() : number of cuts : %d\n", cs.sizeRowCuts()); #endif #if defined OSI_TABLEAU solver->disableFactorization(); delete[] basicVars; delete[] tableauColPart; delete[] tableauRowPart; #endif delete[] colBasisIndex; delete[] rowBasisIndex; delete[] cut; delete[] slackVal; delete[] cutElem; delete[] cutIndex; delete[] listFracBasic; delete[] cstat; delete[] rstat; delete[] isInteger; } /* generateCuts */ /***********************************************************************/ void CglGMI::setParam(const CglGMIParam &source) { param = source; } /* setParam */ /***********************************************************************/ void CglGMI::computeIsInteger() { for (int i = 0; i < ncol; ++i) { if(solver->isInteger(i)) { isInteger[i] = true; } else { if((areEqual(colLower[i], colUpper[i], param.getEPS(), param.getEPS())) && (isIntegerValue(colUpper[i]))) { // continuous variable fixed to an integer value isInteger[i] = true; } else { isInteger[i] = false; } } } } /* computeIsInteger */ /***********************************************************************/ void CglGMI::printOptTab(OsiSolverInterface *lclSolver) const { int *cstat = new int[ncol]; int *rstat = new int[nrow]; lclSolver->enableFactorization(); lclSolver->getBasisStatus(cstat, rstat); // 0: free 1: basic // 2: upper 3: lower int *basisIndex = new int[nrow]; // basisIndex[i] = // index of pivot var in row i // (slack if number >= ncol) lclSolver->getBasics(basisIndex); double *z = new double[ncol]; // workspace to get row of the tableau double *slack = new double[nrow]; // workspace to get row of the tableau double *slackVal = new double[nrow]; for (int i = 0; i < nrow; i++) { slackVal[i] = rowRhs[i] - rowActivity[i]; } const double *rc = lclSolver->getReducedCost(); const double *dual = lclSolver->getRowPrice(); const double *solution = lclSolver->getColSolution(); printvecINT("cstat", cstat, ncol); printvecINT("rstat", rstat, nrow); printvecINT("basisIndex", basisIndex, nrow); printvecDBL("solution", solution, ncol); printvecDBL("slackVal", slackVal, nrow); printvecDBL("reduced_costs", rc, ncol); printvecDBL("dual solution", dual, nrow); printf("Optimal Tableau:\n"); for (int i = 0; i < nrow; i++) { lclSolver->getBInvARow(i, z, slack); for (int ii = 0; ii < ncol; ++ii) { printf("%5.2f ", z[ii]); } printf(" | "); for (int ii = 0; ii < nrow; ++ii) { printf("%5.2f ", slack[ii]); } printf(" | "); if(basisIndex[i] < ncol) { printf("%5.2f ", solution[basisIndex[i]]); } else { printf("%5.2f ", slackVal[basisIndex[i]-ncol]); } printf("\n"); } for (int ii = 0; ii < 7*(ncol+nrow+1); ++ii) { printf("-"); } printf("\n"); for (int ii = 0; ii < ncol; ++ii) { printf("%5.2f ", rc[ii]); } printf(" | "); for (int ii = 0; ii < nrow; ++ii) { printf("%5.2f ", -dual[ii]); } printf(" | "); printf("%5.2f\n", -lclSolver->getObjValue()); lclSolver->disableFactorization(); delete[] cstat; delete[] rstat; delete[] basisIndex; delete[] slack; delete[] z; delete[] slackVal; } /* printOptTab */ /*********************************************************************/ // Create C++ lines to get to current state std::string CglGMI::generateCpp(FILE * fp) { CglGMI other; fprintf(fp,"0#include \"CglGMI.hpp\"\n"); fprintf(fp,"3 CglGMI GMI;\n"); if (param.getMAX_SUPPORT()!=other.param.getMAX_SUPPORT()) fprintf(fp,"3 GMI.setLimit(%d);\n",param.getMAX_SUPPORT()); else fprintf(fp,"4 GMI.setLimit(%d);\n",param.getMAX_SUPPORT()); if (param.getAway()!=other.param.getAway()) fprintf(fp,"3 GMI.setAway(%g);\n",param.getAway()); else fprintf(fp,"4 GMI.setAway(%g);\n",param.getAway()); if (param.getEPS()!=other.param.getEPS()) fprintf(fp,"3 GMI.setEPS(%g);\n",param.getEPS()); else fprintf(fp,"4 GMI.setEPS(%g);\n",param.getEPS()); if (param.getEPS_COEFF()!=other.param.getEPS_COEFF()) fprintf(fp,"3 GMI.setEPS_COEFF(%g);\n",param.getEPS_COEFF()); else fprintf(fp,"4 GMI.set.EPS_COEFF(%g);\n",param.getEPS_COEFF()); if (param.getEPS_RELAX_ABS()!=other.param.getEPS_RELAX_ABS()) fprintf(fp,"3 GMI.set.EPS_RELAX(%g);\n",param.getEPS_RELAX_ABS()); else fprintf(fp,"4 GMI.set.EPS_RELAX(%g);\n",param.getEPS_RELAX_ABS()); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 GMI.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 GMI.setAggressiveness(%d);\n",getAggressiveness()); return "GMI"; } /*********************************************************************/ int CglGMI::factorize(CoinFactorization & factorization, int* colBasisIndex, int* rowBasisIndex) { // Start of code to create a factorization from warm start ==== // Taken (with small modifications) from CglGomory int status=-100; for (int i = 0; i < nrow; ++i) { if (rstat[i] == 1) { rowBasisIndex[i]=1; } else { rowBasisIndex[i]=-1; } } for (int i = 0; i < ncol; ++i) { if (cstat[i] == 1) { colBasisIndex[i]=1; } else { colBasisIndex[i]=-1; } } // returns 0 if okay, -1 singular, -2 too many in basis, -99 memory */ while (status<-98) { status=factorization.factorize(*byCol, rowBasisIndex, colBasisIndex); if (status==-99) factorization.areaFactor(factorization.areaFactor()*2.0); } if (status) { return -1; } #if defined GMI_TRACE double condition = 0.0; const CoinFactorizationDouble * pivotRegion = factorization.pivotRegion(); for (int i = 0; i < nrow; ++i) { condition += log(fabs(pivotRegion[i])); } printf("CglGMI::factorize(): condition number recomputed as sum of log: %g\n", (condition)); #endif return 0; } /*********************************************************************/ void CglGMI::setTrackRejection(bool value) { #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE trackRejection = value; if (trackRejection) { // reset data members resetRejectionCounters(); } #endif } /*********************************************************************/ bool CglGMI::getTrackRejection() { #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE return trackRejection; #else return false; #endif } /*********************************************************************/ void CglGMI::resetRejectionCounters() { #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE fracFail = 0; dynFail = 0; violFail = 0; suppFail = 0; scaleFail = 0; numGeneratedCuts = 0; #endif } /*********************************************************************/ int CglGMI::getNumberRejectedCuts(RejectionType reason) { #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE switch (reason) { case failureFractionality: return fracFail; case failureDynamism: return dynFail; case failureViolation: return violFail; case failureSupport: return suppFail; case failureScale: return scaleFail; } return 0; #else return 0; #endif } /*********************************************************************/ int CglGMI::getNumberGeneratedCuts() { #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE return numGeneratedCuts; #else return 0; #endif } CoinMP-1.8.3/Cgl/src/CglGMI/CglGMIParam.hpp0000644000175000017500000002704712130104031016401 0ustar renerene// Name: CglGMIParam.hpp // Author: Giacomo Nannicini // Singapore University of Technology and Design // email: nannicini@sutd.edu.sg // based on CglRedSplitParam.hpp by Francois Margot // Date: 11/17/09 //----------------------------------------------------------------------------- // Copyright (C) 2009, Giacomo Nannicini and others. All Rights Reserved. #ifndef CglGMIParam_H #define CglGMIParam_H #include "CglParam.hpp" /**@name CglGMI Parameters */ //@{ /** Class collecting parameters for the GMI cut generator. Parameters of the generator are listed below. Modifying the default values for parameters other than the last four might result in invalid cuts. - MAXDYN: Maximum ratio between largest and smallest non zero coefficients in a cut. See method setMAXDYN(). - EPS_ELIM: Precision for deciding if a coefficient is zero when eliminating slack variables. See method setEPS_ELIM(). - MINVIOL: Minimum violation for the current basic solution in a generated cut. See method setMINVIOL(). - USE_INTSLACKS: Use integer slacks to generate cuts. (not implemented yet, will be in the future). See method setUSE_INTSLACKS(). - AWAY: Look only at basic integer variables whose current value is at least this value away from being integer. See method setAway(). - CHECK_DUPLICATES: Should we check for duplicates when adding a cut to the collection? Can be slow. Default 0 - do not check, add cuts anyway. - CLEAN_PROC: Cleaning procedure that should be used. Look below at the enumeration CleaningProcedure for possible values. - INTEGRAL_SCALE_CONT: If we try to scale cut coefficients so that they become integral, do we also scale on continuous variables? Default 0 - do not scale continuous vars. Used only if CLEAN_PROC does integral scaling. - ENFORCE_SCALING: Discard badly scaled cuts, or keep them (unscaled). Default 1 - yes. */ //@} class CglGMIParam : public CglParam { public: /**@name Enumerations */ enum CleaningProcedure{ /* CglLandP procedure I */ CP_CGLLANDP1, /* CglLandP procedure II */ CP_CGLLANDP2, /* CglRedSplit procedure I */ CP_CGLREDSPLIT, /* Only integral cuts, i.e. cuts with integral coefficients */ CP_INTEGRAL_CUTS, /* CglLandP procedure I with integral scaling */ CP_CGLLANDP1_INT, /* CglLandP procedure I with scaling of the max element to 1 if possible */ CP_CGLLANDP1_SCALEMAX, /* CglLandP procedure I with scaling of the rhs to 1 if possible */ CP_CGLLANDP1_SCALERHS }; /**@name Set/get methods */ //@{ /** Aliases for parameter get/set method in the base class CglParam */ /** Value for Infinity. Default: DBL_MAX */ inline void setInfinity(double value) {setINFINIT(value);} inline double getInfinity() const {return INFINIT;} /** Epsilon for comparing numbers. Default: 1.0e-6 */ inline void setEps(double value) {setEPS(value);} inline double getEps() const {return EPS;} /** Epsilon for zeroing out coefficients. Default: 1.0e-5 */ inline void setEpsCoeff(double value) {setEPS_COEFF(value);} inline double getEpsCoeff() const {return EPS_COEFF;} /** Maximum support of the cutting planes. Default: INT_MAX */ inline void setMaxSupport(int value) {setMAX_SUPPORT(value);} inline int getMaxSupport() const {return MAX_SUPPORT;} /** Alias for consistency with our naming scheme */ inline void setMaxSupportAbs(int value) {setMAX_SUPPORT(value);} inline int getMaxSupportAbs() const {return MAX_SUPPORT;} inline int getMAX_SUPPORT_ABS() const {return MAX_SUPPORT;} /** Set AWAY, the minimum distance from being integer used for selecting rows for cut generation; all rows whose pivot variable should be integer but is more than away from integrality will be selected; Default: 0.005 */ virtual void setAway(double value); /** Get value of away */ inline double getAway() const {return AWAY;} /// Aliases inline void setAWAY(double value) {setAway(value);} inline double getAWAY() const {return AWAY;} /** Set the value of EPS_ELIM, epsilon for values of coefficients when eliminating slack variables; Default: 0 */ virtual void setEPS_ELIM(double value); /** Get the value of EPS_ELIM */ inline double getEPS_ELIM() const {return EPS_ELIM;} /// Aliases inline void setEpsElim(double value) {setEPS_ELIM(value);} inline double getEpsElim() const {return EPS_ELIM;} /** Set EPS_RELAX_ABS */ virtual void setEPS_RELAX_ABS(double value); /** Get value of EPS_RELAX_ABS */ inline double getEPS_RELAX_ABS() const {return EPS_RELAX_ABS;} /// Aliases inline void setEpsRelaxAbs(double value) {setEPS_RELAX_ABS(value);} inline double getEpsRelaxAbs() const {return EPS_RELAX_ABS;} /** Set EPS_RELAX_REL */ virtual void setEPS_RELAX_REL(double value); /** Get value of EPS_RELAX_REL */ inline double getEPS_RELAX_REL() const {return EPS_RELAX_REL;} /// Aliases inline void setEpsRelaxRel(double value) {setEPS_RELAX_REL(value);} inline double getEpsRelaxRel() const {return EPS_RELAX_REL;} // Set the maximum ratio between largest and smallest non zero // coefficients in a cut. Default: 1e6. virtual void setMAXDYN(double value); /** Get the value of MAXDYN */ inline double getMAXDYN() const {return MAXDYN;} /// Aliases inline void setMaxDyn(double value) {setMAXDYN(value);} inline double getMaxDyn() const {return MAXDYN;} /** Set the value of MINVIOL, the minimum violation for the current basic solution in a generated cut. Default: 1e-7 */ virtual void setMINVIOL(double value); /** Get the value of MINVIOL */ inline double getMINVIOL() const {return MINVIOL;} /// Aliases inline void setMinViol(double value) {setMINVIOL(value);} inline double getMinViol() const {return MINVIOL;} /** Set the value of MAX_SUPPORT_REL, the factor contributing to the maximum support relative to the number of columns. Maximum allowed support is: MAX_SUPPORT_ABS + MAX_SUPPORT_REL*ncols. Default: 0.1 */ virtual void setMAX_SUPPORT_REL(double value); /** Get the value of MINVIOL */ inline double getMAX_SUPPORT_REL() const {return MAX_SUPPORT_REL;} /// Aliases inline void setMaxSupportRel(double value) {setMAX_SUPPORT_REL(value);} inline double getMaxSupportRel() const {return MAX_SUPPORT_REL;} /** Set the value of USE_INTSLACKS. Default: 0 */ virtual void setUSE_INTSLACKS(bool value); /** Get the value of USE_INTSLACKS */ inline bool getUSE_INTSLACKS() const {return USE_INTSLACKS;} /// Aliases inline void setUseIntSlacks(bool value) {setUSE_INTSLACKS(value);} inline int getUseIntSlacks() const {return USE_INTSLACKS;} /** Set the value of CHECK_DUPLICATES. Default: 0 */ virtual void setCHECK_DUPLICATES(bool value); /** Get the value of CHECK_DUPLICATES */ inline bool getCHECK_DUPLICATES() const {return CHECK_DUPLICATES;} /// Aliases inline void setCheckDuplicates(bool value) {setCHECK_DUPLICATES(value);} inline bool getCheckDuplicates() const {return CHECK_DUPLICATES;} /** Set the value of CLEAN_PROC. Default: CP_CGLLANDP1 */ virtual void setCLEAN_PROC(CleaningProcedure value); /** Get the value of CLEAN_PROC. */ inline CleaningProcedure getCLEAN_PROC() const {return CLEAN_PROC;} /// Aliases inline void setCleanProc(CleaningProcedure value) {setCLEAN_PROC(value);} inline CleaningProcedure getCleaningProcedure() const {return CLEAN_PROC;} /** Set the value of INTEGRAL_SCALE_CONT. Default: 0 */ virtual void setINTEGRAL_SCALE_CONT(bool value); /** Get the value of INTEGRAL_SCALE_CONT. */ inline bool getINTEGRAL_SCALE_CONT() const {return INTEGRAL_SCALE_CONT;} /// Aliases inline void setIntegralScaleCont(bool value) {setINTEGRAL_SCALE_CONT(value);} inline bool getIntegralScaleCont() const {return INTEGRAL_SCALE_CONT;} /** Set the value of ENFORCE_SCALING. Default: 1 */ virtual void setENFORCE_SCALING(bool value); /** Get the value of ENFORCE_SCALING. */ inline bool getENFORCE_SCALING() const {return ENFORCE_SCALING;} /// Aliases inline void setEnforceScaling(bool value) {setENFORCE_SCALING(value);} inline bool getEnforcescaling() const {return ENFORCE_SCALING;} //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglGMIParam(double eps = 1e-12, double away = 0.005, double eps_coeff = 1e-11, double eps_elim = 0, double eps_relax_abs = 1e-11, double eps_relax_rel = 1e-13, double max_dyn = 1e6, double min_viol = 1e-4, int max_supp_abs = 1000, double max_supp_rel = 0.1, CleaningProcedure clean_proc = CP_CGLLANDP1, bool use_int_slacks = false, bool check_duplicates = false, bool integral_scale_cont = false, bool enforce_scaling = true); /// Constructor from CglParam CglGMIParam(CglParam &source, double away = 0.005, double eps_elim = 1e-12, double eps_relax_abs = 1e-11, double eps_relax_rel = 1e-13, double max_dyn = 1e6, double min_viol = 1e-4, double max_supp_rel = 0.1, CleaningProcedure clean_proc = CP_CGLLANDP1, bool use_int_slacks = false, bool check_duplicates = false, bool integral_scale_cont = false, bool enforce_scaling = true); /// Copy constructor CglGMIParam(const CglGMIParam &source); /// Clone virtual CglGMIParam* clone() const; /// Assignment operator virtual CglGMIParam& operator=(const CglGMIParam &rhs); /// Destructor virtual ~CglGMIParam(); //@} protected: /**@name Parameters */ //@{ /** Use row only if pivot variable should be integer but is more than AWAY from being integer. */ double AWAY; /** Epsilon for value of coefficients when eliminating slack variables. Default: 0. */ double EPS_ELIM; /** Value added to the right hand side of each generated cut to relax it. Default: 1e-11 */ double EPS_RELAX_ABS; /** For a generated cut with right hand side rhs_val, EPS_RELAX_EPS * fabs(rhs_val) is used to relax the constraint. Default: 1.e-13 */ double EPS_RELAX_REL; /** Maximum ratio between largest and smallest non zero coefficients in a cut. Default: 1e6. */ double MAXDYN; /** Minimum violation for the current basic solution in a generated cut. Default: 1e-4. */ double MINVIOL; /** Maximum support relative to number of columns. Must be between 0 and 1. Default: 0. */ double MAX_SUPPORT_REL; /** Which cleaning procedure should be used? */ CleaningProcedure CLEAN_PROC; /** Use integer slacks to generate cuts if USE_INTSLACKS = 1. Default: 0. */ bool USE_INTSLACKS; /** Check for duplicates when adding the cut to the collection? */ bool CHECK_DUPLICATES; /** Should we try to rescale cut coefficients on continuous variables so that they become integral, or do we only rescale coefficients on integral variables? Used only by cleaning procedure that try the integral scaling. */ bool INTEGRAL_SCALE_CONT; /** Should we discard badly scaled cuts (according to the scaling procedure in use)? If false, CglGMI::scaleCut always returns true, even though it still scales cuts whenever possible, but not cut is rejected for scaling. Default true. Used only by cleaning procedure that try to scale. */ bool ENFORCE_SCALING; //@} }; #endif CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding/0000755000175000017500000000000012600453456017335 5ustar renereneCoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding/Makefile.in0000644000175000017500000005510112506321416021377 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglMixedIntegerRounding DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglMixedIntegerRounding_la_LIBADD = am_libCglMixedIntegerRounding_la_OBJECTS = CglMixedIntegerRounding.lo \ CglMixedIntegerRoundingTest.lo libCglMixedIntegerRounding_la_OBJECTS = \ $(am_libCglMixedIntegerRounding_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglMixedIntegerRounding_la_SOURCES) DIST_SOURCES = $(libCglMixedIntegerRounding_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglMixedIntegerRounding # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglMixedIntegerRounding.la # List all source files for this library, including headers libCglMixedIntegerRounding_la_SOURCES = CglMixedIntegerRounding.cpp CglMixedIntegerRounding.hpp CglMixedIntegerRoundingTest.cpp # This is for libtool (on Windows) libCglMixedIntegerRounding_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglMixedIntegerRounding.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglMixedIntegerRounding/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglMixedIntegerRounding/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglMixedIntegerRounding.la: $(libCglMixedIntegerRounding_la_OBJECTS) $(libCglMixedIntegerRounding_la_DEPENDENCIES) $(CXXLINK) $(libCglMixedIntegerRounding_la_LDFLAGS) $(libCglMixedIntegerRounding_la_OBJECTS) $(libCglMixedIntegerRounding_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglMixedIntegerRounding.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglMixedIntegerRoundingTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding/CglMixedIntegerRounding.hpp0000644000175000017500000003213112130102162024545 0ustar renerene// LAST EDIT: //----------------------------------------------------------------------------- // name: Mixed Integer Rounding Cut Generator // authors: Joao Goncalves (jog7@lehigh.edu) // Laszlo Ladanyi (ladanyi@us.ibm.com) // date: August 11, 2004 //----------------------------------------------------------------------------- // Copyright (C) 2004, International Business Machines Corporation and others. // All Rights Reserved. // This code is published under the Eclipse Public License. #ifndef CglMixedIntegerRounding_H #define CglMixedIntegerRounding_H #include #include //#include #include "CoinError.hpp" #include "CglCutGenerator.hpp" //============================================================================= #ifndef CGL_DEBUG #define CGL_DEBUG 0 #endif //============================================================================= // Class to store variable upper bounds (VUB) class CglMixIntRoundVUB { // Variable upper bounds have the form x_j <= a y_j, where x_j is // a continuous variable and y_j is an integer variable protected: int var_; // The index of y_j double val_; // The value of a public: // Default constructor CglMixIntRoundVUB() : var_(-1), val_(-1) {} // Copy constructor CglMixIntRoundVUB(const CglMixIntRoundVUB& source) { var_ = source.var_; val_ = source.val_; } // Assignment operator CglMixIntRoundVUB& operator=(const CglMixIntRoundVUB& rhs) { if (this != &rhs) { var_ = rhs.var_; val_ = rhs.val_; } return *this; } // Destructor ~CglMixIntRoundVUB() {} // Query and set functions int getVar() const { return var_; } double getVal() const { return val_; } void setVar(const int v) { var_ = v; } void setVal(const double v) { val_ = v; } }; //============================================================================= // Class to store variable lower bounds (VLB). // It is the same as the class to store variable upper bounds typedef CglMixIntRoundVUB CglMixIntRoundVLB; //============================================================================= /** Mixed Integer Rounding Cut Generator Class */ // Reference: // Hugues Marchand and Laurence A. Wolsey // Aggregation and Mixed Integer Rounding to Solve MIPs // Operations Research, 49(3), May-June 2001. // Also published as CORE Dicusion Paper 9839, June 1998. class CglMixedIntegerRounding : public CglCutGenerator { friend void CglMixedIntegerRoundingUnitTest(const OsiSolverInterface * siP, const std::string mpdDir); private: //--------------------------------------------------------------------------- // Enumeration constants that describe the various types of rows enum RowType { // The row type of this row is NOT defined yet. ROW_UNDEFINED, /** After the row is flipped to 'L', the row has exactly two variables: one is negative binary and the other is a continous, and the RHS is zero.*/ ROW_VARUB, /** After the row is flipped to 'L', the row has exactly two variables: one is positive binary and the other is a continous, and the RHS is zero.*/ ROW_VARLB, /** The row sense is 'E', the row has exactly two variables: one is binary and the other is a continous, and the RHS is zero.*/ ROW_VAREQ, // The row contains continuous and integer variables; // the total number of variables is at least 2 ROW_MIX, // The row contains only continuous variables ROW_CONT, // The row contains only integer variables ROW_INT, // The row contains other types of rows ROW_OTHER }; public: /**@name Generate Cuts */ //@{ /** Generate Mixed Integer Rounding cuts for the model data contained in si. The generated cuts are inserted in the collection of cuts cs. */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} //--------------------------------------------------------------------------- /**@name Constructors and destructors */ //@{ /// Default constructor CglMixedIntegerRounding (); /// Alternate Constructor CglMixedIntegerRounding (const int maxaggr, const bool multiply, const int criterion, const int preproc = -1); /// Copy constructor CglMixedIntegerRounding ( const CglMixedIntegerRounding &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglMixedIntegerRounding & operator=( const CglMixedIntegerRounding& rhs); /// Destructor virtual ~CglMixedIntegerRounding (); /// This can be used to refresh any inforamtion virtual void refreshSolver(OsiSolverInterface * solver); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} //--------------------------------------------------------------------------- /**@name Set and get methods */ //@{ /// Set MAXAGGR_ inline void setMAXAGGR_ (int maxaggr) { if (maxaggr > 0) { MAXAGGR_ = maxaggr; } else { throw CoinError("Unallowable value. maxaggr must be > 0", "gutsOfConstruct","CglMixedIntegerRounding"); } } /// Get MAXAGGR_ inline int getMAXAGGR_ () const { return MAXAGGR_; } /// Set MULTIPLY_ inline void setMULTIPLY_ (bool multiply) { MULTIPLY_ = multiply; } /// Get MULTIPLY_ inline bool getMULTIPLY_ () const { return MULTIPLY_; } /// Set CRITERION_ inline void setCRITERION_ (int criterion) { if ((criterion >= 1) && (criterion <= 3)) { CRITERION_ = criterion; } else { throw CoinError("Unallowable value. criterion must be 1, 2 or 3", "gutsOfConstruct","CglMixedIntegerRounding"); } } /// Get CRITERION_ inline int getCRITERION_ () const { return CRITERION_; } /// Set doPreproc void setDoPreproc(int value); /// Get doPreproc bool getDoPreproc() const; //@} private: //-------------------------------------------------------------------------- // Private member methods // Construct void gutsOfConstruct (const int maxaggr, const bool multiply, const int criterion, const int preproc); // Delete void gutsOfDelete(); // Copy void gutsOfCopy (const CglMixedIntegerRounding& rhs); // Do preprocessing. // It determines the type of each row. It also identifies the variable // upper bounds and variable lower bounds. // It may change sense and RHS for ranged rows void mixIntRoundPreprocess(const OsiSolverInterface& si); // Determine the type of a given row. RowType determineRowType(const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const char sense, const double rhs) const; // Generate MIR cuts void generateMirCuts( const OsiSolverInterface& si, const double* xlp, const double* colUpperBound, const double* colLowerBound, const CoinPackedMatrix& matrixByRow, const double* LHS, const double* coefByRow, const int* colInds, const int* rowStarts, const int* rowLengths, //const CoinPackedMatrix& matrixByCol, const double* coefByCol, const int* rowInds, const int* colStarts, const int* colLengths, OsiCuts& cs ) const; // Copy row selected to CoinPackedVector void copyRowSelected( const int iAggregate, const int rowSelected, std::set& setRowsAggregated, int* listRowsAggregated, double* xlpExtra, const char sen, const double rhs, const double lhs, const CoinPackedMatrix& matrixByRow, CoinPackedVector& rowToAggregate, double& rhsToAggregate) const; // Select a row to aggregate bool selectRowToAggregate( const OsiSolverInterface& si, const CoinPackedVector& rowAggregated, const double* colUpperBound, const double* colLowerBound, const std::set& setRowsAggregated, const double* xlp, const double* coefByCol, const int* rowInds, const int* colStarts, const int* colLengths, int& rowSelected, int& colSelected ) const; // Aggregation heuristic. // Combines one or more rows of the original matrix void aggregateRow( const int colSelected, CoinPackedVector& rowToAggregate, double rhs, CoinPackedVector& rowAggregated, double& rhsAggregated ) const; // Choose the bound substitution based on the criteria defined by the user inline bool isLowerSubst(const double inf, const double aj, const double xlp, const double LB, const double UB) const; // Bound substitution heuristic bool boundSubstitution( const OsiSolverInterface& si, const CoinPackedVector& rowAggregated, const double* xlp, const double* xlpExtra, const double* colUpperBound, const double* colLowerBound, CoinPackedVector& mixedKnapsack, double& rhsMixedKnapsack, double& sStar, CoinPackedVector& contVariablesInS ) const; // c-MIR separation heuristic bool cMirSeparation ( const OsiSolverInterface& si, const CoinPackedMatrix& matrixByRow, const CoinPackedVector& rowAggregated, const int* listRowsAggregated, const char* sense, const double* RHS, //const double* coefByRow, //const int* colInds, const int* rowStarts, //const int* rowLengths, const double* xlp, const double sStar, const double* colUpperBound, const double* colLowerBound, const CoinPackedVector& mixedKnapsack, const double& rhsMixedKnapsack, const CoinPackedVector& contVariablesInS, OsiRowCut& flowCut ) const; // function to create one c-MIR inequality void cMirInequality( const int numInt, const double delta, const double numeratorBeta, const int *knapsackIndices, const double* knapsackElements, const double* xlp, const double sStar, const double* colUpperBound, const std::set& setC, CoinPackedVector& cMIR, double& rhscMIR, double& sCoef, double& violation) const; // function to compute G inline double functionG( const double d, const double f ) const; // function to print statistics (used only in debug mode) void printStats( std::ofstream & fout, const bool hasCut, const OsiSolverInterface& si, const CoinPackedVector& rowAggregated, const double& rhsAggregated, const double* xlp, const double* xlpExtra, const int* listRowsAggregated, const int* listColsSelected, const int level, const double* colUpperBound, const double* colLowerBound ) const; private: //--------------------------------------------------------------------------- // Private member data // Maximum number of rows to aggregate int MAXAGGR_; // Flag that indicates if an aggregated row is also multiplied by -1 bool MULTIPLY_; // The criterion to use in the bound substitution int CRITERION_; // Tolerance used for numerical purposes double EPSILON_; /// There is no variable upper bound or variable lower bound defined int UNDEFINED_; // If violation of a cut is greater that this number, the cut is accepted double TOLERANCE_; /** Controls the preprocessing of the matrix to identify rows suitable for cut generation.
    • -1: preprocess according to solver settings;
    • 0: Do preprocessing only if it has not yet been done;
    • 1: Do preprocessing.
    Default value: -1 **/ int doPreproc_; // The number of rows of the problem. int numRows_; // The number columns of the problem. int numCols_; // Indicates whether preprocessing has been done. bool doneInitPre_; // The array of CglMixIntRoundVUBs. CglMixIntRoundVUB* vubs_; // The array of CglMixIntRoundVLBs. CglMixIntRoundVLB* vlbs_; // Array with the row types of the rows in the model. RowType* rowTypes_; // The indices of the rows of the initial matrix int* indRows_; // The number of rows of type ROW_MIX int numRowMix_; // The indices of the rows of type ROW_MIX int* indRowMix_; // The number of rows of type ROW_CONT int numRowCont_; // The indices of the rows of type ROW_CONT int* indRowCont_; // The number of rows of type ROW_INT int numRowInt_; // The indices of the rows of type ROW_INT int* indRowInt_; // The number of rows of type ROW_CONT that have at least one variable // with variable upper or lower bound int numRowContVB_; // The indices of the rows of type ROW_CONT that have at least one variable // with variable upper or lower bound int* indRowContVB_; // Sense of rows (modified if ranges) char * sense_; // RHS of rows (modified if ranges) double * RHS_; }; //############################################################################# // A function that tests the methods in the CglMixedIntegerRounding class. The // only reason for it not to be a member method is that this way it doesn't // have to be compiled into the library. And that's a gain, because the // library should be compiled with optimization on, but this method should be // compiled with debugging. void CglMixedIntegerRoundingUnitTest(const OsiSolverInterface * siP, const std::string mpdDir); #endif CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding/Makefile.am0000644000175000017500000000333611621724114021370 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglMixedIntegerRounding # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglMixedIntegerRounding.la # List all source files for this library, including headers libCglMixedIntegerRounding_la_SOURCES = CglMixedIntegerRounding.cpp CglMixedIntegerRounding.hpp CglMixedIntegerRoundingTest.cpp # This is for libtool (on Windows) libCglMixedIntegerRounding_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglMixedIntegerRounding.hpp CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding/CglMixedIntegerRoundingTest.cpp0000644000175000017500000000472412130104031025404 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglMixedIntegerRounding.hpp" void CglMixedIntegerRoundingUnitTest(const OsiSolverInterface *baseSiP, const std::string mpsDir) { // Test default constructor { CglMixedIntegerRounding aGenerator; } // Test copy & assignment { CglMixedIntegerRounding rhs; { CglMixedIntegerRounding bGenerator; CglMixedIntegerRounding cGenerator(bGenerator); rhs=bGenerator; } } // Test get/set methods { CglMixedIntegerRounding getset; int gagg = 10 * getset.getMAXAGGR_(); getset.setMAXAGGR_(gagg); int gagg2 = getset.getMAXAGGR_(); assert(gagg == gagg2); bool gmult = !getset.getMULTIPLY_(); getset.setMULTIPLY_(gmult); bool gmult2 = getset.getMULTIPLY_(); assert(gmult == gmult2); int gcrit = getset.getCRITERION_(); gcrit = (gcrit) % 3 + 1; getset.setCRITERION_(gcrit); int gcrit2 = getset.getCRITERION_(); assert(gcrit == gcrit2); int gpre = getset.getDoPreproc(); gpre = (gpre + 1) % 3 - 1; getset.setDoPreproc(gpre); int gpre2 = getset.getDoPreproc(); assert(gpre == gpre2); } // Test generateCuts { CglMixedIntegerRounding gct; OsiSolverInterface *siP = baseSiP->clone(); std::string fn = mpsDir+"capPlan1"; std::string fn2 = mpsDir+"capPlan1.mps"; FILE *in_f = fopen(fn2.c_str(), "r"); if(in_f == NULL) { std::cout<<"Can not open file "<readMps(fn.c_str(),"mps"); siP->initialSolve(); double lpRelax = siP->getObjValue(); OsiCuts cs; gct.generateCuts(*siP, cs); int nRowCuts = cs.sizeRowCuts(); std::cout<<"There are "< 0); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cs); siP->resolve(); double lpRelaxAfter= siP->getObjValue(); std::cout<<"Initial LP value: "< //#include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinPackedVector.hpp" #include "CglMixedIntegerRounding.hpp" //#define CGL_DEBUG 1 //----------------------------------------------------------------------------- // Generate Mixed Integer Rounding inequality //------------------------------------------------------------------- void CglMixedIntegerRounding::generateCuts(const OsiSolverInterface& si, OsiCuts& cs, const CglTreeInfo ) { // If the LP or integer presolve is used, then need to redo preprocessing // everytime this function is called. Otherwise, just do once. bool preInit = false; bool preReso = false; si.getHintParam(OsiDoPresolveInInitial, preInit); si.getHintParam(OsiDoPresolveInResolve, preReso); if (preInit == false && preReso == false && doPreproc_ == -1 ) { // Do once if (doneInitPre_ == false) { mixIntRoundPreprocess(si); doneInitPre_ = true; } } else { if(doPreproc_ == 1){ // Do everytime mixIntRoundPreprocess(si); doneInitPre_ = true; } else { if (doneInitPre_ == false) { mixIntRoundPreprocess(si); doneInitPre_ = true; } } } const double* xlp = si.getColSolution(); // LP solution const double* colUpperBound = si.getColUpper(); // vector of upper bounds const double* colLowerBound = si.getColLower(); // vector of lower bounds // get matrix by row const CoinPackedMatrix & tempMatrixByRow = *si.getMatrixByRow(); CoinPackedMatrix matrixByRow; matrixByRow.submatrixOf(tempMatrixByRow, numRows_, indRows_); CoinPackedMatrix matrixByCol = matrixByRow; matrixByCol.reverseOrdering(); //const CoinPackedMatrix & matrixByRow = *si.getMatrixByRow(); const double* LHS = si.getRowActivity(); const double* coefByRow = matrixByRow.getElements(); const int* colInds = matrixByRow.getIndices(); const int* rowStarts = matrixByRow.getVectorStarts(); const int* rowLengths = matrixByRow.getVectorLengths(); // get matrix by column //const CoinPackedMatrix & matrixByCol = *si.getMatrixByCol(); const double* coefByCol = matrixByCol.getElements(); const int* rowInds = matrixByCol.getIndices(); const int* colStarts = matrixByCol.getVectorStarts(); const int* colLengths = matrixByCol.getVectorLengths(); generateMirCuts(si, xlp, colUpperBound, colLowerBound, matrixByRow, LHS, coefByRow, colInds, rowStarts, rowLengths, //matrixByCol, coefByCol, rowInds, colStarts, colLengths, cs); } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglMixedIntegerRounding::CglMixedIntegerRounding () : CglCutGenerator() { gutsOfConstruct(1, true, 1, -1); } //------------------------------------------------------------------- // Alternate Constructor //------------------------------------------------------------------- CglMixedIntegerRounding::CglMixedIntegerRounding (const int maxaggr, const bool multiply, const int criterion, const int preproc) : CglCutGenerator() { gutsOfConstruct(maxaggr, multiply, criterion, preproc); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglMixedIntegerRounding::CglMixedIntegerRounding ( const CglMixedIntegerRounding & rhs) : CglCutGenerator(rhs) { gutsOfCopy(rhs); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglMixedIntegerRounding::clone() const { return new CglMixedIntegerRounding(*this); } //------------------------------------------------------------------ // Assignment operator //------------------------------------------------------------------- CglMixedIntegerRounding & CglMixedIntegerRounding::operator=(const CglMixedIntegerRounding& rhs) { if (this != &rhs) { gutsOfDelete(); CglCutGenerator::operator=(rhs); gutsOfCopy(rhs); } return *this; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglMixedIntegerRounding::~CglMixedIntegerRounding () { gutsOfDelete(); } //------------------------------------------------------------------- // Construct //------------------------------------------------------------------- void CglMixedIntegerRounding::gutsOfConstruct (const int maxaggr, const bool multiply, const int criterion, const int preproc) { if (maxaggr > 0) { MAXAGGR_ = maxaggr; } else { throw CoinError("Unallowable value. maxaggr must be > 0", "gutsOfConstruct","CglMixedIntegerRounding"); } MULTIPLY_ = multiply; if ((criterion >= 1) && (criterion <= 3)) { CRITERION_ = criterion; } else { throw CoinError("Unallowable value. criterion must be 1, 2 or 3", "gutsOfConstruct","CglMixedIntegerRounding"); } if ((preproc >= -1) && (preproc <= 2)) { doPreproc_ = preproc; } else { throw CoinError("Unallowable value. preproc must be -1, 0 or 1", "gutsOfConstruct","CglMixedIntegerRounding"); } EPSILON_ = 1.0e-6; UNDEFINED_ = -1; TOLERANCE_ = 1.0e-4; numRows_ = 0; numCols_ = 0; doneInitPre_ = false; vubs_ = 0; vlbs_ = 0; rowTypes_ = 0; indRows_ = 0; numRowMix_ = 0; indRowMix_ = 0; numRowCont_ = 0; indRowCont_ = 0; numRowInt_ = 0; indRowInt_ = 0; numRowContVB_ = 0; indRowContVB_ = 0; sense_=NULL; RHS_=NULL; } //------------------------------------------------------------------- // Delete //------------------------------------------------------------------- void CglMixedIntegerRounding::gutsOfDelete () { if (vubs_ != 0) { delete [] vubs_; vubs_ = 0; } if (vlbs_ != 0) { delete [] vlbs_; vlbs_ = 0; } if (rowTypes_ != 0) { delete [] rowTypes_; rowTypes_ = 0; } if (indRows_ != 0) { delete [] indRows_; indRows_ = 0; } if (indRowMix_ != 0) { delete [] indRowMix_; indRowMix_ = 0; } if (indRowCont_ != 0) { delete [] indRowCont_; indRowCont_ = 0; } if (indRowInt_ != 0) { delete [] indRowInt_; indRowInt_ = 0; } if (indRowContVB_ != 0) { delete [] indRowContVB_; indRowContVB_ = 0; } if (sense_ !=NULL) { delete [] sense_; sense_=NULL;} if (RHS_ !=NULL) { delete [] RHS_; RHS_=NULL;} } //------------------------------------------------------------------- // Copy //------------------------------------------------------------------- void CglMixedIntegerRounding::gutsOfCopy (const CglMixedIntegerRounding& rhs) { MAXAGGR_ = rhs.MAXAGGR_; MULTIPLY_ = rhs.MULTIPLY_; CRITERION_ = rhs.CRITERION_; EPSILON_ = rhs.EPSILON_; UNDEFINED_ = rhs.UNDEFINED_; TOLERANCE_ = rhs.TOLERANCE_; doPreproc_ = rhs.doPreproc_; numRows_ = rhs.numRows_; numCols_ = rhs.numCols_; doneInitPre_ = rhs.doneInitPre_; numRowMix_ = rhs.numRowMix_; numRowCont_ = rhs.numRowCont_; numRowInt_ = rhs.numRowInt_; numRowContVB_ = rhs.numRowContVB_; if (numCols_ > 0) { vubs_ = new CglMixIntRoundVUB [numCols_]; vlbs_ = new CglMixIntRoundVLB [numCols_]; CoinDisjointCopyN(rhs.vubs_, numCols_, vubs_); CoinDisjointCopyN(rhs.vlbs_, numCols_, vlbs_); } else { vubs_ = 0; vlbs_ = 0; } if (numRows_ > 0) { rowTypes_ = new RowType [numRows_]; CoinDisjointCopyN(rhs.rowTypes_, numRows_, rowTypes_); indRows_ = new int [numRows_]; CoinDisjointCopyN(rhs.indRows_, numRows_, indRows_); sense_ = CoinCopyOfArray(rhs.sense_,numRows_); RHS_ = CoinCopyOfArray(rhs.RHS_,numRows_); } else { rowTypes_ = 0; indRows_ = 0; sense_=NULL; RHS_=NULL; } if (numRowMix_ > 0) { indRowMix_ = new int [numRowMix_]; CoinDisjointCopyN(rhs.indRowMix_, numRowMix_, indRowMix_); } else { indRowMix_ = 0; } if (numRowCont_ > 0) { indRowCont_ = new int [numRowCont_]; CoinDisjointCopyN(rhs.indRowCont_, numRowCont_, indRowCont_); indRowContVB_ = new int [numRowCont_]; CoinDisjointCopyN(rhs.indRowContVB_, numRowCont_, indRowContVB_); } else { indRowCont_ = 0; indRowContVB_ = 0; } if (numRowInt_ > 0) { indRowInt_ = new int [numRowInt_]; CoinDisjointCopyN(rhs.indRowInt_, numRowInt_, indRowInt_); } else { indRowInt_ = 0; } } //------------------------------------------------------------------- // Do preprocessing // It determines the type of each row. It also identifies the variable // upper bounds and variable lower bounds. //------------------------------------------------------------------- void CglMixedIntegerRounding:: mixIntRoundPreprocess(const OsiSolverInterface& si) { // get matrix stored by row const CoinPackedMatrix & matrixByRow = *si.getMatrixByRow(); numRows_ = si.getNumRows(); numCols_ = si.getNumCols(); const double* coefByRow = matrixByRow.getElements(); const int* colInds = matrixByRow.getIndices(); const int* rowStarts = matrixByRow.getVectorStarts(); const int* rowLengths = matrixByRow.getVectorLengths(); // Get copies of sense and RHS so we can modify if ranges if (sense_) { delete [] sense_; delete [] RHS_; } sense_ = CoinCopyOfArray(si.getRowSense(),numRows_); RHS_ = CoinCopyOfArray(si.getRightHandSide(),numRows_); if (rowTypes_ != 0) { delete [] rowTypes_; rowTypes_ = 0; } rowTypes_ = new RowType [numRows_]; // Destructor will free memory // Summarize the row type infomation. int numUNDEFINED = 0; int numVARUB = 0; int numVARLB = 0; int numVAREQ = 0; int numMIX = 0; int numCONT = 0; int numINT = 0; int numOTHER = 0; int iRow; const double* rowActivity = si.getRowActivity(); const double* rowLower = si.getRowLower(); const double* rowUpper = si.getRowUpper(); for (iRow = 0; iRow < numRows_; ++iRow) { // If range then choose which to use if (sense_[iRow]=='R') { if (rowActivity[iRow]-rowLower[iRow]< rowUpper[iRow]-rowActivity[iRow]) { // treat as G row RHS_[iRow]=rowLower[iRow]; sense_[iRow]='G'; } else { // treat as L row RHS_[iRow]=rowUpper[iRow]; sense_[iRow]='L'; } } // get the type of a row const RowType rowType = determineRowType(si, rowLengths[iRow], colInds+rowStarts[iRow], coefByRow+rowStarts[iRow], sense_[iRow], RHS_[iRow]); // store the type of the current row rowTypes_[iRow] = rowType; // Summarize information about row types switch(rowType) { case ROW_UNDEFINED: ++numUNDEFINED; break; case ROW_VARUB: ++numVARUB; break; case ROW_VARLB: ++numVARLB; break; case ROW_VAREQ: ++numVAREQ; break; case ROW_MIX: ++numMIX; break; case ROW_CONT: ++numCONT; break; case ROW_INT: ++numINT; break; case ROW_OTHER: ++numOTHER; break; default: throw CoinError("Unknown row type", "MixIntRoundPreprocess", "CglMixedIntegerRounding"); } } // allocate memory for vector of indices of all rows if (indRows_ != 0) { delete [] indRows_; indRows_ = 0; } if (numRows_ > 0) indRows_ = new int [numRows_]; // Destructor will free memory // allocate memory for vector of indices of rows of type ROW_MIX numRowMix_ = numMIX; if (indRowMix_ != 0) { delete [] indRowMix_; indRowMix_ = 0; } if (numRowMix_ > 0) indRowMix_ = new int [numRowMix_]; // Destructor will free memory // allocate memory for vector of indices of rows of type ROW_CONT numRowCont_ = numCONT; if (indRowCont_ != 0) { delete [] indRowCont_; indRowCont_ = 0; } if (numRowCont_ > 0) indRowCont_ = new int [numRowCont_]; // Destructor will free memory // allocate memory for vector of indices of rows of type ROW_INT numRowInt_ = numINT; if (indRowInt_ != 0) { delete [] indRowInt_; indRowInt_ = 0; } if (numRowInt_ > 0) indRowInt_ = new int [numRowInt_]; // Destructor will free memory #if CGL_DEBUG std::cout << "The num of rows = " << numRows_ << std::endl; std::cout << "Summary of Row Type" << std::endl; std::cout << "numUNDEFINED = " << numUNDEFINED << std::endl; std::cout << "numVARUB = " << numVARUB << std::endl; std::cout << "numVARLB = " << numVARLB << std::endl; std::cout << "numVAREQ = " << numVAREQ << std::endl; std::cout << "numMIX = " << numMIX << std::endl; std::cout << "numCONT = " << numCONT << std::endl; std::cout << "numINT = " << numINT << std::endl; std::cout << "numOTHER = " << numOTHER << std::endl; #endif //--------------------------------------------------------------------------- // Setup vubs_ and vlbs_ if (vubs_ != 0) { delete [] vubs_; vubs_ = 0; } vubs_ = new CglMixIntRoundVUB [numCols_]; // Destructor will free if (vlbs_ != 0) { delete [] vlbs_; vlbs_ = 0; } vlbs_ = new CglMixIntRoundVLB [numCols_]; // Destructor will free // Initialization. Altough this has been done in constructor, it is needed // for the case where the mixIntRoundPreprocess is called more than once for (int iCol = 0; iCol < numCols_; ++iCol) { vubs_[iCol].setVar(UNDEFINED_); vlbs_[iCol].setVar(UNDEFINED_); } int countM = 0; int countC = 0; int countI = 0; for ( iRow = 0; iRow < numRows_; ++iRow) { RowType rowType = rowTypes_[iRow]; // fill the vector indRows_ with the indices of all rows indRows_[iRow] = iRow; // fill the vector indRowMix_ with the indices of the rows of type ROW_MIX if (rowType == ROW_MIX) { indRowMix_[countM] = iRow; countM++; } // fill the vector indRowCont_ with the indices of rows of type ROW_CONT else if (rowType == ROW_CONT) { indRowCont_[countC] = iRow; countC++; } // fill the vector indRowInt_ with the indices of the rows of type ROW_INT else if (rowType == ROW_INT) { indRowInt_[countI] = iRow; countI++; } // create vectors with variable lower and upper bounds else if ( (rowType == ROW_VARUB) || (rowType == ROW_VARLB) || (rowType == ROW_VAREQ) ) { int startPos = rowStarts[iRow]; int stopPos = startPos + rowLengths[iRow]; int xInd = 0, yInd = 0; // x is continuous, y is integer double xCoef = 0.0, yCoef = 0.0; for (int i = startPos; i < stopPos; ++i) { if ( fabs(coefByRow[i]) > EPSILON_ ) { if( si.isInteger(colInds[i]) ) { yInd = colInds[i]; yCoef = coefByRow[i]; } else { xInd = colInds[i]; xCoef = coefByRow[i]; } } } switch (rowType) { case ROW_VARUB: // Inequality: x <= ? * y vubs_[xInd].setVar(yInd); vubs_[xInd].setVal(-yCoef / xCoef); break; case ROW_VARLB: // Inequality: x >= ? * y vlbs_[xInd].setVar(yInd); vlbs_[xInd].setVal(-yCoef / xCoef); break; case ROW_VAREQ: // Inequality: x >= AND <= ? * y vubs_[xInd].setVar(yInd); vubs_[xInd].setVal(-yCoef / xCoef); vlbs_[xInd].setVar(yInd); vlbs_[xInd].setVal(-yCoef / xCoef); break; default: // I am getting compiler bug which gets here - I am disabling - JJF //throw CoinError("Unknown row type: impossible", // "MixIntRoundPreprocess", // "CglMixedIntegerRounding"); break; } } } // allocate memory for vector of indices of rows of type ROW_CONT // that have at least one variable with variable upper or lower bound if (indRowContVB_ != 0) { delete [] indRowContVB_; indRowContVB_ = 0; } if (numRowCont_ > 0) indRowContVB_ = new int [numRowCont_]; // Destructor will free memory // create vector with rows of type ROW_CONT that have at least // one variable with variable upper or lower bound countC = 0; for (int i = 0; i < numRowCont_; ++i) { int indRow = indRowCont_[i]; int jStart = rowStarts[indRow]; int jStop = jStart + rowLengths[indRow]; for (int j = jStart; j < jStop; ++j) { int indCol = colInds[j]; CglMixIntRoundVLB VLB = vlbs_[indCol]; CglMixIntRoundVUB VUB = vubs_[indCol]; if (( VLB.getVar() != UNDEFINED_ ) || ( VUB.getVar() != UNDEFINED_ ) ){ indRowContVB_[countC] = indRow; countC++; break; } } } numRowContVB_ = countC; } //------------------------------------------------------------------- // Determine the type of a given row //------------------------------------------------------------------- CglMixedIntegerRounding::RowType CglMixedIntegerRounding::determineRowType(const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const char sense, const double rhs) const { if (rowLen == 0) return ROW_UNDEFINED; if (sense == 'N' || rhs == si.getInfinity() || rhs == -si.getInfinity()) return ROW_OTHER; RowType rowType = ROW_UNDEFINED; int numPosInt = 0; // num of positive integer variables int numNegInt = 0; // num of negative integer variables int numInt = 0; // num of integer variables int numPosCon = 0; // num of positive continuous variables int numNegCon = 0; // num of negative continuous variables int numCon = 0; // num of continuous variables // Summarize the variable types of the given row. for ( int i = 0; i < rowLen; ++i ) { if ( coef[i] < -EPSILON_ ) { if( si.isInteger(ind[i]) ) ++numNegInt; else ++numNegCon; } else if ( coef[i] > EPSILON_ ) { if( si.isInteger(ind[i]) ) ++numPosInt; else ++numPosCon; } } numInt = numNegInt + numPosInt; numCon = numNegCon + numPosCon; #if CGL_DEBUG std::cout << "numNegInt = " << numNegInt << std::endl; std::cout << "numPosInt = " << numPosInt << std::endl; std::cout << "numInt = " << numInt << std::endl; std::cout << "numNegCon = " << numNegCon << std::endl; std::cout << "numPosCon = " << numPosCon << std::endl; std::cout << "numCon = " << numCon << std::endl; std::cout << "rowLen = " << rowLen << std::endl; #endif //------------------------------------------------------------------------- // Classify row type based on the types of variables. if ((numInt > 0) && (numCon > 0)) { if ((numInt == 1) && (numCon == 1) && (fabs(rhs) <= EPSILON_)) { // It's a variable bound constraint switch (sense) { case 'L': rowType = numPosCon == 1 ? ROW_VARUB : ROW_VARLB; break; case 'G': rowType = numPosCon == 1 ? ROW_VARLB : ROW_VARUB; break; case 'E': rowType = ROW_VAREQ; break; default: break; } } else { // It's a constraint with continuous and integer variables; // The total number of variables is at least 2 rowType = ROW_MIX; } } else if (numInt == 0) { // It's a constraint with only continuous variables rowType = ROW_CONT; } else if ((numCon == 0) && ((sense == 'L') || (sense == 'G'))) { // It's a <= or >= constraint with only integer variables rowType = ROW_INT; } else // It's a constraint that does not fit the above categories rowType = ROW_OTHER; return rowType; } //------------------------------------------------------------------- // Generate MIR cuts //------------------------------------------------------------------- void CglMixedIntegerRounding::generateMirCuts( const OsiSolverInterface& si, const double* xlp, const double* colUpperBound, const double* colLowerBound, const CoinPackedMatrix& matrixByRow, const double* LHS, const double* /*coefByRow*/, const int* /*colInds*/, const int* /*rowStarts*/, const int* /*rowLengths*/, //const CoinPackedMatrix& matrixByCol, const double* coefByCol, const int* rowInds, const int* colStarts, const int* colLengths, OsiCuts& cs ) const { #if CGL_DEBUG // Open debug data file; incorporate solver name so we get separate files // when running unit test. std::string dbgFname ; si.getStrParam(OsiSolverName,dbgFname) ; dbgFname = "mir_"+dbgFname+"_stats.dat" ; std::ofstream fout(dbgFname.c_str()) ; #endif // Define upper limit for the loop where the cMIRs are constructed int upperLimit; if (MULTIPLY_) upperLimit = 2; else upperLimit = 1; // create a vector with the columns that were used in the aggregation int* listColsSelected = new int[MAXAGGR_]; // create a vector with the rows that were aggregated int* listRowsAggregated = new int[MAXAGGR_]; // create a vector with the LP solutions of the slack variables double* xlpExtra = new double[MAXAGGR_]; // loop until maximum number of aggregated rows is reached or a // violated cut is found int numRowMixAndRowContVB = numRowMix_ + numRowContVB_; int numRowMixAndRowContVBAndRowInt = numRowMixAndRowContVB + numRowInt_; for (int iRow = 0; iRow < numRowMixAndRowContVBAndRowInt; ++iRow) { int rowSelected; // row selected to be aggregated next int colSelected; // column selected for pivot in aggregation CoinPackedVector rowAggregated; double rhsAggregated; // create a set with the indices of rows selected std::set setRowsAggregated; // loop until the maximum number of aggregated rows is reached for (int iAggregate = 0; iAggregate < MAXAGGR_; ++iAggregate) { if (iAggregate == 0) { // select row if (iRow < numRowMix_) { rowSelected = indRowMix_[iRow]; } else if (iRow < numRowMixAndRowContVB) { rowSelected = indRowContVB_[iRow - numRowMix_]; } else { rowSelected = indRowInt_[iRow - numRowMixAndRowContVB]; } copyRowSelected(iAggregate, rowSelected, setRowsAggregated, listRowsAggregated, xlpExtra, sense_[rowSelected], RHS_[rowSelected], LHS[rowSelected], matrixByRow, rowAggregated, rhsAggregated); } else { // search for a row to aggregate bool foundRowToAggregate = selectRowToAggregate( si, rowAggregated, colUpperBound, colLowerBound, setRowsAggregated, xlp, coefByCol, rowInds, colStarts, colLengths, rowSelected, colSelected); // if finds row to aggregate, compute aggregated row if (foundRowToAggregate) { CoinPackedVector rowToAggregate; double rhsToAggregate; listColsSelected[iAggregate] = colSelected; copyRowSelected(iAggregate, rowSelected, setRowsAggregated, listRowsAggregated, xlpExtra, sense_[rowSelected], RHS_[rowSelected], LHS[rowSelected], matrixByRow, rowToAggregate, rhsToAggregate); // call aggregate row heuristic aggregateRow(colSelected, rowToAggregate, rhsToAggregate, rowAggregated, rhsAggregated); } else break; } // construct cMIR with current rowAggregated // and, if upperLimit=2 construct also a cMIR with // the current rowAggregated multiplied by -1 for (int i = 0; i < upperLimit; ++i) { // create vector for mixed knapsack constraint CoinPackedVector rowToUse = rowAggregated; double rhsMixedKnapsack = rhsAggregated; if (i == 1) { rowToUse *= (-1.0); rhsMixedKnapsack *= (-1.0); } CoinPackedVector mixedKnapsack; double sStar = 0.0; // create vector for the continuous variables in s CoinPackedVector contVariablesInS; // call bound substitution heuristic bool foundMixedKnapsack = boundSubstitution( si, rowToUse, xlp, xlpExtra, colUpperBound, colLowerBound, mixedKnapsack, rhsMixedKnapsack, sStar, contVariablesInS); // may want some limit? if (mixedKnapsack.getNumElements()>25000) { #if CGL_DEBUG std::cout << "mixed knapsack has " <& setRowsAggregated, int* listRowsAggregated, double* xlpExtra, const char sen, const double rhs, const double lhs, const CoinPackedMatrix& matrixByRow, CoinPackedVector& rowToAggregate, double& rhsToAggregate) const { // copy the row selected to a vector of type CoinPackedVector const CoinShallowPackedVector reqdBySunCC = matrixByRow.getVector(rowSelected); rowToAggregate = reqdBySunCC ; rhsToAggregate = rhs; // update list of indices of rows selected setRowsAggregated.insert(rowSelected); listRowsAggregated[iAggregate] = rowSelected; // Add a slack variable if needed and compute its current value if (sen == 'L') { rowToAggregate.insert(numCols_ + iAggregate, 1); xlpExtra[iAggregate] = rhs - lhs; } else if (sen == 'G') { rowToAggregate.insert(numCols_ + iAggregate, -1); xlpExtra[iAggregate] = lhs - rhs; } } //------------------------------------------------------------------- // Construct the set P* and select a row to aggregate //------------------------------------------------------------------- bool CglMixedIntegerRounding::selectRowToAggregate( const OsiSolverInterface& si, const CoinPackedVector& rowAggregated, const double* colUpperBound, const double* colLowerBound, const std::set& setRowsAggregated, const double* xlp, const double* coefByCol, const int* rowInds, const int* colStarts, const int* colLengths, int& rowSelected, int& colSelected ) const { bool foundRowToAggregate = false; double deltaMax = 0.0; // maximum delta const int numColsAggregated = rowAggregated.getNumElements(); const int *rowAggregatedIndices = rowAggregated.getIndices(); const double *rowAggregatedElements = rowAggregated.getElements(); for (int j = 0; j < numColsAggregated; ++j) { // store the index and coefficient of column j int indCol = rowAggregatedIndices[j]; if (indCol >= numCols_) continue; double coefCol = rowAggregatedElements[j]; // Consider only continuous variables if ( (!si.isContinuous(indCol)) || (fabs(coefCol) < EPSILON_)) continue; // Compute current lower bound CglMixIntRoundVLB VLB = vlbs_[indCol]; double LB = ( VLB.getVar() != UNDEFINED_ ) ? VLB.getVal() * xlp[VLB.getVar()] : colLowerBound[indCol]; // Compute current upper bound CglMixIntRoundVUB VUB = vubs_[indCol]; double UB = ( VUB.getVar() != UNDEFINED_ ) ? VUB.getVal() * xlp[VUB.getVar()] : colUpperBound[indCol]; // Compute distances from current solution to upper and lower bounds double delta = CoinMin(xlp[indCol] - LB, UB - xlp[indCol]); // In case this variable is acceptable look for possible rows if (delta > deltaMax) { int iStart = colStarts[indCol]; int iStop = iStart + colLengths[indCol]; // int count = 0; // std::vector rowPossible; // find a row to use in aggregation for (int i = iStart; i < iStop; ++i) { int rowInd = rowInds[i]; if (setRowsAggregated.find(rowInd) == setRowsAggregated.end()) { // if the row was not already selected, select it RowType rType = rowTypes_[rowInd]; if ( ((rType == ROW_MIX) || (rType == ROW_CONT)) && (fabs(coefByCol[i]) > EPSILON_) ) { // rowPossible.push_back(rowInd); rowSelected = rowInd; deltaMax = delta; colSelected = indCol; foundRowToAggregate = true; //count++; break; } } } // if (count > 0) // rowSelected = rowPossible[rand() % count]; // std::cout << count << std::endl; } } return foundRowToAggregate; } //------------------------------------------------------------------- // Aggregate the selected row with the current aggregated row //------------------------------------------------------------------- void CglMixedIntegerRounding::aggregateRow( const int colSelected, CoinPackedVector& rowToAggregate, double rhs, CoinPackedVector& rowAggregated, double& rhsAggregated ) const { // quantity to multiply by the coefficients of the row to aggregate double multiCoef = rowAggregated[colSelected] / rowToAggregate[colSelected]; rowToAggregate *= multiCoef; rhs *= multiCoef; rowAggregated = rowAggregated - rowToAggregate; rhsAggregated -= rhs; } //------------------------------------------------------------------- // Choose the bound substitution based on the criteria defined by the user //------------------------------------------------------------------- inline bool CglMixedIntegerRounding::isLowerSubst(const double inf, const double aj, const double xlp, const double LB, const double UB) const { if (CRITERION_ == 1) { // criterion 1 (the same as criterion (a) in the paper) return xlp - LB < UB - xlp; } else { if (UB == inf || xlp == LB) return true; if (LB == -inf || xlp == UB) return false; if (CRITERION_ == 2) // criterion 2 (the same as criterion (b) in the paper) return aj < 0; else // criterion 3 (the same as criterion (c) in the paper) return aj > 0; } } //------------------------------------------------------------------- // Bound substitution heuristic //------------------------------------------------------------------- bool CglMixedIntegerRounding::boundSubstitution( const OsiSolverInterface& si, const CoinPackedVector& rowAggregated, const double* xlp, const double* xlpExtra, const double* colUpperBound, const double* colLowerBound, CoinPackedVector& mixedKnapsack, double& rhsMixedKnapsack, double& sStar, CoinPackedVector& contVariablesInS ) const { bool generated = false; const int numColsAggregated = rowAggregated.getNumElements(); const int *rowAggregatedIndices = rowAggregated.getIndices(); const double *rowAggregatedElements = rowAggregated.getElements(); // go through all the variables and if it is continuous and delta is // negative, store variable in the vector contVariablesInS. // If it is integer, store variable in the vector mixedKnapsack int numCont = 0; int j; for ( j = 0; j < numColsAggregated; ++j) { // get index and coefficient of column j in the aggregated row const int indCol = rowAggregatedIndices[j]; const double coefCol = rowAggregatedElements[j]; // if the lower bound is equal to the upper bound, remove variable if ( (indCol < numCols_) && (colLowerBound[indCol] == colUpperBound[indCol]) ) { rhsMixedKnapsack -= coefCol * colLowerBound[indCol]; continue; } if (fabs(coefCol) < EPSILON_) continue; // set the coefficients of the integer variables if ( (indCol < numCols_) && (!si.isContinuous(indCol)) ) { // Copy the integer variable to the vector mixedKnapsack if (mixedKnapsack.isExistingIndex(indCol)) { const int index = mixedKnapsack.findIndex(indCol); mixedKnapsack.setElement(index, mixedKnapsack[indCol] + coefCol); } else mixedKnapsack.insert(indCol, coefCol); continue; } // Select the continuous variables and copy the ones in s to // the vector contVariablesInS if (indCol < numCols_) { // variable is model variable // Compute lower bound for variable indCol const CglMixIntRoundVLB VLB = vlbs_[indCol]; const double LB = ( VLB.getVar() != UNDEFINED_ ) ? VLB.getVal() * xlp[VLB.getVar()] : colLowerBound[indCol]; // Compute upper bound for variable indCol const CglMixIntRoundVUB VUB = vubs_[indCol]; const double UB = ( VUB.getVar() != UNDEFINED_ ) ? VUB.getVal() * xlp[VUB.getVar()] : colUpperBound[indCol]; // if both bounds are infinite, then we cannot form a mixed knapsack if ( (LB == -1.0 * si.getInfinity()) && (UB == si.getInfinity()) ) { #if CGL_DEBUG std::cout << "continuous var with infinite bounds. " << "Cannot form mixed Knapsack = " << std::endl; #endif return generated; } // Select the bound substitution if (isLowerSubst(si.getInfinity(), rowAggregatedElements[j], xlp[indCol], LB, UB)) { if (VLB.getVar() != UNDEFINED_ ) { const int indVLB = VLB.getVar(); if (mixedKnapsack.isExistingIndex(indVLB)) { const int index = mixedKnapsack.findIndex(indVLB); mixedKnapsack.setElement(index, mixedKnapsack[indVLB] + coefCol * VLB.getVal()); } else mixedKnapsack.insert(indVLB, coefCol * VLB.getVal()); } else { rhsMixedKnapsack -= coefCol * LB; } // Update sStar if (coefCol < -EPSILON_) { contVariablesInS.insert(indCol, coefCol); sStar -= coefCol * (xlp[indCol] - LB); numCont++; } } else { if (VUB.getVar() != UNDEFINED_ ) { const int indVUB = VUB.getVar(); if (mixedKnapsack.isExistingIndex(indVUB)) { const int index = mixedKnapsack.findIndex(indVUB); mixedKnapsack.setElement(index, mixedKnapsack[indVUB] + coefCol * VUB.getVal()); } else mixedKnapsack.insert(indVUB, coefCol * VUB.getVal()); } else { rhsMixedKnapsack -= coefCol * UB; } // Update sStar if (coefCol > EPSILON_) { contVariablesInS.insert(indCol, - coefCol); sStar += coefCol * (UB - xlp[indCol]); numCont++; } } } else { // variable is slack variable // in this case the LB = 0 and the UB = infinity // Update sStar const double tLB = xlpExtra[indCol - numCols_]; if (coefCol < -EPSILON_) { contVariablesInS.insert(indCol, coefCol); sStar -= coefCol * tLB; numCont++; } } } // if there are no continuous variables to form s, then we stop #if CGL_DEBUG std::cout << "# of continuous var in mixedKnapsack = " << numCont << std::endl; #endif if (numCont == 0) return generated; // check that the integer variables have lower bound equal to zero const int numInt = mixedKnapsack.getNumElements(); // if there are not integer variables in mixedKnapsack, then we stop // CAUTION: all the coefficients could be zero #if CGL_DEBUG std::cout << "# of integer var in mixedKnapsack = " << numInt << std::endl; #endif if (numInt == 0) return generated; const int *knapsackIndices = mixedKnapsack.getIndices(); const double *knapsackElements = mixedKnapsack.getElements(); for ( j = 0; j < numInt; ++j) { // if the coefficient is zero, disregard if (fabs(knapsackElements[j]) < EPSILON_) continue; // if the lower bound is not zero, then we stop if (fabs(colLowerBound[knapsackIndices[j]]) > EPSILON_) return generated; } // if the lower bounds of all integer variables are zero, proceed generated = true; return generated; } //------------------------------------------------------------------- // c-MIR separation heuristic //------------------------------------------------------------------- bool CglMixedIntegerRounding::cMirSeparation( const OsiSolverInterface& si, const CoinPackedMatrix& matrixByRow, const CoinPackedVector& rowAggregated, const int* listRowsAggregated, const char* sense, const double* RHS, //const double* coefByRow, //const int* colInds, const int* rowStarts, //const int* rowLengths, const double* xlp, const double sStar, const double* colUpperBound, const double* colLowerBound, const CoinPackedVector& mixedKnapsack, const double& rhsMixedKnapsack, const CoinPackedVector& contVariablesInS, OsiRowCut& cMirCut) const { bool generated = false; double numeratorBeta = rhsMixedKnapsack; CoinPackedVector cMIR = mixedKnapsack; double rhscMIR; double maxViolation = 0.0; double bestDelta = 0.0; CoinPackedVector bestCut; double rhsBestCut = 0.0; double sCoefBestCut = 0.0; const int numInt = mixedKnapsack.getNumElements(); const int *knapsackIndices = mixedKnapsack.getIndices(); const double *knapsackElements = mixedKnapsack.getElements(); const int *contVarInSIndices = contVariablesInS.getIndices(); const double *contVarInSElements = contVariablesInS.getElements(); // Construct set C, T will be the rest. // Also, for T we construct a CoinPackedVector named complT which // contains the vars in T that are strictly between their bounds std::set setC; CoinPackedVector complT; int j; for ( j = 0; j < numInt; ++j) { const int indCol = knapsackIndices[j]; // if the upper bound is infinity, then indCol is in T and cannot // be in complT if (colUpperBound[indCol] != si.getInfinity()) { if (xlp[indCol] >= colUpperBound[indCol] / 2.0) { setC.insert(j); numeratorBeta -= knapsackElements[j] * colUpperBound[indCol]; } else { if ( (xlp[indCol] <= EPSILON_) || (xlp[indCol] >= colUpperBound[indCol] - EPSILON_)) continue; complT.insert(j, fabs(xlp[indCol] - colUpperBound[indCol]/2)); } } } // Sort the indices in complT by nondecreasing values // (which are $|y^*_j-u_j/2|$) if (complT.getNumElements() > 0) { complT.sortIncrElement(); } // Construct c-MIR inequalities and take the one with the largest violation for ( j = 0; j < numInt; ++j) { int indCol = knapsackIndices[j]; if ( (xlp[indCol] <= EPSILON_) || (xlp[indCol] >= colUpperBound[indCol] - EPSILON_)) continue; double delta = knapsackElements[j]; // delta has to be positive if (delta <= EPSILON_) continue; double violation = 0.0; double sCoef = 0.0; // form a cMIR inequality cMirInequality(numInt, delta, numeratorBeta, knapsackIndices, knapsackElements, xlp, sStar, colUpperBound, setC, cMIR, rhscMIR, sCoef, violation); // store cut if it is the best found so far if (violation > maxViolation + EPSILON_) { bestCut = cMIR; rhsBestCut = rhscMIR; sCoefBestCut = sCoef; maxViolation = violation; bestDelta = delta; } } // if no violated inequality has been found, exit now if (maxViolation == 0.0) return generated; // improve the best violated inequality. // try to divide delta by 2, 4 or 8 and see if increases the violation double deltaBase = bestDelta; for (int multFactor = 2; multFactor <= 8; multFactor *= 2) { double delta = deltaBase / multFactor; double violation = 0.0; double sCoef = 0.0; // form a cMIR inequality cMirInequality(numInt, delta, numeratorBeta, knapsackIndices, knapsackElements, xlp, sStar, colUpperBound, setC, cMIR, rhscMIR, sCoef, violation); // store cut if it is the best found so far if (violation > maxViolation + EPSILON_) { bestCut = cMIR; rhsBestCut = rhscMIR; sCoefBestCut = sCoef; maxViolation = violation; bestDelta = delta; } } // improve cMIR for the best delta // complT contains indices into mixedKnapsack for the variables // which may be complemented and they are already appropriately // sorted. const int complTSize = complT.getNumElements(); if (complTSize > 0) { const int *complTIndices = complT.getIndices(); for (int j = 0; j < complTSize; ++j) { // move variable in set complT from set T to set C int jIndex = complTIndices[j]; int indCol = knapsackIndices[jIndex]; // do nothing if upper bound is infinity if (colUpperBound[indCol] >= si.getInfinity()) continue; setC.insert(jIndex); double violation = 0.0; double sCoef = 0.0; double localNumeratorBeta = numeratorBeta - mixedKnapsack[indCol] * colUpperBound[indCol]; // form a cMIR inequality cMirInequality(numInt, bestDelta, localNumeratorBeta, knapsackIndices, knapsackElements, xlp, sStar, colUpperBound, setC, cMIR, rhscMIR, sCoef, violation); // store cut if it is the best found so far; otherwise, move the variable // that was added to set C back to set T if (violation > maxViolation + EPSILON_) { bestCut = cMIR; rhsBestCut = rhscMIR; sCoefBestCut = sCoef; maxViolation = violation; numeratorBeta = localNumeratorBeta; } else setC.erase(jIndex); } } // write the best cut found with the model variables int numCont = contVariablesInS.getNumElements(); for ( j = 0; j < numCont; ++j) { int indCol = contVarInSIndices[j]; double coefCol = contVarInSElements[j]; if (indCol < numCols_) { // variable is model variable // Compute lower bound for variable indCol CglMixIntRoundVLB VLB = vlbs_[indCol]; double LB = ( VLB.getVar() != UNDEFINED_ ) ? VLB.getVal() * xlp[VLB.getVar()] : colLowerBound[indCol]; // Compute upper bound for variable indCol CglMixIntRoundVUB VUB = vubs_[indCol]; double UB = ( VUB.getVar() != UNDEFINED_ ) ? VUB.getVal() * xlp[VUB.getVar()] : colUpperBound[indCol]; // Select the bound substitution if (isLowerSubst(si.getInfinity(), rowAggregated[indCol], xlp[indCol], LB, UB)) { if (VLB.getVar() != UNDEFINED_ ) { int indVLB = VLB.getVar(); if (bestCut.isExistingIndex(indVLB)){ int index = bestCut.findIndex(indVLB); bestCut.setElement(index, bestCut[indVLB] - sCoefBestCut * coefCol * VLB.getVal()); } else bestCut.insert(indVLB, - sCoefBestCut * coefCol * VLB.getVal()); bestCut.insert(indCol, sCoefBestCut * coefCol); } else { rhsBestCut += sCoefBestCut * coefCol * colLowerBound[indCol]; bestCut.insert(indCol, sCoefBestCut * coefCol); } } else { if (VUB.getVar() != UNDEFINED_ ) { int indVUB = VUB.getVar(); if (bestCut.isExistingIndex(indVUB)){ int index = bestCut.findIndex(indVUB); bestCut.setElement(index, bestCut[indVUB] + sCoefBestCut * coefCol * VUB.getVal()); } else bestCut.insert(indVUB, sCoefBestCut * coefCol * VUB.getVal()); bestCut.insert(indCol, - sCoefBestCut * coefCol); } else { rhsBestCut -= sCoefBestCut * coefCol * colUpperBound[indCol]; bestCut.insert(indCol, - sCoefBestCut * coefCol); } } } else { // variable is slack variable // in this case the LB = 0 and the UB = infinity // copy the row selected to a vector of type CoinPackedVector const int iRow = listRowsAggregated[indCol - numCols_]; const CoinShallowPackedVector reqdBySunCC = matrixByRow.getVector(iRow); CoinPackedVector row = reqdBySunCC ; double rhs = RHS[iRow]; if (sense[iRow] == 'L') { // if it is a <= inequality, the coefficient of the slack is 1 row *= (- sCoefBestCut * coefCol); rhs *= (- sCoefBestCut * coefCol); } else { assert (sense[iRow]=='G'); // if it is a <= inequality, the coefficient of the slack is -1 row *= (sCoefBestCut * coefCol); rhs *= (sCoefBestCut * coefCol); } rhsBestCut += rhs; bestCut = bestCut + row; } } // Check the violation of the cut after it is written with the original // variables. int cutLen = bestCut.getNumElements(); int* cutInd = bestCut.getIndices(); double* cutCoef = bestCut.getElements(); double cutRHS = rhsBestCut; double violation = 0.0; double normCut = 0.0; // Also weaken by small coefficients int n=0; for ( j = 0; j < cutLen; ++j) { double value = cutCoef[j]; int column = cutInd[j]; if (fabs(value)>1.0e-12) { violation += cutCoef[j] * xlp[column]; normCut += cutCoef[j] * cutCoef[j]; cutCoef[n]=value; cutInd[n++]=column; } else if (value) { // Weaken if (value>0.0) { // Allow for at lower bound cutRHS -= value*colLowerBound[column]; } else { // Allow for at upper bound cutRHS -= value*colUpperBound[column]; } } } cutLen=n; violation -= cutRHS; violation /= sqrt(normCut); if ( violation > TOLERANCE_ ) { cMirCut.setRow(cutLen, cutInd, cutCoef); cMirCut.setLb(-1.0 * si.getInfinity()); cMirCut.setUb(cutRHS); cMirCut.setEffectiveness(violation); #ifdef CGL_DEBUG { for (int k=0; k=0); assert(cutCoef[k]); assert (fabs(cutCoef[k])>1.0e-12); } } #endif generated = true; } return generated; } //------------------------------------------------------------------- // construct a c-MIR inequality //------------------------------------------------------------------- void CglMixedIntegerRounding::cMirInequality( const int numInt, const double delta, const double numeratorBeta, const int *knapsackIndices, const double* knapsackElements, const double* xlp, const double sStar, const double* colUpperBound, const std::set& setC, CoinPackedVector& cMIR, double& rhscMIR, double& sCoef, double& violation) const { // form a cMIR inequality double beta = numeratorBeta / delta; double f = beta - floor(beta); rhscMIR = floor(beta); double normCut = 0.0; // coefficients of variables in set T for (int i = 0; i < numInt; ++i) { const int iIndex = knapsackIndices[i]; double G = 0.0; if (setC.find(i) == setC.end()) { // i is not in setC, i.e., it is in T G = functionG(knapsackElements[i] / delta, f); violation += (G * xlp[iIndex]); normCut += G * G; cMIR.setElement(i, G); } else { G = functionG( - knapsackElements[i] / delta, f); violation -= (G * xlp[iIndex]); normCut += G * G; rhscMIR -= G * colUpperBound[iIndex]; cMIR.setElement(i, -G); } } sCoef = 1.0 / (delta * (1.0 - f)); violation -= (rhscMIR + sCoef * sStar); normCut += sCoef * sCoef; violation /= sqrt(normCut); } //------------------------------------------------------------------- // function G for computing coefficients in cMIR inequality //------------------------------------------------------------------- inline double CglMixedIntegerRounding::functionG( const double d, const double f ) const { double delta = d - floor(d) - f; if (delta > EPSILON_) return floor(d) + delta / (1 - f); else return floor(d); } //------------------------------------------------------------------- // Printing statistics //------------------------------------------------------------------- void CglMixedIntegerRounding::printStats( std::ofstream & fout, const bool hasCut, const OsiSolverInterface& si, const CoinPackedVector& rowAggregated, const double& rhsAggregated, const double* xlp, const double* xlpExtra, const int* listRowsAggregated, const int* listColsSelected, const int level, const double* colUpperBound, const double* colLowerBound ) const { const int numColsAggregated = rowAggregated.getNumElements(); const int *rowAggregatedIndices = rowAggregated.getIndices(); const double *rowAggregatedElements = rowAggregated.getElements(); fout << "Rows "; for (int i = 0; i < level; ++i) { fout << listRowsAggregated[i] << " "; } fout << std::endl; int numColsBack = 0; // go through all the variables for (int j = 0; j < numColsAggregated; ++j) { // get index and coefficient of column j in the aggregated row int indCol = rowAggregatedIndices[j]; double coefCol = rowAggregatedElements[j]; // check if a column used in aggregation is back into the aggregated row for (int i = 0; i < level-1; ++i) { if ( (listColsSelected[i] == indCol) && (coefCol != 0) ) { numColsBack++; break; } } if (fabs(coefCol) < EPSILON_) { // print variable number and coefficient fout << indCol << " " << 0.0 << std::endl; continue; } else { // print variable number and coefficient fout << indCol << " " << coefCol << " "; } // integer variables if ( (indCol < numCols_) && (!si.isContinuous(indCol)) ) { // print fout << "I " << xlp[indCol] << " " << colLowerBound[indCol] << " " << colUpperBound[indCol] << std::endl; continue; } // continuous variables if (indCol < numCols_) { // variable is model variable // print fout << "C " << xlp[indCol] << " " << colLowerBound[indCol] << " " << colUpperBound[indCol] << " "; // variable lower bound? CglMixIntRoundVLB VLB = vlbs_[indCol]; if (VLB.getVar() != UNDEFINED_) { fout << VLB.getVal() << " " << xlp[VLB.getVar()] << " " << colLowerBound[VLB.getVar()] << " " << colUpperBound[VLB.getVar()] << " "; } else { fout << "-1 -1 -1 -1 "; } // variable upper bound? CglMixIntRoundVUB VUB = vubs_[indCol]; if (VUB.getVar() != UNDEFINED_) { fout << VUB.getVal() << " " << xlp[VUB.getVar()] << " " << colLowerBound[VUB.getVar()] << " " << colUpperBound[VUB.getVar()] << " "; } else { fout << "-1 -1 -1 -1 "; } } else { // variable is slack variable // in this case the LB = 0 and the UB = infinity // print fout << "C " << xlpExtra[indCol-numCols_] << " " << 0.0 << " " << si.getInfinity() << " "; } fout << std::endl; } fout << "rhs " << rhsAggregated << std::endl; fout << "numColsBack " << numColsBack << std::endl; if (hasCut) { fout << "CUT: YES" << std::endl; } else { fout << "CUT: NO" << std::endl; } } // This can be used to refresh any inforamtion void CglMixedIntegerRounding::refreshSolver(OsiSolverInterface * ) { doneInitPre_ = false; } // Create C++ lines to get to current state std::string CglMixedIntegerRounding::generateCpp( FILE * fp) { CglMixedIntegerRounding other; fprintf(fp,"0#include \"CglMixedIntegerRounding.hpp\"\n"); fprintf(fp,"3 CglMixedIntegerRounding mixedIntegerRounding;\n"); if (MAXAGGR_!=other.MAXAGGR_) fprintf(fp,"3 mixedIntegerRounding.setMAXAGGR_(%d);\n",MAXAGGR_); else fprintf(fp,"4 mixedIntegerRounding.setMAXAGGR_(%d);\n",MAXAGGR_); if (MULTIPLY_!=other.MULTIPLY_) fprintf(fp,"3 mixedIntegerRounding.setMULTIPLY_(%d);\n",MULTIPLY_); else fprintf(fp,"4 mixedIntegerRounding.setMULTIPLY_(%d);\n",MULTIPLY_); if (CRITERION_!=other.CRITERION_) fprintf(fp,"3 mixedIntegerRounding.setCRITERION_(%d);\n",CRITERION_); if (doPreproc_!=other.doPreproc_) fprintf(fp,"3 mixedIntegerRounding.setDoPreproc_(%d);\n", doPreproc_); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 mixedIntegerRounding.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 mixedIntegerRounding.setAggressiveness(%d);\n",getAggressiveness()); return "mixedIntegerRounding"; } void CglMixedIntegerRounding::setDoPreproc(int value) { if (value != -1 && value != 0 && value != 1) { throw CoinError("setDoPrepoc", "invalid value", "CglMixedIntegerRounding2"); } else { doPreproc_ = value; } } bool CglMixedIntegerRounding::getDoPreproc() const { return (doPreproc_!=0); } CoinMP-1.8.3/Cgl/src/CglProbing/0000755000175000017500000000000012600453456014643 5ustar renereneCoinMP-1.8.3/Cgl/src/CglProbing/Makefile.in0000644000175000017500000005435012506321416016712 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglProbing DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglProbing_la_LIBADD = am_libCglProbing_la_OBJECTS = CglProbing.lo CglProbingTest.lo libCglProbing_la_OBJECTS = $(am_libCglProbing_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglProbing_la_SOURCES) DIST_SOURCES = $(libCglProbing_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglCglProbing # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglProbing.la # List all source files for this library, including headers libCglProbing_la_SOURCES = CglProbing.cpp CglProbing.hpp CglProbingTest.cpp # This is for libtool (on Windows) libCglProbing_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglProbing.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglProbing/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglProbing/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglProbing.la: $(libCglProbing_la_OBJECTS) $(libCglProbing_la_DEPENDENCIES) $(CXXLINK) $(libCglProbing_la_LDFLAGS) $(libCglProbing_la_OBJECTS) $(libCglProbing_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglProbing.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglProbingTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglProbing/CglProbingTest.cpp0000644000175000017500000001301412130103340020212 0ustar renerene// $Id: CglProbingTest.cpp 1120 2013-04-06 20:34:40Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CoinPackedMatrix.hpp" #include "CglProbing.hpp" //-------------------------------------------------------------------------- // test EKKsolution methods. void CglProbingUnitTest( const OsiSolverInterface * baseSiP, const std::string mpsDir ) { # ifdef CGL_DEBUG int i ; // define just once # endif CoinRelFltEq eq(0.000001); // Test default constructor { CglProbing aGenerator; } // Test copy & assignment { CglProbing rhs; { CglProbing bGenerator; CglProbing cGenerator(bGenerator); rhs=bGenerator; } } { OsiCuts osicuts; CglProbing test1; OsiSolverInterface * siP = baseSiP->clone(); int nColCuts; int nRowCuts; std::string fn = mpsDir+"p0033"; siP->readMps(fn.c_str(),"mps"); siP->initialSolve(); // just unsatisfied variables test1.generateCuts(*siP,osicuts); nColCuts = osicuts.sizeColCuts(); nRowCuts = osicuts.sizeRowCuts(); std::cout<<"There are "<getColLower(); const double * up = siP->getColUpper(); for (i=0; ilo[icol]) std::cout<<"Can increase lb on "<getColSolution(); rcut = osicuts.rowCut(i); rpv = rcut.row(); const int n = rpv.getNumElements(); const int * indices = rpv.getIndices(); double* elements = rpv.getElements(); double sum2=0.0; int k=0; double lb=rcut.lb(); double ub=rcut.ub(); for (k=0; kub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<getColLower(); const double * up = siP->getColUpper(); for (i=0; ilo[icol]) std::cout<<"Can increase lb on "<getColSolution(); rcut = osicuts.rowCut(i); rpv = rcut.row(); const int n = rpv.getNumElements(); const int * indices = rpv.getIndices(); double* elements = rpv.getElements(); double sum2=0.0; int k=0; double lb=rcut.lb(); double ub=rcut.ub(); for (k=0; kub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<=4); delete siP; } } CoinMP-1.8.3/Cgl/src/CglProbing/Makefile.am0000644000175000017500000000320311621724114016667 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglCglProbing # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglProbing.la # List all source files for this library, including headers libCglProbing_la_SOURCES = CglProbing.cpp CglProbing.hpp CglProbingTest.cpp # This is for libtool (on Windows) libCglProbing_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglProbing.hpp CoinMP-1.8.3/Cgl/src/CglProbing/CglProbing.hpp0000644000175000017500000004506212306400264017401 0ustar renerene// $Id: CglProbing.hpp 1201 2014-03-07 17:24:04Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglProbing_H #define CglProbing_H #include #include "CglCutGenerator.hpp" /** Only useful type of disaggregation is most normal For now just done for 0-1 variables Can be used for building cliques */ typedef struct { //unsigned int zeroOne:1; // nonzero if affected variable is 0-1 //unsigned int whenAtUB:1; // nonzero if fixing happens when this variable at 1 //unsigned int affectedToUB:1; // nonzero if affected variable fixed to UB //unsigned int affected:29; // If 0-1 then 0-1 sequence, otherwise true unsigned int affected; } disaggregationAction; /** Probing Cut Generator Class */ class CglProbing : public CglCutGenerator { friend void CglProbingUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /**@name Generate Cuts */ //@{ /** Generate probing/disaggregation cuts for the model of the solver interface, si. This is a simplification of probing ideas put into OSL about ten years ago. The only known documentation is a copy of a talk handout - we think Robin Lougee-Heimer has a copy! For selected integer variables (e.g. unsatisfied ones) the effect of setting them up or down is investigated. Setting a variable up may in turn set other variables (continuous as well as integer). There are various possible results: 1) It is shown that problem is infeasible (this may also be because objective function or reduced costs show worse than best solution). If the other way is feasible we can generate a column cut (and continue probing), if not feasible we can say problem infeasible. 2) If both ways are feasible, it can happen that x to 0 implies y to 1 ** and x to 1 implies y to 1 (again a column cut). More common is that x to 0 implies y to 1 and x to 1 implies y to 0 so we could substitute for y which might lead later to more powerful cuts. ** This is not done in this code as there is no mechanism for returning information. 3) When x to 1 a constraint went slack by c. We can tighten the constraint ax + .... <= b (where a may be zero) to (a+c)x + .... <= b. If this cut is violated then it is generated. 4) Similarly we can generate implied disaggregation cuts Note - differences to cuts in OSL. a) OSL had structures intended to make this faster. b) The "chaining" in 2) was done c) Row cuts modified original constraint rather than adding cut b) This code can cope with general integer variables. Insert the generated cuts into OsiCut, cs. If a "snapshot" of a matrix exists then this will be used. Presumably this will give global cuts and will be faster. No check is done to see if cuts will be global. Otherwise use current matrix. Both row cuts and column cuts may be returned The mode options are: 0) Only unsatisfied integer variables will be looked at. If no information exists for that variable then probing will be done so as a by-product you "may" get a fixing or infeasibility. This will be fast and is only available if a snapshot exists (otherwise as 1). The bounds in the snapshot are the ones used. 1) Look at unsatisfied integer variables, using current bounds. Probing will be done on all looked at. 2) Look at all integer variables, using current bounds. Probing will be done on all ** If generateCutsAndModify is used then new relaxed row bounds and tightened column bounds are generated Returns number of infeasibilities */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); int generateCutsAndModify( const OsiSolverInterface & si, OsiCuts & cs, CglTreeInfo * info); //@} /**@name snapshot etc */ //@{ /** Create a copy of matrix which is to be used this is to speed up process and to give global cuts Can give an array with 1 set to select, 0 to ignore column bounds are tightened If array given then values of 1 will be set to 0 if redundant. Objective may be added as constraint Returns 1 if infeasible otherwise 0 */ int snapshot ( const OsiSolverInterface & si, char * possible=NULL, bool withObjective=true); /// Deletes snapshot void deleteSnapshot ( ); /** Creates cliques for use by probing. Only cliques >= minimumSize and < maximumSize created Can also try and extend cliques as a result of probing (root node). Returns number of cliques found. */ int createCliques( OsiSolverInterface & si, int minimumSize=2, int maximumSize=100); /// Delete all clique information void deleteCliques(); /** Create a fake model by adding cliques if type&4 then delete rest of model first, if 1 then add proper cliques, 2 add fake cliques */ OsiSolverInterface * cliqueModel(const OsiSolverInterface * model, int type); //@} /**@name Get tighter column bounds */ //@{ /// Lower const double * tightLower() const; /// Upper const double * tightUpper() const; /// Array which says tighten continuous const char * tightenBounds() const { return tightenBounds_;} //@} /**@name Get possible freed up row bounds - only valid after mode==3 */ //@{ /// Lower const double * relaxedRowLower() const; /// Upper const double * relaxedRowUpper() const; //@} /**@name Change mode */ //@{ /// Set void setMode(int mode); /// Get int getMode() const; //@} /**@name Change maxima */ //@{ /// Set maximum number of passes per node void setMaxPass(int value); /// Get maximum number of passes per node int getMaxPass() const; /// Set log level - 0 none, 1 - a bit, 2 - more details void setLogLevel(int value); /// Get log level int getLogLevel() const; /// Set maximum number of unsatisfied variables to look at void setMaxProbe(int value); /// Get maximum number of unsatisfied variables to look at int getMaxProbe() const; /// Set maximum number of variables to look at in one probe void setMaxLook(int value); /// Get maximum number of variables to look at in one probe int getMaxLook() const; /// Set maximum number of elements in row for it to be considered void setMaxElements(int value); /// Get maximum number of elements in row for it to be considered int getMaxElements() const; /// Set maximum number of passes per node (root node) void setMaxPassRoot(int value); /// Get maximum number of passes per node (root node) int getMaxPassRoot() const; /// Set maximum number of unsatisfied variables to look at (root node) void setMaxProbeRoot(int value); /// Get maximum number of unsatisfied variables to look at (root node) int getMaxProbeRoot() const; /// Set maximum number of variables to look at in one probe (root node) void setMaxLookRoot(int value); /// Get maximum number of variables to look at in one probe (root node) int getMaxLookRoot() const; /// Set maximum number of elements in row for it to be considered (root node) void setMaxElementsRoot(int value); /// Get maximum number of elements in row for it to be considered (root node) int getMaxElementsRoot() const; /** Returns true if may generate Row cuts in tree (rather than root node). Used so know if matrix will change in tree. Really meant so column cut generators can still be active without worrying code. Default is true */ virtual bool mayGenerateRowCutsInTree() const; //@} /**@name Get information back from probing */ //@{ /// Number looked at this time inline int numberThisTime() const { return numberThisTime_;} /// Which ones looked at this time inline const int * lookedAt() const { return lookedAt_;} //@} /**@name Stop or restart row cuts (otherwise just fixing from probing) */ //@{ /// Set /// 0 no cuts, 1 just disaggregation type, 2 coefficient ( 3 both) void setRowCuts(int type); /// Get int rowCuts() const; //@} /// Clique type typedef struct { unsigned int equality:1; // nonzero if clique is == } CliqueType; /**@name Information on cliques */ //@{ /// Number of cliques inline int numberCliques() const { return numberCliques_;} /// Clique type inline CliqueType * cliqueType() const { return cliqueType_;} /// Start of each clique inline int * cliqueStart() const { return cliqueStart_;} /// Entries for clique inline CliqueEntry * cliqueEntry() const { return cliqueEntry_;} //@} /**@name Whether use objective as constraint */ //@{ /** Set 0 don't 1 do -1 don't even think about it */ void setUsingObjective(int yesNo); /// Get int getUsingObjective() const; //@} /**@name Mark which continuous variables are to be tightened */ //@{ /// Mark variables to be tightened void tightenThese(const OsiSolverInterface & solver, int number, const int * which); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglProbing (); /// Copy constructor CglProbing ( const CglProbing &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglProbing & operator=( const CglProbing& rhs); /// Destructor virtual ~CglProbing (); /// This can be used to refresh any inforamtion virtual void refreshSolver(OsiSolverInterface * solver); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} private: // Private member methods /**@name probe */ //@{ /// Does probing and adding cuts (without cliques and mode_!=0) int probe( const OsiSolverInterface & si, const OsiRowCutDebugger * debugger, OsiCuts & cs, double * colLower, double * colUpper, CoinPackedMatrix *rowCopy, CoinPackedMatrix *columnCopy,const CoinBigIndex * rowStartPos, const int * realRow, const double * rowLower, const double * rowUpper, const char * intVar, double * minR, double * maxR, int * markR, CglTreeInfo * info); /// Does probing and adding cuts (with cliques) int probeCliques( const OsiSolverInterface & si, const OsiRowCutDebugger * debugger, OsiCuts & cs, double * colLower, double * colUpper, CoinPackedMatrix *rowCopy, CoinPackedMatrix *columnCopy, const int * realRow, double * rowLower, double * rowUpper, char * intVar, double * minR, double * maxR, int * markR, CglTreeInfo * info); /// Does probing and adding cuts for clique slacks int probeSlacks( const OsiSolverInterface & si, const OsiRowCutDebugger * debugger, OsiCuts & cs, double * colLower, double * colUpper, CoinPackedMatrix *rowCopy, CoinPackedMatrix *columnCopy, double * rowLower, double * rowUpper, char * intVar, double * minR, double * maxR,int * markR, CglTreeInfo * info); /** Does most of work of generateCuts Returns number of infeasibilities */ int gutsOfGenerateCuts( const OsiSolverInterface & si, OsiCuts & cs, double * rowLower, double * rowUpper, double * colLower, double * colUpper, CglTreeInfo * info); /// Sets up clique information for each row void setupRowCliqueInformation(const OsiSolverInterface & si); /** This tightens column bounds (and can declare infeasibility) It may also declare rows to be redundant */ int tighten(double *colLower, double * colUpper, const int *column, const double *rowElements, const CoinBigIndex *rowStart,const CoinBigIndex * rowStartPos, const int * rowLength, double *rowLower, double *rowUpper, int nRows,int nCols,char * intVar,int maxpass, double tolerance); /// This just sets minima and maxima on rows void tighten2(double *colLower, double * colUpper, const int *column, const double *rowElements, const CoinBigIndex *rowStart, const int * rowLength, double *rowLower, double *rowUpper, double * minR, double * maxR, int * markR, int nRows); //@} // Private member data struct disaggregation_struct_tag ; friend struct CglProbing::disaggregation_struct_tag ; /**@name Private member data */ //@{ /// Row copy (only if snapshot) CoinPackedMatrix * rowCopy_; /// Column copy (only if snapshot) CoinPackedMatrix * columnCopy_; /// Lower bounds on rows double * rowLower_; /// Upper bounds on rows double * rowUpper_; /// Lower bounds on columns double * colLower_; /// Upper bounds on columns double * colUpper_; /// Number of rows in snapshot (or when cliqueRow stuff computed) int numberRows_; /// Number of columns in problem ( must == current) int numberColumns_; /// Tolerance to see if infeasible double primalTolerance_; /** Mode - 0 lazy using snapshot, 1 just unsatisfied, 2 all. 16 bit set if want to extend cliques at root node */ int mode_; /** Row cuts flag 0 no cuts, 1 just disaggregation type, 2 coefficient ( 3 both), 4 just column cuts -n as +n but just fixes variables unless at root */ int rowCuts_; /// Maximum number of passes to do in probing int maxPass_; /// Log level - 0 none, 1 - a bit, 2 - more details int logLevel_; /// Maximum number of unsatisfied variables to probe int maxProbe_; /// Maximum number of variables to look at in one probe int maxStack_; /// Maximum number of elements in row for scan int maxElements_; /// Maximum number of passes to do in probing at root int maxPassRoot_; /// Maximum number of unsatisfied variables to probe at root int maxProbeRoot_; /// Maximum number of variables to look at in one probe at root int maxStackRoot_; /// Maximum number of elements in row for scan at root int maxElementsRoot_; /// Whether to include objective as constraint int usingObjective_; /// Number of integer variables int numberIntegers_; /// Number of 0-1 integer variables int number01Integers_; /// Number looked at this time int numberThisTime_; /// Total number of times called int totalTimesCalled_; /// Which ones looked at this time int * lookedAt_; /// Disaggregation cuts and for building cliques typedef struct disaggregation_struct_tag { int sequence; // integer variable // index will be NULL if no probing done yet int length; // length of newValue disaggregationAction * index; // columns whose bounds will be changed } disaggregation; disaggregation * cutVector_; /// Cliques /// Number of cliques int numberCliques_; /// Clique type CliqueType * cliqueType_; /// Start of each clique int * cliqueStart_; /// Entries for clique CliqueEntry * cliqueEntry_; /** Start of oneFixes cliques for a column in matrix or -1 if not in any clique */ int * oneFixStart_; /** Start of zeroFixes cliques for a column in matrix or -1 if not in any clique */ int * zeroFixStart_; /// End of fixes for a column int * endFixStart_; /// Clique numbers for one or zero fixes int * whichClique_; /** For each column with nonzero in row copy this gives a clique "number". So first clique mentioned in row is always 0. If no entries for row then no cliques. If sequence > numberColumns then not in clique. */ CliqueEntry * cliqueRow_; /// cliqueRow_ starts for each row int * cliqueRowStart_; /// If not null and [i] !=0 then also tighten even if continuous char * tightenBounds_; //@} }; inline int affectedInDisaggregation(const disaggregationAction & dis) { return dis.affected&0x1fffffff;} inline void setAffectedInDisaggregation(disaggregationAction & dis, int affected) { dis.affected = affected|(dis.affected&0xe0000000);} #ifdef NDEBUG inline bool zeroOneInDisaggregation(const disaggregationAction & ) { return true;} #else inline bool zeroOneInDisaggregation(const disaggregationAction & dis) //{ return (dis.affected&0x80000000)!=0;} { assert ((dis.affected&0x80000000)!=0); return true;} #endif inline void setZeroOneInDisaggregation(disaggregationAction & dis,bool zeroOne) { dis.affected = (zeroOne ? 0x80000000 : 0)|(dis.affected&0x7fffffff);} inline bool whenAtUBInDisaggregation(const disaggregationAction & dis) { return (dis.affected&0x40000000)!=0;} inline void setWhenAtUBInDisaggregation(disaggregationAction & dis,bool whenAtUB) { dis.affected = (whenAtUB ? 0x40000000 : 0)|(dis.affected&0xbfffffff);} inline bool affectedToUBInDisaggregation(const disaggregationAction & dis) { return (dis.affected&0x20000000)!=0;} inline void setAffectedToUBInDisaggregation(disaggregationAction & dis,bool affectedToUB) { dis.affected = (affectedToUB ? 0x20000000 : 0)|(dis.affected&0xdfffffff);} //############################################################################# /** A function that tests the methods in the CglProbing class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglProbingUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); /// This just uses implication info class CglImplication : public CglCutGenerator { public: /**@name Generate Cuts */ //@{ /** Generate cuts from implication table Insert generated cuts into the cut set cs. */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglImplication (); /// Constructor with info CglImplication (CglTreeProbingInfo * info); /// Copy constructor CglImplication ( const CglImplication &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglImplication & operator=( const CglImplication& rhs); /// Destructor virtual ~CglImplication (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} /**@name Set implication */ //@{ /// Set implication inline void setProbingInfo(CglTreeProbingInfo * info) { probingInfo_=info;} //@} private: /**@name Private member data */ //@{ /// Pointer to tree probing info CglTreeProbingInfo * probingInfo_; //@} }; #endif CoinMP-1.8.3/Cgl/src/CglProbing/CglProbing.cpp0000644000175000017500000122100212522171651017370 0ustar renerene// $Id: CglProbing.cpp 1294 2015-05-05 16:45:29Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include #define PROBING100 0 //#define PRINT_DEBUG //#define CGL_DEBUG 1 //#undef NDEBUG #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" #include "OsiRowCutDebugger.hpp" #include "CglProbing.hpp" //#define PROBING_EXTRA_STUFF true #define PROBING_EXTRA_STUFF false #define FIXED_ALLOWANCE 10 #define SIZE_ROW_MULT 4 #define SIZE_ROW_ADD 2000 typedef struct {double infeasibility;int sequence;} double_int_pair; class double_int_pair_compare { public: bool operator() (double_int_pair x , double_int_pair y) const { return ( x.infeasibility < y.infeasibility); } }; // for hashing typedef struct { int index, next; } CoinHashLink; static double multiplier[] = {1.23456789e2,-9.87654321}; static int hashCut (const OsiRowCut2 & x, int size) { int xN =x.row().getNumElements(); double xLb = x.lb(); double xUb = x.ub(); const int * xIndices = x.row().getIndices(); const double * xElements = x.row().getElements(); unsigned int hashValue; double value=1.0; if (xLb>-1.0e10) value += xLb*multiplier[0]; if (xUb<1.0e10) value += xUb*multiplier[1]; for( int j=0;jsizeof(hashValue)) { assert (sizeof(value)==2*sizeof(hashValue)); union { double d; int i[2]; } xx; xx.d = value; hashValue = (xx.i[0] + xx.i[1]); } else { assert (sizeof(value)==sizeof(hashValue)); union { double d; unsigned int i[2]; } xx; xx.d = value; hashValue = xx.i[0]; } return hashValue%(size); } static bool same (const OsiRowCut2 & x, const OsiRowCut2 & y) { int xN =x.row().getNumElements(); int yN =y.row().getNumElements(); bool identical=false; if (xN==yN) { double xLb = x.lb(); double xUb = x.ub(); double yLb = y.lb(); double yUb = y.ub(); if (fabs(xLb-yLb)<1.0e-8&&fabs(xUb-yUb)<1.0e-8) { const int * xIndices = x.row().getIndices(); const double * xElements = x.row().getElements(); const int * yIndices = y.row().getIndices(); const double * yElements = y.row().getElements(); int j; for( j=0;j1.0e-12) break; } identical = (j==xN); } } return identical; } class row_cut { public: row_cut(int nRows, bool initialPass ) { numberCuts_=0; if (nRows<500) { maxSize_ = SIZE_ROW_MULT*nRows + SIZE_ROW_ADD; } else if (nRows<5000) { maxSize_ = (SIZE_ROW_MULT*nRows + SIZE_ROW_ADD)>>1; } else if (nRows<10000) { maxSize_ = (SIZE_ROW_MULT*(nRows>>1) + SIZE_ROW_ADD)>>1; } else { maxSize_ = (SIZE_ROW_MULT*CoinMin(nRows,100000) + SIZE_ROW_ADD)>>2; } size_ = (maxSize_>>3)+10; if (initialPass) size_ = size_>>1; if (size_<1000) hashSize_=4*size_; else hashSize_=2*size_; nRows_ = nRows; rowCut_ = new OsiRowCut2 * [size_]; hash_ = new CoinHashLink[hashSize_]; for (int i=0;i= 0 ) { if ( !same(*temp[i],*temp[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=i; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_1.0e12) bad=true; } if (bad) return 1; OsiRowCut2 newCut(whichRow); newCut.setLb(newLb); newCut.setUb(newUb); newCut.setRow(vector); int ipos = hashCut(newCut,hashSize_); int found = -1; int jpos=ipos; while ( true ) { int j1 = hash_[ipos].index; if ( j1 >= 0 ) { if ( !same(newCut,*rowCut_[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=numberCuts_; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_setLb(newLb); newCutPtr->setUb(newUb); newCutPtr->setRow(vector); rowCut_[numberCuts_++]=newCutPtr; return 0; } else { return 1; } } else { return -1; } } void addCuts(OsiCuts & cs, OsiRowCut ** whichRow,int iPass) { int numberCuts=cs.sizeRowCuts(); int i ; if (numberCuts_whichRow(); if (iRow>=0&&!whichRow[iRow]) whichRow[iRow]=cs.rowCutPtr(numberCuts);; } numberCuts++; } } else { for (i=numberCuts_-1;i>=0;i--) { cs.insert(*rowCut_[i]); if (whichRow) { int iRow= rowCut_[i]->whichRow(); if (iRow>=0&&!whichRow[iRow]) whichRow[iRow]=cs.rowCutPtr(numberCuts);; } numberCuts++; } } } else { // just best double * effectiveness = new double[numberCuts_]; int iCut=0; for (i=0;ieffectiveness(); if (whichRow) { int iRow= rowCut_[i]->whichRow(); if (iRow>=0) value -= 1.0e10; } effectiveness[iCut++]=value; } std::sort(effectiveness,effectiveness+numberCuts_); double threshold = -1.0e20; if (iCut>nRows_) threshold = effectiveness[nRows_]; for ( i=0;ieffectiveness()>threshold) { cs.insert(*rowCut_[i]); if (whichRow) { int iRow= rowCut_[i]->whichRow(); if (iRow>=0&&!whichRow[iRow]) whichRow[iRow]=cs.rowCutPtr(numberCuts);; } numberCuts++; } } delete[] effectiveness ; } for (i = 0 ; i < numberCuts_ ; i++) { delete rowCut_[i] ; rowCut_[i] = 0 ; } numberCuts_=0; } }; // Adds in cut to list #ifdef CGL_DEBUG // Checks bounds okay against debugger static void checkBounds(const OsiRowCutDebugger * debugger,OsiColCut & cut) { if (debugger) { // on optimal path const double * optimal = debugger->optimalSolution(); int i; int nIndex; const double * values; const int * index; const CoinPackedVector & lbs = cut.lbs(); values = lbs.getElements(); nIndex = lbs.getNumElements(); index = lbs.getIndices(); for (i=0;i=optimal[iColumn]-1.0e-5); } } } #endif #define CGL_REASONABLE_INTEGER_BOUND 1.23456789e10 // This tightens column bounds (and can declare infeasibility) // It may also declare rows to be redundant int CglProbing::tighten(double *colLower, double * colUpper, const int *column, const double *rowElements, const CoinBigIndex *rowStart, const CoinBigIndex * rowStartPos,const int * rowLength, double *rowLower, double *rowUpper, int nRows,int nCols,char * intVar,int maxpass, double tolerance) { int i, j, k, kre; int krs; int dolrows; int iflagu, iflagl; int ntotal=0,nchange=1,jpass=0; double dmaxup, dmaxdown, dbound; int ninfeas=0; // For clique stuff double * cliqueMin=NULL; double * cliqueMax=NULL; // And second best ones double * cliqueMin2 = NULL; double * cliqueMax2 = NULL; if (cliqueRowStart_&&numberRows_&&cliqueRowStart_[numberRows_]) { cliqueMin = new double[nCols]; cliqueMax = new double[nCols]; cliqueMin2 = new double[nCols]; cliqueMax2 = new double[nCols]; } else { // do without cliques and using sorted version assert (rowStartPos); while(nchange) { nchange = 0; if (jpass==maxpass) break; jpass++; dolrows = (jpass & 1) == 1; for (i = 0; i < nRows; ++i) { if (rowLower[i]>-1.0e20||rowUpper[i]<1.0e20) { int iflagu = 0; int iflagl = 0; double dmaxup = 0.0; double dmaxdown = 0.0; int krs = rowStart[i]; int krs2 = rowStartPos[i]; int kre = rowStart[i]+rowLength[i]; /* ------------------------------------------------------------*/ /* Compute L(i) and U(i) */ /* ------------------------------------------------------------*/ for (k = krs; k < krs2; ++k) { double value=rowElements[k]; int j = column[k]; if (colUpper[j] < 1.0e12) dmaxdown += colUpper[j] * value; else ++iflagl; if (colLower[j] > -1.0e12) dmaxup += colLower[j] * value; else ++iflagu; } for (k = krs2; k < kre; ++k) { double value=rowElements[k]; int j = column[k]; if (colUpper[j] < 1.0e12) dmaxup += colUpper[j] * value; else ++iflagu; if (colLower[j] > -1.0e12) dmaxdown += colLower[j] * value; else ++iflagl; } if (iflagu) dmaxup=1.0e31; if (iflagl) dmaxdown=-1.0e31; if (dmaxup <= rowUpper[i] + tolerance && dmaxdown >= rowLower[i] - tolerance) { /* * The sum of the column maxs is at most the row ub, and * the sum of the column mins is at least the row lb; * this row says nothing at all. * I suspect that this corresponds to * an implied column singleton in the paper (viii, on p. 325), * where the singleton in question is the row slack. */ ++nchange; rowLower[i]=-COIN_DBL_MAX; rowUpper[i]=COIN_DBL_MAX; } else { if (dmaxup < rowLower[i] -tolerance || dmaxdown > rowUpper[i]+tolerance) { ninfeas++; break; } /* Finite U(i) */ /* -------------------------------------------------------------*/ /* below is deliberate mistake (previously was by chance) */ /* never do both */ if (iflagu == 0 && rowLower[i] > 0.0 && iflagl == 0 && rowUpper[i] < 1e15) { if (dolrows) { iflagu = 1; } else { iflagl = 1; } } if (iflagu == 0 && rowLower[i] > -1e15) { for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; if (value > 0.0) { if (colUpper[j] < 1.0e12) { dbound = colUpper[j] + (rowLower[i] - dmaxup) / value; if (dbound > colLower[j] + 1.0e-8) { /* we can tighten the lower bound */ /* the paper mentions this as a possibility on p. 227 */ colLower[j] = dbound; ++nchange; /* this may have fixed the variable */ /* I believe that this roughly corresponds to a * forcing constraint in the paper (p. 226). * If there is a forcing constraint (with respect * to the original, untightened bounds), then in this * loop we will go through all the columns and fix * each of them to their implied bound, rather than * determining that the row as a whole is forced * and just fixing them without doing computation for * each column (as in the paper). * By doing it this way, we can tighten bounds and * get forcing constraints for free. */ if (colUpper[j] - colLower[j] <= tolerance) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } } } } else { if (colLower[j] > -1.0e12) { dbound = colLower[j] + (rowLower[i] - dmaxup) / value; if (dbound < colUpper[j] - 1.0e-8) { colUpper[j] = dbound; ++nchange; if (colUpper[j] - colLower[j] <= tolerance) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } } } } } } /* ----------------------------------------------------------------*/ /* Finite L(i) */ /* ----------------------------------------------------------------*/ if (iflagl == 0 && rowUpper[i] < 1e15) { for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; if (value < 0.0) { if (colUpper[j] < 1.0e12) { dbound = colUpper[j] + (rowUpper[i] - dmaxdown) / value; if (dbound > colLower[j] + 1.0e-8) { colLower[j] = dbound; ++nchange; if (! (colUpper[j] - colLower[j] > tolerance)) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } } } } else { if (colLower[j] > -1.0e12) { dbound = colLower[j] + (rowUpper[i] - dmaxdown) / value; if (dbound < colUpper[j] - 1.0e-8) { colUpper[j] = dbound; ++nchange; if (! (colUpper[j] - colLower[j] > tolerance)) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } } } } } } } } } for (j = 0; j < nCols; ++j) { if (intVar[j]) { if (colUpper[j]-colLower[j]>1.0e-8) { if (floor(colUpper[j]+1.0e-4)colLower[j]) nchange++; // clean up anyway colLower[j]=ceil(colLower[j]-1.0e-4); if (colUpper[j]-1.0e20||rowUpper[i]<1.0e20) { iflagu = 0; iflagl = 0; dmaxup = 0.0; dmaxdown = 0.0; krs = rowStart[i]; kre = rowStart[i]+rowLength[i]; /* ------------------------------------------------------------*/ /* Compute L(i) and U(i) */ /* ------------------------------------------------------------*/ if (!cliqueMin||i>=numberRows_||cliqueRowStart_[i]==cliqueRowStart_[i+1]) { // without cliques for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; if (value > 0.0) { if (colUpper[j] < 1.0e12) dmaxup += colUpper[j] * value; else ++iflagu; if (colLower[j] > -1.0e12) dmaxdown += colLower[j] * value; else ++iflagl; } else if (value<0.0) { if (colUpper[j] < 1.0e12) dmaxdown += colUpper[j] * value; else ++iflagl; if (colLower[j] > -1.0e12) dmaxup += colLower[j] * value; else ++iflagu; } } if (iflagu) dmaxup=1.0e31; if (iflagl) dmaxdown=-1.0e31; } else { // with cliques int nClique=0; int bias = cliqueRowStart_[i]-krs; double dmaxup2=0.0; double dmaxdown2=0.0; double sumZeroFixes=0.0; for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; int iClique = sequenceInCliqueEntry(cliqueRow_[k+bias]); bool oneFixes = oneFixesInCliqueEntry(cliqueRow_[k+bias]); if (iClique>=numberColumns_||colUpper[j]==colLower[j]) { if (value > 0.0) { if (colUpper[j] >= 1.0e12) { dmaxup = 1e31; ++iflagu; } else { dmaxup += colUpper[j] * value; } if (colLower[j] <= -1.0e12) { dmaxdown = -1e31; ++iflagl; } else { dmaxdown += colLower[j] * value; } } else if (value<0.0) { if (colUpper[j] >= 1.0e12) { dmaxdown = -1e31; ++iflagl; } else { dmaxdown += colUpper[j] * value; } if (colLower[j] <= -1.0e12) { dmaxup = 1e31; ++iflagu; } else { dmaxup += colLower[j] * value; } } } else { // clique may help if (iClique>=nClique) { //zero out for (int j=nClique;j<=iClique;j++) { cliqueMin[j]=0.0; cliqueMax[j]=0.0; cliqueMin2[j]=0.0; cliqueMax2[j]=0.0; } nClique=iClique+1; } // Update best and second best if (oneFixes) { if (value > 0.0) { dmaxup2 += value; cliqueMax2[iClique] = cliqueMax[iClique]; cliqueMax[iClique] = CoinMax(cliqueMax[iClique],value); } else if (value<0.0) { dmaxdown2 += value; cliqueMin2[iClique] = cliqueMin[iClique]; cliqueMin[iClique] = CoinMin(cliqueMin[iClique],value); } } else { sumZeroFixes += value; if (value > 0.0) { dmaxup2 += value; cliqueMin2[iClique] = cliqueMin[iClique]; cliqueMin[iClique] = CoinMin(cliqueMin[iClique],-value); } else if (value<0.0) { dmaxdown2 += value; cliqueMax2[iClique] = cliqueMax[iClique]; cliqueMax[iClique] = CoinMax(cliqueMax[iClique],-value); } } } } double dmaxup3 = dmaxup + sumZeroFixes; double dmaxdown3 = dmaxdown + sumZeroFixes; for (int iClique=0;iClique=dmaxdown-1.0e-8); if (dmaxup3dmaxdown+1.0e-8) { cliqueChanges=true; //printf("normal min/max %g , %g clique %g , %g\n", // dmaxdown,dmaxup,dmaxdown3,dmaxup3); dmaxdown=dmaxdown3; dmaxup=dmaxup3; } } if (dmaxup <= rowUpper[i] + tolerance && dmaxdown >= rowLower[i] - tolerance) { /* * The sum of the column maxs is at most the row ub, and * the sum of the column mins is at least the row lb; * this row says nothing at all. * I suspect that this corresponds to * an implied column singleton in the paper (viii, on p. 325), * where the singleton in question is the row slack. */ ++nrwdrp; rowLower[i]=-COIN_DBL_MAX; rowUpper[i]=COIN_DBL_MAX; } else { if (dmaxup < rowLower[i] -tolerance || dmaxdown > rowUpper[i]+tolerance) { ninfeas++; assert (!cliqueChanges); break; } /* Finite U(i) */ /* -------------------------------------------------------------*/ /* below is deliberate mistake (previously was by chance) */ /* never do both */ if (iflagu == 0 && rowLower[i] > 0.0 && iflagl == 0 && rowUpper[i] < 1e15) { if (dolrows) { iflagu = 1; } else { iflagl = 1; } } if (!cliqueChanges) { // without cliques if (iflagu == 0 && rowLower[i] > -1e15) { for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; if (value > 0.0) { if (colUpper[j] < 1.0e12) { dbound = colUpper[j] + (rowLower[i] - dmaxup) / value; if (dbound > colLower[j] + 1.0e-8) { /* we can tighten the lower bound */ /* the paper mentions this as a possibility on p. 227 */ colLower[j] = dbound; ++ilbred; /* this may have fixed the variable */ /* I believe that this roughly corresponds to a * forcing constraint in the paper (p. 226). * If there is a forcing constraint (with respect * to the original, untightened bounds), then in this * loop we will go through all the columns and fix * each of them to their implied bound, rather than * determining that the row as a whole is forced * and just fixing them without doing computation for * each column (as in the paper). * By doing it this way, we can tighten bounds and * get forcing constraints for free. */ if (colUpper[j] - colLower[j] <= tolerance) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } } } } else { if (colLower[j] > -1.0e12) { dbound = colLower[j] + (rowLower[i] - dmaxup) / value; if (dbound < colUpper[j] - 1.0e-8) { colUpper[j] = dbound; ++iubred; if (colUpper[j] - colLower[j] <= tolerance) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } } } } } } /* ----------------------------------------------------------------*/ /* Finite L(i) */ /* ----------------------------------------------------------------*/ if (iflagl == 0 && rowUpper[i] < 1e15) { for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; if (value < 0.0) { if (colUpper[j] < 1.0e12) { dbound = colUpper[j] + (rowUpper[i] - dmaxdown) / value; if (dbound > colLower[j] + 1.0e-8) { colLower[j] = dbound; ++ilbred; if (! (colUpper[j] - colLower[j] > tolerance)) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } } } } else { if (colLower[j] > -1.0e12) { dbound = colLower[j] + (rowUpper[i] - dmaxdown) / value; if (dbound < colUpper[j] - 1.0e-8) { colUpper[j] = dbound; ++iubred; if (! (colUpper[j] - colLower[j] > tolerance)) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } } } } } } } else { // with cliques int bias = cliqueRowStart_[i]-krs; if (iflagu == 0 && rowLower[i] > -1e15) { for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; int iClique = sequenceInCliqueEntry(cliqueRow_[k+bias]); //bool oneFixes = (cliqueRow_[k+bias].oneFixes!=0); if (iClique>=numberColumns_) { if (value > 0.0) { if (colUpper[j] < 1.0e12) { dbound = colUpper[j] + (rowLower[i] - dmaxup) / value; if (dbound > colLower[j] + 1.0e-8) { /* we can tighten the lower bound */ /* the paper mentions this as a possibility on p. 227 */ colLower[j] = dbound; ++ilbred; /* this may have fixed the variable */ /* I believe that this roughly corresponds to a * forcing constraint in the paper (p. 226). * If there is a forcing constraint (with respect * to the original, untightened bounds), then in this * loop we will go through all the columns and fix * each of them to their implied bound, rather than * determining that the row as a whole is forced * and just fixing them without doing computation for * each column (as in the paper). * By doing it this way, we can tighten bounds and * get forcing constraints for free. */ if (colUpper[j] - colLower[j] <= tolerance) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } #if 0 } else if (intVar[j]==1 && rowUpper[i]>1.0e20) { // can we modify coefficient if (dmaxdown+value>rowLower[i]+1.0e-8) { assert (dmaxdown -1.0e12) { dbound = colLower[j] + (rowLower[i] - dmaxup) / value; if (dbound < colUpper[j] - 1.0e-8) { colUpper[j] = dbound; ++iubred; if (colUpper[j] - colLower[j] <= tolerance) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } #if 0 } else if (intVar[j]==1 && rowUpper[i]>1.0e20) { // can we modify coefficient if (dmaxdown-value>rowLower[i]+1.0e-8) { assert (dmaxdowncolLower[j]) { // in clique // adjustment double dmaxup2=dmaxup; assert (cliqueMax[iClique]>=0); assert (cliqueMax2[iClique]>=0); /* get max up if at other bound May not go down at all but will not go up */ if (fabs(value)==fabs(cliqueMax[iClique])) dmaxup2 -= cliqueMax[iClique]-cliqueMax2[iClique]; if (dmaxup2 0.0) { colLower[j] = 1.0; ++ilbred; } else { colUpper[j] = 0.0; ++iubred; } } } } } } /* ----------------------------------------------------------------*/ /* Finite L(i) */ /* ----------------------------------------------------------------*/ if (iflagl == 0 && rowUpper[i] < 1e15) { for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; int iClique = sequenceInCliqueEntry(cliqueRow_[k+bias]); //bool oneFixes = (cliqueRow_[k+bias].oneFixes!=0); if (iClique>=numberColumns_) { if (value < 0.0) { if (colUpper[j] < 1.0e12) { dbound = colUpper[j] + (rowUpper[i] - dmaxdown) / value; if (dbound > colLower[j] + 1.0e-8) { colLower[j] = dbound; ++ilbred; if (! (colUpper[j] - colLower[j] > tolerance)) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } #if 0 } else if (intVar[j]==1 && rowLower[i]<-1.0e20) { // can we modify coefficient if (dmaxup+valuerowUpper[i]-1.0e-8); double change = dmaxup+value - rowUpper[i]; double newValue = value - change; if (newValue<1.0e-12) newValue=0.0; printf("Could change value from %g to %g b\n", value,newValue); // dmaxdown -= change; } #endif } } } else { if (colLower[j] > -1.0e12) { dbound = colLower[j] + (rowUpper[i] - dmaxdown) / value; if (dbound < colUpper[j] - 1.0e-8) { colUpper[j] = dbound; ++iubred; if (! (colUpper[j] - colLower[j] > tolerance)) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if (colUpper[j] - colLower[j] < -100.0*tolerance) { ninfeas++; } } #if 0 } else if (intVar[j]==1 && rowLower[i]<-1.0e20) { // can we modify coefficient if (dmaxup-valuerowUpper[i]-1.0e-8); double change = dmaxup-value-rowUpper[i]; double newValue = value+change; double newUpper = rowUpper[i]+change; if (newValue<1.0e-12) newValue=0.0; printf("Could change value from %g to %g and uprow from %g to %g b\n", value,newValue,rowLower[i],newUpper); // dmaxup += change } #endif } } } } else if (colUpper[j]>colLower[j]) { // in clique // adjustment double dmaxdown2=dmaxdown; assert (cliqueMin[iClique]<=0); assert (cliqueMin2[iClique]<=0); /* get max down if this is at other bound May not go up at all but will not go down */ if (fabs(value)==fabs(cliqueMin[iClique])) dmaxdown2 -= cliqueMin[iClique]-cliqueMin2[iClique]; if (dmaxdown2>rowUpper[i]+1.0e-8) { /* --------------------------------------------------*/ /* check if infeasible !!!!! */ /* --------------------------------------------------*/ if ( dmaxdown>rowUpper[i]+1.0e-8) { ninfeas++; } else { if (value < 0.0) { colLower[j] = 1.0; ++ilbred; } else { colUpper[j] = 0.0; ++iubred; } } } } } } } } } } for (j = 0; j < nCols; ++j) { if (intVar[j]) { if (colUpper[j]-colLower[j]>1.0e-8) { if (floor(colUpper[j]+1.0e-4)colLower[j]) nchange++; // clean up anyway colLower[j]=ceil(colLower[j]-1.0e-4); if (colUpper[j]-1.0e20||rowUpper[i]<1.0e20) { iflagu = 0; iflagl = 0; dmaxup = 0.0; dmaxdown = 0.0; krs = rowStart[i]; kre = rowStart[i]+rowLength[i]; /* ------------------------------------------------------------*/ /* Compute L(i) and U(i) */ /* ------------------------------------------------------------*/ for (k = krs; k < kre; ++k) { double value=rowElements[k]; j = column[k]; if (value > 0.0) { if (colUpper[j] < 1.0e12) dmaxup += colUpper[j] * value; else ++iflagu; if (colLower[j] > -1.0e12) dmaxdown += colLower[j] * value; else ++iflagl; } else if (value<0.0) { if (colUpper[j] < 1.0e12) dmaxdown += colUpper[j] * value; else ++iflagl; if (colLower[j] > -1.0e12) dmaxup += colLower[j] * value; else ++iflagu; } } if (iflagu) maxR[i]=1.0e60; else maxR[i]=dmaxup; if (iflagl) minR[i]=-1.0e60; else minR[i]=dmaxdown; #if 0 if (minR[i]<-1.0e10&&maxR[i]>1.0e10) { markR[i]=-2; } else { #endif markR[i]=-1; #if 0 } #endif } else { minR[i]=-1.0e60; maxR[i]=1.0e60; #if 0 markR[i]=-2; abort(); #else markR[i]=-1; #endif } } } #ifdef CGL_DEBUG static int nPath=0; #endif //------------------------------------------------------------------- // Generate disaggregation cuts //------------------------------------------------------------------- void CglProbing::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info2) { #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&debugger->onOptimalPath(si)) { printf("On optimal path %d\n",nPath); nPath++; int nCols=si.getNumCols(); int i; const double * solution = si.getColSolution(); const double * lower = si.getColLower(); const double * upper = si.getColUpper(); const double * optimal = debugger->optimalSolution(); const double * objective = si.getObjCoefficients(); double objval1=0.0,objval2=0.0; for (i=0;i1 printf("%d %g %g %g %g\n",i,lower[i],solution[i],upper[i],optimal[i]); #endif objval1 += solution[i]*objective[i]; objval2 += optimal[i]*objective[i]; assert(optimal[i]>=lower[i]&&optimal[i]<=upper[i]); } printf("current obj %g, integer %g\n",objval1,objval2); } #endif int saveRowCuts=rowCuts_; if (rowCuts_<0) { if (info2.inTree) rowCuts_=4; else rowCuts_=-rowCuts_; } int nRows=si.getNumRows(); double * rowLower = new double[nRows+1]; double * rowUpper = new double[nRows+1]; int nCols=si.getNumCols(); // Set size if not set if (!rowCopy_) { numberRows_=nRows; numberColumns_=nCols; } double * colLower = new double[nCols]; double * colUpper = new double[nCols]; CglTreeInfo info = info2; int ninfeas=gutsOfGenerateCuts(si,cs,rowLower,rowUpper,colLower,colUpper,&info); if (ninfeas) { // generate infeasible cut and return OsiRowCut rc; rc.setLb(COIN_DBL_MAX); rc.setUb(0.0); cs.insert(rc); #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&debugger->onOptimalPath(si)) assert(!debugger->invalidCut(rc)); #endif } delete [] rowLower; delete [] rowUpper; delete [] colLower; delete [] colUpper; delete [] colLower_; delete [] colUpper_; colLower_ = NULL; colUpper_ = NULL; rowCuts_=saveRowCuts; } int CglProbing::generateCutsAndModify(const OsiSolverInterface & si, OsiCuts & cs, CglTreeInfo * info) { #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&debugger->onOptimalPath(si)) { printf("On optimal path %d\n",nPath); nPath++; int nCols=si.getNumCols(); int i; const double * solution = si.getColSolution(); const double * lower = si.getColLower(); const double * upper = si.getColUpper(); const double * optimal = debugger->optimalSolution(); const double * objective = si.getObjCoefficients(); double objval1=0.0,objval2=0.0; for (i=0;i1 printf("%d %g %g %g %g\n",i,lower[i],solution[i],upper[i],optimal[i]); #endif objval1 += solution[i]*objective[i]; objval2 += optimal[i]*objective[i]; assert(optimal[i]>=lower[i]-1.0e-5&&optimal[i]<=upper[i]+1.0e-5); } printf("current obj %g, integer %g\n",objval1,objval2); } #endif int saveRowCuts=rowCuts_; if (rowCuts_<0) { if (info->inTree) rowCuts_=4; else rowCuts_=-rowCuts_; } int saveMode = mode_; bool rowCliques=false; if (!(mode_&15)) { if (info->pass!=4||info->inTree) { mode_=1; } else { saveMode=1; // make sure do just once mode_=0; rowCliques=true; } } int nRows=si.getNumRows(); double * rowLower = new double[nRows+1]; double * rowUpper = new double[nRows+1]; int nCols=si.getNumCols(); double * colLower = new double[nCols]; double * colUpper = new double[nCols]; int ninfeas=gutsOfGenerateCuts(si,cs,rowLower,rowUpper,colLower,colUpper,info); if (ninfeas) { // generate infeasible cut and return OsiRowCut rc; rc.setLb(COIN_DBL_MAX); rc.setUb(0.0); cs.insert(rc); #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&debugger->onOptimalPath(si)) assert(!debugger->invalidCut(rc)); #endif } rowCuts_=saveRowCuts; mode_=saveMode; // move bounds so can be used by user if (mode_==3) { delete [] rowLower_; delete [] rowUpper_; rowLower_ = rowLower; rowUpper_ = rowUpper; } else { delete [] rowLower; delete [] rowUpper; } delete [] colLower_; delete [] colUpper_; colLower_ = colLower; colUpper_ = colUpper; // Setup information if (rowCliques&&numberRows_&&numberColumns_) setupRowCliqueInformation(si); return ninfeas; } bool analyze(const OsiSolverInterface * solverX, char * intVar, double * lower, double * upper) { OsiSolverInterface * solver = solverX->clone(); const double *objective = solver->getObjCoefficients() ; int numberColumns = solver->getNumCols() ; int numberRows = solver->getNumRows(); double direction = solver->getObjSense(); int iRow,iColumn; // Row copy CoinPackedMatrix matrixByRow(*solver->getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); // Column copy CoinPackedMatrix matrixByCol(*solver->getMatrixByCol()); const double * element = matrixByCol.getElements(); const int * row = matrixByCol.getIndices(); const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol.getVectorLengths(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); char * ignore = new char [numberRows]; int * which = new int[numberRows]; double * changeRhs = new double[numberRows]; memset(changeRhs,0,numberRows*sizeof(double)); memset(ignore,0,numberRows); int numberChanged=0; bool finished=false; while (!finished) { int saveNumberChanged = numberChanged; for (iRow=0;iRow lower[jColumn]+1.0e-8) { if (!intVar[jColumn]) { if (numberContinuous==0) { jColumn1=jColumn; value1=value; } else { jColumn2=jColumn; value2=value; } numberContinuous++; } else { if (fabs(value-floor(value+0.5))>1.0e-12) allIntegerCoeff=false; } } else { sumFixed += lower[jColumn]*value; } } double low = rowLower[iRow]; if (low>-1.0e20) { low -= sumFixed; if (fabs(low-floor(low+0.5))>1.0e-12) allIntegerCoeff=false; } double up = rowUpper[iRow]; if (up<1.0e20) { up -= sumFixed; if (fabs(up-floor(up+0.5))>1.0e-12) allIntegerCoeff=false; } if (!allIntegerCoeff) continue; // can't do if (numberContinuous==1) { // see if really integer // This does not allow for complicated cases if (low==up) { if (fabs(value1)>1.0e-3) { value1 = 1.0/value1; if (fabs(value1-floor(value1+0.5))<1.0e-12) { // integer numberChanged++; intVar[jColumn1]=77; } } } else { if (fabs(value1)>1.0e-3) { value1 = 1.0/value1; if (fabs(value1-floor(value1+0.5))<1.0e-12) { // This constraint will not stop it being integer ignore[iRow]=1; } } } } else if (numberContinuous==2) { if (low==up) { /* need general theory - for now just look at 2 cases - 1 - +- 1 one in column and just costs i.e. matching objective 2 - +- 1 two in column but feeds into G/L row which will try and minimize (take out 2 for now - until fixed) */ if (fabs(value1)==1.0&&value1*value2==-1.0&&!lower[jColumn1] &&!lower[jColumn2]&&columnLength[jColumn1]==1&&columnLength[jColumn2]==1) { int n=0; int i; double objChange=direction*(objective[jColumn1]+objective[jColumn2]); double bound = CoinMin(upper[jColumn1],upper[jColumn2]); bound = CoinMin(bound,1.0e20); for ( i=columnStart[jColumn1];i=0.0) { // see if all rows OK bool good=true; for (i=0;i0.0) { double rhs = rowLower[jRow]; if (rhs>0.0) { double ratio =rhs/value; if (fabs(ratio-floor(ratio+0.5))>1.0e-12) good=false; } } else { double rhs = rowUpper[jRow]; if (rhs<0.0) { double ratio =rhs/value; if (fabs(ratio-floor(ratio+0.5))>1.0e-12) good=false; } } } else if (rowLength[jRow]==2) { if (value>0.0) { if (rowLower[jRow]>-1.0e20) good=false; } else { if (rowUpper[jRow]<1.0e20) good=false; } } else { good=false; } } } if (good) { // both can be integer numberChanged++; intVar[jColumn1]=77; numberChanged++; intVar[jColumn2]=77; } } // clear for (i=0;i lower[iColumn]+1.0e-8&&!intVar[iColumn]) { double value; value = upper[iColumn]; if (value<1.0e20&&fabs(value-floor(value+0.5))>1.0e-12) continue; value = lower[iColumn]; if (value>-1.0e20&&fabs(value-floor(value+0.5))>1.0e-12) continue; bool integer=true; for (CoinBigIndex j=columnStart[iColumn];j1.0e20) { upper[iColumn] = 1.0e20; } else { upper[iColumn] = floor(upper[iColumn]+1.0e-5); } if (lower[iColumn]<-1.0e20) { lower[iColumn] = -1.0e20; } else { lower[iColumn] = ceil(lower[iColumn]-1.0e-5); if (lower[iColumn]>upper[iColumn]) feasible=false; } if (lower[iColumn]==0.0&&upper[iColumn]==1.0) intVar[iColumn]=1; else if (lower[iColumn]==upper[iColumn]) intVar[iColumn]=0; else intVar[iColumn]=2; } } delete [] which; delete [] changeRhs; delete [] ignore; //if (numberChanged) //printf("%d variables could be made integer\n",numberChanged); delete solver; return feasible; } int CglProbing::gutsOfGenerateCuts(const OsiSolverInterface & si, OsiCuts & cs , double * rowLower, double * rowUpper, double * colLower, double * colUpper, CglTreeInfo * info) { //printf("PASS\n"); // Get basic problem information int nRows; CoinPackedMatrix * rowCopy=NULL; int numberRowCutsBefore = cs.sizeRowCuts(); // get branch and bound cutoff double cutoff; bool cutoff_available = si.getDblParam(OsiDualObjectiveLimit,cutoff); if (!cutoff_available||usingObjective_<0) { // cut off isn't set or isn't valid cutoff = si.getInfinity(); } cutoff *= si.getObjSense(); if (fabs(cutoff)>1.0e30) assert (cutoff>1.0e30); int mode=mode_; int nCols=si.getNumCols(); // get integer variables const char * intVarOriginal = si.getColType(true); char * intVar = CoinCopyOfArray(intVarOriginal,nCols); int i; int numberIntegers=0; CoinMemcpyN(si.getColLower(),nCols,colLower); CoinMemcpyN(si.getColUpper(),nCols,colUpper); const double * colsol =si.getColSolution(); // and put reasonable bounds on integer variables for (i=0;i1.0e12) colUpper[i] = CGL_REASONABLE_INTEGER_BOUND; if (colsol[i]>-1.0e10&&colLower[i]<-1.0e12) colLower[i] = -CGL_REASONABLE_INTEGER_BOUND; } } } bool feasible=true; if (!info->inTree&&!info->pass) { // make more integer feasible = analyze(&si,intVar,colLower,colUpper); } if (feasible&&PROBING_EXTRA_STUFF) { // tighten bounds on djs // should be in CbcCutGenerator and check if basic const double * djs =si.getReducedCost(); const double * colsol =si.getColSolution(); double direction = si.getObjSense(); double cutoff; bool cutoff_available = si.getDblParam(OsiDualObjectiveLimit,cutoff); if (!cutoff_available||usingObjective_<0) { // cut off isn't set or isn't valid cutoff = si.getInfinity(); } cutoff *= direction; if (fabs(cutoff)>1.0e30) assert (cutoff>1.0e30); double current = si.getObjValue(); current *= direction; double gap=CoinMax(cutoff-current,1.0e-1); for (int i = 0; i < nCols; ++i) { double djValue = djs[i]*direction; if (colUpper[i]-colLower[i]>1.0e-8) { if (colsol[i]gap) { if (si.isInteger(i)) { printf("why int %d not fixed at lb\n",i); colUpper[i]= colLower[i]; } else { double newUpper = colLower[i] + gap/djValue; if (newUppercolUpper[i]-primalTolerance_) { if (-djValue>gap) { if (si.isInteger(i)) { printf("why int %d not fixed at ub\n",i); colLower[i]= colUpper[i]; } else { double newLower = colUpper[i] + gap/djValue; if (newLower>colLower[i]) { //printf("%d lb from %g to %g\n",i,colLower[i],newLower); colLower[i]= CoinMin(newLower,colUpper[i]-1.0e-5); } } } } } } } int ninfeas=0; // Set up maxes int maxProbe = info->inTree ? maxProbe_ : maxProbeRoot_; int maxElements = info->inTree ? maxElements_ : maxElementsRoot_; //if (!info->inTree&&!info->pass) //maxElements=nCols; // Get objective offset double offset; si.getDblParam(OsiObjOffset,offset); #ifdef COIN_DEVELOP if (offset&&!info->inTree&&!info->pass) printf("CglProbing obj offset %g\n",offset); #endif // see if using cached copy or not if (!rowCopy_) { // create from current nRows=si.getNumRows(); // mode==0 is invalid if going from current matrix if (mode==0) mode=1; // add in objective if there is a cutoff if (cutoff<1.0e30&&usingObjective_>0) { rowCopy = new CoinPackedMatrix(*si.getMatrixByRow(),1,nCols,false); } else { rowCopy = new CoinPackedMatrix(*si.getMatrixByRow()); } // add in objective if there is a cutoff if (cutoff<1.0e30&&usingObjective_>0) { int * columns = new int[nCols]; double * elements = new double[nCols]; int n=0; const double * objective = si.getObjCoefficients(); bool maximize = (si.getObjSense()==-1); for (i=0;iappendRow(n,columns,elements); delete [] columns; delete [] elements; CoinMemcpyN(si.getRowLower(),nRows,rowLower); CoinMemcpyN(si.getRowUpper(),nRows,rowUpper); rowLower[nRows]=-COIN_DBL_MAX; rowUpper[nRows]=cutoff+offset; nRows++; } else { CoinMemcpyN(si.getRowLower(),nRows,rowLower); CoinMemcpyN(si.getRowUpper(),nRows,rowUpper); } } else { // use snapshot nRows=numberRows_; assert(nCols==numberColumns_); rowCopy = new CoinPackedMatrix(*rowCopy_); assert (rowCopy_->getNumRows()==numberRows_); rowLower = new double[nRows]; rowUpper = new double[nRows]; CoinMemcpyN(rowLower_,nRows,rowLower); CoinMemcpyN(rowUpper_,nRows,rowUpper); if (usingObjective_>0) { rowLower[nRows-1]=-COIN_DBL_MAX; rowUpper[nRows-1]=cutoff+offset; } } CoinBigIndex * rowStartPos = NULL; int * realRows = NULL; { // Now take out rows with too many elements int * rowLength = rowCopy->getMutableVectorLengths(); //#define OUTRUBBISH double * elements = rowCopy->getMutableElements(); int * column = rowCopy->getMutableIndices(); CoinBigIndex * rowStart = rowCopy->getMutableVectorStarts(); #ifdef OUTRUBBISH double large=1.0e3; #endif int nDelete = 0; int nKeep=0; int * which = new int[nRows]; int nElements=rowCopy->getNumElements(); int nTotalOut=0; int nRealRows = si.getNumRows(); for (i=0;imaxElements||(rowLower[i]<-1.0e20&&rowUpper[i]>1.0e20)) { // keep objective if (imaxElements&&i1.0e20)) { which[nDelete++]=i; } else { #ifdef OUTRUBBISH // out all rows with infinite plus and minus int nPlus=rowUpper[i]>-large ? 0 : 1; int nMinus=rowLower[i]large) { if (elements[j]>0.0) nPlus++; else nMinus++; } if (colLower[iColumn]<-large) { if (elements[j]<0.0) nPlus++; else nMinus++; } } if (!nPlus||!nMinus) { rowLower[nKeep]=rowLower[i]; rowUpper[nKeep]=rowUpper[i]; nKeep++; } else { nExtraDel++; which[nDelete++]=i; } #else if (info->strengthenRow&&!info->pass&&(rowLower[i]<-1.0e20||rowUpper[i]>1.0e20)) { int nPlus=0; int nMinus=0; for (CoinBigIndex j=rowStart[i];j0.0) { nPlus++; } else { nMinus++; } } else { nPlus=2; nMinus=2; break; } } double effectiveness=0.0; if (nPlus==1&&rowUpper[i]>0.0&&rowUpper[i]<1.0e10) { // can make element smaller for (CoinBigIndex j=rowStart[i];j0.0) { elements[j] -= rowUpper[i]; //printf("pass %d row %d plus el from %g to %g\n",info->pass, // i,elements[j]+rowUpper[i],elements[j]); } effectiveness += fabs(elements[j]); } rowUpper[i]=0.0; } else if (nMinus==1&&rowLower[i]<0.0&&rowLower[i]>-1.0e10) { // can make element smaller in magnitude for (CoinBigIndex j=rowStart[i];jpass, // i,elements[j]+rowLower[i],elements[j]); } effectiveness += fabs(elements[j]); } rowLower[i]=0.0; } if (effectiveness) { OsiRowCut rc; rc.setLb(rowLower[i]); rc.setUb(rowUpper[i]); int start = rowStart[i]; int n = rowLength[i]; rc.setRow(rowLength[i],column+start,elements+start,false); // but get rid of tinies CoinPackedVector & row = rc.mutableRow(); double * elements = row.getElements(); int n2=0; for (n2=0;n21.0e-12) { elements[n2]=elements[i]; columns[n2++]=columns[i]; } } row.truncate(n2); } rc.setEffectiveness(effectiveness); assert (!info->strengthenRow[i]); info->strengthenRow[i]=rc.clone(); } } rowLower[nKeep]=rowLower[i]; rowUpper[nKeep]=rowUpper[i]; nKeep++; #endif } } if (nDelete) { #ifdef OUTRUBBISH if (nExtraDel) { printf("%d rows deleted (extra %d)\n",nDelete,nExtraDel); } #else #endif if (info->strengthenRow) { // Set up pointers to real rows realRows = new int [nRows]; CoinZeroN(realRows,nRows); for (i=0;ideleteRows(nDelete,which); nRows=nKeep; } delete [] which; if (!nRows) { #ifdef COIN_DEVELOP printf("All rows too long for probing\n"); #endif // nothing left!! // delete stuff delete rowCopy; if (rowCopy_) { delete [] rowLower; delete [] rowUpper; } delete [] intVar; // and put back unreasonable bounds on integer variables const double * trueLower = si.getColLower(); const double * trueUpper = si.getColUpper(); for (i=0;igetMutableElements(); column = rowCopy->getMutableIndices(); rowStart = rowCopy->getMutableVectorStarts(); rowLength = rowCopy->getMutableVectorLengths(); #if 0 int nFixed=0; for (i=0;icolLower[iColumn]) { double value = elements[j]; if (value<0.0) { elements[newSize]=value; column[newSize++]=iColumn; } else if (value>0.0) { elements2[nOther]=value; column2[nOther++]=iColumn; } } else { offset += colUpper[iColumn]*elements[j]; } } rowStartPos[i] = newSize; for (int k=0;k-1.0e20) rowLower[i] -= offset; if (rowUpper[i]<1.0e20) rowUpper[i] -= offset; } } delete [] column2; delete [] elements2; rowStart[nRows]=newSize; rowCopy->setNumElements(newSize); } CoinPackedMatrix * columnCopy=new CoinPackedMatrix(*rowCopy,0,0,true); int nRowsSafe=CoinMin(nRows,si.getNumRows()); #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&!debugger->onOptimalPath(si)) debugger = NULL; #else const OsiRowCutDebugger * debugger = NULL; #endif const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * rowElements = rowCopy->getElements(); // Arrays so user can find out what happened if (!lookedAt_) { lookedAt_ = new int[nCols]; } numberThisTime_=0; // Let us never add more than twice the number of rows worth of row cuts // Keep cuts out of cs until end so we can find duplicates quickly int nRowsFake = info->inTree ? nRowsSafe/3 : nRowsSafe; if (!info->inTree&&!info->pass) nRowsFake *= 5; row_cut rowCut(nRowsFake,!info->inTree); int * markR = new int [nRows]; double * minR = new double [nRows]; double * maxR = new double [nRows]; if (mode) { ninfeas= tighten(colLower, colUpper, column, rowElements, rowStart, rowStartPos ,rowLength, rowLower, rowUpper, nRows, nCols, intVar, 2, primalTolerance_); if (!feasible) ninfeas=1; if (!ninfeas) { // create column cuts where integer bounds have changed { const double * lower = si.getColLower(); const double * upper = si.getColUpper(); const double * colsol = si.getColSolution(); int numberChanged=0,ifCut=0; CoinPackedVector lbs; CoinPackedVector ubs; for (i = 0; i < nCols; ++i) { if (intVar[i]) { colUpper[i] = CoinMin(upper[i],floor(colUpper[i]+1.0e-4)); if (colUpper[i]lower[i]+1.0e-8) { if (colLower[i]>colsol[i]+1.0e-8) ifCut=1; lbs.insert(i,colLower[i]); numberChanged++; } } } if (numberChanged) { OsiColCut cc; cc.setUbs(ubs); cc.setLbs(lbs); if (ifCut) { cc.setEffectiveness(100.0); } else { cc.setEffectiveness(1.0e-5); } #ifdef CGL_DEBUG checkBounds(debugger,cc); #endif cs.insert(cc); } } if (maxProbe>0) { numberThisTime_=0; // get min max etc for rows tighten2(colLower, colUpper, column, rowElements, rowStart, rowLength, rowLower, rowUpper, minR , maxR , markR, nRows); // decide what to look at if (mode==1) { const double * colsol = si.getColSolution(); double_int_pair * array = new double_int_pair [nCols]; # ifdef ZEROFAULT std::memset(array,0,sizeof(double_int_pair)*nCols) ; # endif double multiplier = -1.0; if (info->inTree||(info->pass&1)!=0) multiplier=1.0; //const int * columnLength = si.getMatrixByCol()->getVectorLengths(); for (i=0;i1.0e-8) { double away = fabs(0.5-(colsol[i]-floor(colsol[i]))); if (away<0.49999||!info->inTree) { //array[numberThisTime_].infeasibility=away; array[numberThisTime_].infeasibility=away*multiplier; //array[numberThisTime_].infeasibility=-columnLength[i]; array[numberThisTime_++].sequence=i; } } } //printf("maxP %d num %d\n",maxProbe,numberThisTime_); std::sort(array,array+numberThisTime_,double_int_pair_compare()); //numberThisTime_=CoinMin(numberThisTime_,maxProbe); for (i=0;i1.0e-8) { lookedAt_[numberThisTime_++]=i; } } } #if 0 // Only look at short rows for (i=0;imaxElements) abort(); //markR[i]=-2; } #endif // sort to be clean //std::sort(lookedAt_,lookedAt_+numberThisTime_); if (!numberCliques_) { ninfeas= probe(si, debugger, cs, colLower, colUpper, rowCopy,columnCopy, rowStartPos, realRows, rowLower, rowUpper, intVar, minR, maxR, markR, info); } else { ninfeas= probeCliques(si, debugger, cs, colLower, colUpper, rowCopy,columnCopy, realRows,rowLower, rowUpper, intVar, minR, maxR, markR, info); } } } } else if (maxProbe>0) { // global cuts from previous calculations // could check more thoroughly that integers are correct assert(numberIntegers==numberIntegers_); // make up list of new variables to look at numberThisTime_=0; const double * colsol = si.getColSolution(); double_int_pair * array = new double_int_pair [nCols]; # ifdef ZEROFAULT std::memset(array,0,sizeof(double_int_pair)*nCols) ; # endif for (i=0;i1.0e-8) { double away = fabs(0.5-(colsol[j]-floor(colsol[j]))); array[numberThisTime_].infeasibility=away; array[numberThisTime_++].sequence=i; } } std::sort(array,array+numberThisTime_,double_int_pair_compare()); numberThisTime_=CoinMin(numberThisTime_,maxProbe); for (i=0;imaxElements) abort(); //markR[i]=-2; } #endif ninfeas= probeCliques(si, debugger, csNew, colLower, colUpper, rowCopy,columnCopy, realRows, rowLower, rowUpper, intVar, minR, maxR, markR, info); } if (!ninfeas) { // go through row cuts int nCuts = csNew.sizeRowCuts(); int iCut; // need space for backward lookup // just for ones being looked at int * backward = new int [2*nCols]; int * onList = backward + nCols; for (i=0;i0.0); // delta to 0 => x to 0.0 cutVector_[i].length++; } else { if (elements[1-which]<0.0&&fabs(elements[which]/elements[1-which]- colUpper[other])<1.0e-5) { // delta to 1 => x to upper bound cutVector_[i].length++; } else { if (onList[other]) { double value0 = elements[0]; double value1 = elements[1]; if (value0*value1==-1.0) { // can do something ? int j=backward[other]; cutVector_[i].length++; cutVector_[j].length++; } else { continue; } } } } } else { if (onList[other]) { if (elements[0]==1.0&&elements[1]==1.0&&rcut.ub()==1.0) { // can do something ? int j=backward[other]; cutVector_[i].length++; cutVector_[j].length++; } else { continue; } } } } else { assert(rcut.ub()==DBL_MAX); if (!lb) { // LB if (elements[which]>0.0) { //assert (elements[1-which]<0.0); // delta to 0 => x to 0.0 // flip so same as UB cutVector_[i].length++; } else { if (elements[1-which]<0.0&&fabs(elements[which]/elements[1-which]- colUpper[other])<1.0e-5) { // delta to 1 => x to upper bound cutVector_[i].length++; } else { if (onList[other]) { double value0 = elements[0]; double value1 = elements[1]; if (value0*value1==-1.0) { // can do something ? int j=backward[other]; cutVector_[i].length++; cutVector_[j].length++; } else { continue; } } } } } } } // allocate space for (i=0;i=0) setAffectedInDisaggregation(cutVector_[i].index[iput],j); else setAffectedInDisaggregation(cutVector_[i].index[iput],other); setWhenAtUBInDisaggregation(cutVector_[i].index[iput],false); setAffectedToUBInDisaggregation(cutVector_[i].index[iput],false); setZeroOneInDisaggregation(cutVector_[i].index[iput],onList[other]!=0); cutVector_[i].length++; } else { if (elements[1-which]<0.0&&fabs(elements[which]/elements[1-which]- colUpper[other])<1.0e-5) { // delta to 1 => x to upper bound iput=cutVector_[i].length; if (j>=0) setAffectedInDisaggregation(cutVector_[i].index[iput],j); else setAffectedInDisaggregation(cutVector_[i].index[iput],other); setWhenAtUBInDisaggregation(cutVector_[i].index[iput],true); setAffectedToUBInDisaggregation(cutVector_[i].index[iput],true); setZeroOneInDisaggregation(cutVector_[i].index[iput],onList[other]!=0); cutVector_[i].length++; } else { if (onList[other]) { double value0 = elements[0]; double value1 = elements[1]; if (value0*value1==-1.0) { // can do something ? int j=backward[other]; assert (j>=0); // flip so value0 1.0 if (value1==1.0) { j=i; i=backward[other]; value1=value0; value0=1.0; } assert (value0==1.0); assert (value1==-1.0); iput=cutVector_[i].length; setAffectedInDisaggregation(cutVector_[i].index[iput],j); setWhenAtUBInDisaggregation(cutVector_[i].index[iput],true); setAffectedToUBInDisaggregation(cutVector_[i].index[iput],true); setZeroOneInDisaggregation(cutVector_[i].index[iput],true); cutVector_[i].length++; iput=cutVector_[j].length; setAffectedInDisaggregation(cutVector_[j].index[iput],i); setWhenAtUBInDisaggregation(cutVector_[j].index[iput],false); setAffectedToUBInDisaggregation(cutVector_[j].index[iput],false); setZeroOneInDisaggregation(cutVector_[j].index[iput],true); cutVector_[j].length++; } } } } } else { if (onList[other]) { if (elements[0]==1.0&&elements[1]==1.0&&rcut.ub()==1.0) { // can do something ? int j=backward[other]; assert (j>=0); iput=cutVector_[i].length; setAffectedInDisaggregation(cutVector_[i].index[iput],j); setWhenAtUBInDisaggregation(cutVector_[i].index[iput],true); setAffectedToUBInDisaggregation(cutVector_[i].index[iput],false); setZeroOneInDisaggregation(cutVector_[i].index[iput],true); cutVector_[i].length++; iput=cutVector_[j].length; setAffectedInDisaggregation(cutVector_[j].index[iput],i); setWhenAtUBInDisaggregation(cutVector_[j].index[iput],true); setAffectedToUBInDisaggregation(cutVector_[j].index[iput],false); setZeroOneInDisaggregation(cutVector_[j].index[iput],true); cutVector_[j].length++; } else { #ifdef COIN_DEVELOP abort(); #endif continue; } } } } else { assert(rcut.ub()==DBL_MAX); if (!lb) { // LB if (elements[which]>0.0) { iput=cutVector_[i].length; if (j>=0) setAffectedInDisaggregation(cutVector_[i].index[iput],j); else setAffectedInDisaggregation(cutVector_[i].index[iput],other); setWhenAtUBInDisaggregation(cutVector_[i].index[iput],false); setAffectedToUBInDisaggregation(cutVector_[i].index[iput],false); setZeroOneInDisaggregation(cutVector_[i].index[iput],onList[other]!=0); cutVector_[i].length++; } else { if (elements[1-which]<0.0&&fabs(elements[which]/elements[1-which]- colUpper[other])<1.0e-5) { iput=cutVector_[i].length; if (j>=0) setAffectedInDisaggregation(cutVector_[i].index[iput],j); else setAffectedInDisaggregation(cutVector_[i].index[iput],other); setWhenAtUBInDisaggregation(cutVector_[i].index[iput],true); setAffectedToUBInDisaggregation(cutVector_[i].index[iput],true); setZeroOneInDisaggregation(cutVector_[i].index[iput],onList[other]!=0); cutVector_[i].length++; } else { if (onList[other]) { double value0 = elements[0]; double value1 = elements[1]; if (value0*value1==-1.0) { // can do something ? int j=backward[other]; assert (j>=0); // flip so value0 -1.0 if (value1==-1.0) { j=i; i=backward[other]; value1=value0; value0=-1.0; } assert (value0==-1.0); assert (value1==1.0); iput=cutVector_[i].length; setAffectedInDisaggregation(cutVector_[i].index[iput],j); setWhenAtUBInDisaggregation(cutVector_[i].index[iput],true); setAffectedToUBInDisaggregation(cutVector_[i].index[iput],true); setZeroOneInDisaggregation(cutVector_[i].index[iput],true); cutVector_[i].length++; iput=cutVector_[j].length; setAffectedInDisaggregation(cutVector_[j].index[iput],i); setWhenAtUBInDisaggregation(cutVector_[j].index[iput],false); setAffectedToUBInDisaggregation(cutVector_[j].index[iput],false); setZeroOneInDisaggregation(cutVector_[j].index[iput],true); cutVector_[j].length++; } } } } } } } delete [] backward; // Now sort and get rid of duplicates // could also see if any are cliques int longest=0; for (i=0;i>3; int zeroOne = (sortit[k]&4)>>2; int whenAtUB = (sortit[k]&2)>>1; int affectedToUB = sortit[k]&1; disaggregationAction action; action.affected=0; setAffectedInDisaggregation(action,affected); setZeroOneInDisaggregation(action,zeroOne!=0); setWhenAtUBInDisaggregation(action,whenAtUB!=0); setAffectedToUBInDisaggregation(action,affectedToUB!=0); if (affected!=affectedLast||zeroOne!=zeroOneLast) { // new variable thisOne.index[put++]=action; } else if (whenAtUB!=whenAtUBLast||affectedToUB!=affectedToUBLast) { // new action - what can we discover thisOne.index[put++]=action; int j=cutVector_[i].sequence; int k=affected; if (zeroOne) { k=cutVector_[k].sequence; if (logLevel_>1) printf("For %d %d 0-1 pair",j,k) ; } else { if (logLevel_>1) printf("For %d %d pair",j,k) ; } if (logLevel_>1) printf(" old whenAtUB, affectedToUB %d %d, new whenAtUB, affectedToUB %d %d\n", whenAtUBLast, affectedToUBLast,whenAtUB, affectedToUB); } affectedLast=affected; zeroOneLast=zeroOne; whenAtUBLast=whenAtUB; affectedToUBLast=affectedToUB; } if (put(affected)>i) { bool whenAtUB = whenAtUBInDisaggregation(thisOne.index[k]); bool affectedToUB = affectedToUBInDisaggregation(thisOne.index[k]); disaggregation otherOne=cutVector_[affected]; int numberOther = otherOne.length; // Could do binary search if a lot int lastAction=-1; for (int j=0;j x + y <=1 (1,1 impossible) 1 -> x - y <=0 (1,0 impossible) 2 -> -x + y <=0 (0,1 impossible) 3 -> -x -y <= -1 (0,0 impossible) 10 -> x == y 11 -> x + y == 1 20 -> x == 0 21 -> x == 1 22 -> y == 0 23 -> y == 1 */ int action=-1; if (whenAtUB) { if (affectedToUB) { // x -> 1 => y -> 1 if (whenAtUBOther) { if (affectedToUBOther) { // y -> 1 => x -> 1 action=10; // x,y must be same } else { // y -> 1 => x -> 0 action=20; // If x is 1 then contradiction } } else { if (affectedToUBOther) { // y -> 0 => x -> 1 action=23; // if y is 0 then contradiction } else { // y -> 0 => x -> 0 action=1; // x,y 1,0 impossible } } } else { // x -> 1 => y -> 0 if (whenAtUBOther) { if (affectedToUBOther) { // y -> 1 => x -> 1 action=22; // If y is 1 then contradiction } else { // y -> 1 => x -> 0 action=0; } } else { if (affectedToUBOther) { // y -> 0 => x -> 1 action=11; // x,y with same values impossible } else { // y -> 0 => x -> 0 action=20; // If x is 1 then contradiction } } } } else { if (affectedToUB) { // x -> 0 => y -> 1 if (whenAtUBOther) { if (affectedToUBOther) { // y -> 1 => x -> 1 action=21; // If x is 0 then contradiction } else { // y -> 1 => x -> 0 action=11; // x,y must be different } } else { if (affectedToUBOther) { // y -> 0 => x -> 1 action=3; // one of x,y must be 1 } else { // y -> 0 => x -> 0 action=23; // if y is 0 then contradiction } } } else { // x -> 0 => y -> 0 if (whenAtUBOther) { if (affectedToUBOther) { // y -> 1 => x -> 1 action=2; // x,y 0,1 impossible } else { // y -> 1 => x -> 0 action=22; // If y is 1 then contradiction } } else { if (affectedToUBOther) { // y -> 0 => x -> 1 action=21; // if x is 0 then contradiction } else { // y -> 0 => x -> 0 action=10; // x,y must be same } } } } assert (action>=0); if (action<4) { // clique - see if there if (oneFixStart_) { switch (action) { case 0: break; case 1: break; case 2: break; case 3: break; } // If not can we add or strengthen } // check last action if (lastAction>=0) { if (logLevel_>1) printf("XX lastAction %d, this %d\n",lastAction,action); } } else if (action<12) { if (logLevel_>1) printf("XX Could eliminate one of %d %d 0-1 variables %c\n",i,affected, (lastAction>=0) ? '*' : ' '); if (info->strengthenRow) { OsiRowCut rc; int index[2]; double element[2]; index[0]=cutVector_[i].sequence; element[0]=1.0; index[1]=cutVector_[affected].sequence; if (action==10) { // 10 -> x == y rc.setLb(0.0); rc.setUb(0.0); element[1]= -1.0; } else { // 11 -> x + y == 1 rc.setLb(1.0); rc.setUb(1.0); element[1]= 1.0; } rc.setRow(2,index,element,false); cs.insert(rc); } } else { if (action<22) { if (logLevel_>1) printf("XX Could fix a 0-1 variable %d\n",i); } else { if (logLevel_>1) printf("XX Could fix a 0-1 variable %d\n",affected); } } //printf("%d when %d forces %d to %d , %d when %d forces %d to %d\n", // i,whenAtUB,affected,affectedToUB, // affected, whenAtUBOther,i, affectedToUBOther); } } } } } delete [] sortit; } if (cutVector_) { // now see if any disaggregation cuts are violated for (i=0;i1.0e-8) { double away = fabs(0.5-(solInt-floor(solInt))); if (away<0.4999999) { disaggregation thisOne=cutVector_[i]; int k; OsiRowCut rc; for (k=0;k 0 => x to lb (at present just 0) infeasibility = solValue - upper * solInt; if (infeasibility > 1.0e-3) { rc.setLb(-COIN_DBL_MAX); rc.setUb(0.0); index[0]=icol; element[0]=1.0; index[1]=j; element[1]= -upper; } else { infeasibility=0.0; } } else { // delta -> 0 => x to ub abort(); } } else { if (affectedToUBInDisaggregation(thisOne.index[k])) { // delta -> 1 => x to ub (?) icol = affectedInDisaggregation(thisOne.index[k]); if (zeroOneInDisaggregation(thisOne.index[k])) icol = cutVector_[icol].sequence; solValue=colsol[icol]; upper=colUpper_[icol]; if (!colLower[icol]) { infeasibility = upper * solInt - solValue; if (infeasibility > 1.0e-3) { rc.setLb(-COIN_DBL_MAX); rc.setUb(0.0); index[0]=icol; element[0]=-1.0; index[1]=j; element[1]= upper; } else { infeasibility=0.0; } } else { assert (upper==colLower[icol]); infeasibility=0.0; } } else { // delta + delta2 <= 1 assert (zeroOneInDisaggregation(thisOne.index[k])); // delta -> 1 => delta2 -> 0 icol = affectedInDisaggregation(thisOne.index[k]); icol = cutVector_[icol].sequence; // only do if icol > j if (icol >j && colUpper[icol] ) { solValue=colsol[icol]; if (!colLower[icol]) { infeasibility = solInt + solValue - 1.0; if (infeasibility > 1.0e-3) { rc.setLb(-COIN_DBL_MAX); rc.setUb(1.0); index[0]=icol; element[0]=1.0; index[1]=j; element[1]= 1.0; } else { infeasibility=0.0; } } else { assert (upper==colLower[icol]); infeasibility=0.0; } } } } if (infeasibility) { rc.setEffectiveness(infeasibility); rc.setRow(2,index,element,false); if (logLevel_>1) printf("%g <= %g * x%d + %g * x%d <= %g\n", rc.lb(),element[0],index[0],element[1],index[1],rc.ub()); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); } } } } } } } delete [] markR; delete [] minR; delete [] maxR; // Add in row cuts if (!ninfeas) { rowCut.addCuts(cs,info->strengthenRow,0); } // delete stuff delete rowCopy; delete columnCopy; if (rowCopy_) { delete [] rowLower; delete [] rowUpper; } delete [] intVar; delete [] rowStartPos; delete [] realRows; // and put back unreasonable bounds on integer variables const double * trueLower = si.getColLower(); const double * trueUpper = si.getColUpper(); if (!ninfeas) { for (i=0;iinTree&&((info->options&4)==4||((info->options&8)&&!info->pass))) { int numberRowCutsAfter = cs.sizeRowCuts(); for (int i=numberRowCutsBefore;isetGloballyValid(); } return ninfeas; } // Choose tighter bounds static void cleanBounds(int way,int & nFix,int * index,double * element) { CoinSort_2(index,index+nFix,element); int last=-1; int n=0; for (int i=0;ilast) { index[n]=index[i]; element[n++]=element[i]; last=index[i]; } else if (way>0) { // tighter ub if (element[n-1]>element[i]) element[n-1]=element[i]; } else { // tighter lb if (element[n-1]getNumRows(); int nRowsSafe=CoinMin(nRows,si.getNumRows()); int nCols=rowCopy->getNumCols(); const double * currentColLower = si.getColLower(); const double * currentColUpper = si.getColUpper(); // Set up maxes int maxStack = info->inTree ? maxStack_ : maxStackRoot_; int maxPass = info->inTree ? maxPass_ : maxPassRoot_; if ((totalTimesCalled_%10)==-1) { int newMax=CoinMin(2*maxStack,50); maxStack=CoinMax(newMax,maxStack); } double relaxedTolerance=2.0*primalTolerance_; #define ONE_ARRAY #ifdef ONE_ARRAY unsigned int DIratio = sizeof(double)/sizeof(int); assert (DIratio==1||DIratio==2); int nSpace = 8*nCols+4*nRows+2*maxStack; nSpace += (4*nCols+nRows+maxStack+DIratio-1)>>(DIratio-1); double * colsol = new double[nSpace]; double * djs = colsol + nCols; double * columnGap = djs + nCols; double * saveL = columnGap + nCols; double * saveU = saveL + 2*nCols; double * saveMin = saveU + 2*nCols; double * saveMax = saveMin + nRows; double * largestPositiveInRow = saveMax + nRows; double * largestNegativeInRow = largestPositiveInRow + nRows; double * element = largestNegativeInRow + nRows; double * lo0 = element + nCols; double * up0 = lo0 + maxStack; int * markC = reinterpret_cast (up0+maxStack); int * stackC = markC + nCols; int * stackR = stackC + 2*nCols; int * index = stackR + nRows; int * stackC0 = index + nCols; #else double * colsol = new double[nCols]; double * djs = new double[nCols]; double * columnGap = new double [nCols]; double * saveL = new double [2*nCols]; double * saveU = new double [2*nCols]; double * saveMin = new double [nRows]; double * saveMax = new double [nRows]; double * largestPositiveInRow = new double [nRows]; double * largestNegativeInRow = new double [nRows]; double * element = new double[nCols]; double * lo0 = new double[maxStack]; double * up0 = new double[maxStack]; int * markC = new int [nCols]; int * stackC = new int [2*nCols]; int * stackR = new int [nRows]; int * index = new int[nCols]; int * stackC0 = new int[maxStack]; #endif // Let us never add more than twice the number of rows worth of row cuts // Keep cuts out of cs until end so we can find duplicates quickly #define PROBING4 #ifdef PROBING4 int nRowsFake = info->inTree ? nRowsSafe/3 : nRowsSafe*10; #else int nRowsFake = info->inTree ? nRowsSafe/3 : nRowsSafe; #endif if (!info->inTree&&!info->pass) nRowsFake *= 10; bool justReplace = ((info->options&64)!=0)&&(realRows!=NULL); if (justReplace) { nRowsFake=nRows; } row_cut rowCut(nRowsFake, !info->inTree); row_cut * rowCutFake = NULL; if ((mode_&8)!=0) { // redo to be more compact rowCutFake = new row_cut(10000, !info->inTree); } totalTimesCalled_++; const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowElements = rowCopy->getElements(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); const double * columnElements = columnCopy->getElements(); #define MOVE_SINGLETONS #ifdef MOVE_SINGLETONS const double * objective = si.getObjCoefficients(); const int * columnLength2 = si.getMatrixByCol()->getVectorLengths(); #endif bool anyColumnCuts=false; int ninfeas=0; int rowCuts; double disaggEffectiveness; /* clean up djs and solution */ CoinMemcpyN(si.getReducedCost(),nCols,djs); CoinMemcpyN( si.getColSolution(),nCols,colsol); disaggEffectiveness=1.0e-3; rowCuts=rowCuts_; //CoinBigIndex * rowStartPos = new CoinBigIndex [nRows]; #ifndef NDEBUG const int * rowLength = rowCopy->getVectorLengths(); #endif for (int i=0;i0.0) break; } assert (rowStartPos[i]==kk); #endif double value; value=0.0; for ( kk =rowStart[i];kk1.0e-8) { if (colsol[i]colUpper[i]-primalTolerance_) { colsol[i]=colUpper[i]; djs[i] = CoinMin(0.0,djValue); } else { djs[i]=0.0; } } columnGap[i]=gap-primalTolerance_; } int ipass=0,nfixed=-1; double cutoff; bool cutoff_available = si.getDblParam(OsiDualObjectiveLimit,cutoff); if (!cutoff_available||usingObjective_<0) { // cut off isn't set or isn't valid cutoff = si.getInfinity(); } cutoff *= direction; if (fabs(cutoff)>1.0e30) assert (cutoff>1.0e30); double current = si.getObjValue(); current *= direction; /* for both way coding */ int nstackC0=-1; int nstackR,nstackC; //int nFix=0; for (int i=0;i1.0e10) markC[i] |= 8; if (colLower[i]<-1.0e10) markC[i] |= 4; } } //printf("PROBE %d fixed out of %d\n",nFix,nCols); double tolerance = 1.0e1*primalTolerance_; // If we are going to replace coefficient then we don't need to be effective //double needEffectiveness = info->strengthenRow ? -1.0e10 : 1.0e-3; double needEffectiveness = info->strengthenRow ? 1.0e-8 : 1.0e-3; if (justReplace&&(info->pass&1)!=0) needEffectiveness=-1.0e10; if (PROBING_EXTRA_STUFF) { int nCut=0; for (int iRow=0;iRow colLower[jColumn]+1.0e-8) { if (intVar[jColumn]) { numberInt++; whichInt=jColumn; intValue=value; } else if (value<0) { numberNeg++; } } else { sumFixed += colLower[jColumn]*value; } } if (numberInt==1&&numberNeg==0&&intValue<0.0&&!rowUpper[iRow]&&rowLower[iRow]<-1.0e30&&!sumFixed) { double intSol = colsol[whichInt]; for (CoinBigIndex j=rowStart[iRow];j colLower[jColumn]+1.0e-8) { if (!intVar[jColumn]) { if (colLower[jColumn]||colUpper[jColumn]>1.0) continue;; double upper = colUpper[jColumn]; if (colsol[jColumn]>intSol*upper+1.0e-4) { nCut++; OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb(0.0); rc.setEffectiveness(1.0e-5); int index[2]; double element[2]; index[0]=jColumn; index[1]=whichInt; element[0]=1.0; element[1]=-upper; rc.setRow(2,index,element,false); cs.insert(rc); } } } } } } if (nCut) printf("%d possible cuts\n",nCut); } bool saveFixingInfo = false; #if PROBING100 CglTreeProbingInfo * probingInfo = dynamic_cast (info); const int * backward = NULL; const int * integerVariable = NULL; const int * toZero = NULL; const int * toOne = NULL; const fixEntry * fixEntries=NULL; #endif if (info->inTree) { #if PROBING100 backward = probingInfo->backward(); integerVariable = probingInfo->integerVariable(); toZero = probingInfo->toZero(); toOne = probingInfo->toOne(); fixEntries=probingInfo->fixEntries(); #endif } else { saveFixingInfo = (info->initializeFixing(&si)>0); } while (ipassinTree&&!info->pass) ? -1 : 0; int maxProbe = info->inTree ? maxProbe_ : maxProbeRoot_; if (justFix<0) maxProbe=numberThisTime_; if (maxProbe==123) { // Try and be a bit intelligent maxProbe=0; if (!info->inTree) { if (!info->pass||numberThisTime_<-100) { maxProbe=numberThisTime_; } else { int cutDown = 4; int offset = info->pass % cutDown; int i; int k=0; int kk=offset; for (i=0;ipass % cutDown; int i; int k=0; int kk=offset; for (i=0;i(leftTotalStackD); else leftTotalStack=COIN_INT_MAX; #ifdef PROBING5 if (!info->inTree&&!info->pass) leftTotalStack = 1234567890; #endif //printf("maxStack %d maxPass %d numberThisTime %d info pass %d\n", // maxStack,maxPass,numberThisTime_,info->pass); for (iLook=0;iLookinTree)) { #ifdef COIN_DEVELOP if (!info->inTree) printf("Exiting a on pass %d, maxProbe %d\n", ipass,maxProbe); #endif break; } else if (justFix<=0) { if (!info->inTree) { rowCuts=0; justFix=1; disaggEffectiveness=COIN_DBL_MAX; needEffectiveness=COIN_DBL_MAX; //maxStack=10; maxPass=1; } else if (!nfixed) { #ifdef COIN_DEVELOP printf("Exiting b on pass %d, maxProbe %d\n", ipass,maxProbe); #endif break; } } } int j=lookedAt_[iLook]; //if (j==231||j==226) //printf("size %d %d j is %d\n",rowCut.numberCuts(),cs.sizeRowCuts(),j);//printf("looking at %d (%d out of %d)\n",j,iLook,numberThisTime_); solval=colsol[j]; down = floor(solval+tolerance); up = ceil(solval-tolerance); if(columnGap[j]<0.0) markC[j]=3; if ((markC[j]&3)!=0||!intVar[j]) continue; double saveSolval = solval; if (solval>=colUpper[j]-tolerance||solval<=colLower[j]+tolerance||up==down) { if (solval<=colLower[j]+2.0*tolerance) { solval = colLower[j]+1.0e-1; down=colLower[j]; up=down+1.0; } else if (solval>=colUpper[j]-2.0*tolerance) { solval = colUpper[j]-1.0e-1; up=colUpper[j]; down=up-1; } else { // odd up=down+1.0; solval = down+1.0e-1; } } assert (up<=colUpper[j]); assert (down>=colLower[j]); assert (up>down); int istackC,iway, istackR; int way[]={1,2,1}; int feas[]={1,2,4}; int feasible=0; int notFeasible; for (iway=0;iway<3;iway ++) { int fixThis=0; double objVal=current; int goingToTrueBound=0; stackC[0]=j; markC[j]=way[iway]; double solMovement; double movement; if (way[iway]==1) { movement=down-colUpper[j]; solMovement = down-colsol[j]; assert(movement<-0.99999); if (fabs(down-colLower[j])<1.0e-7) { goingToTrueBound=2; down=colLower[j]; } } else { movement=up-colLower[j]; solMovement = up-colsol[j]; assert(movement>0.99999); if (fabs(up-colUpper[j])<1.0e-7) { goingToTrueBound=2; up=colUpper[j]; } } if (goingToTrueBound&&(colUpper[j]-colLower[j]>1.5||colLower[j])) goingToTrueBound=1; // switch off disaggregation if not wanted if ((rowCuts&1)==0) goingToTrueBound=0; bool canReplace = info->strengthenRow&&(goingToTrueBound==2); #ifdef PRINT_DEBUG if (fabs(movement)>1.01) { printf("big %d %g %g %g\n",j,colLower[j],solval,colUpper[j]); } #endif if (solMovement*djs[j]>0.0) objVal += solMovement*djs[j]; nstackC=1; nstackR=0; saveL[0]=colLower[j]; saveU[0]=colUpper[j]; assert (saveU[0]>saveL[0]); notFeasible=0; if (movement<0.0) { colUpper[j] += movement; colUpper[j] = floor(colUpper[j]+0.5); columnGap[j] = colUpper[j]-colLower[j]-primalTolerance_; #ifdef PRINT_DEBUG printf("** Trying %d down to 0\n",j); #endif } else { colLower[j] += movement; colLower[j] = floor(colLower[j]+0.5); columnGap[j] = colUpper[j]-colLower[j]-primalTolerance_; #ifdef PRINT_DEBUG printf("** Trying %d up to 1\n",j); #endif } if (fabs(colUpper[j]-colLower[j])<1.0e-6) markC[j]=3; // say fixed markC[j] &= ~12; if (colUpper[j]>1.0e10) markC[j] |= 8; if (colLower[j]<-1.0e10) markC[j] |= 4; istackC=0; /* update immediately */ int k; for ( k=columnStart[j];k0.0) { /* up */ if (value>0.0) { /* up does not change - down does */ if (minR[irow]>-1.0e10) minR[irow] += value; if (minR[irow]>rowUpper[irow]+1.0e-5) { notFeasible=1; istackC=1; break; } } else { /* down does not change - up does */ if (maxR[irow]<1.0e10) maxR[irow] += value; if (maxR[irow]-1.0e10) minR[irow] -= value; if (minR[irow]>rowUpper[irow]+1.0e-5) { notFeasible=1; istackC=1; break; } } else { /* down does not change - up does */ if (maxR[irow]<1.0e10) maxR[irow] -= value; if (maxR[irow]=0) { int nFix=0; // 0-1 see what else could be fixed if (jway==1) { // fixed to 0 int j; for ( j=toZero_[jColumn];jsaveL[nstackC]); assert (nstackCsaveL[nstackC]); assert (nstackCsaveL[nstackC]); assert (nstackCsaveL[nstackC]); assert (nstackC0) doRowUpN=false; if (rowUp2-largestPositiveInRow[irow]>0) doRowUpP=false; } } else { doRowUpN=false; doRowUpP=false; rowUp2=COIN_DBL_MAX; } double rowLo = rowLower[irow]; double rowLo2=0.0; bool doRowLoN; bool doRowLoP; if (rowLo>-1.0e10) { doRowLoN=true; doRowLoP=true; rowLo2 = rowLo-maxR[irow]; if (rowLo2>tolerance) { notFeasible=true; break; } else { if (rowLo2-largestNegativeInRow[irow]<0) doRowLoN=false; if (rowLo2+largestPositiveInRow[irow]<0) doRowLoP=false; } } else { doRowLoN=false; doRowLoP=false; rowLo2=-COIN_DBL_MAX; } if (doRowUpN&&doRowLoN) { //doRowUpN=doRowLoN=false; // Start neg values loop for (int kk =rStart;kk=-1e10) assert ((markIt&4)==0); else assert ((markIt&4)!=0); assert (value2<0.0); double gap = columnGap[kcol]*value2; bool doUp = (rowUp2 + gap < -1.0e-7); bool doDown = (rowLo2 -gap > 1.0e-7); if (doUp||doDown) { double moveUp=0.0; double moveDown=0.0; double newUpper=-1.0; double newLower=1.0; if ( doUp&&(markIt&(2+8))==0) { double dbound = colUpper[kcol]+rowUp2/value2; if (intVar[kcol]) { markIt |= 2; newLower = ceil(dbound-relaxedTolerance); } else { newLower=dbound; if (newLower+primalTolerance_>colUpper[kcol]&& newLower-primalTolerance_<=colUpper[kcol]) { newLower=colUpper[kcol]; markIt |= 2; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveUp = newLower-colLower[kcol]; } if ( doDown&&(markIt&(1+4))==0) { double dbound = colLower[kcol] + rowLo2/value2; if (intVar[kcol]) { markIt |= 1; newUpper = floor(dbound+relaxedTolerance); } else { newUpper=dbound; if (newUpper-primalTolerance_=colLower[kcol]) { newUpper=colLower[kcol]; markIt |= 1; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveDown = newUpper-colUpper[kcol]; } if (!moveUp&&!moveDown) continue; bool onList = ((markC[kcol]&3)!=0); if (nstackC<2*maxStack) { markC[kcol] = markIt; } if (moveUp&&nstackC<2*maxStack) { fixThis++; if (!onList) { stackC[nstackC]=kcol; saveL[nstackC]=colLower[kcol]; saveU[nstackC]=colUpper[kcol]; assert (saveU[nstackC]>saveL[nstackC]); assert (nstackCcolsol[kcol]) { if (djs[kcol]<0.0) { /* should be infeasible */ assert (newLower>colUpper[kcol]+primalTolerance_); } else { objVal += moveUp*djs[kcol]; } } if (intVar[kcol]) newLower = CoinMax(colLower[kcol],ceil(newLower-1.0e-4)); colLower[kcol]=newLower; columnGap[kcol] = colUpper[kcol]-newLower-primalTolerance_; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } markC[kcol] &= ~12; if (colUpper[kcol]>1.0e10) markC[kcol] |= 8; if (colLower[kcol]<-1.0e10) markC[kcol] |= 4; /* update immediately */ for (int jj =columnStart[kcol];jj0.0) { /* up does not change - down does */ if (minR[krow]>-1.0e10) minR[krow] += value*moveUp; if (krow==irow) rowUp2 = rowUp-minR[irow]; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveUp; if (krow==irow) rowLo2 = rowLo-maxR[irow]; if (maxR[krow]saveL[nstackC]); assert (nstackC0.0) { /* should be infeasible */ assert (colLower[kcol]>newUpper+primalTolerance_); } else { objVal += moveDown*djs[kcol]; } } if (intVar[kcol]) newUpper = CoinMin(colUpper[kcol],floor(newUpper+1.0e-4)); colUpper[kcol]=newUpper; columnGap[kcol] = newUpper-colLower[kcol]-primalTolerance_; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } markC[kcol] &= ~12; if (colUpper[kcol]>1.0e10) markC[kcol] |= 8; if (colLower[kcol]<-1.0e10) markC[kcol] |= 4; /* update immediately */ for (int jj =columnStart[kcol];jj-1.0e10) minR[krow] += value*moveDown; if (krow==irow) rowUp2 = rowUp-minR[irow]; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ columnGap[kcol] = -1.0e50; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveDown; if (krow==irow) rowLo2 = rowLo-maxR[irow]; if (maxR[krow]colUpper[kcol]+primalTolerance_) { notFeasible=1;; k=columnStart[jcol]+columnLength[jcol]; istackC=nstackC+1; break; } } } } // end big loop rStart->rPos } else if (doRowUpN) { // Start neg values loop for (int kk =rStart;kkcolUpper[kcol]&& newLower-primalTolerance_<=colUpper[kcol]) { newLower=colUpper[kcol]; markIt |= 2; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveUp = newLower-colLower[kcol]; if (!moveUp) continue; bool onList = ((markC[kcol]&3)!=0); if (nstackC<2*maxStack) { markC[kcol] = markIt; } if (moveUp&&nstackC<2*maxStack) { fixThis++; if (!onList) { stackC[nstackC]=kcol; saveL[nstackC]=colLower[kcol]; saveU[nstackC]=colUpper[kcol]; assert (saveU[nstackC]>saveL[nstackC]); assert (nstackCcolsol[kcol]) { if (djs[kcol]<0.0) { /* should be infeasible */ assert (newLower>colUpper[kcol]+primalTolerance_); } else { objVal += moveUp*djs[kcol]; } } if (intVar[kcol]) newLower = CoinMax(colLower[kcol],ceil(newLower-1.0e-4)); colLower[kcol]=newLower; columnGap[kcol] = colUpper[kcol]-newLower-primalTolerance_; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } markC[kcol] &= ~12; if (colUpper[kcol]>1.0e10) markC[kcol] |= 8; if (colLower[kcol]<-1.0e10) markC[kcol] |= 4; /* update immediately */ for (int jj =columnStart[kcol];jj0.0) { /* up does not change - down does */ if (minR[krow]>-1.0e10) minR[krow] += value*moveUp; if (krow==irow) rowUp2 = rowUp-minR[irow]; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ columnGap[kcol] = -1.0e50; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveUp; if (krow==irow) rowLo2 = rowLo-maxR[irow]; if (maxR[krow]colUpper[kcol]+primalTolerance_) { notFeasible=1;; k=columnStart[jcol]+columnLength[jcol]; istackC=nstackC+1; break; } } } } // end big loop rStart->rPos } else if (doRowLoN) { // Start neg values loop for (int kk =rStart;kk 1.0e-7); if (doDown&& (markIt&(1+4))==0 ) { double dbound = colLower[kcol] + rowLo2/value2; if (intVar[kcol]) { markIt |= 1; newUpper = floor(dbound+relaxedTolerance); } else { newUpper=dbound; if (newUpper-primalTolerance_=colLower[kcol]) { newUpper=colLower[kcol]; markIt |= 1; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveDown = newUpper-colUpper[kcol]; if (!moveDown) continue; bool onList = ((markC[kcol]&3)!=0); if (nstackC<2*maxStack) { markC[kcol] = markIt; } if (moveDown&&nstackC<2*maxStack) { fixThis++; if (!onList) { stackC[nstackC]=kcol; saveL[nstackC]=colLower[kcol]; saveU[nstackC]=colUpper[kcol]; assert (saveU[nstackC]>saveL[nstackC]); assert (nstackC0.0) { /* should be infeasible */ assert (colLower[kcol]>newUpper+primalTolerance_); } else { objVal += moveDown*djs[kcol]; } } if (intVar[kcol]) newUpper = CoinMin(colUpper[kcol],floor(newUpper+1.0e-4)); colUpper[kcol]=newUpper; columnGap[kcol] = newUpper-colLower[kcol]-primalTolerance_; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } markC[kcol] &= ~12; if (colUpper[kcol]>1.0e10) markC[kcol] |= 8; if (colLower[kcol]<-1.0e10) markC[kcol] |= 4; /* update immediately */ for (int jj =columnStart[kcol];jj-1.0e10) minR[krow] += value*moveDown; if (krow==irow) rowUp2 = rowUp-minR[irow]; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ columnGap[kcol] = -1.0e50; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveDown; if (krow==irow) rowLo2 = rowLo-maxR[irow]; if (maxR[krow]colUpper[kcol]+primalTolerance_) { notFeasible=1;; k=columnStart[jcol]+columnLength[jcol]; istackC=nstackC+1; break; } } } } // end big loop rStart->rPos } rStart = rEnd; rEnd = rowStart[irow+1]; if (doRowUpP&&doRowLoP) { //doRowUpP=doRowLoP=false; // Start pos values loop for (int kk =rStart;kk 0.0); /* positive element */ double gap = columnGap[kcol]*value2; bool doDown = (rowLo2 + gap > 1.0e-7); bool doUp = (rowUp2 - gap < -1.0e-7); if (doDown||doUp) { double moveUp=0.0; double moveDown=0.0; double newUpper=-1.0; double newLower=1.0; if (doDown&&(markIt&(2+8))==0) { double dbound = colUpper[kcol] + rowLo2/value2; if (intVar[kcol]) { markIt |= 2; newLower = ceil(dbound-relaxedTolerance); } else { newLower=dbound; if (newLower+primalTolerance_>colUpper[kcol]&& newLower-primalTolerance_<=colUpper[kcol]) { newLower=colUpper[kcol]; markIt |= 2; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveUp = newLower-colLower[kcol]; } if (doUp&&(markIt&(1+4))==0) { double dbound = colLower[kcol] + rowUp2/value2; if (intVar[kcol]) { markIt |= 1; newUpper = floor(dbound+relaxedTolerance); } else { newUpper=dbound; if (newUpper-primalTolerance_=colLower[kcol]) { newUpper=colLower[kcol]; markIt |= 1; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveDown = newUpper-colUpper[kcol]; } if (!moveUp&&!moveDown) continue; bool onList = ((markC[kcol]&3)!=0); if (nstackC<2*maxStack) { markC[kcol] = markIt; } if (moveUp&&nstackC<2*maxStack) { fixThis++; if (!onList) { stackC[nstackC]=kcol; saveL[nstackC]=colLower[kcol]; saveU[nstackC]=colUpper[kcol]; assert (saveU[nstackC]>saveL[nstackC]); assert (nstackCcolsol[kcol]) { if (djs[kcol]<0.0) { /* should be infeasible */ assert (newLower>colUpper[kcol]+primalTolerance_); } else { objVal += moveUp*djs[kcol]; } } if (intVar[kcol]) newLower = CoinMax(colLower[kcol],ceil(newLower-1.0e-4)); colLower[kcol]=newLower; columnGap[kcol] = colUpper[kcol]-newLower-primalTolerance_; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } markC[kcol] &= ~12; if (colUpper[kcol]>1.0e10) markC[kcol] |= 8; if (colLower[kcol]<-1.0e10) markC[kcol] |= 4; /* update immediately */ for (int jj =columnStart[kcol];jj0.0) { /* up does not change - down does */ if (minR[krow]>-1.0e10) minR[krow] += value*moveUp; if (krow==irow) rowUp2 = rowUp-minR[irow]; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ columnGap[kcol] = -1.0e50; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveUp; if (krow==irow) rowLo2 = rowLo-maxR[irow]; if (maxR[krow]saveL[nstackC]); assert (nstackC0.0) { /* should be infeasible */ assert (colLower[kcol]>newUpper+primalTolerance_); } else { objVal += moveDown*djs[kcol]; } } if (intVar[kcol]) newUpper = CoinMin(colUpper[kcol],floor(newUpper+1.0e-4)); colUpper[kcol]=newUpper; columnGap[kcol] = newUpper-colLower[kcol]-primalTolerance_; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } markC[kcol] &= ~12; if (colUpper[kcol]>1.0e10) markC[kcol] |= 8; if (colLower[kcol]<-1.0e10) markC[kcol] |= 4; /* update immediately */ for (int jj =columnStart[kcol];jj-1.0e10) minR[krow] += value*moveDown; if (krow==irow) rowUp2 = rowUp-minR[irow]; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ columnGap[kcol] = -1.0e50; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveDown; if (krow==irow) rowLo2 = rowLo-maxR[irow]; if (maxR[krow]colUpper[kcol]+primalTolerance_) { notFeasible=1;; k=columnStart[jcol]+columnLength[jcol]; istackC=nstackC+1; break; } } } } // end big loop rPos->rEnd } else if (doRowUpP) { // Start pos values loop for (int kk =rStart;kk 0.0); /* positive element */ double gap = columnGap[kcol]*value2; bool doUp = (rowUp2 - gap < -1.0e-7); if (doUp&&(markIt&(1+4))==0) { double newUpper=-1.0; double dbound = colLower[kcol] + rowUp2/value2; if (intVar[kcol]) { markIt |= 1; newUpper = floor(dbound+relaxedTolerance); } else { newUpper=dbound; if (newUpper-primalTolerance_=colLower[kcol]) { newUpper=colLower[kcol]; markIt |= 1; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } double moveDown = newUpper-colUpper[kcol]; if (!moveDown) continue; bool onList = ((markC[kcol]&3)!=0); if (nstackC<2*maxStack) { markC[kcol] = markIt; } if (nstackC<2*maxStack) { fixThis++; if (!onList) { stackC[nstackC]=kcol; saveL[nstackC]=colLower[kcol]; saveU[nstackC]=colUpper[kcol]; assert (saveU[nstackC]>saveL[nstackC]); assert (nstackC0.0) { /* should be infeasible */ assert (colLower[kcol]>newUpper+primalTolerance_); } else { objVal += moveDown*djs[kcol]; } } if (intVar[kcol]) newUpper = CoinMin(colUpper[kcol],floor(newUpper+1.0e-4)); colUpper[kcol]=newUpper; columnGap[kcol] = newUpper-colLower[kcol]-primalTolerance_; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } markC[kcol] &= ~12; if (colUpper[kcol]>1.0e10) markC[kcol] |= 8; if (colLower[kcol]<-1.0e10) markC[kcol] |= 4; /* update immediately */ for (int jj =columnStart[kcol];jj-1.0e10) minR[krow] += value*moveDown; if (krow==irow) rowUp2 = rowUp-minR[irow]; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ columnGap[kcol] = -1.0e50; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveDown; if (krow==irow) rowLo2 = rowLo-maxR[irow]; if (maxR[krow]colUpper[kcol]+primalTolerance_) { notFeasible=1;; k=columnStart[jcol]+columnLength[jcol]; istackC=nstackC+1; break; } } } } // end big loop rPos->rEnd } else if (doRowLoP) { // Start pos values loop for (int kk =rStart;kk 0.0); /* positive element */ double gap = columnGap[kcol]*value2; bool doDown = (rowLo2 +gap > 1.0e-7); if (doDown&&(markIt&(2+8))==0) { double newLower=1.0; double dbound = colUpper[kcol] + rowLo2/value2; if (intVar[kcol]) { markIt |= 2; newLower = ceil(dbound-relaxedTolerance); } else { newLower=dbound; if (newLower+primalTolerance_>colUpper[kcol]&& newLower-primalTolerance_<=colUpper[kcol]) { newLower=colUpper[kcol]; markIt |= 2; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } double moveUp = newLower-colLower[kcol]; if (!moveUp) continue; bool onList = ((markC[kcol]&3)!=0); if (nstackC<2*maxStack) { markC[kcol] = markIt; } if (nstackC<2*maxStack) { fixThis++; if (!onList) { stackC[nstackC]=kcol; saveL[nstackC]=colLower[kcol]; saveU[nstackC]=colUpper[kcol]; assert (saveU[nstackC]>saveL[nstackC]); assert (nstackCcolsol[kcol]) { if (djs[kcol]<0.0) { /* should be infeasible */ assert (newLower>colUpper[kcol]+primalTolerance_); } else { objVal += moveUp*djs[kcol]; } } if (intVar[kcol]) newLower = CoinMax(colLower[kcol],ceil(newLower-1.0e-4)); colLower[kcol]=newLower; columnGap[kcol] = colUpper[kcol]-newLower-primalTolerance_; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } markC[kcol] &= ~12; if (colUpper[kcol]>1.0e10) markC[kcol] |= 8; if (colLower[kcol]<-1.0e10) markC[kcol] |= 4; /* update immediately */ for (int jj =columnStart[kcol];jj0.0) { /* up does not change - down does */ if (minR[krow]>-1.0e10) minR[krow] += value*moveUp; if (krow==irow) rowUp2 = rowUp-minR[irow]; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ columnGap[kcol] = -1.0e50; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveUp; if (krow==irow) rowLo2 = rowLo-maxR[irow]; if (maxR[krow]colUpper[kcol]+primalTolerance_) { notFeasible=1;; k=columnStart[jcol]+columnLength[jcol]; istackC=nstackC+1; break; } } } } // end big loop rPos->rEnd } } istackC++; } if (!notFeasible) { if (objVal<=cutoff) { feasible |= feas[iway]; } else { #ifdef PRINT_DEBUG printf("not feasible on dj\n"); #endif notFeasible=1; if (iway==1&&feasible==0) { /* not feasible at all */ ninfeas=1; j=nCols-1; break; } } if (rowCutFake&&!notFeasible&&iway==1) { assert (j==stackC[0]); // add to cliques for (istackC=1;istackCaddCutIfNotDuplicate(rc); //printf("XX x%d + x%d <= 1\n",j,icol); } } } if (!notFeasible&&saveFixingInfo) { // save fixing info assert (j==stackC[0]); int toValue = (way[iway]==1) ? -1 : +1; for (istackC=1;istackCfixes(j,toValue, icol,colLower[icol]==saveL[istackC]); } } } } else if (iway==1&&feasible==0) { /* not feasible at all */ ninfeas=1; j=nCols-1; iLook=numberThisTime_; ipass=maxPass; break; } if (notFeasible) goingToTrueBound=0; if (iway==2||(iway==1&&feasible==2)) { /* keep */ iway=3; nfixed++; OsiColCut cc; int nTot=0,nFix=0,nInt=0; bool ifCut=false; for (istackC=0;istackCcolUpper[icol]+primalTolerance_) { ifCut=true; anyColumnCuts=true; } } } } if (nFix) { nTot=nFix; cleanBounds(1,nFix,index,element); cc.setUbs(nFix,index,element); nFix=0; } for (istackC=0;istackCcurrentColLower[icol]+1.0e-4) { element[nFix]=colLower[icol]; index[nFix++]=icol; nInt++; if (colsol[icol]primalTolerance_) { markC[icol]&= ~3; } else { markC[icol]=3; } } for (istackR=0;istackR=0;istackC--) { int icol=stackC[istackC]; double oldU=saveU[istackC]; double oldL=saveL[istackC]; if(goingToTrueBound==2&&istackC&&!justReplace) { // upper disaggregation cut would be // xval < upper + (old_upper-upper) (jval-down) boundChange = oldU-colUpper[icol]; if (boundChange>0.0&&oldU<1.0e10&& (colsol[icol]>colUpper[icol] + boundChange*solMove+primalTolerance_)) { // create cut OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); double newUb = colUpper[icol]-down*boundChange; if (!intVar[icol]&&newUb>1.0e3) newUb += 1.0e-7*newUb; rc.setUb(newUb); index[0]=icol; element[0]=1.0; index[1]=j; element[1]= - boundChange; // effectiveness is how far j moves double newSol = (colsol[icol]-colUpper[icol])/ boundChange; assert(newSol>solMove); rc.setEffectiveness(newSol-solMove); if (rc.effectiveness()>disaggEffectiveness) { rc.setRow(2,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); } } // lower disaggregation cut would be // xval > lower + (old_lower-lower) (jval-down) boundChange = oldL-colLower[icol]; if (boundChange<0.0&&oldL>-1.0e10&& (colsol[icol]1.0e3) newLb -= 1.0e-7*fabs(newLb); rc.setLb(newLb); rc.setUb(COIN_DBL_MAX); index[0]=icol; element[0]=1.0; index[1]=j; element[1]=- boundChange; // effectiveness is how far j moves double newSol = (colsol[icol]-colLower[icol])/ boundChange; assert(newSol>solMove); rc.setEffectiveness(newSol-solMove); if (rc.effectiveness()>disaggEffectiveness) { rc.setRow(2,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); #if 0 printf("%d original bounds %g, %g new Lo %g sol= %g int %d sol= %g\n",icol,oldL,oldU,colLower[icol],colsol[icol], j, colsol[j]); printf("-1.0 * x(%d) + %g * y(%d) <= %g\n", icol,boundChange,j,rc.ub()); #endif } } } colUpper[icol]=oldU; colLower[icol]=oldL; columnGap[icol] = oldU-oldL-primalTolerance_; markC[icol]= 0; if (oldU>1.0e10) markC[icol] |= 8; if (oldL<-1.0e10) markC[icol] |= 4; } for (istackR=0;istackRprimalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut // also see if singletons can go to good objective // Taken out as should be found elsewhere // and has to be original column length #ifdef MOVE_SINGLETONS bool moveSingletons=true; #endif for (int kk =rowStart[irow];kkcolLower[iColumn]) { if (columnLength2[iColumn]!=1) { moveSingletons=false; } } } #endif } #ifdef MOVE_SINGLETONS if (moveSingletons) { // can fix any with good costs for (int kk =rowStart[irow];kkcolLower[iColumn]) { if (columnLength2[iColumn]==1) { double value = rowElements[kk]; if (direction*objective[iColumn]*value<0.0&&!(markC[iColumn]&3)) { // Fix if (nstackC0+10.0) { lo0[nstackC0]=colUpper[iColumn]; up0[nstackC0]=colUpper[iColumn]; } else { lo0[nstackC0]=colLower[iColumn]; up0[nstackC0]=colLower[iColumn]; } nstackC0++; } } } } } } } #endif if (sum-gap*colsol[j]>maxR[irow]+primalTolerance_||(info->strengthenRow&&rowLower[irow]<-1.0e20)) { // can be a cut // subtract gap from upper and integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; double sum2=0.0; for (int kk =rowStart[irow];kk1.0e-12) { index[n]=kColumn; element[n++]=el; } coefficientExists=true; } sum2 += colsol[kColumn]*el; } if (!coefficientExists) { index[n]=j; element[n++]=-gap; sum2 -= colsol[j]*gap; } OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); double ub =rowUpper[irow]-gap*(colLower[j]+1.0); rc.setUb(ub); double effectiveness=sum2-ub; effectiveness = CoinMax(effectiveness, (sum-gap*colsol[j] -maxR[irow])/gap); if (!coefficientExists) effectiveness=CoinMax(1.0e-7, effectiveness); rc.setEffectiveness(effectiveness); //rc.setEffectiveness((sum-gap*colsol[j]-maxR[irow])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif // If strengthenRow point to row //if(info->strengthenRow) //printf("a point to row %d\n",irow); //#define STRENGTHEN_PRINT #ifdef STRENGTHEN_PRINT if (canReplace&&rowLower[irow]<-1.0e20) { printf("1Cut %g <= ",rc.lb()); int k; //printf("original row %d - %g <= <= %g - j = %d\n",iow,rowLower[irow],rowUpper[irow],j); //for (int kk=rowStart[irow];kk=0) realRow=realRows[realRow]; if (!justReplace) { rowCut.addCutIfNotDuplicate(rc,realRow); } else if (realRow>=0) { double effectiveness=0.0; for (int i=0;istrengthenRow[realRow]||info->strengthenRow[realRow]->effectiveness()>effectiveness) { delete info->strengthenRow[realRow]; rc.setEffectiveness(effectiveness); info->strengthenRow[realRow]=rc.clone(); } } } } } gap = minR[irow]-rowLower[irow]; if (!ifCut&&(gap>primalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut sum =0.0; // also see if singletons can go to good objective #ifdef MOVE_SINGLETONS bool moveSingletons=true; #endif for (int kk =rowStart[irow];kkcolLower[iColumn]) { if (columnLength2[iColumn]!=1) { moveSingletons=false; } } } #endif } #ifdef MOVE_SINGLETONS if (moveSingletons) { // can fix any with good costs for (int kk =rowStart[irow];kkcolLower[iColumn]) { if (columnLength2[iColumn]==1) { double value = rowElements[kk]; if (direction*objective[iColumn]*value>0.0&&!(markC[iColumn]&3)) { // Fix if (nstackC0+1strengthenRow&&rowUpper[irow]>1.0e20)) { // can be a cut // add gap to lower and integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; double sum2=0.0; for (int kk =rowStart[irow];kk1.0e-12) { index[n]=kColumn; element[n++]=el; } coefficientExists=true; } sum2 += colsol[kColumn]*el; } if (!coefficientExists) { index[n]=j; element[n++]=gap; sum2 += colsol[j]*gap; } OsiRowCut rc; double lb = rowLower[irow]+gap*(colLower[j]+1.0); rc.setLb(lb); rc.setUb(COIN_DBL_MAX); // effectiveness double effectiveness=lb-sum2; effectiveness = CoinMax(effectiveness, (minR[irow]- sum-gap*colsol[j])/gap); if (!coefficientExists) effectiveness=CoinMax(1.0e-7, effectiveness); rc.setEffectiveness(effectiveness); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(info->strengthenRow) //printf("b point to row %d\n",irow); #ifdef STRENGTHEN_PRINT if (canReplace&&rowUpper[irow]>1.0e20) { printf("2Cut %g <= ",rc.lb()); int k; for ( k=0;k1.0e20) ? irow : -1; if (realRows&&realRow>=0) realRow=realRows[realRow]; if (!justReplace) { rowCut.addCutIfNotDuplicate(rc,realRow); } else if (realRow>=0) { double effectiveness=0.0; for (int i=0;istrengthenRow[realRow]||info->strengthenRow[realRow]->effectiveness()>effectiveness) { delete info->strengthenRow[realRow]; rc.setEffectiveness(effectiveness); info->strengthenRow[realRow]=rc.clone(); } } } } } } minR[irow]=saveMin[istackR]; maxR[irow]=saveMax[istackR]; markR[irow]=-1; } } else { if (iway==1&&feasible==3) { iway=3; #ifdef MOVE_SINGLETONS // look for singletons that can move (just at root) if ((rowCuts&2)!=0&&goingToTrueBound&&info->strengthenRow) { for (istackR=0;istackRprimalTolerance_) { // also see if singletons can go to good objective bool moveSingletons=true; for (int kk =rowStart[irow];kkcolLower[iColumn]) { if (columnLength2[iColumn]!=1) { moveSingletons=false; } } } } if (moveSingletons) { // can fix any with good costs for (int kk =rowStart[irow];kkcolLower[iColumn]) { if (columnLength2[iColumn]==1) { double value = rowElements[kk]; if (direction*objective[iColumn]*value<0.0&&!(markC[iColumn]&3)) { // Fix stackC[nstackC]=iColumn; saveL[nstackC]=colLower[iColumn]; saveU[nstackC]=colUpper[iColumn]; assert (saveU[nstackC]>saveL[nstackC]); if (value>0.0) { colLower[iColumn]=colUpper[iColumn]; } else { colUpper[iColumn]=colLower[iColumn]; } columnGap[iColumn] = -primalTolerance_; assert (nstackCprimalTolerance_) { // also see if singletons can go to good objective bool moveSingletons=true; for (int kk =rowStart[irow];kkcolLower[iColumn]) { if (columnLength2[iColumn]!=1) { moveSingletons=false; } } } } if (moveSingletons) { // can fix any with good costs for (int kk =rowStart[irow];kkcolLower[iColumn]) { if (columnLength2[iColumn]==1) { double value = rowElements[kk]; if (direction*objective[iColumn]*value>0.0&&!(markC[iColumn]&3)) { // Fix stackC[nstackC]=iColumn; saveL[nstackC]=colLower[iColumn]; saveU[nstackC]=colUpper[iColumn]; assert (saveU[nstackC]>saveL[nstackC]); if (value<0.0) { colLower[iColumn]=colUpper[iColumn]; } else { colUpper[iColumn]=colLower[iColumn]; } columnGap[iColumn] = -primalTolerance_; assert (nstackC=0;istackC--) { int icol=stackC[istackC]; markC[icol]=istackC+1000; } OsiColCut cc; int nTot=0,nFix=0,nInt=0; bool ifCut=false; for (istackC=1;istackC=0) { if (CoinMin(lo0[istackC],colLower[icol])>saveL[istackC1]+1.0e-4) { saveL[istackC1]=CoinMin(lo0[istackC],colLower[icol]); if (intVar[icol]/*||!info->inTree*/) { element[nFix]=saveL[istackC1]; index[nFix++]=icol; nInt++; if (colsol[icol]=0) { if (CoinMax(up0[istackC],colUpper[icol])inTree*/) { element[nFix]=saveU[istackC1]; index[nFix++]=icol; nInt++; if (colsol[icol]>saveU[istackC1]+primalTolerance_) ifCut=true; } nfixed++; } else if (!info->inTree&&saveL[0]==0.0&&saveU[0]==1.0) { // See if can do two cut double upperWhenDown = up0[istackC]; double lowerWhenDown = lo0[istackC]; double upperWhenUp = colUpper[icol]; double lowerWhenUp = colLower[icol]; double upperOriginal = saveU[istackC1]; double lowerOriginal = saveL[istackC1]; if (upperWhenDownupperOriginal-1.0e-12) { OsiRowCut rc; rc.setLb(lowerOriginal); rc.setUb(lowerOriginal); rc.setEffectiveness(1.0e-5); int index[2]; double element[2]; index[0]=j; index[1]=icol; element[0]=-(upperOriginal-lowerOriginal); // If zero then - must have been fixed without noticing! if (fabs(element[0])>1.0e-8) { element[1]=1.0; rc.setRow(2,index,element,false); cs.insert(rc); } } else if (upperWhenUpupperOriginal-1.0e-12) { OsiRowCut rc; rc.setLb(upperOriginal); rc.setUb(upperOriginal); rc.setEffectiveness(1.0e-5); int index[2]; double element[2]; index[0]=j; index[1]=icol; element[0]=upperOriginal-lowerOriginal; element[1]=1.0; rc.setRow(2,index,element,false); cs.insert(rc); } } } } if (nFix) { nTot+=nFix; cleanBounds(1,nFix,index,element); cc.setUbs(nFix,index,element); } // could tighten continuous as well if (nInt) { if (ifCut) { cc.setEffectiveness(100.0); } else { cc.setEffectiveness(1.0e-5); } #ifdef CGL_DEBUG checkBounds(debugger,cc); #endif cs.insert(cc); } } else { goingToTrueBound=0; } double solMove = up-saveSolval; double boundChange; /* restore all */ for (istackC=nstackC-1;istackC>=0;istackC--) { int icol=stackC[istackC]; double oldU=saveU[istackC]; double oldL=saveL[istackC]; if(goingToTrueBound==2&&istackC&&!justReplace) { // upper disaggregation cut would be // xval < upper + (old_upper-upper) (up-jval) boundChange = oldU-colUpper[icol]; if (boundChange>0.0&&oldU<1.0e10&& (colsol[icol]>colUpper[icol] + boundChange*solMove+primalTolerance_)) { // create cut OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); double newUb = colUpper[icol]+up*boundChange; if (!intVar[icol]&&newUb>1.0e3) newUb += 1.0e-7*newUb; rc.setUb(newUb); index[0]=icol; element[0]=1.0; index[1]=j; element[1]= + boundChange; // effectiveness is how far j moves double newSol = (colsol[icol]-colUpper[icol])/ boundChange; assert(newSol>solMove); rc.setEffectiveness(newSol-solMove); if (rc.effectiveness()>disaggEffectiveness) { rc.setRow(2,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); } } // lower disaggregation cut would be // xval > lower + (old_lower-lower) (up-jval) boundChange = oldL-colLower[icol]; if (boundChange<0.0&&oldL>-1.0e10&& (colsol[icol]1.0e3) newLb -= 1.0e-7*fabs(newLb); rc.setLb(newLb); rc.setUb(COIN_DBL_MAX); index[0]=icol; element[0]=1.0; index[1]=j; element[1]= + boundChange; // effectiveness is how far j moves double newSol = (colsol[icol]-colLower[icol])/ boundChange; assert(newSol>solMove); rc.setEffectiveness(newSol-solMove); if (rc.effectiveness()>disaggEffectiveness) { rc.setRow(2,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); } } } colUpper[icol]=oldU; colLower[icol]=oldL; columnGap[icol] = oldU-oldL-primalTolerance_; if (oldU>oldL+1.0e-4) { markC[icol]=0; if (oldU>1.0e10) markC[icol] |= 8; if (oldL<-1.0e10) markC[icol] |= 4; } else { markC[icol]=3; } } for (istackR=0;istackRstrengthenRow&&(goingToTrueBound==2); bool ifCut=anyColumnCuts; double gap = rowUpper[irow]-maxR[irow]; double sum=0.0; if (!ifCut&&(gap>primalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut for (int kk =rowStart[irow];kkrowUpper[irow]+primalTolerance_||(canReplace&&rowLower[irow]<-1.e20)) { // can be a cut // add gap to integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; double sum2=0.0; for (int kk =rowStart[irow];kk1.0e-12) { index[n]=kColumn; element[n++]=el; } coefficientExists=true; } sum2 += colsol[kColumn]*el; } if (!coefficientExists) { index[n]=j; element[n++]=gap; sum2 += colsol[j]*gap; } OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); double ub = rowUpper[irow]+gap*(colUpper[j]-1.0); rc.setUb(ub); // effectiveness double effectiveness=sum2-ub; effectiveness = CoinMax(effectiveness, (sum+gap*colsol[j]- rowUpper[irow])/gap); if (!coefficientExists) effectiveness=CoinMax(1.0e-7, effectiveness); rc.setEffectiveness(effectiveness); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(canReplace) //printf("c point to row %d\n",irow); #ifdef STRENGTHEN_PRINT if (canReplace&&rowLower[irow]<-1.0e20) { printf("3Cut %g <= ",rc.lb()); int k; for ( k=0;k=0) realRow=realRows[realRow]; if (!justReplace) { rowCut.addCutIfNotDuplicate(rc,realRow); } else if (realRow>=0) { double effectiveness=0.0; for (int i=0;istrengthenRow[realRow]||info->strengthenRow[realRow]->effectiveness()>effectiveness) { delete info->strengthenRow[realRow]; rc.setEffectiveness(effectiveness); info->strengthenRow[realRow]=rc.clone(); } } } } } gap = minR[irow]-rowLower[irow]; if (!ifCut&&(gap>primalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut if (!sum) { for (int kk =rowStart[irow];kk1.0e20)) { // can be a cut // subtract gap from integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; double sum2=0.0; for (int kk =rowStart[irow];kk1.0e-12) { index[n]=kColumn; element[n++]=el; } coefficientExists=true; } sum2 += colsol[kColumn]*el; } if (!coefficientExists) { index[n]=j; element[n++]=-gap; sum2 -= colsol[j]*gap; } OsiRowCut rc; double lb = rowLower[irow]-gap*(colUpper[j]-1); rc.setLb(lb); rc.setUb(COIN_DBL_MAX); double effectiveness=lb-sum2; effectiveness = CoinMax(effectiveness, (rowLower[irow]- sum+gap*colsol[j])/gap); if (!coefficientExists) effectiveness=CoinMax(1.0e-7, effectiveness); rc.setEffectiveness(effectiveness); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(canReplace) //printf("d point to row %d\n",irow); #ifdef STRENGTHEN_PRINT if (canReplace&&rowUpper[irow]>1.0e20) { printf("4Cut %g <= ",rc.lb()); int k; for ( k=0;k1.0e20) ? irow : -1; if (realRows&&realRow>=0) realRow=realRows[realRow]; if (!justReplace) { rowCut.addCutIfNotDuplicate(rc,realRow); } else if (realRow>=0) { double effectiveness=0.0; for (int i=0;istrengthenRow[realRow]||info->strengthenRow[realRow]->effectiveness()>effectiveness) { delete info->strengthenRow[realRow]; rc.setEffectiveness(effectiveness); info->strengthenRow[realRow]=rc.clone(); } } } } } } minR[irow]=saveMin[istackR]; maxR[irow]=saveMax[istackR]; markR[irow]=-1; } } } } } } if ((!ninfeas&&!rowCut.outOfSpace())&&(info->strengthenRow|| !rowCut.numberCuts())&&rowCuts) { // Try and find ALL big M's for (int i = 0; i < nRowsSafe; ++i) { if ((rowLower[i]>-1.0e20||rowUpper[i]<1.0e20)&& (!info->strengthenRow||!info->strengthenRow[i])) { int iflagu = 0; int iflagl = 0; double dmaxup = 0.0; double dmaxdown = 0.0; int krs = rowStart[i]; int kre = rowStart[i+1]; int kInt = -1; double rhsAdjustment=0.0; int nPosInt=0; int nNegInt=0; double valueInteger=0.0; // Find largest integer coefficient int k; for ( k = krs; k < kre; ++k) { int j = column[k]; if (intVar[j]) { double value=rowElements[k]; if (colUpper[j]>colLower[j]&&!colLower[j]&& fabs(value)>fabs(valueInteger)) { kInt=j; valueInteger=value; } } } if (kInt>=0) { double upperBound = CoinMin(colUpper[kInt],static_cast(COIN_INT_MAX)); double upAdjust=0.0; double downAdjust=0.0; for (k = krs; k < kre; ++k) { double value=rowElements[k]; int j = column[k]; if (colUpper[j]==colLower[j]) { rhsAdjustment += colUpper[j]*value; continue; } if (intVar[j]) { if (value>0.0) nPosInt++; else nNegInt++; } else { nPosInt = -nCols; } if (j!=kInt) { // treat as continuous if (value > 0.0) { if (colUpper[j] >= 1e15) { dmaxup = 1e31; ++iflagu; } else { dmaxup += colUpper[j] * value; } if (colLower[j] <= -1e15) { dmaxdown = -1e31; ++iflagl; } else { dmaxdown += colLower[j] * value; } } else if (value<0.0) { if (colUpper[j] >= 1e15) { dmaxdown = -1e31; ++iflagl; } else { dmaxdown += colUpper[j] * value; } if (colLower[j] <= -1e15) { dmaxup = 1e31; ++iflagu; } else { dmaxup += colLower[j] * value; } } } else { // Chosen variable if (value > 0.0) { if (colUpper[j] >= 1e15) { upAdjust = 1e31; } else { upAdjust = colUpper[j] * value; } if (colLower[j] <= -1e15) { downAdjust = -1e31; } else { downAdjust = colLower[j] * value; } } else if (value<0.0) { if (colUpper[j] >= 1e15) { downAdjust = -1e31; } else { downAdjust = colUpper[j] * value; } if (colLower[j] <= -1e15) { upAdjust = 1e31; } else { upAdjust = colLower[j] * value; } } } } dmaxup += rhsAdjustment; dmaxdown += rhsAdjustment; // end of row if (iflagu) dmaxup=1.0e31; if (iflagl) dmaxdown=-1.0e31; // See if redundant if (dmaxdown+downAdjust>rowLower[i]-tolerance&& dmaxup+upAdjustrowLower[i]&& dmaxup+valueInteger*upperBoundrowLower[i]&&dmaxup+valueIntegerrowUpper[i]+primalTolerance_)) { // can tighten (maybe) double saveValue = valueInteger; if (valueInteger>0.0) { assert (dmaxdownrowUpper[i]); valueInteger = rowUpper[i]-dmaxup; } if (fabs(saveValue-valueInteger)>1.0e-12) { // take OsiRowCut rc; rc.setLb(rowLower[i]); rc.setUb(rowUpper[i]); int n=0; double sum=0.0; for (int kk=rowStart[i];kk=0.0); #if 0 if (fabs(rowElements[kk])>1.01*fabs(valueInteger)) { printf("row %d changing coefficient of %d from %g to %g\n", i,kInt,rowElements[kk],valueInteger); } #endif if (fabs(valueInteger)>1.0e-12) { index[n]=column[kk]; element[n++]=valueInteger; } } } double gap = 0.0; if (sumrowUpper[i]) gap=sum-rowUpper[i]; if (gap>1.0e-4||info->strengthenRow!=NULL) { gap += 1.0e5; rc.setEffectiveness(gap); rc.setRow(n,index,element,false); #ifdef STRENGTHEN_PRINT { printf("1aCut %g <= ",rc.lb()); int irow =i; int k; for ( k=0;kstrengthenRow,info->pass); } else { for (int i=0;i=0) { OsiRowCut * cut = info->strengthenRow[realRow]; if (cut) { #ifdef CLP_INVESTIGATE printf("Row %d, real row %d effectiveness %g\n",i,realRow,cut->effectiveness()); #endif cs.insert(cut); } } } } } #if 0 { int numberRowCutsAfter = cs.sizeRowCuts() ; int k ; for (k = 0;knumberCuts(); CoinBigIndex numberElements = 2*numberCliques_; cliqueEntry_ = new CliqueEntry [numberElements]; int * column = reinterpret_cast(cliqueEntry_); numberElements = 0; for (int iCut=0;iCutcut(iCut)->row().getIndices()[0]; column[numberElements++]=rowCutFake->cut(iCut)->row().getIndices()[1]; } } delete rowCutFake; return (ninfeas); } // Does probing and adding cuts int CglProbing::probeCliques( const OsiSolverInterface & si, const OsiRowCutDebugger * #ifdef CGL_DEBUG debugger #endif ,OsiCuts & cs, double * colLower, double * colUpper, CoinPackedMatrix *rowCopy, CoinPackedMatrix *columnCopy, const int * realRows, double * rowLower, double * rowUpper, char * intVar, double * minR, double * maxR, int * markR, CglTreeInfo * info) { // Set up maxes int maxStack = info->inTree ? maxStack_ : maxStackRoot_; int nRows=rowCopy->getNumRows(); int nCols=rowCopy->getNumCols(); double * colsol = new double[nCols]; double * djs = new double[nCols]; const double * currentColLower = si.getColLower(); const double * currentColUpper = si.getColUpper(); double * tempL = new double [nCols]; double * tempU = new double [nCols]; int * markC = new int [nCols]; int * stackC = new int [2*nCols]; int * stackR = new int [nRows]; double * saveL = new double [2*nCols]; double * saveU = new double [2*nCols]; double * saveMin = new double [nRows]; double * saveMax = new double [nRows]; double * element = new double[nCols]; int * index = new int[nCols]; // For trying to extend cliques int * cliqueStack=NULL; int * cliqueCount=NULL; int * to_01=NULL; int * cliqueAdd = NULL; int maxCliqueAdded=nCols+nRows; int numberCliqueAdded=0; int * cliqueAdd2 = NULL; if (!mode_) { cliqueAdd = new int [2*maxCliqueAdded]; cliqueAdd2 = cliqueAdd + maxCliqueAdded; to_01 = new int[nCols]; cliqueStack = new int[numberCliques_]; cliqueCount = new int[numberCliques_]; int i; for (i=0;iinTree ? nRows/3 : nRows; row_cut rowCut(nRowsFake, !info->inTree); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * rowElements = rowCopy->getElements(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); const double * columnElements = columnCopy->getElements(); double movement; int i, j, k,kk,jj; int kcol,krow; bool anyColumnCuts=false; double dbound, value, value2; int ninfeas=0; int rowCuts; double disaggEffectiveness; if (mode_) { /* clean up djs and solution */ CoinMemcpyN(si.getReducedCost(),nCols,djs); CoinMemcpyN( si.getColSolution(),nCols,colsol); disaggEffectiveness=1.0e-3; rowCuts=rowCuts_; } else { // need to go from a neutral place memset(djs,0,nCols*sizeof(double)); CoinMemcpyN( si.getColSolution(),nCols,colsol); disaggEffectiveness=-1.0e10; if (rowCuts_!=4) rowCuts=1; else rowCuts=4; } for (i = 0; i < nCols; ++i) { /* was if (intVar[i]) */ if (1) { if (colUpper[i]-colLower[i]>1.0e-8) { if (colsol[i]colUpper[i]-primalTolerance_) { colsol[i]=colUpper[i]; djs[i] = CoinMin(0.0,djs[i]); } else { djs[i]=0.0; } /*if (fabs(djs[i])<1.0e-5) djs[i]=0.0;*/ } } } int ipass=0,nfixed=-1; double cutoff; bool cutoff_available = si.getDblParam(OsiDualObjectiveLimit,cutoff); if (!cutoff_available||usingObjective_<0) { // cut off isn't set or isn't valid cutoff = si.getInfinity(); } cutoff *= si.getObjSense(); if (fabs(cutoff)>1.0e30) assert (cutoff>1.0e30); double current = si.getObjValue(); // make irrelevant if mode is 0 if (!mode_) cutoff=COIN_DBL_MAX; /* for both way coding */ int nstackC0=-1; int * stackC0 = new int[maxStack]; double * lo0 = new double[maxStack]; double * up0 = new double[maxStack]; int nstackR,nstackC; for (i=0;iinTree ? maxPass_ : maxPassRoot_; // If we are going to replace coefficient then we don't need to be effective double needEffectiveness = info->strengthenRow ? -1.0e10 : 1.0e-3; while (ipass=colUpper[j]-tolerance||solval<=colLower[j]+tolerance||up==down) { if (solval<=colLower[j]+2.0*tolerance) { solval = colLower[j]+1.0e-1; down=colLower[j]; up=down+1.0; } else if (solval>=colUpper[j]-2.0*tolerance) { solval = colUpper[j]-1.0e-1; up=colUpper[j]; down=up-1; } else { // odd up=down+1.0; solval = down+1.0e-1; } } assert (up<=colUpper[j]); assert (down>=colLower[j]); assert (up>down); if ((solval-down>1.0e-6&&up-solval>1.0e-6)||mode_!=1) { int istackC,iway, istackR; int way[]={1,2,1}; int feas[]={1,2,4}; int feasible=0; int notFeasible; for (iway=0;iway<3;iway ++) { int fixThis=0; double objVal=current; int goingToTrueBound=0; stackC[0]=j; markC[j]=way[iway]; double solMovement; if (way[iway]==1) { movement=down-colUpper[j]; solMovement = down-colsol[j]; assert(movement<-0.99999); if (fabs(down-colLower[j])<1.0e-7) { goingToTrueBound=2; down=colLower[j]; } } else { movement=up-colLower[j]; solMovement = up-colsol[j]; assert(movement>0.99999); if (fabs(up-colUpper[j])<1.0e-7) { goingToTrueBound=2; up=colUpper[j]; } } if (goingToTrueBound&&(colUpper[j]-colLower[j]>1.5||colLower[j])) goingToTrueBound=1; // switch off disaggregation if not wanted if ((rowCuts&1)==0) goingToTrueBound=0; #ifdef PRINT_DEBUG if (fabs(movement)>1.01) { printf("big %d %g %g %g\n",j,colLower[j],solval,colUpper[j]); } #endif if (solMovement*djs[j]>0.0) objVal += solMovement*djs[j]; nstackC=1; nstackR=0; saveL[0]=colLower[j]; saveU[0]=colUpper[j]; assert (saveU[0]>saveL[0]); notFeasible=0; if (movement<0.0) { colUpper[j] += movement; colUpper[j] = floor(colUpper[j]+0.5); #ifdef PRINT_DEBUG printf("** Trying %d down to 0\n",j); #endif } else { colLower[j] += movement; colLower[j] = floor(colLower[j]+0.5); #ifdef PRINT_DEBUG printf("** Trying %d up to 1\n",j); #endif } if (fabs(colUpper[j]-colLower[j])<1.0e-6) markC[j]=3; // say fixed istackC=0; /* update immediately */ for (k=columnStart[j];k0.0) { /* up */ if (value>0.0) { /* up does not change - down does */ if (minR[irow]>-1.0e10) minR[irow] += value; if (minR[irow]>rowUpper[irow]+1.0e-5) { notFeasible=1; istackC=1; break; } } else { /* down does not change - up does */ if (maxR[irow]<1.0e10) maxR[irow] += value; if (maxR[irow]-1.0e10) minR[irow] -= value; if (minR[irow]>rowUpper[irow]+1.0e-5) { notFeasible=1; istackC=1; break; } } else { /* down does not change - up does */ if (maxR[irow]<1.0e10) maxR[irow] -= value; if (maxR[irow]=0) { int start; int end; if (colLower[jcol]>saveL[istackC]) { // going up start = oneFixStart_[jcol]; end = zeroFixStart_[jcol]; } else { assert (colUpper[jcol]saveL[nstackC]); nstackC++; if (!kway) { // going up double solMovement=1.0-colsol[kcol]; if (solMovement>0.0001) { assert (djs[kcol]>=0.0); objVal += djs[kcol]*solMovement; } colLower[kcol]=1.0; /* update immediately */ for (int jj =columnStart[kcol];jj0.0) { /* up does not change - down does */ if (minR[krow]>-1.0e10) minR[krow] += value; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value; if (maxR[krow]-1.0e10) minR[krow] -= value; if (minR[krow]>rowUpper[krow]+1.0e-5) { notFeasible=1; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] -= value; if (maxR[krow] colLower[kcol] + primalTolerance_) { if (intVar[kcol]) { markIt |= 2; newLower = ceil(dbound-primalTolerance_); } else { newLower=dbound; if (newLower+primalTolerance_>colUpper[kcol]&& newLower-primalTolerance_<=colUpper[kcol]) { newLower=colUpper[kcol]; markIt |= 2; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveUp = newLower-colLower[kcol]; } } if (colLower[kcol] > -1e10 && (markIt&1)==0 && rowLower[irow]>-1.0e10) { dbound = colLower[kcol] + (rowLower[irow]-maxR[irow])/value2; if (dbound < colUpper[kcol] - primalTolerance_) { if (intVar[kcol]) { markIt |= 1; newUpper = floor(dbound+primalTolerance_); } else { newUpper=dbound; if (newUpper-primalTolerance_=colLower[kcol]) { newUpper=colLower[kcol]; markIt |= 1; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveDown = newUpper-colUpper[kcol]; } } } else { /* positive element */ if (colUpper[kcol] < 1e10 && (markIt&2)==0 && rowLower[irow]>-1.0e10) { dbound = colUpper[kcol] + (rowLower[irow]-maxR[irow])/value2; if (dbound > colLower[kcol] + primalTolerance_) { if (intVar[kcol]) { markIt |= 2; newLower = ceil(dbound-primalTolerance_); } else { newLower=dbound; if (newLower+primalTolerance_>colUpper[kcol]&& newLower-primalTolerance_<=colUpper[kcol]) { newLower=colUpper[kcol]; markIt |= 2; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveUp = newLower-colLower[kcol]; } } if (colLower[kcol] > -1e10 && (markIt&1)==0 && rowUpper[irow]<1.0e10) { dbound = colLower[kcol] + (rowUpper[irow]-minR[irow])/value2; if (dbound < colUpper[kcol] - primalTolerance_) { if (intVar[kcol]) { markIt |= 1; newUpper = floor(dbound+primalTolerance_); } else { newUpper=dbound; if (newUpper-primalTolerance_=colLower[kcol]) { newUpper=colLower[kcol]; markIt |= 1; //markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveDown = newUpper-colUpper[kcol]; } } } if (nstackC<2*maxStack) { markC[kcol] = markIt; } if (moveUp&&nstackC<2*maxStack) { fixThis++; #ifdef PRINT_DEBUG printf("lower bound on %d increased from %g to %g by row %d %g %g\n",kcol,colLower[kcol],newLower,irow,rowLower[irow],rowUpper[irow]); value=0.0; for (jj=rowStart[irow];jjprimalTolerance_) { printf("(%d, %g) ",ii,rowElements[jj]); } else { value += rowElements[jj]*colLower[ii]; } } printf(" - fixed %g\n",value); for (jj=rowStart[irow];jjsaveL[nstackC]); nstackC++; onList=true; } if (newLower>colsol[kcol]) { if (djs[kcol]<0.0) { /* should be infeasible */ assert (newLower>colUpper[kcol]+primalTolerance_); } else { objVal += moveUp*djs[kcol]; } } if (intVar[kcol]) newLower = CoinMax(colLower[kcol],ceil(newLower-1.0e-4)); colLower[kcol]=newLower; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } /* update immediately */ for (jj=columnStart[kcol];jj0.0) { /* up does not change - down does */ if (minR[krow]>-1.0e10) minR[krow] += value*moveUp; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveUp; if (maxR[krow]primalTolerance_) { printf("(%d, %g) ",ii,rowElements[jj]); } else { value += rowElements[jj]*colLower[ii]; } } printf(" - fixed %g\n",value); for (jj=rowStart[irow];jjsaveL[nstackC]); nstackC++; onList=true; } if (newUpper0.0) { /* should be infeasible */ assert (colLower[kcol]>newUpper+primalTolerance_); } else { objVal += moveDown*djs[kcol]; } } if (intVar[kcol]) newUpper = CoinMin(colUpper[kcol],floor(newUpper+1.0e-4)); colUpper[kcol]=newUpper; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } /* update immediately */ for (jj=columnStart[kcol];jj-1.0e10) minR[krow] += value*moveDown; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveDown; if (maxR[krow]colUpper[kcol]+primalTolerance_) { notFeasible=1;; k=columnStart[jcol]+columnLength[jcol]; istackC=nstackC+1; #ifdef PRINT_DEBUG printf("** not feasible this way\n"); #endif break; } } } #if 0 } #endif } istackC++; } if (!notFeasible) { if (objVal<=cutoff) { feasible |= feas[iway]; } else { #ifdef PRINT_DEBUG printf("not feasible on dj\n"); #endif notFeasible=1; if (iway==1&&feasible==0) { /* not feasible at all */ ninfeas=1; j=nCols-1; break; } } } else if (iway==1&&feasible==0) { /* not feasible at all */ ninfeas=1; j=nCols-1; iLook=numberThisTime_; ipass=maxPass; break; } if (notFeasible) goingToTrueBound=0; if (iway==2||(iway==1&&feasible==2)) { /* keep */ iway=3; nfixed++; if (mode_) { OsiColCut cc; int nTot=0,nFix=0,nInt=0; bool ifCut=false; for (istackC=0;istackCcolUpper[icol]+primalTolerance_) { ifCut=true; anyColumnCuts=true; } } } } if (nFix) { nTot=nFix; cleanBounds(1,nFix,index,element); cc.setUbs(nFix,index,element); nFix=0; } for (istackC=0;istackCcurrentColLower[icol]+1.0e-4) { element[nFix]=colLower[icol]; index[nFix++]=icol; nInt++; if (colsol[icol]primalTolerance_) { markC[icol]=0; } else { markC[icol]=3; } } for (istackR=0;istackR=0;istackC--) { int icol=stackC[istackC]; double oldU=saveU[istackC]; double oldL=saveL[istackC]; if(goingToTrueBound==2&&istackC) { // Work for extending cliques if (!mode_&&numberCliques_) { int i_01 = to_01[icol]; if (i_01>=0) { int start; int end; if (colLower[icol]) { // going up - but we want weak way start = zeroFixStart_[icol]; end = endFixStart_[icol]; } else { // going down - but we want weak way start = oneFixStart_[icol]; end = zeroFixStart_[icol]; } //if (end>start) //printf("j %d, other %d is in %d cliques\n", // j,i_01,end-start); for (int i=start;i0.0&&oldU<1.0e10&& (!mode_||colsol[icol]>colUpper[icol] + boundChange*solMove+primalTolerance_)) { // create cut OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); double newUb = colUpper[icol]-down*boundChange; if (!intVar[icol]&&newUb>1.0e3) newUb += 1.0e-7*newUb; rc.setUb(newUb); index[0]=icol; element[0]=1.0; index[1]=j; element[1]= - boundChange; // effectiveness is how far j moves double newSol = (colsol[icol]-colUpper[icol])/ boundChange; if (mode_) assert(newSol>solMove); rc.setEffectiveness(newSol-solMove); if (rc.effectiveness()>disaggEffectiveness) { rc.setRow(2,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); } } // lower disaggregation cut would be // xval > lower + (old_lower-lower) (jval-down) boundChange = oldL-colLower[icol]; if (boundChange<0.0&&oldL>-1.0e10&& (!mode_||colsol[icol]1.0e3) newLb -= 1.0e-7*fabs(newLb); rc.setLb(newLb); rc.setUb(COIN_DBL_MAX); index[0]=icol; element[0]=1.0; index[1]=j; element[1]=- boundChange; // effectiveness is how far j moves double newSol = (colsol[icol]-colLower[icol])/ boundChange; if (mode_) assert(newSol>solMove); rc.setEffectiveness(newSol-solMove); if (rc.effectiveness()>disaggEffectiveness) { rc.setRow(2,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); #if 0 printf("%d original bounds %g, %g new Lo %g sol= %g int %d sol= %g\n",icol,oldL,oldU,colLower[icol],colsol[icol], j, colsol[j]); printf("-1.0 * x(%d) + %g * y(%d) <= %g\n", icol,boundChange,j,rc.ub()); #endif } } } colUpper[icol]=oldU; colLower[icol]=oldL; markC[icol]=0; } if (nCliquesAffected) { for (int i=0;i1) printf("** could extend clique by adding j!\n"); } } } for (istackR=0;istackRprimalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut for (kk=rowStart[irow];kkmaxR[irow]+primalTolerance_||(info->strengthenRow&&rowLower[irow]<-1.0e20)) { // can be a cut // subtract gap from upper and integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; for (kk=rowStart[irow];kk1.0e-12) { index[n]=column[kk]; element[n++]=value; } coefficientExists=true; } } if (!coefficientExists) { index[n]=j; element[n++]=-gap; } OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb(rowUpper[irow]-gap*(colLower[j]+1.0)); // effectiveness is how far j moves rc.setEffectiveness((sum-gap*colsol[j]-maxR[irow])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif // If strengthenRow point to row //if(info->strengthenRow) //printf("a point to row %d\n",irow); #ifdef STRENGTHEN_PRINT if (rowLower[irow]<-1.0e20) { printf("5Cut %g <= ",rc.lb()); int k; for ( k=0;k0) realRow=realRows[realRow]; rowCut.addCutIfNotDuplicate(rc,realRow); } } } gap = minR[irow]-rowLower[irow]; if (!ifCut&&(gap>primalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut if (!sum) { for (kk=rowStart[irow];kkstrengthenRow&&rowUpper[irow]>1.0e20)) { // can be a cut // add gap to lower and integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; for (kk=rowStart[irow];kk1.0e-12) { index[n]=column[kk]; element[n++]=value; } coefficientExists=true; } } if (!coefficientExists) { index[n]=j; element[n++]=gap; } OsiRowCut rc; rc.setLb(rowLower[irow]+gap*(colLower[j]+1.0)); rc.setUb(COIN_DBL_MAX); // effectiveness is how far j moves rc.setEffectiveness((minR[irow]-sum-gap*colsol[j])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(info->strengthenRow) //printf("b point to row %d\n",irow); #ifdef STRENGTHEN_PRINT if (rowUpper[irow]>1.0e20) { printf("6Cut %g <= ",rc.lb()); int k; for ( k=0;k1.0e20) ? irow : -1; if (realRows&&realRow>0) realRow=realRows[realRow]; rowCut.addCutIfNotDuplicate(rc,realRow); } } } } minR[irow]=saveMin[istackR]; maxR[irow]=saveMax[istackR]; markR[irow]=-1; } } else { if (iway==1&&feasible==3) { iway=3; /* point back to stack */ for (istackC=nstackC-1;istackC>=0;istackC--) { int icol=stackC[istackC]; markC[icol]=istackC+1000; } if (mode_) { OsiColCut cc; int nTot=0,nFix=0,nInt=0; bool ifCut=false; for (istackC=0;istackC=0) { if (CoinMin(lo0[istackC],colLower[icol])>saveL[istackC1]+1.0e-4) { saveL[istackC1]=CoinMin(lo0[istackC],colLower[icol]); if (intVar[icol]) { element[nFix]=saveL[istackC1]; index[nFix++]=icol; nInt++; if (colsol[icol]=0) { if (CoinMax(up0[istackC],colUpper[icol])saveU[istackC1]+primalTolerance_) ifCut=true; } nfixed++; } } } if (nFix) { nTot+=nFix; cleanBounds(1,nFix,index,element); cc.setUbs(nFix,index,element); } // could tighten continuous as well if (nInt) { if (ifCut) { cc.setEffectiveness(100.0); } else { cc.setEffectiveness(1.0e-5); } #ifdef CGL_DEBUG checkBounds(debugger,cc); #endif cs.insert(cc); } } } else { goingToTrueBound=0; } double solMove = up-saveSolval; double boundChange; /* restore all */ int nCliquesAffected=0; for (istackC=nstackC-1;istackC>=0;istackC--) { int icol=stackC[istackC]; double oldU=saveU[istackC]; double oldL=saveL[istackC]; if(goingToTrueBound==2&&istackC) { // Work for extending cliques if (!mode_&&numberCliques_&&iway==3) { int i_01 = to_01[icol]; if (i_01>=0) { int start; int end; if (colLower[icol]) { // going up - but we want weak way start = zeroFixStart_[icol]; end = endFixStart_[icol]; } else { // going down - but we want weak way start = oneFixStart_[icol]; end = zeroFixStart_[icol]; } //if (end>start) //printf("up j %d, other %d is in %d cliques\n", // j,i_01,end-start); for (int i=start;i0.0&&oldU<1.0e10&& (!mode_||colsol[icol]>colUpper[icol] + boundChange*solMove+primalTolerance_)) { // create cut OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); double newUb = colUpper[icol]+up*boundChange; if (!intVar[icol]&&newUb>1.0e3) newUb += 1.0e-7*newUb; rc.setUb(newUb); index[0]=icol; element[0]=1.0; index[1]=j; element[1]= + boundChange; // effectiveness is how far j moves double newSol = (colsol[icol]-colUpper[icol])/ boundChange; if (mode_) assert(newSol>solMove); rc.setEffectiveness(newSol-solMove); if (rc.effectiveness()>disaggEffectiveness) { rc.setRow(2,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); } } // lower disaggregation cut would be // xval > lower + (old_lower-lower) (up-jval) boundChange = oldL-colLower[icol]; if (boundChange<0.0&&oldL>-1.0e10&& (!mode_||colsol[icol]1.0e3) newLb -= 1.0e-7*fabs(newLb); rc.setLb(newLb); rc.setUb(COIN_DBL_MAX); index[0]=icol; element[0]=1.0; index[1]=j; element[1]= + boundChange; // effectiveness is how far j moves double newSol = (colsol[icol]-colLower[icol])/ boundChange; if (mode_) assert(newSol>solMove); rc.setEffectiveness(newSol-solMove); if (rc.effectiveness()>disaggEffectiveness) { rc.setRow(2,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif rowCut.addCutIfNotDuplicate(rc); } } } colUpper[icol]=oldU; colLower[icol]=oldL; if (oldU>oldL+1.0e-4) markC[icol]=0; else markC[icol]=3; } if (nCliquesAffected) { for (int i=0;i1) printf("** could extend clique by adding j!\n"); } } } for (istackR=0;istackRprimalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut for (kk=rowStart[irow];kkrowUpper[irow]+primalTolerance_||(info->strengthenRow&&rowLower[irow]<-1.0e20)) { // can be a cut // add gap to integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; for (kk=rowStart[irow];kk1.0e-12) { index[n]=column[kk]; element[n++]=value; } coefficientExists=true; } } if (!coefficientExists) { index[n]=j; element[n++]=gap; } OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb(rowUpper[irow]+gap*(colUpper[j]-1.0)); // effectiveness is how far j moves rc.setEffectiveness((sum+gap*colsol[j]-rowUpper[irow])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(info->strengthenRow) //printf("c point to row %d\n",irow); #ifdef STRENGTHEN_PRINT if (rowLower[irow]<-1.0e20) { printf("7Cut %g <= ",rc.lb()); int k; for ( k=0;k0) realRow=realRows[realRow]; rowCut.addCutIfNotDuplicate(rc,realRow); } } } gap = minR[irow]-rowLower[irow]; if (!ifCut&&(gap>primalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut if (!sum) { for (kk=rowStart[irow];kkstrengthenRow&&rowUpper[irow]>1.0e20)) { // can be a cut // subtract gap from integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; for (kk=rowStart[irow];kk1.0e-12) { index[n]=column[kk]; element[n++]=value; } coefficientExists=true; } } if (!coefficientExists) { index[n]=j; element[n++]=-gap; } OsiRowCut rc; rc.setLb(rowLower[irow]-gap*(colUpper[j]-1)); rc.setUb(COIN_DBL_MAX); // effectiveness is how far j moves rc.setEffectiveness((rowLower[irow]-sum+gap*colsol[j])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(info->strengthenRow) //printf("d point to row %d\n",irow); #ifdef STRENGTHEN_PRINT if (rowUpper[irow]>1.0e20) { printf("8Cut %g <= ",rc.lb()); int k; for ( k=0;k1.0e20) ? irow : -1; if (realRows&&realRow>0) realRow=realRows[realRow]; rowCut.addCutIfNotDuplicate(rc,realRow); } } } } minR[irow]=saveMin[istackR]; maxR[irow]=saveMax[istackR]; markR[irow]=-1; } } } } } } } if (numberCliqueAdded) { CoinSort_2(cliqueAdd2,cliqueAdd2+numberCliqueAdded,cliqueAdd); // do cliqueStart and cliqueEntry int numberEntries = cliqueStart_[numberCliques_]; numberEntries += numberCliqueAdded; CliqueEntry * entry = new CliqueEntry [numberEntries]; // use cliqueCount memset(cliqueCount,0,numberCliques_*sizeof(int)); for (int i=0;i=0;iClique--) { // add in new for (int i=0;i=0 && iColumn=start;i--) entry[--put]=cliqueEntry_[i]; last = start; cliqueStart_[iClique]=put; } assert (!put); delete [] cliqueEntry_; cliqueEntry_ = entry; for (int j=0;j=0); assert(sequenceInCliqueEntry(cliqueEntry_[j])=0) { int n1=oneFixStart_[iColumn]; int n2=zeroFixStart_[iColumn]; oneFixStart_[iColumn]=numberEntries; which[iColumn]=numberEntries; numberEntries += n1; zeroFixStart_[iColumn]=numberEntries; endFixStart_[iColumn]=numberEntries; numberEntries += n2; } } // now put in for (int iClique=0;iCliquestrengthenRow,0); } return (ninfeas); } // Does probing and adding cuts for clique slacks int CglProbing::probeSlacks( const OsiSolverInterface & si, const OsiRowCutDebugger * #ifdef CGL_DEBUG debugger #endif ,OsiCuts & cs, double * colLower, double * colUpper, CoinPackedMatrix *rowCopy, CoinPackedMatrix *columnCopy, double * rowLower, double * rowUpper, char * intVar, double * minR, double * maxR,int * markR, CglTreeInfo * info) { if (!numberCliques_) return 0; // Set up maxes int maxProbe = info->inTree ? maxProbe_ : maxProbeRoot_; int maxStack = info->inTree ? maxStack_ : maxStackRoot_; int nRows=rowCopy->getNumRows(); int nCols=rowCopy->getNumCols(); double * colsol = new double[nCols]; CoinMemcpyN( si.getColSolution(),nCols,colsol); int rowCuts=rowCuts_; double_int_pair * array = new double_int_pair [numberCliques_]; // look at <= cliques int iClique; int nLook=0; for (iClique=0;iCliqueinTree ? nRows/3 : nRows; row_cut rowCut(nRowsFake, !info->inTree); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * rowElements = rowCopy->getElements(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); const double * columnElements = columnCopy->getElements(); double movement; int i, j, k,kk,jj; int kcol,irow,krow; bool anyColumnCuts=false; double dbound, value, value2; int ninfeas=0; for (i = 0; i < nCols; ++i) { if (colUpper[i]-colLower[i]>1.0e-8) { if (colsol[i]colUpper[i]-primalTolerance_) { colsol[i]=colUpper[i]; } } } int ipass=0,nfixed=-1; /* for both way coding */ int nstackC0=-1; int * stackC0 = new int[maxStack]; double * lo0 = new double[maxStack]; double * up0 = new double[maxStack]; int nstackR,nstackC; for (i=0;iinTree ? maxPass_ : maxPassRoot_; double needEffectiveness = info->strengthenRow ? -1.0e10 : 1.0e-3; while (ipass0.99999); up=colUpper[j]; } nstackC=1; nstackR=0; saveL[0]=colLower[j]; saveU[0]=colUpper[j]; assert (saveU[0]>saveL[0]); notFeasible=0; if (movement<0.0) { colUpper[j] += movement; colUpper[j] = floor(colUpper[j]+0.5); #ifdef PRINT_DEBUG printf("** Trying %d down to 0\n",j); #endif } else { colLower[j] += movement; colLower[j] = floor(colLower[j]+0.5); #ifdef PRINT_DEBUG printf("** Trying %d up to 1\n",j); #endif } if (fabs(colUpper[j]-colLower[j])<1.0e-6) markC[j]=3; // say fixed istackC=0; /* update immediately */ for (k=columnStart[j];k0.0) { /* up */ if (value>0.0) { /* up does not change - down does */ if (minR[irow]>-1.0e10) minR[irow] += value; if (minR[irow]>rowUpper[irow]+1.0e-5) { notFeasible=1; istackC=1; break; } } else { /* down does not change - up does */ if (maxR[irow]<1.0e10) maxR[irow] += value; if (maxR[irow]-1.0e10) minR[irow] -= value; if (minR[irow]>rowUpper[irow]+1.0e-5) { notFeasible=1; istackC=1; break; } } else { /* down does not change - up does */ if (maxR[irow]<1.0e10) maxR[irow] -= value; if (maxR[irow]=0) { int start; int end; if (colLower[jcol]>saveL[istackC]) { // going up start = oneFixStart_[jcol]; end = zeroFixStart_[jcol]; } else { assert (colUpper[jcol]saveL[nstackC]); nstackC++; if (!kway) { // going up colLower[kcol]=1.0; /* update immediately */ for (jj=columnStart[kcol];jj0.0) { /* up does not change - down does */ if (minR[krow]>-1.0e10) minR[krow] += value; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value; if (maxR[krow]-1.0e10) minR[krow] -= value; if (minR[krow]>rowUpper[krow]+1.0e-5) { notFeasible=1; break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] -= value; if (maxR[krow] colLower[kcol] + primalTolerance_) { if (intVar[kcol]) { markIt |= 2; newLower = ceil(dbound-primalTolerance_); } else { newLower=dbound; if (newLower+primalTolerance_>colUpper[kcol]&& newLower-primalTolerance_<=colUpper[kcol]) { newLower=colUpper[kcol]; markIt |= 2; markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveUp = newLower-colLower[kcol]; } } if (colLower[kcol] > -1e10 && (markIt&1)==0 && rowLower[irow]>-1.0e10) { dbound = colLower[kcol] + (rowLower[irow]-maxR[irow])/value2; if (dbound < colUpper[kcol] - primalTolerance_) { if (intVar[kcol]) { markIt |= 1; newUpper = floor(dbound+primalTolerance_); } else { newUpper=dbound; if (newUpper-primalTolerance_=colLower[kcol]) { newUpper=colLower[kcol]; markIt |= 1; markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveDown = newUpper-colUpper[kcol]; } } } else { /* positive element */ if (colUpper[kcol] < 1e10 && (markIt&2)==0 && rowLower[irow]>-1.0e10) { dbound = colUpper[kcol] + (rowLower[irow]-maxR[irow])/value2; if (dbound > colLower[kcol] + primalTolerance_) { if (intVar[kcol]) { markIt |= 2; newLower = ceil(dbound-primalTolerance_); } else { newLower=dbound; if (newLower+primalTolerance_>colUpper[kcol]&& newLower-primalTolerance_<=colUpper[kcol]) { newLower=colUpper[kcol]; markIt |= 2; markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveUp = newLower-colLower[kcol]; } } if (colLower[kcol] > -1e10 && (markIt&1)==0 && rowUpper[irow]<1.0e10) { dbound = colLower[kcol] + (rowUpper[irow]-minR[irow])/value2; if (dbound < colUpper[kcol] - primalTolerance_) { if (intVar[kcol]) { markIt |= 1; newUpper = floor(dbound+primalTolerance_); } else { newUpper=dbound; if (newUpper-primalTolerance_=colLower[kcol]) { newUpper=colLower[kcol]; markIt |= 1; markIt=3; } else { // avoid problems - fix later ? markIt=3; } } moveDown = newUpper-colUpper[kcol]; } } } if (nstackC<2*maxStack) { markC[kcol] = markIt; } if (moveUp&&nstackC<2*maxStack) { fixThis++; #ifdef PRINT_DEBUG printf("lower bound on %d increased from %g to %g by row %d %g %g\n",kcol,colLower[kcol],newLower,irow,rowLower[irow],rowUpper[irow]); value=0.0; for (jj=rowStart[irow];jjprimalTolerance_) { printf("(%d, %g) ",ii,rowElements[jj]); } else { value += rowElements[jj]*colLower[ii]; } } printf(" - fixed %g\n",value); for (jj=rowStart[irow];jjsaveL[nstackC]); nstackC++; onList=true; } if (intVar[kcol]) newLower = CoinMax(colLower[kcol],ceil(newLower-1.0e-4)); colLower[kcol]=newLower; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } /* update immediately */ for (jj=columnStart[kcol];jj0.0) { /* up does not change - down does */ if (minR[krow]>-1.0e10) minR[krow] += value*moveUp; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveUp; if (maxR[krow]primalTolerance_) { printf("(%d, %g) ",ii,rowElements[jj]); } else { value += rowElements[jj]*colLower[ii]; } } printf(" - fixed %g\n",value); for (jj=rowStart[irow];jjsaveL[nstackC]); nstackC++; onList=true; } if (intVar[kcol]) newUpper = CoinMin(colUpper[kcol],floor(newUpper+1.0e-4)); colUpper[kcol]=newUpper; if (fabs(colUpper[kcol]-colLower[kcol])<1.0e-6) { markC[kcol]=3; // say fixed } /* update immediately */ for (jj=columnStart[kcol];jj-1.0e10) minR[krow] += value*moveDown; if (minR[krow]>rowUpper[krow]+1.0e-5) { colUpper[kcol]=-1.0e50; /* force infeasible */ break; } } else { /* down does not change - up does */ if (maxR[krow]<1.0e10) maxR[krow] += value*moveDown; if (maxR[krow]colUpper[kcol]+primalTolerance_) { notFeasible=1;; k=columnStart[jcol]+columnLength[jcol]; istackC=nstackC+1; #ifdef PRINT_DEBUG printf("** not feasible this way\n"); #endif break; } } } } } istackC++; } if (!notFeasible) { feasible |= feas[iway]; } else if (iway==1&&feasible==0) { /* not feasible at all */ ninfeas=1; j=nCols-1; iLook=nLook; ipass=maxPass; break; } if (iway==2||(iway==1&&feasible==2)) { /* keep */ iway=3; nfixed++; if (mode_) { OsiColCut cc; int nTot=0,nFix=0,nInt=0; bool ifCut=false; for (istackC=0;istackCcolUpper[icol]+primalTolerance_) { ifCut=true; anyColumnCuts=true; } } } } if (nFix) { nTot=nFix; cleanBounds(1,nFix,index,element); cc.setUbs(nFix,index,element); nFix=0; } for (istackC=0;istackCcurrentColLower[icol]+1.0e-4) { element[nFix]=colLower[icol]; index[nFix++]=icol; nInt++; if (colsol[icol]primalTolerance_) { markC[icol]=0; } else { markC[icol]=3; } } for (istackR=0;istackR=0;istackC--) { int icol=stackC[istackC]; double oldU=saveU[istackC]; double oldL=saveL[istackC]; colUpper[icol]=oldU; colLower[icol]=oldL; markC[icol]=0; } for (istackR=0;istackRprimalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut for (kk=rowStart[irow];kkmaxR[irow]+primalTolerance_||info->strengthenRow) { // can be a cut // subtract gap from upper and integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; for (kk=rowStart[irow];kk1.0e-12) { index[n]=column[kk]; element[n++]=value; } coefficientExists=true; } } if (!coefficientExists) { index[n]=j; element[n++]=-gap; } OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb(rowUpper[irow]-gap*(colLower[j]+1.0)); // effectiveness is how far j moves rc.setEffectiveness((sum-gap*colsol[j]-maxR[irow])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif // If strengthenRow point to row //if(info->strengthenRow) //printf("a point to row %d\n",irow); #ifdef STRENGTHEN_PRINT { printf("9Cut %g <= ",rc.lb()); int k; for ( k=0;kprimalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut if (!sum) { for (kk=rowStart[irow];kkstrengthenRow) { // can be a cut // add gap to lower and integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; for (kk=rowStart[irow];kk1.0e-12) { index[n]=column[kk]; element[n++]=value; } coefficientExists=true; } } if (!coefficientExists) { index[n]=j; element[n++]=gap; } OsiRowCut rc; rc.setLb(rowLower[irow]+gap*(colLower[j]+1.0)); rc.setUb(COIN_DBL_MAX); // effectiveness is how far j moves rc.setEffectiveness((minR[irow]-sum-gap*colsol[j])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(info->strengthenRow) //printf("b point to row %d\n",irow); #ifdef STRENGTHEN_PRINT { printf("10Cut %g <= ",rc.lb()); int k; for ( k=0;k=0;istackC--) { int icol=stackC[istackC]; markC[icol]=istackC+1000; } if (mode_) { OsiColCut cc; int nTot=0,nFix=0,nInt=0; bool ifCut=false; for (istackC=0;istackC=0) { if (CoinMin(lo0[istackC],colLower[icol])>saveL[istackC1]+1.0e-4) { saveL[istackC1]=CoinMin(lo0[istackC],colLower[icol]); if (intVar[icol]) { element[nFix]=saveL[istackC1]; index[nFix++]=icol; nInt++; if (colsol[icol]=0) { if (CoinMax(up0[istackC],colUpper[icol])saveU[istackC1]+primalTolerance_) ifCut=true; } nfixed++; } } } if (nFix) { nTot+=nFix; cleanBounds(1,nFix,index,element); cc.setUbs(nFix,index,element); } // could tighten continuous as well if (nInt) { if (ifCut) { cc.setEffectiveness(100.0); } else { cc.setEffectiveness(1.0e-5); } #ifdef CGL_DEBUG checkBounds(debugger,cc); #endif cs.insert(cc); } } } /* restore all */ for (istackC=nstackC-1;istackC>=0;istackC--) { int icol=stackC[istackC]; double oldU=saveU[istackC]; double oldL=saveL[istackC]; colUpper[icol]=oldU; colLower[icol]=oldL; if (oldU>oldL+1.0e-4) markC[icol]=0; else markC[icol]=3; } for (istackR=0;istackRprimalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut for (kk=rowStart[irow];kkrowUpper[irow]+primalTolerance_||info->strengthenRow) { // can be a cut // add gap to integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; for (kk=rowStart[irow];kk1.0e-12) { index[n]=column[kk]; element[n++]=value; } coefficientExists=true; } } if (!coefficientExists) { index[n]=j; element[n++]=gap; } OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb(rowUpper[irow]+gap*(colUpper[j]-1.0)); // effectiveness is how far j moves rc.setEffectiveness((sum+gap*colsol[j]-rowUpper[irow])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(info->strengthenRow) //printf("c point to row %d\n",irow); #ifdef STRENGTHEN_PRINT { printf("11Cut %g <= ",rc.lb()); int k; for ( k=0;kprimalTolerance_&&gap<1.0e8)) { // see if the strengthened row is a cut if (!sum) { for (kk=rowStart[irow];kkstrengthenRow) { // can be a cut // subtract gap from integer coefficient // saveU and saveL spare int * index = reinterpret_cast(saveL); double * element = saveU; int n=0; bool coefficientExists=false; for (kk=rowStart[irow];kk1.0e-12) { index[n]=column[kk]; element[n++]=value; } coefficientExists=true; } } if (!coefficientExists) { index[n]=j; element[n++]=-gap; } OsiRowCut rc; rc.setLb(rowLower[irow]-gap*(colUpper[j]-1)); rc.setUb(COIN_DBL_MAX); // effectiveness is how far j moves rc.setEffectiveness((rowLower[irow]-sum+gap*colsol[j])/gap); if (rc.effectiveness()>needEffectiveness) { rc.setRow(n,index,element,false); #ifdef CGL_DEBUG if (debugger) assert(!debugger->invalidCut(rc)); #endif //if(info->strengthenRow) //printf("d point to row %d\n",irow); #ifdef STRENGTHEN_PRINT { printf("12Cut %g <= ",rc.lb()); int k; for ( k=0;kstrengthenRow,0); } delete [] array; abort(); return (ninfeas); } // Create a copy of matrix which is to be used // this is to speed up process and to give global cuts // Can give an array with 1 set to select, 0 to ignore // column bounds are tightened // If array given then values of 1 will be set to 0 if redundant int CglProbing::snapshot ( const OsiSolverInterface & si, char * possible,bool withObjective) { deleteSnapshot(); // Get basic problem information numberColumns_=si.getNumCols(); numberRows_=si.getNumRows(); colLower_ = new double[numberColumns_]; colUpper_ = new double[numberColumns_]; CoinMemcpyN(si.getColLower(),numberColumns_,colLower_); CoinMemcpyN(si.getColUpper(),numberColumns_,colUpper_); rowLower_= new double [numberRows_+1]; rowUpper_= new double [numberRows_+1]; CoinMemcpyN(si.getRowLower(),numberRows_,rowLower_); CoinMemcpyN(si.getRowUpper(),numberRows_,rowUpper_); int i; if (possible) { for (i=0;igetMutableIndices(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); double * rowElements = rowCopy_->getMutableElements(); // Put negative first int * column2 = new int[numberColumns_]; double * elements2 = new double[numberColumns_]; CoinBigIndex * rowStartPos = new CoinBigIndex [numberRows_]; for (int i=0;i 1 (one or more variables infeasible), shouldn't we bail out here? */ // do integer stuff for mode 0 cutVector_ = new disaggregation [number01Integers_]; memset(cutVector_,0,number01Integers_*sizeof(disaggregation)); number01Integers_=0; for (i=0;i1.0e30) possible[i]=0; } } int * index = new int[numberRows_]; int nDrop=0,nKeep=0; for (i=0;i1.0e30&&false) { index[nDrop++]=i; } else { rowLower_[nKeep]=rowLower_[i]; rowUpper_[nKeep++]=rowUpper_[i]; } } numberRows_=nKeep; if (nDrop) rowCopy_->deleteRows(nDrop,index); delete [] index; if (withObjective) { // add in objective int * columns = new int[numberColumns_]; double * elements = new double[numberColumns_]; int n=0; const double * objective = si.getObjCoefficients(); bool maximize = (si.getObjSense()==-1); for (i=0;iappendRow(n,columns,elements); delete [] columns; delete [] elements; numberRows_++; } // create column copy if (rowCopy_->getNumElements()) { columnCopy_=new CoinPackedMatrix(*rowCopy_,0,0,true); } else { columnCopy_=new CoinPackedMatrix(); } // make sure big enough - in case too many rows dropped columnCopy_->setDimensions(numberRows_,numberColumns_); rowCopy_->setDimensions(numberRows_,numberColumns_); return returnCode; } // Delete snapshot void CglProbing::deleteSnapshot() { delete [] rowLower_; delete [] rowUpper_; delete [] colLower_; delete [] colUpper_; delete rowCopy_; delete columnCopy_; rowCopy_=NULL; columnCopy_=NULL; rowLower_=NULL; rowUpper_=NULL; colLower_=NULL; colUpper_=NULL; int i; for (i=0;i=0&&mode2<3) { // take off bottom bit mode_ &= ~15; mode_ |= mode; } } int CglProbing::getMode() const { return mode_&15; } // Set maximum number of passes per node void CglProbing::setMaxPass(int value) { if (value>0) maxPass_=value; } // Get maximum number of passes per node int CglProbing::getMaxPass() const { return maxPass_; } // Set log level void CglProbing::setLogLevel(int value) { if (value>=0) logLevel_=value; } // Get log level int CglProbing::getLogLevel() const { return logLevel_; } // Set maximum number of unsatisfied variables to look at void CglProbing::setMaxProbe(int value) { if (value>=0) maxProbe_=value; } // Get maximum number of unsatisfied variables to look at int CglProbing::getMaxProbe() const { return maxProbe_; } // Set maximum number of variables to look at in one probe void CglProbing::setMaxLook(int value) { if (value>=0) maxStack_=value; } // Get maximum number of variables to look at in one probe int CglProbing::getMaxLook() const { return maxStack_; } // Set maximum number of elements in row for scan void CglProbing::setMaxElements(int value) { if (value>0) maxElements_=value; } // Get maximum number of elements in row for scan int CglProbing::getMaxElements() const { return maxElements_; } // Set maximum number of passes per node (root node) void CglProbing::setMaxPassRoot(int value) { if (value>0) maxPassRoot_=value; } // Get maximum number of passes per node (root node) int CglProbing::getMaxPassRoot() const { return maxPassRoot_; } // Set maximum number of unsatisfied variables to look at (root node) void CglProbing::setMaxProbeRoot(int value) { if (value>0) maxProbeRoot_=value; } // Get maximum number of unsatisfied variables to look at (root node) int CglProbing::getMaxProbeRoot() const { return maxProbeRoot_; } // Set maximum number of variables to look at in one probe (root node) void CglProbing::setMaxLookRoot(int value) { if (value>0) maxStackRoot_=value; } // Get maximum number of variables to look at in one probe (root node) int CglProbing::getMaxLookRoot() const { return maxStackRoot_; } // Set maximum number of elements in row for scan (root node) void CglProbing::setMaxElementsRoot(int value) { if (value>0) maxElementsRoot_=value; } // Get maximum number of elements in row for scan (root node) int CglProbing::getMaxElementsRoot() const { return maxElementsRoot_; } // Set whether to use objective void CglProbing::setUsingObjective(int yesNo) { usingObjective_=yesNo; } // Get whether objective is being used int CglProbing::getUsingObjective() const { return usingObjective_; } // Decide whether to do row cuts void CglProbing::setRowCuts(int type) { if (type>-5&&type<5) rowCuts_=type; } // Returns row cuts generation type int CglProbing::rowCuts() const { return rowCuts_; } // Returns tight lower const double * CglProbing::tightLower() const { return colLower_; } // Returns tight upper const double * CglProbing::tightUpper() const { return colUpper_; } // Returns relaxed Row lower const double * CglProbing::relaxedRowLower() const { return rowLower_; } // Returns relaxed Row upper const double * CglProbing::relaxedRowUpper() const { return rowUpper_; } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglProbing::CglProbing () : CglCutGenerator(), primalTolerance_(1.1e-07), mode_(1), rowCuts_(1), maxPass_(3), logLevel_(0), maxProbe_(100), maxStack_(50), maxElements_(1000), maxPassRoot_(3), maxProbeRoot_(100), maxStackRoot_(50), maxElementsRoot_(10000), usingObjective_(0) { numberRows_=0; numberColumns_=0; rowCopy_=NULL; columnCopy_=NULL; rowLower_=NULL; rowUpper_=NULL; colLower_=NULL; colUpper_=NULL; numberIntegers_=0; number01Integers_=0; numberThisTime_=0; totalTimesCalled_=0; lookedAt_=NULL; cutVector_=NULL; numberCliques_=0; cliqueType_=NULL; cliqueStart_=NULL; cliqueEntry_=NULL; oneFixStart_=NULL; zeroFixStart_=NULL; endFixStart_=NULL; whichClique_=NULL; cliqueRow_=NULL; cliqueRowStart_=NULL; tightenBounds_=NULL; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglProbing::CglProbing ( const CglProbing & rhs) : CglCutGenerator(rhs), primalTolerance_(rhs.primalTolerance_), mode_(rhs.mode_), rowCuts_(rhs.rowCuts_), maxPass_(rhs.maxPass_), logLevel_(rhs.logLevel_), maxProbe_(rhs.maxProbe_), maxStack_(rhs.maxStack_), maxElements_(rhs.maxElements_), maxPassRoot_(rhs.maxPassRoot_), maxProbeRoot_(rhs.maxProbeRoot_), maxStackRoot_(rhs.maxStackRoot_), maxElementsRoot_(rhs.maxElementsRoot_), usingObjective_(rhs.usingObjective_) { numberRows_=rhs.numberRows_; numberColumns_=rhs.numberColumns_; numberCliques_=rhs.numberCliques_; if (rhs.rowCopy_) { rowCopy_= new CoinPackedMatrix(*(rhs.rowCopy_)); columnCopy_= new CoinPackedMatrix(*(rhs.columnCopy_)); rowLower_=new double[numberRows_]; CoinMemcpyN(rhs.rowLower_,numberRows_,rowLower_); rowUpper_=new double[numberRows_]; CoinMemcpyN(rhs.rowUpper_,numberRows_,rowUpper_); colLower_=new double[numberColumns_]; CoinMemcpyN(rhs.colLower_,numberColumns_,colLower_); colUpper_=new double[numberColumns_]; CoinMemcpyN(rhs.colUpper_,numberColumns_,colUpper_); int i; numberIntegers_=rhs.numberIntegers_; number01Integers_=rhs.number01Integers_; cutVector_=new disaggregation [number01Integers_]; CoinMemcpyN(rhs.cutVector_,number01Integers_,cutVector_); for (i=0;i=0;i--) { if (oneFixStart_[i]>=0) { n2=endFixStart_[i]; break; } } assert (n==n2); #endif whichClique_ = new int [n]; CoinMemcpyN(rhs.whichClique_,n,whichClique_); if (rhs.cliqueRowStart_) { cliqueRowStart_ = CoinCopyOfArray(rhs.cliqueRowStart_,numberRows_+1); n=cliqueRowStart_[numberRows_]; cliqueRow_ = CoinCopyOfArray(rhs.cliqueRow_,n); } else { cliqueRow_=NULL; cliqueRowStart_=NULL; } } else { cliqueType_=NULL; cliqueStart_=NULL; cliqueEntry_=NULL; oneFixStart_=NULL; zeroFixStart_=NULL; endFixStart_=NULL; cliqueRow_=NULL; cliqueRowStart_=NULL; whichClique_=NULL; } if (rhs.tightenBounds_) { assert (numberColumns_); tightenBounds_=CoinCopyOfArray(rhs.tightenBounds_,numberColumns_); } else { tightenBounds_=NULL; } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglProbing::clone() const { return new CglProbing(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglProbing::~CglProbing () { // free memory delete [] rowLower_; delete [] rowUpper_; delete [] colLower_; delete [] colUpper_; delete rowCopy_; delete columnCopy_; delete [] lookedAt_; delete [] cliqueType_; delete [] cliqueStart_; delete [] cliqueEntry_; delete [] oneFixStart_; delete [] zeroFixStart_; delete [] endFixStart_; delete [] whichClique_; delete [] cliqueRow_; delete [] cliqueRowStart_; if (cutVector_) { for (int i=0;i=0;i--) { if (oneFixStart_[i]>=0) { n2=endFixStart_[i]; break; } } assert (n==n2); #endif whichClique_ = new int [n]; CoinMemcpyN(rhs.whichClique_,n,whichClique_); if (rhs.cliqueRowStart_) { cliqueRowStart_ = CoinCopyOfArray(rhs.cliqueRowStart_,numberRows_+1); n=cliqueRowStart_[numberRows_]; cliqueRow_ = CoinCopyOfArray(rhs.cliqueRow_,n); } else { cliqueRow_=NULL; cliqueRowStart_=NULL; } } else { cliqueType_=NULL; cliqueStart_=NULL; cliqueEntry_=NULL; oneFixStart_=NULL; zeroFixStart_=NULL; endFixStart_=NULL; whichClique_=NULL; cliqueRow_=NULL; cliqueRowStart_=NULL; } if (rhs.tightenBounds_) { assert (numberColumns_); tightenBounds_=CoinCopyOfArray(rhs.tightenBounds_,numberColumns_); } else { tightenBounds_=NULL; } } return *this; } /// This can be used to refresh any inforamtion void CglProbing::refreshSolver(OsiSolverInterface * solver) { if (rowCopy_) { // snapshot existed - redo snapshot(*solver,NULL); } } /* Creates cliques for use by probing. Can also try and extend cliques as a result of probing (root node). Returns number of cliques found. */ int CglProbing::createCliques( OsiSolverInterface & si, int minimumSize, int maximumSize) { // get rid of what is there deleteCliques(); CoinPackedMatrix matrixByRow(*si.getMatrixByRow()); int numberRows = si.getNumRows(); if (!rowCopy_) numberRows_=numberRows; numberColumns_ = si.getNumCols(); numberCliques_=0; int numberEntries=0; int numberIntegers=0; int * lookup = new int[numberColumns_]; int i; for (i=0;i0.0) { which[numberP1++]=iColumn; } else { numberM1++; which[numberIntegers-numberM1]=iColumn; } } int iUpper = static_cast (floor(upperValue+1.0e-5)); int iLower = static_cast (ceil(lowerValue-1.0e-5)); int state=0; if (upperValue<1.0e6) { if (iUpper==1-numberM1) state=1; else if (iUpper==-numberM1) state=2; else if (iUpper<-numberM1) state=3; } if (!state&&lowerValue>-1.0e6) { if (-iLower==1-numberP1) state=-1; else if (-iLower==-numberP1) state=-2; else if (-iLower<-numberP1) state=-3; } if (good&&state) { if (abs(state)==3) { // infeasible numberCliques_ = -99999; break; } else if (abs(state)==2) { // we can fix all numberFixed += numberP1+numberM1; if (state>0) { // fix all +1 at 0, -1 at 1 for (i=0;i= minimumSize&&length= maximumSize) { // too big numberBig++; totalBig += numberP1+numberM1; } } } } if (numberCliques_<0) { if (logLevel_) printf("*** Problem infeasible\n"); } else { if (numberCliques_) { if (logLevel_) printf("%d cliques of average size %g found, %d P1, %d M1\n", numberCliques_, (static_cast(totalP1+totalM1))/ (static_cast (numberCliques_)), totalP1,totalM1); } else { if (logLevel_>1) printf("No cliques found\n"); } if (numberBig) { if (logLevel_) printf("%d large cliques ( >= %d) found, total %d\n", numberBig,maximumSize,totalBig); } if (numberFixed) { if (logLevel_) printf("%d variables fixed\n",numberFixed); } } if (numberCliques_>0) { cliqueType_ = new CliqueType [numberCliques_]; cliqueStart_ = new int [numberCliques_+1]; cliqueEntry_ = new CliqueEntry [numberEntries]; oneFixStart_ = new int [numberColumns_]; zeroFixStart_ = new int [numberColumns_]; endFixStart_ = new int [numberColumns_]; whichClique_ = new int [numberEntries]; numberEntries=0; cliqueStart_[0]=0; for (i=0;i0.0) { which[numberP1++]=iColumn; } else { numberM1++; which[numberIntegers-numberM1]=iColumn; } } int iUpper = static_cast (floor(upperValue+1.0e-5)); int iLower = static_cast (ceil(lowerValue-1.0e-5)); int state=0; if (upperValue<1.0e6) { if (iUpper==1-numberM1) state=1; } if (!state&&lowerValue>-1.0e6) { state=-1; } if (abs(state)!=1) continue; // must have been fixed if (iLower==iUpper) { cliqueType_[numberCliques_].equality=1; } else { cliqueType_[numberCliques_].equality=0; } if (state>0) { for (i=0;i=0) { int n1=oneFixStart_[iColumn]; int n2=zeroFixStart_[iColumn]; oneFixStart_[iColumn]=numberEntries; which[iColumn]=numberEntries; numberEntries += n1; zeroFixStart_[iColumn]=numberEntries; endFixStart_[iColumn]=numberEntries; numberEntries += n2; } } // now put in for (iClique=0;iCliqueclone(); if ((type&4)!=0) { int numberRows = newModel->getNumRows(); int * which =new int [numberRows]; for (int i=0;ideleteRows(numberRows,which); delete [] which; } type &= 3; if (type!=2) { CoinBigIndex numberElements = cliqueStart_[numberCliques_]; int * column = new int [numberElements]; double * element = new double [numberElements]; double * rowLower = new double [numberCliques_]; double * rowUpper = new double [numberCliques_]; numberElements = 0; for (int iClique=0;iCliqueaddRows(numberCliques_,cliqueStart_,column,element, rowLower,rowUpper); delete [] column; delete [] element; delete [] rowLower; delete [] rowUpper; } else { int numberCuts = numberCliques_; CoinBigIndex numberElements = 2*numberCuts; int * column = new int [numberElements]; double * element = new double [numberElements]; double * rowLower = new double [numberCuts]; double * rowUpper = new double [numberCuts]; CoinBigIndex * start = new CoinBigIndex [numberCuts+1]; start[0]=0; numberElements = 0; int * entry = reinterpret_cast(cliqueEntry_); for (int iCut=0;iCutaddRows(numberCuts,start,column,element, rowLower,rowUpper); delete [] column; delete [] element; delete [] rowLower; delete [] rowUpper; delete [] start; } return newModel; } /* Returns true if may generate Row cuts in tree (rather than root node). Used so know if matrix will change in tree. Really meant so column cut generators can still be active without worrying code. Default is true */ bool CglProbing::mayGenerateRowCutsInTree() const { return rowCuts_>0; } // Sets up clique information for each row void CglProbing::setupRowCliqueInformation(const OsiSolverInterface & si) { if (!numberCliques_) return; CoinPackedMatrix * rowCopy; if (!rowCopy_) { // create from current numberRows_=si.getNumRows(); numberColumns_=si.getNumCols(); rowCopy = new CoinPackedMatrix(*si.getMatrixByRow()); } else { rowCopy = rowCopy_; assert(numberRows_<=si.getNumRows()); assert(numberColumns_==si.getNumCols()); } assert(numberRows_&&numberColumns_); cliqueRowStart_ = new int [numberRows_+1]; cliqueRowStart_[0]=0; // Temporary array while building list CliqueEntry ** array = new CliqueEntry * [numberRows_]; // Which cliques in use int * which = new int[numberCliques_]; int * count = new int[numberCliques_]; int * back =new int[numberColumns_]; CoinZeroN(count,numberCliques_); CoinFillN(back,numberColumns_,-1); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * lower = si.getColLower(); const double * upper = si.getColUpper(); int iRow; for (iRow=0;iRowlower[iColumn]) { back[iColumn]=j-rowStart[iRow]; numberFree++; for (int k=oneFixStart_[iColumn];klargest) { largest=count[iClique]; whichClique=iClique; } } // Add in if >1 (but not if all as that means clique==row) if (whichClique>=0&&largestlower[iColumn]) { bool found=false; int k; for ( k=oneFixStart_[iColumn];k=0&&kgenerateCuts(si,cs,info); //int n2=cs.sizeRowCuts(); //if (n2>n1) //printf("added %d cuts\n",n2-n1); } } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglImplication::CglImplication () : CglCutGenerator(), probingInfo_(NULL) { // nothing to do here } //------------------------------------------------------------------- // Constructor with info //------------------------------------------------------------------- CglImplication::CglImplication (CglTreeProbingInfo * info) : CglCutGenerator(), probingInfo_(info) { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglImplication::CglImplication ( const CglImplication & source) : CglCutGenerator(source), probingInfo_(source.probingInfo_) { // Nothing to do here } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglImplication::clone() const { return new CglImplication(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglImplication::~CglImplication () { // Nothing to do here } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglImplication & CglImplication::operator=( const CglImplication& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); probingInfo_=rhs.probingInfo_; } return *this; } // Create C++ lines to get to current state std::string CglImplication::generateCpp( FILE * fp) { CglImplication other; fprintf(fp,"0#include \"CglImplication.hpp\"\n"); fprintf(fp,"3 CglImplication implication;\n"); return "implication"; } CoinMP-1.8.3/Cgl/src/CglRedSplit/0000755000175000017500000000000012600453456014771 5ustar renereneCoinMP-1.8.3/Cgl/src/CglRedSplit/Makefile.in0000644000175000017500000005466512506321416017051 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglRedSplit DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglRedSplit_la_LIBADD = am_libCglRedSplit_la_OBJECTS = CglRedSplit.lo CglRedSplitTest.lo \ CglRedSplitParam.lo libCglRedSplit_la_OBJECTS = $(am_libCglRedSplit_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglRedSplit_la_SOURCES) DIST_SOURCES = $(libCglRedSplit_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglRedSplit # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglRedSplit.la # List all source files for this library, including headers libCglRedSplit_la_SOURCES = \ CglRedSplit.cpp CglRedSplit.hpp \ CglRedSplitTest.cpp \ CglRedSplitParam.cpp CglRedSplitParam.hpp # This is for libtool (on Windows) libCglRedSplit_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglRedSplit.hpp CglRedSplitParam.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglRedSplit/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglRedSplit/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglRedSplit.la: $(libCglRedSplit_la_OBJECTS) $(libCglRedSplit_la_DEPENDENCIES) $(CXXLINK) $(libCglRedSplit_la_LDFLAGS) $(libCglRedSplit_la_OBJECTS) $(libCglRedSplit_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglRedSplit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglRedSplitParam.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglRedSplitTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglRedSplit/Makefile.am0000644000175000017500000000332411621724114017021 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglRedSplit # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglRedSplit.la # List all source files for this library, including headers libCglRedSplit_la_SOURCES = \ CglRedSplit.cpp CglRedSplit.hpp \ CglRedSplitTest.cpp \ CglRedSplitParam.cpp CglRedSplitParam.hpp # This is for libtool (on Windows) libCglRedSplit_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglRedSplit.hpp CglRedSplitParam.hpp CoinMP-1.8.3/Cgl/src/CglRedSplit/CglRedSplit.hpp0000644000175000017500000003565212130102162017650 0ustar renerene// Last edit: 4/20/07 // // Name: CglRedSplit.hpp // Author: Francois Margot // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // email: fmargot@andrew.cmu.edu // Date: 2/6/05 // // $Id: CglRedSplit.hpp 1119 2013-04-06 20:24:18Z stefan $ //----------------------------------------------------------------------------- // Copyright (C) 2005, Francois Margot and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglRedSplit_H #define CglRedSplit_H #include "CglCutGenerator.hpp" #include "CglRedSplitParam.hpp" /** Gomory Reduce-and-Split Cut Generator Class; See method generateCuts(). Based on the paper by K. Anderson, G. Cornuejols, Yanjun Li, "Reduce-and-Split Cuts: Improving the Performance of Mixed Integer Gomory Cuts", Management Science 51 (2005). */ class CglRedSplit : public CglCutGenerator { friend void CglRedSplitUnitTest(const OsiSolverInterface * siP, const std::string mpdDir); public: /**@name generateCuts */ //@{ /** Generate Reduce-and-Split Mixed Integer Gomory cuts for the model of the solver interface si. Insert the generated cuts into OsiCuts cs. Warning: This generator currently works only with the Lp solvers Clp or Cplex9.0 or higher. It requires access to the optimal tableau and optimal basis inverse and makes assumptions on the way slack variables are added by the solver. The Osi implementations for Clp and Cplex verify these assumptions. When calling the generator, the solver interface si must contain an optimized problem and information related to the optimal basis must be available through the OsiSolverInterface methods (si->optimalBasisIsAvailable() must return 'true'). It is also essential that the integrality of structural variable i can be obtained using si->isInteger(i). Reduce-and-Split cuts are variants of Gomory cuts: Starting from the current optimal tableau, linear combinations of the rows of the current optimal simplex tableau are used for generating Gomory cuts. The choice of the linear combinations is driven by the objective of reducing the coefficients of the non basic continuous variables in the resulting row. Note that this generator might not be able to generate cuts for some solutions violating integrality constraints. */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /// Return true if needs optimal basis to do cuts (will return true) virtual bool needsOptimalBasis() const; //@} /**@name Public Methods */ //@{ // Set the parameters to the values of the given CglRedSplitParam object. void setParam(const CglRedSplitParam &source); // Return the CglRedSplitParam object of the generator. inline CglRedSplitParam getParam() const {return param;} // Compute entries of low_is_lub and up_is_lub. void compute_is_lub(); // Compute entries of is_integer. void compute_is_integer(); /// Set given_optsol to the given optimal solution given_sol. /// If given_optsol is set using this method, /// the code will stop as soon as /// a generated cut is violated by the given solution; exclusively /// for debugging purposes. void set_given_optsol(const double *given_sol, const int card_sol); /// Print some of the data members void print() const; /// Print the current simplex tableau void printOptTab(OsiSolverInterface *solver) const; //@} /**@name Public Methods (soon to be obsolete)*/ //@{ //************************************************************ // TO BE REMOVED /** Set limit, the maximum number of non zero coefficients in generated cut; Default: 50 */ void setLimit(int limit); /** Get value of limit */ int getLimit() const; /** Set away, the minimum distance from being integer used for selecting rows for cut generation; all rows whose pivot variable should be integer but is more than away from integrality will be selected; Default: 0.05 */ void setAway(double value); /// Get value of away double getAway() const; /** Set the value of LUB, value considered large for the absolute value of a lower or upper bound on a variable; Default: 1000 */ void setLUB(double value); /** Get the value of LUB */ double getLUB() const; /** Set the value of EPS, epsilon for double computations; Default: 1e-7 */ void setEPS(double value); /** Get the value of EPS */ double getEPS() const; /** Set the value of EPS_COEFF, epsilon for values of coefficients; Default: 1e-8 */ void setEPS_COEFF(double value); /** Get the value of EPS_COEFF */ double getEPS_COEFF() const; /** Set the value of EPS_COEFF_LUB, epsilon for values of coefficients for variables with absolute value of lower or upper bound larger than LUB; Default: 1e-13 */ void setEPS_COEFF_LUB(double value); /** Get the value of EPS_COEFF_LUB */ double getEPS_COEFF_LUB() const; /** Set the value of EPS_RELAX, value used for relaxing the right hand side of each generated cut; Default: 1e-8 */ void setEPS_RELAX(double value); /** Get the value of EPS_RELAX */ double getEPS_RELAX() const; /** Set the value of normIsZero, the threshold for considering a norm to be 0; Default: 1e-5 */ void setNormIsZero(double value); /** Get the value of normIsZero */ double getNormIsZero() const; /** Set the value of minReduc, threshold for relative norm improvement for performing a reduction; Default: 0.05 */ void setMinReduc(double value); /// Get the value of minReduc double getMinReduc() const; /** Set the maximum allowed value for (mTab * mTab * CoinMax(mTab, nTab)) where mTab is the number of rows used in the combinations and nTab is the number of continuous non basic variables. The work of the generator is proportional to (mTab * mTab * CoinMax(mTab, nTab)). Reducing the value of maxTab makes the generator faster, but weaker. Default: 1e7. */ void setMaxTab(double value); /// Get the value of maxTab double getMaxTab() const; // END TO BE REMOVED //************************************************************ //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglRedSplit(); /// Constructor with specified parameters CglRedSplit(const CglRedSplitParam &RS_param); /// Copy constructor CglRedSplit (const CglRedSplit &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglRedSplit & operator=( const CglRedSplit& rhs); /// Destructor virtual ~CglRedSplit (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} private: // Private member methods /**@name Private member methods */ //@{ // Method generating the cuts after all CglRedSplit members are properly set. void generateCuts(OsiCuts & cs); /// Compute the fractional part of value, allowing for small error. inline double rs_above_integer(double value); /// Perform row r1 of pi := row r1 of pi - step * row r2 of pi. void update_pi_mat(int r1, int r2, int step); /// Perform row r1 of tab := row r1 of tab - step * row r2 of tab. void update_redTab(int r1, int r2, int step); /// Find optimal integer step for changing row r1 by adding to it a /// multiple of another row r2. void find_step(int r1, int r2, int *step, double *reduc, double *norm); /// Test if an ordered pair of rows yields a reduction. Perform the /// reduction if it is acceptable. int test_pair(int r1, int r2, double *norm); /// Reduce rows of contNonBasicTab. void reduce_contNonBasicTab(); /// Generate a row of the current LP tableau. void generate_row(int index_row, double *row); /// Generate a mixed integer Chvatal-Gomory cut, when all non basic /// variables are non negative and at their lower bound. int generate_cgcut(double *row, double *rhs); /// Generate a mixed integer Chvatal-Gomory cut, when all non basic /// variables are non negative and at their lower bound (different formula) int generate_cgcut_2(int basic_ind, double *row, double *rhs); /// Use multiples of the initial inequalities to cancel out the coefficients /// of the slack variables. void eliminate_slacks(double *row, const double *elements, const int *start, const int *indices, const int *rowLength, const double *rhs, double *rowrhs); /// Change the sign of the coefficients of the continuous non basic /// variables at their upper bound. void flip(double *row); /// Change the sign of the coefficients of the continuous non basic /// variables at their upper bound and do the translations restoring /// the original bounds. Modify the right hand side /// accordingly. void unflip(double *row, double *rowrhs, double *slack_val); /// Return the scale factor for the row. /// Compute max_coeff: maximum absolute value of the coefficients. /// Compute min_coeff: minimum absolute value of the coefficients /// larger than EPS_COEFF. /// Return -1 if max_coeff < EPS_COEFF or if max_coeff/min_coeff > MAXDYN /// or MAXDYN_LUB (depending if the row has a non zero coeff. for a variable /// with large lower/upper bound) */. double row_scale_factor(double *row); /// Generate the packed cut from the row representation. int generate_packed_row(const double *xlp, double *row, int *rowind, double *rowelem, int *card_row, double & rhs); /// Check that the generated cuts do not cut a given optimal solution. void check_optsol(const int calling_place, const double *xlp, const double *slack_val, const int do_flip); /// Check that the generated cuts do not cut a given optimal solution. void check_optsol(const int calling_place, const double *xlp, const double *slack_val, const double *ck_row, const double ck_rhs, const int cut_number, const int do_flip); // Check that two vectors are different. bool rs_are_different_vectors(const int *vect1, const int *vect2, const int dim); // Check that two vectors are different. bool rs_are_different_vectors(const double *vect1, const double *vect2, const int dim); // Check that two matrices are different. bool rs_are_different_matrices(const CoinPackedMatrix *mat1, const CoinPackedMatrix *mat2, const int nmaj, const int nmin); //@} // Private member data /**@name Private member data */ //@{ /// Object with CglRedSplitParam members. CglRedSplitParam param; /// Number of rows ( = number of slack variables) in the current LP. int nrow; /// Number of structural variables in the current LP. int ncol; /// Lower bounds for structural variables const double *colLower; /// Upper bounds for structural variables const double *colUpper; /// Lower bounds for constraints const double *rowLower; /// Upper bounds for constraints const double *rowUpper; /// Righ hand side for constraints (upper bound for ranged constraints). const double *rowRhs; /// Number of integer basic structural variables that are fractional in the /// current lp solution (at least param.away_ from being integer). int card_intBasicVar_frac; /// Number of integer non basic structural variables in the /// current lp solution. int card_intNonBasicVar; /// Number of continuous non basic variables (structural or slack) in the /// current lp solution. int card_contNonBasicVar; /// Number of non basic variables (structural or slack) at their /// upper bound in the current lp solution. int card_nonBasicAtUpper; /// Number of non basic variables (structural or slack) at their /// lower bound in the current lp solution. int card_nonBasicAtLower; /// Characteristic vector for integer basic structural variables /// with non integer value in the current lp solution. int *cv_intBasicVar_frac; /// List of integer structural basic variables /// (in order of pivot in selected rows for cut generation). int *intBasicVar_frac; /// List of integer structural non basic variables. int *intNonBasicVar; /// List of continuous non basic variables (structural or slack). // slacks are considered continuous (no harm if this is not the case). int *contNonBasicVar; /// List of non basic variables (structural or slack) at their /// upper bound. int *nonBasicAtUpper; /// List of non basic variables (structural or slack) at their lower /// bound. int *nonBasicAtLower; /// Number of rows in the reduced tableau (= card_intBasicVar_frac). int mTab; /// Number of columns in the reduced tableau (= card_contNonBasicVar) int nTab; /// Tableau of multipliers used to alter the rows used in generation. /// Dimensions: mTab by mTab. Initially, pi_mat is the identity matrix. int **pi_mat; /// Current tableau for continuous non basic variables (structural or slack). /// Only rows used for generation. /// Dimensions: mTab by nTab. double **contNonBasicTab; /// Current tableau for integer non basic structural variables. /// Only rows used for generation. // Dimensions: mTab by card_intNonBasicVar. double **intNonBasicTab; /// Right hand side of the tableau. /// Only rows used for generation. double *rhsTab ; /// Given optimal solution that should not be cut; only for debug. const double *given_optsol; /// Number of entries in given_optsol. int card_given_optsol; /// Characteristic vectors of structural integer variables or continuous /// variables currently fixed to integer values. int *is_integer; /// Characteristic vector of the structural variables whose lower bound /// in absolute value is larger than LUB. int *low_is_lub; /// Characteristic vector of the structural variables whose upper bound /// in absolute value is larger than LUB. int *up_is_lub; /// Pointer on solver. Reset by each call to generateCuts(). OsiSolverInterface *solver; /// Pointer on point to separate. Reset by each call to generateCuts(). const double *xlp; /// Pointer on row activity. Reset by each call to generateCuts(). const double *rowActivity; /// Pointer on column type. Reset by each call to generateCuts(). const char *colType; /// Pointer on matrix of coefficient ordered by rows. /// Reset by each call to generateCuts(). const CoinPackedMatrix *byRow; //@} }; //############################################################################# /** A function that tests the methods in the CglRedSplit class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglRedSplitUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); #endif CoinMP-1.8.3/Cgl/src/CglRedSplit/CglRedSplitParam.cpp0000644000175000017500000001663612130104031020622 0ustar renerene// Name: CglRedSplitParam.cpp // Author: Francois Margot // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 11/24/06 // // $Id: CglRedSplitParam.cpp 1122 2013-04-06 20:39:53Z stefan $ //--------------------------------------------------------------------------- // Copyright (C) 2006, Francois Margot and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CglRedSplitParam.hpp" /***********************************************************************/ void CglRedSplitParam::setAway(const double value) { if (value > 0.0 && value <= 0.5) away_ = value; } /***********************************************************************/ void CglRedSplitParam::setMaxTab(const double value) { if (value > 10) { maxTab_ = value; } else { printf("### WARNING: CglRedSplitParam::setMaxTab(): value: %f ignored\n", value); } } /***********************************************************************/ void CglRedSplitParam::setLUB(const double value) { if (value > 0.0) { LUB = value; } else { printf("### WARNING: CglRedSplitParam::setLUB(): value: %f ignored\n", value); } } /* setLUB */ /***********************************************************************/ void CglRedSplitParam::setEPS_ELIM(const double eps_el) { if(eps_el >= 0) EPS_ELIM = eps_el; } /* setEPS_ELIM */ /***********************************************************************/ void CglRedSplitParam::setEPS_RELAX_ABS(const double eps_ra) { if(eps_ra >= 0) EPS_RELAX_ABS = eps_ra; } /* setEPS_RELAX_ABS */ /***********************************************************************/ void CglRedSplitParam::setEPS_RELAX_REL(const double eps_rr) { if(eps_rr >= 0) EPS_RELAX_REL = eps_rr; } /* setEPS_RELAX_REL */ /***********************************************************************/ void CglRedSplitParam::setMAXDYN(double value) { if (value > 1.0) { MAXDYN = value; } else { printf("### WARNING: CglRedSplit::setMAXDYN(): value: %f ignored\n", value); } } /* setMAXDYN */ /***********************************************************************/ void CglRedSplitParam::setMAXDYN_LUB(double value) { if (value > 1.0) { MAXDYN_LUB = value; } else { printf("### WARNING: CglRedSplit::setMAXDYN_LUB(): value: %f ignored\n", value); } } /* setMAXDYN_LUB */ /***********************************************************************/ void CglRedSplitParam::setEPS_COEFF_LUB(const double value) { if (value > 0.0 && value <= 0.1) { EPS_COEFF_LUB = value; } else { printf("### WARNING: CglRedSplitParam::setEPS_COEFF_LUB(): value: %f ignored\n", value); } } /* setEPS_COEFF_LUB */ /***********************************************************************/ void CglRedSplitParam::setMINVIOL(double value) { if (value > 0.0 && value <= 0.1) { MINVIOL = value; } else { printf("### WARNING: CglRedSplitParam::setMINVIOL(): value: %f ignored\n", value); } } /* setMINVIOL */ /***********************************************************************/ void CglRedSplitParam::setUSE_INTSLACKS(int value) { USE_INTSLACKS = value; } /* setUSE_INTSLACKS */ /***********************************************************************/ void CglRedSplitParam::setUSE_CG2(int value) { USE_CG2 = value; } /* setUSE_CG2 */ /***********************************************************************/ void CglRedSplitParam::setNormIsZero(const double value) { if (value > 0.0 && value <= 1) { normIsZero = value; } else { printf("### WARNING: CglRedSplitParam::setNormIsZero(): value: %f ignored\n", value); } } /* setNormIsZero */ /***********************************************************************/ void CglRedSplitParam::setMinReduc(const double value) { if (value > 0.0 && value <= 1) { minReduc = value; } else { printf("### WARNING: CglRedSplitParam::MinReduc(): value: %f ignored\n", value); } } /* setMinReduc */ /***********************************************************************/ CglRedSplitParam::CglRedSplitParam(const double lub, const double eps_el, const double eps_relax_abs, const double eps_relax_rel, const double max_dyn, const double max_dyn_lub, const double eps_coeff_lub, const double min_viol, const int use_int_slacks, const int use_cg2, const double norm_zero, const double min_reduc, const double away, const double max_tab) : CglParam(), LUB(lub), EPS_ELIM(eps_el), EPS_RELAX_ABS(eps_relax_abs), EPS_RELAX_REL(eps_relax_rel), MAXDYN(max_dyn), MAXDYN_LUB(max_dyn_lub), EPS_COEFF_LUB(eps_coeff_lub), MINVIOL(min_viol), USE_INTSLACKS(use_int_slacks), USE_CG2(use_cg2), normIsZero(norm_zero), minReduc(min_reduc), away_(away), maxTab_(max_tab) {} /***********************************************************************/ CglRedSplitParam::CglRedSplitParam(const CglParam &source, const double lub, const double eps_el, const double eps_ra, const double eps_rr, const double max_dyn, const double max_dyn_lub, const double eps_coeff_lub, const double min_viol, const int use_int_slacks, const int use_cg2, const double norm_zero, const double min_reduc, const double away, const double max_tab) : CglParam(source), LUB(lub), EPS_ELIM(eps_el), EPS_RELAX_ABS(eps_ra), EPS_RELAX_REL(eps_rr), MAXDYN(max_dyn), MAXDYN_LUB(max_dyn_lub), EPS_COEFF_LUB(eps_coeff_lub), MINVIOL(min_viol), USE_INTSLACKS(use_int_slacks), USE_CG2(use_cg2), normIsZero(norm_zero), minReduc(min_reduc), away_(away), maxTab_(max_tab) {} /***********************************************************************/ CglRedSplitParam::CglRedSplitParam(const CglRedSplitParam &source) : CglParam(source), LUB(source.LUB), EPS_ELIM(source.EPS_ELIM), EPS_RELAX_ABS(source.EPS_RELAX_ABS), EPS_RELAX_REL(source.EPS_RELAX_REL), MAXDYN(source.MAXDYN), MAXDYN_LUB(source.MAXDYN_LUB), EPS_COEFF_LUB(source.EPS_COEFF_LUB), MINVIOL(source.MINVIOL), USE_INTSLACKS(source.USE_INTSLACKS), USE_CG2(source.USE_CG2), normIsZero(source.normIsZero), minReduc(source.minReduc), away_(source.away_), maxTab_(source.maxTab_) {} /***********************************************************************/ CglRedSplitParam* CglRedSplitParam::clone() const { return new CglRedSplitParam(*this); } /***********************************************************************/ CglRedSplitParam& CglRedSplitParam::operator=(const CglRedSplitParam &rhs) { if(this != &rhs) { CglParam::operator=(rhs); LUB = rhs.LUB; EPS_ELIM = rhs.EPS_ELIM; EPS_RELAX_ABS = rhs.EPS_RELAX_ABS; EPS_RELAX_REL = rhs.EPS_RELAX_REL; MAXDYN = rhs.MAXDYN; MAXDYN_LUB = rhs.MAXDYN_LUB; EPS_COEFF_LUB = rhs.EPS_COEFF_LUB; MINVIOL = rhs.MINVIOL; USE_INTSLACKS = rhs.USE_INTSLACKS; USE_CG2 = rhs.USE_CG2; normIsZero = rhs.normIsZero; minReduc = rhs.minReduc; away_ = rhs.away_; maxTab_ = rhs.maxTab_; } return *this; } /***********************************************************************/ CglRedSplitParam::~CglRedSplitParam() {} CoinMP-1.8.3/Cgl/src/CglRedSplit/CglRedSplit.cpp0000644000175000017500000014660612130102162017645 0ustar renerene// Last edit: 4/20/07 // // Name: CglRedSplit.cpp // Author: Francois Margot // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 2/6/05 // // $Id: CglRedSplit.cpp 1119 2013-04-06 20:24:18Z stefan $ //--------------------------------------------------------------------------- // Copyright (C) 2005, Francois Margot and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include //#define RS_TRACE //#define RS_TRACEALL //#define RS_TRACETAB #include "OsiSolverInterface.hpp" #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "OsiRowCutDebugger.hpp" #include "CoinFactorization.hpp" #include "CoinWarmStartBasis.hpp" #include "CglRedSplit.hpp" #include "CoinFinite.hpp" //------------------------------------------------------------------- // Generate Gomory Reduce-and-Split cuts //------------------------------------------------------------------- /***************************************************************************/ // Returns (value - floor) but allowing for small errors inline double CglRedSplit::rs_above_integer(double value) { double value2=floor(value); double value3=floor(value+0.5); if (fabs(value3-value)< param.getEPS() * (fabs(value3)+1.0)) return 0.0; return value-value2; } /* rs_above_integer */ /**********************************************************/ void rs_allocmatINT(int ***v, const int m, const int n) { int i; *v = reinterpret_cast (calloc (m, sizeof(int *))); if (*v == NULL) { printf("###ERROR: INTEGER matrix allocation failed\n"); exit(1); } for(i=0; i (calloc (n, sizeof(int))); if ((*v)[i] == NULL) { printf("###ERROR: INTEGER matrix allocation failed\n"); exit(1); } } } /* rs_allocmatINT */ /**********************************************************/ void rs_deallocmatINT(int ***v, const int m, const int /*n*/) { int i; for(i=0; i ((*v)[i])); } free(reinterpret_cast (*v)); } /* rs_deallocmatINT */ /**********************************************************/ void rs_allocmatDBL(double ***v, const int m, const int n) { int i; *v = reinterpret_cast (calloc (m, sizeof(double *))); if (*v == NULL) { printf("###ERROR: DOUBLE matrix allocation failed\n"); exit(1); } for(i=0; i (calloc (n, sizeof(double))); if ((*v)[i] == NULL) { printf("###ERROR: DOUBLE matrix allocation failed\n"); exit(1); } } } /* rs_allocmatDBL */ /**********************************************************/ void rs_deallocmatDBL(double ***v, const int m, const int /*n*/) { int i; for(i=0; i ((*v)[i])); } free(reinterpret_cast (*v)); } /* rs_deallocmatDBL */ /**********************************************************/ void rs_printvecINT(const char *vecstr, const int *x, const int n) { int num, fromto, upto, j, i; num = (n/10) + 1; printf("%s :\n", vecstr); for(j=0; j ((*x0)/b) ; x1 = a*(*x0 - k*b) - k*c ; if(x1 < 0) x1 = x1 + m; *x0 = x1; return(static_cast(x1)/static_cast(m)); } /* rs_genalea */ /***********************************************************************/ void CglRedSplit::update_pi_mat(int r1, int r2, int step) { int j; for(j=0; j (floor(opt_step)); int c_step = f_step + 1; double val_f = norm[r1] + f_step * f_step * norm[r2] - 2 * btb_val * f_step; double val_c = norm[r1] + c_step * c_step * norm[r2] - 2 * btb_val * c_step; if(val_f <= val_c ) { (*step) = f_step; (*reduc) = norm[r1] - val_f; } else { (*step) = c_step; (*reduc) = norm[r1] - val_c; } } /* find_step */ /***************************************************************************/ int CglRedSplit::test_pair(int r1, int r2, double *norm) { int step; double reduc; find_step(r1, r2, &step, &reduc, norm); if(reduc/norm[r1] >= param.getMinReduc()) { update_pi_mat(r1, r2, step); update_redTab(r1, r2, step); norm[r1] = rs_dotProd(contNonBasicTab[r1], contNonBasicTab[r1], nTab); #ifdef RS_TRACEALL printf("Use %d and %d for reduction (step: %d)\n", r1, r2, step); #endif return(1); } return(0); } /* test_pair */ /***************************************************************************/ void CglRedSplit::reduce_contNonBasicTab() { int i, j; double *norm = new double[mTab]; for(i=0; i param.getNormIsZero()) { for(j=i+1; j param.getNormIsZero()) { if((checked[i][j] < changed[i]) || (checked[i][j] < changed[j])) { if(test_pair(i, j, norm)) { changed[i] = iter+1; done = 0; } checked[i][j] = iter; if((checked[j][i] < changed[i]) || (checked[j][i] < changed[j])) { if(test_pair(j, i, norm)) { changed[j] = iter+1; done = 0; } checked[j][i] = iter; } } } } } } iter++; } #ifdef RS_TRACEALL rs_printmatDBL("contNonBasicTab", contNonBasicTab, mTab, nTab); rs_printmatINT("checked", checked, mTab, mTab); rs_printvecINT("changed", changed, mTab); rs_printvecDBL("norm", norm, mTab); rs_printmatINT("pi_mat", pi_mat, mTab, mTab); #endif sum_norms = 0; for(i=0; i f0) { row[locind] += (f-f0)/f0compl; } } for(i=0; i f0) { row[locind] = -ratf0f0compl * fcompl; } else { row[locind] = -f; } } for(i=0; i param.getEPS_ELIM()) { if(rowLower[i] > rowUpper[i] - param.getEPS()) { row[ncol+i] = 0; continue; } int upto = rowStart[i] + rowLength[i]; for(j=rowStart[i]; j param.getEPS_COEFF_LUB()) { min_val = CoinMin(min_val, val); has_lub = 1; nelem++; } } else { if(val > param.getEPS_COEFF()) { min_val = CoinMin(min_val, val); nelem++; } } } double retval = 1; if(norm > 100 * nelem) { retval = 10 * sqrt(norm / nelem); } if(norm < 0.5 * nelem) { retval = 0.5 * sqrt(norm / nelem); } if((retval < 0.02) || (retval > 50)) { return(-1); } if(has_lub) { if((max_val > param.getEPS_COEFF_LUB()) && (max_val < param.getMAXDYN_LUB() * min_val) && (max_val >= min_val)) { return(retval); } } else { if((max_val > param.getEPS_COEFF()) && (max_val < param.getMAXDYN() * min_val) && (max_val >= min_val)) { return(retval); } } #ifdef RS_TRACE printf("CglRedSplit::scale_row(): max_val: %6.6f min_val: %6.6f\n", max_val, min_val); #endif return(-1); } /* row_scale_factor */ /************************************************************************/ int CglRedSplit::generate_packed_row(const double *lclXlp, double *row, int *rowind, double *rowelem, int *card_row, double & rhs) { int i; double scale_f = row_scale_factor(row); double value; if(scale_f < 0) { #ifdef RS_TRACE printf("CglRedSplit::generate_packed_row(): Cut discarded (bad numerical behavior)\n"); #endif return(0); } *card_row = 0; rhs /= scale_f; for(i=0; i param.getEPS_COEFF()) { rowind[*card_row] = i; rowelem[*card_row] = value; (*card_row)++; if(*card_row > param.getMAX_SUPPORT()) { #ifdef RS_TRACE printf("CglRedSplit::generate_packed_row(): Cut discarded (too many non zero)\n"); #endif return(0); } } else { if((value > 0.0) && (!low_is_lub[i])) { rhs -= value * colLower[i]; } else if((value < 0.0) && (!up_is_lub[i])) { rhs -= value * colUpper[i]; } else if(fabs(value) > param.getEPS_COEFF_LUB()) { // take anyway rowind[*card_row] = i; rowelem[*card_row] = value; (*card_row)++; if(*card_row > param.getMAX_SUPPORT()) { #ifdef RS_TRACE printf("CglRedSplit::generate_packed_row(): Cut discarded since too many non zero coefficients\n"); #endif return(0); } } } } value = 0; for(i=0; i<(*card_row); i++) { value += lclXlp[rowind[i]] * rowelem[i]; } if(value > rhs) { value -= rhs; if(value < param.getMINVIOL()) { #ifdef RS_TRACE printf("CglRedSplit::generate_packed_row(): Cut discarded: violation: %12.10f\n", value); #endif return(0); } } return(1); } /* generate_packed_row */ // TO BE REMOVED /***********************************************************************/ void CglRedSplit::setLimit(int limit) { if (limit>0) param.setMAX_SUPPORT(limit); } /* setLimit */ /***********************************************************************/ int CglRedSplit::getLimit() const { return param.getMAX_SUPPORT(); } /* getLimit */ /***********************************************************************/ void CglRedSplit::setAway(double value) { if (value>0.0 && value<=0.5) param.setAway(value); } /***********************************************************************/ double CglRedSplit::getAway() const { return param.getAway(); } /***********************************************************************/ void CglRedSplit::setMaxTab(double value) { if (value > 10) { param.setMaxTab(value); } else { printf("### WARNING: CglRedSplit::setMaxTab(): value: %f ignored\n", value); } } /***********************************************************************/ double CglRedSplit::getMaxTab() const { return param.getMaxTab(); } /***********************************************************************/ void CglRedSplit::setLUB(double value) { if (value > 0.0) { param.setLUB(value); } else { printf("### WARNING: CglRedSplit::setLUB(): value: %f ignored\n", value); } } /* setLUB */ /***********************************************************************/ double CglRedSplit::getLUB() const { return param.getLUB(); } /* getLUB */ /***********************************************************************/ void CglRedSplit::setEPS(double value) { if (value>0.0 && value<=0.1) { param.setEPS(value); } else { printf("### WARNING: CglRedSplit::setEPS(): value: %f ignored\n", value); } } /* setEPS */ /***********************************************************************/ double CglRedSplit::getEPS() const { return param.getEPS(); } /* getEPS */ /***********************************************************************/ void CglRedSplit::setEPS_COEFF(double value) { if (value > 0.0 && value <= 0.1) { param.setEPS_COEFF(value); } else { printf("### WARNING: CglRedSplit::setEPS_COEFF(): value: %f ignored\n", value); } } /* setEPS_COEFF */ /***********************************************************************/ double CglRedSplit::getEPS_COEFF() const { return param.getEPS_COEFF(); } /* getEPS_COEFF */ /***********************************************************************/ void CglRedSplit::setEPS_COEFF_LUB(double value) { if (value > 0.0 && value <= 0.1) { param.setEPS_COEFF_LUB(value); } else { printf("### WARNING: CglRedSplit::setEPS_COEFF_LUB(): value: %f ignored\n", value); } } /* setEPS_COEFF_LUB */ /***********************************************************************/ double CglRedSplit::getEPS_COEFF_LUB() const { return param.getEPS_COEFF_LUB(); } /* getEPS_COEFF_LUB */ /***********************************************************************/ void CglRedSplit::setEPS_RELAX(double value) { if (value > 0.0 && value <= 0.1) { param.setEPS_RELAX_ABS(value); } else { printf("### WARNING: CglRedSplit::setEPS_RELAX(): value: %f ignored\n", value); } } /* setEPS_RELAX */ /***********************************************************************/ double CglRedSplit::getEPS_RELAX() const { return param.getEPS_RELAX_ABS(); } /* getEPS_RELAX */ /***********************************************************************/ void CglRedSplit::setNormIsZero(double value) { if (value>0.0 && value<=1) { param.setNormIsZero(value); } else { printf("### WARNING: CglRedSplit::setNormIsZero(): value: %f ignored\n", value); } } /* setNormIsZero */ /***********************************************************************/ double CglRedSplit::getNormIsZero() const { return param.getNormIsZero(); } /* getNormIsZero */ /***********************************************************************/ void CglRedSplit::setMinReduc(double value) { if (value>0.0 && value<=1) { param.setMinReduc(value); } else { printf("### WARNING: CglRedSplit::MinReduc(): value: %f ignored\n", value); } } /* setMinReduc */ /***********************************************************************/ double CglRedSplit::getMinReduc() const { return param.getMinReduc(); } /* getMinReduc */ /************************************************************************/ void CglRedSplit::set_given_optsol(const double *given_sol, int card_sol) { given_optsol = given_sol; card_given_optsol = card_sol; } /* set_given_optsol */ /************************************************************************/ void CglRedSplit::check_optsol(const int calling_place, const double *lclXlp, const double *slack_val, const int do_flip) { if(card_given_optsol != ncol) { printf("### ERROR: CglRedSplit(): card_given_optsol: %d ncol: %d\n", card_given_optsol, ncol); exit(1); } int i; double *ck_slack = new double[nrow]; #ifdef RS_TRACEALL print(); #endif byRow->timesMinor(given_optsol, ck_slack); int irow; for(irow=0; irow ck_rhs + param.getEPS())) { printf("### ERROR: CglRedSplit::check_optsol(): Cut %d cuts given_optsol\n", irow); rs_printvecDBL("ck_row", ck_row, ncol+nrow); printf("lhs: %f rhs: %f calling_place: %d\n", ck_lhs, ck_rhs, calling_place); exit(1); } } delete[] ck_slack; delete[] ck_row; } /* check_optsol */ /************************************************************************/ void CglRedSplit::check_optsol(const int calling_place, const double * /*lclXlp*/, const double *slack_val, const double *ck_row, const double ck_rhs, const int cut_number, const int do_flip) { if(card_given_optsol != ncol) { printf("### ERROR: CglRedSplit(): card_given_optsol: %d ncol: %d\n", card_given_optsol, ncol); exit(1); } double *cpy_row = new double[ncol+nrow]; double *ck_slack = new double[nrow]; #ifdef RS_TRACEALL print(); #endif int i, irow; for(i=0; itimesMinor(given_optsol, ck_slack); for(irow=0; irow ck_rhs + adjust_rhs + param.getEPS()) { printf("### ERROR: CglRedSplit::check_optsol(): Cut %d cuts given_optsol\n", cut_number); rs_printvecDBL("cpy_row", cpy_row, ncol+nrow); printf("lhs: %f rhs: %f calling_place: %d\n", ck_lhs, ck_rhs + adjust_rhs, calling_place); exit(1); } delete[] cpy_row; delete[] ck_slack; } /* check_optsol */ /************************************************************************/ bool CglRedSplit::rs_are_different_vectors(const int *vect1, const int *vect2, const int dim) { int i; for(i=0; i 1e-6) { printf("### ERROR: rs_are_different_vectors(): vect1[%d]: %12.8f vect2[%d]: %12.8f\n", i, vect1[i], i, vect2[i]); return(0); } } return(1); } /* rs_are_different_vectors */ /************************************************************************/ bool CglRedSplit::rs_are_different_matrices(const CoinPackedMatrix *mat1, const CoinPackedMatrix *mat2, const int nmaj, const int /*nmin*/) { const int *matStart1 = mat1->getVectorStarts(); const double *matElements1 = mat1->getElements(); const int *matIndices1 = mat1->getIndices(); const int *matRowLength1 = mat1->getVectorLengths(); const int *matStart2 = mat2->getVectorStarts(); const double *matElements2 = mat2->getElements(); const int *matIndices2 = mat2->getIndices(); const int *matRowLength2 = mat2->getVectorLengths(); int i, j; for(i=0; i 1e-6) { printf("### ERROR: rs_are_different_matrices(): matElements1[%d]: %12.8f matElements2[%d]: %12.8f\n", j, matElements1[j], j, matElements2[j]); return(1); } } } return(0); } /* rs_are_different_matrices */ /************************************************************************/ void CglRedSplit::generateCuts(const OsiSolverInterface &si, OsiCuts & cs, const CglTreeInfo ) { solver = const_cast(&si); if(solver == NULL) { printf("### WARNING: CglRedSplit::generateCuts(): no solver available.\n"); return; } if(!solver->optimalBasisIsAvailable()) { printf("### WARNING: CglRedSplit::generateCuts(): no optimal basis available.\n"); return; } // Reset some members of CglRedSplit card_intBasicVar_frac = 0; card_intNonBasicVar = 0; card_contNonBasicVar = 0; card_nonBasicAtUpper = 0; card_nonBasicAtLower = 0; // Get basic problem information from solver ncol = solver->getNumCols(); nrow = solver->getNumRows(); colLower = solver->getColLower(); colUpper = solver->getColUpper(); rowLower = solver->getRowLower(); rowUpper = solver->getRowUpper(); rowRhs = solver->getRightHandSide(); xlp = solver->getColSolution(); rowActivity = solver->getRowActivity(); colType = NULL; byRow = solver->getMatrixByRow(); solver->enableFactorization(); generateCuts(cs); solver->disableFactorization(); } /* generateCuts */ /************************************************************************/ void CglRedSplit::generateCuts(OsiCuts &cs) { int i; low_is_lub = new int[ncol]; up_is_lub = new int[ncol]; is_integer = new int[ncol]; compute_is_lub(); compute_is_integer(); int *cstat = new int[ncol]; int *rstat = new int[nrow]; solver->getBasisStatus(cstat, rstat); // 0: free 1: basic // 2: upper 3: lower int *basis_index = new int[nrow]; // basis_index[i] = // index of pivot var in row i // (slack if number >= ncol) #ifdef RS_TRACETAB rs_printvecINT("cstat", cstat, ncol); rs_printvecINT("rstat", rstat, nrow); #endif solver->getBasics(basis_index); cv_intBasicVar_frac = new int[ncol]; intBasicVar_frac = new int[ncol]; intNonBasicVar = new int[ncol]; contNonBasicVar = new int[ncol+nrow]; nonBasicAtUpper = new int[ncol+nrow]; nonBasicAtLower = new int[ncol+nrow]; double dist_int; for(i=0; i param.getAway()) && (dist_int < 1 - param.getAway())) { cv_intBasicVar_frac[i] = 1; card_intBasicVar_frac++; // intBasicVar_frac computed below, // as order must be according to selected rows } break; case 2: // Non basic at upper bound: must be flipped and shifted // so that it becomes non negative with lower bound 0 // It is assumed that bounds for integer variables have been // tightend so that non basic integer structural variables // have integer values nonBasicAtUpper[card_nonBasicAtUpper] = i; card_nonBasicAtUpper++; if(is_integer[i]) { intNonBasicVar[card_intNonBasicVar] = i; card_intNonBasicVar++; } else { contNonBasicVar[card_contNonBasicVar] = i; card_contNonBasicVar++; } break; case 3 : // non basic at lower bound: must be shifted so that it becomes // non negative with lower bound 0 // It is assumed that bounds for integer variables have been // tightend so that they are integer nonBasicAtLower[card_nonBasicAtLower] = i; card_nonBasicAtLower++; if(is_integer[i]) { intNonBasicVar[card_intNonBasicVar] = i; card_intNonBasicVar++; } else { contNonBasicVar[card_contNonBasicVar] = i; card_contNonBasicVar++; } break; default: // free variable ? Don't know how to handle printf("### ERROR: CglRedSplit::generateCuts(): cstat[%d]: %d\n", i, cstat[i]); exit(1); break; } } for(i=0; i (card_contNonBasicVar); double nc3 = nc * nc * nc; if(nc3 > param.getMaxTab()) { new_mTab = static_cast (sqrt(param.getMaxTab()/card_contNonBasicVar)); } else { #if defined(_MSC_VER) new_mTab = static_cast (pow(param.getMaxTab(), 1./3.)); #else new_mTab = static_cast (cbrt(param.getMaxTab())); #endif } if(new_mTab == 0) { delete[] cstat; delete[] rstat; delete[] basis_index; delete[] cv_intBasicVar_frac; delete[] intBasicVar_frac; delete[] intNonBasicVar; delete[] contNonBasicVar; delete[] nonBasicAtUpper; delete[] nonBasicAtLower; delete[] low_is_lub; delete[] up_is_lub; delete[] is_integer; return; // no cuts can be generated } int start = 0; // first row for selecting intBasicVar_frac, if too many. // Removing rows used for generation whose pivot is some // var in intBasicVar_frac is valid since the corresponding // column in the optimal tableau is a column of the // identity matrix if(new_mTab < card_intBasicVar_frac) { // Remove some of the rows used for generation. // Poor randomness; could do better if needed int seed = card_intBasicVar_frac; start = static_cast (nrow * rs_genalea(&seed)); #ifdef RS_TRACE printf("CglRedSlpit::generateCuts(): mTab: %d new_mTab: %d\n", card_intBasicVar_frac, new_mTab); #endif card_intBasicVar_frac = new_mTab; } double *slack_val = new double[nrow]; for(i=0; igetRightHandSide(); if(rs_are_different_vectors(rowRhs, solver_rhs, nrow)) { printf("### ERROR: CglRedSplit::generateCuts(): rowRhs[%d]: %12.f solver_rhs[%d]: %12.f\n", i, rowRhs[i], i, solver_rhs[i]); exit(1); } #endif double *z = new double[ncol]; // workspace to get row of the tableau double *slack = new double[nrow]; // workspace to get row of the tableau #ifdef RS_TRACETAB printOptTab(solver); #endif mTab = card_intBasicVar_frac; nTab = card_contNonBasicVar; rhsTab = new double[mTab]; int card_rowTab = 0; rs_allocmatDBL(&contNonBasicTab, mTab, nTab); rs_allocmatDBL(&intNonBasicTab, mTab, card_intNonBasicVar); card_intBasicVar_frac = 0; // recompute in pivot order for(i=0; i nrow) { ind_row -= nrow; } if(basis_index[ind_row] >= ncol) { continue; } if(cv_intBasicVar_frac[basis_index[ind_row]] == 1) { // row used in generation intBasicVar_frac[card_intBasicVar_frac] = basis_index[ind_row]; card_intBasicVar_frac++; rhsTab[card_rowTab] = xlp[basis_index[ind_row]]; solver->getBInvARow(ind_row, z, slack); int ii; for(ii=0; iigetElements(); const int *rowStart = byRow->getVectorStarts(); const int *indices = byRow->getIndices(); const int *rowLength = byRow->getVectorLengths(); for(i=0; i 0.0) { adjust += fabs(tabrowrhs) * param.getEPS_RELAX_REL(); } rc.setUb(tabrowrhs + adjust); // relax the constraint slightly cs.insertIfNotDuplicate(rc, CoinAbsFltEq(param.getEPS_COEFF())); } } } delete[] cstat; delete[] rstat; delete[] basis_index; delete[] slack; delete[] z; delete[] slack_val; delete[] row; delete[] rowind; delete[] rowelem; delete[] cv_intBasicVar_frac; delete[] intBasicVar_frac; delete[] intNonBasicVar; delete[] contNonBasicVar; delete[] nonBasicAtUpper; delete[] nonBasicAtLower; delete[] low_is_lub; delete[] up_is_lub; delete[] is_integer; rs_deallocmatDBL(&contNonBasicTab, mTab, nTab); rs_deallocmatDBL(&intNonBasicTab, mTab, card_intNonBasicVar); rs_deallocmatINT(&pi_mat, mTab, mTab); delete[] rhsTab; //return(cs.sizeRowCuts()); } /* generateCuts */ /***********************************************************************/ void CglRedSplit::setParam(const CglRedSplitParam &source) { param = source; } /* setParam */ /***********************************************************************/ void CglRedSplit::compute_is_lub() { int i; for(i=0; i param.getLUB()) { up_is_lub[i] = 1; } if(fabs(colLower[i]) > param.getLUB()) { low_is_lub[i] = 1; } } } /* compute_is_lub */ /***********************************************************************/ void CglRedSplit::compute_is_integer() { int i; if(colType != NULL) { for(i=0; iisInteger(i)) { is_integer[i] = 1; } else { if((colUpper[i] - colLower[i] < param.getEPS()) && (rs_above_integer(colUpper[i]) < param.getEPS())) { // continuous variable fixed to an integer value is_integer[i] = 1; } else { is_integer[i] = 0; } } } } } /* compute_is_integer */ /***********************************************************************/ void CglRedSplit::print() const { rs_printvecINT("intBasicVar_frac", intBasicVar_frac, card_intBasicVar_frac); rs_printmatINT("pi_mat", pi_mat, card_intBasicVar_frac, card_intBasicVar_frac); rs_printvecINT("intNonBasicVar", intNonBasicVar, card_intNonBasicVar); rs_printmatDBL("intNonBasicTab", intNonBasicTab, card_intBasicVar_frac, card_intNonBasicVar); rs_printvecINT("contNonBasicVar", contNonBasicVar, card_contNonBasicVar); rs_printmatDBL("contNonBasicTab", contNonBasicTab, card_intBasicVar_frac, card_contNonBasicVar); rs_printvecINT("nonBasicAtLower", nonBasicAtLower, card_nonBasicAtLower); rs_printvecINT("nonBasicAtUpper", nonBasicAtUpper, card_nonBasicAtUpper); } /* print */ /***********************************************************************/ void CglRedSplit::printOptTab(OsiSolverInterface *lclSolver) const { int i; int *cstat = new int[ncol]; int *rstat = new int[nrow]; lclSolver->getBasisStatus(cstat, rstat); // 0: free 1: basic // 2: upper 3: lower int *basis_index = new int[nrow]; // basis_index[i] = // index of pivot var in row i // (slack if number >= ncol) lclSolver->getBasics(basis_index); double *z = new double[ncol]; // workspace to get row of the tableau double *slack = new double[nrow]; // workspace to get row of the tableau double *slack_val = new double[nrow]; for(i=0; igetReducedCost(); const double *dual = lclSolver->getRowPrice(); const double *solution = lclSolver->getColSolution(); rs_printvecINT("cstat", cstat, ncol); rs_printvecINT("rstat", rstat, nrow); rs_printvecINT("basis_index", basis_index, nrow); rs_printvecDBL("solution", solution, ncol); rs_printvecDBL("slack_val", slack_val, nrow); rs_printvecDBL("reduced_costs", rc, ncol); rs_printvecDBL("dual solution", dual, nrow); printf("Optimal Tableau:\n"); for(i=0; igetBInvARow(i, z, slack); int ii; for(ii=0; iigetObjValue()); delete[] cstat; delete[] rstat; delete[] basis_index; delete[] slack; delete[] z; delete[] slack_val; } /* printOptTab */ /*********************************************************************/ CglRedSplit::CglRedSplit() : CglCutGenerator(), nrow(0), ncol(0), card_intBasicVar_frac(0), card_intNonBasicVar(0), card_contNonBasicVar(0), card_nonBasicAtUpper(0), card_nonBasicAtLower(0), cv_intBasicVar_frac(0), intBasicVar_frac(0), intNonBasicVar(0), contNonBasicVar(0), nonBasicAtUpper(0), nonBasicAtLower(0), mTab(0), nTab(0), pi_mat(0), contNonBasicTab(0), intNonBasicTab(0), rhsTab(0), given_optsol(0), card_given_optsol(0) {} /*********************************************************************/ CglRedSplit::CglRedSplit(const CglRedSplitParam &RS_param) : CglCutGenerator(), nrow(0), ncol(0), card_intBasicVar_frac(0), card_intNonBasicVar(0), card_contNonBasicVar(0), card_nonBasicAtUpper(0), card_nonBasicAtLower(0), cv_intBasicVar_frac(0), intBasicVar_frac(0), intNonBasicVar(0), contNonBasicVar(0), nonBasicAtUpper(0), nonBasicAtLower(0), mTab(0), nTab(0), pi_mat(0), contNonBasicTab(0), intNonBasicTab(0), rhsTab(0), given_optsol(0), card_given_optsol(0) { param = RS_param; } /*********************************************************************/ CglRedSplit::CglRedSplit (const CglRedSplit & source) : CglCutGenerator(source), param(source.param), nrow(0), ncol(0), card_intBasicVar_frac(0), card_intNonBasicVar(0), card_contNonBasicVar(0), card_nonBasicAtUpper(0), card_nonBasicAtLower(0), cv_intBasicVar_frac(NULL), intBasicVar_frac(NULL), intNonBasicVar(NULL), contNonBasicVar(NULL), nonBasicAtUpper(NULL), nonBasicAtLower(NULL), mTab(0), nTab(0), pi_mat(NULL), contNonBasicTab(NULL), intNonBasicTab(NULL), rhsTab(NULL), given_optsol(source.given_optsol), card_given_optsol(source.card_given_optsol) {} /*********************************************************************/ CglCutGenerator * CglRedSplit::clone() const { return new CglRedSplit(*this); } /*********************************************************************/ CglRedSplit::~CglRedSplit () {} /*********************************************************************/ CglRedSplit & CglRedSplit::operator=(const CglRedSplit &source) { if (this != &source) { CglCutGenerator::operator=(source); param = source.param; given_optsol = source.given_optsol; card_given_optsol = source.card_given_optsol; } return *this; } /*********************************************************************/ // Returns true if needs optimal basis to do cuts bool CglRedSplit::needsOptimalBasis() const { return true; } /*********************************************************************/ // Create C++ lines to get to current state std::string CglRedSplit::generateCpp(FILE * fp) { CglRedSplit other; fprintf(fp,"0#include \"CglRedSplit.hpp\"\n"); fprintf(fp,"3 CglRedSplit redSplit;\n"); if (param.getMAX_SUPPORT()!=other.param.getMAX_SUPPORT()) fprintf(fp,"3 redSplit.setLimit(%d);\n",param.getMAX_SUPPORT()); else fprintf(fp,"4 redSplit.setLimit(%d);\n",param.getMAX_SUPPORT()); if (param.getAway()!=other.param.getAway()) fprintf(fp,"3 redSplit.setAway(%g);\n",param.getAway()); else fprintf(fp,"4 redSplit.setAway(%g);\n",param.getAway()); if (param.getLUB()!=other.param.getLUB()) fprintf(fp,"3 redSplit.setLUB(%g);\n",param.getLUB()); else fprintf(fp,"4 redSplit.setLUB(%g);\n",param.getLUB()); if (param.getEPS()!=other.param.getEPS()) fprintf(fp,"3 redSplit.set.EPS(%g);\n",param.getEPS()); else fprintf(fp,"4 redSplit.setEPS(%g);\n",param.getEPS()); if (param.getEPS_COEFF()!=other.param.getEPS_COEFF()) fprintf(fp,"3 redSplit.setEPS_COEFF(%g);\n",param.getEPS_COEFF()); else fprintf(fp,"4 redSplit.set.EPS_COEFF(%g);\n",param.getEPS_COEFF()); if (param.getEPS_COEFF_LUB()!=other.param.getEPS_COEFF_LUB()) fprintf(fp,"3 redSplit.set.EPS_COEFF_LUB(%g);\n",param.getEPS_COEFF_LUB()); else fprintf(fp,"4 redSplit.set.EPS_COEFF_LUB(%g);\n",param.getEPS_COEFF_LUB()); if (param.getEPS_RELAX_ABS()!=other.param.getEPS_RELAX_ABS()) fprintf(fp,"3 redSplit.set.EPS_RELAX(%g);\n",param.getEPS_RELAX_ABS()); else fprintf(fp,"4 redSplit.set.EPS_RELAX(%g);\n",param.getEPS_RELAX_ABS()); if (param.getNormIsZero()!=other.param.getNormIsZero()) fprintf(fp,"3 redSplit.setNormIsZero(%g);\n",param.getNormIsZero()); else fprintf(fp,"4 redSplit.setNormIsZero(%g);\n",param.getNormIsZero()); if (param.getMinReduc()!=other.param.getMinReduc()) fprintf(fp,"3 redSplit.setMinReduc(%g);\n",param.getMinReduc()); else fprintf(fp,"4 redSplit.setMinReduc(%g);\n",param.getMinReduc()); if (param.getMaxTab()!=other.param.getMaxTab()) fprintf(fp,"3 redSplit.setMaxTab(%g);\n",param.getMaxTab()); else fprintf(fp,"4 redSplit.setMaxTab(%g);\n",param.getMaxTab()); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 redSplit.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 redSplit.setAggressiveness(%d);\n",getAggressiveness()); return "redSplit"; } CoinMP-1.8.3/Cgl/src/CglRedSplit/CglRedSplitParam.hpp0000644000175000017500000002425512130104031020623 0ustar renerene// Name: CglRedSplitParam.hpp // Author: Francois Margot // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // email: fmargot@andrew.cmu.edu // Date: 11/24/06 // // $Id: CglRedSplitParam.hpp 1122 2013-04-06 20:39:53Z stefan $ //----------------------------------------------------------------------------- // Copyright (C) 2006, Francois Margot and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglRedSplitParam_H #define CglRedSplitParam_H #include "CglParam.hpp" /**@name CglRedSplit Parameters */ //@{ /** Class collecting parameters the Reduced-and-split cut generator. Parameters of the generator are listed below. Modifying the default values for parameters other than the last four might result in invalid cuts. - LUB: Value considered large for the absolute value of a lower or upper bound on a variable. See method setLUB(). - MAXDYN: Maximum ratio between largest and smallest non zero coefficients in a cut. See method setMAXDYN(). - MAXDYN_LUB: Maximum ratio between largest and smallest non zero coefficients in a cut involving structural variables with lower or upper bound in absolute value larger than LUB. Should logically be larger or equal to MAXDYN. See method setMAXDYN_LUB(). - EPS_ELIM: Precision for deciding if a coefficient is zero when eliminating slack variables. See method setEPS_ELIM(). - EPS_COEFF_LUB: Precision for deciding if a coefficient of a generated cut is zero when the corresponding variable has a lower or upper bound larger than LUB in absolute value. See method setEPS_COEFF_LUB(). - MINVIOL: Minimum violation for the current basic solution in a generated cut. See method setMINVIOL(). - USE_INTSLACKS: Use integer slacks to generate cuts. (not implemented). See method setUSE_INTSLACKS(). - USE_CG2: Use alternative formula to generate a mixed integer Gomory cut (see methods CglRedSPlit::generate_cgcut() and CglRedSPlit::generate_cgcut_2()). See method setUSE_CG2(). - normIsZero: Norm of a vector is considered zero if smaller than this value. See method setNormIsZero(). - minReduc: Reduction is performed only if the norm of the vector is reduced by this fraction. See method setMinReduc(). - away: Look only at basic integer variables whose current value is at least this value from being integer. See method setAway(). - maxTab: Controls the number of rows selected for the generation. See method setMaxTab(). */ //@} class CglRedSplitParam : public CglParam { public: /**@name Set/get methods */ //@{ /** Set away, the minimum distance from being integer used for selecting rows for cut generation; all rows whose pivot variable should be integer but is more than away from integrality will be selected; Default: 0.05 */ virtual void setAway(const double value); /// Get value of away inline double getAway() const {return away_;} /** Set the value of LUB, value considered large for the absolute value of a lower or upper bound on a variable; Default: 1000 */ virtual void setLUB(const double value); /** Get the value of LUB */ inline double getLUB() const {return LUB;} /** Set the value of EPS_ELIM, epsilon for values of coefficients when eliminating slack variables; Default: 1e-12 */ void setEPS_ELIM(const double value); /** Get the value of EPS_ELIM */ double getEPS_ELIM() const {return EPS_ELIM;} /** Set EPS_RELAX_ABS */ virtual void setEPS_RELAX_ABS(const double eps_ra); /** Get value of EPS_RELAX_ABS */ inline double getEPS_RELAX_ABS() const {return EPS_RELAX_ABS;} /** Set EPS_RELAX_REL */ virtual void setEPS_RELAX_REL(const double eps_rr); /** Get value of EPS_RELAX_REL */ inline double getEPS_RELAX_REL() const {return EPS_RELAX_REL;} // Set the maximum ratio between largest and smallest non zero // coefficients in a cut. Default: 1e8. virtual void setMAXDYN(double value); /** Get the value of MAXDYN */ inline double getMAXDYN() const {return MAXDYN_LUB;} // Set the maximum ratio between largest and smallest non zero // coefficient in a cut involving structural variables with // lower or upper bound in absolute value larger than LUB. // Should logically be larger or equal to MAXDYN. Default: 1e13. virtual void setMAXDYN_LUB(double value); /** Get the value of MAXDYN_LUB */ inline double getMAXDYN_LUB() const {return MAXDYN_LUB;} /** Set the value of EPS_COEFF_LUB, epsilon for values of coefficients for variables with absolute value of lower or upper bound larger than LUB; Default: 1e-13 */ virtual void setEPS_COEFF_LUB(const double value); /** Get the value of EPS_COEFF_LUB */ inline double getEPS_COEFF_LUB() const {return EPS_COEFF_LUB;} /** Set the value of MINVIOL, the minimum violation for the current basic solution in a generated cut. Default: 1e-7 */ virtual void setMINVIOL(double value); /** Get the value of MINVIOL */ inline double getMINVIOL() const {return MINVIOL;} /** Set the value of USE_INTSLACKS. Default: 0 */ virtual void setUSE_INTSLACKS(int value); /** Get the value of USE_INTSLACKS */ inline int getUSE_INTSLACKS() const {return USE_INTSLACKS;} /** Set the value of USE_CG2. Default: 0 */ virtual void setUSE_CG2(int value); /** Get the value of USE_CG2 */ inline int getUSE_CG2() const {return USE_CG2;} /** Set the value of normIsZero, the threshold for considering a norm to be 0; Default: 1e-5 */ virtual void setNormIsZero(const double value); /** Get the value of normIsZero */ inline double getNormIsZero() const {return normIsZero;} /** Set the value of minReduc, threshold for relative norm improvement for performing a reduction; Default: 0.05 */ virtual void setMinReduc(const double value); /// Get the value of minReduc inline double getMinReduc() const {return minReduc;} /** Set the maximum allowed value for (mTab * mTab * CoinMax(mTab, nTab)) where mTab is the number of rows used in the combinations and nTab is the number of continuous non basic variables. The work of the generator is proportional to (mTab * mTab * CoinMax(mTab, nTab)). Reducing the value of maxTab makes the generator faster, but weaker. Default: 1e7. */ virtual void setMaxTab(const double value); /// Get the value of maxTab inline double getMaxTab() const {return maxTab_;} //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglRedSplitParam(const double lub = 1000.0, const double eps_elim = 1e-12, const double eps_relax_abs = 1e-8, const double eps_relax_rel = 0.0, const double max_dyn = 1e8, const double max_dyn_lub = 1e13, const double eps_coeff_lub = 1e-13, const double min_viol = 1e-7, const int use_int_slacks = 0, const int use_cg2 = 0, const double norm_zero = 1e-5, const double min_reduc = 0.05, const double away = 0.05, const double max_tab = 1e7); /// Constructor from CglParam CglRedSplitParam(const CglParam &source, const double lub = 1000.0, const double eps_elim = 1e-12, const double eps_relax_abs = 1e-8, const double eps_relax_rel = 0.0, const double max_dyn = 1e8, const double max_dyn_lub = 1e13, const double eps_coeff_lub = 1e-13, const double min_viol = 1e-7, const int use_int_slacks = 0, const int use_cg2 = 0, const double norm_zero = 1e-5, const double min_reduc = 0.05, const double away = 0.05, const double max_tab = 1e7); /// Copy constructor CglRedSplitParam(const CglRedSplitParam &source); /// Clone virtual CglRedSplitParam* clone() const; /// Assignment operator virtual CglRedSplitParam& operator=(const CglRedSplitParam &rhs); /// Destructor virtual ~CglRedSplitParam(); //@} protected: /**@name Parameters */ //@{ /** Value considered large for the absolute value of lower or upper bound on a variable. Default: 1000. */ double LUB; /** Epsilon for value of coefficients when eliminating slack variables. Default: 1e-12. */ double EPS_ELIM; /** Value added to the right hand side of each generated cut to relax it. Default: 1e-8 */ double EPS_RELAX_ABS; /** For a generated cut with right hand side rhs_val, EPS_RELAX_EPS * fabs(rhs_val) is used to relax the constraint. Default: 0 */ double EPS_RELAX_REL; // Maximum ratio between largest and smallest non zero // coefficients in a cut. Default: 1e8. double MAXDYN; // Maximum ratio between largest and smallest non zero // coefficients in a cut involving structural variables with // lower or upper bound in absolute value larger than LUB. // Should logically be larger or equal to MAXDYN. Default: 1e13. double MAXDYN_LUB; /// Epsilon for value of coefficients for variables with absolute value of /// lower or upper bound larger than LUB. Default: 1e-13. double EPS_COEFF_LUB; /// Minimum violation for the current basic solution in a generated cut. /// Default: 1e-7. double MINVIOL; /// Use integer slacks to generate cuts if USE_INTSLACKS = 1. Default: 0. int USE_INTSLACKS; /// Use second way to generate a mixed integer Gomory cut /// (see methods generate_cgcut()) and generate_cgcut_2()). Default: 0. int USE_CG2; /// Norm of a vector is considered zero if smaller than normIsZero; /// Default: 1e-5. double normIsZero; /// Minimum reduction in percent that must be achieved by a potential /// reduction step in order to be performed; Between 0 and 1, default: 0.05. double minReduc; /// Use row only if pivot variable should be integer but is more /// than away_ from being integer. double away_; /// Maximum value for (mTab * mTab * CoinMax(mTab, nTab)). See method /// setMaxTab(). double maxTab_; //@} }; #endif CoinMP-1.8.3/Cgl/src/CglRedSplit/CglRedSplitTest.cpp0000644000175000017500000000553712130104031020477 0ustar renerene// // Name: CglRedSplit.cpp // Author: Francois Margot // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 2/6/05 // // $Id: CglRedSplitTest.cpp 1122 2013-04-06 20:39:53Z stefan $ //--------------------------------------------------------------------------- // Copyright (C) 2005, Francois Margot and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglRedSplit.hpp" void CglRedSplitUnitTest(const OsiSolverInterface *baseSiP, const std::string mpsDir) { // Test default constructor { CglRedSplit aGenerator; } // Test copy & assignment { CglRedSplit rhs; { CglRedSplit bGenerator; CglRedSplit cGenerator(bGenerator); rhs=bGenerator; } } // Test get/set methods { CglRedSplit getset; CglRedSplitParam gsparam = getset.getParam(); double geps = 10 * gsparam.getEPS(); gsparam.setEPS(geps); double geps2 = gsparam.getEPS(); assert(geps == geps2); double gepse = 10 * gsparam.getEPS_ELIM(); gsparam.setEPS_ELIM(gepse); double gepse2 = gsparam.getEPS_ELIM(); assert(gepse == gepse2); double gmv = 10 * gsparam.getMINVIOL(); gsparam.setMINVIOL(gmv); double gmv2 = gsparam.getMINVIOL(); assert(gmv == gmv2); int gucg = gsparam.getUSE_CG2(); gucg = 1 - gucg; gsparam.setUSE_CG2(gucg); int gucg2 = gsparam.getUSE_CG2(); assert(gucg == gucg2); } // Test generateCuts { CglRedSplit gct; OsiSolverInterface *siP = baseSiP->clone(); std::string fn = mpsDir+"p0033"; std::string fn2 = mpsDir+"p0033.mps"; FILE *in_f = fopen(fn2.c_str(), "r"); if(in_f == NULL) { std::cout<<"Can not open file "<readMps(fn.c_str(),"mps"); siP->initialSolve(); double lpRelax = siP->getObjValue(); OsiCuts cs; gct.getParam().setMAX_SUPPORT(34); gct.getParam().setUSE_CG2(1); // gct.getParam().setUSE_CG2(1); gct.generateCuts(*siP, cs); int nRowCuts = cs.sizeRowCuts(); std::cout<<"There are "< 0); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cs); siP->resolve(); double lpRelaxAfter= siP->getObjValue(); std::cout<<"Initial LP value: "< #include //#include //#include #include "CoinPragma.hpp" #include "CglCutGenerator.hpp" #include "CoinHelperFunctions.hpp" //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglCutGenerator::CglCutGenerator () : aggressive_(0), canDoGlobalCuts_(false) { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglCutGenerator::CglCutGenerator ( const CglCutGenerator & source) : aggressive_(source.aggressive_), canDoGlobalCuts_(source.canDoGlobalCuts_) { // nothing to do here } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglCutGenerator::~CglCutGenerator () { // nothing to do here } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglCutGenerator & CglCutGenerator::operator=( const CglCutGenerator& rhs) { if (this != &rhs) { aggressive_ = rhs.aggressive_; canDoGlobalCuts_ = rhs.canDoGlobalCuts_; } return *this; } bool CglCutGenerator::mayGenerateRowCutsInTree() const { return true; } // Return true if needs optimal basis to do cuts bool CglCutGenerator::needsOptimalBasis() const { return false; } #ifdef NDEBUG #undef NDEBUG #endif #if 0 //-------------------------------------------------------------------------- // test EKKsolution methods. //-------------------------------------------------------------------------- void CglCutGenerator::unitTest() { } #endif CoinMP-1.8.3/Cgl/src/config.h.in0000644000175000017500000000613612130104031014622 0ustar renerene/* src/config.h.in. Generated from configure.ac by autoheader. */ /* SVN revision number of project */ #undef CGL_SVN_REV /* Version number of project */ #undef CGL_VERSION /* Major Version number of project */ #undef CGL_VERSION_MAJOR /* Minor Version number of project */ #undef CGL_VERSION_MINOR /* Release Version number of project */ #undef CGL_VERSION_RELEASE /* Define to the debug sanity check level (0 is no test) */ #undef COIN_CGL_CHECKLEVEL /* Define to the debug verbosity level (0 is no output) */ #undef COIN_CGL_VERBOSITY /* Define to 1 if the CoinUtils package is available */ #undef COIN_HAS_COINUTILS /* Define to 1 if the Osi package is available */ #undef COIN_HAS_OSI /* Define to 1 if the OsiClp package is available */ #undef COIN_HAS_OSICLP /* Define to 1 if the OsiCpx package is available */ #undef COIN_HAS_OSICPX /* Define to 1 if the OsiDyLP package is available */ #undef COIN_HAS_OSIDYLP /* Define to 1 if the OsiGlpk package is available */ #undef COIN_HAS_OSIGLPK /* Define to 1 if the OsiMsk package is available */ #undef COIN_HAS_OSIMSK /* Define to 1 if the OsiVol package is available */ #undef COIN_HAS_OSIVOL /* Define to 1 if the OsiXpr package is available */ #undef COIN_HAS_OSIXPR /* Define to 1 if the Sample package is available */ #undef COIN_HAS_SAMPLE /* Define to 1 if you have the header file. */ #undef HAVE_CFLOAT /* Define to 1 if you have the header file. */ #undef HAVE_CIEEEFP /* Define to 1 if you have the header file. */ #undef HAVE_CMATH /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the header file. */ #undef HAVE_IEEEFP_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION CoinMP-1.8.3/Cgl/src/CglParam.cpp0000644000175000017500000000444312130104031014770 0ustar renerene// Name: CglParam.cpp // Author: Francois Margot // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 11/24/06 // // This code is licensed under the terms of the Eclipse Public License (EPL). // Copyright (C) 2006, Francois Margot and others. All Rights Reserved. //--------------------------------------------------------------------------- #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CglParam.hpp" /***********************************************************************/ void CglParam::setINFINIT(const double inf) { if(inf > 0) INFINIT = inf; } /* setINFINIT */ /***********************************************************************/ void CglParam::setEPS(const double eps) { if(eps >= 0) EPS = eps; } /* setEPS */ /***********************************************************************/ void CglParam::setEPS_COEFF(const double eps_c) { if(eps_c >= 0) EPS_COEFF = eps_c; } /* setEPS_COEFF */ /***********************************************************************/ void CglParam::setMAX_SUPPORT(const int max_s) { if(max_s > 0) MAX_SUPPORT = max_s; } /* setMAX_SUPPORT */ /***********************************************************************/ CglParam::CglParam(const double inf, const double eps, const double eps_c, const int max_s) : INFINIT(inf), EPS(eps), EPS_COEFF(eps_c), MAX_SUPPORT(max_s) {} /***********************************************************************/ CglParam::CglParam(const CglParam &source) : INFINIT(source.INFINIT), EPS(source.EPS), EPS_COEFF(source.EPS_COEFF), MAX_SUPPORT(source.MAX_SUPPORT) {} /***********************************************************************/ CglParam* CglParam::clone() const { return new CglParam(*this); } /***********************************************************************/ CglParam& CglParam::operator=(const CglParam &rhs) { if(this != &rhs) { INFINIT = rhs.INFINIT; EPS = rhs.EPS; EPS_COEFF = rhs.EPS_COEFF; MAX_SUPPORT = rhs.MAX_SUPPORT; } return *this; } /***********************************************************************/ CglParam::~CglParam() {} CoinMP-1.8.3/Cgl/src/CglGomory/0000755000175000017500000000000012600453455014516 5ustar renereneCoinMP-1.8.3/Cgl/src/CglGomory/Makefile.in0000644000175000017500000005443012506321416016565 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ @COIN_HAS_OSICLP_TRUE@am__append_1 = $(OSICLP_CFLAGS) subdir = src/CglGomory DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglGomory_la_LIBADD = am_libCglGomory_la_OBJECTS = CglGomory.lo CglGomoryTest.lo libCglGomory_la_OBJECTS = $(am_libCglGomory_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglGomory_la_SOURCES) DIST_SOURCES = $(libCglGomory_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglGomory # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglGomory.la # List all source files for this library, including headers libCglGomory_la_SOURCES = CglGomory.cpp CglGomory.hpp CglGomoryTest.cpp # This is for libtool (on Windows) libCglGomory_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) \ $(OSI_CFLAGS) $(am__append_1) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglGomory.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglGomory/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglGomory/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglGomory.la: $(libCglGomory_la_OBJECTS) $(libCglGomory_la_DEPENDENCIES) $(CXXLINK) $(libCglGomory_la_LDFLAGS) $(libCglGomory_la_OBJECTS) $(libCglGomory_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglGomory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglGomoryTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglGomory/Makefile.am0000644000175000017500000000326711621724114016555 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglGomory # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglGomory.la # List all source files for this library, including headers libCglGomory_la_SOURCES = CglGomory.cpp CglGomory.hpp CglGomoryTest.cpp # This is for libtool (on Windows) libCglGomory_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) if COIN_HAS_OSICLP AM_CPPFLAGS += $(OSICLP_CFLAGS) endif # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglGomory.hpp CoinMP-1.8.3/Cgl/src/CglGomory/CglGomory.cpp0000644000175000017500000014717212575706415017150 0ustar renerene// Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include //#define CGL_DEBUG 1 #ifdef NDEBUG //#undef NDEBUG #endif #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "OsiRowCutDebugger.hpp" #define COIN_HAS_CLP_GOMORY #ifdef COIN_HAS_CLP_GOMORY #include "OsiClpSolverInterface.hpp" #endif #include "CoinFactorization.hpp" #undef CLP_OSL #if 1 #define CLP_OSL 1 #if CLP_OSL!=1&&CLP_OSL!=3 #undef CLP_OSL #else #include "CoinOslFactorization.hpp" #endif #endif #include "CoinWarmStartBasis.hpp" #include "CglGomory.hpp" #include "CoinFinite.hpp" #ifdef CGL_DEBUG_GOMORY int gomory_try=CGL_DEBUG_GOMORY; #endif //------------------------------------------------------------------- // Generate Gomory cuts //------------------------------------------------------------------- void CglGomory::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) { #ifdef CGL_DEBUG_GOMORY gomory_try++; #endif // Get basic problem information int numberColumns=si.getNumCols(); // get integer variables and basis char * intVar = new char[numberColumns]; int i; CoinWarmStart * warmstart = si.getWarmStart(); CoinWarmStartBasis* warm = dynamic_cast(warmstart); const double * colUpper = si.getColUpper(); const double * colLower = si.getColLower(); //#define CLP_INVESTIGATE2 #ifndef CLP_INVESTIGATE2 if ((info.options&16)!=0) #endif printf("%d %d %d\n",info.inTree,info.options,info.pass); for (i=0;icolLower[i]+0.5) { if (fabs(colUpper[i]-1.0)<1.0e-12&&fabs(colLower[i])<1.0e-12) { intVar[i]=1; //0-1 } else if (colLower[i]>=0.0) { intVar[i] = 2; // other } else { // negative bounds - I am not sure works intVar[i] = 3; } } else { intVar[i] = 4; } } else { intVar[i]=0; } } const OsiSolverInterface * useSolver=&si; #ifdef COIN_HAS_CLP_GOMORY double * objective = NULL; OsiClpSolverInterface * clpSolver = dynamic_cast(originalSolver_); int numberOriginalRows = -1; if (clpSolver) { useSolver = originalSolver_; assert (gomoryType_); // check simplex is plausible if (!clpSolver->getNumRows()||numberColumns!=clpSolver->getNumCols()) { delete originalSolver_; originalSolver_=si.clone(); clpSolver = dynamic_cast(originalSolver_); assert (clpSolver); useSolver = originalSolver_; } ClpSimplex * simplex = clpSolver->getModelPtr(); numberOriginalRows = simplex->numberRows(); int numberRows = si.getNumRows(); assert (numberOriginalRows<=numberRows); // only do if different (unless type 2x) int gomoryType = gomoryType_%10; int whenToDo = gomoryType_/10; if (whenToDo==2 ||(numberRows>numberOriginalRows && whenToDo==1 && (info.options&512)==0) || ((info.options&1024)!=0 && (info.options&512)==0 && numberTimesStalled_<3)) { // bounds memcpy(simplex->columnLower(),colLower,numberColumns*sizeof(double)); memcpy(simplex->columnUpper(),colUpper,numberColumns*sizeof(double)); double * obj = simplex->objective(); objective = CoinCopyOfArray(obj,numberColumns); const double * pi = si.getRowPrice(); const CoinPackedMatrix * rowCopy = si.getMatrixByRow(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * rowElements = rowCopy->getElements(); const double * rowLower = si.getRowLower(); const double * rowUpper = si.getRowUpper(); int numberCopy; int numberAdd; double * rowLower2 = NULL; double * rowUpper2 = NULL; int * column2 = NULL; CoinBigIndex * rowStart2 = NULL; double * rowElements2 = NULL; char * copy = new char [numberRows-numberOriginalRows]; memset(copy,0,numberRows-numberOriginalRows); if (gomoryType==2) { numberCopy=0; numberAdd=0; for (int iRow=numberOriginalRows;iRow0.5) obj[i] -= randomNumber*0.001*fabs(obj[i]); else obj[i] += randomNumber*0.001*fabs(obj[i]); } } #endif if (numberCopy) { clpSolver->addRows(numberCopy, rowStart2,column2,rowElements2, rowLower2,rowUpper2); delete [] rowLower2 ; delete [] rowUpper2 ; delete [] column2 ; delete [] rowStart2 ; delete [] rowElements2 ; } delete [] copy; memcpy(simplex->primalColumnSolution(),si.getColSolution(), numberColumns*sizeof(double)); warm->resize(numberOriginalRows,numberColumns); clpSolver->setBasis(*warm); delete warm; simplex->setDualObjectiveLimit(COIN_DBL_MAX); simplex->setLogLevel(0); simplex->primal(1); // check basis int numberTotal=simplex->numberRows()+simplex->numberColumns(); int superbasic=0; for (int i=0;igetStatus(i)==ClpSimplex::superBasic) superbasic++; } if (superbasic) { //printf("%d superbasic!\n",superbasic); simplex->dual(); superbasic=0; for (int i=0;igetStatus(i)==ClpSimplex::superBasic) superbasic++; } assert (!superbasic); } //printf("Trying - %d its status %d objs %g %g - with offset %g\n", // simplex->numberIterations(),simplex->status(), // simplex->objectiveValue(),si.getObjValue(),simplex->objectiveValue()+offset); //simplex->setLogLevel(0); warm=simplex->getBasis(); warmstart=warm; if (simplex->status()) { //printf("BAD status %d\n",simplex->status()); //clpSolver->writeMps("clp"); //si.writeMps("si"); delete [] objective; objective=NULL; useSolver=&si; } } else { // don't do delete warmstart; warmstart=NULL; if ((info.options&1024)==0) numberTimesStalled_=0; } } #endif #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&!debugger->onOptimalPath(si)) debugger = NULL; #else const OsiRowCutDebugger * debugger = NULL; #endif int numberRowCutsBefore = cs.sizeRowCuts(); if (warmstart) generateCuts(debugger, cs, *useSolver->getMatrixByCol(), *useSolver->getMatrixByRow(), useSolver->getColSolution(), useSolver->getColLower(), useSolver->getColUpper(), useSolver->getRowLower(), useSolver->getRowUpper(), intVar,warm,info); #ifdef COIN_HAS_CLP_GOMORY if (objective) { ClpSimplex * simplex = clpSolver->getModelPtr(); memcpy(simplex->objective(),objective,numberColumns*sizeof(double)); delete [] objective; // take out locally useless cuts const double * solution = si.getColSolution(); double primalTolerance = 1.0e-7; int numberRowCutsAfter = cs.sizeRowCuts(); for (int k = numberRowCutsAfter - 1; k >= numberRowCutsBefore; k--) { const OsiRowCut * thisCut = cs.rowCutPtr(k) ; double sum = 0.0; int n = thisCut->row().getNumElements(); const int * column = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); assert (n); for (int i = 0; i < n; i++) { double value = element[i]; sum += value * solution[column[i]]; } if (sum > thisCut->ub() + primalTolerance) { sum = sum - thisCut->ub(); } else if (sum < thisCut->lb() - primalTolerance) { sum = thisCut->lb() - sum; } else { sum = 0.0; } if (!sum) { // take out cs.eraseRowCut(k); } } #ifdef CLP_INVESTIGATE2 printf("OR %p pass %d inTree %c - %d cuts (but %d deleted)\n", originalSolver_,info.pass,info.inTree?'Y':'N', numberRowCutsAfter-numberRowCutsBefore, numberRowCutsAfter-cs.sizeRowCuts()); #endif } #endif delete warmstart; delete [] intVar; if ((!info.inTree&&((info.options&4)==4||((info.options&8)&&!info.pass))) ||(info.options&16)!=0) { int limit = maximumLengthOfCutInTree(); int numberRowCutsAfter = cs.sizeRowCuts(); for (int i=numberRowCutsBefore;irow().getNumElements(); if (length<=limit) cs.rowCutPtr(i)->setGloballyValid(); } } if ((gomoryType_%10)==2) { // back to original assert(clpSolver); int numberRows = clpSolver->getNumRows(); if (numberRows>numberOriginalRows) { int numberDelete = numberRows-numberOriginalRows; int * delRow = new int [numberDelete]; for (int i=0;ideleteRows(numberDelete,delRow); delete [] delRow; } } } // Returns value - floor but allowing for small errors inline double above_integer(double value) { double value2=floor(value); double value3=floor(value+0.5); if (fabs(value3-value)<1.0e-9*(fabs(value3)+1.0)) return 0.0; return value-value2; } //------------------------------------------------------------------- // Returns the greatest common denominator of two // positive integers, a and b, found using Euclid's algorithm //------------------------------------------------------------------- static int gcd(int a, int b) { int remainder = -1; #if CGL_DEBUG>1 printf("gcd of %d and %d\n",a,b); int nLoop=0; #endif // make sure a<=b (will always remain so) if(a > b) { // Swap a and b int temp = a; a = b; b = temp; } // if zero then gcd is nonzero (zero may occur in rhs of packed) if (!a) { if (b) { return b; } else { printf("**** gcd given two zeros!!\n"); abort(); } } while (remainder) { #if CGL_DEBUG>1 nLoop++; if (nLoop>50) { abort(); return -1; } #endif remainder = b % a; b = a; a = remainder; } #if CGL_DEBUG>1 printf("=> %d\n",b); #endif return b; } //------------------------------------------------------------------- // Returns the nearest rational with denominator < maxDenominator //------------------------------------------------------------------- typedef struct { int numerator; int denominator; } Rational; inline Rational nearestRational(double value, int maxDenominator) { Rational tryThis; Rational tryA; Rational tryB; double integerPart; #if CGL_DEBUG>1 printf("Rational of %g is ",value); #endif int nLoop=0; tryA.numerator=0; tryA.denominator=1; tryB.numerator=1; tryB.denominator=0; if (fabs(value)<1.0e-10) return tryA; integerPart = floor(value); value -= integerPart; tryThis.numerator = tryB.numerator* static_cast (integerPart) + tryA.numerator; tryThis.denominator = tryB.denominator* static_cast (integerPart) + tryA.denominator; tryA = tryB; tryB = tryThis; while (value>1.0e-10 && tryB.denominator <=maxDenominator) { nLoop++; if (nLoop>50) { Rational bad; bad.numerator=-1; bad.denominator=-1; #if CGL_DEBUG>1 printf(" *** bad rational\n"); #endif return bad; } value = 1.0/value; integerPart = floor(value+1.0e-10); value -= integerPart; tryThis.numerator = tryB.numerator* static_cast (integerPart) + tryA.numerator; tryThis.denominator = tryB.denominator* static_cast(integerPart) + tryA.denominator; tryA = tryB; tryB = tryThis; } if (tryB.denominator <= maxDenominator) { #if CGL_DEBUG>1 printf("%d/%d\n",tryB.numerator,tryB.denominator); #endif return tryB; } else { #if CGL_DEBUG>1 printf("%d/%d\n",tryA.numerator,tryA.denominator); #endif return tryA; } } // Does actual work - returns number of cuts int CglGomory::generateCuts( #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger, #else const OsiRowCutDebugger * , #endif OsiCuts & cs, const CoinPackedMatrix & columnCopy, const CoinPackedMatrix & rowCopy, const double * colsol, const double * colLower, const double * colUpper, const double * rowLower, const double * rowUpper, const char * intVar, const CoinWarmStartBasis* warm, const CglTreeInfo info) { int infoOptions=info.options; bool globalCuts = (infoOptions&16)!=0; double testFixed = (!globalCuts) ? 1.0e-8 : -1.0; // get what to look at double away = info.inTree ? away_ : CoinMin(away_,awayAtRoot_); int numberRows=columnCopy.getNumRows(); int numberColumns=columnCopy.getNumCols(); int numberElements=columnCopy.getNumElements(); // Allow bigger length on initial matrix (if special setting) //if (limit==512&&!info.inTree&&!info.pass) //limit=1024; // Start of code to create a factorization from warm start (A) ==== // check factorization is okay CoinFactorization factorization; #ifdef CLP_OSL CoinOslFactorization * factorization2=NULL; if (alternateFactorization_) { factorization2 = new CoinOslFactorization(); } #endif // We can either set increasing rows so ...IsBasic gives pivot row // or we can just increment iBasic one by one // for now let ...iBasic give pivot row int status=-100; // probably could use pivotVariables from OsiSimplexModel int * rowIsBasic = new int[numberRows]; int * columnIsBasic = new int[numberColumns]; int i; int numberBasic=0; for (i=0;igetArtifStatus(i) == CoinWarmStartBasis::basic) { rowIsBasic[i]=1; numberBasic++; } else { rowIsBasic[i]=-1; } } for (i=0;igetStructStatus(i) == CoinWarmStartBasis::basic) { columnIsBasic[i]=1; numberBasic++; } else { columnIsBasic[i]=-1; } } //returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */ while (status<-98) { #ifdef CLP_OSL if (!alternateFactorization_) { #endif status=factorization.factorize(columnCopy, rowIsBasic, columnIsBasic); if (status==-99) factorization.areaFactor(factorization.areaFactor() * 2.0); #ifdef CLP_OSL } else { double areaFactor=1.0; status=factorization2->factorize(columnCopy, rowIsBasic, columnIsBasic,areaFactor); if (status==-99) areaFactor *= 2.0; } #endif } if (status) { #ifdef COIN_DEVELOP std::cout<<"Bad factorization of basis - status "<conditionNumber(); #else double relaxation = factorization.conditionNumber(); #endif // if very small be a bit more careful if (relaxation<1.0e-10) relaxation=1.0/sqrt(relaxation); #ifdef COIN_DEVELOP_z if (relaxation>1.0e49) printf("condition %g\n",relaxation); #endif //printf("condition %g %g\n",relaxation,conditionNumberMultiplier_); relaxation *= conditionNumberMultiplier_; double bounds[2]={-COIN_DBL_MAX,0.0}; int iColumn,iRow; const int * column = rowCopy.getIndices(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const int * rowLength = rowCopy.getVectorLengths(); const double * rowElements = rowCopy.getElements(); const int * row = columnCopy.getIndices(); const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); const int * columnLength = columnCopy.getVectorLengths(); const double * columnElements = columnCopy.getElements(); // we need to do book-keeping for variables at ub double tolerance = 1.0e-7; bool * swap= new bool [numberColumns]; for (iColumn=0;iColumnrowLower[iRow]+1.0e-7) { int type=0; double rhs=0.0; if (rowActivity[iRow]>=rowUpper[iRow]-1.0e-7) { type=1; rhs=rowUpper[iRow]; } else if (rowActivity[iRow]<=rowLower[iRow]+1.0e-7) { type=2; rhs=rowLower[iRow]; } else { // probably large rhs if (rowActivity[iRow]-rowLower[iRow]< rowUpper[iRow]-rowActivity[iRow]) rowType[iRow]=2; else rowType[iRow]=1; #ifdef CGL_DEBUG assert (CoinMin(rowUpper[iRow]-rowActivity[iRow], rowActivity[iRow]-rowUpper[iRow])<1.0e-5); //abort(); continue; #else continue; #endif } if (above_integer(rhs)<1.0e-10) { // could be integer slack bool allInteger=true; int k; for (k=rowStart[iRow]; k1.0e-10) { // not integer slacks allInteger=false; break; } } if (allInteger) { type |= 4; } } rowType[iRow]=type; } else { // row is equality or basic rowType[iRow]=0; } } // Start of code to create work arrays for factorization (B) ==== // two vectors for updating (one is work) CoinIndexedVector work; CoinIndexedVector array; // make sure large enough work.reserve(numberRows); array.reserve(numberRows); int * arrayRows = array.getIndices(); double * arrayElements = array.denseVector(); // End of code to create work arrays (B) ==== int numberAdded=0; // we also need somewhere to accumulate cut CoinIndexedVector cutVector; cutVector.reserve(numberColumns+1); int * cutIndex = cutVector.getIndices(); double * cutElement = cutVector.denseVector(); // and for packed form (as not necessarily in order) // also space for sort bool doSorted = (infoOptions&256)!=0; int lengthArray = static_cast(numberColumns+1+((numberColumns+1)*sizeof(int))/sizeof(double)); if (doSorted) lengthArray+=numberColumns; double * packed = new double[lengthArray]; double * sort = packed+numberColumns+1; int * which = reinterpret_cast(doSorted ? (sort+numberColumns): (sort)); double tolerance1=1.0e-6; double tolerance2=0.9; double tolerance3=1.0e-4; double tolerance6=1.0e-6; double tolerance9=1.0e-4; #define MORE_GOMORY_CUTS 1 #ifdef CLP_INVESTIGATE2 int saveLimit = info.inTree ? 50 : 1000; #else #if MORE_GOMORY_CUTS==2||MORE_GOMORY_CUTS==3 int saveLimit; #endif #endif // get limit on length of cut int limit = 0; if (!limit_) dynamicLimitInTree_ = CoinMax(50,numberColumns/40); if (!info.inTree) { limit = limitAtRoot_; if (!info.pass) { tolerance1=1.0; tolerance2=1.0e-2; tolerance3=1.0e-6; tolerance6=1.0e-7; tolerance9=1.0e-5; if (!limit) limit=numberColumns; } else { if((infoOptions&32)==0/*&&numberTimesStalled_<3*/) { if (!limit) { if(numberElements>8*numberColumns) limit=numberColumns; else limit = CoinMax(1000,numberRows/4); } } else { limit=numberColumns; numberTimesStalled_++; } } } else { limit = limit_; if (!limit) { if (!info.pass) limit = dynamicLimitInTree_; else limit=50; } } // If big - allow for rows if (limit>=numberColumns) limit += numberRows; #ifdef CLP_INVESTIGATE2 if (limit>saveLimit&&!info.inTree&&(infoOptions&512)==0) printf("Gomory limit changed from %d to %d, inTree %c, pass %d, r %d,c %d,e %d\n", saveLimit,limit,info.inTree ? 'Y' : 'N',info.pass, numberRows,numberColumns,numberElements); #endif int nCandidates=0; for (iColumn=0;iColumn=0&&intVar[iColumn]) { double reducedValue=above_integer(colsol[iColumn]); //printf("col %d bas %d val %.18g\n",iColumn,iBasic,colsol[iColumn]); if(intVar[iColumn]&&reducedValue<1.0-away&&reducedValue>away) { if (doSorted) sort[nCandidates]=fabs(0.5-reducedValue); which[nCandidates++]=iColumn; } } } int nTotalEls=COIN_INT_MAX; if (doSorted) { CoinSort_2(sort,sort+nCandidates,which); int nElsNow = columnCopy.getNumElements(); int nAdd; int nAdd2; int nReasonable; int depth=info.level; if (depth<2) { nAdd=10000; if (info.pass>0) nAdd = CoinMin(nAdd,nElsNow+2*numberRows); nAdd2 = 5*numberColumns; nReasonable = CoinMax(nAdd2,nElsNow/8+nAdd); if (!depth&&!info.pass) { // allow more nAdd += nElsNow/2; nAdd2 += nElsNow/2; nReasonable += nElsNow/2; limit=numberRows+numberColumns; } } else { nAdd = 200; nAdd2 = 2*numberColumns; nReasonable = CoinMax(nAdd2,nElsNow/8+nAdd); } nTotalEls=nReasonable; } #ifdef MORE_GOMORY_CUTS int saveTotalEls=nTotalEls; #endif #if MORE_GOMORY_CUTS==2||MORE_GOMORY_CUTS==3 saveLimit=limit; if (doSorted) limit=numberRows+numberColumns; OsiCuts longCuts; #endif #if MORE_GOMORY_CUTS==1||MORE_GOMORY_CUTS==3 OsiCuts secondaryCuts; #endif for (int kColumn=0;kColumn=0) { // Debug code below computes tableau column of basic ==== int j; #ifdef CGL_DEBUG { // put column into array array.setVector(columnLength[iColumn],row+columnStart[iColumn], columnElements+columnStart[iColumn]); // get column in tableau #ifdef CLP_OSL if (!alternateFactorization_) #endif factorization.updateColumn ( &work, &array ); #ifdef CLP_OSL else factorization2->updateColumn ( &work, &array ); #endif int nn=0; int numberInArray=array.getNumElements(); for (j=0;j1.0e-5) { assert (fabs(value-1.0)<1.0e-7); assert (indexValue==iBasic); nn++; } } assert (nn==1); array.clear(); //work.checkClear(); } #endif array.clear(); assert(intVar[iColumn]&&reducedValue<1.0-away&&reducedValue>away); { #ifdef CGL_DEBUG //cutVector.checkClear(); #endif // get row of tableau double one =1.0; array.setVector(1,&iBasic,&one); int numberNonInteger=0; //Code below computes tableau row ==== // get pi #ifdef CLP_OSL if (!alternateFactorization_) #endif factorization.updateColumnTranspose ( &work, &array ); #ifdef CLP_OSL else factorization2->updateColumnTranspose ( &work, &array ); #endif int numberInArray=array.getNumElements(); #ifdef CGL_DEBUG // check pivot on iColumn { double value=0.0; int k; // add in row of tableau for (k=columnStart[iColumn]; kcolLower[j]+testFixed) { double value=0.0; int k; // add in row of tableau for (k=columnStart[j];k1 if (iColumn==52) printf("for basic %d, column %d has alpha %g, colsol %g\n", iColumn,j,value,colsol[j]); #endif // deal with bounds if (swap[j]) { //reducedValue -= value*colUpper[j]; // negate value = - value; } else { //reducedValue -= value*colLower[j]; } #if CGL_DEBUG>1 if (iColumn==52) printf("%d value %g reduced %g int %d rhs %g swap %d\n", j,value,reducedValue,intVar[j],rhs,swap[j]); #endif double coefficient; if (intVar[j]) { // integer coefficient = above_integer(value); if (coefficient > reducedValue) { coefficient = ratio * (1.0-coefficient); } } else { // continuous numberNonInteger++; if (value > 0.0) { coefficient = value; } else { //??? sign wrong in book coefficient = -ratio*value; } } if (swap[j]) { // negate coefficient = - coefficient; rhs += colUpper[j]*coefficient; } else { rhs += colLower[j]*coefficient; } if (fabs(coefficient)>= COIN_INDEXED_TINY_ELEMENT) { cutElement[j] = coefficient; numberCoefficients++; cutIndex[number++]=j; // If too many - break from loop if (number>limit) break; } } } else { // basic continue; } } cutVector.setNumElements(number); // If too many - just clear vector and skip if (number>limit) { cutVector.clear(); continue; } //check will be cut //reducedValue=above_integer(reducedValue); rhs += reducedValue; double violation = reducedValue; #ifdef CGL_DEBUG std::cout<<"cut has violation of "<=1.0e-16) { if ((type&1)==0) { // negate to get correct coefficient value = - value; } double coefficient; if ((type&4)!=0) { // integer coefficient = above_integer(value); if (coefficient > reducedValue) { coefficient = ratio * (1.0-coefficient); } } else { numberNonInteger++; // continuous if (value > 0.0) { coefficient = value; } else { coefficient = -ratio*value; } } if ((type&1)!=0) { // slack at ub - treat as +1.0 rhs -= coefficient*rowUpper[iRow]; } else { // negate yet again ? coefficient = - coefficient; rhs -= coefficient*rowLower[iRow]; } int k; for (k=rowStart[iRow]; klimit) { cutVector.clear(); continue; } #if MORE_GOMORY_CUTS==1||MORE_GOMORY_CUTS==3 double violation2=violation; #endif number=0; numberNonInteger=0; double sumCoefficients=0.0; for (j=0;j10.0) sumCoefficients += 2.0*fabs(value); cutElement[jColumn]=0.0; if (fabs(value)>1.0e-8) { sum+=value*colsol[jColumn]; packed[number]=value; cutIndex[number++]=jColumn; if (!intVar[jColumn]) numberNonInteger++; } else { #define LARGE_BOUND 1.0e20 // small - adjust rhs if rhs reasonable if (value>0.0&&colLower[jColumn]>-LARGE_BOUND) { rhs -= value*colLower[jColumn]; #if MORE_GOMORY_CUTS==1||MORE_GOMORY_CUTS==3 // weaken violation violation2 -= fabs(value*(colsol[jColumn]-colLower[jColumn])); #endif } else if (value<0.0&&colUpper[jColumn]1.0e-13) { // take anyway sum+=value*colsol[jColumn]; packed[number]=value; cutIndex[number++]=jColumn; if (!intVar[jColumn]) numberNonInteger++; } } } // Final test on number //if (number>limit) //continue; // say zeroed out cutVector.setNumElements(0); bool accurate2=false; double difference=fabs((sum-rhs)-violation); double useTolerance; if (tolerance1>0.99) { // use absolute useTolerance = tolerance; } else { double rhs2=CoinMax(fabs(rhs),10.0); useTolerance=rhs2*0.1*tolerance1; } bool accurate = (differencerhs+tolerance2*away&& (accurate||accurate2)) { //#ifdef CGL_DEBUG #ifdef CGL_DEBUG #if CGL_DEBUG<=1 if (number<=-10) { #endif for (j=0;j %g \n",value,dxInt); #endif if (dxInt>1.0e9||fabs(dxInt-xInt[j])> 1.0e-8) { nOverflow++; break; } } if (nOverflow){ #ifdef CGL_DEBUG printf("Gomory Scaling: Warning: Overflow detected \n"); #endif numberNonInteger=-1; } else { // find greatest common divisor of the elements j=0; while (!xInt[j]) j++; // skip zeros int thisGcd = gcd(xInt[j],xInt[j+1]); j++; for (;j0.0) newOne=xInt[j]/thisGcd; else newOne=-xInt[j]/thisGcd; if (fabs(((double) newOne)-old)> 1.0e-10*(fabs(newOne)+1.0)) { // say no good - first see if happens printf("Fix this test 456 - just skip\n"); abort(); } } #endif #if CGL_DEBUG>1 printf("The gcd of xInt is %i\n",thisGcd); #endif // construct new cut by dividing through by gcd and double minMultiplier=1.0e100; double maxMultiplier=0.0; for (j=0; j0.0) { packed[j]=xInt[j]/thisGcd; } else { packed[j]=-xInt[j]/thisGcd; } #if CGL_DEBUG>1 printf("%g => %g \n",old,packed[j]); #endif if (packed[j]) { if (fabs(packed[j])>maxMultiplier*fabs(old)) maxMultiplier = packed[j]/old; if (fabs(packed[j])0.9999&&maxMultiplier/minMultiplier<1.0001); } } // erase cutElement CoinFillN(cutElement,number+1,0.0); } else { // relax rhs a tiny bit //#define CGL_GOMORY_OLD_RELAX #ifndef CGL_GOMORY_OLD_RELAX #if 0 double rhs2=rhs; rhs2 += 1.0e-8; // relax if lots of elements for mixed gomory if (number>=20) { rhs2 += 1.0e-7*(static_cast (number/20)); } #endif rhs += 1.0e-7; if (numberCoefficients>=10||true) { rhs += 1.0e-7*sumCoefficients+1.0e-8*numberCoefficients; } #if 0 if (numberCoefficients>number*3) printf("old rhs %.18g new %.18g - n,nNon,nC,sumC %d,%d,%d %g\n", rhs2,rhs,number,numberNonInteger,numberCoefficients, sumCoefficients); #endif #else rhs += 1.0e-8; // relax if lots of elements for mixed gomory if (number>=20) { rhs += 1.0e-7*(static_cast (number/20)); } #endif } // Take off tiny elements // for first pass reject #ifndef CGL_GOMORY_TINY_ELEMENT #define CGL_GOMORY_TINY_ELEMENT 1.0e-12 #endif { int i,number2=number; number=0; double largest=0.0; double smallest=1.0e30; for (i=0;i0.0) rhs -= value*colLower[iColumn]; else rhs += value*colUpper[iColumn]; } else { // throw away number=limit+1; numberNonInteger=1; break; } } else { int iColumn = cutIndex[i]; if (colUpper[iColumn]!=colLower[iColumn]||globalCuts) { value=fabs(value); largest=CoinMax(largest,value); smallest=CoinMin(smallest,value); cutIndex[number]=cutIndex[i]; packed[number++]=packed[i]; } else { // fixed so subtract out rhs -= packed[i]*colLower[iColumn]; if (intVar[iColumn]) numberNonInteger--; } } } if (largest>1.0e10*smallest||(number>20&&smallest1.0e9*smallest) { #ifdef CLP_INVESTIGATE2 printf("WOuld reject %g %g ratio %g\n",smallest,largest, smallest/largest); #endif #if MORE_GOMORY_CUTS==1||MORE_GOMORY_CUTS==3 accurate=false; #endif } else { #define TRY7 2 #define PRINT_NUMBER 0 #if PRINT_NUMBER if (number==PRINT_NUMBER) { printf("==========\n<= %.18g ",rhs); for (int i=0;ilimit) continue; #if TRY7==1 // Just scale double multiplier = 1.0/sqrt(largest*smallest); for (int i=0;i= 1.0) { int iColumn=cutIndex[i]; if (intVar[iColumn]) { if (colLower[iColumn]>=0.0) { if (value>0.0) { // better if smaller if (ratio>nearest) { packed[i]=scaleFactor/nearest; } } else { // better if larger if (ratio50&&numberNonInteger) bounds[1] = rhs+tolerance6+1.0e-8*fabs(rhs); // weaken #if GOMORY_RELAX_NUMBER else if (number>GOMORY_RELAX_NUMBER&&numberNonInteger>1) bounds[1] = rhs+tolerance6+1.0e-8*fabs(rhs); // weaken #endif // if close to integer - round up double nearest=floor(bounds[1]+0.5); if (bounds[1]nearest-1.0e-4) bounds[1]=nearest; double test = CoinMin(largestFactor*largestFactorMultiplier_, relaxation); if (number>5&&numberNonInteger&&test>1.0e-20) { #ifdef CLP_INVESTIGATE2 printf("relaxing rhs by %g - largestFactor was %g, rel %g\n", CoinMin(test*fabs(rhs),tolerance9),largestFactor,relaxation); #endif //bounds[1] = CoinMax(bounds[1], // rhs+CoinMin(test*fabs(rhs),tolerance9)); // weaken bounds[1] = bounds[1]+CoinMin(test*fabs(rhs),tolerance9); // weaken } #ifdef MORE_GOMORY_CUTS if (accurate) { #else { #endif // tidy if (!cleanedCut) { double range=0.0; for (int k=0;k1.0e-6) { close=false; break; } } if (close) { #ifdef PRINT_MORE bool printIt=false; for (int k=0;k1.0e-12) { printIt=true; break; } } if (printIt) { printf("yy %.18g >= ",bounds[1]); for (int k=0;kinvalidCut(rc)); if(debugger->invalidCut(rc)) abort(); } #endif #if MORE_GOMORY_CUTS<2 nTotalEls -= number; cs.insert(rc); #else if(number1 { // put column into array array.setVector(columnLength[iColumn],row+columnStart[iColumn], columnElements+columnStart[iColumn]); // get column in tableau #ifdef CLP_OSL if (!alternateFactorization_) #endif factorization.updateColumn ( &work, &array ); #ifdef CLP_OSL else factorization2->updateColumn ( &work, &array ); #endif int numberInArray=array.getNumElements(); printf("non-basic %d\n",iColumn); for (int j=0;j1.0e-6) { printf("%d %g\n",indexValue,value); } } } #endif } } #ifdef CLP_OSL delete factorization2; #endif delete [] rowActivity; delete [] swap; delete [] rowType; delete [] packed; delete [] rowIsBasic; delete [] columnIsBasic; #ifdef MORE_GOMORY_CUTS #if MORE_GOMORY_CUTS==1 int numberInaccurate = secondaryCuts.sizeRowCuts(); #ifdef CLP_INVESTIGATE2 int numberOrdinary = numberAdded-numberInaccurate; if (!info.inTree&&(infoOptions&512)==0) printf("Gomory has %d ordinary and %d less accurate cuts(%d els)\n", numberOrdinary,numberInaccurate,saveTotalEls-nTotalEls); #endif #elif MORE_GOMORY_CUTS==2 int numberLong = longCuts.sizeRowCuts(); #ifdef CLP_INVESTIGATE2 int numberOrdinary = numberAdded-numberLong; if (!info.inTree&&(infoOptions&512)==0) printf("Gomory has %d ordinary and %d long cuts(%d els)\n", numberOrdinary,numberLong,saveTotalEls-nTotalEls); #endif #elif MORE_GOMORY_CUTS==3 int numberLong = longCuts.sizeRowCuts(); int numberInaccurate = secondaryCuts.sizeRowCuts(); #ifdef CLP_INVESTIGATE2 int numberOrdinary = numberAdded-numberLong-numberInaccurate; if (!info.inTree&&(infoOptions&512)==0) printf("Gomory has %d ordinary, %d long and %d less accurate cuts(%d els)\n", numberOrdinary,numberLong,numberInaccurate,saveTotalEls-nTotalEls); #endif #endif if (doSorted&&limit0) { for (int i=0;irow().getNumElements(); cs.insert(longCuts.rowCut(i)); numberAdded ++; if (nTotalEls<=0) break; } break; } #endif #if MORE_GOMORY_CUTS==1||MORE_GOMORY_CUTS==3 while (nTotalEls>0) { for (int i=0;irow().getNumElements(); cs.insert(secondaryCuts.rowCut(i)); numberAdded ++; if (nTotalEls<=0) break; } break; } #endif } #else #ifdef CLP_INVESTIGATE2 if (!info.inTree&&(infoOptions&512)==0) printf("Gomory added %d cuts(%d els)\n",numberAdded,saveTotalEls-nTotalEls); #endif #endif return numberAdded; } // Limit stuff void CglGomory::setLimit(int limit) { if (limit>=0) limit_=limit; } int CglGomory::getLimit() const { return limit_; } // Limit stuff at root void CglGomory::setLimitAtRoot(int limit) { if (limit>=0) limitAtRoot_=limit; } int CglGomory::getLimitAtRoot() const { return limitAtRoot_; } // Return maximum length of cut in tree int CglGomory::maximumLengthOfCutInTree() const { if (limit_) return limit_; else return dynamicLimitInTree_; } // Away stuff void CglGomory::setAway(double value) { if (value>0.0&&value<=0.5) away_=value; } double CglGomory::getAway() const { return away_; } // Away stuff at root void CglGomory::setAwayAtRoot(double value) { if (value>0.0&&value<=0.5) awayAtRoot_=value; } double CglGomory::getAwayAtRoot() const { return awayAtRoot_; } // ConditionNumberMultiplier stuff void CglGomory::setConditionNumberMultiplier(double value) { if (value>=0.0) conditionNumberMultiplier_=value; } double CglGomory::getConditionNumberMultiplier() const { return conditionNumberMultiplier_; } // LargestFactorMultiplier stuff void CglGomory::setLargestFactorMultiplier(double value) { if (value>=0.0) largestFactorMultiplier_=value; } double CglGomory::getLargestFactorMultiplier() const { return largestFactorMultiplier_; } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglGomory::CglGomory () : CglCutGenerator(), away_(0.05), awayAtRoot_(0.05), conditionNumberMultiplier_(1.0e-18), largestFactorMultiplier_(1.0e-13), originalSolver_(NULL), limit_(50), limitAtRoot_(0), dynamicLimitInTree_(-1), alternateFactorization_(0), gomoryType_(0) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglGomory::CglGomory (const CglGomory & source) : CglCutGenerator(source), away_(source.away_), awayAtRoot_(source.awayAtRoot_), conditionNumberMultiplier_(source.conditionNumberMultiplier_), largestFactorMultiplier_(source.largestFactorMultiplier_), originalSolver_(NULL), limit_(source.limit_), limitAtRoot_(source.limitAtRoot_), dynamicLimitInTree_(source.dynamicLimitInTree_), alternateFactorization_(source.alternateFactorization_), gomoryType_(source.gomoryType_) { if (source.originalSolver_) originalSolver_ = source.originalSolver_->clone(); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglGomory::clone() const { return new CglGomory(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglGomory::~CglGomory () { delete originalSolver_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglGomory & CglGomory::operator=(const CglGomory& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); away_=rhs.away_; awayAtRoot_=rhs.awayAtRoot_; conditionNumberMultiplier_ = rhs.conditionNumberMultiplier_; largestFactorMultiplier_ = rhs.largestFactorMultiplier_; limit_=rhs.limit_; limitAtRoot_=rhs.limitAtRoot_; dynamicLimitInTree_ = rhs.dynamicLimitInTree_; alternateFactorization_=rhs.alternateFactorization_; gomoryType_ = rhs.gomoryType_; delete originalSolver_; if (rhs.originalSolver_) originalSolver_ = rhs.originalSolver_->clone(); else originalSolver_=NULL; } return *this; } // This can be used to refresh any information void CglGomory::refreshSolver(OsiSolverInterface * solver) { int numberColumns=solver->getNumCols(); const double * colUpper = solver->getColUpper(); const double * colLower = solver->getColLower(); canDoGlobalCuts_ = true; if (originalSolver_) { delete originalSolver_; originalSolver_ = solver->clone(); } for (int i=0;iisInteger(i)) { if (colUpper[i]>colLower[i]+1.0) { canDoGlobalCuts_ = false; break; } } } } // Pass in a copy of original solver (clone it) void CglGomory::passInOriginalSolver(OsiSolverInterface * solver) { delete originalSolver_; if (solver) { if (!gomoryType_) gomoryType_=1; originalSolver_ = solver->clone(); } else { gomoryType_=0; originalSolver_=NULL; } } // Does actual work - returns number of cuts int CglGomory::generateCuts( const OsiRowCutDebugger * debugger, OsiCuts & cs, const CoinPackedMatrix & columnCopy, const double * colsol, const double * colLower, const double * colUpper, const double * rowLower, const double * rowUpper, const char * intVar, const CoinWarmStartBasis* warm, const CglTreeInfo info) { CoinPackedMatrix rowCopy; rowCopy.reverseOrderedCopyOf(columnCopy); return generateCuts( debugger, cs, columnCopy, rowCopy, colsol, colLower, colUpper, rowLower, rowUpper, intVar, warm, info); } // Create C++ lines to get to current state std::string CglGomory::generateCpp( FILE * fp) { CglGomory other; fprintf(fp,"0#include \"CglGomory.hpp\"\n"); fprintf(fp,"3 CglGomory gomory;\n"); if (limit_!=other.limit_) fprintf(fp,"3 gomory.setLimit(%d);\n",limit_); else fprintf(fp,"4 gomory.setLimit(%d);\n",limit_); if (limitAtRoot_!=other.limitAtRoot_) fprintf(fp,"3 gomory.setLimitAtRoot(%d);\n",limitAtRoot_); else fprintf(fp,"4 gomory.setLimitAtRoot(%d);\n",limitAtRoot_); if (away_!=other.away_) fprintf(fp,"3 gomory.setAway(%g);\n",away_); else fprintf(fp,"4 gomory.setAway(%g);\n",away_); if (awayAtRoot_!=other.awayAtRoot_) fprintf(fp,"3 gomory.setAwayAtRoot(%g);\n",awayAtRoot_); else fprintf(fp,"4 gomory.setAwayAtRoot(%g);\n",awayAtRoot_); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 gomory.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 gomory.setAggressiveness(%d);\n",getAggressiveness()); return "gomory"; } CoinMP-1.8.3/Cgl/src/CglGomory/CglGomory.hpp0000644000175000017500000001442612130102162017120 0ustar renerene// Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglGomory_H #define CglGomory_H #include #include "CglCutGenerator.hpp" class CoinWarmStartBasis; /** Gomory Cut Generator Class */ class CglGomory : public CglCutGenerator { friend void CglGomoryUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /**@name Generate Cuts */ //@{ /** Generate Mixed Integer Gomory cuts for the model of the solver interface, si. Insert the generated cuts into OsiCut, cs. There is a limit option, which will only generate cuts with less than this number of entries. We can also only look at 0-1 variables a certain distance from integer. */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /** Generates cuts given matrix and solution etc, returns number of cuts generated */ int generateCuts( const OsiRowCutDebugger * debugger, OsiCuts & cs, const CoinPackedMatrix & columnCopy, const CoinPackedMatrix & rowCopy, const double * colsol, const double * colLower, const double * colUpper, const double * rowLower, const double * rowUpper, const char * intVar , const CoinWarmStartBasis* warm, const CglTreeInfo info = CglTreeInfo()); /** Generates cuts given matrix and solution etc, returns number of cuts generated (no row copy passed in) */ int generateCuts( const OsiRowCutDebugger * debugger, OsiCuts & cs, const CoinPackedMatrix & columnCopy, const double * colsol, const double * colLower, const double * colUpper, const double * rowLower, const double * rowUpper, const char * intVar , const CoinWarmStartBasis* warm, const CglTreeInfo info = CglTreeInfo()); /// Return true if needs optimal basis to do cuts (will return true) virtual bool needsOptimalBasis() const { return true; } //@} /**@name Change way Gomory works */ //@{ /// Pass in a copy of original solver (clone it) void passInOriginalSolver(OsiSolverInterface * solver); /// Returns original solver inline OsiSolverInterface * originalSolver() const { return originalSolver_;} /// Set type - 0 normal, 1 add original matrix one, 2 replace inline void setGomoryType(int type) { gomoryType_=type;} /// Return type inline int gomoryType() const { return gomoryType_;} //@} /**@name Change limit on how many variables in cut (default 50) */ //@{ /// Set void setLimit(int limit); /// Get int getLimit() const; /// Set at root (if #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CoinPackedMatrix.hpp" #include "OsiCuts.hpp" #include "CoinWarmStartBasis.hpp" #include "CglGomory.hpp" //-------------------------------------------------------------------------- // ** At present this does not use any solver void CglGomoryUnitTest( const OsiSolverInterface * baseSiP, const std::string mpsDir ) { CoinRelFltEq eq(0.000001); // Test default constructor { CglGomory aGenerator; assert (aGenerator.getLimit()==50); assert (aGenerator.getAway()==0.05); } // Test copy & assignment etc { CglGomory rhs; { CglGomory bGenerator; bGenerator.setLimit(99); bGenerator.setAway(0.2); CglGomory cGenerator(bGenerator); rhs=bGenerator; assert (rhs.getLimit()==99); assert (rhs.getAway()==0.2); } } // Test explicit form - all integer (pg 125 Wolsey) if (1) { OsiCuts osicuts; CglGomory test1; int i; int nOldCuts=0,nRowCuts; // matrix data //deliberate hiccup of 2 between 0 and 1 CoinBigIndex start[5]={0,4,7,8,9}; int length[5]={2,3,1,1,1}; int rows[11]={0,2,-1,-1,0,1,2,0,1,2}; double elements[11]={7.0,2.0,1.0e10,1.0e10,-2.0,1.0,-2.0,1,1,1}; CoinPackedMatrix matrix(true,3,5,8,elements,rows,start,length); // rim data (objective not used just yet) double rowLower[5]={14.0,3.0,3.0,1.0e10,1.0e10}; double rowUpper[5]={14.0,3.0,3.0,-1.0e10,-1.0e10}; double colLower[7]={0.0,0.0,0.0,0.0,0.0,0.0,0.0}; double colUpper[7]={100.0,100.0,100.0,100.0,100.0,100.0,100.0}; // integer char intVar[7]={2,2,2,2,2,2,2}; // basis 1 int rowBasis1[3]={-1,-1,-1}; int colBasis1[5]={1,1,-1,-1,1}; CoinWarmStartBasis warm; warm.setSize(5,3); for (i=0;i<3;i++) { if (rowBasis1[i]<0) { warm.setArtifStatus(i,CoinWarmStartBasis::atLowerBound); } else { warm.setArtifStatus(i,CoinWarmStartBasis::basic); } } for (i=0;i<5;i++) { if (colBasis1[i]<0) { warm.setStructStatus(i,CoinWarmStartBasis::atLowerBound); } else { warm.setStructStatus(i,CoinWarmStartBasis::basic); } } // solution 1 double colsol1[5]={20.0/7.0,3.0,0.0,0.0,23.0/7.0}; test1.generateCuts(NULL, osicuts, matrix, /*objective,*/ colsol1, colLower, colUpper, rowLower, rowUpper, intVar, &warm); nRowCuts = osicuts.sizeRowCuts(); std::cout<<"There are "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout<<"Cut "<clone(); std::string fn(mpsDir+"p0033"); siP->readMps(fn.c_str(),"mps"); siP->activateRowCutDebugger("p0033"); CglGomory test; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); std::cout<<"Initial LP value: "<setColSolution(mycs); ****/ OsiCuts cuts; // Test generateCuts method test.generateCuts(*siP,cuts); int nRowCuts = cuts.sizeRowCuts(); std::cout<<"There are "< 0); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); std::cout<<"LP value with cuts: "< 2545.0 ); assert( lpRelaxBefore < lpRelaxAfter ); assert(lpRelaxAfter < 3089.1); delete siP; } } CoinMP-1.8.3/Cgl/src/CglKnapsackCover/0000755000175000017500000000000012600453456015775 5ustar renereneCoinMP-1.8.3/Cgl/src/CglKnapsackCover/Makefile.in0000644000175000017500000005460712506321416020051 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglKnapsackCover DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglKnapsackCover_la_LIBADD = am_libCglKnapsackCover_la_OBJECTS = CglKnapsackCover.lo \ CglKnapsackCoverTest.lo libCglKnapsackCover_la_OBJECTS = $(am_libCglKnapsackCover_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglKnapsackCover_la_SOURCES) DIST_SOURCES = $(libCglKnapsackCover_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglKnapsackCover # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglKnapsackCover.la # List all source files for this library, including headers libCglKnapsackCover_la_SOURCES = CglKnapsackCover.cpp CglKnapsackCover.hpp CglKnapsackCoverTest.cpp # This is for libtool (on Windows) libCglKnapsackCover_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglKnapsackCover.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglKnapsackCover/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglKnapsackCover/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglKnapsackCover.la: $(libCglKnapsackCover_la_OBJECTS) $(libCglKnapsackCover_la_DEPENDENCIES) $(CXXLINK) $(libCglKnapsackCover_la_LDFLAGS) $(libCglKnapsackCover_la_OBJECTS) $(libCglKnapsackCover_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglKnapsackCover.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglKnapsackCoverTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglKnapsackCover/Makefile.am0000644000175000017500000000325711621724114020032 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglKnapsackCover # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglKnapsackCover.la # List all source files for this library, including headers libCglKnapsackCover_la_SOURCES = CglKnapsackCover.cpp CglKnapsackCover.hpp CglKnapsackCoverTest.cpp # This is for libtool (on Windows) libCglKnapsackCover_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglKnapsackCover.hpp CoinMP-1.8.3/Cgl/src/CglKnapsackCover/CglKnapsackCover.hpp0000644000175000017500000002202412306400264021656 0ustar renerene// $Id: CglKnapsackCover.hpp 1201 2014-03-07 17:24:04Z forrest $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglKnapsackCover_H #define CglKnapsackCover_H #include #include "CglCutGenerator.hpp" #include "CglTreeInfo.hpp" /** Knapsack Cover Cut Generator Class */ class CglKnapsackCover : public CglCutGenerator { friend void CglKnapsackCoverUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /** A method to set which rows should be tested for knapsack covers */ void setTestedRowIndices(int num, const int* ind); /**@name Generate Cuts */ //@{ /** Generate knapsack cover cuts for the model of the solver interface, si. Insert the generated cuts into OsiCut, cs. */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglKnapsackCover (); /// Copy constructor CglKnapsackCover ( const CglKnapsackCover &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglKnapsackCover & operator=( const CglKnapsackCover& rhs); /// Destructor virtual ~CglKnapsackCover (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); /// This can be used to refresh any information virtual void refreshSolver(OsiSolverInterface * solver); //@} /**@name Sets and gets */ //@{ /// Set limit on number in knapsack inline void setMaxInKnapsack(int value) { if (value>0) maxInKnapsack_ = value;} /// get limit on number in knapsack inline int getMaxInKnapsack() const {return maxInKnapsack_;} /// Switch off expensive cuts inline void switchOffExpensive() { expensiveCuts_=false;} /// Switch on expensive cuts inline void switchOnExpensive() { expensiveCuts_=true;} private: // Private member methods /**@name Private methods */ //@{ /** deriveAKnapsack returns 1 if it is able to derive a (canonical) knapsack inequality in binary variables of the form ax<=b from the rowIndex-th row in the model, returns 0 otherwise. */ int deriveAKnapsack( const OsiSolverInterface & si, OsiCuts & cs, CoinPackedVector & krow, bool treatAsLRow, double & b, int * complement, double * xstar, int rowIndex, int numberElements, const int * index, const double * element); int deriveAKnapsack( const OsiSolverInterface & si, OsiCuts & cs, CoinPackedVector & krow, double & b, int * complement, double * xstar, int rowIndex, const CoinPackedVectorBase & matrixRow); /** Find a violated minimal cover from a canonical form knapsack inequality by solving the -most- violated cover problem and postprocess to ensure minimality */ int findExactMostViolatedMinCover( int nCols, int row, CoinPackedVector & krow, double b, double * xstar, CoinPackedVector & cover, CoinPackedVector & remainder); /** Find the most violate minimum cover by solving the lp-relaxation of the most-violate-min-cover problem */ int findLPMostViolatedMinCover( int nCols, int row, CoinPackedVector & krow, double & b, double * xstar, CoinPackedVector & cover, CoinPackedVector & remainder); /// find a minimum cover by a simple greedy approach int findGreedyCover( int row, CoinPackedVector & krow, double & b, double * xstar, CoinPackedVector & cover, CoinPackedVector & remainder ); /// lift the cover inequality int liftCoverCut( double & b, int nRowElem, CoinPackedVector & cover, CoinPackedVector & remainder, CoinPackedVector & cut ); /// sequence-independent lift and uncomplement and add the resulting cut to the cut set int liftAndUncomplementAndAdd( double rowub, CoinPackedVector & krow, double & b, int * complement, int row, CoinPackedVector & cover, CoinPackedVector & remainder, OsiCuts & cs ); /// sequence-dependent lift, uncomplement and add the resulting cut to the cut set void seqLiftAndUncomplementAndAdd( int nCols, double * xstar, int * complement, int row, int nRowElem, double & b, CoinPackedVector & cover, // need not be violated CoinPackedVector & remainder, OsiCuts & cs ); /// sequence-dependent lift binary variables either up or down, uncomplement and add to the cut set void liftUpDownAndUncomplementAndAdd( int nCols, double * xstar, int * complement, int row, int nRowElem, double & b, // the following 3 packed vectors partition the krow: CoinPackedVector & fracCover, // vars have frac soln values in lp relaxation // and form cover with the vars atOne CoinPackedVector & atOne, // vars have soln value of 1 in lp relaxation // and together with fracCover form minimal (?) cover. CoinPackedVector & remainder, OsiCuts & cs ); /// find a cover using a variation of the logic found in OSL (w/o SOS) int findPseudoJohnAndEllisCover ( int row, CoinPackedVector & krow, double & b, double * xstar, CoinPackedVector & cover, CoinPackedVector & remainder); /// find a cover using the basic logic found in OSL (w/o SOS) int findJohnAndEllisCover ( int row, CoinPackedVector & krow, double & b, double * xstar, CoinPackedVector & fracCover, CoinPackedVector & atOnes, CoinPackedVector & remainder); /** A C-style implementation of the Horowitz-Sahni exact solution procedure for solving knapsack problem. (ToDo: implement the more efficient dynamic programming approach) (Reference: Martello and Toth, Knapsack Problems, Wiley, 1990, p30.) */ int exactSolveKnapsack( int n, double c, double const *pp, double const *ww, double & z, int * x); /// For testing gub stuff int gubifyCut(CoinPackedVector & cut); public: /** Creates cliques for use by probing. Only cliques >= minimumSize and < maximumSize created Can also try and extend cliques as a result of probing (root node). Returns number of cliques found. */ int createCliques( OsiSolverInterface & si, int minimumSize=2, int maximumSize=100, bool extendCliques=false); private: /// Delete all clique information void deleteCliques(); //@} // Private member data /**@name Private member data */ //@{ /// epsilon double epsilon_; /// Tolerance to use for violation - bigger than epsilon_ double epsilon2_; /// 1-epsilon double onetol_; /// Maximum in knapsack int maxInKnapsack_; /** which rows to look at. If specified, only these rows will be considered for generating knapsack covers. Otherwise all rows will be tried */ int numRowsToCheck_; int* rowsToCheck_; /// exactKnapsack can be expensive - this switches off some bool expensiveCuts_; /// Cliques /// **** TEMP so can reference from listing const OsiSolverInterface * solver_; int whichRow_; int * complement_; double * elements_; /// Number of cliques int numberCliques_; /// Clique type typedef struct { unsigned int equality:1; // nonzero if clique is == } CliqueType; CliqueType * cliqueType_; /// Start of each clique int * cliqueStart_; /// Entries for clique CliqueEntry * cliqueEntry_; /** Start of oneFixes cliques for a column in matrix or -1 if not in any clique */ int * oneFixStart_; /** Start of zeroFixes cliques for a column in matrix or -1 if not in any clique */ int * zeroFixStart_; /// End of fixes for a column int * endFixStart_; /// Clique numbers for one or zero fixes int * whichClique_; /// Number of columns int numberColumns_; /** For each column with nonzero in row copy this gives a clique "number". So first clique mentioned in row is always 0. If no entries for row then no cliques. If sequence > numberColumns then not in clique. */ //CliqueEntry * cliqueRow_; /// cliqueRow_ starts for each row //int * cliqueRowStart_; //@} }; //############################################################################# /** A function that tests the methods in the CglKnapsackCover class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglKnapsackCoverUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); #endif CoinMP-1.8.3/Cgl/src/CglKnapsackCover/CglKnapsackCover.cpp0000644000175000017500000037252512470340254021673 0ustar renerene// $Id: CglKnapsackCover.cpp 1262 2015-02-16 10:04:28Z forrest $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CglKnapsackCover.hpp" #include "CoinPackedVector.hpp" #include "CoinSort.hpp" #include "CoinPackedMatrix.hpp" #include "OsiRowCutDebugger.hpp" #define GUBCOVER 1 //#define PRINT_DEBUG //#define CGL_DEBUG 1 //----------------------------------------------------------------------------- // Generate knapsack cover cuts //------------------------------------------------------------------- void CglKnapsackCover::generateCuts(const OsiSolverInterface& si, OsiCuts& cs, const CglTreeInfo info) { // Get basic problem information int nRows=si.getNumRows(); int nCols=si.getNumCols(); // Create working space for "canonical" knapsack inequality // - krow will contain the coefficients and indices of the // (potentially complemented) variables in the knapsack inequality. // - b is the rhs of knapsack inequality. // - complement[i] is 1 if the index i in krow refers to the complement // of the variable, and 0 otherwise. CoinPackedVector krow; double b=0.0; int numberRowCutsBefore = cs.sizeRowCuts(); int * complement= new int[nCols]; complement_ = complement; #if GUBCOVER==1 elements_=new double [2*nCols]; CoinZeroN(elements_,2*nCols); #elif GUBCOVER==2 int size1=4*nCols+2*numberCliques_; int size2=2*nCols+5*numberCliques_+5; elements_=reinterpret_cast(new int [size2+size1*sizeof(double)/sizeof(int)]); CoinZeroN(elements_,2*nCols+2*numberCliques_); int * restInd = reinterpret_cast (elements_+size1); CoinFillN(restInd,nCols,-2); #endif // Create a local copy of the column solution (colsol), call it xstar, and // inititalize it. // Assumes the lp-relaxation has been solved, and the solver interface // has a meaningful colsol. double * xstar= new double[nCols]; solver_ = &si; // To allow for vub knapsacks int * thisColumnIndex = new int [nCols]; double * thisElement = new double[nCols]; int * back = new int[nCols]; const double *colsol = si.getColSolution(); int k; // For each row point to vub variable // -1 if no vub // -2 if can skip row for knapsacks int * vub = new int [nRows]; // Now vubValue are for positive coefficients and vlbValue for negative // when L row // For each column point to vub row int * vubRow = new int [nCols]; double * vubValue = new double [nRows]; // For each column point to vlb row int * vlbRow = new int [nCols]; double * vlbValue = new double [nRows]; // Take out all fixed double * effectiveUpper = new double [nRows]; double * effectiveLower = new double [nRows]; const double * colUpper = si.getColUpper(); const double * colLower = si.getColLower(); for (k=0; kcolUpper[k]) xstar[k]=colUpper[k]; else if (xstar[k]getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); const double * rowUpper = si.getRowUpper(); const double * rowLower = si.getRowLower(); // Scan all rows looking for possibles for (rowIndex=0;rowIndex1.0e20) multiplier=-1.0; else if (loRhs<-1.0e20) multiplier=1.0; int numberContinuous=0; int numberBinary=0; int iCont=-1; double sum = 0.0; double valueContinuous=0.0; #ifdef PRINT_DEBUG double valueBinary=0.0; int iBinary=-1; #endif int j; for (j=start;jcolLower[iColumn]) { sum += xstar[iColumn]*value; if (vubRow[iColumn]==-2&&value*multiplier>0.0) { // binary numberBinary++; #ifdef PRINT_DEBUG valueBinary=value; iBinary=iColumn; #endif } else if (vlbRow[iColumn]==-2&&value*multiplier<0.0) { // binary numberBinary++; #ifdef PRINT_DEBUG valueBinary=value; iBinary=iColumn; #endif } else if (vubRow[iColumn]==-1) { // only use if not at bound // if (colsol[iColumn]colLower[iColumn]+1.0e-6) { // possible iCont=iColumn; numberContinuous++; valueContinuous=value; //} else { //// ** needs more thought //numberContinuous ++; //iCont=-1; //} } else { // ** needs more thought numberContinuous ++; iCont=-1; //if (colsol[iColumn]colLower[iColumn]+1.0e-6) { //// already assigned //numberContinuous ++; //iCont=-1; //} } } else { // fixed upRhs -= colLower[iColumn]*value; loRhs -= colLower[iColumn]*value; } } // see if binding effectiveUpper[rowIndex] = upRhs; effectiveLower[rowIndex] = loRhs; bool possible = false; if (fabs(sum-upRhs)=0&&numberBinary==1) { // vub #ifdef PRINT_DEBUG printf("vub/vlb (by row %d) %g <= 0-1 %g * %d + %g * %d <= %g\n", rowIndex,effectiveLower[rowIndex],valueBinary,iBinary, valueContinuous,iCont,effectiveUpper[rowIndex]); #endif if (multiplier*valueContinuous>0.0) { vubValue[rowIndex] = valueContinuous; vubRow[iCont]=rowIndex; } else { vlbValue[rowIndex] = valueContinuous; vlbRow[iCont]=rowIndex; } vub[rowIndex]=iCont; numberVub++; } else if (numberBinary>1) { // could be knapsack vub[rowIndex]=-1; } else { // no point looking at this row vub[rowIndex]=-2; } } else { if (!possible||numberBinary+numberContinuous>maxInKnapsack_) vub[rowIndex]=-2; // no point looking at this row } } // Main loop int numCheck = 0; int* toCheck = 0; if (!rowsToCheck_) { toCheck = new int[nRows]; CoinIotaN(toCheck, nRows, 0); numCheck = nRows; } else { numCheck = numRowsToCheck_; toCheck = rowsToCheck_; } // Long row int longRow =20; //15; int longRow2 =20; //15; if (!info.inTree) { longRow=25; //longRow2=20; if (!info.pass) longRow=30; } // Set up number of tries for each row int ntry; if (numberVub) ntry=4; else ntry=2; //ntry=2; // switch off for (int ii=0; ii < numCheck; ++ii){ rowIndex = toCheck[ii]; if (rowIndex < 0 || rowIndex >= nRows) continue; if (vub[rowIndex]==-2) continue; whichRow_=ii; #ifdef PRINT_DEBUG std::cout << "CGL: Processing row " << rowIndex << std::endl; #endif // Get a tight row // (want to be able to // experiment by turning this on and off) // // const double * pi=si.rowprice(); // if (fabs(pi[row]) < epsilon_){ // continue; // } ////////////////////////////////////////////////////// // Derive a "canonical" knapsack // // inequality (in binary variables) // // from the model row in mixed integer variables // ////////////////////////////////////////////////////// #ifdef CGL_DEBUG assert(!krow.getNumElements()); #endif double effectiveRhs[4]; double rhs[4]; double sign[]={0.0,0.0,-1.0,1.0}; bool rowType[] = {false,true,false,true}; effectiveRhs[0] = effectiveLower[rowIndex]; rhs[0]=rowLower[rowIndex]; effectiveRhs[2] = effectiveRhs[0]; rhs[2]= effectiveRhs[0]; effectiveRhs[1] = effectiveUpper[rowIndex]; rhs[1]=rowUpper[rowIndex]; effectiveRhs[3] = effectiveRhs[1]; rhs[3]= effectiveRhs[1]; int itry; #ifdef CGL_DEBUG int kcuts[4]; memset(kcuts,0,4*sizeof(int)); #endif for (itry=0;itry1.0e20) continue; int length = rowLength[rowIndex]; memcpy(thisColumnIndex,column+rowStart[rowIndex],length*sizeof(int)); memcpy(thisElement,elementByRow+rowStart[rowIndex], length*sizeof(double)); b=rhs[itry]; if (itry>1) { // see if we would be better off relaxing int i; // mark columns int length2=length; // for new length int numberReplaced=0; for (i=0;i=0) { int jRow = vubRow[iColumn]; if (vub[jRow]==iColumn&&jRow!=rowIndex) { double vbCoefficient = vubValue[jRow]; // break it out - may be able to do better if (dSign*thisCoefficient>0.0) { // we want valid lower bound on continuous if (effectiveLower[jRow]>-1.0e20&&vbCoefficient>0.0) { replace=-1; iRow=jRow; vubCoefficient = vbCoefficient; } else if (effectiveUpper[jRow]<1.0e20&&vbCoefficient<0.0) { replace=1; iRow=jRow; vubCoefficient = vbCoefficient; } } else { // we want valid upper bound on continuous if (effectiveLower[jRow]>-1.0e20&&vbCoefficient<0.0) { replace=-1; iRow=jRow; vubCoefficient = vbCoefficient; } else if (effectiveUpper[jRow]<1.0e20&&vbCoefficient>0.0) { replace=1; iRow=jRow; vubCoefficient = vbCoefficient; } } } } if (vlbRow[iColumn]>=0) { int jRow = vlbRow[iColumn]; if (vub[jRow]==iColumn&&jRow!=rowIndex) { double vbCoefficient = vlbValue[jRow]; // break it out - may be able to do better if (dSign*thisCoefficient>0.0) { // we want valid lower bound on continuous if (effectiveLower[jRow]>-1.0e20&&vbCoefficient>0.0) { replace=-1; iRow=jRow; vubCoefficient = vbCoefficient; } else if (effectiveUpper[jRow]<1.0e20&&vbCoefficient<0.0) { replace=1; iRow=jRow; vubCoefficient = vbCoefficient; } } else { // we want valid upper bound on continuous if (effectiveLower[jRow]>-1.0e20&&vbCoefficient<0.0) { replace=-1; iRow=jRow; vubCoefficient = vbCoefficient; } else if (effectiveUpper[jRow]<1.0e20&&vbCoefficient>0.0) { replace=1; iRow=jRow; vubCoefficient = vbCoefficient; } } } } if (replace) { double useRhs=0.0; numberReplaced++; if (replace<0) useRhs = effectiveLower[iRow]; else useRhs = effectiveUpper[iRow]; // now replace (just using vubRow==-2) // delete continuous thisElement[i]=0.0; double scale = thisCoefficient/vubCoefficient; // modify rhs b -= scale*useRhs; int start = rowStart[iRow]; int end = start+rowLength[iRow]; int j; for (j=start;jmaxInKnapsack_) continue; // too long } else { for (i=0;igetVector(rowIndex).getIndices(); const double * elements = si.getMatrixByRow()->getVector(rowIndex).getElements(); // for every variable in the constraint for (i=0; igetVector(rowIndex).getNumElements(); i++){ printf("%d (s=%g) %g, ",indices[i],colsol[indices[i]],elements[i]); } printf("\n"); } #endif ////////////////////////////////////////////////////// // Look for a series of // // different types of minimal covers. // // If a minimal cover is found, // // lift the associated minimal cover inequality, // // uncomplement the vars // // and add it to the cut set. // // After the last type of cover is tried, // // restore xstar values // ////////////////////////////////////////////////////// ////////////////////////////////////////////////////// // Try to generate a violated // // minimal cover greedily from fractional vars // ////////////////////////////////////////////////////// CoinPackedVector cover, remainder; if (findGreedyCover(rowIndex, krow, b, xstar, cover, remainder) == 1){ // Lift cover inequality and add to cut set if (!liftAndUncomplementAndAdd(rowUpper[rowIndex], krow, b, complement, rowIndex, cover, remainder, cs)) { // Reset local data and continue to the next iteration // of the rowIndex-loop // I am not sure this is needed but I am just being careful for(k=0; k 0. If this is not the case, something's screwy. Exit gracefully. double lambda = sum-b; if (lambda < epsilon_) { #ifdef CGL_DEBUG if (lambda < -epsilon_) { printf("lambda < epsilon....aborting. \n"); std::cout << "lambda " << lambda << " epsilon " << epsilon_ << std::endl; abort(); } else { #endif possible=false; #ifdef CGL_DEBUG } #endif } } if (possible) { CoinPackedVector atOnes; CoinPackedVector fracCover; // different than cover int nInCover = cover.getNumElements(); const int * ind = cover.getIndices(); const double * elsIn = cover.getElements(); for (int i=0;i epsilon_) { for(k=0; knlast) { const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&debugger->onOptimalPath(si)) { // check cuts okay int k; for (k=nlast;kinvalidCut(rc)) { printf("itry %d, rhs %g, length %d\n",itry,rhs[itry],length); int i; for (i=0;i1) { int length = rowLength[rowIndex]; memcpy(thisColumnIndex,column+rowStart[rowIndex], length*sizeof(int)); memcpy(thisElement,elementByRow+rowStart[rowIndex], length*sizeof(double)); printf("Original row had rhs %g and length %d\n", (itry==2 ? rowLower[rowIndex] :rowUpper[rowIndex]), length); for (i=0;iinvalidCut(rc)); } } } if (itry>1&&nnow-nlast>kcuts[itry-2]) { printf("itry %d gave %d cuts as against %d for itry %d\n", itry,nnow-nlast,kcuts[itry-2],itry-2); } kcuts[itry]=nnow-nlast; nlast=nnow; } #endif } } if (!info.inTree&&((info.options&4)==4||((info.options&8)&&!info.pass))) { int numberRowCutsAfter = cs.sizeRowCuts(); for (int i=numberRowCutsBefore;isetGloballyValid(); } // Clean up: free allocated memory if (toCheck != rowsToCheck_) delete[] toCheck; delete[] xstar; delete[] complement; #ifdef GUBCOVER delete [] elements_; #endif delete [] thisColumnIndex; delete [] thisElement; delete [] back; delete [] vub; delete [] vubRow; delete [] vubValue; delete [] vlbRow; delete [] vlbValue; delete [] effectiveLower; delete [] effectiveUpper; } void CglKnapsackCover::setTestedRowIndices(int num, const int* ind) { if (rowsToCheck_) delete[] rowsToCheck_; numRowsToCheck_ = num; if (num > 0) { rowsToCheck_ = new int[num]; CoinCopyN(ind, num, rowsToCheck_); } } //------------------------------------------------------------- // Lift and uncomplement cut. Add cut to the cutset //------------------------------------------------------------------- int CglKnapsackCover::liftAndUncomplementAndAdd( double /*rowub*/, CoinPackedVector & krow, double & b, int * complement, int /*row*/, CoinPackedVector & cover, CoinPackedVector & remainder, OsiCuts & cs ) { CoinPackedVector cut; double cutRhs = cover.getNumElements() - 1.0; int goodCut=1; if (remainder.getNumElements() > 0){ // Construct lifted cover cut if (!liftCoverCut( b, krow.getNumElements(), cover, remainder, cut )) goodCut= 0; // no cut } // The cover consists of every variable in the knapsack. // There is nothing to lift, so just add cut else { cut.reserve(cover.getNumElements()); cut.setConstant(cover.getNumElements(),cover.getIndices(),1.0); } if (goodCut) { //int extendedCut = gubifyCut(cut); //if (extendedCut) //printf("XX extended cut\n"); // Uncomplement the complemented variables in the cut int k; //if (fabs(b-rowub)> epsilon_) { double * elements = cut.getElements(); int * indices = cut.getIndices(); for (k=0; k=0); assert(elements[k]); assert (fabs(elements[k])>1.0e-12); } } #endif rc.setLb(-COIN_DBL_MAX); rc.setUb(cutRhs); // rc.setEffectiveness(0); // Todo: put in a more useful measure such as the violation. // Add row cut to the cut set #ifdef PRINT_DEBUG { int k; printf("cutrhs %g %d elements\n",cutRhs,cut.getNumElements()); double * elements = cut.getElements(); int * indices = cut.getIndices(); for (k=0; k()); } // nBinUnsat is a counter for the number of unsatisfied // (i.e. fractional) binary vars int nBinUnsat =0; const double * colupper = si.getColUpper(); const double * collower = si.getColLower(); // At this point, leMatrixRow and b represent a le inequality in general // variables. // To derive a canonical knapsack inequality in free binary variable, // process out the continuous & non-binary integer & fixed binary variables. // If the non-free-binary variables can be appropriately bounded, // net them out of the constraint, otherwise abandon this row and return 0. const int * indices = leMatrixRow.getIndices(); const double * elements = leMatrixRow.getElements(); // for every variable in the constraint for (i=0; iepsilon_){ // and the variable has a finite lower bound if (collower[indices[i]] > -si.getInfinity()){ // then replace the variable with its lower bound. b=b-elements[i]*collower[indices[i]]; } else { return 0; } } // note: if the coefficient is zero, the variable is not included in the // knapsack inequality. } // else the variable is a free binary var and is included in the knapsack // inequality. // note: the variable is included regardless of its solution value to the // lp relaxation. else{ krow.insert(indices[i], elements[i]); // if the binary variable is unsatified (i.e. has fractional value), // increment the counter. if(xstar[indices[i]] > epsilon_ && xstar[indices[i]] < onetol_) nBinUnsat++; // keep track of the largest and smallest elements in the knapsack // (the idea is if there is not a lot of variation in the knapsack // coefficients, it is unlikely we will find a violated minimal // cover from this knapsack so don't even bother trying) if (fabs(elements[i]) > maxKrowElement) maxKrowElement = fabs(elements[i]); if (fabs(elements[i]) < minKrowElement) minKrowElement = fabs(elements[i]); } } // If there's little variation in the knapsack coefficients, return 0. // If there are no unsatisfied binary variables, return. // If there's only one binary, return. // ToDo: but why return if 2 binary? ...there was some assumption in the // findVioMinCover..(?) // Anyway probing will probably find something if (krow.getNumElements() < 3 || nBinUnsat == 0 || maxKrowElement-minKrowElement < 1.0e-3*maxKrowElement ) { return 0; } // However if we do decide to do when count is two - look carefully if (krow.getNumElements()==2) { const int * indices = krow.getIndices(); double * elements = krow.getElements(); double sum=0.0; for(i=0; i<2; i++){ int iColumn = indices[i]; sum += elements[i]*xstar[iColumn]; } if (sum ub. // TODO: test this scenario in BCP if (b < 0 ){ OsiColCut cc; int index = krow.getIndices()[0]; const double fakeLb = colupper[index] + 1.0;; // yes, colupper. #ifdef CGL_DEBUG const double fakeUb = collower[index]; assert( fakeUb < fakeLb ); #endif cc.setLbs( 1, &index, &fakeLb); cc.setUbs( 1, &index, &fakeLb); cc.setEffectiveness(COIN_DBL_MAX); cs.insert(cc); #ifdef PRINT_DEBUG printf("Cgl: Problem is infeasible\n"); #endif } // At this point, krow and b represent a le inequality with postive // coefficients. // If any coefficient a_j > b, then x_j = 0, return 0 // If any complemented var has coef a_j > b, then x_j = 1, return 0 int fixed = 0; CoinPackedVector fixedBnd; for(i=0; i b){ fixedBnd.insert(krow.getIndices()[i],complement[krow.getIndices()[i]]); #ifdef PRINT_DEBUG printf("Variable %i being fixed to %i due to row %d.\n", krow.getIndices()[i],complement[krow.getIndices()[i]],rowIndex); #endif fixed = 1; } } // After all possible variables are fixed by adding a column cut with // equivalent lower and upper bounds, return if (fixed) { OsiColCut cc; cc.setLbs(fixedBnd); cc.setUbs(fixedBnd); cc.setEffectiveness(COIN_DBL_MAX); return 0; } return 1; } //------------------------------------------------------------------- // deriveAKnapsack - returns 1 if the method is able to // derive a cannonical knapsack inequality // in binary variables of the form ax<=b // from the rowIndex-th row of the constraint matrix. // returns 0, otherwise. // Precondition: complement must be 0'd out!!! //------------------------------------------------------------------- int CglKnapsackCover::deriveAKnapsack( const OsiSolverInterface & si, OsiCuts & cs, CoinPackedVector & krow, double & b, int * complement, double * xstar, int rowIndex, const CoinPackedVectorBase & matrixRow ) { // Get the sense of the row const char rowsense = si.getRowSense()[rowIndex]; // Skip equality and unbounded rows if (rowsense=='E' || rowsense=='N') { return 0; } bool treatAsLRow = (rowsense=='L'); const int * indices = matrixRow.getIndices(); const double * elements = matrixRow.getElements(); int numberElements = matrixRow.getNumElements(); return deriveAKnapsack( si, cs, krow, treatAsLRow, b, complement, xstar, rowIndex, numberElements, indices, elements); } //-------------------------------------------------- // Find a violated minimal cover from // a canonical form knapsack inequality by // solving the lp relaxation of the // -most- violated cover problem. // Postprocess to ensure minimality. // ----------------------------------------- int CglKnapsackCover::findLPMostViolatedMinCover( int nCols, int #ifdef PRINT_DEBUG row #endif , CoinPackedVector & krow, double & b, double * xstar, CoinPackedVector & cover, CoinPackedVector & remainder) { // Assumes krow and b describe a knapsack inequality in canonical form // Given a knapsack inequality sum a_jx_j <= b, and optimal lp solution // xstart, a violated minimal cover inequality exists if the following 0-1 // programming problem has an optimal objective function value (oofv) < 1 // oofv = min sum (1-xstar_j)z_j // s.t. sum a_jz_j > b // z binary // The vector z is an incidence vector, defining the cover R with the // associated cover inequality: // (sum j in R) x_j <= |R|-1 // This problem is itself a (min version of the) knapsack problem // but with a unsightly strict inequalty. // To transform transform it into a max version, // complement the z's, z_j=1-y_j. // To compensate for the strict inequality, subtract epsilon from the rhs. // oofv = (sum (1-xstar_j))- max sum (1-xstar)y_j // s.t. sum a_jy_j <= (sum over j)a_j - b (- EPSILON) // y binary // If oofv < 1, then a violated min cover inequality has // incidence vector z with elements z_j=1-y_j and rhs= num of nonzero's in // z, i.e. the number of 0's in y. // If the size of the knapsack is "small", we solve the problem exactly. // If the size of the knapsack is large, we solve the (simpler) lp relaxation // of the knapsack problem and postprocess to ensure the construction of a // minimimal cover. // We also assume that testing/probing/fixing based on the knapsack structure // is done elsewhere. Only convenient-to-do sanity checks are done here. // (We do not assume that data is integer.) double elementSum = krow.sum(); // Redundant/useless adjusted rows should have been trapped in the // transformation to the canonical form of knapsack inequality if (elementSum < b + epsilon_) { return -1; } // Order krow in nonincreasing order of coefObj_j/a_j. // (1-xstar_1)/a_1 >= (1-xstar_2)/a_2 >= ... >= (1-xstar_n)/a_n // by defining this full-storage array "ratio" to be the external sort key. double * ratio= new double[nCols]; memset(ratio, 0, (nCols*sizeof(double))); int i; for (i=0; i epsilon_ ){ ratio[krow.getIndices()[i]]= (1.0-xstar[krow.getIndices()[i]]) / (krow.getElements()[i]); } else { ratio[krow.getIndices()[i]] = 0.0; } } // ToDo: would be nice to have sortkey NOT be full-storage vector CoinDecrSolutionOrdered dso(ratio); krow.sort(dso); // Find the "critical" element index "r" in the knapsack lp solution int r = 0; double sum = krow.getElements()[0]; while ( sum <= (elementSum - b - epsilon_ ) ){ r++; sum += krow.getElements()[r]; } // Note: It is possible the r=0, and you get a violated minimal cover // if (r=0), then you've got a var with a really large coeff. compared // to the rest of the row. // r=0 says trivially that the // sum of ALL the binary vars in the row <= (cardinality of all the set -1) // Note: The cover may not be minimal if there are alternate optimals to the // maximization problem, so the cover must be post-processed to ensure // minimality. // "r" is the critical element // The lp relaxation column solution is: // y_j = 1 for j=0,...,(r-1) // y_r = (elementSum - b - sum + krow.element()[r])/krow.element()[r] // y_j = 0 for j=r+1,...,krow.getNumElements() // The number of nonzeros in the lp column solution is r+1 // if oofv to the lp knap >= 1, then no violated min cover is possible int nCover; double lpoofv=0.0; for (i=r+1; i 1.0 - epsilon_){ delete [] ratio; return -1; } else { // Partition knapsack into cover and noncover (i.e. remainder) // pieces nCover = krow.getNumElements() - r; double coverSum =0.0; cover.reserve(nCover); remainder.reserve(r); for (i=r; i b+1.0e-12){ // move the excess cover member into the set of remainders remainder.insert(cover.getIndices()[nCover-1], cover.getElements()[nCover-1]); cover.truncate(nCover-1); nCover--; oneLessCoverSum -= cover.getElements()[nCover-1]; } if (nCover<2){ #ifdef PRINT_DEBUG printf("nCover < 2...aborting\n"); abort(); #endif delete [] ratio; return -1; } #ifdef PRINT_DEBUG /* debug */ printf("\ Lp relax of most violated minimal cover: row %i has cover of size %i.\n", row,nCover); //double sumCover = 0.0; for (i=0; i nCover-1){ printf("\ \nBad cover from lp relax of most violated cover..aborting\n"); abort(); } #endif /* clean up */ delete [] ratio; return 1; } } //-------------------------------------------------- // Find a violated minimal cover from // a canonical form knapsack inequality by // solving the -most- violated cover problem // and postprocess to ensure minimality // ----------------------------------------- int CglKnapsackCover::findExactMostViolatedMinCover( int nCols, int #ifdef PRINT_DEBUG row #endif , CoinPackedVector & krow, double b, double * xstar, CoinPackedVector & cover, CoinPackedVector & remainder) { // assumes the row is in canonical knapsack form // A violated min.cover inequality exists if the // opt obj func value (oofv) < 1: // oofv = min sum (1-xstar_j)z_j // s.t. sum a_jz_j > b // x binary // The vector z is the incidence vector // defines the set R and the cover inequality. // (sum j in R) x_j <= |R|-1 // This is the min version of the knapsack problem. // (note that strict inequalty...bleck) // To obtain the max version, complement the z's, z_j=1-y_j and // adjust the constraint. // oofv = (sum (1-xstar_j))- max sum (1-xstar)y_j // s.t. sum a_jy_j <= (sum over j)a_j - b (- EPSILON)] // y binary // If oofv < 1, violated min cover inequality has // incidence vector z=1-y and rhs= num of nonzero's in z, i.e. // the number 0 in y. // We solve the 0-1 knapsack problem by explicit ennumeration double elementSum = krow.sum(); // Redundant/useless adjusted rows should have been trapped in // transformation to canonical form of knapsack inequality if (elementSum < b + epsilon_) { #ifdef PRINT_DEBUG printf("Redundant/useless adjusted row\n"); #endif return -1; } // Order krow in nonincreasing order of coefObj_j/a_j. // (1-xstar_1)/a_1 >= (1-xstar_2)/a_2 >= ... >= (1-xstar_n)/a_n // by defining this full-storage array "ratio" to be the external sort key. double * ratio= new double[nCols]; memset(ratio, 0, (nCols*sizeof(double))); int i; { const int * indices = krow.getIndices(); const double * elements = krow.getElements(); for (i=0; i epsilon_ ){ ratio[indices[i]]= (1.0-xstar[indices[i]]) / elements[i]; } else { ratio[indices[i]] = 0.0; } } } // ToDo: would be nice to have sortkey NOT be full-storage vector CoinDecrSolutionOrdered dso(ratio); krow.sort(dso); #ifdef CGL_DEBUG // sanity check for ( i=1; i= ratioi ); } #endif // Recall: // oofv = (sum (1-xstar_j))- max sum (1-xstar)y_j // s.t. sum a_jy_j <= (sum over j)a_j - b (- epsilon_)] // y binary double objConst = 0.0; double exactOptVal = -1.0; int * exactOptSol = new int[krow.getNumElements()]; double * p = new double[krow.getNumElements()]; double * w = new double[krow.getNumElements()]; int kk; for (kk=0; kk b){ // move the excess cover member into the set of remainders remainder.insert(cover.getIndices()[cover.getNumElements()-1], cover.getElements()[cover.getNumElements()-1]); cover.truncate(cover.getNumElements()-1); oneLessCoverElementSum -= cover.getElements()[cover.getNumElements()-1]; } #ifdef PRINT_DEBUG printf("Exact Most Violated Cover: row %i has cover of size %i.\n", row,cover.getNumElements()); //double sumCover = 0.0; for (i=0; i adjRhs, skip row. Bad knapsack. // margin = adjRhs // idea: if (possibly compl) soln >= .5 round up, else round down // they do more, but that's the essence // go through the elements { // if round down, skip // if round up, add to element to cover. adjust margin // if current element = biggest, then get next biggest // if biggest > marg, you've got a cover. stop looking // else try next element in the loop // } // (*)RLH: I'm going to sort in decreasing order of soln val // b/c var's whose soln < .5 in can. form get rounded down // and skipped. If you can get a min cover of the vars // whose soln is >= .5, I believe this gives the same as J&E. // But if not, maybe I can get something more. // (**)By checking largest value left, they ensure a minimal cover // on the unsatisfied variables // if you have a cover // sort the elements to be lifted in order of their reduced costs. // lift in this order. // ...I don't understand their lifting, so for now use sequence-indep lifting // J&E employ lifting up and down. // Here I'm including the vars at one in the cover. // Adding these vars back in may cause the minimality of the cover to lost. // So, post-processing to establish minimality is required. cover.reserve(krow.getNumElements()); remainder.reserve(krow.getNumElements()); double unsatRhs = b; // working info on unsatisfied vars CoinPackedVector unsat; unsat.reserve(krow.getNumElements()); // working info on vars with value one CoinPackedVector atOne; atOne.reserve(krow.getNumElements()); // partition the (binary) variables in the canonical knapsack // into those at zero, those at fractions, and those at one. // Note: no consideration given to whether variables are free // or fixed at binary values. // Note: continuous and integer vars have already been netted out // to derive the canonical knapsack form int i; for (i=0; i onetol_){ atOne.insert(krow.getIndices()[i],krow.getElements()[i]); unsatRhs -= krow.getElements()[i]; } else if (xstar[krow.getIndices()[i]] >= epsilon_){ unsat.insert(krow.getIndices()[i],krow.getElements()[i]) ; } else { remainder.insert(krow.getIndices()[i],krow.getElements()[i]); } } // sort the indices of the unsat var in order of decreasing solution value CoinDecrSolutionOrdered decrSol(xstar); unsat.sort(decrSol); #ifdef CGL_DEBUG // sanity check for (i=1; i= xstari ); } #endif // get the largest coefficient among the unsatisfied variables double bigCoef= 0.0; // double temp; int bigIndex = 0; for (i=0; ibigCoef){ bigCoef = unsat.getElements()[i]; bigIndex = i; } } // initialize i=0; double margin = unsatRhs; int gotCover=0; int j; // look in order through the unsatisfied vars which along with the // the max element defines a cover while (i bigCoef ){ bigCoef = temp; bigIndex = j; } } } if (bigCoef > margin+epsilon2_) gotCover = 1; i++; } // J&E approach; get first single one element that fills the margin if(gotCover){ j=i; if (j (nCover-1) && coverElementSum > unsatRhs+epsilon2_){ for (i=nCover; i b){ // move the excess cover member into the set of remainders remainder.insert(cover.getIndices()[cover.getNumElements()-1], cover.getElements()[cover.getNumElements()-1]); cover.truncate(cover.getNumElements()-1); oneLessCoverElementSum -= cover.getElements()[cover.getNumElements()-1]; } #ifdef PRINT_DEBUG if (coverXstarSum > (nCover-1) && coverElementSum > b){ printf("John and Ellis: row %i has cover of size %i.\n", row,cover.getNumElements()); //double sumCover = 0.0; for (i=0; i adjRhs, skip row. Bad knapsack. // margin = adjRhs // idea: if (possibly compl) soln >= .5 round up, else round down // they do more, but that's the essence // go through the elements { // if round down, skip // if round up, add to element to cover. adjust margin // if current element = biggest, then get next biggest // if biggest > marg, you've got a cover. stop looking // else try next element in the loop // } // (*)RLH: I'm going to sort in decreasing order of soln val // b/c var's whose soln < .5 in can. form get rounded down // and skipped. If you can get a min cover of the vars // whose soln is >= .5, I believe this gives the same as J&E. // But if not, maybe I can get something more. // (**)By checking largest value left, they ensure a minimal cover // on the unsatisfied variables // if you have a cover // sort the elements to be lifted in order of their reduced costs. // lift in this order. // They lift down on variables at one, in a sequence-dependent manner. // Partion the variables into three sets: those in the cover, those // not in the cover at value one, and those remaining. fracCover.reserve(krow.getNumElements()); remainder.reserve(krow.getNumElements()); atOne.reserve(krow.getNumElements()); double unsatRhs = b; // working info on unsatisfied vars CoinPackedVector unsat; unsat.reserve(krow.getNumElements()); // partition the (binary) variables in the canonical knapsack // into those at zero, those at fractions, and those at one. // // essentially, temporarily fix to one the free vars with lp soln value of // one by calculating the "unsatRhs". Call the result the "reduced krow". // // Note: continuous and integer vars, and variables fixed at // binary values have already been netted out // in deriving the canonical knapsack form int i; for (i=0; i onetol_){ atOne.insert(krow.getIndices()[i],krow.getElements()[i]); unsatRhs -= krow.getElements()[i]; } else if (xstar[krow.getIndices()[i]] >= epsilon_){ unsat.insert(krow.getIndices()[i],krow.getElements()[i]) ; } else { remainder.insert(krow.getIndices()[i],krow.getElements()[i]); } } // sort the indices of the unsat var in order of decreasing solution value CoinDecrSolutionOrdered decrSol(xstar); unsat.sort(decrSol); #ifdef CGL_DEBUG // sanity check for (i=1; i= xstari ); } #endif // get the largest coefficient among the unsatisfied variables double bigCoef= 0.0; // double temp; int bigIndex = 0; for (i=0; ibigCoef){ bigCoef = unsat.getElements()[i]; bigIndex = i; } } // initialize i=0; double margin = unsatRhs; int gotCover=0; int j; // look in order through the unsatisfied vars which along with the // the max element defines a cover while (i bigCoef ){ bigCoef = temp; bigIndex = j; } } } if (bigCoef > margin+epsilon2_) gotCover = 1; i++; } // J&E approach; get first single one element that fills the margin if(gotCover){ j=i; if (j unsatRhs+epsilon2_){ for (i=nCover; i b){ // move the excess cover member into the set of remainders remainder.insert(fracCover.getIndices()[fracCover.getNumElements()-1], fracCover.getElements()[fracCover.getNumElements()-1]); fracCover.truncate(fracCover.getNumElements()-1); oneLessCoverElementSum -= fracCover.getElements()[fracCover.getNumElements()-1]; } #endif #ifdef PRINT_DEBUG printf("More Exactly John and Ellis:"); printf(" row %i has -reduced--fractional- cover of size %i.\n", row,fracCover.getNumElements()); double sumFracCover = 0.0; for (i=0; i= epsilon_ && xstar[krow.getIndices()[i]] <= onetol_ && !gotCover){ greedyElementSum += krow.getElements()[i]; greedyXstarSum += xstar[krow.getIndices()[i]]; cover.insert(krow.getIndices()[i],krow.getElements()[i]); if (greedyElementSum > b+epsilon2_){ gotCover = 1; } } else{ remainder.insert(krow.getIndices()[i],krow.getElements()[i]); } } #ifdef CGL_DEBUG // sanity check int size = remainder.getNumElements()+cover.getNumElements(); int krowsize = krow.getNumElements(); assert( size==krowsize ); #endif // if no violated minimal cover was found, pack it in if ( (greedyXstarSum<=(cover.getNumElements()-1)+epsilon2_) || (!gotCover) || (cover.getNumElements() < 2)){ return -1; } #ifdef PRINT_DEBUG printf("Greedy cover: row %i has cover of size %i\n", row,cover.getNumElements()); for (i=0; iepsilon2_) { printf("At one %d\n",atOne.getNumElements()); for (i=0; i 0 ); // If there is something to lift, then calculate the lifted coefficients if (unsatRhs>0.0&&(remainder.getNumElements()+atOne.getNumElements())> 0){ // What order to lift? // Take the remainder vars in decreasing order of their // xstar solution value. Sort remainder in order of decreasing // xstar value. // Lift them "up" // (The lift "down" the variables atOne. CoinDecrSolutionOrdered dso1(xstar); remainder.sort(dso1); #if GUBCOVER==2 int nClique=0; double * weightClique2 = NULL; int * indices = NULL; int * starts = NULL; if (numberCliques_) { int nInCover = fracCover.getNumElements(); int nRest = remainder.getNumElements(); const CoinPackedMatrix * matrixByRow = solver_->getMatrixByRow(); #ifdef PRINT_DEBUG const double * elementByRow = matrixByRow->getElements(); #endif const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); #ifdef PRINT_DEBUG const double * rowUpper = solver_->getRowUpper(); const double * rowLower = solver_->getRowLower(); #endif int numberColumns = solver_->getNumCols(); double * els = elements_; double * els2 = els+numberColumns; double * weightClique = els2+numberColumns; weightClique2 = weightClique+numberCliques_; double * temp = weightClique2+2*numberColumns; int * count = reinterpret_cast(temp); indices = reinterpret_cast (temp+numberCliques_); int * whichClique = indices+numberColumns; for (i=rowStart[whichRow_];i=0&&!complement_[iColumn]) { //printf("Cover column %d, xstar %g ",iColumn,xstar[iColumn]); for (int j=oneFixStart_[iColumn];j ",iClique,weightClique[iClique]); double value=weightClique[iClique]; if (!value) { whichClique[nClique++] =iClique; count[iClique]=0; } count[iClique]++; value += 3.0; weightClique[iClique]=value; //printf("%g) ",weightClique[iClique]); } //printf("\n"); } } ind = remainder.getIndices(); #ifdef PRINT_DEBUG elsIn = remainder.getElements(); #endif for (i=0;i1.0e-5) value=3.0; else value=0.99; if (oneFixStart_[iColumn]>=0&&!complement_[iColumn]) { //printf("Column %d, xstar %g ",iColumn,xstar[iColumn]); for (int j=oneFixStart_[iColumn];j ",iClique,weightClique[iClique]); //printf("%g) ",weightClique[iClique]); } //printf("\n"); } } // But only look at cliques with more than one entry int nnClique=0; for (i=0;i1) whichClique[nnClique++]=iClique; else weightClique[iClique]=0.0; } nClique=nnClique; ind = fracCover.getIndices(); for (i=0;i=0&&!complement_[iColumn]) { double value=3.1; int jClique=-1; for (int j=oneFixStart_[iColumn];jvalue) { jClique=iClique; value=weightClique[iClique]; } } if (jClique>=0) { indices[iColumn]=jClique; count[jClique]=-1; } else { indices[iColumn]=-2; } } } ind = remainder.getIndices(); for (i=0;i=0&&!complement_[iColumn]) { double value=1.1; int jClique=-1; for (int j=oneFixStart_[iColumn];jvalue) { jClique=iClique; value=weightClique[iClique]; } } if (jClique>=0) { indices[iColumn]=jClique; count[jClique]=-1; } else { indices[iColumn]=-2; } } } #ifdef PRINT_DEBUG bool interesting = false; #endif nnClique=0; for (i=0;i=0) { int back = count[iClique]; if (back<0) { // first back=nnClique; count[iClique]=nnClique; whichClique[nnClique++]=iClique; current[iClique]=0; } current[iClique]++; weightClique[back] -= xstar[i]; } } assert (nnClique==nClique); CoinSort_2(weightClique,weightClique+nClique,whichClique); int n=0; for (i=0;i=0) { int back = count[iClique]; int put = current[back]; current[back]++; which[put]=iColumn; indices[iColumn]=back; nNow[back]++; // already in } } // Next remainder (maybe should split into nonzero and zero) // and add atOnes in middle // *** NEED to sort so best gub first ind = remainder.getIndices(); for (i=0;i=0) { int back = count[iClique]; int put = current[back]; current[back]++; which[put]=iColumn; indices[iColumn]=back; } } #ifdef CLP_INVESTIGATE nTry++; int k=CoinMin(nClique,4); howMany[k]++; if ((nTry%100)==0) { printf("TRY %d ",nTry); for (i=1;i<5;i++) if (howMany[i]) printf("(%d cliques -> %d) ",i,howMany[i]); printf("\n"); } #endif } } #endif // a is the part of krow corresponding to vars which have been lifted // alpha are the lifted coefficients with explicit storage of lifted zero // coefficients the a.getIndices() and alpha.getIndices() are identical CoinPackedVector a(fracCover); CoinPackedVector alpha; int i; for (i=0; i= alpha_2/a_2 >= ... >= alpha_n/a_n // by defining this full-storage array "ratio" to be the external sort key. // right now external sort key must be full-storage. double * ratio= new double[nCols]; memset(ratio, 0, (nCols*sizeof(double))); #ifdef CGL_DEBUG double alphasize = alpha.getNumElements(); double asize = a.getNumElements(); assert( alphasize == asize ); #endif for (i=0; i epsilon_ ){ ratio[a.getIndices()[i]]=alpha.getElements()[i]/a.getElements()[i]; } else { ratio[a.getIndices()[i]] = 0.0; } } CoinDecrSolutionOrdered dso2(ratio); a.sort(dso2); alpha.sort(dso2); #ifdef CGL_DEBUG // sanity check for ( i=1; i=alpha_2/a_2>=...>=alpha_n/a_n order // check if lifted var can take value 1 ratio[iColumn] = 0.0; #if GUBCOVER==2 int inClique = (nClique) ? indices[iColumn] : -3; #endif if (unsatRhs - element >= epsilon_) { #if GUBCOVER==2 if (!nClique) { #endif exactSolveKnapsack(alpha.getNumElements(), unsatRhs-element, alpha.getElements(),a.getElements(),psi_j,x); #if GUBCOVER==2 } else { // A) should sort "remainder" so strongest clique first // B) make more efficient // C) take out news in exactKnapsack // weightClique2 is 2*ncolumns // indices for (i=0;i=0) { // Do current for (i=0;i=0) { current[i]=which[k+kk]; } else { current[i]=-3; } } double offsetObj=0.0; double testRhs=unsatRhs-element; int n=0; for (i=0;i= epsilon_) { exactSolveKnapsack(n,testRhs,p,w,nowPsi_j,x); nowPsi_j += offsetObj; #ifdef FULL_GUB_PRINT printf("gub psi %g\n",nowPsi_j); #endif assert (nowPsi_j>=0.0); if (nowPsi_j>biggestPsi_j) biggestPsi_j=nowPsi_j; } else if (testRhs >= -epsilon_) { // as is nowPsi_j = offsetObj; #ifdef FULL_GUB_PRINT printf("gub psi %g (no knapsack computation)\n",nowPsi_j); #endif assert (nowPsi_j>=0.0); if (nowPsi_j>biggestPsi_j) biggestPsi_j=nowPsi_j; } else { #ifdef FULL_GUB_PRINT printf("take as zero\n"); #endif } stack[kStack]--; while (stack[kStack]<0) { stack[kStack]=nNow[kStack]-1; kStack--; if (kStack>=0) { stack[kStack]--; if (stack[kStack]>=0) { kStack=nClique-1; break; } } } } #ifdef FULL_GUB_PRINT if (fabs(biggestPsi_j-oldPsi_j)>1.0e-7) { printf("gub ** Ordinary psi %g, gub %g\n",oldPsi_j, biggestPsi_j); } #endif assert (biggestPsi_jepsilon_) { cut.insert(iColumn,cutRhs-psi_j); // assert the new coefficient is nonegative? alpha.insert(iColumn,cutRhs-psi_j); a.insert(iColumn,element); ratio[iColumn] = (cutRhs-psi_j)/element; CoinDecrSolutionOrdered dso(ratio); a.sort(dso); alpha.sort(dso); } #if GUBCOVER==2 if (inClique>=0) { int kStart =starts[inClique]; int kEnd =starts[inClique+1]; int j=nNow[inClique]; j += kStart; assert (kStartepsilon_) { nNow[inClique]++; } else { // shuffle up (some may have already gone) for (int k=j+1;k=alpha_2/a_2>=...>=alpha_n/a_n order exactSolveKnapsack(alpha.getNumElements(), unsatRhs+atOne.getElements()[j], alpha.getElements(),a.getElements(),psi_j,x); alpha.insert(atOne.getIndices()[j],psi_j-cutRhs); a.insert(atOne.getIndices()[j],atOne.getElements()[j]); // if the lifted coefficient is non-zero (i.e. psi_j != cutRhs), add it // to the cut if (fabs(psi_j-cutRhs)>epsilon_) cut.insert(atOne.getIndices()[j],psi_j-cutRhs); #ifdef CGL_DEBUG assert ( fabs(atOne.getElements()[j])> epsilon_ ); #else if ( fabs(atOne.getElements()[j])<= epsilon_ ) { // exit gracefully cutRhs = COIN_DBL_MAX; break; } #endif ratio[atOne.getIndices()[j]]=(psi_j-cutRhs)/atOne.getElements()[j]; // update cutRhs and unsatRhs cutRhs = psi_j ; unsatRhs += atOne.getElements()[j]; CoinDecrSolutionOrdered dso(ratio); a.sort(dso); alpha.sort(dso); } #if 0 for (j=firstZero; j=alpha_2/a_2>=...>=alpha_n/a_n order // check if lifted var can take value 1 if (unsatRhs - remainder.getElements()[j] < epsilon_){ psi_j = cutRhs; } else { exactSolveKnapsack(alpha.getNumElements(), unsatRhs-remainder.getElements()[j], alpha.getElements(),a.getElements(),psi_j,x); } // assert the new coefficient is nonegative? alpha.insert(remainder.getIndices()[j],cutRhs-psi_j); a.insert(remainder.getIndices()[j],remainder.getElements()[j]); // if the lifted coefficient is non-zero // (i.e. psi_j != cutRhs), add it to the cut if (fabs(cutRhs-psi_j)>epsilon_) cut.insert(remainder.getIndices()[j],cutRhs-psi_j); ratio[remainder.getIndices()[j]]= (cutRhs-psi_j)/remainder.getElements()[j]; CoinDecrSolutionOrdered dso(ratio); a.sort(dso); alpha.sort(dso); } #endif delete [] x; delete [] ratio; #if GUBCOVER==2 if (numberCliques_) { const CoinPackedMatrix * matrixByRow = solver_->getMatrixByRow(); //const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); //const double * rowUpper = solver_->getRowUpper(); //const double * rowLower = solver_->getRowLower(); int numberColumns = solver_->getNumCols(); double * els = elements_; double * els2 = els+numberColumns; double * weightClique = els2+numberColumns; double * weightClique2 = weightClique+numberCliques_; double * temp=weightClique2+2*numberColumns; //int * count = reinterpret_cast(temp); int * indices = reinterpret_cast (temp+numberCliques_); //int * whichClique = indices+numberColumns; for (i=rowStart[whichRow_];igetNumCols(); #ifdef PRINT_DEBUG CoinZeroN(els,numberColumns); //temp for (i=0;i cover.getNumElements()-1, un-complement // and add it to the pool. double sum=0; for (i=0; i cutRhs+epsilon2_){ #ifdef PRINT_DEBUG printf("Sequentially lifted UpDown cover cut of "); printf("size %i derived from fracCover of size %i.\n", cut.getNumElements(), fracCover.getNumElements()); for (i=0; i=0); assert(elements[k]); assert (fabs(elements[k])>1.0e-12); } } #endif rc.setLb(-COIN_DBL_MAX); rc.setUb(cutRhs); // ToDo: what's the default effectiveness? // rc.setEffectiveness(1.0); // Add row cut to the cut set #ifdef PRINT_DEBUG { int k; printf("cutrhs %g %d elements\n",cutRhs,cut.getNumElements()); double * elements = cut.getElements(); int * indices = cut.getIndices(); for (k=0; k 0){ // What order to lift? // Take the to-be-lifted vars in decreasing order of their // xstar solution value. Sort remainder in order of decreasing // xstar value. CoinDecrSolutionOrdered dso1(xstar); remainder.sort(dso1); // a is the part of krow corresponding to vars which have been lifted // alpha are the lifted coefficients with explicit storage of lifted zero // coefficients the a.getIndices() and alpha.getIndices() are identical CoinPackedVector a(cover); CoinPackedVector alpha; int i; for (i=0; i= alpha_2/a_2 >= ... >= alpha_n/a_n // by defining this full-storage array "ratio" to be the external sort key. double * ratio= new double[nCols]; memset(ratio, 0, (nCols*sizeof(double))); #ifdef CGL_DEBUG int alphasize = alpha.getNumElements(); int asize = a.getNumElements(); assert( alphasize == asize ); #endif for (i=0; i epsilon_ ){ ratio[a.getIndices()[i]]=alpha.getElements()[i]/a.getElements()[i]; } else { ratio[a.getIndices()[i]] = 0.0; } } // ToDo: would be nice to have sortkey NOT be full-storage vector CoinDecrSolutionOrdered dso2(ratio); // RLH: JP, Is there a more efficient way? // The sort is identical for a and alpha, but I'm having to sort twice // here, and at every iteration in the loop below. a.sort(dso2); alpha.sort(dso2); #ifdef CGL_DEBUG // sanity check for ( i=1; i=alpha_2/a_2>=...>=alpha_n/a_n order exactSolveKnapsack(alpha.getNumElements(), b-remainder.getElements()[j], alpha.getElements(),a.getElements(),psi_j,x); alpha.insert(remainder.getIndices()[j],cutRhs-psi_j); a.insert(remainder.getIndices()[j],remainder.getElements()[j]); // if the lifted coefficient is non-zero (i.e. psi_j != cutRhs), add it // to the cut if (fabs(cutRhs-psi_j)>epsilon_) cut.insert(remainder.getIndices()[j],cutRhs-psi_j); ratio[remainder.getIndices()[j]]= (cutRhs-psi_j)/remainder.getElements()[j]; CoinDecrSolutionOrdered dso(ratio); a.sort(dso); alpha.sort(dso); } delete [] x; delete [] ratio; } // If the cut is violated, add it to the pool // if (sum over cut.getIndices()) // cut.element()*xstar > cover.getNumElements()-1, un-complement // and add it to the pool. double sum=0; int i; for (i=0; i cutRhs+epsilon2_){ #ifdef PRINT_DEBUG printf("Sequentially lifted cover cut of size %i derived from cover of size %i.\n",cut.getNumElements(), cover.getNumElements()); for (i=0; i=0); assert(elements[k]); assert (fabs(elements[k])>1.0e-12); } } #endif rc.setLb(-COIN_DBL_MAX); rc.setUb(cutRhs); // ToDo: what's a meaningful effectivity? // rc.setEffectiveness(1.0); #ifdef PRINT_DEBUG { int k; printf("cutrhs %g\n",cutRhs); double * elements = cut.getElements(); int * indices = cut.getIndices(); for (k=0; k=a_1>=...>=a_(nCover-1) // TODO: right now if the lifted coefficient is zero, // then it's still in the cut. // Should not carry explicit zero coefficients // Calculate the sum of the knapsack coefficients of the cover variables double sum = cover.sum(); // Define lambda to be the "cover excess". // By definition, lambda > 0. If this is not the case, something's screwy. Exit gracefully. double lambda = sum-b; if (lambda < epsilon2_) { #ifdef PRINT_DEBUG printf("lambda < epsilon....aborting. \n"); std::cout << "lambda " << lambda << " epsilon " << epsilon_ << std::endl; //abort(); #else //std::cout << "lambda " << lambda << " exiting" << std::endl; #endif return 0; } // mu is vector of partial sums: // mu[i] = sum(j=0 to i) a_j where the cover is C={0,1,..,r} // mu[0] = 0, mu[1]=a_0, mu[2]=a_0+a_1, etc. // and C is assumed to be sorted in nondecreasing knapsack coefficient order. double * mu= new double[cover.getNumElements()+1]; double * muMinusLambda= new double[cover.getNumElements()+1]; memset(mu, 0, (cover.getNumElements()+1)*sizeof(double)); memset(muMinusLambda, 0, (cover.getNumElements()+1)*sizeof(double)); // mu[0] = 0, mu[1]= knapsack coef of cover element 0, etc. muMinusLambda[0]= -lambda; for(i=1; i<(cover.getNumElements()+1); i++){ mu[i]=mu[i-1]+ cover.getElements()[i-1]; muMinusLambda[i]=mu[i]-lambda; } cut.reserve(nRowElem); // the cut coefficent for the members of the cover is 1.0 cut.setConstant(cover.getNumElements(),cover.getIndices(),1.0); // if f(z) is superadditive int h; if (muMinusLambda[1] >= cover.getElements()[1]-epsilon_){ for (h=0; h(i) ); found=1; } else if (remainder.getElements()[h] < muMinusLambda[i+1]+rho[i+1]){ #ifdef CGL_DEBUG bool notE = !cut.isExistingIndex(remainder.getIndices()[h]); assert( notE ); #endif double cutCoef = i+1 - (muMinusLambda[i+1]+rho[i+1]-remainder.getElements()[h])/rho[1]; if (fabs(cutCoef)>epsilon_) cut.insert( remainder.getIndices()[h], cutCoef ); found=1; } i++; } // endwhile } // end for j not in C delete [] rho; } // end else use g delete [] muMinusLambda; delete [] mu; #ifdef GUBCOVER if (goodCut&&numberCliques_) { int n = cut.getNumElements(); const int * ind3; const double * els3; ind3 = cut.getIndices(); els3 = cut.getElements(); const CoinPackedMatrix * matrixByRow = solver_->getMatrixByRow(); const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); int numberColumns = solver_->getNumCols(); double * els = elements_; double * els2 = els+numberColumns; for (i=0;i=0) { for (int j=oneFixStart_[iColumn];j=fabs(els2[iColumn])) { #if CGL_DEBUG if (!found) { found=true; printf("Good cut can be improved"); for (i=0;igetMatrixByRow(); const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); int numberColumns = solver_->getNumCols(); double * els = elements_; double * els2 = els+numberColumns; bool good = true; for (int i=0;i=0) { for (int j=oneFixStart_[iColumn];j=fabs(els2[iColumn])) { #if CGL_DEBUG bool found=false; if (!found) { found=true; printf("Good cut can be improved"); for (int i=0;i= p_2/w_2 >= ... >= p_n/w_n memset(x, 0, (n)*sizeof(int)); int * xhat = new int[n+1]; memset(xhat, 0, (n+1)*sizeof(int)); int j; // set up: adding the extra element and // accounting for the FORTRAN vs C difference in indexing arrays. double * p = new double[n+2]; double * w = new double[n+2]; int ii; for (ii=1; iichat};" ii=j; double wSemiSum = w[j]; double pSemiSum = p[j]; while (wSemiSum <= chat && ii= zhat + u) goto 5: backtrack;" if (!(z >= zhat + u)) { do { // 3. perform a forward step while (w[j] <= chat){ chat = chat - w[j]; zhat = zhat + p[j]; xhat[j] = 1; j+=1; } if (j<=n) { xhat[j]= 0; j+=1; } } while(j==n); // "if (j z) { z=zhat; int k; for (k=0; k0){ i--; } // "if (no such i exists) return;" if (i==0){ delete [] p; delete [] w; delete [] xhat; return 1; } chat = chat + w[i]; zhat=zhat -p[i]; xhat[i]=0; j=i+1; // "goto 2: compute_ub;" } } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglKnapsackCover::CglKnapsackCover () : CglCutGenerator(), epsilon_(1.0e-07), epsilon2_(1.0e-5), onetol_(1-epsilon_), maxInKnapsack_(50), numRowsToCheck_(-1), rowsToCheck_(0), expensiveCuts_(false) { numberCliques_=0; numberColumns_=0; cliqueType_=NULL; cliqueStart_=NULL; cliqueEntry_=NULL; oneFixStart_=NULL; zeroFixStart_=NULL; endFixStart_=NULL; whichClique_=NULL; canDoGlobalCuts_=true; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglKnapsackCover::CglKnapsackCover (const CglKnapsackCover & source) : CglCutGenerator(source), epsilon_(source.epsilon_), epsilon2_(source.epsilon2_), onetol_(source.onetol_), maxInKnapsack_(source.maxInKnapsack_), numRowsToCheck_(source.numRowsToCheck_), rowsToCheck_(0), expensiveCuts_(source.expensiveCuts_) { if (numRowsToCheck_ > 0) { rowsToCheck_ = new int[numRowsToCheck_]; CoinCopyN(source.rowsToCheck_, numRowsToCheck_, rowsToCheck_); } numberCliques_=source.numberCliques_; numberColumns_=source.numberColumns_; if (numberCliques_) { cliqueType_ = new CliqueType [numberCliques_]; CoinMemcpyN(source.cliqueType_,numberCliques_,cliqueType_); cliqueStart_ = new int [numberCliques_+1]; CoinMemcpyN(source.cliqueStart_,(numberCliques_+1),cliqueStart_); int n = cliqueStart_[numberCliques_]; cliqueEntry_ = new CliqueEntry [n]; CoinMemcpyN(source.cliqueEntry_,n,cliqueEntry_); oneFixStart_ = new int [numberColumns_]; CoinMemcpyN(source.oneFixStart_,numberColumns_,oneFixStart_); zeroFixStart_ = new int [numberColumns_]; CoinMemcpyN(source.zeroFixStart_,numberColumns_,zeroFixStart_); endFixStart_ = new int [numberColumns_]; CoinMemcpyN(source.endFixStart_,numberColumns_,endFixStart_); #ifndef NDEBUG int n2=-1; for (int i=numberColumns_-1;i>=0;i--) { if (oneFixStart_[i]>=0) { n2=endFixStart_[i]; break; } } assert (n==n2); #endif whichClique_ = new int [n]; CoinMemcpyN(source.whichClique_,n,whichClique_); } else { cliqueType_=NULL; cliqueStart_=NULL; cliqueEntry_=NULL; oneFixStart_=NULL; zeroFixStart_=NULL; endFixStart_=NULL; whichClique_=NULL; } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglKnapsackCover::clone() const { return new CglKnapsackCover(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglKnapsackCover::~CglKnapsackCover () { delete[] rowsToCheck_; deleteCliques(); } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglKnapsackCover & CglKnapsackCover::operator=(const CglKnapsackCover& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); epsilon_=rhs.epsilon_; epsilon2_=rhs.epsilon2_; onetol_=rhs.onetol_; maxInKnapsack_=rhs.maxInKnapsack_; delete[] rowsToCheck_; numRowsToCheck_ = rhs.numRowsToCheck_; if (numRowsToCheck_ > 0) { rowsToCheck_ = new int[numRowsToCheck_]; CoinCopyN(rhs.rowsToCheck_, numRowsToCheck_, rowsToCheck_); } else { rowsToCheck_ = 0; } expensiveCuts_ = rhs.expensiveCuts_; deleteCliques(); numberCliques_=rhs.numberCliques_; numberColumns_=rhs.numberColumns_; if (numberCliques_) { cliqueType_ = new CliqueType [numberCliques_]; CoinMemcpyN(rhs.cliqueType_,numberCliques_,cliqueType_); cliqueStart_ = new int [numberCliques_+1]; CoinMemcpyN(rhs.cliqueStart_,(numberCliques_+1),cliqueStart_); int n = cliqueStart_[numberCliques_]; cliqueEntry_ = new CliqueEntry [n]; CoinMemcpyN(rhs.cliqueEntry_,n,cliqueEntry_); oneFixStart_ = new int [numberColumns_]; CoinMemcpyN(rhs.oneFixStart_,numberColumns_,oneFixStart_); zeroFixStart_ = new int [numberColumns_]; CoinMemcpyN(rhs.zeroFixStart_,numberColumns_,zeroFixStart_); endFixStart_ = new int [numberColumns_]; CoinMemcpyN(rhs.endFixStart_,numberColumns_,endFixStart_); #ifndef NDEBUG int n2=-1; for (int i=numberColumns_-1;i>=0;i--) { if (oneFixStart_[i]>=0) { n2=endFixStart_[i]; break; } } assert (n==n2); #endif whichClique_ = new int [n]; CoinMemcpyN(rhs.whichClique_,n,whichClique_); } } return *this; } // Create C++ lines to get to current state std::string CglKnapsackCover::generateCpp( FILE * fp) { CglKnapsackCover other; fprintf(fp,"0#include \"CglKnapsackCover.hpp\"\n"); fprintf(fp,"3 CglKnapsackCover knapsackCover;\n"); if (maxInKnapsack_!=other.maxInKnapsack_) fprintf(fp,"3 knapsackCover.setMaxInKnapsack(%d);\n",maxInKnapsack_); else fprintf(fp,"4 knapsackCover.setMaxInKnapsack(%d);\n",maxInKnapsack_); if (expensiveCuts_ != other.expensiveCuts_) { if (expensiveCuts_) fprintf(fp,"3 knapsackCover.switchOnExpensive();\n"); else fprintf(fp,"3 knapsackCover.switchOffExpensive();\n"); } else { if (expensiveCuts_) fprintf(fp,"4 knapsackCover.switchOnExpensive();\n"); else fprintf(fp,"4 knapsackCover.switchOffExpensive();\n"); } if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 knapsackCover.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 knapsackCover.setAggressiveness(%d);\n",getAggressiveness()); return "knapsackCover"; } // This can be used to refresh any information void CglKnapsackCover::refreshSolver(OsiSolverInterface * solver) { #ifdef GUBCOVER deleteCliques(); if (solver->getMatrixByCol()) createCliques( *solver,2,200,false); #endif } /* Creates cliques for use by probing. Can also try and extend cliques as a result of probing (root node). Returns number of cliques found. */ int CglKnapsackCover::createCliques( OsiSolverInterface & si, int minimumSize, int maximumSize, bool /*extendCliques*/) { // Should be 0 unless you're debugging! const int logLevel = 0 ; // get rid of what is there deleteCliques(); CoinPackedMatrix matrixByRow(*si.getMatrixByRow()); int numberRows = si.getNumRows(); numberColumns_ = si.getNumCols(); numberCliques_=0; int numberEntries=0; int numberIntegers=0; int * lookup = new int[numberColumns_]; int i; for (i=0;i0.0) { which[numberP1++]=iColumn; } else { numberM1++; which[numberIntegers-numberM1]=iColumn; } } int iUpper = static_cast (floor(upperValue+1.0e-5)); int iLower = static_cast (ceil(lowerValue-1.0e-5)); int state=0; if (upperValue<1.0e6) { if (iUpper==1-numberM1) state=1; else if (iUpper==-numberM1) state=2; else if (iUpper<-numberM1) state=3; } if (!state&&lowerValue>-1.0e6) { if (-iLower==1-numberP1) state=-1; else if (-iLower==-numberP1) state=-2; else if (-iLower<-numberP1) state=-3; } if (good&&state) { if (abs(state)==3) { // infeasible numberCliques_ = -99999; break; } else if (abs(state)==2) { // we can fix all numberFixed += numberP1+numberM1; if (state>0) { // fix all +1 at 0, -1 at 1 for (i=0;i1) printf("bad clique %d +1, %d -1\n", numberP1,numberM1); length=0; } totalP1 += numberP1; totalM1 += numberM1; if (length >= minimumSize&&length= maximumSize) { // too big numberBig++; totalBig += length; } } } } if (logLevel > 0) { if (numberCliques_<0) { printf("*** Problem infeasible\n"); } else { if (numberCliques_) { if (logLevel>1) printf("%d cliques of average size %g found, %d P1, %d M1\n", numberCliques_, (static_cast(totalP1+totalM1))/ (static_cast (numberCliques_)), totalP1,totalM1); } else { if (logLevel>1) printf("No cliques found\n"); } if (numberBig) { if (logLevel>1) printf("%d large cliques ( >= %d) found, total %d\n", numberBig,maximumSize,totalBig); } if (numberFixed) { printf("%d variables fixed\n",numberFixed); } } } if (numberCliques_>0) { cliqueType_ = new CliqueType [numberCliques_]; cliqueStart_ = new int [numberCliques_+1]; cliqueEntry_ = new CliqueEntry [numberEntries]; oneFixStart_ = new int [numberColumns_]; zeroFixStart_ = new int [numberColumns_]; endFixStart_ = new int [numberColumns_]; whichClique_ = new int [numberEntries]; numberEntries=0; cliqueStart_[0]=0; for (i=0;i0.0) { which[numberP1++]=iColumn; } else { numberM1++; which[numberIntegers-numberM1]=iColumn; } } int iUpper = static_cast (floor(upperValue+1.0e-5)); int iLower = static_cast (ceil(lowerValue-1.0e-5)); int state=0; if (upperValue<1.0e6) { if (iUpper==1-numberM1) state=1; } if (!state&&lowerValue>-1.0e6) { state=-1; } if (abs(state)!=1) continue; // must have been fixed if (iLower==iUpper) { cliqueType_[numberCliques_].equality=1; } else { cliqueType_[numberCliques_].equality=0; } if (state>0) { for (i=0;i=0) { int n1=oneFixStart_[iColumn]; int n2=zeroFixStart_[iColumn]; oneFixStart_[iColumn]=numberEntries; which[iColumn]=numberEntries; numberEntries += n1; zeroFixStart_[iColumn]=numberEntries; endFixStart_[iColumn]=numberEntries; numberEntries += n2; } } // now put in for (iClique=0;iClique #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglKnapsackCover.hpp" #include "CoinPackedMatrix.hpp" //-------------------------------------------------------------------------- void CglKnapsackCoverUnitTest( const OsiSolverInterface * baseSiP, const std::string mpsDir ) { int i; CoinRelFltEq eq(0.000001); // Test default constructor { CglKnapsackCover kccGenerator; } // Test copy & assignment { CglKnapsackCover rhs; { CglKnapsackCover kccGenerator; CglKnapsackCover cgC(kccGenerator); rhs=kccGenerator; } } // test exactSolveKnapsack { CglKnapsackCover kccg; const int n=7; double c=50; double p[n] = {70,20,39,37,7,5,10}; double w[n] = {31, 10, 20, 19, 4, 3, 6}; double z; int x[n]; int exactsol = kccg.exactSolveKnapsack(n, c, p, w, z, x); assert(exactsol==1); assert (z == 107); assert (x[0]==1); assert (x[1]==0); assert (x[2]==0); assert (x[3]==1); assert (x[4]==0); assert (x[5]==0); assert (x[6]==0); } /* // Testcase /u/rlh/osl2/mps/scOneInt.mps // Model has 3 continous, 2 binary, and 1 general // integer variable. { OsiSolverInterface * siP = baseSiP->clone(); int * complement=NULL; double * xstar=NULL; siP->readMps("../Mps/scOneInt","mps"); CglKnapsackCover kccg; int nCols=siP->getNumCols(); // Test the siP methods for detecting // variable type int numCont=0, numBinary=0, numIntNonBinary=0, numInt=0; for (int thisCol=0; thisColisContinuous(thisCol) ) numCont++; if ( siP->isBinary(thisCol) ) numBinary++; if ( siP->isIntegerNonBinary(thisCol) ) numIntNonBinary++; if ( siP->isInteger(thisCol) ) numInt++; } assert(numCont==3); assert(numBinary==2); assert(numIntNonBinary==1); assert(numInt==3); // Test initializeCutGenerator siP->initialSolve(); assert(xstar !=NULL); for (i=0; igetNumRows(); for (i=0; igetMatrixByRow()->vectorSize(i); assert(vectorsize==2); } kccg.cleanUpCutGenerator(complement,xstar); delete siP; } */ // Testcase /u/rlh/osl2/mps/tp3.mps // Models has 3 cols, 3 rows // Row 0 yields a knapsack, others do not. { // setup OsiSolverInterface * siP = baseSiP->clone(); std::string fn(mpsDir+"tp3"); siP->readMps(fn.c_str(),"mps"); // All integer variables should be binary. // Assert that this is true. for ( i = 0; i < siP->getNumCols(); i++ ) if ( siP->isInteger(i) ) assert(siP->getColUpper()[i]==1.0 && siP->isBinary(i)); OsiCuts cs; CoinPackedVector krow; double b=0; int nCols=siP->getNumCols(); int * complement=new int [nCols]; double * xstar=new double [nCols]; CglKnapsackCover kccg; // solve LP relaxation // a "must" before calling initialization siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); std::cout<<"Initial LP value: "<getObjValue(), 97.185) ); double mycs[] = {.627, .667558333333, .038}; siP->setColSolution(mycs); const double *colsol = siP->getColSolution(); int k; for (k=0; kgetRowSense()[0] == 'N' ) ? 1 : 0; const CoinShallowPackedVector reqdBySunCC = siP->getMatrixByRow()->getVector(rind) ; int deriveaknap = kccg.deriveAKnapsack(*siP, cs, krow,b,complement,xstar,rind,reqdBySunCC); assert(deriveaknap ==1); assert(complement[0]==0); assert(complement[1]==1); assert(complement[2]==1); int inx[3] = {0,1,2}; double el[3] = {161, 120, 68}; CoinPackedVector r; r.setVector(3,inx,el); assert (krow == r); //assert (b == 183.0); ????? but x1 and x2 at 1 is valid // test findGreedyCover CoinPackedVector cover,remainder; #if 0 int findgreedy = kccg.findGreedyCover( 0, krow, b, xstar, cover, remainder ); assert( findgreedy == 1 ); int coveri = cover.getNumElements(); assert( cover.getNumElements() == 2); coveri = cover.getIndices()[0]; assert( cover.getIndices()[0] == 0); assert( cover.getIndices()[1] == 1); assert( cover.getElements()[0] == 161.0); assert( cover.getElements()[1] == 120.0); assert( remainder.getNumElements() == 1); assert( remainder.getIndices()[0] == 2); assert( remainder.getElements()[0] == 68.0); // test liftCoverCut CoinPackedVector cut; double * rowupper = ekk_rowupper(model); double cutRhs = cover.getNumElements() - 1.0; kccg.liftCoverCut(b, krow.getNumElements(), cover, remainder, cut); assert ( cut.getNumElements() == 3 ); assert ( cut.getIndices()[0] == 0 ); assert ( cut.getIndices()[1] == 1 ); assert ( cut.getIndices()[2] == 2 ); assert( cut.getElements()[0] == 1 ); assert( cut.getElements()[1] == 1 ); assert( eq(cut.getElements()[2], 0.087719) ); // test liftAndUncomplementAndAdd OsiCuts cuts; kccg.liftAndUncomplementAndAdd(*siP.getRowUpper()[0],krow,b,complement,0, cover,remainder,cuts); int sizerowcuts = cuts.sizeRowCuts(); assert ( sizerowcuts== 1 ); OsiRowCut testRowCut = cuts.rowCut(0); CoinPackedVector testRowPV = testRowCut.row(); OsiRowCut sampleRowCut; const int sampleSize = 3; int sampleCols[sampleSize]={0,1,2}; double sampleElems[sampleSize]={1.0,-1.0,-0.087719}; sampleRowCut.setRow(sampleSize,sampleCols,sampleElems); sampleRowCut.setLb(-DBL_MAX); sampleRowCut.setUb(-0.087719); bool equiv = testRowPV.equivalent(sampleRowCut.row(),CoinRelFltEq(1.0e-05) ); assert ( equiv ); #endif // test find PseudoJohnAndEllisCover cover.setVector(0,NULL, NULL); remainder.setVector(0,NULL,NULL); rind = ( siP->getRowSense()[0] == 'N' ) ? 1 : 0; int findPJE = kccg.findPseudoJohnAndEllisCover( rind, krow, b, xstar, cover, remainder ); assert( findPJE == 1 ); assert ( cover.getIndices()[0] == 0 ); assert ( cover.getIndices()[1] == 2 ); assert ( cover.getElements()[0] == 161 ); assert ( cover.getElements()[1] == 68 ); assert ( remainder.getIndices()[0] == 1 ); assert ( remainder.getElements()[0] == 120 ); OsiCuts cuts; kccg.liftAndUncomplementAndAdd((*siP).getRowUpper()[rind],krow,b, complement, rind, cover,remainder,cuts); assert (cuts.sizeRowCuts() == 1 ); OsiRowCut testRowCut = cuts.rowCut(0); CoinPackedVector testRowPV = testRowCut.row(); const int sampleSize = 3; int sampleCols[sampleSize]={0,1,2}; double sampleElems[sampleSize]={1.0, -1.0, -1.0}; OsiRowCut sampleRowCut; sampleRowCut.setRow(sampleSize,sampleCols,sampleElems); sampleRowCut.setLb(-COIN_DBL_MAX); sampleRowCut.setUb(-1.0); // test for 'close enough' assert( testRowPV.isEquivalent(sampleRowCut.row(),CoinRelFltEq(1.0e-05) ) ); // Reset complement & test next row for (i=0; igetMatrixByRow()->getVector(rind) ; deriveaknap = kccg.deriveAKnapsack(*siP,cuts,krow,b,complement,xstar,rind,reqdBySunCC2); assert(deriveaknap==0); // Reset complement & test next row for (i=0; igetMatrixByRow()->getVector(2) ; deriveaknap = kccg.deriveAKnapsack(*siP,cuts,krow,b,complement,xstar,2, reqdBySunCC3); assert(deriveaknap == 0); // Clean up delete [] complement; delete [] xstar; delete siP; } #if 0 // Testcase /u/rlh/osl2/mps/tp4.mps // Models has 6 cols, 1 knapsack row and // 3 rows explicily bounding variables // Row 0 yields a knapsack cover cut // using findGreedyCover which moves the // LP objective function value. { // Setup EKKContext * env=ekk_initializeContext(); EKKModel * model = ekk_newModel(env,""); OsiSolverInterface si(model); ekk_importModel(model, "tp4.mps"); CglKnapsackCover kccg; kccg.ekk_validateIntType(si); // Solve the LP relaxation of the model and // print out ofv for sake of comparison ekk_allSlackBasis(model); ekk_crash(model,1); ekk_primalSimplex(model,1); double lpRelaxBefore=ekk_getRobjvalue(model); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); #endif // Determine if lp sol is ip optimal // Note: no ekk_function to do this int nCols=ekk_getInumcols(model); double * optLpSol = ekk_colsol(model); int ipOpt = 1; i=0; while (i++ 1.0e-08) ipOpt = 0; } if (ipOpt){ #ifdef CGL_DEBUG printf("Lp solution is within ip optimality tolerance\n"); #endif } else { OsiSolverInterface iModel(model); OsiCuts cuts; // Test generateCuts method kccg.generateCuts(iModel,cuts); OsiSolverInterface::ApplyCutsReturnCode rc = iModel.applyCuts(cuts); ekk_mergeBlocks(model,1); ekk_dualSimplex(model); double lpRelaxAfter=ekk_getRobjvalue(model); #ifdef CGL_DEBUG printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif assert( lpRelaxBefore < lpRelaxAfter ); // This may need to be updated as other // minimal cover finders are added assert( cuts.sizeRowCuts() == 1 ); OsiRowCut testRowCut = cuts.rowCut(0); CoinPackedVector testRowPV = testRowCut.row(); OsiRowCut sampleRowCut; const int sampleSize = 6; int sampleCols[sampleSize]={0,1,2,3,4,5}; double sampleElems[sampleSize]={1.0,1.0,1.0,1.0,0.5, 2.0}; sampleRowCut.setRow(sampleSize,sampleCols,sampleElems); sampleRowCut.setLb(-DBL_MAX); sampleRowCut.setUb(3.0); bool equiv = testRowPV.equivalent(sampleRowCut.row(),CoinRelFltEq(1.0e-05) ); assert( testRowPV.equivalent(sampleRowCut.row(),CoinRelFltEq(1.0e-05) ) ); } // Exit out of OSL ekk_deleteModel(model); ekk_endContext(env); } #endif // Testcase /u/rlh/osl2/mps/tp5.mps // Models has 6 cols, 1 knapsack row and // 3 rows explicily bounding variables // Row 0 yields a knapsack cover cut // using findGreedyCover which moves the // LP objective function value. { // Setup OsiSolverInterface * siP = baseSiP->clone(); std::string fn(mpsDir+"tp5"); siP->readMps(fn.c_str(),"mps"); // All integer variables should be binary. // Assert that this is true. for ( i = 0; i < siP->getNumCols(); i++ ) if ( siP->isInteger(i) ) assert(siP->getColUpper()[i]==1.0 && siP->isBinary(i)); CglKnapsackCover kccg; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, -51.66666666667) ); double mycs[] = {.8999999999, .899999999999, .89999999999, 1.110223e-16, .5166666666667, 0}; siP->setColSolution(mycs); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); #endif // Determine if lp sol is 0/1 optimal int nCols=siP->getNumCols(); const double * optLpSol = siP->getColSolution(); bool ipOpt = true; i=0; while (i++ kccg.epsilon_ && optLpSol[i] < kccg.onetol_) ipOpt = false; } if (ipOpt){ #ifdef CGL_DEBUG printf("Lp solution is within ip optimality tolerance\n"); #endif } else { // set up OsiCuts cuts; CoinPackedVector krow; double b=0.0; int * complement=new int[nCols]; double * xstar=new double[nCols]; // initialize cut generator const double *colsol = siP->getColSolution(); for (i=0; igetRowSense()[0] == 'N' ) ? 1 : 0; // transform row into canonical knapsack form const CoinShallowPackedVector reqdBySunCC = siP->getMatrixByRow()->getVector(row) ; if (kccg.deriveAKnapsack(*siP, cuts, krow, b, complement, xstar, row,reqdBySunCC)){ CoinPackedVector cover, remainder; // apply greedy logic to detect violated minimal cover inequalities if (kccg.findGreedyCover(row, krow, b, xstar, cover, remainder) == 1){ // lift, uncomplements, and add cut to cut set kccg.liftAndUncomplementAndAdd((*siP).getRowUpper()[row],krow, b, complement, row, cover, remainder, cuts); } // reset optimal column solution (xstar) information in OSL const double * rowupper = siP->getRowUpper(); int k; if (fabs(b-rowupper[row]) > 1.0e-05) { for(k=0; kapplyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); assert( eq(lpRelaxAfter, -30.0) ); #ifdef CGL_DEBUG printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif // test that expected cut was detected assert( lpRelaxBefore < lpRelaxAfter ); assert( cuts.sizeRowCuts() == 1 ); OsiRowCut testRowCut = cuts.rowCut(0); CoinPackedVector testRowPV = testRowCut.row(); OsiRowCut sampleRowCut; const int sampleSize = 6; int sampleCols[sampleSize]={0,1,2,3,4,5}; double sampleElems[sampleSize]={1.0,1.0,1.0,0.25,1.0,2.0}; sampleRowCut.setRow(sampleSize,sampleCols,sampleElems); sampleRowCut.setLb(-COIN_DBL_MAX); sampleRowCut.setUb(3.0); assert(testRowPV.isEquivalent(sampleRowCut.row(),CoinRelFltEq(1.0e-05))); } delete siP; } // Testcase /u/rlh/osl2/mps/p0033 // Miplib3 problem p0033 // Test that no cuts chop off the optimal solution { // Setup OsiSolverInterface * siP = baseSiP->clone(); std::string fn(mpsDir+"p0033"); siP->readMps(fn.c_str(),"mps"); // All integer variables should be binary. // Assert that this is true. for ( i = 0; i < siP->getNumCols(); i++ ) if ( siP->isInteger(i) ) assert(siP->getColUpper()[i]==1.0 && siP->isBinary(i)); int nCols=siP->getNumCols(); CglKnapsackCover kccg; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, 2520.5717391304347) ); double mycs[] = {0, 1, 0, 0, -2.0837010502455788e-19, 1, 0, 0, 1, 0.021739130434782594, 0.35652173913043478, -6.7220534694101275e-18, 5.3125906451789717e-18, 1, 0, 1.9298798670241979e-17, 0, 0, 0, 7.8875708048320448e-18, 0.5, 0, 0.85999999999999999, 1, 1, 0.57999999999999996, 1, 0, 1, 0, 0.25, 0, 0.67500000000000004}; siP->setColSolution(mycs); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); #endif OsiCuts cuts; // Test generateCuts method kccg.generateCuts(*siP,cuts); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); assert( eq(lpRelaxAfter, 2829.0597826086955) ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif assert( lpRelaxBefore < lpRelaxAfter ); // the CoinPackedVector p0033 is the optimal // IP solution to the miplib problem p0033 int objIndices[14] = { 0, 6, 7, 9, 13, 17, 18, 22, 24, 25, 26, 27, 28, 29 }; CoinPackedVector p0033(14,objIndices,1.0); // Sanity check const double * objective=siP->getObjCoefficients(); double ofv =0 ; int r; for (r=0; rclone(); double lo=-1.0e30; double * upper = new double[ncol]; start[ncol]=nel; int last=0; for (i=0;iloadProblem(ncol,1,start,row,el1,NULL,upper,NULL,&lo,&up); // use upper for solution memset(upper,0,ncol*sizeof(double)); for (i=0;isetInteger(icol); } siP->setColSolution(upper); delete [] sol1; delete [] el1; delete [] col1; delete [] start; delete [] row; delete [] upper; CglKnapsackCover kccg; OsiCuts cuts; // Test generateCuts method kccg.generateCuts(*siP,cuts); // print out and compare to known cuts int numberCuts = cuts.sizeRowCuts(); if (numberCuts) { for (i=0;irow().getNumElements(); printf("Cut %d has %d entries, rhs %g %g =>",i,n,thisCut->lb(), thisCut->ub()); int j; const int * index = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); for (j=0;jclone(); std::string fn(mpsDir+"p0201"); siP->readMps(fn.c_str(),"mps"); // All integer variables should be binary. // Assert that this is true. for ( i = 0; i < siP->getNumCols(); i++ ) if ( siP->isInteger(i) ) assert(siP->getColUpper()[i]==1.0 && siP->isBinary(i)); const int nCols=siP->getNumCols(); CglKnapsackCover kccg; // Solve the LP relaxation of the model and // print out ofv for sake of comparisn siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, 6875.) ); double mycs[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; siP->setColSolution(mycs); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); #endif OsiCuts cuts; // Test generateCuts method kccg.generateCuts(*siP,cuts); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); assert( eq(lpRelaxAfter, 7125) ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif assert( lpRelaxBefore < lpRelaxAfter ); // Optimal IP solution to p0201 int objIndices[22] = { 8, 10, 21, 38, 39, 56, 60, 74, 79, 92, 94, 110, 111, 128, 132, 146, 151,164, 166, 182,183, 200 }; CoinPackedVector p0201(22,objIndices,1.0); // Sanity check const double * objective=siP->getObjCoefficients(); double ofv =0 ; int r; for (r=0; rclone(); std::string fn(mpsDir+"nw460"); siP->readMps(fn.c_str(),"mps"); // All integer variables should be binary. // Assert that this is true. for ( i = 0; i < siP->getNumCols(); i++ ) if ( siP->isInteger(i) ) assert(siP->getColUpper()[i]==1.0 && siP->isBinary(i)); CglKnapsackCover kccg; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, -225.68951787852194) ); double mycs[] = {0.7099213482046447, 0, 0.34185802225477174, 1, 1, 0, 1, 1, 0}; siP->setColSolution(mycs); OsiCuts cuts; // Test generateCuts method kccg.generateCuts(*siP,cuts); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); assert( eq(lpRelaxAfter, -176) ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif #ifdef MJS assert( lpRelaxBefore < lpRelaxAfter ); #endif int nRowCuts = cuts.sizeRowCuts(); OsiRowCut rcut; CoinPackedVector rpv; for (i=0; iclone(); std::string fn(mpsDir+"exmip1"); siP->readMps(fn.c_str(),"mps"); // All integer variables should be binary. // Assert that this is true. for ( i = 0; i < siP->getNumCols(); i++ ) if ( siP->isInteger(i) ) assert(siP->getColUpper()[i]==1.0 && siP->isBinary(i)); CglKnapsackCover kccg; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, 3.2368421052631575) ); double mycs[] = {2.5, 0, 0, 0.6428571428571429, 0.5, 4, 0, 0.26315789473684253}; siP->setColSolution(mycs); // Test generateCuts method OsiCuts cuts; kccg.generateCuts(*siP,cuts); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); assert( eq(lpRelaxAfter, 3.2368421052631575) ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif assert( lpRelaxBefore <= lpRelaxAfter ); delete siP; } #ifdef CGL_DEBUG // See what findLPMostViolatedMinCover for knapsack with 2 elements does { int nCols = 2; int row = 1; CoinPackedVector krow; double e[2] = {5,10}; int ii[2] = {0,1}; krow.setVector(nCols,ii,e); double b=11; double xstar[2] = {.2,.9}; CoinPackedVector cover; CoinPackedVector remainder; CglKnapsackCover kccg; kccg.findLPMostViolatedMinCover(nCols, row, krow, b, xstar, cover, remainder); printf("num in cover = %i\n",cover.getNumElements()); int j; for (j=0; j #include #include #include #include #include #include "CoinPragma.hpp" #include "CglTreeInfo.hpp" #include "CoinHelperFunctions.hpp" #include "CoinSort.hpp" #include "CoinPackedMatrix.hpp" #include "CglStored.hpp" #include "OsiRowCut.hpp" // Default constructor CglTreeInfo::CglTreeInfo () : level(-1), pass(-1), formulation_rows(-1), options(0), inTree(false), strengthenRow(NULL),randomNumberGenerator(NULL) {} // Copy constructor CglTreeInfo::CglTreeInfo (const CglTreeInfo & rhs) : level(rhs.level), pass(rhs.pass), formulation_rows(rhs.formulation_rows), options(rhs.options), inTree(rhs.inTree), strengthenRow(rhs.strengthenRow), randomNumberGenerator(rhs.randomNumberGenerator) { } // Clone CglTreeInfo * CglTreeInfo::clone() const { return new CglTreeInfo(*this); } // Assignment operator CglTreeInfo & CglTreeInfo::operator=(const CglTreeInfo& rhs) { if (this != &rhs) { //CglCutGenerator::operator=(rhs); level = rhs.level; pass = rhs.pass; formulation_rows = rhs.formulation_rows; options = rhs.options; inTree = rhs.inTree; strengthenRow = rhs.strengthenRow; randomNumberGenerator = rhs.randomNumberGenerator; } return *this; } // Destructor CglTreeInfo::~CglTreeInfo () { } // Default constructor CglTreeProbingInfo::CglTreeProbingInfo () : CglTreeInfo(), fixEntry_(NULL), toZero_(NULL), toOne_(NULL), integerVariable_(NULL), backward_(NULL), fixingEntry_(NULL), numberVariables_(0), numberIntegers_(0), maximumEntries_(0), numberEntries_(-1) { } // Constructor from model CglTreeProbingInfo::CglTreeProbingInfo (const OsiSolverInterface * model) : CglTreeInfo(), fixEntry_(NULL), toZero_(NULL), toOne_(NULL), integerVariable_(NULL), backward_(NULL), fixingEntry_(NULL), numberVariables_(0), numberIntegers_(0), maximumEntries_(0), numberEntries_(-1) { numberVariables_=model->getNumCols(); // Too many ... but integerVariable_ = new int [numberVariables_]; backward_ = new int [numberVariables_]; int i; // Get integer types const char * columnType = model->getColType (true); for (i=0;iKEEP_CLIQUES) { int * sort = new int [numberCliques]; for (iClique=numberMatrixCliques;iCliqueallow) break; else nEqual++; } delete [] sort; int j=cliqueStart[numberMatrixCliques]; int put=j; int nClique=numberMatrixCliques; for (iClique=numberMatrixCliques;iCliqueallow) { copy=true; } else if (n==allow&&nEqual) { copy=true; nEqual--; } if (copy) { cliqueType[nClique++]=cliqueType[iClique]; for (;j(entry))+j); } // lexicographic sort int * which = new int [numberCliques]; int * position = new int [numberCliques]; int * sort = new int [numberCliques]; int * value = new int [numberCliques]; for (iClique=0;iCliqueiValue||position[kClique]jFirst) { // mark all apart from lowest number as duplicate and move on lastDone =jClique-1; for (jClique=jFirst;jClique<=lastDone;jClique++) { int kClique = which [jClique]; if (kClique!=iLowest) { value[kClique]=-2; nDup++; nSave += cliqueStart[kClique+1]-cliqueStart[kClique]; } } } } } if (printit) printf("%d duplicates\n",nDup); // Now see if any subset int nOut=0; for (int jClique=0;jCliquestatic_cast (sequenceInCliqueEntry(entry[cliqueStart[iClique+1]-1]))) { value[iClique]=numberIntegers; continue; } } if (iValuekValue) continue; // not a candidate // See if subset (remember duplicates have gone) if (cliqueStart[iClique+1]-position[iClique]> cliqueStart[kClique+1]-cliqueStart[kClique]) { // could be subset ? int offset = cliqueStart[iClique]-position[kClique]; int j; bool subset=true; // what about different fixes bool odd=false; for (j=cliqueStart[kClique]+1;jkColumn) { subset=false; } else { while (iColumn1) printf("clique %d is subset of %d\n",kClique,iClique); nOut++; break; } } } } if (nOut) { if(printit) printf("Can get rid of %d cliques\n",nOut); // make new copy int nNewC=numberCliques-nOut; int size = cliqueStart[numberCliques]-nSave; int n=0; int * start = new int [nNewC+1]; char * type = new char [nNewC]; start[0]=0; CliqueEntry * entryC = new CliqueEntry [size]; int nel=0; allNew = true; for (int jClique=0;jClique=numberLastTime) allNew=false; int nn=cliqueStart[kClique+1]-cliqueStart[kClique]; memcpy(entryC+nel,entry+cliqueStart[kClique],nn*sizeof(CliqueEntry)); nel += nn; type[n++]=cliqueType[kClique]; start[n]=nel; } } int nM=n; for (int jClique=0;jClique=numberMatrixCliques) { if (kClique>=numberLastTime) allNew=false; int nn=cliqueStart[kClique+1]-cliqueStart[kClique]; memcpy(entryC+nel,entry+cliqueStart[kClique],nn*sizeof(CliqueEntry)); nel += nn; type[n++]=cliqueType[kClique]; start[n]=nel; } } // move numberCliques=n; numberMatrixCliques=nM; delete [] cliqueStart; cliqueStart=start; delete [] entry; entry = entryC; delete [] cliqueType; cliqueType = type; if (printit>1) { for (int jClique=0;jCliquegetIndices(); const double * elementByRow = rowCopy->getElements(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * lower = si.getColLower(); const double * upper = si.getColUpper(); const double * rowLower = si.getRowLower(); const double * rowUpper = si.getRowUpper(); for (int iPass=0;iPass<2;iPass++) { if (iPass) { int numberExtraEntries=0; if (numberExtraCliques) numberExtraEntries = starts[numberExtraCliques]; cliqueStart = new int [numberCliques+1+numberExtraCliques]; cliqueStart[0]=0; entry = new CliqueEntry [numberEntries+numberExtraEntries]; cliqueType = new char [numberCliques+numberExtraCliques]; whichClique = new int [numberEntries+numberExtraEntries]; numberCliques=0; numberEntries=0; } #if 1 for (iRow=0;iRow0.0) { assert (numberP1 (floor(upperValue+1.0e-5)); int iLower = static_cast (ceil(lowerValue-1.0e-5)); int state=0; if (upperValue<1.0e6) { if (iUpper==1-numberM1) state=1; else if (iUpper==-numberM1) state=2; else if (iUpper<-numberM1) state=3; if (fabs(static_cast (iUpper)-upperValue)>1.0e-9) state =-1; } if (!state&&lowerValue>-1.0e6) { if (-iLower==1-numberP1) state=-1; else if (-iLower==-numberP1) state=-2; else if (-iLower<-numberP1) state=-3; if (fabs(static_cast (iLower)-lowerValue)>1.0e-9) state =-1; } if (numberP1+numberM1<2) state=-1; if (good&&state>0) { if (abs(state)==3) { // infeasible printf("FFF Infeasible\n");; //feasible=false; break; } else if (abs(state)==2) { // we can fix all //numberFixed += numberP1+numberM1; printf("FFF can fix %d\n",numberP1+numberM1); } else { for (j=0;j (numberIntegers_);iColumn++) { int j; for ( j=toZero_[iColumn];j (sequenceInCliqueEntry(entry[j])); if (oneFixesInCliqueEntry(entry[j])) { oneCount[iColumn]++; } else { zeroCount[iColumn]++; } } } int j; zeroStart[0]=0; cliqueStart[0]=0; for (j=0;j (sequenceInCliqueEntry(entry[j])); if (oneFixesInCliqueEntry(entry[j])) { int k=oneCount[iColumn]; oneCount[iColumn]++; int put = oneStart[iColumn]+k; whichClique[put]=iClique; } else { int k=zeroCount[iColumn]; zeroCount[iColumn]++; int put = zeroStart[iColumn]+k; whichClique[put]=iClique; } } } nStrengthen=0; int numberEntries=cliqueStart[numberCliques]; int maximumEntries=numberEntries; int maximumCliques=numberCliques; for (iColumn=0;iColumniColumn&&!mark[jColumn]) { mark[jColumn]=1; whichP[n++]=jColumn; assert (nmaximumEntries) { maximumEntries = CoinMax(numberEntries+jCount+1,(maximumEntries*12)/10+100); CliqueEntry * temp = new CliqueEntry [maximumEntries]; memcpy(temp,entry,numberEntries*sizeof(CliqueEntry)); delete [] entry; entry=temp; int * tempI = new int [maximumEntries]; memcpy(tempI,whichClique,numberEntries*sizeof(int)); delete [] whichClique; whichClique=tempI; } if (numberCliques==maximumCliques) { maximumCliques = (maximumCliques*12)/10+100; int * temp = new int [maximumCliques+1]; memcpy(temp,cliqueStart,(numberCliques+1)*sizeof(int)); delete [] cliqueStart; cliqueStart=temp; char * tempT = new char [maximumCliques]; memcpy(tempT,cliqueType,numberCliques); delete [] cliqueType; cliqueType=tempT; } CliqueEntry eI; eI.fixes=0; setSequenceInCliqueEntry(eI,iColumn); setOneFixesInCliqueEntry(eI,false); entry[numberEntries++]=eI; whichM[0]=iColumn; int n=1; for (int i=cliqueStart[jClique];i(entry))+numberEntries-n); cliqueType[numberCliques]='S'; numberCliques++; cliqueStart[numberCliques]=numberEntries; } } for (i=0;iiColumn&&!mark[jColumn]) { mark[jColumn]=1; whichP[n++]=jColumn; assert (nmaximumEntries) { maximumEntries = CoinMax(numberEntries+jCount+1,(maximumEntries*12)/10+100); CliqueEntry * temp = new CliqueEntry [maximumEntries]; memcpy(temp,entry,numberEntries*sizeof(CliqueEntry)); delete [] entry; entry=temp; int * tempI = new int [maximumEntries]; memcpy(tempI,whichClique,numberEntries*sizeof(int)); delete [] whichClique; whichClique=tempI; } if (numberCliques==maximumCliques) { maximumCliques = (maximumCliques*12)/10+100; int * temp = new int [maximumCliques+1]; memcpy(temp,cliqueStart,(numberCliques+1)*sizeof(int)); delete [] cliqueStart; cliqueStart=temp; char * tempT = new char [maximumCliques]; memcpy(tempT,cliqueType,numberCliques); delete [] cliqueType; cliqueType=tempT; } CliqueEntry eI; eI.fixes=0; setSequenceInCliqueEntry(eI,iColumn); setOneFixesInCliqueEntry(eI,true); entry[numberEntries++]=eI; whichM[0]=iColumn; int n=1; for (int i=cliqueStart[jClique];i(entry))+numberEntries-n); cliqueType[numberCliques]='S'; numberCliques++; cliqueStart[numberCliques]=numberEntries; } } for (i=0;i1&&numberCliques-numberDeleted>5000)) nStrengthen=0; } delete [] count; delete [] whichCount; } #if 0 if (numberCliques>numberMatrixCliques) { // should keep as cliques and also use in branching ?? double * element = new double [numberIntegers_]; for (iClique=numberMatrixCliques;iCliqueaddCut(-COIN_DBL_MAX,rhs,n,whichP,element); } delete [] element; } #endif OsiSolverInterface * newSolver=NULL; if (numberCliques>numberMatrixCliques||alwaysDo) { newSolver = si.clone(); // Delete all rows int * start = new int [ CoinMax(numberRows,numberCliques+1)]; int i; for (i=0;ideleteRows(numberRows,start); start[0]=0; int numberElements = cliqueStart[numberCliques]; int * column = new int [numberElements]; double * element = new double [numberElements]; double * lower = new double [numberCliques]; double * upper = new double [numberCliques]; numberElements=0; for (iClique=0;iCliqueaddRows(numberCliques,start,column,element,lower,upper); delete [] start; delete [] column; delete [] element; delete [] lower; delete [] upper; } delete [] mark; delete [] whichP; delete [] whichM; delete [] cliqueStart; delete [] entry; delete [] cliqueType; delete [] zeroStart; delete [] oneStart; delete [] zeroCount; delete [] oneCount; delete [] whichClique; return newSolver; } // Take action if cut generator can fix a variable (toValue -1 for down, +1 for up) bool CglTreeProbingInfo::fixes(int variable, int toValue, int fixedVariable,bool fixedToLower) { //printf("%d going to %d fixes %d at %g\n",variable,toValue,fixedVariable,fixedToValue); int intVariable = backward_[variable]; if (intVariable<0) // off as no longer in order FIX return true; // not 0-1 (well wasn't when constructor was called) int intFix = backward_[fixedVariable]; if (intFix<0) intFix = numberIntegers_+fixedVariable; // not 0-1 int fixedTo = fixedToLower ? 0 : 1; if (numberEntries_==maximumEntries_) { // See if taking too much memory if (maximumEntries_>=CoinMax(1000000,10*numberIntegers_)) return false; maximumEntries_ += 100 +maximumEntries_/2; CliqueEntry * temp1 = new CliqueEntry [maximumEntries_]; memcpy(temp1,fixEntry_,numberEntries_*sizeof(CliqueEntry)); delete [] fixEntry_; fixEntry_ = temp1; int * temp2 = new int [maximumEntries_]; memcpy(temp2,fixingEntry_,numberEntries_*sizeof(int)); delete [] fixingEntry_; fixingEntry_ = temp2; } CliqueEntry entry1; entry1.fixes=0; setOneFixesInCliqueEntry(entry1,fixedTo!=0); setSequenceInCliqueEntry(entry1,intFix); fixEntry_[numberEntries_] = entry1; assert (toValue==-1||toValue==1); assert (fixedTo==0||fixedTo==1); if (toValue<0) fixingEntry_[numberEntries_++] = intVariable << 1; else fixingEntry_[numberEntries_++] = (intVariable << 1) | 1; return true; } // Initalizes fixing arrays etc - returns true if we want to save info int CglTreeProbingInfo::initializeFixing(const OsiSolverInterface * model) { if (numberEntries_>=0) return 2; // already got arrays else if (numberEntries_==-2) return numberEntries_; delete [] fixEntry_; delete [] toZero_; delete [] toOne_; delete [] integerVariable_; delete [] backward_; delete [] fixingEntry_; numberVariables_=model->getNumCols(); // Too many ... but integerVariable_ = new int [numberVariables_]; backward_ = new int [numberVariables_]; numberIntegers_=0; int i; // Get integer types const char * columnType = model->getColType (true); for (i=0;i=0) { CoinSort_2( fixingEntry_, fixingEntry_+numberEntries_, fixEntry_); assert (!toZero_); toZero_ = new int [numberIntegers_+1]; toOne_ = new int [numberIntegers_]; toZero_[0]=0; int n=0; int put=0; for (int intVariable = 0;intVariable>1; int way = value &1; if (intVariable!=iVar||way) break; } if (n>last) { // sort assert (sizeof(int)==4); std::sort(reinterpret_cast (fixEntry_)+last, reinterpret_cast (fixEntry_)+n); CliqueEntry temp2; temp2.fixes=0; setSequenceInCliqueEntry(temp2,numberVariables_+1); for (int i=last;i>1; if (intVariable!=iVar) break; } if (n>last) { // sort assert (sizeof(int)==4); std::sort(reinterpret_cast (fixEntry_)+last, reinterpret_cast (fixEntry_)+n); CliqueEntry temp2; temp2.fixes=0; setSequenceInCliqueEntry(temp2,numberVariables_+1); for (int i=last;i (numberIntegers_);jColumn++) { int iColumn = integerVariable_[jColumn]; if (upper[iColumn]==0.0) { int j; for ( j=toZero_[jColumn];j=0); if (!value) { int j; for ( j=toZero_[jColumn];j (numberIntegers_);jColumn++) { int j; for ( j=iLast;j (numberIntegers_);jColumn++) { int iColumn = integerVariable_[jColumn]; assert (iColumn>=0&&iColumn=0&&kColumn=0&&kColumn0.00001) { OsiRowCut rc; int index[2]; double element[2]; index[0]=iColumn; element[0]=1.0; index[1]=kColumn; element[1]= -1.0; rc.setLb(-COIN_DBL_MAX); rc.setUb(0.0); rc.setRow(2,index,element,false); cs.insert(rc); } } else { if (value1+value2>1.00001) { OsiRowCut rc; int index[2]; double element[2]; index[0]=iColumn; element[0]=1.0; index[1]=kColumn; element[1]= 1.0; rc.setLb(-COIN_DBL_MAX); rc.setUb(1.0); rc.setRow(2,index,element,false); cs.insert(rc); } } } } } else if (upper[iColumn]==0.0) { for (int j=toZero_[jColumn];j=0&&kColumn=0&&kColumn #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinPackedVector.hpp" #include "CoinSort.hpp" #include "CglFlowCover.hpp" // added #define to get rid of warnings (so uncomment if =true) //#define CGLFLOW_DEBUG2 static bool CGLFLOW_DEBUG=false; static bool doLift=true; #include //------------------------------------------------------------------- // Overloaded operator<< for printing VUB and VLB. //------------------------------------------------------------------- std::ostream& operator<<( std::ostream& os, const CglFlowVUB &v ) { os << " VAR = " << v.getVar() << "\t VAL = " << v.getVal() << std::endl; return os; } // Initialize static memeber int CglFlowCover::numFlowCuts_ = 0; //------------------------------------------------------------------- // Determine row types. Find the VUBS and VLBS. //------------------------------------------------------------------- void CglFlowCover::flowPreprocess(const OsiSolverInterface& si) { CoinPackedMatrix matrixByRow(*si.getMatrixByRow()); int numRows = si.getNumRows(); int numCols = si.getNumCols(); const char* sense = si.getRowSense(); const double* RHS = si.getRightHandSide(); const double* coefByRow = matrixByRow.getElements(); const int* colInds = matrixByRow.getIndices(); const int* rowStarts = matrixByRow.getVectorStarts(); const int* rowLengths = matrixByRow.getVectorLengths(); int iRow = -1; int iCol = -1; numCols_ = numCols; // Record col and row numbers for copy constructor numRows_ = numRows; if (rowTypes_ != 0) { delete [] rowTypes_; rowTypes_ = 0; } rowTypes_ = new CglFlowRowType [numRows];// Destructor will free memory // Get integer types const char * columnType = si.getColType (true); // Summarize the row type infomation. int numUNDEFINED = 0; int numVARUB = 0; int numVARLB = 0; int numVAREQ = 0; int numMIXUB = 0; int numMIXEQ = 0; int numNOBINUB = 0; int numNOBINEQ = 0; int numSUMVARUB = 0; int numSUMVAREQ = 0; int numUNINTERSTED = 0; int* ind = new int [numCols]; double* coef = new double [numCols]; for (iRow = 0; iRow < numRows; ++iRow) { int rowLen = rowLengths[iRow]; char sen = sense[iRow]; double rhs = RHS[iRow]; CoinDisjointCopyN(colInds + rowStarts[iRow], rowLen, ind); CoinDisjointCopyN(coefByRow + rowStarts[iRow], rowLen, coef); CglFlowRowType rowType = determineOneRowType(si, rowLen, ind, coef, sen, rhs); rowTypes_[iRow] = rowType; switch(rowType) { case CGLFLOW_ROW_UNDEFINED: ++numUNDEFINED; break; case CGLFLOW_ROW_VARUB: ++numVARUB; break; case CGLFLOW_ROW_VARLB: ++numVARLB; break; case CGLFLOW_ROW_VAREQ: ++numVAREQ; break; case CGLFLOW_ROW_MIXUB: ++numMIXUB; break; case CGLFLOW_ROW_MIXEQ: ++numMIXEQ; break; case CGLFLOW_ROW_NOBINUB: ++numNOBINUB; break; case CGLFLOW_ROW_NOBINEQ: ++numNOBINEQ; break; case CGLFLOW_ROW_SUMVARUB: ++numSUMVARUB; break; case CGLFLOW_ROW_SUMVAREQ: ++numSUMVAREQ; break; case CGLFLOW_ROW_UNINTERSTED: ++numUNINTERSTED; break; default: throw CoinError("Unknown row type", "flowPreprocess", "CglFlowCover"); } } delete [] ind; ind = NULL; delete [] coef; coef = NULL; if(CGLFLOW_DEBUG) { std::cout << "The num of rows = " << numRows << std::endl; std::cout << "Summary of Row Type" << std::endl; std::cout << "numUNDEFINED = " << numUNDEFINED << std::endl; std::cout << "numVARUB = " << numVARUB << std::endl; std::cout << "numVARLB = " << numVARLB << std::endl; std::cout << "numVAREQ = " << numVAREQ << std::endl; std::cout << "numMIXUB = " << numMIXUB << std::endl; std::cout << "numMIXEQ = " << numMIXEQ << std::endl; std::cout << "numNOBINUB = " << numNOBINUB << std::endl; std::cout << "numNOBINEQ = " << numNOBINEQ << std::endl; std::cout << "numSUMVARUB = " << numSUMVARUB << std::endl; std::cout << "numSUMVAREQ = " << numSUMVAREQ << std::endl; std::cout << "numUNINTERSTED = " << numUNINTERSTED << std::endl; } //--------------------------------------------------------------------------- // Setup vubs_ and vlbs_ if (vubs_ != 0) { delete [] vubs_; vubs_ = 0; } vubs_ = new CglFlowVUB [numCols]; // Destructor will free memory if (vlbs_ != 0) { delete [] vlbs_; vlbs_ = 0; } vlbs_ = new CglFlowVLB [numCols]; // Destructor will free memory for (iCol = 0; iCol < numCols; ++iCol) { // Initilized in constructor vubs_[iCol].setVar(UNDEFINED_); // but, need redo since may call vlbs_[iCol].setVar(UNDEFINED_); // preprocess(...) more than once } for (iRow = 0; iRow < numRows; ++iRow) { CglFlowRowType rowType2 = rowTypes_[iRow]; if ( (rowType2 == CGLFLOW_ROW_VARUB) || (rowType2 == CGLFLOW_ROW_VARLB) || (rowType2 == CGLFLOW_ROW_VAREQ) ) { int startPos = rowStarts[iRow]; int index0 = colInds[startPos]; int index1 = colInds[startPos + 1]; double coef0 = coefByRow[startPos]; double coef1 = coefByRow[startPos + 1]; int xInd, yInd; // x is binary double xCoef, yCoef; if ( columnType[index0]==1 ) { xInd = index0; yInd = index1; xCoef = coef0; yCoef = coef1; } else { xInd = index1; yInd = index0; xCoef = coef1; yCoef = coef0; } switch (rowType2) { case CGLFLOW_ROW_VARUB: // Inequality: y <= ? * x vubs_[yInd].setVar(xInd); vubs_[yInd].setVal(-xCoef / yCoef); break; case CGLFLOW_ROW_VARLB: // Inequality: y >= ? * x vlbs_[yInd].setVar(xInd); vlbs_[yInd].setVal(-xCoef / yCoef); break; case CGLFLOW_ROW_VAREQ: // Inequality: y >= AND <= ? * x vubs_[yInd].setVar(xInd); vubs_[yInd].setVal(-xCoef / yCoef); vlbs_[yInd].setVar(xInd); vlbs_[yInd].setVal(-xCoef / yCoef); break; default: throw CoinError("Unknown row type: impossible", "flowPreprocess", "CglFlowCover"); } } } if(CGLFLOW_DEBUG) { printVubs(std::cout); } } //----------------------------------------------------------------------------- // Generate LSGFC cuts //------------------------------------------------------------------- void CglFlowCover::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) { static int count=0; if (getMaxNumCuts() <= 0) return; if (getNumFlowCuts() >= getMaxNumCuts()) return; ++count; #if 0 bool preInit = false; bool preReso = false; si.getHintParam(OsiDoPresolveInInitial, preInit); si.getHintParam(OsiDoPresolveInResolve, preReso); if (preInit == false && preReso == false) { // Do once if (doneInitPre_ == false) { flowPreprocess(si); doneInitPre_ = true; } } else #endif int numberRowCutsBefore = cs.sizeRowCuts(); flowPreprocess(si); CoinPackedMatrix matrixByRow(*si.getMatrixByRow()); const char* sense = si.getRowSense(); const double* rhs = si.getRightHandSide(); const double* elementByRow = matrixByRow.getElements(); const int* colInd = matrixByRow.getIndices(); const CoinBigIndex* rowStart = matrixByRow.getVectorStarts(); const int* rowLength = matrixByRow.getVectorLengths(); int* ind = 0; double* coef = 0; int iRow, iCol; CglFlowRowType rType; for (iRow = 0; iRow < numRows_; ++iRow) { rType = getRowType(iRow); if( ( rType != CGLFLOW_ROW_MIXUB ) && ( rType != CGLFLOW_ROW_MIXEQ ) && ( rType != CGLFLOW_ROW_NOBINUB ) && ( rType != CGLFLOW_ROW_NOBINEQ ) && ( rType != CGLFLOW_ROW_SUMVARUB ) && ( rType != CGLFLOW_ROW_SUMVAREQ ) ) continue; const int sta = rowStart[iRow]; // Start position of iRow const int rowLen = rowLength[iRow]; // iRow length / non-zero elements if (ind != 0) { delete [] ind; ind = 0; } ind = new int [rowLen]; if (coef != 0) { delete [] coef; coef = 0; } coef = new double [rowLen]; int lastPos = sta + rowLen; for (iCol = sta; iCol < lastPos; ++iCol) { ind[iCol - sta] = colInd[iCol]; coef[iCol - sta] = elementByRow[iCol]; } OsiRowCut flowCut1, flowCut2, flowCut3; double violation = 0.0; bool hasCut = false; if (sense[iRow] == 'E') { hasCut = generateOneFlowCut(si, rowLen, ind, coef, 'L', rhs[iRow], flowCut1, violation); if (hasCut) { // If find a cut cs.insert(flowCut1); incNumFlowCuts(); if (getNumFlowCuts() >= getMaxNumCuts()) break; } hasCut = false; hasCut = generateOneFlowCut(si, rowLen, ind, coef, 'G', rhs[iRow], flowCut2, violation); if (hasCut) { cs.insert(flowCut2); incNumFlowCuts(); if (getNumFlowCuts() >= getMaxNumCuts()) break; } } if (sense[iRow] == 'L' || sense[iRow] == 'G') { hasCut = generateOneFlowCut(si, rowLen, ind, coef, sense[iRow], rhs[iRow], flowCut3, violation); if (hasCut) { cs.insert(flowCut3); incNumFlowCuts(); if (getNumFlowCuts() >= getMaxNumCuts()) break; } } } #ifdef CGLFLOW_DEBUG2 if(CGLFLOW_DEBUG) { std::cout << "\nnumFlowCuts = "<< getNumFlowCuts() << std::endl; std::cout << "CGLFLOW_COL_BINNEG = "<< CGLFLOW_COL_BINNEG << std::endl; } #endif if (!info.inTree&&((info.options&4)==4||((info.options&8)&&!info.pass))) { int numberRowCutsAfter = cs.sizeRowCuts(); for (int i=numberRowCutsBefore;isetGloballyValid(); } if (ind != 0) { delete [] ind; ind = 0; } if (coef != 0) { delete [] coef; coef = 0; } } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglFlowCover::CglFlowCover() : CglCutGenerator(), maxNumCuts_(2000), EPSILON_(1.0e-6), UNDEFINED_(-1), INFTY_(1.0e30), TOLERANCE_(0.05), firstProcess_(true), numRows_(0), numCols_(0), doneInitPre_(false), vubs_(0), vlbs_(0), rowTypes_(0) { // DO NOTHING } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglFlowCover::CglFlowCover (const CglFlowCover & source) : CglCutGenerator(source), maxNumCuts_(source.maxNumCuts_), EPSILON_(source.EPSILON_), UNDEFINED_(source.UNDEFINED_), INFTY_(source.INFTY_), TOLERANCE_(source.TOLERANCE_), firstProcess_(true), numRows_(source.numRows_), numCols_(source.numCols_), doneInitPre_(source.doneInitPre_) { setNumFlowCuts(source.numFlowCuts_); if (numCols_ > 0) { vubs_ = new CglFlowVUB [numCols_]; vlbs_ = new CglFlowVLB [numCols_]; CoinDisjointCopyN(source.vubs_, numCols_, vubs_); CoinDisjointCopyN(source.vlbs_, numCols_, vlbs_); } else { vubs_ = 0; vlbs_ = 0; } if (numRows_ > 0) { rowTypes_ = new CglFlowRowType [numRows_]; CoinDisjointCopyN(source.rowTypes_, numRows_, rowTypes_); } else { rowTypes_ = 0; } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglFlowCover::clone() const { return new CglFlowCover(*this); } //------------------------------------------------------------------ // Assignment operator //------------------------------------------------------------------- CglFlowCover & CglFlowCover::operator=(const CglFlowCover& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); maxNumCuts_ = rhs.maxNumCuts_; EPSILON_ = rhs.EPSILON_; UNDEFINED_ = rhs.UNDEFINED_; INFTY_ = rhs.INFTY_; TOLERANCE_ = rhs.TOLERANCE_; numRows_ = rhs.numRows_; numCols_ = rhs.numCols_; // numFlowCuts_ = rhs.numFlowCuts_; setNumFlowCuts(rhs.numFlowCuts_); doneInitPre_ = rhs.doneInitPre_; if (numCols_ > 0) { vubs_ = new CglFlowVUB [numCols_]; vlbs_ = new CglFlowVLB [numCols_]; CoinDisjointCopyN(rhs.vubs_, numCols_, vubs_); CoinDisjointCopyN(rhs.vlbs_, numCols_, vlbs_); } if (numRows_ > 0) { rowTypes_ = new CglFlowRowType [numRows_]; CoinDisjointCopyN(rhs.rowTypes_, numRows_, rowTypes_); } } return *this; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglFlowCover::~CglFlowCover () { if (vubs_ != 0) { delete [] vubs_; vubs_ = 0; } if (vlbs_ != 0) { delete [] vlbs_; vlbs_ = 0; } if (rowTypes_ != 0) { delete [] rowTypes_; rowTypes_ = 0; } } //------------------------------------------------------------------- // Given the model data, a row of the model, and a LP solution, // this function tries to generate a violated lifted simple generalized // flow cover. //------------------------------------------------------------------- bool CglFlowCover::generateOneFlowCut( const OsiSolverInterface & si, const int rowLen, int* ind, double* coef, char sense, double rhs, OsiRowCut& flowCut, double& violation ) { bool generated = false; const double* xlp = si.getColSolution(); const int numCols = si.getNumCols(); double* up = new double [rowLen]; double* x = new double [rowLen]; double* y = new double [rowLen]; CglFlowColType* sign = new CglFlowColType [rowLen]; int i, j; double value, LB, UB; CglFlowVLB VLB; CglFlowVUB VUB; static int count=0; ++count; CGLFLOW_DEBUG=false; doLift=true; // Get integer types const char * columnType = si.getColType (); for (i = 0; i < rowLen; ++i) { if ( xlp[ind[i]] - floor(xlp[ind[i]]) > EPSILON_ && ceil(xlp[ind[i]]) - xlp[ind[i]] > EPSILON_ ) break; } if (i != rowLen) { for (int j = 0; j < rowLen; ++j) { if ( fabs(coef[j])<=EPSILON_) { doLift = false; break; } } } else { doLift = false; } if (!doLift) { delete [] sign; delete [] up; delete [] x; delete [] y; return generated; } //------------------------------------------------------------------------- if (sense == 'G') flipRow(rowLen, coef, rhs); // flips everything, // but the sense if(CGLFLOW_DEBUG) { std::cout << "***************************" << std::endl; std::cout << "Generate Flow cover -- initial constraint, converted to L sense..." << std::endl; std::cout << "Rhs = " << rhs << std::endl; std::cout << "coef [var_index]" << " -- " << "xlp[var_index]" << '\t' << "vub_coef[vub_index] vub_lp_value OR var_index_col_ub" << std::endl; for(int iD = 0; iD < rowLen; ++iD) { VUB = getVubs(ind[iD]); std::cout << std::setw(5) << coef[iD] << "[" << std::setw(5) << ind[iD] << "] -- " << std::setw(20) << xlp[ind[iD]] << '\t'; if (VUB.getVar() != UNDEFINED_) { std::cout << std::setw(20) << VUB.getVal() << "[" << std::setw(5) << VUB.getVar() << "]" << std::setw(20) << xlp[VUB.getVar()] << std::endl; } else std::cout << std::setw(20) << si.getColUpper()[ind[iD]] << " " << std::setw(20) << 1.0 << std::endl; } } //------------------------------------------------------------------------- // Generate conservation inequality and capacity equalities from // the given row. for (i = 0; i < rowLen; ++i) { VLB = getVlbs(ind[i]); LB = ( VLB.getVar() != UNDEFINED_ ) ? VLB.getVal() : si.getColLower()[ind[i]]; VUB = getVubs(ind[i]); UB = ( VUB.getVar() != UNDEFINED_ ) ? VUB.getVal() : si.getColUpper()[ind[i]]; if (LB < -EPSILON_) { // Only consider rows whose variables are all delete [] sign; // non-negative (LB>= 0). delete [] up; delete [] x; delete [] y; return generated; } if ( columnType[ind[i]]==1 ) { // Binary variable value = coef[i]; if (value > 0.0) sign[i] = CGLFLOW_COL_BINPOS; else { sign[i] = CGLFLOW_COL_BINNEG; value = -value; } up[i] = value; x[i] = xlp[ind[i]]; y[i] = value * x[i]; } else { value = coef[i]; if (value > 0.0) sign[i] = CGLFLOW_COL_CONTPOS; else { sign[i] = CGLFLOW_COL_CONTNEG; value = -value; } up[i] = value* UB; x[i] = (VUB.getVar() != UNDEFINED_) ? xlp[VUB.getVar()] : 1.0; y[i] = value * xlp[ind[i]]; } } //------------------------------------------------------------------------- // Find a initial cover (C+, C-) in (N+, N-) double knapRHS = rhs; double tempSum = 0.0; double tempMin = INFTY_; CglFlowColCut * candidate = new CglFlowColCut [rowLen]; CglFlowColCut * label = new CglFlowColCut [rowLen]; double* ratio = new double [rowLen]; int t = -1; for (i = 0; i < rowLen; ++i) { candidate[i] = label[i] = CGLFLOW_COL_OUTCUT; ratio[i] = INFTY_; switch(sign[i]) { case CGLFLOW_COL_CONTPOS: case CGLFLOW_COL_BINPOS: if( y[i] > EPSILON_ ) { ratio[i] = (1.0 - x[i]) / up[i]; if( y[i] > up[i] * x[i] - EPSILON_ ) { // Violated candidate[i] = CGLFLOW_COL_PRIME; tempSum += up[i]; } else { candidate[i] = CGLFLOW_COL_SECONDARY; } } break; case CGLFLOW_COL_CONTNEG: case CGLFLOW_COL_BINNEG: if( up[i] > ( (1.0 - EPSILON_) * INFTY_ ) ) { // UB is infty label[i] = CGLFLOW_COL_INCUT; } else { knapRHS += up[i]; if( y[i] < up[i] ) { candidate[i] = CGLFLOW_COL_PRIME; ratio[i] = x[i] / up[i]; tempSum += up[i]; } } break; } } double diff, tempD, lambda; int xID = -1; if (knapRHS >1.0e10) { if(CGLFLOW_DEBUG) { std::cout << "knapsack RHS too large. RETURN." << std::endl; } delete [] sign; delete [] up; delete [] x; delete [] y; delete [] candidate; delete [] label; delete [] ratio; return generated; } while (tempSum < knapRHS + EPSILON_) { // Not a cover yet diff = INFTY_; for (i = 0; i < rowLen; ++i) { if (candidate[i] == CGLFLOW_COL_SECONDARY) { tempD = up[i] * x[i] - y[i]; if (tempD < diff - EPSILON_) { diff = tempD; xID = i; } } } if( diff > (1.0 - EPSILON_) * INFTY_ ) { // NO cover exits. delete [] sign; delete [] up; delete [] x; delete [] y; delete [] candidate; delete [] label; delete [] ratio; return generated; } else { tempSum += up[xID]; candidate[xID] = CGLFLOW_COL_PRIME; } } // Solve the knapsack problem to get an initial cover tempSum = 0.0; for (i = 0; i < rowLen; ++i) { if (candidate[i] == CGLFLOW_COL_PRIME && ratio[i] < EPSILON_) { //Zero ratio label[i] = CGLFLOW_COL_INCUT; tempSum += up[i]; } } while (tempSum < knapRHS + EPSILON_) { tempMin = INFTY_; xID=-1; for (i = 0; i < rowLen; i++) { // Search the col with minimum ratio if (candidate[i] == CGLFLOW_COL_PRIME && label[i] == 0 && ratio[i] < tempMin) { tempMin = ratio[i]; xID = i; } } if (xID>=0) { label[xID] = CGLFLOW_COL_INCUT; tempSum += up[xID]; } else { if(CGLFLOW_DEBUG) { std::cout << "knapsack RHS too large B. RETURN." << std::endl; } delete [] sign; delete [] up; delete [] x; delete [] y; delete [] candidate; delete [] label; delete [] ratio; return generated; } } // Reduce to a minimal cover for (i = 0; i < rowLen; ++i) { if (label[i] == CGLFLOW_COL_INCUT && ratio[i] > EPSILON_) { if (tempSum - up[i] > knapRHS + EPSILON_) { label[i] = CGLFLOW_COL_OUTCUT; tempSum -= up[i]; } } } for (i = 0; i < rowLen; ++i) { if (label[i] == CGLFLOW_COL_INCUT && ratio[i] < EPSILON_) { if (tempSum - up[i] > knapRHS + EPSILON_) { label[i] = CGLFLOW_COL_OUTCUT; tempSum -= up[i]; } } } // Due to the way to handle N- for(i = 0; i < rowLen; ++i) { if( sign[i] < 0 ) label[i] = label[i]==CGLFLOW_COL_OUTCUT?CGLFLOW_COL_INCUT:CGLFLOW_COL_OUTCUT; } // No cover, no cut. bool emptyCover = true; for (i = 0; i < rowLen; ++i) { if (label[i] == CGLFLOW_COL_INCUT) { emptyCover = false; break; } } if (emptyCover) { if(CGLFLOW_DEBUG) { std::cout << "No cover. RETURN." << std::endl; } delete [] sign; delete [] up; delete [] x; delete [] y; delete [] candidate; delete [] label; delete [] ratio; return generated; } lambda = tempSum - knapRHS; if(CGLFLOW_DEBUG) { double sum_mj_Cplus = 0.0; double sum_mj_Cminus= 0.0; // double checkLambda; // variable not used anywhere (LL) // print out the knapsack variables std::cout << "Knapsack Cover: C+" << std::endl; for (i = 0; i < rowLen; ++i) { if ( label[i] == CGLFLOW_COL_INCUT && sign[i] > 0 ) { std::cout << ind[i] << '\t' << up[i] << std::endl; sum_mj_Cplus += up[i]; } } std::cout << "Knapsack Cover: C-" << std::endl; for (i = 0; i < rowLen; ++i) { if ( label[i] == CGLFLOW_COL_INCUT && sign[i] < 0 ) { std::cout << ind[i] << '\t' << up[i] << std::endl; sum_mj_Cminus += up[i]; } } // rlh: verified "lambda" is lambda in the paper. // lambda = (sum coefficients in C+) - (sum of VUB // coefficients in C-) - rhs-orig-constraint std::cout << "lambda = " << lambda << std::endl; } //------------------------------------------------------------------------- // Generate a violated SGFC int numCMinus = 0; int numPlusPlus = 0; double* rho = new double [rowLen]; double* xCoef = new double [rowLen]; double* yCoef = new double [rowLen]; double cutRHS = rhs; double temp = 0.0; double sum = 0.0; double minPlsM = INFTY_; double minNegM = INFTY_; for(i = 0; i < rowLen; ++i) { rho[i] = 0.0; xCoef[i] = 0.0; yCoef[i] = 0.0; } // Project out variables in C- // d^' = d + sum_{i in C^-} m_i. Now cutRHS = d^' for (i = 0; i < rowLen; ++i) { if ( label[i] == CGLFLOW_COL_INCUT && sign[i] < 0 ) { cutRHS += up[i]; ++numCMinus; } } // (1) Compute the coefficients of the simple generalized flow cover // (2) Compute minPlsM, minNegM and sum // // sum = sum_{i in C+\C++} m_i + sum_{i in L--} m_i = m. Page 15. // minPlsM = min_{i in C++} m_i // minNegM = min_{i in L-} m_i temp = cutRHS; for (i = 0; i < rowLen; ++i) { if (label[i] == CGLFLOW_COL_INCUT && sign[i] > 0) { // C+ yCoef[i] = 1.0; if ( up[i] > lambda + EPSILON_ ) { // C++ ++numPlusPlus; xCoef[i] = lambda - up[i]; cutRHS += xCoef[i]; if( up[i] < minPlsM ) { minPlsM = up[i]; } } else { // C+\C++ xCoef[i] = 0.0; // rlh: is this necesarry? (xCoef initialized to zero) sum += up[i]; } } if (label[i] != CGLFLOW_COL_INCUT && sign[i] < 0) { // N-\C- temp += up[i]; if ( up[i] > lambda) { // L- if(CGLFLOW_DEBUG) { std::cout << "Variable " << ind[i] << " is in L-" << std::endl; } yCoef[i] = 0.0; xCoef[i] = -lambda; label[i] = CGLFLOW_COL_INLMIN; if ( up[i] < minNegM ) { minNegM = up[i]; } } else { // L-- if(CGLFLOW_DEBUG) { std::cout << "Variable " << ind[i] << " is in L-- " << std::endl; } yCoef[i] = -1.0; xCoef[i] = 0.0; // rlh: is this necesarry? (xCoef initialized to zero) label[i] = CGLFLOW_COL_INLMINMIN; sum += up[i]; } } } // Sort the upper bounds (m_i) of variables in C++ and L-. int ix; int index = 0; double* mt = new double [rowLen]; double* M = new double [rowLen + 1]; // order to look at variables int * order = new int [rowLen]; int nLook=0; for (int i = 0; i < rowLen; ++i) { if ( (label[i] == CGLFLOW_COL_INCUT && sign[i] > 0) || label[i] == CGLFLOW_COL_INLMIN ) { // C+ || L- // possible M[nLook]=-up[i]; order[nLook++]=i; } } CoinSort_2(M,M+nLook,order); int kLook=0; while (kLook 0) || label[i] == CGLFLOW_COL_INLMIN ) { // C+ || L- if ( up[i] > lambda ) { // C++ || L-(up[i] > lambda) ix = i; } } if( ix == UNDEFINED_ ) break; mt[index++] = up[ix]; // Record m_i in C++ and L-(not all) in descending order. if( label[ix] == CGLFLOW_COL_INLMIN ) label[ix] = CGLFLOW_COL_INLMINDONE; else label[ix] = CGLFLOW_COL_INCUTDONE; } //printf("mins %g %g\n",minNegM,minPlsM); if( index == 0 || numPlusPlus == 0) { // No column in C++ and L-(not all). RETURN. if(CGLFLOW_DEBUG) { std::cout << "index = 0. RETURN." << std::endl; } delete [] sign; delete [] up; delete [] x; delete [] y; delete [] candidate; delete [] label; delete [] ratio; delete [] rho; delete [] xCoef; delete [] yCoef; delete [] mt; delete [] M; delete [] order; return generated; } for ( i = 0; i < rowLen; i++ ) { switch( label[i] ) { case CGLFLOW_COL_INCUTDONE: label[i] = CGLFLOW_COL_INCUT; break; case CGLFLOW_COL_INLMIN: case CGLFLOW_COL_INLMINDONE: case CGLFLOW_COL_INLMINMIN: label[i] = CGLFLOW_COL_OUTCUT; break; case CGLFLOW_COL_INCUT: case CGLFLOW_COL_OUTCUT: case CGLFLOW_COL_PRIME: case CGLFLOW_COL_SECONDARY: break; } } /* Get t */ t = 0; for ( i = 0; i < index; ++i ) { if ( mt[i] < minPlsM ) { t = i; break; } } if (i == index) { t = index; } /* Compute M_i */ M[0] = 0.0; for ( i = 1; i <= index; ++i ) { M[i] = M[(i-1)] + mt[(i-1)]; if(CGLFLOW_DEBUG) { std::cout << "t = " << t << std::endl; std::cout << "mt[" << std::setw(5) << (i-1) << "]=" << std::setw(2) << ", M[" << std::setw(5) << i << "]=" << std::setw(20) << M[i] << std::endl; } } // Exit if very big M if (M[index]>1.0e30) { // rlh: should test for huge col UB earler // no sense doing all this work in that case. if(CGLFLOW_DEBUG) { std::cout << "M[index]>1.0e30. RETURN." << std::endl; delete [] sign; delete [] up; delete [] x; delete [] y; delete [] candidate; delete [] label; delete [] ratio; delete [] rho; delete [] xCoef; delete [] yCoef; delete [] mt; delete [] M; delete [] order; return generated; } } /* Get ml */ double ml = CoinMin(sum, lambda); if(CGLFLOW_DEBUG) { // sum = sum_{i in C+\C++} m_i + sum_{i in L--} m_i = m. Page 15. std::cout << "ml = CoinMin(m, lambda) = CoinMin(" << sum << ", " << lambda << ") =" << ml << std::endl; } /* rho_i = max[0, m_i - (minPlsM - lamda) - ml */ if (t < index ) { /* rho exits only for t <= index-1 */ value = (minPlsM - lambda) + ml; for (i = t; i < index; ++i) { rho[i] = CoinMax(0.0, mt[i] - value); if(CGLFLOW_DEBUG) { std::cout << "rho[" << std::setw(5) << i << "]=" << std::setw(20) << rho[i] << std::endl; } } } // Calculate the violation violation = -cutRHS; for ( i = 0; i < rowLen; ++i ) { #ifdef CGLFLOW_DEBUG2 if(CGLFLOW_DEBUG) { std::cout << "i = " << i << " ind = " << ind[i] << " sign = " << sign[i] << " coef = " << coef[i] << " x = " << x[i] << " xCoef = " << xCoef[i] << " y = " << y[i] << " yCoef = " << yCoef[i] << " up = " << up[i] << " label = " << label[i] << std::endl; } #endif violation += y[i] * yCoef[i] + x[i] * xCoef[i]; } if(CGLFLOW_DEBUG) { std::cout << "violation = " << violation << std::endl; } // double violationBeforeLift=violation; // variable not used anywhere (LL) if(doLift && fabs(violation) > TOLERANCE_ ) { // LIFTING double estY, estX; double movement = 0.0; double dPrimePrime = temp + cutRHS; bool lifted = false; for( i = 0; i < rowLen; ++i ) { if ( (label[i] != CGLFLOW_COL_INCUT) && (sign[i] > 0) ) {/* N+\C+*/ lifted = liftPlus(estY, estX, index, up[i], lambda, y[i], x[i], dPrimePrime, M); xCoef[i] = -estX; yCoef[i] = estY; if(CGLFLOW_DEBUG) { if (lifted) { printf("Success: Lifted col %i (up_i=%f,yCoef[i]=%f,xCoef[i]=%f) in N+\\C+\n", ind[i], up[i], yCoef[i], xCoef[i]); } else { printf("Failed to Lift col %i (m_i=%f) in N+\\C+\n", ind[i], up[i]); } } } if (label[i] == CGLFLOW_COL_INCUT && sign[i] < 0) { /* C- */ liftMinus(movement, t, index, up[i], dPrimePrime, lambda, ml, M, rho); if(movement > EPSILON_) { if(CGLFLOW_DEBUG) { printf("Success: Lifted col %i in C-, movement=%f\n", ind[i], movement); } lifted = true; xCoef[i] = -movement; cutRHS -= movement; } else { if(CGLFLOW_DEBUG) { printf("Failed to Lift col %i in C-, g=%f\n", ind[i], movement); } } } } } //------------------------------------------------------------------- // Calculate the violation violation = -cutRHS; for ( i = 0; i < rowLen; ++i ) { #ifdef CGLFLOW_DEBUG2 if(CGLFLOW_DEBUG) { std::cout << "i = " << i << " ind = " << ind[i] << " sign = " << sign[i] << " coef = " << coef[i] << " x = " << x[i] << " xCoef = " << xCoef[i] << " y = " << y[i] << " yCoef = " << yCoef[i] << " up = " << up[i] << " label = " << label[i] << std::endl; } #endif violation += y[i] * yCoef[i] + x[i] * xCoef[i]; } if(CGLFLOW_DEBUG) { std::cout << "violation = " << violation << std::endl; } int cutLen = 0; int* cutInd = 0; double* cutCoef = 0; // If violated, transform the inequality back to original system if ( violation > TOLERANCE_ ) { cutLen = 0; cutInd = new int [3*numCols]; cutCoef = new double [3*numCols]; assert (cutLen EPSILON_ ) { if ( sign[i] == CGLFLOW_COL_CONTPOS ) cutCoef[cutLen] = coef[i] * yCoef[i]; else cutCoef[cutLen] = -coef[i] * yCoef[i]; cutInd[cutLen++] = ind[i]; } if ( fabs( xCoef[i] ) > EPSILON_ ) { if ( VUB.getVar() != UNDEFINED_ ) { cutCoef[cutLen] = xCoef[i]; cutInd[cutLen++] = VUB.getVar(); } else cutRHS -= xCoef[i]; } } if ( ( sign[i] == CGLFLOW_COL_BINPOS ) || ( sign[i] == CGLFLOW_COL_BINNEG ) ) { if (fabs(yCoef[i]) > EPSILON_ || fabs(xCoef[i]) > EPSILON_) { if (sign[i] == CGLFLOW_COL_BINPOS) cutCoef[cutLen] = coef[i] * yCoef[i] + xCoef[i]; else cutCoef[cutLen] = -coef[i] * yCoef[i] + xCoef[i]; cutInd[cutLen++] = ind[i]; } } } #if 1 assert (cutLen); CoinShortSort_2(cutInd,cutInd+cutLen,cutCoef); j=0; int lastInd=cutInd[0]; double lastCoef=cutCoef[0]; for ( i = 1; i < cutLen+1; ++i ) { if (i==cutLen||cutInd[i]>lastInd) { if ( fabs(lastCoef) >= EPSILON_ ) { cutCoef[j]=lastCoef; cutInd[j++]=lastInd; lastCoef = cutCoef[i]; if (i TOLERANCE_ ) { flowCut.setRow(cutLen, cutInd, cutCoef); flowCut.setLb(-1.0 * si.getInfinity()); flowCut.setUb(cutRHS); flowCut.setEffectiveness(violation); generated = true; if(CGLFLOW_DEBUG) { std::cout << "generateOneFlowCover(): Found a cut" << std::endl; } } else { if(CGLFLOW_DEBUG) { std::cout << "generateOneFlowCover(): Lost a cut" << std::endl; } } } //------------------------------------------------------------------------- delete [] sign; delete [] up; delete [] x; delete [] y; delete [] candidate; delete [] label; delete [] ratio; delete [] rho; delete [] xCoef; delete [] yCoef; delete [] mt; delete [] M; delete [] order; delete [] cutInd; delete [] cutCoef; return generated; } //------------------------------------------------------------------- // Flip a row from ">=" to "<=", and vice versa. //------------------------------------------------------------------- void CglFlowCover::flipRow(int rowLen, double* coef, double& rhs) const { for(int i = 0; i < rowLen; ++i) coef[i] = -coef[i]; rhs = -rhs; } //------------------------------------------------------------------- // Flip a row from ">=" to "<=", and vice versa. Have 'sense'. //------------------------------------------------------------------- void CglFlowCover::flipRow(int rowLen, double* coef, char& sen, double& rhs) const { for(int i = 0; i < rowLen; ++i) coef[i] = -coef[i]; sen = (sen == 'G') ? 'L' : 'G'; rhs = -rhs; } //------------------------------------------------------------------- // Determine the type of a given row //------------------------------------------------------------------- CglFlowRowType CglFlowCover::determineOneRowType(const OsiSolverInterface& si, int rowLen, int* ind, double* coef, char sense, double rhs) const { if (rowLen == 0) return CGLFLOW_ROW_UNDEFINED; if (sense == 'R') return CGLFLOW_ROW_UNINTERSTED; // Could be fixed CglFlowRowType rowType = CGLFLOW_ROW_UNDEFINED; // Get integer types const char * columnType = si.getColType (); int numPosBin = 0; // num of positive binary variables int numNegBin = 0; // num of negative binary variables int numBin = 0; // num of binary variables int numPosCol = 0; // num of positive variables int numNegCol = 0; // num of negative variables int i; bool flipped = false; // Range row will only consider as 'L' if (sense == 'G') { // Transform to " <= " flipRow(rowLen, coef, sense, rhs); flipped = true; } // Summarize the variable types of the given row. for ( i = 0; i < rowLen; ++i ) { if ( coef[i] < -EPSILON_ ) { ++numNegCol; if( columnType[ind[i]]==1 ) ++numNegBin; } else { ++numPosCol; if( columnType[ind[i]]==1 ) ++numPosBin; } } numBin = numNegBin + numPosBin; if(CGLFLOW_DEBUG) { std::cout << "numNegBin = " << numNegBin << std::endl; std::cout << "numPosBin = " << numPosBin << std::endl; std::cout << "numBin = " << numBin << std::endl; std::cout << "rowLen = " << rowLen << std::endl; } //------------------------------------------------------------------------ // Classify row type based on the types of variables. // All variables are binary. NOT interested in this type of row right now if (numBin == rowLen) rowType = CGLFLOW_ROW_UNINTERSTED; // All variables are NOT binary if (rowType == CGLFLOW_ROW_UNDEFINED && numBin == 0) { if (sense == 'L') rowType = CGLFLOW_ROW_NOBINUB; else rowType = CGLFLOW_ROW_NOBINEQ; } // There are binary and other types of variables if (rowType == CGLFLOW_ROW_UNDEFINED) { if ((rhs < -EPSILON_) || (rhs > EPSILON_) || (numBin != 1)) { if (sense == 'L') rowType = CGLFLOW_ROW_MIXUB; else rowType = CGLFLOW_ROW_MIXEQ; } else { // EXACTLY one binary if (rowLen == 2) { // One binary and one other type if (sense == 'L') { if (numNegCol == 1 && numNegBin == 1) rowType = CGLFLOW_ROW_VARUB; if (numPosCol == 1 && numPosBin == 1) rowType = CGLFLOW_ROW_VARLB; } else rowType = CGLFLOW_ROW_VAREQ; } else { // One binary and 2 or more other types if (numNegCol==1 && numNegBin==1) {// Binary has neg coef and if (sense == 'L') // other are positive rowType = CGLFLOW_ROW_SUMVARUB; else rowType = CGLFLOW_ROW_SUMVAREQ; } } } } // Still undefined if (rowType == CGLFLOW_ROW_UNDEFINED) { if (sense == 'L') rowType = CGLFLOW_ROW_MIXUB; else rowType = CGLFLOW_ROW_MIXEQ; } if (flipped == true) { flipRow(rowLen, coef, sense, rhs); } return rowType; } /*===========================================================================*/ void CglFlowCover::liftMinus(double &movement, /* Output */ int t, int r, double z, double dPrimePrime, double lambda, double ml, double *M, double *rho) const { int i; movement = 0.0; if (z > dPrimePrime) { movement = z - M[r] + r * lambda; } else { for (i = 0; i < t; ++i) { if ( (z >= M[i]) && (z <= M[(i+1)] - lambda) ) { movement = i * lambda; return; } } for (i = 1; i < t; ++i) { if ( (z >= M[i] - lambda) && (z <= M[i]) ) { movement = z - M[i] + i * lambda; return; } } for (i = t; i < r; ++i) { if ( (z >= M[i] - lambda) && (z <= M[i] - lambda + ml + rho[i]) ) { movement = z - M[i] + i * lambda; return; } } for (i = t; i < r; ++i) { if ( (z >= M[i]-lambda+ml+rho[i]) && (z <= M[(i+1)]-lambda) ) { movement = i * lambda; return; } } if ((z >= M[r] - lambda) && z <= dPrimePrime) { movement = z - M[r] + r * lambda; } } } /*===========================================================================*/ bool CglFlowCover::liftPlus(double &alpha, double &beta, int r, double m_j, double lambda, double y_j, double x_j, double dPrimePrime, double *M) const { int i; bool status = false; /* Default: fail to lift */ double value; alpha = 0.0; beta = 0.0; if (m_j > M[r] - lambda + EPSILON_) { if (m_j < dPrimePrime - EPSILON_) { if ((m_j > (M[r] - lambda)) && (m_j <= M[r])){ /* FIXME: Test */ value = y_j - x_j * (M[r] - r * lambda); /* FIXME: Is this "if" useful */ if (value > 0.0) { status = true; alpha = 1.0; beta = M[r] - r * lambda; if(CGLFLOW_DEBUG) { printf("liftPlus:1: value=%f, alpah=%f, beta=%f\n", value, alpha,beta); } } else { if(CGLFLOW_DEBUG) { printf("liftPlus:1: value=%f, become worst\n",value); } } } } else { if(CGLFLOW_DEBUG) { printf("liftPlus:1: too big number\n"); } } } else { for (i = 1; i <= r; ++i) { if ((m_j > (M[i] - lambda)) && (m_j <= M[i])){ /* FIXME: Test */ value = y_j - x_j * (M[i] - i * lambda); /* FIXME: Is this "if" useful */ if (value > 0.0) { status = true; alpha = 1.0; beta = M[i] - i * lambda; if(CGLFLOW_DEBUG) { printf("liftPlus:2: value=%f, alpah=%f, beta=%f\n", value, alpha, beta); } } else { if(CGLFLOW_DEBUG) { printf("liftPlus:2: value=%f, become worst\n",value); } } return status; } } } return status; } // Create C++ lines to get to current state std::string CglFlowCover::generateCpp( FILE * fp) { CglFlowCover other; fprintf(fp,"0#include \"CglFlowCover.hpp\"\n"); fprintf(fp,"3 CglFlowCover flowCover;\n"); if (maxNumCuts_!=other.maxNumCuts_) fprintf(fp,"3 flowCover.setMaxNumCuts(%d);\n",maxNumCuts_); else fprintf(fp,"4 flowCover.setMaxNumCuts(%d);\n",maxNumCuts_); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 flowCover.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 flowCover.setAggressiveness(%d);\n",getAggressiveness()); return "flowCover"; } CoinMP-1.8.3/Cgl/src/CglFlowCover/CglFlowCover.hpp0000644000175000017500000003014612130102162020201 0ustar renerene// $Id: CglFlowCover.hpp 1119 2013-04-06 20:24:18Z stefan $ //----------------------------------------------------------------------------- // name: Cgl Lifted Simple Generalized Flow Cover Cut Generator // author: Yan Xu email: yan.xu@sas.com // Jeff Linderoth email: jtl3@lehigh.edu // Martin Savelsberg email: martin.savelsbergh@isye.gatech.edu // date: 05/01/2003 // comments: please scan this file for '???' and read the comments //----------------------------------------------------------------------------- // Copyright (C) 2003, Yan Xu, Jeff Linderoth, Martin Savelsberg and others. // All Rights Reserved. // This code is published under the Eclipse Public License. #ifndef CglFlowCover_H #define CglFlowCover_H #include #include "CoinError.hpp" #include "CglCutGenerator.hpp" //============================================================================= //============================================================================= /** This enumerative constant describes the various col types.*/ enum CglFlowColType { /** The column(variable) is a negative binary variable.*/ CGLFLOW_COL_BINNEG = -2, /** The column is a negative continous variable.*/ CGLFLOW_COL_CONTNEG, /** The column is a positive continous variable.*/ CGLFLOW_COL_CONTPOS = 1, /** The column is a positive binary variable.*/ CGLFLOW_COL_BINPOS }; enum CglFlowColStatus{ }; /** This enumerative constant describes the various stati of vars in a cut or not.*/ enum CglFlowColCut{ /** The column is NOT in cover.*/ CGLFLOW_COL_OUTCUT = 0, /** The column is in cover now. */ CGLFLOW_COL_INCUT, /** The column is decided to be in cover. */ CGLFLOW_COL_INCUTDONE, /** The column is in L-. */ CGLFLOW_COL_INLMIN, /** The column is decided to be in L-. */ CGLFLOW_COL_INLMINDONE, /** The column is in L--.*/ CGLFLOW_COL_INLMINMIN, /** This enumerative constant describes the various stati of vars in determining the cover.*/ /** The column is a prime candidate. */ CGLFLOW_COL_PRIME, /** The column is a secondary candidate. */ CGLFLOW_COL_SECONDARY }; /** This enumerative constant describes the various row types.*/ enum CglFlowRowType { /** The row type of this row is NOT defined yet.*/ CGLFLOW_ROW_UNDEFINED, /** After the row is flipped to 'L', the row has exactly two variables: one is negative binary and the other is continous, and the RHS is zero.*/ CGLFLOW_ROW_VARUB, /** After the row is flipped to 'L', the row has exactlytwo variables: one is positive binary and the other is continous, and the RHS is zero.*/ CGLFLOW_ROW_VARLB, /** The row sense is 'E', the row has exactly two variables: one is binary and the other is a continous, and the RHS is zero.*/ CGLFLOW_ROW_VAREQ, /** Rows can not be classfied into other types and the row sense is NOT 'E'.*/ CGLFLOW_ROW_MIXUB, /** Rows can not be classfied into other types and the row sense is 'E'.*/ CGLFLOW_ROW_MIXEQ, /** All variables are NOT binary and the row sense is NOT 'E'. */ CGLFLOW_ROW_NOBINUB, /** All variables are NOT binary and the row sense is 'E'. */ CGLFLOW_ROW_NOBINEQ, /** The row has one binary and 2 or more other types of variables and the row sense is NOT 'E'. */ CGLFLOW_ROW_SUMVARUB, /** The row has one binary and 2 or more other types of variables and the row sense is 'E'. */ CGLFLOW_ROW_SUMVAREQ, /** All variables are binary. */ CGLFLOW_ROW_UNINTERSTED }; //============================================================================= /** Variable upper bound class. */ class CglFlowVUB { protected: int varInd_; /** The index of the associated 0-1 variable.*/ double upper_; /** The Value of the associated upper bound.*/ public: CglFlowVUB() : varInd_(-1), upper_(-1) {} CglFlowVUB(const CglFlowVUB& source) { varInd_= source.varInd_; upper_ = source.upper_; } CglFlowVUB& operator=(const CglFlowVUB& rhs) { if (this == &rhs) return *this; varInd_= rhs.varInd_; upper_ = rhs.upper_; return *this; } /**@name Query and set functions for associated 0-1 variable index and value. */ //@{ inline int getVar() const { return varInd_; } inline double getVal() const { return upper_; } inline void setVar(const int v) { varInd_ = v; } inline void setVal(const double v) { upper_ = v; } //@} }; //============================================================================= /** Variable lower bound class, which is the same as vub. */ typedef CglFlowVUB CglFlowVLB; /** Overloaded operator<< for printing VUB and VLB.*/ std::ostream& operator<<( std::ostream& os, const CglFlowVUB &v ); //============================================================================= /** * Lifed Simple Generalized Flow Cover Cut Generator Class. */ class CglFlowCover : public CglCutGenerator { friend void CglFlowCoverUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /** * Do the following tasks: *
      *
    • classify row types *
    • indentify vubs and vlbs *
    * This function is called by * generateCuts(const OsiSolverInterface & si, OsiCuts & cs). */ void flowPreprocess(const OsiSolverInterface& si); /**@name Generate Cuts */ //@{ /** Generate Lifed Simple Generalized flow cover cuts for the model data contained in si. The generated cuts are inserted into and returned in the collection of cuts cs. */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Functions to query and set maximum number of cuts can be generated. */ //@{ inline int getMaxNumCuts() const { return maxNumCuts_; } inline void setMaxNumCuts(int mc) { maxNumCuts_ = mc; } //@} /**@name Functions to query and set the number of cuts have been generated. */ //@{ static int getNumFlowCuts() { return numFlowCuts_; } static void setNumFlowCuts(int fc) { numFlowCuts_ = fc; } static void incNumFlowCuts(int fc = 1) { numFlowCuts_ += fc; } //@} //------------------------------------------------------------------------- /**@name Constructors and destructors */ //@{ /// Default constructor CglFlowCover (); /// Copy constructor CglFlowCover ( const CglFlowCover &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglFlowCover & operator=( const CglFlowCover& rhs); /// Destructor virtual ~CglFlowCover (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} private: //------------------------------------------------------------------------- // Private member functions /** Based a given row, a LP solution and other model data, this function tries to generate a violated lifted simple generalized flow cover. */ bool generateOneFlowCut( const OsiSolverInterface & si, const int rowLen, int* ind, double* coef, char sense, double rhs, OsiRowCut& flowCut, double& violation ); /** Transform a row from ">=" to "<=", and vice versa. */ void flipRow(int rowLen, double* coef, double& rhs) const; /** Transform a row from ">=" to "<=", and vice versa. Have 'sense'. */ void flipRow(int rowLen, double* coef, char& sen, double& rhs) const; /** Determine the type of a given row. */ CglFlowRowType determineOneRowType(const OsiSolverInterface& si, int rowLen, int* ind, double* coef, char sen, double rhs) const; /** Lift functions */ void liftMinus(double &movement, /* Output */ int t, int r, double z, double dPrimePrime, double lambda, double ml, double *M, double *rho) const; bool liftPlus(double &alpha, double &beta, int r, double m_j, double lambda, double y_j, double x_j, double dPrimePrime, double *M) const; //------------------------------------------------------------------------- //**@name Query and set the row type of a givne row. */ //@{ inline const CglFlowRowType* getRowTypes() const { return rowTypes_; } inline CglFlowRowType getRowType(const int i) const { return rowTypes_[i]; } /** Set rowtypes, take over the ownership. */ inline void setRowTypes(CglFlowRowType* rt) { rowTypes_ = rt; rt = 0; } inline void setRowTypes(const CglFlowRowType rt, const int i) { if (rowTypes_ != 0) rowTypes_[i] = rt; else { std::cout << "ERROR: Should allocate memory for rowType_ before " << "using it " << std::endl; throw CoinError("Forgot to allocate memory for rowType_", "setRowType", "CglFlowCover"); } } //@} //------------------------------------------------------------------------- //**@name Query and set vubs. */ //@{ inline const CglFlowVUB* getVubs() const { return vubs_; } inline const CglFlowVUB& getVubs(int i) const { return vubs_[i]; } /** Set CglFlowVUBs,take over the ownership. */ inline void setVubs(CglFlowVUB* vubs) { vubs_ = vubs; vubs = 0; } inline void setVubs(const CglFlowVUB& vub, int i) { if (vubs_ != 0) vubs_[i] = vub; else { std::cout << "ERROR: Should allocate memory for vubs_ before " << "using it " << std::endl; throw CoinError("Forgot to allocate memory for vubs_", "setVubs", "CglFlowCover"); } } inline void printVubs(std::ostream& os) const { for (int i = 0; i < numCols_; ++i) { os << "ix: " << i << ", " << vubs_[i]; } } //@} //------------------------------------------------------------------------- //**@name Query and set vlbs. */ //@{ inline const CglFlowVLB* getVlbs() const { return vlbs_; } inline const CglFlowVLB& getVlbs(int i) const { return vlbs_[i]; } /** Set CglFlowVLBs,take over the ownership. */ inline void setVlbs(CglFlowVLB* vlbs) { vlbs_ = vlbs; vlbs = 0; } inline void setVlbs(const CglFlowVLB& vlb, int i) { if (vlbs_ != 0) vlbs_[i] = vlb; else { std::cout << "ERROR: Should allocate memory for vlbs_ before " << "using it " << std::endl; throw CoinError("Forgot to allocate memory for vlbs_", "setVlbs", "CglFlowCover"); } } //@} private: //------------------------------------------------------------------------ // Private member data /** The maximum number of flow cuts to be generated. Default is 1000. */ int maxNumCuts_; /** Tolerance used for numerical purpose. */ double EPSILON_; /** The variable upper bound of a flow is not indentified yet.*/ int UNDEFINED_; /** Very large number. */ double INFTY_; /** If violation of a cut is greater that this number, the cut is useful.*/ double TOLERANCE_; /** First time preprocessing */ bool firstProcess_; /** The number rows of the problem.*/ int numRows_; /** The number columns of the problem.*/ int numCols_; /** The number flow cuts found.*/ static int numFlowCuts_; /** Indicate whether initial flow preprecessing has been done. */ bool doneInitPre_; /** The array of CglFlowVUBs. */ CglFlowVUB* vubs_; /** The array of CglFlowVLBs. */ CglFlowVLB* vlbs_; /** CglFlowRowType of the rows in model. */ CglFlowRowType* rowTypes_; }; //############################################################################# /** A function that tests the methods in the CglFlowCover class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglFlowCoverUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); #endif CoinMP-1.8.3/Cgl/src/CglFlowCover/CglFlowCoverTest.cpp0000644000175000017500000001103111507177625021053 0ustar renerene// $Id: CglFlowCoverTest.cpp 908 2010-12-30 21:54:29Z mjs $ //----------------------------------------------------------------------------- // name: Cgl Lifed Simple Generalized Flow Cover Cut Generator // author: Yan Xu email: Yan.Xu@sas.com // Jeff Linderoth email: jtl3@lehigh.edu // Martin Savelsberg email: martin.savelsbergh@isye.gatech.edu // date: 05/01/2003 // comments: please scan this file for '???' and read the comments //----------------------------------------------------------------------------- // Copyright (C) 2003, Yan Xu, Jeff Linderoth, Martin Savelsberg and others. // All Rights Reserved. // This code is published under the Eclipse Public License. #ifdef NDEBUG #undef NDEBUG #endif #include #include //#include "CoinPackedMatrix.hpp" #include "CglFlowCover.hpp" //-------------------------------------------------------------------------- void CglFlowCoverUnitTest( const OsiSolverInterface * baseSiP, const std::string mpsDir ) { // Test default constructor { CglFlowCover aGenerator; assert (aGenerator.getMaxNumCuts() == 2000); } // Test copy & assignment { CglFlowCover rhs; { CglFlowCover bGenerator; bGenerator.setMaxNumCuts(100); CglFlowCover cGenerator(bGenerator); rhs=bGenerator; } } { OsiCuts osicuts1; CglFlowCover test; OsiSolverInterface * siP = baseSiP->clone(); int nRowCuts; std::string fn(mpsDir+"egout"); std::string fn2 = mpsDir+"egout.mps"; FILE *in_f = fopen(fn2.c_str(), "r"); if(in_f == NULL) { std::cout<<"Can not open file "<readMps(fn.c_str(), "mps"); // Check the preprocess test.flowPreprocess(*siP); #ifdef CGL_DEBUG test.printVubs(std::cout); #endif // Test generating cuts siP->initialSolve(); double lpRelax = siP->getObjValue(); test.generateCuts(*siP, osicuts1); nRowCuts = osicuts1.sizeRowCuts(); #ifdef CGL_DEBUG std::cout<<"There are " << nRowCuts << " flow cuts" << std::endl; int i; for (i = 0; i < nRowCuts; i++){ OsiRowCut rcut; CoinPackedVector rpv; const double* colsol = siP->getColSolution(); rcut = osicuts1.rowCut(i); rpv = rcut.row(); const int n = rpv.getNumElements(); const int* indices = rpv.getIndices(); double* elements = rpv.getElements(); double sum2 = 0.0; int k = 0; double lb = rcut.lb(); double ub = rcut.ub(); for (k = 0; k < n; ++k){ int column = indices[k]; sum2 += colsol[column] * elements[k]; } if (sum2 > ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout << "Cut " << i <<" lb " << lb << " solution " << sum2 <<" ub " << ub << std::endl; for (k = 0; k < n; ++k){ int column = indices[k]; std::cout << "(col=" << column << ", el = " << elements[k] << ", sol = " << colsol[column] << ") "; } std::cout <applyCuts(osicuts2); siP->resolve(); nRowCuts = osicuts2.sizeRowCuts(); std::cout<<"There are " << nRowCuts << " flow cuts" << std::endl; #ifdef CGL_DEBUG for (i = 0; i < nRowCuts; i++){ OsiRowCut rcut; CoinPackedVector rpv; const double* colsol = siP->getColSolution(); rcut = osicuts2.rowCut(i); rpv = rcut.row(); const int n = rpv.getNumElements(); const int* indices = rpv.getIndices(); double* elements = rpv.getElements(); double sum2 = 0.0; int k = 0; double lb = rcut.lb(); double ub = rcut.ub(); for (k = 0; k < n; ++k){ int column = indices[k]; sum2 += colsol[column] * elements[k]; } if (sum2 > ub + 1.0e-7 ||sum2 < lb - 1.0e-7) { std::cout << "Cut " << i <<" lb " << lb << " solution " << sum2 <<" ub " << ub << std::endl; for (k = 0; k < n; ++k){ int column = indices[k]; std::cout << "(col=" << column << ", el = " << elements[k] << ", sol = " << colsol[column] << ") "; } std::cout < 0); rc = siP->applyCuts(osicuts2); siP->resolve(); double lpRelaxAfter= siP->getObjValue(); std::cout<<"Initial LP value: "< #include #include #include #include #include //#define CGL_DEBUG 2 #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "OsiRowCutDebugger.hpp" #include "CoinWarmStartBasis.hpp" #include "CglStored.hpp" #include "CglTreeInfo.hpp" #include "CoinFinite.hpp" //------------------------------------------------------------------- // Generate Stored cuts //------------------------------------------------------------------- void CglStored::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo /*info*/) { // Get basic problem information const double * solution = si.getColSolution(); int numberRowCuts = cuts_.sizeRowCuts(); for (int i=0;iviolated(solution); if (violation>=requiredViolation_) cs.insert(*rowCutPointer); } if (probingInfo_) { int number01 = probingInfo_->numberIntegers(); const CliqueEntry * entry = probingInfo_->fixEntries(); const int * toZero = probingInfo_->toZero(); const int * toOne = probingInfo_->toOne(); const int * integerVariable = probingInfo_->integerVariable(); const double * lower = si.getColLower(); const double * upper = si.getColUpper(); OsiRowCut cut; int column[2]; double element[2]; for (int i=0;i=0); double value2 = solution[jColumn]; if (oneFixesInCliqueEntry(entry[j])) { double violation = 1.0-value1-value2; if (violation>requiredViolation_) { //printf("XXX can do %d + %d >=1\n",iColumn,jColumn); cut.setLb(1.0); cut.setUb(COIN_DBL_MAX); column[0]=iColumn; element[0]=1.0; column[1]=jColumn; element[1]= 1.0; cut.setEffectiveness(violation); cut.setRow(2,column,element,false); cs.insert(cut); } } else { double violation = value2-value1; if (violation>requiredViolation_) { //printf("XXX can do %d >= %d\n",iColumn,jColumn); cut.setLb(0.0); cut.setUb(COIN_DBL_MAX); column[0]=iColumn; element[0]=1.0; column[1]=jColumn; element[1]= -1.0; cut.setEffectiveness(violation); cut.setRow(2,column,element,false); cs.insert(cut); } } } else { jColumn -= number01; // not 0-1 double value2 = solution[jColumn]; double lowerValue = lower[jColumn]; double upperValue = upper[jColumn]; if (oneFixesInCliqueEntry(entry[j])) { double violation = upperValue-value1*(upperValue-lowerValue)-value2; if (violation>requiredViolation_) { //printf("XXX can do %g*%d + %d >=%g\n",(upperValue-lowerValue),iColumn,jColumn,upperValue); cut.setLb(upperValue); cut.setUb(COIN_DBL_MAX); column[0]=iColumn; element[0]=upperValue-lowerValue; column[1]=jColumn; element[1]= 1.0; cut.setEffectiveness(violation); cut.setRow(2,column,element,false); cs.insert(cut); } } else { double violation = value2-value1*(upperValue-lowerValue)-lowerValue; if (violation>requiredViolation_) { //printf("XXX can do %g*%d >= %d -%g\n",(upperValue-lowerValue),iColumn,jColumn,lowerValue); cut.setLb(-lowerValue); cut.setUb(COIN_DBL_MAX); column[0]=iColumn; element[0]=upperValue-lowerValue; column[1]=jColumn; element[1]= -1.0; cut.setEffectiveness(violation); cut.setRow(2,column,element,false); cs.insert(cut); } } } } for (int j=toOne[i];j=0); double value2 = solution[jColumn]; if (oneFixesInCliqueEntry(entry[j])) { double violation = value1-value2; if (violation>requiredViolation_) { //printf("XXX can do %d <= %d\n",iColumn,jColumn); cut.setLb(-COIN_DBL_MAX); cut.setUb(0.0); column[0]=iColumn; element[0]=1.0; column[1]=jColumn; element[1]= -1.0; cut.setEffectiveness(violation); cut.setRow(2,column,element,false); cs.insert(cut); } } else { double violation = value1+value2-1.0; if (violation>requiredViolation_) { //printf("XXX can do %d + %d <=1\n",iColumn,jColumn); cut.setLb(-COIN_DBL_MAX); cut.setUb(1.0); column[0]=iColumn; element[0]=1.0; column[1]=jColumn; element[1]= 1.0; cut.setEffectiveness(violation); cut.setRow(2,column,element,false); cs.insert(cut); } } } else { jColumn -= number01; // not 0-1 double value2 = solution[jColumn]; double lowerValue = lower[jColumn]; double upperValue = upper[jColumn]; if (oneFixesInCliqueEntry(entry[j])) { double violation = lowerValue +(upperValue-lowerValue)*value1-value2; if (violation>requiredViolation_) { //printf("XXX can do %g*%d <= %d -%g\n",(upperValue-lowerValue),iColumn,jColumn,lowerValue); cut.setLb(-COIN_DBL_MAX); cut.setUb(-lowerValue); column[0]=iColumn; element[0]=upperValue-lowerValue; column[1]=jColumn; element[1]= -1.0; cut.setEffectiveness(violation); cut.setRow(2,column,element,false); cs.insert(cut); } } else { double violation = (upperValue-lowerValue)*value1+value2-upperValue; if (violation>requiredViolation_) { //printf("XXX can do %g*%d + %d <=%g\n",(upperValue-lowerValue),iColumn,jColumn,upperValue); cut.setLb(-COIN_DBL_MAX); cut.setUb(upperValue); column[0]=iColumn; element[0]=upperValue-lowerValue; column[1]=jColumn; element[1]= 1.0; cut.setEffectiveness(violation); cut.setRow(2,column,element,false); cs.insert(cut); } } } } } } } // Add cuts void CglStored::addCut(const OsiCuts & cs) { int numberRowCuts = cs.sizeRowCuts(); for (int i=0;i=0) { #ifndef NDEBUG numberRead = fread(&n,sizeof(int),1,fp); assert (numberRead==1); #else fread(&n,sizeof(int),1,fp); #endif if (n<0) break; if (n>maxInCut) { maxInCut=n; delete [] index; delete [] coefficient; index = new int [maxInCut]; coefficient = new double [maxInCut]; } #ifndef NDEBUG numberRead = fread(rhs,sizeof(double),2,fp); assert (numberRead==2); #else fread(rhs,sizeof(double),2,fp); #endif fread(index,sizeof(int),n,fp); fread(coefficient,sizeof(double),n,fp); OsiRowCut rc; rc.setRow(n,index,coefficient,false); rc.setLb(rhs[0]); rc.setUb(rhs[1]); cuts_.insert(rc); } delete [] index; delete [] coefficient; fclose(fp); } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglStored::clone() const { return new CglStored(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglStored::~CglStored () { delete probingInfo_; delete [] bestSolution_; delete [] bounds_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglStored & CglStored::operator=(const CglStored& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); requiredViolation_=rhs.requiredViolation_; cuts_=rhs.cuts_; delete probingInfo_; if (rhs.probingInfo_) probingInfo_ = new CglTreeProbingInfo(*rhs.probingInfo_); else probingInfo_ = NULL; delete [] bestSolution_; delete [] bounds_; bestSolution_ = NULL; bounds_ = NULL; numberColumns_ = rhs.numberColumns_; if (numberColumns_) { bestSolution_ = CoinCopyOfArray(rhs.bestSolution_,numberColumns_+1); bounds_ = CoinCopyOfArray(rhs.bounds_,2*numberColumns_); } } return *this; } // Save stuff void CglStored::saveStuff(double bestObjective, const double * bestSolution, const double * lower, const double * upper) { assert (numberColumns_); delete [] bestSolution_; delete [] bounds_; if (bestSolution) { bestSolution_ = new double[numberColumns_+1]; memcpy(bestSolution_,bestSolution,numberColumns_*sizeof(double)); bestSolution_[numberColumns_]=bestObjective; } else { bestSolution_=NULL; } bounds_ = new double [2*numberColumns_]; memcpy(bounds_,lower,numberColumns_*sizeof(double)); memcpy(bounds_+numberColumns_,upper,numberColumns_*sizeof(double)); } // Best objective double CglStored::bestObjective() const { if (bestSolution_) return bestSolution_[numberColumns_]; else return COIN_DBL_MAX; } CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding2/0000755000175000017500000000000012600453455017416 5ustar renereneCoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding2/Makefile.in0000644000175000017500000005513412506321416021467 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglMixedIntegerRounding2 DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglMixedIntegerRounding2_la_LIBADD = am_libCglMixedIntegerRounding2_la_OBJECTS = \ CglMixedIntegerRounding2.lo CglMixedIntegerRounding2Test.lo libCglMixedIntegerRounding2_la_OBJECTS = \ $(am_libCglMixedIntegerRounding2_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglMixedIntegerRounding2_la_SOURCES) DIST_SOURCES = $(libCglMixedIntegerRounding2_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglMixedIntegerRounding2 # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglMixedIntegerRounding2.la # List all source files for this library, including headers libCglMixedIntegerRounding2_la_SOURCES = CglMixedIntegerRounding2.cpp CglMixedIntegerRounding2.hpp CglMixedIntegerRounding2Test.cpp # This is for libtool (on Windows) libCglMixedIntegerRounding2_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglMixedIntegerRounding2.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglMixedIntegerRounding2/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglMixedIntegerRounding2/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglMixedIntegerRounding2.la: $(libCglMixedIntegerRounding2_la_OBJECTS) $(libCglMixedIntegerRounding2_la_DEPENDENCIES) $(CXXLINK) $(libCglMixedIntegerRounding2_la_LDFLAGS) $(libCglMixedIntegerRounding2_la_OBJECTS) $(libCglMixedIntegerRounding2_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglMixedIntegerRounding2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglMixedIntegerRounding2Test.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding2/Makefile.am0000644000175000017500000000334511621724114021452 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglMixedIntegerRounding2 # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglMixedIntegerRounding2.la # List all source files for this library, including headers libCglMixedIntegerRounding2_la_SOURCES = CglMixedIntegerRounding2.cpp CglMixedIntegerRounding2.hpp CglMixedIntegerRounding2Test.cpp # This is for libtool (on Windows) libCglMixedIntegerRounding2_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglMixedIntegerRounding2.hpp CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2Test.cpp0000644000175000017500000000477012130104031025551 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglMixedIntegerRounding2.hpp" void CglMixedIntegerRounding2UnitTest(const OsiSolverInterface *baseSiP, const std::string mpsDir) { // Test default constructor { CglMixedIntegerRounding2 aGenerator; } // Test copy & assignment { CglMixedIntegerRounding2 rhs; { CglMixedIntegerRounding2 bGenerator; CglMixedIntegerRounding2 cGenerator(bGenerator); rhs=bGenerator; } } // Test get/set methods { CglMixedIntegerRounding2 getset; int gagg = 10 * getset.getMAXAGGR_(); getset.setMAXAGGR_(gagg); int gagg2 = getset.getMAXAGGR_(); assert(gagg == gagg2); bool gmult = !getset.getMULTIPLY_(); getset.setMULTIPLY_(gmult); bool gmult2 = getset.getMULTIPLY_(); assert(gmult == gmult2); int gcrit = getset.getCRITERION_(); gcrit = (gcrit) % 3 + 1; getset.setCRITERION_(gcrit); int gcrit2 = getset.getCRITERION_(); assert(gcrit == gcrit2); int gpre = getset.getDoPreproc(); gpre = (gpre + 1) % 3 - 1; getset.setDoPreproc(gpre); int gpre2 = getset.getDoPreproc(); assert(gpre == gpre2); } // Test generateCuts { CglMixedIntegerRounding2 gct; OsiSolverInterface *siP = baseSiP->clone(); std::string fn = mpsDir+"capPlan1"; std::string fn2 = mpsDir+"capPlan1.mps"; FILE *in_f = fopen(fn2.c_str(), "r"); if(in_f == NULL) { std::cout<<"Can not open file "<readMps(fn.c_str(),"mps"); siP->initialSolve(); double lpRelax = siP->getObjValue(); OsiCuts cs; gct.setDoPreproc(1); // Needed for DyLP gct.generateCuts(*siP, cs); int nRowCuts = cs.sizeRowCuts(); std::cout<<"There are "< 0); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cs); siP->resolve(); double lpRelaxAfter= siP->getObjValue(); printf("Initial LP value: %f\n", lpRelax); printf("LP value with cuts: %f\n", lpRelaxAfter); assert( lpRelax < lpRelaxAfter ); assert(lpRelaxAfter < 964); } delete siP; } } CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.hpp0000644000175000017500000003227512130102162024722 0ustar renerene// LAST EDIT: //----------------------------------------------------------------------------- // name: Mixed Integer Rounding Cut Generator // authors: Joao Goncalves (jog7@lehigh.edu) // Laszlo Ladanyi (ladanyi@us.ibm.com) // date: August 11, 2004 //----------------------------------------------------------------------------- // Copyright (C) 2004, International Business Machines Corporation and others. // All Rights Reserved. // This code is published under the Eclipse Public License. #ifndef CglMixedIntegerRounding2_H #define CglMixedIntegerRounding2_H #include #include //#include #include "CoinError.hpp" #include "CglCutGenerator.hpp" #include "CoinIndexedVector.hpp" //============================================================================= #ifndef CGL_DEBUG #define CGL_DEBUG 0 #endif //============================================================================= // Class to store variable upper bounds (VUB) class CglMixIntRoundVUB2 { // Variable upper bounds have the form x_j <= a y_j, where x_j is // a continuous variable and y_j is an integer variable protected: int var_; // The index of y_j double val_; // The value of a public: // Default constructor CglMixIntRoundVUB2() : var_(-1), val_(-1) {} // Copy constructor CglMixIntRoundVUB2(const CglMixIntRoundVUB2& source) { var_ = source.var_; val_ = source.val_; } // Assignment operator CglMixIntRoundVUB2& operator=(const CglMixIntRoundVUB2& rhs) { if (this != &rhs) { var_ = rhs.var_; val_ = rhs.val_; } return *this; } // Destructor ~CglMixIntRoundVUB2() {} // Query and set functions int getVar() const { return var_; } double getVal() const { return val_; } void setVar(const int v) { var_ = v; } void setVal(const double v) { val_ = v; } }; //============================================================================= // Class to store variable lower bounds (VLB). // It is the same as the class to store variable upper bounds typedef CglMixIntRoundVUB2 CglMixIntRoundVLB2; //============================================================================= /** Mixed Integer Rounding Cut Generator Class */ // Reference: // Hugues Marchand and Laurence A. Wolsey // Aggregation and Mixed Integer Rounding to Solve MIPs // Operations Research, 49(3), May-June 2001. // Also published as CORE Dicusion Paper 9839, June 1998. class CglMixedIntegerRounding2 : public CglCutGenerator { friend void CglMixedIntegerRounding2UnitTest(const OsiSolverInterface * siP, const std::string mpdDir); private: //--------------------------------------------------------------------------- // Enumeration constants that describe the various types of rows enum RowType { // The row type of this row is NOT defined yet. ROW_UNDEFINED, /** After the row is flipped to 'L', the row has exactly two variables: one is negative binary and the other is a continous, and the RHS is zero.*/ ROW_VARUB, /** After the row is flipped to 'L', the row has exactly two variables: one is positive binary and the other is a continous, and the RHS is zero.*/ ROW_VARLB, /** The row sense is 'E', the row has exactly two variables: one is binary and the other is a continous, and the RHS is zero.*/ ROW_VAREQ, // The row contains continuous and integer variables; // the total number of variables is at least 2 ROW_MIX, // The row contains only continuous variables ROW_CONT, // The row contains only integer variables ROW_INT, // The row contains other types of rows ROW_OTHER }; public: /**@name Generate Cuts */ //@{ /** Generate Mixed Integer Rounding cuts for the model data contained in si. The generated cuts are inserted in the collection of cuts cs. */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} //--------------------------------------------------------------------------- /**@name Constructors and destructors */ //@{ /// Default constructor CglMixedIntegerRounding2 (); /// Alternate Constructor CglMixedIntegerRounding2 (const int maxaggr, const bool multiply, const int criterion, const int preproc = -1); /// Copy constructor CglMixedIntegerRounding2 ( const CglMixedIntegerRounding2 &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglMixedIntegerRounding2 & operator=( const CglMixedIntegerRounding2& rhs); /// Destructor virtual ~CglMixedIntegerRounding2 (); /// This can be used to refresh any inforamtion virtual void refreshSolver(OsiSolverInterface * solver); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} //--------------------------------------------------------------------------- /**@name Set and get methods */ //@{ /// Set MAXAGGR_ inline void setMAXAGGR_ (int maxaggr) { if (maxaggr > 0) { MAXAGGR_ = maxaggr; } else { throw CoinError("Unallowable value. maxaggr must be > 0", "gutsOfConstruct","CglMixedIntegerRounding2"); } } /// Get MAXAGGR_ inline int getMAXAGGR_ () const { return MAXAGGR_; } /// Set MULTIPLY_ inline void setMULTIPLY_ (bool multiply) { MULTIPLY_ = multiply; } /// Get MULTIPLY_ inline bool getMULTIPLY_ () const { return MULTIPLY_; } /// Set CRITERION_ inline void setCRITERION_ (int criterion) { if ((criterion >= 1) && (criterion <= 3)) { CRITERION_ = criterion; } else { throw CoinError("Unallowable value. criterion must be 1, 2 or 3", "gutsOfConstruct","CglMixedIntegerRounding2"); } } /// Get CRITERION_ inline int getCRITERION_ () const { return CRITERION_; } /// Set doPreproc void setDoPreproc(int value); /// Get doPreproc bool getDoPreproc() const; //@} private: //-------------------------------------------------------------------------- // Private member methods // Construct void gutsOfConstruct ( const int maxaggr, const bool multiply, const int criterion, const int preproc); // Delete void gutsOfDelete(); // Copy void gutsOfCopy (const CglMixedIntegerRounding2& rhs); // Do preprocessing. // It determines the type of each row. It also identifies the variable // upper bounds and variable lower bounds. // It may change sense and RHS for ranged rows void mixIntRoundPreprocess(const OsiSolverInterface& si); // Determine the type of a given row. RowType determineRowType(//const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const char sense, const double rhs) const; // Generate MIR cuts void generateMirCuts( const OsiSolverInterface& si, const double* xlp, const double* colUpperBound, const double* colLowerBound, const CoinPackedMatrix& matrixByRow, const double* LHS, //const double* coefByRow, //const int* colInds, //const int* rowStarts, //const CoinPackedMatrix& matrixByCol, const double* coefByCol, const int* rowInds, const int* colStarts, OsiCuts& cs ) const; // Copy row selected to CoinIndexedVector void copyRowSelected( const int iAggregate, const int rowSelected, CoinIndexedVector& setRowsAggregated, int* listRowsAggregated, double* xlpExtra, const char sen, const double rhs, const double lhs, const CoinPackedMatrix& matrixByRow, CoinIndexedVector& rowToAggregate, double& rhsToAggregate) const; // Select a row to aggregate bool selectRowToAggregate( //const OsiSolverInterface& si, const CoinIndexedVector& rowAggregated, const double* colUpperBound, const double* colLowerBound, const CoinIndexedVector& setRowsAggregated, const double* xlp, const double* coefByCol, const int* rowInds, const int* colStarts, int& rowSelected, int& colSelected ) const; // Aggregation heuristic. // Combines one or more rows of the original matrix void aggregateRow( const int colSelected, CoinIndexedVector& rowToAggregate, double rhs, CoinIndexedVector& rowAggregated, double& rhsAggregated ) const; // Choose the bound substitution based on the criteria defined by the user inline bool isLowerSubst(const double inf, const double aj, const double xlp, const double LB, const double UB) const; // Bound substitution heuristic bool boundSubstitution( const OsiSolverInterface& si, const CoinIndexedVector& rowAggregated, const double* xlp, const double* xlpExtra, const double* colUpperBound, const double* colLowerBound, CoinIndexedVector& mixedKnapsack, double& rhsMixedKnapsack, double& sStar, CoinIndexedVector& contVariablesInS ) const; // c-MIR separation heuristic bool cMirSeparation ( const OsiSolverInterface& si, const CoinPackedMatrix& matrixByRow, const CoinIndexedVector& rowAggregated, const int* listRowsAggregated, const char* sense, const double* RHS, //const double* coefByRow, //const int* colInds, const int* rowStarts, const double* xlp, const double sStar, const double* colUpperBound, const double* colLowerBound, const CoinIndexedVector& mixedKnapsack, const double& rhsMixedKnapsack, const CoinIndexedVector& contVariablesInS, CoinIndexedVector * workVector, OsiRowCut& flowCut ) const; // function to create one c-MIR inequality void cMirInequality( const int numInt, const double delta, const double numeratorBeta, const int *knapsackIndices, const double* knapsackElements, const double* xlp, const double sStar, const double* colUpperBound, const CoinIndexedVector& setC, CoinIndexedVector& cMIR, double& rhscMIR, double& sCoef, double& violation) const; // function to compute G inline double functionG( const double d, const double f ) const; // function to print statistics (used only in debug mode) void printStats( std::ofstream & fout, const bool hasCut, const OsiSolverInterface& si, const CoinIndexedVector& rowAggregated, const double& rhsAggregated, const double* xlp, const double* xlpExtra, const int* listRowsAggregated, const int* listColsSelected, const int level, const double* colUpperBound, const double* colLowerBound ) const; private: //--------------------------------------------------------------------------- // Private member data // Maximum number of rows to aggregate int MAXAGGR_; // Flag that indicates if an aggregated row is also multiplied by -1 bool MULTIPLY_; // The criterion to use in the bound substitution int CRITERION_; // Tolerance used for numerical purposes double EPSILON_; /// There is no variable upper bound or variable lower bound defined int UNDEFINED_; // If violation of a cut is greater that this number, the cut is accepted double TOLERANCE_; /** Controls the preprocessing of the matrix to identify rows suitable for cut generation.
    • -1: preprocess according to solver settings;
    • 0: Do preprocessing only if it has not yet been done;
    • 1: Do preprocessing.
    Default value: -1 **/ int doPreproc_; // The number of rows of the problem. int numRows_; // The number columns of the problem. int numCols_; // Indicates whether preprocessing has been done. bool doneInitPre_; // The array of CglMixIntRoundVUB2s. CglMixIntRoundVUB2* vubs_; // The array of CglMixIntRoundVLB2s. CglMixIntRoundVLB2* vlbs_; // Array with the row types of the rows in the model. RowType* rowTypes_; // The indices of the rows of the initial matrix int* indRows_; // The number of rows of type ROW_MIX int numRowMix_; // The indices of the rows of type ROW_MIX int* indRowMix_; // The number of rows of type ROW_CONT int numRowCont_; // The indices of the rows of type ROW_CONT int* indRowCont_; // The number of rows of type ROW_INT int numRowInt_; // The indices of the rows of type ROW_INT int* indRowInt_; // The number of rows of type ROW_CONT that have at least one variable // with variable upper or lower bound int numRowContVB_; // The indices of the rows of type ROW_CONT that have at least one variable // with variable upper or lower bound int* indRowContVB_; // If integer - for speed char * integerType_; // Sense of rows (modified if ranges) char * sense_; // RHS of rows (modified if ranges) double * RHS_; }; //############################################################################# // A function that tests the methods in the CglMixedIntegerRounding2 class. The // only reason for it not to be a member method is that this way it doesn't // have to be compiled into the library. And that's a gain, because the // library should be compiled with optimization on, but this method should be // compiled with debugging. void CglMixedIntegerRounding2UnitTest(const OsiSolverInterface * siP, const std::string mpdDir); #endif CoinMP-1.8.3/Cgl/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.cpp0000644000175000017500000015615612474405756024754 0ustar renerene// LAST EDIT: //----------------------------------------------------------------------------- // name: Mixed Integer Rounding Cut Generator // authors: Joao Goncalves (jog7@lehigh.edu) // Laszlo Ladanyi (ladanyi@us.ibm.com) // date: August 11, 2004 //----------------------------------------------------------------------------- // Copyright (C) 2004, International Business Machines Corporation and others. // All Rights Reserved. // This code is published under the Eclipse Public License. //#include //#include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinPackedVector.hpp" #include "CglMixedIntegerRounding2.hpp" //#define CGL_DEBUG2 2 #if CGL_DEBUG2 static int xxxxxx=0; static int yyyyyy=1687; #endif //----------------------------------------------------------------------------- // Generate Mixed Integer Rounding inequality //------------------------------------------------------------------- void CglMixedIntegerRounding2::generateCuts(const OsiSolverInterface& si, OsiCuts& cs, const CglTreeInfo info) { // If the LP or integer presolve is used, then need to redo preprocessing // everytime this function is called. Otherwise, just do once. bool preInit = false; bool preReso = false; si.getHintParam(OsiDoPresolveInInitial, preInit); si.getHintParam(OsiDoPresolveInResolve, preReso); if (preInit == false && preReso == false && doPreproc_ == -1 ) { // Do once if (doneInitPre_ == false) { mixIntRoundPreprocess(si); doneInitPre_ = true; } } else { if(doPreproc_ == 1){ // Do everytime mixIntRoundPreprocess(si); doneInitPre_ = true; } else { if (doneInitPre_ == false) { mixIntRoundPreprocess(si); doneInitPre_ = true; } } } int numberRowCutsBefore = cs.sizeRowCuts(); const double* xlp = si.getColSolution(); // LP solution const double* colUpperBound = si.getColUpper(); // vector of upper bounds const double* colLowerBound = si.getColLower(); // vector of lower bounds // get matrix by row const CoinPackedMatrix & tempMatrixByRow = *si.getMatrixByRow(); CoinPackedMatrix matrixByRow(false,0.0,0.0); // There are no duplicates but this is faster matrixByRow.submatrixOfWithDuplicates(tempMatrixByRow, numRows_, indRows_); CoinPackedMatrix matrixByCol(matrixByRow,0,0,true); //matrixByCol.reverseOrdering(); //const CoinPackedMatrix & matrixByRow = *si.getMatrixByRow(); const double* LHS = si.getRowActivity(); //const double* coefByRow = matrixByRow.getElements(); //const int* colInds = matrixByRow.getIndices(); //const int* rowStarts = matrixByRow.getVectorStarts(); // get matrix by column //const CoinPackedMatrix & matrixByCol = *si.getMatrixByCol(); const double* coefByCol = matrixByCol.getElements(); const int* rowInds = matrixByCol.getIndices(); const int* colStarts = matrixByCol.getVectorStarts(); generateMirCuts(si, xlp, colUpperBound, colLowerBound, matrixByRow, LHS, //coefByRow, //colInds, rowStarts, //matrixByCol, coefByCol, rowInds, colStarts, cs); if (!info.inTree&&((info.options&4)==4||((info.options&8)&&!info.pass))) { int numberRowCutsAfter = cs.sizeRowCuts(); for (int i=numberRowCutsBefore;isetGloballyValid(); } } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglMixedIntegerRounding2::CglMixedIntegerRounding2 () : CglCutGenerator() { gutsOfConstruct(1, true, 1, -1); } //------------------------------------------------------------------- // Alternate Constructor //------------------------------------------------------------------- CglMixedIntegerRounding2::CglMixedIntegerRounding2 (const int maxaggr, const bool multiply, const int criterion, const int preproc) : CglCutGenerator() { gutsOfConstruct(maxaggr, multiply, criterion, preproc); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglMixedIntegerRounding2::CglMixedIntegerRounding2 ( const CglMixedIntegerRounding2 & rhs) : CglCutGenerator(rhs) { gutsOfCopy(rhs); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglMixedIntegerRounding2::clone() const { return new CglMixedIntegerRounding2(*this); } //------------------------------------------------------------------ // Assignment operator //------------------------------------------------------------------- CglMixedIntegerRounding2 & CglMixedIntegerRounding2::operator=(const CglMixedIntegerRounding2& rhs) { if (this != &rhs) { gutsOfDelete(); CglCutGenerator::operator=(rhs); gutsOfCopy(rhs); } return *this; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglMixedIntegerRounding2::~CglMixedIntegerRounding2 () { gutsOfDelete(); } //------------------------------------------------------------------- // Construct //------------------------------------------------------------------- void CglMixedIntegerRounding2::gutsOfConstruct (const int maxaggr, const bool multiply, const int criterion, const int preproc) { if (maxaggr > 0) { MAXAGGR_ = maxaggr; } else { throw CoinError("Unallowable value. maxaggr must be > 0", "gutsOfConstruct","CglMixedIntegerRounding2"); } MULTIPLY_ = multiply; if ((criterion >= 1) && (criterion <= 3)) { CRITERION_ = criterion; } else { throw CoinError("Unallowable value. criterion must be 1, 2 or 3", "gutsOfConstruct","CglMixedIntegerRounding2"); } if ((preproc >= -1) && (preproc <= 2)) { doPreproc_ = preproc; } else { throw CoinError("Unallowable value. preproc must be -1, 0 or 1", "gutsOfConstruct","CglMixedIntegerRounding"); } EPSILON_ = 1.0e-6; UNDEFINED_ = -1; TOLERANCE_ = 1.0e-4; numRows_ = 0; numCols_ = 0; doneInitPre_ = false; vubs_ = 0; vlbs_ = 0; rowTypes_ = 0; indRows_ = 0; numRowMix_ = 0; indRowMix_ = 0; numRowCont_ = 0; indRowCont_ = 0; numRowInt_ = 0; indRowInt_ = 0; numRowContVB_ = 0; indRowContVB_ = 0; integerType_ = NULL; sense_=NULL; RHS_=NULL; } //------------------------------------------------------------------- // Delete //------------------------------------------------------------------- void CglMixedIntegerRounding2::gutsOfDelete () { if (vubs_ != 0) { delete [] vubs_; vubs_ = 0; } if (vlbs_ != 0) { delete [] vlbs_; vlbs_ = 0; } if (rowTypes_ != 0) { delete [] rowTypes_; rowTypes_ = 0; } if (indRows_ != 0) { delete [] indRows_; indRows_ = 0; } if (indRowMix_ != 0) { delete [] indRowMix_; indRowMix_ = 0; } if (indRowCont_ != 0) { delete [] indRowCont_; indRowCont_ = 0; } if (indRowInt_ != 0) { delete [] indRowInt_; indRowInt_ = 0; } if (indRowContVB_ != 0) { delete [] indRowContVB_; indRowContVB_ = 0; } if (integerType_ !=NULL) { delete [] integerType_; integerType_=NULL;} if (sense_ !=NULL) { delete [] sense_; sense_=NULL;} if (RHS_ !=NULL) { delete [] RHS_; RHS_=NULL;} } //------------------------------------------------------------------- // Copy //------------------------------------------------------------------- void CglMixedIntegerRounding2::gutsOfCopy (const CglMixedIntegerRounding2& rhs) { MAXAGGR_ = rhs.MAXAGGR_; MULTIPLY_ = rhs.MULTIPLY_; CRITERION_ = rhs.CRITERION_; EPSILON_ = rhs.EPSILON_; UNDEFINED_ = rhs.UNDEFINED_; TOLERANCE_ = rhs.TOLERANCE_; doPreproc_ = rhs.doPreproc_; numRows_ = rhs.numRows_; numCols_ = rhs.numCols_; doneInitPre_ = rhs.doneInitPre_; numRowMix_ = rhs.numRowMix_; numRowCont_ = rhs.numRowCont_; numRowInt_ = rhs.numRowInt_; numRowContVB_ = rhs.numRowContVB_; if (numCols_ > 0) { vubs_ = new CglMixIntRoundVUB2 [numCols_]; vlbs_ = new CglMixIntRoundVLB2 [numCols_]; CoinDisjointCopyN(rhs.vubs_, numCols_, vubs_); CoinDisjointCopyN(rhs.vlbs_, numCols_, vlbs_); integerType_ = CoinCopyOfArray(rhs.integerType_,numCols_); } else { vubs_ = 0; vlbs_ = 0; integerType_ = NULL; } if (numRows_ > 0) { rowTypes_ = new RowType [numRows_]; CoinDisjointCopyN(rhs.rowTypes_, numRows_, rowTypes_); indRows_ = new int [numRows_]; CoinDisjointCopyN(rhs.indRows_, numRows_, indRows_); sense_ = CoinCopyOfArray(rhs.sense_,numRows_); RHS_ = CoinCopyOfArray(rhs.RHS_,numRows_); } else { rowTypes_ = 0; indRows_ = 0; sense_=NULL; RHS_=NULL; } if (numRowMix_ > 0) { indRowMix_ = new int [numRowMix_]; CoinDisjointCopyN(rhs.indRowMix_, numRowMix_, indRowMix_); } else { indRowMix_ = 0; } if (numRowCont_ > 0) { indRowCont_ = new int [numRowCont_]; CoinDisjointCopyN(rhs.indRowCont_, numRowCont_, indRowCont_); indRowContVB_ = new int [numRowCont_]; CoinDisjointCopyN(rhs.indRowContVB_, numRowCont_, indRowContVB_); } else { indRowCont_ = 0; indRowContVB_ = 0; } if (numRowInt_ > 0) { indRowInt_ = new int [numRowInt_]; CoinDisjointCopyN(rhs.indRowInt_, numRowInt_, indRowInt_); } else { indRowInt_ = 0; } } //------------------------------------------------------------------- // Do preprocessing // It determines the type of each row. It also identifies the variable // upper bounds and variable lower bounds. //------------------------------------------------------------------- void CglMixedIntegerRounding2:: mixIntRoundPreprocess(const OsiSolverInterface& si) { // get matrix stored by row const CoinPackedMatrix & matrixByRow = *si.getMatrixByRow(); numRows_ = si.getNumRows(); numCols_ = si.getNumCols(); const double* coefByRow = matrixByRow.getElements(); const int* colInds = matrixByRow.getIndices(); const int* rowStarts = matrixByRow.getVectorStarts(); const int* rowLengths = matrixByRow.getVectorLengths(); // Get copies of sense and RHS so we can modify if ranges if (sense_) { delete [] sense_; delete [] RHS_; } sense_ = CoinCopyOfArray(si.getRowSense(),numRows_); RHS_ = CoinCopyOfArray(si.getRightHandSide(),numRows_); // Save integer type for speed if (integerType_) delete [] integerType_; integerType_ = new char [numCols_]; int iColumn; for (iColumn=0;iColumn 0) indRows_ = new int [numRows_]; // Destructor will free memory // allocate memory for vector of indices of rows of type ROW_MIX numRowMix_ = numMIX; if (indRowMix_ != 0) { delete [] indRowMix_; indRowMix_ = 0; } if (numRowMix_ > 0) indRowMix_ = new int [numRowMix_]; // Destructor will free memory // allocate memory for vector of indices of rows of type ROW_CONT numRowCont_ = numCONT; if (indRowCont_ != 0) { delete [] indRowCont_; indRowCont_ = 0; } if (numRowCont_ > 0) indRowCont_ = new int [numRowCont_]; // Destructor will free memory // allocate memory for vector of indices of rows of type ROW_INT numRowInt_ = numINT; if (indRowInt_ != 0) { delete [] indRowInt_; indRowInt_ = 0; } if (numRowInt_ > 0) indRowInt_ = new int [numRowInt_]; // Destructor will free memory #if CGL_DEBUG std::cout << "The num of rows = " << numRows_ << std::endl; std::cout << "Summary of Row Type" << std::endl; std::cout << "numUNDEFINED = " << numUNDEFINED << std::endl; std::cout << "numVARUB = " << numVARUB << std::endl; std::cout << "numVARLB = " << numVARLB << std::endl; std::cout << "numVAREQ = " << numVAREQ << std::endl; std::cout << "numMIX = " << numMIX << std::endl; std::cout << "numCONT = " << numCONT << std::endl; std::cout << "numINT = " << numINT << std::endl; std::cout << "numOTHER = " << numOTHER << std::endl; #endif //--------------------------------------------------------------------------- // Setup vubs_ and vlbs_ if (vubs_ != 0) { delete [] vubs_; vubs_ = 0; } vubs_ = new CglMixIntRoundVUB2 [numCols_]; // Destructor will free if (vlbs_ != 0) { delete [] vlbs_; vlbs_ = 0; } vlbs_ = new CglMixIntRoundVLB2 [numCols_]; // Destructor will free // Initialization. Altough this has been done in constructor, it is needed // for the case where the mixIntRoundPreprocess is called more than once for (int iCol = 0; iCol < numCols_; ++iCol) { vubs_[iCol].setVar(UNDEFINED_); vlbs_[iCol].setVar(UNDEFINED_); } int countM = 0; int countC = 0; int countI = 0; for ( iRow = 0; iRow < numRows_; ++iRow) { RowType rowType = rowTypes_[iRow]; // fill the vector indRows_ with the indices of all rows indRows_[iRow] = iRow; // fill the vector indRowMix_ with the indices of the rows of type ROW_MIX if (rowType == ROW_MIX) { indRowMix_[countM] = iRow; countM++; } // fill the vector indRowCont_ with the indices of rows of type ROW_CONT else if (rowType == ROW_CONT) { indRowCont_[countC] = iRow; countC++; } // fill the vector indRowInt_ with the indices of the rows of type ROW_INT else if (rowType == ROW_INT) { indRowInt_[countI] = iRow; countI++; } // create vectors with variable lower and upper bounds else if ( (rowType == ROW_VARUB) || (rowType == ROW_VARLB) || (rowType == ROW_VAREQ) ) { int startPos = rowStarts[iRow]; int stopPos = startPos + rowLengths[iRow]; int xInd = 0, yInd = 0; // x is continuous, y is integer double xCoef = 0.0, yCoef = 0.0; for (int i = startPos; i < stopPos; ++i) { if ( fabs(coefByRow[i]) > EPSILON_ ) { if( integerType_[colInds[i]] ) { yInd = colInds[i]; yCoef = coefByRow[i]; } else { xInd = colInds[i]; xCoef = coefByRow[i]; } } } switch (rowType) { case ROW_VARUB: // Inequality: x <= ? * y vubs_[xInd].setVar(yInd); vubs_[xInd].setVal(-yCoef / xCoef); break; case ROW_VARLB: // Inequality: x >= ? * y vlbs_[xInd].setVar(yInd); vlbs_[xInd].setVal(-yCoef / xCoef); break; case ROW_VAREQ: // Inequality: x >= AND <= ? * y vubs_[xInd].setVar(yInd); vubs_[xInd].setVal(-yCoef / xCoef); vlbs_[xInd].setVar(yInd); vlbs_[xInd].setVal(-yCoef / xCoef); break; default: // I am getting compiler bug which gets here - I am disabling - JJF //throw CoinError("Unknown row type: impossible", // "MixIntRoundPreprocess", // "CglMixedIntegerRounding2"); break; } } } // allocate memory for vector of indices of rows of type ROW_CONT // that have at least one variable with variable upper or lower bound if (indRowContVB_ != 0) { delete [] indRowContVB_; indRowContVB_ = 0; } if (numRowCont_ > 0) indRowContVB_ = new int [numRowCont_]; // Destructor will free memory // create vector with rows of type ROW_CONT that have at least // one variable with variable upper or lower bound countC = 0; for (int i = 0; i < numRowCont_; ++i) { int indRow = indRowCont_[i]; int jStart = rowStarts[indRow]; int jStop = jStart + rowLengths[indRow]; for (int j = jStart; j < jStop; ++j) { int indCol = colInds[j]; CglMixIntRoundVLB2 VLB = vlbs_[indCol]; CglMixIntRoundVUB2 VUB = vubs_[indCol]; if (( VLB.getVar() != UNDEFINED_ ) || ( VUB.getVar() != UNDEFINED_ ) ){ indRowContVB_[countC] = indRow; countC++; break; } } } numRowContVB_ = countC; } //------------------------------------------------------------------- // Determine the type of a given row //------------------------------------------------------------------- CglMixedIntegerRounding2::RowType CglMixedIntegerRounding2::determineRowType(//const OsiSolverInterface& si, const int rowLen, const int* ind, const double* coef, const char sense, const double rhs) const { if (rowLen == 0 || fabs(rhs) > 1.0e20) return ROW_UNDEFINED; RowType rowType = ROW_UNDEFINED; int numPosInt = 0; // num of positive integer variables int numNegInt = 0; // num of negative integer variables int numInt = 0; // num of integer variables int numPosCon = 0; // num of positive continuous variables int numNegCon = 0; // num of negative continuous variables int numCon = 0; // num of continuous variables // Summarize the variable types of the given row. for ( int i = 0; i < rowLen; ++i ) { if ( coef[i] < -EPSILON_ ) { if( integerType_[ind[i]] ) ++numNegInt; else ++numNegCon; } else if ( coef[i] > EPSILON_ ) { if( integerType_[ind[i]] ) ++numPosInt; else ++numPosCon; } } numInt = numNegInt + numPosInt; numCon = numNegCon + numPosCon; #if CGL_DEBUG std::cout << "numNegInt = " << numNegInt << std::endl; std::cout << "numPosInt = " << numPosInt << std::endl; std::cout << "numInt = " << numInt << std::endl; std::cout << "numNegCon = " << numNegCon << std::endl; std::cout << "numPosCon = " << numPosCon << std::endl; std::cout << "numCon = " << numCon << std::endl; std::cout << "rowLen = " << rowLen << std::endl; #endif //------------------------------------------------------------------------- // Classify row type based on the types of variables. if ((numInt > 0) && (numCon > 0)) { if ((numInt == 1) && (numCon == 1) && (fabs(rhs) <= EPSILON_)) { // It's a variable bound constraint switch (sense) { case 'L': rowType = numPosCon == 1 ? ROW_VARUB : ROW_VARLB; break; case 'G': rowType = numPosCon == 1 ? ROW_VARLB : ROW_VARUB; break; case 'E': rowType = ROW_VAREQ; break; default: break; } } else { // It's a constraint with continuous and integer variables; // The total number of variables is at least 2 rowType = ROW_MIX; } } else if (numInt == 0) { // It's a constraint with only continuous variables rowType = ROW_CONT; } else if ((numCon == 0) && ((sense == 'L') || (sense == 'G'))) { // It's a <= or >= constraint with only integer variables rowType = ROW_INT; } else // It's a constraint that does not fit the above categories rowType = ROW_OTHER; return rowType; } //------------------------------------------------------------------- // Generate MIR cuts //------------------------------------------------------------------- void CglMixedIntegerRounding2::generateMirCuts( const OsiSolverInterface& si, const double* xlp, const double* colUpperBound, const double* colLowerBound, const CoinPackedMatrix& matrixByRow, const double* LHS, //const double* coefByRow, //const int* colInds, //const int* rowStarts, //const CoinPackedMatrix& matrixByCol, const double* coefByCol, const int* rowInds, const int* colStarts, OsiCuts& cs ) const { #if CGL_DEBUG // OPEN FILE std::ofstream fout("stats.dat"); #endif // Define upper limit for the loop where the cMIRs are constructed int upperLimit; if (MULTIPLY_) upperLimit = 2; else upperLimit = 1; // create a vector with the columns that were used in the aggregation int* listColsSelected = new int[MAXAGGR_]; // create a vector with the rows that were aggregated int* listRowsAggregated = new int[MAXAGGR_]; // create a vector with the LP solutions of the slack variables double* xlpExtra = new double[MAXAGGR_]; // loop until maximum number of aggregated rows is reached or a // violated cut is found int numRowMixAndRowContVB = numRowMix_ + numRowContVB_; int numRowMixAndRowContVBAndRowInt = numRowMixAndRowContVB + numRowInt_; // Get large enough vector CoinIndexedVector rowAggregated(si.getNumCols()); CoinIndexedVector rowToAggregate(si.getNumCols()); CoinIndexedVector mixedKnapsack(si.getNumCols()); CoinIndexedVector contVariablesInS(si.getNumCols()); CoinIndexedVector rowToUse(si.getNumCols()); // And work vectors CoinIndexedVector workVectors[4]; for (int i=0; i<4; i++) workVectors[i].reserve(si.getNumCols()); CoinIndexedVector setRowsAggregated(si.getNumRows()); for (int iRow = 0; iRow < numRowMixAndRowContVBAndRowInt; ++iRow) { int rowSelected; // row selected to be aggregated next int colSelected; // column selected for pivot in aggregation rowAggregated.clear(); double rhsAggregated; // create a set with the indices of rows selected setRowsAggregated.clear(); // loop until the maximum number of aggregated rows is reached for (int iAggregate = 0; iAggregate < MAXAGGR_; ++iAggregate) { if (iAggregate == 0) { // select row if (iRow < numRowMix_) { rowSelected = indRowMix_[iRow]; } else if (iRow < numRowMixAndRowContVB) { rowSelected = indRowContVB_[iRow - numRowMix_]; } else { rowSelected = indRowInt_[iRow - numRowMixAndRowContVB]; } copyRowSelected(iAggregate, rowSelected, setRowsAggregated, listRowsAggregated, xlpExtra, sense_[rowSelected], RHS_[rowSelected], LHS[rowSelected], matrixByRow, rowAggregated, rhsAggregated); } else { // search for a row to aggregate bool foundRowToAggregate = selectRowToAggregate( /*si,*/ rowAggregated, colUpperBound, colLowerBound, setRowsAggregated, xlp, coefByCol, rowInds, colStarts, rowSelected, colSelected); // if finds row to aggregate, compute aggregated row if (foundRowToAggregate) { rowToAggregate.clear(); double rhsToAggregate; listColsSelected[iAggregate] = colSelected; copyRowSelected(iAggregate, rowSelected, setRowsAggregated, listRowsAggregated, xlpExtra, sense_[rowSelected], RHS_[rowSelected], LHS[rowSelected], matrixByRow, rowToAggregate, rhsToAggregate); // call aggregate row heuristic aggregateRow(colSelected, rowToAggregate, rhsToAggregate, rowAggregated, rhsAggregated); } else break; } // construct cMIR with current rowAggregated // and, if upperLimit=2 construct also a cMIR with // the current rowAggregated multiplied by -1 for (int i = 0; i < upperLimit; ++i) { // create vector for mixed knapsack constraint double rhsMixedKnapsack; rowToUse.copy(rowAggregated); if (i==0) { rhsMixedKnapsack = rhsAggregated; } else { rowToUse *= -1.0; rhsMixedKnapsack = - rhsAggregated; } mixedKnapsack.clear(); double sStar = 0.0; // create vector for the continuous variables in s contVariablesInS.clear(); // call bound substitution heuristic bool foundMixedKnapsack = boundSubstitution( si, rowToUse, xlp, xlpExtra, colUpperBound, colLowerBound, mixedKnapsack, rhsMixedKnapsack, sStar, contVariablesInS); // if it did not find a mixed knapsack it is because there is at // least one integer variable with lower bound different than zero // or there are no integer or continuous variables. // In this case, we continue without trying to generate a c-MIR if (!foundMixedKnapsack) { #if CGL_DEBUG std::cout << "couldn't create mixed knapsack" << std::endl; #endif continue; } OsiRowCut cMirCut; // Find a c-MIR cut with the current mixed knapsack constraint bool hasCut = cMirSeparation(si, matrixByRow, rowToUse, listRowsAggregated, sense_, RHS_, //coefByRow, colInds, rowStarts, xlp, sStar, colUpperBound, colLowerBound, mixedKnapsack, rhsMixedKnapsack, contVariablesInS, workVectors,cMirCut); #if CGL_DEBUG // PRINT STATISTICS printStats(fout, hasCut, si, rowAggregated, rhsAggregated, xlp, xlpExtra, listRowsAggregated, listColsSelected, iAggregate+1, colUpperBound, colLowerBound ); #endif // if a cut was found, insert it into cs if (hasCut) { // look at cut to see if unstable const CoinPackedVector & row = cMirCut.row(); int n=row.getNumElements(); const double * elements = row.getElements(); double largest = 0.0; double smallest = COIN_DBL_MAX; for (int i=0;i1.0e8*smallest||largest>1.0e7||smallest<1.0e-5) { #if CGL_DEBUG2 printf("Unstable Mixed cut %g <= ",cMirCut.lb()); const int * columns = row.getIndices(); for (int i=0;i= numCols_) continue; double coefCol = rowAggregatedElements[indCol]; // Consider only continuous variables if ( (integerType_[indCol]) || (fabs(coefCol) < EPSILON_)) continue; // Compute current lower bound CglMixIntRoundVLB2 VLB = vlbs_[indCol]; double LB = ( VLB.getVar() != UNDEFINED_ ) ? VLB.getVal() * xlp[VLB.getVar()] : colLowerBound[indCol]; // Compute current upper bound CglMixIntRoundVUB2 VUB = vubs_[indCol]; double UB = ( VUB.getVar() != UNDEFINED_ ) ? VUB.getVal() * xlp[VUB.getVar()] : colUpperBound[indCol]; // Compute distances from current solution to upper and lower bounds double delta = CoinMin(xlp[indCol] - LB, UB - xlp[indCol]); // In case this variable is acceptable look for possible rows if (delta > deltaMax) { int iStart = colStarts[indCol]; int iStop = colStarts[indCol+1]; // int count = 0; // std::vector rowPossible; // find a row to use in aggregation for (int i = iStart; i < iStop; ++i) { int rowInd = rowInds[i]; if (!setRowsAggregated.denseVector()[rowInd]) { // if the row was not already selected, select it RowType rType = rowTypes_[rowInd]; if ( ((rType == ROW_MIX) || (rType == ROW_CONT)) && (fabs(coefByCol[i]) > EPSILON_) ) { // rowPossible.push_back(rowInd); rowSelected = rowInd; deltaMax = delta; colSelected = indCol; foundRowToAggregate = true; //count++; break; } } } // if (count > 0) // rowSelected = rowPossible[rand() % count]; // std::cout << count << std::endl; } } return foundRowToAggregate; } //------------------------------------------------------------------- // Aggregate the selected row with the current aggregated row //------------------------------------------------------------------- void CglMixedIntegerRounding2::aggregateRow( const int colSelected, CoinIndexedVector& rowToAggregate, double rhs, CoinIndexedVector& rowAggregated, double& rhsAggregated ) const { // quantity to multiply by the coefficients of the row to aggregate double multiCoef = rowAggregated[colSelected] / rowToAggregate[colSelected]; rowToAggregate *= multiCoef; rhs *= multiCoef; rowAggregated = rowAggregated - rowToAggregate; rhsAggregated -= rhs; } //------------------------------------------------------------------- // Choose the bound substitution based on the criteria defined by the user //------------------------------------------------------------------- inline bool CglMixedIntegerRounding2::isLowerSubst(const double inf, const double aj, const double xlp, const double LB, const double UB) const { if (CRITERION_ == 1) { // criterion 1 (the same as criterion (a) in the paper) return xlp - LB < UB - xlp; } else { if (UB == inf || xlp == LB) return true; if (LB == -inf || xlp == UB) return false; if (CRITERION_ == 2) // criterion 2 (the same as criterion (b) in the paper) return aj < 0; else // criterion 3 (the same as criterion (c) in the paper) return aj > 0; } } //------------------------------------------------------------------- // Bound substitution heuristic //------------------------------------------------------------------- bool CglMixedIntegerRounding2::boundSubstitution( const OsiSolverInterface& si, const CoinIndexedVector& rowAggregated, const double* xlp, const double* xlpExtra, const double* colUpperBound, const double* colLowerBound, CoinIndexedVector& mixedKnapsack, double& rhsMixedKnapsack, double& sStar, CoinIndexedVector& contVariablesInS ) const { bool generated = false; const int numColsAggregated = rowAggregated.getNumElements(); const int *rowAggregatedIndices = rowAggregated.getIndices(); const double *rowAggregatedElements = rowAggregated.denseVector(); // go through all the variables and if it is continuous and delta is // negative, store variable in the vector contVariablesInS. // If it is integer, store variable in the vector mixedKnapsack int numCont = 0; double infinity = si.getInfinity(); int j; for ( j = 0; j < numColsAggregated; ++j) { // get index and coefficient of column j in the aggregated row const int indCol = rowAggregatedIndices[j]; const double coefCol = rowAggregatedElements[indCol]; // if the lower bound is equal to the upper bound, remove variable if ( (indCol < numCols_) && (colLowerBound[indCol] == colUpperBound[indCol]) ) { rhsMixedKnapsack -= coefCol * colLowerBound[indCol]; continue; } if (fabs(coefCol) < EPSILON_) { // relax as far as possible if (coefCol<0.0) rhsMixedKnapsack -= coefCol*colUpperBound[indCol]; else rhsMixedKnapsack -= coefCol*colLowerBound[indCol]; continue; } // set the coefficients of the integer variables if ( (indCol < numCols_) && (integerType_[indCol]) ) { // Copy the integer variable to the vector mixedKnapsack mixedKnapsack.add(indCol,coefCol); continue; } // Select the continuous variables and copy the ones in s to // the vector contVariablesInS if (indCol < numCols_) { // variable is model variable // Compute lower bound for variable indCol const CglMixIntRoundVLB2 VLB = vlbs_[indCol]; const double LB = ( VLB.getVar() != UNDEFINED_ ) ? VLB.getVal() * xlp[VLB.getVar()] : colLowerBound[indCol]; // Compute upper bound for variable indCol const CglMixIntRoundVUB2 VUB = vubs_[indCol]; const double UB = ( VUB.getVar() != UNDEFINED_ ) ? VUB.getVal() * xlp[VUB.getVar()] : colUpperBound[indCol]; // if both bounds are infinite, then we cannot form a mixed knapsack if ( (LB == -1.0 * infinity) && (UB == infinity) ) { #if CGL_DEBUG std::cout << "continuous var with infinite bounds. " << "Cannot form mixed Knapsack = " << std::endl; #endif return generated; } // Select the bound substitution if (isLowerSubst(infinity, rowAggregatedElements[indCol], xlp[indCol], LB, UB)) { if (VLB.getVar() != UNDEFINED_ ) { const int indVLB = VLB.getVar(); mixedKnapsack.add(indVLB, coefCol * VLB.getVal()); } else { rhsMixedKnapsack -= coefCol * LB; } // Update sStar if (coefCol < -EPSILON_) { contVariablesInS.insert(indCol, coefCol); sStar -= coefCol * (xlp[indCol] - LB); numCont++; } } else { if (VUB.getVar() != UNDEFINED_ ) { const int indVUB = VUB.getVar(); mixedKnapsack.add(indVUB, coefCol * VUB.getVal()); } else { rhsMixedKnapsack -= coefCol * UB; } // Update sStar if (coefCol > EPSILON_) { contVariablesInS.insert(indCol, - coefCol); sStar += coefCol * (UB - xlp[indCol]); numCont++; } } } else { // variable is slack variable // in this case the LB = 0 and the UB = infinity // Update sStar const double tLB = xlpExtra[indCol - numCols_]; if (coefCol < -EPSILON_) { contVariablesInS.insert(indCol, coefCol); sStar -= coefCol * tLB; numCont++; } } } // if there are no continuous variables to form s, then we stop #if CGL_DEBUG std::cout << "# of continuous var in mixedKnapsack = " << numCont << std::endl; #endif if (numCont == 0) return generated; // check that the integer variables have lower bound equal to zero const int numInt = mixedKnapsack.getNumElements(); // if there are not integer variables in mixedKnapsack, then we stop // CAUTION: all the coefficients could be zero #if CGL_DEBUG std::cout << "# of integer var in mixedKnapsack = " << numInt << std::endl; #endif if (numInt == 0) return generated; const int *knapsackIndices = mixedKnapsack.getIndices(); const double *knapsackElements = mixedKnapsack.denseVector(); for ( j = 0; j < numInt; ++j) { int indCol = knapsackIndices[j]; // if the coefficient is zero, disregard if (fabs(knapsackElements[indCol]) < EPSILON_) continue; // if the lower bound is not zero, then we stop if (fabs(colLowerBound[indCol]) > EPSILON_) return generated; } // if the lower bounds of all integer variables are zero, proceed generated = true; return generated; } //------------------------------------------------------------------- // c-MIR separation heuristic //------------------------------------------------------------------- bool CglMixedIntegerRounding2::cMirSeparation( const OsiSolverInterface& si, const CoinPackedMatrix& matrixByRow, const CoinIndexedVector& rowAggregated, const int* listRowsAggregated, const char* sense, const double* RHS, //const double* coefByRow, //const int* colInds, const int* rowStarts, const double* xlp, const double sStar, const double* colUpperBound, const double* colLowerBound, const CoinIndexedVector& mixedKnapsack, const double& rhsMixedKnapsack, const CoinIndexedVector& contVariablesInS, CoinIndexedVector * workVectors, OsiRowCut& cMirCut) const { bool generated = false; double numeratorBeta = rhsMixedKnapsack; CoinIndexedVector * cMIR = &workVectors[0]; cMIR->copy(mixedKnapsack); double rhscMIR; double maxViolation = 0.0; double bestDelta = 0.0; CoinIndexedVector * bestCut = &workVectors[1]; double rhsBestCut = 0.0; double sCoefBestCut = 0.0; const int numInt = mixedKnapsack.getNumElements(); const int *knapsackIndices = mixedKnapsack.getIndices(); const double *knapsackElements = mixedKnapsack.denseVector(); const int *contVarInSIndices = contVariablesInS.getIndices(); const double *contVarInSElements = contVariablesInS.denseVector(); // Construct set C, T will be the rest. // Also, for T we construct a CoinIndexedVector named complT which // contains the vars in T that are strictly between their bounds CoinIndexedVector & setC = workVectors[3]; setC.clear(); CoinIndexedVector * complT = &workVectors[2]; complT->clear(); double infinity = si.getInfinity(); int j; for ( j = 0; j < numInt; ++j) { const int indCol = knapsackIndices[j]; // if the upper bound is infinity, then indCol is in T and cannot // be in complT if (colUpperBound[indCol] != infinity) { if (xlp[indCol] >= colUpperBound[indCol] / 2.0) { setC.insert(j,1.0); numeratorBeta -= knapsackElements[indCol] * colUpperBound[indCol]; } else { if ( (xlp[indCol] <= EPSILON_) || (xlp[indCol] >= colUpperBound[indCol] - EPSILON_)) continue; complT->insert(j, fabs(xlp[indCol] - colUpperBound[indCol]/2)); } } } // Sort the indices in complT by nondecreasing values // (which are $|y^*_j-u_j/2|$) if (complT->getNumElements() > 0) { complT->sortIncrElement(); } // Construct c-MIR inequalities and take the one with the largest violation for ( j = 0; j < numInt; ++j) { int indCol = knapsackIndices[j]; if ( (xlp[indCol] <= EPSILON_) || (xlp[indCol] >= colUpperBound[indCol] - EPSILON_)) continue; double delta = knapsackElements[indCol]; // delta has to be positive if (delta <= EPSILON_) continue; double violation = 0.0; double sCoef = 0.0; // form a cMIR inequality cMirInequality(numInt, delta, numeratorBeta, knapsackIndices, knapsackElements, xlp, sStar, colUpperBound, setC, *cMIR, rhscMIR, sCoef, violation); // store cut if it is the best found so far if (violation > maxViolation + EPSILON_) { bestCut->copy(*cMIR); rhsBestCut = rhscMIR; sCoefBestCut = sCoef; maxViolation = violation; bestDelta = delta; } } // if no violated inequality has been found, exit now if (maxViolation == 0.0) { bestCut->clear(); return generated; } // improve the best violated inequality. // try to divide delta by 2, 4 or 8 and see if increases the violation double deltaBase = bestDelta; for (int multFactor = 2; multFactor <= 8; multFactor *= 2) { double delta = deltaBase / multFactor; double violation = 0.0; double sCoef = 0.0; // form a cMIR inequality cMirInequality(numInt, delta, numeratorBeta, knapsackIndices, knapsackElements, xlp, sStar, colUpperBound, setC, *cMIR, rhscMIR, sCoef, violation); // store cut if it is the best found so far if (violation > maxViolation + EPSILON_) { bestCut->copy(cMIR); rhsBestCut = rhscMIR; sCoefBestCut = sCoef; maxViolation = violation; bestDelta = delta; } } // improve cMIR for the best delta // complT contains indices into mixedKnapsack for the variables // which may be complemented and they are already appropriately // sorted. const int complTSize = complT->getNumElements(); if (complTSize > 0) { const int *complTIndices = complT->getIndices(); for (int j = 0; j < complTSize; ++j) { // move variable in set complT from set T to set C int jIndex = complTIndices[j]; int indCol = knapsackIndices[jIndex]; // do nothing if upper bound is infinity if (colUpperBound[indCol] >= infinity) continue; setC.insert(jIndex,1.0); double violation = 0.0; double sCoef = 0.0; double localNumeratorBeta = numeratorBeta - mixedKnapsack[indCol] * colUpperBound[indCol]; // form a cMIR inequality cMirInequality(numInt, bestDelta, localNumeratorBeta, knapsackIndices, knapsackElements, xlp, sStar, colUpperBound, setC, *cMIR, rhscMIR, sCoef, violation); // store cut if it is the best found so far; otherwise, move the variable // that was added to set C back to set T if (violation > maxViolation + EPSILON_) { bestCut->copy(cMIR); rhsBestCut = rhscMIR; sCoefBestCut = sCoef; maxViolation = violation; numeratorBeta = localNumeratorBeta; } else setC.quickAdd(jIndex,-1.0); } } // write the best cut found with the model variables int numCont = contVariablesInS.getNumElements(); for ( j = 0; j < numCont; ++j) { int indCol = contVarInSIndices[j]; double coefCol = contVarInSElements[indCol]; if (indCol < numCols_) { // variable is model variable // Compute lower bound for variable indCol CglMixIntRoundVLB2 VLB = vlbs_[indCol]; double LB = ( VLB.getVar() != UNDEFINED_ ) ? VLB.getVal() * xlp[VLB.getVar()] : colLowerBound[indCol]; // Compute upper bound for variable indCol CglMixIntRoundVUB2 VUB = vubs_[indCol]; double UB = ( VUB.getVar() != UNDEFINED_ ) ? VUB.getVal() * xlp[VUB.getVar()] : colUpperBound[indCol]; // Select the bound substitution if (isLowerSubst(infinity, rowAggregated[indCol], xlp[indCol], LB, UB)) { if (VLB.getVar() != UNDEFINED_ ) { int indVLB = VLB.getVar(); bestCut->add(indVLB, - sCoefBestCut * coefCol * VLB.getVal()); bestCut->insert(indCol, sCoefBestCut * coefCol); } else { rhsBestCut += sCoefBestCut * coefCol * colLowerBound[indCol]; bestCut->insert(indCol, sCoefBestCut * coefCol); } } else { if (VUB.getVar() != UNDEFINED_ ) { int indVUB = VUB.getVar(); bestCut->add(indVUB, sCoefBestCut * coefCol * VUB.getVal()); bestCut->insert(indCol, - sCoefBestCut * coefCol); } else { rhsBestCut -= sCoefBestCut * coefCol * colUpperBound[indCol]; bestCut->insert(indCol, - sCoefBestCut * coefCol); } } } else { // variable is slack variable // in this case the LB = 0 and the UB = infinity // copy the row selected to a vector of type CoinIndexedVector const int iRow = listRowsAggregated[indCol - numCols_]; double multiplier; if (sense[iRow] == 'L') { // if it is a <= inequality, the coefficient of the slack is 1 multiplier = (- sCoefBestCut * coefCol); } else { // if it is a <= inequality, the coefficient of the slack is -1 multiplier = (sCoefBestCut * coefCol); } rhsBestCut += RHS[iRow]*multiplier; CoinShallowPackedVector row = matrixByRow.getVector(iRow); int nElements = row.getNumElements(); const int * column = row.getIndices(); const double * element = row.getElements(); for (int i=0;iadd(column[i],element[i]*multiplier); } } // Check the violation of the cut after it is written with the original // variables. int cutLen = bestCut->getNumElements(); int* cutInd = bestCut->getIndices(); double* cutCoef = bestCut->denseVector(); double cutRHS = rhsBestCut; double violation = 0.0; double normCut = 0.0; #if CGL_DEBUG2 double smallest=COIN_DBL_MAX; #endif double largest=0.0; // Also weaken by small coefficients for ( j = 0; j < cutLen; ++j) { int column = cutInd[j]; double value = cutCoef[column]; #if CGL_DEBUG2 smallest=CoinMin(smallest,fabs(value)); normCut += value * value; #endif largest=CoinMax(largest,fabs(value)); } double testValue=CoinMax(1.0e-6*largest,1.0e-12); #if CGL_DEBUG2 normCut=sqrt(normCut); printf("smallest %g largest %g norm %g - %d elements - rhs %g - %d\n", smallest,largest,normCut,cutLen,cutRHS,xxxxxx); xxxxxx++; if (xxxxxx==yyyyyy) printf("trouble\n"); normCut=0.0; #endif int n=0; for ( j = 0; j < cutLen; ++j) { int column = cutInd[j]; double value = cutCoef[column]; if (fabs(value)>testValue) { violation += value * xlp[column]; normCut += value * value; cutInd[n++]=column; #if CGL_DEBUG2 printf("taking %d %g\n",column,value); #endif } else if (value) { cutCoef[column]=0.0; // Weaken if (value>0.0) { #if CGL_DEBUG2 printf("not taking %d %g - lb %g - rhs -> %g\n",column,value, colLowerBound[column], cutRHS - value*colLowerBound[column]); #endif // Allow for at lower bound double modification = value*colLowerBound[column]; if (colLowerBound[column]>0.0) { #if CGL_DEBUG2 printf("weakening modification from %g to zero\n", modification); #endif modification=0.0; } cutRHS -= modification; } else { #if CGL_DEBUG2 printf("not taking %d %g - ub %g - rhs -> %g\n",column,value, colUpperBound[column], cutRHS - value*colUpperBound[column]); #endif // Allow for at upper bound double modification = value*colUpperBound[column]; if (colUpperBound[column]<0.0) { #if CGL_DEBUG2 printf("weakening modification from %g to zero\n", modification); #endif modification=0.0; } cutRHS -= modification; } } } cutLen=n; violation -= cutRHS; violation /= sqrt(normCut); if ( violation > TOLERANCE_ ) { // cutCoef is still unpacked std::sort(cutInd,cutInd+cutLen); int i; for ( i=0;i=0); assert(cutCoef[k]); assert (fabs(cutCoef[k])>1.0e-12); } } #endif // Zero bestCut by hand bestCut->setNumElements(0); for ( i=0;iclear(); } return generated; } //------------------------------------------------------------------- // construct a c-MIR inequality //------------------------------------------------------------------- void CglMixedIntegerRounding2::cMirInequality( const int numInt, const double delta, const double numeratorBeta, const int *knapsackIndices, const double* knapsackElements, const double* xlp, const double sStar, const double* colUpperBound, const CoinIndexedVector& setC, CoinIndexedVector& cMIR, double& rhscMIR, double& sCoef, double& violation) const { // form a cMIR inequality double beta = numeratorBeta / delta; double f = beta - floor(beta); rhscMIR = floor(beta); double normCut = 0.0; // coefficients of variables in set T for (int i = 0; i < numInt; ++i) { const int iIndex = knapsackIndices[i]; double G = 0.0; if (setC.denseVector()[i] != 1.0) { // i is not in setC, i.e., it is in T G = functionG(knapsackElements[iIndex] / delta, f); violation += (G * xlp[iIndex]); normCut += G * G; cMIR.setElement(i, G); } else { G = functionG( - knapsackElements[iIndex] / delta, f); violation -= (G * xlp[iIndex]); normCut += G * G; rhscMIR -= G * colUpperBound[iIndex]; cMIR.setElement(i, -G); } } sCoef = 1.0 / (delta * (1.0 - f)); violation -= (rhscMIR + sCoef * sStar); normCut += sCoef * sCoef; violation /= sqrt(normCut); } //------------------------------------------------------------------- // function G for computing coefficients in cMIR inequality //------------------------------------------------------------------- inline double CglMixedIntegerRounding2::functionG( const double d, const double f ) const { double delta = d - floor(d) - f; if (delta > EPSILON_) return floor(d) + delta / (1 - f); else return floor(d); } //------------------------------------------------------------------- // Printing statistics //------------------------------------------------------------------- void CglMixedIntegerRounding2::printStats( std::ofstream & fout, const bool hasCut, const OsiSolverInterface& si, const CoinIndexedVector& rowAggregated, const double& rhsAggregated, const double* xlp, const double* xlpExtra, const int* listRowsAggregated, const int* listColsSelected, const int level, const double* colUpperBound, const double* colLowerBound ) const { const int numColsAggregated = rowAggregated.getNumElements(); const int *rowAggregatedIndices = rowAggregated.getIndices(); const double *rowAggregatedElements = rowAggregated.denseVector(); fout << "Rows "; for (int i = 0; i < level; ++i) { fout << listRowsAggregated[i] << " "; } fout << std::endl; int numColsBack = 0; // go through all the variables for (int j = 0; j < numColsAggregated; ++j) { // get index and coefficient of column j in the aggregated row int indCol = rowAggregatedIndices[j]; double coefCol = rowAggregatedElements[indCol]; // check if a column used in aggregation is back into the aggregated row for (int i = 0; i < level-1; ++i) { if ( (listColsSelected[i] == indCol) && (coefCol != 0) ) { numColsBack++; break; } } if (fabs(coefCol) < EPSILON_) { // print variable number and coefficient fout << indCol << " " << 0.0 << std::endl; continue; } else { // print variable number and coefficient fout << indCol << " " << coefCol << " "; } // integer variables if ( (indCol < numCols_) && (integerType_[indCol]) ) { // print fout << "I " << xlp[indCol] << " " << colLowerBound[indCol] << " " << colUpperBound[indCol] << std::endl; continue; } // continuous variables if (indCol < numCols_) { // variable is model variable // print fout << "C " << xlp[indCol] << " " << colLowerBound[indCol] << " " << colUpperBound[indCol] << " "; // variable lower bound? CglMixIntRoundVLB2 VLB = vlbs_[indCol]; if (VLB.getVar() != UNDEFINED_) { fout << VLB.getVal() << " " << xlp[VLB.getVar()] << " " << colLowerBound[VLB.getVar()] << " " << colUpperBound[VLB.getVar()] << " "; } else { fout << "-1 -1 -1 -1 "; } // variable upper bound? CglMixIntRoundVUB2 VUB = vubs_[indCol]; if (VUB.getVar() != UNDEFINED_) { fout << VUB.getVal() << " " << xlp[VUB.getVar()] << " " << colLowerBound[VUB.getVar()] << " " << colUpperBound[VUB.getVar()] << " "; } else { fout << "-1 -1 -1 -1 "; } } else { // variable is slack variable // in this case the LB = 0 and the UB = infinity // print fout << "C " << xlpExtra[indCol-numCols_] << " " << 0.0 << " " << si.getInfinity() << " "; } fout << std::endl; } fout << "rhs " << rhsAggregated << std::endl; fout << "numColsBack " << numColsBack << std::endl; if (hasCut) { fout << "CUT: YES" << std::endl; } else { fout << "CUT: NO" << std::endl; } } // This can be used to refresh any inforamtion void CglMixedIntegerRounding2::refreshSolver(OsiSolverInterface * solver) { if (solver->getNumRows()) { mixIntRoundPreprocess(*solver); doneInitPre_ = true; } else { doneInitPre_ = false; } } // Create C++ lines to get to current state std::string CglMixedIntegerRounding2::generateCpp( FILE * fp) { CglMixedIntegerRounding2 other; fprintf(fp,"0#include \"CglMixedIntegerRounding2.hpp\"\n"); fprintf(fp,"3 CglMixedIntegerRounding2 mixedIntegerRounding2;\n"); if (MAXAGGR_!=other.MAXAGGR_) fprintf(fp,"3 mixedIntegerRounding2.setMAXAGGR_(%d);\n",MAXAGGR_); else fprintf(fp,"4 mixedIntegerRounding2.setMAXAGGR_(%d);\n",MAXAGGR_); if (MULTIPLY_!=other.MULTIPLY_) fprintf(fp,"3 mixedIntegerRounding2.setMULTIPLY_(%d);\n",MULTIPLY_); else fprintf(fp,"4 mixedIntegerRounding2.setMULTIPLY_(%d);\n",MULTIPLY_); if (CRITERION_!=other.CRITERION_) fprintf(fp,"3 mixedIntegerRounding2.setCRITERION_(%d);\n",CRITERION_); if (doPreproc_!=other.doPreproc_) fprintf(fp,"3 mixedIntegerRounding2.setDoPreproc_(%d);\n", doPreproc_); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 mixedIntegerRounding2.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 mixedIntegerRounding2.setAggressiveness(%d);\n",getAggressiveness()); return "mixedIntegerRounding2"; } void CglMixedIntegerRounding2::setDoPreproc(int value) { if (value != -1 && value != 0 && value != 1) { throw CoinError("setDoPrepoc", "invalid value", "CglMixedIntegerRounding2"); } else { doPreproc_ = value; } } bool CglMixedIntegerRounding2::getDoPreproc() const { return (doPreproc_!=0); } CoinMP-1.8.3/Cgl/src/CglLiftAndProject/0000755000175000017500000000000012600453455016112 5ustar renereneCoinMP-1.8.3/Cgl/src/CglLiftAndProject/Makefile.in0000644000175000017500000005443112506321416020162 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglLiftAndProject DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglLiftAndProject_la_LIBADD = am_libCglLiftAndProject_la_OBJECTS = CglLiftAndProject.lo libCglLiftAndProject_la_OBJECTS = \ $(am_libCglLiftAndProject_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglLiftAndProject_la_SOURCES) DIST_SOURCES = $(libCglLiftAndProject_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglLiftAndProject # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglLiftAndProject.la # List all source files for this library, including headers libCglLiftAndProject_la_SOURCES = CglLiftAndProject.cpp CglLiftAndProject.hpp # This is for libtool (on Windows) libCglLiftAndProject_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglLiftAndProject.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglLiftAndProject/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglLiftAndProject/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglLiftAndProject.la: $(libCglLiftAndProject_la_OBJECTS) $(libCglLiftAndProject_la_DEPENDENCIES) $(CXXLINK) $(libCglLiftAndProject_la_LDFLAGS) $(libCglLiftAndProject_la_OBJECTS) $(libCglLiftAndProject_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglLiftAndProject.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglLiftAndProject/CglLiftAndProject.hpp0000644000175000017500000000505212130102162022103 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglLiftAndProject_H #define CglLiftAndProject_H #include #include "CglCutGenerator.hpp" /** Lift And Project Cut Generator Class */ class CglLiftAndProject : public CglCutGenerator { friend void CglLiftAndProjectUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /**@name Generate Cuts */ //@{ /** Generate lift-and-project cuts for the model of the solver interface, si. Insert the generated cuts into OsiCut, cs. */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /** Get the normalization : Either beta=+1 or beta=-1. */ double getBeta() const { return beta_; } /** Set the normalization : Either beta=+1 or beta=-1. Default value is 1. */ void setBeta(int oneOrMinusOne){ if (oneOrMinusOne==1 || oneOrMinusOne==-1){ beta_= static_cast(oneOrMinusOne); } else { throw CoinError("Unallowable value. Beta must be 1 or -1", "cutGeneration","CglLiftAndProject"); } } //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglLiftAndProject (); /// Copy constructor CglLiftAndProject ( const CglLiftAndProject &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglLiftAndProject & operator=( const CglLiftAndProject& rhs); /// Destructor virtual ~CglLiftAndProject (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} private: // Private member methods /**@name Private methods */ //@{ //@} // Private member data /**@name Private member data */ //@{ /// The normalization is beta_=1 or beta_=-1 double beta_; /// epsilon double epsilon_; /// 1-epsilon double onetol_; //@} }; //############################################################################# /** A function that tests the methods in the CglLiftAndProject class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglLiftAndProjectUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); #endif CoinMP-1.8.3/Cgl/src/CglLiftAndProject/Makefile.am0000644000175000017500000000323211621724114020141 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglLiftAndProject # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglLiftAndProject.la # List all source files for this library, including headers libCglLiftAndProject_la_SOURCES = CglLiftAndProject.cpp CglLiftAndProject.hpp # This is for libtool (on Windows) libCglLiftAndProject_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglLiftAndProject.hpp CoinMP-1.8.3/Cgl/src/CglLiftAndProject/CglLiftAndProject.cpp0000644000175000017500000003031012130103340022070 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CglLiftAndProject.hpp" #include "CoinPackedVector.hpp" #include "CoinSort.hpp" #include "CoinPackedMatrix.hpp" //----------------------------------------------------------------------------- // Generate Lift-and-Project cuts //------------------------------------------------------------------- void CglLiftAndProject::generateCuts(const OsiSolverInterface& si, OsiCuts& cs, const CglTreeInfo /*info*/) { // Assumes the mixed 0-1 problem // // min {cx: >= btilde} // // is in canonical form with all bounds, // including x_t>=0, -x_t>=-1 for x_t binary, // explicitly stated in the constraint matrix. // See ~/COIN/Examples/Cgl2/cgl2.cpp // for a general purpose "convert" function. // Reference [BCC]: Balas, Ceria, and Corneujols, // "A lift-and-project cutting plane algorithm // for mixed 0-1 program", Math Prog 58, (1993) // 295-324. // This implementation uses Normalization 1. // Given canonical problem and // the lp-relaxation solution, x, // the LAP cut generator attempts to construct // a cut for every x_j such that 0getElements(); const int * AtildeIndices = Atilde->getIndices(); const CoinBigIndex * AtildeStarts = Atilde->getVectorStarts(); const int * AtildeLengths = Atilde->getVectorLengths(); const int AtildeFullSize = AtildeStarts[m]; const double * btilde = si.getRowLower(); // Set up memory for system (10) [BCC:307] // (the problem over the norm intersected // with the polar cone) // // min <,u> + x_ju_0 // s.t. // = (0,...,0,beta_,beta)^T // w is nonneg for all but the // last two entries, which are free. // where // w = (u,v,v_0,u_0)in BCC notation // u and v are m-vectors; u,v >=0 // v_0 and u_0 are free-scalars, and // // B = Atilde^T -Atilde^T -e_j e_j // btilde^T e_0^T 0 0 // e_0^T btilde^T 1 0 // ^T indicates Transpose // e_0 is a (AtildeNCols x 1) vector of all zeros // e_j is e_0 with a 1 in the jth position // Storing B in column order. B is a (n+2 x 2m+2) matrix // But need to allow for possible gaps in Atilde. // At each iteration, only need to change 2 cols and objfunc // Sane design of OsiSolverInterface does not permit mucking // with matrix. // Because we must delete and add cols to alter matrix, // and we can only add columns on the end of the matrix // put the v_0 and u_0 columns on the end. // rather than as described in [BCC] // Initially allocating B with space for v_0 and u_O cols // but not populating, for efficiency. // B without u_0 and v_0 is a (n+2 x 2m) size matrix. int twoM = 2*m; int BNumRows = n+2; int BNumCols = twoM+2; int BFullSize = 2*AtildeFullSize+twoM+3; double * BElements = new double[BFullSize]; int * BIndices = new int[BFullSize]; CoinBigIndex * BStarts = new CoinBigIndex [BNumCols+1]; int * BLengths = new int[BNumCols]; int i, ij, k=0; int nPlus1=n+1; int offset = AtildeStarts[m]+m; for (i=0; i,u> // Note: at each iteration coefficient u_0 // changes to // w=(u,v,beta,v_0,u_0) size 2m+3 // So, BOjective[2m+2]=x[j] double * BObjective= new double[BNumCols]; double * Atildex = new double[m]; CoinFillN(BObjective,BNumCols,0.0); Atilde->times(x,Atildex); // Atildex is size m, x is size n CoinDisjointCopyN(Atildex,m,BObjective); // Number of cols and size of Elements vector // in B without the v_0 and u_0 cols int BFullSizeLessThree = BFullSize-3; // Load B matrix into a column orders CoinPackedMatrix CoinPackedMatrix * BMatrix = new CoinPackedMatrix(true, BNumRows, BNumColsLessTwo, BFullSizeLessThree, BElements,BIndices, BStarts,BLengths); // Assign problem into a solver interface // Note: coneSi will cleanup the memory itself OsiSolverInterface * coneSi = si.clone(false); coneSi->assignProblem (BMatrix, BColLowers, BColUppers, BObjective, BRowLowers, BRowUppers); // Problem sense should default to "min" by default, // but just to be virtuous... coneSi->setObjSense(1.0); // The plot outline from here on down: // coneSi has been assigned B without the u_0 and v_0 columns // Calculate base objective <,u> // bool haveWarmStart = false; // For (j=0; j=1) continue; // // IMPROVEME: if(haveWarmStart) check if j attractive // add {-e_j,0,-1} matrix column for v_0 // add {e_j,0,0} matrix column for u_0 // objective coefficient for u_0 is x_j // if (haveWarmStart) // set warmstart info // solve min{objw:Bw=0; w>=0,except v_0, u_0 free} // if (bounded) // get warmstart info // haveWarmStart=true; // ustar = optimal u solution // ustar_0 = optimal u_0 solution // alpha^T= -ustar_0e_j^T // (double check >= beta_ should be violated) // add >= beta_ to cutset // endif // delete column for u_0 // this deletes all column info. // delete column for v_0 // endFor // clean up memory // return 0; int * nVectorIndices = new int[n]; CoinIotaN(nVectorIndices, n, 0); bool haveWarmStart = false; bool equalObj1, equalObj2; CoinRelFltEq eq; double v_0Elements[2] = {-1,1}; double u_0Elements[1] = {1}; CoinWarmStart * warmStart = 0; double * ustar = new double[m]; CoinFillN(ustar, m, 0.0); double* alpha = new double[n]; CoinFillN(alpha, n, 0.0); for (j=0;jgetMatrixByRow(); #endif coneSi->addCol(v_0,-solverINFINITY,solverINFINITY,0); coneSi->addCol(u_0,-solverINFINITY,solverINFINITY,x[j]); if(haveWarmStart) { coneSi->setWarmStart(warmStart); coneSi->resolve(); } else { #if CGL_DEBUG const CoinPackedMatrix *see2 = coneSi->getMatrixByRow(); #endif coneSi->initialSolve(); } if(coneSi->isProvenOptimal()){ warmStart = coneSi->getWarmStart(); haveWarmStart=true; const double * wstar = coneSi->getColSolution(); CoinDisjointCopyN(wstar, m, ustar); Atilde->transposeTimes(ustar,alpha); alpha[j]+=wstar[BNumCols-1]; #if debug int p; double sum; for(p=0;p >= beta_ to cutset OsiRowCut rc; rc.setRow(n,nVectorIndices,alpha); rc.setLb(beta_); rc.setUb(solverINFINITY); cs.insert(rc); } // delete col for u_o and v_0 coneSi->deleteCols(2,delCols); // clean up memory } // clean up delete [] alpha; delete [] ustar; delete [] nVectorIndices; // BMatrix, BColLowers,BColUppers, BObjective, BRowLowers, BRowUppers // are all freed by OsiSolverInterface destructor (?) delete [] BLengths; delete [] BStarts; delete [] BIndices; delete [] BElements; } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglLiftAndProject::CglLiftAndProject () : CglCutGenerator(), beta_(1), epsilon_(1.0e-08), onetol_(1-epsilon_) { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglLiftAndProject::CglLiftAndProject (const CglLiftAndProject & source) : CglCutGenerator(source), beta_(source.beta_), epsilon_(source.epsilon_), onetol_(source.onetol_) { // Nothing to do here } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglLiftAndProject::clone() const { return new CglLiftAndProject(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglLiftAndProject::~CglLiftAndProject () { // Nothing to do here } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglLiftAndProject & CglLiftAndProject::operator=( const CglLiftAndProject& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); beta_=rhs.beta_; epsilon_=rhs.epsilon_; onetol_=rhs.onetol_; } return *this; } // Create C++ lines to get to current state std::string CglLiftAndProject::generateCpp( FILE * fp) { CglLiftAndProject other; fprintf(fp,"0#include \"CglLiftAndProject.hpp\"\n"); fprintf(fp,"3 CglLiftAndProject liftAndProject;\n"); if (beta_!=other.beta_) fprintf(fp,"3 liftAndProject.setBeta(%d);\n",static_cast (beta_)); else fprintf(fp,"4 liftAndProject.setBeta(%d);\n",static_cast (beta_)); fprintf(fp,"3 liftAndProject.setAggressiveness(%d);\n",getAggressiveness()); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 liftAndProject.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 liftAndProject.setAggressiveness(%d);\n",getAggressiveness()); return "liftAndProject"; } CoinMP-1.8.3/Cgl/src/CglClique/0000755000175000017500000000000012600453455014464 5ustar renereneCoinMP-1.8.3/Cgl/src/CglClique/Makefile.in0000644000175000017500000005452012506321416016533 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglClique DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglClique_la_LIBADD = am_libCglClique_la_OBJECTS = CglClique.lo CglCliqueHelper.lo \ CglCliqueTest.lo libCglClique_la_OBJECTS = $(am_libCglClique_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglClique_la_SOURCES) DIST_SOURCES = $(libCglClique_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglClique # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglClique.la # List all source files for this library, including headers libCglClique_la_SOURCES = \ CglClique.cpp CglClique.hpp \ CglCliqueHelper.cpp CglCliqueTest.cpp # This is for libtool (on Windows) libCglClique_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglClique.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglClique/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglClique/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglClique.la: $(libCglClique_la_OBJECTS) $(libCglClique_la_DEPENDENCIES) $(CXXLINK) $(libCglClique_la_LDFLAGS) $(libCglClique_la_OBJECTS) $(libCglClique_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglClique.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglCliqueHelper.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglCliqueTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglClique/Makefile.am0000644000175000017500000000322711621724114016517 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglClique # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglClique.la # List all source files for this library, including headers libCglClique_la_SOURCES = \ CglClique.cpp CglClique.hpp \ CglCliqueHelper.cpp CglCliqueTest.cpp # This is for libtool (on Windows) libCglClique_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglClique.hpp CoinMP-1.8.3/Cgl/src/CglClique/CglClique.hpp0000644000175000017500000002446712130102162017042 0ustar renerene// $Id: CglClique.hpp 1119 2013-04-06 20:24:18Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef _CglClique_h_ #define _CglClique_h_ #include "CglCutGenerator.hpp" //class OsiCuts; //class OsiSolverInterface; class CglClique : public CglCutGenerator { friend void CglCliqueUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /// Copy constructor CglClique(const CglClique& rhs); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglClique& operator=(const CglClique& rhs); public: virtual void generateCuts(const OsiSolverInterface& si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /**@name Constructors and destructors */ //@{ /** Default constructor. If the setPacking argument is set to true then CglClique will assume that the problem in the solverinterface passed to the generateCuts() method describes a set packing problem, i.e., - all variables are binary - the matrix is a 0-1 matrix - all constraints are '= 1' or '<= 1' Otherwise the user can use the considerRows() method to set the list of clique rows, that is, - all coeffs corresponding to binary variables at fractional level is 1 - all other coeffs are non-negative - the constraint is '= 1' or '<= 1'. If the user does not set the list of clique rows then CglClique will start the generateCuts() methods by scanning the matrix for them. Also justOriginalRows can be set to true to limit clique creation */ CglClique(bool setPacking = false, bool justOriginalRows = false); /// Destructor virtual ~CglClique() {} /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); void considerRows(const int numRows, const int* rowInd); public: /** possible choices for selecting the next node in the star clique search */ enum scl_next_node_method { SCL_MIN_DEGREE, SCL_MAX_DEGREE, SCL_MAX_XJ_MAX_DEG }; void setStarCliqueNextNodeMethod(scl_next_node_method method) { scl_next_node_rule = method; } void setStarCliqueCandidateLengthThreshold(int maxlen) { scl_candidate_length_threshold = maxlen; } void setRowCliqueCandidateLengthThreshold(int maxlen) { rcl_candidate_length_threshold = maxlen; } void setStarCliqueReport(bool yesno = true) { scl_report_result = yesno; } void setRowCliqueReport(bool yesno = true) { rcl_report_result = yesno; } void setDoStarClique(bool yesno = true) { do_star_clique = yesno; } void setDoRowClique(bool yesno = true) { do_row_clique = yesno; } void setMinViolation(double minviol) { petol = minviol; } double getMinViolation() const { return petol; } private: struct frac_graph ; friend struct frac_graph ; /** A node of the fractional graph. There is a node for every variable at fractional level. */ struct fnode { /** pointer into all_nbr */ int *nbrs; /** 1-x_i-x_j, needed for odd holes, in the same order as the adj list, pointer into all_edgecost */ double *edgecosts; /** degree of the node */ int degree; /** the fractional value of the variable corresponding to this node */ double val; }; /** A graph corresponding to a fractional solution of an LP. Two nodes are adjacent iff their columns are non-orthogonal. */ struct frac_graph { /** # of nodes = # of fractional values in the LP solution */ int nodenum; /** # of edges in the graph */ int edgenum; /** density= edgenum/(nodenum choose 2) */ double density; int min_deg_node; int min_degree; int max_deg_node; int max_degree; /** The array of the nodes in the graph */ fnode *nodes; /** The array of all the neighbors. First the indices of the nodes adjacent to node 0 are listed, then those adjacent to node 1, etc. */ int *all_nbr; /** The array of the costs of the edges going to the neighbors */ double *all_edgecost; frac_graph() : nodenum(0), edgenum(0), density(0), min_deg_node(0), min_degree(0), max_deg_node(0), max_degree(0), nodes(0), all_nbr(0), all_edgecost(0) {} }; protected: /** An indicator showing whether the whole matrix in the solverinterface is a set packing problem or not */ bool setPacking_; /// True if just look at original rows bool justOriginalRows_; /** pieces of the set packing part of the solverinterface */ int sp_numrows; int* sp_orig_row_ind; int sp_numcols; int* sp_orig_col_ind; double* sp_colsol; int* sp_col_start; int* sp_col_ind; int* sp_row_start; int* sp_row_ind; /** the intersection graph corresponding to the set packing problem */ frac_graph fgraph; /** the node-node incidence matrix of the intersection graph. */ bool* node_node; /** The primal tolerance in the solverinterface. */ double petol; /** data for the star clique algorithm */ /** Parameters */ /**@{*/ /** whether to do the row clique algorithm or not. */ bool do_row_clique; /** whether to do the star clique algorithm or not. */ bool do_star_clique; /** How the next node to be added to the star clique should be selected */ scl_next_node_method scl_next_node_rule; /** In the star clique method the maximal length of the candidate list (those nodes that are in a star, i.e., connected to the center of the star) to allow complete enumeration of maximal cliques. Otherwise a greedy algorithm is used. */ int scl_candidate_length_threshold; /** whether to give a detailed statistics on the star clique method */ bool scl_report_result; /** In the row clique method the maximal length of the candidate list (those nodes that can extend the row clique, i.e., connected to all nodes in the row clique) to allow complete enumeration of maximal cliques. Otherwise a greedy algorithm is used. */ int rcl_candidate_length_threshold; /** whether to give a detailed statistics on the row clique method */ bool rcl_report_result; /**@}*/ /** variables/arrays that are used across many methods */ /**@{*/ /** List of indices that must be in the to be created clique. This is just a pointer, it is never new'd and therefore does not need to be delete[]'d either. */ const int* cl_perm_indices; /** The length of cl_perm_indices */ int cl_perm_length; /** List of indices that should be considered for extending the ones listed in cl_perm_indices. */ int* cl_indices; /** The length of cl_indices */ int cl_length; /** An array of nodes discarded from the candidate list. These are rechecked when a maximal clique is found just to make sure that the clique is really maximal. */ int* cl_del_indices; /** The length of cl_del_indices */ int cl_del_length; /**@}*/ private: /** Scan through the variables and select those that are binary and are at a fractional level. */ void selectFractionalBinaries(const OsiSolverInterface& si); /** Scan through the variables and select those that are at a fractional level. We already know that everything is binary. */ void selectFractionals(const OsiSolverInterface& si); /** */ void selectRowCliques(const OsiSolverInterface& si,int numOriginalRows); /** */ void createSetPackingSubMatrix(const OsiSolverInterface& si); /** */ void createFractionalGraph(); /** */ int createNodeNode(); /** */ void deleteSetPackingSubMatrix(); /** */ void deleteFractionalGraph(); /** */ void find_scl(OsiCuts& cs); /** */ void find_rcl(OsiCuts& cs); /** */ int scl_choose_next_node(const int current_nodenum, const int *current_indices, const int *current_degrees, const double *current_values); /** */ void scl_delete_node(const int del_ind, int& current_nodenum, int *current_indices, int *current_degrees, double *current_values); /** */ int enumerate_maximal_cliques(int& pos, bool* scl_label, OsiCuts& cs); /** */ int greedy_maximal_clique(OsiCuts& cs); /** */ void recordClique(const int len, int* indices, OsiCuts& cs); }; //############################################################################# /** A function that tests the methods in the CglClique class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglCliqueUnitTest(const OsiSolverInterface * siP, const std::string mpdDir); /// This works on a fake solver i.e. invented rows class CglProbing; class CglFakeClique : public CglClique { public: /// Copy constructor CglFakeClique(const CglFakeClique& rhs); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglFakeClique& operator=(const CglFakeClique& rhs); virtual void generateCuts(const OsiSolverInterface& si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /**@name Constructors and destructors */ //@{ /** Default constructor. If the setPacking argument is set to true then CglFakeClique will assume that the problem in the solverinterface passed to the generateCuts() method describes a set packing problem, i.e., - all variables are binary - the matrix is a 0-1 matrix - all constraints are '= 1' or '<= 1' Otherwise the user can use the considerRows() method to set the list of clique rows, that is, - all coeffs corresponding to binary variables at fractional level is 1 - all other coeffs are non-negative - the constraint is '= 1' or '<= 1'. If the user does not set the list of clique rows then CglFakeClique will start the generateCuts() methods by scanning the matrix for them. */ CglFakeClique(OsiSolverInterface * solver=NULL,bool setPacking = false); /// Destructor virtual ~CglFakeClique(); /// Assign solver (generator takes over ownership) void assignSolver(OsiSolverInterface * fakeSolver); protected: /// fake solver to use OsiSolverInterface * fakeSolver_; /// Probing object CglProbing * probing_; }; #endif CoinMP-1.8.3/Cgl/src/CglClique/CglCliqueTest.cpp0000644000175000017500000000342512130104031017661 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglClique.hpp" void CglCliqueUnitTest(const OsiSolverInterface *baseSiP, const std::string mpsDir) { // Test default constructor { CglClique aGenerator; } // Test copy & assignment { CglClique rhs; { CglClique bGenerator; CglClique cGenerator(bGenerator); //rhs=bGenerator; } } // Test get/set methods { CglClique getset; // None to test } // Test generateCuts { CglClique gct; OsiSolverInterface *siP = baseSiP->clone(); std::string fn = mpsDir+"l152lav"; std::string fn2 = mpsDir+"l152lav.mps"; FILE *in_f = fopen(fn2.c_str(), "r"); if(in_f == NULL) { std::cout<<"Can not open file "<readMps(fn.c_str(),"mps"); siP->initialSolve(); double lpRelax = siP->getObjValue(); OsiCuts cs; gct.generateCuts(*siP, cs); int nRowCuts = cs.sizeRowCuts(); std::cout<<"There are "< 0); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cs); siP->resolve(); double lpRelaxAfter= siP->getObjValue(); std::cout<<"Initial LP value: "< #include #include "CoinHelperFunctions.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "CglClique.hpp" /*****************************************************************************/ CglClique::CglClique(bool setPacking, bool justOriginalRows) : CglCutGenerator(), setPacking_(setPacking), justOriginalRows_(justOriginalRows), sp_numrows(0), sp_orig_row_ind(0), sp_numcols(0), sp_orig_col_ind(0), sp_colsol(0), sp_col_start(0), sp_col_ind(0), sp_row_start(0), sp_row_ind(0), node_node(0), petol(-1.0), do_row_clique(true), do_star_clique(true), scl_next_node_rule(SCL_MAX_XJ_MAX_DEG), scl_candidate_length_threshold(12), scl_report_result(true), rcl_candidate_length_threshold(12), rcl_report_result(true), cl_perm_indices(0), cl_perm_length(0), cl_indices(0), cl_length(0), cl_del_indices(0), cl_del_length(0) {} // Copy constructor CglClique::CglClique(const CglClique& rhs) : CglCutGenerator(rhs), setPacking_(rhs.setPacking_), justOriginalRows_(rhs.justOriginalRows_), sp_numrows(rhs.sp_numrows), sp_orig_row_ind(rhs.sp_orig_row_ind), sp_numcols(rhs.sp_numcols), sp_orig_col_ind(rhs.sp_orig_col_ind), sp_colsol(rhs.sp_colsol), sp_col_start(rhs.sp_col_start), sp_col_ind(rhs.sp_col_ind), sp_row_start(rhs.sp_row_start), sp_row_ind(rhs.sp_row_ind), node_node(rhs.node_node), petol(rhs.petol), do_row_clique(rhs.do_row_clique), do_star_clique(rhs.do_star_clique), scl_next_node_rule(rhs.scl_next_node_rule), scl_candidate_length_threshold(rhs.scl_candidate_length_threshold), scl_report_result(rhs.scl_report_result), rcl_candidate_length_threshold(rhs.rcl_candidate_length_threshold), rcl_report_result(rhs.rcl_report_result), cl_perm_indices(rhs.cl_perm_indices), cl_perm_length(rhs.cl_perm_length), cl_indices(rhs.cl_indices), cl_length(rhs.cl_length), cl_del_indices(rhs.cl_del_indices), cl_del_length(rhs.cl_del_length) { } /*****************************************************************************/ /*****************************************************************************/ void CglClique::generateCuts(const OsiSolverInterface& si, OsiCuts & cs, const CglTreeInfo info) { int i; bool has_petol_set = petol != -1.0; if (! has_petol_set) si.getDblParam(OsiPrimalTolerance, petol); int numberOriginalRows = si.getNumRows(); if (info.inTree&&justOriginalRows_) numberOriginalRows = info.formulation_rows; int numberRowCutsBefore = cs.sizeRowCuts(); // First select which rows/columns we are interested in. if (!setPacking_) { selectFractionalBinaries(si); if (!sp_orig_row_ind) { selectRowCliques(si,numberOriginalRows); } } else { selectFractionals(si); delete[] sp_orig_row_ind; sp_numrows = numberOriginalRows; //sp_numcols = si.getNumCols(); sp_orig_row_ind = new int[sp_numrows]; for (i = 0; i < sp_numrows; ++i) sp_orig_row_ind[i] = i; } // Just original rows if (justOriginalRows_&&info.inTree) sp_numrows = CoinMin(info.formulation_rows,sp_numrows); createSetPackingSubMatrix(si); fgraph.edgenum = createNodeNode(); createFractionalGraph(); cl_indices = new int[sp_numcols]; cl_del_indices = new int[sp_numcols]; if (do_row_clique) find_rcl(cs); if (do_star_clique) find_scl(cs); if (!info.inTree&&((info.options&4)==4||((info.options&8)&&!info.pass))) { int numberRowCutsAfter = cs.sizeRowCuts(); for (int i=numberRowCutsBefore;isetGloballyValid(); } delete[] cl_indices; cl_indices = 0; delete[] cl_del_indices; cl_del_indices = 0; deleteFractionalGraph(); delete[] node_node; node_node = 0; deleteSetPackingSubMatrix(); if (! has_petol_set) petol = -1; } /*****************************************************************************/ /*===========================================================================* * Find violated row cliques. * * Algorithm: For each row of the matrix collect all variables not in the * row's support that are non-orthogonal to all variables in the row. These * variables form a candidate set in which we look for maximal cliques * (enumerate all or try to find one greedily, depending on the size of the * candidate set). When a violated maximal clique is found, it is recorded in * the cut set. *===========================================================================*/ void CglClique::find_rcl(OsiCuts& cs) { const int nodenum = fgraph.nodenum; const fnode *nodes = fgraph.nodes; /* A flag for each column that might be used to extend the current row clique */ bool *cand = new bool[nodenum]; /* In cl_indices we'll list the indices of the 'true' entries in cand */ /* The degree of each candidate (those listed in cl_indices) */ int *degrees = new int[nodenum]; /** An array used in the recursive complete enumeration of maximal cliques. The first cl_length entries are used. */ bool* label = new bool[nodenum]; int i, j, k; /* initialize global variables */ cl_del_length = 0; cl_length = 0; int clique_count = 0; int largest_length = 0; /* for each row of the matrix */ for (j = 0; j < sp_numrows; j++) { /* if the row is of zero length, take the next row */ const int len = sp_row_start[j+1] - sp_row_start[j]; if (!len) continue; /* the beginning of the row to be considered */ const int *row = sp_row_ind + sp_row_start[j]; /* copy the row of node_node corresponding to the first column in 'row' into cand, and take the AND of this vector with every row of node_node corresponding to the rest of the columns in 'row' to determine those columns that are non-orthog to every column in row */ std::copy(node_node + row[0]*nodenum, node_node + (row[0]+1)*nodenum, cand); for (i = 1; i < len; i++) { const bool* node_node_col = node_node + row[i] * nodenum; for (k = 0; k < nodenum; k++) cand[k] &= node_node_col[k]; } cl_length = 0; for (k = 0; k < nodenum; k++) if (cand[k]) cl_indices[cl_length++] = k; largest_length = CoinMax(cl_length, largest_length); /* if there is anything in indices, enumerate (or greedily find) maximal cliques */ if (cl_length > 0) { cl_perm_length = len; cl_perm_indices = row; if (cl_length <= rcl_candidate_length_threshold) { for (i = 0; i < cl_length; i++) label[i] = false; int pos = 0; clique_count += enumerate_maximal_cliques(pos, label, cs); } else { /* order cl_indices into decreasing order of their degrees */ for (i = 0; i < cl_length; i++) degrees[i] = nodes[cl_indices[i]].degree; CoinSort_2(degrees, degrees + cl_length, cl_indices, CoinFirstGreater_2()); clique_count += greedy_maximal_clique(cs); } } } if (rcl_report_result) { printf("\nrcl Found %i new violated cliques with the row-clique method", clique_count); printf("\nrcl The largest admissible number was %i (threshold %i)\n", largest_length, rcl_candidate_length_threshold); if (largest_length < rcl_candidate_length_threshold) printf("rcl all row cliques have been enumerated\n"); else printf("rcl not all row cliques have been eliminated\n"); } delete[] degrees; delete[] cand; delete[] label; } /*****************************************************************************/ /*===========================================================================* * Find violated star cliques, a la Hoffman-Padberg. * * Algorithm: Take min degree node. Check for violated cuts in the subgraph * consisting of this node and its neighbors (the "star" of this node). Then * delete the node and continue with the now min degree node. * * Implementation: Two arrays are defined, one contains the indices the other * the degrees of all the nodes still in the graph. If the min degree is 0 * or 1 then the min degree node can be deleted at once. * All cliques are enumerated in v U star(v) if the min degree is smaller * than the threshold scl_candidate_length_threshold, otherwise attemp to * find maximal clique greedily. * * Note: Indices in current_indices are always kept in increasing order. *===========================================================================*/ void CglClique::find_scl(OsiCuts& cs) { const int nodenum = fgraph.nodenum; const fnode *nodes = fgraph.nodes; // Return at once if no nodes - otherwise we get invalid reads if (!nodenum) return; int *current_indices = new int[nodenum]; int *current_degrees = new int[nodenum]; double *current_values = new double[nodenum]; int *star = cl_indices; int *star_deg = new int[nodenum]; /** An array used in the recursive complete enumeration of maximal cliques. The first cl_length entries are used. */ bool* label = new bool[nodenum]; int i, cnt1 = 0, cnt2 = 0, cnt3 = 0; int clique_cnt_e = 0, clique_cnt_g = 0; int largest_star_size = 0; /* initialize global variables */ cl_del_length = 0; /* initialize current_nodes, current_degrees and current_values */ int current_nodenum = nodenum; for (i = 0; i < nodenum; i++) { current_indices[i] = i; current_degrees[i] = nodes[i].degree; current_values[i] = nodes[i].val; } /* find first node to be checked */ int best_ind = scl_choose_next_node(current_nodenum, current_indices, current_degrees, current_values); int v = current_indices[best_ind]; int v_deg = current_degrees[best_ind]; double v_val = current_values[best_ind]; /* while there are nodes left in the graph ... (more precisely, while there are at least 3 nodes in the graph) */ while (current_nodenum > 2) { /* if the best node is of degree < 2 then it can be deleted */ if (v_deg < 2) { cl_del_indices[cl_del_length++] = v; scl_delete_node(best_ind, current_nodenum, current_indices, current_degrees, current_values); best_ind = scl_choose_next_node(current_nodenum, current_indices, current_degrees, current_values); v = current_indices[best_ind]; v_deg = current_degrees[best_ind]; v_val = current_values[best_ind]; largest_star_size = CoinMax(largest_star_size, v_deg); continue; } /* star will contain the indices of v's neighbors (but not v's index) */ const bool* node_node_start = node_node + nodenum * v; int& star_length = cl_length; star_length = 0; double star_val = v_val; for (i = 0; i < current_nodenum; i++) { const int other_node = current_indices[i]; if (node_node_start[other_node]) { star[star_length] = other_node; star_deg[star_length++] = current_degrees[i]; star_val += current_values[i]; } } /* quick check: if sum of values for the star does not exceed 1 then there won't be a violated clique in the star */ if (star_val >= 1 + petol) { /* node whose star we're evaluating is always in */ cl_perm_length = 1; cl_perm_indices = &v; /* find maximal violated cliques in star. cliques found here might not be maximal wrt to entire fractional graph, only for the current subset of it (some nodes might be already deleted...) Note that star is the same as cl_indices and start_length is cl_length... */ if (v_deg < scl_candidate_length_threshold) { // par /* enumerate if v_deg is small enough */ for (i = 0; i < star_length; i++) label[i] = false; int pos = 0; clique_cnt_e += enumerate_maximal_cliques(pos, label, cs); cnt1++; } else { /* greedily find if v_deg is too big */ /* order nodes in *decreasing* order of their degrees in star */ CoinSort_2(star_deg, star_deg + star_length, star, CoinFirstGreater_2()); /* find maxl clique greedily, including v */ clique_cnt_g += greedy_maximal_clique(cs); cnt2++; } } else { cnt3++; } /* delete v from current_indices */ cl_del_indices[cl_del_length++] = v; scl_delete_node(best_ind, current_nodenum, current_indices, current_degrees, current_values); best_ind = scl_choose_next_node(current_nodenum, current_indices, current_degrees, current_values); v = current_indices[best_ind]; v_deg = current_degrees[best_ind]; v_val = current_values[best_ind]; largest_star_size = CoinMax(largest_star_size, v_deg); } const int clique_cnt = clique_cnt_e + clique_cnt_g; if (scl_report_result) { printf("\nscl Found %i new violated cliques with the star-clique method", clique_cnt); printf("\nscl The largest star size was %i (threshold %i)\n", largest_star_size, scl_candidate_length_threshold); // par printf("scl Enumeration %i times, found %i maxl cliques\n", cnt1, clique_cnt_e); printf("scl Greedy %i times, found %i maxl cliques\n", cnt2, clique_cnt_g); printf("scl Skipped a star b/c of small solution value %i times\n", cnt3); if (cnt2 == 0) printf("scl all cliques have been enumerated\n"); else printf("scl not all cliques have been eliminated\n"); } delete[] current_indices; delete[] current_degrees; delete[] current_values; delete[] star_deg; delete[] label; } /*****************************************************************************/ /*===========================================================================* * returns the index of the "best" node wrt current_indices, etc. *===========================================================================*/ int CglClique::scl_choose_next_node(const int current_nodenum, const int * /* current_indices */, const int *current_degrees, const double *current_values) { int best = 0; int best_deg = current_degrees[0]; double best_val = current_values[0]; int i; switch (scl_next_node_rule) { // p->par.scl_which_node case SCL_MIN_DEGREE: // NOTE: could use stl::min_element for (i = 1; i < current_nodenum; i++) if (current_degrees[i] < best_deg) { best = i; best_deg = current_degrees[i]; } break; case SCL_MAX_DEGREE: // NOTE: could use stl::max_element for (i = 1; i < current_nodenum; i++) if (current_degrees[i] > best_deg) { best = i; best_deg = current_degrees[i]; } break; case SCL_MAX_XJ_MAX_DEG: for (i = 1; i < current_nodenum; i++) { if (current_values[i] > best_val) { best = i; best_val = current_values[i]; best_deg = current_degrees[i]; } else if (current_values[i] == best_val && current_degrees[i] > best_deg) { best = i; best_deg = current_degrees[i]; } } break; default: printf("ERROR: bad starcl_which_node (in scl_choose_next_node\n"); break; } return(best); } /*****************************************************************************/ /*===========================================================================* * Delete the node of index del_ind (this index is wrt current_indices) from * the list current_indices (current_degrees and current_values) and based on * the graph stored in fgraph decrease the degrees of its neighbors. * * There are at least 3 nodes in the graph when this function is invoked. * * Note that the node indices in current_indices are in increasing order, * and that this ordering is maintained here. * * fgraph: IN, pointer to the fractional graph * node_node: IN, node_node incidence matrix * del_ind: IN, the index of the node to be deleted (wrt to current_indices) * pcurrent_nodenum: INOUT, pointer to the current number of nodes * current_indices: INOUT, array of current node indices * current_degrees: INOUT, array of current node degrees, in the dame order * as in current_indices * current_values: INOUT, array of solution values *===========================================================================*/ void CglClique::scl_delete_node(const int del_ind, int& current_nodenum, int *current_indices, int *current_degrees, double *current_values) { const int v = current_indices[del_ind]; /* delete the entry corresponding to del_ind from current_indices, current_degrees and current_values */ memmove(reinterpret_cast(current_indices + del_ind), reinterpret_cast(current_indices + (del_ind+1)), (current_nodenum-del_ind-1) * sizeof(int)); memmove(reinterpret_cast(current_degrees + del_ind), reinterpret_cast(current_degrees + (del_ind+1)), (current_nodenum-del_ind-1) * sizeof(int)); memmove(reinterpret_cast(current_values + del_ind), reinterpret_cast(current_values + (del_ind+1)), (current_nodenum-del_ind-1) * sizeof(double)); current_nodenum--; /* decrease the degrees of v's neighbors by 1 */ const bool* node_node_start = node_node + (fgraph.nodenum * v); for (int i = 0; i < current_nodenum; ++i) if (node_node_start[current_indices[i]]) current_degrees[i]--; } /*****************************************************************************/ /*===========================================================================* * Enumerate all maximal cliques on the nodes in scl_indices. Maximal cliques * that are violated are added to the cut list. Returns the number of maximal * violated cliques found. The algorithm is recursive. * * Data members used from CglClique * fgraph: IN, the description of the intersection graph * cl_perm_length: IN, the length of cl_perm_indices * cl_perm_indices: IN, indices of nodes that MUST be in the clique, these * nodes are supposed to be connected to all nodes in * cl_indices * cl_length: IN, length of cl_indices and label * cl_indices: IN, indices of nodes on which maximal cliques are sought * cl_del_length: IN, length of cl_del_indices * cl_del_indices: IN, indices of nodes that are already deleted. these * nodes are tested whether they can be added to a max * clique discovered in scl_indices. if any of them can be * added then the clique is not maximal after all... * * Arguments: * label: INOUT, indicates which nodes are in the clique at the moment * pos: INOUT, position within cl_indices (and label), nodes up to * position pos in cl_indices are permanently labeled (backtrack cannot * change labels) *===========================================================================*/ int CglClique::enumerate_maximal_cliques(int& pos, bool* label, OsiCuts& cs) { const fnode *nodes = fgraph.nodes; const int nodenum = fgraph.nodenum; int i, j, k, cnt; /* starting from position pos, find the first node in cl_indices that can be added to the clique, and label it with true */ while (pos < cl_length) { label[pos] = true; const bool* node_node_start = node_node + cl_indices[pos] * nodenum; for (j = 0; j < pos; j++) if (label[j] && ! node_node_start[cl_indices[j]]) { label[pos] = false; break; } if (label[pos++] == true) break; } /* found counts the number of maximal violated cliques that have been sent to the lp under the current level of recursion */ int found = 0; /* if not all nodes are labeled: recurse by setting the last node labeled true once to true and once to false; otherwise check whether the clique found is maximal and violated */ if (pos < cl_length) { found += enumerate_maximal_cliques(pos, label, cs); label[pos-1] = false; found += enumerate_maximal_cliques(pos, label, cs); } else { /* check if the clique can be extended on cl_indices */ /* copy indices of the clique into coef (not user inds, coef is a tmp) */ int* coef = new int[cl_length + cl_perm_length]; for (j = cl_length - 1, cnt = 0; j >= 0; j--) if (label[j]) coef[cnt++] = cl_indices[j]; if (!cnt) { delete[] coef; return(found); } /* check if the clique can be extended on cl_indices */ for (k = cl_length - 1; k >= 0; k--) { if (!label[k]) { const bool* node_node_start = node_node + cl_indices[k] * nodenum; for (i = cnt - 1; i >= 0; i--) if (!node_node_start[coef[i]]) break; /* if k can be added to the clique, return (the clique is not maximal, so it will be or was recorded) */ if (i < 0) { delete[] coef; return(found); } } } /* now the clique is maximal on cl_indices. fill relative indices into coef */ for (j = 0; j < cl_perm_length; j++) coef[cnt++] = cl_perm_indices[j]; /* check if clique is violated */ double lhs = 0; for (j = 0; j < cnt; j++) lhs += nodes[coef[j]].val; if (lhs < 1 + petol) { delete[] coef; return(found); } /* if clique can be extended on cl_del_indices then it can be discarded (was already counted) */ for (i = 0; i < cl_del_length; i++) { const bool* node_node_start = node_node + cl_del_indices[i]*nodenum; for (j = cnt - 1; j >= 0; j--) if (!node_node_start[coef[j]]) break; /* if cl_del_indices[i] can be added to the clique, return */ if (j < 0) { delete[] coef; return(found); } } recordClique(cnt, coef, cs); delete[] coef; ++found; } return(found); } /*****************************************************************************/ /*===========================================================================* * Find a violated clique greedily in the given array of indices, starting * from pos. Return the number of violated cliques found (1 or 0). * This routine overwrites the array indices: those variables in the * clique will be shuffled to the beginning of the array (after pos). *===========================================================================*/ int CglClique::greedy_maximal_clique(OsiCuts& cs) { assert(cl_length > 0); const fnode *nodes = fgraph.nodes; const int nodenum = fgraph.nodenum; int i, j; int * coef = new int[cl_length + cl_perm_length]; coef[0] = cl_indices[0]; int cnt = 1; for (j = 1; j < cl_length; j++) { const int var = cl_indices[j]; const bool* node_node_start = node_node + var * nodenum; for (i = cnt-1; i >= 0; i--) if (!node_node_start[coef[i]]) break; if (i < 0) coef[cnt++] = var; } for (j = 0; j < cl_perm_length; j++) coef[cnt++] = cl_perm_indices[j]; /* now coef contains the clique */ /* only cliques of size at least 3 are interesting */ if (cnt < 3) { delete[] coef; return(0); } /* compute lhs */ double lhs = 0; for (j = 0; j < cnt; j++) lhs += nodes[coef[j]].val; if (lhs > 1 + petol) { recordClique(cnt, coef, cs); delete[] coef; return(1); } delete[] coef; return(0); } /*****************************************************************************/ /*===========================================================================* *===========================================================================*/ void CglClique::recordClique(const int len, int* indices, OsiCuts& cs) { /* transform relative indices into user indices and order them */ for (int j = len - 1; j >= 0; j--) indices[j] = sp_orig_col_ind[indices[j]]; std::sort(indices, indices + len); OsiRowCut rowcut; double* coef = new double[len]; std::fill(coef, coef + len, 1.0); rowcut.setRow(len, indices, coef); rowcut.setUb(1.0); CoinAbsFltEq equal(1.0e-12); cs.insertIfNotDuplicate(rowcut,equal); delete[] coef; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglClique::clone() const { return new CglClique(*this); } /*****************************************************************************/ // Create C++ lines to get to current state std::string CglClique::generateCpp( FILE * fp) { CglClique other; fprintf(fp,"0#include \"CglClique.hpp\"\n"); fprintf(fp,"3 CglClique clique;\n"); std::string types[] = {"SCL_MIN_DEGREE","SCL_MAX_DEGREE", "SCL_MAX_XJ_MAX_DEG"}; if (scl_next_node_rule!=other.scl_next_node_rule) fprintf(fp,"3 clique.setStarCliqueNextNodeMethod(CglClique::%s);\n", types[scl_next_node_rule].c_str()); else fprintf(fp,"4 clique.setStarCliqueNextNodeMethod(CglClique::%s);\n", types[scl_next_node_rule].c_str()); if (scl_candidate_length_threshold!=other.scl_candidate_length_threshold) fprintf(fp,"3 clique.setStarCliqueCandidateLengthThreshold(%d);\n", scl_candidate_length_threshold); else fprintf(fp,"4 clique.setStarCliqueCandidateLengthThreshold(%d);\n", scl_candidate_length_threshold); if (rcl_candidate_length_threshold!=other.rcl_candidate_length_threshold) fprintf(fp,"3 clique.setRowCliqueCandidateLengthThreshold(%d);\n", rcl_candidate_length_threshold); else fprintf(fp,"4 clique.setRowCliqueCandidateLengthThreshold(%d);\n", rcl_candidate_length_threshold); if (scl_report_result!=other.scl_report_result) fprintf(fp,"3 clique.setStarCliqueReport(%s);\n", scl_report_result ? "true" : "false"); else fprintf(fp,"4 clique.setStarCliqueReport(%s);\n", scl_report_result ? "true" : "false"); if (rcl_report_result!=other.rcl_report_result) fprintf(fp,"3 clique.setRowCliqueReport(%s);\n", rcl_report_result ? "true" : "false"); else fprintf(fp,"4 clique.setRowCliqueReport(%s);\n", rcl_report_result ? "true" : "false"); if (do_star_clique!=other.do_star_clique) fprintf(fp,"3 clique.setDoStarClique(%s);\n", do_star_clique ? "true" : "false"); else fprintf(fp,"4 clique.setDoStarClique(%s);\n", do_star_clique ? "true" : "false"); if (do_row_clique!=other.do_row_clique) fprintf(fp,"3 clique.setDoRowClique(%s);\n", do_row_clique ? "true" : "false"); else fprintf(fp,"4 clique.setDoRowClique(%s);\n", do_row_clique ? "true" : "false"); if (petol!=other.petol) fprintf(fp,"3 clique.setMinViolation(%g);\n",petol); else fprintf(fp,"4 clique.setMinViolation(%g);\n",petol); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 clique.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 clique.setAggressiveness(%d);\n",getAggressiveness()); return "clique"; } /*****************************************************************************/ #include "../CglProbing/CglProbing.hpp" CglFakeClique::CglFakeClique(OsiSolverInterface * solver, bool setPacking) : CglClique(setPacking,true) { if (solver) fakeSolver_ = solver->clone(); else fakeSolver_ = NULL; if (fakeSolver_) { probing_ = new CglProbing(); probing_->refreshSolver(fakeSolver_); } else { probing_ = NULL; } } // Copy constructor CglFakeClique::CglFakeClique(const CglFakeClique& rhs) : CglClique(rhs) { if (rhs.fakeSolver_) { fakeSolver_ = rhs.fakeSolver_->clone(); probing_ = new CglProbing(*rhs.probing_); probing_->refreshSolver(fakeSolver_); } else { fakeSolver_ = NULL; probing_ = NULL; } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglFakeClique::clone() const { return new CglFakeClique(*this); } // Destructor CglFakeClique::~CglFakeClique() { delete fakeSolver_; delete probing_; } // Assign solver (generator takes over ownership) void CglFakeClique::assignSolver(OsiSolverInterface * fakeSolver) { delete fakeSolver_; fakeSolver_ = fakeSolver; if (fakeSolver_) { delete [] sp_orig_row_ind; sp_orig_row_ind=NULL; } if (probing_) probing_->refreshSolver(fakeSolver_); } #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif // Generate cuts void CglFakeClique::generateCuts(const OsiSolverInterface& si, OsiCuts & cs, const CglTreeInfo info) { if (fakeSolver_) { assert (si.getNumCols()==fakeSolver_->getNumCols()); fakeSolver_->setColLower(si.getColLower()); const double * solution = si.getColSolution(); fakeSolver_->setColSolution(solution); fakeSolver_->setColUpper(si.getColUpper()); // get and set branch and bound cutoff double cutoff; si.getDblParam(OsiDualObjectiveLimit,cutoff); fakeSolver_->setDblParam(OsiDualObjectiveLimit,COIN_DBL_MAX); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (fakeSolver_); if (clpSolver) { // fix up fake solver const ClpSimplex * siSimplex = clpSolver->getModelPtr(); // need to set djs memcpy(siSimplex->primalColumnSolution(), si.getReducedCost(),si.getNumCols()*sizeof(double)); fakeSolver_->setDblParam(OsiDualObjectiveLimit,cutoff); } #endif const CoinPackedMatrix * matrixByRow = si.getMatrixByRow(); const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); const double * rowUpper = si.getRowUpper(); const double * rowLower = si.getRowLower(); // Scan all rows looking for possibles int numberRows = si.getNumRows(); double tolerance = 1.0e-3; for (int iRow=0;iRowupRhs+tolerance) { // add as cut OsiRowCut rc; rc.setLb(loRhs); rc.setUb(upRhs); rc.setRow(end-start,column+start,elementByRow+start,false); CoinAbsFltEq equal(1.0e-12); cs.insertIfNotDuplicate(rc,equal); } } CglClique::generateCuts(*fakeSolver_,cs,info); if (probing_) { probing_->generateCuts(*fakeSolver_,cs,info); } } else { // just use real solver CglClique::generateCuts(si,cs,info); } } CoinMP-1.8.3/Cgl/src/CglClique/CglCliqueHelper.cpp0000644000175000017500000002772312130102162020173 0ustar renerene// $Id: CglCliqueHelper.cpp 1119 2013-04-06 20:24:18Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPackedMatrix.hpp" #include "OsiSolverInterface.hpp" #include "CglClique.hpp" /*****************************************************************************/ /*===========================================================================* Scan through the variables and select those that are binary and are at a fractional level. *===========================================================================*/ void CglClique::selectFractionalBinaries(const OsiSolverInterface& si) { // extract the primal tolerance from the solver double lclPetol = 0.0; si.getDblParam(OsiPrimalTolerance, lclPetol); const int numcols = si.getNumCols(); if (petol<0.0) { // do all if not too many int n=0; for (int i = 0; i < numcols; ++i) { if (si.isBinary(i)) n++; } if (n<5000) lclPetol=-1.0e-5; } const double* x = si.getColSolution(); std::vector fracind; int i; for (i = 0; i < numcols; ++i) { if (si.isBinary(i) && x[i] > lclPetol && x[i] < 1-petol) fracind.push_back(i); } sp_numcols = static_cast(fracind.size()); sp_orig_col_ind = new int[sp_numcols]; sp_colsol = new double[sp_numcols]; for (i = 0; i < sp_numcols; ++i) { sp_orig_col_ind[i] = fracind[i]; sp_colsol[i] = x[fracind[i]]; } } /*****************************************************************************/ /*===========================================================================* Scan through the variables and select those that are at a fractional level. We already know that everything is binary. *===========================================================================*/ void CglClique::selectFractionals(const OsiSolverInterface& si) { // extract the primal tolerance from the solver double lclPetol = 0.0; si.getDblParam(OsiPrimalTolerance, lclPetol); const int numcols = si.getNumCols(); const double* x = si.getColSolution(); std::vector fracind; int i; for (i = 0; i < numcols; ++i) { if (x[i] > lclPetol && x[i] < 1-lclPetol) fracind.push_back(i); } sp_numcols = static_cast(fracind.size()); sp_orig_col_ind = new int[sp_numcols]; sp_colsol = new double[sp_numcols]; for (i = 0; i < sp_numcols; ++i) { sp_orig_col_ind[i] = fracind[i]; sp_colsol[i] = x[fracind[i]]; } } /*****************************************************************************/ /*===========================================================================* *===========================================================================*/ void CglClique::selectRowCliques(const OsiSolverInterface& si,int numOriginalRows) { const int numrows = si.getNumRows(); std::vector clique(numrows, 1); int i, j, k; // First scan through the binary fractional variables and see where do they // have a 1 coefficient const CoinPackedMatrix& mcol = *si.getMatrixByCol(); for (j = 0; j < sp_numcols; ++j) { const CoinShallowPackedVector& vec = mcol.getVector(sp_orig_col_ind[j]); const int* ind = vec.getIndices(); const double* elem = vec.getElements(); for (i = vec.getNumElements() - 1; i >= 0; --i) { if (elem[i] != 1.0) { clique[ind[i]] = 0; } } } // Now check the sense and rhs (by checking rowupper) and the rest of the // coefficients const CoinPackedMatrix& mrow = *si.getMatrixByRow(); const double* rub = si.getRowUpper(); for (i = 0; i < numrows; ++i) { if (rub[i] != 1.0||i>=numOriginalRows) { clique[i] = 0; continue; } if (clique[i] == 1) { const CoinShallowPackedVector& vec = mrow.getVector(i); const double* elem = vec.getElements(); for (j = vec.getNumElements() - 1; j >= 0; --j) { if (elem[j] < 0) { clique[i] = 0; break; } } } } // Finally collect the still standing rows into sp_orig_row_ind sp_numrows = std::accumulate(clique.begin(), clique.end(), 0); sp_orig_row_ind = new int[sp_numrows]; for (i = 0, k = 0; i < numrows; ++i) { if (clique[i] == 1) { sp_orig_row_ind[k++] = i; } } } /*****************************************************************************/ /*===========================================================================* Create the set packing submatrix *===========================================================================*/ void CglClique::createSetPackingSubMatrix(const OsiSolverInterface& si) { sp_col_start = new int[sp_numcols+1]; sp_row_start = new int[sp_numrows+1]; std::fill(sp_col_start, sp_col_start + (sp_numcols+1), 0); std::fill(sp_row_start, sp_row_start + (sp_numrows+1), 0); int i, j; const CoinPackedMatrix& mcol = *si.getMatrixByCol(); const int numrows = si.getNumRows(); int* clique = new int[numrows]; std::fill(clique, clique+numrows, -1); for (i = 0; i < sp_numrows; ++i) clique[sp_orig_row_ind[i]] = i; for (j = 0; j < sp_numcols; ++j) { const CoinShallowPackedVector& vec = mcol.getVector(sp_orig_col_ind[j]); const int* ind = vec.getIndices(); for (i = vec.getNumElements() - 1; i >= 0; --i) { if (clique[ind[i]] >= 0) { ++sp_col_start[j]; ++sp_row_start[clique[ind[i]]]; } } } std::partial_sum(sp_col_start, sp_col_start+sp_numcols, sp_col_start); std::rotate(sp_col_start, sp_col_start+sp_numcols, sp_col_start + (sp_numcols+1)); std::partial_sum(sp_row_start, sp_row_start+sp_numrows, sp_row_start); std::rotate(sp_row_start, sp_row_start+sp_numrows, sp_row_start + (sp_numrows+1)); const int nzcnt = sp_col_start[sp_numcols]; assert(nzcnt == sp_row_start[sp_numrows]); /* Now create the vectors with row indices for each column (sp_col_ind) and column indices for each row (sp_row_ind). It turns out that CoinIsOrthogonal assumes that the row indices for a given column are listed in ascending order. This is *not* a solver-independent assumption! At best, one can hope that the underlying solver will produce an index vector that's either ascending or descending. Under that assumption, compare the first and last entries and proceed accordingly. Eventually some solver will come along that hands back an index vector in random order, and CoinIsOrthogonal will break. Until then, try and avoid the cost of a sort. */ sp_col_ind = new int[nzcnt]; sp_row_ind = new int[nzcnt]; int last=0; for (j = 0; j < sp_numcols; ++j) { const CoinShallowPackedVector& vec = mcol.getVector(sp_orig_col_ind[j]); const int len = vec.getNumElements(); const int* ind = vec.getIndices(); if (ind[0] < ind[len-1]) { for (i = 0; i < len; ++i) { const int sp_row = clique[ind[i]]; if (sp_row >= 0) { sp_col_ind[sp_col_start[j]++] = sp_row; sp_row_ind[sp_row_start[sp_row]++] = j; } } } else { for (i = len-1; i >= 0; --i) { const int sp_row = clique[ind[i]]; if (sp_row >= 0) { sp_col_ind[sp_col_start[j]++] = sp_row; sp_row_ind[sp_row_start[sp_row]++] = j; } } } // sort std::sort(sp_col_ind+last,sp_col_ind+sp_col_start[j]); last=sp_col_start[j]; } std::rotate(sp_col_start, sp_col_start+sp_numcols, sp_col_start + (sp_numcols+1)); sp_col_start[0] = 0; std::rotate(sp_row_start, sp_row_start+sp_numrows, sp_row_start + (sp_numrows+1)); sp_row_start[0] = 0; delete[] clique; } /*****************************************************************************/ static inline bool CoinIsOrthogonal(const int* first0, const int* last0, const int* first1, const int* last1) { while (first0 != last0 && first1 != last1) { if (*first0 == *first1) return false; if (*first0 < *first1) ++first0; else ++first1; } return true; } /*===========================================================================* Build up the fractional graph *===========================================================================*/ void CglClique::createFractionalGraph() { // fgraph.edgenum is filled when createNodeNode is invoked fgraph.nodenum = sp_numcols; fgraph.all_nbr = new int[2*fgraph.edgenum]; fgraph.nodes = new fnode[sp_numcols+1]; int *all_nbr = fgraph.all_nbr; fnode *nodes = fgraph.nodes; int min_degree, max_degree, min_deg_node, max_deg_node; # ifdef ZEROFAULT // May be read below even if sp_numcols == 0 nodes[0].degree = 0 ; # endif int i, j, total_deg, old_total; /*========================================================================* Construct the adjacency lists (neighbors) of the nodes in fgraph. Two nodes are adjacent iff the columns corresponding to them are non-orthogonal. *========================================================================*/ for ( i = 0, total_deg = 0; i < sp_numcols; i++ ) { old_total = total_deg; const bool* node_node_i = node_node + i * sp_numcols; for ( j = 0; j < sp_numcols; j++ ) { if ( node_node_i[j] ) { all_nbr[total_deg++] = j; } } nodes[i].val = sp_colsol[i]; nodes[i].degree = total_deg - old_total; nodes[i].nbrs = all_nbr + old_total; } fgraph.density = static_cast (total_deg) / (sp_numcols * (sp_numcols-1)); /*========================================================================* Compute the min and max degree. *========================================================================*/ min_deg_node = 0; max_deg_node = 0; min_degree = max_degree = nodes[0].degree; for ( i = 0; i < sp_numcols; i++ ) { if ( nodes[i].degree < min_degree ) { min_deg_node = i; min_degree = nodes[i].degree; } if ( nodes[i].degree > max_degree ) { max_deg_node = i; max_degree = nodes[i].degree; } } fgraph.min_degree = min_degree; fgraph.max_degree = max_degree; fgraph.min_deg_node = min_deg_node; fgraph.max_deg_node = max_deg_node; } /*****************************************************************************/ /*===========================================================================* * Construct the node-node incidence matrix from the fractional graph. *===========================================================================*/ int CglClique::createNodeNode() { node_node = new bool[sp_numcols * sp_numcols]; std::fill(node_node, node_node + sp_numcols * sp_numcols, false); int i, j; int edgenum = 0; for (i = 0; i < sp_numcols; ++i) { for (j = i+1; j < sp_numcols; ++j) { if (! CoinIsOrthogonal(sp_col_ind + sp_col_start[i], sp_col_ind + sp_col_start[i+1], sp_col_ind + sp_col_start[j], sp_col_ind + sp_col_start[j+1]) ) { node_node[i * sp_numcols + j] = true; node_node[j * sp_numcols + i] = true; ++edgenum; } } } return edgenum; } /*****************************************************************************/ /*===========================================================================* * Cleanup routines *===========================================================================*/ void CglClique::deleteSetPackingSubMatrix() { delete[] sp_orig_row_ind; sp_orig_row_ind = 0; delete[] sp_orig_col_ind; sp_orig_col_ind = 0; delete[] sp_colsol; sp_colsol = 0; delete[] sp_col_start; sp_col_start = 0; delete[] sp_col_ind; sp_col_ind = 0; delete[] sp_row_start; sp_row_start = 0; delete[] sp_row_ind; sp_row_ind = 0; } void CglClique::deleteFractionalGraph() { fgraph.nodenum = 0; fgraph.edgenum = 0; fgraph.density = 0; fgraph.min_deg_node = 0; fgraph.min_degree = 0; fgraph.max_deg_node = 0; fgraph.max_degree = 0; delete[] fgraph.all_nbr; fgraph.all_nbr = 0; delete[] fgraph.nodes; fgraph.nodes = 0; delete[] fgraph.all_edgecost; fgraph.all_edgecost = 0; } CoinMP-1.8.3/Cgl/src/CglRedSplit2/0000755000175000017500000000000012600453455015052 5ustar renereneCoinMP-1.8.3/Cgl/src/CglRedSplit2/Makefile.in0000644000175000017500000005472512506321416017130 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglRedSplit2 DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglRedSplit2_la_LIBADD = am_libCglRedSplit2_la_OBJECTS = CglRedSplit2.lo CglRedSplit2Test.lo \ CglRedSplit2Param.lo libCglRedSplit2_la_OBJECTS = $(am_libCglRedSplit2_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglRedSplit2_la_SOURCES) DIST_SOURCES = $(libCglRedSplit2_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglRedSplit2 # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglRedSplit2.la # List all source files for this library, including headers libCglRedSplit2_la_SOURCES = \ CglRedSplit2.cpp CglRedSplit2.hpp \ CglRedSplit2Test.cpp \ CglRedSplit2Param.cpp CglRedSplit2Param.hpp # This is for libtool (on Windows) libCglRedSplit2_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglRedSplit2.hpp CglRedSplit2Param.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglRedSplit2/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglRedSplit2/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglRedSplit2.la: $(libCglRedSplit2_la_OBJECTS) $(libCglRedSplit2_la_DEPENDENCIES) $(CXXLINK) $(libCglRedSplit2_la_LDFLAGS) $(libCglRedSplit2_la_OBJECTS) $(libCglRedSplit2_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglRedSplit2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglRedSplit2Param.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglRedSplit2Test.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglRedSplit2/Makefile.am0000644000175000017500000000333712130104031017071 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglRedSplit2 # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglRedSplit2.la # List all source files for this library, including headers libCglRedSplit2_la_SOURCES = \ CglRedSplit2.cpp CglRedSplit2.hpp \ CglRedSplit2Test.cpp \ CglRedSplit2Param.cpp CglRedSplit2Param.hpp # This is for libtool (on Windows) libCglRedSplit2_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglRedSplit2.hpp CglRedSplit2Param.hpp CoinMP-1.8.3/Cgl/src/CglRedSplit2/CglRedSplit2Test.cpp0000644000175000017500000000416312130104031020635 0ustar renerene#include #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglRedSplit2.hpp" void CglRedSplit2UnitTest(const OsiSolverInterface *baseSiP, const std::string mpsDir) { // Test default constructor { CglRedSplit2 aGenerator; } // Test copy & assignment { CglRedSplit2 rhs; { CglRedSplit2 bGenerator; CglRedSplit2 cGenerator(bGenerator); rhs=bGenerator; } } // Test get/set methods { CglRedSplit2 getset; CglRedSplit2Param gsparam = getset.getParam(); double geps = 1.1 * gsparam.getEPS(); gsparam.setEPS(geps); double geps2 = gsparam.getEPS(); assert(geps == geps2); double gepse = 1.1 * gsparam.getEPS_ELIM(); gsparam.setEPS_ELIM(gepse); double gepse2 = gsparam.getEPS_ELIM(); assert(gepse == gepse2); double gmv = 1.1 * gsparam.getMINVIOL(); gsparam.setMINVIOL(gmv); double gmv2 = gsparam.getMINVIOL(); assert(gmv == gmv2); } // Test generateCuts { CglRedSplit2 gct; OsiSolverInterface *siP = baseSiP->clone(); std::string fn = mpsDir+"p0033"; std::string fn2 = mpsDir+"p0033.mps"; FILE *in_f = fopen(fn2.c_str(), "r"); if(in_f == NULL) { std::cout<<"Can not open file "<readMps(fn.c_str(),"mps"); siP->initialSolve(); double lpRelax = siP->getObjValue(); OsiCuts cs; gct.getParam().setMAX_SUPPORT(34); gct.generateCuts(*siP, cs); int nRowCuts = cs.sizeRowCuts(); std::cout<<"There are "< 0); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cs); siP->resolve(); double lpRelaxAfter= siP->getObjValue(); std::cout<<"Initial LP value: "< #include #include #include #include #include #include "CoinPragma.hpp" #include "CglRedSplit2Param.hpp" /***********************************************************************/ void CglRedSplit2Param::setAway(double value) { if (value > 0.0 && value <= 0.5) away_ = value; } /***********************************************************************/ void CglRedSplit2Param::setEPS_ELIM(double eps_el) { if(eps_el >= 0) EPS_ELIM = eps_el; } /* setEPS_ELIM */ /***********************************************************************/ void CglRedSplit2Param::setEPS_RELAX_ABS(double eps_ra) { if(eps_ra >= 0) EPS_RELAX_ABS = eps_ra; } /* setEPS_RELAX_ABS */ /***********************************************************************/ void CglRedSplit2Param::setEPS_RELAX_REL(double eps_rr) { if(eps_rr >= 0) EPS_RELAX_REL = eps_rr; } /* setEPS_RELAX_REL */ /***********************************************************************/ void CglRedSplit2Param::setMAXDYN(double value) { if (value > 1.0) { MAXDYN = value; } else { printf("### WARNING: CglRedSplit2::setMAXDYN(): value: %f ignored\n", value); } } /* setMAXDYN */ /***********************************************************************/ void CglRedSplit2Param::setMINVIOL(double value) { if (value > 0.0 && value <= 0.1) { MINVIOL = value; } else { printf("### WARNING: CglRedSplit2Param::setMINVIOL(): value: %f ignored\n", value); } } /* setMINVIOL */ /***********************************************************************/ void CglRedSplit2Param::setMAX_SUPP_REL(double value) { if (value > 0.0 && value <= 0.1) { MINVIOL = value; } else { printf("### WARNING: CglRedSplit2Param::setMINVIOL(): value: %f ignored\n", value); } } /* setMAX_SUPP_REL */ /***********************************************************************/ void CglRedSplit2Param::setUSE_INTSLACKS(int value) { USE_INTSLACKS = value; } /* setUSE_INTSLACKS */ /***********************************************************************/ void CglRedSplit2Param::setNormIsZero(double value) { if (value > 0.0 && value <= 1) { normIsZero_ = value; } else { printf("### WARNING: CglRedSplit2Param::setNormIsZero(): value: %f ignored\n", value); } } /* setNormIsZero */ /***********************************************************************/ void CglRedSplit2Param::setMinNormReduction(double value) { if (value > 0.0 && value <= 1) { minNormReduction_ = value; } else { printf("### WARNING: CglRedSplit2Param::setMinNormReduction(): value: %f ignored\n", value); } } /* setMinNormReduction */ /***********************************************************************/ void CglRedSplit2Param::setMaxSumMultipliers(int value) { if (value > 1) { maxSumMultipliers_ = value; } else { printf("### WARNING: CglRedSplit2Param::setMaxSumMultipliers(): value: %d ignored\n", value); } } /* setMaxSumMultipliers */ /***********************************************************************/ void CglRedSplit2Param::setNormalization(double value) { if (value >= 0) { normalization_ = value; } else { printf("### WARNING: CglRedSplit2Param::setNormalization(): value: %f ignored\n", value); } } /* setNormalization */ /***********************************************************************/ void CglRedSplit2Param::addNumRowsReduction(int value) { if (value >= 0) { numRowsReduction_.push_back(value); } else { printf("### WARNING: CglRedSplit2Param::addNumRowsReduction(): value: %d ignored\n", value); } } /* addNumRowsReduction */ /***********************************************************************/ void CglRedSplit2Param::addColumnSelectionStrategy(ColumnSelectionStrategy value) { if (value != CS_ALL && value != CS_BEST && value != CS_LAP_NONBASICS) { columnSelectionStrategy_.push_back(value); } else if (value == CS_ALL) { // CS_ALL means all strategies. columnSelectionStrategy_.push_back(CS1); columnSelectionStrategy_.push_back(CS2); columnSelectionStrategy_.push_back(CS3); columnSelectionStrategy_.push_back(CS4); columnSelectionStrategy_.push_back(CS5); columnSelectionStrategy_.push_back(CS6); columnSelectionStrategy_.push_back(CS7); columnSelectionStrategy_.push_back(CS8); columnSelectionStrategy_.push_back(CS9); columnSelectionStrategy_.push_back(CS10); columnSelectionStrategy_.push_back(CS11); columnSelectionStrategy_.push_back(CS12); columnSelectionStrategy_.push_back(CS13); columnSelectionStrategy_.push_back(CS14); columnSelectionStrategy_.push_back(CS15); columnSelectionStrategy_.push_back(CS16); columnSelectionStrategy_.push_back(CS17); columnSelectionStrategy_.push_back(CS18); columnSelectionStrategy_.push_back(CS19); columnSelectionStrategy_.push_back(CS20); columnSelectionStrategy_.push_back(CS21); } else if (value == CS_BEST){ // Select C-5P, I-2P-2/3, I-2P-4/5, I-3P columnSelectionStrategy_.push_back(CS4); columnSelectionStrategy_.push_back(CS5); columnSelectionStrategy_.push_back(CS6); columnSelectionStrategy_.push_back(CS7); columnSelectionStrategy_.push_back(CS8); columnSelectionStrategy_.push_back(CS9); columnSelectionStrategy_.push_back(CS10); columnSelectionStrategy_.push_back(CS11); columnSelectionStrategy_.push_back(CS12); columnSelectionStrategy_.push_back(CS18); columnSelectionStrategy_.push_back(CS19); columnSelectionStrategy_.push_back(CS20); columnSelectionStrategy_.push_back(CS21); } } /* addColumnSelectionStrategy */ /***********************************************************************/ void CglRedSplit2Param::addRowSelectionStrategy(RowSelectionStrategy value) { if (value != RS_ALL && value != RS_BEST){ rowSelectionStrategy_.push_back(value); } else if (value == RS_ALL){ rowSelectionStrategy_.push_back(RS1); rowSelectionStrategy_.push_back(RS2); rowSelectionStrategy_.push_back(RS3); rowSelectionStrategy_.push_back(RS4); rowSelectionStrategy_.push_back(RS5); rowSelectionStrategy_.push_back(RS6); rowSelectionStrategy_.push_back(RS7); rowSelectionStrategy_.push_back(RS8); } else if (value == RS_BEST){ rowSelectionStrategy_.push_back(RS7); rowSelectionStrategy_.push_back(RS8); } } /* addRowSelectionStrategy */ /***********************************************************************/ void CglRedSplit2Param::addNumRowsReductionLAP(int value) { if (value >= 0) { numRowsReductionLAP_.push_back(value); } else { printf("### WARNING: CglRedSplit2Param::addNumRowsReductionLAP(): value: %d ignored\n", value); } } /* addNumRowsReductionLAP */ /***********************************************************************/ void CglRedSplit2Param::addColumnSelectionStrategyLAP(ColumnSelectionStrategy value) { if (value != CS_ALL && value != CS_BEST) { columnSelectionStrategyLAP_.push_back(value); } else if (value == CS_BEST){ columnSelectionStrategyLAP_.push_back(CS1); } else{ printf("### WARNING: CglRedSplit2Param::addColumnSelectionStrategyLAP(): value: %d ignored\n", value); } } /* addColumnSelectionStrategyLAP */ /***********************************************************************/ void CglRedSplit2Param::addRowSelectionStrategyLAP(RowSelectionStrategy value) { if (value != RS_ALL && value != RS_BEST){ rowSelectionStrategyLAP_.push_back(value); } else if (value == RS_BEST){ rowSelectionStrategyLAP_.push_back(RS8); } else{ printf("### WARNING: CglRedSplit2Param::addRowSelectionStrategyLAP(): value: %d ignored\n", value); } } /* addRowSelectionStrategyLAP */ /***********************************************************************/ void CglRedSplit2Param::setTimeLimit(double value) { if (value >= 0.0){ timeLimit_ = value; } else { timeLimit_ = 0.0; } } /* setTimeLimit */ /***********************************************************************/ void CglRedSplit2Param::setMaxNumCuts(int value) { if (value >= 0){ maxNumCuts_ = value; } else { printf("### WARNING: CglRedSplit2Param::maxNumCuts(): value: %d ignored\n", value); } } /* setMaxNumCuts */ /***********************************************************************/ void CglRedSplit2Param::setMaxNumComputedCuts(int value) { if (value >= 0){ maxNumComputedCuts_ = value; } else { printf("### WARNING: CglRedSplit2Param::maxNumComputedCuts(): value: %d ignored\n", value); } } /* setMaxNumComputedCuts */ /***********************************************************************/ void CglRedSplit2Param::setMaxNonzeroesTab(int value) { if (value >= 0){ maxNonzeroesTab_ = value; } else { printf("### WARNING: CglRedSplit2Param::maxNonzeroesTab(): value: %d ignored\n", value); } } /* setMaxNumComputedCuts */ /***********************************************************************/ void CglRedSplit2Param::setColumnScalingStrategyLAP(ColumnScalingStrategy value) { columnScalingStrategyLAP_ = value; } /* setColumnScalingStrategyLAP */ /***********************************************************************/ void CglRedSplit2Param::setColumnScalingBoundLAP(double value) { if (value >= 0){ columnScalingBoundLAP_ = value; } else { printf("### WARNING: CglRedSplit2Param::columnScalingBoundLAP(): value: %f ignored\n", value); } } /* setColumnScalingBoundLAP */ /***********************************************************************/ void CglRedSplit2Param::setSkipGomory(int value) { if (value >= 0 && value <= 1){ skipGomory_ = value; } else{ printf("### WARNING: CglRedSplit2Param::skipGomory(): value: %d ignored\n", value); } } /***********************************************************************/ CglRedSplit2Param::CglRedSplit2Param(bool use_default_strategies, double eps, double eps_coeff, double eps_elim, double eps_relax_abs, double eps_relax_rel, double max_dyn, double min_viol, int max_supp_abs, double max_supp_rel, int use_int_slacks, double norm_zero, double minNormReduction, int maxSumMultipliers, double normalization, double away, double timeLimit, int maxNumCuts, int maxNumComputedCuts, int maxNonzeroesTab, double columnScalingBoundLAP, int skipGomory) : CglParam(COIN_DBL_MAX, eps, eps_coeff, max_supp_abs), EPS_ELIM(eps_elim), EPS_RELAX_ABS(eps_relax_abs), EPS_RELAX_REL(eps_relax_rel), MAXDYN(max_dyn), MINVIOL(min_viol), MAX_SUPP_REL(max_supp_rel), USE_INTSLACKS(use_int_slacks), normIsZero_(norm_zero), minNormReduction_(minNormReduction), maxSumMultipliers_(maxSumMultipliers), normalization_(normalization), away_(away), columnScalingBoundLAP_(columnScalingBoundLAP), timeLimit_(timeLimit), maxNumCuts_(maxNumCuts), maxNumComputedCuts_(maxNumComputedCuts), maxNonzeroesTab_(maxNonzeroesTab), skipGomory_(skipGomory) { if (use_default_strategies) { addNumRowsReduction(5); addColumnSelectionStrategy(CglRedSplit2Param::CS_BEST); addRowSelectionStrategy(CglRedSplit2Param::RS_BEST); addNumRowsReductionLAP(3); addColumnSelectionStrategyLAP(CglRedSplit2Param::CS1); addRowSelectionStrategyLAP(CglRedSplit2Param::RS8); setColumnScalingStrategyLAP(CglRedSplit2Param::SC_UNIFORM_NZ); } } /***********************************************************************/ CglRedSplit2Param::CglRedSplit2Param(const CglParam &source, bool use_default_strategies, double eps_elim, double eps_relax_abs, double eps_relax_rel, double max_dyn, double min_viol, double max_supp_rel, int use_int_slacks, double norm_zero, double minNormReduction, int maxSumMultipliers, double normalization, double away, double timeLimit, int maxNumCuts, int maxNumComputedCuts, int maxNonzeroesTab, double columnScalingBoundLAP, int skipGomory) : CglParam(source), EPS_ELIM(eps_elim), EPS_RELAX_ABS(eps_relax_abs), EPS_RELAX_REL(eps_relax_rel), MAXDYN(max_dyn), MINVIOL(min_viol), MAX_SUPP_REL(max_supp_rel), USE_INTSLACKS(use_int_slacks), normIsZero_(norm_zero), minNormReduction_(minNormReduction), maxSumMultipliers_(maxSumMultipliers), normalization_(normalization), away_(away), columnScalingBoundLAP_(columnScalingBoundLAP), timeLimit_(timeLimit), maxNumCuts_(maxNumCuts), maxNumComputedCuts_(maxNumComputedCuts), maxNonzeroesTab_(maxNonzeroesTab), skipGomory_(skipGomory) { if (use_default_strategies) { addNumRowsReduction(5); addColumnSelectionStrategy(CglRedSplit2Param::CS_BEST); addRowSelectionStrategy(CglRedSplit2Param::RS_BEST); addNumRowsReductionLAP(3); addColumnSelectionStrategyLAP(CglRedSplit2Param::CS1); addRowSelectionStrategyLAP(CglRedSplit2Param::RS8); setColumnScalingStrategyLAP(CglRedSplit2Param::SC_UNIFORM_NZ); } } /***********************************************************************/ CglRedSplit2Param::CglRedSplit2Param(const CglRedSplit2Param &source) : CglParam(source), EPS_ELIM(source.EPS_ELIM), EPS_RELAX_ABS(source.EPS_RELAX_ABS), EPS_RELAX_REL(source.EPS_RELAX_REL), MAXDYN(source.MAXDYN), MINVIOL(source.MINVIOL), MAX_SUPP_REL(source.MAX_SUPP_REL), USE_INTSLACKS(source.USE_INTSLACKS), normIsZero_(source.normIsZero_), minNormReduction_(source.minNormReduction_), maxSumMultipliers_(source.maxSumMultipliers_), normalization_(source.normalization_), away_(source.away_), numRowsReduction_(source.numRowsReduction_), columnSelectionStrategy_(source.columnSelectionStrategy_), rowSelectionStrategy_(source.rowSelectionStrategy_), numRowsReductionLAP_(source.numRowsReductionLAP_), columnSelectionStrategyLAP_(source.columnSelectionStrategyLAP_), rowSelectionStrategyLAP_(source.rowSelectionStrategyLAP_), columnScalingStrategyLAP_(source.columnScalingStrategyLAP_), columnScalingBoundLAP_(source.columnScalingBoundLAP_), timeLimit_(source.timeLimit_), maxNumCuts_(source.maxNumCuts_), maxNumComputedCuts_(source.maxNumComputedCuts_), maxNonzeroesTab_(source.maxNonzeroesTab_), skipGomory_(source.skipGomory_) {} /***********************************************************************/ CglRedSplit2Param* CglRedSplit2Param::clone() const { return new CglRedSplit2Param(*this); } /***********************************************************************/ CglRedSplit2Param& CglRedSplit2Param::operator=(const CglRedSplit2Param &rhs) { if(this != &rhs) { CglParam::operator=(rhs); EPS_ELIM = rhs.EPS_ELIM; EPS_RELAX_ABS = rhs.EPS_RELAX_ABS; EPS_RELAX_REL = rhs.EPS_RELAX_REL; MAXDYN = rhs.MAXDYN; MINVIOL = rhs.MINVIOL; MAX_SUPP_REL = rhs.MAX_SUPP_REL; USE_INTSLACKS = rhs.USE_INTSLACKS; normIsZero_ = rhs.normIsZero_; minNormReduction_ = rhs.minNormReduction_; maxSumMultipliers_ = rhs.maxSumMultipliers_; normalization_ = rhs.normalization_; away_ = rhs.away_; numRowsReduction_ = rhs.numRowsReduction_; columnSelectionStrategy_ = rhs.columnSelectionStrategy_; rowSelectionStrategy_ = rhs.rowSelectionStrategy_; numRowsReductionLAP_ = rhs.numRowsReductionLAP_; columnSelectionStrategyLAP_ = rhs.columnSelectionStrategyLAP_; rowSelectionStrategyLAP_ = rhs.rowSelectionStrategyLAP_; columnScalingStrategyLAP_ = rhs.columnScalingStrategyLAP_; columnScalingBoundLAP_ = rhs.columnScalingBoundLAP_; timeLimit_ = rhs.timeLimit_; maxNumCuts_ = rhs.maxNumCuts_; maxNumComputedCuts_ = rhs.maxNumComputedCuts_; maxNonzeroesTab_ = rhs.maxNonzeroesTab_; skipGomory_ = rhs.skipGomory_; } return *this; } /***********************************************************************/ CglRedSplit2Param::~CglRedSplit2Param() {} CoinMP-1.8.3/Cgl/src/CglRedSplit2/CglRedSplit2.hpp0000644000175000017500000004472612130104031020013 0ustar renerene// Last edit: 04/03/10 // // Name: CglRedSplit2.hpp // Author: Giacomo Nannicini // Singapore University of Technology and Design // Singapore // email: nannicini@sutd.edu.sg // based on CglRedSplit by Francois Margot // Date: 03/09/09 //----------------------------------------------------------------------------- // Copyright (C) 2010, Giacomo Nannicini and others. All Rights Reserved. #ifndef CglRedSplit2_H #define CglRedSplit2_H #include "CglCutGenerator.hpp" #include "CglRedSplit2Param.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" /** Reduce-and-Split Cut Generator Class; See method generateCuts(). Based on the papers "Practical strategies for generating rank-1 split cuts in mixed-integer linear programming" by G. Cornuejols and G. Nannicini, published on Mathematical Programming Computation, and "Combining Lift-and-Project and Reduce-and-Split" by E. Balas, G. Cornuejols, T. Kis and G. Nannicini, published on INFORMS Journal on Computing. Part of this code is based on CglRedSplit by F. Margot. */ class CglRedSplit2 : public CglCutGenerator { friend void CglRedSplit2UnitTest(const OsiSolverInterface * siP, const std::string mpdDir); public: /**@name generateCuts */ //@{ /** Generate Reduce-and-Split Mixed Integer Gomory cuts for the model of the solver interface si. Insert the generated cuts into OsiCuts cs. This generator currently works only with the Lp solvers Clp or Cplex9.0 or higher. It requires access to the optimal tableau and optimal basis inverse and makes assumptions on the way slack variables are added by the solver. The Osi implementations for Clp and Cplex verify these assumptions. When calling the generator, the solver interface si must contain an optimized problem and information related to the optimal basis must be available through the OsiSolverInterface methods (si->optimalBasisIsAvailable() must return 'true'). It is also essential that the integrality of structural variable i can be obtained using si->isInteger(i). Reduce-and-Split cuts are a class of split cuts. We compute linear combinations of the rows of the simplex tableau, trying to reduce some of the coefficients on the nonbasic continuous columns. We have a large number of heuristics to choose which coefficients should be reduced, and by using which rows. The paper explains everything in detail. Note that this generator can potentially generate a huge number of cuts, depending on how it is parametered. Default parameters should be good for most situations; if you want to go heavy on split cuts, use more row selection strategies or a different number of rows in the linear combinations. Again, look at the paper for details. If you want to generate a small number of cuts, default parameters are not the best choice. A combination of Reduce-and-Split with Lift & Project is described in the paper "Combining Lift-and-Project and Reduce-and-Split". The Reduce-and-Split code for the implementation used in that paper is included here. This generator does not generate the same cuts as CglRedSplit, therefore both generators can be used in conjunction. */ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /// Return true if needs optimal basis to do cuts (will return true) virtual bool needsOptimalBasis() const; // Generate the row multipliers computed by Reduce-and-Split from the // given OsiSolverInterface. The multipliers are written in lambda; // lambda should be of size nrow*maxNumMultipliers. We generate at most // maxNumMultipliers m-vectors of row multipliers, and return the number // of m-vectors that were generated. // If the caller wants to know which variables are basic in each row // (same order as lambda), basicVariables should be non-NULL (size nrow). // This method can also generate the cuts corresponding to the multipliers // returned; it suffices to pass non-NULL OsiCuts. // This method is not needed by the typical user; however, it is useful // in the context of generating Lift & Project cuts. int generateMultipliers(const OsiSolverInterface& si, int* lambda, int maxNumMultipliers, int* basicVariables = NULL, OsiCuts* cs = NULL); // Try to improve a Lift & Project cut, by employing the // Reduce-and-Split procedure. We start from a row of a L&P tableau, // and generate a cut trying to reduce the coefficients on the // nonbasic variables. Note that this L&P tableau will in general // have nonbasic variables which are nonzero in the point that we // want to cut off, so we should be careful. Arguments: // OsiSolverInterface which contains the simplex tableau, initial // row from which the cut is derived, row rhs, row number of the // source row (if it is in the simplex tableau; otherwise, a // negative number; needed to avoid using duplicate rows), point // that we want to cut off (note: this is NOT a basic solution for // the OsiSolverInterace!), list of variables which are basic in // xbar but are nonbasic in the OsiSolverInterface. The computed cut // is written in OsiRowCut* cs. Finally, if a starting disjunction // is provided in the vector lambda (of size ncols, i.e. a // disjunction on the structural variables), the disjunction is // modified according to the cut which is produced. int tiltLandPcut(const OsiSolverInterface* si, double* row, double rowRhs, int rownumber, const double* xbar, const int* newnonbasics, OsiRowCut* cs, int* lambda = NULL); //@} /**@name Public Methods */ //@{ // Set the parameters to the values of the given CglRedSplit2Param object. void setParam(const CglRedSplit2Param &source); // Return the CglRedSplit2Param object of the generator. inline CglRedSplit2Param& getParam() {return param;} /// Print some of the data members; used for debugging void print() const; /// Print the current simplex tableau void printOptTab(OsiSolverInterface *solver) const; //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglRedSplit2(); /// Constructor with specified parameters CglRedSplit2(const CglRedSplit2Param &RS_param); /// Copy constructor CglRedSplit2(const CglRedSplit2 &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglRedSplit2 & operator=(const CglRedSplit2& rhs); /// Destructor virtual ~CglRedSplit2 (); //@} private: // Private member methods /**@name Private member methods */ //@{ // Method generating the cuts after all CglRedSplit2 members are // properly set. This does the actual work. Returns the number of // generated cuts (or multipliers). // Will generate cuts if cs != NULL, and will generate multipliers // if lambda != NULL. int generateCuts(OsiCuts* cs, int maxNumCuts, int* lambda = NULL); /// Compute the fractional part of value, allowing for small error. inline double rs_above_integer(const double value) const; /// Fill workNonBasicTab, depending on the column selection strategy. /// Accepts a list of variables indices that should be ignored; by /// default, this list is empty (it is only used by Lift & Project). /// The list ignore_list contains -1 as the last element. /// Note that the implementation of the ignore_list is not very efficient /// if the list is long, so it should be used only if its short. void fill_workNonBasicTab(CglRedSplit2Param::ColumnSelectionStrategy strategy, const int* ignore_list = NULL); /// Fill workNonBasicTab, alternate version for Lift & Project: also /// reduces columns which are now nonbasic but are basic in xbar. /// This function should be called only when CglRedSplit2 is used in /// conjunction with CglLandP to generate L&P+RS cuts. void fill_workNonBasicTab(const int* newnonbasics, const double* xbar, CglRedSplit2Param::ColumnScalingStrategy scaling); /// Reduce rows of workNonBasicTab, i.e. compute integral linear /// combinations of the rows in order to reduce row coefficients on /// workNonBasicTab void reduce_workNonBasicTab(int numRows, CglRedSplit2Param::RowSelectionStrategy rowSelectionStrategy, int maxIterations); /// Generate a linear combination of the rows of the current LP /// tableau, using the row multipliers stored in the matrix pi_mat /// on the row of index index_row void generate_row(int index_row, double *row); /// Generate a mixed integer Gomory cut, when all non basic /// variables are non negative and at their lower bound. int generate_cgcut(double *row, double *rhs); /// Use multiples of the initial inequalities to cancel out the coefficients /// of the slack variables. void eliminate_slacks(double *row, const double *elements, const int *start, const int *indices, const int *rowLength, const double *rhs, double *rowrhs); /// Change the sign of the coefficients of the continuous non basic /// variables at their upper bound. void flip(double *row); /// Change the sign of the coefficients of the continuous non basic /// variables at their upper bound and do the translations restoring /// the original bounds. Modify the right hand side /// accordingly. void unflip(double *row, double *rowrhs); /// Returns 1 if the row has acceptable max/min coeff ratio. /// Compute max_coeff: maximum absolute value of the coefficients. /// Compute min_coeff: minimum absolute value of the coefficients /// larger than EPS_COEFF. /// Return 0 if max_coeff/min_coeff > MAXDYN. int check_dynamism(double *row); /// Generate the packed cut from the row representation. int generate_packed_row(const double *xlp, double *row, int *rowind, double *rowelem, int *card_row, double & rhs); // Compute entries of is_integer. void compute_is_integer(); // Check that two vectors are different. bool rs_are_different_vectors(const int *vect1, const int *vect2, const int dim); // allocate matrix of integers void rs_allocmatINT(int ***v, int m, int n); // deallocate matrix of integers void rs_deallocmatINT(int ***v, int m); // allocate matrix of doubles void rs_allocmatDBL(double ***v, int m, int n); // deallocate matrix of doubles void rs_deallocmatDBL(double ***v, int m); // print a vector of integers void rs_printvecINT(const char *vecstr, const int *x, int n) const; // print a vector of doubles void rs_printvecDBL(const char *vecstr, const double *x, int n) const; // print a matrix of integers void rs_printmatINT(const char *vecstr, const int * const *x, int m, int n) const; // print a matrix of doubles void rs_printmatDBL(const char *vecstr, const double * const *x, int m, int n) const; // dot product double rs_dotProd(const double *u, const double *v, int dim) const; double rs_dotProd(const int *u, const double *v, int dim) const; // From Numerical Recipes in C: LU decomposition int ludcmp(double **a, int n, int *indx, double *d, double* vv) const; // from Numerical Recipes in C: backward substitution void lubksb(double **a, int n, int *indx, double *b) const; // Check if the linear combination given by listOfRows with given multipliers // improves the norm of row #rowindex; note: multipliers are rounded! // Returns the difference with respect to the old norm (if negative there is // an improvement, if positive norm increases) double compute_norm_change(double oldnorm, const int* listOfRows, int numElemList, const double* multipliers) const; // Compute the list of rows that should be used to reduce row #rowIndex int get_list_rows_reduction(int rowIndex, int numRowsReduction, int* list, const double* norm, CglRedSplit2Param::RowSelectionStrategy rowSelectionStrategy) const; // Sorts the rows by increasing number of nonzeroes with respect to a given // row (rowIndex), on the nonbasic variables (whichTab == 0 means only // integer, whichTab == 1 means only workTab, whichTab == 2 means both). // The array for sorting must be allocated (and deleted) by caller. // Corresponds to BRS1 in the paper. int sort_rows_by_nonzeroes(struct sortElement* array, int rowIndex, int maxRows, int whichTab) const; // Greedy variant of the previous function; slower but typically // more effective. Corresponds to BRS2 in the paper. int sort_rows_by_nonzeroes_greedy(struct sortElement* array, int rowIndex, int maxRows, int whichTab) const; // Sorts the rows by decreasing absolute value of the cosine of the // angle with respect to a given row (rowIndex), on the nonbasic // variables (whichTab == 0 means only integer, whichTab == 1 means // only workTab, whichTab == 2 means both). The array for sorting // must be allocated (and deleted) by caller. Very effective // strategy in practice. Corresponds to BRS3 in the paper. int sort_rows_by_cosine(struct sortElement* array, int rowIndex, int maxRows, int whichTab) const; // Did we hit the time limit? inline bool checkTime() const{ if ((CoinCpuTime() - startTime) < param.getTimeLimit()){ return true; } return false; } //@} // Private member data /**@name Private member data */ //@{ /// Object with CglRedSplit2Param members. CglRedSplit2Param param; /// Number of rows ( = number of slack variables) in the current LP. int nrow; /// Number of structural variables in the current LP. int ncol; /// Number of rows which have been reduced int numRedRows; /// Lower bounds for structural variables const double *colLower; /// Upper bounds for structural variables const double *colUpper; /// Lower bounds for constraints const double *rowLower; /// Upper bounds for constraints const double *rowUpper; /// Righ hand side for constraints (upper bound for ranged constraints). const double *rowRhs; /// Reduced costs for columns const double *reducedCost; /// Row price const double *rowPrice; /// Objective coefficients const double* objective; /// Number of integer basic structural variables int card_intBasicVar; /// Number of integer basic structural variables that are fractional in the /// current lp solution (at least param.away_ from being integer). int card_intBasicVar_frac; /// Number of integer non basic structural variables in the /// current lp solution. int card_intNonBasicVar; /// Number of continuous non basic variables (structural or slack) in the /// current lp solution. int card_contNonBasicVar; /// Number of continuous non basic variables (structural or slack) in the /// current working set for coefficient reduction int card_workNonBasicVar; /// Number of non basic variables (structural or slack) at their /// upper bound in the current lp solution. int card_nonBasicAtUpper; /// Number of non basic variables (structural or slack) at their /// lower bound in the current lp solution. int card_nonBasicAtLower; /// Characteristic vector for integer basic structural variables int *cv_intBasicVar; /// Characteristic vector for integer basic structural variables /// with non integer value in the current lp solution. int *cv_intBasicVar_frac; /// Characteristic vector for rows of the tableau selected for reduction /// with non integer value in the current lp solution int *cv_fracRowsTab; /// List of integer structural basic variables /// (in order of pivot in selected rows for cut generation). int *intBasicVar; /// List of integer structural basic variables with fractional value /// (in order of pivot in selected rows for cut generation). int *intBasicVar_frac; /// List of integer structural non basic variables. int *intNonBasicVar; /// List of continuous non basic variables (structural or slack). // slacks are considered continuous (no harm if this is not the case). int *contNonBasicVar; /// List of non basic variables (structural or slack) at their /// upper bound. int *nonBasicAtUpper; /// List of non basic variables (structural or slack) at their lower /// bound. int *nonBasicAtLower; /// Number of rows in the reduced tableau (= card_intBasicVar). int mTab; /// Number of columns in the reduced tableau (= card_contNonBasicVar) int nTab; /// Tableau of multipliers used to alter the rows used in generation. /// Dimensions: mTab by mTab. Initially, pi_mat is the identity matrix. int **pi_mat; /// Simplex tableau for continuous non basic variables (structural or slack). /// Only rows used for generation. /// Dimensions: mTab by card_contNonBasicVar. double **contNonBasicTab; /// Current tableau for continuous non basic variables (structural or slack). /// Only columns used for coefficient reduction. /// Dimensions: mTab by card_workNonBasicVar. double **workNonBasicTab; /// Simplex tableau for integer non basic structural variables. /// Only rows used for generation. // Dimensions: mTab by card_intNonBasicVar. double **intNonBasicTab; /// Right hand side of the tableau. /// Only rows used for generation. double *rhsTab; /// Norm of rows in workNonBasicTab; needed for faster computations double *norm; /// Characteristic vectors of structural integer variables or continuous /// variables currently fixed to integer values. int *is_integer; /// Pointer on solver. Reset by each call to generateCuts(). OsiSolverInterface *solver; /// Pointer on point to separate. Reset by each call to generateCuts(). const double *xlp; /// Pointer on row activity. Reset by each call to generateCuts(). const double *rowActivity; /// Pointer on matrix of coefficient ordered by rows. /// Reset by each call to generateCuts(). const CoinPackedMatrix *byRow; /// Time at which cut computations began. /// Reset by each call to generateCuts(). double startTime; //@} }; //############################################################################# /** A function that tests some of the methods in the CglRedSplit2 class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CglRedSplit2UnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); #endif CoinMP-1.8.3/Cgl/src/CglRedSplit2/CglRedSplit2.cpp0000644000175000017500000025341612130104031020004 0ustar renerene// Last edit: 04/03/10 // // Name: CglRedSplit2.cpp // Author: Giacomo Nannicini // Singapore University of Technology and Design // Singapore // email: nannicini@sutd.edu.sg // based on CglRedSplit by Francois Margot // Date: 03/09/09 //----------------------------------------------------------------------------- // Copyright (C) 2010, Giacomo Nannicini and others. All Rights Reserved. #include #include #include #include #include #include #include /* Debug output */ //#define RS2_TRACE /* Print optimal tableau and basis */ //#define RS2_TRACETAB /* Use LAPACK instead of own code for solving linear systems */ //#define RS2_USE_LAPACK // Sparse for intNonBasic 0,1,2 #define RS_FAST_INT 2 // Sparse for contNonBasic 0,1,2 #define RS_FAST_CONT 2 // Sparse for workNonBasic 0,1,2 #define RS_FAST_WORK 2 #include "CoinPragma.hpp" #include "OsiSolverInterface.hpp" #include "CglRedSplit2.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "OsiRowCutDebugger.hpp" #include "CoinFactorization.hpp" #include "CoinFinite.hpp" #define TINY 1e-20 #define rs2round(x) (floor((x)+0.5)) //------------------------------------------------------------------- // Generate Reduce-and-Split cuts //------------------------------------------------------------------- #ifdef RS2_USE_LAPACK extern "C" void dgesv_( const int * , const int * , double * , const int * , int * , double * , const int * , int * ); #endif /***************************************************************************/ // Utility functions and definitions for sorting struct sortElement{ int index; double cost; }; // Return -1 if firstE has lower cost or same cost but lower index int rs2_compareElements(const void* firstE, const void* secondE){ const struct sortElement* a = static_cast(firstE); const struct sortElement* b = static_cast(secondE); if (a->cost < b->cost) return -1; else if (a->cost > b->cost) return 1; else if (a->index < b->index) return -1; else if (a->index > b->index) return 1; return 0; } /***************************************************************************/ // Returns (value - floor) but allowing for small errors; // taken from the CglGomory cut generator inline double CglRedSplit2::rs_above_integer(const double value) const { double value2=floor(value); double value3=rs2round(value); if (fabs(value3-value)< param.getEPS() * (fabs(value3)+1.0)) return 0.0; return value-value2; } /* rs_above_integer */ /**********************************************************/ void CglRedSplit2::rs_allocmatINT(int ***v, int m, int n) { *v = reinterpret_cast (calloc (m, sizeof(int *))); if (*v == NULL) { printf("###ERROR: INTEGER matrix allocation failed\n"); exit(1); } for (int i = 0; i < m; ++i) { (*v)[i] = reinterpret_cast (calloc (n, sizeof(int))); if ((*v)[i] == NULL) { printf("###ERROR: INTEGER matrix allocation failed\n"); exit(1); } } } /* rs_allocmatINT */ /**********************************************************/ void CglRedSplit2::rs_deallocmatINT(int ***v, int m) { for (int i = 0; i < m; ++i) { free(reinterpret_cast ((*v)[i])); } free(reinterpret_cast (*v)); } /* rs_deallocmatINT */ /**********************************************************/ void CglRedSplit2::rs_allocmatDBL(double ***v, int m, int n) { *v = reinterpret_cast (calloc (m, sizeof(double *))); if (*v == NULL) { printf("###ERROR: DOUBLE matrix allocation failed\n"); exit(1); } for (int i = 0; i < m; ++i){ (*v)[i] = reinterpret_cast (calloc (n, sizeof(double))); if ((*v)[i] == NULL) { printf("###ERROR: DOUBLE matrix allocation failed\n"); exit(1); } } } /* rs_allocmatDBL */ /**********************************************************/ void CglRedSplit2::rs_deallocmatDBL(double ***v, int m) { for (int i = 0; i < m; ++i){ free(reinterpret_cast ((*v)[i])); } free(reinterpret_cast (*v)); } /* rs_deallocmatDBL */ /**********************************************************/ void CglRedSplit2::rs_printvecINT(const char *vecstr, const int *x, int n) const { int num, fromto, upto, j, i; num = (n/10) + 1; printf("%s :\n", vecstr); for(j=0; j big) { big = temp; } } if (big == 0.0) { return false; } vv[i-1]=1.0/big; } for (j = 1; j <= n; ++j){ for (i=1;i= big) { big = dum; imax = i; } } if (j != imax) { for (k=1;k<=n;k++) { dum=a[imax-1][k-1]; a[imax-1][k-1]=a[j-1][k-1]; a[j-1][k-1]=dum; } *d = -(*d); vv[imax-1]=vv[j-1]; } indx[j-1]=imax; if (a[j-1][j-1] == 0.0) a[j-1][j-1]=TINY; if (j != n) { dum=1.0/(a[j-1][j-1]); for (i=j+1;i<=n;i++) a[i-1][j-1] *= dum; } } return ret; } /***************************************************************************/ // from Numerical Recipes in C: backward substitution void CglRedSplit2::lubksb(double **a, int n, int *indx, double *b) const { int i,ii=0,ip,j; double sum; for (i = 1; i <= n; ++i){ ip=indx[i-1]; sum=b[ip-1]; b[ip-1]=b[i-1]; if (ii) for (j=ii;j<=i-1;j++) sum -= a[i-1][j-1]*b[j-1]; else if (sum) ii=i; b[i-1]=sum; } for (i=n;i>=1;i--) { sum=b[i-1]; for (j=i+1;j<=n;j++) sum -= a[i-1][j-1]*b[j-1]; b[i-1]=sum/a[i-1][i-1]; } } /***************************************************************************/ double CglRedSplit2::compute_norm_change(double oldnorm, const int* list, int numElemList, const double* multipliers) const { double newnorm = 0; double accumulator; for (int j = 0; j < nTab; ++j){ accumulator = 0; for (int i = 0; i < numElemList; ++i){ accumulator += multipliers[i]*workNonBasicTab[list[i]][j]; } newnorm += accumulator*accumulator; } return (newnorm-oldnorm); } /***************************************************************************/ int CglRedSplit2::sort_rows_by_nonzeroes(struct sortElement* array, int rowIndex, int maxRows, int whichTab) const { // Note: this function only takes into account rows which share at least // a nonzero column with the row that we want to reduce (rowIndex). int counter = 0; int numZeroCost = 0; for (int i = 0; i < mTab; ++i){ if (!checkTime()){ break; } if (numZeroCost == maxRows){ // We found enough rows with cost equal to zero, i.e. "perfect" rows // No need to continue! counter = numZeroCost; break; } if ((i != rowIndex) && (norm[i] > param.getNormIsZero())){ // sort rows by number of nonzeros on nonbasic columns. // check if they have at least one nonzero in the same place, // otherwise skip bool match = false; for (int j = 0; j < nTab; ++j){ if ((fabs(workNonBasicTab[rowIndex][j]) > param.getEPS_COEFF()) && (fabs(workNonBasicTab[i][j]) > param.getEPS_COEFF())){ match = true; break; } } if (!match) continue; array[counter].index = i; array[counter].cost = 0; // whichTab = 0 means only intNonBasicTab, 1 means only // workNonBasicTab, 2 means both if (whichTab == 0 || whichTab == 2){ for (int j = 0; j < card_intNonBasicVar; ++j){ if ((fabs(intNonBasicTab[rowIndex][j]) <= param.getEPS_COEFF()) && (fabs(intNonBasicTab[i][j]) > param.getEPS_COEFF())){ array[counter].cost += 1; } } } if (whichTab == 1 || whichTab == 2){ for (int j = 0; j < nTab; ++j){ if ((fabs(workNonBasicTab[rowIndex][j]) <= param.getEPS_COEFF()) && (fabs(workNonBasicTab[i][j]) > param.getEPS_COEFF())){ array[counter].cost += 1; } } } if (array[counter].cost == 0){ array[counter] = array[numZeroCost]; array[numZeroCost].index = i; array[numZeroCost].cost = 0; numZeroCost++; } counter++; } } if (counter > maxRows){ qsort(array, counter, sizeof(struct sortElement), rs2_compareElements); } return counter; } /***************************************************************************/ int CglRedSplit2::sort_rows_by_nonzeroes_greedy(struct sortElement* array, int rowIndex, int maxRows, int whichTab) const{ int counter = 0; counter = sort_rows_by_nonzeroes(array, rowIndex, maxRows, whichTab); if (counter > maxRows){ int i, j; // vector of positions of zero elements int* z_int = NULL; int* z_cont = NULL; // whichTab = 0 means only intNonBasicTab, 1 means only // workNonBasicTab, 2 means both if (whichTab == 0 || whichTab == 2) z_int = new int[card_intNonBasicVar]; if (whichTab == 1 || whichTab == 2) z_cont = new int[nTab]; // number of elements in the vectors above int numz_int = 0; int numz_cont = 0; // compute initial vector of nonzeroes if (whichTab == 0 || whichTab == 2){ for (j = 0; j < card_intNonBasicVar; ++j){ if (fabs(intNonBasicTab[rowIndex][j]) <= param.getEPS_COEFF()){ z_int[numz_int++] = j; } } } if (whichTab == 1 || whichTab == 2){ for (j = 0; j < nTab; ++j){ if (fabs(workNonBasicTab[rowIndex][j]) <= param.getEPS_COEFF()){ z_cont[numz_cont++] = j; } } } int numSorted = counter; counter = 1; // store the minimum number of nz introduced by one row int minNz; // and the position of that row int rowMinNz; // maximum number of nonzero that can be introduced double maxNz; int currentNz; while (counter < maxRows && counter < numSorted){ if (!checkTime()){ break; } // initialize minNz to a large value minNz = numz_int + numz_cont;; maxNz = array[counter].cost + array[counter-1].cost; rowMinNz = counter; for (i = counter; i < numSorted && array[i].cost < maxNz; ++i){ int ii = array[i].index; // pick the row which introduces the smallest // number of nonzeros on the nonbasic integer columns currentNz = 0; for (j = 0; j < numz_int; ++j){ if ((fabs(intNonBasicTab[ii][z_int[j]]) > param.getEPS_COEFF())){ currentNz++; } } for (j = 0; j < numz_cont; ++j){ if ((fabs(workNonBasicTab[ii][z_cont[j]]) > param.getEPS_COEFF())){ currentNz++; } } array[i].cost = currentNz; if (currentNz < minNz){ rowMinNz = i; minNz = currentNz; } if (currentNz == 0){ // perfect matching, no need to look further break; } } // update introduced nonzeroes by the selected row; // first, put the row in the correct position in the array int swap1 = array[rowMinNz].index; double swap2 = array[rowMinNz].cost; array[rowMinNz] = array[counter]; array[counter].index = swap1; array[counter].cost = swap2; // now count how many nonzeroes were introduces, and update // the vectors z_int and z_cont accordingly for (j = 0; j < numz_int; ++j){ if (fabs(intNonBasicTab[swap1][z_int[j]]) > param.getEPS_COEFF()){ z_int[j] = z_int[numz_int-1]; numz_int--; } } for (j = 0; j < numz_cont; ++j){ if (fabs(workNonBasicTab[swap1][z_cont[j]]) > param.getEPS_COEFF()){ z_cont[j] = z_cont[numz_cont-1]; numz_cont--; } } counter++; } if (z_int) delete[] z_int; if (z_cont) delete[] z_cont; } return counter; } /***************************************************************************/ int CglRedSplit2::sort_rows_by_cosine(struct sortElement* array, int rowIndex, int maxRows, int whichTab) const { // whichTab == 0 means only integer nonbasic variables, whichTab == // 1 means only workTab, whichTab == 2 means both int counter = 0; double initnorm = 0.0; if (whichTab == 0 || whichTab == 2){ #if RS_FAST_INT == 0 initnorm += rs_dotProd(intNonBasicTab[rowIndex], intNonBasicTab[rowIndex], card_intNonBasicVar); #elif RS_FAST_INT == 1 initnorm += rs_dotProd(intNonBasicTab[rowIndex], intNonBasicTab[rowIndex], card_intNonBasicVar); double value = rs_sparseDotProd(intNonBasicTab[rowIndex], intNonBasicTab[rowIndex], pi_mat[rowIndex]+mTab, pi_mat[rowIndex]+mTab); assert (value==initnorm); #else initnorm = rs_sparseDotProd(intNonBasicTab[rowIndex], intNonBasicTab[rowIndex], pi_mat[rowIndex]+mTab, pi_mat[rowIndex]+mTab); #endif } if (whichTab == 1 || whichTab == 2){ initnorm += norm[rowIndex]; } #if RS_FAST_WORK int workOffset = mTab+card_intNonBasicVar+card_contNonBasicVar+2; #endif for (int i = 0; i < mTab; ++i){ if ((i != rowIndex) && (norm[i] > param.getNormIsZero())){ if (!checkTime()){ break; } array[counter].index = i; array[counter].cost = 0; if (whichTab == 0 || whichTab == 2){ #if RS_FAST_INT == 0 array[counter].cost -= fabs(rs_dotProd(intNonBasicTab[rowIndex], intNonBasicTab[i], card_intNonBasicVar)); #elif RS_FAST == 1 array[counter].cost -= fabs(rs_dotProd(intNonBasicTab[rowIndex], intNonBasicTab[i], card_intNonBasicVar)); double value = -fabs(rs_sparseDotProd(intNonBasicTab[rowIndex], intNonBasicTab[i], pi_mat[rowIndex]+mTab, pi_mat[i]+mTab)); assert (value==array[counter].cost); #else array[counter].cost = -fabs(rs_sparseDotProd(intNonBasicTab[rowIndex], intNonBasicTab[i], pi_mat[rowIndex]+mTab, pi_mat[i]+mTab)); #endif } if (whichTab == 1 || whichTab == 2){ #if RS_FAST_WORK == 0 array[counter].cost -= fabs(rs_dotProd(workNonBasicTab[rowIndex], workNonBasicTab[i], nTab)); #elif RS_FAST_WORK == 1 double value = array[counter].cost; array[counter].cost -= fabs(rs_dotProd(workNonBasicTab[rowIndex], workNonBasicTab[i], nTab)); value -= fabs(rs_sparseDotProd(workNonBasicTab[rowIndex], workNonBasicTab[i], pi_mat[rowIndex]+workOffset, pi_mat[i]+workOffset)); assert (value==array[counter].cost); #else array[counter].cost -= fabs(rs_sparseDotProd(workNonBasicTab[rowIndex], workNonBasicTab[i], pi_mat[rowIndex]+workOffset, pi_mat[i]+workOffset)); #endif } // Now divide by the two norms double denom = 0.0; if (whichTab == 0 || whichTab == 2){ #if RS_FAST_INT == 0 denom += initnorm*rs_dotProd(intNonBasicTab[i], intNonBasicTab[i], card_intNonBasicVar); #elif RS_FAST == 1 denom += initnorm*rs_dotProd(intNonBasicTab[i], intNonBasicTab[i], card_intNonBasicVar); double value = initnorm*rs_sparseDotProd(intNonBasicTab[i], intNonBasicTab[i], pi_mat[i]+mTab, pi_mat[i]+mTab); assert (value==denom); #else denom = initnorm*rs_sparseDotProd(intNonBasicTab[i], intNonBasicTab[i], pi_mat[i]+mTab, pi_mat[i]+mTab); #endif } if (whichTab == 1 || whichTab == 2){ denom += initnorm*norm[i]; } array[counter].cost /= sqrt(denom); if (array[counter].cost != 0.0){ counter++; } } } if (counter >= maxRows){ qsort(array, counter, sizeof(struct sortElement), rs2_compareElements); } return counter; } /***************************************************************************/ int CglRedSplit2::get_list_rows_reduction(int rowIndex, int maxRowsReduction, int* list, const double* norm, CglRedSplit2Param::RowSelectionStrategy selectionStrategy) const{ #ifdef RS2_TRACE printf("Obtaining list of rows with column strategy %d\n", selectionStrategy); #endif struct sortElement* array = new struct sortElement[mTab]; int counter = 0; int i, j; // Look in CglRedSplit2Param for a description of each strategy if (selectionStrategy == CglRedSplit2Param::RS1){ counter = sort_rows_by_nonzeroes(array, rowIndex, maxRowsReduction-1, 0); } else if (selectionStrategy == CglRedSplit2Param::RS2){ counter = sort_rows_by_nonzeroes(array, rowIndex, maxRowsReduction-1, 1); } else if (selectionStrategy == CglRedSplit2Param::RS3){ counter = sort_rows_by_nonzeroes(array, rowIndex, maxRowsReduction-1, 2); } else if (selectionStrategy == CglRedSplit2Param::RS4){ // compute the *true* number of nonzeroes that we introduce // on the integer nonbasics counter = sort_rows_by_nonzeroes_greedy(array, rowIndex, maxRowsReduction-1, 0); } else if (selectionStrategy == CglRedSplit2Param::RS5){ // compute the *true* number of nonzeroes that we introduce // on the working set (continuous nonbasics) counter = sort_rows_by_nonzeroes_greedy(array, rowIndex, maxRowsReduction-1, 1); } else if (selectionStrategy == CglRedSplit2Param::RS6){ // compute the *true* number of nonzeroes that we introduce // on all the nonbasics: intNonBasicVar and workNonBasicVar counter = sort_rows_by_nonzeroes_greedy(array, rowIndex, maxRowsReduction-1, 2); } else if (selectionStrategy == CglRedSplit2Param::RS7){ // sort rows by cosine of the angle in the space of the nonbasic integer // and nonbasic continuous (working set) columns, wrt row rowIndex counter = sort_rows_by_cosine(array, rowIndex, maxRowsReduction-1, 2); } else if (selectionStrategy == CglRedSplit2Param::RS8){ // sort rows by cosine of the angle in the space of the // nonbasic continuous (working set) columns, wrt row rowIndex counter = sort_rows_by_cosine(array, rowIndex, maxRowsReduction-1, 1); } list[0] = rowIndex; j = 1; for (i = 0; i < counter && j < maxRowsReduction; ++i){ list[j] = array[i].index; j++; } delete[] array; return j; } /***************************************************************************/ void CglRedSplit2::fill_workNonBasicTab(CglRedSplit2Param::ColumnSelectionStrategy strategy, const int* ignore_list){ // Sort continuous non basic variables by reduced cost and choose the // columns we will work with. // We can choose among several strategies; these are described in // CglRedSplit2Param.hpp. int i, j; if (strategy == CglRedSplit2Param::CS_ALLCONT){ // select all continuous nonbasic columns for (i = 0; i < mTab; ++i){ memcpy(workNonBasicTab[i], contNonBasicTab[i], card_contNonBasicVar*sizeof(double)); } nTab = card_contNonBasicVar; } else{ // Begin by sorting all continuous nonbasic columns by increasing // reduced cost (except those in the ingore_list) struct sortElement* array = new struct sortElement[card_contNonBasicVar]; int pos = 0, iter = 0; for (i = 0; i < card_contNonBasicVar; ++i){ if (ignore_list != NULL){ iter = 0; while (ignore_list[iter] >= 0 && ignore_list[iter] != contNonBasicVar[i]){ iter++; } if (ignore_list[iter] == contNonBasicVar[i]){ continue; } } array[pos].index = i; // We take absolute value of reduced costs because sign could be // positive or negative depending on minimization/maximization, // and which bound the variable is at (upper/lower). if (contNonBasicVar[i] < ncol) array[pos].cost = fabs(reducedCost[contNonBasicVar[i]]); else array[pos].cost = fabs(rowPrice[contNonBasicVar[i]-ncol]); pos++; } qsort(array,pos,sizeof(struct sortElement),rs2_compareElements); nTab = 0; int card_contNonBasicVar = pos; // Now choose the variables. These strategies are described in // CglRedSplit2Param.hpp. // CS1, CS2 and CS3 are the 3 partitions of C-3P: each one // contains one third of the variables, sorted by reduced costs if (strategy == CglRedSplit2Param::CS1){ for (i = 0; i < card_contNonBasicVar/3; ++i){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } else if (strategy == CglRedSplit2Param::CS2){ for (i = card_contNonBasicVar/3; i < 2*card_contNonBasicVar/3; ++i){ if (!checkTime()){ break; } for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } else if (strategy == CglRedSplit2Param::CS3){ for (i = 2*card_contNonBasicVar/3; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } // CS4, CS5, CS6, CS7 and CS8 are the 5 partitions of C-5P; each // one contains 1/5 of the variables, sorted by increasing reduced // cost: first set has smallest reduced costs, and so on. else if (strategy == CglRedSplit2Param::CS4){ for (i = 0; i < card_contNonBasicVar/5; ++i){ if (!checkTime()){ break; } for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } else if (strategy == CglRedSplit2Param::CS5){ for (i = card_contNonBasicVar/5; i < 2*card_contNonBasicVar/5; ++i){ if (!checkTime()){ break; } for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } else if (strategy == CglRedSplit2Param::CS6){ for (i = 2*card_contNonBasicVar/5; i < 3*card_contNonBasicVar/5; ++i){ if (!checkTime()){ break; } for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } else if (strategy == CglRedSplit2Param::CS7){ for (i = 3*card_contNonBasicVar/5; i < 4*card_contNonBasicVar/5; ++i){ if (!checkTime()){ break; } for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } else if (strategy == CglRedSplit2Param::CS8){ for (i = 4*card_contNonBasicVar/5; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } // CS9 and CS10 are the 2 partitions of I-2P-2/3; this is a // partition with interleaving pattern XX--X- on the 2/3 of the // variables with smallest reduced cost else if (strategy == CglRedSplit2Param::CS9){ int pat; for (i = 0; i < 2*card_contNonBasicVar/3; ++i){ if (!checkTime()){ break; } pat = i%6; if (pat == 0 || pat == 1 || pat == 4){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } else if (strategy == CglRedSplit2Param::CS10){ int pat; for (i = 0; i < 2*card_contNonBasicVar/3; ++i){ if (!checkTime()){ break; } pat = i%6; if (pat == 2 || pat == 3 || pat == 5){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } // CS11 and CS12 are the 2 partitions of I-2P-4/5; partition with // interleaving pattern X---XXX- on 4/5 of the vars with smallest // reduced cost else if (strategy == CglRedSplit2Param::CS11){ int pat; for (i = 0; i < 4*card_contNonBasicVar/5; ++i){ if (!checkTime()){ break; } pat = i%8; if (pat == 0 || pat == 4 || pat == 5 || pat == 6){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } else if (strategy == CglRedSplit2Param::CS12){ int pat; for (i = 0; i < 4*card_contNonBasicVar/5; ++i){ if (!checkTime()){ break; } pat = i%8; if (pat == 1 || pat == 2 || pat == 3 || pat == 7){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } // CS13, and CS14 are the 2 partitions of I-2P-1/2; interleaving // partition with pattern X--X on 1/2 of the variables else if (strategy == CglRedSplit2Param::CS13){ for (i = 0; i < card_contNonBasicVar/2; ++i){ if (!checkTime()){ break; } if (i%4 == 0 || i%4 == 3){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } else if (strategy == CglRedSplit2Param::CS14){ for (i = 0; i < card_contNonBasicVar/2; ++i){ if (!checkTime()){ break; } if (i%4 == 1 || i%4 == 2){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } // CS15, CS16 and CS17 are the 3 partitions of I-3P; interleaving // partition with pattern X-/ on all the variables else if (strategy == CglRedSplit2Param::CS15){ for (i = 0; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } if (i%3 == 0){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } else if (strategy == CglRedSplit2Param::CS16){ for (i = 0; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } if (i%3 == 1){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } else if (strategy == CglRedSplit2Param::CS17){ for (i = 0; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } if (i%3 == 2){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } // CS18, CS19, CS20, CS21 are the 4 partitions of I-4P; // interleaving partition with pattern X-X/\\-/ on all the // variables else if (strategy == CglRedSplit2Param::CS18){ int pat; for (i = 0; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } pat = i%8; if (pat == 0 || pat == 2){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } else if (strategy == CglRedSplit2Param::CS19){ int pat; for (i = 0; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } pat = i%8; if (pat == 1 || pat == 6){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } else if (strategy == CglRedSplit2Param::CS20){ int pat; for (i = 0; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } pat = i%8; if (pat == 3 || pat == 7){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } else if (strategy == CglRedSplit2Param::CS21){ int pat; for (i = 0; i < card_contNonBasicVar; ++i){ if (!checkTime()){ break; } pat = i%8; if (pat == 4 || pat == 5){ for (j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = contNonBasicTab[j][array[i].index]; } nTab++; } } } delete[] array; } // create sparse work stuff for(i=0; i param.getNormIsZero()) { // Obtain the list of rows that should be used to reduce row k numUsedRows = get_list_rows_reduction(k, maxRowsReduction, list, norm, rowSelectionStrategy); #ifdef RS2_TRACE rs_printvecINT("rows used for reduction", list, numUsedRows); #endif if (numUsedRows <= 1){ // This means that the list only contains the current row; // Thus, no rows were selected for reduction. Skip. continue; } // Note: the list must have size maxRowsReduction. // Now prepare the linear system according to the paper for (i = 0; i < numUsedRows; ++i){ for (j = 0; j < numUsedRows; ++j){ #ifdef RS2_USE_LAPACK A[i*numUsedRows+j] = 0; #else A[i][j] = 0; #endif if (list[i] != k && list[j] != k){ for (h = 0; h < nTab; ++h){ #ifdef RS2_USE_LAPACK A[i*numUsedRows+j]+=workNonBasicTab[list[i]][h]*workNonBasicTab[list[j]][h]; #else A[i][j]+=workNonBasicTab[list[i]][h]*workNonBasicTab[list[j]][h]; #endif } if (resolveWithNormalization && i == j){ // Penalize the norm of lambda, i.e. the solution #ifdef RS2_USE_LAPACK A[i*numUsedRows+j] += norm[k]*param.getNormalization(); #else A[i][j] += norm[k]*param.getNormalization(); #endif } } } if (list[i] == k){ b[i] = 1; #ifdef RS2_USE_LAPACK A[i*numUsedRows+i] = 1; #else A[i][i] = 1; #endif } else{ b[i] = 0; for (h = 0; h < nTab; ++h){ b[i] -= workNonBasicTab[list[i]][h]*workNonBasicTab[k][h]; } } } // Linear system has been written, now solve it #ifdef RS2_USE_LAPACK int info = 0; int h = 1; dgesv_(&numUsedRows, &h, A, &numUsedRows, indexlu, b, &numUsedRows, &info); if (info) continue; #else // LU decomposition if (!ludcmp(A, numUsedRows, indexlu, &tmpnumlu, tmpveclu)){ // numerical error: exit continue; } // Backward substitution lubksb(A, numUsedRows, indexlu, b); #endif // Check the 1-norm of the solution double sumnorm = 0.0; for (i = 0; i < numUsedRows; ++i){ b[i] = rs2round(b[i]); sumnorm += fabs(b[i]); if (sumnorm > param.getMaxSumMultipliers()){ break; } } #ifdef RS2_TRACE rs_printvecDBL("multipliers", b, numUsedRows); printf("sumnorm: %f\n", sumnorm); #endif if (sumnorm == 1){ // The optimal solution has lambda_k = 1 and all the rest is zero; // so we cannot reduce any coefficient, let's skip this continue; } else if (!resolveWithNormalization && sumnorm > param.getMaxSumMultipliers()){ // The norm of lambda is too large, resolve with normalization // (note that we do not want to do this more than once) resolveWithNormalization = true; k--; continue; } resolveWithNormalization = false; if (sumnorm > param.getMaxSumMultipliers()){ // If we got this far, even resolving did not help, so we skip continue; } double deltaNorm = compute_norm_change(norm[k], list, numUsedRows, b); if (deltaNorm <= -norm[k]*param.getMinNormReduction()){ for (i = 0; i < numUsedRows; ++i){ pi_mat[k][list[i]] = (int)(b[i]); } numRedRows++; } } /* if (norm[k] > param.getNormIsZero()) */ } /*for (k = 0; k < mTab; ++k) */ delete[] b; delete[] list; delete[] indexlu; delete[] tmpveclu; #ifdef RS2_USE_LAPACK delete[] A; #else rs_deallocmatDBL(&A, maxRowsReduction); #endif #ifdef RS2_TRACE sum_norms = 0; for(i=0; i f0) { row[locind] = - ((1-f) * f0); } else { row[locind] = -(f*f0compl); } } for(i=0; i param.getEPS_ELIM()) { int upto = rowStart[i] + rowLength[i]; for(j=rowStart[i]; j param.getEPS_COEFF()) { min_val = CoinMin(min_val, val); nelem++; } } if((max_val < param.getMAXDYN() * min_val) && (max_val >= min_val)) { return 1; } #ifdef RS2_TRACE printf("CglRedSplit2::check_dynamism(): max_val: %6.6f min_val: %6.6f dynamism: %g\n", max_val, min_val, max_val/min_val); #endif return 0; } /* row_scale_factor */ /************************************************************************/ int CglRedSplit2::generate_packed_row(const double *lclXlp, double *row, int *rowind, double *rowelem, int *card_row, double & rhs) { int i; double value; int max_support = param.getMAX_SUPP_ABS() + (static_cast(ncol*param.getMAX_SUPP_REL())); if(!check_dynamism(row)) { #ifdef RS2_TRACE printf("CglRedSplit2::generate_packed_row(): Cut discarded (bad dynamism)\n"); #endif return(0); } *card_row = 0; for(i=0; i param.getEPS_COEFF()) { rowind[*card_row] = i; rowelem[*card_row] = value; (*card_row)++; if(*card_row > max_support) { #ifdef RS2_TRACE printf("CglRedSplit2::generate_packed_row(): Cut discarded (too many non zero)\n"); #endif return(0); } } else { if (value > 0.0) { rhs -= value * colLower[i]; } else { rhs -= value * colUpper[i]; } } } value = 0; for(i=0; i<(*card_row); i++) { value += lclXlp[rowind[i]] * rowelem[i]; } if(value > rhs) { value = value-rhs; if(value < param.getMINVIOL()) { #ifdef RS2_TRACE printf("CglRedSplit2::generate_packed_row(): Cut discarded: violation: %12.10f\n", value); #endif return(0); } } return(1); } /* generate_packed_row */ /************************************************************************/ bool CglRedSplit2::rs_are_different_vectors(const int *vect1, const int *vect2, const int dim) { int i; for(i=0; i(&si); if(solver == NULL) { printf("### WARNING: CglRedSplit2::generateCuts(): no solver available.\n"); return; } if(!solver->optimalBasisIsAvailable()) { printf("### WARNING: CglRedSplit2::generateCuts(): no optimal basis available.\n"); return; } // Reset some members of CglRedSplit2 card_intBasicVar = 0; card_intBasicVar_frac = 0; card_intNonBasicVar = 0; card_contNonBasicVar = 0; card_nonBasicAtUpper = 0; card_nonBasicAtLower = 0; numRedRows = 0; startTime = CoinCpuTime(); // Get basic problem information from solver ncol = solver->getNumCols(); nrow = solver->getNumRows(); colLower = solver->getColLower(); colUpper = solver->getColUpper(); rowLower = solver->getRowLower(); rowUpper = solver->getRowUpper(); rowRhs = solver->getRightHandSide(); reducedCost = solver->getReducedCost(); rowPrice = solver->getRowPrice(); objective = solver->getObjCoefficients(); xlp = solver->getColSolution(); rowActivity = solver->getRowActivity(); byRow = solver->getMatrixByRow(); solver->enableFactorization(); generateCuts(&cs, param.getMaxNumCuts()); solver->disableFactorization(); } /* generateCuts */ /************************************************************************/ int CglRedSplit2::generateCuts(OsiCuts* cs, int maxNumCuts, int* lambda) { int i; is_integer = new int[ncol]; compute_is_integer(); int *cstat = new int[ncol]; int *rstat = new int[nrow]; solver->getBasisStatus(cstat, rstat); // 0: free 1: basic // 2: upper 3: lower int *basis_index = new int[nrow]; // basis_index[i] = // index of pivot var in row i // (slack if number >= ncol) #ifdef RS2_TRACETAB rs_printvecINT("cstat", cstat, ncol); rs_printvecINT("rstat", rstat, nrow); #endif solver->getBasics(basis_index); cv_intBasicVar = new int[ncol]; cv_intBasicVar_frac = new int[ncol]; intBasicVar = new int[ncol]; intNonBasicVar = new int[ncol]; contNonBasicVar = new int[ncol+nrow]; nonBasicAtUpper = new int[ncol+nrow]; nonBasicAtLower = new int[ncol+nrow]; double dist_int; for(i=0; i param.getAway()) && (dist_int < 1 - param.getAway())) { cv_intBasicVar_frac[i] = 1; card_intBasicVar_frac++; // intBasicVar_frac computed below, // as order must be according to selected rows } card_intBasicVar++; cv_intBasicVar[i] = 1; } break; case 2: // Non basic at upper bound: must be flipped and shifted // so that it becomes non negative with lower bound 0 // It is assumed that bounds for integer variables have been // tightend so that non basic integer structural variables // have integer values nonBasicAtUpper[card_nonBasicAtUpper] = i; card_nonBasicAtUpper++; if(is_integer[i]) { intNonBasicVar[card_intNonBasicVar] = i; card_intNonBasicVar++; } else { contNonBasicVar[card_contNonBasicVar] = i; card_contNonBasicVar++; } break; case 3 : // non basic at lower bound: must be shifted so that it becomes // non negative with lower bound 0 // It is assumed that bounds for integer variables have been // tightend so that they are integer nonBasicAtLower[card_nonBasicAtLower] = i; card_nonBasicAtLower++; if(is_integer[i]) { intNonBasicVar[card_intNonBasicVar] = i; card_intNonBasicVar++; } else { contNonBasicVar[card_contNonBasicVar] = i; card_contNonBasicVar++; } break; default: // free variable ? Don't know how to handle printf("### ERROR: CglRedSplit2::generateCuts(): cstat[%d]: %d\n", i, cstat[i]); exit(1); break; } } // Use this instead of rowRhs to allow for ranges double *effective_rhs = new double[nrow]; for(i=0; i= ncol || cv_intBasicVar[basis_index[ind_row]] != 1) { // If basic variable is not an integer variable, skip continue; } origRow[card_intBasicVar] = ind_row; // row used in generation intBasicVar[card_intBasicVar] = basis_index[ind_row]; if (cv_intBasicVar_frac[basis_index[ind_row]] == 1){ // row is fractional intBasicVar_frac[card_intBasicVar_frac] = basis_index[ind_row]; cv_fracRowsTab[card_intBasicVar] = 1; } // obtain row of simplex tableau solver->getBInvARow(ind_row, z, slack); rhsTab[card_rowTab] = xlp[basis_index[ind_row]]; int nonzeroes = 0; int ii; for(ii=0; ii TINY) nonzeroes++; } for(ii=0; ii TINY) nonzeroes++; } #if RS_FAST_INT > 0 || RS_FAST_CONT > 0 || RS_FAST_WORK > 0 if(nonzeroes < param.getMaxNonzeroesTab()) { #endif // The number of nonzeroes is small enough, we keep the row card_rowTab++; card_intBasicVar++; if (cv_intBasicVar_frac[basis_index[ind_row]] == 1) card_intBasicVar_frac++; #if RS_FAST_INT > 0 || RS_FAST_CONT > 0 || RS_FAST_WORK > 0 } #endif } #if RS_FAST_INT == 0 && RS_FAST_CONT == 0 && RS_FAST_WORK == 0 rs_allocmatINT(&pi_mat, mTab, mTab); #else // Allow for sparse info (and for work) rs_allocmatINT(&pi_mat, mTab, mTab+ card_intNonBasicVar+2*card_contNonBasicVar+3); for (int i=0;i TINY) intSparse[++n]=j; } intSparse[0]=n; n=0; values=contNonBasicTab[i]; for (int j=0;jgetElements(); const int *rowStart = byRow->getVectorStarts(); const int *indices = byRow->getIndices(); const int *rowLength = byRow->getVectorLengths(); CglRedSplit2Param::ColumnSelectionStrategy columnSelection; CglRedSplit2Param::RowSelectionStrategy rowSelection; int numRows; int maxNumComputedCuts = param.getMaxNumComputedCuts(); int* bufflambda = lambda; OsiCuts* buffcs = cs; // quality of cuts struct sortElement* quality = NULL; if (maxNumCuts < maxNumComputedCuts){ // user wants the generator to generate several cuts and select only best if (lambda != NULL){ bufflambda = new int[maxNumComputedCuts*nrow]; } if (cs != NULL){ buffcs = new OsiCuts(); } quality = new struct sortElement[maxNumComputedCuts]; } int initNumCuts = 0; if (buffcs != NULL){ initNumCuts = buffcs->sizeRowCuts(); } // reset vector of lambdas if (bufflambda != NULL){ if (maxNumCuts < maxNumComputedCuts){ memset(bufflambda, 0, maxNumComputedCuts*nrow*sizeof(int)); } else{ memset(bufflambda, 0, maxNumCuts*nrow*sizeof(int)); } } int numCuts = 0; std::vector listColSel = param.getColumnSelectionStrategy(); std::vector listRowSel = param.getRowSelectionStrategy(); std::vector listNumRows = param.getNumRowsReduction(); #if 0 double work= listColSel.size()*listNumRows.size()*listRowSel.size()*nDiag; work *= mTab*(card_intNonBasicVar+card_contNonBasicVar); printf("listColSel %d listNumRows %d listRowSel %d mTab %d intNon %d contnon %d - %d generate_rows and dense ops %g\n", listColSel.size(),listNumRows.size(),listRowSel.size(),mTab, card_intNonBasicVar,card_contNonBasicVar, listColSel.size()*listNumRows.size()*listRowSel.size()*nDiag,work); #endif for (unsigned int coliter = 0; coliter < listColSel.size(); ++coliter){ if (!checkTime() || numCuts >= maxNumComputedCuts){ break; } columnSelection = listColSel[coliter]; #ifdef RS2_TRACE printf("Filling workNonBasicTab with column strategy %d\n", columnSelection); #endif // select the columns fill_workNonBasicTab(columnSelection); for (unsigned int nriter = 0; nriter < listNumRows.size(); ++nriter){ if (!checkTime() || numCuts >= maxNumComputedCuts){ break; } numRows = listNumRows[nriter]; #ifdef RS2_TRACE printf("Applying reduction algorithm with %d rows\n", numRows); #endif for (unsigned int rowiter = 0; rowiter < listRowSel.size(); ++rowiter){ if (!checkTime() || numCuts >= maxNumComputedCuts){ break; } rowSelection = listRowSel[rowiter]; #ifdef RS2_TRACE printf("Reducing norms with row strategy %d\n", rowSelection); #endif // new iteration: reinitialize pi_mat for(i=0; i 0.0) { adjust += fabs(tabrowrhs) * param.getEPS_RELAX_REL(); } rc.setUb(tabrowrhs + adjust); // relax the constraint slightly buffcs->insertIfNotDuplicate(rc, CoinAbsFltEq(param.getEPS())); numCuts = buffcs->sizeRowCuts() - initNumCuts; } else{ numCuts++; } } } } } } } } } if (maxNumCuts < maxNumComputedCuts){ // select best cuts and copy them back if (numCuts > maxNumCuts){ qsort(quality, numCuts, sizeof(struct sortElement), rs2_compareElements); } // also delete temp data if (buffcs){ for (int i = 0; i < numCuts && i < maxNumCuts; ++i){ cs->insertIfNotDuplicate(buffcs->rowCut(quality[i].index), CoinAbsFltEq(param.getEPS_COEFF())); } delete buffcs; } if (bufflambda){ for (int i = 0; i < numCuts && i < maxNumCuts; ++i){ memcpy(lambda + (i*nrow), bufflambda + (quality[i].index*nrow), sizeof(int)*nrow); } delete[] bufflambda; } if (numCuts > maxNumCuts){ numCuts = maxNumCuts; } } delete[] cstat; delete[] rstat; delete[] basis_index; delete[] slack; delete[] z; delete[] effective_rhs; delete[] row; delete[] rowind; delete[] rowelem; delete[] origRow; delete[] cv_intBasicVar; delete[] cv_intBasicVar_frac; delete[] cv_fracRowsTab; delete[] intBasicVar; delete[] intBasicVar_frac; delete[] intNonBasicVar; delete[] contNonBasicVar; delete[] nonBasicAtUpper; delete[] nonBasicAtLower; delete[] is_integer; rs_deallocmatDBL(&contNonBasicTab, mTab); rs_deallocmatDBL(&workNonBasicTab, mTab); rs_deallocmatDBL(&intNonBasicTab, mTab); rs_deallocmatINT(&pi_mat, mTab); delete[] rhsTab; delete[] norm; return numCuts; } /* generateCuts */ /***********************************************************************/ void CglRedSplit2::setParam(const CglRedSplit2Param &source) { param = source; } /* setParam */ /***********************************************************************/ void CglRedSplit2::compute_is_integer() { int i; for(i=0; iisInteger(i)) { is_integer[i] = 1; } else { if((colUpper[i] - colLower[i] < param.getEPS()) && (rs_above_integer(colUpper[i]) < param.getEPS())) { // continuous variable fixed to an integer value is_integer[i] = 1; } else { is_integer[i] = 0; } } } } /* compute_is_integer */ /***********************************************************************/ void CglRedSplit2::print() const { rs_printvecINT("intBasicVar_frac", intBasicVar_frac, card_intBasicVar_frac); rs_printmatINT("pi_mat", pi_mat, card_intBasicVar_frac, card_intBasicVar_frac); rs_printvecINT("intNonBasicVar", intNonBasicVar, card_intNonBasicVar); rs_printmatDBL("intNonBasicTab", intNonBasicTab, card_intBasicVar_frac, card_intNonBasicVar); rs_printvecINT("contNonBasicVar", contNonBasicVar, card_contNonBasicVar); rs_printmatDBL("contNonBasicTab", contNonBasicTab, card_intBasicVar_frac, card_contNonBasicVar); rs_printvecINT("nonBasicAtLower", nonBasicAtLower, card_nonBasicAtLower); rs_printvecINT("nonBasicAtUpper", nonBasicAtUpper, card_nonBasicAtUpper); } /* print */ /***********************************************************************/ void CglRedSplit2::printOptTab(OsiSolverInterface *lclSolver) const { int i; int *cstat = new int[ncol]; int *rstat = new int[nrow]; lclSolver->getBasisStatus(cstat, rstat); // 0: free 1: basic // 2: upper 3: lower int *basis_index = new int[nrow]; // basis_index[i] = // index of pivot var in row i // (slack if number >= ncol) lclSolver->getBasics(basis_index); double *z = new double[ncol]; // workspace to get row of the tableau double *slack = new double[nrow]; // workspace to get row of the tableau double *slack_val = new double[nrow]; for(i=0; igetReducedCost(); const double *dual = lclSolver->getRowPrice(); const double *solution = lclSolver->getColSolution(); rs_printvecINT("cstat", cstat, ncol); rs_printvecINT("rstat", rstat, nrow); rs_printvecINT("basis_index", basis_index, nrow); rs_printvecDBL("solution", solution, ncol); rs_printvecDBL("slack_val", slack_val, nrow); rs_printvecDBL("reduced_costs", rc, ncol); rs_printvecDBL("dual solution", dual, nrow); printf("Optimal Tableau:\n"); for(i=0; igetBInvARow(i, z, slack); int ii; for(ii=0; iigetObjValue()); delete[] cstat; delete[] rstat; delete[] basis_index; delete[] slack; delete[] z; delete[] slack_val; } /* printOptTab */ /*********************************************************************/ CglRedSplit2::CglRedSplit2() : CglCutGenerator(), nrow(0), ncol(0), card_intBasicVar(0), card_intBasicVar_frac(0), card_intNonBasicVar(0), card_contNonBasicVar(0), card_nonBasicAtUpper(0), card_nonBasicAtLower(0), cv_intBasicVar(0), cv_intBasicVar_frac(0), cv_fracRowsTab(0), intBasicVar(0), intBasicVar_frac(0), intNonBasicVar(0), contNonBasicVar(0), nonBasicAtUpper(0), nonBasicAtLower(0), mTab(0), nTab(0), pi_mat(0), contNonBasicTab(0), intNonBasicTab(0), rhsTab(0) { } /*********************************************************************/ CglRedSplit2::CglRedSplit2(const CglRedSplit2Param &RS_param) : CglCutGenerator(), nrow(0), ncol(0), card_intBasicVar(0), card_intBasicVar_frac(0), card_intNonBasicVar(0), card_contNonBasicVar(0), card_nonBasicAtUpper(0), card_nonBasicAtLower(0), cv_intBasicVar(0), cv_intBasicVar_frac(0), cv_fracRowsTab(0), intBasicVar(0), intBasicVar_frac(0), intNonBasicVar(0), contNonBasicVar(0), nonBasicAtUpper(0), nonBasicAtLower(0), mTab(0), nTab(0), pi_mat(0), contNonBasicTab(0), intNonBasicTab(0), rhsTab(0) { param = RS_param; } /*********************************************************************/ CglRedSplit2::CglRedSplit2 (const CglRedSplit2 & source) : CglCutGenerator(source), param(source.param), nrow(0), ncol(0), card_intBasicVar(0), card_intBasicVar_frac(0), card_intNonBasicVar(0), card_contNonBasicVar(0), card_nonBasicAtUpper(0), card_nonBasicAtLower(0), cv_intBasicVar(NULL), cv_intBasicVar_frac(NULL), cv_fracRowsTab(NULL), intBasicVar(NULL), intBasicVar_frac(NULL), intNonBasicVar(NULL), contNonBasicVar(NULL), nonBasicAtUpper(NULL), nonBasicAtLower(NULL), mTab(0), nTab(0), pi_mat(NULL), contNonBasicTab(NULL), intNonBasicTab(NULL), rhsTab(NULL) { } /*********************************************************************/ CglCutGenerator * CglRedSplit2::clone() const { return new CglRedSplit2(*this); } /*********************************************************************/ CglRedSplit2::~CglRedSplit2 () {} /*********************************************************************/ CglRedSplit2 & CglRedSplit2::operator=(const CglRedSplit2 &source) { if (this != &source) { CglCutGenerator::operator=(source); param = source.param; } return *this; } /*********************************************************************/ // Returns true if needs optimal basis to do cuts bool CglRedSplit2::needsOptimalBasis() const { return true; } /************************************************************************/ int CglRedSplit2::generateMultipliers(const OsiSolverInterface &si, int* lambda, int maxNumMultipliers, int* basicVariables, OsiCuts* cs) { solver = const_cast(&si); if(solver == NULL) { printf("### WARNING: CglRedSplit2::generateCuts(): no solver available.\n"); return 0; } if(!solver->optimalBasisIsAvailable()) { printf("### WARNING: CglRedSplit2::generateCuts(): no optimal basis available.\n"); return 0; } // Reset some members of CglRedSplit2 card_intBasicVar = 0; card_intBasicVar_frac = 0; card_intNonBasicVar = 0; card_contNonBasicVar = 0; card_nonBasicAtUpper = 0; card_nonBasicAtLower = 0; numRedRows = 0; startTime = CoinCpuTime(); // Get basic problem information from solver ncol = solver->getNumCols(); nrow = solver->getNumRows(); colLower = solver->getColLower(); colUpper = solver->getColUpper(); rowLower = solver->getRowLower(); rowUpper = solver->getRowUpper(); rowRhs = solver->getRightHandSide(); reducedCost = solver->getReducedCost(); rowPrice = solver->getRowPrice(); objective = solver->getObjCoefficients(); xlp = solver->getColSolution(); rowActivity = solver->getRowActivity(); byRow = solver->getMatrixByRow(); solver->enableFactorization(); if (basicVariables != NULL){ solver->getBasics(basicVariables); } int numMultipliers = generateCuts(cs, maxNumMultipliers, lambda); solver->disableFactorization(); return numMultipliers; } /* generateMultipliers */ /***********************************************************************/ int CglRedSplit2::tiltLandPcut(const OsiSolverInterface* si, double* landprow, double landprhs, int rownumber, const double* xbar, const int* newnonbasics, OsiRowCut* cs, int* lambda){ solver = const_cast(si); if(solver == NULL) { printf("### WARNING: CglRedSplit2::tiltLandPcut(): no solver available.\n"); return 0; } // Reset some members of CglRedSplit2 card_intBasicVar = 0; card_intBasicVar_frac = 0; card_intNonBasicVar = 0; card_contNonBasicVar = 0; card_nonBasicAtUpper = 0; card_nonBasicAtLower = 0; numRedRows = 0; startTime = CoinCpuTime(); // Get basic problem information from solver ncol = solver->getNumCols(); nrow = solver->getNumRows(); colLower = solver->getColLower(); colUpper = solver->getColUpper(); rowLower = solver->getRowLower(); rowUpper = solver->getRowUpper(); rowRhs = solver->getRightHandSide(); reducedCost = solver->getReducedCost(); rowPrice = solver->getRowPrice(); objective = solver->getObjCoefficients(); xlp = solver->getColSolution(); rowActivity = solver->getRowActivity(); byRow = solver->getMatrixByRow(); int i; is_integer = new int[ncol]; compute_is_integer(); int *cstat = new int[ncol]; int *rstat = new int[nrow]; solver->getBasisStatus(cstat, rstat); // 0: free 1: basic // 2: upper 3: lower int *basis_index = new int[nrow]; // basis_index[i] = // index of pivot var in row i // (slack if number >= ncol) #ifdef RS2_TRACETAB rs_printvecINT("cstat", cstat, ncol); rs_printvecINT("rstat", rstat, nrow); #endif solver->getBasics(basis_index); cv_intBasicVar = new int[ncol]; cv_intBasicVar_frac = new int[ncol]; intBasicVar = new int[ncol]; intNonBasicVar = new int[ncol]; contNonBasicVar = new int[ncol+nrow]; nonBasicAtUpper = new int[ncol+nrow]; nonBasicAtLower = new int[ncol+nrow]; double dist_int; for(i=0; i param.getAway()) && (dist_int < 1 - param.getAway())) { cv_intBasicVar_frac[i] = 1; card_intBasicVar_frac++; // intBasicVar_frac computed below, // as order must be according to selected rows } card_intBasicVar++; cv_intBasicVar[i] = 1; } break; case 2: // Non basic at upper bound: must be flipped and shifted // so that it becomes non negative with lower bound 0 // It is assumed that bounds for integer variables have been // tightend so that non basic integer structural variables // have integer values nonBasicAtUpper[card_nonBasicAtUpper] = i; card_nonBasicAtUpper++; if(is_integer[i]) { intNonBasicVar[card_intNonBasicVar] = i; card_intNonBasicVar++; } else { contNonBasicVar[card_contNonBasicVar] = i; card_contNonBasicVar++; } break; case 3 : // non basic at lower bound: must be shifted so that it becomes // non negative with lower bound 0 // It is assumed that bounds for integer variables have been // tightend so that they are integer nonBasicAtLower[card_nonBasicAtLower] = i; card_nonBasicAtLower++; if(is_integer[i]) { intNonBasicVar[card_intNonBasicVar] = i; card_intNonBasicVar++; } else { contNonBasicVar[card_contNonBasicVar] = i; card_contNonBasicVar++; } break; default: // free variable ? Don't know how to handle printf("### ERROR: CglRedSplit2::generateCuts(): cstat[%d]: %d\n", i, cstat[i]); exit(1); break; } } // Use this instead of rowRhs to allow for ranges double *effective_rhs = new double[nrow]; for(i=0; i= 0){ // this means that the source row is in the given simplex tableau mTab = card_intBasicVar; } else{ // source row is an extra row, so we need extra space mTab = card_intBasicVar + 1; } nTab = card_contNonBasicVar; rhsTab = new double[mTab]; cv_fracRowsTab = new int[mTab]; memset(cv_fracRowsTab, 0, mTab*sizeof(int)); int card_rowTab = 0; int extraColumns = 0; while (newnonbasics[extraColumns] >= 0){ extraColumns++; } rs_allocmatDBL(&contNonBasicTab, mTab, card_contNonBasicVar); rs_allocmatDBL(&workNonBasicTab, mTab, card_contNonBasicVar + extraColumns); rs_allocmatDBL(&intNonBasicTab, mTab, card_intNonBasicVar); norm = new double[mTab]; intBasicVar_frac = new int[ncol]; card_intBasicVar = 0; // recompute in pivot order card_intBasicVar_frac = 0; // write L&P row as first row rhsTab[card_rowTab] = landprhs; // flip row: L&P flips the nonbasic at upper bound, but we don't want this for (int ii=0; ii= ncol || ind_row == rownumber) { continue; } if(cv_intBasicVar[basis_index[ind_row]] == 1) { // row used in generation intBasicVar[card_intBasicVar] = basis_index[ind_row]; if (cv_intBasicVar_frac[basis_index[ind_row]] == 1){ // row is fractional intBasicVar_frac[card_intBasicVar_frac] = basis_index[ind_row]; card_intBasicVar_frac++; cv_fracRowsTab[card_intBasicVar] = 1; } card_intBasicVar++; int ii; rhsTab[card_rowTab] = xlp[basis_index[ind_row]]; solver->getBInvARow(ind_row, z, slack); for(ii=0; iigetElements(); const int *rowStart = byRow->getVectorStarts(); const int *indices = byRow->getIndices(); const int *rowLength = byRow->getVectorLengths(); CglRedSplit2Param::ColumnSelectionStrategy columnSelection; CglRedSplit2Param::RowSelectionStrategy rowSelection; int numRows; int generatedCuts = 0; std::vector listColSel = param.getColumnSelectionStrategyLAP(); std::vector listRowSel = param.getRowSelectionStrategyLAP(); std::vector listNumRows = param.getNumRowsReductionLAP(); for (unsigned int coliter = 0; coliter < listColSel.size(); ++coliter){ if (!checkTime()){ break; } columnSelection = listColSel[coliter]; #ifdef RS2_TRACE printf("Filling workNonBasicTab with column strategy %d\n", columnSelection); #endif nTab = 0; // select the columns if (columnSelection != CglRedSplit2Param::CS_LAP_NONBASICS){ fill_workNonBasicTab(columnSelection, newnonbasics); } fill_workNonBasicTab(newnonbasics, xbar, param.getColumnScalingStrategyLAP()); for (unsigned int nriter = 0; nriter < listNumRows.size(); ++nriter){ if (!checkTime()){ break; } numRows = listNumRows[nriter]; #ifdef RS2_TRACE printf("Applying reduction algorithm with %d rows\n", numRows); #endif for (unsigned int rowiter = 0; rowiter < listRowSel.size(); ++rowiter){ if (!checkTime()){ break; } rowSelection = listRowSel[rowiter]; #ifdef RS2_TRACE printf("Reducing norms with row strategy %d\n", rowSelection); #endif // new iteration: reinitialize pi_mat for(i=0; isetRow(card_row, rowind, rowelem); cs->setLb(-param.getINFINIT()); double adjust = param.getEPS_RELAX_ABS(); if(param.getEPS_RELAX_REL() > 0.0) { adjust += fabs(tabrowrhs) * param.getEPS_RELAX_REL(); } cs->setUb(tabrowrhs + adjust); if (lambda){ // Modify the initial disjunction by adding the new // coefficients for (int k = 1; k < mTab; ++k){ lambda[intBasicVar[k-1]] += pi_mat[i][k]; } } generatedCuts++; } } } } } } delete[] cstat; delete[] rstat; delete[] basis_index; delete[] slack; delete[] z; delete[] effective_rhs; delete[] row; delete[] rowind; delete[] rowelem; delete[] cv_intBasicVar_frac; delete[] cv_fracRowsTab; delete[] intBasicVar; delete[] intBasicVar_frac; delete[] intNonBasicVar; delete[] contNonBasicVar; delete[] nonBasicAtUpper; delete[] nonBasicAtLower; delete[] is_integer; rs_deallocmatDBL(&contNonBasicTab, mTab); rs_deallocmatDBL(&workNonBasicTab, mTab); rs_deallocmatDBL(&intNonBasicTab, mTab); rs_deallocmatINT(&pi_mat, pi_mat_rows); delete[] rhsTab; delete[] norm; return generatedCuts; } /* tiltLandPcut */ /***************************************************************************/ void CglRedSplit2::fill_workNonBasicTab(const int* newnonbasics, const double* xbar, CglRedSplit2Param::ColumnScalingStrategy scaling){ // See CglRedSplit2Param.hpp for a description of the strategies int i = 0; int currvar, colpos; #ifdef RS2_TRACE while (newnonbasics[i] >= 0){ printf("Newnonbasic[%d]: %d\n", i, newnonbasics[i]); i++; } i = 0; #endif // In workNonBasicTab, we write the new nonbasic columns given by the // Lift & Project algorithm, scaled by the value of the fractional solution. while (newnonbasics[i] >= 0){ currvar = newnonbasics[i]; if (currvar < ncol && solver->isInteger(currvar)){ for (colpos = 0; colpos < card_intNonBasicVar; ++colpos){ if (intNonBasicVar[colpos] == currvar){ #ifdef RS2_TRACE printf("Found int nonbasic at pos %d: %d %d\n", colpos, intNonBasicVar[colpos], currvar); #endif break; } } double factor = 1.0; if (scaling == CglRedSplit2Param::SC_LINEAR){ if (fabs(xbar[currvar]) > factor){ factor = fabs(xbar[currvar]); } } else if (scaling == CglRedSplit2Param::SC_LINEAR_BOUNDED){ if (fabs(xbar[currvar]) > factor){ factor = fabs(xbar[currvar]); } if (factor < param.getColumnScalingBoundLAP()){ factor = param.getColumnScalingBoundLAP(); } } else if (scaling == CglRedSplit2Param::SC_LOG_BOUNDED){ if (log(fabs(xbar[currvar])) > factor){ factor = log(fabs(xbar[currvar])); } if (factor < param.getColumnScalingBoundLAP()){ factor = param.getColumnScalingBoundLAP(); } } else if (scaling == CglRedSplit2Param::SC_UNIFORM){ factor = param.getColumnScalingBoundLAP(); } else if (scaling == CglRedSplit2Param::SC_UNIFORM_NZ){ if (fabs(xbar[currvar]) > param.getEPS()){ factor = param.getColumnScalingBoundLAP(); } } for (int j = 0; j < mTab; ++j){ workNonBasicTab[j][nTab] = intNonBasicTab[j][colpos]*factor; } nTab++; } else{ for (colpos = 0; colpos < card_contNonBasicVar; ++colpos){ if (contNonBasicVar[colpos] == currvar){ #ifdef RS2_TRACE printf("Found cont nonbasic at pos %d: %d %d\n", colpos, contNonBasicVar[colpos], currvar); #endif break; } } double factor = 1.0; if (scaling == CglRedSplit2Param::SC_LINEAR){ if (fabs(xbar[currvar]) > factor){ factor = fabs(xbar[currvar]); } } else if (scaling == CglRedSplit2Param::SC_LINEAR_BOUNDED){ if (fabs(xbar[currvar]) > factor){ factor = fabs(xbar[currvar]); } if (factor < param.getColumnScalingBoundLAP()){ factor = param.getColumnScalingBoundLAP(); } } else if (scaling == CglRedSplit2Param::SC_LOG_BOUNDED){ if (log(fabs(xbar[currvar])) > factor){ factor = log(fabs(xbar[currvar])); } if (factor < param.getColumnScalingBoundLAP()){ factor = param.getColumnScalingBoundLAP(); } } else if (scaling == CglRedSplit2Param::SC_UNIFORM){ factor = param.getColumnScalingBoundLAP(); } else if (scaling == CglRedSplit2Param::SC_UNIFORM_NZ){ if (fabs(xbar[currvar]) > param.getEPS()){ factor = param.getColumnScalingBoundLAP(); } } for (int j = 0; j < mTab; ++j){ #ifdef RS2_TRACE printf("Col %d Row %d: %f, xbar %f\n", colpos, j, contNonBasicTab[j][colpos], xbar[currvar]); #endif workNonBasicTab[j][nTab] = contNonBasicTab[j][colpos]*factor; } nTab++; } i++; } #ifdef RS2_TRACE printf("Printing workNonBasicTab:\n"); #endif #if RS_FAST_WORK int workOffset = mTab+card_intNonBasicVar+card_contNonBasicVar+2; #endif for (i = 0; i < mTab; ++i) { #ifdef RS2_TRACE for (int j = 0; j < nTab; ++j){ printf("%.6f ", workNonBasicTab[i][j]); } printf("\n"); #endif #if RS_FAST_WORK == 0 norm[i] = rs_dotProd(workNonBasicTab[i], workNonBasicTab[i], nTab); #elif RS_FAST_WORK == 1 norm[i] = rs_dotProd(workNonBasicTab[i], workNonBasicTab[i], nTab); double value = rs_sparseDotProd(workNonBasicTab[i], workNonBasicTab[i], pi_mat[i]+workOffset, pi_mat[i]+workOffset); assert (value==norm[i]); #else norm[i] = rs_sparseDotProd(workNonBasicTab[i], workNonBasicTab[i], pi_mat[i]+workOffset, pi_mat[i]+workOffset); #endif } } /* fill_workNonBasicTab */ /***********************************************************************/ CoinMP-1.8.3/Cgl/src/CglRedSplit2/CglRedSplit2Param.hpp0000644000175000017500000004606312130104031020770 0ustar renerene// Name: CglRedSplit2Param.hpp // Author: Giacomo Nannicini // Singapore University of Technology and Design // Singapore // email: nannicini@sutd.edu.sg // Date: 03/09/09 //----------------------------------------------------------------------------- // Copyright (C) 2010, Giacomo Nannicini and others. All Rights Reserved. #ifndef CglRedSplit2Param_H #define CglRedSplit2Param_H #include "CglParam.hpp" #include /**@name CglRedSplit2 Parameters */ //@{ /** Class collecting parameters the Reduced-and-split cut generator. An important thing to note is that the cut generator allows for the selection of a number of strategies that can be combined together. By default, a selection that typically yields a good compromise between speed and cut strenght is made. The selection can be changed by resetting the default choices (see the functions whose name starts with "reset") or by setting the parameter use_default_strategies to false in the constructors. After this, the chosen strategies can be added to the list by using the functions whose name starts with "add". All strategies will be combined together: if we choose 3 row selection strategies, 2 column selection strategies, and 2 possible numbers of rows, we end up with a total of 3*2*2 combinations. For a detailed explanation of the parameters and their meaning, see the paper by Cornuejols and Nannicini: "Practical strategies for generating rank-1 split cuts in mixed-integer linear programming", on Mathematical Programming Computation. Parameters of the generator are listed below. - MAXDYN: Maximum ratio between largest and smallest non zero coefficients in a cut. See method setMAXDYN(). - EPS_ELIM: Precision for deciding if a coefficient is zero when eliminating slack variables. See method setEPS_ELIM(). - MINVIOL: Minimum violation for the current basic solution in a generated cut. See method setMINVIOL(). - EPS_RELAX_ABS: Absolute relaxation of cut rhs. - EPS_RELAX_REL: Relative relaxation of cut rhs. - MAX_SUPP_ABS: Maximum cut support (absolute). - MAX_SUPP_REL: Maximum cut support (relative): the formula to compute maximum cut support is MAX_SUPP_ABS + ncol*MAX_SUPP_REL. - USE_INTSLACKS: Use integer slacks to generate cuts. (not implemented). See method setUSE_INTSLACKS(). - normIsZero: Norm of a vector is considered zero if smaller than this value. See method setNormIsZero(). - minNormReduction: a cut is generated if the new norm of the row on the continuous nonbasics is reduced by at least this factor (relative reduction). - away: Look only at basic integer variables whose current value is at least this value from being integer. See method setAway(). - maxSumMultipliers: maximum sum (in absolute value) of row multipliers - normalization: normalization factor for the norm of lambda in the coefficient reduction algorithm (convex min problem) - numRowsReduction: Maximum number of rows in the linear system for norm reduction. - columnSelectionStrategy: parameter to select which columns should be used for coefficient reduction. - rowSelectionStrategy: parameter to select which rows should be used for coefficient reduction. - timeLimit: Time limit (in seconds) for cut generation. - maxNumCuts: Maximum number of cuts that can be returned at each pass; we could generate more cuts than this number (see below) - maxNumComputedCuts: Maximum number of cuts that can be computed by the generator at each pass - maxNonzeroesTab : Rows of the simplex tableau with more than this number of nonzeroes will not be considered for reduction. Only works if RS_FAST_* are defined in CglRedSplit2. - skipGomory: Skip traditional Gomory cuts, i.e. GMI cuts arising from a single row of the tableau (instead of a combination). Default is 1 (true), because we assume that they are generated by a traditional Gomory generator anyway. */ //@} class CglRedSplit2Param : public CglParam { public: /** Enumerations for parameters */ /** Row selection strategies; same names as in the paper */ enum RowSelectionStrategy{ /* Pick rows that introduce the fewest nonzeroes on integer nonbasics */ RS1, /* Pick rows that introduce the fewest nonzeroes on the set of working continuous nonbasics */ RS2, /* Pick rows that introduce the fewest nonzeroes on both integer and working continuous nonbasics */ RS3, /* Same as RS0 but with greedy algorithm */ RS4, /* Same as RS1 but with greedy algorithm */ RS5, /* Same as RS2 but with greedy algorithm */ RS6, /* Pick rows with smallest angle in the space of integer and working continuous nonbasics */ RS7, /* Pick rows with smallest angle in the space of working continuous nonbasics */ RS8, /* Use all strategies */ RS_ALL, /* Use best ones - that is, RS8 and RS7 */ RS_BEST }; /** Column selection strategies; again, look them up in the paper. */ enum ColumnSelectionStrategy{ /* C-3P */ CS1, CS2, CS3, /* C-5P */ CS4, CS5, CS6, CS7, CS8, /* I-2P-2/3 */ CS9, CS10, /* I-2P-4/5 */ CS11, CS12, /* I-2P-1/2 */ CS13, CS14, /* I-3P */ CS15, CS16, CS17, /* I-4P */ CS18, CS19, CS20, CS21, /* Use all strategies up to this point */ CS_ALL, /* Use best strategies (same effect as CS_ALL, because it turns out that using all strategies is the best thing to do) */ CS_BEST, /* Optimize over all continuous nonbasic columns; this does not give good results, but we use it for testing Lift & Project + RedSplit */ CS_ALLCONT, /* Lift & Project specific strategy: only select variables which are nonbasic in the tableau but are basic in the point to cut off. This strategy cannot be used outside L&P. It is not very effective even with L&P, but is left here for testing.*/ CS_LAP_NONBASICS }; /** Scaling strategies for new nonbasic columns for Lift & Project; * "factor" is the value of columnScalingBoundLAP_ */ enum ColumnScalingStrategy{ /* No scaling */ SC_NONE, /* Multiply by |xbar[i]| where xbar[i] is the value of the corresponding component of the point that we want to cut off */ SC_LINEAR, /* Multiply by min(factor,|xbar[i]|) */ SC_LINEAR_BOUNDED, /* Multiply by min(factor,log(|xbar[i]|)) */ SC_LOG_BOUNDED, /* Multiply all new nonbasics by factor */ SC_UNIFORM, /* Multiply only nonzero coefficients by factor */ SC_UNIFORM_NZ }; /**@name Set/get methods */ //@{ /** Set away, the minimum distance from being integer used for selecting rows for cut generation; all rows whose pivot variable should be integer but is more than away from integrality will be selected; Default: 0.005 */ virtual void setAway(double value); /// Get value of away inline double getAway() const {return away_;} /** Set the value of EPS_ELIM, epsilon for values of coefficients when eliminating slack variables; Default: 0.0 */ void setEPS_ELIM(double value); /** Get the value of EPS_ELIM */ double getEPS_ELIM() const {return EPS_ELIM;} /** Set EPS_RELAX_ABS */ virtual void setEPS_RELAX_ABS(double eps_ra); /** Get value of EPS_RELAX_ABS */ inline double getEPS_RELAX_ABS() const {return EPS_RELAX_ABS;} /** Set EPS_RELAX_REL */ virtual void setEPS_RELAX_REL(double eps_rr); /** Get value of EPS_RELAX_REL */ inline double getEPS_RELAX_REL() const {return EPS_RELAX_REL;} // Set the maximum ratio between largest and smallest non zero // coefficients in a cut. Default: 1e6. virtual void setMAXDYN(double value); /** Get the value of MAXDYN */ inline double getMAXDYN() const {return MAXDYN;} /** Set the value of MINVIOL, the minimum violation for the current basic solution in a generated cut. Default: 1e-3 */ virtual void setMINVIOL(double value); /** Get the value of MINVIOL */ inline double getMINVIOL() const {return MINVIOL;} /** Maximum absolute support of the cutting planes. Default: INT_MAX. Aliases for consistency with our naming scheme. */ inline void setMAX_SUPP_ABS(int value) {setMAX_SUPPORT(value);} inline int getMAX_SUPP_ABS() const {return MAX_SUPPORT;} /** Maximum relative support of the cutting planes. Default: 0.0. The maximum support is MAX_SUPP_ABS + MAX_SUPPREL*ncols. */ inline void setMAX_SUPP_REL(double value); inline double getMAX_SUPP_REL() const {return MAX_SUPP_REL;} /** Set the value of USE_INTSLACKS. Default: 0 */ virtual void setUSE_INTSLACKS(int value); /** Get the value of USE_INTSLACKS */ inline int getUSE_INTSLACKS() const {return USE_INTSLACKS;} /** Set the value of normIsZero, the threshold for considering a norm to be 0; Default: 1e-5 */ virtual void setNormIsZero(double value); /** Get the value of normIsZero */ inline double getNormIsZero() const {return normIsZero_;} /** Set the value of minNormReduction; Default: 0.1 */ virtual void setMinNormReduction(double value); /** Get the value of normIsZero */ inline double getMinNormReduction() const {return minNormReduction_;} /** Set the value of maxSumMultipliers; Default: 10 */ virtual void setMaxSumMultipliers(int value); /** Get the value of maxSumMultipliers */ inline int getMaxSumMultipliers() const {return maxSumMultipliers_;} /** Set the value of normalization; Default: 0.0001 */ virtual void setNormalization(double value); /** Get the value of normalization */ inline double getNormalization() const {return normalization_;} /** Set the value of numRowsReduction, max number of rows that are used * for each row reduction step. In particular, the linear system will * involve a numRowsReduction*numRowsReduction matrix */ virtual void addNumRowsReduction(int value); /// get the value inline std::vector getNumRowsReduction() const {return numRowsReduction_;} /// reset inline void resetNumRowsReduction() {numRowsReduction_.clear();} /** Add the value of columnSelectionStrategy */ virtual void addColumnSelectionStrategy(ColumnSelectionStrategy value); /// get the value inline std::vector getColumnSelectionStrategy() const {return columnSelectionStrategy_;} /// reset inline void resetColumnSelectionStrategy(){columnSelectionStrategy_.clear();} /** Set the value for rowSelectionStrategy, which changes the way we choose * the rows for the reduction step */ virtual void addRowSelectionStrategy(RowSelectionStrategy value); /// get the value inline std::vector getRowSelectionStrategy() const {return rowSelectionStrategy_;}; /// reset inline void resetRowSelectionStrategy() {rowSelectionStrategy_.clear();} /** Set the value of numRowsReductionLAP, max number of rows that are used * for each row reduction step during Lift & Project. * In particular, the linear system will involve a * numRowsReduction*numRowsReduction matrix */ virtual void addNumRowsReductionLAP(int value); /// get the value inline std::vector getNumRowsReductionLAP() const {return numRowsReductionLAP_;} /// reset inline void resetNumRowsReductionLAP() {numRowsReductionLAP_.clear();} /** Add the value of columnSelectionStrategyLAP */ virtual void addColumnSelectionStrategyLAP(ColumnSelectionStrategy value); /// get the value inline std::vector getColumnSelectionStrategyLAP() const {return columnSelectionStrategyLAP_;} /// reset inline void resetColumnSelectionStrategyLAP(){columnSelectionStrategyLAP_.clear();} /** Set the value for rowSelectionStrategyLAP, which changes the way we * choose the rows for the reduction step */ virtual void addRowSelectionStrategyLAP(RowSelectionStrategy value); /// get the value inline std::vector getRowSelectionStrategyLAP() const {return rowSelectionStrategyLAP_;}; /// reset inline void resetRowSelectionStrategyLAP() {rowSelectionStrategyLAP_.clear();} /** Set the value for columnScalingStrategyLAP, which sets the way nonbasic * columns that are basic in the fractional point to cut off are scaled */ virtual void setColumnScalingStrategyLAP(ColumnScalingStrategy value); /// get the value inline ColumnScalingStrategy getColumnScalingStrategyLAP() const {return columnScalingStrategyLAP_; }; /** Set the value for the bound in the column scaling factor */ virtual void setColumnScalingBoundLAP(double value); /// get the value inline double getColumnScalingBoundLAP() const {return columnScalingBoundLAP_;}; /** Set the value of the time limit for cut generation (in seconds) */ virtual void setTimeLimit(double value); /// get the value inline double getTimeLimit() const {return timeLimit_;} /** Set the value for the maximum number of cuts that can be returned */ virtual void setMaxNumCuts(int value); /// get the value inline int getMaxNumCuts() const {return maxNumCuts_;} /** Set the value for the maximum number of cuts that can be computed */ virtual void setMaxNumComputedCuts(int value); /// get the value inline int getMaxNumComputedCuts() const {return maxNumComputedCuts_;} /** Set the value for the maximum number of nonzeroes in a row of * the simplex tableau for the row to be considered */ virtual void setMaxNonzeroesTab(int value); /// get the value inline int getMaxNonzeroesTab() const {return maxNonzeroesTab_;} /** Set the value of skipGomory: should we skip simple Gomory cuts, * i.e. GMI cuts derived from a single row of the simple tableau? * This is 1 (true) by default: we only generate cuts from linear * combinations of at least two rows. */ virtual void setSkipGomory(int value); /// get the value inline int getSkipGomory() const {return skipGomory_;} //@} /**@name Constructors and destructors */ //@{ /// Default constructor. If use_default_strategies is true, we add /// to the list of strategies the default ones. If is false, the /// list of strategies is left empty (must be populated before usage!). CglRedSplit2Param(bool use_default_strategies = true, double eps = 1e-12, double eps_coeff = 1e-11, double eps_elim = 0.0, double eps_relax_abs = 1e-11, double eps_relax_rel = 1e-13, double max_dyn = 1e6, double min_viol = 1e-3, int max_supp_abs = 1000, double max_supp_rel = 0.1, int use_int_slacks = 0, double norm_zero = 1e-5, double minNormReduction = 0.1, int maxSumMultipliers = 10, double normalization = 0.0001, double away = 0.005, double timeLimit = 60, int maxNumCuts = 10000, int maxNumComputedCuts = 10000, int maxNonzeroesTab = 1000, double columnScalingBoundLAP = 5.0, int skipGomory = 1); /// Constructor from CglParam. If use_default_strategies is true, we /// add to the list of strategies the default ones. If is false, the /// list of strategies is left empty (must be populated before /// usage!). CglRedSplit2Param(const CglParam &source, bool use_default_strategies = true, double eps_elim = 0.0, double eps_relax_abs = 1e-11, double eps_relax_rel = 1e-13, double max_dyn = 1e6, double min_viol = 1e-3, double max_supp_rel = 0.1, int use_int_slacks = 0, double norm_zero = 1e-5, double minNormReduction = 0.1, int maxSumMultipliers = 10, double normalization = 0.0001, double away = 0.005, double timeLimit = 60, int maxNumCuts = 10000, int maxNumComputedCuts = 10000, int maxNonzeroesTab = 1000, double columnScalingBoundLAP = 5.0, int skipGomory = 1); /// Copy constructor CglRedSplit2Param(const CglRedSplit2Param &source); /// Clone virtual CglRedSplit2Param* clone() const; /// Assignment operator virtual CglRedSplit2Param& operator=(const CglRedSplit2Param &rhs); /// Destructor virtual ~CglRedSplit2Param(); //@} protected: /**@name Parameters */ //@{ /** Epsilon for value of coefficients when eliminating slack variables. Default: 0.0. */ double EPS_ELIM; /** Value added to the right hand side of each generated cut to relax it. Default: 1e-11 */ double EPS_RELAX_ABS; /** For a generated cut with right hand side rhs_val, EPS_RELAX_EPS * fabs(rhs_val) is used to relax the constraint. Default: 1e-13 */ double EPS_RELAX_REL; // Maximum ratio between largest and smallest non zero // coefficients in a cut. Default: 1e6. double MAXDYN; /// Minimum violation for the current basic solution in a generated cut. /// Default: 1e-3. double MINVIOL; /// Maximum support - relative part of the formula double MAX_SUPP_REL; /// Use integer slacks to generate cuts if USE_INTSLACKS = 1. Default: 0. int USE_INTSLACKS; /// Norm of a vector is considered zero if smaller than normIsZero; /// Default: 1e-5. double normIsZero_; /// Minimum reduction to accept a new row. double minNormReduction_; /// Maximum sum of the vector of row multipliers to generate a cut int maxSumMultipliers_; /// Normalization factor for the norm of lambda in the quadratic /// minimization problem that is solved during the coefficient reduction step double normalization_; /// Use row only if pivot variable should be integer but is more /// than away_ from being integer. Default: 0.005 double away_; /// Maximum number of rows to use for the reduction of a given row. std::vector numRowsReduction_; /// Column selection method std::vector columnSelectionStrategy_; /// Row selection method std::vector rowSelectionStrategy_; /// Maximum number of rows to use for the reduction during Lift & Project std::vector numRowsReductionLAP_; /// Column selection method for Lift & Project std::vector columnSelectionStrategyLAP_; /// Row selection method for Lift & Project std::vector rowSelectionStrategyLAP_; /// Column scaling strategy for the nonbasics columns that were basic in /// the point that we want to cut off (Lift & Project only) ColumnScalingStrategy columnScalingStrategyLAP_; /// Minimum value for column scaling (Lift & Project only) double columnScalingBoundLAP_; /// Time limit double timeLimit_; /// Maximum number of returned cuts int maxNumCuts_; /// Maximum number of computed cuts int maxNumComputedCuts_; /// Maximum number of nonzeroes in tableau row for reduction int maxNonzeroesTab_; /// Skip simple Gomory cuts int skipGomory_; //@} }; #endif CoinMP-1.8.3/Cgl/src/CglMessage.hpp0000644000175000017500000000174212122056610015332 0ustar renerene// $Id: CglMessage.hpp 1105 2013-03-19 12:43:52Z forrest $ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglMessage_H #define CglMessage_H #include "CoinPragma.hpp" // This deals with Cgl messages (as against Osi messages etc) #include "CoinMessageHandler.hpp" enum CGL_Message { CGL_INFEASIBLE, CGL_CLIQUES, CGL_FIXED, CGL_PROCESS_STATS, CGL_SLACKS, CGL_PROCESS_STATS2, CGL_PROCESS_SOS1, CGL_PROCESS_SOS2, CGL_UNBOUNDED, CGL_ELEMENTS_CHANGED1, CGL_ELEMENTS_CHANGED2, CGL_MADE_INTEGER, CGL_ADDED_INTEGERS, CGL_POST_INFEASIBLE, CGL_POST_CHANGED, CGL_GENERAL, CGL_DUMMY_END }; /** This deals with Cgl messages (as against Osi messages etc) */ class CglMessage : public CoinMessages { public: /**@name Constructors etc */ //@{ /** Constructor */ CglMessage(Language language=us_en); //@} }; #endif CoinMP-1.8.3/Cgl/src/config_default.h0000644000175000017500000000170112130104031015712 0ustar renerene /* include the COIN-OR-wide system specific configure header */ #include "configall_system.h" /* include the public project specific macros */ #include "config_cgl_default.h" /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Define to the debug sanity check level (0 is no test) */ #define COIN_CGL_CHECKLEVEL 0 /* Define to the debug verbosity level (0 is no output) */ #define COIN_CGL_VERBOSITY 0 /* Define to 1 if the Clp package is used */ #define COIN_HAS_OSICLP 1 /* Define to 1 if the CoinUtils package is used */ #define COIN_HAS_COINUTILS 1 /* Define to 1 if the Osi package is used */ #define COIN_HAS_OSI 1 /* Define to 1 if the Vol package is used */ #define COIN_HAS_VOL 1 CoinMP-1.8.3/Cgl/src/CglDuplicateRow/0000755000175000017500000000000012600453456015645 5ustar renereneCoinMP-1.8.3/Cgl/src/CglDuplicateRow/Makefile.in0000644000175000017500000005434712506321416017722 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglDuplicateRow DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglDuplicateRow_la_LIBADD = am_libCglDuplicateRow_la_OBJECTS = CglDuplicateRow.lo libCglDuplicateRow_la_OBJECTS = $(am_libCglDuplicateRow_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglDuplicateRow_la_SOURCES) DIST_SOURCES = $(libCglDuplicateRow_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglDuplicateRow # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglDuplicateRow.la # List all source files for this library, including headers libCglDuplicateRow_la_SOURCES = CglDuplicateRow.cpp CglDuplicateRow.hpp # This is for libtool (on Windows) libCglDuplicateRow_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglDuplicateRow.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglDuplicateRow/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglDuplicateRow/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglDuplicateRow.la: $(libCglDuplicateRow_la_OBJECTS) $(libCglDuplicateRow_la_DEPENDENCIES) $(CXXLINK) $(libCglDuplicateRow_la_LDFLAGS) $(libCglDuplicateRow_la_OBJECTS) $(libCglDuplicateRow_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglDuplicateRow.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglDuplicateRow/Makefile.am0000644000175000017500000000321611621724114017675 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglDuplicateRow # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglDuplicateRow.la # List all source files for this library, including headers libCglDuplicateRow_la_SOURCES = CglDuplicateRow.cpp CglDuplicateRow.hpp # This is for libtool (on Windows) libCglDuplicateRow_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglDuplicateRow.hpp CoinMP-1.8.3/Cgl/src/CglDuplicateRow/CglDuplicateRow.hpp0000644000175000017500000001305712130102162021373 0ustar renerene// $Id: CglDuplicateRow.hpp 1119 2013-04-06 20:24:18Z stefan $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglDuplicateRow_H #define CglDuplicateRow_H #include #include "CglCutGenerator.hpp" class CglStored; /** DuplicateRow Cut Generator Class */ class CglDuplicateRow : public CglCutGenerator { public: /**@name Generate Cuts */ //@{ /** Fix variables and find duplicate/dominated rows for the model of the solver interface, si. This is a very simple minded idea but I (JJF) am using it in a project so thought I might as well add it. It should really be called before first solve and I may modify CBC to allow for that. This is designed for problems with few rows and many integer variables where the rhs are <= or == and all coefficients and rhs are small integers. If effective rhs is K then we can fix all variables with coefficients > K to their lower bounds (effective rhs just means original with variables with nonzero lower bounds subtracted out). If one row is a subset of another and the effective rhs are same we can fix some variables and then the two rows are identical. The generator marks identical rows so can be taken out in solve */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); private: /// Does work for modes 1,2 void generateCuts12( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /// Does work for mode 4 void generateCuts4( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); /// Does work for mode 8 void generateCuts8( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); public: /** Fix variables and find duplicate/dominated rows for the model of the solver interface, si. This is a very simple minded idea but I (JJF) am using it in a project so thought I might as well add it. It should really be called before first solve and I may modify CBC to allow for that. This is designed for problems with few rows and many integer variables where the rhs are <= or == and all coefficients and rhs are small integers. If effective rhs is K then we can fix all variables with coefficients > K to their lower bounds (effective rhs just means original with variables with nonzero lower bounds subtracted out). If one row is a subset of another and the effective rhs are same we can fix some variables and then the two rows are identical. This version does deletions and fixings and may return stored cuts for dominated columns */ CglStored * outDuplicates( OsiSolverInterface * solver); //@} /**@name Get information on size of problem */ //@{ /// Get duplicate row list, -1 means still in, -2 means out (all fixed), k>= means same as row k inline const int * duplicate() const { return duplicate_;} /// Size of dynamic program inline int sizeDynamic() const { return sizeDynamic_;} /// Number of rows in original problem inline int numberOriginalRows() const { return matrix_.getNumRows();} //@} /**@name Get information on size of problem */ //@{ /// logLevel inline int logLevel() const { return logLevel_;} inline void setLogLevel(int value) { logLevel_ = value;} //@} /**@name We only check for duplicates amongst rows with effective rhs <= this */ //@{ /// Get inline int maximumRhs() const { return maximumRhs_;} /// Set inline void setMaximumRhs(int value) { maximumRhs_=value;} //@} /**@name We only check for dominated amongst groups of columns whose size <= this */ //@{ /// Get inline int maximumDominated() const { return maximumDominated_;} /// Set inline void setMaximumDominated(int value) { maximumDominated_=value;} //@} /**@name gets and sets */ //@{ /// Get mode inline int mode() const { return mode_;} /// Set mode inline void setMode(int value) { mode_=value;} //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglDuplicateRow (); /// Useful constructor CglDuplicateRow (OsiSolverInterface * solver); /// Copy constructor CglDuplicateRow ( const CglDuplicateRow & rhs); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglDuplicateRow & operator=( const CglDuplicateRow& rhs); /// Destructor virtual ~CglDuplicateRow (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); /// This can be used to refresh any information virtual void refreshSolver(OsiSolverInterface * solver); //@} protected: // Protected member data /**@name Protected member data */ //@{ /// Matrix CoinPackedMatrix matrix_; /// Matrix by row CoinPackedMatrix matrixByRow_; /// Possible rhs (if 0 then not possible) int * rhs_; /// Marks duplicate rows int * duplicate_; /// To allow for <= rows int * lower_; /// Stored cuts if we found dominance cuts CglStored * storedCuts_; /// Check dominated columns if less than this number of candidates int maximumDominated_; /// Check duplicates if effective rhs <= this int maximumRhs_; /// Size of dynamic program int sizeDynamic_; /// 1 do rows, 2 do columns, 3 do both int mode_; /// Controls print out int logLevel_; //@} }; #endif CoinMP-1.8.3/Cgl/src/CglDuplicateRow/CglDuplicateRow.cpp0000644000175000017500000026373512513476617021430 0ustar renerene// $Id: CglDuplicateRow.cpp 1287 2015-04-15 15:02:39Z forrest $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include //#define PRINT_DEBUG //#define CGL_DEBUG #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" #include "OsiRowCutDebugger.hpp" #include "CglDuplicateRow.hpp" #include "CglStored.hpp" //------------------------------------------------------------------- // Generate duplicate row column cuts //------------------------------------------------------------------- void CglDuplicateRow::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) { #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = si.getRowCutDebugger(); if (debugger&&debugger->onOptimalPath(si)) { printf("On optimal path\n"); } #endif // Don't do in tree ? if (info.inTree) { // but do any stored cuts if (storedCuts_) storedCuts_->generateCuts(si,cs,info); return; } if ((mode_&3)!=0) { // bug generateCuts12(si,cs,info); } else if ((mode_&4)!=0) { generateCuts4(si,cs,info); } else { assert ((mode_&8)!=0); generateCuts8(si,cs,info); } } void CglDuplicateRow::generateCuts12(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) { int numberColumns = matrix_.getNumCols(); CoinPackedVector ubs; // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); const double * columnLower = si.getColLower(); const double * columnUpper = si.getColUpper(); int nFree=0; int nOut=0; int nFixed=0; int i; int numberRows=matrix_.getNumRows(); const double * rowLower = si.getRowLower(); const double * rowUpper = si.getRowUpper(); int * effectiveRhs = CoinCopyOfArray(rhs_,numberRows); int * effectiveLower = CoinCopyOfArray(lower_,numberRows); double * effectiveRhs2 = new double [numberRows]; /* For L or G rows - compute effective lower we have to raech */ // mark bad rows - also used for domination for (i=0;i1.0e20) { LorG=2; rhs=rowLower[i]; } int j; for (j=rowStart[i];j0.0) { double bound=columnLower[iColumn]; if (bound>-1.0e20) rhs -= bound*value; else LorG=-1; } else { double bound=columnUpper[iColumn]; if (bound<1.0e20) rhs -= bound*value; else LorG=-1; } } else if (LorG==2) { // need highest contribution if (value<0.0) { double bound=columnLower[iColumn]; if (bound>-1.0e20) rhs -= bound*value; else LorG=-2; } else { double bound=columnUpper[iColumn]; if (bound<1.0e20) rhs -= bound*value; else LorG=-2; } } if (duplicate!=-3) { if (value!=1.0) { duplicate=-3; rhs_[i]=-1000000; //break; } else if (!si.isInteger(iColumn)) { duplicate=-5; } } } duplicate_[i]=duplicate; if (!LorG) { effectiveRhs2[i]=0.0; } else if (LorG<0) { // weak effectiveRhs2[i]=-COIN_DBL_MAX; } else if (LorG==1) { effectiveRhs2[i]=rhs; } else { effectiveRhs2[i]=rhs; } } double * colUpper2 = CoinCopyOfArray(columnUpper,numberColumns); if (!info.pass&&(mode_&2)!=0) { // First look at duplicate or dominated columns double * random = new double[numberRows]; double * sort = new double[numberColumns+1]; if (info.randomNumberGenerator) { const CoinThreadRandom * randomGenerator = info.randomNumberGenerator; for (i=0;i1.0e20) random[i]=0.0; else random[i] = randomGenerator->randomDouble(); } } else { for (i=0;i1.0e20) random[i]=0.0; else random[i] = CoinDrand48(); } } int * which = new int[numberColumns]; int nPossible=0; for ( i=0;ilastValue) { if (i-last<=maximumDominated_&&i>last+1) { // look to see if dominated for (int j=last;j1.0e20) ? element[jj] : -element[jj]; rowGeJ[nGeJ++]=iRow; } } double objValueJ = objective[jColumn]*direction; for (int k=j+1;k0.0) continue; int nEqualK=0; // -2 no good, -1 J dominates K, 0 unknown or equal, 1 K dominates J int dominate=0; // mark int kk; for (kk=0;kk1.0e20) ? element[kk] : -element[kk]; double valueJ = elementGeJ[iRow]; mark[iRow]=0; if (valueJ==valueK) { // equal } else if (valueJ>valueK) { // J would dominate K if (dominate==1) { // no good dominate=-2; break; } else { dominate=-1; } } else { // K would dominate J if (dominate==-1) { // no good dominate=-2; break; } else { dominate=1; } } } } kk=0; if (dominate!=-2) { // unmark and check for (;kkvalueK) { // J would dominate K if (dominate==1) { // no good dominate=-2; break; } else { dominate=-1; } } else { // K would dominate J if (dominate==-1) { // no good dominate=-2; break; } else { dominate=1; } } } mark[iRow]=0; } } // just unmark rest for (;kkobjValueK&&dominate==1) { // say K dominates assert (colUpper2[jColumn]); dominate=1; } else { dominate=0; } if (dominate) { // see if both can be 1 bool canFix=false; for (int jj=0;jj0.0) { minSum += lo*elValue; maxSum += up*elValue; } else { maxSum += lo*elValue; minSum += up*elValue; } } } if (minSum+value>rowUpper[iRow]+1.0e-5) canFix=true; else if (maxSum+valueeffectiveRhs2[iRow]+1.0e-4) { canFix=true; break; } } else { // >= row double valueK = element[kk] + elementGeJ[iRow]; if (valueK0) ? jColumn : kColumn; nFixed++; assert (!columnLower[iColumn]); colUpper2[iColumn]=0.0; ubs.insert(iColumn,0.0); if (iColumn==jColumn) break; // no need to carry on on jColumn } else { int iDominated = (dominate>0) ? jColumn : kColumn; int iDominating = (dominate<0) ? jColumn : kColumn; double els[]={1.0,-1.0}; int inds[2]; inds[0]=iDominating; inds[1]=iDominated; if (!storedCuts_) storedCuts_ = new CglStored(); storedCuts_->addCut(0.0,COIN_DBL_MAX,2,inds,els); } } } } for (jj=0;jjsizeRowCuts() : 0; if (nFixed||numberCuts) printf("** %d fixed and %d cuts from domination\n",nFixed,numberCuts); #endif } delete [] effectiveRhs2; bool infeasible=false; // if we were just doing columns - mark all as bad if ((mode_&1)==0) { for (i=0;i (element[jj]*value); effectiveRhs[iRow] -= static_cast (element[jj]*value); effectiveLower[iRow] -= static_cast (element[jj]*value); } } } for ( i=0;i=0&&element[jj]>effectiveRhs[iRow]) fixed=true; } if (fixed) { nFixed++; colUpper2[i]=columnLower[i]; ubs.insert(i,columnLower[i]); } else { nFree++; } } } // See if anything odd char * check = new char[numberColumns]; memset(check,0,numberColumns); int * which2 = new int[numberColumns]; for (i=0;i (rowUpper[i]); effectiveLower[i] = static_cast (CoinMax(0.0,rowLower[i])); bool goodRow=true; for (int j=rowStart[i];j (value); effectiveLower[i] -= static_cast (value); } else { goodRow=false; } } } if (goodRow) duplicate_[i] = -1; // can have continuous variables now else duplicate_[i] = -3; } else { duplicate_[i] = -3; } } if (duplicate_[i]==-1) { if (effectiveRhs[i]>0) { // leave } else if (effectiveRhs[i]==0) { duplicate_[i]=-2; } else { duplicate_[i]=-3; // leave unless >=1 row if (effectiveLower[i]==1&&rhs_[i]<0.0) duplicate_[i]=-4; } } else { effectiveRhs[i]=-1000; } } // Look at <= rows for (i=0;i=nn&&effectiveLower[i]==rhs_[i]&&effectiveLower[k]==rhs_[k]) { abort(); } } else if (nnsame==nn&&nn2>nn&&effectiveLower[i]==rhs_[i]&&rhs_[i]<=rhs_[k]) { if (logLevel_) printf("row %d strict superset of row %d, fix some in row %d\n", k,i,k); // treat k as duplicate duplicate_[k]=i; // set check for k for ( j=rowStart[k];jnn&&effectiveLower[i]<=0&&rhs_[k]<=rhs_[i]) { if (logLevel_) printf("row %d slack subset of row %d, drop row %d\n", i,k,i); // treat i as duplicate duplicate_[i]=k; } } } } } for (k=0;k=1 rows for (i=0;inn) { // k redundant if (logLevel_) printf("row %d slack superset of row %d, drop row %d\n", k,i,k); // treat k as duplicate duplicate_[k]=i; } else if (nn21.0e30) { if (logLevel_) { printf("Cover row %d %g <= ",i,rowLower[i]); printf("(%d,%g) (%d,%g) ",column0,element0,column1,element1); printf(" <= %g\n",rowUpper[i]); } effectiveRhs[nPossible++]=i; } else { // not at present //printf("NON Cover row %d %g <= ",i,rowLower[i]); //printf("(%d,%g) (%d,%g) ",column0,element0,column1,element1); //printf(" <= %g\n",rowUpper[i]); } } } } if (nPossible) { int * check2 = new int [numberColumns]; CoinFillN(check2,numberColumns,-1); for (int iPossible=0;iPossible1) #endif printf("***Make %d %d %d >=2 and take out rows %d %d %d\n", columnB1,column0,column1, i,k,check2[columnB1]); OsiRowCut rc; rc.setLb(2.0); rc.setUb(COIN_DBL_MAX); int index[3]; double element[3]={1.0,1.0,1.0}; index[0]=column0; index[1]=column1; index[2]=columnB1; rc.setRow(3,index,element,false); cs.insert(rc); // drop rows duplicate_[i]=-2; duplicate_[k]=-2; duplicate_[check2[columnB1]]=-2; } } } for (k=0;k>1; } } } else { duplicate_[i]=-1; } } delete [] effectiveRhs; delete [] effectiveLower; if (logLevel_) printf("%d free (but %d fixed this time), %d out of rhs, DP size %d, %d rows\n", nFree,nFixed,nOut,sizeDynamic_,nRow); if (nFixed) { OsiColCut cc; cc.setUbs(ubs); cc.setEffectiveness(100.0); cs.insert(cc); } if (infeasible) { // generate infeasible cut and return OsiRowCut rc; rc.setLb(COIN_DBL_MAX); rc.setUb(0.0); cs.insert(rc); } } void CglDuplicateRow::generateCuts4(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo ) { int numberColumns = matrix_.getNumCols(); // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); const double * columnLower = si.getColLower(); const double * columnUpper = si.getColUpper(); int nFixed=0; int numberRows=matrix_.getNumRows(); const double * rowLower = si.getRowLower(); const double * rowUpper = si.getRowUpper(); bool infeasible=false; // try more complicated domination int * originalColumns = new int [numberColumns]; int * originalRows = new int [2*numberRows]; int * rowCount = originalRows+numberRows; memset(rowCount,0,numberRows*sizeof(int)); memset(originalRows,0,numberRows*sizeof(int)); unsigned char * rowFlag = new unsigned char[numberRows]; unsigned char * columnFlag = new unsigned char[2*numberColumns]; double * newBound = new double[numberColumns]; double * trueLower = new double[numberColumns]; double * effectiveRhs = new double [2*numberRows]; double *rhs2 = effectiveRhs+numberRows; // first take out fixed stuff memset(rhs2,0,numberRows*sizeof(double)); memset(rowFlag,0,numberRows); memset(columnFlag,0,numberColumns); int nCol2=0; for (int i=0;i-1.0e20) { for (int jj=columnStart[i];jjlo) { int add=0; if (si.isInteger(i)) { columnFlag[nCol2]|=2; if (up>lo+1.5) { add=1; // only allow one general columnFlag[nCol2]|=4; } } else { add=1; } newBound[nCol2]=up-lo; trueLower[nCol2]=lo; originalColumns[nCol2++]=i; for (int jj=columnStart[i];jj1||!nInt) flag=8; // don't look at for now if (rowLower[i]==rowUpper[i]) flag |= 1; else if (rowLower[i]>-1.0e20&&rowUpper[i]<1.0e20) flag |=8; else if (rowUpper[i]>1.0e20) flag |= 2; if ((flag&8)==0) { rowCount[nRow2]=rowCount[i]; originalRows[nRow2++]=i; } } CoinSort_2(rowCount,rowCount+nRow2,originalRows); for (int i=0;i1.0e20) flag |= 2; rowFlag[i]=flag; } if (nRow2&&nCol2) { CoinPackedMatrix small(matrix_,nRow2,originalRows, nCol2,originalColumns); // Column copy small.removeGaps(); double * element = small.getMutableElements(); const int * row = small.getIndices(); const CoinBigIndex * columnStart = small.getVectorStarts(); //const int * columnLength = small.getVectorLengths(); for (int i=0;i=2&&nRowStart<0) nRowStart=nRowLook; if (n>MAX_IN_BASE) break; } // cut back nRow2 int nnRow2=nRowLook; for (nnRow2=0;nnRow2MAX_IN_COMP) break; } nRow2=nnRow2; nRowStart=CoinMax(0,nRowStart); unsigned char * mark = columnFlag+nCol2; memset(mark,0,nCol2); /* at most 3 0-1 integers - if all 0-1 then see if same allowed if one other then get bounds */ double loC0[4]; double upC0[4]; int allowed0[8]; double loC1[4]; double upC1[4]; int allowed1[8]; for (int i=nRowStart;iloRhs-tolerance) allowed0[put]=1; else allowed0[put]=0; } } upRhs = effectiveRhs[k]; loRhs = ((rowFlag[k]&1)!=0) ? effectiveRhs[k] : -1.0e30; tolerance = CoinMax(1.0e-5,fabs(upRhs)*1.0e-10); for (int j0=0;j0<2;j0++) { for (int j1=0;j1<2;j1++) { double value = element1[0]*j0+element1[1]*j1; int put = j0+2*j1; if (valueloRhs-tolerance) allowed1[put]=1; else allowed1[put]=0; } } /* interesting cases are when - one forces fixing (but probably found in probing) and of two is zero and of two forces fixing two same - this is probably only one */ int intersect[4]; bool same=true; bool tighter0=true; bool tighter1=true; bool feasible=false; bool redundant=true; for (int j=0;j<4;j++) { intersect[j]=allowed0[j]&allowed1[j]; if (intersect[j]0.0) printf(" +"); else printf(" "); } int iColumn=column0[j]; if ((columnFlag[iColumn]&2)==0) printf("%g*X%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else if ((columnFlag[iColumn]&(2+4))==2) printf("%g*B%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else printf("%g*I%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); } if ((rowFlag[i]&1)!=0) printf(" == "); else printf(" <= "); printf("%g\n",effectiveRhs[i]); printf("Comp %d (orig %d) ",k,originalRows[k]); for (int j=0;j0.0) printf(" +"); else printf(" "); } int iColumn=column1[j]; if ((columnFlag[iColumn]&2)==0) printf("%g*X%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else if ((columnFlag[iColumn]&(2+4))==2) printf("%g*B%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else printf("%g*I%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); } if ((rowFlag[k]&1)!=0) printf(" == "); else printf(" <= "); printf("%g\n",effectiveRhs[k]); } /* end debug print */ #endif #ifdef CGL_INVESTIGATE printf("**same %c redundant %c feasible %c tight %c,%c fixed %d,%d\n", same ? 'Y' : 'N', redundant ? 'Y' : 'N', feasible ? 'Y' : 'N', tighter0 ? 'Y' : 'N', tighter1 ? 'Y' : 'N', fixed[0],fixed[1]); #endif if (!feasible) { #ifdef CGL_INVESTIGATE printf("QQ infeasible\n"); #endif infeasible=true; } else if (fixed[0]||fixed[1]) { #ifdef CGL_INVESTIGATE printf("QQ fixed\n"); #endif for (int k=0;k<2;k++) { if (fixed[k]) { int iColumn=column0[k]; int kColumn=originalColumns[iColumn]; #ifdef CGL_INVESTIGATE printf("true bounds %g %g\n",columnLower[kColumn], columnUpper[kColumn]); #endif double lo; if (fixed[k]>0) { lo=1.0; } else { lo=0.0; } if ((columnFlag[iColumn]&1)==0) { columnFlag[iColumn] |= 16; trueLower[iColumn] += lo; newBound[iColumn] = 0.0; for (int jj=columnStart[iColumn];jjloRhs-tolerance) allowed0[put]=1; else allowed0[put]=0; } } } upRhs = effectiveRhs[k]; loRhs = ((rowFlag[k]&1)!=0) ? effectiveRhs[k] : -1.0e30; tolerance = CoinMax(1.0e-5,fabs(upRhs)*1.0e-10); for (int j0=0;j0<2;j0++) { for (int j1=0;j1<2;j1++) { for (int j2=0;j2<2;j2++) { double value = element1[0]*j0+element1[1]*j1 +element1[2]*j2; int put = j0+2*j1+4*j2; if (valueloRhs-tolerance) allowed1[put]=1; else allowed1[put]=0; } } } /* interesting cases are when - one forces fixing (but probably found in probing) and of two is zero and of two forces fixing two same - this is probably only one */ int intersect[8]; bool same=true; bool tighter0=true; bool tighter1=true; bool feasible=false; bool redundant=true; for (int j=0;j<8;j++) { intersect[j]=allowed0[j]&allowed1[j]; if (intersect[j]0.0) printf(" +"); else printf(" "); } int iColumn=column0[j]; if ((columnFlag[iColumn]&2)==0) printf("%g*X%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else if ((columnFlag[iColumn]&(2+4))==2) printf("%g*B%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else printf("%g*I%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); } if ((rowFlag[i]&1)!=0) printf(" == "); else printf(" <= "); printf("%g\n",effectiveRhs[i]); printf("Comp %d (orig %d) ",k,originalRows[k]); for (int j=0;j0.0) printf(" +"); else printf(" "); } int iColumn=column1[j]; if ((columnFlag[iColumn]&2)==0) printf("%g*X%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else if ((columnFlag[iColumn]&(2+4))==2) printf("%g*B%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else printf("%g*I%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); } if ((rowFlag[k]&1)!=0) printf(" == "); else printf(" <= "); printf("%g\n",effectiveRhs[k]); } /* end debug print */ #endif #ifdef CGL_INVESTIGATE printf("**same3 %c redundant %c feasible %c tight %c,%c fixed %d,%d,%d\n", same ? 'Y' : 'N', redundant ? 'Y' : 'N', feasible ? 'Y' : 'N', tighter0 ? 'Y' : 'N', tighter1 ? 'Y' : 'N', fixed[0],fixed[1],fixed[2]); #endif if (!feasible) { #ifdef CGL_INVESTIGATE printf("QQ infeasible\n"); #endif infeasible=true; } else if (fixed[0]||fixed[1]||fixed[2]) { #ifdef CGL_INVESTIGATE printf("QQ fixed\n"); #endif for (int k=0;k<3;k++) { if (fixed[k]) { int iColumn=column0[k]; int kColumn=originalColumns[iColumn]; #ifdef CGL_INVESTIGATE printf("true bounds %g %g\n",columnLower[kColumn], columnUpper[kColumn]); #endif double lo; if (fixed[k]>0) { lo=1.0; } else { lo=0.0; } if ((columnFlag[iColumn]&1)==0) { columnFlag[iColumn] |= 16; trueLower[iColumn] += lo; newBound[iColumn] = 0.0; for (int jj=columnStart[iColumn];jj0.0) { valueLo=value; valueHi=value+gap0; } else { valueLo=value+gap0; valueHi=value; } if (valueLoloRhs-tolerance) allowed0[put]=1; else allowed0[put]=0; if (valueLo0.0) { loC0[put]=(loRhs-valueLo)/el0[2]; } else { upC0[put]=bound-((valueLo-loRhs)/el0[2]); } } if (valueHi>upRhs+tolerance) { if (gap0>0.0) { upC0[put]=bound-((valueHi-upRhs)/el0[2]); } else { loC0[put]=(upRhs-valueHi)/el0[2]; } } } } upRhs = effectiveRhs[k]; loRhs = ((rowFlag[k]&1)!=0) ? effectiveRhs[k] : -1.0e30; tolerance = CoinMax(1.0e-5,fabs(upRhs)*1.0e-10); for (int j0=0;j0<2;j0++) { for (int j1=0;j1<2;j1++) { double value = el1[0]*j0+el1[1]*j1; int put = j0+2*j1; double valueLo,valueHi; if (gap1>0.0) { valueLo=value; valueHi=value+gap1; } else { valueLo=value+gap1; valueHi=value; } if (valueLoloRhs-tolerance) allowed1[put]=1; else allowed1[put]=0; if (valueLo0.0) { loC1[put]=(loRhs-valueLo)/el1[2]; } else { upC1[put]=bound-((valueLo-loRhs)/el1[2]); } } if (valueHi>upRhs+tolerance) { if (gap1>0.0) { upC1[put]=bound-((valueHi-upRhs)/el1[2]); } else { loC1[put]=(upRhs-valueHi)/el1[2]; } } } } /* interesting cases are when - one forces fixing (but probably found in probing) and of two is zero and of two forces fixing two same - this is probably only one */ int intersect[4]; bool same=true; bool tighter0=true; bool tighter1=true; bool feasible=false; bool redundant=true; int count=nInt; for (int j=0;j<(1< lo0 %g lo1 %g up0 %g up1 %g", jj,loC0[jj],loC1[jj],upC0[jj],upC1[jj]); #endif if (intersect[jj]) { #ifdef CGL_INVESTIGATE printf("\n"); #endif newLo=CoinMin(newLo,CoinMax(loC0[jj],loC1[jj])); newUp=CoinMax(newUp,CoinMin(upC0[jj],upC1[jj])); } else { #ifdef CGL_INVESTIGATE printf(" INF\n"); #endif loC0[jj]=0.0; loC1[jj]=0.0; upC0[jj]=bound; upC1[jj]=bound; } } } else { for (int jj=0;jj<2;jj++) { for (int jj1=0;jj1<2;jj1++) { int k=jj+2*jj1; #ifdef CGL_INVESTIGATE printf("first int at %d, second at %d -> lo0 %g lo1 %g up0 %g up1 %g", jj,jj1,loC0[k],loC1[k],upC0[k],upC1[k]); #endif if (intersect[k]) { #ifdef CGL_INVESTIGATE printf("\n"); #endif newLo=CoinMin(newLo,CoinMax(loC0[k],loC1[k])); newUp=CoinMax(newUp,CoinMin(upC0[k],upC1[k])); } else { #ifdef CGL_INVESTIGATE printf(" INF\n"); #endif loC0[k]=0.0; loC1[k]=0.0; upC0[k]=bound; upC1[k]=bound; } } } } if (newLo>0.0||newUp1.0e-8) same=false; if (fabs(upC0[jj]-upC1[jj])>1.0e-8) same=false; if (loC0[jj]upC1[jj]+1.0e-12) { tighter0=false; redundant=false; } if (loC1[jj]upC0[jj]+1.0e-12) { tighter1=false; redundant=false; } if (fabs(newLo-loC0[jj])>1.0e-12) redundant=false; if (fabs(newLo-loC1[jj])>1.0e-12) redundant=false; if (fabs(newUp-upC0[jj])>1.0e-12) redundant=false; if (fabs(newUp-upC1[jj])>1.0e-12) redundant=false; } if (same||redundant||!feasible||fixed[0]||fixed[1]|| tighter0||tighter1) { #ifdef CGL_INVESTIGATE /* start debug print */ { printf("Base %d (orig %d) ",i,originalRows[i]); for (int j=0;j0.0) printf(" +"); else printf(" "); } int iColumn=column0[j]; if ((columnFlag[iColumn]&2)==0) printf("%g*X%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else if ((columnFlag[iColumn]&(2+4))==2) printf("%g*B%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else printf("%g*I%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); } if ((rowFlag[i]&1)!=0) printf(" == "); else printf(" <= "); printf("%g\n",effectiveRhs[i]); printf("Comp %d (orig %d) ",k,originalRows[k]); for (int j=0;j0.0) printf(" +"); else printf(" "); } int iColumn=column1[j]; if ((columnFlag[iColumn]&2)==0) printf("%g*X%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else if ((columnFlag[iColumn]&(2+4))==2) printf("%g*B%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); else printf("%g*I%d(%d) (<=%g)",value,iColumn,originalColumns[iColumn],newBound[iColumn]); } if ((rowFlag[k]&1)!=0) printf(" == "); else printf(" <= "); printf("%g\n",effectiveRhs[k]); } /* end debug print */ #endif #ifdef CGL_INVESTIGATE printf("**same %c redundant %c feasible %c tight %c,%c fixed %d,%d\n", same ? 'Y' : 'N', redundant ? 'Y' : 'N', feasible ? 'Y' : 'N', tighter0 ? 'Y' : 'N', tighter1 ? 'Y' : 'N', fixed[0],fixed[1]); #endif //if (nInt>1) //continue; if (!feasible) { #ifdef CGL_INVESTIGATE printf("QQ infeasible\n"); #endif infeasible=true; } else if (fixed[0]||fixed[1]) { #ifdef CGL_INVESTIGATE printf("QQ fixed\n"); #endif for (int k=0;k<2;k++) { if (fixed[k]) { int iColumn=col[k]; int kColumn=originalColumns[iColumn]; #ifdef CGL_INVESTIGATE printf("true bounds %g %g\n",columnLower[kColumn], columnUpper[kColumn]); #endif double lo; if (fixed[k]>0) { lo=1.0; } else { lo=0.0; } if ((columnFlag[iColumn]&1)==0) { columnFlag[iColumn] |= 16; trueLower[iColumn] += lo; newBound[iColumn] = 0.0; for (int jj=columnStart[iColumn];jj0.0&&el1[2]>0.0&& el0[0]>0.0&&el1[0]>0.0&& (rowFlag[k]&1)==0&& (rowFlag[i]&1)==0) { // bounds same at 0 and 1 double up0 = (effectiveRhs[i]-el0[0])/el0[2]; double up1 = (effectiveRhs[k]-el1[0])/el1[2]; if (up00.0) up0=bound0; else lo0=CoinMax(0.0,bound0); double rhs1 =effectiveRhs[k]-el1[0]*value0; double lo1=0.0; double up1=1.0e30; double bound1=rhs1/el1[2]; if (el1[2]>0.0) up1=bound1; else lo1=CoinMax(0.0,bound1); if (fabs(lo0-lo1)>1.0e-8|| fabs(up0-up1)>1.0e-8*(1.0+fabs(up1))) { if (lo0>lo1+1.0e-8) { if (up0up1+1.0e-8) { which=-2; break; } } else if (lo0up0+1.0e-8) { which=-2; break; } } else { if (up1up0+1.0e-8) { // 0 tighter if (which==1) { which=-2; break; } else { which=-1; } } } } } if (which==0) { duplicate_[k]=-2; #ifdef CGL_INVESTIGATE printf("QQ discard one same same k\n"); #endif } else if (which==-1) { duplicate_[k]=-2; #ifdef CGL_INVESTIGATE printf("QQ discard one (i tighter) k\n"); #endif } else if (which==1) { duplicate_[i]=-2; #ifdef CGL_INVESTIGATE printf("QQ discard one (k tighter) i\n"); #endif } else { printf("QQ Can't decide what to do nint==1\n"); } } else { printf("QQ Don't know what to do nint==1\n"); } } } else { if ((rowFlag[k]&1)==0&&(rowFlag[i]&1)==0) { int which=0; for (int i0=0;i0<=10;i0++) { double value0=0.05*i0; for (int i1=0;i1<=10;i1++) { double value1=0.05*i1; double rhs0 =effectiveRhs[i]-el0[0]*value0 -el0[1]*value1; double lo0=0.0; double up0=1.0e30; double bound0=rhs0/el0[2]; if (el0[2]>0.0) up0=bound0; else lo0=CoinMax(0.0,bound0); double rhs1 =effectiveRhs[k]-el1[0]*value0 -el1[1]*value1; double lo1=0.0; double up1=1.0e30; double bound1=rhs1/el1[2]; if (el1[2]>0.0) up1=bound1; else lo1=CoinMax(0.0,bound1); if (fabs(lo0-lo1)>1.0e-8|| fabs(up0-up1)>1.0e-8*(1.0+fabs(up1))) { if (lo0>lo1+1.0e-8) { if (up0up1+1.0e-8) { which=-2; break; } } else if (lo0up0+1.0e-8) { which=-2; break; } } else { if (up1up0+1.0e-8) { // 0 tighter if (which==1) { which=-2; break; } else { which=-1; } } } } } if (which==-2) break; } if (which==0) { duplicate_[k]=-2; #ifdef CGL_INVESTIGATE printf("QQ discard one same same k\n"); #endif } else if (which==-1) { duplicate_[k]=-2; #ifdef CGL_INVESTIGATE printf("QQ discard one (i tighter) k\n"); #endif } else if (which==1) { duplicate_[i]=-2; #ifdef CGL_INVESTIGATE printf("QQ discard one (k tighter) i\n"); #endif } else { printf("QQ Can't decide what to do nint==2\n"); } } else { #ifdef CGL_INVESTIGATE printf("QQ Don't know what to do nint==2\n"); #endif } } } } } } } } } for (int j=0;jcolumnLower[kColumn]+1.0e-7) { nFixed++; lbs.insert(kColumn,lower); //xx->setColLower(kColumn,lower); } if (uppersetColUpper(kColumn,upper); } } else { // integer if (lower>columnLower[kColumn]+1.0e-7) { nFixed++; lower = ceil(lower); //xx->setColLower(kColumn,lower); lbs.insert(kColumn,lower); } if (uppersetColUpper(kColumn,upper); ubs.insert(kColumn,upper); } } if (lower>upper+1.0e-7) infeasible=true; //printf("Bounds for %d are %g and %g, were %g %g\n", // kColumn, // xx->getColLower()[kColumn], // xx->getColUpper()[kColumn], // si.getColLower()[kColumn], // si.getColUpper()[kColumn]); } } //if (!infeasible) { //si.writeMps("si"); //xx->writeMps("xx"); //xx->resolve(); //assert (xx->isProvenOptimal()); //printf("obj value %g %g\n",si.getObjValue(),xx->getObjValue()); //} //delete xx; // Move duplicate flags int * temp = reinterpret_cast(effectiveRhs); for (int i=0;iiColumn2) { return false; } else { where1++; where2++; } } if (where1==row1.end_) return false; else return true; } }; static int * lexSort(int numberCliques, int * cliqueStart, int * entry) { CglOneRow * rows = new CglOneRow [numberCliques]; for (int i=0;iiValue||position[kClique]jFirst) { // mark all apart from lowest number as duplicate and move on // use cliqueType lastDone =jClique-1; for (jClique=jFirst;jClique<=lastDone;jClique++) { int kClique = which [jClique]; if (kClique!=iLowest) { statusClique[kClique]=-2; nDup++; nSave += cliqueStart[kClique+1]-cliqueStart[kClique]; } } } } } #if 1 for (int jClique=0;jClique10 printf("clique %d is subset of %d\n",kClique,iClique); printf("Kclique %d ",kClique); for (int j=cliqueStart[kClique];jiValue||position[kClique]jFirst) { // mark all apart from lowest number as duplicate and move on // use cliqueType lastDone =jClique-1; for (jClique=jFirst;jClique<=lastDone;jClique++) { int kClique = which [jClique]; if (kClique!=iLowest) { statusClique[kClique]=-2; nDup++; nSave += cliqueStart[kClique+1]-cliqueStart[kClique]; } } } } } #if 0 for (int jClique=0;jCliqueentry[cliqueStart[iClique+1]-1]) { statusClique[iClique]=numberIntegers; continue; } } if (iValuekValue) continue; // not a candidate // See if subset (remember duplicates have gone) if (cliqueStart[iClique+1]-position[iClique]> cliqueStart[kClique+1]-cliqueStart[kClique]) { // could be subset ? int offset = cliqueStart[iClique]-position[kClique]; int j; bool subset=true; // what about different fixes bool odd=false; for (j=cliqueStart[kClique];j1) printf("clique %d is subset of %d\n",kClique,iClique); if (!ppp&&false) { ppp=true; printf("Kclique %d ",kClique); for (int j=cliqueStart[kClique];jgetIndices(); const double * elementByRow = rowCopy->getElements(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * lower = si.getColLower(); const double * upper = si.getColUpper(); const double * rowLower = si.getRowLower(); const double * rowUpper = si.getRowUpper(); // Find 0-1 variables int numberIntegers=0; int numberColumns=si.getNumCols(); int * backward = new int [numberColumns]; for (int i=0;i (floor(upperValue+1.0e-5)); int iLower = static_cast (ceil(lowerValue-1.0e-5)); int state=0; if (upperValue<1.0e6) { if (iUpper==1) state=1; else if (iUpper==0) state=2; else if (iUpper<0) state=3; if (fabs(static_cast (iUpper)-upperValue)>1.0e-9) state =-1; } if (!state&&lowerValue>-1.0e6) { if (-iLower==1-numberP1) state=-1; else if (-iLower==-numberP1) state=-2; else if (-iLower<-numberP1) state=-3; if (fabs(static_cast (iLower)-lowerValue)>1.0e-9) state =-1; } if (numberP1<2) state=-1; if (good&&state>0) { if (abs(state)==3) { // infeasible printf("FFF Infeasible\n");; feasible=false; break; } else if (abs(state)==2) { // we can fix all //numberFixed += numberP1+numberM1; printf("FFF can fix %d\n",numberP1); } else { for (j=0;j=0&&fixed[i01]==-1) { ubs.insert(i,0.0); nFixed++; } } for (iRow=0;iRow=0) fixed[iClique]=iRow; } int * dup2 = new int [2*numberRows]; int * used2 = dup2+numberRows; int * used = dups+numberCliques; for (iRow=0;iRow=0) { dup2[iRow] = dups[iClique]; int which = used[iClique]; if (which>=0&&whichgetMatrixByCol(); matrix_.removeGaps(); matrix_.orderMatrix(); matrixByRow_ = *solver->getMatrixByRow(); int numberRows=matrix_.getNumRows(); rhs_ = new int[numberRows]; duplicate_ = new int[numberRows]; lower_ = new int[numberRows]; const double * columnLower = solver->getColLower(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); int iRow; int numberGood=0; int markBad = -(solver->getNumCols()+1); for (iRow=0;iRow (floor(rowUpper[iRow])); // check elements bool good=true; for (int j=rowStart[iRow];jisInteger(iColumn)) good=false; double value = elementByRow[j]; if (floor(value)!=value||value<1.0) { good=false; } } if (good) { lower_[iRow] = static_cast (CoinMax(0.0,ceil(rowLower[iRow]))); if (iRhs>=lower_[iRow]) { rhs_[iRow]=iRhs; numberGood++; } else { // infeasible ? lower_[iRow]=markBad; rhs_[iRow]=markBad; } } else { lower_[iRow]=markBad; rhs_[iRow]=markBad; } } else if (rowUpper[iRow]>1.0e30&&rowLower[iRow]==1.0) { // may be OK to look for dominated in >=1 rows // check elements bool good=true; for (int j=rowStart[iRow];jisInteger(iColumn)) good=false; double value = elementByRow[j]; if (floor(value)!=value||value<1.0) { good=false; } if (columnLower[iColumn]!=0.0) good=false; } if (good) { lower_[iRow] = 1; } } } } /** Fix variables and find duplicate/dominated rows for the model of the solver interface, si. This is a very simple minded idea but I (JJF) am using it in a project so thought I might as well add it. It should really be called before first solve and I may modify CBC to allow for that. This is designed for problems with few rows and many integer variables where the rhs are <= or == and all coefficients and rhs are small integers. If effective rhs is K then we can fix all variables with coefficients > K to their lower bounds (effective rhs just means original with variables with nonzero lower bounds subtracted out). If one row is a subset of another and the effective rhs are same we can fix some variables and then the two rows are identical. This version does deletions and fixings and may return stored cuts for dominated columns */ CglStored * CglDuplicateRow::outDuplicates( OsiSolverInterface * solver) { CglTreeInfo info; info.level = 0; info.pass = 0; int numberRows = solver->getNumRows(); info.formulation_rows = numberRows; info.inTree = false; info.strengthenRow= NULL; info.pass = 0; OsiCuts cs; generateCuts(*solver,cs,info); // Get rid of duplicate rows int * which = new int[numberRows]; int numberDrop=0; for (int iRow=0;iRow=0) which[numberDrop++]=iRow; } if (numberDrop) { solver->deleteRows(numberDrop,which); } delete [] which; // see if we have any column cuts int numberColumnCuts = cs.sizeColCuts() ; const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); for (int k = 0;klbs() ; const CoinPackedVector & ubs = thisCut->ubs() ; int j ; int n ; const int * which ; const double * values ; n = lbs.getNumElements() ; which = lbs.getIndices() ; values = lbs.getElements() ; for (j = 0;jcolumnLower[iColumn]) solver->setColLower(iColumn,values[j]) ; } n = ubs.getNumElements() ; which = ubs.getIndices() ; values = ubs.getElements() ; for (j = 0;jsetColUpper(iColumn,values[j]) ; } } return storedCuts_; } // Create C++ lines to get to current state std::string CglDuplicateRow::generateCpp( FILE * fp) { CglDuplicateRow other; fprintf(fp,"0#include \"CglDuplicateRow.hpp\"\n"); fprintf(fp,"3 CglDuplicateRow duplicateRow;\n"); if (logLevel_!=other.logLevel_) fprintf(fp,"3 duplicateRow.setLogLevel(%d);\n",logLevel_); else fprintf(fp,"4 duplicateRow.setLogLevel(%d);\n",logLevel_); if (maximumRhs_!=other.maximumRhs_) fprintf(fp,"3 duplicateRow.setMaximumRhs(%d);\n",maximumRhs_); else fprintf(fp,"4 duplicateRow.setMaximumRhs(%d);\n",maximumRhs_); if (maximumDominated_!=other.maximumDominated_) fprintf(fp,"3 duplicateRow.setMaximumDominated(%d);\n",maximumDominated_); else fprintf(fp,"4 duplicateRow.setMaximumDominated(%d);\n",maximumDominated_); if (mode_!=other.mode_) fprintf(fp,"3 duplicateRow.setMode(%d);\n",mode_); else fprintf(fp,"4 duplicateRow.setMode(%d);\n",mode_); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 duplicateRow.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 duplicateRow.setAggressiveness(%d);\n",getAggressiveness()); return "duplicateRow"; } CoinMP-1.8.3/Cgl/src/CglConfig.h0000644000175000017500000000253711574132374014632 0ustar renerene/* Copyright (C) 2011 * All Rights Reserved. * This code is published under the Eclipse Public License. * * $Id: CglConfig.h 1024 2011-06-09 11:56:44Z stefan $ * * Include file for the configuration of Cgl. * * On systems where the code is configured with the configure script * (i.e., compilation is always done with HAVE_CONFIG_H defined), this * header file includes the automatically generated header file, and * undefines macros that might configure with other Config.h files. * * On systems that are compiled in other ways (e.g., with the * Developer Studio), a header files is included to define those * macros that depend on the operating system and the compiler. The * macros that define the configuration of the particular user setting * (e.g., presence of other COIN-OR packages or third party code) are set * by the files config_*default.h. The project maintainer needs to remember * to update these file and choose reasonable defines. * A user can modify the default setting by editing the config_*default.h files. * */ #ifndef __CGLCONFIG_H__ #define __CGLCONFIG_H__ #ifdef HAVE_CONFIG_H #ifdef CGL_BUILD #include "config.h" #else #include "config_cgl.h" #endif #else /* HAVE_CONFIG_H */ #ifdef CGL_BUILD #include "config_default.h" #else #include "config_cgl_default.h" #endif #endif /* HAVE_CONFIG_H */ #endif /*__CGLCONFIG_H__*/ CoinMP-1.8.3/Cgl/src/config_cgl.h.in0000644000175000017500000000051612130104031015443 0ustar renerene/* src/config_cgl.h.in. */ #ifndef __CONFIG_CGL_H__ #define __CONFIG_CGL_H__ /* Version number of project */ #undef CGL_VERSION /* Major Version number of project */ #undef CGL_VERSION_MAJOR /* Minor Version number of project */ #undef CGL_VERSION_MINOR /* Release Version number of project */ #undef CGL_VERSION_RELEASE #endif CoinMP-1.8.3/Cgl/src/CglSimpleRounding/0000755000175000017500000000000012600453456016202 5ustar renereneCoinMP-1.8.3/Cgl/src/CglSimpleRounding/Makefile.in0000644000175000017500000005464512506321416020260 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/CglSimpleRounding DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cgl.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCglSimpleRounding_la_LIBADD = am_libCglSimpleRounding_la_OBJECTS = CglSimpleRounding.lo \ CglSimpleRoundingTest.lo libCglSimpleRounding_la_OBJECTS = \ $(am_libCglSimpleRounding_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCglSimpleRounding_la_SOURCES) DIST_SOURCES = $(libCglSimpleRounding_la_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(includecoindir)" includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CGLLIB_CFLAGS = @CGLLIB_CFLAGS@ CGLLIB_CFLAGS_INSTALLED = @CGLLIB_CFLAGS_INSTALLED@ CGLLIB_DEPENDENCIES = @CGLLIB_DEPENDENCIES@ CGLLIB_LIBS = @CGLLIB_LIBS@ CGLLIB_LIBS_INSTALLED = @CGLLIB_LIBS_INSTALLED@ CGLLIB_PCLIBS = @CGLLIB_PCLIBS@ CGLLIB_PCREQUIRES = @CGLLIB_PCREQUIRES@ CGL_SUBDIRS = @CGL_SUBDIRS@ CGL_SUBLIBS = @CGL_SUBLIBS@ CGL_SVN_REV = @CGL_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_OSICLP_FALSE = @COIN_HAS_OSICLP_FALSE@ COIN_HAS_OSICLP_TRUE = @COIN_HAS_OSICLP_TRUE@ COIN_HAS_OSICPX_FALSE = @COIN_HAS_OSICPX_FALSE@ COIN_HAS_OSICPX_TRUE = @COIN_HAS_OSICPX_TRUE@ COIN_HAS_OSIDYLP_FALSE = @COIN_HAS_OSIDYLP_FALSE@ COIN_HAS_OSIDYLP_TRUE = @COIN_HAS_OSIDYLP_TRUE@ COIN_HAS_OSIGLPK_FALSE = @COIN_HAS_OSIGLPK_FALSE@ COIN_HAS_OSIGLPK_TRUE = @COIN_HAS_OSIGLPK_TRUE@ COIN_HAS_OSIMSK_FALSE = @COIN_HAS_OSIMSK_FALSE@ COIN_HAS_OSIMSK_TRUE = @COIN_HAS_OSIMSK_TRUE@ COIN_HAS_OSIVOL_FALSE = @COIN_HAS_OSIVOL_FALSE@ COIN_HAS_OSIVOL_TRUE = @COIN_HAS_OSIVOL_TRUE@ COIN_HAS_OSIXPR_FALSE = @COIN_HAS_OSIXPR_FALSE@ COIN_HAS_OSIXPR_TRUE = @COIN_HAS_OSIXPR_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICLP_CFLAGS = @OSICLP_CFLAGS@ OSICLP_CFLAGS_INSTALLED = @OSICLP_CFLAGS_INSTALLED@ OSICLP_DATA = @OSICLP_DATA@ OSICLP_DATA_INSTALLED = @OSICLP_DATA_INSTALLED@ OSICLP_DEPENDENCIES = @OSICLP_DEPENDENCIES@ OSICLP_LIBS = @OSICLP_LIBS@ OSICLP_LIBS_INSTALLED = @OSICLP_LIBS_INSTALLED@ OSICPX_CFLAGS = @OSICPX_CFLAGS@ OSICPX_CFLAGS_INSTALLED = @OSICPX_CFLAGS_INSTALLED@ OSICPX_DATA = @OSICPX_DATA@ OSICPX_DATA_INSTALLED = @OSICPX_DATA_INSTALLED@ OSICPX_DEPENDENCIES = @OSICPX_DEPENDENCIES@ OSICPX_LIBS = @OSICPX_LIBS@ OSICPX_LIBS_INSTALLED = @OSICPX_LIBS_INSTALLED@ OSIDYLP_CFLAGS = @OSIDYLP_CFLAGS@ OSIDYLP_CFLAGS_INSTALLED = @OSIDYLP_CFLAGS_INSTALLED@ OSIDYLP_DATA = @OSIDYLP_DATA@ OSIDYLP_DATA_INSTALLED = @OSIDYLP_DATA_INSTALLED@ OSIDYLP_DEPENDENCIES = @OSIDYLP_DEPENDENCIES@ OSIDYLP_LIBS = @OSIDYLP_LIBS@ OSIDYLP_LIBS_INSTALLED = @OSIDYLP_LIBS_INSTALLED@ OSIGLPK_CFLAGS = @OSIGLPK_CFLAGS@ OSIGLPK_CFLAGS_INSTALLED = @OSIGLPK_CFLAGS_INSTALLED@ OSIGLPK_DATA = @OSIGLPK_DATA@ OSIGLPK_DATA_INSTALLED = @OSIGLPK_DATA_INSTALLED@ OSIGLPK_DEPENDENCIES = @OSIGLPK_DEPENDENCIES@ OSIGLPK_LIBS = @OSIGLPK_LIBS@ OSIGLPK_LIBS_INSTALLED = @OSIGLPK_LIBS_INSTALLED@ OSIMSK_CFLAGS = @OSIMSK_CFLAGS@ OSIMSK_CFLAGS_INSTALLED = @OSIMSK_CFLAGS_INSTALLED@ OSIMSK_DATA = @OSIMSK_DATA@ OSIMSK_DATA_INSTALLED = @OSIMSK_DATA_INSTALLED@ OSIMSK_DEPENDENCIES = @OSIMSK_DEPENDENCIES@ OSIMSK_LIBS = @OSIMSK_LIBS@ OSIMSK_LIBS_INSTALLED = @OSIMSK_LIBS_INSTALLED@ OSIVOL_CFLAGS = @OSIVOL_CFLAGS@ OSIVOL_CFLAGS_INSTALLED = @OSIVOL_CFLAGS_INSTALLED@ OSIVOL_DATA = @OSIVOL_DATA@ OSIVOL_DATA_INSTALLED = @OSIVOL_DATA_INSTALLED@ OSIVOL_DEPENDENCIES = @OSIVOL_DEPENDENCIES@ OSIVOL_LIBS = @OSIVOL_LIBS@ OSIVOL_LIBS_INSTALLED = @OSIVOL_LIBS_INSTALLED@ OSIXPR_CFLAGS = @OSIXPR_CFLAGS@ OSIXPR_CFLAGS_INSTALLED = @OSIXPR_CFLAGS_INSTALLED@ OSIXPR_DATA = @OSIXPR_DATA@ OSIXPR_DATA_INSTALLED = @OSIXPR_DATA_INSTALLED@ OSIXPR_DEPENDENCIES = @OSIXPR_DEPENDENCIES@ OSIXPR_LIBS = @OSIXPR_LIBS@ OSIXPR_LIBS_INSTALLED = @OSIXPR_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglSimpleRounding # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglSimpleRounding.la # List all source files for this library, including headers libCglSimpleRounding_la_SOURCES = CglSimpleRounding.cpp CglSimpleRounding.hpp CglSimpleRoundingTest.cpp # This is for libtool (on Windows) libCglSimpleRounding_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglSimpleRounding.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/CglSimpleRounding/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/CglSimpleRounding/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(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 libCglSimpleRounding.la: $(libCglSimpleRounding_la_OBJECTS) $(libCglSimpleRounding_la_DEPENDENCIES) $(CXXLINK) $(libCglSimpleRounding_la_LDFLAGS) $(libCglSimpleRounding_la_OBJECTS) $(libCglSimpleRounding_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglSimpleRounding.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CglSimpleRoundingTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am .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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-man 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 uninstall-includecoinHEADERS \ uninstall-info-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: CoinMP-1.8.3/Cgl/src/CglSimpleRounding/Makefile.am0000644000175000017500000000326411621724114020235 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1040 2011-08-14 10:49:48Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCglSimpleRounding # ######################################################################## # Name of the library compiled in this directory. We don't want it to be # installed since it will be collected into the libCgl library noinst_LTLIBRARIES = libCglSimpleRounding.la # List all source files for this library, including headers libCglSimpleRounding_la_SOURCES = CglSimpleRounding.cpp CglSimpleRounding.hpp CglSimpleRoundingTest.cpp # This is for libtool (on Windows) libCglSimpleRounding_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = CglSimpleRounding.hpp CoinMP-1.8.3/Cgl/src/CglSimpleRounding/CglSimpleRounding.cpp0000644000175000017500000004034112130103340022253 0ustar renerene// $Id: CglSimpleRounding.cpp 1120 2013-04-06 20:34:40Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include "CoinPragma.hpp" #include "CglSimpleRounding.hpp" #include "CoinPackedVector.hpp" #include "CoinSort.hpp" #include "CoinPackedMatrix.hpp" //------------------------------------------------------------- void CglSimpleRounding::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo /*info*/) { int nRows=si.getNumRows(); // number of rows in the coefficient matrix int nCols=si.getNumCols(); // number of columns in the coefficient matrix int rowIndex; // index into the constraint matrix stored in row // order CoinPackedVector irow; // "integer row": working space to hold the integer // <= inequality derived from the rowIndex-th // constraint double b=0; // working space for the rhs of integer <= inequality bool * negative= new bool[nCols]; // negative[i]= true if coefficient of the // ith variable is negative and false // otherwise int k; // dummy iterator variable for ( k=0; kgetVector(rowIndex), irow, b, negative)) { // Reset local data for the next iteration of the rowIndex-loop for(k=0; k=0) { xInt = new int[irow.getNumElements()]; double dxInt; // a double version of xInt for error trapping #ifdef CGL_DEBUG printf("The (double) coefficients and their integer-ized counterparts:\n"); #endif for (k=0; k (dxInt+0.5); // Need to add the 0.5 // so that a dxInt=9.999 will give a xInt=1 #ifdef CGL_DEBUG printf("%g %g \n",irow.getElements()[k],dxInt); #endif } } else { // If overflow is detected, one warning message is printed and // the row is skipped. #ifdef CGL_DEBUG printf("SimpleRounding: Warning: Overflow detected \n"); printf(" on %i of vars in processing row %i. Row skipped.\n", -power, rowIndex); #endif // reset local data for next iteration for(k=0; k epsilon_){ // if the cut and row are different. OsiRowCut rc; rc.setRow(cut.getNumElements(),cut.getIndices(),cut.getElements()); rc.setLb(-COIN_DBL_MAX); rc.setUb(cutRhs); cs.insert(rc); #ifdef CGL_DEBUG printf("Row %i had a simple rounding cut:\n",rowIndex); printf("Cut size: %i Cut rhs: %g Index Element \n", cut.getNumElements(), cutRhs); for (k=0; kepsilon_){ // and the continuous variable has a finite lower bound if (collower[matrixRow.getIndices()[i]] > -si.getInfinity()){ // then replace the variable with its lower bound. b=b-(sign*matrixRow.getElements()[i]*collower[matrixRow.getIndices()[i]]); } else return 0; } // else the coefficient is essentially an explicitly stored zero; do // nothing } // else: the variable is integer else{ // if the integer variable is fixed, net it out of the integer inequality if (colupper[matrixRow.getIndices()[i]]- collower[matrixRow.getIndices()[i]]< epsilon_){ b=b-(sign*matrixRow.getElements()[i]*colupper[matrixRow.getIndices()[i]]); } // else the variable is a free integer variable and it becomes // part of the integer inequality else { irow.insert(matrixRow.getIndices()[i],sign*matrixRow.getElements()[i]); } } } // if there are no free integer variables, then abandon this row; if(irow.getNumElements() == 0){ return 0; } // Store the values and the signs of the coefficients separately. // irow.elements stores the absolute values of the coefficients // negative indicates the sign. // Note: after this point b is essentially the effecitve rhs of a le // contraint { const int s = irow.getNumElements(); const int * indices = irow.getIndices(); double * elements = irow.getElements(); for(i=0; i 0 ); int i; // loop iterator int maxPower=0; // maximum power of 10 used to convert any x[i] to an // integer // this is the number we are after. int power = 0; // power of 10 used to convert a particular x[i] to an // integer #ifdef OLD_MULT double intPart; // the integer part of the number #endif double fracPart; // the fractional part of the number // we keep multiplying by 10 until the fractional part is 0 // (well, really just until the factional part is less than // dataTol) // JJF - code seems to fail sometimes as multiplying by 10 - so // definition of dataTol changed - see header file const double multiplier[16]={1.0,1.0e1,1.0e2,1.0e3,1.0e4,1.0e5, 1.0e6,1.0e7,1.0e8,1.0e9,1.0e10,1.0e11, 1.0e12,1.0e13,1.0e14,1.0e15}; // Loop through every element in the array in x for (i=0; i2147483647) { #ifdef CGL_DEBUG printf("Overflow %g => %g, power %d\n",x[i],scaledValue,power); #endif return -1; } #endif #ifdef CGL_DEBUG printf("The smallest power of 10 to make %g integral = %i\n",x[i],power); #endif // keep track of the largest power needed so that at the end of the for // loop // x[i]*10**maxPower will be integral for all i if (maxPower < power) maxPower=power; } return maxPower; } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglSimpleRounding::CglSimpleRounding () : CglCutGenerator(), epsilon_(1.0e-08) { // nothing to do here } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglSimpleRounding::CglSimpleRounding ( const CglSimpleRounding & source) : CglCutGenerator(source), epsilon_(source.epsilon_) { // Nothing to do here } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglSimpleRounding::clone() const { return new CglSimpleRounding(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglSimpleRounding::~CglSimpleRounding () { // Nothing to do here } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglSimpleRounding & CglSimpleRounding::operator=( const CglSimpleRounding& rhs) { if (this != &rhs) { CglCutGenerator::operator=(rhs); epsilon_=rhs.epsilon_; } return *this; } // Create C++ lines to get to current state std::string CglSimpleRounding::generateCpp( FILE * fp) { CglSimpleRounding other; fprintf(fp,"0#include \"CglSimpleRounding.hpp\"\n"); fprintf(fp,"3 CglSimpleRounding simpleRounding;\n"); if (getAggressiveness()!=other.getAggressiveness()) fprintf(fp,"3 simpleRounding.setAggressiveness(%d);\n",getAggressiveness()); else fprintf(fp,"4 simpleRounding.setAggressiveness(%d);\n",getAggressiveness()); return "simpleRounding"; } CoinMP-1.8.3/Cgl/src/CglSimpleRounding/CglSimpleRoundingTest.cpp0000644000175000017500000001034012130103340023107 0ustar renerene// $Id: CglSimpleRoundingTest.cpp 1120 2013-04-06 20:34:40Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CglSimpleRounding.hpp" #include //-------------------------------------------------------------------------- // test the simple rounding cut generators methods. void CglSimpleRoundingUnitTest( const OsiSolverInterface * baseSiP, const std::string mpsDir ) { // Test default constructor { CglSimpleRounding cg; } // Test copy & assignment { CglSimpleRounding rhs; { CglSimpleRounding cg; CglSimpleRounding cgC(cg); rhs=cg; } } // Test gcd and gcdn { CglSimpleRounding cg; int v = cg.gcd(122,356); assert(v==2); v=cg.gcd(356,122); assert(v==2); v=cg.gcd(54,67); assert(v==1); v=cg.gcd(67,54); assert(v==1); v=cg.gcd(485,485); assert(v==485); v=cg.gcd(17*13,17*23); assert( v==17); v=cg.gcd(17*13*5,17*23); assert( v==17); v=cg.gcd(17*13*23,17*23); assert(v==17*23); int a[4] = {12, 20, 32, 400}; v= cg.gcdv(4,a); assert(v== 4); int b[4] = {782, 4692, 51, 2754}; v= cg.gcdv(4,b); assert(v== 17); int c[4] = {50, 40, 30, 10}; v= cg.gcdv(4,c); assert(v== 10); } // Test generate cuts method on exmip1.5.mps { CglSimpleRounding cg; OsiSolverInterface * siP = baseSiP->clone(); std::string fn = mpsDir+"exmip1.5.mps"; siP->readMps(fn.c_str(),""); OsiCuts cuts; cg.generateCuts(*siP,cuts); // there should be 3 cuts int nRowCuts = cuts.sizeRowCuts(); assert(nRowCuts==3); // get the last "sr"=simple rounding cut that was derived OsiRowCut srRowCut2 = cuts.rowCut(2); CoinPackedVector srRowCutPV2 = srRowCut2.row(); // this is what the last cut should look like: i.e. the "solution" const int solSize = 2; int solCols[solSize]={2,3}; double solCoefs[solSize]={5.0, 4.0}; OsiRowCut solRowCut; solRowCut.setRow(solSize,solCols,solCoefs); solRowCut.setLb(-COIN_DBL_MAX); solRowCut.setUb(2.0); // Test for equality between the derived cut and the solution cut // Note: testing two OsiRowCuts are equal invokes testing two // CoinPackedVectors are equal which invokes testing two doubles // are equal. Usually not a good idea to test that two doubles are equal, // but in this cut the "doubles" represent integer values. Also allow that // different solvers have different orderings in packed vectors, which may // not match the ordering defined for solRowCut. assert(srRowCut2.OsiCut::operator==(solRowCut)) ; assert(srRowCut2.row().isEquivalent(solRowCut.row())) ; assert(srRowCut2.lb() == solRowCut.lb()) ; assert(srRowCut2.ub() == solRowCut.ub()) ; delete siP; } // Test generate cuts method on p0033 { CglSimpleRounding cg; OsiSolverInterface * siP = baseSiP->clone(); std::string fn = mpsDir+"p0033"; siP->readMps(fn.c_str(),"mps"); OsiCuts cuts; cg.generateCuts(*siP,cuts); // p0033 is the optimal solution to p0033 int objIndices[14] = { 0, 6, 7, 9, 13, 17, 18, 22, 24, 25, 26, 27, 28, 29 }; CoinPackedVector p0033(14,objIndices,1.0); // test that none of the generated cuts // chops off the optimal solution int nRowCuts = cuts.sizeRowCuts(); OsiRowCut rcut; CoinPackedVector rpv; int i; for (i=0; iinitialSolve(); double lpRelaxBefore=siP->getObjValue(); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("Final LP min=%f\n\n",lpRelaxAfter); #endif assert( lpRelaxBefore < lpRelaxAfter ); delete siP; } } CoinMP-1.8.3/Cgl/src/CglSimpleRounding/CglSimpleRounding.hpp0000644000175000017500000001243212231270471022274 0ustar renerene// $Id: CglSimpleRounding.hpp 1149 2013-10-21 18:23:53Z tkr $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglSimpleRounding_H #define CglSimpleRounding_H #include #include "CglCutGenerator.hpp" #include "CoinPackedMatrix.hpp" /** Simple Rounding Cut Generator Class This class generates simple rounding cuts via the following method: For each contraint, attempt to derive a <= inequality in all integer variables by netting out any continuous variables. Divide the resulting integer inequality through by the greatest common denomimator (gcd) of the lhs coefficients. Round down the rhs. Warning: Use with careful attention to data precision. (Reference: Nemhauser and Wolsey, Integer and Combinatorial Optimization, 1988, pg 211.) */ class CglSimpleRounding : public CglCutGenerator { friend void CglSimpleRoundingUnitTest(const OsiSolverInterface * siP, const std::string mpdDir ); public: /**@name Generate Cuts */ //@{ /** Generate simple rounding cuts for the model accessed through the solver interface. Insert generated cuts into the cut set cs. */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglSimpleRounding (); /// Copy constructor CglSimpleRounding ( const CglSimpleRounding &); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglSimpleRounding & operator=( const CglSimpleRounding& rhs); /// Destructor virtual ~CglSimpleRounding (); /// Create C++ lines to get to current state virtual std::string generateCpp( FILE * fp); //@} private: // Private member methods /**@name Private methods */ //@{ /// Derive a <= inequality in integer variables from the rowIndex-th constraint bool deriveAnIntegerRow( const OsiSolverInterface & si, int rowIndex, const CoinShallowPackedVector & matrixRow, CoinPackedVector & irow, double & b, bool * negative) const; /** Given a vector of doubles, x, with size elements and a positive tolerance, dataTol, this method returns the smallest power of 10 needed so that x[i]*10**power "is integer" for all i=0,...,size-1. ** change of definition of dataTol so that it refers to original data, not to scaled data as that seems to lead to problems. So if xScaled is x[i]*10**power and xInt is rounded(xScaled) then fabs(xScaled-xInt) <= dataTol*10**power. This means that dataTol should be smaller - say 1.0e-12 rather tahn 1.0e-8 Returns -number of times overflowed if the power is so big that it will cause overflow (i.e. integer stored will be bigger than 2**31). Test in cut generator. */ int power10ToMakeDoubleAnInt( int size, // the length of the vector x const double * x, double dataTol ) const; // the precision of the data, i.e. the positive // epsilon, which is equivalent to zero /**@name Greatest common denominators methods */ //@{ /// Returns the greatest common denominator of two positive integers, a and b. inline int gcd(int a, int b) const; /** Returns the greatest common denominator of a vector of positive integers, vi, of length n. */ inline int gcdv(int n, const int * const vi) const; //@} //@} /**@name Private member data */ //@{ /// A value within an epsilon_ neighborhood of 0 is considered to be 0. double epsilon_; //@} }; //------------------------------------------------------------------- // Returns the greatest common denominator of two // positive integers, a and b, found using Euclid's algorithm //------------------------------------------------------------------- int CglSimpleRounding::gcd(int a, int b) const { if(a > b) { // Swap a and b int temp = a; a = b; b = temp; } int remainder = b % a; if (remainder == 0) return a; else return gcd(remainder,a); } //------------------------------------------------------------------- // Returns the greatest common denominator of a vector of // positive integers, vi, of length n. //------------------------------------------------------------------- int CglSimpleRounding::gcdv(int n, const int* const vi) const { if (n==0) abort(); if (n==1) return vi[0]; int retval=gcd(vi[0], vi[1]); for (int i=2; i #define REMOVE_LOG 0 namespace LAP { #ifdef LAP_ADD_MSG #error "Macro ADD_MSG already defined" #endif #define LAP_ADD_MSG(Id,Type,Level,MSG) addMessage(Id, CoinOneMessage( Type(Id), Level, MSG)) inline int std_m(int n) { return 1 + n; } inline int warn_m(int n) { return 3000 + n; } inline int err_m(int n) { return n + 6000; } LandPMessages::LandPMessages() : CoinMessages(DUMMY_END) { strcpy(source_,"Lap"); LAP_ADD_MSG(Separating,std_m,3+REMOVE_LOG,"Starting separation on variable %d, initial depth of cut %f"); LAP_ADD_MSG(FoundImprovingRow, std_m,4, "Found improving row (leaving variable). Row %d (basic var %d), " "leaving status %d, sign of gamma %d, reduced cost %f"); LAP_ADD_MSG(FoundBestImprovingCol, std_m, 4, " Found best improvement (entering variable). Var %d, " "value of gamma %f, expected depth of next cut %f"); LAP_ADD_MSG(WarnFailedBestImprovingCol, err_m, 3, "Failed to find an improving entering variable while reduced cost was %f, " "depth of current cut %f, best cut depth with pivot %f"); //Log line is cut number time pivot number, cut depth, leaving, incoming gamma degenerate LAP_ADD_MSG(LogHead, std_m, 3+REMOVE_LOG, "Pivot no \t cut depth \t leaving var \t incoming var \t direction \t gamma \t degenerate"); LAP_ADD_MSG(PivotLog, std_m, 3+REMOVE_LOG, "%8d\t %9f\t %11d \t %11d \t %11d \t %8f \t %12d \t %.5g \t %11d"); LAP_ADD_MSG(FinishedOptimal, std_m, 2, "Found optimal lift-and-project cut, depth %f number of pivots performed %d"); LAP_ADD_MSG(HitLimit, std_m, 2, "Stopping lift-and-project optimization hit %s limit. Number of pivots %d"); LAP_ADD_MSG(WarnBadSigmaComputation, err_m, 1, "Cut depth after pivot is not what was expected by computations before, difference %.15f"); LAP_ADD_MSG(WarnBadRowComputation, err_m, 1, "Row obtained after pivot is not what was expected (distance between the two %f in norm inf)."); LAP_ADD_MSG(WarnGiveUpRow, err_m,1,"Limit of %d negative reduced costs with no strict improvement"); LAP_ADD_MSG(PivotFailedSigmaUnchanged, err_m, 1, "A pivot failed to be performed (probably refactorization was performed) but sigma is unchanged continue..."); LAP_ADD_MSG(PivotFailedSigmaIncreased, err_m, 1,"A pivot failed to be performed, and sigma has changed exit without generating cut"); LAP_ADD_MSG(FailedSigmaIncreased, err_m,1,"Cut violation has increased in last pivot"); LAP_ADD_MSG (WarnBadRhsComputation, err_m,1, "rhs obtained after pivot is not what was expected (distance between the two %f)."); LAP_ADD_MSG(WarnFailedPivotTol, err_m, 2,"All pivots are below tolerance"); LAP_ADD_MSG(WarnFailedPivotIIf, err_m, 2,"There is no possible pivot within tolerance (every pivot make rhs for current row %f too close to integer feasibility"); LAP_ADD_MSG(NumberNegRc, std_m, 4, "Number of rows with negative reduced cost %i"); LAP_ADD_MSG(NumberZeroRc, std_m, 4, "Number of rows with zero reduced cost %i"); LAP_ADD_MSG(NumberPosRc, std_m, 4, "Number of rows with positive reduced cost %i"); LAP_ADD_MSG(WeightsStats, std_m, 2, "Maximal weight %g minimal weight %g"); LAP_ADD_MSG(RoundStats, std_m, 1, "Separated %i cuts with %i pivots, source entered %i times, %i sigma increases."); LAP_ADD_MSG(CutStat, std_m, 1, "Separated cut %i with %i pivots, source entered %i times, %i sigma increases, %i potential cycles.%g"); } } CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPTabRow.hpp0000644000175000017500000000350612130104031017475 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // LIF // CNRS, Aix-Marseille Universites // Date: 02/23/08 // // $Id: CglLandPTabRow.hpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #ifndef CglLandPTabRow_H #define CglLandPTabRow_H #include "CoinIndexedVector.hpp" #include namespace LAP { class CglLandPSimplex; struct TabRow: public CoinIndexedVector { /** Row number.*/ int num; /** Row right-hand-side.*/ double rhs; /** Row of what?*/ const CglLandPSimplex * si_; /** Flag to say if row is modularized.*/ bool modularized_; TabRow(): CoinIndexedVector(), si_(NULL), modularized_(false) {} TabRow(const CglLandPSimplex *si): CoinIndexedVector(), num(-1), rhs(0), si_(si), modularized_(false) {} TabRow(const TabRow & source):CoinIndexedVector(source), num(source.num), rhs(source.rhs), si_(source.si_) { } TabRow& operator=(const TabRow & r) { if (this != &r) { CoinIndexedVector::operator=(r); num = r.num; rhs = r.rhs; si_ = r.si_; } return *this; } bool operator==(const TabRow &r) const; ~TabRow() { } void modularize(const bool * integerVar); void print(std::ostream & os, int width = 9, const int * nonBasics = NULL, int m = 0); inline const double& operator[](const int &index) const { return denseVector()[index]; } inline double& operator[](const int &index) { return denseVector()[index]; } }; }/* Ends LAP Namespace.*/ #endif CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPSimplex.cpp0000644000175000017500000031743412233746052017746 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 21/07/05 // // $Id: CglLandPSimplex.cpp 1153 2013-10-29 14:54:34Z forrest $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #include "CglLandPSimplex.hpp" #include "CoinTime.hpp" #ifdef COIN_HAS_OSICLP #include "OsiClpSolverInterface.hpp" #endif #include "CoinIndexedVector.hpp" #include #include #include #include #define REMOVE_LOG 0 #define RED_COST_CHECK 1e-6 //#define OUT_CGLP_PIVOTS #ifdef OUT_CGLP_PIVOTS #include "CglLandPOutput.hpp" #endif #ifdef DEBUG_LAP /* The function is not used anywhere (LL) static void MyAssertFunc(bool c, const std::string &s, const std::string& file, unsigned int line){ if (c != true){ fprintf(stderr, "Failed MyAssertion: %s in %s line %i.\n", s.c_str(), file.c_str(), line); throw -1; } } */ static void DblGtAssertFunc(const double& a, const std::string &a_s, const double&b, const std::string& b_s, const std::string& file, unsigned int line) { if (a //#define TEST_M3 namespace LAP { void CglLandPSimplex::printTableau(std::ostream & os) { int width = 9; os<<"Tableau at current basis"<getBasics(basic2); for (int i = 0; i < nrows_ ; i++) assert(basics_[i]==basic2[i]); delete [] basic2; return true; } CglLandPSimplex::CglLandPSimplex(const OsiSolverInterface &si, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms, Validator& validator): #ifdef COIN_HAS_OSICLP clp_(NULL), #endif row_k_(this), original_row_k_(this), row_i_(this), new_row_(this), gammas_(false), rowFlags_(NULL), col_in_subspace(), colCandidateToLeave_(NULL), basics_(NULL), nonBasics_(NULL), M1_(), M2_(), M3_(), sigma_(0), basis_(NULL), colsolToCut_(NULL), colsol_(NULL), ncols_orig_(0),nrows_orig_(0), inDegenerateSequence_(false), chosenReducedCostVal_(1e100), original_index_(), si_(NULL), validator_(validator), numPivots_(0), numSourceRowEntered_(0), numIncreased_(0) { ncols_orig_ = si.getNumCols(); nrows_orig_ = si.getNumRows(); handler_ = new CoinMessageHandler(); handler_->setLogLevel(2); messages_ = LandPMessages(); si_ = const_cast(&si); #ifdef COIN_HAS_OSICLP OsiClpSolverInterface * clpSi = dynamic_cast(si_); if (clpSi) { clp_ = clpSi; } #endif int rowsize = ncols_orig_ + nrows_orig_ + 1; row_k_.reserve(rowsize); #ifndef NDEBUG new_row_.reserve(rowsize); #endif lo_bounds_.resize(ncols_orig_ + nrows_orig_); up_bounds_.resize(ncols_orig_ + nrows_orig_); CoinCopyN(si.getColLower(),ncols_orig_, &lo_bounds_[0]); CoinCopyN(si.getColUpper(),ncols_orig_,&up_bounds_[0]); const double * rowUpper = si.getRowUpper(); const double * rowLower = si.getRowLower(); double infty = si.getInfinity(); int i=ncols_orig_; for (int iRow = 0; iRow < nrows_orig_ ; iRow++, i++) { if (rowUpper[iRow] < infty) lo_bounds_[i]=0.; else lo_bounds_[i]= - infty; if (rowLower[iRow] <= - infty) up_bounds_[i] = infty; else if (rowUpper[iRow] < infty) { lo_bounds_[i] = rowLower[iRow] - rowUpper[iRow]; up_bounds_[i] = 0; } else up_bounds_[i] = 0.; } cuts_.resize(ncols_orig_); if (params.pivotLimit != 0) { own_ = true; rWk1_.resize(nrows_orig_); rWk2_.resize(nrows_orig_); rWk3_.resize(nrows_orig_); rWk4_.resize(nrows_orig_); rIntWork_.resize(nrows_orig_); row_i_.reserve(rowsize); rowFlags_ = new bool[nrows_orig_]; col_in_subspace.resize(ncols_orig_ + nrows_orig_); colCandidateToLeave_ = new bool[ncols_orig_]; basics_ = new int[nrows_orig_]; nonBasics_ = new int[ncols_orig_]; colsolToCut_ = new double[ncols_orig_ + nrows_orig_]; colsol_ = new double[ncols_orig_ + nrows_orig_]; original_index_.resize(ncols_orig_ + nrows_orig_); CoinIotaN(&original_index_[0],ncols_orig_ + nrows_orig_, 0); } else { nrows_ = nrows_orig_; ncols_ = ncols_orig_; original_index_.resize(ncols_orig_ + nrows_orig_); CoinIotaN(&original_index_[0],ncols_orig_ + nrows_orig_, 0); own_ = false; si_->enableSimplexInterface(0); basis_ = new CoinWarmStartBasis(*cached.basis_); } cacheUpdate(cached,params.sepSpace != CglLandP::Full); if (params.normalization) { computeWeights(params.lhs_norm, params.normalization, params.rhsWeightType); } else rhs_weight_ = 1; } CglLandPSimplex::~CglLandPSimplex() { delete handler_; handler_ = NULL; delete basis_; basis_ = NULL; if (own_) { delete [] rowFlags_; rowFlags_ = NULL; delete [] colCandidateToLeave_; colCandidateToLeave_ = NULL; delete [] basics_; basics_ = NULL; delete [] nonBasics_; nonBasics_ = NULL; delete [] colsolToCut_; colsolToCut_ = NULL; delete [] colsol_; colsol_ = NULL; } else { si_->disableSimplexInterface(); } } /** Compute normalization weights.*/ void CglLandPSimplex::computeWeights(CglLandP::LHSnorm norm, CglLandP::Normalization type, CglLandP::RhsWeightType rhs) { norm_weights_.clear(); norm_weights_.resize(ncols_orig_ ,1.); norm_weights_.resize(ncols_orig_ + nrows_orig_, 0.); double * rows_weights = &norm_weights_[ncols_orig_]; std::vector nnz(nrows_orig_,0); const CoinPackedMatrix * m = si_->getMatrixByCol(); const double * val = m->getElements(); const int * ind = m->getIndices(); const int * length = m->getVectorLengths(); const CoinBigIndex * start = m->getVectorStarts(); rhs_weight_ = 1; if (type== CglLandP::WeightRHS) { if (rhs == CglLandP::Fixed) rhs_weight_ = (ncols_orig_ + 1);//params.rhsWeight; else if (rhs == CglLandP::Dynamic) { throw -1; } } if (norm == CglLandP::Infinity) { for (int i = 0 ; i < ncols_orig_ ; i++) { CoinBigIndex begin = start[i]; CoinBigIndex end = begin + length[i]; for (CoinBigIndex k = begin ; k < end ; k++) { rows_weights[ind[k]] = CoinMax(fabs(val[k]), rows_weights[ind[k]]); rhs_weight_ += fabs(val[k]); nnz[ind[k]] ++; } } } else if (norm == CglLandP::L1 || norm == CglLandP::Average) { for (int i = 0 ; i < ncols_orig_ ; i++) { CoinBigIndex begin = start[i]; CoinBigIndex end = begin + length[i]; for (CoinBigIndex k = begin ; k < end ; k++) { rows_weights[ind[k]] += fabs(val[k]); nnz[ind[k]] ++; } } if (norm == CglLandP::Average) { for (int i = 0 ; i < nrows_orig_ ; i++) { rows_weights[i] = static_cast(nnz[i]); } } if (type== CglLandP::WeightBoth) { rhs_weight_ += (ncols_orig_ + 1); std::cout<<"rhs_weight : "< (nnz[i]); } if (type== CglLandP::WeightBoth) { rhs_weight_ = (ncols_orig_ + 1); } } else if (norm ==CglLandP::Uniform) { for (int i = 0 ; i < nrows_orig_ ; i++) { rows_weights[i] = static_cast (1); } if (type== CglLandP::WeightBoth) { rhs_weight_ = (ncols_orig_ + 1); } } } void CglLandPSimplex::cacheUpdate(const CglLandP::CachedData &cached, bool reducedSpace) { integers_ = cached.integers_; if (own_) { CoinCopyN(cached.basics_, nrows_orig_, basics_); CoinCopyN(cached.nonBasics_, ncols_orig_, nonBasics_); CoinCopyN(cached.colsol_, nrows_orig_ + ncols_orig_, colsol_); for (int i = 0 ; i < ncols_orig_ ; i++) { colsol_[nonBasics_[i]] = 0; } CoinCopyN(cached.colsol_, nrows_orig_ + ncols_orig_, colsolToCut_); //Zero all non basics in colsol setup the reduced space col_in_subspace.resize(0); col_in_subspace.resize(ncols_orig_+nrows_orig_,true); for (int i = 0 ; i < ncols_orig_ ; i++) { setColsolToCut(nonBasics_[i],0.); colsol_[nonBasics_[i]] = 0; } /** Mark the variables at zero in solution to cut so that we know that their contribution to reduced cost has to be computed*/ int n_removed =0; if (reducedSpace) { for (int ii = 0; ii < ncols_orig_ ; ii++) { if (getColsolToCut(ii) - up_bounds_[ii] > 1e-08 || getColsolToCut(ii) - lo_bounds_[ii] < 1e-08) { col_in_subspace[ii]=false; n_removed++; } } } } else { basics_ = cached.basics_; nonBasics_ = cached.nonBasics_; } } bool CglLandPSimplex::resetSolver(const CoinWarmStartBasis * /*basis*/) { si_->disableSimplexInterface(); return 0; } int CglLandPSimplex::generateExtraCuts(const CglLandP::CachedData & cached, const CglLandP::Parameters& params) { int ret_val = 0; for (int i = 0 ; i < nrows_ && cuts_.numberCuts() < params.extraCutsLimit; i++) { if (basics_[i] < ncols_) ret_val += generateExtraCut(i, cached, params); } return ret_val; } int CglLandPSimplex::generateExtraCut(int i, const CglLandP::CachedData & cached, const CglLandP::Parameters& params) { const int & iCol = basics_[i]; if (!isInteger(iCol) || int_val(colsol_[iCol], params.away) || !int_val(getColsolToCut(iCol), params.away) || colsol_[iCol] < getLoBound(iCol) || colsol_[iCol] > getUpBound(iCol) || (cuts_.rowCut(iCol) != NULL) ) { return false; } #ifdef DBG_OUT printf("var: %i, basic in row %i. integer=%i, colsol_=%f, colsolToCut_=%f.\n",iCol, i, isInteger(iCol), colsol_[iCol], getColsolToCut(iCol)); printf("generating extra cut....\n"); #endif OsiRowCut * cut = new OsiRowCut; generateMig(i, *cut, params); assert(fabs(row_k_.rhs - colsol_[iCol]) < 1e-10); int code = validator_(*cut, cached.colsol_, *si_, params, &lo_bounds_[0], &up_bounds_[0]); if (code) { delete cut; return false; } else { cuts_.insert(iCol, cut); return true; } } void CglLandPSimplex::genThisBasisMigs(const CglLandP::CachedData &cached, const CglLandP::Parameters & params) { for (int i = 0 ; i < cached.nBasics_ ; i++) { const int iCol = basics_[i]; if (iCol >= ncols_ || !cached.integers_[iCol] || int_val(colsol_[iCol], params.away)) continue; OsiRowCut * cut = new OsiRowCut; generateMig(i, *cut, params); int code = validator_(*cut, cached.colsol_, *si_, params, &lo_bounds_[0], &up_bounds_[0]); if (code) { delete cut; continue; } cut->setEffectiveness(cut->violated(cached.colsol_)); if (cuts_.rowCut(iCol) == NULL || cut->effectiveness() > cuts_.rowCut(iCol)->effectiveness()) { cuts_.insert(iCol,cut); } else delete cut; } } bool CglLandPSimplex::generateMig(int row, OsiRowCut & cut, const CglLandP::Parameters & params) { row_k_.num = row; pullTableauRow(row_k_); row_k_.rhs = row_k_.rhs - floor(row_k_.rhs); if (params.strengthen || params.modularize) createMIG(row_k_, cut); else createIntersectionCut(row_k_, cut); return 1;//At this point nothing failed, always generate a cut } bool CglLandPSimplex::optimize (int row, OsiRowCut & cut,const CglLandP::CachedData &cached,const CglLandP::Parameters & params) { bool optimal = false; int nRowFailed = 0; double timeLimit = CoinMin(params.timeLimit, params.singleCutTimeLimit); timeLimit += CoinCpuTime(); // double timeBegin = CoinCpuTime(); /** Copy the cached information */ nrows_ = nrows_orig_; ncols_ = ncols_orig_; CoinCopyN(cached.basics_, nrows_, basics_); CoinCopyN(cached.nonBasics_, ncols_, nonBasics_); CoinCopyN(cached.colsol_, nrows_+ ncols_, colsol_); CoinCopyN(cached.colsol_, nrows_+ ncols_, colsolToCut_); delete basis_; basis_ = new CoinWarmStartBasis(*cached.basis_); #define CACHED_SOLVER #ifndef CACHED_SOLVER si_->enableSimplexInterface(0); #else delete si_; si_ = cached.solver_->clone(); #ifdef COIN_HAS_OSICLP OsiClpSolverInterface * clpSi = dynamic_cast(si_); OsiClpSolverInterface * clpSiRhs = dynamic_cast(cached.solver_); if (clpSi) { clp_ = clpSi; clpSi->getModelPtr()->copyEnabledStuff(clpSiRhs->getModelPtr());; } #endif #endif #ifdef APPEND_ROW if (params.modularize) { append_row(row, params.modularize); row_k_.modularize(integers_); } #endif for (int i = 0 ; i < ncols_; i++) { setColsolToCut(nonBasics_[i], 0.); colsol_[nonBasics_[i]] = 0; } #ifdef APPEND_ROW if (params.modularize) row_k_.num = nrows_ - 1; else #endif row_k_.num = row; pullTableauRow(row_k_); row_k_.rhs = row_k_.rhs - floor(row_k_.rhs); if (params.modularize) row_k_.modularize(integers_); updateM1_M2_M3(row_k_, 0., params.perturb); sigma_ = computeCglpObjective(row_k_); handler_->message(Separating,messages_)<message(LogHead, messages_)<= 0) { if (params.pivotSelection == CglLandP::mostNegativeRc || (params.pivotSelection == CglLandP::initialReducedCosts && numPivots == 0)) { if (params.pivotSelection == CglLandP::initialReducedCosts) rowFlags_[leaving] = false; incoming = fastFindBestPivotColumn(direction, gammaSign, params.pivotTol, params.away, (params.sepSpace==CglLandP::Fractional), allowDegeneratePivot, bestSigma, false//params.modularize ); while (incoming < 0 && !optimal && nRowFailed < maxTryRow) // if no improving was found rescan the tables of reduced cost to find a good one { if (incoming == -1 || params.countMistakenRc) nRowFailed ++; rowFlags_[leaving] = false; hasFlagedRow = true; leaving = rescanReducedCosts(direction, gammaSign, params.pivotTol); if (leaving >= 0) { incoming = fastFindBestPivotColumn(direction, gammaSign, params.pivotTol, params.away, (params.sepSpace==CglLandP::Fractional), allowDegeneratePivot, bestSigma, false//params.modularize ); } else optimal = true; } } else if (params.pivotSelection == CglLandP::bestPivot) { incoming = findBestPivot(leaving, direction, params); } } } else if (params.pivotSelection == CglLandP::initialReducedCosts) { assert(numPivots > 0); while (incoming < 0 && !optimal) // if no improving was found rescan the tables of reduced cost to find a good one { if (!hasFlagedRow) hasFlagedRow = true; leaving = rescanReducedCosts(direction, gammaSign, params.pivotTol); rowFlags_[leaving] = false; if (leaving >= 0) { incoming = fastFindBestPivotColumn(direction, gammaSign, params.pivotTol, params.away, (params.sepSpace==CglLandP::Fractional), allowDegeneratePivot, bestSigma, false//params.modularize ); } else optimal = true; } } if (leaving >= 0) { if ( incoming >= 0 && !optimal) { if (inDegenerateSequence_) //flag leaving row { numberConsecutiveDegenerate++; allowDegeneratePivot = numberConsecutiveDegenerate < params.degeneratePivotLimit; rowFlags_[leaving] = false; } else { beObstinate = 0; numberConsecutiveDegenerate = 0; allowDegeneratePivot = numberConsecutiveDegenerate < params.degeneratePivotLimit; } double gamma = - row_k_[nonBasics_[incoming]] / row_i_[nonBasics_[incoming]]; #ifdef COIN_HAS_OSICLP if (numPivots && ( numPivots % 40 == 0 ) && clp_) { clp_->getModelPtr()->factorize(); } #endif #ifndef OLD_COMPUTATION bool recompute_source_row = (numPivots && (numPivots % 10 == 0 || fabs(gamma) < 1e-05)); #endif std::pair cur_pivot(nonBasics_[incoming],basics_[leaving]); bool pivoted = changeBasis(incoming,leaving,direction, #ifndef OLD_COMPUTATION recompute_source_row, #endif false);//params.modularize); if (leaving == row) { numSourceRowEntered_++; } if (params.generateExtraCuts == CglLandP::WhenEnteringBasis && basics_[leaving] < ncols_ && cuts_.numberCuts() < params.extraCutsLimit) generateExtraCut(leaving, cached, params); if (pivoted) { numPivots++; double lastSigma = sigma_; if (params.modularize) { row_k_.modularize(integers_); } sigma_ = computeCglpObjective(row_k_); if (sigma_ - lastSigma > -1e-4*(lastSigma)) { if(sigma_ > 0) return 0; #if 0 if (sigma_ > 0 || sigma_ - lastSigma > 1e1*(-lastSigma)) return 0; #endif } handler_->message(PivotLog,messages_)<1e-8) { handler_->message(PivotFailedSigmaIncreased,messages_)<message(PivotFailedSigmaUnchanged,messages_)< params.failedPivotLimit) break; } } else //attained max number of leaving vars tries with no improvement { handler_->message(WarnGiveUpRow,messages_)<message(FinishedOptimal, messages_)<= params.pivotLimit) { std::string limit="pivots"; handler_->message(HitLimit, messages_)<= params.failedPivotLimit) { std::string limit="failed pivots"; handler_->message(HitLimit, messages_)<message(CutStat, messages_)<getInfinity(); int clpLeavingStatus = leavingStatus; #ifdef COIN_HAS_OSICLP if (clp_) { if (basics_[leaving] >= ncols_) clpLeavingStatus = - leavingStatus; } #endif int code = 0; code = si_->pivot(nonBasics_[incoming],basics_[leaving], clpLeavingStatus); if (code) { #ifdef OLD_COMPUTATION if (!modularize) { pullTableauRow(row_k_); row_k_.rhs = row_k_.rhs - floor(row_k_.rhs); } else{ int & indexLeaving = basics_[leaving]; if (leavingStatus==1) { setColsolToCut(indexLeaving, getUpBound(indexLeaving) - getColsolToCut(indexLeaving)); } else { setColsolToCut(indexLeaving, getColsolToCut(indexLeaving) + getLoBound(indexLeaving)); } } #endif return 0; } numPivots_ ++; //swap bounds int & indexLeaving = basics_[leaving]; #ifdef OLD_COMPUTATION if (!modularize) { if (leavingStatus==1) { setColsolToCut(indexLeaving, getUpBound(indexLeaving) - getColsolToCut(indexLeaving)); } else { setColsolToCut(indexLeaving, getColsolToCut(indexLeaving) - getLoBound(indexLeaving)); } } #endif if (indexLeaving < ncols_) { basis_->setStructStatus(indexLeaving, leavingStatus==1 ? CoinWarmStartBasis::atUpperBound : CoinWarmStartBasis::atLowerBound); } else { int iRow = basics_[leaving] - ncols_; basis_->setArtifStatus(iRow, leavingStatus==1 ? CoinWarmStartBasis::atUpperBound : CoinWarmStartBasis::atLowerBound); // assert(leavingStatus==-1 || (rowLower_[iRow]>-1e50 && rowUpper_[iRow] < 1e50)); } if (nonBasics_[incoming] < ncols_) { int & indexIncoming = nonBasics_[incoming]; CoinWarmStartBasis::Status status = basis_->getStructStatus(indexIncoming); if (status==CoinWarmStartBasis::atUpperBound) setColsolToCut(indexIncoming, getUpBound(indexIncoming) - getColsolToCut(indexIncoming)); else setColsolToCut(indexIncoming, getColsolToCut(indexIncoming) + getLoBound(indexIncoming)); basis_->setStructStatus(indexIncoming, CoinWarmStartBasis::basic); } else { int iRow = nonBasics_[incoming] - ncols_; int & indexIncoming = nonBasics_[incoming]; if (basis_->getArtifStatus(iRow)==CoinWarmStartBasis::atUpperBound) setColsolToCut(indexIncoming, getUpBound(indexIncoming) - getColsolToCut(indexIncoming)); else setColsolToCut(indexIncoming, getColsolToCut(indexIncoming) + getLoBound(indexIncoming)); basis_->setArtifStatus(iRow, CoinWarmStartBasis::basic); } int swap = basics_[leaving]; basics_[leaving] = nonBasics_[incoming]; nonBasics_[incoming] = swap; //update solution of leaving variable colsol_[nonBasics_[incoming]] = 0; //update solution for basics const double * lpSol = si_->getColSolution(); const double * rowAct = si_->getRowActivity(); const double * rowLower = si_->getRowLower(); const double * rowUpper = si_->getRowUpper(); for (int i = 0 ; i < nrows_ ; i++) { int& iCol = basics_[i]; if (iCol -infty) { colsol_[iCol] += rowLower[iRow]; } else { colsol_[iCol] += rowUpper[iRow]; } } } // basics_ may unfortunately change reload int k = basics_[row_k_.num]; si_->getBasics(basics_); if (basics_[row_k_.num] != k) { for (int ii = 0 ; ii < nrows_ ; ii++) { if (basics_[ii]==k) { row_k_.num= ii; break; } } } #ifndef OLD_COMPUTATION if (!modularize && recompute_source_row) { #else if (!modularize) { #endif pullTableauRow(row_k_); row_k_.rhs = row_k_.rhs - floor(row_k_.rhs); } #if 0 } #endif else //Update row k by hand { double gamma = - row_k_[basics_[leaving]] / row_i_[basics_[leaving]]; row_k_[basics_[leaving]] = 0; row_k_.quickAdd(nonBasics_[incoming], gamma); if(1 || fabs(gamma) > 1e-9){ int nnz = row_i_.getNumElements(); const int * indices = row_i_.getIndices(); for (int i = 0 ; i < nnz; i++) { if(row_k_.getNumElements() > row_k_.capacity() - 2) row_k_.scan(); if (indices[i] != nonBasics_[incoming] && indices[i] != basics_[leaving]) row_k_.quickAdd(indices[i], gamma * row_i_[indices[i]]); } row_k_.rhs += gamma * row_i_.rhs; } row_k_.scan(); row_k_.clean(1e-10); checkVec(row_k_); #if 0 TabRow test_row(this); int rowsize = ncols_orig_ + nrows_orig_ + 1; test_row.reserve(rowsize); test_row.num = row_k_.num; pullTableauRow(test_row); test_row.rhs = test_row.rhs - floor(test_row.rhs); VecModEqAssert(row_k_, test_row); #endif } return true; } /** Find a row which can be used to perform an improving pivot return index of the cut or -1 if none exists * (i.e., find the leaving variable).*/ int CglLandPSimplex::findCutImprovingPivotRow( int &direction, int &gammaSign, double tolerance) { bool bestRed = 0; tolerance = -10*tolerance; int bestRow = -1; int bestDirection = 0; int bestGamma = 0; double infty = si_->getInfinity(); for (row_i_.num = 0 ; row_i_.num < nrows_; row_i_.num++) { //if ( (row_k_.modularized_ || row_i_.num != row_k_.num)//obviously not necessary to combine row k with itself (unless modularized) if ( (row_i_.num != row_k_.num)//obviously not necessary to combine row k with itself (unless modularized) && rowFlags_[row_i_.num] //row has not been flaged // && fabs(getUpBound(basics_[row_i_.num]) - getLoBound(basics_[row_i_.num]))>1e-09 //variable is not fixed ) { pullTableauRow(row_i_); double tau = computeRedCostConstantsInRow(); if (getLoBound(basics_[row_i_.num]) > -infty) // variable can leave at its lower bound //Compute reduced cost with basics_[i] value decreasing { direction = -1; gammaSign = -1; double redCost = computeCglpRedCost(direction, gammaSign, tau); if (redCost=0 && row_i_.num != bestRow) { row_i_.num=bestRow; pullTableauRow(row_i_); } assert (bestRow<0||direction!=0); return bestRow; } /** Find a row which can be used to perform an improving pivot the fast way * (i.e., find the leaving variable). \return index of the cut or -1 if none exists. */ int CglLandPSimplex::fastFindCutImprovingPivotRow( int &direction, int &gammaSign, double tolerance, bool flagPositiveRows) { bool modularize = false; double sigma = sigma_ /rhs_weight_; //Fill vector to compute contribution to reduced cost of variables in M1 and M2 (nz non-basic vars in row_k_.row). // 1. Put the values // 2. Post multiply by basis inverse double * rWk1bis_ =NULL; CoinFillN(&rWk1_[0],nrows_,static_cast (0)); if (modularize) CoinFillN(rWk1bis_, nrows_, static_cast (0)); int capacity = 0; const CoinPackedMatrix* mat = si_->getMatrixByCol(); const CoinBigIndex* starts = mat->getVectorStarts(); const CoinBigIndex * lengths = mat->getVectorLengths(); const int * indices = mat->getIndices(); const double * elements = mat->getElements(); for (unsigned int i = 0 ; i < M1_.size() ; i++) { const int& ii = M1_[i]; if (ii < ncols_) { const CoinBigIndex& begin = starts[ii]; const CoinBigIndex end = begin + lengths[ii]; bool swap = false; if (basis_->getStructStatus(ii)==CoinWarmStartBasis::atUpperBound) swap = true; for (CoinBigIndex k = begin ; k < end ; k++) { if (swap) { rWk1_[indices[k]] += normedCoef(elements[k] * sigma, ii); if (modularize) { rWk1bis_[indices[k]] += elements[k] * (getColsolToCut(ii) - normedCoef(sigma, ii)); } } else { rWk1_[indices[k]] -= normedCoef(elements[k] * sigma, ii); if (modularize) { rWk1bis_[indices[k]] -= elements[k] * (getColsolToCut(ii) - normedCoef(sigma, ii)); } } } } else { bool swap = false; if (basis_->getArtifStatus(ii - ncols_orig_)==CoinWarmStartBasis::atUpperBound) swap = true; if (swap) { rWk1_[ii - ncols_] += normedCoef(sigma, ii); if (modularize) { rWk1bis_[ii - ncols_] += (getColsolToCut(ii) - normedCoef(sigma, ii)); } } else { rWk1_[ii - ncols_] -= normedCoef(sigma, ii); if (modularize) { rWk1bis_[ii - ncols_] -= (getColsolToCut(ii) - normedCoef(sigma, ii)); } } } } for (unsigned int i = 0 ; i < M2_.size(); i++) { const int& ii = M2_[i]; if (iigetStructStatus(ii)==CoinWarmStartBasis::atUpperBound) swap = true; for (CoinBigIndex k = begin ; k < end ; k++) { if (swap) { rWk1_[indices[k]] += elements[k] * (getColsolToCut(ii) - normedCoef(sigma, ii)); if (modularize) rWk1bis_[indices[k]] += elements[k] * normedCoef(sigma, ii); } else { rWk1_[indices[k]] -= elements[k] * (getColsolToCut(ii) - normedCoef(sigma, ii)); if (modularize) rWk1bis_[indices[k]] -= elements[k] * normedCoef(sigma, ii); } } } else { bool swap = false; if (basis_->getArtifStatus(M2_[i] - ncols_orig_)==CoinWarmStartBasis::atUpperBound) swap = true; if (swap) { rWk1_[ii - ncols_] += (getColsolToCut(ii) - normedCoef(sigma, ii)); if (modularize) rWk1bis_[ii - ncols_] += normedCoef(sigma, ii); } else { rWk1_[ii - ncols_] -= (getColsolToCut(ii) - normedCoef(sigma, ii)); if (modularize) rWk1bis_[ii - ncols_] -= normedCoef(sigma, ii); } } } for (int i = 0 ; i < nrows_ ; i++) { if (rWk1_[i]) rIntWork_[capacity++] = i; } CoinIndexedVector indexed; indexed.borrowVector(nrows_, capacity, &rIntWork_[0], &rWk1_[0]); #ifdef COIN_HAS_OSICLP if (clp_) clp_->getBInvACol(&indexed); else #endif throw CoinError("Function not implemented in this OsiSolverInterface", "getBInvACol","CglLandpSimplex"); indexed.returnVector(); if (modularize) { capacity = 0; for (int i = 0 ; i < nrows_ ; i++) { if (rWk1bis_[i]) rIntWork_[capacity++] = i; } indexed.borrowVector(nrows_, capacity, &rIntWork_[0], rWk1bis_); #ifdef COIN_HAS_OSICLP if (clp_) clp_->getBInvACol(&indexed); else #endif indexed.returnVector(); } //Now compute the contribution of the variables in M3_ //Need to get the column of the tableau in rW3_ for each of these and //add up with correctly in storage for multiplier for negative gamma (named rW3_) and //for positive gamma (which is named rW4_) if (!M3_.empty()) { CoinFillN(&rWk3_[0],nrows_,0.); CoinFillN(&rWk4_[0],nrows_,0.); if (modularize) { double * rWk3bis_ = NULL; double * rWk4bis_ = NULL; CoinFillN(rWk3bis_,nrows_,0.); CoinFillN(rWk4bis_,nrows_,0.); } } for (unsigned int i = 0 ; i < M3_.size() ; i++) { const int & ii = M3_[i]; si_->getBInvACol(ii, &rWk2_[0]); bool swap = false; if (ii < ncols_orig_ && basis_->getStructStatus(ii)==CoinWarmStartBasis::atUpperBound) swap = true; if (ii >= ncols_orig_ && basis_->getArtifStatus(ii - ncols_orig_)==CoinWarmStartBasis::atUpperBound) swap = true; for (int j = 0 ; j < nrows_ ; j++) { if (swap) rWk2_[j] = - rWk2_[j]; if (rWk2_[j] > 0.) { //is in M1 for multiplier with negative gamma rWk3_[j] -= normedCoef(sigma*rWk2_[j], ii); //is in M2 for multiplier with positive gamma rWk4_[j] -= (getColsolToCut(ii) - normedCoef(sigma, ii))*rWk2_[j]; } else if (rWk2_[j] < 0.) { //is in M2 for multiplier with negative gamma rWk3_[j] -=(getColsolToCut(ii) - normedCoef(sigma, ii))*rWk2_[j]; //is in M1 for multiplier with positive gamma rWk4_[j] -= normedCoef(sigma, ii)*rWk2_[j]; } } } //Now, we just need to add up everything correctly for each of the reduced //cost. Compute the Tau in rWk2_ which is not used anymore then compute the reduced cost in rWk1_ for u^l_j // rwk2_ in u^u_j rWk3_ for v^u_j rWk4_ for v^u_j // Let's rename not to get too much confused double * ul_i = &rWk1_[0]; double * uu_i = &rWk2_[0]; double * vl_i = &rWk3_[0]; double * vu_i = &rWk4_[0]; int bestRow = -1; int bestDirection = 0; int bestGammaSign = 0; // double infty = si_->getInfinity(); nNegativeRcRows_ = 0;//counter int nZeroRc = 0; int nPositiveRc = 0; double fzero = getColsolToCut(basics_[row_k_.num]) - floor(getColsolToCut(basics_[row_k_.num])); // fzero = row_k_.rhs; //for (int i = 0 ; i < ncols_orig_ ; i++) { // fzero -= getColsolToCut(nonBasics_[i]) * row_k_[nonBasics_[i]]; //} double bestReducedCost = -tolerance; for (int i = 0 ; i < nrows_ ; i++) { //if ((!row_k_.modularized_ && i == row_k_.num)//obviously not necessary to combine row k with itself if ((i == row_k_.num)//obviously not necessary to combine row k with itself // && fabs(getUpBound(basics_[row_i_.num]) - getLoBound(basics_[row_i_.num]))>1e-09 //variable is not fixed || col_in_subspace[basics_[i]] == false ) { ul_i[i]=uu_i[i]=vl_i[i]=vu_i[i]=10.; rowFlags_[i] = false; continue; } double tau1 = rWk1_[i]; double tau2 = rWk1_[i]; double tau3 = rWk1_[i]; double tau4 = rWk1_[i]; if (!M3_.empty()) { tau1 += rWk3_[i]; tau2 += rWk4_[i]; tau3 += rWk4_[i]; tau4 += rWk3_[i]; } if (modularize) { tau1 = rWk1_[i] + rWk3_[i]; tau2 = rWk1bis_[i] + rWk3_[i]; tau3 = - rWk1_[i] - rWk4_[i]; tau4 = - rWk1bis_[i] - rWk3_[i]; } double redCost; bool hasNegativeRc = false; double loBound = getLoBound(basics_[i]); if (loBound > -1e50) { redCost = - normedCoef(sigma,basics_[i]) + (tau1) + (1 - fzero) * ( colsol_[basics_[i]] - loBound); if (redCost < -tolerance) { ul_i[i] = redCost; hasNegativeRc = true; } else { if (fabs(redCost) < tolerance) nZeroRc++; else nPositiveRc ++; ul_i[i] = 10.; } if (redCost < bestReducedCost && rowFlags_[i] ) //row has not been flaged { bestDirection = -1; bestGammaSign = -1; bestReducedCost = redCost; bestRow = i; } redCost = -normedCoef(sigma,basics_[i]) - (tau2) - (1 - fzero) * ( colsol_[basics_[i]] - loBound) - loBound + getColsolToCut(basics_[i]); if (redCost < -tolerance) { vl_i[i] = redCost; hasNegativeRc = true; } else { if (fabs(redCost) < tolerance) nZeroRc++; else nPositiveRc ++; vl_i[i]=10.; } if (redCost < bestReducedCost && rowFlags_[i]) //row has not been flaged { bestDirection = -1; bestGammaSign = 1; bestReducedCost = redCost; bestRow = i; } } else { ul_i[i] = 10.; vl_i[i] = 10.; } double upBound = getUpBound(basics_[i]); if (getUpBound(basics_[i]) < 1e50) { redCost = - normedCoef(sigma,basics_[i]) - (tau3) + (1 - fzero) * ( - colsol_[basics_[i]] + upBound); if (redCost < -tolerance) { uu_i[i] = redCost; hasNegativeRc = true; } else { if (fabs(redCost) < tolerance) nZeroRc++; else nPositiveRc ++; uu_i[i] = 10.; } if (redCost < bestReducedCost && rowFlags_[i]) //row has not been flaged { bestDirection = 1; bestGammaSign = -1; bestReducedCost = redCost; bestRow = i; } redCost = -normedCoef(sigma,basics_[i]) + (tau4) - (1 - fzero) * ( - colsol_[basics_[i]] + upBound) + upBound - getColsolToCut(basics_[i]); if (redCost < -tolerance) { vu_i[i] = redCost; hasNegativeRc = true; } else { if (fabs(redCost) < tolerance) nZeroRc++; else nPositiveRc ++; vu_i[i] = 10.; } if (redCost < bestReducedCost && rowFlags_[i]) //row has not been flaged { bestDirection = 1; bestGammaSign = 1; bestReducedCost = redCost; bestRow = i; } } else { uu_i[i] = 10.; vu_i[i] = 10.; } if (hasNegativeRc) nNegativeRcRows_ ++; else if (flagPositiveRows) rowFlags_[i] = false; } handler_->message(NumberNegRc, messages_)<message(NumberZeroRc, messages_)<message(NumberPosRc, messages_)<message(FoundImprovingRow, messages_)<< bestRow<getInfinity(); double bestReducedCost = -tolerance; for (int i = 0 ; i < nrows_ ; i++) { if (i == row_k_.num//obviously not necessary to combine row k with itself || !rowFlags_[i] //row has not been flaged // && fabs(getUpBound(basics_[row_i_.num]) - getLoBound(basics_[row_i_.num]))>1e-09 //variable is not fixed ) continue; if (ul_i[i] < bestReducedCost && rowFlags_[i]) //row has not been flaged { bestDirection = -1; bestGammaSign = -1; bestReducedCost = ul_i[i]; bestRow = i; } if (vl_i[i] < bestReducedCost && rowFlags_[i]) //row has not been flaged { bestDirection = -1; bestGammaSign = 1; bestReducedCost = vl_i[i]; bestRow = i; } if (uu_i[i] < bestReducedCost && rowFlags_[i]) //row has not been flaged { bestDirection = 1; bestGammaSign = -1; bestReducedCost = uu_i[i]; bestRow = i; } if (vu_i[i] < bestReducedCost && rowFlags_[i]) //row has not been flaged { bestDirection = 1; bestGammaSign = 1; bestReducedCost = vu_i[i]; bestRow = i; } } direction = bestDirection; gammaSign = bestGammaSign; // row_i_.num=bestRow; if (bestRow != -1) { chosenReducedCostVal_ = bestReducedCost; row_i_.num=bestRow; pullTableauRow(row_i_); handler_->message(FoundImprovingRow, messages_)<< bestRow<0.) { if (gammaSign > 0) { p += row_k * val; } else { // if(fabs(getColsolToCut(nonBasics_[i])) > 0) { p += row_k * val; q += row_i * val; } } r += normedCoef(row_k, ii) ; s += normedCoef(row_i, ii); } else if (coeff< 0.) { if (gammaSign > 0) { q -= row_i * val; } r -= normedCoef(row_k,ii); s -= normedCoef(row_i,ii); } else { if (gammaSign > 0 && row_i < 0) { q -= row_i * val; } else if (gammaSign < 0 && row_i < 0) { q += row_i * val; } s += normedCoef(gammaSign*fabs(row_i),ii); } } } // double f_plus(double gamma, int gammaSign){ // double num = row_k_. // for(int i = 0 ; i < ncols_ ; i++){ // } //} /** Find the column which leads to the best cut (i.e., find incoming variable).*/ int CglLandPSimplex::fastFindBestPivotColumn(int direction, int gammaSign, double pivotTol, double rhsTol, bool reducedSpace, bool allowDegenerate, double & bestSigma, bool modularize) { gammas_.clear(); pivotTol = 1e-05; adjustTableauRow(basics_[row_i_.num], row_i_, direction); double fzero = getColsolToCut(basics_[row_k_.num]) - floor(getColsolToCut(basics_[row_k_.num])); double p = 0; double q = 0; if(!modularize){//Take a shortcut p = -row_k_.rhs * (1 - fzero); q = row_i_.rhs * fzero; if (gammaSign < 0){ q -= row_i_.rhs; } } double r = 1.; double s = normedCoef( static_cast (gammaSign), basics_[row_i_.num]); bool haveSmallGammaPivot = false; double gammaTolerance = 0; if (allowDegenerate) gammaTolerance = 0; //fill the array with the gammas of correct sign for (int i = 0 ; i < ncols_ ; i++) { const int &ii = nonBasics_[i];//True index const double& val = getColsolToCut(ii); //value in solution to cut const double& row_k = row_k_[ii]; // coefficient in row k const double& row_i = row_i_[ii]; // coefficient in row i if(modularize){ p-=row_k_.rhs*row_k*val; q-=row_i_.rhs*row_k*val; } if (reducedSpace && colCandidateToLeave_[i]==false) { assert(col_in_subspace[ii]==false); continue; } double gamma = 1; if (fabs(row_i) > gammaTolerance && fabs(row_k) > gammaTolerance) { gamma = - row_k/row_i; if (gamma * gammaSign > gammaTolerance) { gammas_.insert(i,gamma*gammaSign); } } gamma = fabs(gamma); // we already know the sign of gamma, its absolute value is more usefull if (row_k>gammaTolerance) { if (gammaSign > 0) { p += row_k * val; } else { { p += row_k * val; q += row_i * val; } } r += normedCoef(row_k, ii) ; s += normedCoef(row_i, ii); } else if (row_k< gammaTolerance) { if (gammaSign > 0) { q -= row_i * val; } r -= normedCoef(row_k,ii); s -= normedCoef(row_i,ii); } else { haveSmallGammaPivot |= true; if (gammaSign > 0 && row_i < 0) { q -= row_i * val; } else if (gammaSign < 0 && row_i < 0) { q += row_i * val; } s += normedCoef(gammaSign*fabs(row_i),ii); } } if(modularize){ p -= row_k_.rhs * (1 - row_k_.rhs); q += row_i_.rhs * row_k_.rhs; if (gammaSign < 0){ q -= row_i_.rhs; } } int n = gammas_.getNumElements(); if (n==0) { resetOriginalTableauRow(basics_[row_i_.num], row_i_, direction); return -2; } gammas_.sortIncrElement(); const int* inds = gammas_.getIndices(); const double * elements = gammas_.getElements(); int bestColumn = -1; double newSigma = 1e100; DblEqAssert(sigma_, rhs_weight_*p/r); bestSigma = sigma_ = rhs_weight_*p/r; int lastValid = -1; #ifndef NDEBUG bool rc_positive=false; if (M3_.size()) DblEqAssert( gammaSign*(q * r - p * s)/r, chosenReducedCostVal_); #endif if ( gammaSign*(q * r - p * s) >= 0) { // after recomputing reduced cost (using exact row) it is found to be >=0 resetOriginalTableauRow(basics_[row_i_.num], row_i_, direction); return -2; #ifndef NDEBUG rc_positive = true; #endif } for (int i = 0 ; i < n ; i++) { double newRhs = row_k_.rhs + gammaSign * elements[i] * row_i_.rhs; if (newRhs < rhsTol || newRhs > 1 - rhsTol) { // if(i == 0) break; } newSigma = (p + gammaSign * elements[i] * q)*rhs_weight_/(r + gammaSign*elements[i] * s); #ifdef DEBUG_LAP double alt = computeCglpObjective(gammaSign*elements[i], false); DblEqAssert(newSigma, alt); #endif if (newSigma > bestSigma - 1e-08*bestSigma) { #ifndef NDEBUG if (!rc_positive) { } if (0 && elements[i] <= 1e-05) { } #endif break; } else if (newSigma <= bestSigma) // && colCandidateToLeave_[inds[i]]) { bestColumn = inds[i]; bestSigma = newSigma; lastValid = i; } #ifndef NDEBUG if (rc_positive) { break; } #endif int col = nonBasics_[inds[i]]; if (row_i_[col] *gammaSign > 0) { p += row_k_[col] * getColsolToCut(col); q += row_i_[col] * getColsolToCut(col); r += normedCoef(row_k_[col]*2,col); s += normedCoef(row_i_[col]*2,col); } else { p -= row_k_[col] * getColsolToCut(col); q -= row_i_[col] * getColsolToCut(col); r -= normedCoef(row_k_[col]*2,col); s -= normedCoef(row_i_[col]*2,col); } if (gammaSign*(q * r - p * s) >= 0) /* function is starting to increase stop here*/ { #ifndef NDEBUG if (0 && elements[i] <= 1e-5) { } rc_positive = true; #endif break; } } //Get the results did we find a valid pivot? is it degenerate? if (bestColumn == -1) // Apparently no pivot is within the tolerances { resetOriginalTableauRow(basics_[row_i_.num], row_i_, direction); handler_->message(WarnFailedPivotTol, messages_)<message(WarnFailedPivotTol, messages_)<message(FoundBestImprovingCol, messages_)<message(WarnFailedBestImprovingCol, messages_)<getInfinity(); int j = 0; double gamma = 0.; for (; j< ncols_orig_ ; j++) { if (reducedSpace && !colCandidateToLeave_[j] ) continue; if (fabs(row_i_[nonBasics_[j]])< pivotTol) { continue; } gamma = - row_k_[nonBasics_[j]]/row_i_[nonBasics_[j]]; newRow[basics_[row_k_.num]] = 1.; newRow.rhs = row_k_.rhs + gamma * row_i_.rhs; if (newRow.rhs > 1e-5 && newRow.rhs < 1 - 1e-5 ) { double m_j = computeCglpObjective(gamma, modularize, newRow); if (m_j < m) { varOut = j; m = m_j; } } } resetOriginalTableauRow(basics_[row_i_.num], row_i_, direction); if (m < sigma_ ) { handler_->message(FoundBestImprovingCol, messages_)< Note that by theory only one reduced cost (for u_i, or v_i) maybe negative for each direction. */ int direction; /** gammSign is the sign of gamma (corresponding to taking rc for u_i or v_i) for the best of the two rc for this row.*/ int gammaSign; /** gammaSign2 is the sign of gamma for the worst of the two rc for this row.*/ int gammaSign2; /** if both reduced costs are <0 value is the smallest of the two.*/ double value; /** greatest of the two reduced costs */ double value2; /** index of the row.*/ int row; bool operator<(const reducedCost & other) const { return (value>other.value); } }; /** Find incoming and leaving variables which lead to the most violated adjacent normalized lift-and-project cut. \remark At this point reduced costs should be already computed. \return incoming variable variable, \param leaving variable \param direction leaving direction \param numTryRows number rows tried \param pivotTol pivot tolerance \param reducedSpace separaration space (reduced or full) \param allowNonStrictlyImproving wether or not to allow non stricly improving pivots. */ int CglLandPSimplex::findBestPivot(int &leaving, int & direction, const CglLandP::Parameters & params) { // 1. Sort <0 reduced costs in increasing order // 2. for numTryRows reduced costs call findBestPivotColumn // if better record // The reduced cost are already here in rWk1_ is u^l_j // rwk2_ is u^u_j rWk3_ is v^u_j rWk4_ is v^u_j // Let's rename not to get too much confused double * ul_i = &rWk1_[0]; double * uu_i = &rWk2_[0]; double * vl_i = &rWk3_[0]; double * vu_i = &rWk4_[0]; reducedCost * rc = new reducedCost[nNegativeRcRows_]; int k = 0; rc[k].direction = 0;//initialize first rc int k2 = 0; for (int i = 0 ; i < nrows_ ; i++) { if (ul_i[i] < -params.pivotTol) // && rowFlags_[i]) //row has not been flaged { rc[k].direction = -1; rc[k].gammaSign = -1; rc[k].value = ul_i[i]; rc[k].row = i; k2++; } if (vl_i[i] < -params.pivotTol) //&& rowFlags_[i]) //row has not been flaged { rc[k].direction = -1; rc[k].gammaSign = 1; rc[k].value = vl_i[i]; rc[k].row = i; k2++; } if (uu_i[i] < -params.pivotTol) // && rowFlags_[i]) //row has not been flaged { if (rc[k].direction == 0) { rc[k].direction = 1; rc[k].gammaSign = -1; rc[k].value = uu_i[i]; rc[k].row = i; } else { if (uu_i[i] -1e-02) break; if (rc[l].value > -1e-02) break; row_i_.num=rc[l].row; pullTableauRow(row_i_);//Get the tableau row //compute f+ or f- for the best negative rc corresponding to this row chosenReducedCostVal_ = rc[l].value; double sigma; int incoming = fastFindBestPivotColumn (rc[l].direction, rc[l].gammaSign, params.pivotTol, params.away, (params.sepSpace==CglLandP::Fractional), 0, sigma, params.modularize); if (incoming!=-1 && bestSigma > sigma) { // std::cout<<"I found a better pivot "< 0 ? 1 : -1; bestRc = rc[l].value; notImproved = 0; } //Now evenutally compute f+ or f- for the other negative rc (if if exists) if (rc[l].direction == 2 || rc[l].direction == -2) { rc[l].direction/= -2;//Reverse the direction chosenReducedCostVal_ = rc[l].value2;//need to set this for debug double //checks incoming = fastFindBestPivotColumn (rc[l].direction, rc[l].gammaSign2, params.pivotTol, params.away, (params.sepSpace==CglLandP::Fractional), 0, sigma, params.modularize); if (incoming!=-1 && bestSigma > sigma) { // std::cout<<"I found a better pivot "< 0 ? coeff *(1- row.rhs): - coeff * row.rhs)*getColsolToCut(jj); } return numerator*rhs_weight_/denominator; } double CglLandPSimplex::computeCglpObjective(double gamma, bool strengthen) { double rhs = row_k_.rhs + gamma * row_i_.rhs; double numerator = - rhs * (1 - rhs); double denominator = 1; double coeff = gamma;//newRowCoefficient(basics_[row_i_.num], gamma); if (strengthen && isInteger(basics_[row_i_.num])) coeff = modularizedCoef(coeff, rhs); denominator += normedCoef(fabs(coeff), basics_[row_i_.num]); numerator += (coeff > 0 ? coeff *(1- rhs): - coeff * rhs)* getColsolToCut(basics_[row_i_.num]); for (int j = 0 ; j < ncols_ ; j++) { if (col_in_subspace[nonBasics_[j]]==false) { continue; } coeff = newRowCoefficient(nonBasics_[j], gamma); if (strengthen && nonBasics_[j] < ncols_orig_ && isInteger(j)) coeff = modularizedCoef(coeff, rhs); denominator += normedCoef(fabs(coeff), nonBasics_[j]); numerator += (coeff > 0 ? coeff *(1- rhs): - coeff * rhs)* getColsolToCut(nonBasics_[j]); } return numerator*rhs_weight_/denominator; } double CglLandPSimplex::computeCglpObjective(double gamma, bool strengthen, TabRow & newRow) { newRow.clear(); newRow.rhs = row_k_.rhs + gamma * row_i_.rhs; double numerator = -newRow.rhs * (1 - newRow.rhs); double denominator = 1; int * indices = newRow.getIndices(); int k = 0; { if (col_in_subspace[basics_[row_i_.num]]==false) { DblEqAssert(0.,1.); } double & val = newRow[ basics_[row_i_.num]] = gamma;//newRowCoefficient(basics_[row_i_.num], gamma); indices[k++] = basics_[row_i_.num]; if (strengthen && row_i_.num < ncols_orig_ && isInteger(row_i_.num)) newRow[ basics_[row_i_.num]] = modularizedCoef(newRow[ basics_[row_i_.num]], newRow.rhs); denominator += normedCoef(fabs(val), basics_[row_i_.num]); numerator += (val > 0 ? val *(1- newRow.rhs): - val * newRow.rhs)* getColsolToCut(basics_[row_i_.num]); } for (int j = 0 ; j < ncols_ ; j++) { double & val = newRow[nonBasics_[j]] = newRowCoefficient(nonBasics_[j], gamma); indices[k++] = nonBasics_[j]; if (strengthen && nonBasics_[j] < ncols_orig_ && isInteger(j)) newRow[ nonBasics_[j]] = modularizedCoef(val, newRow.rhs); if (col_in_subspace[nonBasics_[j]]==false) continue; denominator += normedCoef(fabs(val), nonBasics_[j]); numerator += (val > 0 ? val *(1- newRow.rhs): - val * newRow.rhs)* getColsolToCut(nonBasics_[j]); } newRow.setNumElements(k); //assert (fabs(numerator/denominator - computeCglpObjective(newRow))<1e-04); return numerator*rhs_weight_/denominator; } /** Compute the reduced cost of Cglp */ double CglLandPSimplex::computeCglpRedCost(int direction, int gammaSign, double tau) { double toBound; toBound = direction == -1 ? getLoBound(basics_[row_i_.num]) : getUpBound(basics_[row_i_.num]); double value =0; int sign = gammaSign * direction; double tau1 = 0; double tau2 = 0; for (unsigned int i = 0 ; i < M3_.size() ; i++) { tau1 += fabs(row_i_ [M3_[i]]); if (sign == 1 && row_i_[M3_[i]] < 0) { tau2 += row_i_[M3_[i]] * getColsolToCut(M3_[i]); } else if (sign == -1 && row_i_[M3_[i]] > 0) { tau2 += row_i_[M3_[i]] * getColsolToCut(M3_[i]); } } double Tau = - sign * (tau + tau2) - tau1 * sigma_; value = - sigma_ + Tau + (1 - getColsolToCut(basics_[row_k_.num])) * sign * (row_i_.rhs - toBound) + (gammaSign == 1)*direction*(toBound - getColsolToCut(basics_[row_i_.num])); return value; } /** Compute the value of sigma and thau (which are constants for a row i as defined in Mike Perregaard thesis */ double CglLandPSimplex::computeRedCostConstantsInRow() { double tau1 = 0; //the part which will be multiplied by sigma double tau2 = 0;//the rest for (unsigned int i = 0 ; i < M1_.size() ; i++) { tau1 += row_i_[M1_[i]]; } for (unsigned int i = 0 ; i < M2_.size() ; i++) { tau1 -= row_i_[M2_[i]]; tau2 += row_i_[M2_[i]] * getColsolToCut(M2_[i]); } return sigma_ * tau1 + tau2; } void CglLandPSimplex::updateM1_M2_M3(TabRow & row, double tolerance, bool perturb) { M1_.clear(); M2_.clear(); M3_.clear(); tolerance = 0; for (int i = 0; itolerance) { if (col_in_subspace[ii]) { M2_.push_back(ii); colCandidateToLeave_[i]=true; } else { colCandidateToLeave_[i]=false; } } else { if (col_in_subspace[ii]) { if (perturb) //assign to M1 or M2 at random { int sign = CoinDrand48() > 0.5 ? 1 : -1; if (sign == -1) //put into M1 { M1_.push_back(ii); colCandidateToLeave_[i]=true; } else //put into M2 { M2_.push_back(ii); colCandidateToLeave_[i]=true; } } else { M3_.push_back(ii); colCandidateToLeave_[i] = true; } } else { colCandidateToLeave_[i] = false; } } } //std::cout<<"M3 has "<getColLower(); const double * rowLower = si_->getRowLower(); const double * colUpper = si_->getColUpper(); const double * rowUpper = si_->getRowUpper(); // double f_0 = row.rhs; //put the row back into original form for (int j = 0; j < ncols_ ; j++) { if ((nonBasics_[j] < ncols_)) { CoinWarmStartBasis::Status status = getStatus(nonBasics_[j]); if (status==CoinWarmStartBasis::atLowerBound) { // row.rhs += getLoBound(nonBasics_[j]) * row[nonBasics_[j]]; } else if (status==CoinWarmStartBasis::atUpperBound) { row[nonBasics_[j]] = - row[nonBasics_[j]]; // row.rhs += getUpBound(nonBasics_[j]) * row[nonBasics_[j]]; } else { throw; } } } // return ; cut.setUb(COIN_DBL_MAX); double * vec = new double[ncols_orig_+ nrows_orig_ ]; CoinFillN(vec, ncols_orig_ + nrows_orig_, 0.); double infty = si_->getInfinity(); double cutRhs = row.rhs; cutRhs = cutRhs * (1 - cutRhs); for (int j = 0; j < ncols_ ; j++) { if (fabs(row[nonBasics_[j]])>1e-10) { double value = intersectionCutCoef(row[nonBasics_[j]], row.rhs); if (nonBasics_[j]getStructStatus(nonBasics_[j]); if (status==CoinWarmStartBasis::atUpperBound) { value = - intersectionCutCoef(- row[nonBasics_[j]], row.rhs) ; cutRhs += value * colUpper[nonBasics_[j]]; } else cutRhs += value * colLower[nonBasics_[j]]; vec[original_index_[nonBasics_[j]]] += value; } else if (nonBasics_[j]>=ncols_) { int iRow = nonBasics_[j] - ncols_; if (rowLower[iRow] > -infty) { value = -value; cutRhs -= value*rowLower[iRow]; assert(basis_->getArtifStatus(iRow)==CoinWarmStartBasis::atUpperBound || (fabs(rowLower[iRow] - rowUpper[iRow]) < 1e-08)); } else { cutRhs -= value*rowUpper[iRow]; assert(basis_->getArtifStatus(iRow)==CoinWarmStartBasis::atLowerBound); } vec[nonBasics_[j]] = value; assert(fabs(cutRhs)<1e100); } } } const CoinPackedMatrix * mat = si_->getMatrixByCol(); const CoinBigIndex * starts = mat->getVectorStarts(); const int * lengths = mat->getVectorLengths(); const double * values = mat->getElements(); const CoinBigIndex * indices = mat->getIndices(); for (int j = 0 ; j < ncols_ ; j++) { const int& start = starts[j]; int end = start + lengths[j]; for (int k = start ; k < end ; k++) { vec[original_index_[j]] -= vec[original_index_[ncols_ + indices[k]]] * values[k]; } } //Pack vec into the cut int * inds = new int [ncols_orig_]; int nelem = 0; for (int i = 0 ; i < ncols_orig_ ; i++) { if (fabs(vec[i]) > COIN_INDEXED_TINY_ELEMENT) { vec[nelem] = vec[i]; inds[nelem++] = i; } } cut.setLb(cutRhs); cut.setRow(nelem, inds, vec, false); delete [] vec; } /** Compute the normalization factor of the cut.*/ double CglLandPSimplex::normalizationFactor(const TabRow & row) const { double numerator = rhs_weight_; double denominator = 1.; for (int j = 0 ; j < ncols_ ; j++) { denominator += fabs(normedCoef(row[nonBasics_[j]], nonBasics_[j])); } return numerator/denominator; } /** Create MIG cut from row k*/ void CglLandPSimplex::createMIG( TabRow &row, OsiRowCut &cut) const { const double * colLower = si_->getColLower(); const double * rowLower = si_->getRowLower(); const double * colUpper = si_->getColUpper(); const double * rowUpper = si_->getRowUpper(); if (1) { double f_0 = row.rhs - floor(row.rhs); //put the row back into original form for (int j = 0; j < ncols_ ; j++) { if (nonBasics_[j] < ncols_) { const CoinWarmStartBasis::Status status = basis_->getStructStatus(nonBasics_[j]); if (status==CoinWarmStartBasis::atLowerBound) { // row.rhs += getLoBound(nonBasics_[j]) * row[nonBasics_[j]]; } else if (status==CoinWarmStartBasis::atUpperBound) { row[nonBasics_[j]] = - row[nonBasics_[j]]; // row.rhs += getUpBound(nonBasics_[j]) * row[nonBasics_[j]]; } else { throw; } } } //double scaleFactor = normalizationFactor(row); row.rhs = f_0; cut.setUb(COIN_DBL_MAX); double * vec = new double[ncols_orig_ + nrows_orig_]; CoinFillN(vec, ncols_orig_ + nrows_orig_, 0.); //f_0 = row.rhs - floor(row.rhs); double infty = si_->getInfinity(); double cutRhs = row.rhs - floor(row.rhs); cutRhs = cutRhs * (1 - cutRhs); assert(fabs(cutRhs)<1e100); for (int j = 0; j < ncols_ ; j++) { if (fabs(row[nonBasics_[j]])>0.) { { if (nonBasics_[j]getStructStatus(nonBasics_[j]); double value; if (status==CoinWarmStartBasis::atUpperBound) { value = - strengthenedIntersectionCutCoef(nonBasics_[j], - row[nonBasics_[j]], row.rhs) ; cutRhs += value * colUpper[nonBasics_[j]]; } else if (status==CoinWarmStartBasis::atLowerBound) { value = strengthenedIntersectionCutCoef(nonBasics_[j], row[nonBasics_[j]], row.rhs); cutRhs += value * colLower[nonBasics_[j]]; } else { std::cerr<<"Invalid basis"<getArtifStatus(iRow)==CoinWarmStartBasis::atUpperBound || (rowUpper[iRow] < infty)); } vec[original_index_[nonBasics_[j]]] = value; assert(fabs(cutRhs)<1e100); } } } } //Eliminate slacks eliminate_slacks(vec); //Pack vec into the cut int * inds = new int [ncols_orig_]; int nelem = 0; for (int i = 0 ; i < ncols_orig_ ; i++) { if (fabs(vec[i]) > COIN_INDEXED_TINY_ELEMENT) { vec[nelem] = vec[i]; inds[nelem++] = i; } } cut.setLb(cutRhs); cut.setRow(nelem, inds, vec, false); //std::cout<<"Scale factor: "<getMatrixByCol(); const CoinBigIndex * starts = mat->getVectorStarts(); const int * lengths = mat->getVectorLengths(); const double * values = mat->getElements(); const CoinBigIndex * indices = mat->getIndices(); const double * vecSlacks = vec + ncols_orig_; for (int j = 0 ; j < ncols_ ; j++) { const CoinBigIndex& start = starts[j]; CoinBigIndex end = start + lengths[j]; double & val = vec[original_index_[j]]; for (CoinBigIndex k = start ; k < end ; k++) { val -= vecSlacks[indices[k]] * values[k]; } } } void CglLandPSimplex::scaleCut(OsiRowCut & cut, double factor) const { DblGtAssert(factor, 0.); cut *= factor; cut.setLb(cut.lb()*factor); } #ifdef APPEND_ROW void CglLandPSimplex::append_row(int row_num, bool modularize) { int old_idx = basics_[row_num]; int r_idx = nrows_ - 1; if (basis_->getArtifStatus(nrows_ - 1) == CoinWarmStartBasis::basic) { int i = 0; for (; i < ncols_ ; i++) { if (nonBasics_[i] == ncols_ + nrows_ -1) break; } if (i < ncols_) { nonBasics_[i] = ncols_ + nrows_ - 1; assert(basics_[nrows_ - 1] == ncols_ + nrows_ - 1); basics_[nrows_ - 1] = ncols_ - 1; } } #if 0 if (basis_->getStructStatus(ncols_ - 1) != CoinWarmStartBasis::basic) { basis_->setStructStatus(ncols_ - 1, CoinWarmStartBasis::basic); assert(basis_->getArtifStatus(nrows_ - 1) == CoinWarmStartBasis::basic); basis_->setArtifStatus(nrows_ - 1, CoinWarmStartBasis::atLowerBound); si_->pivot(ncols_ - 1, ncols_ + nrows_ - 1, -1); } #endif TabRow row(this); int rowsize = ncols_orig_ + nrows_orig_ + 1; row.reserve(rowsize); row.num = row_num; pullTableauRow(row); row.rhs -= floor(row.rhs); if (basis_->getStructStatus(ncols_ - 1) != CoinWarmStartBasis::basic) { basis_->setStructStatus(ncols_ - 1, CoinWarmStartBasis::basic); assert(basis_->getArtifStatus(nrows_ - 1) == CoinWarmStartBasis::basic); basis_->setArtifStatus(nrows_ - 1, CoinWarmStartBasis::atLowerBound); si_->pivot(ncols_ - 1, ncols_ + nrows_ - 1, -1); } int n = row.getNumElements(); const int* ind = row.getIndices(); #ifdef COIN_HAS_OSICLP CoinPackedMatrix * m = clp_->getMutableMatrixByCol(); #endif #if 1 const double * rowLower = si_->getRowLower(); const double * rowUpper = si_->getRowUpper(); double infty = si_->getInfinity(); double rhs = floor (colsol_[old_idx]);//floor(row.rhs); std::vector vec(rowsize,0.); for (int i = 0 ; i < n ; i++) { const int &ni = ind[i]; if (ni == old_idx) continue; if (integers_[ni]) { double f = modularizedCoef(row[ni],row.rhs); f = floor(row[ni] - f + 0.5); row[ni] -= f; if (ni < ncols_) { if (basis_->getStructStatus(ni) == CoinWarmStartBasis::atUpperBound) { f *= -1; rhs += f * getUpBound(ni); } if (basis_->getStructStatus(ni) == CoinWarmStartBasis::atLowerBound) { //f *= -1; rhs -= f * getLoBound(ni); } vec[ni]=f; } else { int iRow = ind[i] - ncols_; if (basis_->getArtifStatus(iRow)==CoinWarmStartBasis::atLowerBound) { rhs -= f*rowUpper[iRow]; } else if (basis_->getArtifStatus(iRow)==CoinWarmStartBasis::atUpperBound) { f *= -1; rhs -= f*rowLower[iRow]; assert(rowLower[iRow] < infty); } vec[ni] = f; } } } vec[old_idx] = 1; eliminate_slacks(&vec[0]); for (int i = 0 ; i < rowsize ; i++) { if (vec[i]) m->modifyCoefficient(r_idx, i, vec[i], true); } si_->setRowBounds(r_idx, rhs, rhs); #endif #if 1 si_->messageHandler()->setLogLevel(0); si_->resolve(); assert(si_->getIterationCount() == 0); #endif /* Update the cached info.*/ #ifndef NDEBUG int * basics = new int[nrows_]; #else int * basics = basics_; #endif si_->getBasics(basics); #ifndef NDEBUG for (int i = 0 ; i < r_idx ; i++) { assert(basics[i] == basics_[i]); } assert(basics[r_idx] == ncols_ - 1); delete [] basics_; basics_ = basics; #endif assert(basis_->getStructStatus(old_idx) == CoinWarmStartBasis::basic); assert(basis_->getStructStatus(ncols_ - 1) == CoinWarmStartBasis::basic); n = 0; for (int i = 0 ; i < ncols_ ; i++) { if (basis_->getStructStatus(i) != CoinWarmStartBasis::basic) { nonBasics_[n++] = i; } } for (int i = 0 ; i < nrows_ ; i++) { if (basis_->getArtifStatus(i) != CoinWarmStartBasis::basic) { nonBasics_[n++] = i + ncols_; } } assert (n == ncols_); colsol_[ncols_ - 1] = si_->getColSolution()[ncols_-1]; colsolToCut_[ncols_ - 1] = si_->getColSolution()[ncols_-1]; } void CglLandPSimplex::check_mod_row(TabRow & row) { int rowsize = ncols_orig_ + nrows_orig_; for (int i = 0 ; i < rowsize ; i++) { assert(! integers_[i] || ((row[i] <= row.rhs+1e-08) && (row[i] >= row.rhs - 1- 1e-08))); } } void CglLandPSimplex::update_row(TabRow &row) { int r_idx = nrows_ - 1; int c_idx = ncols_ - 1; assert(basics_[row.num] == ncols_ - 1); assert(r_idx == row.num); int rowsize = nrows_ + ncols_; int n = row.getNumElements(); const int* ind = row.getIndices(); #ifdef COIN_HAS_OSICLP CoinPackedMatrix * m = clp_->getMutableMatrixByCol(); #endif //double * m_el = m->getMutableElements(); //const int * m_id = m->getIndices(); //const int * m_le = m->getVectorLengths(); //const CoinBigIndex * m_st = m->getVectorStarts(); const double * rowLower = si_->getRowLower(); const double * rowUpper = si_->getRowUpper(); double infty = si_->getInfinity(); double rhs = floor(row.rhs); std::vector vec(rowsize,0.); for (int i = 0 ; i < n ; i++) { const int &ni = ind[i]; if (ni == c_idx) continue; if (integers_[ni]) { double f = modularizedCoef(row[ni],row.rhs); f = floor(row[ni] - f + 0.5); //row[ni] -= f; if (ni < ncols_) { assert(basis_->getStructStatus(ni) != CoinWarmStartBasis::basic); if (basis_->getStructStatus(ni) == CoinWarmStartBasis::atUpperBound) { f *= -1; rhs += f * getUpBound(ni); } if (basis_->getStructStatus(ni) == CoinWarmStartBasis::atLowerBound) { rhs -= f * getLoBound(ni); } vec[ni]=f; } else { //continue; int iRow = ind[i] - ncols_; if (iRow == r_idx) continue; assert(basis_->getArtifStatus(iRow) != CoinWarmStartBasis::basic); if (basis_->getArtifStatus(iRow)==CoinWarmStartBasis::atLowerBound) { rhs -= f*rowUpper[iRow]; } else if (basis_->getArtifStatus(iRow)==CoinWarmStartBasis::atUpperBound) { f *= -1; rhs -= f*rowLower[iRow]; assert(rowUpper[iRow] < infty); } vec[ni] = f; } } } std::copy(vec.begin(),vec.end(), std::ostream_iterator(std::cout, "\t")); std::cout<(std::cout, "\t")); std::cout<getCoefficient(r_idx,i); m->modifyCoefficient(r_idx, i, f + vec[i], true); } } si_->setRowBounds(r_idx, rowLower[r_idx] + rhs, rowUpper[r_idx] + rhs); #ifdef COIN_HAS_OSICLP clp_->getModelPtr()->factorize(); #endif pullTableauRow(row); assert(row.rhs >= 0. && row.rhs <= 1.); bool stop = false; for (int i = 0 ; i < rowsize ; i++) { if (integers_[i] && (row[i] > row.rhs || row[i] < row.rhs - 1)) { stop = true; } //assert(! integers_[i] || (row[i] <= row.rhs && row[i] > row.rhs - 1)); } if (stop) exit(10); } #endif /** Get the row i of the tableau */ void CglLandPSimplex::pullTableauRow(TabRow &row) const { const double * rowLower = si_->getRowLower(); const double * rowUpper = si_->getRowUpper(); row.clear(); row.modularized_ = false; double infty = si_->getInfinity(); /* Get the row */ #ifdef COIN_HAS_OSICLP if (clp_) { CoinIndexedVector array2; array2.borrowVector(nrows_, 0, row.getIndices() + ncols_, row.denseVector() + ncols_); clp_->getBInvARow(row.num, &row, &array2); { int n = array2.getNumElements(); int * indices1 = row.getIndices() + row.getNumElements(); int * indices2 = array2.getIndices(); for ( int i = 0 ; i < n ; i++) { *indices1 = indices2[i] + ncols_; indices1++; } row.setNumElements(n + row.getNumElements()); array2.returnVector(); } } else #endif { si_->getBInvARow(row.num,row.denseVector(),row.denseVector() + ncols_); } //Clear basic element (it is a trouble for most of the computations) row[basics_[row.num]]=0.; // row.row[basics_[row.num]]=1; /* get the rhs */ { int iCol = basics_[row.num]; if (iColgetColSolution()[iCol]; else // Osi does not give direct acces to the value of slacks { iCol -= ncols_; row.rhs = - si_->getRowActivity()[iCol]; if (rowLower[iCol]> -infty) { row.rhs += rowLower[iCol]; } else { row.rhs+= rowUpper[iCol]; } } } //Now adjust the row of the tableau to reflect non-basic variables activity for (int j = 0; j < ncols_ ; j++) { if (nonBasics_[j]getStructStatus(nonBasics_[j])==CoinWarmStartBasis::atLowerBound) { } else if (basis_->getStructStatus(nonBasics_[j])==CoinWarmStartBasis::atUpperBound) { row[nonBasics_[j]] = -row[nonBasics_[j]]; } else { std::cout<<(basis_->getStructStatus(nonBasics_[j])==CoinWarmStartBasis::isFree)<getArtifStatus(iRow)==CoinWarmStartBasis::atUpperBound) { row[nonBasics_[j]] = -row[nonBasics_[j]]; } } } // row.clean(1e-30); } /** Adjust the row of the tableau to reflect leaving variable direction */ void CglLandPSimplex::adjustTableauRow(int var, TabRow & row, int direction) { double bound = 0; assert(direction != 0); if (direction > 0) { for (int j = 0 ; j < ncols_orig_ ; j++) row[nonBasics_[j]] = - row[nonBasics_[j]]; row.rhs = -row.rhs; bound = getUpBound(var); setColsolToCut(var, bound - getColsolToCut(var)); row.rhs += bound; } else if (direction < 0) { bound = getLoBound(var); setColsolToCut(var, getColsolToCut(var) - bound); row.rhs -= bound; } // assert(fabs(row.rhs)<1e100); } /** reset the tableau row after a call to adjustTableauRow */ void CglLandPSimplex::resetOriginalTableauRow(int var, TabRow & row, int direction) { if (direction > 0) { adjustTableauRow(var, row, direction); } else { double bound = getLoBound(var); row.rhs += bound; setColsolToCut(var, getColsolToCut(var) + bound); } } template struct SortingOfArray { X * array; SortingOfArray(X* a): array(a) {} bool operator()(const int i, const int j) { return array[i] < array[j]; } }; void CglLandPSimplex::removeRows(int nDelete, const int * rowsIdx) { std::vector sortedIdx; for (int i = 0 ; i < nDelete ; i++) sortedIdx.push_back(rowsIdx[i]); std::sort(sortedIdx.end(), sortedIdx.end()); si_->deleteRows(nDelete, rowsIdx); int k = 1; int l = sortedIdx[0]; for (int i = sortedIdx[0] + 1 ; k < nDelete ; i++) { if (sortedIdx[k] == i) { k++; } else { original_index_[l] = original_index_[i]; l++; } } delete basis_; basis_ = dynamic_cast (si_->getWarmStart()); assert(basis_); /* Update rowFlags_ */ std::vector order(nrows_); for (unsigned int i = 0 ; i < order.size() ; i++) { order[i] = i; } std::sort(order.begin(), order.end(), SortingOfArray(basics_)); k = 0; l = 0; for (int i = 0 ; k < nDelete ; i++) { if (basics_[order[i]] == sortedIdx[k]) { basics_[order[i]] = -1; k++; } else { order[l] = order[i]; l++; } } k = 0; for (int i = 0 ; i < nrows_ ; i++) { if (basics_[i] == -1) { k++; } else { basics_[l] = basics_[i]; rowFlags_[l] = rowFlags_[i]; rWk1_[l] = rWk1_[i]; rWk2_[l] = rWk2_[i]; rWk4_[l] = rWk3_[i]; rWk4_[l] = rWk4_[i]; if (row_k_.num == i) row_k_.num = l; l++; } } nrows_ = nrows_ - nDelete; original_index_.resize(nrows_); int numStructural = basis_->getNumStructural(); assert(ncols_ = numStructural); int nNonBasics = 0; for (int i = 0 ; i < numStructural ; i++) { if (basis_->getStructStatus(i) != CoinWarmStartBasis::basic) { nonBasics_[nNonBasics++] = i; } } int numArtificial = basis_->getNumArtificial(); assert(nrows_ = numArtificial); for (int i = 0 ; i < numArtificial ; i++) { if (basis_->getArtifStatus(i)!= CoinWarmStartBasis::basic) { nonBasics_[nNonBasics++] = i + numStructural; } } assert (nNonBasics == ncols_); } void CglLandPSimplex::printEverything(){ row_k_.print(std::cout, 2, nonBasics_, ncols_); printf("nonBasics_: "); for(int i = 0 ; i < ncols_ ; i++){ printf("%5i ",nonBasics_[i]); } printf("\n"); printf("basics_: "); for(int i = 0 ; i < nrows_ ; i++){ printf("%5i ",basics_[i]); } printf("\n"); printf("source row:"); for(int i = 0 ; i < ncols_ + nrows_ ; i++){ printf("%10.9g ", row_k_[i]); } printf("%10.9g", row_k_.rhs); printf("\n"); printf(" source indices: "); for(int i = 0 ; i < row_k_.getNumElements() ; i++){ printf("%5i %20.20g ", row_k_.getIndices()[i], row_k_[row_k_.getIndices()[i]]); } printf("\n"); printf("colsolToCut: "); for(int i = 0 ; i < ncols_ + nrows_ ; i++){ printf("%10.6g ", colsolToCut_[i]); } printf("\n"); printf("colsol: "); for(int i = 0 ; i < ncols_ + nrows_ ; i++){ printf("%10.6g ", colsol_[i]); } printf("\n"); } }/* Ends LAP namespace.*/ CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPValidator.hpp0000644000175000017500000000745012563406720020252 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 11/22/05 // // $Id: CglLandPValidator.hpp 1302 2015-08-14 15:48:32Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #ifndef CglLandPValidator_H #define CglLandPValidator_H #include "OsiSolverInterface.hpp" #include "CglParam.hpp" #include /** constants describing rejection codes*/ //[5] = {"Accepted", "violation too small", "small coefficient too small", "big dynamic","too dense"} namespace LAP { /** Class to validate or reject a cut */ class Validator { public: /** Reasons for rejecting a cut */ enum RejectionsReasons { NoneAccepted=0 /**Cut was accepted*/, SmallViolation /** Violation of the cut is too small */, SmallCoefficient /** There is a small coefficient we can not get rid off.*/, BigDynamic /** Dynamic of coefficinet is too important. */, DenseCut/**cut is too dense */, EmptyCut/**After cleaning cut has become empty*/, DummyEnd/** dummy*/ }; /** Constructor with default values */ Validator(double maxFillIn = 1., double maxRatio = 1e8, double minViolation = 0, bool scale = false, double rhsScale = 1); /** Clean an OsiCut */ int cleanCut(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par, const double * colLower, const double * colUpper); /** Clean an OsiCut by another method */ int cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam & par, const double * colLower, const double * colUpper); /** Call the cut cleaner */ int operator()(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par, const double * colLower, const double * colUpper) { return cleanCut(aCut, solCut, si, par, colLower, colUpper); } /** @name set functions */ /** @{ */ void setMaxFillIn(double value) { maxFillIn_ = value; } void setMaxRatio(double value) { maxRatio_ = value; } void setMinViolation(double value) { minViolation_ = value; } void setRhsScale(double v) { rhsScale_ = v; } /** @} */ /** @name get functions */ /** @{ */ double getMaxFillIn() { return maxFillIn_; } double getMaxRatio() { return maxRatio_; } double getMinViolation() { return minViolation_; } /** @} */ const char* failureString(RejectionsReasons code) const { return rejections_[static_cast (code)]; } const char* failureString(int code) const { return rejections_[ code]; } int numRejected(RejectionsReasons code)const { return numRejected_[static_cast (code)]; } int numRejected(int code)const { return numRejected_[ code]; } private: /** max percentage of given formulation fillIn should be accepted for cut fillin.*/ double maxFillIn_; /** max ratio between smallest and biggest coefficient */ double maxRatio_; /** minimum violation for accepting a cut */ double minViolation_; /** Do we do scaling? */ bool scale_; /** Scale of right-hand-side.*/ double rhsScale_; /** Strings explaining reason for rejections */ static const char* rejections_[DummyEnd]; /** Number of cut rejected for each of the reasons.*/ std::vector numRejected_; }; }/* Ends namespace LAP.*/ #endif CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPUtils.hpp0000644000175000017500000000517612130104031017404 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // LIF // CNRS, Aix-Marseille Universites // Date: 02/23/08 // // $Id: CglLandPUtils.hpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #ifndef CglLandPUtils_H #define CglLandPUtils_H #include "CglLandPTabRow.hpp" class CoinRelFltEq; class OsiRowCut; class OsiCuts; #include #include namespace LAP { /** Compute \$ \frac{\sum\limits_{j=1}^n | \overline a_{ij} |}{1 - \overline a_{i0}} \$ for row passed as argument.*/ double normCoef(TabRow &row, int ncols, const int * nonBasics); /** scale the cut passed as argument*/ void scale(OsiRowCut &cut); /** scale the cut passed as argument using provided normalization factor*/ void scale(OsiRowCut &cut, double norma); /** Modularize row.*/ void modularizeRow(TabRow & row, const bool * integerVar); /** return the coefficients of the intersection cut */ inline double intersectionCutCoef(double alpha_i, double beta) { if (alpha_i>0) return alpha_i* (1 - beta); else return -alpha_i * beta;// (1 - beta); } /** compute the modularized row coefficient for an integer variable*/ inline double modularizedCoef(double alpha, double beta) { double f_i = alpha - floor(alpha); if (f_i <= beta) return f_i; else return f_i - 1; } /** Says is value is integer*/ inline bool int_val(double value, double tol) { return fabs( floor( value + 0.5 ) - value ) < tol; } /** To store extra cuts generated by columns from which they origin.*/ struct Cuts { Cuts(): numberCuts_(0), cuts_(0) { } /** Puts all the cuts into an OsiCuts */ int insertAll(OsiCuts & cs, CoinRelFltEq& eq); /** Destructor.*/ ~Cuts() {} /** Access to row cut indexed by i*/ OsiRowCut * rowCut(unsigned int i) { return cuts_[i]; } /** const access to row cut indexed by i*/ const OsiRowCut * rowCut(unsigned int i) const { return cuts_[i]; } /** insert a cut for variable i and count number of cuts.*/ void insert(int i, OsiRowCut * cut); /** Access to number of cuts.*/ int numberCuts() { return numberCuts_; } /** resize vector.*/ void resize(unsigned int i) { cuts_.resize(i, reinterpret_cast (NULL)); } private: /** Stores the number of cuts.*/ int numberCuts_; /** Store the cuts by index of the generating simple disjunction.*/ std::vector cuts_; }; } #endif CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPUtils.cpp0000644000175000017500000000476012130104031017375 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // LIF // CNRS, Aix-Marseille Universites // Date: 02/23/08 // // $Id: CglLandPUtils.cpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #include "CglLandPUtils.hpp" #include "OsiRowCut.hpp" #include "OsiCuts.hpp" namespace LAP { double normCoef(TabRow &row, int ncols, const int * nonBasics) { double res = 1; for (int i = 0 ; i < ncols ; i++) res += fabs(row[nonBasics[i]]); return res/(1-row.rhs); } /** scale the cut passed as argument using provided normalization factor*/ void scale(OsiRowCut &cut, double norma) { assert(norma >0.); CoinPackedVector row; row.reserve(cut.row().getNumElements()); for (int i = 0 ; i < cut.row().getNumElements() ; i++) { row.insert(cut.row().getIndices()[i], cut.row().getElements()[i]/norma); } cut.setLb(cut.lb()/norma); cut.setRow(row); } /** scale the cut passed as argument*/ void scale(OsiRowCut &cut) { double rhs = fabs(cut.lb()); CoinPackedVector row; row.reserve(cut.row().getNumElements()); for (int i = 0 ; i < cut.row().getNumElements() ; i++) { row.insert(cut.row().getIndices()[i], cut.row().getElements()[i]/rhs); } cut.setLb(cut.lb()/rhs); cut.setRow(row); } /** Modularize row.*/ void modularizeRow(TabRow & row, const bool * integerVar) { const int& n = row.getNumElements(); const int* ind = row.getIndices(); for (int i = 0 ; i < n ; i++) { const int &ni = ind[i]; if (integerVar[ni]) row[ni] = modularizedCoef(row[ni],row.rhs); } } int Cuts::insertAll(OsiCuts & cs, CoinRelFltEq& eq) { int r_val = 0; for (unsigned int i = 0 ; i < cuts_.size() ; i++) { if (cuts_[i] != NULL) { cs.insertIfNotDuplicate(*cuts_[i], eq); delete cuts_[i]; cuts_[i] = NULL; r_val++; } } return r_val; } /** insert a cut for variable i and count number of cuts.*/ void Cuts::insert(int i, OsiRowCut * cut) { if (cuts_[i] == NULL) numberCuts_++; else { printf("Replacing cut with violation %g with one from optimal basis with violation %g.\n", cuts_[i]->effectiveness(), cut->effectiveness()); delete cuts_[i]; } cuts_[i] = cut; } } CoinMP-1.8.3/Cgl/src/CglLandP/CglLandP.cpp0000644000175000017500000005403712130104031016356 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 07/21/05 // // $Id: CglLandP.cpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #include "CglLandP.hpp" #include "CglLandPSimplex.hpp" #define INT_INFEAS(value) fabs(value - floor(value+0.5)) #include "CglConfig.h" #ifdef COIN_HAS_OSICLP #include "OsiClpSolverInterface.hpp" #endif #define CLONE_SI //Solver is cloned between two cuts #include "CoinTime.hpp" #include "CglGomory.hpp" #include "CoinFactorization.hpp" #include namespace LAP { //Setup output messages LapMessages::LapMessages( ) :CoinMessages(LAP_MESSAGES_DUMMY_END) { strcpy(source_,"Lap"); addMessage(BEGIN_ROUND,CoinOneMessage( 1, 2,"Starting %s round %d variable considered for separation.")); addMessage(END_ROUND,CoinOneMessage(2, 2,"End ouf %s round %d cut generated in %g seconds.")); addMessage(DURING_SEP,CoinOneMessage(3,1,"After %g seconds, separated %d cuts.")); addMessage(CUT_REJECTED, CoinOneMessage(4,1,"Cut rejected for %s.")); addMessage(CUT_FAILED,CoinOneMessage(5,1,"Generation failed.")); addMessage(CUT_GAP, CoinOneMessage(7,1,"CUTGAP after %i pass objective is %g")); addMessage(LAP_CUT_FAILED_DO_MIG, CoinOneMessage(3006,1,"Failed to generate a cut generate a Gomory cut instead")); } } using namespace LAP; CglLandP::Parameters::Parameters(): CglParam(), pivotLimit(20), pivotLimitInTree(10), maxCutPerRound(5000), failedPivotLimit(1), degeneratePivotLimit(0), extraCutsLimit(5), pivotTol(1e-4), away(5e-4), timeLimit(COIN_DBL_MAX), singleCutTimeLimit(COIN_DBL_MAX), rhsWeight(1.), useTableauRow(true), modularize(false), strengthen(true), countMistakenRc(false), sepSpace(Fractional), perturb(true), normalization(Unweighted), rhsWeightType(Fixed), lhs_norm(L1), generateExtraCuts(none), pivotSelection(mostNegativeRc) { EPS = 1e-08; } CglLandP::Parameters::Parameters(const Parameters &other): CglParam(other), pivotLimit(other.pivotLimit), pivotLimitInTree(other.pivotLimitInTree), maxCutPerRound(other.maxCutPerRound), failedPivotLimit(other.failedPivotLimit), degeneratePivotLimit(other.degeneratePivotLimit), extraCutsLimit(other.extraCutsLimit), pivotTol(other.pivotTol), away(other.away), timeLimit(other.timeLimit), singleCutTimeLimit(other.singleCutTimeLimit), rhsWeight(other.rhsWeight), useTableauRow(other.useTableauRow), modularize(other.modularize), strengthen(other.strengthen), countMistakenRc(other.countMistakenRc), sepSpace(other.sepSpace), perturb(other.perturb), normalization(other.normalization), rhsWeightType(other.rhsWeightType), lhs_norm(other.lhs_norm), generateExtraCuts(other.generateExtraCuts), pivotSelection(other.pivotSelection) {} CglLandP::Parameters & CglLandP::Parameters::operator=(const Parameters &other) { if (this != &other) { CglParam::operator=(other); pivotLimit = other.pivotLimit; pivotLimitInTree = other.pivotLimitInTree; maxCutPerRound = other.maxCutPerRound; failedPivotLimit = other.failedPivotLimit; degeneratePivotLimit = other.failedPivotLimit; extraCutsLimit = other.extraCutsLimit; pivotTol = other.pivotTol; away = other.away; timeLimit = other.timeLimit; singleCutTimeLimit = other.singleCutTimeLimit; rhsWeight = other.rhsWeight; useTableauRow = other.useTableauRow; modularize = other.modularize; strengthen = other.strengthen; countMistakenRc = other.countMistakenRc; sepSpace = other.sepSpace; perturb = other.perturb; normalization = other.normalization; rhsWeightType = other.rhsWeightType; lhs_norm = other.lhs_norm; generateExtraCuts = other.generateExtraCuts; pivotSelection = other.pivotSelection; } return *this; } CglLandP::CachedData::CachedData(int nBasics, int nNonBasics): basics_(NULL), nonBasics_(NULL), nBasics_(nBasics), nNonBasics_(nNonBasics), basis_(NULL), colsol_(NULL), slacks_(NULL), integers_(NULL), solver_(NULL) { if (nBasics_>0) { basics_ = new int[nBasics_]; integers_ = new bool [nNonBasics_ + nBasics_]; } if (nNonBasics_>0) nonBasics_ = new int[nNonBasics_]; if (nBasics_ + nNonBasics_ > 0) { colsol_ = new double[nBasics_ + nNonBasics_]; slacks_ = &colsol_[nNonBasics_]; } } CglLandP::CachedData::CachedData(const CachedData &source): basics_(NULL), nonBasics_(NULL), nBasics_(source.nBasics_), nNonBasics_(source.nNonBasics_), basis_(NULL), colsol_(NULL), slacks_(NULL), integers_(NULL), solver_(NULL) { if (nBasics_>0) { basics_ = new int[nBasics_]; CoinCopyN(source.basics_, nBasics_, basics_); integers_ = new bool [nNonBasics_ + nBasics_]; CoinCopyN(source.integers_, nBasics_ + nNonBasics_, integers_); } if (nNonBasics_>0) { nonBasics_ = new int[nNonBasics_]; CoinCopyN(source.nonBasics_, nBasics_, nonBasics_); } if (nBasics_ + nNonBasics_ > 0) { colsol_ = new double[nBasics_ + nNonBasics_]; slacks_ = &colsol_[nNonBasics_]; CoinCopyN(source.colsol_, nBasics_ + nNonBasics_, colsol_); } if (source.basis_!=NULL) basis_ = new CoinWarmStartBasis(*source.basis_); if (source.solver_!=NULL) solver_ = source.solver_->clone(); } CglLandP::CachedData& CglLandP::CachedData::operator=(const CachedData &source) { if (this != &source) { nBasics_ = source.nBasics_; nNonBasics_ = source.nNonBasics_; if (basics_ == NULL) delete [] basics_; basics_ = NULL; if (nonBasics_ == NULL) delete [] nonBasics_; nonBasics_ = NULL; if (basis_ == NULL) delete [] basis_; basis_ = NULL; if (colsol_ == NULL) delete [] colsol_; colsol_ = NULL; if (slacks_ == NULL) delete [] slacks_; slacks_ = NULL; if (integers_ == NULL) delete [] integers_; integers_ = NULL; if (nBasics_>0) { basics_ = new int[nBasics_]; CoinCopyN(source.basics_, nBasics_, basics_); integers_ = new bool [nBasics_ + nNonBasics_]; CoinCopyN(source.integers_, nBasics_ + nNonBasics_, integers_); } if (nNonBasics_>0) { nonBasics_ = new int[nNonBasics_]; CoinCopyN(source.nonBasics_, nBasics_, nonBasics_); } if (nBasics_ + nNonBasics_ > 0) { colsol_ = new double[nBasics_ + nNonBasics_]; slacks_ = &colsol_[nNonBasics_]; CoinCopyN(source.colsol_, nBasics_ + nNonBasics_, colsol_); } if (source.basis_!=NULL) basis_ = new CoinWarmStartBasis(*source.basis_); delete solver_; if (source.solver_) solver_ = source.solver_->clone(); } return *this; } void CglLandP::CachedData::getData(const OsiSolverInterface &si) { int nBasics = si.getNumRows(); int nNonBasics = si.getNumCols(); if (basis_ != NULL) delete basis_; basis_ = dynamic_cast (si.getWarmStart()); if (!basis_) throw NoBasisError(); if (nBasics_ > 0 || nBasics != nBasics_) { delete [] basics_; basics_ = NULL; } if (basics_ == NULL) { basics_ = new int[nBasics]; nBasics_ = nBasics; } if (nNonBasics_ > 0 || nNonBasics != nNonBasics_) { delete [] nonBasics_; nonBasics_ = NULL; } if (nonBasics_ == NULL) { nonBasics_ = new int[nNonBasics]; nNonBasics_ = nNonBasics; } int n = nBasics + nNonBasics; if ( nBasics_ + nNonBasics_ > 0 || nBasics_ + nNonBasics_ != n) { delete [] colsol_; delete [] integers_; integers_ = NULL; colsol_ = NULL; slacks_ = NULL; } if (colsol_ == NULL) { colsol_ = new double[n]; slacks_ = &colsol_[nNonBasics]; } if (integers_ == NULL) { integers_ = new bool[n]; } const double * rowLower = si.getRowLower(); const double * rowUpper = si.getRowUpper(); //determine which slacks are integer const CoinPackedMatrix * m = si.getMatrixByCol(); const double * elems = m->getElements(); const int * inds = m->getIndices(); const CoinBigIndex * starts = m->getVectorStarts(); const int * lengths = m->getVectorLengths(); // int numElems = m->getNumElements(); int numCols = m->getNumCols(); assert(numCols == nNonBasics_); // int numRows = m->getNumRows(); CoinFillN(integers_ ,n, true); for (int i = 0 ; i < numCols ; i++) { if (si.isContinuous(i)) integers_[i] = false; } bool * integerSlacks = integers_ + numCols; for (int i = 0 ; i < nBasics ; i++) { if (rowLower[i] > -1e50 && INT_INFEAS(rowLower[i]) > 1e-15) integerSlacks[i] = false; if (rowUpper[i] < 1e50 && INT_INFEAS(rowUpper[i]) > 1e-15) integerSlacks[i] = false; } for (int i = 0 ; i < numCols ; i++) { CoinBigIndex end = starts[i] + lengths[i]; if (integers_[i]) { for (CoinBigIndex k=starts[i] ; k < end; k++) { if (integerSlacks[inds[k]] && INT_INFEAS(elems[k])>1e-15 ) integerSlacks[inds[k]] = false; } } else { for (CoinBigIndex k=starts[i] ; k < end; k++) { if (integerSlacks[inds[k]]) integerSlacks[inds[k]] = false; } } } CoinCopyN(si.getColSolution(), si.getNumCols(), colsol_); CoinCopyN(si.getRowActivity(), si.getNumRows(), slacks_); for (int i = 0 ; i < si.getNumRows() ; i++) { slacks_[i]*=-1; if (rowLower[i]>-1e50) { slacks_[i] += rowLower[i]; } else { slacks_[i] += rowUpper[i]; } } //Now get the fill the arrays; nNonBasics = 0; nBasics = 0; //For having the index variables correctly ordered we need to access to OsiSimplexInterface { OsiSolverInterface * ncSi = (const_cast(&si)); ncSi->enableSimplexInterface(0); ncSi->getBasics(basics_); // Save enabled solver solver_ = si.clone(); #ifdef COIN_HAS_OSICLP OsiClpSolverInterface * clpSi = dynamic_cast(solver_); const OsiClpSolverInterface * clpSiRhs = dynamic_cast(&si); if (clpSi) clpSi->getModelPtr()->copyEnabledStuff(clpSiRhs->getModelPtr());; #endif ncSi->disableSimplexInterface(); } int numStructural = basis_->getNumStructural(); for (int i = 0 ; i < numStructural ; i++) { if (basis_->getStructStatus(i)== CoinWarmStartBasis::basic) { nBasics++; //Basically do nothing } else { nonBasics_[nNonBasics++] = i; } } int numArtificial = basis_->getNumArtificial(); for (int i = 0 ; i < numArtificial ; i++) { if (basis_->getArtifStatus(i)== CoinWarmStartBasis::basic) { //Just check number of basics nBasics++; } else { nonBasics_[nNonBasics++] = i + basis_->getNumStructural(); } } } void CglLandP::CachedData::clean(){ if (basics_!=NULL) delete [] basics_; basics_ = NULL; if (nonBasics_!=NULL) delete [] nonBasics_; nonBasics_ = NULL; if (colsol_ != NULL) delete [] colsol_; colsol_ = NULL; delete basis_; basis_ = NULL; if (integers_) delete [] integers_; integers_ = NULL; nBasics_ = 0; nNonBasics_ = 0; delete solver_; solver_ = NULL; } CglLandP::CachedData::~CachedData() { if (basics_!=NULL) delete [] basics_; if (nonBasics_!=NULL) delete [] nonBasics_; if (colsol_ != NULL) delete [] colsol_; delete basis_; if (integers_) delete [] integers_; delete solver_; } CglLandP::CglLandP(const CglLandP::Parameters ¶ms, const LAP::Validator &validator): params_(params), cached_(), validator_(validator), numcols_(-1), originalColLower_(NULL), originalColUpper_(NULL), canLift_(false), extraCuts_() { handler_ = new CoinMessageHandler(); handler_->setLogLevel(0); messages_ = LapMessages(); } CglLandP::~CglLandP() { delete handler_; if (originalColLower_ != NULL) delete [] originalColLower_; if (originalColUpper_ != NULL) delete [] originalColUpper_; } CglLandP::CglLandP(const CglLandP & source): CglCutGenerator(source), params_(source.params_), cached_(source.cached_), validator_(source.validator_), numcols_(source.numcols_), originalColLower_(NULL), originalColUpper_(NULL), canLift_(source.canLift_), extraCuts_(source.extraCuts_) { handler_ = new CoinMessageHandler(); handler_->setLogLevel(source.handler_->logLevel()); messages_ = LapMessages(); if (numcols_ != -1) { assert(numcols_ > 0); assert(originalColLower_!=NULL); assert(originalColUpper_!=NULL); originalColLower_ = new double[numcols_]; originalColUpper_ = new double[numcols_]; CoinCopyN(source.originalColLower_,numcols_,originalColLower_); CoinCopyN(source.originalColUpper_,numcols_,originalColUpper_); } } /** Assignment operator */ CglLandP& CglLandP::operator=(const CglLandP &rhs) { if (this != &rhs) { params_ = rhs.params_; cached_ = rhs.cached_; validator_ = rhs.validator_; extraCuts_ = rhs.extraCuts_; } return *this; } CglCutGenerator * CglLandP::clone() const { return new CglLandP(*this); } extern double restaurationTime; struct cutsCos { int i; int j; double angle; cutsCos(int i_, int j_ , double angle_):i(i_), j(j_), angle(angle_) { } bool operator<(const cutsCos&other)const { return angle > other.angle; } }; void CglLandP::scanExtraCuts(OsiCuts& cs, const double * colsol) const { int numAdded = 0; for (int i = extraCuts_.sizeRowCuts() - 1; i > -1 ; i--) { double violation = extraCuts_.rowCut(i).violated(colsol); if (violation > 0.) { cs.insert(extraCuts_.rowCut(i)); numAdded++; // std::cout<<"A cut computed in a previous iteration is violated by "<message(CUT_GAP, messages_)<addCol(CoinPackedVector(), 0, 1, 0); t_si->setInteger(new_idx); t_si->addRow(v,0, 0); t_si->resolve(); } #else const OsiSolverInterface * t_si = &si; #endif cached_.getData(*t_si); CglLandPSimplex landpSi(*t_si, cached_, params, validator_); if (params.generateExtraCuts == CglLandP::AllViolatedMigs) { landpSi.genThisBasisMigs(cached_, params); } landpSi.setLogLevel(handler_->logLevel()); int nCut = 0; std::vector indices; getSortedFractionalIndices(indices,cached_, params); #ifndef NDEBUG int numrows = si.getNumRows(); #endif #ifdef DO_STAT //Get informations on current optimum { OsiSolverInterface * gapTester = si.clone(); gapTester->resolve(); roundsStats_.analyseOptimalBasis(gapTester,info.pass, numrows_); delete gapTester; } #endif params_.timeLimit += CoinCpuTime(); CoinRelFltEq eq(1e-04); for (unsigned int i = 0; i < indices.size() && nCut < params.maxCutPerRound && nCut < cached_.nBasics_ ; i++) { //Check for time limit int iRow = indices[i]; assert(iRow < numrows); OsiRowCut cut; int code=1; OsiSolverInterface * ncSi = NULL; if (params.pivotLimit != 0) { ncSi = t_si->clone(); landpSi.setSi(ncSi); ncSi->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); ncSi->messageHandler()->setLogLevel(0); } int generated = 0; if (params.pivotLimit == 0) { generated = landpSi.generateMig(iRow, cut, params); } else { generated = landpSi.optimize(iRow, cut, cached_, params); if (params.generateExtraCuts == CglLandP::AllViolatedMigs) { landpSi.genThisBasisMigs(cached_, params); } landpSi.resetSolver(cached_.basis_); } code = 0; if (generated) code = validator_(cut, cached_.colsol_, si, params, originalColLower_, originalColUpper_); if (!generated || code) { if (params.pivotLimit !=0) { handler_->message(LAP_CUT_FAILED_DO_MIG, messages_)<clone(); landpSi.setSi(ncSi); params.pivotLimit = 0; if (landpSi.optimize(iRow, cut, cached_, params)) { code = validator_(cut, cached_.colsol_, si, params, originalColLower_, originalColUpper_); } params.pivotLimit = params_.pivotLimit; } } if (params.pivotLimit != 0) { landpSi.freeSi(); } if (code) { handler_->message(CUT_REJECTED, messages_)<< validator_.failureString(code)<message(LAP_CUT_FAILED_DO_MIG, messages_) < class StableCompare { public: inline bool operator()(const CoinTriple& t1, const CoinTriple& t2) const { return (t1.third < t2.third) || ((t1.third == t2.third) && (t1.second < t2.second)); } }; template struct StableExternalComp { const std::vector &vec_1_; const std::vector &vec_2_; StableExternalComp(const std::vector &vec_1, const std::vector &vec_2): vec_1_(vec_1), vec_2_(vec_2) { } CoinRelFltEq eq; bool operator()(int i, int j) { bool result = (vec_1_[i] < vec_1_[j]) || ( ((vec_1_[i]== vec_1_[j])) && (vec_2_[i] < vec_2_[j])); return result; } }; void CglLandP::getSortedFractionalIndices(std::vector &frac_indices, const CachedData &data, const CglLandP::Parameters & params) const { std::vector colIndices; std::vector values; std::vector indices; for (int i = 0 ; i < data.nBasics_ ; i++) { const int& iCol = data.basics_[i]; if (iCol >= data.nNonBasics_ || !data.integers_[iCol] || INT_INFEAS(data.colsol_[iCol]) <= params.away) continue; const double value = INT_INFEAS(data.colsol_[iCol]); frac_indices.push_back(i); indices.push_back(static_cast(values.size())); values.push_back(- value); colIndices.push_back(iCol); } std::sort(indices.begin(), indices.end(),StableExternalComp(values,colIndices)); colIndices = frac_indices; for (unsigned int i = 0; i < indices.size() ; i++) { frac_indices[i] = colIndices[indices[i]]; } } CoinMP-1.8.3/Cgl/src/CglLandP/CglLandP.hpp0000644000175000017500000002274012130104031016357 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 07/21/05 // // $Id: CglLandP.hpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #ifndef CglLandP_H #define CglLandP_H #include "CglLandPValidator.hpp" #include "CglCutGenerator.hpp" #include "CglParam.hpp" #include class CoinWarmStartBasis; /** Performs one round of Lift & Project using CglLandPSimplex to build cuts */ namespace LAP { enum LapMessagesTypes { BEGIN_ROUND, END_ROUND, DURING_SEP, CUT_REJECTED, CUT_FAILED, CUT_GAP, LAP_CUT_FAILED_DO_MIG, LAP_MESSAGES_DUMMY_END }; /** Output messages for Cgl */ class LapMessages : public CoinMessages { public: /** Constructor */ LapMessages( ); /** destructor.*/ virtual ~LapMessages() {} }; class CglLandPSimplex; } class CglLandP : public CglCutGenerator { friend void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir); friend class LAP::CglLandPSimplex; friend class CftCglp; public: enum SelectionRules { mostNegativeRc /** select most negative reduced cost */, bestPivot /** select best possible pivot.*/, initialReducedCosts/** Select only those rows which had initialy a 0 reduced cost.*/ }; enum ExtraCutsMode { none/** Generate no extra cuts.*/, AtOptimalBasis /** Generate cuts from the optimal basis.*/, WhenEnteringBasis /** Generate cuts as soon as a structural enters the basis.*/, AllViolatedMigs/** Generate all violated Mixed integer Gomory cuts in the course of the optimization.*/ }; /** Space where cuts are optimized.*/ enum SeparationSpaces { Fractional=0 /** True fractional space.*/, Fractional_rc/** Use fractional space only for computing reduced costs.*/, Full /** Work in full space.*/ }; /** Normalization */ enum Normalization { Unweighted = 0, WeightRHS, WeightLHS, WeightBoth }; enum LHSnorm { L1 = 0, L2, SupportSize, Infinity, Average, Uniform }; /** RHS weight in normalization.*/ enum RhsWeightType { Fixed = 0 /** 2*initial number of constraints. */, Dynamic /** 2 * current number of constraints. */ }; /** Class storing parameters. \remark I take all parameters from Ionut's code */ class Parameters : public CglParam { public: /** Default constructor (with default values)*/ Parameters(); /** Copy constructor */ Parameters(const Parameters &other); /** Assignment opertator */ Parameters & operator=(const Parameters &other); /// @name integer parameters ///@{ /** Max number of pivots before we generate the cut \default 20 */ int pivotLimit; /** Max number of pivots at regular nodes. Put a value if you want it lower than the global pivot limit. \default 100.*/ int pivotLimitInTree; /** Maximum number of cuts generated at a given round*/ int maxCutPerRound; /** Maximum number of failed pivots before aborting */ int failedPivotLimit; /** maximum number of consecutive degenerate pivots \default 0 */ int degeneratePivotLimit; /** Maximum number of extra rows to generate per round.*/ int extraCutsLimit; ///@} /// @name double parameters ///@{ /** Tolerance for small pivots values (should be the same as the solver */ double pivotTol; /** A variable have to be at least away from integrity to be generated */ double away; /** Total time limit for cut generation.*/ double timeLimit; /** Time limit for generating a single cut.*/ double singleCutTimeLimit; /** Weight to put in RHS of normalization if static.*/ double rhsWeight; ///@} /// @name Flags ///@{ /** Do we use tableau row or the disjunction (I don't really get that there should be a way to always use the tableau)*/ bool useTableauRow; /** Do we apply Egon Balas's Heuristic for modularized cuts */ bool modularize; /** Do we strengthen the final cut (always do if modularize is 1) */ bool strengthen; /** Wether to limit or not the number of mistaken RC (when perturbation is applied).*/ bool countMistakenRc; /** Work in the reduced space (only non-structurals enter the basis) */ SeparationSpaces sepSpace; /** Apply perturbation procedure. */ bool perturb; /** How to weight normalization.*/ Normalization normalization; /** How to weight RHS of normalization.*/ RhsWeightType rhsWeightType; /** How to weight LHS of normalization.*/ LHSnorm lhs_norm; /** Generate extra constraints from optimal lift-and-project basis.*/ ExtraCutsMode generateExtraCuts; /** Which rule to apply for choosing entering and leaving variables.*/ SelectionRules pivotSelection; ///@} }; /** Constructor for the class*/ CglLandP(const CglLandP::Parameters ¶ms = CglLandP::Parameters(), const LAP::Validator &validator = LAP::Validator()); /** Destructor */ ~CglLandP(); /** Copy constructor */ CglLandP(const CglLandP &source); /** Assignment operator */ CglLandP& operator=(const CglLandP &rhs); /** Clone function */ CglCutGenerator * clone() const; /**@name Generate Cuts */ //@{ virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} virtual bool needsOptimalBasis() const { return true; } LAP::Validator & validator() { return validator_; } /** set level of log for cut generation procedure :
    1. for none
    2. for log at begin and end of procedure + at some time interval
    3. for log at every cut generated
    */ void setLogLevel(int level) { handler_->setLogLevel(level); } class NoBasisError : public CoinError { public: NoBasisError(): CoinError("No basis available","LandP","") {} }; class SimplexInterfaceError : public CoinError { public: SimplexInterfaceError(): CoinError("Invalid conversion to simplex interface", "CglLandP","CglLandP") {} }; Parameters & parameter() { return params_; } private: void scanExtraCuts(OsiCuts& cs, const double * colsol) const; Parameters params_; /** Some informations that will be changed by the pivots and that we want to keep*/ struct CachedData { CachedData(int nBasics = 0 , int nNonBasics = 0); CachedData(const CachedData & source); CachedData& operator=(const CachedData &source); /** Get the data from a problem */ void getData(const OsiSolverInterface &si); void clean(); ~CachedData(); /** Indices of basic variables in starting basis (ordered if variable basics_[i] s basic in row i)*/ int * basics_; /** Indices of non-basic variables */ int *nonBasics_; /** number of basics variables */ int nBasics_; /** number of non-basics */ int nNonBasics_; /** Optimal basis */ CoinWarmStartBasis * basis_; /** Stores the value of the solution to cut */ double * colsol_; /** Stores the values of the slacks */ double * slacks_; /** Stores wheter slacks are integer constrained */ bool * integers_; /** Solver before pivots */ OsiSolverInterface * solver_; }; /** Retrieve sorted integer variables which are fractional in the solution. Return the number of variables.*/ int getSortedFractionals(CoinPackedVector &xFrac, const CachedData & data, const CglLandP::Parameters& params) const; /** Retrieve sorted integer variables which are fractional in the solution. Return the number of variables.*/ void getSortedFractionalIndices(std::vector& indices, const CachedData &data, const CglLandP::Parameters & params) const; /** Cached informations about problem.*/ CachedData cached_; /** message handler */ CoinMessageHandler * handler_; /** messages */ CoinMessages messages_; /** cut validator */ LAP::Validator validator_; /** number of rows in the original problems. */ int numrows_; /** number of columns in the original problems. */ int numcols_; /** Original lower bounds for the problem (for lifting cuts).*/ double * originalColLower_; /** Original upper bounds for the problem (for lifting cuts).*/ double * originalColUpper_; /** Flag to say if cuts can be lifted.*/ bool canLift_; /** Store some extra cut which could be cheaply generated but do not cut current incumbent.*/ OsiCuts extraCuts_; }; void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir); #endif CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPValidator.cpp0000644000175000017500000002150612563406720020243 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 11/22/05 // // $Id: CglLandPValidator.cpp 1302 2015-08-14 15:48:32Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #include "CglLandPValidator.hpp" #include "CoinPackedMatrix.hpp" #include "OsiRowCut.hpp" #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif namespace LAP { const char* Validator::rejections_[DummyEnd] = { "Cut was accepted.", "Violation of the cut is too small.", "There is a small coefficient we can not get rid off.", "Dynamic of coefficient is too important.", "Cut is too dense.", "Cleaned cut is empty." }; /** Clean an OsiCut \return 1 if min violation is too small \return 2 if small coefficient can not be removed \return 3 if dynamic is too big \return 4 if too many non zero element*/ int Validator::cleanCut(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam& par, const double * origColLower, const double * origColUpper) { /** Compute fill-in in si */ int numcols = si.getNumCols(); const double * colLower = (origColLower) ? origColLower : si.getColLower(); const double * colUpper = (origColUpper) ? origColUpper : si.getColUpper(); int maxNnz = static_cast (maxFillIn_ * static_cast (numcols)); double rhs = aCut.lb(); assert (aCut.ub()> 1e50); CoinPackedVector *vec = const_cast(&aCut.row()); int * indices = vec->getIndices(); double * elems = vec->getElements(); int n = vec->getNumElements(); /** First compute violation if it is too small exit */ double violation = aCut.violated(solCut); if (violation < minViolation_) return 1; /** Now relax get dynamic and remove tiny elements */ int offset = 0; rhs -= 1e-8; double smallest = 1e100; double biggest = 0; for (int i = 0 ; i < n ; i++) { double val = fabs(elems[i]); if (val <= par.getEPS()) //try to remove coef { if (val>0 && val<1e-20) { offset++; continue; throw; } if (val==0) { offset++; continue; } int & iCol = indices[i]; if (elems[i]>0. && colUpper[iCol] < 10000.) { offset++; rhs -= elems[i] * colUpper[iCol]; elems[i]=0; } else if (elems[i]<0. && colLower[iCol] > -10000.) { offset++; rhs -= elems[i] * colLower[iCol]; elems[i]=0.; } else { #ifdef DEBUG std::cout<<"Small coefficient : "< maxRatio_ * smallest) { #ifdef DEBUG std::cout<<"Whaooo "< maxNnz) { numRejected_[DenseCut] ++; return DenseCut; } if (offset == n) { numRejected_[EmptyCut]++; return EmptyCut; } if (offset) vec->truncate(n - offset); indices = vec->getIndices(); elems = vec->getElements(); n = vec->getNumElements(); aCut.setLb(rhs); violation = aCut.violated(solCut); if (violation < minViolation_) { numRejected_[SmallViolation]++; return SmallViolation; } return NoneAccepted; } /**Clean cut 2, different algorithm. First check the dynamic of the cut if < maxRatio scale to a biggest coef of 1 otherwise scale it so that biggest coeff is 1 and try removing tinys ( < 1/maxRatio) either succeed or fail */ int Validator::cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam &/* par */, const double * origColLower, const double * origColUpper) { /** Compute fill-in in si */ int numcols = si.getNumCols(); // int numrows = si.getNumRows(); const double * colLower = (origColLower) ? origColLower : si.getColLower(); const double * colUpper = (origColUpper) ? origColUpper : si.getColUpper(); int maxNnz = static_cast ( maxFillIn_ * static_cast (numcols)); double rhs = aCut.lb(); assert (aCut.ub()> 1e50); CoinPackedVector *vec = const_cast(&aCut.row()); // vec->sortIncrIndex(); int * indices = vec->getIndices(); double * elems = vec->getElements(); int n = vec->getNumElements(); if (n==0) { numRejected_[EmptyCut]++; return EmptyCut; } /** First compute violation if it is too small exit */ double violation = aCut.violated(solCut); if (violation < minViolation_) return 1; /** Now relax get dynamic and remove tiny elements */ int offset = 0; rhs -= 1e-10; double smallest = fabs(rhs); double biggest = smallest; double veryTiny = 1e-20; for (int i = 0 ; i < n ; i++) { double val = fabs(elems[i]); if (val > veryTiny) //tiny should be very very small { smallest = std::min(val,smallest); biggest = std::max (val,biggest); } } if (biggest > 1e9) { #ifdef DEBUG std::cout<<"Whaooo "< maxRatio_ * smallest) //we have to remove some small coefficients { double myTiny = biggest * toBeBiggest / maxRatio_; veryTiny *= toBeBiggest ; for (int i = 0 ; i < n ; i++) { double val = fabs(elems[i]); if (val < myTiny) { if (val< veryTiny) { offset++; continue; } int & iCol = indices[i]; if (elems[i]>0. && colUpper[iCol] < 1000.) { offset++; rhs -= elems[i] * colUpper[iCol]; elems[i]=0; } else if (elems[i]<0. && colLower[iCol] > -1000.) { offset++; rhs -= elems[i] * colLower[iCol]; elems[i]=0.; } else { numRejected_[SmallCoefficient]++; return SmallCoefficient; } } else //Not a small coefficient keep it { if (offset) //if offset is zero current values are ok { int i2 = i - offset; indices[i2] = indices[i]; elems[i2] = elems[i]; } } } } if ((n - offset) > maxNnz) { numRejected_[DenseCut] ++; return DenseCut; } if (offset) vec->truncate(n - offset); if (vec->getNumElements() == 0 ) { numRejected_[EmptyCut]++; return EmptyCut; } /** recheck violation */ aCut.setLb(rhs); violation = aCut.violated(solCut); if (violation < minViolation_) { numRejected_[SmallViolation]++; return SmallViolation; } assert(fabs(rhs)<1e09); return NoneAccepted; } /** Constructor with default values */ Validator::Validator(double maxFillIn, double maxRatio, double minViolation, bool scale, double rhsScale): maxFillIn_(maxFillIn), maxRatio_(maxRatio), minViolation_(minViolation), scale_(scale), rhsScale_(rhsScale), numRejected_(DummyEnd,0) { } } /* Ends namespace LAP.*/ CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPMessages.hpp0000644000175000017500000000253712130104031020051 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // LIF // CNRS, Aix-Marseille Universites // Date: 02/23/08 // // $Id: CglLandPMessages.hpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #ifndef CglLandPMessages_H #define CglLandPMessages_H #include "CoinMessage.hpp" #include "CoinMessageHandler.hpp" namespace LAP { /** Forward declaration of class to store extra debug data.*/ class DebugData; /** Types of messages for lift-and-project simplex.*/ enum LAP_messages { Separating, FoundImprovingRow, FoundBestImprovingCol, WarnFailedBestImprovingCol, LogHead, PivotLog, FinishedOptimal, HitLimit, NumberNegRc, NumberZeroRc, NumberPosRc, WeightsStats, WarnBadSigmaComputation, WarnBadRowComputation, WarnGiveUpRow, PivotFailedSigmaUnchanged, PivotFailedSigmaIncreased, FailedSigmaIncreased, WarnBadRhsComputation, WarnFailedPivotTol, WarnFailedPivotIIf, RoundStats, CutStat, DUMMY_END }; /** Message handler for lift-and-project simplex. */ class LandPMessages : public CoinMessages { public: /** Constructor */ LandPMessages(); }; } #endif CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPSimplex.hpp0000644000175000017500000003733612130104031017730 0ustar renerene// Copyright (C) 2005-2009 Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // Date: 21/07/05 // // $Id: CglLandPSimplex.hpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #ifndef CglLandPSimplex_H #define CglLandPSimplex_H #include #include #include "CglConfig.h" #include "CglLandP.hpp" #include "OsiSolverInterface.hpp" #include "CoinMessage.hpp" #include "CoinMessageHandler.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinPackedMatrix.hpp" #ifdef COIN_HAS_OSICLP #include "OsiClpSolverInterface.hpp" #endif #include "CglLandPTabRow.hpp" #include "CglLandPUtils.hpp" #include "CglLandPMessages.hpp" //#define APPEND_ROW #define OLD_COMPUTATION namespace LAP { /** Forward declaration of class to store extra debug data.*/ class DebugData; class CglLandPSimplex { public: /** Usefull onstructor */ CglLandPSimplex(const OsiSolverInterface &si, const CglLandP::CachedData &cached, const CglLandP::Parameters ¶ms, Validator &validator); /** Destructor */ ~CglLandPSimplex(); /**Update cached information in case of basis change in a round*/ void cacheUpdate(const CglLandP::CachedData &cached, bool reducedSpace = 0); /** reset the solver to optimal basis */ bool resetSolver(const CoinWarmStartBasis * basis); /** Perfom pivots to find the best cuts */ bool optimize(int var, OsiRowCut & cut, const CglLandP::CachedData &cached, const CglLandP::Parameters & params); /** Find Gomory cut (i.e. don't do extra setup required for pivots).*/ bool generateMig(int row, OsiRowCut &cut, const CglLandP::Parameters & params); /** Find extra constraints in current tableau.*/ int generateExtraCuts(const CglLandP::CachedData &cached, const CglLandP::Parameters & params); /** Generate a constrainte for a row of the tableau different from the source row.*/ int generateExtraCut(int i, const CglLandP::CachedData & cached, const CglLandP::Parameters& params); void genThisBasisMigs(const CglLandP::CachedData &cached, const CglLandP::Parameters & params) ; /** insert all extra cuts in cs.*/ int insertAllExtr(OsiCuts & cs, CoinRelFltEq eq); void setLogLevel(int level) { handler_->setLogLevel(level); } void setSi(OsiSolverInterface *si) { si_ = si; #ifdef COIN_HAS_OSICLP OsiClpSolverInterface * clpSi = dynamic_cast(si_); if (clpSi) { clp_ = clpSi; } #endif } void freeSi() { assert(si_ != NULL); delete si_; si_ = NULL; #ifdef COIN_HAS_OSICLP clp_ = NULL; #endif } Cuts& extraCuts() { return cuts_; } void loadBasis(const OsiSolverInterface &si, std::vector &M1, std::vector &M2, int k); int getNumCols() const { return ncols_; } int getNumRows() const { return nrows_; } const CoinWarmStartBasis * getBasis() const { return basis_; } const int * getNonBasics() const { return nonBasics_; } const int * getBasics() const { return basics_; } void outPivInfo(int ncuts) { handler_->message(RoundStats, messages_)<= ncols_ && lo_bounds_[original_index_[index]] < -1e-10 && up_bounds_[original_index_[index]] <= 1e-09); } /** Access to value in solution to cut (indexed in reduced problem) */ inline void setColsolToCut(int index, double value) { colsolToCut_[original_index_[index]] = value; } /** Get the basic status of a variable (structural or slack).*/ inline CoinWarmStartBasis::Status getStatus(int index) const { if (index < ncols_) return basis_->getStructStatus(index); return basis_->getArtifStatus(index - ncols_); } /** Say if variable index by i in current tableau is integer.*/ inline bool isInteger(int index) const { return integers_[original_index_[index]]; } /** Compute normalization weights.*/ void computeWeights(CglLandP::LHSnorm norm, CglLandP::Normalization type, CglLandP::RhsWeightType rhs); /** Evenutaly multiply a by w if normed_weights_ is not empty.*/ double normedCoef(double a, int ii) const { if (norm_weights_.empty()) { return a; } else { return a*norm_weights_[ii]; } } /** print the tableau of current basis. */ void printTableau(std::ostream & os); /** Print everything .*/ void printEverything(); /** print the tableau of current basis. */ void printTableauLateX(std::ostream & os); void printRowLateX(std::ostream & os, int i); void printCutLateX(std::ostream & os, int i); /** Print CGLP basis corresponding to current tableau and source row.*/ void printCglpBasis(std::ostream& os = std::cout); /** Put variables in M1 M2 and M3 according to their sign.*/ void get_M1_M2_M3(const TabRow & row, std::vector &M1, std::vector &M2, std::vector &M3); /** Put a vector in structural sapce.*/ void eliminate_slacks(double * vec) const; private: /// No default constructor CglLandPSimplex(); /// No copy constructor CglLandPSimplex(const CglLandPSimplex&); /// No assignment operator CglLandPSimplex& operator=(const CglLandPSimplex&); #ifdef COIN_HAS_OSICLP /** Pointer to OsiClpSolverInterface if used.*/ OsiClpSolverInterface * clp_; #endif /** Update values in M1 M2 and M3 before an iteration.*/ void updateM1_M2_M3(TabRow & row, double tolerance, bool alwaysComputeCheap); /** Remove rows from current tableau.*/ void removeRows(int nDelete, const int * rowsIdx); void compute_p_q_r_s(double gamma, int gammaSign, double &p, double & q, double & r , double &s); /// @name Work infos /// @{ /** Source row for cut */ TabRow row_k_; /** Original version of source row (without modularization).*/ TabRow original_row_k_; /** Row of leaving candidate*/ TabRow row_i_; #ifndef NDBEUG TabRow new_row_; #endif /**vector to sort the gammas*/ CoinPackedVector gammas_; /**first work vector in row space.*/ std::vector rWk1_; /**scond work vector in row space.*/ std::vector rWk2_; /**third work vector in row space.*/ std::vector rWk3_; /**fourth work vector in row space.*/ std::vector rWk4_; /** integer valued work vector on the rows */ std::vector rIntWork_; /** Flag rows which we don't want to try anymore */ bool * rowFlags_; /** Flag columns which are in the subspace (usualy remove nonbasic structurals in subspace) */ std::vector col_in_subspace; /** Flag columns which have to be considered for leaving the basis */ bool *colCandidateToLeave_; /** Store the basics variable */ int * basics_; /** Stores the nonBasicVariables */ int * nonBasics_; /** Stores the variables which are always in M1 for a given k*/ std::vector M1_; /** Stores the variables which are always in M2 for a given k*/ std::vector M2_; /** Stores the variables which could be either in M1 or M2 */ std::vector M3_; /** stores the cglp value of the normalized cut obtained from row k_ */ double sigma_; /** Keep track of basis status */ CoinWarmStartBasis * basis_; /** Pointer to the solution to cut (need to be modified after each pivot because we are only considering slacks).*/ double * colsolToCut_; /** Pointer to the current basic solution.*/ double * colsol_; /// cached numcols in original problem int ncols_orig_; ///cached numrows in original problem int nrows_orig_; /// cached number of columns in reduced size problem int ncols_; /// Cached number of rows in reduced size problem int nrows_; // for fast access to lower bounds (both cols and rows) std::vector lo_bounds_; // for fast access to upper bounds (both cols and rows) std::vector up_bounds_; /// Say if we are in a sequence of degenerate pivots bool inDegenerateSequence_; /// Value for the reduced cost chosen for pivoting double chosenReducedCostVal_; /// pointer to array of integer info for both structural and slacks const bool * integers_; /// Original index of variable before deletions. std::vector original_index_; /// Stores extra cuts which are generated along the procedure Cuts cuts_; /// @} /// @name Interfaces to the solver /// @{ /** Pointer to the solver interface */ OsiSolverInterface * si_; ///@} /// Own the data or not? bool own_; /// A pointer to a cut validator Validator & validator_; /// Weights for the normalization constraint std::vector norm_weights_; /// Weight for rhs of normalization constraint.*/ double rhs_weight_; /// number of rows with a <0 rc in current iteration int nNegativeRcRows_; /** Check that the basis is correct.*/ bool checkBasis(); /** Record the number of pivots.*/ int numPivots_; /** Record the number of times the source row entered the basis.*/ int numSourceRowEntered_; /** Record the number of times that sigma increased.*/ int numIncreased_; /** Message handler. */ CoinMessageHandler * handler_; /** Messages. */ CoinMessages messages_; #ifndef NDEBUG double bestSigma_; #endif protected: /** \name Slow versions of the function (old versions do not work).*/ /** @{ */ /** Compute the reduced cost of Cglp */ double computeCglpRedCost(int direction, int gammaSign, double tau); /** Compute the value of sigma and thau (which are constants for a row i as defined in Mike Perregaard thesis */ double computeRedCostConstantsInRow(); /** Compute the objective value of the Cglp with linear combintation of the two rows by gamma */ double computeCglpObjective(double gamma, bool strengthen, TabRow &row); /** Compute the objective value of the Cglp with linear combintation of the row_k_ and gamma row_i_ */ double computeCglpObjective(double gamma, bool strengthen); /** Find a row which can be used to perform an improving pivot return index of the cut or -1 if none exists * (i.e., find the leaving variable).*/ int findCutImprovingPivotRow( int &direction, int &gammaSign, double tolerance); /** Find the column which leads to the best cut (i.e., find incoming variable).*/ int findBestPivotColumn(int direction, double pivotTol, bool reducedSpace, bool allowDegeneratePivot, bool modularize); #if 1 int plotCGLPobj(int direction, double gammaTolerance, double pivotTol, bool reducedSpace, bool allowDegenerate, bool modularize); #endif /** @} */ }; /** return the coefficients of the strengthened intersection cut */ double CglLandPSimplex::strengthenedIntersectionCutCoef(int i, double alpha_i, double beta) const { // double ratio = beta/(1-beta); if ( (!integers_[i])) return intersectionCutCoef(alpha_i, beta); else { double f_i = alpha_i - floor(alpha_i); if (f_i < beta) return f_i*(1- beta); else return (1 - f_i)*beta;//(1-beta); } } /** return the coefficient of the new row (combining row_k + gamma row_i). */ double CglLandPSimplex::newRowCoefficient(int j, double gamma) const { return row_k_[j] + gamma * row_i_[j]; } } #endif CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPTest.cpp0000644000175000017500000003036112130104031017210 0ustar renerene// $Id: CglLandPTest.cpp 1122 2013-04-06 20:39:53Z stefan $ // Copyright (C) 2000-2009, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // UnitTest for CglGomory adapted for lift-and-project #include #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CoinPackedMatrix.hpp" #include "OsiCuts.hpp" #include "CoinWarmStartBasis.hpp" #include "CglLandP.hpp" void CglLandPUnitTest( OsiSolverInterface * si, const std::string &mpsDir) { CoinRelFltEq eq(1e-05); // Test default constructor { CglLandP aGenerator; assert(aGenerator.parameter().pivotLimit==20); assert(aGenerator.parameter().maxCutPerRound==5000); assert(aGenerator.parameter().failedPivotLimit==1); assert(aGenerator.parameter().degeneratePivotLimit==0); assert(eq(aGenerator.parameter().pivotTol, 1e-04)); assert(eq(aGenerator.parameter().away, 5e-04)); assert(eq(aGenerator.parameter().timeLimit, COIN_DBL_MAX)); assert(eq(aGenerator.parameter().singleCutTimeLimit, COIN_DBL_MAX)); assert(aGenerator.parameter().useTableauRow==true); assert(aGenerator.parameter().modularize==false); assert(aGenerator.parameter().strengthen==true); assert(aGenerator.parameter().perturb==true); assert(aGenerator.parameter().pivotSelection==CglLandP::mostNegativeRc); } // Test copy constructor { CglLandP a; { CglLandP b; b.parameter().pivotLimit = 100; b.parameter().maxCutPerRound = 100; b.parameter().failedPivotLimit = 10; b.parameter().degeneratePivotLimit = 10; b.parameter().pivotTol = 1e-07; b.parameter().away = 1e-10; b.parameter().timeLimit = 120; b.parameter().singleCutTimeLimit = 15; b.parameter().useTableauRow = true; b.parameter().modularize = true; b.parameter().strengthen = false; b.parameter().perturb = false; b.parameter().pivotSelection=CglLandP::bestPivot; //Test Copy CglLandP c(b); assert(c.parameter().pivotLimit == 100); assert(c.parameter().maxCutPerRound == 100); assert(c.parameter().failedPivotLimit == 10); assert(c.parameter().degeneratePivotLimit == 10); assert(c.parameter().pivotTol == 1e-07); assert(c.parameter().away == 1e-10); assert(c.parameter().timeLimit == 120); assert(c.parameter().singleCutTimeLimit == 15); assert(c.parameter().useTableauRow == true); assert(c.parameter().modularize == true); assert(c.parameter().strengthen == false); assert(c.parameter().perturb == false); assert(c.parameter().pivotSelection == CglLandP::bestPivot); a=b; assert(a.parameter().pivotLimit == 100); assert(a.parameter().maxCutPerRound == 100); assert(a.parameter().failedPivotLimit == 10); assert(a.parameter().degeneratePivotLimit == 10); assert(a.parameter().pivotTol == 1e-07); assert(a.parameter().away == 1e-10); assert(a.parameter().timeLimit == 120); assert(a.parameter().singleCutTimeLimit == 15); assert(a.parameter().useTableauRow == true); assert(a.parameter().modularize == true); assert(a.parameter().strengthen == false); assert(a.parameter().perturb == false); assert(a.parameter().pivotSelection == CglLandP::bestPivot); } } { // Maximize 2 x2 // s.t. // 2x1 + 2x2 <= 3 // -2x1 + 2x2 <= 1 // 7x1 + 4x2 <= 8 // -7x1 + 4x2 <= 1 // x1, x2 >= 0 and x1, x2 integer // Slacks are s1, s2, s3, s4 //Test that problem is correct // Optimal Basis is x1, x2, s3, s4 with tableau // x1 0.25 s1 -0.25 s2 = 0.5 // x2 0.25 s1 0.25 s2 = 1 // -2.75 s1 0.75 s2 s3 = 0.5 // 0.75 s1 -2.75 s2 s4 = 0.5 // z= -0.25 s1 -0.25 s2 = -1 // Gomory cut from variable x1 is x2 <= 0.5 // Can be improved by first pivoting s2 in and s4 out, then s1 in and s3 out // to x2 <= 0.25 { int start[2] = {0,4}; int length[2] = {4,4}; int rows[8] = {0,1,2,3,0,1,2,3}; double elements[8] = {2.0,-2.0,7.0,-7.0,2.0,2.0,4.0,4.0}; CoinPackedMatrix columnCopy(true,4,2,8,elements,rows,start,length); double rowLower[4]={-COIN_DBL_MAX,-COIN_DBL_MAX, -COIN_DBL_MAX,-COIN_DBL_MAX}; double rowUpper[4]={3.,1.,8.,1.}; double colLower[2]={0.0,0.0}; double colUpper[2]={1.0,1.0}; double obj[2]={-1,-1}; int intVar[2]={0,1}; OsiSolverInterface * siP = si->clone(); siP->loadProblem(columnCopy, colLower, colUpper, obj, rowLower, rowUpper); siP->setInteger(intVar,2); CglLandP test; test.setLogLevel(2); test.parameter().sepSpace = CglLandP::Full; siP->resolve(); // Test generateCuts method { OsiCuts cuts; test.generateCuts(*siP,cuts); cuts.printCuts(); assert(cuts.sizeRowCuts()==1); OsiRowCut aCut = cuts.rowCut(0); assert(eq(aCut.lb(), -.0714286)); CoinPackedVector row = aCut.row(); if (row.getNumElements() == 1) { assert(row.getIndices()[0]==1); assert(eq(row.getElements()[0], -4*.0714286)); } else if (row.getNumElements() == 2) { assert(row.getIndices()[0]==0); assert(eq(row.getElements()[0], 0.)); assert(row.getIndices()[1]==1); assert(eq(row.getElements()[1], -1)); } OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); } if (0) { OsiCuts cuts; test.generateCuts(*siP,cuts); cuts.printCuts(); assert(cuts.sizeRowCuts()==1); OsiRowCut aCut = cuts.rowCut(0); CoinPackedVector row = aCut.row(); if (row.getNumElements() == 1) { assert(row.getIndices()[0]==1); assert(eq(row.getElements()[0], -1)); } else if (row.getNumElements() == 2) { assert(row.getIndices()[0]==0); assert(eq(row.getElements()[0], 0.)); assert(row.getIndices()[1]==1); assert(eq(row.getElements()[1], -1)); } assert(eq(aCut.lb(), 0.)); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); } delete siP; } } if (1) //Test on p0033 { // Setup OsiSolverInterface * siP = si->clone(); std::string fn(mpsDir+"p0033"); siP->readMps(fn.c_str(),"mps"); siP->activateRowCutDebugger("p0033"); CglLandP test; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, 2520.5717391304347) ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); #endif OsiCuts cuts; // Test generateCuts method test.generateCuts(*siP,cuts); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); //assert( eq(lpRelaxAfter, 2592.1908295194507) ); std::cout<<"Relaxation after "< 2840. ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif assert( lpRelaxBefore < lpRelaxAfter ); delete siP; } if (1) //test again with modularization { // Setup OsiSolverInterface * siP = si->clone(); std::string fn(mpsDir+"p0033"); siP->readMps(fn.c_str(),"mps"); siP->activateRowCutDebugger("p0033"); CglLandP test; test.parameter().modularize = true; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, 2520.5717391304347) ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); #endif OsiCuts cuts; // Test generateCuts method test.generateCuts(*siP,cuts); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); //assert( eq(lpRelaxAfter, 2592.1908295194507) ); std::cout<<"Relaxation after "< 2840. ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif assert( lpRelaxBefore < lpRelaxAfter ); delete siP; } if (1) //test again with alternate pivoting rule { // Setup OsiSolverInterface * siP = si->clone(); std::string fn(mpsDir+"p0033"); siP->readMps(fn.c_str(),"mps"); siP->activateRowCutDebugger("p0033"); CglLandP test; test.parameter().pivotSelection = CglLandP::bestPivot; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, 2520.5717391304347) ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); #endif OsiCuts cuts; // Test generateCuts method test.generateCuts(*siP,cuts); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); //assert( eq(lpRelaxAfter, 2592.1908295194507) ); std::cout<<"Relaxation after "< 2840. ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif assert( lpRelaxBefore < lpRelaxAfter ); delete siP; } if (1) //Finally test code in documentation { // Setup OsiSolverInterface * siP = si->clone(); std::string fn(mpsDir+"p0033"); siP->readMps(fn.c_str(),"mps"); siP->activateRowCutDebugger("p0033"); CglLandP landpGen; landpGen.parameter().timeLimit = 10.; landpGen.parameter().pivotLimit = 2; // Solve the LP relaxation of the model and // print out ofv for sake of comparison siP->initialSolve(); double lpRelaxBefore=siP->getObjValue(); assert( eq(lpRelaxBefore, 2520.5717391304347) ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); #endif OsiCuts cuts; // Test generateCuts method landpGen.generateCuts(*siP, cuts); OsiSolverInterface::ApplyCutsReturnCode rc = siP->applyCuts(cuts); siP->resolve(); double lpRelaxAfter=siP->getObjValue(); //assert( eq(lpRelaxAfter, 2592.1908295194507) ); std::cout<<"Relaxation after "< 2840. ); #ifdef CGL_DEBUG printf("\n\nOrig LP min=%f\n",lpRelaxBefore); printf("\n\nFinal LP min=%f\n",lpRelaxAfter); #endif assert( lpRelaxBefore < lpRelaxAfter ); delete siP; } } CoinMP-1.8.3/Cgl/src/CglLandP/CglLandPTabRow.cpp0000644000175000017500000000377712130104031017502 0ustar renerene// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved. // Author: Pierre Bonami // LIF // CNRS, Aix-Marseille Universites // Date: 02/23/08 // // $Id: CglLandPTabRow.cpp 1122 2013-04-06 20:39:53Z stefan $ // // This code is licensed under the terms of the Eclipse Public License (EPL). //--------------------------------------------------------------------------- #include "CglLandPTabRow.hpp" #include "CglLandPSimplex.hpp" namespace LAP { void TabRow::print(std::ostream & os, int width, const int * nonBasics, int m) { os.width(3); os.precision(4); os.setf(std::ios_base::right, std::ios_base::adjustfield); os<<"idx: "; const double * dense = denseVector(); for (int j = 0 ; j < m ; j++) { os.width(width); os.setf(std::ios_base::right, std::ios_base::adjustfield); os< #include #include "CoinMessageHandler.hpp" #include "OsiSolverInterface.hpp" #include "CglStored.hpp" #include "OsiPresolve.hpp" #include "CglCutGenerator.hpp" //############################################################################# /** Class for preProcessing and postProcessing. While cuts can be added at any time in the tree, some cuts are actually just stronger versions of existing constraints. In this case they can replace those constraints rather than being added as new constraints. This is awkward in the tree but reasonable at the root node. This is a general process class which uses other cut generators to strengthen constraints, establish that constraints are redundant, fix variables and find relationships such as x + y == 1. Presolve will also be done. If row names existed they may be replaced by R0000000 etc */ class CglPreProcess { public: ///@name Main methods //@{ /** preProcess problem - returning new problem. If makeEquality true then <= cliques converted to ==. Presolve will be done numberPasses times. Returns NULL if infeasible This version uses default strategy. For more control copy and edit code from this function i.e. call preProcessNonDefault */ OsiSolverInterface * preProcess(OsiSolverInterface & model, bool makeEquality=false, int numberPasses=5); /** preProcess problem - returning new problem. If makeEquality true then <= cliques converted to ==. Presolve will be done numberPasses times. Returns NULL if infeasible This version assumes user has added cut generators to CglPreProcess object before calling it. As an example use coding in preProcess If makeEquality is 1 add slacks to get cliques, if 2 add slacks to get sos (but only if looks plausible) and keep sos info */ OsiSolverInterface * preProcessNonDefault(OsiSolverInterface & model, int makeEquality=0, int numberPasses=5, int tuning=0); /// Creates solution in original model void postProcess(OsiSolverInterface &model ,bool deleteStuff=true); /** Tightens primal bounds to make dual and branch and cutfaster. Unless fixed or integral, bounds are slightly looser than they could be. Returns non-zero if problem infeasible Fudge for branch and bound - put bounds on columns of factor * largest value (at continuous) - should improve stability in branch and bound on infeasible branches (0.0 is off) */ int tightenPrimalBounds(OsiSolverInterface & model,double factor=0.0); /** Fix some of problem - returning new problem. Uses reduced costs. Optional signed character array 1 always keep, -1 always discard, 0 use djs */ OsiSolverInterface * someFixed(OsiSolverInterface & model, double fractionToKeep=0.25, bool fixContinuousAsWell=false, char * keep=NULL) const; /** Replace cliques by more maximal cliques Returns NULL if rows not reduced by greater than cliquesNeeded*rows */ OsiSolverInterface * cliqueIt(OsiSolverInterface & model, double cliquesNeeded=0.0) const; /// If we have a cutoff - fix variables int reducedCostFix(OsiSolverInterface & model); //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false if the value of the parameter is out of range. The get methods return the value of the parameter. */ //@{ /** Set cutoff bound on the objective function. When using strict comparison, the bound is adjusted by a tolerance to avoid accidentally cutting off the optimal solution. */ void setCutoff(double value) ; /// Get the cutoff bound on the objective function - always as minimize double getCutoff() const; /// The original solver associated with this model. inline OsiSolverInterface * originalModel() const { return originalModel_;} /// Solver after making clique equalities (may == original) inline OsiSolverInterface * startModel() const { return startModel_;} /// Copies of solver at various stages after presolve inline OsiSolverInterface * modelAtPass(int iPass) const { if (iPass>=0&&iPass=0&&iPass=0&&iPass #include #include #include #include #include #include "CoinPragma.hpp" #include "CglPreProcess.hpp" #include "CglMessage.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "OsiRowCutDebugger.hpp" #include "CglStored.hpp" #include "CglCutGenerator.hpp" #include "CoinTime.hpp" #include "CoinSort.hpp" #include "CoinDenseFactorization.hpp" #include "CoinBuild.hpp" #include "CoinHelperFunctions.hpp" #include "CoinWarmStartBasis.hpp" #include "CglProbing.hpp" #include "CglDuplicateRow.hpp" #include "CglClique.hpp" //#define PRINT_DEBUG 1 //#define COIN_DEVELOP 1 #ifdef COIN_DEVELOP static int whichMps=0; char nameMps[50]; #endif OsiSolverInterface * CglPreProcess::preProcess(OsiSolverInterface & model, bool makeEquality, int numberPasses) { // Tell solver we are in Branch and Cut model.setHintParam(OsiDoInBranchAndCut,true,OsiHintDo) ; // Default set of cut generators CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(3); generator1.setMaxProbeRoot(model.getNumCols()); generator1.setMaxElements(100); generator1.setMaxLookRoot(50); generator1.setRowCuts(3); // Add in generators addCutGenerator(&generator1); OsiSolverInterface * newSolver = preProcessNonDefault(model,makeEquality ? 1 : 0,numberPasses); // Tell solver we are not in Branch and Cut model.setHintParam(OsiDoInBranchAndCut,false,OsiHintDo) ; if (newSolver) newSolver->setHintParam(OsiDoInBranchAndCut,false,OsiHintDo) ; return newSolver; } static void outSingletons(int & nCol, int & nRow, int * startCol, int * row, double * element, int * startRow, int *column) { int iRow,iCol; bool singletons=false; int * countRow = new int [nRow]; int * countCol = new int [nCol]; int * temp = new int[nRow]; // make row copy memset(countRow,0,nRow*sizeof(int)); memset(countCol,0,nCol*sizeof(int)); for (iCol=0;iCol1); temp[iRow]=newNrow; newNrow++; } } int newNcol=0; int nEl=0; int iNext=0; for (iCol=0;iCol1); int end = start+countCol[iCol]; countCol[iCol]=newNcol; int j; for ( j=start;j=0); row[nEl]=iRow; if (element) element[nEl]=element[j]; nEl++; } newNcol++; startCol[newNcol]=nEl; } } newNrow=0; nEl=0; iNext=0; for (iRow=0;iRow1) { int end = start+countRow[iRow]; int j; for ( j=start;j=0); column[nEl++]=iCol; } newNrow++; startRow[newNrow]=nEl; } } nRow=newNrow; nCol=newNcol; } delete [] countCol; delete [] countRow; delete [] temp; } static int makeIntegers2(OsiSolverInterface * model,int mode) { // See whether we should make variables integer const double *objective = model->getObjCoefficients() ; const double *lower = model->getColLower() ; const double *upper = model->getColUpper() ; const double *rowLower = model->getRowLower() ; const double *rowUpper = model->getRowUpper() ; int numberRows = model->getNumRows() ; double * rhs = new double [numberRows]; int * count = new int [numberRows]; int iColumn; bool makeAll = (mode>1); int numberColumns = model->getNumCols() ; // Column copy of matrix const double * element = model->getMatrixByCol()->getElements(); const int * row = model->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = model->getMatrixByCol()->getVectorStarts(); const int * columnLength = model->getMatrixByCol()->getVectorLengths(); // Row copy CoinPackedMatrix matrixByRow(*model->getMatrixByRow()); //const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); int numberIntegers=1; int totalNumberIntegers=0; while (numberIntegers) { memset(rhs,0,numberRows*sizeof(double)); memset(count,0,numberRows*sizeof(int)); int currentNumber=0; for (iColumn=0;iColumnisInteger(iColumn)) { currentNumber++; for (CoinBigIndex j=start;j1.0e-10) rhs[iRow] = COIN_DBL_MAX; } } else { for (CoinBigIndex j=start;j1 printf("Current number of integers is %d\n",currentNumber); #endif // now look at continuous bool allGood=true; double direction = model->getObjSense() ; int numberObj=0; int numberEq=0; int numberEqI=0; int numberZero=0; int numberNonZero=0; if (false) { for (iColumn=0;iColumnlower[iColumn]) { if (!model->isInteger(iColumn)) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; int nC=0; for (CoinBigIndex j=start;j1) { nC++; } } if (nC>2) { for (CoinBigIndex j=start;j1) count[iRow]=999999; } } } } } } int * newInts = new int[numberColumns]; // Columns to zap int nColumnZap=0; int * columnZap = new int[numberColumns]; char * noGoodColumn = new char [numberColumns]; memset(noGoodColumn,0,numberColumns); int nNew=0; for (iColumn=0;iColumnlower[iColumn]) { double objValue = objective[iColumn]*direction; bool thisGood=true; if ((objValue||makeAll)&&!model->isInteger(iColumn)) { if (objValue) { numberObj++; } else if (columnLength[iColumn]==1) { continue; // don't bother with singletons } CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; if (objValue>=0.0) { // wants to be as low as possible if (lower[iColumn]<-1.0e10||fabs(lower[iColumn]-floor(lower[iColumn]+0.5))>1.0e-10) { thisGood=false; } else if (upper[iColumn]<1.0e10&&fabs(upper[iColumn]-floor(upper[iColumn]+0.5))>1.0e-10) { thisGood=false; } bool singletonRow=true; bool equality=false; int nC=0; int xxxx=0; #if CBC_USEFUL_PRINTING bool badCount=false; #endif for (CoinBigIndex j=start;j1) { singletonRow=false; //printf("col %d row%d element %g - row count %d\n",iColumn,iRow,element[j],count[iRow]); #if CBC_USEFUL_PRINTING if (count[iRow]==999999) badCount=true; #endif if (element[j]==1.0) { if ((xxxx&1)==0) xxxx |= 1; else xxxx = 15; } else { if ((xxxx&2)==0) xxxx |= 2; else xxxx = 15; } nC++; } else if (rowLower[iRow]==rowUpper[iRow]) { equality=true; } double rhsValue = rhs[iRow]; double lowerValue = rowLower[iRow]; double upperValue = rowUpper[iRow]; if (rhsValue<1.0e20) { if(lowerValue>-1.0e20) lowerValue -= rhsValue; if(upperValue<1.0e20) upperValue -= rhsValue; } if (fabs(rhsValue)>1.0e20||fabs(rhsValue-floor(rhsValue+0.5))>1.0e-10 ||fabs(element[j])!=1.0) { // no good thisGood=false; break; } if (element[j]>0.0) { if (lowerValue>-1.0e20&&fabs(lowerValue-floor(lowerValue+0.5))>1.0e-10) { // no good thisGood=false; break; } } else { if (upperValue<1.0e20&&fabs(upperValue-floor(upperValue+0.5))>1.0e-10) { // no good thisGood=false; break; } } } #if CBC_USEFUL_PRINTING if (!model->isInteger(iColumn)&&false) printf("%d has %d rows with >1 - state network %s interaction %s\n",iColumn,nC,xxxx>3 ? "bad" : "good", badCount ? "too much" : "ok"); #endif // If not good here then mark rows if (!thisGood) { for (CoinBigIndex j=start;jstart+1&&!equality) thisGood=false; // Can we make equality if (end==start+1&&!equality&&false) { numberEq++; int iRow = row[start]; if (element[start]>0.0) model->setRowUpper(iRow,rowLower[iRow]); else model->setRowLower(iRow,rowUpper[iRow]); } } else { // wants to be as high as possible if (upper[iColumn]>1.0e10||fabs(upper[iColumn]-floor(upper[iColumn]+0.5))>1.0e-10) { thisGood=false; } else if (lower[iColumn]>-1.0e10&&fabs(lower[iColumn]-floor(lower[iColumn]+0.5))>1.0e-10) { thisGood=false; } bool singletonRow=true; bool equality=false; for (CoinBigIndex j=start;j1) { singletonRow=false; thisGood=false; } else if (rowLower[iRow]==rowUpper[iRow]) { equality=true; } double rhsValue = rhs[iRow]; double lowerValue = rowLower[iRow]; double upperValue = rowUpper[iRow]; if (rhsValue<1.0e20) { if(lowerValue>-1.0e20) lowerValue -= rhsValue; if(upperValue<1.0e20) upperValue -= rhsValue; } if (fabs(rhsValue)>1.0e20||fabs(rhsValue-floor(rhsValue+0.5))>1.0e-10 ||fabs(element[j])!=1.0) { // no good thisGood=false; break; } if (element[j]<0.0) { if (lowerValue>-1.0e20&&fabs(lowerValue-floor(lowerValue+0.5))>1.0e-10) { // no good thisGood=false; break; } } else { if (upperValue<1.0e20&&fabs(upperValue-floor(upperValue+0.5))>1.0e-10) { // no good thisGood=false; break; } } } if (!singletonRow&&end>start+1&&!equality) thisGood=false; // If not good here then mark rows if (!thisGood) { for (CoinBigIndex j=start;jsetRowUpper(iRow,rowLower[iRow]); else model->setRowLower(iRow,rowUpper[iRow]); } } } else if (objValue) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; if (end==start+1) { int iRow = row[start]; if (rowUpper[iRow]>rowLower[iRow]&&!count[iRow]) { if (fabs(rhs[iRow])>1.0e20||fabs(rhs[iRow]-floor(rhs[iRow]+0.5))>1.0e-10 ||fabs(element[start])!=1.0) { // no good } else if (false) { numberEqI++; if (element[start]*objValue>0.0) model->setRowUpper(iRow,rowLower[iRow]); else model->setRowLower(iRow,rowUpper[iRow]); } } } } if (!thisGood) { if (objValue) allGood=false; // look at again columnZap[nColumnZap++]=iColumn; } else if (makeAll&&!model->isInteger(iColumn)&& upper[iColumn]-lower[iColumn]<10) { newInts[nNew++] = iColumn; } } } // Rows to look at int * rowLook = new int[numberRows]; while (nColumnZap) { int nRowLook=0; for (int i=0;ilower[iColumn]&& !model->isInteger(iColumn)) { if (!noGoodColumn[iColumn]) { noGoodColumn[iColumn]=1; columnZap[nColumnZap++]=iColumn; } } } } } } delete [] rowLook; delete [] noGoodColumn; delete [] columnZap; // Final look for (iColumn=0;iColumnlower[iColumn]&& !model->isInteger(iColumn)&&objective[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j=start;jsetInteger(iColumn); if (objValue) numberNonZero++; else numberZero++; } else if (objValue) { // unable to fix all with obj allGood=false; } } } delete [] newInts; // Can we look at remainder and make any integer if (makeAll&&false) { int nLook=0; int nEl=0; for (iColumn=0;iColumnlower[iColumn]&&!model->isInteger(iColumn)) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; bool possible=true; int n=0; for (CoinBigIndex j=start;j1) { if (count[iRow]==999999) { possible=false; break; } else { n++; } } } if (possible) { nLook++; nEl+=n; } } } if (nLook) { int * startC = new int [nLook+1]; int * back = new int [nLook]; int * row2 = new int[nEl]; double * element2 = new double [nEl]; int * backRow = new int [numberRows]; int jRow; for (jRow=0;jRowlower[iColumn]&&!model->isInteger(iColumn)) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; bool possible=true; int n=0; for (CoinBigIndex j=start;j1) { if (count[iRow]==999999) { possible=false; break; } else { n++; } } } if (!n) possible=false; // may be done later if (possible) { back[nLook]=iColumn; for (CoinBigIndex j=start;j1) { int jRow=backRow[iRow]; if (jRow<0) { // new row backRow[iRow]=nRow; jRow=nRow; nRow++; } element2[nEl]=element[j]; row2[nEl++]=jRow; } } nLook++; startC[nLook]=nEl; } } } // Redo nCol nCol=nLook; delete [] backRow; int * startRow = new int [nRow+1]; int * column2 = new int [nEl]; // take out singletons and do row copy outSingletons(nCol, nRow, startC, row2, element2, startRow, column2); // Decompose int * rowBlock = new int[nRow]; int * stack = new int [nRow]; for (int iRow=0;iRow=0) { if (element2[j]==1.0) { if ((type&1)==0) type |=1; else type=7; } else { assert (element2[j]==-1.0); if ((type&2)==0) type |=2; else type=7; } row2B[nElB++]=iRow; } } if (type!=3) network=false; nColB++; startCB[nColB]=nElB; assert (startCB[nColB]>startCB[nColB-1]+1); } else { whichCol[i]=-1; } } // See if network bool goodInteger=false; if (!network) { // take out singletons outSingletons(nColB, nRowB, startCB, row2B, NULL, startRowC, column2C); // See if totally balanced; int * split = new int [nRowB]; int * best = new int[nRowB]; int * current = new int [nRowB]; int * size = new int [nRowB]; { memset(size,0,nRowB*sizeof(int)); for (i=0;i=0;j--) { if (current[j]>best[j]) { better=true; break; } else if (current[j]=0); // swap for (i=0;i0&&best[i]=0) { whichRow[iRow]=newSet+1+nRowB; } } nSet += nMore; memset(size,0,nSet*sizeof(int)); for (i=0;i=nRowB) { // has 1 - correct it iSet -= nRowB; } else { // 0 part of split set or not split iSet=current[iSet]; } whichRow[i]=iSet; size[iSet]++; } } nLeft--; } if (nSet0;i--) { int j; for (j=startCC[i];jiRow&&!split[jRow]) { // bad goodInteger=false; break; } } } } } if (!goodInteger) break; for (j=startCC[i];jsetInteger(iBack); } } } delete [] startRowC; delete [] column2C; delete [] startCB; delete [] row2B; delete [] startCC; delete [] row2C; delete [] whichRow; delete [] whichCol; } delete [] startRow; delete [] column2; delete [] element2; delete [] startC; delete [] row2; delete [] back; } } numberIntegers=numberNonZero; if (allGood&&numberObj) { #if CBC_USEFUL_PRINTING>1 int numberPossible = 0; #endif for (iColumn=0;iColumnlower[iColumn]&&objective[iColumn]&&!model->isInteger(iColumn)) { #if CBC_USEFUL_PRINTING>1 numberPossible++; #endif if (upper[iColumn]<=lower[iColumn]+10) { model->setInteger(iColumn); numberIntegers++; } } } #if CBC_USEFUL_PRINTING>1 printf("ZZZZYY CglPreProcess analysis says all (%d) continuous with costs could be made integer - %d were\n",numberPossible,numberIntegers-numberNonZero); #endif } #if CBC_USEFUL_PRINTING>1 if (numberZero) printf("ZZZZYY %d continuous with zero cost were made integer\n",numberZero); #endif numberIntegers += numberZero; #if CBC_USEFUL_PRINTING>1 if (numberEq||numberEqI) printf("ZZZZYY %d rows made equality from continuous, %d from integer\n",numberEq,numberEqI); #endif totalNumberIntegers += numberIntegers; if (!makeAll) numberIntegers=0; } delete [] rhs; delete [] count; return (totalNumberIntegers); } //#define CGL_WRITEMPS 1 #ifdef CGL_WRITEMPS #if CGL_WRITEMPS>1 extern double * debugSolution; extern int debugNumberColumns; #endif static int mpsNumber=0; static void writeDebugMps(const OsiSolverInterface * solver, const char * where, OsiPresolve * pinfo) { mpsNumber++; char name[20]; sprintf(name,"presolve%2.2d.mps",mpsNumber); printf("saving %s from %s - %d row, %d columns\n", name,where,solver->getNumRows(),solver->getNumCols()); solver->writeMpsNative(name,NULL,NULL,0,1,0); #if CGL_WRITEMPS>1 if (pinfo&&debugSolution) { int n = solver->getNumCols(); if (noriginalColumns(); if (!original) { printf("No original columns\n"); abort(); } for (int i=0;iclone(); const double * lower = newSolver->getColLower(); const double * upper = newSolver->getColUpper(); for (int i = 0; iisInteger(i)) { double value = floor(debugSolution[i]+0.5); if (valueupper[i]) { printf("Bad value %d - %g %g %g\n",i,lower[i],debugSolution[i], upper[i]); } else { newSolver->setColLower(i,value); newSolver->setColUpper(i,value); } } } printf("Starting solve %d\n",mpsNumber); newSolver->resolve(); printf("Ending solve %d - status %s obj %g\n",mpsNumber, newSolver->isProvenOptimal() ? "ok" : "bad", newSolver->getObjValue()); delete newSolver; } #endif } #else #define writeDebugMps(x,y,z) #endif OsiSolverInterface * CglPreProcess::preProcessNonDefault(OsiSolverInterface & model, int makeEquality, int numberPasses, int tuning) { #ifdef CGL_WRITEMPS bool rcdActive = true ; std::string modelName ; model.getStrParam(OsiProbName,modelName) ; writeDebugMps(&model,"IPP:preProcessNonDefault",0) ; std::cout << " Attempting to activate row cut debugger for " << modelName << " ... " ; if (!appData_) { model.activateRowCutDebugger(modelName.c_str()) ; } else { // see if passed in double * solution = CoinCopyOfArray(reinterpret_cast(appData_), model.getNumCols()); model.activateRowCutDebugger(solution); delete [] solution; } if (model.getRowCutDebugger()) std::cout << "on optimal path." << std::endl ; else if (model.getRowCutDebuggerAlways()) std::cout << "not on optimal path." << std::endl ; else { std::cout << "failure." << std::endl ; rcdActive = false ; } if (rcdActive) { const OsiRowCutDebugger *debugger = model.getRowCutDebuggerAlways() ; std::cout << " Optimal solution is:" << std::endl ; debugger->printOptimalSolution(model) ; } # endif originalModel_ = & model; if (tuning>=1000000) { numberPasses=tuning/1000000; tuning %= 1000000; //minimumLength = tuning; } numberSolvers_ = numberPasses; model_ = new OsiSolverInterface * [numberSolvers_]; modifiedModel_ = new OsiSolverInterface * [numberSolvers_]; presolve_ = new OsiPresolve * [numberSolvers_]; for (int i=0;iclone(); CoinPackedMatrix matrixByRow(*originalModel_->getMatrixByRow()); int numberRows = originalModel_->getNumRows(); if (rowType_) assert (numberRowType_==numberRows); int numberColumns = originalModel_->getNumCols(); //int originalNumberColumns=numberColumns; int minimumLength = 5; int numberModifiedPasses=10; if (numberPasses<=1) numberModifiedPasses=1; // lightweight preprocessing else if (numberPasses<=2) numberModifiedPasses=2; // fairly lightweight preprocessing if (tuning>=10000) { numberModifiedPasses=tuning/10000; tuning %= 10000; //minimumLength = tuning; } if ((tuning&1)!=0) options_ |= 16; // heavy stuff //bool heavyProbing = (tuning&1)!=0; int makeIntegers = (tuning&6)>>1; // See if we want to do initial presolve int doInitialPresolve = 1; if (numberSolvers_<2) doInitialPresolve=0; // We want to add columns int numberSlacks=0; int * rows = new int[numberRows]; double * element =new double[numberRows]; int iRow; int numberCliques=0; int * which = new int[numberColumns]; // Statistics int totalP1=0,totalM1=0; int numberFixed=0; // May just find it is infeasible bool feasible=true; // Row copy const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); const double * lower = originalModel_->getColLower(); const double * upper = originalModel_->getColUpper(); const double * rowLower = originalModel_->getRowLower(); const double * rowUpper = originalModel_->getRowUpper(); // Clean bounds int iColumn; for (iColumn=0;iColumnisInteger(iColumn)) { double lo = CoinMax(lower[iColumn],ceil(lower[iColumn]-1.0e-6)); if (lo>lower[iColumn]) originalModel_->setColLower(iColumn,lo); double up = CoinMin(upper[iColumn],floor(upper[iColumn]+1.0e-6)); if (upsetColUpper(iColumn,up); if (lo>up) feasible=false; } } bool allToGub = makeEquality==5; if (allToGub) makeEquality=3; // Initialize random seed CoinThreadRandom randomGenerator(987654321); bool justOnesWithObj=false; if (makeEquality==2||makeEquality==3||makeEquality==4) { int iRow, iColumn; int numberIntegers = 0; for (iColumn=0;iColumnisInteger(iColumn)) numberIntegers++; } // Look for possible SOS int numberSOS=0; int * mark = new int[numberColumns]; CoinFillN(mark,numberColumns,-1); int numberOverlap=0; int numberInSOS=0; // See if worthwhile creating accumulation variables int firstOther=numberRows; int * whichRow = new int[numberRows]; for (iRow=0;iRowisInteger(iColumn)||lower[iColumn]) { goodRow=false; break; } if (mark[iColumn]>=0) { overlap=true; numberOverlap++; } } if (goodRow) { if (!overlap) { // mark all for (int j=rowStart[iRow];j=5) { firstOther--; whichRow[firstOther]=iRow; } } } } if (makeEquality==2&&false) { if(numberOverlap||numberIntegers>numberInSOS+1) { // try just ones with costs CoinFillN(mark,numberColumns,-1); numberOverlap=0; numberInSOS=0; bool allCostsInSOS=true; const double *objective = originalModel_->getObjCoefficients() ; for (iRow=0;iRow=5) { bool goodRow=true; bool overlap=false; int nObj=0; for (int j=rowStart[iRow];jisInteger(iColumn)||lower[iColumn]) { goodRow=false; } if (objective[iColumn]) nObj++; if (mark[iColumn]>=0) { overlap=true; numberOverlap++; } } if (nObj&&nObj>=rowLength[iRow]-1) { if (goodRow) { if (!overlap) { // mark all for (int j=rowStart[iRow];j=0) nGoodObj++; else nBadObj++; } } if (nBadObj*101 printf("trying SOS as all costs there\n"); #endif } } } } if (firstOther(startModel_->getMatrixByCol()); // Column copy const int * row = matrixByColumn->getIndices(); const CoinBigIndex * columnStart = matrixByColumn->getVectorStarts(); const int * columnLength = matrixByColumn->getVectorLengths(); double * columnElements = matrixByColumn->getMutableElements(); int * rowCount = new int[numberRows]; memset(rowCount,0,numberRows*sizeof(int)); double * rowValue = new double [numberRows]; int numberY=0; int numberElements=0; int numberSOS=0; for (int kRow=firstOther;kRow0) { if (value!=rowValue[jRow]) rowCount[jRow]=-1; // no good else rowCount[jRow]++; } else if (!rowCount[jRow]) { whichRow[n++]=jRow; rowCount[jRow]=1; rowValue[jRow]=value; } } } } int bestRow=-1; int bestCount=4; for (j=0;j=5) { numberY++; numberElements+=count; } if (count>bestCount) { // possible bestRow=jRow; bestCount=count; } } if (bestRow>=0) { numberSOS++; numberY++; numberElements+=bestCount; } } if (numberY) { // Some may be duplicates // make sure ordered matrixByRow.orderMatrix(); elementByRow = matrixByRow.getElements(); column = matrixByRow.getIndices(); rowStart = matrixByRow.getVectorStarts(); rowLength = matrixByRow.getVectorLengths(); CoinBigIndex * newStart = new CoinBigIndex[numberY+1]; int * newColumn = new int [numberElements]; double * newValue = new double [numberElements]; double * hash = new double [numberY]; double * hashColumn = new double [numberColumns]; int i; for (i=0;igetColSolution(),numberColumns*sizeof(double)); memset(rowCount,0,numberRows*sizeof(int)); // List of SOS entries to zero out CoinBigIndex * where = new CoinBigIndex[numberColumns]; numberY=0; numberElements=0; int numberElementsY=0; newStart[0]=0; for (int kRow=firstOther;kRow0) { if (value!=rowValue[jRow]) rowCount[jRow]=-1; // no good else rowCount[jRow]++; } else if (!rowCount[jRow]) { whichRow[n++]=jRow; rowCount[jRow]=1; rowValue[jRow]=value; assert (value); } } } } for (i=0;i=5) { //assert (countsaveNumberY) rowCount[iRow]=-1000; } delete [] hash; delete [] hashColumn; matrixByColumn->cleanMatrix(); // Now add rows double * rhs = new double[numberY]; memset(rhs,0,numberY*sizeof(double)); startModel_->addRows(numberY,newStart,newColumn,newValue,rhs,rhs); delete [] rhs; delete [] newStart; delete [] newColumn; delete [] newValue; delete [] where; // Redo matrix CoinPackedMatrix add(true,rowY,columnY,valueY,numberElementsY); delete [] valueY; delete [] rowY; delete [] columnY; const int * row = add.getIndices(); const CoinBigIndex * columnStart = add.getVectorStarts(); //const int * columnLength = add.getVectorLengths(); double * columnElements = add.getMutableElements(); double * lo = new double [numberY]; double * up = new double [numberY]; for (i=0;iaddCols(numberY,columnStart,row,columnElements,lo,up,NULL); delete [] lo; delete [] up; for (i=0;isetInteger(i+numberColumns); CoinWarmStartBasis* basis = dynamic_cast (startModel_->getWarmStart()) ; if (basis) { for (i=0;isetArtifStatus(i+numberRows,CoinWarmStartBasis::atLowerBound); basis->setStructStatus(i+numberColumns,CoinWarmStartBasis::basic); } startModel_->setWarmStart(basis); delete basis; } startModel_->setColSolution(newSolution); delete [] newSolution; writeDebugMps(startModel_,"start",NULL); if (numberElements<10*CoinMin(numberColumns,100*numberY)) { handler_->message(CGL_ADDED_INTEGERS,messages_) <getHintParam(OsiDoDualInResolve, saveTakeHint,saveStrength); startModel_->setHintParam(OsiDoDualInResolve,false,OsiHintTry); startModel_->resolve(); numberIterationsPre_ += startModel_->getIterationCount(); startModel_->setHintParam(OsiDoDualInResolve,saveTakeHint,saveStrength); } else { // not such a good idea? delete startModel_; startModel_=NULL; } } delete [] rowValue; delete [] rowCount; } if (makeEquality==4) { makeEquality=0; #if 1 // Try and make continuous variables integer // make clone if (!startModel_) startModel_ = originalModel_->clone(); makeInteger(); #endif } delete [] whichRow; delete [] mark; if (numberSOS) { if (makeEquality==2) { if(numberOverlap||numberIntegers>numberInSOS+1) { handler_->message(CGL_PROCESS_SOS2,messages_) <getColLower(); upper = originalModel_->getColUpper(); rowLower = originalModel_->getRowLower(); rowUpper = originalModel_->getRowUpper(); } // See if all + 1 bool allPlusOnes=true; int nPossible=0; int numberMadeEquality=0; for (iRow=0;iRowisBinary(iColumn)) { good = false; possibleSlack=false; //break; } else { numberTotal++; } if (fabs(value-floor(value+0.5))>1.0e-12) possibleSlack=false;; if (fabs(value)!=1.0) { good=false; allPlus=false; } else if (value>0.0) { which[numberP1++]=iColumn; } else { numberM1++; which[numberColumns-numberM1]=iColumn; allPlus=false; } } if (possibleSlack) { if(upperValue>1.0e20&&lowerValue>-1.0e12) { possibleSlack = (fabs(lowerValue-floor(lowerValue+0.5))<1.0e-12); } else if(lowerValue<-1.0e20&&upperValue<1.0e12) { possibleSlack = (fabs(upperValue-floor(upperValue+0.5))<1.0e-12); } else { possibleSlack=false; } } if (allPlus) nPossible++; int iUpper = static_cast (floor(upperValue+1.0e-5)); int iLower = static_cast (ceil(lowerValue-1.0e-5)); int state=0; if (upperValue<1.0e6) { if (iUpper==1-numberM1) state=1; else if (iUpper==-numberM1) state=2; else if (iUpper<-numberM1) state=3; if (fabs((static_cast (iUpper))-upperValue)>1.0e-9) state =-1; } if (!state&&lowerValue>-1.0e6) { if (-iLower==1-numberP1) state=-1; else if (-iLower==-numberP1) state=-2; else if (-iLower<-numberP1) state=-3; if (fabs((static_cast (iLower))-lowerValue)>1.0e-9) state =-1; } if (good&&state>0) { if (abs(state)==3) { // infeasible feasible=false; break; } else if (abs(state)==2) { // we can fix all numberFixed += numberP1+numberM1; int i; if (state>0) { // fix all +1 at 0, -1 at 1 for (i=0;isetColUpper(which[i],0.0); for (i=0;isetColLower(which[numberColumns-i-1],1.0); } else { // fix all +1 at 1, -1 at 0 for (i=0;isetColLower(which[i],1.0); for (i=0;isetColUpper(which[numberColumns-i-1],0.0); } } else { if (!makeEquality||(makeEquality==-1&&numberM1+numberP10) { totalP1 += numberP1; totalM1 += numberM1; } else { totalP1 += numberM1; totalM1 += numberP1; } } } if (possibleSlack&&makeEquality==-2&&(!good||state<=0)) { if (numberTotalnumberRows; delete [] which; if (!feasible) { handler_->message(CGL_INFEASIBLE,messages_) <message(CGL_CLIQUES,messages_) <(totalP1+totalM1))/ (static_cast (numberCliques)) <message(CGL_FIXED,messages_) <message(CGL_SLACKS,messages_) <clone(); } for (int i=0;i=numberRows) { // just a slack not a clique upperValue=COIN_DBL_MAX; iRow -= numberRows; } CoinPackedVector column(1,&iRow,&value); startModel_->addCol(column,lowerValue,upperValue,objValue); // set integer startModel_->setInteger(numberColumns+i); if (value >0) startModel_->setRowLower(iRow,rowUpper[iRow]); else startModel_->setRowUpper(iRow,rowLower[iRow]); } } else if (!startModel_) { // make clone anyway so can tighten bounds startModel_ = originalModel_->clone(); } // move objective to integers or to aggregated lower = startModel_->getColLower(); upper = startModel_->getColUpper(); rowLower = startModel_->getRowLower(); rowUpper = startModel_->getRowUpper(); matrixByRow = CoinPackedMatrix(*startModel_->getMatrixByRow()); elementByRow = matrixByRow.getElements(); column = matrixByRow.getIndices(); rowStart = matrixByRow.getVectorStarts(); rowLength = matrixByRow.getVectorLengths(); char * marked = new char [numberColumns]; memset(marked,0,numberColumns); numberRows=startModel_->getNumRows(); numberColumns=startModel_->getNumCols(); //CoinPackedMatrix * matrixByColumn = const_cast(startModel_->getMatrixByCol()); // Column copy //const int * row = matrixByColumn->getIndices(); //const CoinBigIndex * columnStart = matrixByColumn->getVectorStarts(); //const int * columnLength = startModel_->getMatrixByCol()->getVectorLengths(); //const double * columnElements = matrixByColumn->getElements(); double * obj = CoinCopyOfArray(startModel_->getObjCoefficients(),numberColumns); double offset; int numberMoved=0; startModel_->getDblParam(OsiObjOffset,offset); for (iRow=0;iRowlower[iColumn]) { if (startModel_->isInteger(iColumn)) { #if 0 if (columnLength[iColumn]==1) { if (value==1.0) { } } if (value!=floor(value+0.5)) allInteger=false; if (allInteger&&fabs(value)<1.0e8) { if (!multiple) multiple = static_cast (fabs(value)); else if (multiple>0) multiple = gcd(multiple,static_cast (fabs(value))); } else { allInteger=false; } #endif } else { numberContinuous++; } if (value>0.0) { if (nPlus>0&&value!=valuePlus) { nPlus = - numberColumns; } else if (!nPlus) { nPlus=1; iPlus=iColumn; valuePlus=value; } else { nPlus++; } } else { if (nMinus>0&&value!=valueMinus) { nMinus = - numberColumns; } else if (!nMinus) { nMinus=1; iMinus=iColumn; valueMinus=value; } else { nMinus++; } } } else { rhs -= lower[iColumn]*value; } } if (((nPlus==1&&startModel_->isInteger(iPlus)&&nMinus>0)|| (nMinus==1&&startModel_->isInteger(iMinus)&&nPlus>0))&&numberContinuous&&true) { int jColumn; double multiplier; if (nPlus==1) { jColumn = iPlus; multiplier = fabs(valuePlus/valueMinus); rhs /= -valueMinus; } else { jColumn = iMinus; multiplier = fabs(valueMinus/valuePlus); rhs /= valuePlus; } double smallestPos=COIN_DBL_MAX; double smallestNeg=-COIN_DBL_MAX; for (CoinBigIndex j=rowStart[iRow];jlower[iColumn]) { if (objValue>=0.0) smallestPos=CoinMin(smallestPos,objValue); else smallestNeg=CoinMax(smallestNeg,objValue); } } } if (smallestPos>0.0) { double move=0.0; if(smallestNeg==-COIN_DBL_MAX) move=smallestPos; else if (smallestPos==COIN_DBL_MAX) move=smallestNeg; if (move) { // can move objective numberMoved++; #if CBC_USEFUL_PRINTING>1 if (rhs) printf("ZZZ on col %d move %g offset %g\n", jColumn,move,move*rhs); #endif offset -= move*rhs; for (CoinBigIndex j=rowStart[iRow];jlower[iColumn]) { obj[iColumn] -= move; } } else { obj[jColumn] += move*multiplier; } } } } } } #if CBC_USEFUL_PRINTING>1 if (numberMoved) printf("ZZZ %d costs moved\n",numberMoved); #endif startModel_->setDblParam(OsiObjOffset,offset); startModel_->setObjective(obj); delete [] obj; delete [] marked; delete [] rows; delete [] element; if (makeIntegers) { makeIntegers2(startModel_,makeIntegers); } int infeas=0; OsiSolverInterface * startModel2 = startModel_; // Do we want initial presolve if (doInitialPresolve) { assert (doInitialPresolve==1); OsiSolverInterface * presolvedModel; OsiSolverInterface * oldModel = startModel2; OsiPresolve * pinfo = new OsiPresolve(); int presolveActions=0; // Allow dual stuff on integers // Allow stuff which may not unroll cleanly presolveActions=1+16; if ((tuning&32)!=0) presolveActions |= 32; // Do not allow all +1 to be tampered with //if (allPlusOnes) //presolveActions |= 2; // allow transfer of costs // presolveActions |= 4; // If trying for SOS don't allow some transfers if (makeEquality==2||makeEquality==3) presolveActions |= 8; pinfo->setPresolveActions(presolveActions); if (prohibited_) assert (numberProhibited_==oldModel->getNumCols()); int saveLogLevel = oldModel->messageHandler()->logLevel(); if (saveLogLevel==1) oldModel->messageHandler()->setLogLevel(0); std::string solverName; oldModel->getStrParam(OsiSolverName,solverName); // Extend if you want other solvers to keep solution bool keepSolution=solverName=="clp"; // Should not be hardwired tolerance - temporary fix #ifndef CGL_PREPROCESS_TOLERANCE #define CGL_PREPROCESS_TOLERANCE 1.0e-7 #endif // So standalone version can switch off double feasibilityTolerance = ((tuning&1024)==0) ? CGL_PREPROCESS_TOLERANCE : 1.0e-4; presolvedModel = pinfo->presolvedModel(*oldModel,feasibilityTolerance,true,5,prohibited_,keepSolution,rowType_); oldModel->messageHandler()->setLogLevel(saveLogLevel); if (presolvedModel) { presolvedModel->messageHandler()->setLogLevel(saveLogLevel); //presolvedModel->writeMps("new"); writeDebugMps(presolvedModel,"ordinary",pinfo); // update prohibited and rowType update(pinfo,presolvedModel); if (!presolvedModel->getNumRows()) { doInitialPresolve=0; delete presolvedModel; delete pinfo; } else { model_[0]=presolvedModel; presolve_[0]=pinfo; modifiedModel_[0]=presolvedModel->clone(); startModel2 = modifiedModel_[0]; } } else { infeas=1; doInitialPresolve=0; delete presolvedModel; delete pinfo; } } // tighten bounds /* Virtuous solvers may require a refresh via initialSolve if this call is ever changed to give a nonzero value to the (default) second parameter. Previous actions may have made significant changes to the constraint system. Safe as long as tightenPrimalBounds doesn't ask for the current solution. */ if (!infeas&&true) { // may be better to just do at end writeDebugMps(startModel2,"before",NULL); infeas = tightenPrimalBounds(*startModel2); writeDebugMps(startModel2,"after",NULL); } if (infeas) { handler_->message(CGL_INFEASIBLE,messages_) <getNumCols()); CoinThreadRandom randomGenerator; CglTreeProbingInfo info(startModel2); info.level = 0; info.formulation_rows = startModel2->getNumRows(); info.inTree = false; info.options = !numberProhibited_ ? 0 : 2; info.randomNumberGenerator=&randomGenerator; info.pass=4; generator1.setMode(8); OsiCuts cs; generator1.generateCutsAndModify(*startModel2,cs,&info); OsiSolverInterface * temp = generator1.cliqueModel(startModel2,2); OsiSolverInterface * temp2 = cliqueIt(*temp,0.0001); delete temp; if (temp2) { if (temp2->getNumRows()getNumRows()) { delete newSolver; newSolver = temp2; } else { delete temp2; } } } else { // take out cliques newSolver=cliqueIt(*startModel2,0.0001); } if (newSolver) { if (startModel2 == modifiedModel_[0]) modifiedModel_[0]=newSolver; delete startModel2; startModel2=newSolver; newSolver->setHintParam(OsiDoDualInInitial, true, OsiHintTry); newSolver->initialSolve(); assert (newSolver->isProvenOptimal()); //printf("new size %d rows, %d columns\n", // newSolver->getNumRows(),newSolver->getNumCols()); } } { // Give a hint to do dual bool saveTakeHint; OsiHintStrength saveStrength; startModel2->getHintParam(OsiDoDualInInitial, saveTakeHint,saveStrength); startModel2->setHintParam(OsiDoDualInInitial,true,OsiHintTry); startModel2->initialSolve(); numberIterationsPre_ += startModel2->getIterationCount(); // double check if (!startModel2->isProvenOptimal()) { if (!startModel2->isProvenDualInfeasible()) { // Do presolves bool saveHint; OsiHintStrength saveStrength; startModel2->getHintParam(OsiDoPresolveInInitial,saveHint,saveStrength); startModel2->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry); startModel2->setHintParam(OsiDoDualInInitial,false,OsiHintTry); startModel2->initialSolve(); numberIterationsPre_ += startModel2->getIterationCount(); if (!startModel2->isProvenDualInfeasible()) { CoinWarmStart * empty = startModel2->getEmptyWarmStart(); startModel2->setWarmStart(empty); delete empty; startModel2->setHintParam(OsiDoDualInInitial,true,OsiHintTry); startModel2->initialSolve(); numberIterationsPre_ += startModel2->getIterationCount(); } startModel2->setHintParam(OsiDoPresolveInInitial,saveHint,saveStrength); } } startModel2->setHintParam(OsiDoDualInInitial,saveTakeHint,saveStrength); } if (!startModel2->isProvenOptimal()) { if (!startModel2->isProvenDualInfeasible()) { handler_->message(CGL_INFEASIBLE,messages_)<< CoinMessageEol ; #if CBC_USEFUL_PRINTING>1 startModel2->writeMps("infeas"); #endif } else { handler_->message(CGL_UNBOUNDED,messages_)<< CoinMessageEol ; } return NULL; } reducedCostFix(*startModel2); if (!numberSolvers_) { // just fix OsiSolverInterface * newModel = modified(startModel2,false,numberChanges,0,numberModifiedPasses); if (startModel_!=originalModel_) delete startModel_; if (startModel2!=startModel_) delete startModel2; startModel_=newModel; returnModel=startModel_; } else { OsiSolverInterface * presolvedModel; OsiSolverInterface * oldModel = startModel2; if (doInitialPresolve) oldModel = modifiedModel_[0]; //CglDuplicateRow dupCuts(oldModel); //dupCuts.setLogLevel(1); // If +1 try duplicate rows #define USECGLCLIQUE 512 if ((options_&8)!=0) tuning &= ~USECGLCLIQUE; if ((options_&4)!=0) allPlusOnes=false; if ((allPlusOnes&&(options_&8)==0)||(tuning&USECGLCLIQUE)!=0) { #if 1 // put at beginning int nAdd= ((tuning&(64+USECGLCLIQUE))==64+USECGLCLIQUE&&allPlusOnes) ? 2 : 1; CglCutGenerator ** temp = generator_; generator_ = new CglCutGenerator * [numberCutGenerators_+nAdd]; memcpy(generator_+nAdd,temp,numberCutGenerators_*sizeof(CglCutGenerator *)); delete[] temp ; numberCutGenerators_+=nAdd; if (nAdd==2||(tuning&USECGLCLIQUE)!=0) { CglClique * cliqueGen=new CglClique(false,true); cliqueGen->setStarCliqueReport(false); cliqueGen->setRowCliqueReport(false); if ((tuning&USECGLCLIQUE)==0) cliqueGen->setMinViolation(-2.0); else cliqueGen->setMinViolation(-3.0); generator_[0]=cliqueGen; } if ((allPlusOnes||(tuning&256)!=0)&&(options_&4)==0) { CglDuplicateRow * dupCuts =new CglDuplicateRow(oldModel); if ((tuning&256)!=0) dupCuts->setMaximumDominated(numberColumns); generator_[nAdd-1]=dupCuts; } #else CglDuplicateRow dupCuts(oldModel); addCutGenerator(&dupCuts); #endif } for (int iPass=doInitialPresolve;iPassgetColLower(); const double * columnUpper = oldModel->getColUpper(); const CoinPackedMatrix * rowCopy = oldModel->getMatrixByRow(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * rowElements = rowCopy->getElements(); const CoinPackedMatrix * columnCopy = oldModel->getMatrixByCol(); //const int * row = columnCopy->getIndices(); //const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); //const double * columnElements = columnCopy->getElements(); const double * rowLower = oldModel->getRowLower(); const double * rowUpper = oldModel->getRowUpper(); const double * objective = oldModel->getObjCoefficients(); double direction = oldModel->getObjSense(); int numberRows = oldModel->getNumRows(); for (int iRow=0;iRow1.0e20)) { CoinBigIndex start = rowStart[iRow]; int iColumn1 = column[start]; int iColumn2 = column[start+1]; double value1 = rowElements[start]; double value2 = rowElements[start+1]; double upper; if (rowLower[iRow]<-1.0e20) { if (rowUpper[iRow]<1.0e20) upper = rowUpper[iRow]; else continue; // free row } else { upper = - rowLower[iRow]; value1=-value1; value2=-value2; } //for now just singletons bool integer1 = oldModel->isInteger(iColumn1); bool integer2 = oldModel->isInteger(iColumn2); int debug=0; if (columnLength[iColumn1]==1) { if (integer1) { debug=0;// no good } else if (integer2) { // possible debug=1; } } else if (columnLength[iColumn2]==1) { if (integer2) { debug=-1; // print and skip } else if (integer1) { // possible debug=1; double valueD = value1; value1 = value2; value2 = valueD; int valueI = iColumn1; iColumn1 = iColumn2; iColumn2 = valueI; bool valueB = integer1; integer1 = integer2; integer2 = valueB; } } #if CBC_USEFUL_PRINTING if (debug&&0) { printf("%d %d elements%selement %g and %d %d elements%selement %g <= %g\n", iColumn1,columnLength[iColumn1],integer1 ? " (integer) " : " ",value1, iColumn2,columnLength[iColumn2],integer2 ? " (integer) " : " ",value2, upper); } #endif if (debug>0) { if (value1>0.0&&objective[iColumn1]*direction<0.0) { // will push as high as possible so make == // highest effective rhs if (value2>0) upper -= value2 * columnLower[iColumn2]; else upper -= value2 * columnUpper[iColumn2]; if (columnUpper[iColumn1]>1.0e20|| columnUpper[iColumn1]*value1>=upper) { //printf("looks possible\n"); // make equality if (rowLower[iRow]<-1.0e20) oldModel->setRowLower(iRow,rowUpper[iRow]); else oldModel->setRowUpper(iRow,rowLower[iRow]); } else { // may be able to make integer // may just be better to use to see objective integral if (upper==floor(upper)&&value2==floor(value2)&& value1==floor(value1)&&objective[iColumn1]==floor(objective[iColumn1])) oldModel->setInteger(iColumn1); //printf("odd3\n"); } } else if (value1<0.0&&objective[iColumn1]*direction>0.0) { //printf("odd4\n"); } else { //printf("odd2\n"); } } else if (debug<0) { //printf("odd1\n"); } } } } OsiPresolve * pinfo = new OsiPresolve(); int presolveActions=0; // Allow dual stuff on integers // Allow stuff which may not unroll cleanly presolveActions=1+16; // Do not allow all +1 to be tampered with //if (allPlusOnes) //presolveActions |= 2; // allow transfer of costs // presolveActions |= 4; // If trying for SOS don't allow some transfers if (makeEquality==2||makeEquality==3) presolveActions |= 8; pinfo->setPresolveActions(presolveActions); if (prohibited_) assert (numberProhibited_==oldModel->getNumCols()); /* VIRTUOUS but possible bad for performance At this point, the solution is most likely stale: we may have added cuts as we left the previous call to modified(), or we may have changed row bounds in VUB analysis just above. Continuous presolve doesn't need a solution unless we want it to transform the current solution to match the presolved model. */ int saveLogLevel = oldModel->messageHandler()->logLevel(); if (saveLogLevel==1) oldModel->messageHandler()->setLogLevel(0); std::string solverName; oldModel->getStrParam(OsiSolverName,solverName); // Extend if you want other solvers to keep solution bool keepSolution=solverName=="clp"; presolvedModel = pinfo->presolvedModel(*oldModel,CGL_PREPROCESS_TOLERANCE,true,5, prohibited_,keepSolution,rowType_); oldModel->messageHandler()->setLogLevel(saveLogLevel); if (!presolvedModel) { returnModel=NULL; delete pinfo; break; } presolvedModel->messageHandler()->setLogLevel(saveLogLevel); // update prohibited and rowType update(pinfo,presolvedModel); writeDebugMps(presolvedModel,"ordinary2",pinfo); model_[iPass]=presolvedModel; presolve_[iPass]=pinfo; if (!presolvedModel->getNumRows()) { // was returnModel=oldModel; returnModel=presolvedModel; numberSolvers_=iPass+1; break; // model totally solved } bool constraints = iPassgetHintParam(OsiDoDualInInitial, saveTakeHint,saveStrength); //if (iPass) presolvedModel->setHintParam(OsiDoDualInInitial,false,OsiHintTry); presolvedModel->initialSolve(); numberIterationsPre_ += presolvedModel->getIterationCount(); presolvedModel->setHintParam(OsiDoDualInInitial,saveTakeHint,saveStrength); if (!presolvedModel->isProvenOptimal()) { writeDebugMps(presolvedModel,"bad2",NULL); CoinWarmStartBasis *slack = dynamic_cast(presolvedModel->getEmptyWarmStart()) ; presolvedModel->setWarmStart(slack); delete slack ; presolvedModel->resolve(); if (!presolvedModel->isProvenOptimal()) { returnModel=NULL; //printf("infeasible\n"); break; } else { //printf("feasible on second try\n"); } } // maybe we can fix some int numberFixed = reducedCostFix(*presolvedModel); #if CBC_USEFUL_PRINTING>1 if (numberFixed) printf("%d variables fixed on reduced cost\n",numberFixed); #endif #if CGL_WRITEMPS const OsiRowCutDebugger *debugger = presolvedModel->getRowCutDebugger(); if (debugger) printf("Contains optimal before modified\n") ; #endif OsiSolverInterface * newModel = modified(presolvedModel,constraints,numberChanges,iPass-doInitialPresolve,numberModifiedPasses); #if CGL_WRITEMPS if (debugger) assert(newModel->getRowCutDebugger()); #endif returnModel=newModel; if (!newModel) { break; } modifiedModel_[iPass]=newModel; oldModel=newModel; writeDebugMps(newModel,"ordinary3",NULL); if (!numberChanges&&!numberFixed) { #if CBC_USEFUL_PRINTING>1 printf("exiting after pass %d of %d\n",iPass,numberSolvers_); #endif numberSolvers_=iPass+1; break; } } } #if CGL_WRITEMPS const OsiRowCutDebugger *debugger = returnModel->getRowCutDebugger(); if (debugger) printf("Contains optimal before tighten\n") ; #endif if (returnModel) { if (returnModel->getNumRows()) { // tighten bounds int infeas = tightenPrimalBounds(*returnModel); #if CGL_WRITEMPS if (debugger) assert(returnModel->getRowCutDebugger()); #endif if (infeas) { delete returnModel; for (int iPass=0;iPassmessage(CGL_INFEASIBLE,messages_) <getNumCols(); for (iColumn=0;iColumnisInteger(iColumn)) numberIntegers++; } } if ((makeEquality==2||makeEquality==3)&&numberCliques&&returnModel) { int iRow, iColumn; int numberColumns = returnModel->getNumCols(); int numberRows = returnModel->getNumRows(); const double * objective = returnModel->getObjCoefficients(); // get row copy const CoinPackedMatrix * matrix = returnModel->getMatrixByRow(); const double * element = matrix->getElements(); const int * column = matrix->getIndices(); const CoinBigIndex * rowStart = matrix->getVectorStarts(); const int * rowLength = matrix->getVectorLengths(); const double * rowLower = returnModel->getRowLower(); const double * rowUpper = returnModel->getRowUpper(); const double * columnLower = returnModel->getColLower(); // Look for possible SOS int numberSOS=0; int * mark = new int[numberColumns]; int * sosRow = new int [numberRows]; CoinZeroN(sosRow,numberRows); CoinFillN(mark,numberColumns,-1); int numberOverlap=0; int numberInSOS=0; for (iRow=0;iRowisInteger(iColumn)||columnLower[iColumn]) { goodRow=false; break; } if (mark[iColumn]>=0&&!allToGub) { goodRow=false; numberOverlap++; } if (objective[iColumn]) nObj++; } if (goodRow&&justOnesWithObj) { if (!nObj||nObjnumberInSOS+1)) { handler_->message(CGL_PROCESS_SOS2,messages_) <message(CGL_PROCESS_SOS1,messages_) <getMatrixByCol(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); const double * columnElements = columnCopy->getElements(); const double * objective = returnModel->getObjCoefficients(); int * numberInRow = new int [numberRows]; double * sort = new double[numberColumns]; int * which = new int[numberColumns]; for (int iSOS =0;iSOS=n-1) { // See how many different int i; for ( i=0;ilast+CoinMax(fabs(last)*1.0e-8,1.0e-5)) { nDiff++; } last = sort[i]; } if (nDiff>numberDifferent) { numberDifferent = nDiff; bestRow=iRow; } } } if (numberObj>=n-1||bestRow<0) { int i; for ( i=0;ilast+CoinMax(fabs(last)*1.0e-8,1.0e-5)) { nDiff++; } last = sort[i]; } if (nDiff>numberDifferent) { numberDifferent = nDiff; bestRow=numberRows; } } if (bestRow>=0) { // if not objective - recreate if (bestRowgetRowCutDebugger()); #endif if (returnModel) { if (makeIntegers) makeIntegers2(returnModel,makeIntegers); #if CGL_WRITEMPS if (debugger) assert(returnModel->getRowCutDebugger()); #endif numberIntegers=0; int numberBinary=0; int numberColumns=returnModel->getNumCols(); for (int i=0;iisInteger(i)) { numberIntegers++; if (returnModel->isBinary(i)) { numberBinary++; } } } handler_->message(CGL_PROCESS_STATS2,messages_) <getNumRows()<getNumElements() <getRowCutDebugger()); #endif // If can make some cuts then do so if (rowType_) { int numberRows = returnModel->getNumRows(); int numberCuts=0; for (int i=0;i0) numberCuts++; } if (numberCuts) { CglStored stored; int * whichRow = new int[numberRows]; // get row copy const CoinPackedMatrix * rowCopy = returnModel->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowLower = returnModel->getRowLower(); const double * rowUpper = returnModel->getRowUpper(); const double * element = rowCopy->getElements(); int iRow,nDelete=0; for (iRow=0;iRowdeleteRows(nDelete,whichRow); delete [] whichRow; cuts_ = stored; } } } #if CGL_WRITEMPS if (debugger) assert(returnModel->getRowCutDebugger()); #endif #if 0 if (returnModel) { int numberColumns = returnModel->getNumCols(); int numberRows = returnModel->getNumRows(); int * del = new int [CoinMax(numberColumns,numberRows)]; int * original = new int [numberColumns]; int nDel=0; for (int i=0;iisInteger(i)) del[nDel++]=i; } int nExtra=0; if (nDel&&nDel!=numberColumns&&(options_&1)!=0&&false) { OsiSolverInterface * yyyy = returnModel->clone(); int nPass=0; while (nDel&&nPass<10) { nPass++; OsiSolverInterface * xxxx = yyyy->clone(); int nLeft=0; for (int i=0;i=0) original[nLeft++]=kOrig; } assert (nLeft==numberColumns-nDel); xxxx->deleteCols(nDel,del); numberColumns = xxxx->getNumCols(); const CoinPackedMatrix * rowCopy = xxxx->getMatrixByRow(); numberRows = rowCopy->getNumRows(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowLower = xxxx->getRowLower(); const double * rowUpper = xxxx->getRowUpper(); const double * element = rowCopy->getElements(); const CoinPackedMatrix * columnCopy = xxxx->getMatrixByCol(); const int * columnLength = columnCopy->getVectorLengths(); nDel=0; // Could do gcd stuff on ones with costs for (int i=0;iisInteger(iColumn)) { double mult =1.0/fabs(element[k]); if (rowLower[i]<-1.0e20) { double value = rowUpper[i]*mult; if (fabs(value-floor(value+0.5))<1.0e-8) { del[nDel++]=i; if (columnLength[iColumn]==1) { xxxx->setInteger(iColumn); int kOrig=original[iColumn]; returnModel->setInteger(kOrig); } } } else if (rowUpper[i]>1.0e20) { double value = rowLower[i]*mult; if (fabs(value-floor(value+0.5))<1.0e-8) { del[nDel++]=i; if (columnLength[iColumn]==1) { xxxx->setInteger(iColumn); int kOrig=original[iColumn]; returnModel->setInteger(kOrig); } } } else { double value = rowUpper[i]*mult; if (rowLower[i]==rowUpper[i]&& fabs(value-floor(value+0.5))<1.0e-8) { del[nDel++]=i; xxxx->setInteger(iColumn); int kOrig=original[iColumn]; returnModel->setInteger(kOrig); } } } } else { // only if all singletons bool possible=false; if (rowLower[i]<-1.0e20) { double value = rowUpper[i]; if (fabs(value-floor(value+0.5))<1.0e-8) possible=true; } else if (rowUpper[i]>1.0e20) { double value = rowLower[i]; if (fabs(value-floor(value+0.5))<1.0e-8) possible=true; } else { double value = rowUpper[i]; if (rowLower[i]==rowUpper[i]&& fabs(value-floor(value+0.5))<1.0e-8) possible=true; } if (possible) { for (CoinBigIndex j=rowStart[i]; jisInteger(iColumn)) { xxxx->setInteger(iColumn); int kOrig=original[iColumn]; returnModel->setInteger(kOrig); } } del[nDel++]=i; } } } } if (nDel) { xxxx->deleteRows(nDel,del); } if (nDel!=numberRows) { nDel=0; for (int i=0;iisInteger(i)) { del[nDel++]=i; nExtra++; } } } delete yyyy; yyyy=xxxx->clone(); } numberColumns = yyyy->getNumCols(); numberRows = yyyy->getNumRows(); if (!numberColumns||!numberRows) { printf("All gone\n"); int numberColumns = returnModel->getNumCols(); for (int i=0;iisInteger(i)); } // Would need to check if original bounds integer //yyyy->writeMps("noints"); delete yyyy; printf("Creating simplified model with %d rows and %d columns - %d extra integers\n", numberRows,numberColumns,nExtra); } delete [] del; delete [] original; //exit(2); } #endif writeDebugMps(returnModel,"returnModel",NULL); #if CGL_WRITEMPS if (debugger) assert(returnModel->getRowCutDebugger()); #endif return returnModel; } /* Tightens primal bounds to make dual and branch and cutfaster. Unless fixed, bounds are slightly looser than they could be. Returns non-zero if problem infeasible Fudge for branch and bound - put bounds on columns of factor * largest value (at continuous) - should improve stability in branch and bound on infeasible branches (0.0 is off) */ int CglPreProcess::tightenPrimalBounds(OsiSolverInterface & model,double factor) { // Get a row copy in standard format CoinPackedMatrix copy = *model.getMatrixByRow(); // get matrix data pointers const int * column = copy.getIndices(); const CoinBigIndex * rowStart = copy.getVectorStarts(); const int * rowLength = copy.getVectorLengths(); double * element = copy.getMutableElements(); int numberChanged=1,iPass=0; double large = model.getInfinity()*0.1; // treat bounds > this as infinite int numberInfeasible=0; int totalTightened = 0; double tolerance; model.getDblParam(OsiPrimalTolerance,tolerance); int numberColumns=model.getNumCols(); const double * colLower = model.getColLower(); const double * colUpper = model.getColUpper(); // New and saved column bounds double * newLower = new double [numberColumns]; memcpy(newLower,colLower,numberColumns*sizeof(double)); double * newUpper = new double [numberColumns]; memcpy(newUpper,colUpper,numberColumns*sizeof(double)); double * columnLower = new double [numberColumns]; memcpy(columnLower,colLower,numberColumns*sizeof(double)); double * columnUpper = new double [numberColumns]; memcpy(columnUpper,colUpper,numberColumns*sizeof(double)); int iRow, iColumn; // If wanted - tighten column bounds using solution if (factor) { /* Callers need to ensure that the solution is fresh */ const double * solution = model.getColSolution(); double largest=0.0; if (factor>0.0) { assert (factor>1.0); for (iColumn=0;iColumntolerance) { largest = CoinMax(largest,fabs(solution[iColumn])); } } largest *= factor; } else { // absolute largest = - factor; } for (iColumn=0;iColumntolerance) { newUpper[iColumn] = CoinMin(columnUpper[iColumn],largest); newLower[iColumn] = CoinMax(columnLower[iColumn],-largest); } } } int numberRows = model.getNumRows(); const double * rowLower = model.getRowLower(); const double * rowUpper = model.getRowUpper(); #ifndef NDEBUG double large2= 1.0e10*large; #endif #define MAXPASS 10 // Loop round seeing if we can tighten bounds // Would be faster to have a stack of possible rows // and we put altered rows back on stack int numberCheck=-1; while(numberChanged>numberCheck) { numberChanged = 0; // Bounds tightened this pass if (iPass==MAXPASS) break; iPass++; for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow]>-large||rowUpper[iRow] 0.0) { if (newUpper[iColumn] >= large) { ++infiniteUpper; } else { maximumUp += newUpper[iColumn] * value; } if (newLower[iColumn] <= -large) { ++infiniteLower; } else { maximumDown += newLower[iColumn] * value; } } else if (value<0.0) { if (newUpper[iColumn] >= large) { ++infiniteLower; } else { maximumDown += newUpper[iColumn] * value; } if (newLower[iColumn] <= -large) { ++infiniteUpper; } else { maximumUp += newLower[iColumn] * value; } } } // Build in a margin of error maximumUp += 1.0e-8*fabs(maximumUp); maximumDown -= 1.0e-8*fabs(maximumDown); double maxUp = maximumUp+infiniteUpper*1.0e31; double maxDown = maximumDown-infiniteLower*1.0e31; if (maxUp <= rowUpper[iRow] + tolerance && maxDown >= rowLower[iRow] - tolerance) { // Row is redundant - make totally free } else { if (maxUp < rowLower[iRow] -100.0*tolerance || maxDown > rowUpper[iRow]+100.0*tolerance) { // problem is infeasible - exit at once numberInfeasible++; break; } double lower = rowLower[iRow]; double upper = rowUpper[iRow]; for (j = rStart; j < rEnd; ++j) { double value=element[j]; iColumn = column[j]; double nowLower = newLower[iColumn]; double nowUpper = newUpper[iColumn]; if (value > 0.0) { // positive value if (lower>-large) { if (!infiniteUpper) { assert(nowUpper < large2); newBound = nowUpper + (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp)>1.0e8) newBound -= 1.0e-12*fabs(maximumUp); } else if (infiniteUpper==1&&nowUpper>large) { newBound = (lower -maximumUp) / value; // relax if original was large if (fabs(maximumUp)>1.0e8) newBound -= 1.0e-12*fabs(maximumUp); } else { newBound = -COIN_DBL_MAX; } if (newBound > nowLower + 1.0e-12&&newBound>-large) { // Tighten the lower bound newLower[iColumn] = newBound; numberChanged++; // check infeasible (relaxed) if (nowUpper - newBound < -100.0*tolerance) { numberInfeasible++; } // adjust double now; if (nowLower<-large) { now=0.0; infiniteLower--; } else { now = nowLower; } maximumDown += (newBound-now) * value; nowLower = newBound; } } if (upper - large2); newBound = nowLower + (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown)>1.0e8) newBound += 1.0e-12*fabs(maximumDown); } else if (infiniteLower==1&&nowLower<-large) { newBound = (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown)>1.0e8) newBound += 1.0e-12*fabs(maximumDown); } else { newBound = COIN_DBL_MAX; } if (newBound < nowUpper - 1.0e-12&&newBoundlarge) { now=0.0; infiniteUpper--; } else { now = nowUpper; } maximumUp += (newBound-now) * value; nowUpper = newBound; } } } else { // negative value if (lower>-large) { if (!infiniteUpper) { assert(nowLower < large2); newBound = nowLower + (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp)>1.0e8) newBound += 1.0e-12*fabs(maximumUp); } else if (infiniteUpper==1&&nowLower<-large) { newBound = (lower -maximumUp) / value; // relax if original was large if (fabs(maximumUp)>1.0e8) newBound += 1.0e-12*fabs(maximumUp); } else { newBound = COIN_DBL_MAX; } if (newBound < nowUpper - 1.0e-12&&newBoundlarge) { now=0.0; infiniteLower--; } else { now = nowUpper; } maximumDown += (newBound-now) * value; nowUpper = newBound; } } if (upper 1.0e8) newBound -= 1.0e-12*fabs(maximumDown); } else if (infiniteLower==1&&nowUpper>large) { newBound = (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown)>1.0e8) newBound -= 1.0e-12*fabs(maximumDown); } else { newBound = -COIN_DBL_MAX; } if (newBound > nowLower + 1.0e-12&&newBound>-large) { // Tighten the lower bound newLower[iColumn] = newBound; numberChanged++; // check infeasible (relaxed) if (nowUpper - newBound < -100.0*tolerance) { numberInfeasible++; } // adjust double now; if (nowLower<-large) { now=0.0; infiniteUpper--; } else { now = nowLower; } maximumUp += (newBound-now) * value; nowLower = newBound; } } } } } } } totalTightened += numberChanged; if (iPass==1) numberCheck=numberChanged>>4; if (numberInfeasible) break; } if (!numberInfeasible) { // Set bounds slightly loose unless integral - now tighter double useTolerance = 1.0e-5; for (iColumn=0;iColumncolumnLower[iColumn]) { double lower = newLower[iColumn]; double upper = newUpper[iColumn]; if (model.isInteger(iColumn)) { if (fabs(lower-floor(lower+0.5))<1.0e-5) lower=floor(lower+0.5); else lower = ceil(lower); if (fabs(upper-floor(upper+0.5))<1.0e-5) upper=floor(upper+0.5); else upper = floor(upper); if (lower>upper) numberInfeasible++; } else { if (fabs(upper)<1.0e-8&&fabs(lower)<1.0e-8) { lower=0.0; upper=0.0; } else { // Relax unless integral if (fabs(lower-floor(lower+0.5))>1.0e-9) lower -= useTolerance; else lower = floor(lower+0.5); lower=CoinMax(columnLower[iColumn],lower); if (fabs(upper-floor(upper+0.5))>1.0e-9) upper += useTolerance; else upper = floor(upper+0.5); upper=CoinMin(columnUpper[iColumn],upper); } } model.setColLower(iColumn,lower); model.setColUpper(iColumn,upper); newLower[iColumn]=lower; newUpper[iColumn]=upper; } } if (!numberInfeasible) { // check common bad formulations int numberChanges=0; for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow]>-large||rowUpper[iRow]newLower[iColumn]) { if (model.isInteger(iColumn)) { numberInteger++; //whichInteger=iColumn; } largest = CoinMax(largest,fabs(value)); if (value > 0.0) { if (newUpper[iColumn] >= large) { ++infiniteUpper; } else { maximumUp += newUpper[iColumn] * value; } if (newLower[iColumn] <= -large) { ++infiniteLower; } else { maximumDown += newLower[iColumn] * value; } } else if (value<0.0) { if (newUpper[iColumn] >= large) { ++infiniteLower; } else { maximumDown += newUpper[iColumn] * value; } if (newLower[iColumn] <= -large) { ++infiniteUpper; } else { maximumUp += newLower[iColumn] * value; } } } else { // fixed sumFixed += newLower[iColumn]*value; } } // Adjust maximumUp += sumFixed; maximumDown += sumFixed; // For moment just when all one sign and ints //maximumUp += 1.0e-8*fabs(maximumUp); //maximumDown -= 1.0e-8*fabs(maximumDown); double gap = 0.0; if ((rowLower[iRow]>maximumDown&&largest>rowLower[iRow]-maximumDown)&& ((maximumUp<=rowUpper[iRow]&&!infiniteUpper)||rowUpper[iRow]>=1.0e30)) { gap = rowLower[iRow]-maximumDown; if (infiniteLower) gap=0.0; // switch off } else if ((maximumUp>rowUpper[iRow]&&largest>maximumUp-rowUpper[iRow])&& ((maximumDown>=rowLower[iRow]&&!infiniteLower)||rowLower[iRow]<=-1.0e30)) { gap = -(maximumUp-rowUpper[iRow]); if (infiniteUpper) gap=0.0; // switch off } if (fabs(gap)>1.0e-8) { for (j = rStart;j < rEnd; ++j) { double value=element[j]; iColumn = column[j]; double difference = newUpper[iColumn]-newLower[iColumn]; if (difference>0.0&&difference<=1.0) { double newValue=value; if (value*gap>0.0&&model.isInteger(iColumn)) { if (fabs(value*difference) > fabs(gap)) { // No need for it to be larger than newValue = gap/difference; } if (fabs(value-newValue)>1.0e-12) { numberChanges++; // BUT variable may have bound double rhsAdjust=0.0; if (gap>0.0) { // rowLower if (value>0.0) { // new value is based on going up from lower bound if (colLower[iColumn]) rhsAdjust = colLower[iColumn]*(value-newValue); } else { // new value is based on going down from upper bound if (colUpper[iColumn]) rhsAdjust = colUpper[iColumn]*(value-newValue); } } else { // rowUpper if (value<0.0) { // new value is based on going up from lower bound if (colLower[iColumn]) rhsAdjust = colLower[iColumn]*(value-newValue); } else { // new value is based on going down from upper bound if (colUpper[iColumn]) rhsAdjust = colUpper[iColumn]*(value-newValue); } } if (rhsAdjust) { #if CBC_USEFUL_PRINTING>1 printf("FFor column %d bounds %g, %g on row %d bounds %g, %g coefficient was changed from %g to %g with rhs adjustment of %g\n", iColumn,colLower[iColumn],colUpper[iColumn], iRow,rowLower[iRow],rowUpper[iRow], value,newValue,rhsAdjust); #endif if (rowLower[iRow]>-1.0e20) model.setRowLower(iRow,rowLower[iRow]-rhsAdjust); if (rowUpper[iRow]<1.0e20) model.setRowUpper(iRow,rowUpper[iRow]-rhsAdjust); #if CBC_USEFUL_PRINTING>1 printf("FFor column %d bounds %g, %g on row %d bounds %g, %g coefficient was changed from %g to %g with rhs adjustment of %g\n", iColumn,colLower[iColumn],colUpper[iColumn], iRow,rowLower[iRow],rowUpper[iRow], value,newValue,rhsAdjust); #endif } element[j]=newValue; handler_->message(CGL_ELEMENTS_CHANGED2,messages_) <numberColumns()==numberColumns) { const double * optimal = debugger->optimalSolution(); double sum=0.0; for (int jj = rStart;jj < rEnd; ++jj) { double value=element[j]; int jColumn = column[jj]; sum += value*optimal[jColumn]; } assert (sum>=rowLower[iRow]-1.0e7&&sum<=rowUpper[iRow]+1.0e-7); } #endif } } } } } } } if (numberChanges) { handler_->message(CGL_ELEMENTS_CHANGED1,messages_) <message(CGL_INFEASIBLE,messages_) <getHintParam(OsiDoPresolveInInitial,saveHint,saveStrength); bool saveHint2; OsiHintStrength saveStrength2; originalModel_->getHintParam(OsiDoDualInInitial, saveHint2,saveStrength2); OsiSolverInterface * clonedCopy=NULL; double saveObjectiveValue = modelIn.getObjValue(); // Make sure cutoff is ignored modelIn.setDblParam(OsiDualObjectiveLimit,1.0e50); if (!modelIn.isProvenOptimal()) { CoinWarmStartBasis *slack = dynamic_cast(modelIn.getEmptyWarmStart()) ; modelIn.setWarmStart(slack); delete slack ; modelIn.resolve(); } if (modelIn.isProvenOptimal()) { #if COIN_DEVELOP>1 whichMps++; sprintf(nameMps,"start_%d",whichMps); modelIn.writeMps(nameMps); printf("Mps file %s saved in %s at line %d\n", nameMps,__FILE__,__LINE__); #endif OsiSolverInterface * modelM = &modelIn; // If some cuts add back rows if (cuts_.sizeRowCuts()) { clonedCopy = modelM->clone(); modelM=clonedCopy; int numberRowCuts = cuts_.sizeRowCuts() ; // add in CoinBuild build; for (int k = 0;krow().getNumElements(); const int * columnCut = thisCut->row().getIndices(); const double * elementCut = thisCut->row().getElements(); double lower = thisCut->lb(); double upper = thisCut->ub(); build.addRow(n,columnCut,elementCut,lower,upper); } modelM->addRows(build); // basis is wrong CoinWarmStartBasis empty; modelM->setWarmStart(&empty); } for (int iPass=numberSolvers_-1;iPass>=0;iPass--) { OsiSolverInterface * model = model_[iPass]; if (model->getNumCols()) { CoinWarmStartBasis* basis = dynamic_cast (modelM->getWarmStart()) ; if (basis) { model->setWarmStart(basis); delete basis; } int numberColumns = modelM->getNumCols(); const double * solutionM = modelM->getColSolution(); const double * columnLower2 = model->getColLower(); const double * columnUpper2 = model->getColUpper(); const double * columnLower = modelM->getColLower(); const double * columnUpper = modelM->getColUpper(); int iColumn; for (iColumn=0;iColumnisInteger(iColumn)) { double value = solutionM[iColumn]; double value2 = floor(value+0.5); // if test fails then empty integer if (fabs(value-value2)<1.0e-3) { model->setColLower(iColumn,value2); model->setColUpper(iColumn,value2); } else { #if CBC_USEFUL_PRINTING>1 printf("NPASS=%d, ipass %d var %d values %g %g %g\n", numberSolvers_,iPass,iColumn,model->getColLower()[iColumn], value,model->getColUpper()[iColumn]); #endif } } else if (columnUpper[iColumn]==columnLower[iColumn]) { if (columnUpper2[iColumn]>columnLower2[iColumn]&&!model->isInteger(iColumn)) { model->setColUpper(iColumn,columnLower[iColumn]); } } } } int numberColumns = modelM->getNumCols(); const double * solutionM = modelM->getColSolution(); int iColumn; // Give a hint to do primal //model->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry); model->setHintParam(OsiDoDualInInitial,false,OsiHintTry); // clean /* VIRTUOUS - I am not happy here (JJF) - This was put in for Special Ordered Sets of type 2 Previous loop has likely made nontrivial bound changes, hence invalidated solution. Why do we need this? We're about to do an initialSolve, which will overwrite solution. Perhaps belongs in same guarded block with following feasibility check? If this is necessary for clp, solution should be acquired before bounds changes. */ if (0) { int numberColumns = model->getNumCols(); const double * lower = model->getColLower(); const double * upper = model->getColUpper(); double * solution = CoinCopyOfArray(model->getColSolution(),numberColumns); int i; for ( i=0;isetColSolution(solution); delete [] solution; } #if CBC_USEFUL_PRINTING>1 { int numberColumns = model->getNumCols(); int numberRows = model->getNumRows(); const double * lower = model->getColLower(); const double * upper = model->getColUpper(); const double * rowLower = model->getRowLower(); const double * rowUpper = model->getRowUpper(); #ifndef NDEBUG double primalTolerance=1.0e-8; #endif // Column copy const CoinPackedMatrix * matrix = model->getMatrixByCol(); const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); double * rowActivity = new double[numberRows]; memset(rowActivity,0,numberRows*sizeof(double)); int i; for ( i=0;iupper[i]) { value=upper[i]; } assert (upper[i]>=lower[i]); assert ((fabs(value)<1.0e20)); if (value) { for (j=columnStart[i]; jrowUpper[i]) { if (rowActivity[i]>rowUpper[i]+1000.0*primalTolerance) { feasible=false; #if CBC_USEFUL_PRINTING printf("Bad row %d %g <= %g <= %g\n", i,rowLower[i],rowActivity[i],rowUpper[i]); #endif } rowActivity[i]=rowUpper[i]; } } assert (feasible); } #endif { int numberFixed=0; int numberColumns = model->getNumCols(); const double * columnLower = model->getColLower(); const double * columnUpper = model->getColUpper(); int iColumn; for (iColumn=0;iColumn2000&&numberFixednumberColumns) { model->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry); } } model->setHintParam(OsiDoDualInInitial, true, OsiHintTry); model->initialSolve(); numberIterationsPost_ += model->getIterationCount(); if (!model->isProvenOptimal()) { // try without basis CoinWarmStartBasis * basis = dynamic_cast (model->getEmptyWarmStart()); model->setWarmStart(basis); delete basis; model->initialSolve(); } if (!model->isProvenOptimal()) { #if CBC_USEFUL_PRINTING>1 whichMps++; sprintf(nameMps,"bad2_%d",whichMps); model->writeMps(nameMps); printf("Mps file %s saved in %s at line %d\n", nameMps,__FILE__,__LINE__); printf("bad unwind in postprocess\n"); OsiSolverInterface * temp = model->clone(); temp->setDblParam(OsiDualObjectiveLimit,1.0e30); temp->setHintParam(OsiDoReducePrint,false,OsiHintTry); temp->initialSolve(); if (temp->isProvenOptimal()) { printf("Was infeasible on objective limit\n"); } delete temp; #endif } else { #if COIN_DEVELOP>1 whichMps++; sprintf(nameMps,"good2_%d",whichMps); model->writeMps(nameMps); printf("Mps file %s saved in %s at line %d\n", nameMps,__FILE__,__LINE__); #endif } const int * originalColumns = presolve_[iPass]->originalColumns(); const double * columnLower = modelM->getColLower(); const double * columnUpper = modelM->getColUpper(); OsiSolverInterface * modelM2; if (iPass) modelM2 = modifiedModel_[iPass-1]; else modelM2 = startModel_; const double * solutionM2 = modelM2->getColSolution(); const double * columnLower2 = modelM2->getColLower(); const double * columnUpper2 = modelM2->getColUpper(); double primalTolerance; modelM->getDblParam(OsiPrimalTolerance,primalTolerance); /* clean up status for any bound alterations made by preprocess which postsolve won't understand. Could move inside OsiPresolve but some people might object */ CoinWarmStartBasis *presolvedBasis = dynamic_cast(model->getWarmStart()) ; assert (presolvedBasis); int numberChanged=0; // Have to use free as superBasic does not exist for (iColumn=0;iColumngetStructStatus(iColumn)) { case CoinWarmStartBasis::basic: case CoinWarmStartBasis::isFree: break; case CoinWarmStartBasis::atLowerBound: if (solutionM[iColumn]>columnLower2[jColumn]+primalTolerance) { presolvedBasis->setStructStatus(iColumn,CoinWarmStartBasis::isFree); numberChanged++; } break; case CoinWarmStartBasis::atUpperBound: if (solutionM[iColumn]setStructStatus(iColumn,CoinWarmStartBasis::isFree); numberChanged++; } break; } } if (numberChanged) model->setWarmStart(presolvedBasis); delete presolvedBasis; presolve_[iPass]->postsolve(true); // and fix values for (iColumn=0;iColumnisInteger(jColumn)) { if (columnUpper[iColumn]==columnLower[iColumn]) { if (columnUpper2[jColumn]>columnLower2[jColumn]&&!modelM2->isInteger(jColumn)) { double value = solutionM[iColumn]; value = CoinMax(value,columnLower[iColumn]); value = CoinMin(value,columnUpper[iColumn]); #if CBC_USEFUL_PRINTING>1 printf ("assuming %d fixed to solution of %g (was %g) - bounds %g %g, old bounds and sol %g %g\n", jColumn,value,solutionM2[jColumn],columnLower2[jColumn],columnUpper2[jColumn], columnLower[iColumn],columnUpper[iColumn]); #endif modelM2->setColUpper(jColumn,value); } } else { #if CBC_USEFUL_PRINTING if (columnUpper2[jColumn]>columnLower2[jColumn]&&!modelM2->isInteger(jColumn)) { double value = solutionM[iColumn]; value = CoinMax(value,columnLower[iColumn]); value = CoinMin(value,columnUpper[iColumn]); printf ("assuming %d not fixed to solution of %g (was %g) - bounds %g %g, old bounds and sol %g %g\n", jColumn,value,solutionM2[jColumn],columnLower2[jColumn],columnUpper2[jColumn], columnLower[iColumn],columnUpper[iColumn]); } #endif } } else { // integer - dupcol bounds may be odd so use solution double value = floor(solutionM2[jColumn]+0.5); if (valuesetColLower(jColumn,value); } else if (value>columnUpper2[jColumn]) { //printf("changing upper bound for %d from %g to %g to allow feasibility\n", // jColumn,columnUpper2[jColumn],value); modelM2->setColUpper(jColumn,value); } } } if (deleteStuff) { delete modifiedModel_[iPass];; delete model_[iPass];; delete presolve_[iPass]; modifiedModel_[iPass]=NULL; model_[iPass]=NULL; presolve_[iPass]=NULL; } modelM = modelM2; } // should be back to startModel_; OsiSolverInterface * model = originalModel_; // Use number of columns in original int numberColumns = model->getNumCols(); const double * solutionM = modelM->getColSolution(); int iColumn; const double * columnLower2 = model->getColLower(); const double * columnUpper2 = model->getColUpper(); const double * columnLower = modelM->getColLower(); const double * columnUpper = modelM->getColUpper(); int numberBadValues = 0; CoinWarmStartBasis* basis = dynamic_cast (modelM->getWarmStart()) ; if (basis) { model->setWarmStart(basis); delete basis; } for (iColumn=0;iColumnisInteger(iColumn)) { double value = solutionM[iColumn]; double value2 = floor(value+0.5); // if test fails then empty integer if (fabs(value-value2)<1.0e-3) { value2 = CoinMax(CoinMin(value2,columnUpper[iColumn]),columnLower[iColumn]); model->setColLower(iColumn,value2); model->setColUpper(iColumn,value2); } else { #if CBC_USEFUL_PRINTING>1 printf("NPASS=%d, ipass end var %d values %g %g %g\n", numberSolvers_,iColumn,model->getColLower()[iColumn], value,model->getColUpper()[iColumn]); #endif numberBadValues++; } } else if (columnUpper[iColumn]==columnLower[iColumn]) { if (columnUpper2[iColumn]>columnLower2[iColumn]&&!model->isInteger(iColumn)) { model->setColUpper(iColumn,columnLower[iColumn]); } } } if(numberBadValues) { const CoinPackedMatrix * columnCopy = model->getMatrixByCol(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); const double * element = columnCopy->getElements(); int numberRows = model->getNumRows(); double * rowActivity = new double[numberRows]; memset(rowActivity,0,numberRows*sizeof(double)); double * solution = CoinCopyOfArray(solutionM,numberColumns); for ( iColumn=0;iColumnisInteger(iColumn)) { double value2 = floor(value+0.5); // if test fails then empty integer if (fabs(value-value2)<1.0e-3) value = value2; } solution[iColumn] = value; for (CoinBigIndex j=columnStart[iColumn]; jgetRowLower(); const double * rowUpper = model->getRowUpper(); //const double * columnLower = model->getColLower(); //const double * columnUpper = model->getColUpper(); const double * objective = model->getObjCoefficients(); double direction = model->getObjSense(); int numberCheck=0; double tolerance; model->getDblParam(OsiPrimalTolerance,tolerance); tolerance *= 10.0; for ( iColumn=0;iColumnisInteger(iColumn)) { double value2 = floor(value); // See if empty integer if (value!=value2) { numberCheck++; int allowed=0; // can we go up double movement = value2+1.0-value; CoinBigIndex j; bool good=true; for (j=columnStart[iColumn]; j1 if (rowLower[iRow]>-1.0e20&&rowUpper[iRow]<1.0e20) printf("odd row with both bounds %d %g %g - element %g\n", iRow,rowLower[iRow],rowUpper[iRow],element[j]); #endif double newActivity = rowActivity[iRow] + movement*element[j]; if (newActivity>rowUpper[iRow]+tolerance|| newActivityrowUpper[iRow]+tolerance|| newActivity0.0) allowed=2; else allowed=1; } if(allowed==1) value2++; movement = value2-value; solution[iColumn]=value2; model->setColLower(iColumn,value2); model->setColUpper(iColumn,value2); for (j=columnStart[iColumn]; j1 printf("Unable to move %d\n",iColumn); #endif } } } } assert (numberCheck==numberBadValues); model->setColSolution(solution); delete [] rowActivity; delete [] solution; } } else { // infeasible for (int iPass=numberSolvers_-1;iPass>=0;iPass--) { delete modifiedModel_[iPass];; delete model_[iPass];; delete presolve_[iPass]; modifiedModel_[iPass]=NULL; model_[iPass]=NULL; presolve_[iPass]=NULL; } // Back to startModel_; OsiSolverInterface * model = originalModel_; // Use number of columns in original int numberColumns = model->getNumCols(); const double * columnLower = model->getColLower(); int iColumn; for (iColumn=0;iColumnisInteger(iColumn)) model->setColUpper(iColumn,columnLower[iColumn]); } } delete clonedCopy; originalModel_->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry); originalModel_->setHintParam(OsiDoDualInInitial,false,OsiHintTry); { int numberFixed=0; int numberColumns = originalModel_->getNumCols(); const double * columnLower = originalModel_->getColLower(); const double * columnUpper = originalModel_->getColUpper(); int iColumn; for (iColumn=0;iColumninitialSolve(); //printf("Time with basis %g seconds, %d iterations\n",CoinCpuTime()-time1,originalModel_->getIterationCount()); if (numberColumns<10000||numberFixed==numberColumns) { CoinWarmStart * empty = originalModel_->getEmptyWarmStart(); originalModel_->setWarmStart(empty); delete empty; } } //double time1 = CoinCpuTime(); originalModel_->initialSolve(); numberIterationsPost_ += originalModel_->getIterationCount(); //printf("Time without basis %g seconds, %d iterations\n",CoinCpuTime()-time1,originalModel_->getIterationCount()); double objectiveValue = originalModel_->getObjValue(); double testObj = 1.0e-8*CoinMax(fabs(saveObjectiveValue), fabs(objectiveValue))+1.0e-4; if (!originalModel_->isProvenOptimal()) { #if CBC_USEFUL_PRINTING>1 whichMps++; sprintf(nameMps,"bad3_%d",whichMps); originalModel_->writeMps(nameMps); printf("Mps file %s saved in %s at line %d\n", nameMps,__FILE__,__LINE__); printf("bad end unwind in postprocess\n"); #endif handler_->message(CGL_POST_INFEASIBLE,messages_) <testObj &&deleteStuff ) { handler_->message(CGL_POST_CHANGED,messages_) <setHintParam(OsiDoDualInInitial,saveHint2,saveStrength2); originalModel_->setHintParam(OsiDoPresolveInInitial,saveHint,saveStrength); } //------------------------------------------------------------------- // Returns the greatest common denominator of two // positive integers, a and b, found using Euclid's algorithm //------------------------------------------------------------------- static int gcd(int a, int b) { int remainder = -1; // make sure a<=b (will always remain so) if(a > b) { // Swap a and b int temp = a; a = b; b = temp; } // if zero then gcd is nonzero (zero may occur in rhs of packed) if (!a) { if (b) { return b; } else { printf("**** gcd given two zeros!!\n"); abort(); } } while (remainder) { remainder = b % a; b = a; a = remainder; } return b; } #define CGL_PREPROCESS_DENSE_CODE #define F77_FUNC(x,y) x##_ /* Type of Fortran integer translated into C */ #ifndef ipfint //typedef ipfint FORTRAN_INTEGER_TYPE ; typedef int ipfint; typedef const int cipfint; #endif //#define COIN_HAS_LAPACK //#include "CoinFactorization.hpp" #ifdef CGL_PREPROCESS_DENSE_CODE // using simple lapack interface extern "C" { /** LAPACK Fortran subroutine DGETRF. */ void F77_FUNC(dgetrf,DGETRF)(ipfint * m, ipfint *n, double *A, ipfint *ldA, ipfint * ipiv, ipfint *info); /** LAPACK Fortran subroutine DGETRS. */ void F77_FUNC(dgetrs,DGETRS)(char *trans, cipfint *n, cipfint *nrhs, const double *A, cipfint *ldA, cipfint * ipiv, double *B, cipfint *ldB, ipfint *info, int trans_len); } #endif /* Return model with useful modifications. If constraints true then adds any x+y=1 or x-y=0 constraints If NULL infeasible */ OsiSolverInterface * CglPreProcess::modified(OsiSolverInterface * model, bool constraints, int & numberChanges, int iBigPass, int numberPasses) { OsiSolverInterface * newModel = model->clone(); int numberRows = newModel->getNumRows(); CglUniqueRowCuts twoCuts(numberRows); int numberColumns = newModel->getNumCols(); int number01Integers=0; int iColumn; for (iColumn=0;iColumnisBinary(iColumn)) number01Integers++; } #if CBC_USEFUL_PRINTING>0 printf("At beginning of modified %d rows and %d columns (pass %d - doing %d minor passes)\n", numberRows,numberColumns,iBigPass,numberPasses); #endif OsiRowCut ** whichCut = new OsiRowCut * [numberRows+1]; memset(whichCut, 0, (numberRows+1)*sizeof(OsiRowCut *)); numberChanges=0; CoinThreadRandom randomGenerator; CglTreeProbingInfo info(model); info.level = 0; info.pass = 0; info.formulation_rows = numberRows; info.inTree = false; info.options = !numberProhibited_ ? 0 : 2; info.randomNumberGenerator=&randomGenerator; info.strengthenRow= whichCut; #ifdef HEAVY_PROBING // See if user asked for heavy probing bool heavyProbing=false; for (int iGenerator=0;iGenerator (generator_[iGenerator]); if (probingCut&&probingCut->getMaxPassRoot()>1) { heavyProbing=true; break; } } #endif bool feasible=true; int firstGenerator=0; int lastGenerator=numberCutGenerators_; bool useSolution=getCutoff()<1.0e20; #if 1 // Do triple stuff if (iBigPass==0) { // Row copy CoinPackedMatrix matrixByRow(*newModel->getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); // Column copy CoinPackedMatrix matrixByCol(*newModel->getMatrixByCol()); //const double * element = matrixByCol.getElements(); const int * row = matrixByCol.getIndices(); const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol.getVectorLengths(); const double * rowLower = newModel->getRowLower(); const double * rowUpper = newModel->getRowUpper(); const double * columnLower = newModel->getColLower(); const double * columnUpper = newModel->getColUpper(); #define TRIPLE_ROWS 4 #define TRIPLE_COLS 3 // just allow TRIPLE_ROWS rows double el[TRIPLE_COLS][2*TRIPLE_ROWS]; double rhs[2*TRIPLE_ROWS],lower[TRIPLE_ROWS],upper[TRIPLE_ROWS]; double modifiedRhs[2*TRIPLE_ROWS],scaleFactor[2*TRIPLE_ROWS]; memset(modifiedRhs,0,sizeof(modifiedRhs)); memset(scaleFactor,0,sizeof(scaleFactor)); int rowNumber[2*TRIPLE_ROWS]; double colLower[TRIPLE_COLS],colUpper[TRIPLE_COLS]; #if CBC_USEFUL_PRINTING>0 int binary[TRIPLE_COLS]; int colNumber[TRIPLE_COLS]; #endif unsigned char result[2*TRIPLE_ROWS][2*TRIPLE_ROWS]; int rowType[2*TRIPLE_ROWS]; #define MAX_ELS 20 #define MAX_LOOK_ROWS 40 #define MAX_LOOK_COLS 32 // for more go to long unsigned int bitMask[MAX_LOOK_ROWS]; int * which = new int [2*numberColumns+3*numberRows+ MAX_LOOK_ROWS+MAX_LOOK_COLS]; int * marked = which+MAX_LOOK_COLS; int * whichRow = marked+numberColumns; int * markRow = whichRow+MAX_LOOK_ROWS; int * backwardRow = markRow+numberRows; int * backwardColumn = backwardRow+numberRows; int * rowTypeAll = backwardColumn+numberColumns; memset(marked,0,numberColumns*sizeof(int)); memset(markRow,0,numberRows*sizeof(int)); for (int iRow=0;iRow-1.0e30) { if (rowUpper[iRow]<1.0e30) { type=2; } else { type=1; } } else { if (rowUpper[iRow]<1.0e30) { type=2; } else { type=0; } } } else { type=3; } if (rowType_&&rowType_[iRow]) type=0; // not allowed if may be cut rowTypeAll[iRow]=type; } // clean model for (int iColumn=0;iColumnisInteger(iColumn)) { double lower = columnLower[iColumn]; double upper = columnUpper[iColumn]; double saveLower=lower; double saveUpper=upper; if (lower!=ceil(lower)) { if (fabs(lower-floor(lower+0.5))<1.0e-6) lower = floor(lower+0.5); else lower = ceil(lower); newModel->setColLower(iColumn,lower); } if (upper!=floor(upper)) { if (fabs(upper-floor(upper+0.5))<1.0e-6) upper = floor(upper+0.5); else upper = floor(upper); newModel->setColUpper(iColumn,upper); } if (lower>upper) { char generalPrint[100]; sprintf(generalPrint,"%d input bounds %g %g", iColumn,saveLower,saveUpper); handler_->message(CGL_GENERAL, messages_) << generalPrint << CoinMessageEol; handler_->message(CGL_INFEASIBLE,messages_) <0 int nFreed=0; #endif for (int iColumn=0;iColumnisInteger(iColumn) && columnLength[iColumn]<=MAX_ELS && columnLength[iColumn]>1&&columnLower[iColumn]==0.0&& columnUpper[iColumn]==1.0) { int nMarked=0; backwardColumn[iColumn]=0; marked[iColumn]=1; which[nMarked++]=iColumn; int nMarkRow = 0; for (CoinBigIndex j=columnStart[iColumn]; j>1; } mask=bitMask[iLook]; for (int jLook=iLook+1;jLook0 printf("For column %d %d matches on size %d\n", iColumn,nMatch,nBits); if (nMatch>1) { printf("WHAT NOW\n"); } #endif // Pad out here int jColumn1=-1,jColumn2=-1; int iRow1=whichRow[iLook]; int iRow2=-1; for (int jLook=iLook+1;jLook0 binary[0]=1; int nCol=nBits; #endif assert (rowLength[iRow1]<=3); int nRow=2; for (int j=0;j<2;j++) { int iRow=rowNumber[j]; lower[j]=rowLower[iRow]; upper[j]=rowUpper[iRow]; for (CoinBigIndex k=rowStart[iRow]; k0 binary[1]=0; if (!colLower[1]&&colUpper[1]==1.0&&newModel->isInteger(kColumn)) binary[1]=1; #endif } else if (jColumn2<0) { jColumn2=kColumn; el[2][j]=elementByRow[k]; colLower[2]=columnLower[kColumn]; colUpper[2]=columnUpper[kColumn]; #if CBC_USEFUL_PRINTING>0 binary[2]=0; if (!colLower[2]&&colUpper[2]==1.0&&newModel->isInteger(kColumn)) binary[2]=1; #endif } else { abort(); } } } if (jColumn1<0) { #if CBC_USEFUL_PRINTING>0 printf("**Why jColumn1 negative\n"); #endif continue; } #if CBC_USEFUL_PRINTING>0 colNumber[0]=iColumn; colNumber[1]=jColumn1; colNumber[2]=jColumn2; #endif // do something assert (columnLower[iColumn]==0.0); assert (columnUpper[iColumn]==1.0); if (nBits==2) { #if CBC_USEFUL_PRINTING>0 printf("iColumn %d %g %g binary\n",iColumn,colLower[0], colUpper[0]); printf("jColumn1 %d %g %g %s\n",jColumn1,colLower[1], colUpper[1],newModel->isInteger(jColumn1) ? "integer" : "continuous"); for (int i=0;i<2;i++) { printf("%d row %d %g <= %g*x0%s%g*x1 <= %g\n", i,rowNumber[i],lower[i],el[0][i], el[1][i]>0.0 ? " +" : " -",fabs(el[1][i]),upper[i]); } #endif double lower1[2],upper1[2]; lower1[0]=lower1[1]=colLower[1]; upper1[0]=upper1[1]=colUpper[1]; double l,u; // binary at 0 l=lower[0]; u=upper[0]; if (el[1][0]>0.0) { lower1[0]=CoinMax(lower1[0],l/el[1][0]); upper1[0]=CoinMin(upper1[0],u/el[1][0]); } else { lower1[0]=CoinMax(lower1[0],u/el[1][0]); upper1[0]=CoinMin(upper1[0],l/el[1][0]); } l=lower[1]; u=upper[1]; if (el[1][1]>0.0) { lower1[0]=CoinMax(lower1[0],l/el[1][1]); upper1[0]=CoinMin(upper1[0],u/el[1][1]); } else { lower1[0]=CoinMax(lower1[0],u/el[1][1]); upper1[0]=CoinMin(upper1[0],l/el[1][1]); } l=lower[0]-el[0][0]; u=upper[0]-el[0][0]; if (el[1][0]>0.0) { lower1[1]=CoinMax(lower1[1],l/el[1][0]); upper1[1]=CoinMin(upper1[1],u/el[1][0]); } else { lower1[1]=CoinMax(lower1[1],u/el[1][0]); upper1[1]=CoinMin(upper1[1],l/el[1][0]); } l=lower[1]-el[0][1]; u=upper[1]-el[0][1]; if (el[1][1]>0.0) { lower1[1]=CoinMax(lower1[1],l/el[1][1]); upper1[1]=CoinMin(upper1[1],u/el[1][1]); } else { lower1[1]=CoinMax(lower1[1],u/el[1][1]); upper1[1]=CoinMin(upper1[1],l/el[1][1]); } if (CoinMin(lower1[0],lower1[1])>colLower[1]) { #if CBC_USEFUL_PRINTING>0 printf("for jColumn1 0-bounds %g,%g 1-bounds %g,%g\n", lower1[0],upper1[0],lower1[1],upper1[1]); #endif double value = CoinMin(lower1[0],lower1[1]); if (newModel->isInteger(jColumn1)) value = ceil(value-1.0e-5); #if CBC_USEFUL_PRINTING>0 printf("increasing lb on %d from %g to %g\n", jColumn1,colLower[1],value); #endif colLower[1]=value; newModel->setColLower(jColumn1,value); } if (CoinMax(upper1[0],upper1[1])0 printf("for jColumn1 0-bounds %g,%g 1-bounds %g,%g\n", lower1[0],upper1[0],lower1[1],upper1[1]); #endif double value = CoinMax(upper1[0],upper1[1]); if (newModel->isInteger(jColumn1)) value = floor(value+1.0e-5); #if CBC_USEFUL_PRINTING>0 printf("decreasing ub on %d from %g to %g\n", jColumn1,colUpper[1],value); #endif colUpper[1]=value; newModel->setColUpper(jColumn1,value); } if (lower1[0]>colUpper[1] || upper1[0]0 printf("for jColumn1 0-bounds %g,%g 1-bounds %g,%g\n", lower1[0],upper1[0],lower1[1],upper1[1]); printf("fixing %d to 1\n",iColumn); #endif colLower[0]=1.0; newModel->setColLower(iColumn,1.0); nMarkRow=0; // stop looking } if (lower1[1]>colUpper[1] || upper1[1]0 printf("for jColumn1 0-bounds %g,%g 1-bounds %g,%g\n", lower1[0],upper1[0],lower1[1],upper1[1]); printf("fixing %d to 0\n",iColumn); #endif colUpper[0]=0.0; newModel->setColLower(iColumn,0.0); nMarkRow=0; // stop looking } if (colLower[0]>colUpper[0]|| colLower[1]>colUpper[1]+1.0e-6) { #if CBC_USEFUL_PRINTING>0 printf("** infeasible\n"); #endif feasible = false; } } else { #if CBC_USEFUL_PRINTING>0 printf("iColumn %d %g %g binary\n",iColumn,colLower[0], colUpper[0]); printf("jColumn1 %d %g %g %s\n",jColumn1,colLower[1], colUpper[1],newModel->isInteger(jColumn1) ? "integer" : "continuous"); printf("jColumn2 %d %g %g %s\n",jColumn2,colLower[2], colUpper[2],newModel->isInteger(jColumn2) ? "integer" : "continuous"); for (int i=0;i<2;i++) { printf("%d row %d %g <= %g*x0%s%g*x1%s%g*x2 <= %g\n", i,rowNumber[i],lower[i],el[0][i], el[1][i]>0.0 ? " +" : " -",fabs(el[1][i]), el[2][i]>0.0 ? " +" : " -",fabs(el[2][i]),upper[i]); } #endif // Find other doubleton rows for (CoinBigIndex j1=columnStart[jColumn1]; j10 printf("%d row %d %g <= %g*x0%s%g*x1%s%g*x2 <= %g\n", nRow,iRow,lower[nRow],el[0][nRow], el[1][nRow]>0.0 ? " +" : " -",fabs(el[1][nRow]), el[2][nRow]>0.0 ? " +" : " -",fabs(el[2][nRow]),upper[nRow]); #endif nRow++; if (nRow==TRIPLE_ROWS) break; } } } } // Now put in <= form int nLook = nRow; // types 1 <=, -1 >= 2 first ==, -2 second ==, 3 <= from range, -3 >= from range for (int i=0;i1.0e20) { rowType[i]=-1; rhs[i]=-lower[i]; for (int j=0;jmodifiedRhs[k2]+1.0e-7) { stronger=0; } else if (modifiedRhs[k1]>modifiedRhs[k2]-1.0e-7) { stronger=4; } if (stronger) { int strongerEl=2; for (int k3=1;k3(stronger <<(4*j)); } } } } } int dropped=-1; for (int k1=0;k1>4; if (state0&&state1) { if (state0==5) { if (state1==5) { // same if (abs(rowType[k1])==1) dropped=k1; else dropped=k2; #if CBC_USEFUL_PRINTING>0 printf("ZZZsame "); #endif } else if (state1==9) { // drop second dropped=k2; #if CBC_USEFUL_PRINTING>0 printf("ZZZfirst "); #endif } else { #if CBC_USEFUL_PRINTING>0 printf("ZZYY "); #endif } } else if (state0==9) { // drop second dropped=k2; #if CBC_USEFUL_PRINTING>0 printf("ZZZsecond "); #endif } else { #if CBC_USEFUL_PRINTING>0 printf("ZZYY "); #endif } #if CBC_USEFUL_PRINTING>0 printf("row %d (%d) and row %d (%d) status at 0 is %d status at 1 is %d\n", k1,rowNumber[k1],k2,rowNumber[k2], state0,state1); #endif if (dropped>=0) break; } } } if (dropped>=0) break; } if (dropped>=0) { int iRow=rowNumber[dropped]; // Think if ranged or == if (rowLower[iRow]<-1.0e30||rowUpper[iRow]>1.0e30) { newModel->setRowLower(iRow,-COIN_DBL_MAX); newModel->setRowUpper(iRow,COIN_DBL_MAX); #if CBC_USEFUL_PRINTING>0 nFreed++; #endif } else { #if CBC_USEFUL_PRINTING>0 printf("XXXYYY - shouldn't drop ranged/equality row????\n"); #endif } } // stop rest for (int jLook=iLook;jLook0 if(nFreed) printf("%d rows freed up\n",nFreed); #endif delete [] which; } #endif #if 0 // Do domination stuff if (iBigPass==0) { // Row copy CoinPackedMatrix matrixByRow(*newModel->getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); // Column copy CoinPackedMatrix matrixByCol(*newModel->getMatrixByCol()); //const double * element = matrixByCol.getElements(); const int * row = matrixByCol.getIndices(); const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol.getVectorLengths(); const double * rowLower = newModel->getRowLower(); const double * rowUpper = newModel->getRowUpper(); const double * columnLower = newModel->getColLower(); const double * columnUpper = newModel->getColUpper(); // get sizes for canonical form (overestimate if free columns) int nRows=numberRows; CoinBigIndex nEls=matrixByRow.getNumElements(); for (int iRow=0;iRow-1.0e30&&rowUpper[iRow]<1.0e30) { nRows++; nEls += rowLength[iRow]; } } int * rowNumber = new int[3*nRows+numberColumns]; int * rowBinary = rowNumber+nRows; int * rowPos = rowBinary+nRows; int * whichColumn = rowPos+nRows; double * elementByRow2 = new double [nEls+numberColumns+nRows]; double * columnValue = elementByRow2+nEls; double * rhs = columnValue+numberColumns; int * column2 = new int [nEls]; CoinBigIndex * rowStart2 = new CoinBigIndex[nRows+1]; char * marked = new char [numberColumns+nRows]; char * markedRow = marked + numberColumns; for (int iColumn=0;iColumn1.0e10) { marked[iColumn]=-1; } else if (fabs(columnUpper[iColumn])isInteger(iColumn) && columnUpper[iColumn]==columnLower[iColumn]+1) marked[iColumn]=3; } else { marked[iColumn]=0; columnValue[iColumn]=columnLower[iColumn]; if (newModel->isInteger(iColumn) && columnUpper[iColumn]==columnLower[iColumn]+1) marked[iColumn]=1; } } nRows=0; nEls=0; rowStart2[0]=0; for (int iRow=0;iRow0.0) nPos++; largest=CoinMax(fabs(value),largest); smallest=CoinMin(fabs(value),smallest); column2[nEls++]=kColumn; } if (typeRow>=0 && smallest*1.0e7>largest) { double scale = sqrt(largest*smallest); if (fabs(rhsValue)>1.0e6*scale|| (rhsValue&&fabs(rhsValue)<1.0e-6*scale)) { scale=0.0; } else if (rhsValue) { scale=1.0/fabs(rhsValue); } if (scale) { rhs[nRows]=scale*rhsValue; for (CoinBigIndex k=rowStart2[nRows];k3) nInt=0; // for first try ignore integers! nInt=0; if (nInt) { } else { for (int jRow=iRow+1;jRow3) nInt2=0; // for first try ignore integers! nInt2=0; if (nInt2) { } else { // continuous tests // -1 iRow may be stronger, +1 jRow may be stronger, 0 continue, 2 == els int way=2; if (rhsValue>rhsValue2+tolerance) way=1; else if (rhsValue2>rhsValue+tolerance) way=-1; if (nNeg2>nNeg) { // iRow can be stronger if (nPos2>nPos || way == 1) way=0; else way=-1; } else if (nNeg2==nNeg) { // iRow can be either way if (nPos2>nPos) { if (way!=-1) way=1; else way=0; } else if (nPos2valueI+1.0e-12) { way=0; break; } else { if (valueI<0.0) nHitNeg++; } } if (nHitNeg0.0) nHitPos++; } } if (nHitPoscolumnValue[kColumn]+1.0e-12) { way=1; break; } } k2++; if (way==1) { for (;k20.0) nHitPos++; } } if (nHitPosvalueI+1.0e-12) { way=0; break; } else { if (valueI<0.0) nHitNeg++; } } if (nHitNeggetNumRows(),newModel->getNumRows()); #endif if (temp->getNumRows()getNumRows()) { numberChangedThisPass += newModel->getNumRows()-temp->getNumRows(); delete newModel; newModel = temp; numberRows = newModel->getNumRows(); } else { delete temp; } } else { #if CBC_USEFUL_PRINTING printf("bigpass %d pass %d no more cliques %d rows\n", iBigPass,iPass,newModel->getNumRows()); #endif } } #endif /* needResolve solution is stale rebuilt constraint system deleted and recreated (implies initialSolve) */ for (int iGenerator=firstGenerator;iGenerator=0) { //char name[20]; //sprintf(name,"prex%2.2d.mps",iGenerator); //newModel->writeMpsNative(name, NULL, NULL,0,1,0); // refresh as model may have changed generator_[iGenerator]->refreshSolver(newModel); // skip duplicate rows except once dupRow = dynamic_cast (generator_[iGenerator]); cliqueGen = dynamic_cast (generator_[iGenerator]); if (cliqueGen&&iPass) continue; if (dupRow&&(iPass||iBigPass)) continue; probingCut = dynamic_cast (generator_[iGenerator]); #if CBC_USEFUL_PRINTING>0 double time1 = CoinCpuTime(); #endif if (!probingCut) { generator_[iGenerator]->generateCuts(*newModel,cs,info); } else { info.options=64; probingCut->setMode(useSolution ? 4 : 4|64); int saveMaxElements = probingCut->getMaxElementsRoot(); int saveMaxProbe = probingCut->getMaxProbeRoot(); int saveMaxLook = probingCut->getMaxLookRoot(); if (!iBigPass&&!iPass&&(options_&(16|64))!=0) { noStrengthening = true; numberPasses=1; probingCut->setMaxProbeRoot(CoinMax(saveMaxProbe,1000)); probingCut->setMaxElementsRoot(CoinMax(saveMaxElements,2000)); probingCut->setMaxLookRoot(CoinMax(saveMaxLook, CoinMin(numberColumns,numberRows))/2); options_ &= ~16; } else if (iPass||(options_&64)==0) { // cut back probingCut->setMaxElementsRoot(probingCut->getMaxElements()); probingCut->setMaxProbeRoot(probingCut->getMaxProbe()); probingCut->setMaxLookRoot(probingCut->getMaxLook()); } probingCut->generateCutsAndModify(*newModel,cs,&info); probingCut->setMaxElementsRoot(saveMaxElements); probingCut->setMaxProbeRoot(saveMaxProbe); probingCut->setMaxLookRoot(saveMaxLook); if (!iPass&&(!cs.sizeColCuts()||iBigPass>2)) options_ &= ~64; // switch off heavy } #if CBC_USEFUL_PRINTING>0 printf("Generator %d took %g seconds\n", iGenerator,CoinCpuTime()-time1); printf("After probing1 %d row cuts and %d column cuts\n", cs.sizeRowCuts(),cs.sizeColCuts()); #endif if (cs.sizeColCuts()&&iPass=0;i--) cs.eraseRowCut(i); for (int i=0;inumberOriginalRows(); duplicate = dupRow->duplicate(); if (cs.sizeRowCuts()) { // add to twoCuts (may be more, but ....) int numberRowCuts = cs.sizeRowCuts() ; for (int k = 0;kclone(); numberRows=copySolver->getNumRows(); copySolver->applyCuts(cs); //static int kk=0; //char name[20]; //kk++; //sprintf(name,"matrix%d",kk); //printf("writing matrix %s\n",name); //copySolver->writeMps(name); CglDuplicateRow dupCuts(copySolver); dupCuts.setMode(8); OsiCuts cs2; dupCuts.generateCuts(*copySolver,cs2,info); #if CBC_USEFUL_PRINTING>0 printf("After probing dupCuts %d row cuts and %d column cuts\n", cs2.sizeRowCuts(),cs2.sizeColCuts()); #endif // -1 not used, -2 delete, -3 not clique const int * duplicate = dupCuts.duplicate(); // -1 not used, >=0 earliest row affected const int * used = duplicate+numberRows+n; int numberDrop=0; int * drop = new int[numberRows]; for (int iRow=0;iRow=numberRows;iRow--) { #if 1 int earliest = used[iRow]; while (earliest>=numberRows) { if (duplicate[earliest]==-2) earliest = used[earliest]; else break; } #else int earliest=0; #endif if (duplicate[iRow]==-2||earliest==-1||earliest>=numberRows) { cs.eraseRowCut(iRow-numberRows); nOther++; } } n -= nOther; int newNumberRows = numberRows-numberDrop+n; bool special = (cliqueGen->getMinViolation()==-3.0); #if CBC_USEFUL_PRINTING printf("could drop %d rows - current nrows %d other %d - new nrows %d\n", numberDrop,numberRows,nOther,newNumberRows); #endif if (n<=numberDrop||special) { #if CBC_USEFUL_PRINTING printf("Dropping rows current nrows %d - new nrows %d\n", numberRows,newNumberRows); #endif if (newNumberRows>numberRows) { // need new array delete [] whichCut; whichCut = new OsiRowCut * [newNumberRows+1]; CoinZeroN(whichCut,newNumberRows); info.strengthenRow= whichCut; } newModel->deleteRows(numberDrop,drop); // may be able to delete some added cliques newModel->applyCuts(cs); numberRows=newModel->getNumRows(); newModel->resolve(); #if 0 int numberRows2=copySolver->getNumRows(); const double * rowLower = copySolver->getRowLower(); const double * rowUpper = copySolver->getRowUpper(); const CoinPackedMatrix * matrixByRow = copySolver->getMatrixByRow(); // Row copy const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); const double * solution = newModel->getColSolution(); for (int iRow=0;iRowrowLower[iRow]-1.0e-4&&sumgetNumCols()); } // out for now - think about cliques if(!generator1.snapshot(*newModel,NULL,false)) { generator1.createCliques(*newModel,2,1000); // To get special stuff info.pass=4; CoinZeroN(whichCut,numberRows); generator1.setMode(16+4); generator1.generateCutsAndModify(*newModel,cs,&info); #if CBC_USEFUL_PRINTING>0 printf("After probing clique stuff %d row cuts and %d column cuts\n", cs.sizeRowCuts(),cs.sizeColCuts()); #endif // can we extend cliques? // make fake model OsiSolverInterface * fakeModel = generator1.cliqueModel(newModel,1); // if above added rows then take out duplicates OsiSolverInterface * fakeModel2 = cliqueIt(*fakeModel,0.0); delete fakeModel; //delete fakeModel2; delete newModel; newModel=fakeModel2; #ifdef CLIQUE_ANALYSIS printf("special probing\n"); info.analyze(*newModel); #endif } else { feasible=false; } #endif } // check changes // first are any rows strengthened by cuts int iRow; for (iRow=0;iRow=0) { numberDrop++; newModel->setRowBounds(iRow,-COIN_DBL_MAX,COIN_DBL_MAX); } } const double * columnLower = newModel->getColLower(); const double * columnUpper = newModel->getColUpper(); if ((numberStrengthened||numberDrop)&&feasible) { /* Deleting all rows and rebuilding invalidates everything, initialSolve will be required. */ if (useSolution) needResolve = true ; rebuilt = true ; // Easier to recreate entire matrix const CoinPackedMatrix * rowCopy = newModel->getMatrixByRow(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * rowElements = rowCopy->getElements(); const double * rowLower = newModel->getRowLower(); const double * rowUpper = newModel->getRowUpper(); CoinBuild build; // For basis char * keepRow = new char [numberRows]; for (iRow=0;iRow-1.0e20||rowUpper[iRow]<1.0e20) { #if 0 if (thisCut) { double * allColumns = new double[numberColumns]; int which[]={0,8,11,19,21,29,30,38,42,61,77,90,104,105,7,37}; memset(allColumns,0,numberColumns*sizeof(double)); for (int k=0;klb(); double ub = thisCut->ub(); CoinPackedVector row = thisCut->row(); printf("Cut on row %d - %g <= ",iRow,lb); bool feas1=true; double sum1=0.0; for (int k = 0; k < row.getNumElements(); ++k) { CoinBigIndex j = row.getIndices()[k]; double value = row.getElements()[k]; printf("(%d,%g) ",j,value); sum1 += value*allColumns[j]; } if (sum1ub+1.0e-3) { printf(" ******** "); feas1 = false; } printf("<= %g\n",ub); printf("Old row %g <= ",rowLower[iRow]); bool feas2=true; double sum2=0.0; int start=rowStart[iRow]; int end = start + rowLength[iRow]; for (int k = start; k < end; ++k) { CoinBigIndex j = column[k]; double value = rowElements[k]; printf("(%d,%g) ",j,value); sum2 += value*allColumns[j]; } if (sum2rowUpper[iRow]+1.0e-3) { printf(" ******** "); feas2 = false; } printf("<= %g\n",rowUpper[iRow]); if (feas1 && !feas2) abort(); delete [] allColumns; } #endif if (!thisCut) { // put in old row int start=rowStart[iRow]; int kInt=-1; double newValue=0.0; if (!iPass&&!iBigPass) { // worthwhile seeing if odd gcd int end = start + rowLength[iRow]; double rhsAdjustment=0.0; int nPosInt=0; int nNegInt=0; // Find largest integer coefficient int k; for ( k = start; k < end; ++k) { CoinBigIndex j = column[k]; if (columnUpper[j]>columnLower[j]) { if (newModel->isInteger(j)) { if (rowElements[k]>0.0) nPosInt++; else nNegInt++; } else { break; // no good } } else { rhsAdjustment += columnLower[j]*rowElements[k]; } } if (k==end) { // see if singleton coefficient can be strengthened if ((nPosInt==1&&nNegInt>1)||(nNegInt==1&&nPosInt>1)) { double lo; double up; if (rowLower[iRow]>-1.0e20) lo = rowLower[iRow]-rhsAdjustment; else lo=-COIN_DBL_MAX; if(rowUpper[iRow]<1.0e20) up = rowUpper[iRow]-rhsAdjustment; else up=COIN_DBL_MAX; double multiplier=1.0; if (nNegInt==1) { // swap signs multiplier=lo; lo=-up; up=-multiplier; multiplier=-1.0; } bool possible=true; double singletonValue=0; double scale = 4.0*5.0*6.0; int kGcd=-1; double smallestSum = 0.0; double largestSum = 0.0; for ( k = start; k < end; ++k) { CoinBigIndex j = column[k]; double value=multiplier*rowElements[k]; if (columnUpper[j]>columnLower[j]) { if (value>0.0) { // singleton kInt=j; if (columnUpper[j]-columnLower[j]!=1.0) { possible = false; break; } else { singletonValue=value; } } else { if (columnLower[j]>-1.0e10) smallestSum += value*columnLower[j]; else smallestSum = -COIN_DBL_MAX; if (columnUpper[j]<-1.0e10) largestSum += value*columnUpper[j]; else largestSum = COIN_DBL_MAX; value *=-scale; if (fabs(value-floor(value+0.5))>1.0e-12) { possible=false; break; } else { int kVal = static_cast (floor(value+0.5)); if (kGcd>0) kGcd = gcd(kGcd,kVal); else kGcd=kVal; } } } } if (possible) { double multiple = (static_cast (kGcd))/scale; int interesting=0; double saveLo=lo; double saveUp=up; #if CBC_USEFUL_PRINTING>1 double nearestLo0=lo; double nearestLo1=lo; #endif double nearestUp0=up; double nearestUp1=up; // adjust rhs for singleton if (lo!=-COIN_DBL_MAX) { // singleton at lb lo -= columnLower[kInt]*singletonValue; double exact = lo/multiple; if (fabs(exact-floor(exact+0.5))>1.0e-4) { interesting +=1; #if CBC_USEFUL_PRINTING>1 nearestLo0 = ceil(exact)*multiple; #endif } // singleton at ub lo -= singletonValue; exact = lo/multiple; if (fabs(exact-floor(exact+0.5))>1.0e-4) { interesting +=2; #if CBC_USEFUL_PRINTING>1 nearestLo1 = ceil(exact)*multiple; #endif } } if (up!=COIN_DBL_MAX) { // singleton at lb up -= columnLower[kInt]*singletonValue; double exact = up/multiple; if (fabs(exact-floor(exact+0.5))>1.0e-4) { interesting +=4; nearestUp0 = floor(exact)*multiple; } // singleton at ub up -= singletonValue; exact = up/multiple; if (fabs(exact-floor(exact+0.5))>1.0e-4) { interesting +=8; nearestUp1 = floor(exact)*multiple; } } if (interesting) { #if CBC_USEFUL_PRINTING>1 printf("Row %d interesting %d lo,up %g,%g singleton %d value %g bounds %g,%g - gcd %g\n",iRow,interesting,saveLo,saveUp,kInt,singletonValue, columnLower[kInt],columnUpper[kInt],multiple); printf("Orig lo,up %g,%g %d\n",rowLower[iRow],rowUpper[iRow],end-start); for ( k = start; k < end; ++k) { CoinBigIndex j = column[k]; double value=multiplier*rowElements[k]; printf(" (%d, %g - bds %g, %g)",j,value, columnLower[j],columnUpper[j]); } printf("\n"); #endif if(columnLower[kInt]) { #if CBC_USEFUL_PRINTING>1 printf("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\n"); //think #endif interesting=0; } newValue = singletonValue; #if CBC_USEFUL_PRINTING>1 double newLoRhs = rowLower[iRow]; double newUpRhs = rowUpper[iRow]; if ((interesting&3)!=0) { newLoRhs = nearestLo0; newValue = nearestLo0-nearestLo1; } #endif if (saveLo==saveUp&&((interesting&5)==5||(interesting&10)==10)) { #if CBC_USEFUL_PRINTING>1 printf("INFEAS? "); #endif interesting=0; //ninfeas++; } if ((interesting&12)) { #if CBC_USEFUL_PRINTING>1 double value2 = newValue; newUpRhs = nearestUp0; #endif newValue = nearestUp0-nearestUp1; #if CBC_USEFUL_PRINTING>1 if (newValue!=value2) { printf("??? old newvalue %g ",newValue); } #endif } #if CBC_USEFUL_PRINTING>1 printf("guess is new lo %g, new up %g, new value %g\n", newLoRhs,newUpRhs,newValue); #endif } // Just do mzzv11 case double exact = singletonValue/multiple; if (fabs(exact-floor(exact+0.5))<1.0e-5) interesting &= ~2; if (!smallestSum&&interesting==2&&!saveLo&&saveUp>1.0e20) { newValue = multiple*floor(exact); newValue *= multiplier; #if CBC_USEFUL_PRINTING>1 printf("New coefficient for %d will be %g\n",kInt,newValue); #endif } else { // don't do kInt=-1; } } else { kInt=-1; } } } // endgcd } int length = rowLength[iRow]; if (kInt<0) { build.addRow(length,column+start,rowElements+start, rowLower[iRow],rowUpper[iRow]); } else { double * els = CoinCopyOfArray(rowElements+start,length); if (fabs(newValue)>1.0e-13) { for ( int k = 0; k < length; ++k) { int j = column[k+start]; if (j==kInt) { els[k] = newValue; break; } } build.addRow(length,column+start,els, rowLower[iRow],rowUpper[iRow]); } else { // strengthened to zero! #if CBC_USEFUL_PRINTING>1 printf("CglPreProcess - element strenthened to zero!\n"); #endif int * cols = CoinCopyOfArray(column+start,length); int n=0; for ( int k = 0; k < length; ++k) { int j = cols[k]; if (j!=kInt) { els[n] = els[k]; cols[n++]=j; } } build.addRow(n,cols,els, rowLower[iRow],rowUpper[iRow]); delete [] cols; } delete [] els; } keepRow[iRow]=1; } else { // strengthens this row (should we check?) // may be worth going round again numberChangedThisPass++; int n=thisCut->row().getNumElements(); const int * columnCut = thisCut->row().getIndices(); const double * elementCut = thisCut->row().getElements(); double lower = thisCut->lb(); double upper = thisCut->ub(); if (probingCut) { int i; int nFree=0; for ( i=0;icolumnLower[iColumn]+1.0e-12) nFree++; } bool good = (n==nFree); nFree=0; int n1=rowLength[iRow]; int start=rowStart[iRow]; for ( i=0;icolumnLower[iColumn]+1.0e-12) nFree++; } if (n1!=nFree) good=false; if (noStrengthening && n > n1) { good=false; //printf("Skipping row %d strengthened row has %d (%d)\n", // iRow,n,n1); } if (good) { #if PRINT_DEBUG >1 printf("Original row %.8d %g <= ",iRow,rowLower[iRow]); for ( i=0;i0) { build.addRow(n,columnCut,elementCut,lower,upper); keepRow[iRow]=1; } else if (!n) { // Either infeasible or redundant if (lower<=0.0&&upper>=0.0) { // redundant - row will go } else { // infeasible! feasible=false; break; } } } } } if (rowType_) { assert (numberRowType_==numberRows); int numberRowType_=0; for (iRow=0;iRow(newModel->getWarmStart()) ; if (basis) { int n=0; for (iRow=0;iRowdeleteRows(n,del); } for (iRow=0;iRowdeleteRows(numberRows,del); newModel->addRows(build); numberRows = newModel->getNumRows(); #if CBC_USEFUL_PRINTING>0 printf("After build %d rows and %d columns (%d rows strengthened)\n", numberRows,newModel->getNumCols(),numberStrengthened); #endif if (basis) { assert (numberRows==basis->getNumArtificial()); newModel->setWarmStart(basis); delete basis; } if (dupRow&&cs.sizeRowCuts()) newModel->applyCuts(cs); delete [] keepRow; delete [] del; /* VIRTUOUS A solver is not required to hold these pointers constant across complete row deletion and rebuild. */ columnLower = newModel->getColLower(); columnUpper = newModel->getColUpper(); } if (!feasible) break; // now see if we have any x=y x+y=1 if (constraints) { int numberRowCuts = cs.sizeRowCuts() ; for (int k = 0;krow().getNumElements(); double lower = thisCut->lb(); double upper = thisCut->ub(); if (n==2&&lower==upper) { twoCuts.insert(*thisCut); } } } if (probingCut) { // we could look harder for infeasibilities assert (info.numberVariables()==numberColumns); int number01 = info.numberIntegers(); const CliqueEntry * entry = info.fixEntries(); const int * toZero = info.toZero(); const int * toOne = info.toOne(); const int * which = info.integerVariable(); int numberBounds=0; char * markLB = new char [number01]; memset(markLB,0,number01); char * markUB = new char [number01]; memset(markUB,0,number01); for (int k=0;k=number01) continue; if (goingToOne) { // If v -> 1 means k -> 0 we have k+v==1 int startV = toOne[v]; int endV = toZero[v+1]; for (int jv=startV;jv (sequenceInCliqueEntry(entry[jv]))) { int goingToOneV = oneFixesInCliqueEntry(entry[jv]); double lo,up; if (!goingToOneV) { lo=1.0; up=1.0; OsiRowCut thisCut; thisCut.setLb(lo); thisCut.setUb(up); double values[]={1.0,1.0}; int columns[2]; columns[0]=which[k]; columns[1]=which[v]; thisCut.setRow(2,columns,values,false); twoCuts.insertIfNotDuplicate(thisCut); } else { // means infeasible for k to go to 0 markLB[k]=1; numberBounds++; } break; } } } else { // If v -> 0 means k -> 0 we have k==v int startV = toZero[v]; int endV = toOne[v]; for (int jv=startV;jv (sequenceInCliqueEntry(entry[jv]))) { int goingToOneV = oneFixesInCliqueEntry(entry[jv]); double lo,up; if (!goingToOneV) { lo=0.0; up=0.0; OsiRowCut thisCut; thisCut.setLb(lo); thisCut.setUb(up); double values[]={1.0,-1.0}; int columns[2]; columns[0]=which[k]; columns[1]=which[v]; thisCut.setRow(2,columns,values,false); twoCuts.insertIfNotDuplicate(thisCut); } else { // means infeasible for k to go to 0 markLB[k]=1; numberBounds++; } break; } } } } start = toOne[k]; end = toZero[k+1]; // to one for (j=start;j=number01) continue; if (goingToOne) { // If v -> 1 means k -> 1 we have k==v int startV = toOne[v]; int endV = toZero[v+1]; for (int jv=startV;jv (sequenceInCliqueEntry(entry[jv]))) { int goingToOneV = oneFixesInCliqueEntry(entry[jv]); double lo,up; if (goingToOneV) { lo=0.0; up=0.0; OsiRowCut thisCut; thisCut.setLb(lo); thisCut.setUb(up); double values[]={1.0,-1.0}; int columns[2]; columns[0]=which[k]; columns[1]=which[v]; thisCut.setRow(2,columns,values,false); twoCuts.insertIfNotDuplicate(thisCut); } else { // means infeasible for k to go to 1 markUB[k]=1; numberBounds++; } break; } } } else { // If v -> 0 means k -> 1 we have k+v==1 int startV = toZero[v]; int endV = toOne[v]; for (int jv=startV;jv (sequenceInCliqueEntry(entry[jv]))) { int goingToOneV = oneFixesInCliqueEntry(entry[jv]); double lo,up; if (goingToOneV) { lo=1.0; up=1.0; OsiRowCut thisCut; thisCut.setLb(lo); thisCut.setUb(up); double values[]={1.0,1.0}; int columns[2]; columns[0]=which[k]; columns[1]=which[v]; thisCut.setRow(2,columns,values,false); twoCuts.insertIfNotDuplicate(thisCut); } else { // means infeasible for k to go to 1 markUB[k]=1; numberBounds++; } break; } } } } } if (numberBounds) { CoinPackedVector lbs; CoinPackedVector ubs; for (int k=0;keffectiveness() > 1.0 && useSolution) { needResolve = true ; } const CoinPackedVector & lbs = thisCut->lbs() ; const CoinPackedVector & ubs = thisCut->ubs() ; int j ; int n ; const int * which ; const double * values ; n = lbs.getNumElements() ; which = lbs.getIndices() ; values = lbs.getElements() ; for (j = 0;jcolumnLower[iColumn]&&values[j]>-1.0e20) { //printf("%d lower from %g to %g\n",iColumn,columnLower[iColumn],values[j]); newModel->setColLower(iColumn,values[j]) ; if (false) { OsiSolverInterface * xx = newModel->clone(); xx->initialSolve(); assert (xx->isProvenOptimal()); delete xx; } numberChangedThisPass++; if (columnLower[iColumn]==columnUpper[iColumn]) { numberFixed++; } else { numberBounds++; if (columnLower[iColumn]>columnUpper[iColumn]) feasible=false; } } } n = ubs.getNumElements() ; which = ubs.getIndices() ; values = ubs.getElements() ; for (j = 0;jsetColUpper(iColumn,values[j]) ; if (false) { OsiSolverInterface * xx = newModel->clone(); xx->initialSolve(); assert (xx->isProvenOptimal()); delete xx; } numberChangedThisPass++; if (columnLower[iColumn]==columnUpper[iColumn]) { numberFixed++; } else { numberBounds++; if (columnLower[iColumn]>columnUpper[iColumn]) feasible=false; } } } } numberTwo = twoCuts.sizeRowCuts()-numberTwo; numberChanges += numberTwo + numberStrengthened/10; if (numberFixed||numberTwo||numberStrengthened||numberBounds) handler_->message(CGL_PROCESS_STATS,messages_) <(newModel->getEmptyWarmStart()) ; //newModel->setWarmStart(slack); //delete slack ; bool saveHint; OsiHintStrength saveStrength; newModel->getHintParam(OsiDoPresolveInInitial,saveHint,saveStrength); // Do presolves if ((numberFixed+numberTwo)*4>numberColumns) newModel->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry); newModel->setHintParam(OsiDoDualInInitial,true,OsiHintTry); newModel->initialSolve() ; newModel->setHintParam(OsiDoPresolveInInitial,saveHint,saveStrength); } else { newModel->resolve() ; } numberIterationsPre_ += newModel->getIterationCount(); feasible = newModel->isProvenOptimal(); if (!feasible&&getCutoff()>1.0e20) { // Better double check CoinWarmStartBasis *slack = dynamic_cast(newModel->getEmptyWarmStart()) ; newModel->setWarmStart(slack); delete slack ; newModel->resolve() ; numberIterationsPre_ += newModel->getIterationCount(); feasible = newModel->isProvenOptimal(); //if (!feasible) //newModel->writeMpsNative("infeas.mps",NULL,NULL,2,1); } } if (!feasible) break; } if (!feasible) break; numberChanges += numberChangedThisPass; if (iPass10) ? numberRows+1000 : 1; if ((!numberFixed&&numberChangedThisPass*multiplier 4) { firstGenerator=-1; lastGenerator=0; } iPass=numberPasses-2; } } } delete [] whichCut; int numberRowCuts = twoCuts.sizeRowCuts() ; if (numberRowCuts) { // add in x=y etc CoinBuild build; for (int k = 0;krow().getNumElements(); const int * columnCut = thisCut->row().getIndices(); const double * elementCut = thisCut->row().getElements(); double lower = thisCut->lb(); double upper = thisCut->ub(); build.addRow(n,columnCut,elementCut,lower,upper); } newModel->addRows(build); if (rowType_) { // adjust int numberRows=newModel->getNumRows(); char * temp = CoinCopyOfArrayPartial(rowType_,numberRows,numberRowType_); delete [] rowType_; rowType_ = temp; for (int iRow=numberRowType_;iRowsetLogLevel(2); messages_ = CglMessage(); } // Copy constructor. CglPreProcess::CglPreProcess(const CglPreProcess & rhs) : numberSolvers_(rhs.numberSolvers_), defaultHandler_(rhs.defaultHandler_), appData_(rhs.appData_), originalColumn_(NULL), originalRow_(NULL), numberCutGenerators_(rhs.numberCutGenerators_), numberProhibited_(rhs.numberProhibited_), numberIterationsPre_(rhs.numberIterationsPre_), numberIterationsPost_(rhs.numberIterationsPost_), numberRowType_(rhs.numberRowType_), options_(rhs.options_) { if (defaultHandler_) { handler_ = new CoinMessageHandler(); handler_->setLogLevel(rhs.handler_->logLevel()); } else { handler_ = rhs.handler_; } messages_ = rhs.messages_; if (numberCutGenerators_) { generator_ = new CglCutGenerator * [numberCutGenerators_]; for (int i=0;iclone(); } } else { generator_=NULL; } if (rhs.originalModel_) { originalModel_ = rhs.originalModel_; // If no make equality then solvers are same if (rhs.originalModel_!=rhs.startModel_) { startModel_=rhs.startModel_->clone(); } else { startModel_=originalModel_; } } else { originalModel_=NULL; startModel_=NULL; } if (numberSolvers_) { model_ = new OsiSolverInterface * [numberSolvers_]; modifiedModel_ = new OsiSolverInterface * [numberSolvers_]; presolve_ = new OsiPresolve * [numberSolvers_]; for (int i=0;iclone(); modifiedModel_[i]=rhs.modifiedModel_[i]->clone(); presolve_[i]=new OsiPresolve(*rhs.presolve_[i]); } } else { model_=NULL; presolve_=NULL; } numberSOS_=rhs.numberSOS_; if (numberSOS_) { int numberTotal = rhs.startSOS_[numberSOS_]; typeSOS_= CoinCopyOfArray(rhs.typeSOS_,numberSOS_); startSOS_= CoinCopyOfArray(rhs.startSOS_,numberSOS_+1); whichSOS_= CoinCopyOfArray(rhs.whichSOS_,numberTotal); weightSOS_= CoinCopyOfArray(rhs.weightSOS_,numberTotal); } else { typeSOS_ = NULL; startSOS_ = NULL; whichSOS_ = NULL; weightSOS_ = NULL; } prohibited_ = CoinCopyOfArray(rhs.prohibited_,numberProhibited_); rowType_ = CoinCopyOfArray(rhs.rowType_,numberRowType_); cuts_ = rhs.cuts_; } // Assignment operator CglPreProcess & CglPreProcess::operator=(const CglPreProcess& rhs) { if (this!=&rhs) { gutsOfDestructor(); numberSolvers_=rhs.numberSolvers_; defaultHandler_=rhs.defaultHandler_; appData_=rhs.appData_; numberCutGenerators_=rhs.numberCutGenerators_; numberProhibited_ = rhs.numberProhibited_; numberIterationsPre_ = rhs.numberIterationsPre_; numberIterationsPost_ = rhs.numberIterationsPost_; numberRowType_ = rhs.numberRowType_; options_ = rhs.options_; if (defaultHandler_) { handler_ = new CoinMessageHandler(); handler_->setLogLevel(rhs.handler_->logLevel()); } else { handler_ = rhs.handler_; } messages_ = rhs.messages_; if (numberCutGenerators_) { generator_ = new CglCutGenerator * [numberCutGenerators_]; for (int i=0;iclone(); } } if (rhs.originalModel_) { originalModel_ = rhs.originalModel_; // If no make equality then solvers are same if (rhs.originalModel_!=rhs.startModel_) { startModel_=rhs.startModel_->clone(); } else { startModel_=originalModel_; } } else { originalModel_=NULL; startModel_=NULL; } if (numberSolvers_) { model_ = new OsiSolverInterface * [numberSolvers_]; modifiedModel_ = new OsiSolverInterface * [numberSolvers_]; presolve_ = new OsiPresolve * [numberSolvers_]; for (int i=0;iclone(); modifiedModel_[i]=rhs.modifiedModel_[i]->clone(); presolve_[i]=new OsiPresolve(*rhs.presolve_[i]); } } else { model_=NULL; presolve_=NULL; } numberSOS_=rhs.numberSOS_; if (numberSOS_) { int numberTotal = rhs.startSOS_[numberSOS_]; typeSOS_= CoinCopyOfArray(rhs.typeSOS_,numberSOS_); startSOS_= CoinCopyOfArray(rhs.startSOS_,numberSOS_+1); whichSOS_= CoinCopyOfArray(rhs.whichSOS_,numberTotal); weightSOS_= CoinCopyOfArray(rhs.weightSOS_,numberTotal); } else { typeSOS_ = NULL; startSOS_ = NULL; whichSOS_ = NULL; weightSOS_ = NULL; } prohibited_ = CoinCopyOfArray(rhs.prohibited_,numberProhibited_); rowType_ = CoinCopyOfArray(rhs.rowType_,numberRowType_); cuts_ = rhs.cuts_; } return *this; } // Destructor CglPreProcess::~CglPreProcess () { gutsOfDestructor(); } // Clears out as much as possible (except solver) void CglPreProcess::gutsOfDestructor() { if (defaultHandler_) { delete handler_; handler_ = NULL; } if (startModel_!=originalModel_) delete startModel_; startModel_=NULL; //delete originalModel_; originalModel_=NULL; int i; for (i=0;iclone(); } //############################################################################# // Set/Get Application Data // This is a pointer that the application can store into and retrieve // This field is the application to optionally define and use. //############################################################################# void CglPreProcess::setApplicationData(void * appData) { appData_ = appData; } //----------------------------------------------------------------------------- void * CglPreProcess::getApplicationData() const { return appData_; } /* Set cutoff bound on the objective function. When using strict comparison, the bound is adjusted by a tolerance to avoid accidentally cutting off the optimal solution. */ void CglPreProcess::setCutoff(double value) { // Solvers know about direction double direction = originalModel_->getObjSense(); originalModel_->setDblParam(OsiDualObjectiveLimit,value*direction); } // Get the cutoff bound on the objective function - always as minimize double CglPreProcess::getCutoff() const { double value ; originalModel_->getDblParam(OsiDualObjectiveLimit,value) ; return value * originalModel_->getObjSense() ; } // Pass in Message handler (not deleted at end) void CglPreProcess::passInMessageHandler(CoinMessageHandler * handler) { if (defaultHandler_) delete handler_; defaultHandler_=false; handler_=handler; } // Set language void CglPreProcess::newLanguage(CoinMessages::Language language) { messages_ = CglMessage(language); } // Return a pointer to the original columns (without clique slacks) const int * CglPreProcess::originalColumns() { if (!originalColumn_) createOriginalIndices(); return originalColumn_; } // Return a pointer to the original rows const int * CglPreProcess::originalRows() { if (!originalRow_) createOriginalIndices(); return originalRow_; } // create original columns and rows void CglPreProcess::createOriginalIndices() { // Find last model and presolve int iPass; for (iPass=numberSolvers_-1;iPass>=0;iPass--) { if (presolve_[iPass]) break; } int nRows,nColumns; if (iPass>=0) { nRows=model_[iPass]->getNumRows(); nColumns=model_[iPass]->getNumCols(); } else { nRows=originalModel_->getNumRows(); nColumns=originalModel_->getNumCols(); } delete [] originalColumn_; originalColumn_=new int [nColumns]; delete [] originalRow_; originalRow_ = new int[nRows]; if (iPass>=0) { memcpy(originalColumn_,presolve_[iPass]->originalColumns(), nColumns*sizeof(int)); memcpy(originalRow_,presolve_[iPass]->originalRows(), nRows*sizeof(int)); iPass--; for (;iPass>=0;iPass--) { const int * originalColumns = presolve_[iPass]->originalColumns(); int i; for (i=0;ioriginalRows(); int nRowsNow=model_[iPass]->getNumRows(); for (i=0;i=0&&iRoworiginalColumns(); int numberColumns = solver->getNumCols(); // number prohibited must stay constant int n=0; int i; for (i=0;ioriginal[i-1]); char p = prohibited_[iColumn]; if (p) n2++; prohibited_[i]=p; } assert (n==n2); numberProhibited_=numberColumns; } if (rowType_) { const int * original = pinfo->originalRows(); int numberRows = solver->getNumRows(); #if CBC_USEFUL_PRINTING>1 int nMarked1=0; for (int i=0;igetNumRows();i++) { if (rowType_[i]) nMarked1++; } int nMarked2=0; int k=-1; for (int i=0;inMarked2) printf("Marked rows reduced from %d to %d\n", nMarked1,nMarked2); #endif for (int i=0;ilower[i]) numberContinuous++; if (model.isInteger(i)||fixContinuousAsWell) { if (keep) { if (keep[i]==1) { continue; // always keep } else if (keep[i]==-1) { // always fix dj[number]=-1.0e30; numberThrow++; sort[number++]=i; continue; } } double value = solution[i]; if (valueupper[number]-1.0e-8) { dj[number]=-dj[i]; sort[number++]=i; } } } CoinSort_2(dj,dj+number,sort); int numberToFix = static_cast (numberColumns *(1.0-fractionToKeep)); if (!fixContinuousAsWell) numberToFix = static_cast ((numberColumns-numberContinuous) *(1.0-fractionToKeep)); numberToFix = CoinMax(numberToFix,numberThrow); numberToFix = CoinMin(number,numberToFix); #if CBC_USEFUL_PRINTING printf("%d columns fixed\n",numberToFix); #endif for (i=0;isetColUpper(iColumn,lower[iColumn]); } else if (value>upper[number]-1.0e-8) { newModel->setColLower(iColumn,lower[iColumn]); } else { // must be a throw away on - go to lower newModel->setColUpper(iColumn,lower[iColumn]); } } return newModel; } // If we have a cutoff - fix variables int CglPreProcess::reducedCostFix(OsiSolverInterface & model) { double cutoff ; model.getDblParam(OsiDualObjectiveLimit,cutoff) ; double direction = model.getObjSense() ; cutoff *= direction; double gap = cutoff - model.getObjValue()*direction ; double tolerance; model.getDblParam(OsiDualTolerance,tolerance) ; if (gap<=0.0||fabs(cutoff)>1.0e20) return 0; gap += 100.0*tolerance; // not really but thats all we can get double integerTolerance; model.getDblParam(OsiPrimalTolerance,integerTolerance) ; int numberColumns = model.getNumCols(); const double *lower = model.getColLower() ; const double *upper = model.getColUpper() ; const double *solution = model.getColSolution() ; const double *reducedCost = model.getReducedCost() ; int numberFixed = 0 ; int iColumn; for (iColumn=0;iColumnlower[iColumn]) { double djValue = direction*reducedCost[iColumn] ; if (solution[iColumn] < lower[iColumn]+integerTolerance && djValue > gap) { model.setColUpper(iColumn,lower[iColumn]) ; numberFixed++ ; } else if (solution[iColumn] > upper[iColumn]-integerTolerance && -djValue > gap) { model.setColLower(iColumn,upper[iColumn]) ; numberFixed++ ; } } } return numberFixed; } // Pass in prohibited columns void CglPreProcess::passInProhibited(const char * prohibited,int numberColumns) { delete [] prohibited_; prohibited_ = CoinCopyOfArray(prohibited,numberColumns); numberProhibited_ = numberColumns; } /* Pass in row types 0 normal 1 cut rows - will be dropped if remain in At end of preprocess cut rows will be dropped and put into cuts */ void CglPreProcess::passInRowTypes(const char * rowTypes,int numberRows) { delete [] rowType_; rowType_ = CoinCopyOfArray(rowTypes,numberRows); numberRowType_ = numberRows; cuts_ = CglStored(); } // Make continuous variables integer void CglPreProcess::makeInteger() { // First check if we need to int numberInteger=0; { const double *lower = startModel_->getColLower() ; const double *upper = startModel_->getColUpper() ; int numberColumns = startModel_->getNumCols() ; int iColumn; int numberContinuous=0; for (iColumn=0;iColumn lower[iColumn]+1.0e-8) { if(startModel_->isInteger(iColumn)) numberInteger++; else numberContinuous++; } } if (!numberContinuous) return; } OsiSolverInterface * solver = startModel_->clone(); const double *objective = solver->getObjCoefficients() ; const double *lower = solver->getColLower() ; const double *upper = solver->getColUpper() ; int numberColumns = solver->getNumCols() ; int numberRows = solver->getNumRows(); double direction = solver->getObjSense(); int iRow,iColumn; // Row copy CoinPackedMatrix matrixByRow(*solver->getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); // Column copy CoinPackedMatrix matrixByCol(*solver->getMatrixByCol()); const double * element = matrixByCol.getElements(); const int * row = matrixByCol.getIndices(); const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol.getVectorLengths(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); char * ignore = new char [numberRows]; int * changed = new int[numberColumns]; int * which = new int[numberRows]; double * changeRhs = new double[numberRows]; memset(changeRhs,0,numberRows*sizeof(double)); memset(ignore,0,numberRows); int numberChanged=0; bool finished=false; while (!finished) { int saveNumberChanged = numberChanged; for (iRow=0;iRow lower[jColumn]+1.0e-8) { if (!solver->isInteger(jColumn)) { if (numberContinuous==0) { jColumn1=jColumn; value1=value; } else { jColumn2=jColumn; value2=value; } numberContinuous++; } else { if (fabs(value-floor(value+0.5))>1.0e-12) allIntegerCoeff=false; } } else { sumFixed += lower[jColumn]*value; } } double low = rowLower[iRow]; if (low>-1.0e20) { low -= sumFixed; if (fabs(low-floor(low+0.5))>1.0e-12) allIntegerCoeff=false; } double up = rowUpper[iRow]; if (up<1.0e20) { up -= sumFixed; if (fabs(up-floor(up+0.5))>1.0e-12) allIntegerCoeff=false; } if (!allIntegerCoeff) continue; // can't do if (numberContinuous==1) { // see if really integer // This does not allow for complicated cases if (low==up) { if (fabs(value1)>1.0e-3) { value1 = 1.0/value1; if (fabs(value1-floor(value1+0.5))<1.0e-12) { // integer changed[numberChanged++]=jColumn1; solver->setInteger(jColumn1); if (upper[jColumn1]>1.0e20) solver->setColUpper(jColumn1,1.0e20); if (lower[jColumn1]<-1.0e20) solver->setColLower(jColumn1,-1.0e20); } } } else { if (fabs(value1)>1.0e-3) { value1 = 1.0/value1; if (fabs(value1-floor(value1+0.5))<1.0e-12) { // This constraint will not stop it being integer ignore[iRow]=1; } } } } else if (numberContinuous==2) { if (low==up) { /* need general theory - for now just look at 2 cases - 1 - +- 1 one in column and just costs i.e. matching objective 2 - +- 1 two in column but feeds into G/L row which will try and minimize */ if (fabs(value1)==1.0&&value1*value2==-1.0&&!lower[jColumn1] &&!lower[jColumn2]) { int n=0; int i; double objChange=direction*(objective[jColumn1]+objective[jColumn2]); double bound = CoinMin(upper[jColumn1],upper[jColumn2]); bound = CoinMin(bound,1.0e20); for ( i=columnStart[jColumn1];i=0.0) { // see if all rows OK bool good=true; for (i=0;i0.0) { double rhs = rowLower[jRow]; if (rhs>0.0) { double ratio =rhs/value; if (fabs(ratio-floor(ratio+0.5))>1.0e-12) good=false; } } else { double rhs = rowUpper[jRow]; if (rhs<0.0) { double ratio =rhs/value; if (fabs(ratio-floor(ratio+0.5))>1.0e-12) good=false; } } } else if (rowLength[jRow]==2) { if (value>0.0) { if (rowLower[jRow]>-1.0e20) good=false; } else { if (rowUpper[jRow]<1.0e20) good=false; } } else { good=false; } } } if (good) { // both can be integer changed[numberChanged++]=jColumn1; solver->setInteger(jColumn1); if (upper[jColumn1]>1.0e20) solver->setColUpper(jColumn1,1.0e20); if (lower[jColumn1]<-1.0e20) solver->setColLower(jColumn1,-1.0e20); changed[numberChanged++]=jColumn2; solver->setInteger(jColumn2); if (upper[jColumn2]>1.0e20) solver->setColUpper(jColumn2,1.0e20); if (lower[jColumn2]<-1.0e20) solver->setColLower(jColumn2,-1.0e20); } } // clear for (i=0;i lower[iColumn]+1.0e-8&&!solver->isInteger(iColumn)) { double value; value = upper[iColumn]; if (value<1.0e20&&fabs(value-floor(value+0.5))>1.0e-12) continue; value = lower[iColumn]; if (value>-1.0e20&&fabs(value-floor(value+0.5))>1.0e-12) continue; bool integer=true; for (CoinBigIndex j=columnStart[iColumn];jsetInteger(iColumn); if (upper[iColumn]>1.0e20) solver->setColUpper(iColumn,1.0e20); if (lower[iColumn]<-1.0e20) solver->setColLower(iColumn,-1.0e20); } } } finished = numberChanged==saveNumberChanged; } delete [] which; delete [] changeRhs; delete [] ignore; //increment=0.0; if (numberChanged) { handler_->message(CGL_MADE_INTEGER,messages_) <isInteger(iColumn)&&objective[iColumn]) startModel_->setInteger(iColumn); } } delete solver; delete [] changed; } //#define BRON_TIMES #ifdef BRON_TIMES static int numberTimesX=0; #endif /* Replace cliques by more maximal cliques Returns NULL if rows not reduced by greater than cliquesNeeded*rows */ OsiSolverInterface * CglPreProcess::cliqueIt(OsiSolverInterface & model, double cliquesNeeded) const { /* Initial arrays * Candidate nodes (columns) First nIn already in Next nCandidate are candidates numberColumns-1 back to nNot are Nots * Starts * Other node * Original row (paired with other node) * CliqueIn expanded array with 1 in, 2 not, 3 out, 0 possible, -1 never * Type (for original row) */ const double *lower = model.getColLower() ; const double *upper = model.getColUpper() ; const double *rowLower = model.getRowLower() ; const double *rowUpper = model.getRowUpper() ; int numberRows = model.getNumRows() ; int numberColumns = model.getNumCols() ; // Column copy of matrix //const double * element = model.getMatrixByCol()->getElements(); //const int * row = model.getMatrixByCol()->getIndices(); //const CoinBigIndex * columnStart = model.getMatrixByCol()->getVectorStarts(); //const int * columnLength = model.getMatrixByCol()->getVectorLengths(); // Row copy CoinPackedMatrix matrixByRow(*model.getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); char * type = new char [numberRows+3*numberColumns]; char * numberInColumn = type+numberRows; char * negativeInColumn = numberInColumn+numberColumns; char * positiveInColumn = negativeInColumn+numberColumns; memset(numberInColumn,0,3*numberColumns); // First pass to mark columns int numberCliques=0; //int numberOddCliques=0; for (int i=0;i1000) possible=false; if (possible) { for (CoinBigIndex j=start;j0.0) type[i]=1; else type[i]=0; } } else if ((rupper==0.0||rlower==0.0)&&rowLength[i]==2) { int multiplier; if (rupper==0.0&&rlower<-1.0e20) multiplier=1; else if (rlower==0.0&&rupper>1.0e20) multiplier=-1; else multiplier=0; if (multiplier) { CoinBigIndex start = rowStart[i]; if (fabs(elementByRow[start])==1.0&& fabs(elementByRow[start+1])==1.0) { if (elementByRow[start]*elementByRow[start+1]==-1.0) { int iPColumn,iNColumn; if (multiplier*elementByRow[start]==1.0) { iPColumn = column[start]; iNColumn = column[start+1]; } else { iNColumn = column[start]; iPColumn = column[start+1]; } if (upper[iPColumn]==1.0&&lower[iPColumn]==0.0&& model.isInteger(iPColumn)&& upper[iNColumn]==1.0&&lower[iNColumn]==0.0&& model.isInteger(iNColumn)) { type[i]=-2; if (positiveInColumn[iPColumn]<100) positiveInColumn[iPColumn]++; if (negativeInColumn[iNColumn]<100) negativeInColumn[iNColumn]++; } } } } } } #if CBC_USEFUL_PRINTING>0 // look at odd cliques int nOdd=0; for (int iColumn=0;iColumn1) { nOdd++; } } if (nOdd) printf("%d possible odd cliques?\n",nOdd); #endif double numberElements=0; if (numberCliques>CoinMax(1,static_cast(cliquesNeeded*numberRows))) { numberCliques=0; for (int i=0;i=0) { bool possible = true; int n=0; CoinBigIndex start = rowStart[i]; CoinBigIndex end = start + rowLength[i]; for (CoinBigIndex j=start;jCoinMax(1,static_cast(cliquesNeeded*numberRows))) { if (numberElements<5.0e7&&numberElements0 printf("%d cliques needing 2 * %g ints\n", numberCliques,numberElements); #endif #ifdef BRON_TIMES double time1 = CoinCpuTime(); #endif CglBK bk(model,type,static_cast(numberElements)); bk.bronKerbosch(); newSolver = bk.newSolver(model); #ifdef BRON_TIMES printf("Time %g - bron called %d times\n",CoinCpuTime()-time1,numberTimesX); #endif } else { #if CBC_USEFUL_PRINTING>0 printf("*** %d cliques needing 2 * %g ints\n", numberCliques,numberElements); #endif } } delete [] type; return newSolver; } // Default constructor CglBK::CglBK() { candidates_=NULL; mark_=NULL; start_=NULL; otherColumn_=NULL; originalRow_=NULL; dominated_=NULL; cliqueMatrix_=NULL; rowType_=NULL; numberColumns_=0; numberRows_=0; numberPossible_=0; numberCandidates_=0; firstNot_=0; numberIn_=0; left_=0; lastColumn_=0; } // Useful constructor CglBK::CglBK(const OsiSolverInterface & model, const char * rowType, int numberElements) { const double *lower = model.getColLower() ; const double *upper = model.getColUpper() ; const double *rowLower = model.getRowLower() ; const double *rowUpper = model.getRowUpper() ; numberRows_ = model.getNumRows() ; numberColumns_ = model.getNumCols() ; // Column copy of matrix #ifndef NDEBUG const double * element = model.getMatrixByCol()->getElements(); #endif const int * row = model.getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = model.getMatrixByCol()->getVectorStarts(); const int * columnLength = model.getMatrixByCol()->getVectorLengths(); start_ = new CoinBigIndex[numberColumns_+1]; otherColumn_ = new int [numberElements]; candidates_ = new int [2*numberColumns_]; CoinZeroN(candidates_,2*numberColumns_); // for valgrind originalRow_ = new int [numberElements]; dominated_ = new int [numberRows_]; CoinZeroN(dominated_,numberRows_); //int inputNumber=numberElements; numberElements=0; numberPossible_=0; rowType_=rowType; // Row copy CoinPackedMatrix matrixByRow(*model.getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); #if 1 // take out duplicate doubleton rows double * sort = new double[numberRows_]; int * which = new int [numberRows_]; double * randomValues = new double [numberColumns_]; // Initialize random seed CoinThreadRandom randomGenerator(987654321); for (int i=0;icolumn[last]) { first=last; last=rowStart[i]; } int iColumn1 = column[first]; int iColumn2 = column[last]; double value = elementByRow[first]*randomValues[iColumn1]+ elementByRow[last]*randomValues[iColumn2]; sort[nSort]=value; which[nSort++]=i; } } CoinSort_2(sort,sort+nSort,which); double value=sort[0]; int nDominated=0; for (int i=1;icolumn[last1]) { first1=last1; last1=rowStart[i1]; } int iColumn11 = column[first1]; int iColumn12 = column[last1]; int first2 = rowStart[i2]; int last2 = first2+1; if (column[first2]>column[last2]) { first2=last2; last2=rowStart[i2]; } int iColumn21 = column[first2]; int iColumn22 = column[last2]; if (iColumn11==iColumn21&& iColumn12==iColumn22&& elementByRow[first1]==elementByRow[first2]&& elementByRow[last1]==elementByRow[last2]) { dominated_[i2]=1; nDominated++; } } } value=sort[i]; } //if (nDominated) //printf("%d duplicate doubleton rows!\n",nDominated); delete [] randomValues; delete [] sort; delete [] which; #endif for (int iColumn=0;iColumn=0&&!dominated_[iRow]) { assert(element[j]==1.0); #if 0 CoinBigIndex r=rowStart[iRow]; assert (rowLength[iRow]==2); int kColumn = column[r]; if (kColumn==iColumn) kColumn=column[r+1]; originalRow_[numberElements]=iRow; otherColumn_[numberElements++]=kColumn; #else for (CoinBigIndex r=rowStart[iRow];rstart_[iColumn]) { candidates_[numberPossible_++]=iColumn; } } } //printf("input number %d, computed number %d\n",inputNumber,numberElements); start_[numberColumns_]=numberElements; numberCandidates_=numberPossible_; numberIn_=0; firstNot_ = numberPossible_; left_=numberPossible_; lastColumn_=-1; mark_ = new char [numberColumns_]; memset(mark_,0,numberColumns_); cliqueMatrix_=new CoinPackedMatrix(false,0.5,0.0); int n=0; for (int i=0;i=0) n++; } cliqueMatrix_->reserve(CoinMin(100,n),5*numberPossible_); } // Copy constructor . CglBK::CglBK(const CglBK & rhs) { // This only copies data in candidates_ // rest just points candidates_ = CoinCopyOfArray(rhs.candidates_,2*rhs.numberPossible_); mark_=rhs.mark_; start_=rhs.start_; otherColumn_=rhs.otherColumn_; originalRow_=rhs.originalRow_; dominated_=rhs.dominated_; cliqueMatrix_=rhs.cliqueMatrix_; rowType_=rhs.rowType_; numberColumns_=rhs.numberColumns_; numberRows_=rhs.numberRows_; numberPossible_=rhs.numberPossible_; numberCandidates_=rhs.numberCandidates_; firstNot_=rhs.firstNot_; numberIn_=rhs.numberIn_; left_=rhs.left_; lastColumn_=rhs.lastColumn_; } // Assignment operator CglBK & CglBK::operator=(const CglBK& rhs) { if (this!=&rhs) { delete [] candidates_; // This only copies data in candidates_ // rest just points candidates_ = CoinCopyOfArray(rhs.candidates_,2*numberPossible_); mark_=rhs.mark_; start_=rhs.start_; otherColumn_=rhs.otherColumn_; originalRow_=rhs.originalRow_; dominated_=rhs.dominated_; cliqueMatrix_=rhs.cliqueMatrix_; rowType_=rhs.rowType_; numberColumns_=rhs.numberColumns_; numberRows_=rhs.numberRows_; numberPossible_=rhs.numberPossible_; numberCandidates_=rhs.numberCandidates_; firstNot_=rhs.firstNot_; numberIn_=rhs.numberIn_; left_=rhs.left_; lastColumn_=rhs.lastColumn_; } return *this; } // Destructor CglBK::~CglBK () { delete [] candidates_; // only deletes if left_==-1 if (left_==-1) { delete [] mark_; delete [] start_; delete [] otherColumn_; delete [] originalRow_; delete [] dominated_; delete cliqueMatrix_; } } // For Bron-Kerbosch void CglBK::bronKerbosch() { #ifdef BRON_TIMES numberTimesX++; if ((numberTimesX%1000)==0) printf("times %d - %d candidates left\n",numberTimesX,numberCandidates_); #endif if (!numberCandidates_&&firstNot_==numberPossible_) { // mark original rows which are dominated // save if clique size >2 if (numberIn_>2) { double * elements = new double [numberIn_]; int * column = candidates_+numberPossible_; // mark those in clique for (int i=0;iappendRow(numberIn_,column,elements); delete [] elements; } } else { #if 0 int nCplusN=numberCandidates_+(numberPossible_-firstNot_); int iChoose = CoinDrand48()*nCplusN; iChoose=CoinMin(0,nCplusN-1); if (iChoose>=numberCandidates_) { iChoose -= numberCandidates_; iChoose += firstNot_; } #else for (int i=0;i=firstNot_;i--) { int iColumn = candidates_[i]; int n=0; for (int j=start_[iColumn];jnMax) { nMax=n; iChoose=i; } } if (nMaxnMax) { nMax=n; iChoose=i; } } } for (int i=0;i=bk2.firstNot_;i--) { int jColumn = newCandidates[i]; if (mark_[jColumn]) newCandidates[--firstNot]=jColumn; } bk2.firstNot_=firstNot; for (int j=start_[iColumn];jgetNumRows(); #if CBC_USEFUL_PRINTING>0 printf ("%d rows can be deleted with %d new cliques\n", nDelete,nAdd); #endif OsiSolverInterface * newSolver = NULL; if (nDelete>nAdd) { newSolver = model.clone(); newSolver->deleteRows(nDelete,deleted); double * lower = new double [nAdd]; double * upper = new double [nAdd]; for (int i=0;igetElements(); const int * column = cliqueMatrix_->getIndices(); const CoinBigIndex * rowStart = cliqueMatrix_->getVectorStarts(); //const int * rowLength = cliqueMatrix_->getVectorLengths(); assert (cliqueMatrix_->getNumElements()==rowStart[nAdd]); newSolver->addRows(nAdd,rowStart,column,elementByRow,lower,upper); #if PRINT_DEBUG for (int i=0;i10) printf("Clique %d has %d entries\n",i,rowStart[i+1]-rowStart[i]); } #endif delete [] lower; delete [] upper; } delete [] deleted; // mark so everything will be deleted left_=-1; return newSolver; } static double multiplier[] = {1.23456789e2,-9.87654321}; static int hashCut (const OsiRowCut & x, int size) { int xN =x.row().getNumElements(); double xLb = x.lb(); double xUb = x.ub(); const int * xIndices = x.row().getIndices(); const double * xElements = x.row().getElements(); unsigned int hashValue; double value=1.0; if (xLb>-1.0e10) value += xLb*multiplier[0]; if (xUb<1.0e10) value += xUb*multiplier[1]; for( int j=0;jsizeof(hashValue)) { assert (sizeof(value)==2*sizeof(hashValue)); union { double d; int i[2]; } xx; xx.d = value; hashValue = (xx.i[0] + xx.i[1]); } else { assert (sizeof(value)==sizeof(hashValue)); union { double d; unsigned int i[2]; } xx; xx.d = value; hashValue = xx.i[0]; } return hashValue%(size); } static bool same (const OsiRowCut & x, const OsiRowCut & y) { int xN =x.row().getNumElements(); int yN =y.row().getNumElements(); bool identical=false; if (xN==yN) { double xLb = x.lb(); double xUb = x.ub(); double yLb = y.lb(); double yUb = y.ub(); if (fabs(xLb-yLb)<1.0e-8&&fabs(xUb-yUb)<1.0e-8) { const int * xIndices = x.row().getIndices(); const double * xElements = x.row().getElements(); const int * yIndices = y.row().getIndices(); const double * yElements = y.row().getElements(); int j; for( j=0;j1.0e-12) break; } identical = (j==xN); } } return identical; } CglUniqueRowCuts::CglUniqueRowCuts(int initialMaxSize, int hashMultiplier) { numberCuts_=0; size_ = initialMaxSize; hashMultiplier_ = hashMultiplier; int hashSize=hashMultiplier_*size_; if (size_) { rowCut_ = new OsiRowCut * [size_]; hash_ = new CglHashLink[hashSize]; } else { rowCut_ = NULL; hash_ = NULL; } for (int i=0;i=0&&sequence= 0 ) { if (j1!=sequence) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } assert (found>=0); assert (hash_[ipos].index==sequence); // shuffle up while (hash_[ipos].next>=0) { int k = hash_[ipos].next; hash_[ipos]=hash_[k]; ipos=k; } delete cut; // move last to found numberCuts_--; if (numberCuts_) { ipos = hashCut(*rowCut_[numberCuts_],hashSize); while ( true ) { int j1 = hash_[ipos].index; if (j1!=numberCuts_) { int k = hash_[ipos].next; ipos = k; } else { // change hash_[ipos].index=found; rowCut_[found]=rowCut_[numberCuts_]; rowCut_[numberCuts_]=NULL; break; } } } assert (!rowCut_[numberCuts_]); } // Return 0 if added, 1 if not int CglUniqueRowCuts::insertIfNotDuplicate(const OsiRowCut & cut) { int hashSize= size_*hashMultiplier_; if (numberCuts_==size_) { size_ = 2*size_+100; hashSize=hashMultiplier_*size_; OsiRowCut ** temp = new OsiRowCut * [size_]; delete [] hash_; hash_ = new CglHashLink[hashSize]; for (int i=0;i= 0 ) { if ( !same(*temp[i],*temp[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=i; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_1.0e12) bad=true; } if (bad) return 1; OsiRowCut newCut; newCut.setLb(newLb); newCut.setUb(newUb); newCut.setRow(vector); int ipos = hashCut(newCut,hashSize); int found = -1; int jpos=ipos; while ( true ) { int j1 = hash_[ipos].index; if ( j1 >= 0 ) { if ( !same(newCut,*rowCut_[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=numberCuts_; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_setLb(newLb); newCutPtr->setUb(newUb); newCutPtr->setRow(vector); rowCut_[numberCuts_++]=newCutPtr; return 0; } else { return 1; } } else { return -1; } } // Add in cuts as normal cuts and delete void CglUniqueRowCuts::addCuts(OsiCuts & cs) { for (int i=0;i /// Structure for use by CglMessage.cpp typedef struct { CGL_Message internalNumber; int externalNumber; // or continuation char detail; const char * message; } Cgl_message; static Cgl_message us_english[]= { {CGL_INFEASIBLE,0,1,"Cut generators found to be infeasible! (or unbounded)"}, {CGL_CLIQUES,1,2,"%d cliques of average size %g"}, {CGL_FIXED,2,1,"%d variables fixed"}, {CGL_PROCESS_STATS,3,1,"%d fixed, %d tightened bounds, %d strengthened rows, %d substitutions"}, {CGL_SLACKS,8,1,"%d inequality constraints converted to equality constraints"}, {CGL_PROCESS_STATS2,4,1,"processed model has %d rows, %d columns (%d integer (%d of which binary)) and %d elements"}, {CGL_PROCESS_SOS1,5,1,"%d SOS with %d members"}, {CGL_PROCESS_SOS2,6,2,"%d SOS (%d members out of %d) with %d overlaps - too much overlap or too many others"}, {CGL_UNBOUNDED,7,1,"Continuous relaxation is unbounded!"}, {CGL_ELEMENTS_CHANGED1,9,2,"%d elements changed"}, {CGL_ELEMENTS_CHANGED2,10,3,"element in row %d for column %d changed from %g to %g"}, {CGL_MADE_INTEGER,11,1,"%d variables made integer"}, {CGL_ADDED_INTEGERS,12,1,"Added %d variables (from %d rows) with %d elements"}, {CGL_POST_INFEASIBLE,13,1,"Postprocessed model is infeasible - possible tolerance issue - try without preprocessing"}, {CGL_POST_CHANGED,14,1,"Postprocessing changed objective from %g to %g - possible tolerance issue - try without preprocessing"}, {CGL_GENERAL, 1000, 1, "%s"}, {CGL_DUMMY_END,999999,0,""} }; /* Constructor */ CglMessage::CglMessage(Language language) : CoinMessages(sizeof(us_english)/sizeof(Cgl_message)) { language_=language; strcpy(source_,"Cgl"); class_ = 3; // Cuts Cgl_message * message = us_english; while (message->internalNumber!=CGL_DUMMY_END) { CoinOneMessage oneMessage(message->externalNumber,message->detail, message->message); addMessage(message->internalNumber,oneMessage); message ++; } // Put into compact form toCompact(); } CoinMP-1.8.3/Cgl/AUTHORS0000644000175000017500000000350412122056610013066 0ustar renereneCglAllDifferrent John Forrest - contributor & PM CglClique & CliqueHelper JP Fasano John Forrest Lazlo Ladanyi - PM Marta Eso - contributor CglCutGenerator John Forrest - contributor & PM CglDuplicateRow John Forrest - contributor & PM CglFlowCover & FlowCoverTest John Forrest Laszlo Ladani Yan Xu - contributor & PM Jeff Linderoth - contributor Martin Savelsbergh - contributor CglGMI John Forrest - PM A more robust Gomory Giacomo Nannicini - contributor CglGomory & GomoryTest JP Fasano John Forrest - contributor & PM Laszlo Ladanyi - contributor CglKnapsackCover John Forrest Laszlo Ladanyi Robin Lougee - contributor & PM CglLandP Pierre Bonami - contributor & PM CglLiftAndProject John Forrest Laszlo Ladanyi Robin Lougee - contributor & PM CglMessage John Forrest - contributor & PM CglMixedIntegerRounding John Forrest Laszlo Ladanyi - contributor Joao Goncalves - contributor & PM CglMixedIntegerRounding2 John Forrest - contributor & PM CglOddHole John Forrest - contributor & PM Laszlo Ladanyi CglPreProcess John Forrest - contributor & PM CglProbing & Probing Test JP Fasano John Forrest - contributor & PM Laszlo Ladanyi CglRedSplit John Forrest JP Fasano Francois Margot - contributor & PM CglRedSplit2 John Forrest - PM Based on CglRedSplit Giacomo Nannicini - contributor CglResidualCapacity Francisco Barahona - contributor & PM CglSimpleRounding John Forrest Laszlo Ladanyi Robin Lougee - contributor & PM CglStored John Forrest - contributor & PM CglTwomir JP Fasano John Forrest Oktay Gunluk - contributor & PM Laszlo Ladanyi Sanjeeb Dash - contributor Marcos Goycoolea - contributor CglZeroHalf Alberto Caprara - contributor John Forrest - PM CoinMP-1.8.3/Cbc/0000755000175000017500000000000012600453457012011 5ustar renereneCoinMP-1.8.3/Cbc/Makefile.in0000644000175000017500000011741012547035070014057 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball @ALWAYS_FALSE@am__append_1 = test DIST_COMMON = README $(am__configure_deps) \ $(srcdir)/BuildTools/Makemain.inc $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/cbc-uninstalled.pc.in \ $(srcdir)/cbc.pc.in $(srcdir)/osi-cbc-uninstalled.pc.in \ $(srcdir)/osi-cbc.pc.in $(top_srcdir)/configure \ $(top_srcdir)/doxydoc/doxygen.conf.in \ $(top_srcdir)/examples/Makefile.in AUTHORS INSTALL \ config.guess config.sub depcomp install-sh ltmain.sh missing @HAVE_EXTERNALS_TRUE@am__append_2 = Dependencies @HAVE_EXTERNALS_TRUE@am__append_3 = .Dependencies-stamp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cbc.h CONFIG_CLEAN_FILES = examples/Makefile cbc.pc cbc-uninstalled.pc \ osi-cbc.pc osi-cbc-uninstalled.pc doxydoc/doxygen.conf SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(pkgconfiglibdir)" pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) DATA = $(pkgconfiglib_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = src src/OsiCbc test DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ ASL_CFLAGS = @ASL_CFLAGS@ ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ ASL_DATA = @ASL_DATA@ ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ ASL_LIBS = @ASL_LIBS@ ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CBCGENERIC_CFLAGS = @CBCGENERIC_CFLAGS@ CBCGENERIC_CFLAGS_INSTALLED = @CBCGENERIC_CFLAGS_INSTALLED@ CBCGENERIC_DEPENDENCIES = @CBCGENERIC_DEPENDENCIES@ CBCGENERIC_LIBS = @CBCGENERIC_LIBS@ CBCGENERIC_LIBS_INSTALLED = @CBCGENERIC_LIBS_INSTALLED@ CBCGENERIC_PCLIBS = @CBCGENERIC_PCLIBS@ CBCGENERIC_PCREQUIRES = @CBCGENERIC_PCREQUIRES@ CBCLIB_CFLAGS = @CBCLIB_CFLAGS@ CBCLIB_CFLAGS_INSTALLED = @CBCLIB_CFLAGS_INSTALLED@ CBCLIB_DEPENDENCIES = @CBCLIB_DEPENDENCIES@ CBCLIB_LIBS = @CBCLIB_LIBS@ CBCLIB_LIBS_INSTALLED = @CBCLIB_LIBS_INSTALLED@ CBCLIB_PCLIBS = @CBCLIB_PCLIBS@ CBCLIB_PCREQUIRES = @CBCLIB_PCREQUIRES@ CBC_BUILD_CBC_GENERIC_FALSE = @CBC_BUILD_CBC_GENERIC_FALSE@ CBC_BUILD_CBC_GENERIC_TRUE = @CBC_BUILD_CBC_GENERIC_TRUE@ CBC_SVN_REV = @CBC_SVN_REV@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CLP_CFLAGS = @CLP_CFLAGS@ CLP_CFLAGS_INSTALLED = @CLP_CFLAGS_INSTALLED@ CLP_DATA = @CLP_DATA@ CLP_DATA_INSTALLED = @CLP_DATA_INSTALLED@ CLP_DEPENDENCIES = @CLP_DEPENDENCIES@ CLP_LIBS = @CLP_LIBS@ CLP_LIBS_INSTALLED = @CLP_LIBS_INSTALLED@ COINDEPEND_CFLAGS = @COINDEPEND_CFLAGS@ COINDEPEND_CFLAGS_INSTALLED = @COINDEPEND_CFLAGS_INSTALLED@ COINDEPEND_DATA = @COINDEPEND_DATA@ COINDEPEND_DATA_INSTALLED = @COINDEPEND_DATA_INSTALLED@ COINDEPEND_DEPENDENCIES = @COINDEPEND_DEPENDENCIES@ COINDEPEND_LIBS = @COINDEPEND_LIBS@ COINDEPEND_LIBS_INSTALLED = @COINDEPEND_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ COIN_HAS_CLP_FALSE = @COIN_HAS_CLP_FALSE@ COIN_HAS_CLP_TRUE = @COIN_HAS_CLP_TRUE@ COIN_HAS_COINDEPEND_FALSE = @COIN_HAS_COINDEPEND_FALSE@ COIN_HAS_COINDEPEND_TRUE = @COIN_HAS_COINDEPEND_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_DYLP_FALSE = @COIN_HAS_DYLP_FALSE@ COIN_HAS_DYLP_TRUE = @COIN_HAS_DYLP_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MIPLIB3_FALSE = @COIN_HAS_MIPLIB3_FALSE@ COIN_HAS_MIPLIB3_TRUE = @COIN_HAS_MIPLIB3_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_NTY_FALSE = @COIN_HAS_NTY_FALSE@ COIN_HAS_NTY_TRUE = @COIN_HAS_NTY_TRUE@ COIN_HAS_OSITESTS_FALSE = @COIN_HAS_OSITESTS_FALSE@ COIN_HAS_OSITESTS_TRUE = @COIN_HAS_OSITESTS_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SPX_FALSE = @COIN_HAS_SPX_FALSE@ COIN_HAS_SPX_TRUE = @COIN_HAS_SPX_TRUE@ COIN_HAS_VOL_FALSE = @COIN_HAS_VOL_FALSE@ COIN_HAS_VOL_TRUE = @COIN_HAS_VOL_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPX_CFLAGS = @CPX_CFLAGS@ CPX_CFLAGS_INSTALLED = @CPX_CFLAGS_INSTALLED@ CPX_DATA = @CPX_DATA@ CPX_DATA_INSTALLED = @CPX_DATA_INSTALLED@ CPX_DEPENDENCIES = @CPX_DEPENDENCIES@ CPX_LIBS = @CPX_LIBS@ CPX_LIBS_INSTALLED = @CPX_LIBS_INSTALLED@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ DYLP_CFLAGS = @DYLP_CFLAGS@ DYLP_CFLAGS_INSTALLED = @DYLP_CFLAGS_INSTALLED@ DYLP_DATA = @DYLP_DATA@ DYLP_DATA_INSTALLED = @DYLP_DATA_INSTALLED@ DYLP_DEPENDENCIES = @DYLP_DEPENDENCIES@ DYLP_LIBS = @DYLP_LIBS@ DYLP_LIBS_INSTALLED = @DYLP_LIBS_INSTALLED@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRB_CFLAGS = @GRB_CFLAGS@ GRB_CFLAGS_INSTALLED = @GRB_CFLAGS_INSTALLED@ GRB_DATA = @GRB_DATA@ GRB_DATA_INSTALLED = @GRB_DATA_INSTALLED@ GRB_DEPENDENCIES = @GRB_DEPENDENCIES@ GRB_LIBS = @GRB_LIBS@ GRB_LIBS_INSTALLED = @GRB_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MIPLIB3_CFLAGS = @MIPLIB3_CFLAGS@ MIPLIB3_CFLAGS_INSTALLED = @MIPLIB3_CFLAGS_INSTALLED@ MIPLIB3_DATA = @MIPLIB3_DATA@ MIPLIB3_DATA_INSTALLED = @MIPLIB3_DATA_INSTALLED@ MIPLIB3_DEPENDENCIES = @MIPLIB3_DEPENDENCIES@ MIPLIB3_LIBS = @MIPLIB3_LIBS@ MIPLIB3_LIBS_INSTALLED = @MIPLIB3_LIBS_INSTALLED@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSK_CFLAGS = @MSK_CFLAGS@ MSK_CFLAGS_INSTALLED = @MSK_CFLAGS_INSTALLED@ MSK_DATA = @MSK_DATA@ MSK_DATA_INSTALLED = @MSK_DATA_INSTALLED@ MSK_DEPENDENCIES = @MSK_DEPENDENCIES@ MSK_LIBS = @MSK_LIBS@ MSK_LIBS_INSTALLED = @MSK_LIBS_INSTALLED@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ NTYINCDIR = @NTYINCDIR@ NTYLIB = @NTYLIB@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICBC_DFLT_SOLVER_CLP_FALSE = @OSICBC_DFLT_SOLVER_CLP_FALSE@ OSICBC_DFLT_SOLVER_CLP_TRUE = @OSICBC_DFLT_SOLVER_CLP_TRUE@ OSICBC_DFLT_SOLVER_CPX_FALSE = @OSICBC_DFLT_SOLVER_CPX_FALSE@ OSICBC_DFLT_SOLVER_CPX_TRUE = @OSICBC_DFLT_SOLVER_CPX_TRUE@ OSICBC_DFLT_SOLVER_DYLP_FALSE = @OSICBC_DFLT_SOLVER_DYLP_FALSE@ OSICBC_DFLT_SOLVER_DYLP_TRUE = @OSICBC_DFLT_SOLVER_DYLP_TRUE@ OSICBC_DFLT_SOLVER_GLPK_FALSE = @OSICBC_DFLT_SOLVER_GLPK_FALSE@ OSICBC_DFLT_SOLVER_GLPK_TRUE = @OSICBC_DFLT_SOLVER_GLPK_TRUE@ OSICBC_DFLT_SOLVER_GRB_FALSE = @OSICBC_DFLT_SOLVER_GRB_FALSE@ OSICBC_DFLT_SOLVER_GRB_TRUE = @OSICBC_DFLT_SOLVER_GRB_TRUE@ OSICBC_DFLT_SOLVER_MSK_FALSE = @OSICBC_DFLT_SOLVER_MSK_FALSE@ OSICBC_DFLT_SOLVER_MSK_TRUE = @OSICBC_DFLT_SOLVER_MSK_TRUE@ OSICBC_DFLT_SOLVER_SPX_FALSE = @OSICBC_DFLT_SOLVER_SPX_FALSE@ OSICBC_DFLT_SOLVER_SPX_TRUE = @OSICBC_DFLT_SOLVER_SPX_TRUE@ OSICBC_DFLT_SOLVER_SYM_FALSE = @OSICBC_DFLT_SOLVER_SYM_FALSE@ OSICBC_DFLT_SOLVER_SYM_TRUE = @OSICBC_DFLT_SOLVER_SYM_TRUE@ OSICBC_DFLT_SOLVER_VOL_FALSE = @OSICBC_DFLT_SOLVER_VOL_FALSE@ OSICBC_DFLT_SOLVER_VOL_TRUE = @OSICBC_DFLT_SOLVER_VOL_TRUE@ OSICBC_DFLT_SOLVER_XPR_FALSE = @OSICBC_DFLT_SOLVER_XPR_FALSE@ OSICBC_DFLT_SOLVER_XPR_TRUE = @OSICBC_DFLT_SOLVER_XPR_TRUE@ OSITESTS_CFLAGS = @OSITESTS_CFLAGS@ OSITESTS_CFLAGS_INSTALLED = @OSITESTS_CFLAGS_INSTALLED@ OSITESTS_DATA = @OSITESTS_DATA@ OSITESTS_DATA_INSTALLED = @OSITESTS_DATA_INSTALLED@ OSITESTS_DEPENDENCIES = @OSITESTS_DEPENDENCIES@ OSITESTS_LIBS = @OSITESTS_LIBS@ OSITESTS_LIBS_INSTALLED = @OSITESTS_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SPX_CFLAGS = @SPX_CFLAGS@ SPX_CFLAGS_INSTALLED = @SPX_CFLAGS_INSTALLED@ SPX_DATA = @SPX_DATA@ SPX_DATA_INSTALLED = @SPX_DATA_INSTALLED@ SPX_DEPENDENCIES = @SPX_DEPENDENCIES@ SPX_LIBS = @SPX_LIBS@ SPX_LIBS_INSTALLED = @SPX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VOL_CFLAGS = @VOL_CFLAGS@ VOL_CFLAGS_INSTALLED = @VOL_CFLAGS_INSTALLED@ VOL_DATA = @VOL_DATA@ VOL_DATA_INSTALLED = @VOL_DATA_INSTALLED@ VOL_DEPENDENCIES = @VOL_DEPENDENCIES@ VOL_LIBS = @VOL_LIBS@ VOL_LIBS_INSTALLED = @VOL_LIBS_INSTALLED@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPR_CFLAGS = @XPR_CFLAGS@ XPR_CFLAGS_INSTALLED = @XPR_CFLAGS_INSTALLED@ XPR_DATA = @XPR_DATA@ XPR_DATA_INSTALLED = @XPR_DATA_INSTALLED@ XPR_DEPENDENCIES = @XPR_DEPENDENCIES@ XPR_LIBS = @XPR_LIBS@ XPR_LIBS_INSTALLED = @XPR_LIBS_INSTALLED@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## # Don't do src/OsiCbc recursively, since src/OsiCbc/libOsiCbc depends on src/libCbc SUBDIRS = src src/OsiCbc $(am__append_1) ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = doc/authors.xml doc/cbcexe.xml doc/cbcmodelclass.xml \ doc/cbcuserguide.xml doc/doxygen.xml doc/faqcontent.xml \ doc/faq.xml doc/intro.xml doc/legal.xml doc/messages.xml \ doc/moresamples.xml doc/osibuild.xml doc/otherclasses.xml \ doc/revhist.xml examples/CbcBranchFollow2.cpp \ examples/CbcBranchFollow2.hpp examples/CbcBranchLink.cpp \ examples/CbcBranchLink.hpp examples/CbcBranchUser.cpp \ examples/CbcBranchUser.hpp examples/CbcCompareUser.cpp \ examples/CbcCompareUser.hpp examples/CbcSolver2.cpp \ examples/CbcSolver2.hpp examples/CbcSolver3.cpp \ examples/CbcSolver3.hpp examples/CbcSolverLongThin.cpp \ examples/CbcSolverLongThin.hpp examples/CbcSolverLink.hpp \ examples/CbcSolverLink.cpp examples/ClpQuadInterface.cpp \ examples/ClpQuadInterface.hpp examples/OsiBranchLink.cpp \ examples/OsiBranchLink.hpp examples/OsiSolverLink.hpp \ examples/OsiSolverLink.cpp examples/crew.cpp \ examples/driver2.cpp examples/driver.cpp \ examples/fast0507b.cpp examples/fast0507.cpp examples/gear.cpp \ examples/hotstart.cpp examples/link.cpp examples/longthin.cpp \ examples/lotsize.cpp examples/Makefile.in examples/minimum.cpp \ examples/nway.cpp examples/qmip.cpp examples/quad2.mps \ examples/quad.mps examples/repeat.cpp examples/sample1.cpp \ examples/sample2.cpp examples/sample3.cpp examples/sample4.cpp \ examples/sample5.cpp examples/sos.cpp examples/sudoku.cpp \ examples/sudoku_sample.csv $(am__append_2) ######################################################################## # Installation of the addlibs file # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = cbc.pc osi-cbc.pc addlibsdir = $(DESTDIR)$(datadir)/coin/doc/Cbc ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = $(am__append_3) $(VPATH_DISTCLEANFILES) DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) COIN_HAS_DOXYGEN = @COIN_HAS_DOXYGEN_TRUE@TRUE COIN_HAS_LATEX = @COIN_HAS_LATEX_TRUE@TRUE all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/BuildTools/Makemain.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) examples/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ cbc.pc: $(top_builddir)/config.status $(srcdir)/cbc.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ cbc-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/cbc-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-cbc.pc: $(top_builddir)/config.status $(srcdir)/osi-cbc.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-cbc-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/osi-cbc-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ doxydoc/doxygen.conf: $(top_builddir)/config.status $(top_srcdir)/doxydoc/doxygen.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ 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; } \ END { 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: ctags-recursive $(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; } \ END { 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) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/BuildTools $(distdir)/doc $(distdir)/doxydoc $(distdir)/examples @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfiglibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-exec-am: install-exec-local install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-local \ uninstall-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-local \ clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-libtool distclean-local \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-exec install-exec-am \ install-exec-local install-info install-info-am install-man \ install-pkgconfiglibDATA install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-libtool \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-hook uninstall-info-am \ uninstall-local uninstall-pkgconfiglibDATA ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc install-data-hook: @$(mkdir_p) "$(addlibsdir)" @COIN_HAS_PKGCONFIG_TRUE@ PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ @COIN_HAS_PKGCONFIG_TRUE@ $(PKG_CONFIG) --libs cbc > $(addlibsdir)/cbc_addlibs.txt @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCbc.lib @CBCLIB_LIBS_INSTALLED@" > $(addlibsdir)/cbc_addlibs.txt @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lCbcSolver -lCbc @CBCLIB_LIBS_INSTALLED@ > $(addlibsdir)/cbc_addlibs.txt uninstall-hook: rm -f $(addlibsdir)/cbc_addlibs.txt doxygen-docs: if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ doxygen doxydoc/doxygen.conf;\ fi;\ fi pdf-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/latex"; then \ if test "$(COIN_HAS_LATEX)" = TRUE; then \ cd doxydoc/latex;\ $(MAKE) pdf;\ cd -;\ fi;\ fi;\ fi clean-doxygen-docs: if test -d "doxydoc/"; then \ cd doxydoc ;\ rm -rf html latex *.log *.tag;\ fi install-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc"; \ $(INSTALL_DATA) @coin_doxy_tagname@ "$(DESTDIR)$(DocInstallDir)/@coin_doxy_tagname@";\ if test -f "doxydoc/latex/refman.pdf"; then \ $(INSTALL_DATA) doxydoc/latex/refman.pdf "$(DESTDIR)$(DocInstallDir)";\ fi;\ if test -d "doxydoc/html"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/search/" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc/search/"; \ $(INSTALL_DATA) doxydoc/html/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc";\ $(INSTALL_DATA) doxydoc/html/search/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc/search";\ fi;\ fi;\ fi uninstall-doxygen-docs: if test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/"; then \ rm -rf "$(DESTDIR)$(DocInstallDir)/doxydoc/"; \ fi if test -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; then \ rm -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; \ fi all-doxygen-docs: for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) doxygen-docs) \ fi ; \ done ; clean-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) clean-doxygen-docs) \ fi ; \ done ; install-all-doxygen-docs: all-doxygen-docs for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) install-doxygen-docs) \ fi ; \ done ; uninstall-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) uninstall-doxygen-docs) \ fi ; \ done ; install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## # Make sure acinclude is using most recent coin.m4 @MAINTAINER_MODE_TRUE@$(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 @MAINTAINER_MODE_TRUE@ cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date @MAINTAINER_MODE_TRUE@$(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh @MAINTAINER_MODE_TRUE@ cp $< $@ # Take care of updating externals (if Dependencies file exists) @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@$(top_builddir)/Makefile: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@.Dependencies-stamp: $(srcdir)/Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); BuildTools/set_externals Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ touch .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@update-externals: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); svn update .PHONY: install-doc uninstall-doc update-externals # 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: CoinMP-1.8.3/Cbc/examples/0000755000175000017500000000000012600453456013626 5ustar renereneCoinMP-1.8.3/Cbc/examples/fast0507.cpp0000644000175000017500000002663212131054214015600 0ustar renerene// $Id: fast0507.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchUser.hpp" #include "CbcBranchCut.hpp" #include "CbcBranchToFixLots.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "CbcHeuristicGreedy.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcSolver3.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding.hpp" #include "CglMixedIntegerRounding2.hpp" // Preprocessing #include "CglPreProcess.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It then sets up some Cgl cut generators and calls branch and cut. Branching is simple binary branching on integer variables. Node selection is depth first until first solution is found and then based on objective and number of unsatisfied integer variables. In this example the functionality is the same as default but it is a user comparison function. Variable branching selection is on maximum minimum-of-up-down change after strong branching on 5 variables closest to 0.5. A simple rounding heuristic is used. ************************************************************************/ // ****** define comparison to choose best next node int main (int argc, const char *argv[]) { CbcSolver3 solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); /* Options are: preprocess to do preprocessing time in minutes if 2 parameters and numeric taken as time */ bool preProcess=false; double minutes=-1.0; int nGoodParam=0; for (int iParam=2; iParam=0.0) { nGoodParam+=2; iParam++; // skip time } } } } if (nGoodParam==0&&argc==3&&isdigit(argv[2][0])) { // If time is given then stop after that number of minutes minutes = atof(argv[2]); if (minutes>=0.0) nGoodParam=1; } if (nGoodParam!=argc-2) { printf("Usage [preprocess] [time ] or \n"); exit(1); } solver1.initialSolve(); // Reduce printout solver1.setHintParam(OsiDoReducePrint,true,OsiHintTry); // Say we want scaling //solver1.setHintParam(OsiDoScale,true,OsiHintTry); //solver1.setCleanupScaling(1); // See if we want preprocessing OsiSolverInterface * solver2=&solver1; CglPreProcess process; if (preProcess) { /* Do not try and produce equality cliques and do up to 5 passes */ solver2 = process.preProcess(solver1,false,5); if (!solver2) { printf("Pre-processing says infeasible\n"); exit(2); } solver2->resolve(); } CbcModel model(*solver2); // Point to solver OsiSolverInterface * solver3 = model.solver(); CbcSolver3 * osiclp = dynamic_cast< CbcSolver3*> (solver3); assert (osiclp); const double fractionFix=0.985; osiclp->initialize(&model,NULL); osiclp->setAlgorithm(2); osiclp->setMemory(1000); osiclp->setNested(fractionFix); //osiclp->setNested(1.0); //off // Set up some cut generators and defaults // Probing first as gets tight bounds on continuous CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(3); // Number of unsatisfied variables to look at generator1.setMaxProbe(10); // How far to follow the consequences generator1.setMaxLook(50); // Only look at rows with fewer than this number of elements generator1.setMaxElements(200); generator1.setRowCuts(3); CglGomory generator2; // try larger limit generator2.setLimit(300); CglKnapsackCover generator3; CglOddHole generator4; generator4.setMinimumViolation(0.005); generator4.setMinimumViolationPer(0.00002); // try larger limit generator4.setMaximumEntries(200); CglClique generator5; generator5.setStarCliqueReport(false); generator5.setRowCliqueReport(false); CglMixedIntegerRounding mixedGen; /* This is same as default constructor - (1,true,1) I presume if maxAggregate larger then slower but maybe better criterion can be 1 through 3 Reference: Hugues Marchand and Laurence A. Wolsey Aggregation and Mixed Integer Rounding to Solve MIPs Operations Research, 49(3), May-June 2001. */ int maxAggregate=1; bool multiply=true; int criterion=1; CglMixedIntegerRounding2 mixedGen2(maxAggregate,multiply,criterion); CglFlowCover flowGen; // Add in generators // Experiment with -1 and -99 etc model.addCutGenerator(&generator1,-99,"Probing"); //model.addCutGenerator(&generator2,-1,"Gomory"); //model.addCutGenerator(&generator3,-1,"Knapsack"); //model.addCutGenerator(&generator4,-1,"OddHole"); //model.addCutGenerator(&generator5,-1,"Clique"); //model.addCutGenerator(&flowGen,-1,"FlowCover"); //model.addCutGenerator(&mixedGen,-1,"MixedIntegerRounding"); //model.addCutGenerator(&mixedGen2,-1,"MixedIntegerRounding2"); // Say we want timings int numberGenerators = model.numberCutGenerators(); int iGenerator; for (iGenerator=0;iGeneratorsetTiming(true); } // Allow rounding heuristic CbcRounding heuristic1(model); model.addHeuristic(&heuristic1); // And Greedy heuristic CbcHeuristicGreedyCover heuristic2(model); // Use original upper and perturb more heuristic2.setAlgorithm(11); model.addHeuristic(&heuristic2); // Redundant definition of default branching (as Default == User) CbcBranchUserDecision branch; model.setBranchingMethod(&branch); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); int iColumn; int numberColumns = solver3->getNumCols(); // do pseudo costs CbcObject ** objects = new CbcObject * [numberColumns+1]; const CoinPackedMatrix * matrix = solver3->getMatrixByCol(); // Column copy const int * columnLength = matrix->getVectorLengths(); const double * objective = model.getObjCoefficients(); int n=0; for (iColumn=0;iColumnisInteger(iColumn)) { double costPer = objective[iColumn]/ ((double) columnLength[iColumn]); CbcSimpleIntegerPseudoCost * newObject = new CbcSimpleIntegerPseudoCost(&model,n,iColumn, costPer,costPer); newObject->setMethod(3); objects[n++]= newObject; } } // and special fix lots branch objects[n++]=new CbcBranchToFixLots(&model,-1.0e-6,fractionFix+0.01,1,0,NULL); model.addObjects(n,objects); for (iColumn=0;iColumnsetIntParam(OsiMaxNumIterationHotStart,100); // If time is given then stop after that number of minutes if (minutes>=0.0) { std::cout<<"Stopping after "<setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } //model.messageHandler()->setLogLevel(2); //model.solver()->messageHandler()->setLogLevel(2); //model.setPrintFrequency(50); #define DEBUG_CUTS #ifdef DEBUG_CUTS // Set up debugger by name (only if no preprocesing) if (!preProcess) { std::string problemName ; //model.solver()->getStrParam(OsiProbName,problemName) ; //model.solver()->activateRowCutDebugger(problemName.c_str()) ; model.solver()->activateRowCutDebugger("cap6000a") ; } #endif // Do complete search try { model.branchAndBound(); } catch (CoinError e) { e.print(); if (e.lineNumber()>=0) std::cout<<"This was from a CoinAssert"<cutGeneratorName()<<" was tried " <numberTimesEntered()<<" times and created " <numberCutsInTotal()<<" cuts of which " <numberCutsActive()<<" were active after adding rounds of cuts"; if (generator->timing()) std::cout<<" ( "<timeInCutGenerator()<<" seconds)"<getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout< #include #include #include "CoinPragma.hpp" #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchUser.hpp" #include "CoinSort.hpp" // Default Constructor // Default Constructor CbcBranchUserDecision::CbcBranchUserDecision() :CbcBranchDecision() { } // Copy constructor CbcBranchUserDecision::CbcBranchUserDecision ( const CbcBranchUserDecision & rhs) :CbcBranchDecision(rhs) { } CbcBranchUserDecision::~CbcBranchUserDecision() { } // Clone CbcBranchDecision * CbcBranchUserDecision::clone() const { return new CbcBranchUserDecision(*this); } // Initialize i.e. before start of choosing at a node void CbcBranchUserDecision::initialize(CbcModel * model) { } /* Returns nonzero if branching on first object is "better" than on second (if second NULL first wins). User can play with decision object. This is only used after strong branching. The initial selection is done by infeasibility() for each CbcObject return code +1 for up branch preferred, -1 for down */ int CbcBranchUserDecision::betterBranch(CbcBranchingObject * thisOne, CbcBranchingObject * bestSoFar, double changeUp, int numberInfeasibilitiesUp, double changeDown, int numberInfeasibilitiesDown) { printf("Now obsolete CbcBranchUserDecision::betterBranch\n"); abort(); return 0; } /* Compare N branching objects. Return index of best and sets way of branching in chosen object. This routine is used only after strong branching. This is reccommended version as it can be more sophisticated */ int CbcBranchUserDecision::bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied, double * changeUp, int * numberInfeasibilitiesUp, double * changeDown, int * numberInfeasibilitiesDown, double objectiveValue) { int bestWay=0; int whichObject = -1; if (numberObjects) { CbcModel * model = objects[0]->model(); // at continuous //double continuousObjective = model->getContinuousObjective(); //int continuousInfeasibilities = model->getContinuousInfeasibilities(); // average cost to get rid of infeasibility //double averageCostPerInfeasibility = //(objectiveValue-continuousObjective)/ //(double) (abs(continuousInfeasibilities-numberUnsatisfied)+1); /* beforeSolution is : 0 - before any solution n - n heuristic solutions but no branched one -1 - branched solution found */ int numberSolutions = model->getSolutionCount(); double cutoff = model->getCutoff(); int method=0; int i; if (numberSolutions) { int numberHeuristic = model->getNumberHeuristicSolutions(); if (numberHeuristicnumberInfeasibilitiesDown[i]) { if (numberInfeasibilitiesDown[i]bestCriterion) betterWay=1; } else { if (changeDown[i]>bestCriterion) betterWay=-1; } if (betterWay) { bestCriterion = CoinMin(changeUp[i],changeDown[i]); whichObject = i; bestWay = betterWay; } } break; case 2: for ( i = 0 ; i < numberObjects ; i++) { double change = CoinMin(changeUp[i],changeDown[i]); double sum = changeUp[i] + changeDown[i]; bool take=false; if (change>1.1*bestCriterion) take=true; else if (change>0.9*bestCriterion&&sum+change>bestCriterion+alternativeCriterion) take=true; if (take) { if (changeUp[i]<=changeDown[i]) { if (changeUp[i]>bestCriterion) bestWay=1; } else { if (changeDown[i]>bestCriterion) bestWay=-1; } bestCriterion = change; alternativeCriterion = sum; whichObject = i; } } break; case 3: for ( i = 0 ; i < numberObjects ; i++) { int numberNext = numberInfeasibilitiesUp[i]; if (numberNextnumberInfeasibilitiesDown[i]) { if (numberInfeasibilitiesDown[i]=0) objects[whichObject]->way(bestWay); } return whichObject; } /** Default Constructor Equivalent to an unspecified binary variable. */ CbcSimpleIntegerFixed::CbcSimpleIntegerFixed () : CbcSimpleInteger() { } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ CbcSimpleIntegerFixed::CbcSimpleIntegerFixed (CbcModel * model, int iColumn, double breakEven) : CbcSimpleInteger(model,iColumn,breakEven) { } // Constructor from simple CbcSimpleIntegerFixed::CbcSimpleIntegerFixed (const CbcSimpleInteger & rhs) : CbcSimpleInteger(rhs) { } // Copy constructor CbcSimpleIntegerFixed::CbcSimpleIntegerFixed ( const CbcSimpleIntegerFixed & rhs) :CbcSimpleInteger(rhs) { } // Clone CbcObject * CbcSimpleIntegerFixed::clone() const { return new CbcSimpleIntegerFixed(*this); } // Assignment operator CbcSimpleIntegerFixed & CbcSimpleIntegerFixed::operator=( const CbcSimpleIntegerFixed& rhs) { if (this!=&rhs) { CbcSimpleInteger::operator=(rhs); } return *this; } // Destructor CbcSimpleIntegerFixed::~CbcSimpleIntegerFixed () { } // Infeasibility - large is 0.5 double CbcSimpleIntegerFixed::infeasibility(int & preferredWay) const { OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); /*printf("%d %g %g %g %g\n",columnNumber_,value,lower[columnNumber_], solution[columnNumber_],upper[columnNumber_]);*/ double nearest = floor(value+(1.0-breakEven_)); assert (breakEven_>0.0&&breakEven_<1.0); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); if (nearest>value) preferredWay=1; else preferredWay=-1; if (preferredWay_) preferredWay=preferredWay_; double weight = fabs(value-nearest); // normalize so weight is 0.5 at break even if (nearesttestSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); assert (upper[columnNumber_]>lower[columnNumber_]); if (!model_->hotstartSolution()) { double nearest = floor(value+0.5); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); if (fabs(value-nearest)hotstartSolution(); double targetValue = hotstartSolution[columnNumber_]; if (way>0) value = targetValue-0.1; else value = targetValue+0.1; } CbcBranchingObject * branch = new CbcIntegerBranchingObject(model_,columnNumber_,way, value); branch->setOriginalObject(this); return branch; } CoinMP-1.8.3/Cbc/examples/driver3.cpp0000644000175000017500000001116112131054214015674 0ustar renerene// $Id: driver3.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPragma.hpp" #include "CbcModel.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcBranchDynamic.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program shows how to take advantage of the standalone cbc in your program. It should perform very nearly the same as cbc First it reads in an integer model from an mps file and saves and strips off integer information. Then it initializes the integer model with cbc defaults Then it puts back integers - here you could do anything and also set parameters Then it calls CbcMain1 passing all parameters apart from first Finally it prints solution ************************************************************************/ int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; //#define USE_OSI_NAMES #ifdef USE_OSI_NAMES // Say we are keeping names (a bit slower this way) solver1.setIntParam(OsiNameDiscipline,1); #endif // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } // Strip off integer information and save int numberColumns = solver1.getNumCols(); char * integer = new char[numberColumns]; int i; for (i=0;isetInteger(i); } #else CbcObject ** objects = new CbcObject * [ numberColumns]; int n=0; for (i=0;i2) { CbcMain1(argc-1,argv+1,model); } else { const char * argv2[]={"driver3","-solve","-quit"}; CbcMain1(3,argv2,model); } // Print solution if finished (could get from model.bestSolution() as well if (solver->getObjValue()*solver->getObjSense()<1.0e50) { const double * solution = solver->getColSolution(); int iColumn; std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout<getColName(iColumn) <1.0e-7&&solver->isInteger(iColumn)) std::cout<columnName(iColumn) < #include // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchUser.hpp" #include "CbcBranchActual.hpp" #include "CbcCompareUser.hpp" #include "CoinTime.hpp" #include "OsiClpSolverInterface.hpp" //############################################################################# /************************************************************************ This main program reads in an SOS model (rgn) from an mps file. It then solves it three ways :- a) As normal b) SOS 1 c) SOS 2 (so answer will be different) ************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; //solver1.messageHandler()->setLogLevel(0); CbcModel model(solver1); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Read in rgn.mps std::string mpsFileName; #if defined(MIPLIB3DIR) mpsFileName = MIPLIB3DIR "/rgn"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find miplib3 MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = model.solver()->readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } // Definition of node choice CbcCompareUser compare; compare.setWeight(0.0); model.setNodeComparison(compare); // Reduce output model.messageHandler()->setLogLevel(1); // Get branching messages model.messageHandler()->setLogLevel(3); // Do initial solve to continuous model.initialSolve(); // Save model CbcModel model2 = model; int numberColumns=model.getNumCols(); int numberIntegers = 0; int * integerVariable = new int[numberColumns]; int i; for ( i=0;igetColSolution(); std::cout<1.0e-7) std::cout<addCols(4,start,row,element,NULL,up,NULL); // Now use SOS1 int numberSets=4; int which[104]; double weights[104]; int starts[5]; // load int n=0; starts[0]=0; for (int iSet=0;iSet<4;iSet++) { for (int i=0;i<25;i++) { weights[n]=i+1.0; which[n]=iSet*25+i; n++; } // slack - make sure first branch is on slack weights[n]=1000.0; which[n]=180+iSet; n++; starts[iSet+1]=n; } for (i=0;isetContinuous(iColumn); } // save model in this state CbcModel modelSOS = model; CbcObject ** objects = new CbcObject * [numberSets]; for (i=0;igetColSolution(); std::cout<1.0e-7) std::cout<getColSolution(); std::cout<1.0e-7) std::cout< #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcStrategy.hpp" #include "CbcBranchUser.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "OsiClpSolverInterface.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglRedSplit.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding2.hpp" // Preprocessing #include "CglPreProcess.hpp" // Heuristics #include "CbcHeuristic.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It then sets up some Cgl cut generators and calls branch and cut. Then it uses solution as hot start ************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); /* Options are: preprocess to do preprocessing time in minutes if 2 parameters and numeric taken as time */ bool preProcess=false; double minutes=-1.0; int nGoodParam=0; for (int iParam=2; iParam=0.0) { nGoodParam+=2; iParam++; // skip time } } } } if (nGoodParam==0&&argc==3&&isdigit(argv[2][0])) { // If time is given then stop after that number of minutes minutes = atof(argv[2]); if (minutes>=0.0) nGoodParam=1; } if (nGoodParam!=argc-2&&argc>=2) { printf("Usage [preprocess] [time ] or \n"); exit(1); } //solver1.getModelPtr()->setLogLevel(0); solver1.messageHandler()->setLogLevel(0); solver1.initialSolve(); // Reduce printout solver1.setHintParam(OsiDoReducePrint,true,OsiHintTry); CbcModel model(solver1); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Set up some cut generators and defaults // Probing first as gets tight bounds on continuous CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(1); generator1.setMaxPassRoot(5); // Number of unsatisfied variables to look at generator1.setMaxProbe(10); generator1.setMaxProbeRoot(1000); // How far to follow the consequences generator1.setMaxLook(50); generator1.setMaxLookRoot(500); // Only look at rows with fewer than this number of elements generator1.setMaxElements(200); generator1.setRowCuts(3); CglGomory generator2; // try larger limit generator2.setLimit(300); CglKnapsackCover generator3; CglRedSplit generator4; // try larger limit generator4.setLimit(200); CglClique generator5; generator5.setStarCliqueReport(false); generator5.setRowCliqueReport(false); CglMixedIntegerRounding2 mixedGen; CglFlowCover flowGen; // Add in generators // Experiment with -1 and -99 etc model.addCutGenerator(&generator1,-1,"Probing"); model.addCutGenerator(&generator2,-1,"Gomory"); model.addCutGenerator(&generator3,-1,"Knapsack"); // model.addCutGenerator(&generator4,-1,"RedSplit"); model.addCutGenerator(&generator5,-1,"Clique"); model.addCutGenerator(&flowGen,-1,"FlowCover"); model.addCutGenerator(&mixedGen,-1,"MixedIntegerRounding"); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (model.solver()); // go faster stripes if (osiclp) { // Turn this off if you get problems // Used to be automatically set osiclp->setSpecialOptions(128); if(osiclp->getNumRows()<300&&osiclp->getNumCols()<500) { //osiclp->setupForRepeatedUse(2,1); osiclp->setupForRepeatedUse(0,1); } } // Uncommenting this should switch off most CBC messages //model.messagesPointer()->setDetailMessages(10,5,5000); // Allow rounding heuristic CbcRounding heuristic1(model); model.addHeuristic(&heuristic1); // Redundant definition of default branching (as Default == User) CbcBranchUserDecision branch; model.setBranchingMethod(&branch); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); // Do initial solve to continuous model.initialSolve(); // Could tune more double objValue = model.solver()->getObjSense()*model.solver()->getObjValue(); double minimumDropA=CoinMin(1.0,fabs(objValue)*1.0e-3+1.0e-4); double minimumDrop= fabs(objValue)*1.0e-4+1.0e-4; printf("min drop %g (A %g)\n",minimumDrop,minimumDropA); model.setMinimumDrop(minimumDrop); if (model.getNumCols()<500) model.setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (model.getNumCols()<5000) model.setMaximumCutPassesAtRoot(100); // use minimum drop else model.setMaximumCutPassesAtRoot(20); model.setMaximumCutPasses(10); //model.setMaximumCutPasses(2); // Switch off strong branching if wanted // model.setNumberStrong(0); // Do more strong branching if small if (model.getNumCols()<5000) model.setNumberStrong(10); model.setNumberStrong(20); //model.setNumberStrong(5); model.setNumberBeforeTrust(5); //model.setSizeMiniTree(2); model.solver()->setIntParam(OsiMaxNumIterationHotStart,100); // Switch off most output if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } model.messageHandler()->setLogLevel(6); model.solver()->messageHandler()->setLogLevel(1); // If time is given then stop after that number of minutes if (minutes>=0.0) { std::cout<<"Stopping after "<getNumCols(); double * bestSolution=NULL; int * priority = new int[numberColumns]; // Do two passes for (int iPass=0;iPass<2;iPass++) { time1 = CoinCpuTime(); // Do hot start on second pass if (bestSolution) { model.setHotstartSolution(bestSolution,priority); delete [] bestSolution; bestSolution=NULL; delete [] priority; model.setMaximumNodes(40000); } else { model.setMaximumNodes(40000); } // Do complete search model.branchAndBound(); std::cout<getNumCols(); const double * solution = solver->getColSolution(); // save solution if (!iPass) { bestSolution = CoinCopyOfArray(solution,numberColumns); for (int i=0;i0.5) priority[i]=-1; else priority[i]=2; } } //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); // Get names from solver1 (as OsiSolverInterface may lose) std::vector columnNames = *solver1.getModelPtr()->columnNames(); int iColumn; std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout< #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchUser.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "CbcHeuristicGreedy.hpp" #include "CbcSolver2.hpp" #include "CoinModel.hpp" // Cuts #include "CglProbing.hpp" #include "CoinTime.hpp" /************************************************************************ This main program reads in an integer model from an mps file. It expects it to be unit coefficients and unit rhs and long and thin Branching is simple binary branching on integer variables. */ int main (int argc, const char *argv[]) { // Define a Solver for long thin problems CbcSolver2 solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); solver1.initialSolve(); // Reduce printout solver1.setHintParam(OsiDoReducePrint,true,OsiHintTry); OsiSolverInterface * solver2=&solver1; CbcModel model(*solver2); // Point to solver OsiSolverInterface * solver3 = model.solver(); CbcSolver2 * osiclp = dynamic_cast< CbcSolver2*> (solver3); assert (osiclp); osiclp->initialize(&model,NULL); osiclp->setAlgorithm(2); osiclp->setMemory(1000); // Set up some cut generators and defaults // Probing first as gets tight bounds on continuous CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(3); // Number of unsatisfied variables to look at generator1.setMaxProbe(10); // How far to follow the consequences generator1.setMaxLook(50); // Only look at rows with fewer than this number of elements generator1.setMaxElements(200); generator1.setRowCuts(3); // Add in generators // Experiment with -1 and -99 etc model.addCutGenerator(&generator1,-99,"Probing"); // Allow rounding heuristic CbcRounding heuristic1(model); model.addHeuristic(&heuristic1); // And Greedy heuristic CbcHeuristicGreedyCover heuristic2(model); // Use original upper and perturb more heuristic2.setAlgorithm(11); model.addHeuristic(&heuristic2); // Redundant definition of default branching (as Default == User) CbcBranchUserDecision branch; model.setBranchingMethod(&branch); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); int iColumn; int numberColumns = solver3->getNumCols(); // do pseudo costs CbcObject ** objects = new CbcObject * [numberColumns]; const CoinPackedMatrix * matrix = solver3->getMatrixByCol(); // Column copy const int * columnLength = matrix->getVectorLengths(); const double * objective = model.getObjCoefficients(); int numberIntegers=0; for (iColumn=0;iColumnisInteger(iColumn)) { /* Branching up gets us much closer to an integer solution so we want to encourage up - so we will branch up if variable value > 0.333333. The expected cost of going up obviously depends on the cost of the variable so we just choose pseudo costs to reflect that. We could also decide to try and use the pseudo costs to make it more likely to branch on a variable with many coefficients. This leads to the computation below. */ double cost = objective[iColumn]*(1.0 + 0.2*((double) columnLength[iColumn])); CbcSimpleIntegerPseudoCost * newObject = new CbcSimpleIntegerPseudoCost(&model,iColumn, 2.0*cost,cost); newObject->setMethod(3); objects[numberIntegers++]= newObject; } } model.addObjects(numberIntegers,objects); for (iColumn=0;iColumnsetSpecialOptions(16); // We had better allow a lot model.solver()->setIntParam(OsiMaxNumIterationHotStart,10000); // So use strategy to keep rows osiclp->setStrategy(1); // Switch off most output if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } //model.setPrintFrequency(50); // Do complete search try { model.branchAndBound(); } catch (CoinError e) { e.print(); if (e.lineNumber()>=0) std::cout<<"This was from a CoinAssert"<getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout< #include #include "CoinPragma.hpp" #include "OsiClpSolverInterface.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in a model from an mps file. It then tells the OsiClpSolver to use barrier for initialSolve The cryptic code was generated by playing around with "clp" and using -cpp option. So clp input.mps -cpp 1 -barrier created a user_driver.cpp from which the lines between ===== were taken ************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; // Taken from a user_driver.cpp // ======================= ClpSolve::SolveType method = ClpSolve::useBarrier; ClpSolve::PresolveType presolveType = ClpSolve::presolveOn; int numberPasses = 5; #ifndef UFL_BARRIER int options[] = {0,0,0,0,0,0}; #else // we can use UFL code int options[] = {0,0,0,0,4,0}; #endif int extraInfo[] = {-1,-1,-1,-1,-1,-1}; int independentOptions[] = {0,0,3}; ClpSolve clpSolve(method,presolveType,numberPasses, options,extraInfo,independentOptions); // ======================= // now pass options in solver1.setSolveOptions(clpSolve); // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); solver1.initialSolve(); std::cout< #include #include "CoinPragma.hpp" #include "CbcModel.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcSolver.hpp" #include "CoinTime.hpp" #include "CoinSignal.hpp" /* This shows how to trap signals. This just traps ctrl-c and allows user to pause and then hit S or C In this simple version Stop may not be effective until a heuristic has exited */ static CbcModel * currentBranchModel=NULL; extern "C" { static void signal_handler(int whichSignal) { int gotChar='X'; while (toupper(gotChar)!='S'&&toupper(gotChar)!='C') { // See what user wants to do fprintf(stderr,"Enter S to stop, C to continue:"); gotChar = getchar(); } if (currentBranchModel != NULL&&toupper(gotChar)=='S') { currentBranchModel->sayEventHappened(); // say why stopped if (currentBranchModel->heuristicModel()) currentBranchModel->heuristicModel()->sayEventHappened(); } return; } } static CoinSighandler_t saveSignal=signal(SIGINT,signal_handler); //############################################################################# /************************************************************************ This main program shows how to take advantage of the standalone cbc in your program, while still making major modifications. First it reads in an integer model from an mps file Then it initializes the integer model with cbc defaults Then it calls CbcMain1 passing all parameters apart from first but with callBack to modify stuff Finally it prints solution ************************************************************************/ /* Meaning of whereFrom: 1 after initial solve by dualsimplex etc 2 after preprocessing 3 just before branchAndBound (so user can override) 4 just after branchAndBound (before postprocessing) 5 after postprocessing */ /* Meaning of model status is as normal status -1 before branchAndBound 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found (or check value of best solution) 1 stopped - on maxnodes, maxsols, maxtime 2 difficulties so run was abandoned (5 event user programmed event occurred) cbc secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 linear relaxation not feasible (or worse than cutoff) 2 stopped on gap 3 stopped on nodes 4 stopped on time 5 stopped on user event 6 stopped on solutions 7 linear relaxation unbounded but initially check if status is 0 and secondary status is 1 -> infeasible or you can check solver status. */ /* Return non-zero to return quickly */ static int callBack(CbcModel * model, int whereFrom) { int returnCode=0; switch (whereFrom) { case 1: case 2: if (!model->status()&&model->secondaryStatus()) returnCode=1; break; case 3: { // set up signal trapping saveSignal=signal(SIGINT,signal_handler); currentBranchModel=model; } break; case 4: { // restore signal(SIGINT,saveSignal); currentBranchModel=NULL; } // If not good enough could skip postprocessing break; case 5: break; default: abort(); } return returnCode; } #include "CbcEventHandler.hpp" /** This is so user can trap events and do useful stuff. CbcModel model_ is available as well as anything else you care to pass in */ class MyEventHandler3 : public CbcEventHandler { public: /**@name Overrides */ //@{ virtual CbcAction event(CbcEvent whichEvent); //@} /**@name Constructors, destructor etc*/ //@{ /** Default constructor. */ MyEventHandler3(); /// Constructor with pointer to model (redundant as setEventHandler does) MyEventHandler3(CbcModel * model); /** Destructor */ virtual ~MyEventHandler3(); /** The copy constructor. */ MyEventHandler3(const MyEventHandler3 & rhs); /// Assignment MyEventHandler3& operator=(const MyEventHandler3 & rhs); /// Clone virtual CbcEventHandler * clone() const ; //@} protected: // data goes here }; //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- MyEventHandler3::MyEventHandler3 () : CbcEventHandler() { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- MyEventHandler3::MyEventHandler3 (const MyEventHandler3 & rhs) : CbcEventHandler(rhs) { } // Constructor with pointer to model MyEventHandler3::MyEventHandler3(CbcModel * model) : CbcEventHandler(model) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- MyEventHandler3::~MyEventHandler3 () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- MyEventHandler3 & MyEventHandler3::operator=(const MyEventHandler3& rhs) { if (this != &rhs) { CbcEventHandler::operator=(rhs); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CbcEventHandler * MyEventHandler3::clone() const { return new MyEventHandler3(*this); } CbcEventHandler::CbcAction MyEventHandler3::event(CbcEvent whichEvent) { // If in sub tree carry on if (!model_->parentModel()) { if (whichEvent==solution||whichEvent==heuristicSolution) { #ifdef STOP_EARLY return stop; // say finished #else // If preprocessing was done solution will be to processed model int numberColumns = model_->getNumCols(); const double * bestSolution = model_->bestSolution(); assert (bestSolution); printf("value of solution is %g\n",model_->getObjValue()); for (int i=0;i1.0e-8) printf("%d %g\n",i,bestSolution[i]); } return noAction; // carry on #endif } else { return noAction; // carry on } } else { return noAction; // carry on } } int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; //#define USE_OSI_NAMES #ifdef USE_OSI_NAMES // Say we are keeping names (a bit slower this way) solver1.setIntParam(OsiNameDiscipline,1); #endif // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } // Tell solver to return fast if presolve or initial solve infeasible solver1.getModelPtr()->setMoreSpecialOptions(3); // Pass to Cbc initialize defaults CbcModel modelA(solver1); CbcModel * model = &modelA; CbcMain0(modelA); // Event handler MyEventHandler3 eventHandler; model->passInEventHandler(&eventHandler); /* Now go into code for standalone solver Could copy arguments and add -quit at end to be safe but this will do */ if (argc>2) { CbcMain1(argc-1,argv+1,modelA,callBack); } else { const char * argv2[]={"driver6","-solve","-quit"}; CbcMain1(3,argv2,modelA,callBack); } // Solver was cloned so get current copy OsiSolverInterface * solver = model->solver(); // Print solution if finished (could get from model->bestSolution() as well if (model->bestSolution()) { const double * solution = solver->getColSolution(); int iColumn; int numberColumns = solver->getNumCols(); std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout<getColName(iColumn) <1.0e-7&&solver->isInteger(iColumn)) std::cout<columnName(iColumn) < #include // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchUser.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "CbcHeuristicLocal.hpp" #include "OsiClpSolverInterface.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding.hpp" // Heuristics #include "CbcHeuristic.hpp" // Methods of building #include "CoinBuild.hpp" #include "CoinModel.hpp" #include "CoinTime.hpp" /************************************************************************ This main program creates an integer model and then solves it It then sets up some Cgl cut generators and calls branch and cut. Branching is simple binary branching on integer variables. Node selection is depth first until first solution is found and then based on objective and number of unsatisfied integer variables. In this example the functionality is the same as default but it is a user comparison function. Variable branching selection is on maximum minimum-of-up-down change after strong branching on 5 variables closest to 0.5. A simple rounding heuristic is used. ************************************************************************/ int main (int argc, const char *argv[]) { /* Define your favorite OsiSolver. CbcModel clones the solver so use solver1 up to the time you pass it to CbcModel then use a pointer to cloned solver (model.solver()) */ OsiClpSolverInterface solver1; /* From now on we can build model in a solver independent way. You can add rows one at a time but for large problems this is slow so this example uses CoinBuild or CoinModel */ OsiSolverInterface * solver = &solver1; // Data (is exmip1.mps in Mps/Sample // Objective double objValue[]={1.0,2.0,0.0,0.0,0.0,0.0,0.0,-1.0}; // Lower bounds for columns double columnLower[]={2.5,0.0,0.0,0.0,0.5,0.0,0.0,0.0}; // Upper bounds for columns double columnUpper[]={COIN_DBL_MAX,4.1,1.0,1.0,4.0, COIN_DBL_MAX,COIN_DBL_MAX,4.3}; // Lower bounds for row activities double rowLower[]={2.5,-COIN_DBL_MAX,-COIN_DBL_MAX,1.8,3.0}; // Upper bounds for row activities double rowUpper[]={COIN_DBL_MAX,2.1,4.0,5.0,15.0}; // Matrix stored packed int column[] = {0,1,3,4,7, 1,2, 2,5, 3,6, 4,7}; double element[] = {3.0,1.0,-2.0,-1.0,-1.0, 2.0,1.1, 1.0,1.0, 2.8,-1.2, 1.0,1.9}; int starts[]={0,5,7,9,11,13}; // Integer variables (note upper bound already 1.0) int whichInt[]={2,3}; int numberRows=(int) (sizeof(rowLower)/sizeof(double)); int numberColumns=(int) (sizeof(columnLower)/sizeof(double)); #define BUILD 2 #if BUILD==1 // Using CoinBuild // First do columns (objective and bounds) int i; // We are not adding elements for (i=0;iaddCol(0,NULL,NULL,columnLower[i],columnUpper[i], objValue[i]); } // mark as integer for (i=0;i<(int) (sizeof(whichInt)/sizeof(int));i++) solver->setInteger(whichInt[i]); // Now build rows CoinBuild build; for (i=0;iaddRows(build); #else /* using CoinModel - more flexible but still beta. Can do exactly same way but can mix and match much more. Also all operations are on building object */ CoinModel build; // First do columns (objective and bounds) int i; for (i=0;iloadFromCoinModel(build); #endif // Pass to solver CbcModel model(*solver); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Set up some cut generators and defaults // Probing first as gets tight bounds on continuous CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(3); generator1.setMaxProbe(100); generator1.setMaxLook(50); generator1.setRowCuts(3); // generator1.snapshot(*model.solver()); //generator1.createCliques(*model.solver(),2,1000,true); //generator1.setMode(0); CglGomory generator2; // try larger limit generator2.setLimit(300); CglKnapsackCover generator3; CglOddHole generator4; generator4.setMinimumViolation(0.005); generator4.setMinimumViolationPer(0.00002); // try larger limit generator4.setMaximumEntries(200); CglClique generator5; generator5.setStarCliqueReport(false); generator5.setRowCliqueReport(false); CglMixedIntegerRounding mixedGen; CglFlowCover flowGen; // Add in generators model.addCutGenerator(&generator1,-1,"Probing"); model.addCutGenerator(&generator2,-1,"Gomory"); model.addCutGenerator(&generator3,-1,"Knapsack"); model.addCutGenerator(&generator4,-1,"OddHole"); model.addCutGenerator(&generator5,-1,"Clique"); model.addCutGenerator(&flowGen,-1,"FlowCover"); model.addCutGenerator(&mixedGen,-1,"MixedIntegerRounding"); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (model.solver()); // go faster stripes if (osiclp->getNumRows()<300&&osiclp->getNumCols()<500) { osiclp->setupForRepeatedUse(2,0); printf("trying slightly less reliable but faster version (? Gomory cuts okay?)\n"); printf("may not be safe if doing cuts in tree which need accuracy (level 2 anyway)\n"); } // Allow rounding heuristic CbcRounding heuristic1(model); model.addHeuristic(&heuristic1); // And local search when new solution found CbcHeuristicLocal heuristic2(model); model.addHeuristic(&heuristic2); // Redundant definition of default branching (as Default == User) CbcBranchUserDecision branch; model.setBranchingMethod(&branch); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); // Do initial solve to continuous model.initialSolve(); // Could tune more model.setMinimumDrop(CoinMin(1.0, fabs(model.getMinimizationObjValue())*1.0e-3+1.0e-4)); if (model.getNumCols()<500) model.setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (model.getNumCols()<5000) model.setMaximumCutPassesAtRoot(100); // use minimum drop else model.setMaximumCutPassesAtRoot(20); //model.setMaximumCutPasses(5); // Switch off strong branching if wanted // model.setNumberStrong(0); // Do more strong branching if small if (model.getNumCols()<5000) model.setNumberStrong(10); model.solver()->setIntParam(OsiMaxNumIterationHotStart,100); // If time is given then stop after that number of minutes if (argc>2) { int minutes = atoi(argv[2]); std::cout<<"Stopping after "<=0); model.setDblParam(CbcModel::CbcMaximumSeconds,60.0*minutes); } // Switch off most output if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } double time1 = CoinCpuTime(); // Do complete search model.branchAndBound(); std::cout<<" Branch and cut took "<cutGeneratorName()<<" was tried " <numberTimesEntered()<<" times and created " <numberCutsInTotal()<<" cuts of which " <numberCutsActive()<<" were active after adding rounds of cuts" <getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout< #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CoinModel.hpp" // For all different #include "CbcBranchCut.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchAllDifferent.hpp" #include "CbcCutGenerator.hpp" #include "CglAllDifferent.hpp" #include "OsiClpSolverInterface.hpp" #include "CglStored.hpp" #include "CoinTime.hpp" /************************************************************************ This shows how we can define a new branching method to solve problems with all different constraints. We are going to solve a sudoku problem such as 1, , ,4, , ,7, , ,2, , ,5, , ,8, 8,7,3, , ,6, , ,9 4, , ,7, , ,1, , ,5, , ,8, , ,2, , ,6, ,4,9, , ,3 7, , ,1, , ,4, , ,8, ,6,2, , ,5, , ,9, ,7,3, ,1,6 The input should be exported from spreadsheet as a csv file where cells are empty unless value is known. We set up a fake objective and simple constraints to say sum must be 45 and then we add all different branching (CbcBranchAllDifferent) and all different cuts (to fix variables) (CglAllDifferent). CbcBranchAllDifferent is really just an example of a cut branch. If we wish to stop x==y then we can have two branches - one x <= y-1 and the other x >= y+1. It should be easy for the user to make up similar cut branches for other uses. Note - this is all we need to solve most 9 x 9 puzzles because they seem to solve at root node or easily. To solve 16 x 16 puzzles we need more. All different cuts need general integer variables to be fixed while we can branch so they are just at bounds. To get round that we can introduce extra 0-1 variables such that general integer x = sum j * delta j and then do N way branching on these (CbcNWay) so that we fix one delta j to 1. At the same time we use the new class CbcConsequence (used in N way branching) which when delta j goes to 1 fixes other variables. So it will fix x to the correct value and while we are at it we can fix some delta variables in other sets to zero (as per all different rules). Finally as well as storing the instructions which say if delta 11 is 1 then delta 21 is 0 we can also add this in as a cut using new trivial cut class CglStored. ************************************************************************/ int main (int argc, const char *argv[]) { // Get data std::string fileName = "./sudoku_sample.csv"; if (argc>=2) fileName = argv[1]; FILE * fp = fopen(fileName.c_str(),"r"); if (!fp) { printf("Unable to open file %s\n",fileName.c_str()); exit(0); } #define MAX_SIZE 16 int valueOffset=1; double lo[MAX_SIZE*MAX_SIZE],up[MAX_SIZE*MAX_SIZE]; char line[80]; int row,column; /*************************************** Read .csv file and see if 9 or 16 Su Doku ***************************************/ int size=9; for (row=0;row=32) { if (line[get]==',') size++; get++; } assert (size==9||size==16); printf("Solving Su Doku of size %d\n",size); if (size==16) valueOffset=0; } int get=0; for (column=0;column=32) { // skip blanks if (line[get]==' ') { get++; continue; } int value = line[get]-'0'; if (size==9) { assert (value>=1&&value<=9); } else { assert (size==16); if (value<0||value>9) { if (line[get]=='"') { get++; value = 10 + line[get]-'A'; if (value<10||value>15) { value = 10 + line[get]-'a'; } get++; } else { value = 10 + line[get]-'A'; if (value<10||value>15) { value = 10 + line[get]-'a'; } } } assert (value>=0&&value<=15); } lo[size*row+column]=value; up[size*row+column]=value; get++; } get++; } } int block_size = (int) sqrt ((double) size); /*************************************** Now build rules for all different 3*9 or 3*16 sets of variables Number variables by row*size+column ***************************************/ int starts[3*MAX_SIZE+1]; int which[3*MAX_SIZE*MAX_SIZE]; int put=0; int set=0; starts[0]=0; // By row for (row=0;rowsetHintParam(OsiDoReducePrint,true,OsiHintTry); model.solver()->setHintParam(OsiDoScale,false,OsiHintTry); /*************************************** Add in All different cut generator and All different branching So we will have integers then cut branching then N way branching in reverse priority order ***************************************/ // Cut generator CglAllDifferent allDifferent(3*size,starts,which); model.addCutGenerator(&allDifferent,-99,"allDifferent"); model.cutGenerator(0)->setWhatDepth(5); CbcObject ** objects = new CbcObject * [4*size*size]; int nObj=0; for (row=0;row<3*size;row++) { int iStart = starts[row]; objects[row]= new CbcBranchAllDifferent(&model,size,which+iStart); objects[row]->setPriority(2000+nObj); // do after rest satisfied nObj++; } /*************************************** Add in N way branching and while we are at it add in cuts ***************************************/ CglStored stored; for (row=0;rowsetConsequence(indices[i],fix); // Now do as cuts for (int kk=1;kkkColumn) { cutInd[1]=jColumn; stored.addCut(-COIN_DBL_MAX,1.0,2,cutInd,values); } } } objects[nObj]= obj; objects[nObj]->setPriority(nObj); nObj++; } } model.addObjects(nObj,objects); for (row=0;rowsetLogLevel(1); model.addCutGenerator(&stored,1,"stored"); // Say we want timings int numberGenerators = model.numberCutGenerators(); int iGenerator; for (iGenerator=0;iGeneratorsetTiming(true); } // Set this to get all solutions (all ones in newspapers should only have one) //model.setCutoffIncrement(-1.0e6); /*************************************** Do branch and bound ***************************************/ // Do complete search model.branchAndBound(); std::cout<<"took "<=lo[put]&&value<=up[put]); // save for later test lo[put++]=value; printf("%d ",value); } printf("\n"); } // check valid bool valid=true; // By row for (row=0;row #include #include //#define CBC_DEBUG #include "CoinPragma.hpp" #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchLink.hpp" #include "CoinError.hpp" #include "CoinPackedMatrix.hpp" // Default Constructor CbcLink::CbcLink () : CbcObject(), weights_(NULL), numberMembers_(0), numberLinks_(0), which_(NULL), sosType_(1) { } // Useful constructor (which are indices) CbcLink::CbcLink (CbcModel * model, int numberMembers, int numberLinks, int first , const double * weights, int identifier) : CbcObject(model), numberMembers_(numberMembers), numberLinks_(numberLinks), which_(NULL), sosType_(1) { id_=identifier; if (numberMembers_) { weights_ = new double[numberMembers_]; which_ = new int[numberMembers_*numberLinks_]; if (weights) { memcpy(weights_,weights,numberMembers_*sizeof(double)); } else { for (int i=0;iweights_[i-1]+1.0e-12); for (i=0;iweights_[i-1]+1.0e-12); for (i=0;isolver(); const double * solution = model_->testSolution(); //const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double weight = 0.0; double sum =0.0; // check bounds etc double lastWeight=-1.0e100; int base=0; for (j=0;j=weights_[j]-1.0e-7) throw CoinError("Weights too close together in CBCLink","infeasibility","CbcLink"); double value = CoinMax(0.0,solution[iColumn]); sum += value; if (value>integerTolerance&&upper[iColumn]) { // Possibly due to scaling a fixed variable might slip through if (value>upper[iColumn]+1.0e-8) { // Could change to #ifdef CBC_DEBUG #ifndef NDEBUG if (model_->messageHandler()->logLevel()>1) printf("** Variable %d (%d) has value %g and upper bound of %g\n", iColumn,j,value,upper[iColumn]); #endif } value = CoinMin(value,upper[iColumn]); weight += weights_[j]*value; if (firstNonZero<0) firstNonZero=j; lastNonZero=j; } } base += numberLinks_; } double valueInfeasibility; preferredWay=1; if (lastNonZero-firstNonZero>=sosType_) { // find where to branch assert (sum>0.0); weight /= sum; valueInfeasibility = lastNonZero-firstNonZero+1; valueInfeasibility *= 0.5/((double) numberMembers_); //#define DISTANCE #ifdef DISTANCE assert (sosType_==1); // code up /* may still be satisfied. For LOS type 2 we might wish to move coding around and keep initial info in model_ for speed */ int iWhere; bool possible=false; for (iWhere=firstNonZero;iWhere<=lastNonZero;iWhere++) { if (fabs(weight-weights_[iWhere])<1.0e-8) { possible=true; break; } } if (possible) { // One could move some of this (+ arrays) into model_ const CoinPackedMatrix * matrix = solver->getMatrixByCol(); const double * element = matrix->getMutableElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * rowSolution = solver->getRowActivity(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int numberRows = matrix->getNumRows(); double * array = new double [numberRows]; CoinZeroN(array,numberRows); int * which = new int [numberRows]; int n=0; int base=numberLinks_*firstNonZero; for (j=firstNonZero;j<=lastNonZero;j++) { for (int k=0;kintegerTolerance&&upper[iColumn]) { value = CoinMin(value,upper[iColumn]); for (int j=columnStart[iColumn];j1.0e-8) { if (distance+rowSolution[iRow]>rowUpper[iRow]+1.0e-8) { possible=false; break; } } else if (distance<-1.0e-8) { if (distance+rowSolution[iRow]solver(); const double * solution = model_->testSolution(); const double * upper = solver->getColUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double weight = 0.0; double sum =0.0; int base=0; for (j=0;jintegerTolerance&&upper[iColumn]) { weight += weights_[j]*value; if (firstNonZero<0) firstNonZero=j; lastNonZero=j; } } base += numberLinks_; } #ifdef DISTANCE if (lastNonZero-firstNonZero>sosType_-1) { /* may still be satisfied. For LOS type 2 we might wish to move coding around and keep initial info in model_ for speed */ int iWhere; bool possible=false; for (iWhere=firstNonZero;iWhere<=lastNonZero;iWhere++) { if (fabs(weight-weights_[iWhere])<1.0e-8) { possible=true; break; } } if (possible) { // One could move some of this (+ arrays) into model_ const CoinPackedMatrix * matrix = solver->getMatrixByCol(); const double * element = matrix->getMutableElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * rowSolution = solver->getRowActivity(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int numberRows = matrix->getNumRows(); double * array = new double [numberRows]; CoinZeroN(array,numberRows); int * which = new int [numberRows]; int n=0; int base=numberLinks_*firstNonZero; for (j=firstNonZero;j<=lastNonZero;j++) { for (int k=0;kintegerTolerance&&upper[iColumn]) { value = CoinMin(value,upper[iColumn]); for (int j=columnStart[iColumn];j1.0e-8) { if (distance+rowSolution[iRow]>rowUpper[iRow]+1.0e-8) { possible=false; break; } } else if (distance<-1.0e-8) { if (distance+rowSolution[iRow]setColUpper(iColumn,0.0); } base += numberLinks_; } // skip base += numberLinks_; for (j=lastNonZero+1;jsetColUpper(iColumn,0.0); } base += numberLinks_; } } // Creates a branching object CbcBranchingObject * CbcLink::createCbcBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * /*info*/, int way) { int j; const double * solution = model_->testSolution(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); OsiSolverInterface * solver = model_->solver(); const double * upper = solver->getColUpper(); int firstNonFixed=-1; int lastNonFixed=-1; int firstNonZero=-1; int lastNonZero = -1; double weight = 0.0; double sum =0.0; int base=0; for (j=0;jintegerTolerance) { weight += weights_[j]*value; if (firstNonZero<0) firstNonZero=j; lastNonZero=j; } } } base += numberLinks_; } assert (lastNonZero-firstNonZero>=sosType_) ; // find where to branch assert (sum>0.0); weight /= sum; int iWhere; double separator=0.0; for (iWhere=firstNonZero;iWhereid(),way,0.5) { set_ = set; separator_ = separator; } // Copy constructor CbcLinkBranchingObject::CbcLinkBranchingObject ( const CbcLinkBranchingObject & rhs) :CbcBranchingObject(rhs) { set_=rhs.set_; separator_ = rhs.separator_; } // Assignment operator CbcLinkBranchingObject & CbcLinkBranchingObject::operator=( const CbcLinkBranchingObject& rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); set_=rhs.set_; separator_ = rhs.separator_; } return *this; } CbcBranchingObject * CbcLinkBranchingObject::clone() const { return (new CbcLinkBranchingObject(*this)); } // Destructor CbcLinkBranchingObject::~CbcLinkBranchingObject () { } double CbcLinkBranchingObject::branch() { decrementNumberBranchesLeft(); int numberMembers = set_->numberMembers(); int numberLinks = set_->numberLinks(); const double * weights = set_->weights(); const int * which = set_->which(); OsiSolverInterface * solver = model_->solver(); //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); // *** for way - up means fix all those in down section if (way_<0) { int i; for ( i=0;i separator_) break; } assert (isetColUpper(iColumn,0.0); } base += numberLinks; } way_=1; // Swap direction } else { int i; int base=0; for ( i=0;i= separator_) { break; } else { for (int k=0;ksetColUpper(iColumn,0.0); } base += numberLinks; } } assert (inumberMembers(); int numberLinks = set_->numberLinks(); const double * weights = set_->weights(); const int * which = set_->which(); OsiSolverInterface * solver = model_->solver(); const double * upper = solver->getColUpper(); int first=numberMembers; int last=-1; int numberFixed=0; int numberOther=0; int i; int base=0; for ( i=0;i separator_) break; for (int k=0;k= separator_) break; for (int k=0;k %d (%g), %d would be fixed, %d other way\n", separator_,first,weights[first],last,weights[last],numberFixed/numberLinks, numberOther/numberLinks); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcLinkBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap) { throw("must implement"); } CoinMP-1.8.3/Cbc/examples/interrupt.cpp0000644000175000017500000003045112131054770016364 0ustar renerene// $Id: interrupt.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPragma.hpp" #include "CbcModel.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcSolver.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program shows how to take advantage of the standalone cbc in your program, while still making major modifications. This is very like driver4 but allows interrupts in clp for faster stopping It would be up to user to clean up output as stopping in Clp seems to give correct results but can think it is stopping in an odd way. To make cleaner would need more events defined (in Cbc AND Clp) First it reads in an integer model from an mps file Then it initializes the integer model with cbc defaults Then it calls CbcMain1 passing all parameters apart from first but with callBack to modify stuff Finally it prints solution ************************************************************************/ /* Meaning of whereFrom: 1 after initial solve by dualsimplex etc 2 after preprocessing 3 just before branchAndBound (so user can override) 4 just after branchAndBound (before postprocessing) 5 after postprocessing */ /* Meaning of model status is as normal status -1 before branchAndBound 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found (or check value of best solution) 1 stopped - on maxnodes, maxsols, maxtime 2 difficulties so run was abandoned (5 event user programmed event occurred) cbc secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 linear relaxation not feasible (or worse than cutoff) 2 stopped on gap 3 stopped on nodes 4 stopped on time 5 stopped on user event 6 stopped on solutions 7 linear relaxation unbounded but initially check if status is 0 and secondary status is 1 -> infeasible or you can check solver status. */ /* Return non-zero to return quickly */ static int callBack(CbcModel * model, int whereFrom) { int returnCode=0; switch (whereFrom) { case 1: case 2: if (!model->status()&&model->secondaryStatus()) returnCode=1; break; case 3: { //CbcCompareUser compare; //model->setNodeComparison(compare); } break; case 4: // If not good enough could skip postprocessing break; case 5: break; default: abort(); } return returnCode; } #include "CbcEventHandler.hpp" static int cancelAsap=0; /* 0 - not yet in Cbc 1 - in Cbc with new signal handler 2 - ending Cbc */ static int statusOfCbc=0; #include "CoinSignal.hpp" static CoinSighandler_t saveSignal = static_cast (0); extern "C" { static void #if defined(_MSC_VER) __cdecl #endif // _MSC_VER signal_handler(int /*whichSignal*/) { cancelAsap=3; return; } } /** This is so user can trap events and do useful stuff. CbcModel model_ is available as well as anything else you care to pass in */ class MyEventHandler3 : public CbcEventHandler { public: /**@name Overrides */ //@{ virtual CbcAction event(CbcEvent whichEvent); //@} /**@name Constructors, destructor etc*/ //@{ /** Default constructor. */ MyEventHandler3(); /// Constructor with pointer to model (redundant as setEventHandler does) MyEventHandler3(CbcModel * model); /** Destructor */ virtual ~MyEventHandler3(); /** The copy constructor. */ MyEventHandler3(const MyEventHandler3 & rhs); /// Assignment MyEventHandler3& operator=(const MyEventHandler3 & rhs); /// Clone virtual CbcEventHandler * clone() const ; //@} protected: // data goes here }; //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- MyEventHandler3::MyEventHandler3 () : CbcEventHandler() { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- MyEventHandler3::MyEventHandler3 (const MyEventHandler3 & rhs) : CbcEventHandler(rhs) { } // Constructor with pointer to model MyEventHandler3::MyEventHandler3(CbcModel * model) : CbcEventHandler(model) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- MyEventHandler3::~MyEventHandler3 () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- MyEventHandler3 & MyEventHandler3::operator=(const MyEventHandler3& rhs) { if (this != &rhs) { CbcEventHandler::operator=(rhs); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CbcEventHandler * MyEventHandler3::clone() const { return new MyEventHandler3(*this); } CbcEventHandler::CbcAction MyEventHandler3::event(CbcEvent whichEvent) { if(!statusOfCbc) { // override signal handler // register signal handler saveSignal = signal(SIGINT, signal_handler); statusOfCbc=1; } if ( (cancelAsap&2)!=0 ) { printf("Cbc got cancel\n"); // switch off Clp cancel cancelAsap &= 2; return stop; } // If in sub tree carry on if (!model_->parentModel()) { if (whichEvent==endSearch&&statusOfCbc==1) { // switch off cancel cancelAsap=0; // restore signal handler signal(SIGINT, saveSignal); statusOfCbc=2; } if (whichEvent==solution||whichEvent==heuristicSolution) { #ifdef STOP_EARLY return stop; // say finished #else #ifdef WANT_SOLUTION // If preprocessing was done solution will be to processed model int numberColumns = model_->getNumCols(); const double * bestSolution = model_->bestSolution(); assert (bestSolution); printf("value of solution is %g\n",model_->getObjValue()); for (int i=0;i1.0e-8) printf("%d %g\n",i,bestSolution[i]); } #endif return noAction; // carry on #endif } else { return noAction; // carry on } } else { return noAction; // carry on } } /** This is so user can trap events and do useful stuff. ClpSimplex model_ is available as well as anything else you care to pass in */ class MyEventHandler4 : public ClpEventHandler { public: /**@name Overrides */ //@{ virtual int event(Event whichEvent); //@} /**@name Constructors, destructor etc*/ //@{ /** Default constructor. */ MyEventHandler4(); /// Constructor with pointer to model (redundant as setEventHandler does) MyEventHandler4(ClpSimplex * model); /** Destructor */ virtual ~MyEventHandler4(); /** The copy constructor. */ MyEventHandler4(const MyEventHandler4 & rhs); /// Assignment MyEventHandler4& operator=(const MyEventHandler4 & rhs); /// Clone virtual ClpEventHandler * clone() const ; //@} protected: // data goes here }; //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- MyEventHandler4::MyEventHandler4 () : ClpEventHandler() { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- MyEventHandler4::MyEventHandler4 (const MyEventHandler4 & rhs) : ClpEventHandler(rhs) { } // Constructor with pointer to model MyEventHandler4::MyEventHandler4(ClpSimplex * model) : ClpEventHandler(model) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- MyEventHandler4::~MyEventHandler4 () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- MyEventHandler4 & MyEventHandler4::operator=(const MyEventHandler4& rhs) { if (this != &rhs) { ClpEventHandler::operator=(rhs); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpEventHandler * MyEventHandler4::clone() const { return new MyEventHandler4(*this); } int MyEventHandler4::event(Event whichEvent) { if ( (cancelAsap&1)!=0 ) { printf("Clp got cancel\n"); return 5; } else { return -1; } } int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; //#define USE_OSI_NAMES #ifdef USE_OSI_NAMES // Say we are keeping names (a bit slower this way) solver1.setIntParam(OsiNameDiscipline,1); #endif // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } // Tell solver to return fast if presolve or initial solve infeasible solver1.getModelPtr()->setMoreSpecialOptions(3); // allow Clp to handle interrupts MyEventHandler4 clpEventHandler; solver1.getModelPtr()->passInEventHandler(&clpEventHandler); /* Two ways of doing this depending on whether NEW_STYLE_SOLVER defined. So we need pointer to model. Old way could use modelA. rather than model-> */ // Messy code below copied from CbcSolver.cpp #if NEW_STYLE_SOLVER==0 // Pass to Cbc initialize defaults CbcModel modelA(solver1); CbcModel * model = &modelA; CbcMain0(modelA); // Event handler MyEventHandler3 eventHandler; model->passInEventHandler(&eventHandler); /* Now go into code for standalone solver Could copy arguments and add -quit at end to be safe but this will do */ if (argc>2) { CbcMain1(argc-1,argv+1,modelA,callBack); } else { const char * argv2[]={"driver4","-solve","-quit"}; CbcMain1(3,argv2,modelA,callBack); } #else CbcSolver control(solver1); // initialize control.fillValuesInSolver(); // Event handler MyEventHandler3 eventHandler; CbcModel * model = control.model(); model->passInEventHandler(&eventHandler); control.solve (argc-1, argv+1, 1); #endif // Solver was cloned so get current copy OsiSolverInterface * solver = model->solver(); // Print solution if finished (could get from model->bestSolution() as well if (model->bestSolution()) { const double * solution = solver->getColSolution(); int iColumn; int numberColumns = solver->getNumCols(); std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout<getColName(iColumn) <1.0e-7&&solver->isInteger(iColumn)) std::cout<columnName(iColumn) < #include // For Branch and bound //#include "CbcStrategy.hpp" #include "CoinPragma.hpp" #include "OsiCbcSolverInterface.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It then uses default strategy - just cuts at root node ************************************************************************/ int main (int argc, const char *argv[]) { // This would just do cuts at root // OsiCbcSolverInterface solver1; // This does cuts in tree and uses Clp CbcStrategyDefault strategy(false); OsiCbcSolverInterface solver1(NULL,&strategy); // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); // Do complete search solver1.branchAndBound(); std::cout<1.0e-7&&solver1.isInteger(iColumn)) std::cout< #include #include "CoinPragma.hpp" #include "CbcModel.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcSolver.hpp" #include "CbcHeuristicDiveCoefficient.hpp" #include "CbcHeuristicDiveFractional.hpp" #include "CbcHeuristicDiveGuided.hpp" #include "CbcHeuristicDiveVectorLength.hpp" #include "CbcHeuristicDivePseudoCost.hpp" #include "CbcHeuristicDiveLineSearch.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program shows how to take advantage of the standalone cbc in your program, while still making major modifications. First it reads in an integer model from an mps file Then it initializes the integer model with cbc defaults Then it calls CbcMain1 passing all parameters apart from first but with callBack to modify stuff Finally it prints solution ************************************************************************/ /* Meaning of whereFrom: 1 after initial solve by dualsimplex etc 2 after preprocessing 3 just before branchAndBound (so user can override) 4 just after branchAndBound (before postprocessing) 5 after postprocessing */ /* Meaning of model status is as normal status -1 before branchAndBound 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found (or check value of best solution) 1 stopped - on maxnodes, maxsols, maxtime 2 difficulties so run was abandoned (5 event user programmed event occurred) cbc secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 linear relaxation not feasible (or worse than cutoff) 2 stopped on gap 3 stopped on nodes 4 stopped on time 5 stopped on user event 6 stopped on solutions 7 linear relaxation unbounded but initially check if status is 0 and secondary status is 1 -> infeasible or you can check solver status. */ /* Return non-zero to return quickly */ static int callBack(CbcModel * model, int whereFrom) { int returnCode=0; switch (whereFrom) { case 1: case 2: if (!model->status()&&model->secondaryStatus()) returnCode=1; break; case 3: { // Add in some diving heuristics with different options CbcHeuristicDiveCoefficient heuristicDC(*model); heuristicDC.setHeuristicName("DiveCoefficient"); // do if no solution heuristicDC.setWhen(3); // 150 passes and fix general integers heuristicDC.setMaxIterations(151); // make sure can do as many simplex iterations as wanted heuristicDC.setMaxSimplexIterations(COIN_INT_MAX); heuristicDC.setMaxSimplexIterationsAtRoot(COIN_INT_MAX); model->addHeuristic(&heuristicDC) ; CbcHeuristicDiveFractional heuristicDF(*model); heuristicDF.setHeuristicName("DiveFractional"); // do if no solution heuristicDF.setWhen(3); // 150 passes and don't fix general integers heuristicDF.setMaxIterations(150); // make sure can do as many simplex iterations as wanted heuristicDF.setMaxSimplexIterations(COIN_INT_MAX); heuristicDF.setMaxSimplexIterationsAtRoot(COIN_INT_MAX); model->addHeuristic(&heuristicDF) ; CbcHeuristicDiveGuided heuristicDG(*model); heuristicDG.setHeuristicName("DiveGuided"); // do if no solution heuristicDG.setWhen(3); // 200 passes and fix general integers heuristicDG.setMaxIterations(201); // make sure can do as many simplex iterations as wanted heuristicDG.setMaxSimplexIterations(COIN_INT_MAX); heuristicDG.setMaxSimplexIterationsAtRoot(COIN_INT_MAX); model->addHeuristic(&heuristicDG) ; CbcHeuristicDiveVectorLength heuristicDV(*model); heuristicDV.setHeuristicName("DiveVectorLength"); // do if no solution heuristicDV.setWhen(3); // 150 passes and fix general integers heuristicDV.setMaxIterations(151); // make sure can do as many simplex iterations as wanted heuristicDV.setMaxSimplexIterations(COIN_INT_MAX); heuristicDV.setMaxSimplexIterationsAtRoot(COIN_INT_MAX); model->addHeuristic(&heuristicDV) ; // Second version! CbcHeuristicDiveVectorLength heuristicDV2(*model); heuristicDV2.setHeuristicName("DiveVectorLength"); // do if no solution heuristicDV2.setWhen(3); // 300 passes and don't fix general integers heuristicDV2.setMaxIterations(300); // fix fewer heuristicDV2.setPercentageToFix(0.05); // make sure can do as many simplex iterations as wanted heuristicDV2.setMaxSimplexIterations(COIN_INT_MAX); heuristicDV2.setMaxSimplexIterationsAtRoot(COIN_INT_MAX); model->addHeuristic(&heuristicDV2) ; CbcHeuristicDivePseudoCost heuristicDP(*model); heuristicDP.setHeuristicName("DivePseudoCost"); // do if no solution heuristicDP.setWhen(3); // 100 passes and don't fix general integers heuristicDP.setMaxIterations(100); // make sure can do as many simplex iterations as wanted heuristicDP.setMaxSimplexIterations(COIN_INT_MAX); heuristicDP.setMaxSimplexIterationsAtRoot(COIN_INT_MAX); model->addHeuristic(&heuristicDP) ; CbcHeuristicDiveLineSearch heuristicDL(*model); heuristicDL.setHeuristicName("DiveLineSearch"); // do if no solution heuristicDL.setWhen(3); // 150 passes and fix general integers heuristicDL.setMaxIterations(151); // make sure can do as many simplex iterations as wanted heuristicDL.setMaxSimplexIterations(COIN_INT_MAX); heuristicDL.setMaxSimplexIterationsAtRoot(COIN_INT_MAX); model->addHeuristic(&heuristicDL) ; //CbcCompareUser compare; //model->setNodeComparison(compare); } break; case 4: // If not good enough could skip postprocessing break; case 5: break; default: abort(); } return returnCode; } #include "CbcEventHandler.hpp" /** This is so user can trap events and do useful stuff. CbcModel model_ is available as well as anything else you care to pass in */ class MyEventHandler3 : public CbcEventHandler { public: /**@name Overrides */ //@{ virtual CbcAction event(CbcEvent whichEvent); //@} /**@name Constructors, destructor etc*/ //@{ /** Default constructor. */ MyEventHandler3(); /// Constructor with pointer to model (redundant as setEventHandler does) MyEventHandler3(CbcModel * model); /** Destructor */ virtual ~MyEventHandler3(); /** The copy constructor. */ MyEventHandler3(const MyEventHandler3 & rhs); /// Assignment MyEventHandler3& operator=(const MyEventHandler3 & rhs); /// Clone virtual CbcEventHandler * clone() const ; //@} protected: // data goes here }; //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- MyEventHandler3::MyEventHandler3 () : CbcEventHandler() { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- MyEventHandler3::MyEventHandler3 (const MyEventHandler3 & rhs) : CbcEventHandler(rhs) { } // Constructor with pointer to model MyEventHandler3::MyEventHandler3(CbcModel * model) : CbcEventHandler(model) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- MyEventHandler3::~MyEventHandler3 () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- MyEventHandler3 & MyEventHandler3::operator=(const MyEventHandler3& rhs) { if (this != &rhs) { CbcEventHandler::operator=(rhs); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CbcEventHandler * MyEventHandler3::clone() const { return new MyEventHandler3(*this); } CbcEventHandler::CbcAction MyEventHandler3::event(CbcEvent whichEvent) { // If in sub tree carry on if (!model_->parentModel()) { if (whichEvent==solution||whichEvent==heuristicSolution) { #ifdef STOP_EARLY return stop; // say finished #else // If preprocessing was done solution will be to processed model int numberColumns = model_->getNumCols(); const double * bestSolution = model_->bestSolution(); assert (bestSolution); printf("value of solution is %g\n",model_->getObjValue()); for (int i=0;i1.0e-8) printf("%d %g\n",i,bestSolution[i]); } return noAction; // carry on #endif } else { return noAction; // carry on } } else { return noAction; // carry on } } int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; //#define USE_OSI_NAMES #ifdef USE_OSI_NAMES // Say we are keeping names (a bit slower this way) solver1.setIntParam(OsiNameDiscipline,1); #endif // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } // Tell solver to return fast if presolve or initial solve infeasible solver1.getModelPtr()->setMoreSpecialOptions(3); /* Two ways of doing this depending on whether NEW_STYLE_SOLVER defined. So we need pointer to model. Old way could use modelA. rather than model-> */ // Messy code below copied from CbcSolver.cpp // Pass to Cbc initialize defaults CbcModel modelA(solver1); CbcModel * model = &modelA; CbcMain0(modelA); // Event handler MyEventHandler3 eventHandler; model->passInEventHandler(&eventHandler); /* Now go into code for standalone solver Could copy arguments and add -quit at end to be safe but this will do */ if (argc>2) { CbcMain1(argc-1,argv+1,modelA,callBack); } else { const char * argv2[]={"driver4","-solve","-quit"}; CbcMain1(3,argv2,modelA,callBack); } // Solver was cloned so get current copy OsiSolverInterface * solver = model->solver(); // Print solution if finished (could get from model->bestSolution() as well if (model->bestSolution()) { const double * solution = solver->getColSolution(); int iColumn; int numberColumns = solver->getNumCols(); std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout<getColName(iColumn) <1.0e-7&&solver->isInteger(iColumn)) std::cout<columnName(iColumn) < #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CoinModel.hpp" // For Linked Ordered Sets #include "CbcBranchLink.hpp" #include "OsiClpSolverInterface.hpp" #include "CoinTime.hpp" /************************************************************************ This shows how we can define a new branching method to solve problems with nonlinearities and discontinuities. We are going to solve the problem minimize 10.0*x + y + z - w where x, y are continuous between 1 and 10, z can take the values 0, 0.1, 0.2 up to 1.0 and w can take the values 0 or 1. There is one constraint w <= x*z**2 + y*sqrt(z) One could try to use logarithms to make the problem separable but that is a very weak formulation as we want to branch on z directly. The answer is the concept of linked special ordered sets. The generalization with column generation can be even more powerful but here we are limiting z to discrete values to avoid column generation. The idea is simple: A linear variable is a convex combination of its lower bound and upper bound! If x must lie between 2 and 10 then we can substitute for x as x == 2.0*xl + 10.0*xu where xl + xu == 1.0. At first this looks cumbersome but if we have xl0, xl1, ... xl10 and corresponding xu and yl and yu then we can write: x == sum 2.0*xl[i] + 10.0* xu[i] where sum xl[i] + xu[i] == 1.0 and x*z**2 == 0.02*xl1 + 0.1*xu1 + 0.08*xl2 + 0.4*xu2 .... + 2.0*xl10 + 10.0*xu10 with similar substitutions for y and y*sqrt(z) And now the problem is satisfied if w is 0 or 1 and xl[i], xu[i], yl[i] and yu[i] are only nonzero for one i. So this is just like a special ordered set of type 1 but on four sets simultaneously. Also note that convexity requirements for any non-linear functions are not needed. So we need a new branching method to do that - see CbcBranchLink.?pp We are going to need a CbcBranchLink method to see whether we are satisfied etc and also to create another branching object which knows how to fix variables. We might be able to use an existing method for the latter but let us create two methods CbcLink and CbcLinkBranchingObject. For CbcLink we will need the following methods: Constructot/Destructor infeasibility - returns 0.0 if feasible otherwise some measure of infeasibility feasibleRegion - sets bounds to contain current solution createBranch - creates a CbcLinkBranchingObject For CbcLinkBranchingObject we need: Constructor/Destructor branch - does actual fixing print - optional for debug purposes. The easiest way to do this is to cut and paste from CbcBranchActual to get current SOS stuff and then modify that. ************************************************************************/ int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; // Create model CoinModel build; // Keep x,y and z for reporting purposes in rows 0,1,2 // Do these double value=1.0; int row=-1; // x row=0; build.addColumn(1,&row,&value,1.0,10.0,10.0); // y row=1; build.addColumn(1,&row,&value,1.0,10.0,1.0); // z row=2; build.addColumn(1,&row,&value,0.0,1.0,1.0); // w row=3; build.addColumn(1,&row,&value,0.0,1.0,-1.0); build.setInteger(3); // Do columns so we know where each is int i; for (i=4;i<4+44;i++) build.setColumnBounds(i,0.0,1.0); // Now do rows // x build.setRowBounds(0,0.0,0.0); for (i=0;i<11;i++) { // xl build.setElement(0,4+4*i,-1.0); // xu build.setElement(0,4+4*i+1,-10.0); } // y build.setRowBounds(1,0.0,0.0); for (i=0;i<11;i++) { // yl build.setElement(1,4+4*i+2,-1.0); // yu build.setElement(1,4+4*i+3,-10.0); } // z - just use x part build.setRowBounds(2,0.0,0.0); for (i=0;i<11;i++) { // xl build.setElement(2,4+4*i,-0.1*i); // xu build.setElement(2,4+4*i+1,-0.1*i); } // w <= x*z**2 + y* sqrt(z) build.setRowBounds(3,-COIN_DBL_MAX,0.0); for (i=0;i<11;i++) { double value = 0.1*i; // xl * z**2 build.setElement(3,4+4*i,-1.0*value*value); // xu * z**2 build.setElement(3,4+4*i+1,-10.0*value*value); // yl * sqrt(z) build.setElement(3,4+4*i+2,-1.0*sqrt(value)); // yu * sqrt(z) build.setElement(3,4+4*i+3,-10.0*sqrt(value)); } // and convexity for x and y // x build.setRowBounds(4,1.0,1.0); for (i=0;i<11;i++) { // xl build.setElement(4,4+4*i,1.0); // xu build.setElement(4,4+4*i+1,1.0); } // y build.setRowBounds(5,1.0,1.0); for (i=0;i<11;i++) { // yl build.setElement(5,4+4*i+2,1.0); // yu build.setElement(5,4+4*i+3,1.0); } solver1.loadFromCoinModel(build); // To make CbcBranchLink simpler assume that all variables with same i are consecutive double time1 = CoinCpuTime(); solver1.initialSolve(); solver1.writeMps("bad"); CbcModel model(solver1); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Although just one set - code as if more CbcObject ** objects = new CbcObject * [1]; /* Format is number in sets, number in each link, first variable in matrix) and then a weight for each in set to say where to branch. Finally a set number as ID. */ double where[]={0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0}; objects[0]=new CbcLink(&model,11,4,4,where,0); model.addObjects(1,objects); delete objects[0]; delete [] objects; // Do complete search model.branchAndBound(); std::cout<<"took "<1.0e-7) { if (which==-1) which=i; else assert (which==i); } } } double x=solution[0]; double y=solution[1]; double z=solution[2]; double w=solution[3]; // check z assert (fabs(z-0.1*((double) which))<1.0e-7); printf("Optimal solution when x is %g, y %g, z %g and w %g\n", x,y,z,w); printf("solution should be %g\n",10.0*x+y+z-w); } return 0; } CoinMP-1.8.3/Cbc/examples/ClpQuadInterface.cpp0000644000175000017500000001062611510742723017506 0ustar renerene// $Id: ClpQuadInterface.cpp 1574 2011-01-05 01:13:55Z lou $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinHelperFunctions.hpp" //#include "CoinIndexedVector.hpp" #include "ClpQuadraticObjective.hpp" #include "ClpLinearObjective.hpp" #include "ClpObjective.hpp" //#include "ClpSimplex.hpp" #include "ClpQuadInterface.hpp" //############################################################################# // Solve methods //############################################################################# void ClpQuadInterface::initialSolve() { // save cutoff double cutoff = modelPtr_->dualObjectiveLimit(); modelPtr_->setDualObjectiveLimit(1.0e50); modelPtr_->scaling(0); modelPtr_->setLogLevel(0); // solve with no objective to get feasible solution setBasis(basis_,modelPtr_); modelPtr_->dual(); basis_ = getBasis(modelPtr_); modelPtr_->setDualObjectiveLimit(cutoff); if (modelPtr_->problemStatus()) { assert (modelPtr_->problemStatus()==1); return; } ClpObjective * saveObjective = modelPtr_->objectiveAsObject(); modelPtr_->setObjectivePointer(quadraticObjective_); //modelPtr_->setLogLevel(1); // Could load up any data into a solver modelPtr_->primal(); modelPtr_->setDualObjectiveLimit(cutoff); if (modelPtr_->objectiveValue()>cutoff) modelPtr_->setProblemStatus(1); // zero reduced costs // Should not have to as convex //CoinZeroN(modelPtr_->dualRowSolution(),modelPtr_->numberRows()); //CoinZeroN(modelPtr_->dualColumnSolution(),modelPtr_->numberColumns()); modelPtr_->setObjectivePointer(saveObjective); } //----------------------------------------------------------------------------- void ClpQuadInterface::resolve() { initialSolve(); } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpQuadInterface::ClpQuadInterface () : OsiClpSolverInterface() { quadraticObjective_=NULL; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * ClpQuadInterface::clone(bool CopyData) const { if (CopyData) { return new ClpQuadInterface(*this); } else { printf("warning ClpQuadInterface clone with copyData false\n"); return new ClpQuadInterface(); } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpQuadInterface::ClpQuadInterface ( const ClpQuadInterface & rhs) : OsiClpSolverInterface(rhs) { if (rhs.quadraticObjective_) quadraticObjective_=rhs.quadraticObjective_->clone(); else quadraticObjective_=NULL; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpQuadInterface::~ClpQuadInterface () { delete quadraticObjective_; } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpQuadInterface & ClpQuadInterface::operator=(const ClpQuadInterface& rhs) { if (this != &rhs) { OsiClpSolverInterface::operator=(rhs); if (rhs.quadraticObjective_) quadraticObjective_=rhs.quadraticObjective_->clone(); else quadraticObjective_=NULL; } return *this; } //------------------------------------------------------------------- // Real initializer //------------------------------------------------------------------- void ClpQuadInterface::initialize () { // Save true objective and create a fake one delete quadraticObjective_; quadraticObjective_ = modelPtr_->objectiveAsObject(); ClpLinearObjective * linearObjective = new ClpLinearObjective(NULL,modelPtr_->numberColumns()); modelPtr_->setObjectivePointer(linearObjective); } // Get objective function value (can't use default) double ClpQuadInterface::getObjValue() const { // first try easy way return modelPtr_->objectiveValue(); } CoinMP-1.8.3/Cbc/examples/CbcBranchFollow2.hpp0000644000175000017500000000457211510742723017416 0ustar renerene// $Id: CbcBranchFollow2.hpp 1574 2011-01-05 01:13:55Z lou $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcBranchFollowOn2_H #define CbcBranchFollowOn2_H #include "CbcBranchActual.hpp" #include "CoinPackedMatrix.hpp" /** Define a follow on class. The idea of this is that in air-crew scheduling problems crew may fly in on flight A and out on flight B or on some other flight. A useful branch is one which on one side fixes all which go out on flight B to 0, while the other branch fixes all those that do NOT go out on flight B to 0. This tries to generalize so that cuts are produced with sum aij xj <= bi on each side. It should be intelligent enough to fix if things can be fixed. We also need to make sure branch cuts work properly (i.e. persistence). This branching rule should be in addition to normal rules and have a high priority. */ class CbcFollowOn2 : public CbcObject { public: // Default Constructor CbcFollowOn2 (); /** Useful constructor */ CbcFollowOn2 (CbcModel * model); // Copy constructor CbcFollowOn2 ( const CbcFollowOn2 &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcFollowOn2 & operator=( const CbcFollowOn2& rhs); // Destructor ~CbcFollowOn2 (); /// Infeasibility - large is 0.5 virtual double infeasibility(int & preferredWay) const; /// This looks at solution and sets bounds to contain solution virtual void feasibleRegion(); /// Creates a branching object virtual CbcBranchingObject * createBranch(int way) ; /** As some computation is needed in more than one place - returns row. Also returns other row and effective rhs (so we can know if cut) */ virtual int gutsOfFollowOn2(int & otherRow, int & preferredWay, int & effectiveRhs) const; /// get and set for maximum rhws (affects cuts as branch) inline int maximumRhs() const { return maximumRhs_;} inline void setMaximumRhs(int value) { maximumRhs_=value;} protected: /// data /// Matrix CoinPackedMatrix matrix_; /// Matrix by row CoinPackedMatrix matrixByRow_; /// Possible rhs (if 0 then not possible) int * rhs_; /// If >1 then allow cuts if effective rhs <= this int maximumRhs_; }; #endif CoinMP-1.8.3/Cbc/examples/fast0507b.cpp0000644000175000017500000002512212131054214015733 0ustar renerene// $Id: fast0507b.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CbcConfig.h" #include #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchUser.hpp" #include "CbcBranchFollow2.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "CbcHeuristicGreedy.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcSolver2.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding.hpp" #include "CglMixedIntegerRounding2.hpp" // Preprocessing #include "CglPreProcess.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It then sets up some Cgl cut generators and calls branch and cut. Branching is simple binary branching on integer variables. Node selection is depth first until first solution is found and then based on objective and number of unsatisfied integer variables. In this example the functionality is the same as default but it is a user comparison function. Variable branching selection is on maximum minimum-of-up-down change after strong branching on 5 variables closest to 0.5. A simple rounding heuristic is used. ************************************************************************/ // ****** define comparison to choose best next node int main (int argc, const char *argv[]) { // Define your favorite OsiSolver #ifdef COIN_USE_CLPxx OsiClpSolverInterface solver1; #else CbcSolver2 solver1; #endif // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); /* Options are: preprocess to do preprocessing time in minutes if 2 parameters and numeric taken as time */ bool preProcess=false; double minutes=-1.0; int nGoodParam=0; for (int iParam=2; iParam=0.0) { nGoodParam+=2; iParam++; // skip time } } } } if (nGoodParam==0&&argc==3&&isdigit(argv[2][0])) { // If time is given then stop after that number of minutes minutes = atof(argv[2]); if (minutes>=0.0) nGoodParam=1; } if (nGoodParam!=argc-2) { printf("Usage [preprocess] [time ] or \n"); exit(1); } solver1.initialSolve(); // Reduce printout //solver1.setHintParam(OsiDoReducePrint,true,OsiHintTry); // Say we want scaling //solver1.setHintParam(OsiDoScale,true,OsiHintTry); //solver1.setCleanupScaling(1); // See if we want preprocessing OsiSolverInterface * solver2=&solver1; CglPreProcess process; if (preProcess) { /* Do not try and produce equality cliques and do up to 5 passes */ solver2 = process.preProcess(solver1,false,5); if (!solver2) { printf("Pre-processing says infeasible\n"); exit(2); } solver2->resolve(); } CbcModel model(*solver2); // Point to solver OsiSolverInterface * solver3 = model.solver(); CbcSolver2 * osiclp = dynamic_cast< CbcSolver2*> (solver3); assert (osiclp); osiclp->initialize(&model,NULL); osiclp->setAlgorithm(2); int numberColumns = osiclp->getNumCols(); int * priority = new int [numberColumns+1]; int n=0; int iColumn; for ( iColumn=0;iColumnsetTiming(true); } // Allow rounding heuristic CbcRounding heuristic1(model); model.addHeuristic(&heuristic1); // And Greedy heuristic CbcHeuristicGreedyCover heuristic2(model); // Use original upper and perturb more heuristic2.setAlgorithm(0); heuristic2.setWhen(13); // say do even though looks odd (nObjects>nInts) model.addHeuristic(&heuristic2); // Redundant definition of default branching (as Default == User) CbcBranchUserDecision branch; model.setBranchingMethod(&branch); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); // Do initial solve to continuous model.initialSolve(); // Could tune more model.setMinimumDrop(CoinMin(1.0, fabs(model.getMinimizationObjValue())*1.0e-3+1.0e-4)); if (model.getNumCols()<500) model.setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (model.getNumCols()<5000) model.setMaximumCutPassesAtRoot(100); // use minimum drop else model.setMaximumCutPassesAtRoot(20); //model.setMaximumCutPasses(1); // Do more strong branching if small //if (model.getNumCols()<5000) //model.setNumberStrong(10); // Switch off strong branching if wanted model.setNumberStrong(0); model.solver()->setIntParam(OsiMaxNumIterationHotStart,50); // If time is given then stop after that number of minutes if (minutes>=0.0) { std::cout<<"Stopping after "<setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } //model.messageHandler()->setLogLevel(2); //model.solver()->messageHandler()->setLogLevel(2); //model.setPrintFrequency(50); #define DEBUG_CUTS #ifdef DEBUG_CUTS // Set up debugger by name (only if no preprocesing) if (!preProcess) { std::string problemName ; //model.solver()->getStrParam(OsiProbName,problemName) ; //model.solver()->activateRowCutDebugger(problemName.c_str()) ; model.solver()->activateRowCutDebugger("cap6000a") ; } #endif // Do complete search model.branchAndBound(); //void printHowMany(); //printHowMany(); std::cout<cutGeneratorName()<<" was tried " <numberTimesEntered()<<" times and created " <numberCutsInTotal()<<" cuts of which " <numberCutsActive()<<" were active after adding rounds of cuts"; if (generator->timing()) std::cout<<" ( "<timeInCutGenerator()<<" seconds)"<getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout< #include "CoinTime.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "ClpFactorization.hpp" #include "ClpObjective.hpp" #include "ClpSimplex.hpp" #include "CbcSolverLongThin.hpp" #include "CbcModel.hpp" #include "ClpPresolve.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchFollow2.hpp" #include "CbcCutGenerator.hpp" #include "CbcCompareUser.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding.hpp" #include "CglTwomir.hpp" #include "CglDuplicateRow.hpp" #include "CbcFathomDynamicProgramming.hpp" static int timesBad_=0; //############################################################################# // Solve methods //############################################################################# static CglDuplicateRow * tryCut=NULL; void CbcSolverLongThin::initialSolve() { modelPtr_->scaling(0); setBasis(basis_,modelPtr_); modelPtr_->dual(); basis_ = getBasis(modelPtr_); assert(!modelPtr_->specialOptions()); modelPtr_->setLogLevel(0); if (!tryCut) { tryCut = new CglDuplicateRow(this); tryCut->setLogLevel(2); } } //----------------------------------------------------------------------------- void CbcSolverLongThin::resolve() { int * whichRow = NULL; int * whichColumn = NULL; // problem may be small enough to do nested search const double * colLower = modelPtr_->columnLower(); const double * colUpper = modelPtr_->columnUpper(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int numberRows=modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); int i; int nFix=0; int nNewRow=0; int nNewCol=0; int sizeDynamic = COIN_INT_MAX; int smallOriginalNumberRows=0; if (algorithm_==0) { for (i=0;igenerateCuts(*this,cs); int numberCuts = cs.sizeColCuts(); if (numberCuts) { for ( i = 0 ; i < numberCuts ; i++) { const OsiColCut *thisCut = cs.colCutPtr(i) ; const CoinPackedVector & ubs = thisCut->ubs() ; int n = ubs.getNumElements() ; const int * which = ubs.getIndices() ; const double * values = ubs.getElements() ; for (int j = 0;jsetColUpper(iColumn,values[j]) ; } } } #if 1 const int * duplicate = tryCut->duplicate(); sizeDynamic = tryCut->sizeDynamic(); int nOrig = tryCut->numberOriginalRows(); for (i=0;isetRowStatus(i,ClpSimplex::basic); } smallOriginalNumberRows=nNewRow; for (;icount_-memory_&&node_[i]>0); if ((choose&&colUpper[i]) ||(modelPtr_->getStatus(i)!=ClpSimplex::atLowerBound&& modelPtr_->getStatus(i)!=ClpSimplex::isFixed) ||colLower[i]>0.0) whichColumn[nNewCol++]=i; } } if (nestedSearch_<1.0&&model_&&model_->phase()==2) { if (((double) sizeDynamic)*((double) nNewCol)<1000000000&&sizeDynamic<10000000) { // could do Dynamic Programming // back to original number of rows nNewRow = smallOriginalNumberRows; // and get rid of any basics int nNewCol=0; for (i=0;i0.0) whichColumn[nNewCol++]=i; } ClpSimplex temp(modelPtr_,nNewRow,whichRow,nNewCol,whichColumn); int returnCode; double * rowLower2 = temp.rowLower(); double * rowUpper2 = temp.rowUpper(); int numberColumns2 = temp.numberColumns(); double * colLower2 = temp.columnLower(); double * colUpper2 = temp.columnUpper(); const CoinPackedMatrix * matrix = temp.matrix(); const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); double offset=0.0; const double * objective = temp.objective(); bool feasible=true; for (i=0;isetLogLevel(0); CbcFathomDynamicProgramming fathom1(modelSmall); // Set maximum space allowed fathom1.setMaximumSize(100000000); temp2.writeMps("small"); returnCode=fathom1.fathom(solutionDP); if (returnCode!=1) { printf("probably not enough memory\n"); abort(); } } if (solutionDP) { double objValue = 0.0; double * solution = modelPtr_->primalColumnSolution(); const double * objective = modelPtr_->objective(); for (i=0;igetCutoff()) { printf("good solution %g by dynamic programming\n",objValue); returnCode = 0; // paranoid check double * rowLower = modelPtr_->rowLower(); double * rowUpper = modelPtr_->rowUpper(); // Column copy const CoinPackedMatrix * matrix2 = modelPtr_->matrix(); element = matrix2->getElements(); row = matrix2->getIndices(); columnStart = matrix2->getVectorStarts(); columnLength = matrix2->getVectorLengths(); double * rowActivity = new double [numberRows]; memset(rowActivity,0,numberRows*sizeof(double)); for (i=0;i=colLower[i]&&value<=colUpper[i]); if (value) { printf("%d has value %g\n",i,value); for (j=columnStart[i]; jrowUpper[i]) { if (rowActivity[i]>rowUpper[i]+1.0e-8) feasible = false; } } if (!feasible) { printf("** Bad solution by dynamic programming\n"); abort(); } delete [] rowActivity; model_->setBestSolution(CBC_TREE_SOL,objValue,solution); } else { returnCode=2; } } else { returnCode=2; } temp2.releaseClp(); modelPtr_->setProblemStatus(1); delete [] whichRow; delete [] whichColumn; return; } if (nFix>nestedSearch_*numberIntegers) { // Do nested search // back to original number of rows nNewRow = smallOriginalNumberRows; // and get rid of any basics int nNewCol=0; for (i=0;i0.0) whichColumn[nNewCol++]=i; } #if 0 // We clone from continuous solver so set some stuff OsiSolverInterface * solver = model_->continuousSolver(); CbcSolverLongThin * osiclp = dynamic_cast< CbcSolverLongThin*> (solver); assert (osiclp); // up special options if (osiclp->specialOptions()==3) osiclp->setSpecialOptions(7); double saveNested = osiclp->getNested(); int saveAlgorithm = osiclp->getAlgorithm(); osiclp->setNested(1.0); osiclp->setAlgorithm(0); int numberObjects = model_->numberObjects(); if (numberObjects>model_->numberIntegers()) { // for now only integers //assert (numberObjects == model_->numberIntegers()+1); model_->setNumberObjects(model_->numberIntegers()); // try follow on //model_->setNumberObjects(model_->numberIntegers()+1); } double saveMaxTime = model_->getDblParam(CbcModel::CbcMaximumSeconds); model_->setDblParam(CbcModel::CbcMaximumSeconds,1.0e5); // up special options #if 1 int returnCode= model_->subBranchAndBound(colLower,colUpper,2000); #else CbcModel * model3 = model_->cleanModel(colLower,colUpper); // integer presolve int returnCode=0; CbcModel * model2 = model3->integerPresolve(false); if (!model2||!model2->getNumRows()) { delete model2; delete model3; returnCode= 2; } else { if (handler_->logLevel()>1) printf("Reduced model has %d rows and %d columns\n", model2->getNumRows(),model2->getNumCols()); if (true) { OsiSolverInterface * solver = model2->solver(); OsiSolverInterface * osiclp = dynamic_cast< OsiSolverInterface*> (solver); assert (osiclp); int * priority = new int [numberColumns+1]; int n=0; int iColumn; for ( iColumn=0;iColumnisInteger(iColumn)) { priority[n++]=10000; } } priority[n]=1; CbcObject * newObject =new CbcFollowOn2(model2); model2->addObjects(1,&newObject); delete newObject; model2->passInPriorities(priority,false); delete [] priority; } returnCode= model_->subBranchAndBound(model3,model2,4000); } #endif model_->setDblParam(CbcModel::CbcMaximumSeconds,saveMaxTime); model_->setNumberObjects(numberObjects); osiclp->setNested(saveNested); osiclp->setAlgorithm(saveAlgorithm); #else // start again very simply ClpSimplex temp(modelPtr_,nNewRow,whichRow,nNewCol,whichColumn); int returnCode; OsiClpSolverInterface temp2(&temp); temp2.setupForRepeatedUse(2); int numberColumns2 = temp.numberColumns(); const double * colUpper2 = temp2.getColUpper(); const double * colLower2 = temp2.getColLower(); const double * solution2 = temp.getColSolution(); double * cleanSolution2 = new double [numberColumns2]; for (i=0;igetVectorLengths(); int * priority = new int [numberColumns2+1]; // do pseudo costs and priorities - take a reasonable guess CbcObject ** objects = new CbcObject * [numberColumns2+1]; int n=0; const double * objective = modelSmall.getObjCoefficients(); for (i=0;isetMethod(3); objects[n]= newObject; priority[n++]=10000-columnLength[i]; } priority[n]=1; objects[n++]=new CbcFollowOn2(&modelSmall); modelSmall.addObjects(n,objects); for (i=0;igetCutoff()); //if (!onPathX&&modelSmall.getCutoff()>480.5) //modelSmall.setCutoff(480.5); //printf("cutoff %g\n",model_->getCutoff()); modelSmall.messageHandler()->setLogLevel(1); modelSmall.solver()->messageHandler()->setLogLevel(0); modelSmall.messagesPointer()->setDetailMessage(3,9); modelSmall.messagesPointer()->setDetailMessage(3,6); modelSmall.messagesPointer()->setDetailMessage(3,4); modelSmall.messagesPointer()->setDetailMessage(3,13); modelSmall.messagesPointer()->setDetailMessage(3,14); modelSmall.messagesPointer()->setDetailMessage(3,1); modelSmall.messagesPointer()->setDetailMessage(3,3007); modelSmall.branchAndBound(); temp2.releaseClp(); if (modelSmall.bestSolution()) { double objValue = 0.0; const double * solution2 = modelSmall.bestSolution(); double * solution = modelPtr_->primalColumnSolution(); const double * objective = modelPtr_->objective(); for (i=0;igetCutoff()); if (objValuegetCutoff()) { //printf("good solution \n"); model_->setBestSolution(CBC_TREE_SOL,objValue,solution); returnCode = 0; } else { returnCode=2; } } else { returnCode=2; } #endif if (returnCode!=0&&returnCode!=2) { printf("pretending entire search done\n"); returnCode=0; } if (returnCode==0||returnCode==2) { modelPtr_->setProblemStatus(1); delete [] whichRow; delete [] whichColumn; return; } } } if ((count_<100&&algorithm_==2)||!algorithm_) { delete [] whichRow; delete [] whichColumn; assert(!modelPtr_->specialOptions()); int saveOptions = modelPtr_->specialOptions(); bool takeHint; OsiHintStrength strength; getHintParam(OsiDoInBranchAndCut,takeHint,strength); if (strength!=OsiHintIgnore&&takeHint) { // could do something - think about it //printf("thin hint %d %c\n",strength,takeHint ? 'T' :'F'); } if((specialOptions_&1)==0) { modelPtr_->setSpecialOptions(saveOptions|(64|1024)); } else { if((specialOptions_&4)==0) modelPtr_->setSpecialOptions(saveOptions|(64|128|512|1024|4096)); else modelPtr_->setSpecialOptions(saveOptions|(64|128|512|1024|2048|4096)); } //printf("thin options %d size %d\n",modelPtr_->specialOptions(),modelPtr_->numberColumns()); setBasis(basis_,modelPtr_); //modelPtr_->setLogLevel(1); modelPtr_->dual(0,0); basis_ = getBasis(modelPtr_); modelPtr_->setSpecialOptions(saveOptions); if (modelPtr_->status()==0) { count_++; double * solution = modelPtr_->primalColumnSolution(); int i; for (i=0;i1.0e-6||modelPtr_->getStatus(i)==ClpSimplex::basic) { node_[i]=CoinMax(count_,node_[i]); howMany_[i]++; } } } else { if (!algorithm_==2) printf("infeasible early on\n"); } } else { // use counts int i; const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); setBasis(basis_,modelPtr_); ClpSimplex * temp = new ClpSimplex(modelPtr_,nNewRow,whichRow,nNewCol,whichColumn); //temp->setLogLevel(2); //printf("small has %d rows and %d columns\n",nNewRow,nNewCol); temp->setSpecialOptions(128+512); temp->setDualObjectiveLimit(1.0e50); temp->dual(); if (temp->status()) { // In some cases we know that it must be infeasible if (believeInfeasible_||algorithm_==1) { modelPtr_->setProblemStatus(1); printf("assuming infeasible!\n"); //modelPtr_->writeMps("infeas.mps"); //temp->writeMps("infeas2.mps"); //abort(); delete temp; delete [] whichRow; delete [] whichColumn; return; } } double * solution = modelPtr_->primalColumnSolution(); if (!temp->status()) { const double * solution2 = temp->primalColumnSolution(); memset(solution,0,numberColumns*sizeof(double)); for (i=0;isetStatus(iColumn,temp->getStatus(i)); } double * rowSolution = modelPtr_->primalRowSolution(); const double * rowSolution2 = temp->primalRowSolution(); double * dual = modelPtr_->dualRowSolution(); const double * dual2 = temp->dualRowSolution(); memset(dual,0,numberRows*sizeof(double)); for (i=0;isetRowStatus(iRow,temp->getRowStatus(i)); rowSolution[iRow]=rowSolution2[i]; dual[iRow]=dual2[i]; } // See if optimal double * dj = modelPtr_->dualColumnSolution(); // get reduced cost for large problem // this assumes minimization memcpy(dj,modelPtr_->objective(),numberColumns*sizeof(double)); modelPtr_->transposeTimes(-1.0,dual,dj); modelPtr_->setObjectiveValue(temp->objectiveValue()); modelPtr_->setProblemStatus(0); int nBad=0; for (i=0;igetStatus(i)==ClpSimplex::atLowerBound &&upper[i]>lower[i]&&dj[i]<-1.0e-5) nBad++; } //modelPtr_->writeMps("bada.mps"); //temp->writeMps("badb.mps"); if (nBad) { assert (algorithm_==2); //printf("%d bad\n",nBad); timesBad_++; modelPtr_->primal(); } } else { // infeasible - do all modelPtr_->setSpecialOptions(64+128+512); setBasis(basis_,modelPtr_); //modelPtr_->setLogLevel(1); modelPtr_->dual(0,0); basis_ = getBasis(modelPtr_); modelPtr_->setSpecialOptions(0); if (modelPtr_->status()) { printf("really infeasible!\n"); delete temp; delete [] whichRow; delete [] whichColumn; return; } else { printf("initially infeasible\n"); } } delete temp; delete [] whichRow; delete [] whichColumn; basis_ = getBasis(modelPtr_); modelPtr_->setSpecialOptions(0); count_++; if ((count_%100)==0&&algorithm_==2) printf("count %d, bad %d\n",count_,timesBad_); for (i=0;i1.0e-6||modelPtr_->getStatus(i)==ClpSimplex::basic) { node_[i]=CoinMax(count_,node_[i]); howMany_[i]++; } } if (modelPtr_->objectiveValue()>=modelPtr_->dualObjectiveLimit()) modelPtr_->setProblemStatus(1); } } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CbcSolverLongThin::CbcSolverLongThin () : OsiClpSolverInterface() { node_=NULL; howMany_=NULL; count_=0; model_ = NULL; memory_=300; believeInfeasible_=false; nestedSearch_ = 1.0; algorithm_=0; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * CbcSolverLongThin::clone(bool CopyData) const { if (CopyData) { return new CbcSolverLongThin(*this); } else { printf("warning CbcSolveUser clone with copyData false\n"); return new CbcSolverLongThin(); } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CbcSolverLongThin::CbcSolverLongThin ( const CbcSolverLongThin & rhs) : OsiClpSolverInterface(rhs) { model_ = rhs.model_; int numberColumns = modelPtr_->numberColumns(); node_=CoinCopyOfArray(rhs.node_,numberColumns); howMany_=CoinCopyOfArray(rhs.howMany_,numberColumns); count_=rhs.count_; memory_=rhs.memory_; believeInfeasible_ = rhs.believeInfeasible_; nestedSearch_ = rhs.nestedSearch_; algorithm_=rhs.algorithm_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CbcSolverLongThin::~CbcSolverLongThin () { delete [] node_; delete [] howMany_; } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcSolverLongThin & CbcSolverLongThin::operator=(const CbcSolverLongThin& rhs) { if (this != &rhs) { OsiClpSolverInterface::operator=(rhs); delete [] node_; delete [] howMany_; model_ = rhs.model_; int numberColumns = modelPtr_->numberColumns(); node_=CoinCopyOfArray(rhs.node_,numberColumns); howMany_=CoinCopyOfArray(rhs.howMany_,numberColumns); count_=rhs.count_; memory_=rhs.memory_; believeInfeasible_ = rhs.believeInfeasible_; nestedSearch_ = rhs.nestedSearch_; algorithm_=rhs.algorithm_; } return *this; } //------------------------------------------------------------------- // Real initializer //------------------------------------------------------------------- void CbcSolverLongThin::initialize (CbcModel * model, const char * keep) { model_=model; int numberColumns = modelPtr_->numberColumns(); if (numberColumns) { node_ = new int[numberColumns]; howMany_ = new int[numberColumns]; for (int i=0;i #include #include "CoinPragma.hpp" #include "OsiClpSolverInterface.hpp" #include "CoinPackedVector.hpp" //#define USE_CBC #ifdef USE_CBC #include "CbcModel.hpp" #endif int main (int argc, const char *argv[]) { OsiClpSolverInterface model; int start[] = { 0, 1, 2}; int index[] = { 0, 0}; double values[] = {1.0, 2.0}; double collb[] = {0.0, 0.0}; double colub[] = {10.0, 10.0}; double obj[] = { 1.0, 1.0}; double rowlb[] = { 0.0}; double rowub[]= { 3.9}; // obj: Max x0 + x1 // st. x0 + 2 x1 <= 3.9 // 0 <= x0 <= 10 and integer // 0 <= x1 <= 10 model.loadProblem(2, 1, start, index, values, collb, colub, obj, rowlb, rowub); model.setInteger(0); model.setObjSense(-1.0); //bool optimal; #ifndef USE_CBC // Save bounds - that and dual limit should be all that is needed // For this simple example we could just re-use collb and colub double saveLower[2]; double saveUpper[2]; int numberColumns = model.getNumCols(); CoinCopyN(model.getColLower(),numberColumns,saveLower); CoinCopyN(model.getColUpper(),numberColumns,saveUpper); double objLimit; model.getDblParam(OsiDualObjectiveLimit,objLimit); model.branchAndBound(); //optimal = model.isProvenOptimal(); const double *val = model.getColSolution(); // x0 = 3, x1 = 0.45 printf("Solution %g %g\n",val[0],val[1]); // Restore bounds and dual limit model.setColLower(saveLower); model.setColUpper(saveUpper); model.setDblParam(OsiDualObjectiveLimit,objLimit); #else { CbcModel model2(model); model2.branchAndBound(); //optimal = model2.isProvenOptimal(); const double *val = model2.getColSolution(); // x0 = 3, x1 = 0.45 printf("Solution %g %g\n",val[0],val[1]); } #endif const int rowCols[] = {0}; const double rowElements = { 1.0}; // add x0 <= 2, and solve once again. CoinPackedVector v(1, rowCols, rowElements); model.addRow(v, 0.0, 2.0); #ifndef USE_CBC model.branchAndBound(); //optimal = model.isProvenOptimal(); // should be x0 = 2, x1 = 0.95 // Address of solution will be same as only adding rows - but be safe val = model.getColSolution(); printf("Solution %g %g\n",val[0],val[1]); #else { CbcModel model2(model); model2.branchAndBound(); //optimal = model2.isProvenOptimal(); // should be x0 = 2, x1 = 0.95 const double *val = model2.getColSolution(); printf("Solution %g %g\n",val[0],val[1]); } #endif return 0; } CoinMP-1.8.3/Cbc/examples/sample1.cpp0000644000175000017500000001172612131054214015667 0ustar renerene// $Id: sample1.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CbcConfig.h" #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "OsiClpSolverInterface.hpp" #include "ClpPresolve.hpp" #include "CbcCompareUser.hpp" #include "CglProbing.hpp" //############################################################################# #ifdef NDEBUG #undef NDEBUG #endif // Time #include #if !defined(_MSC_VER) #include #include #include #endif static double cpuTime() { double cpu_temp; #if defined(_MSC_VER) unsigned int ticksnow; /* clock_t is same as int */ ticksnow = (unsigned int)clock(); cpu_temp = (double)((double)ticksnow/CLOCKS_PER_SEC); #else struct rusage usage; getrusage(RUSAGE_SELF,&usage); cpu_temp = (double)usage.ru_utime.tv_sec; cpu_temp += 1.0e-6*((double) usage.ru_utime.tv_usec); #endif return cpu_temp; } /************************************************************************ This main program reads in an integer model from an mps file. It then sets up some Cgl cut generators and calls branch and cut. Branching is simple binary branching on integer variables. Node selection is depth first until first solution is found and then based on objective and number of unsatisfied integer variables. Variable branching selection is on maximum minimum-of-up-down change after strong branching on 5 variables closest to 0.5. A simple rounding heuristic is used. Any cut generators based on Cgl can be added in same way You may also wish to look at CbcModel.hpp ************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver ClpSimplex simplex; double time0 = cpuTime(); double time1 = time0; double time2; // Read in model using argv[1] // and assert that it is a clean model if (argc <= 1) { printf("using %s \n", argv[0]); return 1; } int numMpsReadErrors = simplex.readMps(argv[1],""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } time2 = cpuTime(); std::cout<<"Input took "<setLogLevel(0); CbcModel model(solver1); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); // Maybe probing due to very large coefficients CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(3); generator1.setMaxProbe(100); generator1.setMaxLook(50); generator1.setRowCuts(3); // Add in generators // model.addCutGenerator(&generator1,-1,"Probing"); // Switch off strong branching if wanted model.setNumberStrong(0); model.solver()->setIntParam(OsiMaxNumIterationHotStart,100); //model.solver()->setHintParam(OsiDoScale,false,OsiHintTry); // Switch off most output if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } // Do complete search model.branchAndBound(); time2 = cpuTime(); std::cout<<"Search took "< (model.solver()); assert (clpSolver); ClpSimplex * clp = clpSolver->getModelPtr(); *simplex2 = *clp; pinfo.postsolve(true); time1 = time2; // Fix all integers const int * original = pinfo.originalColumns(); double * lower2 = simplex2->columnLower(); double * upper2 = simplex2->columnUpper(); const char * info2 = simplex2->integerInformation(); double * lower = simplex.columnLower(); double * upper = simplex.columnUpper(); int i; for (i=0;inumberColumns();i++) { if (info2[i]) { int iSeq = original[i]; upper[iSeq]=upper2[i]; lower[iSeq]=lower2[i]; } } simplex.primal(); time2 = cpuTime(); std::cout<<"Cleanup took "< #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiClpSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchActual.hpp" #include "CbcCompareUser.hpp" #include "CoinTime.hpp" /************************************************************************ This main program reads in an integer model from an mps file. It expects it to be unit coefficients and unit rhs. Branching is follow-on branching plus simple binary branching on integer variables. */ int main (int argc, const char *argv[]) { // Define a Solver for long thin problems OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); solver1.initialSolve(); // Reduce printout solver1.setHintParam(OsiDoReducePrint,true,OsiHintTry); OsiSolverInterface * solver2=&solver1; CbcModel model(*solver2); // Point to solver OsiSolverInterface * solver3 = model.solver(); assert (dynamic_cast< OsiClpSolverInterface*> (solver3)); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); int iColumn; int numberColumns = solver3->getNumCols(); /* We are going to add a single follow on object but we want to give low priority to existing integers. As the default priority is 1000 we don't actually need to give integer priorities but it is here to show how. */ // Normal integer priorities int * priority = new int [numberColumns]; int numberIntegers=0; for (iColumn=0;iColumnisInteger(iColumn)) { priority[numberIntegers++]= 100; // low priority } } /* Second parameter is true if we are adding objects, false if integers. So this does integers */ model.passInPriorities(priority,false); delete [] priority; /* Add in objects before we can give priority. In this case just one - but this shows general method */ CbcObject ** objects = new CbcObject * [1]; objects[0]=new CbcFollowOn(&model); model.addObjects(1,objects); delete objects[0]; delete [] objects; // High priority int followPriority=1; model.passInPriorities(&followPriority,true); // Do initial solve to continuous model.initialSolve(); // Do more strong branching if small // Switch off strong branching if wanted model.setNumberStrong(0); model.solver()->setIntParam(OsiMaxNumIterationHotStart,100); // Switch off most output if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } //model.setPrintFrequency(50); // Do complete search try { model.branchAndBound(); } catch (CoinError e) { e.print(); if (e.lineNumber()>=0) std::cout<<"This was from a CoinAssert"<getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout< #include #include "CoinPragma.hpp" #include "CbcModel.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcSolver.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program shows how to take advantage of the standalone cbc in your program, while still making major modifications. This is like driver4 but executes in parallel First it reads in a model from an mps file Then it initializes three integer models with cbc defaults Then it calls CbcMain0/1 using threads passing parameters Finally it prints solution (just for first model) All models have same parameters unless "-switch" is found so -- miplib/p0033 -solve -switch -heuristic off -solve would solve first model with heuristics and subsequent ones without This could be used to try different ideas OR on different models NOTE - The minimum has been done to make thread safe so no interrupts -quit is added to make sure just reads from argv */ /*************************************************************************/ #define USE_PTHREAD #ifdef USE_PTHREAD #include #endif /* Return non-zero to return quickly */ static int callBack(CbcModel * model, int whereFrom) { int returnCode=0; switch (whereFrom) { case 1: case 2: if (!model->status()&&model->secondaryStatus()) returnCode=1; break; case 3: { //CbcCompareUser compare; //model->setNodeComparison(compare); } break; case 4: // If not good enough could skip postprocessing break; case 5: break; default: abort(); } return returnCode; } // For threads typedef struct { CbcModel * model; CbcSolverUsefulData * data; int argc; char ** argv; } threadStuff; static void * doThread(void * voidInfo) { threadStuff * stuff = reinterpret_cast(voidInfo); CbcModel * model = stuff->model; CbcMain0(*model,*stuff->data); // Now go into code for standalone solver CbcMain1(stuff->argc,const_cast(stuff->argv), *model,callBack,*stuff->data); return NULL; } int main (int argc, const char *argv[]) { // Number of models to do at once int numberModels=3; // Stuff for each model CbcModel * allModels = new CbcModel[numberModels]; OsiClpSolverInterface * allSolvers = new OsiClpSolverInterface[numberModels]; CbcSolverUsefulData * data = new CbcSolverUsefulData[numberModels]; threadStuff * allData = new threadStuff[numberModels]; // First populate first model /* in a real application models would be different */ OsiClpSolverInterface & solver1 = allSolvers[0]; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } // Tell solver to return fast if presolve or initial solve infeasible solver1.getModelPtr()->setMoreSpecialOptions(3); // create models for (int iModel=1;iModel0) lastArgc=thisArgc; else thisArgc=lastArgc; // allow extra for -quit char ** thisArgv=new char *[thisArgc+2]; thisArgv[0]=strdup(argv[0]); int put=1; for (int iArgc=lastArgPosition;iArgcsolver(); // Print solution if finished (could get from model->bestSolution() as well if (model->bestSolution()) { const double * solution = solver->getColSolution(); int iColumn; int numberColumns = solver->getNumCols(); std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout<getColName(iColumn) <1.0e-7&&solver->isInteger(iColumn)) std::cout<columnName(iColumn) < #include "CoinTime.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "ClpFactorization.hpp" #include "ClpObjective.hpp" #include "ClpSimplex.hpp" #include "CbcSolver3.hpp" #include "CbcModel.hpp" #include "ClpPresolve.hpp" #include "CbcHeuristicGreedy.hpp" #include "CbcBranchActual.hpp" #include "CbcCutGenerator.hpp" #include "CbcCompareUser.hpp" #include "CbcCompareActual.hpp" #include "CbcCompareObjective.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding.hpp" #include "CglTwomir.hpp" static int timesBad_=0; //############################################################################# // Solve methods //############################################################################# void CbcSolver3::initialSolve() { modelPtr_->scaling(0); setBasis(basis_,modelPtr_); // Do long thin by sprint ClpSolve options; options.setSolveType(ClpSolve::usePrimalorSprint); options.setPresolveType(ClpSolve::presolveOff); options.setSpecialOption(1,3,30); modelPtr_->initialSolve(options); basis_ = getBasis(modelPtr_); modelPtr_->setLogLevel(0); } //----------------------------------------------------------------------------- void CbcSolver3::resolve() { int * whichRow = NULL; int * whichColumn = NULL; // problem may be small enough to do nested search const double * colLower = modelPtr_->columnLower(); const double * colUpper = modelPtr_->columnUpper(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int numberRows=modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); int i; int nFix=0; int nNewRow=0; int nNewCol=0; int smallOriginalNumberRows=0; if (algorithm_==0) { for (i=0;icount_-memory_&&node_[i]>0); if ((choose&&colUpper[i]) ||(modelPtr_->getStatus(i)!=ClpSimplex::atLowerBound&& modelPtr_->getStatus(i)!=ClpSimplex::isFixed) ||colLower[i]>0.0) whichColumn[nNewCol++]=i; } } if (nestedSearch_<1.0&&model_&&model_->phase()==2) { if (nFix>nestedSearch_*numberIntegers) { // Do nested search // back to original number of rows nNewRow = smallOriginalNumberRows; // and get rid of any basics int nNewCol=0; for (i=0;i0.0) whichColumn[nNewCol++]=i; } // start again very simply ClpSimplex temp(modelPtr_,nNewRow,whichRow,nNewCol,whichColumn); int returnCode; OsiClpSolverInterface temp2(&temp); temp2.setupForRepeatedUse(2); int numberColumns2 = temp.numberColumns(); const double * colUpper2 = temp2.getColUpper(); const double * colLower2 = temp2.getColLower(); const double * solution2 = temp.getColSolution(); double * cleanSolution2 = new double [numberColumns2]; for (i=0;igetVectorLengths(); int * priority = new int [numberColumns2+1]; // do pseudo costs and priorities - take a reasonable guess CbcObject ** objects = new CbcObject * [numberColumns2+1]; int n=0; const double * objective = modelSmall.getObjCoefficients(); for (i=0;isetMethod(3); objects[n]= newObject; priority[n++]=10000-columnLength[i]; } modelSmall.addObjects(n,objects); for (i=0;igetCutoff()); modelSmall.messageHandler()->setLogLevel(1); modelSmall.solver()->messageHandler()->setLogLevel(0); modelSmall.messagesPointer()->setDetailMessage(3,9); modelSmall.messagesPointer()->setDetailMessage(3,6); modelSmall.messagesPointer()->setDetailMessage(3,4); modelSmall.messagesPointer()->setDetailMessage(3,13); modelSmall.messagesPointer()->setDetailMessage(3,14); modelSmall.messagesPointer()->setDetailMessage(3,1); modelSmall.messagesPointer()->setDetailMessage(3,3007); // Definition of node choice CbcCompareObjective compare; modelSmall.setNodeComparison(compare); // And Greedy heuristic CbcHeuristicGreedyCover heuristic2(modelSmall); // Use original upper and perturb more heuristic2.setAlgorithm(11); modelSmall.addHeuristic(&heuristic2); modelSmall.branchAndBound(); temp2.releaseClp(); if (modelSmall.bestSolution()) { double objValue = 0.0; const double * solution2 = modelSmall.bestSolution(); double * solution = modelPtr_->primalColumnSolution(); const double * objective = modelPtr_->objective(); for (i=0;igetCutoff()); if (objValuegetCutoff()) { //printf("good solution \n"); model_->setBestSolution(CBC_TREE_SOL,objValue,solution); returnCode = 0; } else { returnCode=2; } } else { returnCode=2; } if (returnCode!=0&&returnCode!=2) { printf("pretending entire search done\n"); returnCode=0; } if (returnCode==0||returnCode==2) { modelPtr_->setProblemStatus(1); delete [] whichRow; delete [] whichColumn; return; } } } if ((count_<100&&algorithm_==2)||!algorithm_) { delete [] whichRow; delete [] whichColumn; assert(!modelPtr_->specialOptions()); int saveOptions = modelPtr_->specialOptions(); bool takeHint; OsiHintStrength strength; getHintParam(OsiDoInBranchAndCut,takeHint,strength); if (strength!=OsiHintIgnore&&takeHint) { // could do something - think about it //printf("thin hint %d %c\n",strength,takeHint ? 'T' :'F'); } if((specialOptions_&1)==0) { modelPtr_->setSpecialOptions(saveOptions|(64|1024)); } else { if((specialOptions_&4)==0) modelPtr_->setSpecialOptions(saveOptions|(64|128|512|1024|4096)); else modelPtr_->setSpecialOptions(saveOptions|(64|128|512|1024|2048|4096)); } //printf("thin options %d size %d\n",modelPtr_->specialOptions(),modelPtr_->numberColumns()); setBasis(basis_,modelPtr_); //modelPtr_->setLogLevel(1); printf("model has %d rows\n",modelPtr_->numberRows()); modelPtr_->dual(0,0); basis_ = getBasis(modelPtr_); modelPtr_->setSpecialOptions(saveOptions); if (modelPtr_->status()==0) { count_++; double * solution = modelPtr_->primalColumnSolution(); int i; for (i=0;i1.0e-6||modelPtr_->getStatus(i)==ClpSimplex::basic) { node_[i]=CoinMax(count_,node_[i]); howMany_[i]++; } } } else { if (!algorithm_==2) printf("infeasible early on\n"); } } else { // use counts int i; const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); setBasis(basis_,modelPtr_); ClpSimplex * temp = new ClpSimplex(modelPtr_,nNewRow,whichRow,nNewCol,whichColumn); //temp->setLogLevel(2); //printf("small has %d rows and %d columns\n",nNewRow,nNewCol); temp->setSpecialOptions(128+512); temp->setDualObjectiveLimit(1.0e50); printf("model has %d rows\n",nNewRow); temp->dual(); if (temp->status()) { // In some cases we know that it must be infeasible if (believeInfeasible_||algorithm_==1) { modelPtr_->setProblemStatus(1); printf("assuming infeasible!\n"); //modelPtr_->writeMps("infeas.mps"); //temp->writeMps("infeas2.mps"); //abort(); delete temp; delete [] whichRow; delete [] whichColumn; return; } } double * solution = modelPtr_->primalColumnSolution(); if (!temp->status()) { const double * solution2 = temp->primalColumnSolution(); memset(solution,0,numberColumns*sizeof(double)); for (i=0;isetStatus(iColumn,temp->getStatus(i)); } double * rowSolution = modelPtr_->primalRowSolution(); const double * rowSolution2 = temp->primalRowSolution(); double * dual = modelPtr_->dualRowSolution(); const double * dual2 = temp->dualRowSolution(); memset(dual,0,numberRows*sizeof(double)); for (i=0;isetRowStatus(iRow,temp->getRowStatus(i)); rowSolution[iRow]=rowSolution2[i]; dual[iRow]=dual2[i]; } // See if optimal double * dj = modelPtr_->dualColumnSolution(); // get reduced cost for large problem // this assumes minimization memcpy(dj,modelPtr_->objective(),numberColumns*sizeof(double)); modelPtr_->transposeTimes(-1.0,dual,dj); modelPtr_->setObjectiveValue(temp->objectiveValue()); modelPtr_->setProblemStatus(0); int nBad=0; for (i=0;igetStatus(i)==ClpSimplex::atLowerBound &&upper[i]>lower[i]&&dj[i]<-1.0e-5) nBad++; } //modelPtr_->writeMps("bada.mps"); //temp->writeMps("badb.mps"); if (nBad) { assert (algorithm_==2); //printf("%d bad\n",nBad); timesBad_++; modelPtr_->primal(); } } else { // infeasible - do all modelPtr_->setSpecialOptions(64+128+512); setBasis(basis_,modelPtr_); //modelPtr_->setLogLevel(1); modelPtr_->dual(0,0); basis_ = getBasis(modelPtr_); modelPtr_->setSpecialOptions(0); if (modelPtr_->status()) { printf("really infeasible!\n"); delete temp; delete [] whichRow; delete [] whichColumn; return; } else { printf("initially infeasible\n"); } } delete temp; delete [] whichRow; delete [] whichColumn; basis_ = getBasis(modelPtr_); modelPtr_->setSpecialOptions(0); count_++; if ((count_%100)==0&&algorithm_==2) printf("count %d, bad %d\n",count_,timesBad_); for (i=0;i1.0e-6||modelPtr_->getStatus(i)==ClpSimplex::basic) { node_[i]=CoinMax(count_,node_[i]); howMany_[i]++; } } if (modelPtr_->objectiveValue()>=modelPtr_->dualObjectiveLimit()) modelPtr_->setProblemStatus(1); } } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CbcSolver3::CbcSolver3 () : OsiClpSolverInterface() { node_=NULL; howMany_=NULL; count_=0; model_ = NULL; memory_=300; believeInfeasible_=false; nestedSearch_ = 1.0; algorithm_=0; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * CbcSolver3::clone(bool CopyData) const { if (CopyData) { return new CbcSolver3(*this); } else { printf("warning CbcSolveUser clone with copyData false\n"); return new CbcSolver3(); } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CbcSolver3::CbcSolver3 ( const CbcSolver3 & rhs) : OsiClpSolverInterface(rhs) { model_ = rhs.model_; int numberColumns = modelPtr_->numberColumns(); node_=CoinCopyOfArray(rhs.node_,numberColumns); howMany_=CoinCopyOfArray(rhs.howMany_,numberColumns); count_=rhs.count_; memory_=rhs.memory_; believeInfeasible_ = rhs.believeInfeasible_; nestedSearch_ = rhs.nestedSearch_; algorithm_=rhs.algorithm_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CbcSolver3::~CbcSolver3 () { delete [] node_; delete [] howMany_; } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcSolver3 & CbcSolver3::operator=(const CbcSolver3& rhs) { if (this != &rhs) { OsiClpSolverInterface::operator=(rhs); delete [] node_; delete [] howMany_; model_ = rhs.model_; int numberColumns = modelPtr_->numberColumns(); node_=CoinCopyOfArray(rhs.node_,numberColumns); howMany_=CoinCopyOfArray(rhs.howMany_,numberColumns); count_=rhs.count_; memory_=rhs.memory_; believeInfeasible_ = rhs.believeInfeasible_; nestedSearch_ = rhs.nestedSearch_; algorithm_=rhs.algorithm_; } return *this; } //------------------------------------------------------------------- // Real initializer //------------------------------------------------------------------- void CbcSolver3::initialize (CbcModel * model, const char * keep) { model_=model; int numberColumns = modelPtr_->numberColumns(); if (numberColumns) { node_ = new int[numberColumns]; howMany_ = new int[numberColumns]; for (int i=0;i #include #include "CoinPragma.hpp" // For Branch and bound #include "CbcModel.hpp" #include "CbcBranchActual.hpp" #include "OsiClpSolverInterface.hpp" // Time #include "CoinTime.hpp" /************************************************************************ This main program reads in an integer model from an mps file. It then tries to find SOS structure and solves using N-way variables *************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(MIPLIB3DIR) mpsFileName = MIPLIB3DIR "/10teams"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find miplib3 MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } int iRow, iColumn; int numberColumns = solver1.getNumCols(); int numberRows = solver1.getNumRows(); // get row copy const CoinPackedMatrix * matrix = solver1.getMatrixByRow(); const double * element = matrix->getElements(); const int * column = matrix->getIndices(); const CoinBigIndex * rowStart = matrix->getVectorStarts(); const int * rowLength = matrix->getVectorLengths(); const double * rowLower = solver1.getRowLower(); const double * rowUpper = solver1.getRowUpper(); const double * columnLower = solver1.getColLower(); // Look for possible SOS int numberSOS=0; int * mark = new int[numberColumns]; CoinFillN(mark,numberColumns,-1); for (iRow=0;iRow=0||columnLower[iColumn]) { goodRow=false; break; } } if (goodRow) { // mark all for (int j=rowStart[iRow];j2) { int minutes = atoi(argv[2]); std::cout<<"Stopping after "<=0); model.setDblParam(CbcModel::CbcMaximumSeconds,60.0*minutes); } // Switch off most output model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); //model.solver()->messageHandler()->setLogLevel(1); } //model.messageHandler()->setLogLevel(1); double time1 = CoinCpuTime(); // Do complete search model.branchAndBound(); std::cout<getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout< #include #include "CoinPragma.hpp" // For Branch and bound #include "CbcModel.hpp" #include "CbcBranchActual.hpp" #include "OsiClpSolverInterface.hpp" // Time #include "CoinTime.hpp" /************************************************************************ This main program reads in an integer model from an mps file. It then tries to find SOS structure *************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(MIPLIB3DIR) mpsFileName = MIPLIB3DIR "/10teams"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find miplib3 MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } int iRow, iColumn; int numberColumns = solver1.getNumCols(); int numberRows = solver1.getNumRows(); // get row copy const CoinPackedMatrix * matrix = solver1.getMatrixByRow(); const double * element = matrix->getElements(); const int * column = matrix->getIndices(); const CoinBigIndex * rowStart = matrix->getVectorStarts(); const int * rowLength = matrix->getVectorLengths(); const double * rowLower = solver1.getRowLower(); const double * rowUpper = solver1.getRowUpper(); const double * columnLower = solver1.getColLower(); // Look for possible SOS int numberSOS=0; int * mark = new int[numberColumns]; CoinFillN(mark,numberColumns,-1); for (iRow=0;iRow=0||columnLower[iColumn]) { goodRow=false; break; } } if (goodRow) { // mark all for (int j=rowStart[iRow];j2) { int minutes = atoi(argv[2]); std::cout<<"Stopping after "<=0); model.setDblParam(CbcModel::CbcMaximumSeconds,60.0*minutes); } // Switch off most output model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } model.messageHandler()->setLogLevel(1); double time1 = CoinCpuTime(); // Do complete search model.branchAndBound(); std::cout<getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout<1.0e-7) std::cout< #include #include //#define CBC_DEBUG #include "CoinPragma.hpp" #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchFollow2.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" // Default Constructor CbcFollowOn2::CbcFollowOn2 () : CbcObject(), rhs_(NULL), maximumRhs_(1) { } // Useful constructor CbcFollowOn2::CbcFollowOn2 (CbcModel * model) : CbcObject(model) { assert (model); OsiSolverInterface * solver = model_->solver(); matrix_ = *solver->getMatrixByCol(); matrix_.removeGaps(); matrixByRow_ = *solver->getMatrixByRow(); int numberRows = matrix_.getNumRows(); maximumRhs_ =1; rhs_ = new int[numberRows]; int i; const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); for (i=0;i=1.0&&value<100.0) { // check elements bool good=true; for (int j=rowStart[i];jisInteger(iColumn)) good=false; double elValue = elementByRow[j]; if (floor(elValue)!=elValue||elValue<1.0) good=false; } if (good) rhs_[i]=(int) value; } } } } // Copy constructor CbcFollowOn2::CbcFollowOn2 ( const CbcFollowOn2 & rhs) :CbcObject(rhs), matrix_(rhs.matrix_), matrixByRow_(rhs.matrixByRow_), maximumRhs_(rhs.maximumRhs_) { int numberRows = matrix_.getNumRows(); rhs_= CoinCopyOfArray(rhs.rhs_,numberRows); } // Clone CbcObject * CbcFollowOn2::clone() const { return new CbcFollowOn2(*this); } // Assignment operator CbcFollowOn2 & CbcFollowOn2::operator=( const CbcFollowOn2& rhs) { if (this!=&rhs) { CbcObject::operator=(rhs); delete [] rhs_; matrix_ = rhs.matrix_; matrixByRow_ = rhs.matrixByRow_; int numberRows = matrix_.getNumRows(); rhs_= CoinCopyOfArray(rhs.rhs_,numberRows); maximumRhs_ = rhs.maximumRhs_; } return *this; } // Destructor CbcFollowOn2::~CbcFollowOn2 () { delete [] rhs_; } /* As some computation is needed in more than one place - returns row. Also returns other row and effective rhs (so we can know if cut) */ int CbcFollowOn2::gutsOfFollowOn2(int & otherRow, int & preferredWay, int & effectiveRhs) const { int whichRow=-1; otherRow=-1; int numberRows = matrix_.getNumRows(); int i; // For sorting int * sort = new int [numberRows]; int * isort = new int [numberRows]; // Column copy //const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); const double * solution = solver->getColSolution(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); int nSort=0; for (i=0;iintegerTolerance) numberUnsatisfied++; } else { rhsValue -= (int)(value*floor(solValue+0.5)); } } if (numberUnsatisfied>1) { if (smallestrhsValue) printf("could fix\n"); if (number1==1&&largest==rhsValue) printf("could fix\n"); #endif if (rhsValue<=maximumRhs_&&0) { // will mean a cut but worth trying sort[nSort]=i; isort[nSort++]=100000-numberUnsatisfied; } } else if (largest==rhsValue) { sort[nSort]=i; isort[nSort++]=-numberUnsatisfied; } } } } if (nSort>1) { CoinSort_2(isort,isort+nSort,sort); assert (isort[1]<0); CoinZeroN(isort,numberRows); double * other = new double[numberRows]; CoinZeroN(other,numberRows); int * which = new int[numberRows]; //#define COUNT #ifndef COUNT bool beforeSolution = model_->getSolutionCount()==0; #endif for (int k=0;kintegerTolerance) { numberUnsatisfied++; for (int jj=columnStart[iColumn];jj>1; int best=numberUnsatisfied; #else double best; if (beforeSolution) best=dtarget; else best=1.0e30; #endif for (j=0;jbest) { best = fabs(dvalue-dtarget); iBest=iRow; if (dvalue=0) { whichRow=i; otherRow=iBest; //printf("Rows %d (%d) and %d (%d)\n",whichRow,rhs_[whichRow], // otherRow,rhs_[otherRow]); break; } } delete [] which; delete [] other; } delete [] sort; delete [] isort; return whichRow; } // Infeasibility - large is 0.5 double CbcFollowOn2::infeasibility(int & preferredWay) const { int otherRow=0; int effectiveRhs; int whichRow = gutsOfFollowOn2(otherRow,preferredWay,effectiveRhs); if (whichRow<0) { return 0.0; } else { assert (whichRow!=otherRow); return 2.0* model_->getDblParam(CbcModel::CbcIntegerTolerance); } } // This looks at solution and sets bounds to contain solution void CbcFollowOn2::feasibleRegion() { } // Creates a branching object CbcBranchingObject * CbcFollowOn2::createBranch(int way) { int otherRow=0; int preferredWay; int effectiveRhs; int whichRow = gutsOfFollowOn2(otherRow,preferredWay,effectiveRhs); assert(way==preferredWay); assert (whichRow>=0); int numberColumns = matrix_.getNumCols(); // Column copy //const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Row copy //const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); //const double * solution = solver->getColSolution(); #if 0 //printf("Rows %d (%d) and %d (%d)\n",whichRow,rhs_[whichRow], // otherRow,rhs_[otherRow]); int nFree=0; int nOut=0; int nImplicit=0; int i; int rhsx[100]; double * colUpper2 = new double [numberColumns]; memcpy(rhsx,rhs_,matrix_.getNumRows()*sizeof(int)); for ( i=0;i1.0e-5) { nonzero=true; //printf("column %d value %g ",i,solution[i]); for (int jj=columnStart[i];jjrhsx[iRow]) fixed=true; } if (fixed) { nImplicit++; colUpper2[i]=0.0; if (nonzero) nFixedBut++; assert (!columnLower[i]); } } } // See if anything odd char * check = new char[numberColumns]; memset(check,0,numberColumns); int * which2 = new int[numberColumns]; int numberRows=matrix_.getNumRows(); for (i=0;i=nn) abort(); } else if (nnsame==nn&&nn2>nn) { printf("row %d strict superset of row %d, fix some in row %d\n", k,i,k); } } } for (k=0;k #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcStrategy.hpp" #include "CbcBranchUser.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "CbcHeuristicLocal.hpp" #include "OsiClpSolverInterface.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglRedSplit.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding2.hpp" // Preprocessing #include "CglPreProcess.hpp" // Heuristics #include "CbcHeuristic.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It then sets up some Cgl cut generators and calls branch and cut. This is designed to show two things :- 1) Use of CbcStrategy to do preprocessing - this should be cleaner than old way 2) Looping round modifying solver and redoing branch and cut. This uses resetToReferenceCopy which resets stuff like the cutoff and any memory of previous branch and cut. ************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); /* Options are: preprocess to do preprocessing time in minutes if 2 parameters and numeric taken as time */ bool preProcess=false; double minutes=-1.0; int nGoodParam=0; for (int iParam=2; iParam=0.0) { nGoodParam+=2; iParam++; // skip time } } } } if (nGoodParam==0&&argc==3&&isdigit(argv[2][0])) { // If time is given then stop after that number of minutes minutes = atof(argv[2]); if (minutes>=0.0) nGoodParam=1; } if (nGoodParam!=argc-2&&argc>=2) { printf("Usage [preprocess] [time ] or \n"); exit(1); } //solver1.getModelPtr()->setLogLevel(0); solver1.messageHandler()->setLogLevel(0); solver1.initialSolve(); // Reduce printout solver1.setHintParam(OsiDoReducePrint,true,OsiHintTry); CbcModel model(solver1); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Set up some cut generators and defaults // Probing first as gets tight bounds on continuous CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(1); generator1.setMaxPassRoot(5); // Number of unsatisfied variables to look at generator1.setMaxProbe(10); generator1.setMaxProbeRoot(1000); // How far to follow the consequences generator1.setMaxLook(50); generator1.setMaxLookRoot(500); // Only look at rows with fewer than this number of elements generator1.setMaxElements(200); generator1.setRowCuts(3); CglGomory generator2; // try larger limit generator2.setLimit(300); CglKnapsackCover generator3; CglRedSplit generator4; // try larger limit generator4.setLimit(200); CglClique generator5; generator5.setStarCliqueReport(false); generator5.setRowCliqueReport(false); CglMixedIntegerRounding2 mixedGen; CglFlowCover flowGen; // Add in generators // Experiment with -1 and -99 etc model.addCutGenerator(&generator1,-1,"Probing"); model.addCutGenerator(&generator2,-1,"Gomory"); model.addCutGenerator(&generator3,-1,"Knapsack"); // model.addCutGenerator(&generator4,-1,"RedSplit"); model.addCutGenerator(&generator5,-1,"Clique"); model.addCutGenerator(&flowGen,-1,"FlowCover"); model.addCutGenerator(&mixedGen,-1,"MixedIntegerRounding"); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (model.solver()); // go faster stripes if (osiclp) { // Turn this off if you get problems // Used to be automatically set osiclp->setSpecialOptions(128); if(osiclp->getNumRows()<300&&osiclp->getNumCols()<500) { //osiclp->setupForRepeatedUse(2,1); osiclp->setupForRepeatedUse(0,1); } } // Uncommenting this should switch off most CBC messages //model.messagesPointer()->setDetailMessages(10,5,5000); // Allow rounding heuristic CbcRounding heuristic1(model); model.addHeuristic(&heuristic1); // And local search when new solution found CbcHeuristicLocal heuristic2(model); model.addHeuristic(&heuristic2); // Redundant definition of default branching (as Default == User) CbcBranchUserDecision branch; model.setBranchingMethod(&branch); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); // Do initial solve to continuous model.initialSolve(); // Could tune more double objValue = model.solver()->getObjSense()*model.solver()->getObjValue(); double minimumDropA=CoinMin(1.0,fabs(objValue)*1.0e-3+1.0e-4); double minimumDrop= fabs(objValue)*1.0e-4+1.0e-4; printf("min drop %g (A %g)\n",minimumDrop,minimumDropA); model.setMinimumDrop(minimumDrop); if (model.getNumCols()<500) model.setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (model.getNumCols()<5000) model.setMaximumCutPassesAtRoot(100); // use minimum drop else model.setMaximumCutPassesAtRoot(20); model.setMaximumCutPasses(10); //model.setMaximumCutPasses(2); // Switch off strong branching if wanted // model.setNumberStrong(0); // Do more strong branching if small if (model.getNumCols()<5000) model.setNumberStrong(10); model.setNumberStrong(20); //model.setNumberStrong(5); model.setNumberBeforeTrust(5); //model.setSizeMiniTree(2); model.solver()->setIntParam(OsiMaxNumIterationHotStart,100); // If time is given then stop after that number of minutes if (minutes>=0.0) { std::cout<<"Stopping after "<setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } // Default strategy will leave cut generators as they exist already // so cutsOnlyAtRoot (1) ignored // numberStrong (2) is 5 (default) // numberBeforeTrust (3) is 5 (default is 0) // printLevel (4) defaults (0) CbcStrategyDefault strategy(true,5,5); // Set up pre-processing to find sos if wanted if (preProcess) strategy.setupPreProcessing(2); model.setStrategy(strategy); // Go round adding cuts to cutoff last solution // Stop after finding 20 best solutions for (int iPass=0;iPass<20;iPass++) { time1 = CoinCpuTime(); // Do complete search model.branchAndBound(); std::cout<getNumCols(); const double * solution = model.bestSolution(); //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); // Get names from solver1 (as OsiSolverInterface may lose) std::vector columnNames = *solver1.getModelPtr()->columnNames(); int iColumn; std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout<getColLower(); const double * originalUpper = refSolver->getColUpper(); #endif CoinPackedVector cut; double rhs = 1.0; for (iColumn=0;iColumnisInteger(iColumn)) { // only works for 0-1 variables assert (originalLower[iColumn]==0.0&& originalUpper[iColumn]==1.0); // double check integer assert (fabs(floor(value+0.5)-value)<1.0e-5); if (value>0.5) { // at 1.0 cut.insert(iColumn,-1.0); rhs -= 1.0; } else { // at 0.0 cut.insert(iColumn,1.0); } } } // now add cut refSolver->addRow(cut,rhs,COIN_DBL_MAX); model.resetToReferenceSolver(); } return 0; } CoinMP-1.8.3/Cbc/examples/sample2.cpp0000644000175000017500000002610312131054214015663 0ustar renerene// $Id: sample2.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchUser.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "CbcStrategy.hpp" #include "CbcHeuristicLocal.hpp" #include "OsiClpSolverInterface.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglRedSplit.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding2.hpp" // Preprocessing #include "CglPreProcess.hpp" // Heuristics #include "CbcHeuristic.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It then sets up some Cgl cut generators and calls branch and cut. Branching is simple binary branching on integer variables. Node selection is depth first until first solution is found and then based on objective and number of unsatisfied integer variables. In this example the functionality is the same as default but it is a user comparison function. Variable branching selection is on maximum minimum-of-up-down change after strong branching on 5 variables closest to 0.5. A simple rounding heuristic is used. Preprocessing may be selected in two ways - the second is preferred now ************************************************************************/ #define PREPROCESS 2 int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string dirsep(1,CoinFindDirSeparator()); std::string mpsFileName; # if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR ; mpsFileName += dirsep+"p0033.mps"; # else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } # endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); /* Options are: preprocess to do preprocessing time in minutes if 2 parameters and numeric taken as time */ bool preProcess=false; double minutes=-1.0; int nGoodParam=0; for (int iParam=2; iParam=0.0) { nGoodParam+=2; iParam++; // skip time } } } } if (nGoodParam==0&&argc==3&&isdigit(argv[2][0])) { // If time is given then stop after that number of minutes minutes = atof(argv[2]); if (minutes>=0.0) nGoodParam=1; } if (nGoodParam!=argc-2&&argc>=2) { printf("Usage [preprocess] [time ] or \n"); exit(1); } solver1.initialSolve(); // Reduce printout solver1.setHintParam(OsiDoReducePrint,true,OsiHintTry); // See if we want preprocessing OsiSolverInterface * solver2=&solver1; #if PREPROCESS==1 CglPreProcess process; if (preProcess) { /* Do not try and produce equality cliques and do up to 5 passes */ solver2 = process.preProcess(solver1,false,5); if (!solver2) { printf("Pre-processing says infeasible\n"); exit(2); } solver2->resolve(); } #endif CbcModel model(*solver2); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Set up some cut generators and defaults // Probing first as gets tight bounds on continuous CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(1); generator1.setMaxPassRoot(5); // Number of unsatisfied variables to look at generator1.setMaxProbe(10); generator1.setMaxProbeRoot(1000); // How far to follow the consequences generator1.setMaxLook(50); generator1.setMaxLookRoot(500); // Only look at rows with fewer than this number of elements generator1.setMaxElements(200); generator1.setRowCuts(3); CglGomory generator2; // try larger limit generator2.setLimit(300); CglKnapsackCover generator3; CglRedSplit generator4; // try larger limit generator4.setLimit(200); CglClique generator5; generator5.setStarCliqueReport(false); generator5.setRowCliqueReport(false); CglMixedIntegerRounding2 mixedGen; CglFlowCover flowGen; // Add in generators // Experiment with -1 and -99 etc model.addCutGenerator(&generator1,-1,"Probing"); model.addCutGenerator(&generator2,-1,"Gomory"); model.addCutGenerator(&generator3,-1,"Knapsack"); // model.addCutGenerator(&generator4,-1,"RedSplit"); model.addCutGenerator(&generator5,-1,"Clique"); model.addCutGenerator(&flowGen,-1,"FlowCover"); model.addCutGenerator(&mixedGen,-1,"MixedIntegerRounding"); // Say we want timings int numberGenerators = model.numberCutGenerators(); int iGenerator; for (iGenerator=0;iGeneratorsetTiming(true); } OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (model.solver()); // go faster stripes if (osiclp) { // Turn this off if you get problems // Used to be automatically set osiclp->setSpecialOptions(128); if(osiclp->getNumRows()<300&&osiclp->getNumCols()<500) { //osiclp->setupForRepeatedUse(2,0); osiclp->setupForRepeatedUse(0,0); } } // Uncommenting this should switch off all CBC messages // model.messagesPointer()->setDetailMessages(10,10000,NULL); // Allow rounding heuristic CbcRounding heuristic1(model); model.addHeuristic(&heuristic1); // And local search when new solution found CbcHeuristicLocal heuristic2(model); model.addHeuristic(&heuristic2); // Redundant definition of default branching (as Default == User) CbcBranchUserDecision branch; model.setBranchingMethod(&branch); // Definition of node choice CbcCompareUser compare; model.setNodeComparison(compare); // Do initial solve to continuous model.initialSolve(); // Could tune more double objValue = model.solver()->getObjSense()*model.solver()->getObjValue(); double minimumDropA=CoinMin(1.0,fabs(objValue)*1.0e-3+1.0e-4); double minimumDrop= fabs(objValue)*1.0e-4+1.0e-4; printf("min drop %g (A %g)\n",minimumDrop,minimumDropA); model.setMinimumDrop(minimumDrop); if (model.getNumCols()<500) model.setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (model.getNumCols()<5000) model.setMaximumCutPassesAtRoot(100); // use minimum drop else model.setMaximumCutPassesAtRoot(20); model.setMaximumCutPasses(10); //model.setMaximumCutPasses(2); // Switch off strong branching if wanted // model.setNumberStrong(0); // Do more strong branching if small if (model.getNumCols()<5000) model.setNumberStrong(10); model.setNumberStrong(20); //model.setNumberStrong(5); model.setNumberBeforeTrust(5); model.solver()->setIntParam(OsiMaxNumIterationHotStart,100); // If time is given then stop after that number of minutes if (minutes>=0.0) { std::cout<<"Stopping after "<setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } //model.messageHandler()->setLogLevel(2); //model.solver()->messageHandler()->setLogLevel(2); //model.setPrintFrequency(50); //#define DEBUG_CUTS #ifdef DEBUG_CUTS // Set up debugger by name (only if no preprocesing) if (!preProcess) { std::string problemName ; model.solver()->getStrParam(OsiProbName,problemName) ; model.solver()->activateRowCutDebugger(problemName.c_str()) ; } #endif #if PREPROCESS==2 // Default strategy will leave cut generators as they exist already // so cutsOnlyAtRoot (1) ignored // numberStrong (2) is 5 (default) // numberBeforeTrust (3) is 5 (default is 0) // printLevel (4) defaults (0) CbcStrategyDefault strategy(true,5,5); // Set up pre-processing to find sos if wanted if (preProcess) strategy.setupPreProcessing(2); model.setStrategy(strategy); #endif // Do complete search model.branchAndBound(); std::cout<cutGeneratorName()<<" was tried " <numberTimesEntered()<<" times and created " <numberCutsInTotal()<<" cuts of which " <numberCutsActive()<<" were active after adding rounds of cuts"; if (generator->timing()) std::cout<<" ( "<timeInCutGenerator()<<" seconds)"<getNumCols(); const double * solution = solver->getColSolution(); // Get names from solver1 (as OsiSolverInterface may lose) std::vector columnNames = *solver1.getModelPtr()->columnNames(); int iColumn; std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout< #include #include "CoinPragma.hpp" // For Branch and bound #include "CbcModel.hpp" #include "CbcBranchLotsize.hpp" #include "OsiClpSolverInterface.hpp" // Time #include "CoinTime.hpp" /************************************************************************ This main program reads in an integer model from an mps file. It then replaces all 0-1 variables by lotsizing variables which can take values 0.0,0.45-0.55 or 1.0 *************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(MIPLIB3DIR) mpsFileName = MIPLIB3DIR "/10teams"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find miplib3 MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } int iColumn; int numberColumns = solver1.getNumCols(); int numberLot=0; char * mark = new char[numberColumns]; // take off integers but find where they are for (iColumn=0;iColumn2) { int minutes = atoi(argv[2]); std::cout<<"Stopping after "<=0); model.setDblParam(CbcModel::CbcMaximumSeconds,60.0*minutes); } // Switch off most output model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } model.messageHandler()->setLogLevel(1); double time1 = CoinCpuTime(); // Do complete search model.branchAndBound(); std::cout<getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7) std::cout< #include // For Branch and bound #include "CoinPragma.hpp" #include "CbcModel.hpp" #include "CbcStrategy.hpp" #include "OsiClpSolverInterface.hpp" // Preprocessing #include "CglPreProcess.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It then uses default strategy - just cuts at root node ************************************************************************/ int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); /* Options are: preprocess to do preprocessing time in minutes if 2 parameters and numeric taken as time */ bool preProcess=false; double minutes=-1.0; int nGoodParam=0; for (int iParam=2; iParam=0.0) { nGoodParam+=2; iParam++; // skip time } } } } if (nGoodParam==0&&argc==3&&isdigit(argv[2][0])) { // If time is given then stop after that number of minutes minutes = atof(argv[2]); if (minutes>=0.0) nGoodParam=1; } if (nGoodParam!=argc-2&&argc>=2) { printf("Usage [preprocess] [time ] or \n"); exit(1); } // See if we want preprocessing OsiSolverInterface * solver2=&solver1; CglPreProcess process; if (preProcess) { /* Do not try and produce equality cliques and do up to 5 passes */ solver2 = process.preProcess(solver1,false,5); if (!solver2) { printf("Pre-processing says infeasible\n"); exit(2); } solver2->resolve(); } CbcModel model(*solver2); // If time is given then stop after that number of minutes if (minutes>=0.0) { std::cout<<"Stopping after "<getNumCols(); const double * solution = solver->getColSolution(); int iColumn; std::cout<1.0e-7&&solver->isInteger(iColumn)) std::cout< #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CoinModel.hpp" // For Linked Ordered Sets #include "CbcBranchLink.hpp" #include "OsiClpSolverInterface.hpp" #include "CoinTime.hpp" /************************************************************************ This shows how we can define a new branching method to solve problems with nonlinearities and discontinuities. We are going to solve the problem minimize abs ( 1.0/6.931 - x1*x4/x2*x3) where the variables are integral between 12 and 60. See E.Sangren, "Nonlinear Integer and Discrete Programming in Mechanical Design Optimization". Trans. ASME, J. Mech Design 112, 223-229, 1990 One could try to use logarithms to make the problem separable but that leads to a weak formulation. Instaed we are going to use linked special ordered sets. The generalization with column generation can be even more powerful but is not yet in CBC. The idea is simple: A linear variable is a convex combination of its lower bound and upper bound! If x must lie between 12 and 60 then we can substitute for x as x == 12.0*xl + 60.0*xu where xl + xu == 1.0. At first this looks cumbersome but if we have xl12, xl13, ... xl60 and corresponding xu and yl and yu then we can write: x == sum 12.0*xl[i] + 60.0* xu[i] where sum xl[i] + xu[i] == 1.0 and x*y == 12.0*12.0*xl12 + 12.0*60.0*xu12 + 13.0*12.0*xl13 + 13.0*60.0*x13 .... + 12.0*60*.0xl60 + 60.0*60.0*xu60 And now x*y is correct if x is integer and xl[i], xu[i] are only nonzero for one i. Note that this would have worked just as easily for y**2 or any clean function of y. So this is just like a special ordered set of type 1 but on two sets simultaneously. The idea is even more powerful if we want other functions on y as we can branch on all sets simultaneously. Also note that convexity requirements for any non-linear functions are not needed. So we need a new branching method to do that - see CbcBranchLink.?pp We are going to need a CbcBranchLink method to see whether we are satisfied etc and also to create another branching object which knows how to fix variables. We might be able to use an existing method for the latter but let us create two methods CbcLink and CbcLinkBranchingObject. For CbcLink we will need the following methods: Constructot/Destructor infeasibility - returns 0.0 if feasible otherwise some measure of infeasibility feasibleRegion - sets bounds to contain current solution createBranch - creates a CbcLinkBranchingObject For CbcLinkBranchingObject we need: Constructor/Destructor branch - does actual fixing print - optional for debug purposes. The easiest way to do this is to cut and paste from CbcBranchActual to get current SOS stuff and then modify that. ************************************************************************/ int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; /* We are going to treat x1 and x2 as integer and x3 and x4 as a set. We define two new variables y1 == x1*x4 and y2 == x2*x3. We define a variable z == x1*x4/x2*x3 so y2*z == y1 (we will treat y2 as a set) Then we have objective - minimize w1 + w2 where w1 - w2 = 1.0/6.931 - z The model would be a lot smaller if we had column generation. */ // Create model CoinModel build; // Keep values of all variables for reporting purposes even if not necessary /* z is first, then x then y1,y2 then w1,w2 then y1 stuff, y2 stuff and finally y2 -> z stuff. For rows same but 2 per y then rest of z stuff */ int loInt=12; int hiInt=60; int ybaseA=5, ybaseB=9, ylen=hiInt-loInt+1; int base = ybaseB+2*2*ylen; int yylen = hiInt*hiInt-loInt*loInt+1; int zbase = 10; int i; // Do single variables double value[] ={1.0,1.0}; int row[2]; /* z - obviously we can't choose bounds too tight but we need bounds so choose 20% off as obviously feasible. fastest way to solve would be too run for a few seconds to get tighter bounds then re-formulate and solve. */ double loose=0.2; double loZ = (1-loose)*(1.0/6.931), hiZ = (1+loose)*(1.0/6.931); row[0]=0; // for reporting row[1]=zbase+1; // for real use build.addColumn(2,row,value,loZ, hiZ, 0.0); // x for (i=0;i<4;i++) { row[0]=i+1; build.addColumn(1,row,value,loInt, hiInt,0.0); // we don't need to say x2, x3 integer but won't hurt build.setInteger(i+1); } // y for (i=0;i<2;i++) { // y from x*x, and convexity row[0]=ybaseA+2*i; if (i==0) row[1]=zbase+2; // yb*z == ya else row[1]=zbase-1; // to feed into z build.addColumn(2,row,value,loInt*loInt, hiInt*hiInt,0.0); // we don't need to say integer but won't hurt build.setInteger(ybaseA+i); } // skip z convexity put w in final equation row[0]=zbase+1; build.addColumn(1,row,value,0.0,1.0,1.0); value[0]=-1.0; build.addColumn(1,row,value,0.0,1.0,1.0); // Do columns so we know where each is for (i=ybaseB;isetHintParam(OsiDoReducePrint,true,OsiHintTry); model.solver()->setHintParam(OsiDoScale,false,OsiHintTry); CbcObject ** objects = new CbcObject * [3]; /* Format is number in sets, number in each link, first variable in matrix) and then a weight for each in set to say where to branch. In this case use NULL to say 0,1,2 ... Finally a set number as ID. */ objects[0]=new CbcLink(&model,ylen,2,ybaseB,NULL,0); objects[0]->setPriority(10); objects[1]=new CbcLink(&model,ylen,2,ybaseB+2*ylen,NULL,0); objects[1]->setPriority(20); objects[2]=new CbcLink(&model,yylen,2,base,NULL,0); objects[2]->setPriority(1); model.addObjects(3,objects); for (i=0;i<3;i++) delete objects[i]; delete [] objects; model.messageHandler()->setLogLevel(1); // Do complete search model.setDblParam(CbcModel::CbcMaximumSeconds,1200.0); model.setDblParam(CbcModel::CbcCutoffIncrement,1.0e-8); model.branchAndBound(); std::cout<<"took "<getNumCols(); double x1=solution[1]; double x2=solution[2]; double x3=solution[3]; double x4=solution[4]; printf("Optimal solution %g %g %g %g\n",x1,x2,x3,x4); for (int iColumn=0;iColumn1.0e-7) std::cout< #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchUser.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "CbcHeuristicLocal.hpp" #include "ClpQuadInterface.hpp" // Cuts - some may work but be very very careful #include "CglProbing.hpp" // Heuristics would need adapting #include "CbcHeuristic.hpp" // Time #include "CoinTime.hpp" /************************************************************************ This main program reads in a quadratic integer model from an mps file. It then sets up some Cgl cut generators and calls branch and cut. Branching is simple binary branching on integer variables. Node selection is depth first until first solution is found and then based on objective and number of unsatisfied integer variables. In this example the functionality is the same as default but it is a user comparison function. Variable branching selection is on maximum minimum-of-up-down change after strong branching on 5 variables closest to 0.5. A simple rounding heuristic could be used.but is switched off as needs work for quadratic This is NOT meant to be a serious MIQP code; it is to show how you can use ClpQuadInterface.hpp to solve a QP at each node. You could pick up data in that interface and use any QP solver (e.g. one that works) ************************************************************************/ int main (int argc, const char *argv[]) { // Define a Solver which inherits from OsiClpsolverInterface -> OsiSolverInterface ClpQuadInterface solver1; // Read in model using argv[1] if (argc <= 1) { printf("using %s \n", argv[0]); return 1; } // must use clp to get a quadratic model ClpSimplex * clp = solver1.getModelPtr(); int numMpsReadErrors = clp->readMps(argv[1]); // and assert that it is a clean model if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } // This clones solver CbcModel model(solver1); // But now model doesn't know about integers! const char * integerInfo = clp->integerInformation(); int numberColumns = clp->numberColumns(); // and point to solver OsiSolverInterface * solver2 = model.solver(); for (int iColumn=0;iColumnsetInteger(iColumn); } // Okay - now we have a good MIQP solver // Within branch and cut it is better (at present) to switch off all objectives ClpQuadInterface * osiclp = dynamic_cast< ClpQuadInterface*> (solver2); assert (osiclp); // Set fake objective so Cbc not confused osiclp->initialize(); solver2->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Set up some cut generators and defaults // Probing first as gets tight bounds on continuous CglProbing generator1; // can not use objective generator1.setUsingObjective(false); generator1.setMaxPass(3); generator1.setMaxProbe(100); generator1.setMaxLook(50); generator1.setRowCuts(3); // Add in generators // Only some generators work (and even then try without first) model.addCutGenerator(&generator1,1,"Probing"); // Allow rounding heuristic CbcRounding heuristic1(model); // do not add yet as don't know how to deal with quadratic objective //model.addHeuristic(&heuristic1); // Redundant definition of default branching (as Default == User) CbcBranchUserDecision branch; model.setBranchingMethod(&branch); // Definition of node choice CbcCompareUser compare; // breadth first //compare.setWeight(0.0); model.setNodeComparison(compare); // Do initial solve to continuous model.initialSolve(); // Could tune more model.setMinimumDrop(CoinMin(1.0, fabs(model.getMinimizationObjValue())*1.0e-3+1.0e-4)); model.setMaximumCutPassesAtRoot(0); model.setMaximumCutPasses(0); // Switch off strong branching if wanted //model.setNumberStrong(5); model.solver()->setIntParam(OsiMaxNumIterationHotStart,10000); // If time is given then stop after that number of minutes if (argc>2) { int minutes = atoi(argv[2]); std::cout<<"Stopping after "<=0); model.setDblParam(CbcModel::CbcMaximumSeconds,60.0*minutes); } // Switch off most output if (model.getNumCols()<3000) { model.messageHandler()->setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } model.setPrintFrequency(50); double time1 = CoinCpuTime(); // Do complete search model.branchAndBound(); std::cout<cutGeneratorName()<<" was tried " <numberTimesEntered()<<" times and created " <numberCutsInTotal()<<" cuts of which " <numberCutsActive()<<" were active after adding rounds of cuts" <getNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout< #include #include #include /* prototypes */ void printSolution(Cbc_Model *cbc_model); Cbc_Model * getDefaultModel(int argc, const char *argv[]); /* Call back function - just says whenever it gets Clp0005 or Coin0002 */ /* TODO: It seems that Cbc gives callbacks but not Coin */ static void callBack(Cbc_Model * model, int messageNumber, int nDouble, const double * vDouble, int nInt, const int * vInt, int nString, char ** vString) { const char prefix[] = "cbc_driverC_sos.cpp::callBack(): "; const int VERBOSE = 4; if (VERBOSE>0) printf("%s begin\n",prefix); if (VERBOSE>1) printf("%s messageNumber %i\n",prefix,messageNumber); if (messageNumber==1000002) { /* Coin0002 */ assert (nString==1&&nInt==3); printf("Name of problem is %s\n",vString[0]); printf("row %d col %d el %d\n",vInt[0],vInt[1],vInt[2]); } else if (messageNumber==5) { /* Clp0005 */ int i; assert (nInt==4&&nDouble==3); /* they may not all print */ for (i=0;i<3;i++) printf("%d %g\n",vInt[i],vDouble[i]); } if (VERBOSE>0) printf("%s return\n",prefix); } /** * Get default model */ Cbc_Model * getDefaultModel(int argc, const char *argv[]) { const char prefix[] = "cbc_driverC_sos.cpp::getDefaultModel(): "; const int VERBOSE = 4; Cbc_Model *model; int status; if (VERBOSE>0) printf("%s begin\n",prefix); model = Cbc_newModel(); /** Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - verbose above that 8,16,32 etc just for selective debug */ Cbc_setLogLevel(model, 1); if (VERBOSE>0) printf("%s Log Level %i\n", prefix, Cbc_logLevel(model)); /* register callback */ Cbc_registerCallBack(model,callBack); /* Keep names when reading an mps file */ if (argc < 2) { #if defined(SAMPLEDIR) /* SAMPLEDIR should be something like "path/to/mps/directory", including the quotes and excluding the final directory separator. Don't forget to properly escape '\' when using native Windows path syntax. */ status=Cbc_readMps(model, SAMPLEDIR "/p0033.mps") ; #else fprintf(stderr, "Please specify the full path to an MPS file on the command line\n"); exit(1); #endif } else status=Cbc_readMps(model,argv[1]); if (status) { fprintf(stderr,"Bad readMps %s\n",argv[1]); fprintf(stdout,"Bad readMps %s\n",argv[1]); exit(1); } Cbc_setOptimizationDirection(model, 1); if (1) Cbc_setIntegerTolerance(model, 1.0e-5); /* Solve initial LP relaxation */ Cbc_initialSolve(model); if (VERBOSE>0) printf("%s return\n",prefix); return model; } /* getDefaultModel() */ void printSolution(Cbc_Model *cbc_model) { /* Now to print out solution. The methods used return modifiable arrays while the alternative names return const pointers - which is of course much more virtuous. This version just does non-zero column and row values. */ /* If we have not kept names (parameter to readMps) this will be 0 assert(Cbc_lengthNames(cbc_model)); */ { int name_length = 256; char model_name[256]; Cbc_problemName(cbc_model, name_length, model_name); printf("Model Name = '%s'\n", model_name); } printf("Iteration Count = %i\n",Cbc_getIterationCount(cbc_model)); printf("Iteration Limit = %i\n",Cbc_maximumIterations(cbc_model)); printf("Is Abandoned = %i\n",Cbc_isAbandoned(cbc_model)); printf("Is Proven Optimal = %i\n",Cbc_isProvenOptimal(cbc_model)); printf("Is Proven Infeasible = %i\n",Cbc_isProvenPrimalInfeasible(cbc_model)); printf("Is Proven Dual Infeasible = %i\n",Cbc_isProvenDualInfeasible(cbc_model)); printf("Is Proven Unbounded = %i\n",(Cbc_infeasibilityRay(cbc_model) == NULL) ? 0 : 1); printf("Is Primal Objective Limit Reached = %i\n",Cbc_isPrimalObjectiveLimitReached(cbc_model)); printf("Is Dual Objective Limit Reached = %i\n",Cbc_isDualObjectiveLimitReached(cbc_model)); printf("Is Iteration Limit Reached = %i\n",Cbc_isIterationLimitReached(cbc_model)); printf("Objective Sense = %g\n",Cbc_getObjSense(cbc_model)); /* (1 - minimize, -1 - maximize, 0 - ignore) */ printf("Primal Feasible = %i\n",Cbc_primalFeasible(cbc_model)); printf("Dual Feasible = %i\n",Cbc_dualFeasible(cbc_model)); printf("Dual Bound = %g\n",Cbc_dualBound(cbc_model)); printf("Infeasibility Cost = %g\n",Cbc_infeasibilityCost(cbc_model)); printf("Sum Dual Infeasibilities = %g\n",Cbc_sumDualInfeasibilities(cbc_model)); printf("Number Dual Infeasibilities = %i\n",Cbc_numberDualInfeasibilities(cbc_model)); printf("Sum Primal Infeasibilities = %g\n",Cbc_sumPrimalInfeasibilities(cbc_model)); printf("Number Primal Infeasibilities = %i\n",Cbc_numberPrimalInfeasibilities(cbc_model)); printf("Objective Value = %g\n",Cbc_objectiveValue(cbc_model)); printf("Optimization Direction = %g\n", Cbc_optimizationDirection(cbc_model)); printf(" (1 - minimize, -1 - maximize, 0 - ignore)\n"); printf("--------------------------------------\n"); /* Rows */ { int numberRows = Cbc_numberRows(cbc_model); int iRow; const double * rowPrimal = Cbc_getRowActivity(cbc_model); const double * rowDual = Cbc_getRowPrice(cbc_model); const double * rowLower = Cbc_getRowLower(cbc_model); const double * rowUpper = Cbc_getRowUpper(cbc_model); assert(rowPrimal != NULL); assert(rowDual != NULL); assert(rowLower != NULL); assert(rowUpper != NULL); printf(" Primal Dual Lower Upper\n"); for (iRow=0;iRow1.0e-8||value<-1.0e-8) { char name[20]; sprintf(name," Row%-4i",iRow); printf("%6d %8s",iRow,name); printf(" %13g",rowPrimal[iRow]); printf(" %13g",rowDual[iRow]); printf(" %13g",rowLower[iRow]); printf(" %13g",rowUpper[iRow]); printf("\n"); } } } printf("--------------------------------------\n"); /* Columns */ { int numberColumns = Cbc_numberColumns(cbc_model); int iColumn; const double * columnPrimal = Cbc_getColSolution(cbc_model); const double * columnDual = Cbc_getReducedCost(cbc_model); const double * columnLower = Cbc_getColLower(cbc_model); const double * columnUpper = Cbc_getColUpper(cbc_model); const double * columnObjective = Cbc_getObjCoefficients(cbc_model); assert(columnPrimal != NULL); assert(columnDual != NULL); assert(columnLower != NULL); assert(columnUpper != NULL); assert(columnObjective != NULL); printf(" Primal Dual Lower Upper Cost\n"); for (iColumn=0;iColumn1.0e-8||value<-1.0e-8) { char name[20]; sprintf(name," Col%-4i",iColumn); /* Cbc_columnName(cbc_model,iColumn,name); */ printf("%6d %8s",iColumn,name); printf(" %13g",columnPrimal[iColumn]); printf(" %13g",columnDual[iColumn]); printf(" %13g",columnLower[iColumn]); printf(" %13g",columnUpper[iColumn]); printf(" %13g",columnObjective[iColumn]); printf("\n"); } } } printf("--------------------------------------\n"); } /* printSolution() */ int main (int argc, const char *argv[]) { const char prefix[] = "cbc_driverC_sos.cpp:main(): "; const int VERBOSE = 4; Cbc_Model * model, * model2; double time1; char modelName[80]; int numberIntegers; int * integerVariable; if (VERBOSE>0) printf("%s begin\n",prefix); if (VERBOSE>0) printf("%s Version %g\n",prefix,Cbc_getVersion()); /* set model using the local routine for reading an MPS file */ model = getDefaultModel(argc, argv); model2 = NULL; /* used to keep model around */ /* This clause ought to set the initial basis, but does not yet work. */ { int i; int row_length = Cbc_getNumRows(model); int col_length = Cbc_getNumCols(model); int rim_length = row_length + col_length; int elem_length = Cbc_getNumElements(model); int * cbc_rowStatus = NULL; int * cbc_columnStatus = NULL; if (0) { fprintf(stdout,"%s row_length = %i\n", prefix, row_length); fprintf(stdout,"%s col_length = %i\n", prefix, col_length); fprintf(stdout,"%s rim_length = %i\n", prefix, rim_length); fprintf(stdout,"%s elem_length = %i\n", prefix, elem_length); fflush(stdout); } /* print solution status variables */ if (0) { if (cbc_rowStatus) { for (i = 0; i < row_length; i++) { printf("%s cbc_rowStatus[%i] = %i\n", prefix, i, cbc_rowStatus[i]); fflush(stdout); } } else { fprintf(stdout,"%s cbc_rowStatus = %p\n", prefix, (void*)cbc_rowStatus); fflush(stdout); } if (cbc_columnStatus) { for (i = 0; i < row_length; i++) { fprintf(stdout,"%s cbc_rowStatus[%i] = %i\n", prefix, i, cbc_columnStatus[i]); fflush(stdout); } } else { fprintf(stdout,"%s cbc_columnStatus = %p\n", prefix, (void*)cbc_columnStatus); fflush(stdout); } } } /* Save model as a clone (does not work as of 2004). */ model2 = Cbc_clone(model); /* Store which variables are integer as defined in the MPS file. They will be set to Continuous before adding the SOS constraints. */ { int i; int numberColumns=Cbc_getNumCols(model); numberIntegers = 0; integerVariable = malloc(numberColumns*sizeof(int[1])); for ( i=0;i3) printf("%s integerVariable[%i] = %i\n",prefix, numberIntegers-1, integerVariable[numberIntegers-1]); } } } Cbc_problemName(model,80,modelName); /* Solve the MPS version of the problem */ if (1) { if (VERBOSE>1) { printf("%s Solve MPS version of the problem\n",prefix); printf("%s Optimization Direction = %g (1 - minimize, -1 - maximize, 0 - ignore)\n", prefix, Cbc_optimizationDirection(model)); } /* Cbc_setLogLevel(model, VERBOSE); // 4 is verbose */ time1 = Cbc_cpuTime(model) ; Cbc_branchAndBound(model); if (VERBOSE>1) printf("Model %s has %d rows and %d columns\n", modelName,Cbc_numberRows(model),Cbc_numberColumns(model)); if (VERBOSE>1) printf("%s Solving model %s took %g seconds, %i nodes with objective %g\n", prefix, modelName, (Cbc_cpuTime(model)-time1), Cbc_getNodeCount(model), Cbc_getObjValue(model)); if (VERBOSE>0) (!Cbc_status(model)) ? printf(" Finished\n") : printf(" Not finished\n"); if (VERBOSE>2) printSolution(model); } { /* SOS specification data specify numberSets, numPoints, and whichRanges explicitly NOTE: These need to be commented according to the MPS file. Example_1_1: Cbc0004I MPS reads 1081 only columns out of 1085 Then the 4th range goes out of bounds Example_2: Cbc0006I The LP relaxation is infeasible or too expensive Mod_RT_1: Cbc0006I The LP relaxation is infeasible or too expensive */ const int numberSets = 1; /* dummy // 4; // Example_1_1 // 2; // Example_2 // 2; // Mod_RT_1 // 2; // SITH */ const int numPoints = 1; /* dummy // 257; // Example_1_1 // 256; // Example_2 // 257; // Mod_RT_1 // 257; // SITH */ const int whichRanges[1][2] = { /* counting from zero? */ {0,0} /* dummy */ /* {56,312}, {313, 569}, {572, 828}, {829, 1085} // Example_1_1 {48, 303}, {304, 559} // Example_2 {45, 301}, {302, 558} // Mod_RT_1 {45, 301}, {302, 558} // SITH */ }; /* the rest is determined parametrically */ int *len = malloc(numberSets* sizeof(int[1])); int **which = malloc(numberSets* sizeof(int[1])); int setNum, pointNum; double *weights; int i, j; for (setNum = 0; setNum < numberSets; setNum++) { len[setNum] = whichRanges[setNum][1] - whichRanges[setNum][0] + 1; if (len[setNum] != numPoints) { printf("%s ERROR: len[%i] (%i) != numPoints (%i)\n", prefix, setNum, len[setNum], numPoints); return 1; } which[setNum] = malloc(numPoints*sizeof(int[1])); for (j = 0; j < len[setNum]; j++) which[setNum][j] = whichRanges[setNum][0] + j; /* Example_2 */ } weights = malloc(numPoints*sizeof(double[1])); for (pointNum = 0; pointNum < numPoints; pointNum++) weights[pointNum] = pointNum+1; /* Now use SOS2 NOTE: Only enable this if known good SOS Specification (above) */ if (1) { if (VERBOSE>1) printf("%s Use SOS2\n",prefix); /* Restore model */ Cbc_deleteModel(model); if (0) { model = Cbc_clone(model2); } else { model = getDefaultModel(argc, argv); } /* Cbc_setLogLevel(model, 4); // 4 is verbose */ if (VERBOSE>1) printf("%s Model %s has %d rows and %d columns\n", prefix, modelName,Cbc_numberRows(model),Cbc_numberColumns(model)); /* make SOS cuts */ for (i=0;i1) { printf("%s Solve MPS version of the problem\n",prefix); printf("%s Optimization Direction = %g (1 - minimize, -1 - maximize, 0 - ignore)\n", prefix, Cbc_optimizationDirection(model)); } if (VERBOSE>1) printf("%s calling Cbc_scaling()\n",prefix); Cbc_scaling(model,1); time1 = Cbc_cpuTime(model) ; if (VERBOSE>1) printf("%s calling Cbc_initialSolve()\n",prefix); Cbc_initialSolve(model); if (VERBOSE>3) Cbc_printModel(model,prefix); if (VERBOSE>1) printf("%s calling Cbc_branchAndBound()\n",prefix); Cbc_branchAndBound(model); if (VERBOSE>1) printf("%s %s took %g seconds, %i nodes with objective %g\n", prefix, modelName, (Cbc_cpuTime(model)-time1), Cbc_getNodeCount(model), Cbc_getObjValue(model)); if (VERBOSE>0) (!Cbc_status(model)) ? printf(" Finished\n") : printf(" Not finished\n"); if (VERBOSE>2) printSolution(model); } if (VERBOSE>1) printf("%s Log Level %i\n", prefix, Cbc_logLevel(model)); if (VERBOSE>0) printf("%s return 0\n",prefix); return 0; } /* main() */ CoinMP-1.8.3/Cbc/examples/sample3.cpp0000644000175000017500000003203512131054214015665 0ustar renerene// $Id: sample3.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CbcConfig.h" #include "CoinPragma.hpp" #include #include // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchUser.hpp" #include "CbcCompareUser.hpp" #include "CbcTreeLocal.hpp" #include "CbcCutGenerator.hpp" #include "CbcHeuristicLocal.hpp" #include "OsiClpSolverInterface.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" // Heuristics #include "CbcHeuristic.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It then sets up some Cgl cut generators and calls branch and cut. Branching is simple binary branching on integer variables. Node selection is depth first until first solution is found and then based on objective and number of unsatisfied integer variables. In this example the functionality is the same as default but it is a user comparison function. Variable branching selection is on maximum minimum-of-up-down change after strong branching on 5 variables closest to 0.5. A simple rounding heuristic is used. ************************************************************************/ // See if option there and return integer value - or -123456 bool option(int argc, const char *argv[],const char * check, int & value) { value=-123456; for (int i=1;igetNumCols(); const double * solution = model.solver()->getColSolution(); int iColumn; std::cout<1.0e-7&&model.solver()->isInteger(iColumn)) std::cout<0.5&&model.solver()->isInteger(i)) { if (comma) printf(","); if (newLine) printf("\n"); printf("%d ",i); comma=true; newLine=false; n++; if (n==10) { n=0; newLine=true; } } } printf("};\n"); n=0; comma=false; newLine=false; printf("\tdouble intSolnV[]={\n"); for ( i=0;i0.5&&model.solver()->isInteger(i)) { if (comma) printf(","); if (newLine) printf("\n"); int value = (int) (solution[i]+0.5); printf("%d. ",value); comma=true; newLine=false; n++; if (n==10) { n=0; newLine=true; } } } printf("};\n"); } return 0; } CoinMP-1.8.3/Cbc/examples/pool.cpp0000644000175000017500000000651612175700730015310 0ustar renerene// $Id: driver4.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPragma.hpp" #include "CbcModel.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcSolver.hpp" #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program shows how to take advantage of the standalone cbc in your program, while still making major modifications. First it reads in an integer model from an mps file Then it initializes the integer model with cbc defaults Then it calls CbcMain1 passing all parameters apart from first but with callBack to modify stuff Finally it prints solution */ int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } // Tell solver to return fast if presolve or initial solve infeasible solver1.getModelPtr()->setMoreSpecialOptions(3); // Pass to Cbc initialize defaults CbcModel modelA(solver1); CbcModel * model = &modelA; CbcMain0(modelA); modelA.setMaximumSavedSolutions(5); /* Now go into code for standalone solver Could copy arguments and add -quit at end to be safe but this will do */ if (argc>2) { CbcMain1(argc-1,argv+1,modelA); } else { const char * argv2[]={"driver4","-solve","-quit"}; CbcMain1(3,argv2,modelA); } // Solver was cloned so get current copy OsiSolverInterface * solver = model->solver(); // Print solution if finished (could get from model->bestSolution() as well if (model->bestSolution()) { int numberColumns = solver->getNumCols(); std::cout<1.0e-7&&solver1.isInteger(iColumn)) std::cout<columnName(iColumn) < #include "CoinTime.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "ClpFactorization.hpp" #include "ClpObjective.hpp" #include "ClpSimplex.hpp" #include "ClpSolve.hpp" #include "CbcSolver2.hpp" #include "CbcModel.hpp" #include "CoinModel.hpp" static int timesBad_=0; static int iterationsBad_=0; //############################################################################# // Solve methods //############################################################################# void CbcSolver2::initialSolve() { modelPtr_->scaling(0); setBasis(basis_,modelPtr_); // Do long thin by sprint ClpSolve options; options.setSolveType(ClpSolve::usePrimalorSprint); options.setPresolveType(ClpSolve::presolveOff); options.setSpecialOption(1,3,30); modelPtr_->initialSolve(options); basis_ = getBasis(modelPtr_); modelPtr_->setLogLevel(0); } //----------------------------------------------------------------------------- void CbcSolver2::resolve() { int numberColumns = modelPtr_->numberColumns(); if ((count_<10&&algorithm_==2)||!algorithm_) { OsiClpSolverInterface::resolve(); if (modelPtr_->status()==0) { count_++; double * solution = modelPtr_->primalColumnSolution(); int i; for (i=0;i1.0e-6||modelPtr_->getStatus(i)==ClpSimplex::basic) { node_[i]=CoinMax(count_,node_[i]); howMany_[i]++; } } } else { if (!algorithm_==2) printf("infeasible early on\n"); } } else { // use counts int numberRows=modelPtr_->numberRows(); int * whichRow = new int[numberRows]; int * whichColumn = new int [numberColumns]; int i; const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); const double * rowUpper = modelPtr_->rowUpper(); bool equality=false; for (i=0;imatrix()->getElements(); const int * row = modelPtr_->matrix()->getIndices(); const CoinBigIndex * columnStart = modelPtr_->matrix()->getVectorStarts(); const int * columnLength = modelPtr_->matrix()->getVectorLengths(); int * rowActivity = new int[numberRows]; memset(rowActivity,0,numberRows*sizeof(int)); int * rowActivity2 = new int[numberRows]; memset(rowActivity2,0,numberRows*sizeof(int)); char * mark = new char[numberColumns]; memset(mark,0,numberColumns); // Get rows which are satisfied for (i=0;i0.0) { CoinBigIndex j; for (j=columnStart[i]; j1) { feasible=false; break; } } if (!feasible) { delete [] rowActivity; delete [] rowActivity2; modelPtr_->setProblemStatus(1); delete [] whichRow; delete [] whichColumn; delete [] mark; printf("infeasible by inspection (over)\n"); return; } } int nNoGood=0; for (i=0;icount_-memory_&&node_[i]>0); bool any; if (equality) { // See if forced to be zero CoinBigIndex j; any=true; for (j=columnStart[i]; jgetColumnStatus(i)==ClpSimplex::basic) choose=true; if (choose||lower[i]>0.0) { mark[i]=1; whichColumn[nNewCol++]=i; CoinBigIndex j; double value = upper[i]; if (value) { for (j=columnStart[i]; jsetRowStatus(i,ClpSimplex::basic); // make slack basic } if (nOKsetProblemStatus(1); delete [] whichRow; delete [] whichColumn; delete [] mark; printf("infeasible by inspection\n"); return; } bool allIn=false; if (nNewCol+nNoGood+numberRows>numberColumns) { // add in all allIn=true; for (i=0;iaddColumns(build); temp->setLogLevel(1); printf("small has %d rows and %d columns (%d impossible to help) %s\n", nNewRow,nNewCol,nNoGood,allIn ? "all in" : ""); temp->setSpecialOptions(128+512); temp->setDualObjectiveLimit(1.0e50); temp->dual(); assert (!temp->status()); double * solution = modelPtr_->primalColumnSolution(); const double * solution2 = temp->primalColumnSolution(); memset(solution,0,numberColumns*sizeof(double)); for (i=0;isetStatus(iColumn,temp->getStatus(i)); } double * rowSolution = modelPtr_->primalRowSolution(); const double * rowSolution2 = temp->primalRowSolution(); double * dual = modelPtr_->dualRowSolution(); const double * dual2 = temp->dualRowSolution(); memset(dual,0,numberRows*sizeof(double)); for (i=0;isetRowStatus(iRow,temp->getRowStatus(i)); rowSolution[iRow]=rowSolution2[i]; dual[iRow]=dual2[i]; } // See if optimal double * dj = modelPtr_->dualColumnSolution(); // get reduced cost for large problem // this assumes minimization memcpy(dj,modelPtr_->objective(),numberColumns*sizeof(double)); modelPtr_->transposeTimes(-1.0,dual,dj); modelPtr_->setObjectiveValue(temp->objectiveValue()); modelPtr_->setProblemStatus(0); int nBad=0; for (i=0;igetStatus(i)==ClpSimplex::atLowerBound &&upper[i]>lower[i]&&dj[i]<-1.0e-5) nBad++; } //modelPtr_->writeMps("bada.mps"); //temp->writeMps("badb.mps"); delete temp; if (nBad&&!allIn) { assert (algorithm_==2); //printf("%d bad\n",nBad); timesBad_++; // just non mark==2 int nAdded=0; for (i=0;iaddColumns(build); temp->setLogLevel(2); temp->setSpecialOptions(128+512); temp->setDualObjectiveLimit(1.0e50); temp->primal(1); assert (!temp->status()); double * solution = modelPtr_->primalColumnSolution(); const double * solution2 = temp->primalColumnSolution(); memset(solution,0,numberColumns*sizeof(double)); for (i=0;isetStatus(iColumn,temp->getStatus(i)); } double * rowSolution = modelPtr_->primalRowSolution(); const double * rowSolution2 = temp->primalRowSolution(); double * dual = modelPtr_->dualRowSolution(); const double * dual2 = temp->dualRowSolution(); memset(dual,0,numberRows*sizeof(double)); for (i=0;isetRowStatus(iRow,temp->getRowStatus(i)); rowSolution[iRow]=rowSolution2[i]; dual[iRow]=dual2[i]; } modelPtr_->setObjectiveValue(temp->objectiveValue()); modelPtr_->setProblemStatus(0); iterationsBad_ += temp->numberIterations(); printf("clean %d\n",temp->numberIterations()); delete temp; } } delete [] mark; delete [] whichRow; delete [] whichColumn; basis_ = getBasis(modelPtr_); modelPtr_->setSpecialOptions(0); count_++; if ((count_%100)==0&&algorithm_==2) printf("count %d, bad %d - iterations %d\n",count_,timesBad_,iterationsBad_); for (i=0;i1.0e-6||modelPtr_->getStatus(i)==ClpSimplex::basic) { node_[i]=CoinMax(count_,node_[i]); howMany_[i]++; } } if (modelPtr_->objectiveValue()>=modelPtr_->dualObjectiveLimit()) modelPtr_->setProblemStatus(1); } } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CbcSolver2::CbcSolver2 () : OsiClpSolverInterface() { node_=NULL; howMany_=NULL; count_=0; model_ = NULL; memory_=300; algorithm_=0; strategy_=0; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * CbcSolver2::clone(bool CopyData) const { if (CopyData) { return new CbcSolver2(*this); } else { printf("warning CbcSolveUser clone with copyData false\n"); return new CbcSolver2(); } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CbcSolver2::CbcSolver2 ( const CbcSolver2 & rhs) : OsiClpSolverInterface(rhs) { model_ = rhs.model_; int numberColumns = modelPtr_->numberColumns(); node_=CoinCopyOfArray(rhs.node_,numberColumns); howMany_=CoinCopyOfArray(rhs.howMany_,numberColumns); count_=rhs.count_; memory_=rhs.memory_; algorithm_=rhs.algorithm_; strategy_=rhs.strategy_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CbcSolver2::~CbcSolver2 () { delete [] node_; delete [] howMany_; } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcSolver2 & CbcSolver2::operator=(const CbcSolver2& rhs) { if (this != &rhs) { OsiClpSolverInterface::operator=(rhs); delete [] node_; delete [] howMany_; model_ = rhs.model_; int numberColumns = modelPtr_->numberColumns(); node_=CoinCopyOfArray(rhs.node_,numberColumns); howMany_=CoinCopyOfArray(rhs.howMany_,numberColumns); count_=rhs.count_; memory_=rhs.memory_; algorithm_=rhs.algorithm_; strategy_=rhs.strategy_; } return *this; } //------------------------------------------------------------------- // Real initializer //------------------------------------------------------------------- void CbcSolver2::initialize (CbcModel * model, const char * keep) { model_=model; int numberColumns = modelPtr_->numberColumns(); if (numberColumns) { node_ = new int[numberColumns]; howMany_ = new int[numberColumns]; for (int i=0;i #include "CoinPragma.hpp" // For Branch and bound #include "OsiClpSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcCutGenerator.hpp" #include "CoinHelperFunctions.hpp" #include "CbcStrategy.hpp" // Need stored cuts #include "CglStored.hpp" // For saying about solution validity #include "OsiAuxInfo.hpp" // Time #include "CoinTime.hpp" // Class to disallow strong branching solutions #include "CbcFeasibilityBase.hpp" class CbcFeasibilityNoStrong : public CbcFeasibilityBase{ public: // Default Constructor CbcFeasibilityNoStrong () {} virtual ~CbcFeasibilityNoStrong() {} // Copy constructor CbcFeasibilityNoStrong ( const CbcFeasibilityNoStrong &rhs) {} // Assignment operator CbcFeasibilityNoStrong & operator=( const CbcFeasibilityNoStrong& rhs) { return * this;} /// Clone virtual CbcFeasibilityBase * clone() const { return new CbcFeasibilityNoStrong();} /** On input mode: 0 - called after a solve but before any cuts -1 - called after strong branching Returns : 0 - no opinion -1 pretend infeasible 1 pretend integer solution */ virtual int feasible(CbcModel * model, int mode) {return mode;} }; /************************************************************************ This main program solves the following 0-1 problem: min -x0 - 2x1 - 3x2 - 4x3 subject to x0 + x1 + x2 + x3 <= 2 and quadratic constraints with positive random numbers It does it creating extra yij variables and constraints xi + xj -1 <= yij and putting quadratic elements on y The extra constraints are treated as stored cuts. This is to show how to keep branching even if we have a solution ************************************************************************/ int main (int argc, const char *argv[]) { // Define a Solver which inherits from OsiClpsolverInterface -> OsiSolverInterface OsiClpSolverInterface solver1; int nX=4; int nY = (nX * (nX-1)/2); // All columns double * obj = new double [nX+nY]; double * clo = new double[nX+nY]; double * cup = new double[nX+nY]; int i; for (i=0;isetMustCallAgain(true); // Say cuts needed at continuous (b) OsiBabSolver oddCuts; oddCuts.setSolverType(4); model.passInSolverCharacteristics(&oddCuts); // Say no to all solutions by strong branching (c) CbcFeasibilityNoStrong noStrong; model.setProblemFeasibility(noStrong); // Say don't recompute solution d) model.setSpecialOptions(4); double time1 = CoinCpuTime(); // Do complete search model.branchAndBound(); std::cout<getNumCols(); //const double * solution = model.bestSolution(); const double * solution = model.solver()->getColSolution(); int iColumn; for (iColumn=0;iColumn1.0e-7&&model.solver()->isInteger(iColumn)) printf("Column %d has value %g\n",iColumn,value); } } return 0; } CoinMP-1.8.3/Cbc/examples/CbcSolver2.hpp0000644000175000017500000000533711510742723016310 0ustar renerene// $Id: CbcSolver2.hpp 1574 2011-01-05 01:13:55Z lou $ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcSolver2_H #define CbcSolver2_H #include "OsiClpSolverInterface.hpp" class CbcModel; //############################################################################# /** This is to allow the user to replace initialSolve and resolve. This version is to try and speed up long thin problems. This particular version assumes unit elements and rhs Can be E or G rhs */ class CbcSolver2 : public OsiClpSolverInterface { public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); //@} /**@name Constructors and destructors */ //@{ /// Default Constructor CbcSolver2 (); /// Clone virtual OsiSolverInterface * clone(bool CopyData=true) const; /// Copy constructor CbcSolver2 (const CbcSolver2 &); /// Assignment operator CbcSolver2 & operator=(const CbcSolver2& rhs); /// Destructor virtual ~CbcSolver2 (); //@} /**@name Sets and Getss */ //@{ /// Setup arrays - ones in keep will always be in void initialize(CbcModel * model, const char * keep); /// get which ones have been used inline const int * when() const { return node_;} /// Get memory (i.e. how recent use should be) inline int getMemory() const { return memory_;} /// Get current count inline int getCount() const { return count_;} /// Set memory (i.e. how recent use should be) inline void setMemory(int value) { memory_=value;} /// Say whether to just count usage inline void setAlgorithm(int value) { algorithm_=value;} /// Say whether to just count usage inline int getAlgorithm() const { return algorithm_;} /// Strategy inline void setStrategy(int value) { strategy_=value;} /// Strategy inline int getStrategy() const { return strategy_;} //@} //--------------------------------------------------------------------------- private: /**@name Private member data */ //@{ /// Node number when variable last in problem int * node_; /// How many times in problem int * howMany_; /// Pointer back to model CbcModel * model_; /// Counter int count_; /// How recently it must have been used int memory_; /// If 0 nothing, 1 compress and fix, 2 long thin int algorithm_; /// If 0 get rid of rows, 1 keep rows (to stay dual feasible) int strategy_; //@} }; #endif CoinMP-1.8.3/Cbc/examples/CbcCompareUser.cpp0000644000175000017500000001647612131054214017171 0ustar renerene// $Id: CbcCompareUser.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include //#define CBC_DEBUG #include "CoinPragma.hpp" #include "CbcMessage.hpp" #include "CbcModel.hpp" #include "CbcTree.hpp" #include "CbcCompareUser.hpp" #include "CoinError.hpp" #include "CoinHelperFunctions.hpp" /** Default Constructor */ CbcCompareUser::CbcCompareUser () : CbcCompareBase(), weight_(-1.0), saveWeight_(0.0), numberSolutions_(0), count_(0), treeSize_(0) { test_=this; } // Constructor with weight CbcCompareUser::CbcCompareUser (double weight) : CbcCompareBase(), weight_(weight) , saveWeight_(0.0), numberSolutions_(0), count_(0), treeSize_(0) { test_=this; } // Copy constructor CbcCompareUser::CbcCompareUser ( const CbcCompareUser & rhs) :CbcCompareBase(rhs) { weight_=rhs.weight_; saveWeight_ = rhs.saveWeight_; numberSolutions_=rhs.numberSolutions_; count_ = rhs.count_; treeSize_ = rhs.treeSize_; } // Clone CbcCompareBase * CbcCompareUser::clone() const { return new CbcCompareUser(*this); } // Assignment operator CbcCompareUser & CbcCompareUser::operator=( const CbcCompareUser& rhs) { if (this!=&rhs) { CbcCompareBase::operator=(rhs); weight_=rhs.weight_; saveWeight_ = rhs.saveWeight_; numberSolutions_=rhs.numberSolutions_; count_ = rhs.count_; treeSize_ = rhs.treeSize_; } return *this; } // Destructor CbcCompareUser::~CbcCompareUser () { } // For moment go to default #if 0 // Returns true if y better than x bool CbcCompareUser::test (CbcNode * x, CbcNode * y) { if (x) { if (y) { if (weight_==-1.0) { // before solution /* printf("x %d %d %g, y %d %d %g\n", x->numberUnsatisfied(),x->depth(),x->objectiveValue(), y->numberUnsatisfied(),y->depth(),y->objectiveValue()); */ if (x->numberUnsatisfied() > y->numberUnsatisfied()) return true; else if (x->numberUnsatisfied() < y->numberUnsatisfied()) return false; else return x->depth() < y->depth(); } else { // after solution double weight = CoinMax(weight_,0.0); return x->objectiveValue()+ weight*x->numberUnsatisfied() > y->objectiveValue() + weight*y->numberUnsatisfied(); //return x->guessedObjectiveValue()>y->guessedObjectiveValue(); } } else { return false; } } else { return true; } } // This allows method to change behavior as it is called // after each solution void CbcCompareUser::newSolution(CbcModel * model, double objectiveAtContinuous, int numberInfeasibilitiesAtContinuous) { // set to get close to this solution double costPerInteger = (model->getObjValue()-objectiveAtContinuous)/ ((double) numberInfeasibilitiesAtContinuous); weight_ = 0.95*costPerInteger; saveWeight_=weight_; if (model->getSolutionCount()==model->getNumberHeuristicSolutions()) return; // solution was got by rounding numberSolutions_++; if (numberSolutions_>5) weight_ =0.0; // this searches on objective return (true) ; } // This allows method to change behavior bool CbcCompareUser::every1000Nodes(CbcModel * model, int numberNodes) { if (numberNodes>10000) weight_ =0.0; // this searches on objective else if (numberNodes==1000&&weight_==-2.0) weight_=-1.0; // Go to depth first // get size of tree treeSize_ = model->tree()->size(); if (treeSize_>10000) { // set weight to reduce size most of time if (treeSize_>20000) weight_=-1.0; else if ((numberNodes%4000)!=0) weight_=-1.0; else weight_=saveWeight_; } return numberNodes==11000; // resort if first time } // Returns true if wants code to do scan with alternate criterion bool CbcCompareUser::fullScan() const { count_++; if (weight_) return (count_%10)==0; else return false; } // This is alternate test function bool CbcCompareUser::alternateTest (CbcNode * x, CbcNode * y) { if (x) { if (y) { return x->objectiveValue() > y->objectiveValue() ; } else { return false; } } else { return true; } } #else // Returns true if y better than x bool CbcCompareUser::test (CbcNode * x, CbcNode * y) { if (weight_==-1.0&&(y->depth()>7||x->depth()>7)) { // before solution /* printf("x %d %d %g, y %d %d %g\n", x->numberUnsatisfied(),x->depth(),x->objectiveValue(), y->numberUnsatisfied(),y->depth(),y->objectiveValue()); */ if (x->numberUnsatisfied() > y->numberUnsatisfied()) { return true; } else if (x->numberUnsatisfied() < y->numberUnsatisfied()) { return false; } else { int testX = x->depth(); int testY = y->depth(); if (testX!=testY) return testX < testY; else return equalityTest(x,y); // so ties will be broken in consistent manner } } else { // after solution double weight = CoinMax(weight_,0.0); double testX = x->objectiveValue()+ weight*x->numberUnsatisfied(); double testY = y->objectiveValue() + weight*y->numberUnsatisfied(); if (testX!=testY) return testX > testY; else return equalityTest(x,y); // so ties will be broken in consistent manner } } // This allows method to change behavior as it is called // after each solution bool CbcCompareUser::newSolution(CbcModel * model, double objectiveAtContinuous, int numberInfeasibilitiesAtContinuous) { if (model->getSolutionCount()==model->getNumberHeuristicSolutions()&& model->getSolutionCount()<5&&model->getNodeCount()<500) return (false) ; // solution was got by rounding // set to get close to this solution double costPerInteger = (model->getObjValue()-objectiveAtContinuous)/ ((double) numberInfeasibilitiesAtContinuous); weight_ = 0.95*costPerInteger; saveWeight_ = 0.95*weight_; numberSolutions_++; if (numberSolutions_>5) weight_ =0.0; // this searches on objective return (true) ; } // This allows method to change behavior bool CbcCompareUser::every1000Nodes(CbcModel * model, int numberNodes) { double saveWeight=weight_; int numberNodes1000 = numberNodes/1000; if (numberNodes>10000) { weight_ =0.0; // this searches on objective // but try a bit of other stuff if ((numberNodes1000%4)==1) weight_=saveWeight_; } else if (numberNodes==1000&&weight_==-2.0) { weight_=-1.0; // Go to depth first } // get size of tree treeSize_ = model->tree()->size(); if (treeSize_>10000) { int n1 = model->solver()->getNumRows()+model->solver()->getNumCols(); int n2 = model->numberObjects(); double size = n1*0.1 + n2*2.0; // set weight to reduce size most of time if (treeSize_*size>5.0e7) weight_=-1.0; else if ((numberNodes1000%4)==0&&treeSize_*size>1.0e6) weight_=-1.0; else if ((numberNodes1000%4)==1) weight_=0.0; else weight_=saveWeight_; } return (weight_!=saveWeight); } // Returns true if wants code to do scan with alternate criterion bool CbcCompareUser::fullScan() const { return false; } // This is alternate test function bool CbcCompareUser::alternateTest (CbcNode * x, CbcNode * y) { // not used abort(); return false; } #endif CoinMP-1.8.3/Cbc/examples/CbcBranchUser.hpp0000644000175000017500000000624111510742723017003 0ustar renerene// $Id: CbcBranchUser.hpp 1574 2011-01-05 01:13:55Z lou $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcBranchUser_H #define CbcBranchUser_H #include "CbcBranchBase.hpp" #include "CbcBranchActual.hpp" /** Branching decision user class */ class CbcBranchUserDecision : public CbcBranchDecision { public: // Default Constructor CbcBranchUserDecision (); // Copy constructor CbcBranchUserDecision ( const CbcBranchUserDecision &); virtual ~CbcBranchUserDecision(); /// Clone virtual CbcBranchDecision * clone() const; /// Initialize i.e. before start of choosing at a node virtual void initialize(CbcModel * model); /** Returns nonzero if branching on first object is "better" than on second (if second NULL first wins). This is only used after strong branching. The initial selection is done by infeasibility() for each CbcObject return code +1 for up branch preferred, -1 for down */ virtual int betterBranch(CbcBranchingObject * thisOne, CbcBranchingObject * bestSoFar, double changeUp, int numberInfeasibilitiesUp, double changeDown, int numberInfeasibilitiesDown); /** \brief Compare N branching objects. Return index of best and sets way of branching in chosen object. This routine is used only after strong branching. This is reccommended version as it can be more sophisticated */ virtual int bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied, double * changeUp, int * numberInfeasibilitiesUp, double * changeDown, int * numberInfeasibilitiesDown, double objectiveValue) ; private: /// Illegal Assignment operator CbcBranchUserDecision & operator=(const CbcBranchUserDecision& rhs); }; /// Define a single integer class where branching is forced until fixed class CbcSimpleIntegerFixed : public CbcSimpleInteger { public: // Default Constructor CbcSimpleIntegerFixed (); // Useful constructor - passed integer index and model index CbcSimpleIntegerFixed (CbcModel * model, int iColumn, double breakEven=0.5); // Constructor from simple CbcSimpleIntegerFixed (const CbcSimpleInteger & simple); // Copy constructor CbcSimpleIntegerFixed ( const CbcSimpleIntegerFixed &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcSimpleIntegerFixed & operator=( const CbcSimpleIntegerFixed& rhs); // Destructor ~CbcSimpleIntegerFixed (); /// Infeasibility - large is 0.5 virtual double infeasibility(int & preferredWay) const; /** Creates a branching object The preferred direction is set by \p way, -1 for down, +1 for up. */ //virtual CbcBranchingObject * createBranch(int way) ; /** Create a branching object and indicate which way to branch first. The branching object has to know how to create branches (fix variables, etc.) */ virtual CbcBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; protected: /// data }; #endif CoinMP-1.8.3/Cbc/examples/minimum.cpp0000644000175000017500000000266412131054214016001 0ustar renerene// $Id: minimum.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CbcModel.hpp" // Using as solver #include "OsiClpSolverInterface.hpp" int main (int argc, const char *argv[]) { OsiClpSolverInterface solver1; // Read in example model // and assert that it is a clean model #if defined(SAMPLEDIR) int numMpsReadErrors = solver1.readMps(SAMPLEDIR "/p0033.mps",""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif // Pass data and solver to CbcModel CbcModel model(solver1); // uncomment to reduce printout //model.setLogLevel(1); //model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Do complete search model.branchAndBound(); /* Print solution. CbcModel clones solver so we need to get current copy */ int numberColumns = model.solver()->getNumCols(); const double * solution = model.solver()->getColSolution(); for (int iColumn=0;iColumn1.0e-7&&model.solver()->isInteger(iColumn)) printf("%d has value %g\n",iColumn,value); } return 0; } CoinMP-1.8.3/Cbc/examples/ClpQuadInterface.hpp0000644000175000017500000000334111510742723017507 0ustar renerene// $Id: ClpQuadInterface.hpp 1574 2011-01-05 01:13:55Z lou $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpQuadInterface_H #define ClpQuadInterface_H #include "OsiClpSolverInterface.hpp" //############################################################################# /** This is to allow the user to replace initialSolve and resolve */ class ClpQuadInterface : public OsiClpSolverInterface { public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); //@} /**@name Constructors and destructors */ //@{ /// Default Constructor ClpQuadInterface (); /// Clone virtual OsiSolverInterface * clone(bool CopyData=true) const; /// Copy constructor ClpQuadInterface (const ClpQuadInterface &); /// Assignment operator ClpQuadInterface & operator=(const ClpQuadInterface& rhs); /// Destructor virtual ~ClpQuadInterface (); //@} /**@name Sets and Getss */ //@{ /** Setup fake objective. It could also read an ampl .nl file or somehow get nonlinear info */ void initialize(); /// Get objective function value (can't use default) virtual double getObjValue() const; //@} //--------------------------------------------------------------------------- private: /**@name Private member data */ //@{ /// True quadratic objective ClpObjective * quadraticObjective_; //@} }; #endif CoinMP-1.8.3/Cbc/examples/modify.cpp0000644000175000017500000000676312101340057015621 0ustar renerene// $Id: modify.cpp 1854 2013-01-28 00:02:55Z stefan $ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* This example shows the creation of a model from arrays, solution and then changes to objective and adding a row */ #include "CbcModel.hpp" // Using as solver #include "OsiClpSolverInterface.hpp" int main (int argc, const char *argv[]) { // model is as exmip1.mps from Data/samples int numberRows=5; int numberColumns=8; int numberElements=14; // matrix data - column ordered CoinBigIndex start[9]={0,2,4,6,8,10,11,12,14}; int length[8]={2,2,2,2,2,1,1,2}; int rows[14]={0,4,0,1,1,2,0,3,0,4,2,3,0,4}; double elements[14]={3,5.6,1,2,1.1,1,-2,2.8,-1,1,1,-1.2,-1,1.9}; CoinPackedMatrix matrix(true,numberRows,numberColumns,numberElements,elements,rows,start,length); // rim data double objective[8]={1,0,0,0,2,0,0,-1}; double rowLower[5]={2.5,-COIN_DBL_MAX,4,1.8,3}; double rowUpper[5]={COIN_DBL_MAX,2.1,4,5,15}; double colLower[8]={2.5,0,0,0,0.5,0,0,0}; double colUpper[8]={COIN_DBL_MAX,4.1,1,1,4,COIN_DBL_MAX,COIN_DBL_MAX,4.3}; OsiClpSolverInterface solver1; // load problem solver1.loadProblem(matrix,colLower,colUpper,objective, rowLower,rowUpper); // mark integer solver1.setInteger(2); solver1.setInteger(3); // Solve solver1.initialSolve(); // Pass data and solver to CbcModel CbcModel model(solver1); // reduce printout model.setLogLevel(1); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Do complete search model.branchAndBound(); /* Print solution. CbcModel clones solver so we need to get current copy */ const double * solution = model.solver()->getColSolution(); int i; for (i=0;i1.0e-7&&model.solver()->isInteger(i)) printf("i %d has value %g\n",i,value); else if (fabs(value)>1.0e-7) printf("c %d has value %g\n",i,value); } // Change objective solver1.setObjCoeff(0,-100.0); // Now model has too much information e.g. best solution // simplest is to start again // Pass data and solver to CbcModel model = CbcModel(solver1); // reduce printout model.setLogLevel(1); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Do complete search model.branchAndBound(); solution = model.solver()->getColSolution(); for (i=0;i1.0e-7&&model.solver()->isInteger(i)) printf("i %d has value %g\n",i,value); else if (fabs(value)>1.0e-7) printf("c %d has value %g\n",i,value); } // Add constraint int column[8]={0,1,2,3,4,5,6,7}; double element2[8] ={1,1,1,1,1,1,1,1}; solver1.addRow(8,column,element2,7.8,COIN_DBL_MAX); // Now model has too much information e.g. best solution // simplest is to start again // Pass data and solver to CbcModel model = CbcModel(solver1); // reduce printout model.setLogLevel(1); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Do complete search model.branchAndBound(); solution = model.solver()->getColSolution(); for (i=0;i1.0e-7&&model.solver()->isInteger(i)) printf("i %d has value %g\n",i,value); else if (fabs(value)>1.0e-7) printf("c %d has value %g\n",i,value); } return 0; } CoinMP-1.8.3/Cbc/examples/allCuts.cpp0000644000175000017500000004167112131054214015736 0ustar renerene// $Id: allCuts.cpp 1898 2013-04-09 18:06:04Z stefan $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPragma.hpp" // For Branch and bound #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcBranchUser.hpp" #include "CbcCompareUser.hpp" #include "CbcCutGenerator.hpp" #include "CbcStrategy.hpp" #include "CbcHeuristicLocal.hpp" #include "OsiClpSolverInterface.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglRedSplit.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding2.hpp" // Preprocessing #include "CglPreProcess.hpp" // For saying about solution validity #include "OsiAuxInfo.hpp" // Heuristics (But any will have to be special) #include "CbcHeuristic.hpp" #include "CoinTime.hpp" // Need stored cuts #include "CglStored.hpp" /** Stored Cut Generator Class */ class CglStoredUser : public CglStored { public: /**@name Generate Cuts */ //@{ /** Generate Mixed Integer Stored cuts for the model of the solver interface, si. Insert the generated cuts into OsiCut, cs. This generator just looks at previously stored cuts and inserts any that are violated by enough */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()) const; //@} /**@name Cut stuff */ //@{ OsiRowCut * mutableRowCutPointer(int index) { return cuts_.rowCutPtr(index);} //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglStoredUser (); /// Copy constructor CglStoredUser (const CglStoredUser & rhs); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglStoredUser & operator=(const CglStoredUser& rhs); /// Destructor virtual ~CglStoredUser (); //@} protected: // Protected member methods // Protected member data /**@name Protected member data */ //@{ /** Don't add any more cuts after this number passes (per node) unless looks integer feasible */ int numberPasses_; //@} }; //------------------------------------------------------------------- // Generate Stored cuts //------------------------------------------------------------------- void CglStoredUser::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) const { // Get basic problem information const double * solution = si.getColSolution(); if (info.inTree&&info.pass>numberPasses_) { // only continue if integer feasible int numberColumns=si.getNumCols(); int i; const double * colUpper = si.getColUpper(); const double * colLower = si.getColLower(); int numberAway=0; for (i=0;i1.0e-5) numberAway++; } if (numberAway) return; // let code branch } int numberRowCuts = cuts_.sizeRowCuts(); for (int i=0;iviolated(solution); if (violation>=requiredViolation_) cs.insert(*rowCutPointer); } } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglStoredUser::CglStoredUser () : CglStored(), numberPasses_(5) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglStoredUser::CglStoredUser (const CglStoredUser & source) : CglStored(source), numberPasses_(source.numberPasses_) { } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglStoredUser::clone() const { return new CglStoredUser(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglStoredUser::~CglStoredUser () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglStoredUser & CglStoredUser::operator=(const CglStoredUser& rhs) { if (this != &rhs) { CglStored::operator=(rhs); numberPasses_=rhs.numberPasses_; } return *this; } // Class to disallow strong branching solutions #include "CbcFeasibilityBase.hpp" class CbcFeasibilityNoStrong : public CbcFeasibilityBase{ public: // Default Constructor CbcFeasibilityNoStrong () {}; virtual ~CbcFeasibilityNoStrong() {}; // Copy constructor CbcFeasibilityNoStrong ( const CbcFeasibilityNoStrong &rhs) {}; // Assignment operator CbcFeasibilityNoStrong & operator=( const CbcFeasibilityNoStrong& rhs) { return * this;}; /// Clone virtual CbcFeasibilityBase * clone() const { return new CbcFeasibilityNoStrong();}; /** On input mode: 0 - called after a solve but before any cuts -1 - called after strong branching Returns : 0 - no opinion -1 pretend infeasible 1 pretend integer solution */ virtual int feasible(CbcModel * model, int mode) {return mode;}; }; //############################################################################# /************************************************************************ This main program reads in an integer model from an mps file. It makes L or G rows into cuts ************************************************************************/ int main (int argc, const char *argv[]) { // Define your favorite OsiSolver OsiClpSolverInterface solver1; // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } double time1 = CoinCpuTime(); OsiClpSolverInterface solverSave = solver1; /* Options are: preprocess to do preprocessing time in minutes if 2 parameters and numeric taken as time */ bool preProcess=false; double minutes=-1.0; int nGoodParam=0; for (int iParam=2; iParam=0.0) { nGoodParam+=2; iParam++; // skip time } } } } if (nGoodParam==0&&argc==3&&isdigit(argv[2][0])) { // If time is given then stop after that number of minutes minutes = atof(argv[2]); if (minutes>=0.0) nGoodParam=1; } if (nGoodParam!=argc-2&&argc>=2) { printf("Usage [preprocess] [time ] or \n"); exit(1); } // Reduce printout solver1.setHintParam(OsiDoReducePrint,true,OsiHintTry); // See if we want preprocessing OsiSolverInterface * solver2=&solver1; CglPreProcess process; // Never do preprocessing until dual tests out as can fix incorrectly preProcess=false; if (preProcess) { /* Do not try and produce equality cliques and do up to 5 passes */ solver2 = process.preProcess(solver1,false,5); if (!solver2) { printf("Pre-processing says infeasible\n"); exit(2); } solver2->resolve(); } // Turn L rows into cuts CglStoredUser stored; { int numberRows = solver2->getNumRows(); int * whichRow = new int[numberRows]; // get row copy const CoinPackedMatrix * rowCopy = solver2->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowLower = solver2->getRowLower(); const double * rowUpper = solver2->getRowUpper(); const double * element = rowCopy->getElements(); int iRow,nDelete=0; for (iRow=0;iRow1.0e20) { // take out whichRow[nDelete++]=iRow; } } // leave some rows to avoid empty problem (Gomory does not like) nDelete = CoinMax(CoinMin(nDelete,numberRows-5),0); for (int jRow=0;jRowsetEffectiveness(1.0e50); } solver2->deleteRows(nDelete,whichRow); delete [] whichRow; } CbcModel model(*solver2); model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); // Set up some cut generators and defaults // Probing first as gets tight bounds on continuous CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(1); generator1.setMaxPassRoot(5); // Number of unsatisfied variables to look at generator1.setMaxProbe(10); generator1.setMaxProbeRoot(1000); // How far to follow the consequences generator1.setMaxLook(50); generator1.setMaxLookRoot(500); // Only look at rows with fewer than this number of elements generator1.setMaxElements(200); generator1.setRowCuts(3); CglGomory generator2; // try larger limit generator2.setLimit(300); CglKnapsackCover generator3; CglRedSplit generator4; // try larger limit generator4.setLimit(200); CglClique generator5; generator5.setStarCliqueReport(false); generator5.setRowCliqueReport(false); CglMixedIntegerRounding2 mixedGen; CglFlowCover flowGen; // Add in generators // Experiment with -1 and -99 etc // This is just for one particular model model.addCutGenerator(&generator1,-1,"Probing"); //model.addCutGenerator(&generator2,-1,"Gomory"); model.addCutGenerator(&generator2,1,"Gomory"); model.addCutGenerator(&generator3,-1,"Knapsack"); // model.addCutGenerator(&generator4,-1,"RedSplit"); //model.addCutGenerator(&generator5,-1,"Clique"); model.addCutGenerator(&generator5,1,"Clique"); model.addCutGenerator(&flowGen,-1,"FlowCover"); model.addCutGenerator(&mixedGen,-1,"MixedIntegerRounding"); // Add stored cuts (making sure at all depths) model.addCutGenerator(&stored,1,"Stored",true,false,false,-100,1,-1); int numberGenerators = model.numberCutGenerators(); int iGenerator; // Say we want timings for (iGenerator=0;iGeneratorsetTiming(true); } OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (model.solver()); // go faster stripes if (osiclp) { if(osiclp->getNumRows()<300&&osiclp->getNumCols()<500) { //osiclp->setupForRepeatedUse(2,0); osiclp->setupForRepeatedUse(0,0); } // Don't allow dual stuff osiclp->setSpecialOptions(osiclp->specialOptions()|262144); } // Uncommenting this should switch off all CBC messages // model.messagesPointer()->setDetailMessages(10,10000,NULL); // No heuristics // Do initial solve to continuous model.initialSolve(); /* You need the next few lines - a) so that cut generator will always be called again if it generated cuts b) it is known that matrix is not enough to define problem so do cuts even if it looks integer feasible at continuous optimum. c) a solution found by strong branching will be ignored. d) don't recompute a solution once found */ // Make sure cut generator called correctly (a) iGenerator=numberGenerators-1; model.cutGenerator(iGenerator)->setMustCallAgain(true); // Say cuts needed at continuous (b) OsiBabSolver oddCuts; oddCuts.setSolverType(4); // owing to bug must set after initialSolve model.passInSolverCharacteristics(&oddCuts); // Say no to all solutions by strong branching (c) CbcFeasibilityNoStrong noStrong; model.setProblemFeasibility(noStrong); // Say don't recompute solution d) model.setSpecialOptions(4); // Could tune more double objValue = model.solver()->getObjSense()*model.solver()->getObjValue(); double minimumDropA=CoinMin(1.0,fabs(objValue)*1.0e-3+1.0e-4); double minimumDrop= fabs(objValue)*1.0e-4+1.0e-4; printf("min drop %g (A %g)\n",minimumDrop,minimumDropA); model.setMinimumDrop(minimumDrop); if (model.getNumCols()<500) model.setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (model.getNumCols()<5000) model.setMaximumCutPassesAtRoot(100); // use minimum drop else model.setMaximumCutPassesAtRoot(20); model.setMaximumCutPasses(10); //model.setMaximumCutPasses(2); // Switch off strong branching if wanted // model.setNumberStrong(0); // Do more strong branching if small if (model.getNumCols()<5000) model.setNumberStrong(10); model.setNumberStrong(20); //model.setNumberStrong(5); model.setNumberBeforeTrust(5); model.solver()->setIntParam(OsiMaxNumIterationHotStart,100); // If time is given then stop after that number of minutes if (minutes>=0.0) { std::cout<<"Stopping after "<setLogLevel(1); //model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); } //model.messageHandler()->setLogLevel(2); //model.solver()->messageHandler()->setLogLevel(2); //model.setPrintFrequency(50); //#define DEBUG_CUTS #ifdef DEBUG_CUTS // Set up debugger by name (only if no preprocesing) if (!preProcess) { std::string problemName ; model.solver()->getStrParam(OsiProbName,problemName) ; model.solver()->activateRowCutDebugger(problemName.c_str()) ; } #endif // Do complete search model.branchAndBound(); std::cout<cutGeneratorName()<<" was tried " <numberTimesEntered()<<" times and created " <numberCutsInTotal()<<" cuts of which " <numberCutsActive()<<" were active after adding rounds of cuts"; if (generator->timing()) std::cout<<" ( "<timeInCutGenerator()<<" seconds)"<getNumCols(); const double * solution = solver->getColSolution(); // Get names from solver1 (as OsiSolverInterface may lose) std::vector columnNames = *solver1.getModelPtr()->columnNames(); int iColumn; std::cout<1.0e-7&&solver->isInteger(iColumn)) { std::cout< CoinMP-1.8.3/Cbc/MSVisualStudio/v9/cbc/0000755000175000017500000000000012600453457015771 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v9/cbc/cbc.vcproj0000644000175000017500000002475212131026530017742 0ustar renerene CoinMP-1.8.3/Cbc/MSVisualStudio/v9/OsiCbcUnitTest/0000755000175000017500000000000012600453457020104 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v9/OsiCbcUnitTest/OsiCbcUnitTest.vcproj0000644000175000017500000002234511512601133024164 0ustar renerene CoinMP-1.8.3/Cbc/MSVisualStudio/v9/libOsiCbc/0000755000175000017500000000000012600453457017073 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v9/libOsiCbc/libOsiCbc.vcproj0000644000175000017500000001631411577425227022164 0ustar renerene CoinMP-1.8.3/Cbc/MSVisualStudio/v9/cbcExamplesSample2/0000755000175000017500000000000012600453457020714 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v9/cbcExamplesSample2/cbcExamplesSample2.vcproj0000644000175000017500000005444712131026530025614 0ustar renerene CoinMP-1.8.3/Cbc/MSVisualStudio/v9/Cbc.sln0000644000175000017500000003201412131026530016432 0ustar renereneMicrosoft Visual Studio Solution File, Format Version 10.00 # Visual C++ Express 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbcExamplesSample2", "cbcExamplesSample2\cbcExamplesSample2.vcproj", "{4C0B8243-2876-4C92-B6CB-2472B0571CC3}" ProjectSection(ProjectDependencies) = postProject {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} = {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} {363BA154-FEC9-4E1E-BC23-93CEC58AB785} = {363BA154-FEC9-4E1E-BC23-93CEC58AB785} {02D45875-A8CF-41B9-990B-3699C0ECFE10} = {02D45875-A8CF-41B9-990B-3699C0ECFE10} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbc", "cbc\cbc.vcproj", "{E2294708-C5BA-460A-B0A7-060A4023684A}" ProjectSection(ProjectDependencies) = postProject {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} = {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} {363BA154-FEC9-4E1E-BC23-93CEC58AB785} = {363BA154-FEC9-4E1E-BC23-93CEC58AB785} {02D45875-A8CF-41B9-990B-3699C0ECFE10} = {02D45875-A8CF-41B9-990B-3699C0ECFE10} {71DA4595-E8A7-4B21-A00A-D96D29D11E3E} = {71DA4595-E8A7-4B21-A00A-D96D29D11E3E} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCbc", "libCbc\libCbc.vcproj", "{363BA154-FEC9-4E1E-BC23-93CEC58AB785}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCgl", "..\..\..\Cgl\MSVisualStudio\v9\libCgl\libCgl.vcproj", "{DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libClp", "..\..\..\Clp\MSVisualStudio\v9\libClp\libClp.vcproj", "{4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v9\libCoinUtils\libCoinUtils.vcproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "..\..\..\Osi\MSVisualStudio\v9\libOsi\libOsi.vcproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbcCInterfaceDll", "cbcCInterfaceDll\cbcCInterfaceDll.vcproj", "{F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}" ProjectSection(ProjectDependencies) = postProject {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} = {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} {363BA154-FEC9-4E1E-BC23-93CEC58AB785} = {363BA154-FEC9-4E1E-BC23-93CEC58AB785} {02D45875-A8CF-41B9-990B-3699C0ECFE10} = {02D45875-A8CF-41B9-990B-3699C0ECFE10} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbcCSosDllSample", "cbcCSosDllSample\cbcCSosDllSample.vcproj", "{8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}" ProjectSection(ProjectDependencies) = postProject {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB} = {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCbcSolver", "libCbcSolver\libCbcSolver.vcproj", "{71DA4595-E8A7-4B21-A00A-D96D29D11E3E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiClp", "..\..\..\Clp\MSVisualStudio\v9\libOsiClp\libOsiClp.vcproj", "{02D45875-A8CF-41B9-990B-3699C0ECFE10}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCbc", "libOsiCbc\libOsiCbc.vcproj", "{431ED9C6-FDF6-4836-8B33-BE4EC5378640}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiCbcUnitTest", "OsiCbcUnitTest\OsiCbcUnitTest.vcproj", "{BB058D80-D376-4F0F-87F7-E4760BC2C84D}" ProjectSection(ProjectDependencies) = postProject {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} = {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} {E2294708-C5BA-460A-B0A7-060A4023684A} = {E2294708-C5BA-460A-B0A7-060A4023684A} {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} {363BA154-FEC9-4E1E-BC23-93CEC58AB785} = {363BA154-FEC9-4E1E-BC23-93CEC58AB785} {109D6E6F-6D91-460F-86AE-DF27400E09A9} = {109D6E6F-6D91-460F-86AE-DF27400E09A9} {02D45875-A8CF-41B9-990B-3699C0ECFE10} = {02D45875-A8CF-41B9-990B-3699C0ECFE10} {431ED9C6-FDF6-4836-8B33-BE4EC5378640} = {431ED9C6-FDF6-4836-8B33-BE4EC5378640} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "..\..\..\Osi\MSVisualStudio\v9\libOsiCommonTest\libOsiCommonTest.vcproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Debug|Win32.ActiveCfg = Debug|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Debug|Win32.Build.0 = Debug|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Debug|x64.ActiveCfg = Debug|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Release|Win32.ActiveCfg = Release|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Release|Win32.Build.0 = Release|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Release|x64.ActiveCfg = Release|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Debug|Win32.ActiveCfg = Debug|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Debug|Win32.Build.0 = Debug|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Debug|x64.ActiveCfg = Debug|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Release|Win32.ActiveCfg = Release|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Release|Win32.Build.0 = Release|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Release|x64.ActiveCfg = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Win32.ActiveCfg = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Win32.Build.0 = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|x64.ActiveCfg = Debug|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|x64.Build.0 = Debug|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Win32.ActiveCfg = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Win32.Build.0 = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|x64.ActiveCfg = Release|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|x64.Build.0 = Release|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.ActiveCfg = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.Build.0 = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.ActiveCfg = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.Build.0 = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.ActiveCfg = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.Build.0 = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.ActiveCfg = Release|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.Build.0 = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.Build.0 = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.ActiveCfg = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.Build.0 = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.Build.0 = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.ActiveCfg = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Debug|Win32.ActiveCfg = Debug|Win32 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Debug|x64.ActiveCfg = Debug|x64 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Debug|x64.Build.0 = Debug|x64 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Release|Win32.ActiveCfg = Release|Win32 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Release|x64.ActiveCfg = Release|x64 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Debug|Win32.ActiveCfg = Debug|Win32 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Debug|x64.ActiveCfg = Debug|x64 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Debug|x64.Build.0 = Debug|x64 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Release|Win32.ActiveCfg = Release|Win32 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Release|x64.ActiveCfg = Release|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Win32.ActiveCfg = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Win32.Build.0 = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|x64.ActiveCfg = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Win32.ActiveCfg = Release|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Win32.Build.0 = Release|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|x64.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.Build.0 = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.ActiveCfg = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.Build.0 = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.Build.0 = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.ActiveCfg = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.Build.0 = Release|x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Debug|Win32.ActiveCfg = Debug|Win32 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Debug|Win32.Build.0 = Debug|Win32 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Debug|x64.ActiveCfg = Debug|x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Debug|x64.Build.0 = Debug|x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Release|Win32.ActiveCfg = Release|Win32 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Release|Win32.Build.0 = Release|Win32 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Release|x64.ActiveCfg = Release|x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Release|x64.Build.0 = Release|x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Debug|Win32.ActiveCfg = Debug|Win32 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Debug|Win32.Build.0 = Debug|Win32 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Debug|x64.ActiveCfg = Debug|x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Debug|x64.Build.0 = Debug|x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Release|Win32.ActiveCfg = Release|Win32 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Release|Win32.Build.0 = Release|Win32 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Release|x64.ActiveCfg = Release|x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Release|x64.Build.0 = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Cbc/MSVisualStudio/v9/libCbcSolver/0000755000175000017500000000000012600453457017613 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v9/libCbcSolver/libCbcSolver.vcproj0000644000175000017500000002514112131026530023377 0ustar renerene CoinMP-1.8.3/Cbc/MSVisualStudio/v9/cbcCSosDllSample/0000755000175000017500000000000012600453457020357 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v9/cbcCSosDllSample/cbcCSosDllSample.vcproj0000644000175000017500000002573611512601133024721 0ustar renerene CoinMP-1.8.3/Cbc/MSVisualStudio/v9/cbcCInterfaceDll/0000755000175000017500000000000012600453457020351 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v9/cbcCInterfaceDll/cbcCInterfaceDll.vcproj0000644000175000017500000002233711512601133024677 0ustar renerene CoinMP-1.8.3/Cbc/MSVisualStudio/v10/0000755000175000017500000000000012600453457015312 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/CbcWithInstalledLibraries/0000755000175000017500000000000012600453457022332 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/CbcWithInstalledLibraries/README.txt0000644000175000017500000000057112252737704024036 0ustar renereneBaseCBCProject Originated by Iain Dunning: http://www.iaindunning.com Shamelessly modified by Ted Ralphs from original versions on https://github.com/IainNZ/BaseCBCProject This is a nearly-empty Visual C++ 2010 project with settings ready for use with the Cbc libraries that come bundled with the COIN-OR installer. See more: https://projects.coin-or.org/Cbc/wiki/VSSetup CoinMP-1.8.3/Cbc/MSVisualStudio/v10/CbcWithInstalledLibraries/BaseCBCProject.vcxproj0000644000175000017500000001170612252737704026470 0ustar renerene Debug Win32 Release Win32 {58EC5CA5-F696-4DC1-8E73-722E90FCFBCA} Win32Proj BaseCBCProject Application true Unicode Application false true Unicode true false Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) C:\Program Files (x86)\COIN-OR\1.7.3\win32-msvc10\include\coin Console true libcoinmetis.lib;libcoinmumps.lib;libcoinglpk.lib;libcoinasl.lib;libcoinlapack.lib;libcoinblas.lib;libCbc.lib;libCgl.lib;libClp.lib;libCoinUtils.lib;libOsi.lib;libOsiClp.lib;%(AdditionalDependencies) C:\Program Files (x86)\COIN-OR\1.7.3\win32-msvc10\lib;C:\Program Files (x86)\COIN-OR\1.7.3\win32-msvc10\lib\intel Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) C:\Program Files (x86)\COIN-OR\1.7.3\win32-msvc10\include\coin Console true true true libcoinmetis.lib;libcoinmumps.lib;libcoinglpk.lib;libcoinasl.lib;libcoinlapack.lib;libcoinblas.lib;libCbc.lib;libCgl.lib;libClp.lib;libCoinUtils.lib;libOsi.lib;libOsiClp.lib;%(AdditionalDependencies) C:\Program Files (x86)\COIN-OR\1.7.3\win32-msvc10\lib;C:\Program Files (x86)\COIN-OR\1.7.3\win32-msvc10\lib\intel CoinMP-1.8.3/Cbc/MSVisualStudio/v10/CbcWithInstalledLibraries/main.cpp0000644000175000017500000000211012252737704023757 0ustar renerene#include "OsiClpSolverInterface.hpp" #include "CbcModel.hpp" #include "CoinModel.hpp" #include int main() { const int numcols = 2; const int numrows = 1; double obj[] = { 1.0, 1.0}; // obj: Max x0 + x1 // Column-major sparse "A" matrix: x0 + 2 x1 <= 3.9 int start[] = {0, 1, 2}; // where in index columns start (?) int index[] = {0, 0}; // row indexs for the columns double values[] = {1.0, 2.0}; // the values in the sparse matrix double rowlb[] = {0.0}; double rowub[] = {3.9}; // 0 <= x0 <= 10 and integer // 0 <= x1 <= 10 double collb[] = {0.0, 0.0}; double colub[] = {10.0, 10.0}; OsiClpSolverInterface model; model.loadProblem(numcols, numrows, start, index, values, collb, colub, obj, rowlb, rowub); model.setInteger(0); // Sets x0 to integer model.setObjSense(-1.0); // Maximise CbcModel solver(model); solver.branchAndBound(); bool optimal = solver.isProvenOptimal(); const double *val = solver.getColSolution(); printf("Solution %g %g\n", val[0], val[1]); return 0; }CoinMP-1.8.3/Cbc/MSVisualStudio/v10/CbcWithInstalledLibraries/BaseCBCProject.sln0000644000175000017500000000155712252737704025574 0ustar renerene Microsoft Visual Studio Solution File, Format Version 11.00 # Visual C++ Express 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseCBCProject", "BaseCBCProject.vcxproj", "{58EC5CA5-F696-4DC1-8E73-722E90FCFBCA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {58EC5CA5-F696-4DC1-8E73-722E90FCFBCA}.Debug|Win32.ActiveCfg = Debug|Win32 {58EC5CA5-F696-4DC1-8E73-722E90FCFBCA}.Debug|Win32.Build.0 = Debug|Win32 {58EC5CA5-F696-4DC1-8E73-722E90FCFBCA}.Release|Win32.ActiveCfg = Release|Win32 {58EC5CA5-F696-4DC1-8E73-722E90FCFBCA}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Cbc/MSVisualStudio/v10/libCbc/0000755000175000017500000000000012600453457016470 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/libCbc/libCbc.vcxproj0000644000175000017500000021363012176740617021275 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785} libCbc StaticLibrary StaticLibrary StaticLibrary StaticLibrary <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglGMI;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;..\..\..\..\Cgl\src\CglRedSplit2;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_LIB;USE_CBCCONFIG;COIN_NO_CLP_MESSAGE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) _DEBUG;%(PreprocessorDefinitions) 0x0409 true ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglGMI;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;..\..\..\..\Cgl\src\CglRedSplit2;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;WIN32;_LIB;USE_CBCCONFIG;COIN_NO_CLP_MESSAGE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true true NDEBUG;_NDEBUG;%(PreprocessorDefinitions) 0x0409 true X64 ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglGMI;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;..\..\..\..\Cgl\src\CglRedSplit2;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_LIB;USE_CBCCONFIG;COIN_NO_CLP_MESSAGE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks ProgramDatabase false _DEBUG;%(PreprocessorDefinitions) 0x0409 true X64 Default ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglGMI;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;..\..\..\..\Cgl\src\CglRedSplit2;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;WIN32;_LIB;USE_CBCCONFIG;COIN_NO_CLP_MESSAGE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) NDEBUG;_NDEBUG;%(PreprocessorDefinitions) 0x0409 true Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) CoinMP-1.8.3/Cbc/MSVisualStudio/v10/cbc/0000755000175000017500000000000012600453457016041 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/cbc/cbc.vcxproj0000644000175000017500000004033512130311737020202 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {E2294708-C5BA-460A-B0A7-060A4023684A} cbc Application Application Application Application <_ProjectFileVersion>10.0.30319.1 false false false false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset .\Debug/cbcSolve.tlb ..\..\..\src;..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) _DEBUG;%(PreprocessorDefinitions) 0x0409 libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies) true $(OutDir);%(AdditionalLibraryDirectories) true Console false MachineX86 false .\Release/cbcSolve.tlb ..\..\..\src;..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true Default NDEBUG;_NDEBUG;%(PreprocessorDefinitions) 0x0409 libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies) true $(OutDir);%(AdditionalLibraryDirectories) Console false MachineX86 false X64 .\Debug/cbcSolve.tlb ..\..\..\src;..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) ProgramDatabase _DEBUG;%(PreprocessorDefinitions) 0x0409 libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies) true $(OutDir);%(AdditionalLibraryDirectories) true Console false MachineX64 false X64 .\Release/cbcSolve.tlb ..\..\..\src;..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) NDEBUG;_NDEBUG;%(PreprocessorDefinitions) 0x0409 libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies) true $(OutDir);%(AdditionalLibraryDirectories) Console false MachineX64 false Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) {dbea3904-f0b8-408a-9e1a-6497febe8c42} false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false {02d45875-a8cf-41b9-990b-3699c0ecfe10} false {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false {71da4595-e8a7-4b21-a00a-d96d29d11e3e} false {363ba154-fec9-4e1e-bc23-93cec58ab785} false CoinMP-1.8.3/Cbc/MSVisualStudio/v10/OsiCbcUnitTest/0000755000175000017500000000000012600453457020154 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/OsiCbcUnitTest/OsiCbcUnitTest.vcxproj0000644000175000017500000003347112130311737024433 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D} OsiCbcUnitTest Win32Proj Application Application Application Application <_ProjectFileVersion>10.0.30319.1 true false true false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Osi\src\Osi;..\..\..\src\OsiCbc;..\..\..\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_CONSOLE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";NETLIBDIR="..\\..\\..\\..\\Data\\Netlib";MIPLIBDIR="..\\..\\..\\..\\Data\\miplib3";%(PreprocessorDefinitions) libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;libClp.lib;libOsiClp.lib;libCgl.lib;libCbc.lib;libOsiCbc.lib;libOsiClp.lib;libClp.lib;libOsi.lib;libOsiCommonTest.lib;libCoinUtils.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Console MachineX86 false ..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Osi\src\Osi;..\..\..\src\OsiCbc;..\..\..\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";NETLIBDIR="..\\..\\..\\..\\Data\\Netlib";MIPLIBDIR="..\\..\\..\\..\\Data\\miplib3";%(PreprocessorDefinitions) libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;libClp.lib;libOsiClp.lib;libCgl.lib;libCbc.lib;libOsiCbc.lib;libOsiClp.lib;libClp.lib;libOsi.lib;libOsiCommonTest.lib;libCoinUtils.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Console true true MachineX86 false X64 ..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Osi\src\Osi;..\..\..\src\OsiCbc;..\..\..\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_CONSOLE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";NETLIBDIR="..\\..\\..\\..\\Data\\Netlib";MIPLIBDIR="..\\..\\..\\..\\Data\\miplib3";%(PreprocessorDefinitions) libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;libClp.lib;libOsiClp.lib;libCgl.lib;libCbc.lib;libOsiCbc.lib;libCgl.lib;libOsiClp.lib;libClp.lib;libOsi.lib;libOsiCommonTest.lib;libCoinUtils.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Console MachineX64 false X64 ..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Osi\src\Osi;..\..\..\src\OsiCbc;..\..\..\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\OsiCommonTest;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";NETLIBDIR="..\\..\\..\\..\\Data\\Netlib";MIPLIBDIR="..\\..\\..\\..\\Data\\miplib3";%(PreprocessorDefinitions) libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;libClp.lib;libOsiClp.lib;libCgl.lib;libCbc.lib;libOsiCbc.lib;libCgl.lib;libOsiClp.lib;libClp.lib;libOsi.lib;libOsiCommonTest.lib;libCoinUtils.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Console true true MachineX64 false {dbea3904-f0b8-408a-9e1a-6497febe8c42} false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false {02d45875-a8cf-41b9-990b-3699c0ecfe10} false {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {109d6e6f-6d91-460f-86ae-df27400e09a9} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false {e2294708-c5ba-460a-b0a7-060a4023684a} false {363ba154-fec9-4e1e-bc23-93cec58ab785} false {431ed9c6-fdf6-4836-8b33-be4ec5378640} false CoinMP-1.8.3/Cbc/MSVisualStudio/v10/libOsiCbc/0000755000175000017500000000000012600453457017143 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/libOsiCbc/libOsiCbc.vcxproj0000644000175000017500000002132712130311737022406 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640} libOsiCbc ManagedCProj StaticLibrary StaticLibrary StaticLibrary StaticLibrary <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\..\Osi\src\Osi;..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\src;%(AdditionalIncludeDirectories) WIN32;_DEBUG;%(PreprocessorDefinitions) ..\..\..\..\Osi\src\Osi;..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\src;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;%(PreprocessorDefinitions) Level3 ProgramDatabase X64 ..\..\..\..\Osi\src\Osi;..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\src;%(AdditionalIncludeDirectories) WIN32;_DEBUG;%(PreprocessorDefinitions) Level3 ProgramDatabase X64 ..\..\..\..\Osi\src\Osi;..\..\..\..\BuildTools\headers;..\..\..\..\CoinUtils\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\src;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;%(PreprocessorDefinitions) Level3 ProgramDatabase Default true true true true true true CoinMP-1.8.3/Cbc/MSVisualStudio/v10/cbcExamplesSample2/0000755000175000017500000000000012600453457020764 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/cbcExamplesSample2/cbcExamplesSample2.vcxproj0000644000175000017500000006321612130551432026051 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {4C0B8243-2876-4C92-B6CB-2472B0571CC3} cbcExamplesSample2 Application Application Application Application <_ProjectFileVersion>10.0.30319.1 false false false false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset .\Debug/cbcExamplesSample2.tlb ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";%(PreprocessorDefinitions) _DEBUG;%(PreprocessorDefinitions) 0x0409 libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName).exe true $(OutDir);%(AdditionalLibraryDirectories) true .\Debug/cbcExamplesSample2.pdb Console false MachineX86 false X64 .\Debug/cbcExamplesSample2.tlb ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";%(PreprocessorDefinitions) _DEBUG;%(PreprocessorDefinitions) 0x0409 libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName).exe true $(OutDir);%(AdditionalLibraryDirectories) true .\Debug/cbcExamplesSample2.pdb Console false MachineX64 false .\Release/cbcExamplesSample2.tlb ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";%(PreprocessorDefinitions) NDEBUG;_NDEBUG;%(PreprocessorDefinitions) 0x0409 libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName).exe true $(OutDir);%(AdditionalLibraryDirectories) .\Release/cbcExamplesSample2.pdb Console false MachineX86 false X64 .\Release/cbcExamplesSample2.tlb ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample";%(PreprocessorDefinitions) NDEBUG;_NDEBUG;%(PreprocessorDefinitions) 0x0409 libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName).exe true $(OutDir);%(AdditionalLibraryDirectories) .\Release/cbcExamplesSample2.pdb Console false MachineX64 false Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks $(IntDir) $(IntDir)vc90.pdb Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks $(IntDir) $(IntDir)vc90.pdb MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) $(IntDir) $(IntDir)vc90.pdb MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) $(IntDir) $(IntDir)vc90.pdb Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks $(IntDir) $(IntDir)vc90.pdb Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks $(IntDir) $(IntDir)vc90.pdb MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) $(IntDir) $(IntDir)vc90.pdb MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) $(IntDir) $(IntDir)vc90.pdb Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks $(IntDir) $(IntDir)vc90.pdb Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks $(IntDir) $(IntDir)vc90.pdb MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) $(IntDir) $(IntDir)vc90.pdb MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) $(IntDir) $(IntDir)vc90.pdb {dbea3904-f0b8-408a-9e1a-6497febe8c42} false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false {02d45875-a8cf-41b9-990b-3699c0ecfe10} false {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false {363ba154-fec9-4e1e-bc23-93cec58ab785} false CoinMP-1.8.3/Cbc/MSVisualStudio/v10/Cbc.sln0000644000175000017500000002515411645033041016515 0ustar renereneMicrosoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbcExamplesSample2", "cbcExamplesSample2\cbcExamplesSample2.vcxproj", "{4C0B8243-2876-4C92-B6CB-2472B0571CC3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbc", "cbc\cbc.vcxproj", "{E2294708-C5BA-460A-B0A7-060A4023684A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCbc", "libCbc\libCbc.vcxproj", "{363BA154-FEC9-4E1E-BC23-93CEC58AB785}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCgl", "..\..\..\Cgl\MSVisualStudio\v10\libCgl\libCgl.vcxproj", "{DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libClp", "..\..\..\Clp\MSVisualStudio\v10\libClp\libClp.vcxproj", "{4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v10\libCoinUtils\libCoinUtils.vcxproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "..\..\..\Osi\MSVisualStudio\v10\libOsi\libOsi.vcxproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbcCInterfaceDll", "cbcCInterfaceDll\cbcCInterfaceDll.vcxproj", "{F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cbcCSosDllSample", "cbcCSosDllSample\cbcCSosDllSample.vcxproj", "{8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCbcSolver", "libCbcSolver\libCbcSolver.vcxproj", "{71DA4595-E8A7-4B21-A00A-D96D29D11E3E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiClp", "..\..\..\Clp\MSVisualStudio\v10\libOsiClp\libOsiClp.vcxproj", "{02D45875-A8CF-41B9-990B-3699C0ECFE10}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCbc", "libOsiCbc\libOsiCbc.vcxproj", "{431ED9C6-FDF6-4836-8B33-BE4EC5378640}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiCbcUnitTest", "OsiCbcUnitTest\OsiCbcUnitTest.vcxproj", "{BB058D80-D376-4F0F-87F7-E4760BC2C84D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "..\..\..\Osi\MSVisualStudio\v10\libOsiCommonTest\libOsiCommonTest.vcxproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Debug|Win32.ActiveCfg = Debug|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Debug|Win32.Build.0 = Debug|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Debug|x64.ActiveCfg = Debug|x64 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Debug|x64.Build.0 = Debug|x64 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Release|Win32.ActiveCfg = Release|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Release|Win32.Build.0 = Release|Win32 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Release|x64.ActiveCfg = Release|x64 {4C0B8243-2876-4C92-B6CB-2472B0571CC3}.Release|x64.Build.0 = Release|x64 {E2294708-C5BA-460A-B0A7-060A4023684A}.Debug|Win32.ActiveCfg = Debug|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Debug|Win32.Build.0 = Debug|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Debug|x64.ActiveCfg = Debug|x64 {E2294708-C5BA-460A-B0A7-060A4023684A}.Debug|x64.Build.0 = Debug|x64 {E2294708-C5BA-460A-B0A7-060A4023684A}.Release|Win32.ActiveCfg = Release|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Release|Win32.Build.0 = Release|Win32 {E2294708-C5BA-460A-B0A7-060A4023684A}.Release|x64.ActiveCfg = Release|x64 {E2294708-C5BA-460A-B0A7-060A4023684A}.Release|x64.Build.0 = Release|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Win32.ActiveCfg = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Win32.Build.0 = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|x64.ActiveCfg = Debug|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|x64.Build.0 = Debug|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Win32.ActiveCfg = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Win32.Build.0 = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|x64.ActiveCfg = Release|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|x64.Build.0 = Release|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.ActiveCfg = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.Build.0 = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.ActiveCfg = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.Build.0 = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.ActiveCfg = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.Build.0 = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.ActiveCfg = Release|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.Build.0 = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.Build.0 = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.ActiveCfg = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.Build.0 = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.Build.0 = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.ActiveCfg = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Debug|Win32.ActiveCfg = Debug|Win32 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Debug|x64.ActiveCfg = Debug|x64 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Release|Win32.ActiveCfg = Release|Win32 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB}.Release|x64.ActiveCfg = Release|x64 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Debug|Win32.ActiveCfg = Debug|Win32 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Debug|x64.ActiveCfg = Debug|x64 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Release|Win32.ActiveCfg = Release|Win32 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E}.Release|x64.ActiveCfg = Release|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Win32.ActiveCfg = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Win32.Build.0 = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|x64.ActiveCfg = Debug|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|x64.Build.0 = Debug|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Win32.ActiveCfg = Release|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Win32.Build.0 = Release|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|x64.ActiveCfg = Release|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|x64.Build.0 = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.Build.0 = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.ActiveCfg = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.Build.0 = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.Build.0 = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.ActiveCfg = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.Build.0 = Release|x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Debug|Win32.ActiveCfg = Debug|Win32 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Debug|Win32.Build.0 = Debug|Win32 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Debug|x64.ActiveCfg = Debug|x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Debug|x64.Build.0 = Debug|x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Release|Win32.ActiveCfg = Release|Win32 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Release|Win32.Build.0 = Release|Win32 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Release|x64.ActiveCfg = Release|x64 {431ED9C6-FDF6-4836-8B33-BE4EC5378640}.Release|x64.Build.0 = Release|x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Debug|Win32.ActiveCfg = Debug|Win32 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Debug|Win32.Build.0 = Debug|Win32 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Debug|x64.ActiveCfg = Debug|x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Debug|x64.Build.0 = Debug|x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Release|Win32.ActiveCfg = Release|Win32 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Release|Win32.Build.0 = Release|Win32 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Release|x64.ActiveCfg = Release|x64 {BB058D80-D376-4F0F-87F7-E4760BC2C84D}.Release|x64.Build.0 = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Cbc/MSVisualStudio/v10/libCbcSolver/0000755000175000017500000000000012600453457017663 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/libCbcSolver/libCbcSolver.vcxproj0000644000175000017500000002746712136521002023653 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E} libCbcSolver ManagedCProj StaticLibrary StaticLibrary StaticLibrary StaticLibrary <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglGMI;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;..\..\..\..\Cgl\src\CglRedSplit2;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglGMI;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;..\..\..\..\Cgl\src\CglRedSplit2;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Level3 ProgramDatabase X64 ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglGMI;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;..\..\..\..\Cgl\src\CglRedSplit2;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Level3 ProgramDatabase X64 ..\..\..\src\;..\..\..\..\Cgl\src\CglZeroHalf;..\..\..\..\Cgl\src\CglGMI;..\..\..\..\Cgl\src\CglLandP;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglDuplicateRow;..\..\..\..\Cgl\src\CglRedSplit;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cgl\src\CglResidualCapacity;..\..\..\..\Cgl\src\CglRedSplit2;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Level3 ProgramDatabase Default true true true true true true CoinMP-1.8.3/Cbc/MSVisualStudio/v10/cbcCInterfaceDll/0000755000175000017500000000000012600453457020421 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/cbcCInterfaceDll/cbcCInterfaceDll.vcxproj0000644000175000017500000003421312130311737025140 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {F1E9E3F0-6639-4A84-8E0F-A2D5F11978FB} cbcCInterfaceDll Win32Proj DynamicLibrary DynamicLibrary DynamicLibrary DynamicLibrary <_ProjectFileVersion>10.0.30319.1 true false true false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset Disabled ..\..\..\..\Cbc\src\;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_WINDOWS;_USRDLL;CBCCINTERFACEDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 EditAndContinue libOsiClp.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName).dll $(OutDir);%(AdditionalLibraryDirectories) true $(OutDir)cbcCInterfaceDll.pdb Windows false $(OutDir)cbcCInterfaceDll.lib MachineX86 ..\..\..\..\Cbc\src\;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_WINDOWS;_USRDLL;CBCCINTERFACEDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase libOsiClp.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName).dll $(OutDir);%(AdditionalLibraryDirectories) true Windows true true false $(OutDir)cbcCInterfaceDll.lib MachineX86 X64 Disabled ..\..\..\..\Cbc\src\;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;_DEBUG;_WINDOWS;_USRDLL;CBCCINTERFACEDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 ProgramDatabase libOsiClp.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName).dll $(OutDir);%(AdditionalLibraryDirectories) true $(OutDir)cbcCInterfaceDll.pdb Windows false $(OutDir)cbcCInterfaceDll.lib MachineX64 X64 ..\..\..\..\Cbc\src\;..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_WINDOWS;_USRDLL;CBCCINTERFACEDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase libOsiClp.lib;%(AdditionalDependencies) $(OutDir)$(ProjectName).dll $(OutDir);%(AdditionalLibraryDirectories) true Windows true true false $(OutDir)cbcCInterfaceDll.lib MachineX64 {dbea3904-f0b8-408a-9e1a-6497febe8c42} false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false {02d45875-a8cf-41b9-990b-3699c0ecfe10} false {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false {363ba154-fec9-4e1e-bc23-93cec58ab785} false CoinMP-1.8.3/Cbc/MSVisualStudio/v10/CbcCSosDllSample/0000755000175000017500000000000012600453457020367 5ustar renereneCoinMP-1.8.3/Cbc/MSVisualStudio/v10/CbcCSosDllSample/cbcCSosDllSample.vcxproj0000644000175000017500000003532112130311737025115 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {8AFDEA7E-BC40-4F31-80A8-8D05485E0A1E} cbcCSosDllSample Win32Proj Application Application Application Application <_ProjectFileVersion>10.0.30319.1 true false true false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\..\Osi\src\OsiCbc;..\..\..\..\Osi\src;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Osi\src\OsiClp;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cbc\src;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;CBCCINTERFACEDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\";%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Cdecl Default false cbcCInterfaceDll.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) %(DelayLoadDLLs) true true true Console false MachineX86 ..\..\..\..\Osi\src\OsiCbc;..\..\..\..\Osi\src;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Osi\src\OsiClp;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cbc\src;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;CBCCINTERFACEDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\\";%(PreprocessorDefinitions) MultiThreadedDLL Cdecl Default false cbcCInterfaceDll.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) %(DelayLoadDLLs) true true true Console true true false MachineX86 X64 ..\..\..\..\Osi\src\OsiCbc;..\..\..\..\Osi\src;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Osi\src\OsiClp;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cbc\src;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;CBCCINTERFACEDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\\";%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL ProgramDatabase Cdecl Default false cbcCInterfaceDll.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) %(DelayLoadDLLs) true true true Console false MachineX64 X64 ..\..\..\..\Osi\src\OsiCbc;..\..\..\..\Osi\src;..\..\..\..\Cgl\src\CglTwomir;..\..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\..\Cgl\src\CglFlowCover;..\..\..\..\Cgl\src\CglClique;..\..\..\..\Cgl\src\CglOddHole;..\..\..\..\Cgl\src\CglKnapsackCover;..\..\..\..\Cgl\src\CglGomory;..\..\..\..\Cgl\src\CglPreProcess;..\..\..\..\Cgl\src\CglProbing;..\..\..\..\Cgl\src;..\..\..\..\Clp\src;..\..\..\..\Osi\src\OsiClp;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;..\..\..\..\Cbc\src;%(AdditionalIncludeDirectories) CBC_BUILD;WIN32;NDEBUG;_NDEBUG;COIN_FAST_CODE;CLP_FAST_CODE;COIN_NO_TEST_DUPLICATE;_CONSOLE;CBCCINTERFACEDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\\";%(PreprocessorDefinitions) MultiThreadedDLL Cdecl Default false cbcCInterfaceDll.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) %(DelayLoadDLLs) true true true Console true true false MachineX64 {f1e9e3f0-6639-4a84-8e0f-a2d5f11978fb} false CoinMP-1.8.3/Cbc/osi-cbc.pc.in0000644000175000017500000000043211510112067014244 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiCbc Description: COIN-OR Open Solver Interface for CBC URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiCbc Cflags: -I${includedir} Requires: cbc CoinMP-1.8.3/Cbc/scripts/0000755000175000017500000000000012600453456013477 5ustar renereneCoinMP-1.8.3/Cbc/scripts/get.miplib20100000755000175000017500000000033312101340057015745 0ustar renerene#!/bin/bash for file in `cat miplib2010-candidates.test` do if test -f $file then echo $file exists else cd miplib2010-candidates/ wget http://miplib.zib.de/miplib2010/$file cd .. fi doneCoinMP-1.8.3/Cbc/scripts/run_cbc.sh0000755000175000017500000000360112101340057015435 0ustar renerene#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #* * #* This file is part of the test engine for MIPLIB2010 * #* * #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # $Id: run_cbc.sh 1854 2013-01-28 00:02:55Z stefan $ SOLVER=$1 BINNAME=$2 NAME=$3 TIMELIMIT=$4 SOLFILE=$5 THREADS=$6 MIPGAP=$7 TMPFILE=results/check.$SOLVER.tmp if test $THREADS != 0 then $BINNAME -import $NAME -sec $TIMELIMIT -threads $THREADS -ratio $MIPGAP -solve -solution $SOLFILE else $BINNAME -import $NAME -sec $TIMELIMIT -ratio $MIPGAP -solve -solution $SOLFILE fi if test -f $SOLFILE then # translate CBC solution format into format for solution checker. # The SOLFILE format is a very simple format where in each line # we have a pair, separated by spaces. # A variable name of =obj= is used to store the objective value # of the solution, as computed by the solver. A variable name of # =infeas= can be used to indicate that an instance is infeasible. awk ' BEGIN{ infeasible = 0; nointsol = 0; } ($3 != "objective" && $3 != "gap" && $3 != "time" && $2 != "infeasible"){ if (!infeasible){ printf ("%s %s \n", $2, $3); } } ($3 == "objective" && $1 != "Infeasible" && $2 != "infeasible"){ printf ("=obj= %s \n", $5); } ($3 == "gap"){ printf ("=obj= %s \n", $8); } ($3 == "time"){ if ($5 == "integer"){ printf ("=nointsol= \n"); nointsol = 1; }else{ printf ("=obj= %s \n", $7); } } ($1 == "Infeasible" || $2 == "infeasible"){ printf ("=infeas= \n"); infeasible = 1; }' $SOLFILE | tee $TMPFILE mv $TMPFILE $SOLFILE fi CoinMP-1.8.3/Cbc/scripts/parse_cbc_sol.awk0000755000175000017500000000132612101340057016772 0ustar renerene#!/usr/bin/awk -f #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #* * #* This file is part of the test engine for MIPLIB2010 * #* * #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /^Stopped/ { if( NF > 7 ) exit; printf ("=obj= %s \n", $7); next; } /^Optimal/ { printf ("=obj= %s \n", $5); next; } /^Infeasible/ { printf ("=infeas= \n"); exit; } /^Integer/ { if( $2 == "infeasible") printf ("=infeas= \n"); exit; } //{ printf ("%s %s \n", $2, $3); } CoinMP-1.8.3/Cbc/scripts/run.sh0000755000175000017500000000664012101340057014634 0ustar renerene#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #* * #* This file is part of the test engine for MIPLIB2010 * #* * #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # $Id: run.sh 1854 2013-01-28 00:02:55Z stefan $ SHELL=$1 BINNAME=$2 TSTNAME=$3 TIMELIMIT=$4 HARDMEMLIMIT=$5 THREADS=$6 # construct paths MIPLIBPATH=`pwd` BINPATH=$MIPLIBPATH/bin CHECKERPATH=$MIPLIBPATH/checker RESULTSPATH=$MIPLIBPATH/results SCRIPTPATH=$MIPLIBPATH/scripts TSTPATH=$MIPLIBPATH/testset # check if the solver link (binary) exists if test ! -e $BINPATH/$BINNAME then echo "ERROR: solver link <$BINNAME> does not exist in folder; see bin/README" exit; fi # check if the test set file/link exists if test ! -e $TSTPATH/$TSTNAME.test then echo "ERROR: test set file/link <$TSTNAME.test> does not exist in folder" exit; fi # grep solver name SOLVER=`echo $BINNAME | sed 's/\([a-zA-Z0-9_-]*\).*/\1/g'` # check if the result folder exist. if not create the result folder if test ! -e $RESULTSPATH then mkdir $RESULTSPATH fi # construct name of output, results, and temporary solution file BASENAME=$RESULTSPATH/$TSTNAME.$BINNAME OUTFILE=$BASENAME.out RESFILE=$BASENAME.res SOLFILE=$BASENAME.sol # absolut tolerance for checking linear constraints and objective value LINTOL=1e-4 # absolut tolerance for checking integrality constraints INTTOL=1e-4 # Note that the MIP gap (gap between primal and dual solution) is not # uniqly defined through all solvers. For example, there is a difference # between SCIP and CPLEX. All solver, however, have the some behaviour in # case of a MIP gap of 0.0. MIPGAP=0.0 # post system information and current time into the output file uname -a > $OUTFILE date >> $OUTFILE # convert hard memory limit to kilo bytes and post it into the output file HARDMEMLIMIT=`expr $HARDMEMLIMIT \* 1024` echo "hard mem limit: $HARDMEMLIMIT k" >> $OUTFILE # loop over all instance names which are listed in the test set file name for i in `cat $TSTPATH/$TSTNAME.test` do # check if the current instance exists if test -f $i then echo @01 $i =========== echo ----------------------------- date echo ----------------------------- TIMESTART=`date +"%s"` echo @03 $TIMESTART $SHELL -c " ulimit -v $HARDMEMLIMIT k; ulimit -f 2000000; $SCRIPTPATH/run_$SOLVER.sh $SOLVER $BINPATH/$BINNAME $i $TIMELIMIT $SOLFILE $THREADS $MIPGAP" echo TIMEEND=`date +"%s"` echo @04 $TIMEEND echo @05 $TIMELIMIT # check if a solution file was written if test -e $SOLFILE then # check if the link to the solution checker exists if test -f "$CHECKERPATH/bin/solchecker" then echo $SHELL -c " $CHECKERPATH/bin/solchecker $i $SOLFILE $LINTOL $INTTOL" echo else echo WARNING: solution cannot be checked because solution checker is missing fi fi echo ----------------------------- date echo ----------------------------- echo echo =ready= else echo @02 FILE NOT FOUND: $i =========== fi done 2>&1 | tee -a $OUTFILE date >> $OUTFILE if test -e $SOLFILE then rm $SOLFILE fi awk -f $SCRIPTPATH/parse.awk -f $SCRIPTPATH/parse_$SOLVER.awk $OUTFILE | tee $RESFILE CoinMP-1.8.3/Cbc/scripts/parse.awk0000644000175000017500000001041212101340057015277 0ustar renerene#!/usr/bin/awk -f #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #* * #* This file is part of the test engine for MIPLIB2010 * #* * #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # $Id: parse.awk 1854 2013-01-28 00:02:55Z stefan $ function abs(x) { return x < 0 ? -x : x; } function min(x,y) { return (x) < (y) ? (x) : (y); } function max(x,y) { return (x) > (y) ? (x) : (y); } BEGIN { printf("----------------------------+----------------+----------------+------+-------+-------+--------+---------\n"); printf("Name | Dual Bound | Primal Bound | Gap%% | Nodes | Time | Status | Solution \n"); printf("----------------------------+----------------+----------------+------+-------+-------+--------+---------\n"); infty = +1e+20; eps = 1e-04; largegap = 1e+04; # initialize summary data nsolved = 0; nstopped = 0; nfailed = 0; # initialize data to be set in parse_.awk solver = "?"; solverversion = "?"; solverremark = ""; } # instance name /^@01/ { n = split ($2, a, "/"); m = split(a[n], b, "."); prob = b[1]; if( b[m] == "gz" || b[m] == "z" || b[m] == "GZ" || b[m] == "Z" ) m--; for( i = 2; i < m; ++i ) prob = prob "." b[i]; # initialize data to be set in parse.awk timelimit = 0; starttime = 0.0; endtime = 0.0; time = 0.0; # initialize data to be set parse_.awk bbnodes = 0; pb = +infty; db = -infty; aborted = 1; timeout = 0; solstatus = "none"; read_error = 0; } # time /@03/ { starttime = $2; } /@04/ { endtime = $2; } /@05/ { timelimit = $2; } # solution status /Read SOL:/ { solstatus = "--"; } /Check SOL:/ { intcheck = $4; conscheck = $6; objcheck = $8; if( intcheck && conscheck && objcheck ) solstatus = "ok"; else solstatus = "fail"; } /^=ready=/ { # measure wallclock time externaly rounded up to the next second time = max(1, endtime - starttime); if( timelimit > 0 ) { # report time limit as time for instances stopped by time limit if( timeout ) time = timelimit; # report time limit as time for aborted instances if( aborted ) time = timelimit; # report time limit as time for instances that exceeded the time limit but did not stop time = min(time, timelimit); } # determine solving status status = ""; if( aborted && !read_error) status = "abort"; else if (aborted && read_error) status = "noread"; else if( timeout ) status = "stopped"; else status = "ok"; # determine overall status from solving status and solution status: # instance solved correctly (including case that no solution was found) if( status == "ok" && (solstatus == "ok" || solstatus == "--") ) nsolved++; # incorrect solving process or infeasible solution (including errors with solution checker) else if( status == "abort" || (solstatus == "fail" || solstatus == "error") ) nfailed++; # stopped due to imposed limits else if ( status == "stopped" ) nstopped++; else nnoread++; # compute gap temp = pb; pb = 1.0*temp; temp = db; db = 1.0*temp; if( abs(pb - db) < eps && pb < +infty ) gap = 0.0; else if( abs(db) < eps ) gap = -1.0; else if( pb*db < 0.0 ) gap = -1.0; else if( abs(db) >= +infty ) gap = -1.0; else if( abs(pb) >= +infty ) gap = -1.0; else gap = 100.0*abs((pb-db)/db); if( gap < 0.0 ) gapstr = " --"; else if( gap < largegap ) gapstr = sprintf("%6.1f", gap); else gapstr = " Large"; printf("%-28s %16.9g %16.9g %6s %7d %7d %8s %9s\n", prob, db, pb, gapstr, bbnodes, time, status, solstatus); } END { printf("----------------------------+----------------+----------------+------+-------+-------+--------+---------\n"); printf("\n"); printf("solved/stopped/noread/failed: %d/%d/%d/%d\n", nsolved, nstopped, nnoread, nfailed); printf("\n"); printf("@02 timelimit: %g\n", timelimit); printf("@01 %s(%s)%s\n", solver, solverversion, solverremark); }CoinMP-1.8.3/Cbc/scripts/parse_cbc.awk0000644000175000017500000000304012101340057016105 0ustar renerene#!/usr/bin/awk -f #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #* * #* This file is part of the test engine for MIPLIB2010 * #* * #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # $Id: parse_cbc.awk 1854 2013-01-28 00:02:55Z stefan $ # set all solver specific data: # solver ["?"] # solverversion ["?"] # lps ["none"] # lpsversion ["-"] # bbnodes [0] # db [-infty] # pb [+infty] # aborted [1] # timeout [0] # The solver name BEGIN { solver = "CBC"; gap = 0; } # The solver version /^Version:/ { version = $2; } /^Revision Number:/ { revision = $3; solverversion = version "-" revision } # The results /^Result/ { if ($3 == "Optimal"){ if ($7 == "gap"){ gap = 1; }else{ gap = 0 } aborted = 0; timeout = 0; } if ($5 == "infeasible"){ pb = +infty; db = +infty; aborted = 0; timeout = 0; }else if ($5 == "unbounded"){ pb = -infty; db = -infty; aborted = 0; timeout = 0; }else if ($3 == "Stopped"){ if ($5 == "time"){ timeout = 1; aborted = 0; } }else if ($3 == "Difficulties"){ aborted = 1 } } /^Objective value:/ { pb = $3; if (!gap){ db = pb; } } /^Lower bound:/ { db = $3; } /^Enumerated nodes:/ { bbnodes = $3 } /errors on input/ { read_error = 1; }CoinMP-1.8.3/Cbc/Makefile.am0000644000175000017500000001071412465466743014063 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 2132 2015-02-07 19:56:19Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src # Don't do src/OsiCbc recursively, since src/OsiCbc/libOsiCbc depends on src/libCbc SUBDIRS += src/OsiCbc # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball if ALWAYS_FALSE SUBDIRS += test endif ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = \ doc/authors.xml \ doc/cbcexe.xml \ doc/cbcmodelclass.xml \ doc/cbcuserguide.xml \ doc/doxygen.xml \ doc/faqcontent.xml \ doc/faq.xml \ doc/intro.xml \ doc/legal.xml \ doc/messages.xml \ doc/moresamples.xml \ doc/osibuild.xml \ doc/otherclasses.xml \ doc/revhist.xml \ examples/CbcBranchFollow2.cpp \ examples/CbcBranchFollow2.hpp \ examples/CbcBranchLink.cpp \ examples/CbcBranchLink.hpp \ examples/CbcBranchUser.cpp \ examples/CbcBranchUser.hpp \ examples/CbcCompareUser.cpp \ examples/CbcCompareUser.hpp \ examples/CbcSolver2.cpp \ examples/CbcSolver2.hpp \ examples/CbcSolver3.cpp \ examples/CbcSolver3.hpp \ examples/CbcSolverLongThin.cpp \ examples/CbcSolverLongThin.hpp \ examples/CbcSolverLink.hpp \ examples/CbcSolverLink.cpp \ examples/ClpQuadInterface.cpp \ examples/ClpQuadInterface.hpp \ examples/OsiBranchLink.cpp \ examples/OsiBranchLink.hpp \ examples/OsiSolverLink.hpp \ examples/OsiSolverLink.cpp \ examples/crew.cpp \ examples/driver2.cpp \ examples/driver.cpp \ examples/fast0507b.cpp \ examples/fast0507.cpp \ examples/gear.cpp \ examples/hotstart.cpp \ examples/link.cpp \ examples/longthin.cpp \ examples/lotsize.cpp \ examples/Makefile.in \ examples/minimum.cpp \ examples/nway.cpp \ examples/qmip.cpp \ examples/quad2.mps \ examples/quad.mps \ examples/repeat.cpp \ examples/sample1.cpp \ examples/sample2.cpp \ examples/sample3.cpp \ examples/sample4.cpp \ examples/sample5.cpp \ examples/sos.cpp \ examples/sudoku.cpp \ examples/sudoku_sample.csv ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc ######################################################################## # Installation of the addlibs file # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = cbc.pc osi-cbc.pc addlibsdir = $(DESTDIR)$(datadir)/coin/doc/Cbc install-data-hook: @$(mkdir_p) "$(addlibsdir)" if COIN_HAS_PKGCONFIG PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ $(PKG_CONFIG) --libs cbc > $(addlibsdir)/cbc_addlibs.txt else if COIN_CXX_IS_CL echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCbc.lib @CBCLIB_LIBS_INSTALLED@" > $(addlibsdir)/cbc_addlibs.txt else echo -L@abs_lib_dir@ -lCbcSolver -lCbc @CBCLIB_LIBS_INSTALLED@ > $(addlibsdir)/cbc_addlibs.txt endif endif uninstall-hook: rm -f $(addlibsdir)/cbc_addlibs.txt ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = include BuildTools/Makemain.inc CoinMP-1.8.3/Cbc/depcomp0000755000175000017500000003710011405215312013353 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Cbc/LICENSE0000644000175000017500000002622712131054770013021 0ustar renereneEclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. CoinMP-1.8.3/Cbc/README0000644000175000017500000002271412510010035012654 0ustar renerene# CBC Version 2.9.4 README Welcome to the README for the COIN Branch and Cut Solver (CBC). CBC is distributed under the Eclipse Public License and is freely redistributable. All source code and documentation is Copyright IBM and others. This README may be redistributed freely. ## DOCUMENTATION For a quick start guide, please see the INSTALL file in this distribution. A (somehwat outdated) user's manual is available here: http://www.coin-or.org/Cbc More up-to-date automatically generated documentation of the source code can be found here: http://www.coin-or.org/Doxygen/Cbc/ Further information can be found here: http://projects.coin-or.org/Cbc ## SUPPORT ### List Serve CBC users should use the Cbc mailing list. To subscribe, go to http://list.coin-or.org/mailman/listinfo/cbc ### Bug Reports Bug reports should be reported on the CBC development web site at https://projects.coin-or.org/Cbc/newticket ## CHANGELOG * Release 2.9.4 * Small fixes for stability * Fixes for Doygen documentation generation * Release 2.9.3 * Minor bug fixes * Release 2.9.2 * Fix for proper installation with ```DESTDIR``` * Release 2.9.1 * Fix for dependency linking * Minor bug fixes * Release 2.9.0 * Introduced specialized branching methods for dealing with "big Ms". * Introduced new methods for dealing with symmetry (requires installation of [nauty](http://pallini.di.uniroma1.it/)) * Introduction of conflict cuts (off by default, turn on with `-constraint conflict`) * Release 2.8.13 * Improved message handling * Miscellaneous bug fixes. * Release 2.8.12 * Update for dependencies. * Release 5.8.11 * Major overhaul of C interface * Fixes to SOS * Miscellaneous bug fixes * Release 2.8.10 * More changes related to thread safety. * Fix bug in build system with Visual Studio compiler. * Miscellaneous bug fixes. * Release 2.8.9 * Attempt to make Cbc thread safe. * Add parallel examples. * Add CbcSolverUsefulInfo. * Bug fixes. * Release 2.8.8 * Added example to show how to use Cbc with installed libraries in MSVC++ * Fixed inconsistency in addition of libCbcSolver to dependencies in {{{cbc_addlibs.txt}}}. * Release 2.8.7 * Changed so that Doxygen builds LaTex * Fixes for build system * Release 2.8.6 * Added option to explicitly link dependencies to comply with packaging requirements on Fedora and Debian, as well as allow building of MinGW DLLs. * Release 2.8.5 * Minor fixes to build system * Release 2.8.4 * Small bug fixes * Upgrades to build system * Release 2.8.3: * Fix for handling SOS. * Release 2.8.2: * Fixed recognition of Glpk source in main configure. * Minor bug fixes in CoinUtils, Clp, and Cbc. * Release 2.8.1: * Minor bug fixes * Release 2.8.0: * Introduced new secondaryStatus 8 to indicate that solving stopped due to an iteration limit. * Solution pool is now accessible via the command line and the CbcMain* interface. * New mipstart option to read an initial feasible solution from a file. Only values for discrete variables need to be provided. * Added Proximity Search heuristic by Fischetti and Monaci (off by default): The simplest way to switch it on using stand-alone version is ```-proximity on```. Proximity Search is the new "No-Neighborhood Search" 0-1 MIP refinement heuristic recently proposed by Fischetti and Monaci (2012). The idea is to define a sub-MIP without additional constraints but with a modified objective function intended to attract the search in the proximity of the incumbent. The approach works well for 0-1 MIPs whose solution landscape is not too irregular (meaning the there is reasonable probability of finding an improved solution by flipping a small number of binary variables), in particular when it is applied to the first heuristic solutions found at the root node. * An implementation of Zero-Half-Cuts by Alberto Caprara is now available. By default, these cuts are off. To use add to your command line -zerohalfCuts root (or other options) or just -zero. So far, they may help only on a small subset of problems and may need some tuning. The implementation of these cuts is described in G. Andreello, A. Caprara, and M. Fischetti "Embedding Cuts in a Branch and Cut Framework: a Computational Study with {0,1/2}-Cuts" INFORMS Journal on Computing 19(2), 229-238, 2007 http://dx.doi.org/10.1287/ijoc.1050.0162 * An alternative implementation of a reduce and split cut generator by Giacomo Nannicini is now available. By default, these cuts are off. To use add to your command line -reduce2AndSplitCuts root (or other options). The implementation of these cuts is described in G. Cornuejols and G. Nannicini "Practical strategies for generating rank-1 split cuts in mixed-integer linear programming" Mathematical Programming Computation 3(4), 281-318, 2011 http://dx.doi.org/10.1007/s12532-011-0028-6 * An alternative robust implementation of a Gomory cut generator by Giacomo Nannicini is now available. By default, these cuts are off. To use add to your command line -GMI root (or other options). The implementation of these cuts is described in G. Cornuejols, F. Margot, and G. Nannicini "On the safety of Gomory cut generators" http://faculty.sutd.edu.sg/~nannicini/index.php?page=publications * To encourage the use of some of the more exotic/expensive cut generators a parameter -slowcutpasses has been added. The idea is that the code does these cuts just a few times - less than the more usual cuts. The default is 10. The cut generators identified by "may be slow" at present are just Lift and project and ReduceAndSplit (both versions). * Allow initialization of random seed by user. Pseudo-random numbers are used in Cbc and Clp. In Clp they are used to break ties in degenerate problems, while in Cbc heuristics such as the Feasibility Pump use them to decide whether to round up or down. So if a different pseudo-random seed is given to Clp then you may get a different continuous optimum and so different cuts and heuristic solutions. This can be switched on by setting randomSeed for Clp and/or randomCbcSeed for Cbc. The special value of 0 tells code to use time of day for initial seed. * Building on this idea, Andrea Lodi, Matteo Fischetti, Michele Monaci, Domenico Salvagnin, Yuji Shinano, and Andrea Tramontani suggest that this idea be improved by running at the root node with multiple copies of solver, each with its own different seed and then passing in the solutions and cuts so that the main solver has a richer set of solutions and possibly stronger cuts. This is switched on by setting -multipleRootPasses. These can also be done in parallel. * Few changes to presolve for special variables and badly scaled problems (in CoinUtils). * New option -extraVariables which switches on a trivial re-formulation that introduces extra integer variables to group together variables with same cost. * For some problems, cut generators and general branching work better if the problem would be infeasible if the cost is too high. If the new option -constraintFromCutoff is set, the objective function is added as a constraint which rhs is set to the current cutoff value (objective value of best known solution). * Release 2.7.8: * Change message when LP simplex iteration limit is hit from "Exiting on maximum nodes" to "Exiting on maximum number of iterations" * Fix for using overlapping SOS. * Fixes in buildsystem. * Release 2.7.7: * Fix to report interruption on user event if SIGINT is received by CbcSolver. model->status() should now be 5 if this event happened. Added method CbcModel::sayEventHappened() to make cbc stop due to an 'user event'. * Other minor fixes. * Release 2.7.6: * Fixes to build system. * Other minor fixes. * Release 2.7.5: * Fixes to get AMPL interface working again. * More fixes to MSVC++ files. * Release 2.7.4: * Minor bugfixes. * Release 2.7.3: * Minor bugfixes. * Fixes to MSVC++ files. * Release 2.7.2: * Allow row/column names for GMPL models. * Added CbcModel::haveMultiThreadSupport() to indicate whether Cbc library has been compiled with multithread support. * Added CbcModel::waitingForMiniBranchAndBound() to indicate whether sub-MIP heuristic is currently running. * Cbc shell should work with readline if configured with ```--enable-gnu-packages```. * Support for compressed input files (.gz, .bz2) is now enabled by default. * Fix problems with relative gap tolerance > 100% and further bugs. * Fixes for MSVC++ Version 9 files. * Minor fixes in buildsystem; update to BuildTools 0.7.1. * Release 2.7.1: * Fixes to MSVC++ files * Release 2.7.0: * License has been changed to the EPL. * Support for MSVC++ version 10 added. * Support for BuildTools version 0.7 to incorporate recent enhancements, including proper library versioning in Linux, prohibiting installation of private headers, etc. * Updated externals to new stable versions of dependent projects. * Improvements to heuristics. * New options for cut generation. * Improved reporting of results. * Improvements to documentation. * Minor bug fixes. CoinMP-1.8.3/Cbc/config.sub0000755000175000017500000007772611405215312014003 0ustar renerene#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Cbc/CbcSourceFilesTable2.xls0000644000175000017500000012000011305575712016417 0ustar renereneÐÏࡱá>þÿ NþÿÿÿþÿÿÿMÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ | ÍÉá°Áâ\pBjarni Kristjansson B°aÀ=œ¯¼=âÿŸQé%8X@"·Ú1Èÿ Arial1Èÿ Arial1Èÿ Arial1Èÿ Arial1 ÿ Arial1Èÿ¼ Arial1Èÿ Arial1Ü Calibri1Ü  Calibri1Ü Calibri1Ü4¼ Calibri1Ü ¼ Calibri1Ü Calibri1Ü Calibri1,8¼ Calibri18¼ Calibri1Ü8¼ Calibri1Ü> Calibri1Ü4 Calibri1Ü< Calibri1Ü?¼ Calibri1h8¼ Cambria1ܼ Calibri1Ü  Calibri"$"#,##0_);\("$"#,##0\)!"$"#,##0_);[Red]\("$"#,##0\)""$"#,##0.00_);\("$"#,##0.00\)'""$"#,##0.00_);[Red]\("$"#,##0.00\)7*2_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_).))_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)?,:_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)6+1_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)àõÿ À àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ à À àõÿ ´Ÿ àõÿ ´­ àõÿ ´ª àõÿ ´® àõÿ ´› àõÿ ´¯ àõÿ ´¬ àõÿ ´ àõÿ ´‹ àõÿ ´® àõÿ ´¬ àõÿ ´³ à õÿ ´ž à õÿ ´ à õÿ ´‹ à õÿ ´¤ à õÿ ´± à õÿ ´´ à õÿ ´¾ à õÿ ´Š à õÿ ´¹ à õÿ ´¤ à õÿ ´± à õÿ ´µ à õÿ ´­ à õÿ ”— — – à õÿ ”ff¿¿· à+õÿ øÀ à)õÿ øÀ à,õÿ øÀ à*õÿ øÀ à õÿ ôÀ àõÿ ´ª àõÿ ÔPÀ àõÿ ÔP À àõÿ Ô À àõÿ ôÀ àõÿ ”— — ¯ àõÿ Ô`À àõÿ ´« àõÿ œ  š àõÿ ”¿¿– à õÿ øÀ àõÿ ôÀ àõÿ Ôa>À àõÿ ôÀ à À à @À “ 20% - Accent1“ 20% - Accent2“ 20% - Accent3“ 20% - Accent4“ 20% - Accent5“ 20% - Accent6“ 40% - Accent1“ 40% - Accent2“ 40% - Accent3“ 40% - Accent4“ 40% - Accent5“ 40% - Accent6“ 60% - Accent1“ 60% - Accent2“ 60% - Accent3“ 60% - Accent4“ 60% - Accent5“! 60% - Accent6“ "Accent1“ #Accent2“ $Accent3“ %Accent4“ &Accent5“ 'Accent6“(Bad“) Calculation“* Check Cell“+€ÿ“,€ÿ“-€ÿ“.€ÿ“/Explanatory Text“ 0Good“1 Heading 1“2 Heading 2“3 Heading 3“4 Heading 4“ 5Input“6 Linked Cell“ 7Neutral“€ÿ“ 8Note“ 9Output“:€ÿ“ ;Title“ <Total“= Warning Text`…±ASheet1…/wSheet2…xSheet3Œ®ÁÁ"¾üOÂÞCbcBranchActual.cppCbcBranchBase.cppCbcBranchCut.cppCbcBranchDynamic.cppCbcBranchLotsize.cppCbcCbcParam.cppCbcCompareActual.cppCbcCountRowCut.cppCbcCutGenerator.cppCbcEventHandler.cpp CbcFathom.cppCbcFathomDynamicProgramming.cpp CbcGenBaB.cppCbcGenCbcParam.cppCbcGenCbcParamUtils.cppCbcGenCtlBlk.cppCbcGeneric.cppCbcGenMessages.cppCbcGenOsiParam.cppCbcGenOsiParamUtils.cppCbcGenParam.cppCbcGenParamUtils.cppCbcGenSolution.cppCbcGenSolvers.cppCbcHeuristic.cppCbcHeuristicDive.cppCbcHeuristicDiveCoefficient.cppCbcHeuristicDiveFractional.cppCbcHeuristicDiveGuided.cppCbcHeuristicDiveLineSearch.cppCbcHeuristicDivePseudoCost.cpp CbcHeuristicDiveVectorLength.cppCbcHeuristicFPump.cppCbcHeuristicGreedy.cppCbcHeuristicLocal.cppCbcHeuristicPivotAndFix.cppCbcHeuristicRandRound.cppCbcHeuristicRINS.cpp CbcLinked.cpp CbcMain.cppCbcMessage.cpp CbcModel.cpp CbcNode.cpp CbcParam.cpp CbcSolver.cppCbcStatistics.cppCbcStrategy.cpp CbcTree.cppCbcTreeLocal.cpp Cbc_ampl.cppCbc_C_Interface.cppClpAmplObjective.cppClpAmplStuff.cpp CoinSolve.cpp unitTest.cppunitTestClp.cppBranch InterfaceAmplTest HeuristicGenericFilenameGroup CPP LinesAThe support functions for the main branch-and-cut action routine.4Implementation functions for CbcGenParam parameters.,Constructors and destructors for CbcCbcParamDUnnamed local namespace for cbc-generic support types and functions.,Constructors and destructors for CbcOsiParam3Implementation functions for CbcOsiParam parameters,Constructors and destructors for CbcGenParam3Implementation functions for CbcGenParam parameters‚Helper routine to generate masks for selecting names to print. Returns true if masks are generated without error, false otherwise.¥This file contains routines related to handling Osi solvers. The technique is to maintain a map of OsiSolverInterface objects as prototypes of the available solvers.libCbcxcbcSolve cbcGeneric*Constructor for cbc-generic control block.Message definitions.CommentCbcAmpl Other ObjectsMultiple CbcTreeLocalCbcTree CbcTreeArray CbcStrategyCbcStrategyDefault*CbcAmpl*, Multiple CbcStatisticsCbcParam2CbcNodeInfo, CbcFullNodeInfo, CbcPartialNodeInfo, CbcNodeCbcModel CbcMessage OsiSolverLink_OsiLinkedBound, OsiHeuristicDynamic3, OsiOldLink, OsiBiLinear*, OsiSimpleFixedInteger, MultipleCbcHeuristicRINSCbcHeuristicRandRoundCbcHeuristicPivotAndFixCbcHeuristicLocalCbcHeuristicNaiveCbcHeuristicGreedyCoverCbcHeuristicGreedyEqualityCbcHeuristicFPumpCbcDisasterHandlerCbcHeuristicDiveVectorLengthCbcHeuristicDivePseudoCostCbcHeuristicDiveLineSearchCbcHeuristicDiveGuidedCbcHeuristicDiveFractionalCbcHeuristicDiveCoefficientCbcHeuristicDive CbcHeuristicmCbcHeuristicNode, CbcHeuristicNodeList, CbcRounding, CbcHeuristicPartial, CbcSerendipity, CbcHeuristicJustOneCbcFathomDynamicProgramming CbcFathom CbcOsiSolverCbcEventHandlerCbcCutGenerator$CbcCutModifier, CbcCutSubsetModifierCbcCountRowCutCbcCompareDepth:CbcCompareObjective, CbcCompareDefault, CbcCompareEstimate#include "CbcOrClpParam.cpp" CbcLotsizeCbcLotsizeBranchingObject!CbcSimpleIntegerDynamicPseudoCost=CbcDynamicPseudoCostBranchingObject, CbcBranchDynamicDecision CbcBranchCut@CbcCutBranchingObject, CbcBranchToFixLots, CbcBranchAllDifferent CbcObjectJCbcBranchingObject, CbcBranchDecision, CbcConsequence, CbcObjectUpdateData CbcGenCtlBlk CbcCbcParamnamespace CbcCbcParamUtils CbcOsiParamnamespace CbcOsiParamUtils CbcGenParamnamespace CbcGenSolversCbcGenParamUtils namespacenamespace CbcGenParamUtilsnamespace CbcGenSolvers, CbcCompareUser, namespacemain CbcSolverCbcMainglobalClpAmplObjectiveMyMessageHandler2¾CbcClique, CbcSos, CbcSimpleInteger, CbcIntegerBranchingObject, CbcSimpleIntegerPseudoCost, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSosBranchingObject, CbcBranchDefaultDecision, CbcFollowOn, CbcFixingBranchingObject, CbcNWay, CbcNWayBranchingObject, CbcFixVariable, CbcDummyBranchingObject, CbcGeneral, CbcGeneralDepth, CbcGeneralBranchingObject, CbcOneGeneralBranchingObject, CbcSubProblem First ObjectPersonBjarniLou HPP Lines3CbcHeuristicRENS, CbcHeuristicDINS, CbcHeuristicVNDCbcCompareBase.hppCbcCompareBaseCbcCompare, CbcChooseVariable CbcConfig.h#definesCbcFeasibilityBase.hppCbcFeasibilityBaseClpConstraintAmpl.hppOther ProjectsAge Total LinesStatusEdwin CbcClique.cpp CbcSos.cppCbcSimpleIntegerCbcIntegerBranchingObjectCbcSimpleIntegerPseudoCost#CbcIntegerPseudoCostBranchingObjectCbcCliqueBranchingObjectCbcLongCliqueBranchingObjectCbcSosBranchingObjectCbcBranchDefaultDecision CbcFollowOnCbcFixingBranchingObjectCbcNWayCbcNWayBranchingObjectCbcFixVariableCbcDummyBranchingObject CbcGeneralCbcGeneralDepthCbcGeneralBranchingObjectCbcOneGeneralBranchingObject CbcSubProblem CbcCompareCbcChooseVariableCbcBranchDecisionCbcBranchObjectCbcConsequenceCbcObjectUpdateDataCbcBranchAllDifferentCbcBranchToFixLotsCbcCutBranchingObjectCbcDynamicPseudoCostBranchingCbcFullNodeInfo.cppCbcNodeInfo.cppCbcPartialNodeInfo.cpp NodeStratCutsAPICoreCbcCutSubsetModifier.cppCbcCutModifier.cpCbcCompareDefault.cppCbcCompareDepth.cppCbcCompareEstimate.cppCbcCompareObjective.cppInherits Nonlinear/OsiAPI?Dan Dan/EdwinÿâP ùµ©eP ?û÷³x4 ÇWè¤Y Ç©e •Q g# m) D ~:שeç £Œ!Hò!®Ì"ˆp#, $É¿${I%ccÒ||@Ñ/£}A} 00\);_(*ef;_(@_) }A} 00\);_(*ef;_(@_) }A} 00\);_(*ef;_(@_) }A} 00\);_(*ef;_(@_) }A} 00\);_(*ef;_(@_) }A} 00\);_(*ef ;_(@_) }A} 00\);_(*ÌL;_(@_) }A} 00\);_(*ÌL;_(@_) }A} 00\);_(*ÌL;_(@_) }A} 00\);_(*ÌL;_(@_) }A} 00\);_(*ÌL;_(@_) }A} 00\);_(*ÌL ;_(@_) }A} 00\);_(*23;_(@_) }A} 00\);_(*23;_(@_) }A} 00\);_(*23;_(@_) }A} 00\);_(*23;_(@_) }A}  00\);_(*23;_(@_) }A}! 00\);_(*23 ;_(@_) }A}" 00\);_(*;_(@_) }A}# 00\);_(*;_(@_) }A}$ 00\);_(*;_(@_) }A}% 00\);_(*;_(@_) }A}& 00\);_(*;_(@_) }A}' 00\);_(* ;_(@_) }A}( œÿ00\);_(*ÿÇÎÿ;_(@_) }‘}) ú}ÿ00\);_(*òòòÿ;_(@_) ÿ ÿ ÿ ÿ}‘}* 00\);_(*¥¥¥ÿ;_(@_) ???ÿ ???ÿ ???ÿ ???ÿ}-}/ ÿ00\);_(*}A}0 aÿ00\);_(*ÆïÎÿ;_(@_) }A}1 00\);_(*;_(@_) }A}2 00\);_(*ÿ?;_(@_) }A}3 00\);_(*23;_(@_) }-}4 00\);_(*}‘}5 ??vÿ00\);_(*ÿÌ™ÿ;_(@_) ÿ ÿ ÿ ÿ}A}6 ú}ÿ00\);_(*ÿ€ÿ;_(@_) }A}7 œeÿ00\);_(*ÿëœÿ;_(@_) }x}8ÿÿÌÿ00\);_(*²²²ÿÿëœÿ;_(²²²ÿÿ ²²²ÿÿ ²²²ÿÿ}‘}9 ???ÿ00\);_(*òòòÿ;_(???ÿ ???ÿ  ???ÿ ???ÿ}-}; 00\);_(*}U}< 00\);_(*;_( }-}= ÿÿ00\);_(*’M’ÿ 20% - Accent1 efÛåñÿ ÿ%’M’"ÿ 20% - Accent2 efòÝÜÿ ÿ%’M’&ÿ 20% - Accent3 efêñÝÿ ÿ%’M’*ÿ 20% - Accent4 efåàìÿ ÿ%’M’.ÿ 20% - Accent5 efÛîóÿ ÿ%’M’2ÿ 20% - Accent6  efýéÙÿ ÿ%’M’ÿ 40% - Accent1 ÌL¸Ìäÿ ÿ%’M’#ÿ 40% - Accent2 ÌL湸ÿ ÿ%’M’'ÿ 40% - Accent3 ÌL×ä¼ÿ ÿ%’M’+ÿ 40% - Accent4 ÌLÌÀÚÿ ÿ%’M’/ÿ 40% - Accent5 ÌL¶Ýèÿ ÿ%’M’3ÿ 40% - Accent6  ÌLüÕ´ÿ ÿ%’M’ ÿ 60% - Accent1 23•³×ÿ ÿÿÿÿ%’M’$ÿ 60% - Accent2 23Ù—•ÿ ÿÿÿÿ%’M’(ÿ 60% - Accent3 23ÂÖšÿ ÿÿÿÿ%’M’,ÿ 60% - Accent4 23²¡Çÿ ÿÿÿÿ%’M’0ÿ 60% - Accent5 23“ÍÝÿ ÿÿÿÿ%’M’4ÿ 60% - Accent6  23úÀÿ ÿÿÿÿ%’A’ÿAccent1 O½ÿ ÿÿÿÿ%’A’!ÿAccent2 ÀPMÿ ÿÿÿÿ%’A’%ÿAccent3 ›»Yÿ ÿÿÿÿ%’A’)ÿAccent4 €d¢ÿ ÿÿÿÿ%’A’-ÿAccent5 K¬Æÿ ÿÿÿÿ%’A’1ÿAccent6  ÷–Fÿ ÿÿÿÿ%’9’ÿBad ÿÿÇÎÿ ÿœÿ%’’ÿ Calculation ÿòòòÿ ÿú}ÿ%ÿÿÿÿÿÿ ÿÿ’’ÿ Check Cell ÿ¥¥¥ÿ ÿÿÿÿ%ÿ???ÿÿ???ÿÿ???ÿ ÿ???ÿ’ ’ÿComma’(’ÿ Comma [0]’&’ÿCurrency’.’ÿ Currency [0]’G’5ÿExplanatory Text ÿÿ%’;’ÿGood ÿÆïÎÿ ÿaÿ%’G’ÿ Heading 1 I}ÿ%O½ÿ’G’ÿ Heading 2 I}ÿ%ÿ?¨ÀÞÿ’G’ÿ Heading 3 I}ÿ%23•³×ÿ’9’ÿ Heading 4 I}ÿ%’u’ÿInput ÿÿÌ™ÿ ÿ??vÿ%ÿÿÿÿÿÿ ÿÿ’K’ÿ Linked Cell ÿú}ÿ%ÿÿ€ÿ’A’ÿNeutral ÿÿëœÿ ÿœeÿ%’"’ÿNormal’b’ ÿNote ÿÿÿÌÿÿ²²²ÿÿ²²²ÿÿ²²²ÿ ÿ²²²ÿ’w’ÿOutput ÿòòòÿ ÿ???ÿ%ÿ???ÿÿ???ÿÿ???ÿ ÿ???ÿ’$’ÿPercent’1’ÿTitle I}ÿ%’M’ÿTotal ÿ%O½ÿO½ÿ’?’ ÿ Warning Text ÿÿÿ%ŽXŽTableStyleMedium9PivotStyleLight16šš££––Bå››ŒŒ | ÍÉ  gçFQÐ`krhv  dü©ñÒMbP?_*+‚€%ÿÁƒ„Mj\\OFFICE1\Dell Printer 5100cn ÜŒSÿ€ê odXXLetterPRIVâ0''''ÄÈ\KhCŸ}­ôÿÿÈDFBF0040/#Ñùgü-¤Oµ_ÉûËÜ}Ìd¡"dXXà?à?U} $} $!} $ } I+} I(gÿ€>ÿÿÿÿÿÿÿÿ ÿ ÿ ÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿý >>ý >?ý >›ý >Ùý >«ý >©ý >@ý >žý >ªý >Ký >Mý >Ný >¨ý >šý >Sý >Qý ý 8ý ¬½ @Ü´@|œ@! û»@ +ý DÀDÀý  Lý Tý ™ý ­ý 8ý ¬ý ®ý 8ý ¬ý ¯ý 8ý ¬ý °ý 8ý ¬ý ±ý 8ý ¬ý ²ý 8ý ¬ý ³ý 8ý ¬ý ´ý 8ý ¬ý µý 8ý ¬ý ¶ý 8ý ¬ý ·ý 8ý ¬ý ¸ý 8ý ¬ý ¹ý 8ý ¬ý ºý 8ý ¬ý »ý 8ý ¬ý ¼ý 8ý ¬ý ½ý 8ý ¬ý ¾ý 8ý ¬ý ¿ý 8ý ¬ý Àý 8ý ¬ý Áý 8ý ¬ý ý 8ý ¬½$@v@†@ Œ@ þ ¼f ; LþÀLÿÀý  Lý …ý †ý Äý 8ý ¬ý Åý 8ý ¬ý Æý 8ý ¬ý …ý 8ý ¬ý Çý 8ý ¬ý ý 8ý ¬½$@ø@°s@ è”@! ÿ ý  Lý ƒý „ý Èý 8ý ¬ý Éý 8ý ¬×DÄ là•*********************¨****** ÿ!ÿ"ÿ#ÿ$ÿ%ÿ&ÿ'ÿ(ÿ)ÿ*ÿ+ÿ,ÿ-ÿ.ÿ/ÿ0ÿ1ÿ2ÿ3ÿ4ÿ5ÿ6ÿ7ÿ8ÿ9ÿ:ÿ;ÿ<ÿ=ÿ>ÿ?ÿý Êý 8ý ¬ý !ý !8ý !¬½! @Ü@h@! H£@$ ÿ ý ! Lý !ý !‚ý "Ëý "8ý "¬ý #ý #8ý #¬ý $ý $8ý $¬½$.@H‰@@o@$ Œ@% ÿ ý $ Lý $ý $€ý %ý %Ñý %œ½%8@ð?% ð?& ÿ ý % Lý %~ý &ý &Ïý &¬½& @ð|@ d@&  ƒ@+ ÿ ý & Lý &|ý &}ý 'Õý 'Ïý '¬ý (Öý (Ïý (¬ý )×ý )Ïý )¬ý *Øý *Ïý *¬ý + ý +Ïý +¬~ +8@~ +@e@+ @e@. ÿ ý + Lý +¡ý +¢ý ,Âý ,Ïý ,¬ý -Ãý -Ïý -¬ý .£~ .4@~ .€Y@. €Y@/ ÿ ý . Lý .¤ý /ý /н/$@€_@À\@/  n@0 ÿ ý / Lý /{ý 0ý 0Ðý 0¬½0@“@à@0 ›@3 ÿ ý 0 Lý 0yý 0zý 1Ôý 1Ðý 1¬ý 2Óý 2Ðý 2¬ý 3 ý 3ѽ3B@@Y@ k@3  t@4 ÿ ý 3 Lý 3xý 4 ý 4Ïý 4¬½43@€Z@€_@4 m@5 ÿ ý 4 Lý 4vý 4wý 5 ý 5Ïý 5¬½5$@l@Àd@5 “@6 ÿ ý 5 Lý 5uý 6¥ý 6Û~ 68@~ 6€J@6 €J@7 ÿ ý 6 Lý 6¦ý 7 ý 7=ý 7½7,@°‹@7 °‹@8 ÿ ý 7 Lý 7ý 7ý 7Aý 8 ý 8=ý 8½88@`c@ g@8 €u@9 ÿ ý 8 Lý 8ˆý 8Cý 9ý 9=ý 9½92@y@9 y@: ÿ ý 9 Lý 9‰ý 9Bý :ý :=ý :½:8@H…@ @: t™@; ÿ ý : Lý : Lý :‡ý :Oý ;ý ;=ý ;½;8@ðy@; ðy@< ÿ ý ; Lý ;ý ;ý ;Dý <ý <=ý <½<8@h@< h@= ÿ ý < Lý <‡ý <Pý =ý ==ý =½=8@€c@ h@= v@> ÿ ý = Lý =Šý =Eý >ý >=ý >½>2@€€@> €€@? ÿ ý > Lý >‹ý >Fý ?ý ?=ý ?½?8@@c@`k@? Pw@@ ÿ ý ? Lý ?Œý ?G×Dul***{******es**ss—‰—‰‰@ÿAÿBÿCÿDÿEÿFÿGÿHÿIÿJÿKÿLÿMÿNÿOÿPÿQÿRÿSÿTÿUÿVÿWÿXÿYÿZÿ[ÿ\ÿ]ÿ^ÿ_ÿý @ý @=ý @½@2@d—@@ d—@A ÿ ý @ Lý @ý @‘ý @Hý Aý A=ý A½A6@@‚@A @‚@B ÿ ý A Lý AŽý Aý AIý Bý B=ý B½B8@Pp@B Pp@C ÿ ý B Lý Bý Bý BJý Cý C<½C$@ª¦@P„@C ¾«@D ÿ ý C Lý Csý Ctý Dý D<½D$@°@d@D 0“@E ÿ ý D Lý Drý Eý E<½E(@`@€H@E  f@F ÿ ý E Lý Eqý Fý F<½F2@\@€H@F  d@G ÿ ý F Lý Fpý Gý G<½G2@À^@J@G àe@H ÿ ý G Lý Goý Hý H<½H2@^@€H@H  e@I ÿ ý H Lý Hný Iý I<½I2@`l@€L@I Àq@J ÿ ý I Lý Imý Jý J<½J$@À^@€H@J €e@K ÿ ý J Lý Jlý K ý K<½K @˜¥@ðs@K ¨@L ÿ ý K Lý Kjý Kký L!ý L<½L1@èŠ@ g@L h@M ÿ ý L Lý Lhý Liý M"ý M<½M @@‘@j@M €”@N ÿ ý M Lý Mfý Mgý N#ý N<½N,@È€@€K@N €‚@O ÿ ý N Lý Neý O$ý O<½O$@€@€K@O È@P ÿ ý O Lý Odý P%ý P<½P$@Ü’@€r@P |—@Q ÿ ý P Lý Pcý PŸý Q&ý QÚ½Q$@7À@ì•@Q €ôÂ@R ÿ ý Q Lý Qaý Qbý R'ý RѽR,@?Ì™@R Ì™@S ÿ ý R Lý R“ý R’ý S(ý SѽS*@Z@ÀU@S àg@T ÿ ý S Lý S`ý T)ý TÒý T¬½T@+Ð@|¤@T ÀºÒ@U ÿ ý T Lý T_ý U*ý UÒý UܽU´@0‰@U 5·@Y ÿ ý U Lý U^ý U]ý VÌý VÒý VÜý WÍý WÒý WÜý XÎý XÒý XÜý Y+ý YÑý Yœ½Y8@`@ m@Y ‡@Z ÿ ý Y Lý Y\ý Z,ý ZÑý Zœ½Z€2Æ@Z €2Æ@[ ÿ ý Z Lý Z”ý Z•ý [-ý [ѽ[5@a@€X@[ @m@\ ÿ ý [ Lý [[ý \.ý \Òý \ݽ\ @`@ào@\ ¬’@] ÿ ý \ Lý \Xý \Yý ]/ý ]Òý ]ݽ] @h’@0z@] ô˜@^ ÿ ý ] Lý ]Vý ]Wý ^0ý ^<½^$@L›@w@^ ˆ @_ ÿ ý ^ Lý ^Uý _1ý _:½_@?€—@@P@_ „˜@` ÿ ý _ Lý _–×DSl———sssssssss{s***‰ss`ÿaÿbÿcÿdÿeÿfÿý `2ý `9ý `œ½`@?ô£@„@` ©@a ÿ ý ` Lý `–ý a3ý a:½a,@?p‡@€[@a àŠ@b ÿ ý a Lý a—ý b4ý b:½b@h•@b h•@c ÿ ý b Lý bRý bZý c§ý c:~ c8@~ c@Z@c @Z@d ÿ ý d5ý dÑý dœ½d @?`u@d `u@e ÿ ý d Lý d˜ý d“ý e6ý e;½e @? z@e  z@f ÿ ý e Lý e–ý f7ý f;½f@?P†@f P†@ ÿ ý f Lý f–×µxs{W‰m>¶@A à!@ÿ?666ï7ggÿÿÿÿDœ&œ‹‹P | ÍÉ çw  dü©ñÒMbP?_*+‚€%ÿÁƒ„¡"ÿPà?à?U>¶@ï7ggÿÿÿÿDœ&œ‹‹ | ÍÉ Gy  dü©ñÒMbP?_*+‚€%ÿÁƒ„¡"ÿà?à?U>¶@ï7ggÿÿÿÿDœ&œ‹‹ þÿà…ŸòùOh«‘+'³Ù0¸@Hd€ ˜ ¤°äBjarni KristjanssonBjarni KristjanssonMicrosoft Excel@Sðü|NÊ@è*©sÊþÿÕÍÕœ.“—+,ù®0ì PXx €ˆ˜   ÉäMaximal Software, Inc.' Sheet1Sheet2Sheet3  Worksheets  !"#$%&'()*+,-./0123456789:;<þÿÿÿ>?@ABCDþÿÿÿFGHIJKLþÿÿÿýÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ ÀFþÿÿÿWorkbookÿÿÿÿÿÿÿÿÿÿÿÿïySummaryInformation(ÿÿÿÿ=DocumentSummaryInformation8ÿÿÿÿÿÿÿÿÿÿÿÿECoinMP-1.8.3/Cbc/doc/0000755000175000017500000000000012600453456012555 5ustar renereneCoinMP-1.8.3/Cbc/doc/moresamples.xml0000644000175000017500000001016710235673241015631 0ustar renerene More Samples
    CBC's Samples Directory The CBC distribution includes a number of .cpp sample files. Users are encouraged to use them as starting points for their own CBC projects. The files can be found in the &cbcsamplesdir; directory. For the latest information on compiling and running these samples, please see the file &cbcsamplesdir;INSTALL. Most of them can be built by make DRIVER=name which produces an executable testit. Below is a list of some of the most useful sample files with a short description for each file. Basic Samples Source file        Description &minimumcpp; This is a CBC "Hello, world" program. It reads a problem in MPS file format, and solves the problem using simple branch-and-bound. &sample2cpp; This is designed to be a file that a user could modify to get a useful driver program for his or her project. In particular, it demonstrates the use of CGL's preprocess functionality. It uses CbcBranchUser.cpp, CbcCompareUser.cpp and CbcHeuristicUser.cpp with corresponding *.hpp files.
    Advanced Samples Source file        Description &crewcpp; This sample shows the use of advanced branching and a use of priorities. It uses CbcCompareUser.cpp with corresponding *.hpp files. &longthincpp; This sample shows the advanced use of a solver. It also has coding for a greedy heuristic. The solver is given in CbcSolver2.hpp and CbcSolver2.cpp. The heuristic is given in CbcHeuristicGreedy.hpp and CbcHeuristicGreedy.cpp. It uses CbcBranchUser.cpp and CbcCompareUser.cpp with corresponding *.hpp files. &qmipcpp; This solves a quadratic MIP. It is to show advanced use of a solver. The solver is given in ClpQuadInterface.hpp and ClpQuadInterface.cpp. It uses CbcBranchUser.cpp and CbcCompareUser.cpp with corresponding *.hpp files. &soscpp; This artificially creates a Special Ordered Set problem. &lotsizecpp; This artificially creates a Lot Sizing problem.
    CoinMP-1.8.3/Cbc/doc/doxygen.xml0000644000175000017500000000121410220363301014733 0ustar renerene Doxygen There is Doxygen content for CBC available online at http://www.coin-or.org/Doxygen/Cbc/index.html. A local version of the Doxygen content can be generated from the CBC distribution. To do so, in the directory COIN/Cbc, enter make doc. The Doxygen content will be created in the directory COIN/Cbc/Doc/html. The same can be done for the COIN core, from the COIN/Coin directory. CoinMP-1.8.3/Cbc/doc/messages.xml0000644000175000017500000003655510235446252015122 0ustar renerene Messages Messages and codes passed by CBC are listed in the tables below. For a complete list, see COIN/Cbc/CbcMessages.cpp. The notation used is the same as for the printf in the C programming language. %s is a string %d is an integer %g or %f is a floating point value There are several log levels. Setting the log level to be i produces the log messages for level i and all levels less than i. Logging Level 0: Switches off all CBC messages, but one. Logging Level 1: The default. Logging Level 2: Substantial amount of information, e.g., message 15 is generated once per node. Can be useful when the evaluation at each node is slow. Logging Level 3: Tremendous amount of information, e.g., multiple messages per node. CBC Messages Passed At Logging Level 0 Code Text and notes 3007 No integer variables - nothing to do
    CBC Messages Passed At or Above Logging Level 1 Code Text and notes 1 Search completed - best objective %g, took %d iterations and %d nodes 3 Exiting on maximum nodes 4 Integer solution of %g found after %d iterations and %d nodes 5 Partial search - best objective %g (best possible %g), took %d iterations and %d nodes 6 The LP relaxation is infeasible or too expensive 9 Objective coefficients multiple of %g 10 After %d nodes, %d on tree, %g best solution, best possible %g 11 Exiting as integer gap of %g less than %g or %g%% 12 Integer solution of %g found by heuristic after %d iterations and %d nodes 13 At root node, %d cuts changed objective from %g to %g in %d passes 14 Cut generator %d (%s) - %d row cuts (%d active), %d column cuts %? in %g seconds - new frequency is %d 16 Integer solution of %g found by strong branching after %d iterations and %d nodes 17 %d solved, %d variables fixed, %d tightened 18 After tightenVubs, %d variables fixed, %d tightened 19 Exiting on maximum solutions 20 Exiting on maximum time 23 Cutoff set to %g - equivalent to best solution of %g 24 Integer solution of %g found by subtree after %d iterations and %d nodes 26 Setting priorities for objects %d to %d inclusive (out of %d) 3008 Strong branching is fixing too many variables, too expensively!
    CBC Messages Passed At or Above Logging Level 2 Code Text and notes 8 %d has value %g 15 Node %d Obj %g Unsat %d depth %d 21 On closer inspection node is infeasible 22 On closer inspection objective value of %g above cutoff of %g 23 Allowing solution, even though largest row infeasibility is %g
    CBC Messages Passed At or Above Logging Level 3 Code Text and notes 7 Strong branching on %d (%d), down %g (%d) up %g (%d) value %g 25 %d cleanup iterations before strong branching
    CoinMP-1.8.3/Cbc/doc/otherclasses.xml0000644000175000017500000010637410235673241016007 0ustar renerene Selecting the Next Node in the Search Tree
    CbcCompare - Comparison Methods The order in which the nodes of the search tree are explored can strongly influence the performance of branch-and-cut algorithms. CBC give users complete control over the search order. The search order is controlled via the CbcCompare... class. CBC provides an abstract base class, CbcCompareBase, and several commonly used instances which are described in . Compare Classes Provided Class name Description CbcCompareDepth This will always choose the node deepest in tree. It gives minimum tree size but may take a long time to find the best solution. CbcCompareObjective This will always choose the node with the best objective value. This may give a very large tree. It is likely that the first solution found will be the best and the search should finish soon after the first solution is found. CbcCompareDefault This is designed to do a mostly depth-first search until a solution has been found. It then use estimates that are designed to give a slightly better solution. If a reasonable number of nodes have been explored (or a reasonable number of solutions found), then this class will adopt a breadth-first search (i.e., making a comparison based strictly on objective function values) unless the tree is very large when it will revert to depth-first search. A better description of CbcCompareUser is given below. CbcCompareEstimate When pseudo costs are invoked, they can be used to guess a solution. This class uses the guessed solution.
    It is relatively simple for an experienced user to create new compare class instances. The code in describes how to build a new comparison class and the reasoning behind it. The complete source can be found in CbcCompareUser.hpp and CbcCompareUser.cpp, located in the CBC Samples directory. See . The key method in CbcCompare is bool test(CbcNode* x, CbcNode* y)) which returns true if node y is preferred over node x. In the test() method, information from CbcNode can easily be used. list some commonly used methods to access information at a node. Information Available from <classname>CbcNode</classname> double objectiveValue() const Value of objective at the node. int numberUnsatisfied() const Number of unsatisfied integers (assuming branching object is an integer - otherwise it might be number of unsatisfied sets). int depth() const Depth of the node in the search tree. double guessedObjectiveValue() const If user was setting this (e.g., if using pseudo costs). int way() const The way which branching would next occur from this node (for more advanced use). int variable() const The branching "variable" (associated with the CbcBranchingObject -- for more advanced use).
    The node desired in the tree is often a function of the how the search is progressing. In the design of CBC, there is no information on the state of the tree. The CBC is designed so that the method newSolution() is called whenever a solution is found and the method every1000Nodes() is called every 1000 nodes. When these methods are called, the user has the opportunity to modify the behavior of test() by adjusting their common variables (e.g., weight_). Because CbcNode has a pointer to the model, the user can also influence the search through actions such as changing the maximum time CBC is allowed, once a solution has been found (e.g., CbcModel::setMaximumSeconds(double value)). In CbcCompareUser.cpp of the COIN/Cbc/Samples directory, four items of data are used. 1) The number of solutions found so far 2) The size of the tree (defined to be the number of active nodes) 3) A weight, weight_, which is initialized to -1.0 4) A saved value of weight, saveWeight_ (for when weight is set back to -1.0 for special reason) The full code for the CbcCompareUser::test() method is given in . <function>CbcCompareUser::test()</function> numberUnsatisfied() > y->numberUnsatisfied()) return true; else if (x->numberUnsatisfied() < y->numberUnsatisfied()) return false; else return x->depth() < y->depth(); } else { // after solution. // note: if weight_=0, comparison is based // solely on objective value double weight = CoinMax(weight_,0.0); return x->objectiveValue()+ weight*x->numberUnsatisfied() > y->objectiveValue() + weight*y->numberUnsatisfied(); } } ]]> Initially, weight_ is -1.0 and the search is biased towards depth first. In fact, test() prefers y if y has fewer unsatisfied variables. In the case of a tie, test() prefers the node with the greater depth in tree. Once a solution is found, newSolution() is called. The method newSolution() interacts with test() by means of the variable weight_. If the solution was achieved by branching, a calculation is made to determine the cost per unsatisfied integer variable to go from the continuous solution to an integer solution. The variable weight_ is then set to aim at a slightly better solution. From then on, test() returns true if it seems that y will lead to a better solution than x. This source for newSolution() in given in . <function>CbcCompareUser::newSolution()</function> getSolutionCount()==model->getNumberHeuristicSolutions()) return; // solution was found by rounding so ignore it. // set weight_ to get close to this solution double costPerInteger = (model->getObjValue()-objectiveAtContinuous)/ ((double) numberInfeasibilitiesAtContinuous); weight_ = 0.98*costPerInteger; saveWeight_=weight_; numberSolutions_++; if (numberSolutions_>5) weight_ =0.0; // comparison in test() will be // based strictly on objective value. } ]]> As the search progresses, the comparison can be modified. If many nodes (or many solutions) have been genereated, then weight_ is set to 0.0 leading to a breadth-first search. Breadth-first search can lead to an enormous tree. If the tree size is exceeds 10000, it may be desirable to return to a search biased towards depth first. Changing the behavior in this manner is done by the method every1000Nodes shown in . <function>CbcCompareUser::every1000Nodes()</function> 10000) weight_ =0.0; // compare nodes based on objective value else if (numberNodes==1000&&weight_==-2.0) weight_=-1.0; // Go to depth first // get size of tree treeSize_ = model->tree()->size(); if (treeSize_>10000) { // set weight to reduce size most of time if (treeSize_>20000) weight_=-1.0; else if ((numberNodes%4000)!=0) weight_=-1.0; else weight_=saveWeight_; } return numberNodes==11000; // resort if first time } ]]>
    Getting Good Bounds in CBC
    CbcHeuristic - Heuristic Methods In practice, it is very useful to get a good solution reasonably fast. Any MIP-feasible solution produces an upper bound, and a good bound will greatly reduce the run time. Good solutions can satisfy the user on very large problems where a complete search is impossible. Obviously, heuristics are problem dependent, although some do have more general use. At present there is only one heuristic in CBC itself, CbcRounding. Hopefully, the number will grow. Other heuristics are in the COIN/Cbc/Samples directory. A heuristic tries to obtain a solution to the original problem so it only needs to consider the original rows and does not have to use the current bounds. CBC provides an abstract base class CbcHeuristic and a rounding heuristic in CBC. This chapter describes how to build a greedy heuristic for a set covering problem, e.g., the miplib problem fast0507. A more general (and efficient) version of the heuristic is in CbcHeuristicGreedy.hpp and CbcHeuristicGreedy.cpp located in the COIN/Cbc/Samples directory, see . The greedy heuristic will leave all variables taking value one at this node of the tree at value one, and will initially set all other variable to value zero. All variables are then sorted in order of their cost divided by the number of entries in rows which are not yet covered. (We may randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic.) The best one is choosen, and set to one. The process is repeated. Because this is a set covering problem (i.e., all constraints are ≥), the heuristic is guaranteed to find a solution (but not necessarily an improved solution). The speed of the heuristic could be improved by just redoing those affected, but for illustrative purposes we will keep it simple.(The speed could also be improved if all elements are 1.0). The key CbcHeuristic method is int solution(double & solutionValue, double * betterSolution). The solution() method returns 0 if no solution found, and returns 1 if a solution is found, in which case it fills in the objective value and primal solution. The code in CbcHeuristicGreedy.cpp is a little more complicated than this following example. For instance, the code here assumes all variables are integer. The important bit of data is a copy of the matrix (stored by column) before any cuts have been made. The data used are bounds, objective and the matrix plus two work arrays. Data solver(); // Get solver from CbcModel const double * columnLower = solver->getColLower(); // Column Bounds const double * columnUpper = solver->getColUpper(); const double * rowLower = solver->getRowLower(); // We know we only need lower bounds const double * solution = solver->getColSolution(); const double * objective = solver->getObjCoefficients(); // In code we also use min/max double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance,primalTolerance); int numberRows = originalNumberRows_; // This is number of rows when matrix was passed in // Column copy of matrix (before cuts) const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Get solution array for heuristic solution int numberColumns = solver->getNumCols(); double * newSolution = new double [numberColumns]; // And to sum row activities double * rowActivity = new double[numberRows]; ]]> The newSolution is then initialized to the rounded down solution. Initialize <varname>newSolution</varname> At this point some row activities may be below their lower bound. To correct this infeasibility, the variable which is cheapest in reducing the sum of infeasibilities is found and updated, and the process repeats. This is a finite process. (Theimplementation could be faster, but is kept simple for illustrative purposes.) Create Feasible <varname>newSolution</varname> from Initial <varname>newSolution</varname> 1.0e-7) { sum += CoinMin(element[j],gap); if (element[j]+rowActivity[iRow]0.0) { double ratio = (cost/sum)*(1.0+0.1*CoinDrand48()); if (ratio A solution value of newSolution is compared to the best solution value. If newSolution is an improvement, its feasibility is validated. Check Solution Quality of <varname>newSolution</varname>
    Branching
    Pseudo Cost Branching If the user declares variables as integer but does no more, then CBC will treat them as simple integer variables. In many cases the user would like to do some more fine tuning. This section shows how to create integer variables with pseudo costs. When pseudo costs are given then it is assumed that if a variable is at 1.3 then the cost of branching that variable down will be 0.3 times the down pseudo cost and the cost of branching up would be 0.7 times the up pseudo cost. Pseudo costs can be used both for branching and for choosing a node. The full code is in longthin.cpp located in the CBC Samples directory, see . The idea is simple for set covering problems. Branching up gets us much closer to an integer solution so we will encourage that direction by branch up if variable value > 0.333333. The expected cost of going up obviously depends on the cost of the variable. The pseudo costs are choosen to reflect that fact. <classname>CbcSimpleIntegerPseudoCosts</classname> getNumCols(); // do pseudo costs CbcObject ** objects = new CbcObject * [numberColumns]; // Point to objective const double * objective = model.getObjCoefficients(); int numberIntegers=0; for (iColumn=0;iColumnisInteger(iColumn)) { double cost = objective[iColumn]; CbcSimpleIntegerPseudoCost * newObject = new CbcSimpleIntegerPseudoCost(&model,numberIntegers,iColumn, 2.0*cost,cost); newObject->setMethod(3); objects[numberIntegers++]= newObject; } } // Now add in objects (they will replace simple integers) model.addObjects(numberIntegers,objects); for (iColumn=0;iColumn The code in also tries to give more importance to variables with more coefficients. Whether this sort of thing is worthwhile should be the subject of experimentation.
    Follow-On Branching In crew scheduling, the problems are long and thin. A problem may have a few rows but many thousands of variables. Branching a variable to 1 is very powerful as it fixes many other variables to zero, but branching to zero is very weak as thousands of variables can increase from zero. In crew scheduling problems, each constraint is a flight leg, e.g., JFK airport to DFW airport. From DFW there may be several flights the crew could take next - suppose one flight is the 9:30 flight from DFW to LAX airport. A binary branch is that the crew arriving at DFW either take the 9:30 flight to LAX or they don't. This "follow-on" branching does not fix individual variables. Instead this branching divides all the variables with entries in the JFK-DFW constraint into two groups - those with entries in the DFW-LAX constraint and those without entries. The full sample code for follow-on brancing is in crew.cpp located in the CBC Samples directory, see ). In this case, the simple integer variables are left which may be necessary if other sorts of constraints exist. Follow-on branching rules are to be considered first, so the priorities are set to indicated the follow-on rules take precedence. Priority 1 is the highest priority. <classname>CbcFollowOn</classname> getNumCols(); /* We are going to add a single follow-on object but we want to give low priority to existing integers As the default priority is 1000 we don't actually need to give integer priorities but it is here to show how. */ // Normal integer priorities int * priority = new int [numberColumns]; int numberIntegers=0; for (iColumn=0;iColumnisInteger(iColumn)) { priority[numberIntegers++]= 100; // low priority } } /* Second parameter is set to true for objects, and false for integers. This indicates integers */ model.passInPriorities(priority,false); delete [] priority; /* Add in objects before we can give them a priority. In this case just one object - but it shows the general method */ CbcObject ** objects = new CbcObject * [1]; objects[0]=new CbcFollowOn(&model); model.addObjects(1,objects); delete objects[0]; delete [] objects; // High priority int followPriority=1; model.passInPriorities(&followPriority,true); ]]>
    Advance Solver Uses
    Creating a Solver via Inheritance CBC uses a generic OsiSolverInterface and its resolve capability. This does not give much flexibility so advanced users can inherit from their interface of choice. This section illustrates how to implement such a solver for a long thin problem, e.g., fast0507 again. As with the other examples in the Guide, the sample code is not guaranteed to be the fastest way to solve the problem. The main purpose of the example is to illustrate techniques. The full source is in CbcSolver2.hpp and CbcSolver2.cpp located in the CBC Samples directory, see . The method initialSolve is called a few times in CBC, and provides a convenient starting point. The modelPtr_ derives from OsiClpSolverInterface. <function>initialSolve()</function> setLogLevel(1); // switch on a bit of printout modelPtr_->scaling(0); // We don't want scaling for fast0507 setBasis(basis_,modelPtr_); // Put basis into ClpSimplex // Do long thin by sprint ClpSolve options; options.setSolveType(ClpSolve::usePrimalorSprint); options.setPresolveType(ClpSolve::presolveOff); options.setSpecialOption(1,3,15); // Do 15 sprint iterations modelPtr_->initialSolve(options); // solve problem basis_ = getBasis(modelPtr_); // save basis modelPtr_->setLogLevel(0); // switch off printout ]]> The resolve() method is more complicated than initialSolve(). The main pieces of data are a counter count_ which is incremented each solve and an integer array node_ which stores the last time a variable was active in a solution. For the first few times, the normal Dual Simplex is called and node_ array is updated. First Few Solves status()==0) { count_++; // feasible - save any nonzero or basic const double * solution = modelPtr_->primalColumnSolution(); for (int i=0;i1.0e-6||modelPtr_->getStatus(i)==ClpSimplex::basic) { node_[i]=CoinMax(count_,node_[i]); howMany_[i]++; } } } else { printf("infeasible early on\n"); } } ]]> After the first few solves, only those variables which took part in a solution in the last so many solves are used. As fast0507 is a set covering problem, any rows which are already covered can be taken out. Create Small Problem columnLower(); const double * upper = modelPtr_->columnUpper(); setBasis(basis_,modelPtr_); // Set basis int nNewCol=0; // Number of columns in small model // Column copy of matrix const double * element = modelPtr_->matrix()->getElements(); const int * row = modelPtr_->matrix()->getIndices(); const CoinBigIndex * columnStart = modelPtr_->matrix()->getVectorStarts(); const int * columnLength = modelPtr_->matrix()->getVectorLengths(); int * rowActivity = new int[numberRows]; // Number of columns with entries in each row memset(rowActivity,0,numberRows*sizeof(int)); int * rowActivity2 = new int[numberRows]; // Lower bound on row activity for each row memset(rowActivity2,0,numberRows*sizeof(int)); char * mark = (char *) modelPtr_->dualColumnSolution(); // Get some space to mark columns memset(mark,0,numberColumns); for (i=0;icount_-memory_&&node_[i]>0); // Choose if used recently // Take if used recently or active in some sense if ((choose&&upper[i]) ||(modelPtr_->getStatus(i)!=ClpSimplex::atLowerBound&& modelPtr_->getStatus(i)!=ClpSimplex::isFixed) ||lower[i]>0.0) { mark[i]=1; // mark as used whichColumn[nNewCol++]=i; // add to list CoinBigIndex j; double value = upper[i]; if (value) { for (j=columnStart[i]; j0.0) { for (j=columnStart[i]; jsetRowStatus(i,ClpSimplex::basic); // make slack basic } if (nOKsetProblemStatus(1); delete [] whichRow; delete [] whichColumn; printf("infeasible by inspection\n"); return; } // Now make up a small model with the right rows and columns ClpSimplex * temp = new ClpSimplex(modelPtr_,nNewRow,whichRow,nNewCol,whichColumn); ]]> If the variables cover the rows, then the problem is feasible (no cuts are being used). If the rows were equality constraints, then this might not be the case. More work would be needed. After the solution, the reduct costs are checked. If any reduced costs are negative, the code goes back to the full problem and cleans up with Primal Simplex. Check Optimal Solution setDualObjectiveLimit(1.0e50); // Switch off dual cutoff as problem is restricted temp->dual(); // solve double * solution = modelPtr_->primalColumnSolution(); // put back solution const double * solution2 = temp->primalColumnSolution(); memset(solution,0,numberColumns*sizeof(double)); for (i=0;isetStatus(iColumn,temp->getStatus(i)); } double * rowSolution = modelPtr_->primalRowSolution(); const double * rowSolution2 = temp->primalRowSolution(); double * dual = modelPtr_->dualRowSolution(); const double * dual2 = temp->dualRowSolution(); memset(dual,0,numberRows*sizeof(double)); for (i=0;isetRowStatus(iRow,temp->getRowStatus(i)); rowSolution[iRow]=rowSolution2[i]; dual[iRow]=dual2[i]; } // See if optimal double * dj = modelPtr_->dualColumnSolution(); // get reduced cost for large problem // this assumes minimization memcpy(dj,modelPtr_->objective(),numberColumns*sizeof(double)); modelPtr_->transposeTimes(-1.0,dual,dj); modelPtr_->setObjectiveValue(temp->objectiveValue()); modelPtr_->setProblemStatus(0); int nBad=0; for (i=0;igetStatus(i)==ClpSimplex::atLowerBound &&upper[i]>lower[i]&&dj[i]<-1.0e-5) nBad++; } // If necessary clean up with primal (and save some statistics) if (nBad) { timesBad_++; modelPtr_->primal(1); iterationsBad_ += modelPtr_->numberIterations(); } ]]> The array node_ is updated, as for the first few solves. To give some idea of the effect of this tactic, the problem fast0507 has 63,009 variables but the small problem never has more than 4,000 variables. In only about ten percent of solves was it necessary to resolve, and then the average number of iterations on full problem was less than 20.
    Quadratic MIP To give another example - again only for illustrative purposes -- it is possible to do quadratic MIP with CBC. In this case, we make resolve the same as initialSolve. The full code is in ClpQuadInterface.hpp and ClpQuadInterface.cpp located in the CBC Samples directory, see ). Solving a Quadratic MIP dualObjectiveLimit(); modelPtr_->setDualObjectiveLimit(1.0e50); modelPtr_->scaling(0); modelPtr_->setLogLevel(0); // solve with no objective to get feasible solution setBasis(basis_,modelPtr_); modelPtr_->dual(); basis_ = getBasis(modelPtr_); modelPtr_->setDualObjectiveLimit(cutoff); if (modelPtr_->problemStatus()) return; // problem was infeasible // Now pass in quadratic objective ClpObjective * saveObjective = modelPtr_->objectiveAsObject(); modelPtr_->setObjectivePointer(quadraticObjective_); modelPtr_->primal(); modelPtr_->setDualObjectiveLimit(cutoff); if (modelPtr_->objectiveValue()>cutoff) modelPtr_->setProblemStatus(1); modelPtr_->setObjectivePointer(saveObjective); ]]>
    CoinMP-1.8.3/Cbc/doc/osibuild.xml0000644000175000017500000000033710220363301015075 0ustar renerene Building and Modifying a Model
    CoinModel
    CoinMP-1.8.3/Cbc/doc/cbcexe.xml0000644000175000017500000002067610220363301014524 0ustar renerene The CLP Executable
    Quick Start The result of make unitTest (executed in COIN/Clp) is an executable clp as well as the CLP and COIN libraries. The executable can be used to perform various unit tests, but can also be used as a standalone solver. As the executable has a very simple solution file format, the user may wish to modify COIN/Clp/Test/ClpMain.cpp, which contains the source of the executable (modifications could even be offered as a contribution to CLP). The clp executable operates in command line mode or prompted mode. Entering clp will invoke the prompted mode, while clp <filename> will import a problem in MPS format from filename, solve it using the dual simplex method and exit. The command clp <filename> -primalsimplex instructs the executable tp import a file and solve using the primal simplex method. An additional solitary dash ("-") starts the prompt mode once the execution of the initial command has been completed. The "-" is necessary as part of the command; invoking prompt mode as a separate command will result in the loss of problem information related to the initial command. So, the following sequences of commands are equivalent in the sense that both maximize a problem using the dual simplex method and write a solution to file: solfile:
    $ clp filename -maximize -dualsimplex -solution solfile
    $ clp filename -maximize - Clp:duals Clp:solution solfile Clp:quit
    The executable is at a very early stage of development. Comments and suggestions would be appreciated.
    Online Help and Basic Usage The executable has some command-completion functionality as well as some online help. Below is a table with some examples which summarize these capabilities. Command examples for the clp executable Command     Result ? Gives a list of all commands p? Gives a list of all commands which begin with <p>. p?? Gives a list of all commands which begin with <p>., with a short explanation for each. primals?? If is this is enough to uniquely determine a command (in this example, primalS, for primal simplex), a long explanation is given.
    In addition, matching a name without a ? will either execute the command or give the value of the corresponding parameter as follows: primalw will give the current value of the primalWeight parameter while primalw 1.0e7 will change it to 1.0e7.
    A Sample Session Below is a sample CLP executable prompt-mode session. A small problem is loaded and solved under various conditions with the primal and dual simplex methods. Note the use of the allslack command; it sets the basis to all slacks and resets the solution. $clp Coin LP version 0.99.9, build Sep 14 2004 Clp takes input from arguments ( - switches to stdin) Enter ? for list of commands or help Clp:import../Mps/Sample/p0033.mps At line 15 NAME P0033 At line 16 ROWS At line 34 COLUMNS At line 109 RHS At line 118 BOUNDS At line 152 ENDATA Problem P0033 has 16 rows, 33 columns and 98 elements Model was imported from ./../Mps/Sample/p0033.mps in 0 seconds Clp:primals Presolve 15 (-1) rows, 32 (-1) columns and 97 (-1) elements 0 Obj 0 Primal inf 27.2175 (10) Dual inf 6.42094e+11 (32) 32 Obj 2520.57 Optimal - objective value 2520.57 After Postsolve, objective 2520.57, infeasibilities - dual 0 (0), primal 0 (0) Optimal objective 2520.571739 - 32 iterations time 0.012, Presolve 0.01 Clp:max Clp:primals Presolve 11 (-5) rows, 25 (-8) columns and 84 (-14) elements 0 Obj 4807.92 Dual inf 1700.71 (15) End of values pass after 2 iterations 2 Obj 4921.7 Dual inf 580.637 (5) 9 Obj 5299.7 Optimal - objective value 5299.7 After Postsolve, objective 5299.7, infeasibilities - dual 643.608 (9), primal 27.0826 (10) Presolved model was optimal, full model needs cleaning up 0 Obj 5299.7 0 Obj 5299.7 Optimal - objective value 5299.7 Optimal objective 5299.698868 - 9 iterations time 0.022, Presolve 0.02 Clp:allslack Clp:duals Presolve 11 (-5) rows, 25 (-8) columns and 84 (-14) elements 0 Obj 2752 Primal inf 24.4867 (6) Dual inf 4280.55 (25) 8 Obj 5299.7 Optimal - objective value 5299.7 After Postsolve, objective 5299.7, infeasibilities - dual 704.58 (8), primal 27.0792 (10) Presolved model was optimal, full model needs cleaning up 0 Obj 5299.7 0 Obj 5299.7 Optimal - objective value 5299.7 Optimal objective 5299.698868 - 8 iterations time 0.032, Presolve 0.01 Clp:min Clp:duals Presolve 15 (-1) rows, 32 (-1) columns and 97 (-1) elements 0 Obj 5299.7 Dual inf 4632.26 (28) 16 Obj 2520.57 Optimal - objective value 2520.57 After Postsolve, objective 2520.57, infeasibilities - dual 2052.5 (13), primal 27.1143 (10) Presolved model was optimal, full model needs cleaning up 0 Obj 2520.57 0 Obj 2520.57 Optimal - objective value 2520.57 Optimal objective 2520.571739 - 16 iterations time 0.012, Presolve 0.01 Clp:allslack Clp:presolve off Clp:primals 0 Obj 0 Primal inf 27.2175 (10) Dual inf 6.39167e+11 (32) 32 Obj 2520.57 Optimal - objective value 2520.57 Optimal objective 2520.571739 - 32 iterations time 0.002 Clp:allslack Clp:maxIt 10 maxIterations was changed from 99999999 to 10 Clp:primals 0 Obj 0 Primal inf 27.2175 (10) Dual inf 6.39167e+11 (32) Stopped - objective value 4.24664e+10 Stopped objective 4.246637759e+10 - 10 iterations time 0.002 Clp:quit
    CoinMP-1.8.3/Cbc/doc/legal.xml0000644000175000017500000000164111507203260014354 0ustar renerene 2005 IBM Coportation CBC and this documentation are provided under the terms of the Eclipse Public License (EPL). Any use, reproduction or distribution of the programs constitutes the recipient's acceptance of the license. The EPL is approved by the Open Source Initiative. The Eclipse Foundation, the steward of the EPL, has an EPL FAQ available which is based on the Eclipse Foundation's understanding of the EPL. CoinMP-1.8.3/Cbc/doc/faq.xml0000644000175000017500000000022410220363301014025 0ustar renerene FAQ &faqcontent; CoinMP-1.8.3/Cbc/doc/intro.xml0000644000175000017500000002375310235673241014442 0ustar renerene Introduction
    Welcome to CBC The COIN The complete acronym is "COIN-OR" which stands for the Compuational Infrastructure for Operations Research. For simplicity (and in keeping with the directory and function names) we will simply use "COIN". Branch and Cut solver (CBC) is an open-source mixed-integer program (MIP) solver written in C++. CBC is intended to be used primarily as a callable library to create customized branch-and-cut solvers. A basic, stand-alone executable version is also available. CBC is an active open-source project led by John Forrest at www.coin-or.org.
    Prerequisites The primary users of CBC are expected to be developers implementing customized branch-and-cut algorithms in C++ using CBC as a library. Consequently, this document assumes a working knowledge of C++, including basic object-oriented programming terminology, and familiarity with the fundamental concepts of linear programming and mixed integer programming. CBC relies other parts of the COIN repository. CBC needs an LP solver and relies the COIN Open Solver Inteface (OSI) to communicate with the user's choice of solver. Any LP solver with an OSI interface can be used with CBC. The LP solver expected to be used most commonly is COIN's native linear program solver, CLP. For cut generators, CBC relies on the COIN Cut Generation Library (CGL). Any cut generator written to CGL standards can be used with CBC. Some of the cut generators in CGL rely on other parts of COIN, e.g., CGL's Gomory cut generator rely on the factorization functionality of CoinFactorization. This document assumes basic familiarity with OSI and CGL. Technically speaking, CBC assesses the solver (and sometime the model and data it contains) through an OSISolverInterface. For the sake of simplicity, we will refer to the OsiSolverInterface as "the solver" in this document, rather than "the standard application programming interface to the solver." We hope any confusion caused by blurring this distinction will be mitigated by the shorter sentences. In summary, readers should have the following prerequisites: C++ knowledge, LP and MIP fundamentals, and OSI familiarity. Unless otherwise stated, we will assume the problem being optimized is a minimization problem. The terms "model" and "problem" are used synonymously.
    Branch-and-Cut Overview Before examining CBC in more detail, we tersely describe the basic branch-and-cut algorithm by way of example, (which should really be called branch-and-cut-and-bound) and show the major C++ class(es) in CBC related to each step. The major CBC classes, labeled (A) through (F), are described in . Step 1. (Bound) Given a MIP model to minimize where some variables must take on integer values (e.g., 0, 1, or 2), relax the integrality requirements (e.g., consider each "integer" variable to be continuous with a lower bound of 0.0 and an upper bound of 2.0). Solve the resulting linear model with an LP solver to obtain a lower bound on the MIP's objective function value. If the optimal LP solution has integer values for the MIP's integer variables, we are finished. Any MIP-feasible solution provides an upper bound on the objective value. The upper bound equals the lower bound; the solution is optimal. Step 2. (Branch) Otherwise, there exists an "integer" variable with a non-integral value. Choose one non-integral variable (e.g., with value 1.3) (A)(B) and branch. Create two nodes, one with the branching variable having an upper bound of 1.0, and the other with the branching variable having a lower bound of 2.0. Add the two nodes to the search tree. While (search tree is not empty) { Step 3. (Choose Node) Pick a node off the tree (C)(D) Step 4. (Re-optimize LP) Create an LP relaxation and solve. Step 5. (Bound) Interrogate the optimal LP solution, and try to prune the node by one of the following. LP is infeasible, prune the node. Else, the optimal LP solution value of the node exceeds the current upper bound, prune the node. Else, the optimal LP solution of the node does not exceed the current upper bound and the solution is feasible to the MIP. Update the upper bound, and the best known MIP solution, and prune the node by optimality. Step 6. (Branch) If we were unable to prune the node, then branch. Choose one non-integral variable to branch on (A)(B). Create two nodes and add them to the search tree. } This is the outline of a "branch-and-bound" algorithm. If in optimizing the linear programs, we use cuts to tighten the LP relaxations (E)(F), then we have a "branch-and-cut" algorithm. (Note, if cuts are only used in Step 1, the method is called a "cut-and-branch" algorithm.) Associated Classes Note Class name Description (A) CbcBranch... These classes define the nature of MIP's discontinuity. The simplest discontinuity is a variable which must take an integral value. Other types of discontinuities exist, e.g., lot-sizing variables. (B) CbcNode This class decides which variable/entity to branch on next. Even advanced users will probably only interact with this class by setting CbcModel parameters ( e.g., priorities). (C) CbcTree All unsolved models can be thought of as being nodes on a tree where each node (model) can branch two or more times. The user should not need to be concerned with this class. (D) CbcCompare... These classes are used in determine which of the unexplored nodes in the tree to consider next. These classes are very small simple classes that can be tailored to suit the problem. (E) CglCutGenerators Any cut generator from CGL can be used in CBC. The cut generators are passed to CBC with parameters which modify when each generator will be tried. All cut generators should be tried to determine which are effective. Few users will write their own cut generators. (F) CbcHeuristics Heuristics are very important for obtaining valid solutions quickly. Some heuristics are available, but this is an area where it is useful and interesting to write specialized ones.
    There are a number of resources available to help new CBC users get started. This document is designed to be used in conjunction with the files in the Samples subdirectory of the main CBC directory (COIN/Cbc/Samples). The Samples illustrate how to use CBC and may also serve as useful starting points for user projects. In the event that either this document or the available Doxygen content conflicts with the observed behavior of the source code, the comments in the header files, found in COIN/Cbc/include, are the ultimate reference.
    CoinMP-1.8.3/Cbc/doc/revhist.xml0000644000175000017500000000127610235507566014775 0ustar renerene Revision History 0.2 May 2, 2005 RLH Book chapter for CBC Tutorial at INFORMS 2005 annual meeting. Reorganized the content. Added CBC Messages. Changed the font type to distinguish functions/variables/classnames/code from text. 0.1 April 1, 2005 JF First draft. The CBC documenation uses the DocBook CLP documentation created by David de la Nuez. CoinMP-1.8.3/Cbc/doc/faqcontent.xml0000644000175000017500000000733511507203260015440 0ustar renerene What is CBC? The COIN-OR Branch and Cut code is designed to be a high quality mixed integer code provided under the terms of the Eclipse Public License. CBC is written in C++, and is primarily intended to be used as a callable library (though a rudimentary stand-alone executable exists). The first documented release was .90.0 The current release is version .90.0. (JF 04/01/05) What are some of the features of CBC? CBC allows the use of any CGL cuts and the use of heuristics and specialized branching methods. (JF 04/01/05) How do I obtain and install CBC? Please see the COIN-OR FAQ for details on how to obtain and install COIN-OR modules. (JF 04/01/05) Is CBC reliable? CBC has been tested on many problems, but more testing and improvement is needed before it can get to version 1.0. (JF 04/01/05) Is there any documentation for CBC? If you can see this you have the best there is:-) Also available is a list of CBC class descriptions generated by Doxygen. (JF 04/01/05) Is CBC as fast as Cplex or Xpress? No. However its design is much more flexible so advanced users will be able to tailor CBC to their needs. (JF 04/01/05) When will version 1.0 of CBC be available? It is expected that version 1.0 will be released in time for the 2005 INFORMS annual meeting. (JF 04/01/05) What can the community do to help? People from all around the world are already helping. There are probably ten people who do not always post to the discussion mail list but are constantly "improving" the code by demanding performance or bug fixes or enhancements. And there are others posting questions to discussion groups. (JF 04/01/05) A good start is to join the coin-discuss mailing list where CBC is discussed. Some other possibilities include: Comment on the design Give feedback on the documentation and FAQs. Break the code, or better yet -- mend it. Tackle any of the "to-dos" listed in the Doxyen documentation and contribute back to COIN-OR. CoinMP-1.8.3/Cbc/doc/authors.xml0000644000175000017500000000107010235424220014747 0ustar renerene John Forrest jjforre at us dot ibm dot com IBM Research Robin Lougee-Heimer robinlh at us dot ibm dot com IBM Research CoinMP-1.8.3/Cbc/doc/cbcuserguide.xml0000644000175000017500000000352210235507566015751 0ustar renerene sample2.cpp"> crew.cpp"> minimum.cpp"> qmip.cpp"> lotsize.cpp"> sos.cpp"> longthin.cpp"> ]> CBC User Guide &authors; &legal; &intro; &cbcmodelclass; &otherclasses; &moresamples; &messages; &faq; &doxygen; &revhist; CoinMP-1.8.3/Cbc/doc/cbcmodelclass.xml0000644000175000017500000006112010235673241016073 0ustar renerene The CBC Model Class
    Overview The main class in CBC is CbcModel. The CbcModel class is where most of the parameter setting is done. The absolute minimum number of actions taken with CbcModel is two, CbcModel(OsiSolverInterface & linearSolver) as constructor, and branchAndBound() for solving the problem.
    Simple Branch-and-Bound Example The first sample program shows how to perform simple branch-and-bound with CBC. This program is short enough to present in full. Most of the remaining examples will take the form of small code fragments. The complete code for all the examples in this Guide can be found in the CBC Samples directory, COIN/Cbc/Samples. minimum.cpp getNumCols(); const double * solution = model.solver()->getColSolution(); for (int iColumn=0;iColumn1.0e-7&&model.solver()->isInteger(iColumn)) printf("%d has value %g\n",iColumn,value); } return 0; } ]]> The program in creates a OsiClpSolverInterface solver interface (i.e., solver1), and reads an MPS file. If there are no errors, the program passes the problem to CbcModel which solves the problem using the branch-and-bound algorithm. The part of the program which solves the problem is very small (one line!) but before that one line, the LP solver (i.e., solver1) had to be created and populated with the problem. After that one line, the results were printed out.
    The Relationship Between OSI and CBC The program in illustrates the dependency of CBC on the OsiSolverInterface class. The constructor of CbcModel takes a pointer to an OsiSolverInterface (i.e., a solver). The CbcModel clones the solver, and uses its own instance of the solver. The CbcModel's solver and the original solver (e.g., solver1) are not in sync unless the user synchronizes them. The user can always access the CbcModel's solver through the model() method. To synchronize the two solvers, explicitly refreshing the original, e.g., solver1 = model.solver(); CbcModel's method solve() returns a pointer to CBC's cloned solver. For convenience, many of the OSI methods to access problem data have identical method names in CbcModel. (It's just more convenient to type model.getNumCols() rather than model.solver()->getNumCols()). The CbcModel refreshes its solver at certain logical points during the algorithm. At these points, the information from the CbcModel model will match the information from the model.solver(). Elsewhere, the information may vary. For instance, the OSI method getColSolution() will contain the best solution so far, while the CbcModel method may not. In this case, it is safer to use CbcModel::bestSolution(). While all the OSI methods used in minimum.cpp have equivalent methods in CbcModel, there are some OSI methods which do not. For example, if the program produced a lot of undesired output, one might add the line model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); to reduce the output. There is no setHintParam() method in CbcModel.
    Getting Solution Information Optimality can be checked through a call to model.isProvenOptimal(). Also available are isProvenInfeasible(), isSolutionLimitReached(), isNodeLimitReached() or the feared isAbandoned(). There is also int status() which returns 0 if finished (which includes the case when the algorithm is finished because it has been proved infeasible), 1 if stopped by user, and 2 if difficulties arose. In addition to these CbcModel methods, solution values can be accessed via OSI methods. The OSI methods pick up the current solution in the CBCModel. The current solution will match the best solution found so far if called after branchAndBound() and a solution was found. Methods for Getting Solution Information from OSI Purpose Name Notes Primal column solution const double * getColSolution() The OSI method will return the best solution found thus far, unless none has been found. It is safer to use CbcModel version, CbcModel::bestSolution() Dual row solution const double * getRowPrice() Identical CbcModel version available, CbcModel::getRowPrice(). Primal row solution const double * getRowActivity() Identical CbcModel version available, CbcModel::getRowActivity(). Dual column solution const double * getReducedCost() Identical CbcModel version available, CbcModel::gtReducedCost(). Number of rows in model int getNumRows() Identical CbcModel version available, CbcModel::getNumRows(). Note: the number of rows can change due to cuts. Number of columns in model int getNumCols() Identical CbcModel version available, CbcModel::getNumCols().
    Useful Set and Get Methods in <classname>CbcModel</classname> Most of the parameter setting in CBC is done through CbcModel methods. The most commonly used set and get methods are listed in . Useful Set and Get Methods in <classname>CbcModel</classname> Method(s) Description bool setMaximumNodes(int value) int getMaximumNodes() const bool setMaximumSeconds(double value) double getMaximumSeconds() bool setMaximumSolutions(double value) double getMaximumSolutions() const These set methods tell CBC to stop after a given number of nodes, seconds, or solutions is reached. The get methods return the corresponding values. bool setIntegerTolerance(double value) const double getIntegerTolerance() const An integer variable is deemed to be at an integral value if it is no further than this value (tolerance) away. bool setAllowableGap(double value) double getAllowableGap() const bool setAllowablePercentageGap(double value) double getAllowablePercentageGap() const bool setAllowableFractionGap(double value) double getAllowableFractionGap() const CbcModel returns if the gap between the best known solution and the best possible solution is less than this value, or as a percentage, or a fraction. void setNumberStrong(double value) int numberStrong() const These methods set or get the maximum number of candidates at a node to be evaluated for strong branching. void setPrintFrequency(int value) int printFrequency() const Controls the number of nodes evaluated between status prints. Print frequency has a very slight overhead, if value is small. int getNodeCount() const Returns number of nodes evaluated in the search. int numberRowsAtContinuous() const Returns number of rows at continuous int  numberIntegers() const const int * integerVariable() const Returns number of integer variables and an array specifying them. bool isBinary(int colIndex) const bool isContinuous(int colIndex) const bool isInteger(int colIndex) const Returns information on variable colIndex. OSI methods can be used to set these attributes (before handing the model to CbcModel). double getObjValue() const This method returns the best objective value so far. double getCurrentObjValue() const This method returns the current objective value. const double * getObjCoefficients() const This method return the objective coefficients. const double * getRowLower() const const double * getRowUpper() const const double * getColLower() const const double * getColUpper() const These methods return the lower and upper bounds on row and column activities. const CoinPackMatrix * getMatrixByRow() const This method returns a pointer to a row copy of matrix stored as a CoinPackedMatrix which can be further examined. const CoinPackMatrix * getMatrixByCol() const This method returns a pointer to a column copy of matrix stored as a CoinPackedMatrix which can be further examined. CoinBigIndex getNumElements() const CoinBigIndex is a typedef which in most cases is the same as int. Returns the number of nonzero elements in the problem matrix. void setObjSense(double value) double getObjSense() const These methods set and get the objective sense. The parameter value should be +1 to minimize and -1 to maximize.
    Impacting the Solution Process CbcModel is extremely flexible and customizable. The class structure of CBC is designed to make the most commonly desired customizations of branch-and-cut possible. These include: selecting the next node to consider in the search tree, determining which variable to branch on, using heuristics to generate MIP-feasible solutions quickly, including cut generation when solving the LP-relaxations, and invoking customized subproblem solvers. To enable this flexibility, CbcModel uses other classes in CBC (some of which are virtual and may have multiple instances). Not all classes are created equal. The two tables below list in alphabetical order the classes used by CbcModel that are of most interest and of least interest. Classes Used by CbcModel - Most Useful Class name Description Notes CbcCompareBase Controls which node on the tree is selected. The default is CbcCompareDefault. Other comparison classes in CbcCompareActual.hpp include CbcCompareDepth and CbcCompareObjective. Experimenting with these classes and creating new compare classes is easy. CbcCutGenerator A wrapper for CglCutGenerator with additional data to control when the cut generator is invoked during the tree search. Other than knowing how to add a cut generator to CbcModel, there is not much the average user needs to know about this class. However, sophisticated users can implement their own cut generators. CbcHeuristic Heuristic that attempts to generate valid MIP-solutions leading to good upper bounds. Specialized heuristics can dramatically improve branch-and-cut performance. As many different heuristics as desired can be used in CBC. Advanced users should consider implementing custom heuristics when tackling difficult problems. CbcObject Defines what it means for a variable to be satisfied. Used in branching. Virtual class. CBC's concept of branching is based on the idea of an "object". An object has (i) a feasible region, (ii) can be evaluated for infeasibility, (iii) can be branched on, e.g., a method of generating a branching object, which defines an up branch and a down branch, and (iv) allows comparsion of the effect of branching. Instances of objects include CbcSimpleInteger, CbcSimpleIntegerPseudoCosts, CbcClique, CbcSOS (type 1 and 2), CbcFollowOn, and CbcLotsize. OsiSolverInterface Defines the LP solver being used and the LP model. Normally a pointer to the desired OsiSolverInteface is passed to CbcModel before branch and cut. Virtual class. The user instantiates the solver interface of their choice, e.g., OsiClpSolverInterface.
    There is not much about the classes listed in that the average user needs to know about. Classes Used by CbcModel - Least Useful Class name Description Notes CbcBranchDecision Used in choosing which variable to branch on, however, most of the work is done by the definitions in CbcObject. Defaults to CbcBranchDefaultDecision. CbcCountRowCut Interface to OsiRowCut. It counts the usage so cuts can gracefully vanish. See OsiRowCut for more details. CbcNode Controls which variable/entity is selected to be branch on. Controlled via CbcModel parameters. Information from CbcNode can be useful in creating customized node selection rules. CbcNodeInfo Contains data on bounds, basis, etc. for one node of the search tree. Header is located in CbcNode.hpp. CbcTree Defines how the search tree is stored. This class can be changed but it is not likely to be modified. CoinMessageHandler Deals with message handling The user can inherit from CoinMessageHandler to specialize message handling. CoinWarmStartBasis Basis representation to be used by solver
    CoinMP-1.8.3/Cbc/configure0000755000175000017500000420471312600277660013733 0ustar renerene#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for Cbc 2.9.6. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # # Copyright 2006 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package Coin which is distributed # under the Eclipse Public License. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='Cbc' PACKAGE_TARNAME='cbc' PACKAGE_VERSION='2.9.6' PACKAGE_STRING='Cbc 2.9.6' PACKAGE_BUGREPORT='cbc@lists.coin-or.org' ac_unique_file="src/CbcTree.hpp" ac_default_prefix=`pwd` # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os ALWAYS_FALSE_TRUE ALWAYS_FALSE_FALSE have_svnversion CBC_SVN_REV CDEFS ADD_CFLAGS DBG_CFLAGS OPT_CFLAGS sol_cc_compiler CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT COIN_CC_IS_CL_TRUE COIN_CC_IS_CL_FALSE MPICC CXXDEFS ADD_CXXFLAGS DBG_CXXFLAGS OPT_CXXFLAGS CXX CXXFLAGS ac_ct_CXX COIN_CXX_IS_CL_TRUE COIN_CXX_IS_CL_FALSE MPICXX EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOLM4 have_autoconf have_automake have_svn BUILDTOOLSDIR AUX_DIR abs_source_dir abs_lib_dir abs_include_dir abs_bin_dir HAVE_EXTERNALS_TRUE HAVE_EXTERNALS_FALSE host host_cpu host_vendor host_os ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ac_c_preproc_warn_flag ac_cxx_preproc_warn_flag RPATH_FLAGS DEPENDENCY_LINKING_TRUE DEPENDENCY_LINKING_FALSE LT_LDFLAGS PKG_CONFIG ac_ct_PKG_CONFIG COIN_HAS_PKGCONFIG_TRUE COIN_HAS_PKGCONFIG_FALSE COIN_PKG_CONFIG_PATH COIN_PKG_CONFIG_PATH_UNINSTALLED COINDEPEND_LIBS COINDEPEND_CFLAGS COINDEPEND_DATA COINDEPEND_DEPENDENCIES COINDEPEND_LIBS_INSTALLED COINDEPEND_CFLAGS_INSTALLED COINDEPEND_DATA_INSTALLED CBCLIB_CFLAGS CBCLIB_LIBS CBCLIB_PCLIBS CBCLIB_PCREQUIRES CBCLIB_DEPENDENCIES CBCLIB_CFLAGS_INSTALLED CBCLIB_LIBS_INSTALLED CBCGENERIC_CFLAGS CBCGENERIC_LIBS CBCGENERIC_PCLIBS CBCGENERIC_PCREQUIRES CBCGENERIC_DEPENDENCIES CBCGENERIC_CFLAGS_INSTALLED CBCGENERIC_LIBS_INSTALLED COIN_HAS_COINDEPEND_TRUE COIN_HAS_COINDEPEND_FALSE CLP_LIBS CLP_CFLAGS CLP_DATA CLP_DEPENDENCIES CLP_LIBS_INSTALLED CLP_CFLAGS_INSTALLED CLP_DATA_INSTALLED COIN_HAS_CLP_TRUE COIN_HAS_CLP_FALSE OSITESTS_LIBS OSITESTS_CFLAGS OSITESTS_DATA OSITESTS_DEPENDENCIES OSITESTS_LIBS_INSTALLED OSITESTS_CFLAGS_INSTALLED OSITESTS_DATA_INSTALLED COIN_HAS_OSITESTS_TRUE COIN_HAS_OSITESTS_FALSE SAMPLE_LIBS SAMPLE_CFLAGS SAMPLE_DATA SAMPLE_DEPENDENCIES SAMPLE_LIBS_INSTALLED SAMPLE_CFLAGS_INSTALLED SAMPLE_DATA_INSTALLED COIN_HAS_SAMPLE_TRUE COIN_HAS_SAMPLE_FALSE NETLIB_LIBS NETLIB_CFLAGS NETLIB_DATA NETLIB_DEPENDENCIES NETLIB_LIBS_INSTALLED NETLIB_CFLAGS_INSTALLED NETLIB_DATA_INSTALLED COIN_HAS_NETLIB_TRUE COIN_HAS_NETLIB_FALSE MIPLIB3_LIBS MIPLIB3_CFLAGS MIPLIB3_DATA MIPLIB3_DEPENDENCIES MIPLIB3_LIBS_INSTALLED MIPLIB3_CFLAGS_INSTALLED MIPLIB3_DATA_INSTALLED COIN_HAS_MIPLIB3_TRUE COIN_HAS_MIPLIB3_FALSE DYLP_LIBS DYLP_CFLAGS DYLP_DATA DYLP_DEPENDENCIES DYLP_LIBS_INSTALLED DYLP_CFLAGS_INSTALLED DYLP_DATA_INSTALLED COIN_HAS_DYLP_TRUE COIN_HAS_DYLP_FALSE VOL_LIBS VOL_CFLAGS VOL_DATA VOL_DEPENDENCIES VOL_LIBS_INSTALLED VOL_CFLAGS_INSTALLED VOL_DATA_INSTALLED COIN_HAS_VOL_TRUE COIN_HAS_VOL_FALSE CPX_LIBS CPX_CFLAGS CPX_DATA CPX_DEPENDENCIES CPX_LIBS_INSTALLED CPX_CFLAGS_INSTALLED CPX_DATA_INSTALLED COIN_HAS_CPX_TRUE COIN_HAS_CPX_FALSE GLPK_LIBS GLPK_CFLAGS GLPK_DATA GLPK_DEPENDENCIES GLPK_LIBS_INSTALLED GLPK_CFLAGS_INSTALLED GLPK_DATA_INSTALLED COIN_HAS_GLPK_TRUE COIN_HAS_GLPK_FALSE GRB_LIBS GRB_CFLAGS GRB_DATA GRB_DEPENDENCIES GRB_LIBS_INSTALLED GRB_CFLAGS_INSTALLED GRB_DATA_INSTALLED COIN_HAS_GRB_TRUE COIN_HAS_GRB_FALSE MSK_LIBS MSK_CFLAGS MSK_DATA MSK_DEPENDENCIES MSK_LIBS_INSTALLED MSK_CFLAGS_INSTALLED MSK_DATA_INSTALLED COIN_HAS_MSK_TRUE COIN_HAS_MSK_FALSE SPX_LIBS SPX_CFLAGS SPX_DATA SPX_DEPENDENCIES SPX_LIBS_INSTALLED SPX_CFLAGS_INSTALLED SPX_DATA_INSTALLED COIN_HAS_SPX_TRUE COIN_HAS_SPX_FALSE XPR_LIBS XPR_CFLAGS XPR_DATA XPR_DEPENDENCIES XPR_LIBS_INSTALLED XPR_CFLAGS_INSTALLED XPR_DATA_INSTALLED COIN_HAS_XPR_TRUE COIN_HAS_XPR_FALSE ASL_LIBS ASL_CFLAGS ASL_DATA ASL_DEPENDENCIES ASL_LIBS_INSTALLED ASL_CFLAGS_INSTALLED ASL_DATA_INSTALLED COIN_HAS_ASL_TRUE COIN_HAS_ASL_FALSE NTYINCDIR NTYLIB COIN_HAS_NTY_TRUE COIN_HAS_NTY_FALSE CBC_BUILD_CBC_GENERIC_TRUE CBC_BUILD_CBC_GENERIC_FALSE OSICBC_DFLT_SOLVER_CLP_TRUE OSICBC_DFLT_SOLVER_CLP_FALSE OSICBC_DFLT_SOLVER_CPX_TRUE OSICBC_DFLT_SOLVER_CPX_FALSE OSICBC_DFLT_SOLVER_DYLP_TRUE OSICBC_DFLT_SOLVER_DYLP_FALSE OSICBC_DFLT_SOLVER_GLPK_TRUE OSICBC_DFLT_SOLVER_GLPK_FALSE OSICBC_DFLT_SOLVER_GRB_TRUE OSICBC_DFLT_SOLVER_GRB_FALSE OSICBC_DFLT_SOLVER_MSK_TRUE OSICBC_DFLT_SOLVER_MSK_FALSE OSICBC_DFLT_SOLVER_SPX_TRUE OSICBC_DFLT_SOLVER_SPX_FALSE OSICBC_DFLT_SOLVER_SYM_TRUE OSICBC_DFLT_SOLVER_SYM_FALSE OSICBC_DFLT_SOLVER_VOL_TRUE OSICBC_DFLT_SOLVER_VOL_FALSE OSICBC_DFLT_SOLVER_XPR_TRUE OSICBC_DFLT_SOLVER_XPR_FALSE coin_have_doxygen coin_have_latex coin_doxy_usedot coin_doxy_tagname coin_doxy_logname COIN_HAS_DOXYGEN_TRUE COIN_HAS_DOXYGEN_FALSE COIN_HAS_LATEX_TRUE COIN_HAS_LATEX_FALSE coin_doxy_tagfiles coin_doxy_excludes LIBEXT VPATH_DISTCLEANFILES ABSBUILDDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CDEFS_set=${CDEFS+set} ac_env_CDEFS_value=$CDEFS ac_cv_env_CDEFS_set=${CDEFS+set} ac_cv_env_CDEFS_value=$CDEFS ac_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_cv_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_cv_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_cv_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_cv_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_cv_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_cv_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_MPICC_set=${MPICC+set} ac_env_MPICC_value=$MPICC ac_cv_env_MPICC_set=${MPICC+set} ac_cv_env_MPICC_value=$MPICC ac_env_CXXDEFS_set=${CXXDEFS+set} ac_env_CXXDEFS_value=$CXXDEFS ac_cv_env_CXXDEFS_set=${CXXDEFS+set} ac_cv_env_CXXDEFS_value=$CXXDEFS ac_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_cv_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_cv_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_cv_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_cv_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_cv_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_cv_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_MPICXX_set=${MPICXX+set} ac_env_MPICXX_value=$MPICXX ac_cv_env_MPICXX_set=${MPICXX+set} ac_cv_env_MPICXX_value=$MPICXX ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP ac_env_F77_set=${F77+set} ac_env_F77_value=$F77 ac_cv_env_F77_set=${F77+set} ac_cv_env_F77_value=$F77 ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_env_PKG_CONFIG_value=$PKG_CONFIG ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Cbc 2.9.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Cbc 2.9.6:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug compile all projects with debug options tests (implies --disable-shared) --enable-debug-cbc compile project Cbc with debug compiler flags --enable-msvc Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin. --enable-static[=PKGS] build static libraries [default=no] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-dependency-linking disable linking library dependencies into shared libraries --disable-pkg-config disable use of pkg-config (if available) --disable-interpackage-dependencies disables deduction of Makefile dependencies from package linker flags --enable-gnu-packages compile with GNU packages (disabled by default) --disable-nauty-libcheck skip the link check at configuration time --enable-cbc-parallel enables compilation of the SMP version of Cbc Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-cbc-verbosity specify the debug verbosity level for project Cbc --with-cbc-checklevel specify the sanity check level for project Cbc --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-coin-instdir prefix of installation directory for precompiled COIN packages --with-coindepend-lib linker flags for using package CoinDepend --with-coindepend-incdir directory with header files for using package CoinDepend --with-coindepend-datadir directory with data files for using package CoinDepend --with-clp-lib linker flags for using package Clp --with-clp-incdir directory with header files for using package Clp --with-clp-datadir directory with data files for using package Clp --with-ositests-lib linker flags for using package OsiTests --with-ositests-incdir directory with header files for using package OsiTests --with-ositests-datadir directory with data files for using package OsiTests --with-sample-lib linker flags for using package Sample --with-sample-incdir directory with header files for using package Sample --with-sample-datadir directory with data files for using package Sample --with-netlib-lib linker flags for using package Netlib --with-netlib-incdir directory with header files for using package Netlib --with-netlib-datadir directory with data files for using package Netlib --with-miplib3-lib linker flags for using package Miplib3 --with-miplib3-incdir directory with header files for using package Miplib3 --with-miplib3-datadir directory with data files for using package Miplib3 --with-dylp-lib linker flags for using package DyLP --with-dylp-incdir directory with header files for using package DyLP --with-dylp-datadir directory with data files for using package DyLP --with-vol-lib linker flags for using package Vol --with-vol-incdir directory with header files for using package Vol --with-vol-datadir directory with data files for using package Vol --with-cpx-lib linker flags for using package Cpx --with-cpx-incdir directory with header files for using package Cpx --with-cpx-datadir directory with data files for using package Cpx --with-glpk-lib linker flags for using package Glpk --with-glpk-incdir directory with header files for using package Glpk --with-glpk-datadir directory with data files for using package Glpk --with-grb-lib linker flags for using package Grb --with-grb-incdir directory with header files for using package Grb --with-grb-datadir directory with data files for using package Grb --with-msk-lib linker flags for using package Msk --with-msk-incdir directory with header files for using package Msk --with-msk-datadir directory with data files for using package Msk --with-spx-lib linker flags for using package Spx --with-spx-incdir directory with header files for using package Spx --with-spx-datadir directory with data files for using package Spx --with-xpr-lib linker flags for using package Xpr --with-xpr-incdir directory with header files for using package Xpr --with-xpr-datadir directory with data files for using package Xpr --with-asl-lib linker flags for using package ASL --with-asl-incdir directory with header files for using package ASL --with-asl-datadir directory with data files for using package ASL --with-nauty-incdir specify the header file directory for library Nauty --with-nauty-lib specify the flags used to link with the library Nauty --with-cbc-generic specify whether to build cbc-generic (default: no) --with-cbc-generic-solver specify default solver for cbc-generic in lower case letters (if not given, clp is assumed) --with-pthreadsw32-lib specify the name of the pthreads win32 library (for cl/icl builds only) --with-pthreadsw32-incdir specify the path of the pthreads win32 header file (for cl/icl builds only) --with-osicbc-default-solver specify underlying solver for OsiCbc (default clp) --with-dot use dot (from graphviz) when creating documentation with doxygen if available; --without-dot to disable Some influential environment variables: CDEFS Additional -D flags to be used when compiling C code. ADD_CFLAGS Additional C compiler options DBG_CFLAGS Debug C compiler options OPT_CFLAGS Optimize C compiler options CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory MPICC C MPI Compiler CXXDEFS Additional -D flags to be used when compiling C++ code. ADD_CXXFLAGS Additional C++ compiler options DBG_CXXFLAGS Debug C++ compiler options OPT_CXXFLAGS Optimize C++ compiler options CXX C++ compiler command CXXFLAGS C++ compiler flags MPICXX C++ MPI Compiler CPP C preprocessor CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags PKG_CONFIG path to pkg-config utility Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Cbc configure 2.9.6 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Cbc $as_me 2.9.6, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # List one file in the package so that the configure script can test # whether the package is actually there # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. # As backup, we make sure we don't loose an FLIBS if it has been set # by the user save_FLIBS="$FLIBS" # A useful makefile conditional that is always false if false; then ALWAYS_FALSE_TRUE= ALWAYS_FALSE_FALSE='#' else ALWAYS_FALSE_TRUE='#' ALWAYS_FALSE_FALSE= fi # We set the following variable so that we know later in AC_COIN_FINALIZE # that we are in a project main directory coin_projectdir=yes # Set the project's version numbers cat >>confdefs.h <<_ACEOF #define CBC_VERSION "$PACKAGE_VERSION" _ACEOF coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'` coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'` coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'` if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi cat >>confdefs.h <<_ACEOF #define CBC_VERSION_MAJOR $coin_majorver _ACEOF cat >>confdefs.h <<_ACEOF #define CBC_VERSION_MINOR $coin_minorver _ACEOF cat >>confdefs.h <<_ACEOF #define CBC_VERSION_RELEASE $coin_releasever _ACEOF # We use the following variable to have a string with the upper case # version of the project name COIN_PRJCT=CBC # Set the project's SVN revision number. The complicated sed expression # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up # as a single number. # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svnversion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svnversion"; then ac_cv_prog_have_svnversion="$have_svnversion" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svnversion="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svnversion" && ac_cv_prog_have_svnversion="no" fi fi have_svnversion=$ac_cv_prog_have_svnversion if test -n "$have_svnversion"; then echo "$as_me:$LINENO: result: $have_svnversion" >&5 echo "${ECHO_T}$have_svnversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$have_svnversion" = xyes; then svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null` if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then CBC_SVN_REV=`echo $svn_rev_tmp | sed -n -e 's/^[0-9]*://' -e 's/\([0-9]\)[^0-9]*$/\1/p'` cat >>confdefs.h <<_ACEOF #define CBC_SVN_REV $CBC_SVN_REV _ACEOF fi fi # Capture libtool library version, if given. coin_libversion=12:6:9 # Check if user wants to produce debugging code echo "$as_me:$LINENO: checking whether we want to compile in debug mode" >&5 echo $ECHO_N "checking whether we want to compile in debug mode... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" case "${enableval}" in yes) coin_debug_compile=true if test "${enable_shared+set}" = set; then :; else enable_shared=no fi ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug" >&2;} { (exit 1); exit 1; }; } ;; esac else coin_debug_compile=false fi; # Check whether --enable-debug-cbc or --disable-debug-cbc was given. if test "${enable_debug_cbc+set}" = set; then enableval="$enable_debug_cbc" case "${enableval}" in yes) coin_debug_compile=true ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug-cbc" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug-cbc" >&2;} { (exit 1); exit 1; }; } ;; esac else : fi; # m4_ifvaln([Cbc], if test $coin_debug_compile = true; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Check whether --with-cbc-verbosity or --without-cbc-verbosity was given. if test "${with_cbc_verbosity+set}" = set; then withval="$with_cbc_verbosity" if test "$withval" = yes; then withval=1 fi coin_cbc_verbosity=$withval else coin_cbc_verbosity=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_CBC_VERBOSITY $coin_cbc_verbosity _ACEOF # Check whether --with-cbc-checklevel or --without-cbc-checklevel was given. if test "${with_cbc_checklevel+set}" = set; then withval="$with_cbc_checklevel" if test "$withval" = yes; then withval=1 fi coin_cbc_checklevel=$withval else coin_cbc_checklevel=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_CBC_CHECKLEVEL $coin_cbc_checklevel _ACEOF # m4_ifvaln([Cbc], # Get the name of the C++ compiler and appropriate compiler options # for backward compatibility # Check whether --enable-doscompile or --disable-doscompile was given. if test "${enable_doscompile+set}" = set; then enableval="$enable_doscompile" enable_doscompile=$enableval else enable_doscompile=no fi; # Check whether --enable-msvc or --disable-msvc was given. if test "${enable_msvc+set}" = set; then enableval="$enable_msvc" enable_msvc=$enableval else enable_msvc=no if test "$enable_doscompile" = msvc ; then enable_msvc=yes elif test "$enable_doscompile" != no ; then { { echo "$as_me:$LINENO: error: --enable-doscompile=$enable_doscompile not supported anymore." >&5 echo "$as_me: error: --enable-doscompile=$enable_doscompile not supported anymore." >&2;} { (exit 1); exit 1; }; } fi fi; if test "$enable_msvc" = MD; then enable_shared=yes enable_msvc=yes fi if test "$enable_msvc" = yes; then case $build in *-cygwin* | *-mingw*) ;; *) { { echo "$as_me:$LINENO: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&5 echo "$as_me: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&2;} { (exit 1); exit 1; }; } ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # For consistency, we set the C compiler to the same value of the C++ # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" { echo "$as_me:$LINENO: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&5 echo "$as_me: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&2;} fi ;; esac fi coin_has_cc=yes save_cflags="$CFLAGS" # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. # Depending on the user's PATH, when Studio/Workshop cc is not present we may # find /usr/ucb/cc, which is almost certainly not a good choice for the C # compiler. In this case, put cc after gcc. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl gcc" else comps="gcc icl cl" fi ;; *-*-solaris*) # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_sol_cc_compiler+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$sol_cc_compiler"; then ac_cv_prog_sol_cc_compiler="$sol_cc_compiler" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_sol_cc_compiler="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_sol_cc_compiler shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set sol_cc_compiler to just the basename; use the full file name. shift ac_cv_prog_sol_cc_compiler="$as_dir/$ac_word${1+' '}$@" fi fi fi fi sol_cc_compiler=$ac_cv_prog_sol_cc_compiler if test -n "$sol_cc_compiler"; then echo "$as_me:$LINENO: result: $sol_cc_compiler" >&5 echo "${ECHO_T}$sol_cc_compiler" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$sol_cc_compiler" = "cc" ; then comps="cc xlc gcc pgcc icc" else comps="xlc gcc pgcc icc cc" fi ;; *-*-darwin*) comps="clang gcc cc" ;; *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;; *-linux-*) comps="xlc gcc cc pgcc icc" ;; *) comps="xlc_r xlc cc gcc pgcc icc" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } # AC_MSG_NOTICE([C compiler candidates: $comps]) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -z "$CC" ; then { { echo "$as_me:$LINENO: error: Failed to find a C compiler!" >&5 echo "$as_me: error: Failed to find a C compiler!" >&2;} { (exit 1); exit 1; }; } fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; esac if test $coin_cc_is_cl = true; then COIN_CC_IS_CL_TRUE= COIN_CC_IS_CL_FALSE='#' else COIN_CC_IS_CL_TRUE='#' COIN_CC_IS_CL_FALSE= fi # Check if a project specific CFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} if test x$coin_tmp = xset; then eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} fi fi if test x"$CFLAGS" = x; then coin_add_cflags= coin_opt_cflags= coin_dbg_cflags= coin_warn_cflags= if test "$GCC" = "yes"; then case "$CC" in icc* | */icc*) ;; *) coin_opt_cflags="-O3" coin_add_cflags="-pipe" coin_dbg_cflags="-g -O0" coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cflags="-pedantic-errors $coin_warn_cflags" ;; esac esac fi if test -z "$coin_opt_cflags"; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' coin_dbg_cflags='-MDd' else coin_opt_cflags='-MT -O2' coin_dbg_cflags='-MTd' fi coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -Ox' coin_dbg_cflags='-MDd -debug' else coin_opt_cflags='-MT -Ox' coin_dbg_cflags='-MTd -debug' fi coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CC" in icc* | */icc*) coin_opt_cflags="-O3 -ip -mp1" coin_add_cflags="" coin_dbg_cflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cflags="-i_dynamic $coin_add_cflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgcc* | */pgcc*) coin_opt_cflags="-fast" coin_add_cflags="-Kieee -pc 64" coin_dbg_cflags="-g" ;; esac ;; *-ibm-*) case "$CC" in xlc* | */xlc* | mpxlc* | */mpxlc*) coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_cflags="-g" ;; esac ;; *-hp-*) coin_opt_cflags="-O" coin_add_cflags="-Ae" coin_dbg_cflags="-g" ;; *-*-solaris*) coin_opt_cflags="-xO4" coin_dbg_cflags="-g" ;; *-sgi-*) coin_opt_cflags="-O -OPT:Olimit=0" coin_dbg_cflags="-g" ;; esac fi if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then coin_dbg_cflags="-g" fi if test -z "$coin_opt_cflags"; then # Try if -O option works if nothing else is set CFLAGS="-O" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cflags" = xyes; then coin_warn_cflags= fi if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" fi DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" if test "$coin_debug_compile" = "true"; then CFLAGS="$DBG_CFLAGS" else CFLAGS="$OPT_CFLAGS" fi else CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$CFLAGS" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$CFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CFLAGS works save_CFLAGS="$CFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&2;} CFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C compiler options are: $CFLAGS" >&5 echo "$as_me: C compiler options are: $CFLAGS" >&6;} if test x"$MPICC" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C compiler $MPICC" >&5 echo "$as_me: Will use MPI C compiler $MPICC" >&6;} CC="$MPICC" fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #Let's try if that overcomes configuration problem with VC++ 6.0 ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_has_cxx=yes save_cxxflags="$CXXFLAGS" # For *-*-solaris*, promote Studio/Workshop compiler to front of list. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl g++" else comps="g++ icl cl" fi ;; *-*-solaris*) comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; *-darwin*) comps="clang++ g++ c++ CC" ;; *-linux-gnu*) comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;; *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } # AC_MSG_NOTICE([C++ compiler candidates: $comps]) ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler #thus, we test here whether $CXX is actually working ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking whether C++ compiler $CXX works" >&5 echo $ECHO_N "checking whether C++ compiler $CXX works... $ECHO_C" >&6; cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&5 echo "$as_me: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_cxx_is_cl=false # It seems that we need to cleanup something here for the Windows case "$CXX" in clang* | */clang*) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh mv confdefs.hh confdefs.h coin_cxx_is_cl=true ;; esac # add automake conditional so we can recognize cl compiler in makefile if test $coin_cxx_is_cl = true; then COIN_CXX_IS_CL_TRUE= COIN_CXX_IS_CL_FALSE='#' else COIN_CXX_IS_CL_TRUE='#' COIN_CXX_IS_CL_FALSE= fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CXXFLAGS="$save_cxxflags" # Check if a project specific CXXFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} if test x$coin_tmp = xset; then eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} fi fi if test x"$CXXFLAGS" = x; then # ToDo decide whether we want -DNDEBUG for optimization coin_add_cxxflags= coin_opt_cxxflags= coin_dbg_cxxflags= coin_warn_cxxflags= if test "$GXX" = "yes"; then case "$CXX" in icpc* | */icpc*) ;; *) # ToDo decide about unroll-loops coin_opt_cxxflags="-O3" coin_add_cxxflags="-pipe" coin_dbg_cxxflags="-g -O0" coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" ;; esac esac fi # Note that we do not need to cover GCC in the following tests. if test -z "$coin_opt_cxxflags"; then case $build in *-cygwin* | *-mingw*) case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -O2' coin_dbg_cxxflags='-MDd' else coin_opt_cxxflags='-MT -O2' coin_dbg_cxxflags='-MTd' fi coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -Ox' coin_dbg_cxxflags='-MDd -debug' else coin_opt_cxxflags='-MT -Ox' coin_dbg_cxxflags='-MTd -debug' fi coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CXX" in icpc* | */icpc*) coin_opt_cxxflags="-O3 -ip -mp1" coin_add_cxxflags="" coin_dbg_cxxflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CXXFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cxxflags="-i_dynamic $coin_add_cxxflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgCC* | */pgCC*) coin_opt_cxxflags="-fast" coin_add_cxxflags="-Kieee -pc 64" coin_dbg_cxxflags="-g" ;; esac ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" coin_dbg_cxxflags="-g" ;; esac ;; *-hp-*) case "$CXX" in aCC* | */aCC* ) coin_opt_cxxflags="-O" coin_add_cxxflags="-AA" coin_dbg_cxxflags="-g" ;; esac ;; *-*-solaris*) coin_opt_cxxflags="-O4" coin_dbg_cxxflags="-g" ;; esac fi # Generic flag settings. If these don't work, add a case above. if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then coin_dbg_cxxflags="-g" fi if test -z "$coin_opt_cxxflags"; then # Try if -O option works if nothing else is set CXXFLAGS=-O cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cxxflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cxxflags" = xyes; then coin_warn_cxxflags= fi # Do final setup of flags based on values determined above. if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" fi DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test "$coin_debug_compile" = "true"; then CXXFLAGS="$DBG_CXXFLAGS" else CXXFLAGS="$OPT_CXXFLAGS" fi # Handle the case where CXXFLAGS was set externally. else CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$CXXFLAGS" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$CXXFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CXXFLAGS works save_CXXFLAGS="$CXXFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&2;} CXXFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C++ compiler options are: $CXXFLAGS" >&5 echo "$as_me: C++ compiler options are: $CXXFLAGS" >&6;} if test x"$MPICXX" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C++ compiler $MPICXX" >&5 echo "$as_me: Will use MPI C++ compiler $MPICXX" >&6;} CXX="$MPICXX" fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Initialize automake and libtool { # START coin_disable_shared=no # Test if force_shared has been set if test "x" = xforce_shared; then if test x$enable_shared = xno; then { { echo "$as_me:$LINENO: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&5 echo "$as_me: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&2;} { (exit 1); exit 1; }; } fi enable_shared=yes; else case $build in *-cygwin* | *-mingw*) coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in clang* ) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Building of DLLs not supported in this configuration." >&5 echo "$as_me: Building of DLLs not supported in this configuration." >&6;} ;; *gcc*) if test x"$enable_dependency_linking" = xyes; then coin_disable_shared=no else { echo "$as_me:$LINENO: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&5 echo "$as_me: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&2;} fi ;; *) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; esac fi ;; *-aix*) coin_disable_shared=yes platform=AIX if test x"$enable_shared" = xyes; then { echo "$as_me:$LINENO: WARNING: Shared objects are not supported." >&5 echo "$as_me: WARNING: Shared objects are not supported." >&2;} fi ;; esac fi if test x"$coin_disable_shared" = xyes; then if test x"$enable_shared" = xyes; then : else # we don't disable shared, because it was not selected anyway coin_disable_shared=no fi enable_shared=no fi # By default, we only want the shared objects to be compiled # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=no fi; # Initialize automake echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='cbc' VERSION='2.9.6' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi depcc="$CXX" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME echo "$as_me:$LINENO: checking whether we are using the correct autotools" >&5 echo $ECHO_N "checking whether we are using the correct autotools... $ECHO_C" >&6 if test "${ac_cv_use_correct_autotools+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_correct_autotools=check fi echo "$as_me:$LINENO: result: $ac_cv_use_correct_autotools" >&5 echo "${ECHO_T}$ac_cv_use_correct_autotools" >&6 if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_autoconf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_autoconf"; then ac_cv_prog_have_autoconf="$have_autoconf" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_autoconf="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_autoconf" && ac_cv_prog_have_autoconf="no" fi fi have_autoconf=$ac_cv_prog_have_autoconf if test -n "$have_autoconf"; then echo "$as_me:$LINENO: result: $have_autoconf" >&5 echo "${ECHO_T}$have_autoconf" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_autoconf = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of autoconf" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of autoconf... $ECHO_C" >&6 autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of autoconf as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of autoconf as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location echo "$as_me:$LINENO: checking whether autoconf is coming from the correct location" >&5 echo $ECHO_N "checking whether autoconf is coming from the correct location... $ECHO_C" >&6 autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if we have automake # Extract the first word of "automake", so it can be a program name with args. set dummy automake; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_automake+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_automake"; then ac_cv_prog_have_automake="$have_automake" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_automake="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_automake" && ac_cv_prog_have_automake="no" fi fi have_automake=$ac_cv_prog_have_automake if test -n "$have_automake"; then echo "$as_me:$LINENO: result: $have_automake" >&5 echo "${ECHO_T}$have_automake" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_automake = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of automake" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of automake... $ECHO_C" >&6 automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of automake as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of automake as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable automake is picked up from the correct location echo "$as_me:$LINENO: checking whether automake is coming from the correct location" >&5 echo $ECHO_N "checking whether automake is coming from the correct location... $ECHO_C" >&6 automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` if test -r $want_dir/libtool/ltmain.sh; then have_ltmain=yes : else have_ltmain=no : fi echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of libtool." >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of libtool.... $ECHO_C" >&6 if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of libtool." >&5 echo "$as_me: error: You don't have the correct version of libtool." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: I cannot find the ltmain.sh file." >&5 echo "$as_me: error: I cannot find the ltmain.sh file." >&2;} { (exit 1); exit 1; }; } fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi if test -r $want_dir/aclocal/libtool.m4; then LIBTOOLM4="$want_dir/aclocal/libtool.m4" : else { { echo "$as_me:$LINENO: error: I cannot find the libtool.m4 file." >&5 echo "$as_me: error: I cannot find the libtool.m4 file." >&2;} { (exit 1); exit 1; }; } : fi # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https # Extract the first word of "svn", so it can be a program name with args. set dummy svn; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svn"; then ac_cv_prog_have_svn="$have_svn" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svn="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svn" && ac_cv_prog_have_svn="no" fi fi have_svn=$ac_cv_prog_have_svn if test -n "$have_svn"; then echo "$as_me:$LINENO: result: $have_svn" >&5 echo "${ECHO_T}$have_svn" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$have_svn = xyes; then echo "$as_me:$LINENO: checking whether svn understands https" >&5 echo $ECHO_N "checking whether svn understands https... $ECHO_C" >&6 if test "${ac_cv_svn_understands_https+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out fi echo "$as_me:$LINENO: result: $ac_cv_svn_understands_https" >&5 echo "${ECHO_T}$ac_cv_svn_understands_https" >&6 fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else { { echo "$as_me:$LINENO: error: Cannot find the BuildTools directory" >&5 echo "$as_me: error: Cannot find the BuildTools directory" >&2;} { (exit better disable maintainer mode.); exit better disable maintainer mode.; }; } fi fi fi # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` abs_lib_dir=$full_prefix/lib abs_include_dir=$full_prefix/include abs_bin_dir=$full_prefix/bin if test $coin_have_externals = yes && test x$have_svn = xyes; then HAVE_EXTERNALS_TRUE= HAVE_EXTERNALS_FALSE='#' else HAVE_EXTERNALS_TRUE='#' HAVE_EXTERNALS_FALSE= fi # AC_MSG_NOTICE([End automake initialisation.]) LIBTOOL= if test -f ../libtool; then coin_config_dir=.. LIBTOOL='$(SHELL) $(top_builddir)/../libtool' fi if test "x$LIBTOOL" = x; then if test -f ../../libtool; then coin_config_dir=../.. LIBTOOL='$(SHELL) $(top_builddir)/../../libtool' fi fi if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) # Stuff for libtool # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi; echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done fi SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix4* | aix5*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | kfreebsd*-gnu | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 5879 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to cbc@lists.coin-or.org ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done F77=$ac_ct_F77 fi # Provide some information about the compiler. echo "$as_me:7013:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 else echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux*) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6 else echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 fi echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6 if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6 objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAGIC_CMD=: fi fi fi ;; esac enable_dlopen=no enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default fi; test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8080: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8084: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8348: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8352: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 if test x"$lt_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works=yes fi else lt_prog_compiler_static_works=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 if test x"$lt_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8452: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:8456: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix3*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs=no ;; esac fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var" || \ test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which library types will actually be built echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags or --without-tags was given. if test "${with_tags+set}" = set; then withval="$with_tags" tagnames="$withval" fi; if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_CXX=yes else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_CXX=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_CXX='+b $libdir' ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix3*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. We must also pass each convience library through # to the system linker between allextract/defaultextract. # The C++ compiler will combine linker options so we # cannot just pass the convience library names through # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix3*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; solaris*) case $cc_basename in CC*) # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. postdeps_CXX='-lCstd -lCrun' ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13241: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:13245: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_CXX=yes fi else lt_prog_compiler_static_works_CXX=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 if test x"$lt_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13345: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:13349: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var_CXX" || \ test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6 if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_CXX" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code=" subroutine t\n return\n end\n" # Code to be used in simple link tests lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14915: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14919: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_F77=yes fi else lt_prog_compiler_static_works_F77=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 if test x"$lt_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:15019: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:15023: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix3*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_F77=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_F77=yes else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_F77=no ;; esac fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var_F77" || \ test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6 if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_F77" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no old_archive_cmds_GCJ=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17226: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17230: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_GCJ='-Qoption ld ';; *) lt_prog_compiler_wl_GCJ='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; unicos*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_can_build_shared_GCJ=no ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17494: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17498: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_GCJ=yes fi else lt_prog_compiler_static_works_GCJ=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17598: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:17602: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix3*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_GCJ=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = no; then runpath_var= hardcode_libdir_flag_spec_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_GCJ=yes else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_GCJ=no ;; esac fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6 test "$ld_shlibs_GCJ" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ pic_flag=$lt_prog_compiler_pic_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var_GCJ" || \ test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6 if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_GCJ" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_RC" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion # No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- # AC_REQUIRE([AC_COIN_DLFCN_H]) # NEW: If libtool exists in the directory higher up, we use that one # instead of creating a new one # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED # out in front of this macro body. You'll notice that LIBTOOL is already # defined here. We'll have to count on this macro not being called if libtool # already exists, or at least move the libtool fixes outside the conditional. # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".]) # This test is therefore removed. -- lh, 061214 -- # if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Calling PROG_LIBTOOL.]) # AC_MSG_NOTICE([Finished PROG_LIBTOOL.]) { echo "$as_me:$LINENO: Build is \"$build\"." >&5 echo "$as_me: Build is \"$build\"." >&6;} mydos2unix='| dos2unix' case $build in *-mingw*) CYGPATH_W=echo mydos2unix= ;; esac case $build in # Here we need to check if -m32 is specified. If so, we need to correct # sys_lib_search_path_spec *-cygwin* | *-mingw*) case "$CXX" in clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? { echo "$as_me:$LINENO: Applying patches to libtool for CLANG compiler" >&5 echo "$as_me: Applying patches to libtool for CLANG compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Applying patches to libtool for cl compiler" >&5 echo "$as_me: Applying patches to libtool for cl compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%lib /OUT:%lib -OUT:%' \ -e "s%cygpath -w%$CYGPATH_W%" \ -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$1"'); done%' \ -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$1"') '"$mydos2unix"'%' \ -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ libtool > conftest.bla ;; *) { echo "$as_me:$LINENO: Applying patches to libtool for GNU compiler" >&5 echo "$as_me: Applying patches to libtool for GNU compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; esac mv conftest.bla libtool chmod 755 libtool ;; *x86_64-*) if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then { echo "$as_me:$LINENO: Applying patches to libtool for 32bit compilation" >&5 echo "$as_me: Applying patches to libtool for 32bit compilation" >&6;} sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi ;; *-solaris*) if test "$GCC" = yes && \ (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then hdwisa=`isainfo | sed -e 's/\([^ ]*\) .*$/\1/'` if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then { echo "$as_me:$LINENO: Applying patches to libtool for 64-bit GCC compilation" >&5 echo "$as_me: Applying patches to libtool for 64-bit GCC compilation" >&6;} fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then # AC_MSG_NOTICE(Compensating for broken gcc) for lib in $fixlibtmp ; do if test -d "${lib}${hdwisa}" ; then syslibpath64="$syslibpath64 ${lib}${hdwisa}/" fi done syslibpath64="${syslibpath64} ${fixlibtmp}" else syslibpath64="$fixlibtmp" fi sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi # AC_MSG_NOTICE(Result is ) # $EGREP 'sys_lib_search_path_spec=' libtool fi ;; # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. *-darwin*) { echo "$as_me:$LINENO: Applying patches to libtool for Darwin" >&5 echo "$as_me: Applying patches to libtool for Darwin" >&6;} sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool ;; esac # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of # the macro. -- lh, 061214 -- # fi # AC_MSG_NOTICE([End libtool initialisation.]) # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) # set RPATH_FLAGS to the compiler link flags required to hardcode location # of the shared objects RPATH_FLAGS= if test $enable_shared = yes; then case $build in *-linux-*) if test "$GXX" = "yes"; then RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" done fi ;; *-darwin*) RPATH_FLAGS=nothing ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) RPATH_FLAGS=nothing ;; esac ;; *-hp-*) RPATH_FLAGS=nothing ;; *-mingw32) RPATH_FLAGS=nothing ;; *-*-solaris*) RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -R$dir" done esac if test "$RPATH_FLAGS" = ""; then { echo "$as_me:$LINENO: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&5 echo "$as_me: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&2;} fi if test "$RPATH_FLAGS" = "nothing"; then RPATH_FLAGS= fi fi else { echo "$as_me:$LINENO: Using libtool script in directory $coin_config_dir" >&5 echo "$as_me: Using libtool script in directory $coin_config_dir" >&6;} # get all missing information from the config.log file # output variables and defines as_save_IFS=$IFS IFS=' ' for oneline in `cat $coin_config_dir/config.status`; do case "$oneline" in # First some automake conditionals s,@am__fastdep* | s,@AR@* | s,@CPP@* | s,@CPPFLAGS@* | s,@CXXCPP@* | \ s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \ s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \ s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; s,@DEFS@* ) command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; esac done IFS=$as_save_IFS # And some defines (assuming here that the packages base dir # doesn't have a config.h file for word in $defsline; do # echo word $word case $word in -DHAVE_[A-Z_]*_H=1 | -DSTDC_HEADERS=1 ) i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` # echo dd $i echo $i >>confdefs.h ;; esac done fi # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) # Check whether --enable-dependency-linking or --disable-dependency-linking was given. if test "${enable_dependency_linking+set}" = set; then enableval="$enable_dependency_linking" dependency_linking="$enableval" else dependency_linking=auto fi; if test "$dependency_linking" = auto; then # On Cygwin and AIX, building DLLs doesn't work dependency_linking=no if test x"$coin_disable_shared" = xno; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) dependency_linking=no ;; *gcc*) dependency_linking=yes ;; *) dependency_linking=yes ;; esac ;; *) dependency_linking=yes ;; esac fi fi if test "$dependency_linking" = yes ; then LT_LDFLAGS="-no-undefined" else LT_LDFLAGS= fi if test "$dependency_linking" = yes; then DEPENDENCY_LINKING_TRUE= DEPENDENCY_LINKING_FALSE='#' else DEPENDENCY_LINKING_TRUE='#' DEPENDENCY_LINKING_FALSE= fi # Check if we want to set the library version echo "$as_me:$LINENO: checking if library version is set" >&5 echo $ECHO_N "checking if library version is set... $ECHO_C" >&6 if test x"$coin_libversion" != x; then LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion" echo "$as_me:$LINENO: result: $coin_libversion" >&5 echo "${ECHO_T}$coin_libversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi #END } ############################################################################# # COIN-OR components # ############################################################################# # Check whether --enable-pkg-config or --disable-pkg-config was given. if test "${enable_pkg_config+set}" = set; then enableval="$enable_pkg_config" use_pkgconfig="$enableval" else if test x$coin_cc_is_cl = xtrue; then use_pkgconfig=no else use_pkgconfig=yes fi fi; if test $use_pkgconfig = yes ; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PKG_CONFIG=$ac_cv_prog_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_PKG_CONFIG"; then ac_ct_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_PKG_CONFIG"; then ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG if test -n "$ac_ct_PKG_CONFIG"; then echo "$as_me:$LINENO: result: $ac_ct_PKG_CONFIG" >&5 echo "${ECHO_T}$ac_ct_PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi PKG_CONFIG=$ac_ct_PKG_CONFIG else PKG_CONFIG="$ac_cv_prog_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.16.0 echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 PKG_CONFIG="" fi fi # check if pkg-config supports the short-errors flag if test -n "$PKG_CONFIG" && \ $PKG_CONFIG --atleast-pkgconfig-version 0.20; then pkg_short_errors=" --short-errors " else pkg_short_errors="" fi fi if test -n "$PKG_CONFIG"; then COIN_HAS_PKGCONFIG_TRUE= COIN_HAS_PKGCONFIG_FALSE='#' else COIN_HAS_PKGCONFIG_TRUE='#' COIN_HAS_PKGCONFIG_FALSE= fi # assemble pkg-config search path for installed projects COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" # let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there # best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig, # unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}... if test "x${prefix}" = xNONE ; then COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" else COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi # Check whether --with-coin-instdir or --without-coin-instdir was given. if test "${with_coin_instdir+set}" = set; then withval="$with_coin_instdir" if test -d "$withval"; then : ; else { { echo "$as_me:$LINENO: error: argument for --with-coin-instdir not a directory" >&5 echo "$as_me: error: argument for --with-coin-instdir not a directory" >&2;} { (exit 1); exit 1; }; } fi COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi; # assemble additional pkg-config search paths for uninstalled projects if test x$coin_projectdir = xyes ; then # if we are in a project setup, then in a classic setup, we want to find uninstalled projects # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory # unfortunately, if the user set prefix, then we do not know where the project base directory is located # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data) COIN_PKG_CONFIG_PATH_UNINSTALLED= if test -f ../coin_subdirs.txt ; then for i in `cat ../coin_subdirs.txt` ; do if test -d ../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi if test -f ../../coin_subdirs.txt ; then for i in `cat ../../coin_subdirs.txt` ; do if test -d ../../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi fi if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then { echo "$as_me:$LINENO: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&5 echo "$as_me: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&2;} fi echo "$as_me:$LINENO: checking for COIN-OR package CoinDepend" >&5 echo $ECHO_N "checking for COIN-OR package CoinDepend... $ECHO_C" >&6 coin_has_coindepend=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "CoinDepend"; then coin_has_coindepend=skipping fi done fi if test "$coin_has_coindepend" != skipping; then # Check whether --with-m4_tolower(CoinDepend) or --without-m4_tolower(CoinDepend) was given. if test "${with_coindepend+set}" = set; then withval="$with_coindepend" if test "$withval" = no ; then coin_has_coindepend=skipping fi fi; fi COINDEPEND_LIBS= COINDEPEND_CFLAGS= COINDEPEND_DATA= COINDEPEND_DEPENDENCIES= COINDEPEND_PCLIBS= COINDEPEND_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_coindepend != skipping; then # Check whether --with-m4_tolower(CoinDepend)-lib or --without-m4_tolower(CoinDepend)-lib was given. if test "${with_coindepend_lib+set}" = set; then withval="$with_coindepend_lib" if test "$withval" = no ; then coin_has_coindepend=skipping else coin_has_coindepend=yes COINDEPEND_LIBS="$withval" COINDEPEND_PCLIBS="$withval" CBCLIB_PCLIBS="$withval $CBCLIB_PCLIBS" CBCLIB_LIBS="$withval $CBCLIB_LIBS" CBCGENERIC_PCLIBS="$withval $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS="$withval $CBCGENERIC_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINDEPEND_LIBS_INSTALLED="$withval" CBCLIB_LIBS_INSTALLED="$withval $CBCLIB_LIBS_INSTALLED"CBCGENERIC_LIBS_INSTALLED="$withval $CBCGENERIC_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_coindepend != skipping; then # Check whether --with-m4_tolower(CoinDepend)-incdir or --without-m4_tolower(CoinDepend)-incdir was given. if test "${with_coindepend_incdir+set}" = set; then withval="$with_coindepend_incdir" if test "$withval" = no ; then coin_has_coindepend=skipping else coin_has_coindepend=yes COINDEPEND_CFLAGS="-I`${CYGPATH_W} $withval`" CBCLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CBCLIB_CFLAGS"CBCGENERIC_CFLAGS="-I`${CYGPATH_W} $withval` $CBCGENERIC_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINDEPEND_CFLAGS_INSTALLED="$COINDEPEND_CFLAGS" CBCLIB_CFLAGS_INSTALLED="$COINDEPEND_CFLAGS $CBCLIB_CFLAGS_INSTALLED"CBCGENERIC_CFLAGS_INSTALLED="$COINDEPEND_CFLAGS $CBCGENERIC_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_coindepend != skipping; then # Check whether --with-m4_tolower(CoinDepend)-datadir or --without-m4_tolower(CoinDepend)-datadir was given. if test "${with_coindepend_datadir+set}" = set; then withval="$with_coindepend_datadir" if test "$withval" = no ; then coin_has_coindepend=skipping else coin_has_coindepend=yes COINDEPEND_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINDEPEND_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_coindepend = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "cgl osi coinutils"; then COINDEPEND_VERSIONS=`$PKG_CONFIG --modversion "cgl osi coinutils" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "cgl osi coinutils" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINDEPEND_CFLAGS="$cflags" COINDEPEND_LIBS=`$PKG_CONFIG --libs "cgl osi coinutils" 2>/dev/null` COINDEPEND_DATA=`$PKG_CONFIG --variable=datadir "cgl osi coinutils" 2>/dev/null` coin_has_coindepend=yes echo "$as_me:$LINENO: result: yes: $COINDEPEND_VERSIONS" >&5 echo "${ECHO_T}yes: $COINDEPEND_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then COINDEPEND_LIBS=`echo " $COINDEPEND_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi COINDEPEND_PCREQUIRES="cgl osi coinutils" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CbcLib CbcGeneric CBCLIB_PCREQUIRES="cgl osi coinutils $CBCLIB_PCREQUIRES" CBCLIB_CFLAGS="$COINDEPEND_CFLAGS $CBCLIB_CFLAGS" CBCLIB_LIBS="$COINDEPEND_LIBS $CBCLIB_LIBS" CBCGENERIC_PCREQUIRES="cgl osi coinutils $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$COINDEPEND_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$COINDEPEND_LIBS $CBCGENERIC_LIBS" else COINDEPEND_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "cgl osi coinutils"` coin_has_coindepend=notGiven echo "$as_me:$LINENO: result: not given: $COINDEPEND_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $COINDEPEND_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module CoinDepend without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module CoinDepend without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package CoinDepend (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package CoinDepend (fallback)... $ECHO_C" >&6 coin_has_coindepend=notGiven COINDEPEND_LIBS= COINDEPEND_LIBS_INSTALLED= COINDEPEND_CFLAGS= COINDEPEND_CFLAGS_INSTALLED= COINDEPEND_DATA= COINDEPEND_DATA_INSTALLED= COINDEPEND_PCLIBS= COINDEPEND_PCREQUIRES= # initial list of dependencies is "cgl osi coinutils", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="cgl osi coinutils" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$COINDEPEND_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` COINDEPEND_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$COINDEPEND_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi COINDEPEND_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINDEPEND_CFLAGS="$projcflags $COINDEPEND_CFLAGS" # set LIBS variable COINDEPEND_LIBS="$projlibs $COINDEPEND_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINDEPEND_CFLAGS_INSTALLED="$projcflags $COINDEPEND_CFLAGS_INSTALLED" # set LIBS variable COINDEPEND_LIBS_INSTALLED="$projlibs $COINDEPEND_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_coindepend=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_COINDEPEND 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then COINDEPEND_LIBS=`echo " $COINDEPEND_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` COINDEPEND_LIBS_INSTALLED=`echo " $COINDEPEND_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi COINDEPEND_PCREQUIRES="cgl osi coinutils" CBCLIB_PCREQUIRES="cgl osi coinutils $CBCLIB_PCREQUIRES" CBCLIB_CFLAGS="$COINDEPEND_CFLAGS $CBCLIB_CFLAGS" CBCLIB_LIBS="$COINDEPEND_LIBS $CBCLIB_LIBS" CBCLIB_CFLAGS_INSTALLED="$COINDEPEND_CFLAGS_INSTALLED $CBCLIB_CFLAGS_INSTALLED" CBCLIB_LIBS_INSTALLED="$COINDEPEND_LIBS_INSTALLED $CBCLIB_LIBS_INSTALLED" CBCGENERIC_PCREQUIRES="cgl osi coinutils $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$COINDEPEND_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$COINDEPEND_LIBS $CBCGENERIC_LIBS" CBCGENERIC_CFLAGS_INSTALLED="$COINDEPEND_CFLAGS_INSTALLED $CBCGENERIC_CFLAGS_INSTALLED" CBCGENERIC_LIBS_INSTALLED="$COINDEPEND_LIBS_INSTALLED $CBCGENERIC_LIBS_INSTALLED" fi if test $coin_has_coindepend != notGiven && test $coin_has_coindepend != skipping; then COIN_HAS_COINDEPEND_TRUE= COIN_HAS_COINDEPEND_FALSE='#' else COIN_HAS_COINDEPEND_TRUE='#' COIN_HAS_COINDEPEND_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_coindepend" >&5 echo "${ECHO_T}$coin_has_coindepend" >&6 fi if test $coin_has_coindepend != skipping && test $coin_has_coindepend != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_COINDEPEND 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) COINDEPEND_DEPENDENCIES=`echo " $COINDEPEND_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCLIB_DEPENDENCIES=`echo " $CBCLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCGENERIC_DEPENDENCIES=`echo " $CBCGENERIC_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$COINDEPEND_CFLAGS" ; then { echo "$as_me:$LINENO: CoinDepend CFLAGS are $COINDEPEND_CFLAGS" >&5 echo "$as_me: CoinDepend CFLAGS are $COINDEPEND_CFLAGS" >&6;} fi if test -n "$COINDEPEND_LIBS" ; then { echo "$as_me:$LINENO: CoinDepend LIBS are $COINDEPEND_LIBS" >&5 echo "$as_me: CoinDepend LIBS are $COINDEPEND_LIBS" >&6;} fi if test -n "$COINDEPEND_DEPENDENCIES" ; then { echo "$as_me:$LINENO: CoinDepend DEPENDENCIES are $COINDEPEND_DEPENDENCIES" >&5 echo "$as_me: CoinDepend DEPENDENCIES are $COINDEPEND_DEPENDENCIES" >&6;} fi if test -n "$COINDEPEND_DATA" ; then { echo "$as_me:$LINENO: CoinDepend DATA is $COINDEPEND_DATA" >&5 echo "$as_me: CoinDepend DATA is $COINDEPEND_DATA" >&6;} fi if test -n "$COINDEPEND_PCLIBS" ; then { echo "$as_me:$LINENO: CoinDepend PCLIBS are $COINDEPEND_PCLIBS" >&5 echo "$as_me: CoinDepend PCLIBS are $COINDEPEND_PCLIBS" >&6;} fi if test -n "$COINDEPEND_PCREQUIRES" ; then { echo "$as_me:$LINENO: CoinDepend PCREQUIRES are $COINDEPEND_PCREQUIRES" >&5 echo "$as_me: CoinDepend PCREQUIRES are $COINDEPEND_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CbcLib CFLAGS are $CBCLIB_CFLAGS" >&5 echo "$as_me: CbcLib CFLAGS are $CBCLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcLib LIBS are $CBCLIB_LIBS" >&5 echo "$as_me: CbcLib LIBS are $CBCLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CbcLib DEPENDENCIES are $CBCLIB_DEPENDENCIES" >&5 echo "$as_me: CbcLib DEPENDENCIES are $CBCLIB_DEPENDENCIES" >&6;} { echo "$as_me:$LINENO: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&5 echo "$as_me: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&5 echo "$as_me: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&6;} { echo "$as_me:$LINENO: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&5 echo "$as_me: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_coindepend != notGiven && test $coin_has_coindepend != skipping; then COIN_HAS_COINDEPEND_TRUE= COIN_HAS_COINDEPEND_FALSE='#' else COIN_HAS_COINDEPEND_TRUE='#' COIN_HAS_COINDEPEND_FALSE= fi if test $coin_has_coindepend != yes ; then { { echo "$as_me:$LINENO: error: One or more required packages CoinUtils, Osi, and Cgl are not available." >&5 echo "$as_me: error: One or more required packages CoinUtils, Osi, and Cgl are not available." >&2;} { (exit 1); exit 1; }; } fi # Clp and OsiClp are inseparable here. echo "$as_me:$LINENO: checking for COIN-OR package Clp" >&5 echo $ECHO_N "checking for COIN-OR package Clp... $ECHO_C" >&6 coin_has_clp=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Clp"; then coin_has_clp=skipping fi done fi if test "$coin_has_clp" != skipping; then # Check whether --with-m4_tolower(Clp) or --without-m4_tolower(Clp) was given. if test "${with_clp+set}" = set; then withval="$with_clp" if test "$withval" = no ; then coin_has_clp=skipping fi fi; fi CLP_LIBS= CLP_CFLAGS= CLP_DATA= CLP_DEPENDENCIES= CLP_PCLIBS= CLP_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_clp != skipping; then # Check whether --with-m4_tolower(Clp)-lib or --without-m4_tolower(Clp)-lib was given. if test "${with_clp_lib+set}" = set; then withval="$with_clp_lib" if test "$withval" = no ; then coin_has_clp=skipping else coin_has_clp=yes CLP_LIBS="$withval" CLP_PCLIBS="$withval" CBCLIB_PCLIBS="$withval $CBCLIB_PCLIBS" CBCLIB_LIBS="$withval $CBCLIB_LIBS" CBCGENERIC_PCLIBS="$withval $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS="$withval $CBCGENERIC_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CLP_LIBS_INSTALLED="$withval" CBCLIB_LIBS_INSTALLED="$withval $CBCLIB_LIBS_INSTALLED"CBCGENERIC_LIBS_INSTALLED="$withval $CBCGENERIC_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_clp != skipping; then # Check whether --with-m4_tolower(Clp)-incdir or --without-m4_tolower(Clp)-incdir was given. if test "${with_clp_incdir+set}" = set; then withval="$with_clp_incdir" if test "$withval" = no ; then coin_has_clp=skipping else coin_has_clp=yes CLP_CFLAGS="-I`${CYGPATH_W} $withval`" CBCLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CBCLIB_CFLAGS"CBCGENERIC_CFLAGS="-I`${CYGPATH_W} $withval` $CBCGENERIC_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CLP_CFLAGS_INSTALLED="$CLP_CFLAGS" CBCLIB_CFLAGS_INSTALLED="$CLP_CFLAGS $CBCLIB_CFLAGS_INSTALLED"CBCGENERIC_CFLAGS_INSTALLED="$CLP_CFLAGS $CBCGENERIC_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_clp != skipping; then # Check whether --with-m4_tolower(Clp)-datadir or --without-m4_tolower(Clp)-datadir was given. if test "${with_clp_datadir+set}" = set; then withval="$with_clp_datadir" if test "$withval" = no ; then coin_has_clp=skipping else coin_has_clp=yes CLP_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CLP_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_clp = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-clp"; then CLP_VERSIONS=`$PKG_CONFIG --modversion "osi-clp" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-clp" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CLP_CFLAGS="$cflags" CLP_LIBS=`$PKG_CONFIG --libs "osi-clp" 2>/dev/null` CLP_DATA=`$PKG_CONFIG --variable=datadir "osi-clp" 2>/dev/null` coin_has_clp=yes echo "$as_me:$LINENO: result: yes: $CLP_VERSIONS" >&5 echo "${ECHO_T}yes: $CLP_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then CLP_LIBS=`echo " $CLP_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi CLP_PCREQUIRES="osi-clp" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CbcLib CbcGeneric CBCLIB_PCREQUIRES="osi-clp $CBCLIB_PCREQUIRES" CBCLIB_CFLAGS="$CLP_CFLAGS $CBCLIB_CFLAGS" CBCLIB_LIBS="$CLP_LIBS $CBCLIB_LIBS" CBCGENERIC_PCREQUIRES="osi-clp $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$CLP_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$CLP_LIBS $CBCGENERIC_LIBS" else CLP_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-clp"` coin_has_clp=notGiven echo "$as_me:$LINENO: result: not given: $CLP_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $CLP_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Clp without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Clp without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Clp (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Clp (fallback)... $ECHO_C" >&6 coin_has_clp=notGiven CLP_LIBS= CLP_LIBS_INSTALLED= CLP_CFLAGS= CLP_CFLAGS_INSTALLED= CLP_DATA= CLP_DATA_INSTALLED= CLP_PCLIBS= CLP_PCREQUIRES= # initial list of dependencies is "osi-clp", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-clp" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$CLP_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` CLP_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$CLP_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi CLP_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CLP_CFLAGS="$projcflags $CLP_CFLAGS" # set LIBS variable CLP_LIBS="$projlibs $CLP_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CLP_CFLAGS_INSTALLED="$projcflags $CLP_CFLAGS_INSTALLED" # set LIBS variable CLP_LIBS_INSTALLED="$projlibs $CLP_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_clp=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_CLP 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then CLP_LIBS=`echo " $CLP_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` CLP_LIBS_INSTALLED=`echo " $CLP_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi CLP_PCREQUIRES="osi-clp" CBCLIB_PCREQUIRES="osi-clp $CBCLIB_PCREQUIRES" CBCLIB_CFLAGS="$CLP_CFLAGS $CBCLIB_CFLAGS" CBCLIB_LIBS="$CLP_LIBS $CBCLIB_LIBS" CBCLIB_CFLAGS_INSTALLED="$CLP_CFLAGS_INSTALLED $CBCLIB_CFLAGS_INSTALLED" CBCLIB_LIBS_INSTALLED="$CLP_LIBS_INSTALLED $CBCLIB_LIBS_INSTALLED" CBCGENERIC_PCREQUIRES="osi-clp $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$CLP_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$CLP_LIBS $CBCGENERIC_LIBS" CBCGENERIC_CFLAGS_INSTALLED="$CLP_CFLAGS_INSTALLED $CBCGENERIC_CFLAGS_INSTALLED" CBCGENERIC_LIBS_INSTALLED="$CLP_LIBS_INSTALLED $CBCGENERIC_LIBS_INSTALLED" fi if test $coin_has_clp != notGiven && test $coin_has_clp != skipping; then COIN_HAS_CLP_TRUE= COIN_HAS_CLP_FALSE='#' else COIN_HAS_CLP_TRUE='#' COIN_HAS_CLP_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_clp" >&5 echo "${ECHO_T}$coin_has_clp" >&6 fi if test $coin_has_clp != skipping && test $coin_has_clp != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_CLP 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) CLP_DEPENDENCIES=`echo " $CLP_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCLIB_DEPENDENCIES=`echo " $CBCLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCGENERIC_DEPENDENCIES=`echo " $CBCGENERIC_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$CLP_CFLAGS" ; then { echo "$as_me:$LINENO: Clp CFLAGS are $CLP_CFLAGS" >&5 echo "$as_me: Clp CFLAGS are $CLP_CFLAGS" >&6;} fi if test -n "$CLP_LIBS" ; then { echo "$as_me:$LINENO: Clp LIBS are $CLP_LIBS" >&5 echo "$as_me: Clp LIBS are $CLP_LIBS" >&6;} fi if test -n "$CLP_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Clp DEPENDENCIES are $CLP_DEPENDENCIES" >&5 echo "$as_me: Clp DEPENDENCIES are $CLP_DEPENDENCIES" >&6;} fi if test -n "$CLP_DATA" ; then { echo "$as_me:$LINENO: Clp DATA is $CLP_DATA" >&5 echo "$as_me: Clp DATA is $CLP_DATA" >&6;} fi if test -n "$CLP_PCLIBS" ; then { echo "$as_me:$LINENO: Clp PCLIBS are $CLP_PCLIBS" >&5 echo "$as_me: Clp PCLIBS are $CLP_PCLIBS" >&6;} fi if test -n "$CLP_PCREQUIRES" ; then { echo "$as_me:$LINENO: Clp PCREQUIRES are $CLP_PCREQUIRES" >&5 echo "$as_me: Clp PCREQUIRES are $CLP_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CbcLib CFLAGS are $CBCLIB_CFLAGS" >&5 echo "$as_me: CbcLib CFLAGS are $CBCLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcLib LIBS are $CBCLIB_LIBS" >&5 echo "$as_me: CbcLib LIBS are $CBCLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CbcLib DEPENDENCIES are $CBCLIB_DEPENDENCIES" >&5 echo "$as_me: CbcLib DEPENDENCIES are $CBCLIB_DEPENDENCIES" >&6;} { echo "$as_me:$LINENO: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&5 echo "$as_me: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&5 echo "$as_me: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&6;} { echo "$as_me:$LINENO: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&5 echo "$as_me: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_clp != notGiven && test $coin_has_clp != skipping; then COIN_HAS_CLP_TRUE= COIN_HAS_CLP_FALSE='#' else COIN_HAS_CLP_TRUE='#' COIN_HAS_CLP_FALSE= fi if test $coin_has_clp != yes ; then { { echo "$as_me:$LINENO: error: \"Required package Clp unavailable.\"" >&5 echo "$as_me: error: \"Required package Clp unavailable.\"" >&2;} { (exit 1); exit 1; }; } fi # The rest are not required for linking against Cbc echo "$as_me:$LINENO: checking for COIN-OR package OsiTests" >&5 echo $ECHO_N "checking for COIN-OR package OsiTests... $ECHO_C" >&6 coin_has_ositests=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiTests"; then coin_has_ositests=skipping fi done fi if test "$coin_has_ositests" != skipping; then # Check whether --with-m4_tolower(OsiTests) or --without-m4_tolower(OsiTests) was given. if test "${with_ositests+set}" = set; then withval="$with_ositests" if test "$withval" = no ; then coin_has_ositests=skipping fi fi; fi OSITESTS_LIBS= OSITESTS_CFLAGS= OSITESTS_DATA= OSITESTS_DEPENDENCIES= OSITESTS_PCLIBS= OSITESTS_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_ositests != skipping; then # Check whether --with-m4_tolower(OsiTests)-lib or --without-m4_tolower(OsiTests)-lib was given. if test "${with_ositests_lib+set}" = set; then withval="$with_ositests_lib" if test "$withval" = no ; then coin_has_ositests=skipping else coin_has_ositests=yes OSITESTS_LIBS="$withval" OSITESTS_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSITESTS_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_ositests != skipping; then # Check whether --with-m4_tolower(OsiTests)-incdir or --without-m4_tolower(OsiTests)-incdir was given. if test "${with_ositests_incdir+set}" = set; then withval="$with_ositests_incdir" if test "$withval" = no ; then coin_has_ositests=skipping else coin_has_ositests=yes OSITESTS_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSITESTS_CFLAGS_INSTALLED="$OSITESTS_CFLAGS" fi fi fi; fi if test $coin_has_ositests != skipping; then # Check whether --with-m4_tolower(OsiTests)-datadir or --without-m4_tolower(OsiTests)-datadir was given. if test "${with_ositests_datadir+set}" = set; then withval="$with_ositests_datadir" if test "$withval" = no ; then coin_has_ositests=skipping else coin_has_ositests=yes OSITESTS_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSITESTS_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_ositests = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-unittests"; then OSITESTS_VERSIONS=`$PKG_CONFIG --modversion "osi-unittests" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-unittests" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSITESTS_CFLAGS="$cflags" OSITESTS_LIBS=`$PKG_CONFIG --libs "osi-unittests" 2>/dev/null` OSITESTS_DATA=`$PKG_CONFIG --variable=datadir "osi-unittests" 2>/dev/null` coin_has_ositests=yes echo "$as_me:$LINENO: result: yes: $OSITESTS_VERSIONS" >&5 echo "${ECHO_T}yes: $OSITESTS_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSITESTS_LIBS=`echo " $OSITESTS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSITESTS_PCREQUIRES="osi-unittests" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else OSITESTS_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-unittests"` coin_has_ositests=notGiven echo "$as_me:$LINENO: result: not given: $OSITESTS_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSITESTS_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiTests without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiTests without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiTests (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiTests (fallback)... $ECHO_C" >&6 coin_has_ositests=notGiven OSITESTS_LIBS= OSITESTS_LIBS_INSTALLED= OSITESTS_CFLAGS= OSITESTS_CFLAGS_INSTALLED= OSITESTS_DATA= OSITESTS_DATA_INSTALLED= OSITESTS_PCLIBS= OSITESTS_PCREQUIRES= # initial list of dependencies is "osi-unittests", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-unittests" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSITESTS_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSITESTS_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSITESTS_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSITESTS_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSITESTS_CFLAGS="$projcflags $OSITESTS_CFLAGS" # set LIBS variable OSITESTS_LIBS="$projlibs $OSITESTS_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSITESTS_CFLAGS_INSTALLED="$projcflags $OSITESTS_CFLAGS_INSTALLED" # set LIBS variable OSITESTS_LIBS_INSTALLED="$projlibs $OSITESTS_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_ositests=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSITESTS 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSITESTS_LIBS=`echo " $OSITESTS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSITESTS_LIBS_INSTALLED=`echo " $OSITESTS_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSITESTS_PCREQUIRES="osi-unittests" fi if test $coin_has_ositests != notGiven && test $coin_has_ositests != skipping; then COIN_HAS_OSITESTS_TRUE= COIN_HAS_OSITESTS_FALSE='#' else COIN_HAS_OSITESTS_TRUE='#' COIN_HAS_OSITESTS_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_ositests" >&5 echo "${ECHO_T}$coin_has_ositests" >&6 fi if test $coin_has_ositests != skipping && test $coin_has_ositests != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSITESTS 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSITESTS_DEPENDENCIES=`echo " $OSITESTS_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSITESTS_CFLAGS" ; then { echo "$as_me:$LINENO: OsiTests CFLAGS are $OSITESTS_CFLAGS" >&5 echo "$as_me: OsiTests CFLAGS are $OSITESTS_CFLAGS" >&6;} fi if test -n "$OSITESTS_LIBS" ; then { echo "$as_me:$LINENO: OsiTests LIBS are $OSITESTS_LIBS" >&5 echo "$as_me: OsiTests LIBS are $OSITESTS_LIBS" >&6;} fi if test -n "$OSITESTS_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiTests DEPENDENCIES are $OSITESTS_DEPENDENCIES" >&5 echo "$as_me: OsiTests DEPENDENCIES are $OSITESTS_DEPENDENCIES" >&6;} fi if test -n "$OSITESTS_DATA" ; then { echo "$as_me:$LINENO: OsiTests DATA is $OSITESTS_DATA" >&5 echo "$as_me: OsiTests DATA is $OSITESTS_DATA" >&6;} fi if test -n "$OSITESTS_PCLIBS" ; then { echo "$as_me:$LINENO: OsiTests PCLIBS are $OSITESTS_PCLIBS" >&5 echo "$as_me: OsiTests PCLIBS are $OSITESTS_PCLIBS" >&6;} fi if test -n "$OSITESTS_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiTests PCREQUIRES are $OSITESTS_PCREQUIRES" >&5 echo "$as_me: OsiTests PCREQUIRES are $OSITESTS_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_ositests != notGiven && test $coin_has_ositests != skipping; then COIN_HAS_OSITESTS_TRUE= COIN_HAS_OSITESTS_FALSE='#' else COIN_HAS_OSITESTS_TRUE='#' COIN_HAS_OSITESTS_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Sample" >&5 echo $ECHO_N "checking for COIN-OR package Sample... $ECHO_C" >&6 coin_has_sample=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Sample"; then coin_has_sample=skipping fi done fi if test "$coin_has_sample" != skipping; then # Check whether --with-m4_tolower(Sample) or --without-m4_tolower(Sample) was given. if test "${with_sample+set}" = set; then withval="$with_sample" if test "$withval" = no ; then coin_has_sample=skipping fi fi; fi SAMPLE_LIBS= SAMPLE_CFLAGS= SAMPLE_DATA= SAMPLE_DEPENDENCIES= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-lib or --without-m4_tolower(Sample)-lib was given. if test "${with_sample_lib+set}" = set; then withval="$with_sample_lib" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_LIBS="$withval" SAMPLE_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-incdir or --without-m4_tolower(Sample)-incdir was given. if test "${with_sample_incdir+set}" = set; then withval="$with_sample_incdir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_CFLAGS_INSTALLED="$SAMPLE_CFLAGS" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-datadir or --without-m4_tolower(Sample)-datadir was given. if test "${with_sample_datadir+set}" = set; then withval="$with_sample_datadir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatasample"; then SAMPLE_VERSIONS=`$PKG_CONFIG --modversion "coindatasample" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatasample" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$cflags" SAMPLE_LIBS=`$PKG_CONFIG --libs "coindatasample" 2>/dev/null` SAMPLE_DATA=`$PKG_CONFIG --variable=datadir "coindatasample" 2>/dev/null` coin_has_sample=yes echo "$as_me:$LINENO: result: yes: $SAMPLE_VERSIONS" >&5 echo "${ECHO_T}yes: $SAMPLE_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi SAMPLE_PCREQUIRES="coindatasample" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else SAMPLE_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatasample"` coin_has_sample=notGiven echo "$as_me:$LINENO: result: not given: $SAMPLE_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $SAMPLE_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Sample without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Sample without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Sample (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Sample (fallback)... $ECHO_C" >&6 coin_has_sample=notGiven SAMPLE_LIBS= SAMPLE_LIBS_INSTALLED= SAMPLE_CFLAGS= SAMPLE_CFLAGS_INSTALLED= SAMPLE_DATA= SAMPLE_DATA_INSTALLED= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= # initial list of dependencies is "coindatasample", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatasample" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$SAMPLE_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` SAMPLE_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$SAMPLE_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi SAMPLE_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$projcflags $SAMPLE_CFLAGS" # set LIBS variable SAMPLE_LIBS="$projlibs $SAMPLE_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS_INSTALLED="$projcflags $SAMPLE_CFLAGS_INSTALLED" # set LIBS variable SAMPLE_LIBS_INSTALLED="$projlibs $SAMPLE_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_sample=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` SAMPLE_LIBS_INSTALLED=`echo " $SAMPLE_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi SAMPLE_PCREQUIRES="coindatasample" fi if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_sample" >&5 echo "${ECHO_T}$coin_has_sample" >&6 fi if test $coin_has_sample != skipping && test $coin_has_sample != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) SAMPLE_DEPENDENCIES=`echo " $SAMPLE_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$SAMPLE_CFLAGS" ; then { echo "$as_me:$LINENO: Sample CFLAGS are $SAMPLE_CFLAGS" >&5 echo "$as_me: Sample CFLAGS are $SAMPLE_CFLAGS" >&6;} fi if test -n "$SAMPLE_LIBS" ; then { echo "$as_me:$LINENO: Sample LIBS are $SAMPLE_LIBS" >&5 echo "$as_me: Sample LIBS are $SAMPLE_LIBS" >&6;} fi if test -n "$SAMPLE_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&5 echo "$as_me: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&6;} fi if test -n "$SAMPLE_DATA" ; then { echo "$as_me:$LINENO: Sample DATA is $SAMPLE_DATA" >&5 echo "$as_me: Sample DATA is $SAMPLE_DATA" >&6;} fi if test -n "$SAMPLE_PCLIBS" ; then { echo "$as_me:$LINENO: Sample PCLIBS are $SAMPLE_PCLIBS" >&5 echo "$as_me: Sample PCLIBS are $SAMPLE_PCLIBS" >&6;} fi if test -n "$SAMPLE_PCREQUIRES" ; then { echo "$as_me:$LINENO: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&5 echo "$as_me: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Netlib" >&5 echo $ECHO_N "checking for COIN-OR package Netlib... $ECHO_C" >&6 coin_has_netlib=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Netlib"; then coin_has_netlib=skipping fi done fi if test "$coin_has_netlib" != skipping; then # Check whether --with-m4_tolower(Netlib) or --without-m4_tolower(Netlib) was given. if test "${with_netlib+set}" = set; then withval="$with_netlib" if test "$withval" = no ; then coin_has_netlib=skipping fi fi; fi NETLIB_LIBS= NETLIB_CFLAGS= NETLIB_DATA= NETLIB_DEPENDENCIES= NETLIB_PCLIBS= NETLIB_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-lib or --without-m4_tolower(Netlib)-lib was given. if test "${with_netlib_lib+set}" = set; then withval="$with_netlib_lib" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_LIBS="$withval" NETLIB_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-incdir or --without-m4_tolower(Netlib)-incdir was given. if test "${with_netlib_incdir+set}" = set; then withval="$with_netlib_incdir" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_CFLAGS_INSTALLED="$NETLIB_CFLAGS" fi fi fi; fi if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-datadir or --without-m4_tolower(Netlib)-datadir was given. if test "${with_netlib_datadir+set}" = set; then withval="$with_netlib_datadir" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_netlib = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatanetlib"; then NETLIB_VERSIONS=`$PKG_CONFIG --modversion "coindatanetlib" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatanetlib" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS="$cflags" NETLIB_LIBS=`$PKG_CONFIG --libs "coindatanetlib" 2>/dev/null` NETLIB_DATA=`$PKG_CONFIG --variable=datadir "coindatanetlib" 2>/dev/null` coin_has_netlib=yes echo "$as_me:$LINENO: result: yes: $NETLIB_VERSIONS" >&5 echo "${ECHO_T}yes: $NETLIB_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then NETLIB_LIBS=`echo " $NETLIB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi NETLIB_PCREQUIRES="coindatanetlib" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else NETLIB_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatanetlib"` coin_has_netlib=notGiven echo "$as_me:$LINENO: result: not given: $NETLIB_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $NETLIB_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Netlib without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Netlib without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Netlib (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Netlib (fallback)... $ECHO_C" >&6 coin_has_netlib=notGiven NETLIB_LIBS= NETLIB_LIBS_INSTALLED= NETLIB_CFLAGS= NETLIB_CFLAGS_INSTALLED= NETLIB_DATA= NETLIB_DATA_INSTALLED= NETLIB_PCLIBS= NETLIB_PCREQUIRES= # initial list of dependencies is "coindatanetlib", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatanetlib" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$NETLIB_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` NETLIB_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$NETLIB_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi NETLIB_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS="$projcflags $NETLIB_CFLAGS" # set LIBS variable NETLIB_LIBS="$projlibs $NETLIB_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS_INSTALLED="$projcflags $NETLIB_CFLAGS_INSTALLED" # set LIBS variable NETLIB_LIBS_INSTALLED="$projlibs $NETLIB_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_netlib=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NETLIB 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then NETLIB_LIBS=`echo " $NETLIB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` NETLIB_LIBS_INSTALLED=`echo " $NETLIB_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi NETLIB_PCREQUIRES="coindatanetlib" fi if test $coin_has_netlib != notGiven && test $coin_has_netlib != skipping; then COIN_HAS_NETLIB_TRUE= COIN_HAS_NETLIB_FALSE='#' else COIN_HAS_NETLIB_TRUE='#' COIN_HAS_NETLIB_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_netlib" >&5 echo "${ECHO_T}$coin_has_netlib" >&6 fi if test $coin_has_netlib != skipping && test $coin_has_netlib != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NETLIB 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) NETLIB_DEPENDENCIES=`echo " $NETLIB_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$NETLIB_CFLAGS" ; then { echo "$as_me:$LINENO: Netlib CFLAGS are $NETLIB_CFLAGS" >&5 echo "$as_me: Netlib CFLAGS are $NETLIB_CFLAGS" >&6;} fi if test -n "$NETLIB_LIBS" ; then { echo "$as_me:$LINENO: Netlib LIBS are $NETLIB_LIBS" >&5 echo "$as_me: Netlib LIBS are $NETLIB_LIBS" >&6;} fi if test -n "$NETLIB_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Netlib DEPENDENCIES are $NETLIB_DEPENDENCIES" >&5 echo "$as_me: Netlib DEPENDENCIES are $NETLIB_DEPENDENCIES" >&6;} fi if test -n "$NETLIB_DATA" ; then { echo "$as_me:$LINENO: Netlib DATA is $NETLIB_DATA" >&5 echo "$as_me: Netlib DATA is $NETLIB_DATA" >&6;} fi if test -n "$NETLIB_PCLIBS" ; then { echo "$as_me:$LINENO: Netlib PCLIBS are $NETLIB_PCLIBS" >&5 echo "$as_me: Netlib PCLIBS are $NETLIB_PCLIBS" >&6;} fi if test -n "$NETLIB_PCREQUIRES" ; then { echo "$as_me:$LINENO: Netlib PCREQUIRES are $NETLIB_PCREQUIRES" >&5 echo "$as_me: Netlib PCREQUIRES are $NETLIB_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_netlib != notGiven && test $coin_has_netlib != skipping; then COIN_HAS_NETLIB_TRUE= COIN_HAS_NETLIB_FALSE='#' else COIN_HAS_NETLIB_TRUE='#' COIN_HAS_NETLIB_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Miplib3" >&5 echo $ECHO_N "checking for COIN-OR package Miplib3... $ECHO_C" >&6 coin_has_miplib3=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Miplib3"; then coin_has_miplib3=skipping fi done fi if test "$coin_has_miplib3" != skipping; then # Check whether --with-m4_tolower(Miplib3) or --without-m4_tolower(Miplib3) was given. if test "${with_miplib3+set}" = set; then withval="$with_miplib3" if test "$withval" = no ; then coin_has_miplib3=skipping fi fi; fi MIPLIB3_LIBS= MIPLIB3_CFLAGS= MIPLIB3_DATA= MIPLIB3_DEPENDENCIES= MIPLIB3_PCLIBS= MIPLIB3_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_miplib3 != skipping; then # Check whether --with-m4_tolower(Miplib3)-lib or --without-m4_tolower(Miplib3)-lib was given. if test "${with_miplib3_lib+set}" = set; then withval="$with_miplib3_lib" if test "$withval" = no ; then coin_has_miplib3=skipping else coin_has_miplib3=yes MIPLIB3_LIBS="$withval" MIPLIB3_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MIPLIB3_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_miplib3 != skipping; then # Check whether --with-m4_tolower(Miplib3)-incdir or --without-m4_tolower(Miplib3)-incdir was given. if test "${with_miplib3_incdir+set}" = set; then withval="$with_miplib3_incdir" if test "$withval" = no ; then coin_has_miplib3=skipping else coin_has_miplib3=yes MIPLIB3_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MIPLIB3_CFLAGS_INSTALLED="$MIPLIB3_CFLAGS" fi fi fi; fi if test $coin_has_miplib3 != skipping; then # Check whether --with-m4_tolower(Miplib3)-datadir or --without-m4_tolower(Miplib3)-datadir was given. if test "${with_miplib3_datadir+set}" = set; then withval="$with_miplib3_datadir" if test "$withval" = no ; then coin_has_miplib3=skipping else coin_has_miplib3=yes MIPLIB3_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MIPLIB3_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_miplib3 = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatamiplib3"; then MIPLIB3_VERSIONS=`$PKG_CONFIG --modversion "coindatamiplib3" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatamiplib3" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MIPLIB3_CFLAGS="$cflags" MIPLIB3_LIBS=`$PKG_CONFIG --libs "coindatamiplib3" 2>/dev/null` MIPLIB3_DATA=`$PKG_CONFIG --variable=datadir "coindatamiplib3" 2>/dev/null` coin_has_miplib3=yes echo "$as_me:$LINENO: result: yes: $MIPLIB3_VERSIONS" >&5 echo "${ECHO_T}yes: $MIPLIB3_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then MIPLIB3_LIBS=`echo " $MIPLIB3_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi MIPLIB3_PCREQUIRES="coindatamiplib3" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else MIPLIB3_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatamiplib3"` coin_has_miplib3=notGiven echo "$as_me:$LINENO: result: not given: $MIPLIB3_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $MIPLIB3_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Miplib3 without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Miplib3 without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Miplib3 (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Miplib3 (fallback)... $ECHO_C" >&6 coin_has_miplib3=notGiven MIPLIB3_LIBS= MIPLIB3_LIBS_INSTALLED= MIPLIB3_CFLAGS= MIPLIB3_CFLAGS_INSTALLED= MIPLIB3_DATA= MIPLIB3_DATA_INSTALLED= MIPLIB3_PCLIBS= MIPLIB3_PCREQUIRES= # initial list of dependencies is "coindatamiplib3", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatamiplib3" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$MIPLIB3_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` MIPLIB3_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$MIPLIB3_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi MIPLIB3_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MIPLIB3_CFLAGS="$projcflags $MIPLIB3_CFLAGS" # set LIBS variable MIPLIB3_LIBS="$projlibs $MIPLIB3_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MIPLIB3_CFLAGS_INSTALLED="$projcflags $MIPLIB3_CFLAGS_INSTALLED" # set LIBS variable MIPLIB3_LIBS_INSTALLED="$projlibs $MIPLIB3_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_miplib3=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_MIPLIB3 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then MIPLIB3_LIBS=`echo " $MIPLIB3_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` MIPLIB3_LIBS_INSTALLED=`echo " $MIPLIB3_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi MIPLIB3_PCREQUIRES="coindatamiplib3" fi if test $coin_has_miplib3 != notGiven && test $coin_has_miplib3 != skipping; then COIN_HAS_MIPLIB3_TRUE= COIN_HAS_MIPLIB3_FALSE='#' else COIN_HAS_MIPLIB3_TRUE='#' COIN_HAS_MIPLIB3_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_miplib3" >&5 echo "${ECHO_T}$coin_has_miplib3" >&6 fi if test $coin_has_miplib3 != skipping && test $coin_has_miplib3 != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_MIPLIB3 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) MIPLIB3_DEPENDENCIES=`echo " $MIPLIB3_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$MIPLIB3_CFLAGS" ; then { echo "$as_me:$LINENO: Miplib3 CFLAGS are $MIPLIB3_CFLAGS" >&5 echo "$as_me: Miplib3 CFLAGS are $MIPLIB3_CFLAGS" >&6;} fi if test -n "$MIPLIB3_LIBS" ; then { echo "$as_me:$LINENO: Miplib3 LIBS are $MIPLIB3_LIBS" >&5 echo "$as_me: Miplib3 LIBS are $MIPLIB3_LIBS" >&6;} fi if test -n "$MIPLIB3_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Miplib3 DEPENDENCIES are $MIPLIB3_DEPENDENCIES" >&5 echo "$as_me: Miplib3 DEPENDENCIES are $MIPLIB3_DEPENDENCIES" >&6;} fi if test -n "$MIPLIB3_DATA" ; then { echo "$as_me:$LINENO: Miplib3 DATA is $MIPLIB3_DATA" >&5 echo "$as_me: Miplib3 DATA is $MIPLIB3_DATA" >&6;} fi if test -n "$MIPLIB3_PCLIBS" ; then { echo "$as_me:$LINENO: Miplib3 PCLIBS are $MIPLIB3_PCLIBS" >&5 echo "$as_me: Miplib3 PCLIBS are $MIPLIB3_PCLIBS" >&6;} fi if test -n "$MIPLIB3_PCREQUIRES" ; then { echo "$as_me:$LINENO: Miplib3 PCREQUIRES are $MIPLIB3_PCREQUIRES" >&5 echo "$as_me: Miplib3 PCREQUIRES are $MIPLIB3_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_miplib3 != notGiven && test $coin_has_miplib3 != skipping; then COIN_HAS_MIPLIB3_TRUE= COIN_HAS_MIPLIB3_FALSE='#' else COIN_HAS_MIPLIB3_TRUE='#' COIN_HAS_MIPLIB3_FALSE= fi # Cbc really should make these tests; right now it assumes far too much about # its environment. Needed for cbc-generic. ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cmath],[],[],[$hdr]) for ac_header in cmath do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to cbc@lists.coin-or.org ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cmath" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([math.h],[],[],[$hdr]) for ac_header in math.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to cbc@lists.coin-or.org ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cfloat],[],[],[$hdr]) for ac_header in cfloat do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to cbc@lists.coin-or.org ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cfloat" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([float.h],[],[],[$hdr]) for ac_header in float.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to cbc@lists.coin-or.org ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cieeefp],[],[],[$hdr]) for ac_header in cieeefp do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to cbc@lists.coin-or.org ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cieeefp" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([ieeefp.h],[],[],[$hdr]) for ac_header in ieeefp.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to cbc@lists.coin-or.org ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --enable-gnu-packages or --disable-gnu-packages was given. if test "${enable_gnu_packages+set}" = set; then enableval="$enable_gnu_packages" coin_enable_gnu=$enableval else coin_enable_gnu=no fi; coin_has_readline=no if test $coin_enable_gnu = yes; then #if test x"#include " = x; then # hdr="#include " #else # hdr="#include " #fi #AC_CHECK_HEADERS([readline/readline.h],[coin_has_readline=yes],[],[$hdr]) for ac_header in readline/readline.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF coin_has_readline=yes fi done coin_save_LIBS="$LIBS" LIBS= # First we check if tputs and friends are available if test $coin_has_readline = yes; then echo "$as_me:$LINENO: checking for library containing tputs" >&5 echo $ECHO_N "checking for library containing tputs... $ECHO_C" >&6 if test "${ac_cv_search_tputs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_tputs=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tputs (); int main () { tputs (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_tputs="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_tputs" = no; then for ac_lib in ncurses termcap curses; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tputs (); int main () { tputs (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_tputs="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_tputs" >&5 echo "${ECHO_T}$ac_cv_search_tputs" >&6 if test "$ac_cv_search_tputs" != no; then test "$ac_cv_search_tputs" = "none required" || LIBS="$ac_cv_search_tputs $LIBS" else coin_has_readline=no fi fi # Now we check for readline if test $coin_has_readline = yes; then echo "$as_me:$LINENO: checking for readline in -lreadline" >&5 echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6 if test "${ac_cv_lib_readline_readline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char readline (); int main () { readline (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_readline_readline=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_readline=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5 echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6 if test $ac_cv_lib_readline_readline = yes; then : else coin_has_readline=no fi fi if test $coin_has_readline = yes; then CBCLIB_LIBS="-lreadline $LIBS $CBCLIB_LIBS" CBCLIB_PCLIBS="-lreadline $LIBS $CBCLIB_PCLIBS" CBCLIB_LIBS_INSTALLED="-lreadline $LIBS $CBCLIB_LIBS_INSTALLED" CBCGENERIC_LIBS="-lreadline $LIBS $CBCGENERIC_LIBS" CBCGENERIC_PCLIBS="-lreadline $LIBS $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS_INSTALLED="-lreadline $LIBS $CBCGENERIC_LIBS_INSTALLED" cat >>confdefs.h <<\_ACEOF #define COIN_HAS_READLINE 1 _ACEOF fi LIBS="$coin_save_LIBS" fi ############################################################################# # LP solvers other than CLP # ############################################################################# # Check which other LP solvers are available, some of them become a dependency of CbcGeneric echo "$as_me:$LINENO: checking for COIN-OR package DyLP" >&5 echo $ECHO_N "checking for COIN-OR package DyLP... $ECHO_C" >&6 coin_has_dylp=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "DyLP"; then coin_has_dylp=skipping fi done fi if test "$coin_has_dylp" != skipping; then # Check whether --with-m4_tolower(DyLP) or --without-m4_tolower(DyLP) was given. if test "${with_dylp+set}" = set; then withval="$with_dylp" if test "$withval" = no ; then coin_has_dylp=skipping fi fi; fi DYLP_LIBS= DYLP_CFLAGS= DYLP_DATA= DYLP_DEPENDENCIES= DYLP_PCLIBS= DYLP_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_dylp != skipping; then # Check whether --with-m4_tolower(DyLP)-lib or --without-m4_tolower(DyLP)-lib was given. if test "${with_dylp_lib+set}" = set; then withval="$with_dylp_lib" if test "$withval" = no ; then coin_has_dylp=skipping else coin_has_dylp=yes DYLP_LIBS="$withval" DYLP_PCLIBS="$withval" CBCGENERIC_PCLIBS="$withval $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS="$withval $CBCGENERIC_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then DYLP_LIBS_INSTALLED="$withval" CBCGENERIC_LIBS_INSTALLED="$withval $CBCGENERIC_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_dylp != skipping; then # Check whether --with-m4_tolower(DyLP)-incdir or --without-m4_tolower(DyLP)-incdir was given. if test "${with_dylp_incdir+set}" = set; then withval="$with_dylp_incdir" if test "$withval" = no ; then coin_has_dylp=skipping else coin_has_dylp=yes DYLP_CFLAGS="-I`${CYGPATH_W} $withval`" CBCGENERIC_CFLAGS="-I`${CYGPATH_W} $withval` $CBCGENERIC_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then DYLP_CFLAGS_INSTALLED="$DYLP_CFLAGS" CBCGENERIC_CFLAGS_INSTALLED="$DYLP_CFLAGS $CBCGENERIC_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_dylp != skipping; then # Check whether --with-m4_tolower(DyLP)-datadir or --without-m4_tolower(DyLP)-datadir was given. if test "${with_dylp_datadir+set}" = set; then withval="$with_dylp_datadir" if test "$withval" = no ; then coin_has_dylp=skipping else coin_has_dylp=yes DYLP_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then DYLP_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_dylp = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-dylp"; then DYLP_VERSIONS=`$PKG_CONFIG --modversion "osi-dylp" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-dylp" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi DYLP_CFLAGS="$cflags" DYLP_LIBS=`$PKG_CONFIG --libs "osi-dylp" 2>/dev/null` DYLP_DATA=`$PKG_CONFIG --variable=datadir "osi-dylp" 2>/dev/null` coin_has_dylp=yes echo "$as_me:$LINENO: result: yes: $DYLP_VERSIONS" >&5 echo "${ECHO_T}yes: $DYLP_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then DYLP_LIBS=`echo " $DYLP_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi DYLP_PCREQUIRES="osi-dylp" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CbcGeneric CBCGENERIC_PCREQUIRES="osi-dylp $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$DYLP_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$DYLP_LIBS $CBCGENERIC_LIBS" else DYLP_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-dylp"` coin_has_dylp=notGiven echo "$as_me:$LINENO: result: not given: $DYLP_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $DYLP_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module DyLP without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module DyLP without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package DyLP (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package DyLP (fallback)... $ECHO_C" >&6 coin_has_dylp=notGiven DYLP_LIBS= DYLP_LIBS_INSTALLED= DYLP_CFLAGS= DYLP_CFLAGS_INSTALLED= DYLP_DATA= DYLP_DATA_INSTALLED= DYLP_PCLIBS= DYLP_PCREQUIRES= # initial list of dependencies is "osi-dylp", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-dylp" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$DYLP_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` DYLP_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$DYLP_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi DYLP_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi DYLP_CFLAGS="$projcflags $DYLP_CFLAGS" # set LIBS variable DYLP_LIBS="$projlibs $DYLP_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi DYLP_CFLAGS_INSTALLED="$projcflags $DYLP_CFLAGS_INSTALLED" # set LIBS variable DYLP_LIBS_INSTALLED="$projlibs $DYLP_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_dylp=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_DYLP 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then DYLP_LIBS=`echo " $DYLP_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` DYLP_LIBS_INSTALLED=`echo " $DYLP_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi DYLP_PCREQUIRES="osi-dylp" CBCGENERIC_PCREQUIRES="osi-dylp $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$DYLP_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$DYLP_LIBS $CBCGENERIC_LIBS" CBCGENERIC_CFLAGS_INSTALLED="$DYLP_CFLAGS_INSTALLED $CBCGENERIC_CFLAGS_INSTALLED" CBCGENERIC_LIBS_INSTALLED="$DYLP_LIBS_INSTALLED $CBCGENERIC_LIBS_INSTALLED" fi if test $coin_has_dylp != notGiven && test $coin_has_dylp != skipping; then COIN_HAS_DYLP_TRUE= COIN_HAS_DYLP_FALSE='#' else COIN_HAS_DYLP_TRUE='#' COIN_HAS_DYLP_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_dylp" >&5 echo "${ECHO_T}$coin_has_dylp" >&6 fi if test $coin_has_dylp != skipping && test $coin_has_dylp != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_DYLP 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) DYLP_DEPENDENCIES=`echo " $DYLP_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCGENERIC_DEPENDENCIES=`echo " $CBCGENERIC_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$DYLP_CFLAGS" ; then { echo "$as_me:$LINENO: DyLP CFLAGS are $DYLP_CFLAGS" >&5 echo "$as_me: DyLP CFLAGS are $DYLP_CFLAGS" >&6;} fi if test -n "$DYLP_LIBS" ; then { echo "$as_me:$LINENO: DyLP LIBS are $DYLP_LIBS" >&5 echo "$as_me: DyLP LIBS are $DYLP_LIBS" >&6;} fi if test -n "$DYLP_DEPENDENCIES" ; then { echo "$as_me:$LINENO: DyLP DEPENDENCIES are $DYLP_DEPENDENCIES" >&5 echo "$as_me: DyLP DEPENDENCIES are $DYLP_DEPENDENCIES" >&6;} fi if test -n "$DYLP_DATA" ; then { echo "$as_me:$LINENO: DyLP DATA is $DYLP_DATA" >&5 echo "$as_me: DyLP DATA is $DYLP_DATA" >&6;} fi if test -n "$DYLP_PCLIBS" ; then { echo "$as_me:$LINENO: DyLP PCLIBS are $DYLP_PCLIBS" >&5 echo "$as_me: DyLP PCLIBS are $DYLP_PCLIBS" >&6;} fi if test -n "$DYLP_PCREQUIRES" ; then { echo "$as_me:$LINENO: DyLP PCREQUIRES are $DYLP_PCREQUIRES" >&5 echo "$as_me: DyLP PCREQUIRES are $DYLP_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&5 echo "$as_me: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&5 echo "$as_me: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&6;} { echo "$as_me:$LINENO: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&5 echo "$as_me: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_dylp != notGiven && test $coin_has_dylp != skipping; then COIN_HAS_DYLP_TRUE= COIN_HAS_DYLP_FALSE='#' else COIN_HAS_DYLP_TRUE='#' COIN_HAS_DYLP_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Vol" >&5 echo $ECHO_N "checking for COIN-OR package Vol... $ECHO_C" >&6 coin_has_vol=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Vol"; then coin_has_vol=skipping fi done fi if test "$coin_has_vol" != skipping; then # Check whether --with-m4_tolower(Vol) or --without-m4_tolower(Vol) was given. if test "${with_vol+set}" = set; then withval="$with_vol" if test "$withval" = no ; then coin_has_vol=skipping fi fi; fi VOL_LIBS= VOL_CFLAGS= VOL_DATA= VOL_DEPENDENCIES= VOL_PCLIBS= VOL_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_vol != skipping; then # Check whether --with-m4_tolower(Vol)-lib or --without-m4_tolower(Vol)-lib was given. if test "${with_vol_lib+set}" = set; then withval="$with_vol_lib" if test "$withval" = no ; then coin_has_vol=skipping else coin_has_vol=yes VOL_LIBS="$withval" VOL_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then VOL_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_vol != skipping; then # Check whether --with-m4_tolower(Vol)-incdir or --without-m4_tolower(Vol)-incdir was given. if test "${with_vol_incdir+set}" = set; then withval="$with_vol_incdir" if test "$withval" = no ; then coin_has_vol=skipping else coin_has_vol=yes VOL_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then VOL_CFLAGS_INSTALLED="$VOL_CFLAGS" fi fi fi; fi if test $coin_has_vol != skipping; then # Check whether --with-m4_tolower(Vol)-datadir or --without-m4_tolower(Vol)-datadir was given. if test "${with_vol_datadir+set}" = set; then withval="$with_vol_datadir" if test "$withval" = no ; then coin_has_vol=skipping else coin_has_vol=yes VOL_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then VOL_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_vol = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-vol"; then VOL_VERSIONS=`$PKG_CONFIG --modversion "osi-vol" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-vol" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi VOL_CFLAGS="$cflags" VOL_LIBS=`$PKG_CONFIG --libs "osi-vol" 2>/dev/null` VOL_DATA=`$PKG_CONFIG --variable=datadir "osi-vol" 2>/dev/null` coin_has_vol=yes echo "$as_me:$LINENO: result: yes: $VOL_VERSIONS" >&5 echo "${ECHO_T}yes: $VOL_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then VOL_LIBS=`echo " $VOL_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi VOL_PCREQUIRES="osi-vol" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else VOL_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-vol"` coin_has_vol=notGiven echo "$as_me:$LINENO: result: not given: $VOL_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $VOL_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Vol without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Vol without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Vol (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Vol (fallback)... $ECHO_C" >&6 coin_has_vol=notGiven VOL_LIBS= VOL_LIBS_INSTALLED= VOL_CFLAGS= VOL_CFLAGS_INSTALLED= VOL_DATA= VOL_DATA_INSTALLED= VOL_PCLIBS= VOL_PCREQUIRES= # initial list of dependencies is "osi-vol", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-vol" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$VOL_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` VOL_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$VOL_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi VOL_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi VOL_CFLAGS="$projcflags $VOL_CFLAGS" # set LIBS variable VOL_LIBS="$projlibs $VOL_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi VOL_CFLAGS_INSTALLED="$projcflags $VOL_CFLAGS_INSTALLED" # set LIBS variable VOL_LIBS_INSTALLED="$projlibs $VOL_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_vol=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_VOL 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then VOL_LIBS=`echo " $VOL_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` VOL_LIBS_INSTALLED=`echo " $VOL_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi VOL_PCREQUIRES="osi-vol" fi if test $coin_has_vol != notGiven && test $coin_has_vol != skipping; then COIN_HAS_VOL_TRUE= COIN_HAS_VOL_FALSE='#' else COIN_HAS_VOL_TRUE='#' COIN_HAS_VOL_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_vol" >&5 echo "${ECHO_T}$coin_has_vol" >&6 fi if test $coin_has_vol != skipping && test $coin_has_vol != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_VOL 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) VOL_DEPENDENCIES=`echo " $VOL_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$VOL_CFLAGS" ; then { echo "$as_me:$LINENO: Vol CFLAGS are $VOL_CFLAGS" >&5 echo "$as_me: Vol CFLAGS are $VOL_CFLAGS" >&6;} fi if test -n "$VOL_LIBS" ; then { echo "$as_me:$LINENO: Vol LIBS are $VOL_LIBS" >&5 echo "$as_me: Vol LIBS are $VOL_LIBS" >&6;} fi if test -n "$VOL_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Vol DEPENDENCIES are $VOL_DEPENDENCIES" >&5 echo "$as_me: Vol DEPENDENCIES are $VOL_DEPENDENCIES" >&6;} fi if test -n "$VOL_DATA" ; then { echo "$as_me:$LINENO: Vol DATA is $VOL_DATA" >&5 echo "$as_me: Vol DATA is $VOL_DATA" >&6;} fi if test -n "$VOL_PCLIBS" ; then { echo "$as_me:$LINENO: Vol PCLIBS are $VOL_PCLIBS" >&5 echo "$as_me: Vol PCLIBS are $VOL_PCLIBS" >&6;} fi if test -n "$VOL_PCREQUIRES" ; then { echo "$as_me:$LINENO: Vol PCREQUIRES are $VOL_PCREQUIRES" >&5 echo "$as_me: Vol PCREQUIRES are $VOL_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_vol != notGiven && test $coin_has_vol != skipping; then COIN_HAS_VOL_TRUE= COIN_HAS_VOL_FALSE='#' else COIN_HAS_VOL_TRUE='#' COIN_HAS_VOL_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Cpx" >&5 echo $ECHO_N "checking for COIN-OR package Cpx... $ECHO_C" >&6 coin_has_cpx=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Cpx"; then coin_has_cpx=skipping fi done fi if test "$coin_has_cpx" != skipping; then # Check whether --with-m4_tolower(Cpx) or --without-m4_tolower(Cpx) was given. if test "${with_cpx+set}" = set; then withval="$with_cpx" if test "$withval" = no ; then coin_has_cpx=skipping fi fi; fi CPX_LIBS= CPX_CFLAGS= CPX_DATA= CPX_DEPENDENCIES= CPX_PCLIBS= CPX_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_cpx != skipping; then # Check whether --with-m4_tolower(Cpx)-lib or --without-m4_tolower(Cpx)-lib was given. if test "${with_cpx_lib+set}" = set; then withval="$with_cpx_lib" if test "$withval" = no ; then coin_has_cpx=skipping else coin_has_cpx=yes CPX_LIBS="$withval" CPX_PCLIBS="$withval" CBCLIB_PCLIBS="$withval $CBCLIB_PCLIBS" CBCLIB_LIBS="$withval $CBCLIB_LIBS" CBCGENERIC_PCLIBS="$withval $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS="$withval $CBCGENERIC_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CPX_LIBS_INSTALLED="$withval" CBCLIB_LIBS_INSTALLED="$withval $CBCLIB_LIBS_INSTALLED"CBCGENERIC_LIBS_INSTALLED="$withval $CBCGENERIC_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_cpx != skipping; then # Check whether --with-m4_tolower(Cpx)-incdir or --without-m4_tolower(Cpx)-incdir was given. if test "${with_cpx_incdir+set}" = set; then withval="$with_cpx_incdir" if test "$withval" = no ; then coin_has_cpx=skipping else coin_has_cpx=yes CPX_CFLAGS="-I`${CYGPATH_W} $withval`" CBCLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CBCLIB_CFLAGS"CBCGENERIC_CFLAGS="-I`${CYGPATH_W} $withval` $CBCGENERIC_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CPX_CFLAGS_INSTALLED="$CPX_CFLAGS" CBCLIB_CFLAGS_INSTALLED="$CPX_CFLAGS $CBCLIB_CFLAGS_INSTALLED"CBCGENERIC_CFLAGS_INSTALLED="$CPX_CFLAGS $CBCGENERIC_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_cpx != skipping; then # Check whether --with-m4_tolower(Cpx)-datadir or --without-m4_tolower(Cpx)-datadir was given. if test "${with_cpx_datadir+set}" = set; then withval="$with_cpx_datadir" if test "$withval" = no ; then coin_has_cpx=skipping else coin_has_cpx=yes CPX_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CPX_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_cpx = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-cplex"; then CPX_VERSIONS=`$PKG_CONFIG --modversion "osi-cplex" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-cplex" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CPX_CFLAGS="$cflags" CPX_LIBS=`$PKG_CONFIG --libs "osi-cplex" 2>/dev/null` CPX_DATA=`$PKG_CONFIG --variable=datadir "osi-cplex" 2>/dev/null` coin_has_cpx=yes echo "$as_me:$LINENO: result: yes: $CPX_VERSIONS" >&5 echo "${ECHO_T}yes: $CPX_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then CPX_LIBS=`echo " $CPX_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi CPX_PCREQUIRES="osi-cplex" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CbcLib CbcGeneric CBCLIB_PCREQUIRES="osi-cplex $CBCLIB_PCREQUIRES" CBCLIB_CFLAGS="$CPX_CFLAGS $CBCLIB_CFLAGS" CBCLIB_LIBS="$CPX_LIBS $CBCLIB_LIBS" CBCGENERIC_PCREQUIRES="osi-cplex $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$CPX_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$CPX_LIBS $CBCGENERIC_LIBS" else CPX_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-cplex"` coin_has_cpx=notGiven echo "$as_me:$LINENO: result: not given: $CPX_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $CPX_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Cpx without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Cpx without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Cpx (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Cpx (fallback)... $ECHO_C" >&6 coin_has_cpx=notGiven CPX_LIBS= CPX_LIBS_INSTALLED= CPX_CFLAGS= CPX_CFLAGS_INSTALLED= CPX_DATA= CPX_DATA_INSTALLED= CPX_PCLIBS= CPX_PCREQUIRES= # initial list of dependencies is "osi-cplex", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-cplex" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$CPX_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` CPX_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$CPX_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi CPX_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CPX_CFLAGS="$projcflags $CPX_CFLAGS" # set LIBS variable CPX_LIBS="$projlibs $CPX_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CPX_CFLAGS_INSTALLED="$projcflags $CPX_CFLAGS_INSTALLED" # set LIBS variable CPX_LIBS_INSTALLED="$projlibs $CPX_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_cpx=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_CPX 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then CPX_LIBS=`echo " $CPX_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` CPX_LIBS_INSTALLED=`echo " $CPX_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi CPX_PCREQUIRES="osi-cplex" CBCLIB_PCREQUIRES="osi-cplex $CBCLIB_PCREQUIRES" CBCLIB_CFLAGS="$CPX_CFLAGS $CBCLIB_CFLAGS" CBCLIB_LIBS="$CPX_LIBS $CBCLIB_LIBS" CBCLIB_CFLAGS_INSTALLED="$CPX_CFLAGS_INSTALLED $CBCLIB_CFLAGS_INSTALLED" CBCLIB_LIBS_INSTALLED="$CPX_LIBS_INSTALLED $CBCLIB_LIBS_INSTALLED" CBCGENERIC_PCREQUIRES="osi-cplex $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$CPX_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$CPX_LIBS $CBCGENERIC_LIBS" CBCGENERIC_CFLAGS_INSTALLED="$CPX_CFLAGS_INSTALLED $CBCGENERIC_CFLAGS_INSTALLED" CBCGENERIC_LIBS_INSTALLED="$CPX_LIBS_INSTALLED $CBCGENERIC_LIBS_INSTALLED" fi if test $coin_has_cpx != notGiven && test $coin_has_cpx != skipping; then COIN_HAS_CPX_TRUE= COIN_HAS_CPX_FALSE='#' else COIN_HAS_CPX_TRUE='#' COIN_HAS_CPX_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_cpx" >&5 echo "${ECHO_T}$coin_has_cpx" >&6 fi if test $coin_has_cpx != skipping && test $coin_has_cpx != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_CPX 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) CPX_DEPENDENCIES=`echo " $CPX_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCLIB_DEPENDENCIES=`echo " $CBCLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCGENERIC_DEPENDENCIES=`echo " $CBCGENERIC_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$CPX_CFLAGS" ; then { echo "$as_me:$LINENO: Cpx CFLAGS are $CPX_CFLAGS" >&5 echo "$as_me: Cpx CFLAGS are $CPX_CFLAGS" >&6;} fi if test -n "$CPX_LIBS" ; then { echo "$as_me:$LINENO: Cpx LIBS are $CPX_LIBS" >&5 echo "$as_me: Cpx LIBS are $CPX_LIBS" >&6;} fi if test -n "$CPX_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Cpx DEPENDENCIES are $CPX_DEPENDENCIES" >&5 echo "$as_me: Cpx DEPENDENCIES are $CPX_DEPENDENCIES" >&6;} fi if test -n "$CPX_DATA" ; then { echo "$as_me:$LINENO: Cpx DATA is $CPX_DATA" >&5 echo "$as_me: Cpx DATA is $CPX_DATA" >&6;} fi if test -n "$CPX_PCLIBS" ; then { echo "$as_me:$LINENO: Cpx PCLIBS are $CPX_PCLIBS" >&5 echo "$as_me: Cpx PCLIBS are $CPX_PCLIBS" >&6;} fi if test -n "$CPX_PCREQUIRES" ; then { echo "$as_me:$LINENO: Cpx PCREQUIRES are $CPX_PCREQUIRES" >&5 echo "$as_me: Cpx PCREQUIRES are $CPX_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CbcLib CFLAGS are $CBCLIB_CFLAGS" >&5 echo "$as_me: CbcLib CFLAGS are $CBCLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcLib LIBS are $CBCLIB_LIBS" >&5 echo "$as_me: CbcLib LIBS are $CBCLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CbcLib DEPENDENCIES are $CBCLIB_DEPENDENCIES" >&5 echo "$as_me: CbcLib DEPENDENCIES are $CBCLIB_DEPENDENCIES" >&6;} { echo "$as_me:$LINENO: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&5 echo "$as_me: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&5 echo "$as_me: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&6;} { echo "$as_me:$LINENO: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&5 echo "$as_me: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_cpx != notGiven && test $coin_has_cpx != skipping; then COIN_HAS_CPX_TRUE= COIN_HAS_CPX_FALSE='#' else COIN_HAS_CPX_TRUE='#' COIN_HAS_CPX_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Glpk" >&5 echo $ECHO_N "checking for COIN-OR package Glpk... $ECHO_C" >&6 coin_has_glpk=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Glpk"; then coin_has_glpk=skipping fi done fi if test "$coin_has_glpk" != skipping; then # Check whether --with-m4_tolower(Glpk) or --without-m4_tolower(Glpk) was given. if test "${with_glpk+set}" = set; then withval="$with_glpk" if test "$withval" = no ; then coin_has_glpk=skipping fi fi; fi GLPK_LIBS= GLPK_CFLAGS= GLPK_DATA= GLPK_DEPENDENCIES= GLPK_PCLIBS= GLPK_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-lib or --without-m4_tolower(Glpk)-lib was given. if test "${with_glpk_lib+set}" = set; then withval="$with_glpk_lib" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_LIBS="$withval" GLPK_PCLIBS="$withval" CBCGENERIC_PCLIBS="$withval $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS="$withval $CBCGENERIC_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_LIBS_INSTALLED="$withval" CBCGENERIC_LIBS_INSTALLED="$withval $CBCGENERIC_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-incdir or --without-m4_tolower(Glpk)-incdir was given. if test "${with_glpk_incdir+set}" = set; then withval="$with_glpk_incdir" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_CFLAGS="-I`${CYGPATH_W} $withval`" CBCGENERIC_CFLAGS="-I`${CYGPATH_W} $withval` $CBCGENERIC_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_CFLAGS_INSTALLED="$GLPK_CFLAGS" CBCGENERIC_CFLAGS_INSTALLED="$GLPK_CFLAGS $CBCGENERIC_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-datadir or --without-m4_tolower(Glpk)-datadir was given. if test "${with_glpk_datadir+set}" = set; then withval="$with_glpk_datadir" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_glpk = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-glpk"; then GLPK_VERSIONS=`$PKG_CONFIG --modversion "osi-glpk" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-glpk" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS="$cflags" GLPK_LIBS=`$PKG_CONFIG --libs "osi-glpk" 2>/dev/null` GLPK_DATA=`$PKG_CONFIG --variable=datadir "osi-glpk" 2>/dev/null` coin_has_glpk=yes echo "$as_me:$LINENO: result: yes: $GLPK_VERSIONS" >&5 echo "${ECHO_T}yes: $GLPK_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GLPK_LIBS=`echo " $GLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi GLPK_PCREQUIRES="osi-glpk" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CbcGeneric CBCGENERIC_PCREQUIRES="osi-glpk $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$GLPK_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$GLPK_LIBS $CBCGENERIC_LIBS" else GLPK_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-glpk"` coin_has_glpk=notGiven echo "$as_me:$LINENO: result: not given: $GLPK_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $GLPK_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Glpk without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Glpk without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Glpk (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Glpk (fallback)... $ECHO_C" >&6 coin_has_glpk=notGiven GLPK_LIBS= GLPK_LIBS_INSTALLED= GLPK_CFLAGS= GLPK_CFLAGS_INSTALLED= GLPK_DATA= GLPK_DATA_INSTALLED= GLPK_PCLIBS= GLPK_PCREQUIRES= # initial list of dependencies is "osi-glpk", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-glpk" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$GLPK_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` GLPK_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$GLPK_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi GLPK_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS="$projcflags $GLPK_CFLAGS" # set LIBS variable GLPK_LIBS="$projlibs $GLPK_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS_INSTALLED="$projcflags $GLPK_CFLAGS_INSTALLED" # set LIBS variable GLPK_LIBS_INSTALLED="$projlibs $GLPK_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_glpk=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GLPK 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GLPK_LIBS=`echo " $GLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` GLPK_LIBS_INSTALLED=`echo " $GLPK_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi GLPK_PCREQUIRES="osi-glpk" CBCGENERIC_PCREQUIRES="osi-glpk $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$GLPK_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$GLPK_LIBS $CBCGENERIC_LIBS" CBCGENERIC_CFLAGS_INSTALLED="$GLPK_CFLAGS_INSTALLED $CBCGENERIC_CFLAGS_INSTALLED" CBCGENERIC_LIBS_INSTALLED="$GLPK_LIBS_INSTALLED $CBCGENERIC_LIBS_INSTALLED" fi if test $coin_has_glpk != notGiven && test $coin_has_glpk != skipping; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_glpk" >&5 echo "${ECHO_T}$coin_has_glpk" >&6 fi if test $coin_has_glpk != skipping && test $coin_has_glpk != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GLPK 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) GLPK_DEPENDENCIES=`echo " $GLPK_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCGENERIC_DEPENDENCIES=`echo " $CBCGENERIC_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$GLPK_CFLAGS" ; then { echo "$as_me:$LINENO: Glpk CFLAGS are $GLPK_CFLAGS" >&5 echo "$as_me: Glpk CFLAGS are $GLPK_CFLAGS" >&6;} fi if test -n "$GLPK_LIBS" ; then { echo "$as_me:$LINENO: Glpk LIBS are $GLPK_LIBS" >&5 echo "$as_me: Glpk LIBS are $GLPK_LIBS" >&6;} fi if test -n "$GLPK_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Glpk DEPENDENCIES are $GLPK_DEPENDENCIES" >&5 echo "$as_me: Glpk DEPENDENCIES are $GLPK_DEPENDENCIES" >&6;} fi if test -n "$GLPK_DATA" ; then { echo "$as_me:$LINENO: Glpk DATA is $GLPK_DATA" >&5 echo "$as_me: Glpk DATA is $GLPK_DATA" >&6;} fi if test -n "$GLPK_PCLIBS" ; then { echo "$as_me:$LINENO: Glpk PCLIBS are $GLPK_PCLIBS" >&5 echo "$as_me: Glpk PCLIBS are $GLPK_PCLIBS" >&6;} fi if test -n "$GLPK_PCREQUIRES" ; then { echo "$as_me:$LINENO: Glpk PCREQUIRES are $GLPK_PCREQUIRES" >&5 echo "$as_me: Glpk PCREQUIRES are $GLPK_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&5 echo "$as_me: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&5 echo "$as_me: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&6;} { echo "$as_me:$LINENO: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&5 echo "$as_me: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_glpk != notGiven && test $coin_has_glpk != skipping; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Grb" >&5 echo $ECHO_N "checking for COIN-OR package Grb... $ECHO_C" >&6 coin_has_grb=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Grb"; then coin_has_grb=skipping fi done fi if test "$coin_has_grb" != skipping; then # Check whether --with-m4_tolower(Grb) or --without-m4_tolower(Grb) was given. if test "${with_grb+set}" = set; then withval="$with_grb" if test "$withval" = no ; then coin_has_grb=skipping fi fi; fi GRB_LIBS= GRB_CFLAGS= GRB_DATA= GRB_DEPENDENCIES= GRB_PCLIBS= GRB_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_grb != skipping; then # Check whether --with-m4_tolower(Grb)-lib or --without-m4_tolower(Grb)-lib was given. if test "${with_grb_lib+set}" = set; then withval="$with_grb_lib" if test "$withval" = no ; then coin_has_grb=skipping else coin_has_grb=yes GRB_LIBS="$withval" GRB_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GRB_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_grb != skipping; then # Check whether --with-m4_tolower(Grb)-incdir or --without-m4_tolower(Grb)-incdir was given. if test "${with_grb_incdir+set}" = set; then withval="$with_grb_incdir" if test "$withval" = no ; then coin_has_grb=skipping else coin_has_grb=yes GRB_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GRB_CFLAGS_INSTALLED="$GRB_CFLAGS" fi fi fi; fi if test $coin_has_grb != skipping; then # Check whether --with-m4_tolower(Grb)-datadir or --without-m4_tolower(Grb)-datadir was given. if test "${with_grb_datadir+set}" = set; then withval="$with_grb_datadir" if test "$withval" = no ; then coin_has_grb=skipping else coin_has_grb=yes GRB_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GRB_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_grb = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-gurobi"; then GRB_VERSIONS=`$PKG_CONFIG --modversion "osi-gurobi" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-gurobi" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GRB_CFLAGS="$cflags" GRB_LIBS=`$PKG_CONFIG --libs "osi-gurobi" 2>/dev/null` GRB_DATA=`$PKG_CONFIG --variable=datadir "osi-gurobi" 2>/dev/null` coin_has_grb=yes echo "$as_me:$LINENO: result: yes: $GRB_VERSIONS" >&5 echo "${ECHO_T}yes: $GRB_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GRB_LIBS=`echo " $GRB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi GRB_PCREQUIRES="osi-gurobi" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else GRB_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-gurobi"` coin_has_grb=notGiven echo "$as_me:$LINENO: result: not given: $GRB_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $GRB_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Grb without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Grb without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Grb (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Grb (fallback)... $ECHO_C" >&6 coin_has_grb=notGiven GRB_LIBS= GRB_LIBS_INSTALLED= GRB_CFLAGS= GRB_CFLAGS_INSTALLED= GRB_DATA= GRB_DATA_INSTALLED= GRB_PCLIBS= GRB_PCREQUIRES= # initial list of dependencies is "osi-gurobi", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-gurobi" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$GRB_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` GRB_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$GRB_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi GRB_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GRB_CFLAGS="$projcflags $GRB_CFLAGS" # set LIBS variable GRB_LIBS="$projlibs $GRB_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GRB_CFLAGS_INSTALLED="$projcflags $GRB_CFLAGS_INSTALLED" # set LIBS variable GRB_LIBS_INSTALLED="$projlibs $GRB_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_grb=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GRB 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GRB_LIBS=`echo " $GRB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` GRB_LIBS_INSTALLED=`echo " $GRB_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi GRB_PCREQUIRES="osi-gurobi" fi if test $coin_has_grb != notGiven && test $coin_has_grb != skipping; then COIN_HAS_GRB_TRUE= COIN_HAS_GRB_FALSE='#' else COIN_HAS_GRB_TRUE='#' COIN_HAS_GRB_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_grb" >&5 echo "${ECHO_T}$coin_has_grb" >&6 fi if test $coin_has_grb != skipping && test $coin_has_grb != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GRB 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) GRB_DEPENDENCIES=`echo " $GRB_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$GRB_CFLAGS" ; then { echo "$as_me:$LINENO: Grb CFLAGS are $GRB_CFLAGS" >&5 echo "$as_me: Grb CFLAGS are $GRB_CFLAGS" >&6;} fi if test -n "$GRB_LIBS" ; then { echo "$as_me:$LINENO: Grb LIBS are $GRB_LIBS" >&5 echo "$as_me: Grb LIBS are $GRB_LIBS" >&6;} fi if test -n "$GRB_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Grb DEPENDENCIES are $GRB_DEPENDENCIES" >&5 echo "$as_me: Grb DEPENDENCIES are $GRB_DEPENDENCIES" >&6;} fi if test -n "$GRB_DATA" ; then { echo "$as_me:$LINENO: Grb DATA is $GRB_DATA" >&5 echo "$as_me: Grb DATA is $GRB_DATA" >&6;} fi if test -n "$GRB_PCLIBS" ; then { echo "$as_me:$LINENO: Grb PCLIBS are $GRB_PCLIBS" >&5 echo "$as_me: Grb PCLIBS are $GRB_PCLIBS" >&6;} fi if test -n "$GRB_PCREQUIRES" ; then { echo "$as_me:$LINENO: Grb PCREQUIRES are $GRB_PCREQUIRES" >&5 echo "$as_me: Grb PCREQUIRES are $GRB_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_grb != notGiven && test $coin_has_grb != skipping; then COIN_HAS_GRB_TRUE= COIN_HAS_GRB_FALSE='#' else COIN_HAS_GRB_TRUE='#' COIN_HAS_GRB_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Msk" >&5 echo $ECHO_N "checking for COIN-OR package Msk... $ECHO_C" >&6 coin_has_msk=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Msk"; then coin_has_msk=skipping fi done fi if test "$coin_has_msk" != skipping; then # Check whether --with-m4_tolower(Msk) or --without-m4_tolower(Msk) was given. if test "${with_msk+set}" = set; then withval="$with_msk" if test "$withval" = no ; then coin_has_msk=skipping fi fi; fi MSK_LIBS= MSK_CFLAGS= MSK_DATA= MSK_DEPENDENCIES= MSK_PCLIBS= MSK_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_msk != skipping; then # Check whether --with-m4_tolower(Msk)-lib or --without-m4_tolower(Msk)-lib was given. if test "${with_msk_lib+set}" = set; then withval="$with_msk_lib" if test "$withval" = no ; then coin_has_msk=skipping else coin_has_msk=yes MSK_LIBS="$withval" MSK_PCLIBS="$withval" CBCGENERIC_PCLIBS="$withval $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS="$withval $CBCGENERIC_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MSK_LIBS_INSTALLED="$withval" CBCGENERIC_LIBS_INSTALLED="$withval $CBCGENERIC_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_msk != skipping; then # Check whether --with-m4_tolower(Msk)-incdir or --without-m4_tolower(Msk)-incdir was given. if test "${with_msk_incdir+set}" = set; then withval="$with_msk_incdir" if test "$withval" = no ; then coin_has_msk=skipping else coin_has_msk=yes MSK_CFLAGS="-I`${CYGPATH_W} $withval`" CBCGENERIC_CFLAGS="-I`${CYGPATH_W} $withval` $CBCGENERIC_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MSK_CFLAGS_INSTALLED="$MSK_CFLAGS" CBCGENERIC_CFLAGS_INSTALLED="$MSK_CFLAGS $CBCGENERIC_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_msk != skipping; then # Check whether --with-m4_tolower(Msk)-datadir or --without-m4_tolower(Msk)-datadir was given. if test "${with_msk_datadir+set}" = set; then withval="$with_msk_datadir" if test "$withval" = no ; then coin_has_msk=skipping else coin_has_msk=yes MSK_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MSK_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_msk = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-mosek"; then MSK_VERSIONS=`$PKG_CONFIG --modversion "osi-mosek" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-mosek" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MSK_CFLAGS="$cflags" MSK_LIBS=`$PKG_CONFIG --libs "osi-mosek" 2>/dev/null` MSK_DATA=`$PKG_CONFIG --variable=datadir "osi-mosek" 2>/dev/null` coin_has_msk=yes echo "$as_me:$LINENO: result: yes: $MSK_VERSIONS" >&5 echo "${ECHO_T}yes: $MSK_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then MSK_LIBS=`echo " $MSK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi MSK_PCREQUIRES="osi-mosek" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CbcGeneric CBCGENERIC_PCREQUIRES="osi-mosek $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$MSK_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$MSK_LIBS $CBCGENERIC_LIBS" else MSK_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-mosek"` coin_has_msk=notGiven echo "$as_me:$LINENO: result: not given: $MSK_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $MSK_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Msk without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Msk without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Msk (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Msk (fallback)... $ECHO_C" >&6 coin_has_msk=notGiven MSK_LIBS= MSK_LIBS_INSTALLED= MSK_CFLAGS= MSK_CFLAGS_INSTALLED= MSK_DATA= MSK_DATA_INSTALLED= MSK_PCLIBS= MSK_PCREQUIRES= # initial list of dependencies is "osi-mosek", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-mosek" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$MSK_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` MSK_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$MSK_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi MSK_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MSK_CFLAGS="$projcflags $MSK_CFLAGS" # set LIBS variable MSK_LIBS="$projlibs $MSK_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MSK_CFLAGS_INSTALLED="$projcflags $MSK_CFLAGS_INSTALLED" # set LIBS variable MSK_LIBS_INSTALLED="$projlibs $MSK_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_msk=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_MSK 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then MSK_LIBS=`echo " $MSK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` MSK_LIBS_INSTALLED=`echo " $MSK_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi MSK_PCREQUIRES="osi-mosek" CBCGENERIC_PCREQUIRES="osi-mosek $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$MSK_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$MSK_LIBS $CBCGENERIC_LIBS" CBCGENERIC_CFLAGS_INSTALLED="$MSK_CFLAGS_INSTALLED $CBCGENERIC_CFLAGS_INSTALLED" CBCGENERIC_LIBS_INSTALLED="$MSK_LIBS_INSTALLED $CBCGENERIC_LIBS_INSTALLED" fi if test $coin_has_msk != notGiven && test $coin_has_msk != skipping; then COIN_HAS_MSK_TRUE= COIN_HAS_MSK_FALSE='#' else COIN_HAS_MSK_TRUE='#' COIN_HAS_MSK_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_msk" >&5 echo "${ECHO_T}$coin_has_msk" >&6 fi if test $coin_has_msk != skipping && test $coin_has_msk != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_MSK 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) MSK_DEPENDENCIES=`echo " $MSK_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCGENERIC_DEPENDENCIES=`echo " $CBCGENERIC_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$MSK_CFLAGS" ; then { echo "$as_me:$LINENO: Msk CFLAGS are $MSK_CFLAGS" >&5 echo "$as_me: Msk CFLAGS are $MSK_CFLAGS" >&6;} fi if test -n "$MSK_LIBS" ; then { echo "$as_me:$LINENO: Msk LIBS are $MSK_LIBS" >&5 echo "$as_me: Msk LIBS are $MSK_LIBS" >&6;} fi if test -n "$MSK_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Msk DEPENDENCIES are $MSK_DEPENDENCIES" >&5 echo "$as_me: Msk DEPENDENCIES are $MSK_DEPENDENCIES" >&6;} fi if test -n "$MSK_DATA" ; then { echo "$as_me:$LINENO: Msk DATA is $MSK_DATA" >&5 echo "$as_me: Msk DATA is $MSK_DATA" >&6;} fi if test -n "$MSK_PCLIBS" ; then { echo "$as_me:$LINENO: Msk PCLIBS are $MSK_PCLIBS" >&5 echo "$as_me: Msk PCLIBS are $MSK_PCLIBS" >&6;} fi if test -n "$MSK_PCREQUIRES" ; then { echo "$as_me:$LINENO: Msk PCREQUIRES are $MSK_PCREQUIRES" >&5 echo "$as_me: Msk PCREQUIRES are $MSK_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&5 echo "$as_me: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&5 echo "$as_me: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&6;} { echo "$as_me:$LINENO: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&5 echo "$as_me: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_msk != notGiven && test $coin_has_msk != skipping; then COIN_HAS_MSK_TRUE= COIN_HAS_MSK_FALSE='#' else COIN_HAS_MSK_TRUE='#' COIN_HAS_MSK_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Spx" >&5 echo $ECHO_N "checking for COIN-OR package Spx... $ECHO_C" >&6 coin_has_spx=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Spx"; then coin_has_spx=skipping fi done fi if test "$coin_has_spx" != skipping; then # Check whether --with-m4_tolower(Spx) or --without-m4_tolower(Spx) was given. if test "${with_spx+set}" = set; then withval="$with_spx" if test "$withval" = no ; then coin_has_spx=skipping fi fi; fi SPX_LIBS= SPX_CFLAGS= SPX_DATA= SPX_DEPENDENCIES= SPX_PCLIBS= SPX_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_spx != skipping; then # Check whether --with-m4_tolower(Spx)-lib or --without-m4_tolower(Spx)-lib was given. if test "${with_spx_lib+set}" = set; then withval="$with_spx_lib" if test "$withval" = no ; then coin_has_spx=skipping else coin_has_spx=yes SPX_LIBS="$withval" SPX_PCLIBS="$withval" CBCGENERIC_PCLIBS="$withval $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS="$withval $CBCGENERIC_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SPX_LIBS_INSTALLED="$withval" CBCGENERIC_LIBS_INSTALLED="$withval $CBCGENERIC_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_spx != skipping; then # Check whether --with-m4_tolower(Spx)-incdir or --without-m4_tolower(Spx)-incdir was given. if test "${with_spx_incdir+set}" = set; then withval="$with_spx_incdir" if test "$withval" = no ; then coin_has_spx=skipping else coin_has_spx=yes SPX_CFLAGS="-I`${CYGPATH_W} $withval`" CBCGENERIC_CFLAGS="-I`${CYGPATH_W} $withval` $CBCGENERIC_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SPX_CFLAGS_INSTALLED="$SPX_CFLAGS" CBCGENERIC_CFLAGS_INSTALLED="$SPX_CFLAGS $CBCGENERIC_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_spx != skipping; then # Check whether --with-m4_tolower(Spx)-datadir or --without-m4_tolower(Spx)-datadir was given. if test "${with_spx_datadir+set}" = set; then withval="$with_spx_datadir" if test "$withval" = no ; then coin_has_spx=skipping else coin_has_spx=yes SPX_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SPX_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_spx = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-soplex"; then SPX_VERSIONS=`$PKG_CONFIG --modversion "osi-soplex" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-soplex" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SPX_CFLAGS="$cflags" SPX_LIBS=`$PKG_CONFIG --libs "osi-soplex" 2>/dev/null` SPX_DATA=`$PKG_CONFIG --variable=datadir "osi-soplex" 2>/dev/null` coin_has_spx=yes echo "$as_me:$LINENO: result: yes: $SPX_VERSIONS" >&5 echo "${ECHO_T}yes: $SPX_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SPX_LIBS=`echo " $SPX_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi SPX_PCREQUIRES="osi-soplex" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CbcGeneric CBCGENERIC_PCREQUIRES="osi-soplex $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$SPX_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$SPX_LIBS $CBCGENERIC_LIBS" else SPX_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-soplex"` coin_has_spx=notGiven echo "$as_me:$LINENO: result: not given: $SPX_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $SPX_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Spx without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Spx without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Spx (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Spx (fallback)... $ECHO_C" >&6 coin_has_spx=notGiven SPX_LIBS= SPX_LIBS_INSTALLED= SPX_CFLAGS= SPX_CFLAGS_INSTALLED= SPX_DATA= SPX_DATA_INSTALLED= SPX_PCLIBS= SPX_PCREQUIRES= # initial list of dependencies is "osi-soplex", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-soplex" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$SPX_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` SPX_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$SPX_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi SPX_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SPX_CFLAGS="$projcflags $SPX_CFLAGS" # set LIBS variable SPX_LIBS="$projlibs $SPX_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SPX_CFLAGS_INSTALLED="$projcflags $SPX_CFLAGS_INSTALLED" # set LIBS variable SPX_LIBS_INSTALLED="$projlibs $SPX_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_spx=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SPX 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SPX_LIBS=`echo " $SPX_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` SPX_LIBS_INSTALLED=`echo " $SPX_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi SPX_PCREQUIRES="osi-soplex" CBCGENERIC_PCREQUIRES="osi-soplex $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$SPX_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$SPX_LIBS $CBCGENERIC_LIBS" CBCGENERIC_CFLAGS_INSTALLED="$SPX_CFLAGS_INSTALLED $CBCGENERIC_CFLAGS_INSTALLED" CBCGENERIC_LIBS_INSTALLED="$SPX_LIBS_INSTALLED $CBCGENERIC_LIBS_INSTALLED" fi if test $coin_has_spx != notGiven && test $coin_has_spx != skipping; then COIN_HAS_SPX_TRUE= COIN_HAS_SPX_FALSE='#' else COIN_HAS_SPX_TRUE='#' COIN_HAS_SPX_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_spx" >&5 echo "${ECHO_T}$coin_has_spx" >&6 fi if test $coin_has_spx != skipping && test $coin_has_spx != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SPX 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) SPX_DEPENDENCIES=`echo " $SPX_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCGENERIC_DEPENDENCIES=`echo " $CBCGENERIC_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$SPX_CFLAGS" ; then { echo "$as_me:$LINENO: Spx CFLAGS are $SPX_CFLAGS" >&5 echo "$as_me: Spx CFLAGS are $SPX_CFLAGS" >&6;} fi if test -n "$SPX_LIBS" ; then { echo "$as_me:$LINENO: Spx LIBS are $SPX_LIBS" >&5 echo "$as_me: Spx LIBS are $SPX_LIBS" >&6;} fi if test -n "$SPX_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Spx DEPENDENCIES are $SPX_DEPENDENCIES" >&5 echo "$as_me: Spx DEPENDENCIES are $SPX_DEPENDENCIES" >&6;} fi if test -n "$SPX_DATA" ; then { echo "$as_me:$LINENO: Spx DATA is $SPX_DATA" >&5 echo "$as_me: Spx DATA is $SPX_DATA" >&6;} fi if test -n "$SPX_PCLIBS" ; then { echo "$as_me:$LINENO: Spx PCLIBS are $SPX_PCLIBS" >&5 echo "$as_me: Spx PCLIBS are $SPX_PCLIBS" >&6;} fi if test -n "$SPX_PCREQUIRES" ; then { echo "$as_me:$LINENO: Spx PCREQUIRES are $SPX_PCREQUIRES" >&5 echo "$as_me: Spx PCREQUIRES are $SPX_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&5 echo "$as_me: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&5 echo "$as_me: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&6;} { echo "$as_me:$LINENO: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&5 echo "$as_me: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_spx != notGiven && test $coin_has_spx != skipping; then COIN_HAS_SPX_TRUE= COIN_HAS_SPX_FALSE='#' else COIN_HAS_SPX_TRUE='#' COIN_HAS_SPX_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Xpr" >&5 echo $ECHO_N "checking for COIN-OR package Xpr... $ECHO_C" >&6 coin_has_xpr=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Xpr"; then coin_has_xpr=skipping fi done fi if test "$coin_has_xpr" != skipping; then # Check whether --with-m4_tolower(Xpr) or --without-m4_tolower(Xpr) was given. if test "${with_xpr+set}" = set; then withval="$with_xpr" if test "$withval" = no ; then coin_has_xpr=skipping fi fi; fi XPR_LIBS= XPR_CFLAGS= XPR_DATA= XPR_DEPENDENCIES= XPR_PCLIBS= XPR_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_xpr != skipping; then # Check whether --with-m4_tolower(Xpr)-lib or --without-m4_tolower(Xpr)-lib was given. if test "${with_xpr_lib+set}" = set; then withval="$with_xpr_lib" if test "$withval" = no ; then coin_has_xpr=skipping else coin_has_xpr=yes XPR_LIBS="$withval" XPR_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then XPR_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_xpr != skipping; then # Check whether --with-m4_tolower(Xpr)-incdir or --without-m4_tolower(Xpr)-incdir was given. if test "${with_xpr_incdir+set}" = set; then withval="$with_xpr_incdir" if test "$withval" = no ; then coin_has_xpr=skipping else coin_has_xpr=yes XPR_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then XPR_CFLAGS_INSTALLED="$XPR_CFLAGS" fi fi fi; fi if test $coin_has_xpr != skipping; then # Check whether --with-m4_tolower(Xpr)-datadir or --without-m4_tolower(Xpr)-datadir was given. if test "${with_xpr_datadir+set}" = set; then withval="$with_xpr_datadir" if test "$withval" = no ; then coin_has_xpr=skipping else coin_has_xpr=yes XPR_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then XPR_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_xpr = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-xpress"; then XPR_VERSIONS=`$PKG_CONFIG --modversion "osi-xpress" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-xpress" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi XPR_CFLAGS="$cflags" XPR_LIBS=`$PKG_CONFIG --libs "osi-xpress" 2>/dev/null` XPR_DATA=`$PKG_CONFIG --variable=datadir "osi-xpress" 2>/dev/null` coin_has_xpr=yes echo "$as_me:$LINENO: result: yes: $XPR_VERSIONS" >&5 echo "${ECHO_T}yes: $XPR_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then XPR_LIBS=`echo " $XPR_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi XPR_PCREQUIRES="osi-xpress" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else XPR_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-xpress"` coin_has_xpr=notGiven echo "$as_me:$LINENO: result: not given: $XPR_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $XPR_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Xpr without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Xpr without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Xpr (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Xpr (fallback)... $ECHO_C" >&6 coin_has_xpr=notGiven XPR_LIBS= XPR_LIBS_INSTALLED= XPR_CFLAGS= XPR_CFLAGS_INSTALLED= XPR_DATA= XPR_DATA_INSTALLED= XPR_PCLIBS= XPR_PCREQUIRES= # initial list of dependencies is "osi-xpress", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-xpress" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$XPR_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` XPR_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$XPR_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi XPR_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi XPR_CFLAGS="$projcflags $XPR_CFLAGS" # set LIBS variable XPR_LIBS="$projlibs $XPR_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi XPR_CFLAGS_INSTALLED="$projcflags $XPR_CFLAGS_INSTALLED" # set LIBS variable XPR_LIBS_INSTALLED="$projlibs $XPR_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_xpr=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_XPR 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then XPR_LIBS=`echo " $XPR_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` XPR_LIBS_INSTALLED=`echo " $XPR_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi XPR_PCREQUIRES="osi-xpress" fi if test $coin_has_xpr != notGiven && test $coin_has_xpr != skipping; then COIN_HAS_XPR_TRUE= COIN_HAS_XPR_FALSE='#' else COIN_HAS_XPR_TRUE='#' COIN_HAS_XPR_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_xpr" >&5 echo "${ECHO_T}$coin_has_xpr" >&6 fi if test $coin_has_xpr != skipping && test $coin_has_xpr != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_XPR 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) XPR_DEPENDENCIES=`echo " $XPR_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$XPR_CFLAGS" ; then { echo "$as_me:$LINENO: Xpr CFLAGS are $XPR_CFLAGS" >&5 echo "$as_me: Xpr CFLAGS are $XPR_CFLAGS" >&6;} fi if test -n "$XPR_LIBS" ; then { echo "$as_me:$LINENO: Xpr LIBS are $XPR_LIBS" >&5 echo "$as_me: Xpr LIBS are $XPR_LIBS" >&6;} fi if test -n "$XPR_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Xpr DEPENDENCIES are $XPR_DEPENDENCIES" >&5 echo "$as_me: Xpr DEPENDENCIES are $XPR_DEPENDENCIES" >&6;} fi if test -n "$XPR_DATA" ; then { echo "$as_me:$LINENO: Xpr DATA is $XPR_DATA" >&5 echo "$as_me: Xpr DATA is $XPR_DATA" >&6;} fi if test -n "$XPR_PCLIBS" ; then { echo "$as_me:$LINENO: Xpr PCLIBS are $XPR_PCLIBS" >&5 echo "$as_me: Xpr PCLIBS are $XPR_PCLIBS" >&6;} fi if test -n "$XPR_PCREQUIRES" ; then { echo "$as_me:$LINENO: Xpr PCREQUIRES are $XPR_PCREQUIRES" >&5 echo "$as_me: Xpr PCREQUIRES are $XPR_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_xpr != notGiven && test $coin_has_xpr != skipping; then COIN_HAS_XPR_TRUE= COIN_HAS_XPR_FALSE='#' else COIN_HAS_XPR_TRUE='#' COIN_HAS_XPR_FALSE= fi ############################################################################# # Other third party software # ############################################################################# # Ampl Solver library echo "$as_me:$LINENO: checking for COIN-OR package ASL" >&5 echo $ECHO_N "checking for COIN-OR package ASL... $ECHO_C" >&6 coin_has_asl=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "ASL"; then coin_has_asl=skipping fi done fi if test "$coin_has_asl" != skipping; then # Check whether --with-m4_tolower(ASL) or --without-m4_tolower(ASL) was given. if test "${with_asl+set}" = set; then withval="$with_asl" if test "$withval" = no ; then coin_has_asl=skipping fi fi; fi ASL_LIBS= ASL_CFLAGS= ASL_DATA= ASL_DEPENDENCIES= ASL_PCLIBS= ASL_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_asl != skipping; then # Check whether --with-m4_tolower(ASL)-lib or --without-m4_tolower(ASL)-lib was given. if test "${with_asl_lib+set}" = set; then withval="$with_asl_lib" if test "$withval" = no ; then coin_has_asl=skipping else coin_has_asl=yes ASL_LIBS="$withval" ASL_PCLIBS="$withval" CBCLIB_PCLIBS="$withval $CBCLIB_PCLIBS" CBCLIB_LIBS="$withval $CBCLIB_LIBS" CBCGENERIC_PCLIBS="$withval $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS="$withval $CBCGENERIC_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then ASL_LIBS_INSTALLED="$withval" CBCLIB_LIBS_INSTALLED="$withval $CBCLIB_LIBS_INSTALLED"CBCGENERIC_LIBS_INSTALLED="$withval $CBCGENERIC_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_asl != skipping; then # Check whether --with-m4_tolower(ASL)-incdir or --without-m4_tolower(ASL)-incdir was given. if test "${with_asl_incdir+set}" = set; then withval="$with_asl_incdir" if test "$withval" = no ; then coin_has_asl=skipping else coin_has_asl=yes ASL_CFLAGS="-I`${CYGPATH_W} $withval`" CBCLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CBCLIB_CFLAGS"CBCGENERIC_CFLAGS="-I`${CYGPATH_W} $withval` $CBCGENERIC_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then ASL_CFLAGS_INSTALLED="$ASL_CFLAGS" CBCLIB_CFLAGS_INSTALLED="$ASL_CFLAGS $CBCLIB_CFLAGS_INSTALLED"CBCGENERIC_CFLAGS_INSTALLED="$ASL_CFLAGS $CBCGENERIC_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_asl != skipping; then # Check whether --with-m4_tolower(ASL)-datadir or --without-m4_tolower(ASL)-datadir was given. if test "${with_asl_datadir+set}" = set; then withval="$with_asl_datadir" if test "$withval" = no ; then coin_has_asl=skipping else coin_has_asl=yes ASL_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then ASL_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_asl = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinasl"; then ASL_VERSIONS=`$PKG_CONFIG --modversion "coinasl" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinasl" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi ASL_CFLAGS="$cflags" ASL_LIBS=`$PKG_CONFIG --libs "coinasl" 2>/dev/null` ASL_DATA=`$PKG_CONFIG --variable=datadir "coinasl" 2>/dev/null` coin_has_asl=yes echo "$as_me:$LINENO: result: yes: $ASL_VERSIONS" >&5 echo "${ECHO_T}yes: $ASL_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then ASL_LIBS=`echo " $ASL_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi ASL_PCREQUIRES="coinasl" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CbcLib CbcGeneric CBCLIB_PCREQUIRES="coinasl $CBCLIB_PCREQUIRES" CBCLIB_CFLAGS="$ASL_CFLAGS $CBCLIB_CFLAGS" CBCLIB_LIBS="$ASL_LIBS $CBCLIB_LIBS" CBCGENERIC_PCREQUIRES="coinasl $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$ASL_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$ASL_LIBS $CBCGENERIC_LIBS" else ASL_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinasl"` coin_has_asl=notGiven echo "$as_me:$LINENO: result: not given: $ASL_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $ASL_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module ASL without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module ASL without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package ASL (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package ASL (fallback)... $ECHO_C" >&6 coin_has_asl=notGiven ASL_LIBS= ASL_LIBS_INSTALLED= ASL_CFLAGS= ASL_CFLAGS_INSTALLED= ASL_DATA= ASL_DATA_INSTALLED= ASL_PCLIBS= ASL_PCREQUIRES= # initial list of dependencies is "coinasl", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinasl" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$ASL_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` ASL_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$ASL_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi ASL_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi ASL_CFLAGS="$projcflags $ASL_CFLAGS" # set LIBS variable ASL_LIBS="$projlibs $ASL_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi ASL_CFLAGS_INSTALLED="$projcflags $ASL_CFLAGS_INSTALLED" # set LIBS variable ASL_LIBS_INSTALLED="$projlibs $ASL_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_asl=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_ASL 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then ASL_LIBS=`echo " $ASL_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` ASL_LIBS_INSTALLED=`echo " $ASL_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi ASL_PCREQUIRES="coinasl" CBCLIB_PCREQUIRES="coinasl $CBCLIB_PCREQUIRES" CBCLIB_CFLAGS="$ASL_CFLAGS $CBCLIB_CFLAGS" CBCLIB_LIBS="$ASL_LIBS $CBCLIB_LIBS" CBCLIB_CFLAGS_INSTALLED="$ASL_CFLAGS_INSTALLED $CBCLIB_CFLAGS_INSTALLED" CBCLIB_LIBS_INSTALLED="$ASL_LIBS_INSTALLED $CBCLIB_LIBS_INSTALLED" CBCGENERIC_PCREQUIRES="coinasl $CBCGENERIC_PCREQUIRES" CBCGENERIC_CFLAGS="$ASL_CFLAGS $CBCGENERIC_CFLAGS" CBCGENERIC_LIBS="$ASL_LIBS $CBCGENERIC_LIBS" CBCGENERIC_CFLAGS_INSTALLED="$ASL_CFLAGS_INSTALLED $CBCGENERIC_CFLAGS_INSTALLED" CBCGENERIC_LIBS_INSTALLED="$ASL_LIBS_INSTALLED $CBCGENERIC_LIBS_INSTALLED" fi if test $coin_has_asl != notGiven && test $coin_has_asl != skipping; then COIN_HAS_ASL_TRUE= COIN_HAS_ASL_FALSE='#' else COIN_HAS_ASL_TRUE='#' COIN_HAS_ASL_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_asl" >&5 echo "${ECHO_T}$coin_has_asl" >&6 fi if test $coin_has_asl != skipping && test $coin_has_asl != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_ASL 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) ASL_DEPENDENCIES=`echo " $ASL_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCLIB_DEPENDENCIES=`echo " $CBCLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CBCGENERIC_DEPENDENCIES=`echo " $CBCGENERIC_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$ASL_CFLAGS" ; then { echo "$as_me:$LINENO: ASL CFLAGS are $ASL_CFLAGS" >&5 echo "$as_me: ASL CFLAGS are $ASL_CFLAGS" >&6;} fi if test -n "$ASL_LIBS" ; then { echo "$as_me:$LINENO: ASL LIBS are $ASL_LIBS" >&5 echo "$as_me: ASL LIBS are $ASL_LIBS" >&6;} fi if test -n "$ASL_DEPENDENCIES" ; then { echo "$as_me:$LINENO: ASL DEPENDENCIES are $ASL_DEPENDENCIES" >&5 echo "$as_me: ASL DEPENDENCIES are $ASL_DEPENDENCIES" >&6;} fi if test -n "$ASL_DATA" ; then { echo "$as_me:$LINENO: ASL DATA is $ASL_DATA" >&5 echo "$as_me: ASL DATA is $ASL_DATA" >&6;} fi if test -n "$ASL_PCLIBS" ; then { echo "$as_me:$LINENO: ASL PCLIBS are $ASL_PCLIBS" >&5 echo "$as_me: ASL PCLIBS are $ASL_PCLIBS" >&6;} fi if test -n "$ASL_PCREQUIRES" ; then { echo "$as_me:$LINENO: ASL PCREQUIRES are $ASL_PCREQUIRES" >&5 echo "$as_me: ASL PCREQUIRES are $ASL_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CbcLib CFLAGS are $CBCLIB_CFLAGS" >&5 echo "$as_me: CbcLib CFLAGS are $CBCLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcLib LIBS are $CBCLIB_LIBS" >&5 echo "$as_me: CbcLib LIBS are $CBCLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CbcLib DEPENDENCIES are $CBCLIB_DEPENDENCIES" >&5 echo "$as_me: CbcLib DEPENDENCIES are $CBCLIB_DEPENDENCIES" >&6;} { echo "$as_me:$LINENO: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&5 echo "$as_me: CbcGeneric CFLAGS are $CBCGENERIC_CFLAGS" >&6;} { echo "$as_me:$LINENO: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&5 echo "$as_me: CbcGeneric LIBS are $CBCGENERIC_LIBS" >&6;} { echo "$as_me:$LINENO: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&5 echo "$as_me: CbcGeneric DEPENDENCIES are $CBCGENERIC_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_asl != notGiven && test $coin_has_asl != skipping; then COIN_HAS_ASL_TRUE= COIN_HAS_ASL_FALSE='#' else COIN_HAS_ASL_TRUE='#' COIN_HAS_ASL_FALSE= fi # Nauty library (for symmetry detection) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking if user provides library for Nauty" >&5 echo $ECHO_N "checking if user provides library for Nauty... $ECHO_C" >&6 # Check for header file directory # Check whether --with-nauty-incdir or --without-nauty-incdir was given. if test "${with_nauty_incdir+set}" = set; then withval="$with_nauty_incdir" NTYINCDIR=`cd $withval; pwd` fi; # Check for library directory # Check whether --with-nauty-lib or --without-nauty-lib was given. if test "${with_nauty_lib+set}" = set; then withval="$with_nauty_lib" NTYLIB=$withval fi; # Switch to disable library check if requested # Check whether --enable-nauty-libcheck or --disable-nauty-libcheck was given. if test "${enable_nauty_libcheck+set}" = set; then enableval="$enable_nauty_libcheck" nauty_libcheck=$enableval else nauty_libcheck=yes fi; # At this point, if we're going to use the library, both LBRYINCDIR and # LBRYLIB must be defined and not empty. if test x"$NTYINCDIR" != x || test x"$NTYLIB" != x; then if test x"$NTYINCDIR" = x || test x"$NTYLIB" = x; then { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Nauty. Use --with-nauty-incdir of environment variable $NTYINCDIR to specify the include directory. Use --with-nauty-lib or environment variable $NTYLIB to specify link flags." >&5 echo "$as_me: error: You need to specify both an include directory and link flags to use library Nauty. Use --with-nauty-incdir of environment variable $NTYINCDIR to specify the include directory. Use --with-nauty-lib or environment variable $NTYLIB to specify link flags." >&2;} { (exit 1); exit 1; }; } fi coin_has_nty=true echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else coin_has_nty=false echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # If we have instructions for use, consider header and link checks. if test $coin_has_nty = true; then # If argument 3 (file) is given, check for the file. Typically this will be a # header file, but that's not assumed. if test -r $NTYINCDIR/nauty.h; then : else { { echo "$as_me:$LINENO: error: Cannot find file nauty.h in $NTYINCDIR" >&5 echo "$as_me: error: Cannot find file nauty.h in $NTYINCDIR" >&2;} { (exit 1); exit 1; }; } : fi # Now see if we can link the function. There are arguments for and against # assuming argument 3 is a header file declaring the function. A correct # function declaration is the main argument in favour. Having to cope with # possible dependencies or other oddities are the main arguments against. # Force the use of C as the best single choice amongst C++, C, and Fortran. # Obviously, this has limits. if test x"$nauty_libcheck" != xno; then coin_save_LIBS="$LIBS" LIBS="$NTYLIB " coin_NTY_link=no ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for fnm in nauty ; do echo "$as_me:$LINENO: checking whether symbol $fnm is available with NTY" >&5 echo $ECHO_N "checking whether symbol $fnm is available with NTY... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $fnm() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 coin_NTY_link=yes break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$coin_save_LIBS" if test x"$coin_NTY_link" != xyes ; then { { echo "$as_me:$LINENO: error: Cannot find symbol(s) nauty with NTY" >&5 echo "$as_me: error: Cannot find symbol(s) nauty with NTY" >&2;} { (exit 1); exit 1; }; } fi fi # If we make it this far, we've verified the file and linked the function. Add # the necessary link flags to CbcLib CbcGeneric_{PC}LIBS and define the preprocessor symbol # COIN_HAS_LBRY. CBCLIB_LIBS="$NTYLIB $CBCLIB_LIBS" CBCLIB_PCLIBS="$NTYLIB $CBCLIB_PCLIBS" CBCLIB_LIBS_INSTALLED="$NTYLIB $CBCLIB_LIBS_INSTALLED" CBCGENERIC_LIBS="$NTYLIB $CBCGENERIC_LIBS" CBCGENERIC_PCLIBS="$NTYLIB $CBCGENERIC_PCLIBS" CBCGENERIC_LIBS_INSTALLED="$NTYLIB $CBCGENERIC_LIBS_INSTALLED" cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NTY 1 _ACEOF fi # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the # automake conditional. These actions must occur unconditionally. if test $coin_has_nty = true; then COIN_HAS_NTY_TRUE= COIN_HAS_NTY_FALSE='#' else COIN_HAS_NTY_TRUE='#' COIN_HAS_NTY_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ############################################################################# # CbcGeneric configuration # ############################################################################# # Are we building cbc-generic? Default is no (false). # Check whether --with-cbc-generic or --without-cbc-generic was given. if test "${with_cbc_generic+set}" = set; then withval="$with_cbc_generic" case $withval in yes) cbc_with_cbc_generic=true ;; *) cbc_with_cbc_generic=false ;; esac else cbc_with_cbc_generic=false fi; if test x"$cbc_with_cbc_generic" = xyes ; then { echo "$as_me:$LINENO: building cbc-generic" >&5 echo "$as_me: building cbc-generic" >&6;} fi if test x"$cbc_with_cbc_generic" = xtrue; then CBC_BUILD_CBC_GENERIC_TRUE= CBC_BUILD_CBC_GENERIC_FALSE='#' else CBC_BUILD_CBC_GENERIC_TRUE='#' CBC_BUILD_CBC_GENERIC_FALSE= fi # Set the default solver for cbc-generic. In theory, any OsiXXX should work. # In practice, only the three listed below have had any testing. echo "$as_me:$LINENO: checking for cbc-generic default solver" >&5 echo $ECHO_N "checking for cbc-generic default solver... $ECHO_C" >&6 # Check whether --with-cbc-generic-solver or --without-cbc-generic-solver was given. if test "${with_cbc_generic_solver+set}" = set; then withval="$with_cbc_generic_solver" cbc_default_solver=$withval else cbc_default_solver=clp fi; echo "$as_me:$LINENO: result: $cbc_default_solver" >&5 echo "${ECHO_T}$cbc_default_solver" >&6 # FIXME what about cplex and mosek here? case $cbc_default_solver in clp) ;; dylp) ;; glpk) ;; soplex) ;; *) { echo "$as_me:$LINENO: WARNING: Unrecognised solver $cbc_default_solver chosen as cbc-generic default solver." >&5 echo "$as_me: WARNING: Unrecognised solver $cbc_default_solver chosen as cbc-generic default solver." >&2;} ;; esac cat >>confdefs.h <<_ACEOF #define CBC_DEFAULT_SOLVER "$cbc_default_solver" _ACEOF ############################################################################# # Cbc parallel configuration # ############################################################################# # First we define a new option, --enable-cbc-parallel # Check whether --enable-cbc-parallel or --disable-cbc-parallel was given. if test "${enable_cbc_parallel+set}" = set; then enableval="$enable_cbc_parallel" fi; if test "$enable_cbc_parallel" = yes; then # Define the preprocessor macro cat >>confdefs.h <<\_ACEOF #define CBC_THREAD 1 _ACEOF if test $coin_cxx_is_cl = true ; then # TODO we should check whether the library works and pthread.h is indeed there # Check whether --with-pthreadsw32-lib or --without-pthreadsw32-lib was given. if test "${with_pthreadsw32_lib+set}" = set; then withval="$with_pthreadsw32_lib" CBCLIB_LIBS="$withval $CBCLIB_LIBS" CBCLIB_PCLIBS="$withval $CBCLIB_PCLIBS" else { echo "$as_me:$LINENO: WARNING: --enable-cbc-parallel selected, but --with-pthreadsw32-lib not given" >&5 echo "$as_me: WARNING: --enable-cbc-parallel selected, but --with-pthreadsw32-lib not given" >&2;} CBCLIB_LIBS="pthreadVCE2.lib $CBCLIB_LIBS" fi; # Check whether --with-pthreadsw32-incdir or --without-pthreadsw32-incdir was given. if test "${with_pthreadsw32_incdir+set}" = set; then withval="$with_pthreadsw32_incdir" CXXFLAGS="$CXXFLAGS -I$withval" else { echo "$as_me:$LINENO: WARNING: --enable-cbc-parallel selected, but --with-pthreadsw32-incdir not given" >&5 echo "$as_me: WARNING: --enable-cbc-parallel selected, but --with-pthreadsw32-incdir not given" >&2;} fi; else echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char clock_gettime (); int main () { clock_gettime (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_rt_clock_gettime=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_rt_clock_gettime=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 if test $ac_cv_lib_rt_clock_gettime = yes; then CBCLIB_LIBS="-lrt $CBCLIB_LIBS" CBCLIB_PCLIBS="-lrt $CBCLIB_PCLIBS" cat >>confdefs.h <<\_ACEOF #define HAVE_CLOCK_GETTIME 1 _ACEOF else { echo "$as_me:$LINENO: WARNING: --enable-cbc-parallel selected, but -lrt unavailable; using gettimeofday instead of clock_gettime" >&5 echo "$as_me: WARNING: --enable-cbc-parallel selected, but -lrt unavailable; using gettimeofday instead of clock_gettime" >&2;} fi echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6 if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_create (); int main () { pthread_create (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pthread_pthread_create=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread_pthread_create=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6 if test $ac_cv_lib_pthread_pthread_create = yes; then CBCLIB_LIBS="-lpthread $CBCLIB_LIBS" CBCLIB_PCLIBS="-lpthread $CBCLIB_PCLIBS" else { { echo "$as_me:$LINENO: error: --enable-cbc-parallel selected, but -lpthreads unavailable" >&5 echo "$as_me: error: --enable-cbc-parallel selected, but -lpthreads unavailable" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: Cbc multithreading enabled" >&5 echo "$as_me: Cbc multithreading enabled" >&6;}; fi ############################################################################## # OsiCbc configuration # ############################################################################## # Handles configuration of the underlying default solver in OsiCbc. The issue # is that OsiCbc defines a default solver, used when the client does not # specify a solver in the constructor. The default solver must, therefore, # be present in the build. This macro checks that this is true, and sets the # compile-time symbols OSICBC_DFLT_SOLVER, OSICBC_CLP_DFLT_SOLVER, and # OSICBC_DFLT_SOLVER_HPP that control the build. The parameter default_solver # should normally be clp, unless you're working on some other solver. # Ideally, this macro would not require enumeration of solvers, but the # effort required to avoid it is just not justified at present. One enumeration # is hidden in AC_OSI_CANONICAL. The other is visible, the AM_CONDITIONAL # list at the end. # In an ideal world this macro would do absolutely nothing if Cbc is not # present, but autotools is not an ideal world and we have to satisfy its # requirements. In particular, the AM_CONDITIONAL macros need to execute or # automake will complain. Really the only thing we need to suppress is the # check that the default solver exists. All the rest is irrelevant when Cbc # isn't present (hence OsiCbc will be configured but not actually compiled). # Process the with-osicbc-default-solver option. # Check whether --with-osicbc-default-solver or --without-osicbc-default-solver was given. if test "${with_osicbc_default_solver+set}" = set; then withval="$with_osicbc_default_solver" osicbc_with_solver=$withval else osicbc_with_solver=clp fi; case "${osicbc_with_solver}" in [Cc][Ll][Pp]*) osi_lc_solver=clp ; osi_mc_solver=Clp ; osi_uc_solver=CLP ; osi_exists_solver=${coin_has_clp-"unavailable"} ;; [Dd][Yy][Ll][Pp]*) osi_lc_solver=dylp ; osi_mc_solver=Dylp osi_uc_solver=DYLP osi_exists_solver=${coin_has_dylp-"unavailable"} ;; [Cc][Pp][Xx]*) osi_lc_solver=cpx ; osi_mc_solver=Cpx osi_uc_solver=CPX osi_exists_solver=${coin_has_cpx-"unavailable"} ;; [Gg][Ll][Pp][Kk]*) osi_lc_solver=glpk ; osi_mc_solver=Glpk osi_uc_solver=GLPK osi_exists_solver=${coin_has_glpk-"unavailable"} ;; [Gg][Rr][Bb]*) osi_lc_solver=grb ; osi_mc_solver=Grb ; osi_uc_solver=GRB ; osi_exists_solver=${coin_has_grb-"unavailable"} ;; [Mm][Ss][Kk]*) osi_lc_solver=msk ; osi_mc_solver=Msk osi_uc_solver=MSK osi_exists_solver=${coin_has_msk-"unavailable"} ;; [Ss][Pp][Xx]*) osi_lc_solver=spx ; osi_mc_solver=Spx osi_uc_solver=SPX osi_exists_solver=${coin_has_spx-"unavailable"} ;; [Ss][Yy][Mm]*) osi_lc_solver=sym ; osi_mc_solver=Sym osi_uc_solver=SYM osi_exists_solver=${coin_has_sym-"unavailable"} ;; [Vv][Oo][Ll]*) osi_lc_solver=vol ; osi_mc_solver=Vol osi_uc_solver=VOL osi_exists_solver=${coin_has_vol-"unavailable"} ;; [Xx][Pp][Rr]*) osi_lc_solver=xpr ; osi_mc_solver=Xpr osi_uc_solver=XPR osi_exists_solver=${coin_has_xpr-"unavailable"} ;; *) osi_lc_solver=clp ; osi_mc_solver=Clp ; osi_uc_solver=CLP ; osi_exists_solver=${coin_has_clp-"unavailable"} { echo "$as_me:$LINENO: WARNING: Unrecognised solver $1; defaulting to $osi_lc_solver." >&5 echo "$as_me: WARNING: Unrecognised solver $1; defaulting to $osi_lc_solver." >&2;} ;; esac # Check that the requested solver is available. if test $osi_exists_solver = no; then { { echo "$as_me:$LINENO: error: selected default solver $osicbc_with_solver is unavailable. Please select an available solver using the --with-osicbc-default-solver option." >&5 echo "$as_me: error: selected default solver $osicbc_with_solver is unavailable. Please select an available solver using the --with-osicbc-default-solver option." >&2;} { (exit 1); exit 1; }; } fi # State the result. { echo "$as_me:$LINENO: OsiCbc default solver is $osi_lc_solver" >&5 echo "$as_me: OsiCbc default solver is $osi_lc_solver" >&6;} # And set the configuration variables. cat >>confdefs.h <<_ACEOF #define OSICBC_DFLT_SOLVER Osi${osi_mc_solver}SolverInterface _ACEOF cat >>confdefs.h <<_ACEOF #define OSICBC_DFLT_SOLVER_HPP "Osi${osi_mc_solver}SolverInterface.hpp" _ACEOF if test $osi_mc_solver = "Clp"; then cat >>confdefs.h <<\_ACEOF #define OSICBC_DFLT_SOLVER_CLP 1 _ACEOF fi # Last but not least, we need automake conditionals. if test $osi_mc_solver = Clp; then OSICBC_DFLT_SOLVER_CLP_TRUE= OSICBC_DFLT_SOLVER_CLP_FALSE='#' else OSICBC_DFLT_SOLVER_CLP_TRUE='#' OSICBC_DFLT_SOLVER_CLP_FALSE= fi if test $osi_mc_solver = Cpx; then OSICBC_DFLT_SOLVER_CPX_TRUE= OSICBC_DFLT_SOLVER_CPX_FALSE='#' else OSICBC_DFLT_SOLVER_CPX_TRUE='#' OSICBC_DFLT_SOLVER_CPX_FALSE= fi if test $osi_mc_solver = Dylp; then OSICBC_DFLT_SOLVER_DYLP_TRUE= OSICBC_DFLT_SOLVER_DYLP_FALSE='#' else OSICBC_DFLT_SOLVER_DYLP_TRUE='#' OSICBC_DFLT_SOLVER_DYLP_FALSE= fi if test $osi_mc_solver = Glpk; then OSICBC_DFLT_SOLVER_GLPK_TRUE= OSICBC_DFLT_SOLVER_GLPK_FALSE='#' else OSICBC_DFLT_SOLVER_GLPK_TRUE='#' OSICBC_DFLT_SOLVER_GLPK_FALSE= fi if test $osi_mc_solver = Grb; then OSICBC_DFLT_SOLVER_GRB_TRUE= OSICBC_DFLT_SOLVER_GRB_FALSE='#' else OSICBC_DFLT_SOLVER_GRB_TRUE='#' OSICBC_DFLT_SOLVER_GRB_FALSE= fi if test $osi_mc_solver = Msk; then OSICBC_DFLT_SOLVER_MSK_TRUE= OSICBC_DFLT_SOLVER_MSK_FALSE='#' else OSICBC_DFLT_SOLVER_MSK_TRUE='#' OSICBC_DFLT_SOLVER_MSK_FALSE= fi if test $osi_mc_solver = Spx; then OSICBC_DFLT_SOLVER_SPX_TRUE= OSICBC_DFLT_SOLVER_SPX_FALSE='#' else OSICBC_DFLT_SOLVER_SPX_TRUE='#' OSICBC_DFLT_SOLVER_SPX_FALSE= fi if test $osi_mc_solver = Sym; then OSICBC_DFLT_SOLVER_SYM_TRUE= OSICBC_DFLT_SOLVER_SYM_FALSE='#' else OSICBC_DFLT_SOLVER_SYM_TRUE='#' OSICBC_DFLT_SOLVER_SYM_FALSE= fi if test $osi_mc_solver = Vol; then OSICBC_DFLT_SOLVER_VOL_TRUE= OSICBC_DFLT_SOLVER_VOL_FALSE='#' else OSICBC_DFLT_SOLVER_VOL_TRUE='#' OSICBC_DFLT_SOLVER_VOL_FALSE= fi if test $osi_mc_solver = Xpr; then OSICBC_DFLT_SOLVER_XPR_TRUE= OSICBC_DFLT_SOLVER_XPR_FALSE='#' else OSICBC_DFLT_SOLVER_XPR_TRUE='#' OSICBC_DFLT_SOLVER_XPR_FALSE= fi ############################################################################## # VPATH links for example input files # ############################################################################## # In case this is a VPATH configuration we need to make sure that the # input files for the examples are available in the VPATH directory. echo "$as_me:$LINENO: checking whether this is a VPATH configuration" >&5 echo $ECHO_N "checking whether this is a VPATH configuration... $ECHO_C" >&6 if test `cd $srcdir; pwd` != `pwd`; then coin_vpath_config=yes; else coin_vpath_config=no; fi echo "$as_me:$LINENO: result: $coin_vpath_config" >&5 echo "${ECHO_T}$coin_vpath_config" >&6 # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="examples/sudoku_sample.csv" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="examples/quad.mps" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="examples/quad2.mps" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi ############################################################################# # Check for doxygen # ############################################################################# { echo "$as_me:$LINENO: configuring doxygen documentation options" >&5 echo "$as_me: configuring doxygen documentation options" >&6;} # Check to see if doxygen is available. # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_doxygen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_doxygen"; then ac_cv_prog_coin_have_doxygen="$coin_have_doxygen" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_doxygen="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_doxygen" && ac_cv_prog_coin_have_doxygen="no" fi fi coin_have_doxygen=$ac_cv_prog_coin_have_doxygen if test -n "$coin_have_doxygen"; then echo "$as_me:$LINENO: result: $coin_have_doxygen" >&5 echo "${ECHO_T}$coin_have_doxygen" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_latex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_latex"; then ac_cv_prog_coin_have_latex="$coin_have_latex" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_latex="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_latex" && ac_cv_prog_coin_have_latex="no" fi fi coin_have_latex=$ac_cv_prog_coin_have_latex if test -n "$coin_have_latex"; then echo "$as_me:$LINENO: result: $coin_have_latex" >&5 echo "${ECHO_T}$coin_have_latex" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Look for the dot tool from the graphviz package, unless the user has # disabled it. # Check whether --with-dot or --without-dot was given. if test "${with_dot+set}" = set; then withval="$with_dot" else withval=yes fi; if test x"$withval" = xno ; then coin_doxy_usedot=NO echo "$as_me:$LINENO: checking for dot " >&5 echo $ECHO_N "checking for dot ... $ECHO_C" >&6 echo "$as_me:$LINENO: result: disabled" >&5 echo "${ECHO_T}disabled" >&6 else # Extract the first word of "dot", so it can be a program name with args. set dummy dot; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_doxy_usedot+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_doxy_usedot"; then ac_cv_prog_coin_doxy_usedot="$coin_doxy_usedot" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_doxy_usedot="YES" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_doxy_usedot" && ac_cv_prog_coin_doxy_usedot="NO" fi fi coin_doxy_usedot=$ac_cv_prog_coin_doxy_usedot if test -n "$coin_doxy_usedot"; then echo "$as_me:$LINENO: result: $coin_doxy_usedot" >&5 echo "${ECHO_T}$coin_doxy_usedot" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi # Generate a tag file name and a log file name coin_doxy_tagname=doxydoc/${PACKAGE}_doxy.tag coin_doxy_logname=doxydoc/${PACKAGE}_doxy.log if test $coin_have_doxygen = yes; then COIN_HAS_DOXYGEN_TRUE= COIN_HAS_DOXYGEN_FALSE='#' else COIN_HAS_DOXYGEN_TRUE='#' COIN_HAS_DOXYGEN_FALSE= fi if test $coin_have_latex = yes; then COIN_HAS_LATEX_TRUE= COIN_HAS_LATEX_FALSE='#' else COIN_HAS_LATEX_TRUE='#' COIN_HAS_LATEX_FALSE= fi # Process the list of project names and massage them into possible doxygen # doc'n directories. Prefer 1) classic external, source processed using # a project-specific doxygen.conf, we use the tag file; 2) classic # external, source processed using package doxygen.conf; 3) installed # doxydoc. Alternatives 1) and 2) are only possible if the directory will be # configured, which we can't know unless this is the package base configure, # since coin_subdirs is only set there. Hence it's sufficient to check for # membership. If we use a tag file from a classic external, exclude the # source from doxygen processing when doxygen runs in the base directory. coin_doxy_tagfiles= coin_doxy_excludes= tmp="CoinUtils Osi Clp DyLP Cgl Vol" for proj in $tmp ; do lc_proj=`echo $proj | tr [A-Z] [a-z]` echo "$as_me:$LINENO: checking for doxygen doc'n for $proj " >&5 echo $ECHO_N "checking for doxygen doc'n for $proj ... $ECHO_C" >&6 doxytag=${lc_proj}_doxy.tag doxyfound=no # proj will be configured, hence doxydoc present in build tree doxysrcdir="${srcdir}/../${proj}" # AC_MSG_NOTICE([Considering $doxysrcdir (base)]) if test -d "$doxysrcdir" ; then # with a doxydoc directory? doxydir="$doxysrcdir/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (base)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) if test -d "$doxydir" ; then # use tag file; don't process source doxydir="../${proj}/doxydoc" coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=../../$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 coin_doxy_excludes="$coin_doxy_excludes */${proj}" else # will process the source -- nothing further to be done here echo "$as_me:$LINENO: result: $doxysrcdir (src)" >&5 echo "${ECHO_T}$doxysrcdir (src)" >&6 fi doxyfound=yes fi # Not built, fall back to installed tag file if test $doxyfound = no ; then eval doxydir="${datadir}/coin/doc/${proj}/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (install)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 fi done ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) ac_config_files="$ac_config_files Makefile examples/Makefile src/Makefile src/OsiCbc/Makefile test/Makefile cbc.pc cbc-uninstalled.pc osi-cbc.pc osi-cbc-uninstalled.pc" ac_config_files="$ac_config_files doxydoc/doxygen.conf" # Here put the location and name of the configuration header file ac_config_headers="$ac_config_headers src/config.h src/config_cbc.h" # Finally, we let configure write all the output... echo "$as_me:$LINENO: checking which command should be used to link input files" >&5 echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac echo "$as_me:$LINENO: result: $coin_link_input_cmd" >&5 echo "${ECHO_T}$coin_link_input_cmd" >&6 if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${ALWAYS_FALSE_TRUE}" && test -z "${ALWAYS_FALSE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CC_IS_CL_TRUE}" && test -z "${COIN_CC_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CXX_IS_CL_TRUE}" && test -z "${COIN_CXX_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_EXTERNALS_TRUE}" && test -z "${HAVE_EXTERNALS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${DEPENDENCY_LINKING_TRUE}" && test -z "${DEPENDENCY_LINKING_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_PKGCONFIG_TRUE}" && test -z "${COIN_HAS_PKGCONFIG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_COINDEPEND_TRUE}" && test -z "${COIN_HAS_COINDEPEND_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_COINDEPEND\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_COINDEPEND\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_COINDEPEND_TRUE}" && test -z "${COIN_HAS_COINDEPEND_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_COINDEPEND\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_COINDEPEND\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_CLP_TRUE}" && test -z "${COIN_HAS_CLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_CLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_CLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_CLP_TRUE}" && test -z "${COIN_HAS_CLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_CLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_CLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSITESTS_TRUE}" && test -z "${COIN_HAS_OSITESTS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSITESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSITESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSITESTS_TRUE}" && test -z "${COIN_HAS_OSITESTS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSITESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSITESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NETLIB_TRUE}" && test -z "${COIN_HAS_NETLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NETLIB_TRUE}" && test -z "${COIN_HAS_NETLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_MIPLIB3_TRUE}" && test -z "${COIN_HAS_MIPLIB3_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_MIPLIB3\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_MIPLIB3\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_MIPLIB3_TRUE}" && test -z "${COIN_HAS_MIPLIB3_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_MIPLIB3\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_MIPLIB3\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_DYLP_TRUE}" && test -z "${COIN_HAS_DYLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_DYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_DYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_DYLP_TRUE}" && test -z "${COIN_HAS_DYLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_DYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_DYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_VOL_TRUE}" && test -z "${COIN_HAS_VOL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_VOL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_VOL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_VOL_TRUE}" && test -z "${COIN_HAS_VOL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_VOL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_VOL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_CPX_TRUE}" && test -z "${COIN_HAS_CPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_CPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_CPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_CPX_TRUE}" && test -z "${COIN_HAS_CPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_CPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_CPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GRB_TRUE}" && test -z "${COIN_HAS_GRB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GRB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GRB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GRB_TRUE}" && test -z "${COIN_HAS_GRB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GRB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GRB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_MSK_TRUE}" && test -z "${COIN_HAS_MSK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_MSK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_MSK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_MSK_TRUE}" && test -z "${COIN_HAS_MSK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_MSK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_MSK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SPX_TRUE}" && test -z "${COIN_HAS_SPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SPX_TRUE}" && test -z "${COIN_HAS_SPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_XPR_TRUE}" && test -z "${COIN_HAS_XPR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_XPR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_XPR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_XPR_TRUE}" && test -z "${COIN_HAS_XPR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_XPR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_XPR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_ASL_TRUE}" && test -z "${COIN_HAS_ASL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_ASL_TRUE}" && test -z "${COIN_HAS_ASL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NTY_TRUE}" && test -z "${COIN_HAS_NTY_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NTY\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NTY\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${CBC_BUILD_CBC_GENERIC_TRUE}" && test -z "${CBC_BUILD_CBC_GENERIC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"CBC_BUILD_CBC_GENERIC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"CBC_BUILD_CBC_GENERIC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_CLP_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_CLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_CLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_CLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_CPX_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_CPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_CPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_CPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_DYLP_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_DYLP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_DYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_DYLP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_GLPK_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_GRB_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_GRB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_GRB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_GRB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_MSK_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_MSK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_MSK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_MSK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_SPX_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_SPX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_SPX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_SPX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_SYM_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_SYM_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_SYM\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_SYM\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_VOL_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_VOL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_VOL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_VOL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OSICBC_DFLT_SOLVER_XPR_TRUE}" && test -z "${OSICBC_DFLT_SOLVER_XPR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OSICBC_DFLT_SOLVER_XPR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OSICBC_DFLT_SOLVER_XPR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_DOXYGEN_TRUE}" && test -z "${COIN_HAS_DOXYGEN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LATEX_TRUE}" && test -z "${COIN_HAS_LATEX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by Cbc $as_me 2.9.6, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Cbc config.status 2.9.6 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/OsiCbc/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiCbc/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "cbc.pc" ) CONFIG_FILES="$CONFIG_FILES cbc.pc" ;; "cbc-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES cbc-uninstalled.pc" ;; "osi-cbc.pc" ) CONFIG_FILES="$CONFIG_FILES osi-cbc.pc" ;; "osi-cbc-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-cbc-uninstalled.pc" ;; "doxydoc/doxygen.conf" ) CONFIG_FILES="$CONFIG_FILES doxydoc/doxygen.conf" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "src/config_cbc.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config_cbc.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@ALWAYS_FALSE_TRUE@,$ALWAYS_FALSE_TRUE,;t t s,@ALWAYS_FALSE_FALSE@,$ALWAYS_FALSE_FALSE,;t t s,@have_svnversion@,$have_svnversion,;t t s,@CBC_SVN_REV@,$CBC_SVN_REV,;t t s,@CDEFS@,$CDEFS,;t t s,@ADD_CFLAGS@,$ADD_CFLAGS,;t t s,@DBG_CFLAGS@,$DBG_CFLAGS,;t t s,@OPT_CFLAGS@,$OPT_CFLAGS,;t t s,@sol_cc_compiler@,$sol_cc_compiler,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@COIN_CC_IS_CL_TRUE@,$COIN_CC_IS_CL_TRUE,;t t s,@COIN_CC_IS_CL_FALSE@,$COIN_CC_IS_CL_FALSE,;t t s,@MPICC@,$MPICC,;t t s,@CXXDEFS@,$CXXDEFS,;t t s,@ADD_CXXFLAGS@,$ADD_CXXFLAGS,;t t s,@DBG_CXXFLAGS@,$DBG_CXXFLAGS,;t t s,@OPT_CXXFLAGS@,$OPT_CXXFLAGS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@COIN_CXX_IS_CL_TRUE@,$COIN_CXX_IS_CL_TRUE,;t t s,@COIN_CXX_IS_CL_FALSE@,$COIN_CXX_IS_CL_FALSE,;t t s,@MPICXX@,$MPICXX,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBTOOLM4@,$LIBTOOLM4,;t t s,@have_autoconf@,$have_autoconf,;t t s,@have_automake@,$have_automake,;t t s,@have_svn@,$have_svn,;t t s,@BUILDTOOLSDIR@,$BUILDTOOLSDIR,;t t s,@AUX_DIR@,$AUX_DIR,;t t s,@abs_source_dir@,$abs_source_dir,;t t s,@abs_lib_dir@,$abs_lib_dir,;t t s,@abs_include_dir@,$abs_include_dir,;t t s,@abs_bin_dir@,$abs_bin_dir,;t t s,@HAVE_EXTERNALS_TRUE@,$HAVE_EXTERNALS_TRUE,;t t s,@HAVE_EXTERNALS_FALSE@,$HAVE_EXTERNALS_FALSE,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@CXXCPP@,$CXXCPP,;t t s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@ac_c_preproc_warn_flag@,$ac_c_preproc_warn_flag,;t t s,@ac_cxx_preproc_warn_flag@,$ac_cxx_preproc_warn_flag,;t t s,@RPATH_FLAGS@,$RPATH_FLAGS,;t t s,@DEPENDENCY_LINKING_TRUE@,$DEPENDENCY_LINKING_TRUE,;t t s,@DEPENDENCY_LINKING_FALSE@,$DEPENDENCY_LINKING_FALSE,;t t s,@LT_LDFLAGS@,$LT_LDFLAGS,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@ac_ct_PKG_CONFIG@,$ac_ct_PKG_CONFIG,;t t s,@COIN_HAS_PKGCONFIG_TRUE@,$COIN_HAS_PKGCONFIG_TRUE,;t t s,@COIN_HAS_PKGCONFIG_FALSE@,$COIN_HAS_PKGCONFIG_FALSE,;t t s,@COIN_PKG_CONFIG_PATH@,$COIN_PKG_CONFIG_PATH,;t t s,@COIN_PKG_CONFIG_PATH_UNINSTALLED@,$COIN_PKG_CONFIG_PATH_UNINSTALLED,;t t s,@COINDEPEND_LIBS@,$COINDEPEND_LIBS,;t t s,@COINDEPEND_CFLAGS@,$COINDEPEND_CFLAGS,;t t s,@COINDEPEND_DATA@,$COINDEPEND_DATA,;t t s,@COINDEPEND_DEPENDENCIES@,$COINDEPEND_DEPENDENCIES,;t t s,@COINDEPEND_LIBS_INSTALLED@,$COINDEPEND_LIBS_INSTALLED,;t t s,@COINDEPEND_CFLAGS_INSTALLED@,$COINDEPEND_CFLAGS_INSTALLED,;t t s,@COINDEPEND_DATA_INSTALLED@,$COINDEPEND_DATA_INSTALLED,;t t s,@CBCLIB_CFLAGS@,$CBCLIB_CFLAGS,;t t s,@CBCLIB_LIBS@,$CBCLIB_LIBS,;t t s,@CBCLIB_PCLIBS@,$CBCLIB_PCLIBS,;t t s,@CBCLIB_PCREQUIRES@,$CBCLIB_PCREQUIRES,;t t s,@CBCLIB_DEPENDENCIES@,$CBCLIB_DEPENDENCIES,;t t s,@CBCLIB_CFLAGS_INSTALLED@,$CBCLIB_CFLAGS_INSTALLED,;t t s,@CBCLIB_LIBS_INSTALLED@,$CBCLIB_LIBS_INSTALLED,;t t s,@CBCGENERIC_CFLAGS@,$CBCGENERIC_CFLAGS,;t t s,@CBCGENERIC_LIBS@,$CBCGENERIC_LIBS,;t t s,@CBCGENERIC_PCLIBS@,$CBCGENERIC_PCLIBS,;t t s,@CBCGENERIC_PCREQUIRES@,$CBCGENERIC_PCREQUIRES,;t t s,@CBCGENERIC_DEPENDENCIES@,$CBCGENERIC_DEPENDENCIES,;t t s,@CBCGENERIC_CFLAGS_INSTALLED@,$CBCGENERIC_CFLAGS_INSTALLED,;t t s,@CBCGENERIC_LIBS_INSTALLED@,$CBCGENERIC_LIBS_INSTALLED,;t t s,@COIN_HAS_COINDEPEND_TRUE@,$COIN_HAS_COINDEPEND_TRUE,;t t s,@COIN_HAS_COINDEPEND_FALSE@,$COIN_HAS_COINDEPEND_FALSE,;t t s,@CLP_LIBS@,$CLP_LIBS,;t t s,@CLP_CFLAGS@,$CLP_CFLAGS,;t t s,@CLP_DATA@,$CLP_DATA,;t t s,@CLP_DEPENDENCIES@,$CLP_DEPENDENCIES,;t t s,@CLP_LIBS_INSTALLED@,$CLP_LIBS_INSTALLED,;t t s,@CLP_CFLAGS_INSTALLED@,$CLP_CFLAGS_INSTALLED,;t t s,@CLP_DATA_INSTALLED@,$CLP_DATA_INSTALLED,;t t s,@COIN_HAS_CLP_TRUE@,$COIN_HAS_CLP_TRUE,;t t s,@COIN_HAS_CLP_FALSE@,$COIN_HAS_CLP_FALSE,;t t s,@OSITESTS_LIBS@,$OSITESTS_LIBS,;t t s,@OSITESTS_CFLAGS@,$OSITESTS_CFLAGS,;t t s,@OSITESTS_DATA@,$OSITESTS_DATA,;t t s,@OSITESTS_DEPENDENCIES@,$OSITESTS_DEPENDENCIES,;t t s,@OSITESTS_LIBS_INSTALLED@,$OSITESTS_LIBS_INSTALLED,;t t s,@OSITESTS_CFLAGS_INSTALLED@,$OSITESTS_CFLAGS_INSTALLED,;t t s,@OSITESTS_DATA_INSTALLED@,$OSITESTS_DATA_INSTALLED,;t t s,@COIN_HAS_OSITESTS_TRUE@,$COIN_HAS_OSITESTS_TRUE,;t t s,@COIN_HAS_OSITESTS_FALSE@,$COIN_HAS_OSITESTS_FALSE,;t t s,@SAMPLE_LIBS@,$SAMPLE_LIBS,;t t s,@SAMPLE_CFLAGS@,$SAMPLE_CFLAGS,;t t s,@SAMPLE_DATA@,$SAMPLE_DATA,;t t s,@SAMPLE_DEPENDENCIES@,$SAMPLE_DEPENDENCIES,;t t s,@SAMPLE_LIBS_INSTALLED@,$SAMPLE_LIBS_INSTALLED,;t t s,@SAMPLE_CFLAGS_INSTALLED@,$SAMPLE_CFLAGS_INSTALLED,;t t s,@SAMPLE_DATA_INSTALLED@,$SAMPLE_DATA_INSTALLED,;t t s,@COIN_HAS_SAMPLE_TRUE@,$COIN_HAS_SAMPLE_TRUE,;t t s,@COIN_HAS_SAMPLE_FALSE@,$COIN_HAS_SAMPLE_FALSE,;t t s,@NETLIB_LIBS@,$NETLIB_LIBS,;t t s,@NETLIB_CFLAGS@,$NETLIB_CFLAGS,;t t s,@NETLIB_DATA@,$NETLIB_DATA,;t t s,@NETLIB_DEPENDENCIES@,$NETLIB_DEPENDENCIES,;t t s,@NETLIB_LIBS_INSTALLED@,$NETLIB_LIBS_INSTALLED,;t t s,@NETLIB_CFLAGS_INSTALLED@,$NETLIB_CFLAGS_INSTALLED,;t t s,@NETLIB_DATA_INSTALLED@,$NETLIB_DATA_INSTALLED,;t t s,@COIN_HAS_NETLIB_TRUE@,$COIN_HAS_NETLIB_TRUE,;t t s,@COIN_HAS_NETLIB_FALSE@,$COIN_HAS_NETLIB_FALSE,;t t s,@MIPLIB3_LIBS@,$MIPLIB3_LIBS,;t t s,@MIPLIB3_CFLAGS@,$MIPLIB3_CFLAGS,;t t s,@MIPLIB3_DATA@,$MIPLIB3_DATA,;t t s,@MIPLIB3_DEPENDENCIES@,$MIPLIB3_DEPENDENCIES,;t t s,@MIPLIB3_LIBS_INSTALLED@,$MIPLIB3_LIBS_INSTALLED,;t t s,@MIPLIB3_CFLAGS_INSTALLED@,$MIPLIB3_CFLAGS_INSTALLED,;t t s,@MIPLIB3_DATA_INSTALLED@,$MIPLIB3_DATA_INSTALLED,;t t s,@COIN_HAS_MIPLIB3_TRUE@,$COIN_HAS_MIPLIB3_TRUE,;t t s,@COIN_HAS_MIPLIB3_FALSE@,$COIN_HAS_MIPLIB3_FALSE,;t t s,@DYLP_LIBS@,$DYLP_LIBS,;t t s,@DYLP_CFLAGS@,$DYLP_CFLAGS,;t t s,@DYLP_DATA@,$DYLP_DATA,;t t s,@DYLP_DEPENDENCIES@,$DYLP_DEPENDENCIES,;t t s,@DYLP_LIBS_INSTALLED@,$DYLP_LIBS_INSTALLED,;t t s,@DYLP_CFLAGS_INSTALLED@,$DYLP_CFLAGS_INSTALLED,;t t s,@DYLP_DATA_INSTALLED@,$DYLP_DATA_INSTALLED,;t t s,@COIN_HAS_DYLP_TRUE@,$COIN_HAS_DYLP_TRUE,;t t s,@COIN_HAS_DYLP_FALSE@,$COIN_HAS_DYLP_FALSE,;t t s,@VOL_LIBS@,$VOL_LIBS,;t t s,@VOL_CFLAGS@,$VOL_CFLAGS,;t t s,@VOL_DATA@,$VOL_DATA,;t t s,@VOL_DEPENDENCIES@,$VOL_DEPENDENCIES,;t t s,@VOL_LIBS_INSTALLED@,$VOL_LIBS_INSTALLED,;t t s,@VOL_CFLAGS_INSTALLED@,$VOL_CFLAGS_INSTALLED,;t t s,@VOL_DATA_INSTALLED@,$VOL_DATA_INSTALLED,;t t s,@COIN_HAS_VOL_TRUE@,$COIN_HAS_VOL_TRUE,;t t s,@COIN_HAS_VOL_FALSE@,$COIN_HAS_VOL_FALSE,;t t s,@CPX_LIBS@,$CPX_LIBS,;t t s,@CPX_CFLAGS@,$CPX_CFLAGS,;t t s,@CPX_DATA@,$CPX_DATA,;t t s,@CPX_DEPENDENCIES@,$CPX_DEPENDENCIES,;t t s,@CPX_LIBS_INSTALLED@,$CPX_LIBS_INSTALLED,;t t s,@CPX_CFLAGS_INSTALLED@,$CPX_CFLAGS_INSTALLED,;t t s,@CPX_DATA_INSTALLED@,$CPX_DATA_INSTALLED,;t t s,@COIN_HAS_CPX_TRUE@,$COIN_HAS_CPX_TRUE,;t t s,@COIN_HAS_CPX_FALSE@,$COIN_HAS_CPX_FALSE,;t t s,@GLPK_LIBS@,$GLPK_LIBS,;t t s,@GLPK_CFLAGS@,$GLPK_CFLAGS,;t t s,@GLPK_DATA@,$GLPK_DATA,;t t s,@GLPK_DEPENDENCIES@,$GLPK_DEPENDENCIES,;t t s,@GLPK_LIBS_INSTALLED@,$GLPK_LIBS_INSTALLED,;t t s,@GLPK_CFLAGS_INSTALLED@,$GLPK_CFLAGS_INSTALLED,;t t s,@GLPK_DATA_INSTALLED@,$GLPK_DATA_INSTALLED,;t t s,@COIN_HAS_GLPK_TRUE@,$COIN_HAS_GLPK_TRUE,;t t s,@COIN_HAS_GLPK_FALSE@,$COIN_HAS_GLPK_FALSE,;t t s,@GRB_LIBS@,$GRB_LIBS,;t t s,@GRB_CFLAGS@,$GRB_CFLAGS,;t t s,@GRB_DATA@,$GRB_DATA,;t t s,@GRB_DEPENDENCIES@,$GRB_DEPENDENCIES,;t t s,@GRB_LIBS_INSTALLED@,$GRB_LIBS_INSTALLED,;t t s,@GRB_CFLAGS_INSTALLED@,$GRB_CFLAGS_INSTALLED,;t t s,@GRB_DATA_INSTALLED@,$GRB_DATA_INSTALLED,;t t s,@COIN_HAS_GRB_TRUE@,$COIN_HAS_GRB_TRUE,;t t s,@COIN_HAS_GRB_FALSE@,$COIN_HAS_GRB_FALSE,;t t s,@MSK_LIBS@,$MSK_LIBS,;t t s,@MSK_CFLAGS@,$MSK_CFLAGS,;t t s,@MSK_DATA@,$MSK_DATA,;t t s,@MSK_DEPENDENCIES@,$MSK_DEPENDENCIES,;t t s,@MSK_LIBS_INSTALLED@,$MSK_LIBS_INSTALLED,;t t s,@MSK_CFLAGS_INSTALLED@,$MSK_CFLAGS_INSTALLED,;t t s,@MSK_DATA_INSTALLED@,$MSK_DATA_INSTALLED,;t t s,@COIN_HAS_MSK_TRUE@,$COIN_HAS_MSK_TRUE,;t t s,@COIN_HAS_MSK_FALSE@,$COIN_HAS_MSK_FALSE,;t t s,@SPX_LIBS@,$SPX_LIBS,;t t s,@SPX_CFLAGS@,$SPX_CFLAGS,;t t s,@SPX_DATA@,$SPX_DATA,;t t s,@SPX_DEPENDENCIES@,$SPX_DEPENDENCIES,;t t s,@SPX_LIBS_INSTALLED@,$SPX_LIBS_INSTALLED,;t t s,@SPX_CFLAGS_INSTALLED@,$SPX_CFLAGS_INSTALLED,;t t s,@SPX_DATA_INSTALLED@,$SPX_DATA_INSTALLED,;t t s,@COIN_HAS_SPX_TRUE@,$COIN_HAS_SPX_TRUE,;t t s,@COIN_HAS_SPX_FALSE@,$COIN_HAS_SPX_FALSE,;t t s,@XPR_LIBS@,$XPR_LIBS,;t t s,@XPR_CFLAGS@,$XPR_CFLAGS,;t t s,@XPR_DATA@,$XPR_DATA,;t t s,@XPR_DEPENDENCIES@,$XPR_DEPENDENCIES,;t t s,@XPR_LIBS_INSTALLED@,$XPR_LIBS_INSTALLED,;t t s,@XPR_CFLAGS_INSTALLED@,$XPR_CFLAGS_INSTALLED,;t t s,@XPR_DATA_INSTALLED@,$XPR_DATA_INSTALLED,;t t s,@COIN_HAS_XPR_TRUE@,$COIN_HAS_XPR_TRUE,;t t s,@COIN_HAS_XPR_FALSE@,$COIN_HAS_XPR_FALSE,;t t s,@ASL_LIBS@,$ASL_LIBS,;t t s,@ASL_CFLAGS@,$ASL_CFLAGS,;t t s,@ASL_DATA@,$ASL_DATA,;t t s,@ASL_DEPENDENCIES@,$ASL_DEPENDENCIES,;t t s,@ASL_LIBS_INSTALLED@,$ASL_LIBS_INSTALLED,;t t s,@ASL_CFLAGS_INSTALLED@,$ASL_CFLAGS_INSTALLED,;t t s,@ASL_DATA_INSTALLED@,$ASL_DATA_INSTALLED,;t t s,@COIN_HAS_ASL_TRUE@,$COIN_HAS_ASL_TRUE,;t t s,@COIN_HAS_ASL_FALSE@,$COIN_HAS_ASL_FALSE,;t t s,@NTYINCDIR@,$NTYINCDIR,;t t s,@NTYLIB@,$NTYLIB,;t t s,@COIN_HAS_NTY_TRUE@,$COIN_HAS_NTY_TRUE,;t t s,@COIN_HAS_NTY_FALSE@,$COIN_HAS_NTY_FALSE,;t t s,@CBC_BUILD_CBC_GENERIC_TRUE@,$CBC_BUILD_CBC_GENERIC_TRUE,;t t s,@CBC_BUILD_CBC_GENERIC_FALSE@,$CBC_BUILD_CBC_GENERIC_FALSE,;t t s,@OSICBC_DFLT_SOLVER_CLP_TRUE@,$OSICBC_DFLT_SOLVER_CLP_TRUE,;t t s,@OSICBC_DFLT_SOLVER_CLP_FALSE@,$OSICBC_DFLT_SOLVER_CLP_FALSE,;t t s,@OSICBC_DFLT_SOLVER_CPX_TRUE@,$OSICBC_DFLT_SOLVER_CPX_TRUE,;t t s,@OSICBC_DFLT_SOLVER_CPX_FALSE@,$OSICBC_DFLT_SOLVER_CPX_FALSE,;t t s,@OSICBC_DFLT_SOLVER_DYLP_TRUE@,$OSICBC_DFLT_SOLVER_DYLP_TRUE,;t t s,@OSICBC_DFLT_SOLVER_DYLP_FALSE@,$OSICBC_DFLT_SOLVER_DYLP_FALSE,;t t s,@OSICBC_DFLT_SOLVER_GLPK_TRUE@,$OSICBC_DFLT_SOLVER_GLPK_TRUE,;t t s,@OSICBC_DFLT_SOLVER_GLPK_FALSE@,$OSICBC_DFLT_SOLVER_GLPK_FALSE,;t t s,@OSICBC_DFLT_SOLVER_GRB_TRUE@,$OSICBC_DFLT_SOLVER_GRB_TRUE,;t t s,@OSICBC_DFLT_SOLVER_GRB_FALSE@,$OSICBC_DFLT_SOLVER_GRB_FALSE,;t t s,@OSICBC_DFLT_SOLVER_MSK_TRUE@,$OSICBC_DFLT_SOLVER_MSK_TRUE,;t t s,@OSICBC_DFLT_SOLVER_MSK_FALSE@,$OSICBC_DFLT_SOLVER_MSK_FALSE,;t t s,@OSICBC_DFLT_SOLVER_SPX_TRUE@,$OSICBC_DFLT_SOLVER_SPX_TRUE,;t t s,@OSICBC_DFLT_SOLVER_SPX_FALSE@,$OSICBC_DFLT_SOLVER_SPX_FALSE,;t t s,@OSICBC_DFLT_SOLVER_SYM_TRUE@,$OSICBC_DFLT_SOLVER_SYM_TRUE,;t t s,@OSICBC_DFLT_SOLVER_SYM_FALSE@,$OSICBC_DFLT_SOLVER_SYM_FALSE,;t t s,@OSICBC_DFLT_SOLVER_VOL_TRUE@,$OSICBC_DFLT_SOLVER_VOL_TRUE,;t t s,@OSICBC_DFLT_SOLVER_VOL_FALSE@,$OSICBC_DFLT_SOLVER_VOL_FALSE,;t t s,@OSICBC_DFLT_SOLVER_XPR_TRUE@,$OSICBC_DFLT_SOLVER_XPR_TRUE,;t t s,@OSICBC_DFLT_SOLVER_XPR_FALSE@,$OSICBC_DFLT_SOLVER_XPR_FALSE,;t t s,@coin_have_doxygen@,$coin_have_doxygen,;t t s,@coin_have_latex@,$coin_have_latex,;t t s,@coin_doxy_usedot@,$coin_doxy_usedot,;t t s,@coin_doxy_tagname@,$coin_doxy_tagname,;t t s,@coin_doxy_logname@,$coin_doxy_logname,;t t s,@COIN_HAS_DOXYGEN_TRUE@,$COIN_HAS_DOXYGEN_TRUE,;t t s,@COIN_HAS_DOXYGEN_FALSE@,$COIN_HAS_DOXYGEN_FALSE,;t t s,@COIN_HAS_LATEX_TRUE@,$COIN_HAS_LATEX_TRUE,;t t s,@COIN_HAS_LATEX_FALSE@,$COIN_HAS_LATEX_FALSE,;t t s,@coin_doxy_tagfiles@,$coin_doxy_tagfiles,;t t s,@coin_doxy_excludes@,$coin_doxy_excludes,;t t s,@LIBEXT@,$LIBEXT,;t t s,@VPATH_DISTCLEANFILES@,$VPATH_DISTCLEANFILES,;t t s,@ABSBUILDDIR@,$ABSBUILDDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then { echo "$as_me:$LINENO: Copying data files for VPATH configuration" >&5 echo "$as_me: Copying data files for VPATH configuration" >&6;} else { echo "$as_me:$LINENO: Creating VPATH links for data files" >&5 echo "$as_me: Creating VPATH links for data files" >&6;} fi for file in $coin_vpath_link_files; do dir=`(dirname "./$file") 2>/dev/null || $as_expr X"./$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"./$file" : 'X\(//\)[^/]' \| \ X"./$file" : 'X\(//\)$' \| \ X"./$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"./$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test -d $dir; then : ; else { if $as_mkdir_p; then mkdir -p $dir else as_dir=$dir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dir" >&5 echo "$as_me: error: cannot create directory $dir" >&2;} { (exit 1); exit 1; }; }; } fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi { echo "$as_me:$LINENO: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&5 echo "$as_me: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&6;} if test x$coin_projectdir = xyes; then { echo "$as_me:$LINENO: Configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} else { echo "$as_me:$LINENO: Main configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Main configuration of $PACKAGE_NAME successful" >&6;} fi else { echo "$as_me:$LINENO: No configuration of $PACKAGE_NAME necessary" >&5 echo "$as_me: No configuration of $PACKAGE_NAME necessary" >&6;} fi CoinMP-1.8.3/Cbc/cbc.pc.in0000644000175000017500000000046111510112067013456 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: CBC Description: COIN-OR Branch and Cut URL: https://projects.coin-or.org/Cbc Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lCbcSolver -lCbc @CBCLIB_PCLIBS@ Cflags: -I${includedir} Requires: @CBCLIB_PCREQUIRES@ CoinMP-1.8.3/Cbc/INSTALL0000644000175000017500000000030612131054770013033 0ustar renereneThis is a project directory. For information on how to install the package this project was downloaded with see the INSTALL file in the root of the package (the parent directory of this directory). CoinMP-1.8.3/Cbc/CbcSourceFilesTable.xls0000644000175000017500000006600011277055727016355 0ustar renereneÐÏࡱá>þÿ 4þÿÿÿþÿÿÿ3ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ s ÍÉÀá°Áâ\pBjarni Kristjansson B°aÀ=œ¯¼=âÿŸQÒ8X@"·Ú1Èÿ¨Arial1Èÿ¨Arial1Èÿ¨Arial1Èÿ¨Arial1 ÿ¨Arial1Èÿ¼¨Arial"$"#,##0_);\("$"#,##0\)!"$"#,##0_);[Red]\("$"#,##0\)""$"#,##0.00_);\("$"#,##0.00\)'""$"#,##0.00_);[Red]\("$"#,##0.00\)7*2_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_).))_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)?,:_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)6+1_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)àõÿ À àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ à À à+õÿ øÀ à)õÿ øÀ à,õÿ øÀ à*õÿ øÀ à õÿ øÀ à À à @À “€ÿ“€ÿ“€ÿ“€ÿ“€ÿ“€ÿ`…PSheet1…aBSheet2…hCSheet3ŒÁÁ"¾ü*¯CbcBranchActual.cppCbcBranchBase.cppCbcBranchCut.cppCbcBranchDynamic.cppCbcBranchLotsize.cppCbcCbcParam.cppCbcCompareActual.cppCbcCountRowCut.cppCbcCutGenerator.cppCbcEventHandler.cpp CbcFathom.cppCbcFathomDynamicProgramming.cpp CbcGenBaB.cppCbcGenCbcParam.cppCbcGenCbcParamUtils.cppCbcGenCtlBlk.cppCbcGeneric.cppCbcGenMessages.cppCbcGenOsiParam.cppCbcGenOsiParamUtils.cppCbcGenParam.cppCbcGenParamUtils.cppCbcGenSolution.cppCbcGenSolvers.cppCbcHeuristic.cppCbcHeuristicDive.cppCbcHeuristicDiveCoefficient.cppCbcHeuristicDiveFractional.cppCbcHeuristicDiveGuided.cppCbcHeuristicDiveLineSearch.cppCbcHeuristicDivePseudoCost.cpp CbcHeuristicDiveVectorLength.cppCbcHeuristicFPump.cppCbcHeuristicGreedy.cppCbcHeuristicLocal.cppCbcHeuristicPivotAndFix.cppCbcHeuristicRandRound.cppCbcHeuristicRINS.cpp CbcLinked.cpp CbcMain.cppCbcMessage.cpp CbcModel.cpp CbcNode.cpp CbcParam.cpp CbcSolver.cppCbcStatistics.cppCbcStrategy.cpp CbcTree.cppCbcTreeLocal.cpp Cbc_ampl.cppCbc_C_Interface.cppClpAmplObjective.cppClpAmplStuff.cpp CoinSolve.cpp unitTest.cppunitTestClp.cppBranch InterfaceAmplTest HeuristicGenericFilenameGroup CPP LinesAThe support functions for the main branch-and-cut action routine.4Implementation functions for CbcGenParam parameters.,Constructors and destructors for CbcCbcParamDUnnamed local namespace for cbc-generic support types and functions.,Constructors and destructors for CbcOsiParam3Implementation functions for CbcOsiParam parameters,Constructors and destructors for CbcGenParam3Implementation functions for CbcGenParam parameters‚Helper routine to generate masks for selecting names to print. Returns true if masks are generated without error, false otherwise.¥This file contains routines related to handling Osi solvers. The technique is to maintain a map of OsiSolverInterface objects as prototypes of the available solvers.libCbcxcbcSolve cbcGeneric*Constructor for cbc-generic control block.Message definitions.CommentCbcAmpl Other ObjectsMultiple CbcTreeLocalCbcTree CbcTreeArray CbcStrategyCbcStrategyDefault*CbcAmpl*, Multiple CbcStatisticsCbcParam2CbcNodeInfo, CbcFullNodeInfo, CbcPartialNodeInfo, CbcNodeCbcModel CbcMessage OsiSolverLink_OsiLinkedBound, OsiHeuristicDynamic3, OsiOldLink, OsiBiLinear*, OsiSimpleFixedInteger, MultipleCbcHeuristicRINSCbcHeuristicRandRoundCbcHeuristicPivotAndFixCbcHeuristicLocalCbcHeuristicNaiveCbcHeuristicGreedyCoverCbcHeuristicGreedyEqualityCbcHeuristicFPumpCbcDisasterHandlerCbcHeuristicDiveVectorLengthCbcHeuristicDivePseudoCostCbcHeuristicDiveLineSearchCbcHeuristicDiveGuidedCbcHeuristicDiveFractionalCbcHeuristicDiveCoefficientCbcHeuristicDive CbcHeuristicmCbcHeuristicNode, CbcHeuristicNodeList, CbcRounding, CbcHeuristicPartial, CbcSerendipity, CbcHeuristicJustOneCbcFathomDynamicProgramming CbcFathom CbcOsiSolverCbcEventHandlerCbcCutGenerator$CbcCutModifier, CbcCutSubsetModifierCbcCountRowCutCbcCompareDepth:CbcCompareObjective, CbcCompareDefault, CbcCompareEstimate#include "CbcOrClpParam.cpp" CbcLotsizeCbcLotsizeBranchingObject!CbcSimpleIntegerDynamicPseudoCost=CbcDynamicPseudoCostBranchingObject, CbcBranchDynamicDecision CbcBranchCut@CbcCutBranchingObject, CbcBranchToFixLots, CbcBranchAllDifferent CbcObjectJCbcBranchingObject, CbcBranchDecision, CbcConsequence, CbcObjectUpdateData CbcGenCtlBlk CbcCbcParamnamespace CbcCbcParamUtils CbcOsiParamnamespace CbcOsiParamUtils CbcGenParamnamespace CbcGenSolversCbcGenParamUtils namespacenamespace CbcGenParamUtilsnamespace CbcGenSolvers, CbcCompareUser, namespacemain CbcSolverCbcMainglobalClpAmplObjectiveMyMessageHandler2¾CbcClique, CbcSos, CbcSimpleInteger, CbcIntegerBranchingObject, CbcSimpleIntegerPseudoCost, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSosBranchingObject, CbcBranchDefaultDecision, CbcFollowOn, CbcFixingBranchingObject, CbcNWay, CbcNWayBranchingObject, CbcFixVariable, CbcDummyBranchingObject, CbcGeneral, CbcGeneralDepth, CbcGeneralBranchingObject, CbcOneGeneralBranchingObject, CbcSubProblem First ObjectSolverPersonBjarniLou HPP Lines3CbcHeuristicRENS, CbcHeuristicDINS, CbcHeuristicVNDCbcCompareBase.hppCbcCompareBaseCbcCompare, CbcChooseVariable CbcConfig.h#definesCbcFeasibilityBase.hppCbcFeasibilityBaseClpConstraintAmpl.hppOther ProjectsAge Total LinesStatusEdwinCompareÿ²ø ¡µQeø çûŸ ³ 4³ Çÿ  ¤EY³ÇQe =Q # ) ì &:Ã×Qebv%9ccÒ s ÍÉÀ =~ 2ÇA  dü©ñÒMbP?_*+‚€%ÿÁƒ„Mj\\OFFICE1\Dell Printer 5100cn ÜŒSÿ€ê odXXLetterPRIVâ0''''ÄÈ\KhCŸ}­ôÿÿÈDFBF0040/#Ñùgü-¤Oµ_ÉûËÜ}Ìd¡"dXXà?à?U} $"} $ } I+} I(=ÿ€ÿÿÿÿÿÿÿÿ ÿ ÿ ÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿý >ý ?ý œý ¬ý ªý @ý Ÿý «ý Ký Mý Ný ©ý šý Sý Qý ý 8ý ­½ @Ü´@|œ@!û»@ÌÆý DÀDÀý Lý  Tý  ™ý ý 8ý ­½$@v@†@Œ@þ¼<; LþÀLÿÀý Lý  …ý  †ý ý 8ý ­½$@ø@°s@è”@ÿý Lý  ƒý  „ý ý 8ý ­½ @Ü@h@H£@ÿý Lý  ý  ‚ý ý 8ý ­½.@H‰@@o@Œ@ÿý Lý  ý  €ý ý ›ý ½8@ð?ð?ÿý Lý  ~ý ý ®½ @ð|@ d@ ƒ@ÿý Lý  |ý  }ý ¡ý ®~ 8@~ @e@@e@ ÿý Lý  ¢ý  £ý ¤~ 4@~ €Y@ €Y@ ÿý Lý ¥ý ½ $@€_@À\@  n@ ÿý Lý {ý ½ @“@à@ ›@ ÿý Lý yý zý  ½ B@@Y@ k@  t@ ÿý Lý xý  ½ 3@€Z@€_@ m@ÿý Lý vý wý  ½$@l@Àd@“@ÿý Lý  uý ¦~ 8@~ €J@€J@ÿý Lý  §ý  ý =ý ž½,@°‹@°‹@ÿý  Lý  ý  ý Aý  ý =ý ž½8@`c@ g@€u@ÿý  Lý  ˆý Cý ý =ý ž½2@y@y@ÿý  Lý  ‰ý Bý ý =ý ž½8@H…@ @t™@ÿý Lý  Lý  ‡ý Oý ý =ý ž½8@ðy@ðy@ÿý  Lý  ý  ý Dý ý =ý ž½8@h@h@ÿý Lý  ‡ý Pý ý =ý ž½8@€c@ h@v@ÿý  Lý  Šý Eý ý =ý ž½2@€€@€€@ÿý  Lý  ‹ý Fý ý =ý ž½8@@c@`k@Pw@ÿý  Lý  Œý Gý ý =ý ž½2@d—@d—@ÿý  Lý  ý  ‘ý Hý ý =ý ž½6@@‚@@‚@ÿý  Lý  Žý  ý Iý ý =ý ž½8@Pp@Pp@ÿý  Lý  ý  ý Jý ý <½$@ª¦@P„@¾«@ÿý Lý  sý  tý ý <½$@°@d@0“@ÿý Lý  rý ý <½(@`@€H@ f@ÿý Lý  qý ý <½2@\@€H@ d@ ÿý Lý  p×DJlÒ•¨{eesesee—‰—‰‰———ss ÿ!ÿ"ÿ#ÿ$ÿ%ÿ&ÿ'ÿ(ÿ)ÿ*ÿ+ÿ,ÿ-ÿ.ÿ/ÿ0ÿ1ÿ2ÿ3ÿ4ÿ5ÿ6ÿ7ÿ8ÿ9ÿ:ÿ;ÿ<ÿý ý <½ 2@À^@J@ àe@!ÿý Lý oý !ý !<½!2@^@€H@! e@"ÿý !Lý ! ný "ý "<½"2@`l@€L@"Àq@#ÿý "Lý " mý #ý #<½#$@À^@€H@#€e@$ÿý #Lý # lý $ ý $<½$ @˜¥@ðs@$¨@%ÿý $Lý $ jý $ ký %!ý %<½%1@èŠ@ g@%h@&ÿý %Lý % hý % iý &"ý &<½& @@‘@j@&€”@'ÿý &Lý & fý & gý '#ý '<½',@È€@€K@'€‚@(ÿý 'Lý ' eý ($ý (<½($@€@€K@(È@)ÿý (Lý ( dý )%ý )<½)$@Ü’@€r@)|—@*ÿý )Lý ) cý )  ý *&½*$@7À@ì•@*€ôÂ@+ÿý *Lý * aý * bý +'½+,@Ì™@+Ì™@,ÿý + Lý + “ý + ’ý ,(½,*@Z@ÀU@,àg@-ÿý ,Lý , `ý -)½-@+Ð@|¤@-ÀºÒ@.ÿý -Lý - _ý .*½.´@0‰@.5·@/ÿý .Lý . ^ý . ]ý /+ý /›ý /½/8@`@ m@/‡@0ÿý /Lý / \ý 0,ý 0›ý 0½0€2Æ@0€2Æ@1ÿý 0 Lý 0 ”ý 0 •ý 1-½15@a@€X@1@m@2ÿý 1Lý 1 [ý 2.½2 @`@ào@2¬’@3ÿý 2Lý 2 Xý 2 Yý 3/½3 @h’@0z@3ô˜@4ÿý 3Lý 3 Vý 3 Wý 40½4$@L›@w@4ˆ @5ÿý 4Lý 4 Uý 51ý 5:½5@€—@@P@5„˜@6ÿý 5 Lý 5 –ý 62ý 69ý 6½6@ô£@„@6©@7ÿý 6 Lý 6 –ý 73ý 7:½7,@p‡@€[@7àŠ@8ÿý 7 Lý 7 —ý 84ý 8:½8@h•@8h•@9ÿý 8Lý 8 Rý 8 Zý 9¨ý 9:~ 98@~ 9@Z@9@Z@:ÿý :5ý :›½: @`u@:`u@;ÿý : Lý : ˜ý : “ý ;6ý ;;½; @ z@; z@<ÿý ; Lý ; –ý <7ý <;½<@P†@<P†@ÿý < Lý < –×>_0sssssssmees‰essess{W{m>¶@A à@ ÿ? ï7 s ÍÉÀ C  dü©ñÒMbP?_*+‚€%ÿÁƒ„¡"ÿà?à?U>¶@ï7 s ÍÉÀ  D  dü©ñÒMbP?_*+‚€%ÿÁƒ„¡"ÿà?à?U>¶@ï7 þÿà…ŸòùOh«‘+'³Ù0¸@Hd€ ˜ ¤°äBjarni KristjanssonBjarni KristjanssonMicrosoft Excel@Sðü|NÊ@)‰ÉcÊþÿÕÍÕœ.“—+,ù®0ì PXx €ˆ˜   ÉäMaximal Software, Inc.' Sheet1Sheet2Sheet3  Worksheets  !"þÿÿÿ$%&'()*þÿÿÿ,-./012þÿÿÿýÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ ÀFðÊòuÊcÊþÿÿÿWorkbookÿÿÿÿÿÿÿÿÿÿÿÿoDSummaryInformation(ÿÿÿÿ#DocumentSummaryInformation8ÿÿÿÿÿÿÿÿÿÿÿÿ+CoinMP-1.8.3/Cbc/ltmain.sh0000755000175000017500000057753011405215312013641 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/Cbc/config.guess0000755000175000017500000012706311405215312014326 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Cbc/test/0000755000175000017500000000000012600453456012767 5ustar renereneCoinMP-1.8.3/Cbc/test/Makefile.in0000644000175000017500000007267112547035070015047 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ @COIN_HAS_CLP_TRUE@am__append_1 = test_cbc ctests @CBC_BUILD_CBC_GENERIC_TRUE@@COIN_HAS_SAMPLE_TRUE@am__append_2 = test_cbc_generic @COIN_HAS_SAMPLE_TRUE@am__append_3 = -dirSample `$(CYGPATH_W) $(SAMPLE_DATA)` @COIN_HAS_SAMPLE_TRUE@am__append_4 = -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` @COIN_HAS_MIPLIB3_TRUE@am__append_5 = -dirMiplib `$(CYGPATH_W) $(MIPLIB3_DATA)` -miplib @COIN_HAS_NETLIB_TRUE@am__append_6 = -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testOsiSolverInterface bin_PROGRAMS = gamsTest$(EXEEXT) osiUnitTest$(EXEEXT) \ CInterfaceTest$(EXEEXT) subdir = test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cbc.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_CInterfaceTest_OBJECTS = CInterfaceTest.$(OBJEXT) CInterfaceTest_OBJECTS = $(am_CInterfaceTest_OBJECTS) am__DEPENDENCIES_1 = am_gamsTest_OBJECTS = gamsTest.$(OBJEXT) gamsTest_OBJECTS = $(am_gamsTest_OBJECTS) am_osiUnitTest_OBJECTS = osiUnitTest.$(OBJEXT) \ OsiCbcSolverInterfaceTest.$(OBJEXT) osiUnitTest_OBJECTS = $(am_osiUnitTest_OBJECTS) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(CInterfaceTest_SOURCES) \ $(nodist_EXTRA_CInterfaceTest_SOURCES) $(gamsTest_SOURCES) \ $(osiUnitTest_SOURCES) DIST_SOURCES = $(CInterfaceTest_SOURCES) $(gamsTest_SOURCES) \ $(osiUnitTest_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ ASL_CFLAGS = @ASL_CFLAGS@ ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ ASL_DATA = @ASL_DATA@ ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ ASL_LIBS = @ASL_LIBS@ ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CBCGENERIC_CFLAGS = @CBCGENERIC_CFLAGS@ CBCGENERIC_CFLAGS_INSTALLED = @CBCGENERIC_CFLAGS_INSTALLED@ CBCGENERIC_DEPENDENCIES = @CBCGENERIC_DEPENDENCIES@ CBCGENERIC_LIBS = @CBCGENERIC_LIBS@ CBCGENERIC_LIBS_INSTALLED = @CBCGENERIC_LIBS_INSTALLED@ CBCGENERIC_PCLIBS = @CBCGENERIC_PCLIBS@ CBCGENERIC_PCREQUIRES = @CBCGENERIC_PCREQUIRES@ CBCLIB_CFLAGS = @CBCLIB_CFLAGS@ CBCLIB_CFLAGS_INSTALLED = @CBCLIB_CFLAGS_INSTALLED@ CBCLIB_DEPENDENCIES = @CBCLIB_DEPENDENCIES@ CBCLIB_LIBS = @CBCLIB_LIBS@ CBCLIB_LIBS_INSTALLED = @CBCLIB_LIBS_INSTALLED@ CBCLIB_PCLIBS = @CBCLIB_PCLIBS@ CBCLIB_PCREQUIRES = @CBCLIB_PCREQUIRES@ CBC_BUILD_CBC_GENERIC_FALSE = @CBC_BUILD_CBC_GENERIC_FALSE@ CBC_BUILD_CBC_GENERIC_TRUE = @CBC_BUILD_CBC_GENERIC_TRUE@ CBC_SVN_REV = @CBC_SVN_REV@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CLP_CFLAGS = @CLP_CFLAGS@ CLP_CFLAGS_INSTALLED = @CLP_CFLAGS_INSTALLED@ CLP_DATA = @CLP_DATA@ CLP_DATA_INSTALLED = @CLP_DATA_INSTALLED@ CLP_DEPENDENCIES = @CLP_DEPENDENCIES@ CLP_LIBS = @CLP_LIBS@ CLP_LIBS_INSTALLED = @CLP_LIBS_INSTALLED@ COINDEPEND_CFLAGS = @COINDEPEND_CFLAGS@ COINDEPEND_CFLAGS_INSTALLED = @COINDEPEND_CFLAGS_INSTALLED@ COINDEPEND_DATA = @COINDEPEND_DATA@ COINDEPEND_DATA_INSTALLED = @COINDEPEND_DATA_INSTALLED@ COINDEPEND_DEPENDENCIES = @COINDEPEND_DEPENDENCIES@ COINDEPEND_LIBS = @COINDEPEND_LIBS@ COINDEPEND_LIBS_INSTALLED = @COINDEPEND_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ COIN_HAS_CLP_FALSE = @COIN_HAS_CLP_FALSE@ COIN_HAS_CLP_TRUE = @COIN_HAS_CLP_TRUE@ COIN_HAS_COINDEPEND_FALSE = @COIN_HAS_COINDEPEND_FALSE@ COIN_HAS_COINDEPEND_TRUE = @COIN_HAS_COINDEPEND_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_DYLP_FALSE = @COIN_HAS_DYLP_FALSE@ COIN_HAS_DYLP_TRUE = @COIN_HAS_DYLP_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MIPLIB3_FALSE = @COIN_HAS_MIPLIB3_FALSE@ COIN_HAS_MIPLIB3_TRUE = @COIN_HAS_MIPLIB3_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_NTY_FALSE = @COIN_HAS_NTY_FALSE@ COIN_HAS_NTY_TRUE = @COIN_HAS_NTY_TRUE@ COIN_HAS_OSITESTS_FALSE = @COIN_HAS_OSITESTS_FALSE@ COIN_HAS_OSITESTS_TRUE = @COIN_HAS_OSITESTS_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SPX_FALSE = @COIN_HAS_SPX_FALSE@ COIN_HAS_SPX_TRUE = @COIN_HAS_SPX_TRUE@ COIN_HAS_VOL_FALSE = @COIN_HAS_VOL_FALSE@ COIN_HAS_VOL_TRUE = @COIN_HAS_VOL_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPX_CFLAGS = @CPX_CFLAGS@ CPX_CFLAGS_INSTALLED = @CPX_CFLAGS_INSTALLED@ CPX_DATA = @CPX_DATA@ CPX_DATA_INSTALLED = @CPX_DATA_INSTALLED@ CPX_DEPENDENCIES = @CPX_DEPENDENCIES@ CPX_LIBS = @CPX_LIBS@ CPX_LIBS_INSTALLED = @CPX_LIBS_INSTALLED@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ DYLP_CFLAGS = @DYLP_CFLAGS@ DYLP_CFLAGS_INSTALLED = @DYLP_CFLAGS_INSTALLED@ DYLP_DATA = @DYLP_DATA@ DYLP_DATA_INSTALLED = @DYLP_DATA_INSTALLED@ DYLP_DEPENDENCIES = @DYLP_DEPENDENCIES@ DYLP_LIBS = @DYLP_LIBS@ DYLP_LIBS_INSTALLED = @DYLP_LIBS_INSTALLED@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRB_CFLAGS = @GRB_CFLAGS@ GRB_CFLAGS_INSTALLED = @GRB_CFLAGS_INSTALLED@ GRB_DATA = @GRB_DATA@ GRB_DATA_INSTALLED = @GRB_DATA_INSTALLED@ GRB_DEPENDENCIES = @GRB_DEPENDENCIES@ GRB_LIBS = @GRB_LIBS@ GRB_LIBS_INSTALLED = @GRB_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MIPLIB3_CFLAGS = @MIPLIB3_CFLAGS@ MIPLIB3_CFLAGS_INSTALLED = @MIPLIB3_CFLAGS_INSTALLED@ MIPLIB3_DATA = @MIPLIB3_DATA@ MIPLIB3_DATA_INSTALLED = @MIPLIB3_DATA_INSTALLED@ MIPLIB3_DEPENDENCIES = @MIPLIB3_DEPENDENCIES@ MIPLIB3_LIBS = @MIPLIB3_LIBS@ MIPLIB3_LIBS_INSTALLED = @MIPLIB3_LIBS_INSTALLED@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSK_CFLAGS = @MSK_CFLAGS@ MSK_CFLAGS_INSTALLED = @MSK_CFLAGS_INSTALLED@ MSK_DATA = @MSK_DATA@ MSK_DATA_INSTALLED = @MSK_DATA_INSTALLED@ MSK_DEPENDENCIES = @MSK_DEPENDENCIES@ MSK_LIBS = @MSK_LIBS@ MSK_LIBS_INSTALLED = @MSK_LIBS_INSTALLED@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ NTYINCDIR = @NTYINCDIR@ NTYLIB = @NTYLIB@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICBC_DFLT_SOLVER_CLP_FALSE = @OSICBC_DFLT_SOLVER_CLP_FALSE@ OSICBC_DFLT_SOLVER_CLP_TRUE = @OSICBC_DFLT_SOLVER_CLP_TRUE@ OSICBC_DFLT_SOLVER_CPX_FALSE = @OSICBC_DFLT_SOLVER_CPX_FALSE@ OSICBC_DFLT_SOLVER_CPX_TRUE = @OSICBC_DFLT_SOLVER_CPX_TRUE@ OSICBC_DFLT_SOLVER_DYLP_FALSE = @OSICBC_DFLT_SOLVER_DYLP_FALSE@ OSICBC_DFLT_SOLVER_DYLP_TRUE = @OSICBC_DFLT_SOLVER_DYLP_TRUE@ OSICBC_DFLT_SOLVER_GLPK_FALSE = @OSICBC_DFLT_SOLVER_GLPK_FALSE@ OSICBC_DFLT_SOLVER_GLPK_TRUE = @OSICBC_DFLT_SOLVER_GLPK_TRUE@ OSICBC_DFLT_SOLVER_GRB_FALSE = @OSICBC_DFLT_SOLVER_GRB_FALSE@ OSICBC_DFLT_SOLVER_GRB_TRUE = @OSICBC_DFLT_SOLVER_GRB_TRUE@ OSICBC_DFLT_SOLVER_MSK_FALSE = @OSICBC_DFLT_SOLVER_MSK_FALSE@ OSICBC_DFLT_SOLVER_MSK_TRUE = @OSICBC_DFLT_SOLVER_MSK_TRUE@ OSICBC_DFLT_SOLVER_SPX_FALSE = @OSICBC_DFLT_SOLVER_SPX_FALSE@ OSICBC_DFLT_SOLVER_SPX_TRUE = @OSICBC_DFLT_SOLVER_SPX_TRUE@ OSICBC_DFLT_SOLVER_SYM_FALSE = @OSICBC_DFLT_SOLVER_SYM_FALSE@ OSICBC_DFLT_SOLVER_SYM_TRUE = @OSICBC_DFLT_SOLVER_SYM_TRUE@ OSICBC_DFLT_SOLVER_VOL_FALSE = @OSICBC_DFLT_SOLVER_VOL_FALSE@ OSICBC_DFLT_SOLVER_VOL_TRUE = @OSICBC_DFLT_SOLVER_VOL_TRUE@ OSICBC_DFLT_SOLVER_XPR_FALSE = @OSICBC_DFLT_SOLVER_XPR_FALSE@ OSICBC_DFLT_SOLVER_XPR_TRUE = @OSICBC_DFLT_SOLVER_XPR_TRUE@ OSITESTS_CFLAGS = @OSITESTS_CFLAGS@ OSITESTS_CFLAGS_INSTALLED = @OSITESTS_CFLAGS_INSTALLED@ OSITESTS_DATA = @OSITESTS_DATA@ OSITESTS_DATA_INSTALLED = @OSITESTS_DATA_INSTALLED@ OSITESTS_DEPENDENCIES = @OSITESTS_DEPENDENCIES@ OSITESTS_LIBS = @OSITESTS_LIBS@ OSITESTS_LIBS_INSTALLED = @OSITESTS_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SPX_CFLAGS = @SPX_CFLAGS@ SPX_CFLAGS_INSTALLED = @SPX_CFLAGS_INSTALLED@ SPX_DATA = @SPX_DATA@ SPX_DATA_INSTALLED = @SPX_DATA_INSTALLED@ SPX_DEPENDENCIES = @SPX_DEPENDENCIES@ SPX_LIBS = @SPX_LIBS@ SPX_LIBS_INSTALLED = @SPX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VOL_CFLAGS = @VOL_CFLAGS@ VOL_CFLAGS_INSTALLED = @VOL_CFLAGS_INSTALLED@ VOL_DATA = @VOL_DATA@ VOL_DATA_INSTALLED = @VOL_DATA_INSTALLED@ VOL_DEPENDENCIES = @VOL_DEPENDENCIES@ VOL_LIBS = @VOL_LIBS@ VOL_LIBS_INSTALLED = @VOL_LIBS_INSTALLED@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPR_CFLAGS = @XPR_CFLAGS@ XPR_CFLAGS_INSTALLED = @XPR_CFLAGS_INSTALLED@ XPR_DATA = @XPR_DATA@ XPR_DATA_INSTALLED = @XPR_DATA_INSTALLED@ XPR_DEPENDENCIES = @XPR_DEPENDENCIES@ XPR_LIBS = @XPR_LIBS@ XPR_LIBS_INSTALLED = @XPR_LIBS_INSTALLED@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # unitTest for Cbc # ######################################################################## CBC_TEST_TGTS = gamstests ositests $(am__append_1) $(am__append_2) cbcflags = $(am__append_3) -unitTest $(am__append_5) ositestsflags = $(am__append_4) $(am__append_6) gamsTest_SOURCES = gamsTest.cpp gamsTest_LDADD = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_LIBS) gamsTest_DEPENDENCIES = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_DEPENDENCIES) AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` $(COINDEPEND_CFLAGS) \ $(CLP_CFLAGS) $(CPX_CFLAGS) $(DYLP_CFLAGS) $(GLPK_CFLAGS) \ $(MSK_CFLAGS) $(VOL_CFLAGS) $(XPR_CFLAGS) -I`$(CYGPATH_W) \ $(srcdir)/../src/OsiCbc` $(OSITESTS_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src ######################################################################## # unitTest for OsiCbc # ######################################################################## osiUnitTest_SOURCES = osiUnitTest.cpp OsiCbcSolverInterfaceTest.cpp osiUnitTest_LDADD = ../src/OsiCbc/libOsiCbc.la ../src/libCbc.la \ $(CBCLIB_LIBS) $(OSITESTS_LIBS) osiUnitTest_DEPENDENCIES = ../src/OsiCbc/libOsiCbc.la ../src/libCbc.la \ $(CBCLIB_DEPENDENCIES) $(OSITESTS_DEPENDENCIES) ######################################################################## # unitTest for CbcCInterface # ######################################################################## CInterfaceTest_SOURCES = CInterfaceTest.c nodist_EXTRA_CInterfaceTest_SOURCES = dummy.cpp # force using C++ linker CInterfaceTest_LDADD = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_LIBS) CInterfaceTest_DEPENDENCIES = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_DEPENDENCIES) ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = yy.mps xx.mps continuous.mps integer.mps test2.lp test2.out test.lp test.mps test.out x1.mps.mps x2.mps.mps x3.mps.mps all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 test/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign test/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done CInterfaceTest$(EXEEXT): $(CInterfaceTest_OBJECTS) $(CInterfaceTest_DEPENDENCIES) @rm -f CInterfaceTest$(EXEEXT) $(CXXLINK) $(CInterfaceTest_LDFLAGS) $(CInterfaceTest_OBJECTS) $(CInterfaceTest_LDADD) $(LIBS) gamsTest$(EXEEXT): $(gamsTest_OBJECTS) $(gamsTest_DEPENDENCIES) @rm -f gamsTest$(EXEEXT) $(CXXLINK) $(gamsTest_LDFLAGS) $(gamsTest_OBJECTS) $(gamsTest_LDADD) $(LIBS) osiUnitTest$(EXEEXT): $(osiUnitTest_OBJECTS) $(osiUnitTest_DEPENDENCIES) @rm -f osiUnitTest$(EXEEXT) $(CXXLINK) $(osiUnitTest_LDFLAGS) $(osiUnitTest_OBJECTS) $(osiUnitTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiCbcSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamsTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osiUnitTest.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: 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: uninstall-binPROGRAMS uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ 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 \ uninstall-binPROGRAMS uninstall-info-am # We are using the solver executables to do the unit test test: $(CBC_TEST_TGTS) test_cbc: ../src/cbc$(EXEEXT) ../src/cbc$(EXEEXT) $(cbcflags) @COIN_HAS_SAMPLE_TRUE@test_cbc_generic: ../src/cbc-generic$(EXEEXT) @COIN_HAS_SAMPLE_TRUE@ echo "A minimal test is all that cbc-generic can manage just yet." @COIN_HAS_SAMPLE_TRUE@ ../src/cbc-generic$(EXEEXT) \ @COIN_HAS_SAMPLE_TRUE@ -directory `$(CYGPATH_W) $(SAMPLE_DATA)` -import p0033.mps -branch gamstests: gamsTest$(EXEEXT) ./gamsTest$(EXEEXT) .PHONY: test ositests: osiUnitTest$(EXEEXT) ./osiUnitTest$(EXEEXT) $(ositestsflags) ctests: CInterfaceTest$(EXEEXT) ./CInterfaceTest$(EXEEXT) # 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: CoinMP-1.8.3/Cbc/test/Makefile.am0000644000175000017500000000731012371046416015023 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 2054 2014-08-08 04:07:42Z mlubin $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # unitTest for Cbc # ######################################################################## CBC_TEST_TGTS = gamstests ositests if COIN_HAS_CLP CBC_TEST_TGTS += test_cbc ctests endif if CBC_BUILD_CBC_GENERIC if COIN_HAS_SAMPLE CBC_TEST_TGTS += test_cbc_generic endif endif cbcflags = ositestsflags = if COIN_HAS_SAMPLE cbcflags += -dirSample `$(CYGPATH_W) $(SAMPLE_DATA)` ositestsflags += -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` endif cbcflags += -unitTest if COIN_HAS_MIPLIB3 cbcflags += -dirMiplib `$(CYGPATH_W) $(MIPLIB3_DATA)` -miplib endif if COIN_HAS_NETLIB ositestsflags += -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testOsiSolverInterface endif # We are using the solver executables to do the unit test test: $(CBC_TEST_TGTS) test_cbc: ../src/cbc$(EXEEXT) ../src/cbc$(EXEEXT) $(cbcflags) if COIN_HAS_SAMPLE test_cbc_generic: ../src/cbc-generic$(EXEEXT) echo "A minimal test is all that cbc-generic can manage just yet." ../src/cbc-generic$(EXEEXT) \ -directory `$(CYGPATH_W) $(SAMPLE_DATA)` -import p0033.mps -branch endif gamstests: gamsTest$(EXEEXT) ./gamsTest$(EXEEXT) .PHONY: test bin_PROGRAMS = gamsTest osiUnitTest CInterfaceTest gamsTest_SOURCES = gamsTest.cpp gamsTest_LDADD = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_LIBS) gamsTest_DEPENDENCIES = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_DEPENDENCIES) AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` $(COINDEPEND_CFLAGS) AM_CPPFLAGS += $(CLP_CFLAGS) $(CPX_CFLAGS) $(DYLP_CFLAGS) $(GLPK_CFLAGS) $(MSK_CFLAGS) $(VOL_CFLAGS) $(XPR_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src ######################################################################## # unitTest for OsiCbc # ######################################################################## osiUnitTest_SOURCES = osiUnitTest.cpp OsiCbcSolverInterfaceTest.cpp osiUnitTest_LDADD = ../src/OsiCbc/libOsiCbc.la ../src/libCbc.la \ $(CBCLIB_LIBS) $(OSITESTS_LIBS) osiUnitTest_DEPENDENCIES = ../src/OsiCbc/libOsiCbc.la ../src/libCbc.la \ $(CBCLIB_DEPENDENCIES) $(OSITESTS_DEPENDENCIES) AM_CPPFLAGS += -I`$(CYGPATH_W) $(srcdir)/../src/OsiCbc` $(OSITESTS_CFLAGS) ositests: osiUnitTest$(EXEEXT) ./osiUnitTest$(EXEEXT) $(ositestsflags) ######################################################################## # unitTest for CbcCInterface # ######################################################################## CInterfaceTest_SOURCES = CInterfaceTest.c nodist_EXTRA_CInterfaceTest_SOURCES = dummy.cpp # force using C++ linker CInterfaceTest_LDADD = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_LIBS) CInterfaceTest_DEPENDENCIES = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_DEPENDENCIES) ctests: CInterfaceTest$(EXEEXT) ./CInterfaceTest$(EXEEXT) ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = yy.mps xx.mps continuous.mps integer.mps test2.lp test2.out test.lp test.mps test.out x1.mps.mps x2.mps.mps x3.mps.mps CoinMP-1.8.3/Cbc/test/gamsTest.cpp0000644000175000017500000006043112101340057015252 0ustar renerene// $Id: gamsTest.cpp 1854 2013-01-28 00:02:55Z stefan $ // Copyright (C) 2008, Stefan Vigerske, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include using namespace std; #include "CoinHelperFunctions.hpp" #include "CoinError.hpp" #include "CbcModel.hpp" #include "CbcBranchActual.hpp" //for CbcSOS #include "CbcBranchLotsize.hpp" //for CbcLotsize #include "OsiClpSolverInterface.hpp" #define testtol 1e-6 /** model sos1a from the GAMS test library * http://www.gams.com/testlib/libhtml/sos1a.htm */ void sos1a(int& error_count, int& warning_count); /** model sos2a from the GAMS test library * http://www.gams.com/testlib/libhtml/sos2a.htm */ void sos2a(int& error_count, int& warning_count); /** model semicon1 from the GAMS test library * http://www.gams.com/testlib/libhtml/semicon1.htm */ void semicon1(int& error_count, int& warning_count); /** model semiint1 from the GAMS test library * http://www.gams.com/testlib/libhtml/semiint1.htm */ void semiint1(int& error_count, int& warning_count); int main (int argc, const char *argv[]) { WindowsErrorPopupBlocker(); // only in CoinUtils/trunk: WindowsErrorPopupBlocker(); int error_count = 0; int warning_count = 0; sos1a(error_count, warning_count); cout << "\n***********************\n" << endl; sos2a(error_count, warning_count); cout << "\n***********************\n" << endl; semicon1(error_count, warning_count); cout << "\n***********************\n" << endl; semiint1(error_count, warning_count); cout << endl << "Finished - there have been " << error_count << " errors and " << warning_count << " warnings." << endl; return error_count; } void sos1a(int& error_count, int& warning_count) { OsiClpSolverInterface solver1; int numcols = 3; int numrows = 1; int nnz = 3; CoinBigIndex *start = new int[numcols+1]; int* index = new int[nnz]; double* value = new double[nnz]; double *collb = new double[numcols]; double *colub = new double[numcols]; double *obj = new double[numcols]; double *rowlb = new double[numrows]; double *rowub = new double[numrows]; // objective obj[0] = .9; obj[1] = 1.; obj[2] = 1.1; // column bounds collb[0] = 0.; colub[0] = .8; collb[1] = 0.; colub[1] = .6; collb[2] = 0.; colub[2] = .6; // matrix start[0] = 0; index[0] = 0; value[0] = 1.; start[1] = 1; index[1] = 0; value[1] = 1.; start[2] = 2; index[2] = 0; value[2] = 1.; start[3] = 3; // row bounds rowlb[0] = -solver1.getInfinity(); rowub[0] = 1.; solver1.loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); solver1.setObjSense(-1); CbcModel model(solver1); CbcMain0(model); int which[3] = { 0, 1, 2 }; CbcObject* sosobject = new CbcSOS(&model, 3, which, NULL, 0, 1); model.addObjects(1, &sosobject); delete sosobject; const char * argv2[]={"gamstest_sos1a","-solve","-quit"}; CbcMain1(3,argv2,model); cout << endl; if (!model.isProvenOptimal()) { cerr << "Error: Model sos1a not solved to optimality." << endl; ++error_count; return; // other tests make no sense ---- memory leak here } OsiSolverInterface* solver = model.solver(); assert(solver); cout << "Objective value model: " << model.getObjValue() << "\t solver: " << solver->getObjValue() << "\t expected: 0.72" << endl; if (CoinAbs(model.getObjValue()-0.72)>testtol || CoinAbs(solver->getObjValue()-0.72)>testtol) { cerr << "Error: Objective value incorrect." << endl; ++error_count; } cout << "Primal value variable 0 in model: " << model.bestSolution()[0] << "\t in solver: " << solver->getColSolution()[0] << "\t expected: 0.8" << endl; if (CoinAbs(model.bestSolution()[0]-0.8)>testtol || CoinAbs(solver->getColSolution()[0]-0.8)>testtol) { cerr << "Error: Primal value incorrect." << endl; ++error_count; } cout << "Primal value variable 1 in model: " << model.bestSolution()[1] << "\t in solver: " << solver->getColSolution()[1] << "\t expected: 0.0" << endl; if (CoinAbs(model.bestSolution()[1])>testtol || CoinAbs(solver->getColSolution()[1])>testtol) { cerr << "Error: Primal value incorrect." << endl; ++error_count; } cout << "Primal value variable 2 in model: " << model.bestSolution()[2] << "\t in solver: " << solver->getColSolution()[2] << "\t expected: 0.0" << endl; if (CoinAbs(model.bestSolution()[2])>testtol || CoinAbs(solver->getColSolution()[2])>testtol) { cerr << "Error: Primal value incorrect." << endl; ++error_count; } delete[] start; delete[] index; delete[] value; delete[] collb; delete[] colub; delete[] obj; delete[] rowlb; delete[] rowub; } void sos2a(int& error_count, int& warning_count) { OsiClpSolverInterface solver1; int numcols = 7; // w1, w2, w3, x, fx, fplus, fminus int numrows = 5; // wsum, xdef, fxdef, gapplus, gapminus int nnz = 15; CoinBigIndex *start = new int[numcols+1]; int* index = new int[nnz]; double* value = new double[nnz]; double *collb = new double[numcols]; double *colub = new double[numcols]; double *obj = new double[numcols]; double *rowlb = new double[numrows]; double *rowub = new double[numrows]; // objective obj[0] = 0.; obj[1] = 0.; obj[2] = 0.; obj[3] = 0.; obj[4] = 0.; obj[5] = 1.; obj[6] = 1.; // column bounds collb[0] = 0.; colub[0] = solver1.getInfinity(); collb[1] = 0.; colub[1] = solver1.getInfinity(); collb[2] = 0.; colub[2] = solver1.getInfinity(); collb[3] = -solver1.getInfinity(); colub[3] = solver1.getInfinity(); collb[4] = -solver1.getInfinity(); colub[4] = solver1.getInfinity(); collb[5] = 0.; colub[5] = solver1.getInfinity(); collb[6] = 0.; colub[6] = solver1.getInfinity(); // matrix start[0] = 0; index[0] = 0; value[0] = 1.; index[1] = 1; value[1] = 1.; index[2] = 2; value[2] = 1.; start[1] = 3; index[3] = 0; value[3] = 1.; index[4] = 1; value[4] = 2.; index[5] = 2; value[5] = 2.; start[2] = 6; index[6] = 0; value[6] = 1.; index[7] = 1; value[7] = 3.; index[8] = 2; value[8] = 3.; start[3] = 9; index[9] = 1; value[9] =-1.; start[4] =10; index[10]= 2; value[10]=-1.; index[11]= 3; value[11]=-1.; index[12]= 4; value[12]= 1.; start[5] =13; index[13]= 3; value[13]= 1.; start[6] =14; index[14]= 4; value[14]= 1.; start[7] =15; // row bounds rowlb[0] = 1. ; rowub[0] = 1.; rowlb[1] = 0. ; rowub[1] = 0.; rowlb[2] = 0. ; rowub[2] = 0.; rowlb[3] = -1.3; rowub[3] = solver1.getInfinity(); rowlb[4] = 1.3; rowub[4] = solver1.getInfinity(); solver1.loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); double* primalval = new double[numcols]; double* redcost = new double[numcols]; double optvalue = solver1.getInfinity(); for (int testcase = 0; testcase < 2; ++testcase) { switch(testcase) { case 0: solver1.setColLower(0, 0.); optvalue = 0.; primalval[0] = .7; redcost[0] = 0.; primalval[1] = .3; redcost[1] = 0.; primalval[2] =0. ; redcost[2] = 0.; primalval[3] =1.3; redcost[3] = 0.; primalval[4] =1.3; redcost[4] = 0.; primalval[5] =0. ; redcost[5] = 1.; primalval[6] =0. ; redcost[6] = 1.; break; case 1: solver1.setColLower(0, .8); optvalue = 0.1; primalval[0] = .8; redcost[0] = 1.; primalval[1] = .2; redcost[1] = 0.; primalval[2] =0. ; redcost[2] =-1.; primalval[3] =1.2; redcost[3] = 0.; primalval[4] =1.2; redcost[4] = 0.; primalval[5] =0. ; redcost[5] = 1.; primalval[6] =0.1; redcost[6] = 0.; break; } CbcModel model(solver1); CbcMain0(model); int which[3] = { 0, 1, 2 }; CbcObject* sosobject = new CbcSOS(&model, 3, which, NULL, 0, 2); model.addObjects(1, &sosobject); delete sosobject; const char * argv2[]={"gamstest_sos2a","-solve","-quit"}; cout << "\nSolving sos2a model with w1 having lower bound " << solver1.getColLower()[0] << endl; CbcMain1(3,argv2,model); cout << endl; if (!model.isProvenOptimal()) { cerr << "Error: Model sos2a not solved to optimality." << endl; ++error_count; continue; // other tests make no sense } OsiSolverInterface* solver = model.solver(); assert(solver); cout << "Objective value model: " << model.getObjValue() << "\t solver: " << solver->getObjValue() << "\t expected: " << optvalue << endl; if (CoinAbs(model.getObjValue()-optvalue)>testtol || CoinAbs(solver->getObjValue()-optvalue)>testtol) { cerr << "Error: Objective value incorrect." << endl; ++error_count; } for (int i=0; igetColSolution()[i] << "\t expected: " << primalval[i] << endl; if (CoinAbs(model.bestSolution()[i]-primalval[i])>testtol || CoinAbs(solver->getColSolution()[i]-primalval[i])>testtol) { cerr << "Error: Primal value incorrect." << endl; ++error_count; } } for (int i=0; igetReducedCost()[i] << "\t expected: " << redcost[i] << endl; if (CoinAbs(model.getReducedCost()[i]-redcost[i])>testtol || CoinAbs(solver->getReducedCost()[i]-redcost[i])>testtol) { cerr << "Warning: Reduced cost incorrect." << endl; ++warning_count; } } } delete[] start; delete[] index; delete[] value; delete[] collb; delete[] colub; delete[] obj; delete[] rowlb; delete[] rowub; delete[] primalval; delete[] redcost; } void semicon1(int& error_count, int& warning_count) { OsiClpSolverInterface solver1; int numcols = 4; // s, pup, plo, x int numrows = 3; // bigx, smallx, f int nnz = 6; CoinBigIndex *start = new int[numcols+1]; int* index = new int[nnz]; double* value = new double[nnz]; double *collb = new double[numcols]; double *colub = new double[numcols]; double *obj = new double[numcols]; double *rowlb = new double[numrows]; double *rowub = new double[numrows]; // objective obj[0] = 0; obj[1] = 1.; obj[2] = 1; obj[3] = 0; // column bounds collb[0] = 0.; colub[0] = 10.; collb[1] = 0.; colub[1] = solver1.getInfinity(); collb[2] = 0.; colub[2] = solver1.getInfinity(); collb[3] = 0.; colub[3] = solver1.getInfinity(); // matrix start[0] = 0; index[0] = 2; value[0] = 1.; start[1] = 1; index[1] = 0; value[1] = -1.; start[2] = 2; index[2] = 1; value[2] = 1.; start[3] = 3; index[3] = 0; value[3] = 1.; index[4] = 1; value[4] = 1.; index[5] = 2; value[5] = 1.; start[4] = nnz; // row bounds rowlb[0] = -solver1.getInfinity(); rowub[0] = 8.9; rowlb[1] = 8.9; rowub[1] = solver1.getInfinity(); rowlb[2] = 10.; rowub[2] = 10.; solver1.loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); for (int testcase = 0; testcase < 5; ++testcase) { CbcModel model(solver1); CbcMain0(model); double points[4] = { 0., 0., 0., 10. }; double objval; double primalval[4]; double redcost[4]; double row2marg; redcost[1] = 1.0; redcost[2] = 1.0; redcost[3] = 0.0; switch(testcase) { case 0: points[2] = 0.; objval = 0.; primalval[0] = 1.1; primalval[1] = 0.0; primalval[2] = 0.0; primalval[3] = 8.9; redcost[0] = 0.0; row2marg = 0.0; break; case 1: points[2] = 1.; objval = 0.; primalval[0] = 1.1; primalval[1] = 0.0; primalval[2] = 0.0; primalval[3] = 8.9; redcost[0] = 0.0; row2marg = 0.0; break; case 2: points[2] = 1.5; objval = 0.4; primalval[0] = 1.5; primalval[1] = 0.0; primalval[2] = 0.4; primalval[3] = 8.5; redcost[0] = 1.0; row2marg = -1.0; break; case 3: points[2] = 2.1; objval = 1.0; primalval[0] = 2.1; primalval[1] = 0.0; primalval[2] = 1.0; primalval[3] = 7.9; redcost[0] = 1.0; row2marg = -1.0; break; case 4: points[2] = 2.8; objval = 1.1; primalval[0] = 0.0; primalval[1] = 1.1; primalval[2] = 0.0; primalval[3] = 10.0; redcost[0] = -1.0; row2marg = 1.0; break; default: // to please the compile redcost[0] = 0.; row2marg = 0.; objval = 0.; } CbcObject* semiconobject = new CbcLotsize(&model, 0, 2, points, true); model.addObjects(1, &semiconobject); delete semiconobject; cout << "\nSolving semicon1 model for lotsize variable being either 0 or between " << points[2] << " and 10.\n" << endl; const char * argv2[]={"gamstest_semicon1","-solve","-quit"}; CbcMain1(3,argv2,model); cout << endl; if (!model.isProvenOptimal()) { cerr << "Error: Model semicon1 not solved to optimality." << endl; ++error_count; continue; // other tests make no sense } OsiSolverInterface* solver = model.solver(); assert(solver); cout << "Objective value in model: " << model.getObjValue() << "\t in solver: " << solver->getObjValue() << "\t expected: " << objval << endl; if (CoinAbs(model.getObjValue()-objval)>testtol || CoinAbs(solver->getObjValue()-objval)>testtol) { cerr << "Error: Objective value incorrect." << endl; ++error_count; } for (int i=0; igetColSolution()[i] << "\t expected: " << primalval[i] << endl; if (CoinAbs(model.bestSolution()[i]-primalval[i])>testtol || CoinAbs(solver->getColSolution()[i]-primalval[i])>testtol) { cerr << "Error: Primal value incorrect." << endl; ++error_count; } } cout << "Reduced cost variable " << 0 << " in model: " << model.getReducedCost()[0] << "\t in solver: " << solver->getReducedCost()[0] << "\t expected: " << redcost[0] << endl; if (CoinAbs(model.getReducedCost()[0]-redcost[0])>testtol || CoinAbs(solver->getReducedCost()[0]-redcost[0])>testtol) { cerr << "Warning: Reduced cost incorrect." << endl; ++warning_count; } cout << "Reduced cost variable " << 3 << " in model: " << model.getReducedCost()[3] << "\t in solver: " << solver->getReducedCost()[3] << "\t expected: " << redcost[3] << endl; if (CoinAbs(model.getReducedCost()[3]-redcost[3])>testtol || CoinAbs(solver->getReducedCost()[3]-redcost[3])>testtol) { cerr << "Warning: Reduced cost incorrect." << endl; ++warning_count; } cout << "Reduced cost variable 1 plus - dual of row 0 in model: " << model.getReducedCost()[1]-model.getRowPrice()[0] << "\t expected: " << redcost[1] << endl; if (CoinAbs(model.getReducedCost()[1]-model.getRowPrice()[0]-redcost[1])>testtol) { cerr << "Warning: Reduced cost or row margin incorrect." << endl; ++warning_count; } cout << "Reduced cost variable 2 plus + dual of row 1 in model: " << model.getReducedCost()[2]+model.getRowPrice()[1] << "\t expected: " << redcost[2] << endl; if (CoinAbs(model.getReducedCost()[2]+model.getRowPrice()[1]-redcost[2])>testtol) { cerr << "Warning: Reduced cost or row margin incorrect." << endl; ++warning_count; } cout << "Row 2 marginal (price) in model: " << model.getRowPrice()[2] << "\t in solver: " << solver->getRowPrice()[2] << "\t expected: " << row2marg << endl; if (CoinAbs(model.getRowPrice()[2]-row2marg)>testtol || CoinAbs(solver->getRowPrice()[2]-row2marg)>testtol) { cerr << "Warning: Row price incorrect." << endl; ++warning_count; } } delete[] start; delete[] index; delete[] value; delete[] collb; delete[] colub; delete[] obj; delete[] rowlb; delete[] rowub; } void semiint1(int& error_count, int& warning_count) { OsiClpSolverInterface solver1; int numcols = 4; // s, pup, plo, x int numrows = 3; // bigx, smallx, f int nnz = 6; CoinBigIndex *start = new int[numcols+1]; int* index = new int[nnz]; double* value = new double[nnz]; double *collb = new double[numcols]; double *colub = new double[numcols]; double *obj = new double[numcols]; double *rowlb = new double[numrows]; double *rowub = new double[numrows]; // objective obj[0] = 0; obj[1] = 1.; obj[2] = 1; obj[3] = 0; // column bounds collb[0] = 0.; colub[0] = 10.; collb[1] = 0.; colub[1] = solver1.getInfinity(); collb[2] = 0.; colub[2] = solver1.getInfinity(); collb[3] = 0.; colub[3] = solver1.getInfinity(); // matrix start[0] = 0; index[0] = 2; value[0] = 1.; start[1] = 1; index[1] = 0; value[1] = -1.; start[2] = 2; index[2] = 1; value[2] = 1.; start[3] = 3; index[3] = 0; value[3] = 1.; index[4] = 1; value[4] = 1.; index[5] = 2; value[5] = 1.; start[4] = nnz; // row bounds rowlb[0] = -solver1.getInfinity(); rowub[0] = 7.9; rowlb[1] = 7.9; rowub[1] = solver1.getInfinity(); rowlb[2] = 10.; rowub[2] = 10.; solver1.loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); solver1.setInteger(0); for (int testcase = 0; testcase < 6; ++testcase) { CbcModel model(solver1); CbcMain0(model); double points[10]; points[0]=0.; int nrpoints = 0; double objval; double primalval[4]; double redcost[4]; double row2marg; redcost[2] = 1.0; redcost[3] = 0.0; switch(testcase) { case 0: nrpoints = 0; // pure integer case objval = 0.1; primalval[0] = 2.0; primalval[1] = 0.1; primalval[2] = 0.0; primalval[3] = 8; redcost[0] = -1.0; redcost[1] = 0.0; row2marg = 1.0; break; case 1: nrpoints = 0; // pure integer case too objval = 0.1; primalval[0] = 2.0; primalval[1] = 0.1; primalval[2] = 0.0; primalval[3] = 8.0; redcost[0] = -1.0; redcost[1] = 0.0; row2marg = 1.0; break; case 2: for (nrpoints=1; nrpoints<10; ++nrpoints) points[nrpoints]=nrpoints+1; objval = 0.1; primalval[0] = 2.0; primalval[1] = 0.1; primalval[2] = 0.0; primalval[3] = 8.0; redcost[0] = -1.0; redcost[1] = 0.0; row2marg = 1.0; break; case 3: for (nrpoints=1; nrpoints<9; ++nrpoints) points[nrpoints]=nrpoints+2; objval = 0.9; primalval[0] = 3.0; primalval[1] = 0.0; primalval[2] = 0.9; primalval[3] = 7.0; redcost[0] = 1.0; redcost[1] = 1.0; row2marg = -1.0; break; case 4: for (nrpoints=1; nrpoints<8; ++nrpoints) points[nrpoints]=nrpoints+3; objval = 1.9; primalval[0] = 4.0; primalval[1] = 0.0; primalval[2] = 1.9; primalval[3] = 6.0; redcost[0] = 1.0; redcost[1] = 1.0; row2marg = -1.0; break; case 5: for (nrpoints=1; nrpoints<7; ++nrpoints) points[nrpoints]=nrpoints+4; objval = 2.1; primalval[0] = 0.0; primalval[1] = 2.1; primalval[2] = 0.0; primalval[3] = 10.0; redcost[0] = -1.0; redcost[1] = 0.0; row2marg = 1.0; break; default: // to please the compile redcost[0] = 0.; redcost[1] = 0.; row2marg = 0.; objval = 0.; } if (nrpoints) { CbcObject* semiintobject = new CbcLotsize(&model, 0, nrpoints, points); model.addObjects(1, &semiintobject); delete semiintobject; } cout << "\nSolving semiint1 model for integer lotsize variable being either 0 or between " << points[2] << " and 10.\n" << endl; const char * argv2[]={"gamstest_semiint1","-solve","-quit"}; CbcMain1(3,argv2,model); cout << endl; if (!model.isProvenOptimal()) { cerr << "Error: Model semiint1 not solved to optimality." << endl; ++error_count; continue; // other tests make no sense } OsiSolverInterface* solver = model.solver(); assert(solver); cout << "Objective value in model: " << model.getObjValue() << "\t in solver: " << solver->getObjValue() << "\t expected: " << objval << endl; if (CoinAbs(model.getObjValue()-objval)>testtol || CoinAbs(solver->getObjValue()-objval)>testtol) { cerr << "Error: Objective value incorrect." << endl; ++error_count; } for (int i=0; igetColSolution()[i] << "\t expected: " << primalval[i] << endl; if (CoinAbs(model.bestSolution()[i]-primalval[i])>testtol || CoinAbs(solver->getColSolution()[i]-primalval[i])>testtol) { cerr << "Error: Primal value incorrect." << endl; ++error_count; } } cout << "Reduced cost variable " << 0 << " in model: " << model.getReducedCost()[0] << "\t in solver: " << solver->getReducedCost()[0] << "\t expected: " << redcost[0] << endl; if (CoinAbs(model.getReducedCost()[0]-redcost[0])>testtol || CoinAbs(solver->getReducedCost()[0]-redcost[0])>testtol) { cerr << "Warning: Reduced cost incorrect." << endl; ++warning_count; } cout << "Reduced cost variable " << 3 << " in model: " << model.getReducedCost()[3] << "\t in solver: " << solver->getReducedCost()[3] << "\t expected: " << redcost[3] << endl; if (CoinAbs(model.getReducedCost()[3]-redcost[3])>testtol || CoinAbs(solver->getReducedCost()[3]-redcost[3])>testtol) { cerr << "Warning: Reduced cost incorrect." << endl; ++warning_count; } cout << "Row 2 marginal (price) in model: " << model.getRowPrice()[2] << "\t in solver: " << solver->getRowPrice()[2] << "\t expected: " << row2marg << endl; if (CoinAbs(model.getRowPrice()[2]-row2marg)>testtol || CoinAbs(solver->getRowPrice()[2]-row2marg)>testtol) { cerr << "Warning: Row price incorrect." << endl; ++warning_count; } cout << "Row 2 marginal (price) in model: " << model.getRowPrice()[2] << "\t in solver: " << solver->getRowPrice()[2] << "\t expected: " << row2marg << endl; if (CoinAbs(model.getRowPrice()[2]-row2marg)>testtol || CoinAbs(solver->getRowPrice()[2]-row2marg)>testtol) { cerr << "Warning: Row price incorrect." << endl; ++warning_count; } } delete[] start; delete[] index; delete[] value; delete[] collb; delete[] colub; delete[] obj; delete[] rowlb; delete[] rowub; } CoinMP-1.8.3/Cbc/test/osiUnitTest.cpp0000644000175000017500000000645712101340057015765 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // $Id: osiUnitTest.cpp 1854 2013-01-28 00:02:55Z stefan $ #include "CoinPragma.hpp" #include #include "OsiUnitTests.hpp" #include "OsiCbcSolverInterface.hpp" using namespace OsiUnitTest; //---------------------------------------------------------------- // to see parameter list, call unitTest -usage //---------------------------------------------------------------- int main (int argc, const char *argv[]) { /* Start off with various bits of initialisation that don't really belong anywhere else. Synchronise C++ stream i/o with C stdio. This makes debugging output a bit more comprehensible. It still suffers from interleave of cout (stdout) and cerr (stderr), but -nobuf deals with that. */ std::ios::sync_with_stdio() ; /* Suppress an popup window that Windows shows in response to a crash. See note at head of file. */ WindowsErrorPopupBlocker(); /* Process command line parameters. */ std::map parms; if (processParameters(argc,argv,parms) == false) return 1; std::string mpsDir = parms["-mpsDir"] ; std::string netlibDir = parms["-netlibDir"] ; /* Test Osi{Row,Col}Cut routines. */ { OsiCbcSolverInterface cbcSi; testingMessage( "Testing OsiRowCut with OsiCbcSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&cbcSi,mpsDir), {}, cbcSi, "rowcut unittest"); } { OsiCbcSolverInterface cbcSi; testingMessage( "Testing OsiColCut with OsiCbcSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&cbcSi,mpsDir), {}, cbcSi, "colcut unittest"); } { OsiCbcSolverInterface cbcSi; testingMessage( "Testing OsiRowCutDebugger with OsiCbcSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&cbcSi,mpsDir), {}, cbcSi, "rowcut debugger unittest"); } /* Run the OsiCbc class test. This will also call OsiSolverInterfaceCommonUnitTest. */ testingMessage( "Testing OsiCbcSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiCbcSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "cbc", "osicbc unittest"); /* We have run the specialised unit test. Check now to see if we need to run through the Netlib problems. */ if (parms.find("-testOsiSolverInterface") != parms.end()) { // Create vector of solver interfaces std::vector vecSi(1, new OsiCbcSolverInterface); testingMessage( "Testing OsiSolverInterface on Netlib problems.\n" ); OSIUNITTEST_CATCH_ERROR(OsiSolverInterfaceMpsUnitTest(vecSi,netlibDir), {}, "cbc", "netlib unittest"); delete vecSi[0]; } else testingMessage( "***Skipped Testing of OsiCbcSolverInterface on Netlib problems, use -testOsiSolverInterface to run them.***\n" ); /* We're done. Report on the results. */ std::cout.flush(); outcomes.print(); int nerrors; int nerrors_expected; outcomes.getCountBySeverity(TestOutcome::ERROR, nerrors, nerrors_expected); if (nerrors > nerrors_expected) std::cerr << "Tests completed with " << nerrors - nerrors_expected << " unexpected errors." << std::endl ; else std::cerr << "All tests completed successfully\n"; return nerrors - nerrors_expected; } CoinMP-1.8.3/Cbc/test/CInterfaceTest.c0000644000175000017500000002332212413272577016005 0ustar renerene/* $Id$ */ /* Copyright (C) 2014, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #undef NDEBUG /* force asserts to work */ #include "Cbc_C_Interface.h" #include #include #include #include #include #ifndef INFINITY /* workaround for non-C99 compilers */ #define INFINITY (HUGE_VAL * 2) #endif static int callback_called = 0; void (COINLINKAGE_CB test_callback)(Cbc_Model * model,int msgno, int ndouble, const double * dvec, int nint, const int * ivec, int nchar, char ** cvec) { callback_called = 1; printf("In callback: message %d\n", msgno); } void testKnapsack() { Cbc_Model *model = Cbc_newModel(); /* Simple knapsack problem Maximize 5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5] s.t. 2x[1] + 8x[2] + 4x[3] + 2x[4] + 5x[5] <= 10 All x binary */ CoinBigIndex start[] = {0, 1, 2, 3, 4, 5, 6}; int rowindex[] = {0, 0, 0, 0, 0}; double value[] = {2, 8, 4, 2, 5}; double collb[] = {0,0,0,0,0}; double colub[] = {1,1,1,1,1}; double obj[] = {5, 3, 2, 7, 4}; double feasible[] = {1,1,0,0,0}; double rowlb[] = {-INFINITY}; double rowub[] = {10}; const double *sol; const char* setname = "test model"; char *getname = malloc(20); int i; printf("Interface reports Cbc version %s\n", Cbc_getVersion()); Cbc_loadProblem(model, 5, 1, start, rowindex, value, collb, colub, obj, rowlb, rowub); Cbc_setColName(model, 2, "var2"); Cbc_setRowName(model, 0, "constr0"); assert(Cbc_getNumCols(model) == 5); assert(Cbc_getNumRows(model) == 1); for (i = 0; i < 5; i++) { Cbc_setInteger(model, i); assert(Cbc_isInteger(model,i)); } Cbc_setObjSense(model, -1); assert(Cbc_getObjSense(model) == -1); Cbc_setProblemName(model, setname); Cbc_registerCallBack(model, test_callback); Cbc_setInitialSolution(model, feasible); Cbc_solve(model); assert(Cbc_isProvenOptimal(model)); assert(!Cbc_isAbandoned(model)); assert(!Cbc_isProvenInfeasible(model)); assert(!Cbc_isContinuousUnbounded(model)); assert(!Cbc_isNodeLimitReached(model)); assert(!Cbc_isSecondsLimitReached(model)); assert(!Cbc_isSolutionLimitReached(model)); assert(fabs( Cbc_getObjValue(model)- (16.0) < 1e-6)); assert(fabs( Cbc_getBestPossibleObjValue(model)- (16.0) < 1e-6)); assert(callback_called == 1); sol = Cbc_getColSolution(model); assert(fabs(sol[0] - 1.0) < 1e-6); assert(fabs(sol[1] - 0.0) < 1e-6); assert(fabs(sol[2] - 0.0) < 1e-6); assert(fabs(sol[3] - 1.0) < 1e-6); assert(fabs(sol[4] - 1.0) < 1e-6); Cbc_problemName(model, 20, getname); i = strcmp(getname,setname); assert( (i == 0) ); Cbc_getColName(model, 2, getname, 20); i = strcmp(getname, "var2"); assert( (i == 0) ); Cbc_getRowName(model, 0, getname, 20); i = strcmp(getname, "constr0"); assert( (i == 0) ); assert( Cbc_maxNameLength(model) >= 7 ); Cbc_deleteModel(model); } /* void testProblemModification() { Cbc_Model *model = Cbc_newModel(); / * Simple knapsack problem Maximize 5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5] s.t. 2x[1] + 8x[2] + 4x[3] + 2x[4] + 5x[5] <= 10 All x binary * / CoinBigIndex start[] = {0, 1, 2, 3, 4, 5, 6}; int rowindex[] = {0, 0, 0, 0, 0}; double value[] = {2, 8, 4, 2, 5}; double collb[] = {0,0,0,0,0}; double colub[] = {1,1,1,1,1}; double obj[] = {5, 3, 2, 7, 4}; double rowlb[] = {-INFINITY}; double rowub[] = {10}; const double *sol; int i; printf("Interface reports Cbc version %s\n", Cbc_getVersion()); Cbc_loadProblem(model, 5, 1, start, rowindex, value, collb, colub, obj, rowlb, rowub); for (i = 0; i < 5; i++) { Cbc_setInteger(model, i); assert(Cbc_isInteger(model,i)); } Cbc_setObjSense(model, -1); assert(Cbc_getObjSense(model) == -1); Cbc_solve(model); assert(Cbc_isProvenOptimal(model)); assert(fabs( Cbc_getObjValue(model)- (16.0) < 1e-6)); sol = Cbc_getColSolution(model); assert(fabs(sol[0] - 1.0) < 1e-6); assert(fabs(sol[1] - 0.0) < 1e-6); assert(fabs(sol[2] - 0.0) < 1e-6); assert(fabs(sol[3] - 1.0) < 1e-6); assert(fabs(sol[4] - 1.0) < 1e-6); Cbc_setColUpper(model, 0, 0.0); Cbc_solve(model); assert(Cbc_isProvenOptimal(model)); assert(fabs( Cbc_getObjValue(model)- (11.0) < 1e-6)); sol = Cbc_getColSolution(model); assert(fabs(sol[0] - 0.0) < 1e-6); assert(fabs(sol[1] - 0.0) < 1e-6); assert(fabs(sol[2] - 0.0) < 1e-6); assert(fabs(sol[3] - 1.0) < 1e-6); assert(fabs(sol[4] - 1.0) < 1e-6); Cbc_setColLower(model, 1, 1.0); assert(Cbc_isProvenOptimal(model)); assert(fabs( Cbc_getObjValue(model)- (10.0) < 1e-6)); sol = Cbc_getColSolution(model); assert(fabs(sol[0] - 0.0) < 1e-6); assert(fabs(sol[1] - 1.0) < 1e-6); assert(fabs(sol[2] - 0.0) < 1e-6); assert(fabs(sol[3] - 1.0) < 1e-6); assert(fabs(sol[4] - 0.0) < 1e-6); Cbc_deleteModel(model); } */ void testSOS() { Cbc_Model *model = Cbc_newModel(); /* Maximize 5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5] s.t. x[1] + x[2] + x[3] + x[4] + x[5] == 1 All x binary */ CoinBigIndex start[] = {0, 0, 0, 0, 0, 0, 0}; double collb[] = {0,0,0,0,0}; double colub[] = {1,1,1,1,1}; double obj[] = {5, 3, 2, 7, 4}; int sosrowstart[] = {0,5}; int soscolindex[] = {0,1,2,3,4}; const double *sol; int i; Cbc_loadProblem(model, 5, 0, start, NULL, NULL, collb, colub, obj, NULL, NULL); assert(Cbc_getNumCols(model) == 5); assert(Cbc_getNumRows(model) == 0); for (i = 0; i < 5; i++) { Cbc_setInteger(model, i); assert(Cbc_isInteger(model,i)); } Cbc_setObjSense(model, -1); assert(Cbc_getObjSense(model) == -1); Cbc_addSOS(model,1,sosrowstart,soscolindex,obj,1); Cbc_solve(model); assert(Cbc_isProvenOptimal(model)); assert(!Cbc_isAbandoned(model)); assert(!Cbc_isProvenInfeasible(model)); assert(!Cbc_isContinuousUnbounded(model)); assert(!Cbc_isNodeLimitReached(model)); assert(!Cbc_isSecondsLimitReached(model)); assert(!Cbc_isSolutionLimitReached(model)); assert(fabs( Cbc_getObjValue(model)- (7.0) < 1e-6)); assert(fabs( Cbc_getBestPossibleObjValue(model)- (7.0) < 1e-6)); sol = Cbc_getColSolution(model); assert(fabs(sol[0] - 0.0) < 1e-6); assert(fabs(sol[1] - 0.0) < 1e-6); assert(fabs(sol[2] - 0.0) < 1e-6); assert(fabs(sol[3] - 1.0) < 1e-6); assert(fabs(sol[4] - 0.0) < 1e-6); Cbc_deleteModel(model); } void testIntegerInfeasible() { Cbc_Model *model = Cbc_newModel(); /* Minimize x * s.t. x <= -10 * x binary */ CoinBigIndex start[] = {0, 1}; int rowindex[] = {0}; double value[] = {1.0}; double rowlb[] = {-INFINITY}; double rowub[] = {-10}; double collb[] = {0.0}; double colub[] = {1.0}; double obj[] = {1.0}; Cbc_loadProblem(model, 1, 1, start, rowindex, value, collb, colub, obj, rowlb, rowub); Cbc_setInteger(model, 0); assert(Cbc_getNumCols(model) == 1); assert(Cbc_getNumRows(model) == 1); Cbc_solve(model); assert(!Cbc_isProvenOptimal(model)); assert(Cbc_isProvenInfeasible(model)); Cbc_deleteModel(model); } void testIntegerUnbounded() { Cbc_Model *model = Cbc_newModel(); /* http://list.coin-or.org/pipermail/cbc/2014-March/001276.html * Minimize x * s.t. x + y <= 3 * x - y == 0 * x,y Free * x integer */ CoinBigIndex start[] = {0,2,4}; int rowindex[] = {0, 1, 0, 1}; double value[] = {1, 1, 1, -1}; double rowlb[] = {-INFINITY, 0.0}; double rowub[] = {3.0,0.0}; double collb[] = {-INFINITY, -INFINITY}; double colub[] = {INFINITY, INFINITY}; double obj[] = {1.0,0.0}; Cbc_loadProblem(model, 2, 2, start, rowindex, value, collb, colub, obj, rowlb, rowub); Cbc_setInteger(model, 0); Cbc_setParameter(model, "log", "0"); printf("About to solve problem silently. You should see no output except \"Done\".\n"); Cbc_solve(model); printf("Done\n"); assert(!Cbc_isProvenOptimal(model)); assert(!Cbc_isProvenInfeasible(model)); assert(Cbc_isContinuousUnbounded(model)); Cbc_deleteModel(model); } void testIntegerBounds() { /* max 1.1x + 100.0z st x + z <= 3 0 <= x <= 3 0 <= z <= 1.5, Integer x* = 2, z* = 1 */ Cbc_Model *model = Cbc_newModel(); CoinBigIndex start[] = {0,1,2}; int rowindex[] = {0, 0}; double value[] = {1, 1}; double rowlb[] = {-INFINITY}; double rowub[] = {3.0}; double collb[] = {0.0, 0.0}; double colub[] = {3.0, 1.5}; double obj[] = {1.1,100.0}; const double *sol; Cbc_loadProblem(model, 2, 1, start, rowindex, value, collb, colub, obj, rowlb, rowub); Cbc_setInteger(model, 1); Cbc_setObjSense(model, -1); Cbc_solve(model); assert(Cbc_isProvenOptimal(model)); sol = Cbc_getColSolution(model); assert(fabs(sol[0] - 2.0) < 1e-6); assert(fabs(sol[1] - 1.0) < 1e-6); Cbc_deleteModel(model); } int main() { printf("Knapsack test\n"); testKnapsack(); printf("SOS test\n"); testSOS(); printf("Infeasible test\n"); testIntegerInfeasible(); printf("Unbounded test\n"); testIntegerUnbounded(); /*printf("Problem modification test\n"); testProblemModification();*/ printf("Integer bounds test\n"); testIntegerBounds(); return 0; } CoinMP-1.8.3/Cbc/test/OsiCbcSolverInterfaceTest.cpp0000644000175000017500000011647512101340057020513 0ustar renerene// $Id: OsiCbcSolverInterfaceTest.cpp 1854 2013-01-28 00:02:55Z stefan $ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" //#include //#include //#include //#include #include "OsiCbcSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "OsiUnitTests.hpp" #include "CoinMessage.hpp" #include "CoinModel.hpp" //############################################################################# namespace { CoinPackedMatrix &BuildExmip1Mtx () /* Simple function to build a packed matrix for the exmip1 example used in tests. The function exists solely to hide the intermediate variables. Probably could be written as an initialised declaration. See COIN/Mps/Sample/exmip1.mps for a human-readable presentation. Ordered triples seem easiest. They're listed in row-major order. */ { int rowndxs[] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4 } ; int colndxs[] = { 0, 1, 3, 4, 7, 1, 2, 2, 5, 3, 6, 0, 4, 7 } ; double coeffs[] = { 3.0, 1.0, -2.0, -1.0, -1.0, 2.0, 1.1, 1.0, 1.0, 2.8, -1.2, 5.6, 1.0, 1.9 } ; static CoinPackedMatrix exmip1mtx = CoinPackedMatrix(true,&rowndxs[0],&colndxs[0],&coeffs[0],14) ; return (exmip1mtx) ; } } //-------------------------------------------------------------------------- // test solution methods. void OsiCbcSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir) { { CoinRelFltEq eq; OsiCbcSolverInterface m; std::string fn = mpsDir+"exmip1"; m.readMps(fn.c_str(),"mps"); { OsiCbcSolverInterface im; OSIUNITTEST_ASSERT_ERROR(im.getNumCols() == 0, {}, "cbc", "default constructor"); OSIUNITTEST_ASSERT_ERROR(im.getModelPtr() != NULL, {}, "cbc", "default constructor"); } // Test copy constructor and assignment operator { OsiCbcSolverInterface lhs; { OsiCbcSolverInterface im(m); OsiCbcSolverInterface imC1(im); OSIUNITTEST_ASSERT_ERROR(imC1.getModelPtr() != im.getModelPtr(), {}, "cbc", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumCols() == im.getNumCols(), {}, "cbc", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getNumRows() == im.getNumRows(), {}, "cbc", "copy constructor"); OsiCbcSolverInterface imC2(im); OSIUNITTEST_ASSERT_ERROR(imC2.getModelPtr() != im.getModelPtr(), {}, "cbc", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumCols() == im.getNumCols(), {}, "cbc", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC2.getNumRows() == im.getNumRows(), {}, "cbc", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(imC1.getModelPtr() != imC2.getModelPtr(), {}, "cbc", "copy constructor"); lhs = imC2; } // Test that lhs has correct values even though rhs has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.getModelPtr() != m.getModelPtr(), {}, "cbc", "assignment operator"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols() == m.getNumCols(), {}, "cbc", "copy constructor"); OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows() == m.getNumRows(), {}, "cbc", "copy constructor"); } // Test clone { OsiCbcSolverInterface cbcSi(m); OsiSolverInterface * siPtr = &cbcSi; OsiSolverInterface * siClone = siPtr->clone(); OsiCbcSolverInterface * cbcClone = dynamic_cast(siClone); OSIUNITTEST_ASSERT_ERROR(cbcClone != NULL, {}, "cbc", "clone"); OSIUNITTEST_ASSERT_ERROR(cbcClone->getModelPtr() != cbcSi.getModelPtr(), {}, "cbc", "clone"); OSIUNITTEST_ASSERT_ERROR(cbcClone->getNumRows() == cbcSi.getNumRows(), {}, "cbc", "clone"); OSIUNITTEST_ASSERT_ERROR(cbcClone->getNumCols() == m.getNumCols(), {}, "cbc", "clone"); delete siClone; } // test infinity { OsiCbcSolverInterface si; OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == OsiCbcInfinity, {}, "cbc", "infinity"); } // Test some catches if (!OsiCbcHasNDEBUG()) { OsiCbcSolverInterface solver; try { solver.setObjCoeff(0,0.0); OSIUNITTEST_ADD_OUTCOME("cbc", "setObjCoeff on empty model", "should throw exception", OsiUnitTest::TestOutcome::ERROR, false); } catch (CoinError e) { if (OsiUnitTest::verbosity >= 1) std::cout<<"Correct throw from setObjCoeff on empty model"<= 1) std::cout<<"Correct throw from setObjCoeff on empty model"<getMajorDim() == 5, return, "cbc", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getMinorDim() == 8, return, "cbc", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "cbc", "getMatrixByRow: num elements"); OSIUNITTEST_ASSERT_ERROR(smP->getSizeVectorStarts() == 6, return, "cbc", "getMatrixByRow: num elements"); #ifdef OSICBC_TEST_MTX_STRUCTURE CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[0], 3.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[1], 1.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[2], -2.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[3], -1.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[4], -1.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[5], 2.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[6], 1.1), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[7], 1.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[8], 1.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[9], 2.8), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "cbc", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cbc", "getMatrixByRow: elements"); const int * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "cbc", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "cbc", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "cbc", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "cbc", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cbc", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cbc", "getMatrixByRow: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cbc", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cbc", "getMatrixByRow: indices"); #else // OSICBC_TEST_MTX_STRUCTURE CoinPackedMatrix exmip1Mtx ; exmip1Mtx.reverseOrderedCopyOf(BuildExmip1Mtx()) ; OSIUNITTEST_ASSERT_ERROR(exmip1Mtx.isEquivalent(*smP), {}, "cbc", "getMatrixByRow") ; #endif // OSICBC_TEST_MTX_STRUCTURE } // Test adding several cuts, and handling of a coefficient of infinity // in the constraint matrix. { OsiCbcSolverInterface fim; std::string fn = mpsDir+"exmip1"; fim.readMps(fn.c_str(),"mps"); // exmip1.mps has 2 integer variables with index 2 & 3 fim.initialSolve(); OsiRowCut cuts[3]; // Generate one ineffective cut plus two trivial cuts int c; int nc = fim.getNumCols(); int *inx = new int[nc]; for (c=0;cgetMajorDim() == 8, return, "cbc", "getMatrixByCol: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getMinorDim() == 5, return, "cbc", "getMatrixByCol: minor dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "cbc", "getMatrixByCol: number of elements"); OSIUNITTEST_ASSERT_ERROR(smP->getSizeVectorStarts() == 9, return, "cbc", "getMatrixByCol: vector starts size"); #ifdef OSICBC_TEST_MTX_STRUCTURE CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 5.6), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2], 1.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3], 2.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4], 1.1), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 1.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6],-2.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 2.8), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8],-1.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 1.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], 1.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11],-1.2), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12],-1.0), {}, "cbc", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cbc", "getMatrixByCol: elements"); const CoinBigIndex * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "cbc", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 2, {}, "cbc", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 4, {}, "cbc", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 6, {}, "cbc", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 8, {}, "cbc", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 10, {}, "cbc", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[6] == 11, {}, "cbc", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[7] == 12, {}, "cbc", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[8] == 14, {}, "cbc", "getMatrixByCol: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 4, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 0, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 1, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 1, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 2, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 0, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 3, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 0, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 4, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 2, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 3, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 0, {}, "cbc", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 4, {}, "cbc", "getMatrixByCol: indices"); #else // OSICBC_TEST_MTX_STRUCTURE CoinPackedMatrix &exmip1Mtx = BuildExmip1Mtx() ; OSIUNITTEST_ASSERT_ERROR(exmip1Mtx.isEquivalent(*smP), {}, "cbc", "getMatrixByCol"); #endif // OSICBC_TEST_MTX_STRUCTURE } //-------------- // Test rowsense, rhs, rowrange, matrixByRow, solver assignment { OsiCbcSolverInterface lhs; { OsiCbcSolverInterface siC1(m); const char * siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "cbc", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "cbc", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "cbc", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "cbc", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "cbc", "row sense"); const double * siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "cbc", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "cbc", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "cbc", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "cbc", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "cbc", "right hand side"); const double * siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "cbc", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "cbc", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "cbc", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "cbc", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "cbc", "row range"); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "cbc", "matrix by row"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "cbc", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMinorDim() == 8, return, "cbc", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "cbc", "matrix by row: num elements"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getSizeVectorStarts() == 6, return, "cbc", "matrix by row: num elements"); #ifdef OSICBC_TEST_MTX_STRUCTURE const double * ev = siC1mbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "cbc", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cbc", "matrix by row: elements"); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "cbc", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "cbc", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "cbc", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "cbc", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cbc", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cbc", "matrix by row: vector starts"); const int * ei = siC1mbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cbc", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cbc", "matrix by row: indices"); #else // OSICBC_TEST_MTX_STRUCTURE CoinPackedMatrix exmip1Mtx ; exmip1Mtx.reverseOrderedCopyOf(BuildExmip1Mtx()) ; OSIUNITTEST_ASSERT_ERROR(exmip1Mtx.isEquivalent(*siC1mbr), {}, "cbc", "matrix by row"); #endif // OSICBC_TEST_MTX_STRUCTURE OSIUNITTEST_ASSERT_WARNING(siC1rs == siC1.getRowSense(), {}, "cbc", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "cbc", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1rr == siC1.getRowRange(), {}, "cbc", "row range"); // Change CBC Model by adding free row OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb( COIN_DBL_MAX); OsiCuts cuts; cuts.insert(rc); siC1.applyCuts(cuts); siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "cbc", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "cbc", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "cbc", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "cbc", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "cbc", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "cbc", "row sense after adding row"); siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "cbc", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "cbc", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "cbc", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "cbc", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "cbc", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "cbc", "right hand side after adding row"); siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "cbc", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "cbc", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "cbc", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "cbc", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "cbc", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "cbc", "row range after adding row"); lhs = siC1; } // Test that lhs has correct values even though siC1 has gone out of scope const char * lhsrs = lhs.getRowSense(); OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "cbc", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "cbc", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "cbc", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "cbc", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "cbc", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "cbc", "row sense after assignment"); const double * lhsrhs = lhs.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "cbc", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "cbc", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "cbc", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "cbc", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "cbc", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "cbc", "right hand side after assignment"); const double *lhsrr = lhs.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "cbc", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "cbc", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "cbc", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "cbc", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "cbc", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "cbc", "row range after assignment"); const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "cbc", "matrix by row after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "cbc", "matrix by row after assignment: major dim"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "cbc", "matrix by row after assignment: num elements"); #ifdef OSICBC_TEST_MTX_STRUCTURE const double * ev = lhsmbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "cbc", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cbc", "matrix by row after assignment: elements"); const CoinBigIndex * mi = lhsmbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "cbc", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "cbc", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "cbc", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "cbc", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cbc", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cbc", "matrix by row after assignment: vector starts"); const int * ei = lhsmbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cbc", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cbc", "matrix by row after assignment: indices"); #else // OSICBC_TEST_MTX_STRUCTURE /* This admittedly looks bogus, but it's the equivalent operation on the matrix for inserting a cut of the form -Inf <= +Inf (i.e., a cut with no coefficients). */ CoinPackedMatrix exmip1Mtx ; exmip1Mtx.reverseOrderedCopyOf(BuildExmip1Mtx()) ; CoinPackedVector freeRow ; exmip1Mtx.appendRow(freeRow) ; OSIUNITTEST_ASSERT_ERROR(exmip1Mtx.isEquivalent(*lhsmbr), {}, "cbc", "matrix by row after assignment"); #endif // OSICBC_TEST_MTX_STRUCTURE } } // Test add/delete columns { OsiCbcSolverInterface m; std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); double inf = m.getInfinity(); CoinPackedVector c0; c0.insert(0, 4); c0.insert(1, 1); m.addCol(c0, 0, inf, 3); m.initialSolve(); double objValue = m.getObjValue(); CoinRelFltEq eq(1.0e-2); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "cbc", "objvalue after adding col"); // Try deleting first column that's nonbasic at lower bound (0). int * d = new int[1]; CoinWarmStartBasis *cwsb = dynamic_cast(m.getWarmStart()) ; OSIUNITTEST_ASSERT_ERROR(cwsb != NULL, {}, "cbc", "get warmstart basis"); CoinWarmStartBasis::Status stati ; int iCol ; for (iCol = 0 ; iCol < cwsb->getNumStructural() ; iCol++) { stati = cwsb->getStructStatus(iCol) ; if (stati == CoinWarmStartBasis::atLowerBound) break ; } d[0]=iCol; m.deleteCols(1,d); delete [] d; delete cwsb; d=NULL; m.resolve(); objValue = m.getObjValue(); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after deleting first col"); // Try deleting column we added. If basic, go to initialSolve as deleting // basic variable trashes basis required for warm start. iCol = m.getNumCols()-1; cwsb = dynamic_cast(m.getWarmStart()) ; stati = cwsb->getStructStatus(iCol) ; delete cwsb; m.deleteCols(1,&iCol); if (stati == CoinWarmStartBasis::basic) { m.initialSolve() ; } else { m.resolve(); } objValue = m.getObjValue(); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after deleting added col"); } // Build a model { OsiCbcSolverInterface model; std::string fn = mpsDir+"p0033"; model.readMps(fn.c_str(),"mps"); // Point to data int numberRows = model.getNumRows(); const double * rowLower = model.getRowLower(); const double * rowUpper = model.getRowUpper(); int numberColumns = model.getNumCols(); const double * columnLower = model.getColLower(); const double * columnUpper = model.getColUpper(); const double * columnObjective = model.getObjCoefficients(); // get row copy CoinPackedMatrix rowCopy = *model.getMatrixByRow(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const double * element = rowCopy.getElements(); // solve model.initialSolve(); // Now build new model CoinModel build; // Row bounds int iRow; for (iRow=0;iRow=0;iRow--) { int start = rowStart[iRow]; for (int j=start;j=0) { int iColumn = triple.column(); if (iColumn*2setLogLevel(0); m.getModelPtr()->messageHandler()->setLogLevel(0); m.branchAndBound(); } // branch and bound using CbcModel!!!!!!! { OsiCbcSolverInterface mm; OsiCbcSolverInterface m(&mm); std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); m.initialSolve(); m.branchAndBound(); } // Do common solverInterface testing { OsiCbcSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir); } { OsiCbcSolverInterface mm; OsiCbcSolverInterface m(&mm); OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir); } } CoinMP-1.8.3/Cbc/missing0000755000175000017500000002540611405215312013403 0ustar renerene#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Cbc/install-sh0000755000175000017500000002202111405215312013776 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Cbc/configure.ac0000644000175000017500000003645112600277660014310 0ustar renerene# Copyright (C) 2006, 2007 International Business Machines. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: configure.ac 2212 2015-09-22 16:20:00Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 ############################################################################# # Names and other basic things # ############################################################################# AC_PREREQ(2.59) AC_INIT([Cbc],[2.9.6],[cbc@lists.coin-or.org]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License.]) # List one file in the package so that the configure script can test # whether the package is actually there AC_CONFIG_SRCDIR(src/CbcTree.hpp) # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. AC_PREFIX_DEFAULT([`pwd`]) ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type AC_CANONICAL_BUILD # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. AC_COIN_PROJECTDIR_INIT(Cbc,12:6:9) # Check if user wants to produce debugging code AC_COIN_DEBUG_COMPILE(Cbc) # Get the name of the C++ compiler and appropriate compiler options AC_COIN_PROG_CXX # Initialize automake and libtool AC_COIN_INIT_AUTO_TOOLS ############################################################################# # COIN-OR components # ############################################################################# AC_COIN_CHECK_PACKAGE(CoinDepend, [cgl osi coinutils], [CbcLib CbcGeneric]) if test $coin_has_coindepend != yes ; then AC_MSG_ERROR([One or more required packages CoinUtils, Osi, and Cgl are not available.]) fi # Clp and OsiClp are inseparable here. AC_COIN_CHECK_PACKAGE(Clp, [osi-clp], [CbcLib CbcGeneric]) if test $coin_has_clp != yes ; then AC_MSG_ERROR("Required package Clp unavailable.") fi # The rest are not required for linking against Cbc AC_COIN_CHECK_PACKAGE(OsiTests, [osi-unittests]) AC_COIN_CHECK_PACKAGE(Sample, [coindatasample]) AC_COIN_CHECK_PACKAGE(Netlib, [coindatanetlib]) AC_COIN_CHECK_PACKAGE(Miplib3, [coindatamiplib3]) # Cbc really should make these tests; right now it assumes far too much about # its environment. Needed for cbc-generic. AC_COIN_CHECK_CXX_CHEADER(math) AC_COIN_CHECK_CXX_CHEADER(float) AC_COIN_CHECK_CXX_CHEADER(ieeefp) AC_COIN_CHECK_GNU_READLINE(CbcLib CbcGeneric) ############################################################################# # LP solvers other than CLP # ############################################################################# # Check which other LP solvers are available, some of them become a dependency of CbcGeneric AC_COIN_CHECK_PACKAGE(DyLP, [osi-dylp], [CbcGeneric]) AC_COIN_CHECK_PACKAGE(Vol, [osi-vol]) AC_COIN_CHECK_PACKAGE(Cpx, [osi-cplex], [CbcLib CbcGeneric]) AC_COIN_CHECK_PACKAGE(Glpk, [osi-glpk], [CbcGeneric]) AC_COIN_CHECK_PACKAGE(Grb, [osi-gurobi]) AC_COIN_CHECK_PACKAGE(Msk, [osi-mosek], [CbcGeneric]) AC_COIN_CHECK_PACKAGE(Spx, [osi-soplex], [CbcGeneric]) AC_COIN_CHECK_PACKAGE(Xpr, [osi-xpress]) ############################################################################# # Other third party software # ############################################################################# # Ampl Solver library AC_COIN_CHECK_PACKAGE(ASL, [coinasl], [CbcLib CbcGeneric]) # Nauty library (for symmetry detection) AC_LANG_PUSH(C) AC_COIN_CHECK_USER_LIBRARY([Nauty],[NTY],[nauty.h],[nauty],,[CbcLib CbcGeneric]) AC_LANG_POP(C) ############################################################################# # CbcGeneric configuration # ############################################################################# # Are we building cbc-generic? Default is no (false). AC_ARG_WITH([cbc-generic], AS_HELP_STRING([--with-cbc-generic], [specify whether to build cbc-generic (default: no)]), [case $withval in yes) cbc_with_cbc_generic=true ;; *) cbc_with_cbc_generic=false ;; esac], [cbc_with_cbc_generic=false]) if test x"$cbc_with_cbc_generic" = xyes ; then AC_MSG_NOTICE([building cbc-generic]) fi AM_CONDITIONAL(CBC_BUILD_CBC_GENERIC, test x"$cbc_with_cbc_generic" = xtrue) # Set the default solver for cbc-generic. In theory, any OsiXXX should work. # In practice, only the three listed below have had any testing. AC_MSG_CHECKING(for cbc-generic default solver) AC_ARG_WITH([cbc-generic-solver], AC_HELP_STRING([--with-cbc-generic-solver], [specify default solver for cbc-generic in lower case letters (if not given, clp is assumed)]), [cbc_default_solver=$withval], [cbc_default_solver=clp]) AC_MSG_RESULT($cbc_default_solver) # FIXME what about cplex and mosek here? case $cbc_default_solver in clp) ;; dylp) ;; glpk) ;; soplex) ;; *) AC_MSG_WARN([Unrecognised solver $cbc_default_solver chosen as cbc-generic default solver.]) ;; esac AC_DEFINE_UNQUOTED([CBC_DEFAULT_SOLVER],"$cbc_default_solver", [Define to the name of the default solver to be used in cbc-generic in small letters]) ############################################################################# # Cbc parallel configuration # ############################################################################# # First we define a new option, --enable-cbc-parallel AC_ARG_ENABLE([cbc-parallel], [AC_HELP_STRING([--enable-cbc-parallel], [enables compilation of the SMP version of Cbc])]) if test "$enable_cbc_parallel" = yes; then # Define the preprocessor macro AC_DEFINE([CBC_THREAD],[1],[Define to 1 if the SMP version of Cbc should be compiled]) if test $coin_cxx_is_cl = true ; then # TODO we should check whether the library works and pthread.h is indeed there AC_ARG_WITH(pthreadsw32-lib, AC_HELP_STRING([--with-pthreadsw32-lib], [specify the name of the pthreads win32 library (for cl/icl builds only)]), [CBCLIB_LIBS="$withval $CBCLIB_LIBS" CBCLIB_PCLIBS="$withval $CBCLIB_PCLIBS"], [AC_MSG_WARN([--enable-cbc-parallel selected, but --with-pthreadsw32-lib not given]) CBCLIB_LIBS="pthreadVCE2.lib $CBCLIB_LIBS"]) AC_ARG_WITH(pthreadsw32-incdir, AC_HELP_STRING([--with-pthreadsw32-incdir], [specify the path of the pthreads win32 header file (for cl/icl builds only)]), [CXXFLAGS="$CXXFLAGS -I$withval"], [AC_MSG_WARN([--enable-cbc-parallel selected, but --with-pthreadsw32-incdir not given])]) else AC_CHECK_LIB([rt],[clock_gettime], [CBCLIB_LIBS="-lrt $CBCLIB_LIBS" CBCLIB_PCLIBS="-lrt $CBCLIB_PCLIBS" AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Define if clock_gettime and rt library is available]) ], [AC_MSG_WARN([--enable-cbc-parallel selected, but -lrt unavailable; using gettimeofday instead of clock_gettime])]) AC_CHECK_LIB([pthread],[pthread_create], [CBCLIB_LIBS="-lpthread $CBCLIB_LIBS" CBCLIB_PCLIBS="-lpthread $CBCLIB_PCLIBS" ], [AC_MSG_ERROR([--enable-cbc-parallel selected, but -lpthreads unavailable])]) fi AC_MSG_NOTICE([Cbc multithreading enabled]); fi ############################################################################## # OsiCbc configuration # ############################################################################## # Handles configuration of the underlying default solver in OsiCbc. The issue # is that OsiCbc defines a default solver, used when the client does not # specify a solver in the constructor. The default solver must, therefore, # be present in the build. This macro checks that this is true, and sets the # compile-time symbols OSICBC_DFLT_SOLVER, OSICBC_CLP_DFLT_SOLVER, and # OSICBC_DFLT_SOLVER_HPP that control the build. The parameter default_solver # should normally be clp, unless you're working on some other solver. # Ideally, this macro would not require enumeration of solvers, but the # effort required to avoid it is just not justified at present. One enumeration # is hidden in AC_OSI_CANONICAL. The other is visible, the AM_CONDITIONAL # list at the end. # In an ideal world this macro would do absolutely nothing if Cbc is not # present, but autotools is not an ideal world and we have to satisfy its # requirements. In particular, the AM_CONDITIONAL macros need to execute or # automake will complain. Really the only thing we need to suppress is the # check that the default solver exists. All the rest is irrelevant when Cbc # isn't present (hence OsiCbc will be configured but not actually compiled). # Process the with-osicbc-default-solver option. AC_ARG_WITH([osicbc-default-solver], AS_HELP_STRING([--with-osicbc-default-solver], [specify underlying solver for OsiCbc (default clp)]), [osicbc_with_solver=$withval], [osicbc_with_solver=clp]) case "${osicbc_with_solver}" in @<:@Cc@:>@@<:@Ll@:>@@<:@Pp@:>@*) osi_lc_solver=clp ; osi_mc_solver=Clp ; osi_uc_solver=CLP ; osi_exists_solver=${coin_has_clp-"unavailable"} ;; @<:@Dd@:>@@<:@Yy@:>@@<:@Ll@:>@@<:@Pp@:>@*) osi_lc_solver=dylp ; osi_mc_solver=Dylp osi_uc_solver=DYLP osi_exists_solver=${coin_has_dylp-"unavailable"} ;; @<:@Cc@:>@@<:@Pp@:>@@<:@Xx@:>@*) osi_lc_solver=cpx ; osi_mc_solver=Cpx osi_uc_solver=CPX osi_exists_solver=${coin_has_cpx-"unavailable"} ;; @<:@Gg@:>@@<:@Ll@:>@@<:@Pp@:>@@<:@Kk@:>@*) osi_lc_solver=glpk ; osi_mc_solver=Glpk osi_uc_solver=GLPK osi_exists_solver=${coin_has_glpk-"unavailable"} ;; @<:@Gg@:>@@<:@Rr@:>@@<:@Bb@:>@*) osi_lc_solver=grb ; osi_mc_solver=Grb ; osi_uc_solver=GRB ; osi_exists_solver=${coin_has_grb-"unavailable"} ;; @<:@Mm@:>@@<:@Ss@:>@@<:@Kk@:>@*) osi_lc_solver=msk ; osi_mc_solver=Msk osi_uc_solver=MSK osi_exists_solver=${coin_has_msk-"unavailable"} ;; @<:@Ss@:>@@<:@Pp@:>@@<:@Xx@:>@*) osi_lc_solver=spx ; osi_mc_solver=Spx osi_uc_solver=SPX osi_exists_solver=${coin_has_spx-"unavailable"} ;; @<:@Ss@:>@@<:@Yy@:>@@<:@Mm@:>@*) osi_lc_solver=sym ; osi_mc_solver=Sym osi_uc_solver=SYM osi_exists_solver=${coin_has_sym-"unavailable"} ;; @<:@Vv@:>@@<:@Oo@:>@@<:@Ll@:>@*) osi_lc_solver=vol ; osi_mc_solver=Vol osi_uc_solver=VOL osi_exists_solver=${coin_has_vol-"unavailable"} ;; @<:@Xx@:>@@<:@Pp@:>@@<:@Rr@:>@*) osi_lc_solver=xpr ; osi_mc_solver=Xpr osi_uc_solver=XPR osi_exists_solver=${coin_has_xpr-"unavailable"} ;; *) osi_lc_solver=clp ; osi_mc_solver=Clp ; osi_uc_solver=CLP ; osi_exists_solver=${coin_has_clp-"unavailable"} AC_MSG_WARN([Unrecognised solver $1; defaulting to $osi_lc_solver.]) ;; esac # Check that the requested solver is available. if test $osi_exists_solver = no; then AC_MSG_ERROR([selected default solver $osicbc_with_solver is unavailable. Please select an available solver using the --with-osicbc-default-solver option.]) fi # State the result. AC_MSG_NOTICE([OsiCbc default solver is $osi_lc_solver]) # And set the configuration variables. AC_DEFINE_UNQUOTED([OSICBC_DFLT_SOLVER], [Osi${osi_mc_solver}SolverInterface], [define to the name of the default solver interface class, e.g., OsiClpSolverInterface]) AC_DEFINE_UNQUOTED([OSICBC_DFLT_SOLVER_HPP], ["Osi${osi_mc_solver}SolverInterface.hpp"], [define to the name of the .hpp file for the default solver interface class, e.g., "OsiClpSolverInterface.hpp" (include quotes)]) if test $osi_mc_solver = "Clp"; then AC_DEFINE([OSICBC_DFLT_SOLVER_CLP],[1],[define this symbol if clp is the default solver]) fi # Last but not least, we need automake conditionals. AM_CONDITIONAL([OSICBC_DFLT_SOLVER_CLP],[test $osi_mc_solver = Clp]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_CPX],[test $osi_mc_solver = Cpx]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_DYLP],[test $osi_mc_solver = Dylp]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_GLPK],[test $osi_mc_solver = Glpk]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_GRB],[test $osi_mc_solver = Grb]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_MSK],[test $osi_mc_solver = Msk]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_SPX],[test $osi_mc_solver = Spx]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_SYM],[test $osi_mc_solver = Sym]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_VOL],[test $osi_mc_solver = Vol]) AM_CONDITIONAL([OSICBC_DFLT_SOLVER_XPR],[test $osi_mc_solver = Xpr]) ############################################################################## # VPATH links for example input files # ############################################################################## # In case this is a VPATH configuration we need to make sure that the # input files for the examples are available in the VPATH directory. AC_COIN_VPATH_LINK(examples/sudoku_sample.csv) AC_COIN_VPATH_LINK(examples/quad.mps) AC_COIN_VPATH_LINK(examples/quad2.mps) ############################################################################# # Check for doxygen # ############################################################################# AC_COIN_DOXYGEN(CoinUtils Osi Clp DyLP Cgl Vol) ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) AC_CONFIG_FILES([Makefile examples/Makefile src/Makefile src/OsiCbc/Makefile test/Makefile cbc.pc cbc-uninstalled.pc osi-cbc.pc osi-cbc-uninstalled.pc]) AC_CONFIG_FILES([doxydoc/doxygen.conf]) # Here put the location and name of the configuration header file AC_CONFIG_HEADER([src/config.h src/config_cbc.h]) # Finally, we let configure write all the output... AC_COIN_FINALIZE CoinMP-1.8.3/Cbc/doxydoc/0000755000175000017500000000000012600453456013461 5ustar renereneCoinMP-1.8.3/Cbc/doxydoc/doxygen.conf.in0000644000175000017500000017377612231275131016427 0ustar renerene# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doxydoc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = "@abs_top_srcdir@/" # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = @coin_doxy_logname@ #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @abs_top_srcdir@/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.hpp \ *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.svn* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 3 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = YES # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = YES # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = letter # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = @coin_doxy_tagfiles@ # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = @coin_doxy_tagname@ # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = YES # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = @coin_doxy_usedot@ # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES CoinMP-1.8.3/Cbc/CbcSourceFilesTable2.csv0000644000175000017500000002061711305575712016421 0ustar renereneFilename,,Group,Person,Inherits,Status,Age,CPP Lines,HPP Lines,Total Lines,libCbc,cbcSolve,cbcGeneric,Other Projects,First Object,Other Objects,Comment CbcBranchActual.cpp,,Branch,Edwin,,,8,5340,1823,7163,x,,,,Multiple,"CbcClique, CbcSos, CbcSimpleInteger, CbcIntegerBranchingObject, CbcSimpleIntegerPseudoCost, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSosBranchingObject, CbcBranchDefaultDecision, CbcFollowOn, CbcFixingBranchingObject, CbcNWay, CbcNWayBranchingObject, CbcFixVariable, CbcDummyBranchingObject, CbcGeneral, CbcGeneralDepth, CbcGeneralBranchingObject, CbcOneGeneralBranchingObject, CbcSubProblem", ,CbcClique.cpp,Branch,Edwin,,,,,,,,,,,,, ,CbcSos.cpp,Branch,Edwin,,,,,,,,,,,,, ,CbcSimpleInteger,Branch,Edwin,,,,,,,,,,,,, ,CbcIntegerBranchingObject,Branch,Edwin,,,,,,,,,,,,, ,CbcSimpleIntegerPseudoCost,Branch,Edwin,,,,,,,,,,,,, ,CbcIntegerPseudoCostBranchingObject,Branch,Edwin,,,,,,,,,,,,, ,CbcCliqueBranchingObject,Branch,Edwin,,,,,,,,,,,,, ,CbcLongCliqueBranchingObject,Branch,Edwin,,,,,,,,,,,,, ,CbcSosBranchingObject,Branch,Edwin,,,,,,,,,,,,, ,CbcBranchDefaultDecision,Branch,Edwin,,,,,,,,,,,,, ,CbcFollowOn,Branch,Edwin,,,,,,,,,,,,, ,CbcFixingBranchingObject,Branch,Edwin,,,,,,,,,,,,, ,CbcNWay,Branch,Edwin,,,,,,,,,,,,, ,CbcNWayBranchingObject,Branch,Edwin,,,,,,,,,,,,, ,CbcFixVariable,Branch,Edwin,,,,,,,,,,,, ,CbcDummyBranchingObject,Branch,Edwin,,,,,,,,,,,, ,CbcGeneral,Branch,Edwin,,,,,,,,,,,, ,CbcGeneralDepth,Branch,Edwin,,,,,,,,,,,, ,CbcGeneralBranchingObject,Branch,Edwin,,,,,,,,,,,, ,CbcOneGeneralBranchingObject,Branch,Edwin,,,,,,,,,,,, ,CbcSubProblem,Branch,Edwin,,,,,,,,,,,, CbcBranchBase.cpp,,Branch,Edwin,,,10,352,707,1059,x,,,,CbcObject,"CbcBranchingObject, CbcBranchDecision, CbcConsequence, CbcObjectUpdateData" ,CbcBranchDecision,Branch,Edwin,,,,,,,,,,,, ,CbcBranchObject,Branch,Edwin,,,,,,,,,,,, ,CbcConsequence,Branch,Edwin,,,,,,,,,,,, ,CbcObject,Branch,Edwin,,,,,,,,,,,, ,CbcObjectUpdateData,Branch,Edwin,,,,,,,,,,,, CbcBranchCut.cpp,,Branch,Edwin,,,10,1023,315,1338,x,,,,CbcBranchCut,"CbcCutBranchingObject, CbcBranchToFixLots, CbcBranchAllDifferent" ,CbcBranchAllDifferent,Branch,Edwin,,,,,,,,,,,, ,CbcBranchToFixLots,Branch,Edwin,,,,,,,,,,,, ,CbcCutBranchingObject,Branch,Edwin,,,,,,,,,,,, CbcBranchDynamic.cpp,,Branch,Edwin,,,8,1911,557,2468,x,,,,CbcSimpleIntegerDynamicPseudoCost,"CbcDynamicPseudoCostBranchingObject, CbcBranchDynamicDecision" ,CbcDynamicPseudoCostBranching,Branch,Edwin,,,,,,,,,,,, ,CbcSimpleIntegerDynamicPseudoCost,Branch,Edwin,,,,,,,,,,,, CbcBranchLotsize.cpp,,Branch,Edwin,,,15,809,250,1059,x,,,,CbcLotsize,CbcLotsizeBranchingObject CbcCbcParam.cpp,,API,Bjarni,,,24,1,,1,x,,,,"#include ""CbcOrClpParam.cpp""", CbcCompareActual.cpp,,NodeStrat,Edwin,,,8,463,165,628,x,,,,CbcCompareDepth,"CbcCompareObjective, CbcCompareDefault, CbcCompareEstimate" ,CbcCompareDefault.cpp,NodeStrat,Edwin,,,,,,,,,,,, ,CbcCompareDepth.cpp,NodeStrat,Edwin,,,,,,,,,,,, ,CbcCompareEstimate.cpp,NodeStrat,Edwin,,,,,,,,,,,, ,CbcCompareObjective.cpp,NodeStrat,Edwin,,,,,,,,,,,, CbcCompareBase.hpp,,NodeStrat,Edwin,,,24,,170,170,x,,,,CbcCompareBase,"CbcCompare, CbcChooseVariable" ,CbcCompare,NodeStrat,Edwin,,,,,,,,,,,, ,CbcChooseVariable,NodeStrat,Edwin,,,,,,,,,,,, CbcConfig.h,,,,,,20,,102,102,x,,,,#defines, CbcCountRowCut.cpp,,Cuts,,,,10,126,115,241,x,,,,CbcCountRowCut, CbcCutGenerator.cpp,,Cuts,Edwin,,,2,1223,510,1733,x,,,,CbcCutGenerator,"CbcCutModifier, CbcCutSubsetModifier", ,CbcCutModifier.cp,Cuts,Edwin,,,,,,,,,,,,, ,CbcCutSubsetModifier.cpp,Cuts,Edwin,,,,,,,,,,,,, CbcEventHandler.cpp,,API,,,,36,101,221,322,x,,,,CbcEventHandler,, CbcFathom.cpp,,NodeStrat,Edwin,,,19,106,126,232,x,,,,CbcFathom,CbcOsiSolver, CbcFathomDynamicProgramming.cpp,,NodeStrat,Edwin,,,10,1051,166,1217,x,,,,CbcFathomDynamicProgramming,, CbcFeasibilityBase.hpp,,API?,,,,24,,53,53,x,,,,CbcFeasibilityBase,, CbcGenBaB.cpp,,Generic,Lou,,,14,886,,886,,,x,,namespace CbcGenParamUtils,namespace,The support functions for the main branch-and-cut action routine. CbcGenCbcParam.cpp,,Generic,Lou,,,24,155,189,344,,,x,,CbcCbcParam,,Constructors and destructors for CbcCbcParam CbcGenCbcParamUtils.cpp,,Generic,Lou,,,18,401,,401,,,x,,namespace CbcCbcParamUtils,,Implementation functions for CbcGenParam parameters. CbcGenCtlBlk.cpp,,Generic,Lou,,,24,681,948,1629,x,,x,,CbcGenCtlBlk,,Constructor for cbc-generic control block. CbcGeneric.cpp,,Generic,Lou,,,24,415,,415,,,x,,namespace CbcGenSolvers,namespace,Unnamed local namespace for cbc-generic support types and functions. CbcGenMessages.cpp,,Generic,Lou,,,24,192,,192,x,,,,CbcGenCtlBlk,,Message definitions. CbcGenOsiParam.cpp,,Generic,Lou,,,24,156,197,353,,,x,,CbcOsiParam,,Constructors and destructors for CbcOsiParam CbcGenOsiParamUtils.cpp,,Generic,Lou,,,18,528,,528,,,x,,namespace CbcOsiParamUtils,,Implementation functions for CbcOsiParam parameters CbcGenParam.cpp,,Generic,Lou,,,24,154,219,373,,,x,,CbcGenParam,,Constructors and destructors for CbcGenParam CbcGenParamUtils.cpp,,Generic,Lou,,,18,1497,,1497,,,x,,namespace CbcGenParamUtils,"namespace CbcGenSolvers, ",Implementation functions for CbcGenParam parameters CbcGenSolution.cpp,,Generic,Lou,,,22,584,,584,,,x,,CbcGenParamUtils,namespace,"Helper routine to generate masks for selecting names to print. Returns true if masks are generated without error, false otherwise." CbcGenSolvers.cpp,,Generic,Lou,,,24,261,,261,,,x,,namespace CbcGenSolvers,namespace,This file contains routines related to handling Osi solvers. The technique is to maintain a map of OsiSolverInterface objects as prototypes of the available solvers. CbcHeuristic.cpp,,Heuristic,,,,10,2901,650,3551,x,,,,CbcHeuristic,"CbcHeuristicNode, CbcHeuristicNodeList, CbcRounding, CbcHeuristicPartial, CbcSerendipity, CbcHeuristicJustOne", CbcHeuristicDive.cpp,,Heuristic,,,,10,1068,160,1228,x,,,,CbcHeuristicDive,, CbcHeuristicDiveCoefficient.cpp,,Heuristic,,,,12,128,49,177,x,,,,CbcHeuristicDiveCoefficient,, CbcHeuristicDiveFractional.cpp,,Heuristic,,,,18,112,49,161,x,,,,CbcHeuristicDiveFractional,, CbcHeuristicDiveGuided.cpp,,Heuristic,,,,18,123,52,175,x,,,,CbcHeuristicDiveGuided,, CbcHeuristicDiveLineSearch.cpp,,Heuristic,,,,18,120,49,169,x,,,,CbcHeuristicDiveLineSearch,, CbcHeuristicDivePseudoCost.cpp,,Heuristic,,,,18,227,57,284,x,,,,CbcHeuristicDivePseudoCost,, CbcHeuristicDiveVectorLength.cpp,,Heuristic,,,,10,123,49,172,x,,,,CbcHeuristicDiveVectorLength,, CbcHeuristicFPump.cpp,,Heuristic,,,,8,2764,319,3083,x,,,,CbcHeuristicFPump,CbcDisasterHandler, CbcHeuristicGreedy.cpp,,Heuristic,,,,17,861,189,1050,x,,,,CbcHeuristicGreedyCover,CbcHeuristicGreedyEquality, CbcHeuristicLocal.cpp,,Heuristic,,,,8,1104,208,1312,x,,,,CbcHeuristicLocal,CbcHeuristicNaive, CbcHeuristicPivotAndFix.cpp,,Heuristic,,,,14,537,55,592,x,,,,CbcHeuristicPivotAndFix,, CbcHeuristicRandRound.cpp,,Heuristic,,,,10,514,55,569,x,,,,CbcHeuristicRandRound,, CbcHeuristicRINS.cpp,,Heuristic,,,,10,1207,296,1503,x,,,,CbcHeuristicRINS,"CbcHeuristicRENS, CbcHeuristicDINS, CbcHeuristicVND" CbcLinked.cpp,,Nonlinear/Osi,,,,10,8302,1403,9705,x,,,,OsiSolverLink,"OsiLinkedBound, OsiHeuristicDynamic3, OsiOldLink, OsiBiLinear*, OsiSimpleFixedInteger, Multiple" CbcMain.cpp,,API,,,,14,1651,,1651,,,,x,main,"CbcCompareUser, namespace" CbcMessage.cpp,,API,,,,13,104,87,191,x,,,,CbcMessage, CbcModel.cpp,,Core,Edwin,,,0,16557,2622,19179,x,,,,CbcModel, CbcNode.cpp,,Core,Dan,,,0,5135,806,5941,x,,,,CbcNode,"CbcNodeInfo, CbcFullNodeInfo, CbcPartialNodeInfo, " ,CbcFullNodeInfo.cpp,Core,Dan,,,,,,,,,,,, ,CbcNodeInfo.cpp,Core,Dan,,,,,,,,,,,, ,CbcPartialNodeInfo.cpp,Core,Dan,,,,,,,,,,,, CbcParam.cpp,,API,Bjarni,,,24,502,237,739,x,,,,CbcParam, CbcSolver.cpp,,API,Bjarni,,,0,11365,,11365,,x,,,CbcSolver,CbcMain CbcStatistics.cpp,,API,,,,21,136,98,234,x,,,,CbcStatistics, CbcStrategy.cpp,,Core,Dan/Edwin,,,8,940,255,1195,x,,,,CbcStrategy,CbcStrategyDefault* CbcTree.cpp,,Core,Dan/Edwin,,,8,1178,419,1597,x,,,,CbcTree,CbcTreeArray CbcTreeLocal.cpp,,Heuristic,,,,10,1747,369,2116,x,,,,CbcTreeLocal, Cbc_ampl.cpp,,Ampl,,,,4,1504,65,1569,,,,x,global, Cbc_C_Interface.cpp,,Interface,Bjarni,,,4,2554,658,3212,,,,x,global, ClpAmplObjective.cpp,,Ampl,,,,14,750,110,860,,,,x,ClpAmplObjective, ClpAmplStuff.cpp,,Ampl,,,,3,1370,,1370,x,,,,CbcAmpl,"CbcAmpl*, Multiple" ClpConstraintAmpl.hpp,,Ampl,,,,24,,105,105,,,,,, CoinSolve.cpp,,API,Bjarni,,,8,342,,342,,x,,,MyMessageHandler2,main unitTest.cpp,,Test,,,,8,418,,418,,,,x,global, unitTestClp.cpp,,Test,,,,5,714,,714,,x,,,global, CoinMP-1.8.3/Cbc/cbc-uninstalled.pc.in0000644000175000017500000000045611574143003016006 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src Name: CBC Description: COIN-OR Branch and Cut URL: https://projects.coin-or.org/Cbc Version: @PACKAGE_VERSION@ Libs: ${libdir}/libCbcSolver.la ${libdir}/libCbc.la @CBCLIB_PCLIBS@ Cflags: -I@abs_source_dir@/src -I@ABSBUILDDIR@/src Requires: @CBCLIB_PCREQUIRES@ CoinMP-1.8.3/Cbc/CbcSourceFilesTable3.csv0000644000175000017500000002266311307556223016423 0ustar renerene"Filename",,"Group","Person","Inherits","Status","Age","CPP Lines","HPP Lines","Total Lines","libCbc","cbcSolve","cbcGeneric","Other Projects","First Object","Other Objects","Comment" "CbcBranchActual.cpp (broken up, no longer used)",,"Branch","Edwin",,,8,5340,1823,7163,"x",,,,"Multiple","CbcClique, CbcSos, CbcSimpleInteger, CbcIntegerBranchingObject, CbcSimpleIntegerPseudoCost, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSosBranchingObject, CbcBranchDefaultDecision, CbcFollowOn, CbcFixingBranchingObject, CbcNWay, CbcNWayBranchingObject, CbcFixVariable, CbcDummyBranchingObject, CbcGeneral, CbcGeneralDepth, CbcGeneralBranchingObject, CbcOneGeneralBranchingObject, CbcSubProblem", ,"CbcClique.cpp (CbcClique, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject)","Branch","Edwin",,,,,,,,,,,,, ,"CbcSos.cpp (CbcSos, CbcSosBranchingObject)","Branch","Edwin",,,,,,,,,,,,, ,"CbcSimpleInteger.cpp (CbcSimpleInteger, CbcIntegerBranchingObject)","Branch","Edwin",,,,,,,,,,,,, ,"CbcSimpleIntegerPseudoCost.cpp (CbcSimpleIntegerPseudoCost, CbcIntegerPseudoCostBranchingObject)","Branch","Edwin",,,,,,,,,,,,, ,"CbcBranchDefaultDecision","Branch","Edwin",,,,,,,,,,,,, ,"CbcFollowOn.cpp (CbcFollowOn, CbcFixingBranchingObject)","Branch","Edwin",,,,,,,,,,,,, ,"CbcNWay.cpp (CbcNWay, CbcNWayBranchingObject)","Branch","Edwin",,,,,,,,,,,,, ,"CbcFixVariable","Branch","Edwin",,,,,,,,,,,,, ,"CbcDummyBranchingObject","Branch","Edwin",,,,,,,,,,,,, ,"CbcGeneral","Branch","Edwin",,,,,,,,,,,,, ,"CbcGeneralDepth.cpp (CbcGeneralDepth, CbcGeneralBranchingObject, CbcOneGeneralBranchingObject)","Branch","Edwin",,,,,,,,,,,,, ,"CbcSubProblem","Branch","Edwin",,,,,,,,,,,,, "CbcBranchBase.cpp (broken up, no longer used)",,"Branch","Edwin",,,10,352,707,1059,"x",,,,"CbcObject","CbcBranchingObject, CbcBranchDecision, CbcConsequence, CbcObjectUpdateData", ,"CbcBranchDecision","Branch","Edwin",,,,,,,,,,,,, ,"CbcBranchObject","Branch","Edwin",,,,,,,,,,,,, ,"CbcConsequence","Branch","Edwin",,,,,,,,,,,,, ,"CbcObject","Branch","Edwin",,,,,,,,,,,,, ,"CbcObjectUpdateData","Branch","Edwin",,,,,,,,,,,,, "CbcBranchCut.cpp (CbcBranchCut, CbcCutBranchingObject)",,"Branch","Edwin",,,10,1023,315,1338,"x",,,,"CbcBranchCut","CbcCutBranchingObject, CbcBranchToFixLots, CbcBranchAllDifferent", ,"CbcBranchAllDifferent","Branch","Edwin",,,,,,,,,,,,, ,"CbcBranchToFixLots","Branch","Edwin",,,,,,,,,,,,, "CbcBranchDynamic.cpp (CbcBranchDynamic, CbcDynamicPseudoCostBranchingObject)",,"Branch","Edwin",,,8,1911,557,2468,"x",,,,"CbcSimpleIntegerDynamicPseudoCost","CbcDynamicPseudoCostBranchingObject, CbcBranchDynamicDecision", ,"CbcSimpleIntegerDynamicPseudoCost","Branch","Edwin",,,,,,,,,,,,, "CbcLotsize.cpp (CbcLotsize, CbcLotsizeBranchingObject)",,"Branch","Edwin",,,,,,,,,,,,, "CbcCbcParam.cpp",,"API","Bjarni",,,24,1,,1,"x",,,,"#include ""CbcOrClpParam.cpp""",, "CbcCompareActual.cpp",,"NodeStrat","Dan",,"Reviewed",8,463,165,628,"x",,,,"CbcCompareDepth","CbcCompareObjective, CbcCompareDefault, CbcCompareEstimate", ,"CbcCompareDefault.cpp","NodeStrat","Dan",,"Reviewed",,,,,,,,,,, ,"CbcCompareDepth.cpp","NodeStrat","Dan",,"Reviewed",,,,,,,,,,, ,"CbcCompareEstimate.cpp","NodeStrat","Dan",,"Reviewed",,,,,,,,,,, ,"CbcCompareObjective.cpp","NodeStrat","Dan",,"Reviewed",,,,,,,,,,, "CbcCompareBase.hpp",,"NodeStrat","Dan",,"Reviewed",24,,170,170,"x",,,,"CbcCompareBase","CbcCompare, CbcChooseVariable", ,"CbcCompare","NodeStrat","Dan",,"Reviewed",,,,,,,,,,, ,"CbcChooseVariable - class not used","NodeStrat","[Dan]",,"Reviewed",,,,,,,,,,, "CbcConfig.h",,,,,,20,,102,102,"x",,,,"#defines",, "CbcCountRowCut.cpp",,"Cuts",,,,10,126,115,241,"x",,,,"CbcCountRowCut",, "CbcCutGenerator.cpp",,"Cuts","Dan",,"Reviewed",2,1223,510,1733,"x",,,,"CbcCutGenerator","CbcCutModifier, CbcCutSubsetModifier", ,"CbcCutModifier.cpp","Cuts","Dan",,"Reviewed",,,,,,,,,,, ,"CbcCutSubsetModifier.cpp","Cuts","Dan",,"Reviewed",,,,,,,,,,, "CbcEventHandler.cpp",,"API",,,,36,101,221,322,"x",,,,"CbcEventHandler",, "CbcFathom.cpp - not used currently",,"NodeStrat","[Dan]",,"Reviewed",19,106,126,232,"x",,,,"CbcFathom","CbcOsiSolver", "CbcFathomDynamicProgramming.cpp - not used currently",,"NodeStrat","[Dan]",,"Reviewed",10,1051,166,1217,"x",,,,"CbcFathomDynamicProgramming",, "CbcFeasibilityBase.hpp",,"API?",,,,24,,53,53,"x",,,,"CbcFeasibilityBase",, "CbcGenBaB.cpp",,"Generic","Lou",,,14,886,,886,,,"x",,"namespace CbcGenParamUtils","namespace","The support functions for the main branch-and-cut action routine." "CbcGenCbcParam.cpp",,"Generic","Lou",,,24,155,189,344,,,"x",,"CbcCbcParam",,"Constructors and destructors for CbcCbcParam" "CbcGenCbcParamUtils.cpp",,"Generic","Lou",,,18,401,,401,,,"x",,"namespace CbcCbcParamUtils",,"Implementation functions for CbcGenParam parameters." "CbcGenCtlBlk.cpp",,"Generic","Lou",,,24,681,948,1629,"x-not used",,"x",,"CbcGenCtlBlk",,"Constructor for cbc-generic control block." "CbcGeneric.cpp",,"Generic","Lou",,,24,415,,415,,,"x",,"namespace CbcGenSolvers","namespace","Unnamed local namespace for cbc-generic support types and functions." "CbcGenMessages.cpp",,"Generic","Lou",,,24,192,,192,"x-not used",,,,"CbcGenCtlBlk",,"Message definitions." "CbcGenOsiParam.cpp",,"Generic","Lou",,,24,156,197,353,,,"x",,"CbcOsiParam",,"Constructors and destructors for CbcOsiParam" "CbcGenOsiParamUtils.cpp",,"Generic","Lou",,,18,528,,528,,,"x",,"namespace CbcOsiParamUtils",,"Implementation functions for CbcOsiParam parameters" "CbcGenParam.cpp",,"Generic","Lou",,,24,154,219,373,,,"x",,"CbcGenParam",,"Constructors and destructors for CbcGenParam" "CbcGenParamUtils.cpp",,"Generic","Lou",,,18,1497,,1497,,,"x",,"namespace CbcGenParamUtils","namespace CbcGenSolvers, ","Implementation functions for CbcGenParam parameters" "CbcGenSolution.cpp",,"Generic","Lou",,,22,584,,584,,,"x",,"CbcGenParamUtils","namespace","Helper routine to generate masks for selecting names to print. Returns true if masks are generated without error, false otherwise." "CbcGenSolvers.cpp",,"Generic","Lou",,,24,261,,261,,,"x",,"namespace CbcGenSolvers","namespace","This file contains routines related to handling Osi solvers. The technique is to maintain a map of OsiSolverInterface objects as prototypes of the available solvers." "CbcHeuristic.cpp",,"Heuristic",,,"Reviewed",10,2901,650,3551,"x",,,,"CbcHeuristic","CbcHeuristicNode, CbcHeuristicNodeList, CbcRounding, CbcHeuristicPartial, CbcSerendipity, CbcHeuristicJustOne", "CbcHeuristicDive.cpp",,"Heuristic",,,"Reviewed",10,1068,160,1228,"x",,,,"CbcHeuristicDive",, "CbcHeuristicDiveCoefficient.cpp",,"Heuristic",,,"Reviewed",12,128,49,177,"x",,,,"CbcHeuristicDiveCoefficient",, "CbcHeuristicDiveFractional.cpp",,"Heuristic",,,"Reviewed",18,112,49,161,"x",,,,"CbcHeuristicDiveFractional",, "CbcHeuristicDiveGuided.cpp",,"Heuristic",,,"Reviewed",18,123,52,175,"x",,,,"CbcHeuristicDiveGuided",, "CbcHeuristicDiveLineSearch.cpp",,"Heuristic",,,"Reviewed",18,120,49,169,"x",,,,"CbcHeuristicDiveLineSearch",, "CbcHeuristicDivePseudoCost.cpp",,"Heuristic",,,"Reviewed",18,227,57,284,"x",,,,"CbcHeuristicDivePseudoCost",, "CbcHeuristicDiveVectorLength.cpp",,"Heuristic",,,"Reviewed",10,123,49,172,"x",,,,"CbcHeuristicDiveVectorLength",, "CbcHeuristicFPump.cpp",,"Heuristic",,,"Reviewed",8,2764,319,3083,"x",,,,"CbcHeuristicFPump","CbcDisasterHandler", "CbcHeuristicGreedy.cpp",,"Heuristic",,,"Reviewed",17,861,189,1050,"x",,,,"CbcHeuristicGreedyCover","CbcHeuristicGreedyEquality", "CbcHeuristicLocal.cpp",,"Heuristic",,,"Reviewed",8,1104,208,1312,"x",,,,"CbcHeuristicLocal","CbcHeuristicNaive", "CbcHeuristicPivotAndFix.cpp",,"Heuristic",,,"Reviewed",14,537,55,592,"x",,,,"CbcHeuristicPivotAndFix",, "CbcHeuristicRandRound.cpp",,"Heuristic",,,"Reviewed",10,514,55,569,"x",,,,"CbcHeuristicRandRound",, "CbcHeuristicRINS.cpp",,"Heuristic",,,"Reviewed",10,1207,296,1503,"x",,,,"CbcHeuristicRINS","CbcHeuristicRENS, CbcHeuristicDINS, CbcHeuristicVND", "CbcLinked.cpp",,"Nonlinear/Osi",,,,10,8302,1403,9705,"x",,,,"OsiSolverLink","OsiLinkedBound, OsiHeuristicDynamic3, OsiOldLink, OsiBiLinear*, OsiSimpleFixedInteger, Multiple", "CbcMain.cpp",,"API",,,"Deleted",14,1651,,1651,,,,"x","main","CbcCompareUser, namespace", "CbcMessage.cpp",,"API",,,,13,104,87,191,"x",,,,"CbcMessage",, "CbcModel.cpp",,"Core","Edwin",,"Updated",0,16557,2622,19179,"x",,,,"CbcModel",, "CbcNode.cpp",,"Core","Dan",,"Reviewed",0,5135,806,5941,"x",,,,"CbcNode","CbcNodeInfo, CbcFullNodeInfo, CbcPartialNodeInfo, ", ,"CbcFullNodeInfo.cpp","Core","Dan",,"Reviewed",,,,,,,,,,, ,"CbcNodeInfo.cpp","Core","Dan",,"Reviewed",,,,,,,,,,, ,"CbcPartialNodeInfo.cpp","Core","Dan",,"Reviewed",,,,,,,,,,, "CbcParam.cpp",,"API","Bjarni",,,24,502,237,739,"x",,,,"CbcParam",, "CbcSolver.cpp",,"API","Bjarni",,,0,11365,,11365,,"x",,,"CbcSolver","CbcMain", "CbcStatistics.cpp",,"API",,,,21,136,98,234,"x",,,,"CbcStatistics",, "CbcStrategy.cpp",,"Core","Dan",,"Updated",8,940,255,1195,"x",,,,"CbcStrategy","CbcStrategyDefault*", "CbcTree.cpp",,"Core","Dan",,"Reviewed",8,1178,419,1597,"x",,,,"CbcTree","CbcTreeArray", "CbcTreeLocal.cpp",,"Heuristic",,,,10,1747,369,2116,"x",,,,"CbcTreeLocal",, "Cbc_ampl.cpp",,"Ampl",,,,4,1504,65,1569,,,,"x","global",, "Cbc_C_Interface.cpp",,"Interface","Bjarni",,,4,2554,658,3212,,,,"x","global",, "ClpAmplObjective.cpp",,"Ampl",,,,14,750,110,860,,,,"x","ClpAmplObjective",, "ClpAmplStuff.cpp",,"Ampl",,,,3,1370,,1370,"x",,,,"CbcAmpl","CbcAmpl*, Multiple", "ClpConstraintAmpl.hpp",,"Ampl",,,,24,,105,105,,,,,,, "CoinSolve.cpp",,"API",,,,8,342,,342,,"x",,,"MyMessageHandler2","main", "unitTest.cpp",,"Test",,,,8,418,,418,,,,"x","global",, "unitTestClp.cpp",,"Test",,,,5,714,,714,,"x",,,"global",, CoinMP-1.8.3/Cbc/CbcSourceFilesTable.csv0000644000175000017500000001425711277055727016351 0ustar renereneFilename,Group,Person,Status,Age,CPP Lines,HPP Lines,Total Lines,libCbc,cbcSolve,cbcGeneric,Other Projects,First Object,Other Objects,Comment CbcBranchActual.cpp,Branch,Edwin,,8,5340,1823,7163,x,,,,Multiple,"CbcClique, CbcSos, CbcSimpleInteger, CbcIntegerBranchingObject, CbcSimpleIntegerPseudoCost, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSosBranchingObject, CbcBranchDefaultDecision, CbcFollowOn, CbcFixingBranchingObject, CbcNWay, CbcNWayBranchingObject, CbcFixVariable, CbcDummyBranchingObject, CbcGeneral, CbcGeneralDepth, CbcGeneralBranchingObject, CbcOneGeneralBranchingObject, CbcSubProblem", CbcBranchBase.cpp,Branch,Edwin,,10,352,707,1059,x,,,,CbcObject,"CbcBranchingObject, CbcBranchDecision, CbcConsequence, CbcObjectUpdateData", CbcBranchCut.cpp,Branch,Edwin,,10,1023,315,1338,x,,,,CbcBranchCut,"CbcCutBranchingObject, CbcBranchToFixLots, CbcBranchAllDifferent", CbcBranchDynamic.cpp,Branch,Edwin,,8,1911,557,2468,x,,,,CbcSimpleIntegerDynamicPseudoCost,"CbcDynamicPseudoCostBranchingObject, CbcBranchDynamicDecision", CbcBranchLotsize.cpp,Branch,Edwin,,15,809,250,1059,x,,,,CbcLotsize,CbcLotsizeBranchingObject, CbcCbcParam.cpp,Solver,Bjarni,,24,1,,1,x,,,,"#include ""CbcOrClpParam.cpp""",, CbcCompareActual.cpp,Compare,,,8,463,165,628,x,,,,CbcCompareDepth,"CbcCompareObjective, CbcCompareDefault, CbcCompareEstimate", CbcCompareBase.hpp,Compare,,,24,,170,170,x,,,,CbcCompareBase,"CbcCompare, CbcChooseVariable", CbcConfig.h,,,,20,,102,102,x,,,,#defines,, CbcCountRowCut.cpp,,,,10,126,115,241,x,,,,CbcCountRowCut,, CbcCutGenerator.cpp,,,,2,1223,510,1733,x,,,,CbcCutGenerator,"CbcCutModifier, CbcCutSubsetModifier", CbcEventHandler.cpp,,,,36,101,221,322,x,,,,CbcEventHandler,, CbcFathom.cpp,,,,19,106,126,232,x,,,,CbcFathom,CbcOsiSolver, CbcFathomDynamicProgramming.cpp,,,,10,1051,166,1217,x,,,,CbcFathomDynamicProgramming,, CbcFeasibilityBase.hpp,,,,24,,53,53,x,,,,CbcFeasibilityBase,, CbcGenBaB.cpp,Generic,Lou,,14,886,,886,,,x,,namespace CbcGenParamUtils,namespace,The support functions for the main branch-and-cut action routine. CbcGenCbcParam.cpp,Generic,Lou,,24,155,189,344,,,x,,CbcCbcParam,,Constructors and destructors for CbcCbcParam CbcGenCbcParamUtils.cpp,Generic,Lou,,18,401,,401,,,x,,namespace CbcCbcParamUtils,,Implementation functions for CbcGenParam parameters. CbcGenCtlBlk.cpp,Generic,Lou,,24,681,948,1629,x,,x,,CbcGenCtlBlk,,Constructor for cbc-generic control block. CbcGeneric.cpp,Generic,Lou,,24,415,,415,,,x,,namespace CbcGenSolvers,namespace,Unnamed local namespace for cbc-generic support types and functions. CbcGenMessages.cpp,Generic,Lou,,24,192,,192,x,,,,CbcGenCtlBlk,,Message definitions. CbcGenOsiParam.cpp,Generic,Lou,,24,156,197,353,,,x,,CbcOsiParam,,Constructors and destructors for CbcOsiParam CbcGenOsiParamUtils.cpp,Generic,Lou,,18,528,,528,,,x,,namespace CbcOsiParamUtils,,Implementation functions for CbcOsiParam parameters CbcGenParam.cpp,Generic,Lou,,24,154,219,373,,,x,,CbcGenParam,,Constructors and destructors for CbcGenParam CbcGenParamUtils.cpp,Generic,Lou,,18,1497,,1497,,,x,,namespace CbcGenParamUtils,"namespace CbcGenSolvers, ",Implementation functions for CbcGenParam parameters CbcGenSolution.cpp,Generic,Lou,,22,584,,584,,,x,,CbcGenParamUtils,namespace,"Helper routine to generate masks for selecting names to print. Returns true if masks are generated without error, false otherwise." CbcGenSolvers.cpp,Generic,Lou,,24,261,,261,,,x,,namespace CbcGenSolvers,namespace,This file contains routines related to handling Osi solvers. The technique is to maintain a map of OsiSolverInterface objects as prototypes of the available solvers. CbcHeuristic.cpp,Heuristic,,,10,2901,650,3551,x,,,,CbcHeuristic,"CbcHeuristicNode, CbcHeuristicNodeList, CbcRounding, CbcHeuristicPartial, CbcSerendipity, CbcHeuristicJustOne", CbcHeuristicDive.cpp,Heuristic,,,10,1068,160,1228,x,,,,CbcHeuristicDive,, CbcHeuristicDiveCoefficient.cpp,Heuristic,,,12,128,49,177,x,,,,CbcHeuristicDiveCoefficient,, CbcHeuristicDiveFractional.cpp,Heuristic,,,18,112,49,161,x,,,,CbcHeuristicDiveFractional,, CbcHeuristicDiveGuided.cpp,Heuristic,,,18,123,52,175,x,,,,CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch.cpp,Heuristic,,,18,120,49,169,x,,,,CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost.cpp,Heuristic,,,18,227,57,284,x,,,,CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength.cpp,Heuristic,,,10,123,49,172,x,,,,CbcHeuristicDiveVectorLength, CbcHeuristicFPump.cpp,Heuristic,,,8,2764,319,3083,x,,,,CbcHeuristicFPump,CbcDisasterHandler CbcHeuristicGreedy.cpp,Heuristic,,,17,861,189,1050,x,,,,CbcHeuristicGreedyCover,CbcHeuristicGreedyEquality CbcHeuristicLocal.cpp,Heuristic,,,8,1104,208,1312,x,,,,CbcHeuristicLocal,CbcHeuristicNaive CbcHeuristicPivotAndFix.cpp,Heuristic,,,14,537,55,592,x,,,,CbcHeuristicPivotAndFix, CbcHeuristicRandRound.cpp,Heuristic,,,10,514,55,569,x,,,,CbcHeuristicRandRound, CbcHeuristicRINS.cpp,Heuristic,,,10,1207,296,1503,x,,,,CbcHeuristicRINS,"CbcHeuristicRENS, CbcHeuristicDINS, CbcHeuristicVND" CbcLinked.cpp,,,,10,8302,1403,9705,x,,,,OsiSolverLink,"OsiLinkedBound, OsiHeuristicDynamic3, OsiOldLink, OsiBiLinear*, OsiSimpleFixedInteger, Multiple" CbcMain.cpp,,,,14,1651,,1651,,,,x,main,"CbcCompareUser, namespace" CbcMessage.cpp,,,,13,104,87,191,x,,,,CbcMessage, CbcModel.cpp,,,,0,16557,2622,19179,x,,,,CbcModel, CbcNode.cpp,,,,0,5135,806,5941,x,,,,CbcNode,"CbcNodeInfo, CbcFullNodeInfo, CbcPartialNodeInfo, " CbcParam.cpp,Solver,Bjarni,,24,502,237,739,x,,,,CbcParam, CbcSolver.cpp,Solver,Bjarni,,0,11365,,11365,,x,,,CbcSolver,CbcMain CbcStatistics.cpp,,,,21,136,98,234,x,,,,CbcStatistics, CbcStrategy.cpp,,,,8,940,255,1195,x,,,,CbcStrategy,CbcStrategyDefault* CbcTree.cpp,,,,8,1178,419,1597,x,,,,CbcTree,CbcTreeArray CbcTreeLocal.cpp,,,,10,1747,369,2116,x,,,,CbcTreeLocal, Cbc_ampl.cpp,Ampl,,,4,1504,65,1569,,,,x,global, Cbc_C_Interface.cpp,Interface,Bjarni,,4,2554,658,3212,,,,x,global, ClpAmplObjective.cpp,Ampl,,,14,750,110,860,,,,x,ClpAmplObjective, ClpAmplStuff.cpp,Ampl,,,3,1370,,1370,x,,,,CbcAmpl,"CbcAmpl*, Multiple" ClpConstraintAmpl.hpp,Ampl,,,24,,105,105,,,,,, CoinSolve.cpp,Solver,,,8,342,,342,,x,,,MyMessageHandler2,main unitTest.cpp,Test,,,8,418,,418,,,,x,global, unitTestClp.cpp,Test,,,5,714,,714,,x,,,global, CoinMP-1.8.3/Cbc/CbcSourceFilesTable3.xls0000644000175000017500000006000011307556223016421 0ustar renereneÐÏࡱá;þÿ -*þÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿýÿÿÿÿÿÿÿ  !"#$%&'()þÿÿÿþÿÿÿ,þÿÿÿ.þÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿ » Ìá°Áâ\pCalc B°a=œ¯¼@=@ 8X"·Ú1&Èÿ Lohit Hindi1ÈÿArial1ÈÿArial1ÈÿArial1ÈÿArial1Èÿ¼Arial ¤GENERAL ¥GENERALà¤õÿ À àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ àõÿ ôÀ ठÀ à+õÿ ðÀ à)õÿ ðÀ à,õÿ ðÀ à*õÿ ðÀ à õÿ ðÀ ठÀ ॠÀ ठ@À “€ÿ“€ÿ“€ÿ“€ÿ“€ÿ“€ÿ`…¨Sheet1…¶KSheet2…3MSheet3Œëjðbð( 3 ð¿ À@@ñ  ÷ü„ÀÕFilenameGroupPersonInheritsStatusAge CPP Lines HPP Lines Total LineslibCbccbcSolve cbcGenericOther Projects First Object Other ObjectsComment/CbcBranchActual.cpp (broken up, no longer used)BranchEdwinxMultiple¾CbcClique, CbcSos, CbcSimpleInteger, CbcIntegerBranchingObject, CbcSimpleIntegerPseudoCost, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSosBranchingObject, CbcBranchDefaultDecision, CbcFollowOn, CbcFixingBranchingObject, CbcNWay, CbcNWayBranchingObject, CbcFixVariable, CbcDummyBranchingObject, CbcGeneral, CbcGeneralDepth, CbcGeneralBranchingObject, CbcOneGeneralBranchingObject, CbcSubProblemQCbcClique.cpp (CbcClique, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject)*CbcSos.cpp (CbcSos, CbcSosBranchingObject)BCbcSimpleInteger.cpp (CbcSimpleInteger, CbcIntegerBranchingObject)`CbcSimpleIntegerPseudoCost.cpp (CbcSimpleIntegerPseudoCost, CbcIntegerPseudoCostBranchingObject)CbcBranchDefaultDecision7CbcFollowOn.cpp (CbcFollowOn, CbcFixingBranchingObject)-CbcNWay.cpp (CbcNWay, CbcNWayBranchingObject)CbcFixVariableCbcDummyBranchingObject CbcGeneral^CbcGeneralDepth.cpp (CbcGeneralDepth, CbcGeneralBranchingObject, CbcOneGeneralBranchingObject) CbcSubProblem-CbcBranchBase.cpp (broken up, no longer used) CbcObjectJCbcBranchingObject, CbcBranchDecision, CbcConsequence, CbcObjectUpdateDataCbcBranchDecisionCbcBranchObjectCbcConsequenceCbcObjectUpdateData6CbcBranchCut.cpp (CbcBranchCut, CbcCutBranchingObject) CbcBranchCut@CbcCutBranchingObject, CbcBranchToFixLots, CbcBranchAllDifferentCbcBranchAllDifferentCbcBranchToFixLotsLCbcBranchDynamic.cpp (CbcBranchDynamic, CbcDynamicPseudoCostBranchingObject)!CbcSimpleIntegerDynamicPseudoCost=CbcDynamicPseudoCostBranchingObject, CbcBranchDynamicDecision6CbcLotsize.cpp (CbcLotsize, CbcLotsizeBranchingObject)CbcCbcParam.cppAPIBjarni#include "CbcOrClpParam.cpp"CbcCompareActual.cpp NodeStratDanReviewedCbcCompareDepth:CbcCompareObjective, CbcCompareDefault, CbcCompareEstimateCbcCompareDefault.cppCbcCompareDepth.cppCbcCompareEstimate.cppCbcCompareObjective.cppCbcCompareBase.hppCbcCompareBaseCbcCompare, CbcChooseVariable CbcCompare"CbcChooseVariable - class not used[Dan] CbcConfig.h#definesCbcCountRowCut.cppCutsCbcCountRowCutCbcCutGenerator.cppCbcCutGenerator$CbcCutModifier, CbcCutSubsetModifierCbcCutModifier.cppCbcCutSubsetModifier.cppCbcEventHandler.cppCbcEventHandler"CbcFathom.cpp - not used currently CbcFathom CbcOsiSolver4CbcFathomDynamicProgramming.cpp - not used currentlyCbcFathomDynamicProgrammingCbcFeasibilityBase.hppAPI?CbcFeasibilityBase CbcGenBaB.cppGenericLounamespace CbcGenParamUtils namespaceAThe support functions for the main branch-and-cut action routine.CbcGenCbcParam.cpp CbcCbcParam,Constructors and destructors for CbcCbcParamCbcGenCbcParamUtils.cppnamespace CbcCbcParamUtils4Implementation functions for CbcGenParam parameters.CbcGenCtlBlk.cpp x-not used CbcGenCtlBlk*Constructor for cbc-generic control block.CbcGeneric.cppnamespace CbcGenSolversDUnnamed local namespace for cbc-generic support types and functions.CbcGenMessages.cppMessage definitions.CbcGenOsiParam.cpp CbcOsiParam,Constructors and destructors for CbcOsiParamCbcGenOsiParamUtils.cppnamespace CbcOsiParamUtils3Implementation functions for CbcOsiParam parametersCbcGenParam.cpp CbcGenParam,Constructors and destructors for CbcGenParamCbcGenParamUtils.cppnamespace CbcGenSolvers, 3Implementation functions for CbcGenParam parametersCbcGenSolution.cppCbcGenParamUtils‚Helper routine to generate masks for selecting names to print. Returns true if masks are generated without error, false otherwise.CbcGenSolvers.cpp¥This file contains routines related to handling Osi solvers. The technique is to maintain a map of OsiSolverInterface objects as prototypes of the available solvers.CbcHeuristic.cpp Heuristic CbcHeuristicmCbcHeuristicNode, CbcHeuristicNodeList, CbcRounding, CbcHeuristicPartial, CbcSerendipity, CbcHeuristicJustOneCbcHeuristicDive.cppCbcHeuristicDiveCbcHeuristicDiveCoefficient.cppCbcHeuristicDiveCoefficientCbcHeuristicDiveFractional.cppCbcHeuristicDiveFractionalCbcHeuristicDiveGuided.cppCbcHeuristicDiveGuidedCbcHeuristicDiveLineSearch.cppCbcHeuristicDiveLineSearchCbcHeuristicDivePseudoCost.cppCbcHeuristicDivePseudoCost CbcHeuristicDiveVectorLength.cppCbcHeuristicDiveVectorLengthCbcHeuristicFPump.cppCbcHeuristicFPumpCbcDisasterHandlerCbcHeuristicGreedy.cppCbcHeuristicGreedyCoverCbcHeuristicGreedyEqualityCbcHeuristicLocal.cppCbcHeuristicLocalCbcHeuristicNaiveCbcHeuristicPivotAndFix.cppCbcHeuristicPivotAndFixCbcHeuristicRandRound.cppCbcHeuristicRandRoundCbcHeuristicRINS.cppCbcHeuristicRINS3CbcHeuristicRENS, CbcHeuristicDINS, CbcHeuristicVND CbcLinked.cpp Nonlinear/Osi OsiSolverLink_OsiLinkedBound, OsiHeuristicDynamic3, OsiOldLink, OsiBiLinear*, OsiSimpleFixedInteger, Multiple CbcMain.cppDeletedmainCbcCompareUser, namespaceCbcMessage.cpp CbcMessage CbcModel.cppCoreUpdatedCbcModel CbcNode.cppCbcNode2CbcNodeInfo, CbcFullNodeInfo, CbcPartialNodeInfo, CbcFullNodeInfo.cppCbcNodeInfo.cppCbcPartialNodeInfo.cpp CbcParam.cppCbcParam CbcSolver.cpp CbcSolverCbcMainCbcStatistics.cpp CbcStatisticsCbcStrategy.cpp CbcStrategyCbcStrategyDefault* CbcTree.cppCbcTree CbcTreeArrayCbcTreeLocal.cpp CbcTreeLocal Cbc_ampl.cppAmplglobalCbc_C_Interface.cpp InterfaceClpAmplObjective.cppClpAmplObjectiveClpAmplStuff.cppCbcAmplCbcAmpl*, MultipleClpConstraintAmpl.hpp CoinSolve.cppMyMessageHandler2 unitTest.cppTestunitTestClp.cppÿ Õ » Ì dü©ñÒMbP?_€%öÁ*+‚ƒ„&è?'è?(ð?)ð?¡"d,, ¶` ¶`à? ¶` ¶`à?U} ¤} œ(}  .} } '} \$} .\ö€öööööööö ö ö ö ö öööööööööööööööööööý ý ý ý ý ý ý ý ý ý  ý  ý  ý  ý  ý ý ý ý ý ½"rS~! û»@ DÀDÀý  ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý ý  ý ý ý !ý ý ý "ý ý ½*‚  Œ@  ¼[ : LþÀLÿÀý  ý #ý $ý %ý ý ý &ý ý ý 'ý ý ý #ý ý ý (ý ý ý )ý ý ½*þî è”@  ý  ý *ý +ý ,ý ý ý -ý ý ý .ý ý ½"Þ¶ H£@  ý  ý /ý 0ý /ý ý ý 1ý ý ý 2ý 3ý 4½b ð?  ý  ý 5ý 6ý 7ý 8ý 9½">–  ƒ@  ý  ý :ý ;ý <ý 7ý 8ý 9ý =ý 7ý 8ý 9ý >ý 7ý 8ý 9ý ?ý 7ý 8ý 9 ö!ö"ö#ö$ö%ö&ö'ö(ö)ö*ö+ö,ö-ö.ö/ö0ö1ö2ö3ö4ö5ö6ö7ö8ö9ö:ö;ö<ö=ö>ö?öý @ý 7ý 8ý 9~ b~ ª @e@  ý ý Aý Bý !Cý !7ý !8ý !9ý "Dý "7ý "Eý "9ý #F~ #R~ #š# €Y@  ý # ý #Gý $Hý $I½$*úÎ$  n@  ý $ ý $Jý %Ký %Iý %8ý %9½% ú% ›@  ý % ý %Lý %Mý &Ný &Iý &8ý &9ý 'Oý 'Iý '8ý '9ý (Pý (3½(’–v(  t@  ý ( ý (Qý )Rý )7ý )Eý )9½)Nªú) m@  ý ) ý )Sý )Tý *Uý *7ý *Eý *9½**nš* “@  ý * ý *Vý +Wý +X~ +b~ +Ö+ €J@  ý + ý +Yý ,Zý ,[ý ,\½,:Ú , °‹@  ý , ý ,]ý ,^ý ,_ý -`ý -[ý -\½-bnö- €u@  ý - ý -aý -bý .cý .[ý .\½.JF. y@  ý . ý .dý .eý /fý /[ý /\½/b¦ Ò/ t™@  ý / gý / ý /hý /iý 0jý 0[ý 0\½0b~0 ðy@  ý 0 ý 0ký 0^ý 0lý 1mý 1[ý 1\½1b1 h@  ý 1 gý 1hý 1ný 2oý 2[ý 2\½2br2 v@  ý 2 ý 2pý 2qý 3rý 3[ý 3\½3JB3 €€@  ý 3 ý 3sý 3tý 4uý 4[ý 4\½4bjn4 Pw@  ý 4 ý 4vý 4wý 5xý 5[ý 5\½5Jf5 d—@  ý 5 ý 5]ý 5yý 5zý 6{ý 6[ý 6\½6Z" 6 @‚@  ý 6 ý 6|ý 6^ý 6}ý 7~ý 7[ý 7\½7b7 Pp@  ý 7 ý 7ký 7^ý 7ý 8€ý 8ý 89½8*V-* 8 ¾«@  ý 8 ý 8‚ý 8ƒý 9„ý 9ý 99½9*²‚9 0“@  ý 9 ý 9…ý :†ý :ý :9½:2Æ:  f@  ý : ý :‡ý ;ˆý ;ý ;9½;JÂÆ;  d@  ý ; ý ;‰ý <Šý <ý <9½<JîÒ< àe@  ý < ý <‹ý =Œý =ý =9½=JâÆ=  e@  ý = ý =ý >Žý >ý >9½>JŽæ> Àq@  ý > ý >ý ?ý ?ý ?9½?*îÆ? €e@  ý ? ý ?‘@öAöBöCöDöEöFöGHöIöJöKöLöMöNöOöPöQöRöSöTöUöVöWöX öYöZö[öý @’ý @ý @9½@"2+þ@ ¨@  ý @ ý @“ý @”ý A•ý Aý A9½AFv öA h@  ý A ý A–ý A—ý B˜ý Bý B9½B"BBB €”@  ý B ý B™ý Bšý C›ý Cý C9½C:fÞC €‚@  ý C ý Cœý Dý Dý D9½D* ÞD È@  ý D ý Džý EŸý Eý E9½E*Þ¢E |—@  ý E ý E ý E¡ý F¢ý F£½F*ºîF €ôÂ@  ý F ý F¤ý F¥ý G¦ý G3ý G§½G:ÎG Ì™@  ý G ý G¨ý G©ý Hªý H3½H6¢^H àg@  ý H ý H«ý I¬ý I­ý Iý I®½I¶ú(I ÀºÒ@  ý I ý I¯ý J°ý J­ý J8ý J9½J>Pš J 5·@  ý J ý J±ý J²ý K³ý K­ý K8ý K9ý L´ý L­ý L8ý L9ý Mµý M­ý M8ý M9ý N¶ý N3ý N4½NbÚ¶N ‡@  ý N ý N·ý O¸ý O3ý O4½O–±O €2Æ@  ý O ý O¹ý Oºý P»ý P3½PV"ŠP @m@  ý P ý P¼ý Q½ý Q­ý Q8ý Q®½Q"²þQ ¬’@  ý Q ý Q¾ý Q¿ý RÀý R­ý R8ý R9½R"jŽR ô˜@  ý R ý RÁý RÂý SÃý S½S*NÆS ˆ @  ý S ý SÄý TÅý TƽT‚T „˜@  ý T ý TÇý UÈý UÉý U4½Uê'J U ©@  ý U ý UÇý VÊý VƽV:º ºV àŠ@  ý V ý VËý WÌý WƽWjW h•@  ý W ý WÍý WÎý XÏý XÆ~ Xb~ X¦X @Z@  ý YÐý Y3½Y"ZY `u@  ý Y ý YÑý Y¨ý ZÒý ZÓ½Z"ŠZ  z@  ý Z ý ZÇý [Ôý [Ó½[* [ P†@  ý [ ý [ÇìPðHðð0ð( ð ð>¶@• •dA äEGGGÿ » Ì dü©ñÒMbP?_€%öÁ*+‚ƒ„&è?'è?(ð?)ð?¡"d,, ¶` ¶`à? ¶` ¶`à?U} .ìPðH ðð0ð( ð ð>¶@GGÿ » Ì dü©ñÒMbP?_€%öÁ*+‚ƒ„&è?'è?(ð?)ð?¡"d,, ¶` ¶`à? ¶` ¶`à?U} .ìPðH0ð ð0ð( ð ð >¶@GGÿ þÿÿÿþÿÿÿþÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿ ÿÿÿÿÀFMicrosoft Excel 97-TabelleBiff8þÿà…ŸòùOh«‘+'³Ù0ÄHPl ˆ ”   ¬ ¸éýBjarni KristjanssonMatthew Saltzman1@€Ü[$@@Sðü|NÊ@€‰!?[xÊþÿÕÍÕœ.“—+,ù®DÕÍÕœ.“—+,ù®\éýéýRoot EntryÿÿÿÿÿÿÿÿÀF+@Workbookÿÿÿÿ°NCompObjÿÿÿÿÿÿÿÿIOle ÿÿÿÿÿÿÿÿÿÿÿÿSummaryInformation(ÿÿÿÿÿÿÿÿôDocumentSummaryInformation8ÿÿÿÿÿÿÿÿÿÿÿÿtÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿCoinMP-1.8.3/Cbc/osi-cbc-uninstalled.pc.in0000644000175000017500000000040311507673264016603 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/OsiCbc Name: OsiCbc Description: COIN-OR Open Solver Interface for CBC URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsiCbc.la Cflags: -I@abs_source_dir@/src/OsiCbc Requires: cbc CoinMP-1.8.3/Cbc/src/0000755000175000017500000000000012600453457012600 5ustar renereneCoinMP-1.8.3/Cbc/src/CbcBranchToFixLots.hpp0000644000175000017500000000606612131054770016734 0ustar renerene// $Id: CbcBranchToFixLots.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/13/2009-- carved out of CbcBranchCut #ifndef CbcBranchToFixLots_H #define CbcBranchToFixLots_H #include "CbcBranchCut.hpp" #include "CbcBranchBase.hpp" #include "OsiRowCut.hpp" #include "CoinPackedMatrix.hpp" /** Define a branch class that branches so that one way variables are fixed while the other way cuts off that solution. a) On reduced cost b) When enough ==1 or <=1 rows have been satisfied (not fixed - satisfied) */ class CbcBranchToFixLots : public CbcBranchCut { public: // Default Constructor CbcBranchToFixLots (); /** Useful constructor - passed reduced cost tolerance and fraction we would like fixed. Also depth level to do at. Also passed number of 1 rows which when clean triggers fix Always does if all 1 rows cleaned up and number>0 or if fraction columns reached Also whether to create branch if can't reach fraction. */ CbcBranchToFixLots (CbcModel * model, double djTolerance, double fractionFixed, int depth, int numberClean = 0, const char * mark = NULL, bool alwaysCreate = false); // Copy constructor CbcBranchToFixLots ( const CbcBranchToFixLots &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcBranchToFixLots & operator=( const CbcBranchToFixLots& rhs); // Destructor ~CbcBranchToFixLots (); /** Does a lot of the work, Returns 0 if no good, 1 if dj, 2 if clean, 3 if both FIXME: should use enum or equivalent to make these numbers clearer. */ int shallWe() const; /// Infeasibility for an integer variable - large is 0.5, but also can be infinity when known infeasible. virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const { return true; } /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Redoes data when sequence numbers change virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns); protected: /// data /// Reduced cost tolerance i.e. dj has to be >= this before fixed double djTolerance_; /// We only need to make sure this fraction fixed double fractionFixed_; /// Never fix ones marked here char * mark_; /// Matrix by row CoinPackedMatrix matrixByRow_; /// Do if depth multiple of this int depth_; /// number of ==1 rows which need to be clean int numberClean_; /// If true then always create branch bool alwaysCreate_; }; #endif CoinMP-1.8.3/Cbc/src/CbcCompareActual.hpp0000644000175000017500000000070411510742604016434 0ustar renerene/* $Id: CbcCompareActual.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcCompareActual_H #define CbcCompareActual_H #include "CbcNode.hpp" #include "CbcCompareBase.hpp" #include "CbcCompare.hpp" #include "CbcCompareDepth.hpp" #include "CbcCompareDefault.hpp" #endif CoinMP-1.8.3/Cbc/src/CbcBranchBase.hpp0000644000175000017500000000460011510742604015703 0ustar renerene/* $Id: CbcBranchBase.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcBranchBase_H #define CbcBranchBase_H #include #include #include "OsiBranchingObject.hpp" enum CbcRangeCompare { CbcRangeSame, CbcRangeDisjoint, CbcRangeSubset, CbcRangeSuperset, CbcRangeOverlap }; #include "CbcObject.hpp" #include "CbcBranchingObject.hpp" #include "CbcBranchDecision.hpp" #include "CbcConsequence.hpp" #include "CbcObjectUpdateData.hpp" //############################################################################## /** Compare two ranges. The two bounds arrays are both of size two and describe closed intervals. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the content of thisBd with the intersection of the ranges. */ static inline CbcRangeCompare CbcCompareRanges(double* thisBd, const double* otherBd, const bool replaceIfOverlap) { const double lbDiff = thisBd[0] - otherBd[0]; if (lbDiff < 0) { // lb of this < lb of other if (thisBd[1] >= otherBd[1]) { // ub of this >= ub of other return CbcRangeSuperset; } else if (thisBd[1] < otherBd[0]) { return CbcRangeDisjoint; } else { // overlap if (replaceIfOverlap) { thisBd[0] = otherBd[0]; } return CbcRangeOverlap; } } else if (lbDiff > 0) { // lb of this > lb of other if (thisBd[1] <= otherBd[1]) { // ub of this <= ub of other return CbcRangeSubset; } else if (thisBd[0] > otherBd[1]) { return CbcRangeDisjoint; } else { // overlap if (replaceIfOverlap) { thisBd[1] = otherBd[1]; } return CbcRangeOverlap; } } else { // lb of this == lb of other if (thisBd[1] == otherBd[1]) { return CbcRangeSame; } return thisBd[1] < otherBd[1] ? CbcRangeSubset : CbcRangeSuperset; } return CbcRangeSame; // fake return } //############################################################################# #endif CoinMP-1.8.3/Cbc/src/Makefile.in0000644000175000017500000013720112547035070014646 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) @COIN_HAS_NTY_TRUE@am__append_1 = -I$(NTYINCDIR) ######################################################################## # cbc program # ######################################################################## # Name of the executable compiled in this directory. We want it to be # installed in the 'bin' directory @COIN_HAS_CLP_TRUE@am__append_2 = cbc ######################################################################## # cbc-generic program # ######################################################################## # Name of the executable compiled in this directory. We want it to be # installed in the 'bin' directory @CBC_BUILD_CBC_GENERIC_TRUE@am__append_3 = cbc-generic # List all additionally required solver and Osi libraries # the linker flags for all available LP solvers should already be included in $CBCGENERIC_LIBS, # so just add compiler flags here (all we can think of) @CBC_BUILD_CBC_GENERIC_TRUE@am__append_4 = $(DYLP_CFLAGS) $(GLPK_CFLAGS) $(MSK_CFLAGS) $(SPX_CFLAGS) $(VOL_CFLAGS) $(XPR_CFLAGS) subdir = src DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/config_cbc.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h config_cbc.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libCbc_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) am_libCbc_la_OBJECTS = CbcBranchAllDifferent.lo CbcBranchCut.lo \ CbcBranchDecision.lo CbcBranchDefaultDecision.lo \ CbcBranchDynamic.lo CbcBranchingObject.lo CbcBranchLotsize.lo \ CbcBranchToFixLots.lo CbcCompareDefault.lo CbcCompareDepth.lo \ CbcCompareEstimate.lo CbcCompareObjective.lo CbcConsequence.lo \ CbcClique.lo CbcCountRowCut.lo CbcCutGenerator.lo \ CbcCutModifier.lo CbcCutSubsetModifier.lo \ CbcDummyBranchingObject.lo CbcEventHandler.lo CbcFathom.lo \ CbcFathomDynamicProgramming.lo CbcFixVariable.lo \ CbcFullNodeInfo.lo CbcFollowOn.lo CbcGeneral.lo \ CbcGeneralDepth.lo CbcHeuristic.lo CbcHeuristicDINS.lo \ CbcHeuristicDive.lo CbcHeuristicDiveCoefficient.lo \ CbcHeuristicDiveFractional.lo CbcHeuristicDiveGuided.lo \ CbcHeuristicDiveLineSearch.lo CbcHeuristicDivePseudoCost.lo \ CbcHeuristicDiveVectorLength.lo CbcHeuristicFPump.lo \ CbcHeuristicGreedy.lo CbcHeuristicLocal.lo \ CbcHeuristicPivotAndFix.lo CbcHeuristicRandRound.lo \ CbcHeuristicRENS.lo CbcHeuristicRINS.lo CbcHeuristicVND.lo \ CbcHeuristicDW.lo CbcMessage.lo CbcModel.lo CbcNode.lo \ CbcNodeInfo.lo CbcNWay.lo CbcObject.lo CbcObjectUpdateData.lo \ CbcPartialNodeInfo.lo CbcSimpleInteger.lo \ CbcSimpleIntegerDynamicPseudoCost.lo \ CbcSimpleIntegerPseudoCost.lo CbcSOS.lo CbcStatistics.lo \ CbcStrategy.lo CbcSubProblem.lo CbcSymmetry.lo CbcThread.lo \ CbcTree.lo CbcTreeLocal.lo libCbc_la_OBJECTS = $(am_libCbc_la_OBJECTS) @DEPENDENCY_LINKING_TRUE@libCbcSolver_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) libCbc.la am_libCbcSolver_la_OBJECTS = Cbc_C_Interface.lo CbcCbcParam.lo \ Cbc_ampl.lo CbcLinked.lo CbcLinkedUtils.lo unitTestClp.lo \ CbcSolver.lo CbcSolverHeuristics.lo CbcSolverAnalyze.lo \ CbcMipStartIO.lo CbcSolverExpandKnapsack.lo libCbcSolver_la_OBJECTS = $(am_libCbcSolver_la_OBJECTS) @COIN_HAS_CLP_TRUE@am__EXEEXT_1 = cbc$(EXEEXT) @CBC_BUILD_CBC_GENERIC_TRUE@am__EXEEXT_2 = cbc-generic$(EXEEXT) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am__cbc_SOURCES_DIST = CoinSolve.cpp @COIN_HAS_CLP_TRUE@am_cbc_OBJECTS = CoinSolve.$(OBJEXT) cbc_OBJECTS = $(am_cbc_OBJECTS) am__cbc_generic_SOURCES_DIST = CbcGenBaB.cpp CbcGenCbcParam.cpp \ CbcGenCbcParam.hpp CbcGenCbcParamUtils.cpp CbcGenCtlBlk.cpp \ CbcGenCtlBlk.hpp CbcGeneric.cpp CbcGenMessages.cpp \ CbcGenMessages.hpp CbcGenOsiParam.cpp CbcGenOsiParam.hpp \ CbcGenOsiParamUtils.cpp CbcGenParam.cpp CbcGenParam.hpp \ CbcGenParamUtils.cpp CbcGenSolution.cpp CbcGenSolvers.cpp @CBC_BUILD_CBC_GENERIC_TRUE@am_cbc_generic_OBJECTS = \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenBaB.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenCbcParam.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenCbcParamUtils.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenCtlBlk.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGeneric.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenMessages.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenOsiParam.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenOsiParamUtils.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenParam.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenParamUtils.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenSolution.$(OBJEXT) \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenSolvers.$(OBJEXT) cbc_generic_OBJECTS = $(am_cbc_generic_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCbc_la_SOURCES) $(libCbcSolver_la_SOURCES) \ $(cbc_SOURCES) $(cbc_generic_SOURCES) DIST_SOURCES = $(libCbc_la_SOURCES) $(libCbcSolver_la_SOURCES) \ $(am__cbc_SOURCES_DIST) $(am__cbc_generic_SOURCES_DIST) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ ASL_CFLAGS = @ASL_CFLAGS@ ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ ASL_DATA = @ASL_DATA@ ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ ASL_LIBS = @ASL_LIBS@ ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CBCGENERIC_CFLAGS = @CBCGENERIC_CFLAGS@ CBCGENERIC_CFLAGS_INSTALLED = @CBCGENERIC_CFLAGS_INSTALLED@ CBCGENERIC_DEPENDENCIES = @CBCGENERIC_DEPENDENCIES@ CBCGENERIC_LIBS = @CBCGENERIC_LIBS@ CBCGENERIC_LIBS_INSTALLED = @CBCGENERIC_LIBS_INSTALLED@ CBCGENERIC_PCLIBS = @CBCGENERIC_PCLIBS@ CBCGENERIC_PCREQUIRES = @CBCGENERIC_PCREQUIRES@ CBCLIB_CFLAGS = @CBCLIB_CFLAGS@ CBCLIB_CFLAGS_INSTALLED = @CBCLIB_CFLAGS_INSTALLED@ CBCLIB_DEPENDENCIES = @CBCLIB_DEPENDENCIES@ CBCLIB_LIBS = @CBCLIB_LIBS@ CBCLIB_LIBS_INSTALLED = @CBCLIB_LIBS_INSTALLED@ CBCLIB_PCLIBS = @CBCLIB_PCLIBS@ CBCLIB_PCREQUIRES = @CBCLIB_PCREQUIRES@ CBC_BUILD_CBC_GENERIC_FALSE = @CBC_BUILD_CBC_GENERIC_FALSE@ CBC_BUILD_CBC_GENERIC_TRUE = @CBC_BUILD_CBC_GENERIC_TRUE@ CBC_SVN_REV = @CBC_SVN_REV@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CLP_CFLAGS = @CLP_CFLAGS@ CLP_CFLAGS_INSTALLED = @CLP_CFLAGS_INSTALLED@ CLP_DATA = @CLP_DATA@ CLP_DATA_INSTALLED = @CLP_DATA_INSTALLED@ CLP_DEPENDENCIES = @CLP_DEPENDENCIES@ CLP_LIBS = @CLP_LIBS@ CLP_LIBS_INSTALLED = @CLP_LIBS_INSTALLED@ COINDEPEND_CFLAGS = @COINDEPEND_CFLAGS@ COINDEPEND_CFLAGS_INSTALLED = @COINDEPEND_CFLAGS_INSTALLED@ COINDEPEND_DATA = @COINDEPEND_DATA@ COINDEPEND_DATA_INSTALLED = @COINDEPEND_DATA_INSTALLED@ COINDEPEND_DEPENDENCIES = @COINDEPEND_DEPENDENCIES@ COINDEPEND_LIBS = @COINDEPEND_LIBS@ COINDEPEND_LIBS_INSTALLED = @COINDEPEND_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ COIN_HAS_CLP_FALSE = @COIN_HAS_CLP_FALSE@ COIN_HAS_CLP_TRUE = @COIN_HAS_CLP_TRUE@ COIN_HAS_COINDEPEND_FALSE = @COIN_HAS_COINDEPEND_FALSE@ COIN_HAS_COINDEPEND_TRUE = @COIN_HAS_COINDEPEND_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_DYLP_FALSE = @COIN_HAS_DYLP_FALSE@ COIN_HAS_DYLP_TRUE = @COIN_HAS_DYLP_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MIPLIB3_FALSE = @COIN_HAS_MIPLIB3_FALSE@ COIN_HAS_MIPLIB3_TRUE = @COIN_HAS_MIPLIB3_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_NTY_FALSE = @COIN_HAS_NTY_FALSE@ COIN_HAS_NTY_TRUE = @COIN_HAS_NTY_TRUE@ COIN_HAS_OSITESTS_FALSE = @COIN_HAS_OSITESTS_FALSE@ COIN_HAS_OSITESTS_TRUE = @COIN_HAS_OSITESTS_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SPX_FALSE = @COIN_HAS_SPX_FALSE@ COIN_HAS_SPX_TRUE = @COIN_HAS_SPX_TRUE@ COIN_HAS_VOL_FALSE = @COIN_HAS_VOL_FALSE@ COIN_HAS_VOL_TRUE = @COIN_HAS_VOL_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPX_CFLAGS = @CPX_CFLAGS@ CPX_CFLAGS_INSTALLED = @CPX_CFLAGS_INSTALLED@ CPX_DATA = @CPX_DATA@ CPX_DATA_INSTALLED = @CPX_DATA_INSTALLED@ CPX_DEPENDENCIES = @CPX_DEPENDENCIES@ CPX_LIBS = @CPX_LIBS@ CPX_LIBS_INSTALLED = @CPX_LIBS_INSTALLED@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ DYLP_CFLAGS = @DYLP_CFLAGS@ DYLP_CFLAGS_INSTALLED = @DYLP_CFLAGS_INSTALLED@ DYLP_DATA = @DYLP_DATA@ DYLP_DATA_INSTALLED = @DYLP_DATA_INSTALLED@ DYLP_DEPENDENCIES = @DYLP_DEPENDENCIES@ DYLP_LIBS = @DYLP_LIBS@ DYLP_LIBS_INSTALLED = @DYLP_LIBS_INSTALLED@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRB_CFLAGS = @GRB_CFLAGS@ GRB_CFLAGS_INSTALLED = @GRB_CFLAGS_INSTALLED@ GRB_DATA = @GRB_DATA@ GRB_DATA_INSTALLED = @GRB_DATA_INSTALLED@ GRB_DEPENDENCIES = @GRB_DEPENDENCIES@ GRB_LIBS = @GRB_LIBS@ GRB_LIBS_INSTALLED = @GRB_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MIPLIB3_CFLAGS = @MIPLIB3_CFLAGS@ MIPLIB3_CFLAGS_INSTALLED = @MIPLIB3_CFLAGS_INSTALLED@ MIPLIB3_DATA = @MIPLIB3_DATA@ MIPLIB3_DATA_INSTALLED = @MIPLIB3_DATA_INSTALLED@ MIPLIB3_DEPENDENCIES = @MIPLIB3_DEPENDENCIES@ MIPLIB3_LIBS = @MIPLIB3_LIBS@ MIPLIB3_LIBS_INSTALLED = @MIPLIB3_LIBS_INSTALLED@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSK_CFLAGS = @MSK_CFLAGS@ MSK_CFLAGS_INSTALLED = @MSK_CFLAGS_INSTALLED@ MSK_DATA = @MSK_DATA@ MSK_DATA_INSTALLED = @MSK_DATA_INSTALLED@ MSK_DEPENDENCIES = @MSK_DEPENDENCIES@ MSK_LIBS = @MSK_LIBS@ MSK_LIBS_INSTALLED = @MSK_LIBS_INSTALLED@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ NTYINCDIR = @NTYINCDIR@ NTYLIB = @NTYLIB@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICBC_DFLT_SOLVER_CLP_FALSE = @OSICBC_DFLT_SOLVER_CLP_FALSE@ OSICBC_DFLT_SOLVER_CLP_TRUE = @OSICBC_DFLT_SOLVER_CLP_TRUE@ OSICBC_DFLT_SOLVER_CPX_FALSE = @OSICBC_DFLT_SOLVER_CPX_FALSE@ OSICBC_DFLT_SOLVER_CPX_TRUE = @OSICBC_DFLT_SOLVER_CPX_TRUE@ OSICBC_DFLT_SOLVER_DYLP_FALSE = @OSICBC_DFLT_SOLVER_DYLP_FALSE@ OSICBC_DFLT_SOLVER_DYLP_TRUE = @OSICBC_DFLT_SOLVER_DYLP_TRUE@ OSICBC_DFLT_SOLVER_GLPK_FALSE = @OSICBC_DFLT_SOLVER_GLPK_FALSE@ OSICBC_DFLT_SOLVER_GLPK_TRUE = @OSICBC_DFLT_SOLVER_GLPK_TRUE@ OSICBC_DFLT_SOLVER_GRB_FALSE = @OSICBC_DFLT_SOLVER_GRB_FALSE@ OSICBC_DFLT_SOLVER_GRB_TRUE = @OSICBC_DFLT_SOLVER_GRB_TRUE@ OSICBC_DFLT_SOLVER_MSK_FALSE = @OSICBC_DFLT_SOLVER_MSK_FALSE@ OSICBC_DFLT_SOLVER_MSK_TRUE = @OSICBC_DFLT_SOLVER_MSK_TRUE@ OSICBC_DFLT_SOLVER_SPX_FALSE = @OSICBC_DFLT_SOLVER_SPX_FALSE@ OSICBC_DFLT_SOLVER_SPX_TRUE = @OSICBC_DFLT_SOLVER_SPX_TRUE@ OSICBC_DFLT_SOLVER_SYM_FALSE = @OSICBC_DFLT_SOLVER_SYM_FALSE@ OSICBC_DFLT_SOLVER_SYM_TRUE = @OSICBC_DFLT_SOLVER_SYM_TRUE@ OSICBC_DFLT_SOLVER_VOL_FALSE = @OSICBC_DFLT_SOLVER_VOL_FALSE@ OSICBC_DFLT_SOLVER_VOL_TRUE = @OSICBC_DFLT_SOLVER_VOL_TRUE@ OSICBC_DFLT_SOLVER_XPR_FALSE = @OSICBC_DFLT_SOLVER_XPR_FALSE@ OSICBC_DFLT_SOLVER_XPR_TRUE = @OSICBC_DFLT_SOLVER_XPR_TRUE@ OSITESTS_CFLAGS = @OSITESTS_CFLAGS@ OSITESTS_CFLAGS_INSTALLED = @OSITESTS_CFLAGS_INSTALLED@ OSITESTS_DATA = @OSITESTS_DATA@ OSITESTS_DATA_INSTALLED = @OSITESTS_DATA_INSTALLED@ OSITESTS_DEPENDENCIES = @OSITESTS_DEPENDENCIES@ OSITESTS_LIBS = @OSITESTS_LIBS@ OSITESTS_LIBS_INSTALLED = @OSITESTS_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SPX_CFLAGS = @SPX_CFLAGS@ SPX_CFLAGS_INSTALLED = @SPX_CFLAGS_INSTALLED@ SPX_DATA = @SPX_DATA@ SPX_DATA_INSTALLED = @SPX_DATA_INSTALLED@ SPX_DEPENDENCIES = @SPX_DEPENDENCIES@ SPX_LIBS = @SPX_LIBS@ SPX_LIBS_INSTALLED = @SPX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VOL_CFLAGS = @VOL_CFLAGS@ VOL_CFLAGS_INSTALLED = @VOL_CFLAGS_INSTALLED@ VOL_DATA = @VOL_DATA@ VOL_DATA_INSTALLED = @VOL_DATA_INSTALLED@ VOL_DEPENDENCIES = @VOL_DEPENDENCIES@ VOL_LIBS = @VOL_LIBS@ VOL_LIBS_INSTALLED = @VOL_LIBS_INSTALLED@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPR_CFLAGS = @XPR_CFLAGS@ XPR_CFLAGS_INSTALLED = @XPR_CFLAGS_INSTALLED@ XPR_DATA = @XPR_DATA@ XPR_DATA_INSTALLED = @XPR_DATA_INSTALLED@ XPR_DEPENDENCIES = @XPR_DEPENDENCIES@ XPR_LIBS = @XPR_LIBS@ XPR_LIBS_INSTALLED = @XPR_LIBS_INSTALLED@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCbc # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in the 'lib' directory lib_LTLIBRARIES = libCbc.la libCbcSolver.la # List all source files for this library, including headers libCbc_la_SOURCES = \ CbcConfig.h \ CbcBranchActual.hpp \ CbcBranchAllDifferent.cpp CbcBranchAllDifferent.hpp \ CbcBranchBase.hpp \ CbcBranchCut.cpp CbcBranchCut.hpp \ CbcBranchDecision.cpp CbcBranchDecision.hpp \ CbcBranchDefaultDecision.cpp CbcBranchDefaultDecision.hpp \ CbcBranchDynamic.cpp CbcBranchDynamic.hpp \ CbcBranchingObject.cpp CbcBranchingObject.hpp \ CbcBranchLotsize.cpp CbcBranchLotsize.hpp \ CbcBranchToFixLots.cpp CbcBranchToFixLots.hpp \ CbcCompareActual.hpp \ CbcCompareBase.hpp \ CbcCompareDefault.cpp CbcCompareDefault.hpp \ CbcCompareDepth.cpp CbcCompareDepth.hpp \ CbcCompareEstimate.cpp CbcCompareEstimate.hpp \ CbcCompareObjective.cpp CbcCompareObjective.hpp \ CbcConsequence.cpp CbcConsequence.hpp \ CbcClique.cpp CbcClique.hpp \ CbcCompare.hpp \ CbcCountRowCut.cpp CbcCountRowCut.hpp \ CbcCutGenerator.cpp CbcCutGenerator.hpp \ CbcCutModifier.cpp CbcCutModifier.hpp \ CbcCutSubsetModifier.cpp CbcCutSubsetModifier.hpp \ CbcDummyBranchingObject.cpp CbcDummyBranchingObject.hpp \ CbcEventHandler.cpp CbcEventHandler.hpp \ CbcFathom.cpp CbcFathom.hpp \ CbcFathomDynamicProgramming.cpp CbcFathomDynamicProgramming.hpp \ CbcFeasibilityBase.hpp \ CbcFixVariable.cpp CbcFixVariable.hpp \ CbcFullNodeInfo.cpp CbcFullNodeInfo.hpp \ CbcFollowOn.cpp CbcFollowOn.hpp \ CbcGeneral.cpp CbcGeneral.hpp \ CbcGeneralDepth.cpp CbcGeneralDepth.hpp \ CbcHeuristic.cpp CbcHeuristic.hpp \ CbcHeuristicDINS.cpp CbcHeuristicDINS.hpp \ CbcHeuristicDive.cpp CbcHeuristicDive.hpp \ CbcHeuristicDiveCoefficient.cpp CbcHeuristicDiveCoefficient.hpp \ CbcHeuristicDiveFractional.cpp CbcHeuristicDiveFractional.hpp \ CbcHeuristicDiveGuided.cpp CbcHeuristicDiveGuided.hpp \ CbcHeuristicDiveLineSearch.cpp CbcHeuristicDiveLineSearch.hpp \ CbcHeuristicDivePseudoCost.cpp CbcHeuristicDivePseudoCost.hpp \ CbcHeuristicDiveVectorLength.cpp CbcHeuristicDiveLength.hpp \ CbcHeuristicFPump.cpp CbcHeuristicFPump.hpp \ CbcHeuristicGreedy.cpp CbcHeuristicGreedy.hpp \ CbcHeuristicLocal.cpp CbcHeuristicLocal.hpp \ CbcHeuristicPivotAndFix.cpp CbcHeuristicPivotAndFix.hpp \ CbcHeuristicRandRound.cpp CbcHeuristicRandRound.hpp \ CbcHeuristicRENS.cpp CbcHeuristicRENS.hpp \ CbcHeuristicRINS.cpp CbcHeuristicRINS.hpp \ CbcHeuristicVND.cpp CbcHeuristicVND.hpp \ CbcHeuristicDW.cpp CbcHeuristicDW.hpp \ CbcMessage.cpp CbcMessage.hpp \ CbcModel.cpp CbcModel.hpp \ CbcNode.cpp CbcNode.hpp \ CbcNodeInfo.cpp CbcNodeInfo.hpp \ CbcNWay.cpp CbcNWay.hpp \ CbcObject.cpp CbcObject.hpp \ CbcObjectUpdateData.cpp CbcObjectUpdateData.hpp \ CbcPartialNodeInfo.cpp CbcPartialNodeInfo.hpp \ CbcSimpleInteger.cpp CbcSimpleInteger.hpp \ CbcSimpleIntegerDynamicPseudoCost.cpp \ CbcSimpleIntegerDynamicPseudoCost.hpp \ CbcSimpleIntegerPseudoCost.cpp \ CbcSimpleIntegerPseudoCost.hpp \ CbcSOS.cpp CbcSOS.hpp \ CbcStatistics.cpp CbcStatistics.hpp \ CbcStrategy.cpp CbcStrategy.hpp \ CbcSubProblem.cpp CbcSubProblem.hpp \ CbcSymmetry.cpp CbcSymmetry.hpp \ CbcThread.cpp CbcThread.hpp \ CbcTree.cpp CbcTree.hpp \ CbcTreeLocal.cpp CbcTreeLocal.hpp libCbcSolver_la_SOURCES = \ Cbc_C_Interface.cpp Cbc_C_Interface.h \ CbcCbcParam.cpp \ Cbc_ampl.cpp Cbc_ampl.h \ CbcLinked.cpp CbcLinked.hpp CbcLinkedUtils.cpp \ unitTestClp.cpp CbcSolver.cpp \ CbcSolverHeuristics.cpp CbcSolverHeuristics.hpp \ CbcSolverAnalyze.cpp CbcSolverAnalyze.hpp \ CbcMipStartIO.cpp CbcMipStartIO.hpp \ CbcSolverExpandKnapsack.cpp CbcSolverExpandKnapsack.hpp # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libCbc_la_LIBADD = $(CBCLIB_LIBS) @DEPENDENCY_LINKING_TRUE@libCbcSolver_la_LIBADD = $(CBCLIB_LIBS) libCbc.la # This is for libtool libCbc_la_LDFLAGS = $(LT_LDFLAGS) libCbcSolver_la_LDFLAGS = $(LT_LDFLAGS) ######################################################################## # Additional flags # ######################################################################## # List additional defines AM_CPPFLAGS = $(COINDEPEND_CFLAGS) $(CLP_CFLAGS) $(CPX_CFLAGS) \ $(ASL_CFLAGS) $(am__append_1) $(am__append_4) \ -DCOIN_NO_CLP_MESSAGE -DUSE_CBCCONFIG # List all source files for this executable, including headers @COIN_HAS_CLP_TRUE@cbc_SOURCES = CoinSolve.cpp # Additional libraries @COIN_HAS_CLP_TRUE@cbc_LDADD = libCbcSolver.la libCbc.la $(CBCLIB_LIBS) $(ASL_LIBS) @COIN_HAS_CLP_TRUE@cbc_DEPENDENCIES = libCbcSolver.la libCbc.la $(CBCLIB_DEPENDENCIES) $(ASL_DEPENDENCIES) # List all source files for this executable, including headers @CBC_BUILD_CBC_GENERIC_TRUE@cbc_generic_SOURCES = \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenBaB.cpp \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenCbcParam.cpp CbcGenCbcParam.hpp CbcGenCbcParamUtils.cpp \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenCtlBlk.cpp CbcGenCtlBlk.hpp \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGeneric.cpp \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenMessages.cpp CbcGenMessages.hpp \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenOsiParam.cpp CbcGenOsiParam.hpp CbcGenOsiParamUtils.cpp \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenParam.cpp CbcGenParam.hpp CbcGenParamUtils.cpp \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenSolution.cpp \ @CBC_BUILD_CBC_GENERIC_TRUE@ CbcGenSolvers.cpp @CBC_BUILD_CBC_GENERIC_TRUE@cbc_generic_LDADD = libCbcSolver.la libCbc.la $(CBCGENERIC_LIBS) @CBC_BUILD_CBC_GENERIC_TRUE@cbc_generic_DEPENDENCIES = libCbcSolver.la libCbc.la $(CBCGENERIC_DEPENDENCIES) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ Cbc_C_Interface.h \ CbcBranchActual.hpp \ CbcBranchAllDifferent.hpp \ CbcBranchBase.hpp \ CbcBranchDynamic.hpp \ CbcBranchCut.hpp \ CbcBranchDecision.hpp \ CbcBranchDefaultDecision.hpp \ CbcBranchingObject.hpp \ CbcBranchLotsize.hpp \ CbcBranchToFixLots.hpp \ CbcCompareActual.hpp \ CbcCompareBase.hpp \ CbcCompareDefault.hpp \ CbcCompareDepth.hpp \ CbcCompareEstimate.hpp \ CbcCompareObjective.hpp \ CbcConsequence.hpp \ CbcClique.hpp \ CbcCompare.hpp \ CbcCountRowCut.hpp \ CbcCutGenerator.hpp \ CbcCutModifier.hpp \ CbcCutSubsetModifier.hpp \ CbcDummyBranchingObject.hpp \ CbcFathom.hpp \ CbcEventHandler.hpp \ CbcFathomDynamicProgramming.hpp \ CbcFeasibilityBase.hpp \ CbcFixVariable.hpp \ CbcFollowOn.hpp \ CbcFullNodeInfo.hpp \ CbcGeneral.hpp \ CbcGeneralDepth.hpp \ CbcHeuristic.hpp \ CbcHeuristicDINS.hpp \ CbcHeuristicDive.hpp \ CbcHeuristicDiveCoefficient.hpp \ CbcHeuristicDiveFractional.hpp \ CbcHeuristicDiveGuided.hpp \ CbcHeuristicDiveLineSearch.hpp \ CbcHeuristicDivePseudoCost.hpp \ CbcHeuristicDiveVectorLength.hpp \ CbcHeuristicFPump.hpp \ CbcHeuristicGreedy.hpp \ CbcHeuristicLocal.hpp \ CbcHeuristicPivotAndFix.hpp \ CbcHeuristicRandRound.hpp \ CbcHeuristicRENS.hpp \ CbcHeuristicRINS.hpp \ CbcHeuristicVND.hpp \ CbcHeuristicDW.hpp \ CbcMessage.hpp \ CbcModel.hpp \ CbcNode.hpp \ CbcNodeInfo.hpp \ CbcNWay.hpp \ CbcObject.hpp \ CbcObjectUpdateData.hpp \ CbcParam.hpp \ CbcPartialNodeInfo.hpp \ CbcSimpleInteger.hpp \ CbcSimpleIntegerDynamicPseudoCost.hpp \ CbcSimpleIntegerPseudoCost.hpp \ CbcStrategy.hpp \ CbcSolver.hpp \ CbcMipStartIO.hpp \ CbcSOS.hpp \ CbcSubProblem.hpp \ CbcTree.hpp \ CbcLinked.hpp \ CbcTreeLocal.hpp \ ClpConstraintAmpl.hpp \ ClpAmplObjective.hpp all: config.h config_cbc.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ config_cbc.h: stamp-h2 @if test ! -f $@; then \ rm -f stamp-h2; \ $(MAKE) stamp-h2; \ else :; fi stamp-h2: $(srcdir)/config_cbc.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status src/config_cbc.h distclean-hdr: -rm -f config.h stamp-h1 config_cbc.h stamp-h2 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libCbc.la: $(libCbc_la_OBJECTS) $(libCbc_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libCbc_la_LDFLAGS) $(libCbc_la_OBJECTS) $(libCbc_la_LIBADD) $(LIBS) libCbcSolver.la: $(libCbcSolver_la_OBJECTS) $(libCbcSolver_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libCbcSolver_la_LDFLAGS) $(libCbcSolver_la_OBJECTS) $(libCbcSolver_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done cbc$(EXEEXT): $(cbc_OBJECTS) $(cbc_DEPENDENCIES) @rm -f cbc$(EXEEXT) $(CXXLINK) $(cbc_LDFLAGS) $(cbc_OBJECTS) $(cbc_LDADD) $(LIBS) cbc-generic$(EXEEXT): $(cbc_generic_OBJECTS) $(cbc_generic_DEPENDENCIES) @rm -f cbc-generic$(EXEEXT) $(CXXLINK) $(cbc_generic_LDFLAGS) $(cbc_generic_OBJECTS) $(cbc_generic_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcBranchAllDifferent.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcBranchCut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcBranchDecision.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcBranchDefaultDecision.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcBranchDynamic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcBranchLotsize.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcBranchToFixLots.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcBranchingObject.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCbcParam.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcClique.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCompareDefault.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCompareDepth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCompareEstimate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCompareObjective.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcConsequence.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCountRowCut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCutGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCutModifier.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcCutSubsetModifier.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcDummyBranchingObject.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcEventHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcFathom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcFathomDynamicProgramming.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcFixVariable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcFollowOn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcFullNodeInfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenBaB.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenCbcParam.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenCbcParamUtils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenCtlBlk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenMessages.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenOsiParam.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenOsiParamUtils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenParam.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenParamUtils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenSolution.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGenSolvers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGeneral.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGeneralDepth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcGeneric.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDINS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDW.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDive.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDiveCoefficient.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDiveFractional.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDiveGuided.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDiveLineSearch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDivePseudoCost.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicDiveVectorLength.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicFPump.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicGreedy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicLocal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicPivotAndFix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicRENS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicRINS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicRandRound.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicVND.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcLinked.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcLinkedUtils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcMessage.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcMipStartIO.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcModel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcNWay.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcNode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcNodeInfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcObject.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcObjectUpdateData.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcPartialNodeInfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSOS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSimpleInteger.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSimpleIntegerDynamicPseudoCost.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSimpleIntegerPseudoCost.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSolver.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSolverAnalyze.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSolverExpandKnapsack.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSolverHeuristics.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcStatistics.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcStrategy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSubProblem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcSymmetry.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcThread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcTree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcTreeLocal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cbc_C_Interface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cbc_ampl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinSolve.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unitTestClp.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in config_cbc.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_cbc.h.in $(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; } \ END { 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) config.h.in config_cbc.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_cbc.h.in $(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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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) $(PROGRAMS) $(HEADERS) config.h \ config_cbc.h install-binPROGRAMS: install-libLTLIBRARIES installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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." @COIN_CXX_IS_CL_FALSE@install-exec-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-binPROGRAMS install-exec-local \ install-libLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-info: install-info-am install-man: 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: uninstall-binPROGRAMS uninstall-includecoinHEADERS \ uninstall-info-am uninstall-libLTLIBRARIES uninstall-local .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libLTLIBRARIES clean-libtool ctags \ distclean distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-exec install-exec-am \ install-exec-hook install-exec-local \ install-includecoinHEADERS install-info install-info-am \ install-libLTLIBRARIES install-man 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 uninstall-binPROGRAMS \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local ######################################################################## # Installing manifest (MSVC++) # ######################################################################## @COIN_CXX_IS_CL_TRUE@install-exec-hook: @COIN_CXX_IS_CL_TRUE@ test -s cbc.exe.manifest && \ @COIN_CXX_IS_CL_TRUE@ mt -manifest cbc.exe.manifest -outputresource:cbc.exe;\ @COIN_CXX_IS_CL_TRUE@ cp cbc.exe $(bindir)/cbc.exe ####################################################################### # Create the Config.h file that has all public defines and install it # ####################################################################### install-exec-local: $(install_sh_DATA) config_cbc.h $(DESTDIR)$(includecoindir)/CbcConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/CbcConfig.h # 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: CoinMP-1.8.3/Cbc/src/CbcGenOsiParam.cpp0000644000175000017500000000664312131054770016064 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenOsiParam.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinParam.hpp" #include "CbcModel.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" #include "CbcGenCbcParam.hpp" #include "CbcGenOsiParam.hpp" namespace { char svnid[] = "$Id: CbcGenOsiParam.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } /* Constructors and destructors There's a generic constructor and one for integer, double, keyword, string, and action parameters. */ /* Default constructor. */ CbcOsiParam::CbcOsiParam () : CoinParam(), paramCode_(CbcOsiParamCode(0)), obj_(0) { /* Nothing to be done here */ } /* Constructor for double parameter */ CbcOsiParam::CbcOsiParam (CbcOsiParamCode code, std::string name, std::string help, double lower, double upper, double dflt, bool display) : CoinParam(name, help, lower, upper, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for integer parameter */ CbcOsiParam::CbcOsiParam (CbcOsiParamCode code, std::string name, std::string help, int lower, int upper, int dflt, bool display) : CoinParam(name, help, lower, upper, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for keyword parameter. */ CbcOsiParam::CbcOsiParam (CbcOsiParamCode code, std::string name, std::string help, std::string firstValue, int dflt, bool display) : CoinParam(name, help, firstValue, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for string parameter. */ CbcOsiParam::CbcOsiParam (CbcOsiParamCode code, std::string name, std::string help, std::string dflt, bool display) : CoinParam(name, help, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for action parameter. */ CbcOsiParam::CbcOsiParam (CbcOsiParamCode code, std::string name, std::string help, bool display) : CoinParam(name, help, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Copy constructor. */ CbcOsiParam::CbcOsiParam (const CbcOsiParam &orig) : CoinParam(orig), paramCode_(orig.paramCode_), obj_(orig.obj_) { /* Nothing to be done here */ } /* Clone */ CbcOsiParam *CbcOsiParam::clone () { return (new CbcOsiParam(*this)) ; } CbcOsiParam &CbcOsiParam::operator= (const CbcOsiParam & rhs) { if (this != &rhs) { CoinParam::operator=(rhs) ; paramCode_ = rhs.paramCode_ ; obj_ = rhs.obj_ ; } return *this ; } /* Destructor */ CbcOsiParam::~CbcOsiParam () { /* Nothing more to do */ } CoinMP-1.8.3/Cbc/src/CbcDummyBranchingObject.hpp0000644000175000017500000000531612131054770017756 0ustar renerene// $Id: CbcDummyBranchingObject.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #ifndef CbcDummyBranchingObject_H #define CbcDummyBranchingObject_H #include "CbcBranchBase.hpp" /** Dummy branching object This object specifies a one-way dummy branch. This is so one can carry on branching even when it looks feasible */ class CbcDummyBranchingObject : public CbcBranchingObject { public: /// Default constructor CbcDummyBranchingObject (CbcModel * model = NULL); /// Copy constructor CbcDummyBranchingObject ( const CbcDummyBranchingObject &); /// Assignment operator CbcDummyBranchingObject & operator= (const CbcDummyBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; /// Destructor virtual ~CbcDummyBranchingObject (); using CbcBranchingObject::branch ; /** \brief Dummy branch */ virtual double branch(); #ifdef JJF_ZERO // No need to override. Default works fine. /** Reset every information so that the branching object appears to point to the previous child. This method does not need to modify anything in any solver. */ virtual void previousBranch(); #endif using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return DummyBranchObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveGuided.cpp0000644000175000017500000001003212426717442017604 0ustar renerene/* $Id: CbcHeuristicDiveGuided.cpp 2093 2014-11-06 16:17:38Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcHeuristicDiveGuided.hpp" #include "CbcStrategy.hpp" // Default Constructor CbcHeuristicDiveGuided::CbcHeuristicDiveGuided() : CbcHeuristicDive() { } // Constructor from model CbcHeuristicDiveGuided::CbcHeuristicDiveGuided(CbcModel & model) : CbcHeuristicDive(model) { } // Destructor CbcHeuristicDiveGuided::~CbcHeuristicDiveGuided () { } // Clone CbcHeuristicDiveGuided * CbcHeuristicDiveGuided::clone() const { return new CbcHeuristicDiveGuided(*this); } // Create C++ lines to get to current state void CbcHeuristicDiveGuided::generateCpp( FILE * fp) { CbcHeuristicDiveGuided other; fprintf(fp, "0#include \"CbcHeuristicDiveGuided.hpp\"\n"); fprintf(fp, "3 CbcHeuristicDiveGuided heuristicDiveGuided(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicDiveGuided"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicDiveGuided);\n"); } // Copy constructor CbcHeuristicDiveGuided::CbcHeuristicDiveGuided(const CbcHeuristicDiveGuided & rhs) : CbcHeuristicDive(rhs) { } // Assignment operator CbcHeuristicDiveGuided & CbcHeuristicDiveGuided::operator=( const CbcHeuristicDiveGuided & rhs) { if (this != &rhs) { CbcHeuristicDive::operator=(rhs); } return *this; } bool CbcHeuristicDiveGuided::canHeuristicRun() { double* bestIntegerSolution = model_->bestSolution(); if (bestIntegerSolution == NULL) return false; // no integer solution available. Switch off heuristic return CbcHeuristicDive::canHeuristicRun(); } bool CbcHeuristicDiveGuided::selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound) { double* bestIntegerSolution = model_->bestSolution(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); bestColumn = -1; bestRound = -1; // -1 rounds down, +1 rounds up double bestFraction = COIN_DBL_MAX; bool allTriviallyRoundableSoFar = true; int bestPriority = COIN_INT_MAX; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; double fraction = value - floor(value); int round = 0; if (fabs(floor(value + 0.5) - value) > integerTolerance) { if (allTriviallyRoundableSoFar || (downLocks_[i] > 0 && upLocks_[i] > 0)) { if (allTriviallyRoundableSoFar && downLocks_[i] > 0 && upLocks_[i] > 0) { allTriviallyRoundableSoFar = false; bestFraction = COIN_DBL_MAX; } if (value >= bestIntegerSolution[iColumn]) round = -1; else { round = 1; fraction = 1.0 - fraction; } // if variable is not binary, penalize it if (!solver->isBinary(iColumn)) fraction *= 1000.0; // if priorities then use if (priority_) { int thisRound=static_cast(priority_[i].direction); if ((thisRound&1)!=0) round = ((thisRound&2)==0) ? -1 : +1; if (priority_[i].priority>bestPriority) { fraction=COIN_DBL_MAX; } else if (priority_[i].priority(priority_[i].priority); bestFraction=COIN_DBL_MAX; } } if (fraction < bestFraction) { bestColumn = iColumn; bestFraction = fraction; bestRound = round; } } } } return allTriviallyRoundableSoFar; } CoinMP-1.8.3/Cbc/src/CbcHeuristicDINS.cpp0000644000175000017500000003750112432625130016327 0ustar renerene// $Id: CbcHeuristicDINS.cpp 2094 2014-11-18 11:15:36Z forrest $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // edwin 12/5/09 carved out of CbcHeuristicRINS #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristicDINS.hpp" #include "CbcBranchActual.hpp" #include "CbcStrategy.hpp" #include "CglPreProcess.hpp" // Default Constructor CbcHeuristicDINS::CbcHeuristicDINS() : CbcHeuristic() { numberSolutions_ = 0; numberSuccesses_ = 0; numberTries_ = 0; howOften_ = 100; decayFactor_ = 0.5; maximumKeepSolutions_ = 5; numberKeptSolutions_ = 0; numberIntegers_ = -1; localSpace_ = 10; values_ = NULL; } // Constructor with model - assumed before cuts CbcHeuristicDINS::CbcHeuristicDINS(CbcModel & model) : CbcHeuristic(model) { numberSolutions_ = 0; numberSuccesses_ = 0; numberTries_ = 0; howOften_ = 100; decayFactor_ = 0.5; assert(model.solver()); maximumKeepSolutions_ = 5; numberKeptSolutions_ = 0; numberIntegers_ = -1; localSpace_ = 10; values_ = NULL; } // Destructor CbcHeuristicDINS::~CbcHeuristicDINS () { for (int i = 0; i < numberKeptSolutions_; i++) delete [] values_[i]; delete [] values_; } // Clone CbcHeuristic * CbcHeuristicDINS::clone() const { return new CbcHeuristicDINS(*this); } // Assignment operator CbcHeuristicDINS & CbcHeuristicDINS::operator=( const CbcHeuristicDINS & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); numberSolutions_ = rhs.numberSolutions_; howOften_ = rhs.howOften_; numberSuccesses_ = rhs.numberSuccesses_; numberTries_ = rhs.numberTries_; for (int i = 0; i < numberKeptSolutions_; i++) delete [] values_[i]; delete [] values_; maximumKeepSolutions_ = rhs.maximumKeepSolutions_; numberKeptSolutions_ = rhs.numberKeptSolutions_; numberIntegers_ = rhs.numberIntegers_; localSpace_ = rhs.localSpace_; if (model_ && rhs.values_) { assert (numberIntegers_ >= 0); values_ = new int * [maximumKeepSolutions_]; for (int i = 0; i < maximumKeepSolutions_; i++) values_[i] = CoinCopyOfArray(rhs.values_[i], numberIntegers_); } else { values_ = NULL; } } return *this; } // Create C++ lines to get to current state void CbcHeuristicDINS::generateCpp( FILE * fp) { CbcHeuristicDINS other; fprintf(fp, "0#include \"CbcHeuristicDINS.hpp\"\n"); fprintf(fp, "3 CbcHeuristicDINS heuristicDINS(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicDINS"); if (howOften_ != other.howOften_) fprintf(fp, "3 heuristicDINS.setHowOften(%d);\n", howOften_); else fprintf(fp, "4 heuristicDINS.setHowOften(%d);\n", howOften_); if (maximumKeepSolutions_ != other.maximumKeepSolutions_) fprintf(fp, "3 heuristicDINS.setMaximumKeep(%d);\n", maximumKeepSolutions_); else fprintf(fp, "4 heuristicDINS.setMaximumKeep(%d);\n", maximumKeepSolutions_); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicDINS);\n"); } // Copy constructor CbcHeuristicDINS::CbcHeuristicDINS(const CbcHeuristicDINS & rhs) : CbcHeuristic(rhs), numberSolutions_(rhs.numberSolutions_), howOften_(rhs.howOften_), numberSuccesses_(rhs.numberSuccesses_), numberTries_(rhs.numberTries_), maximumKeepSolutions_(rhs.maximumKeepSolutions_), numberKeptSolutions_(rhs.numberKeptSolutions_), numberIntegers_(rhs.numberIntegers_), localSpace_(rhs.localSpace_) { if (model_ && rhs.values_) { assert (numberIntegers_ >= 0); values_ = new int * [maximumKeepSolutions_]; for (int i = 0; i < maximumKeepSolutions_; i++) values_[i] = CoinCopyOfArray(rhs.values_[i], numberIntegers_); } else { values_ = NULL; } } // Resets stuff if model changes void CbcHeuristicDINS::resetModel(CbcModel * ) { //CbcHeuristic::resetModel(model); for (int i = 0; i < numberKeptSolutions_; i++) delete [] values_[i]; delete [] values_; numberKeptSolutions_ = 0; numberIntegers_ = -1; numberSolutions_ = 0; values_ = NULL; } /* First tries setting a variable to better value. If feasible then tries setting others. If not feasible then tries swaps Returns 1 if solution, 0 if not */ int CbcHeuristicDINS::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; int returnCode = 0; const double * bestSolution = model_->bestSolution(); if (!bestSolution) return 0; // No solution found yet #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif if (numberSolutions_ < model_->getSolutionCount()) { // new solution - add info numberSolutions_ = model_->getSolutionCount(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); if (numberIntegers_ < 0) { numberIntegers_ = numberIntegers; assert (!values_); values_ = new int * [maximumKeepSolutions_]; for (int i = 0; i < maximumKeepSolutions_; i++) values_[i] = NULL; } else { assert (numberIntegers >= numberIntegers_); } // move solutions (0 will be most recent) { int * temp = values_[maximumKeepSolutions_-1]; for (int i = maximumKeepSolutions_ - 1; i > 0; i--) values_[i] = values_[i-1]; if (!temp) temp = new int [numberIntegers_]; values_[0] = temp; } int i; for (i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable[i]; double value = bestSolution[iColumn]; double nearest = floor(value + 0.5); values_[0][i] = static_cast (nearest); } numberKeptSolutions_ = CoinMin(numberKeptSolutions_ + 1, maximumKeepSolutions_); } int finalReturnCode = 0; if (((model_->getNodeCount() % howOften_) == howOften_ / 2 || !model_->getNodeCount()) && (model_->getCurrentPassNumber() <= 1 || model_->getCurrentPassNumber() == 999999)) { OsiSolverInterface * solver = model_->solver(); //int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); const double * currentSolution = solver->getColSolution(); int localSpace = localSpace_; // 0 means finished but no solution, 1 solution, 2 node limit int status = -1; double cutoff = model_->getCutoff(); while (status) { status = 0; OsiSolverInterface * newSolver = cloneBut(3); // was model_->continuousSolver()->clone(); const double * colLower = solver->getColLower(); const double * colUpper = solver->getColUpper(); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); const double * continuousSolution = newSolver->getColSolution(); // Space for added constraint double * element = new double [numberIntegers_]; int * column = new int [numberIntegers_]; int i; int nFix = 0; int nCouldFix = 0; int nCouldFix2 = 0; int nBound = 0; int nEl = 0; double bias = localSpace; int okSame = numberKeptSolutions_ - 1; for (i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable[i]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double valueInt = bestSolution[iColumn]; if (valueInt < originalLower) { valueInt = originalLower; } else if (valueInt > originalUpper) { valueInt = originalUpper; } int intValue = static_cast (floor(valueInt + 0.5)); double currentValue = currentSolution[iColumn]; double currentLower = colLower[iColumn]; double currentUpper = colUpper[iColumn]; if (fabs(valueInt - currentValue) >= 0.5) { // Re-bound nBound++; if (intValue >= currentValue) { currentLower = CoinMax(currentLower, ceil(2 * currentValue - intValue)); currentUpper = intValue; } else { currentLower = intValue; currentUpper = CoinMin(currentUpper, floor(2 * currentValue - intValue)); } newSolver->setColLower(iColumn, currentLower); newSolver->setColUpper(iColumn, currentUpper); } else { // See if can fix bool canFix = false; double continuousValue = continuousSolution[iColumn]; if (fabs(currentValue - valueInt) < 10.0*primalTolerance) { if (currentUpper - currentLower > 1.0) { // General integer variable canFix = true; } else if (fabs(continuousValue - valueInt) < 10.0*primalTolerance) { int nSame = 1; //assert (intValue==values_[0][i]); for (int k = 1; k < numberKeptSolutions_; k++) { if (intValue == values_[k][i]) nSame++; } if (nSame >= okSame) { // can fix canFix = true; } else { nCouldFix++; } } else { nCouldFix2++; } } if (canFix) { newSolver->setColLower(iColumn, intValue); newSolver->setColUpper(iColumn, intValue); nFix++; } else { if (currentUpper - currentLower > 1.0) { // General integer variable currentLower = floor(currentValue); if (intValue >= currentLower && intValue <= currentLower + 1) { newSolver->setColLower(iColumn, currentLower); newSolver->setColUpper(iColumn, currentLower + 1.0); } else { // fix double value; if (intValue < currentLower) value = currentLower; else value = currentLower + 1; newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); nFix++; } } else { // 0-1 (ish) column[nEl] = iColumn; if (intValue == currentLower) { bias += currentLower; element[nEl++] = 1.0; } else if (intValue == currentUpper) { bias += currentUpper; element[nEl++] = -1.0; } else { printf("bad DINS logic\n"); abort(); } } } } } char generalPrint[200]; sprintf(generalPrint, "%d fixed, %d same as cont/int, %d same as int - %d bounded %d in cut\n", nFix, nCouldFix, nCouldFix2, nBound, nEl); model_->messageHandler()->message(CBC_FPUMP2, model_->messages()) << generalPrint << CoinMessageEol; if (nFix > numberIntegers_ / 10) { #ifdef JJF_ZERO newSolver->initialSolve(); printf("obj %g\n", newSolver->getObjValue()); for (i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable[i]; printf("%d new bounds %g %g - solutions %g %g\n", iColumn, newSolver->getColLower()[iColumn], newSolver->getColUpper()[iColumn], bestSolution[iColumn], currentSolution[iColumn]); } #endif if (nEl > 0) newSolver->addRow(nEl, column, element, -COIN_DBL_MAX, bias); //printf("%d integers have same value\n",nFix); returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, cutoff, "CbcHeuristicDINS"); if (returnCode < 0) { returnCode = 0; // returned on size status = 0; } else { numRuns_++; if ((returnCode&2) != 0) { // could add cut as complete search returnCode &= ~2; if ((returnCode&1) != 0) { numberSuccesses_++; status = 1; } else { // no solution status = 0; } } else { if ((returnCode&1) != 0) { numberSuccesses_++; status = 1; } else { // no solution but node limit status = 2; if (nEl) localSpace -= 5; else localSpace = -1; if (localSpace < 0) status = 0; } } if ((returnCode&1) != 0) { cutoff = CoinMin(cutoff, solutionValue - model_->getCutoffIncrement()); finalReturnCode = 1; } } } delete [] element; delete [] column; delete newSolver; } numberTries_++; if ((numberTries_ % 10) == 0 && numberSuccesses_*3 < numberTries_) howOften_ += static_cast (howOften_ * decayFactor_); } return finalReturnCode; } // update model void CbcHeuristicDINS::setModel(CbcModel * model) { model_ = model; // Get a copy of original matrix assert(model_->solver()); for (int i = 0; i < numberKeptSolutions_; i++) delete [] values_[i]; delete [] values_; numberKeptSolutions_ = 0; numberIntegers_ = -1; numberSolutions_ = 0; values_ = NULL; } CoinMP-1.8.3/Cbc/src/CbcTreeLocal.hpp0000644000175000017500000002603211510742604015570 0ustar renerene/* $Id: CbcTreeLocal.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcTreeLocal_H #define CbcTreeLocal_H //############################################################################# /* This implements (approximately) local branching as in the 2002 paper by Matteo Fischetti and Andrea Lodi. The very simple version of the algorithm for problems with 0-1 variables and continuous is as follows: Obtain a feasible solution (one can be passed in). Add a cut which limits search to a k neighborhood of this solution. (At most k 0-1 variables may change value) Do branch and bound on this problem. If finished search and proven optimal then we can reverse cut so any solutions must be at least k+1 away from solution and we can add a new cut limiting search to a k neighborhood of new solution repeat. If finished search and no new solution then the simplest version would reverse last cut and complete search. The version implemented here can use time and node limits and can widen search (increase effective k) .... and more */ #include "CbcTree.hpp" #include "CbcNode.hpp" #include "OsiRowCut.hpp" class CbcModel; class CbcTreeLocal : public CbcTree { public: // Default Constructor CbcTreeLocal (); /* Constructor with solution. If solution NULL no solution, otherwise must be integer range is initial upper bound (k) on difference from given solution. typeCuts - 0 means just 0-1 cuts and will need to refine 0-1 solution 1 uses weaker cuts on all integer variables maxDiversification is maximum number of range widenings to try timeLimit is seconds in subTree nodeLimit is nodes in subTree refine is whether to see if we can prove current solution is optimal when we fix all 0-1 (in case typeCuts==0 and there are general integer variables) if false then no refinement but reverse cuts weaker */ CbcTreeLocal (CbcModel * model, const double * solution , int range = 10, int typeCuts = 0, int maxDiversification = 0, int timeLimit = 1000000, int nodeLimit = 1000000, bool refine = true); // Copy constructor CbcTreeLocal ( const CbcTreeLocal & rhs); // = operator CbcTreeLocal & operator=(const CbcTreeLocal & rhs); virtual ~CbcTreeLocal(); /// Clone virtual CbcTree * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /*! \name Heap access and maintenance methods */ //@{ /// Return the top node of the heap virtual CbcNode * top() const; /// Add a node to the heap virtual void push(CbcNode * x); /// Remove the top node from the heap virtual void pop() ; //@} /*! \name Other stuff */ //@{ /// Create cut - return -1 if bad, 0 if okay and 1 if cut is everything int createCut(const double * solution, OsiRowCut & cut); /// Test if empty *** note may be overridden virtual bool empty() ; /// We may have got an intelligent tree so give it one more chance virtual void endSearch() ; /// Other side of last cut branch (if bias==rhs_ will be weakest possible) void reverseCut(int state, double bias = 0.0); /// Delete last cut branch void deleteCut(OsiRowCut & cut); /// Pass in solution (so can be used after heuristic) void passInSolution(const double * solution, double solutionValue); // range i.e. k inline int range() const { return range_; } // setrange i.e. k inline void setRange(int value) { range_ = value; } // Type of cuts - 0=just 0-1, 1=all inline int typeCuts() const { return typeCuts_; } // Type of cuts - 0=just 0-1, 1=all inline void setTypeCuts(int value) { typeCuts_ = value; } // maximum number of diversifications inline int maxDiversification() const { return maxDiversification_; } // maximum number of diversifications inline void setMaxDiversification(int value) { maxDiversification_ = value; } // time limit per subtree inline int timeLimit() const { return timeLimit_; } // time limit per subtree inline void setTimeLimit(int value) { timeLimit_ = value; } // node limit for subtree inline int nodeLimit() const { return nodeLimit_; } // node limit for subtree inline void setNodeLimit(int value) { nodeLimit_ = value; } // Whether to do refinement step inline bool refine() const { return refine_; } // Whether to do refinement step inline void setRefine(bool yesNo) { refine_ = yesNo; } //@} private: // Node for local cuts CbcNode * localNode_; // best solution double * bestSolution_; // saved solution double * savedSolution_; // solution number at start of pass int saveNumberSolutions_; /* Cut. If zero size then no solution yet. Otherwise is left hand branch */ OsiRowCut cut_; // This cut fixes all 0-1 variables OsiRowCut fixedCut_; // Model CbcModel * model_; // Original lower bounds double * originalLower_; // Original upper bounds double * originalUpper_; // range i.e. k int range_; // Type of cuts - 0=just 0-1, 1=all int typeCuts_; // maximum number of diversifications int maxDiversification_; // current diversification int diversification_; // Whether next will be strong diversification bool nextStrong_; // Current rhs double rhs_; // Save allowable gap double savedGap_; // Best solution double bestCutoff_; // time limit per subtree int timeLimit_; // time when subtree started int startTime_; // node limit for subtree int nodeLimit_; // node count when subtree started int startNode_; // -1 not started, 0 == stop on first solution, 1 don't stop on first, 2 refinement step int searchType_; // Whether to do refinement step bool refine_; }; class CbcTreeVariable : public CbcTree { public: // Default Constructor CbcTreeVariable (); /* Constructor with solution. If solution NULL no solution, otherwise must be integer range is initial upper bound (k) on difference from given solution. typeCuts - 0 means just 0-1 cuts and will need to refine 0-1 solution 1 uses weaker cuts on all integer variables maxDiversification is maximum number of range widenings to try timeLimit is seconds in subTree nodeLimit is nodes in subTree refine is whether to see if we can prove current solution is optimal when we fix all 0-1 (in case typeCuts==0 and there are general integer variables) if false then no refinement but reverse cuts weaker */ CbcTreeVariable (CbcModel * model, const double * solution , int range = 10, int typeCuts = 0, int maxDiversification = 0, int timeLimit = 1000000, int nodeLimit = 1000000, bool refine = true); // Copy constructor CbcTreeVariable ( const CbcTreeVariable & rhs); // = operator CbcTreeVariable & operator=(const CbcTreeVariable & rhs); virtual ~CbcTreeVariable(); /// Clone virtual CbcTree * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /*! \name Heap access and maintenance methods */ //@{ /// Return the top node of the heap virtual CbcNode * top() const; /// Add a node to the heap virtual void push(CbcNode * x); /// Remove the top node from the heap virtual void pop() ; //@} /*! \name Other stuff */ //@{ /// Create cut - return -1 if bad, 0 if okay and 1 if cut is everything int createCut(const double * solution, OsiRowCut & cut); /// Test if empty *** note may be overridden virtual bool empty() ; /// We may have got an intelligent tree so give it one more chance virtual void endSearch() ; /// Other side of last cut branch (if bias==rhs_ will be weakest possible) void reverseCut(int state, double bias = 0.0); /// Delete last cut branch void deleteCut(OsiRowCut & cut); /// Pass in solution (so can be used after heuristic) void passInSolution(const double * solution, double solutionValue); // range i.e. k inline int range() const { return range_; } // setrange i.e. k inline void setRange(int value) { range_ = value; } // Type of cuts - 0=just 0-1, 1=all inline int typeCuts() const { return typeCuts_; } // Type of cuts - 0=just 0-1, 1=all inline void setTypeCuts(int value) { typeCuts_ = value; } // maximum number of diversifications inline int maxDiversification() const { return maxDiversification_; } // maximum number of diversifications inline void setMaxDiversification(int value) { maxDiversification_ = value; } // time limit per subtree inline int timeLimit() const { return timeLimit_; } // time limit per subtree inline void setTimeLimit(int value) { timeLimit_ = value; } // node limit for subtree inline int nodeLimit() const { return nodeLimit_; } // node limit for subtree inline void setNodeLimit(int value) { nodeLimit_ = value; } // Whether to do refinement step inline bool refine() const { return refine_; } // Whether to do refinement step inline void setRefine(bool yesNo) { refine_ = yesNo; } //@} private: // Node for local cuts CbcNode * localNode_; // best solution double * bestSolution_; // saved solution double * savedSolution_; // solution number at start of pass int saveNumberSolutions_; /* Cut. If zero size then no solution yet. Otherwise is left hand branch */ OsiRowCut cut_; // This cut fixes all 0-1 variables OsiRowCut fixedCut_; // Model CbcModel * model_; // Original lower bounds double * originalLower_; // Original upper bounds double * originalUpper_; // range i.e. k int range_; // Type of cuts - 0=just 0-1, 1=all int typeCuts_; // maximum number of diversifications int maxDiversification_; // current diversification int diversification_; // Whether next will be strong diversification bool nextStrong_; // Current rhs double rhs_; // Save allowable gap double savedGap_; // Best solution double bestCutoff_; // time limit per subtree int timeLimit_; // time when subtree started int startTime_; // node limit for subtree int nodeLimit_; // node count when subtree started int startNode_; // -1 not started, 0 == stop on first solution, 1 don't stop on first, 2 refinement step int searchType_; // Whether to do refinement step bool refine_; }; #endif CoinMP-1.8.3/Cbc/src/CbcCutGenerator.hpp0000644000175000017500000003731312410776405016332 0ustar renerene/* $Id: CbcCutGenerator.hpp 2081 2014-09-25 11:31:17Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcCutGenerator_H #define CbcCutGenerator_H #include "OsiSolverInterface.hpp" #include "OsiCuts.hpp" #include "CglCutGenerator.hpp" #include "CbcCutModifier.hpp" class CbcModel; class OsiRowCut; class OsiRowCutDebugger; //############################################################################# /** Interface between Cbc and Cut Generation Library. \c CbcCutGenerator is intended to provide an intelligent interface between Cbc and the cutting plane algorithms in the CGL. A \c CbcCutGenerator is bound to a \c CglCutGenerator and to an \c CbcModel. It contains parameters which control when and how the \c generateCuts method of the \c CglCutGenerator will be called. The builtin decision criteria available to use when deciding whether to generate cuts are limited: every X nodes, when a solution is found, and when a subproblem is found to be infeasible. The idea is that the class will grow more intelligent with time. \todo Add a pointer to function member which will allow a client to install their own decision algorithm to decide whether or not to call the CGL \p generateCuts method. Create a default decision method that looks at the builtin criteria. \todo It strikes me as not good that generateCuts contains code specific to individual CGL algorithms. Another set of pointer to function members, so that the client can specify the cut generation method as well as pre- and post-generation methods? Taken a bit further, should this class contain a bunch of pointer to function members, one for each of the places where the cut generator might be referenced? Initialization, root node, search tree node, discovery of solution, and termination all come to mind. Initialization and termination would also be useful for instrumenting cbc. */ class CbcCutGenerator { public: /** \name Generate Cuts */ //@{ /** Generate cuts for the client model. Evaluate the state of the client model and decide whether to generate cuts. The generated cuts are inserted into and returned in the collection of cuts \p cs. If \p fullScan is !=0, the generator is obliged to call the CGL \c generateCuts routine. Otherwise, it is free to make a local decision. Negative fullScan says things like at integer solution The current implementation uses \c whenCutGenerator_ to decide. The routine returns true if reoptimisation is needed (because the state of the solver interface has been modified). If node then can find out depth */ bool generateCuts( OsiCuts &cs, int fullScan, OsiSolverInterface * solver, CbcNode * node); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CbcCutGenerator (); /// Normal constructor CbcCutGenerator(CbcModel * model, CglCutGenerator * generator, int howOften = 1, const char * name = NULL, bool normal = true, bool atSolution = false, bool infeasible = false, int howOftenInsub = -100, int whatDepth = -1, int whatDepthInSub = -1, int switchOffIfLessThan = 0); /// Copy constructor CbcCutGenerator (const CbcCutGenerator &); /// Assignment operator CbcCutGenerator & operator=(const CbcCutGenerator& rhs); /// Destructor ~CbcCutGenerator (); //@} /**@name Gets and sets */ //@{ /** Set the client model. In addition to setting the client model, refreshModel also calls the \c refreshSolver method of the CglCutGenerator object. */ void refreshModel(CbcModel * model); /// return name of generator inline const char * cutGeneratorName() const { return generatorName_; } /// Create C++ lines to show how to tune void generateTuning( FILE * fp); /** Set the cut generation interval Set the number of nodes evaluated between calls to the Cgl object's \p generateCuts routine. If \p value is positive, cuts will always be generated at the specified interval. If \p value is negative, cuts will initially be generated at the specified interval, but Cbc may adjust the value depending on the success of cuts produced by this generator. A value of -100 disables the generator, while a value of -99 means just at root. */ void setHowOften(int value) ; /// Get the cut generation interval. inline int howOften() const { return whenCutGenerator_; } /// Get the cut generation interval.in sub tree inline int howOftenInSub() const { return whenCutGeneratorInSub_; } /// Get level of cut inaccuracy (0 means exact e.g. cliques) inline int inaccuracy() const { return inaccuracy_; } /// Set level of cut inaccuracy (0 means exact e.g. cliques) inline void setInaccuracy(int level) { inaccuracy_ = level; } /** Set the cut generation depth Set the depth criterion for calls to the Cgl object's \p generateCuts routine. Only active if > 0. If whenCutGenerator is positive and this is positive then this overrides. If whenCutGenerator is -1 then this is used as criterion if any cuts were generated at root node. If whenCutGenerator is anything else this is ignored. */ void setWhatDepth(int value) ; /// Set the cut generation depth in sub tree void setWhatDepthInSub(int value) ; /// Get the cut generation depth criterion. inline int whatDepth() const { return depthCutGenerator_; } /// Get the cut generation depth criterion.in sub tree inline int whatDepthInSub() const { return depthCutGeneratorInSub_; } /// Set maximum number of times to enter inline void setMaximumTries(int value) { maximumTries_ = value;} /// Get maximum number of times to enter inline int maximumTries() const { return maximumTries_;} /// Get switches inline int switches() const { return switches_; } /// Set switches (for copying from virgin state) inline void setSwitches(int value) { switches_ = value; } /// Get whether the cut generator should be called in the normal place inline bool normal() const { return (switches_&1) != 0; } /// Set whether the cut generator should be called in the normal place inline void setNormal(bool value) { switches_ &= ~1; switches_ |= value ? 1 : 0; } /// Get whether the cut generator should be called when a solution is found inline bool atSolution() const { return (switches_&2) != 0; } /// Set whether the cut generator should be called when a solution is found inline void setAtSolution(bool value) { switches_ &= ~2; switches_ |= value ? 2 : 0; } /** Get whether the cut generator should be called when the subproblem is found to be infeasible. */ inline bool whenInfeasible() const { return (switches_&4) != 0; } /** Set whether the cut generator should be called when the subproblem is found to be infeasible. */ inline void setWhenInfeasible(bool value) { switches_ &= ~4; switches_ |= value ? 4 : 0; } /// Get whether the cut generator is being timed inline bool timing() const { return (switches_&64) != 0; } /// Set whether the cut generator is being timed inline void setTiming(bool value) { switches_ &= ~64; switches_ |= value ? 64 : 0; timeInCutGenerator_ = 0.0; } /// Return time taken in cut generator inline double timeInCutGenerator() const { return timeInCutGenerator_; } inline void incrementTimeInCutGenerator(double value) { timeInCutGenerator_ += value; } /// Get the \c CglCutGenerator corresponding to this \c CbcCutGenerator. inline CglCutGenerator * generator() const { return generator_; } /// Number times cut generator entered inline int numberTimesEntered() const { return numberTimes_; } inline void setNumberTimesEntered(int value) { numberTimes_ = value; } inline void incrementNumberTimesEntered(int value = 1) { numberTimes_ += value; } /// Total number of cuts added inline int numberCutsInTotal() const { return numberCuts_; } inline void setNumberCutsInTotal(int value) { numberCuts_ = value; } inline void incrementNumberCutsInTotal(int value = 1) { numberCuts_ += value; } /// Total number of elements added inline int numberElementsInTotal() const { return numberElements_; } inline void setNumberElementsInTotal(int value) { numberElements_ = value; } inline void incrementNumberElementsInTotal(int value = 1) { numberElements_ += value; } /// Total number of column cuts inline int numberColumnCuts() const { return numberColumnCuts_; } inline void setNumberColumnCuts(int value) { numberColumnCuts_ = value; } inline void incrementNumberColumnCuts(int value = 1) { numberColumnCuts_ += value; } /// Total number of cuts active after (at end of n cut passes at each node) inline int numberCutsActive() const { return numberCutsActive_; } inline void setNumberCutsActive(int value) { numberCutsActive_ = value; } inline void incrementNumberCutsActive(int value = 1) { numberCutsActive_ += value; } inline void setSwitchOffIfLessThan(int value) { switchOffIfLessThan_ = value; } inline int switchOffIfLessThan() const { return switchOffIfLessThan_; } /// Say if optimal basis needed inline bool needsOptimalBasis() const { return (switches_&128) != 0; } /// Set if optimal basis needed inline void setNeedsOptimalBasis(bool yesNo) { switches_ &= ~128; switches_ |= yesNo ? 128 : 0; } /// Whether generator MUST be called again if any cuts (i.e. ignore break from loop) inline bool mustCallAgain() const { return (switches_&8) != 0; } /// Set whether generator MUST be called again if any cuts (i.e. ignore break from loop) inline void setMustCallAgain(bool yesNo) { switches_ &= ~8; switches_ |= yesNo ? 8 : 0; } /// Whether generator switched off for moment inline bool switchedOff() const { return (switches_&16) != 0; } /// Set whether generator switched off for moment inline void setSwitchedOff(bool yesNo) { switches_ &= ~16; switches_ |= yesNo ? 16 : 0; } /// Whether last round of cuts did little inline bool ineffectualCuts() const { return (switches_&512) != 0; } /// Set whether last round of cuts did little inline void setIneffectualCuts(bool yesNo) { switches_ &= ~512; switches_ |= yesNo ? 512 : 0; } /// Whether to use if any cuts generated inline bool whetherToUse() const { return (switches_&1024) != 0; } /// Set whether to use if any cuts generated inline void setWhetherToUse(bool yesNo) { switches_ &= ~1024; switches_ |= yesNo ? 1024 : 0; } /// Whether in must call again mode (or after others) inline bool whetherInMustCallAgainMode() const { return (switches_&2048) != 0; } /// Set whether in must call again mode (or after others) inline void setWhetherInMustCallAgainMode(bool yesNo) { switches_ &= ~2048; switches_ |= yesNo ? 2048 : 0; } /// Whether to call at end inline bool whetherCallAtEnd() const { return (switches_&4096) != 0; } /// Set whether to call at end inline void setWhetherCallAtEnd(bool yesNo) { switches_ &= ~4096; switches_ |= yesNo ? 4096 : 0; } /// Whether needs refresh on copy inline bool needsRefresh() const { return (switches_&8192) != 0; } /// Set whether needs refresh on copy inline void setNeedsRefresh(bool yesNo) { switches_ &= ~8192; switches_ |= yesNo ? 8192 : 0; } /// Number of cuts generated at root inline int numberCutsAtRoot() const { return numberCutsAtRoot_; } inline void setNumberCutsAtRoot(int value) { numberCutsAtRoot_ = value; } /// Number of cuts active at root inline int numberActiveCutsAtRoot() const { return numberActiveCutsAtRoot_; } inline void setNumberActiveCutsAtRoot(int value) { numberActiveCutsAtRoot_ = value; } /// Number of short cuts at root inline int numberShortCutsAtRoot() const { return numberShortCutsAtRoot_; } inline void setNumberShortCutsAtRoot(int value) { numberShortCutsAtRoot_ = value; } /// Set model inline void setModel(CbcModel * model) { model_ = model; } /// Whether global cuts at root inline bool globalCutsAtRoot() const { return (switches_&32) != 0; } /// Set whether global cuts at root inline void setGlobalCutsAtRoot(bool yesNo) { switches_ &= ~32; switches_ |= yesNo ? 32 : 0; } /// Whether global cuts inline bool globalCuts() const { return (switches_&256) != 0; } /// Set whether global cuts inline void setGlobalCuts(bool yesNo) { switches_ &= ~256; switches_ |= yesNo ? 256 : 0; } /// Add in statistics from other void addStatistics(const CbcCutGenerator * other); /// Scale back statistics by factor void scaleBackStatistics(int factor); //@} private: /**@name Private gets and sets */ //@{ //@} /// Saved cuts OsiCuts savedCuts_; /// Time in cut generator double timeInCutGenerator_; /// The client model CbcModel *model_; // The CglCutGenerator object CglCutGenerator * generator_; /// Name of generator char * generatorName_; /** Number of nodes between calls to the CglCutGenerator::generateCuts routine. */ int whenCutGenerator_; /** Number of nodes between calls to the CglCutGenerator::generateCuts routine in sub tree. */ int whenCutGeneratorInSub_; /** If first pass at root produces fewer than this cuts then switch off */ int switchOffIfLessThan_; /** Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depth%depthCutGenerator==0). */ int depthCutGenerator_; /** Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depth%depthCutGenerator==0). In sub tree. */ int depthCutGeneratorInSub_; /// Level of cut inaccuracy (0 means exact e.g. cliques) int inaccuracy_; /// Number times cut generator entered int numberTimes_; /// Total number of cuts added int numberCuts_; /// Total number of elements added int numberElements_; /// Total number of column cuts added int numberColumnCuts_; /// Total number of cuts active after (at end of n cut passes at each node) int numberCutsActive_; /// Number of cuts generated at root int numberCutsAtRoot_; /// Number of cuts active at root int numberActiveCutsAtRoot_; /// Number of short cuts at root int numberShortCutsAtRoot_; /// Switches - see gets and sets int switches_; /// Maximum number of times to enter int maximumTries_; }; // How often to do if mostly switched off (A) # define SCANCUTS 1000 // How often to do if mostly switched off (probing B) # define SCANCUTS_PROBING 1000 #endif CoinMP-1.8.3/Cbc/src/CbcBranchToFixLots.cpp0000644000175000017500000005115212131054770016723 0ustar renerene// $Id: CbcBranchToFixLots.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/13/2009-- carved out of CbcBranchCut #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchCut.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" #include "CbcBranchToFixLots.hpp" /** Default Constructor Equivalent to an unspecified binary variable. */ CbcBranchToFixLots::CbcBranchToFixLots () : CbcBranchCut(), djTolerance_(COIN_DBL_MAX), fractionFixed_(1.0), mark_(NULL), depth_(-1), numberClean_(0), alwaysCreate_(false) { } /* Useful constructor - passed reduced cost tolerance and fraction we would like fixed. Also depth level to do at. Also passed number of 1 rows which when clean triggers fix Always does if all 1 rows cleaned up and number>0 or if fraction columns reached Also whether to create branch if can't reach fraction. */ CbcBranchToFixLots::CbcBranchToFixLots (CbcModel * model, double djTolerance, double fractionFixed, int depth, int numberClean, const char * mark, bool alwaysCreate) : CbcBranchCut(model) { djTolerance_ = djTolerance; fractionFixed_ = fractionFixed; if (mark) { int numberColumns = model->getNumCols(); mark_ = new char[numberColumns]; memcpy(mark_, mark, numberColumns); } else { mark_ = NULL; } depth_ = depth; assert (model); OsiSolverInterface * solver = model_->solver(); matrixByRow_ = *solver->getMatrixByRow(); numberClean_ = numberClean; alwaysCreate_ = alwaysCreate; } // Copy constructor CbcBranchToFixLots::CbcBranchToFixLots ( const CbcBranchToFixLots & rhs) : CbcBranchCut(rhs) { djTolerance_ = rhs.djTolerance_; fractionFixed_ = rhs.fractionFixed_; int numberColumns = model_->getNumCols(); mark_ = CoinCopyOfArray(rhs.mark_, numberColumns); matrixByRow_ = rhs.matrixByRow_; depth_ = rhs.depth_; numberClean_ = rhs.numberClean_; alwaysCreate_ = rhs.alwaysCreate_; } // Clone CbcObject * CbcBranchToFixLots::clone() const { return new CbcBranchToFixLots(*this); } // Assignment operator CbcBranchToFixLots & CbcBranchToFixLots::operator=( const CbcBranchToFixLots & rhs) { if (this != &rhs) { CbcBranchCut::operator=(rhs); djTolerance_ = rhs.djTolerance_; fractionFixed_ = rhs.fractionFixed_; int numberColumns = model_->getNumCols(); delete [] mark_; mark_ = CoinCopyOfArray(rhs.mark_, numberColumns); matrixByRow_ = rhs.matrixByRow_; depth_ = rhs.depth_; numberClean_ = rhs.numberClean_; alwaysCreate_ = rhs.alwaysCreate_; } return *this; } // Destructor CbcBranchToFixLots::~CbcBranchToFixLots () { delete [] mark_; } CbcBranchingObject * CbcBranchToFixLots::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * /*info*/, int /*way*/) { // by default way must be -1 //assert (way==-1); //OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * dj = solver->getReducedCost(); int i; int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); // make smaller ? double tolerance = CoinMin(1.0e-8, integerTolerance); // How many fixed are we aiming at int wantedFixed = static_cast (static_cast(numberIntegers) * fractionFixed_); int nSort = 0; int numberFixed = 0; int numberColumns = solver->getNumCols(); int * sort = new int[numberColumns]; double * dsort = new double[numberColumns]; if (djTolerance_ != -1.234567) { int type = shallWe(); assert (type); // Take clean first if (type == 1) { for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (upper[iColumn] > lower[iColumn]) { if (!mark_ || !mark_[iColumn]) { if (solution[iColumn] < lower[iColumn] + tolerance) { if (dj[iColumn] > djTolerance_) { dsort[nSort] = -dj[iColumn]; sort[nSort++] = iColumn; } } else if (solution[iColumn] > upper[iColumn] - tolerance) { if (dj[iColumn] < -djTolerance_) { dsort[nSort] = dj[iColumn]; sort[nSort++] = iColumn; } } } } else { numberFixed++; } } // sort CoinSort_2(dsort, dsort + nSort, sort); nSort = CoinMin(nSort, wantedFixed - numberFixed); } else if (type < 10) { int i; //const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); const double * solution = solver->getColSolution(); int numberColumns = solver->getNumCols(); int numberRows = solver->getNumRows(); for (i = 0; i < numberColumns; i++) { sort[i] = i; if (columnLower[i] != columnUpper[i]) { dsort[i] = 1.0e100; } else { dsort[i] = 1.0e50; numberFixed++; } } for (i = 0; i < numberRows; i++) { double rhsValue = rowUpper[i]; bool oneRow = true; // check elements int numberUnsatisfied = 0; for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; double value = elementByRow[j]; double solValue = solution[iColumn]; if (columnLower[iColumn] != columnUpper[iColumn]) { if (solValue < 1.0 - integerTolerance && solValue > integerTolerance) numberUnsatisfied++; if (value != 1.0) { oneRow = false; break; } } else { rhsValue -= value * floor(solValue + 0.5); } } if (oneRow && rhsValue <= 1.0 + tolerance) { if (!numberUnsatisfied) { for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (dsort[iColumn] > 1.0e50) { dsort[iColumn] = 0; nSort++; } } } } } // sort CoinSort_2(dsort, dsort + numberColumns, sort); } else { // new way for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (upper[iColumn] > lower[iColumn]) { if (!mark_ || !mark_[iColumn]) { double distanceDown = solution[iColumn] - lower[iColumn]; double distanceUp = upper[iColumn] - solution[iColumn]; double distance = CoinMin(distanceDown, distanceUp); if (distance > 0.001 && distance < 0.5) { dsort[nSort] = distance; sort[nSort++] = iColumn; } } } } // sort CoinSort_2(dsort, dsort + nSort, sort); int n = 0; double sum = 0.0; for (int k = 0; k < nSort; k++) { sum += dsort[k]; if (sum <= djTolerance_) n = k; else break; } nSort = CoinMin(n, numberClean_ / 1000000); } } else { #define FIX_IF_LESS -0.1 // 3 in same row and sum testSolution(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); double bestSum = 1.0; int nBest = -1; int kRow = -1; OsiSolverInterface * solver = model_->solver(); for (int i = 0; i < numberRows; i++) { int numberUnsatisfied = 0; double sum = 0.0; for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (solver->isInteger(iColumn)) { double solValue = solution[iColumn]; if (solValue > 1.0e-5 && solValue < FIX_IF_LESS) { numberUnsatisfied++; sum += solValue; } } } if (numberUnsatisfied >= 3 && sum < FIX_IF_LESS) { // possible if (numberUnsatisfied > nBest || (numberUnsatisfied == nBest && sum < bestSum)) { nBest = numberUnsatisfied; bestSum = sum; kRow = i; } } } assert (nBest > 0); for (int j = rowStart[kRow]; j < rowStart[kRow] + rowLength[kRow]; j++) { int iColumn = column[j]; if (solver->isInteger(iColumn)) { double solValue = solution[iColumn]; if (solValue > 1.0e-5 && solValue < FIX_IF_LESS) { sort[nSort++] = iColumn; } } } } OsiRowCut down; down.setLb(-COIN_DBL_MAX); double rhs = 0.0; for (i = 0; i < nSort; i++) { int iColumn = sort[i]; double distanceDown = solution[iColumn] - lower[iColumn]; double distanceUp = upper[iColumn] - solution[iColumn]; if (distanceDown < distanceUp) { rhs += lower[iColumn]; dsort[i] = 1.0; } else { rhs -= upper[iColumn]; dsort[i] = -1.0; } } down.setUb(rhs); down.setRow(nSort, sort, dsort); down.setEffectiveness(COIN_DBL_MAX); // so will persist delete [] sort; delete [] dsort; // up is same - just with rhs changed OsiRowCut up = down; up.setLb(rhs + 1.0); up.setUb(COIN_DBL_MAX); // Say can fix one way CbcCutBranchingObject * newObject = new CbcCutBranchingObject(model_, down, up, true); if (model_->messageHandler()->logLevel() > 1) printf("creating cut in CbcBranchCut\n"); return newObject; } /* Does a lot of the work, Returns 0 if no good, 1 if dj, 2 if clean, 3 if both 10 if branching on ones away from bound */ int CbcBranchToFixLots::shallWe() const { int returnCode = 0; OsiSolverInterface * solver = model_->solver(); int numberRows = matrixByRow_.getNumRows(); //if (numberRows!=solver->getNumRows()) //return 0; const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * dj = solver->getReducedCost(); int i; int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); if (numberClean_ > 1000000) { int wanted = numberClean_ % 1000000; int * sort = new int[numberIntegers]; double * dsort = new double[numberIntegers]; int nSort = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (upper[iColumn] > lower[iColumn]) { if (!mark_ || !mark_[iColumn]) { double distanceDown = solution[iColumn] - lower[iColumn]; double distanceUp = upper[iColumn] - solution[iColumn]; double distance = CoinMin(distanceDown, distanceUp); if (distance > 0.001 && distance < 0.5) { dsort[nSort] = distance; sort[nSort++] = iColumn; } } } } // sort CoinSort_2(dsort, dsort + nSort, sort); int n = 0; double sum = 0.0; for (int k = 0; k < nSort; k++) { sum += dsort[k]; if (sum <= djTolerance_) n = k; else break; } delete [] sort; delete [] dsort; return (n >= wanted) ? 10 : 0; } double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); // make smaller ? double tolerance = CoinMin(1.0e-8, integerTolerance); // How many fixed are we aiming at int wantedFixed = static_cast (static_cast(numberIntegers) * fractionFixed_); if (djTolerance_ < 1.0e10) { int nSort = 0; int numberFixed = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (upper[iColumn] > lower[iColumn]) { if (!mark_ || !mark_[iColumn]) { if (solution[iColumn] < lower[iColumn] + tolerance) { if (dj[iColumn] > djTolerance_) { nSort++; } } else if (solution[iColumn] > upper[iColumn] - tolerance) { if (dj[iColumn] < -djTolerance_) { nSort++; } } } } else { numberFixed++; } } if (numberFixed + nSort < wantedFixed && !alwaysCreate_) { returnCode = 0; } else if (numberFixed < wantedFixed) { returnCode = 1; } else { returnCode = 0; } } if (numberClean_) { // see how many rows clean int i; //const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); const double * solution = solver->getColSolution(); int numberClean = 0; bool someToDoYet = false; int numberColumns = solver->getNumCols(); char * mark = new char[numberColumns]; int numberFixed = 0; for (i = 0; i < numberColumns; i++) { if (columnLower[i] != columnUpper[i]) { mark[i] = 0; } else { mark[i] = 1; numberFixed++; } } int numberNewFixed = 0; for (i = 0; i < numberRows; i++) { double rhsValue = rowUpper[i]; bool oneRow = true; // check elements int numberUnsatisfied = 0; for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; double value = elementByRow[j]; double solValue = solution[iColumn]; if (columnLower[iColumn] != columnUpper[iColumn]) { if (solValue < 1.0 - integerTolerance && solValue > integerTolerance) numberUnsatisfied++; if (value != 1.0) { oneRow = false; break; } } else { rhsValue -= value * floor(solValue + 0.5); } } if (oneRow && rhsValue <= 1.0 + tolerance) { if (numberUnsatisfied) { someToDoYet = true; } else { numberClean++; for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (columnLower[iColumn] != columnUpper[iColumn] && !mark[iColumn]) { mark[iColumn] = 1; numberNewFixed++; } } } } } delete [] mark; //printf("%d clean, %d old fixed, %d new fixed\n", // numberClean,numberFixed,numberNewFixed); if (someToDoYet && numberClean < numberClean_ && numberNewFixed + numberFixed < wantedFixed) { } else if (numberFixed < wantedFixed) { returnCode |= 2; } else { } } return returnCode; } double CbcBranchToFixLots::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { preferredWay = -1; CbcNode * node = model_->currentNode(); int depth; if (node) depth = CoinMax(node->depth(), 0); else return 0.0; if (depth_ < 0) { return 0.0; } else if (depth_ > 0) { if ((depth % depth_) != 0) return 0.0; } if (djTolerance_ != -1.234567) { if (!shallWe()) return 0.0; else return 1.0e20; } else { // See if 3 in same row and sum testSolution(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); double bestSum = 1.0; int nBest = -1; OsiSolverInterface * solver = model_->solver(); for (int i = 0; i < numberRows; i++) { int numberUnsatisfied = 0; double sum = 0.0; for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (solver->isInteger(iColumn)) { double solValue = solution[iColumn]; if (solValue > 1.0e-5 && solValue < FIX_IF_LESS) { numberUnsatisfied++; sum += solValue; } } } if (numberUnsatisfied >= 3 && sum < FIX_IF_LESS) { // possible if (numberUnsatisfied > nBest || (numberUnsatisfied == nBest && sum < bestSum)) { nBest = numberUnsatisfied; bestSum = sum; } } } if (nBest > 0) return 1.0e20; else return 0.0; } } // Redoes data when sequence numbers change void CbcBranchToFixLots::redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns) { model_ = model; if (mark_) { OsiSolverInterface * solver = model_->solver(); int numberColumnsNow = solver->getNumCols(); char * temp = new char[numberColumnsNow]; memset(temp, 0, numberColumnsNow); for (int i = 0; i < numberColumns; i++) { int j = originalColumns[i]; temp[i] = mark_[j]; } delete [] mark_; mark_ = temp; } OsiSolverInterface * solver = model_->solver(); matrixByRow_ = *solver->getMatrixByRow(); } CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveCoefficient.cpp0000644000175000017500000001102312432625130020607 0ustar renerene/* $Id: CbcHeuristicDiveCoefficient.cpp 2094 2014-11-18 11:15:36Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif //#define PRINT_DEBUG #include "CbcHeuristicDiveCoefficient.hpp" #include "CbcStrategy.hpp" // Default Constructor CbcHeuristicDiveCoefficient::CbcHeuristicDiveCoefficient() : CbcHeuristicDive() { whereFrom_ |= 16*(1+256); } // Constructor from model CbcHeuristicDiveCoefficient::CbcHeuristicDiveCoefficient(CbcModel & model) : CbcHeuristicDive(model) { whereFrom_ |= 16*(1+256); } // Destructor CbcHeuristicDiveCoefficient::~CbcHeuristicDiveCoefficient () { } // Clone CbcHeuristicDiveCoefficient * CbcHeuristicDiveCoefficient::clone() const { return new CbcHeuristicDiveCoefficient(*this); } // Create C++ lines to get to current state void CbcHeuristicDiveCoefficient::generateCpp( FILE * fp) { CbcHeuristicDiveCoefficient other; fprintf(fp, "0#include \"CbcHeuristicDiveCoefficient.hpp\"\n"); fprintf(fp, "3 CbcHeuristicDiveCoefficient heuristicDiveCoefficient(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicDiveCoefficient"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicDiveCoefficient);\n"); } // Copy constructor CbcHeuristicDiveCoefficient::CbcHeuristicDiveCoefficient(const CbcHeuristicDiveCoefficient & rhs) : CbcHeuristicDive(rhs) { } // Assignment operator CbcHeuristicDiveCoefficient & CbcHeuristicDiveCoefficient::operator=( const CbcHeuristicDiveCoefficient & rhs) { if (this != &rhs) { CbcHeuristicDive::operator=(rhs); } return *this; } bool CbcHeuristicDiveCoefficient::selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound) { int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); bestColumn = -1; bestRound = -1; // -1 rounds down, +1 rounds up double bestFraction = COIN_DBL_MAX; int bestLocks = COIN_INT_MAX; bool allTriviallyRoundableSoFar = true; int bestPriority = COIN_INT_MAX; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; double fraction = value - floor(value); int round = 0; if (fabs(floor(value + 0.5) - value) > integerTolerance) { int nDownLocks = downLocks_[i]; int nUpLocks = upLocks_[i]; if (allTriviallyRoundableSoFar || (nDownLocks > 0 && nUpLocks > 0)) { if (allTriviallyRoundableSoFar && nDownLocks > 0 && nUpLocks > 0) { allTriviallyRoundableSoFar = false; bestFraction = COIN_DBL_MAX; bestLocks = COIN_INT_MAX; } // the variable cannot be rounded int nLocks = nDownLocks; if (nDownLocks < nUpLocks) round = -1; else if (nDownLocks > nUpLocks) { round = 1; fraction = 1.0 - fraction; nLocks = nUpLocks; } else if (fraction < 0.5) round = -1; else { round = 1; fraction = 1.0 - fraction; nLocks = nUpLocks; } // if variable is not binary, penalize it if (!solver->isBinary(iColumn)) fraction *= 1000.0; // if priorities then use if (priority_) { int thisRound=static_cast(priority_[i].direction); if ((thisRound&1)!=0) round = ((thisRound&2)==0) ? -1 : +1; if (priority_[i].priority>bestPriority) { nLocks=COIN_INT_MAX; } else if (priority_[i].priority(priority_[i].priority); bestLocks=COIN_INT_MAX; } } if (nLocks < bestLocks || (nLocks == bestLocks && fraction < bestFraction)) { bestColumn = iColumn; bestLocks = nLocks; bestFraction = fraction; bestRound = round; } } } } return allTriviallyRoundableSoFar; } CoinMP-1.8.3/Cbc/src/CbcNWay.hpp0000644000175000017500000001222712131054770014575 0ustar renerene// $Id: CbcNWay.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/9/2009-- carved out of CbcBranchActual /** Define an n-way class for variables. Only valid value is one at UB others at LB Normally 0-1 */ #ifndef CbcNWay_H #define CbcNWay_H class CbcNWay : public CbcObject { public: // Default Constructor CbcNWay (); /** Useful constructor (which are matrix indices) */ CbcNWay (CbcModel * model, int numberMembers, const int * which, int identifier); // Copy constructor CbcNWay ( const CbcNWay &); /// Clone virtual CbcObject * clone() const; /// Assignment operator CbcNWay & operator=( const CbcNWay& rhs); /// Destructor virtual ~CbcNWay (); /// Set up a consequence for a single member void setConsequence(int iColumn, const CbcConsequence & consequence); /// Applies a consequence for a single member void applyConsequence(int iSequence, int state) const; /// Infeasibility - large is 0.5 (and 0.5 will give this) virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /// This looks at solution and sets bounds to contain solution virtual void feasibleRegion(); /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Number of members inline int numberMembers() const { return numberMembers_; } /// Members (indices in range 0 ... numberColumns-1) inline const int * members() const { return members_; } /// Redoes data when sequence numbers change virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns); protected: /// data /// Number of members int numberMembers_; /// Members (indices in range 0 ... numberColumns-1) int * members_; /// Consequences (normally NULL) CbcConsequence ** consequence_; }; /** N way branching Object class. Variable is number of set. */ class CbcNWayBranchingObject : public CbcBranchingObject { public: // Default Constructor CbcNWayBranchingObject (); /** Useful constructor - order had matrix indices way_ -1 corresponds to setting first, +1 to second, +3 etc. this is so -1 and +1 have similarity to normal */ CbcNWayBranchingObject (CbcModel * model, const CbcNWay * nway, int numberBranches, const int * order); // Copy constructor CbcNWayBranchingObject ( const CbcNWayBranchingObject &); // Assignment operator CbcNWayBranchingObject & operator=( const CbcNWayBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; // Destructor virtual ~CbcNWayBranchingObject (); using CbcBranchingObject::branch ; /// Does next branch and updates state virtual double branch(); #ifdef JJF_ZERO // FIXME: what do we need to do here? /** Reset every information so that the branching object appears to point to the previous child. This method does not need to modify anything in any solver. */ virtual void previousBranch(); #endif using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** The number of branch arms created for this branching object */ virtual int numberBranches() const { return numberInSet_; } /// Is this a two way object (-1 down, +1 up) virtual bool twoWay() const { return false; } /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return NWayBranchObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); private: /// order of branching - points back to CbcNWay int * order_; /// Points back to object const CbcNWay * object_; /// Number in set int numberInSet_; }; #endif CoinMP-1.8.3/Cbc/src/CbcCountRowCut.hpp0000644000175000017500000001213712432625130016151 0ustar renerene/* $Id: CbcCountRowCut.hpp 2094 2014-11-18 11:15:36Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcCountRowCut_H #define CbcCountRowCut_H class OsiCuts; class OsiRowCut; class CbcNodeInfo; //############################################################################# /** \brief OsiRowCut augmented with bookkeeping CbcCountRowCut is an OsiRowCut object augmented with bookkeeping information: a reference count and information that specifies the the generator that created the cut and the node to which it's associated. The general principles for handling the reference count are as follows:
    • Once it's determined how the node will branch, increment the reference count under the assumption that all children will use all cuts currently tight at the node and will survive to be placed in the search tree.
    • As this assumption is proven incorrect (a cut becomes loose, or a child is fathomed), decrement the reference count accordingly.
    When all possible uses of a cut have been demonstrated to be unnecessary, the reference count (#numberPointingToThis_) will fall to zero. The CbcCountRowCut object (and its included OsiRowCut object) are then deleted. */ class CbcCountRowCut : public OsiRowCut { public: /** @name Constructors & destructors */ //@{ /// Default Constructor CbcCountRowCut (); /// `Copy' constructor using an OsiRowCut CbcCountRowCut ( const OsiRowCut &); /// `Copy' constructor using an OsiRowCut and an CbcNodeInfo CbcCountRowCut(const OsiRowCut &, CbcNodeInfo *, int whichOne, int whichGenerator = -1, int numberPointingToThis = 0); /** Destructor \note The destructor will reach out (via #owner_) and NULL the reference to the cut in the owner's \link CbcNodeInfo::cuts_ cuts_ \endlink list. */ virtual ~CbcCountRowCut (); //@} /// Increment the number of references void increment(int change = 1); /// Decrement the number of references and return the number left. int decrement(int change = 1); /** \brief Set the information associating this cut with a node An CbcNodeInfo object and an index in the cut set of the node. For locally valid cuts, the node will be the search tree node where the cut was generated. For globally valid cuts, it's the node where the cut was activated. */ void setInfo(CbcNodeInfo *, int whichOne); /// Number of other CbcNodeInfo objects pointing to this row cut inline int numberPointingToThis() { return numberPointingToThis_; } /// Which generator for cuts - as user order inline int whichCutGenerator() const { return whichCutGenerator_; } /// Returns true if can drop cut if slack basic bool canDropCut(const OsiSolverInterface * solver, int row) const; #ifdef CHECK_CUT_COUNTS // Just for printing sanity checks int tempNumber_; #endif private: /// Standard copy is illegal (reference counts would be incorrect) CbcCountRowCut(const CbcCountRowCut &); /// Standard assignment is illegal (reference counts would be incorrect) CbcCountRowCut & operator=(const CbcCountRowCut& rhs); /// Backward pointer to owning CbcNodeInfo CbcNodeInfo * owner_; /// Index of cut in owner's cut set /// (\link CbcNodeInfo::cuts_ cuts_ \endlink). int ownerCut_; /// Number of other CbcNodeInfo objects pointing to this cut int numberPointingToThis_; /** Which generator created this cut (add 10000 if globally valid) if -1 then from global cut pool -2 cut branch -3 unknown */ int whichCutGenerator_; }; /** Really for Conflict cuts to - a) stop duplicates b) allow half baked cuts The whichRow_ field in OsiRowCut2 is used for a type 0 - normal 1 - processed cut (conflict) 2 - unprocessed cut i.e. dual ray computation */ // for hashing typedef struct { int index, next; } CoinHashLink; class CbcRowCuts { public: CbcRowCuts(int initialMaxSize=0, int hashMultiplier=4 ); ~CbcRowCuts(); CbcRowCuts(const CbcRowCuts& rhs); CbcRowCuts& operator=(const CbcRowCuts& rhs); inline OsiRowCut2 * cut(int sequence) const { return rowCut_[sequence];} inline int numberCuts() const { return numberCuts_;} inline int sizeRowCuts() const { return numberCuts_;} inline OsiRowCut * rowCutPtr(int sequence) { return rowCut_[sequence];} void eraseRowCut(int sequence); // Return 0 if added, 1 if not, -1 if not added because of space int addCutIfNotDuplicate(const OsiRowCut & cut,int whichType=0); // Return 0 if added, 1 if not, -1 if not added because of space int addCutIfNotDuplicateWhenGreedy(const OsiRowCut & cut,int whichType=0); // Add in cuts as normal cuts (and delete) void addCuts(OsiCuts & cs); // Truncate void truncate(int numberAfter); private: OsiRowCut2 ** rowCut_; /// Hash table CoinHashLink *hash_; int size_; int hashMultiplier_; int numberCuts_; int lastHash_; }; #endif CoinMP-1.8.3/Cbc/src/CbcFathomDynamicProgramming.cpp0000644000175000017500000010440612130062717020640 0ustar renerene/* $Id: CbcFathomDynamicProgramming.cpp 1886 2013-04-06 18:13:35Z stefan $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcFathomDynamicProgramming.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinSort.hpp" // Default Constructor CbcFathomDynamicProgramming::CbcFathomDynamicProgramming() : CbcFathom(), size_(0), type_(-1), cost_(NULL), back_(NULL), lookup_(NULL), indices_(NULL), numberActive_(0), maximumSizeAllowed_(1000000), startBit_(NULL), numberBits_(NULL), rhs_(NULL), coefficients_(NULL), target_(0), numberNonOne_(0), bitPattern_(0), algorithm_(-1) { } // Constructor from model CbcFathomDynamicProgramming::CbcFathomDynamicProgramming(CbcModel & model) : CbcFathom(model), cost_(NULL), back_(NULL), lookup_(NULL), indices_(NULL), numberActive_(0), maximumSizeAllowed_(1000000), startBit_(NULL), numberBits_(NULL), rhs_(NULL), coefficients_(NULL), target_(0), numberNonOne_(0), bitPattern_(0), algorithm_(-1) { type_ = checkPossible(); } // Destructor CbcFathomDynamicProgramming::~CbcFathomDynamicProgramming () { gutsOfDelete(); } // Does deleteions void CbcFathomDynamicProgramming::gutsOfDelete() { delete [] cost_; delete [] back_; delete [] lookup_; delete [] indices_; delete [] startBit_; delete [] numberBits_; delete [] rhs_; delete [] coefficients_; cost_ = NULL; back_ = NULL; lookup_ = NULL; indices_ = NULL; startBit_ = NULL; numberBits_ = NULL; rhs_ = NULL; coefficients_ = NULL; } // Clone CbcFathom * CbcFathomDynamicProgramming::clone() const { return new CbcFathomDynamicProgramming(*this); } // Copy constructor CbcFathomDynamicProgramming::CbcFathomDynamicProgramming(const CbcFathomDynamicProgramming & rhs) : CbcFathom(rhs), size_(rhs.size_), type_(rhs.type_), cost_(NULL), back_(NULL), lookup_(NULL), indices_(NULL), numberActive_(rhs.numberActive_), maximumSizeAllowed_(rhs.maximumSizeAllowed_), startBit_(NULL), numberBits_(NULL), rhs_(NULL), coefficients_(NULL), target_(rhs.target_), numberNonOne_(rhs.numberNonOne_), bitPattern_(rhs.bitPattern_), algorithm_(rhs.algorithm_) { if (size_) { cost_ = CoinCopyOfArray(rhs.cost_, size_); back_ = CoinCopyOfArray(rhs.back_, size_); int numberRows = model_->getNumRows(); lookup_ = CoinCopyOfArray(rhs.lookup_, numberRows); startBit_ = CoinCopyOfArray(rhs.startBit_, numberActive_); indices_ = CoinCopyOfArray(rhs.indices_, numberActive_); numberBits_ = CoinCopyOfArray(rhs.numberBits_, numberActive_); rhs_ = CoinCopyOfArray(rhs.rhs_, numberActive_); coefficients_ = CoinCopyOfArray(rhs.coefficients_, numberActive_); } } // Returns type int CbcFathomDynamicProgramming::checkPossible(int allowableSize) { algorithm_ = -1; assert(model_->solver()); OsiSolverInterface * solver = model_->solver(); const CoinPackedMatrix * matrix = solver->getMatrixByCol(); int numberIntegers = model_->numberIntegers(); int numberColumns = solver->getNumCols(); size_ = 0; if (numberIntegers != numberColumns) return -1; // can't do dynamic programming const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * rowUpper = solver->getRowUpper(); int numberRows = model_->getNumRows(); int i; // First check columns to see if possible double * rhs = new double [numberRows]; CoinCopyN(rowUpper, numberRows, rhs); // Column copy const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); bool bad = false; /* It is just possible that we could say okay as variables may get fixed but seems unlikely */ for (i = 0; i < numberColumns; i++) { int j; double lowerValue = lower[i]; assert (lowerValue == floor(lowerValue)); for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; double value = element[j]; if (upper[i] > lowerValue && (value <= 0.0 || value != floor(value))) bad = true; if (lowerValue) rhs[iRow] -= lowerValue * value; } } // check possible (at present do not allow covering) int numberActive = 0; bool infeasible = false; bool saveBad = bad; for (i = 0; i < numberRows; i++) { if (rhs[i] < 0) infeasible = true; else if (rhs[i] > 1.0e5 || fabs(rhs[i] - floor(rhs[i] + 0.5)) > 1.0e-7) bad = true; else if (rhs[i] > 0.0) numberActive++; } if (bad || infeasible) { delete [] rhs; if (!saveBad && infeasible) return -2; else return -1; } // check size of array needed double size = 1.0; double check = COIN_INT_MAX; for (i = 0; i < numberRows; i++) { int n = static_cast (floor(rhs[i] + 0.5)); if (n) { n++; // allow for 0,1... n if (numberActive != 1) { // power of 2 int iBit = 0; int k = n; k &= ~1; while (k) { iBit++; k &= ~(1 << iBit); } // See if exact power if (n != (1 << iBit)) { // round up to next power of 2 n = 1 << (iBit + 1); } size *= n; if (size >= check) break; } else { size = n; // just one constraint } } } // set size needed if (size >= check) size_ = COIN_INT_MAX; else size_ = static_cast (size); int n01 = 0; int nbadcoeff = 0; // See if we can tighten bounds for (i = 0; i < numberColumns; i++) { int j; double lowerValue = lower[i]; double gap = upper[i] - lowerValue; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; double value = element[j]; if (value != 1.0) nbadcoeff++; if (gap*value > rhs[iRow] + 1.0e-8) gap = rhs[iRow] / value; } gap = lowerValue + floor(gap + 1.0e-7); if (gap < upper[i]) solver->setColUpper(i, gap); if (gap <= 1.0) n01++; } if (allowableSize && size_ <= allowableSize) { if (n01 == numberColumns && !nbadcoeff) algorithm_ = 0; // easiest else algorithm_ = 1; } if (allowableSize && size_ <= allowableSize) { numberActive_ = numberActive; indices_ = new int [numberActive_]; cost_ = new double [size_]; CoinFillN(cost_, size_, COIN_DBL_MAX); // but do nothing is okay cost_[0] = 0.0; back_ = new int[size_]; CoinFillN(back_, size_, -1); startBit_ = new int[numberActive_]; numberBits_ = new int[numberActive_]; lookup_ = new int [numberRows]; rhs_ = new int [numberActive_]; numberActive = 0; int kBit = 0; for (i = 0; i < numberRows; i++) { int n = static_cast (floor(rhs[i] + 0.5)); if (n) { lookup_[i] = numberActive; rhs_[numberActive] = n; startBit_[numberActive] = kBit; n++; // allow for 0,1... n int iBit = 0; // power of 2 int k = n; k &= ~1; while (k) { iBit++; k &= ~(1 << iBit); } // See if exact power if (n != (1 << iBit)) { // round up to next power of 2 iBit++; } if (numberActive != 1) { n = 1 << iBit; size *= n; if (size >= check) break; } else { size = n; // just one constraint } numberBits_[numberActive++] = iBit; kBit += iBit; } else { lookup_[i] = -1; } } const double * rowLower = solver->getRowLower(); if (algorithm_ == 0) { // rhs 1 and coefficients 1 // Get first possible solution for printing target_ = -1; int needed = 0; int numberActive = 0; for (i = 0; i < numberRows; i++) { int newRow = lookup_[i]; if (newRow >= 0) { if (rowLower[i] == rowUpper[i]) { needed += 1 << numberActive; numberActive++; } } } for (i = 0; i < size_; i++) { if ((i&needed) == needed) { break; } } target_ = i; } else { coefficients_ = new int[numberActive_]; // If not too many general rhs then we can be more efficient numberNonOne_ = 0; for (i = 0; i < numberActive_; i++) { if (rhs_[i] != 1) numberNonOne_++; } if (numberNonOne_*2 < numberActive_) { // put rhs >1 every second int * permute = new int[numberActive_]; int * temp = new int[numberActive_]; // try different ways int k = 0; for (i = 0; i < numberRows; i++) { int newRow = lookup_[i]; if (newRow >= 0 && rhs_[newRow] > 1) { permute[newRow] = k; k += 2; } } // adjust so k points to last k -= 2; // and now rest int k1 = 1; for (i = 0; i < numberRows; i++) { int newRow = lookup_[i]; if (newRow >= 0 && rhs_[newRow] == 1) { permute[newRow] = k1; k1++; if (k1 <= k) k1++; } } for (i = 0; i < numberActive_; i++) { int put = permute[i]; temp[put] = rhs_[i]; } memcpy(rhs_, temp, numberActive_*sizeof(int)); for (i = 0; i < numberActive_; i++) { int put = permute[i]; temp[put] = numberBits_[i]; } memcpy(numberBits_, temp, numberActive_*sizeof(int)); k = 0; for (i = 0; i < numberActive_; i++) { startBit_[i] = k; k += numberBits_[i]; } for (i = 0; i < numberRows; i++) { int newRow = lookup_[i]; if (newRow >= 0) lookup_[i] = permute[newRow]; } delete [] permute; delete [] temp; // mark new method algorithm_ = 2; } // Get first possible solution for printing target_ = -1; int needed = 0; int * lower2 = new int[numberActive_]; for (i = 0; i < numberRows; i++) { int newRow = lookup_[i]; if (newRow >= 0) { int gap = static_cast (rowUpper[i] - CoinMax(0.0, rowLower[i])); lower2[newRow] = rhs_[newRow] - gap; int numberBits = numberBits_[newRow]; int startBit = startBit_[newRow]; if (numberBits == 1 && !gap) { needed |= 1 << startBit; } } } for (i = 0; i < size_; i++) { if ((i&needed) == needed) { // this one may do bool good = true; for (int kk = 0; kk < numberActive_; kk++) { int numberBits = numberBits_[kk]; int startBit = startBit_[kk]; int size = 1 << numberBits; int start = 1 << startBit; int mask = start * (size - 1); int level = (i & mask) >> startBit; if (level < lower2[kk]) { good = false; break; } } if (good) { break; } } } delete [] lower2; target_ = i; } } delete [] rhs; if (allowableSize && size_ > allowableSize) { COIN_DETAIL_PRINT(printf("Too large - need %d entries x 8 bytes\n", size_)); return -1; // too big } else { return algorithm_; } } // Resets stuff if model changes void CbcFathomDynamicProgramming::resetModel(CbcModel * model) { model_ = model; type_ = checkPossible(); } int CbcFathomDynamicProgramming::fathom(double * & betterSolution) { int returnCode = 0; int type = checkPossible(maximumSizeAllowed_); assert (type != -1); if (type == -2) { // infeasible (so complete search done) return 1; } if (algorithm_ >= 0) { OsiSolverInterface * solver = model_->solver(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * objective = solver->getObjCoefficients(); double direction = solver->getObjSense(); const CoinPackedMatrix * matrix = solver->getMatrixByCol(); // Column copy const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int numberRows = model_->getNumRows(); int numberColumns = solver->getNumCols(); double offset; solver->getDblParam(OsiObjOffset, offset); double fixedObj = -offset; int i; // may be possible double bestAtTarget = COIN_DBL_MAX; for (i = 0; i < numberColumns; i++) { if (size_ > 10000000 && (i % 100) == 0) COIN_DETAIL_PRINT(printf("column %d\n", i)); double lowerValue = lower[i]; assert (lowerValue == floor(lowerValue)); double cost = direction * objective[i]; fixedObj += lowerValue * cost; int gap = static_cast (upper[i] - lowerValue); CoinBigIndex start = columnStart[i]; tryColumn(columnLength[i], row + start, element + start, cost, gap); if (cost_[target_] < bestAtTarget) { if (model_->messageHandler()->logLevel() > 1) printf("At column %d new best objective of %g\n", i, cost_[target_]); bestAtTarget = cost_[target_]; } } returnCode = 1; int needed = 0; double bestValue = COIN_DBL_MAX; int iBest = -1; if (algorithm_ == 0) { int numberActive = 0; for (i = 0; i < numberRows; i++) { int newRow = lookup_[i]; if (newRow >= 0) { if (rowLower[i] == rowUpper[i]) { needed += 1 << numberActive; numberActive++; } } } for (i = 0; i < size_; i++) { if ((i&needed) == needed) { // this one will do if (cost_[i] < bestValue) { bestValue = cost_[i]; iBest = i; } } } } else { int * lower = new int[numberActive_]; for (i = 0; i < numberRows; i++) { int newRow = lookup_[i]; if (newRow >= 0) { int gap = static_cast (rowUpper[i] - CoinMax(0.0, rowLower[i])); lower[newRow] = rhs_[newRow] - gap; int numberBits = numberBits_[newRow]; int startBit = startBit_[newRow]; if (numberBits == 1 && !gap) { needed |= 1 << startBit; } } } for (i = 0; i < size_; i++) { if ((i&needed) == needed) { // this one may do bool good = true; for (int kk = 0; kk < numberActive_; kk++) { int numberBits = numberBits_[kk]; int startBit = startBit_[kk]; int size = 1 << numberBits; int start = 1 << startBit; int mask = start * (size - 1); int level = (i & mask) >> startBit; if (level < lower[kk]) { good = false; break; } } if (good && cost_[i] < bestValue) { bestValue = cost_[i]; iBest = i; } } } delete [] lower; } if (bestValue < COIN_DBL_MAX) { bestValue += fixedObj; if (model_->messageHandler()->logLevel() > 1) printf("Can get solution of %g\n", bestValue); if (bestValue < model_->getMinimizationObjValue()) { // set up solution betterSolution = new double[numberColumns]; memcpy(betterSolution, lower, numberColumns*sizeof(double)); while (iBest > 0) { int n = decodeBitPattern(iBest - back_[iBest], indices_, numberRows); // Search for cheapest double bestCost = COIN_DBL_MAX; int iColumn = -1; for (i = 0; i < numberColumns; i++) { if (n == columnLength[i]) { bool good = true; for (int j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; double value = element[j]; int iValue = static_cast (value); if (iValue != indices_[iRow]) { good = false; break; } } if (good && objective[i] < bestCost && betterSolution[i] < upper[i]) { bestCost = objective[i]; iColumn = i; } } } assert (iColumn >= 0); betterSolution[iColumn]++; assert (betterSolution[iColumn] <= upper[iColumn]); iBest = back_[iBest]; } } // paranoid check double * rowActivity = new double [numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); for (i = 0; i < numberColumns; i++) { int j; double value = betterSolution[i]; if (value) { for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } // check was feasible bool feasible = true; for (i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i]) { if (rowActivity[i] < rowLower[i] - 1.0e-8) feasible = false; } else if (rowActivity[i] > rowUpper[i]) { if (rowActivity[i] > rowUpper[i] + 1.0e-8) feasible = false; } } if (feasible) { if (model_->messageHandler()->logLevel() > 0) printf("** good solution of %g by dynamic programming\n", bestValue); } delete [] rowActivity; } gutsOfDelete(); } return returnCode; } /* Tries a column returns true if was used in making any changes. */ bool CbcFathomDynamicProgramming::tryColumn(int numberElements, const int * rows, const double * coefficients, double cost, int upper) { bool touched = false; int n = 0; if (algorithm_ == 0) { for (int j = 0; j < numberElements; j++) { int iRow = rows[j]; double value = coefficients[j]; int newRow = lookup_[iRow]; if (newRow < 0 || value > rhs_[newRow]) { n = 0; break; //can't use } else { indices_[n++] = newRow; } } if (n && upper) { touched = addOneColumn0(n, indices_, cost); } } else { for (int j = 0; j < numberElements; j++) { int iRow = rows[j]; double value = coefficients[j]; int iValue = static_cast (value); int newRow = lookup_[iRow]; if (newRow < 0 || iValue > rhs_[newRow]) { n = 0; break; //can't use } else { coefficients_[n] = iValue; indices_[n++] = newRow; if (upper*iValue > rhs_[newRow]) { upper = rhs_[newRow] / iValue; } } } if (n) { if (algorithm_ == 1) { for (int k = 1; k <= upper; k++) { bool t = addOneColumn1(n, indices_, coefficients_, cost); if (t) touched = true; } } else { CoinSort_2(indices_, indices_ + n, coefficients_); for (int k = 1; k <= upper; k++) { bool t = addOneColumn1A(n, indices_, coefficients_, cost); if (t) touched = true; } } } } return touched; } /* Adds one column if type 0, returns true if was used in making any changes */ bool CbcFathomDynamicProgramming::addOneColumn0(int numberElements, const int * rows, double cost) { // build up mask int mask = 0; int i; for (i = 0; i < numberElements; i++) { int iRow = rows[i]; mask |= 1 << iRow; } bitPattern_ = mask; i = size_ - 1 - mask; bool touched = false; while (i >= 0) { int kMask = i & mask; if (kMask == 0) { double thisCost = cost_[i]; if (thisCost != COIN_DBL_MAX) { // possible double newCost = thisCost + cost; int next = i + mask; if (cost_[next] > newCost) { cost_[next] = newCost; back_[next] = i; touched = true; } } i--; } else { // we can skip some int k = (i&~mask); #ifdef CBC_DEBUG for (int j = i - 1; j > k; j--) { int jMask = j & mask; assert (jMask != 0); } #endif i = k; } } return touched; } /* Adds one attempt of one column of type 1, returns true if was used in making any changes. At present the user has to call it once for each possible value */ bool CbcFathomDynamicProgramming::addOneColumn1(int numberElements, const int * rows, const int * coefficients, double cost) { /* build up masks. a) mask for 1 rhs b) mask for addition c) mask so adding will overflow d) individual masks */ int mask1 = 0; int maskAdd = 0; int mask2 = 0; int i; int n2 = 0; int mask[40]; int adjust[40]; assert (numberElements <= 40); for (i = 0; i < numberElements; i++) { int iRow = rows[i]; int numberBits = numberBits_[iRow]; int startBit = startBit_[iRow]; if (numberBits == 1) { mask1 |= 1 << startBit; maskAdd |= 1 << startBit; mask2 |= 1 << startBit; } else { int value = coefficients[i]; int size = 1 << numberBits; int start = 1 << startBit; assert (value < size); maskAdd |= start * value; int gap = size - rhs_[iRow] - 1; assert (gap >= 0); int hi2 = rhs_[iRow] - value; if (hi2 < size - 1) hi2++; adjust[n2] = start * hi2; mask2 += start * gap; mask[n2++] = start * (size - 1); } } bitPattern_ = maskAdd; i = size_ - 1 - maskAdd; bool touched = false; while (i >= 0) { int kMask = i & mask1; if (kMask == 0) { bool good = true; for (int kk = n2 - 1; kk >= 0; kk--) { int iMask = mask[kk]; int jMask = iMask & mask2; int kkMask = iMask & i; kkMask += jMask; if (kkMask > iMask) { // we can skip some int k = (i&~iMask); k |= adjust[kk]; #ifdef CBC_DEBUG for (int j = i - 1; j > k; j--) { int jMask = j & mask1; if (jMask == 0) { bool good = true; for (int kk = n2 - 1; kk >= 0; kk--) { int iMask = mask[kk]; int jMask = iMask & mask2; int kkMask = iMask & i; kkMask += jMask; if (kkMask > iMask) { good = false; break; } } assert (!good); } } #endif i = k; good = false; break; } } if (good) { double thisCost = cost_[i]; if (thisCost != COIN_DBL_MAX) { // possible double newCost = thisCost + cost; int next = i + maskAdd; if (cost_[next] > newCost) { cost_[next] = newCost; back_[next] = i; touched = true; } } } i--; } else { // we can skip some // we can skip some int k = (i&~mask1); #ifdef CBC_DEBUG for (int j = i - 1; j > k; j--) { int jMask = j & mask1; assert (jMask != 0); } #endif i = k; } } return touched; } /* Adds one attempt of one column of type 1, returns true if was used in making any changes. At present the user has to call it once for each possible value This version is when there are enough 1 rhs to do faster */ bool CbcFathomDynamicProgramming::addOneColumn1A(int numberElements, const int * rows, const int * coefficients, double cost) { /* build up masks. a) mask for 1 rhs b) mask for addition c) mask so adding will overflow d) mask for non 1 rhs */ int maskA = 0; int maskAdd = 0; int maskC = 0; int maskD = 0; int i; for (i = 0; i < numberElements; i++) { int iRow = rows[i]; int numberBits = numberBits_[iRow]; int startBit = startBit_[iRow]; if (numberBits == 1) { maskA |= 1 << startBit; maskAdd |= 1 << startBit; } else { int value = coefficients[i]; int size = 1 << numberBits; int start = 1 << startBit; assert (value < size); maskAdd |= start * value; int gap = size - rhs_[iRow] + value - 1; assert (gap > 0 && gap <= size - 1); maskC |= start * gap; maskD |= start * (size - 1); } } bitPattern_ = maskAdd; int maskDiff = maskD - maskC; i = size_ - 1 - maskAdd; bool touched = false; if (!maskD) { // Just ones while (i >= 0) { int kMask = i & maskA; if (kMask == 0) { double thisCost = cost_[i]; if (thisCost != COIN_DBL_MAX) { // possible double newCost = thisCost + cost; int next = i + maskAdd; if (cost_[next] > newCost) { cost_[next] = newCost; back_[next] = i; touched = true; } } i--; } else { // we can skip some int k = (i&~maskA); i = k; } } } else { // More general while (i >= 0) { int kMask = i & maskA; if (kMask == 0) { int added = i & maskD; // just bits belonging to non 1 rhs added += maskC; // will overflow mask if bad added &= (~maskD); if (added == 0) { double thisCost = cost_[i]; if (thisCost != COIN_DBL_MAX) { // possible double newCost = thisCost + cost; int next = i + maskAdd; if (cost_[next] > newCost) { cost_[next] = newCost; back_[next] = i; touched = true; } } i--; } else { // we can skip some int k = i & ~ maskD; // clear all // Put back enough - but only below where we are int kk = (numberNonOne_ << 1) - 2; assert (rhs_[kk] > 1); int iMask = 0; for (; kk >= 0; kk -= 2) { iMask = 1 << startBit_[kk+1]; if ((added&iMask) != 0) { iMask--; break; } } assert (kk >= 0); iMask &= maskDiff; k |= iMask; assert (k < i); i = k; } } else { // we can skip some int k = (i&~maskA); i = k; } } } return touched; } // update model void CbcFathomDynamicProgramming::setModel(CbcModel * model) { model_ = model; type_ = checkPossible(); } // Gets bit pattern from original column int CbcFathomDynamicProgramming::bitPattern(int numberElements, const int * rows, const int * coefficients) { int i; int mask = 0; switch (algorithm_) { // just ones case 0: for (i = 0; i < numberElements; i++) { int iRow = rows[i]; iRow = lookup_[iRow]; if (iRow >= 0) mask |= 1 << iRow; } break; // case 1: case 2: for (i = 0; i < numberElements; i++) { int iRow = rows[i]; iRow = lookup_[iRow]; if (iRow >= 0) { int startBit = startBit_[iRow]; int value = coefficients[i]; int start = 1 << startBit; mask |= start * value; } } break; } return mask; } // Fills in original column (dense) from bit pattern int CbcFathomDynamicProgramming::decodeBitPattern(int bitPattern, int * values, int numberRows) { int i; int n = 0; switch (algorithm_) { // just ones case 0: for (i = 0; i < numberRows; i++) { values[i] = 0; int iRow = lookup_[i]; if (iRow >= 0) { if ((bitPattern&(1 << iRow)) != 0) { values[i] = 1; n++; } } } break; // case 1: case 2: for (i = 0; i < numberRows; i++) { values[i] = 0; int iRow = lookup_[i]; if (iRow >= 0) { int startBit = startBit_[iRow]; int numberBits = numberBits_[iRow]; int iValue = bitPattern >> startBit; iValue &= ((1 << numberBits) - 1); if (iValue) { values[i] = iValue; n++; } } } break; } return n; } CoinMP-1.8.3/Cbc/src/Makefile.am0000644000175000017500000002333112547035070014633 0ustar renerene# Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 2206 2015-07-07 20:44:40Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCbc # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in the 'lib' directory lib_LTLIBRARIES = libCbc.la libCbcSolver.la # List all source files for this library, including headers libCbc_la_SOURCES = \ CbcConfig.h \ CbcBranchActual.hpp \ CbcBranchAllDifferent.cpp CbcBranchAllDifferent.hpp \ CbcBranchBase.hpp \ CbcBranchCut.cpp CbcBranchCut.hpp \ CbcBranchDecision.cpp CbcBranchDecision.hpp \ CbcBranchDefaultDecision.cpp CbcBranchDefaultDecision.hpp \ CbcBranchDynamic.cpp CbcBranchDynamic.hpp \ CbcBranchingObject.cpp CbcBranchingObject.hpp \ CbcBranchLotsize.cpp CbcBranchLotsize.hpp \ CbcBranchToFixLots.cpp CbcBranchToFixLots.hpp \ CbcCompareActual.hpp \ CbcCompareBase.hpp \ CbcCompareDefault.cpp CbcCompareDefault.hpp \ CbcCompareDepth.cpp CbcCompareDepth.hpp \ CbcCompareEstimate.cpp CbcCompareEstimate.hpp \ CbcCompareObjective.cpp CbcCompareObjective.hpp \ CbcConsequence.cpp CbcConsequence.hpp \ CbcClique.cpp CbcClique.hpp \ CbcCompare.hpp \ CbcCountRowCut.cpp CbcCountRowCut.hpp \ CbcCutGenerator.cpp CbcCutGenerator.hpp \ CbcCutModifier.cpp CbcCutModifier.hpp \ CbcCutSubsetModifier.cpp CbcCutSubsetModifier.hpp \ CbcDummyBranchingObject.cpp CbcDummyBranchingObject.hpp \ CbcEventHandler.cpp CbcEventHandler.hpp \ CbcFathom.cpp CbcFathom.hpp \ CbcFathomDynamicProgramming.cpp CbcFathomDynamicProgramming.hpp \ CbcFeasibilityBase.hpp \ CbcFixVariable.cpp CbcFixVariable.hpp \ CbcFullNodeInfo.cpp CbcFullNodeInfo.hpp \ CbcFollowOn.cpp CbcFollowOn.hpp \ CbcGeneral.cpp CbcGeneral.hpp \ CbcGeneralDepth.cpp CbcGeneralDepth.hpp \ CbcHeuristic.cpp CbcHeuristic.hpp \ CbcHeuristicDINS.cpp CbcHeuristicDINS.hpp \ CbcHeuristicDive.cpp CbcHeuristicDive.hpp \ CbcHeuristicDiveCoefficient.cpp CbcHeuristicDiveCoefficient.hpp \ CbcHeuristicDiveFractional.cpp CbcHeuristicDiveFractional.hpp \ CbcHeuristicDiveGuided.cpp CbcHeuristicDiveGuided.hpp \ CbcHeuristicDiveLineSearch.cpp CbcHeuristicDiveLineSearch.hpp \ CbcHeuristicDivePseudoCost.cpp CbcHeuristicDivePseudoCost.hpp \ CbcHeuristicDiveVectorLength.cpp CbcHeuristicDiveLength.hpp \ CbcHeuristicFPump.cpp CbcHeuristicFPump.hpp \ CbcHeuristicGreedy.cpp CbcHeuristicGreedy.hpp \ CbcHeuristicLocal.cpp CbcHeuristicLocal.hpp \ CbcHeuristicPivotAndFix.cpp CbcHeuristicPivotAndFix.hpp \ CbcHeuristicRandRound.cpp CbcHeuristicRandRound.hpp \ CbcHeuristicRENS.cpp CbcHeuristicRENS.hpp \ CbcHeuristicRINS.cpp CbcHeuristicRINS.hpp \ CbcHeuristicVND.cpp CbcHeuristicVND.hpp \ CbcHeuristicDW.cpp CbcHeuristicDW.hpp \ CbcMessage.cpp CbcMessage.hpp \ CbcModel.cpp CbcModel.hpp \ CbcNode.cpp CbcNode.hpp \ CbcNodeInfo.cpp CbcNodeInfo.hpp \ CbcNWay.cpp CbcNWay.hpp \ CbcObject.cpp CbcObject.hpp \ CbcObjectUpdateData.cpp CbcObjectUpdateData.hpp \ CbcPartialNodeInfo.cpp CbcPartialNodeInfo.hpp \ CbcSimpleInteger.cpp CbcSimpleInteger.hpp \ CbcSimpleIntegerDynamicPseudoCost.cpp \ CbcSimpleIntegerDynamicPseudoCost.hpp \ CbcSimpleIntegerPseudoCost.cpp \ CbcSimpleIntegerPseudoCost.hpp \ CbcSOS.cpp CbcSOS.hpp \ CbcStatistics.cpp CbcStatistics.hpp \ CbcStrategy.cpp CbcStrategy.hpp \ CbcSubProblem.cpp CbcSubProblem.hpp \ CbcSymmetry.cpp CbcSymmetry.hpp \ CbcThread.cpp CbcThread.hpp \ CbcTree.cpp CbcTree.hpp \ CbcTreeLocal.cpp CbcTreeLocal.hpp libCbcSolver_la_SOURCES = \ Cbc_C_Interface.cpp Cbc_C_Interface.h \ CbcCbcParam.cpp \ Cbc_ampl.cpp Cbc_ampl.h \ CbcLinked.cpp CbcLinked.hpp CbcLinkedUtils.cpp \ unitTestClp.cpp CbcSolver.cpp \ CbcSolverHeuristics.cpp CbcSolverHeuristics.hpp \ CbcSolverAnalyze.cpp CbcSolverAnalyze.hpp \ CbcMipStartIO.cpp CbcMipStartIO.hpp \ CbcSolverExpandKnapsack.cpp CbcSolverExpandKnapsack.hpp # List all additionally required libraries if DEPENDENCY_LINKING libCbc_la_LIBADD = $(CBCLIB_LIBS) libCbcSolver_la_LIBADD = $(CBCLIB_LIBS) libCbc.la endif # This is for libtool libCbc_la_LDFLAGS = $(LT_LDFLAGS) libCbcSolver_la_LDFLAGS = $(LT_LDFLAGS) # Some common setup for cbc and cbc-generic. bin_PROGRAMS = AM_CPPFLAGS = $(COINDEPEND_CFLAGS) $(CLP_CFLAGS) $(CPX_CFLAGS) $(ASL_CFLAGS) if COIN_HAS_NTY AM_CPPFLAGS += -I$(NTYINCDIR) endif ######################################################################## # cbc program # ######################################################################## if COIN_HAS_CLP # Name of the executable compiled in this directory. We want it to be # installed in the 'bin' directory bin_PROGRAMS += cbc # List all source files for this executable, including headers cbc_SOURCES = CoinSolve.cpp # Additional libraries cbc_LDADD = libCbcSolver.la libCbc.la $(CBCLIB_LIBS) $(ASL_LIBS) cbc_DEPENDENCIES = libCbcSolver.la libCbc.la $(CBCLIB_DEPENDENCIES) $(ASL_DEPENDENCIES) endif ######################################################################## # cbc-generic program # ######################################################################## if CBC_BUILD_CBC_GENERIC # Name of the executable compiled in this directory. We want it to be # installed in the 'bin' directory bin_PROGRAMS += cbc-generic # List all source files for this executable, including headers cbc_generic_SOURCES = \ CbcGenBaB.cpp \ CbcGenCbcParam.cpp CbcGenCbcParam.hpp CbcGenCbcParamUtils.cpp \ CbcGenCtlBlk.cpp CbcGenCtlBlk.hpp \ CbcGeneric.cpp \ CbcGenMessages.cpp CbcGenMessages.hpp \ CbcGenOsiParam.cpp CbcGenOsiParam.hpp CbcGenOsiParamUtils.cpp \ CbcGenParam.cpp CbcGenParam.hpp CbcGenParamUtils.cpp \ CbcGenSolution.cpp \ CbcGenSolvers.cpp cbc_generic_LDADD = libCbcSolver.la libCbc.la $(CBCGENERIC_LIBS) cbc_generic_DEPENDENCIES = libCbcSolver.la libCbc.la $(CBCGENERIC_DEPENDENCIES) # List all additionally required solver and Osi libraries # the linker flags for all available LP solvers should already be included in $CBCGENERIC_LIBS, # so just add compiler flags here (all we can think of) AM_CPPFLAGS += $(DYLP_CFLAGS) $(GLPK_CFLAGS) $(MSK_CFLAGS) $(SPX_CFLAGS) $(VOL_CFLAGS) $(XPR_CFLAGS) endif ######################################################################## # Additional flags # ######################################################################## # List additional defines AM_CPPFLAGS += -DCOIN_NO_CLP_MESSAGE -DUSE_CBCCONFIG # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ Cbc_C_Interface.h \ CbcBranchActual.hpp \ CbcBranchAllDifferent.hpp \ CbcBranchBase.hpp \ CbcBranchDynamic.hpp \ CbcBranchCut.hpp \ CbcBranchDecision.hpp \ CbcBranchDefaultDecision.hpp \ CbcBranchingObject.hpp \ CbcBranchLotsize.hpp \ CbcBranchToFixLots.hpp \ CbcCompareActual.hpp \ CbcCompareBase.hpp \ CbcCompareDefault.hpp \ CbcCompareDepth.hpp \ CbcCompareEstimate.hpp \ CbcCompareObjective.hpp \ CbcConsequence.hpp \ CbcClique.hpp \ CbcCompare.hpp \ CbcCountRowCut.hpp \ CbcCutGenerator.hpp \ CbcCutModifier.hpp \ CbcCutSubsetModifier.hpp \ CbcDummyBranchingObject.hpp \ CbcFathom.hpp \ CbcEventHandler.hpp \ CbcFathomDynamicProgramming.hpp \ CbcFeasibilityBase.hpp \ CbcFixVariable.hpp \ CbcFollowOn.hpp \ CbcFullNodeInfo.hpp \ CbcGeneral.hpp \ CbcGeneralDepth.hpp \ CbcHeuristic.hpp \ CbcHeuristicDINS.hpp \ CbcHeuristicDive.hpp \ CbcHeuristicDiveCoefficient.hpp \ CbcHeuristicDiveFractional.hpp \ CbcHeuristicDiveGuided.hpp \ CbcHeuristicDiveLineSearch.hpp \ CbcHeuristicDivePseudoCost.hpp \ CbcHeuristicDiveVectorLength.hpp \ CbcHeuristicFPump.hpp \ CbcHeuristicGreedy.hpp \ CbcHeuristicLocal.hpp \ CbcHeuristicPivotAndFix.hpp \ CbcHeuristicRandRound.hpp \ CbcHeuristicRENS.hpp \ CbcHeuristicRINS.hpp \ CbcHeuristicVND.hpp \ CbcHeuristicDW.hpp \ CbcMessage.hpp \ CbcModel.hpp \ CbcNode.hpp \ CbcNodeInfo.hpp \ CbcNWay.hpp \ CbcObject.hpp \ CbcObjectUpdateData.hpp \ CbcParam.hpp \ CbcPartialNodeInfo.hpp \ CbcSimpleInteger.hpp \ CbcSimpleIntegerDynamicPseudoCost.hpp \ CbcSimpleIntegerPseudoCost.hpp \ CbcStrategy.hpp \ CbcSolver.hpp \ CbcMipStartIO.hpp \ CbcSOS.hpp \ CbcSubProblem.hpp \ CbcTree.hpp \ CbcLinked.hpp \ CbcTreeLocal.hpp \ ClpConstraintAmpl.hpp \ ClpAmplObjective.hpp ######################################################################## # Installing manifest (MSVC++) # ######################################################################## if COIN_CXX_IS_CL install-exec-hook: test -s cbc.exe.manifest && \ mt -manifest cbc.exe.manifest -outputresource:cbc.exe;\ cp cbc.exe $(bindir)/cbc.exe endif ####################################################################### # Create the Config.h file that has all public defines and install it # ####################################################################### install-exec-local: $(install_sh_DATA) config_cbc.h $(DESTDIR)$(includecoindir)/CbcConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/CbcConfig.h CoinMP-1.8.3/Cbc/src/CbcPartialNodeInfo.hpp0000644000175000017500000000643712131054770016743 0ustar renerene// $Id: CbcPartialNodeInfo.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/24/09 carved from CbcNode #ifndef CbcPartialNodeInfo_H #define CbcPartialNodeInfo_H #include #include #include "CoinWarmStartBasis.hpp" #include "CoinSearchTree.hpp" #include "CbcBranchBase.hpp" #include "CbcNodeInfo.hpp" class OsiSolverInterface; class OsiSolverBranch; class OsiCuts; class OsiRowCut; class OsiRowCutDebugger; class CoinWarmStartBasis; class CbcCountRowCut; class CbcModel; class CbcNode; class CbcSubProblem; class CbcGeneralBranchingObject; /** \brief Holds information for recreating a subproblem by incremental change from the parent. A CbcPartialNodeInfo object contains changes to the bounds and basis, and additional cuts, required to recreate a subproblem by modifying and augmenting the parent subproblem. */ class CbcPartialNodeInfo : public CbcNodeInfo { public: /** \brief Modify model according to information at node The routine modifies the model according to bound and basis change information at node and adds any cuts to the addCuts array. */ virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis, CbcCountRowCut **addCuts, int ¤tNumberCuts) const ; /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible) virtual int applyBounds(int iColumn, double & lower, double & upper, int force) ; /** Builds up row basis backwards (until original model). Returns NULL or previous one to apply . Depends on Free being 0 and impossible for cuts */ virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis ) const ; // Default Constructor CbcPartialNodeInfo (); // Constructor from current state CbcPartialNodeInfo (CbcNodeInfo * parent, CbcNode * owner, int numberChangedBounds, const int * variables, const double * boundChanges, const CoinWarmStartDiff *basisDiff) ; // Copy constructor CbcPartialNodeInfo ( const CbcPartialNodeInfo &); // Destructor ~CbcPartialNodeInfo (); /// Clone virtual CbcNodeInfo * clone() const; /// Basis diff information inline const CoinWarmStartDiff *basisDiff() const { return basisDiff_ ; } /// Which variable (top bit if upper bound changing) inline const int * variables() const { return variables_; } // New bound inline const double * newBounds() const { return newBounds_; } /// Number of bound changes inline int numberChangedBounds() const { return numberChangedBounds_; } protected: /* Data values */ /// Basis diff information CoinWarmStartDiff *basisDiff_ ; /// Which variable (top bit if upper bound changing) int * variables_; // New bound double * newBounds_; /// Number of bound changes int numberChangedBounds_; private: /// Illegal Assignment operator CbcPartialNodeInfo & operator=(const CbcPartialNodeInfo& rhs); }; #endif //CbcPartialNodeInfo_H CoinMP-1.8.3/Cbc/src/CbcClique.cpp0000644000175000017500000007344412432625130015142 0ustar renerene// $Id: CbcClique.cpp 2094 2014-11-18 11:15:36Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/9/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcClique.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## // Default Constructor CbcClique::CbcClique () : CbcObject(), numberMembers_(0), numberNonSOSMembers_(0), members_(NULL), type_(NULL), cliqueType_(-1), slack_(-1) { } // Useful constructor (which are integer indices) CbcClique::CbcClique (CbcModel * model, int cliqueType, int numberMembers, const int * which, const char * type, int identifier, int slack) : CbcObject(model) { numberMembers_ = numberMembers; int * backward = NULL; if (identifier<0) { // which are variables in model - not in integers identifier=-identifier; int numberColumns = model->getNumCols(); int numberIntegers = model->numberIntegers(); const int * integerVariable = model->integerVariable(); backward = new int [numberColumns]; for (int i=0;i=0); members_[i]=iColumn; #ifdef FULL_PRINT printf("%d column %d member %d\n",i,which[i],iColumn); #endif } } type_ = new char[numberMembers_]; if (type) { memcpy(type_, type, numberMembers_*sizeof(char)); } else { for (int i = 0; i < numberMembers_; i++) type_[i] = 1; } } else { members_ = NULL; type_ = NULL; } // Find out how many non sos int i; numberNonSOSMembers_ = 0; for (i = 0; i < numberMembers_; i++) if (!type_[i]) numberNonSOSMembers_++; cliqueType_ = cliqueType; slack_ = slack; delete [] backward; id_ = identifier; } // Copy constructor CbcClique::CbcClique ( const CbcClique & rhs) : CbcObject(rhs) { numberMembers_ = rhs.numberMembers_; numberNonSOSMembers_ = rhs.numberNonSOSMembers_; if (numberMembers_) { members_ = new int[numberMembers_]; memcpy(members_, rhs.members_, numberMembers_*sizeof(int)); type_ = new char[numberMembers_]; memcpy(type_, rhs.type_, numberMembers_*sizeof(char)); } else { members_ = NULL; type_ = NULL; } cliqueType_ = rhs.cliqueType_; slack_ = rhs.slack_; } // Clone CbcObject * CbcClique::clone() const { return new CbcClique(*this); } // Assignment operator CbcClique & CbcClique::operator=( const CbcClique & rhs) { if (this != &rhs) { CbcObject::operator=(rhs); delete [] members_; delete [] type_; numberMembers_ = rhs.numberMembers_; numberNonSOSMembers_ = rhs.numberNonSOSMembers_; if (numberMembers_) { members_ = new int[numberMembers_]; memcpy(members_, rhs.members_, numberMembers_*sizeof(int)); type_ = new char[numberMembers_]; memcpy(type_, rhs.type_, numberMembers_*sizeof(char)); } else { members_ = NULL; type_ = NULL; } cliqueType_ = rhs.cliqueType_; slack_ = rhs.slack_; } return *this; } // Destructor CbcClique::~CbcClique () { delete [] members_; delete [] type_; } /* Unfortunately, that comment is untrue. And there are other issues. This routine is clearly an unfinished work. */ double CbcClique::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { int numberUnsatis = 0, numberFree = 0; int j; const int * integer = model_->integerVariable(); OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double largestValue = 0.0; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double * sort = new double[numberMembers_]; /* Calculate integer infeasibility and fill an array. Pick off the infeasibility of the slack and the max infeasibility while we're at it. You can see here the conversion of `non-SOS' (strong value of 0, negative coefficient) to `SOS' (strong value of 1, positive coefficient). Also count the number of variables that have integral values but are not fixed. */ double slackValue = 0.0; for (j = 0; j < numberMembers_; j++) { int sequence = members_[j]; int iColumn = integer[sequence]; double value = solution[iColumn]; value = CoinMax(value, lower[iColumn]); value = CoinMin(value, upper[iColumn]); double nearest = floor(value + 0.5); double distance = fabs(value - nearest); if (distance > integerTolerance) { if (!type_[j]) value = 1.0 - value; // non SOS // if slack then choose that if (j == slack_ && value > 0.05) slackValue = value; largestValue = CoinMax(value, largestValue); sort[numberUnsatis++] = -value; } else if (upper[iColumn] > lower[iColumn]) { numberFree++; } } /* preferredWay will not change. The calculation of otherWay is an expensive noop --- value is ultimately unused. Same for the sort of sort. It looks like there was some notion of branching by splitting the set using even and odd indices (as opposed to first and second half). */ preferredWay = 1; double otherWay = 0.0; if (numberUnsatis) { // sort std::sort(sort, sort + numberUnsatis); for (j = 0; j < numberUnsatis; j++) { if ((j&1) != 0) otherWay += -sort[j]; } // Need to think more /* Here we have the actual infeasibility calculation. Most previous work is discarded, and we calculate a value using various counts, adjusted by the max value and slack value. This is not scaled to [0, .5]. */ double value = 0.2 * numberUnsatis + 0.01 * (numberMembers_ - numberFree); if (fabs(largestValue - 0.5) < 0.1) { // close to half value += 0.1; } if (slackValue) { // branching on slack value += slackValue; } // scale other way otherWay *= value / (1.0 - otherWay); delete [] sort; return value; } else { delete [] sort; return 0.0; // satisfied } } // This looks at solution and sets bounds to contain solution void CbcClique::feasibleRegion() { int j; const int * integer = model_->integerVariable(); OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); #ifndef NDEBUG double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); #endif for (j = 0; j < numberMembers_; j++) { int sequence = members_[j]; int iColumn = integer[sequence]; double value = solution[iColumn]; value = CoinMax(value, lower[iColumn]); value = CoinMin(value, upper[iColumn]); double nearest = floor(value + 0.5); #ifndef NDEBUG double distance = fabs(value - nearest); assert(distance <= integerTolerance); #endif solver->setColLower(iColumn, nearest); solver->setColUpper(iColumn, nearest); } } // Redoes data when sequence numbers change void CbcClique::redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns) { model_ = model; int n2 = 0; for (int j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; int i; for (i = 0; i < numberColumns; i++) { if (originalColumns[i] == iColumn) break; } if (i < numberColumns) { members_[n2] = i; type_[n2++] = type_[j]; } } if (n2 < numberMembers_) { //printf("** SOS number of members reduced from %d to %d!\n",numberMembers_,n2); numberMembers_ = n2; } // Find out how many non sos int i; numberNonSOSMembers_ = 0; for (i = 0; i < numberMembers_; i++) if (!type_[i]) numberNonSOSMembers_++; } CbcBranchingObject * CbcClique::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * /*info*/, int way) { int numberUnsatis = 0; int j; int nUp = 0; int nDown = 0; int numberFree = numberMembers_; const int * integer = model_->integerVariable(); //OsiSolverInterface * solver = model_->solver(); CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); int * upList = new int[numberMembers_]; int * downList = new int[numberMembers_]; double * sort = new double[numberMembers_]; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double slackValue = 0.0; for (j = 0; j < numberMembers_; j++) { int sequence = members_[j]; int iColumn = integer[sequence]; double value = solution[iColumn]; value = CoinMax(value, lower[iColumn]); value = CoinMin(value, upper[iColumn]); double nearest = floor(value + 0.5); double distance = fabs(value - nearest); if (distance > integerTolerance) { if (!type_[j]) value = 1.0 - value; // non SOS // if slack then choose that if (j == slack_ && value > 0.05) slackValue = value; value = -value; // for sort upList[numberUnsatis] = j; sort[numberUnsatis++] = value; } else if (upper[iColumn] > lower[iColumn]) { upList[--numberFree] = j; sort[numberFree] = 0.0; if (basis && basis->getStructStatus(iColumn) == CoinWarmStartBasis::basic) sort[numberFree] = -1.0; } } assert (numberUnsatis); if (!slackValue) { // sort CoinSort_2(sort, sort + numberUnsatis, upList); // also try and spread out satisfied basic CoinSort_2(sort+numberFree, sort + numberMembers_, upList+numberFree); // put first in up etc int kWay = 1; for (j = 0; j < numberUnsatis; j++) { if (kWay > 0) upList[nUp++] = upList[j]; else downList[nDown++] = upList[j]; kWay = -kWay; } for (j = numberFree; j < numberMembers_; j++) { if (kWay > 0) upList[nUp++] = upList[j]; else downList[nDown++] = upList[j]; kWay = -kWay; } } else { // put slack to 0 in first way nUp = 1; upList[0] = slack_; for (j = 0; j < numberUnsatis; j++) { downList[nDown++] = upList[j]; } for (j = numberFree; j < numberMembers_; j++) { downList[nDown++] = upList[j]; } } // create object CbcBranchingObject * branch; if (numberMembers_ <= 64) branch = new CbcCliqueBranchingObject(model_, this, way, nDown, downList, nUp, upList); else branch = new CbcLongCliqueBranchingObject(model_, this, way, nDown, downList, nUp, upList); delete [] upList; delete [] downList; delete [] sort; return branch; } // Default Constructor CbcCliqueBranchingObject::CbcCliqueBranchingObject() : CbcBranchingObject() { clique_ = NULL; downMask_[0] = 0; downMask_[1] = 0; upMask_[0] = 0; upMask_[1] = 0; } // Useful constructor CbcCliqueBranchingObject::CbcCliqueBranchingObject (CbcModel * model, const CbcClique * clique, int way , int numberOnDownSide, const int * down, int numberOnUpSide, const int * up) : CbcBranchingObject(model, clique->id(), way, 0.5) { clique_ = clique; downMask_[0] = 0; downMask_[1] = 0; upMask_[0] = 0; upMask_[1] = 0; int i; for (i = 0; i < numberOnDownSide; i++) { int sequence = down[i]; int iWord = sequence >> 5; int iBit = sequence - 32 * iWord; unsigned int k = 1 << iBit; downMask_[iWord] |= k; } for (i = 0; i < numberOnUpSide; i++) { int sequence = up[i]; int iWord = sequence >> 5; int iBit = sequence - 32 * iWord; unsigned int k = 1 << iBit; upMask_[iWord] |= k; } } // Copy constructor CbcCliqueBranchingObject::CbcCliqueBranchingObject ( const CbcCliqueBranchingObject & rhs) : CbcBranchingObject(rhs) { clique_ = rhs.clique_; downMask_[0] = rhs.downMask_[0]; downMask_[1] = rhs.downMask_[1]; upMask_[0] = rhs.upMask_[0]; upMask_[1] = rhs.upMask_[1]; } // Assignment operator CbcCliqueBranchingObject & CbcCliqueBranchingObject::operator=( const CbcCliqueBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); clique_ = rhs.clique_; downMask_[0] = rhs.downMask_[0]; downMask_[1] = rhs.downMask_[1]; upMask_[0] = rhs.upMask_[0]; upMask_[1] = rhs.upMask_[1]; } return *this; } CbcBranchingObject * CbcCliqueBranchingObject::clone() const { return (new CbcCliqueBranchingObject(*this)); } // Destructor CbcCliqueBranchingObject::~CbcCliqueBranchingObject () { } double CbcCliqueBranchingObject::branch() { decrementNumberBranchesLeft(); int iWord; int numberMembers = clique_->numberMembers(); const int * which = clique_->members(); const int * integerVariables = model_->integerVariable(); int numberWords = (numberMembers + 31) >> 5; // *** for way - up means fix all those in down section if (way_ < 0) { #ifdef FULL_PRINT printf("Down Fix "); #endif for (iWord = 0; iWord < numberWords; iWord++) { int i; for (i = 0; i < 32; i++) { unsigned int k = 1 << i; if ((upMask_[iWord]&k) != 0) { int iColumn = which[i+32*iWord]; #ifdef FULL_PRINT printf("%d ", i + 32*iWord); #endif // fix weak way if (clique_->type(i + 32*iWord)) { #ifdef FULL_PRINT printf("member %d int %d matcol %d bound %g %g to 0.0\n", i,iColumn,integerVariables[iColumn], model_->solver()->getColLower()[integerVariables[iColumn]], model_->solver()->getColUpper()[integerVariables[iColumn]]); #endif model_->solver()->setColUpper(integerVariables[iColumn], 0.0); } else { #ifdef FULL_PRINT printf("member %d int %d matcol %d bound %g %g to 1.0\n", i,iColumn,integerVariables[iColumn], model_->solver()->getColLower()[integerVariables[iColumn]], model_->solver()->getColUpper()[integerVariables[iColumn]]); #endif model_->solver()->setColLower(integerVariables[iColumn], 1.0); } } } } way_ = 1; // Swap direction } else { #ifdef FULL_PRINT printf("Up Fix "); #endif for (iWord = 0; iWord < numberWords; iWord++) { int i; for (i = 0; i < 32; i++) { unsigned int k = 1 << i; if ((downMask_[iWord]&k) != 0) { int iColumn = which[i+32*iWord]; #ifdef FULL_PRINT printf("%d ", i + 32*iWord); #endif // fix weak way if (clique_->type(i + 32*iWord)) { #ifdef FULL_PRINT printf("member %d int %d matcol %d bound %g %g to 0.0\n", i,iColumn,integerVariables[iColumn], model_->solver()->getColLower()[integerVariables[iColumn]], model_->solver()->getColUpper()[integerVariables[iColumn]]); #endif model_->solver()->setColUpper(integerVariables[iColumn], 0.0); } else { #ifdef FULL_PRINT printf("member %d int %d matcol %d bound %g %g to 1.0\n", i,iColumn,integerVariables[iColumn], model_->solver()->getColLower()[integerVariables[iColumn]], model_->solver()->getColUpper()[integerVariables[iColumn]]); #endif model_->solver()->setColLower(integerVariables[iColumn], 1.0); } } } } way_ = -1; // Swap direction } #ifdef FULL_PRINT printf("\n"); #endif return 0.0; } // Print what would happen void CbcCliqueBranchingObject::print() { int iWord; int numberMembers = clique_->numberMembers(); const int * which = clique_->members(); const int * integerVariables = model_->integerVariable(); int numberWords = (numberMembers + 31) >> 5; // *** for way - up means fix all those in down section if (way_ < 0) { printf("Clique - Down Fix "); for (iWord = 0; iWord < numberWords; iWord++) { int i; for (i = 0; i < 32; i++) { unsigned int k = 1 << i; if ((upMask_[iWord]&k) != 0) { int iColumn = which[i+32*iWord]; printf("%d ", integerVariables[iColumn]); } } } } else { printf("Clique - Up Fix "); for (iWord = 0; iWord < numberWords; iWord++) { int i; for (i = 0; i < 32; i++) { unsigned int k = 1 << i; if ((downMask_[iWord]&k) != 0) { int iColumn = which[i+32*iWord]; printf("%d ", integerVariables[iColumn]); } } } } printf("\n"); } static inline int CbcCompareCliques(const CbcClique* cl0, const CbcClique* cl1) { if (cl0->cliqueType() < cl1->cliqueType()) { return -1; } if (cl0->cliqueType() > cl1->cliqueType()) { return 1; } if (cl0->numberMembers() != cl1->numberMembers()) { return cl0->numberMembers() - cl1->numberMembers(); } if (cl0->numberNonSOSMembers() != cl1->numberNonSOSMembers()) { return cl0->numberNonSOSMembers() - cl1->numberNonSOSMembers(); } return memcmp(cl0->members(), cl1->members(), cl0->numberMembers() * sizeof(int)); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcCliqueBranchingObject::compareOriginalObject (const CbcBranchingObject* brObj) const { const CbcCliqueBranchingObject* br = dynamic_cast(brObj); assert(br); return CbcCompareCliques(clique_, br->clique_); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcCliqueBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool /*replaceIfOverlap*/) { const CbcCliqueBranchingObject* br = dynamic_cast(brObj); assert(br); unsigned int* thisMask = way_ < 0 ? upMask_ : downMask_; const unsigned int* otherMask = br->way_ < 0 ? br->upMask_ : br->downMask_; const CoinUInt64 cl0 = (static_cast(thisMask[0]) << 32) | thisMask[1]; const CoinUInt64 cl1 = (static_cast(otherMask[0]) << 32) | otherMask[1]; if (cl0 == cl1) { return CbcRangeSame; } const CoinUInt64 cl_intersection = (cl0 & cl1); if (cl_intersection == cl0) { return CbcRangeSuperset; } if (cl_intersection == cl1) { return CbcRangeSubset; } const CoinUInt64 cl_xor = (cl0 ^ cl1); if (cl_intersection == 0 && cl_xor == 0) { return CbcRangeDisjoint; } const CoinUInt64 cl_union = (cl0 | cl1); thisMask[0] = static_cast(cl_union >> 32); thisMask[1] = static_cast(cl_union & 0xffffffff); return CbcRangeOverlap; } //############################################################################## // Default Constructor CbcLongCliqueBranchingObject::CbcLongCliqueBranchingObject() : CbcBranchingObject() { clique_ = NULL; downMask_ = NULL; upMask_ = NULL; } // Useful constructor CbcLongCliqueBranchingObject::CbcLongCliqueBranchingObject (CbcModel * model, const CbcClique * clique, int way , int numberOnDownSide, const int * down, int numberOnUpSide, const int * up) : CbcBranchingObject(model, clique->id(), way, 0.5) { clique_ = clique; int numberMembers = clique_->numberMembers(); int numberWords = (numberMembers + 31) >> 5; downMask_ = new unsigned int [numberWords]; upMask_ = new unsigned int [numberWords]; memset(downMask_, 0, numberWords*sizeof(unsigned int)); memset(upMask_, 0, numberWords*sizeof(unsigned int)); int i; for (i = 0; i < numberOnDownSide; i++) { int sequence = down[i]; int iWord = sequence >> 5; int iBit = sequence - 32 * iWord; unsigned int k = 1 << iBit; downMask_[iWord] |= k; } for (i = 0; i < numberOnUpSide; i++) { int sequence = up[i]; int iWord = sequence >> 5; int iBit = sequence - 32 * iWord; unsigned int k = 1 << iBit; upMask_[iWord] |= k; } } // Copy constructor CbcLongCliqueBranchingObject::CbcLongCliqueBranchingObject ( const CbcLongCliqueBranchingObject & rhs) : CbcBranchingObject(rhs) { clique_ = rhs.clique_; if (rhs.downMask_) { int numberMembers = clique_->numberMembers(); int numberWords = (numberMembers + 31) >> 5; downMask_ = new unsigned int [numberWords]; memcpy(downMask_, rhs.downMask_, numberWords*sizeof(unsigned int)); upMask_ = new unsigned int [numberWords]; memcpy(upMask_, rhs.upMask_, numberWords*sizeof(unsigned int)); } else { downMask_ = NULL; upMask_ = NULL; } } // Assignment operator CbcLongCliqueBranchingObject & CbcLongCliqueBranchingObject::operator=( const CbcLongCliqueBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); clique_ = rhs.clique_; delete [] downMask_; delete [] upMask_; if (rhs.downMask_) { int numberMembers = clique_->numberMembers(); int numberWords = (numberMembers + 31) >> 5; downMask_ = new unsigned int [numberWords]; memcpy(downMask_, rhs.downMask_, numberWords*sizeof(unsigned int)); upMask_ = new unsigned int [numberWords]; memcpy(upMask_, rhs.upMask_, numberWords*sizeof(unsigned int)); } else { downMask_ = NULL; upMask_ = NULL; } } return *this; } CbcBranchingObject * CbcLongCliqueBranchingObject::clone() const { return (new CbcLongCliqueBranchingObject(*this)); } // Destructor CbcLongCliqueBranchingObject::~CbcLongCliqueBranchingObject () { delete [] downMask_; delete [] upMask_; } double CbcLongCliqueBranchingObject::branch() { decrementNumberBranchesLeft(); int iWord; int numberMembers = clique_->numberMembers(); const int * which = clique_->members(); const int * integerVariables = model_->integerVariable(); int numberWords = (numberMembers + 31) >> 5; // *** for way - up means fix all those in down section if (way_ < 0) { #ifdef FULL_PRINT printf("Down Fix "); #endif for (iWord = 0; iWord < numberWords; iWord++) { int i; for (i = 0; i < 32; i++) { unsigned int k = 1 << i; if ((upMask_[iWord]&k) != 0) { int iColumn = which[i+32*iWord]; #ifdef FULL_PRINT printf("%d ", i + 32*iWord); #endif // fix weak way if (clique_->type(i + 32*iWord)) model_->solver()->setColUpper(integerVariables[iColumn], 0.0); else model_->solver()->setColLower(integerVariables[iColumn], 1.0); } } } way_ = 1; // Swap direction } else { #ifdef FULL_PRINT printf("Up Fix "); #endif for (iWord = 0; iWord < numberWords; iWord++) { int i; for (i = 0; i < 32; i++) { unsigned int k = 1 << i; if ((downMask_[iWord]&k) != 0) { int iColumn = which[i+32*iWord]; #ifdef FULL_PRINT printf("%d ", i + 32*iWord); #endif // fix weak way if (clique_->type(i + 32*iWord)) model_->solver()->setColUpper(integerVariables[iColumn], 0.0); else model_->solver()->setColLower(integerVariables[iColumn], 1.0); } } } way_ = -1; // Swap direction } #ifdef FULL_PRINT printf("\n"); #endif return 0.0; } void CbcLongCliqueBranchingObject::print() { int iWord; int numberMembers = clique_->numberMembers(); const int * which = clique_->members(); const int * integerVariables = model_->integerVariable(); int numberWords = (numberMembers + 31) >> 5; // *** for way - up means fix all those in down section if (way_ < 0) { printf("Clique - Down Fix "); for (iWord = 0; iWord < numberWords; iWord++) { int i; for (i = 0; i < 32; i++) { unsigned int k = 1 << i; if ((upMask_[iWord]&k) != 0) { int iColumn = which[i+32*iWord]; printf("%d ", integerVariables[iColumn]); } } } } else { printf("Clique - Up Fix "); for (iWord = 0; iWord < numberWords; iWord++) { int i; for (i = 0; i < 32; i++) { unsigned int k = 1 << i; if ((downMask_[iWord]&k) != 0) { int iColumn = which[i+32*iWord]; printf("%d ", integerVariables[iColumn]); } } } } printf("\n"); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcLongCliqueBranchingObject::compareOriginalObject (const CbcBranchingObject* brObj) const { const CbcLongCliqueBranchingObject* br = dynamic_cast(brObj); assert(br); return CbcCompareCliques(clique_, br->clique_); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcLongCliqueBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool /*replaceIfOverlap*/) { const CbcLongCliqueBranchingObject* br = dynamic_cast(brObj); assert(br); const int numberMembers = clique_->numberMembers(); const int numberWords = (numberMembers + 31) >> 5; unsigned int* thisMask = way_ < 0 ? upMask_ : downMask_; const unsigned int* otherMask = br->way_ < 0 ? br->upMask_ : br->downMask_; if (memcmp(thisMask, otherMask, numberWords * sizeof(unsigned int)) == 0) { return CbcRangeSame; } bool canBeSuperset = true; bool canBeSubset = true; int i; for (i = numberWords - 1; i >= 0 && (canBeSuperset || canBeSubset); --i) { const unsigned int both = (thisMask[i] & otherMask[i]); canBeSuperset &= (both == thisMask[i]); canBeSubset &= (both == otherMask[i]); } if (canBeSuperset) { return CbcRangeSuperset; } if (canBeSubset) { return CbcRangeSubset; } for (i = numberWords - 1; i >= 0; --i) { if ((thisMask[i] ^ otherMask[i]) != 0) { break; } } if (i == -1) { // complement return CbcRangeDisjoint; } // must be overlap for (i = numberWords - 1; i >= 0; --i) { thisMask[i] |= otherMask[i]; } return CbcRangeOverlap; } CoinMP-1.8.3/Cbc/src/CbcSimpleIntegerDynamicPseudoCost.hpp0000644000175000017500000004474712432625130022016 0ustar renerene// $Id: CbcSimpleIntegerDynamicPseudoCost.hpp 2094 2014-11-18 11:15:36Z forrest $ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/17/2009 - carved out of CbcBranchDynamic #ifndef CbcSimpleIntegerDynamicPseudoCost_H #define CbcSimpleIntegerDynamicPseudoCost_H #include "CbcSimpleInteger.hpp" #define TYPERATIO 0.9 #define MINIMUM_MOVEMENT 0.1 #define TYPE2 0 // was 1 - but that looks flakey #define INFEAS 1 #define MOD_SHADOW 1 // weight at 1.0 is max min #define WEIGHT_AFTER 0.8 #define WEIGHT_BEFORE 0.1 //Stolen from Constraint Integer Programming book (with epsilon change) #define WEIGHT_PRODUCT /** Define a single integer class but with dynamic pseudo costs. Based on work by Achterberg, Koch and Martin. It is wild overkill but to keep design all twiddly things are in each. This could be used for fine tuning. */ class CbcSimpleIntegerDynamicPseudoCost : public CbcSimpleInteger { public: // Default Constructor CbcSimpleIntegerDynamicPseudoCost (); // Useful constructor - passed model index CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int iColumn, double breakEven = 0.5); // Useful constructor - passed model index and pseudo costs CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int iColumn, double downDynamicPseudoCost, double upDynamicPseudoCost); // Useful constructor - passed model index and pseudo costs CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int dummy, int iColumn, double downDynamicPseudoCost, double upDynamicPseudoCost); // Copy constructor CbcSimpleIntegerDynamicPseudoCost ( const CbcSimpleIntegerDynamicPseudoCost &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcSimpleIntegerDynamicPseudoCost & operator=( const CbcSimpleIntegerDynamicPseudoCost& rhs); // Destructor virtual ~CbcSimpleIntegerDynamicPseudoCost (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Fills in a created branching object // void fillCreateBranch(CbcIntegerBranchingObject * branching, const OsiBranchingInformation * info, int way) ; /** Pass in information on branch just done and create CbcObjectUpdateData instance. If object does not need data then backward pointer will be NULL. Assumes can get information from solver */ virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface * solver, const CbcNode * node, const CbcBranchingObject * branchingObject); /// Update object by CbcObjectUpdateData virtual void updateInformation(const CbcObjectUpdateData & data) ; /// Copy some information i.e. just variable stuff void copySome(const CbcSimpleIntegerDynamicPseudoCost * otherObject); /// Updates stuff like pseudocosts before threads virtual void updateBefore(const OsiObject * rhs) ; /// Updates stuff like pseudocosts after threads finished virtual void updateAfter(const OsiObject * rhs, const OsiObject * baseObject) ; /// Updates stuff like pseudocosts after mini branch and bound void updateAfterMini(int numberDown, int numberDownInfeasible, double sumDown, int numberUp, int numberUpInfeasible, double sumUp); using CbcSimpleInteger::solverBranch ; /** Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ virtual OsiSolverBranch * solverBranch() const; /// Down pseudo cost inline double downDynamicPseudoCost() const { return downDynamicPseudoCost_; } /// Set down pseudo cost void setDownDynamicPseudoCost(double value) ; /// Modify down pseudo cost in a slightly different way void updateDownDynamicPseudoCost(double value); /// Up pseudo cost inline double upDynamicPseudoCost() const { return upDynamicPseudoCost_; } /// Set up pseudo cost void setUpDynamicPseudoCost(double value); /// Modify up pseudo cost in a slightly different way void updateUpDynamicPseudoCost(double value); /// Down pseudo shadow price cost inline double downShadowPrice() const { return downShadowPrice_; } /// Set down pseudo shadow price cost inline void setDownShadowPrice(double value) { downShadowPrice_ = value; } /// Up pseudo shadow price cost inline double upShadowPrice() const { return upShadowPrice_; } /// Set up pseudo shadow price cost inline void setUpShadowPrice(double value) { upShadowPrice_ = value; } /// Up down separator inline double upDownSeparator() const { return upDownSeparator_; } /// Set up down separator inline void setUpDownSeparator(double value) { upDownSeparator_ = value; } /// Down sum cost inline double sumDownCost() const { return sumDownCost_; } /// Set down sum cost inline void setSumDownCost(double value) { sumDownCost_ = value; } /// Add to down sum cost and set last and square inline void addToSumDownCost(double value) { sumDownCost_ += value; lastDownCost_ = value; } /// Up sum cost inline double sumUpCost() const { return sumUpCost_; } /// Set up sum cost inline void setSumUpCost(double value) { sumUpCost_ = value; } /// Add to up sum cost and set last and square inline void addToSumUpCost(double value) { sumUpCost_ += value; lastUpCost_ = value; } /// Down sum change inline double sumDownChange() const { return sumDownChange_; } /// Set down sum change inline void setSumDownChange(double value) { sumDownChange_ = value; } /// Add to down sum change inline void addToSumDownChange(double value) { sumDownChange_ += value; } /// Up sum change inline double sumUpChange() const { return sumUpChange_; } /// Set up sum change inline void setSumUpChange(double value) { sumUpChange_ = value; } /// Add to up sum change and set last and square inline void addToSumUpChange(double value) { sumUpChange_ += value; } /// Sum down decrease number infeasibilities from strong or actual inline double sumDownDecrease() const { return sumDownDecrease_; } /// Set sum down decrease number infeasibilities from strong or actual inline void setSumDownDecrease(double value) { sumDownDecrease_ = value; } /// Add to sum down decrease number infeasibilities from strong or actual inline void addToSumDownDecrease(double value) { sumDownDecrease_ += value;/*lastDownDecrease_ = (int) value;*/ } /// Sum up decrease number infeasibilities from strong or actual inline double sumUpDecrease() const { return sumUpDecrease_; } /// Set sum up decrease number infeasibilities from strong or actual inline void setSumUpDecrease(double value) { sumUpDecrease_ = value; } /// Add to sum up decrease number infeasibilities from strong or actual inline void addToSumUpDecrease(double value) { sumUpDecrease_ += value;/*lastUpDecrease_ = (int) value;*/ } /// Down number times inline int numberTimesDown() const { return numberTimesDown_; } /// Set down number times inline void setNumberTimesDown(int value) { numberTimesDown_ = value; } /// Increment down number times inline void incrementNumberTimesDown() { numberTimesDown_++; } /// Up number times inline int numberTimesUp() const { return numberTimesUp_; } /// Set up number times inline void setNumberTimesUp(int value) { numberTimesUp_ = value; } /// Increment up number times inline void incrementNumberTimesUp() { numberTimesUp_++; } /// Number times branched inline int numberTimesBranched() const { return numberTimesDown_ + numberTimesUp_; } /// Down number times infeasible inline int numberTimesDownInfeasible() const { return numberTimesDownInfeasible_; } /// Set down number times infeasible inline void setNumberTimesDownInfeasible(int value) { numberTimesDownInfeasible_ = value; } /// Increment down number times infeasible inline void incrementNumberTimesDownInfeasible() { numberTimesDownInfeasible_++; } /// Up number times infeasible inline int numberTimesUpInfeasible() const { return numberTimesUpInfeasible_; } /// Set up number times infeasible inline void setNumberTimesUpInfeasible(int value) { numberTimesUpInfeasible_ = value; } /// Increment up number times infeasible inline void incrementNumberTimesUpInfeasible() { numberTimesUpInfeasible_++; } /// Number of times before trusted inline int numberBeforeTrust() const { return numberBeforeTrust_; } /// Set number of times before trusted inline void setNumberBeforeTrust(int value) { numberBeforeTrust_ = value; } /// Increment number of times before trusted inline void incrementNumberBeforeTrust() { numberBeforeTrust_++; } /// Return "up" estimate virtual double upEstimate() const; /// Return "down" estimate (default 1.0e-5) virtual double downEstimate() const; /// method - see below for details inline int method() const { return method_; } /// Set method inline void setMethod(int value) { method_ = value; } /// Pass in information on a down branch void setDownInformation(double changeObjectiveDown, int changeInfeasibilityDown); /// Pass in information on a up branch void setUpInformation(double changeObjectiveUp, int changeInfeasibilityUp); /// Pass in probing information void setProbingInformation(int fixedDown, int fixedUp); /// Print - 0 -summary, 1 just before strong void print(int type = 0, double value = 0.0) const; /// Same - returns true if contents match(ish) bool same(const CbcSimpleIntegerDynamicPseudoCost * obj) const; protected: /// data /// Down pseudo cost double downDynamicPseudoCost_; /// Up pseudo cost double upDynamicPseudoCost_; /** Up/down separator If >0.0 then do first branch up if value-floor(value) >= this value */ double upDownSeparator_; /// Sum down cost from strong or actual double sumDownCost_; /// Sum up cost from strong or actual double sumUpCost_; /// Sum of all changes to x when going down double sumDownChange_; /// Sum of all changes to x when going up double sumUpChange_; /// Current pseudo-shadow price estimate down mutable double downShadowPrice_; /// Current pseudo-shadow price estimate up mutable double upShadowPrice_; /// Sum down decrease number infeasibilities from strong or actual double sumDownDecrease_; /// Sum up decrease number infeasibilities from strong or actual double sumUpDecrease_; /// Last down cost from strong (i.e. as computed by last strong) double lastDownCost_; /// Last up cost from strong (i.e. as computed by last strong) double lastUpCost_; /// Last down decrease number infeasibilities from strong (i.e. as computed by last strong) mutable int lastDownDecrease_; /// Last up decrease number infeasibilities from strong (i.e. as computed by last strong) mutable int lastUpDecrease_; /// Number of times we have gone down int numberTimesDown_; /// Number of times we have gone up int numberTimesUp_; /// Number of times we have been infeasible going down int numberTimesDownInfeasible_; /// Number of times we have been infeasible going up int numberTimesUpInfeasible_; /// Number of branches before we trust int numberBeforeTrust_; /// Number of local probing fixings going down int numberTimesDownLocalFixed_; /// Number of local probing fixings going up int numberTimesUpLocalFixed_; /// Number of total probing fixings going down double numberTimesDownTotalFixed_; /// Number of total probing fixings going up double numberTimesUpTotalFixed_; /// Number of times probing done int numberTimesProbingTotal_; /// Number of times infeasible when tested /** Method - 0 - pseudo costs 1 - probing */ int method_; }; /** Simple branching object for an integer variable with pseudo costs This object can specify a two-way branch on an integer variable. For each arm of the branch, the upper and lower bounds on the variable can be independently specified. Variable_ holds the index of the integer variable in the integerVariable_ array of the model. */ class CbcIntegerPseudoCostBranchingObject : public CbcIntegerBranchingObject { public: /// Default constructor CbcIntegerPseudoCostBranchingObject (); /** Create a standard floor/ceiling branch object Specifies a simple two-way branch. Let \p value = x*. One arm of the branch will be is lb <= x <= floor(x*), the other ceil(x*) <= x <= ub. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ CbcIntegerPseudoCostBranchingObject (CbcModel *model, int variable, int way , double value) ; /** Create a degenerate branch object Specifies a `one-way branch'. Calling branch() for this object will always result in lowerValue <= x <= upperValue. Used to fix a variable when lowerValue = upperValue. */ CbcIntegerPseudoCostBranchingObject (CbcModel *model, int variable, int way, double lowerValue, double upperValue) ; /// Copy constructor CbcIntegerPseudoCostBranchingObject ( const CbcIntegerPseudoCostBranchingObject &); /// Assignment operator CbcIntegerPseudoCostBranchingObject & operator= (const CbcIntegerPseudoCostBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; /// Destructor virtual ~CbcIntegerPseudoCostBranchingObject (); using CbcBranchingObject::branch ; /** \brief Sets the bounds for the variable according to the current arm of the branch and advances the object state to the next arm. This version also changes guessed objective value */ virtual double branch(); /// Change in guessed inline double changeInGuessed() const { return changeInGuessed_; } /// Set change in guessed inline void setChangeInGuessed(double value) { changeInGuessed_ = value; } /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return SimpleIntegerDynamicPseudoCostBranchObj; } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); protected: /// Change in guessed objective value for next branch double changeInGuessed_; }; #ifdef SWITCH_VARIABLES /** Define a single integer class but with associated switched variable So Binary variable switches on/off a continuous variable designed for badly scaled problems */ class CbcSwitchingBinary : public CbcSimpleIntegerDynamicPseudoCost { public: // Default Constructor CbcSwitchingBinary (); // Useful constructor CbcSwitchingBinary (CbcSimpleIntegerDynamicPseudoCost * oldObject, int nOdd,const int * other, const int * otherRow); // Copy constructor CbcSwitchingBinary ( const CbcSwitchingBinary &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcSwitchingBinary & operator=( const CbcSwitchingBinary& rhs); // Destructor virtual ~CbcSwitchingBinary (); /// Add in zero switches void addZeroSwitches(int nAdd,const int * columns); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; /// Same - returns true if contents match(ish) bool same(const CbcSwitchingBinary * obj) const; /// Set associated bounds virtual int setAssociatedBounds(OsiSolverInterface * solver=NULL, int cleanBasis=0) const; /// Check associated bounds int checkAssociatedBounds(const OsiSolverInterface * solver,const double * solution, int printLevel, int state[3], int & nBadFixed) const; /// Lower bound when binary zero inline const double * zeroLowerBound() const { return zeroLowerBound_; } /// Lower bound when binary one inline const double * oneLowerBound() const { return oneLowerBound_; } /// Upper bound when binary zero inline const double * zeroUpperBound() const { return zeroUpperBound_; } /// Upper bound when binary one inline const double * oneUpperBound() const { return oneUpperBound_; } /** Continuous variable - */ inline const int * otherVariable() const { return otherVariable_;} /// Number of other variables inline int numberOther() const { return numberOther_;} /** Type 1 - single switch 2 - double switch 3 - both */ inline int type() const { return type_;} protected: /// data /// Lower bound when binary zero double * zeroLowerBound_; /// Lower bound when binary one double * oneLowerBound_; /// Upper bound when binary zero double * zeroUpperBound_; /// Upper bound when binary one double * oneUpperBound_; /** Continuous variable - */ int * otherVariable_; /// Number of other variables int numberOther_; /** Type 1 - single switch 2 - double switch 3 - both */ int type_; }; #endif #endif CoinMP-1.8.3/Cbc/src/CbcCutSubsetModifier.cpp0000644000175000017500000000472712131054770017320 0ustar renerene// $Id: CbcCutSubsetModifier.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCutGenerator #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include #include #include #include #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #else #include "OsiSolverInterface.hpp" #endif #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcCutGenerator.hpp" #include "CbcBranchDynamic.hpp" #include "CglProbing.hpp" #include "CoinTime.hpp" #include "CbcCutSubsetModifier.hpp" // Default Constructor CbcCutSubsetModifier::CbcCutSubsetModifier () : CbcCutModifier(), firstOdd_(COIN_INT_MAX) { } // Useful constructor CbcCutSubsetModifier::CbcCutSubsetModifier (int firstOdd) : CbcCutModifier() { firstOdd_ = firstOdd; } // Copy constructor CbcCutSubsetModifier::CbcCutSubsetModifier ( const CbcCutSubsetModifier & rhs) : CbcCutModifier(rhs) { firstOdd_ = rhs.firstOdd_; } // Clone CbcCutModifier * CbcCutSubsetModifier::clone() const { return new CbcCutSubsetModifier(*this); } // Assignment operator CbcCutSubsetModifier & CbcCutSubsetModifier::operator=( const CbcCutSubsetModifier & rhs) { if (this != &rhs) { CbcCutModifier::operator=(rhs); firstOdd_ = rhs.firstOdd_; } return *this; } // Destructor CbcCutSubsetModifier::~CbcCutSubsetModifier () { } /* Returns 0 unchanged 1 strengthened 2 weakened 3 deleted */ int CbcCutSubsetModifier::modify(const OsiSolverInterface * /*solver*/, OsiRowCut & cut) { int n = cut.row().getNumElements(); if (!n) return 0; const int * column = cut.row().getIndices(); //const double * element = cut.row().getElements(); int returnCode = 0; for (int i = 0; i < n; i++) { if (column[i] >= firstOdd_) { returnCode = 3; break; } } #ifdef COIN_DETAIL if (!returnCode) { const double * element = cut.row().getElements(); printf("%g <= ", cut.lb()); for (int i = 0; i < n; i++) { printf("%g*x%d ", element[i], column[i]); } printf("<= %g\n", cut.ub()); } #endif //return 3; return returnCode; } CoinMP-1.8.3/Cbc/src/CbcMipStartIO.hpp0000644000175000017500000000153512131054770015712 0ustar renerene#ifndef MIPSTARTIO_HPP_INCLUDED #define MIPSTARTIO_HPP_INCLUDED #include #include #include class CbcModel; class OsiSolverInterface; /* tries to read mipstart (solution file) from fileName, filling colValues and obj returns 0 with success, 1 otherwise */ int readMIPStart( CbcModel * model, const char *fileName, std::vector< std::pair< std::string, double > > &colValues, double &solObj ); /* from a partial list of variables tries to fill the remaining variable values */ int computeCompleteSolution( CbcModel * model, const std::vector< std::string > colNames, const std::vector< std::pair< std::string, double > > &colValues, double *sol, double &obj ); #endif // MIPSTARTIO_HPP_INCLUDED CoinMP-1.8.3/Cbc/src/CbcSimpleIntegerPseudoCost.hpp0000644000175000017500000000646412131054770020505 0ustar renerene// $Id: CbcSimpleIntegerPseudoCost.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #ifndef CbcSimpleIntegerPseudoCost_H #define CbcSimpleIntegerPseudoCost_H #include "CbcSimpleInteger.hpp" /// Define a single integer class but with pseudo costs class CbcSimpleIntegerPseudoCost : public CbcSimpleInteger { public: // Default Constructor CbcSimpleIntegerPseudoCost (); // Useful constructor - passed model index CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn, double breakEven = 0.5); // Useful constructor - passed and model index and pseudo costs CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn, double downPseudoCost, double upPseudoCost); // Useful constructor - passed and model index and pseudo costs CbcSimpleIntegerPseudoCost (CbcModel * model, int dummy, int iColumn, double downPseudoCost, double upPseudoCost); // Copy constructor CbcSimpleIntegerPseudoCost ( const CbcSimpleIntegerPseudoCost &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcSimpleIntegerPseudoCost & operator=( const CbcSimpleIntegerPseudoCost& rhs); // Destructor virtual ~CbcSimpleIntegerPseudoCost (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Down pseudo cost inline double downPseudoCost() const { return downPseudoCost_; } /// Set down pseudo cost inline void setDownPseudoCost(double value) { downPseudoCost_ = value; } /// Up pseudo cost inline double upPseudoCost() const { return upPseudoCost_; } /// Set up pseudo cost inline void setUpPseudoCost(double value) { upPseudoCost_ = value; } /// Up down separator inline double upDownSeparator() const { return upDownSeparator_; } /// Set up down separator inline void setUpDownSeparator(double value) { upDownSeparator_ = value; } /// Return "up" estimate virtual double upEstimate() const; /// Return "down" estimate (default 1.0e-5) virtual double downEstimate() const; /// method - see below for details inline int method() const { return method_; } /// Set method inline void setMethod(int value) { method_ = value; } protected: /// data /// Down pseudo cost double downPseudoCost_; /// Up pseudo cost double upPseudoCost_; /** Up/down separator If >0.0 then do first branch up if value-floor(value) >= this value */ double upDownSeparator_; /** Method - 0 - normal - return min (up,down) 1 - if before any solution return CoinMax(up,down) 2 - if before branched solution return CoinMax(up,down) 3 - always return CoinMax(up,down) */ int method_; }; #endif CoinMP-1.8.3/Cbc/src/CbcSolverAnalyze.cpp0000644000175000017500000003417412405160734016517 0ustar renerene/* $Id: CbcSolverAnalyze.cpp 2071 2014-09-14 00:31:24Z unxusr $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolverAnalyze.cpp Look to see if a constraint is all-integer (variables & coeffs), or could be all integer. Consider whether one or two continuous variables can be declared integer. John's comment is that integer preprocessing might do a better job, so we should consider whether this routine should stay. No hurry to get rid of it, in my opinion -- lh, 091210 -- */ #include "CbcConfig.h" #include "CoinPragma.hpp" #include "OsiClpSolverInterface.hpp" #include "ClpMessage.hpp" #include "CbcModel.hpp" #ifndef CBC_OTHER_SOLVER int * analyze(OsiClpSolverInterface * solverMod, int & numberChanged, double & increment, bool changeInt, CoinMessageHandler * generalMessageHandler, bool noPrinting) { bool noPrinting_ = noPrinting; OsiSolverInterface * solver = solverMod->clone(); char generalPrint[200]; if (0) { // just get increment CbcModel model(*solver); model.analyzeObjective(); double increment2 = model.getCutoffIncrement(); printf("initial cutoff increment %g\n", increment2); } const double *objective = solver->getObjCoefficients() ; const double *lower = solver->getColLower() ; const double *upper = solver->getColUpper() ; int numberColumns = solver->getNumCols() ; int numberRows = solver->getNumRows(); double direction = solver->getObjSense(); int iRow, iColumn; // Row copy CoinPackedMatrix matrixByRow(*solver->getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); // Column copy CoinPackedMatrix matrixByCol(*solver->getMatrixByCol()); const double * element = matrixByCol.getElements(); const int * row = matrixByCol.getIndices(); const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol.getVectorLengths(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); char * ignore = new char [numberRows]; int * changed = new int[numberColumns]; int * which = new int[numberRows]; double * changeRhs = new double[numberRows]; memset(changeRhs, 0, numberRows*sizeof(double)); memset(ignore, 0, numberRows); numberChanged = 0; int numberInteger = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn] + 1.0e-8 && solver->isInteger(iColumn)) numberInteger++; } bool finished = false; while (!finished) { int saveNumberChanged = numberChanged; for (iRow = 0; iRow < numberRows; iRow++) { int numberContinuous = 0; double value1 = 0.0, value2 = 0.0; bool allIntegerCoeff = true; double sumFixed = 0.0; int jColumn1 = -1, jColumn2 = -1; for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int jColumn = column[j]; double value = elementByRow[j]; if (upper[jColumn] > lower[jColumn] + 1.0e-8) { if (!solver->isInteger(jColumn)) { if (numberContinuous == 0) { jColumn1 = jColumn; value1 = value; } else { jColumn2 = jColumn; value2 = value; } numberContinuous++; } else { if (fabs(value - floor(value + 0.5)) > 1.0e-12) allIntegerCoeff = false; } } else { sumFixed += lower[jColumn] * value; } } double low = rowLower[iRow]; if (low > -1.0e20) { low -= sumFixed; if (fabs(low - floor(low + 0.5)) > 1.0e-12) allIntegerCoeff = false; } double up = rowUpper[iRow]; if (up < 1.0e20) { up -= sumFixed; if (fabs(up - floor(up + 0.5)) > 1.0e-12) allIntegerCoeff = false; } if (!allIntegerCoeff) continue; // can't do if (numberContinuous == 1) { // see if really integer // This does not allow for complicated cases if (low == up) { if (fabs(value1) > 1.0e-3) { value1 = 1.0 / value1; if (fabs(value1 - floor(value1 + 0.5)) < 1.0e-12) { // integer changed[numberChanged++] = jColumn1; solver->setInteger(jColumn1); if (upper[jColumn1] > 1.0e20) solver->setColUpper(jColumn1, 1.0e20); if (lower[jColumn1] < -1.0e20) solver->setColLower(jColumn1, -1.0e20); } } } else { if (fabs(value1) > 1.0e-3) { value1 = 1.0 / value1; if (fabs(value1 - floor(value1 + 0.5)) < 1.0e-12) { // This constraint will not stop it being integer ignore[iRow] = 1; } } } } else if (numberContinuous == 2) { if (low == up) { /* need general theory - for now just look at 2 cases - 1 - +- 1 one in column and just costs i.e. matching objective 2 - +- 1 two in column but feeds into G/L row which will try and minimize */ if (fabs(value1) == 1.0 && value1*value2 == -1.0 && !lower[jColumn1] && !lower[jColumn2]) { int n = 0; int i; double objChange = direction * (objective[jColumn1] + objective[jColumn2]); double bound = CoinMin(upper[jColumn1], upper[jColumn2]); bound = CoinMin(bound, 1.0e20); for ( i = columnStart[jColumn1]; i < columnStart[jColumn1] + columnLength[jColumn1]; i++) { int jRow = row[i]; double value = element[i]; if (jRow != iRow) { which[n++] = jRow; changeRhs[jRow] = value; } } for ( i = columnStart[jColumn1]; i < columnStart[jColumn1] + columnLength[jColumn1]; i++) { int jRow = row[i]; double value = element[i]; if (jRow != iRow) { if (!changeRhs[jRow]) { which[n++] = jRow; changeRhs[jRow] = value; } else { changeRhs[jRow] += value; } } } if (objChange >= 0.0) { // see if all rows OK bool good = true; for (i = 0; i < n; i++) { int jRow = which[i]; double value = changeRhs[jRow]; if (value) { value *= bound; if (rowLength[jRow] == 1) { if (value > 0.0) { double rhs = rowLower[jRow]; if (rhs > 0.0) { double ratio = rhs / value; if (fabs(ratio - floor(ratio + 0.5)) > 1.0e-12) good = false; } } else { double rhs = rowUpper[jRow]; if (rhs < 0.0) { double ratio = rhs / value; if (fabs(ratio - floor(ratio + 0.5)) > 1.0e-12) good = false; } } } else if (rowLength[jRow] == 2) { if (value > 0.0) { if (rowLower[jRow] > -1.0e20) good = false; } else { if (rowUpper[jRow] < 1.0e20) good = false; } } else { good = false; } } } if (good) { // both can be integer changed[numberChanged++] = jColumn1; solver->setInteger(jColumn1); if (upper[jColumn1] > 1.0e20) solver->setColUpper(jColumn1, 1.0e20); if (lower[jColumn1] < -1.0e20) solver->setColLower(jColumn1, -1.0e20); changed[numberChanged++] = jColumn2; solver->setInteger(jColumn2); if (upper[jColumn2] > 1.0e20) solver->setColUpper(jColumn2, 1.0e20); if (lower[jColumn2] < -1.0e20) solver->setColLower(jColumn2, -1.0e20); } } // clear for (i = 0; i < n; i++) { changeRhs[which[i]] = 0.0; } } } } } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn] + 1.0e-8 && !solver->isInteger(iColumn)) { double value; value = upper[iColumn]; if (value < 1.0e20 && fabs(value - floor(value + 0.5)) > 1.0e-12) continue; value = lower[iColumn]; if (value > -1.0e20 && fabs(value - floor(value + 0.5)) > 1.0e-12) continue; bool integer = true; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (!ignore[iRow]) { integer = false; break; } } if (integer) { // integer changed[numberChanged++] = iColumn; solver->setInteger(iColumn); if (upper[iColumn] > 1.0e20) solver->setColUpper(iColumn, 1.0e20); if (lower[iColumn] < -1.0e20) solver->setColLower(iColumn, -1.0e20); } } } finished = numberChanged == saveNumberChanged; } delete [] which; delete [] changeRhs; delete [] ignore; //if (numberInteger&&!noPrinting_) //printf("%d integer variables",numberInteger); if (changeInt) { //if (!noPrinting_) { //if (numberChanged) // printf(" and %d variables made integer\n",numberChanged); //else // printf("\n"); //} //increment=0.0; if (!numberChanged) { delete [] changed; delete solver; return NULL; } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (solver->isInteger(iColumn)) solverMod->setInteger(iColumn); } delete solver; return changed; } } else { //if (!noPrinting_) { //if (numberChanged) // printf(" and %d variables could be made integer\n",numberChanged); //else // printf("\n"); //} // just get increment int logLevel = generalMessageHandler->logLevel(); CbcModel model(*solver); if (!model.defaultHandler()) model.passInMessageHandler(generalMessageHandler); if (noPrinting_) model.setLogLevel(0); model.analyzeObjective(); generalMessageHandler->setLogLevel(logLevel); double increment2 = model.getCutoffIncrement(); if (increment2 > increment && increment2 > 0.0) { if (!noPrinting_) { sprintf(generalPrint, "Cutoff increment increased from %g to %g", increment, increment2); CoinMessages generalMessages = solverMod->getModelPtr()->messages(); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } increment = increment2; } delete solver; numberChanged = 0; delete [] changed; return NULL; } } #endif // ifndef CBC_OTHER_SOLVER CoinMP-1.8.3/Cbc/src/CbcSymmetry.hpp0000644000175000017500000002457612547040710015562 0ustar renerene/* $Id: CbcSymmetry.hpp 1033 2013-12-14 19:34:28Z pbelotti $ * * Name: Hacked from CouenneProblem.hpp * Author: Pietro Belotti, Lehigh University * Andreas Waechter, IBM * Purpose: define the class CouenneProblem * * (C) Carnegie-Mellon University, 2006-11. * This file is licensed under the Eclipse Public License (EPL) */ /* If this is much used then we could improve build experience Download nauty - say to /disk/nauty25r9 In that directory ./configure --enable-tls --enable-wordsize=32 make copy nauty.a to libnauty.a In Cbc's configure add -DCOIN_HAS_NTY to CXXDEFS add -I/disk/nauty25r9 to CXXDEFS or ADD_CXXFLAGS add -L/disk/nauty25r9 -lnauty to LDFLAGS If you wish to use Traces rather than nauty then add -DNTY_TRACES To use it is -orbit on Nauty has this - * Permission * is hereby given for use and/or distribution with the exception of * * sale for profit or application with nontrivial military significance. * so you can use it internally even if you are a company. */ #ifndef CBC_SYMMETRY_HPP #define CBC_SYMMETRY_HPP extern "C" { #include "nauty.h" #include "nausparse.h" #ifdef NTY_TRACES #include "traces.h" #endif } #include #include #include #include "CbcModel.hpp" class OsiObject; // when to give up (depth since last success) #ifndef NTY_BAD_DEPTH #define NTY_BAD_DEPTH 10 #endif class CbcNauty; #define COUENNE_HACKED_EPS 1.e-07 #define COUENNE_HACKED_EPS_SYMM 1e-8 #define COUENNE_HACKED_EXPRGROUP 8 /** Class to deal with symmetry * * Hacked from Couenne * Thanks, but it had been nice to make sure that there are no symbol collisions when building Couenne with this Cbc. */ class CbcSymmetry { class Node{ int index; double coeff; double lb; double ub; int color; int code; int sign; public: void node(int, double, double, double, int, int); inline void color_vertex (register int k) {color = k;} inline int get_index () const {return index;} inline double get_coeff () const {return coeff;} inline double get_lb () const {return lb;} inline double get_ub () const {return ub;} inline int get_color () const {return color;} inline int get_code () const {return code;} inline int get_sign () const {return sign;} inline void bounds(register double a, register double b){ lb = a; ub = b;} }; struct myclass0 { inline bool operator() (register const Node &a, register const Node &b) { return (( a.get_code () < b.get_code ()) || (( a.get_code () == b.get_code () && (( a.get_coeff () < b.get_coeff () - COUENNE_HACKED_EPS_SYMM) || (( fabs (a.get_coeff () - b.get_coeff ()) < COUENNE_HACKED_EPS_SYMM) && (( a.get_lb () < b.get_lb () - COUENNE_HACKED_EPS_SYMM) || (( fabs (a.get_lb () - b.get_lb ()) < COUENNE_HACKED_EPS_SYMM) && (( a.get_ub () < b.get_ub () - COUENNE_HACKED_EPS_SYMM) || (( fabs (a.get_ub () - b.get_ub ()) < COUENNE_HACKED_EPS_SYMM) && (( a.get_index () < b.get_index ()))))))))))); } } ; struct myclass { inline bool operator() (register const Node &a, register const Node &b) { return (a.get_index() < b.get_index() ); } }; struct less_than_str { inline bool operator() (register const char *a, register const char *b) const {return strcmp (a, b) < 0;} }; public: /**@name Constructors and destructors */ //@{ /// Default constructor CbcSymmetry (); /// Copy constructor CbcSymmetry (const CbcSymmetry &); /// Assignment operator CbcSymmetry & operator=(const CbcSymmetry& rhs); /// Destructor ~CbcSymmetry (); //@} // Symmetry Info std::vector *Find_Orbit(int) const; myclass0 node_sort; myclass index_sort; void Compute_Symmetry() const; int statsOrbits(CbcModel * model, int type) const; //double timeNauty () const; void Print_Orbits() const; void fillOrbits(); /// Fixes variables using orbits (returns number fixed) int orbitalFixing(OsiSolverInterface * solver); inline int * whichOrbit() { return numberUsefulOrbits_ ? whichOrbit_ : NULL;} inline int numberUsefulOrbits() const { return numberUsefulOrbits_;} inline int numberUsefulObjects() const { return numberUsefulObjects_;} int largestOrbit(const double * lower, const double * upper) const; void ChangeBounds (const double * lower, const double * upper, int numberColumns,bool justFixedAtOne) const; inline bool compare (register Node &a, register Node &b) const; CbcNauty *getNtyInfo () {return nauty_info_;} // bool node_sort ( Node a, Node b); // bool index_sort ( Node a, Node b); /// empty if no NTY, symmetry data structure setup otherwise void setupSymmetry (const OsiSolverInterface & solver); private: mutable std::vector node_info_; mutable CbcNauty *nauty_info_; int numberColumns_; int numberUsefulOrbits_; int numberUsefulObjects_; int * whichOrbit_; }; class CbcNauty { public: enum VarStatus { FIX_AT_ZERO, FIX_AT_ONE, FREE }; /**@name Constructors and destructors */ //@{ private: /// Default constructor CbcNauty (); public: /// Normal constructor (if dense - NULLS) CbcNauty (int n, const size_t * v, const int * d, const int * e); /// Copy constructor CbcNauty (const CbcNauty &); /// Assignment operator CbcNauty & operator=(const CbcNauty& rhs); /// Destructor ~CbcNauty (); //@} void addElement(int ix, int jx); void clearPartitions(); void computeAuto(); void deleteElement(int ix, int jx); void color_node(int ix, int color) { vstat_[ix] = color; } void insertRHS(int rhs , int cons) {constr_rhs.insert( std::pair(rhs,cons));} double getGroupSize() const; //int getNautyCalls() const { return nautyCalls_; } //double getNautyTime() const { return nautyTime_; } int getN() const { return n_; } int getNumGenerators() const; int getNumOrbits() const; /// Returns the orbits in a "convenient" form std::vector > *getOrbits() const; void getVstat(double *v, int nv); inline bool isSparse() const { return GSparse_ != NULL;} inline int errorStatus() const { return stats_->errstatus;} /** * Methods to classify orbits. Not horribly efficient, but gets the job done */ // bool isAllFixOneOrbit(const std::vector &orbit) const; // bool isAllFreeOrbit(const std::vector &orbit) const; //bool isAutoComputed() const { return autoComputed_; } //bool isConstraintOrbit(const std::vector &orbit) const; //bool isMixedFreeZeroOrbit(const std::vector &orbit) const; //void makeFree(int ix) { vstat_[ix] = FREE; } void setWriteAutoms (const std::string &afilename); void unsetWriteAutoms(); private: // The base nauty stuff graph *G_; sparsegraph *GSparse_; int *lab_; int *ptn_; set *active_; int *orbits_; #ifndef NTY_TRACES optionblk *options_; statsblk *stats_; #else TracesOptions *options_; TracesStats *stats_; #endif setword *workspace_; int worksize_; int m_; int n_; size_t nel_; graph *canonG_; bool autoComputed_; int *vstat_; //static int nautyCalls_; //static double nautyTime_; std::multimap constr_rhs; std::multimap::iterator it; std::pair::iterator, std::multimap::iterator> ret; // File pointer for automorphism group FILE *afp_; }; /** Branching object for Orbital branching Variable_ is the set id number (redundant, as the object also holds a pointer to the set. */ class CbcOrbitalBranchingObject : public CbcBranchingObject { public: // Default Constructor CbcOrbitalBranchingObject (); // Useful constructor CbcOrbitalBranchingObject (CbcModel * model, int column, int way, int numberExtra, const int * extraToZero); // Copy constructor CbcOrbitalBranchingObject ( const CbcOrbitalBranchingObject &); // Assignment operator CbcOrbitalBranchingObject & operator=( const CbcOrbitalBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; // Destructor virtual ~CbcOrbitalBranchingObject (); using CbcBranchingObject::branch ; /// Does next branch and updates state virtual double branch(); /** Update bounds in solver as in 'branch' and update given bounds. branchState is -1 for 'down' +1 for 'up' */ virtual void fix(OsiSolverInterface * solver, double * lower, double * upper, int branchState) const ; /** Reset every information so that the branching object appears to point to the previous child. This method does not need to modify anything in any solver. */ virtual void previousBranch() { CbcBranchingObject::previousBranch(); } using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return SoSBranchObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); private: /// Column to go to 1 int column_; /// Number (without column) going to zero on down branch int numberOther_; /// Number extra int numberExtra_; /// Fix to zero int * fixToZero_; }; #endif CoinMP-1.8.3/Cbc/src/CbcObject.hpp0000644000175000017500000002260712131054770015130 0ustar renerene// $Id: CbcObject.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #ifndef CbcObject_H #define CbcObject_H #include #include #include "OsiBranchingObject.hpp" class OsiSolverInterface; class OsiSolverBranch; class CbcModel; class CbcNode; class CbcNodeInfo; class CbcBranchingObject; class OsiChooseVariable; class CbcObjectUpdateData; //############################################################################# /** Abstract base class for `objects'. It now just has stuff that OsiObject does not have The branching model used in Cbc is based on the idea of an object. In the abstract, an object is something that has a feasible region, can be evaluated for infeasibility, can be branched on (i.e., there's some constructive action to be taken to move toward feasibility), and allows comparison of the effect of branching. This class (CbcObject) is the base class for an object. To round out the branching model, the class CbcBranchingObject describes how to perform a branch, and the class CbcBranchDecision describes how to compare two CbcBranchingObjects. To create a new type of object you need to provide three methods: #infeasibility(), #feasibleRegion(), and #createCbcBranch(), described below. This base class is primarily virtual to allow for any form of structure. Any form of discontinuity is allowed. \todo The notion that all branches are binary (two arms) is wired into the implementation of CbcObject, CbcBranchingObject, and CbcBranchDecision. Changing this will require a moderate amount of recoding. */ // This can be used if object wants to skip strong branching typedef struct { CbcBranchingObject * possibleBranch; // what a branch would do double upMovement; // cost going up (and initial away from feasible) double downMovement; // cost going down int numIntInfeasUp ; // without odd ones int numObjInfeasUp ; // just odd ones bool finishedUp; // true if solver finished int numItersUp ; // number of iterations in solver int numIntInfeasDown ; // without odd ones int numObjInfeasDown ; // just odd ones bool finishedDown; // true if solver finished int numItersDown; // number of iterations in solver int objectNumber; // Which object it is int fix; // 0 if no fix, 1 if we can fix up, -1 if we can fix down } CbcStrongInfo; class CbcObject : public OsiObject { public: // Default Constructor CbcObject (); // Useful constructor CbcObject (CbcModel * model); // Copy constructor CbcObject ( const CbcObject &); // Assignment operator CbcObject & operator=( const CbcObject& rhs); /// Clone virtual CbcObject * clone() const = 0; /// Destructor virtual ~CbcObject (); /** Infeasibility of the object This is some measure of the infeasibility of the object. It should be scaled to be in the range [0.0, 0.5], with 0.0 indicating the object is satisfied. The preferred branching direction is returned in preferredWay, This is used to prepare for strong branching but should also think of case when no strong branching The object may also compute an estimate of cost of going "up" or "down". This will probably be based on pseudo-cost ideas */ #ifdef CBC_NEW_STYLE_BRANCH virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const = 0; #else virtual double infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { return infeasibility(preferredWay); } virtual double infeasibility(int &/*preferredWay*/) const { throw CoinError("Need code", "infeasibility", "CbcBranchBase"); } #endif /** For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. */ virtual void feasibleRegion() = 0; /// Dummy one for compatibility virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. Returns measure of how much it had to move solution to make feasible */ virtual double feasibleRegion(OsiSolverInterface * solver) const ; /** Create a branching object and indicate which way to branch first. The branching object has to know how to create branches (fix variables, etc.) */ #ifdef CBC_NEW_STYLE_BRANCH virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) = 0; #else virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * /* solver */, const OsiBranchingInformation * /* info */, int /* way */) { // return createBranch(solver, info, way); return NULL; } virtual OsiBranchingObject * createBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * /*info*/, int /*way*/) const { throw CoinError("Need code", "createBranch", "CbcBranchBase"); } #endif /** Create an Osibranching object and indicate which way to branch first. The branching object has to know how to create branches (fix variables, etc.) */ virtual OsiBranchingObject * createOsiBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; /** Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ virtual OsiSolverBranch * solverBranch() const; /** \brief Given a valid solution (with reduced costs, etc.), return a branching object which would give a new feasible point in a good direction. If the method cannot generate a feasible point (because there aren't any, or because it isn't bright enough to find one), it should return null. */ virtual CbcBranchingObject * preferredNewFeasible() const { return NULL; } /** \brief Given a valid solution (with reduced costs, etc.), return a branching object which would give a new feasible point in a bad direction. If the method cannot generate a feasible point (because there aren't any, or because it isn't bright enough to find one), it should return null. */ virtual CbcBranchingObject * notPreferredNewFeasible() const { return NULL; } /** Reset variable bounds to their original values. Bounds may be tightened, so it may be good to be able to set this info in object. */ virtual void resetBounds(const OsiSolverInterface * ) {} /** Returns floor and ceiling i.e. closest valid points */ virtual void floorCeiling(double & floorValue, double & ceilingValue, double value, double tolerance) const; /** Pass in information on branch just done and create CbcObjectUpdateData instance. If object does not need data then backward pointer will be NULL. Assumes can get information from solver */ virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface * solver, const CbcNode * node, const CbcBranchingObject * branchingObject); /// Update object by CbcObjectUpdateData virtual void updateInformation(const CbcObjectUpdateData & ) {} /// Identifier (normally column number in matrix) inline int id() const { return id_; } /** Set identifier (normally column number in matrix) but 1000000000 to 1100000000 means optional branching object i.e. code would work without it */ inline void setId(int value) { id_ = value; } /** Return true if optional branching object i.e. code would work without it */ inline bool optionalObject() const { return (id_ >= 1000000000 && id_ < 1100000000); } /// Get position in object_ list inline int position() const { return position_; } /// Set position in object_ list inline void setPosition(int position) { position_ = position; } /// update model inline void setModel(CbcModel * model) { model_ = model; } /// Return model inline CbcModel * model() const { return model_; } /// If -1 down always chosen first, +1 up always, 0 normal inline int preferredWay() const { return preferredWay_; } /// Set -1 down always chosen first, +1 up always, 0 normal inline void setPreferredWay(int value) { preferredWay_ = value; } /// Redoes data when sequence numbers change virtual void redoSequenceEtc(CbcModel * , int , const int * ) {} /// Initialize for branching virtual void initializeForBranching(CbcModel * ) {} protected: /// data /// Model CbcModel * model_; /// Identifier (normally column number in matrix) int id_; /// Position in object list int position_; /// If -1 down always chosen first, +1 up always, 0 normal int preferredWay_; }; #endif CoinMP-1.8.3/Cbc/src/CbcNWay.cpp0000644000175000017500000003044312131054770014570 0ustar renerene// $Id: CbcNWay.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/9/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcNWay.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## // Default Constructor CbcNWay::CbcNWay () : CbcObject(), numberMembers_(0), members_(NULL), consequence_(NULL) { } // Useful constructor (which are integer indices) CbcNWay::CbcNWay (CbcModel * model, int numberMembers, const int * which, int identifier) : CbcObject(model) { id_ = identifier; numberMembers_ = numberMembers; if (numberMembers_) { members_ = new int[numberMembers_]; memcpy(members_, which, numberMembers_*sizeof(int)); } else { members_ = NULL; } consequence_ = NULL; } // Copy constructor CbcNWay::CbcNWay ( const CbcNWay & rhs) : CbcObject(rhs) { numberMembers_ = rhs.numberMembers_; consequence_ = NULL; if (numberMembers_) { members_ = new int[numberMembers_]; memcpy(members_, rhs.members_, numberMembers_*sizeof(int)); if (rhs.consequence_) { consequence_ = new CbcConsequence * [numberMembers_]; for (int i = 0; i < numberMembers_; i++) { if (rhs.consequence_[i]) consequence_[i] = rhs.consequence_[i]->clone(); else consequence_[i] = NULL; } } } else { members_ = NULL; } } // Clone CbcObject * CbcNWay::clone() const { return new CbcNWay(*this); } // Assignment operator CbcNWay & CbcNWay::operator=( const CbcNWay & rhs) { if (this != &rhs) { CbcObject::operator=(rhs); delete [] members_; numberMembers_ = rhs.numberMembers_; if (consequence_) { for (int i = 0; i < numberMembers_; i++) delete consequence_[i]; delete [] consequence_; consequence_ = NULL; } if (numberMembers_) { members_ = new int[numberMembers_]; memcpy(members_, rhs.members_, numberMembers_*sizeof(int)); } else { members_ = NULL; } if (rhs.consequence_) { consequence_ = new CbcConsequence * [numberMembers_]; for (int i = 0; i < numberMembers_; i++) { if (rhs.consequence_[i]) consequence_[i] = rhs.consequence_[i]->clone(); else consequence_[i] = NULL; } } } return *this; } // Destructor CbcNWay::~CbcNWay () { delete [] members_; if (consequence_) { for (int i = 0; i < numberMembers_; i++) delete consequence_[i]; delete [] consequence_; } } // Set up a consequence for a single member void CbcNWay::setConsequence(int iColumn, const CbcConsequence & consequence) { if (!consequence_) { consequence_ = new CbcConsequence * [numberMembers_]; for (int i = 0; i < numberMembers_; i++) consequence_[i] = NULL; } for (int i = 0; i < numberMembers_; i++) { if (members_[i] == iColumn) { consequence_[i] = consequence.clone(); break; } } } // Applies a consequence for a single member void CbcNWay::applyConsequence(int iSequence, int state) const { assert (state == -9999 || state == 9999); if (consequence_) { CbcConsequence * consequence = consequence_[iSequence]; if (consequence) consequence->applyToSolver(model_->solver(), state); } } double CbcNWay::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { int numberUnsatis = 0; int j; OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double largestValue = 0.0; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; double value = solution[iColumn]; value = CoinMax(value, lower[iColumn]); value = CoinMin(value, upper[iColumn]); double distance = CoinMin(value - lower[iColumn], upper[iColumn] - value); if (distance > integerTolerance) { numberUnsatis++; largestValue = CoinMax(distance, largestValue); } } preferredWay = 1; if (numberUnsatis) { return largestValue; } else { return 0.0; // satisfied } } // This looks at solution and sets bounds to contain solution void CbcNWay::feasibleRegion() { int j; OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; double value = solution[iColumn]; value = CoinMax(value, lower[iColumn]); value = CoinMin(value, upper[iColumn]); if (value >= upper[iColumn] - integerTolerance) { solver->setColLower(iColumn, upper[iColumn]); } else { assert (value <= lower[iColumn] + integerTolerance); solver->setColUpper(iColumn, lower[iColumn]); } } } // Redoes data when sequence numbers change void CbcNWay::redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns) { model_ = model; int n2 = 0; for (int j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; int i; for (i = 0; i < numberColumns; i++) { if (originalColumns[i] == iColumn) break; } if (i < numberColumns) { members_[n2] = i; consequence_[n2++] = consequence_[j]; } else { delete consequence_[j]; } } if (n2 < numberMembers_) { printf("** NWay number of members reduced from %d to %d!\n", numberMembers_, n2); numberMembers_ = n2; } } CbcBranchingObject * CbcNWay::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * /*info*/, int /*way*/) { int numberFree = 0; int j; //OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); int * list = new int[numberMembers_]; double * sort = new double[numberMembers_]; for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; double value = solution[iColumn]; value = CoinMax(value, lower[iColumn]); value = CoinMin(value, upper[iColumn]); if (upper[iColumn] > lower[iColumn]) { double distance = upper[iColumn] - value; list[numberFree] = j; sort[numberFree++] = distance; } } assert (numberFree); // sort CoinSort_2(sort, sort + numberFree, list); // create object CbcBranchingObject * branch; branch = new CbcNWayBranchingObject(model_, this, numberFree, list); branch->setOriginalObject(this); delete [] list; delete [] sort; return branch; } // Default Constructor CbcNWayBranchingObject::CbcNWayBranchingObject() : CbcBranchingObject() { order_ = NULL; object_ = NULL; numberInSet_ = 0; way_ = 0; } // Useful constructor CbcNWayBranchingObject::CbcNWayBranchingObject (CbcModel * model, const CbcNWay * nway, int number, const int * order) : CbcBranchingObject(model, nway->id(), -1, 0.5) { numberBranches_ = number; order_ = new int [number]; object_ = nway; numberInSet_ = number; memcpy(order_, order, number*sizeof(int)); } // Copy constructor CbcNWayBranchingObject::CbcNWayBranchingObject ( const CbcNWayBranchingObject & rhs) : CbcBranchingObject(rhs) { numberInSet_ = rhs.numberInSet_; object_ = rhs.object_; if (numberInSet_) { order_ = new int [numberInSet_]; memcpy(order_, rhs.order_, numberInSet_*sizeof(int)); } else { order_ = NULL; } } // Assignment operator CbcNWayBranchingObject & CbcNWayBranchingObject::operator=( const CbcNWayBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); object_ = rhs.object_; delete [] order_; numberInSet_ = rhs.numberInSet_; if (numberInSet_) { order_ = new int [numberInSet_]; memcpy(order_, rhs.order_, numberInSet_*sizeof(int)); } else { order_ = NULL; } } return *this; } CbcBranchingObject * CbcNWayBranchingObject::clone() const { return (new CbcNWayBranchingObject(*this)); } // Destructor CbcNWayBranchingObject::~CbcNWayBranchingObject () { delete [] order_; } double CbcNWayBranchingObject::branch() { int which = branchIndex_; branchIndex_++; assert (numberBranchesLeft() >= 0); if (which == 0) { // first branch so way_ may mean something assert (way_ == -1 || way_ == 1); if (way_ == -1) which++; } else if (which == 1) { // second branch so way_ may mean something assert (way_ == -1 || way_ == 1); if (way_ == -1) which--; // switch way off way_ = 0; } const double * lower = model_->solver()->getColLower(); const double * upper = model_->solver()->getColUpper(); const int * members = object_->members(); for (int j = 0; j < numberInSet_; j++) { int iSequence = order_[j]; int iColumn = members[iSequence]; if (j != which) { model_->solver()->setColUpper(iColumn, lower[iColumn]); //model_->solver()->setColLower(iColumn,lower[iColumn]); assert (lower[iColumn] > -1.0e20); // apply any consequences object_->applyConsequence(iSequence, -9999); } else { model_->solver()->setColLower(iColumn, upper[iColumn]); //model_->solver()->setColUpper(iColumn,upper[iColumn]); #ifdef FULL_PRINT printf("Up Fix %d to %g\n", iColumn, upper[iColumn]); #endif assert (upper[iColumn] < 1.0e20); // apply any consequences object_->applyConsequence(iSequence, 9999); } } return 0.0; } void CbcNWayBranchingObject::print() { printf("NWay - Up Fix "); const int * members = object_->members(); for (int j = 0; j < way_; j++) { int iColumn = members[order_[j]]; printf("%d ", iColumn); } printf("\n"); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcNWayBranchingObject::compareOriginalObject (const CbcBranchingObject* /*brObj*/) const { throw("must implement"); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcNWayBranchingObject::compareBranchingObject (const CbcBranchingObject* /*brObj*/, const bool /*replaceIfOverlap*/) { throw("must implement"); } CoinMP-1.8.3/Cbc/src/CbcGenCbcParamUtils.cpp0000644000175000017500000003526412131054770017043 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenCbcParamUtils.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinFinite.hpp" #include "CoinParam.hpp" #include "CbcModel.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" #include "CbcGenCbcParam.hpp" /*! \file CbcGenParamUtils \brief Implementation functions for CbcGenParam parameters. */ namespace { char svnid[] = "$Id: CbcGenCbcParamUtils.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } namespace CbcCbcParamUtils { /* Function to set up cbc (CbcModel) parameters. */ void addCbcCbcParams (int &numberParameters, CoinParamVec ¶meters, CbcModel *model) { CbcCbcParam *param ; param = new CbcCbcParam(CbcCbcParam::ALLOWABLEGAP, "allow!ableGap", "Stop when gap between best possible and incumbent is less than this", 0.0, 1.0e20) ; param->setDblVal(0.0) ; param->setPushFunc(pushCbcCbcDbl) ; param->setObj(model) ; param->setLongHelp( "If the gap between best solution and best possible solution is less than this then the search will be terminated. Also see ratioGap." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::CUTOFF, "cuto!ff", "All solutions must be better than this", -1.0e60, 1.0e60) ; param->setDblVal(1.0e50) ; param->setPushFunc(pushCbcCbcDbl) ; param->setObj(model) ; param->setLongHelp( "All solutions must be better than this value (in a minimization sense). This is also set by cbc whenever it obtains a solution and is set to the value of the objective for the solution minus the cutoff increment." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::DIRECTION, "direction", "Minimize or maximize", "min!imize", 0) ; param->appendKwd("max!imize") ; param->appendKwd("zero") ; param->setObj(model) ; param->setLongHelp( "The default is minimize - use 'direction maximize' for maximization.\nYou can also use the parameters 'maximize' or 'minimize'." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::INCREMENT, "inc!rement", "A new solution must be at least this much better than the incumbent", -1.0e20, 1.0e20, model->getDblParam(CbcModel::CbcCutoffIncrement)) ; param->setPushFunc(pushCbcCbcDbl) ; param->setObj(model) ; param->setLongHelp( "Whenever a solution is found the bound on future solutions is set to the objective of the solution (in a minimization sense) plus the specified increment. If this option is not specified, the code will try and work out an increment. E.g., if all objective coefficients are multiples of 0.01 and only integer variables have entries in objective then the increment can be set to 0.01. Be careful if you set this negative!" ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::INFEASIBILITYWEIGHT, "inf!easibilityWeight", "Each integer infeasibility is expected to cost this much", 0.0, 1.0e20, model->getDblParam(CbcModel::CbcInfeasibilityWeight)) ; param->setPushFunc(pushCbcCbcDbl) ; param->setObj(model) ; param->setLongHelp( "A primitive way of deciding which node to explore next. Satisfying each integer infeasibility is expected to cost this much." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::INTEGERTOLERANCE, "integerT!olerance", "For an optimal solution, no integer variable may be farther than this from an integer value", 1.0e-20, 0.5, model->getDblParam(CbcModel::CbcIntegerTolerance)) ; param->setPushFunc(pushCbcCbcDbl) ; param->setObj(model) ; param->setLongHelp( "When checking a solution for feasibility, if the difference between the value of a variable and the nearest integer is less than the integer tolerance, the value is considered to be integral. Beware of setting this smaller than the primal tolerance." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::LOGLEVEL, "bclog!Level", "Level of detail in Coin branch and Cut output", -1, 63, model->messageHandler()->logLevel()) ; param->setPushFunc(pushCbcCbcInt) ; param->setObj(model) ; param->setLongHelp( "If set to 0 then there should be no output in normal circumstances. A value of 1 is probably the best value for most uses, while 2 and 3 give more information." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::MAXIMIZE, "max!imize", "Set optimization direction to maximize") ; param->setObj(model) ; param->setLongHelp( "The default is minimize - use 'maximize' for maximization.\n A synonym for 'direction maximize'." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::MAXNODES, "maxN!odes", "Maximum number of nodes to evaluate", 1, 2147483647) ; param->setObj(model) ; param->setLongHelp( "This is a repeatable way to limit search. Normally using time is easier but then the results may not be repeatable." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::MINIMIZE, "min!imize", "Set optimization direction to minimize") ; param->setObj(model) ; param->setLongHelp( "The default is minimize - use 'maximize' for maximization.\nThis should only be necessary if you have previously set maximization. A synonym for 'direction minimize'." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::MIPOPTIONS, "mipO!ptions", "Dubious options for mip", 0, COIN_INT_MAX, 0, false) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::MOREMIPOPTIONS, "more!MipOptions", "More dubious options for mip", -1, COIN_INT_MAX, 0, false) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::NUMBERMINI, "miniT!ree", "Size of fast mini tree", 0, COIN_INT_MAX, 0, false) ; param->setObj(model) ; param->setLongHelp( "The idea is that I can do a small tree fast. This is a first try and will hopefully become more sophisticated." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::NUMBERANALYZE, "numberA!nalyze", "Number of analysis iterations", -COIN_INT_MAX, COIN_INT_MAX, false) ; param->setObj(model) ; param->setLongHelp( "This says how many iterations to spend at the root node analyzing the problem. This is a first try and will hopefully become more sophisticated." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::CUTPASS, "passC!uts", "Number of cut passes at root node", -999999, 999999, model->getMaximumCutPassesAtRoot()) ; param->setObj(model) ; param->setLongHelp( "The default is 100 passes if less than 500 columns, 100 passes (but stop if the drop is small) if less than 5000 columns, 20 otherwise." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::GAPRATIO, "ratio!Gap", "Stop when the gap between the best possible solution and the incumbent is less than this fraction of the larger of the two", 0.0, 1.0e20, model->getDblParam(CbcModel::CbcAllowableFractionGap)) ; param->setPushFunc(pushCbcCbcDbl) ; param->setObj(model) ; param->setLongHelp( "If the gap between the best solution and the best possible solution is less than this fraction of the objective value at the root node then the search will terminate. See 'allowableGap' for a way of using absolute value rather than fraction." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::TIMELIMIT_BAB, "sec!onds", "Maximum seconds for branch and cut", -1.0, 1.0e12) ; param->setPushFunc(pushCbcCbcDbl) ; param->setObj(model) ; param->setLongHelp( "After this many seconds the program will act as if maximum nodes had been reached." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::STRONGBRANCHING, "strong!Branching", "Number of variables to look at in strong branching", 0, 999999, model->numberStrong()) ; param->setObj(model) ; param->setLongHelp( "In order to decide which variable to branch on, the code will choose up to this number of unsatisfied variables and try mini up and down branches. The most effective one is chosen. If a variable is branched on many times then the previous average up and down costs may be used - see number before trust." ) ; parameters.push_back(param) ; param = new CbcCbcParam(CbcCbcParam::NUMBERBEFORE, "trust!PseudoCosts", "Number of branches before we trust pseudocosts", -1, 2000000, model->numberBeforeTrust()) ; param->setObj(model) ; param->setPushFunc(pushCbcCbcInt) ; param->setLongHelp( "Using strong branching computes pseudo-costs. After this many times for a variable we just trust the pseudo costs and do not do any more strong branching." ) ; parameters.push_back(param) ; numberParameters = parameters.size() ; assert (numberParameters <= parameters.capacity()) ; } void loadCbcParamObj (const CoinParamVec paramVec, int first, int last, CbcModel *obj) { int i ; /* Load the CbcModel object into the parameters */ for (i = first ; i <= last ; i++) { CbcCbcParam *cbcParam = dynamic_cast(paramVec[i]) ; assert (cbcParam != 0) ; cbcParam->setObj(obj) ; } return ; } /* Set CbcModel defaults appropriate for cbc-generic. */ void setCbcModelDefaults (CbcModel *model) { model->setIntParam(CbcModel::CbcMaxNumNode, (COIN_INT_MAX / 2)) ; model->setIntParam(CbcModel::CbcMaxNumSol, 999999) ; model->setIntParam(CbcModel::CbcFathomDiscipline, 0) ; model->setDblParam(CbcModel::CbcIntegerTolerance, 1.0e-6) ; model->setDblParam(CbcModel::CbcInfeasibilityWeight, 0.0) ; model->setDblParam(CbcModel::CbcCutoffIncrement, 1.0e-5) ; model->setDblParam(CbcModel::CbcAllowableGap, 1.0e-10) ; model->setDblParam(CbcModel::CbcAllowableFractionGap, 0.0) ; // One year is 60x60x24x365 = 31,536,000 seconds. model->setDblParam(CbcModel::CbcMaximumSeconds, 3.0e7) ; model->setDblParam(CbcModel::CbcCurrentCutoff, 1.0e100) ; model->setDblParam(CbcModel::CbcOptimizationDirection, 1.0) ; model->setDblParam(CbcModel::CbcCurrentObjectiveValue, 1.0e100) ; model->setDblParam(CbcModel::CbcCurrentMinimizationObjectiveValue, 1.0e100) ; model->setDblParam(CbcModel::CbcStartSeconds, 0.0) ; model->setNumberBeforeTrust(5) ; model->setNumberStrong(5) ; return ; } /* Function to push a double parameter. */ int pushCbcCbcDbl (CoinParam *param) { assert (param != 0) ; CbcCbcParam *cbcParam = dynamic_cast(param) ; assert (cbcParam != 0) ; CbcModel *model = cbcParam->obj() ; double val = cbcParam->dblVal() ; CbcCbcParam::CbcCbcParamCode code = cbcParam->paramCode() ; assert (model != 0) ; int retval = 0 ; /* Translate the parameter code from CbcCbcParamCode into the correct key for CbcDblParam. */ CbcModel::CbcDblParam key ; switch (code) { case CbcCbcParam::INTEGERTOLERANCE: { key = CbcModel::CbcIntegerTolerance ; break ; } case CbcCbcParam::INFEASIBILITYWEIGHT: { key = CbcModel::CbcInfeasibilityWeight ; break ; } case CbcCbcParam::INCREMENT: { key = CbcModel::CbcCutoffIncrement ; break ; } case CbcCbcParam::ALLOWABLEGAP: { key = CbcModel::CbcAllowableGap ; break ; } case CbcCbcParam::GAPRATIO: { key = CbcModel::CbcAllowableFractionGap ; break ; } case CbcCbcParam::TIMELIMIT_BAB: { key = CbcModel::CbcMaximumSeconds ; break ; } case CbcCbcParam::CUTOFF: { key = CbcModel::CbcCurrentCutoff ; break ; } default: { std::cerr << "pushCbcCbcDbl: no equivalent CbcDblParam for " << "parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } bool result = model->setDblParam(key, val) ; if (result == false) { retval = -1 ; } return (retval) ; } /* Function to push an integer parameter. */ int pushCbcCbcInt (CoinParam *param) { assert (param != 0) ; CbcCbcParam *cbcParam = dynamic_cast(param) ; assert (cbcParam != 0) ; CbcModel *model = cbcParam->obj() ; int val = cbcParam->intVal() ; CbcCbcParam::CbcCbcParamCode code = cbcParam->paramCode() ; assert (model != 0) ; int retval = 0 ; /* Translate the parameter code from CbcCbcParamCode into the correct key for CbcIntParam, or call the appropriate method directly. */ CbcModel::CbcIntParam key = CbcModel::CbcLastIntParam ; switch (code) { case CbcCbcParam::CUTPASS: { model->setMaximumCutPassesAtRoot(val) ; break ; } case CbcCbcParam::LOGLEVEL: { CoinMessageHandler *hndl = model->messageHandler() ; assert (hndl != 0) ; hndl->setLogLevel(val) ; break ; } case CbcCbcParam::NUMBERBEFORE: { model->setNumberBeforeTrust(val) ; break ; } default: { std::cerr << "pushCbcCbcInt: no equivalent CbcIntParam for " << "parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } if (key != CbcModel::CbcLastIntParam) { bool result = model->setIntParam(key, val) ; if (result == false) { retval = -1 ; } } return (retval) ; } } // end namespace CbcCbcParamUtils CoinMP-1.8.3/Cbc/src/CbcConfig.h0000644000175000017500000000253712101340057014560 0ustar renerene/* Copyright (C) 2011 * All Rights Reserved. * This code is published under the Eclipse Public License. * * $Id: CbcConfig.h 1854 2013-01-28 00:02:55Z stefan $ * * Include file for the configuration of Cbc. * * On systems where the code is configured with the configure script * (i.e., compilation is always done with HAVE_CONFIG_H defined), this * header file includes the automatically generated header file, and * undefines macros that might configure with other Config.h files. * * On systems that are compiled in other ways (e.g., with the * Developer Studio), a header files is included to define those * macros that depend on the operating system and the compiler. The * macros that define the configuration of the particular user setting * (e.g., presence of other COIN-OR packages or third party code) are set * by the files config_*default.h. The project maintainer needs to remember * to update these file and choose reasonable defines. * A user can modify the default setting by editing the config_*default.h files. * */ #ifndef __CBCCONFIG_H__ #define __CBCCONFIG_H__ #ifdef HAVE_CONFIG_H #ifdef CBC_BUILD #include "config.h" #else #include "config_cbc.h" #endif #else /* HAVE_CONFIG_H */ #ifdef CBC_BUILD #include "config_default.h" #else #include "config_cbc_default.h" #endif #endif /* HAVE_CONFIG_H */ #endif /*__CBCCONFIG_H__*/ CoinMP-1.8.3/Cbc/src/CbcObjectUpdateData.cpp0000644000175000017500000000463612131054770017062 0ustar renerene// $Id: CbcObjectUpdateData.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "OsiChooseVariable.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchBase.hpp" #include "CbcObjectUpdateData.hpp" // Default constructor CbcObjectUpdateData::CbcObjectUpdateData() : object_(NULL), way_(0), objectNumber_(-1), change_(0.0), status_(0), intDecrease_(0), branchingValue_(0.0), originalObjective_(COIN_DBL_MAX), cutoff_(COIN_DBL_MAX) { } // Useful constructor CbcObjectUpdateData::CbcObjectUpdateData (CbcObject * object, int way, double change, int status, int intDecrease, double branchingValue) : object_(object), way_(way), objectNumber_(-1), change_(change), status_(status), intDecrease_(intDecrease), branchingValue_(branchingValue), originalObjective_(COIN_DBL_MAX), cutoff_(COIN_DBL_MAX) { } // Destructor CbcObjectUpdateData::~CbcObjectUpdateData () { } // Copy constructor CbcObjectUpdateData::CbcObjectUpdateData ( const CbcObjectUpdateData & rhs) : object_(rhs.object_), way_(rhs.way_), objectNumber_(rhs.objectNumber_), change_(rhs.change_), status_(rhs.status_), intDecrease_(rhs.intDecrease_), branchingValue_(rhs.branchingValue_), originalObjective_(rhs.originalObjective_), cutoff_(rhs.cutoff_) { } // Assignment operator CbcObjectUpdateData & CbcObjectUpdateData::operator=( const CbcObjectUpdateData & rhs) { if (this != &rhs) { object_ = rhs.object_; way_ = rhs.way_; objectNumber_ = rhs.objectNumber_; change_ = rhs.change_; status_ = rhs.status_; intDecrease_ = rhs.intDecrease_; branchingValue_ = rhs.branchingValue_; originalObjective_ = rhs.originalObjective_; cutoff_ = rhs.cutoff_; } return *this; } CoinMP-1.8.3/Cbc/src/CbcCompareDepth.hpp0000644000175000017500000000256312131054770016274 0ustar renerene// $Id: CbcCompareDepth.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/24/09 carved out of CbcCompareActual #ifndef CbcCompareDepth_H #define CbcCompareDepth_H //############################################################################# /* These are alternative strategies for node traversal. They can take data etc for fine tuning At present the node list is stored as a heap and the "test" comparison function returns true if node y is better than node x. */ #include "CbcNode.hpp" #include "CbcCompareBase.hpp" #include "CbcCompare.hpp" class CbcModel; // This is default before first solution class CbcCompareDepth : public CbcCompareBase { public: // Default Constructor CbcCompareDepth () ; ~CbcCompareDepth(); // Copy constructor CbcCompareDepth ( const CbcCompareDepth &rhs); // Assignment operator CbcCompareDepth & operator=( const CbcCompareDepth& rhs); /// Clone virtual CbcCompareBase * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp); // This returns true if the depth of node y is greater than depth of node x virtual bool test (CbcNode * x, CbcNode * y); }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicRINS.cpp0000644000175000017500000003211012432625130016334 0ustar renerene/* $Id: CbcHeuristicRINS.cpp 2094 2014-11-18 11:15:36Z forrest $ */ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristicRINS.hpp" #include "CbcBranchActual.hpp" #include "CbcStrategy.hpp" #include "CglPreProcess.hpp" // Default Constructor CbcHeuristicRINS::CbcHeuristicRINS() : CbcHeuristic() { numberSolutions_ = 0; numberSuccesses_ = 0; numberTries_ = 0; stateOfFixing_ = 0; shallowDepth_ = 0; lastNode_ = -999999; howOften_ = 100; decayFactor_ = 0.5; used_ = NULL; whereFrom_ = 1 + 8 + 16 + 255 * 256; whereFrom_ = 1 + 8 + 255 * 256; } // Constructor with model - assumed before cuts CbcHeuristicRINS::CbcHeuristicRINS(CbcModel & model) : CbcHeuristic(model) { numberSolutions_ = 0; numberSuccesses_ = 0; numberTries_ = 0; stateOfFixing_ = 0; shallowDepth_ = 0; lastNode_ = -999999; howOften_ = 100; decayFactor_ = 0.5; assert(model.solver()); int numberColumns = model.solver()->getNumCols(); used_ = new char[numberColumns]; memset(used_, 0, numberColumns); whereFrom_ = 1 + 8 + 16 + 255 * 256; whereFrom_ = 1 + 8 + 255 * 256; } // Destructor CbcHeuristicRINS::~CbcHeuristicRINS () { delete [] used_; } // Clone CbcHeuristic * CbcHeuristicRINS::clone() const { return new CbcHeuristicRINS(*this); } // Assignment operator CbcHeuristicRINS & CbcHeuristicRINS::operator=( const CbcHeuristicRINS & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); numberSolutions_ = rhs.numberSolutions_; howOften_ = rhs.howOften_; numberSuccesses_ = rhs.numberSuccesses_; numberTries_ = rhs.numberTries_; stateOfFixing_ = rhs.stateOfFixing_; lastNode_ = rhs.lastNode_; delete [] used_; if (model_ && rhs.used_) { int numberColumns = model_->solver()->getNumCols(); used_ = new char[numberColumns]; memcpy(used_, rhs.used_, numberColumns); } else { used_ = NULL; } } return *this; } // Create C++ lines to get to current state void CbcHeuristicRINS::generateCpp( FILE * fp) { CbcHeuristicRINS other; fprintf(fp, "0#include \"CbcHeuristicRINS.hpp\"\n"); fprintf(fp, "3 CbcHeuristicRINS heuristicRINS(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicRINS"); if (howOften_ != other.howOften_) fprintf(fp, "3 heuristicRINS.setHowOften(%d);\n", howOften_); else fprintf(fp, "4 heuristicRINS.setHowOften(%d);\n", howOften_); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicRINS);\n"); } // Copy constructor CbcHeuristicRINS::CbcHeuristicRINS(const CbcHeuristicRINS & rhs) : CbcHeuristic(rhs), numberSolutions_(rhs.numberSolutions_), howOften_(rhs.howOften_), numberSuccesses_(rhs.numberSuccesses_), numberTries_(rhs.numberTries_), stateOfFixing_(rhs.stateOfFixing_), lastNode_(rhs.lastNode_) { if (model_ && rhs.used_) { int numberColumns = model_->solver()->getNumCols(); used_ = new char[numberColumns]; memcpy(used_, rhs.used_, numberColumns); } else { used_ = NULL; } } // Resets stuff if model changes void CbcHeuristicRINS::resetModel(CbcModel * /*model*/) { //CbcHeuristic::resetModel(model); delete [] used_; stateOfFixing_ = 0; if (model_ && used_) { int numberColumns = model_->solver()->getNumCols(); used_ = new char[numberColumns]; memset(used_, 0, numberColumns); } else { used_ = NULL; } } /* First tries setting a variable to better value. If feasible then tries setting others. If not feasible then tries swaps Returns 1 if solution, 0 if not */ int CbcHeuristicRINS::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; int returnCode = 0; const double * bestSolution = model_->bestSolution(); if (!bestSolution) return 0; // No solution found yet #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif if (numberSolutions_ < model_->getSolutionCount()) { // new solution - add info numberSolutions_ = model_->getSolutionCount(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double value = bestSolution[iColumn]; if (value < originalLower) { value = originalLower; } else if (value > originalUpper) { value = originalUpper; } double nearest = floor(value + 0.5); // if away from lower bound mark that fact if (nearest > originalLower) { used_[iColumn] = 1; } } } int numberNodes = model_->getNodeCount(); if (howOften_ == 100) { if (numberNodes < lastNode_ + 12) return 0; // Do at 50 and 100 if ((numberNodes > 40 && numberNodes <= 50) || (numberNodes > 90 && numberNodes < 100)) numberNodes = howOften_; } // Allow for infeasible nodes - so do anyway after a bit if (howOften_ >= 100 && numberNodes >= lastNode_ + 2*howOften_) { numberNodes = howOften_; } if ((numberNodes % howOften_) == 0 && (model_->getCurrentPassNumber() <= 1 || model_->getCurrentPassNumber() == 999999)) { lastNode_ = model_->getNodeCount(); OsiSolverInterface * solver = model_->solver(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); const double * currentSolution = solver->getColSolution(); const int * used = model_->usedInSolution(); OsiSolverInterface * newSolver = cloneBut(3); // was model_->continuousSolver()->clone(); int numberColumns = newSolver->getNumCols(); int numberContinuous = numberColumns - numberIntegers; double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); int i; int nFix = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double valueInt = bestSolution[iColumn]; if (valueInt < originalLower) { valueInt = originalLower; } else if (valueInt > originalUpper) { valueInt = originalUpper; } if (fabs(currentSolution[iColumn] - valueInt) < 10.0*primalTolerance) { double nearest = floor(valueInt + 0.5); /* shallowDepth_ 0 - normal 1 - only fix if at lb 2 - only fix if not at lb 3 - only fix if at lb and !used */ bool fix=false; switch (shallowDepth_) { case 0: fix = true; break; case 1: if (nearest==originalLower) fix = true; break; case 2: if (nearest!=originalLower) fix = true; break; case 3: if (nearest==originalLower && !used[iColumn]) fix = true; break; } if (fix) { newSolver->setColLower(iColumn, nearest); newSolver->setColUpper(iColumn, nearest); nFix++; } } } int divisor = 0; if (5*nFix > numberIntegers) { if (numberContinuous > 2*numberIntegers && ((nFix*10 < numberColumns && !numRuns_ && numberTries_ > 2) || stateOfFixing_)) { #define RINS_FIX_CONTINUOUS #ifdef RINS_FIX_CONTINUOUS const double * colLower = newSolver->getColLower(); //const double * colUpper = newSolver->getColUpper(); int nAtLb = 0; //double sumDj=0.0; const double * dj = newSolver->getReducedCost(); double direction = newSolver->getObjSense(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn)) { double value = bestSolution[iColumn]; if (value < colLower[iColumn] + 1.0e-8) { //double djValue = dj[iColumn]*direction; nAtLb++; //sumDj += djValue; } } } if (nAtLb) { // fix some continuous double * sort = new double[nAtLb]; int * which = new int [nAtLb]; //double threshold = CoinMax((0.01*sumDj)/static_cast(nAtLb),1.0e-6); int nFix2 = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn)) { double value = bestSolution[iColumn]; if (value < colLower[iColumn] + 1.0e-8) { double djValue = dj[iColumn] * direction; if (djValue > 1.0e-6) { sort[nFix2] = -djValue; which[nFix2++] = iColumn; } } } } CoinSort_2(sort, sort + nFix2, which); divisor = 4; if (stateOfFixing_ > 0) divisor = stateOfFixing_; else if (stateOfFixing_ < -1) divisor = (-stateOfFixing_) - 1; nFix2 = CoinMin(nFix2, (numberColumns - nFix) / divisor); for (int i = 0; i < nFix2; i++) { int iColumn = which[i]; newSolver->setColUpper(iColumn, colLower[iColumn]); } delete [] sort; delete [] which; #ifdef CLP_INVESTIGATE2 printf("%d integers have same value, and %d continuous fixed at lb\n", nFix, nFix2); #endif } #endif } if (solutionValue==-COIN_DBL_MAX) { // return fixings in betterSolution const double * colLower = newSolver->getColLower(); const double * colUpper = newSolver->getColUpper(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colLower[iColumn]==colUpper[iColumn]) betterSolution[iColumn]=colLower[iColumn]; else betterSolution[iColumn]=COIN_DBL_MAX; } delete newSolver; return 0; } //printf("RINS %d integers have same value\n",nFix); returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, model_->getCutoff(), "CbcHeuristicRINS"); if (returnCode < 0) { returnCode = 0; // returned on size if (divisor) { stateOfFixing_ = - divisor; // say failed } else if (numberContinuous > 2*numberIntegers && !numRuns_ && numberTries_ > 2) { stateOfFixing_ = -4; //start fixing } } else { numRuns_++; if (divisor) stateOfFixing_ = divisor; // say small enough } if ((returnCode&1) != 0) numberSuccesses_++; //printf("return code %d",returnCode); if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; //printf("could add cut with %d elements (if all 0-1)\n",nFix); } else { //printf("\n"); } } numberTries_++; if ((numberTries_ % 10) == 0 && numberSuccesses_*3 < numberTries_) howOften_ += static_cast (howOften_ * decayFactor_); delete newSolver; } return returnCode; } // update model void CbcHeuristicRINS::setModel(CbcModel * model) { model_ = model; // Get a copy of original matrix assert(model_->solver()); delete [] used_; int numberColumns = model->solver()->getNumCols(); used_ = new char[numberColumns]; memset(used_, 0, numberColumns); } CoinMP-1.8.3/Cbc/src/CbcCompareDepth.cpp0000644000175000017500000000340612131054770016264 0ustar renerene// $Id: CbcCompareDepth.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/24/09 carved out of CbcCompareActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CbcMessage.hpp" #include "CbcModel.hpp" #include "CbcTree.hpp" #include "CbcCompareActual.hpp" #include "CoinError.hpp" #include "CbcCompareDepth.hpp" /** Default Constructor */ CbcCompareDepth::CbcCompareDepth () : CbcCompareBase() { test_ = this; } // Copy constructor CbcCompareDepth::CbcCompareDepth ( const CbcCompareDepth & rhs) : CbcCompareBase(rhs) { } // Clone CbcCompareBase * CbcCompareDepth::clone() const { return new CbcCompareDepth(*this); } // Assignment operator CbcCompareDepth & CbcCompareDepth::operator=( const CbcCompareDepth & rhs) { if (this != &rhs) { CbcCompareBase::operator=(rhs); } return *this; } // Destructor CbcCompareDepth::~CbcCompareDepth () { } // Returns true if y better than x bool CbcCompareDepth::test (CbcNode * x, CbcNode * y) { int testX = x->depth(); int testY = y->depth(); if (testX != testY) return testX < testY; else return equalityTest(x, y); // so ties will be broken in consistent manner } // Create C++ lines to get to current state void CbcCompareDepth::generateCpp( FILE * fp) { fprintf(fp, "0#include \"CbcCompareActual.hpp\"\n"); fprintf(fp, "3 CbcCompareDepth compare;\n"); fprintf(fp, "3 cbcModel->setNodeComparison(compare);\n"); } CoinMP-1.8.3/Cbc/src/CbcCountRowCut.cpp0000644000175000017500000004336012463371352016156 0ustar renerene/* $Id: CbcCountRowCut.cpp 2124 2015-02-01 09:33:30Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include "OsiRowCut.hpp" #include "CbcModel.hpp" #include "CbcCountRowCut.hpp" #include "CbcNode.hpp" //#define CHECK_CUT_COUNTS // Default Constructor CbcCountRowCut::CbcCountRowCut () : OsiRowCut(), owner_(NULL), ownerCut_(-1), numberPointingToThis_(0), whichCutGenerator_(-1) { #ifdef CHECK_CUT_COUNTS printf("CbcCountRowCut default constructor %x\n", this); #endif } // Copy Constructor CbcCountRowCut::CbcCountRowCut (const OsiRowCut & rhs) : OsiRowCut(rhs), owner_(NULL), ownerCut_(-1), numberPointingToThis_(0), whichCutGenerator_(-1) { #ifdef CHECK_CUT_COUNTS printf("CbcCountRowCut constructor %x from RowCut\n", this); #endif } // Copy Constructor CbcCountRowCut::CbcCountRowCut (const OsiRowCut & rhs, CbcNodeInfo * info, int whichOne, int whichGenerator, int numberPointingToThis) : OsiRowCut(rhs), owner_(info), ownerCut_(whichOne), numberPointingToThis_(numberPointingToThis), whichCutGenerator_(whichGenerator) { #ifdef CHECK_CUT_COUNTS printf("CbcCountRowCut constructor %x from RowCut and info %d\n", this, numberPointingToThis_); #endif //assert (!numberPointingToThis||numberPointingToThis==1000000000); } CbcCountRowCut::~CbcCountRowCut() { #ifdef CHECK_CUT_COUNTS printf("CbcCountRowCut destructor %x - references %d\n", this, numberPointingToThis_); #endif // Look at owner and delete if (owner_) owner_->deleteCut(ownerCut_); ownerCut_ = -1234567; } // Increment number of references void CbcCountRowCut::increment(int change) { assert(ownerCut_ != -1234567); numberPointingToThis_ += change; } // Decrement number of references and return number left int CbcCountRowCut::decrement(int change) { assert(ownerCut_ != -1234567); // See if plausible number if (change < 900000000) { //assert(numberPointingToThis_>=change); assert(numberPointingToThis_ >= 0); if (numberPointingToThis_ < change) { assert(numberPointingToThis_ > 0); COIN_DETAIL_PRINT(printf("negative cut count %d - %d\n", numberPointingToThis_, change)); change = numberPointingToThis_; } numberPointingToThis_ -= change; } return numberPointingToThis_; } // Set information void CbcCountRowCut::setInfo(CbcNodeInfo * info, int whichOne) { owner_ = info; ownerCut_ = whichOne; } // Returns true if can drop cut if slack basic bool CbcCountRowCut::canDropCut(const OsiSolverInterface * solver, int iRow) const { // keep if COIN_DBL_MAX otherwise keep if slack zero if (effectiveness() < 1.0e20) { return true; } else if (effectiveness() != COIN_DBL_MAX) { if (iRow >= solver->getNumRows()) return true; const double * rowActivity = solver->getRowActivity(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); double tolerance; solver->getDblParam(OsiPrimalTolerance, tolerance) ; double value = rowActivity[iRow]; if (value < rowLower[iRow] + tolerance || value > rowUpper[iRow] - tolerance) return false; else return true; } else { return false; } } static double multiplier[] = {1.23456789e2,-9.87654321}; static int hashCut (const OsiRowCut2 & x, int size) { int xN =x.row().getNumElements(); double xLb = x.lb(); double xUb = x.ub(); const int * xIndices = x.row().getIndices(); const double * xElements = x.row().getElements(); unsigned int hashValue; double value=1.0; if (xLb>-1.0e10) value += xLb*multiplier[0]; if (xUb<1.0e10) value += xUb*multiplier[1]; for( int j=0;jsizeof(hashValue)) { assert (sizeof(value)==2*sizeof(hashValue)); union { double d; int i[2]; } xx; xx.d = value; hashValue = (xx.i[0] + xx.i[1]); } else { assert (sizeof(value)==sizeof(hashValue)); union { double d; unsigned int i[2]; } xx; xx.d = value; hashValue = xx.i[0]; } return hashValue%(size); } static int hashCut2 (const OsiRowCut2 & x, int size) { int xN =x.row().getNumElements(); double xLb = x.lb(); double xUb = x.ub(); const int * xIndices = x.row().getIndices(); const double * xElements = x.row().getElements(); unsigned int hashValue; double value=1.0; if (xLb>-1.0e10) value += xLb*multiplier[0]; if (xUb<1.0e10) value += xUb*multiplier[1]; for( int j=0;jsizeof(hashValue)) { assert (sizeof(value)==2*sizeof(hashValue)); union { double d; int i[2]; } xx; xx.d = value; hashValue = (xx.i[0] + xx.i[1]); } else { assert (sizeof(value)==sizeof(hashValue)); union { double d; unsigned int i[2]; } xx; xx.d = value; hashValue = xx.i[0]; } return hashValue%(size); } static bool same (const OsiRowCut2 & x, const OsiRowCut2 & y) { int xN =x.row().getNumElements(); int yN =y.row().getNumElements(); bool identical=false; if (xN==yN) { double xLb = x.lb(); double xUb = x.ub(); double yLb = y.lb(); double yUb = y.ub(); if (fabs(xLb-yLb)<1.0e-8&&fabs(xUb-yUb)<1.0e-8) { const int * xIndices = x.row().getIndices(); const double * xElements = x.row().getElements(); const int * yIndices = y.row().getIndices(); const double * yElements = y.row().getElements(); int j; for( j=0;j1.0e-12) break; } identical = (j==xN); } } return identical; } static bool same2 (const OsiRowCut2 & x, const OsiRowCut2 & y) { int xN =x.row().getNumElements(); int yN =y.row().getNumElements(); bool identical=false; if (xN==yN) { double xLb = x.lb(); double xUb = x.ub(); double yLb = y.lb(); double yUb = y.ub(); if (fabs(xLb-yLb)<1.0e-8&&fabs(xUb-yUb)<1.0e-8) { const int * xIndices = x.row().getIndices(); const double * xElements = x.row().getElements(); const int * yIndices = y.row().getIndices(); const double * yElements = y.row().getElements(); int j; for( j=0;j1.0e-12) break; } identical = (j==xN); } } return identical; } CbcRowCuts::CbcRowCuts(int initialMaxSize, int hashMultiplier) { numberCuts_=0; size_ = initialMaxSize; hashMultiplier_ = hashMultiplier; int hashSize=hashMultiplier_*size_; if (size_) { rowCut_ = new OsiRowCut2 * [size_]; hash_ = new CoinHashLink[hashSize]; } else { rowCut_ = NULL; hash_ = NULL; } for (int i=0;i=0&&sequence= 0 ) { if (j1!=sequence) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } assert (found>=0); assert (hash_[ipos].index==sequence); // shuffle up while (hash_[ipos].next>=0) { int k = hash_[ipos].next; hash_[ipos]=hash_[k]; ipos=k; } hash_[ipos].index=-1; // move last to found numberCuts_--; assert (found==numberCuts_); // debug when fails if (numberCuts_&&found=0); } else { // change hash_[ipos].index=found; rowCut_[found]=rowCut_[numberCuts_]; rowCut_[numberCuts_]=NULL; break; } } } delete cut; rowCut_[numberCuts_]=NULL; //assert (!rowCut_[numberCuts_-1]); } // Truncate void CbcRowCuts::truncate(int numberAfter) { if (numberAfter<0||numberAfter>=numberCuts_) return; for (int i=numberAfter;i= 0 ) { if ( !same(*temp[i],*temp[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=i; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_= 0 ) { if ( !same(*temp[i],*temp[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=i; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_1.0e12) bad=true; } if (bad) return 1; OsiRowCut2 newCut(whichType); newCut.setLb(newLb); newCut.setUb(newUb); newCut.setRow(vector); int ipos = hashCut(newCut,hashSize); int found = -1; int jpos=ipos; while ( true ) { int j1 = hash_[ipos].index; if ( j1 >= 0 ) { if ( !same(newCut,*rowCut_[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=numberCuts_; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_setLb(newLb); newCutPtr->setUb(newUb); newCutPtr->setRow(vector); newCutPtr->setGloballyValid(globallyValid); rowCut_[numberCuts_++]=newCutPtr; //printf("addedGlobalCut of size %d to %x - cuts size %d\n", // cut.row().getNumElements(),this,numberCuts_); return 0; } else { return 1; } } else { return -1; } } // Return 0 if added, 1 if not, -1 if not added because of space int CbcRowCuts::addCutIfNotDuplicateWhenGreedy(const OsiRowCut & cut,int whichType) { int hashSize= size_*hashMultiplier_; if (numberCuts_==size_) { size_ = 2*size_+100; hashSize=hashMultiplier_*size_; OsiRowCut2 ** temp = new OsiRowCut2 * [size_]; delete [] hash_; hash_ = new CoinHashLink[hashSize]; for (int i=0;i= 0 ) { if ( !same2(*temp[i],*temp[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=i; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_1.0e12) bad=true; } if (bad) return 1; OsiRowCut2 newCut(whichType); newCut.setLb(newLb); newCut.setUb(newUb); newCut.setRow(vector); int ipos = hashCut2(newCut,hashSize); int found = -1; int jpos=ipos; while ( true ) { int j1 = hash_[ipos].index; if ( j1 >= 0 ) { if ( !same2(newCut,*rowCut_[j1]) ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { break; } } if (found<0) { assert (hash_[ipos].next==-1); if (ipos==jpos) { // first hash_[ipos].index=numberCuts_; } else { // find next space while ( true ) { ++lastHash_; assert (lastHash_setLb(newLb); newCutPtr->setUb(newUb); newCutPtr->setRow(vector); rowCut_[numberCuts_++]=newCutPtr; //printf("addedGreedyGlobalCut of size %d to %p - cuts size %d\n", // cut.row().getNumElements(),this,numberCuts_); return 0; } else { return 1; } } else { return -1; } } // Add in cuts as normal cuts and delete void CbcRowCuts::addCuts(OsiCuts & cs) { for (int i=0;i
  • 1 -- 100 double parameters
  • 101 -- 200 integer parameters
  • 201 -- 250 string parameters
  • 251 -- 300 cuts etc(string but broken out for clarity)
  • 301 -- 400 `actions' `Actions' do not necessarily invoke an immediate action; it's just that they don't fit neatly into the parameters array. This coding scheme is in flux. CBC_PARAM_STR_NODESTRATEGY, CBC_PARAM_STR_BRANCHSTRATEGY, CBC_PARAM_NOTUSED_ADDCUTSSTRATEGY, CLP_PARAM_ACTION_CLEARCUTS, CBC_PARAM_NOTUSED_OSLSTUFF, CBC_PARAM_NOTUSED_CBCSTUFF are not used at present (03.10.24). */ enum CbcParameterType { CBC_PARAM_GENERALQUERY = -100, CBC_PARAM_FULLGENERALQUERY, CLP_PARAM_DBL_PRIMALTOLERANCE = 1, CLP_PARAM_DBL_DUALTOLERANCE, CBC_PARAM_DBL_CUTOFF, CLP_PARAM_DBL_TIMELIMIT, CLP_PARAM_DBL_DUALBOUND, CLP_PARAM_DBL_PRIMALWEIGHT, CLP_PARAM_DBL_OBJSCALE, CLP_PARAM_DBL_RHSSCALE, CBC_PARAM_DBL_INFEASIBILITYWEIGHT = 51, CBC_PARAM_DBL_INTEGERTOLERANCE, CBC_PARAM_DBL_INCREMENT, CBC_PARAM_DBL_ALLOWABLEGAP, CBC_PARAM_DBL_DJFIX = 81, CBC_PARAM_DBL_GAPRATIO, CBC_PARAM_DBL_TIGHTENFACTOR, CLP_PARAM_INT_LOGLEVEL = 101, CLP_PARAM_INT_SOLVERLOGLEVEL, CBC_PARAM_INT_MAXNODES, CBC_PARAM_INT_STRONGBRANCHING, CLP_PARAM_INT_MAXFACTOR, CLP_PARAM_INT_PERTVALUE, CLP_PARAM_INT_MAXITERATION, CLP_PARAM_INT_PRESOLVEPASS, CLP_PARAM_INT_IDIOT, CLP_PARAM_INT_SPRINT, CLP_PARAM_INT_OUTPUTFORMAT, CLP_PARAM_INT_SLPVALUE, CLP_PARAM_INT_PRESOLVEOPTIONS, CLP_PARAM_INT_PRINTOPTIONS, CLP_PARAM_INT_SPECIALOPTIONS, CLP_PARAM_STR_DIRECTION = 201, CLP_PARAM_STR_DUALPIVOT, CLP_PARAM_STR_SCALING, CLP_PARAM_STR_ERRORSALLOWED, CLP_PARAM_STR_KEEPNAMES, CLP_PARAM_STR_SPARSEFACTOR, CLP_PARAM_STR_PRIMALPIVOT, CLP_PARAM_STR_PRESOLVE, CLP_PARAM_STR_CRASH, CLP_PARAM_STR_BIASLU, CLP_PARAM_STR_PERTURBATION, CLP_PARAM_STR_MESSAGES, CLP_PARAM_STR_AUTOSCALE, CLP_PARAM_STR_CHOLESKY, CLP_PARAM_STR_KKT, CLP_PARAM_STR_BARRIERSCALE, CLP_PARAM_STR_GAMMA, CLP_PARAM_STR_CROSSOVER, CLP_PARAM_STR_PFI, CLP_PARAM_NOTUSED_ALGORITHM, CBC_PARAM_STR_NODESTRATEGY = 251, CBC_PARAM_STR_BRANCHSTRATEGY, CBC_PARAM_NOTUSED_ADDCUTSSTRATEGY, CBC_PARAM_STR_GOMORYCUTS, CBC_PARAM_STR_PROBINGCUTS, CBC_PARAM_STR_KNAPSACKCUTS, CBC_PARAM_NOTUSED_ODDHOLECUTS, CBC_PARAM_STR_ROUNDING, CBC_PARAM_STR_SOLVER, CBC_PARAM_STR_CLIQUECUTS, CBC_PARAM_STR_COSTSTRATEGY, CBC_PARAM_STR_FLOWCUTS, CBC_PARAM_STR_MIXEDCUTS, CBC_PARAM_STR_TWOMIRCUTS, CBC_PARAM_STR_PREPROCESS, CLP_PARAM_ACTION_DIRECTORY = 301, CLP_PARAM_ACTION_IMPORT, CLP_PARAM_ACTION_EXPORT, CLP_PARAM_ACTION_RESTORE, CLP_PARAM_ACTION_SAVE, CLP_PARAM_ACTION_DUALSIMPLEX, CLP_PARAM_ACTION_PRIMALSIMPLEX, CLP_PARAM_ACTION_MAXIMIZE, CLP_PARAM_ACTION_MINIMIZE, CLP_PARAM_ACTION_EXIT, CLP_PARAM_ACTION_STDIN, CLP_PARAM_ACTION_UNITTEST, CLP_PARAM_ACTION_NETLIB_DUAL, CLP_PARAM_ACTION_NETLIB_PRIMAL, CLP_PARAM_ACTION_SOLUTION, CLP_PARAM_ACTION_TIGHTEN, CLP_PARAM_ACTION_FAKEBOUND, CLP_PARAM_ACTION_HELP, CLP_PARAM_ACTION_PLUSMINUS, CLP_PARAM_ACTION_NETWORK, CLP_PARAM_ACTION_ALLSLACK, CLP_PARAM_ACTION_REVERSE, CLP_PARAM_ACTION_BARRIER, CLP_PARAM_ACTION_NETLIB_BARRIER, CLP_PARAM_ACTION_REALLY_SCALE, CLP_PARAM_ACTION_BASISIN, CLP_PARAM_ACTION_BASISOUT, CLP_PARAM_ACTION_SOLVECONTINUOUS, CBC_PARAM_ACTION_BAB, CBC_PARAM_ACTION_MIPLIB, CLP_PARAM_ACTION_CLEARCUTS, CLP_VERSION_NOTUSED_PRINTVERSION, CBC_PARAM_NOTUSED_OSLSTUFF = 401, CBC_PARAM_NOTUSED_CBCSTUFF, CBC_PARAM_NOTUSED_INVALID = 1000 }; /// Very simple class for setting parameters class CbcParam { public: /**@name Constructor and destructor */ //@{ /// Constructors CbcParam ( ); CbcParam (std::string name, std::string help, double lower, double upper, CbcParameterType type, bool display = true); CbcParam (std::string name, std::string help, int lower, int upper, CbcParameterType type, bool display = true); // Other strings will be added by insert CbcParam (std::string name, std::string help, std::string firstValue, CbcParameterType type, int defaultIndex = 0, bool display = true); // Action CbcParam (std::string name, std::string help, CbcParameterType type, int indexNumber = -1, bool display = true); /// Copy constructor. CbcParam(const CbcParam &); /// Assignment operator. This copies the data CbcParam & operator=(const CbcParam & rhs); /// Destructor ~CbcParam ( ); //@} /**@name stuff */ //@{ /// Insert string (only valid for keywords) void append(std::string keyWord); /// Adds one help line void addHelp(std::string keyWord); /// Returns name inline std::string name( ) const { return name_; }; /// Returns short help inline std::string shortHelp( ) const { return shortHelp_; }; /// Sets a double parameter (nonzero code if error) int setDoubleParameter(CbcModel & model, double value) const; /// Gets a double parameter double doubleParameter(CbcModel & model) const; /// Sets a int parameter (nonzero code if error) int setIntParameter(CbcModel & model, int value) const; /// Gets a int parameter int intParameter(CbcModel & model) const; /// Sets a double parameter (nonzero code if error) int setDoubleParameter(ClpSimplex * model, double value) const; /// Gets a double parameter double doubleParameter(ClpSimplex * model) const; /// Sets a int parameter (nonzero code if error) int setIntParameter(ClpSimplex * model, int value) const; /// Gets a int parameter int intParameter(ClpSimplex * model) const; /// Sets a double parameter (nonzero code if error) int setDoubleParameter(OsiSolverInterface * model, double value) const; /// Gets a double parameter double doubleParameter(OsiSolverInterface * model) const; /// Sets a int parameter (nonzero code if error) int setIntParameter(OsiSolverInterface * model, int value) const; /// Gets a int parameter int intParameter(OsiSolverInterface * model) const; /// Checks a double parameter (nonzero code if error) int checkDoubleParameter(double value) const; /// Returns name which could match std::string matchName ( ) const; /// Returns parameter option which matches (-1 if none) int parameterOption ( std::string check ) const; /// Prints parameter options void printOptions ( ) const; /// Returns current parameter option inline std::string currentOption ( ) const { return definedKeyWords_[currentKeyWord_]; } /// Sets current parameter option inline void setCurrentOption ( int value ) { currentKeyWord_ = value; } /// Sets int value inline void setIntValue ( int value ) { intValue_ = value; } inline int intValue () const { return intValue_; } /// Sets double value inline void setDoubleValue ( double value ) { doubleValue_ = value; } inline double doubleValue () const { return doubleValue_; } /// Sets string value inline void setStringValue ( std::string value ) { stringValue_ = value; } inline std::string stringValue () const { return stringValue_; } /// Returns 1 if matches minimum, 2 if matches less, 0 if not matched int matches (std::string input) const; /// type inline CbcParameterType type() const { return type_; } /// whether to display inline bool displayThis() const { return display_; } /// Set Long help inline void setLonghelp(const std::string help) { longHelp_ = help; } /// Print Long help void printLongHelp() const; /// Print action and string void printString() const; /// type for classification inline int indexNumber() const { return indexNumber_; } private: /// gutsOfConstructor void gutsOfConstructor(); //@} ////////////////// data ////////////////// private: /**@name data We might as well throw all type data in - could derive? */ //@{ // Type see CbcParameterType CbcParameterType type_; /// If double == okay double lowerDoubleValue_; double upperDoubleValue_; /// If int == okay int lowerIntValue_; int upperIntValue_; // Length of name unsigned int lengthName_; // Minimum match unsigned int lengthMatch_; /// set of valid strings std::vector definedKeyWords_; /// Name std::string name_; /// Short help std::string shortHelp_; /// Long help std::string longHelp_; /// Action CbcParameterType action_; /// Current keyWord (if a keyword parameter) int currentKeyWord_; /// Display on ? bool display_; /// Integer parameter - current value int intValue_; /// Double parameter - current value double doubleValue_; /// String parameter - current value std::string stringValue_; /// index number to use for display purposes int indexNumber_; //@} }; #endif /* CbcParam_H */ CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveVectorLength.hpp0000644000175000017500000000320612131054770021010 0ustar renerene/* $Id: CbcHeuristicDiveVectorLength.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicDiveVectorLength_H #define CbcHeuristicDiveVectorLength_H #include "CbcHeuristicDive.hpp" /** DiveVectorLength class */ class CbcHeuristicDiveVectorLength : public CbcHeuristicDive { public: // Default Constructor CbcHeuristicDiveVectorLength (); // Constructor with model - assumed before cuts CbcHeuristicDiveVectorLength (CbcModel & model); // Copy constructor CbcHeuristicDiveVectorLength ( const CbcHeuristicDiveVectorLength &); // Destructor ~CbcHeuristicDiveVectorLength (); /// Clone virtual CbcHeuristicDiveVectorLength * clone() const; /// Assignment operator CbcHeuristicDiveVectorLength & operator=(const CbcHeuristicDiveVectorLength& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Selects the next variable to branch on /** Returns true if all the fractional variables can be trivially rounded. Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable. */ virtual bool selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound); }; #endif CoinMP-1.8.3/Cbc/src/CbcCutModifier.hpp0000644000175000017500000000251112131054770016124 0ustar renerene// $Id: CbcCutModifier.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCutGenerator #ifndef CbcCutModifier_H #define CbcCutModifier_H #include "OsiSolverInterface.hpp" #include "OsiCuts.hpp" #include "CglCutGenerator.hpp" class CbcModel; class OsiRowCut; class OsiRowCutDebugger; /** Abstract cut modifier base class In exotic circumstances - cuts may need to be modified a) strengthened - changed b) weakened - changed c) deleted - set to NULL d) unchanged */ class CbcCutModifier { public: /// Default Constructor CbcCutModifier (); // Copy constructor CbcCutModifier ( const CbcCutModifier &); /// Destructor virtual ~CbcCutModifier(); /// Assignment CbcCutModifier & operator=(const CbcCutModifier& rhs); /// Clone virtual CbcCutModifier * clone() const = 0; /** Returns 0 unchanged 1 strengthened 2 weakened 3 deleted */ virtual int modify(const OsiSolverInterface * solver, OsiRowCut & cut) = 0; /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} protected: }; #endif //CbcCutModifier_H CoinMP-1.8.3/Cbc/src/CbcNodeInfo.hpp0000644000175000017500000002427212361442754015433 0ustar renerene// $Id: CbcNodeInfo.hpp 2048 2014-07-16 09:29:16Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/24/09 carved from CbcNode #ifndef CbcNodeInfo_H #define CbcNodeInfo_H #include #include #include "CoinWarmStartBasis.hpp" #include "CoinSearchTree.hpp" #include "CbcBranchBase.hpp" class OsiSolverInterface; class OsiSolverBranch; class OsiCuts; class OsiRowCut; class OsiRowCutDebugger; class CoinWarmStartBasis; class CbcCountRowCut; class CbcModel; class CbcNode; class CbcSubProblem; class CbcGeneralBranchingObject; //############################################################################# /** Information required to recreate the subproblem at this node When a subproblem is initially created, it is represented by a CbcNode object and an attached CbcNodeInfo object. The CbcNode contains information needed while the subproblem remains live. The CbcNode is deleted when the last branch arm has been evaluated. The CbcNodeInfo contains information required to maintain the branch-and-cut search tree structure (links and reference counts) and to recreate the subproblem for this node (basis, variable bounds, cutting planes). A CbcNodeInfo object remains in existence until all nodes have been pruned from the subtree rooted at this node. The principle used to maintain the reference count is that the reference count is always the sum of all potential and actual children of the node. Specifically,
    • Once it's determined how the node will branch, the reference count is set to the number of potential children (i.e., the number of arms of the branch).
    • As each child is created by CbcNode::branch() (converting a potential child to the active subproblem), the reference count is decremented.
    • If the child survives and will become a node in the search tree (converting the active subproblem into an actual child), increment the reference count.
    Notice that the active subproblem lives in a sort of limbo, neither a potential or an actual node in the branch-and-cut tree. CbcNodeInfo objects come in two flavours. A CbcFullNodeInfo object contains a full record of the information required to recreate a subproblem. A CbcPartialNodeInfo object expresses this information in terms of differences from the parent. */ class CbcNodeInfo { public: /** \name Constructors & destructors */ //@{ /** Default Constructor Creates an empty NodeInfo object. */ CbcNodeInfo (); /// Copy constructor CbcNodeInfo ( const CbcNodeInfo &); #ifdef JJF_ZERO /** Construct with parent Creates a NodeInfo object which knows its parent and assumes it will in turn have two children. */ CbcNodeInfo (CbcNodeInfo * parent); #endif /** Construct with parent and owner As for `construct with parent', and attached to \p owner. */ CbcNodeInfo (CbcNodeInfo * parent, CbcNode * owner); /** Destructor Note that the destructor will recursively delete the parent if this nodeInfo is the last child. */ virtual ~CbcNodeInfo(); //@} /** \brief Modify model according to information at node The routine modifies the model according to bound and basis information at node and adds any cuts to the addCuts array. */ virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis, CbcCountRowCut **addCuts, int ¤tNumberCuts) const = 0 ; /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible) virtual int applyBounds(int iColumn, double & lower, double & upper, int force) = 0; /** Builds up row basis backwards (until original model). Returns NULL or previous one to apply . Depends on Free being 0 and impossible for cuts */ virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis) const = 0; /// Clone virtual CbcNodeInfo * clone() const = 0; /// Called when number branches left down to zero virtual void allBranchesGone() {} #ifndef JJF_ONE /// Increment number of references inline void increment(int amount = 1) { numberPointingToThis_ += amount;/*printf("CbcNodeInfo %x incremented by %d to %d\n",this,amount,numberPointingToThis_);*/ } /// Decrement number of references and return number left inline int decrement(int amount = 1) { numberPointingToThis_ -= amount;/*printf("CbcNodeInfo %x decremented by %d to %d\n",this,amount,numberPointingToThis_);*/ return numberPointingToThis_; } #else /// Increment number of references void increment(int amount = 1); /// Decrement number of references and return number left int decrement(int amount = 1); #endif /** Initialize reference counts Initialize the reference counts used for tree maintenance. */ inline void initializeInfo(int number) { numberPointingToThis_ = number; numberBranchesLeft_ = number; } /// Return number of branches left in object inline int numberBranchesLeft() const { return numberBranchesLeft_; } /// Set number of branches left in object inline void setNumberBranchesLeft(int value) { numberBranchesLeft_ = value; } /// Return number of objects pointing to this inline int numberPointingToThis() const { return numberPointingToThis_; } /// Set number of objects pointing to this inline void setNumberPointingToThis(int number) { numberPointingToThis_ = number; } /// Increment number of objects pointing to this inline void incrementNumberPointingToThis() { numberPointingToThis_ ++; } /// Say one branch taken inline int branchedOn() { numberPointingToThis_--; numberBranchesLeft_--; return numberBranchesLeft_; } /// Say thrown away inline void throwAway() { numberPointingToThis_ -= numberBranchesLeft_; numberBranchesLeft_ = 0; } /// Parent of this CbcNodeInfo * parent() const { return parent_; } /// Set parent null inline void nullParent() { parent_ = NULL; } void addCuts(OsiCuts & cuts, int numberToBranch, //int * whichGenerator, int numberPointingToThis); void addCuts(int numberCuts, CbcCountRowCut ** cuts, int numberToBranch); /** Delete cuts (decrements counts) Slow unless cuts in same order as saved */ void deleteCuts(int numberToDelete, CbcCountRowCut ** cuts); void deleteCuts(int numberToDelete, int * which); /// Really delete a cut void deleteCut(int whichOne); /// Decrement active cut counts void decrementCuts(int change = 1); /// Increment active cut counts void incrementCuts(int change = 1); /// Decrement all active cut counts in chain starting at parent void decrementParentCuts(CbcModel * model, int change = 1); /// Increment all active cut counts in parent chain void incrementParentCuts(CbcModel * model, int change = 1); /// Array of pointers to cuts inline CbcCountRowCut ** cuts() const { return cuts_; } /// Number of row cuts (this node) inline int numberCuts() const { return numberCuts_; } inline void setNumberCuts(int value) { numberCuts_ = value; } /// Set owner null inline void nullOwner() { owner_ = NULL; } const inline CbcNode * owner() const { return owner_; } inline CbcNode * mutableOwner() const { return owner_; } /// The node number inline int nodeNumber() const { return nodeNumber_; } inline void setNodeNumber(int node) { nodeNumber_ = node; } /** Deactivate node information. 1 - bounds 2 - cuts 4 - basis! 8 - just marked 16 - symmetry branching worked */ void deactivate(int mode = 3); /// Say if normal inline bool allActivated() const { return ((active_&7) == 7); } /// Say if marked inline bool marked() const { return ((active_&8) != 0); } /// Mark inline void mark() { active_ |= 8; } /// Unmark inline void unmark() { active_ &= ~8; } /// Get symmetry value (true worked at this node) inline bool symmetryWorked() const { return (active_&16) !=0;} /// Say symmetry worked at this node) inline void setSymmetryWorked() { active_ |= 16;} /// Branching object for the parent inline const OsiBranchingObject * parentBranch() const { return parentBranch_; } /// If we need to take off parent based data void unsetParentBasedData(); protected: /** Number of other nodes pointing to this node. Number of existing and potential search tree nodes pointing to this node. `Existing' means referenced by #parent_ of some other CbcNodeInfo. `Potential' means children still to be created (#numberBranchesLeft_ of this CbcNodeInfo). */ int numberPointingToThis_; /// parent CbcNodeInfo * parent_; /// Copy of the branching object of the parent when the node is created OsiBranchingObject * parentBranch_; /// Owner CbcNode * owner_; /// Number of row cuts (this node) int numberCuts_; /// The node number int nodeNumber_; /// Array of pointers to cuts CbcCountRowCut ** cuts_; /** Number of rows in problem (before these cuts). This means that for top of chain it must be rows at continuous */ int numberRows_; /** Number of branch arms left to explore at this node \todo There seems to be redundancy between this field and CbcBranchingObject::numberBranchesLeft_. It'd be good to sort out if both are necessary. */ int numberBranchesLeft_; /** Active node information. 1 - bounds 2 - cuts 4 - basis! */ int active_; private: /// Illegal Assignment operator CbcNodeInfo & operator=(const CbcNodeInfo& rhs); /// routine common to constructors void setParentBasedData(); }; #endif // CbcNodeInfo_H CoinMP-1.8.3/Cbc/src/CbcNode.cpp0000644000175000017500000076254012522137742014616 0ustar renerene/* $Id: CbcNode.cpp 2187 2015-05-05 13:04:34Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #include // for Sleep() #ifdef small #undef small #endif #else #include // for usleep() #endif #include "CbcConfig.h" #ifdef COIN_HAS_NTY #include "CbcSymmetry.hpp" #endif //#define DEBUG_SOLUTION #ifdef DEBUG_SOLUTION #define COIN_DETAIL #endif #include //#define CBC_DEBUG 1 //#define CHECK_CUT_COUNTS //#define CHECK_NODE //#define CBC_CHECK_BASIS #include #include #define CUTS #include "OsiSolverInterface.hpp" #include "OsiChooseVariable.hpp" #include "OsiAuxInfo.hpp" #include "OsiSolverBranch.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinTime.hpp" #include "CbcModel.hpp" #include "CbcNode.hpp" #include "CbcStatistics.hpp" #include "CbcStrategy.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchDynamic.hpp" #include "OsiRowCut.hpp" #include "OsiRowCutDebugger.hpp" #include "OsiCuts.hpp" #include "CbcCountRowCut.hpp" #include "CbcFeasibilityBase.hpp" #include "CbcMessage.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #include "ClpSimplexOther.hpp" #include "ClpSolve.hpp" #include "ClpDualRowSteepest.hpp" #include "ClpPrimalColumnPivot.hpp" #endif using namespace std; #include "CglCutGenerator.hpp" CbcNode::CbcNode() : nodeInfo_(NULL), objectiveValue_(1.0e100), guessedObjectiveValue_(1.0e100), sumInfeasibilities_(0.0), branch_(NULL), depth_(-1), numberUnsatisfied_(0), nodeNumber_(-1), state_(0) { #ifdef CHECK_NODE printf("CbcNode %p Constructor\n", this); #endif } // Print void CbcNode::print() const { printf("number %d obj %g depth %d sumun %g nunsat %d state %d\n", nodeNumber_, objectiveValue_, depth_, sumInfeasibilities_, numberUnsatisfied_, state_); } CbcNode::CbcNode(CbcModel * model, CbcNode * lastNode) : nodeInfo_(NULL), objectiveValue_(1.0e100), guessedObjectiveValue_(1.0e100), sumInfeasibilities_(0.0), branch_(NULL), depth_(-1), numberUnsatisfied_(0), nodeNumber_(-1), state_(0) { #ifdef CHECK_NODE printf("CbcNode %p Constructor from model\n", this); #endif model->setObjectiveValue(this, lastNode); if (lastNode) { if (lastNode->nodeInfo_) { lastNode->nodeInfo_->increment(); } } nodeNumber_ = model->getNodeCount(); } #define CBC_NEW_CREATEINFO #ifdef CBC_NEW_CREATEINFO /* New createInfo, with basis manipulation hidden inside mergeBasis. Allows solvers to override and carry over all information from one basis to another. */ void CbcNode::createInfo (CbcModel *model, CbcNode *lastNode, const CoinWarmStartBasis *lastws, const double *lastLower, const double *lastUpper, int numberOldActiveCuts, int numberNewCuts) { OsiSolverInterface *solver = model->solver(); CbcStrategy *strategy = model->strategy(); /* The root --- no parent. Create full basis and bounds information. */ if (!lastNode) { if (!strategy) nodeInfo_ = new CbcFullNodeInfo(model, solver->getNumRows()); else nodeInfo_ = strategy->fullNodeInfo(model, solver->getNumRows()); } else { /* Not the root. Create an edit from the parent's basis & bound information. This is not quite as straightforward as it seems. We need to reintroduce cuts we may have dropped out of the basis, in the correct position, because this whole process is strictly positional. Start by grabbing the current basis. */ bool mustDeleteBasis; const CoinWarmStartBasis *ws = dynamic_cast(solver->getPointerToWarmStart(mustDeleteBasis)); assert(ws != NULL); // make sure not volume //int numberArtificials = lastws->getNumArtificial(); int numberColumns = solver->getNumCols(); int numberRowsAtContinuous = model->numberRowsAtContinuous(); int currentNumberCuts = model->currentNumberCuts(); # ifdef CBC_CHECK_BASIS std::cout << "Before expansion: orig " << numberRowsAtContinuous << ", old " << numberOldActiveCuts << ", new " << numberNewCuts << ", current " << currentNumberCuts << "." << std::endl ; ws->print(); # endif /* Clone the basis and resize it to hold the structural constraints, plus all the cuts: old cuts, both active and inactive (currentNumberCuts), and new cuts (numberNewCuts). This will become the expanded basis. */ CoinWarmStartBasis *expanded = dynamic_cast(ws->clone()) ; int iCompact = numberRowsAtContinuous + numberOldActiveCuts + numberNewCuts ; // int nPartial = numberRowsAtContinuous+currentNumberCuts; int iFull = numberRowsAtContinuous + currentNumberCuts + numberNewCuts; // int maxBasisLength = ((iFull+15)>>4)+((numberColumns+15)>>4); // printf("l %d full %d\n",maxBasisLength,iFull); expanded->resize(iFull, numberColumns); # ifdef CBC_CHECK_BASIS std::cout << "\tFull basis " << iFull << " rows, " << numberColumns << " columns; compact " << iCompact << " rows." << std::endl ; # endif /* Now flesh out the expanded basis. The clone already has the correct status information for the variables and for the structural (numberRowsAtContinuous) constraints. Any indices beyond nPartial must be cuts created while processing this node --- they can be copied en bloc into the correct position in the expanded basis. The space reserved for xferRows is a gross overestimate. */ CoinWarmStartBasis::XferVec xferRows ; xferRows.reserve(iFull - numberRowsAtContinuous + 1) ; if (numberNewCuts) { xferRows.push_back( CoinWarmStartBasis::XferEntry(iCompact - numberNewCuts, iFull - numberNewCuts, numberNewCuts)) ; } /* From nPartial down, record the entries we want to copy from the current basis (the entries for the active cuts; non-zero in the list returned by addedCuts). Fill the expanded basis with entries showing a status of basic for the deactivated (loose) cuts. */ CbcCountRowCut **cut = model->addedCuts(); iFull -= (numberNewCuts + 1) ; iCompact -= (numberNewCuts + 1) ; int runLen = 0 ; CoinWarmStartBasis::XferEntry entry(-1, -1, -1) ; while (iFull >= numberRowsAtContinuous) { for ( ; iFull >= numberRowsAtContinuous && cut[iFull-numberRowsAtContinuous] ; iFull--) runLen++ ; if (runLen) { iCompact -= runLen ; entry.first = iCompact + 1 ; entry.second = iFull + 1 ; entry.third = runLen ; runLen = 0 ; xferRows.push_back(entry) ; } for ( ; iFull >= numberRowsAtContinuous && !cut[iFull-numberRowsAtContinuous] ; iFull--) expanded->setArtifStatus(iFull, CoinWarmStartBasis::basic); } /* Finally, call mergeBasis to copy over entries from the current basis to the expanded basis. Since we cloned the expanded basis from the active basis and haven't changed the number of variables, only row status entries need to be copied. */ expanded->mergeBasis(ws, &xferRows, 0) ; #ifdef CBC_CHECK_BASIS std::cout << "Expanded basis:" << std::endl ; expanded->print() ; std::cout << "Diffing against:" << std::endl ; lastws->print() ; #endif assert (expanded->getNumArtificial() >= lastws->getNumArtificial()); #ifdef CLP_INVESTIGATE if (!expanded->fullBasis()) { int iFull = numberRowsAtContinuous + currentNumberCuts + numberNewCuts; printf("cont %d old %d new %d current %d full inc %d full %d\n", numberRowsAtContinuous, numberOldActiveCuts, numberNewCuts, currentNumberCuts, iFull, iFull - numberNewCuts); } #endif /* Now that we have two bases in proper positional correspondence, creating the actual diff is dead easy. Note that we're going to compare the expanded basis here to the stripped basis (lastws) produced by addCuts. It doesn't affect the correctness (the diff process has no knowledge of the meaning of an entry) but it does mean that we'll always generate a whack of diff entries because the expanded basis is considerably larger than the stripped basis. */ CoinWarmStartDiff *basisDiff = expanded->generateDiff(lastws) ; /* Diff the bound vectors. It's assumed the number of structural variables is not changing. For branching objects that change bounds on integer variables, we should see at least one bound change as a consequence of applying the branch that generated this subproblem from its parent. This need not hold for other types of branching objects (hyperplane branches, for example). */ const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double *boundChanges = new double [2*numberColumns] ; int *variables = new int [2*numberColumns] ; int numberChangedBounds = 0; int i; for (i = 0; i < numberColumns; i++) { if (lower[i] != lastLower[i]) { variables[numberChangedBounds] = i; boundChanges[numberChangedBounds++] = lower[i]; } if (upper[i] != lastUpper[i]) { variables[numberChangedBounds] = i | 0x80000000; boundChanges[numberChangedBounds++] = upper[i]; } #ifdef CBC_DEBUG if (lower[i] != lastLower[i]) { std::cout << "lower on " << i << " changed from " << lastLower[i] << " to " << lower[i] << std::endl ; } if (upper[i] != lastUpper[i]) { std::cout << "upper on " << i << " changed from " << lastUpper[i] << " to " << upper[i] << std::endl ; } #endif } #ifdef CBC_DEBUG std::cout << numberChangedBounds << " changed bounds." << std::endl ; #endif //if (lastNode->branchingObject()->boundBranch()) //assert (numberChangedBounds); /* Hand the lot over to the CbcPartialNodeInfo constructor, then clean up and return. */ if (!strategy) nodeInfo_ = new CbcPartialNodeInfo(lastNode->nodeInfo_, this, numberChangedBounds, variables, boundChanges, basisDiff) ; else nodeInfo_ = strategy->partialNodeInfo(model, lastNode->nodeInfo_, this, numberChangedBounds, variables, boundChanges, basisDiff) ; delete basisDiff ; delete [] boundChanges; delete [] variables; delete expanded ; if (mustDeleteBasis) delete ws; } // Set node number nodeInfo_->setNodeNumber(model->getNodeCount2()); state_ |= 2; // say active } #else // CBC_NEW_CREATEINFO /* Original createInfo, with bare manipulation of basis vectors. Fails if solver maintains additional information in basis. */ void CbcNode::createInfo (CbcModel *model, CbcNode *lastNode, const CoinWarmStartBasis *lastws, const double *lastLower, const double *lastUpper, int numberOldActiveCuts, int numberNewCuts) { OsiSolverInterface * solver = model->solver(); CbcStrategy * strategy = model->strategy(); /* The root --- no parent. Create full basis and bounds information. */ if (!lastNode) { if (!strategy) nodeInfo_ = new CbcFullNodeInfo(model, solver->getNumRows()); else nodeInfo_ = strategy->fullNodeInfo(model, solver->getNumRows()); } /* Not the root. Create an edit from the parent's basis & bound information. This is not quite as straightforward as it seems. We need to reintroduce cuts we may have dropped out of the basis, in the correct position, because this whole process is strictly positional. Start by grabbing the current basis. */ else { bool mustDeleteBasis; const CoinWarmStartBasis* ws = dynamic_cast(solver->getPointerToWarmStart(mustDeleteBasis)); assert(ws != NULL); // make sure not volume //int numberArtificials = lastws->getNumArtificial(); int numberColumns = solver->getNumCols(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); int i; /* Create a clone and resize it to hold all the structural constraints, plus all the cuts: old cuts, both active and inactive (currentNumberCuts), and new cuts (numberNewCuts). TODO: You'd think that the set of constraints (logicals) in the expanded basis should match the set represented in lastws. At least, that's what I thought. But at the point I first looked hard at this bit of code, it turned out that lastws was the stripped basis produced at the end of addCuts(), rather than the raw basis handed back by addCuts1(). The expanded basis here is equivalent to the raw basis of addCuts1(). I said ``whoa, that's not good, I must have introduced a bug'' and went back to John's code to see where I'd gone wrong. And discovered the same `error' in his code. After a bit of thought, my conclusion is that correctness is not affected by whether lastws is the stripped or raw basis. The diffs have no semantics --- just a set of changes that need to be made to convert lastws into expanded. I think the only effect is that we store a lot more diffs (everything in expanded that's not covered by the stripped basis). But I need to give this more thought. There may well be some subtle error cases. In the mean time, I've twiddled addCuts() to set lastws to the raw basis. Makes me (Lou) less nervous to compare apples to apples. */ CoinWarmStartBasis *expanded = dynamic_cast(ws->clone()) ; int numberRowsAtContinuous = model->numberRowsAtContinuous(); int iFull = numberRowsAtContinuous + model->currentNumberCuts() + numberNewCuts; //int numberArtificialsNow = iFull; //int maxBasisLength = ((iFull+15)>>4)+((numberColumns+15)>>4); //printf("l %d full %d\n",maxBasisLength,iFull); if (expanded) expanded->resize(iFull, numberColumns); #ifdef CBC_CHECK_BASIS printf("Before expansion: orig %d, old %d, new %d, current %d\n", numberRowsAtContinuous, numberOldActiveCuts, numberNewCuts, model->currentNumberCuts()) ; ws->print(); #endif /* Now fill in the expanded basis. Any indices beyond nPartial must be cuts created while processing this node --- they can be copied directly into the expanded basis. From nPartial down, pull the status of active cuts from ws, interleaving with a B entry for the deactivated (loose) cuts. */ int numberDropped = model->currentNumberCuts() - numberOldActiveCuts; int iCompact = iFull - numberDropped; CbcCountRowCut ** cut = model->addedCuts(); int nPartial = model->currentNumberCuts() + numberRowsAtContinuous; iFull--; for (; iFull >= nPartial; iFull--) { CoinWarmStartBasis::Status status = ws->getArtifStatus(--iCompact); //assert (status != CoinWarmStartBasis::basic); // may be permanent cut expanded->setArtifStatus(iFull, status); } for (; iFull >= numberRowsAtContinuous; iFull--) { if (cut[iFull-numberRowsAtContinuous]) { CoinWarmStartBasis::Status status = ws->getArtifStatus(--iCompact); // If no cut generator being used then we may have basic variables //if (model->getMaximumCutPasses()&& // status == CoinWarmStartBasis::basic) //printf("cut basic\n"); expanded->setArtifStatus(iFull, status); } else { expanded->setArtifStatus(iFull, CoinWarmStartBasis::basic); } } #ifdef CBC_CHECK_BASIS printf("Expanded basis\n"); expanded->print() ; printf("Diffing against\n") ; lastws->print() ; #endif /* Now that we have two bases in proper positional correspondence, creating the actual diff is dead easy. */ CoinWarmStartDiff *basisDiff = expanded->generateDiff(lastws) ; /* Diff the bound vectors. It's assumed the number of structural variables is not changing. Assuming that branching objects all involve integer variables, we should see at least one bound change as a consequence of processing this subproblem. Different types of branching objects could break this assertion. Not true at all - we have not applied current branch - JJF. */ double *boundChanges = new double [2*numberColumns] ; int *variables = new int [2*numberColumns] ; int numberChangedBounds = 0; for (i = 0; i < numberColumns; i++) { if (lower[i] != lastLower[i]) { variables[numberChangedBounds] = i; boundChanges[numberChangedBounds++] = lower[i]; } if (upper[i] != lastUpper[i]) { variables[numberChangedBounds] = i | 0x80000000; boundChanges[numberChangedBounds++] = upper[i]; } #ifdef CBC_DEBUG if (lower[i] != lastLower[i]) printf("lower on %d changed from %g to %g\n", i, lastLower[i], lower[i]); if (upper[i] != lastUpper[i]) printf("upper on %d changed from %g to %g\n", i, lastUpper[i], upper[i]); #endif } #ifdef CBC_DEBUG printf("%d changed bounds\n", numberChangedBounds) ; #endif //if (lastNode->branchingObject()->boundBranch()) //assert (numberChangedBounds); /* Hand the lot over to the CbcPartialNodeInfo constructor, then clean up and return. */ if (!strategy) nodeInfo_ = new CbcPartialNodeInfo(lastNode->nodeInfo_, this, numberChangedBounds, variables, boundChanges, basisDiff) ; else nodeInfo_ = strategy->partialNodeInfo(model, lastNode->nodeInfo_, this, numberChangedBounds, variables, boundChanges, basisDiff) ; delete basisDiff ; delete [] boundChanges; delete [] variables; delete expanded ; if (mustDeleteBasis) delete ws; } // Set node number nodeInfo_->setNodeNumber(model->getNodeCount2()); state_ |= 2; // say active } #endif // CBC_NEW_CREATEINFO /* The routine scans through the object list of the model looking for objects that indicate infeasibility. It tests each object using strong branching and selects the one with the least objective degradation. A corresponding branching object is left attached to lastNode. If strong branching is disabled, a candidate object is chosen essentially at random (whatever object ends up in pos'n 0 of the candidate array). If a branching candidate is found to be monotone, bounds are set to fix the variable and the routine immediately returns (the caller is expected to reoptimize). If a branching candidate is found to result in infeasibility in both directions, the routine immediately returns an indication of infeasibility. Returns: 0 both branch directions are feasible -1 branching variable is monotone -2 infeasible Original comments: Here could go cuts etc etc For now just fix on objective from strong branching. */ int CbcNode::chooseBranch (CbcModel *model, CbcNode *lastNode, int numberPassesLeft) { if (lastNode) depth_ = lastNode->depth_ + 1; else depth_ = 0; delete branch_; branch_ = NULL; OsiSolverInterface * solver = model->solver(); # ifdef COIN_HAS_CLP OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver); int saveClpOptions = 0; if (osiclp) { // for faster hot start saveClpOptions = osiclp->specialOptions(); osiclp->setSpecialOptions(saveClpOptions | 8192); } # else OsiSolverInterface *osiclp = NULL ; # endif double saveObjectiveValue = solver->getObjValue(); double objectiveValue = CoinMax(solver->getObjSense() * saveObjectiveValue, objectiveValue_); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); // See what user thinks int anyAction = model->problemFeasibility()->feasible(model, 0); if (anyAction) { // will return -2 if infeasible , 0 if treat as integer return anyAction - 1; } double integerTolerance = model->getDblParam(CbcModel::CbcIntegerTolerance); // point to useful information OsiBranchingInformation usefulInfo = model->usefulInformation(); // and modify usefulInfo.depth_ = depth_; int i; bool beforeSolution = model->getSolutionCount() == 0; int numberStrong = model->numberStrong(); // switch off strong if hotstart const double * hotstartSolution = model->hotstartSolution(); const int * hotstartPriorities = model->hotstartPriorities(); int numberObjects = model->numberObjects(); int numberColumns = model->getNumCols(); double * saveUpper = new double[numberColumns]; double * saveLower = new double[numberColumns]; for (i = 0; i < numberColumns; i++) { saveLower[i] = lower[i]; saveUpper[i] = upper[i]; } // Save solution in case heuristics need good solution later double * saveSolution = new double[numberColumns]; memcpy(saveSolution, solver->getColSolution(), numberColumns*sizeof(double)); model->reserveCurrentSolution(saveSolution); if (hotstartSolution) { numberStrong = 0; if ((model->moreSpecialOptions()&1024) != 0) { int nBad = 0; int nUnsat = 0; int nDiff = 0; for (int i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); const CbcSimpleInteger * thisOne = dynamic_cast (object); if (thisOne) { int iColumn = thisOne->columnNumber(); double targetValue = hotstartSolution[iColumn]; double value = saveSolution[iColumn]; if (fabs(value - floor(value + 0.5)) > 1.0e-6) { nUnsat++; #ifdef CLP_INVESTIGATE printf("H %d is %g target %g\n", iColumn, value, targetValue); #endif } else if (fabs(targetValue - value) > 1.0e-6) { nDiff++; } if (targetValue < saveLower[iColumn] || targetValue > saveUpper[iColumn]) { #ifdef CLP_INVESTIGATE printf("%d has target %g and current bounds %g and %g\n", iColumn, targetValue, saveLower[iColumn], saveUpper[iColumn]); #endif nBad++; } } } #ifdef CLP_INVESTIGATE printf("Hot %d unsatisfied, %d outside limits, %d different\n", nUnsat, nBad, nDiff); #endif if (nBad) { // switch off as not possible hotstartSolution = NULL; model->setHotstartSolution(NULL, NULL); usefulInfo.hotstartSolution_ = NULL; } } } int numberStrongDone = 0; int numberUnfinished = 0; int numberStrongInfeasible = 0; int numberStrongIterations = 0; int saveNumberStrong = numberStrong; bool checkFeasibility = numberObjects > model->numberIntegers(); int maximumStrong = CoinMax(CoinMin(numberStrong, numberObjects), 1); /* Get a branching decision object. Use the default decision criteria unless the user has loaded a decision method into the model. */ CbcBranchDecision *decision = model->branchingMethod(); CbcDynamicPseudoCostBranchingObject * dynamicBranchingObject = dynamic_cast(decision); if (!decision || dynamicBranchingObject) decision = new CbcBranchDefaultDecision(); decision->initialize(model); CbcStrongInfo * choice = new CbcStrongInfo[maximumStrong]; // May go round twice if strong branching fixes all local candidates bool finished = false; double estimatedDegradation = 0.0; while (!finished) { finished = true; // Some objects may compute an estimate of best solution from here estimatedDegradation = 0.0; //int numberIntegerInfeasibilities=0; // without odd ones numberStrongDone = 0; numberUnfinished = 0; numberStrongInfeasible = 0; numberStrongIterations = 0; // We may go round this loop twice (only if we think we have solution) for (int iPass = 0; iPass < 2; iPass++) { // compute current state //int numberObjectInfeasibilities; // just odd ones //model->feasibleSolution( // numberIntegerInfeasibilities, // numberObjectInfeasibilities); // Some objects may compute an estimate of best solution from here estimatedDegradation = 0.0; numberUnsatisfied_ = 0; // initialize sum of "infeasibilities" sumInfeasibilities_ = 0.0; int bestPriority = COIN_INT_MAX; /* Scan for branching objects that indicate infeasibility. Choose the best maximumStrong candidates, using priority as the first criteria, then integer infeasibility. The algorithm is to fill the choice array with a set of good candidates (by infeasibility) with priority bestPriority. Finding a candidate with priority better (less) than bestPriority flushes the choice array. (This serves as initialization when the first candidate is found.) A new candidate is added to choices only if its infeasibility exceeds the current max infeasibility (mostAway). When a candidate is added, it replaces the candidate with the smallest infeasibility (tracked by iSmallest). */ int iSmallest = 0; double mostAway = 1.0e-100; for (i = 0 ; i < maximumStrong ; i++) choice[i].possibleBranch = NULL ; numberStrong = 0; bool canDoOneHot = false; for (i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); int preferredWay; double infeasibility = object->infeasibility(&usefulInfo, preferredWay); int priorityLevel = object->priority(); if (hotstartSolution) { // we are doing hot start const CbcSimpleInteger * thisOne = dynamic_cast (object); if (thisOne) { int iColumn = thisOne->columnNumber(); bool canDoThisHot = true; double targetValue = hotstartSolution[iColumn]; if (saveUpper[iColumn] > saveLower[iColumn]) { double value = saveSolution[iColumn]; // clean value = CoinMin(value,saveUpper[iColumn]); value = CoinMax(value,saveLower[iColumn]); if (hotstartPriorities) priorityLevel = hotstartPriorities[iColumn]; //double originalLower = thisOne->originalLower(); //double originalUpper = thisOne->originalUpper(); // switch off if not possible if (targetValue >= saveLower[iColumn] && targetValue <= saveUpper[iColumn]) { /* priority outranks rest always if negative otherwise can be downgraded if at correct level. Infeasibility may be increased to choose 1.0 values first. choose one near wanted value */ if (fabs(value - targetValue) > integerTolerance) { //if (infeasibility>0.01) //infeasibility = fabs(1.0e6-fabs(value-targetValue)); //else infeasibility = fabs(value - targetValue); //if (targetValue==1.0) //infeasibility += 1.0; if (value > targetValue) { preferredWay = -1; } else { preferredWay = 1; } priorityLevel = CoinAbs(priorityLevel); } else if (priorityLevel < 0) { priorityLevel = CoinAbs(priorityLevel); if (targetValue == saveLower[iColumn]) { infeasibility = integerTolerance + 1.0e-12; preferredWay = -1; } else if (targetValue == saveUpper[iColumn]) { infeasibility = integerTolerance + 1.0e-12; preferredWay = 1; } else { // can't priorityLevel += 10000000; canDoThisHot = false; } } else { priorityLevel += 10000000; canDoThisHot = false; } } else { // switch off if not possible canDoThisHot = false; } if (canDoThisHot) canDoOneHot = true; } else if (targetValue < saveLower[iColumn] || targetValue > saveUpper[iColumn]) { } } else { priorityLevel += 10000000; } } if (infeasibility) { // Increase estimated degradation to solution estimatedDegradation += CoinMin(object->upEstimate(), object->downEstimate()); numberUnsatisfied_++; sumInfeasibilities_ += infeasibility; // Better priority? Flush choices. if (priorityLevel < bestPriority) { int j; iSmallest = 0; for (j = 0; j < maximumStrong; j++) { choice[j].upMovement = 0.0; delete choice[j].possibleBranch; choice[j].possibleBranch = NULL; } bestPriority = priorityLevel; mostAway = 1.0e-100; numberStrong = 0; } else if (priorityLevel > bestPriority) { continue; } // Check for suitability based on infeasibility. if (infeasibility > mostAway) { //add to list choice[iSmallest].upMovement = infeasibility; delete choice[iSmallest].possibleBranch; CbcObject * obj = dynamic_cast (object) ; assert (obj); choice[iSmallest].possibleBranch = obj->createCbcBranch(solver, &usefulInfo, preferredWay); numberStrong = CoinMax(numberStrong, iSmallest + 1); // Save which object it was choice[iSmallest].objectNumber = i; int j; iSmallest = -1; mostAway = 1.0e50; for (j = 0; j < maximumStrong; j++) { if (choice[j].upMovement < mostAway) { mostAway = choice[j].upMovement; iSmallest = j; } } } } } if (!canDoOneHot && hotstartSolution) { // switch off as not possible hotstartSolution = NULL; model->setHotstartSolution(NULL, NULL); usefulInfo.hotstartSolution_ = NULL; } if (numberUnsatisfied_) { // some infeasibilities - go to next steps #ifdef CLP_INVESTIGATE if (hotstartSolution) { int k = choice[0].objectNumber; OsiObject * object = model->modifiableObject(k); const CbcSimpleInteger * thisOne = dynamic_cast (object); assert (thisOne); int iColumn = thisOne->columnNumber(); double targetValue = hotstartSolution[iColumn]; double value = saveSolution[iColumn]; printf("Branch on %d has target %g (value %g) and current bounds %g and %g\n", iColumn, targetValue, value, saveLower[iColumn], saveUpper[iColumn]); } #endif break; } else if (!iPass) { // looks like a solution - get paranoid bool roundAgain = false; // get basis CoinWarmStartBasis * ws = dynamic_cast(solver->getWarmStart()); if (!ws) break; for (i = 0; i < numberColumns; i++) { double value = saveSolution[i]; if (value < lower[i]) { saveSolution[i] = lower[i]; roundAgain = true; ws->setStructStatus(i, CoinWarmStartBasis::atLowerBound); } else if (value > upper[i]) { saveSolution[i] = upper[i]; roundAgain = true; ws->setStructStatus(i, CoinWarmStartBasis::atUpperBound); } } if (roundAgain && saveNumberStrong) { // restore basis solver->setWarmStart(ws); delete ws; solver->resolve(); memcpy(saveSolution, solver->getColSolution(), numberColumns*sizeof(double)); model->reserveCurrentSolution(saveSolution); if (!solver->isProvenOptimal()) { // infeasible anyAction = -2; break; } } else { delete ws; break; } } } /* Some solvers can do the strong branching calculations faster if they do them all at once. At present only Clp does for ordinary integers but I think this coding would be easy to modify */ bool allNormal = true; // to say if we can do fast strong branching // Say which one will be best int bestChoice = 0; double worstInfeasibility = 0.0; for (i = 0; i < numberStrong; i++) { choice[i].numIntInfeasUp = numberUnsatisfied_; choice[i].numIntInfeasDown = numberUnsatisfied_; choice[i].fix = 0; // say not fixed if (!dynamic_cast (model->object(choice[i].objectNumber))) allNormal = false; // Something odd so lets skip clever fast branching if ( !model->object(choice[i].objectNumber)->boundBranch()) numberStrong = 0; // switch off if ( choice[i].possibleBranch->numberBranches() > 2) numberStrong = 0; // switch off // Do best choice in case switched off if (choice[i].upMovement > worstInfeasibility) { worstInfeasibility = choice[i].upMovement; bestChoice = i; } } //if (!model->parentModel()) //solver->writeMps("query"); // If we have hit max time don't do strong branching bool hitMaxTime = (model->getCurrentSeconds() > model->getDblParam(CbcModel::CbcMaximumSeconds)); // also give up if we are looping round too much if (hitMaxTime || numberPassesLeft <= 0) numberStrong = 0; /* Is strong branching enabled? If so, set up and do it. Otherwise, we'll fall through to simple branching. Setup for strong branching involves saving the current basis (for restoration afterwards) and setting up for hot starts. */ if (numberStrong && saveNumberStrong) { bool solveAll = false; // set true to say look at all even if some fixed (experiment) solveAll = true; // worth trying if too many times // Save basis CoinWarmStart * ws = solver->getWarmStart(); // save limit int saveLimit; solver->getIntParam(OsiMaxNumIterationHotStart, saveLimit); if (beforeSolution && saveLimit < 100) solver->setIntParam(OsiMaxNumIterationHotStart, 100); // go to end # ifdef COIN_HAS_CLP /* If we are doing all strong branching in one go then we create new arrays to store information. If clp NULL then doing old way. Going down - outputSolution[2*i] is final solution. outputStuff[2*i] is status (0 - finished, 1 infeas, other unknown outputStuff[2*i+numberStrong] is number iterations On entry newUpper[i] is new upper bound, on exit obj change Going up - outputSolution[2*i+1] is final solution. outputStuff[2*i+1] is status (0 - finished, 1 infeas, other unknown outputStuff[2*i+1+numberStrong] is number iterations On entry newLower[i] is new lower bound, on exit obj change */ ClpSimplex * clp = NULL; double * newLower = NULL; double * newUpper = NULL; double ** outputSolution = NULL; int * outputStuff = NULL; // Go back to normal way if user wants it if (osiclp && (osiclp->specialOptions()&16) != 0 && osiclp->specialOptions() > 0) allNormal = false; if (osiclp && !allNormal) { // say do fast int easy = 1; osiclp->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, &easy) ; } if (osiclp && allNormal) { clp = osiclp->getModelPtr(); // Clp - do a different way newLower = new double[numberStrong]; newUpper = new double[numberStrong]; outputSolution = new double * [2*numberStrong]; outputStuff = new int [4*numberStrong]; int * which = new int[numberStrong]; int startFinishOptions; int specialOptions = osiclp->specialOptions(); int clpOptions = clp->specialOptions(); int returnCode = 0; #define CRUNCH #ifdef CRUNCH // Crunch down problem int numberRows = clp->numberRows(); // Use dual region double * rhs = clp->dualRowSolution(); int * whichRow = new int[3*numberRows]; int * whichColumn = new int[2*numberColumns]; int nBound; ClpSimplex * small = static_cast (clp)->crunch(rhs, whichRow, whichColumn, nBound, true); if (!small) { anyAction = -2; //printf("XXXX Inf by inspection\n"); delete [] whichColumn; whichColumn = NULL; delete [] whichRow; whichRow = NULL; break; } else { clp = small; } #else int saveLogLevel = clp->logLevel(); int saveMaxIts = clp->maximumIterations(); #endif clp->setLogLevel(0); if ((specialOptions&1) == 0) { startFinishOptions = 0; clp->setSpecialOptions(clpOptions | (64 | 1024)); } else { startFinishOptions = 1 + 2 + 4; //startFinishOptions=1+4; // for moment re-factorize if ((specialOptions&4) == 0) clp->setSpecialOptions(clpOptions | (64 | 128 | 512 | 1024 | 4096)); else clp->setSpecialOptions(clpOptions | (64 | 128 | 512 | 1024 | 2048 | 4096)); } // User may want to clean up before strong branching if ((clp->specialOptions()&32) != 0) { clp->primal(1); if (clp->numberIterations()) model->messageHandler()->message(CBC_ITERATE_STRONG, *model->messagesPointer()) << clp->numberIterations() << CoinMessageEol; } clp->setMaximumIterations(saveLimit); #ifdef CRUNCH int * backColumn = whichColumn + numberColumns; #endif for (i = 0; i < numberStrong; i++) { int iObject = choice[i].objectNumber; const OsiObject * object = model->object(iObject); const CbcSimpleInteger * simple = static_cast (object); int iSequence = simple->columnNumber(); newLower[i] = ceil(saveSolution[iSequence]); newUpper[i] = floor(saveSolution[iSequence]); #ifdef CRUNCH iSequence = backColumn[iSequence]; assert (iSequence >= 0); #endif which[i] = iSequence; outputSolution[2*i] = new double [numberColumns]; outputSolution[2*i+1] = new double [numberColumns]; } //clp->writeMps("bad"); returnCode = clp->strongBranching(numberStrong, which, newLower, newUpper, outputSolution, outputStuff, outputStuff + 2 * numberStrong, !solveAll, false, startFinishOptions); #ifndef CRUNCH clp->setSpecialOptions(clpOptions); // restore clp->setMaximumIterations(saveMaxIts); clp->setLogLevel(saveLogLevel); #endif if (returnCode == -2) { // bad factorization!!! // Doing normal way // Mark hot start solver->markHotStart(); clp = NULL; } else { #ifdef CRUNCH // extract solution //bool checkSol=true; for (i = 0; i < numberStrong; i++) { int iObject = choice[i].objectNumber; const OsiObject * object = model->object(iObject); const CbcSimpleInteger * simple = static_cast (object); int iSequence = simple->columnNumber(); which[i] = iSequence; double * sol = outputSolution[2*i]; double * sol2 = outputSolution[2*i+1]; //bool x=true; //bool x2=true; for (int iColumn = numberColumns - 1; iColumn >= 0; iColumn--) { int jColumn = backColumn[iColumn]; if (jColumn >= 0) { sol[iColumn] = sol[jColumn]; sol2[iColumn] = sol2[jColumn]; } else { sol[iColumn] = saveSolution[iColumn]; sol2[iColumn] = saveSolution[iColumn]; } } } #endif } #ifdef CRUNCH delete [] whichColumn; delete [] whichRow; delete small; #endif delete [] which; } else { // Doing normal way // Mark hot start solver->markHotStart(); } # else /* COIN_HAS_CLP */ OsiSolverInterface *clp = NULL ; double **outputSolution = NULL ; int *outputStuff = NULL ; double * newLower = NULL ; double * newUpper = NULL ; solver->markHotStart(); # endif /* COIN_HAS_CLP */ /* Open a loop to do the strong branching LPs. For each candidate variable, solve an LP with the variable forced down, then up. If a direction turns out to be infeasible or monotonic (i.e., over the dual objective cutoff), force the objective change to be big (1.0e100). If we determine the problem is infeasible, or find a monotone variable, escape the loop. TODO: The `restore bounds' part might be better encapsulated as an unbranch() method. Branching objects more exotic than simple integers or cliques might not restrict themselves to variable bounds. TODO: Virtuous solvers invalidate the current solution (or give bogus results :-) when the bounds are changed out from under them. So we need to do all the work associated with finding a new solution before restoring the bounds. */ for (i = 0 ; i < numberStrong ; i++) { double objectiveChange ; double newObjectiveValue = 1.0e100; // status is 0 finished, 1 infeasible and other int iStatus; /* Try the down direction first. (Specify the initial branching alternative as down with a call to way(-1). Each subsequent call to branch() performs the specified branch and advances the branch object state to the next branch alternative.) */ if (!clp) { choice[i].possibleBranch->way(-1) ; choice[i].possibleBranch->branch() ; bool feasible = true; if (checkFeasibility) { // check branching did not make infeasible int iColumn; int numberColumns = solver->getNumCols(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLower[iColumn] > columnUpper[iColumn] + 1.0e-5) feasible = false; } } if (feasible) { solver->solveFromHotStart() ; numberStrongDone++; numberStrongIterations += solver->getIterationCount(); /* We now have an estimate of objective degradation that we can use for strong branching. If we're over the cutoff, the variable is monotone up. If we actually made it to optimality, check for a solution, and if we have a good one, call setBestSolution to process it. Note that this may reduce the cutoff, so we check again to see if we can declare this variable monotone. */ if (solver->isProvenOptimal()) iStatus = 0; // optimal else if (solver->isIterationLimitReached() && !solver->isDualObjectiveLimitReached()) iStatus = 2; // unknown else iStatus = 1; // infeasible newObjectiveValue = solver->getObjSense() * solver->getObjValue(); choice[i].numItersDown = solver->getIterationCount(); } else { iStatus = 1; // infeasible newObjectiveValue = 1.0e100; choice[i].numItersDown = 0; } } else { iStatus = outputStuff[2*i]; choice[i].numItersDown = outputStuff[2*numberStrong+2*i]; numberStrongDone++; numberStrongIterations += choice[i].numItersDown; newObjectiveValue = objectiveValue + newUpper[i]; solver->setColSolution(outputSolution[2*i]); } objectiveChange = CoinMax(newObjectiveValue - objectiveValue_, 0.0); if (!iStatus) { choice[i].finishedDown = true ; if (newObjectiveValue >= model->getCutoff()) { objectiveChange = 1.0e100; // say infeasible numberStrongInfeasible++; } else { // See if integer solution if (model->feasibleSolution(choice[i].numIntInfeasDown, choice[i].numObjInfeasDown) && model->problemFeasibility()->feasible(model, -1) >= 0) { model->setBestSolution(CBC_STRONGSOL, newObjectiveValue, solver->getColSolution()) ; // only needed for odd solvers newObjectiveValue = solver->getObjSense() * solver->getObjValue(); objectiveChange = CoinMax(newObjectiveValue - objectiveValue_, 0.0) ; model->setLastHeuristic(NULL); model->incrementUsed(solver->getColSolution()); if (newObjectiveValue >= model->getCutoff()) { // *new* cutoff objectiveChange = 1.0e100 ; numberStrongInfeasible++; } } } } else if (iStatus == 1) { objectiveChange = 1.0e100 ; numberStrongInfeasible++; } else { // Can't say much as we did not finish choice[i].finishedDown = false ; numberUnfinished++; } choice[i].downMovement = objectiveChange ; // restore bounds if (!clp) { for (int j = 0; j < numberColumns; j++) { if (saveLower[j] != lower[j]) solver->setColLower(j, saveLower[j]); if (saveUpper[j] != upper[j]) solver->setColUpper(j, saveUpper[j]); } } //printf("Down on %d, status is %d, obj %g its %d cost %g finished %d inf %d infobj %d\n", // choice[i].objectNumber,iStatus,newObjectiveValue,choice[i].numItersDown, // choice[i].downMovement,choice[i].finishedDown,choice[i].numIntInfeasDown, // choice[i].numObjInfeasDown); // repeat the whole exercise, forcing the variable up if (!clp) { bool feasible = true; // If odd branching then maybe just one possibility if (choice[i].possibleBranch->numberBranchesLeft() > 0) { choice[i].possibleBranch->branch(); if (checkFeasibility) { // check branching did not make infeasible int iColumn; int numberColumns = solver->getNumCols(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLower[iColumn] > columnUpper[iColumn] + 1.0e-5) feasible = false; } } } else { // second branch infeasible feasible = false; } if (feasible) { solver->solveFromHotStart() ; numberStrongDone++; numberStrongIterations += solver->getIterationCount(); /* We now have an estimate of objective degradation that we can use for strong branching. If we're over the cutoff, the variable is monotone up. If we actually made it to optimality, check for a solution, and if we have a good one, call setBestSolution to process it. Note that this may reduce the cutoff, so we check again to see if we can declare this variable monotone. */ if (solver->isProvenOptimal()) iStatus = 0; // optimal else if (solver->isIterationLimitReached() && !solver->isDualObjectiveLimitReached()) iStatus = 2; // unknown else iStatus = 1; // infeasible newObjectiveValue = solver->getObjSense() * solver->getObjValue(); choice[i].numItersUp = solver->getIterationCount(); } else { iStatus = 1; // infeasible newObjectiveValue = 1.0e100; choice[i].numItersDown = 0; } } else { iStatus = outputStuff[2*i+1]; choice[i].numItersUp = outputStuff[2*numberStrong+2*i+1]; numberStrongDone++; numberStrongIterations += choice[i].numItersUp; newObjectiveValue = objectiveValue + newLower[i]; solver->setColSolution(outputSolution[2*i+1]); } objectiveChange = CoinMax(newObjectiveValue - objectiveValue_, 0.0); if (!iStatus) { choice[i].finishedUp = true ; if (newObjectiveValue >= model->getCutoff()) { objectiveChange = 1.0e100; // say infeasible numberStrongInfeasible++; } else { // See if integer solution if (model->feasibleSolution(choice[i].numIntInfeasUp, choice[i].numObjInfeasUp) && model->problemFeasibility()->feasible(model, -1) >= 0) { model->setBestSolution(CBC_STRONGSOL, newObjectiveValue, solver->getColSolution()) ; // only needed for odd solvers newObjectiveValue = solver->getObjSense() * solver->getObjValue(); objectiveChange = CoinMax(newObjectiveValue - objectiveValue_, 0.0) ; model->setLastHeuristic(NULL); model->incrementUsed(solver->getColSolution()); if (newObjectiveValue >= model->getCutoff()) { // *new* cutoff objectiveChange = 1.0e100 ; numberStrongInfeasible++; } } } } else if (iStatus == 1) { objectiveChange = 1.0e100 ; numberStrongInfeasible++; } else { // Can't say much as we did not finish choice[i].finishedUp = false ; numberUnfinished++; } choice[i].upMovement = objectiveChange ; // restore bounds if (!clp) { for (int j = 0; j < numberColumns; j++) { if (saveLower[j] != lower[j]) solver->setColLower(j, saveLower[j]); if (saveUpper[j] != upper[j]) solver->setColUpper(j, saveUpper[j]); } } //printf("Up on %d, status is %d, obj %g its %d cost %g finished %d inf %d infobj %d\n", // choice[i].objectNumber,iStatus,newObjectiveValue,choice[i].numItersUp, // choice[i].upMovement,choice[i].finishedUp,choice[i].numIntInfeasUp, // choice[i].numObjInfeasUp); /* End of evaluation for this candidate variable. Possibilities are: * Both sides below cutoff; this variable is a candidate for branching. * Both sides infeasible or above the objective cutoff: no further action here. Break from the evaluation loop and assume the node will be purged by the caller. * One side below cutoff: Install the branch (i.e., fix the variable). Break from the evaluation loop and assume the node will be reoptimised by the caller. */ // reset choice[i].possibleBranch->resetNumberBranchesLeft(); if (choice[i].upMovement < 1.0e100) { if (choice[i].downMovement < 1.0e100) { // feasible - no action } else { // up feasible, down infeasible anyAction = -1; //printf("Down infeasible for choice %d sequence %d\n",i, // model->object(choice[i].objectNumber)->columnNumber()); if (!solveAll) { choice[i].possibleBranch->way(1); choice[i].possibleBranch->branch(); break; } else { choice[i].fix = 1; } } } else { if (choice[i].downMovement < 1.0e100) { // down feasible, up infeasible anyAction = -1; //printf("Up infeasible for choice %d sequence %d\n",i, // model->object(choice[i].objectNumber)->columnNumber()); if (!solveAll) { choice[i].possibleBranch->way(-1); choice[i].possibleBranch->branch(); break; } else { choice[i].fix = -1; } } else { // neither side feasible anyAction = -2; //printf("Both infeasible for choice %d sequence %d\n",i, // model->object(choice[i].objectNumber)->columnNumber()); break; } } bool hitMaxTime = (model->getCurrentSeconds() > model->getDblParam(CbcModel::CbcMaximumSeconds)); if (hitMaxTime) { numberStrong = i + 1; break; } } if (!clp) { // Delete the snapshot solver->unmarkHotStart(); } else { delete [] newLower; delete [] newUpper; delete [] outputStuff; int i; for (i = 0; i < 2*numberStrong; i++) delete [] outputSolution[i]; delete [] outputSolution; } solver->setIntParam(OsiMaxNumIterationHotStart, saveLimit); // restore basis solver->setWarmStart(ws); // Unless infeasible we will carry on // But we could fix anyway if (anyAction == -1 && solveAll) { // apply and take off for (i = 0 ; i < numberStrong ; i++) { if (choice[i].fix) { choice[i].possibleBranch->way(choice[i].fix) ; choice[i].possibleBranch->branch() ; } } bool feasible = true; if (checkFeasibility) { // check branching did not make infeasible int iColumn; int numberColumns = solver->getNumCols(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLower[iColumn] > columnUpper[iColumn] + 1.0e-5) feasible = false; } } if (feasible) { // can do quick optimality check int easy = 2; solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, &easy) ; solver->resolve() ; solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; feasible = solver->isProvenOptimal(); } if (feasible) { memcpy(saveSolution, solver->getColSolution(), numberColumns*sizeof(double)); model->reserveCurrentSolution(saveSolution); memcpy(saveLower, solver->getColLower(), numberColumns*sizeof(double)); memcpy(saveUpper, solver->getColUpper(), numberColumns*sizeof(double)); // Clean up all candidates whih are fixed int numberLeft = 0; for (i = 0 ; i < numberStrong ; i++) { CbcStrongInfo thisChoice = choice[i]; choice[i].possibleBranch = NULL; const OsiObject * object = model->object(thisChoice.objectNumber); double infeasibility = object->checkInfeasibility(&usefulInfo); if (!infeasibility) { // take out delete thisChoice.possibleBranch; } else { choice[numberLeft++] = thisChoice; } } numberStrong = numberLeft; for (; i < maximumStrong; i++) { delete choice[i].possibleBranch; choice[i].possibleBranch = NULL; } // If all fixed then round again if (!numberLeft) { finished = false; numberStrong = 0; saveNumberStrong = 0; maximumStrong = 1; } else { anyAction = 0; } // If these two uncommented then different action anyAction = -1; finished = true; //printf("some fixed but continuing %d left\n",numberLeft); } else { anyAction = -2; // say infeasible } } delete ws; //int numberNodes = model->getNodeCount(); // update number of strong iterations etc model->incrementStrongInfo(numberStrongDone, numberStrongIterations, anyAction == -2 ? 0 : numberStrongInfeasible, anyAction == -2); /* anyAction >= 0 indicates that strong branching didn't produce any monotone variables. Sift through the candidates for the best one. QUERY: Setting numberNodes looks to be a distributed noop. numberNodes is local to this code block. Perhaps should be numberNodes_ from model? Unclear what this calculation is doing. */ if (anyAction >= 0) { // get average cost per iteration and assume stopped ones // would stop after 50% more iterations at average cost??? !!! ??? double averageCostPerIteration = 0.0; double totalNumberIterations = 1.0; int smallestNumberInfeasibilities = COIN_INT_MAX; for (i = 0; i < numberStrong; i++) { totalNumberIterations += choice[i].numItersDown + choice[i].numItersUp ; averageCostPerIteration += choice[i].downMovement + choice[i].upMovement; smallestNumberInfeasibilities = CoinMin(CoinMin(choice[i].numIntInfeasDown , choice[i].numIntInfeasUp ), smallestNumberInfeasibilities); } //if (smallestNumberInfeasibilities>=numberIntegerInfeasibilities) //numberNodes=1000000; // switch off search for better solution averageCostPerIteration /= totalNumberIterations; // all feasible - choose best bet // New method does all at once so it can be more sophisticated // in deciding how to balance actions. // But it does need arrays double * changeUp = new double [numberStrong]; int * numberInfeasibilitiesUp = new int [numberStrong]; double * changeDown = new double [numberStrong]; int * numberInfeasibilitiesDown = new int [numberStrong]; CbcBranchingObject ** objects = new CbcBranchingObject * [ numberStrong]; for (i = 0 ; i < numberStrong ; i++) { int iColumn = choice[i].possibleBranch->variable() ; model->messageHandler()->message(CBC_STRONG, *model->messagesPointer()) << i << iColumn << choice[i].downMovement << choice[i].numIntInfeasDown << choice[i].upMovement << choice[i].numIntInfeasUp << choice[i].possibleBranch->value() << CoinMessageEol; changeUp[i] = choice[i].upMovement; numberInfeasibilitiesUp[i] = choice[i].numIntInfeasUp; changeDown[i] = choice[i].downMovement; numberInfeasibilitiesDown[i] = choice[i].numIntInfeasDown; objects[i] = choice[i].possibleBranch; } int whichObject = decision->bestBranch(objects, numberStrong, numberUnsatisfied_, changeUp, numberInfeasibilitiesUp, changeDown, numberInfeasibilitiesDown, objectiveValue_); // move branching object and make sure it will not be deleted if (whichObject >= 0) { branch_ = objects[whichObject]; if (model->messageHandler()->logLevel() > 3) printf("Choosing column %d\n", choice[whichObject].possibleBranch->variable()) ; choice[whichObject].possibleBranch = NULL; } delete [] changeUp; delete [] numberInfeasibilitiesUp; delete [] changeDown; delete [] numberInfeasibilitiesDown; delete [] objects; } # ifdef COIN_HAS_CLP if (osiclp && !allNormal) { // back to normal osiclp->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; } # endif } /* Simple branching. Probably just one, but we may have got here because of an odd branch e.g. a cut */ else { // not strong // C) create branching object branch_ = choice[bestChoice].possibleBranch; choice[bestChoice].possibleBranch = NULL; } } // Set guessed solution value guessedObjectiveValue_ = objectiveValue_ + estimatedDegradation; //printf ("Node %d depth %d unsatisfied %d sum %g obj %g guess %g\n", // model->getNodeCount(),depth_,numberUnsatisfied_, // sumInfeasibilities_,objectiveValue_,guessedObjectiveValue_); /* Cleanup, then we're outta here. */ if (!model->branchingMethod() || dynamicBranchingObject) delete decision; for (i = 0; i < maximumStrong; i++) delete choice[i].possibleBranch; delete [] choice; delete [] saveLower; delete [] saveUpper; // restore solution solver->setColSolution(saveSolution); delete [] saveSolution; # ifdef COIN_HAS_CLP if (osiclp) osiclp->setSpecialOptions(saveClpOptions); # endif return anyAction; } /* Version for dynamic pseudo costs. **** For now just return if anything odd later allow even if odd The routine scans through the object list of the model looking for objects that indicate infeasibility. It tests each object using strong branching and selects the one with the least objective degradation. A corresponding branching object is left attached to lastNode. This version gives preference in evaluation to variables which have not been evaluated many times. It also uses numberStrong to say give up if last few tries have not changed incumbent. See Achterberg, Koch and Martin. If strong branching is disabled, a candidate object is chosen essentially at random (whatever object ends up in pos'n 0 of the candidate array). If a branching candidate is found to be monotone, bounds are set to fix the variable and the routine immediately returns (the caller is expected to reoptimize). If a branching candidate is found to result in infeasibility in both directions, the routine immediately returns an indication of infeasibility. Returns: 0 both branch directions are feasible -1 branching variable is monotone -2 infeasible -3 Use another method For now just fix on objective from strong branching. */ int CbcNode::chooseDynamicBranch (CbcModel *model, CbcNode *lastNode, OsiSolverBranch * & /*branches*/, int numberPassesLeft) { if (lastNode) depth_ = lastNode->depth_ + 1; else depth_ = 0; // Go to other choose if hot start if (model->hotstartSolution() && (((model->moreSpecialOptions()&1024) == 0) || false)) return -3; delete branch_; branch_ = NULL; OsiSolverInterface * solver = model->solver(); //#define CHECK_DEBUGGER_PATH #ifdef CHECK_DEBUGGER_PATH bool onOptimalPath=false; if ((model->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (debugger) { onOptimalPath = true; } } #endif // get information on solver type const OsiAuxInfo * auxInfo = solver->getAuxiliaryInfo(); const OsiBabSolver * auxiliaryInfo = dynamic_cast (auxInfo); if (!auxiliaryInfo) { // use one from CbcModel auxiliaryInfo = model->solverCharacteristics(); } int numberObjects = model->numberObjects(); // If very odd set of objects then use older chooseBranch bool useOldWay = false; // point to useful information OsiBranchingInformation usefulInfo = model->usefulInformation(); if (numberObjects > model->numberIntegers()) { for (int i = model->numberIntegers(); i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); CbcObject * obj = dynamic_cast (object) ; if (!obj || !obj->optionalObject()) { double infeasibility = object->checkInfeasibility(&usefulInfo); if (infeasibility) { useOldWay = true; break; } } else { obj->initializeForBranching(model); } } } if ((model->specialOptions()&128) != 0) useOldWay = false; // allow // For now return if not simple if (useOldWay) return -3; // Modify useful info usefulInfo.depth_ = depth_; if ((model->specialOptions()&128) != 0) { // SOS - shadow prices int numberRows = solver->getNumRows(); const double * pi = usefulInfo.pi_; double sumPi = 0.0; for (int i = 0; i < numberRows; i++) sumPi += fabs(pi[i]); sumPi /= static_cast (numberRows); // and scale back sumPi *= 0.01; usefulInfo.defaultDual_ = sumPi; // switch on int numberColumns = solver->getNumCols(); int size = CoinMax(numberColumns, 2 * numberRows); usefulInfo.usefulRegion_ = new double [size]; CoinZeroN(usefulInfo.usefulRegion_, size); usefulInfo.indexRegion_ = new int [size]; // pi may change usefulInfo.pi_ = CoinCopyOfArray(usefulInfo.pi_, numberRows); } assert (auxiliaryInfo); double cutoff = model->getCutoff(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); // See if user thinks infeasible int anyAction = model->problemFeasibility()->feasible(model, 0); if (anyAction) { // will return -2 if infeasible , 0 if treat as integer return anyAction - 1; } int i; int saveStateOfSearch = model->stateOfSearch() % 10; int numberStrong = model->numberStrong(); /* Ranging is switched off. The idea is that you can find out the effect of one iteration on each unsatisfied variable cheaply. Then use this if you have not got much else to go on. */ //#define RANGING #ifdef RANGING // must have clp #ifndef COIN_HAS_CLP # warning("Ranging switched off as not Clp"); #undef RANGING #endif // Pass number int kPass = 0; int numberRows = solver->getNumRows(); #endif int numberColumns = model->getNumCols(); double * saveUpper = new double[numberColumns]; double * saveLower = new double[numberColumns]; for (i = 0; i < numberColumns; i++) { saveLower[i] = lower[i]; saveUpper[i] = upper[i]; } // Save solution in case heuristics need good solution later double * saveSolution = new double[numberColumns]; memcpy(saveSolution, solver->getColSolution(), numberColumns*sizeof(double)); model->reserveCurrentSolution(saveSolution); const double * hotstartSolution = model->hotstartSolution(); const int * hotstartPriorities = model->hotstartPriorities(); double integerTolerance = model->getDblParam(CbcModel::CbcIntegerTolerance); if (hotstartSolution) { if ((model->moreSpecialOptions()&1024) != 0) { int nBad = 0; int nUnsat = 0; int nDiff = 0; for (int i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); const CbcSimpleInteger * thisOne = dynamic_cast (object); if (thisOne) { int iColumn = thisOne->columnNumber(); double targetValue = hotstartSolution[iColumn]; double value = saveSolution[iColumn]; if (fabs(value - floor(value + 0.5)) > 1.0e-6) { nUnsat++; #ifdef CLP_INVESTIGATE printf("H %d is %g target %g\n", iColumn, value, targetValue); #endif } else if (fabs(targetValue - value) > 1.0e-6) { nDiff++; } if (targetValue < saveLower[iColumn] || targetValue > saveUpper[iColumn]) { #ifdef CLP_INVESTIGATE printf("%d has target %g and current bounds %g and %g\n", iColumn, targetValue, saveLower[iColumn], saveUpper[iColumn]); #endif nBad++; } } } #ifdef CLP_INVESTIGATE printf("Hot %d unsatisfied, %d outside limits, %d different\n", nUnsat, nBad, nDiff); #endif if (nBad) { // switch off as not possible hotstartSolution = NULL; model->setHotstartSolution(NULL, NULL); usefulInfo.hotstartSolution_ = NULL; } } } /* Get a branching decision object. Use the default dynamic decision criteria unless the user has loaded a decision method into the model. */ CbcBranchDecision *decision = model->branchingMethod(); if (!decision) decision = new CbcBranchDynamicDecision(); int xMark = 0; // Get arrays to sort double * sort = new double[numberObjects]; int * whichObject = new int[numberObjects]; #ifdef RANGING int xPen = 0; int * objectMark = new int[2*numberObjects+1]; #endif // Arrays with movements double * upEstimate = new double[numberObjects]; double * downEstimate = new double[numberObjects]; double estimatedDegradation = 0.0; int numberNodes = model->getNodeCount(); int saveLogLevel = model->logLevel(); #ifdef JJF_ZERO if ((numberNodes % 500) == 0) { model->setLogLevel(6); // Get average up and down costs double averageUp = 0.0; double averageDown = 0.0; int numberUp = 0; int numberDown = 0; int i; for ( i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; assert(dynamicObject); int numberUp2 = 0; int numberDown2 = 0; double up = 0.0; double down = 0.0; if (dynamicObject->numberTimesUp()) { numberUp++; averageUp += dynamicObject->upDynamicPseudoCost(); numberUp2 += dynamicObject->numberTimesUp(); up = dynamicObject->upDynamicPseudoCost(); } if (dynamicObject->numberTimesDown()) { numberDown++; averageDown += dynamicObject->downDynamicPseudoCost(); numberDown2 += dynamicObject->numberTimesDown(); down = dynamicObject->downDynamicPseudoCost(); } if (numberUp2 || numberDown2) printf("col %d - up %d times cost %g, - down %d times cost %g\n", dynamicObject->columnNumber(), numberUp2, up, numberDown2, down); } if (numberUp) averageUp /= static_cast (numberUp); else averageUp = 1.0; if (numberDown) averageDown /= static_cast (numberDown); else averageDown = 1.0; printf("total - up %d vars average %g, - down %d vars average %g\n", numberUp, averageUp, numberDown, averageDown); } #endif int numberBeforeTrust = model->numberBeforeTrust(); // May go round twice if strong branching fixes all local candidates bool finished = false; int numberToFix = 0; # ifdef COIN_HAS_CLP OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver); int saveClpOptions = 0; if (osiclp) { // for faster hot start saveClpOptions = osiclp->specialOptions(); osiclp->setSpecialOptions(saveClpOptions | 8192); } # else OsiSolverInterface *osiclp = NULL ; # endif //const CglTreeProbingInfo * probingInfo = NULL; //model->probingInfo(); // Old code left in with DEPRECATED_STRATEGY assert (model->searchStrategy() == -1 || model->searchStrategy() == 1 || model->searchStrategy() == 2); #ifdef DEPRECATED_STRATEGY int saveSearchStrategy2 = model->searchStrategy(); #endif // Get average up and down costs { double averageUp = 0.0; double averageDown = 0.0; int numberUp = 0; int numberDown = 0; int i; for ( i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; if (dynamicObject) { if (dynamicObject->numberTimesUp()) { numberUp++; averageUp += dynamicObject->upDynamicPseudoCost(); } if (dynamicObject->numberTimesDown()) { numberDown++; averageDown += dynamicObject->downDynamicPseudoCost(); } } } if (numberUp) averageUp /= static_cast (numberUp); else averageUp = 1.0; if (numberDown) averageDown /= static_cast (numberDown); else averageDown = 1.0; for ( i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; if (dynamicObject) { if (!dynamicObject->numberTimesUp()) dynamicObject->setUpDynamicPseudoCost(averageUp); if (!dynamicObject->numberTimesDown()) dynamicObject->setDownDynamicPseudoCost(averageDown); } } } /* 1 strong 2 no strong 3 strong just before solution 4 no strong just before solution 5 strong first time or before solution 6 strong first time */ int useShadow = model->moreSpecialOptions() & 7; if (useShadow > 2) { if (model->getSolutionCount()) { if (numberNodes || useShadow < 5) { useShadow = 0; // zap pseudo shadow prices model->pseudoShadow(-1); // and switch off model->setMoreSpecialOptions(model->moreSpecialOptions()&(~1023)); } else { useShadow = 1; } } else if (useShadow < 5) { useShadow -= 2; } else { useShadow = 1; } } if (useShadow) { // pseudo shadow prices model->pseudoShadow((model->moreSpecialOptions() >> 3)&63); } #ifdef DEPRECATED_STRATEGY { // in for tabbing } else if (saveSearchStrategy2 < 1999) { // pseudo shadow prices model->pseudoShadow(NULL, NULL); } else if (saveSearchStrategy2 < 2999) { // leave old ones } else if (saveSearchStrategy2 < 3999) { // pseudo shadow prices at root if (!numberNodes) model->pseudoShadow(NULL, NULL); } else { abort(); } if (saveSearchStrategy2 >= 0) saveSearchStrategy2 = saveSearchStrategy2 % 1000; if (saveSearchStrategy2 == 999) saveSearchStrategy2 = -1; int saveSearchStrategy = saveSearchStrategy2 < 99 ? saveSearchStrategy2 : saveSearchStrategy2 - 100; #endif //DEPRECATED_STRATEGY int numberNotTrusted = 0; int numberStrongDone = 0; int numberUnfinished = 0; int numberStrongInfeasible = 0; int numberStrongIterations = 0; int strongType=0; #define DO_ALL_AT_ROOT #ifdef DO_ALL_AT_ROOT int saveSatisfiedVariables=0; int saveNumberToDo=0; #endif // so we can save lots of stuff CbcStrongInfo choice; CbcDynamicPseudoCostBranchingObject * choiceObject = NULL; if (model->allDynamic()) { CbcSimpleIntegerDynamicPseudoCost * object = NULL; choiceObject = new CbcDynamicPseudoCostBranchingObject(model, 0, -1, 0.5, object); } choice.possibleBranch = choiceObject; numberPassesLeft = CoinMax(numberPassesLeft, 2); /* How dogged to be in strong branching 0 - default 1 - go to end on first time 2 - always go to end */ int goToEndInStrongBranching = (model->moreSpecialOptions2()&(3*8192))>>13; #ifdef COIN_HAS_NTY // 1 after, 2 strong, 3 until depth 5 int orbitOption = (model->moreSpecialOptions2()&(128|256))>>7; #endif //#define DEBUG_SOLUTION #ifdef DEBUG_SOLUTION bool onOptimalPath=false; if ((model->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = model->continuousSolver()->getRowCutDebugger() ; if (debugger) { const OsiRowCutDebugger *debugger2 = model->solver()->getRowCutDebugger() ; printf("On optimal in CbcNode %s\n",debugger2 ? "" : "but bad cuts"); onOptimalPath=true; } } #endif while (!finished) { numberPassesLeft--; finished = true; decision->initialize(model); // Some objects may compute an estimate of best solution from here estimatedDegradation = 0.0; numberToFix = 0; int numberToDo = 0; int iBestNot = -1; int iBestGot = -1; double best = 0.0; numberNotTrusted = 0; numberStrongDone = 0; numberUnfinished = 0; numberStrongInfeasible = 0; numberStrongIterations = 0; #ifdef RANGING int * which = objectMark + numberObjects + 1; int neededPenalties; int optionalPenalties; #endif // We may go round this loop three times (only if we think we have solution) for (int iPass = 0; iPass < 3; iPass++) { // Some objects may compute an estimate of best solution from here estimatedDegradation = 0.0; numberUnsatisfied_ = 0; // initialize sum of "infeasibilities" sumInfeasibilities_ = 0.0; int bestPriority = COIN_INT_MAX; #ifdef JJF_ZERO int number01 = 0; const cliqueEntry * entry = NULL; const int * toZero = NULL; const int * toOne = NULL; const int * backward = NULL; int numberUnsatisProbed = 0; int numberUnsatisNotProbed = 0; // 0-1 if (probingInfo) { number01 = probingInfo->numberIntegers(); entry = probingInfo->fixEntries(); toZero = probingInfo->toZero(); toOne = probingInfo->toOne(); backward = probingInfo->backward(); if (!toZero[number01] || number01 < numberObjects || true) { // no info probingInfo = NULL; } } #endif /* Scan for branching objects that indicate infeasibility. Choose candidates using priority as the first criteria, then integer infeasibility. The algorithm is to fill the array with a set of good candidates (by infeasibility) with priority bestPriority. Finding a candidate with priority better (less) than bestPriority flushes the choice array. (This serves as initialization when the first candidate is found.) */ numberToDo = 0; #ifdef RANGING neededPenalties = 0; optionalPenalties = numberObjects; #endif iBestNot = -1; double bestNot = 0.0; iBestGot = -1; best = 0.0; /* Problem type as set by user or found by analysis. This will be extended 0 - not known 1 - Set partitioning <= 2 - Set partitioning == 3 - Set covering 4 - all +- 1 or all +1 and odd */ int problemType = model->problemType(); bool canDoOneHot = false; for (i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; double infeasibility = object->checkInfeasibility(&usefulInfo); int priorityLevel = object->priority(); if (hotstartSolution) { // we are doing hot start const CbcSimpleInteger * thisOne = dynamic_cast (object); if (thisOne) { int iColumn = thisOne->columnNumber(); bool canDoThisHot = true; double targetValue = hotstartSolution[iColumn]; if (saveUpper[iColumn] > saveLower[iColumn]) { double value = saveSolution[iColumn]; if (hotstartPriorities) priorityLevel = hotstartPriorities[iColumn]; //double originalLower = thisOne->originalLower(); //double originalUpper = thisOne->originalUpper(); // switch off if not possible if (targetValue >= saveLower[iColumn] && targetValue <= saveUpper[iColumn]) { /* priority outranks rest always if negative otherwise can be downgraded if at correct level. Infeasibility may be increased to choose 1.0 values first. choose one near wanted value */ if (fabs(value - targetValue) > integerTolerance) { //if (infeasibility>0.01) //infeasibility = fabs(1.0e6-fabs(value-targetValue)); //else infeasibility = fabs(value - targetValue); priorityLevel = CoinAbs(priorityLevel); } else if (priorityLevel < 0) { priorityLevel = CoinAbs(priorityLevel); if (targetValue == saveLower[iColumn] || targetValue == saveUpper[iColumn]) { infeasibility = integerTolerance + 1.0e-12; } else { // can't priorityLevel += 10000000; canDoThisHot = false; } } else { priorityLevel += 10000000; canDoThisHot = false; } } else { // switch off if not possible canDoThisHot = false; } if (canDoThisHot) canDoOneHot = true; } else if (targetValue < saveLower[iColumn] || targetValue > saveUpper[iColumn]) { } } else { priorityLevel += 10000000; } } #define ZERO_ONE 0 #define ZERO_FAKE 1.0e20; #if ZERO_ONE==1 // branch on 0-1 first (temp) if (fabs(saveSolution[dynamicObject->columnNumber()]) < 1.0) priorityLevel--; #endif #if ZERO_ONE==2 if (fabs(saveSolution[dynamicObject->columnNumber()]) < 1.0) infeasibility *= ZERO_FAKE; #endif if (infeasibility) { int iColumn = numberColumns + i; bool gotDown = false; int numberThisDown = 0; bool gotUp = false; int numberThisUp = 0; double downGuess = object->downEstimate(); double upGuess = object->upEstimate(); if (dynamicObject) { // Use this object's numberBeforeTrust int numberBeforeTrustThis = dynamicObject->numberBeforeTrust(); iColumn = dynamicObject->columnNumber(); gotDown = false; numberThisDown = dynamicObject->numberTimesDown(); if (numberThisDown >= numberBeforeTrustThis) gotDown = true; gotUp = false; numberThisUp = dynamicObject->numberTimesUp(); if (numberThisUp >= numberBeforeTrustThis) gotUp = true; if (!depth_ && false) { // try closest to 0.5 double part = saveSolution[iColumn] - floor(saveSolution[iColumn]); infeasibility = fabs(0.5 - part); } if (problemType > 0 && problemType < 4 && false) { // try closest to 0.5 double part = saveSolution[iColumn] - floor(saveSolution[iColumn]); infeasibility = 0.5 - fabs(0.5 - part); } #ifdef JJF_ZERO if (probingInfo) { int iSeq = backward[iColumn]; assert (iSeq >= 0); infeasibility = 1.0 + (toZero[iSeq+1] - toZero[iSeq]) + 5.0 * CoinMin(toOne[iSeq] - toZero[iSeq], toZero[iSeq+1] - toOne[iSeq]); if (toZero[iSeq+1] > toZero[iSeq]) { numberUnsatisProbed++; } else { numberUnsatisNotProbed++; } } #endif } else { // see if SOS CbcSOS * sosObject = dynamic_cast (object) ; if (sosObject) { gotDown = false; numberThisDown = sosObject->numberTimesDown(); if (numberThisDown >= numberBeforeTrust) gotDown = true; gotUp = false; numberThisUp = sosObject->numberTimesUp(); if (numberThisUp >= numberBeforeTrust) gotUp = true; } else { gotDown = true; numberThisDown = 999999; downGuess = 1.0e20; gotUp = true; numberThisUp = 999999; upGuess = 1.0e20; numberPassesLeft = 0; } } // Increase estimated degradation to solution estimatedDegradation += CoinMin(downGuess, upGuess); downEstimate[i] = downGuess; upEstimate[i] = upGuess; numberUnsatisfied_++; sumInfeasibilities_ += infeasibility; // Better priority? Flush choices. if (priorityLevel < bestPriority) { numberToDo = 0; bestPriority = priorityLevel; iBestGot = -1; best = 0.0; numberNotTrusted = 0; #ifdef RANGING neededPenalties = 0; optionalPenalties = numberObjects; #endif } else if (priorityLevel > bestPriority) { continue; } if (!gotUp || !gotDown) numberNotTrusted++; // Check for suitability based on infeasibility. if ((gotDown && gotUp) && numberStrong > 0) { sort[numberToDo] = -infeasibility; if (infeasibility > best) { best = infeasibility; iBestGot = numberToDo; } #ifdef RANGING if (dynamicObject) { objectMark[--optionalPenalties] = numberToDo; which[optionalPenalties] = iColumn; } #endif } else { #ifdef RANGING if (dynamicObject) { objectMark[neededPenalties] = numberToDo; which[neededPenalties++] = iColumn; } #endif sort[numberToDo] = -10.0 * infeasibility; if (!(numberThisUp + numberThisDown)) sort[numberToDo] *= 100.0; // make even more likely if (iColumn < numberColumns) { double part = saveSolution[iColumn] - floor(saveSolution[iColumn]); if (1.0 - fabs(part - 0.5) > bestNot) { iBestNot = numberToDo; bestNot = 1.0 - fabs(part - 0.5); } } else { // SOS if (-sort[numberToDo] > bestNot) { iBestNot = numberToDo; bestNot = -sort[numberToDo]; } } } if (model->messageHandler()->logLevel() > 3) { printf("%d (%d) down %d %g up %d %g - infeas %g - sort %g solution %g\n", i, iColumn, numberThisDown, object->downEstimate(), numberThisUp, object->upEstimate(), infeasibility, sort[numberToDo], saveSolution[iColumn]); } whichObject[numberToDo++] = i; } else { // for debug downEstimate[i] = -1.0; upEstimate[i] = -1.0; } } if (numberUnsatisfied_) { //if (probingInfo&&false) //printf("nunsat %d, %d probed, %d other 0-1\n",numberUnsatisfied_, // numberUnsatisProbed,numberUnsatisNotProbed); // some infeasibilities - go to next steps if (!canDoOneHot && hotstartSolution) { // switch off as not possible hotstartSolution = NULL; model->setHotstartSolution(NULL, NULL); usefulInfo.hotstartSolution_ = NULL; } break; } else if (!iPass) { // may just need resolve model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); if (!solver->isProvenOptimal()) { // infeasible anyAction = -2; break; } // Double check looks OK - just look at rows with all integers if (model->allDynamic()) { double * solution = CoinCopyOfArray(saveSolution, numberColumns); for (int i = 0; i < numberColumns; i++) { if (model->isInteger(i)) solution[i] = floor(solution[i] + 0.5); } int numberRows = solver->getNumRows(); double * rowActivity = new double [numberRows]; CoinZeroN(rowActivity, numberRows); solver->getMatrixByCol()->times(solution, rowActivity); //const double * element = model->solver()->getMatrixByCol()->getElements(); const int * row = model->solver()->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = model->solver()->getMatrixByCol()->getVectorStarts(); const int * columnLength = model->solver()->getMatrixByCol()->getVectorLengths(); int nFree = 0; int nFreeNon = 0; int nFixedNon = 0; double mostAway = 0.0; int whichAway = -1; const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); for (int i = 0; i < numberColumns; i++) { if (!model->isInteger(i)) { // mark rows as flexible CoinBigIndex start = columnStart[i]; CoinBigIndex end = start + columnLength[i]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; rowActivity[iRow] = COIN_DBL_MAX; } } else if (columnLower[i] < columnUpper[i]) { double solutionValue = saveSolution[i]; if (fabs(solution[i] - solutionValue) > integerTolerance && (solutionValue - columnLower[i]) > integerTolerance && (columnUpper[i] - solutionValue) > integerTolerance) { nFreeNon++; if (fabs(solution[i] - saveSolution[i]) > mostAway) { mostAway = fabs(solution[i] - saveSolution[i]); whichAway = i; } } else { nFree++; } } else if (solution[i] != saveSolution[i]) { nFixedNon++; } } const double * lower = solver->getRowLower(); const double * upper = solver->getRowUpper(); bool satisfied = true; for (int i = 0; i < numberRows; i++) { double value = rowActivity[i]; if (value != COIN_DBL_MAX) { if (value > upper[i] + 1.0e-5 || value < lower[i] - 1.0e-5) { satisfied = false; } } } delete [] rowActivity; if (!satisfied) { #ifdef CLP_INVESTIGATE printf("%d free ok %d free off target %d fixed off target\n", nFree, nFreeNon, nFixedNon); #endif if (nFreeNon) { // try branching on these delete branch_; for (int i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); CbcSimpleIntegerDynamicPseudoCost * obj = dynamic_cast (object) ; assert (obj); int iColumn = obj->columnNumber(); if (iColumn == whichAway) { int preferredWay = (saveSolution[iColumn] > solution[iColumn]) ? -1 : +1; usefulInfo.integerTolerance_ = 0.0; branch_ = obj->createCbcBranch(solver, &usefulInfo, preferredWay); break; } } anyAction = 0; break; } } delete [] solution; } } else if (iPass == 1) { // looks like a solution - get paranoid bool roundAgain = false; // get basis CoinWarmStartBasis * ws = dynamic_cast(solver->getWarmStart()); if (!ws) break; double tolerance; solver->getDblParam(OsiPrimalTolerance, tolerance); for (i = 0; i < numberColumns; i++) { double value = saveSolution[i]; if (value < lower[i] - tolerance) { saveSolution[i] = lower[i]; roundAgain = true; ws->setStructStatus(i, CoinWarmStartBasis::atLowerBound); } else if (value > upper[i] + tolerance) { saveSolution[i] = upper[i]; roundAgain = true; ws->setStructStatus(i, CoinWarmStartBasis::atUpperBound); } } if (roundAgain) { // restore basis solver->setWarmStart(ws); solver->setColSolution(saveSolution); delete ws; bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); solver->setHintParam(OsiDoDualInResolve, false, OsiHintDo) ; model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); solver->setHintParam(OsiDoDualInResolve, takeHint, strength) ; if (!solver->isProvenOptimal()) { // infeasible anyAction = -2; break; } } else { delete ws; break; } } } if (anyAction == -2) { break; } // skip if solution if (!numberUnsatisfied_) break; int skipAll = (numberNotTrusted == 0 || numberToDo == 1) ? 1 : 0; bool doneHotStart = false; //DEPRECATED_STRATEGYint searchStrategy = saveSearchStrategy>=0 ? (saveSearchStrategy%10) : -1; int searchStrategy = model->searchStrategy(); // But adjust depending on ratio of iterations if (searchStrategy > 0) { if (numberBeforeTrust >= /*5*/ 10 && numberBeforeTrust <= 10) { if (searchStrategy != 2) { assert (searchStrategy == 1); if (depth_ > 5) { int numberIterations = model->getIterationCount(); int numberStrongIterations = model->numberStrongIterations(); if (numberStrongIterations > numberIterations + 10000) { searchStrategy = 2; skipAll = 1; } else if (numberStrongIterations*4 + 1000 < numberIterations) { searchStrategy = 3; skipAll = 0; } } else { searchStrategy = 3; skipAll = 0; } } } } // worth trying if too many times // Save basis CoinWarmStart * ws = NULL; // save limit int saveLimit = 0; solver->getIntParam(OsiMaxNumIterationHotStart, saveLimit); if (!numberPassesLeft) skipAll = 1; if (!skipAll) { ws = solver->getWarmStart(); int limit = 100; if (!saveStateOfSearch && saveLimit < limit && saveLimit == 100) solver->setIntParam(OsiMaxNumIterationHotStart, limit); } // Say which one will be best int whichChoice = 0; int bestChoice; if (iBestGot >= 0) bestChoice = iBestGot; else bestChoice = iBestNot; assert (bestChoice >= 0); // If we have hit max time don't do strong branching bool hitMaxTime = (model->getCurrentSeconds() > model->getDblParam(CbcModel::CbcMaximumSeconds)); // also give up if we are looping round too much if (hitMaxTime || numberPassesLeft <= 0 || useShadow == 2) { int iObject = whichObject[bestChoice]; OsiObject * object = model->modifiableObject(iObject); int preferredWay; object->infeasibility(&usefulInfo, preferredWay); CbcObject * obj = dynamic_cast (object) ; assert (obj); branch_ = obj->createCbcBranch(solver, &usefulInfo, preferredWay); { CbcBranchingObject * branchObj = dynamic_cast (branch_) ; assert (branchObj); branchObj->way(preferredWay); } delete ws; ws = NULL; break; } else { // say do fast int easy = 1; if (!skipAll) solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, &easy) ; int iDo; #define RESET_BOUNDS #ifdef RANGING bool useRanging = model->allDynamic() && !skipAll; if (useRanging) { double currentObjective = solver->getObjValue() * solver->getObjSense(); double gap = cutoff - currentObjective; // relax a bit gap *= 1.0000001; gap = CoinMax(1.0e-5, gap); // off penalties if too much double needed = neededPenalties; needed *= numberRows; if (numberNodes) { if (needed > 1.0e6) { neededPenalties = 0; } else if (gap < 1.0e5) { // maybe allow some not needed int extra = static_cast ((1.0e6 - needed) / numberRows); int nStored = numberObjects - optionalPenalties; extra = CoinMin(extra, nStored); for (int i = 0; i < extra; i++) { objectMark[neededPenalties] = objectMark[optionalPenalties+i]; which[neededPenalties++] = which[optionalPenalties+i];; } } } if (osiclp && neededPenalties) { assert (!doneHotStart); xPen += neededPenalties; which--; which[0] = neededPenalties; osiclp->passInRanges(which); // Mark hot start and get ranges if (kPass) { // until can work out why solution can go funny int save = osiclp->specialOptions(); osiclp->setSpecialOptions(save | 256); solver->markHotStart(); #ifdef RESET_BOUNDS memcpy(saveLower,solver->getColLower(),solver->getNumCols()*sizeof(double)); memcpy(saveUpper,solver->getColUpper(),solver->getNumCols()*sizeof(double)); #endif osiclp->setSpecialOptions(save); } else { solver->markHotStart(); #ifdef RESET_BOUNDS memcpy(saveLower,solver->getColLower(),solver->getNumCols()*sizeof(double)); memcpy(saveUpper,solver->getColUpper(),solver->getNumCols()*sizeof(double)); #endif } doneHotStart = true; xMark++; kPass++; osiclp->passInRanges(NULL); const double * downCost = osiclp->upRange(); const double * upCost = osiclp->downRange(); bool problemFeasible = true; int numberFixed = 0; for (int i = 0; i < neededPenalties; i++) { int j = objectMark[i]; int iObject = whichObject[j]; OsiObject * object = model->modifiableObject(iObject); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; // Use this object's numberBeforeTrust int numberBeforeTrustThis = dynamicObject->numberBeforeTrust(); int iSequence = dynamicObject->columnNumber(); double value = saveSolution[iSequence]; value -= floor(value); double upPenalty = CoinMin(upCost[i], 1.0e110) * (1.0 - value); double downPenalty = CoinMin(downCost[i], 1.0e110) * value; int numberThisDown = dynamicObject->numberTimesDown(); int numberThisUp = dynamicObject->numberTimesUp(); if (!numberBeforeTrustThis) { // override downEstimate[iObject] = downPenalty; upEstimate[iObject] = upPenalty; double min1 = CoinMin(downEstimate[iObject], upEstimate[iObject]); double max1 = CoinMax(downEstimate[iObject], upEstimate[iObject]); min1 = 0.8 * min1 + 0.2 * max1; sort[j] = - min1; } else if (numberThisDown < numberBeforeTrustThis || numberThisUp < numberBeforeTrustThis) { double invTrust = 1.0 / static_cast (numberBeforeTrustThis); if (numberThisDown < numberBeforeTrustThis) { double fraction = numberThisDown * invTrust; downEstimate[iObject] = fraction * downEstimate[iObject] + (1.0 - fraction) * downPenalty; } if (numberThisUp < numberBeforeTrustThis) { double fraction = numberThisUp * invTrust; upEstimate[iObject] = fraction * upEstimate[iObject] + (1.0 - fraction) * upPenalty; } double min1 = CoinMin(downEstimate[iObject], upEstimate[iObject]); double max1 = CoinMax(downEstimate[iObject], upEstimate[iObject]); min1 = 0.8 * min1 + 0.2 * max1; min1 *= 10.0; if (!(numberThisDown + numberThisUp)) min1 *= 100.0; sort[j] = - min1; } // seems unreliable if (false&&CoinMax(downPenalty, upPenalty) > gap) { COIN_DETAIL_PRINT(printf("gap %g object %d has down range %g, up %g\n", gap, i, downPenalty, upPenalty)); //sort[j] -= 1.0e50; // make more likely to be chosen int number; if (downPenalty > gap) { number = dynamicObject->numberTimesDown(); if (upPenalty > gap) problemFeasible = false; CbcBranchingObject * branch = dynamicObject->createCbcBranch(solver, &usefulInfo, 1); //branch->fix(solver,saveLower,saveUpper,1); delete branch; } else { number = dynamicObject->numberTimesUp(); CbcBranchingObject * branch = dynamicObject->createCbcBranch(solver, &usefulInfo, 1); //branch->fix(solver,saveLower,saveUpper,-1); delete branch; } if (number >= numberBeforeTrustThis) dynamicObject->setNumberBeforeTrust(CoinMin(number + 1,5*numberBeforeTrust)); numberFixed++; } if (!numberNodes) COIN_DETAIL_PRINT(printf("%d pen down ps %g -> %g up ps %g -> %g\n", iObject, downPenalty, downPenalty, upPenalty, upPenalty)); } if (numberFixed && problemFeasible) { assert(doneHotStart); solver->unmarkHotStart(); model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); #ifdef CHECK_DEBUGGER_PATH if ((model->specialOptions()&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { printf("Strong branching down on %d went off optimal path\n",iObject); abort(); } } #endif double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); solver->markHotStart(); #ifdef RESET_BOUNDS memcpy(saveLower,solver->getColLower(),solver->getNumCols()*sizeof(double)); memcpy(saveUpper,solver->getColUpper(),solver->getNumCols()*sizeof(double)); #endif problemFeasible = solver->isProvenOptimal(); } if (!problemFeasible) { COIN_DETAIL_PRINT(fprintf(stdout, "both ways infeas on ranging - code needed\n")); anyAction = -2; if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } //printf("Both infeasible for choice %d sequence %d\n",i, // model->object(choice.objectNumber)->columnNumber()); // Delete the snapshot solver->unmarkHotStart(); // back to normal solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; // restore basis solver->setWarmStart(ws); doneHotStart = false; delete ws; ws = NULL; break; } } } #endif /* RANGING */ { int numberIterations = model->getIterationCount(); //numberIterations += (model->numberExtraIterations()>>2); const int * strongInfo = model->strongInfo(); //int numberDone = strongInfo[0]-strongInfo[3]; int numberFixed = strongInfo[1] - strongInfo[4]; int numberInfeasible = strongInfo[2] - strongInfo[5]; assert (!strongInfo[3]); assert (!strongInfo[4]); assert (!strongInfo[5]); int numberStrongIterations = model->numberStrongIterations(); int numberRows = solver->getNumRows(); if (numberStrongIterations > numberIterations + CoinMin(100, 10*numberRows) && depth_ >= 4 && numberNodes > 100) { if (20*numberInfeasible + 4*numberFixed < numberNodes) { // Say never do if (numberBeforeTrust == 10) skipAll = -1; } } } // make sure best will be first if (iBestGot >= 0) sort[iBestGot] = -COIN_DBL_MAX; // Actions 0 - exit for repeat, 1 resolve and try old choice,2 exit for continue if (anyAction) numberToDo = 0; // skip as we will be trying again // Sort CoinSort_2(sort, sort + numberToDo, whichObject); // Change in objective opposite infeasible double worstFeasible = 0.0; // Just first if strong off if (!numberStrong) numberToDo = CoinMin(numberToDo, 1); if (searchStrategy == 2) numberToDo = CoinMin(numberToDo, 20); iDo = 0; int saveLimit2; solver->getIntParam(OsiMaxNumIterationHotStart, saveLimit2); int numberTest = numberNotTrusted > 0 ? numberStrong : (numberStrong + 1) / 2; if (searchStrategy == 3) { // Previously decided we need strong numberTest = numberStrong; } // Try nearly always off if (skipAll >= 0) { if (searchStrategy < 2) { //if ((numberNodes%20)!=0) { if ((model->specialOptions()&8) == 0) { numberTest = 0; } //} else { //numberTest=2*numberStrong; //skipAll=0; //} } } else { // Just take first numberTest = 1; } int testDepth = (skipAll >= 0) ? 8 : 4; if (depth_ < testDepth && numberStrong) { if (searchStrategy != 2) { int numberRows = solver->getNumRows(); // whether to do this or not is important - think if (numberRows < 300 || numberRows + numberColumns < 2500) { if (depth_ < 7) numberStrong = CoinMin(3 * numberStrong, numberToDo); if (!depth_) numberStrong = CoinMin(6 * numberStrong, numberToDo); } numberTest = numberStrong; skipAll = 0; } } // Do at least 5 strong if (numberColumns < 1000 && (depth_ < 15 || numberNodes < 1000000)) numberTest = CoinMax(numberTest, 5); if ((model->specialOptions()&8) == 0) { if (skipAll) { numberTest = 0; } } else { // do 5 as strong is fixing numberTest = CoinMax(numberTest, 5); } // see if switched off if (skipAll < 0) { numberTest = 0; } int realMaxHotIterations = 999999; if (skipAll < 0) numberToDo = 1; strongType=0; #ifdef DO_ALL_AT_ROOT if (model->strongStrategy()) { int iStrategy=model->strongStrategy(); int kDepth = iStrategy/100; if (kDepth) iStrategy -= 100*kDepth; else kDepth=5; double objValue = solver->getObjSense()*solver->getObjValue(); double bestPossible = model->getBestPossibleObjValue(); bestPossible += 1.0e-7*(1.0+fabs(bestPossible)); int jStrategy = iStrategy/10; if (jStrategy) { if ((jStrategy&1)!=0&&!depth_) strongType=2; else if ((jStrategy&2)!=0&&depth_<=kDepth) strongType=2; else if ((jStrategy&4)!=0&&objValueintegerVariable(); int numberIntegers = model->numberIntegers(); if (numberIntegers==numberObjects) { numberToDo=0; for (int i=0;isaveLower[iColumn]) { whichObject [numberToDo++]=i; } } saveSatisfiedVariables=numberToDo-saveNumberToDo; } else { strongType=1; } } if (strongType) { numberTest = numberToDo; numberStrong=numberToDo; skipAll=0; searchStrategy=0; solver->setIntParam(OsiMaxNumIterationHotStart, 100000); //printf("Strong branching type %d\n",strongType); } } #endif #ifdef COIN_HAS_NTY const int * orbits = NULL; #endif #ifdef COIN_HAS_NTY if (orbitOption==2 /* was >1*/) { CbcSymmetry * symmetryInfo = model->symmetryInfo(); CbcNodeInfo * infoX = lastNode ? lastNode->nodeInfo() : NULL; bool worthTrying = false; if (infoX) { CbcNodeInfo * info = infoX; for (int i=0;iparent()) { worthTrying = true; break; } info = info->parent(); if (info->symmetryWorked()) { worthTrying = true; break; } } } else { worthTrying=true; } if (symmetryInfo && worthTrying) { symmetryInfo->ChangeBounds(solver->getColLower(), solver->getColUpper(), solver->getNumCols(),false); symmetryInfo->Compute_Symmetry(); symmetryInfo->fillOrbits(); orbits = symmetryInfo->whichOrbit(); int iColumn=-1; if (orbits && symmetryInfo->numberUsefulOrbits()) { bool doBranch=true; int numberUsefulOrbits = symmetryInfo->numberUsefulOrbits(); if (numberUsefulOrbits<2) { assert (numberUsefulOrbits); double largest=-1.0; for (int i=0;i=0) { if (saveSolution[i]>largest) { largest=saveSolution[i]; iColumn=i; } } } } else { #if COIN_HAS_NTY2 == 1 // take largest int iOrbit=symmetryInfo->largestOrbit(solver->getColLower(), solver->getColUpper()); double largest=-1.0; for (int i=0;ilargest) { largest=saveSolution[i]; iColumn=i; } } } #endif if (orbitOption==2) { // strong int nDo=0; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const int * integerVariable = model->integerVariable(); for (int iOrbit = 0; iOrbit < numberUsefulOrbits; iOrbit++) { double distance=1.0; int iColumn = -1; int numberIntegers = model->numberIntegers(); for (int j=0;j=0) whichObject[nDo++]=iColumn; } if (nDo) numberToDo=nDo; doBranch=false; } else if (orbitOption==3) { // subset int nDo=0; for (int iDo = 0; iDo < numberToDo; iDo++) { int iObject = whichObject[iDo]; OsiObject * object = model->modifiableObject(iObject); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; int iColumn = dynamicObject ? dynamicObject->columnNumber() : -1; if (iColumn<0||orbits[iColumn]>=0) whichObject[nDo++]=whichObject[iDo]; } assert(nDo); //printf("nDo %d\n",nDo); numberToDo=nDo; doBranch=false; /* need NULL as if two in same orbit and strong branching fixes then we may be in trouble. Strong option should be OK as only one in set done. */ orbits=NULL; } } if(doBranch) { orbitOption=0; branch_ = new CbcOrbitalBranchingObject(model,iColumn,1,0,NULL); if (infoX) infoX->setSymmetryWorked(); numberToDo=0; } } } } #endif for ( iDo = 0; iDo < numberToDo; iDo++) { int iObject = whichObject[iDo]; OsiObject * object = model->modifiableObject(iObject); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; int iColumn = dynamicObject ? dynamicObject->columnNumber() : numberColumns + iObject; int preferredWay; double infeasibility = object->infeasibility(&usefulInfo, preferredWay); bool feasibleSolution=false; double predictedChange=0.0; // may have become feasible if (!infeasibility) { if(strongType!=2||solver->getColLower()[iColumn]==solver->getColUpper()[iColumn]) continue; } #ifndef NDEBUG if (iColumn < numberColumns) { const double * solution = model->testSolution(); assert (saveSolution[iColumn] == solution[iColumn]); } #endif CbcSimpleInteger * obj = dynamic_cast (object) ; if (obj) { if (choiceObject) { obj->fillCreateBranch(choiceObject, &usefulInfo, preferredWay); choiceObject->setObject(dynamicObject); } else { choice.possibleBranch = obj->createCbcBranch(solver, &usefulInfo, preferredWay); } } else { CbcObject * obj = dynamic_cast (object) ; assert (obj); choice.possibleBranch = obj->createCbcBranch(solver, &usefulInfo, preferredWay); } // Save which object it was choice.objectNumber = iObject; choice.numIntInfeasUp = numberUnsatisfied_; choice.numIntInfeasDown = numberUnsatisfied_; if (strongType!=2) { choice.upMovement = upEstimate[iObject]; choice.downMovement = downEstimate[iObject]; } else { choice.upMovement = 0.1; choice.downMovement = 0.1; } assert (choice.upMovement >= 0.0); assert (choice.downMovement >= 0.0); choice.fix = 0; // say not fixed // see if can skip strong branching int canSkip = choice.possibleBranch->fillStrongInfo(choice); if ((numberTest <= 0 || skipAll)) { if (iDo > 20) { if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } break; // give up anyway } } if (model->messageHandler()->logLevel() > 3 && numberBeforeTrust && dynamicObject) dynamicObject->print(1, choice.possibleBranch->value()); if (strongType) canSkip=0; if (skipAll < 0) canSkip = 1; if (!canSkip) { if (!doneHotStart) { // Mark hot start doneHotStart = true; solver->markHotStart(); #ifdef RESET_BOUNDS memcpy(saveLower,solver->getColLower(),solver->getNumCols()*sizeof(double)); memcpy(saveUpper,solver->getColUpper(),solver->getNumCols()*sizeof(double)); #endif if (!solver->isProvenOptimal()) { skipAll=-2; canSkip = 1; } xMark++; } } if (!canSkip) { numberTest--; // just do a few if (searchStrategy == 2) solver->setIntParam(OsiMaxNumIterationHotStart, 10); double objectiveChange ; double newObjectiveValue = 1.0e100; int j; #ifdef COIN_HAS_CLP int saveMaxHotIts=0; int saveOsiClpOptions=0; if (osiclp && goToEndInStrongBranching) { /* How dogged to be in strong branching 0 - default 1 - go to end on first time 2 - always go to end */ osiclp->getIntParam(OsiMaxNumIterationHotStart, saveMaxHotIts); saveOsiClpOptions=osiclp->specialOptions(); if (goToEndInStrongBranching==2 || dynamicObject->numberTimesBranched()==0) { osiclp->setIntParam(OsiMaxNumIterationHotStart, 10*(osiclp->getNumRows()+numberColumns)); osiclp->setSpecialOptions(saveOsiClpOptions & (~32)); } } #endif // status is 0 finished, 1 infeasible and other int iStatus; /* Try the down direction first. (Specify the initial branching alternative as down with a call to way(-1). Each subsequent call to branch() performs the specified branch and advances the branch object state to the next branch alternative.) */ choice.possibleBranch->way(-1) ; predictedChange = choice.possibleBranch->branch() ; #ifdef COIN_HAS_NTY if (orbits) { // can fix all in orbit int fixOrbit = orbits[iObject]; if (fixOrbit>=0) { //printf("fixing all in orbit %d for column %d\n",fixOrbit,iObject); for (int i=0;isetColUpper(i,0.0); } } } #endif solver->solveFromHotStart() ; bool needHotStartUpdate = false; numberStrongDone++; numberStrongIterations += solver->getIterationCount(); /* We now have an estimate of objective degradation that we can use for strong branching. If we're over the cutoff, the variable is monotone up. If we actually made it to optimality, check for a solution, and if we have a good one, call setBestSolution to process it. Note that this may reduce the cutoff, so we check again to see if we can declare this variable monotone. */ if (solver->isProvenOptimal()) iStatus = 0; // optimal else if (solver->isIterationLimitReached() && !solver->isDualObjectiveLimitReached()) { iStatus = 2; // unknown } else { iStatus = 1; // infeasible #ifdef CONFLICT_CUTS #undef CONFLICT_CUTS //#define CONFLICT_CUTS 2 #endif #ifdef CONFLICT_CUTS # ifdef COIN_HAS_CLP if (osiclp&&(model->moreSpecialOptions()&4194304)!=0) { const CbcFullNodeInfo * topOfTree = model->topOfTree(); if (topOfTree) { #if CONFLICT_CUTS==2 OsiRowCut * cut = osiclp->smallModelCut(topOfTree->lower(), topOfTree->upper(), model->numberRowsAtContinuous(), model->whichGenerator()); #else OsiRowCut * cut = osiclp->modelCut(topOfTree->lower(), topOfTree->upper(), model->numberRowsAtContinuous(), model->whichGenerator(),0); #endif if (cut) { if (model->messageHandler()->logLevel() > 1) printf("Conflict cut found in strong branching (%d elements)\n", cut->row().getNumElements()); //cut->print(); if ((model->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = model->continuousSolver()->getRowCutDebugger() ; if (debugger) { if (debugger->invalidCut(*cut)) { model->continuousSolver()->applyRowCuts(1,cut); model->continuousSolver()->writeMps("bad"); } CoinAssert (!debugger->invalidCut(*cut)); } } model->makeGlobalCut(cut) ; } } } #endif #endif } // say infeasible if branch says so if (predictedChange==COIN_DBL_MAX) iStatus=1; if (iStatus != 2 && solver->getIterationCount() > realMaxHotIterations) numberUnfinished++; newObjectiveValue = solver->getObjSense() * solver->getObjValue(); choice.numItersDown = solver->getIterationCount(); objectiveChange = CoinMax(newObjectiveValue - objectiveValue_, 0.0); // Update branching information if wanted CbcBranchingObject * cbcobj = dynamic_cast (choice.possibleBranch); if (cbcobj) { CbcObject * object = cbcobj->object(); assert (object) ; CbcObjectUpdateData update = object->createUpdateInformation(solver, this, cbcobj); update.objectNumber_ = choice.objectNumber; model->addUpdateInformation(update); } else { decision->updateInformation( solver, this); } if (!iStatus) { choice.finishedDown = true ; if (newObjectiveValue >= cutoff) { objectiveChange = 1.0e100; // say infeasible numberStrongInfeasible++; } else { #define CBCNODE_TIGHTEN_BOUNDS #ifdef CBCNODE_TIGHTEN_BOUNDS // Can we tighten bounds? if (iColumn < numberColumns && cutoff < 1.0e20 && objectiveChange > 1.0e-5) { double value = saveSolution[iColumn]; double down = value - floor(value-integerTolerance); double changePer = objectiveChange / (down + 1.0e-7); double distance = (cutoff - objectiveValue_) / changePer; distance += 1.0e-3; if (distance < 5.0) { double newLower = ceil(value - distance); if (newLower > saveLower[iColumn]) { //printf("Could increase lower bound on %d from %g to %g\n", // iColumn,saveLower[iColumn],newLower); saveLower[iColumn] = newLower; solver->setColLower(iColumn, newLower); } } } #endif // See if integer solution feasibleSolution = model->feasibleSolution(choice.numIntInfeasDown, choice.numObjInfeasDown); if (feasibleSolution && model->problemFeasibility()->feasible(model, -1) >= 0) { if (auxiliaryInfo->solutionAddsCuts()) { needHotStartUpdate = true; solver->unmarkHotStart(); } model->setLogLevel(saveLogLevel); model->setBestSolution(CBC_STRONGSOL, newObjectiveValue, solver->getColSolution()) ; if (needHotStartUpdate) { model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); newObjectiveValue = solver->getObjSense() * solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjectiveValue); objectiveChange = CoinMax(newObjectiveValue - objectiveValue_, 0.0); model->feasibleSolution(choice.numIntInfeasDown, choice.numObjInfeasDown); } model->setLastHeuristic(NULL); model->incrementUsed(solver->getColSolution()); cutoff = model->getCutoff(); if (newObjectiveValue >= cutoff) { // *new* cutoff objectiveChange = 1.0e100 ; numberStrongInfeasible++; } } } } else if (iStatus == 1) { objectiveChange = 1.0e100 ; numberStrongInfeasible++; } else { // Can't say much as we did not finish choice.finishedDown = false ; numberUnfinished++; } choice.downMovement = objectiveChange ; // restore bounds for ( j = 0; j < numberColumns; j++) { if (saveLower[j] != lower[j]) solver->setColLower(j, saveLower[j]); if (saveUpper[j] != upper[j]) solver->setColUpper(j, saveUpper[j]); } if (needHotStartUpdate) { needHotStartUpdate = false; model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); #ifdef CHECK_DEBUGGER_PATH if ((model->specialOptions()&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { printf("Strong branching down on %d went off optimal path\n",iObject); model->solver()->writeMps("query"); abort(); } } #endif double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); //we may again have an integer feasible solution int numberIntegerInfeasibilities; int numberObjectInfeasibilities; if (model->feasibleSolution( numberIntegerInfeasibilities, numberObjectInfeasibilities)) { #ifdef BONMIN //In this case node has become integer feasible, let us exit the loop std::cout << "Node has become integer feasible" << std::endl; numberUnsatisfied_ = 0; break; #endif double objValue = solver->getObjValue(); model->setLogLevel(saveLogLevel); model->setBestSolution(CBC_STRONGSOL, objValue, solver->getColSolution()) ; model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); cutoff = model->getCutoff(); } solver->markHotStart(); #ifdef RESET_BOUNDS memcpy(saveLower,solver->getColLower(),solver->getNumCols()*sizeof(double)); memcpy(saveUpper,solver->getColUpper(),solver->getNumCols()*sizeof(double)); #endif if (!solver->isProvenOptimal()) { skipAll=-2; canSkip = 1; } xMark++; } #if 0 //def DO_ALL_AT_ROOT if (strongType) printf("Down on %d, status is %d, obj %g its %d cost %g finished %d inf %d infobj %d\n", choice.objectNumber, iStatus, newObjectiveValue, choice.numItersDown, choice.downMovement, choice.finishedDown, choice.numIntInfeasDown, choice.numObjInfeasDown); #endif // repeat the whole exercise, forcing the variable up predictedChange=choice.possibleBranch->branch(); solver->solveFromHotStart() ; #ifdef COIN_HAS_CLP if (osiclp && goToEndInStrongBranching) { osiclp->setIntParam(OsiMaxNumIterationHotStart, saveMaxHotIts); osiclp->setSpecialOptions(saveOsiClpOptions); } #endif numberStrongDone++; numberStrongIterations += solver->getIterationCount(); /* We now have an estimate of objective degradation that we can use for strong branching. If we're over the cutoff, the variable is monotone up. If we actually made it to optimality, check for a solution, and if we have a good one, call setBestSolution to process it. Note that this may reduce the cutoff, so we check again to see if we can declare this variable monotone. */ if (solver->isProvenOptimal()) iStatus = 0; // optimal else if (solver->isIterationLimitReached() && !solver->isDualObjectiveLimitReached()) { iStatus = 2; // unknown } else { iStatus = 1; // infeasible #ifdef CONFLICT_CUTS # ifdef COIN_HAS_CLP if (osiclp&&(model->moreSpecialOptions()&4194304)!=0) { const CbcFullNodeInfo * topOfTree = model->topOfTree(); if (topOfTree) { #if CONFLICT_CUTS==2 OsiRowCut * cut = osiclp->smallModelCut(topOfTree->lower(), topOfTree->upper(), model->numberRowsAtContinuous(), model->whichGenerator()); #else OsiRowCut * cut = osiclp->modelCut(topOfTree->lower(), topOfTree->upper(), model->numberRowsAtContinuous(), model->whichGenerator(),0); #endif if (cut) { //printf("XXXXXX found conflict cut in strong branching\n"); //cut->print(); if ((model->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = model->continuousSolver()->getRowCutDebugger() ; if (debugger) { if (debugger->invalidCut(*cut)) { model->continuousSolver()->applyRowCuts(1,cut); model->continuousSolver()->writeMps("bad"); } CoinAssert (!debugger->invalidCut(*cut)); } } model->makeGlobalCut(cut) ; } } } #endif #endif } // say infeasible if branch says so if (predictedChange==COIN_DBL_MAX) iStatus=1; if (iStatus != 2 && solver->getIterationCount() > realMaxHotIterations) numberUnfinished++; newObjectiveValue = solver->getObjSense() * solver->getObjValue(); choice.numItersUp = solver->getIterationCount(); objectiveChange = CoinMax(newObjectiveValue - objectiveValue_, 0.0); // Update branching information if wanted cbcobj = dynamic_cast (choice.possibleBranch); if (cbcobj) { CbcObject * object = cbcobj->object(); assert (object) ; CbcObjectUpdateData update = object->createUpdateInformation(solver, this, cbcobj); update.objectNumber_ = choice.objectNumber; model->addUpdateInformation(update); } else { decision->updateInformation( solver, this); } if (!iStatus) { choice.finishedUp = true ; if (newObjectiveValue >= cutoff) { objectiveChange = 1.0e100; // say infeasible numberStrongInfeasible++; } else { #ifdef CBCNODE_TIGHTEN_BOUNDS // Can we tighten bounds? if (iColumn < numberColumns && cutoff < 1.0e20 && objectiveChange > 1.0e-5) { double value = saveSolution[iColumn]; double up = ceil(value+integerTolerance) - value; double changePer = objectiveChange / (up + 1.0e-7); double distance = (cutoff - objectiveValue_) / changePer; distance += 1.0e-3; if (distance < 5.0) { double newUpper = floor(value + distance); if (newUpper < saveUpper[iColumn]) { //printf("Could decrease upper bound on %d from %g to %g\n", // iColumn,saveUpper[iColumn],newUpper); saveUpper[iColumn] = newUpper; solver->setColUpper(iColumn, newUpper); } } } #endif // See if integer solution feasibleSolution = model->feasibleSolution(choice.numIntInfeasUp, choice.numObjInfeasUp); if (feasibleSolution && model->problemFeasibility()->feasible(model, -1) >= 0) { #ifdef BONMIN std::cout << "Node has become integer feasible" << std::endl; numberUnsatisfied_ = 0; break; #endif if (auxiliaryInfo->solutionAddsCuts()) { needHotStartUpdate = true; solver->unmarkHotStart(); } model->setLogLevel(saveLogLevel); model->setBestSolution(CBC_STRONGSOL, newObjectiveValue, solver->getColSolution()) ; if (choice.finishedDown) { double cutoff = model->getCutoff(); double downObj = objectiveValue_ + choice.downMovement ; if (downObj >= cutoff) { choice.downMovement = 1.0e100 ; numberStrongInfeasible++; } } if (needHotStartUpdate) { model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); #ifdef CHECK_DEBUGGER_PATH if ((model->specialOptions()&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { printf("Strong branching up on %d went off optimal path\n",iObject); abort(); } } #endif newObjectiveValue = solver->getObjSense() * solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjectiveValue); objectiveChange = CoinMax(newObjectiveValue - objectiveValue_, 0.0); model->feasibleSolution(choice.numIntInfeasDown, choice.numObjInfeasDown); } model->setLastHeuristic(NULL); model->incrementUsed(solver->getColSolution()); cutoff = model->getCutoff(); if (newObjectiveValue >= cutoff) { // *new* cutoff objectiveChange = 1.0e100 ; numberStrongInfeasible++; } } } } else if (iStatus == 1) { objectiveChange = 1.0e100 ; numberStrongInfeasible++; } else { // Can't say much as we did not finish choice.finishedUp = false ; numberUnfinished++; } choice.upMovement = objectiveChange ; // restore bounds for ( j = 0; j < numberColumns; j++) { if (saveLower[j] != lower[j]) solver->setColLower(j, saveLower[j]); if (saveUpper[j] != upper[j]) solver->setColUpper(j, saveUpper[j]); } if (needHotStartUpdate) { needHotStartUpdate = false; model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); #ifdef CHECK_DEBUGGER_PATH if ((model->specialOptions()&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { printf("Strong branching up on %d went off optimal path\n",iObject); abort(); } } #endif double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); //we may again have an integer feasible solution int numberIntegerInfeasibilities; int numberObjectInfeasibilities; if (model->feasibleSolution( numberIntegerInfeasibilities, numberObjectInfeasibilities)) { double objValue = solver->getObjValue(); model->setLogLevel(saveLogLevel); model->setBestSolution(CBC_STRONGSOL, objValue, solver->getColSolution()) ; model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); #ifdef CHECK_DEBUGGER_PATH if ((model->specialOptions()&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { printf("Strong branching up on %d went off optimal path\n",iObject); abort(); } } #endif double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); cutoff = model->getCutoff(); } solver->markHotStart(); #ifdef RESET_BOUNDS memcpy(saveLower,solver->getColLower(),solver->getNumCols()*sizeof(double)); memcpy(saveUpper,solver->getColUpper(),solver->getNumCols()*sizeof(double)); #endif if (!solver->isProvenOptimal()) { skipAll=-2; canSkip = 1; } xMark++; } #if 0 //def DO_ALL_AT_ROOT if (strongType) printf("Up on %d, status is %d, obj %g its %d cost %g finished %d inf %d infobj %d\n", choice.objectNumber, iStatus, newObjectiveValue, choice.numItersUp, choice.upMovement, choice.finishedUp, choice.numIntInfeasUp, choice.numObjInfeasUp); #endif } solver->setIntParam(OsiMaxNumIterationHotStart, saveLimit2); /* End of evaluation for this candidate variable. Possibilities are: * Both sides below cutoff; this variable is a candidate for branching. * Both sides infeasible or above the objective cutoff: no further action here. Break from the evaluation loop and assume the node will be purged by the caller. * One side below cutoff: Install the branch (i.e., fix the variable). Break from the evaluation loop and assume the node will be reoptimised by the caller. */ // reset choice.possibleBranch->resetNumberBranchesLeft(); if (choice.upMovement < 1.0e100) { if (choice.downMovement < 1.0e100) { // In case solution coming in was odd choice.upMovement = CoinMax(0.0, choice.upMovement); choice.downMovement = CoinMax(0.0, choice.downMovement); #if ZERO_ONE==2 // branch on 0-1 first (temp) if (fabs(choice.possibleBranch->value()) < 1.0) { choice.upMovement *= ZERO_FAKE; choice.downMovement *= ZERO_FAKE; } #endif // feasible - see which best if (!canSkip) { if (model->messageHandler()->logLevel() > 3) printf("sort %g downest %g upest %g ", sort[iDo], downEstimate[iObject], upEstimate[iObject]); model->messageHandler()->message(CBC_STRONG, *model->messagesPointer()) << iObject << iColumn << choice.downMovement << choice.numIntInfeasDown << choice.upMovement << choice.numIntInfeasUp << choice.possibleBranch->value() << CoinMessageEol; } int betterWay=0; // If was feasible (extra strong branching) skip if (infeasibility) { CbcBranchingObject * branchObj = dynamic_cast (branch_) ; if (branch_) assert (branchObj); betterWay = decision->betterBranch(choice.possibleBranch, branchObj, choice.upMovement, choice.numIntInfeasUp , choice.downMovement, choice.numIntInfeasDown ); } if (betterWay) { // C) create branching object if (choiceObject) { delete branch_; branch_ = choice.possibleBranch->clone(); } else { delete branch_; branch_ = choice.possibleBranch; choice.possibleBranch = NULL; } { CbcBranchingObject * branchObj = dynamic_cast (branch_) ; assert (branchObj); //branchObj->way(preferredWay); branchObj->way(betterWay); } bestChoice = choice.objectNumber; whichChoice = iDo; if (numberStrong <= 1) { delete ws; ws = NULL; break; } } else { if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } if (iDo >= 2*numberStrong) { delete ws; ws = NULL; break; } if (!dynamicObject || dynamicObject->numberTimesUp() > 1) { if (iDo - whichChoice >= numberStrong) { if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } break; // give up } } else { if (iDo - whichChoice >= 2*numberStrong) { delete ws; ws = NULL; if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } break; // give up } } } } else { // up feasible, down infeasible anyAction = -1; worstFeasible = CoinMax(worstFeasible, choice.upMovement); model->messageHandler()->message(CBC_STRONG, *model->messagesPointer()) << iObject << iColumn << choice.downMovement << choice.numIntInfeasDown << choice.upMovement << choice.numIntInfeasUp << choice.possibleBranch->value() << CoinMessageEol; //printf("Down infeasible for choice %d sequence %d\n",i, // model->object(choice.objectNumber)->columnNumber()); choice.fix = 1; numberToFix++; choice.possibleBranch->fix(solver, saveLower, saveUpper, 1); if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } else { //choiceObject = new CbcDynamicPseudoCostBranchingObject(*choiceObject); choice.possibleBranch = choiceObject; } assert(doneHotStart); solver->unmarkHotStart(); model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); #ifdef CHECK_DEBUGGER_PATH if ((model->specialOptions()&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { printf("Strong branching down on %d went off optimal path\n",iObject); abort(); } } #endif double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); bool goneInfeasible = (!solver->isProvenOptimal()||solver->isDualObjectiveLimitReached()); solver->markHotStart(); #ifdef RESET_BOUNDS memcpy(saveLower,solver->getColLower(),solver->getNumCols()*sizeof(double)); memcpy(saveUpper,solver->getColUpper(),solver->getNumCols()*sizeof(double)); #endif if (!solver->isProvenOptimal()) { skipAll=-2; canSkip = 1; } xMark++; // may be infeasible (if other way stopped on iterations) if (goneInfeasible) { // neither side feasible anyAction = -2; if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } //printf("Both infeasible for choice %d sequence %d\n",i, // model->object(choice.objectNumber)->columnNumber()); delete ws; ws = NULL; break; } } } else { if (choice.downMovement < 1.0e100) { // down feasible, up infeasible anyAction = -1; worstFeasible = CoinMax(worstFeasible, choice.downMovement); model->messageHandler()->message(CBC_STRONG, *model->messagesPointer()) << iObject << iColumn << choice.downMovement << choice.numIntInfeasDown << choice.upMovement << choice.numIntInfeasUp << choice.possibleBranch->value() << CoinMessageEol; choice.fix = -1; numberToFix++; choice.possibleBranch->fix(solver, saveLower, saveUpper, -1); if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } else { //choiceObject = new CbcDynamicPseudoCostBranchingObject(*choiceObject); choice.possibleBranch = choiceObject; } assert(doneHotStart); solver->unmarkHotStart(); model->resolve(NULL, 11, saveSolution, saveLower, saveUpper); #ifdef CHECK_DEBUGGER_PATH if ((model->specialOptions()&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { printf("Strong branching down on %d went off optimal path\n",iObject); solver->writeMps("query"); abort(); } } #endif double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); bool goneInfeasible = (!solver->isProvenOptimal()||solver->isDualObjectiveLimitReached()); solver->markHotStart(); #ifdef RESET_BOUNDS memcpy(saveLower,solver->getColLower(),solver->getNumCols()*sizeof(double)); memcpy(saveUpper,solver->getColUpper(),solver->getNumCols()*sizeof(double)); #endif if (!solver->isProvenOptimal()) { skipAll=-2; canSkip = 1; } xMark++; // may be infeasible (if other way stopped on iterations) if (goneInfeasible) { // neither side feasible anyAction = -2; if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } delete ws; ws = NULL; break; } } else { // neither side feasible anyAction = -2; if (!choiceObject) { delete choice.possibleBranch; choice.possibleBranch = NULL; } delete ws; ws = NULL; break; } } // Check max time hitMaxTime = (model->getCurrentSeconds() > model->getDblParam(CbcModel::CbcMaximumSeconds)); if (hitMaxTime) { // make sure rest are fast for ( int jDo = iDo + 1; jDo < numberToDo; jDo++) { int iObject = whichObject[iDo]; OsiObject * object = model->modifiableObject(iObject); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; if (dynamicObject) dynamicObject->setNumberBeforeTrust(0); } numberTest = 0; } if (!choiceObject) { delete choice.possibleBranch; } } if (model->messageHandler()->logLevel() > 3) { if (anyAction == -2) { printf("infeasible\n"); } else if (anyAction == -1) { printf("%d fixed AND choosing %d iDo %d iChosenWhen %d numberToDo %d\n", numberToFix, bestChoice, iDo, whichChoice, numberToDo); } else { int iObject = whichObject[whichChoice]; OsiObject * object = model->modifiableObject(iObject); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; if (dynamicObject) { int iColumn = dynamicObject->columnNumber(); printf("choosing %d (column %d) iChosenWhen %d numberToDo %d\n", bestChoice, iColumn, whichChoice, numberToDo); } } } if (doneHotStart) { // Delete the snapshot solver->unmarkHotStart(); // back to normal solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; // restore basis solver->setWarmStart(ws); } solver->setIntParam(OsiMaxNumIterationHotStart, saveLimit); // Unless infeasible we will carry on // But we could fix anyway if (numberToFix && !hitMaxTime) { if (anyAction != -2) { // apply and take off bool feasible = true; // can do quick optimality check int easy = 2; solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, &easy) ; model->resolve(NULL, 11, saveSolution, saveLower, saveUpper) ; #ifdef CHECK_DEBUGGER_PATH if ((model->specialOptions()&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { printf("Strong branching went off optimal path\n"); abort(); } } #endif double newObjValue = solver->getObjSense()*solver->getObjValue(); objectiveValue_ = CoinMax(objectiveValue_,newObjValue); solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; feasible = solver->isProvenOptimal(); if (feasible) { anyAction = 0; } else { anyAction = -2; finished = true; } } } // If fixed then round again // See if candidate still possible if (branch_) { const OsiObject * object = model->object(bestChoice); double infeasibility = object->checkInfeasibility(&usefulInfo); if (!infeasibility) { // take out delete branch_; branch_ = NULL; } else { // get preferred way int preferredWay; object->infeasibility(&usefulInfo, preferredWay); CbcBranchingObject * branchObj = dynamic_cast (branch_) ; assert (branchObj); branchObj->way(preferredWay); #ifdef CBCNODE_TIGHTEN_BOUNDS bool fixed = branchObj->tighten(solver); if (fixed) { //printf("Variable now fixed!\n"); // take out delete branch_; branch_ = NULL; } #endif } } if (!branch_ && anyAction != -2 && !hitMaxTime) { finished = false; } delete ws; } } // update number of strong iterations etc model->incrementStrongInfo(numberStrongDone, numberStrongIterations, anyAction == -2 ? 0 : numberToFix, anyAction == -2); if (model->searchStrategy() == -1) { #ifndef COIN_DEVELOP if (solver->messageHandler()->logLevel() > 1) #endif printf("%d strong, %d iters, %d inf, %d not finished, %d not trusted\n", numberStrongDone, numberStrongIterations, numberStrongInfeasible, numberUnfinished, numberNotTrusted); // decide what to do int strategy = 1; if (((numberUnfinished*4 > numberStrongDone && numberStrongInfeasible*40 < numberStrongDone) || numberStrongInfeasible < 0) && model->numberStrong() < 10 && model->numberBeforeTrust() <= 20 && model->numberObjects() > CoinMax(1000, solver->getNumRows())) { strategy = 2; #ifdef COIN_DEVELOP //if (model->logLevel()>1) printf("going to strategy 2\n"); #endif // Weaken model->setNumberStrong(2); model->setNumberBeforeTrust(1); model->synchronizeNumberBeforeTrust(); } if (numberNodes) strategy = 1; // should only happen after hot start model->setSearchStrategy(strategy); } else if (numberStrongDone) { //printf("%d strongB, %d iters, %d inf, %d not finished, %d not trusted\n", // numberStrongDone,numberStrongIterations,numberStrongInfeasible,numberUnfinished, // numberNotTrusted); } if (model->searchStrategy() == 1 && numberNodes > 500 && numberNodes < -510) { #ifndef COIN_DEVELOP if (solver->messageHandler()->logLevel() > 1) #endif printf("after %d nodes - %d strong, %d iters, %d inf, %d not finished, %d not trusted\n", numberNodes, numberStrongDone, numberStrongIterations, numberStrongInfeasible, numberUnfinished, numberNotTrusted); // decide what to do if (numberUnfinished*10 > numberStrongDone + 1 || !numberStrongInfeasible) { COIN_DETAIL_PRINT(printf("going to strategy 2\n")); // Weaken model->setNumberStrong(2); model->setNumberBeforeTrust(1); model->synchronizeNumberBeforeTrust(); model->setSearchStrategy(2); } } if (numberUnfinished*10 < numberStrongDone && model->numberStrongIterations()*20 < model->getIterationCount()&& !auxiliaryInfo->solutionAddsCuts()) { //printf("increasing trust\n"); model->synchronizeNumberBeforeTrust(2); } // Set guessed solution value guessedObjectiveValue_ = objectiveValue_ + estimatedDegradation; int kColumn=-1; if (branch_) { CbcObject * obj = (dynamic_cast(branch_))->object(); CbcSimpleInteger * branchObj = dynamic_cast (obj) ; if (branchObj) { kColumn=branchObj->columnNumber(); } } #ifdef COIN_HAS_NTY if (orbitOption&&kColumn>=0) { CbcSymmetry * symmetryInfo = model->symmetryInfo(); CbcNodeInfo * infoX = lastNode ? lastNode->nodeInfo() : NULL; bool worthTrying = false; if (infoX) { CbcNodeInfo * info = infoX; for (int i=0;iparent()) { worthTrying = true; break; } info = info->parent(); if (info->symmetryWorked()) { worthTrying = true; break; } } } else { worthTrying=true; } if (orbitOption==3&&depth_>5) worthTrying=false; if (symmetryInfo && worthTrying) { if ((orbitOption&1)==1) { symmetryInfo->ChangeBounds(solver->getColLower(), solver->getColUpper(), solver->getNumCols(),false); symmetryInfo->Compute_Symmetry(); symmetryInfo->fillOrbits(); } const int * orbits = symmetryInfo->whichOrbit(); if (orbits && orbits[kColumn]>=0) { int numberUsefulOrbits = symmetryInfo->numberUsefulOrbits(); if (solver->messageHandler()->logLevel() > 1) printf("Orbital Branching on %d - way %d n %d\n",kColumn,way(),numberUsefulOrbits); if (numberUsefulOrbits<1000||orbitOption==3) { delete branch_; branch_ = new CbcOrbitalBranchingObject(model,kColumn,1,0,NULL); if (infoX) infoX->setSymmetryWorked(); } } } } #endif if (model->logLevel()>1) printf ("Node %d depth %d unsatisfied %d sum %g obj %g guess %g branching on %d\n", model->getNodeCount(),depth_,numberUnsatisfied_, sumInfeasibilities_,objectiveValue_,guessedObjectiveValue_, kColumn); #ifdef DO_ALL_AT_ROOT if (strongType) { char general[200]; if (strongType==1) sprintf(general,"Strong branching on all %d unsatisfied, %d iterations (depth %d)\n", saveNumberToDo,numberStrongIterations,depth_); else sprintf(general,"Strong branching on all %d unfixed variables (%d unsatisfied), %d iterations (depth %d)\n", saveNumberToDo+saveSatisfiedVariables,saveNumberToDo,numberStrongIterations,depth_); model->messageHandler()->message(CBC_FPUMP2,model->messages()) << general << CoinMessageEol ; } #endif #ifdef DEBUG_SOLUTION if(onOptimalPath&&anyAction==-2) { printf("Gone off optimal path in CbcNode\n"); assert(!onOptimalPath||anyAction!=-2); } #endif /* Cleanup, then we're finished */ if (!model->branchingMethod()) delete decision; delete choiceObject; delete [] sort; delete [] whichObject; #ifdef RANGING delete [] objectMark; #endif delete [] saveLower; delete [] saveUpper; delete [] upEstimate; delete [] downEstimate; # ifdef COIN_HAS_CLP if (osiclp) { osiclp->setSpecialOptions(saveClpOptions); } # endif // restore solution solver->setColSolution(saveSolution); model->reserveCurrentSolution(saveSolution); delete [] saveSolution; model->setStateOfSearch(saveStateOfSearch); model->setLogLevel(saveLogLevel); // delete extra regions if (usefulInfo.usefulRegion_) { delete [] usefulInfo.usefulRegion_; delete [] usefulInfo.indexRegion_; delete [] usefulInfo.pi_; usefulInfo.usefulRegion_ = NULL; usefulInfo.indexRegion_ = NULL; usefulInfo.pi_ = NULL; } useShadow = model->moreSpecialOptions() & 7; if ((useShadow == 5 && model->getSolutionCount()) || useShadow == 6) { // zap pseudo shadow prices model->pseudoShadow(-1); // and switch off model->setMoreSpecialOptions(model->moreSpecialOptions()&(~1023)); } return anyAction; } // 0 is down, 1 is up typedef struct { double initialValue; // initial value double upLowerBound; // Lower bound when going up double downUpperBound; // Upper bound when going down double movement[2]; // cost (and initial away from feasible) double sumModified[2]; // Sum of integer changes int modified[2]; // Number integers changed int numIntInfeas[2]; // without odd ones int numObjInfeas[2]; // just odd ones bool finished[2]; // true if solver finished int numIters[2]; // number of iterations in solver (-1 if never solved) double * integerSolution; // output if thinks integer solution # ifdef COIN_HAS_CLP ClpDualRowSteepest * steepest; #endif int columnNumber; // Which column it is } StrongInfo; typedef struct { double integerTolerance; double * originalSolution; CoinWarmStart * ws; double * newObjective; # ifdef COIN_HAS_CLP ClpDualRowSteepest * dualRowPivot; ClpPrimalColumnPivot * primalColumnPivot; # endif int * back; int solveType; } StrongStaticInfo; typedef struct { StrongStaticInfo *staticInfo; StrongInfo * choice; OsiSolverInterface * solver; double * tempSolution; CoinWarmStart * tempBasis; int whichChoice; } StrongBundle; /* return 1 if possible solution (for solveType 100 if infeasible) 2 set if down was infeasible 4 set if up was infeasible */ int solveAnalyze(void * info) { StrongBundle * bundle = reinterpret_cast(info); StrongInfo * choice = bundle->choice; StrongStaticInfo * staticInfo = bundle->staticInfo; OsiSolverInterface * solver = bundle->solver; int solveType = staticInfo->solveType; if (solveType==77) { return 0; } const double * saveSolution = staticInfo->originalSolution; int iColumn = choice->columnNumber; const int * back = staticInfo->back; double newObjectiveValue = 1.0e100; double integerTolerance = staticInfo->integerTolerance; double bestSolutionValue=COIN_DBL_MAX; int returnStatus=0; // status is 0 finished, 1 infeasible and other int iStatus; /* Try the down direction first. (Specify the initial branching alternative as down with a call to way(-1). Each subsequent call to branch() performs the specified branch and advances the branch object state to the next branch alternative.) */ for (int iWay=0;iWay<2;iWay++) { if (choice->numIters[iWay]==0) { int numberColumns=solver->getNumCols(); if (solveType!=100) { double saveBound; if (iWay==0) { saveBound = solver->getColUpper()[iColumn]; solver->setColUpper(iColumn,choice->downUpperBound); } else { saveBound = solver->getColLower()[iColumn]; solver->setColLower(iColumn,choice->upLowerBound); } if ((solveType&2)==0) { solver->solveFromHotStart() ; } else { // restore basis solver->setWarmStart(staticInfo->ws); # ifdef COIN_HAS_CLP if (staticInfo->dualRowPivot) { OsiClpSolverInterface * osiclp = dynamic_cast(solver); ClpSimplex * simplex = osiclp->getModelPtr(); simplex->setDualRowPivotAlgorithm(*staticInfo->dualRowPivot); //simplex->dualRowPivot()->saveWeights(simplex,4); simplex->setWhatsChanged(ALL_SAME_EXCEPT_COLUMN_BOUNDS); simplex->dual(0,5); } else { #endif solver->resolve(); # ifdef COIN_HAS_CLP } #endif } if (iWay==0) solver->setColUpper(iColumn,saveBound); else solver->setColLower(iColumn,saveBound); /* We now have an estimate of objective degradation that we can use for strong branching. If we're over the cutoff, the variable is monotone up. If we actually made it to optimality, check for a solution, and if we have a good one, call setBestSolution to process it. Note that this may reduce the cutoff, so we check again to see if we can declare this variable monotone. */ if (solver->isProvenOptimal()) { iStatus = 0; // optimal } else if (solver->isIterationLimitReached() && !solver->isDualObjectiveLimitReached()) { iStatus = 2; // unknown } else { iStatus = 1; // infeasible } newObjectiveValue = solver->getObjSense() * solver->getObjValue(); choice->numIters[iWay] = solver->getIterationCount(); // Look at interaction const double * thisSolution = solver->getColSolution(); int numberModified=0; double sumModified=0.0; int numberInfeas=0; for (int i=0;i=0) { double value = thisSolution[i]; if (iColumn!=i) { double difference = fabs(saveSolution[i]-value); if (difference>integerTolerance) { numberModified++; sumModified += difference; } } if (fabs(value-floor(value+0.5))>integerTolerance) numberInfeas++;; } } choice->numIntInfeas[iWay]=numberInfeas; choice->sumModified[iWay] = sumModified; choice->modified[iWay] = numberModified; if (!iStatus) { choice->finished[iWay] = true ; if (!numberInfeas) { returnStatus=1; if (!choice->integerSolution) { bestSolutionValue=newObjectiveValue; choice->integerSolution=CoinCopyOfArray(thisSolution,numberColumns);; } else if (bestSolutionValue>newObjectiveValue) { memcpy(choice->integerSolution,thisSolution,numberColumns*sizeof(double)); } } } else if (iStatus == 1) { newObjectiveValue = 1.0e100 ; } else { // Can't say much as we did not finish choice->finished[iWay] = false ; } choice->movement[iWay] = newObjectiveValue ; } else { # ifdef COIN_HAS_CLP OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver); ClpSimplex * simplex = osiclp ? osiclp->getModelPtr() : NULL; #endif // doing continuous and general integer solver->setColSolution(staticInfo->originalSolution); solver->setWarmStart(staticInfo->ws); double saveBound; double newBound; if (iWay==0) { saveBound=solver->getColUpper()[iColumn]; solver->setColUpper(iColumn,choice->downUpperBound); newBound=choice->downUpperBound; } else { saveBound=solver->getColLower()[iColumn]; solver->setColLower(iColumn,choice->upLowerBound); newBound=choice->upLowerBound; } # if 0 //def COIN_HAS_CLP if (simplex) { // set solution to new bound (if basic will be recomputed) simplex->primalColumnSolution()[iColumn]=newBound; } #endif solver->setHintParam(OsiDoDualInResolve, true, OsiHintDo) ; #define PRINT_ANALYZE 0 #if PRINT_ANALYZE>0 osiclp->getModelPtr()->setLogLevel(1); solver->setHintParam(OsiDoReducePrint, false, OsiHintTry); #endif solver->resolve(); if (iWay==0) { #if PRINT_ANALYZE>0 printf("column %d down original %g <= %g <= %g upper now %g - result %s\n", iColumn,solver->getColLower()[iColumn], staticInfo->originalSolution[iColumn],saveBound, newBound,solver->isProvenOptimal() ? "ok" : "infeas"); #endif solver->setColUpper(iColumn,saveBound); } else { #if PRINT_ANALYZE>0 printf("column %d up original %g <= %g <= %g lower now %g - result %s\n", iColumn,saveBound,staticInfo->originalSolution[iColumn], solver->getColUpper()[iColumn], newBound,solver->isProvenOptimal() ? "ok" : "infeas"); #endif solver->setColLower(iColumn,saveBound); } choice->numIters[iWay] = solver->getIterationCount(); if (solver->isProvenOptimal()) { //printf("Way %d - all way %d iterations - column %d\n", // iWay,solver->getIterationCount(),iColumn); // can go all way choice->movement[iWay] = newBound; } else { // zero objective double offset; solver->getDblParam(OsiObjOffset,offset); solver->setDblParam(OsiObjOffset, 0.0); solver->setObjective(staticInfo->newObjective+numberColumns); if (iWay==0) { solver->setObjCoeff(iColumn,1.0); } else { solver->setObjCoeff(iColumn,-1.0); } solver->setColSolution(staticInfo->originalSolution); solver->setWarmStart(staticInfo->ws); solver->setHintParam(OsiDoDualInResolve, false, OsiHintDo) ; solver->resolve(); //printf("Way %d - first solve %d iterations, second %d - column %d\n", // iWay,choice->numIters[iWay],solver->getIterationCount(),iColumn); choice->movement[iWay] = solver->getColSolution()[iColumn]; choice->numIters[iWay] += solver->getIterationCount(); #if PRINT_ANALYZE>0 if (iWay==0) { printf("column %d down can get to %g - result %s\n", iColumn,solver->getColSolution()[iColumn],solver->isProvenOptimal() ? "ok" : "infeas"); } else { printf("column %d up can get to %g - result %s\n", iColumn,solver->getColSolution()[iColumn],solver->isProvenOptimal() ? "ok" : "infeas"); } #endif // reset objective solver->setDblParam(OsiObjOffset, offset); solver->setObjective(staticInfo->newObjective); if (!solver->isProvenOptimal()) { # ifdef COIN_HAS_CLP OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver); ClpSimplex * simplex = osiclp->getModelPtr(); double sum = simplex->sumPrimalInfeasibilities(); sum /= static_cast(simplex->numberPrimalInfeasibilities()); if (sum>1.0e-3) { #endif choice->modified[0]=1; returnStatus=1; solver->writeMps("bad","mps"); abort(); # ifdef COIN_HAS_CLP } #endif } } //solver->setObjCoeff(iColumn,0.0); } } } return returnStatus; } #ifdef THREADS_IN_ANALYZE void * cbc_parallelManager(void * stuff) { CoinPthreadStuff * driver = reinterpret_cast(stuff); int whichThread=driver->whichThread(); CoinThreadInfo * threadInfo = driver->threadInfoPointer(whichThread); threadInfo->status=-1; int * which = threadInfo->stuff; pthread_barrier_wait(driver->barrierPointer()); #if 0 int status=-1; while (status!=100) status=timedWait(driver,1000,2); pthread_cond_signal(driver->conditionPointer(1)); pthread_mutex_unlock(driver->mutexPointer(1,whichThread)); #endif // so now mutex_ is locked int whichLocked=0; while (true) { pthread_mutex_t * mutexPointer = driver->mutexPointer(whichLocked,whichThread); // wait //printf("Child waiting for %d - status %d %d %d\n", // whichLocked,lockedX[0],lockedX[1],lockedX[2]); #ifdef DETAIL_THREAD printf("thread %d about to lock mutex %d\n",whichThread,whichLocked); #endif pthread_mutex_lock (mutexPointer); whichLocked++; if (whichLocked==3) whichLocked=0; int unLock=whichLocked+1; if (unLock==3) unLock=0; //printf("child pointer %p status %d\n",threadInfo,threadInfo->status); assert(threadInfo->status>=0); if (threadInfo->status==1000) pthread_exit(NULL); int type=threadInfo->status; int & returnCode=which[0]; int iPass=which[1]; //CoinIndexedVector * array; //double dummy; switch(type) { // dummy case 0: break; case 1: returnCode=solveAnalyze(threadInfo->extraInfo); threadInfo->stuff[3]=0; break; case 100: // initialization break; } threadInfo->status= (type!=1) ? -1 : -2; #ifdef DETAIL_THREAD printf("thread %d about to unlock mutex %d\n",whichThread,unLock); #endif pthread_mutex_unlock (driver->mutexPointer(unLock,whichThread)); } } #endif int CbcNode::analyze (CbcModel *model, double * results) { #define COIN_DETAIL int i; int numberIterationsAllowed = model->numberAnalyzeIterations(); int numberColumns = model->getNumCols(); int numberRows = model->getNumRows(); int numberObjects = model->numberObjects(); int numberIntegers = model->numberIntegers(); int numberLookIntegers=0; int highestPriority=COIN_INT_MAX; int * back = new int[numberColumns]; const int * integerVariable = model->integerVariable(); for (i = 0; i < numberIntegers; i++) { highestPriority = CoinMin(highestPriority,model->modifiableObject(i)->priority()); } for (i = 0; i < numberColumns; i++) back[i] = -1; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; back[iColumn] = i; if (model->modifiableObject(i)->priority()==highestPriority) { numberLookIntegers++; } else { back[iColumn] = i+numberColumns; } } /* 0 - just look 0 (1) bit - use to set priorities 1 (2) bit - look at bounds on all variables and more iterations 2 (4) bit - do threaded (if parallelMode()==1 then not repeatable if any fixed) 3 (8) bit - 4 (16) bit - do even if m*n>1,000,000 5 (32) bit - printing time 6 (64) bit - save mps file */ int solveType; char general[200]; if (numberIterationsAllowed>0) { solveType = 0; } else { solveType = - numberIterationsAllowed; if ((solveType&16)==0) { double size=numberRows; size*=numberLookIntegers; if (size>1000000) { if ((solveType&32)!=0) model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << "Skipping analyze as problem too large" << CoinMessageEol; return 0; } } sprintf(general,"Analyze options %d",solveType); model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << general << CoinMessageEol; if ((solveType&1)!=0) model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << "Using to set priorities (probably bad idea)" << CoinMessageEol; if ((solveType&2)!=0) model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << "Use more iterations and look at continuous/general integer variables" << CoinMessageEol; if ((solveType&4)!=0) model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << "Use threads" << CoinMessageEol; if ((solveType&32)!=0) model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << "32 switches on more printing, (16 bit allows large problems)" << CoinMessageEol; } OsiSolverInterface * solver = model->solver(); objectiveValue_ = solver->getObjSense() * solver->getObjValue(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * dj = solver->getReducedCost(); // What results is double * newLower = results; double * objLower = newLower + numberIntegers; double * newUpper = objLower + numberIntegers; double * objUpper = newUpper + numberIntegers; double * interAction = objUpper + numberIntegers; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; newLower[i] = lower[iColumn]; objLower[i] = -COIN_DBL_MAX; newUpper[i] = upper[iColumn]; objUpper[i] = -COIN_DBL_MAX; interAction[i] = 0.0; } double * objMovement=new double[2*numberIntegers]; memset(objMovement,0,2*numberIntegers*sizeof(double)); double * saveUpper = new double[numberColumns]; double * saveLower = new double[numberColumns]; // Save solution in case heuristics need good solution later double * saveSolution = new double[numberColumns]; memcpy(saveSolution, solver->getColSolution(), numberColumns*sizeof(double)); model->reserveCurrentSolution(saveSolution); for (i = 0; i < numberColumns; i++) { saveLower[i] = lower[i]; saveUpper[i] = upper[i]; } // Get arrays to sort double * sort = new double[numberObjects]; int * whichObject = new int[numberObjects]; int numberToFix = 0; int numberToDo = 0; double integerTolerance = model->getDblParam(CbcModel::CbcIntegerTolerance); // point to useful information OsiBranchingInformation usefulInfo = model->usefulInformation(); // and modify usefulInfo.depth_ = depth_; // compute current state int numberObjectInfeasibilities; // just odd ones int numberIntegerInfeasibilities; model->feasibleSolution( numberIntegerInfeasibilities, numberObjectInfeasibilities); if (solveType) { if ((solveType&2)==0) numberIterationsAllowed=200*numberIntegerInfeasibilities; else numberIterationsAllowed=COIN_INT_MAX; } int saveAllowed=numberIterationsAllowed; # ifdef COIN_HAS_CLP OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver); int saveClpOptions = 0; bool fastIterations = (model->specialOptions() & 8) != 0; if (osiclp) { saveClpOptions = osiclp->specialOptions(); // for faster hot start if (fastIterations) osiclp->setSpecialOptions(saveClpOptions | 8192); else osiclp->setSpecialOptions(saveClpOptions | 2048); // switch off crunch } # else bool fastIterations = false ; # endif /* Scan for branching objects that indicate infeasibility. The algorithm is to fill the array with a set of good candidates (by infeasibility). */ numberToDo = 0; for (i = 0; i < numberObjects; i++) { OsiObject * object = model->modifiableObject(i); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; if (!dynamicObject) continue; if (dynamicObject->priority()!=highestPriority) continue; double infeasibility = object->checkInfeasibility(&usefulInfo); int iColumn = dynamicObject->columnNumber(); if (saveUpper[iColumn] == saveLower[iColumn]) continue; if (infeasibility) sort[numberToDo] = -1.0e10 - infeasibility; else sort[numberToDo] = -fabs(dj[iColumn]); whichObject[numberToDo++] = i; } // Save basis CoinWarmStart * ws = solver->getWarmStart(); int saveLimit; solver->getIntParam(OsiMaxNumIterationHotStart, saveLimit); int targetIterations = CoinMax(500, numberIterationsAllowed / numberObjects); if (saveLimit < targetIterations) solver->setIntParam(OsiMaxNumIterationHotStart, targetIterations); if ((solveType&2)==0) { // Mark hot start solver->markHotStart(); } solver->setHintParam(OsiDoDualInResolve, true, OsiHintDo) ; // Sort CoinSort_2(sort, sort + numberToDo, whichObject); double * currentSolution = model->currentSolution(); double objMin = 1.0e50; double objMax = -1.0e50; bool needResolve = false; int maxChoices=1; int currentChoice=0; int numberThreads=0; bool doAtEnd=false; if (model->parallelMode() && (solveType&4)!=0) { numberThreads=model->getNumberThreads(); sprintf(general,"Using %d threads in analysis\n",numberThreads); model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << general << CoinMessageEol; if (model->parallelMode()==1) { maxChoices=numberThreads; } else { maxChoices = numberToDo; if ((solveType&2)!=0) maxChoices = numberColumns; doAtEnd=true; } } StrongInfo * choices = new StrongInfo[maxChoices]; StrongStaticInfo staticInfo; int numberBundles = CoinMax(1,numberThreads); StrongBundle * bundles = new StrongBundle[numberBundles]; /* 0 - available - no need to look at results 1 - not available 2 - available - need to look at results */ #ifndef NUMBER_THREADS #define NUMBER_THREADS 4 #endif int status[NUMBER_THREADS]; memset(status,0,sizeof(status)); memset(&staticInfo,0,sizeof(staticInfo)); staticInfo.solveType = solveType; staticInfo.originalSolution=saveSolution; staticInfo.back=back; staticInfo.ws=ws; staticInfo.integerTolerance=integerTolerance; double time1 = model->getCurrentSeconds(); #define DO_STEEPEST_SERIAL 1 # ifdef COIN_HAS_CLP if (osiclp&&(solveType&2)!=0&&(!numberThreads||DO_STEEPEST_SERIAL)) { ClpSimplex * simplex = osiclp->getModelPtr(); simplex->setLogLevel(0); simplex->dual(0,1); ClpDualRowPivot * dualRowPivot=simplex->dualRowPivot(); ClpDualRowSteepest * steep = dynamic_cast(dualRowPivot); if (steep) { staticInfo.dualRowPivot=new ClpDualRowSteepest (*steep); staticInfo.dualRowPivot->setMode(1); // full steepest edge simplex->spareIntArray_[0]=0; simplex->spareIntArray_[1]=numberRows; staticInfo.dualRowPivot->saveWeights(simplex,7); } } #endif for (int i=0;iclone(); threadNeedsRefreshing[i]=0; } # ifdef COIN_HAS_CLP int numberSteepThreads=0; int step=numberThreads ? (numberRows+numberThreads-1)/numberThreads : 0; int first=0; for (int i=0;i(threadInfo.threadInfo_[i].extraInfo2); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver); ClpSimplex * simplex = osiclp->getModelPtr(); simplex->setLogLevel(0); simplex->dual(0,1); ClpDualRowPivot * dualRowPivot=simplex->dualRowPivot(); ClpDualRowSteepest * steep = dynamic_cast(dualRowPivot); if (steep) { numberSteepThreads=numberThreads; ClpDualRowSteepest * dualRowPivot=new ClpDualRowSteepest (*steep); dualRowPivot->setMode(1); // full steepest edge simplex->spareIntArray_[0]=0; simplex->spareIntArray_[1]=numberRows; simplex->spareIntArray_[0]=first; simplex->spareIntArray_[1]=CoinMin(first+step,numberRows); first += step; if (i==0) staticInfo.dualRowPivot=dualRowPivot; choices[i].steepest=dualRowPivot; dualRowPivot->saveWeights(simplex,7); } } } if (numberSteepThreads&&false) { int numberDone=0; int iDo=0; staticInfo.solveType = 200; while (numberDone(threadInfo.threadInfo_[iThread].extraInfo2); threadStatus=0; #ifdef DETAIL_THREAD printf("Starting steep task on thread %d\n", choice.iThread); #endif threadInfo.startParallelTask(1,iThread,&bundle); } if (!threadStatus) { #ifdef _MSC_VER Sleep(1); #else usleep(1000); #endif continue; } if (threadStatus) { numberDone++; // say available threadInfo.sayIdle(iThread); } staticInfo.solveType = solveType; } OsiSolverInterface * solver0= reinterpret_cast(threadInfo.threadInfo_[0].extraInfo2); CoinIndexedVector * savedWeights0 = staticInfo.dualRowPivot->savedWeights(); int * index0 = savedWeights0->getIndices(); double * weight0 = savedWeights0->denseVector(); int step=(numberRows+numberSteepThreads-1)/numberSteepThreads; int first=step; //memset(weight0+first,0,(numberRows-first)*sizeof(double)); for (int i=1;isavedWeights(); int * index = savedWeights->getIndices(); double * weight = savedWeights->denseVector(); memcpy(index0+first,index+first,n*sizeof(int)); memcpy(weight0+first,weight+first,n*sizeof(double)); first += step; delete choices[i].steepest; choices[i].steepest=NULL; } //for (int j=0;jgetMinimizationObjValue(); double * bestSolution = NULL; double cutoff; solver->getDblParam(OsiDualObjectiveLimit,cutoff); double maxMovement = 2.0*(cutoff-objectiveValue_)+1.0e-6; /* Now calculate the cost forcing the variable up and down. */ int iDo=0; int iDone=-1; int numberDone=0; int iThread=0; int threadStatus=0; int whenPrint = (numberToDo+9)/10; while (numberDonegetCurrentSeconds()-time1,saveAllowed-numberIterationsAllowed); model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << general << CoinMessageEol; } #ifdef USE_STRONG_THREADS if (numberThreads) { threadInfo.waitParallelTask(1,iThread,iDo(threadInfo.threadInfo_[iThread].extraInfo2); if ((threadNeedsRefreshing[iThread]&1)!=0) solver->setColLower(saveLower); if ((threadNeedsRefreshing[iThread]&2)!=0) solver->setColUpper(saveUpper); threadNeedsRefreshing[iThread]=0; } } #endif if (threadStatus==0&&iDomodifiableObject(iObject); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; int iColumn = dynamicObject->columnNumber(); double value = currentSolution[iColumn]; double nearest = floor(value + 0.5); double lowerValue = floor(value); bool satisfied = false; if (fabs(value - nearest) <= integerTolerance || value < saveLower[iColumn] || value > saveUpper[iColumn]) { satisfied = true; if (nearest < saveUpper[iColumn]) { lowerValue = nearest; } else { lowerValue = nearest - 1; } } double upperValue = lowerValue + 1.0; // Save which object it was choice.columnNumber = iColumn; choice.initialValue=value; choice.upLowerBound=upperValue; choice.downUpperBound=lowerValue; choice.numIntInfeas[1] = numberUnsatisfied_; choice.numIntInfeas[0] = numberUnsatisfied_; choice.movement[0] = 0.0; choice.movement[1] = 0.0; choice.numIters[0] = 0; choice.numIters[1] = 0; if (fabs(value - lowerValue) <= integerTolerance) choice.numIters[0]=-1; // mark as not done if (fabs(value - upperValue) <= integerTolerance) choice.numIters[1]=-1; // mark as not done bundle.choice=&choice; bundle.solver = solver; #ifdef USE_STRONG_THREADS if (numberThreads) { bundle.solver=reinterpret_cast(threadInfo.threadInfo_[iThread].extraInfo2); threadStatus=0; #ifdef DETAIL_THREAD printf("Starting task for column %d on thread %d\n", choice.columnNumber,iThread); #endif threadInfo.startParallelTask(1,iThread,&bundle); } else { #endif threadStatus=2; solveAnalyze(&bundle); #ifdef USE_STRONG_THREADS } #endif } if (!threadStatus) { #ifdef _MSC_VER Sleep(1); #else usleep(1000); #endif continue; } if (threadStatus) { int whichChoice = bundles[iThread].whichChoice; StrongInfo & choice = choices[whichChoice]; int iColumn=choice.columnNumber; if (choice.integerSolution) { double * foundSolution = choice.integerSolution; solver->setColSolution(foundSolution); // See if integer solution int numberInfeas=0; int numberOddInfeas=0; if (model->feasibleSolution(numberInfeas,numberOddInfeas) && model->problemFeasibility()->feasible(model, -1) >= 0) { double newObjectiveValue; solver->getDblParam(OsiObjOffset,newObjectiveValue); newObjectiveValue=-newObjectiveValue; const double * cost = solver->getObjCoefficients(); for ( int i = 0 ; i < numberColumns ; i++ ) newObjectiveValue += cost[i] * foundSolution[i]; if (newObjectiveValuesetBestSolution(CBC_STRONGSOL, newObjectiveValue, foundSolution) ; model->setLastHeuristic(NULL); model->incrementUsed(solver->getColSolution()); bestSolutionValue = model->getMinimizationObjValue(); } } } delete [] foundSolution; } for (int iWay=0;iWay<2;iWay++) { numberIterationsAllowed -= choice.numIters[iWay]; choice.movement[iWay] -= objectiveValue_; } // If objective goes above certain amount we can set bound int jInt = back[iColumn]; OsiObject * object = model->modifiableObject(jInt); CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object) ; if (dynamicObject) { if (choice.numIters[0]>=0) { dynamicObject->addToSumDownCost(CoinMin(choice.movement[0],maxMovement)); dynamicObject->addToSumDownChange(choice.initialValue-choice.downUpperBound); } if (choice.numIters[1]>=0) { dynamicObject->addToSumUpCost(CoinMin(choice.movement[1],maxMovement)); dynamicObject->addToSumUpChange(choice.upLowerBound-choice.initialValue); } } newLower[jInt] = choice.upLowerBound; if (choice.finished[0]) objLower[jInt] = choice.movement[0] + objectiveValue_; else objLower[jInt] = objectiveValue_; newUpper[jInt] = choice.downUpperBound; if (choice.finished[1]) objUpper[jInt] = choice.movement[1] + objectiveValue_; else objUpper[jInt] = objectiveValue_; objMin = CoinMin(CoinMin(objLower[jInt], objUpper[jInt]), objMin); objMovement[2*jInt]=choice.movement[0]; objMovement[2*jInt+1]=choice.movement[1]; double sumModified = choice.modified[0] + choice.modified[1] + 1.0e-15*(choice.sumModified[0]+choice.sumModified[1]); if (choice.numIters[0]>=0&&choice.numIters[1]>=0) sumModified *= 0.6; interAction[jInt] = sumModified; /* End of evaluation for this candidate variable. Possibilities are: * Both sides below cutoff; this variable is a candidate for branching. * Both sides infeasible or above the objective cutoff: no further action here. Break from the evaluation loop and assume the node will be purged by the caller. * One side below cutoff: Install the branch (i.e., fix the variable). Break from the evaluation loop and assume the node will be reoptimised by the caller. */ threadStatus=0; currentChoice++; numberDone++; #ifdef USE_STRONG_THREADS // say available if (numberThreads) { threadInfo.sayIdle(iThread); } #endif if (doAtEnd) continue; if (choice.movement[1] < 1.0e100) { if (choice.movement[0] < 1.0e100) { objMax = CoinMax(CoinMax(objLower[jInt], objUpper[jInt]), objMax); // In case solution coming in was odd choice.movement[1] = CoinMax(0.0, choice.movement[1]); choice.movement[0] = CoinMax(0.0, choice.movement[0]); // feasible - model->messageHandler()->message(CBC_STRONG, *model->messagesPointer()) << iColumn << iColumn << choice.movement[0] << choice.numIntInfeas[0] << choice.movement[1] << choice.numIntInfeas[1] << choice.initialValue << CoinMessageEol; } else { // up feasible, down infeasible needResolve = true; numberToFix++; saveLower[iColumn] = choice.upLowerBound; solver->setColLower(iColumn, choice.upLowerBound); #ifdef USE_STRONG_THREADS for (int i=0;isetColUpper(iColumn, choice.downUpperBound); #ifdef USE_STRONG_THREADS for (int i=0;iobject(choice.objectNumber)->columnNumber())); //solver->writeMps("bad"); numberToFix = -1; break; } } if (numberIterationsAllowed <= 0) break; if (currentChoice==maxChoices) currentChoice=0; } //printf("obj %d, col %d, down %g up %g value %g\n",iObject,iColumn, // choice.downMovement,choice.upMovement,value); } // Do at end if deterministic if (doAtEnd) { if (bestSolution) { model->setBestSolution(CBC_STRONGSOL, bestSolutionValue, bestSolution) ; model->setLastHeuristic(NULL); model->incrementUsed(solver->getColSolution()); delete [] bestSolution; } for (int iDo = 0; iDo < numberLookIntegers; iDo++) { StrongInfo & choice = choices[iDo]; int iColumn = choice.columnNumber; int iObject = iColumn; int jInt = back[iColumn]; double value = choice.initialValue; double lowerValue = choice.downUpperBound; double upperValue = choice.upLowerBound; if (choice.movement[1] < 1.0e100) { if (choice.movement[0] < 1.0e100) { objMax = CoinMax(CoinMax(objLower[jInt], objUpper[jInt]), objMax); // In case solution coming in was odd choice.movement[1] = CoinMax(0.0, choice.movement[1]); choice.movement[0] = CoinMax(0.0, choice.movement[0]); // feasible - model->messageHandler()->message(CBC_STRONG, *model->messagesPointer()) << iObject << iColumn << choice.movement[0] << choice.numIntInfeas[0] << choice.movement[1] << choice.numIntInfeas[1] << value << CoinMessageEol; } else { // up feasible, down infeasible numberToFix++; saveLower[iColumn] = upperValue; solver->setColLower(iColumn, upperValue); } } else { if (choice.movement[0] < 1.0e100) { // down feasible, up infeasible needResolve = true; numberToFix++; saveUpper[iColumn] = lowerValue; solver->setColUpper(iColumn, lowerValue); } else { // neither side feasible COIN_DETAIL_PRINT(printf("Both infeasible for choice %d sequence %d\n", i, model->object(choice.objectNumber)->columnNumber())); //solver->writeMps("bad"); numberToFix = -1; break; } } } } if (false) { const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); for (int i=0;inumberAnalyzeIterations() - numberIterationsAllowed)); model->setNumberAnalyzeIterations(numberIterationsAllowed); if (numberToFix>0) { sprintf(general,"%d variable bounds modified by initial strong branching (%.2f seconds - %d iterations)",numberToFix,model->getCurrentSeconds()-time1,saveAllowed-numberIterationsAllowed); } else if (numberToFix<0) { sprintf(general,"initial strong branching found to be infeasible (%.2f seconds - %d iterations)",model->getCurrentSeconds()-time1,saveAllowed-numberIterationsAllowed); } else if ((solveType&32)!=0) { sprintf(general,"No variables fixed by initial strong branching (%.2f seconds - %d iterations)",model->getCurrentSeconds()-time1,saveAllowed-numberIterationsAllowed); } else { general[0]='\0'; } if (general[0]!='\0') model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << general << CoinMessageEol; double smallestEffect=COIN_DBL_MAX; double largestEffect=0.0; for (i = 0; i < numberIntegers; i++) { int iColumn=integerVariable[i]; if (back[iColumn]>=numberColumns) continue; smallestEffect = CoinMin(smallestEffect,interAction[i]); largestEffect = CoinMax(largestEffect,interAction[i]); } double groupValue[11]; int groupCounts[11]={0,0,0,0,0,0,0,0,0,0,0}; groupValue[10]=largestEffect; for (int i=0;i<10;i++) groupValue[i]=smallestEffect+i*0.1*(largestEffect-smallestEffect); sprintf(general,"Looked at %d integer variables - smallest interaction %g", numberLookIntegers,smallestEffect); model->messageHandler()->message((solveType&32)==0 ? CBC_FPUMP2 : CBC_FPUMP1, *model->messagesPointer()) << general << CoinMessageEol; for (int i = 0; i < numberIntegers; i++) { int iColumn=integerVariable[i]; if (back[iColumn]>=numberColumns) continue; double value = interAction[i]; int j; for (j=0;j<11;j++) { if (value<=groupValue[j]||j==10) break; } groupCounts[j]++; } general[0]='\0'; for (int i=0;i<11;i++) sprintf(general+strlen(general),"%d <= %g ",groupCounts[i],groupValue[i]); model->messageHandler()->message((solveType&32)==0 ? CBC_FPUMP2 : CBC_FPUMP1, *model->messagesPointer()) << general << CoinMessageEol; smallestEffect=COIN_DBL_MAX; largestEffect=0.0; int numberChanged=0; int numberZeroMoved=0; for (i = 0; i < numberIntegers; i++) { int iColumn=integerVariable[i]; if (back[iColumn]>=numberColumns) continue; for (int iWay=0;iWay<2;iWay++) { double value=objMovement[2*i+iWay]; if (value<1.0e-7) { numberZeroMoved++; } else if (value<1.0e50) { smallestEffect = CoinMin(smallestEffect,value); largestEffect = CoinMax(largestEffect,value); } else { numberChanged++; } } } memset(groupCounts,0,sizeof(groupCounts)); groupValue[10]=largestEffect; for (int i=0;i<10;i++) groupValue[i]=smallestEffect+i*0.1*(largestEffect-smallestEffect); sprintf(general,"Strong branching - %d bounds changed, %d zero objective changes and %d nonzero (smallest %g)", numberChanged,numberZeroMoved, 2*numberLookIntegers-numberChanged-numberZeroMoved,smallestEffect); model->messageHandler()->message((solveType&32)==0 ? CBC_FPUMP2 : CBC_FPUMP1, *model->messagesPointer()) << general << CoinMessageEol; sprintf(general,"Breakdown "); for (i = 0; i < numberIntegers; i++) { int iColumn=integerVariable[i]; if (back[iColumn]>=numberColumns) continue; for (int iWay=0;iWay<2;iWay++) { double value = objMovement[2*i+iWay]; int j; for (j=0;j<11;j++) { if (value<=groupValue[j]||j==10) break; } groupCounts[j]++; } } for (int i=0;i<11;i++) sprintf(general+strlen(general),"%d <= %g ",groupCounts[i],groupValue[i]); model->messageHandler()->message((solveType&32)==0 ? CBC_FPUMP2 : CBC_FPUMP1, *model->messagesPointer()) << general << CoinMessageEol; delete [] objMovement; if ((solveType&2)==0) { // Delete the snapshot solver->unmarkHotStart(); } // back to normal solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; solver->setIntParam(OsiMaxNumIterationHotStart, saveLimit); // restore basis solver->setWarmStart(ws); // skip if infeasible if (numberToFix<0) solveType=0; int numberBoundsChanged=0; if ((solveType&16)==0) { double size=numberRows; size*=numberColumns; if (size>1000000) { if ((solveType&32)!=0) model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << "Skipping analyze on other columns as problem too large" << CoinMessageEol; solveType &= ~2; } } if ((solveType&2)!=0) { # ifdef COIN_HAS_CLP int saveOptions = osiclp ? osiclp->specialOptions() : 0; if (osiclp) { //ClpPrimalColumnPivot * primalColumnPivot=NULL; osiclp->setSpecialOptions(saveOptions|2048); // off crunch } #endif double * newLower = new double [2*numberColumns]; double * newUpper = newLower + numberColumns; // look at ints/all - should be parametrics - for now primal OsiSolverInterface * temp = solver->clone(); // add constraint int * indices = reinterpret_cast(newUpper); double * obj = newLower; memcpy(obj,solver->getObjCoefficients(),numberColumns*sizeof(double)); int n=0; for (int i=0;igetCutoff(); // relax a little bit cutoff += 1.0e-4; double offset; temp->getDblParam(OsiObjOffset, offset); temp->addRow(n,indices,obj,-COIN_DBL_MAX,CoinMin(cutoff,1.0e25)+offset); temp->setDblParam(OsiObjOffset, 0.0); #if defined (THREADS_IN_ANALYZE) && defined (COIN_HAS_CLP) for (int iThread=0;iThread(threadInfo.threadInfo_[iThread].extraInfo2); solver->addRow(n,indices,obj,-COIN_DBL_MAX,CoinMin(cutoff,1.0e25)+offset); } #endif } //temp->setHintParam(OsiDoDualInResolve, false, OsiHintDo) ; temp->setHintParam(OsiDoReducePrint, true, OsiHintTry); temp->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); temp->resolve(); { const double * lower =temp->getColLower(); const double * upper =temp->getColUpper(); for (int i=0;igetWarmStart(); staticInfo.ws=ws; staticInfo.newObjective = new double[2*numberColumns]; memcpy(staticInfo.newObjective,solver->getObjCoefficients(),numberColumns*sizeof(double)); memset(staticInfo.newObjective+numberColumns,0,numberColumns*sizeof(double)); #if defined (THREADS_IN_ANALYZE) && defined (COIN_HAS_CLP) for (int iThread=0;iThread(threadInfo.threadInfo_[iThread].extraInfo2); solver->setObjective(newLower); solver->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); threadNeedsRefreshing[iThread]=3; } #endif for (int i = 0; i < numberColumns; i++) { newLower[i]=lower[i]; newUpper[i]=upper[i]; } double * thisSolution = CoinCopyOfArray(temp->getColSolution(),numberColumns); double primalTolerance; solver->getDblParam(OsiPrimalTolerance,primalTolerance); iDo=0; iDone=-1; numberDone=0; int iThread=0; threadStatus=0; currentChoice=0; staticInfo.solveType=100; //mark for analyze staticInfo.originalSolution=thisSolution; whenPrint=(numberColumns+9)/10; while (numberDonegetCurrentSeconds()-time1,saveAllowed-numberIterationsAllowed); model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << general << CoinMessageEol; } #ifdef USE_STRONG_THREADS if (numberThreads) { threadInfo.waitParallelTask(1,iThread,iDo(threadInfo.threadInfo_[iThread].extraInfo2); if ((threadNeedsRefreshing[iThread]&1)!=0) solver->setColLower(saveLower); if ((threadNeedsRefreshing[iThread]&2)!=0) solver->setColUpper(saveUpper); threadNeedsRefreshing[iThread]=0; } } #endif if (threadStatus==0&&iDonewLower[iColumn]+integerTolerance) typeSolve=1; if (thisSolution[iColumn]=0) { if (thisSolution[iColumn]newUpper[iColumn]-0.9999) typeSolve &= ~2; if (temp->isBinary(iColumn)) typeSolve=0; // already done } if (typeSolve==0 || newUpper[iColumn]==newLower[iColumn]) { #ifdef USE_STRONG_THREADS // say available if (numberThreads) { threadInfo.sayIdle(iThread); } #endif numberDone++; continue; } // Save which object it was choice.columnNumber = iColumn; choice.initialValue=thisSolution[iColumn]; choice.movement[0]=COIN_DBL_MAX; choice.movement[1]=-COIN_DBL_MAX; choice.upLowerBound=newUpper[iColumn]; choice.downUpperBound=newLower[iColumn]; if ((typeSolve&1)==0) choice.numIters[0]=-1; // mark as not done if ((typeSolve&2)==0) choice.numIters[1]=-1; // mark as not done bundle.choice=&choice; bundle.solver = temp; #ifdef USE_STRONG_THREADS if (numberThreads) { bundle.solver=reinterpret_cast(threadInfo.threadInfo_[iThread].extraInfo2); threadStatus=0; #ifdef DETAIL_THREAD printf("Starting task for column %d on thread %d\n", choice.columnNumber,iThread); #endif threadInfo.startParallelTask(1,iThread,&bundle); } else { #endif threadStatus=2; solveAnalyze(&bundle); #ifdef USE_STRONG_THREADS } #endif } if (threadStatus) { int whichChoice = bundles[iThread].whichChoice; StrongInfo & choice = choices[whichChoice]; int iColumn=choice.columnNumber; if(choice.modified[0]) { numberToFix = -numberColumns-1; } double gotLower=COIN_DBL_MAX; double gotUpper=-COIN_DBL_MAX; if (choice.numIters[0]>=0) { // go down double value = choice.movement[0]; if (value>newLower[iColumn]+100.0*integerTolerance) { if (back[iColumn]>=0) value = ceil(value-integerTolerance); else value = CoinMax(newLower[iColumn],value-1.0e-5-1.0e-8*fabs(value)); if (value>newLower[iColumn]+1.0e-8*(1.0+fabs(value))) { sprintf(general,"Secondary analysis solve increases lower bound on %d from %g to %g%s", iColumn,newUpper[iColumn],value,(back[iColumn]>=0) ? "(integer)" : ""); model->messageHandler()->message(CBC_FPUMP2, *model->messagesPointer()) << general << CoinMessageEol; numberBoundsChanged++; if (value>newUpper[iColumn]-primalTolerance) { value=newUpper[iColumn]; if (value>newUpper[iColumn]+10.0*primalTolerance) { // infeasible numberToFix=-numberColumns-1; } } gotLower = value; } } } if (choice.numIters[1]>=0) { // go up double value=choice.movement[1]; if (value=0) value = floor(value+integerTolerance); else value = CoinMin(newUpper[iColumn],value+1.0e-5+1.0e-8*fabs(value)); if (value=0) ? "(integer)" : ""); model->messageHandler()->message(CBC_FPUMP2, *model->messagesPointer()) << general << CoinMessageEol; numberBoundsChanged++; if (valuesetColLower(iColumn,gotLower); if (!doAtEnd) solver->setColLower(iColumn,gotLower); } if (gotUpper!=-COIN_DBL_MAX) { gotUpper=CoinMax(gotUpper,newLower[iColumn]); newUpper[iColumn]=gotUpper; temp->setColUpper(iColumn,gotUpper); if (!doAtEnd) solver->setColUpper(iColumn,gotUpper); } #if 0 if ((model->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (!debugger) { abort(); } else { printf("still ok\n"); } } #endif threadStatus=0; currentChoice++; numberDone++; for (int iWay=0;iWay<2;iWay++) { if (choice.numIters[iWay]>0) numberIterationsAllowed -= choice.numIters[iWay]; } if (currentChoice==maxChoices) currentChoice=0; #ifdef USE_STRONG_THREADS // say available if (numberThreads) { threadInfo.sayIdle(iThread); } #endif } } delete [] thisSolution; delete temp; delete [] newLower; # ifdef COIN_HAS_CLP if (osiclp) { //ClpPrimalColumnPivot * primalColumnPivot=NULL; osiclp->setSpecialOptions(saveOptions); } #endif } delete [] staticInfo.newObjective; # ifdef COIN_HAS_CLP if (osiclp) { delete staticInfo.dualRowPivot; delete staticInfo.primalColumnPivot; ClpSimplex * simplex = osiclp->getModelPtr(); ClpDualRowPivot * dualRowPivot=simplex->dualRowPivot(); ClpDualRowSteepest * steep = dynamic_cast(dualRowPivot); if (steep) steep->setMode(3); } #endif if ((solveType&64)!=0) { OsiSolverInterface * temp = solver->clone(); int numberRows=solver->getNumRows(); int numberContinuousRows=model->numberRowsAtContinuous(); int * del = new int[numberRows-numberContinuousRows]; for (int i=numberContinuousRows;ideleteRows(numberRows-numberContinuousRows,del); delete [] del; # ifdef COIN_HAS_CLP if (!osiclp) { #endif solver->writeMps("analyzed"); temp->writeMps("analyzed2"); # ifdef COIN_HAS_CLP } else { OsiClpSolverInterface * osiclp2 = dynamic_cast< OsiClpSolverInterface*> (temp); osiclp->getModelPtr()->writeMps("analyzed.mps",2,1); osiclp2->getModelPtr()->writeMps("analyzed2.mps",2,1); } #endif delete temp; model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << "Models saved on 'analyzed' and 'analyzed2'" << CoinMessageEol; } delete [] choices; for (int i=0;i(threadInfo.threadInfo_[i].extraInfo2); } } #endif delete ws; delete [] sort; delete [] whichObject; delete [] saveLower; delete [] saveUpper; delete [] back; // restore solution solver->setColSolution(saveSolution); # ifdef COIN_HAS_CLP if (osiclp) osiclp->setSpecialOptions(saveClpOptions); # endif delete [] saveSolution; solver->resolve(); if (numberToFix<0&&!solver->isProvenOptimal()) { // infeasible model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << "Analysis shows problem to be infeasible" << CoinMessageEol; return numberToFix; } if (numberBoundsChanged) { sprintf(general,"%d bounds changed by secondary solves (%.2f seconds - %d iterations)", numberBoundsChanged,model->getCurrentSeconds()-time1,saveAllowed-numberIterationsAllowed); model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << general << CoinMessageEol; } else if ((solveType&32)!=0) { sprintf(general,"No bounds changed by secondary solves (%.2f seconds - %d iterations)", model->getCurrentSeconds()-time1,saveAllowed-numberIterationsAllowed); model->messageHandler()->message(CBC_GENERAL, *model->messagesPointer()) << general << CoinMessageEol; } model->reserveCurrentSolution(solver->getColSolution()); if ((solveType&1)!=0) { if (groupCounts[0]*4>numberIntegers) { // change priority on this group int generalPriority=-10000000; for (int i = 0; i < numberIntegers; i++) { OsiObject * object = model->modifiableObject(i); CbcSimpleInteger * integerObject = dynamic_cast (object) ; if (!integerObject) continue; generalPriority = CoinMax(generalPriority,integerObject->priority()); } for (int i = 0; i < numberIntegers; i++) { OsiObject * object = model->modifiableObject(i); CbcSimpleInteger * integerObject = dynamic_cast (object) ; if (!integerObject) continue; if (!interAction[i]&&integerObject->priority()==generalPriority) integerObject->setPriority(generalPriority+1); } } } return numberToFix; } CbcNode::CbcNode(const CbcNode & rhs) : CoinTreeNode(rhs) { #ifdef CHECK_NODE printf("CbcNode %p Constructor from rhs %p\n", this, &rhs); #endif if (rhs.nodeInfo_) nodeInfo_ = rhs.nodeInfo_->clone(); else nodeInfo_ = NULL; objectiveValue_ = rhs.objectiveValue_; guessedObjectiveValue_ = rhs.guessedObjectiveValue_; sumInfeasibilities_ = rhs.sumInfeasibilities_; if (rhs.branch_) branch_ = rhs.branch_->clone(); else branch_ = NULL; depth_ = rhs.depth_; numberUnsatisfied_ = rhs.numberUnsatisfied_; nodeNumber_ = rhs.nodeNumber_; state_ = rhs.state_; if (nodeInfo_) assert ((state_&2) != 0); else assert ((state_&2) == 0); } CbcNode & CbcNode::operator=(const CbcNode & rhs) { if (this != &rhs) { delete nodeInfo_; if (rhs.nodeInfo_) nodeInfo_ = rhs.nodeInfo_->clone(); else nodeInfo_ = NULL; objectiveValue_ = rhs.objectiveValue_; guessedObjectiveValue_ = rhs.guessedObjectiveValue_; sumInfeasibilities_ = rhs.sumInfeasibilities_; if (rhs.branch_) branch_ = rhs.branch_->clone(); else branch_ = NULL, depth_ = rhs.depth_; numberUnsatisfied_ = rhs.numberUnsatisfied_; nodeNumber_ = rhs.nodeNumber_; state_ = rhs.state_; if (nodeInfo_) assert ((state_&2) != 0); else assert ((state_&2) == 0); } return *this; } CbcNode::~CbcNode () { #ifdef CHECK_NODE if (nodeInfo_) { printf("CbcNode %p Destructor nodeInfo %p (%d)\n", this, nodeInfo_, nodeInfo_->numberPointingToThis()); //assert(nodeInfo_->numberPointingToThis()>=0); } else { printf("CbcNode %p Destructor nodeInfo %p (?)\n", this, nodeInfo_); } #endif if (nodeInfo_) { // was if (nodeInfo_&&(state_&2)!=0) { nodeInfo_->nullOwner(); int numberToDelete = nodeInfo_->numberBranchesLeft(); // CbcNodeInfo * parent = nodeInfo_->parent(); //assert (nodeInfo_->numberPointingToThis()>0); if (nodeInfo_->decrement(numberToDelete) == 0 || (state_&2) == 0) { if ((state_&2) == 0) nodeInfo_->nullParent(); delete nodeInfo_; } else { //printf("node %p nodeinfo %p parent %p\n",this,nodeInfo_,nodeInfo_->parent()); // anyway decrement parent //if (parent) ///parent->decrement(1); } } delete branch_; } // Decrement active cut counts void CbcNode::decrementCuts(int change) { if (nodeInfo_) assert ((state_&2) != 0); else assert ((state_&2) == 0); if (nodeInfo_) { nodeInfo_->decrementCuts(change); } } void CbcNode::decrementParentCuts(CbcModel * model, int change) { if (nodeInfo_) assert ((state_&2) != 0); else assert ((state_&2) == 0); if (nodeInfo_) { nodeInfo_->decrementParentCuts(model, change); } } /* Initialize reference counts (numberPointingToThis, numberBranchesLeft_) in the attached nodeInfo_. */ void CbcNode::initializeInfo() { assert(nodeInfo_ && branch_) ; nodeInfo_->initializeInfo(branch_->numberBranches()); assert ((state_&2) != 0); assert (nodeInfo_->numberBranchesLeft() == branch_->numberBranchesLeft()); } // Nulls out node info void CbcNode::nullNodeInfo() { nodeInfo_ = NULL; // say not active state_ &= ~2; } int CbcNode::branch(OsiSolverInterface * solver) { double changeInGuessed; assert (nodeInfo_->numberBranchesLeft() == branch_->numberBranchesLeft()); if (!solver) changeInGuessed = branch_->branch(); else changeInGuessed = branch_->branch(solver); guessedObjectiveValue_ += changeInGuessed; //#define PRINTIT #ifdef PRINTIT int numberLeft = nodeInfo_->numberBranchesLeft(); CbcNodeInfo * parent = nodeInfo_->parent(); int parentNodeNumber = -1; CbcBranchingObject * object1 = dynamic_cast(branch_) ; //OsiObject * object = object1-> //int sequence = object->columnNumber); int id = -1; double value = 0.0; if (object1) { id = object1->variable(); value = object1->value(); } printf("id %d value %g objvalue %g\n", id, value, objectiveValue_); if (parent) parentNodeNumber = parent->nodeNumber(); printf("Node number %d, %s, way %d, depth %d, parent node number %d\n", nodeInfo_->nodeNumber(), (numberLeft == 2) ? "leftBranch" : "rightBranch", way(), depth_, parentNodeNumber); assert (parentNodeNumber != nodeInfo_->nodeNumber()); #endif return nodeInfo_->branchedOn(); } /* Active arm of the attached OsiBranchingObject. In the simplest instance, coded -1 for the down arm of the branch, +1 for the up arm. But see OsiBranchingObject::way() Use nodeInfo--.numberBranchesLeft_ to see how active Except that there is no OsiBranchingObject::way(), and this'll fail in any event because we have various OsiXXXBranchingObjects which aren't descended from CbcBranchingObjects. I think branchIndex() is the appropriate equivalent, but could be wrong. (lh, 061220) 071212: I'm finally getting back to cbc-generic and rescuing a lot of my annotation from branches/devel (which was killed in summer). I'm going to put back an assert(obj) just to see what happens. It's still present as of the most recent change to CbcNode (r833). 080104: Yep, we can arrive here with an OsiBranchingObject. Removed the assert, it's served its purpose. 080226: John finally noticed this problem and added a way() method to the OsiBranchingObject hierarchy. Removing my workaround. */ int CbcNode::way() const { if (branch_) { CbcBranchingObject * obj = dynamic_cast (branch_) ; if (obj) { return obj->way(); } else { OsiTwoWayBranchingObject * obj2 = dynamic_cast (branch_) ; assert (obj2); return obj2->way(); } } else { return 0; } } /* Create a branching object for the node The routine scans the object list of the model and selects a set of unsatisfied objects as candidates for branching. The candidates are evaluated, and an appropriate branch object is installed. The numberPassesLeft is decremented to stop fixing one variable each time and going on and on (e.g. for stock cutting, air crew scheduling) If evaluation determines that an object is monotone or infeasible, the routine returns immediately. In the case of a monotone object, the branch object has already been called to modify the model. Return value:
    • 0: A branching object has been installed
    • -1: A monotone object was discovered
    • -2: An infeasible object was discovered
    Branch state:
    • -1: start
    • -1: A monotone object was discovered
    • -2: An infeasible object was discovered
    */ int CbcNode::chooseOsiBranch (CbcModel * model, CbcNode * lastNode, OsiBranchingInformation * usefulInfo, int branchState) { int returnStatus = 0; if (lastNode) depth_ = lastNode->depth_ + 1; else depth_ = 0; OsiSolverInterface * solver = model->solver(); objectiveValue_ = solver->getObjValue() * solver->getObjSense(); usefulInfo->objectiveValue_ = objectiveValue_; usefulInfo->depth_ = depth_; const double * saveInfoSol = usefulInfo->solution_; double * saveSolution = new double[solver->getNumCols()]; memcpy(saveSolution, solver->getColSolution(), solver->getNumCols()*sizeof(double)); usefulInfo->solution_ = saveSolution; OsiChooseVariable * choose = model->branchingMethod()->chooseMethod(); int numberUnsatisfied = -1; if (branchState < 0) { // initialize // initialize sum of "infeasibilities" sumInfeasibilities_ = 0.0; numberUnsatisfied = choose->setupList(usefulInfo, true); numberUnsatisfied_ = numberUnsatisfied; branchState = 0; if (numberUnsatisfied_ < 0) { // infeasible delete [] saveSolution; return -2; } } // unset best int best = -1; choose->setBestObjectIndex(-1); if (numberUnsatisfied) { if (branchState > 0 || !choose->numberOnList()) { // we need to return at once - don't do strong branching or anything if (choose->numberOnList() || !choose->numberStrong()) { best = choose->candidates()[0]; choose->setBestObjectIndex(best); } else { // nothing on list - need to try again - keep any solution numberUnsatisfied = choose->setupList(usefulInfo, false); numberUnsatisfied_ = numberUnsatisfied; if (numberUnsatisfied) { best = choose->candidates()[0]; choose->setBestObjectIndex(best); } } } else { // carry on with strong branching or whatever int returnCode = choose->chooseVariable(solver, usefulInfo, true); // update number of strong iterations etc model->incrementStrongInfo(choose->numberStrongDone(), choose->numberStrongIterations(), returnCode == -1 ? 0 : choose->numberStrongFixed(), returnCode == -1); if (returnCode > 1) { // has fixed some returnStatus = -1; } else if (returnCode == -1) { // infeasible returnStatus = -2; } else if (returnCode == 0) { // normal returnStatus = 0; numberUnsatisfied = 1; } else { // ones on list satisfied - double check numberUnsatisfied = choose->setupList(usefulInfo, false); numberUnsatisfied_ = numberUnsatisfied; if (numberUnsatisfied) { best = choose->candidates()[0]; choose->setBestObjectIndex(best); } } } } delete branch_; branch_ = NULL; guessedObjectiveValue_ = COIN_DBL_MAX;//objectiveValue_; // for now if (!returnStatus) { if (numberUnsatisfied) { // create branching object const OsiObject * obj = model->solver()->object(choose->bestObjectIndex()); //const OsiSolverInterface * solver = usefulInfo->solver_; branch_ = obj->createBranch(model->solver(), usefulInfo, obj->whichWay()); } } usefulInfo->solution_ = saveInfoSol; delete [] saveSolution; // may have got solution if (choose->goodSolution() && model->problemFeasibility()->feasible(model, -1) >= 0) { // yes double objValue = choose->goodObjectiveValue(); model->setBestSolution(CBC_STRONGSOL, objValue, choose->goodSolution()) ; model->setLastHeuristic(NULL); model->incrementUsed(choose->goodSolution()); choose->clearGoodSolution(); } return returnStatus; } int CbcNode::chooseClpBranch (CbcModel * model, CbcNode * lastNode) { assert(lastNode); depth_ = lastNode->depth_ + 1; delete branch_; branch_ = NULL; OsiSolverInterface * solver = model->solver(); //double saveObjectiveValue = solver->getObjValue(); //double objectiveValue = CoinMax(solver->getObjSense()*saveObjectiveValue,objectiveValue_); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); // point to useful information OsiBranchingInformation usefulInfo = model->usefulInformation(); // and modify usefulInfo.depth_ = depth_; int i; //bool beforeSolution = model->getSolutionCount()==0; int numberObjects = model->numberObjects(); int numberColumns = model->getNumCols(); double * saveUpper = new double[numberColumns]; double * saveLower = new double[numberColumns]; // Save solution in case heuristics need good solution later double * saveSolution = new double[numberColumns]; memcpy(saveSolution, solver->getColSolution(), numberColumns*sizeof(double)); model->reserveCurrentSolution(saveSolution); for (i = 0; i < numberColumns; i++) { saveLower[i] = lower[i]; saveUpper[i] = upper[i]; } // Save basis CoinWarmStart * ws = solver->getWarmStart(); numberUnsatisfied_ = 0; // initialize sum of "infeasibilities" sumInfeasibilities_ = 0.0; // Note looks as if off end (hidden one) OsiObject * object = model->modifiableObject(numberObjects); CbcGeneralDepth * thisOne = dynamic_cast (object); assert (thisOne); OsiClpSolverInterface * clpSolver = dynamic_cast (solver); assert (clpSolver); ClpSimplex * simplex = clpSolver->getModelPtr(); int preferredWay; double infeasibility = object->infeasibility(&usefulInfo, preferredWay); if (thisOne->whichSolution() >= 0) { ClpNode * nodeInfo=NULL; if ((model->moreSpecialOptions()&33554432)==0) { nodeInfo = thisOne->nodeInfo(thisOne->whichSolution()); nodeInfo->applyNode(simplex, 2); } else { // from diving CbcSubProblem ** nodes = reinterpret_cast (model->temporaryPointer()); assert (nodes); int numberDo=thisOne->numberNodes()-1; for (int iNode=0;iNodeapply(solver,1); nodes[numberDo]->apply(solver,9+16); } int saveLogLevel = simplex->logLevel(); simplex->setLogLevel(0); simplex->dual(); simplex->setLogLevel(saveLogLevel); double cutoff = model->getCutoff(); bool goodSolution = true; if (simplex->status()) { //simplex->writeMps("bad7.mps",2); if (nodeInfo) { if (nodeInfo->objectiveValue() > cutoff - 1.0e-2) goodSolution = false; else assert (!simplex->status()); } else { // debug diving assert (!simplex->status()); } } if (goodSolution) { double newObjectiveValue = solver->getObjSense() * solver->getObjValue(); // See if integer solution int numInf; int numInf2; bool gotSol = model->feasibleSolution(numInf, numInf2); if (!gotSol) { COIN_DETAIL_PRINT(printf("numinf %d\n", numInf)); double * sol = simplex->primalColumnSolution(); for (int i = 0; i < numberColumns; i++) { if (simplex->isInteger(i)) { double value = floor(sol[i] + 0.5); if (fabs(value - sol[i]) > 1.0e-7) { COIN_DETAIL_PRINT(printf("%d value %g\n", i, sol[i])); if (fabs(value - sol[i]) < 1.0e-3) { sol[i] = value; } } } } simplex->writeMps("bad8.mps", 2); bool gotSol = model->feasibleSolution(numInf, numInf2); if (!gotSol) assert (gotSol); } model->setBestSolution(CBC_STRONGSOL, newObjectiveValue, solver->getColSolution()) ; model->setLastHeuristic(NULL); model->incrementUsed(solver->getColSolution()); } } // restore bounds { for (int j = 0; j < numberColumns; j++) { if (saveLower[j] != lower[j]) solver->setColLower(j, saveLower[j]); if (saveUpper[j] != upper[j]) solver->setColUpper(j, saveUpper[j]); } } // restore basis solver->setWarmStart(ws); delete ws; int anyAction; //#define CHECK_PATH #ifdef CHECK_PATH extern int gotGoodNode_Z; if (gotGoodNode_Z >= 0) printf("good node %d %g\n", gotGoodNode_Z, infeasibility); #endif if (infeasibility > 0.0) { if (infeasibility == COIN_DBL_MAX) { anyAction = -2; // infeasible } else { branch_ = thisOne->createCbcBranch(solver, &usefulInfo, preferredWay); if (branch_) { // Set to first one (and change when re-pushing) CbcGeneralBranchingObject * branch = dynamic_cast (branch_); branch->state(objectiveValue_, sumInfeasibilities_, numberUnsatisfied_, 0); branch->setNode(this); anyAction = 0; } else { anyAction = -2; // mark as infeasible } } } else { anyAction = -1; } #ifdef CHECK_PATH gotGoodNode_Z = -1; #endif // Set guessed solution value guessedObjectiveValue_ = objectiveValue_ + 1.0e-5; delete [] saveLower; delete [] saveUpper; // restore solution solver->setColSolution(saveSolution); delete [] saveSolution; return anyAction; } /* Double checks in case node can change its mind! Returns objective value Can change objective etc */ double CbcNode::checkIsCutoff(double cutoff) { branch_->checkIsCutoff(cutoff); return objectiveValue_; } CoinMP-1.8.3/Cbc/src/config_cbc.h.in0000644000175000017500000000042312131054770015423 0ustar renerene/* src/config_cbc.h.in. */ /* Version number of project */ #undef CBC_VERSION /* Major Version number of project */ #undef CBC_VERSION_MAJOR /* Minor Version number of project */ #undef CBC_VERSION_MINOR /* Release Version number of project */ #undef CBC_VERSION_RELEASE CoinMP-1.8.3/Cbc/src/CbcCompareBase.hpp0000644000175000017500000001013011510742604016067 0ustar renerene/* $Id: CbcCompareBase.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcCompareBase_H #define CbcCompareBase_H //############################################################################# /* These are alternative strategies for node traversal. They can take data etc for fine tuning At present the node list is stored as a heap and the "test" comparison function returns true if node y is better than node x. This is rather inflexible so if the comparison functions wants it can signal to use alternative criterion on a complete pass throgh tree. */ #include "CbcNode.hpp" #include "CbcConfig.h" class CbcModel; class CbcTree; class CbcCompareBase { public: // Default Constructor CbcCompareBase () { test_ = NULL; threaded_ = false; } /*! \brief Reconsider behaviour after discovering a new solution. This allows any method to change its behaviour. It is called after each solution. The method should return true if changes are made which will alter the evaluation criteria applied to a node. (So that in cases where the search tree is sorted, it can be properly rebuilt.) */ virtual bool newSolution(CbcModel * ) { return (false) ; } /*! \brief Reconsider behaviour after discovering a new solution. This allows any method to change its behaviour. It is called after each solution. The method should return true if changes are made which will alter the evaluation criteria applied to a node. (So that in cases where the search tree is sorted, it can be properly rebuilt.) */ virtual bool newSolution(CbcModel * , double , int ) { return (false) ; } // This allows any method to change behavior as it is called // after every 1000 nodes. // Return true if want tree re-sorted virtual bool every1000Nodes(CbcModel * , int ) { return false; } /** Returns true if wants code to do scan with alternate criterion NOTE - this is temporarily disabled */ virtual bool fullScan() const { return false; } virtual ~CbcCompareBase() {} /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} // Copy constructor CbcCompareBase ( const CbcCompareBase & rhs) { test_ = rhs.test_; threaded_ = rhs.threaded_; } // Assignment operator CbcCompareBase & operator=( const CbcCompareBase& rhs) { if (this != &rhs) { test_ = rhs.test_; threaded_ = rhs.threaded_; } return *this; } /// Clone virtual CbcCompareBase * clone() const { abort(); return NULL; } /// This is test function virtual bool test (CbcNode * , CbcNode * ) { return true; } /// This is alternate test function virtual bool alternateTest (CbcNode * x, CbcNode * y) { return test(x, y); } bool operator() (CbcNode * x, CbcNode * y) { return test(x, y); } /// Further test if everything else equal inline bool equalityTest (CbcNode * x, CbcNode * y) const { assert (x); assert (y); if (!threaded_) { CbcNodeInfo * infoX = x->nodeInfo(); assert (infoX); int nodeNumberX = infoX->nodeNumber(); CbcNodeInfo * infoY = y->nodeInfo(); assert (infoY); int nodeNumberY = infoY->nodeNumber(); assert (nodeNumberX != nodeNumberY); return (nodeNumberX > nodeNumberY); } else { assert (x->nodeNumber() != y->nodeNumber()); return (x->nodeNumber() > y->nodeNumber()); } } /// Say threaded inline void sayThreaded() { threaded_ = true; } protected: CbcCompareBase * test_; // If not threaded we can use better way to break ties bool threaded_; }; #endif CoinMP-1.8.3/Cbc/src/CbcGenParam.cpp0000644000175000017500000000654012131054770015405 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenParam.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinParam.hpp" #include "CbcModel.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" namespace { char svnid[] = "$Id: CbcGenParam.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } /* Constructors and destructors There's a generic constructor and one for integer, double, keyword, string, and action parameters. */ /* Default constructor. */ CbcGenParam::CbcGenParam () : CoinParam(), paramCode_(CbcGenParamCode(0)), obj_(0) { /* Nothing to be done here */ } /* Constructor for double parameter */ CbcGenParam::CbcGenParam (CbcGenParamCode code, std::string name, std::string help, double lower, double upper, double dflt, bool display) : CoinParam(name, help, lower, upper, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for integer parameter */ CbcGenParam::CbcGenParam (CbcGenParamCode code, std::string name, std::string help, int lower, int upper, int dflt, bool display) : CoinParam(name, help, lower, upper, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for keyword parameter. */ CbcGenParam::CbcGenParam (CbcGenParamCode code, std::string name, std::string help, std::string firstValue, int dflt, bool display) : CoinParam(name, help, firstValue, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for string parameter. */ CbcGenParam::CbcGenParam (CbcGenParamCode code, std::string name, std::string help, std::string dflt, bool display) : CoinParam(name, help, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for action parameter. */ CbcGenParam::CbcGenParam (CbcGenParamCode code, std::string name, std::string help, bool display) : CoinParam(name, help, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Copy constructor. */ CbcGenParam::CbcGenParam (const CbcGenParam &orig) : CoinParam(orig), paramCode_(orig.paramCode_), obj_(orig.obj_) { /* Nothing to be done here */ } /* Clone */ CbcGenParam *CbcGenParam::clone () { return (new CbcGenParam(*this)) ; } CbcGenParam &CbcGenParam::operator= (const CbcGenParam & rhs) { if (this != &rhs) { CoinParam::operator=(rhs) ; paramCode_ = rhs.paramCode_ ; obj_ = rhs.obj_ ; } return *this ; } /* Destructor */ CbcGenParam::~CbcGenParam () { /* Nothing more to do */ } CoinMP-1.8.3/Cbc/src/CbcTree.hpp0000644000175000017500000003131412172722151014614 0ustar renerene/* $Id: CbcTree.hpp 1943 2013-07-21 09:05:45Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcTree_H #define CbcTree_H #include #include #include #include "CoinHelperFunctions.hpp" #include "CbcCompare.hpp" /*! \brief Using MS heap implementation It's unclear if this is needed any longer, or even if it should be allowed. Cbc occasionally tries to do things to the tree (typically tweaking the comparison predicate) that can cause a violation of the heap property (parent better than either child). In a debug build, Microsoft's heap implementation does checks that detect this and fail. This symbol switched to an alternate implementation of CbcTree, and there are clearly differences, but no explanation as to why or what for. As of 100921, the code is cleaned up to make it through `cbc -unitTest' without triggering `Invalid heap' in an MSVS debug build. The method validateHeap() can be used for debugging if this turns up again. */ //#define CBC_DUBIOUS_HEAP #if defined(_MSC_VER) || defined(__MNO_CYGWIN) //#define CBC_DUBIOUS_HEAP #endif #if 1 //ndef CBC_DUBIOUS_HEAP /*! \brief Controls search tree debugging In order to have validateHeap() available, set CBC_DEBUG_HEAP to 1 or higher. - 1 calls validateHeap() after each change to the heap - 2 will print a line for major operations (clean, set comparison, etc.) - 3 will print information about each push and pop #define CBC_DEBUG_HEAP 1 */ /*! \class CbcTree \brief Implementation of the live set as a heap. This class is used to hold the set of live nodes in the search tree. */ class CbcTree { public: /*! \name Constructors and related */ //@{ /// Default Constructor CbcTree (); /// Copy constructor CbcTree (const CbcTree &rhs); /// = operator CbcTree & operator=(const CbcTree &rhs); /// Destructor virtual ~CbcTree(); /// Clone virtual CbcTree * clone() const; /// Create C++ lines to get to current state virtual void generateCpp(FILE *) {} //@} /*! \name Heap access and maintenance methods */ //@{ /// Set comparison function and resort heap void setComparison(CbcCompareBase &compare); /// Return the top node of the heap virtual CbcNode * top() const; /// Add a node to the heap virtual void push(CbcNode *x); /// Remove the top node from the heap virtual void pop() ; /*! \brief Gets best node and takes off heap Before returning the node from the top of the heap, the node is offered an opportunity to reevaluate itself. Callers should be prepared to check that the node returned is suitable for use. */ virtual CbcNode * bestNode(double cutoff); /*! \brief Rebuild the heap */ virtual void rebuild() ; //@} /*! \name Direct node access methods */ //@{ /// Test for an empty tree virtual bool empty() ; /// Return size virtual int size() const { return static_cast(nodes_.size()); } /// Return a node pointer inline CbcNode * operator [] (int i) const { return nodes_[i]; } /// Return a node pointer inline CbcNode * nodePointer (int i) const { return nodes_[i]; } void realpop(); /** After changing data in the top node, fix the heap */ void fixTop(); void realpush(CbcNode * node); //@} /*! \name Search tree maintenance */ //@{ /*! \brief Prune the tree using an objective function cutoff This routine removes all nodes with objective worse than the specified cutoff value. It also sets bestPossibleObjective to the best objective over remaining nodes. */ virtual void cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective); /// Get best on list using alternate method CbcNode * bestAlternate(); /// We may have got an intelligent tree so give it one more chance virtual void endSearch() {} /// Get best possible objective function in the tree virtual double getBestPossibleObjective(); /// Reset maximum node number inline void resetNodeNumbers() { maximumNodeNumber_ = 0; } /// Get maximum node number inline int maximumNodeNumber() const { return maximumNodeNumber_; } /// Set number of branches inline void setNumberBranching(int value) { numberBranching_ = value; } /// Get number of branches inline int getNumberBranching() const { return numberBranching_; } /// Set maximum branches inline void setMaximumBranching(int value) { maximumBranching_ = value; } /// Get maximum branches inline int getMaximumBranching() const { return maximumBranching_; } /// Get branched variables inline unsigned int * branched() const { return branched_; } /// Get bounds inline int * newBounds() const { return newBound_; } /// Last objective in branch-and-cut search tree inline double lastObjective() const { return lastObjective_; } /// Last depth in branch-and-cut search tree inline int lastDepth() const { return lastDepth_; } /// Last number of objects unsatisfied inline int lastUnsatisfied() const { return lastUnsatisfied_; } /// Adds branching information to complete state void addBranchingInformation(const CbcModel * model, const CbcNodeInfo * nodeInfo, const double * currentLower, const double * currentUpper); /// Increase space for data void increaseSpace(); //@} # if CBC_DEBUG_HEAP > 0 /*! \name Debugging methods */ //@{ /*! \brief Check that the heap property is satisfied. */ void validateHeap() ; //@} # endif protected: /// Storage vector for the heap std::vector nodes_; /// Sort predicate for heap ordering. CbcCompare comparison_; /// Maximum "node" number so far to split ties int maximumNodeNumber_; /// Size of variable list int numberBranching_; /// Maximum size of variable list int maximumBranching_; /// Objective of last node pushed on tree double lastObjective_; /// Depth of last node pushed on tree int lastDepth_; /// Number unsatisfied of last node pushed on tree int lastUnsatisfied_; /** Integer variables branched or bounded top bit set if new upper bound next bit set if a branch */ unsigned int * branched_; /// New bound int * newBound_; }; #ifdef JJF_ZERO // not used /*! \brief Implementation of live set as a managed array. This class is used to hold the set of live nodes in the search tree. */ class CbcTreeArray : public CbcTree { public: // Default Constructor CbcTreeArray (); // Copy constructor CbcTreeArray ( const CbcTreeArray & rhs); // = operator CbcTreeArray & operator=(const CbcTreeArray & rhs); virtual ~CbcTreeArray(); /// Clone virtual CbcTree * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} /*! \name Heap access and maintenance methods */ //@{ /// Set comparison function and resort heap void setComparison(CbcCompareBase &compare); /// Add a node to the heap virtual void push(CbcNode * x); /// Gets best node and takes off heap virtual CbcNode * bestNode(double cutoff); //@} /*! \name vector methods */ //@{ /// Test if empty *** note may be overridden virtual bool empty() ; //@} /*! \name Search tree maintenance */ //@{ /*! \brief Prune the tree using an objective function cutoff This routine removes all nodes with objective worst than the specified cutoff value. It also sets bestPossibleObjective to best of all on tree before deleting. */ void cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective); /// Get best possible objective function in the tree virtual double getBestPossibleObjective(); //@} protected: /// Returns /// Last node CbcNode * lastNode_; /// Last node popped CbcNode * lastNodePopped_; /// Not used yet int switches_; }; /// New style #include "CoinSearchTree.hpp" /*! \class tree \brief Implementation of live set as a heap. This class is used to hold the set of live nodes in the search tree. */ class CbcNewTree : public CbcTree, public CoinSearchTreeManager { public: // Default Constructor CbcNewTree (); // Copy constructor CbcNewTree ( const CbcNewTree & rhs); // = operator CbcNewTree & operator=(const CbcNewTree & rhs); virtual ~CbcNewTree(); /// Clone virtual CbcNewTree * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} /*! \name Heap access and maintenance methods */ //@{ /// Set comparison function and resort heap void setComparison(CbcCompareBase &compare); /// Return the top node of the heap virtual CbcNode * top() const; /// Add a node to the heap virtual void push(CbcNode * x); /// Remove the top node from the heap virtual void pop() ; /// Gets best node and takes off heap virtual CbcNode * bestNode(double cutoff); //@} /*! \name vector methods */ //@{ /// Test if empty *** note may be overridden virtual bool empty() ; /// Return size inline int size() const { return nodes_.size(); } /// [] operator inline CbcNode * operator [] (int i) const { return nodes_[i]; } /// Return a node pointer inline CbcNode * nodePointer (int i) const { return nodes_[i]; } //@} /*! \name Search tree maintenance */ //@{ /*! \brief Prune the tree using an objective function cutoff This routine removes all nodes with objective worst than the specified cutoff value. It also sets bestPossibleObjective to best of all on tree before deleting. */ void cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective); /// Get best on list using alternate method CbcNode * bestAlternate(); /// We may have got an intelligent tree so give it one more chance virtual void endSearch() {} //@} protected: }; #endif #else /* CBC_DUBIOUS_HEAP is defined See note at top of file. This code is highly suspect. -- lh, 100921 -- */ class CbcTree { public: // Default Constructor CbcTree (); // Copy constructor CbcTree ( const CbcTree & rhs); // = operator CbcTree & operator=(const CbcTree & rhs); virtual ~CbcTree(); /// Clone virtual CbcTree * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) {} /*! \name Heap access and maintenance methods */ //@{ /// Set comparison function and resort heap void setComparison(CbcCompareBase &compare); /// Return the top node of the heap virtual CbcNode * top() const; /// Add a node to the heap virtual void push(CbcNode * x); /// Remove the top node from the heap virtual void pop() ; /// Gets best node and takes off heap virtual CbcNode * bestNode(double cutoff); //@} /*! \name vector methods */ //@{ /// Test if empty *** note may be overridden //virtual bool empty() ; /// Return size inline int size() const { return nodes_.size(); } /// [] operator inline CbcNode * operator [] (int i) const { return nodes_[i]; } /// Return a node pointer inline CbcNode * nodePointer (int i) const { return nodes_[i]; } virtual bool empty(); //inline int size() const { return size_; } void realpop(); /** After changing data in the top node, fix the heap */ void fixTop(); void realpush(CbcNode * node); //@} /*! \name Search tree maintenance */ //@{ /*! \brief Prune the tree using an objective function cutoff This routine removes all nodes with objective worst than the specified cutoff value. It also sets bestPossibleObjective to best of all on tree before deleting. */ void cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective); /// Get best on list using alternate method CbcNode * bestAlternate(); /// We may have got an intelligent tree so give it one more chance virtual void endSearch() {} /// Reset maximum node number inline void resetNodeNumbers() { maximumNodeNumber_ = 0; } /// Get maximum node number inline int maximumNodeNumber() const { return maximumNodeNumber_; } //@} protected: std::vector nodes_; CbcCompare comparison_; ///> Sort function for heap ordering. /// Maximum "node" number so far to split ties int maximumNodeNumber_; }; #endif #endif CoinMP-1.8.3/Cbc/src/CbcGeneralDepth.hpp0000644000175000017500000002077312131054770016266 0ustar renerene// $Id: CbcGeneralDepth.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #ifndef CbcGeneralDepth_H #define CbcGeneralDepth_H #include "CbcGeneral.hpp" #include "CbcBranchBase.hpp" #include "CbcSubProblem.hpp" #ifdef COIN_HAS_CLP /** Define a catch all class. This will create a list of subproblems using partial evaluation */ #include "ClpSimplex.hpp" #include "ClpNode.hpp" class CbcGeneralDepth : public CbcGeneral { public: // Default Constructor CbcGeneralDepth (); /** Useful constructor Just needs to point to model. Initial version does evaluation to depth N This is stored in CbcModel but may be better here */ CbcGeneralDepth (CbcModel * model, int maximumDepth); // Copy constructor CbcGeneralDepth ( const CbcGeneralDepth &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcGeneralDepth & operator=( const CbcGeneralDepth& rhs); // Destructor ~CbcGeneralDepth (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /// This looks at solution and sets bounds to contain solution virtual void feasibleRegion(); /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Return maximum number of nodes inline int maximumNodes() const { return maximumNodes_; } /// Get maximum depth inline int maximumDepth() const { return maximumDepth_; } /// Set maximum depth inline void setMaximumDepth(int value) { maximumDepth_ = value; } /// Return number of nodes inline int numberNodes() const { return numberNodes_; } /// Get which solution inline int whichSolution() const { return whichSolution_; } /// Get ClpNode info inline ClpNode * nodeInfo(int which) { return nodeInfo_->nodeInfo_[which]; } /// Redoes data when sequence numbers change virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns); protected: /// data /// Maximum depth int maximumDepth_; /// Maximum nodes int maximumNodes_; /// Which node has solution (or -1) mutable int whichSolution_; /// Number of valid nodes (including whichSolution_) mutable int numberNodes_; /// For solving nodes mutable ClpNodeStuff * nodeInfo_; }; /** Branching object for general objects */ class CbcNode; class CbcGeneralBranchingObject : public CbcBranchingObject { public: // Default Constructor CbcGeneralBranchingObject (); // Useful constructor CbcGeneralBranchingObject (CbcModel * model); // Copy constructor CbcGeneralBranchingObject ( const CbcGeneralBranchingObject &); // Assignment operator CbcGeneralBranchingObject & operator=( const CbcGeneralBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; // Destructor virtual ~CbcGeneralBranchingObject (); using CbcBranchingObject::branch ; /// Does next branch and updates state virtual double branch(); /** Double checks in case node can change its mind! Can change objective etc */ virtual void checkIsCutoff(double cutoff); using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /// Fill in current objective etc void state(double & objectiveValue, double & sumInfeasibilities, int & numberUnsatisfied, int which) const; /// Set CbcNode inline void setNode(CbcNode * node) { node_ = node; } /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return GeneralDepthBranchObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); /// Number of subproblems inline int numberSubProblems() const { return numberSubProblems_; } /// Decrement number left and return number inline int decrementNumberLeft() { numberSubLeft_--; return numberSubLeft_; } /// Which node we want to use inline int whichNode() const { return whichNode_; } /// Set which node we want to use inline void setWhichNode(int value) { whichNode_ = value; } // Sub problem const CbcSubProblem * subProblem(int which) const { return subProblems_ + which; } public: /// data // Sub problems CbcSubProblem * subProblems_; /// Node CbcNode * node_; /// Number of subproblems int numberSubProblems_; /// Number of subproblems left int numberSubLeft_; /// Which node we want to use (-1 for default) int whichNode_; /// Number of rows int numberRows_; }; /** Branching object for general objects - just one */ class CbcOneGeneralBranchingObject : public CbcBranchingObject { public: // Default Constructor CbcOneGeneralBranchingObject (); // Useful constructor CbcOneGeneralBranchingObject (CbcModel * model, CbcGeneralBranchingObject * object, int whichOne); // Copy constructor CbcOneGeneralBranchingObject ( const CbcOneGeneralBranchingObject &); // Assignment operator CbcOneGeneralBranchingObject & operator=( const CbcOneGeneralBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; // Destructor virtual ~CbcOneGeneralBranchingObject (); using CbcBranchingObject::branch ; /// Does next branch and updates state virtual double branch(); /** Double checks in case node can change its mind! Can change objective etc */ virtual void checkIsCutoff(double cutoff); using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return OneGeneralBranchingObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); public: /// data /// Object CbcGeneralBranchingObject * object_; /// Which one int whichOne_; }; #endif //COIN_HAS_CLP #endif CoinMP-1.8.3/Cbc/src/CbcGenParamUtils.cpp0000644000175000017500000015541712131054770016436 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenParamUtils.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinFileIO.hpp" #include "CoinFinite.hpp" #include "CoinParam.hpp" #include "CbcModel.hpp" #include "CbcGenParam.hpp" #include "CbcGenCtlBlk.hpp" /*! \file CbcGenParamUtils \brief Implementation functions for CbcGenParam parameters. */ namespace { char svnid[] = "$Id: CbcGenParamUtils.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } namespace CbcGenSolvers { void setupSolverParam(CbcGenParam &solverParam) ; } namespace CbcGenParamUtils { /* Function to add cbc-generic control parameters to the cbc-generic parameter vector. Were needed, defaults are drawn from ctlBlk-> This function is a friend of CbcGenCtlBlk. */ void addCbcGenParams (int &numberParameters, CoinParamVec ¶meters, CbcGenCtlBlk *ctlBlk) { CbcGenParam *param ; std::string empty = "" ; param = new CbcGenParam(CbcGenParam::GENERALQUERY, "?", "Print a list of commands", false) ; param->setPushFunc(doHelpParam) ; param->setObj(ctlBlk) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::FULLGENERALQUERY, "???", "Print a list with *all* commands, even those hidden with `?'", false) ; param->setPushFunc(doHelpParam) ; param->setObj(ctlBlk) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::PRINTVERSION, "version", "Print version") ; param->setPushFunc(doVersionParam) ; param->setObj(ctlBlk) ; parameters.push_back(param) ; /* Built into CoinParam parsing. No additional actions required. doNothingParam simply prevents them from being reported as unimplemented. */ param = new CbcGenParam(CbcGenParam::STDIN, "-", "Switch to interactive command line mode", false) ; param->setPushFunc(doNothingParam) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::STDIN, "stdin", "Switch to interactive command line mode", false) ; param->setPushFunc(doNothingParam) ; param->setObj(ctlBlk) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::BAB, "branch!AndCut", "Do Branch and Cut") ; param->setPushFunc(doBaCParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This does branch and cut. There are many parameters which can affect the performance. First just try with default settings and look carefully at the log file. Did cuts help? Did they take too long? Look at output to see which cuts were effective and then do some tuning. You will see that the options for cuts are off, on, root and ifmove. Off is obvious, on means that this cut generator will be tried in the branch and cut tree (you can fine tune using 'depth'). Root means just at the root node while 'ifmove' means that cuts will be used in the tree if they look as if they are doing some good and moving the objective value. If pre-processing reduced the size of the problem or strengthened many coefficients then it is probably wise to leave it on. Switch off heuristics which did not provide solutions. The other major area to look at is the search. Hopefully good solutions were obtained fairly early in the search so the important point is to select the best variable to branch on. See whether strong branching did a good job - or did it just take a lot of iterations. Adjust the strongBranching and trustPseudoCosts parameters." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::CPP, "cpp!Generate", "Generates C++ code", -1, 50000) ; param->setObj(ctlBlk) ; param->setLongHelp( "Once you like what the stand-alone solver does then this allows you to generate user_driver.cpp which approximates the code. 0 gives simplest driver, 1 generates saves and restores, 2 generates saves and restores even for variables at default value. 4 bit in cbc generates size dependent code rather than computed values." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::CLIQUECUTS, "clique!Cuts", "Whether to use clique cuts", "off", ctlBlk->clique_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenCutParam) ; param->setLongHelp( "This switches on clique cuts (either at root or in entire tree). See branchAndCut for information on options." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::CUTDEPTH, "cutD!epth", "Depth in tree at which to do cuts", -1, 999999, ctlBlk->cutDepth_) ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenIntParam) ; param->setLongHelp( "Cut generators may be off, on only at the root, on if they look useful, and on at some interval. If they are done every node then that is that, but it may be worth doing them every so often. The original method was every so many nodes but it is more logical to do it whenever depth in tree is a multiple of K. This option does that and defaults to -1 (off)." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::CUTSTRATEGY, "cuts!OnOff", "Switches all cuts on or off", "off", 0) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setLongHelp( "This can be used to switch on or off all cuts (apart from Reduce and Split). Then you can set individual ones off or on. See branchAndCut for information on options." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::COMBINE, "combine!Solutions", "Whether to use combine solution heuristic", "off", ctlBlk->combine_.action_) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "This switches on a heuristic which does branch and cut on the problem given by just using variables which have appeared in one or more solutions. It is obviously only tried after two or more solutions." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::COSTSTRATEGY, "cost!Strategy", "Whether to use costs or column order as priorities", "off", 0) ; param->appendKwd("pri!orities") ; param->appendKwd("column!Order") ; param->setObj(ctlBlk) ; param->setLongHelp( "This orders the variables in order of their absolute costs - with largest cost ones being branched on first. This primitive strategy can be surprisingly effective. The column order option is obviously not on costs but it's easy to implement." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::DEBUG, "debug!In", "Read/write valid solution from/to file", "", false) ; param->setObj(ctlBlk) ; param->setPushFunc(doDebugParam) ; param->setLongHelp( "This will read a solution file from the given file name. It will use the default directory given by 'directory'. A name of '$' will use the previous value for the name. This is initialized to '', i.e. it must be set.\n\nIf set to create it will create a file called debug.file after B&C search; if set to createAfterPre it will create the file before undoing preprocessing.\n\nThe idea is that if you suspect a bad cut generator and you did not use preprocessing you can do a good run with debug set to 'create' and then switch on the cuts you suspect and re-run with debug set to 'debug.file' Similarly if you do use preprocessing, but use createAfterPre. The create case has the same effect as saveSolution." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::DIRECTORY, "directory", "Set Default directory for import etc.", ctlBlk->dfltDirectory_) ; param->setObj(ctlBlk) ; param->setLongHelp( "This sets the directory which import, export, saveModel, restoreModel etc. will use. It is initialized to the current directory." ) ; param->setPushFunc(pushCbcGenStrParam) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::EXIT, "end", "Stops execution") ; param->setPushFunc(doExitParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This stops execution; end, exit, quit and stop are synonyms." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::ERRORSALLOWED, "error!sAllowed", "Whether to allow import errors", "off", 0) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "The default is not to use any model which had errors when reading the mps file. Setting this to 'on' will allow all errors from which the code can recover simply by ignoring the error. There are some errors from which the code can not recover, e.g., no ENDATA. This has to be set before import, i.e., -errorsAllowed on -import xxxxxx.mps." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::EXIT, "exit", "Stops execution") ; param->setPushFunc(doExitParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This stops execution; end, exit, quit and stop are synonyms." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::EXPORT, "export", "Export model as mps file", std::string("default.mps")) ; param->setObj(ctlBlk) ; param->setLongHelp( "This will write an MPS format file to the given file name. It will use the default directory given by 'directory'. A name of '$' will use the previous value for the name. This is initialized to 'default.mps'." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::DJFIX, "fix!OnDj", "Try heuristic that fixes variables based on reduced costs", -1.0e20, 1.0e20, ctlBlk->djFix_.threshold_) ; param->setPushFunc(pushCbcGenDblParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "If set, integer variables with reduced costs greater than the specified value will be fixed before branch and bound - use with extreme caution!" ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::FPUMP, "feas!ibilityPump", "Whether to try Feasibility Pump", "off", ctlBlk->fpump_.action_) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "This switches on feasibility pump heuristic at root. This is due to Fischetti and Lodi and uses a sequence of LPs to try and get an integer feasible solution. Some fine tuning is available by passFeasibilityPump." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::FPUMPITS, "passF!easibilityPump", "How many passes in feasibility pump", 0, 10000, ctlBlk->fpump_.iters_) ; param->setObj(ctlBlk) ; param->setLongHelp( "This fine tunes the Feasibility Pump heuristic by doing more or fewer passes." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::FLOWCUTS, "flow!CoverCuts", "Whether to use Flow Cover cuts", "off", ctlBlk->flow_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenCutParam) ; param->setLongHelp( "This switches on flow cover cuts (either at root or in entire tree). See branchAndCut for information on options." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::GOMORYCUTS, "gomory!Cuts", "Whether to use Gomory cuts", "off", ctlBlk->gomory_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenCutParam) ; param->setLongHelp( "The original cuts - beware of imitations! Having gone out of favor, they are now more fashionable as LP solvers are more robust and they interact well with other cuts. They will almost always give cuts (although in this executable they are limited as to number of variables in cut). However the cuts may be dense so it is worth experimenting. See branchAndCut for information on options." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::GREEDY, "greedy!Heuristic", "Whether to use a greedy heuristic", "off", ctlBlk->greedyCover_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->setObj(ctlBlk) ; param->setLongHelp( "Switches on a pair of greedy heuristic which will try and obtain a solution. It may just fix a percentage of variables and then try a small branch and cut run." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::HEURISTICSTRATEGY, "heur!isticsOnOff", "Switches most heuristics on or off", "off", 0) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "This can be used to switch on or off all heuristics. Then you can set individual ones off or on. CbcTreeLocal is not included as it dramatically alters search." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::KNAPSACKCUTS, "knapsack!Cuts", "Whether to use Knapsack cuts", "off", ctlBlk->knapsack_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenCutParam) ; param->setLongHelp( "This switches on knapsack cuts (either at root or in entire tree). See branchAndCut for information on options." ) ; parameters.push_back(param) ; /* param = new CbcGenParam(CbcGenParam::LANDPCUTS, "lift!AndProjectCuts","Whether to use lift-and-project cuts","off", ctlBlk->landp_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setLongHelp( "This switches on lift-and-project cuts (either at root or in entire tree). See branchAndCut for information on options." ) ; parameters.push_back(param) ; */ param = new CbcGenParam(CbcGenParam::LOCALTREE, "local!TreeSearch", "Whether to use local tree search", "off", ctlBlk->localTree_.action_) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "This switches on a local search algorithm when a solution is found. This is from Fischetti and Lodi and is not really a heuristic although it can be used as one. When used from this program it has limited functionality. It is not controlled by heuristicsOnOff." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::LOGLEVEL, "log!Level", "Level of detail in cbc-generic output.", -1, 999999, ctlBlk->logLvl_) ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenIntParam) ; param->setLongHelp( "If set to 0 then there should be no output in normal circumstances. A value of 1 is probably the best value for most uses, while 2 and 3 give more information." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::MIXEDCUTS, "mixed!IntegerRoundingCuts", "Whether to use Mixed Integer Rounding cuts", "off", ctlBlk->mir_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenCutParam) ; param->setLongHelp( "This switches on mixed integer rounding cuts (either at root or in entire tree). See branchAndCut for information on options." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::USESOLUTION, "force!Solution", "Whether to use given solution as crash for BAB", "off", 0) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "If on then tries to branch to solution given by AMPL or priorities file." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::HELP, "help", "Print out version, non-standard options and some help") ; param->setPushFunc(doHelpParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This prints out some help to get a user started. If you're seeing this message, you should be past that stage." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::IMPORT, "import", "Import model from mps file", ctlBlk->lastMpsIn_) ; param->setPushFunc(doImportParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This will read an MPS format file from the given file name. It will use the default directory given by 'directory'. A name of '$' will use the previous value for the name. This is initialized to '', i.e., it must be set. If you have libgz then it can read compressed files 'xxxxxxxx.gz'." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::SOLVECONTINUOUS, "initialS!olve", "Solve to continuous optimum") ; param->setObj(ctlBlk) ; param->setLongHelp( "This just solves the problem to the continuous optimum, without adding any cuts." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::MESSAGES, "mess!ages", "Controls whether standardised message prefix is printed", "off", 0) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "By default, messages have a standard prefix, such as:\n Clp0005 2261 Objective 109.024 Primal infeas 944413 (758)\nbut this program turns this off to make it look more friendly. It can be useful to turn them back on if you want to be able to 'grep' for particular messages or if you intend to override the behavior of a particular message." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::MIPLIB, "miplib", "Do some of miplib test set") ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::OUTDUPROWS, "outDup!licates", "Takes duplicate rows, etc., out of the integer model", false) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::OUTPUTFORMAT, "output!Format", "Which output format to use", 1, 6, 2) ; param->setObj(ctlBlk) ; param->setLongHelp( "Normally export will be done using normal representation for numbers and two values per line. You may want to do just one per line (for grep or suchlike) and you may wish to save with absolute accuracy using a coded version of the IEEE value. A value of 2 is normal. Otherwise, odd values give one value per line, even values two. Values of 1 and 2 give normal format, 3 and 4 give greater precision, 5 and 6 give IEEE values. When exporting a basis, 1 does not save values, 2 saves values, 3 saves with greater accuracy and 4 saves in IEEE format." ) ; parameters.push_back(param) ; /* In order for initialisation to work properly, the order of the keywords here must match the order of the enum IPPControl in CbcGenCtlBlk.hpp. */ param = new CbcGenParam(CbcGenParam::PREPROCESS, "preprocess", "Whether to use integer preprocessing", "off", ctlBlk->preProcess_) ; param->appendKwd("on") ; param->appendKwd("save") ; param->appendKwd("equal") ; param->appendKwd("sos") ; param->appendKwd("trysos") ; param->appendKwd("equalall") ; param->appendKwd("strategy") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenKwdParam) ; param->setLongHelp( "This tries to reduce size of the model in a similar way to presolve and it also tries to strengthen the model. This can be very useful and is worth trying. save option saves on file presolved.mps. equal will turn <= cliques into ==. sos will create sos sets if all 0-1 in sets (well one extra is allowed) and no overlaps. trysos is same but allows any number extra. equalall will turn all valid inequalities into equalities with integer slacks. strategy is as on but uses CbcStrategy." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::PRINTOPTIONS, "pO!ptions", "Dubious print options", 0, COIN_INT_MAX, 0, false) ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenIntParam) ; param->setLongHelp( "If this is greater than 0 then presolve will give more information and branch and cut will give statistics" ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::PROBINGCUTS, "probing!Cuts", "Whether to use Probing cuts", "off", ctlBlk->probing_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->appendKwd("forceOnBut") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenCutParam) ; param->setLongHelp( "This switches on probing cuts (either at root or in entire tree). See branchAndCut for information on options." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::INTPRINT, "printi!ngOptions", "Print options", "normal", 0) ; param->appendKwd("integer") ; param->appendKwd("special") ; param->appendKwd("rows") ; param->appendKwd("all") ; param->setPushFunc(pushCbcGenKwdParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This changes the amount and format of printing a solution:\nnormal - nonzero column variables \ninteger - nonzero integer column variables\nspecial - in format suitable for OsiRowCutDebugger\nrows - nonzero column variables and row activities\nall - all column variables and row activities.\n\nFor non-integer problems 'integer' and 'special' act like 'normal'. Also see printMask for controlling output." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::PRINTMASK, "printM!ask", "Control printing of solution with a regular expression", empty) ; param->setPushFunc(doPrintMaskParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "If set then only those names which match mask are printed in a solution. '?' matches any character and '*' matches any set of characters. The default is '' (unset) so all variables are printed. This is only active if model has names." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::PRIORITYIN, "prio!rityIn", "Import priorities etc from file", empty) ; param->setObj(ctlBlk) ; param->setLongHelp( "This will read a file with priorities from the given file name. It will use the default directory given by 'directory'. A name of '$' will use the previous value for the name. This is initialized to '', i.e. it must be set. This can not read from compressed files. File is in csv format with allowed headings - name, number, priority, direction, up, down, solution. Exactly one of name and number must be given." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::REDSPLITCUTS, "reduce!AndSplitCuts", "Whether to use Reduce-and-Split cuts", "off", ctlBlk->redSplit_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenCutParam) ; param->setLongHelp( "This switches on reduce and split cuts (either at root or in entire tree). See branchAndCut for information on options." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::ROUNDING, "round!ingHeuristic", "Whether to use Rounding heuristic", "off", ctlBlk->rounding_.action_) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "This switches on a simple (but effective) rounding heuristic at each node of tree." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::EXIT, "quit", "Stops execution") ; param->setPushFunc(doExitParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This stops execution; end, exit, quit and stop are synonyms." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::DUMMY, "sleep", "for debug", 0, 9999, 0, false) ; param->setObj(ctlBlk) ; param->setLongHelp( "If passed to solver from ampl, then ampl will wait so that you can copy .nl file for debug." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::SOLUTION, "solu!tion", "Prints solution to file", std::string("stdout")) ; param->setPushFunc(doSolutionParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This will write a primitive solution file to the given file name. It will use the default directory given by 'directory'. A name of '$' will use the previous value for the name. This is initialized to 'stdout'. The amount of output can be varied using printi!ngOptions or printMask." ) ; parameters.push_back(param) ; param = new CbcGenParam ; CbcGenSolvers::setupSolverParam(*param) ; param->setObj(ctlBlk) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::SOS, "sos!Options", "Whether to use SOS from AMPL", "off", 0) ; param->appendKwd("on") ; param->setObj(ctlBlk) ; param->setLongHelp( "Normally if AMPL says there are SOS variables they should be used, but sometimes they should be turned off - this does so." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::EXIT, "stop", "Stops execution") ; param->setPushFunc(doExitParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "This stops execution; end, exit, quit and stop are synonyms." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::STRENGTHEN, "strengthen", "Create strengthened problem") ; param->setObj(ctlBlk) ; param->setLongHelp( "This creates a new problem by applying the root node cuts. All tight constraints will be in resulting problem." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::TIGHTENFACTOR, "tighten!Factor", "Tighten bounds using value times largest activity at continuous solution", 1.0, 1.0e20) ; param->setObj(ctlBlk) ; param->setLongHelp( "This sleazy trick can help on some problems." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::TWOMIRCUTS, "two!MirCuts", "Whether to use Two phase Mixed Integer Rounding cuts", "off", ctlBlk->twomir_.action_) ; param->appendKwd("on") ; param->appendKwd("root") ; param->appendKwd("ifmove") ; param->appendKwd("forceOn") ; param->setObj(ctlBlk) ; param->setPushFunc(pushCbcGenCutParam) ; param->setLongHelp( "This switches on two phase mixed integer rounding cuts (either at root or in entire tree). See branchAndCut for information on options." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::UNITTEST, "unitTest", "Do unit test") ; param->setObj(ctlBlk) ; param->setLongHelp( "This exercises the unit test." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::USERCBC, "userCbc", "Hand coded Cbc stuff", 0, COIN_INT_MAX, 0, false) ; param->setObj(ctlBlk) ; param->setLongHelp( "There are times (e.g., when using AMPL interface) when you may wish to do something unusual. Look for USERCBC in main driver and modify sample code." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::VERBOSE, "verbose", "Switches on longer help on single ?", 0, 15, ctlBlk->verbose_, false) ; param->setPushFunc(pushCbcGenIntParam) ; param->setObj(ctlBlk) ; param->setLongHelp( "Set to 1 to get short help with ? list, 2 to get long help." ) ; parameters.push_back(param) ; param = new CbcGenParam(CbcGenParam::SHOWUNIMP, "unimp!lemented", "Report unimplemented commands.", false) ; param->setPushFunc(doUnimplementedParam) ; param->setObj(ctlBlk) ; parameters.push_back(param) ; numberParameters = parameters.size() ; assert (((unsigned) numberParameters) <= parameters.capacity()) ; return ; } void loadGenParamObj (const CoinParamVec paramVec, int first, int last, CbcGenCtlBlk *ctlBlk) { int i ; /* Load the cbc-generic object into the parameters */ for (i = first ; i <= last ; i++) { CbcGenParam *genParam = dynamic_cast(paramVec[i]) ; assert (genParam != 0) ; genParam->setObj(ctlBlk) ; } return ; } /* Functions to implement cbc-generic (CbcGenParam) parameters */ /* Maintainer's utility, scan the parameters and report the ones that are unimplemented (i.e., have no pushFunc). */ int doUnimplementedParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; assert (ctlBlk->paramVec_ != 0) ; CoinParamVec ¶mVec = *ctlBlk->paramVec_ ; int unimpCnt = 0 ; int maxAcross = 5 ; for (unsigned i = 0 ; i < paramVec.size() ; i++) { CoinParam *param = paramVec[i] ; if (param->pushFunc() == 0) { if (unimpCnt % maxAcross == 0) { std::cout << std::endl ; } else { std::cout << " " ; } std::cout << param->name() ; unimpCnt++ ; } } if (unimpCnt % maxAcross != 1) { std::cout << std::endl ; } std::cout << unimpCnt << " unimplemented parameters." << std::endl ; return (0) ; } /* Noop function. Mainly to eliminate commands from the list returned by doUnimplmentedParam. */ int doNothingParam (CoinParam *param) { return (0) ; } /* Function to terminate command parsing by returning -1. */ int doExitParam (CoinParam *param) { return (-1) ; } /* Function to print the current version. */ int doVersionParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; std::cout << "cbc-generic version " << ctlBlk->version_ << std::endl ; std::cout << "cbc-generic is experimental software. If you want a stable MIP " << "solver, please" << std::endl << "use cbc. If you discover bugs while using cbc-generic " << "please specify" << std::endl << "cbc-generic in the ticket description or email subject line." << std::endl ; return (0) ; } /* Function to handle help (HELP), `?' (GENERALQUERY), and `???' (FULLGENERALQUERY). */ int doHelpParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; CbcGenParam::CbcGenParamCode code = genParam->paramCode() ; int verbose = ctlBlk->verbose_ ; bool shortHelp = ((verbose & 0x01) ? true : false) ; bool longHelp = ((verbose & 0x02) ? true : false) ; bool hidden = ((verbose & 0x08) ? true : false) ; CoinParamVec *paramVec = ctlBlk->paramVec_ ; assert (paramVec != 0) ; /* Tune up the initial settings. FULLGENERALQUERY will print normally hidden params, and a request for long help overrules a request for short help. */ if (code == CbcGenParam::FULLGENERALQUERY) { hidden = true ; } if (longHelp) { shortHelp = false ; } CoinParamUtils::printGenericHelp() ; std::cout << "\nAvailable commands are:" ; std::string pfx(" ") ; CoinParamUtils::printHelp(*paramVec, 0, paramVec->size() - 1, pfx, shortHelp, longHelp, hidden) ; return (0) ; } /* Function to push a double-valued parameter. */ int pushCbcGenDblParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; double val = genParam->dblVal() ; CbcGenParam::CbcGenParamCode code = genParam->paramCode() ; int retval = 0 ; /* Figure out what we're doing and set the relevant field. */ switch (code) { case CbcGenParam::DJFIX: { ctlBlk->djFix_.action_ = true ; ctlBlk->djFix_.threshold_ = val ; break ; } default: { std::cerr << "pushCbcGenDbl: no equivalent CbcGenCtlBlk field for " << "parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } return (retval) ; } /* Function to push an integer-valued parameter. */ int pushCbcGenIntParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; int val = genParam->intVal() ; CbcGenParam::CbcGenParamCode code = genParam->paramCode() ; int retval = 0 ; /* Figure out what we're doing and set the relevant field. */ switch (code) { case CbcGenParam::CUTDEPTH: { ctlBlk->setCutDepth(val) ; break ; } case CbcGenParam::LOGLEVEL: { ctlBlk->setLogLevel(val) ; break ; } case CbcGenParam::PRINTOPTIONS: { ctlBlk->printOpt_ = val ; break ; } case CbcGenParam::VERBOSE: { ctlBlk->verbose_ = val ; break ; } default: { std::cerr << "pushCbcGenInt: no equivalent CbcGenCtlBlk field for " << "parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } return (retval) ; } /* Function to push a keyword-valued parameter. This is the catch-all function for keyword parameters that don't belong to any other useful grouping. */ int pushCbcGenKwdParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; std::string str = genParam->kwdVal() ; CbcGenParam::CbcGenParamCode code = genParam->paramCode() ; int retval = 0 ; /* Figure out what we're doing and set the relevant field. */ switch (code) { case CbcGenParam::PREPROCESS: { if (str == "off") { ctlBlk->setIPPAction(CbcGenCtlBlk::IPPOff) ; } else if (str == "on") { ctlBlk->setIPPAction(CbcGenCtlBlk::IPPOn) ; } else if (str == "save") { ctlBlk->setIPPAction(CbcGenCtlBlk::IPPSave) ; } else if (str == "equal") { ctlBlk->setIPPAction(CbcGenCtlBlk::IPPEqual) ; } else if (str == "sos") { ctlBlk->setIPPAction(CbcGenCtlBlk::IPPSOS) ; } else if (str == "trysos") { ctlBlk->setIPPAction(CbcGenCtlBlk::IPPTrySOS) ; } else if (str == "equalall") { ctlBlk->setIPPAction(CbcGenCtlBlk::IPPEqualAll) ; } else if (str == "strategy") { ctlBlk->setIPPAction(CbcGenCtlBlk::IPPStrategy) ; } else { std::cerr << "pushCbcGenKwdParam(PREPROCESS): unrecognised keyword `" << str << "'." << std::endl ; retval = -1 ; } break ; } case CbcGenParam::COSTSTRATEGY: { if (str == "off") { ctlBlk->priorityAction_ = CbcGenCtlBlk::BPOff ; } else if (str == "priorities") { ctlBlk->priorityAction_ = CbcGenCtlBlk::BPCost ; } if (str == "columnOrder") { ctlBlk->priorityAction_ = CbcGenCtlBlk::BPOrder ; } else { std::cerr << "pushCbcGenKwdParam(COSTSTRATEGY): unrecognised keyword `" << str << "'." << std::endl ; retval = -1 ; } break ; } case CbcGenParam::INTPRINT: { if (str == "normal") { ctlBlk->printMode_ = 0 ; } else if (str == "integer") { ctlBlk->printMode_ = 1 ; } else if (str == "special") { ctlBlk->printMode_ = 2 ; } else if (str == "rows") { ctlBlk->printMode_ = 3 ; } else if (str == "all") { ctlBlk->printMode_ = 4 ; } else { std::cerr << "pushCbcGenKwdParam(INTPRINT): unrecognised keyword `" << str << "'." << std::endl ; retval = -1 ; } break ; } default: { std::cerr << "pushCbcGenKwdParam: unrecognised parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } return (retval) ; } /* Function to push a string-valued parameter */ int pushCbcGenStrParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; std::string str = genParam->strVal() ; CbcGenParam::CbcGenParamCode code = genParam->paramCode() ; int retval = 0 ; /* Figure out what we're doing and set the relevant field. */ switch (code) { case CbcGenParam::DIRECTORY: { char dirSep = CoinFindDirSeparator() ; if (str[str.length()-1] != dirSep) { str += dirSep ; } ctlBlk->dfltDirectory_ = str ; break ; } default: { std::cerr << "pushCbcGenStr: no equivalent CbcGenCtlBlk field for " << "parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } return (retval) ; } /* The various parameters to control cut generators can be grouped, as they all use the same set of keywords. */ int pushCbcGenCutParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; std::string str = genParam->kwdVal() ; CbcGenParam::CbcGenParamCode code = genParam->paramCode() ; /* Setup to return nonfatal/fatal error (1/-1) by default, so that all we need to do is correct to 0 (no error) if we're successful. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* First translate the keyword into the correct CGControl enum value. */ CbcGenCtlBlk::CGControl action ; if (str == "off") { action = CbcGenCtlBlk::CGOff ; } else if (str == "on") { action = CbcGenCtlBlk::CGOn ; } else if (str == "root") { action = CbcGenCtlBlk::CGRoot ; } else if (str == "ifmove") { action = CbcGenCtlBlk::CGIfMove ; } else if (str == "forceOn") { action = CbcGenCtlBlk::CGForceOn ; } else if (str == "forceOnBut") { action = CbcGenCtlBlk::CGForceBut ; } else { std::cerr << "pushCbcGenCutParam: unrecognised keyword `" << str << "'." << std::endl ; return (retval) ; } /* Validate the parameter code and set a variable to separate cuts from heuristics. */ bool isCut = false ; bool isHeuristic = false ; switch (code) { case CbcGenParam::CLIQUECUTS: case CbcGenParam::FLOWCUTS: case CbcGenParam::GOMORYCUTS: case CbcGenParam::KNAPSACKCUTS: case CbcGenParam::MIXEDCUTS: case CbcGenParam::PROBINGCUTS: case CbcGenParam::REDSPLITCUTS: case CbcGenParam::TWOMIRCUTS: case CbcGenParam::CUTSTRATEGY: { isCut = true ; break ; } case CbcGenParam::COMBINE: case CbcGenParam::FPUMP: case CbcGenParam::ROUNDING: case CbcGenParam::LOCALTREE: case CbcGenParam::HEURISTICSTRATEGY: { isHeuristic = true ; break ; } default: { std::cerr << "pushCbcGenCutParam: unrecognised parameter code `" << code << "'." << std::endl ; return (retval) ; } } /* See if the action is valid for the specified type. Heuristics are on or off; cuts can be any of the other codes. Only probing can use forceOnBut. */ if (isHeuristic) { if (!(action == CbcGenCtlBlk::CGOff || action == CbcGenCtlBlk::CGOn)) { std::cerr << "pushCbcGenCutParam: only on or off is valid for a heuristic." << std::endl ; return (retval) ; } } else if (isCut) { if (action == CbcGenCtlBlk::CGForceBut && code != CbcGenParam::PROBINGCUTS) { std::cerr << "pushCbcGenCutParam: forceOnBut is valid only for probing." << std::endl ; return (retval) ; } } /* We've done the basic checks; go ahead and set the relevant field in the control block. We shouldn't need the default case, but some compilers will complain if it's missing. */ switch (code) { case CbcGenParam::CLIQUECUTS: { ctlBlk->setCliqueAction(action) ; break ; } case CbcGenParam::FLOWCUTS: { ctlBlk->setFlowAction(action) ; break ; } case CbcGenParam::GOMORYCUTS: { ctlBlk->setGomoryAction(action) ; break ; } case CbcGenParam::KNAPSACKCUTS: { ctlBlk->setKnapsackAction(action) ; break ; } case CbcGenParam::MIXEDCUTS: { ctlBlk->setMirAction(action) ; break ; } case CbcGenParam::PROBINGCUTS: { ctlBlk->setProbingAction(action) ; break ; } case CbcGenParam::REDSPLITCUTS: { ctlBlk->setRedSplitAction(action) ; break ; } case CbcGenParam::TWOMIRCUTS: { ctlBlk->setTwomirAction(action) ; break ; } case CbcGenParam::CUTSTRATEGY: { ctlBlk->setCliqueAction(action) ; ctlBlk->setFlowAction(action) ; ctlBlk->setGomoryAction(action) ; ctlBlk->setKnapsackAction(action) ; ctlBlk->setMirAction(action) ; ctlBlk->setProbingAction(action) ; ctlBlk->setRedSplitAction(action) ; ctlBlk->setTwomirAction(action) ; break ; } case CbcGenParam::COMBINE: { ctlBlk->setCombineAction(action) ; break ; } case CbcGenParam::FPUMP: { ctlBlk->setFPumpAction(action) ; break ; } case CbcGenParam::GREEDY: { ctlBlk->setGreedyCoverAction(action) ; ctlBlk->setGreedyEqualityAction(action) ; break ; } case CbcGenParam::LOCALTREE: { ctlBlk->setTreeLocalAction(action) ; break ; } case CbcGenParam::ROUNDING: { ctlBlk->setRoundingAction(action) ; break ; } case CbcGenParam::HEURISTICSTRATEGY: { ctlBlk->setCombineAction(action) ; ctlBlk->setFPumpAction(action) ; ctlBlk->setGreedyCoverAction(action) ; ctlBlk->setRoundingAction(action) ; ctlBlk->setTreeLocalAction(action) ; break ; } default: { std::cerr << "pushCbcGenCutParam: internal confusion!" << std::endl ; return (-1) ; } } return (0) ; } /* This routine imports a new constraint system into the solver. */ int doImportParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; /* Setup to return nonfatal/fatal error (1/-1) by default, so that all we need to do is correct to 0 (no error) if we're successful. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* Figure out where we're going to acquire this new model. As special cases, `$' says `use the previous input source' and `-' says `use stdin'. */ std::string field = genParam->strVal() ; std::string fileName ; if (field == "$") { fileName = ctlBlk->lastMpsIn_ ; field = fileName ; } else if (field == "-") { fileName = "stdin" ; field = fileName ; } else { fileName = field ; } /* See if we can open a file. fileCoinReadable understands a fair bit about platforms and compressed files and will try variations of the file name (see the doxygen doc'n for details). The file name returned in field wil be the one that actually worked. */ bool canOpen = fileCoinReadable(fileName, ctlBlk->dfltDirectory_) ; if (canOpen == false) { std::cout << "Unable to open file `" << fileName << "', original name '" << genParam->strVal() << "'." << std::endl ; return (retval) ; } /* We can find the file. Record the name. This requires a little finesse: what we want is the base file name (and extension(s), if present) but not the prefix, unless it's an absolute path. */ if (!fileAbsPath(fileName)) { std::string::size_type pos = fileName.rfind(field) ; ctlBlk->lastMpsIn_ = fileName.substr(pos) ; } else { ctlBlk->lastMpsIn_ = fileName ; } /* Try to read the file. Standard OSI doesn't support the Clp extensions for keepImportNames and allowImportErrors. It should at least support keepImportNames. Status will be zero for a successful read. */ OsiSolverInterface *lpSolver = ctlBlk->model_->solver() ; int status = lpSolver->readMps(fileName.c_str(), "") ; if (status) { std::cout << "There were " << status << " errors on input." << std::endl ; return (retval) ; } /* We have a model! Return success. */ ctlBlk->goodModel_ = true ; return (0) ; } /* This routine imports a debug file into the solver, or arranges for its creation. Import works in the standard way, using the file name provided with the command. As special cases, if the file name is `create' or `createAfterPre', the action here sets up to cause a debug file containing the solution to be dumped after branch-and-cut is completed. `createAfterPre' will dump the solution before undoing the presolve transforms. `create' will dump the solution after integer presolve is backed out. */ int doDebugParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; /* Setup to return nonfatal/fatal error (1/-1) by default, so that all we need to do is correct to 0 (no error) if we're successful. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* If the file name is `create' or `createAfterPre', we're just setting up to make a debug file the next time we do branch-and-cut. */ std::string field = genParam->strVal() ; if (field == "create" || field == "createAfterPre") { ctlBlk->debugCreate_ = field ; return (0) ; } /* Figure out where we're going to acquire the debug file. As special cases, `$' says `use the previous input source' and `-' says `use stdin'. */ std::string fileName ; if (field == "$") { fileName = ctlBlk->debugFile_ ; field = fileName ; } else if (field == "-") { fileName = "stdin" ; field = fileName ; } else { fileName = field ; } /* See if we can open a file. fileCoinReadable understands a fair bit about platforms and compressed files and will try variations of the file name (see the doxygen doc'n for details). The file name returned in field wil be the one that actually worked. No default prefix --- a debug file is assumed to always be in the current directory. */ bool canOpen = fileCoinReadable(fileName, ctlBlk->dfltDirectory_) ; if (canOpen == false) { std::cout << "Unable to open file `" << fileName << "', original name '" << genParam->strVal() << "'." << std::endl ; return (retval) ; } /* We can find the file. Record the name. This requires a little finesse: what we want is the base file name (and extension(s), if present) but not the prefix, unless it's an absolute path. */ if (!fileAbsPath(fileName)) { std::string::size_type pos = fileName.rfind(field) ; ctlBlk->lastMpsIn_ = fileName.substr(pos) ; } else { ctlBlk->lastMpsIn_ = fileName ; } /* Load the primal variable values into the debug solution vector. */ int intUnused, numCols ; double dblUnused ; double *primals ; bool readOK = readSolution(fileName, intUnused, numCols, dblUnused, 0, 0, &primals, 0) ; if (readOK) { if (ctlBlk->debugSol_.values_) { delete[] ctlBlk->debugSol_.values_ ; } ctlBlk->debugSol_.numCols_ = numCols ; ctlBlk->debugSol_.values_ = primals ; retval = 0 ; } else { if (primals) { delete[] primals ; } } return (retval) ; } /* Utility routine to save the current solution to a file. No formatting, and not intended to be portable in any way, shape, or form. */ void saveSolution (const OsiSolverInterface *osi, std::string fileName) { FILE *fp = fopen(fileName.c_str(), "wb") ; if (fp) { int numberRows = osi->getNumRows() ; int numberColumns = osi->getNumCols() ; double objectiveValue = osi->getObjValue() ; fwrite(&numberRows, sizeof(int), 1, fp) ; fwrite(&numberColumns, sizeof(int), 1, fp) ; fwrite(&objectiveValue, sizeof(double), 1, fp) ; const double *primalRowSolution = osi->getRowActivity() ; const double *dualRowSolution = osi->getRowPrice() ; const double *primalColumnSolution = osi->getColSolution() ; const double *dualColumnSolution = osi->getReducedCost() ; fwrite(primalRowSolution, sizeof(double), numberRows, fp) ; fwrite(dualRowSolution, sizeof(double), numberRows, fp) ; fwrite(primalColumnSolution, sizeof(double), numberColumns, fp) ; fwrite(dualColumnSolution, sizeof(double), numberColumns, fp) ; fclose(fp) ; } else { std::cout << "saveSolution: Unable to open file `" << fileName << "'." << std::endl ; } return ; } /* Utility routine to read in a solution dump created by saveSolution. Generally we don't need all the info in this file, so the routine accepts a bunch of reference/pointer paramaters and fills in any that are non-null. It's the client's responsibility to dispose of space allocated for solution vectors. The parameters fileName, numRows, numCols, and objVal are mandatory. The rest can be null. */ bool readSolution (std::string fileName, int &numRows, int &numCols, double &objVal, double **rowActivity, double **dualVars, double **primalVars, double **reducedCosts) { FILE *fp = fopen(fileName.c_str(), "rb") ; bool retval = true ; numRows = -1 ; numCols = -1 ; objVal = 0 ; *rowActivity = 0 ; *dualVars = 0 ; *primalVars = 0 ; *reducedCosts = 0 ; if (fp) { fread(&numRows, sizeof(int), 1, fp) ; fread(&numCols, sizeof(int), 1, fp) ; fread(&objVal, sizeof(double), 1, fp) ; if (rowActivity != NULL) { *rowActivity = new double [numRows] ; fread(*rowActivity, sizeof(double), numRows, fp) ; } else { fseek(fp, numRows*sizeof(double), SEEK_CUR) ; } if (dualVars != NULL) { *dualVars = new double [numRows] ; fread(*dualVars, sizeof(double), numRows, fp) ; } else { fseek(fp, numRows*sizeof(double), SEEK_CUR) ; } if (primalVars != NULL) { *primalVars = new double [numCols] ; fread(*primalVars, sizeof(double), numCols, fp) ; } else { fseek(fp, numCols*sizeof(double), SEEK_CUR) ; } if (reducedCosts != NULL) { *reducedCosts = new double [numCols] ; fread(*reducedCosts, sizeof(double), numCols, fp) ; } else { fseek(fp, numCols*sizeof(double), SEEK_CUR) ; } fclose(fp) ; } else { std::cout << "readSolution: Unable to open file `" << fileName << "'." << std::endl ; retval = false ; } return (retval) ; } } // end namespace CbcGenParamUtils CoinMP-1.8.3/Cbc/src/CbcSimpleIntegerDynamicPseudoCost.cpp0000644000175000017500000020310512172722151021774 0ustar renerene// $Id: CbcSimpleIntegerDynamicPseudoCost.cpp 1943 2013-07-21 09:05:45Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/17/2009 - carved out of CbcBranchDynamic #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG //#define TRACE_ONE 19 #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchDynamic.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" #include "CbcSimpleIntegerDynamicPseudoCost.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif #ifdef COIN_DEVELOP typedef struct { double sumUp_; double upEst_; // or change in obj in update double sumDown_; double downEst_; // or movement in value in update int sequence_; int numberUp_; int numberUpInf_; int numberDown_; int numberDownInf_; char where_; char status_; } History; History * history = NULL; int numberHistory = 0; int maxHistory = 0; bool getHistoryStatistics_ = true; static void increaseHistory() { if (numberHistory == maxHistory) { maxHistory = 100 + (3 * maxHistory) / 2; History * temp = new History [maxHistory]; memcpy(temp, history, numberHistory*sizeof(History)); delete [] history; history = temp; } } static bool addRecord(History newOne) { //if (!getHistoryStatistics_) return false; bool fromCompare = false; int i; for ( i = numberHistory - 1; i >= 0; i--) { if (newOne.sequence_ != history[i].sequence_) continue; if (newOne.where_ != history[i].where_) continue; if (newOne.numberUp_ != history[i].numberUp_) continue; if (newOne.sumUp_ != history[i].sumUp_) continue; if (newOne.numberUpInf_ != history[i].numberUpInf_) continue; if (newOne.upEst_ != history[i].upEst_) continue; if (newOne.numberDown_ != history[i].numberDown_) continue; if (newOne.sumDown_ != history[i].sumDown_) continue; if (newOne.numberDownInf_ != history[i].numberDownInf_) continue; if (newOne.downEst_ != history[i].downEst_) continue; // If B knock out previous B if (newOne.where_ == 'C') { fromCompare = true; if (newOne.status_ == 'B') { int j; for (j = i - 1; j >= 0; j--) { if (history[j].where_ == 'C') { if (history[j].status_ == 'I') { break; } else if (history[j].status_ == 'B') { history[j].status_ = ' '; break; } } } } break; } } if (i == -1 || fromCompare) { //add increaseHistory(); history[numberHistory++] = newOne; return true; } else { return false; } } #endif /** Default Constructor Equivalent to an unspecified binary variable. */ CbcSimpleIntegerDynamicPseudoCost::CbcSimpleIntegerDynamicPseudoCost () : CbcSimpleInteger(), downDynamicPseudoCost_(1.0e-5), upDynamicPseudoCost_(1.0e-5), upDownSeparator_(-1.0), sumDownCost_(0.0), sumUpCost_(0.0), sumDownChange_(0.0), sumUpChange_(0.0), downShadowPrice_(0.0), upShadowPrice_(0.0), sumDownDecrease_(0.0), sumUpDecrease_(0.0), lastDownCost_(0.0), lastUpCost_(0.0), lastDownDecrease_(0), lastUpDecrease_(0), numberTimesDown_(0), numberTimesUp_(0), numberTimesDownInfeasible_(0), numberTimesUpInfeasible_(0), numberBeforeTrust_(0), numberTimesDownLocalFixed_(0), numberTimesUpLocalFixed_(0), numberTimesDownTotalFixed_(0.0), numberTimesUpTotalFixed_(0.0), numberTimesProbingTotal_(0), method_(0) { } /** Useful constructor Loads dynamic upper & lower bounds for the specified variable. */ CbcSimpleIntegerDynamicPseudoCost::CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int iColumn, double breakEven) : CbcSimpleInteger(model, iColumn, breakEven), upDownSeparator_(-1.0), sumDownCost_(0.0), sumUpCost_(0.0), sumDownChange_(0.0), sumUpChange_(0.0), downShadowPrice_(0.0), upShadowPrice_(0.0), sumDownDecrease_(0.0), sumUpDecrease_(0.0), lastDownCost_(0.0), lastUpCost_(0.0), lastDownDecrease_(0), lastUpDecrease_(0), numberTimesDown_(0), numberTimesUp_(0), numberTimesDownInfeasible_(0), numberTimesUpInfeasible_(0), numberBeforeTrust_(0), numberTimesDownLocalFixed_(0), numberTimesUpLocalFixed_(0), numberTimesDownTotalFixed_(0.0), numberTimesUpTotalFixed_(0.0), numberTimesProbingTotal_(0), method_(0) { const double * cost = model->getObjCoefficients(); double costValue = CoinMax(1.0e-5, fabs(cost[iColumn])); // treat as if will cost what it says up upDynamicPseudoCost_ = costValue; // and balance at breakeven downDynamicPseudoCost_ = ((1.0 - breakEven_) * upDynamicPseudoCost_) / breakEven_; // so initial will have some effect sumUpCost_ = 2.0 * upDynamicPseudoCost_; sumUpChange_ = 2.0; numberTimesUp_ = 2; sumDownCost_ = 2.0 * downDynamicPseudoCost_; sumDownChange_ = 2.0; numberTimesDown_ = 2; #if TYPE2==0 // No sumUpCost_ = 0.0; sumUpChange_ = 0.0; numberTimesUp_ = 0; sumDownCost_ = 0.0; sumDownChange_ = 0.0; numberTimesDown_ = 0; #else sumUpCost_ = 1.0 * upDynamicPseudoCost_; sumUpChange_ = 1.0; numberTimesUp_ = 1; sumDownCost_ = 1.0 * downDynamicPseudoCost_; sumDownChange_ = 1.0; numberTimesDown_ = 1; #endif } /** Useful constructor Loads dynamic upper & lower bounds for the specified variable. */ CbcSimpleIntegerDynamicPseudoCost::CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int iColumn, double downDynamicPseudoCost, double upDynamicPseudoCost) : CbcSimpleInteger(model, iColumn), upDownSeparator_(-1.0), sumDownCost_(0.0), sumUpCost_(0.0), sumDownChange_(0.0), sumUpChange_(0.0), downShadowPrice_(0.0), upShadowPrice_(0.0), sumDownDecrease_(0.0), sumUpDecrease_(0.0), lastDownCost_(0.0), lastUpCost_(0.0), lastDownDecrease_(0), lastUpDecrease_(0), numberTimesDown_(0), numberTimesUp_(0), numberTimesDownInfeasible_(0), numberTimesUpInfeasible_(0), numberBeforeTrust_(0), numberTimesDownLocalFixed_(0), numberTimesUpLocalFixed_(0), numberTimesDownTotalFixed_(0.0), numberTimesUpTotalFixed_(0.0), numberTimesProbingTotal_(0), method_(0) { downDynamicPseudoCost_ = downDynamicPseudoCost; upDynamicPseudoCost_ = upDynamicPseudoCost; breakEven_ = upDynamicPseudoCost_ / (upDynamicPseudoCost_ + downDynamicPseudoCost_); // so initial will have some effect sumUpCost_ = 2.0 * upDynamicPseudoCost_; sumUpChange_ = 2.0; numberTimesUp_ = 2; sumDownCost_ = 2.0 * downDynamicPseudoCost_; sumDownChange_ = 2.0; numberTimesDown_ = 2; #if TYPE2==0 // No sumUpCost_ = 0.0; sumUpChange_ = 0.0; numberTimesUp_ = 0; sumDownCost_ = 0.0; sumDownChange_ = 0.0; numberTimesDown_ = 0; sumUpCost_ = 1.0e-4 * upDynamicPseudoCost_; sumDownCost_ = 1.0e-4 * downDynamicPseudoCost_; #else sumUpCost_ = 1.0 * upDynamicPseudoCost_; sumUpChange_ = 1.0; numberTimesUp_ = 1; sumDownCost_ = 1.0 * downDynamicPseudoCost_; sumDownChange_ = 1.0; numberTimesDown_ = 1; #endif } /** Useful constructor Loads dynamic upper & lower bounds for the specified variable. */ CbcSimpleIntegerDynamicPseudoCost::CbcSimpleIntegerDynamicPseudoCost (CbcModel * model, int /*dummy*/, int iColumn, double downDynamicPseudoCost, double upDynamicPseudoCost) { CbcSimpleIntegerDynamicPseudoCost(model, iColumn, downDynamicPseudoCost, upDynamicPseudoCost); } // Copy constructor CbcSimpleIntegerDynamicPseudoCost::CbcSimpleIntegerDynamicPseudoCost ( const CbcSimpleIntegerDynamicPseudoCost & rhs) : CbcSimpleInteger(rhs), downDynamicPseudoCost_(rhs.downDynamicPseudoCost_), upDynamicPseudoCost_(rhs.upDynamicPseudoCost_), upDownSeparator_(rhs.upDownSeparator_), sumDownCost_(rhs.sumDownCost_), sumUpCost_(rhs.sumUpCost_), sumDownChange_(rhs.sumDownChange_), sumUpChange_(rhs.sumUpChange_), downShadowPrice_(rhs.downShadowPrice_), upShadowPrice_(rhs.upShadowPrice_), sumDownDecrease_(rhs.sumDownDecrease_), sumUpDecrease_(rhs.sumUpDecrease_), lastDownCost_(rhs.lastDownCost_), lastUpCost_(rhs.lastUpCost_), lastDownDecrease_(rhs.lastDownDecrease_), lastUpDecrease_(rhs.lastUpDecrease_), numberTimesDown_(rhs.numberTimesDown_), numberTimesUp_(rhs.numberTimesUp_), numberTimesDownInfeasible_(rhs.numberTimesDownInfeasible_), numberTimesUpInfeasible_(rhs.numberTimesUpInfeasible_), numberBeforeTrust_(rhs.numberBeforeTrust_), numberTimesDownLocalFixed_(rhs.numberTimesDownLocalFixed_), numberTimesUpLocalFixed_(rhs.numberTimesUpLocalFixed_), numberTimesDownTotalFixed_(rhs.numberTimesDownTotalFixed_), numberTimesUpTotalFixed_(rhs.numberTimesUpTotalFixed_), numberTimesProbingTotal_(rhs.numberTimesProbingTotal_), method_(rhs.method_) { } // Clone CbcObject * CbcSimpleIntegerDynamicPseudoCost::clone() const { return new CbcSimpleIntegerDynamicPseudoCost(*this); } // Assignment operator CbcSimpleIntegerDynamicPseudoCost & CbcSimpleIntegerDynamicPseudoCost::operator=( const CbcSimpleIntegerDynamicPseudoCost & rhs) { if (this != &rhs) { CbcSimpleInteger::operator=(rhs); downDynamicPseudoCost_ = rhs.downDynamicPseudoCost_; upDynamicPseudoCost_ = rhs.upDynamicPseudoCost_; upDownSeparator_ = rhs.upDownSeparator_; sumDownCost_ = rhs.sumDownCost_; sumUpCost_ = rhs.sumUpCost_; sumDownChange_ = rhs.sumDownChange_; sumUpChange_ = rhs.sumUpChange_; downShadowPrice_ = rhs.downShadowPrice_; upShadowPrice_ = rhs.upShadowPrice_; sumDownDecrease_ = rhs.sumDownDecrease_; sumUpDecrease_ = rhs.sumUpDecrease_; lastDownCost_ = rhs.lastDownCost_; lastUpCost_ = rhs.lastUpCost_; lastDownDecrease_ = rhs.lastDownDecrease_; lastUpDecrease_ = rhs.lastUpDecrease_; numberTimesDown_ = rhs.numberTimesDown_; numberTimesUp_ = rhs.numberTimesUp_; numberTimesDownInfeasible_ = rhs.numberTimesDownInfeasible_; numberTimesUpInfeasible_ = rhs.numberTimesUpInfeasible_; numberBeforeTrust_ = rhs.numberBeforeTrust_; numberTimesDownLocalFixed_ = rhs.numberTimesDownLocalFixed_; numberTimesUpLocalFixed_ = rhs.numberTimesUpLocalFixed_; numberTimesDownTotalFixed_ = rhs.numberTimesDownTotalFixed_; numberTimesUpTotalFixed_ = rhs.numberTimesUpTotalFixed_; numberTimesProbingTotal_ = rhs.numberTimesProbingTotal_; method_ = rhs.method_; } return *this; } // Destructor CbcSimpleIntegerDynamicPseudoCost::~CbcSimpleIntegerDynamicPseudoCost () { } // Copy some information i.e. just variable stuff void CbcSimpleIntegerDynamicPseudoCost::copySome(const CbcSimpleIntegerDynamicPseudoCost * otherObject) { downDynamicPseudoCost_ = otherObject->downDynamicPseudoCost_; upDynamicPseudoCost_ = otherObject->upDynamicPseudoCost_; sumDownCost_ = otherObject->sumDownCost_; sumUpCost_ = otherObject->sumUpCost_; sumDownChange_ = otherObject->sumDownChange_; sumUpChange_ = otherObject->sumUpChange_; downShadowPrice_ = otherObject->downShadowPrice_; upShadowPrice_ = otherObject->upShadowPrice_; sumDownDecrease_ = otherObject->sumDownDecrease_; sumUpDecrease_ = otherObject->sumUpDecrease_; lastDownCost_ = otherObject->lastDownCost_; lastUpCost_ = otherObject->lastUpCost_; lastDownDecrease_ = otherObject->lastDownDecrease_; lastUpDecrease_ = otherObject->lastUpDecrease_; numberTimesDown_ = otherObject->numberTimesDown_; numberTimesUp_ = otherObject->numberTimesUp_; numberTimesDownInfeasible_ = otherObject->numberTimesDownInfeasible_; numberTimesUpInfeasible_ = otherObject->numberTimesUpInfeasible_; numberTimesDownLocalFixed_ = otherObject->numberTimesDownLocalFixed_; numberTimesUpLocalFixed_ = otherObject->numberTimesUpLocalFixed_; numberTimesDownTotalFixed_ = otherObject->numberTimesDownTotalFixed_; numberTimesUpTotalFixed_ = otherObject->numberTimesUpTotalFixed_; numberTimesProbingTotal_ = otherObject->numberTimesProbingTotal_; } // Updates stuff like pseudocosts before threads void CbcSimpleIntegerDynamicPseudoCost::updateBefore(const OsiObject * rhs) { #ifndef NDEBUG const CbcSimpleIntegerDynamicPseudoCost * rhsObject = dynamic_cast (rhs) ; assert (rhsObject); #else const CbcSimpleIntegerDynamicPseudoCost * rhsObject = static_cast (rhs) ; #endif copySome(rhsObject); } // Updates stuff like pseudocosts after threads finished void CbcSimpleIntegerDynamicPseudoCost::updateAfter(const OsiObject * rhs, const OsiObject * baseObjectX) { #ifndef NDEBUG const CbcSimpleIntegerDynamicPseudoCost * rhsObject = dynamic_cast (rhs) ; assert (rhsObject); const CbcSimpleIntegerDynamicPseudoCost * baseObject = dynamic_cast (baseObjectX) ; assert (baseObject); #else const CbcSimpleIntegerDynamicPseudoCost * rhsObject = static_cast (rhs) ; const CbcSimpleIntegerDynamicPseudoCost * baseObject = static_cast (baseObjectX) ; #endif // compute current double sumDown = downDynamicPseudoCost_ * numberTimesDown_; sumDown -= baseObject->downDynamicPseudoCost_ * baseObject->numberTimesDown_; sumDown = CoinMax(sumDown, 0.0); sumDown += rhsObject->downDynamicPseudoCost_ * rhsObject->numberTimesDown_; assert (rhsObject->numberTimesDown_ >= baseObject->numberTimesDown_); assert (rhsObject->numberTimesDownInfeasible_ >= baseObject->numberTimesDownInfeasible_); assert( rhsObject->sumDownCost_ >= baseObject->sumDownCost_); double sumUp = upDynamicPseudoCost_ * numberTimesUp_; sumUp -= baseObject->upDynamicPseudoCost_ * baseObject->numberTimesUp_; sumUp = CoinMax(sumUp, 0.0); sumUp += rhsObject->upDynamicPseudoCost_ * rhsObject->numberTimesUp_; assert (rhsObject->numberTimesUp_ >= baseObject->numberTimesUp_); assert (rhsObject->numberTimesUpInfeasible_ >= baseObject->numberTimesUpInfeasible_); assert( rhsObject->sumUpCost_ >= baseObject->sumUpCost_); sumDownCost_ += rhsObject->sumDownCost_ - baseObject->sumDownCost_; sumUpCost_ += rhsObject->sumUpCost_ - baseObject->sumUpCost_; sumDownChange_ += rhsObject->sumDownChange_ - baseObject->sumDownChange_; sumUpChange_ += rhsObject->sumUpChange_ - baseObject->sumUpChange_; downShadowPrice_ = 0.0; upShadowPrice_ = 0.0; sumDownDecrease_ += rhsObject->sumDownDecrease_ - baseObject->sumDownDecrease_; sumUpDecrease_ += rhsObject->sumUpDecrease_ - baseObject->sumUpDecrease_; lastDownCost_ += rhsObject->lastDownCost_ - baseObject->lastDownCost_; lastUpCost_ += rhsObject->lastUpCost_ - baseObject->lastUpCost_; lastDownDecrease_ += rhsObject->lastDownDecrease_ - baseObject->lastDownDecrease_; lastUpDecrease_ += rhsObject->lastUpDecrease_ - baseObject->lastUpDecrease_; numberTimesDown_ += rhsObject->numberTimesDown_ - baseObject->numberTimesDown_; numberTimesUp_ += rhsObject->numberTimesUp_ - baseObject->numberTimesUp_; numberTimesDownInfeasible_ += rhsObject->numberTimesDownInfeasible_ - baseObject->numberTimesDownInfeasible_; numberTimesUpInfeasible_ += rhsObject->numberTimesUpInfeasible_ - baseObject->numberTimesUpInfeasible_; numberTimesDownLocalFixed_ += rhsObject->numberTimesDownLocalFixed_ - baseObject->numberTimesDownLocalFixed_; numberTimesUpLocalFixed_ += rhsObject->numberTimesUpLocalFixed_ - baseObject->numberTimesUpLocalFixed_; numberTimesDownTotalFixed_ += rhsObject->numberTimesDownTotalFixed_ - baseObject->numberTimesDownTotalFixed_; numberTimesUpTotalFixed_ += rhsObject->numberTimesUpTotalFixed_ - baseObject->numberTimesUpTotalFixed_; numberTimesProbingTotal_ += rhsObject->numberTimesProbingTotal_ - baseObject->numberTimesProbingTotal_; if (numberTimesDown_ > 0) { setDownDynamicPseudoCost(sumDown / static_cast (numberTimesDown_)); } if (numberTimesUp_ > 0) { setUpDynamicPseudoCost(sumUp / static_cast (numberTimesUp_)); } //printf("XX %d down %d %d %g up %d %d %g\n",columnNumber_,numberTimesDown_,numberTimesDownInfeasible_,downDynamicPseudoCost_, // numberTimesUp_,numberTimesUpInfeasible_,upDynamicPseudoCost_); assert (downDynamicPseudoCost_ > 1.0e-40 && upDynamicPseudoCost_ > 1.0e-40); } // Same - returns true if contents match(ish) bool CbcSimpleIntegerDynamicPseudoCost::same(const CbcSimpleIntegerDynamicPseudoCost * otherObject) const { bool okay = true; if (downDynamicPseudoCost_ != otherObject->downDynamicPseudoCost_) okay = false; if (upDynamicPseudoCost_ != otherObject->upDynamicPseudoCost_) okay = false; if (sumDownCost_ != otherObject->sumDownCost_) okay = false; if (sumUpCost_ != otherObject->sumUpCost_) okay = false; if (sumDownChange_ != otherObject->sumDownChange_) okay = false; if (sumUpChange_ != otherObject->sumUpChange_) okay = false; if (downShadowPrice_ != otherObject->downShadowPrice_) okay = false; if (upShadowPrice_ != otherObject->upShadowPrice_) okay = false; if (sumDownDecrease_ != otherObject->sumDownDecrease_) okay = false; if (sumUpDecrease_ != otherObject->sumUpDecrease_) okay = false; if (lastDownCost_ != otherObject->lastDownCost_) okay = false; if (lastUpCost_ != otherObject->lastUpCost_) okay = false; if (lastDownDecrease_ != otherObject->lastDownDecrease_) okay = false; if (lastUpDecrease_ != otherObject->lastUpDecrease_) okay = false; if (numberTimesDown_ != otherObject->numberTimesDown_) okay = false; if (numberTimesUp_ != otherObject->numberTimesUp_) okay = false; if (numberTimesDownInfeasible_ != otherObject->numberTimesDownInfeasible_) okay = false; if (numberTimesUpInfeasible_ != otherObject->numberTimesUpInfeasible_) okay = false; if (numberTimesDownLocalFixed_ != otherObject->numberTimesDownLocalFixed_) okay = false; if (numberTimesUpLocalFixed_ != otherObject->numberTimesUpLocalFixed_) okay = false; if (numberTimesDownTotalFixed_ != otherObject->numberTimesDownTotalFixed_) okay = false; if (numberTimesUpTotalFixed_ != otherObject->numberTimesUpTotalFixed_) okay = false; if (numberTimesProbingTotal_ != otherObject->numberTimesProbingTotal_) okay = false; return okay; } /* Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ OsiSolverBranch * CbcSimpleIntegerDynamicPseudoCost::solverBranch() const { OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); assert (upper[columnNumber_] > lower[columnNumber_]); #ifndef NDEBUG double nearest = floor(value + 0.5); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); assert (fabs(value - nearest) > integerTolerance); #endif OsiSolverBranch * branch = new OsiSolverBranch(); branch->addBranch(columnNumber_, value); return branch; } //#define FUNNY_BRANCHING double CbcSimpleIntegerDynamicPseudoCost::infeasibility(const OsiBranchingInformation * info, int &preferredWay) const { assert (downDynamicPseudoCost_ > 1.0e-40 && upDynamicPseudoCost_ > 1.0e-40); const double * solution = model_->testSolution(); const double * lower = model_->getCbcColLower(); const double * upper = model_->getCbcColUpper(); #ifdef FUNNY_BRANCHING2 const double * dj = model_->getCbcReducedCost(); double djValue = dj[columnNumber_]; lastDownDecrease_++; if (djValue > 1.0e-6) { // wants to go down if (true || lower[columnNumber_] > originalLower_) { // Lower bound active lastUpDecrease_++; } } else if (djValue < -1.0e-6) { // wants to go up if (true || upper[columnNumber_] < originalUpper_) { // Upper bound active lastUpDecrease_++; } } #endif if (upper[columnNumber_] == lower[columnNumber_]) { // fixed preferredWay = 1; return 0.0; } assert (breakEven_ > 0.0 && breakEven_ < 1.0); /* Find nearest integer, and integers above and below current value. Given that we've already forced value within bounds, if (current value)+(integer tolerance) > (upper bound) shouldn't we declare this variable integer? */ double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); /*printf("%d %g %g %g %g\n",columnNumber_,value,lower[columnNumber_], solution[columnNumber_],upper[columnNumber_]);*/ double nearest = floor(value + 0.5); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double below = floor(value + integerTolerance); double above = below + 1.0; if (above > upper[columnNumber_]) { above = below; below = above - 1; } #if INFEAS==1 /* Why do we inflate the distance to the cutoff by a factor of 10 for values that could be considered reachable? Why do we add 100 for values larger than 1e20? */ double distanceToCutoff = 0.0; double objectiveValue = model_->getCurrentMinimizationObjValue(); distanceToCutoff = model_->getCutoff() - objectiveValue; if (distanceToCutoff < 1.0e20) distanceToCutoff *= 10.0; else distanceToCutoff = 1.0e2 + fabs(objectiveValue); distanceToCutoff = CoinMax(distanceToCutoff, 1.0e-12 * (1.0 + fabs(objectiveValue))); #endif double sum; #ifndef INFEAS_MULTIPLIER #define INFEAS_MULTIPLIER 1.0 #endif double number; double downCost = CoinMax(value - below, 0.0); #if TYPE2==0 sum = sumDownCost_; number = numberTimesDown_; #if INFEAS==1 sum += INFEAS_MULTIPLIER*numberTimesDownInfeasible_ * CoinMax(distanceToCutoff / (downCost + 1.0e-12), sumDownCost_); #endif #elif TYPE2==1 sum = sumDownCost_; number = sumDownChange_; #if INFEAS==1 sum += INFEAS_MULTIPLIER*numberTimesDownInfeasible_ * CoinMax(distanceToCutoff / (downCost + 1.0e-12), sumDownCost_); #endif #elif TYPE2==2 abort(); #if INFEAS==1 sum += INFEAS_MULTIPLIER*numberTimesDownInfeasible_ * (distanceToCutoff / (downCost + 1.0e-12)); #endif #endif #if MOD_SHADOW>0 if (!downShadowPrice_) { if (number > 0.0) downCost *= sum / number; else downCost *= downDynamicPseudoCost_; } else if (downShadowPrice_ > 0.0) { downCost *= downShadowPrice_; } else { downCost *= (downDynamicPseudoCost_ - downShadowPrice_); } #else if (downShadowPrice_ <= 0.0) { if (number > 0.0) downCost *= sum / number; else downCost *= downDynamicPseudoCost_; } else { downCost *= downShadowPrice_; } #endif double upCost = CoinMax((above - value), 0.0); #if TYPE2==0 sum = sumUpCost_; number = numberTimesUp_; #if INFEAS==1 sum += INFEAS_MULTIPLIER*numberTimesUpInfeasible_ * CoinMax(distanceToCutoff / (upCost + 1.0e-12), sumUpCost_); #endif #elif TYPE2==1 sum = sumUpCost_; number = sumUpChange_; #if INFEAS==1 sum += INFEAS_MULTIPLIER*numberTimesUpInfeasible_ * CoinMax(distanceToCutoff / (upCost + 1.0e-12), sumUpCost_); #endif #elif TYPE2==1 abort(); #if INFEAS==1 sum += INFEAS_MULTIPLIER*numberTimesUpInfeasible_ * (distanceToCutoff / (upCost + 1.0e-12)); #endif #endif #if MOD_SHADOW>0 if (!upShadowPrice_) { if (number > 0.0) upCost *= sum / number; else upCost *= upDynamicPseudoCost_; } else if (upShadowPrice_ > 0.0) { upCost *= upShadowPrice_; } else { upCost *= (upDynamicPseudoCost_ - upShadowPrice_); } #else if (upShadowPrice_ <= 0.0) { if (number > 0.0) upCost *= sum / number; else upCost *= upDynamicPseudoCost_; } else { upCost *= upShadowPrice_; } #endif if (downCost >= upCost) preferredWay = 1; else preferredWay = -1; // See if up down choice set if (upDownSeparator_ > 0.0) { preferredWay = (value - below >= upDownSeparator_) ? 1 : -1; } #ifdef FUNNY_BRANCHING2 if (fabs(value - nearest) > integerTolerance) { double ratio = (100.0 + lastUpDecrease_) / (100.0 + lastDownDecrease_); downCost *= ratio; upCost *= ratio; if ((lastUpDecrease_ % 100) == -1) printf("col %d total %d djtimes %d\n", columnNumber_, lastDownDecrease_, lastUpDecrease_); } #endif if (preferredWay_) preferredWay = preferredWay_; if (info->hotstartSolution_) { double targetValue = info->hotstartSolution_[columnNumber_]; if (value > targetValue) preferredWay = -1; else preferredWay = 1; } if (fabs(value - nearest) <= integerTolerance) { if (priority_ != -999) return 0.0; else return 1.0e-13; } else { int stateOfSearch = model_->stateOfSearch() % 10; double returnValue = 0.0; double minValue = CoinMin(downCost, upCost); double maxValue = CoinMax(downCost, upCost); #ifdef COIN_DEVELOP char where; #endif // was <= 10 //if (stateOfSearch<=1||model_->currentNode()->depth()<=-10 /* was ||maxValue>0.2*distanceToCutoff*/) { if (stateOfSearch <= 2) { // no branching solution #ifdef COIN_DEVELOP where = 'i'; #endif returnValue = WEIGHT_BEFORE * minValue + (1.0 - WEIGHT_BEFORE) * maxValue; if (0) { double sum; int number; double downCost2 = CoinMax(value - below, 0.0); sum = sumDownCost_; number = numberTimesDown_; if (number > 0) downCost2 *= sum / static_cast (number); else downCost2 *= downDynamicPseudoCost_; double upCost2 = CoinMax((above - value), 0.0); sum = sumUpCost_; number = numberTimesUp_; if (number > 0) upCost2 *= sum / static_cast (number); else upCost2 *= upDynamicPseudoCost_; double minValue2 = CoinMin(downCost2, upCost2); double maxValue2 = CoinMax(downCost2, upCost2); printf("%d value %g downC %g upC %g minV %g maxV %g downC2 %g upC2 %g minV2 %g maxV2 %g\n", columnNumber_, value, downCost, upCost, minValue, maxValue, downCost2, upCost2, minValue2, maxValue2); } } else { // some solution #ifdef COIN_DEVELOP where = 'I'; #endif #ifndef WEIGHT_PRODUCT returnValue = WEIGHT_AFTER * minValue + (1.0 - WEIGHT_AFTER) * maxValue; #else double minProductWeight = model_->getDblParam(CbcModel::CbcSmallChange); returnValue = CoinMax(minValue, minProductWeight) * CoinMax(maxValue, minProductWeight); //returnValue += minProductWeight*minValue; #endif } if (numberTimesUp_ < numberBeforeTrust_ || numberTimesDown_ < numberBeforeTrust_) { //if (returnValue<1.0e10) //returnValue += 1.0e12; //else returnValue *= 1.0e3; if (!numberTimesUp_ && !numberTimesDown_) returnValue *= 1.0e10; } //if (fabs(value-0.5)<1.0e-5) { //returnValue = 3.0*returnValue + 0.2; //} else if (value>0.9) { //returnValue = 2.0*returnValue + 0.1; //} if (method_ == 1) { // probing // average double up = 1.0e-15; double down = 1.0e-15; if (numberTimesProbingTotal_) { up += numberTimesUpTotalFixed_ / static_cast (numberTimesProbingTotal_); down += numberTimesDownTotalFixed_ / static_cast (numberTimesProbingTotal_); } returnValue = 1 + 10.0 * CoinMin(numberTimesDownLocalFixed_, numberTimesUpLocalFixed_) + CoinMin(down, up); returnValue *= 1.0e-3; } #ifdef COIN_DEVELOP History hist; hist.where_ = where; hist.status_ = ' '; hist.sequence_ = columnNumber_; hist.numberUp_ = numberTimesUp_; hist.numberUpInf_ = numberTimesUpInfeasible_; hist.sumUp_ = sumUpCost_; hist.upEst_ = upCost; hist.numberDown_ = numberTimesDown_; hist.numberDownInf_ = numberTimesDownInfeasible_; hist.sumDown_ = sumDownCost_; hist.downEst_ = downCost; if (stateOfSearch) addRecord(hist); #endif return CoinMax(returnValue, 1.0e-15); } } // Creates a branching object CbcBranchingObject * CbcSimpleIntegerDynamicPseudoCost::createCbcBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * info, int way) { double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); assert (info->upper_[columnNumber_] > info->lower_[columnNumber_]); if (!info->hotstartSolution_ && priority_ != -999) { #ifndef NDEBUG #ifndef SWITCH_VARIABLES double nearest = floor(value + 0.5); assert (fabs(value - nearest) > info->integerTolerance_); #endif #endif } else if (info->hotstartSolution_) { double targetValue = info->hotstartSolution_[columnNumber_]; if (way > 0) value = targetValue - 0.1; else value = targetValue + 0.1; } else { if (value <= info->lower_[columnNumber_]) value += 0.1; else if (value >= info->upper_[columnNumber_]) value -= 0.1; } assert (value >= info->lower_[columnNumber_] && value <= info->upper_[columnNumber_]); CbcDynamicPseudoCostBranchingObject * newObject = new CbcDynamicPseudoCostBranchingObject(model_, columnNumber_, way, value, this); double up = upDynamicPseudoCost_ * (ceil(value) - value); double down = downDynamicPseudoCost_ * (value - floor(value)); double changeInGuessed = up - down; if (way > 0) changeInGuessed = - changeInGuessed; changeInGuessed = CoinMax(0.0, changeInGuessed); //if (way>0) //changeInGuessed += 1.0e8; // bias to stay up newObject->setChangeInGuessed(changeInGuessed); newObject->setOriginalObject(this); return newObject; } // Return "up" estimate double CbcSimpleIntegerDynamicPseudoCost::upEstimate() const { const double * solution = model_->testSolution(); const double * lower = model_->getCbcColLower(); const double * upper = model_->getCbcColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); if (upper[columnNumber_] == lower[columnNumber_]) { // fixed return 0.0; } double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double below = floor(value + integerTolerance); double above = below + 1.0; if (above > upper[columnNumber_]) { above = below; below = above - 1; } double upCost = CoinMax((above - value) * upDynamicPseudoCost_, 0.0); return upCost; } // Return "down" estimate double CbcSimpleIntegerDynamicPseudoCost::downEstimate() const { const double * solution = model_->testSolution(); const double * lower = model_->getCbcColLower(); const double * upper = model_->getCbcColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); if (upper[columnNumber_] == lower[columnNumber_]) { // fixed return 0.0; } double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double below = floor(value + integerTolerance); double above = below + 1.0; if (above > upper[columnNumber_]) { above = below; below = above - 1; } double downCost = CoinMax((value - below) * downDynamicPseudoCost_, 0.0); return downCost; } // Set down pseudo cost void CbcSimpleIntegerDynamicPseudoCost::setDownDynamicPseudoCost(double value) { #ifdef TRACE_ONE double oldDown = sumDownCost_; #endif downDynamicPseudoCost_ = value; sumDownCost_ = CoinMax(sumDownCost_, value * numberTimesDown_); #ifdef TRACE_ONE if (columnNumber_ == TRACE_ONE) { double down = downDynamicPseudoCost_ * numberTimesDown_; printf("For %d sumDown %g (%d), inf (%d) - pseudo %g - sumDown was %g -> %g\n", TRACE_ONE, down, numberTimesDown_, numberTimesDownInfeasible_, downDynamicPseudoCost_, oldDown, sumDownCost_); } #endif } // Modify down pseudo cost in a slightly different way void CbcSimpleIntegerDynamicPseudoCost::updateDownDynamicPseudoCost(double value) { sumDownCost_ += value; numberTimesDown_++; downDynamicPseudoCost_ = sumDownCost_ / static_cast(numberTimesDown_); } // Set up pseudo cost void CbcSimpleIntegerDynamicPseudoCost::setUpDynamicPseudoCost(double value) { #ifdef TRACE_ONE double oldUp = sumUpCost_; #endif upDynamicPseudoCost_ = value; sumUpCost_ = CoinMax(sumUpCost_, value * numberTimesUp_); #ifdef TRACE_ONE if (columnNumber_ == TRACE_ONE) { double up = upDynamicPseudoCost_ * numberTimesUp_; printf("For %d sumUp %g (%d), inf (%d) - pseudo %g - sumUp was %g -> %g\n", TRACE_ONE, up, numberTimesUp_, numberTimesUpInfeasible_, upDynamicPseudoCost_, oldUp, sumUpCost_); } #endif } // Modify up pseudo cost in a slightly different way void CbcSimpleIntegerDynamicPseudoCost::updateUpDynamicPseudoCost(double value) { sumUpCost_ += value; numberTimesUp_++; upDynamicPseudoCost_ = sumUpCost_ / static_cast(numberTimesUp_); } /* Pass in information on branch just done and create CbcObjectUpdateData instance. If object does not need data then backward pointer will be NULL. Assumes can get information from solver */ CbcObjectUpdateData CbcSimpleIntegerDynamicPseudoCost::createUpdateInformation(const OsiSolverInterface * solver, const CbcNode * node, const CbcBranchingObject * branchingObject) { double originalValue = node->objectiveValue(); int originalUnsatisfied = node->numberUnsatisfied(); double objectiveValue = solver->getObjValue() * solver->getObjSense(); int unsatisfied = 0; int i; //might be base model - doesn't matter int numberIntegers = model_->numberIntegers();; const double * solution = solver->getColSolution(); //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); double change = CoinMax(0.0, objectiveValue - originalValue); int iStatus; if (solver->isProvenOptimal()) iStatus = 0; // optimal else if (solver->isIterationLimitReached() && !solver->isDualObjectiveLimitReached()) iStatus = 2; // unknown else iStatus = 1; // infeasible bool feasible = iStatus != 1; if (feasible) { double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); const int * integerVariable = model_->integerVariable(); for (i = 0; i < numberIntegers; i++) { int j = integerVariable[i]; double value = solution[j]; double nearest = floor(value + 0.5); if (fabs(value - nearest) > integerTolerance) unsatisfied++; #ifdef SWITCH_VARIABLES const CbcSwitchingBinary * sObject = dynamic_cast (this); if (sObject) { int state[3],nBadFixed; unsatisfied += sObject->checkAssociatedBounds(solver,solution,0, state,nBadFixed); } #endif } } int way = branchingObject->way(); way = - way; // because after branch so moved on double value = branchingObject->value(); CbcObjectUpdateData newData (this, way, change, iStatus, originalUnsatisfied - unsatisfied, value); newData.originalObjective_ = originalValue; // Solvers know about direction double direction = solver->getObjSense(); solver->getDblParam(OsiDualObjectiveLimit, newData.cutoff_); newData.cutoff_ *= direction; return newData; } // Just update using feasible branches and keep count of infeasible #undef INFEAS // Update object by CbcObjectUpdateData void CbcSimpleIntegerDynamicPseudoCost::updateInformation(const CbcObjectUpdateData & data) { bool feasible = data.status_ != 1; int way = data.way_; double value = data.branchingValue_; double change = data.change_; #ifdef COIN_DEVELOP History hist; hist.where_ = 'U'; // need to tell if hot #endif double movement = 0.0; if (way < 0) { // down movement = value - floor(value); if (feasible) { #ifdef COIN_DEVELOP hist.status_ = 'D'; #endif movement = CoinMax(movement, MINIMUM_MOVEMENT); //printf("(down change %g value down %g ",change,movement); incrementNumberTimesDown(); addToSumDownChange(1.0e-30 + movement); addToSumDownDecrease(data.intDecrease_); #if TYPE2==0 addToSumDownCost(change / (1.0e-30 + movement)); setDownDynamicPseudoCost(sumDownCost() / static_cast( numberTimesDown())); #elif TYPE2==1 addToSumDownCost(change); setDownDynamicPseudoCost(sumDownCost() / sumDownChange()); #elif TYPE2==2 addToSumDownCost(change*TYPERATIO + (1.0 - TYPERATIO)*change / (1.0e-30 + movement)); setDownDynamicPseudoCost(sumDownCost()*(TYPERATIO / sumDownChange() + (1.0 - TYPERATIO) / (double) numberTimesDown())); #endif } else { #ifdef COIN_DEVELOP hist.status_ = 'd'; #endif //printf("(down infeasible value down %g ",change,movement); incrementNumberTimesDown(); incrementNumberTimesDownInfeasible(); #if INFEAS==2 double distanceToCutoff = 0.0; double objectiveValue = model->getCurrentMinimizationObjValue(); distanceToCutoff = model->getCutoff() - originalValue; if (distanceToCutoff < 1.0e20) change = distanceToCutoff * 2.0; else change = downDynamicPseudoCost() * movement * 10.0; change = CoinMax(1.0e-12 * (1.0 + fabs(originalValue)), change); addToSumDownChange(1.0e-30 + movement); addToSumDownDecrease(data.intDecrease_); #if TYPE2==0 addToSumDownCost(change / (1.0e-30 + movement)); setDownDynamicPseudoCost(sumDownCost() / (double) numberTimesDown()); #elif TYPE2==1 addToSumDownCost(change); setDownDynamicPseudoCost(sumDownCost() / sumDownChange()); #elif TYPE2==2 addToSumDownCost(change*TYPERATIO + (1.0 - TYPERATIO)*change / (1.0e-30 + movement)); setDownDynamicPseudoCost(sumDownCost()*(TYPERATIO / sumDownChange() + (1.0 - TYPERATIO) / (double) numberTimesDown())); #endif #endif } #if INFEAS==1 double sum = sumDownCost_; int number = numberTimesDown_; double originalValue = data.originalObjective_; assert (originalValue != COIN_DBL_MAX); double distanceToCutoff = data.cutoff_ - originalValue; if (distanceToCutoff > 1.0e20) distanceToCutoff = 10.0 + fabs(originalValue); sum += INFEAS_MULTIPLIER*numberTimesDownInfeasible_ * CoinMax(distanceToCutoff, 1.0e-12 * (1.0 + fabs(originalValue))); setDownDynamicPseudoCost(sum / static_cast (number)); #endif } else { // up movement = ceil(value) - value; if (feasible) { #ifdef COIN_DEVELOP hist.status_ = 'U'; #endif movement = CoinMax(movement, MINIMUM_MOVEMENT); //printf("(up change %g value down %g ",change,movement); incrementNumberTimesUp(); addToSumUpChange(1.0e-30 + movement); addToSumUpDecrease(data.intDecrease_); #if TYPE2==0 addToSumUpCost(change / (1.0e-30 + movement)); setUpDynamicPseudoCost(sumUpCost() / static_cast (numberTimesUp())); #elif TYPE2==1 addToSumUpCost(change); setUpDynamicPseudoCost(sumUpCost() / sumUpChange()); #elif TYPE2==2 addToSumUpCost(change*TYPERATIO + (1.0 - TYPERATIO)*change / (1.0e-30 + movement)); setUpDynamicPseudoCost(sumUpCost()*(TYPERATIO / sumUpChange() + (1.0 - TYPERATIO) / (double) numberTimesUp())); #endif } else { #ifdef COIN_DEVELOP hist.status_ = 'u'; #endif //printf("(up infeasible value down %g ",change,movement); incrementNumberTimesUp(); incrementNumberTimesUpInfeasible(); #if INFEAS==2 double distanceToCutoff = 0.0; double objectiveValue = model->getCurrentMinimizationObjValue(); distanceToCutoff = model->getCutoff() - originalValue; if (distanceToCutoff < 1.0e20) change = distanceToCutoff * 2.0; else change = upDynamicPseudoCost() * movement * 10.0; change = CoinMax(1.0e-12 * (1.0 + fabs(originalValue)), change); addToSumUpChange(1.0e-30 + movement); addToSumUpDecrease(data.intDecrease_); #if TYPE2==0 addToSumUpCost(change / (1.0e-30 + movement)); setUpDynamicPseudoCost(sumUpCost() / (double) numberTimesUp()); #elif TYPE2==1 addToSumUpCost(change); setUpDynamicPseudoCost(sumUpCost() / sumUpChange()); #elif TYPE2==2 addToSumUpCost(change*TYPERATIO + (1.0 - TYPERATIO)*change / (1.0e-30 + movement)); setUpDynamicPseudoCost(sumUpCost()*(TYPERATIO / sumUpChange() + (1.0 - TYPERATIO) / (double) numberTimesUp())); #endif #endif } #if INFEAS==1 double sum = sumUpCost_; int number = numberTimesUp_; double originalValue = data.originalObjective_; assert (originalValue != COIN_DBL_MAX); double distanceToCutoff = data.cutoff_ - originalValue; if (distanceToCutoff > 1.0e20) distanceToCutoff = 10.0 + fabs(originalValue); sum += INFEAS_MULTIPLIER*numberTimesUpInfeasible_ * CoinMax(distanceToCutoff, 1.0e-12 * (1.0 + fabs(originalValue))); setUpDynamicPseudoCost(sum / static_cast (number)); #endif } if (data.way_ < 0) assert (numberTimesDown_ > 0); else assert (numberTimesUp_ > 0); assert (downDynamicPseudoCost_ >= 0.0 && downDynamicPseudoCost_ < 1.0e100); downDynamicPseudoCost_ = CoinMax(1.0e-10, downDynamicPseudoCost_); assert (upDynamicPseudoCost_ >= 0.0 && upDynamicPseudoCost_ < 1.0e100); upDynamicPseudoCost_ = CoinMax(1.0e-10, upDynamicPseudoCost_); #ifdef COIN_DEVELOP hist.sequence_ = columnNumber_; hist.numberUp_ = numberTimesUp_; hist.numberUpInf_ = numberTimesUpInfeasible_; hist.sumUp_ = sumUpCost_; hist.upEst_ = change; hist.numberDown_ = numberTimesDown_; hist.numberDownInf_ = numberTimesDownInfeasible_; hist.sumDown_ = sumDownCost_; hist.downEst_ = movement; addRecord(hist); #endif //print(1,0.5); assert (downDynamicPseudoCost_ > 1.0e-40 && upDynamicPseudoCost_ > 1.0e-40); #if MOD_SHADOW>1 if (upShadowPrice_ > 0.0 && numberTimesDown_ >= numberBeforeTrust_ && numberTimesUp_ >= numberBeforeTrust_) { // Set negative upShadowPrice_ = -upShadowPrice_; assert (downShadowPrice_ > 0.0); downShadowPrice_ = - downShadowPrice_; } #endif } // Updates stuff like pseudocosts after mini branch and bound void CbcSimpleIntegerDynamicPseudoCost::updateAfterMini(int numberDown, int numberDownInfeasible, double sumDown, int numberUp, int numberUpInfeasible, double sumUp) { numberTimesDown_ = numberDown; numberTimesDownInfeasible_ = numberDownInfeasible; sumDownCost_ = sumDown; numberTimesUp_ = numberUp; numberTimesUpInfeasible_ = numberUpInfeasible; sumUpCost_ = sumUp; if (numberTimesDown_ > 0) { setDownDynamicPseudoCost(sumDownCost_ / static_cast (numberTimesDown_)); assert (downDynamicPseudoCost_ > 0.0 && downDynamicPseudoCost_ < 1.0e50); } if (numberTimesUp_ > 0) { setUpDynamicPseudoCost(sumUpCost_ / static_cast (numberTimesUp_)); assert (upDynamicPseudoCost_ > 0.0 && upDynamicPseudoCost_ < 1.0e50); } assert (downDynamicPseudoCost_ > 1.0e-40 && upDynamicPseudoCost_ > 1.0e-40); } // Pass in probing information void CbcSimpleIntegerDynamicPseudoCost::setProbingInformation(int fixedDown, int fixedUp) { numberTimesProbingTotal_++; numberTimesDownLocalFixed_ = fixedDown; numberTimesDownTotalFixed_ += fixedDown; numberTimesUpLocalFixed_ = fixedUp; numberTimesUpTotalFixed_ += fixedUp; } // Print void CbcSimpleIntegerDynamicPseudoCost::print(int type, double value) const { if (!type) { double meanDown = 0.0; double devDown = 0.0; if (numberTimesDown_) { meanDown = sumDownCost_ / static_cast (numberTimesDown_); devDown = meanDown * meanDown - 2.0 * meanDown * sumDownCost_; if (devDown >= 0.0) devDown = sqrt(devDown); } double meanUp = 0.0; double devUp = 0.0; if (numberTimesUp_) { meanUp = sumUpCost_ / static_cast (numberTimesUp_); devUp = meanUp * meanUp - 2.0 * meanUp * sumUpCost_; if (devUp >= 0.0) devUp = sqrt(devUp); } printf("%d down %d times (%d inf) mean %g (dev %g) up %d times (%d inf) mean %g (dev %g)\n", columnNumber_, numberTimesDown_, numberTimesDownInfeasible_, meanDown, devDown, numberTimesUp_, numberTimesUpInfeasible_, meanUp, devUp); } else { const double * upper = model_->getCbcColUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double below = floor(value + integerTolerance); double above = below + 1.0; if (above > upper[columnNumber_]) { above = below; below = above - 1; } double objectiveValue = model_->getCurrentMinimizationObjValue(); double distanceToCutoff = model_->getCutoff() - objectiveValue; if (distanceToCutoff < 1.0e20) distanceToCutoff *= 10.0; else distanceToCutoff = 1.0e2 + fabs(objectiveValue); distanceToCutoff = CoinMax(distanceToCutoff, 1.0e-12 * (1.0 + fabs(objectiveValue))); double sum; int number; double downCost = CoinMax(value - below, 0.0); double downCost0 = downCost * downDynamicPseudoCost_; sum = sumDownCost(); number = numberTimesDown(); sum += INFEAS_MULTIPLIER*numberTimesDownInfeasible() * (distanceToCutoff / (downCost + 1.0e-12)); if (number > 0) downCost *= sum / static_cast (number); else downCost *= downDynamicPseudoCost_; double upCost = CoinMax((above - value), 0.0); double upCost0 = upCost * upDynamicPseudoCost_; sum = sumUpCost(); number = numberTimesUp(); sum += INFEAS_MULTIPLIER*numberTimesUpInfeasible() * (distanceToCutoff / (upCost + 1.0e-12)); if (number > 0) upCost *= sum / static_cast (number); else upCost *= upDynamicPseudoCost_; printf("%d down %d times %g (est %g) up %d times %g (est %g)\n", columnNumber_, numberTimesDown_, downCost, downCost0, numberTimesUp_, upCost, upCost0); } } //############################################################################## // Default Constructor CbcIntegerPseudoCostBranchingObject::CbcIntegerPseudoCostBranchingObject() : CbcIntegerBranchingObject() { changeInGuessed_ = 1.0e-5; } // Useful constructor CbcIntegerPseudoCostBranchingObject::CbcIntegerPseudoCostBranchingObject (CbcModel * model, int variable, int way , double value) : CbcIntegerBranchingObject(model, variable, way, value) { } // Useful constructor for fixing CbcIntegerPseudoCostBranchingObject::CbcIntegerPseudoCostBranchingObject (CbcModel * model, int variable, int way, double lowerValue, double /*upperValue*/) : CbcIntegerBranchingObject(model, variable, way, lowerValue) { changeInGuessed_ = 1.0e100; } // Copy constructor CbcIntegerPseudoCostBranchingObject::CbcIntegerPseudoCostBranchingObject ( const CbcIntegerPseudoCostBranchingObject & rhs) : CbcIntegerBranchingObject(rhs) { changeInGuessed_ = rhs.changeInGuessed_; } // Assignment operator CbcIntegerPseudoCostBranchingObject & CbcIntegerPseudoCostBranchingObject::operator=( const CbcIntegerPseudoCostBranchingObject & rhs) { if (this != &rhs) { CbcIntegerBranchingObject::operator=(rhs); changeInGuessed_ = rhs.changeInGuessed_; } return *this; } CbcBranchingObject * CbcIntegerPseudoCostBranchingObject::clone() const { return (new CbcIntegerPseudoCostBranchingObject(*this)); } // Destructor CbcIntegerPseudoCostBranchingObject::~CbcIntegerPseudoCostBranchingObject () { } /* Perform a branch by adjusting the bounds of the specified variable. Note that each arm of the branch advances the object to the next arm by advancing the value of way_. Providing new values for the variable's lower and upper bounds for each branching direction gives a little bit of additional flexibility and will be easily extensible to multi-way branching. Returns change in guessed objective on next branch */ double CbcIntegerPseudoCostBranchingObject::branch() { CbcIntegerBranchingObject::branch(); return changeInGuessed_; } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcIntegerPseudoCostBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap) { const CbcIntegerPseudoCostBranchingObject* br = dynamic_cast(brObj); assert(br); double* thisBd = way_ < 0 ? down_ : up_; const double* otherBd = br->way_ < 0 ? br->down_ : br->up_; return CbcCompareRanges(thisBd, otherBd, replaceIfOverlap); } #ifdef SWITCH_VARIABLES /** Default Constructor Equivalent to an unspecified binary variable. */ CbcSwitchingBinary::CbcSwitchingBinary () : CbcSimpleIntegerDynamicPseudoCost(), zeroLowerBound_(NULL), oneLowerBound_(NULL), zeroUpperBound_(NULL), oneUpperBound_(NULL), otherVariable_(NULL), numberOther_(0), type_(0) { } /** Useful constructor */ CbcSwitchingBinary::CbcSwitchingBinary (CbcSimpleIntegerDynamicPseudoCost * oldObject, int nOdd,const int * other, const int * otherRow) : CbcSimpleIntegerDynamicPseudoCost(*oldObject), zeroLowerBound_(NULL), oneLowerBound_(NULL), zeroUpperBound_(NULL), oneUpperBound_(NULL), otherVariable_(NULL), numberOther_(0), type_(0) { if (nOdd) type_=2; const CoinPackedMatrix * rowCopy = model_->solver()->getMatrixByRow(); const int * column = rowCopy->getIndices(); //const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); //const double * rowLower = model_->solver()->getRowLower(); const double * rowUpper = model_->solver()->getRowUpper(); const double * columnLower = model_->solver()->getColLower(); const double * columnUpper = model_->solver()->getColUpper(); const double * element = rowCopy->getElements(); int last = other[0]; int nPair=0; int nInGroup=1; for (int i=1;i<=nOdd;i++) { if (other[i]==last) { nInGroup++; } else { if (nInGroup>2 && model_->logLevel()>2) printf("%d in group for column %d - some redundancy\n", nInGroup,columnNumber_); nPair++; last=other[i]; nInGroup=1; } } zeroLowerBound_ = new double [4*nPair]; oneLowerBound_ = zeroLowerBound_+nPair; zeroUpperBound_ = oneLowerBound_+nPair; oneUpperBound_ = zeroUpperBound_+nPair; otherVariable_ = new int [nPair]; numberOther_ = nPair; if (nPair>1&&model_->logLevel()>2) printf("%d pairs for column %d\n", nPair,columnNumber_); // Now fill last = other[0]; nPair=0; int rows[20]; rows[0]= otherRow[0]; nInGroup=1; for (int i=1;i<=nOdd;i++) { if (other[i]==last) { rows[nInGroup++]=otherRow[i]; } else { double newLowerZero=0.0; double newUpperZero=COIN_DBL_MAX; double newLowerOne=0.0; double newUpperOne=COIN_DBL_MAX; int cColumn=-1; for (int j=0;j0.0) { // binary*abs(bValue) <= continuous*abs(cValue); newLowerOne = -bValue/cValue; } else { // binary*abs(bValue) >= continuous*abs(cValue); newUpperOne = -bValue/cValue; newUpperZero = 0.0; } } zeroLowerBound_[nPair]=newLowerZero; oneLowerBound_[nPair]=newLowerOne; zeroUpperBound_[nPair]=newUpperZero; oneUpperBound_[nPair]=newUpperOne; // make current bounds tight double newLower = CoinMin(newLowerZero,newLowerOne); if (newLower>columnLower[cColumn]) model_->solver()->setColLower(cColumn,newLower); double newUpper = CoinMax(newUpperZero,newUpperOne); if (newUppersolver()->setColUpper(cColumn,newUpper); otherVariable_[nPair++]=cColumn; last=other[i]; rows[0] = otherRow[i]; nInGroup=1; } } } // Copy constructor CbcSwitchingBinary::CbcSwitchingBinary ( const CbcSwitchingBinary & rhs) : CbcSimpleIntegerDynamicPseudoCost(rhs), numberOther_(rhs.numberOther_), type_(rhs.type_) { zeroLowerBound_ = CoinCopyOfArray(rhs.zeroLowerBound_,4*numberOther_); oneLowerBound_ = zeroLowerBound_+numberOther_; zeroUpperBound_ = oneLowerBound_+numberOther_; oneUpperBound_ = zeroUpperBound_+numberOther_; otherVariable_ = CoinCopyOfArray(rhs.otherVariable_,numberOther_); } // Clone CbcObject * CbcSwitchingBinary::clone() const { return new CbcSwitchingBinary(*this); } // Assignment operator CbcSwitchingBinary & CbcSwitchingBinary::operator=( const CbcSwitchingBinary & rhs) { if (this != &rhs) { CbcSimpleIntegerDynamicPseudoCost::operator=(rhs); numberOther_=rhs.numberOther_; type_ = rhs.type_; delete [] zeroLowerBound_; delete [] otherVariable_; zeroLowerBound_ = CoinCopyOfArray(rhs.zeroLowerBound_,4*numberOther_); oneLowerBound_ = zeroLowerBound_+numberOther_; zeroUpperBound_ = oneLowerBound_+numberOther_; oneUpperBound_ = zeroUpperBound_+numberOther_; otherVariable_ = CoinCopyOfArray(rhs.otherVariable_,numberOther_); } return *this; } // Destructor CbcSwitchingBinary::~CbcSwitchingBinary () { delete [] zeroLowerBound_; delete [] otherVariable_; } // Add in zero switches void CbcSwitchingBinary::addZeroSwitches(int nAdd,const int * columns) { type_ |= 1; int nNew = numberOther_+nAdd; double * bounds = new double[4*nNew]; int * other = new int [nNew]; memcpy(other,otherVariable_,numberOther_*sizeof(int)); delete [] otherVariable_; otherVariable_=other; memcpy(bounds,zeroLowerBound_,numberOther_*sizeof(double)); memcpy(bounds+nNew,oneLowerBound_,numberOther_*sizeof(double)); memcpy(bounds+2*nNew,zeroUpperBound_,numberOther_*sizeof(double)); memcpy(bounds+3*nNew,oneUpperBound_,numberOther_*sizeof(double)); delete [] zeroLowerBound_; zeroLowerBound_ = bounds; oneLowerBound_ = zeroLowerBound_+nNew; zeroUpperBound_ = oneLowerBound_+nNew; oneUpperBound_ = zeroUpperBound_+nNew; for (int i=0;i 1.0e-40 && upDynamicPseudoCost_ > 1.0e-40); double * solution = const_cast(model_->testSolution()); const double * lower = model_->getCbcColLower(); const double * upper = model_->getCbcColUpper(); double saveValue = solution[columnNumber_]; if (!lower[columnNumber_]&&upper[columnNumber_]==1.0) { double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); if (saveValuesolver()->getDblParam(OsiPrimalTolerance, tolerance) ; for (int i=0;izeroUpperBound_[i]+tolerance) allGood=false; } if (!allGood) solution[columnNumber_]=2.0*integerTolerance; } else if (saveValue>1.0-integerTolerance) { // check others OK bool allGood=true; double tolerance; model_->solver()->getDblParam(OsiPrimalTolerance, tolerance) ; for (int i=0;ioneUpperBound_[i]+tolerance) allGood=false; } if (!allGood) solution[columnNumber_]=1.0-2.0*integerTolerance; } } double inf = CbcSimpleIntegerDynamicPseudoCost::infeasibility(info,preferredWay); solution[columnNumber_]=saveValue; return inf; } // Set associated bounds int CbcSwitchingBinary::setAssociatedBounds(OsiSolverInterface * solver, int cleanBasis) const { if (!solver) solver = model_->solver(); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver); if (cleanBasis!=1) clpSolver=NULL; #endif const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); int nChanged=0; if (!columnUpper[columnNumber_]) { #ifdef COIN_HAS_CLP if (clpSolver) clpSolver->setColumnStatus(columnNumber_,ClpSimplex::isFixed); #endif for (int i=0;icolumnLower[otherColumn]) { solver->setColLower(otherColumn,zeroLowerBound_[i]); nChanged++; } if (zeroUpperBound_[i]setColUpper(otherColumn,zeroUpperBound_[i]); #ifdef COIN_DEVELOP const double * solution = solver->getColSolution(); double value = solution[otherColumn]; if (value - zeroUpperBound_[i] > 1.0e-5 && model_->logLevel()>1) printf("value for continuous %d %g - above %g - switch %d is %.12g (ub 0)\n", otherColumn, value, zeroUpperBound_[i],columnNumber_,solution[columnNumber_]); #endif nChanged++; } } } else if (columnLower[columnNumber_]==1.0) { #ifdef COIN_HAS_CLP if (clpSolver) clpSolver->setColumnStatus(columnNumber_,ClpSimplex::isFixed); #endif for (int i=0;icolumnLower[otherColumn]) { solver->setColLower(otherColumn,oneLowerBound_[i]); nChanged++; } if (oneUpperBound_[i]setColUpper(otherColumn,oneUpperBound_[i]); nChanged++; } } } else if (cleanBasis>=2) { // if all OK then can fix int state[3]; int nBadFixed; const double * solution = solver->getColSolution(); if (!checkAssociatedBounds(solver,solution, 0,state,nBadFixed)) { const double *reducedCost = solver->getReducedCost() ; double good=true; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); if (solution[columnNumber_]1.0e-6) solver->setColUpper(columnNumber_,0.0); else good=false; } else if (solution[columnNumber_]>1.0-integerTolerance) { if (cleanBasis==2||reducedCost[columnNumber_]<-1.0e-6) solver->setColLower(columnNumber_,1.0); else good=false; } if (good) nChanged=setAssociatedBounds(solver,0); } } else { // see if any continuous bounds force binary for (int i=0;izeroUpperBound_[i]) { // can't be zero solver->setColLower(columnNumber_,1.0); nChanged++; } else if (columnLower[otherColumn]>oneUpperBound_[i]) { // can't be one solver->setColUpper(columnNumber_,0.0); nChanged++; } if (columnUpper[otherColumn]setColLower(columnNumber_,1.0); nChanged++; } else if (columnUpper[otherColumn]setColUpper(columnNumber_,0.0); nChanged++; } } } return nChanged; } // Check associated bounds int CbcSwitchingBinary::checkAssociatedBounds(const OsiSolverInterface * solver, const double * solution, int printLevel, int state[3], int & nBadFixed) const { state[0] = 0; int nBad=0; if (!solver) solver = model_->solver(); double tolerance; solver->getDblParam(OsiPrimalTolerance, tolerance) ; const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); bool printIt = printLevel>2 && model_->logLevel()>1; if (solution[columnNumber_]solution[otherColumn]+tolerance*5.0) { nBad++; if (columnUpper[columnNumber_]==0.0) { nBadFixed++; //printIt=true; } if (printIt) printf("switch %d at zero, other %d at %.12g below bound of %.12g\n", columnNumber_,otherColumn,solution[otherColumn],zeroLowerBound_[i]); } if (zeroUpperBound_[i]1.0-integerTolerance) { state[0] = 1; for (int i=0;isolution[otherColumn]+tolerance*5.0) { nBad++; if (columnLower[columnNumber_]==1.0) { nBadFixed++; //printIt=true; } if (printIt) printf("switch %d at one, other %d at %.12g below bound of %.12g\n", columnNumber_,otherColumn,solution[otherColumn],oneLowerBound_[i]); } if (oneUpperBound_[i]columnLower[otherColumn]+tolerance&& otherValue= y+1 */ class CbcBranchAllDifferent : public CbcBranchCut { public: // Default Constructor CbcBranchAllDifferent (); /** Useful constructor - passed set of integer variables which must all be different */ CbcBranchAllDifferent (CbcModel * model, int number, const int * which); // Copy constructor CbcBranchAllDifferent ( const CbcBranchAllDifferent &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcBranchAllDifferent & operator=( const CbcBranchAllDifferent& rhs); // Destructor ~CbcBranchAllDifferent (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; protected: /// data /// Number of entries int numberInSet_; /// Which variables int * which_; }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveLineSearch.cpp0000644000175000017500000001034412426717442020426 0ustar renerene/* $Id: CbcHeuristicDiveLineSearch.cpp 2093 2014-11-06 16:17:38Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcHeuristicDiveLineSearch.hpp" #include "CbcStrategy.hpp" // Default Constructor CbcHeuristicDiveLineSearch::CbcHeuristicDiveLineSearch() : CbcHeuristicDive() { } // Constructor from model CbcHeuristicDiveLineSearch::CbcHeuristicDiveLineSearch(CbcModel & model) : CbcHeuristicDive(model) { } // Destructor CbcHeuristicDiveLineSearch::~CbcHeuristicDiveLineSearch () { } // Clone CbcHeuristicDiveLineSearch * CbcHeuristicDiveLineSearch::clone() const { return new CbcHeuristicDiveLineSearch(*this); } // Create C++ lines to get to current state void CbcHeuristicDiveLineSearch::generateCpp( FILE * fp) { CbcHeuristicDiveLineSearch other; fprintf(fp, "0#include \"CbcHeuristicDiveLineSearch.hpp\"\n"); fprintf(fp, "3 CbcHeuristicDiveLineSearch heuristicDiveLineSearch(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicDiveLineSearch"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicDiveLineSearch);\n"); } // Copy constructor CbcHeuristicDiveLineSearch::CbcHeuristicDiveLineSearch(const CbcHeuristicDiveLineSearch & rhs) : CbcHeuristicDive(rhs) { } // Assignment operator CbcHeuristicDiveLineSearch & CbcHeuristicDiveLineSearch::operator=( const CbcHeuristicDiveLineSearch & rhs) { if (this != &rhs) { CbcHeuristicDive::operator=(rhs); } return *this; } bool CbcHeuristicDiveLineSearch::selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound) { int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); // get the LP relaxation solution at the root node double * rootNodeLPSol = model_->continuousSolution(); bestColumn = -1; bestRound = -1; // -1 rounds down, +1 rounds up double bestRelDistance = COIN_DBL_MAX; bool allTriviallyRoundableSoFar = true; int bestPriority = COIN_INT_MAX; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double rootValue = rootNodeLPSol[iColumn]; double value = newSolution[iColumn]; double fraction = value - floor(value); int round = 0; if (fabs(floor(value + 0.5) - value) > integerTolerance) { if (allTriviallyRoundableSoFar || (downLocks_[i] > 0 && upLocks_[i] > 0)) { if (allTriviallyRoundableSoFar && downLocks_[i] > 0 && upLocks_[i] > 0) { allTriviallyRoundableSoFar = false; bestRelDistance = COIN_DBL_MAX; } double relDistance; if (value < rootValue) { round = -1; relDistance = fraction / (rootValue - value); } else if (value > rootValue) { round = 1; relDistance = (1.0 - fraction) / (value - rootValue); } else { round = -1; relDistance = COIN_DBL_MAX; } // if variable is not binary, penalize it if (!solver->isBinary(iColumn)) relDistance *= 1000.0; // if priorities then use if (priority_) { int thisRound=static_cast(priority_[i].direction); if ((thisRound&1)!=0) round = ((thisRound&2)==0) ? -1 : +1; if (priority_[i].priority>bestPriority) { relDistance=COIN_DBL_MAX; } else if (priority_[i].priority(priority_[i].priority); bestRelDistance=COIN_DBL_MAX; } } if (relDistance < bestRelDistance) { bestColumn = iColumn; bestRelDistance = relDistance; bestRound = round; } } } } return allTriviallyRoundableSoFar; } CoinMP-1.8.3/Cbc/src/CbcCompareObjective.cpp0000644000175000017500000000354112131054770017132 0ustar renerene// $Id: CbcCompareObjective.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCompareActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CbcMessage.hpp" #include "CbcModel.hpp" #include "CbcTree.hpp" #include "CbcCompareActual.hpp" #include "CoinError.hpp" #include "CbcCompareObjective.hpp" /** Default Constructor */ CbcCompareObjective::CbcCompareObjective () : CbcCompareBase() { test_ = this; } // Copy constructor CbcCompareObjective::CbcCompareObjective ( const CbcCompareObjective & rhs) : CbcCompareBase(rhs) { } // Clone CbcCompareBase * CbcCompareObjective::clone() const { return new CbcCompareObjective(*this); } // Assignment operator CbcCompareObjective & CbcCompareObjective::operator=( const CbcCompareObjective & rhs) { if (this != &rhs) { CbcCompareBase::operator=(rhs); } return *this; } // Destructor CbcCompareObjective::~CbcCompareObjective () { } // Returns true if y better than x bool CbcCompareObjective::test (CbcNode * x, CbcNode * y) { double testX = x->objectiveValue(); double testY = y->objectiveValue(); if (testX != testY) return testX > testY; else return equalityTest(x, y); // so ties will be broken in consistent manner } // Create C++ lines to get to current state void CbcCompareObjective::generateCpp( FILE * fp) { fprintf(fp, "0#include \"CbcCompareActual.hpp\"\n"); fprintf(fp, "3 CbcCompareObjective compare;\n"); fprintf(fp, "3 cbcModel->setNodeComparison(compare);\n"); } CoinMP-1.8.3/Cbc/src/CbcHeuristicVND.cpp0000644000175000017500000002416512432625130016223 0ustar renerene// $Id: CbcHeuristicVND.cpp 2094 2014-11-18 11:15:36Z forrest $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // edwin 12/5/09 carved out of CbcHeuristicRINS #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristicVND.hpp" #include "CbcBranchActual.hpp" #include "CbcStrategy.hpp" #include "CglPreProcess.hpp" // Default Constructor CbcHeuristicVND::CbcHeuristicVND() : CbcHeuristic() { numberSolutions_ = 0; numberSuccesses_ = 0; numberTries_ = 0; lastNode_ = -999999; howOften_ = 100; decayFactor_ = 0.5; baseSolution_ = NULL; whereFrom_ = 1 + 8 + 255 * 256; stepSize_ = 0; k_ = 0; kmax_ = 0; nDifferent_ = 0; } // Constructor with model - assumed before cuts CbcHeuristicVND::CbcHeuristicVND(CbcModel & model) : CbcHeuristic(model) { numberSolutions_ = 0; numberSuccesses_ = 0; numberTries_ = 0; lastNode_ = -999999; howOften_ = 100; decayFactor_ = 0.5; assert(model.solver()); int numberColumns = model.solver()->getNumCols(); baseSolution_ = new double [numberColumns]; memset(baseSolution_, 0, numberColumns*sizeof(double)); whereFrom_ = 1 + 8 + 255 * 256; stepSize_ = 0; k_ = 0; kmax_ = 0; nDifferent_ = 0; } // Destructor CbcHeuristicVND::~CbcHeuristicVND () { delete [] baseSolution_; } // Clone CbcHeuristic * CbcHeuristicVND::clone() const { return new CbcHeuristicVND(*this); } // Assignment operator CbcHeuristicVND & CbcHeuristicVND::operator=( const CbcHeuristicVND & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); numberSolutions_ = rhs.numberSolutions_; howOften_ = rhs.howOften_; numberSuccesses_ = rhs.numberSuccesses_; numberTries_ = rhs.numberTries_; lastNode_ = rhs.lastNode_; delete [] baseSolution_; if (model_ && rhs.baseSolution_) { int numberColumns = model_->solver()->getNumCols(); baseSolution_ = new double [numberColumns]; memcpy(baseSolution_, rhs.baseSolution_, numberColumns*sizeof(double)); } else { baseSolution_ = NULL; } stepSize_ = rhs.stepSize_; k_ = rhs.k_; kmax_ = rhs.kmax_; nDifferent_ = rhs.nDifferent_; } return *this; } // Create C++ lines to get to current state void CbcHeuristicVND::generateCpp( FILE * fp) { CbcHeuristicVND other; fprintf(fp, "0#include \"CbcHeuristicVND.hpp\"\n"); fprintf(fp, "3 CbcHeuristicVND heuristicVND(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicVND"); if (howOften_ != other.howOften_) fprintf(fp, "3 heuristicVND.setHowOften(%d);\n", howOften_); else fprintf(fp, "4 heuristicVND.setHowOften(%d);\n", howOften_); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicVND);\n"); } // Copy constructor CbcHeuristicVND::CbcHeuristicVND(const CbcHeuristicVND & rhs) : CbcHeuristic(rhs), numberSolutions_(rhs.numberSolutions_), howOften_(rhs.howOften_), numberSuccesses_(rhs.numberSuccesses_), numberTries_(rhs.numberTries_), lastNode_(rhs.lastNode_) { if (model_ && rhs.baseSolution_) { int numberColumns = model_->solver()->getNumCols(); baseSolution_ = new double [numberColumns]; memcpy(baseSolution_, rhs.baseSolution_, numberColumns*sizeof(double)); } else { baseSolution_ = NULL; } stepSize_ = rhs.stepSize_; k_ = rhs.k_; kmax_ = rhs.kmax_; nDifferent_ = rhs.nDifferent_; } // Resets stuff if model changes void CbcHeuristicVND::resetModel(CbcModel * /*model*/) { //CbcHeuristic::resetModel(model); delete [] baseSolution_; if (model_ && baseSolution_) { int numberColumns = model_->solver()->getNumCols(); baseSolution_ = new double [numberColumns]; memset(baseSolution_, 0, numberColumns*sizeof(double)); } else { baseSolution_ = NULL; } } /* First tries setting a variable to better value. If feasible then tries setting others. If not feasible then tries swaps Returns 1 if solution, 0 if not */ int CbcHeuristicVND::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; int returnCode = 0; const double * bestSolution = model_->bestSolution(); if (!bestSolution) return 0; // No solution found yet #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif if (numberSolutions_ < model_->getSolutionCount()) { // new solution - add info numberSolutions_ = model_->getSolutionCount(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double value = bestSolution[iColumn]; if (value < originalLower) { value = originalLower; } else if (value > originalUpper) { value = originalUpper; } } } int numberNodes = model_->getNodeCount(); if (howOften_ == 100) { if (numberNodes < lastNode_ + 12) return 0; // Do at 50 and 100 if ((numberNodes > 40 && numberNodes <= 50) || (numberNodes > 90 && numberNodes < 100)) numberNodes = howOften_; } if ((numberNodes % howOften_) == 0 && (model_->getCurrentPassNumber() <= 1 || model_->getCurrentPassNumber() == 999999)) { lastNode_ = model_->getNodeCount(); OsiSolverInterface * solver = model_->solver(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); const double * currentSolution = solver->getColSolution(); OsiSolverInterface * newSolver = cloneBut(3); // was model_->continuousSolver()->clone(); //const double * colLower = newSolver->getColLower(); //const double * colUpper = newSolver->getColUpper(); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); // Sort on distance double * distance = new double [numberIntegers]; int * which = new int [numberIntegers]; int i; int nFix = 0; double tolerance = 10.0 * primalTolerance; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double valueInt = bestSolution[iColumn]; if (valueInt < originalLower) { valueInt = originalLower; } else if (valueInt > originalUpper) { valueInt = originalUpper; } baseSolution_[iColumn] = currentSolution[iColumn]; distance[i] = fabs(currentSolution[iColumn] - valueInt); which[i] = i; if (fabs(currentSolution[iColumn] - valueInt) < tolerance) nFix++; } CoinSort_2(distance, distance + numberIntegers, which); nDifferent_ = numberIntegers - nFix; stepSize_ = nDifferent_ / 10; k_ = stepSize_; //nFix = numberIntegers-stepSize_; for (i = 0; i < nFix; i++) { int j = which[i]; int iColumn = integerVariable[j]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double valueInt = bestSolution[iColumn]; if (valueInt < originalLower) { valueInt = originalLower; } else if (valueInt > originalUpper) { valueInt = originalUpper; } double nearest = floor(valueInt + 0.5); newSolver->setColLower(iColumn, nearest); newSolver->setColUpper(iColumn, nearest); } delete [] distance; delete [] which; if (nFix > numberIntegers / 5) { //printf("%d integers have samish value\n",nFix); returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, model_->getCutoff(), "CbcHeuristicVND"); if (returnCode < 0) returnCode = 0; // returned on size else numRuns_++; if ((returnCode&1) != 0) numberSuccesses_++; //printf("return code %d",returnCode); if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; //printf("could add cut with %d elements (if all 0-1)\n",nFix); } else { //printf("\n"); } numberTries_++; if ((numberTries_ % 10) == 0 && numberSuccesses_*3 < numberTries_) howOften_ += static_cast (howOften_ * decayFactor_); } delete newSolver; } return returnCode; } // update model void CbcHeuristicVND::setModel(CbcModel * model) { model_ = model; // Get a copy of original matrix assert(model_->solver()); delete [] baseSolution_; int numberColumns = model->solver()->getNumCols(); baseSolution_ = new double [numberColumns]; memset(baseSolution_, 0, numberColumns*sizeof(double)); } CoinMP-1.8.3/Cbc/src/CbcGenOsiParamUtils.cpp0000644000175000017500000003572412131054770017107 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenOsiParamUtils.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinFinite.hpp" #include "CoinParam.hpp" #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" #include "CbcGenCbcParam.hpp" #include "CbcGenOsiParam.hpp" /*! \file CbcOsiParamUtils \brief Implementation functions for CbcOsiParam parameters. */ namespace { char svnid[] = "$Id: CbcGenOsiParamUtils.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } namespace CbcOsiParamUtils { /* Function to set up OSI parameters. Does not include solver-specific parameters. ALGORITHM is commented out in CoinSolve. */ void addCbcOsiParams (int &numberParameters, CoinParamVec ¶meters, OsiSolverInterface *osi) { CbcOsiParam *param ; OsiHintParam key ; bool sense ; OsiHintStrength strength ; int ival ; double dval ; param = new CbcOsiParam(CbcOsiParam::KEEPNAMES, "keepN!ames", "Whether to keep row and column names on import.", "off", 1) ; param->appendKwd("on") ; param->setPushFunc(pushCbcOsiKwd) ; param->setObj(osi) ; param->setLongHelp( "Row and column names are human-friendly, but maintaining names takes up space and time. Specifying -keepnames off >before< importing a problem will discard any name information." ) ; parameters.push_back(param) ; (void) osi->getIntParam(OsiMaxNumIteration, ival) ; param = new CbcOsiParam(CbcOsiParam::MAXITERATION, "maxIt!erations", "Iteration limit for OSI solver.", 0, COIN_INT_MAX, ival) ; param->setPushFunc(pushCbcOsiInt) ; param->setObj(osi) ; param->setLongHelp( "Limits the number of iterations the OSI solver can perform when solving a problem." ) ; parameters.push_back(param) ; (void) osi->getIntParam(OsiMaxNumIterationHotStart, ival) ; param = new CbcOsiParam(CbcOsiParam::MAXHOTITS, "hot!StartMaxIts", "Iteration limit for OSI solver hot start.", 0, COIN_INT_MAX, ival) ; param->setPushFunc(pushCbcOsiInt) ; param->setObj(osi) ; param->setLongHelp( "Limits the number of iterations the OSI solver can perform when solving a problem from a hot start. In the context of cbc, this limits the number of iterations expended on each LP during strong branching." ) ; parameters.push_back(param) ; /* Simplified to on/off for OsiSolverInterface, where it goes in as a hint. */ (void) osi->getHintParam(OsiDoPresolveInInitial, sense, strength) ; if (sense == true) { ival = 1 ; } else { ival = 0 ; } param = new CbcOsiParam(CbcOsiParam::PRESOLVE, "presolve", "Whether to presolve problem", "off", ival) ; param->appendKwd("on") ; param->setPushFunc(pushCbcOsiHint) ; param->setObj(osi) ; param->setLongHelp( "Presolve analyzes the model to find such things as redundant constraints, constraints which fix some variables, constraints which can be transformed into bounds, etc. For the initial solve of any problem this is worth doing unless you know that it will have no effect." ) ; parameters.push_back(param) ; param = new CbcOsiParam(CbcOsiParam::PRIMALTOLERANCE, "primalT!olerance", "For an optimal solution no primal infeasibility may exceed this value", 1.0e-20, 1.0e12) ; param->setPushFunc(pushCbcOsiDbl) ; param->setObj(osi) ; param ->setLongHelp( "Normally the default tolerance is fine, but you may want to increase it a bit if a primal run seems to be having a hard time" ) ; parameters.push_back(param) ; /* Simplified for OsiSolverInterface, which just takes a hint. */ (void) osi->getHintParam(OsiDoScale, sense, strength) ; if (sense == true) { ival = 1 ; } else { ival = 0 ; } param = new CbcOsiParam(CbcOsiParam::SCALING, "scal!ing", "Whether to scale problem", "off", ival) ; param ->appendKwd("on") ; param->setPushFunc(pushCbcOsiHint) ; param->setObj(osi) ; param ->setLongHelp( "Scaling can help in solving problems which might otherwise fail because of lack of accuracy. It can also reduce the number of iterations. It is not applied if the range of elements is small. When unscaled it is possible that there may be small primal and/or infeasibilities." ) ; parameters.push_back(param) ; ival = osi->messageHandler()->logLevel() ; param = new CbcOsiParam(CbcOsiParam::SOLVERLOGLEVEL, "slog!Level", "Level of detail in Solver output", -1, 63, ival) ; param->setPushFunc(pushCbcOsiLogLevel) ; param->setObj(osi) ; param ->setLongHelp( "If 0 then there should be no output in normal circumstances. 1 is probably the best value for most uses, while 2 and 3 give more information." ) ; parameters.push_back(param) ; numberParameters = parameters.size() ; assert (numberParameters <= parameters.capacity()) ; } void loadOsiParamObj (const CoinParamVec paramVec, int first, int last, OsiSolverInterface *obj) { int i ; /* Load the OsiSolverInterface object into the parameters */ for (i = first ; i <= last ; i++) { CbcOsiParam *osiParam = dynamic_cast(paramVec[i]) ; assert (osiParam != 0) ; osiParam->setObj(obj) ; } return ; } /* Function to set default values for solver appropriate for cbc-generic. */ void setOsiSolverInterfaceDefaults (OsiSolverInterface *osi) { bool result ; /* OsiNameDiscipline isn't supported by all solvers, so check to see that it worked. If not, fall back to zero. */ osi->setIntParam(OsiMaxNumIteration, 1000000) ; osi->setIntParam(OsiMaxNumIterationHotStart, 1000) ; result = osi->setIntParam(OsiNameDiscipline, 1) ; if (!result) { result = osi->setIntParam(OsiNameDiscipline, 0) ; } /* Primal and dual feasibility tolerances (OsiPrimalTolerance and OsiDualTolerance, respectively) are left to the discretion of the solver. */ osi->setDblParam(OsiDualObjectiveLimit, 1.0e100) ; osi->setDblParam(OsiPrimalObjectiveLimit, 1.0e100) ; osi->setDblParam(OsiObjOffset, 0.0) ; osi->setHintParam(OsiDoPresolveInInitial, true, OsiHintDo) ; osi->setHintParam(OsiDoDualInInitial, true, OsiHintIgnore) ; osi->setHintParam(OsiDoPresolveInResolve, false, OsiHintTry) ; osi->setHintParam(OsiDoDualInInitial, true, OsiHintTry) ; osi->setHintParam(OsiDoScale, true, OsiHintDo) ; osi->setHintParam(OsiDoCrash, true, OsiHintIgnore) ; osi->setHintParam(OsiDoReducePrint, true, OsiHintDo) ; osi->setHintParam(OsiDoInBranchAndCut, true, OsiHintTry) ; return ; } /* Function to push an integer parameter. */ int pushCbcOsiInt (CoinParam *param) { assert (param != 0) ; CbcOsiParam *osiParam = dynamic_cast(param) ; assert (osiParam != 0) ; OsiSolverInterface *osi = osiParam->obj() ; assert (osi != 0) ; int val = osiParam->intVal() ; CbcOsiParam::CbcOsiParamCode code = osiParam->paramCode() ; assert (osi != 0) ; /* Setup to return nonfatal/fatal error (1/-1) by default, so that all we need to do is correct to 0 (no error) if we're successful. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* Translate the parameter code from CbcOsiParamCode into the correct key for CbcIntParam. */ OsiIntParam key ; switch (code) { case CbcOsiParam::MAXITERATION: { key = OsiMaxNumIteration ; break ; } case CbcOsiParam::MAXHOTITS: { key = OsiMaxNumIterationHotStart ; break ; } default: { std::cerr << "pushCbcOsiIntParam: no equivalent OsiIntParam for " << "parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } bool setOK = osi->setIntParam(key, val) ; if (setOK == false) { retval = -1 ; } return (retval) ; } /* Function to push a double parameter. */ int pushCbcOsiDbl (CoinParam *param) { assert (param != 0) ; CbcOsiParam *osiParam = dynamic_cast(param) ; assert (osiParam != 0) ; OsiSolverInterface *osi = osiParam->obj() ; assert (osi != 0) ; double val = osiParam->dblVal() ; CbcOsiParam::CbcOsiParamCode code = osiParam->paramCode() ; assert (osi != 0) ; /* Setup to return nonfatal/fatal error (1/-1) by default, so that all we need to do is correct to 0 (no error) if we're successful. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* Translate the parameter code from CbcOsiParamCode into the correct key for CbcDblParam. */ OsiDblParam key ; switch (code) { case CbcOsiParam::PRIMALTOLERANCE: { key = OsiPrimalTolerance ; break ; } case CbcOsiParam::DUALTOLERANCE: { key = OsiDualTolerance ; ; break ; } case CbcOsiParam::DUALBOUND: { key = OsiDualObjectiveLimit ; break ; } default: { std::cerr << "pushCbcOsiDblParam: no equivalent OsiDblParam for " << "parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } bool setOK = osi->setDblParam(key, val) ; if (setOK == false) { retval = -1 ; } return (retval) ; } /* Function to push a keyword-valued parameter. This can translate into integer as well as string-valued parameters. */ int pushCbcOsiKwd (CoinParam *param) { assert (param != 0) ; CbcOsiParam *osiParam = dynamic_cast(param) ; assert (osiParam != 0) ; OsiSolverInterface *osi = osiParam->obj() ; assert (osi != 0) ; std::string str = osiParam->kwdVal() ; CbcOsiParam::CbcOsiParamCode code = osiParam->paramCode() ; int retval = 0 ; /* Figure out what we're doing and set the relevant field. */ OsiIntParam key ; switch (code) { case CbcOsiParam::KEEPNAMES: { if (str == "on" || str == "off") { int discipline ; if (str == "on") { discipline = 1 ; } else { discipline = 0 ; } bool recog = osi->setIntParam(OsiNameDiscipline, discipline) ; if (recog == false) { std::cerr << "pushCbcOsiKwdParam(KEEPNAMES): underlying solver does not " << "recognise name discipline " << discipline << "." << std::endl ; retval = +1 ; } } else { std::cerr << "pushCbcOsiKwdParam(KEEPNAMES): unrecognised keyword `" << str << "'." << std::endl ; retval = -1 ; } break ; } default: { std::cerr << "pushCbcGenKwdParam: unrecognised parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } return (retval) ; } /* Function to set the solver's output level. To cover all the bases, adjust the message handler and set the hint. Nothing can go fatally wrong here, but we'll return non-fatal error if the solver rejects the hint. The implementor of an OSI has wide latitude with hints, and may elect to set a log level as part of handling the hint. Do that first and then explicitly set the message handler log level to be sure the new value isn't overridden. */ int pushCbcOsiLogLevel (CoinParam *param) { assert (param != 0) ; CbcOsiParam *osiParam = dynamic_cast(param) ; assert (osiParam != 0) ; OsiSolverInterface *osi = osiParam->obj() ; assert(osi != 0) ; int lvl = param->intVal() ; /* Setup to return nonfatal/fatal error (1/-1) by default, so that all we need to do is correct to 0 (no error) if we're successful. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* Now try to do the right thing with a hint. Harder to say -- assume that log level 1 is `normal'. */ OsiHintStrength strength ; bool sense ; if (lvl < 1) { strength = OsiHintDo ; sense = true ; } else if (lvl == 1) { strength = OsiHintIgnore ; sense = true ; } else if (lvl == 2) { strength = OsiHintTry ; sense = false ; } else { strength = OsiHintDo ; sense = false ; } bool setOK = osi->setHintParam(OsiDoReducePrint, sense, strength) ; /* Recover the message handler and set the log level directly. */ CoinMessageHandler *hndl = osi->messageHandler() ; assert (hndl != 0) ; hndl->setLogLevel(lvl) ; if (setOK) { return (0) ; } else { return (retval) ; } } /* Function for parameters that are enabled/disabled with a hint. */ int pushCbcOsiHint (CoinParam *param) { assert (param != 0) ; CbcOsiParam *osiParam = dynamic_cast(param) ; assert (osiParam != 0) ; OsiSolverInterface *osi = osiParam->obj() ; assert(osi != 0) ; /* Setup to return nonfatal/fatal error (1/-1) by default, so that all we need to do is correct to 0 (no error) if we're successful. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* Set the sense for the hint. */ std::string kwd = param->kwdVal() ; bool sense ; if (kwd == "off") { sense = false ; } else { sense = true ; } /* Grab the parameter code and translate to an OSI parameter key. */ CbcOsiParam::CbcOsiParamCode code = osiParam->paramCode() ; OsiHintParam key ; switch (code) { case CbcOsiParam::PRESOLVE: { key = OsiDoPresolveInInitial ; break ; } case CbcOsiParam::SCALING: { key = OsiDoScale ; break ; } default: { std::cerr << "pushCbcOsiHint: no equivalent OsiHintParam for " << "parameter code `" << code << "'." << std::endl ; retval = -1 ; break ; } } bool setOK = osi->setHintParam(key, sense, OsiHintDo) ; if (setOK) { return (0) ; } else { return (retval) ; } } } // end namespace CbcOsiParamUtils CoinMP-1.8.3/Cbc/src/CbcCompareEstimate.hpp0000644000175000017500000000253512131054770017002 0ustar renerene// $Id: CbcCompareEstimate.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCompareActual #ifndef CbcCompareEstimate_H #define CbcCompareEstimate_H //############################################################################# /* These are alternative strategies for node traversal. They can take data etc for fine tuning At present the node list is stored as a heap and the "test" comparison function returns true if node y is better than node x. */ #include "CbcNode.hpp" #include "CbcCompareBase.hpp" #include "CbcCompare.hpp" class CbcModel; /* This is when rounding is being done */ class CbcCompareEstimate : public CbcCompareBase { public: // Default Constructor CbcCompareEstimate () ; ~CbcCompareEstimate() ; // Copy constructor CbcCompareEstimate ( const CbcCompareEstimate &rhs); // Assignment operator CbcCompareEstimate & operator=( const CbcCompareEstimate& rhs); /// Clone virtual CbcCompareBase * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp); virtual bool test (CbcNode * x, CbcNode * y) ; }; #endif //CbcCompareEstimate_H CoinMP-1.8.3/Cbc/src/CbcModel.hpp0000644000175000017500000032135412547035070014766 0ustar renerene/* $Id: CbcModel.hpp 2206 2015-07-07 20:44:40Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcModel_H #define CbcModel_H #include #include #include "CoinMessageHandler.hpp" #include "OsiSolverInterface.hpp" #include "OsiBranchingObject.hpp" #include "OsiCuts.hpp" #include "CoinWarmStartBasis.hpp" #include "CbcCompareBase.hpp" #include "CbcCountRowCut.hpp" #include "CbcMessage.hpp" #include "CbcEventHandler.hpp" #include "ClpDualRowPivot.hpp" class CbcCutGenerator; class CbcBaseModel; class OsiRowCut; class OsiBabSolver; class OsiRowCutDebugger; class CglCutGenerator; class CglStored; class CbcCutModifier; class CglTreeProbingInfo; class CbcHeuristic; class OsiObject; class CbcThread; class CbcTree; class CbcStrategy; class CbcSymmetry; class CbcFeasibilityBase; class CbcStatistics; class CbcFullNodeInfo; class CbcEventHandler ; class CglPreProcess; class OsiClpSolverInterface; class ClpNodeStuff; // #define CBC_CHECK_BASIS 1 //############################################################################# /** Simple Branch and bound class The initialSolve() method solves the initial LP relaxation of the MIP problem. The branchAndBound() method can then be called to finish using a branch and cut algorithm.

    Search Tree Traversal

    Subproblems (aka nodes) requiring additional evaluation are stored using the CbcNode and CbcNodeInfo objects. Ancestry linkage is maintained in the CbcNodeInfo object. Evaluation of a subproblem within branchAndBound() proceeds as follows:
    • The node representing the most promising parent subproblem is popped from the heap which holds the set of subproblems requiring further evaluation.
    • Using branching instructions stored in the node, and information in its ancestors, the model and solver are adjusted to create the active subproblem.
    • If the parent subproblem will require further evaluation (i.e., there are branches remaining) its node is pushed back on the heap. Otherwise, the node is deleted. This may trigger recursive deletion of ancestors.
    • The newly created subproblem is evaluated.
    • If the subproblem requires further evaluation, a node is created. All information needed to recreate the subproblem (branching information, row and column cuts) is placed in the node and the node is added to the set of subproblems awaiting further evaluation.
    Note that there is never a node representing the active subproblem; the model and solver represent the active subproblem.

    Row (Constraint) Cut Handling

    For a typical subproblem, the sequence of events is as follows:
    • The subproblem is rebuilt for further evaluation: One result of a call to addCuts() is a traversal of ancestors, leaving a list of all cuts used in the ancestors in #addedCuts_. This list is then scanned to construct a basis that includes only tight cuts. Entries for loose cuts are set to NULL.
    • The subproblem is evaluated: One result of a call to solveWithCuts() is the return of a set of newly generated cuts for the subproblem. #addedCuts_ is also kept up-to-date as old cuts become loose.
    • The subproblem is stored for further processing: A call to CbcNodeInfo::addCuts() adds the newly generated cuts to the CbcNodeInfo object associated with this node.
    See CbcCountRowCut for details of the bookkeeping associated with cut management. */ class CbcModel { public: enum CbcIntParam { /** The maximum number of nodes before terminating */ CbcMaxNumNode = 0, /** The maximum number of solutions before terminating */ CbcMaxNumSol, /** Fathoming discipline Controls objective function comparisons for purposes of fathoming by bound or determining monotonic variables. If 1, action is taken only when the current objective is strictly worse than the target. Implementation is handled by adding a small tolerance to the target. */ CbcFathomDiscipline, /** Adjusts printout 1 does different node message with number unsatisfied on last branch */ CbcPrinting, /** Number of branches (may be more than number of nodes as may include strong branching) */ CbcNumberBranches, /** Just a marker, so that a static sized array can store parameters. */ CbcLastIntParam }; enum CbcDblParam { /** The maximum amount the value of an integer variable can vary from integer and still be considered feasible. */ CbcIntegerTolerance = 0, /** The objective is assumed to worsen by this amount for each integer infeasibility. */ CbcInfeasibilityWeight, /** The amount by which to tighten the objective function cutoff when a new solution is discovered. */ CbcCutoffIncrement, /** Stop when the gap between the objective value of the best known solution and the best bound on the objective of any solution is less than this. This is an absolute value. Conversion from a percentage is left to the client. */ CbcAllowableGap, /** Stop when the gap between the objective value of the best known solution and the best bound on the objective of any solution is less than this fraction of of the absolute value of best known solution. Code stops if either this test or CbcAllowableGap test succeeds */ CbcAllowableFractionGap, /** \brief The maximum number of seconds before terminating. A double should be adequate! */ CbcMaximumSeconds, /// Cutoff - stored for speed CbcCurrentCutoff, /// Optimization direction - stored for speed CbcOptimizationDirection, /// Current objective value CbcCurrentObjectiveValue, /// Current minimization objective value CbcCurrentMinimizationObjectiveValue, /** \brief The time at start of model. So that other pieces of code can access */ CbcStartSeconds, /** Stop doing heuristics when the gap between the objective value of the best known solution and the best bound on the objective of any solution is less than this. This is an absolute value. Conversion from a percentage is left to the client. */ CbcHeuristicGap, /** Stop doing heuristics when the gap between the objective value of the best known solution and the best bound on the objective of any solution is less than this fraction of of the absolute value of best known solution. Code stops if either this test or CbcAllowableGap test succeeds */ CbcHeuristicFractionGap, /// Smallest non-zero change on a branch CbcSmallestChange, /// Sum of non-zero changes on a branch CbcSumChange, /// Largest non-zero change on a branch CbcLargestChange, /// Small non-zero change on a branch to be used as guess CbcSmallChange, /** Just a marker, so that a static sized array can store parameters. */ CbcLastDblParam }; //--------------------------------------------------------------------------- public: ///@name Solve methods //@{ /** \brief Solve the initial LP relaxation Invoke the solver's %initialSolve() method. */ void initialSolve(); /** \brief Invoke the branch \& cut algorithm The method assumes that initialSolve() has been called to solve the LP relaxation. It processes the root node, then proceeds to explore the branch & cut search tree. The search ends when the tree is exhausted or one of several execution limits is reached. If doStatistics is 1 summary statistics are printed if 2 then also the path to best solution (if found by branching) if 3 then also one line per node */ void branchAndBound(int doStatistics = 0); private: /** \brief Evaluate a subproblem using cutting planes and heuristics The method invokes a main loop which generates cuts, applies heuristics, and reoptimises using the solver's native %resolve() method. It returns true if the subproblem remains feasible at the end of the evaluation. */ bool solveWithCuts(OsiCuts & cuts, int numberTries, CbcNode * node); /** Generate one round of cuts - serial mode returns - 0 - normal 1 - must keep going 2 - set numberTries to zero -1 - infeasible */ int serialCuts(OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts); /** Generate one round of cuts - parallel mode returns - 0 - normal 1 - must keep going 2 - set numberTries to zero -1 - infeasible */ int parallelCuts(CbcBaseModel * master, OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts); /** Input one node output N nodes to put on tree and optional solution update This should be able to operate in parallel so is given a solver and is const(ish) However we will need to keep an array of solver_ and bases and more status is 0 for normal, 1 if solution Calling code should always push nodes back on tree */ CbcNode ** solveOneNode(int whichSolver, CbcNode * node, int & numberNodesOutput, int & status) ; /// Update size of whichGenerator void resizeWhichGenerator(int numberNow, int numberAfter); public: #ifdef CBC_KEEP_DEPRECATED // See if anyone is using these any more!! /** \brief create a clean model from partially fixed problem The method creates a new model with given bounds and with no tree. */ CbcModel * cleanModel(const double * lower, const double * upper); /** \brief Invoke the branch \& cut algorithm on partially fixed problem The method presolves the given model and does branch and cut. The search ends when the tree is exhausted or maximum nodes is reached. If better solution found then it is saved. Returns 0 if search completed and solution, 1 if not completed and solution, 2 if completed and no solution, 3 if not completed and no solution. Normally okay to do cleanModel immediately followed by subBranchandBound (== other form of subBranchAndBound) but may need to get at model for advanced features. Deletes model2 */ int subBranchAndBound(CbcModel * model2, CbcModel * presolvedModel, int maximumNodes); /** \brief Invoke the branch \& cut algorithm on partially fixed problem The method creates a new model with given bounds, presolves it then proceeds to explore the branch & cut search tree. The search ends when the tree is exhausted or maximum nodes is reached. If better solution found then it is saved. Returns 0 if search completed and solution, 1 if not completed and solution, 2 if completed and no solution, 3 if not completed and no solution. This is just subModel immediately followed by other version of subBranchandBound. */ int subBranchAndBound(const double * lower, const double * upper, int maximumNodes); /** \brief Process root node and return a strengthened model The method assumes that initialSolve() has been called to solve the LP relaxation. It processes the root node and then returns a pointer to the strengthened model (or NULL if infeasible) */ OsiSolverInterface * strengthenedModel(); /** preProcess problem - replacing solver If makeEquality true then <= cliques converted to ==. Presolve will be done numberPasses times. Returns NULL if infeasible If makeEquality is 1 add slacks to get cliques, if 2 add slacks to get sos (but only if looks plausible) and keep sos info */ CglPreProcess * preProcess( int makeEquality = 0, int numberPasses = 5, int tuning = 5); /** Does postprocessing - original solver back. User has to delete process */ void postProcess(CglPreProcess * process); #endif /// Adds an update information object void addUpdateInformation(const CbcObjectUpdateData & data); /** Do one node - broken out for clarity? also for parallel (when baseModel!=this) Returns 1 if solution found node NULL on return if no branches left newNode NULL if no new node created */ int doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode); public: /** \brief Reoptimise an LP relaxation Invoke the solver's %resolve() method. whereFrom - 0 - initial continuous 1 - resolve on branch (before new cuts) 2 - after new cuts 3 - obsolete code or something modified problem in unexpected way 10 - after strong branching has fixed variables at root 11 - after strong branching has fixed variables in tree returns 1 feasible, 0 infeasible, -1 feasible but skip cuts */ int resolve(CbcNodeInfo * parent, int whereFrom, double * saveSolution = NULL, double * saveLower = NULL, double * saveUpper = NULL); /// Make given rows (L or G) into global cuts and remove from lp void makeGlobalCuts(int numberRows, const int * which); /// Make given cut into a global cut int makeGlobalCut(const OsiRowCut * cut); /// Make given cut into a global cut int makeGlobalCut(const OsiRowCut & cut); /// Make given column cut into a global cut void makeGlobalCut(const OsiColCut * cut); /// Make given column cut into a global cut void makeGlobalCut(const OsiColCut & cut); /// Make partial cut into a global cut and save void makePartialCut(const OsiRowCut * cut, const OsiSolverInterface * solver=NULL); /// Make partial cuts into global cuts void makeGlobalCuts(); /// Which cut generator generated this cut inline const int * whichGenerator() const { return whichGenerator_;} //@} /** \name Presolve methods */ //@{ /** Identify cliques and construct corresponding objects. Find cliques with size in the range [\p atLeastThisMany, \p lessThanThis] and construct corresponding CbcClique objects. If \p makeEquality is true then a new model may be returned if modifications had to be made, otherwise \c this is returned. If the problem is infeasible #numberObjects_ is set to -1. A client must use deleteObjects() before a second call to findCliques(). If priorities exist, clique priority is set to the default. */ CbcModel * findCliques(bool makeEquality, int atLeastThisMany, int lessThanThis, int defaultValue = 1000); /** Do integer presolve, creating a new (presolved) model. Returns the new model, or NULL if feasibility is lost. If weak is true then just does a normal presolve \todo It remains to work out the cleanest way of getting a solution to the original problem at the end. So this is very preliminary. */ CbcModel * integerPresolve(bool weak = false); /** Do integer presolve, modifying the current model. Returns true if the model remains feasible after presolve. */ bool integerPresolveThisModel(OsiSolverInterface * originalSolver, bool weak = false); /// Put back information into the original model after integer presolve. void originalModel(CbcModel * presolvedModel, bool weak); /** \brief For variables involved in VUB constraints, see if we can tighten bounds by solving lp's Returns false if feasibility is lost. If CglProbing is available, it will be tried as well to see if it can tighten bounds. This routine is just a front end for tightenVubs(int,const int*,double). If type = -1 all variables are processed (could be very slow). If type = 0 only variables involved in VUBs are processed. If type = n > 0, only the n most expensive VUB variables are processed, where it is assumed that x is at its maximum so delta would have to go to 1 (if x not at bound). If \p allowMultipleBinary is true, then a VUB constraint is a row with one continuous variable and any number of binary variables. If useCutoff < 1.0e30, the original objective is installed as a constraint with \p useCutoff as a bound. */ bool tightenVubs(int type, bool allowMultipleBinary = false, double useCutoff = 1.0e50); /** \brief For variables involved in VUB constraints, see if we can tighten bounds by solving lp's This version is just handed a list of variables to be processed. */ bool tightenVubs(int numberVubs, const int * which, double useCutoff = 1.0e50); /** Analyze problem to find a minimum change in the objective function. */ void analyzeObjective(); /** Add additional integers. */ void AddIntegers(); /** Save copy of the model. */ void saveModel(OsiSolverInterface * saveSolver, double * checkCutoffForRestart, bool * feasible); /** Flip direction of optimization on all models */ void flipModel(); //@} /** \name Object manipulation routines See OsiObject for an explanation of `object' in the context of CbcModel. */ //@{ /// Get the number of objects inline int numberObjects() const { return numberObjects_; } /// Set the number of objects inline void setNumberObjects(int number) { numberObjects_ = number; } /// Get the array of objects inline OsiObject ** objects() const { return object_; } /// Get the specified object const inline OsiObject * object(int which) const { return object_[which]; } /// Get the specified object inline OsiObject * modifiableObject(int which) const { return object_[which]; } void setOptionalInteger(int index); /// Delete all object information (and just back to integers if true) void deleteObjects(bool findIntegers = true); /** Add in object information. Objects are cloned; the owner can delete the originals. */ void addObjects(int numberObjects, OsiObject ** objects); /** Add in object information. Objects are cloned; the owner can delete the originals. */ void addObjects(int numberObjects, CbcObject ** objects); /// Ensure attached objects point to this model. void synchronizeModel() ; /** \brief Identify integer variables and create corresponding objects. Record integer variables and create an CbcSimpleInteger object for each one. If \p startAgain is true, a new scan is forced, overwriting any existing integer variable information. If type > 0 then 1==PseudoCost, 2 new ones low priority */ void findIntegers(bool startAgain, int type = 0); #ifdef SWITCH_VARIABLES /// Convert Dynamic to Switching int findSwitching(); /// Fix associated variables int fixAssociated(OsiSolverInterface * solver,int cleanBasis); /// Debug associated variables int checkAssociated(const OsiSolverInterface * solver, const double * solution, int printLevel); #endif //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false if the value of the parameter is out of range. The get methods return the value of the parameter. */ //@{ /// Set an integer parameter inline bool setIntParam(CbcIntParam key, int value) { intParam_[key] = value; return true; } /// Set a double parameter inline bool setDblParam(CbcDblParam key, double value) { dblParam_[key] = value; return true; } /// Get an integer parameter inline int getIntParam(CbcIntParam key) const { return intParam_[key]; } /// Get a double parameter inline double getDblParam(CbcDblParam key) const { return dblParam_[key]; } /*! \brief Set cutoff bound on the objective function. When using strict comparison, the bound is adjusted by a tolerance to avoid accidentally cutting off the optimal solution. */ void setCutoff(double value) ; /// Get the cutoff bound on the objective function - always as minimize inline double getCutoff() const { //double value ; //solver_->getDblParam(OsiDualObjectiveLimit,value) ; //assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense()); return dblParam_[CbcCurrentCutoff]; } /// Set the \link CbcModel::CbcMaxNumNode maximum node limit \endlink inline bool setMaximumNodes( int value) { return setIntParam(CbcMaxNumNode, value); } /// Get the \link CbcModel::CbcMaxNumNode maximum node limit \endlink inline int getMaximumNodes() const { return getIntParam(CbcMaxNumNode); } /** Set the \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink desired. */ inline bool setMaximumSolutions( int value) { return setIntParam(CbcMaxNumSol, value); } /** Get the \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink desired. */ inline int getMaximumSolutions() const { return getIntParam(CbcMaxNumSol); } /// Set the printing mode inline bool setPrintingMode( int value) { return setIntParam(CbcPrinting, value); } /// Get the printing mode inline int getPrintingMode() const { return getIntParam(CbcPrinting); } /** Set the \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink desired. */ inline bool setMaximumSeconds( double value) { return setDblParam(CbcMaximumSeconds, value); } /** Get the \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink desired. */ inline double getMaximumSeconds() const { return getDblParam(CbcMaximumSeconds); } /// Current time since start of branchAndbound double getCurrentSeconds() const ; /// Return true if maximum time reached bool maximumSecondsReached() const ; /** Set the \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink */ inline bool setIntegerTolerance( double value) { return setDblParam(CbcIntegerTolerance, value); } /** Get the \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink */ inline double getIntegerTolerance() const { return getDblParam(CbcIntegerTolerance); } /** Set the \link CbcModel::CbcInfeasibilityWeight weight per integer infeasibility \endlink */ inline bool setInfeasibilityWeight( double value) { return setDblParam(CbcInfeasibilityWeight, value); } /** Get the \link CbcModel::CbcInfeasibilityWeight weight per integer infeasibility \endlink */ inline double getInfeasibilityWeight() const { return getDblParam(CbcInfeasibilityWeight); } /** Set the \link CbcModel::CbcAllowableGap allowable gap \endlink between the best known solution and the best possible solution. */ inline bool setAllowableGap( double value) { return setDblParam(CbcAllowableGap, value); } /** Get the \link CbcModel::CbcAllowableGap allowable gap \endlink between the best known solution and the best possible solution. */ inline double getAllowableGap() const { return getDblParam(CbcAllowableGap); } /** Set the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink between the best known solution and the best possible solution. */ inline bool setAllowableFractionGap( double value) { return setDblParam(CbcAllowableFractionGap, value); } /** Get the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink between the best known solution and the best possible solution. */ inline double getAllowableFractionGap() const { return getDblParam(CbcAllowableFractionGap); } /** Set the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink between the best known solution and the best possible solution. */ inline bool setAllowablePercentageGap( double value) { return setDblParam(CbcAllowableFractionGap, value*0.01); } /** Get the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink between the best known solution and the best possible solution. */ inline double getAllowablePercentageGap() const { return 100.0*getDblParam(CbcAllowableFractionGap); } /** Set the \link CbcModel::CbcHeuristicGap heuristic gap \endlink between the best known solution and the best possible solution. */ inline bool setHeuristicGap( double value) { return setDblParam(CbcHeuristicGap, value); } /** Get the \link CbcModel::CbcHeuristicGap heuristic gap \endlink between the best known solution and the best possible solution. */ inline double getHeuristicGap() const { return getDblParam(CbcHeuristicGap); } /** Set the \link CbcModel::CbcHeuristicFractionGap fraction heuristic gap \endlink between the best known solution and the best possible solution. */ inline bool setHeuristicFractionGap( double value) { return setDblParam(CbcHeuristicFractionGap, value); } /** Get the \link CbcModel::CbcHeuristicFractionGap fraction heuristic gap \endlink between the best known solution and the best possible solution. */ inline double getHeuristicFractionGap() const { return getDblParam(CbcHeuristicFractionGap); } /** Set the \link CbcModel::CbcCutoffIncrement \endlink desired. */ inline bool setCutoffIncrement( double value) { return setDblParam(CbcCutoffIncrement, value); } /** Get the \link CbcModel::CbcCutoffIncrement \endlink desired. */ inline double getCutoffIncrement() const { return getDblParam(CbcCutoffIncrement); } /// See if can stop on gap bool canStopOnGap() const; /** Pass in target solution and optional priorities. If priorities then >0 means only branch if incorrect while <0 means branch even if correct. +1 or -1 are highest priority */ void setHotstartSolution(const double * solution, const int * priorities = NULL) ; /// Set the minimum drop to continue cuts inline void setMinimumDrop(double value) { minimumDrop_ = value; } /// Get the minimum drop to continue cuts inline double getMinimumDrop() const { return minimumDrop_; } /** Set the maximum number of cut passes at root node (default 20) Minimum drop can also be used for fine tuning */ inline void setMaximumCutPassesAtRoot(int value) { maximumCutPassesAtRoot_ = value; } /** Get the maximum number of cut passes at root node */ inline int getMaximumCutPassesAtRoot() const { return maximumCutPassesAtRoot_; } /** Set the maximum number of cut passes at other nodes (default 10) Minimum drop can also be used for fine tuning */ inline void setMaximumCutPasses(int value) { maximumCutPasses_ = value; } /** Get the maximum number of cut passes at other nodes (default 10) */ inline int getMaximumCutPasses() const { return maximumCutPasses_; } /** Get current cut pass number in this round of cuts. (1 is first pass) */ inline int getCurrentPassNumber() const { return currentPassNumber_; } /** Set current cut pass number in this round of cuts. (1 is first pass) */ inline void setCurrentPassNumber(int value) { currentPassNumber_ = value; } /** Set the maximum number of candidates to be evaluated for strong branching. A value of 0 disables strong branching. */ void setNumberStrong(int number); /** Get the maximum number of candidates to be evaluated for strong branching. */ inline int numberStrong() const { return numberStrong_; } /** Set global preferred way to branch -1 down, +1 up, 0 no preference */ inline void setPreferredWay(int value) { preferredWay_ = value; } /** Get the preferred way to branch (default 0) */ inline int getPreferredWay() const { return preferredWay_; } /// Get at which depths to do cuts inline int whenCuts() const { return whenCuts_; } /// Set at which depths to do cuts inline void setWhenCuts(int value) { whenCuts_ = value; } /** Return true if we want to do cuts If allowForTopOfTree zero then just does on multiples of depth if 1 then allows for doing at top of tree if 2 then says if cuts allowed anywhere apart from root */ bool doCutsNow(int allowForTopOfTree) const; /** Set the number of branches before pseudo costs believed in dynamic strong branching. A value of 0 disables dynamic strong branching. */ void setNumberBeforeTrust(int number); /** get the number of branches before pseudo costs believed in dynamic strong branching. */ inline int numberBeforeTrust() const { return numberBeforeTrust_; } /** Set the number of variables for which to compute penalties in dynamic strong branching. A value of 0 disables penalties. */ void setNumberPenalties(int number); /** get the number of variables for which to compute penalties in dynamic strong branching. */ inline int numberPenalties() const { return numberPenalties_; } /// Pointer to top of tree inline const CbcFullNodeInfo * topOfTree() const { return topOfTree_;} /// Number of analyze iterations to do inline void setNumberAnalyzeIterations(int number) { numberAnalyzeIterations_ = number; } inline int numberAnalyzeIterations() const { return numberAnalyzeIterations_; } /** Get scale factor to make penalties match strong. Should/will be computed */ inline double penaltyScaleFactor() const { return penaltyScaleFactor_; } /** Set scale factor to make penalties match strong. Should/will be computed */ void setPenaltyScaleFactor(double value); /** Problem type as set by user or found by analysis. This will be extended 0 - not known 1 - Set partitioning <= 2 - Set partitioning == 3 - Set covering 4 - all +- 1 or all +1 and odd */ void inline setProblemType(int number) { problemType_ = number; } inline int problemType() const { return problemType_; } /// Current depth inline int currentDepth() const { return currentDepth_; } /// Set how often to scan global cuts void setHowOftenGlobalScan(int number); /// Get how often to scan global cuts inline int howOftenGlobalScan() const { return howOftenGlobalScan_; } /// Original columns as created by integerPresolve or preprocessing inline int * originalColumns() const { return originalColumns_; } /// Set original columns as created by preprocessing void setOriginalColumns(const int * originalColumns, int numberGood=COIN_INT_MAX) ; /// Create conflict cut (well - most of) OsiRowCut * conflictCut(const OsiSolverInterface * solver, bool & localCuts); /** Set the print frequency. Controls the number of nodes evaluated between status prints. If number <=0 the print frequency is set to 100 nodes for large problems, 1000 for small problems. Print frequency has very slight overhead if small. */ inline void setPrintFrequency(int number) { printFrequency_ = number; } /// Get the print frequency inline int printFrequency() const { return printFrequency_; } //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? bool isAbandoned() const; /// Is optimality proven? bool isProvenOptimal() const; /// Is infeasiblity proven (or none better than cutoff)? bool isProvenInfeasible() const; /// Was continuous solution unbounded bool isContinuousUnbounded() const; /// Was continuous solution unbounded bool isProvenDualInfeasible() const; /// Node limit reached? bool isNodeLimitReached() const; /// Time limit reached? bool isSecondsLimitReached() const; /// Solution limit reached? bool isSolutionLimitReached() const; /// Get how many iterations it took to solve the problem. inline int getIterationCount() const { return numberIterations_; } /// Increment how many iterations it took to solve the problem. inline void incrementIterationCount(int value) { numberIterations_ += value; } /// Get how many Nodes it took to solve the problem (including those in complete fathoming B&B inside CLP). inline int getNodeCount() const { return numberNodes_; } /// Increment how many nodes it took to solve the problem. inline void incrementNodeCount(int value) { numberNodes_ += value; } /// Get how many Nodes were enumerated in complete fathoming B&B inside CLP inline int getExtraNodeCount() const { return numberExtraNodes_; } /// Get how many times complete fathoming B&B was done inline int getFathomCount() const { return numberFathoms_; } /** Final status of problem Some of these can be found out by is...... functions -1 before branchAndBound 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found (or check value of best solution) 1 stopped - on maxnodes, maxsols, maxtime 2 difficulties so run was abandoned (5 event user programmed event occurred) */ inline int status() const { return status_; } inline void setProblemStatus(int value) { status_ = value; } /** Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 linear relaxation not feasible (or worse than cutoff) 2 stopped on gap 3 stopped on nodes 4 stopped on time 5 stopped on user event 6 stopped on solutions 7 linear relaxation unbounded 8 stopped on iteration limit */ inline int secondaryStatus() const { return secondaryStatus_; } inline void setSecondaryStatus(int value) { secondaryStatus_ = value; } /// Are there numerical difficulties (for initialSolve) ? bool isInitialSolveAbandoned() const ; /// Is optimality proven (for initialSolve) ? bool isInitialSolveProvenOptimal() const ; /// Is primal infeasiblity proven (for initialSolve) ? bool isInitialSolveProvenPrimalInfeasible() const ; /// Is dual infeasiblity proven (for initialSolve) ? bool isInitialSolveProvenDualInfeasible() const ; //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /// Number of rows in continuous (root) problem. inline int numberRowsAtContinuous() const { return numberRowsAtContinuous_; } /// Get number of columns inline int getNumCols() const { return solver_->getNumCols(); } /// Get number of rows inline int getNumRows() const { return solver_->getNumRows(); } /// Get number of nonzero elements inline CoinBigIndex getNumElements() const { return solver_->getNumElements(); } /// Number of integers in problem inline int numberIntegers() const { return numberIntegers_; } // Integer variables inline const int * integerVariable() const { return integerVariable_; } /// Whether or not integer inline char integerType(int i) const { assert (integerInfo_); assert (integerInfo_[i] == 0 || integerInfo_[i] == 1); return integerInfo_[i]; } /// Whether or not integer inline const char * integerType() const { return integerInfo_; } /// Get pointer to array[getNumCols()] of column lower bounds inline const double * getColLower() const { return solver_->getColLower(); } /// Get pointer to array[getNumCols()] of column upper bounds inline const double * getColUpper() const { return solver_->getColUpper(); } /** Get pointer to array[getNumRows()] of row constraint senses.
    • 'L': <= constraint
    • 'E': = constraint
    • 'G': >= constraint
    • 'R': ranged constraint
    • 'N': free constraint
    */ inline const char * getRowSense() const { return solver_->getRowSense(); } /** Get pointer to array[getNumRows()] of rows right-hand sides
    • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
    • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'N' then rhs()[i] == 0.0
    */ inline const double * getRightHandSide() const { return solver_->getRightHandSide(); } /** Get pointer to array[getNumRows()] of row ranges.
    • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
    • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
    */ inline const double * getRowRange() const { return solver_->getRowRange(); } /// Get pointer to array[getNumRows()] of row lower bounds inline const double * getRowLower() const { return solver_->getRowLower(); } /// Get pointer to array[getNumRows()] of row upper bounds inline const double * getRowUpper() const { return solver_->getRowUpper(); } /// Get pointer to array[getNumCols()] of objective function coefficients inline const double * getObjCoefficients() const { return solver_->getObjCoefficients(); } /// Get objective function sense (1 for min (default), -1 for max) inline double getObjSense() const { //assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense()); return dblParam_[CbcOptimizationDirection]; } /// Return true if variable is continuous inline bool isContinuous(int colIndex) const { return solver_->isContinuous(colIndex); } /// Return true if variable is binary inline bool isBinary(int colIndex) const { return solver_->isBinary(colIndex); } /** Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ inline bool isInteger(int colIndex) const { return solver_->isInteger(colIndex); } /// Return true if variable is general integer inline bool isIntegerNonBinary(int colIndex) const { return solver_->isIntegerNonBinary(colIndex); } /// Return true if variable is binary and not fixed at either bound inline bool isFreeBinary(int colIndex) const { return solver_->isFreeBinary(colIndex) ; } /// Get pointer to row-wise copy of matrix inline const CoinPackedMatrix * getMatrixByRow() const { return solver_->getMatrixByRow(); } /// Get pointer to column-wise copy of matrix inline const CoinPackedMatrix * getMatrixByCol() const { return solver_->getMatrixByCol(); } /// Get solver's value for infinity inline double getInfinity() const { return solver_->getInfinity(); } /// Get pointer to array[getNumCols()] (for speed) of column lower bounds inline const double * getCbcColLower() const { return cbcColLower_; } /// Get pointer to array[getNumCols()] (for speed) of column upper bounds inline const double * getCbcColUpper() const { return cbcColUpper_; } /// Get pointer to array[getNumRows()] (for speed) of row lower bounds inline const double * getCbcRowLower() const { return cbcRowLower_; } /// Get pointer to array[getNumRows()] (for speed) of row upper bounds inline const double * getCbcRowUpper() const { return cbcRowUpper_; } /// Get pointer to array[getNumCols()] (for speed) of primal solution vector inline const double * getCbcColSolution() const { return cbcColSolution_; } /// Get pointer to array[getNumRows()] (for speed) of dual prices inline const double * getCbcRowPrice() const { return cbcRowPrice_; } /// Get a pointer to array[getNumCols()] (for speed) of reduced costs inline const double * getCbcReducedCost() const { return cbcReducedCost_; } /// Get pointer to array[getNumRows()] (for speed) of row activity levels. inline const double * getCbcRowActivity() const { return cbcRowActivity_; } //@} /**@name Methods related to querying the solution */ //@{ /// Holds solution at continuous (after cuts if branchAndBound called) inline double * continuousSolution() const { return continuousSolution_; } /** Array marked whenever a solution is found if non-zero. Code marks if heuristic returns better so heuristic need only mark if it wants to on solutions which are worse than current */ inline int * usedInSolution() const { return usedInSolution_; } /// Increases usedInSolution for nonzeros void incrementUsed(const double * solution); /// Record a new incumbent solution and update objectiveValue void setBestSolution(CBC_Message how, double & objectiveValue, const double *solution, int fixVariables = 0); /// Just update objectiveValue void setBestObjectiveValue( double objectiveValue); /// Deals with event handler and solution CbcEventHandler::CbcAction dealWithEventHandler(CbcEventHandler::CbcEvent event, double objValue, const double * solution); /** Call this to really test if a valid solution can be feasible Solution is number columns in size. If fixVariables true then bounds of continuous solver updated. Returns objective value (worse than cutoff if not feasible) Previously computed objective value is now passed in (in case user does not do solve) virtual so user can override */ virtual double checkSolution(double cutoff, double * solution, int fixVariables, double originalObjValue); /** Test the current solution for feasiblility. Scan all objects for indications of infeasibility. This is broken down into simple integer infeasibility (\p numberIntegerInfeasibilities) and all other reports of infeasibility (\p numberObjectInfeasibilities). */ bool feasibleSolution(int & numberIntegerInfeasibilities, int & numberObjectInfeasibilities) const; /** Solution to the most recent lp relaxation. The solver's solution to the most recent lp relaxation. */ inline double * currentSolution() const { return currentSolution_; } /** For testing infeasibilities - will point to currentSolution_ or solver-->getColSolution() */ inline const double * testSolution() const { return testSolution_; } inline void setTestSolution(const double * solution) { testSolution_ = solution; } /// Make sure region there and optionally copy solution void reserveCurrentSolution(const double * solution = NULL); /// Get pointer to array[getNumCols()] of primal solution vector inline const double * getColSolution() const { return solver_->getColSolution(); } /// Get pointer to array[getNumRows()] of dual prices inline const double * getRowPrice() const { return solver_->getRowPrice(); } /// Get a pointer to array[getNumCols()] of reduced costs inline const double * getReducedCost() const { return solver_->getReducedCost(); } /// Get pointer to array[getNumRows()] of row activity levels. inline const double * getRowActivity() const { return solver_->getRowActivity(); } /// Get current objective function value inline double getCurrentObjValue() const { return dblParam_[CbcCurrentObjectiveValue]; } /// Get current minimization objective function value inline double getCurrentMinimizationObjValue() const { return dblParam_[CbcCurrentMinimizationObjectiveValue]; } /// Get best objective function value as minimization inline double getMinimizationObjValue() const { return bestObjective_; } /// Set best objective function value as minimization inline void setMinimizationObjValue(double value) { bestObjective_ = value; } /// Get best objective function value inline double getObjValue() const { return bestObjective_ * solver_->getObjSense() ; } /** Get best possible objective function value. This is better of best possible left on tree and best solution found. If called from within branch and cut may be optimistic. */ double getBestPossibleObjValue() const; /// Set best objective function value inline void setObjValue(double value) { bestObjective_ = value * solver_->getObjSense() ; } /// Get solver objective function value (as minimization) inline double getSolverObjValue() const { return solver_->getObjValue() * solver_->getObjSense() ; } /** The best solution to the integer programming problem. The best solution to the integer programming problem found during the search. If no solution is found, the method returns null. */ inline double * bestSolution() const { return bestSolution_; } /** User callable setBestSolution. If check false does not check valid If true then sees if feasible and warns if objective value worse than given (so just set to COIN_DBL_MAX if you don't care). If check true then does not save solution if not feasible */ void setBestSolution(const double * solution, int numberColumns, double objectiveValue, bool check = false); /// Get number of solutions inline int getSolutionCount() const { return numberSolutions_; } /// Set number of solutions (so heuristics will be different) inline void setSolutionCount(int value) { numberSolutions_ = value; } /// Number of saved solutions (including best) int numberSavedSolutions() const; /// Maximum number of extra saved solutions inline int maximumSavedSolutions() const { return maximumSavedSolutions_; } /// Set maximum number of extra saved solutions void setMaximumSavedSolutions(int value); /// Return a saved solution (0==best) - NULL if off end const double * savedSolution(int which) const; /// Return a saved solution objective (0==best) - COIN_DBL_MAX if off end double savedSolutionObjective(int which) const; /// Delete a saved solution and move others up void deleteSavedSolution(int which); /** Current phase (so heuristics etc etc can find out). 0 - initial solve 1 - solve with cuts at root 2 - solve with cuts 3 - other e.g. strong branching 4 - trying to validate a solution 5 - at end of search */ inline int phase() const { return phase_; } /// Get number of heuristic solutions inline int getNumberHeuristicSolutions() const { return numberHeuristicSolutions_; } /// Set number of heuristic solutions inline void setNumberHeuristicSolutions(int value) { numberHeuristicSolutions_ = value; } /// Set objective function sense (1 for min (default), -1 for max,) inline void setObjSense(double s) { dblParam_[CbcOptimizationDirection] = s; solver_->setObjSense(s); } /// Value of objective at continuous inline double getContinuousObjective() const { return originalContinuousObjective_; } inline void setContinuousObjective(double value) { originalContinuousObjective_ = value; } /// Number of infeasibilities at continuous inline int getContinuousInfeasibilities() const { return continuousInfeasibilities_; } inline void setContinuousInfeasibilities(int value) { continuousInfeasibilities_ = value; } /// Value of objective after root node cuts added inline double rootObjectiveAfterCuts() const { return continuousObjective_; } /// Sum of Changes to objective by first solve inline double sumChangeObjective() const { return sumChangeObjective1_; } /** Number of times global cuts violated. When global cut pool then this should be kept for each cut and type of cut */ inline int numberGlobalViolations() const { return numberGlobalViolations_; } inline void clearNumberGlobalViolations() { numberGlobalViolations_ = 0; } /// Whether to force a resolve after takeOffCuts inline bool resolveAfterTakeOffCuts() const { return resolveAfterTakeOffCuts_; } inline void setResolveAfterTakeOffCuts(bool yesNo) { resolveAfterTakeOffCuts_ = yesNo; } /// Maximum number of rows inline int maximumRows() const { return maximumRows_; } /// Work basis for temporary use inline CoinWarmStartBasis & workingBasis() { return workingBasis_; } /// Get number of "iterations" to stop after inline int getStopNumberIterations() const { return stopNumberIterations_; } /// Set number of "iterations" to stop after inline void setStopNumberIterations(int value) { stopNumberIterations_ = value; } /// A pointer to model from CbcHeuristic inline CbcModel * heuristicModel() const { return heuristicModel_;} /// Set a pointer to model from CbcHeuristic inline void setHeuristicModel(CbcModel * model) { heuristicModel_ = model;} //@} /** \name Node selection */ //@{ // Comparison functions (which may be overridden by inheritance) inline CbcCompareBase * nodeComparison() const { return nodeCompare_; } void setNodeComparison(CbcCompareBase * compare); void setNodeComparison(CbcCompareBase & compare); //@} /** \name Problem feasibility checking */ //@{ // Feasibility functions (which may be overridden by inheritance) inline CbcFeasibilityBase * problemFeasibility() const { return problemFeasibility_; } void setProblemFeasibility(CbcFeasibilityBase * feasibility); void setProblemFeasibility(CbcFeasibilityBase & feasibility); //@} /** \name Tree methods and subtree methods */ //@{ /// Tree method e.g. heap (which may be overridden by inheritance) inline CbcTree * tree() const { return tree_; } /// For modifying tree handling (original is cloned) void passInTreeHandler(CbcTree & tree); /** For passing in an CbcModel to do a sub Tree (with derived tree handlers). Passed in model must exist for duration of branch and bound */ void passInSubTreeModel(CbcModel & model); /** For retrieving a copy of subtree model with given OsiSolver. If no subtree model will use self (up to user to reset cutoff etc). If solver NULL uses current */ CbcModel * subTreeModel(OsiSolverInterface * solver = NULL) const; /// Returns number of times any subtree stopped on nodes, time etc inline int numberStoppedSubTrees() const { return numberStoppedSubTrees_; } /// Says a sub tree was stopped inline void incrementSubTreeStopped() { numberStoppedSubTrees_++; } /** Whether to automatically do presolve before branch and bound (subTrees). 0 - no 1 - ordinary presolve 2 - integer presolve (dodgy) */ inline int typePresolve() const { return presolve_; } inline void setTypePresolve(int value) { presolve_ = value; } //@} /** \name Branching Decisions See the CbcBranchDecision class for additional information. */ //@{ /// Get the current branching decision method. inline CbcBranchDecision * branchingMethod() const { return branchingMethod_; } /// Set the branching decision method. inline void setBranchingMethod(CbcBranchDecision * method) { delete branchingMethod_; branchingMethod_ = method->clone(); } /** Set the branching method \overload */ inline void setBranchingMethod(CbcBranchDecision & method) { delete branchingMethod_; branchingMethod_ = method.clone(); } /// Get the current cut modifier method inline CbcCutModifier * cutModifier() const { return cutModifier_; } /// Set the cut modifier method void setCutModifier(CbcCutModifier * modifier); /** Set the cut modifier method \overload */ void setCutModifier(CbcCutModifier & modifier); //@} /** \name Row (constraint) and Column (variable) cut generation */ //@{ /** State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no solution but many nodes */ inline int stateOfSearch() const { return stateOfSearch_; } inline void setStateOfSearch(int state) { stateOfSearch_ = state; } /// Strategy worked out - mainly at root node for use by CbcNode inline int searchStrategy() const { return searchStrategy_; } /// Set strategy worked out - mainly at root node for use by CbcNode inline void setSearchStrategy(int value) { searchStrategy_ = value; } /// Stong branching strategy inline int strongStrategy() const { return strongStrategy_; } /// Set strong branching strategy inline void setStrongStrategy(int value) { strongStrategy_ = value; } /// Get the number of cut generators inline int numberCutGenerators() const { return numberCutGenerators_; } /// Get the list of cut generators inline CbcCutGenerator ** cutGenerators() const { return generator_; } ///Get the specified cut generator inline CbcCutGenerator * cutGenerator(int i) const { return generator_[i]; } ///Get the specified cut generator before any changes inline CbcCutGenerator * virginCutGenerator(int i) const { return virginGenerator_[i]; } /** Add one generator - up to user to delete generators. howoften affects how generator is used. 0 or 1 means always, >1 means every that number of nodes. Negative values have same meaning as positive but they may be switched off (-> -100) by code if not many cuts generated at continuous. -99 is just done at root. Name is just for printout. If depth >0 overrides how often generator is called (if howOften==-1 or >0). */ void addCutGenerator(CglCutGenerator * generator, int howOften = 1, const char * name = NULL, bool normal = true, bool atSolution = false, bool infeasible = false, int howOftenInSub = -100, int whatDepth = -1, int whatDepthInSub = -1); //@} /** \name Strategy and sub models See the CbcStrategy class for additional information. */ //@{ /// Get the current strategy inline CbcStrategy * strategy() const { return strategy_; } /// Set the strategy. Clones void setStrategy(CbcStrategy & strategy); /// Set the strategy. assigns inline void setStrategy(CbcStrategy * strategy) { strategy_ = strategy; } /// Get the current parent model inline CbcModel * parentModel() const { return parentModel_; } /// Set the parent model inline void setParentModel(CbcModel & parentModel) { parentModel_ = &parentModel; } //@} /** \name Heuristics and priorities */ //@{ /*! \brief Add one heuristic - up to user to delete The name is just used for print messages. */ void addHeuristic(CbcHeuristic * generator, const char *name = NULL, int before = -1); ///Get the specified heuristic inline CbcHeuristic * heuristic(int i) const { return heuristic_[i]; } /// Get the number of heuristics inline int numberHeuristics() const { return numberHeuristics_; } /// Set the number of heuristics inline void setNumberHeuristics(int value) { numberHeuristics_ = value; } /// Pointer to heuristic solver which found last solution (or NULL) inline CbcHeuristic * lastHeuristic() const { return lastHeuristic_; } /// set last heuristic which found a solution inline void setLastHeuristic(CbcHeuristic * last) { lastHeuristic_ = last; } /** Pass in branching priorities. If ifClique then priorities are on cliques otherwise priorities are on integer variables. Other type (if exists set to default) 1 is highest priority. (well actually -INT_MAX is but that's ugly) If hotstart > 0 then branches are created to force the variable to the value given by best solution. This enables a sort of hot start. The node choice should be greatest depth and hotstart should normally be switched off after a solution. If ifNotSimpleIntegers true then appended to normal integers This is now deprecated except for simple usage. If user creates Cbcobjects then set priority in them \internal Added for Kurt Spielberg. */ void passInPriorities(const int * priorities, bool ifNotSimpleIntegers); /// Returns priority level for an object (or 1000 if no priorities exist) inline int priority(int sequence) const { return object_[sequence]->priority(); } /*! \brief Set an event handler A clone of the handler passed as a parameter is stored in CbcModel. */ void passInEventHandler(const CbcEventHandler *eventHandler) ; /*! \brief Retrieve a pointer to the event handler */ inline CbcEventHandler* getEventHandler() const { return (eventHandler_) ; } //@} /**@name Setting/Accessing application data */ //@{ /** Set application data. This is a pointer that the application can store into and retrieve from the solver interface. This field is available for the application to optionally define and use. */ void setApplicationData (void * appData); /// Get application data void * getApplicationData() const; /** For advanced applications you may wish to modify the behavior of Cbc e.g. if the solver is a NLP solver then you may not have an exact optimum solution at each step. Information could be built into OsiSolverInterface but this is an alternative so that that interface does not have to be changed. If something similar is useful to enough solvers then it could be migrated You can also pass in by using solver->setAuxiliaryInfo. You should do that if solver is odd - if solver is normal simplex then use this. NOTE - characteristics are not cloned */ void passInSolverCharacteristics(OsiBabSolver * solverCharacteristics); /// Get solver characteristics inline const OsiBabSolver * solverCharacteristics() const { return solverCharacteristics_; } //@} //--------------------------------------------------------------------------- /**@name Message handling etc */ //@{ /// Pass in Message handler (not deleted at end) void passInMessageHandler(CoinMessageHandler * handler); /// Set language void newLanguage(CoinMessages::Language language); inline void setLanguage(CoinMessages::Language language) { newLanguage(language); } /// Return handler inline CoinMessageHandler * messageHandler() const { return handler_; } /// Return messages inline CoinMessages & messages() { return messages_; } /// Return pointer to messages inline CoinMessages * messagesPointer() { return &messages_; } /// Set log level void setLogLevel(int value); /// Get log level inline int logLevel() const { return handler_->logLevel(); } /** Set flag to say if handler_ is the default handler. The default handler is deleted when the model is deleted. Other handlers (supplied by the client) will not be deleted. */ inline void setDefaultHandler(bool yesNo) { defaultHandler_ = yesNo; } /// Check default handler inline bool defaultHandler() const { return defaultHandler_; } //@} //--------------------------------------------------------------------------- ///@name Specialized //@{ /** Set special options 0 bit (1) - check if cuts valid (if on debugger list) 1 bit (2) - use current basis to check integer solution (rather than all slack) 2 bit (4) - don't check integer solution (by solving LP) 3 bit (8) - fast analyze 4 bit (16) - non-linear model - so no well defined CoinPackedMatrix 5 bit (32) - keep names 6 bit (64) - try for dominated columns 7 bit (128) - SOS type 1 but all declared integer 8 bit (256) - Set to say solution just found, unset by doing cuts 9 bit (512) - Try reduced model after 100 nodes 10 bit (1024) - Switch on some heuristics even if seems unlikely 11 bit (2048) - Mark as in small branch and bound 12 bit (4096) - Funny cuts so do slow way (in some places) 13 bit (8192) - Funny cuts so do slow way (in other places) 14 bit (16384) - Use Cplex! for fathoming 15 bit (32768) - Try reduced model after 0 nodes 16 bit (65536) - Original model had integer bounds 17 bit (131072) - Perturbation switched off 18 bit (262144) - donor CbcModel 19 bit (524288) - recipient CbcModel 20 bit (1048576) - waiting for sub model to return 22 bit (4194304) - do not initialize random seed in solver (user has) 23 bit (8388608) - leave solver_ with cuts 24 bit (16777216) - just get feasible if no cutoff */ inline void setSpecialOptions(int value) { specialOptions_ = value; } /// Get special options inline int specialOptions() const { return specialOptions_; } /// Set random seed inline void setRandomSeed(int value) { randomSeed_ = value; } /// Get random seed inline int getRandomSeed() const { return randomSeed_; } /// Set multiple root tries inline void setMultipleRootTries(int value) { multipleRootTries_ = value; } /// Get multiple root tries inline int getMultipleRootTries() const { return multipleRootTries_; } /// Tell model to stop on event inline void sayEventHappened() { eventHappened_=true;} /// Says if normal solver i.e. has well defined CoinPackedMatrix inline bool normalSolver() const { return (specialOptions_&16) == 0; } /** Says if model is sitting there waiting for mini branch and bound to finish This is because an event handler may only have access to parent model in mini branch and bound */ inline bool waitingForMiniBranchAndBound() const { return (specialOptions_&1048576) != 0; } /** Set more special options at present bottom 6 bits used for shadow price mode 1024 for experimental hotstart 2048,4096 breaking out of cuts 8192 slowly increase minimum drop 16384 gomory 32768 more heuristics in sub trees 65536 no cuts in preprocessing 131072 Time limits elapsed 18 bit (262144) - Perturb fathom nodes 19 bit (524288) - No limit on fathom nodes 20 bit (1048576) - Reduce sum of infeasibilities before cuts 21 bit (2097152) - Reduce sum of infeasibilities after cuts 22 bit (4194304) - Conflict analysis 23 bit (8388608) - Conflict analysis - temporary bit 24 bit (16777216) - Add cutoff as LP constraint (out) 25 bit (33554432) - diving/reordering 26 bit (67108864) - load global cuts from file 27 bit (134217728) - append binding global cuts to file 28 bit (268435456) - idiot branching 29 bit (536870912) - don't make fake objective 30 bit (1073741824) - Funny SOS or similar - be careful */ inline void setMoreSpecialOptions(int value) { moreSpecialOptions_ = value; } /// Get more special options inline int moreSpecialOptions() const { return moreSpecialOptions_; } /** Set more more special options 0 bit (1) - find switching variables 1 bit (2) - using fake objective until solution 2 bit (4) - switching variables exist 3 bit (8) - skip most of setBestSolution checks 4 bit (16) - very lightweight preprocessing in smallB&B 5 bit (32) - event handler needs to be cloned when parallel 6 bit (64) - testing - use probing to make cliques 7/8 bit (128) - try orbital branching (if nauty) 9 bit (512) - branching on objective (later) 10 bit (1024) - branching on constraints (later) 11/12 bit 2048 - intermittent cuts 13/14 bit 8192 - go to bitter end in strong branching (first time) */ inline void setMoreSpecialOptions2(int value) { moreSpecialOptions2_ = value; } /// Get more special options2 inline int moreSpecialOptions2() const { return moreSpecialOptions2_; } /// Set cutoff as constraint inline void setCutoffAsConstraint(bool yesNo) { cutoffRowNumber_ = (yesNo) ? -2 : -1; } /// Set time method inline void setUseElapsedTime(bool yesNo) { if (yesNo) moreSpecialOptions_ |= 131072; else moreSpecialOptions_ &= ~131072; } /// Get time method inline bool useElapsedTime() const { return (moreSpecialOptions_&131072)!=0; } /// Get useful temporary pointer inline void * temporaryPointer() const { return temporaryPointer_;} /// Set useful temporary pointer inline void setTemporaryPointer(void * pointer) { temporaryPointer_=pointer;} /// Go to dantzig pivot selection if easy problem (clp only) void goToDantzig(int numberNodes, ClpDualRowPivot *& savePivotMethod); /// Now we may not own objects - just point to solver's objects inline bool ownObjects() const { return ownObjects_; } /// Check original model before it gets messed up void checkModel(); //@} //--------------------------------------------------------------------------- ///@name Constructors and destructors etc //@{ /// Default Constructor CbcModel(); /// Constructor from solver CbcModel(const OsiSolverInterface &); /** Assign a solver to the model (model assumes ownership) On return, \p solver will be NULL. If deleteSolver then current solver deleted (if model owned) \note Parameter settings in the outgoing solver are not inherited by the incoming solver. */ void assignSolver(OsiSolverInterface *&solver, bool deleteSolver = true); /** \brief Set ownership of solver A parameter of false tells CbcModel it does not own the solver and should not delete it. Once you claim ownership of the solver, you're responsible for eventually deleting it. Note that CbcModel clones solvers with abandon. Unless you have a deep understanding of the workings of CbcModel, the only time you want to claim ownership is when you're about to delete the CbcModel object but want the solver to continue to exist (as, for example, when branchAndBound has finished and you want to hang on to the answer). */ inline void setModelOwnsSolver (bool ourSolver) { ownership_ = ourSolver ? (ownership_ | 0x80000000) : (ownership_ & (~0x80000000)) ; } /*! \brief Get ownership of solver A return value of true means that CbcModel owns the solver and will take responsibility for deleting it when that becomes necessary. */ inline bool modelOwnsSolver () { return ((ownership_&0x80000000) != 0) ; } /** Copy constructor . If cloneHandler is true then message handler is cloned */ CbcModel(const CbcModel & rhs, bool cloneHandler = false); /** Clone */ virtual CbcModel *clone (bool cloneHandler); /// Assignment operator CbcModel & operator=(const CbcModel& rhs); /// Destructor virtual ~CbcModel (); /// Returns solver - has current state inline OsiSolverInterface * solver() const { return solver_; } /// Returns current solver - sets new one inline OsiSolverInterface * swapSolver(OsiSolverInterface * solver) { OsiSolverInterface * returnSolver = solver_; solver_ = solver; return returnSolver; } /// Returns solver with continuous state inline OsiSolverInterface * continuousSolver() const { return continuousSolver_; } /// Create solver with continuous state inline void createContinuousSolver() { continuousSolver_ = solver_->clone(); } /// Clear solver with continuous state inline void clearContinuousSolver() { delete continuousSolver_; continuousSolver_ = NULL; } /// A copy of the solver, taken at constructor or by saveReferenceSolver inline OsiSolverInterface * referenceSolver() const { return referenceSolver_; } /// Save a copy of the current solver so can be reset to void saveReferenceSolver(); /** Uses a copy of reference solver to be current solver. Because of possible mismatches all exotic integer information is loat (apart from normal information in OsiSolverInterface) so SOS etc and priorities will have to be redone */ void resetToReferenceSolver(); /// Clears out as much as possible (except solver) void gutsOfDestructor(); /** Clears out enough to reset CbcModel as if no branch and bound done */ void gutsOfDestructor2(); /** Clears out enough to reset CbcModel cutoff etc */ void resetModel(); /** Most of copy constructor mode - 0 copy but don't delete before 1 copy and delete before 2 copy and delete before (but use virgin generators) */ void gutsOfCopy(const CbcModel & rhs, int mode = 0); /// Move status, nodes etc etc across void moveInfo(const CbcModel & rhs); //@} ///@name Multithreading //@{ /// Indicates whether Cbc library has been compiled with multithreading support static bool haveMultiThreadSupport(); /// Get pointer to masterthread CbcThread * masterThread() const { return masterThread_; } /// Get pointer to walkback CbcNodeInfo ** walkback() const { return walkback_; } /// Get number of threads inline int getNumberThreads() const { return numberThreads_; } /// Set number of threads inline void setNumberThreads(int value) { numberThreads_ = value; } /// Get thread mode inline int getThreadMode() const { return threadMode_; } /** Set thread mode always use numberThreads for branching 1 set then deterministic 2 set then use numberThreads for root cuts 4 set then use numberThreads in root mini branch and bound 8 set and numberThreads - do heuristics numberThreads at a time 8 set and numberThreads==0 do all heuristics at once default is 0 */ inline void setThreadMode(int value) { threadMode_ = value; } /** Return -2 if deterministic threaded and main thread -1 if deterministic threaded and serial thread 0 if serial 1 if opportunistic threaded */ inline int parallelMode() const { if (!numberThreads_) { if ((threadMode_&1) == 0) return 0; else return -1; return 0; } else { if ((threadMode_&1) == 0) return 1; else return -2; } } /// Thread stuff for master inline CbcBaseModel * master() const { return master_;} /// From here to end of section - code in CbcThread.cpp until class changed /// Returns true if locked bool isLocked() const; #ifdef CBC_THREAD /** Locks a thread if parallel so that stuff like cut pool can be updated and/or used. */ void lockThread(); /** Unlocks a thread if parallel to say cut pool stuff not needed */ void unlockThread(); #else inline void lockThread() {} inline void unlockThread() {} #endif /** Set information in a child -3 pass pointer to child thread info -2 just stop -1 delete simple child stuff 0 delete opportunistic child stuff 1 delete deterministic child stuff */ void setInfoInChild(int type, CbcThread * info); /** Move/copy information from one model to another -1 - initialization 0 - from base model 1 - to base model (and reset) 2 - add in final statistics etc (and reset so can do clean destruction) */ void moveToModel(CbcModel * baseModel, int mode); /// Split up nodes int splitModel(int numberModels, CbcModel ** model, int numberNodes); /// Start threads void startSplitModel(int numberIterations); /// Merge models void mergeModels(int numberModel, CbcModel ** model, int numberNodes); //@} ///@name semi-private i.e. users should not use //@{ /// Get how many Nodes it took to solve the problem. int getNodeCount2() const { return numberNodes2_; } /// Set pointers for speed void setPointers(const OsiSolverInterface * solver); /** Perform reduced cost fixing Fixes integer variables at their current value based on reduced cost penalties. Returns number fixed */ int reducedCostFix() ; /** Makes all handlers same. If makeDefault 1 then makes top level default and rest point to that. If 2 then each is copy */ void synchronizeHandlers(int makeDefault); /// Save a solution to saved list void saveExtraSolution(const double * solution, double objectiveValue); /// Save a solution to best and move current to saved void saveBestSolution(const double * solution, double objectiveValue); /// Delete best and saved solutions void deleteSolutions(); /// Encapsulates solver resolve int resolve(OsiSolverInterface * solver); #ifdef CLP_RESOLVE /// Special purpose resolve int resolveClp(OsiClpSolverInterface * solver, int type); #endif /** Encapsulates choosing a variable - anyAction -2, infeasible (-1 round again), 0 done */ int chooseBranch(CbcNode * & newNode, int numberPassesLeft, CbcNode * oldNode, OsiCuts & cuts, bool & resolved, CoinWarmStartBasis *lastws, const double * lowerBefore, const double * upperBefore, OsiSolverBranch * & branches); int chooseBranch(CbcNode * newNode, int numberPassesLeft, bool & resolved); /** Return an empty basis object of the specified size A useful utility when constructing a basis for a subproblem from scratch. The object returned will be of the requested capacity and appropriate for the solver attached to the model. */ CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ; /** Remove inactive cuts from the model An OsiSolverInterface is expected to maintain a valid basis, but not a valid solution, when loose cuts are deleted. Restoring a valid solution requires calling the solver to reoptimise. If it's certain the solution will not be required, set allowResolve to false to suppress reoptimisation. If saveCuts then slack cuts will be saved On input current cuts are cuts and newCuts on exit current cuts will be correct. Returns number dropped */ int takeOffCuts(OsiCuts &cuts, bool allowResolve, OsiCuts * saveCuts, int numberNewCuts = 0, const OsiRowCut ** newCuts = NULL) ; /** Determine and install the active cuts that need to be added for the current subproblem The whole truth is a bit more complicated. The first action is a call to addCuts1(). addCuts() then sorts through the list, installs the tight cuts in the model, and does bookkeeping (adjusts reference counts). The basis returned from addCuts1() is adjusted accordingly. If it turns out that the node should really be fathomed by bound, addCuts() simply treats all the cuts as loose as it does the bookkeeping. */ int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws); /** Traverse the tree from node to root and prep the model addCuts1() begins the job of prepping the model to match the current subproblem. The model is stripped of all cuts, and the search tree is traversed from node to root to determine the changes required. Appropriate bounds changes are installed, a list of cuts is collected but not installed, and an appropriate basis (minus the cuts, but big enough to accommodate them) is constructed. Returns true if new problem similar to old \todo addCuts1() is called in contexts where it's known in advance that all that's desired is to determine a list of cuts and do the bookkeeping (adjust the reference counts). The work of installing bounds and building a basis goes to waste. */ bool addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws); /** Returns bounds just before where - initially original bounds. Also sets downstream nodes (lower if force 1, upper if 2) */ void previousBounds (CbcNode * node, CbcNodeInfo * where, int iColumn, double & lower, double & upper, int force); /** Set objective value in a node. This is separated out so that odd solvers can use. It may look at extra information in solverCharacteriscs_ and will also use bound from parent node */ void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const; /** If numberBeforeTrust >0 then we are going to use CbcBranchDynamic. Scan and convert CbcSimpleInteger objects */ void convertToDynamic(); /// Set numberBeforeTrust in all objects void synchronizeNumberBeforeTrust(int type = 0); /// Zap integer information in problem (may leave object info) void zapIntegerInformation(bool leaveObjects = true); /// Use cliques for pseudocost information - return nonzero if infeasible int cliquePseudoCosts(int doStatistics); /// Fill in useful estimates void pseudoShadow(int type); /** Return pseudo costs If not all integers or not pseudo costs - returns all zero Length of arrays are numberIntegers() and entries correspond to integerVariable()[i] User must allocate arrays before call */ void fillPseudoCosts(double * downCosts, double * upCosts, int * priority = NULL, int * numberDown = NULL, int * numberUp = NULL, int * numberDownInfeasible = NULL, int * numberUpInfeasible = NULL) const; /** Do heuristics at root. 0 - don't delete 1 - delete 2 - just delete - don't even use */ void doHeuristicsAtRoot(int deleteHeuristicsAfterwards = 0); /// Adjust heuristics based on model void adjustHeuristics(); /// Get the hotstart solution inline const double * hotstartSolution() const { return hotstartSolution_; } /// Get the hotstart priorities inline const int * hotstartPriorities() const { return hotstartPriorities_; } /// Return the list of cuts initially collected for this subproblem inline CbcCountRowCut ** addedCuts() const { return addedCuts_; } /// Number of entries in the list returned by #addedCuts() inline int currentNumberCuts() const { return currentNumberCuts_; } /// Global cuts inline CbcRowCuts * globalCuts() { return &globalCuts_; } /// Get rid of global cuts inline void zapGlobalCuts() { globalCuts_ = CbcRowCuts(); } /// Copy and set a pointer to a row cut which will be added instead of normal branching. void setNextRowCut(const OsiRowCut & cut); /// Get a pointer to current node (be careful) inline CbcNode * currentNode() const { return currentNode_; } /// Get a pointer to probing info inline CglTreeProbingInfo * probingInfo() const { return probingInfo_; } /// Thread specific random number generator inline CoinThreadRandom * randomNumberGenerator() { return &randomNumberGenerator_; } /// Set the number of iterations done in strong branching. inline void setNumberStrongIterations(int number) { numberStrongIterations_ = number; } /// Get the number of iterations done in strong branching. inline int numberStrongIterations() const { return numberStrongIterations_; } /// Get maximum number of iterations (designed to be used in heuristics) inline int maximumNumberIterations() const { return maximumNumberIterations_; } /// Set maximum number of iterations (designed to be used in heuristics) inline void setMaximumNumberIterations(int value) { maximumNumberIterations_ = value; } /// Symmetry information inline CbcSymmetry * symmetryInfo() const { return symmetryInfo_;} /// Set depth for fast nodes inline void setFastNodeDepth(int value) { fastNodeDepth_ = value; } /// Get depth for fast nodes inline int fastNodeDepth() const { return fastNodeDepth_; } /// Get anything with priority >= this can be treated as continuous inline int continuousPriority() const { return continuousPriority_; } /// Set anything with priority >= this can be treated as continuous inline void setContinuousPriority(int value) { continuousPriority_ = value; } inline void incrementExtra(int nodes, int iterations, int fathoms=1) { numberExtraNodes_ += nodes; numberExtraIterations_ += iterations; numberFathoms_ += fathoms; } /// Zero extra inline void zeroExtra() { numberExtraNodes_ = 0; numberExtraIterations_ = 0; numberFathoms_ = 0; } /// Number of extra iterations inline int numberExtraIterations() const { return numberExtraIterations_; } /// Increment strong info void incrementStrongInfo(int numberTimes, int numberIterations, int numberFixed, bool ifInfeasible); /// Return strong info inline const int * strongInfo() const { return strongInfo_; } /// Return mutable strong info inline int * mutableStrongInfo() { return strongInfo_; } /// Get stored row cuts for donor/recipient CbcModel CglStored * storedRowCuts() const { return storedRowCuts_; } /// Set stored row cuts for donor/recipient CbcModel void setStoredRowCuts(CglStored * cuts) { storedRowCuts_ = cuts; } /// Says whether all dynamic integers inline bool allDynamic () const { return ((ownership_&0x40000000) != 0) ; } /// Create C++ lines to get to current state void generateCpp( FILE * fp, int options); /// Generate an OsiBranchingInformation object OsiBranchingInformation usefulInformation() const; /** Warm start object produced by heuristic or strong branching If get a valid integer solution outside branch and bound then it can take a reasonable time to solve LP which produces clean solution. If this object has any size then it will be used in solve. */ inline void setBestSolutionBasis(const CoinWarmStartBasis & bestSolutionBasis) { bestSolutionBasis_ = bestSolutionBasis; } /// Redo walkback arrays void redoWalkBack(); //@} void setMIPStart( const std::vector< std::pair< std::string, double > > &mips ) { this->mipStart_ = mips; } const std::vector< std::pair< std::string, double > > &getMIPStart() { return this->mipStart_; } //--------------------------------------------------------------------------- private: ///@name Private member data //@{ /// The solver associated with this model. OsiSolverInterface * solver_; /** Ownership of objects and other stuff 0x80000000 model owns solver 0x40000000 all variables CbcDynamicPseudoCost */ unsigned int ownership_ ; /// A copy of the solver, taken at the continuous (root) node. OsiSolverInterface * continuousSolver_; /// A copy of the solver, taken at constructor or by saveReferenceSolver OsiSolverInterface * referenceSolver_; /// Message handler CoinMessageHandler * handler_; /** Flag to say if handler_ is the default handler. The default handler is deleted when the model is deleted. Other handlers (supplied by the client) will not be deleted. */ bool defaultHandler_; /// Cbc messages CoinMessages messages_; /// Array for integer parameters int intParam_[CbcLastIntParam]; /// Array for double parameters double dblParam_[CbcLastDblParam]; /** Pointer to an empty warm start object It turns out to be useful to have this available as a base from which to build custom warm start objects. This is typed as CoinWarmStart rather than CoinWarmStartBasis to allow for the possibility that a client might want to apply a solver that doesn't use a basis-based warm start. See getEmptyBasis for an example of how this field can be used. */ mutable CoinWarmStart *emptyWarmStart_ ; /// Best objective double bestObjective_; /// Best possible objective double bestPossibleObjective_; /// Sum of Changes to objective by first solve double sumChangeObjective1_; /// Sum of Changes to objective by subsequent solves double sumChangeObjective2_; /// Array holding the incumbent (best) solution. double * bestSolution_; /// Arrays holding other solutions. double ** savedSolutions_; /** Array holding the current solution. This array is used more as a temporary. */ double * currentSolution_; /** For testing infeasibilities - will point to currentSolution_ or solver-->getColSolution() */ mutable const double * testSolution_; /** MIPstart values values for integer variables which will be converted to a complete integer initial feasible solution */ std::vector< std::pair< std::string, double > > mipStart_; /** Warm start object produced by heuristic or strong branching If get a valid integer solution outside branch and bound then it can take a reasonable time to solve LP which produces clean solution. If this object has any size then it will be used in solve. */ CoinWarmStartBasis bestSolutionBasis_ ; /// Global cuts CbcRowCuts globalCuts_; /// Global conflict cuts CbcRowCuts * globalConflictCuts_; /// Minimum degradation in objective value to continue cut generation double minimumDrop_; /// Number of solutions int numberSolutions_; /// Number of saved solutions int numberSavedSolutions_; /// Maximum number of saved solutions int maximumSavedSolutions_; /** State of search 0 - no solution 1 - only heuristic solutions 2 - branched to a solution 3 - no solution but many nodes */ int stateOfSearch_; /// At which depths to do cuts int whenCuts_; /// Hotstart solution double * hotstartSolution_; /// Hotstart priorities int * hotstartPriorities_; /// Number of heuristic solutions int numberHeuristicSolutions_; /// Cumulative number of nodes int numberNodes_; /** Cumulative number of nodes for statistics. Must fix to match up */ int numberNodes2_; /// Cumulative number of iterations int numberIterations_; /// Cumulative number of solves int numberSolves_; /// Status of problem - 0 finished, 1 stopped, 2 difficulties int status_; /** Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 linear relaxation not feasible (or worse than cutoff) 2 stopped on gap 3 stopped on nodes 4 stopped on time 5 stopped on user event 6 stopped on solutions */ int secondaryStatus_; /// Number of integers in problem int numberIntegers_; /// Number of rows at continuous int numberRowsAtContinuous_; /** -1 - cutoff as constraint not activated -2 - waiting to activate >=0 - activated */ int cutoffRowNumber_; /// Maximum number of cuts int maximumNumberCuts_; /** Current phase (so heuristics etc etc can find out). 0 - initial solve 1 - solve with cuts at root 2 - solve with cuts 3 - other e.g. strong branching 4 - trying to validate a solution 5 - at end of search */ int phase_; /// Number of entries in #addedCuts_ int currentNumberCuts_; /** Current limit on search tree depth The allocated size of #walkback_. Increased as needed. */ int maximumDepth_; /** Array used to assemble the path between a node and the search tree root The array is resized when necessary. #maximumDepth_ is the current allocated size. */ CbcNodeInfo ** walkback_; CbcNodeInfo ** lastNodeInfo_; const OsiRowCut ** lastCut_; int lastDepth_; int lastNumberCuts2_; int maximumCuts_; int * lastNumberCuts_; /** The list of cuts initially collected for this subproblem When the subproblem at this node is rebuilt, a set of cuts is collected for inclusion in the constraint system. If any of these cuts are subsequently removed because they have become loose, the corresponding entry is set to NULL. */ CbcCountRowCut ** addedCuts_; /** A pointer to a row cut which will be added instead of normal branching. After use it should be set to NULL. */ OsiRowCut * nextRowCut_; /// Current node so can be used elsewhere CbcNode * currentNode_; /// Indices of integer variables int * integerVariable_; /// Whether of not integer char * integerInfo_; /// Holds solution at continuous (after cuts) double * continuousSolution_; /// Array marked whenever a solution is found if non-zero int * usedInSolution_; /** Special options 0 bit (1) - check if cuts valid (if on debugger list) 1 bit (2) - use current basis to check integer solution (rather than all slack) 2 bit (4) - don't check integer solution (by solving LP) 3 bit (8) - fast analyze 4 bit (16) - non-linear model - so no well defined CoinPackedMatrix 5 bit (32) - keep names 6 bit (64) - try for dominated columns 7 bit (128) - SOS type 1 but all declared integer 8 bit (256) - Set to say solution just found, unset by doing cuts 9 bit (512) - Try reduced model after 100 nodes 10 bit (1024) - Switch on some heuristics even if seems unlikely 11 bit (2048) - Mark as in small branch and bound 12 bit (4096) - Funny cuts so do slow way (in some places) 13 bit (8192) - Funny cuts so do slow way (in other places) 14 bit (16384) - Use Cplex! for fathoming 15 bit (32768) - Try reduced model after 0 nodes 16 bit (65536) - Original model had integer bounds 17 bit (131072) - Perturbation switched off 18 bit (262144) - donor CbcModel 19 bit (524288) - recipient CbcModel 20 bit (1048576) - waiting for sub model to return 22 bit (4194304) - do not initialize random seed in solver (user has) 23 bit (8388608) - leave solver_ with cuts 24 bit (16777216) - just get feasible if no cutoff */ int specialOptions_; /** More special options at present bottom 6 bits used for shadow price mode 1024 for experimental hotstart 2048,4096 breaking out of cuts 8192 slowly increase minimum drop 16384 gomory 32768 more heuristics in sub trees 65536 no cuts in preprocessing 131072 Time limits elapsed 18 bit (262144) - Perturb fathom nodes 19 bit (524288) - No limit on fathom nodes 20 bit (1048576) - Reduce sum of infeasibilities before cuts 21 bit (2097152) - Reduce sum of infeasibilities after cuts */ int moreSpecialOptions_; /** More more special options 0 bit (1) - find switching variables 1 bit (2) - using fake objective until solution 2 bit (4) - switching variables exist 3 bit (8) - skip most of setBestSolution checks 4 bit (16) - very lightweight preprocessing in smallB&B 5 bit (32) - event handler needs to be cloned when parallel 6 bit (64) - testing - use probing to make cliques 7/8 bit (128) - try orbital branching (if nauty) 9 bit (512) - branching on objective (later) 10 bit (1024) - branching on constraints (later) 11/12 bit 2048 - intermittent cuts */ int moreSpecialOptions2_; /// User node comparison function CbcCompareBase * nodeCompare_; /// User feasibility function (see CbcFeasibleBase.hpp) CbcFeasibilityBase * problemFeasibility_; /// Tree CbcTree * tree_; /// Pointer to top of tree CbcFullNodeInfo * topOfTree_; /// A pointer to model to be used for subtrees CbcModel * subTreeModel_; /// A pointer to model from CbcHeuristic CbcModel * heuristicModel_; /// Number of times any subtree stopped on nodes, time etc int numberStoppedSubTrees_; /// Variable selection function CbcBranchDecision * branchingMethod_; /// Cut modifier function CbcCutModifier * cutModifier_; /// Strategy CbcStrategy * strategy_; /// Parent model CbcModel * parentModel_; /** Whether to automatically do presolve before branch and bound. 0 - no 1 - ordinary presolve 2 - integer presolve (dodgy) */ /// Pointer to array[getNumCols()] (for speed) of column lower bounds const double * cbcColLower_; /// Pointer to array[getNumCols()] (for speed) of column upper bounds const double * cbcColUpper_; /// Pointer to array[getNumRows()] (for speed) of row lower bounds const double * cbcRowLower_; /// Pointer to array[getNumRows()] (for speed) of row upper bounds const double * cbcRowUpper_; /// Pointer to array[getNumCols()] (for speed) of primal solution vector const double * cbcColSolution_; /// Pointer to array[getNumRows()] (for speed) of dual prices const double * cbcRowPrice_; /// Get a pointer to array[getNumCols()] (for speed) of reduced costs const double * cbcReducedCost_; /// Pointer to array[getNumRows()] (for speed) of row activity levels. const double * cbcRowActivity_; /// Pointer to user-defined data structure void * appData_; /// Presolve for CbcTreeLocal int presolve_; /** Maximum number of candidates to consider for strong branching. To disable strong branching, set this to 0. */ int numberStrong_; /** \brief The number of branches before pseudo costs believed in dynamic strong branching. A value of 0 is off. */ int numberBeforeTrust_; /** \brief The number of variables for which to compute penalties in dynamic strong branching. */ int numberPenalties_; /// For threads - stop after this many "iterations" int stopNumberIterations_; /** Scale factor to make penalties match strong. Should/will be computed */ double penaltyScaleFactor_; /// Number of analyze iterations to do int numberAnalyzeIterations_; /// Arrays with analysis results double * analyzeResults_; /// Useful temporary pointer void * temporaryPointer_; /// Number of nodes infeasible by normal branching (before cuts) int numberInfeasibleNodes_; /** Problem type as set by user or found by analysis. This will be extended 0 - not known 1 - Set partitioning <= 2 - Set partitioning == 3 - Set covering */ int problemType_; /// Print frequency int printFrequency_; /// Number of cut generators int numberCutGenerators_; // Cut generators CbcCutGenerator ** generator_; // Cut generators before any changes CbcCutGenerator ** virginGenerator_; /// Number of heuristics int numberHeuristics_; /// Heuristic solvers CbcHeuristic ** heuristic_; /// Pointer to heuristic solver which found last solution (or NULL) CbcHeuristic * lastHeuristic_; /// Depth for fast nodes int fastNodeDepth_; /*! Pointer to the event handler */ # ifdef CBC_ONLY_CLP ClpEventHandler *eventHandler_ ; # else CbcEventHandler *eventHandler_ ; # endif /// Symmetry information CbcSymmetry * symmetryInfo_; /// Total number of objects int numberObjects_; /** \brief Integer and Clique and ... information \note The code assumes that the first objects on the list will be SimpleInteger objects for each integer variable, followed by Clique objects. Portions of the code that understand Clique objects will fail if they do not immediately follow the SimpleIntegers. Large chunks of the code will fail if the first objects are not SimpleInteger. As of 2003.08, SimpleIntegers and Cliques are the only objects. */ OsiObject ** object_; /// Now we may not own objects - just point to solver's objects bool ownObjects_; /// Original columns as created by integerPresolve or preprocessing int * originalColumns_; /// How often to scan global cuts int howOftenGlobalScan_; /** Number of times global cuts violated. When global cut pool then this should be kept for each cut and type of cut */ int numberGlobalViolations_; /// Number of extra iterations in fast lp int numberExtraIterations_; /// Number of extra nodes in fast lp int numberExtraNodes_; /// Number of times fast lp entered int numberFathoms_; /** Value of objective at continuous (Well actually after initial round of cuts) */ double continuousObjective_; /** Value of objective before root node cuts added */ double originalContinuousObjective_; /// Number of infeasibilities at continuous int continuousInfeasibilities_; /// Maximum number of cut passes at root int maximumCutPassesAtRoot_; /// Maximum number of cut passes int maximumCutPasses_; /// Preferred way of branching int preferredWay_; /// Current cut pass number int currentPassNumber_; /// Maximum number of cuts (for whichGenerator_) int maximumWhich_; /// Maximum number of rows int maximumRows_; /// Random seed int randomSeed_; /// Multiple root tries int multipleRootTries_; /// Current depth int currentDepth_; /// Thread specific random number generator mutable CoinThreadRandom randomNumberGenerator_; /// Work basis for temporary use CoinWarmStartBasis workingBasis_; /// Which cut generator generated this cut int * whichGenerator_; /// Maximum number of statistics int maximumStatistics_; /// statistics CbcStatistics ** statistics_; /// Maximum depth reached int maximumDepthActual_; /// Number of reduced cost fixings double numberDJFixed_; /// Probing info CglTreeProbingInfo * probingInfo_; /// Number of fixed by analyze at root int numberFixedAtRoot_; /// Number fixed by analyze so far int numberFixedNow_; /// Whether stopping on gap bool stoppedOnGap_; /// Whether event happened mutable bool eventHappened_; /// Number of long strong goes int numberLongStrong_; /// Number of old active cuts int numberOldActiveCuts_; /// Number of new cuts int numberNewCuts_; /// Strategy worked out - mainly at root node int searchStrategy_; /** Strategy for strong branching 0 - normal when to do all fractional 1 - root node 2 - depth less than modifier 4 - if objective == best possible 6 - as 2+4 when to do all including satisfied 10 - root node etc. If >=100 then do when depth <= strategy/100 (otherwise 5) */ int strongStrategy_; /// Number of iterations in strong branching int numberStrongIterations_; /** 0 - number times strong branching done, 1 - number fixed, 2 - number infeasible Second group of three is a snapshot at node [6] */ int strongInfo_[7]; /** For advanced applications you may wish to modify the behavior of Cbc e.g. if the solver is a NLP solver then you may not have an exact optimum solution at each step. This gives characteristics - just for one BAB. For actually saving/restoring a solution you need the actual solver one. */ OsiBabSolver * solverCharacteristics_; /// Whether to force a resolve after takeOffCuts bool resolveAfterTakeOffCuts_; /// Maximum number of iterations (designed to be used in heuristics) int maximumNumberIterations_; /// Anything with priority >= this can be treated as continuous int continuousPriority_; /// Number of outstanding update information items int numberUpdateItems_; /// Maximum number of outstanding update information items int maximumNumberUpdateItems_; /// Update items CbcObjectUpdateData * updateItems_; /// Stored row cuts for donor/recipient CbcModel CglStored * storedRowCuts_; /** Parallel 0 - off 1 - testing 2-99 threads other special meanings */ int numberThreads_; /** thread mode always use numberThreads for branching 1 set then deterministic 2 set then use numberThreads for root cuts 4 set then use numberThreads in root mini branch and bound default is 0 */ int threadMode_; /// Number of global cuts on entry to a node int numberGlobalCutsIn_; /// Thread stuff for master CbcBaseModel * master_; /// Pointer to masterthread CbcThread * masterThread_; //@} }; /// So we can use osiObject or CbcObject during transition void getIntegerInformation(const OsiObject * object, double & originalLower, double & originalUpper) ; // So we can call from other programs // Real main program class OsiClpSolverInterface; int CbcMain (int argc, const char *argv[], OsiClpSolverInterface & solver, CbcModel ** babSolver); int CbcMain (int argc, const char *argv[], CbcModel & babSolver); // four ways of calling int callCbc(const char * input2, OsiClpSolverInterface& solver1); int callCbc(const char * input2); int callCbc(const std::string input2, OsiClpSolverInterface& solver1); int callCbc(const std::string input2) ; // When we want to load up CbcModel with options first void CbcMain0 (CbcModel & babSolver); int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver); // two ways of calling int callCbc(const char * input2, CbcModel & babSolver); int callCbc(const std::string input2, CbcModel & babSolver); // And when CbcMain0 already called to initialize int callCbc1(const char * input2, CbcModel & babSolver); int callCbc1(const std::string input2, CbcModel & babSolver); // And when CbcMain0 already called to initialize (with call back) (see CbcMain1 for whereFrom) int callCbc1(const char * input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom)); int callCbc1(const std::string input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom)); int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom)); // For uniform setting of cut and heuristic options void setCutAndHeuristicOptions(CbcModel & model); #endif CoinMP-1.8.3/Cbc/src/CbcBranchingObject.hpp0000644000175000017500000001751312131054770016744 0ustar renerene// $Id: CbcBranchingObject.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #ifndef CbcBranchingObject_H #define CbcBranchingObject_H #include #include #include "CbcBranchBase.hpp" #include "OsiBranchingObject.hpp" // The types of objects that will be derived from this class. enum CbcBranchObjType { SimpleIntegerBranchObj = 100, SimpleIntegerDynamicPseudoCostBranchObj = 101, CliqueBranchObj = 102, LongCliqueBranchObj = 103, SoSBranchObj = 104, NWayBranchObj = 105, FollowOnBranchObj = 106, DummyBranchObj = 107, GeneralDepthBranchObj = 108, OneGeneralBranchingObj = 110, CutBranchingObj = 200, LotsizeBranchObj = 300, DynamicPseudoCostBranchObj = 400 }; /** \brief Abstract branching object base class Now just difference with OsiBranchingObject In the abstract, an CbcBranchingObject contains instructions for how to branch. We want an abstract class so that we can describe how to branch on simple objects (e.g., integers) and more exotic objects (e.g., cliques or hyperplanes). The #branch() method is the crucial routine: it is expected to be able to step through a set of branch arms, executing the actions required to create each subproblem in turn. The base class is primarily virtual to allow for a wide range of problem modifications. See CbcObject for an overview of the three classes (CbcObject, CbcBranchingObject, and CbcBranchDecision) which make up cbc's branching model. */ class CbcBranchingObject : public OsiBranchingObject { public: /// Default Constructor CbcBranchingObject (); /// Constructor CbcBranchingObject (CbcModel * model, int variable, int way , double value); /// Copy constructor CbcBranchingObject ( const CbcBranchingObject &); /// Assignment operator CbcBranchingObject & operator=( const CbcBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const = 0; /// Destructor virtual ~CbcBranchingObject (); /** Some branchingObjects may claim to be able to skip strong branching. If so they have to fill in CbcStrongInfo. The object mention in incoming CbcStrongInfo must match. Returns nonzero if skip is wanted */ virtual int fillStrongInfo( CbcStrongInfo & ) { return 0; } /// Reset number of branches left to original inline void resetNumberBranchesLeft() { branchIndex_ = 0; } /// Set number of branches to do inline void setNumberBranches(int value) { branchIndex_ = 0; numberBranches_ = value; } /** \brief Execute the actions required to branch, as specified by the current state of the branching object, and advance the object's state. Mainly for diagnostics, whether it is true branch or strong branching is also passed. Returns change in guessed objective on next branch */ virtual double branch() = 0; /** \brief Execute the actions required to branch, as specified by the current state of the branching object, and advance the object's state. Mainly for diagnostics, whether it is true branch or strong branching is also passed. Returns change in guessed objective on next branch */ virtual double branch(OsiSolverInterface * ) { return branch(); } /** Update bounds in solver as in 'branch' and update given bounds. branchState is -1 for 'down' +1 for 'up' */ virtual void fix(OsiSolverInterface * , double * , double * , int ) const {} /** Change (tighten) bounds in object to reflect bounds in solver. Return true if now fixed */ virtual bool tighten(OsiSolverInterface * ) {return false;} /** Reset every information so that the branching object appears to point to the previous child. This method does not need to modify anything in any solver. */ virtual void previousBranch() { assert(branchIndex_ > 0); branchIndex_--; way_ = -way_; } using OsiBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print() const {} /** \brief Index identifying the associated CbcObject within its class. The name is misleading, and typically the index will not refer directly to a variable. Rather, it identifies an CbcObject within the class of similar CbcObjects E.g., for an CbcSimpleInteger, variable() is the index of the integer variable in the set of integer variables (not the index of the variable in the set of all variables). */ inline int variable() const { return variable_; } /** Get the state of the branching object Returns a code indicating the active arm of the branching object. The precise meaning is defined in the derived class. \sa #way_ */ inline int way() const { return way_; } /** Set the state of the branching object. See #way() */ inline void way(int way) { way_ = way; } /// update model inline void setModel(CbcModel * model) { model_ = model; } /// Return model inline CbcModel * model() const { return model_; } /// Return pointer back to object which created inline CbcObject * object() const { return originalCbcObject_; } /// Set pointer back to object which created inline void setOriginalObject(CbcObject * object) { originalCbcObject_ = object; } // Methods used in heuristics /** Return the type (an integer identifier) of \c this. See definition of CbcBranchObjType above for possibilities */ virtual CbcBranchObjType type() const = 0; /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const { const CbcBranchingObject* br = dynamic_cast(brObj); return variable() - br->variable(); } /** Compare the \c this with \c brObj. \c this and \c brObj must be of the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false) = 0; protected: /// The model that owns this branching object CbcModel * model_; /// Pointer back to object which created CbcObject * originalCbcObject_; /// Branching variable (0 is first integer) int variable_; // was - Way to branch - -1 down (first), 1 up, -2 down (second), 2 up (second) /** The state of the branching object. Specifies the active arm of the branching object. Coded as -1 to take the `down' arm, +1 for the `up' arm. `Down' and `up' are defined based on the natural meaning (floor and ceiling, respectively) for a simple integer. The precise meaning is defined in the derived class. */ int way_; }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicLocal.hpp0000644000175000017500000001636312172722151016636 0ustar renerene/* $Id: CbcHeuristicLocal.hpp 1943 2013-07-21 09:05:45Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicLocal_H #define CbcHeuristicLocal_H #include "CbcHeuristic.hpp" /** LocalSearch class */ class CbcHeuristicLocal : public CbcHeuristic { public: // Default Constructor CbcHeuristicLocal (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicLocal (CbcModel & model); // Copy constructor CbcHeuristicLocal ( const CbcHeuristicLocal &); // Destructor ~CbcHeuristicLocal (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicLocal & operator=(const CbcHeuristicLocal& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts First tries setting a variable to better value. If feasible then tries setting others. If not feasible then tries swaps ******** This first version does not do LP's and does swaps of two integer variables. Later versions could do Lps. */ virtual int solution(double & objectiveValue, double * newSolution); /// This version fixes stuff and does IP int solutionFix(double & objectiveValue, double * newSolution, const int * keep); /// Sets type of search inline void setSearchType(int value) { swap_ = value; } /// Used array so we can set inline int * used() const { return used_; } protected: // Data // Original matrix by column CoinPackedMatrix matrix_; // Number of solutions so we only do after new solution int numberSolutions_; // Type of search 0=normal, 1=BAB int swap_; /// Whether a variable has been in a solution (also when) int * used_; }; /** Proximity Search class */ class CbcHeuristicFPump; class CbcHeuristicProximity : public CbcHeuristic { public: // Default Constructor CbcHeuristicProximity (); /* Constructor with model - assumed before cuts */ CbcHeuristicProximity (CbcModel & model); // Copy constructor CbcHeuristicProximity ( const CbcHeuristicProximity &); // Destructor ~CbcHeuristicProximity (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicProximity & operator=(const CbcHeuristicProximity& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) */ virtual int solution(double & objectiveValue, double * newSolution); /// Set extra increment inline void setIncrement(double value) { increment_ = value;} /// Used array so we can set inline int * used() const { return used_; } protected: // Data /// Increment to use if no change double increment_; /// Copy of Feasibility pump CbcHeuristicFPump * feasibilityPump_; /// Number of solutions so we only do after new solution int numberSolutions_; /// Whether a variable has been in a solution (also when) int * used_; }; /** Naive class a) Fix all ints as close to zero as possible b) Fix all ints with nonzero costs and < large to zero c) Put bounds round continuous and UIs and maximize */ class CbcHeuristicNaive : public CbcHeuristic { public: // Default Constructor CbcHeuristicNaive (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicNaive (CbcModel & model); // Copy constructor CbcHeuristicNaive ( const CbcHeuristicNaive &); // Destructor ~CbcHeuristicNaive (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicNaive & operator=(const CbcHeuristicNaive& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) */ virtual int solution(double & objectiveValue, double * newSolution); /// Sets large cost value inline void setLargeValue(double value) { large_ = value; } /// Gets large cost value inline double largeValue() const { return large_; } protected: /// Data /// Large value double large_; }; /** Crossover Search class */ class CbcHeuristicCrossover : public CbcHeuristic { public: // Default Constructor CbcHeuristicCrossover (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicCrossover (CbcModel & model); // Copy constructor CbcHeuristicCrossover ( const CbcHeuristicCrossover &); // Destructor ~CbcHeuristicCrossover (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Fix variables if agree in useNumber_ solutions when_ 0 off, 1 only at new solutions, 2 also every now and then add 10 to make only if agree at lower bound */ virtual int solution(double & objectiveValue, double * newSolution); /// Sets number of solutions to use inline void setNumberSolutions(int value) { if (value > 0 && value <= 10) useNumber_ = value; } protected: // Data /// Attempts std::vector attempts_; /// Random numbers to stop same search happening double random_[10]; /// Number of solutions so we only do after new solution int numberSolutions_; /// Number of solutions to use int useNumber_; }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveVectorLength.cpp0000644000175000017500000001102412426717442021011 0ustar renerene/* $Id: CbcHeuristicDiveVectorLength.cpp 2093 2014-11-06 16:17:38Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcHeuristicDiveVectorLength.hpp" #include "CbcStrategy.hpp" // Default Constructor CbcHeuristicDiveVectorLength::CbcHeuristicDiveVectorLength() : CbcHeuristicDive() { } // Constructor from model CbcHeuristicDiveVectorLength::CbcHeuristicDiveVectorLength(CbcModel & model) : CbcHeuristicDive(model) { } // Destructor CbcHeuristicDiveVectorLength::~CbcHeuristicDiveVectorLength () { } // Clone CbcHeuristicDiveVectorLength * CbcHeuristicDiveVectorLength::clone() const { return new CbcHeuristicDiveVectorLength(*this); } // Create C++ lines to get to current state void CbcHeuristicDiveVectorLength::generateCpp( FILE * fp) { CbcHeuristicDiveVectorLength other; fprintf(fp, "0#include \"CbcHeuristicDiveVectorLength.hpp\"\n"); fprintf(fp, "3 CbcHeuristicDiveVectorLength heuristicDiveVectorLength(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicDiveVectorLength"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicDiveVectorLength);\n"); } // Copy constructor CbcHeuristicDiveVectorLength::CbcHeuristicDiveVectorLength(const CbcHeuristicDiveVectorLength & rhs) : CbcHeuristicDive(rhs) { } // Assignment operator CbcHeuristicDiveVectorLength & CbcHeuristicDiveVectorLength::operator=( const CbcHeuristicDiveVectorLength & rhs) { if (this != &rhs) { CbcHeuristicDive::operator=(rhs); } return *this; } bool CbcHeuristicDiveVectorLength::selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound) { const double * objective = solver->getObjCoefficients(); double direction = solver->getObjSense(); // 1 for min, -1 for max const int * columnLength = matrix_.getVectorLengths(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); bestColumn = -1; bestRound = -1; // -1 rounds down, +1 rounds up double bestScore = COIN_DBL_MAX; bool allTriviallyRoundableSoFar = true; int bestPriority = COIN_INT_MAX; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; double fraction = value - floor(value); int round = 0; if (fabs(floor(value + 0.5) - value) > integerTolerance) { if (allTriviallyRoundableSoFar || (downLocks_[i] > 0 && upLocks_[i] > 0)) { if (allTriviallyRoundableSoFar && downLocks_[i] > 0 && upLocks_[i] > 0) { allTriviallyRoundableSoFar = false; bestScore = COIN_DBL_MAX; } // the variable cannot be rounded double obj = direction * objective[iColumn]; if (obj > smallObjective_) { round = 1; // round up } else if (obj < -smallObjective_) { round = -1; // round down } else { if (fraction<0.4) round = -1; else round = 1; } double objDelta; if (round == 1) objDelta = (1.0 - fraction) * CoinMax(obj,smallObjective_); else objDelta = - fraction * CoinMin(obj,-smallObjective_); // we want the smaller score double score = objDelta / (static_cast (columnLength[iColumn]) + 1.0); // if variable is not binary, penalize it if (!solver->isBinary(iColumn)) score *= 1000.0; // if priorities then use if (priority_) { int thisRound=static_cast(priority_[i].direction); if ((thisRound&1)!=0) round = ((thisRound&2)==0) ? -1 : +1; if (priority_[i].priority>bestPriority) { score=COIN_DBL_MAX; } else if (priority_[i].priority(priority_[i].priority); bestScore=COIN_DBL_MAX; } } if (score < bestScore) { bestColumn = iColumn; bestScore = score; bestRound = round; } } } } return allTriviallyRoundableSoFar; } CoinMP-1.8.3/Cbc/src/unitTest.cpp0000644000175000017500000003362311575435606015140 0ustar renerene/* $Id: unitTest.cpp 1668 2011-06-13 16:32:06Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Test individual classes or groups of classes #include "CbcConfig.h" #include "CoinPragma.hpp" #include #include #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinFileIO.hpp" #ifdef COIN_HAS_CBC #include "OsiCbcSolverInterface.hpp" #endif #ifdef COIN_HAS_OSL #include "OsiOslSolverInterface.hpp" #endif #ifdef COIN_HAS_SPX #include "OsiSpxSolverInterface.hpp" #endif #ifdef COIN_HAS_DYLP #include "OsiDylpSolverInterface.hpp" #endif #ifdef COIN_HAS_GLPK #include "OsiGlpkSolverInterface.hpp" #endif #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif #ifdef NDEBUG #undef NDEBUG #endif #include "CoinTime.hpp" // Function Prototypes. Function definitions is in this file. void testingMessage( const char * const msg ); #ifdef COIN_HAS_CBC void CbcMiplibTest (const std::vector & vecEmptySiP, const std::string & mpsDir) { int i ; unsigned int m ; // See if files exist FILE * fp; bool doTest = false; std::string test1 = mpsDir + "p0033"; fp = fopen(test1.c_str(), "r"); if (fp) { doTest = true; fclose(fp); } if (!doTest && CoinFileInput::haveGzipSupport()) { test1 += ".gz"; fp = fopen(test1.c_str(), "r"); if (fp) { doTest = true; fclose(fp); } } if (!doTest) return; /* Vectors to hold test problem names and characteristics. The objective value after optimization (objValue) must agree to the specified tolerance (objValueTol). */ std::vector mpsName ; std::vector nRows ; std::vector nCols ; std::vector objValueC ; std::vector objValue ; std::vector strategy ; /* And a macro to make the vector creation marginally readable. */ #define PUSH_MPS(zz_mpsName_zz,\ zz_nRows_zz,zz_nCols_zz,zz_objValue_zz,zz_objValueC_zz, \ zz_strategy_zz) \ mpsName.push_back(zz_mpsName_zz) ; \ nRows.push_back(zz_nRows_zz) ; \ nCols.push_back(zz_nCols_zz) ; \ objValueC.push_back(zz_objValueC_zz) ; \ strategy.push_back(zz_strategy_zz) ; \ objValue.push_back(zz_objValue_zz) ; /* Load up the problem vector. Note that the row counts here include the objective function. Set HOWMANY to 0 for no test, 1 for some, 2 for many, 3 for all. */ #define HOWMANY 1 #if HOWMANY #if HOWMANY>1 PUSH_MPS("10teams", 230, 2025, 924, 917, 7) #endif PUSH_MPS("air03", 124, 10757, 340160, 338864.25, 7) #if HOWMANY==3 PUSH_MPS("air04", 823, 8904, 56137, 55535.436, 8) PUSH_MPS("air05", 426, 7195, 26374, 25877.609, 8) #endif // PUSH_MPS("arki001",1048,1388,7580813.0459,7579599.80787,7) PUSH_MPS("bell3a", 123, 133, 878430.32, 862578.64, 7) #if HOWMANY>1 PUSH_MPS("bell5", 91, 104, 8966406.49, 8608417.95, 7) #endif PUSH_MPS("blend2", 274, 353, 7.598985, 6.9156751140, 7) #if HOWMANY>1 PUSH_MPS("cap6000", 2176, 6000, -2451377, -2451537.325, 7) #endif // PUSH_MPS("dano3mip",3202,13873,728.1111,576.23162474,7) // PUSH_MPS("danoint",664,521,65.67,62.637280418,7) PUSH_MPS("dcmulti", 290, 548, 188182, 183975.5397, 7) PUSH_MPS("dsbmip", 1182, 1886, -305.19817501, -305.19817501, 7) PUSH_MPS("egout", 98, 141, 568.101, 149.589, 7) PUSH_MPS("enigma", 21, 100, 0.0, 0.0, 7) #if HOWMANY==3 PUSH_MPS("fast0507", 507, 63009, 174, 172.14556668, 7) #endif PUSH_MPS("fiber", 363, 1298, 405935.18000, 156082.51759, 7) #if HOWMANY>1 PUSH_MPS("fixnet6", 478, 878, 3983, 1200.88, 7) #endif PUSH_MPS("flugpl", 18, 18, 1201500, 1167185.7, 7) PUSH_MPS("gen", 780, 870, 112313, 112130.0, 7) #if HOWMANY>1 PUSH_MPS("gesa2", 1392, 1224, 25779856.372, 25476489.678, 7) PUSH_MPS("gesa2_o", 1248, 1224, 25779856.372, 25476489.678, 7) #endif PUSH_MPS("gesa3", 1368, 1152, 27991042.648, 27833632.451, 7) PUSH_MPS("gesa3_o", 1224, 1152, 27991042.648, 27833632.451, 7) PUSH_MPS("gt2", 29, 188, 21166.000, 13460.233074, 7) #if HOWMANY==3 PUSH_MPS("harp2", 112, 2993, -73899798.00, -74353341.502, 7) #endif PUSH_MPS("khb05250", 101, 1350, 106940226, 95919464.0, 7) #if HOWMANY>1 PUSH_MPS("l152lav", 97, 1989, 4722, 4656.36, 7) #endif PUSH_MPS("lseu", 28, 89, 1120, 834.68, 7) PUSH_MPS("misc03", 96, 160, 3360, 1910., 7) PUSH_MPS("misc06", 820, 1808, 12850.8607, 12841.6, 7) #if HOWMANY>1 PUSH_MPS("misc07", 212, 260, 2810, 1415.0, 7) PUSH_MPS("mitre", 2054, 10724, 115155, 114740.5184, 7) #endif PUSH_MPS("mod008", 6, 319, 307, 290.9, 7) PUSH_MPS("mod010", 146, 2655, 6548, 6532.08, 7) #if HOWMANY==3 PUSH_MPS("mod011", 4480, 10958, -54558535, -62121982.55, 7) PUSH_MPS("modglob", 291, 422, 20740508, 20430947., 7) PUSH_MPS("noswot", 182, 128, -43, -43.0, 7) #endif #if HOWMANY>1 PUSH_MPS("nw04", 36, 87482, 16862, 16310.66667, 7) #endif PUSH_MPS("p0033", 16, 33, 3089, 2520.57, 7) PUSH_MPS("p0201", 133, 201, 7615, 6875.0, 7) PUSH_MPS("p0282", 241, 282, 258411, 176867.50, 7) PUSH_MPS("p0548", 176, 548, 8691, 315.29, 7) PUSH_MPS("p2756", 755, 2756, 3124, 2688.75, 7) #if HOWMANY==3 PUSH_MPS("pk1", 45, 86, 11.0, 0.0, 7) #endif #if HOWMANY>1 PUSH_MPS("pp08a", 136, 240, 7350.0, 2748.3452381, 7) PUSH_MPS("pp08aCUTS", 246, 240, 7350.0, 5480.6061563, 7) #endif #if HOWMANY==3 PUSH_MPS("qiu", 1192, 840, -132.873137, -931.638857, 7) #endif PUSH_MPS("qnet1", 503, 1541, 16029.692681, 14274.102667, 7) PUSH_MPS("qnet1_o", 456, 1541, 16029.692681, 12095.571667, 7) PUSH_MPS("rentacar", 6803, 9557, 30356761, 28806137.644, 7) PUSH_MPS("rgn", 24, 180, 82.1999, 48.7999, 7) #if HOWMANY==3 PUSH_MPS("rout", 291, 556, 1077.56, 981.86428571, 7) PUSH_MPS("set1ch", 492, 712, 54537.75, 32007.73, 7) #endif // PUSH_MPS("seymour",4944,1372,423,403.84647413,7) PUSH_MPS("stein27", 118, 27, 18, 13.0, 7) #if HOWMANY>1 PUSH_MPS("stein45", 331, 45, 30, 22.0, 7) #endif PUSH_MPS("vpm1", 234, 378, 20, 15.4167, 7) PUSH_MPS("vpm2", 234, 378, 13.75, 9.8892645972, 7) #endif #undef PUSH_MPS /* Create a vector of solver interfaces that we can use to run the test problems. The strategy is to create a fresh clone of the `empty' solvers from vecEmptySiP for each problem, then proceed in stages: read the MPS file, solve the problem, check the solution. If there are multiple solvers in vecSiP, the results of each solver are compared with its neighbors in the vector. */ int numberSolvers = vecEmptySiP.size(); std::vector vecSiP(numberSolvers) ; // Create vector to store a name for each solver interface // and a count on the number of problems the solver interface solved. std::vector siName; std::vector numProbSolved; std::vector timeTaken; for ( i = 0; i < numberSolvers; i++ ) { std::string name; vecEmptySiP[i]->getStrParam(OsiSolverName, name); siName.push_back(name); numProbSolved.push_back(0); timeTaken.push_back(0.0); } /* Open the main loops. Outer loop steps through MPS problems, inner loop steps through solvers. */ for (m = 0 ; m < mpsName.size() ; m++) { std::cerr << " processing mps file: " << mpsName[m] << " (" << m + 1 << " out of " << mpsName.size() << ")" << std::endl ; for (i = vecSiP.size() - 1 ; i >= 0 ; --i) { vecSiP[i] = vecEmptySiP[i]->clone() ; /* Stage 1: Read the MPS file into the solver interface. As a basic check, make sure the size of the constraint matrix is correct. */ std::string fn = mpsDir + mpsName[m] ; vecSiP[i]->readMps(fn.c_str(), "") ; vecSiP[i]->setObjSense(1.0) ; int nr = vecSiP[i]->getNumRows() ; int nc = vecSiP[i]->getNumCols() ; assert(nr == nRows[m]) ; assert(nc == nCols[m]) ; /* Stage 2: Call the solver to get a solution for the LP relaxation. */ double startTime = CoinCpuTime(); OsiCbcSolverInterface * integerSolver = dynamic_cast(vecSiP[i]) ; assert(integerSolver); integerSolver->initialSolve(); /* Stage 3: Call the solver to perform branch and cut. We call each solver, then check the return code and objective. Limits are 50000 nodes and one hour of time. */ integerSolver->setMaximumNodes(50000); integerSolver->setMaximumSeconds(60*60); integerSolver->getModelPtr()->messageHandler()->setLogLevel(1) ; integerSolver->branchAndBound(); double timeOfSolution = CoinCpuTime() - startTime; if (!integerSolver->status()) { double soln = integerSolver->getObjValue(); CoinRelFltEq eq(1.0e-3) ; if (eq(soln, objValue[m])) { std::cerr << siName[i] << " " << soln << " = " << objValue[m] << " ; okay"; numProbSolved[i]++; } else { std::cerr << siName[i] << " " << soln << " != " << objValue[m] << "; error=" ; std::cerr << fabs(objValue[m] - soln); } } else { std::cerr << "error; too many nodes" ; } std::cerr << " - took " << timeOfSolution << " seconds." << std::endl; timeTaken[i] += timeOfSolution; delete integerSolver; } } const int siName_size = siName.size(); for ( i = 0; i < siName_size; i++ ) { std::cerr << siName[i] << " solved " << numProbSolved[i] << " out of " << objValue.size() << " and took " << timeTaken[i] << " seconds." << std::endl; } } #endif // COIN_HAS_CBC //---------------------------------------------------------------- // unitTest [-miplibDir=V2] // // where: // -miplibDir: directory containing miplib files // Default value V2="./examples/miplib3" // // All parameters are optional. //---------------------------------------------------------------- int mainTest (int argc, const char *argv[]) { int i; // define valid parameter keywords std::set definedKeyWords; definedKeyWords.insert("-miplibDir"); // Create a map of parameter keys and associated data std::map parms; for ( i = 1; i < argc; i++ ) { std::string parm(argv[i]); std::string key, value; unsigned int eqPos = parm.find('='); // Does parm contain and '=' if ( eqPos == std::string::npos ) { //Parm does not contain '=' key = parm; } else { key = parm.substr(0, eqPos); value = parm.substr(eqPos + 1); } // Is specifed key valid? if ( definedKeyWords.find(key) == definedKeyWords.end() ) { // invalid key word. // Write help text std::cerr << "Undefined parameter \"" << key << "\".\n"; std::cerr << "Correct usage: \n"; std::cerr << " unitTest [-miplibDir=V2] \n"; std::cerr << " where:\n"; std::cerr << " -miplibDir: directory containing miplib files\n"; std::cerr << " Default value V2=\"./Data/miplib3\"\n"; return 1; } parms[key] = value; } const char dirsep = CoinFindDirSeparator(); // Set directory containing miplib data files. std::string miplibDir; if (parms.find("-miplibDir") != parms.end()) miplibDir = parms["-miplibDir"] + dirsep; else miplibDir = dirsep == '/' ? "./Data/miplib3/" : ".\\Data\\miplib3\\"; #ifdef COIN_HAS_CBC { // Create vector of solver interfaces std::vector vecSi; CbcStrategyDefault strategy(0); # if COIN_HAS_OSL OsiSolverInterface * oslSi = new OsiOslSolverInterface; vecSi.push_back(new OsiCbcSolverInterface(oslSi, &strategy)); #endif # if COIN_HAS_SPX OsiSolverInterface * spxSi = new OsiSpxSolverInterface; vecSi.push_back(new OsiCbcSolverInterface(spxSi, &strategy)); #endif # if COIN_HAS_CLP OsiSolverInterface *clpSi = new OsiClpSolverInterface ; /* Quiet, already! */ clpSi->setHintParam(OsiDoReducePrint, true, OsiHintDo) ; vecSi.push_back(new OsiCbcSolverInterface(clpSi, &strategy)); #endif # if COIN_HAS_DYLP OsiSolverInterface * dylpSi = new OsiDylpSolverInterface; vecSi.push_back(new OsiCbcSolverInterface(dylpSi, &strategy)); #endif # if COIN_HAS_GLPK OsiSolverInterface * glpkSi = new OsiGlpkSolverInterface; vecSi.push_back(new OsiCbcSolverInterface(glpkSi, &strategy)); #endif testingMessage( "Testing some miplib stuff\n" ); CbcMiplibTest(vecSi, miplibDir); unsigned int i; for (i = 0; i < vecSi.size(); i++) delete vecSi[i]; } #else // COIN_HAS_CBC std::cerr << "cbc has been built without OsiCbc support. To enable the -miplib\n" << "option, you must enable libOsiCbc in Makefile.location, then\n" << "execute the command `make clean cbc' to rebuild the cbc program." << std::endl ; #endif // COIN_HAS_CBC testingMessage( "All tests completed successfully\n" ); return 0; } // Display message on stdout and stderr void testingMessage( const char * const msg ) { std::cerr << msg << std::endl ; // std::cout << msg << std::endl ; } CoinMP-1.8.3/Cbc/src/CbcSolverHeuristics.cpp0000644000175000017500000023431512452506557017246 0ustar renerene/* $Id: CbcSolverHeuristics.cpp 2105 2015-01-05 13:11:11Z forrest $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolverHeuristics.cpp \brief Second level routines for the cbc stand-alone solver. */ #include "CbcConfig.h" #include "CoinPragma.hpp" #include "CoinTime.hpp" #include "OsiClpSolverInterface.hpp" #include "ClpPresolve.hpp" #include "CbcOrClpParam.hpp" #include "CbcModel.hpp" #include "CbcHeuristicLocal.hpp" #include "CbcHeuristicPivotAndFix.hpp" //#include "CbcHeuristicPivotAndComplement.hpp" #include "CbcHeuristicRandRound.hpp" #include "CbcHeuristicGreedy.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcHeuristicRINS.hpp" #include "CbcHeuristicDW.hpp" #include "CbcHeuristicVND.hpp" #include "CbcHeuristicDiveCoefficient.hpp" #include "CbcHeuristicDiveFractional.hpp" #include "CbcHeuristicDiveGuided.hpp" #include "CbcHeuristicDiveVectorLength.hpp" #include "CbcHeuristicDivePseudoCost.hpp" #include "CbcHeuristicDiveLineSearch.hpp" #include "CbcStrategy.hpp" #include "OsiAuxInfo.hpp" #include "ClpSimplexOther.hpp" // Crunch down model void crunchIt(ClpSimplex * model) { #ifdef JJF_ZERO model->dual(); #else int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); // Use dual region double * rhs = model->dualRowSolution(); int * whichRow = new int[3*numberRows]; int * whichColumn = new int[2*numberColumns]; int nBound; ClpSimplex * small = static_cast (model)->crunch(rhs, whichRow, whichColumn, nBound, false, false); if (small) { small->dual(); if (small->problemStatus() == 0) { model->setProblemStatus(0); static_cast (model)->afterCrunch(*small, whichRow, whichColumn, nBound); } else if (small->problemStatus() != 3) { model->setProblemStatus(1); } else { if (small->problemStatus() == 3) { // may be problems small->computeObjectiveValue(); model->setObjectiveValue(small->objectiveValue()); model->setProblemStatus(3); } else { model->setProblemStatus(3); } } delete small; } else { model->setProblemStatus(1); } delete [] whichRow; delete [] whichColumn; #endif } /* On input doAction - 0 just fix in original and return NULL 1 return fixed non-presolved solver 2 as one but use presolve Inside this 3 use presolve and fix ones with large cost ? do heuristics and set best solution ? do BAB and just set best solution 10+ then use lastSolution and relax a few -2 cleanup afterwards if using 2 On output - number fixed */ OsiClpSolverInterface * fixVubs(CbcModel & model, int skipZero2, int & doAction, CoinMessageHandler * /*generalMessageHandler*/, const double * lastSolution, double dextra[6], int extra[5]) { if (doAction == 11 && !lastSolution) lastSolution = model.bestSolution(); assert (((doAction >= 0 && doAction <= 3) && !lastSolution) || (doAction == 11 && lastSolution)); double fractionIntFixed = dextra[3]; double fractionFixed = dextra[4]; double fixAbove = dextra[2]; double fixAboveValue = (dextra[5] > 0.0) ? dextra[5] : 1.0; #ifdef COIN_DETAIL double time1 = CoinCpuTime(); #endif int leaveIntFree = extra[1]; OsiSolverInterface * originalSolver = model.solver(); OsiClpSolverInterface * originalClpSolver = dynamic_cast< OsiClpSolverInterface*> (originalSolver); ClpSimplex * originalLpSolver = originalClpSolver->getModelPtr(); int * originalColumns = NULL; OsiClpSolverInterface * clpSolver; ClpSimplex * lpSolver; ClpPresolve pinfo; assert(originalSolver->getObjSense() > 0); if (doAction == 2 || doAction == 3) { double * saveLB = NULL; double * saveUB = NULL; int numberColumns = originalLpSolver->numberColumns(); if (fixAbove > 0.0) { #ifdef COIN_DETAIL double time1 = CoinCpuTime(); #endif originalClpSolver->initialSolve(); COIN_DETAIL_PRINT(printf("first solve took %g seconds\n", CoinCpuTime() - time1)); double * columnLower = originalLpSolver->columnLower() ; double * columnUpper = originalLpSolver->columnUpper() ; const double * solution = originalLpSolver->primalColumnSolution(); saveLB = CoinCopyOfArray(columnLower, numberColumns); saveUB = CoinCopyOfArray(columnUpper, numberColumns); const double * objective = originalLpSolver->getObjCoefficients() ; int iColumn; int nFix = 0; int nArt = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (objective[iColumn] > fixAbove) { if (solution[iColumn] < columnLower[iColumn] + 1.0e-8) { columnUpper[iColumn] = columnLower[iColumn]; nFix++; } else { nArt++; } } else if (objective[iColumn] < -fixAbove) { if (solution[iColumn] > columnUpper[iColumn] - 1.0e-8) { columnLower[iColumn] = columnUpper[iColumn]; nFix++; } else { nArt++; } } } COIN_DETAIL_PRINT(printf("%d artificials fixed, %d left as in solution\n", nFix, nArt)); lpSolver = pinfo.presolvedModel(*originalLpSolver, 1.0e-8, true, 10); if (!lpSolver || doAction == 2) { // take off fixing in original memcpy(columnLower, saveLB, numberColumns*sizeof(double)); memcpy(columnUpper, saveUB, numberColumns*sizeof(double)); } delete [] saveLB; delete [] saveUB; if (!lpSolver) { // try again pinfo.destroyPresolve(); lpSolver = pinfo.presolvedModel(*originalLpSolver, 1.0e-8, true, 10); assert (lpSolver); } } else { lpSolver = pinfo.presolvedModel(*originalLpSolver, 1.0e-8, true, 10); assert (lpSolver); } clpSolver = new OsiClpSolverInterface(lpSolver, true); assert(lpSolver == clpSolver->getModelPtr()); numberColumns = lpSolver->numberColumns(); originalColumns = CoinCopyOfArray(pinfo.originalColumns(), numberColumns); doAction = 1; } else { OsiSolverInterface * solver = originalSolver->clone(); clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); lpSolver = clpSolver->getModelPtr(); } // Tighten bounds lpSolver->tightenPrimalBounds(0.0, 11, true); int numberColumns = clpSolver->getNumCols() ; double * saveColumnLower = CoinCopyOfArray(lpSolver->columnLower(), numberColumns); double * saveColumnUpper = CoinCopyOfArray(lpSolver->columnUpper(), numberColumns); //char generalPrint[200]; const double *objective = lpSolver->getObjCoefficients() ; double *columnLower = lpSolver->columnLower() ; double *columnUpper = lpSolver->columnUpper() ; int numberRows = clpSolver->getNumRows(); int iRow, iColumn; // Row copy CoinPackedMatrix matrixByRow(*clpSolver->getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); // Column copy CoinPackedMatrix matrixByCol(*clpSolver->getMatrixByCol()); //const double * element = matrixByCol.getElements(); const int * row = matrixByCol.getIndices(); const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol.getVectorLengths(); const double * rowLower = clpSolver->getRowLower(); const double * rowUpper = clpSolver->getRowUpper(); // Get maximum size of VUB tree // otherColumn is one fixed to 0 if this one zero int nEl = matrixByCol.getNumElements(); CoinBigIndex * fixColumn = new CoinBigIndex [numberColumns+1]; int * otherColumn = new int [nEl]; int * fix = new int[numberColumns]; char * mark = new char [numberColumns]; memset(mark, 0, numberColumns); int numberInteger = 0; int numberOther = 0; fixColumn[0] = 0; double large = lpSolver->largeValue(); // treat bounds > this as infinite #ifndef NDEBUG double large2 = 1.0e10 * large; #endif double tolerance = lpSolver->primalTolerance(); int * check = new int[numberRows]; for (iRow = 0; iRow < numberRows; iRow++) { check[iRow] = -2; // don't check if (rowLower[iRow] < -1.0e6 && rowUpper[iRow] > 1.0e6) continue;// unlikely // possible row int numberPositive = 0; int iPositive = -1; int numberNegative = 0; int iNegative = -1; CoinBigIndex rStart = rowStart[iRow]; CoinBigIndex rEnd = rowStart[iRow] + rowLength[iRow]; CoinBigIndex j; int kColumn; for (j = rStart; j < rEnd; ++j) { double value = elementByRow[j]; kColumn = column[j]; if (columnUpper[kColumn] > columnLower[kColumn]) { if (value > 0.0) { numberPositive++; iPositive = kColumn; } else { numberNegative++; iNegative = kColumn; } } } if (numberPositive == 1 && numberNegative == 1) check[iRow] = -1; // try both if (numberPositive == 1 && rowLower[iRow] > -1.0e20) check[iRow] = iPositive; else if (numberNegative == 1 && rowUpper[iRow] < 1.0e20) check[iRow] = iNegative; } for (iColumn = 0; iColumn < numberColumns; iColumn++) { fix[iColumn] = -1; if (columnUpper[iColumn] > columnLower[iColumn] + 1.0e-8) { if (clpSolver->isInteger(iColumn)) numberInteger++; if (columnLower[iColumn] == 0.0) { bool infeasible = false; fix[iColumn] = 0; // fake upper bound double saveUpper = columnUpper[iColumn]; columnUpper[iColumn] = 0.0; for (CoinBigIndex i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { iRow = row[i]; if (check[iRow] != -1 && check[iRow] != iColumn) continue; // unlikely // possible row int infiniteUpper = 0; int infiniteLower = 0; double maximumUp = 0.0; double maximumDown = 0.0; double newBound; CoinBigIndex rStart = rowStart[iRow]; CoinBigIndex rEnd = rowStart[iRow] + rowLength[iRow]; CoinBigIndex j; int kColumn; // Compute possible lower and upper ranges for (j = rStart; j < rEnd; ++j) { double value = elementByRow[j]; kColumn = column[j]; if (value > 0.0) { if (columnUpper[kColumn] >= large) { ++infiniteUpper; } else { maximumUp += columnUpper[kColumn] * value; } if (columnLower[kColumn] <= -large) { ++infiniteLower; } else { maximumDown += columnLower[kColumn] * value; } } else if (value < 0.0) { if (columnUpper[kColumn] >= large) { ++infiniteLower; } else { maximumDown += columnUpper[kColumn] * value; } if (columnLower[kColumn] <= -large) { ++infiniteUpper; } else { maximumUp += columnLower[kColumn] * value; } } } // Build in a margin of error maximumUp += 1.0e-8 * fabs(maximumUp); maximumDown -= 1.0e-8 * fabs(maximumDown); double maxUp = maximumUp + infiniteUpper * 1.0e31; double maxDown = maximumDown - infiniteLower * 1.0e31; if (maxUp <= rowUpper[iRow] + tolerance && maxDown >= rowLower[iRow] - tolerance) { //printf("Redundant row in vubs %d\n",iRow); } else { if (maxUp < rowLower[iRow] - 100.0*tolerance || maxDown > rowUpper[iRow] + 100.0*tolerance) { infeasible = true; break; } double lower = rowLower[iRow]; double upper = rowUpper[iRow]; for (j = rStart; j < rEnd; ++j) { double value = elementByRow[j]; kColumn = column[j]; double nowLower = columnLower[kColumn]; double nowUpper = columnUpper[kColumn]; if (value > 0.0) { // positive value if (lower > -large) { if (!infiniteUpper) { assert(nowUpper < large2); newBound = nowUpper + (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumUp); } else if (infiniteUpper == 1 && nowUpper > large) { newBound = (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumUp); } else { newBound = -COIN_DBL_MAX; } if (newBound > nowLower + 1.0e-12 && newBound > -large) { // Tighten the lower bound // check infeasible (relaxed) if (nowUpper < newBound) { if (nowUpper - newBound < -100.0*tolerance) { infeasible = true; break; } } } } if (upper < large) { if (!infiniteLower) { assert(nowLower > - large2); newBound = nowLower + (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound += 1.0e-12 * fabs(maximumDown); } else if (infiniteLower == 1 && nowLower < -large) { newBound = (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound += 1.0e-12 * fabs(maximumDown); } else { newBound = COIN_DBL_MAX; } if (newBound < nowUpper - 1.0e-12 && newBound < large) { // Tighten the upper bound // check infeasible (relaxed) if (nowLower > newBound) { if (newBound - nowLower < -100.0*tolerance) { infeasible = true; break; } else { newBound = nowLower; } } if (!newBound || (clpSolver->isInteger(kColumn) && newBound < 0.999)) { // fix to zero if (!mark[kColumn]) { otherColumn[numberOther++] = kColumn; mark[kColumn] = 1; if (check[iRow] == -1) check[iRow] = iColumn; else assert(check[iRow] == iColumn); } } } } } else { // negative value if (lower > -large) { if (!infiniteUpper) { assert(nowLower < large2); newBound = nowLower + (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound += 1.0e-12 * fabs(maximumUp); } else if (infiniteUpper == 1 && nowLower < -large) { newBound = (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound += 1.0e-12 * fabs(maximumUp); } else { newBound = COIN_DBL_MAX; } if (newBound < nowUpper - 1.0e-12 && newBound < large) { // Tighten the upper bound // check infeasible (relaxed) if (nowLower > newBound) { if (newBound - nowLower < -100.0*tolerance) { infeasible = true; break; } else { newBound = nowLower; } } if (!newBound || (clpSolver->isInteger(kColumn) && newBound < 0.999)) { // fix to zero if (!mark[kColumn]) { otherColumn[numberOther++] = kColumn; mark[kColumn] = 1; if (check[iRow] == -1) check[iRow] = iColumn; else assert(check[iRow] == iColumn); } } } } if (upper < large) { if (!infiniteLower) { assert(nowUpper < large2); newBound = nowUpper + (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumDown); } else if (infiniteLower == 1 && nowUpper > large) { newBound = (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumDown); } else { newBound = -COIN_DBL_MAX; } if (newBound > nowLower + 1.0e-12 && newBound > -large) { // Tighten the lower bound // check infeasible (relaxed) if (nowUpper < newBound) { if (nowUpper - newBound < -100.0*tolerance) { infeasible = true; break; } } } } } } } } for (int i = fixColumn[iColumn]; i < numberOther; i++) mark[otherColumn[i]] = 0; // reset bound unless infeasible if (!infeasible || !clpSolver->isInteger(iColumn)) columnUpper[iColumn] = saveUpper; else if (clpSolver->isInteger(iColumn)) columnLower[iColumn] = 1.0; } } fixColumn[iColumn+1] = numberOther; } delete [] check; delete [] mark; // Now do reverse way int * counts = new int [numberColumns]; CoinZeroN(counts, numberColumns); for (iColumn = 0; iColumn < numberColumns; iColumn++) { for (int i = fixColumn[iColumn]; i < fixColumn[iColumn+1]; i++) counts[otherColumn[i]]++; } numberOther = 0; CoinBigIndex * fixColumn2 = new CoinBigIndex [numberColumns+1]; int * otherColumn2 = new int [fixColumn[numberColumns]]; fixColumn2[0] = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { numberOther += counts[iColumn]; counts[iColumn] = 0; fixColumn2[iColumn+1] = numberOther; } // Create other way for ( iColumn = 0; iColumn < numberColumns; iColumn++) { for (int i = fixColumn[iColumn]; i < fixColumn[iColumn+1]; i++) { int jColumn = otherColumn[i]; CoinBigIndex put = fixColumn2[jColumn] + counts[jColumn]; counts[jColumn]++; otherColumn2[put] = iColumn; } } // get top layer i.e. those which are not fixed by any other int kLayer = 0; while (true) { int numberLayered = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (fix[iColumn] == kLayer) { for (int i = fixColumn2[iColumn]; i < fixColumn2[iColumn+1]; i++) { int jColumn = otherColumn2[i]; if (fix[jColumn] == kLayer) { fix[iColumn] = kLayer + 100; } } } if (fix[iColumn] == kLayer) { numberLayered++; } } if (numberLayered) { kLayer += 100; } else { break; } } for (int iPass = 0; iPass < 2; iPass++) { for (int jLayer = 0; jLayer < kLayer; jLayer++) { int check[] = { -1, 0, 1, 2, 3, 4, 5, 10, 50, 100, 500, 1000, 5000, 10000, COIN_INT_MAX}; int nCheck = static_cast (sizeof(check) / sizeof(int)); int countsI[20]; int countsC[20]; assert (nCheck <= 20); memset(countsI, 0, nCheck*sizeof(int)); memset(countsC, 0, nCheck*sizeof(int)); check[nCheck-1] = numberColumns; int numberLayered = 0; int numberInteger = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (fix[iColumn] == jLayer) { numberLayered++; int nFix = fixColumn[iColumn+1] - fixColumn[iColumn]; if (iPass) { // just integers nFix = 0; for (int i = fixColumn[iColumn]; i < fixColumn[iColumn+1]; i++) { int jColumn = otherColumn[i]; if (clpSolver->isInteger(jColumn)) nFix++; } } int iFix; for (iFix = 0; iFix < nCheck; iFix++) { if (nFix <= check[iFix]) break; } assert (iFix < nCheck); if (clpSolver->isInteger(iColumn)) { numberInteger++; countsI[iFix]++; } else { countsC[iFix]++; } } } #ifdef COIN_DETAIL if (numberLayered) { printf("%d (%d integer) at priority %d\n", numberLayered, numberInteger, 1 + (jLayer / 100)); char buffer[50]; for (int i = 1; i < nCheck; i++) { if (countsI[i] || countsC[i]) { if (i == 1) sprintf(buffer, " == zero "); else if (i < nCheck - 1) sprintf(buffer, "> %6d and <= %6d ", check[i-1], check[i]); else sprintf(buffer, "> %6d ", check[i-1]); printf("%s %8d integers and %8d continuous\n", buffer, countsI[i], countsC[i]); } } } #endif } } delete [] counts; // Now do fixing { // switch off presolve and up weight ClpSolve solveOptions; //solveOptions.setPresolveType(ClpSolve::presolveOff,0); solveOptions.setSolveType(ClpSolve::usePrimalorSprint); //solveOptions.setSpecialOption(1,3,30); // sprint int numberColumns = lpSolver->numberColumns(); int iColumn; bool allSlack = true; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (lpSolver->getColumnStatus(iColumn) == ClpSimplex::basic) { allSlack = false; break; } } if (allSlack) solveOptions.setSpecialOption(1, 2, 50); // idiot lpSolver->setInfeasibilityCost(1.0e11); lpSolver->defaultFactorizationFrequency(); if (doAction != 11) lpSolver->initialSolve(solveOptions); double * columnLower = lpSolver->columnLower(); double * columnUpper = lpSolver->columnUpper(); double * fullSolution = lpSolver->primalColumnSolution(); const double * dj = lpSolver->dualColumnSolution(); int iPass = 0; #define MAXPROB 2 ClpSimplex models[MAXPROB]; int kPass = -1; int kLayer = 0; int skipZero = 0; if (skipZero2 == -1) skipZero2 = 40; //-1; /* 0 fixed to 0 by choice 1 lb of 1 by choice 2 fixed to 0 by another 3 as 2 but this go -1 free */ char * state = new char [numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) state[iColumn] = -1; while (true) { double largest = -0.1; double smallest = 1.1; int iLargest = -1; int iSmallest = -1; int atZero = 0; int atOne = 0; int toZero = 0; int toOne = 0; int numberFree = 0; int numberGreater = 0; columnLower = lpSolver->columnLower(); columnUpper = lpSolver->columnUpper(); fullSolution = lpSolver->primalColumnSolution(); if (doAction == 11) { { double * columnLower = lpSolver->columnLower(); double * columnUpper = lpSolver->columnUpper(); // lpSolver->dual(); memcpy(columnLower, saveColumnLower, numberColumns*sizeof(double)); memcpy(columnUpper, saveColumnUpper, numberColumns*sizeof(double)); // lpSolver->dual(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn] + 1.0e-8) { if (clpSolver->isInteger(iColumn)) { double value = lastSolution[iColumn]; int iValue = static_cast (value + 0.5); assert (fabs(value - static_cast (iValue)) < 1.0e-3); assert (iValue >= columnLower[iColumn] && iValue <= columnUpper[iColumn]); columnLower[iColumn] = iValue; columnUpper[iColumn] = iValue; } } } lpSolver->initialSolve(solveOptions); memcpy(columnLower, saveColumnLower, numberColumns*sizeof(double)); memcpy(columnUpper, saveColumnUpper, numberColumns*sizeof(double)); } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn] + 1.0e-8) { if (clpSolver->isInteger(iColumn)) { double value = lastSolution[iColumn]; int iValue = static_cast (value + 0.5); assert (fabs(value - static_cast (iValue)) < 1.0e-3); assert (iValue >= columnLower[iColumn] && iValue <= columnUpper[iColumn]); if (!fix[iColumn]) { if (iValue == 0) { state[iColumn] = 0; assert (!columnLower[iColumn]); columnUpper[iColumn] = 0.0; } else if (iValue == 1) { state[iColumn] = 1; columnLower[iColumn] = 1.0; } else { // leave fixed columnLower[iColumn] = iValue; columnUpper[iColumn] = iValue; } } else if (iValue == 0) { state[iColumn] = 10; columnUpper[iColumn] = 0.0; } else { // leave fixed columnLower[iColumn] = iValue; columnUpper[iColumn] = iValue; } } } } int jLayer = 0; int nFixed = -1; int nTotalFixed = 0; while (nFixed) { nFixed = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] == 0.0 && fix[iColumn] == jLayer) { for (int i = fixColumn[iColumn]; i < fixColumn[iColumn+1]; i++) { int jColumn = otherColumn[i]; if (columnUpper[jColumn]) { bool canFix = true; for (int k = fixColumn2[jColumn]; k < fixColumn2[jColumn+1]; k++) { int kColumn = otherColumn2[k]; if (state[kColumn] == 1) { canFix = false; break; } } if (canFix) { columnUpper[jColumn] = 0.0; nFixed++; } } } } } nTotalFixed += nFixed; jLayer += 100; } COIN_DETAIL_PRINT(printf("This fixes %d variables in lower priorities\n", nTotalFixed)); break; } for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (!clpSolver->isInteger(iColumn) || fix[iColumn] > kLayer) continue; // skip if fixes nothing if (fixColumn[iColumn+1] - fixColumn[iColumn] <= skipZero2) continue; double value = fullSolution[iColumn]; if (value > 1.00001) { numberGreater++; continue; } double lower = columnLower[iColumn]; double upper = columnUpper[iColumn]; if (lower == upper) { if (lower) atOne++; else atZero++; continue; } if (value < 1.0e-7) { toZero++; columnUpper[iColumn] = 0.0; state[iColumn] = 10; continue; } if (value > 1.0 - 1.0e-7) { toOne++; columnLower[iColumn] = 1.0; state[iColumn] = 1; continue; } numberFree++; // skip if fixes nothing if (fixColumn[iColumn+1] - fixColumn[iColumn] <= skipZero) continue; if (value < smallest) { smallest = value; iSmallest = iColumn; } if (value > largest) { largest = value; iLargest = iColumn; } } if (toZero || toOne) COIN_DETAIL_PRINT(printf("%d at 0 fixed and %d at one fixed\n", toZero, toOne)); COIN_DETAIL_PRINT(printf("%d variables free, %d fixed to 0, %d to 1 - smallest %g, largest %g\n", numberFree, atZero, atOne, smallest, largest)); if (numberGreater && !iPass) COIN_DETAIL_PRINT(printf("%d variables have value > 1.0\n", numberGreater)); //skipZero2=0; // leave 0 fixing int jLayer = 0; int nFixed = -1; int nTotalFixed = 0; while (nFixed) { nFixed = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] == 0.0 && fix[iColumn] == jLayer) { for (int i = fixColumn[iColumn]; i < fixColumn[iColumn+1]; i++) { int jColumn = otherColumn[i]; if (columnUpper[jColumn]) { bool canFix = true; for (int k = fixColumn2[jColumn]; k < fixColumn2[jColumn+1]; k++) { int kColumn = otherColumn2[k]; if (state[kColumn] == 1) { canFix = false; break; } } if (canFix) { columnUpper[jColumn] = 0.0; nFixed++; } } } } } nTotalFixed += nFixed; jLayer += 100; } COIN_DETAIL_PRINT(printf("This fixes %d variables in lower priorities\n", nTotalFixed)); if (iLargest < 0 || numberFree <= leaveIntFree) break; double movement; int way; if (smallest <= 1.0 - largest && smallest < 0.2 && largest < fixAboveValue) { columnUpper[iSmallest] = 0.0; state[iSmallest] = 0; movement = smallest; way = -1; } else { columnLower[iLargest] = 1.0; state[iLargest] = 1; movement = 1.0 - largest; way = 1; } double saveObj = lpSolver->objectiveValue(); iPass++; kPass = iPass % MAXPROB; models[kPass] = *lpSolver; if (way == -1) { // fix others for (int i = fixColumn[iSmallest]; i < fixColumn[iSmallest+1]; i++) { int jColumn = otherColumn[i]; if (state[jColumn] == -1) { columnUpper[jColumn] = 0.0; state[jColumn] = 3; } } } double maxCostUp = COIN_DBL_MAX; objective = lpSolver->getObjCoefficients() ; if (way == -1) maxCostUp = (1.0 - movement) * objective[iSmallest]; lpSolver->setDualObjectiveLimit(saveObj + maxCostUp); crunchIt(lpSolver); double moveObj = lpSolver->objectiveValue() - saveObj; COIN_DETAIL_PRINT(printf("movement %s was %g costing %g\n", (way == -1) ? "down" : "up", movement, moveObj)); if (way == -1 && (moveObj >= maxCostUp || lpSolver->status())) { // go up columnLower = models[kPass].columnLower(); columnUpper = models[kPass].columnUpper(); columnLower[iSmallest] = 1.0; columnUpper[iSmallest] = saveColumnUpper[iSmallest]; *lpSolver = models[kPass]; columnLower = lpSolver->columnLower(); columnUpper = lpSolver->columnUpper(); fullSolution = lpSolver->primalColumnSolution(); dj = lpSolver->dualColumnSolution(); columnLower[iSmallest] = 1.0; columnUpper[iSmallest] = saveColumnUpper[iSmallest]; state[iSmallest] = 1; // unfix others for (int i = fixColumn[iSmallest]; i < fixColumn[iSmallest+1]; i++) { int jColumn = otherColumn[i]; if (state[jColumn] == 3) { columnUpper[jColumn] = saveColumnUpper[jColumn]; state[jColumn] = -1; } } crunchIt(lpSolver); } models[kPass] = *lpSolver; } lpSolver->dual(); COIN_DETAIL_PRINT(printf("Fixing took %g seconds\n", CoinCpuTime() - time1)); columnLower = lpSolver->columnLower(); columnUpper = lpSolver->columnUpper(); fullSolution = lpSolver->primalColumnSolution(); dj = lpSolver->dualColumnSolution(); int * sort = new int[numberColumns]; double * dsort = new double[numberColumns]; int chunk = 20; int iRelax = 0; //double fractionFixed=6.0/8.0; // relax while lots fixed while (true) { if (skipZero2 > 10 && doAction < 10) break; iRelax++; int n = 0; double sum0 = 0.0; double sum00 = 0.0; double sum1 = 0.0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (!clpSolver->isInteger(iColumn) || fix[iColumn] > kLayer) continue; // skip if fixes nothing if (fixColumn[iColumn+1] - fixColumn[iColumn] == 0 && doAction < 10) continue; double djValue = dj[iColumn]; if (state[iColumn] == 1) { assert (columnLower[iColumn]); assert (fullSolution[iColumn] > 0.1); if (djValue > 0.0) { //printf("YY dj of %d at %g is %g\n",iColumn,value,djValue); sum1 += djValue; sort[n] = iColumn; dsort[n++] = -djValue; } else { //printf("dj of %d at %g is %g\n",iColumn,value,djValue); } } else if (state[iColumn] == 0 || state[iColumn] == 10) { assert (fullSolution[iColumn] < 0.1); assert (!columnUpper[iColumn]); double otherValue = 0.0; int nn = 0; for (int i = fixColumn[iColumn]; i < fixColumn[iColumn+1]; i++) { int jColumn = otherColumn[i]; if (columnUpper[jColumn] == 0.0) { if (dj[jColumn] < -1.0e-5) { nn++; otherValue += dj[jColumn]; // really need to look at rest } } } if (djValue < -1.0e-2 || otherValue < -1.0e-2) { //printf("XX dj of %d at %g is %g - %d out of %d contribute %g\n",iColumn,value,djValue, // nn,fixColumn[iColumn+1]-fixColumn[iColumn],otherValue); if (djValue < 1.0e-8) { sum0 -= djValue; sum00 -= otherValue; sort[n] = iColumn; if (djValue < -1.0e-2) dsort[n++] = djValue + otherValue; else dsort[n++] = djValue + 0.001 * otherValue; } } else { //printf("dj of %d at %g is %g - no contribution from %d\n",iColumn,value,djValue, // fixColumn[iColumn+1]-fixColumn[iColumn]); } } } CoinSort_2(dsort, dsort + n, sort); double * originalColumnLower = saveColumnLower; double * originalColumnUpper = saveColumnUpper; double * lo = CoinCopyOfArray(columnLower, numberColumns); double * up = CoinCopyOfArray(columnUpper, numberColumns); for (int k = 0; k < CoinMin(chunk, n); k++) { iColumn = sort[k]; state[iColumn] = -2; } memcpy(columnLower, originalColumnLower, numberColumns*sizeof(double)); memcpy(columnUpper, originalColumnUpper, numberColumns*sizeof(double)); int nFixed = 0; int nFixed0 = 0; int nFixed1 = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (state[iColumn] == 0 || state[iColumn] == 10) { columnUpper[iColumn] = 0.0; assert (lo[iColumn] == 0.0); nFixed++; nFixed0++; for (int i = fixColumn[iColumn]; i < fixColumn[iColumn+1]; i++) { int jColumn = otherColumn[i]; if (columnUpper[jColumn]) { bool canFix = true; for (int k = fixColumn2[jColumn]; k < fixColumn2[jColumn+1]; k++) { int kColumn = otherColumn2[k]; if (state[kColumn] == 1 || state[kColumn] == -2) { canFix = false; break; } } if (canFix) { columnUpper[jColumn] = 0.0; assert (lo[jColumn] == 0.0); nFixed++; } } } } else if (state[iColumn] == 1) { columnLower[iColumn] = 1.0; nFixed1++; } } COIN_DETAIL_PRINT(printf("%d fixed %d orig 0 %d 1\n", nFixed, nFixed0, nFixed1)); int jLayer = 0; nFixed = -1; int nTotalFixed = 0; while (nFixed) { nFixed = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] == 0.0 && fix[iColumn] == jLayer) { for (int i = fixColumn[iColumn]; i < fixColumn[iColumn+1]; i++) { int jColumn = otherColumn[i]; if (columnUpper[jColumn]) { bool canFix = true; for (int k = fixColumn2[jColumn]; k < fixColumn2[jColumn+1]; k++) { int kColumn = otherColumn2[k]; if (state[kColumn] == 1 || state[kColumn] == -2) { canFix = false; break; } } if (canFix) { columnUpper[jColumn] = 0.0; assert (lo[jColumn] == 0.0); nFixed++; } } } } } nTotalFixed += nFixed; jLayer += 100; } nFixed = 0; int nFixedI = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLower[iColumn] == columnUpper[iColumn]) { if (clpSolver->isInteger(iColumn)) nFixedI++; nFixed++; } } COIN_DETAIL_PRINT(printf("This fixes %d variables in lower priorities - total %d (%d integer) - all target %d, int target %d\n", nTotalFixed, nFixed, nFixedI, static_cast(fractionFixed*numberColumns), static_cast (fractionIntFixed*numberInteger))); int nBad = 0; int nRelax = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (lo[iColumn] < columnLower[iColumn] || up[iColumn] > columnUpper[iColumn]) { COIN_DETAIL_PRINT(printf("bad %d old %g %g, new %g %g\n", iColumn, lo[iColumn], up[iColumn], columnLower[iColumn], columnUpper[iColumn])); nBad++; } if (lo[iColumn] > columnLower[iColumn] || up[iColumn] < columnUpper[iColumn]) { nRelax++; } } COIN_DETAIL_PRINT(printf("%d relaxed\n", nRelax)); if (iRelax > 20 && nRelax == chunk) nRelax = 0; if (iRelax > 50) nRelax = 0; assert (!nBad); delete [] lo; delete [] up; lpSolver->primal(1); if (nFixed < fractionFixed*numberColumns || nFixedI < fractionIntFixed*numberInteger || !nRelax) break; } delete [] state; delete [] sort; delete [] dsort; } delete [] fix; delete [] fixColumn; delete [] otherColumn; delete [] otherColumn2; delete [] fixColumn2; // See if was presolved if (originalColumns) { columnLower = lpSolver->columnLower(); columnUpper = lpSolver->columnUpper(); for ( iColumn = 0; iColumn < numberColumns; iColumn++) { saveColumnLower[iColumn] = columnLower[iColumn]; saveColumnUpper[iColumn] = columnUpper[iColumn]; } pinfo.postsolve(true); columnLower = originalLpSolver->columnLower(); columnUpper = originalLpSolver->columnUpper(); double * newColumnLower = lpSolver->columnLower(); double * newColumnUpper = lpSolver->columnUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = originalColumns[iColumn]; columnLower[jColumn] = CoinMax(columnLower[jColumn], newColumnLower[iColumn]); columnUpper[jColumn] = CoinMin(columnUpper[jColumn], newColumnUpper[iColumn]); } numberColumns = originalLpSolver->numberColumns(); delete [] originalColumns; } delete [] saveColumnLower; delete [] saveColumnUpper; if (!originalColumns) { // Basis memcpy(originalLpSolver->statusArray(), lpSolver->statusArray(), numberRows + numberColumns); memcpy(originalLpSolver->primalColumnSolution(), lpSolver->primalColumnSolution(), numberColumns*sizeof(double)); memcpy(originalLpSolver->primalRowSolution(), lpSolver->primalRowSolution(), numberRows*sizeof(double)); // Fix in solver columnLower = lpSolver->columnLower(); columnUpper = lpSolver->columnUpper(); } double * originalColumnLower = originalLpSolver->columnLower(); double * originalColumnUpper = originalLpSolver->columnUpper(); // number fixed doAction = 0; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { originalColumnLower[iColumn] = columnLower[iColumn]; originalColumnUpper[iColumn] = columnUpper[iColumn]; if (columnLower[iColumn] == columnUpper[iColumn]) doAction++; } COIN_DETAIL_PRINT(printf("%d fixed by vub preprocessing\n", doAction)); if (originalColumns) { originalLpSolver->initialSolve(); } delete clpSolver; return NULL; } int doHeuristics(CbcModel * model, int type, CbcOrClpParam* parameters_, int numberParameters_,int noPrinting_,int initialPumpTune) { #ifdef JJF_ZERO //NEW_STYLE_SOLVER==0 CbcOrClpParam * parameters_ = parameters; int numberParameters_ = numberParameters; bool noPrinting_ = noPrinting_; #endif char generalPrint[10000]; CoinMessages generalMessages = model->messages(); CoinMessageHandler * generalMessageHandler = model->messageHandler(); //generalMessageHandler->setPrefix(false); bool anyToDo = false; int logLevel = parameters_[whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters_, parameters_)].intValue(); int useFpump = parameters_[whichParam(CBC_PARAM_STR_FPUMP, numberParameters_, parameters_)].currentOptionAsInteger(); int useRounding = parameters_[whichParam(CBC_PARAM_STR_ROUNDING, numberParameters_, parameters_)].currentOptionAsInteger(); int useGreedy = parameters_[whichParam(CBC_PARAM_STR_GREEDY, numberParameters_, parameters_)].currentOptionAsInteger(); int useCombine = parameters_[whichParam(CBC_PARAM_STR_COMBINE, numberParameters_, parameters_)].currentOptionAsInteger(); int useProximity = parameters_[whichParam(CBC_PARAM_STR_PROXIMITY, numberParameters_, parameters_)].currentOptionAsInteger(); int useCrossover = parameters_[whichParam(CBC_PARAM_STR_CROSSOVER2, numberParameters_, parameters_)].currentOptionAsInteger(); //int usePivotC = parameters_[whichParam(CBC_PARAM_STR_PIVOTANDCOMPLEMENT, numberParameters_, parameters_)].currentOptionAsInteger(); int usePivotF = parameters_[whichParam(CBC_PARAM_STR_PIVOTANDFIX, numberParameters_, parameters_)].currentOptionAsInteger(); int useRand = parameters_[whichParam(CBC_PARAM_STR_RANDROUND, numberParameters_, parameters_)].currentOptionAsInteger(); int useRINS = parameters_[whichParam(CBC_PARAM_STR_RINS, numberParameters_, parameters_)].currentOptionAsInteger(); int useRENS = parameters_[whichParam(CBC_PARAM_STR_RENS, numberParameters_, parameters_)].currentOptionAsInteger(); int useVND = parameters_[whichParam(CBC_PARAM_STR_VND, numberParameters_, parameters_)].currentOptionAsInteger(); int useDINS = parameters_[whichParam(CBC_PARAM_STR_DINS, numberParameters_, parameters_)].currentOptionAsInteger(); int useDIVING2 = parameters_[whichParam(CBC_PARAM_STR_DIVINGS, numberParameters_, parameters_)].currentOptionAsInteger(); int useNaive = parameters_[whichParam(CBC_PARAM_STR_NAIVE, numberParameters_, parameters_)].currentOptionAsInteger(); int useDW = parameters_[whichParam(CBC_PARAM_STR_DW, numberParameters_, parameters_)].currentOptionAsInteger(); int kType = (type < 10) ? type : 1; assert (kType == 1 || kType == 2); // FPump done first as it only works if no solution if (useFpump >= kType && useFpump <= kType + 1) { anyToDo = true; CbcHeuristicFPump heuristic4(*model); double dextra3 = parameters_[whichParam(CBC_PARAM_DBL_SMALLBAB, numberParameters_, parameters_)].doubleValue(); heuristic4.setFractionSmall(dextra3); double dextra1 = parameters_[whichParam(CBC_PARAM_DBL_ARTIFICIALCOST, numberParameters_, parameters_)].doubleValue(); if (dextra1) heuristic4.setArtificialCost(dextra1); heuristic4.setMaximumPasses(parameters_[whichParam(CBC_PARAM_INT_FPUMPITS, numberParameters_, parameters_)].intValue()); if (parameters_[whichParam(CBC_PARAM_INT_FPUMPITS, numberParameters_, parameters_)].intValue() == 21) heuristic4.setIterationRatio(1.0); int pumpTune = parameters_[whichParam(CBC_PARAM_INT_FPUMPTUNE, numberParameters_, parameters_)].intValue(); int pumpTune2 = parameters_[whichParam(CBC_PARAM_INT_FPUMPTUNE2, numberParameters_, parameters_)].intValue(); if (pumpTune > 0) { bool printStuff = (pumpTune != initialPumpTune || logLevel > 1 || pumpTune2 > 0) && !noPrinting_; if (printStuff) { generalMessageHandler->message(CBC_GENERAL, generalMessages) << "Options for feasibility pump - " << CoinMessageEol; } /* >=10000000 for using obj >=1000000 use as accumulate switch >=1000 use index+1 as number of large loops >=100 use dextra1 as cutoff %100 == 10,20 etc for experimentation 1 == fix ints at bounds, 2 fix all integral ints, 3 and continuous at bounds 4 and static continuous, 5 as 3 but no internal integers 6 as 3 but all slack basis! */ double value = model->solver()->getObjSense() * model->solver()->getObjValue(); int w = pumpTune / 10; int i = w % 10; w /= 10; int c = w % 10; w /= 10; int r = w; int accumulate = r / 1000; r -= 1000 * accumulate; if (accumulate >= 10) { int which = accumulate / 10; accumulate -= 10 * which; which--; // weights and factors double weight[] = {0.01, 0.01, 0.1, 0.1, 0.5, 0.5, 1.0, 1.0, 5.0, 5.0}; double factor[] = {0.1, 0.5, 0.1, 0.5, 0.1, 0.5, 0.1, 0.5, 0.1, 0.5}; heuristic4.setInitialWeight(weight[which]); heuristic4.setWeightFactor(factor[which]); if (printStuff) { sprintf(generalPrint, "Initial weight for objective %g, decay factor %g", weight[which], factor[which]); generalMessageHandler->message(CBC_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } // fake cutoff if (c) { double cutoff; model->solver()->getDblParam(OsiDualObjectiveLimit, cutoff); cutoff = CoinMin(cutoff, value + 0.05 * fabs(value) * c); double fakeCutoff = parameters_[whichParam(CBC_PARAM_DBL_FAKECUTOFF, numberParameters_, parameters_)].doubleValue(); if (fakeCutoff) cutoff = fakeCutoff; heuristic4.setFakeCutoff(cutoff); if (printStuff) { sprintf(generalPrint, "Fake cutoff of %g", cutoff); generalMessageHandler->message(CBC_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } int offRandomEtc = 0; if (pumpTune2) { if ((pumpTune2 / 1000) != 0) { offRandomEtc = 1000000 * (pumpTune2 / 1000); if (printStuff) { generalMessageHandler->message(CBC_GENERAL, generalMessages) << "Feasibility pump may run twice" << CoinMessageEol; } pumpTune2 = pumpTune2 % 1000; } if ((pumpTune2 / 100) != 0) { offRandomEtc += 100 * (pumpTune2 / 100); if (printStuff) { generalMessageHandler->message(CBC_GENERAL, generalMessages) << "Not using randomized objective" << CoinMessageEol; } } int maxAllowed = pumpTune2 % 100; if (maxAllowed) { offRandomEtc += 1000 * maxAllowed; if (printStuff) { sprintf(generalPrint, "Fixing if same for %d passes", maxAllowed); generalMessageHandler->message(CBC_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } } if (accumulate) { heuristic4.setAccumulate(accumulate); if (printStuff) { if (accumulate) { sprintf(generalPrint, "Accumulate of %d", accumulate); generalMessageHandler->message(CBC_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } } if (r) { // also set increment //double increment = (0.01*i+0.005)*(fabs(value)+1.0e-12); double increment = 0.0; double fakeIncrement = parameters_[whichParam(CBC_PARAM_DBL_FAKEINCREMENT, numberParameters_, parameters_)].doubleValue(); if (fakeIncrement) increment = fakeIncrement; if (increment>=0.0) heuristic4.setAbsoluteIncrement(increment); else heuristic4.setRelativeIncrement(-increment); heuristic4.setMaximumRetries(r + 1); if (printStuff) { if (increment) { if (increment>0.0) sprintf(generalPrint, "Absolute increment of %g", increment); else sprintf(generalPrint, "Relative increment of %g", -increment); generalMessageHandler->message(CBC_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } sprintf(generalPrint, "%d retries", r + 1); generalMessageHandler->message(CBC_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } if (i + offRandomEtc) { heuristic4.setFeasibilityPumpOptions(i*10 + offRandomEtc); if (printStuff) { sprintf(generalPrint, "Feasibility pump options of %d", i*10 + offRandomEtc); generalMessageHandler->message(CBC_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } pumpTune = pumpTune % 100; if (pumpTune == 6) pumpTune = 13; heuristic4.setWhen((pumpTune % 10) + 10); if (printStuff) { sprintf(generalPrint, "Tuning (fixing) %d", pumpTune % 10); generalMessageHandler->message(CBC_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } heuristic4.setHeuristicName("feasibility pump"); //#define ROLF #ifdef ROLF CbcHeuristicFPump pump(*model); pump.setMaximumTime(60); pump.setMaximumPasses(100); pump.setMaximumRetries(1); pump.setFixOnReducedCosts(0); pump.setHeuristicName("Feasibility pump"); pump.setFractionSmall(1.0); pump.setWhen(13); model->addHeuristic(&pump); #else model->addHeuristic(&heuristic4); #endif } if (useRounding >= type && useRounding >= kType && useRounding <= kType + 1) { CbcRounding heuristic1(*model); heuristic1.setHeuristicName("rounding"); model->addHeuristic(&heuristic1) ; anyToDo = true; } if (useGreedy >= type && useGreedy >= kType && useGreedy <= kType + 1) { CbcHeuristicGreedyCover heuristic3(*model); heuristic3.setHeuristicName("greedy cover"); CbcHeuristicGreedyEquality heuristic3a(*model); heuristic3a.setHeuristicName("greedy equality"); model->addHeuristic(&heuristic3); model->addHeuristic(&heuristic3a); anyToDo = true; } if ((useRENS==7 && kType==1) || (useRENS==8 && kType==2)) { useRENS=1+2*(useRENS-7); CbcHeuristicRENS heuristic6a(*model); heuristic6a.setHeuristicName("RENSdj"); heuristic6a.setFractionSmall(0.6/*3.4*/); heuristic6a.setFeasibilityPumpOptions(3); heuristic6a.setNumberNodes(10); heuristic6a.setWhereFrom(4*256+4*1); heuristic6a.setWhen(2); heuristic6a.setRensType(1+16); model->addHeuristic(&heuristic6a) ; heuristic6a.setHeuristicName("RENSub"); heuristic6a.setFractionSmall(0.4); heuristic6a.setFeasibilityPumpOptions(1008003); heuristic6a.setNumberNodes(50); heuristic6a.setWhereFrom(4*256+4*1); heuristic6a.setWhen(2); heuristic6a.setRensType(2+16); model->addHeuristic(&heuristic6a) ; } if ((useRENS >= kType && useRENS <= kType + 1)|| useRENS>2) { CbcHeuristicRENS heuristic6(*model); heuristic6.setHeuristicName("RENS"); heuristic6.setFractionSmall(0.4); heuristic6.setFeasibilityPumpOptions(1008003); int nodes [] = { -2, 50, 50, 50, 200, 1000, 10000, -1, -1, 200}; heuristic6.setNumberNodes(nodes[useRENS]); heuristic6.setRensType(useRENS!=9 ? 0 : 32); model->addHeuristic(&heuristic6) ; anyToDo = true; } if (useVND >= kType && useVND <= kType + 1) { CbcHeuristicVND heuristic6b(*model); heuristic6b.setHeuristicName("VND"); heuristic6b.setFractionSmall(0.4); heuristic6b.setFeasibilityPumpOptions(1008003); int nodes [] = { -2, 50, 50, 50, 200, 1000, 10000}; heuristic6b.setNumberNodes(nodes[useVND]); model->addHeuristic(&heuristic6b) ; anyToDo = true; } if (useNaive >= kType && useNaive <= kType + 1) { CbcHeuristicNaive heuristic5b(*model); heuristic5b.setHeuristicName("Naive"); heuristic5b.setFractionSmall(0.4); heuristic5b.setNumberNodes(50); model->addHeuristic(&heuristic5b) ; anyToDo = true; } int useDIVING = 0; { int useD; useD = parameters_[whichParam(CBC_PARAM_STR_DIVINGV, numberParameters_, parameters_)].currentOptionAsInteger(); useDIVING |= 1 * ((useD >= kType) ? 1 : 0); useD = parameters_[whichParam(CBC_PARAM_STR_DIVINGG, numberParameters_, parameters_)].currentOptionAsInteger(); useDIVING |= 2 * ((useD >= kType) ? 1 : 0); useD = parameters_[whichParam(CBC_PARAM_STR_DIVINGF, numberParameters_, parameters_)].currentOptionAsInteger(); useDIVING |= 4 * ((useD >= kType) ? 1 : 0); useD = parameters_[whichParam(CBC_PARAM_STR_DIVINGC, numberParameters_, parameters_)].currentOptionAsInteger(); useDIVING |= 8 * ((useD >= kType) ? 1 : 0); useD = parameters_[whichParam(CBC_PARAM_STR_DIVINGL, numberParameters_, parameters_)].currentOptionAsInteger(); useDIVING |= 16 * ((useD >= kType) ? 1 : 0); useD = parameters_[whichParam(CBC_PARAM_STR_DIVINGP, numberParameters_, parameters_)].currentOptionAsInteger(); useDIVING |= 32 * ((useD >= kType) ? 1 : 0); } if (useDIVING2 >= kType && useDIVING2 <= kType + 1) { int diveOptions = parameters_[whichParam(CBC_PARAM_INT_DIVEOPT, numberParameters_, parameters_)].intValue(); if (diveOptions < 0 || diveOptions > 10) diveOptions = 2; CbcHeuristicJustOne heuristicJustOne(*model); heuristicJustOne.setHeuristicName("DiveAny"); heuristicJustOne.setWhen(diveOptions); // add in others CbcHeuristicDiveCoefficient heuristicDC(*model); heuristicDC.setHeuristicName("DiveCoefficient"); heuristicJustOne.addHeuristic(&heuristicDC, 1.0) ; CbcHeuristicDiveFractional heuristicDF(*model); heuristicDF.setHeuristicName("DiveFractional"); heuristicJustOne.addHeuristic(&heuristicDF, 1.0) ; CbcHeuristicDiveGuided heuristicDG(*model); heuristicDG.setHeuristicName("DiveGuided"); heuristicJustOne.addHeuristic(&heuristicDG, 1.0) ; CbcHeuristicDiveLineSearch heuristicDL(*model); heuristicDL.setHeuristicName("DiveLineSearch"); heuristicJustOne.addHeuristic(&heuristicDL, 1.0) ; CbcHeuristicDivePseudoCost heuristicDP(*model); heuristicDP.setHeuristicName("DivePseudoCost"); heuristicJustOne.addHeuristic(&heuristicDP, 1.0) ; CbcHeuristicDiveVectorLength heuristicDV(*model); heuristicDV.setHeuristicName("DiveVectorLength"); heuristicJustOne.addHeuristic(&heuristicDV, 1.0) ; // Now normalize probabilities heuristicJustOne.normalizeProbabilities(); model->addHeuristic(&heuristicJustOne) ; } if (useDIVING > 0) { int majorIterations=parameters_[whichParam(CBC_PARAM_INT_DIVEOPTSOLVES, numberParameters_, parameters_)].intValue(); int diveOptions2 = parameters_[whichParam(CBC_PARAM_INT_DIVEOPT, numberParameters_, parameters_)].intValue(); int diveOptions; if (diveOptions2 > 99) { // switch on various active set stuff diveOptions = diveOptions2%100; diveOptions2 /= 100; } else { diveOptions = diveOptions2; diveOptions2 = 0; } if (diveOptions < 0 || diveOptions > 29) diveOptions = 2; int diveOptionsNotC=diveOptions; if (diveOptions>10) { if (diveOptions>20) { diveOptions-=20; diveOptionsNotC-=20; } else { diveOptions -= 10; diveOptionsNotC = 4; } useDIVING = 63; } if ((useDIVING&1) != 0) { CbcHeuristicDiveVectorLength heuristicDV(*model); heuristicDV.setHeuristicName("DiveVectorLength"); heuristicDV.setWhen(diveOptionsNotC); heuristicDV.setMaxIterations(majorIterations); if (diveOptions2) { heuristicDV.setPercentageToFix(0.0); heuristicDV.setMaxSimplexIterations(COIN_INT_MAX); heuristicDV.setMaxSimplexIterationsAtRoot(COIN_INT_MAX-(diveOptions2-1)); } model->addHeuristic(&heuristicDV) ; } if ((useDIVING&2) != 0) { CbcHeuristicDiveGuided heuristicDG(*model); heuristicDG.setHeuristicName("DiveGuided"); heuristicDG.setWhen(diveOptionsNotC); heuristicDG.setMaxIterations(majorIterations); if (diveOptions2) { heuristicDG.setPercentageToFix(0.0); heuristicDG.setMaxSimplexIterations(COIN_INT_MAX); heuristicDG.setMaxSimplexIterationsAtRoot(COIN_INT_MAX-(diveOptions2-1)); } model->addHeuristic(&heuristicDG) ; } if ((useDIVING&4) != 0) { CbcHeuristicDiveFractional heuristicDF(*model); heuristicDF.setHeuristicName("DiveFractional"); heuristicDF.setWhen(diveOptionsNotC); heuristicDF.setMaxIterations(majorIterations); if (diveOptions2) { heuristicDF.setPercentageToFix(0.0); heuristicDF.setMaxSimplexIterations(COIN_INT_MAX); heuristicDF.setMaxSimplexIterationsAtRoot(COIN_INT_MAX-(diveOptions2-1)); } model->addHeuristic(&heuristicDF) ; } if ((useDIVING&8) != 0) { CbcHeuristicDiveCoefficient heuristicDC(*model); heuristicDC.setHeuristicName("DiveCoefficient"); heuristicDC.setWhen(diveOptions); heuristicDC.setMaxIterations(majorIterations); if (diveOptions2) { heuristicDC.setPercentageToFix(0.0); heuristicDC.setMaxSimplexIterations(COIN_INT_MAX); heuristicDC.setMaxSimplexIterationsAtRoot(COIN_INT_MAX-(diveOptions2-1)); } model->addHeuristic(&heuristicDC) ; } if ((useDIVING&16) != 0) { CbcHeuristicDiveLineSearch heuristicDL(*model); heuristicDL.setHeuristicName("DiveLineSearch"); heuristicDL.setWhen(diveOptionsNotC); heuristicDL.setMaxIterations(majorIterations); if (diveOptions2) { heuristicDL.setPercentageToFix(0.0); heuristicDL.setMaxSimplexIterations(COIN_INT_MAX); heuristicDL.setMaxSimplexIterationsAtRoot(COIN_INT_MAX-(diveOptions2-1)); } model->addHeuristic(&heuristicDL) ; } if ((useDIVING&32) != 0) { CbcHeuristicDivePseudoCost heuristicDP(*model); heuristicDP.setHeuristicName("DivePseudoCost"); heuristicDP.setWhen(diveOptionsNotC /*+ diveOptions2*/); heuristicDP.setMaxIterations(majorIterations); if (diveOptions2) { heuristicDP.setPercentageToFix(0.0); heuristicDP.setMaxSimplexIterations(COIN_INT_MAX); heuristicDP.setMaxSimplexIterationsAtRoot(COIN_INT_MAX-(diveOptions2-1)); } model->addHeuristic(&heuristicDP) ; } anyToDo = true; } #ifdef JJF_ZERO if (usePivotC >= type && usePivotC <= kType + 1) { CbcHeuristicPivotAndComplement heuristic(*model); heuristic.setHeuristicName("pivot and complement"); heuristic.setFractionSmall(10.0); // normally 0.5 model->addHeuristic(&heuristic); anyToDo = true; } #endif if (usePivotF >= type && usePivotF <= kType + 1) { CbcHeuristicPivotAndFix heuristic(*model); heuristic.setHeuristicName("pivot and fix"); heuristic.setFractionSmall(10.0); // normally 0.5 model->addHeuristic(&heuristic); anyToDo = true; } if (useRand >= type && useRand <= kType + 1) { CbcHeuristicRandRound heuristic(*model); heuristic.setHeuristicName("randomized rounding"); heuristic.setFractionSmall(10.0); // normally 0.5 model->addHeuristic(&heuristic); anyToDo = true; } if (useDINS >= kType && useDINS <= kType + 1) { CbcHeuristicDINS heuristic5a(*model); heuristic5a.setHeuristicName("DINS"); heuristic5a.setFractionSmall(0.6); if (useDINS < 4) heuristic5a.setDecayFactor(5.0); else heuristic5a.setDecayFactor(1.5); heuristic5a.setNumberNodes(1000); model->addHeuristic(&heuristic5a) ; anyToDo = true; } if (useRINS >= kType && useRINS <= kType + 1) { CbcHeuristicRINS heuristic5(*model); heuristic5.setHeuristicName("RINS"); if (useRINS < 4) { heuristic5.setFractionSmall(0.5); heuristic5.setDecayFactor(5.0); } else { heuristic5.setFractionSmall(0.6); heuristic5.setDecayFactor(1.5); } model->addHeuristic(&heuristic5) ; anyToDo = true; } if (useDW >= kType && useDW <= kType + 1) { CbcHeuristicDW heuristic13(*model); heuristic13.setHeuristicName("Dantzig-Wolfe"); heuristic13.setNumberPasses(100); heuristic13.setNumberBadPasses(10); int numberIntegers=0; const OsiSolverInterface * solver = model->solver(); int numberColumns = solver->getNumCols(); for (int i=0;iisInteger(i)) numberIntegers++; } heuristic13.setNumberNeeded(CoinMin(200,numberIntegers/10)); model->addHeuristic(&heuristic13); anyToDo = true; } if (useCombine >= kType && (useCombine-1)%3 <= kType ) { CbcHeuristicLocal heuristic2(*model); heuristic2.setHeuristicName("combine solutions"); heuristic2.setFractionSmall(0.5); int searchType=1; if (useCombine>3) searchType += 10; // experiment heuristic2.setSearchType(searchType); model->addHeuristic(&heuristic2); anyToDo = true; } if ((useProximity >= kType && useProximity <= kType + 1) || (kType == 1 && useProximity > 3) ){ CbcHeuristicProximity heuristic2a(*model); heuristic2a.setHeuristicName("Proximity Search"); heuristic2a.setFractionSmall(9999999.0); heuristic2a.setNumberNodes(30); heuristic2a.setFeasibilityPumpOptions(-2); if (useProximity>=4) { const int nodes[]={10,100,300}; heuristic2a.setNumberNodes(nodes[useProximity-4]); // more print out and stronger feasibility pump if (useProximity==6) heuristic2a.setFeasibilityPumpOptions(-3); } else { int proximityNumber; parameters_[whichParam(CBC_PARAM_STR_PROXIMITY, numberParameters_, parameters_)].currentOptionAsInteger(proximityNumber); if (proximityNumber>0) { heuristic2a.setNumberNodes(proximityNumber); // more print out and stronger feasibility pump if (proximityNumber>=300) heuristic2a.setFeasibilityPumpOptions(-3); } } model->addHeuristic(&heuristic2a); anyToDo = true; } if (useCrossover >= kType && useCrossover <= kType + 1) { CbcHeuristicCrossover heuristic2a(*model); heuristic2a.setHeuristicName("crossover"); heuristic2a.setFractionSmall(0.3); // just fix at lower heuristic2a.setWhen(11); model->addHeuristic(&heuristic2a); model->setMaximumSavedSolutions(5); anyToDo = true; } int heurSwitches = parameters_[whichParam(CBC_PARAM_INT_HOPTIONS, numberParameters_, parameters_)].intValue() % 100; if (heurSwitches) { for (int iHeur = 0; iHeur < model->numberHeuristics(); iHeur++) { CbcHeuristic * heuristic = model->heuristic(iHeur); heuristic->setSwitches(heurSwitches); } } if (type == 2 && anyToDo) { // Do heuristics #ifndef JJF_ONE // clean copy CbcModel model2(*model); // But get rid of heuristics in model model->doHeuristicsAtRoot(2); if (logLevel <= 1) model2.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); OsiBabSolver defaultC; //solver_->setAuxiliaryInfo(&defaultC); model2.passInSolverCharacteristics(&defaultC); // Save bounds int numberColumns = model2.solver()->getNumCols(); model2.createContinuousSolver(); bool cleanModel = !model2.numberIntegers() && !model2.numberObjects(); model2.findIntegers(false); int heurOptions = (parameters_[whichParam(CBC_PARAM_INT_HOPTIONS, numberParameters_, parameters_)].intValue() / 100) % 100; if (heurOptions == 0 || heurOptions == 2) { model2.doHeuristicsAtRoot(1); } else if (heurOptions == 1 || heurOptions == 3) { model2.setMaximumNodes(-1); CbcStrategyDefault strategy(0, 5, 5); strategy.setupPreProcessing(1, 0); model2.setStrategy(strategy); model2.branchAndBound(); } if (cleanModel) model2.zapIntegerInformation(false); if (model2.bestSolution()) { double value = model2.getMinimizationObjValue(); model->setCutoff(value); model->setBestSolution(model2.bestSolution(), numberColumns, value); model->setSolutionCount(1); model->setNumberHeuristicSolutions(1); } #else if (logLevel <= 1) model->solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); OsiBabSolver defaultC; //solver_->setAuxiliaryInfo(&defaultC); model->passInSolverCharacteristics(&defaultC); // Save bounds int numberColumns = model->solver()->getNumCols(); model->createContinuousSolver(); bool cleanModel = !model->numberIntegers() && !model->numberObjects(); model->findIntegers(false); model->doHeuristicsAtRoot(1); if (cleanModel) model->zapIntegerInformation(false); #endif return 0; } else { return 0; } } CoinMP-1.8.3/Cbc/src/CbcCompareObjective.hpp0000644000175000017500000000265312131054770017142 0ustar renerene// $Id: CbcCompareObjective.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCompareActual #ifndef CbcCompareObjective_H #define CbcCompareObjective_H //############################################################################# /* These are alternative strategies for node traversal. They can take data etc for fine tuning At present the node list is stored as a heap and the "test" comparison function returns true if node y is better than node x. */ #include "CbcNode.hpp" #include "CbcCompareBase.hpp" #include "CbcCompare.hpp" class CbcModel; class CbcCompareObjective : public CbcCompareBase { public: // Default Constructor CbcCompareObjective (); virtual ~CbcCompareObjective(); // Copy constructor CbcCompareObjective ( const CbcCompareObjective &rhs); // Assignment operator CbcCompareObjective & operator=( const CbcCompareObjective& rhs); /// Clone virtual CbcCompareBase * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp); /* This returns true if objective value of node y is less than objective value of node x */ virtual bool test (CbcNode * x, CbcNode * y); }; #endif //CbcCompareObjective_H CoinMP-1.8.3/Cbc/src/CbcHeuristicFPump.hpp0000644000175000017500000002657311510742604016637 0ustar renerene/* $Id: CbcHeuristicFPump.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicFeasibilityPump_H #define CbcHeuristicFeasibilityPump_H #include "CbcHeuristic.hpp" #include "OsiClpSolverInterface.hpp" /** Feasibility Pump class */ class CbcHeuristicFPump : public CbcHeuristic { public: // Default Constructor CbcHeuristicFPump (); // Constructor with model - assumed before cuts CbcHeuristicFPump (CbcModel & model, double downValue = 0.5, bool roundExpensive = false); // Copy constructor CbcHeuristicFPump ( const CbcHeuristicFPump &); // Destructor ~CbcHeuristicFPump (); /// Assignment operator CbcHeuristicFPump & operator=(const CbcHeuristicFPump& rhs); /// Clone virtual CbcHeuristic * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts. It may make sense for user to call this outside Branch and Cut to get solution. Or normally is just at root node. * new meanings for when_ - on first try then set back to 1 11 - at end fix all integers at same bound throughout 12 - also fix all integers staying at same internal integral value throughout 13 - also fix all continuous variables staying at same bound throughout 14 - also fix all continuous variables staying at same internal value throughout 15 - as 13 but no internal integers And beyond that, it's apparently possible for the range to be between 21 and 25, in which case it's reduced on entry to solution() to be between 11 and 15 and allSlack is set to true. Then, if we're not processing general integers, we'll use an all-slack basis to solve ... what? Don't see that yet. */ virtual int solution(double & objectiveValue, double * newSolution); /// Set maximum Time (default off) - also sets starttime to current void setMaximumTime(double value); /// Get maximum Time (default 0.0 == time limit off) inline double maximumTime() const { return maximumTime_; } /// Set fake cutoff (default COIN_DBL_MAX == off) inline void setFakeCutoff(double value) { fakeCutoff_ = value; } /// Get fake cutoff (default 0.0 == off) inline double fakeCutoff() const { return fakeCutoff_; } /// Set absolute increment (default 0.0 == off) inline void setAbsoluteIncrement(double value) { absoluteIncrement_ = value; } /// Get absolute increment (default 0.0 == off) inline double absoluteIncrement() const { return absoluteIncrement_; } /// Set relative increment (default 0.0 == off) inline void setRelativeIncrement(double value) { relativeIncrement_ = value; } /// Get relative increment (default 0.0 == off) inline double relativeIncrement() const { return relativeIncrement_; } /// Set default rounding (default 0.5) inline void setDefaultRounding(double value) { defaultRounding_ = value; } /// Get default rounding (default 0.5) inline double defaultRounding() const { return defaultRounding_; } /// Set initial weight (default 0.0 == off) inline void setInitialWeight(double value) { initialWeight_ = value; } /// Get initial weight (default 0.0 == off) inline double initialWeight() const { return initialWeight_; } /// Set weight factor (default 0.1) inline void setWeightFactor(double value) { weightFactor_ = value; } /// Get weight factor (default 0.1) inline double weightFactor() const { return weightFactor_; } /// Set threshold cost for using original cost - even on continuous (default infinity) inline void setArtificialCost(double value) { artificialCost_ = value; } /// Get threshold cost for using original cost - even on continuous (default infinity) inline double artificialCost() const { return artificialCost_; } /// Get iteration to size ratio inline double iterationRatio() const { return iterationRatio_; } /// Set iteration to size ratio inline void setIterationRatio(double value) { iterationRatio_ = value; } /// Set maximum passes (default 100) inline void setMaximumPasses(int value) { maximumPasses_ = value; } /// Get maximum passes (default 100) inline int maximumPasses() const { return maximumPasses_; } /// Set maximum retries (default 1) inline void setMaximumRetries(int value) { maximumRetries_ = value; } /// Get maximum retries (default 1) inline int maximumRetries() const { return maximumRetries_; } /** Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions for local search 1 - do not reuse solves, accumulate integer solutions for local search 2 - reuse solves, do not accumulate integer solutions for local search 3 - reuse solves, accumulate integer solutions for local search If we add 4 then use second form of problem (with extra rows and variables for general integers) At some point (date?), I added And then there are a few bit fields: 4 - something about general integers So my (lh) guess for 4 was at least in the ballpark, but I'll have to rethink 8 entirely (and it may well not mean the same thing as it did when I added that comment. 8 - determines whether we process general integers And on 090831, John added If we add 4 then use second form of problem (with extra rows and variables for general integers) If we add 8 then can run after initial cuts (if no solution) */ inline void setAccumulate(int value) { accumulate_ = value; } /// Get accumulation option inline int accumulate() const { return accumulate_; } /** Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - fix integers on reduced costs but only on entry */ inline void setFixOnReducedCosts(int value) { fixOnReducedCosts_ = value; } /// Get reduced cost option inline int fixOnReducedCosts() const { return fixOnReducedCosts_; } /** Set reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing */ inline void setReducedCostMultiplier(double value) { reducedCostMultiplier_ = value; } /// Get reduced cost multiplier inline double reducedCostMultiplier() const { return reducedCostMultiplier_; } protected: // Data /// Start time double startTime_; /// Maximum Cpu seconds double maximumTime_; /** Fake cutoff value. If set then better of real cutoff and this used to add a constraint */ double fakeCutoff_; /// If positive carry on after solution expecting gain of at least this double absoluteIncrement_; /// If positive carry on after solution expecting gain of at least this times objective double relativeIncrement_; /// Default is round up if > this double defaultRounding_; /// Initial weight for true objective double initialWeight_; /// Factor for decreasing weight double weightFactor_; /// Threshold cost for using original cost - even on continuous double artificialCost_; /** If iterationRatio >0 use instead of maximumPasses_ test is iterations > ratio*(2*nrow+ncol) */ double iterationRatio_; /** Reduced cost multiplier 1.0 as normal <1.0 (x) - pretend gap is x* actual gap - just for fixing */ double reducedCostMultiplier_; /// Maximum number of passes int maximumPasses_; /** Maximum number of retries if we find a solution. If negative we clean out used array */ int maximumRetries_; /** Set use of multiple solutions and solves 0 - do not reuse solves, do not accumulate integer solutions for local search 1 - do not reuse solves, accumulate integer solutions for local search 2 - reuse solves, do not accumulate integer solutions for local search 3 - reuse solves, accumulate integer solutions for local search If we add 4 then use second form of problem (with extra rows and variables for general integers) If we do not accumulate solutions then no mini branch and bounds will be done reuse - refers to initial solve after adding in new "cut" If we add 8 then can run after initial cuts (if no solution) */ int accumulate_; /** Set whether to fix variables on known solution 0 - do not fix 1 - fix integers on reduced costs 2 - fix integers on reduced costs but only on entry */ int fixOnReducedCosts_; /// If true round to expensive bool roundExpensive_; private: /** Rounds solution - down if < downValue If roundExpensive then always to more expnsive. returns 0 if current is solution */ int rounds(OsiSolverInterface * solver, double * solution, /*const double * objective, */ int numberIntegers, const int * integerVariable, /*char * pumpPrint,*/int passNumber, /*bool roundExpensive=false,*/ double downValue = 0.5, int *flip = 0); /* note for eagle eyed readers. when_ can now be exotic - <=10 normal */ }; # ifdef COIN_HAS_CLP class CbcDisasterHandler : public OsiClpDisasterHandler { public: /**@name Virtual methods that the derived classe should provide. */ //@{ #ifdef JJF_ZERO /// Into simplex virtual void intoSimplex(); /// Checks if disaster virtual bool check() const ; /// saves information for next attempt virtual void saveInfo(); #endif /// Type of disaster 0 can fix, 1 abort virtual int typeOfDisaster(); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ CbcDisasterHandler(CbcModel * model = NULL); /** Destructor */ virtual ~CbcDisasterHandler(); // Copy CbcDisasterHandler(const CbcDisasterHandler&); // Assignment CbcDisasterHandler& operator=(const CbcDisasterHandler&); /// Clone virtual ClpDisasterHandler * clone() const; //@} /**@name Sets/gets */ //@{ /** set model. */ void setCbcModel(CbcModel * model); /// Get model inline CbcModel * cbcModel() const { return cbcModel_; } //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer to model CbcModel * cbcModel_; //@} }; #endif #endif CoinMP-1.8.3/Cbc/src/CbcGeneric.cpp0000644000175000017500000003720012131054770015264 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGeneric.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #include "CbcConfig.h" #include "CoinPragma.hpp" #include #include #include #include #include #include #include #include "CoinFileIO.hpp" #include "CoinMpsIO.hpp" #include "CoinPackedMatrix.hpp" #include "CoinPackedVector.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinTime.hpp" #include "OsiSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CglCutGenerator.hpp" #include "CglProbing.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglGomory.hpp" #include "CglKnapsackCover.hpp" #include "CglMixedIntegerRounding2.hpp" #include "CglOddHole.hpp" #include "CglRedSplit.hpp" #include "CglTwomir.hpp" #include "CglPreProcess.hpp" #include "CbcModel.hpp" #include "CbcEventHandler.hpp" #include "CbcTree.hpp" #include "CbcCutGenerator.hpp" #include "CbcHeuristic.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcHeuristicGreedy.hpp" #include "CbcHeuristicLocal.hpp" #include "CbcTreeLocal.hpp" #include "CbcCompareActual.hpp" #include "CoinParam.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" #include "CbcGenCbcParam.hpp" #include "CbcGenOsiParam.hpp" namespace { char svnid[] = "$Id: CbcGeneric.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } namespace CbcGenSolvers { OsiSolverInterface *setupSolvers() ; void deleteSolvers() ; } /* Unnamed local namespace for cbc-generic support types and functions. */ namespace { /* Utility to mark the parameter as having been set by the user. This is a bit clumsy --- we need to cast to a derived parameter type to get the parameter code. But it'll do 'til I think of a better way. */ void markAsSetByUser (CbcGenCtlBlk &ctlBlk, CoinParam *param) { CbcGenParam *genParam = dynamic_cast(param) ; CbcCbcParam *cbcParam = dynamic_cast(param) ; CbcOsiParam *osiParam = dynamic_cast(param) ; int code = -1 ; if (genParam != 0) { code = genParam->paramCode() ; } else if (cbcParam != 0) { code = cbcParam->paramCode() ; } else if (osiParam != 0) { code = osiParam->paramCode() ; } else { std::cerr << "Unrecognised parameter class! Serious internal confusion." << std::endl ; } if (code >= 0) { ctlBlk.setByUser_[code] = true ; } return ; } } // end unnamed namespace int main (int argc, const char *argv[]) { /* This interior block contains all memory allocation; useful for debugging. */ { double time1 = CoinCpuTime() ; double time2 ; /* Try and get all the various i/o to come out in order. Synchronise with C stdio and make stderr and stdout unbuffered. */ std::ios::sync_with_stdio() ; setbuf(stderr, 0) ; setbuf(stdout, 0) ; /* The constructor for ctlBlk establishes the default values for cbc-generic parameters. A little more work is required to create the vector of available solvers and set the default. */ CbcGenCtlBlk ctlBlk ; ctlBlk.setMessages() ; ctlBlk.setLogLevel(1) ; OsiSolverInterface *dfltSolver = CbcGenSolvers::setupSolvers() ; ctlBlk.dfltSolver_ = dfltSolver ; assert (ctlBlk.dfltSolver_) ; /* Now we can begin to initialise the parameter vector. Create a vector of the proper size, then load up the parameters that are relevant to the main program (specifically, values held in ctlBlk and actions evoked from the main program). */ int numParams = 0 ; CoinParamVec paramVec ; paramVec.reserve(CbcOsiParam::CBCOSI_LASTPARAM) ; ctlBlk.paramVec_ = ¶mVec ; ctlBlk.genParams_.first_ = numParams ; CbcGenParamUtils::addCbcGenParams(numParams, paramVec, &ctlBlk) ; ctlBlk.genParams_.last_ = numParams - 1 ; /* Establish a CbcModel object with the default lp solver. Install any defaults that are available from ctlBlk. */ CbcModel *model = new CbcModel(*dfltSolver) ; ctlBlk.model_ = model ; model->messageHandler()->setLogLevel(1) ; model->setNumberStrong(ctlBlk.chooseStrong_.numStrong_) ; model->setNumberBeforeTrust(ctlBlk.chooseStrong_.numBeforeTrust_) ; CbcCbcParamUtils::setCbcModelDefaults(model) ; OsiSolverInterface *osi = model->solver() ; /* Set up the remaining classes of parameters, taking defaults from the CbcModel and OsiSolverInterface objects we've set up. There are parameters that belong to CbcModel (CbcCbcParam) and to the underlying OsiSolverInterface (CbcOsiParam). */ ctlBlk.cbcParams_.first_ = numParams ; CbcCbcParamUtils::addCbcCbcParams(numParams, paramVec, model) ; ctlBlk.cbcParams_.last_ = numParams - 1 ; ctlBlk.osiParams_.first_ = numParams ; CbcOsiParamUtils::addCbcOsiParams(numParams, paramVec, osi) ; ctlBlk.osiParams_.last_ = numParams - 1 ; /* Initialise the vector that tracks parameters that have been changed by user command. */ ctlBlk.setByUser_.resize(CbcOsiParam::CBCOSI_LASTPARAM, false) ; /* The main command parsing loop. Call getCommand to get the next parameter. (The user will be prompted in interactive mode.) If we find something, proceed to process it. If we don't find anything, behaviour depends on what we've seen so far: * An empty command/parameter and no history of previous success gets a brief message. If we're in interactive mode, allow the user to try again, otherwise quit. * An empty command/parameter in interactive mode with some history of successful commands is ignored. Iterate and try again. * An empty command/parameter when we're not interactive is taken as the end of commands. If we have a good model, force branchAndBound. (This is one aspect of giving the expected behaviour for `cbc-generic [parameters] foo.mps'.) */ bool keepParsing = true ; bool forceImport = false ; std::string forceImportFile = "" ; std::string prompt = "cbcGen: " ; std::string pfx = "" ; while (keepParsing) { std::string paramName = CoinParamUtils::getCommand(argc, argv, prompt, &pfx); if (paramName.length() == 0) { if (ctlBlk.paramsProcessed_ == 0) { if (CoinParamUtils::isInteractive()) { std::cout << "Type `?' or `help' for usage and command keywords." << " Type `quit' to quit." ; } else { std::cout << "Type `cbc-generic -help' for usage and parameter keywords." ; keepParsing = false ; } std::cout << std::endl ; } else if (!CoinParamUtils::isInteractive()) { keepParsing = false ; if (ctlBlk.goodModel_ == true && ctlBlk.bab_.majorStatus_ == CbcGenCtlBlk::BACNotRun) { paramName = "branchAndCut" ; pfx = "-" ; } } } if (paramName == "") { continue ; } /* Do we have a parameter we recognise? In command line mode, if there was no prefix (either `-' or `--'), the user didn't intend this as a command keyword. */ int matchNdx ; if (!CoinParamUtils::isCommandLine() || pfx == "-" || pfx == "--") { matchNdx = CoinParamUtils::lookupParam(paramName, paramVec) ; } else { matchNdx = -3 ; } std::cout << "Command is `" << paramName << "', pfx `" << pfx << "', match = " << matchNdx << std::endl ; /* If matchNdx is positive, we have a unique parameter match and we can get on with processing. If the return value is negative, and we're not interactive, quit. If we're interactive, react as appropriate: -1: There was a `?' in the command string. Prompt again. -2: No `?', and one or more short matches. Prompt again. -3: No `?', but we didn't match anything either. If we're in command line mode, and there was no `-' or `--' prefix, try forcing `import' (but just once, eh). This is the other piece required to get `cbc-generic [parameters] foo.mps' to work as expected.) In interactive mode, we'll require the user to say `import'. Interactive mode and no history of successful commands gets the help message. -4: Configuration error, offer `report to maintainers' message. */ if (matchNdx < 0) { if (matchNdx == -3) { if (CoinParamUtils::isCommandLine() && pfx == "") { if (!forceImport) { forceImportFile = paramName ; paramName = "import" ; matchNdx = CoinParamUtils::lookupParam(paramName, paramVec) ; forceImport = true ; } else { std::cout << "No commands matched `" << paramName << "'." << std::endl ; } } else { std::cout << "No commands matched `" << paramName << "'." << std::endl ; if (ctlBlk.paramsProcessed_ == 0) { std::cout << "Type `?' or `help' for usage and command keywords." << " Type `quit' to quit." << std::endl ; } } } else if (matchNdx == -4) { std::cout << "Please report this error by filing a ticket at " << "https://projects.coin-or.org/Cbc/wiki." << std::endl ; } } if (matchNdx < 0) { keepParsing = CoinParamUtils::isInteractive() ; continue ; } CoinParam *param = paramVec[matchNdx] ; ctlBlk.paramsProcessed_++ ; /* Depending on the type, we may need a parameter. For keyword parameters, check that the keyword is recognised --- setKwdVal will quietly fail on a bad keyword. */ CoinParam::CoinParamType type = param->type() ; int valid = 0 ; switch (type) { case CoinParam::coinParamAct: { break ; } case CoinParam::coinParamInt: { int ival = CoinParamUtils::getIntField(argc, argv, &valid) ; if (valid == 0) { param->setIntVal(ival) ; } break ; } case CoinParam::coinParamDbl: { double dval = CoinParamUtils::getDoubleField(argc, argv, &valid) ; if (valid == 0) { param->setDblVal(dval) ; } break ; } case CoinParam::coinParamStr: { if (forceImport) { param->setStrVal(forceImportFile) ; } else { const std::string tmp = CoinParamUtils::getStringField(argc, argv, &valid) ; if (valid == 0) { param->setStrVal(tmp) ; } } break ; } case CoinParam::coinParamKwd: { const std::string tmp = CoinParamUtils::getStringField(argc, argv, &valid) ; if (valid == 0) { param->setKwdVal(tmp) ; if (param->kwdVal() != tmp) { std::cout << "Unrecognised keyword `" << tmp << "' for parameter " << param->name() << std::endl ; param->printKwds() ; std::cout << std::endl ; valid = 1 ; } } break ; } default: { assert (false) ; break ; } } /* Deal with missing or incorrect values. If valid came back as 2, we're short a parameter. This is interpreted as a request to tell the user the current value. If valid came back as 1, we had some sort of parse error. Print an error message. */ if (valid != 0) { switch (valid) { case 1: { std::cout << "Could not parse the value given for parameter `" << param->name() << "'." << std::endl ; break ; } case 2: { std::cout << "Current value of " << param->name() << " parameter is `" << *param << "'." << std::endl ; break ; } default: { std::cout << "Parse status is " << valid << "; this indicates internal confusion." << std::endl << "Please report this error by filing a ticket at " << "https://projects.coin-or.org/Cbc/wiki." << std::endl ; } } keepParsing = CoinParamUtils::isInteractive() ; continue ; } /* Ok, call the parameter's push function to do the heavy lifting. Push and pull functions return 0 for success, 1 for non-fatal error, -1 for fatal error. */ if (param->pushFunc() == 0) { std::cout << "Parameter `" << param->name() << "' is not implemented." << std::endl ; } else { int retval = (param->pushFunc())(param) ; markAsSetByUser(ctlBlk, param) ; if (retval < 0) { keepParsing = false ; } } } /* End of loop to parse and execute parameter actions. Time to do cleanup. The destructor for CbcGenCtlBlk will delete anything with a non-null pointer, so we need to be careful that the default solver is deleted only once. */ ctlBlk.dfltSolver_ = 0 ; CbcGenSolvers::deleteSolvers() ; for (int i = 0 ; i < paramVec.size() ; i++) { if (paramVec[i] != 0) delete paramVec[i] ; } } /* End of memory allocation block. There should be no allocated objects at this point. */ return (0) ; } CoinMP-1.8.3/Cbc/src/Cbc_C_Interface.cpp0000644000175000017500000007350312350716705016225 0ustar renerene// $Id: Cbc_C_Interface.cpp 2039 2014-06-20 02:34:45Z mlubin $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPragma.hpp" //#include "CoinHelperFunctions.hpp" //#include "CoinPackedMatrix.hpp" #include "CoinTime.hpp" #include "CbcModel.hpp" #include "CbcBranchActual.hpp" #include "CoinMessageHandler.hpp" #include "OsiClpSolverInterface.hpp" // bobe including extras.h to get strdup() #if defined(__MWERKS__) // #include // bobe 06-02-14 #endif // Get C stuff but with extern C #define CBC_EXTERN_C #include "Coin_C_defines.h" #define CbcGetProperty(T,prop) \ COINLIBAPI T COINLINKAGE \ Cbc_ ## prop (Cbc_Model *m) \ { \ return m->model_->prop(); \ } #define CbcSetSolverProperty(T,prop) \ COINLIBAPI void COINLINKAGE \ Cbc_ ## prop (Cbc_Model *m, int index, T val) \ { \ m->model_->solver()->prop(index,val); \ } const int VERBOSE = 0; // To allow call backs class Cbc_MessageHandler : public CoinMessageHandler { public: /**@name Overrides */ //@{ virtual int print(); //@} /**@name set and get */ //@{ /// Model const Cbc_Model * model() const; void setModel(Cbc_Model * model); /// Call back void setCallBack(cbc_callback callback); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ Cbc_MessageHandler(); /// Constructor with pointer to model Cbc_MessageHandler(Cbc_Model * model, FILE * userPointer = NULL); /** Destructor */ virtual ~Cbc_MessageHandler(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ Cbc_MessageHandler(const Cbc_MessageHandler&); /** The copy constructor from an CoinSimplexMessageHandler. */ Cbc_MessageHandler(const CoinMessageHandler&); Cbc_MessageHandler& operator=(const Cbc_MessageHandler&); /// Clone virtual CoinMessageHandler * clone() const ; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer back to model Cbc_Model * model_; /// call back cbc_callback callback_; //@} }; //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- Cbc_MessageHandler::Cbc_MessageHandler () : CoinMessageHandler(), model_(NULL), callback_(NULL) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- Cbc_MessageHandler::Cbc_MessageHandler (const Cbc_MessageHandler & rhs) : CoinMessageHandler(rhs), model_(rhs.model_), callback_(rhs.callback_) { } Cbc_MessageHandler::Cbc_MessageHandler (const CoinMessageHandler & rhs) : CoinMessageHandler(rhs), model_(NULL), callback_(NULL) { } // Constructor with pointer to model Cbc_MessageHandler::Cbc_MessageHandler(Cbc_Model * model, FILE * /*userPointer*/) : CoinMessageHandler(), model_(model), callback_(NULL) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- Cbc_MessageHandler::~Cbc_MessageHandler () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- Cbc_MessageHandler & Cbc_MessageHandler::operator=(const Cbc_MessageHandler & rhs) { if (this != &rhs) { CoinMessageHandler::operator=(rhs); model_ = rhs.model_; callback_ = rhs.callback_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CoinMessageHandler * Cbc_MessageHandler::clone() const { return new Cbc_MessageHandler(*this); } int Cbc_MessageHandler::print() { if (callback_) { int messageNumber = currentMessage().externalNumber(); if (currentSource() != "Cbc") messageNumber += 1000000; int i; int nDouble = numberDoubleFields(); assert (nDouble <= 200); double vDouble[200]; for (i = 0; i < nDouble; i++) vDouble[i] = doubleValue(i); int nInt = numberIntFields(); assert (nInt <= 200); int vInt[200]; for (i = 0; i < nInt; i++) vInt[i] = intValue(i); int nString = numberStringFields(); assert (nString <= 200); char * vString[200]; for (i = 0; i < nString; i++) { std::string value = stringValue(i); vString[i] = CoinStrdup(value.c_str()); } callback_(model_, messageNumber, nDouble, vDouble, nInt, vInt, nString, vString); for (i = 0; i < nString; i++) free(vString[i]); } return CoinMessageHandler::print(); return 0; } const Cbc_Model * Cbc_MessageHandler::model() const { return model_; } void Cbc_MessageHandler::setModel(Cbc_Model * model) { model_ = model; } // Call back void Cbc_MessageHandler::setCallBack(cbc_callback callback) { callback_ = callback; } /** * * C Interface Routines * */ #include "Cbc_C_Interface.h" #include #include #include #if defined(__MWERKS__) #pragma export on #endif /* Version */ COINLIBAPI const char* COINLINKAGE Cbc_getVersion() { return CBC_VERSION; } /* Default Cbc_Model constructor */ COINLIBAPI Cbc_Model * COINLINKAGE Cbc_newModel() { const char prefix[] = "Cbc_C_Interface::Cbc_newModel(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); Cbc_Model * model = new Cbc_Model(); OsiClpSolverInterface solver1; model->solver_ = &solver1; model->model_ = new CbcModel(solver1); CbcMain0(*model->model_); model->handler_ = NULL; if (VERBOSE > 0) printf("%s return\n", prefix); return model; } /* Cbc_Model Destructor */ COINLIBAPI void COINLINKAGE Cbc_deleteModel(Cbc_Model * model) { const char prefix[] = "Cbc_C_Interface::Cbc_deleteModel(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); fflush(stdout); if (VERBOSE > 1) printf("%s delete model->model_\n", prefix); fflush(stdout); delete model->model_; if (VERBOSE > 1) printf("%s delete model->handler_\n", prefix); fflush(stdout); delete model->handler_; if (VERBOSE > 1) printf("%s delete model\n", prefix); fflush(stdout); delete model; if (VERBOSE > 0) printf("%s return\n", prefix); fflush(stdout); } /* Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is NULL then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ COINLIBAPI void COINLINKAGE Cbc_loadProblem (Cbc_Model * model, const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { const char prefix[] = "Cbc_C_Interface::Cbc_loadProblem(): "; // const int VERBOSE = 2; if (VERBOSE > 0) printf("%s begin\n", prefix); OsiSolverInterface * solver = model->model_->solver(); if (VERBOSE > 1) { printf("%s numcols = %i, numrows = %i\n", prefix, numcols, numrows); printf("%s model = %p, start = %p, index = %p, value = %p\n", prefix, static_cast(model), static_cast(start), static_cast(index), static_cast(value)); printf("%s collb = %p, colub = %p, obj = %p, rowlb = %p, rowub = %p\n", prefix, static_cast(collb), static_cast(colub), static_cast(obj), static_cast(rowlb), static_cast(rowub)); } if (VERBOSE > 1) printf("%s Calling solver->loadProblem()\n", prefix); fflush(stdout); solver->loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); if (VERBOSE > 1) printf("%s Finished solver->loadProblem()\n", prefix); fflush(stdout); if (VERBOSE > 0) printf("%s return\n", prefix); } // Cbc_loadProblem() /* Read an mps file from the given filename */ COINLIBAPI int COINLINKAGE Cbc_readMps(Cbc_Model * model, const char *filename) { const char prefix[] = "Cbc_C_Interface::Cbc_readMps(): "; // const int VERBOSE = 2; if (VERBOSE > 0) printf("%s begin\n", prefix); if (VERBOSE > 1) printf("%s filename = '%s'\n", prefix, filename); int result = 1; result = model->model_->solver()->readMps(filename); assert(result == 0); if (VERBOSE > 0) printf("%s return %i\n", prefix, result); return result; } /* Write an mps file from the given filename */ COINLIBAPI void COINLINKAGE Cbc_writeMps(Cbc_Model * model, const char *filename) { const char prefix[] = "Cbc_C_Interface::Cbc_writeMps(): "; // const int VERBOSE = 2; if (VERBOSE > 0) printf("%s begin\n", prefix); if (VERBOSE > 1) printf("%s filename = '%s'\n", prefix, filename); model->model_->solver()->writeMps(filename, "mps", Cbc_getObjSense(model)); if (VERBOSE > 0) printf("%s return\n", prefix); return; } COINLIBAPI void COINLINKAGE Cbc_setInitialSolution(Cbc_Model *model, const double * sol) { int n = Cbc_getNumCols(model); // We need to manually compute the objective here for some reason const double *objvec = Cbc_getObjCoefficients(model); double objval = 0; for (int i = 0; i < n; i++) { objval += objvec[i]*sol[i]; } model->model_->setBestSolution(sol, n, objval, true); } COINLIBAPI void COINLINKAGE Cbc_setParameter(Cbc_Model * model, const char * name, const char * value) { model->cmdargs_.push_back(std::string("-")+name); model->cmdargs_.push_back(value); } /* Fills in array with problem name */ COINLIBAPI void COINLINKAGE Cbc_problemName(Cbc_Model * model, int maxNumberCharacters, char * array) { std::string name; model->model_->solver()->getStrParam(OsiProbName, name); strncpy(array, name.c_str(), maxNumberCharacters); } /* Sets problem name. Must have \0 at end. */ COINLIBAPI int COINLINKAGE Cbc_setProblemName(Cbc_Model * model, const char * array) { bool result = false; result = model->model_->solver()->setStrParam(OsiProbName, array); return (result) ? 1 : 0; } CbcGetProperty(int, status) CbcGetProperty(int, secondaryStatus) /* Number of elements in matrix */ COINLIBAPI int COINLINKAGE Cbc_getNumElements(Cbc_Model * model) { const char prefix[] = "Cbc_C_Interface::Cbc_getNumElements(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); int result = 0; result = model->model_->getNumElements(); if (VERBOSE > 0) printf("%s return %i\n", prefix, result); return result; } // Column starts in matrix COINLIBAPI const CoinBigIndex * COINLINKAGE Cbc_getVectorStarts(Cbc_Model * model) { const CoinPackedMatrix * matrix = NULL; matrix = model->model_->solver()->getMatrixByCol(); return (matrix == NULL) ? NULL : matrix->getVectorStarts(); } // Row indices in matrix COINLIBAPI const int * COINLINKAGE Cbc_getIndices(Cbc_Model * model) { const char prefix[] = "Cbc_C_Interface::Cbc_getIndices(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); const int * result = NULL; const CoinPackedMatrix * matrix = NULL; matrix = model->model_->solver()->getMatrixByCol(); result = (matrix == NULL) ? NULL : matrix->getIndices(); if (VERBOSE > 0) printf("%s return %p\n", prefix, static_cast(result)); return result; } // Element values in matrix COINLIBAPI const double * COINLINKAGE Cbc_getElements(Cbc_Model * model) { const char prefix[] = "Cbc_C_Interface::Cbc_getElements(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); const double * result = NULL; const CoinPackedMatrix * matrix = NULL; matrix = model->model_->solver()->getMatrixByCol(); result = (matrix == NULL) ? NULL : matrix->getElements(); if (VERBOSE > 0) printf("%s return %p\n", prefix, static_cast(result)); return result; } // ====================================================================== /* Pass in Callback function */ COINLIBAPI void COINLINKAGE Cbc_registerCallBack(Cbc_Model * model, cbc_callback userCallBack) { const char prefix[] = "Cbc_C_Interface::Cbc_registerCallBack(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); // Will be copy of users one delete model->handler_; model->handler_ = new Cbc_MessageHandler(*(model->model_->messageHandler())); model->handler_->setCallBack(userCallBack); model->handler_->setModel(model); model->model_->passInMessageHandler(model->handler_); if (VERBOSE > 0) printf("%s return\n", prefix); } /* Unset Callback function */ COINLIBAPI void COINLINKAGE Cbc_clearCallBack(Cbc_Model * model) { const char prefix[] = "Cbc_C_Interface::Cbc_clearCallBack(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); delete model->handler_; model->handler_ = NULL; if (VERBOSE > 0) printf("%s return\n", prefix); } /* length of names (0 means no names0 */ COINLIBAPI size_t COINLINKAGE Cbc_maxNameLength(Cbc_Model * model) { size_t result = 0; OsiSolverInterface::OsiNameVec const & rownames = model->model_->solver()->getRowNames(); for (size_t i = 0; i < rownames.size(); i++) { if (rownames[i].length() > result) result = rownames[i].length(); } OsiSolverInterface::OsiNameVec const & colnames = model->model_->solver()->getColNames(); for (size_t i = 0; i < colnames.size(); i++) { if (colnames[i].length() > result) result = colnames[i].length(); } return result; } COINLIBAPI void COINLINKAGE Cbc_getRowName(Cbc_Model * model, int iRow, char * name, size_t maxLength) { std::string rowname = model->model_->solver()->getRowName(iRow); strncpy(name, rowname.c_str(), maxLength); name[maxLength-1] = '\0'; } COINLIBAPI void COINLINKAGE Cbc_getColName(Cbc_Model * model, int iRow, char * name, size_t maxLength) { std::string colname = model->model_->solver()->getColName(iRow); strncpy(name, colname.c_str(), maxLength); name[maxLength-1] = '\0'; } COINLIBAPI void COINLINKAGE Cbc_setColName(Cbc_Model * model, int iColumn, const char * name) { model->model_->solver()->setColName(iColumn, name); } COINLIBAPI void COINLINKAGE Cbc_setRowName(Cbc_Model * model, int iRow, const char * name) { model->model_->solver()->setRowName(iRow, name); } COINLIBAPI int COINLINKAGE Cbc_solve(Cbc_Model * model) { const char prefix[] = "Cbc_C_Interface::Cbc_solve(): "; int result = 0; std::vector argv; argv.push_back("Cbc_C_Interface"); for (size_t i = 0; i < model->cmdargs_.size(); i++) { argv.push_back(model->cmdargs_[i].c_str()); } argv.push_back("-solve"); argv.push_back("-quit"); try { CbcMain1((int)argv.size(), &argv[0], *model->model_); } catch (CoinError e) { printf("%s ERROR: %s::%s, %s\n", prefix, e.className().c_str(), e.methodName().c_str(), e.message().c_str()); } result = model->model_->status(); return result; } /* Sum of primal infeasibilities */ COINLIBAPI double COINLINKAGE Cbc_sumPrimalInfeasibilities(Cbc_Model * /*model*/) { const char prefix[] = "Cbc_C_Interface::Cbc_sumPrimalInfeasibilities(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); double result = 0; // cannot find names in Cbc, Osi, or OsiClp //tbd result = model->model_->sumPrimalInfeasibilities(); if (VERBOSE > 0) printf("%s WARNING: NOT IMPLEMENTED\n", prefix); if (VERBOSE > 0) printf("%s return %g\n", prefix, result); return result; } /* Number of primal infeasibilities */ COINLIBAPI int COINLINKAGE Cbc_numberPrimalInfeasibilities(Cbc_Model * /*model*/) { const char prefix[] = "Cbc_C_Interface::Cbc_numberPrimalInfeasibilities(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); int result = 0; //tbd result = model->model_->getContinuousInfeasibilities(); if (VERBOSE > 0) printf("%s WARNING: NOT IMPLEMENTED\n", prefix); if (VERBOSE > 0) printf("%s return %i\n", prefix, result); return result; } /** Call this to really test if a valid solution can be feasible Solution is number columns in size. If fixVariables true then bounds of continuous solver updated. Returns objective value (worse than cutoff if not feasible) */ COINLIBAPI void COINLINKAGE Cbc_checkSolution(Cbc_Model * /*model*/) { const char prefix[] = "Cbc_C_Interface::Cbc_checkSolution(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); // see CbcModel::checkSolution(double cutoff, const double * solution, // bool fixVariables); // model->model_->checkSolution(); if (VERBOSE > 0) printf("%s return\n", prefix); return; } CbcGetProperty(int, getNumCols) CbcGetProperty(int, getNumRows) CbcGetProperty(int, getIterationCount) CbcGetProperty(int, isAbandoned) CbcGetProperty(int, isProvenOptimal) CbcGetProperty(int, isProvenInfeasible) CbcGetProperty(int, isContinuousUnbounded) CbcGetProperty(int, isNodeLimitReached) CbcGetProperty(int, isSecondsLimitReached) CbcGetProperty(int, isSolutionLimitReached) CbcGetProperty(int, isInitialSolveAbandoned) CbcGetProperty(int, isInitialSolveProvenOptimal) CbcGetProperty(int, isInitialSolveProvenPrimalInfeasible) CbcGetProperty(double, getObjSense) COINLIBAPI void COINLINKAGE Cbc_setObjSense(Cbc_Model * model, double sense) { model->model_->setObjSense(sense); } CbcGetProperty(const double*, getRowActivity) CbcGetProperty(const double*, getColSolution) CbcGetProperty(const double*, getRowLower) CbcSetSolverProperty(double, setRowLower) CbcGetProperty(const double*, getRowUpper) CbcSetSolverProperty(double, setRowUpper) CbcGetProperty(const double*, getObjCoefficients) CbcSetSolverProperty(double, setObjCoeff) CbcGetProperty(const double*, getColLower) CbcSetSolverProperty(double, setColLower) CbcGetProperty(const double*, getColUpper) CbcSetSolverProperty(double, setColUpper) CbcGetProperty(double, getObjValue) CbcGetProperty(double, getBestPossibleObjValue) /* Print model */ COINLIBAPI void COINLINKAGE Cbc_printModel(Cbc_Model * model, const char * argPrefix) { const char prefix[] = "Cbc_C_Interface::Cbc_printModel(): "; const int VERBOSE = 4; if (VERBOSE > 0) printf("%s begin\n", prefix); CbcModel *cbc_model = model->model_; int numrows = cbc_model->getNumRows(); int numcols = cbc_model->getNumCols(); int numelem = cbc_model->getNumElements(); const CoinPackedMatrix * matrix = cbc_model->solver()->getMatrixByCol(); const CoinBigIndex * start = matrix->getVectorStarts(); const int * index = matrix->getIndices(); const double * value = matrix->getElements(); const double * collb = cbc_model->getColLower(); const double * colub = cbc_model->getColUpper(); const double * obj = cbc_model->getObjCoefficients(); const double * rowlb = cbc_model->getRowLower(); const double * rowub = cbc_model->getRowUpper(); printf("%s numcols = %i, numrows = %i, numelem = %i\n", argPrefix, numcols, numrows, numelem); printf("%s model = %p, start = %p, index = %p, value = %p\n", argPrefix, static_cast(model), static_cast(start), static_cast(index), static_cast(value)); matrix->dumpMatrix(NULL); { int i; for (i = 0; i <= numcols; i++) printf("%s start[%i] = %i\n", argPrefix, i, start[i]); for (i = 0; i < numelem; i++) printf("%s index[%i] = %i, value[%i] = %g\n", argPrefix, i, index[i], i, value[i]); } printf("%s collb = %p, colub = %p, obj = %p, rowlb = %p, rowub = %p\n", argPrefix, static_cast(collb), static_cast(colub), static_cast(obj), static_cast(rowlb), static_cast(rowub)); printf("%s optimization direction = %g\n", argPrefix, Cbc_getObjSense(model)); printf(" (1 - minimize, -1 - maximize, 0 - ignore)\n"); { int i; for (i = 0; i < numcols; i++) printf("%s collb[%i] = %g, colub[%i] = %g, obj[%i] = %g\n", argPrefix, i, collb[i], i, colub[i], i, obj[i]); for (i = 0; i < numrows; i++) printf("%s rowlb[%i] = %g, rowub[%i] = %g\n", argPrefix, i, rowlb[i], i, rowub[i]); } if (VERBOSE > 0) printf("%s return\n", prefix); } // Cbc_printModel() COINLIBAPI int COINLINKAGE Cbc_isInteger(Cbc_Model * model, int i) { const char prefix[] = "Cbc_C_Interface::Cbc_isInteger(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); bool result = false; result = model->model_->isInteger(i); if (VERBOSE > 0) printf("%s return %i\n", prefix, result); return (result) ? 1 : 0; } CbcGetProperty(int, getNodeCount) /** Return a copy of this model */ COINLIBAPI Cbc_Model * COINLINKAGE Cbc_clone(Cbc_Model * model) { const char prefix[] = "Cbc_C_Interface::Cbc_clone(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); Cbc_Model * result = new Cbc_Model(); result->model_ = new CbcModel(*(model->model_)); result->solver_ = dynamic_cast< OsiClpSolverInterface*> (result->model_->solver()); result->handler_ = NULL; result->cmdargs_ = model->cmdargs_; if (VERBOSE > 0) printf("%s return\n", prefix); return model; } /** Set this the variable to be continuous */ COINLIBAPI void COINLINKAGE Cbc_setContinuous(Cbc_Model * model, int iColumn) { const char prefix[] = "Cbc_C_Interface::Cbc_setContinuous(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); model->model_->solver()->setContinuous(iColumn); if (VERBOSE > 0) printf("%s return\n", prefix); } /** Set this the variable to be integer */ COINLIBAPI void COINLINKAGE Cbc_setInteger(Cbc_Model * model, int iColumn) { const char prefix[] = "Cbc_C_Interface::Cbc_setContinuous(): "; // const int VERBOSE = 1; if (VERBOSE > 0) printf("%s begin\n", prefix); model->model_->solver()->setInteger(iColumn); if (VERBOSE > 0) printf("%s return\n", prefix); } /** Add SOS constraints to the model using row-order matrix */ COINLIBAPI void COINLINKAGE Cbc_addSOS(Cbc_Model * model, int numRows, const int * rowStarts, const int * colIndices, const double * weights, const int type) { const char prefix[] = "Cbc_C_Interface::Cbc_addSOS(): "; //const int VERBOSE = 4; if (VERBOSE > 0) printf("%sbegin\n", prefix); if (VERBOSE > 0) printf("%s numRows = %i\n", prefix, numRows); int row, i; const int *colIndex; const double *colWeight; // loop on rows and count number of objects according to numWeights>0 int numObjects = 0; for (row = 0; row < numRows; row++) { if (VERBOSE > 2) { printf("%s row = %i\n", prefix, row); printf("%s rowStarts[%i] = %i\n", prefix, row, rowStarts[row]); printf("%s rowStarts[%i+1] = %i\n", prefix, row, rowStarts[row+1]); fflush(stdout); } const int numWeights = rowStarts[row+1] - rowStarts[row]; if (VERBOSE > 2) printf("%s numWeights = %i\n", prefix, numWeights); if (numWeights > 0) numObjects++; } // make objects CbcObject ** objects = new CbcObject * [numObjects]; // if (VERBOSE>1) printf("%s numObjects = %i, objects = %X\n",prefix,numObjects,objects); // loop on rows and make an object when numWeights>0 int objNum = 0; for (row = 0; row < numRows; row++) { if (VERBOSE > 2) { printf("%s row = %i\n", prefix, row); printf("%s rowStarts[%i] = %i\n", prefix, row, rowStarts[row]); printf("%s rowStarts[%i+1] = %i\n", prefix, row, rowStarts[row+1]); } const int numWeights = rowStarts[row+1] - rowStarts[row]; if (VERBOSE > 2) printf("%s numWeights = %i\n", prefix, numWeights); colIndex = colIndices + rowStarts[row]; colWeight = weights + rowStarts[row]; if (numWeights > 0) { // Make a CbcSOS and assign it to objects if (VERBOSE > 3) { for (i = 0; i < numWeights; i++) { printf("%s colIndex [%i] = %i\n", prefix, i, colIndex[i]); printf("%s colWeight[%i] = %f\n", prefix, i, colWeight[i]); } fflush(stdout); } objects[objNum] = new CbcSOS(model->model_, (int)(numWeights), (const int*)colIndex, (const double*)colWeight, (int)objNum, (int)type); // if (VERBOSE>2) printf("%s objects[%i] = %X\n",prefix,objNum,objects[objNum]); if (objects[objNum] == NULL) { printf("%s ERROR: objects[%i] == NULL\n", prefix, objNum); fflush(stdout); assert(objects[objNum] != NULL); } objNum++; } } if (VERBOSE > 2) { printf("%s calling addObjects()\n", prefix); // printf("%s numObjects = %i, objects = %X\n",prefix,numObjects,objects); // for (row=0; rowmodel_->addObjects(numObjects, objects); if (VERBOSE > 1) printf("%s finished addObjects()\n", prefix); for (objNum = 0; objNum < numObjects; objNum++) delete objects[objNum]; delete [] objects; if (VERBOSE > 0) printf("%sreturn\n", prefix); return; } /** Print the solution */ COINLIBAPI void COINLINKAGE Cbc_printSolution(Cbc_Model * model) { { // // Now to print out row solution. The methods used return const // pointers - which is of course much more virtuous. // // This version just does non-zero columns // // * Rows int numberRows = Cbc_getNumRows(model); int iRow; const double * rowPrimal = Cbc_getRowActivity(model); const double * rowLower = Cbc_getRowLower(model); const double * rowUpper = Cbc_getRowUpper(model); printf("--------------------------------------\n"); // * If we have not kept names (parameter to readMps) this will be 0 // assert(Cbc_lengthNames(model)); printf(" Primal Lower Upper\n"); for (iRow = 0; iRow < numberRows; iRow++) { double value; value = rowPrimal[iRow]; if (value > 1.0e-8 || value < -1.0e-8) { char name[20]; // Cbc_columnName(model,iColumn,name); sprintf(name, "ROW%5i", iRow); printf("%6d %8s", iRow, name); printf(" %13g", rowPrimal[iRow]); printf(" %13g", rowLower[iRow]); printf(" %13g", rowUpper[iRow]); printf("\n"); } } printf("--------------------------------------\n"); } { // // Now to print out column solution. The methods used return const // pointers - which is of course much more virtuous. // // This version just does non-zero columns // // // * Columns int numberColumns = Cbc_getNumCols(model); int iColumn; const double * columnPrimal = Cbc_getColSolution(model); const double * columnLower = Cbc_getColLower(model); const double * columnUpper = Cbc_getColUpper(model); const double * columnObjective = Cbc_getObjCoefficients(model); printf("--------------------------------------\n"); // * If we have not kept names (parameter to readMps) this will be 0 // assert(Cbc_lengthNames(model)); printf(" Primal Lower Upper Cost isInteger\n"); for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value; value = columnPrimal[iColumn]; if (value > 1.0e-8 || value < -1.0e-8) { char name[20]; // Cbc_columnName(model,iColumn,name); sprintf(name, "COL%5i", iColumn); printf("%6d %8s", iColumn, name); printf(" %13g", columnPrimal[iColumn]); printf(" %13g", columnLower[iColumn]); printf(" %13g", columnUpper[iColumn]); printf(" %13g", columnObjective[iColumn]); printf(" %13i", Cbc_isInteger(model,iColumn)); printf("\n"); } } printf("--------------------------------------\n"); } if (0) Cbc_printModel(model, "cbc::main(): "); return; } #if defined(__MWERKS__) #pragma export off #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicDivePseudoCost.cpp0000644000175000017500000002152512426717442020504 0ustar renerene/* $Id: CbcHeuristicDivePseudoCost.cpp 2093 2014-11-06 16:17:38Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcHeuristicDivePseudoCost.hpp" #include "CbcStrategy.hpp" #include "CbcBranchDynamic.hpp" // Default Constructor CbcHeuristicDivePseudoCost::CbcHeuristicDivePseudoCost() : CbcHeuristicDive() { } // Constructor from model CbcHeuristicDivePseudoCost::CbcHeuristicDivePseudoCost(CbcModel & model) : CbcHeuristicDive(model) { } // Destructor CbcHeuristicDivePseudoCost::~CbcHeuristicDivePseudoCost () { } // Clone CbcHeuristicDivePseudoCost * CbcHeuristicDivePseudoCost::clone() const { return new CbcHeuristicDivePseudoCost(*this); } // Create C++ lines to get to current state void CbcHeuristicDivePseudoCost::generateCpp( FILE * fp) { CbcHeuristicDivePseudoCost other; fprintf(fp, "0#include \"CbcHeuristicDivePseudoCost.hpp\"\n"); fprintf(fp, "3 CbcHeuristicDivePseudoCost heuristicDivePseudoCost(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicDivePseudoCost"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicDivePseudoCost);\n"); } // Copy constructor CbcHeuristicDivePseudoCost::CbcHeuristicDivePseudoCost(const CbcHeuristicDivePseudoCost & rhs) : CbcHeuristicDive(rhs) { } // Assignment operator CbcHeuristicDivePseudoCost & CbcHeuristicDivePseudoCost::operator=( const CbcHeuristicDivePseudoCost & rhs) { if (this != &rhs) { CbcHeuristicDive::operator=(rhs); } return *this; } bool CbcHeuristicDivePseudoCost::selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound) { int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); // get the LP relaxation solution at the root node double * rootNodeLPSol = model_->continuousSolution(); // get pseudo costs double * pseudoCostDown = downArray_; double * pseudoCostUp = upArray_; bestColumn = -1; bestRound = -1; // -1 rounds down, +1 rounds up double bestScore = -1.0; bool allTriviallyRoundableSoFar = true; int bestPriority = COIN_INT_MAX; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double rootValue = rootNodeLPSol[iColumn]; double value = newSolution[iColumn]; double fraction = value - floor(value); int round = 0; if (fabs(floor(value + 0.5) - value) > integerTolerance) { if (allTriviallyRoundableSoFar || (downLocks_[i] > 0 && upLocks_[i] > 0)) { if (allTriviallyRoundableSoFar && downLocks_[i] > 0 && upLocks_[i] > 0) { allTriviallyRoundableSoFar = false; bestScore = -1.0; } double pCostDown = pseudoCostDown[i]; double pCostUp = pseudoCostUp[i]; assert(pCostDown >= 0.0 && pCostUp >= 0.0); if (allTriviallyRoundableSoFar && downLocks_[i] == 0 && upLocks_[i] > 0) round = 1; else if (allTriviallyRoundableSoFar && downLocks_[i] > 0 && upLocks_[i] == 0) round = -1; else if (value - rootValue < -0.4) round = -1; else if (value - rootValue > 0.4) round = 1; else if (fraction < 0.3) round = -1; else if (fraction > 0.7) round = 1; else if (pCostDown < pCostUp) round = -1; else round = 1; // calculate score double score; if (round == 1) score = fraction * (pCostDown + 1.0) / (pCostUp + 1.0); else score = (1.0 - fraction) * (pCostUp + 1.0) / (pCostDown + 1.0); // if variable is binary, increase its chance of being selected if (solver->isBinary(iColumn)) score *= 1000.0; // if priorities then use if (priority_) { int thisRound=static_cast(priority_[i].direction); if ((thisRound&1)!=0) round = ((thisRound&2)==0) ? -1 : +1; if (priority_[i].priority>bestPriority) { score=COIN_DBL_MAX; } else if (priority_[i].priority(priority_[i].priority); bestScore=COIN_DBL_MAX; } } if (score > bestScore) { bestColumn = iColumn; bestScore = score; bestRound = round; } } } } return allTriviallyRoundableSoFar; } void CbcHeuristicDivePseudoCost::initializeData() { int numberIntegers = model_->numberIntegers(); if (!downArray_) { downArray_ = new double [numberIntegers]; upArray_ = new double [numberIntegers]; } // get pseudo costs model_->fillPseudoCosts(downArray_, upArray_); // allow for -999 -> force to run int diveOptions = (when_>0) ? when_ / 100 : 0; if (diveOptions) { // pseudo shadow prices int k = diveOptions % 100; if (diveOptions >= 100) k += 32; model_->pseudoShadow(k - 1); int numberInts = CoinMin(model_->numberObjects(), numberIntegers); OsiObject ** objects = model_->objects(); for (int i = 0; i < numberInts; i++) { CbcSimpleIntegerDynamicPseudoCost * obj1 = dynamic_cast (objects[i]) ; if (obj1) { //int iColumn = obj1->columnNumber(); double downPseudoCost = 1.0e-2 * obj1->downDynamicPseudoCost(); double downShadow = obj1->downShadowPrice(); double upPseudoCost = 1.0e-2 * obj1->upDynamicPseudoCost(); double upShadow = obj1->upShadowPrice(); downPseudoCost = CoinMax(downPseudoCost, downShadow); downPseudoCost = CoinMax(downPseudoCost, 0.001 * upShadow); downArray_[i] = downPseudoCost; upPseudoCost = CoinMax(upPseudoCost, upShadow); upPseudoCost = CoinMax(upPseudoCost, 0.001 * downShadow); upArray_[i] = upPseudoCost; } } } } // Fix other variables at bounds int CbcHeuristicDivePseudoCost::fixOtherVariables(OsiSolverInterface * solver, const double * solution, PseudoReducedCost * candidate, const double * random) { const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); const double* reducedCost = solver->getReducedCost(); bool fixGeneralIntegers = (switches_&65536)!=0; // fix other integer variables that are at their bounds int cnt = 0; int numberFree = 0; int numberFixedAlready = 0; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (upper[iColumn] > lower[iColumn]) { numberFree++; double value = solution[iColumn]; if (value - lower[iColumn] <= integerTolerance) { candidate[cnt].var = iColumn; candidate[cnt++].pseudoRedCost = CoinMax(1.0e-2 * reducedCost[iColumn], downArray_[i]) * random[i]; } else if (upper[iColumn] - value <= integerTolerance) { candidate[cnt].var = iColumn; candidate[cnt++].pseudoRedCost = CoinMax(-1.0e-2 * reducedCost[iColumn], downArray_[i]) * random[i]; } else if (fixGeneralIntegers && fabs(floor(value + 0.5) - value) <= integerTolerance) { candidate[cnt].var = iColumn; candidate[cnt++].pseudoRedCost = CoinMax(-1.0e-6 * reducedCost[iColumn], 1.0e-4*downArray_[i]) * random[i]; } } else { numberFixedAlready++; } } #ifdef CLP_INVESTIGATE printf("cutoff %g obj %g - %d free, %d fixed\n", model_->getCutoff(), solver->getObjValue(), numberFree, numberFixedAlready); #endif return cnt; //return CbcHeuristicDive::fixOtherVariables(solver, solution, // candidate, random); } CoinMP-1.8.3/Cbc/src/CbcBranchDecision.hpp0000644000175000017500000001060112131054770016564 0ustar renerene// $Id: CbcBranchDecision.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #ifndef CbcBranchDecision_H #define CbcBranchDecision_H #include "CbcBranchBase.hpp" /** Abstract branching decision base class In the abstract, an CbcBranchDecision object is expected to be able to compare two possible branching choices. The #betterBranch() method is the crucial routine. It is expected to be able to compare two \link CbcBranchingObject CbcBranchingObjects \endlink. See CbcObject for an overview of the three classes (CbcObject, CbcBranchingObject, and CbcBranchDecision) which make up cbc's branching model. */ class CbcModel; class OsiChooseVariable; class CbcBranchDecision { public: /// Default Constructor CbcBranchDecision (); // Copy constructor CbcBranchDecision ( const CbcBranchDecision &); /// Destructor virtual ~CbcBranchDecision(); /// Clone virtual CbcBranchDecision * clone() const = 0; /// Initialize e.g. before starting to choose a branch at a node virtual void initialize(CbcModel * model) = 0; /** \brief Compare two branching objects. Return nonzero if branching using \p thisOne is better than branching using \p bestSoFar. If \p bestSoFar is NULL, the routine should return a nonzero value. This routine is used only after strong branching. Either this or bestBranch is used depending which user wants. */ virtual int betterBranch (CbcBranchingObject * thisOne, CbcBranchingObject * bestSoFar, double changeUp, int numberInfeasibilitiesUp, double changeDown, int numberInfeasibilitiesDown) = 0 ; /** \brief Compare N branching objects. Return index of best and sets way of branching in chosen object. Either this or betterBranch is used depending which user wants. */ virtual int bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied, double * changeUp, int * numberInfeasibilitiesUp, double * changeDown, int * numberInfeasibilitiesDown, double objectiveValue) ; /** Says whether this method can handle both methods - 1 better, 2 best, 3 both */ virtual int whichMethod() { return 2; } /** Saves a clone of current branching object. Can be used to update information on object causing branch - after branch */ virtual void saveBranchingObject(OsiBranchingObject * ) {} /** Pass in information on branch just done. assumes object can get information from solver */ virtual void updateInformation(OsiSolverInterface * , const CbcNode * ) {} /** Sets or gets best criterion so far */ virtual void setBestCriterion(double ) {} virtual double getBestCriterion() const { return 0.0; } /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} /// Model inline CbcModel * cbcModel() const { return model_; } /* If chooseMethod_ id non-null then the rest is fairly pointless as choosemethod_ will be doing all work This comment makes more sense if you realise that there's a conversion in process from the Cbc branching classes to Osi branching classes. The test for use of the Osi branching classes is CbcModel::branchingMethod_ non-null (i.e., it points to one of these CbcBranchDecision objects) and that branch decision object has an OsiChooseVariable method set. In which case, we'll use it, rather than the choose[*]Variable methods defined in CbcNode. */ OsiChooseVariable * chooseMethod() const { return chooseMethod_; } /// Set (clone) chooseMethod void setChooseMethod(const OsiChooseVariable & method); protected: // Clone of branching object CbcBranchingObject * object_; /// Pointer to model CbcModel * model_; /* If chooseMethod_ id non-null then the rest is fairly pointless as choosemethod_ will be doing all work */ OsiChooseVariable * chooseMethod_; private: /// Assignment is illegal CbcBranchDecision & operator=(const CbcBranchDecision& rhs); }; #endif CoinMP-1.8.3/Cbc/src/CbcBranchLotsize.hpp0000644000175000017500000001742711510742604016475 0ustar renerene/* $Id: CbcBranchLotsize.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcBranchLotsize_H #define CbcBranchLotsize_H #include "CbcBranchBase.hpp" /** Lotsize class */ class CbcLotsize : public CbcObject { public: // Default Constructor CbcLotsize (); /* Useful constructor - passed model index. Also passed valid values - if range then pairs */ CbcLotsize (CbcModel * model, int iColumn, int numberPoints, const double * points, bool range = false); // Copy constructor CbcLotsize ( const CbcLotsize &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcLotsize & operator=( const CbcLotsize& rhs); // Destructor ~CbcLotsize (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /** Set bounds to contain the current solution. More precisely, for the variable associated with this object, take the value given in the current solution, force it within the current bounds if required, then set the bounds to fix the variable at the integer nearest the solution value. */ virtual void feasibleRegion(); /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /** \brief Given a valid solution (with reduced costs, etc.), return a branching object which would give a new feasible point in the good direction. The preferred branching object will force the variable to be +/-1 from its current value, depending on the reduced cost and objective sense. If movement in the direction which improves the objective is impossible due to bounds on the variable, the branching object will move in the other direction. If no movement is possible, the method returns NULL. Only the bounds on this variable are considered when determining if the new point is feasible. */ virtual CbcBranchingObject * preferredNewFeasible() const; /** \brief Given a valid solution (with reduced costs, etc.), return a branching object which would give a new feasible point in a bad direction. As for preferredNewFeasible(), but the preferred branching object will force movement in a direction that degrades the objective. */ virtual CbcBranchingObject * notPreferredNewFeasible() const ; /** Reset original upper and lower bound values from the solver. Handy for updating bounds held in this object after bounds held in the solver have been tightened. */ virtual void resetBounds(const OsiSolverInterface * solver); /** Finds range of interest so value is feasible in range range_ or infeasible between hi[range_] and lo[range_+1]. Returns true if feasible. */ bool findRange(double value) const; /** Returns floor and ceiling */ virtual void floorCeiling(double & floorLotsize, double & ceilingLotsize, double value, double tolerance) const; /// Model column number inline int modelSequence() const { return columnNumber_; } /// Set model column number inline void setModelSequence(int value) { columnNumber_ = value; } /** Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics */ virtual int columnNumber() const; /// Original variable bounds inline double originalLowerBound() const { return bound_[0]; } inline double originalUpperBound() const { return bound_[rangeType_*numberRanges_-1]; } /// Type - 1 points, 2 ranges inline int rangeType() const { return rangeType_; } /// Number of points inline int numberRanges() const { return numberRanges_; } /// Ranges inline double * bound() const { return bound_; } /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const { return false; } private: /// Just for debug (CBC_PRINT defined in CbcBranchLotsize.cpp) void printLotsize(double value, bool condition, int type) const; private: /// data /// Column number in model int columnNumber_; /// Type - 1 points, 2 ranges int rangeType_; /// Number of points int numberRanges_; // largest gap double largestGap_; /// Ranges double * bound_; /// Current range mutable int range_; }; /** Lotsize branching object This object can specify a two-way branch on an integer variable. For each arm of the branch, the upper and lower bounds on the variable can be independently specified. Variable_ holds the index of the integer variable in the integerVariable_ array of the model. */ class CbcLotsizeBranchingObject : public CbcBranchingObject { public: /// Default constructor CbcLotsizeBranchingObject (); /** Create a lotsize floor/ceiling branch object Specifies a simple two-way branch. Let \p value = x*. One arm of the branch will be is lb <= x <= valid range below(x*), the other valid range above(x*) <= x <= ub. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ CbcLotsizeBranchingObject (CbcModel *model, int variable, int way , double value, const CbcLotsize * lotsize) ; /** Create a degenerate branch object Specifies a `one-way branch'. Calling branch() for this object will always result in lowerValue <= x <= upperValue. Used to fix in valid range */ CbcLotsizeBranchingObject (CbcModel *model, int variable, int way, double lowerValue, double upperValue) ; /// Copy constructor CbcLotsizeBranchingObject ( const CbcLotsizeBranchingObject &); /// Assignment operator CbcLotsizeBranchingObject & operator= (const CbcLotsizeBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; /// Destructor virtual ~CbcLotsizeBranchingObject (); using CbcBranchingObject::branch ; /** \brief Sets the bounds for the variable according to the current arm of the branch and advances the object state to the next arm. */ virtual double branch(); using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return LotsizeBranchObj; } // LL: compareOriginalObject can be inherited from the CbcBranchingObject // since variable_ uniquely defines the lot sizing object. /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); protected: /// Lower [0] and upper [1] bounds for the down arm (way_ = -1) double down_[2]; /// Lower [0] and upper [1] bounds for the up arm (way_ = 1) double up_[2]; }; #endif CoinMP-1.8.3/Cbc/src/CbcCompareDefault.cpp0000644000175000017500000002670212131054770016610 0ustar renerene// $Id: CbcCompareDefault.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCompareActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CbcMessage.hpp" #include "CbcModel.hpp" #include "CbcTree.hpp" #include "CbcCompareActual.hpp" #include "CoinError.hpp" #include "CbcCompareDefault.hpp" /** Default Constructor */ CbcCompareDefault::CbcCompareDefault () : CbcCompareBase(), weight_(-1.0), saveWeight_(0.0), cutoff_(COIN_DBL_MAX), bestPossible_(-COIN_DBL_MAX), numberSolutions_(0), treeSize_(0), breadthDepth_(5), startNodeNumber_(-1), afterNodeNumber_(-1), setupForDiving_(false) { test_ = this; } // Constructor with weight CbcCompareDefault::CbcCompareDefault (double weight) : CbcCompareBase(), weight_(weight) , saveWeight_(0.0), cutoff_(COIN_DBL_MAX), bestPossible_(-COIN_DBL_MAX), numberSolutions_(0), treeSize_(0), breadthDepth_(5), startNodeNumber_(-1), afterNodeNumber_(-1), setupForDiving_(false) { test_ = this; } // Copy constructor CbcCompareDefault::CbcCompareDefault ( const CbcCompareDefault & rhs) : CbcCompareBase(rhs) { weight_ = rhs.weight_; saveWeight_ = rhs.saveWeight_; cutoff_ = rhs.cutoff_; bestPossible_ = rhs.bestPossible_; numberSolutions_ = rhs.numberSolutions_; treeSize_ = rhs.treeSize_; breadthDepth_ = rhs.breadthDepth_; startNodeNumber_ = rhs.startNodeNumber_; afterNodeNumber_ = rhs.afterNodeNumber_; setupForDiving_ = rhs.setupForDiving_ ; } // Clone CbcCompareBase * CbcCompareDefault::clone() const { return new CbcCompareDefault(*this); } // Assignment operator CbcCompareDefault & CbcCompareDefault::operator=( const CbcCompareDefault & rhs) { if (this != &rhs) { CbcCompareBase::operator=(rhs); weight_ = rhs.weight_; saveWeight_ = rhs.saveWeight_; cutoff_ = rhs.cutoff_; bestPossible_ = rhs.bestPossible_; numberSolutions_ = rhs.numberSolutions_; treeSize_ = rhs.treeSize_; breadthDepth_ = rhs.breadthDepth_; startNodeNumber_ = rhs.startNodeNumber_; afterNodeNumber_ = rhs.afterNodeNumber_; setupForDiving_ = rhs.setupForDiving_ ; } return *this; } // Destructor CbcCompareDefault::~CbcCompareDefault () { } // Returns true if y better than x bool CbcCompareDefault::test (CbcNode * x, CbcNode * y) { if (startNodeNumber_ >= 0) { // Diving int nX = x->nodeNumber(); int nY = y->nodeNumber(); if (nY == startNodeNumber_) return true; else if (nX == startNodeNumber_) return false; if (nX >= afterNodeNumber_ && nY < afterNodeNumber_) return false; else if (nY >= afterNodeNumber_ && nX < afterNodeNumber_) return true; // treat as depth first int depthX = x->depth(); int depthY = y->depth(); if (depthX != depthY) { return depthX < depthY; } else { double weight = CoinMax(weight_, 1.0e-9); double testX = x->objectiveValue() + weight * x->numberUnsatisfied(); double testY = y->objectiveValue() + weight * y->numberUnsatisfied(); if (testX != testY) return testX > testY; else return equalityTest(x, y); // so ties will be broken in consistent manner } } if (!weight_) { double testX = x->objectiveValue() + 1.0e-9 * x->numberUnsatisfied(); double testY = y->objectiveValue() + 1.0e-9 * y->numberUnsatisfied(); if (testX != testY) return testX > testY; else return equalityTest(x, y); // so ties will be broken in consistent manner } //weight_=0.0; if ((weight_ == -1.0 && (y->depth() > breadthDepth_ && x->depth() > breadthDepth_)) || weight_ == -3.0 || weight_ == -2.0) { int adjust = (weight_ == -3.0) ? 10000 : 0; // before solution /*printf("x %d %d %g, y %d %d %g\n", x->numberUnsatisfied(),x->depth(),x->objectiveValue(), y->numberUnsatisfied(),y->depth(),y->objectiveValue()); */ if (x->numberUnsatisfied() > y->numberUnsatisfied() + adjust) { return true; } else if (x->numberUnsatisfied() < y->numberUnsatisfied() - adjust) { return false; } else { int depthX = x->depth(); int depthY = y->depth(); if (depthX != depthY) return depthX < depthY; else return equalityTest(x, y); // so ties will be broken in consistent manner } } else { // always choose *greatest* depth if both <= breadthDepth_ otherwise <= breadthDepth_ if just one int depthX = x->depth(); int depthY = y->depth(); /*if ((depthX==4&&depthY==5)||(depthX==5&&depthY==4)) printf("X %x depth %d, Y %x depth %d, breadth %d\n", x,depthX,y,depthY,breadthDepth_);*/ if (depthX <= breadthDepth_ || depthY <= breadthDepth_) { if (depthX <= breadthDepth_ && depthY <= breadthDepth_) { if (depthX != depthY) { return depthX < depthY; } } else { assert (depthX != depthY) ; return depthX < depthY; } } // after solution ? #define THRESH2 0.999 #define TRY_THIS 0 #if TRY_THIS==0 double weight = CoinMax(weight_, 1.0e-9); double testX = x->objectiveValue() + weight * x->numberUnsatisfied(); double testY = y->objectiveValue() + weight * y->numberUnsatisfied(); #elif TRY_THIS==1 /* compute what weight would have to be to hit target then reverse sign as large weight good */ double target = (1.0 - THRESH2) * bestPossible_ + THRESH2 * cutoff_; double weight; weight = (target - x->objectiveValue()) / static_cast(x->numberUnsatisfied()); double testX = - weight; weight = (target - y->objectiveValue()) / static_cast(y->numberUnsatisfied()); double testY = - weight; #elif TRY_THIS==2 // Use estimates double testX = x->guessedObjectiveValue(); double testY = y->guessedObjectiveValue(); #elif TRY_THIS==3 #define THRESH 0.95 // Use estimates double testX = x->guessedObjectiveValue(); double testY = y->guessedObjectiveValue(); if (x->objectiveValue() - bestPossible_ > THRESH*(cutoff_ - bestPossible_)) testX *= 2.0; // make worse if (y->objectiveValue() - bestPossible_ > THRESH*(cutoff_ - bestPossible_)) testY *= 2.0; // make worse #endif if (testX != testY) return testX > testY; else return equalityTest(x, y); // so ties will be broken in consistent manner } } /* Change the weight attached to unsatisfied integer variables, unless it's fairly early on in the search and all solutions to date are heuristic. */ bool CbcCompareDefault::newSolution(CbcModel * model, double objectiveAtContinuous, int numberInfeasibilitiesAtContinuous) { cutoff_ = model->getCutoff(); if (model->getSolutionCount() == model->getNumberHeuristicSolutions() && model->getSolutionCount() < 5 && model->getNodeCount() < 500) return (false) ; // solution was got by rounding // set to get close to this solution double costPerInteger = (model->getObjValue() - objectiveAtContinuous) / static_cast (numberInfeasibilitiesAtContinuous); weight_ = 0.95 * costPerInteger; saveWeight_ = 0.95 * weight_; numberSolutions_++; //if (numberSolutions_>5) //weight_ =0.0; // this searches on objective return (true) ; } // This allows method to change behavior bool CbcCompareDefault::every1000Nodes(CbcModel * model, int numberNodes) { #ifdef JJF_ZERO // was if (numberNodes > 10000) weight_ = 0.0; // this searches on objective // get size of tree treeSize_ = model->tree()->size(); #else double saveWeight = weight_; int numberNodes1000 = numberNodes / 1000; if (numberNodes > 10000) { weight_ = 0.0; // this searches on objective // but try a bit of other stuff if ((numberNodes1000 % 4) == 1) weight_ = saveWeight_; } else if (numberNodes == 1000 && weight_ == -2.0) { weight_ = -1.0; // Go to depth first } // get size of tree treeSize_ = model->tree()->size(); if (treeSize_ > 10000) { int n1 = model->solver()->getNumRows() + model->solver()->getNumCols(); int n2 = model->numberObjects(); double size = n1 * 0.1 + n2 * 2.0; // set weight to reduce size most of time if (treeSize_*(size + 100.0) > 5.0e7) weight_ = -3.0; else if ((numberNodes1000 % 4) == 0 && treeSize_*size > 1.0e6) weight_ = -1.0; else if ((numberNodes1000 % 4) == 1) weight_ = 0.0; else weight_ = saveWeight_; } #endif //return numberNodes==11000; // resort if first time return (weight_ != saveWeight); } // Start dive void CbcCompareDefault::startDive(CbcModel * model) { // Get best - using ? criterion double saveWeight = weight_; weight_ = 0.5 * saveWeight_; //0.0; // Switch off to get best startNodeNumber_ = -1; afterNodeNumber_ = -1; CbcNode * best = model->tree()->bestAlternate(); startNodeNumber_ = best->nodeNumber(); // send signal to setComparison setupForDiving_ = true ; /* TODO (review when fixing cleanDive and setComparison) Both afterNodeNumber_ and weight_ must not change after setComparison is invoked, as that will change the behaviour of test(). I replaced the overload on afterNodeNumber_ (magic number -2) with a boolean. Weight_ is more problematic. Either it's correct before calling setComparison, or it needs to be cut from the tie-breaking part of test() during a dive, or there needs to be a new attribute to save and restore it around the dive. Otherwise heap checks fail in debug builds with Visual Studio. Given that weight_ was restored immediately after the call to setComparison, there should be no change in behaviour in terms of calls to test(). -- lh, 100921 -- */ afterNodeNumber_ = model->tree()->maximumNodeNumber(); weight_ = saveWeight ; // redo tree model->tree()->setComparison(*this); setupForDiving_ = false ; } // Clean up dive void CbcCompareDefault::cleanDive() { if (setupForDiving_ == false) { // switch off startNodeNumber_ = -1; afterNodeNumber_ = -1; } } // Create C++ lines to get to current state void CbcCompareDefault::generateCpp( FILE * fp) { CbcCompareDefault other; fprintf(fp, "0#include \"CbcCompareActual.hpp\"\n"); fprintf(fp, "3 CbcCompareDefault compare;\n"); if (weight_ != other.weight_) fprintf(fp, "3 compare.setWeight(%g);\n", weight_); fprintf(fp, "3 cbcModel->setNodeComparison(compare);\n"); } CoinMP-1.8.3/Cbc/src/CbcHeuristicRINS.hpp0000644000175000017500000000542112203713255016350 0ustar renerene/* $Id: CbcHeuristicRINS.hpp 1956 2013-08-17 15:28:45Z forrest $ */ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicRINS_H #define CbcHeuristicRINS_H #include "CbcHeuristic.hpp" // for backward compatibility include 3 other headers #include "CbcHeuristicRENS.hpp" #include "CbcHeuristicDINS.hpp" #include "CbcHeuristicVND.hpp" /** LocalSearch class */ class CbcHeuristicRINS : public CbcHeuristic { public: // Default Constructor CbcHeuristicRINS (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicRINS (CbcModel & model); // Copy constructor CbcHeuristicRINS ( const CbcHeuristicRINS &); // Destructor ~CbcHeuristicRINS (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicRINS & operator=(const CbcHeuristicRINS& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) This does Relaxation Induced Neighborhood Search */ virtual int solution(double & objectiveValue, double * newSolution); /// This version fixes stuff and does IP int solutionFix(double & objectiveValue, double * newSolution, const int * keep); /// Sets how often to do it inline void setHowOften(int value) { howOften_ = value; } /// Used array so we can set inline char * used() const { return used_; } /// Resets lastNode inline void setLastNode(int value) { lastNode_ = value; } /// Resets number of solutions inline void setSolutionCount(int value) { numberSolutions_ = value; } protected: // Data /// Number of solutions so we can do something at solution int numberSolutions_; /// How often to do (code can change) int howOften_; /// Number of successes int numberSuccesses_; /// Number of tries int numberTries_; /** State of fixing continuous variables - 0 - not tried +n - this divisor makes small enough -n - this divisor still not small enough */ int stateOfFixing_; /// Node when last done int lastNode_; /// Whether a variable has been in a solution char * used_; }; #endif CoinMP-1.8.3/Cbc/src/CbcGenCtlBlk.hpp0000644000175000017500000007015712131054770015532 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenCtlBlk.hpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #ifndef CbcGenCtlBlk_H #define CbcGenCtlBlk_H /* \file CbcGenCtlBlk.hpp \brief Declarations for parameters of the cbc-generic main program. */ #include "CoinParam.hpp" #include "CoinMessageHandler.hpp" #include "CglCutGenerator.hpp" #include "CglProbing.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglGomory.hpp" #include "CglKnapsackCover.hpp" #include "CglMixedIntegerRounding2.hpp" #include "CglOddHole.hpp" #include "CglRedSplit.hpp" #include "CglTwomir.hpp" #include "CbcModel.hpp" #include "CbcHeuristic.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcHeuristicGreedy.hpp" #include "CbcHeuristicLocal.hpp" #include "CbcTreeLocal.hpp" #include "CbcGenMessages.hpp" /* It turns out that doxygen is not good with anonymous structures. Hence the `struct nameCtl_struct' style used for structured fields in CbcGenCtlBlk. */ /* $Id: CbcGenCtlBlk.hpp 1899 2013-04-09 18:12:08Z stefan $ */ #define CBC_GENERIC_VERSION "00.01.00" class CbcGenCtlBlk ; namespace CbcGenParamUtils { void addCbcGenParams(int &numParams, CoinParamVec ¶mVec, CbcGenCtlBlk *ctlBlk) ; } /* \brief cbc-generic algorithm control class This class defines values and methods used to control the operation of the cbc-generic main program. */ class CbcGenCtlBlk { friend void CbcGenParamUtils::addCbcGenParams(int &numParams, CoinParamVec ¶mVec, CbcGenCtlBlk *ctlBlk) ; public: /*! \name Enumeration types used for cbc-generic control variables */ //@{ /* In order for initialisation to work properly, the order of declaration of the enum constants here must match the order of keyword declaration for the PREPROCESS parameter in CbcGenParamUtils::addCbcGenParams */ /*! \brief Codes to control integer preprocessing - IPPOff: Integer preprocessing is off. - IPPOn: Integer preprocessing is on. - IPPSave: IPPOn, plus preprocessed system will be saved to presolved.mps. - IPPEqual: IPPOn, plus `<=' cliques are converted to `=' cliques. - IPPSOS: IPPOn, plus will create SOS sets (see below). - IPPTrySOS: IPPOn, plus will create SOS sets (see below). - IPPEqualAll: IPPOn, plus turns all valid inequalities into equalities with integer slacks. - IPPStrategy: look to CbcStrategy object for instructions. IPPSOS will create SOS sets if all binary variables (except perhaps one) can be covered by SOS sets with no overlap between sets. IPPTrySOS will allow any number of binary variables to be uncovered. */ typedef enum { IPPOff = 0, IPPOn, IPPSave, IPPEqual, IPPSOS, IPPTrySOS, IPPEqualAll, IPPStrategy } IPPControl ; /* In order for initialisation to work properly, the order of declaration of the enum constants here must match the order of keyword declaration for the various cut and heuristic control parameters in CbcGenParamUtils::addCbcGenParams */ /*! \brief Codes to control the use of cut generators and heuristics - CGOff: the cut generator will not be installed - CGOn: the cut generator will be installed; exactly how often it's activated depends on the settings at installation - CGRoot: the cut generator will be installed with settings that restrict it to activation at the root node only. - CGIfMove: the cut generator will be installed with settings that allow it to remain active only so long as it's generating cuts that tighten the relaxation. - CGForceOn: the cut generator will be installed with settings that force it to be called at every node - CGForceBut: the cut generator will be installed with settings that force it to be called at every node, but more active at root (probing only) - CGMarker: a convenience to mark the end of the codes. The same codes are used for heuristics. */ typedef enum { CGOff, CGOn, CGRoot, CGIfMove, CGForceOn, CGForceBut, CGMarker } CGControl ; /*! \brief Codes to specify the assignment of branching priorities - BPOff: no priorities are passed to cbc - BPCost: a priority vector is constructed based on objective coefficients - BPOrder: a priority vector is constructed based on column order - BPExt: the user has provided a priority vector */ typedef enum { BPOff, BPCost, BPOrder, BPExt } BPControl ; /*! \brief Major status codes for branch-and-cut - BACInvalid: status not yet set - BACNotRun: branch-and-cut has not yet run for the current problem - BACFinish: branch-and-cut has finished normally - BACStop: branch-and-cut has stopped on a limit - BACAbandon: branch-and-cut abandoned the problem - BACUser: branch-and-cut stopped on user signal Consult minorStatus_ for details. These codes are (mostly) set to match the codes used by CbcModel. Additions to CbcModel codes should be reflected here and in translateMajor. */ typedef enum { BACInvalid = -1, BACFinish = 0, BACStop = 1, BACAbandon = 2, BACNotRun, BACUser = 5 } BACMajor ; /*! \brief Minor status codes - BACmInvalid status not yet set - BACmFinish search exhausted the tree; optimal solution found - BACmInfeas problem is infeasible - BACmUbnd problem is unbounded - BACmGap stopped on integrality gap - BACmNodeLimit stopped on node limit - BACmTimeLimit stopped on time limit - BACmSolnLimit stopped on number of solutions limit - BACmUser stopped due to user event - BACmOther nothing else is appropriate It's not possible to make these codes agree with CbcModel. The meaning varies according to context: if the BACWhere code specifies a relaxation, then the minor status reflects the underlying OSI solver. Otherwise, it reflects the integer problem. */ typedef enum { BACmInvalid = -1, BACmFinish = 0, BACmInfeas, BACmUbnd, BACmGap, BACmNodeLimit, BACmTimeLimit, BACmSolnLimit, BACmUser, BACmOther } BACMinor ; /*! \brief Codes to specify where branch-and-cut stopped - BACwNotStarted stopped before we ever got going - BACwBareRoot stopped after initial solve of root relaxation - BACwIPP stopped after integer preprocessing - BACwIPPRelax stopped after initial solve of preprocessed problem - BACwBAC stopped at some point in branch-and-cut */ typedef enum { BACwInvalid = -1, BACwNotStarted = 0, BACwBareRoot, BACwIPP, BACwIPPRelax, BACwBAC } BACWhere ; //@} /*! \name Constructors and destructors */ //@{ /*! \brief Default constructor */ CbcGenCtlBlk() ; /*! \brief Destructor */ ~CbcGenCtlBlk() ; //@} /*! \name Access and Control Functions for Cut Generators and Heuristics \brief Control functions, plus lazy creation functions for cut generators and heuristics cbc-generic avoids creating objects for cut generators and heuristics unless they're actually used. For cut generators, a prototype is created and reused. For heuristics, the default is to create a new object with each call, because the model may have changed. The object is returned through the reference parameter. The return value of the function is the current action state. Cut generator and heuristic objects created by these calls will be deleted with the destruction of the CbcGenCtlBlk object. */ //@{ /*! \brief Get cut depth setting The name is a bit of a misnomer. Essentially, this overrides the `every so many nodes' control with `execute when (depth in tree) mod (cut depth) == 0'. */ inline int getCutDepth() { return cutDepth_ ; } /*! \brief Set cut depth setting. See comments for getCutDepth(). */ inline void setCutDepth(int cutDepth) { cutDepth_ = cutDepth ; } /*1 \brief Get action state for use of integer preprocessing */ inline IPPControl getIPPAction() { return (preProcess_) ; } /*! \brief Set action state for use of integer preprocessing */ inline void setIPPAction(IPPControl action) { preProcess_ = action ; } /*! \brief Obtain a prototype for a probing cut generator. */ CGControl getProbing(CglCutGenerator *&gen) ; /*! \brief Set action state for use of probing cut generator. */ inline void setProbingAction(CGControl action) { probing_.action_ = action ; } /*! \brief Obtain a prototype for a clique cut generator. */ CGControl getClique(CglCutGenerator *&gen) ; /*! \brief Set action state for use of clique cut generator. */ inline void setCliqueAction(CGControl action) { clique_.action_ = action ; } /*! \brief Obtain a prototype for a flow cover cut generator. */ CGControl getFlow(CglCutGenerator *&gen) ; /*! \brief Set action state for use of flow cover cut generator. */ inline void setFlowAction(CGControl action) { flow_.action_ = action ; } /*! \brief Obtain a prototype for a Gomory cut generator. */ CGControl getGomory(CglCutGenerator *&gen) ; /*! \brief Set action state for use of Gomory cut generator. */ inline void setGomoryAction(CGControl action) { gomory_.action_ = action ; } /*! \brief Obtain a prototype for a knapsack cover cut generator. */ CGControl getKnapsack(CglCutGenerator *&gen) ; /*! \brief Set action state for use of knapsack cut generator. */ inline void setKnapsackAction(CGControl action) { knapsack_.action_ = action ; } /* \brief Obtain a prototype for a lift-and-project cut generator. CGControl getLandP(CglCutGenerator *&gen) ; \brief Set action state for use of lift-and-project cut generator. inline void setLandPAction(CGControl action) { landp_.action_ = action ; } */ /*! \brief Obtain a prototype for a mixed integer rounding (MIR) cut generator. */ CGControl getMir(CglCutGenerator *&gen) ; /*! \brief Set action state for use of MIR cut generator. */ inline void setMirAction(CGControl action) { mir_.action_ = action ; } /*! \brief Obtain a prototype for a reduce and split cut generator. */ CGControl getRedSplit(CglCutGenerator *&gen) ; /*! \brief Set action state for use of reduce and split cut generator. */ inline void setRedSplitAction(CGControl action) { redSplit_.action_ = action ; } /*! \brief Obtain a prototype for a 2-MIR cut generator. */ CGControl getTwomir(CglCutGenerator *&gen) ; /*! \brief Set action state for use of 2-MIR cut generator. */ inline void setTwomirAction(CGControl action) { twomir_.action_ = action ; } /*! \brief Obtain a feasibility pump heuristic. By default, any existing object is deleted and a new object is created and loaded with \c model. Set alwaysCreate = false to return an existing object if one exists. */ CGControl getFPump(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate = true) ; /*! \brief Set action state for use of feasibility pump heuristic. */ inline void setFPumpAction(CGControl action) { fpump_.action_ = action ; } /*! \brief Obtain a local search/combine heuristic. By default, any existing object is deleted and a new object is created and loaded with \c model. Set alwaysCreate = false to return an existing object if one exists. */ CGControl getCombine(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate = true) ; /*! \brief Set action state for use of local search/combine heuristic. */ inline void setCombineAction(CGControl action) { combine_.action_ = action ; } /*! \brief Obtain a greedy cover heuristic. By default, any existing object is deleted and a new object is created and loaded with \c model. Set alwaysCreate = false to return an existing object if one exists. */ CGControl getGreedyCover(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate = true) ; /*! \brief Set action state for use of greedy cover heuristic. */ inline void setGreedyCoverAction(CGControl action) { greedyCover_.action_ = action ; } /*! \brief Obtain a greedy equality heuristic. By default, any existing object is deleted and a new object is created and loaded with \c model. Set alwaysCreate = false to return an existing object if one exists. */ CGControl getGreedyEquality(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate = true) ; /*! \brief Set action state for use of greedy equality heuristic. */ inline void setGreedyEqualityAction(CGControl action) { greedyEquality_.action_ = action ; } /*! \brief Obtain a simple rounding heuristic. By default, any existing object is deleted and a new object is created and loaded with \c model. Set alwaysCreate = false to return an existing object if one exists. */ CGControl getRounding(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate = true) ; /*! \brief Set action state for use of simple rounding heuristic. */ inline void setRoundingAction(CGControl action) { rounding_.action_ = action ; } /*! \brief Obtain a local search tree object By default, any existing object is deleted and a new object is created and loaded with \c model. Set alwaysCreate = false to return an existing object if one exists. */ CGControl getTreeLocal(CbcTreeLocal *&localTree, CbcModel *model, bool alwaysCreate = true) ; /*! \brief Set action state for use of local tree. */ inline void setTreeLocalAction(CGControl action) { localTree_.action_ = action ; } //@} /*! \name Status Functions \brief Convenience routines for status codes. */ //@{ /*! \brief Set the result of branch-and-cut search */ inline void setBaBStatus(BACMajor majorStatus, BACMinor minorStatus, BACWhere where, bool haveAnswer, OsiSolverInterface *answerSolver) { bab_.majorStatus_ = majorStatus ; bab_.minorStatus_ = minorStatus ; bab_.where_ = where ; bab_.haveAnswer_ = haveAnswer ; bab_.answerSolver_ = answerSolver ; } /*! \brief Set the result of branch-and-cut search This version will extract the necessary information from the CbcModel object and set appropriate status based on the value passed for where. */ void setBaBStatus(const CbcModel *model, BACWhere where, bool haveAnswer = false, OsiSolverInterface *answerSolver = 0) ; /*! \brief Translate CbcModel major status to #BACMajor See the #BACMajor enum for details. */ BACMajor translateMajor(int status) ; /*!\brief Translate CbcModel minor status to #BACMinor See the #BACMinor enum for details. */ BACMinor translateMinor(int status) ; /*!\brief Translate OsiSolverInterface status to #BACMinor See the #BACMinor enum for details. Optimal, infeasible, and unbounded get their own codes; everything else maps to BACmOther. */ BACMinor translateMinor(const OsiSolverInterface *osi) ; /*! \brief Print the status block */ void printBaBStatus() ; //@} /*! \name Messages and statistics */ //@{ /*! \brief Print a message Uses the current message handler and messages. */ CoinMessageHandler &message(CbcGenMsgCode inID) ; /*! \brief Supply a new message handler. Replaces the current message handler. The current handler is destroyed if ourMsgHandler_ is true, and the call will set ourMsgHandler_ = true. */ void passInMessageHandler(CoinMessageHandler *handler) ; /*! \brief Return a pointer to the message handler */ inline CoinMessageHandler *messageHandler() const { return msgHandler_ ; } /*! \brief Set up messages in the specified language. Building a set of messages in a given language implies rebuilding the whole set of messages, for reasons explained in the body of the code. Hence there's no separate setLanguage routine. Use this routine for the initial setup of messages and any subsequent change in language. Note that the constructor gives you a message handler by default, but \e not messages. You need to call setMessages explicitly. The default value specified here for lang effectively sets the default language. */ void setMessages(CoinMessages::Language lang = CoinMessages::us_en) ; /*! \brief Set log level */ inline void setLogLevel(int lvl) { logLvl_ = lvl ; if (msgHandler_) msgHandler_->setLogLevel(lvl) ; } /*! \brief Get log level */ inline int logLevel() const { return (logLvl_) ; } /*! \brief When greater than 0, integer presolve gives more information and branch-and-cut provides statistics. */ int printOpt_ ; //@} /*! \name Parameter parsing and input/output. */ //@{ /*! \brief cbc-generic version */ std::string version_ ; /*! \brief Default directory prefix */ std::string dfltDirectory_ ; /*! \brief Last MPS input file */ std::string lastMpsIn_ ; /*! \brief Allow/disallow errors when importing a model */ bool allowImportErrors_ ; /*! \brief Last solution output file */ std::string lastSolnOut_ ; /*! \brief Solution printing mode Controls the amount of information printed when printing a solution. Coding is set by the keyword declarations for the printingOptions command. */ int printMode_ ; /*! \brief Print mask Used to specify row/column names to be printed. Not implemented as of 060920. */ std::string printMask_ ; /*! \brief The parameter vector */ CoinParamVec *paramVec_ ; /*! \brief Start and end of cbc-generic parameters in parameter vector */ struct genParamsInfo_struct { int first_ ; int last_ ; } genParams_ ; /*! \brief Start and end of CbcModel parameters in parameter vector */ struct cbcParamsInfo_struct { int first_ ; int last_ ; } cbcParams_ ; /*! \brief Start and end of OsiSolverInterface parameters in parameter vector */ struct osiParamsInfo_struct { int first_ ; int last_ ; } osiParams_ ; /*! \brief Verbosity level for help messages. Interpretation is bitwise: - (0): short help - (1): long help - (2): unused (for compatibility with cbc; indicates AMPL) - (3): show parameters with display = false. */ int verbose_ ; /*! \brief Number of parameters processed */ int paramsProcessed_ ; /*! \brief Record of parameters changed by user command */ std::vector setByUser_ ; /*! \brief False if the user has made nontrivial modifications to the default control settings. Initially true. Specifying DJFIX, TIGHTENFACTOR, or any cut or heuristic parameter will set this to false. */ bool defaultSettings_ ; /*! \brief Control debug file creation At the conclusion of branch-and-cut, dump the full solution in a binary format to debug.file in the current directory. When set to "createAfterPre", the solution is dumped before integer presolve transforms are removed. When set to "create", the solution is dumped after integer presolve transforms are backed out. */ std::string debugCreate_ ; /*! \brief Last debug input file The file is expected to be in a binary format understood by activateRowCutDebugger. */ std::string debugFile_ ; /*! \brief Array of primal variable values for debugging Used to provide a known optimal solution to activateRowCutDebugger(). */ struct debugSolInfo_struct { int numCols_ ; double *values_ ; } debugSol_ ; //@} /* \name Timing */ //@{ /*! \brief Total elapsed time for this run. */ double totalTime_ ; //@} /*! \name Models of various flavours */ //@{ /*! \brief The reference CbcModel object. This is the CbcModel created when cbc-generic boots up. It holds the default solver with the current constraint system. CbcCbcParam parameters are applied here, and CbcOsiParam parameters are applied to the solver. Major modifications for branch-and-cut (integer preprocessing, installation of heuristics and cut generators) are performed on a clone. The solution is transferred back into this object. */ CbcModel *model_ ; /*! \brief The current default LP solver This is a pointer to a reference copy. If you want the solver associated with #model_, ask for it directly. */ OsiSolverInterface *dfltSolver_ ; /*! \brief True if we have a valid model loaded, false otherwise. */ bool goodModel_ ; /*! \brief State of branch-and-cut Major and minor status codes, and a solver holding the answer, assuming we have a valid answer. See the documentation with the BACMajor, BACMinor, and BACWhere enums for the meaning of the codes. */ struct babState_struct { BACMajor majorStatus_ ; BACMinor minorStatus_ ; BACWhere where_ ; bool haveAnswer_ ; OsiSolverInterface *answerSolver_ ; } bab_ ; //@} /*! \name Various algorithm control variables and settings */ //@{ /*! \brief Control use of reduced cost fixing prior to B&C This heuristic fixes variables whose reduced cost for the root relaxtion exceeds the specified threshold. This is purely a heuristic, performed before there's any incumbent solution. It may well fix variables at the wrong bound! */ struct djFixCtl_struct { bool action_ ; double threshold_ ; } djFix_ ; /*! \brief Control the assignment of branching priorities to integer variables. */ BPControl priorityAction_ ; //@} /*! \name Branching Method Control \brief Usage control and prototypes for branching methods. Looking to the future, this covers only OsiChoose methods. */ //@{ /*! \brief Control variables for a strong branching method. Consult OsiChooseVariable and CbcModel for details. An artifact of the changeover from CbcObjects to OsiObjects is that the number of uses before pseudo costs are trusted (numBeforeTrust_) and the number of variables evaluated with strong branching (numStrong_) are parameters of CbcModel. */ struct chooseStrongCtl_struct { int numBeforeTrust_ ; int numStrong_ ; int shadowPriceMode_ ; } chooseStrong_ ; //@} private: /*! \name Cut Generator and Heuristic Control \brief Usage control and prototypes for cut generators and heuristics. */ //@{ /*! \brief Control integer preprocessing. */ IPPControl preProcess_ ; /*! \brief Control cut generator activity Generators that are active in the tree will be activated when (depth) mod (cutDepth) == 0. */ int cutDepth_ ; /*! \brief Control variable and prototype for probing cut generator */ struct probingCtl_struct { CGControl action_ ; CglProbing *proto_ ; bool usingObjective_ ; int maxPass_ ; int maxPassRoot_ ; int maxProbe_ ; int maxProbeRoot_ ; int maxLook_ ; int maxLookRoot_ ; int maxElements_ ; int rowCuts_ ; } probing_ ; /*! \brief Control variable and prototype for clique cut generator */ struct cliqueCtl_struct { CGControl action_ ; CglClique *proto_ ; bool starCliqueReport_ ; bool rowCliqueReport_ ; double minViolation_ ; } clique_ ; /*! \brief Control variable and prototype for flow cover cut generator */ struct flowCtl_struct { CGControl action_ ; CglFlowCover *proto_ ; } flow_ ; /*! \brief Control variable and prototype for Gomory cut generator */ struct gomoryCtl_struct { CGControl action_ ; CglGomory *proto_ ; int limit_ ; int limitAtRoot_ ; } gomory_ ; /* \brief Control variable and prototype for lift-and-project cut generator struct landpCtl_struct { CGControl action_ ; CglLandP *proto_ ; } landp_ ; */ /*! \brief Control variable and prototype for knapsack cover cut generator */ struct knapsackCtl_struct { CGControl action_ ; CglKnapsackCover *proto_ ; } knapsack_ ; /*! \brief Control variable and prototype for MIR cut generator */ struct mirCtl_struct { CGControl action_ ; CglMixedIntegerRounding2 *proto_ ; } mir_ ; /*! \brief Control variable and prototype for odd hole cut generator */ struct oddHoleCtl_struct { CGControl action_ ; CglOddHole *proto_ ; } oddHole_ ; /*! \brief Control variable and prototype for reduce-and-split cut generator */ struct redSplitCtl_struct { CGControl action_ ; CglRedSplit *proto_ ; } redSplit_ ; /*! \brief Control variable and prototype for Two-MIR cut generator */ struct twomirCtl_struct { CGControl action_ ; CglTwomir *proto_ ; int maxElements_ ; } twomir_ ; /*! \brief Control variable and prototype for feasibility pump heuristic */ struct fpumpCtl_struct { CGControl action_ ; CbcHeuristicFPump *proto_ ; int iters_ ; } fpump_ ; /*! \brief Control variable and prototype for combine heuristic */ struct combineCtl_struct { CGControl action_ ; CbcHeuristicLocal *proto_ ; int trySwap_ ; } combine_ ; /*! \brief Control variable and prototype for greedy cover heuristic */ struct greedyCoverCtl_struct { CGControl action_ ; CbcHeuristicGreedyCover *proto_ ; } greedyCover_ ; /*! \brief Control variable and prototype for greedy equality heuristic */ struct greedyEqualityCtl_struct { CGControl action_ ; CbcHeuristicGreedyEquality *proto_ ; } greedyEquality_ ; /*! \brief Control variable and prototype for simple rounding heuristic */ struct roundingCtl_struct { CGControl action_ ; CbcRounding *proto_ ; } rounding_ ; /*! \brief Control variables for local tree This is a bit different --- getTreeLocal() takes a CbcModel as a parameter and installs a local tree object. But we can keep the parameters here and hide the details. Consult CbcTreeLocal.hpp for details. */ struct localTreeCtl_struct { CGControl action_ ; CbcTreeLocal *proto_ ; double *soln_ ; int range_ ; int typeCuts_ ; int maxDiverge_ ; int timeLimit_ ; int nodeLimit_ ; bool refine_ ; } localTree_ ; //@} /*! \name Messages and statistics (private) \brief Data and objects related to messages and statistics that should be protected from direct manipulation. */ //@{ /*! \brief Message handler. */ CoinMessageHandler *msgHandler_ ; /*! \brief Ownership of message handler. If true, the control block owns the message handler and it will be destroyed with the control block. If false, the client is responsible for the message handler. */ bool ourMsgHandler_ ; /*! \brief The current language */ CoinMessages::Language cur_lang_ ; /*! \brief The current set of messages. */ CoinMessages *msgs_ ; /*! \brief The current log level */ int logLvl_ ; //@} } ; #endif CoinMP-1.8.3/Cbc/src/CbcClique.hpp0000644000175000017500000002424012131054770015137 0ustar renerene// $Id: CbcClique.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/9/2009-- carved out of CbcBranchActual #ifndef CbcClique_H #define CbcClique_H /** \brief Branching object for cliques A clique is defined to be a set of binary variables where fixing any one variable to its `strong' value fixes all other variables. An example is the most common SOS1 construction: a set of binary variables x_j s.t. SUM{j} x_j = 1. Setting any one variable to 1 forces all other variables to 0. (See comments for CbcSOS below.) Other configurations are possible, however: Consider x1-x2+x3 <= 0. Setting x1 (x3) to 1 forces x2 to 1 and x3 (x1) to 0. Setting x2 to 0 forces x1 and x3 to 0. The proper point of view to take when interpreting CbcClique is `generalisation of SOS1 on binary variables.' To get into the proper frame of mind, here's an example. Consider the following sequence, where x_j = (1-y_j): \verbatim x1 + x2 + x3 <= 1 all strong at 1 x1 - y2 + x3 <= 0 y2 strong at 0; x1, x3 strong at 1 -y1 - y2 + x3 <= -1 y1, y2 strong at 0, x3 strong at 1 -y1 - y2 - y3 <= -2 all strong at 0 \endverbatim The first line is a standard SOS1 on binary variables. Variables with +1 coefficients are `SOS-style' and variables with -1 coefficients are `non-SOS-style'. So #numberNonSOSMembers_ simply tells you how many variables have -1 coefficients. The implicit rhs for a clique is 1-numberNonSOSMembers_. */ class CbcClique : public CbcObject { public: /// Default Constructor CbcClique (); /** Useful constructor (which are integer indices) slack can denote a slack in set. If type == NULL then as if 1 */ CbcClique (CbcModel * model, int cliqueType, int numberMembers, const int * which, const char * type, int identifier, int slack = -1); /// Copy constructor CbcClique ( const CbcClique &); /// Clone virtual CbcObject * clone() const; /// Assignment operator CbcClique & operator=( const CbcClique& rhs); /// Destructor virtual ~CbcClique (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /// This looks at solution and sets bounds to contain solution virtual void feasibleRegion(); /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Number of members inline int numberMembers() const { return numberMembers_; } /** \brief Number of variables with -1 coefficient Number of non-SOS members, i.e., fixing to zero is strong. See comments at head of class, and comments for #type_. */ inline int numberNonSOSMembers() const { return numberNonSOSMembers_; } /// Members (indices in range 0 ... numberIntegers_-1) inline const int * members() const { return members_; } /*! \brief Type of each member, i.e., which way is strong. This also specifies whether a variable has a +1 or -1 coefficient. - 0 => -1 coefficient, 0 is strong value - 1 => +1 coefficient, 1 is strong value If unspecified, all coefficients are assumed to be positive. Indexed as 0 .. numberMembers_-1 */ inline char type(int index) const { if (type_) return type_[index]; else return 1; } /// Clique type: 0 is <=, 1 is == inline int cliqueType() const { return cliqueType_; } /// Redoes data when sequence numbers change virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns); protected: /// data /// Number of members int numberMembers_; /// Number of Non SOS members i.e. fixing to zero is strong int numberNonSOSMembers_; /// Members (indices in range 0 ... numberIntegers_-1) int * members_; /** \brief Strong value for each member. This also specifies whether a variable has a +1 or -1 coefficient. - 0 => -1 coefficient, 0 is strong value - 1 => +1 coefficient, 1 is strong value If unspecified, all coefficients are assumed to be positive. Indexed as 0 .. numberMembers_-1 */ char * type_; /** \brief Clique type 0 defines a <= relation, 1 an equality. The assumed value of the rhs is numberNonSOSMembers_+1. (See comments for the class.) */ int cliqueType_; /** \brief Slack variable for the clique Identifies the slack variable for the clique (typically added to convert a <= relation to an equality). Value is sequence number within clique menbers. */ int slack_; }; /** Branching object for unordered cliques Intended for cliques which are long enough to make it worthwhile but <= 64 members. There will also be ones for long cliques. Variable_ is the clique id number (redundant, as the object also holds a pointer to the clique. */ class CbcCliqueBranchingObject : public CbcBranchingObject { public: // Default Constructor CbcCliqueBranchingObject (); // Useful constructor CbcCliqueBranchingObject (CbcModel * model, const CbcClique * clique, int way, int numberOnDownSide, const int * down, int numberOnUpSide, const int * up); // Copy constructor CbcCliqueBranchingObject ( const CbcCliqueBranchingObject &); // Assignment operator CbcCliqueBranchingObject & operator=( const CbcCliqueBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; // Destructor virtual ~CbcCliqueBranchingObject (); using CbcBranchingObject::branch ; /// Does next branch and updates state virtual double branch(); using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return CliqueBranchObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be of the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); private: /// data const CbcClique * clique_; /// downMask - bit set to fix to weak bounds, not set to leave unfixed unsigned int downMask_[2]; /// upMask - bit set to fix to weak bounds, not set to leave unfixed unsigned int upMask_[2]; }; /** Unordered Clique Branching Object class. These are for cliques which are > 64 members Variable is number of clique. */ class CbcLongCliqueBranchingObject : public CbcBranchingObject { public: // Default Constructor CbcLongCliqueBranchingObject (); // Useful constructor CbcLongCliqueBranchingObject (CbcModel * model, const CbcClique * clique, int way, int numberOnDownSide, const int * down, int numberOnUpSide, const int * up); // Copy constructor CbcLongCliqueBranchingObject ( const CbcLongCliqueBranchingObject &); // Assignment operator CbcLongCliqueBranchingObject & operator=( const CbcLongCliqueBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; // Destructor virtual ~CbcLongCliqueBranchingObject (); using CbcBranchingObject::branch ; /// Does next branch and updates state virtual double branch(); using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return LongCliqueBranchObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); private: /// data const CbcClique * clique_; /// downMask - bit set to fix to weak bounds, not set to leave unfixed unsigned int * downMask_; /// upMask - bit set to fix to weak bounds, not set to leave unfixed unsigned int * upMask_; }; #endif CoinMP-1.8.3/Cbc/src/CbcGenMessages.hpp0000644000175000017500000000151212131054770016113 0ustar renerene/* Copyright (C) 2007 Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ /* This file is part of cbc-generic. */ #ifndef CbcGenMessages_H #define CbcGenMessages_H /*! \file This file contains the enum that defines symbolic names for for cbc-generic messages. */ /* $Id: CbcGenMessages.hpp 1899 2013-04-09 18:12:08Z stefan $ */ /* There's arguably not enough content here to justify a separate file, but it maintains the common pattern for COIN code. */ /*! \brief Symbolic names for cbc-generic messages These are the `internal IDs' for cbc-generic messages. */ typedef enum { CBCGEN_TEST_MSG = 1, CBCGEN_NEW_SOLVER, CBCGEN_CONFUSION, CBCGEN_DUMMY_END } CbcGenMsgCode ; #endif CoinMP-1.8.3/Cbc/src/CbcBranchLotsize.cpp0000644000175000017500000006277312354530667016507 0ustar renerene/* $Id: CbcBranchLotsize.cpp 2043 2014-07-01 13:03:51Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchLotsize.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" /* CBC_PRINT 1 just does sanity checks - no printing Larger values of CBC_PRINT set various printing levels. Larger values print more. */ //#define CBC_PRINT 1 // First/last variable to print info on #if CBC_PRINT // preset does all - change to x,x to just do x static int firstPrint = 0; static int lastPrint = 1000000; static CbcModel * saveModel = NULL; #endif // Just for debug (CBC_PRINT defined in CbcBranchLotsize.cpp) void #if CBC_PRINT CbcLotsize::printLotsize(double value, bool condition, int type) const #else CbcLotsize::printLotsize(double , bool , int ) const #endif { #if CBC_PRINT if (columnNumber_ >= firstPrint && columnNumber_ <= lastPrint) { int printIt = CBC_PRINT - 1; // Get details OsiSolverInterface * solver = saveModel->solver(); double currentLower = solver->getColLower()[columnNumber_]; double currentUpper = solver->getColUpper()[columnNumber_]; int i; // See if in a valid range (with two tolerances) bool inRange = false; bool inRange2 = false; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); // increase if type 2 if (type == 2) { integerTolerance *= 100.0; type = 0; printIt = 2; // always print } // bounds should match some bound int rangeL = -1; int rangeU = -1; if (rangeType_ == 1) { for (i = 0; i < numberRanges_; i++) { if (fabs(currentLower - bound_[i]) < 1.0e-12) rangeL = i; if (fabs(currentUpper - bound_[i]) < 1.0e-12) rangeU = i; if (fabs(value - bound_[i]) < integerTolerance) inRange = true; if (fabs(value - bound_[i]) < 1.0e8) inRange2 = true; } } else { for (i = 0; i < numberRanges_; i++) { if (fabs(currentLower - bound_[2*i]) < 1.0e-12) rangeL = i; if (fabs(currentUpper - bound_[2*i+1]) < 1.0e-12) rangeU = i; if (value > bound_[2*i] - integerTolerance && value < bound_[2*i+1] + integerTolerance) inRange = true; if (value > bound_[2*i] - integerTolerance && value < bound_[2*i+1] + integerTolerance) inRange = true; } } assert (rangeL >= 0 && rangeU >= 0); bool abortIt = false; switch (type) { // returning from findRange (fall through to just check) case 0: if (printIt) { printf("findRange returns %s for column %d and value %g", condition ? "true" : "false", columnNumber_, value); if (printIt > 1) printf(" LP bounds %g, %g", currentLower, currentUpper); printf("\n"); } // Should match case 1: if (inRange != condition) { printIt = 2; abortIt = true; } break; // case 2: break; // case 3: break; // case 4: break; } } #endif } /** Default Constructor */ CbcLotsize::CbcLotsize () : CbcObject(), columnNumber_(-1), rangeType_(0), numberRanges_(0), largestGap_(0), bound_(NULL), range_(0) { } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ CbcLotsize::CbcLotsize (CbcModel * model, int iColumn, int numberPoints, const double * points, bool range) : CbcObject(model) { #if CBC_PRINT if (!saveModel) saveModel = model; #endif assert (numberPoints > 0); columnNumber_ = iColumn ; // and set id so can be used for branching id_ = iColumn; // sort ranges int * sort = new int[numberPoints]; double * weight = new double [numberPoints]; int i; if (range) { rangeType_ = 2; } else { rangeType_ = 1; } for (i = 0; i < numberPoints; i++) { sort[i] = i; weight[i] = points[i*rangeType_]; } CoinSort_2(weight, weight + numberPoints, sort); numberRanges_ = 1; largestGap_ = 0; if (rangeType_ == 1) { bound_ = new double[numberPoints+1]; bound_[0] = weight[0]; for (i = 1; i < numberPoints; i++) { if (weight[i] != weight[i-1]) bound_[numberRanges_++] = weight[i]; } // and for safety bound_[numberRanges_] = bound_[numberRanges_-1]; for (i = 1; i < numberRanges_; i++) { largestGap_ = CoinMax(largestGap_, bound_[i] - bound_[i-1]); } } else { bound_ = new double[2*numberPoints+2]; bound_[0] = points[sort[0] * 2]; bound_[1] = points[sort[0] * 2 + 1]; double hi = bound_[1]; assert (hi >= bound_[0]); for (i = 1; i < numberPoints; i++) { double thisLo = points[sort[i] * 2]; double thisHi = points[sort[i] * 2 + 1]; assert (thisHi >= thisLo); if (thisLo > hi) { bound_[2*numberRanges_] = thisLo; bound_[2*numberRanges_+1] = thisHi; numberRanges_++; hi = thisHi; } else { //overlap hi = CoinMax(hi, thisHi); bound_[2*numberRanges_-1] = hi; } } // and for safety bound_[2*numberRanges_] = bound_[2*numberRanges_-2]; bound_[2*numberRanges_+1] = bound_[2*numberRanges_-1]; for (i = 1; i < numberRanges_; i++) { largestGap_ = CoinMax(largestGap_, bound_[2*i] - bound_[2*i-1]); } } delete [] sort; delete [] weight; range_ = 0; } // Copy constructor CbcLotsize::CbcLotsize ( const CbcLotsize & rhs) : CbcObject(rhs) { columnNumber_ = rhs.columnNumber_; rangeType_ = rhs.rangeType_; numberRanges_ = rhs.numberRanges_; range_ = rhs.range_; largestGap_ = rhs.largestGap_; if (numberRanges_) { assert (rangeType_ > 0 && rangeType_ < 3); bound_ = new double [(numberRanges_+1)*rangeType_]; memcpy(bound_, rhs.bound_, (numberRanges_ + 1)*rangeType_*sizeof(double)); } else { bound_ = NULL; } } // Clone CbcObject * CbcLotsize::clone() const { return new CbcLotsize(*this); } // Assignment operator CbcLotsize & CbcLotsize::operator=( const CbcLotsize & rhs) { if (this != &rhs) { CbcObject::operator=(rhs); columnNumber_ = rhs.columnNumber_; rangeType_ = rhs.rangeType_; numberRanges_ = rhs.numberRanges_; largestGap_ = rhs.largestGap_; delete [] bound_; range_ = rhs.range_; if (numberRanges_) { assert (rangeType_ > 0 && rangeType_ < 3); bound_ = new double [(numberRanges_+1)*rangeType_]; memcpy(bound_, rhs.bound_, (numberRanges_ + 1)*rangeType_*sizeof(double)); } else { bound_ = NULL; } } return *this; } // Destructor CbcLotsize::~CbcLotsize () { delete [] bound_; } /* Finds range of interest so value is feasible in range range_ or infeasible between hi[range_] and lo[range_+1]. Returns true if feasible. */ bool CbcLotsize::findRange(double value) const { assert (range_ >= 0 && range_ < numberRanges_ + 1); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); int iLo; int iHi; double infeasibility = 0.0; if (rangeType_ == 1) { if (value < bound_[range_] - integerTolerance) { iLo = 0; iHi = range_ - 1; } else if (value < bound_[range_] + integerTolerance) { #if CBC_PRINT printLotsize(value, true, 0); #endif return true; } else if (value < bound_[range_+1] - integerTolerance) { #ifdef CBC_PRINT printLotsize(value, false, 0); #endif return false; } else { iLo = range_ + 1; iHi = numberRanges_ - 1; } // check lo and hi bool found = false; if (value > bound_[iLo] - integerTolerance && value < bound_[iLo+1] + integerTolerance) { range_ = iLo; found = true; } else if (value > bound_[iHi] - integerTolerance && value < bound_[iHi+1] + integerTolerance) { range_ = iHi; found = true; } else { range_ = (iLo + iHi) >> 1; } //points while (!found) { if (value < bound_[range_]) { if (value >= bound_[range_-1]) { // found range_--; break; } else { iHi = range_; } } else { if (value < bound_[range_+1]) { // found break; } else { iLo = range_; } } range_ = (iLo + iHi) >> 1; } if (value - bound_[range_] <= bound_[range_+1] - value) { infeasibility = value - bound_[range_]; } else { infeasibility = bound_[range_+1] - value; if (infeasibility < integerTolerance) range_++; } #ifdef CBC_PRINT printLotsize(value, (infeasibility < integerTolerance), 0); #endif return (infeasibility < integerTolerance); } else { // ranges if (value < bound_[2*range_] - integerTolerance) { iLo = 0; iHi = range_ - 1; } else if (value < bound_[2*range_+1] + integerTolerance) { #ifdef CBC_PRINT printLotsize(value, true, 0); #endif return true; } else if (value < bound_[2*range_+2] - integerTolerance) { #ifdef CBC_PRINT printLotsize(value, false, 0); #endif return false; } else { iLo = range_ + 1; iHi = numberRanges_ - 1; } // check lo and hi bool found = false; if (value > bound_[2*iLo] - integerTolerance && value < bound_[2*iLo+2] - integerTolerance) { range_ = iLo; found = true; } else if (value >= bound_[2*iHi] - integerTolerance) { range_ = iHi; found = true; } else { range_ = (iLo + iHi) >> 1; } //points while (!found) { if (value < bound_[2*range_]) { if (value >= bound_[2*range_-2]) { // found range_--; break; } else { iHi = range_; } } else { if (value < bound_[2*range_+2]) { // found break; } else { iLo = range_; } } range_ = (iLo + iHi) >> 1; } if (value >= bound_[2*range_] - integerTolerance && value <= bound_[2*range_+1] + integerTolerance) infeasibility = 0.0; else if (value - bound_[2*range_+1] < bound_[2*range_+2] - value) { infeasibility = value - bound_[2*range_+1]; } else { infeasibility = bound_[2*range_+2] - value; } #ifdef CBC_PRINT printLotsize(value, (infeasibility < integerTolerance), 0); #endif return (infeasibility < integerTolerance); } } /* Returns floor and ceiling */ void CbcLotsize::floorCeiling(double & floorLotsize, double & ceilingLotsize, double value, double /*tolerance*/) const { bool feasible = findRange(value); if (rangeType_ == 1) { floorLotsize = bound_[range_]; ceilingLotsize = bound_[range_+1]; // may be able to adjust if (feasible && fabs(value - floorLotsize) > fabs(value - ceilingLotsize)) { floorLotsize = bound_[range_+1]; ceilingLotsize = bound_[range_+2]; } } else { // ranges assert (value >= bound_[2*range_+1]); floorLotsize = bound_[2*range_+1]; ceilingLotsize = bound_[2*range_+2]; } } double CbcLotsize::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); /*printf("%d %g %g %g %g\n",columnNumber_,value,lower[columnNumber_], solution[columnNumber_],upper[columnNumber_]);*/ assert (value >= bound_[0] - integerTolerance && value <= bound_[rangeType_*numberRanges_-1] + integerTolerance); double infeasibility = 0.0; bool feasible = findRange(value); if (!feasible) { if (rangeType_ == 1) { if (value - bound_[range_] < bound_[range_+1] - value) { preferredWay = -1; infeasibility = value - bound_[range_]; } else { preferredWay = 1; infeasibility = bound_[range_+1] - value; } } else { // ranges if (value - bound_[2*range_+1] < bound_[2*range_+2] - value) { preferredWay = -1; infeasibility = value - bound_[2*range_+1]; } else { preferredWay = 1; infeasibility = bound_[2*range_+2] - value; } } } else { // always satisfied preferredWay = -1; } if (infeasibility < integerTolerance) infeasibility = 0.0; else infeasibility /= largestGap_; #ifdef CBC_PRINT printLotsize(value, infeasibility, 1); #endif return infeasibility; } /* Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics */ int CbcLotsize::columnNumber() const { return columnNumber_; } // This looks at solution and sets bounds to contain solution /** More precisely: it first forces the variable within the existing bounds, and then tightens the bounds to make sure the variable is feasible */ void CbcLotsize::feasibleRegion() { OsiSolverInterface * solver = model_->solver(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * solution = model_->testSolution(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); findRange(value); double nearest; if (rangeType_ == 1) { nearest = bound_[range_]; solver->setColLower(columnNumber_, nearest); solver->setColUpper(columnNumber_, nearest); } else { // ranges solver->setColLower(columnNumber_, CoinMax(bound_[2*range_], lower[columnNumber_])); solver->setColUpper(columnNumber_, CoinMin(bound_[2*range_+1], upper[columnNumber_])); if (value > bound_[2*range_+1]) nearest = bound_[2*range_+1]; else if (value < bound_[2*range_]) nearest = bound_[2*range_]; else nearest = value; } #ifdef CBC_PRINT // print details printLotsize(value, true, 2); #endif // Scaling may have moved it a bit // Lotsizing variables could be a lot larger #ifndef NDEBUG double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); assert (fabs(value - nearest) <= (100.0 + 10.0*fabs(nearest))*integerTolerance); #endif } CbcBranchingObject * CbcLotsize::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * /*info*/, int way) { //OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); assert (!findRange(value)); return new CbcLotsizeBranchingObject(model_, columnNumber_, way, value, this); } /* Given valid solution (i.e. satisfied) and reduced costs etc returns a branching object which would give a new feasible point in direction reduced cost says would be cheaper. If no feasible point returns null */ CbcBranchingObject * CbcLotsize::preferredNewFeasible() const { OsiSolverInterface * solver = model_->solver(); assert (findRange(model_->testSolution()[columnNumber_])); double dj = solver->getObjSense() * solver->getReducedCost()[columnNumber_]; CbcLotsizeBranchingObject * object = NULL; double lo, up; if (dj >= 0.0) { // can we go down if (range_) { // yes if (rangeType_ == 1) { lo = bound_[range_-1]; up = bound_[range_-1]; } else { lo = bound_[2*range_-2]; up = bound_[2*range_-1]; } object = new CbcLotsizeBranchingObject(model_, columnNumber_, -1, lo, up); } } else { // can we go up if (range_ < numberRanges_ - 1) { // yes if (rangeType_ == 1) { lo = bound_[range_+1]; up = bound_[range_+1]; } else { lo = bound_[2*range_+2]; up = bound_[2*range_+3]; } object = new CbcLotsizeBranchingObject(model_, columnNumber_, -1, lo, up); } } return object; } /* Given valid solution (i.e. satisfied) and reduced costs etc returns a branching object which would give a new feasible point in direction opposite to one reduced cost says would be cheaper. If no feasible point returns null */ CbcBranchingObject * CbcLotsize::notPreferredNewFeasible() const { OsiSolverInterface * solver = model_->solver(); #ifndef NDEBUG double value = model_->testSolution()[columnNumber_]; double nearest = floor(value + 0.5); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); // Scaling may have moved it a bit // Lotsizing variables could be a lot larger assert (fabs(value - nearest) <= (10.0 + 10.0*fabs(nearest))*integerTolerance); #endif double dj = solver->getObjSense() * solver->getReducedCost()[columnNumber_]; CbcLotsizeBranchingObject * object = NULL; double lo, up; if (dj <= 0.0) { // can we go down if (range_) { // yes if (rangeType_ == 1) { lo = bound_[range_-1]; up = bound_[range_-1]; } else { lo = bound_[2*range_-2]; up = bound_[2*range_-1]; } object = new CbcLotsizeBranchingObject(model_, columnNumber_, -1, lo, up); } } else { // can we go up if (range_ < numberRanges_ - 1) { // yes if (rangeType_ == 1) { lo = bound_[range_+1]; up = bound_[range_+1]; } else { lo = bound_[2*range_+2]; up = bound_[2*range_+3]; } object = new CbcLotsizeBranchingObject(model_, columnNumber_, -1, lo, up); } } return object; } /* Bounds may be tightened, so it may be good to be able to refresh the local copy of the original bounds. */ void CbcLotsize::resetBounds(const OsiSolverInterface * /*solver*/) { } // Default Constructor CbcLotsizeBranchingObject::CbcLotsizeBranchingObject() : CbcBranchingObject() { down_[0] = 0.0; down_[1] = 0.0; up_[0] = 0.0; up_[1] = 0.0; } // Useful constructor CbcLotsizeBranchingObject::CbcLotsizeBranchingObject (CbcModel * model, int variable, int way , double value, const CbcLotsize * lotsize) : CbcBranchingObject(model, variable, way, value) { int iColumn = lotsize->modelSequence(); assert (variable == iColumn); down_[0] = model_->solver()->getColLower()[iColumn]; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); lotsize->floorCeiling(down_[1], up_[0], value, integerTolerance); up_[1] = model->getColUpper()[iColumn]; } // Useful constructor for fixing CbcLotsizeBranchingObject::CbcLotsizeBranchingObject (CbcModel * model, int variable, int way, double lowerValue, double upperValue) : CbcBranchingObject(model, variable, way, lowerValue) { setNumberBranchesLeft(1); down_[0] = lowerValue; down_[1] = upperValue; up_[0] = lowerValue; up_[1] = upperValue; } // Copy constructor CbcLotsizeBranchingObject::CbcLotsizeBranchingObject ( const CbcLotsizeBranchingObject & rhs) : CbcBranchingObject(rhs) { down_[0] = rhs.down_[0]; down_[1] = rhs.down_[1]; up_[0] = rhs.up_[0]; up_[1] = rhs.up_[1]; } // Assignment operator CbcLotsizeBranchingObject & CbcLotsizeBranchingObject::operator=( const CbcLotsizeBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); down_[0] = rhs.down_[0]; down_[1] = rhs.down_[1]; up_[0] = rhs.up_[0]; up_[1] = rhs.up_[1]; } return *this; } CbcBranchingObject * CbcLotsizeBranchingObject::clone() const { return (new CbcLotsizeBranchingObject(*this)); } // Destructor CbcLotsizeBranchingObject::~CbcLotsizeBranchingObject () { } /* Perform a branch by adjusting the bounds of the specified variable. Note that each arm of the branch advances the object to the next arm by advancing the value of way_. Providing new values for the variable's lower and upper bounds for each branching direction gives a little bit of additional flexibility and will be easily extensible to multi-way branching. */ double CbcLotsizeBranchingObject::branch() { decrementNumberBranchesLeft(); int iColumn = variable_; if (way_ < 0) { #ifndef NDEBUG { double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; #ifdef CBC_DEBUG printf("branching down on var %d: [%g,%g] => [%g,%g]\n", iColumn, olb, oub, down_[0], down_[1]) ; #endif assert (olbdown_[1]-1.0e-7); } #endif model_->solver()->setColLower(iColumn, down_[0]); model_->solver()->setColUpper(iColumn, down_[1]); way_ = 1; } else { #ifndef NDEBUG { double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; #ifdef CBC_DEBUG printf("branching up on var %d: [%g,%g] => [%g,%g]\n", iColumn, olb, oub, up_[0], up_[1]) ; #endif assert (olbup_[1]-1.0e-7); } #endif model_->solver()->setColLower(iColumn, up_[0]); model_->solver()->setColUpper(iColumn, up_[1]); way_ = -1; // Swap direction } return 0.0; } // Print void CbcLotsizeBranchingObject::print() { int iColumn = variable_; if (way_ < 0) { { double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; printf("branching down on var %d: [%g,%g] => [%g,%g]\n", iColumn, olb, oub, down_[0], down_[1]) ; } } else { { double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; printf("branching up on var %d: [%g,%g] => [%g,%g]\n", iColumn, olb, oub, up_[0], up_[1]) ; } } } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcLotsizeBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap) { const CbcLotsizeBranchingObject* br = dynamic_cast(brObj); assert(br); double* thisBd = way_ == -1 ? down_ : up_; const double* otherBd = br->way_ == -1 ? br->down_ : br->up_; return CbcCompareRanges(thisBd, otherBd, replaceIfOverlap); } CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveFractional.hpp0000644000175000017500000000315412131054770020470 0ustar renerene/* $Id: CbcHeuristicDiveFractional.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicDiveFractional_H #define CbcHeuristicDiveFractional_H #include "CbcHeuristicDive.hpp" /** DiveFractional class */ class CbcHeuristicDiveFractional : public CbcHeuristicDive { public: // Default Constructor CbcHeuristicDiveFractional (); // Constructor with model - assumed before cuts CbcHeuristicDiveFractional (CbcModel & model); // Copy constructor CbcHeuristicDiveFractional ( const CbcHeuristicDiveFractional &); // Destructor ~CbcHeuristicDiveFractional (); /// Clone virtual CbcHeuristicDiveFractional * clone() const; /// Assignment operator CbcHeuristicDiveFractional & operator=(const CbcHeuristicDiveFractional& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Selects the next variable to branch on /** Returns true if all the fractional variables can be trivially rounded. Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable. */ virtual bool selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound); }; #endif CoinMP-1.8.3/Cbc/src/CbcConsequence.hpp0000644000175000017500000000236712131054770016173 0ustar renerene// $Id: CbcConsequence.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #ifndef CbcConsequence_H #define CbcConsequence_H class OsiSolverInterface; /** Abstract base class for consequent bounds. When a variable is branched on it normally interacts with other variables by means of equations. There are cases where we want to step outside LP and do something more directly e.g. fix bounds. This class is for that. At present it need not be virtual as only instance is CbcFixVariable, but ... */ class CbcConsequence { public: // Default Constructor CbcConsequence (); // Copy constructor CbcConsequence ( const CbcConsequence & rhs); // Assignment operator CbcConsequence & operator=( const CbcConsequence & rhs); /// Clone virtual CbcConsequence * clone() const = 0; /// Destructor virtual ~CbcConsequence (); /** Apply to an LP solver. Action depends on state */ virtual void applyToSolver(OsiSolverInterface * solver, int state) const = 0; protected: }; #endif CoinMP-1.8.3/Cbc/src/CbcMessage.hpp0000644000175000017500000000366211764413376015322 0ustar renerene/* $Id: CbcMessage.hpp 1791 2012-06-08 15:15:10Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcMessage_H #define CbcMessage_H #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif /** This deals with Cbc messages (as against Clp messages etc). CoinMessageHandler.hpp is the general part of message handling. All it has are enum's for the various messages. CbcMessage.cpp has text in various languages. It is trivial to use the .hpp and .cpp file as a basis for messages for other components. */ #include "CoinMessageHandler.hpp" enum CBC_Message { CBC_END_GOOD, CBC_MAXNODES, CBC_MAXTIME, CBC_MAXSOLS, CBC_EVENT, CBC_MAXITERS, CBC_SOLUTION, CBC_END_SOLUTION, CBC_SOLUTION2, CBC_END, CBC_INFEAS, CBC_STRONG, CBC_SOLINDIVIDUAL, CBC_INTEGERINCREMENT, CBC_STATUS, CBC_GAP, CBC_ROUNDING, CBC_TREE_SOL, CBC_ROOT, CBC_GENERATOR, CBC_BRANCH, CBC_STRONGSOL, CBC_NOINT, CBC_VUB_PASS, CBC_VUB_END, CBC_NOTFEAS1, CBC_NOTFEAS2, CBC_NOTFEAS3, CBC_CUTOFF_WARNING1, CBC_ITERATE_STRONG, CBC_PRIORITY, CBC_WARNING_STRONG, CBC_START_SUB, CBC_END_SUB, CBC_THREAD_STATS, CBC_CUTS_STATS, CBC_STRONG_STATS, CBC_UNBOUNDED, CBC_OTHER_STATS, CBC_HEURISTICS_OFF, CBC_STATUS2, CBC_FPUMP1, CBC_FPUMP2, CBC_STATUS3, CBC_OTHER_STATS2, CBC_RELAXED1, CBC_RELAXED2, CBC_RESTART, CBC_GENERAL, CBC_ROOT_DETAIL, #ifndef NO_FATHOM_PRINT CBC_FATHOM_CHANGE, #endif CBC_DUMMY_END }; class CbcMessage : public CoinMessages { public: /**@name Constructors etc */ //@{ /** Constructor */ CbcMessage(Language language = us_en); //@} }; #endif CoinMP-1.8.3/Cbc/src/Cbc_C_Interface.h0000644000175000017500000003056012413370771015665 0ustar renerene/* $Id: Cbc_C_Interface.h 2091 2014-10-03 00:46:49Z mlubin $ */ /* Copyright (C) 2004 International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #ifndef CbcModelC_H #define CbcModelC_H /* include all defines and ugly stuff */ #include "Coin_C_defines.h" #include /* * Original verison contributed by Bob Entriken, * significantly updated by Miles Lubin. */ #ifdef __cplusplus extern "C" { #endif /**@name Constructors and destructor This is a "C" interface to Cbc. The user does not need to know structure of Cbc_Model. */ /*@{*/ /** Default Cbc_Model constructor */ COINLIBAPI Cbc_Model * COINLINKAGE Cbc_newModel(void) ; /** Cbc_Model Destructor */ COINLIBAPI void COINLINKAGE Cbc_deleteModel(Cbc_Model * model) ; /** Current version of Cbc */ COINLIBAPI const char* COINLINKAGE Cbc_getVersion(void) ; /*@}*/ /**@name Getting and setting model data Note that problem access and modification methods, such as getColLower and setColLower, are *not valid* after calling Cbc_solve(). Therefore it is not recommended to reuse a Cbc_Model object for multiple solves. A workaround is to call Cbc_clone() before solving. * */ /*@{*/ /** Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is NULL then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    The constraint matrix is given in standard compressed sparse column (without gaps).
    • start[i] stores the starting index of the ith column
    • index[k] stores the row index of the kth nonzero element
    • value[k] stores the coefficient of the kth nonzero element
    */ COINLIBAPI void COINLINKAGE Cbc_loadProblem (Cbc_Model * model, const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) ; /** Read an mps file from the given filename */ COINLIBAPI int COINLINKAGE Cbc_readMps(Cbc_Model * model, const char *filename) ; /** Write an mps file from the given filename */ COINLIBAPI void COINLINKAGE Cbc_writeMps(Cbc_Model * model, const char *filename) ; /** Provide an initial feasible solution to accelerate branch-and-bound Note that feasibility of the solution is *not* verified. */ COINLIBAPI void COINLINKAGE Cbc_setInitialSolution(Cbc_Model *model, const double * sol) ; /** Fills in array with problem name */ COINLIBAPI void COINLINKAGE Cbc_problemName(Cbc_Model * model, int maxNumberCharacters, char * array) ; /** Sets problem name. \p array must be a null-terminated string. */ COINLIBAPI int COINLINKAGE Cbc_setProblemName(Cbc_Model * model, const char * array) ; /** Number of nonzero elements in constraint matrix */ COINLIBAPI int COINLINKAGE Cbc_getNumElements(Cbc_Model * model) ; /** "Column start" vector of constraint matrix. Same format as Cbc_loadProblem() */ COINLIBAPI const CoinBigIndex * COINLINKAGE Cbc_getVectorStarts(Cbc_Model * model) ; /** "Row index" vector of constraint matrix */ COINLIBAPI const int * COINLINKAGE Cbc_getIndices(Cbc_Model * model) ; /** Coefficient vector of constraint matrix */ COINLIBAPI const double * COINLINKAGE Cbc_getElements(Cbc_Model * model) ; /** Maximum lenght of a row or column name */ COINLIBAPI size_t COINLINKAGE Cbc_maxNameLength(Cbc_Model * model) ; /** Fill in first maxLength bytes of name array with a row name */ COINLIBAPI void COINLINKAGE Cbc_getRowName(Cbc_Model * model, int iRow, char * name, size_t maxLength) ; /** Fill in first maxLength bytes of name array with a column name */ COINLIBAPI void COINLINKAGE Cbc_getColName(Cbc_Model * model, int iColumn, char * name, size_t maxLength) ; /** Set the name of a column */ COINLIBAPI void COINLINKAGE Cbc_setColName(Cbc_Model * model, int iColumn, const char * name) ; /** Set the name of a row */ COINLIBAPI void COINLINKAGE Cbc_setRowName(Cbc_Model * model, int iRow, const char * name) ; /** Number of constraints in the model */ COINLIBAPI int COINLINKAGE Cbc_getNumRows(Cbc_Model * model) ; /** Number of variables in the model */ COINLIBAPI int COINLINKAGE Cbc_getNumCols(Cbc_Model * model) ; /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */ COINLIBAPI void COINLINKAGE Cbc_setObjSense(Cbc_Model * model, double sense) ; /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */ COINLIBAPI double COINLINKAGE Cbc_getObjSense(Cbc_Model * model) ; /** Constraint lower bounds */ COINLIBAPI const double* COINLINKAGE Cbc_getRowLower(Cbc_Model * model) ; /** Set the lower bound of a single constraint */ COINLIBAPI void COINLINKAGE Cbc_setRowLower(Cbc_Model * model, int index, double value) ; /** Constraint upper bounds */ COINLIBAPI const double* COINLINKAGE Cbc_getRowUpper(Cbc_Model * model) ; /** Set the upper bound of a single constraint */ COINLIBAPI void COINLINKAGE Cbc_setRowUpper(Cbc_Model * model, int index, double value) ; /** Objective vector */ COINLIBAPI const double * COINLINKAGE Cbc_getObjCoefficients(Cbc_Model * model) ; /** Set the objective coefficient of a single variable */ COINLIBAPI void COINLINKAGE Cbc_setObjCoeff(Cbc_Model * model, int index, double value) ; /** Variable lower bounds */ COINLIBAPI const double * COINLINKAGE Cbc_getColLower(Cbc_Model * model) ; /** Set the lower bound of a single variable */ COINLIBAPI void COINLINKAGE Cbc_setColLower(Cbc_Model * model, int index, double value) ; /** Variable upper bounds */ COINLIBAPI const double * COINLINKAGE Cbc_getColUpper(Cbc_Model * model) ; /** Set the upper bound of a single variable */ COINLIBAPI void COINLINKAGE Cbc_setColUpper(Cbc_Model * model, int index, double value) ; /** Determine whether the ith variable is integer restricted */ COINLIBAPI int COINLINKAGE Cbc_isInteger(Cbc_Model * model, int i) ; /** Set this variable to be continuous */ COINLIBAPI void COINLINKAGE Cbc_setContinuous(Cbc_Model * model, int iColumn) ; /** Set this variable to be integer */ COINLIBAPI void COINLINKAGE Cbc_setInteger(Cbc_Model * model, int iColumn) ; /** Add SOS constraints to the model using row-order matrix */ COINLIBAPI void COINLINKAGE Cbc_addSOS(Cbc_Model * model, int numRows, const int * rowStarts, const int * colIndices, const double * weights, const int type) ; /** Print the model */ COINLIBAPI void COINLINKAGE Cbc_printModel(Cbc_Model * model, const char * argPrefix) ; /** Return a copy of this model */ COINLIBAPI Cbc_Model * COINLINKAGE Cbc_clone(Cbc_Model * model) ; /*@}*/ /**@name Solver parameters */ /*@{*/ /** Set parameter "name" to value "value". Note that this * translates directly to using "-name value" as a * command-line argument to Cbc.*/ COINLIBAPI void COINLINKAGE Cbc_setParameter(Cbc_Model * model, const char * name, const char * value) ; /*@}*/ /**@name Message handling. Call backs are handled by ONE function */ /*@{*/ /** Pass in Callback function. Message numbers up to 1000000 are Clp, Coin ones have 1000000 added */ COINLIBAPI void COINLINKAGE Cbc_registerCallBack(Cbc_Model * model, cbc_callback userCallBack) ; /** Unset Callback function */ COINLIBAPI void COINLINKAGE Cbc_clearCallBack(Cbc_Model * model) ; /*@}*/ /**@name Solving the model */ /*@{*/ /* Solve the model with Cbc (using CbcMain1). */ COINLIBAPI int COINLINKAGE Cbc_solve(Cbc_Model * model) ; /*@}*/ /**@name Accessing the solution and solution status */ /*@{*/ /** Sum of primal infeasibilities */ COINLIBAPI double COINLINKAGE Cbc_sumPrimalInfeasibilities(Cbc_Model * model) ; /** Number of primal infeasibilities */ COINLIBAPI int COINLINKAGE Cbc_numberPrimalInfeasibilities(Cbc_Model * model) ; /** Just check solution (for external use) - sets sum of infeasibilities etc */ COINLIBAPI void COINLINKAGE Cbc_checkSolution(Cbc_Model * model) ; /** Number of iterations */ COINLIBAPI int COINLINKAGE Cbc_getIterationCount(Cbc_Model * model) ; /** Are there a numerical difficulties? */ COINLIBAPI int COINLINKAGE Cbc_isAbandoned(Cbc_Model * model) ; /** Is optimality proven? */ COINLIBAPI int COINLINKAGE Cbc_isProvenOptimal(Cbc_Model * model) ; /** Is infeasiblity proven (or none better than cutoff)? */ COINLIBAPI int COINLINKAGE Cbc_isProvenInfeasible(Cbc_Model * model) ; /** Was continuous solution unbounded? */ COINLIBAPI int COINLINKAGE Cbc_isContinuousUnbounded(Cbc_Model * model) ; /** Node limit reached? */ COINLIBAPI int COINLINKAGE Cbc_isNodeLimitReached(Cbc_Model * model) ; /** Time limit reached? */ COINLIBAPI int COINLINKAGE Cbc_isSecondsLimitReached(Cbc_Model * model) ; /** Solution limit reached? */ COINLIBAPI int COINLINKAGE Cbc_isSolutionLimitReached(Cbc_Model * model) ; /** Are there numerical difficulties (for initialSolve) ? */ COINLIBAPI int COINLINKAGE Cbc_isInitialSolveAbandoned(Cbc_Model * model) ; /** Is optimality proven (for initialSolve) ? */ COINLIBAPI int COINLINKAGE Cbc_isInitialSolveProvenOptimal(Cbc_Model * model) ; /** Is primal infeasiblity proven (for initialSolve) ? */ COINLIBAPI int COINLINKAGE Cbc_isInitialSolveProvenPrimalInfeasible(Cbc_Model * model) ; /** "row" solution * This is the vector A*x, where A is the constraint matrix * and x is the current solution. */ COINLIBAPI const double * COINLINKAGE Cbc_getRowActivity(Cbc_Model * model) ; /** Best feasible solution vector */ COINLIBAPI const double * COINLINKAGE Cbc_getColSolution(Cbc_Model * model) ; /** Objective value of best feasible solution */ COINLIBAPI double COINLINKAGE Cbc_getObjValue(Cbc_Model * model) ; /** Best known bound on the optimal objective value */ COINLIBAPI double COINLINKAGE Cbc_getBestPossibleObjValue(Cbc_Model * model) ; /** Number of nodes explored in B&B tree */ COINLIBAPI int COINLINKAGE Cbc_getNodeCount(Cbc_Model * model) ; /** Print the solution */ COINLIBAPI void COINLINKAGE Cbc_printSolution(Cbc_Model * model) ; /** Final status of problem Some of these can be found out by is...... functions -1 before branchAndBound 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found (or check value of best solution) 1 stopped - on maxnodes, maxsols, maxtime 2 difficulties so run was abandoned (5 event user programmed event occurred) */ COINLIBAPI int COINLINKAGE Cbc_status(Cbc_Model * model) ; /** Secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 linear relaxation not feasible (or worse than cutoff) 2 stopped on gap 3 stopped on nodes 4 stopped on time 5 stopped on user event 6 stopped on solutions 7 linear relaxation unbounded 8 stopped on iteration limit */ COINLIBAPI int COINLINKAGE Cbc_secondaryStatus(Cbc_Model * model) ; /*@}*/ #ifdef __cplusplus } #endif #endif CoinMP-1.8.3/Cbc/src/ClpConstraintAmpl.hpp0000644000175000017500000000572312131054770016707 0ustar renerene/* $Id: ClpConstraintAmpl.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpConstraintAmpl_H #define ClpConstraintAmpl_H #include "ClpConstraint.hpp" //############################################################################# /** Ampl Constraint Class */ class ClpConstraintAmpl : public ClpConstraint { public: ///@name Stuff //@{ /** Fills gradient. If Ampl then solution may be NULL, also returns true value of function and offset so we can use x not deltaX in constraint If refresh is false then uses last solution Uses model for scaling Returns non-zero if gradient udefined at current solution */ virtual int gradient(const ClpSimplex * model, const double * solution, double * gradient, double & functionValue , double & offset, bool useScaling = false, bool refresh = true) const ; /// Resize constraint virtual void resize(int newNumberColumns) ; /// Delete columns in constraint virtual void deleteSome(int numberToDelete, const int * which) ; /// Scale constraint virtual void reallyScale(const double * columnScale) ; /** Given a zeroed array sets nonampl columns to 1. Returns number of nonampl columns */ virtual int markNonlinear(char * which) const ; /** Given a zeroed array sets possible nonzero coefficients to 1. Returns number of nonzeros */ virtual int markNonzero(char * which) const; /// Say we have new primal solution - so may need to recompute virtual void newXValues() ; //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpConstraintAmpl(); /// Constructor from ampl ClpConstraintAmpl(int row, void * amplInfo); /** Copy constructor . */ ClpConstraintAmpl(const ClpConstraintAmpl & rhs); /// Assignment operator ClpConstraintAmpl & operator=(const ClpConstraintAmpl& rhs); /// Destructor virtual ~ClpConstraintAmpl (); /// Clone virtual ClpConstraint * clone() const; //@} ///@name Gets and sets //@{ /// Number of coefficients virtual int numberCoefficients() const; /// Columns inline const int * column() const { return column_; } /// Coefficients inline const double * coefficient() const { return coefficient_; } //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// Ampl info void * amplInfo_; /// Column int * column_; /// Coefficients double * coefficient_; /// Number of coefficients in gradient int numberCoefficients_; //@} }; #endif CoinMP-1.8.3/Cbc/src/CbcSimpleInteger.hpp0000644000175000017500000002276612172722151016477 0ustar renerene// $Id: CbcSimpleInteger.hpp 1943 2013-07-21 09:05:45Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/9/2009-- carved out of CbcBranchActual #ifndef CbcSimpleInteger_H #define CbcSimpleInteger_H #include "CbcBranchingObject.hpp" /** Simple branching object for an integer variable This object can specify a two-way branch on an integer variable. For each arm of the branch, the upper and lower bounds on the variable can be independently specified. Variable_ holds the index of the integer variable in the integerVariable_ array of the model. */ class CbcIntegerBranchingObject : public CbcBranchingObject { public: /// Default constructor CbcIntegerBranchingObject (); /** Create a standard floor/ceiling branch object Specifies a simple two-way branch. Let \p value = x*. One arm of the branch will be lb <= x <= floor(x*), the other ceil(x*) <= x <= ub. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ CbcIntegerBranchingObject (CbcModel *model, int variable, int way , double value) ; /** Create a degenerate branch object Specifies a `one-way branch'. Calling branch() for this object will always result in lowerValue <= x <= upperValue. Used to fix a variable when lowerValue = upperValue. */ CbcIntegerBranchingObject (CbcModel *model, int variable, int way, double lowerValue, double upperValue) ; /// Copy constructor CbcIntegerBranchingObject ( const CbcIntegerBranchingObject &); /// Assignment operator CbcIntegerBranchingObject & operator= (const CbcIntegerBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; /// Destructor virtual ~CbcIntegerBranchingObject (); /// Does part of constructor void fillPart ( int variable, int way , double value) ; using CbcBranchingObject::branch ; /** \brief Sets the bounds for the variable according to the current arm of the branch and advances the object state to the next arm. Returns change in guessed objective on next branch */ virtual double branch(); /** Update bounds in solver as in 'branch' and update given bounds. branchState is -1 for 'down' +1 for 'up' */ virtual void fix(OsiSolverInterface * solver, double * lower, double * upper, int branchState) const ; /** Change (tighten) bounds in object to reflect bounds in solver. Return true if now fixed */ virtual bool tighten(OsiSolverInterface * ) ; #ifdef JJF_ZERO // No need to override. Default works fine. /** Reset every information so that the branching object appears to point to the previous child. This method does not need to modify anything in any solver. */ virtual void previousBranch(); #endif using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /// Lower and upper bounds for down branch inline const double * downBounds() const { return down_; } /// Lower and upper bounds for up branch inline const double * upBounds() const { return up_; } /// Set lower and upper bounds for down branch inline void setDownBounds(const double bounds[2]) { memcpy(down_, bounds, 2*sizeof(double)); } /// Set lower and upper bounds for up branch inline void setUpBounds(const double bounds[2]) { memcpy(up_, bounds, 2*sizeof(double)); } #ifdef FUNNY_BRANCHING /** Which variable (top bit if upper bound changing, next bit if on down branch */ inline const int * variables() const { return variables_; } // New bound inline const double * newBounds() const { return newBounds_; } /// Number of bound changes inline int numberExtraChangedBounds() const { return numberExtraChangedBounds_; } /// Just apply extra bounds to one variable - COIN_DBL_MAX ignore int applyExtraBounds(int iColumn, double lower, double upper, int way) ; /// Deactivate bounds for branching void deactivate(); /// Are active bounds for branching inline bool active() const { return (down_[1] != -COIN_DBL_MAX); } #endif /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return SimpleIntegerBranchObj; } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); protected: /// Lower [0] and upper [1] bounds for the down arm (way_ = -1) double down_[2]; /// Lower [0] and upper [1] bounds for the up arm (way_ = 1) double up_[2]; #ifdef FUNNY_BRANCHING /** Which variable (top bit if upper bound changing) next bit if changing on down branch only */ int * variables_; // New bound double * newBounds_; /// Number of Extra bound changes int numberExtraChangedBounds_; #endif }; /// Define a single integer class class CbcSimpleInteger : public CbcObject { public: // Default Constructor CbcSimpleInteger (); // Useful constructor - passed model and index CbcSimpleInteger (CbcModel * model, int iColumn, double breakEven = 0.5); // Useful constructor - passed model and Osi object CbcSimpleInteger (CbcModel * model, const OsiSimpleInteger * object); // Copy constructor CbcSimpleInteger ( const CbcSimpleInteger &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcSimpleInteger & operator=( const CbcSimpleInteger& rhs); // Destructor virtual ~CbcSimpleInteger (); /// Construct an OsiSimpleInteger object OsiSimpleInteger * osiObject() const; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /** Set bounds to fix the variable at the current (integer) value. Given an integer value, set the lower and upper bounds to fix the variable. Returns amount it had to move variable. */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** Create a branching object and indicate which way to branch first. The branching object has to know how to create branches (fix variables, etc.) */ virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Fills in a created branching object /*virtual*/ void fillCreateBranch(CbcIntegerBranchingObject * branching, const OsiBranchingInformation * info, int way) ; using CbcObject::solverBranch ; /** Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ virtual OsiSolverBranch * solverBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** Set bounds to fix the variable at the current (integer) value. Given an integer value, set the lower and upper bounds to fix the variable. The algorithm takes a bit of care in order to compensate for minor numerical inaccuracy. */ virtual void feasibleRegion(); /** Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics */ virtual int columnNumber() const; /// Set column number inline void setColumnNumber(int value) { columnNumber_ = value; } /** Reset variable bounds to their original values. Bounds may be tightened, so it may be good to be able to set this info in object. */ virtual void resetBounds(const OsiSolverInterface * solver) ; /** Change column numbers after preprocessing */ virtual void resetSequenceEtc(int numberColumns, const int * originalColumns) ; /// Original bounds inline double originalLowerBound() const { return originalLower_; } inline void setOriginalLowerBound(double value) { originalLower_ = value; } inline double originalUpperBound() const { return originalUpper_; } inline void setOriginalUpperBound(double value) { originalUpper_ = value; } /// Breakeven e.g 0.7 -> >= 0.7 go up first inline double breakEven() const { return breakEven_; } /// Set breakeven e.g 0.7 -> >= 0.7 go up first inline void setBreakEven(double value) { breakEven_ = value; } protected: /// data /// Original lower bound double originalLower_; /// Original upper bound double originalUpper_; /// Breakeven i.e. >= this preferred is up double breakEven_; /// Column number in model int columnNumber_; /// If -1 down always chosen first, +1 up always, 0 normal int preferredWay_; }; #endif CoinMP-1.8.3/Cbc/src/CbcSubProblem.cpp0000644000175000017500000002454312131054770015770 0ustar renerene// $Id: CbcSubProblem.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #include #include #include #include //#define CBC_DEBUG #include "CoinPragma.hpp" #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcSubProblem.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif // Default Constructor CbcSubProblem::CbcSubProblem() : objectiveValue_(0.0), sumInfeasibilities_(0.0), branchValue_(0.0), djValue_(0.0), variables_(NULL), newBounds_(NULL), status_(NULL), depth_(0), numberChangedBounds_(0), numberInfeasibilities_(0), problemStatus_(0), branchVariable_(0) { } // Useful constructor CbcSubProblem::CbcSubProblem (const OsiSolverInterface * solver, const double * lastLower, const double * lastUpper, const unsigned char * status, int depth) : objectiveValue_(0.0), sumInfeasibilities_(0.0), branchValue_(0.0), djValue_(0.0), variables_(NULL), newBounds_(NULL), status_(NULL), depth_(depth), numberChangedBounds_(0), numberInfeasibilities_(0), problemStatus_(0), branchVariable_(0) { const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); numberChangedBounds_ = 0; int numberColumns = solver->getNumCols(); int i; for (i = 0; i < numberColumns; i++) { if (lower[i] != lastLower[i]) numberChangedBounds_++; if (upper[i] != lastUpper[i]) numberChangedBounds_++; } if (numberChangedBounds_) { newBounds_ = new double [numberChangedBounds_] ; variables_ = new int [numberChangedBounds_] ; numberChangedBounds_ = 0; for (i = 0; i < numberColumns; i++) { if (lower[i] != lastLower[i]) { variables_[numberChangedBounds_] = i; newBounds_[numberChangedBounds_++] = lower[i]; } if (upper[i] != lastUpper[i]) { variables_[numberChangedBounds_] = i | 0x80000000; newBounds_[numberChangedBounds_++] = upper[i]; } #ifdef CBC_DEBUG if (lower[i] != lastLower[i]) { std::cout << "lower on " << i << " changed from " << lastLower[i] << " to " << lower[i] << std::endl ; } if (upper[i] != lastUpper[i]) { std::cout << "upper on " << i << " changed from " << lastUpper[i] << " to " << upper[i] << std::endl ; } #endif } #ifdef CBC_DEBUG std::cout << numberChangedBounds_ << " changed bounds." << std::endl ; #endif } const OsiClpSolverInterface * clpSolver = dynamic_cast (solver); assert (clpSolver); // Do difference // Current basis status_ = clpSolver->getBasis(status); assert (status_->fullBasis()); //status_->print(); } // Copy constructor CbcSubProblem::CbcSubProblem ( const CbcSubProblem & rhs) : objectiveValue_(rhs.objectiveValue_), sumInfeasibilities_(rhs.sumInfeasibilities_), branchValue_(rhs.branchValue_), djValue_(rhs.djValue_), variables_(NULL), newBounds_(NULL), status_(NULL), depth_(rhs.depth_), numberChangedBounds_(rhs.numberChangedBounds_), numberInfeasibilities_(rhs.numberInfeasibilities_), problemStatus_(rhs.problemStatus_), branchVariable_(rhs.branchVariable_) { if (numberChangedBounds_) { variables_ = CoinCopyOfArray(rhs.variables_, numberChangedBounds_); newBounds_ = CoinCopyOfArray(rhs.newBounds_, numberChangedBounds_); } if (rhs.status_) { status_ = new CoinWarmStartBasis(*rhs.status_); } } // Assignment operator CbcSubProblem & CbcSubProblem::operator=( const CbcSubProblem & rhs) { if (this != &rhs) { delete [] variables_; delete [] newBounds_; delete status_; objectiveValue_ = rhs.objectiveValue_; sumInfeasibilities_ = rhs.sumInfeasibilities_; branchValue_ = rhs.branchValue_; djValue_ = rhs.djValue_; depth_ = rhs.depth_; numberChangedBounds_ = rhs.numberChangedBounds_; numberInfeasibilities_ = rhs.numberInfeasibilities_; problemStatus_ = rhs.problemStatus_; branchVariable_ = rhs.branchVariable_; if (numberChangedBounds_) { variables_ = CoinCopyOfArray(rhs.variables_, numberChangedBounds_); newBounds_ = CoinCopyOfArray(rhs.newBounds_, numberChangedBounds_); } else { variables_ = NULL; newBounds_ = NULL; } if (rhs.status_) { status_ = new CoinWarmStartBasis(*rhs.status_); } else { status_ = NULL; } } return *this; } // Take over void CbcSubProblem::takeOver( CbcSubProblem & rhs, bool cleanUp) { if (this != &rhs) { delete [] variables_; delete [] newBounds_; delete status_; objectiveValue_ = rhs.objectiveValue_; sumInfeasibilities_ = rhs.sumInfeasibilities_; branchValue_ = rhs.branchValue_; djValue_ = rhs.djValue_; depth_ = rhs.depth_; numberChangedBounds_ = rhs.numberChangedBounds_; numberInfeasibilities_ = rhs.numberInfeasibilities_; problemStatus_ = rhs.problemStatus_; branchVariable_ = rhs.branchVariable_; variables_ = rhs.variables_; newBounds_ = rhs.newBounds_; rhs.variables_ = NULL; rhs.newBounds_ = NULL; status_ = rhs.status_; rhs.status_ = NULL; if (cleanUp) { delete [] variables_; delete [] newBounds_; variables_ = new int [1]; newBounds_ = new double [1]; // swap way and make only fix numberChangedBounds_=1; if ((problemStatus_&1)==0) { // last way was down newBounds_[0] = ceil(branchValue_); variables_[0] = branchVariable_; } else { // last way was up newBounds_[0] = floor(branchValue_); variables_[0] = branchVariable_ | 0x80000000; } } } } // Destructor CbcSubProblem::~CbcSubProblem () { delete [] variables_; delete [] newBounds_; delete status_; } // Apply subproblem void CbcSubProblem::apply(OsiSolverInterface * solver, int what) const { int i; if ((what&1) != 0) { printf("CbcSubapply depth %d column %d way %d bvalue %g obj %g\n", this->depth_,this->branchVariable_,this->problemStatus_, this->branchValue_,this->objectiveValue_); printf("current bounds %g <= %g <= %g\n",solver->getColLower()[branchVariable_],branchValue_,solver->getColUpper()[branchVariable_]); #ifndef NDEBUG int nSame = 0; #endif for (i = 0; i < numberChangedBounds_; i++) { int variable = variables_[i]; int k = variable & 0x3fffffff; if ((variable&0x80000000) == 0) { // lower bound changing //#define CBC_PRINT2 #ifdef CBC_PRINT2 if (solver->getColLower()[k] != newBounds_[i]) printf("lower change for column %d - from %g to %g\n", k, solver->getColLower()[k], newBounds_[i]); #endif #ifndef NDEBUG if ((variable&0x40000000) == 0 && true) { double oldValue = solver->getColLower()[k]; assert (newBounds_[i] > oldValue - 1.0e-8); if (newBounds_[i] < oldValue + 1.0e-8) { #ifdef CBC_PRINT2 printf("bad null lower change for column %d - bound %g\n", k, oldValue); #endif if (newBounds_[i] == oldValue) nSame++; } } #endif solver->setColLower(k, newBounds_[i]); } else { // upper bound changing #ifdef CBC_PRINT2 if (solver->getColUpper()[k] != newBounds_[i]) printf("upper change for column %d - from %g to %g\n", k, solver->getColUpper()[k], newBounds_[i]); #endif #ifndef NDEBUG if ((variable&0x40000000) == 0 && true) { double oldValue = solver->getColUpper()[k]; assert (newBounds_[i] < oldValue + 1.0e-8); if (newBounds_[i] > oldValue - 1.0e-8) { #ifdef CBC_PRINT2 printf("bad null upper change for column %d - bound %g\n", k, oldValue); #endif if (newBounds_[i] == oldValue) nSame++; } } #endif solver->setColUpper(k, newBounds_[i]); } } #ifndef NDEBUG #ifdef CBC_PRINT2 if (nSame && (nSame < numberChangedBounds_ || (what&3) != 3)) printf("%d changes out of %d redundant %d\n", nSame, numberChangedBounds_, what); else if (numberChangedBounds_ && what == 7 && !nSame) printf("%d good changes %d\n", numberChangedBounds_, what); #endif #endif printf("new bounds %g <= %g <= %g\n",solver->getColLower()[branchVariable_],branchValue_,solver->getColUpper()[branchVariable_]); } #ifdef JJF_ZERO if ((what&2) != 0) { OsiClpSolverInterface * clpSolver = dynamic_cast (solver); assert (clpSolver); //assert (clpSolver->getNumRows()==numberRows_); //clpSolver->setBasis(*status_); // Current basis CoinWarmStartBasis * basis = clpSolver->getPointerToWarmStart(); printf("BBBB\n"); basis->print(); assert (basis->fullBasis()); basis->applyDiff(status_); printf("diff applied %x\n", status_); printf("CCCC\n"); basis->print(); assert (basis->fullBasis()); #ifndef NDEBUG if (!basis->fullBasis()) printf("Debug this basis!!\n"); #endif clpSolver->setBasis(*basis); } #endif if ((what&8) != 0) { OsiClpSolverInterface * clpSolver = dynamic_cast (solver); assert (clpSolver); clpSolver->setBasis(*status_); if ((what&16)==0) { delete status_; status_ = NULL; } } } CoinMP-1.8.3/Cbc/src/CbcBranchDefaultDecision.hpp0000644000175000017500000000665312131054770020105 0ustar renerene// $Id: CbcBranchDefaultDecision.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #ifndef CbcBranchDefaultDecision_H #define CbcBranchDefaultDecision_H #include "CbcBranchBase.hpp" /** Branching decision default class This class implements a simple default algorithm (betterBranch()) for choosing a branching variable. */ class CbcBranchDefaultDecision : public CbcBranchDecision { public: // Default Constructor CbcBranchDefaultDecision (); // Copy constructor CbcBranchDefaultDecision ( const CbcBranchDefaultDecision &); virtual ~CbcBranchDefaultDecision(); /// Clone virtual CbcBranchDecision * clone() const; /// Initialize, e.g. before the start of branch selection at a node virtual void initialize(CbcModel * model); /** \brief Compare two branching objects. Return nonzero if \p thisOne is better than \p bestSoFar. The routine compares branches using the values supplied in \p numInfUp and \p numInfDn until a solution is found by search, after which it uses the values supplied in \p changeUp and \p changeDn. The best branching object seen so far and the associated parameter values are remembered in the \c CbcBranchDefaultDecision object. The nonzero return value is +1 if the up branch is preferred, -1 if the down branch is preferred. As the names imply, the assumption is that the values supplied for \p numInfUp and \p numInfDn will be the number of infeasibilities reported by the branching object, and \p changeUp and \p changeDn will be the estimated change in objective. Other measures can be used if desired. Because an \c CbcBranchDefaultDecision object remembers the current best branching candidate (#bestObject_) as well as the values used in the comparison, the parameter \p bestSoFar is redundant, hence unused. */ virtual int betterBranch(CbcBranchingObject * thisOne, CbcBranchingObject * bestSoFar, double changeUp, int numInfUp, double changeDn, int numInfDn); /** Sets or gets best criterion so far */ virtual void setBestCriterion(double value); virtual double getBestCriterion() const; /** \brief Compare N branching objects. Return index of best and sets way of branching in chosen object. This routine is used only after strong branching. */ virtual int bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied, double * changeUp, int * numberInfeasibilitiesUp, double * changeDown, int * numberInfeasibilitiesDown, double objectiveValue) ; private: /// Illegal Assignment operator CbcBranchDefaultDecision & operator=(const CbcBranchDefaultDecision& rhs); /// data /// "best" so far double bestCriterion_; /// Change up for best double bestChangeUp_; /// Number of infeasibilities for up int bestNumberUp_; /// Change down for best double bestChangeDown_; /// Pointer to best branching object CbcBranchingObject * bestObject_; /// Number of infeasibilities for down int bestNumberDown_; }; #endif CoinMP-1.8.3/Cbc/src/config.h.in0000644000175000017500000001047212547035070014624 0ustar renerene/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define to the name of the default solver to be used in cbc-generic in small letters */ #undef CBC_DEFAULT_SOLVER /* SVN revision number of project */ #undef CBC_SVN_REV /* Define to 1 if the SMP version of Cbc should be compiled */ #undef CBC_THREAD /* Version number of project */ #undef CBC_VERSION /* Major Version number of project */ #undef CBC_VERSION_MAJOR /* Minor Version number of project */ #undef CBC_VERSION_MINOR /* Release Version number of project */ #undef CBC_VERSION_RELEASE /* Define to the debug sanity check level (0 is no test) */ #undef COIN_CBC_CHECKLEVEL /* Define to the debug verbosity level (0 is no output) */ #undef COIN_CBC_VERBOSITY /* Define to 1 if the ASL package is available */ #undef COIN_HAS_ASL /* Define to 1 if the Clp package is available */ #undef COIN_HAS_CLP /* Define to 1 if the CoinDepend package is available */ #undef COIN_HAS_COINDEPEND /* Define to 1 if the Cpx package is available */ #undef COIN_HAS_CPX /* Define to 1 if the DyLP package is available */ #undef COIN_HAS_DYLP /* Define to 1 if the Glpk package is available */ #undef COIN_HAS_GLPK /* Define to 1 if the Grb package is available */ #undef COIN_HAS_GRB /* Define to 1 if the Miplib3 package is available */ #undef COIN_HAS_MIPLIB3 /* Define to 1 if the Msk package is available */ #undef COIN_HAS_MSK /* Define to 1 if the Netlib package is available */ #undef COIN_HAS_NETLIB /* Define to 1 if the Nauty package is available */ #undef COIN_HAS_NTY /* Define to 1 if the OsiTests package is available */ #undef COIN_HAS_OSITESTS /* Define to 1 if readline is available */ #undef COIN_HAS_READLINE /* Define to 1 if the Sample package is available */ #undef COIN_HAS_SAMPLE /* Define to 1 if the Spx package is available */ #undef COIN_HAS_SPX /* Define to 1 if the Vol package is available */ #undef COIN_HAS_VOL /* Define to 1 if the Xpr package is available */ #undef COIN_HAS_XPR /* Define to 1 if you have the header file. */ #undef HAVE_CFLOAT /* Define to 1 if you have the header file. */ #undef HAVE_CIEEEFP /* Define if clock_gettime and rt library is available */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the header file. */ #undef HAVE_CMATH /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the header file. */ #undef HAVE_IEEEFP_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_READLINE_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* define to the name of the default solver interface class, e.g., OsiClpSolverInterface */ #undef OSICBC_DFLT_SOLVER /* define this symbol if clp is the default solver */ #undef OSICBC_DFLT_SOLVER_CLP /* define to the name of the .hpp file for the default solver interface class, e.g., "OsiClpSolverInterface.hpp" (include quotes) */ #undef OSICBC_DFLT_SOLVER_HPP /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION CoinMP-1.8.3/Cbc/src/CbcBranchCut.cpp0000644000175000017500000002215011510742604015557 0ustar renerene/* $Id: CbcBranchCut.cpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchCut.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" /** Default Constructor */ CbcBranchCut::CbcBranchCut () : CbcObject() { } /* Constructor so model can be passed up */ CbcBranchCut::CbcBranchCut (CbcModel * model) : CbcObject(model) { } // Copy constructor CbcBranchCut::CbcBranchCut ( const CbcBranchCut & rhs) : CbcObject(rhs) { } // Clone CbcObject * CbcBranchCut::clone() const { return new CbcBranchCut(*this); } // Assignment operator CbcBranchCut & CbcBranchCut::operator=( const CbcBranchCut& /*rhs*/) { return *this; } // Destructor CbcBranchCut::~CbcBranchCut () { } double CbcBranchCut::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { throw CoinError("Use of base class", "infeasibility", "CbcBranchCut"); preferredWay = -1; return 0.0; } // This looks at solution and sets bounds to contain solution /** More precisely: it first forces the variable within the existing bounds, and then tightens the bounds to fix the variable at the nearest integer value. */ void CbcBranchCut::feasibleRegion() { } /* Return true if branch created by object should fix variables */ bool CbcBranchCut::boundBranch() const { return false; } CbcBranchingObject * CbcBranchCut::createCbcBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * /*info*/, int /*way*/) { throw CoinError("Use of base class", "createCbcBranch", "CbcBranchCut"); return new CbcCutBranchingObject(); } /* Given valid solution (i.e. satisfied) and reduced costs etc returns a branching object which would give a new feasible point in direction reduced cost says would be cheaper. If no feasible point returns null */ CbcBranchingObject * CbcBranchCut::preferredNewFeasible() const { throw CoinError("Use of base class", "preferredNewFeasible", "CbcBranchCut"); return new CbcCutBranchingObject(); } /* Given valid solution (i.e. satisfied) and reduced costs etc returns a branching object which would give a new feasible point in direction opposite to one reduced cost says would be cheaper. If no feasible point returns null */ CbcBranchingObject * CbcBranchCut::notPreferredNewFeasible() const { throw CoinError("Use of base class", "notPreferredNewFeasible", "CbcBranchCut"); return new CbcCutBranchingObject(); } /* Bounds may be tightened, so it may be good to be able to refresh the local copy of the original bounds. */ void CbcBranchCut::resetBounds() { } // Default Constructor CbcCutBranchingObject::CbcCutBranchingObject() : CbcBranchingObject() { down_ = OsiRowCut(); up_ = OsiRowCut(); canFix_ = false; } // Useful constructor CbcCutBranchingObject::CbcCutBranchingObject (CbcModel * model, OsiRowCut & down, OsiRowCut &up, bool canFix) : CbcBranchingObject(model, 0, -1, 0.0) { down_ = down; up_ = up; canFix_ = canFix; } // Copy constructor CbcCutBranchingObject::CbcCutBranchingObject ( const CbcCutBranchingObject & rhs) : CbcBranchingObject(rhs) { down_ = rhs.down_; up_ = rhs.up_; canFix_ = rhs.canFix_; } // Assignment operator CbcCutBranchingObject & CbcCutBranchingObject::operator=( const CbcCutBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); down_ = rhs.down_; up_ = rhs.up_; canFix_ = rhs.canFix_; } return *this; } CbcBranchingObject * CbcCutBranchingObject::clone() const { return (new CbcCutBranchingObject(*this)); } // Destructor CbcCutBranchingObject::~CbcCutBranchingObject () { } /* Perform a branch by adjusting bounds and/or adding a cut. Note that each arm of the branch advances the object to the next arm by advancing the value of way_. Returns change in guessed objective on next branch */ double CbcCutBranchingObject::branch() { decrementNumberBranchesLeft(); OsiRowCut * cut; if (way_ < 0) { cut = &down_; way_ = 1; } else { cut = &up_; way_ = -1; // Swap direction } printf("CUT %s ", (way_ == -1) ? "up" : "down"); cut->print(); // See if cut just fixes variables double lb = cut->lb(); double ub = cut->ub(); int n = cut->row().getNumElements(); const int * column = cut->row().getIndices(); const double * element = cut->row().getElements(); OsiSolverInterface * solver = model_->solver(); const double * upper = solver->getColUpper(); const double * lower = solver->getColLower(); double low = 0.0; double high = 0.0; for (int i = 0; i < n; i++) { int iColumn = column[i]; double value = element[i]; if (value > 0.0) { high += upper[iColumn] * value; low += lower[iColumn] * value; } else { high += lower[iColumn] * value; low += upper[iColumn] * value; } } // leave as cut //model_->setNextRowCut(*cut); //return 0.0; // assume cut was cunningly constructed so we need not worry too much about tolerances if (low + 1.0e-8 >= ub && canFix_) { // fix for (int i = 0; i < n; i++) { int iColumn = column[i]; double value = element[i]; if (value > 0.0) { solver->setColUpper(iColumn, lower[iColumn]); } else { solver->setColLower(iColumn, upper[iColumn]); } } } else if (high - 1.0e-8 <= lb && canFix_) { // fix for (int i = 0; i < n; i++) { int iColumn = column[i]; double value = element[i]; if (value > 0.0) { solver->setColLower(iColumn, upper[iColumn]); } else { solver->setColUpper(iColumn, lower[iColumn]); } } } else { // leave as cut model_->setNextRowCut(*cut); } return 0.0; } // Print what would happen void CbcCutBranchingObject::print() { OsiRowCut * cut; if (way_ < 0) { cut = &down_; printf("CbcCut would branch down"); } else { cut = &up_; printf("CbcCut would branch up"); } double lb = cut->lb(); double ub = cut->ub(); int n = cut->row().getNumElements(); const int * column = cut->row().getIndices(); const double * element = cut->row().getElements(); if (n > 5) { printf(" - %d elements, lo=%g, up=%g\n", n, lb, ub); } else { printf(" - %g <=", lb); for (int i = 0; i < n; i++) { int iColumn = column[i]; double value = element[i]; printf(" (%d,%g)", iColumn, value); } printf(" <= %g\n", ub); } } // Return true if branch should fix variables bool CbcCutBranchingObject::boundBranch() const { return false; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcCutBranchingObject::compareOriginalObject (const CbcBranchingObject* brObj) const { const CbcCutBranchingObject* br = dynamic_cast(brObj); assert(br); const OsiRowCut& r0 = way_ == -1 ? down_ : up_; const OsiRowCut& r1 = br->way_ == -1 ? br->down_ : br->up_; return r0.row().compare(r1.row()); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcCutBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap) { const CbcCutBranchingObject* br = dynamic_cast(brObj); assert(br); OsiRowCut& r0 = way_ == -1 ? down_ : up_; const OsiRowCut& r1 = br->way_ == -1 ? br->down_ : br->up_; double thisBd[2]; thisBd[0] = r0.lb(); thisBd[1] = r0.ub(); double otherBd[2]; otherBd[0] = r1.lb(); otherBd[1] = r1.ub(); CbcRangeCompare comp = CbcCompareRanges(thisBd, otherBd, replaceIfOverlap); if (comp != CbcRangeOverlap || (comp == CbcRangeOverlap && !replaceIfOverlap)) { return comp; } r0.setLb(thisBd[0]); r0.setUb(thisBd[1]); return comp; } CoinMP-1.8.3/Cbc/src/CbcLinked.cpp0000644000175000017500000115707712131054770015136 0ustar renerene/* $Id: CbcLinked.cpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CbcConfig.h" #include "CoinTime.hpp" #include "CoinHelperFunctions.hpp" #include "CoinModel.hpp" #include "ClpSimplex.hpp" // returns jColumn (-2 if linear term, -1 if unknown) and coefficient static int decodeBit(char * phrase, char * & nextPhrase, double & coefficient, bool ifFirst, const CoinModel & model) { char * pos = phrase; // may be leading - (or +) char * pos2 = pos; double value = 1.0; if (*pos2 == '-' || *pos2 == '+') pos2++; // next terminator * or + or - while (*pos2) { if (*pos2 == '*') { break; } else if (*pos2 == '-' || *pos2 == '+') { if (pos2 == pos || *(pos2 - 1) != 'e') break; } pos2++; } // if * must be number otherwise must be name if (*pos2 == '*') { char * pos3 = pos; while (pos3 != pos2) { pos3++; #ifndef NDEBUG char x = *(pos3 - 1); assert ((x >= '0' && x <= '9') || x == '.' || x == '+' || x == '-' || x == 'e'); #endif } char saved = *pos2; *pos2 = '\0'; value = atof(pos); *pos2 = saved; // and down to next pos2++; pos = pos2; while (*pos2) { if (*pos2 == '-' || *pos2 == '+') break; pos2++; } } char saved = *pos2; *pos2 = '\0'; // now name // might have + or - if (*pos == '+') { pos++; } else if (*pos == '-') { pos++; assert (value == 1.0); value = - value; } int jColumn = model.column(pos); // must be column unless first when may be linear term if (jColumn < 0) { if (ifFirst) { char * pos3 = pos; while (pos3 != pos2) { pos3++; #ifndef NDEBUG char x = *(pos3 - 1); assert ((x >= '0' && x <= '9') || x == '.' || x == '+' || x == '-' || x == 'e'); #endif } assert(*pos2 == '\0'); // keep possible - value = value * atof(pos); jColumn = -2; } else { // bad *pos2 = saved; printf("bad nonlinear term %s\n", phrase); abort(); } } *pos2 = saved; pos = pos2; coefficient = value; nextPhrase = pos; return jColumn; } #include "ClpQuadraticObjective.hpp" #include #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcLinked.hpp" #include "CoinIndexedVector.hpp" #include "CoinMpsIO.hpp" //#include "OsiSolverLink.hpp" //#include "OsiBranchLink.hpp" #include "ClpPackedMatrix.hpp" #include "CoinTime.hpp" #include "CbcModel.hpp" #include "CbcCutGenerator.hpp" #include "CglStored.hpp" #include "CglPreProcess.hpp" #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglRedSplit.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding2.hpp" #include "CglTwomir.hpp" #include "CglDuplicateRow.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcHeuristic.hpp" #include "CbcHeuristicLocal.hpp" #include "CbcHeuristicGreedy.hpp" #include "ClpLinearObjective.hpp" #include "CbcBranchActual.hpp" #include "CbcCompareActual.hpp" //############################################################################# // Solve methods //############################################################################# void OsiSolverLink::initialSolve() { //writeMps("yy"); //exit(77); specialOptions_ = 0; modelPtr_->setWhatsChanged(0); if (numberVariables_) { CoinPackedMatrix * temp = new CoinPackedMatrix(*matrix_); // update all bounds before coefficients for (int i = 0; i < numberVariables_; i++ ) { info_[i].updateBounds(modelPtr_); } int updated = updateCoefficients(modelPtr_, temp); if (updated || 1) { temp->removeGaps(1.0e-14); ClpMatrixBase * save = modelPtr_->clpMatrix(); ClpPackedMatrix * clpMatrix = dynamic_cast (save); assert (clpMatrix); if (save->getNumRows() > temp->getNumRows()) { // add in cuts int numberRows = temp->getNumRows(); int * which = new int[numberRows]; for (int i = 0; i < numberRows; i++) which[i] = i; save->deleteRows(numberRows, which); delete [] which; temp->bottomAppendPackedMatrix(*clpMatrix->matrix()); } modelPtr_->replaceMatrix(temp, true); } else { delete temp; } } if (0) { const double * lower = getColLower(); const double * upper = getColUpper(); int n = 0; for (int i = 84; i < 84 + 16; i++) { if (lower[i] + 0.01 < upper[i]) { n++; } } if (!n) writeMps("sol_query"); } //static int iPass=0; //char temp[50]; //iPass++; //sprintf(temp,"cc%d",iPass); //writeMps(temp); //writeMps("tight"); //exit(33); //printf("wrote cc%d\n",iPass); OsiClpSolverInterface::initialSolve(); int secondaryStatus = modelPtr_->secondaryStatus(); if (modelPtr_->status() == 0 && (secondaryStatus == 2 || secondaryStatus == 4)) modelPtr_->cleanup(1); //if (!isProvenOptimal()) //writeMps("yy"); if (isProvenOptimal() && quadraticModel_ && modelPtr_->numberColumns() == quadraticModel_->numberColumns()) { // see if qp can get better solution const double * solution = modelPtr_->primalColumnSolution(); int numberColumns = modelPtr_->numberColumns(); bool satisfied = true; for (int i = 0; i < numberColumns; i++) { if (isInteger(i)) { double value = solution[i]; if (fabs(value - floor(value + 0.5)) > 1.0e-6) { satisfied = false; break; } } } if (satisfied) { ClpSimplex qpTemp(*quadraticModel_); double * lower = qpTemp.columnLower(); double * upper = qpTemp.columnUpper(); double * lower2 = modelPtr_->columnLower(); double * upper2 = modelPtr_->columnUpper(); for (int i = 0; i < numberColumns; i++) { if (isInteger(i)) { double value = floor(solution[i] + 0.5); lower[i] = value; upper[i] = value; } else { lower[i] = lower2[i]; upper[i] = upper2[i]; } } //qpTemp.writeMps("bad.mps"); //modelPtr_->writeMps("bad2.mps"); //qpTemp.objectiveAsObject()->setActivated(0); //qpTemp.primal(); //qpTemp.objectiveAsObject()->setActivated(1); qpTemp.primal(); //assert (!qpTemp.problemStatus()); if (qpTemp.objectiveValue() < bestObjectiveValue_ - 1.0e-3 && !qpTemp.problemStatus()) { delete [] bestSolution_; bestSolution_ = CoinCopyOfArray(qpTemp.primalColumnSolution(), numberColumns); bestObjectiveValue_ = qpTemp.objectiveValue(); printf("better qp objective of %g\n", bestObjectiveValue_); // If model has stored then add cut (if convex) if (cbcModel_ && (specialOptions2_&4) != 0) { int numberGenerators = cbcModel_->numberCutGenerators(); int iGenerator; cbcModel_->lockThread(); for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = cbcModel_->cutGenerator(iGenerator); CglCutGenerator * gen = generator->generator(); CglStored * gen2 = dynamic_cast (gen); if (gen2) { // add OA cut double offset; double * gradient = new double [numberColumns+1]; memcpy(gradient, qpTemp.objectiveAsObject()->gradient(&qpTemp, bestSolution_, offset, true, 2), numberColumns*sizeof(double)); // assume convex double rhs = 0.0; int * column = new int[numberColumns+1]; int n = 0; for (int i = 0; i < numberColumns; i++) { double value = gradient[i]; if (fabs(value) > 1.0e-12) { gradient[n] = value; rhs += value * solution[i]; column[n++] = i; } } gradient[n] = -1.0; column[n++] = objectiveVariable_; gen2->addCut(-COIN_DBL_MAX, offset + 1.0e-7, n, column, gradient); delete [] gradient; delete [] column; break; } } cbcModel_->unlockThread(); } } } } } //#define WRITE_MATRIX #ifdef WRITE_MATRIX static int xxxxxx = 0; #endif //----------------------------------------------------------------------------- void OsiSolverLink::resolve() { if (false) { bool takeHint; OsiHintStrength strength; // Switch off printing if asked to getHintParam(OsiDoReducePrint, takeHint, strength); if (strength != OsiHintIgnore && takeHint) { printf("no printing\n"); } else { printf("printing\n"); } } specialOptions_ = 0; modelPtr_->setWhatsChanged(0); bool allFixed = numberFix_ > 0; bool feasible = true; if (numberVariables_) { CoinPackedMatrix * temp = new CoinPackedMatrix(*matrix_); //bool best=true; const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); // update all bounds before coefficients for (int i = 0; i < numberVariables_; i++ ) { info_[i].updateBounds(modelPtr_); int iColumn = info_[i].variable(); double lo = lower[iColumn]; double up = upper[iColumn]; if (up < lo) feasible = false; } int updated = updateCoefficients(modelPtr_, temp); if (updated) { temp->removeGaps(1.0e-14); ClpMatrixBase * save = modelPtr_->clpMatrix(); ClpPackedMatrix * clpMatrix = dynamic_cast (save); assert (clpMatrix); if (save->getNumRows() > temp->getNumRows()) { // add in cuts int numberRows = temp->getNumRows(); int * which = new int[numberRows]; for (int i = 0; i < numberRows; i++) which[i] = i; CoinPackedMatrix * mat = clpMatrix->matrix(); // for debug //mat = new CoinPackedMatrix(*mat); mat->deleteRows(numberRows, which); delete [] which; temp->bottomAppendPackedMatrix(*mat); temp->removeGaps(1.0e-14); } modelPtr_->replaceMatrix(temp, true); modelPtr_->setNewRowCopy(NULL); modelPtr_->setClpScaledMatrix(NULL); } else { delete temp; } } #ifdef WRITE_MATRIX { xxxxxx++; char temp[50]; sprintf(temp, "bb%d", xxxxxx); writeMps(temp); printf("wrote bb%d\n", xxxxxx); } #endif if (0) { const double * lower = getColLower(); const double * upper = getColUpper(); int n = 0; for (int i = 60; i < 64; i++) { if (lower[i]) { printf("%d bounds %g %g\n", i, lower[i], upper[i]); n++; } } if (n == 1) printf("just one?\n"); } // check feasible { const double * lower = getColLower(); const double * upper = getColUpper(); int numberColumns = getNumCols(); for (int i = 0; i < numberColumns; i++) { if (lower[i] > upper[i] + 1.0e-12) { feasible = false; break; } } } if (!feasible) allFixed = false; if ((specialOptions2_&1) == 0) allFixed = false; int returnCode = -1; // See if in strong branching int maxIts = modelPtr_->maximumIterations(); if (feasible) { if (maxIts > 10000) { // may do lots of work if ((specialOptions2_&1) != 0) { // see if fixed const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); for (int i = 0; i < numberFix_; i++ ) { int iColumn = fixVariables_[i]; double lo = lower[iColumn]; double up = upper[iColumn]; if (up > lo) { allFixed = false; break; } } returnCode = allFixed ? fathom(allFixed) : 0; } else { returnCode = 0; } } else { returnCode = 0; } } if (returnCode >= 0) { if (returnCode == 0) OsiClpSolverInterface::resolve(); int satisfied = 2; const double * solution = getColSolution(); const double * lower = getColLower(); const double * upper = getColUpper(); int numberColumns2 = coinModel_.numberColumns(); for (int i = 0; i < numberColumns2; i++) { if (isInteger(i)) { double value = solution[i]; if (fabs(value - floor(value + 0.5)) > 1.0e-6) { satisfied = 0; break; } else if (upper[i] > lower[i]) { satisfied = 1; } } } if (isProvenOptimal()) { //if (satisfied==2) //printf("satisfied %d\n",satisfied); if (satisfied && (specialOptions2_&2) != 0) { assert (quadraticModel_); // look at true objective #ifndef NDEBUG double direction = modelPtr_->optimizationDirection(); assert (direction == 1.0); #endif double value = - quadraticModel_->objectiveOffset(); const double * objective = quadraticModel_->objective(); int i; for ( i = 0; i < numberColumns2; i++) value += solution[i] * objective[i]; // and now rest for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { value += obj->xyCoefficient(solution); } } if (value < bestObjectiveValue_ - 1.0e-3) { printf("obj of %g\n", value); //modelPtr_->setDualObjectiveLimit(value); delete [] bestSolution_; bestSolution_ = CoinCopyOfArray(modelPtr_->getColSolution(), modelPtr_->getNumCols()); bestObjectiveValue_ = value; if (maxIts <= 10000 && cbcModel_) { OsiSolverLink * solver2 = dynamic_cast (cbcModel_->solver()); assert (solver2); if (solver2 != this) { // in strong branching - need to store in original solver if (value < solver2->bestObjectiveValue_ - 1.0e-3) { delete [] solver2->bestSolution_; solver2->bestSolution_ = CoinCopyOfArray(bestSolution_, modelPtr_->getNumCols()); solver2->bestObjectiveValue_ = value; } } } // If model has stored then add cut (if convex) if (cbcModel_ && (specialOptions2_&4) != 0 && quadraticModel_) { int numberGenerators = cbcModel_->numberCutGenerators(); int iGenerator; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = cbcModel_->cutGenerator(iGenerator); CglCutGenerator * gen = generator->generator(); CglStored * gen2 = dynamic_cast (gen); if (gen2) { cbcModel_->lockThread(); // add OA cut double offset = 0.0; int numberColumns = quadraticModel_->numberColumns(); double * gradient = new double [numberColumns+1]; // gradient from bilinear int i; CoinZeroN(gradient, numberColumns + 1); //const double * objective = modelPtr_->objective(); assert (objectiveRow_ >= 0); const double * element = originalRowCopy_->getElements(); const int * column2 = originalRowCopy_->getIndices(); const CoinBigIndex * rowStart = originalRowCopy_->getVectorStarts(); //const int * rowLength = originalRowCopy_->getVectorLengths(); //int numberColumns2 = coinModel_.numberColumns(); for ( i = rowStart[objectiveRow_]; i < rowStart[objectiveRow_+1]; i++) gradient[column2[i]] = element[i]; for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { int xColumn = obj->xColumn(); int yColumn = obj->yColumn(); if (xColumn != yColumn) { double coefficient = /* 2.0* */obj->coefficient(); gradient[xColumn] += coefficient * solution[yColumn]; gradient[yColumn] += coefficient * solution[xColumn]; offset += coefficient * solution[xColumn] * solution[yColumn]; } else { double coefficient = obj->coefficient(); gradient[xColumn] += 2.0 * coefficient * solution[yColumn]; offset += coefficient * solution[xColumn] * solution[yColumn]; } } } // assume convex double rhs = 0.0; int * column = new int[numberColumns+1]; int n = 0; for (int i = 0; i < numberColumns; i++) { double value = gradient[i]; if (fabs(value) > 1.0e-12) { gradient[n] = value; rhs += value * solution[i]; column[n++] = i; } } gradient[n] = -1.0; column[n++] = objectiveVariable_; gen2->addCut(-COIN_DBL_MAX, offset + 1.0e-4, n, column, gradient); delete [] gradient; delete [] column; cbcModel_->unlockThread(); break; } } } } } else if (satisfied == 2) { // is there anything left to do? int i; int numberContinuous = 0; double gap = 0.0; for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { if (obj->xMeshSize() < 1.0 && obj->yMeshSize() < 1.0) { numberContinuous++; int xColumn = obj->xColumn(); double gapX = upper[xColumn] - lower[xColumn]; int yColumn = obj->yColumn(); double gapY = upper[yColumn] - lower[yColumn]; gap = CoinMax(gap, CoinMax(gapX, gapY)); } } } if (numberContinuous && 0) { // iterate to get solution and fathom node int numberColumns2 = coinModel_.numberColumns(); double * lower2 = CoinCopyOfArray(getColLower(), numberColumns2); double * upper2 = CoinCopyOfArray(getColUpper(), numberColumns2); while (gap > defaultMeshSize_) { gap *= 0.9; const double * solution = getColSolution(); double newGap = 0.0; for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj && (obj->branchingStrategy()&8) == 0) { if (obj->xMeshSize() < 1.0 && obj->yMeshSize() < 1.0) { numberContinuous++; // need to make sure new xy value in range double xB[3]; double yB[3]; double xybar[4]; obj->getCoefficients(this, xB, yB, xybar); //double xyTrue = obj->xyCoefficient(solution); double xyLambda = 0.0; int firstLambda = obj->firstLambda(); for (int j = 0; j < 4; j++) { xyLambda += solution[firstLambda+j] * xybar[j]; } //printf ("x %d, y %d - true %g lambda %g\n",obj->xColumn(),obj->yColumn(), // xyTrue,xyLambda); int xColumn = obj->xColumn(); double gapX = upper[xColumn] - lower[xColumn]; int yColumn = obj->yColumn(); if (gapX > gap) { double value = solution[xColumn]; double newLower = CoinMax(lower2[xColumn], value - 0.5 * gap); double newUpper = CoinMin(upper2[xColumn], value + 0.5 * gap); if (newUpper - newLower < 0.99*gap) { if (newLower == lower2[xColumn]) newUpper = CoinMin(upper2[xColumn], newLower + gap); else if (newUpper == upper2[xColumn]) newLower = CoinMax(lower2[xColumn], newUpper - gap); } // see if problem #ifndef NDEBUG double lambda[4]; #endif xB[0] = newLower; xB[1] = newUpper; xB[2] = value; yB[2] = solution[yColumn]; xybar[0] = xB[0] * yB[0]; xybar[1] = xB[0] * yB[1]; xybar[2] = xB[1] * yB[0]; xybar[3] = xB[1] * yB[1]; #ifndef NDEBUG double infeasibility = obj->computeLambdas(xB, yB, xybar, lambda); assert (infeasibility < 1.0e-9); #endif setColLower(xColumn, newLower); setColUpper(xColumn, newUpper); } double gapY = upper[yColumn] - lower[yColumn]; if (gapY > gap) { double value = solution[yColumn]; double newLower = CoinMax(lower2[yColumn], value - 0.5 * gap); double newUpper = CoinMin(upper2[yColumn], value + 0.5 * gap); if (newUpper - newLower < 0.99*gap) { if (newLower == lower2[yColumn]) newUpper = CoinMin(upper2[yColumn], newLower + gap); else if (newUpper == upper2[yColumn]) newLower = CoinMax(lower2[yColumn], newUpper - gap); } // see if problem #ifndef NDEBUG double lambda[4]; #endif yB[0] = newLower; yB[1] = newUpper; xybar[0] = xB[0] * yB[0]; xybar[1] = xB[0] * yB[1]; xybar[2] = xB[1] * yB[0]; xybar[3] = xB[1] * yB[1]; #ifndef NDEBUG double infeasibility = obj->computeLambdas(xB, yB, xybar, lambda); assert (infeasibility < 1.0e-9); #endif setColLower(yColumn, newLower); setColUpper(yColumn, newUpper); } newGap = CoinMax(newGap, CoinMax(gapX, gapY)); } } } printf("solving with gap of %g\n", gap); //OsiClpSolverInterface::resolve(); initialSolve(); if (!isProvenOptimal()) break; } delete [] lower2; delete [] upper2; //if (isProvenOptimal()) //writeMps("zz"); } } // ??? - try // But skip if strong branching CbcModel * cbcModel = (modelPtr_->maximumIterations() > 10000) ? cbcModel_ : NULL; if ((specialOptions2_&2) != 0) { // If model has stored then add cut (if convex) // off until I work out problem with ibell3a if (cbcModel && (specialOptions2_&4) != 0 && quadraticModel_) { int numberGenerators = cbcModel_->numberCutGenerators(); int iGenerator; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = cbcModel_->cutGenerator(iGenerator); CglCutGenerator * gen = generator->generator(); CglTemporary * gen2 = dynamic_cast (gen); if (gen2) { double * solution2 = NULL; int numberColumns = quadraticModel_->numberColumns(); int depth = cbcModel_->currentNode() ? cbcModel_->currentNode()->depth() : 0; if (depth < 5) { ClpSimplex qpTemp(*quadraticModel_); double * lower = qpTemp.columnLower(); double * upper = qpTemp.columnUpper(); double * lower2 = modelPtr_->columnLower(); double * upper2 = modelPtr_->columnUpper(); for (int i = 0; i < numberColumns; i++) { lower[i] = lower2[i]; upper[i] = upper2[i]; } qpTemp.setLogLevel(modelPtr_->logLevel()); qpTemp.primal(); assert (!qpTemp.problemStatus()); if (qpTemp.objectiveValue() < bestObjectiveValue_ - 1.0e-3 && !qpTemp.problemStatus()) { solution2 = CoinCopyOfArray(qpTemp.primalColumnSolution(), numberColumns); } else { printf("QP says expensive - kill\n"); modelPtr_->setProblemStatus(1); modelPtr_->setObjectiveValue(COIN_DBL_MAX); break; } } const double * solution = getColSolution(); // add OA cut doAOCuts(gen2, solution, solution); if (solution2) { doAOCuts(gen2, solution, solution2); delete [] solution2; } break; } } } } else if (cbcModel && (specialOptions2_&8) == 8) { // convex and nonlinear in constraints int numberGenerators = cbcModel_->numberCutGenerators(); int iGenerator; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = cbcModel_->cutGenerator(iGenerator); CglCutGenerator * gen = generator->generator(); CglTemporary * gen2 = dynamic_cast (gen); if (gen2) { const double * solution = getColSolution(); const double * rowUpper = getRowUpper(); const double * rowLower = getRowLower(); const double * element = originalRowCopy_->getElements(); const int * column2 = originalRowCopy_->getIndices(); const CoinBigIndex * rowStart = originalRowCopy_->getVectorStarts(); //const int * rowLength = originalRowCopy_->getVectorLengths(); int numberColumns2 = CoinMax(coinModel_.numberColumns(), objectiveVariable_ + 1); double * gradient = new double [numberColumns2]; int * column = new int[numberColumns2]; //const double * columnLower = modelPtr_->columnLower(); //const double * columnUpper = modelPtr_->columnUpper(); cbcModel_->lockThread(); for (int iNon = 0; iNon < numberNonLinearRows_; iNon++) { int iRow = rowNonLinear_[iNon]; bool convex = convex_[iNon] > 0; if (!convex_[iNon]) continue; // can't use this row // add OA cuts double offset = 0.0; // gradient from bilinear int i; CoinZeroN(gradient, numberColumns2); //const double * objective = modelPtr_->objective(); for ( i = rowStart[iRow]; i < rowStart[iRow+1]; i++) gradient[column2[i]] = element[i]; for ( i = startNonLinear_[iNon]; i < startNonLinear_[iNon+1]; i++) { OsiBiLinear * obj = dynamic_cast (object_[whichNonLinear_[i]]); assert (obj); int xColumn = obj->xColumn(); int yColumn = obj->yColumn(); if (xColumn != yColumn) { double coefficient = /* 2.0* */obj->coefficient(); gradient[xColumn] += coefficient * solution[yColumn]; gradient[yColumn] += coefficient * solution[xColumn]; offset += coefficient * solution[xColumn] * solution[yColumn]; } else { double coefficient = obj->coefficient(); gradient[xColumn] += 2.0 * coefficient * solution[yColumn]; offset += coefficient * solution[xColumn] * solution[yColumn]; } } // assume convex double rhs = 0.0; int n = 0; for (int i = 0; i < numberColumns2; i++) { double value = gradient[i]; if (fabs(value) > 1.0e-12) { gradient[n] = value; rhs += value * solution[i]; column[n++] = i; } } if (iRow == objectiveRow_) { gradient[n] = -1.0; assert (objectiveVariable_ >= 0); rhs -= solution[objectiveVariable_]; column[n++] = objectiveVariable_; assert (convex); } else if (convex) { offset += rowUpper[iRow]; } else if (!convex) { offset += rowLower[iRow]; } if (convex && rhs > offset + 1.0e-5) gen2->addCut(-COIN_DBL_MAX, offset + 1.0e-7, n, column, gradient); else if (!convex && rhs < offset - 1.0e-5) gen2->addCut(offset - 1.0e-7, COIN_DBL_MAX, n, column, gradient); } cbcModel_->unlockThread(); delete [] gradient; delete [] column; break; } } } } } else { modelPtr_->setProblemStatus(1); modelPtr_->setObjectiveValue(COIN_DBL_MAX); } } // Do OA cuts int OsiSolverLink::doAOCuts(CglTemporary * cutGen, const double * solution, const double * solution2) { cbcModel_->lockThread(); // add OA cut double offset = 0.0; int numberColumns = quadraticModel_->numberColumns(); double * gradient = new double [numberColumns+1]; // gradient from bilinear int i; CoinZeroN(gradient, numberColumns + 1); //const double * objective = modelPtr_->objective(); assert (objectiveRow_ >= 0); const double * element = originalRowCopy_->getElements(); const int * column2 = originalRowCopy_->getIndices(); const CoinBigIndex * rowStart = originalRowCopy_->getVectorStarts(); //const int * rowLength = originalRowCopy_->getVectorLengths(); //int numberColumns2 = coinModel_.numberColumns(); for ( i = rowStart[objectiveRow_]; i < rowStart[objectiveRow_+1]; i++) gradient[column2[i]] = element[i]; //const double * columnLower = modelPtr_->columnLower(); //const double * columnUpper = modelPtr_->columnUpper(); for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { int xColumn = obj->xColumn(); int yColumn = obj->yColumn(); if (xColumn != yColumn) { double coefficient = /* 2.0* */obj->coefficient(); gradient[xColumn] += coefficient * solution2[yColumn]; gradient[yColumn] += coefficient * solution2[xColumn]; offset += coefficient * solution2[xColumn] * solution2[yColumn]; } else { double coefficient = obj->coefficient(); gradient[xColumn] += 2.0 * coefficient * solution2[yColumn]; offset += coefficient * solution2[xColumn] * solution2[yColumn]; } } } // assume convex double rhs = 0.0; int * column = new int[numberColumns+1]; int n = 0; for (int i = 0; i < numberColumns; i++) { double value = gradient[i]; if (fabs(value) > 1.0e-12) { gradient[n] = value; rhs += value * solution[i]; column[n++] = i; } } gradient[n] = -1.0; assert (objectiveVariable_ >= 0); rhs -= solution[objectiveVariable_]; column[n++] = objectiveVariable_; int returnCode = 0; if (rhs > offset + 1.0e-5) { cutGen->addCut(-COIN_DBL_MAX, offset + 1.0e-7, n, column, gradient); //printf("added cut with %d elements\n",n); returnCode = 1; } delete [] gradient; delete [] column; cbcModel_->unlockThread(); return returnCode; } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiSolverLink::OsiSolverLink () : CbcOsiSolver() { gutsOfDestructor(true); } #ifdef JJF_ZERO /* returns sequence of nonlinear or -1 numeric -2 not found -3 too many terms */ static int getVariable(const CoinModel & model, char * expression, int & linear) { int non = -1; linear = -1; if (strcmp(expression, "Numeric")) { // function char * first = strchr(expression, '*'); int numberColumns = model.numberColumns(); int j; if (first) { *first = '\0'; for (j = 0; j < numberColumns; j++) { if (!strcmp(expression, model.columnName(j))) { linear = j; memmove(expression, first + 1, strlen(first + 1) + 1); break; } } } // find nonlinear for (j = 0; j < numberColumns; j++) { const char * name = model.columnName(j); first = strstr(expression, name); if (first) { if (first != expression && isalnum(*(first - 1))) continue; // not real match first += strlen(name); if (!isalnum(*first)) { // match non = j; // but check no others j++; for (; j < numberColumns; j++) { const char * name = model.columnName(j); first = strstr(expression, name); if (first) { if (isalnum(*(first - 1))) continue; // not real match first += strlen(name); if (!isalnum(*first)) { // match - ouch non = -3; break; } } } break; } } } if (non == -1) non = -2; } return non; } #endif /* This creates from a coinModel object if errors.then number of sets is -1 This creates linked ordered sets information. It assumes - for product terms syntax is yy*f(zz) also just f(zz) is allowed and even a constant modelObject not const as may be changed as part of process. */ OsiSolverLink::OsiSolverLink ( CoinModel & coinModel) : CbcOsiSolver() { gutsOfDestructor(true); load(coinModel); } // need bounds static void fakeBounds(OsiSolverInterface * solver, int column, double maximumValue, CoinModel * model1, CoinModel * model2) { double lo = solver->getColLower()[column]; if (lo < -maximumValue) { solver->setColLower(column, -maximumValue); if (model1) model1->setColLower(column, -maximumValue); if (model2) model2->setColLower(column, -maximumValue); } double up = solver->getColUpper()[column]; if (up > maximumValue) { solver->setColUpper(column, maximumValue); if (model1) model1->setColUpper(column, maximumValue); if (model2) model2->setColUpper(column, maximumValue); } } void OsiSolverLink::load ( CoinModel & coinModelOriginal, bool tightenBounds, int logLevel) { // first check and set up arrays int numberColumns = coinModelOriginal.numberColumns(); int numberRows = coinModelOriginal.numberRows(); // List of nonlinear entries int * which = new int[numberColumns]; numberVariables_ = 0; //specialOptions2_=0; int iColumn; int numberErrors = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinModelLink triple = coinModelOriginal.firstInColumn(iColumn); bool linear = true; int n = 0; // See if quadratic objective const char * expr = coinModelOriginal.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { linear = false; } while (triple.row() >= 0) { int iRow = triple.row(); const char * expr = coinModelOriginal.getElementAsString(iRow, iColumn); if (strcmp(expr, "Numeric")) { linear = false; } triple = coinModelOriginal.next(triple); n++; } if (!linear) { which[numberVariables_++] = iColumn; } } // return if nothing if (!numberVariables_) { delete [] which; coinModel_ = coinModelOriginal; int nInt = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (coinModel_.isInteger(iColumn)) nInt++; } printf("There are %d integers\n", nInt); loadFromCoinModel(coinModelOriginal, true); OsiObject ** objects = new OsiObject * [nInt]; nInt = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (coinModel_.isInteger(iColumn)) { objects[nInt] = new OsiSimpleInteger(this, iColumn); objects[nInt]->setPriority(integerPriority_); nInt++; } } addObjects(nInt, objects); int i; for (i = 0; i < nInt; i++) delete objects[i]; delete [] objects; return; } else { coinModel_ = coinModelOriginal; // arrays for tightening bounds int * freeRow = new int [numberRows]; CoinZeroN(freeRow, numberRows); int * tryColumn = new int [numberColumns]; CoinZeroN(tryColumn, numberColumns); int nBi = 0; int numberQuadratic = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { // See if quadratic objective const char * expr = coinModel_.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { // check if value*x+-value*y.... assert (strlen(expr) < 20000); tryColumn[iColumn] = 1; char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; double linearTerm = 0.0; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel_); // must be column unless first when may be linear term if (jColumn >= 0) { tryColumn[jColumn] = 1; numberQuadratic++; nBi++; } else if (jColumn == -2) { linearTerm = value; } else { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } coinModelOriginal.setObjective(iColumn, linearTerm); } } int iRow; int saveNBi = nBi; for (iRow = 0; iRow < numberRows; iRow++) { CoinModelLink triple = coinModel_.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); const char * el = coinModel_.getElementAsString(iRow, iColumn); if (strcmp("Numeric", el)) { // check if value*x+-value*y.... assert (strlen(el) < 20000); char temp[20000]; strcpy(temp, el); char * pos = temp; bool ifFirst = true; double linearTerm = 0.0; tryColumn[iColumn] = 1; freeRow[iRow] = 1; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel_); // must be column unless first when may be linear term if (jColumn >= 0) { tryColumn[jColumn] = 1; nBi++; } else if (jColumn == -2) { linearTerm = value; } else { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } coinModelOriginal.setElement(iRow, iColumn, linearTerm); } triple = coinModel_.next(triple); } } if (!nBi) exit(1); bool quadraticObjective = false; int nInt = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (coinModel_.isInteger(iColumn)) nInt++; } printf("There are %d bilinear and %d integers\n", nBi, nInt); loadFromCoinModel(coinModelOriginal, true); CoinModel coinModel = coinModelOriginal; if (tightenBounds && numberColumns < 100) { // first fake bounds for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (tryColumn[iColumn]) { fakeBounds(this, iColumn, defaultBound_, &coinModel, &coinModel_); } } ClpSimplex tempModel(*modelPtr_); int nDelete = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (freeRow[iRow]) freeRow[nDelete++] = iRow; } tempModel.deleteRows(nDelete, freeRow); tempModel.setOptimizationDirection(1.0); if (logLevel < 3) { tempModel.setLogLevel(0); tempModel.setSpecialOptions(32768); } double * objective = tempModel.objective(); CoinZeroN(objective, numberColumns); // now up and down double * columnLower = modelPtr_->columnLower(); double * columnUpper = modelPtr_->columnUpper(); const double * solution = tempModel.primalColumnSolution(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (tryColumn[iColumn]) { objective[iColumn] = 1.0; tempModel.primal(1); if (solution[iColumn] > columnLower[iColumn] + 1.0e-3) { double value = solution[iColumn]; if (coinModel_.isInteger(iColumn)) value = ceil(value - 0.9e-3); if (logLevel > 1) printf("lower bound on %d changed from %g to %g\n", iColumn, columnLower[iColumn], value); columnLower[iColumn] = value; coinModel_.setColumnLower(iColumn, value); coinModel.setColumnLower(iColumn, value); } objective[iColumn] = -1.0; tempModel.primal(1); if (solution[iColumn] < columnUpper[iColumn] - 1.0e-3) { double value = solution[iColumn]; if (coinModel_.isInteger(iColumn)) value = floor(value + 0.9e-3); if (logLevel > 1) printf("upper bound on %d changed from %g to %g\n", iColumn, columnUpper[iColumn], value); columnUpper[iColumn] = value; coinModel_.setColumnUpper(iColumn, value); coinModel.setColumnUpper(iColumn, value); } objective[iColumn] = 0.0; } } } delete [] freeRow; delete [] tryColumn; CoinBigIndex * startQuadratic = NULL; int * columnQuadratic = NULL; double * elementQuadratic = NULL; if ( saveNBi == nBi) { printf("all bilinearity in objective\n"); specialOptions2_ |= 2; quadraticObjective = true; // save copy as quadratic model quadraticModel_ = new ClpSimplex(*modelPtr_); startQuadratic = new CoinBigIndex [numberColumns+1]; columnQuadratic = new int [numberQuadratic]; elementQuadratic = new double [numberQuadratic]; numberQuadratic = 0; } //if (quadraticObjective||((specialOptions2_&8)!=0&&saveNBi)) { if (saveNBi) { // add in objective as constraint objectiveVariable_ = numberColumns; objectiveRow_ = coinModel.numberRows(); coinModel.addColumn(0, NULL, NULL, -COIN_DBL_MAX, COIN_DBL_MAX, 1.0); int * column = new int[numberColumns+1]; double * element = new double[numberColumns+1]; double * objective = coinModel.objectiveArray(); int n = 0; for (int i = 0; i < numberColumns; i++) { if (objective[i]) { column[n] = i; element[n++] = objective[i]; objective[i] = 0.0; } } column[n] = objectiveVariable_; element[n++] = -1.0; double offset = - coinModel.objectiveOffset(); //assert (!offset); // get sign right if happens printf("***** offset %g\n", offset); coinModel.setObjectiveOffset(0.0); double lowerBound = -COIN_DBL_MAX; coinModel.addRow(n, column, element, lowerBound, offset); delete [] column; delete [] element; } OsiObject ** objects = new OsiObject * [nBi+nInt]; char * marked = new char [numberColumns]; memset(marked, 0, numberColumns); // statistics I-I I-x x-x int stats[3] = {0, 0, 0}; double * sort = new double [nBi]; nBi = nInt; const OsiObject ** justBi = const_cast (objects + nInt); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (quadraticObjective) startQuadratic[iColumn] = numberQuadratic; // See if quadratic objective const char * expr = coinModel_.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { // need bounds fakeBounds(this, iColumn, defaultBound_, &coinModel, &coinModel_); // value*x*y char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel_); // must be column unless first when may be linear term if (jColumn >= 0) { if (quadraticObjective) { columnQuadratic[numberQuadratic] = jColumn; if (jColumn == iColumn) elementQuadratic[numberQuadratic++] = 2.0 * value; // convention else elementQuadratic[numberQuadratic++] = 1.0 * value; // convention } // need bounds fakeBounds(this, jColumn, defaultBound_, &coinModel, &coinModel_); double meshI = coinModel_.isInteger(iColumn) ? 1.0 : 0.0; if (meshI) marked[iColumn] = 1; double meshJ = coinModel_.isInteger(jColumn) ? 1.0 : 0.0; if (meshJ) marked[jColumn] = 1; // stats etc if (meshI) { if (meshJ) stats[0]++; else stats[1]++; } else { if (meshJ) stats[1]++; else stats[2]++; } if (iColumn <= jColumn) sort[nBi-nInt] = iColumn + numberColumns * jColumn; else sort[nBi-nInt] = jColumn + numberColumns * iColumn; if (!meshJ && !meshI) { meshI = defaultMeshSize_; meshJ = 0.0; } OsiBiLinear * newObj = new OsiBiLinear(&coinModel, iColumn, jColumn, objectiveRow_, value, meshI, meshJ, nBi - nInt, justBi); newObj->setPriority(biLinearPriority_); objects[nBi++] = newObj; } else if (jColumn == -2) { } else { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } } // stats printf("There were %d I-I, %d I-x and %d x-x bilinear in objective\n", stats[0], stats[1], stats[2]); if (quadraticObjective) { startQuadratic[numberColumns] = numberQuadratic; quadraticModel_->loadQuadraticObjective(numberColumns, startQuadratic, columnQuadratic, elementQuadratic); delete [] startQuadratic; delete [] columnQuadratic; delete [] elementQuadratic; } for (iRow = 0; iRow < numberRows; iRow++) { CoinModelLink triple = coinModel_.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); const char * el = coinModel_.getElementAsString(iRow, iColumn); if (strcmp("Numeric", el)) { // need bounds fakeBounds(this, iColumn, defaultBound_, &coinModel, &coinModel_); // value*x*y char temp[20000]; strcpy(temp, el); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel_); // must be column unless first when may be linear term if (jColumn >= 0) { // need bounds fakeBounds(this, jColumn, defaultBound_, &coinModel, &coinModel_); double meshI = coinModel_.isInteger(iColumn) ? 1.0 : 0.0; if (meshI) marked[iColumn] = 1; double meshJ = coinModel_.isInteger(jColumn) ? 1.0 : 0.0; if (meshJ) marked[jColumn] = 1; // stats etc if (meshI) { if (meshJ) stats[0]++; else stats[1]++; } else { if (meshJ) stats[1]++; else stats[2]++; } if (iColumn <= jColumn) sort[nBi-nInt] = iColumn + numberColumns * jColumn; else sort[nBi-nInt] = jColumn + numberColumns * iColumn; if (!meshJ && !meshI) { meshI = defaultMeshSize_; meshJ = 0.0; } OsiBiLinear * newObj = new OsiBiLinear(&coinModel, iColumn, jColumn, iRow, value, meshI, meshJ, nBi - nInt, justBi); newObj->setPriority(biLinearPriority_); objects[nBi++] = newObj; } else if (jColumn == -2) { } else { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } triple = coinModel_.next(triple); } } { // stats std::sort(sort, sort + nBi - nInt); int nDiff = 0; double last = -1.0; for (int i = 0; i < nBi - nInt; i++) { if (sort[i] != last) nDiff++; last = sort[i]; } delete [] sort; printf("There were %d I-I, %d I-x and %d x-x bilinear in total of which %d were duplicates\n", stats[0], stats[1], stats[2], nBi - nInt - nDiff); } // reload with all bilinear stuff loadFromCoinModel(coinModel, true); //exit(77); nInt = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (coinModel_.isInteger(iColumn)) { objects[nInt] = new OsiSimpleInteger(this, iColumn); if (marked[iColumn]) objects[nInt]->setPriority(integerPriority_); else objects[nInt]->setPriority(integerPriority_); nInt++; } } nInt = nBi; delete [] marked; if (numberErrors) { // errors gutsOfDestructor(); numberVariables_ = -1; } else { addObjects(nInt, objects); int i; for (i = 0; i < nInt; i++) delete objects[i]; delete [] objects; // Now do dummy bound stuff matrix_ = new CoinPackedMatrix(*getMatrixByCol()); info_ = new OsiLinkedBound [numberVariables_]; for ( i = 0; i < numberVariables_; i++) { info_[i] = OsiLinkedBound(this, which[i], 0, NULL, NULL, NULL); } // Do row copy but just part int numberRows2 = objectiveRow_ >= 0 ? numberRows + 1 : numberRows; int * whichRows = new int [numberRows2]; int * whichColumns = new int [numberColumns]; CoinIotaN(whichRows, numberRows2, 0); CoinIotaN(whichColumns, numberColumns, 0); originalRowCopy_ = new CoinPackedMatrix(*getMatrixByRow(), numberRows2, whichRows, numberColumns, whichColumns); delete [] whichColumns; numberNonLinearRows_ = 0; CoinZeroN(whichRows, numberRows2); for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { int xyRow = obj->xyRow(); assert (xyRow >= 0 && xyRow < numberRows2); // even if obj we should move whichRows[xyRow]++; } } int * pos = new int [numberRows2]; int n = 0; for (i = 0; i < numberRows2; i++) { if (whichRows[i]) { pos[numberNonLinearRows_] = n; n += whichRows[i]; whichRows[i] = numberNonLinearRows_; numberNonLinearRows_++; } else { whichRows[i] = -1; } } startNonLinear_ = new int [numberNonLinearRows_+1]; memcpy(startNonLinear_, pos, numberNonLinearRows_*sizeof(int)); startNonLinear_[numberNonLinearRows_] = n; rowNonLinear_ = new int [numberNonLinearRows_]; convex_ = new int [numberNonLinearRows_]; // do row numbers now numberNonLinearRows_ = 0; for (i = 0; i < numberRows2; i++) { if (whichRows[i] >= 0) { rowNonLinear_[numberNonLinearRows_++] = i; } } whichNonLinear_ = new int [n]; for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { int xyRow = obj->xyRow(); int k = whichRows[xyRow]; int put = pos[k]; pos[k]++; whichNonLinear_[put] = i; } } delete [] pos; delete [] whichRows; analyzeObjects(); } } // See if there are any quadratic bounds int nQ = 0; const CoinPackedMatrix * rowCopy = getMatrixByRow(); //const double * element = rowCopy->getElements(); //const int * column = rowCopy->getIndices(); //const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const double * rowLower = getRowLower(); const double * rowUpper = getRowUpper(); for (int iObject = 0; iObject < numberObjects_; iObject++) { OsiBiLinear * obj = dynamic_cast (object_[iObject]); if (obj) { int xyRow = obj->xyRow(); if (rowLength[xyRow] == 4 && false) { // we have simple bound nQ++; double coefficient = obj->coefficient(); double lo = rowLower[xyRow]; double up = rowUpper[xyRow]; if (coefficient != 1.0) { printf("*** double check code here\n"); if (coefficient < 0.0) { double temp = lo; lo = - up; up = - temp; coefficient = - coefficient; } if (lo > -1.0e20) lo /= coefficient; if (up < 1.0e20) up /= coefficient; setRowLower(xyRow, lo); setRowUpper(xyRow, up); // we also need to change elements in matrix_ } int type = 0; if (lo == up) { // good news type = 3; coefficient = lo; } else if (lo < -1.0e20) { assert (up < 1.0e20); coefficient = up; type = 1; // can we make equality? } else if (up > 1.0e20) { coefficient = lo; type = 2; // can we make equality? } else { // we would need extra code abort(); } obj->setBoundType(type); obj->setCoefficient(coefficient); // can do better if integer? assert (!isInteger(obj->xColumn())); assert (!isInteger(obj->yColumn())); } } } delete [] which; if ((specialOptions2_&16) != 0) addTighterConstraints(); } // Add reformulated bilinear constraints void OsiSolverLink::addTighterConstraints() { // This is first attempt - for now get working on trimloss int numberW = 0; int * xW = new int[numberObjects_]; int * yW = new int[numberObjects_]; // Points to firstlambda int * wW = new int[numberObjects_]; // Coefficient double * alphaW = new double[numberObjects_]; // Objects OsiBiLinear ** objW = new OsiBiLinear * [numberObjects_]; int numberColumns = getNumCols(); int firstLambda = numberColumns; // set up list (better to rethink and do properly as column ordered) int * list = new int[numberColumns]; memset(list, 0, numberColumns*sizeof(int)); int i; for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { //obj->setBranchingStrategy(4); // ***** temp objW[numberW] = obj; xW[numberW] = obj->xColumn(); yW[numberW] = obj->yColumn(); list[xW[numberW]] = 1; list[yW[numberW]] = 1; wW[numberW] = obj->firstLambda(); firstLambda = CoinMin(firstLambda, obj->firstLambda()); alphaW[numberW] = obj->coefficient(); //assert (alphaW[numberW]==1.0); // fix when occurs numberW++; } } int nList = 0; for (i = 0; i < numberColumns; i++) { if (list[i]) list[nList++] = i; } // set up mark array char * mark = new char [firstLambda*firstLambda]; memset(mark, 0, firstLambda*firstLambda); for (i = 0; i < numberW; i++) { int x = xW[i]; int y = yW[i]; mark[x*firstLambda+y] = 1; mark[y*firstLambda+x] = 1; } int numberRows2 = originalRowCopy_->getNumRows(); int * addColumn = new int [numberColumns]; double * addElement = new double [numberColumns]; int * addW = new int [numberColumns]; assert (objectiveRow_ < 0); // fix when occurs for (int iRow = 0; iRow < numberRows2; iRow++) { for (int iList = 0; iList < nList; iList++) { int kColumn = list[iList]; #ifndef NDEBUG const double * columnLower = getColLower(); #endif //const double * columnUpper = getColUpper(); const double * rowLower = getRowLower(); const double * rowUpper = getRowUpper(); const CoinPackedMatrix * rowCopy = getMatrixByRow(); const double * element = rowCopy->getElements(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); CoinBigIndex j; int numberElements = rowLength[iRow]; int n = 0; for (j = rowStart[iRow]; j < rowStart[iRow] + numberElements; j++) { int iColumn = column[j]; if (iColumn >= firstLambda) { // no good n = -1; break; } if (mark[iColumn*firstLambda+kColumn]) n++; } if (n == numberElements) { printf("can add row %d\n", iRow); assert (columnLower[kColumn] >= 0); // might be able to fix n = 0; for (j = rowStart[iRow]; j < rowStart[iRow] + numberElements; j++) { int xColumn = kColumn; int yColumn = column[j]; int k; for (k = 0; k < numberW; k++) { if ((xW[k] == yColumn && yW[k] == xColumn) || (yW[k] == yColumn && xW[k] == xColumn)) break; } assert (k < numberW); if (xW[k] != xColumn) { int temp = xColumn; xColumn = yColumn; yColumn = temp; } addW[n/4] = k; int start = wW[k]; double value = element[j]; for (int kk = 0; kk < 4; kk++) { // Dummy value addElement[n] = value; addColumn[n++] = start + kk; } } addColumn[n++] = kColumn; double lo = rowLower[iRow]; double up = rowUpper[iRow]; if (lo > -1.0e20) { // and tell object for (j = 0; j < n - 1; j += 4) { int iObject = addW[j/4]; objW[iObject]->addExtraRow(matrix_->getNumRows(), addElement[j]); } addElement[n-1] = -lo; if (lo == up) addRow(n, addColumn, addElement, 0.0, 0.0); else addRow(n, addColumn, addElement, 0.0, COIN_DBL_MAX); matrix_->appendRow(n, addColumn, addElement); } if (up<1.0e20 && up>lo) { // and tell object for (j = 0; j < n - 1; j += 4) { int iObject = addW[j/4]; objW[iObject]->addExtraRow(matrix_->getNumRows(), addElement[j]); } addElement[n-1] = -up; addRow(n, addColumn, addElement, -COIN_DBL_MAX, 0.0); matrix_->appendRow(n, addColumn, addElement); } } } } #ifdef JJF_ZERO // possibly do bounds for (int iColumn = 0; iColumn < firstLambda; iColumn++) { for (int iList = 0; iList < nList; iList++) { int kColumn = list[iList]; const double * columnLower = getColLower(); const double * columnUpper = getColUpper(); if (mark[iColumn*firstLambda+kColumn]) { printf("can add column %d\n", iColumn); assert (columnLower[kColumn] >= 0); // might be able to fix int xColumn = kColumn; int yColumn = iColumn; int k; for (k = 0; k < numberW; k++) { if ((xW[k] == yColumn && yW[k] == xColumn) || (yW[k] == yColumn && xW[k] == xColumn)) break; } assert (k < numberW); if (xW[k] != xColumn) { int temp = xColumn; xColumn = yColumn; yColumn = temp; } int start = wW[k]; int n = 0; for (int kk = 0; kk < 4; kk++) { // Dummy value addElement[n] = 1.0e-19; addColumn[n++] = start + kk; } // Tell object about this objW[k]->addExtraRow(matrix_->getNumRows(), 1.0); addColumn[n++] = kColumn; double lo = columnLower[iColumn]; double up = columnUpper[iColumn]; if (lo > -1.0e20) { addElement[n-1] = -lo; if (lo == up) addRow(n, addColumn, addElement, 0.0, 0.0); else addRow(n, addColumn, addElement, 0.0, COIN_DBL_MAX); matrix_->appendRow(n, addColumn, addElement); } if (up<1.0e20 && up>lo) { addElement[n-1] = -up; addRow(n, addColumn, addElement, -COIN_DBL_MAX, 0.0); matrix_->appendRow(n, addColumn, addElement); } } } } #endif delete [] xW; delete [] yW; delete [] wW; delete [] alphaW; delete [] addColumn; delete [] addElement; delete [] addW; delete [] mark; delete [] list; delete [] objW; } // Set all biLinear priorities on x-x variables void OsiSolverLink::setBiLinearPriorities(int value, double meshSize) { OsiObject ** newObject = new OsiObject * [numberObjects_]; int numberOdd = 0; int i; for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { if (obj->xMeshSize() < 1.0 && obj->yMeshSize() < 1.0) { double oldSatisfied = CoinMax(obj->xSatisfied(), obj->ySatisfied()); OsiBiLinear * objNew = new OsiBiLinear(*obj); newObject[numberOdd++] = objNew; objNew->setXSatisfied(0.5*meshSize); obj->setXOtherSatisfied(0.5*meshSize); objNew->setXOtherSatisfied(oldSatisfied); objNew->setXMeshSize(meshSize); objNew->setYSatisfied(0.5*meshSize); obj->setYOtherSatisfied(0.5*meshSize); objNew->setYOtherSatisfied(oldSatisfied); objNew->setYMeshSize(meshSize); objNew->setXYSatisfied(0.25*meshSize); objNew->setPriority(value); objNew->setBranchingStrategy(8); } } } addObjects(numberOdd, newObject); for (i = 0; i < numberOdd; i++) delete newObject[i]; delete [] newObject; } /* Set options and priority on all or some biLinear variables 1 - on I-I 2 - on I-x 4 - on x-x or combinations. -1 means leave (for priority value and strategy value) */ void OsiSolverLink::setBranchingStrategyOnVariables(int strategyValue, int priorityValue, int mode) { int i; for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { bool change = false; if (obj->xMeshSize() < 1.0 && obj->yMeshSize() < 1.0 && (mode&4) != 0) change = true; else if (((obj->xMeshSize() == 1.0 && obj->yMeshSize() < 1.0) || (obj->xMeshSize() < 1.0 && obj->yMeshSize() == 1.0)) && (mode&2) != 0) change = true; else if (obj->xMeshSize() == 1.0 && obj->yMeshSize() == 1.0 && (mode&1) != 0) change = true; else if (obj->xMeshSize() > 1.0 || obj->yMeshSize() > 1.0) abort(); if (change) { if (strategyValue >= 0) obj->setBranchingStrategy(strategyValue); if (priorityValue >= 0) obj->setPriority(priorityValue); } } } } // Say convex (should work it out) void OsiSolverLink::sayConvex(bool convex) { specialOptions2_ |= 4; if (convex_) { for (int iNon = 0; iNon < numberNonLinearRows_; iNon++) { convex_[iNon] = convex ? 1 : -1; } } } // Set all mesh sizes on x-x variables void OsiSolverLink::setMeshSizes(double value) { int i; for ( i = 0; i < numberObjects_; i++) { OsiBiLinear * obj = dynamic_cast (object_[i]); if (obj) { if (obj->xMeshSize() < 1.0 && obj->yMeshSize() < 1.0) { #ifdef JJF_ZERO numberContinuous++; int xColumn = obj->xColumn(); double gapX = upper[xColumn] - lower[xColumn]; int yColumn = obj->yColumn(); double gapY = upper[yColumn] - lower[yColumn]; gap = CoinMax(gap, CoinMax(gapX, gapY)); #endif obj->setMeshSizes(this, value, value); } } } } /* Solves nonlinear problem from CoinModel using SLP - may be used as crash for other algorithms when number of iterations small. Also exits if all problematical variables are changing less than deltaTolerance Returns solution array */ double * OsiSolverLink::nonlinearSLP(int numberPasses, double deltaTolerance) { if (!coinModel_.numberRows()) { printf("Model not set up or nonlinear arrays not created!\n"); return NULL; } // first check and set up arrays int numberColumns = coinModel_.numberColumns(); int numberRows = coinModel_.numberRows(); char * markNonlinear = new char [numberColumns+numberRows]; CoinZeroN(markNonlinear, numberColumns + numberRows); // List of nonlinear entries int * listNonLinearColumn = new int[numberColumns]; // List of nonlinear constraints int * whichRow = new int [numberRows]; CoinZeroN(whichRow, numberRows); int numberNonLinearColumns = 0; int iColumn; CoinModel coinModel = coinModel_; //const CoinModelHash * stringArray = coinModel.stringArray(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinModelLink triple = coinModel.firstInColumn(iColumn); bool linear = true; int n = 0; // See if nonlinear objective const char * expr = coinModel.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { linear = false; // try and see which columns assert (strlen(expr) < 20000); char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel_); // must be column unless first when may be linear term if (jColumn >= 0) { markNonlinear[jColumn] = 1; } else if (jColumn != -2) { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } while (triple.row() >= 0) { int iRow = triple.row(); const char * expr = coinModel.getElementAsString(iRow, iColumn); if (strcmp(expr, "Numeric")) { linear = false; whichRow[iRow]++; // try and see which columns assert (strlen(expr) < 20000); char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel_); // must be column unless first when may be linear term if (jColumn >= 0) { markNonlinear[jColumn] = 1; } else if (jColumn != -2) { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } triple = coinModel.next(triple); n++; } if (!linear) { markNonlinear[iColumn] = 1; } } //int xxxx[]={3,2,0,4,3,0}; //double initialSolution[6]; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (markNonlinear[iColumn]) { // put in something double lower = coinModel.columnLower(iColumn); double upper = CoinMin(coinModel.columnUpper(iColumn), lower + 1000.0); coinModel.associateElement(coinModel.columnName(iColumn), 0.5*(lower + upper)); //coinModel.associateElement(coinModel.columnName(iColumn),xxxx[iColumn]); listNonLinearColumn[numberNonLinearColumns++] = iColumn; //initialSolution[iColumn]=xxxx[iColumn]; } } // if nothing just solve if (!numberNonLinearColumns) { delete [] listNonLinearColumn; delete [] whichRow; delete [] markNonlinear; ClpSimplex tempModel; tempModel.loadProblem(coinModel, true); tempModel.initialSolve(); double * solution = CoinCopyOfArray(tempModel.getColSolution(), numberColumns); return solution; } // Create artificials ClpSimplex tempModel; tempModel.loadProblem(coinModel, true); const double * rowLower = tempModel.rowLower(); const double * rowUpper = tempModel.rowUpper(); bool takeAll = false; int iRow; int numberArtificials = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (whichRow[iRow] || takeAll) { if (rowLower[iRow] > -1.0e30) numberArtificials++; if (rowUpper[iRow] < 1.0e30) numberArtificials++; } } CoinBigIndex * startArtificial = new CoinBigIndex [numberArtificials+1]; int * rowArtificial = new int [numberArtificials]; double * elementArtificial = new double [numberArtificials]; double * objectiveArtificial = new double [numberArtificials]; numberArtificials = 0; startArtificial[0] = 0; double artificialCost = 1.0e9; for (iRow = 0; iRow < numberRows; iRow++) { if (whichRow[iRow] || takeAll) { if (rowLower[iRow] > -1.0e30) { rowArtificial[numberArtificials] = iRow; elementArtificial[numberArtificials] = 1.0; objectiveArtificial[numberArtificials] = artificialCost; numberArtificials++; startArtificial[numberArtificials] = numberArtificials; } if (rowUpper[iRow] < 1.0e30) { rowArtificial[numberArtificials] = iRow; elementArtificial[numberArtificials] = -1.0; objectiveArtificial[numberArtificials] = artificialCost; numberArtificials++; startArtificial[numberArtificials] = numberArtificials; } } } // Get first solution int numberColumnsSmall = numberColumns; ClpSimplex model; model.loadProblem(coinModel, true); model.addColumns(numberArtificials, NULL, NULL, objectiveArtificial, startArtificial, rowArtificial, elementArtificial); double * columnLower = model.columnLower(); double * columnUpper = model.columnUpper(); double * trueLower = new double[numberNonLinearColumns]; double * trueUpper = new double[numberNonLinearColumns]; int jNon; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; trueLower[jNon] = columnLower[iColumn]; trueUpper[jNon] = columnUpper[iColumn]; //columnLower[iColumn]=initialSolution[iColumn]; //columnUpper[iColumn]=initialSolution[iColumn]; } model.initialSolve(); //model.writeMps("bad.mps"); // redo number of columns numberColumns = model.numberColumns(); int * last[3]; double * solution = model.primalColumnSolution(); double * trust = new double[numberNonLinearColumns]; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; trust[jNon] = 0.5; if (solution[iColumn] < trueLower[jNon]) solution[iColumn] = trueLower[jNon]; else if (solution[iColumn] > trueUpper[jNon]) solution[iColumn] = trueUpper[jNon]; } int iPass; double lastObjective = 1.0e31; double * saveSolution = new double [numberColumns]; double * saveRowSolution = new double [numberRows]; memset(saveRowSolution, 0, numberRows*sizeof(double)); double * savePi = new double [numberRows]; double * safeSolution = new double [numberColumns]; unsigned char * saveStatus = new unsigned char[numberRows+numberColumns]; double targetDrop = 1.0e31; //double objectiveOffset; //model.getDblParam(ClpObjOffset,objectiveOffset); // 1 bound up, 2 up, -1 bound down, -2 down, 0 no change for (iPass = 0; iPass < 3; iPass++) { last[iPass] = new int[numberNonLinearColumns]; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) last[iPass][jNon] = 0; } // goodMove +1 yes, 0 no, -1 last was bad - just halve gaps, -2 do nothing int goodMove = -2; char * statusCheck = new char[numberColumns]; double * changeRegion = new double [numberColumns]; int logLevel = 63; double dualTolerance = model.dualTolerance(); double primalTolerance = model.primalTolerance(); int lastGoodMove = 1; for (iPass = 0; iPass < numberPasses; iPass++) { lastGoodMove = goodMove; columnLower = model.columnLower(); columnUpper = model.columnUpper(); solution = model.primalColumnSolution(); double * rowActivity = model.primalRowSolution(); // redo objective ClpSimplex tempModel; // load new values for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; coinModel.associateElement(coinModel.columnName(iColumn), solution[iColumn]); } tempModel.loadProblem(coinModel); double objectiveOffset; tempModel.getDblParam(ClpObjOffset, objectiveOffset); double objValue = -objectiveOffset; const double * objective = tempModel.objective(); for (iColumn = 0; iColumn < numberColumnsSmall; iColumn++) objValue += solution[iColumn] * objective[iColumn]; double * rowActivity2 = tempModel.primalRowSolution(); const double * rowLower2 = tempModel.rowLower(); const double * rowUpper2 = tempModel.rowUpper(); memset(rowActivity2, 0, numberRows*sizeof(double)); tempModel.times(1.0, solution, rowActivity2); for (iRow = 0; iRow < numberRows; iRow++) { if (rowActivity2[iRow] < rowLower2[iRow] - primalTolerance) objValue += (rowLower2[iRow] - rowActivity2[iRow] - primalTolerance) * artificialCost; else if (rowActivity2[iRow] > rowUpper2[iRow] + primalTolerance) objValue -= (rowUpper2[iRow] - rowActivity2[iRow] + primalTolerance) * artificialCost; } double theta = -1.0; double maxTheta = COIN_DBL_MAX; if (objValue <= lastObjective + 1.0e-15*fabs(lastObjective) || !iPass) goodMove = 1; else goodMove = -1; //maxTheta=1.0; if (iPass) { int jNon = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { changeRegion[iColumn] = solution[iColumn] - saveSolution[iColumn]; double alpha = changeRegion[iColumn]; double oldValue = saveSolution[iColumn]; if (markNonlinear[iColumn] == 0) { // linear if (alpha < -1.0e-15) { // variable going towards lower bound double bound = columnLower[iColumn]; oldValue -= bound; if (oldValue + maxTheta*alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / (-alpha)); } } else if (alpha > 1.0e-15) { // variable going towards upper bound double bound = columnUpper[iColumn]; oldValue = bound - oldValue; if (oldValue - maxTheta*alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / alpha); } } } else { // nonlinear if (alpha < -1.0e-15) { // variable going towards lower bound double bound = trueLower[jNon]; oldValue -= bound; if (oldValue + maxTheta*alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / (-alpha)); } } else if (alpha > 1.0e-15) { // variable going towards upper bound double bound = trueUpper[jNon]; oldValue = bound - oldValue; if (oldValue - maxTheta*alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / alpha); } } jNon++; } } // make sure both accurate memset(rowActivity, 0, numberRows*sizeof(double)); model.times(1.0, solution, rowActivity); memset(saveRowSolution, 0, numberRows*sizeof(double)); model.times(1.0, saveSolution, saveRowSolution); for (int iRow = 0; iRow < numberRows; iRow++) { double alpha = rowActivity[iRow] - saveRowSolution[iRow]; double oldValue = saveRowSolution[iRow]; if (alpha < -1.0e-15) { // variable going towards lower bound double bound = rowLower[iRow]; oldValue -= bound; if (oldValue + maxTheta*alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / (-alpha)); } } else if (alpha > 1.0e-15) { // variable going towards upper bound double bound = rowUpper[iRow]; oldValue = bound - oldValue; if (oldValue - maxTheta*alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / alpha); } } } } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) { changeRegion[iColumn] = 0.0; saveSolution[iColumn] = solution[iColumn]; } memcpy(saveRowSolution, rowActivity, numberRows*sizeof(double)); } if (goodMove >= 0) { //theta = CoinMin(theta2,maxTheta); theta = maxTheta; if (theta > 0.0 && theta <= 1.0) { // update solution double lambda = 1.0 - theta; for (iColumn = 0; iColumn < numberColumns; iColumn++) solution[iColumn] = lambda * saveSolution[iColumn] + theta * solution[iColumn]; memset(rowActivity, 0, numberRows*sizeof(double)); model.times(1.0, solution, rowActivity); if (lambda > 0.999) { memcpy(model.dualRowSolution(), savePi, numberRows*sizeof(double)); memcpy(model.statusArray(), saveStatus, numberRows + numberColumns); } // redo rowActivity memset(rowActivity, 0, numberRows*sizeof(double)); model.times(1.0, solution, rowActivity); } } // load new values for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; coinModel.associateElement(coinModel.columnName(iColumn), solution[iColumn]); } double * sol2 = CoinCopyOfArray(model.primalColumnSolution(), numberColumns); unsigned char * status2 = CoinCopyOfArray(model.statusArray(), numberColumns); model.loadProblem(coinModel); model.addColumns(numberArtificials, NULL, NULL, objectiveArtificial, startArtificial, rowArtificial, elementArtificial); memcpy(model.primalColumnSolution(), sol2, numberColumns*sizeof(double)); memcpy(model.statusArray(), status2, numberColumns); delete [] sol2; delete [] status2; columnLower = model.columnLower(); columnUpper = model.columnUpper(); solution = model.primalColumnSolution(); rowActivity = model.primalRowSolution(); int * temp = last[2]; last[2] = last[1]; last[1] = last[0]; last[0] = temp; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; double change = solution[iColumn] - saveSolution[iColumn]; if (change < -1.0e-5) { if (fabs(change + trust[jNon]) < 1.0e-5) temp[jNon] = -1; else temp[jNon] = -2; } else if (change > 1.0e-5) { if (fabs(change - trust[jNon]) < 1.0e-5) temp[jNon] = 1; else temp[jNon] = 2; } else { temp[jNon] = 0; } } // goodMove +1 yes, 0 no, -1 last was bad - just halve gaps, -2 do nothing double maxDelta = 0.0; if (goodMove >= 0) { if (objValue <= lastObjective + 1.0e-15*fabs(lastObjective)) goodMove = 1; else goodMove = 0; } else { maxDelta = 1.0e10; } double maxGap = 0.0; int numberSmaller = 0; int numberSmaller2 = 0; int numberLarger = 0; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; maxDelta = CoinMax(maxDelta, fabs(solution[iColumn] - saveSolution[iColumn])); if (goodMove > 0) { if (last[0][jNon]*last[1][jNon] < 0) { // halve trust[jNon] *= 0.5; numberSmaller2++; } else { if (last[0][jNon] == last[1][jNon] && last[0][jNon] == last[2][jNon]) trust[jNon] = CoinMin(1.5 * trust[jNon], 1.0e6); numberLarger++; } } else if (goodMove != -2 && trust[jNon] > 10.0*deltaTolerance) { trust[jNon] *= 0.2; numberSmaller++; } maxGap = CoinMax(maxGap, trust[jNon]); } #ifdef CLP_DEBUG if (logLevel&32) std::cout << "largest gap is " << maxGap << " " << numberSmaller + numberSmaller2 << " reduced (" << numberSmaller << " badMove ), " << numberLarger << " increased" << std::endl; #endif if (iPass > 10000) { for (jNon = 0; jNon < numberNonLinearColumns; jNon++) trust[jNon] *= 0.0001; } printf("last good %d goodMove %d\n", lastGoodMove, goodMove); if (goodMove > 0) { double drop = lastObjective - objValue; printf("Pass %d, objective %g - drop %g maxDelta %g\n", iPass, objValue, drop, maxDelta); if (iPass > 20 && drop < 1.0e-12*fabs(objValue) && lastGoodMove > 0) drop = 0.999e-4; // so will exit if (maxDelta < deltaTolerance && drop < 1.0e-4 && goodMove && theta<0.99999 && lastGoodMove>0) { if (logLevel > 1) std::cout << "Exiting as maxDelta < tolerance and small drop" << std::endl; break; } } else if (!numberSmaller && iPass > 1) { if (logLevel > 1) std::cout << "Exiting as all gaps small" << std::endl; break; } if (!iPass) goodMove = 1; targetDrop = 0.0; double * r = model.dualColumnSolution(); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); } if (iPass) { // get reduced costs model.matrix()->transposeTimes(savePi, model.dualColumnSolution()); const double * objective = model.objective(); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; double dj = objective[iColumn] - r[iColumn]; r[iColumn] = dj; if (dj < -dualTolerance) targetDrop -= dj * (columnUpper[iColumn] - solution[iColumn]); else if (dj > dualTolerance) targetDrop -= dj * (columnLower[iColumn] - solution[iColumn]); } } else { memset(r, 0, numberColumns*sizeof(double)); } #ifdef JJF_ZERO for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; if (statusCheck[iColumn] == 'L' && r[iColumn] < -1.0e-4) { columnLower[iColumn] = CoinMax(solution[iColumn], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); } else if (statusCheck[iColumn] == 'U' && r[iColumn] > 1.0e-4) { columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn], trueUpper[jNon]); } else { columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); } } #endif if (goodMove > 0) { memcpy(saveSolution, solution, numberColumns*sizeof(double)); memcpy(saveRowSolution, rowActivity, numberRows*sizeof(double)); memcpy(savePi, model.dualRowSolution(), numberRows*sizeof(double)); memcpy(saveStatus, model.statusArray(), numberRows + numberColumns); #ifdef CLP_DEBUG if (logLevel&32) std::cout << "Pass - " << iPass << ", target drop is " << targetDrop << std::endl; #endif lastObjective = objValue; if (targetDrop < CoinMax(1.0e-8, CoinMin(1.0e-6, 1.0e-6*fabs(objValue))) && lastGoodMove && iPass > 3) { if (logLevel > 1) printf("Exiting on target drop %g\n", targetDrop); break; } #ifdef CLP_DEBUG { double * r = model.dualColumnSolution(); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; if (logLevel&32) printf("Trust %d %g - solution %d %g obj %g dj %g state %c - bounds %g %g\n", jNon, trust[jNon], iColumn, solution[iColumn], objective[iColumn], r[iColumn], statusCheck[iColumn], columnLower[iColumn], columnUpper[iColumn]); } } #endif model.scaling(false); model.primal(1); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; printf("%d bounds etc %g %g %g\n", iColumn, columnLower[iColumn], solution[iColumn], columnUpper[iColumn]); } char temp[20]; sprintf(temp, "pass%d.mps", iPass); //model.writeMps(temp); #ifdef CLP_DEBUG if (model.status()) { model.writeMps("xx.mps"); } #endif if (model.status() == 1) { // not feasible ! - backtrack and exit // use safe solution memcpy(solution, safeSolution, numberColumns*sizeof(double)); memcpy(saveSolution, solution, numberColumns*sizeof(double)); memset(rowActivity, 0, numberRows*sizeof(double)); model.times(1.0, solution, rowActivity); memcpy(saveRowSolution, rowActivity, numberRows*sizeof(double)); memcpy(model.dualRowSolution(), savePi, numberRows*sizeof(double)); memcpy(model.statusArray(), saveStatus, numberRows + numberColumns); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); } break; } else { // save in case problems memcpy(safeSolution, solution, numberColumns*sizeof(double)); } goodMove = 1; } else { // bad pass - restore solution #ifdef CLP_DEBUG if (logLevel&32) printf("Backtracking\n"); #endif // load old values for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; coinModel.associateElement(coinModel.columnName(iColumn), saveSolution[iColumn]); } model.loadProblem(coinModel); model.addColumns(numberArtificials, NULL, NULL, objectiveArtificial, startArtificial, rowArtificial, elementArtificial); solution = model.primalColumnSolution(); rowActivity = model.primalRowSolution(); memcpy(solution, saveSolution, numberColumns*sizeof(double)); memcpy(rowActivity, saveRowSolution, numberRows*sizeof(double)); memcpy(model.dualRowSolution(), savePi, numberRows*sizeof(double)); memcpy(model.statusArray(), saveStatus, numberRows + numberColumns); columnLower = model.columnLower(); columnUpper = model.columnUpper(); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = solution[iColumn]; columnUpper[iColumn] = solution[iColumn]; } model.primal(1); //model.writeMps("xx.mps"); iPass--; goodMove = -1; } } // restore solution memcpy(solution, saveSolution, numberColumns*sizeof(double)); delete [] statusCheck; delete [] savePi; delete [] saveStatus; // load new values for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; coinModel.associateElement(coinModel.columnName(iColumn), solution[iColumn]); } double * sol2 = CoinCopyOfArray(model.primalColumnSolution(), numberColumns); unsigned char * status2 = CoinCopyOfArray(model.statusArray(), numberColumns); model.loadProblem(coinModel); model.addColumns(numberArtificials, NULL, NULL, objectiveArtificial, startArtificial, rowArtificial, elementArtificial); memcpy(model.primalColumnSolution(), sol2, numberColumns*sizeof(double)); memcpy(model.statusArray(), status2, numberColumns); delete [] sol2; delete [] status2; columnLower = model.columnLower(); columnUpper = model.columnUpper(); solution = model.primalColumnSolution(); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = CoinMax(solution[iColumn], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn], trueUpper[jNon]); } model.primal(1); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = trueLower[jNon]; columnUpper[iColumn] = trueUpper[jNon]; } delete [] saveSolution; delete [] safeSolution; delete [] saveRowSolution; for (iPass = 0; iPass < 3; iPass++) delete [] last[iPass]; delete [] trust; delete [] trueUpper; delete [] trueLower; delete [] changeRegion; delete [] startArtificial; delete [] rowArtificial; delete [] elementArtificial; delete [] objectiveArtificial; delete [] listNonLinearColumn; delete [] whichRow; delete [] markNonlinear; return CoinCopyOfArray(solution, coinModel.numberColumns()); } /* Solve linearized quadratic objective branch and bound. Return cutoff and OA cut */ double OsiSolverLink::linearizedBAB(CglStored * cut) { double bestObjectiveValue = COIN_DBL_MAX; if (quadraticModel_) { ClpSimplex * qp = new ClpSimplex(*quadraticModel_); // bounds int numberColumns = qp->numberColumns(); double * lower = qp->columnLower(); double * upper = qp->columnUpper(); const double * lower2 = getColLower(); const double * upper2 = getColUpper(); for (int i = 0; i < numberColumns; i++) { lower[i] = CoinMax(lower[i], lower2[i]); upper[i] = CoinMin(upper[i], upper2[i]); } qp->nonlinearSLP(20, 1.0e-5); qp->primal(); OsiSolverLinearizedQuadratic solver2(qp); const double * solution = NULL; // Reduce printout solver2.setHintParam(OsiDoReducePrint, true, OsiHintTry); CbcModel model2(solver2); // Now do requested saves and modifications CbcModel * cbcModel = & model2; OsiSolverInterface * osiModel = model2.solver(); OsiClpSolverInterface * osiclpModel = dynamic_cast< OsiClpSolverInterface*> (osiModel); ClpSimplex * clpModel = osiclpModel->getModelPtr(); // Set changed values CglProbing probing; probing.setMaxProbe(10); probing.setMaxLook(10); probing.setMaxElements(200); probing.setMaxProbeRoot(50); probing.setMaxLookRoot(10); probing.setRowCuts(3); probing.setUsingObjective(true); cbcModel->addCutGenerator(&probing, -1, "Probing", true, false, false, -100, -1, -1); cbcModel->cutGenerator(0)->setTiming(true); CglGomory gomory; gomory.setLimitAtRoot(512); cbcModel->addCutGenerator(&gomory, -98, "Gomory", true, false, false, -100, -1, -1); cbcModel->cutGenerator(1)->setTiming(true); CglKnapsackCover knapsackCover; cbcModel->addCutGenerator(&knapsackCover, -98, "KnapsackCover", true, false, false, -100, -1, -1); cbcModel->cutGenerator(2)->setTiming(true); CglClique clique; clique.setStarCliqueReport(false); clique.setRowCliqueReport(false); clique.setMinViolation(0.1); cbcModel->addCutGenerator(&clique, -98, "Clique", true, false, false, -100, -1, -1); cbcModel->cutGenerator(3)->setTiming(true); CglMixedIntegerRounding2 mixedIntegerRounding2; cbcModel->addCutGenerator(&mixedIntegerRounding2, -98, "MixedIntegerRounding2", true, false, false, -100, -1, -1); cbcModel->cutGenerator(4)->setTiming(true); CglFlowCover flowCover; cbcModel->addCutGenerator(&flowCover, -98, "FlowCover", true, false, false, -100, -1, -1); cbcModel->cutGenerator(5)->setTiming(true); CglTwomir twomir; twomir.setMaxElements(250); cbcModel->addCutGenerator(&twomir, -99, "Twomir", true, false, false, -100, -1, -1); cbcModel->cutGenerator(6)->setTiming(true); // For now - switch off most heuristics (because CglPreProcess is bad with QP) #ifndef JJF_ONE CbcHeuristicFPump heuristicFPump(*cbcModel); heuristicFPump.setWhen(13); heuristicFPump.setMaximumPasses(20); heuristicFPump.setMaximumRetries(7); heuristicFPump.setAbsoluteIncrement(4332.64); cbcModel->addHeuristic(&heuristicFPump); heuristicFPump.setInitialWeight(1); CbcHeuristicLocal heuristicLocal(*cbcModel); heuristicLocal.setSearchType(1); cbcModel->addHeuristic(&heuristicLocal); CbcHeuristicGreedyCover heuristicGreedyCover(*cbcModel); cbcModel->addHeuristic(&heuristicGreedyCover); CbcHeuristicGreedyEquality heuristicGreedyEquality(*cbcModel); cbcModel->addHeuristic(&heuristicGreedyEquality); #endif CbcRounding rounding(*cbcModel); rounding.setHeuristicName("rounding"); cbcModel->addHeuristic(&rounding); cbcModel->setNumberBeforeTrust(5); cbcModel->setSpecialOptions(2); cbcModel->messageHandler()->setLogLevel(1); cbcModel->setMaximumCutPassesAtRoot(-100); cbcModel->setMaximumCutPasses(1); cbcModel->setMinimumDrop(0.05); // For branchAndBound this may help clpModel->defaultFactorizationFrequency(); clpModel->setDualBound(1.0001e+08); clpModel->setPerturbation(50); osiclpModel->setSpecialOptions(193); osiclpModel->messageHandler()->setLogLevel(0); osiclpModel->setIntParam(OsiMaxNumIterationHotStart, 100); osiclpModel->setHintParam(OsiDoReducePrint, true, OsiHintTry); // You can save some time by switching off message building // clpModel->messagesPointer()->setDetailMessages(100,10000,(int *) NULL); // Solve cbcModel->initialSolve(); if (clpModel->tightenPrimalBounds() != 0) { std::cout << "Problem is infeasible - tightenPrimalBounds!" << std::endl; delete qp; return COIN_DBL_MAX; } clpModel->dual(); // clean up cbcModel->initialSolve(); cbcModel->branchAndBound(); OsiSolverLinearizedQuadratic * solver3 = dynamic_cast (model2.solver()); assert (solver3); solution = solver3->bestSolution(); bestObjectiveValue = solver3->bestObjectiveValue(); setBestObjectiveValue(bestObjectiveValue); setBestSolution(solution, solver3->getNumCols()); // if convex if ((specialOptions2()&4) != 0) { if (cbcModel_) cbcModel_->lockThread(); // add OA cut double offset; double * gradient = new double [numberColumns+1]; memcpy(gradient, qp->objectiveAsObject()->gradient(qp, solution, offset, true, 2), numberColumns*sizeof(double)); double rhs = 0.0; int * column = new int[numberColumns+1]; int n = 0; for (int i = 0; i < numberColumns; i++) { double value = gradient[i]; if (fabs(value) > 1.0e-12) { gradient[n] = value; rhs += value * solution[i]; column[n++] = i; } } gradient[n] = -1.0; column[n++] = numberColumns; cut->addCut(-COIN_DBL_MAX, offset + 1.0e-7, n, column, gradient); delete [] gradient; delete [] column; if (cbcModel_) cbcModel_->unlockThread(); } delete qp; printf("obj %g\n", bestObjectiveValue); } return bestObjectiveValue; } /* Solves nonlinear problem from CoinModel using SLP - and then tries to get heuristic solution Returns solution array */ double * OsiSolverLink::heuristicSolution(int numberPasses, double deltaTolerance, int mode) { // get a solution CoinModel tempModel = coinModel_; ClpSimplex * temp = approximateSolution(tempModel, numberPasses, deltaTolerance); int numberColumns = coinModel_.numberColumns(); double * solution = CoinCopyOfArray(temp->primalColumnSolution(), numberColumns); delete temp; if (mode == 0) { return solution; } else if (mode == 2) { const double * lower = getColLower(); const double * upper = getColUpper(); for (int iObject = 0; iObject < numberObjects_; iObject++) { OsiSimpleInteger * obj = dynamic_cast (object_[iObject]); if (obj && (obj->priority() < biLinearPriority_ || biLinearPriority_ <= 0)) { int iColumn = obj->columnNumber(); double value = solution[iColumn]; value = floor(value + 0.5); if (fabs(value - solution[iColumn]) > 0.01) { setColLower(iColumn, CoinMax(lower[iColumn], value - CoinMax(defaultBound_, 0.0))); setColUpper(iColumn, CoinMin(upper[iColumn], value + CoinMax(defaultBound_, 1.0))); } else { // could fix to integer setColLower(iColumn, CoinMax(lower[iColumn], value - CoinMax(defaultBound_, 0.0))); setColUpper(iColumn, CoinMin(upper[iColumn], value + CoinMax(defaultBound_, 0.0))); } } } return solution; } OsiClpSolverInterface newSolver; if (mode == 1) { // round all with priority < biLinearPriority_ setFixedPriority(biLinearPriority_); // ? should we save and restore coin model tempModel = coinModel_; // solve modified problem char * mark = new char[numberColumns]; memset(mark, 0, numberColumns); for (int iObject = 0; iObject < numberObjects_; iObject++) { OsiSimpleInteger * obj = dynamic_cast (object_[iObject]); if (obj && obj->priority() < biLinearPriority_) { int iColumn = obj->columnNumber(); double value = solution[iColumn]; value = ceil(value - 1.0e-7); tempModel.associateElement(coinModel_.columnName(iColumn), value); mark[iColumn] = 1; } OsiBiLinear * objB = dynamic_cast (object_[iObject]); if (objB) { // if one or both continuous then fix one if (objB->xMeshSize() < 1.0) { int xColumn = objB->xColumn(); double value = solution[xColumn]; tempModel.associateElement(coinModel_.columnName(xColumn), value); mark[xColumn] = 1; } else if (objB->yMeshSize() < 1.0) { int yColumn = objB->yColumn(); double value = solution[yColumn]; tempModel.associateElement(coinModel_.columnName(yColumn), value); mark[yColumn] = 1; } } } CoinModel * reOrdered = tempModel.reorder(mark); assert (reOrdered); tempModel = *reOrdered; delete reOrdered; delete [] mark; newSolver.loadFromCoinModel(tempModel, true); for (int iObject = 0; iObject < numberObjects_; iObject++) { OsiSimpleInteger * obj = dynamic_cast (object_[iObject]); if (obj && obj->priority() < biLinearPriority_) { int iColumn = obj->columnNumber(); double value = solution[iColumn]; value = ceil(value - 1.0e-7); newSolver.setColLower(iColumn, value); newSolver.setColUpper(iColumn, value); } OsiBiLinear * objB = dynamic_cast (object_[iObject]); if (objB) { // if one or both continuous then fix one if (objB->xMeshSize() < 1.0) { int xColumn = objB->xColumn(); double value = solution[xColumn]; newSolver.setColLower(xColumn, value); newSolver.setColUpper(xColumn, value); } else if (objB->yMeshSize() < 1.0) { int yColumn = objB->yColumn(); double value = solution[yColumn]; newSolver.setColLower(yColumn, value); newSolver.setColUpper(yColumn, value); } } } } CbcModel model(newSolver); // Now do requested saves and modifications CbcModel * cbcModel = & model; OsiSolverInterface * osiModel = model.solver(); OsiClpSolverInterface * osiclpModel = dynamic_cast< OsiClpSolverInterface*> (osiModel); ClpSimplex * clpModel = osiclpModel->getModelPtr(); CglProbing probing; probing.setMaxProbe(10); probing.setMaxLook(10); probing.setMaxElements(200); probing.setMaxProbeRoot(50); probing.setMaxLookRoot(10); probing.setRowCuts(3); probing.setRowCuts(0); probing.setUsingObjective(true); cbcModel->addCutGenerator(&probing, -1, "Probing", true, false, false, -100, -1, -1); CglGomory gomory; gomory.setLimitAtRoot(512); cbcModel->addCutGenerator(&gomory, -98, "Gomory", true, false, false, -100, -1, -1); CglKnapsackCover knapsackCover; cbcModel->addCutGenerator(&knapsackCover, -98, "KnapsackCover", true, false, false, -100, -1, -1); CglClique clique; clique.setStarCliqueReport(false); clique.setRowCliqueReport(false); clique.setMinViolation(0.1); cbcModel->addCutGenerator(&clique, -98, "Clique", true, false, false, -100, -1, -1); CglMixedIntegerRounding2 mixedIntegerRounding2; cbcModel->addCutGenerator(&mixedIntegerRounding2, -98, "MixedIntegerRounding2", true, false, false, -100, -1, -1); CglFlowCover flowCover; cbcModel->addCutGenerator(&flowCover, -98, "FlowCover", true, false, false, -100, -1, -1); CglTwomir twomir; twomir.setMaxElements(250); cbcModel->addCutGenerator(&twomir, -99, "Twomir", true, false, false, -100, -1, -1); cbcModel->cutGenerator(6)->setTiming(true); CbcHeuristicFPump heuristicFPump(*cbcModel); heuristicFPump.setWhen(1); heuristicFPump.setMaximumPasses(20); heuristicFPump.setDefaultRounding(0.5); cbcModel->addHeuristic(&heuristicFPump); CbcRounding rounding(*cbcModel); cbcModel->addHeuristic(&rounding); CbcHeuristicLocal heuristicLocal(*cbcModel); heuristicLocal.setSearchType(1); cbcModel->addHeuristic(&heuristicLocal); CbcHeuristicGreedyCover heuristicGreedyCover(*cbcModel); cbcModel->addHeuristic(&heuristicGreedyCover); CbcHeuristicGreedyEquality heuristicGreedyEquality(*cbcModel); cbcModel->addHeuristic(&heuristicGreedyEquality); CbcCompareDefault compare; cbcModel->setNodeComparison(compare); cbcModel->setNumberBeforeTrust(5); cbcModel->setSpecialOptions(2); cbcModel->messageHandler()->setLogLevel(1); cbcModel->setMaximumCutPassesAtRoot(-100); cbcModel->setMaximumCutPasses(1); cbcModel->setMinimumDrop(0.05); clpModel->setNumberIterations(1); // For branchAndBound this may help clpModel->defaultFactorizationFrequency(); clpModel->setDualBound(6.71523e+07); clpModel->setPerturbation(50); osiclpModel->setSpecialOptions(193); osiclpModel->messageHandler()->setLogLevel(0); osiclpModel->setIntParam(OsiMaxNumIterationHotStart, 100); osiclpModel->setHintParam(OsiDoReducePrint, true, OsiHintTry); // You can save some time by switching off message building // clpModel->messagesPointer()->setDetailMessages(100,10000,(int *) NULL); // Solve cbcModel->initialSolve(); //double cutoff = model_->getCutoff(); if (!cbcModel_) cbcModel->setCutoff(1.0e50); else cbcModel->setCutoff(cbcModel_->getCutoff()); int saveLogLevel = clpModel->logLevel(); clpModel->setLogLevel(0); #ifndef NDEBUG int returnCode = 0; #endif if (clpModel->tightenPrimalBounds() != 0) { clpModel->setLogLevel(saveLogLevel); #ifndef NDEBUG returnCode = -1; // infeasible//std::cout<<"Problem is infeasible - tightenPrimalBounds!"<writeMps("infeas2.mps"); } else { clpModel->setLogLevel(saveLogLevel); clpModel->dual(); // clean up // compute some things using problem size cbcModel->setMinimumDrop(CoinMin(5.0e-2, fabs(cbcModel->getMinimizationObjValue())*1.0e-3 + 1.0e-4)); if (cbcModel->getNumCols() < 500) cbcModel->setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (cbcModel->getNumCols() < 5000) cbcModel->setMaximumCutPassesAtRoot(100); // use minimum drop else cbcModel->setMaximumCutPassesAtRoot(20); cbcModel->setMaximumCutPasses(1); // Hand coded preprocessing CglPreProcess process; OsiSolverInterface * saveSolver = cbcModel->solver()->clone(); // Tell solver we are in Branch and Cut saveSolver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo) ; // Default set of cut generators CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(3); generator1.setMaxProbeRoot(saveSolver->getNumCols()); generator1.setMaxElements(100); generator1.setMaxLookRoot(50); generator1.setRowCuts(3); // Add in generators process.addCutGenerator(&generator1); process.messageHandler()->setLogLevel(cbcModel->logLevel()); OsiSolverInterface * solver2 = process.preProcessNonDefault(*saveSolver, 0, 10); // Tell solver we are not in Branch and Cut saveSolver->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; if (solver2) solver2->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; if (!solver2) { std::cout << "Pre-processing says infeasible!" << std::endl; delete saveSolver; #ifndef NDEBUG returnCode = -1; #endif } else { std::cout << "processed model has " << solver2->getNumRows() << " rows, " << solver2->getNumCols() << " and " << solver2->getNumElements() << std::endl; // we have to keep solver2 so pass clone solver2 = solver2->clone(); //solver2->writeMps("intmodel"); cbcModel->assignSolver(solver2); cbcModel->initialSolve(); cbcModel->branchAndBound(); // For best solution int numberColumns = newSolver.getNumCols(); if (cbcModel->getMinimizationObjValue() < 1.0e50) { // post process process.postProcess(*cbcModel->solver()); // Solution now back in saveSolver cbcModel->assignSolver(saveSolver); memcpy(cbcModel->bestSolution(), cbcModel->solver()->getColSolution(), numberColumns*sizeof(double)); // put back in original solver newSolver.setColSolution(cbcModel->bestSolution()); } else { delete saveSolver; } } } assert (!returnCode); abort(); return solution; } // Analyze constraints to see which are convex (quadratic) void OsiSolverLink::analyzeObjects() { // space for starts int numberColumns = coinModel_.numberColumns(); int * start = new int [numberColumns+1]; const double * rowLower = getRowLower(); const double * rowUpper = getRowUpper(); for (int iNon = 0; iNon < numberNonLinearRows_; iNon++) { int iRow = rowNonLinear_[iNon]; int numberElements = startNonLinear_[iNon+1] - startNonLinear_[iNon]; // triplet arrays int * iColumn = new int [2*numberElements+1]; int * jColumn = new int [2*numberElements]; double * element = new double [2*numberElements]; int i; int n = 0; for ( i = startNonLinear_[iNon]; i < startNonLinear_[iNon+1]; i++) { OsiBiLinear * obj = dynamic_cast (object_[whichNonLinear_[i]]); assert (obj); int xColumn = obj->xColumn(); int yColumn = obj->yColumn(); double coefficient = obj->coefficient(); if (xColumn != yColumn) { iColumn[n] = xColumn; jColumn[n] = yColumn; element[n++] = coefficient; iColumn[n] = yColumn; jColumn[n] = xColumn; element[n++] = coefficient; } else { iColumn[n] = xColumn; jColumn[n] = xColumn; element[n++] = coefficient; } } // First sort in column order CoinSort_3(iColumn, iColumn + n, jColumn, element); // marker at end iColumn[n] = numberColumns; int lastI = iColumn[0]; // compute starts start[0] = 0; for (i = 1; i < n + 1; i++) { if (iColumn[i] != lastI) { while (lastI < iColumn[i]) { start[lastI+1] = i; lastI++; } lastI = iColumn[i]; } } // -1 unknown, 0 convex, 1 nonconvex int status = -1; int statusNegative = -1; int numberLong = 0; // number with >2 elements for (int k = 0; k < numberColumns; k++) { int first = start[k]; int last = start[k+1]; if (last > first) { int j; double diagonal = 0.0; int whichK = -1; for (j = first; j < last; j++) { if (jColumn[j] == k) { diagonal = element[j]; status = diagonal > 0 ? 0 : 1; statusNegative = diagonal < 0 ? 0 : 1; whichK = (j == first) ? j + 1 : j - 1; break; } } if (last == first + 1) { // just one entry if (!diagonal) { // one off diagonal - not positive semi definite status = 1; statusNegative = 1; } } else if (diagonal) { if (last == first + 2) { // other column and element double otherElement = element[whichK];; int otherColumn = jColumn[whichK]; double otherDiagonal = 0.0; // check 2x2 determinant - unless past and 2 long if (otherColumn > i || start[otherColumn+1] > start[otherColumn] + 2) { for (j = start[otherColumn]; j < start[otherColumn+1]; j++) { if (jColumn[j] == otherColumn) { otherDiagonal = element[j]; break; } } // determinant double determinant = diagonal * otherDiagonal - otherElement * otherElement; if (determinant < -1.0e-12) { // not positive semi definite status = 1; statusNegative = 1; } else if (start[otherColumn+1] > start[otherColumn] + 2 && determinant < 1.0e-12) { // not positive semi definite status = 1; statusNegative = 1; } } } else { numberLong++; } } } } if ((status == 0 || statusNegative == 0) && numberLong) { // need to do more work //printf("Needs more work\n"); } assert (status > 0 || statusNegative > 0); if (!status) { convex_[iNon] = 1; // equality may be ok if (rowUpper[iRow] < 1.0e20) specialOptions2_ |= 8; else convex_[iNon] = 0; } else if (!statusNegative) { convex_[iNon] = -1; // equality may be ok if (rowLower[iRow] > -1.0e20) specialOptions2_ |= 8; else convex_[iNon] = 0; } else { convex_[iNon] = 0; } //printf("Convexity of row %d is %d\n",iRow,convex_[iNon]); delete [] iColumn; delete [] jColumn; delete [] element; } delete [] start; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * OsiSolverLink::clone(bool /*copyData*/) const { //assert (copyData); OsiSolverLink * newModel = new OsiSolverLink(*this); return newModel; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiSolverLink::OsiSolverLink ( const OsiSolverLink & rhs) : OsiSolverInterface(rhs), CbcOsiSolver(rhs) { gutsOfDestructor(true); gutsOfCopy(rhs); // something odd happens - try this OsiSolverInterface::operator=(rhs); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiSolverLink::~OsiSolverLink () { gutsOfDestructor(); } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiSolverLink & OsiSolverLink::operator=(const OsiSolverLink & rhs) { if (this != &rhs) { gutsOfDestructor(); CbcOsiSolver::operator=(rhs); gutsOfCopy(rhs); } return *this; } void OsiSolverLink::gutsOfDestructor(bool justNullify) { if (!justNullify) { delete matrix_; delete originalRowCopy_; delete [] info_; delete [] bestSolution_; delete quadraticModel_; delete [] startNonLinear_; delete [] rowNonLinear_; delete [] convex_; delete [] whichNonLinear_; delete [] fixVariables_; } matrix_ = NULL; originalRowCopy_ = NULL; quadraticModel_ = NULL; numberNonLinearRows_ = 0; startNonLinear_ = NULL; rowNonLinear_ = NULL; convex_ = NULL; whichNonLinear_ = NULL; info_ = NULL; fixVariables_ = NULL; numberVariables_ = 0; specialOptions2_ = 0; objectiveRow_ = -1; objectiveVariable_ = -1; bestSolution_ = NULL; bestObjectiveValue_ = 1.0e100; defaultMeshSize_ = 1.0e-4; defaultBound_ = 1.0e5; integerPriority_ = 1000; biLinearPriority_ = 10000; numberFix_ = 0; } void OsiSolverLink::gutsOfCopy(const OsiSolverLink & rhs) { coinModel_ = rhs.coinModel_; numberVariables_ = rhs.numberVariables_; numberNonLinearRows_ = rhs.numberNonLinearRows_; specialOptions2_ = rhs.specialOptions2_; objectiveRow_ = rhs.objectiveRow_; objectiveVariable_ = rhs.objectiveVariable_; bestObjectiveValue_ = rhs.bestObjectiveValue_; defaultMeshSize_ = rhs.defaultMeshSize_; defaultBound_ = rhs.defaultBound_; integerPriority_ = rhs.integerPriority_; biLinearPriority_ = rhs.biLinearPriority_; numberFix_ = rhs.numberFix_; if (numberVariables_) { if (rhs.matrix_) matrix_ = new CoinPackedMatrix(*rhs.matrix_); else matrix_ = NULL; if (rhs.originalRowCopy_) originalRowCopy_ = new CoinPackedMatrix(*rhs.originalRowCopy_); else originalRowCopy_ = NULL; info_ = new OsiLinkedBound [numberVariables_]; for (int i = 0; i < numberVariables_; i++) { info_[i] = OsiLinkedBound(rhs.info_[i]); } if (rhs.bestSolution_) { bestSolution_ = CoinCopyOfArray(rhs.bestSolution_, modelPtr_->getNumCols()); } else { bestSolution_ = NULL; } } if (numberNonLinearRows_) { startNonLinear_ = CoinCopyOfArray(rhs.startNonLinear_, numberNonLinearRows_ + 1); rowNonLinear_ = CoinCopyOfArray(rhs.rowNonLinear_, numberNonLinearRows_); convex_ = CoinCopyOfArray(rhs.convex_, numberNonLinearRows_); int numberEntries = startNonLinear_[numberNonLinearRows_]; whichNonLinear_ = CoinCopyOfArray(rhs.whichNonLinear_, numberEntries); } if (rhs.quadraticModel_) { quadraticModel_ = new ClpSimplex(*rhs.quadraticModel_); } else { quadraticModel_ = NULL; } fixVariables_ = CoinCopyOfArray(rhs.fixVariables_, numberFix_); } // Add a bound modifier void OsiSolverLink::addBoundModifier(bool upperBoundAffected, bool useUpperBound, int whichVariable, int whichVariableAffected, double multiplier) { bool found = false; int i; for ( i = 0; i < numberVariables_; i++) { if (info_[i].variable() == whichVariable) { found = true; break; } } if (!found) { // add in OsiLinkedBound * temp = new OsiLinkedBound [numberVariables_+1]; for (int i = 0; i < numberVariables_; i++) temp[i] = info_[i]; delete [] info_; info_ = temp; info_[numberVariables_++] = OsiLinkedBound(this, whichVariable, 0, NULL, NULL, NULL); } info_[i].addBoundModifier(upperBoundAffected, useUpperBound, whichVariableAffected, multiplier); } // Update coefficients int OsiSolverLink::updateCoefficients(ClpSimplex * solver, CoinPackedMatrix * matrix) { double * lower = solver->columnLower(); double * upper = solver->columnUpper(); double * objective = solver->objective(); int numberChanged = 0; for (int iObject = 0; iObject < numberObjects_; iObject++) { OsiBiLinear * obj = dynamic_cast (object_[iObject]); if (obj) { numberChanged += obj->updateCoefficients(lower, upper, objective, matrix, &basis_); } } return numberChanged; } // Set best solution found internally void OsiSolverLink::setBestSolution(const double * solution, int numberColumns) { delete [] bestSolution_; int numberColumnsThis = modelPtr_->numberColumns(); bestSolution_ = new double [numberColumnsThis]; CoinZeroN(bestSolution_, numberColumnsThis); memcpy(bestSolution_, solution, CoinMin(numberColumns, numberColumnsThis)*sizeof(double)); } /* Two tier integer problem where when set of variables with priority less than this are fixed the problem becomes an easier integer problem */ void OsiSolverLink::setFixedPriority(int priorityValue) { delete [] fixVariables_; fixVariables_ = NULL; numberFix_ = 0; int i; for ( i = 0; i < numberObjects_; i++) { OsiSimpleInteger * obj = dynamic_cast (object_[i]); if (obj) { #ifndef NDEBUG int iColumn = obj->columnNumber(); assert (iColumn >= 0); #endif if (obj->priority() < priorityValue) numberFix_++; } } if (numberFix_) { specialOptions2_ |= 1; fixVariables_ = new int [numberFix_]; numberFix_ = 0; // need to make sure coinModel_ is correct int numberColumns = coinModel_.numberColumns(); char * highPriority = new char [numberColumns]; CoinZeroN(highPriority, numberColumns); for ( i = 0; i < numberObjects_; i++) { OsiSimpleInteger * obj = dynamic_cast (object_[i]); if (obj) { int iColumn = obj->columnNumber(); assert (iColumn >= 0); if (iColumn < numberColumns) { if (obj->priority() < priorityValue) { object_[i] = new OsiSimpleFixedInteger(*obj); delete obj; fixVariables_[numberFix_++] = iColumn; highPriority[iColumn] = 1; } } } } CoinModel * newModel = coinModel_.reorder(highPriority); if (newModel) { coinModel_ = * newModel; } else { printf("Unable to use priorities\n"); delete [] fixVariables_; fixVariables_ = NULL; numberFix_ = 0; } delete newModel; delete [] highPriority; } } // Gets correct form for a quadratic row - user to delete CoinPackedMatrix * OsiSolverLink::quadraticRow(int rowNumber, double * linearRow) const { int numberColumns = coinModel_.numberColumns(); CoinZeroN(linearRow, numberColumns); int numberElements = 0; #ifndef NDEBUG int numberRows = coinModel_.numberRows(); assert (rowNumber >= 0 && rowNumber < numberRows); #endif CoinModelLink triple = coinModel_.firstInRow(rowNumber); while (triple.column() >= 0) { int iColumn = triple.column(); const char * expr = coinModel_.getElementAsString(rowNumber, iColumn); if (strcmp(expr, "Numeric")) { // try and see which columns assert (strlen(expr) < 20000); char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel_); // must be column unless first when may be linear term if (jColumn >= 0) { numberElements++; } else if (jColumn == -2) { linearRow[iColumn] = value; } else { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } else { linearRow[iColumn] = coinModel_.getElement(rowNumber, iColumn); } triple = coinModel_.next(triple); } if (!numberElements) { return NULL; } else { int * column = new int[numberElements]; int * column2 = new int[numberElements]; double * element = new double[numberElements]; numberElements = 0; CoinModelLink triple = coinModel_.firstInRow(rowNumber); while (triple.column() >= 0) { int iColumn = triple.column(); const char * expr = coinModel_.getElementAsString(rowNumber, iColumn); if (strcmp(expr, "Numeric")) { // try and see which columns assert (strlen(expr) < 20000); char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel_); // must be column unless first when may be linear term if (jColumn >= 0) { column[numberElements] = iColumn; column2[numberElements] = jColumn; element[numberElements++] = value; } else if (jColumn != -2) { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } triple = coinModel_.next(triple); } return new CoinPackedMatrix(true, column2, column, element, numberElements); } } /* Problem specific Returns -1 if node fathomed and no solution 0 if did nothing 1 if node fathomed and solution allFixed is true if all LinkedBound variables are fixed */ int OsiSolverLink::fathom(bool allFixed) { int returnCode = 0; if (allFixed) { // solve anyway OsiClpSolverInterface::resolve(); if (!isProvenOptimal()) { printf("cutoff before fathoming\n"); return -1; } // all fixed so we can reformulate OsiClpSolverInterface newSolver; // set values const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); int i; for (i = 0; i < numberFix_; i++ ) { int iColumn = fixVariables_[i]; double lo = lower[iColumn]; #ifndef NDEBUG double up = upper[iColumn]; assert (lo == up); #endif //printf("column %d fixed to %g\n",iColumn,lo); coinModel_.associateElement(coinModel_.columnName(iColumn), lo); } newSolver.loadFromCoinModel(coinModel_, true); for (i = 0; i < numberFix_; i++ ) { int iColumn = fixVariables_[i]; newSolver.setColLower(iColumn, lower[iColumn]); newSolver.setColUpper(iColumn, lower[iColumn]); } // see if everything with objective fixed const double * objective = modelPtr_->objective(); int numberColumns = newSolver.getNumCols(); bool zeroObjective = true; double sum = 0.0; for (i = 0; i < numberColumns; i++) { if (upper[i] > lower[i] && objective[i]) { zeroObjective = false; break; } else { sum += lower[i] * objective[i]; } } int fake[] = {5, 4, 3, 2, 0, 0, 0}; bool onOptimalPath = true; for (i = 0; i < 7; i++) { if (static_cast (upper[i]) != fake[i]) onOptimalPath = false; } if (onOptimalPath) printf("possible\n"); if (zeroObjective) { // randomize objective ClpSimplex * clpModel = newSolver.getModelPtr(); const double * element = clpModel->matrix()->getMutableElements(); //const int * row = clpModel->matrix()->getIndices(); const CoinBigIndex * columnStart = clpModel->matrix()->getVectorStarts(); const int * columnLength = clpModel->matrix()->getVectorLengths(); double * objective = clpModel->objective(); for (i = 0; i < numberColumns; i++) { if (clpModel->isInteger(i)) { double value = 0.0; for (int j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { value += fabs(element[j]); } objective[i] = value; } } } //newSolver.writeMps("xx"); CbcModel model(newSolver); // Now do requested saves and modifications CbcModel * cbcModel = & model; OsiSolverInterface * osiModel = model.solver(); OsiClpSolverInterface * osiclpModel = dynamic_cast< OsiClpSolverInterface*> (osiModel); ClpSimplex * clpModel = osiclpModel->getModelPtr(); CglProbing probing; probing.setMaxProbe(10); probing.setMaxLook(10); probing.setMaxElements(200); probing.setMaxProbeRoot(50); probing.setMaxLookRoot(10); probing.setRowCuts(3); probing.setRowCuts(0); probing.setUsingObjective(true); cbcModel->addCutGenerator(&probing, -1, "Probing", true, false, false, -100, -1, -1); CglGomory gomory; gomory.setLimitAtRoot(512); cbcModel->addCutGenerator(&gomory, -98, "Gomory", true, false, false, -100, -1, -1); CglKnapsackCover knapsackCover; cbcModel->addCutGenerator(&knapsackCover, -98, "KnapsackCover", true, false, false, -100, -1, -1); CglClique clique; clique.setStarCliqueReport(false); clique.setRowCliqueReport(false); clique.setMinViolation(0.1); cbcModel->addCutGenerator(&clique, -98, "Clique", true, false, false, -100, -1, -1); CglMixedIntegerRounding2 mixedIntegerRounding2; cbcModel->addCutGenerator(&mixedIntegerRounding2, -98, "MixedIntegerRounding2", true, false, false, -100, -1, -1); CglFlowCover flowCover; cbcModel->addCutGenerator(&flowCover, -98, "FlowCover", true, false, false, -100, -1, -1); CglTwomir twomir; twomir.setMaxElements(250); cbcModel->addCutGenerator(&twomir, -99, "Twomir", true, false, false, -100, -1, -1); cbcModel->cutGenerator(6)->setTiming(true); CbcHeuristicFPump heuristicFPump(*cbcModel); heuristicFPump.setWhen(1); heuristicFPump.setMaximumPasses(20); heuristicFPump.setDefaultRounding(0.5); cbcModel->addHeuristic(&heuristicFPump); CbcRounding rounding(*cbcModel); cbcModel->addHeuristic(&rounding); CbcHeuristicLocal heuristicLocal(*cbcModel); heuristicLocal.setSearchType(1); cbcModel->addHeuristic(&heuristicLocal); CbcHeuristicGreedyCover heuristicGreedyCover(*cbcModel); cbcModel->addHeuristic(&heuristicGreedyCover); CbcHeuristicGreedyEquality heuristicGreedyEquality(*cbcModel); cbcModel->addHeuristic(&heuristicGreedyEquality); CbcCompareDefault compare; cbcModel->setNodeComparison(compare); cbcModel->setNumberBeforeTrust(5); cbcModel->setSpecialOptions(2); cbcModel->messageHandler()->setLogLevel(1); cbcModel->setMaximumCutPassesAtRoot(-100); cbcModel->setMaximumCutPasses(1); cbcModel->setMinimumDrop(0.05); clpModel->setNumberIterations(1); // For branchAndBound this may help clpModel->defaultFactorizationFrequency(); clpModel->setDualBound(6.71523e+07); clpModel->setPerturbation(50); osiclpModel->setSpecialOptions(193); osiclpModel->messageHandler()->setLogLevel(0); osiclpModel->setIntParam(OsiMaxNumIterationHotStart, 100); osiclpModel->setHintParam(OsiDoReducePrint, true, OsiHintTry); // You can save some time by switching off message building // clpModel->messagesPointer()->setDetailMessages(100,10000,(int *) NULL); // Solve cbcModel->initialSolve(); //double cutoff = model_->getCutoff(); if (zeroObjective || !cbcModel_) cbcModel->setCutoff(1.0e50); else cbcModel->setCutoff(cbcModel_->getCutoff()); // to change exits bool isFeasible = false; int saveLogLevel = clpModel->logLevel(); clpModel->setLogLevel(0); if (clpModel->tightenPrimalBounds() != 0) { clpModel->setLogLevel(saveLogLevel); returnCode = -1; // infeasible//std::cout<<"Problem is infeasible - tightenPrimalBounds!"<setLogLevel(saveLogLevel); clpModel->dual(); // clean up // compute some things using problem size cbcModel->setMinimumDrop(CoinMin(5.0e-2, fabs(cbcModel->getMinimizationObjValue())*1.0e-3 + 1.0e-4)); if (cbcModel->getNumCols() < 500) cbcModel->setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (cbcModel->getNumCols() < 5000) cbcModel->setMaximumCutPassesAtRoot(100); // use minimum drop else cbcModel->setMaximumCutPassesAtRoot(20); cbcModel->setMaximumCutPasses(1); // Hand coded preprocessing CglPreProcess process; OsiSolverInterface * saveSolver = cbcModel->solver()->clone(); // Tell solver we are in Branch and Cut saveSolver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo) ; // Default set of cut generators CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(3); generator1.setMaxProbeRoot(saveSolver->getNumCols()); generator1.setMaxElements(100); generator1.setMaxLookRoot(50); generator1.setRowCuts(3); // Add in generators process.addCutGenerator(&generator1); process.messageHandler()->setLogLevel(cbcModel->logLevel()); OsiSolverInterface * solver2 = process.preProcessNonDefault(*saveSolver, 0, 10); // Tell solver we are not in Branch and Cut saveSolver->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; if (solver2) solver2->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; if (!solver2) { std::cout << "Pre-processing says infeasible!" << std::endl; delete saveSolver; returnCode = -1; } else { std::cout << "processed model has " << solver2->getNumRows() << " rows, " << solver2->getNumCols() << " and " << solver2->getNumElements() << std::endl; // we have to keep solver2 so pass clone solver2 = solver2->clone(); //solver2->writeMps("intmodel"); cbcModel->assignSolver(solver2); cbcModel->initialSolve(); if (zeroObjective) { cbcModel->setMaximumSolutions(1); // just getting a solution #ifdef JJF_ZERO OsiClpSolverInterface * osiclpModel = dynamic_cast< OsiClpSolverInterface*> (cbcModel->solver()); ClpSimplex * clpModel = osiclpModel->getModelPtr(); const double * element = clpModel->matrix()->getMutableElements(); //const int * row = clpModel->matrix()->getIndices(); const CoinBigIndex * columnStart = clpModel->matrix()->getVectorStarts(); const int * columnLength = clpModel->matrix()->getVectorLengths(); int n = clpModel->numberColumns(); int * sort2 = new int[n]; int * pri = new int[n]; double * sort = new double[n]; int i; int nint = 0; for (i = 0; i < n; i++) { if (clpModel->isInteger(i)) { double largest = 0.0; for (int j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { largest = CoinMax(largest, fabs(element[j])); } sort2[nint] = nint; sort[nint++] = -largest; } } CoinSort_2(sort, sort + nint, sort2); int kpri = 1; double last = sort[0]; for (i = 0; i < nint; i++) { if (sort[i] != last) { kpri++; last = sort[i]; } pri[sort2[i]] = kpri; } cbcModel->passInPriorities(pri, false); delete [] sort; delete [] sort2; delete [] pri; #endif } cbcModel->branchAndBound(); // For best solution int numberColumns = newSolver.getNumCols(); if (cbcModel->getMinimizationObjValue() < 1.0e50) { // post process process.postProcess(*cbcModel->solver()); // Solution now back in saveSolver cbcModel->assignSolver(saveSolver); memcpy(cbcModel->bestSolution(), cbcModel->solver()->getColSolution(), numberColumns*sizeof(double)); // put back in original solver newSolver.setColSolution(cbcModel->bestSolution()); isFeasible = true; } else { delete saveSolver; } } //const double * solution = newSolver.getColSolution(); if (isFeasible && cbcModel->getMinimizationObjValue() < 1.0e50) { int numberColumns = this->getNumCols(); int i; const double * solution = cbcModel->bestSolution(); int numberColumns2 = newSolver.getNumCols(); for (i = 0; i < numberColumns2; i++) { double value = solution[i]; assert (fabs(value - floor(value + 0.5)) < 0.0001); value = floor(value + 0.5); this->setColLower(i, value); this->setColUpper(i, value); } for (; i < numberColumns; i++) { this->setColLower(i, 0.0); this->setColUpper(i, 1.1); } // but take off cuts int numberRows = getNumRows(); int numberRows2 = cbcModel_->continuousSolver()->getNumRows(); for (i = numberRows2; i < numberRows; i++) setRowBounds(i, -COIN_DBL_MAX, COIN_DBL_MAX); initialSolve(); //if (!isProvenOptimal()) //getModelPtr()->writeMps("bad.mps"); if (isProvenOptimal()) { delete [] bestSolution_; bestSolution_ = CoinCopyOfArray(modelPtr_->getColSolution(), modelPtr_->getNumCols()); bestObjectiveValue_ = modelPtr_->objectiveValue(); printf("BB best value %g\n", bestObjectiveValue_); returnCode = 1; } else { printf("*** WHY BAD SOL\n"); returnCode = -1; } } else { modelPtr_->setProblemStatus(1); modelPtr_->setObjectiveValue(COIN_DBL_MAX); returnCode = -1; } } } return returnCode; } //############################################################################# // Constructors, destructors and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiLinkedBound::OsiLinkedBound () { model_ = NULL; variable_ = -1; numberAffected_ = 0; maximumAffected_ = numberAffected_; affected_ = NULL; } // Useful Constructor OsiLinkedBound::OsiLinkedBound(OsiSolverInterface * model, int variable, int numberAffected, const int * positionL, const int * positionU, const double * multiplier) { model_ = model; variable_ = variable; numberAffected_ = 2 * numberAffected; maximumAffected_ = numberAffected_; if (numberAffected_) { affected_ = new boundElementAction[numberAffected_]; int n = 0; for (int i = 0; i < numberAffected; i++) { // LB boundElementAction action; action.affect = 2; action.ubUsed = 0; action.type = 0; action.affected = positionL[i]; action.multiplier = multiplier[i]; affected_[n++] = action; // UB action.affect = 2; action.ubUsed = 1; action.type = 0; action.affected = positionU[i]; action.multiplier = multiplier[i]; affected_[n++] = action; } } else { affected_ = NULL; } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiLinkedBound::OsiLinkedBound ( const OsiLinkedBound & rhs) { model_ = rhs.model_; variable_ = rhs.variable_; numberAffected_ = rhs.numberAffected_; maximumAffected_ = rhs.maximumAffected_; if (numberAffected_) { affected_ = new boundElementAction[maximumAffected_]; memcpy(affected_, rhs.affected_, numberAffected_*sizeof(boundElementAction)); } else { affected_ = NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiLinkedBound::~OsiLinkedBound () { delete [] affected_; } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiLinkedBound & OsiLinkedBound::operator=(const OsiLinkedBound & rhs) { if (this != &rhs) { delete [] affected_; model_ = rhs.model_; variable_ = rhs.variable_; numberAffected_ = rhs.numberAffected_; maximumAffected_ = rhs.maximumAffected_; if (numberAffected_) { affected_ = new boundElementAction[maximumAffected_]; memcpy(affected_, rhs.affected_, numberAffected_*sizeof(boundElementAction)); } else { affected_ = NULL; } } return *this; } // Add a bound modifier void OsiLinkedBound::addBoundModifier(bool upperBoundAffected, bool useUpperBound, int whichVariable, double multiplier) { if (numberAffected_ == maximumAffected_) { maximumAffected_ = maximumAffected_ + 10 + maximumAffected_ / 4; boundElementAction * temp = new boundElementAction[maximumAffected_]; memcpy(temp, affected_, numberAffected_*sizeof(boundElementAction)); delete [] affected_; affected_ = temp; } boundElementAction action; action.affect = static_cast(upperBoundAffected ? 1 : 0); action.ubUsed = static_cast(useUpperBound ? 1 : 0); action.type = 2; action.affected = static_cast(whichVariable); action.multiplier = multiplier; affected_[numberAffected_++] = action; } // Update other bounds void OsiLinkedBound::updateBounds(ClpSimplex * solver) { double * lower = solver->columnLower(); double * upper = solver->columnUpper(); double lo = lower[variable_]; double up = upper[variable_]; // printf("bounds for %d are %g and %g\n",variable_,lo,up); for (int j = 0; j < numberAffected_; j++) { if (affected_[j].affect < 2) { double multiplier = affected_[j].multiplier; assert (affected_[j].type == 2); int iColumn = affected_[j].affected; double useValue = (affected_[j].ubUsed) ? up : lo; if (affected_[j].affect == 0) lower[iColumn] = CoinMin(upper[iColumn], CoinMax(lower[iColumn], multiplier * useValue)); else upper[iColumn] = CoinMax(lower[iColumn], CoinMin(upper[iColumn], multiplier * useValue)); } } } #ifdef JJF_ZERO // Add an element modifier void OsiLinkedBound::addCoefficientModifier(bool useUpperBound, int position, double multiplier) { if (numberAffected_ == maximumAffected_) { maximumAffected_ = maximumAffected_ + 10 + maximumAffected_ / 4; boundElementAction * temp = new boundElementAction[maximumAffected_]; memcpy(temp, affected_, numberAffected_*sizeof(boundElementAction)); delete [] affected_; affected_ = temp; } boundElementAction action; action.affect = 2; action.ubUsed = useUpperBound ? 1 : 0; action.type = 0; action.affected = position; action.multiplier = multiplier; affected_[numberAffected_++] = action; } // Update coefficients void OsiLinkedBound::updateCoefficients(ClpSimplex * solver, CoinPackedMatrix * matrix) { double * lower = solver->columnLower(); double * upper = solver->columnUpper(); double * element = matrix->getMutableElements(); double lo = lower[variable_]; double up = upper[variable_]; // printf("bounds for %d are %g and %g\n",variable_,lo,up); for (int j = 0; j < numberAffected_; j++) { if (affected_[j].affect == 2) { double multiplier = affected_[j].multiplier; assert (affected_[j].type == 0); int position = affected_[j].affected; //double old = element[position]; if (affected_[j].ubUsed) element[position] = multiplier * up; else element[position] = multiplier * lo; //if ( old != element[position]) //printf("change at %d from %g to %g\n",position,old,element[position]); } } } #endif // Default Constructor CbcHeuristicDynamic3::CbcHeuristicDynamic3() : CbcHeuristic() { } // Constructor from model CbcHeuristicDynamic3::CbcHeuristicDynamic3(CbcModel & model) : CbcHeuristic(model) { } // Destructor CbcHeuristicDynamic3::~CbcHeuristicDynamic3 () { } // Clone CbcHeuristic * CbcHeuristicDynamic3::clone() const { return new CbcHeuristicDynamic3(*this); } // Copy constructor CbcHeuristicDynamic3::CbcHeuristicDynamic3(const CbcHeuristicDynamic3 & rhs) : CbcHeuristic(rhs) { } // Returns 1 if solution, 0 if not int CbcHeuristicDynamic3::solution(double & solutionValue, double * betterSolution) { if (!model_) return 0; OsiSolverLink * clpSolver = dynamic_cast (model_->solver()); assert (clpSolver); double newSolutionValue = clpSolver->bestObjectiveValue(); const double * solution = clpSolver->bestSolution(); if (newSolutionValue < solutionValue && solution) { int numberColumns = clpSolver->getNumCols(); // new solution memcpy(betterSolution, solution, numberColumns*sizeof(double)); solutionValue = newSolutionValue; return 1; } else { return 0; } } // update model void CbcHeuristicDynamic3::setModel(CbcModel * model) { model_ = model; } // Resets stuff if model changes void CbcHeuristicDynamic3::resetModel(CbcModel * model) { model_ = model; } #include #include #include //#define CBC_DEBUG #include "OsiSolverInterface.hpp" //#include "OsiBranchLink.hpp" #include "CoinError.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinWarmStartBasis.hpp" // Default Constructor OsiOldLink::OsiOldLink () : OsiSOS(), numberLinks_(0) { } // Useful constructor (which are indices) OsiOldLink::OsiOldLink (const OsiSolverInterface * /*solver*/, int numberMembers, int numberLinks, int first , const double * weights, int /*identifier*/) : OsiSOS(), numberLinks_(numberLinks) { numberMembers_ = numberMembers; members_ = NULL; sosType_ = 1; if (numberMembers_) { weights_ = new double[numberMembers_]; members_ = new int[numberMembers_*numberLinks_]; if (weights) { memcpy(weights_, weights, numberMembers_*sizeof(double)); } else { for (int i = 0; i < numberMembers_; i++) weights_[i] = i; } // weights must be increasing int i; #ifndef NDEBUG for (i = 1; i < numberMembers_; i++) assert (weights_[i] > weights_[i-1] + 1.0e-12); #endif for (i = 0; i < numberMembers_*numberLinks_; i++) { members_[i] = first + i; } } else { weights_ = NULL; } } // Useful constructor (which are indices) OsiOldLink::OsiOldLink (const OsiSolverInterface * /*solver*/, int numberMembers, int numberLinks, int /*sosType*/, const int * which , const double * weights, int /*identifier*/) : OsiSOS(), numberLinks_(numberLinks) { numberMembers_ = numberMembers; members_ = NULL; sosType_ = 1; if (numberMembers_) { weights_ = new double[numberMembers_]; members_ = new int[numberMembers_*numberLinks_]; if (weights) { memcpy(weights_, weights, numberMembers_*sizeof(double)); } else { for (int i = 0; i < numberMembers_; i++) weights_[i] = i; } // weights must be increasing int i; #ifndef NDEBUG for (i = 1; i < numberMembers_; i++) assert (weights_[i] > weights_[i-1] + 1.0e-12); #endif for (i = 0; i < numberMembers_*numberLinks_; i++) { members_[i] = which[i]; } } else { weights_ = NULL; } } // Copy constructor OsiOldLink::OsiOldLink ( const OsiOldLink & rhs) : OsiSOS(rhs) { numberLinks_ = rhs.numberLinks_; if (numberMembers_) { delete [] members_; members_ = CoinCopyOfArray(rhs.members_, numberMembers_ * numberLinks_); } } // Clone OsiObject * OsiOldLink::clone() const { return new OsiOldLink(*this); } // Assignment operator OsiOldLink & OsiOldLink::operator=( const OsiOldLink & rhs) { if (this != &rhs) { OsiSOS::operator=(rhs); delete [] members_; numberLinks_ = rhs.numberLinks_; if (numberMembers_) { members_ = CoinCopyOfArray(rhs.members_, numberMembers_ * numberLinks_); } else { members_ = NULL; } } return *this; } // Destructor OsiOldLink::~OsiOldLink () { } // Infeasibility - large is 0.5 double OsiOldLink::infeasibility(const OsiBranchingInformation * info, int & whichWay) const { int j; int firstNonZero = -1; int lastNonZero = -1; const double * solution = info->solution_; //const double * lower = info->lower_; const double * upper = info->upper_; double integerTolerance = info->integerTolerance_; double weight = 0.0; double sum = 0.0; // check bounds etc double lastWeight = -1.0e100; int base = 0; for (j = 0; j < numberMembers_; j++) { for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; if (lastWeight >= weights_[j] - 1.0e-7) throw CoinError("Weights too close together in OsiLink", "infeasibility", "OsiLink"); lastWeight = weights_[j]; double value = CoinMax(0.0, solution[iColumn]); sum += value; if (value > integerTolerance && upper[iColumn]) { // Possibly due to scaling a fixed variable might slip through if (value > upper[iColumn] + 1.0e-8) { #ifdef OSI_DEBUG printf("** Variable %d (%d) has value %g and upper bound of %g\n", iColumn, j, value, upper[iColumn]); #endif } value = CoinMin(value, upper[iColumn]); weight += weights_[j] * value; if (firstNonZero < 0) firstNonZero = j; lastNonZero = j; } } base += numberLinks_; } double valueInfeasibility; whichWay = 1; whichWay_ = 1; if (lastNonZero - firstNonZero >= sosType_) { // find where to branch assert (sum > 0.0); weight /= sum; valueInfeasibility = lastNonZero - firstNonZero + 1; valueInfeasibility *= 0.5 / static_cast (numberMembers_); //#define DISTANCE #ifdef DISTANCE assert (sosType_ == 1); // code up /* may still be satisfied. For LOS type 2 we might wish to move coding around and keep initial info in model_ for speed */ int iWhere; bool possible = false; for (iWhere = firstNonZero; iWhere <= lastNonZero; iWhere++) { if (fabs(weight - weights_[iWhere]) < 1.0e-8) { possible = true; break; } } if (possible) { // One could move some of this (+ arrays) into model_ const CoinPackedMatrix * matrix = solver->getMatrixByCol(); const double * element = matrix->getMutableElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * rowSolution = solver->getRowActivity(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int numberRows = matrix->getNumRows(); double * array = new double [numberRows]; CoinZeroN(array, numberRows); int * which = new int [numberRows]; int n = 0; int base = numberLinks_ * firstNonZero; for (j = firstNonZero; j <= lastNonZero; j++) { for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; double value = CoinMax(0.0, solution[iColumn]); if (value > integerTolerance && upper[iColumn]) { value = CoinMin(value, upper[iColumn]); for (int j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double a = array[iRow]; if (a) { a += value * element[j]; if (!a) a = 1.0e-100; } else { which[n++] = iRow; a = value * element[j]; assert (a); } array[iRow] = a; } } } base += numberLinks_; } base = numberLinks_ * iWhere; for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; const double value = 1.0; for (int j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double a = array[iRow]; if (a) { a -= value * element[j]; if (!a) a = 1.0e-100; } else { which[n++] = iRow; a = -value * element[j]; assert (a); } array[iRow] = a; } } for (j = 0; j < n; j++) { int iRow = which[j]; // moving to point will increase row solution by this double distance = array[iRow]; if (distance > 1.0e-8) { if (distance + rowSolution[iRow] > rowUpper[iRow] + 1.0e-8) { possible = false; break; } } else if (distance < -1.0e-8) { if (distance + rowSolution[iRow] < rowLower[iRow] - 1.0e-8) { possible = false; break; } } } for (j = 0; j < n; j++) array[which[j]] = 0.0; delete [] array; delete [] which; if (possible) { valueInfeasibility = 0.0; printf("possible %d %d %d\n", firstNonZero, lastNonZero, iWhere); } } #endif } else { valueInfeasibility = 0.0; // satisfied } infeasibility_ = valueInfeasibility; otherInfeasibility_ = 1.0 - valueInfeasibility; return valueInfeasibility; } // This looks at solution and sets bounds to contain solution double OsiOldLink::feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const { int j; int firstNonZero = -1; int lastNonZero = -1; const double * solution = info->solution_; const double * upper = info->upper_; double integerTolerance = info->integerTolerance_; double weight = 0.0; double sum = 0.0; int base = 0; for (j = 0; j < numberMembers_; j++) { for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; double value = CoinMax(0.0, solution[iColumn]); sum += value; if (value > integerTolerance && upper[iColumn]) { weight += weights_[j] * value; if (firstNonZero < 0) firstNonZero = j; lastNonZero = j; } } base += numberLinks_; } #ifdef DISTANCE if (lastNonZero - firstNonZero > sosType_ - 1) { /* may still be satisfied. For LOS type 2 we might wish to move coding around and keep initial info in model_ for speed */ int iWhere; bool possible = false; for (iWhere = firstNonZero; iWhere <= lastNonZero; iWhere++) { if (fabs(weight - weights_[iWhere]) < 1.0e-8) { possible = true; break; } } if (possible) { // One could move some of this (+ arrays) into model_ const CoinPackedMatrix * matrix = solver->getMatrixByCol(); const double * element = matrix->getMutableElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * rowSolution = solver->getRowActivity(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int numberRows = matrix->getNumRows(); double * array = new double [numberRows]; CoinZeroN(array, numberRows); int * which = new int [numberRows]; int n = 0; int base = numberLinks_ * firstNonZero; for (j = firstNonZero; j <= lastNonZero; j++) { for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; double value = CoinMax(0.0, solution[iColumn]); if (value > integerTolerance && upper[iColumn]) { value = CoinMin(value, upper[iColumn]); for (int j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double a = array[iRow]; if (a) { a += value * element[j]; if (!a) a = 1.0e-100; } else { which[n++] = iRow; a = value * element[j]; assert (a); } array[iRow] = a; } } } base += numberLinks_; } base = numberLinks_ * iWhere; for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; const double value = 1.0; for (int j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double a = array[iRow]; if (a) { a -= value * element[j]; if (!a) a = 1.0e-100; } else { which[n++] = iRow; a = -value * element[j]; assert (a); } array[iRow] = a; } } for (j = 0; j < n; j++) { int iRow = which[j]; // moving to point will increase row solution by this double distance = array[iRow]; if (distance > 1.0e-8) { if (distance + rowSolution[iRow] > rowUpper[iRow] + 1.0e-8) { possible = false; break; } } else if (distance < -1.0e-8) { if (distance + rowSolution[iRow] < rowLower[iRow] - 1.0e-8) { possible = false; break; } } } for (j = 0; j < n; j++) array[which[j]] = 0.0; delete [] array; delete [] which; if (possible) { printf("possible feas region %d %d %d\n", firstNonZero, lastNonZero, iWhere); firstNonZero = iWhere; lastNonZero = iWhere; } } } #else assert (lastNonZero - firstNonZero < sosType_) ; #endif base = 0; for (j = 0; j < firstNonZero; j++) { for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; solver->setColUpper(iColumn, 0.0); } base += numberLinks_; } // skip base += numberLinks_; for (j = lastNonZero + 1; j < numberMembers_; j++) { for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; solver->setColUpper(iColumn, 0.0); } base += numberLinks_; } // go to coding as in OsiSOS abort(); return -1.0; } // Redoes data when sequence numbers change void OsiOldLink::resetSequenceEtc(int numberColumns, const int * originalColumns) { int n2 = 0; for (int j = 0; j < numberMembers_*numberLinks_; j++) { int iColumn = members_[j]; int i; #ifdef JJF_ZERO for (i = 0; i < numberColumns; i++) { if (originalColumns[i] == iColumn) break; } #else i = originalColumns[iColumn]; #endif if (i >= 0 && i < numberColumns) { members_[n2] = i; weights_[n2++] = weights_[j]; } } if (n2 < numberMembers_) { printf("** SOS number of members reduced from %d to %d!\n", numberMembers_, n2 / numberLinks_); numberMembers_ = n2 / numberLinks_; } } // Creates a branching object OsiBranchingObject * OsiOldLink::createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const { int j; const double * solution = info->solution_; double tolerance = info->primalTolerance_; const double * upper = info->upper_; int firstNonFixed = -1; int lastNonFixed = -1; int firstNonZero = -1; int lastNonZero = -1; double weight = 0.0; double sum = 0.0; int base = 0; for (j = 0; j < numberMembers_; j++) { for (int k = 0; k < numberLinks_; k++) { int iColumn = members_[base+k]; if (upper[iColumn]) { double value = CoinMax(0.0, solution[iColumn]); sum += value; if (firstNonFixed < 0) firstNonFixed = j; lastNonFixed = j; if (value > tolerance) { weight += weights_[j] * value; if (firstNonZero < 0) firstNonZero = j; lastNonZero = j; } } } base += numberLinks_; } assert (lastNonZero - firstNonZero >= sosType_) ; // find where to branch assert (sum > 0.0); weight /= sum; int iWhere; double separator = 0.0; for (iWhere = firstNonZero; iWhere < lastNonZero; iWhere++) if (weight < weights_[iWhere+1]) break; if (sosType_ == 1) { // SOS 1 separator = 0.5 * (weights_[iWhere] + weights_[iWhere+1]); } else { // SOS 2 if (iWhere == firstNonFixed) iWhere++;; if (iWhere == lastNonFixed - 1) iWhere = lastNonFixed - 2; separator = weights_[iWhere+1]; } // create object OsiBranchingObject * branch; branch = new OsiOldLinkBranchingObject(solver, this, way, separator); return branch; } OsiOldLinkBranchingObject::OsiOldLinkBranchingObject() : OsiSOSBranchingObject() { } // Useful constructor OsiOldLinkBranchingObject::OsiOldLinkBranchingObject (OsiSolverInterface * solver, const OsiOldLink * set, int way , double separator) : OsiSOSBranchingObject(solver, set, way, separator) { } // Copy constructor OsiOldLinkBranchingObject::OsiOldLinkBranchingObject ( const OsiOldLinkBranchingObject & rhs) : OsiSOSBranchingObject(rhs) { } // Assignment operator OsiOldLinkBranchingObject & OsiOldLinkBranchingObject::operator=( const OsiOldLinkBranchingObject & rhs) { if (this != &rhs) { OsiSOSBranchingObject::operator=(rhs); } return *this; } OsiBranchingObject * OsiOldLinkBranchingObject::clone() const { return (new OsiOldLinkBranchingObject(*this)); } // Destructor OsiOldLinkBranchingObject::~OsiOldLinkBranchingObject () { } double OsiOldLinkBranchingObject::branch(OsiSolverInterface * solver) { const OsiOldLink * set = dynamic_cast (originalObject_) ; assert (set); int way = (!branchIndex_) ? (2 * firstBranch_ - 1) : -(2 * firstBranch_ - 1); branchIndex_++; int numberMembers = set->numberMembers(); const int * which = set->members(); const double * weights = set->weights(); int numberLinks = set->numberLinks(); //const double * lower = info->lower_; //const double * upper = solver->getColUpper(); // *** for way - up means fix all those in down section if (way < 0) { int i; for ( i = 0; i < numberMembers; i++) { if (weights[i] > value_) break; } assert (i < numberMembers); int base = i * numberLinks;; for (; i < numberMembers; i++) { for (int k = 0; k < numberLinks; k++) { int iColumn = which[base+k]; solver->setColUpper(iColumn, 0.0); } base += numberLinks; } } else { int i; int base = 0; for ( i = 0; i < numberMembers; i++) { if (weights[i] >= value_) { break; } else { for (int k = 0; k < numberLinks; k++) { int iColumn = which[base+k]; solver->setColUpper(iColumn, 0.0); } base += numberLinks; } } assert (i < numberMembers); } return 0.0; } // Print what would happen void OsiOldLinkBranchingObject::print(const OsiSolverInterface * solver) { const OsiOldLink * set = dynamic_cast (originalObject_) ; assert (set); int way = (!branchIndex_) ? (2 * firstBranch_ - 1) : -(2 * firstBranch_ - 1); int numberMembers = set->numberMembers(); int numberLinks = set->numberLinks(); const double * weights = set->weights(); const int * which = set->members(); const double * upper = solver->getColUpper(); int first = numberMembers; int last = -1; int numberFixed = 0; int numberOther = 0; int i; int base = 0; for ( i = 0; i < numberMembers; i++) { for (int k = 0; k < numberLinks; k++) { int iColumn = which[base+k]; double bound = upper[iColumn]; if (bound) { first = CoinMin(first, i); last = CoinMax(last, i); } } base += numberLinks; } // *** for way - up means fix all those in down section base = 0; if (way < 0) { printf("SOS Down"); for ( i = 0; i < numberMembers; i++) { if (weights[i] > value_) break; for (int k = 0; k < numberLinks; k++) { int iColumn = which[base+k]; double bound = upper[iColumn]; if (bound) numberOther++; } base += numberLinks; } assert (i < numberMembers); for (; i < numberMembers; i++) { for (int k = 0; k < numberLinks; k++) { int iColumn = which[base+k]; double bound = upper[iColumn]; if (bound) numberFixed++; } base += numberLinks; } } else { printf("SOS Up"); for ( i = 0; i < numberMembers; i++) { if (weights[i] >= value_) break; for (int k = 0; k < numberLinks; k++) { int iColumn = which[base+k]; double bound = upper[iColumn]; if (bound) numberFixed++; } base += numberLinks; } assert (i < numberMembers); for (; i < numberMembers; i++) { for (int k = 0; k < numberLinks; k++) { int iColumn = which[base+k]; double bound = upper[iColumn]; if (bound) numberOther++; } base += numberLinks; } } assert ((numberFixed % numberLinks) == 0); assert ((numberOther % numberLinks) == 0); printf(" - at %g, free range %d (%g) => %d (%g), %d would be fixed, %d other way\n", value_, first, weights[first], last, weights[last], numberFixed / numberLinks, numberOther / numberLinks); } // Default Constructor OsiBiLinear::OsiBiLinear () : OsiObject2(), coefficient_(0.0), xMeshSize_(0.0), yMeshSize_(0.0), xSatisfied_(1.0e-6), ySatisfied_(1.0e-6), xOtherSatisfied_(0.0), yOtherSatisfied_(0.0), xySatisfied_(1.0e-6), xyBranchValue_(0.0), xColumn_(-1), yColumn_(-1), firstLambda_(-1), branchingStrategy_(0), boundType_(0), xRow_(-1), yRow_(-1), xyRow_(-1), convexity_(-1), numberExtraRows_(0), multiplier_(NULL), extraRow_(NULL), chosen_(-1) { } // Useful constructor OsiBiLinear::OsiBiLinear (OsiSolverInterface * solver, int xColumn, int yColumn, int xyRow, double coefficient, double xMesh, double yMesh, int numberExistingObjects, const OsiObject ** objects ) : OsiObject2(), coefficient_(coefficient), xMeshSize_(xMesh), yMeshSize_(yMesh), xSatisfied_(1.0e-6), ySatisfied_(1.0e-6), xOtherSatisfied_(0.0), yOtherSatisfied_(0.0), xySatisfied_(1.0e-6), xyBranchValue_(0.0), xColumn_(xColumn), yColumn_(yColumn), firstLambda_(-1), branchingStrategy_(0), boundType_(0), xRow_(-1), yRow_(-1), xyRow_(xyRow), convexity_(-1), numberExtraRows_(0), multiplier_(NULL), extraRow_(NULL), chosen_(-1) { double columnLower[4]; double columnUpper[4]; double objective[4]; double rowLower[3]; double rowUpper[3]; CoinBigIndex starts[5]; int index[16]; double element[16]; int i; starts[0] = 0; // rows int numberRows = solver->getNumRows(); // convexity rowLower[0] = 1.0; rowUpper[0] = 1.0; convexity_ = numberRows; starts[1] = 0; // x rowLower[1] = 0.0; rowUpper[1] = 0.0; index[0] = xColumn_; element[0] = -1.0; xRow_ = numberRows + 1; starts[2] = 1; int nAdd = 2; if (xColumn_ != yColumn_) { rowLower[2] = 0.0; rowUpper[2] = 0.0; index[1] = yColumn; element[1] = -1.0; nAdd = 3; yRow_ = numberRows + 2; starts[3] = 2; } else { yRow_ = -1; branchingStrategy_ = 1; } // may be objective assert (xyRow_ >= -1); solver->addRows(nAdd, starts, index, element, rowLower, rowUpper); int n = 0; // order is LxLy, LxUy, UxLy and UxUy firstLambda_ = solver->getNumCols(); // bit sloppy as theoretically could be infeasible but otherwise need to do more work double xB[2]; double yB[2]; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); xB[0] = lower[xColumn_]; xB[1] = upper[xColumn_]; yB[0] = lower[yColumn_]; yB[1] = upper[yColumn_]; if (xMeshSize_ != floor(xMeshSize_)) { // not integral xSatisfied_ = CoinMax(xSatisfied_, 0.51 * xMeshSize_); if (!yMeshSize_) { xySatisfied_ = CoinMax(xySatisfied_, xSatisfied_ * CoinMax(fabs(yB[0]), fabs(yB[1]))); } } if (yMeshSize_ != floor(yMeshSize_)) { // not integral ySatisfied_ = CoinMax(ySatisfied_, 0.51 * yMeshSize_); if (!xMeshSize_) { xySatisfied_ = CoinMax(xySatisfied_, ySatisfied_ * CoinMax(fabs(xB[0]), fabs(xB[1]))); } } // adjust double distance; double steps; if (xMeshSize_) { distance = xB[1] - xB[0]; steps = floor ((distance + 0.5 * xMeshSize_) / xMeshSize_); distance = xB[0] + xMeshSize_ * steps; if (fabs(xB[1] - distance) > xSatisfied_) { printf("bad x mesh %g %g %g -> %g\n", xB[0], xMeshSize_, xB[1], distance); //double newValue = CoinMax(fabs(xB[1]-distance),xMeshSize_); //printf("xSatisfied increased to %g\n",newValue); //xSatisfied_ = newValue; //xB[1]=distance; //solver->setColUpper(xColumn_,distance); } } if (yMeshSize_) { distance = yB[1] - yB[0]; steps = floor ((distance + 0.5 * yMeshSize_) / yMeshSize_); distance = yB[0] + yMeshSize_ * steps; if (fabs(yB[1] - distance) > ySatisfied_) { printf("bad y mesh %g %g %g -> %g\n", yB[0], yMeshSize_, yB[1], distance); //double newValue = CoinMax(fabs(yB[1]-distance),yMeshSize_); //printf("ySatisfied increased to %g\n",newValue); //ySatisfied_ = newValue; //yB[1]=distance; //solver->setColUpper(yColumn_,distance); } } for (i = 0; i < 4; i++) { double x = (i < 2) ? xB[0] : xB[1]; double y = ((i & 1) == 0) ? yB[0] : yB[1]; columnLower[i] = 0.0; columnUpper[i] = 2.0; objective[i] = 0.0; double value; // xy value = coefficient_ * x * y; if (xyRow_ >= 0) { if (fabs(value) < 1.0e-19) value = 1.0e-19; element[n] = value; index[n++] = xyRow_; } else { objective[i] = value; } // convexity value = 1.0; element[n] = value; index[n++] = 0 + numberRows; // x value = x; if (fabs(value) < 1.0e-19) value = 1.0e-19; element[n] = value; index[n++] = 1 + numberRows; if (xColumn_ != yColumn_) { // y value = y; if (fabs(value) < 1.0e-19) value = 1.0e-19; element[n] = value; index[n++] = 2 + numberRows; } starts[i+1] = n; } solver->addCols(4, starts, index, element, columnLower, columnUpper, objective); // At least one has to have a mesh if (!xMeshSize_ && (!yMeshSize_ || yRow_ < 0)) { printf("one of x and y must have a mesh size\n"); abort(); } else if (yRow_ >= 0) { if (!xMeshSize_) branchingStrategy_ = 2; else if (!yMeshSize_) branchingStrategy_ = 1; } // Now add constraints to link in x and or y to existing ones. bool xDone = false; bool yDone = false; // order is LxLy, LxUy, UxLy and UxUy for (i = numberExistingObjects - 1; i >= 0; i--) { const OsiObject * obj = objects[i]; const OsiBiLinear * obj2 = dynamic_cast (obj) ; if (obj2) { if (xColumn_ == obj2->xColumn_ && !xDone) { // make sure y equal double rhs = 0.0; CoinBigIndex starts[2]; int index[4]; double element[4] = {1.0, 1.0, -1.0, -1.0}; starts[0] = 0; starts[1] = 4; index[0] = firstLambda_ + 0; index[1] = firstLambda_ + 1; index[2] = obj2->firstLambda_ + 0; index[3] = obj2->firstLambda_ + 1; solver->addRows(1, starts, index, element, &rhs, &rhs); xDone = true; } if (yColumn_ == obj2->yColumn_ && yRow_ >= 0 && !yDone) { // make sure x equal double rhs = 0.0; CoinBigIndex starts[2]; int index[4]; double element[4] = {1.0, 1.0, -1.0, -1.0}; starts[0] = 0; starts[1] = 4; index[0] = firstLambda_ + 0; index[1] = firstLambda_ + 2; index[2] = obj2->firstLambda_ + 0; index[3] = obj2->firstLambda_ + 2; solver->addRows(1, starts, index, element, &rhs, &rhs); yDone = true; } } } } // Set sizes and other stuff void OsiBiLinear::setMeshSizes(const OsiSolverInterface * solver, double x, double y) { xMeshSize_ = x; yMeshSize_ = y; double xB[2]; double yB[2]; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); xB[0] = lower[xColumn_]; xB[1] = upper[xColumn_]; yB[0] = lower[yColumn_]; yB[1] = upper[yColumn_]; if (xMeshSize_ != floor(xMeshSize_)) { // not integral xSatisfied_ = CoinMax(xSatisfied_, 0.51 * xMeshSize_); if (!yMeshSize_) { xySatisfied_ = CoinMax(xySatisfied_, xSatisfied_ * CoinMax(fabs(yB[0]), fabs(yB[1]))); } } if (yMeshSize_ != floor(yMeshSize_)) { // not integral ySatisfied_ = CoinMax(ySatisfied_, 0.51 * yMeshSize_); if (!xMeshSize_) { xySatisfied_ = CoinMax(xySatisfied_, ySatisfied_ * CoinMax(fabs(xB[0]), fabs(xB[1]))); } } } // Useful constructor OsiBiLinear::OsiBiLinear (CoinModel * coinModel, int xColumn, int yColumn, int xyRow, double coefficient, double xMesh, double yMesh, int numberExistingObjects, const OsiObject ** objects ) : OsiObject2(), coefficient_(coefficient), xMeshSize_(xMesh), yMeshSize_(yMesh), xSatisfied_(1.0e-6), ySatisfied_(1.0e-6), xOtherSatisfied_(0.0), yOtherSatisfied_(0.0), xySatisfied_(1.0e-6), xyBranchValue_(0.0), xColumn_(xColumn), yColumn_(yColumn), firstLambda_(-1), branchingStrategy_(0), boundType_(0), xRow_(-1), yRow_(-1), xyRow_(xyRow), convexity_(-1), numberExtraRows_(0), multiplier_(NULL), extraRow_(NULL), chosen_(-1) { double columnLower[4]; double columnUpper[4]; double objective[4]; double rowLower[3]; double rowUpper[3]; CoinBigIndex starts[5]; int index[16]; double element[16]; int i; starts[0] = 0; // rows int numberRows = coinModel->numberRows(); // convexity rowLower[0] = 1.0; rowUpper[0] = 1.0; convexity_ = numberRows; starts[1] = 0; // x rowLower[1] = 0.0; rowUpper[1] = 0.0; index[0] = xColumn_; element[0] = -1.0; xRow_ = numberRows + 1; starts[2] = 1; int nAdd = 2; if (xColumn_ != yColumn_) { rowLower[2] = 0.0; rowUpper[2] = 0.0; index[1] = yColumn; element[1] = -1.0; nAdd = 3; yRow_ = numberRows + 2; starts[3] = 2; } else { yRow_ = -1; branchingStrategy_ = 1; } // may be objective assert (xyRow_ >= -1); for (i = 0; i < nAdd; i++) { CoinBigIndex iStart = starts[i]; coinModel->addRow(starts[i+1] - iStart, index + iStart, element + iStart, rowLower[i], rowUpper[i]); } int n = 0; // order is LxLy, LxUy, UxLy and UxUy firstLambda_ = coinModel->numberColumns(); // bit sloppy as theoretically could be infeasible but otherwise need to do more work double xB[2]; double yB[2]; const double * lower = coinModel->columnLowerArray(); const double * upper = coinModel->columnUpperArray(); xB[0] = lower[xColumn_]; xB[1] = upper[xColumn_]; yB[0] = lower[yColumn_]; yB[1] = upper[yColumn_]; if (xMeshSize_ != floor(xMeshSize_)) { // not integral xSatisfied_ = CoinMax(xSatisfied_, 0.51 * xMeshSize_); if (!yMeshSize_) { xySatisfied_ = CoinMax(xySatisfied_, xSatisfied_ * CoinMax(fabs(yB[0]), fabs(yB[1]))); } } if (yMeshSize_ != floor(yMeshSize_)) { // not integral ySatisfied_ = CoinMax(ySatisfied_, 0.51 * yMeshSize_); if (!xMeshSize_) { xySatisfied_ = CoinMax(xySatisfied_, ySatisfied_ * CoinMax(fabs(xB[0]), fabs(xB[1]))); } } // adjust double distance; double steps; if (xMeshSize_) { distance = xB[1] - xB[0]; steps = floor ((distance + 0.5 * xMeshSize_) / xMeshSize_); distance = xB[0] + xMeshSize_ * steps; if (fabs(xB[1] - distance) > xSatisfied_) { printf("bad x mesh %g %g %g -> %g\n", xB[0], xMeshSize_, xB[1], distance); //double newValue = CoinMax(fabs(xB[1]-distance),xMeshSize_); //printf("xSatisfied increased to %g\n",newValue); //xSatisfied_ = newValue; //xB[1]=distance; //coinModel->setColUpper(xColumn_,distance); } } if (yMeshSize_) { distance = yB[1] - yB[0]; steps = floor ((distance + 0.5 * yMeshSize_) / yMeshSize_); distance = yB[0] + yMeshSize_ * steps; if (fabs(yB[1] - distance) > ySatisfied_) { printf("bad y mesh %g %g %g -> %g\n", yB[0], yMeshSize_, yB[1], distance); //double newValue = CoinMax(fabs(yB[1]-distance),yMeshSize_); //printf("ySatisfied increased to %g\n",newValue); //ySatisfied_ = newValue; //yB[1]=distance; //coinModel->setColUpper(yColumn_,distance); } } for (i = 0; i < 4; i++) { double x = (i < 2) ? xB[0] : xB[1]; double y = ((i & 1) == 0) ? yB[0] : yB[1]; columnLower[i] = 0.0; columnUpper[i] = 2.0; objective[i] = 0.0; double value; // xy value = coefficient_ * x * y; if (xyRow_ >= 0) { if (fabs(value) < 1.0e-19) value = 1.0e-19; element[n] = value; index[n++] = xyRow_; } else { objective[i] = value; } // convexity value = 1.0; element[n] = value; index[n++] = 0 + numberRows; // x value = x; if (fabs(value) < 1.0e-19) value = 1.0e-19; element[n] = value; index[n++] = 1 + numberRows; if (xColumn_ != yColumn_) { // y value = y; if (fabs(value) < 1.0e-19) value = 1.0e-19; element[n] = value; index[n++] = 2 + numberRows; } starts[i+1] = n; } for (i = 0; i < 4; i++) { CoinBigIndex iStart = starts[i]; coinModel->addColumn(starts[i+1] - iStart, index + iStart, element + iStart, columnLower[i], columnUpper[i], objective[i]); } // At least one has to have a mesh if (!xMeshSize_ && (!yMeshSize_ || yRow_ < 0)) { printf("one of x and y must have a mesh size\n"); abort(); } else if (yRow_ >= 0) { if (!xMeshSize_) branchingStrategy_ = 2; else if (!yMeshSize_) branchingStrategy_ = 1; } // Now add constraints to link in x and or y to existing ones. bool xDone = false; bool yDone = false; // order is LxLy, LxUy, UxLy and UxUy for (i = numberExistingObjects - 1; i >= 0; i--) { const OsiObject * obj = objects[i]; const OsiBiLinear * obj2 = dynamic_cast (obj) ; if (obj2) { if (xColumn_ == obj2->xColumn_ && !xDone) { // make sure y equal double rhs = 0.0; int index[4]; double element[4] = {1.0, 1.0, -1.0, -1.0}; index[0] = firstLambda_ + 0; index[1] = firstLambda_ + 1; index[2] = obj2->firstLambda_ + 0; index[3] = obj2->firstLambda_ + 1; coinModel->addRow(4, index, element, rhs, rhs); xDone = true; } if (yColumn_ == obj2->yColumn_ && yRow_ >= 0 && !yDone) { // make sure x equal double rhs = 0.0; int index[4]; double element[4] = {1.0, 1.0, -1.0, -1.0}; index[0] = firstLambda_ + 0; index[1] = firstLambda_ + 2; index[2] = obj2->firstLambda_ + 0; index[3] = obj2->firstLambda_ + 2; coinModel->addRow(4, index, element, rhs, rhs); yDone = true; } } } } // Copy constructor OsiBiLinear::OsiBiLinear ( const OsiBiLinear & rhs) : OsiObject2(rhs), coefficient_(rhs.coefficient_), xMeshSize_(rhs.xMeshSize_), yMeshSize_(rhs.yMeshSize_), xSatisfied_(rhs.xSatisfied_), ySatisfied_(rhs.ySatisfied_), xOtherSatisfied_(rhs.xOtherSatisfied_), yOtherSatisfied_(rhs.yOtherSatisfied_), xySatisfied_(rhs.xySatisfied_), xyBranchValue_(rhs.xyBranchValue_), xColumn_(rhs.xColumn_), yColumn_(rhs.yColumn_), firstLambda_(rhs.firstLambda_), branchingStrategy_(rhs.branchingStrategy_), boundType_(rhs.boundType_), xRow_(rhs.xRow_), yRow_(rhs.yRow_), xyRow_(rhs.xyRow_), convexity_(rhs.convexity_), numberExtraRows_(rhs.numberExtraRows_), multiplier_(NULL), extraRow_(NULL), chosen_(rhs.chosen_) { if (numberExtraRows_) { multiplier_ = CoinCopyOfArray(rhs.multiplier_, numberExtraRows_); extraRow_ = CoinCopyOfArray(rhs.extraRow_, numberExtraRows_); } } // Clone OsiObject * OsiBiLinear::clone() const { return new OsiBiLinear(*this); } // Assignment operator OsiBiLinear & OsiBiLinear::operator=( const OsiBiLinear & rhs) { if (this != &rhs) { OsiObject2::operator=(rhs); coefficient_ = rhs.coefficient_; xMeshSize_ = rhs.xMeshSize_; yMeshSize_ = rhs.yMeshSize_; xSatisfied_ = rhs.xSatisfied_; ySatisfied_ = rhs.ySatisfied_; xOtherSatisfied_ = rhs.xOtherSatisfied_; yOtherSatisfied_ = rhs.yOtherSatisfied_; xySatisfied_ = rhs.xySatisfied_; xyBranchValue_ = rhs.xyBranchValue_; xColumn_ = rhs.xColumn_; yColumn_ = rhs.yColumn_; firstLambda_ = rhs.firstLambda_; branchingStrategy_ = rhs.branchingStrategy_; boundType_ = rhs.boundType_; xRow_ = rhs.xRow_; yRow_ = rhs.yRow_; xyRow_ = rhs.xyRow_; convexity_ = rhs.convexity_; numberExtraRows_ = rhs.numberExtraRows_; delete [] multiplier_; delete [] extraRow_; if (numberExtraRows_) { multiplier_ = CoinCopyOfArray(rhs.multiplier_, numberExtraRows_); extraRow_ = CoinCopyOfArray(rhs.extraRow_, numberExtraRows_); } else { multiplier_ = NULL; extraRow_ = NULL; } chosen_ = rhs.chosen_; } return *this; } // Destructor OsiBiLinear::~OsiBiLinear () { delete [] multiplier_; delete [] extraRow_; } // Adds in data for extra row with variable coefficients void OsiBiLinear::addExtraRow(int row, double multiplier) { int * tempI = new int [numberExtraRows_+1]; double * tempD = new double [numberExtraRows_+1]; memcpy(tempI, extraRow_, numberExtraRows_*sizeof(int)); memcpy(tempD, multiplier_, numberExtraRows_*sizeof(double)); tempI[numberExtraRows_] = row; tempD[numberExtraRows_] = multiplier; if (numberExtraRows_) assert (row > tempI[numberExtraRows_-1]); numberExtraRows_++; delete [] extraRow_; extraRow_ = tempI; delete [] multiplier_; multiplier_ = tempD; } static bool testCoarse = true; // Infeasibility - large is 0.5 double OsiBiLinear::infeasibility(const OsiBranchingInformation * info, int & whichWay) const { // order is LxLy, LxUy, UxLy and UxUy double xB[2]; double yB[2]; xB[0] = info->lower_[xColumn_]; xB[1] = info->upper_[xColumn_]; yB[0] = info->lower_[yColumn_]; yB[1] = info->upper_[yColumn_]; #ifdef JJF_ZERO if (info->lower_[1] <= 43.0 && info->upper_[1] >= 43.0) { if (info->lower_[4] <= 49.0 && info->upper_[4] >= 49.0) { if (info->lower_[2] <= 16.0 && info->upper_[2] >= 16.0) { if (info->lower_[3] <= 19.0 && info->upper_[3] >= 19.0) { printf("feas %g %g %g %g p %g t %g\n", info->solution_[1], info->solution_[2], info->solution_[3], info->solution_[4], info->solution_[0], info->solution_[5]); } } } } #endif double x = info->solution_[xColumn_]; x = CoinMax(x, xB[0]); x = CoinMin(x, xB[1]); double y = info->solution_[yColumn_]; y = CoinMax(y, yB[0]); y = CoinMin(y, yB[1]); int j; #ifndef NDEBUG double xLambda = 0.0; double yLambda = 0.0; if ((branchingStrategy_&4) == 0) { for (j = 0; j < 4; j++) { int iX = j >> 1; int iY = j & 1; xLambda += xB[iX] * info->solution_[firstLambda_+j]; if (yRow_ >= 0) yLambda += yB[iY] * info->solution_[firstLambda_+j]; } } else { const double * element = info->elementByColumn_; const int * row = info->row_; const CoinBigIndex * columnStart = info->columnStart_; const int * columnLength = info->columnLength_; for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; int iStart = columnStart[iColumn]; int iEnd = iStart + columnLength[iColumn]; int k = iStart; double sol = info->solution_[iColumn]; for (; k < iEnd; k++) { if (xRow_ == row[k]) xLambda += element[k] * sol; if (yRow_ == row[k]) yLambda += element[k] * sol; } } } assert (fabs(x - xLambda) < 1.0e-1); if (yRow_ >= 0) assert (fabs(y - yLambda) < 1.0e-1); #endif // If x or y not satisfied then branch on that double distance; double steps; bool xSatisfied; double xNew = xB[0]; if (xMeshSize_) { if (x < 0.5*(xB[0] + xB[1])) { distance = x - xB[0]; steps = floor ((distance + 0.5 * xMeshSize_) / xMeshSize_); xNew = xB[0] + steps * xMeshSize_; assert (xNew <= xB[1] + xSatisfied_); xSatisfied = (fabs(xNew - x) < xSatisfied_); } else { distance = xB[1] - x; steps = floor ((distance + 0.5 * xMeshSize_) / xMeshSize_); xNew = xB[1] - steps * xMeshSize_; assert (xNew >= xB[0] - xSatisfied_); xSatisfied = (fabs(xNew - x) < xSatisfied_); } // but if first coarse grid then only if gap small if (testCoarse && (branchingStrategy_&8) != 0 && xSatisfied && xB[1] - xB[0] >= xMeshSize_) { // but allow if fine grid would allow if (fabs(xNew - x) >= xOtherSatisfied_ && fabs(yB[0] - y) > yOtherSatisfied_ && fabs(yB[1] - y) > yOtherSatisfied_) { xNew = 0.5 * (xB[0] + xB[1]); x = xNew; xSatisfied = false; } } } else { xSatisfied = true; } bool ySatisfied; double yNew = yB[0]; if (yMeshSize_) { if (y < 0.5*(yB[0] + yB[1])) { distance = y - yB[0]; steps = floor ((distance + 0.5 * yMeshSize_) / yMeshSize_); yNew = yB[0] + steps * yMeshSize_; assert (yNew <= yB[1] + ySatisfied_); ySatisfied = (fabs(yNew - y) < ySatisfied_); } else { distance = yB[1] - y; steps = floor ((distance + 0.5 * yMeshSize_) / yMeshSize_); yNew = yB[1] - steps * yMeshSize_; assert (yNew >= yB[0] - ySatisfied_); ySatisfied = (fabs(yNew - y) < ySatisfied_); } // but if first coarse grid then only if gap small if (testCoarse && (branchingStrategy_&8) != 0 && ySatisfied && yB[1] - yB[0] >= yMeshSize_) { // but allow if fine grid would allow if (fabs(yNew - y) >= yOtherSatisfied_ && fabs(xB[0] - x) > xOtherSatisfied_ && fabs(xB[1] - x) > xOtherSatisfied_) { yNew = 0.5 * (yB[0] + yB[1]); y = yNew; ySatisfied = false; } } } else { ySatisfied = true; } /* There are several possibilities 1 - one or both are unsatisfied and branching strategy tells us what to do 2 - both are unsatisfied and branching strategy is 0 3 - both are satisfied but xy is not 3a one has bounds within satisfied_ - other does not (or neither have but branching strategy tells us what to do) 3b neither do - and branching strategy does not tell us 3c both do - treat as feasible knowing another copy of object will fix 4 - both are satisfied and xy is satisfied - as 3c */ chosen_ = -1; xyBranchValue_ = COIN_DBL_MAX; whichWay_ = 0; double xyTrue = x * y; double xyLambda = 0.0; if ((branchingStrategy_&4) == 0) { for (j = 0; j < 4; j++) { int iX = j >> 1; int iY = j & 1; xyLambda += xB[iX] * yB[iY] * info->solution_[firstLambda_+j]; } } else { if (xyRow_ >= 0) { const double * element = info->elementByColumn_; const int * row = info->row_; const CoinBigIndex * columnStart = info->columnStart_; const int * columnLength = info->columnLength_; for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; int iStart = columnStart[iColumn]; int iEnd = iStart + columnLength[iColumn]; int k = iStart; double sol = info->solution_[iColumn]; for (; k < iEnd; k++) { if (xyRow_ == row[k]) xyLambda += element[k] * sol; } } } else { // objective const double * objective = info->objective_; for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; double sol = info->solution_[iColumn]; xyLambda += objective[iColumn] * sol; } } xyLambda /= coefficient_; } if (0) { // only true with positive values // see if all convexification constraints OK with true assert (xyTrue + 1.0e-5 > xB[0]*y + yB[0]*x - xB[0]*yB[0]); assert (xyTrue + 1.0e-5 > xB[1]*y + yB[1]*x - xB[1]*yB[1]); assert (xyTrue - 1.0e-5 < xB[1]*y + yB[0]*x - xB[1]*yB[0]); assert (xyTrue - 1.0e-5 < xB[0]*y + yB[1]*x - xB[0]*yB[1]); // see if all convexification constraints OK with lambda version #ifndef JJF_ONE assert (xyLambda + 1.0e-5 > xB[0]*y + yB[0]*x - xB[0]*yB[0]); assert (xyLambda + 1.0e-5 > xB[1]*y + yB[1]*x - xB[1]*yB[1]); assert (xyLambda - 1.0e-5 < xB[1]*y + yB[0]*x - xB[1]*yB[0]); assert (xyLambda - 1.0e-5 < xB[0]*y + yB[1]*x - xB[0]*yB[1]); #endif // see if other bound stuff true assert (xyLambda + 1.0e-5 > xB[0]*y); assert (xyLambda + 1.0e-5 > yB[0]*x); assert (xyLambda - 1.0e-5 < xB[1]*y); assert (xyLambda - 1.0e-5 < yB[1]*x); #define SIZE 2 if (yColumn_ == xColumn_ + SIZE) { #if SIZE==6 double bMax = 2200.0; double bMin = bMax - 100.0; double b[] = {330.0, 360.0, 380.0, 430.0, 490.0, 530.0}; #elif SIZE==2 double bMax = 1900.0; double bMin = bMax - 200.0; double b[] = {460.0, 570.0}; #else abort(); #endif double sum = 0.0; double sum2 = 0.0; int m = xColumn_; double x = info->solution_[m]; double xB[2]; double yB[2]; xB[0] = info->lower_[m]; xB[1] = info->upper_[m]; for (int i = 0; i < SIZE*SIZE; i += SIZE) { int n = i + SIZE + m; double y = info->solution_[n]; yB[0] = info->lower_[n]; yB[1] = info->upper_[n]; int firstLambda = SIZE * SIZE + 2 * SIZE + 4 * i + 4 * m; double xyLambda = 0.0; for (int j = 0; j < 4; j++) { int iX = j >> 1; int iY = j & 1; xyLambda += xB[iX] * yB[iY] * info->solution_[firstLambda+j]; } sum += xyLambda * b[i/SIZE]; double xyTrue = x * y; sum2 += xyTrue * b[i/SIZE]; } if (sum > bMax*x + 1.0e-5 || sum < bMin*x - 1.0e-5) { //if (sumbMin*x-1.0e-5) { printf("bmin*x %g b*w %g bmax*x %g (true) %g\n", bMin*x, sum, bMax*x, sum2); printf("m %d lb %g value %g up %g\n", m, xB[0], x, xB[1]); sum = 0.0; for (int i = 0; i < SIZE*SIZE; i += SIZE) { int n = i + SIZE + m; double y = info->solution_[n]; yB[0] = info->lower_[n]; yB[1] = info->upper_[n]; printf("n %d lb %g value %g up %g\n", n, yB[0], y, yB[1]); int firstLambda = SIZE * SIZE + 2 * SIZE + 4 * i + m * 4; double xyLambda = 0.0; for (int j = 0; j < 4; j++) { int iX = j >> 1; int iY = j & 1; xyLambda += xB[iX] * yB[iY] * info->solution_[firstLambda+j]; printf("j %d l %d new xylambda %g ", j, firstLambda + j, xyLambda); } sum += xyLambda * b[i/SIZE]; printf(" - sum now %g\n", sum); } } if (sum2 > bMax*x + 1.0e-5 || sum2 < bMin*x - 1.0e-5) { printf("bmin*x %g b*x*y %g bmax*x %g (estimate) %g\n", bMin*x, sum2, bMax*x, sum); printf("m %d lb %g value %g up %g\n", m, xB[0], x, xB[1]); sum2 = 0.0; for (int i = 0; i < SIZE*SIZE; i += SIZE) { int n = i + SIZE + m; double y = info->solution_[n]; yB[0] = info->lower_[n]; yB[1] = info->upper_[n]; printf("n %d lb %g value %g up %g\n", n, yB[0], y, yB[1]); double xyTrue = x * y; sum2 += xyTrue * b[i/SIZE]; printf("xyTrue %g - sum now %g\n", xyTrue, sum2); } } } } // If pseudo shadow prices then see what would happen //double pseudoEstimate = 0.0; if (info->defaultDual_ >= 0.0) { // If we move to xy then we move by coefficient * (xyTrue-xyLambda) on row xyRow_ double move = xyTrue - xyLambda; assert (xyRow_ >= 0); if (boundType_ == 0) { move *= coefficient_; move *= info->pi_[xyRow_]; move = CoinMax(move, 0.0); } else if (boundType_ == 1) { // if OK then say satisfied } else if (boundType_ == 2) { } else { // == row so move x and y not xy } } if ((branchingStrategy_&16) != 0) { // always treat as satisfied!! xSatisfied = true; ySatisfied = true; xyTrue = xyLambda; } if ( !xSatisfied) { if (!ySatisfied) { if ((branchingStrategy_&3) == 0) { // If pseudo shadow prices then see what would happen if (info->defaultDual_ >= 0.0) { // need coding here if (fabs(x - xNew) > fabs(y - yNew)) { chosen_ = 0; xyBranchValue_ = x; } else { chosen_ = 1; xyBranchValue_ = y; } } else { if (fabs(x - xNew) > fabs(y - yNew)) { chosen_ = 0; xyBranchValue_ = x; } else { chosen_ = 1; xyBranchValue_ = y; } } } else if ((branchingStrategy_&3) == 1) { chosen_ = 0; xyBranchValue_ = x; } else { chosen_ = 1; xyBranchValue_ = y; } } else { // y satisfied chosen_ = 0; xyBranchValue_ = x; } } else { // x satisfied if (!ySatisfied) { chosen_ = 1; xyBranchValue_ = y; } else { /* 3 - both are satisfied but xy is not 3a one has bounds within satisfied_ - other does not (or neither have but branching strategy tells us what to do) 3b neither do - and branching strategy does not tell us 3c both do - treat as feasible knowing another copy of object will fix 4 - both are satisfied and xy is satisfied - as 3c */ if (fabs(xyLambda - xyTrue) < xySatisfied_ || (xB[0] == xB[1] && yB[0] == yB[1])) { // satisfied #ifdef JJF_ZERO printf("all satisfied true %g lambda %g\n", xyTrue, xyLambda); printf("x %d (%g,%g,%g) y %d (%g,%g,%g)\n", xColumn_, xB[0], x, xB[1], yColumn_, yB[0], y, yB[1]); #endif } else { // May be infeasible - check bool feasible = true; if (xB[0] == xB[1] && yB[0] == yB[1]) { double lambda[4]; computeLambdas(info->solver_, lambda); for (int j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; if (info->lower_[iColumn] > lambda[j] + 1.0e-5 || info->upper_[iColumn] < lambda[j] - 1.0e-5) feasible = false; } } if (testCoarse && (branchingStrategy_&8) != 0 && xB[1] - xB[0] < 1.0001*xSatisfied_ && yB[1] - yB[0] < 1.0001*ySatisfied_) feasible = true; if (feasible) { if (xB[1] - xB[0] >= xSatisfied_ && xMeshSize_) { if (yB[1] - yB[0] >= ySatisfied_ && yMeshSize_) { if ((branchingStrategy_&3) == 0) { // If pseudo shadow prices then see what would happen if (info->defaultDual_ >= 0.0) { // need coding here if (xB[1] - xB[0] > yB[1] - yB[0]) { chosen_ = 0; xyBranchValue_ = 0.5 * (xB[0] + xB[1]); } else { chosen_ = 1; xyBranchValue_ = 0.5 * (yB[0] + yB[1]); } } else { if (xB[1] - xB[0] > yB[1] - yB[0]) { chosen_ = 0; xyBranchValue_ = 0.5 * (xB[0] + xB[1]); } else { chosen_ = 1; xyBranchValue_ = 0.5 * (yB[0] + yB[1]); } } } else if ((branchingStrategy_&3) == 1) { chosen_ = 0; xyBranchValue_ = 0.5 * (xB[0] + xB[1]); } else { chosen_ = 1; xyBranchValue_ = 0.5 * (yB[0] + yB[1]); } } else { // y satisfied chosen_ = 0; xyBranchValue_ = 0.5 * (xB[0] + xB[1]); } } else if (yB[1] - yB[0] >= ySatisfied_ && yMeshSize_) { chosen_ = 1; xyBranchValue_ = 0.5 * (yB[0] + yB[1]); } else { // treat as satisfied unless no coefficient tightening if ((branchingStrategy_&4) != 0) { chosen_ = 0; // fix up in branch xyBranchValue_ = x; } } } else { // node not feasible!!! chosen_ = 0; infeasibility_ = COIN_DBL_MAX; otherInfeasibility_ = COIN_DBL_MAX; whichWay = whichWay_; return infeasibility_; } } } } if (chosen_ == -1) { infeasibility_ = 0.0; } else if (chosen_ == 0) { infeasibility_ = CoinMax(fabs(xyBranchValue_ - x), 1.0e-12); //assert (xyBranchValue_>=info->lower_[xColumn_]&&xyBranchValue_<=info->upper_[xColumn_]); } else { infeasibility_ = CoinMax(fabs(xyBranchValue_ - y), 1.0e-12); //assert (xyBranchValue_>=info->lower_[yColumn_]&&xyBranchValue_<=info->upper_[yColumn_]); } if (info->defaultDual_ < 0.0) { // not using pseudo shadow prices otherInfeasibility_ = 1.0 - infeasibility_; } else { abort(); } if (infeasibility_) { bool fixed = true; for (int j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; //if (info->lower_[iColumn]) printf("lower of %g on %d\n",info->lower_[iColumn],iColumn); if (info->lower_[iColumn] < info->upper_[iColumn]) fixed = false; } if (fixed) { //printf("must be tolerance problem - xy true %g lambda %g\n",xyTrue,xyLambda); chosen_ = -1; infeasibility_ = 0.0; } } whichWay = whichWay_; //if (infeasibility_&&priority_==10) //printf("x %d %g %g %g, y %d %g %g %g\n",xColumn_,xB[0],x,xB[1],yColumn_,yB[0],y,yB[1]); return infeasibility_; } // Sets infeasibility and other when pseudo shadow prices void OsiBiLinear::getPseudoShadow(const OsiBranchingInformation * info) { // order is LxLy, LxUy, UxLy and UxUy double xB[2]; double yB[2]; xB[0] = info->lower_[xColumn_]; xB[1] = info->upper_[xColumn_]; yB[0] = info->lower_[yColumn_]; yB[1] = info->upper_[yColumn_]; double x = info->solution_[xColumn_]; x = CoinMax(x, xB[0]); x = CoinMin(x, xB[1]); double y = info->solution_[yColumn_]; y = CoinMax(y, yB[0]); y = CoinMin(y, yB[1]); int j; double xyTrue = x * y; double xyLambda = 0.0; if ((branchingStrategy_&4) == 0) { for (j = 0; j < 4; j++) { int iX = j >> 1; int iY = j & 1; xyLambda += xB[iX] * yB[iY] * info->solution_[firstLambda_+j]; } } else { if (xyRow_ >= 0) { const double * element = info->elementByColumn_; const int * row = info->row_; const CoinBigIndex * columnStart = info->columnStart_; const int * columnLength = info->columnLength_; for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; int iStart = columnStart[iColumn]; int iEnd = iStart + columnLength[iColumn]; int k = iStart; double sol = info->solution_[iColumn]; for (; k < iEnd; k++) { if (xyRow_ == row[k]) xyLambda += element[k] * sol; } } } else { // objective const double * objective = info->objective_; for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; double sol = info->solution_[iColumn]; xyLambda += objective[iColumn] * sol; } } xyLambda /= coefficient_; } assert (info->defaultDual_ >= 0.0); // If we move to xy then we move by coefficient * (xyTrue-xyLambda) on row xyRow_ double movement = xyTrue - xyLambda; infeasibility_ = 0.0; const double * pi = info->pi_; const double * activity = info->rowActivity_; const double * lower = info->rowLower_; const double * upper = info->rowUpper_; double tolerance = info->primalTolerance_; double direction = info->direction_; bool infeasible = false; if (xyRow_ >= 0) { assert (!boundType_); if (lower[xyRow_] < -1.0e20) assert (pi[xyRow_] <= 1.0e-3); if (upper[xyRow_] > 1.0e20) assert (pi[xyRow_] >= -1.0e-3); double valueP = pi[xyRow_] * direction; // if move makes infeasible then make at least default double newValue = activity[xyRow_] + movement * coefficient_; if (newValue > upper[xyRow_] + tolerance || newValue < lower[xyRow_] - tolerance) { infeasibility_ += fabs(movement * coefficient_) * CoinMax(fabs(valueP), info->defaultDual_); infeasible = true; } } else { // objective assert (movement > -1.0e-7); infeasibility_ += movement; } for (int i = 0; i < numberExtraRows_; i++) { int iRow = extraRow_[i]; if (lower[iRow] < -1.0e20) assert (pi[iRow] <= 1.0e-3); if (upper[iRow] > 1.0e20) assert (pi[iRow] >= -1.0e-3); double valueP = pi[iRow] * direction; // if move makes infeasible then make at least default double newValue = activity[iRow] + movement * multiplier_[i]; if (newValue > upper[iRow] + tolerance || newValue < lower[iRow] - tolerance) { infeasibility_ += fabs(movement * multiplier_[i]) * CoinMax(fabs(valueP), info->defaultDual_); infeasible = true; } } if (infeasibility_ < info->integerTolerance_) { if (!infeasible) infeasibility_ = 0.0; else infeasibility_ = info->integerTolerance_; } otherInfeasibility_ = CoinMax(1.0e-12, infeasibility_ * 10.0); } // Gets sum of movements to correct value double OsiBiLinear::getMovement(const OsiBranchingInformation * info) { // order is LxLy, LxUy, UxLy and UxUy double xB[2]; double yB[2]; xB[0] = info->lower_[xColumn_]; xB[1] = info->upper_[xColumn_]; yB[0] = info->lower_[yColumn_]; yB[1] = info->upper_[yColumn_]; double x = info->solution_[xColumn_]; x = CoinMax(x, xB[0]); x = CoinMin(x, xB[1]); double y = info->solution_[yColumn_]; y = CoinMax(y, yB[0]); y = CoinMin(y, yB[1]); int j; double xyTrue = x * y; double xyLambda = 0.0; if ((branchingStrategy_&4) == 0) { for (j = 0; j < 4; j++) { int iX = j >> 1; int iY = j & 1; xyLambda += xB[iX] * yB[iY] * info->solution_[firstLambda_+j]; } } else { if (xyRow_ >= 0) { const double * element = info->elementByColumn_; const int * row = info->row_; const CoinBigIndex * columnStart = info->columnStart_; const int * columnLength = info->columnLength_; for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; int iStart = columnStart[iColumn]; int iEnd = iStart + columnLength[iColumn]; int k = iStart; double sol = info->solution_[iColumn]; for (; k < iEnd; k++) { if (xyRow_ == row[k]) xyLambda += element[k] * sol; } } } else { // objective const double * objective = info->objective_; for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; double sol = info->solution_[iColumn]; xyLambda += objective[iColumn] * sol; } } xyLambda /= coefficient_; } // If we move to xy then we move by coefficient * (xyTrue-xyLambda) on row xyRow_ double movement = xyTrue - xyLambda; double mesh = CoinMax(xMeshSize_, yMeshSize_); if (fabs(movement) < xySatisfied_ && (xB[1] - xB[0] < mesh || yB[1] - yB[0] < mesh)) return 0.0; // say feasible const double * activity = info->rowActivity_; const double * lower = info->rowLower_; const double * upper = info->rowUpper_; double tolerance = info->primalTolerance_; double infeasibility = 0.0; if (xyRow_ >= 0) { assert (!boundType_); // if move makes infeasible double newValue = activity[xyRow_] + movement * coefficient_; if (newValue > upper[xyRow_] + tolerance) infeasibility += newValue - upper[xyRow_]; else if (newValue < lower[xyRow_] - tolerance) infeasibility += lower[xyRow_] - newValue; } else { // objective assert (movement > -1.0e-7); infeasibility += movement; } for (int i = 0; i < numberExtraRows_; i++) { int iRow = extraRow_[i]; // if move makes infeasible double newValue = activity[iRow] + movement * multiplier_[i]; if (newValue > upper[iRow] + tolerance) infeasibility += newValue - upper[iRow]; else if (newValue < lower[iRow] - tolerance) infeasibility += lower[iRow] - newValue; } return infeasibility; } // This looks at solution and sets bounds to contain solution double OsiBiLinear::feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const { // If another object has finer mesh ignore this if ((branchingStrategy_&8) != 0) return 0.0; // order is LxLy, LxUy, UxLy and UxUy double xB[2]; double yB[2]; xB[0] = info->lower_[xColumn_]; xB[1] = info->upper_[xColumn_]; yB[0] = info->lower_[yColumn_]; yB[1] = info->upper_[yColumn_]; double x = info->solution_[xColumn_]; double y = info->solution_[yColumn_]; int j; #ifndef NDEBUG double xLambda = 0.0; double yLambda = 0.0; if ((branchingStrategy_&4) == 0) { for (j = 0; j < 4; j++) { int iX = j >> 1; int iY = j & 1; xLambda += xB[iX] * info->solution_[firstLambda_+j]; if (yRow_ >= 0) yLambda += yB[iY] * info->solution_[firstLambda_+j]; } } else { const double * element = info->elementByColumn_; const int * row = info->row_; const CoinBigIndex * columnStart = info->columnStart_; const int * columnLength = info->columnLength_; for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; int iStart = columnStart[iColumn]; int iEnd = iStart + columnLength[iColumn]; int k = iStart; double sol = info->solution_[iColumn]; for (; k < iEnd; k++) { if (xRow_ == row[k]) xLambda += element[k] * sol; if (yRow_ == row[k]) yLambda += element[k] * sol; } } } if (yRow_ < 0) yLambda = xLambda; #ifdef JJF_ZERO if (fabs(x - xLambda) > 1.0e-4 || fabs(y - yLambda) > 1.0e-4) printf("feasibleregion x %d given %g lambda %g y %d given %g lambda %g\n", xColumn_, x, xLambda, yColumn_, y, yLambda); #endif #endif double infeasibility = 0.0; double distance; double steps; double xNew = x; if (xMeshSize_) { distance = x - xB[0]; if (x < 0.5*(xB[0] + xB[1])) { distance = x - xB[0]; steps = floor ((distance + 0.5 * xMeshSize_) / xMeshSize_); xNew = xB[0] + steps * xMeshSize_; assert (xNew <= xB[1] + xSatisfied_); } else { distance = xB[1] - x; steps = floor ((distance + 0.5 * xMeshSize_) / xMeshSize_); xNew = xB[1] - steps * xMeshSize_; assert (xNew >= xB[0] - xSatisfied_); } if (xMeshSize_ < 1.0 && fabs(xNew - x) <= xSatisfied_) { double lo = CoinMax(xB[0], x - 0.5 * xSatisfied_); double up = CoinMin(xB[1], x + 0.5 * xSatisfied_); solver->setColLower(xColumn_, lo); solver->setColUpper(xColumn_, up); } else { infeasibility += fabs(xNew - x); solver->setColLower(xColumn_, xNew); solver->setColUpper(xColumn_, xNew); } } double yNew = y; if (yMeshSize_) { distance = y - yB[0]; if (y < 0.5*(yB[0] + yB[1])) { distance = y - yB[0]; steps = floor ((distance + 0.5 * yMeshSize_) / yMeshSize_); yNew = yB[0] + steps * yMeshSize_; assert (yNew <= yB[1] + ySatisfied_); } else { distance = yB[1] - y; steps = floor ((distance + 0.5 * yMeshSize_) / yMeshSize_); yNew = yB[1] - steps * yMeshSize_; assert (yNew >= yB[0] - ySatisfied_); } if (yMeshSize_ < 1.0 && fabs(yNew - y) <= ySatisfied_) { double lo = CoinMax(yB[0], y - 0.5 * ySatisfied_); double up = CoinMin(yB[1], y + 0.5 * ySatisfied_); solver->setColLower(yColumn_, lo); solver->setColUpper(yColumn_, up); } else { infeasibility += fabs(yNew - y); solver->setColLower(yColumn_, yNew); solver->setColUpper(yColumn_, yNew); } } if (0) { // temp solver->setColLower(xColumn_, x); solver->setColUpper(xColumn_, x); solver->setColLower(yColumn_, y); solver->setColUpper(yColumn_, y); } if ((branchingStrategy_&4)) { // fake to make correct double lambda[4]; computeLambdas(solver, lambda); for (int j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; double value = lambda[j]; solver->setColLower(iColumn, value); solver->setColUpper(iColumn, value); } } double xyTrue = xNew * yNew; double xyLambda = 0.0; for (j = 0; j < 4; j++) { int iX = j >> 1; int iY = j & 1; xyLambda += xB[iX] * yB[iY] * info->solution_[firstLambda_+j]; } infeasibility += fabs(xyTrue - xyLambda); return infeasibility; } // Returns true value of single xyRow coefficient double OsiBiLinear::xyCoefficient(const double * solution) const { // If another object has finer mesh ignore this if ((branchingStrategy_&8) != 0) return 0.0; double x = solution[xColumn_]; double y = solution[yColumn_]; //printf("x (%d,%g) y (%d,%g) x*y*coefficient %g\n", // xColumn_,x,yColumn_,y,x*y*coefficient_); return x*y*coefficient_; } // Redoes data when sequence numbers change void OsiBiLinear::resetSequenceEtc(int numberColumns, const int * originalColumns) { int i; #ifdef JJF_ZERO for (i = 0; i < numberColumns; i++) { if (originalColumns[i] == firstLambda_) break; } #else i = originalColumns[firstLambda_]; #endif if (i >= 0 && i < numberColumns) { firstLambda_ = i; for (int j = 0; j < 4; j++) { assert (originalColumns[j+i] - firstLambda_ == j); } } else { printf("lost set\n"); abort(); } // rows will be out anyway abort(); } // Creates a branching object OsiBranchingObject * OsiBiLinear::createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * /*info*/, int way) const { // create object OsiBranchingObject * branch; assert (chosen_ == 0 || chosen_ == 1); //if (chosen_==0) //assert (xyBranchValue_>=info->lower_[xColumn_]&&xyBranchValue_<=info->upper_[xColumn_]); //else //assert (xyBranchValue_>=info->lower_[yColumn_]&&xyBranchValue_<=info->upper_[yColumn_]); branch = new OsiBiLinearBranchingObject(solver, this, way, xyBranchValue_, chosen_); return branch; } // Does work of branching void OsiBiLinear::newBounds(OsiSolverInterface * solver, int way, short xOrY, double separator) const { int iColumn; double mesh; double satisfied; if (xOrY == 0) { iColumn = xColumn_; mesh = xMeshSize_; satisfied = xSatisfied_; } else { iColumn = yColumn_; mesh = yMeshSize_; satisfied = ySatisfied_; } const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); double lower = columnLower[iColumn]; double distance; double steps; double zNew = separator; distance = separator - lower; assert (mesh); steps = floor ((distance + 0.5 * mesh) / mesh); if (mesh < 1.0) zNew = lower + steps * mesh; if (zNew > columnUpper[iColumn] - satisfied) zNew = 0.5 * (columnUpper[iColumn] - lower); double oldUpper = columnUpper[iColumn] ; double oldLower = columnLower[iColumn] ; #ifndef NDEBUG int nullChange = 0; #endif if (way < 0) { if (zNew > separator && mesh < 1.0) zNew -= mesh; double oldUpper = columnUpper[iColumn] ; if (zNew + satisfied >= oldUpper) zNew = 0.5 * (oldUpper + oldLower); if (mesh == 1.0) zNew = floor(separator); #ifndef NDEBUG if (oldUpper < zNew + 1.0e-8) nullChange = -1; #endif solver->setColUpper(iColumn, zNew); } else { if (zNew < separator && mesh < 1.0) zNew += mesh; if (zNew - satisfied <= oldLower) zNew = 0.5 * (oldUpper + oldLower); if (mesh == 1.0) zNew = ceil(separator); #ifndef NDEBUG if (oldLower > zNew - 1.0e-8) nullChange = 1; #endif solver->setColLower(iColumn, zNew); } if ((branchingStrategy_&4) != 0 && columnLower[xColumn_] == columnUpper[xColumn_] && columnLower[yColumn_] == columnUpper[yColumn_]) { // fake to make correct double lambda[4]; computeLambdas(solver, lambda); for (int j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; double value = lambda[j]; #ifndef NDEBUG if (fabs(value - columnLower[iColumn]) > 1.0e-5 || fabs(value - columnUpper[iColumn]) > 1.0e-5) nullChange = 0; #endif solver->setColLower(iColumn, value); solver->setColUpper(iColumn, value); } } #ifndef NDEBUG if (nullChange) printf("null change on column%s %d - bounds %g,%g\n", nullChange > 0 ? "Lower" : "Upper", iColumn, oldLower, oldUpper); #endif #ifdef JJF_ZERO // always free up lambda for (int i = firstLambda_; i < firstLambda_ + 4; i++) { solver->setColLower(i, 0.0); solver->setColUpper(i, 2.0); } #endif double xB[3]; xB[0] = columnLower[xColumn_]; xB[1] = columnUpper[xColumn_]; double yB[3]; yB[0] = columnLower[yColumn_]; yB[1] = columnUpper[yColumn_]; if (false && (branchingStrategy_&4) != 0 && yRow_ >= 0 && xMeshSize_ == 1.0 && yMeshSize_ == 1.0) { if ((xB[1] - xB[0])*(yB[1] - yB[0]) < 40) { // try looking at all solutions double lower[4]; double upper[4]; double lambda[4]; int i; double lowerLambda[4]; double upperLambda[4]; for (i = 0; i < 4; i++) { lower[i] = CoinMax(0.0, columnLower[firstLambda_+i]); upper[i] = CoinMin(1.0, columnUpper[firstLambda_+i]); lowerLambda[i] = 1.0; upperLambda[i] = 0.0; } // get coefficients double xybar[4]; getCoefficients(solver, xB, yB, xybar); double x, y; for (x = xB[0]; x <= xB[1]; x++) { xB[2] = x; for (y = yB[0]; y <= yB[1]; y++) { yB[2] = y; computeLambdas(xB, yB, xybar, lambda); for (i = 0; i < 4; i++) { lowerLambda[i] = CoinMin(lowerLambda[i], lambda[i]); upperLambda[i] = CoinMax(upperLambda[i], lambda[i]); } } } double change = 0.0;; for (i = 0; i < 4; i++) { if (lowerLambda[i] > lower[i] + 1.0e-12) { solver->setColLower(firstLambda_ + i, lowerLambda[i]); change += lowerLambda[i] - lower[i]; } if (upperLambda[i] < upper[i] - 1.0e-12) { solver->setColUpper(firstLambda_ + i, upperLambda[i]); change -= upperLambda[i] - upper[i]; } } if (change > 1.0e-5) printf("change of %g\n", change); } } if (boundType_) { assert (!xMeshSize_ || !yMeshSize_); if (xMeshSize_) { // can tighten bounds on y if ((boundType_&1) != 0) { if (xB[0]*yB[1] > coefficient_) { // tighten upper bound on y solver->setColUpper(yColumn_, coefficient_ / xB[0]); } } if ((boundType_&2) != 0) { if (xB[1]*yB[0] < coefficient_) { // tighten lower bound on y solver->setColLower(yColumn_, coefficient_ / xB[1]); } } } else { // can tighten bounds on x if ((boundType_&1) != 0) { if (yB[0]*xB[1] > coefficient_) { // tighten upper bound on x solver->setColUpper(xColumn_, coefficient_ / yB[0]); } } if ((boundType_&2) != 0) { if (yB[1]*xB[0] < coefficient_) { // tighten lower bound on x solver->setColLower(xColumn_, coefficient_ / yB[1]); } } } } } // Compute lambdas if coefficients not changing void OsiBiLinear::computeLambdas(const OsiSolverInterface * solver, double lambda[4]) const { // fix so correct double xB[3], yB[3]; double xybar[4]; getCoefficients(solver, xB, yB, xybar); double x, y; x = solver->getColLower()[xColumn_]; assert(x == solver->getColUpper()[xColumn_]); xB[2] = x; y = solver->getColLower()[yColumn_]; assert(y == solver->getColUpper()[yColumn_]); yB[2] = y; computeLambdas(xB, yB, xybar, lambda); assert (xyRow_ >= 0); } // Get LU coefficients from matrix void OsiBiLinear::getCoefficients(const OsiSolverInterface * solver, double xB[2], double yB[2], double xybar[4]) const { const CoinPackedMatrix * matrix = solver->getMatrixByCol(); const double * element = matrix->getElements(); const double * objective = solver->getObjCoefficients(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); // order is LxLy, LxUy, UxLy and UxUy int j; double multiplier = (boundType_ == 0) ? 1.0 / coefficient_ : 1.0; if (yRow_ >= 0) { for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; int iStart = columnStart[iColumn]; int iEnd = iStart + columnLength[iColumn]; int k = iStart; double x = 0.0; double y = 0.0; xybar[j] = 0.0; for (; k < iEnd; k++) { if (xRow_ == row[k]) x = element[k]; if (yRow_ == row[k]) y = element[k]; if (xyRow_ == row[k]) xybar[j] = element[k] * multiplier; } if (xyRow_ < 0) xybar[j] = objective[iColumn] * multiplier; if (j == 0) xB[0] = x; else if (j == 1) yB[1] = y; else if (j == 2) yB[0] = y; else if (j == 3) xB[1] = x; assert (fabs(xybar[j] - x*y) < 1.0e-4); } } else { // x==y for (j = 0; j < 4; j++) { int iColumn = firstLambda_ + j; int iStart = columnStart[iColumn]; int iEnd = iStart + columnLength[iColumn]; int k = iStart; double x = 0.0; xybar[j] = 0.0; for (; k < iEnd; k++) { if (xRow_ == row[k]) x = element[k]; if (xyRow_ == row[k]) xybar[j] = element[k] * multiplier; } if (xyRow_ < 0) xybar[j] = objective[iColumn] * multiplier; if (j == 0) { xB[0] = x; yB[0] = x; } else if (j == 2) { xB[1] = x; yB[1] = x; } } assert (fabs(xybar[0] - xB[0]*yB[0]) < 1.0e-4); assert (fabs(xybar[1] - xB[0]*yB[1]) < 1.0e-4); assert (fabs(xybar[2] - xB[1]*yB[0]) < 1.0e-4); assert (fabs(xybar[3] - xB[1]*yB[1]) < 1.0e-4); } } // Compute lambdas (third entry in each .B is current value) double OsiBiLinear::computeLambdas(const double xB[3], const double yB[3], const double xybar[4], double lambda[4]) const { // fake to make correct double x = xB[2]; double y = yB[2]; // order is LxLy, LxUy, UxLy and UxUy // l0 + l1 = this double rhs1 = (xB[1] - x) / (xB[1] - xB[0]); // l0 + l2 = this double rhs2 = (yB[1] - y) / (yB[1] - yB[0]); // For xy (taking out l3) double rhs3 = xB[1] * yB[1] - x * y; double a0 = xB[1] * yB[1] - xB[0] * yB[0]; double a1 = xB[1] * yB[1] - xB[0] * yB[1]; double a2 = xB[1] * yB[1] - xB[1] * yB[0]; // divide through to get l0 coefficient rhs3 /= a0; a1 /= a0; a2 /= a0; // subtract out l0 double b[2][2]; double rhs[2]; // first for l1 and l2 b[0][0] = 1.0 - a1; b[0][1] = -a2; rhs[0] = rhs1 - rhs3; // second b[1][0] = -a1; b[1][1] = 1.0 - a2; rhs[1] = rhs2 - rhs3; if (fabs(b[0][0]) > fabs(b[0][1])) { double sub = b[1][0] / b[0][0]; b[1][1] -= sub * b[0][1]; rhs[1] -= sub * rhs[0]; assert (fabs(b[1][1]) > 1.0e-12); lambda[2] = rhs[1] / b[1][1]; lambda[0] = rhs2 - lambda[2]; lambda[1] = rhs1 - lambda[0]; } else { double sub = b[1][1] / b[0][1]; b[1][0] -= sub * b[0][0]; rhs[1] -= sub * rhs[0]; assert (fabs(b[1][0]) > 1.0e-12); lambda[1] = rhs[1] / b[1][0]; lambda[0] = rhs1 - lambda[1]; lambda[2] = rhs2 - lambda[0]; } lambda[3] = 1.0 - (lambda[0] + lambda[1] + lambda[2]); double infeasibility = 0.0; double xy = 0.0; for (int j = 0; j < 4; j++) { double value = lambda[j]; if (value > 1.0) { infeasibility += value - 1.0; value = 1.0; } if (value < 0.0) { infeasibility -= value; value = 0.0; } lambda[j] = value; xy += xybar[j] * value; } assert (fabs(xy - x*y) < 1.0e-4); return infeasibility; } // Updates coefficients int OsiBiLinear::updateCoefficients(const double * lower, const double * upper, double * objective, CoinPackedMatrix * matrix, CoinWarmStartBasis * basis) const { // Return if no updates if ((branchingStrategy_&4) != 0) return 0; int numberUpdated = 0; double * element = matrix->getMutableElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); // order is LxLy, LxUy, UxLy and UxUy double xB[2]; double yB[2]; xB[0] = lower[xColumn_]; xB[1] = upper[xColumn_]; yB[0] = lower[yColumn_]; yB[1] = upper[yColumn_]; //printf("x %d (%g,%g) y %d (%g,%g)\n", // xColumn_,xB[0],xB[1], // yColumn_,yB[0],yB[1]); CoinWarmStartBasis::Status status[4]; int numStruct = basis ? basis->getNumStructural() - firstLambda_ : 0; double coefficient = (boundType_ == 0) ? coefficient_ : 1.0; for (int j = 0; j < 4; j++) { status[j] = (j < numStruct) ? basis->getStructStatus(j + firstLambda_) : CoinWarmStartBasis::atLowerBound; int iX = j >> 1; double x = xB[iX]; int iY = j & 1; double y = yB[iY]; CoinBigIndex k = columnStart[j+firstLambda_]; CoinBigIndex last = k + columnLength[j+firstLambda_]; double value; // xy value = coefficient * x * y; if (xyRow_ >= 0) { assert (row[k] == xyRow_); #if BI_PRINT > 1 printf("j %d xy (%d,%d) coeff from %g to %g\n", j, xColumn_, yColumn_, element[k], value); #endif element[k++] = value; } else { // objective objective[j+firstLambda_] = value; } numberUpdated++; // convexity assert (row[k] == convexity_); k++; // x value = x; #if BI_PRINT > 1 printf("j %d x (%d) coeff from %g to %g\n", j, xColumn_, element[k], value); #endif assert (row[k] == xRow_); element[k++] = value; numberUpdated++; if (yRow_ >= 0) { // y value = y; #if BI_PRINT > 1 printf("j %d y (%d) coeff from %g to %g\n", j, yColumn_, element[k], value); #endif assert (row[k] == yRow_); element[k++] = value; numberUpdated++; } // Do extra rows for (int i = 0; i < numberExtraRows_; i++) { int iRow = extraRow_[i]; for (; k < last; k++) { if (row[k] == iRow) break; } assert (k < last); element[k++] = x * y * multiplier_[i]; } } if (xB[0] == xB[1]) { if (yB[0] == yB[1]) { // only one basic bool first = true; for (int j = 0; j < 4; j++) { if (status[j] == CoinWarmStartBasis::basic) { if (first) { first = false; } else { basis->setStructStatus(j + firstLambda_, CoinWarmStartBasis::atLowerBound); #if BI_PRINT printf("zapping %d (x=%d,y=%d)\n", j, xColumn_, yColumn_); #endif } } } } else { if (status[0] == CoinWarmStartBasis::basic && status[2] == CoinWarmStartBasis::basic) { basis->setStructStatus(2 + firstLambda_, CoinWarmStartBasis::atLowerBound); #if BI_PRINT printf("zapping %d (x=%d,y=%d)\n", 2, xColumn_, yColumn_); #endif } if (status[1] == CoinWarmStartBasis::basic && status[3] == CoinWarmStartBasis::basic) { basis->setStructStatus(3 + firstLambda_, CoinWarmStartBasis::atLowerBound); #if BI_PRINT printf("zapping %d (x=%d,y=%d)\n", 3, xColumn_, yColumn_); #endif } } } else if (yB[0] == yB[1]) { if (status[0] == CoinWarmStartBasis::basic && status[1] == CoinWarmStartBasis::basic) { basis->setStructStatus(1 + firstLambda_, CoinWarmStartBasis::atLowerBound); #if BI_PRINT printf("zapping %d (x=%d,y=%d)\n", 1, xColumn_, yColumn_); #endif } if (status[2] == CoinWarmStartBasis::basic && status[3] == CoinWarmStartBasis::basic) { basis->setStructStatus(3 + firstLambda_, CoinWarmStartBasis::atLowerBound); #if BI_PRINT printf("zapping %d (x=%d,y=%d)\n", 3, xColumn_, yColumn_); #endif } } return numberUpdated; } // This does NOT set mutable stuff double OsiBiLinear::checkInfeasibility(const OsiBranchingInformation * info) const { // If another object has finer mesh ignore this if ((branchingStrategy_&8) != 0) return 0.0; int way; double saveInfeasibility = infeasibility_; short int saveWhichWay = whichWay_; double saveXyBranchValue = xyBranchValue_; short saveChosen = chosen_; double value = infeasibility(info, way); infeasibility_ = saveInfeasibility; whichWay_ = saveWhichWay; xyBranchValue_ = saveXyBranchValue; chosen_ = saveChosen; return value; } OsiBiLinearBranchingObject::OsiBiLinearBranchingObject() : OsiTwoWayBranchingObject(), chosen_(0) { } // Useful constructor OsiBiLinearBranchingObject::OsiBiLinearBranchingObject (OsiSolverInterface * solver, const OsiBiLinear * set, int way , double separator, int chosen) : OsiTwoWayBranchingObject(solver, set, way, separator), chosen_(static_cast(chosen)) { assert (chosen_ >= 0 && chosen_ < 2); } // Copy constructor OsiBiLinearBranchingObject::OsiBiLinearBranchingObject ( const OsiBiLinearBranchingObject & rhs) : OsiTwoWayBranchingObject(rhs), chosen_(rhs.chosen_) { } // Assignment operator OsiBiLinearBranchingObject & OsiBiLinearBranchingObject::operator=( const OsiBiLinearBranchingObject & rhs) { if (this != &rhs) { OsiTwoWayBranchingObject::operator=(rhs); chosen_ = rhs.chosen_; } return *this; } OsiBranchingObject * OsiBiLinearBranchingObject::clone() const { return (new OsiBiLinearBranchingObject(*this)); } // Destructor OsiBiLinearBranchingObject::~OsiBiLinearBranchingObject () { } double OsiBiLinearBranchingObject::branch(OsiSolverInterface * solver) { const OsiBiLinear * set = dynamic_cast (originalObject_) ; assert (set); int way = (!branchIndex_) ? (2 * firstBranch_ - 1) : -(2 * firstBranch_ - 1); branchIndex_++; set->newBounds(solver, way, chosen_, value_); return 0.0; } /* Return true if branch should only bound variables */ bool OsiBiLinearBranchingObject::boundBranch() const { const OsiBiLinear * set = dynamic_cast (originalObject_) ; assert (set); return (set->branchingStrategy()&4) != 0; } // Print what would happen void OsiBiLinearBranchingObject::print(const OsiSolverInterface * /*solver*/) { const OsiBiLinear * set = dynamic_cast (originalObject_) ; assert (set); int way = (!branchIndex_) ? (2 * firstBranch_ - 1) : -(2 * firstBranch_ - 1); int iColumn = (chosen_ == 1) ? set->xColumn() : set->yColumn(); printf("OsiBiLinear would branch %s on %c variable %d from value %g\n", (way < 0) ? "down" : "up", (chosen_ == 0) ? 'X' : 'Y', iColumn, value_); } // Default Constructor OsiBiLinearEquality::OsiBiLinearEquality () : OsiBiLinear(), numberPoints_(0) { } // Useful constructor OsiBiLinearEquality::OsiBiLinearEquality (OsiSolverInterface * solver, int xColumn, int yColumn, int xyRow, double rhs, double xMesh) : OsiBiLinear(), numberPoints_(0) { double xB[2]; double yB[2]; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); xColumn_ = xColumn; yColumn_ = yColumn; xyRow_ = xyRow; coefficient_ = rhs; xB[0] = lower[xColumn_]; xB[1] = upper[xColumn_]; yB[0] = lower[yColumn_]; yB[1] = upper[yColumn_]; if (xB[1]*yB[1] < coefficient_ + 1.0e-12 || xB[0]*yB[0] > coefficient_ - 1.0e-12) { printf("infeasible row - reformulate\n"); abort(); } // reduce range of x if possible if (yB[0]*xB[1] > coefficient_ + 1.0e12) { xB[1] = coefficient_ / yB[0]; solver->setColUpper(xColumn_, xB[1]); } if (yB[1]*xB[0] < coefficient_ - 1.0e12) { xB[0] = coefficient_ / yB[1]; solver->setColLower(xColumn_, xB[0]); } // See how many points numberPoints_ = static_cast ((xB[1] - xB[0] + 0.5 * xMesh) / xMesh); // redo exactly xMeshSize_ = (xB[1] - xB[0]) / static_cast (numberPoints_); numberPoints_++; //#define KEEPXY #ifndef KEEPXY // Take out xyRow solver->setRowLower(xyRow_, 0.0); solver->setRowUpper(xyRow_, 0.0); #else // make >= solver->setRowLower(xyRow_, coefficient_ - 0.05); solver->setRowUpper(xyRow_, COIN_DBL_MAX); #endif double rowLower[3]; double rowUpper[3]; #ifndef KEEPXY double * columnLower = new double [numberPoints_]; double * columnUpper = new double [numberPoints_]; double * objective = new double [numberPoints_]; CoinBigIndex *starts = new CoinBigIndex[numberPoints_+1]; int * index = new int[3*numberPoints_]; double * element = new double [3*numberPoints_]; #else double * columnLower = new double [numberPoints_+2]; double * columnUpper = new double [numberPoints_+2]; double * objective = new double [numberPoints_+2]; CoinBigIndex *starts = new CoinBigIndex[numberPoints_+3]; int * index = new int[4*numberPoints_+2]; double * element = new double [4*numberPoints_+2]; #endif int i; starts[0] = 0; // rows int numberRows = solver->getNumRows(); // convexity rowLower[0] = 1.0; rowUpper[0] = 1.0; convexity_ = numberRows; starts[1] = 0; // x rowLower[1] = 0.0; rowUpper[1] = 0.0; index[0] = xColumn_; element[0] = -1.0; xRow_ = numberRows + 1; starts[2] = 1; rowLower[2] = 0.0; rowUpper[2] = 0.0; index[1] = yColumn; element[1] = -1.0; yRow_ = numberRows + 2; starts[3] = 2; solver->addRows(3, starts, index, element, rowLower, rowUpper); int n = 0; firstLambda_ = solver->getNumCols(); double x = xB[0]; assert(xColumn_ != yColumn_); for (i = 0; i < numberPoints_; i++) { double y = coefficient_ / x; columnLower[i] = 0.0; columnUpper[i] = 2.0; objective[i] = 0.0; double value; #ifdef KEEPXY // xy value = coefficient_; element[n] = value; index[n++] = xyRow_; #endif // convexity value = 1.0; element[n] = value; index[n++] = 0 + numberRows; // x value = x; if (fabs(value) < 1.0e-19) value = 1.0e-19; element[n] = value; index[n++] = 1 + numberRows; // y value = y; if (fabs(value) < 1.0e-19) value = 1.0e-19; element[n] = value; index[n++] = 2 + numberRows; starts[i+1] = n; x += xMeshSize_; } #ifdef KEEPXY // costed slacks columnLower[numberPoints_] = 0.0; columnUpper[numberPoints_] = xMeshSize_; objective[numberPoints_] = 1.0e3;; // convexity element[n] = 1.0; index[n++] = 0 + numberRows; starts[numberPoints_+1] = n; columnLower[numberPoints_+1] = 0.0; columnUpper[numberPoints_+1] = xMeshSize_; objective[numberPoints_+1] = 1.0e3;; // convexity element[n] = -1.0; index[n++] = 0 + numberRows; starts[numberPoints_+2] = n; solver->addCols(numberPoints_ + 2, starts, index, element, columnLower, columnUpper, objective); #else solver->addCols(numberPoints_, starts, index, element, columnLower, columnUpper, objective); #endif delete [] columnLower; delete [] columnUpper; delete [] objective; delete [] starts; delete [] index; delete [] element; } // Copy constructor OsiBiLinearEquality::OsiBiLinearEquality ( const OsiBiLinearEquality & rhs) : OsiBiLinear(rhs), numberPoints_(rhs.numberPoints_) { } // Clone OsiObject * OsiBiLinearEquality::clone() const { return new OsiBiLinearEquality(*this); } // Assignment operator OsiBiLinearEquality & OsiBiLinearEquality::operator=( const OsiBiLinearEquality & rhs) { if (this != &rhs) { OsiBiLinear::operator=(rhs); numberPoints_ = rhs.numberPoints_; } return *this; } // Destructor OsiBiLinearEquality::~OsiBiLinearEquality () { } // Possible improvement double OsiBiLinearEquality::improvement(const OsiSolverInterface * solver) const { const double * pi = solver->getRowPrice(); int i; const double * solution = solver->getColSolution(); printf(" for x %d y %d - pi %g %g\n", xColumn_, yColumn_, pi[xRow_], pi[yRow_]); for (i = 0; i < numberPoints_; i++) { if (fabs(solution[i+firstLambda_]) > 1.0e-7) printf("(%d %g) ", i, solution[i+firstLambda_]); } printf("\n"); return 0.0; } /* change grid if type 0 then use solution and make finer if 1 then back to original */ double OsiBiLinearEquality::newGrid(OsiSolverInterface * solver, int type) const { CoinPackedMatrix * matrix = solver->getMutableMatrixByCol(); if (!matrix) { printf("Unable to modify matrix\n"); abort(); } double * element = matrix->getMutableElements(); #ifndef NDEBUG const int * row = matrix->getIndices(); #endif const CoinBigIndex * columnStart = matrix->getVectorStarts(); //const int * columnLength = matrix->getVectorLengths(); // get original bounds double xB[2]; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); xB[0] = lower[xColumn_]; xB[1] = upper[xColumn_]; assert (fabs((xB[1] - xB[0]) - xMeshSize_*(numberPoints_ - 1)) < 1.0e-7); double mesh = 0.0; int i; if (type == 0) { const double * solution = solver->getColSolution(); int first = -1; int last = -1; double xValue = 0.0; double step = 0.0; for (i = 0; i < numberPoints_; i++) { int iColumn = i + firstLambda_; if (fabs(solution[iColumn]) > 1.0e-7) { int k = columnStart[iColumn] + 1; xValue += element[k] * solution[iColumn]; if (first == -1) { first = i; step = -element[k]; } else { step += element[k]; } last = i; } } if (last > first + 1) { printf("not adjacent - presuming small djs\n"); } // new step size assert (numberPoints_ > 2); step = CoinMax((1.5 * step) / static_cast (numberPoints_ - 1), 0.5 * step); xB[0] = CoinMax(xB[0], xValue - 0.5 * step); xB[1] = CoinMin(xB[1], xValue + 0.5 * step); // and now divide these mesh = (xB[1] - xB[0]) / static_cast (numberPoints_ - 1); } else { // back to original mesh = xMeshSize_; } double x = xB[0]; for (i = 0; i < numberPoints_; i++) { int iColumn = i + firstLambda_; double y = coefficient_ / x; //assert (columnLength[iColumn]==3); - could have cuts int k = columnStart[iColumn]; #ifdef KEEPXY // xy assert (row[k] == xyRow_); k++; #endif assert (row[k] == convexity_); k++; double value; // x value = x; assert (row[k] == xRow_); assert (fabs(value) > 1.0e-10); element[k++] = value; // y value = y; assert (row[k] == yRow_); assert (fabs(value) > 1.0e-10); element[k++] = value; x += mesh; } return mesh; } /** Default Constructor Equivalent to an unspecified binary variable. */ OsiSimpleFixedInteger::OsiSimpleFixedInteger () : OsiSimpleInteger() { } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ OsiSimpleFixedInteger::OsiSimpleFixedInteger (const OsiSolverInterface * solver, int iColumn) : OsiSimpleInteger(solver, iColumn) { } // Useful constructor - passed solver index and original bounds OsiSimpleFixedInteger::OsiSimpleFixedInteger ( int iColumn, double lower, double upper) : OsiSimpleInteger(iColumn, lower, upper) { } // Useful constructor - passed simple integer OsiSimpleFixedInteger::OsiSimpleFixedInteger ( const OsiSimpleInteger &rhs) : OsiSimpleInteger(rhs) { } // Copy constructor OsiSimpleFixedInteger::OsiSimpleFixedInteger ( const OsiSimpleFixedInteger & rhs) : OsiSimpleInteger(rhs) { } // Clone OsiObject * OsiSimpleFixedInteger::clone() const { return new OsiSimpleFixedInteger(*this); } // Assignment operator OsiSimpleFixedInteger & OsiSimpleFixedInteger::operator=( const OsiSimpleFixedInteger & rhs) { if (this != &rhs) { OsiSimpleInteger::operator=(rhs); } return *this; } // Destructor OsiSimpleFixedInteger::~OsiSimpleFixedInteger () { } // Infeasibility - large is 0.5 double OsiSimpleFixedInteger::infeasibility(const OsiBranchingInformation * info, int & whichWay) const { double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); double nearest = floor(value + (1.0 - 0.5)); if (nearest > value) { whichWay = 1; } else { whichWay = 0; } infeasibility_ = fabs(value - nearest); bool satisfied = false; if (infeasibility_ <= info->integerTolerance_) { otherInfeasibility_ = 1.0; satisfied = true; if (info->lower_[columnNumber_] != info->upper_[columnNumber_]) infeasibility_ = 1.0e-5; else infeasibility_ = 0.0; } else if (info->defaultDual_ < 0.0) { otherInfeasibility_ = 1.0 - infeasibility_; } else { const double * pi = info->pi_; const double * activity = info->rowActivity_; const double * lower = info->rowLower_; const double * upper = info->rowUpper_; const double * element = info->elementByColumn_; const int * row = info->row_; const CoinBigIndex * columnStart = info->columnStart_; const int * columnLength = info->columnLength_; double direction = info->direction_; double downMovement = value - floor(value); double upMovement = 1.0 - downMovement; double valueP = info->objective_[columnNumber_] * direction; CoinBigIndex start = columnStart[columnNumber_]; CoinBigIndex end = start + columnLength[columnNumber_]; double upEstimate = 0.0; double downEstimate = 0.0; if (valueP > 0.0) upEstimate = valueP * upMovement; else downEstimate -= valueP * downMovement; double tolerance = info->primalTolerance_; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; if (lower[iRow] < -1.0e20) assert (pi[iRow] <= 1.0e-3); if (upper[iRow] > 1.0e20) assert (pi[iRow] >= -1.0e-3); valueP = pi[iRow] * direction; double el2 = element[j]; double value2 = valueP * el2; double u = 0.0; double d = 0.0; if (value2 > 0.0) u = value2; else d = -value2; // if up makes infeasible then make at least default double newUp = activity[iRow] + upMovement * el2; if (newUp > upper[iRow] + tolerance || newUp < lower[iRow] - tolerance) u = CoinMax(u, info->defaultDual_); upEstimate += u * upMovement * fabs(el2); // if down makes infeasible then make at least default double newDown = activity[iRow] - downMovement * el2; if (newDown > upper[iRow] + tolerance || newDown < lower[iRow] - tolerance) d = CoinMax(d, info->defaultDual_); downEstimate += d * downMovement * fabs(el2); } if (downEstimate >= upEstimate) { infeasibility_ = CoinMax(1.0e-12, upEstimate); otherInfeasibility_ = CoinMax(1.0e-12, downEstimate); whichWay = 1; } else { infeasibility_ = CoinMax(1.0e-12, downEstimate); otherInfeasibility_ = CoinMax(1.0e-12, upEstimate); whichWay = 0; } } if (preferredWay_ >= 0 && !satisfied) whichWay = preferredWay_; whichWay_ = static_cast(whichWay); return infeasibility_; } // Creates a branching object OsiBranchingObject * OsiSimpleFixedInteger::createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const { double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); assert (info->upper_[columnNumber_] > info->lower_[columnNumber_]); double nearest = floor(value + 0.5); double integerTolerance = info->integerTolerance_; if (fabs(value - nearest) < integerTolerance) { // adjust value if (nearest != info->upper_[columnNumber_]) value = nearest + 2.0 * integerTolerance; else value = nearest - 2.0 * integerTolerance; } OsiBranchingObject * branch = new OsiIntegerBranchingObject(solver, this, way, value); return branch; } #include #include #include #include #include #include //#define CGL_DEBUG 2 #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "OsiRowCutDebugger.hpp" #include "CoinWarmStartBasis.hpp" //#include "CglTemporary.hpp" #include "CoinFinite.hpp" //------------------------------------------------------------------- // Generate Stored cuts //------------------------------------------------------------------- void CglTemporary::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo /*info*/) { // Get basic problem information const double * solution = si.getColSolution(); int numberRowCuts = cuts_.sizeRowCuts(); for (int i = 0; i < numberRowCuts; i++) { const OsiRowCut * rowCutPointer = cuts_.rowCutPtr(i); double violation = rowCutPointer->violated(solution); if (violation >= requiredViolation_) cs.insert(*rowCutPointer); } // delete cuts_ = OsiCuts(); } //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CglTemporary::CglTemporary () : CglStored() { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CglTemporary::CglTemporary (const CglTemporary & source) : CglStored(source) { } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CglCutGenerator * CglTemporary::clone() const { return new CglTemporary(*this); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CglTemporary::~CglTemporary () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CglTemporary & CglTemporary::operator=(const CglTemporary & rhs) { if (this != &rhs) { CglStored::operator=(rhs); } return *this; } void checkQP(ClpSimplex * /*model*/) { #ifdef JJF_ZERO printf("Checking quadratic model %x\n", model); if (model) { ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(model->objectiveAsObject())); assert (quadraticObj); CoinPackedMatrix * quadraticObjective = quadraticObj->quadraticObjective(); int numberColumns = quadraticObj->numberColumns(); const int * columnQuadratic = quadraticObjective->getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticObjective->getVectorStarts(); const int * columnQuadraticLength = quadraticObjective->getVectorLengths(); //const double * quadraticElement = quadraticObjective->getElements(); for (int i = 0; i < numberColumns; i++) { for (int j = columnQuadraticStart[i]; j < columnQuadraticStart[i] + columnQuadraticLength[i]; j++) assert (columnQuadratic[j] >= 0 && columnQuadratic[j] < 1000); } } #endif } //############################################################################# // Solve methods //############################################################################# void OsiSolverLinearizedQuadratic::initialSolve() { OsiClpSolverInterface::initialSolve(); int secondaryStatus = modelPtr_->secondaryStatus(); if (modelPtr_->status() == 0 && (secondaryStatus == 2 || secondaryStatus == 4)) modelPtr_->cleanup(1); if (isProvenOptimal() && modelPtr_->numberColumns() == quadraticModel_->numberColumns()) { // see if qp can get better solution const double * solution = modelPtr_->primalColumnSolution(); int numberColumns = modelPtr_->numberColumns(); bool satisfied = true; for (int i = 0; i < numberColumns; i++) { if (isInteger(i)) { double value = solution[i]; if (fabs(value - floor(value + 0.5)) > 1.0e-6) { satisfied = false; break; } } } if (satisfied) { checkQP(quadraticModel_); ClpSimplex qpTemp(*quadraticModel_); checkQP(&qpTemp); double * lower = qpTemp.columnLower(); double * upper = qpTemp.columnUpper(); double * lower2 = modelPtr_->columnLower(); double * upper2 = modelPtr_->columnUpper(); for (int i = 0; i < numberColumns; i++) { if (isInteger(i)) { double value = floor(solution[i] + 0.5); lower[i] = value; upper[i] = value; } else { lower[i] = lower2[i]; upper[i] = upper2[i]; } } //qpTemp.writeMps("bad.mps"); //modelPtr_->writeMps("bad2.mps"); //qpTemp.objectiveAsObject()->setActivated(0); //qpTemp.primal(); //qpTemp.objectiveAsObject()->setActivated(1); qpTemp.primal(); //assert (!qpTemp.problemStatus()); if (qpTemp.objectiveValue() < bestObjectiveValue_ && !qpTemp.problemStatus()) { delete [] bestSolution_; bestSolution_ = CoinCopyOfArray(qpTemp.primalColumnSolution(), numberColumns); bestObjectiveValue_ = qpTemp.objectiveValue(); printf("better qp objective of %g\n", bestObjectiveValue_); } } } } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiSolverLinearizedQuadratic::OsiSolverLinearizedQuadratic () : OsiClpSolverInterface() { bestObjectiveValue_ = COIN_DBL_MAX; bestSolution_ = NULL; specialOptions3_ = 0; quadraticModel_ = NULL; } OsiSolverLinearizedQuadratic::OsiSolverLinearizedQuadratic ( ClpSimplex * quadraticModel) : OsiClpSolverInterface(new ClpSimplex(*quadraticModel), true) { bestObjectiveValue_ = COIN_DBL_MAX; bestSolution_ = NULL; specialOptions3_ = 0; quadraticModel_ = new ClpSimplex(*quadraticModel); // linearize int numberColumns = modelPtr_->numberColumns(); const double * solution = modelPtr_->primalColumnSolution(); // Replace objective ClpObjective * trueObjective = modelPtr_->objectiveAsObject(); ClpObjective * objective = new ClpLinearObjective(NULL, numberColumns); modelPtr_->setObjectivePointer(objective); double offset; double saveOffset = modelPtr_->objectiveOffset(); memcpy(modelPtr_->objective(), trueObjective->gradient(modelPtr_, solution, offset, true, 2), numberColumns*sizeof(double)); modelPtr_->setObjectiveOffset(saveOffset + offset); delete trueObjective; checkQP(quadraticModel_); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * OsiSolverLinearizedQuadratic::clone(bool /*copyData*/) const { //assert (copyData); return new OsiSolverLinearizedQuadratic(*this); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiSolverLinearizedQuadratic::OsiSolverLinearizedQuadratic ( const OsiSolverLinearizedQuadratic & rhs) : OsiSolverInterface(rhs) , OsiClpSolverInterface(rhs) { bestObjectiveValue_ = rhs.bestObjectiveValue_; if (rhs.bestSolution_) { bestSolution_ = CoinCopyOfArray(rhs.bestSolution_, modelPtr_->numberColumns()); } else { bestSolution_ = NULL; } specialOptions3_ = rhs.specialOptions3_; if (rhs.quadraticModel_) { quadraticModel_ = new ClpSimplex(*rhs.quadraticModel_); } else { quadraticModel_ = NULL; } checkQP(rhs.quadraticModel_); checkQP(quadraticModel_); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiSolverLinearizedQuadratic::~OsiSolverLinearizedQuadratic () { delete [] bestSolution_; delete quadraticModel_; } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiSolverLinearizedQuadratic & OsiSolverLinearizedQuadratic::operator=(const OsiSolverLinearizedQuadratic & rhs) { if (this != &rhs) { delete [] bestSolution_; delete quadraticModel_; OsiClpSolverInterface::operator=(rhs); bestObjectiveValue_ = rhs.bestObjectiveValue_; if (rhs.bestSolution_) { bestSolution_ = CoinCopyOfArray(rhs.bestSolution_, modelPtr_->numberColumns()); } else { bestSolution_ = NULL; } specialOptions3_ = rhs.specialOptions3_; if (rhs.quadraticModel_) { quadraticModel_ = new ClpSimplex(*rhs.quadraticModel_); } else { quadraticModel_ = NULL; } checkQP(rhs.quadraticModel_); checkQP(quadraticModel_); } return *this; } /* Expands out all possible combinations for a knapsack If buildObj NULL then just computes space needed - returns number elements On entry numberOutput is maximum allowed, on exit it is number needed or -1 (as will be number elements) if maximum exceeded. numberOutput will have at least space to return values which reconstruct input. Rows returned will be original rows but no entries will be returned for any rows all of whose entries are in knapsack. So up to user to allow for this. If reConstruct >=0 then returns number of entrie which make up item "reConstruct" in expanded knapsack. Values in buildRow and buildElement; */ int CoinModel::expandKnapsack(int knapsackRow, int & numberOutput, double * buildObj, CoinBigIndex * buildStart, int * buildRow, double * buildElement, int reConstruct) const { /* mark rows -2 in knapsack and other variables -1 not involved 0 only in knapsack */ int * markRow = new int [numberRows_]; int iRow; int iColumn; int * whichColumn = new int [numberColumns_]; for (iColumn = 0; iColumn < numberColumns_; iColumn++) whichColumn[iColumn] = -1; int numJ = 0; for (iRow = 0; iRow < numberRows_; iRow++) markRow[iRow] = -1; CoinModelLink triple; triple = firstInRow(knapsackRow); while (triple.column() >= 0) { int iColumn = triple.column(); #ifndef NDEBUG const char * el = getElementAsString(knapsackRow, iColumn); assert (!strcmp("Numeric", el)); #endif whichColumn[iColumn] = numJ; numJ++; triple = next(triple); } for (iRow = 0; iRow < numberRows_; iRow++) { triple = firstInRow(iRow); int type = -3; while (triple.column() >= 0) { int iColumn = triple.column(); if (whichColumn[iColumn] >= 0) { if (type == -3) type = 0; else if (type != 0) type = -2; } else { if (type == -3) type = -1; else if (type == 0) type = -2; } triple = next(triple); } if (type == -3) type = -1; markRow[iRow] = type; } int * bound = new int [numberColumns_+1]; int * whichRow = new int [numberRows_]; ClpSimplex tempModel; CoinModel tempModel2(*this); tempModel.loadProblem(tempModel2); int * stack = new int [numberColumns_+1]; double * size = new double [numberColumns_+1]; double * rhsOffset = new double[numberRows_]; int * build = new int[numberColumns_]; int maxNumber = numberOutput; numJ = 0; double minSize = getRowLower(knapsackRow); double maxSize = getRowUpper(knapsackRow); double offset = 0.0; triple = firstInRow(knapsackRow); while (triple.column() >= 0) { iColumn = triple.column(); double lowerColumn = columnLower(iColumn); double upperColumn = columnUpper(iColumn); double gap = upperColumn - lowerColumn; if (gap > 1.0e8) gap = 1.0e8; assert (fabs(floor(gap + 0.5) - gap) < 1.0e-5); whichColumn[numJ] = iColumn; bound[numJ] = static_cast (gap); size[numJ++] = triple.value(); offset += triple.value() * lowerColumn; triple = next(triple); } int jRow; for (iRow = 0; iRow < numberRows_; iRow++) whichRow[iRow] = iRow; ClpSimplex smallModel(&tempModel, numberRows_, whichRow, numJ, whichColumn, true, true, true); // modify rhs to allow for nonzero lower bounds double * rowLower = smallModel.rowLower(); double * rowUpper = smallModel.rowUpper(); const double * columnLower = smallModel.columnLower(); //const double * columnUpper = smallModel.columnUpper(); const CoinPackedMatrix * matrix = smallModel.matrix(); const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * objective = smallModel.objective(); double objectiveOffset = 0.0; CoinZeroN(rhsOffset, numberRows_); for (iColumn = 0; iColumn < numJ; iColumn++) { double lower = columnLower[iColumn]; if (lower) { objectiveOffset += objective[iColumn]; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { double value = element[j] * lower; int kRow = row[j]; rhsOffset[kRow] += value; if (rowLower[kRow] > -1.0e20) rowLower[kRow] -= value; if (rowUpper[kRow] < 1.0e20) rowUpper[kRow] -= value; } } } // relax for (jRow = 0; jRow < numberRows_; jRow++) { if (markRow[jRow] == 0 && knapsackRow != jRow) { if (rowLower[jRow] > -1.0e20) rowLower[jRow] -= 1.0e-7; if (rowUpper[jRow] < 1.0e20) rowUpper[jRow] += 1.0e-7; } else { rowLower[jRow] = -COIN_DBL_MAX; rowUpper[jRow] = COIN_DBL_MAX; } } double * rowActivity = smallModel.primalRowSolution(); CoinZeroN(rowActivity, numberRows_); maxSize -= offset; minSize -= offset; // now generate int i; int iStack = numJ; for (i = 0; i < numJ; i++) { stack[i] = 0; } double tooMuch = 10.0 * maxSize; stack[numJ] = 1; size[numJ] = tooMuch; bound[numJ] = 0; double sum = tooMuch; numberOutput = 0; int nelCreate = 0; /* typeRun is - 0 for initial sizes 1 for build 2 for reconstruct */ int typeRun = buildObj ? 1 : 0; if (reConstruct >= 0) { assert (buildRow && buildElement); typeRun = 2; } if (typeRun == 1) buildStart[0] = 0; while (iStack >= 0) { if (sum >= minSize && sum <= maxSize) { double checkSize = 0.0; bool good = true; int nRow = 0; double obj = objectiveOffset; // nRow is zero? CoinZeroN(rowActivity,nRow); for (iColumn = 0; iColumn < numJ; iColumn++) { int iValue = stack[iColumn]; if (iValue > bound[iColumn]) { good = false; break; } else if (iValue) { obj += objective[iColumn] * iValue; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { double value = element[j] * iValue; int kRow = row[j]; if (rowActivity[kRow]) { rowActivity[kRow] += value; if (!rowActivity[kRow]) rowActivity[kRow] = 1.0e-100; } else { build[nRow++] = kRow; rowActivity[kRow] = value; } } } } if (good) { for (jRow = 0; jRow < nRow; jRow++) { int kRow = build[jRow]; double value = rowActivity[kRow]; if (value > rowUpper[kRow] || value < rowLower[kRow]) { good = false; break; } } } if (good) { if (typeRun == 1) { buildObj[numberOutput] = obj; for (jRow = 0; jRow < nRow; jRow++) { int kRow = build[jRow]; double value = rowActivity[kRow]; if (markRow[kRow] < 0 && fabs(value) > 1.0e-13) { buildElement[nelCreate] = value; buildRow[nelCreate++] = kRow; } } buildStart[numberOutput+1] = nelCreate; } else if (!typeRun) { for (jRow = 0; jRow < nRow; jRow++) { int kRow = build[jRow]; double value = rowActivity[kRow]; if (markRow[kRow] < 0 && fabs(value) > 1.0e-13) { nelCreate++; } } } if (typeRun == 2 && reConstruct == numberOutput) { // build and exit nelCreate = 0; for (iColumn = 0; iColumn < numJ; iColumn++) { int iValue = stack[iColumn]; if (iValue) { buildRow[nelCreate] = whichColumn[iColumn]; buildElement[nelCreate++] = iValue; } } numberOutput = 1; for (i = 0; i < numJ; i++) { bound[i] = 0; } break; } numberOutput++; if (numberOutput > maxNumber) { nelCreate = -1; numberOutput = -1; for (i = 0; i < numJ; i++) { bound[i] = 0; } break; } else if (typeRun == 1 && numberOutput == maxNumber) { // On second run for (i = 0; i < numJ; i++) { bound[i] = 0; } break; } for (int j = 0; j < numJ; j++) { checkSize += stack[j] * size[j]; } assert (fabs(sum - checkSize) < 1.0e-3); } for (jRow = 0; jRow < nRow; jRow++) { int kRow = build[jRow]; rowActivity[kRow] = 0.0; } } if (sum > maxSize || stack[iStack] > bound[iStack]) { sum -= size[iStack] * stack[iStack]; stack[iStack--] = 0; if (iStack >= 0) { stack[iStack] ++; sum += size[iStack]; } } else { // must be less // add to last possible iStack = numJ - 1; sum += size[iStack]; stack[iStack]++; } } //printf("%d will be created\n",numberOutput); delete [] whichColumn; delete [] whichRow; delete [] bound; delete [] stack; delete [] size; delete [] rhsOffset; delete [] build; delete [] markRow; return nelCreate; } #include "ClpConstraint.hpp" #include "ClpConstraintLinear.hpp" #include "ClpConstraintQuadratic.hpp" #ifdef COIN_HAS_ASL //#include "ClpAmplObjective.hpp" #endif /* Return an approximate solution to a CoinModel. Lots of bounds may be odd to force a solution. mode = 0 just tries to get a continuous solution */ ClpSimplex * approximateSolution(CoinModel & coinModel, int numberPasses, double deltaTolerance, int /*mode*/) { #ifndef JJF_ONE //#ifdef COIN_HAS_ASL // matrix etc will be changed CoinModel coinModel2 = coinModel; if (coinModel2.moreInfo()) { // for now just ampl objective ClpSimplex * model = new ClpSimplex(); model->loadProblem(coinModel2); int numberConstraints; ClpConstraint ** constraints = NULL; int type = model->loadNonLinear(coinModel2.moreInfo(), numberConstraints, constraints); if (type == 1 || type == 3) { model->nonlinearSLP(numberPasses, deltaTolerance); } else if (type == 2 || type == 4) { model->nonlinearSLP(numberConstraints, constraints, numberPasses, deltaTolerance); } else { printf("error or linear - fix %d\n", type); } //exit(66); return model; } // first check and set up arrays int numberColumns = coinModel.numberColumns(); int numberRows = coinModel.numberRows(); // List of nonlinear rows int * which = new int[numberRows]; bool testLinear = false; int numberConstraints = 0; int iColumn; bool linearObjective = true; int maximumQuadraticElements = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { // See if quadratic objective const char * expr = coinModel.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { linearObjective = false; // check if value*x+-value*y.... assert (strlen(expr) < 20000); char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel); // must be column unless first when may be linear term if (jColumn >= 0) { maximumQuadraticElements++; } else if (jColumn != -2) { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } } if (!linearObjective) { // zero objective for (iColumn = 0; iColumn < numberColumns; iColumn++) coinModel2.setObjective(iColumn, 0.0); } int iRow; for (iRow = 0; iRow < numberRows; iRow++) { int numberQuadratic = 0; bool linear = true; CoinModelLink triple = coinModel.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); const char * expr = coinModel.getElementAsString(iRow, iColumn); if (strcmp("Numeric", expr)) { linear = false; // check if value*x+-value*y.... assert (strlen(expr) < 20000); char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel); // must be column unless first when may be linear term if (jColumn >= 0) { numberQuadratic++; } else if (jColumn != -2) { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } triple = coinModel.next(triple); } if (!linear || testLinear) { CoinModelLink triple = coinModel.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); coinModel2.setElement(iRow, iColumn, 0.0); triple = coinModel.next(triple); } which[numberConstraints++] = iRow; maximumQuadraticElements = CoinMax(maximumQuadraticElements, numberQuadratic); } } ClpSimplex * model = new ClpSimplex(); // return if nothing if (!numberConstraints && linearObjective) { delete [] which; model->loadProblem(coinModel); model->dual(); return model; } // space for quadratic // allow for linear term maximumQuadraticElements += numberColumns; CoinBigIndex * startQuadratic = new CoinBigIndex [numberColumns+1]; int * columnQuadratic = new int [maximumQuadraticElements]; double * elementQuadratic = new double [maximumQuadraticElements]; ClpConstraint ** constraints = new ClpConstraint * [numberConstraints]; double * linearTerm = new double [numberColumns]; int saveNumber = numberConstraints; numberConstraints = 0; ClpQuadraticObjective * quadObj = NULL; if (!linearObjective) { int numberQuadratic = 0; CoinZeroN(linearTerm, numberColumns); for (iColumn = 0; iColumn < numberColumns; iColumn++) { startQuadratic[iColumn] = numberQuadratic; // See if quadratic objective const char * expr = coinModel.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { // value*x*y char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel); // must be column unless first when may be linear term if (jColumn >= 0) { columnQuadratic[numberQuadratic] = jColumn; if (jColumn != iColumn) elementQuadratic[numberQuadratic++] = 1.0 * value; // convention else if (jColumn == iColumn) elementQuadratic[numberQuadratic++] = 2.0 * value; // convention } else if (jColumn == -2) { linearTerm[iColumn] = value; } else { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } else { // linear part linearTerm[iColumn] = coinModel.getColumnObjective(iColumn); } } startQuadratic[numberColumns] = numberQuadratic; quadObj = new ClpQuadraticObjective(linearTerm, numberColumns, startQuadratic, columnQuadratic, elementQuadratic); } int iConstraint; for (iConstraint = 0; iConstraint < saveNumber; iConstraint++) { iRow = which[iConstraint]; if (iRow >= 0) { int numberQuadratic = 0; int lastColumn = -1; int largestColumn = -1; CoinZeroN(linearTerm, numberColumns); CoinModelLink triple = coinModel.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); while (lastColumn < iColumn) { startQuadratic[lastColumn+1] = numberQuadratic; lastColumn++; } const char * expr = coinModel.getElementAsString(iRow, iColumn); if (strcmp("Numeric", expr)) { largestColumn = CoinMax(largestColumn, iColumn); // value*x*y char temp[20000]; strcpy(temp, expr); char * pos = temp; bool ifFirst = true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst, coinModel); // must be column unless first when may be linear term if (jColumn >= 0) { columnQuadratic[numberQuadratic] = jColumn; if (jColumn == iColumn) elementQuadratic[numberQuadratic++] = 2.0 * value; // convention else elementQuadratic[numberQuadratic++] = 1.0 * value; // convention largestColumn = CoinMax(largestColumn, jColumn); } else if (jColumn == -2) { linearTerm[iColumn] = value; // and put in as row -1 columnQuadratic[numberQuadratic] = -1; if (jColumn == iColumn) elementQuadratic[numberQuadratic++] = 2.0 * value; // convention else elementQuadratic[numberQuadratic++] = 1.0 * value; // convention largestColumn = CoinMax(largestColumn, iColumn); } else { printf("bad nonlinear term %s\n", temp); abort(); } ifFirst = false; } } else { // linear part linearTerm[iColumn] = coinModel.getElement(iRow, iColumn); // and put in as row -1 columnQuadratic[numberQuadratic] = -1; elementQuadratic[numberQuadratic++] = linearTerm[iColumn]; if (linearTerm[iColumn]) largestColumn = CoinMax(largestColumn, iColumn); } triple = coinModel.next(triple); } while (lastColumn < numberColumns) { startQuadratic[lastColumn+1] = numberQuadratic; lastColumn++; } // here we create ClpConstraint if (testLinear) { int n = 0; int * indices = new int[numberColumns]; for (int j = 0; j < numberColumns; j++) { if (linearTerm[j]) { linearTerm[n] = linearTerm[j]; indices[n++] = j; } } /// Constructor from constraint constraints[numberConstraints++] = new ClpConstraintLinear(iRow, n, numberColumns, indices, linearTerm); delete [] indices; } else { constraints[numberConstraints++] = new ClpConstraintQuadratic(iRow, largestColumn + 1, numberColumns, startQuadratic, columnQuadratic, elementQuadratic); } } } delete [] startQuadratic; delete [] columnQuadratic; delete [] elementQuadratic; delete [] linearTerm; delete [] which; model->loadProblem(coinModel2); if (quadObj) model->setObjective(quadObj); delete quadObj; #ifndef NDEBUG int returnCode; if (numberConstraints) { returnCode = model->nonlinearSLP(numberConstraints, constraints, numberPasses, deltaTolerance); for (iConstraint = 0; iConstraint < saveNumber; iConstraint++) delete constraints[iConstraint]; } else { returnCode = model->nonlinearSLP(numberPasses, deltaTolerance); } assert (!returnCode); #else if (numberConstraints) { model->nonlinearSLP(numberConstraints, constraints, numberPasses, deltaTolerance); for (iConstraint = 0; iConstraint < saveNumber; iConstraint++) delete constraints[iConstraint]; } else { model->nonlinearSLP(numberPasses, deltaTolerance); } #endif delete [] constraints; return model; #else printf("loadNonLinear needs ampl\n"); abort(); return NULL; #endif } OsiChooseStrongSubset::OsiChooseStrongSubset() : OsiChooseStrong(), numberObjectsToUse_(0) { } OsiChooseStrongSubset::OsiChooseStrongSubset(const OsiSolverInterface * solver) : OsiChooseStrong(solver), numberObjectsToUse_(-1) { } OsiChooseStrongSubset::OsiChooseStrongSubset(const OsiChooseStrongSubset & rhs) : OsiChooseStrong(rhs) { numberObjectsToUse_ = -1; } OsiChooseStrongSubset & OsiChooseStrongSubset::operator=(const OsiChooseStrongSubset & rhs) { if (this != &rhs) { OsiChooseStrong::operator=(rhs); numberObjectsToUse_ = -1; } return *this; } OsiChooseStrongSubset::~OsiChooseStrongSubset () { } // Clone OsiChooseVariable * OsiChooseStrongSubset::clone() const { return new OsiChooseStrongSubset(*this); } // Initialize int OsiChooseStrongSubset::setupList ( OsiBranchingInformation *info, bool initialize) { assert (solver_ == info->solver_); // Only has to work with Clp OsiSolverInterface * solverA = const_cast (solver_); OsiSolverLink * solver = dynamic_cast (solverA); assert (solver); int numberObjects = solver->numberObjects(); if (numberObjects > pseudoCosts_.numberObjects()) { // redo useful arrays pseudoCosts_.initialize(numberObjects); } int numObj = numberObjects; if (numberObjectsToUse_ < 0) { // Sort objects so bilinear at end OsiObject ** sorted = new OsiObject * [numberObjects]; OsiObject ** objects = solver->objects(); numObj = 0; int numberBiLinear = 0; int i; for (i = 0; i < numberObjects; i++) { OsiObject * obj = objects[i]; OsiBiLinear * objB = dynamic_cast (obj); if (!objB) objects[numObj++] = obj; else sorted[numberBiLinear++] = obj; } numberObjectsToUse_ = numObj; for (i = 0; i < numberBiLinear; i++) objects[numObj++] = sorted[i]; delete [] sorted; // See if any master objects for (i = 0; i < numberObjectsToUse_; i++) { OsiUsesBiLinear * obj = dynamic_cast (objects[i]); if (obj) obj->addBiLinearObjects(solver); } } solver->setNumberObjects(numberObjectsToUse_); numObj = numberObjectsToUse_; // Use shadow prices //info->defaultDual_=0.0; int numberUnsatisfied = OsiChooseStrong::setupList ( info, initialize); solver->setNumberObjects(numberObjects); numObj = numberObjects; return numberUnsatisfied; } /* Choose a variable Returns - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from whichObject() and whichWay() We can pick up a forced branch (can change bound) from whichForcedObject() and whichForcedWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution() */ int OsiChooseStrongSubset::chooseVariable( OsiSolverInterface * solver, OsiBranchingInformation *info, bool fixVariables) { //int numberObjects = solver->numberObjects(); //solver->setNumberObjects(numberObjectsToUse_); //numberObjects_=numberObjectsToUse_; // Use shadow prices //info->defaultDual_=0.0; int returnCode = OsiChooseStrong::chooseVariable(solver, info, fixVariables); //solver->setNumberObjects(numberObjects); //numberObjects_=numberObjects; return returnCode; } /** Default Constructor Equivalent to an unspecified binary variable. */ OsiUsesBiLinear::OsiUsesBiLinear () : OsiSimpleInteger(), numberBiLinear_(0), type_(0), objects_(NULL) { } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ OsiUsesBiLinear::OsiUsesBiLinear (const OsiSolverInterface * solver, int iColumn, int type) : OsiSimpleInteger(solver, iColumn), numberBiLinear_(0), type_(type), objects_(NULL) { if (type_) { assert(originalLower_ == floor(originalLower_ + 0.5)); assert(originalUpper_ == floor(originalUpper_ + 0.5)); } } // Useful constructor - passed solver index and original bounds OsiUsesBiLinear::OsiUsesBiLinear ( int iColumn, double lower, double upper, int type) : OsiSimpleInteger(iColumn, lower, upper), numberBiLinear_(0), type_(type), objects_(NULL) { if (type_) { assert(originalLower_ == floor(originalLower_ + 0.5)); assert(originalUpper_ == floor(originalUpper_ + 0.5)); } } // Useful constructor - passed simple integer OsiUsesBiLinear::OsiUsesBiLinear ( const OsiSimpleInteger &rhs, int type) : OsiSimpleInteger(rhs), numberBiLinear_(0), type_(type), objects_(NULL) { if (type_) { assert(originalLower_ == floor(originalLower_ + 0.5)); assert(originalUpper_ == floor(originalUpper_ + 0.5)); } } // Copy constructor OsiUsesBiLinear::OsiUsesBiLinear ( const OsiUsesBiLinear & rhs) : OsiSimpleInteger(rhs), numberBiLinear_(0), type_(rhs.type_), objects_(NULL) { } // Clone OsiObject * OsiUsesBiLinear::clone() const { return new OsiUsesBiLinear(*this); } // Assignment operator OsiUsesBiLinear & OsiUsesBiLinear::operator=( const OsiUsesBiLinear & rhs) { if (this != &rhs) { OsiSimpleInteger::operator=(rhs); delete [] objects_; numberBiLinear_ = 0; type_ = rhs.type_; objects_ = NULL; } return *this; } // Destructor OsiUsesBiLinear::~OsiUsesBiLinear () { delete [] objects_; } // Infeasibility - large is 0.5 double OsiUsesBiLinear::infeasibility(const OsiBranchingInformation * info, int & whichWay) const { assert (type_ == 0); // just continuous for now double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); infeasibility_ = 0.0; for (int i = 0; i < numberBiLinear_; i++) { OsiBiLinear * obj = dynamic_cast (objects_[i]); assert (obj); //obj->getPseudoShadow(info); //infeasibility_ += objects_[i]->infeasibility(info,whichWay); infeasibility_ += obj->getMovement(info); } bool satisfied = false; whichWay = -1; if (!infeasibility_) { otherInfeasibility_ = 1.0; satisfied = true; infeasibility_ = 0.0; } else { otherInfeasibility_ = 10.0 * infeasibility_; if (value - info->lower_[columnNumber_] > info->upper_[columnNumber_] - value) whichWay = 1; else whichWay = -1; } if (preferredWay_ >= 0 && !satisfied) whichWay = preferredWay_; whichWay_ = static_cast(whichWay); return infeasibility_; } // Creates a branching object OsiBranchingObject * OsiUsesBiLinear::createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const { double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); assert (info->upper_[columnNumber_] > info->lower_[columnNumber_]); double nearest = floor(value + 0.5); double integerTolerance = info->integerTolerance_; if (fabs(value - nearest) < integerTolerance) { // adjust value if (nearest != info->upper_[columnNumber_]) value = nearest + 2.0 * integerTolerance; else value = nearest - 2.0 * integerTolerance; } OsiBranchingObject * branch = new OsiIntegerBranchingObject(solver, this, way, value, value, value); return branch; } // This looks at solution and sets bounds to contain solution /** More precisely: it first forces the variable within the existing bounds, and then tightens the bounds to fix the variable at the nearest integer value. */ double OsiUsesBiLinear::feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const { double value = info->solution_[columnNumber_]; double newValue = CoinMax(value, info->lower_[columnNumber_]); newValue = CoinMin(newValue, info->upper_[columnNumber_]); solver->setColLower(columnNumber_, newValue); solver->setColUpper(columnNumber_, newValue); return fabs(value - newValue); } // Add all bi-linear objects void OsiUsesBiLinear::addBiLinearObjects(OsiSolverLink * solver) { delete [] objects_; numberBiLinear_ = 0; OsiObject ** objects = solver->objects(); int i; int numberObjects = solver->numberObjects(); for (i = 0; i < numberObjects; i++) { OsiObject * obj = objects[i]; OsiBiLinear * objB = dynamic_cast (obj); if (objB) { if (objB->xColumn() == columnNumber_ || objB->yColumn() == columnNumber_) numberBiLinear_++; } } if (numberBiLinear_) { objects_ = new OsiObject * [numberBiLinear_]; numberBiLinear_ = 0; for (i = 0; i < numberObjects; i++) { OsiObject * obj = objects[i]; OsiBiLinear * objB = dynamic_cast (obj); if (objB) { if (objB->xColumn() == columnNumber_ || objB->yColumn() == columnNumber_) objects_[numberBiLinear_++] = obj;; } } } else { objects_ = NULL; } } CoinMP-1.8.3/Cbc/src/CbcStatistics.hpp0000644000175000017500000000502311510742604016045 0ustar renerene/* $Id: CbcStatistics.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcStatistics_H #define CbcStatistics_H #include "CbcModel.hpp" /** For gathering statistics */ class CbcStatistics { public: // Default Constructor CbcStatistics (); // Branch CbcStatistics(CbcNode * node, CbcModel * model); ~CbcStatistics(); // Copy CbcStatistics(const CbcStatistics & rhs); // Assignment CbcStatistics& operator=(const CbcStatistics & rhs); // Update at end of branch void endOfBranch(int numberIterations, double objectiveValue); // Update number of infeasibilities void updateInfeasibility(int numberInfeasibilities); // Branch found to be infeasible by chooseBranch void sayInfeasible(); // Just prints void print(const int * sequenceLookup = NULL) const; // Node number inline int node() const { return id_; } // Parent node number inline int parentNode() const { return parentId_; } // depth inline int depth() const { return depth_; } // way inline int way() const { return way_; } // value inline double value() const { return value_; } // starting objective inline double startingObjective() const { return startingObjective_; } // Unsatisfied at beginning inline int startingInfeasibility() const { return startingInfeasibility_; } // starting objective inline double endingObjective() const { return endingObjective_; } // Unsatisfied at end inline int endingInfeasibility() const { return endingInfeasibility_; } // Number iterations inline int numberIterations() const { return numberIterations_; } protected: // Data /// Value double value_; /// Starting objective double startingObjective_; /// Ending objective double endingObjective_; /// id int id_; /// parent id int parentId_; /// way -1 or +1 is first branch -10 or +10 is second branch int way_; /// sequence number branched on int sequence_; /// depth int depth_; /// starting number of integer infeasibilities int startingInfeasibility_; /// ending number of integer infeasibilities int endingInfeasibility_; /// number of iterations int numberIterations_; }; #endif CoinMP-1.8.3/Cbc/src/CbcStrategy.hpp0000644000175000017500000001640511510742604015523 0ustar renerene/* $Id: CbcStrategy.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcStrategy_H #define CbcStrategy_H #include "CbcModel.hpp" class CglPreProcess; class CbcNodeInfo; class CbcNode; class CoinWarmStartDiff; //############################################################################# /** Strategy base class */ class CbcStrategy { public: // Default Constructor CbcStrategy (); virtual ~CbcStrategy(); /// Clone virtual CbcStrategy * clone() const = 0; /// Setup cut generators virtual void setupCutGenerators(CbcModel & model) = 0; /// Setup heuristics virtual void setupHeuristics(CbcModel & model) = 0; /// Do printing stuff virtual void setupPrinting(CbcModel & model, int modelLogLevel) = 0; /// Other stuff e.g. strong branching and preprocessing virtual void setupOther(CbcModel & model) = 0; /// Set model depth (i.e. how nested) inline void setNested(int depth) { depth_ = depth; } /// Get model depth (i.e. how nested) inline int getNested() const { return depth_; } /// Say preProcessing done inline void setPreProcessState(int state) { preProcessState_ = state; } /// See what sort of preprocessing was done inline int preProcessState() const { return preProcessState_; } /// Pre-processing object inline CglPreProcess * process() const { return process_; } /// Delete pre-processing object to save memory void deletePreProcess(); /// Return a new Full node information pointer (descendant of CbcFullNodeInfo) virtual CbcNodeInfo * fullNodeInfo(CbcModel * model, int numberRowsAtContinuous) const; /// Return a new Partial node information pointer (descendant of CbcPartialNodeInfo) virtual CbcNodeInfo * partialNodeInfo(CbcModel * model, CbcNodeInfo * parent, CbcNode * owner, int numberChangedBounds, const int * variables, const double * boundChanges, const CoinWarmStartDiff *basisDiff) const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} /** After a CbcModel::resolve this can return a status -1 no effect 0 treat as optimal 1 as 0 but do not do any more resolves (i.e. no more cuts) 2 treat as infeasible */ virtual int status(CbcModel * model, CbcNodeInfo * parent, int whereFrom); private: /// Illegal Assignment operator CbcStrategy & operator=(const CbcStrategy& rhs); protected: // Data /// Model depth int depth_; /** PreProcessing state - -1 infeasible 0 off 1 was done (so need post-processing) */ int preProcessState_; /// If preprocessing then this is object CglPreProcess * process_; }; /** Null class */ class CbcStrategyNull : public CbcStrategy { public: // Default Constructor CbcStrategyNull () {} // Copy constructor CbcStrategyNull ( const CbcStrategyNull & rhs) : CbcStrategy(rhs) {} // Destructor ~CbcStrategyNull () {} /// Clone virtual CbcStrategy * clone() const { return new CbcStrategyNull(*this); } /// Setup cut generators virtual void setupCutGenerators(CbcModel & ) {} /// Setup heuristics virtual void setupHeuristics(CbcModel & ) {} /// Do printing stuff virtual void setupPrinting(CbcModel & , int ) {} /// Other stuff e.g. strong branching virtual void setupOther(CbcModel & ) {} protected: // Data private: /// Illegal Assignment operator CbcStrategyNull & operator=(const CbcStrategyNull& rhs); }; /** Default class */ class CbcStrategyDefault : public CbcStrategy { public: // Default Constructor CbcStrategyDefault (int cutsOnlyAtRoot = 1, int numberStrong = 5, int numberBeforeTrust = 0, int printLevel = 0); // Copy constructor CbcStrategyDefault ( const CbcStrategyDefault &); // Destructor ~CbcStrategyDefault (); /// Clone virtual CbcStrategy * clone() const; /// Setup cut generators virtual void setupCutGenerators(CbcModel & model); /// Setup heuristics virtual void setupHeuristics(CbcModel & model); /// Do printing stuff virtual void setupPrinting(CbcModel & model, int modelLogLevel) ; /// Other stuff e.g. strong branching virtual void setupOther(CbcModel & model); /// Set up preProcessing - see below inline void setupPreProcessing(int desired = 1, int passes = 10) { desiredPreProcess_ = desired; preProcessPasses_ = passes; } /// See what sort of preprocessing wanted inline int desiredPreProcess() const { return desiredPreProcess_; } /// See how many passes wanted inline int preProcessPasses() const { return preProcessPasses_; } /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; protected: // Data // Whether to do cuts only at root (-1 -> switch off totally) int cutsOnlyAtRoot_; // How much strong branching to do int numberStrong_; // Number branches needed to trust with dynamic pseudo costs int numberBeforeTrust_; // Print level 0 little, 1 medium int printLevel_; /** Desired pre-processing 0 - none 1 - ordinary 2 - find sos 3 - find cliques 4 - more aggressive sos 5 - add integer slacks */ int desiredPreProcess_; /// Number of pre-processing passes int preProcessPasses_; private: /// Illegal Assignment operator CbcStrategyDefault & operator=(const CbcStrategyDefault& rhs); }; /** Default class for sub trees */ class CbcStrategyDefaultSubTree : public CbcStrategy { public: // Default Constructor CbcStrategyDefaultSubTree (CbcModel * parent = NULL, int cutsOnlyAtRoot = 1, int numberStrong = 5, int numberBeforeTrust = 0, int printLevel = 0); // Copy constructor CbcStrategyDefaultSubTree ( const CbcStrategyDefaultSubTree &); // Destructor ~CbcStrategyDefaultSubTree (); /// Clone virtual CbcStrategy * clone() const; /// Setup cut generators virtual void setupCutGenerators(CbcModel & model); /// Setup heuristics virtual void setupHeuristics(CbcModel & model); /// Do printing stuff virtual void setupPrinting(CbcModel & model, int modelLogLevel) ; /// Other stuff e.g. strong branching virtual void setupOther(CbcModel & model); protected: // Data // Parent model CbcModel * parentModel_; // Whether to do cuts only at root (-1 -> switch off totally) int cutsOnlyAtRoot_; // How much strong branching to do int numberStrong_; // Number branches needed to trust with dynamic pseudo costs int numberBeforeTrust_; // Print level 0 little, 1 medium int printLevel_; private: /// Illegal Assignment operator CbcStrategyDefaultSubTree & operator=(const CbcStrategyDefaultSubTree& rhs); }; #endif CoinMP-1.8.3/Cbc/src/CbcFeasibilityBase.hpp0000644000175000017500000000275311510742604016761 0ustar renerene/* $Id: CbcFeasibilityBase.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcFeasibilityBase_H #define CbcFeasibilityBase_H //############################################################################# /* There are cases where the user wants to control how CBC sees the problems feasibility. The user may want to examine the problem and say : a) The default looks OK b) Pretend this problem is Integer feasible c) Pretend this problem is infeasible even though it looks feasible This simple class allows user to do that. */ class CbcModel; class CbcFeasibilityBase { public: // Default Constructor CbcFeasibilityBase () {} /** On input mode: 0 - called after a solve but before any cuts -1 - called after strong branching Returns : 0 - no opinion -1 pretend infeasible 1 pretend integer solution */ virtual int feasible(CbcModel * , int ) { return 0; } virtual ~CbcFeasibilityBase() {} // Copy constructor CbcFeasibilityBase ( const CbcFeasibilityBase & ) {} // Assignment operator CbcFeasibilityBase & operator=( const CbcFeasibilityBase& ) { return *this; } /// Clone virtual CbcFeasibilityBase * clone() const { return new CbcFeasibilityBase(*this); } }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicLocal.cpp0000644000175000017500000016631012452506557016642 0ustar renerene/* $Id: CbcHeuristicLocal.cpp 2105 2015-01-05 13:11:11Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristicLocal.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcBranchActual.hpp" #include "CbcStrategy.hpp" #include "CglPreProcess.hpp" // Default Constructor CbcHeuristicLocal::CbcHeuristicLocal() : CbcHeuristic() { numberSolutions_ = 0; swap_ = 0; used_ = NULL; lastRunDeep_ = -1000000; switches_ |= 16; // needs a new solution } // Constructor with model - assumed before cuts CbcHeuristicLocal::CbcHeuristicLocal(CbcModel & model) : CbcHeuristic(model) { numberSolutions_ = 0; swap_ = 0; lastRunDeep_ = -1000000; switches_ |= 16; // needs a new solution // Get a copy of original matrix assert(model.solver()); if (model.solver()->getNumRows()) { matrix_ = *model.solver()->getMatrixByCol(); } int numberColumns = model.solver()->getNumCols(); used_ = new int[numberColumns]; memset(used_, 0, numberColumns*sizeof(int)); } // Destructor CbcHeuristicLocal::~CbcHeuristicLocal () { delete [] used_; } // Clone CbcHeuristic * CbcHeuristicLocal::clone() const { return new CbcHeuristicLocal(*this); } // Create C++ lines to get to current state void CbcHeuristicLocal::generateCpp( FILE * fp) { CbcHeuristicLocal other; fprintf(fp, "0#include \"CbcHeuristicLocal.hpp\"\n"); fprintf(fp, "3 CbcHeuristicLocal heuristicLocal(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicLocal"); if (swap_ != other.swap_) fprintf(fp, "3 heuristicLocal.setSearchType(%d);\n", swap_); else fprintf(fp, "4 heuristicLocal.setSearchType(%d);\n", swap_); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicLocal);\n"); } // Copy constructor CbcHeuristicLocal::CbcHeuristicLocal(const CbcHeuristicLocal & rhs) : CbcHeuristic(rhs), matrix_(rhs.matrix_), numberSolutions_(rhs.numberSolutions_), swap_(rhs.swap_) { if (model_ && rhs.used_) { int numberColumns = model_->solver()->getNumCols(); used_ = CoinCopyOfArray(rhs.used_, numberColumns); } else { used_ = NULL; } } // Assignment operator CbcHeuristicLocal & CbcHeuristicLocal::operator=( const CbcHeuristicLocal & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); matrix_ = rhs.matrix_; numberSolutions_ = rhs.numberSolutions_; swap_ = rhs.swap_; delete [] used_; if (model_ && rhs.used_) { int numberColumns = model_->solver()->getNumCols(); used_ = CoinCopyOfArray(rhs.used_, numberColumns); } else { used_ = NULL; } } return *this; } // Resets stuff if model changes void CbcHeuristicLocal::resetModel(CbcModel * /*model*/) { //CbcHeuristic::resetModel(model); delete [] used_; if (model_ && used_) { int numberColumns = model_->solver()->getNumCols(); used_ = new int[numberColumns]; memset(used_, 0, numberColumns*sizeof(int)); } else { used_ = NULL; } } /* Run a mini-BaB search after fixing all variables not marked as used by solution(). (See comments there for semantics.) Return values are: 1: smallBranchAndBound found a solution 0: everything else The degree of overload as return codes from smallBranchAndBound are folded into 0 is such that it's impossible to distinguish return codes that really require attention from a simple `nothing of interest'. */ // This version fixes stuff and does IP int CbcHeuristicLocal::solutionFix(double & objectiveValue, double * newSolution, const int * /*keep*/) { /* If when is set to off (0), or set to root (1) and we're not at the root, return. If this heuristic discovered the current solution, don't continue. */ numCouldRun_++; // See if to do if (!when() || (when() == 1 && model_->phase() != 1)) return 0; // switched off // Don't do if it was this heuristic which found solution! if (this == model_->lastHeuristic()) return 0; /* Load up a new solver with the solution. Why continuousSolver(), as opposed to solver()? */ OsiSolverInterface * newSolver = model_->continuousSolver()->clone(); const double * colLower = newSolver->getColLower(); //const double * colUpper = newSolver->getColUpper(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); /* The net effect here is that anything that hasn't moved from its lower bound will be fixed at lower bound. See comments in solution() w.r.t. asymmetric treatment of upper and lower bounds. */ int i; int nFix = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); newSolver->setColLower(iColumn, CoinMax(colLower[iColumn], originalLower)); if (!used_[iColumn]) { newSolver->setColUpper(iColumn, colLower[iColumn]); nFix++; } } /* Try a `small' branch-and-bound search. The notion here is that we've fixed a lot of variables and reduced the amount of `free' problem to a point where a small BaB search will suffice to fully explore the remaining problem. This routine will execute integer presolve, then call branchAndBound to do the actual search. */ int returnCode = 0; #ifdef CLP_INVESTIGATE2 printf("Fixing %d out of %d (%d continuous)\n", nFix, numberIntegers, newSolver->getNumCols() - numberIntegers); #endif if (nFix*10 <= numberIntegers) { // see if we can fix more int * which = new int [2*(numberIntegers-nFix)]; int * sort = which + (numberIntegers - nFix); int n = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (used_[iColumn]) { which[n] = iColumn; sort[n++] = used_[iColumn]; } } CoinSort_2(sort, sort + n, which); // only half fixed in total n = CoinMin(n, numberIntegers / 2 - nFix); int allow = CoinMax(numberSolutions_ - 2, sort[0]); int nFix2 = 0; for (i = 0; i < n; i++) { int iColumn = integerVariable[i]; if (used_[iColumn] <= allow) { newSolver->setColUpper(iColumn, colLower[iColumn]); nFix2++; } else { break; } } delete [] which; nFix += nFix2; #ifdef CLP_INVESTIGATE2 printf("Number fixed increased from %d to %d\n", nFix - nFix2, nFix); #endif } if (nFix*10 > numberIntegers) { returnCode = smallBranchAndBound(newSolver, numberNodes_, newSolution, objectiveValue, objectiveValue, "CbcHeuristicLocal"); /* -2 is return due to user event, and -1 is overloaded with what look to be two contradictory meanings. */ if (returnCode < 0) { returnCode = 0; // returned on size int numberColumns = newSolver->getNumCols(); int numberContinuous = numberColumns - numberIntegers; if (numberContinuous > 2*numberIntegers && nFix*10 < numberColumns) { #define LOCAL_FIX_CONTINUOUS #ifdef LOCAL_FIX_CONTINUOUS //const double * colUpper = newSolver->getColUpper(); const double * colLower = newSolver->getColLower(); int nAtLb = 0; //double sumDj=0.0; const double * dj = newSolver->getReducedCost(); double direction = newSolver->getObjSense(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn)) { if (!used_[iColumn]) { //double djValue = dj[iColumn]*direction; nAtLb++; //sumDj += djValue; } } } if (nAtLb) { // fix some continuous double * sort = new double[nAtLb]; int * which = new int [nAtLb]; //double threshold = CoinMax((0.01*sumDj)/static_cast(nAtLb),1.0e-6); int nFix2 = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn)) { if (!used_[iColumn]) { double djValue = dj[iColumn] * direction; if (djValue > 1.0e-6) { sort[nFix2] = -djValue; which[nFix2++] = iColumn; } } } } CoinSort_2(sort, sort + nFix2, which); int divisor = 2; nFix2 = CoinMin(nFix2, (numberColumns - nFix) / divisor); for (int i = 0; i < nFix2; i++) { int iColumn = which[i]; newSolver->setColUpper(iColumn, colLower[iColumn]); } delete [] sort; delete [] which; #ifdef CLP_INVESTIGATE2 printf("%d integers have zero value, and %d continuous fixed at lb\n", nFix, nFix2); #endif returnCode = smallBranchAndBound(newSolver, numberNodes_, newSolution, objectiveValue, objectiveValue, "CbcHeuristicLocal"); if (returnCode < 0) returnCode = 0; // returned on size } #endif } } } /* If the result is complete exploration with a solution (3) or proven infeasibility (2), we could generate a cut (the AI folks would call it a nogood) to prevent us from going down this route in the future. */ if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } delete newSolver; return returnCode; } /* First tries setting a variable to better value. If feasible then tries setting others. If not feasible then tries swaps Returns 1 if solution, 0 if not The main body of this routine implements an O((q^2)/2) brute force search around the current solution, for q = number of integer variables. Call this the inc/dec heuristic. For each integer variable x, first decrement the value. Then, for integer variables x, ..., x, try increment and decrement. If one of these permutations produces a better solution, remember it. Then repeat, with x incremented. If we find a better solution, update our notion of current solution and continue. The net effect is a greedy walk: As each improving pair is found, the current solution is updated and the search continues from this updated solution. Way down at the end, we call solutionFix, which will create a drastically restricted problem based on variables marked as used, then do mini-BaC on the restricted problem. This can occur even if we don't try the inc/dec heuristic. This would be more obvious if the inc/dec heuristic were broken out as a separate routine and solutionFix had a name that reflected where it was headed. The return code of 0 is grossly overloaded, because it maps to a return code of 0 from solutionFix, which is itself grossly overloaded. See comments in solutionFix and in CbcHeuristic::smallBranchAndBound. */ int CbcHeuristicLocal::solution(double & solutionValue, double * betterSolution) { /* Execute only if a new solution has been discovered since the last time we were called. */ numCouldRun_++; // See if frequency kills off idea int swap = swap_%100; int skip = swap_/100; int nodeCount = model_->getNodeCount(); if (nodeCountgetSolutionCount() && (numberSolutions_ == howOftenShallow_ || nodeCount < lastRunDeep_+2*skip)) return 0; howOftenShallow_ = numberSolutions_; numberSolutions_ = model_->getSolutionCount(); if (nodeCount 10*rows). And cost is proportional to number of integer variables --- shouldn't we use that? Why wait until we have more than one solution? */ if ((model_->getNumCols() > 100000 && model_->getNumCols() > 10*model_->getNumRows()) || numberSolutions_ <= 1) return 0; // probably not worth it // worth trying OsiSolverInterface * solver = model_->solver(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); const double * solution = model_->bestSolution(); /* Shouldn't this test be redundant if we've already checked that numberSolutions_ > 1? Stronger: shouldn't this be an assertion? */ if (!solution) return 0; // No solution found yet const double * objective = solver->getObjCoefficients(); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); int numberRows = matrix_.getNumRows(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; double direction = solver->getObjSense(); double newSolutionValue = model_->getObjValue() * direction; int returnCode = 0; numRuns_++; // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Get solution array for heuristic solution int numberColumns = solver->getNumCols(); double * newSolution = new double [numberColumns]; memcpy(newSolution, solution, numberColumns*sizeof(double)); #ifdef LOCAL_FIX_CONTINUOUS // mark continuous used const double * columnLower = solver->getColLower(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!solver->isInteger(iColumn)) { if (solution[iColumn] > columnLower[iColumn] + 1.0e-8) used_[iColumn] = numberSolutions_; } } #endif // way is 1 if down possible, 2 if up possible, 3 if both possible char * way = new char[numberIntegers]; // corrected costs double * cost = new double[numberIntegers]; // for array to mark infeasible rows after iColumn branch char * mark = new char[numberRows]; memset(mark, 0, numberRows); // space to save values so we don't introduce rounding errors double * save = new double[numberRows]; /* Force variables within their original bounds, then to the nearest integer. Overall, we seem to be prepared to cope with noninteger bounds. Is this necessary? Seems like we'd be better off to force the bounds to integrality as part of preprocessing. More generally, why do we need to do this? This solution should have been cleaned and checked when it was accepted as a solution! Once the value is set, decide whether we can move up or down. The only place that used_ is used is in solutionFix; if a variable is not flagged as used, it will be fixed (at lower bound). Why the asymmetric treatment? This makes some sense for binary variables (for which there are only two options). But for general integer variables, why not make a similar test against the original upper bound? */ // clean solution for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double value = newSolution[iColumn]; if (value < originalLower) { value = originalLower; newSolution[iColumn] = value; } else if (value > originalUpper) { value = originalUpper; newSolution[iColumn] = value; } double nearest = floor(value + 0.5); //assert(fabs(value-nearest)<10.0*primalTolerance); value = nearest; newSolution[iColumn] = nearest; // if away from lower bound mark that fact if (nearest > originalLower) { used_[iColumn] = numberSolutions_; } cost[i] = direction * objective[iColumn]; /* Given previous computation we're checking that value is at least 1 away from the original bounds. */ int iway = 0; if (value > originalLower + 0.5) iway = 1; if (value < originalUpper - 0.5) iway |= 2; way[i] = static_cast(iway); } /* Calculate lhs of each constraint for groomed solution. */ // get row activities double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); for (i = 0; i < numberColumns; i++) { int j; double value = newSolution[i]; if (value) { for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } /* Check that constraints are satisfied. For small infeasibility, force the activity within bound. Again, why is this necessary if the current solution was accepted as a valid solution? Why are we scanning past the first unacceptable constraint? */ // check was feasible - if not adjust (cleaning may move) // if very infeasible then give up bool tryHeuristic = true; for (i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i]) { if (rowActivity[i] < rowLower[i] - 10.0*primalTolerance) tryHeuristic = false; rowActivity[i] = rowLower[i]; } else if (rowActivity[i] > rowUpper[i]) { if (rowActivity[i] < rowUpper[i] + 10.0*primalTolerance) tryHeuristic = false; rowActivity[i] = rowUpper[i]; } } /* This bit of code is not quite totally redundant: it'll bail at 10,000 instead of 100,000. Potentially we can do a lot of work to get here, only to abandon it. */ // Switch off if may take too long if (model_->getNumCols() > 10000 && model_->getNumCols() > 10*model_->getNumRows()&&swap<10) tryHeuristic = false; /* Try the inc/dec heuristic? */ if (tryHeuristic) { // total change in objective double totalChange = 0.0; // local best change in objective double bestChange = 0.0; // maybe just do 1000 int maxIntegers = numberIntegers; // stop if too many goes int maxTries=COIN_INT_MAX; // integerVariable may be randomized copy! int * integerVariable = CoinCopyOfArray(model_->integerVariable(),numberIntegers); if (swap>9 && numberIntegers>500) { int type=swap/10; if (type==1) { // reduce maxIntegers = CoinMin(1000,numberIntegers); } else if (type==2) { // reduce even more maxTries=100000; maxIntegers = CoinMin(500,numberIntegers); } else if (type>2) { assert (type<10); int totals[7]={1000,500,100,50,50,50,50}; maxIntegers=CoinMin(totals[type-3],numberIntegers); double * weight = new double[numberIntegers]; for (int i=0;irandomNumberGenerator()->randomDouble(); } CoinSort_2(weight,weight+numberIntegers,integerVariable); } } /* Outer loop to walk integer variables. Call the current variable x. At the end of this loop, bestChange will contain the best (negative) change in the objective for any single pair. The trouble is, we're limited to monotonically increasing improvement. Suppose we discover an improvement of 10 for some pair. If, later in the search, we discover an improvement of 9 for some other pair, we will not use it. That seems wasteful. */ for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; bestChange = 0.0; int endInner = CoinMin(numberIntegers,i+maxIntegers); double objectiveCoefficient = cost[i]; int k; int j; int goodK = -1; int wayK = -1, wayI = -1; /* Try decrementing x. */ if ((way[i]&1) != 0) { int numberInfeasible = 0; /* Adjust row activities where x has a nonzero coefficient. Save the old values for restoration. Mark any rows that become infeasible as a result of the decrement. */ // save row activities and adjust for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; save[iRow] = rowActivity[iRow]; rowActivity[iRow] -= element[j]; if (rowActivity[iRow] < rowLower[iRow] - primalTolerance || rowActivity[iRow] > rowUpper[iRow] + primalTolerance) { // mark row mark[iRow] = 1; numberInfeasible++; } } /* Run through the remaining integer variables. Try increment and decrement on each one. If the potential objective change is better than anything we've seen so far, do a full evaluation of x in that direction. If we can repair all infeasibilities introduced by pushing x down, we have a winner. Remember the best variable, and the direction for x and x. */ // try down for (k = i + 1; k < endInner; k++) { if (!maxTries) break; maxTries--; if ((way[k]&1) != 0) { // try down if (-objectiveCoefficient - cost[k] < bestChange) { // see if feasible down bool good = true; int numberMarked = 0; int kColumn = integerVariable[k]; for (j = columnStart[kColumn]; j < columnStart[kColumn] + columnLength[kColumn]; j++) { int iRow = row[j]; double newValue = rowActivity[iRow] - element[j]; if (newValue < rowLower[iRow] - primalTolerance || newValue > rowUpper[iRow] + primalTolerance) { good = false; break; } else if (mark[iRow]) { // made feasible numberMarked++; } } if (good && numberMarked == numberInfeasible) { // better solution goodK = k; wayK = -1; wayI = -1; bestChange = -objectiveCoefficient - cost[k]; } } } if ((way[k]&2) != 0) { // try up if (-objectiveCoefficient + cost[k] < bestChange) { // see if feasible up bool good = true; int numberMarked = 0; int kColumn = integerVariable[k]; for (j = columnStart[kColumn]; j < columnStart[kColumn] + columnLength[kColumn]; j++) { int iRow = row[j]; double newValue = rowActivity[iRow] + element[j]; if (newValue < rowLower[iRow] - primalTolerance || newValue > rowUpper[iRow] + primalTolerance) { good = false; break; } else if (mark[iRow]) { // made feasible numberMarked++; } } if (good && numberMarked == numberInfeasible) { // better solution goodK = k; wayK = 1; wayI = -1; bestChange = -objectiveCoefficient + cost[k]; } } } } /* Remove effect of decrementing x by restoring original lhs values. */ // restore row activities for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] = save[iRow]; mark[iRow] = 0; } } /* Try to increment x. Actions as for decrement. */ if ((way[i]&2) != 0) { int numberInfeasible = 0; // save row activities and adjust for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; save[iRow] = rowActivity[iRow]; rowActivity[iRow] += element[j]; if (rowActivity[iRow] < rowLower[iRow] - primalTolerance || rowActivity[iRow] > rowUpper[iRow] + primalTolerance) { // mark row mark[iRow] = 1; numberInfeasible++; } } // try up for (k = i + 1; k < endInner; k++) { if (!maxTries) break; if ((way[k]&1) != 0) { // try down if (objectiveCoefficient - cost[k] < bestChange) { // see if feasible down bool good = true; int numberMarked = 0; int kColumn = integerVariable[k]; for (j = columnStart[kColumn]; j < columnStart[kColumn] + columnLength[kColumn]; j++) { int iRow = row[j]; double newValue = rowActivity[iRow] - element[j]; if (newValue < rowLower[iRow] - primalTolerance || newValue > rowUpper[iRow] + primalTolerance) { good = false; break; } else if (mark[iRow]) { // made feasible numberMarked++; } } if (good && numberMarked == numberInfeasible) { // better solution goodK = k; wayK = -1; wayI = 1; bestChange = objectiveCoefficient - cost[k]; } } } if ((way[k]&2) != 0) { // try up if (objectiveCoefficient + cost[k] < bestChange) { // see if feasible up bool good = true; int numberMarked = 0; int kColumn = integerVariable[k]; for (j = columnStart[kColumn]; j < columnStart[kColumn] + columnLength[kColumn]; j++) { int iRow = row[j]; double newValue = rowActivity[iRow] + element[j]; if (newValue < rowLower[iRow] - primalTolerance || newValue > rowUpper[iRow] + primalTolerance) { good = false; break; } else if (mark[iRow]) { // made feasible numberMarked++; } } if (good && numberMarked == numberInfeasible) { // better solution goodK = k; wayK = 1; wayI = 1; bestChange = objectiveCoefficient + cost[k]; } } } } // restore row activities for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] = save[iRow]; mark[iRow] = 0; } } /* We've found a pair x and x which produce a better solution. Update our notion of current solution to match. Why does this not update newSolutionValue? */ if (goodK >= 0) { // we found something - update solution for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += wayI * element[j]; } newSolution[iColumn] += wayI; int kColumn = integerVariable[goodK]; for (j = columnStart[kColumn]; j < columnStart[kColumn] + columnLength[kColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += wayK * element[j]; } newSolution[kColumn] += wayK; /* Adjust motion range for x. We may have banged up against a bound with that last move. */ // See if k can go further ? const OsiObject * object = model_->object(goodK); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double value = newSolution[kColumn]; int iway = 0; if (value > originalLower + 0.5) iway = 1; if (value < originalUpper - 0.5) iway |= 2; way[goodK] = static_cast(iway); totalChange += bestChange; } } /* End of loop to try increment/decrement of integer variables. newSolutionValue does not necessarily match the current newSolution, and bestChange simply reflects the best single change. Still, that's sufficient to indicate that there's been at least one change. Check that we really do have a valid solution. */ if (totalChange + newSolutionValue < solutionValue) { // paranoid check memset(rowActivity, 0, numberRows*sizeof(double)); for (i = 0; i < numberColumns; i++) { int j; double value = newSolution[i]; if (value) { for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } int numberBad = 0; double sumBad = 0.0; // check was approximately feasible for (i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i]) { sumBad += rowLower[i] - rowActivity[i]; if (rowActivity[i] < rowLower[i] - 10.0*primalTolerance) numberBad++; } else if (rowActivity[i] > rowUpper[i]) { sumBad += rowUpper[i] - rowActivity[i]; if (rowActivity[i] > rowUpper[i] + 10.0*primalTolerance) numberBad++; } } if (!numberBad) { for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = model_->object(i); // get original bounds double originalLower; double originalUpper; getIntegerInformation( object, originalLower, originalUpper); double value = newSolution[iColumn]; // if away from lower bound mark that fact if (value > originalLower) { used_[iColumn] = numberSolutions_; } } /* Copy the solution to the array returned to the client. Grab a basis from the solver (which, if it exists, is almost certainly infeasible, but it should be ok for a dual start). The value returned as solutionValue is conservative because of handling of newSolutionValue and bestChange, as described above. */ // new solution memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; if (basis) { model_->setBestSolutionBasis(* basis); delete basis; } returnCode = 1; solutionValue = newSolutionValue + bestChange; } else { // bad solution - should not happen so debug if see message COIN_DETAIL_PRINT(printf("Local search got bad solution with %d infeasibilities summing to %g\n", numberBad, sumBad)); } } // This is just a copy! delete [] integerVariable; } /* We're done. Clean up. */ delete [] newSolution; delete [] rowActivity; delete [] way; delete [] cost; delete [] save; delete [] mark; /* Do we want to try swapping values between solutions? swap_ is set elsewhere; it's not adjusted during heuristic execution. Again, redundant test. We shouldn't be here if numberSolutions_ = 1. */ if (numberSolutions_ > 1 && (swap%10) == 1) { // try merge int returnCode2 = solutionFix( solutionValue, betterSolution, NULL); if (returnCode2) returnCode = 1; } return returnCode; } // update model void CbcHeuristicLocal::setModel(CbcModel * model) { model_ = model; // Get a copy of original matrix assert(model_->solver()); if (model_->solver()->getNumRows()) { matrix_ = *model_->solver()->getMatrixByCol(); } delete [] used_; int numberColumns = model->solver()->getNumCols(); used_ = new int[numberColumns]; memset(used_, 0, numberColumns*sizeof(int)); } // Default Constructor CbcHeuristicProximity::CbcHeuristicProximity() : CbcHeuristic() { increment_ = 0.01; feasibilityPump_ = NULL; numberSolutions_ = 0; used_ = NULL; lastRunDeep_ = -1000000; switches_ |= 16; // needs a new solution } // Constructor with model - assumed before cuts CbcHeuristicProximity::CbcHeuristicProximity(CbcModel & model) : CbcHeuristic(model) { increment_ = 0.01; feasibilityPump_ = NULL; numberSolutions_ = 0; lastRunDeep_ = -1000000; switches_ |= 16; // needs a new solution int numberColumns = model.solver()->getNumCols(); used_ = new int[numberColumns]; memset(used_, 0, numberColumns*sizeof(int)); } // Destructor CbcHeuristicProximity::~CbcHeuristicProximity () { delete feasibilityPump_; delete [] used_; } // Clone CbcHeuristic * CbcHeuristicProximity::clone() const { return new CbcHeuristicProximity(*this); } // Create C++ lines to get to current state void CbcHeuristicProximity::generateCpp( FILE * fp) { CbcHeuristicProximity other; fprintf(fp, "0#include \"CbcHeuristicProximity.hpp\"\n"); fprintf(fp, "3 CbcHeuristicProximity heuristicProximity(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicProximity"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicProximity);\n"); } // Copy constructor CbcHeuristicProximity::CbcHeuristicProximity(const CbcHeuristicProximity & rhs) : CbcHeuristic(rhs), numberSolutions_(rhs.numberSolutions_) { increment_ = rhs.increment_; feasibilityPump_ = NULL; if (model_ && rhs.used_) { int numberColumns = model_->solver()->getNumCols(); used_ = CoinCopyOfArray(rhs.used_, numberColumns); if (rhs.feasibilityPump_) feasibilityPump_ = new CbcHeuristicFPump(*rhs.feasibilityPump_); } else { used_ = NULL; } } // Assignment operator CbcHeuristicProximity & CbcHeuristicProximity::operator=( const CbcHeuristicProximity & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); increment_ = rhs.increment_; numberSolutions_ = rhs.numberSolutions_; delete [] used_; delete feasibilityPump_; feasibilityPump_ = NULL; if (model_ && rhs.used_) { int numberColumns = model_->solver()->getNumCols(); used_ = CoinCopyOfArray(rhs.used_, numberColumns); if (rhs.feasibilityPump_) feasibilityPump_ = new CbcHeuristicFPump(*rhs.feasibilityPump_); } else { used_ = NULL; } } return *this; } // Resets stuff if model changes void CbcHeuristicProximity::resetModel(CbcModel * /*model*/) { //CbcHeuristic::resetModel(model); delete [] used_; if (model_ && used_) { int numberColumns = model_->solver()->getNumCols(); used_ = new int[numberColumns]; memset(used_, 0, numberColumns*sizeof(int)); } else { used_ = NULL; } } /* Run a mini-BaB search after changing objective Return values are: 1: smallBranchAndBound found a solution 0: everything else The degree of overload as return codes from smallBranchAndBound are folded into 0 is such that it's impossible to distinguish return codes that really require attention from a simple `nothing of interest'. */ int CbcHeuristicProximity::solution(double & solutionValue, double * betterSolution) { if (feasibilityPumpOptions_ == -3 && numCouldRun_==0 && !feasibilityPump_ ) { // clone feasibility pump for (int i = 0; i < model_->numberHeuristics(); i++) { const CbcHeuristicFPump* pump = dynamic_cast(model_->heuristic(i)); if (pump) { feasibilityPump_ = new CbcHeuristicFPump(*pump); break; } } } /* Execute only if a new solution has been discovered since the last time we were called. */ numCouldRun_++; int nodeCount = model_->getNodeCount(); if (numberSolutions_ == model_->getSolutionCount()) return 0; if (!model_->bestSolution()) return 0; // odd - because in parallel mode numberSolutions_ = model_->getSolutionCount(); lastRunDeep_ = nodeCount; numRuns_++; //howOftenShallow_ = numberSolutions_; /* Load up a new solver with the solution. Why continuousSolver(), as opposed to solver()? */ OsiSolverInterface * newSolver = model_->continuousSolver()->clone(); int numberColumns=newSolver->getNumCols(); double * obj = CoinCopyOfArray(newSolver->getObjCoefficients(),numberColumns); int * indices = new int [numberColumns]; int n=0; for (int i=0;igetCutoff(); assert (cutoff<1.0e20); if (model_->getCutoffIncrement()<1.0e-4) { cutoff -= increment_; } double offset; newSolver->getDblParam(OsiObjOffset, offset); newSolver->setDblParam(OsiObjOffset, 0.0); newSolver->addRow(n,indices,obj,-COIN_DBL_MAX,cutoff+offset); delete [] indices; memset(obj,0,numberColumns*sizeof(double)); newSolver->setDblParam(OsiDualObjectiveLimit, 1.0e20); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); const double * solutionIn = model_->bestSolution(); for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (fabs(solutionIn[iColumn])<1.0e-5) obj[iColumn]=1.0; else if (fabs(solutionIn[iColumn]-1.0)<1.0e-5) obj[iColumn]=-1.0; } newSolver->setObjective(obj); delete [] obj; //newSolver->writeMps("xxxx"); int maxSolutions = model_->getMaximumSolutions(); model_->setMaximumSolutions(1); bool pumpAdded = false; if (feasibilityPumpOptions_ == -3 && feasibilityPump_) { // add back feasibility pump pumpAdded = true; for (int i = 0; i < model_->numberHeuristics(); i++) { const CbcHeuristicFPump* pump = dynamic_cast(model_->heuristic(i)); if (pump) { pumpAdded = false; break; } } if (pumpAdded) model_->addHeuristic(feasibilityPump_); } int returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, 1.0e20, "CbcHeuristicProximity"); if (pumpAdded) { // take off feasibility pump int lastHeuristic = model_->numberHeuristics()-1; model_->setNumberHeuristics(lastHeuristic); delete model_->heuristic(lastHeuristic); } model_->setMaximumSolutions(maxSolutions); /* -2 is return due to user event, and -1 is overloaded with what look to be two contradictory meanings. */ if (returnCode < 0) { returnCode = 0; } /* If the result is complete exploration with a solution (3) or proven infeasibility (2), we could generate a cut (the AI folks would call it a nogood) to prevent us from going down this route in the future. */ if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } char proxPrint[200]; if ((returnCode&1) != 0) { // redo objective const double * obj = model_->continuousSolver()->getObjCoefficients(); solutionValue = - offset; int sumIncrease=0.0; int sumDecrease=0.0; int numberIncrease=0; int numberDecrease=0; for (int i=0;iisInteger(i)) { int change=static_cast(floor(solutionIn[i]-betterSolution[i]+0.5)); if (change>0) { numberIncrease++; sumIncrease+=change; } else if (change<0) { numberDecrease++; sumDecrease-=change; } } } sprintf(proxPrint,"Proximity search ran %d nodes (out of %d) - in new solution %d increased (%d), %d decreased (%d)", numberNodesDone_,numberNodes_, numberIncrease,sumIncrease,numberDecrease,sumDecrease); if (!numberIncrease&&!numberDecrease) { // somehow tolerances are such that we can slip through // change for next time increment_ += CoinMax(increment_,fabs(solutionValue+offset)*1.0e-10); } } else { sprintf(proxPrint,"Proximity search ran %d nodes - no new solution", numberNodesDone_); } model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << proxPrint << CoinMessageEol; delete newSolver; return returnCode; } // update model void CbcHeuristicProximity::setModel(CbcModel * model) { model_ = model; // Get a copy of original matrix assert(model_->solver()); delete [] used_; int numberColumns = model->solver()->getNumCols(); used_ = new int[numberColumns]; memset(used_, 0, numberColumns*sizeof(int)); } // Default Constructor CbcHeuristicNaive::CbcHeuristicNaive() : CbcHeuristic() { large_ = 1.0e6; } // Constructor with model - assumed before cuts CbcHeuristicNaive::CbcHeuristicNaive(CbcModel & model) : CbcHeuristic(model) { large_ = 1.0e6; } // Destructor CbcHeuristicNaive::~CbcHeuristicNaive () { } // Clone CbcHeuristic * CbcHeuristicNaive::clone() const { return new CbcHeuristicNaive(*this); } // Create C++ lines to get to current state void CbcHeuristicNaive::generateCpp( FILE * fp) { CbcHeuristicNaive other; fprintf(fp, "0#include \"CbcHeuristicProximity.hpp\"\n"); fprintf(fp, "3 CbcHeuristicNaive naive(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "naive"); if (large_ != other.large_) fprintf(fp, "3 naive.setLarge(%g);\n", large_); else fprintf(fp, "4 naive.setLarge(%g);\n", large_); fprintf(fp, "3 cbcModel->addHeuristic(&naive);\n"); } // Copy constructor CbcHeuristicNaive::CbcHeuristicNaive(const CbcHeuristicNaive & rhs) : CbcHeuristic(rhs), large_(rhs.large_) { } // Assignment operator CbcHeuristicNaive & CbcHeuristicNaive::operator=( const CbcHeuristicNaive & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); large_ = rhs.large_; } return *this; } // Resets stuff if model changes void CbcHeuristicNaive::resetModel(CbcModel * model) { CbcHeuristic::resetModel(model); } int CbcHeuristicNaive::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; // See if to do bool atRoot = model_->getNodeCount() == 0; int passNumber = model_->getCurrentPassNumber(); if (!when() || (when() == 1 && model_->phase() != 1) || !atRoot || passNumber > 1) return 0; // switched off // Don't do if it was this heuristic which found solution! if (this == model_->lastHeuristic()) return 0; numRuns_++; double cutoff; model_->solver()->getDblParam(OsiDualObjectiveLimit, cutoff); double direction = model_->solver()->getObjSense(); cutoff *= direction; cutoff = CoinMin(cutoff, solutionValue); OsiSolverInterface * solver = model_->continuousSolver(); if (!solver) solver = model_->solver(); const double * colLower = solver->getColLower(); const double * colUpper = solver->getColUpper(); const double * objective = solver->getObjCoefficients(); int numberColumns = model_->getNumCols(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; bool solutionFound = false; CoinWarmStartBasis saveBasis; CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; if (basis) { saveBasis = * basis; delete basis; } // First just fix all integers as close to zero as possible OsiSolverInterface * newSolver = cloneBut(7); // wassolver->clone(); for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double lower = colLower[iColumn]; double upper = colUpper[iColumn]; double value; if (lower > 0.0) value = lower; else if (upper < 0.0) value = upper; else value = 0.0; newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); } newSolver->initialSolve(); if (newSolver->isProvenOptimal()) { double solValue = newSolver->getObjValue() * direction ; if (solValue < cutoff) { // we have a solution solutionFound = true; solutionValue = solValue; memcpy(betterSolution, newSolver->getColSolution(), numberColumns*sizeof(double)); COIN_DETAIL_PRINT(printf("Naive fixing close to zero gave solution of %g\n", solutionValue)); cutoff = solValue - model_->getCutoffIncrement(); } } // Now fix all integers as close to zero if not zero or large cost int nFix = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double lower = colLower[iColumn]; double upper = colUpper[iColumn]; double value; if (fabs(objective[i]) > 0.0 && fabs(objective[i]) < large_) { nFix++; if (lower > 0.0) value = lower; else if (upper < 0.0) value = upper; else value = 0.0; newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); } else { // set back to original newSolver->setColLower(iColumn, lower); newSolver->setColUpper(iColumn, upper); } } const double * solution = solver->getColSolution(); if (nFix) { newSolver->setWarmStart(&saveBasis); newSolver->setColSolution(solution); newSolver->initialSolve(); if (newSolver->isProvenOptimal()) { double solValue = newSolver->getObjValue() * direction ; if (solValue < cutoff) { // try branch and bound double * newSolution = new double [numberColumns]; COIN_DETAIL_PRINT(printf("%d fixed after fixing costs\n", nFix)); int returnCode = smallBranchAndBound(newSolver, numberNodes_, newSolution, solutionValue, solutionValue, "CbcHeuristicNaive1"); if (returnCode < 0) returnCode = 0; // returned on size if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } if (returnCode == 1) { // solution solutionFound = true; memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); COIN_DETAIL_PRINT(printf("Naive fixing zeros gave solution of %g\n", solutionValue)); cutoff = solutionValue - model_->getCutoffIncrement(); } delete [] newSolution; } } } #if 1 newSolver->setObjSense(-direction); // maximize newSolver->setWarmStart(&saveBasis); newSolver->setColSolution(solution); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; double lower = colLower[iColumn]; double upper = colUpper[iColumn]; double newLower; double newUpper; if (newSolver->isInteger(iColumn)) { newLower = CoinMax(lower, floor(value) - 2.0); newUpper = CoinMin(upper, ceil(value) + 2.0); } else { newLower = CoinMax(lower, value - 1.0e5); newUpper = CoinMin(upper, value + 1.0e-5); } newSolver->setColLower(iColumn, newLower); newSolver->setColUpper(iColumn, newUpper); } newSolver->initialSolve(); if (newSolver->isProvenOptimal()) { double solValue = newSolver->getObjValue() * direction ; if (solValue < cutoff) { nFix = 0; newSolver->setObjSense(direction); // correct direction //const double * thisSolution = newSolver->getColSolution(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; double lower = colLower[iColumn]; double upper = colUpper[iColumn]; double newLower = lower; double newUpper = upper; if (newSolver->isInteger(iColumn)) { if (value < lower + 1.0e-6) { nFix++; newUpper = lower; } else if (value > upper - 1.0e-6) { nFix++; newLower = upper; } else { newLower = CoinMax(lower, floor(value) - 2.0); newUpper = CoinMin(upper, ceil(value) + 2.0); } } newSolver->setColLower(iColumn, newLower); newSolver->setColUpper(iColumn, newUpper); } // try branch and bound double * newSolution = new double [numberColumns]; COIN_DETAIL_PRINT(printf("%d fixed after maximizing\n", nFix)); int returnCode = smallBranchAndBound(newSolver, numberNodes_, newSolution, solutionValue, solutionValue, "CbcHeuristicNaive1"); if (returnCode < 0) returnCode = 0; // returned on size if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } if (returnCode == 1) { // solution solutionFound = true; memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); COIN_DETAIL_PRINT(printf("Naive maximizing gave solution of %g\n", solutionValue)); cutoff = solutionValue - model_->getCutoffIncrement(); } delete [] newSolution; } } #endif delete newSolver; return solutionFound ? 1 : 0; } // update model void CbcHeuristicNaive::setModel(CbcModel * model) { model_ = model; } // Default Constructor CbcHeuristicCrossover::CbcHeuristicCrossover() : CbcHeuristic(), numberSolutions_(0), useNumber_(3) { setWhen(1); } // Constructor with model - assumed before cuts CbcHeuristicCrossover::CbcHeuristicCrossover(CbcModel & model) : CbcHeuristic(model), numberSolutions_(0), useNumber_(3) { setWhen(1); for (int i = 0; i < 10; i++) random_[i] = model.randomNumberGenerator()->randomDouble(); } // Destructor CbcHeuristicCrossover::~CbcHeuristicCrossover () { } // Clone CbcHeuristic * CbcHeuristicCrossover::clone() const { return new CbcHeuristicCrossover(*this); } // Create C++ lines to get to current state void CbcHeuristicCrossover::generateCpp( FILE * fp) { CbcHeuristicCrossover other; fprintf(fp, "0#include \"CbcHeuristicProximity.hpp\"\n"); fprintf(fp, "3 CbcHeuristicCrossover crossover(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "crossover"); if (useNumber_ != other.useNumber_) fprintf(fp, "3 crossover.setNumberSolutions(%d);\n", useNumber_); else fprintf(fp, "4 crossover.setNumberSolutions(%d);\n", useNumber_); fprintf(fp, "3 cbcModel->addHeuristic(&crossover);\n"); } // Copy constructor CbcHeuristicCrossover::CbcHeuristicCrossover(const CbcHeuristicCrossover & rhs) : CbcHeuristic(rhs), attempts_(rhs.attempts_), numberSolutions_(rhs.numberSolutions_), useNumber_(rhs.useNumber_) { memcpy(random_, rhs.random_, 10*sizeof(double)); } // Assignment operator CbcHeuristicCrossover & CbcHeuristicCrossover::operator=( const CbcHeuristicCrossover & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); useNumber_ = rhs.useNumber_; attempts_ = rhs.attempts_; numberSolutions_ = rhs.numberSolutions_; memcpy(random_, rhs.random_, 10*sizeof(double)); } return *this; } // Resets stuff if model changes void CbcHeuristicCrossover::resetModel(CbcModel * model) { CbcHeuristic::resetModel(model); } int CbcHeuristicCrossover::solution(double & solutionValue, double * betterSolution) { if (when_ == 0) return 0; numCouldRun_++; bool useBest = (numberSolutions_ != model_->getSolutionCount()); if (!useBest && (when_ % 10) == 1) return 0; numberSolutions_ = model_->getSolutionCount(); OsiSolverInterface * continuousSolver = model_->continuousSolver(); int useNumber = CoinMin(model_->numberSavedSolutions(), useNumber_); if (useNumber < 2 || !continuousSolver) return 0; // Fix later if (!useBest) abort(); numRuns_++; double cutoff; model_->solver()->getDblParam(OsiDualObjectiveLimit, cutoff); double direction = model_->solver()->getObjSense(); cutoff *= direction; cutoff = CoinMin(cutoff, solutionValue); OsiSolverInterface * solver = cloneBut(2); // But reset bounds solver->setColLower(continuousSolver->getColLower()); solver->setColUpper(continuousSolver->getColUpper()); int numberColumns = solver->getNumCols(); // Fixed double * fixed = new double [numberColumns]; for (int i = 0; i < numberColumns; i++) fixed[i] = -COIN_DBL_MAX; int whichSolution[10]; for (int i = 0; i < useNumber; i++) whichSolution[i] = i; for (int i = 0; i < useNumber; i++) { int k = whichSolution[i]; const double * solution = model_->savedSolution(k); for (int j = 0; j < numberColumns; j++) { if (solver->isInteger(j)) { if (fixed[j] == -COIN_DBL_MAX) fixed[j] = floor(solution[j] + 0.5); else if (fabs(fixed[j] - solution[j]) > 1.0e-7) fixed[j] = COIN_DBL_MAX; } } } const double * colLower = solver->getColLower(); for (int i = 0; i < numberColumns; i++) { if (solver->isInteger(i)) { double value = fixed[i]; if (value != COIN_DBL_MAX) { if (when_ < 10) { solver->setColLower(i, value); solver->setColUpper(i, value); } else if (value == colLower[i]) { solver->setColUpper(i, value); } } } } int returnCode = smallBranchAndBound(solver, numberNodes_, betterSolution, solutionValue, solutionValue, "CbcHeuristicCrossover"); if (returnCode < 0) returnCode = 0; // returned on size if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } delete solver; return returnCode; } // update model void CbcHeuristicCrossover::setModel(CbcModel * model) { model_ = model; if (model) { for (int i = 0; i < 10; i++) random_[i] = model->randomNumberGenerator()->randomDouble(); } } CoinMP-1.8.3/Cbc/src/CbcGenCtlBlk.cpp0000644000175000017500000004345712131054770015530 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenCtlBlk.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #include "CbcConfig.h" #include "CoinPragma.hpp" #include #include "CbcGenCtlBlk.hpp" namespace { char svnid[] = "$Id: CbcGenCtlBlk.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } /* Constructor for cbc-generic control block. Set up defaults for the cbc-generic control block. Note that prototypes for cut generators and heuristics will be created on demand; see the access functions. Once this structure settles down, simple intialisation should move up to the standard `:' block. In the meantime, this avoids complaints about ordering. */ CbcGenCtlBlk::CbcGenCtlBlk () { version_ = CBC_GENERIC_VERSION ; /* It's unclear to me that this is a good choice for dfltDirectory. Makes sense for commands, but seems unnecessary for data files. Perhaps a null string instead? */ char dirsep = CoinFindDirSeparator() ; dfltDirectory_ = (dirsep == '/' ? "./" : ".\\") ; lastMpsIn_ = "" ; allowImportErrors_ = false ; lastSolnOut_ = "stdout" ; printMode_ = 0 ; printMask_ = "" ; paramVec_ = 0 ; genParams_.first_ = 0 ; genParams_.last_ = 0 ; cbcParams_.first_ = 0 ; cbcParams_.last_ = 0 ; osiParams_.first_ = 0 ; osiParams_.last_ = 0 ; verbose_ = 0 ; paramsProcessed_ = 0 ; defaultSettings_ = true ; debugCreate_ = "" ; debugFile_ = "" ; debugSol_.numCols_ = -1 ; debugSol_.values_ = 0 ; printOpt_ = 0 ; /* Assigning us_en to cur_lang_ is entirely bogus, but CoinMessages::Language does not provide an `unspecified' code. */ msgHandler_ = new CoinMessageHandler() ; ourMsgHandler_ = true ; cur_lang_ = CoinMessages::us_en ; msgs_ = 0 ; logLvl_ = 0 ; totalTime_ = 0.0 ; model_ = 0 ; dfltSolver_ = 0 ; goodModel_ = false ; bab_.majorStatus_ = BACInvalid ; bab_.minorStatus_ = BACmInvalid ; bab_.where_ = BACwInvalid ; bab_.haveAnswer_ = false ; bab_.answerSolver_ = 0 ; preProcess_ = CbcGenCtlBlk::IPPSOS ; cutDepth_ = -1 ; probing_.action_ = CbcGenCtlBlk::CGIfMove ; probing_.proto_ = 0 ; probing_.usingObjective_ = true ; probing_.maxPass_ = 3 ; probing_.maxPassRoot_ = 3 ; probing_.maxProbe_ = 10 ; probing_.maxProbeRoot_ = 50 ; probing_.maxLook_ = 10 ; probing_.maxLookRoot_ = 50 ; probing_.maxElements_ = 200 ; probing_.rowCuts_ = 3 ; clique_.action_ = CbcGenCtlBlk::CGIfMove ; clique_.proto_ = 0 ; clique_.starCliqueReport_ = false ; clique_.rowCliqueReport_ = false ; clique_.minViolation_ = 0.1 ; flow_.action_ = CbcGenCtlBlk::CGIfMove ; flow_.proto_ = 0 ; gomory_.action_ = CbcGenCtlBlk::CGIfMove ; gomory_.proto_ = 0 ; gomory_.limit_ = 50 ; gomory_.limitAtRoot_ = 512 ; knapsack_.action_ = CbcGenCtlBlk::CGIfMove ; knapsack_.proto_ = 0 ; // landp_action_ = CbcGenCtlBlk::CGOff ; // landp_.proto_ = 0 ; mir_.action_ = CbcGenCtlBlk::CGIfMove ; mir_.proto_ = 0 ; oddHole_.action_ = CbcGenCtlBlk::CGOff ; oddHole_.proto_ = 0 ; redSplit_.action_ = CbcGenCtlBlk::CGRoot ; redSplit_.proto_ = 0 ; twomir_.action_ = CbcGenCtlBlk::CGRoot ; twomir_.proto_ = 0 ; twomir_.maxElements_ = 250 ; fpump_.action_ = CbcGenCtlBlk::CGOn ; fpump_.proto_ = 0 ; combine_.action_ = CbcGenCtlBlk::CGOn ; combine_.proto_ = 0 ; combine_.trySwap_ = 1 ; greedyCover_.action_ = CbcGenCtlBlk::CGOn ; greedyCover_.proto_ = 0 ; greedyEquality_.action_ = CbcGenCtlBlk::CGOn ; greedyEquality_.proto_ = 0 ; localTree_.action_ = CbcGenCtlBlk::CGOff ; localTree_.proto_ = 0 ; localTree_.soln_ = 0 ; localTree_.range_ = 10 ; localTree_.typeCuts_ = 0 ; localTree_.maxDiverge_ = 0 ; localTree_.timeLimit_ = 10000 ; localTree_.nodeLimit_ = 2000 ; localTree_.refine_ = true ; rounding_.action_ = CbcGenCtlBlk::CGOn ; rounding_.proto_ = 0 ; djFix_.action_ = false ; djFix_.threshold_ = 1.0e100 ; priorityAction_ = CbcGenCtlBlk::BPOff ; /* The value for numBeforeTrust is as recommended by Achterberg. Cbc's implementation doesn't really have a parameter equivalent to Achterberg's dynamic limit on number of strong branching evaluations, so go with a fairly large default. As of 06.12.16, the magic number for shadow price mode meant `use shadow prices (penalties, I think) if there's no strong branching info'. */ chooseStrong_.numBeforeTrust_ = 8 ; chooseStrong_.numStrong_ = 100 ; chooseStrong_.shadowPriceMode_ = 1 ; return ; } /* Note that we don't want to delete dfltSolver_ here because it's just a copy of the pointer held in the solvers map over in CbcGenSolvers.cpp. */ CbcGenCtlBlk::~CbcGenCtlBlk () { if (model_) delete model_ ; if (bab_.answerSolver_) delete bab_.answerSolver_ ; if (probing_.proto_) delete probing_.proto_ ; if (clique_.proto_) delete clique_.proto_ ; if (flow_.proto_) delete flow_.proto_ ; if (gomory_.proto_) delete gomory_.proto_ ; if (knapsack_.proto_) delete knapsack_.proto_ ; if (mir_.proto_) delete mir_.proto_ ; if (oddHole_.proto_) delete oddHole_.proto_ ; if (redSplit_.proto_) delete redSplit_.proto_ ; if (twomir_.proto_) delete twomir_.proto_ ; if (fpump_.proto_) delete fpump_.proto_ ; if (combine_.proto_) delete combine_.proto_ ; if (greedyCover_.proto_) delete greedyCover_.proto_ ; if (greedyEquality_.proto_) delete greedyEquality_.proto_ ; if (rounding_.proto_) delete rounding_.proto_ ; if (msgHandler_ && ourMsgHandler_) delete msgHandler_ ; if (msgs_) delete msgs_ ; return ; } /* Access functions for cut generators and heuristics. These support lazy creation --- if action_ is other than CGOff, an object is created if necessary and a pointer is stored in proto_. The pointer is returned as a generic CglCutGenerator or CbcHeuristic. The return value of the function is the value of action_. Because the model may have changed, the default for heuristics is to delete any existing object and create a new one. This can be suppressed if desired. */ CbcGenCtlBlk::CGControl CbcGenCtlBlk::getProbing (CglCutGenerator *&gen) { if (probing_.action_ != CbcGenCtlBlk::CGOff && probing_.proto_ == 0) { probing_.proto_ = new CglProbing() ; probing_.proto_->setUsingObjective(probing_.usingObjective_) ; probing_.proto_->setMaxPass(probing_.maxPass_) ; probing_.proto_->setMaxPassRoot(probing_.maxPassRoot_) ; probing_.proto_->setMaxProbe(probing_.maxProbe_) ; probing_.proto_->setMaxProbeRoot(probing_.maxProbeRoot_) ; probing_.proto_->setMaxLook(probing_.maxLook_) ; probing_.proto_->setMaxLookRoot(probing_.maxLookRoot_) ; probing_.proto_->setMaxElements(probing_.maxElements_) ; probing_.proto_->setRowCuts(probing_.rowCuts_) ; } gen = dynamic_cast(probing_.proto_) ; return (probing_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getClique (CglCutGenerator *&gen) { if (clique_.action_ != CbcGenCtlBlk::CGOff && clique_.proto_ == 0) { clique_.proto_ = new CglClique() ; clique_.proto_->setStarCliqueReport(clique_.starCliqueReport_) ; clique_.proto_->setRowCliqueReport(clique_.rowCliqueReport_) ; clique_.proto_->setMinViolation(clique_.minViolation_) ; } gen = dynamic_cast(clique_.proto_) ; return (clique_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getFlow (CglCutGenerator *&gen) { if (flow_.action_ != CbcGenCtlBlk::CGOff && flow_.proto_ == 0) { flow_.proto_ = new CglFlowCover() ; } gen = dynamic_cast(flow_.proto_) ; return (flow_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getGomory (CglCutGenerator *&gen) { if (gomory_.action_ != CbcGenCtlBlk::CGOff && gomory_.proto_ == 0) { gomory_.proto_ = new CglGomory() ; gomory_.proto_->setLimitAtRoot(gomory_.limitAtRoot_) ; gomory_.proto_->setLimit(gomory_.limit_) ; } gen = dynamic_cast(gomory_.proto_) ; return (gomory_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getKnapsack (CglCutGenerator *&gen) { if (knapsack_.action_ != CbcGenCtlBlk::CGOff && knapsack_.proto_ == 0) { knapsack_.proto_ = new CglKnapsackCover() ; } gen = dynamic_cast(knapsack_.proto_) ; return (knapsack_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getMir (CglCutGenerator *&gen) { if (mir_.action_ != CbcGenCtlBlk::CGOff && mir_.proto_ == 0) { mir_.proto_ = new CglMixedIntegerRounding2() ; } gen = dynamic_cast(mir_.proto_) ; return (mir_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getRedSplit (CglCutGenerator *&gen) { if (redSplit_.action_ != CbcGenCtlBlk::CGOff && redSplit_.proto_ == 0) { redSplit_.proto_ = new CglRedSplit() ; } gen = dynamic_cast(redSplit_.proto_) ; return (redSplit_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getTwomir (CglCutGenerator *&gen) { if (twomir_.action_ != CbcGenCtlBlk::CGOff && twomir_.proto_ == 0) { twomir_.proto_ = new CglTwomir() ; twomir_.proto_->setMaxElements(twomir_.maxElements_) ; } gen = dynamic_cast(twomir_.proto_) ; return (twomir_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getFPump (CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate) { if (fpump_.action_ != CbcGenCtlBlk::CGOff && (fpump_.proto_ == 0 || alwaysCreate)) { if (fpump_.proto_) { delete fpump_.proto_ ; } fpump_.proto_ = new CbcHeuristicFPump(*model) ; fpump_.proto_->setMaximumPasses(fpump_.iters_) ; } gen = dynamic_cast(fpump_.proto_) ; return (fpump_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getCombine (CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate) { if (combine_.action_ != CbcGenCtlBlk::CGOff && (combine_.proto_ == 0 || alwaysCreate)) { if (combine_.proto_) { delete combine_.proto_ ; } combine_.proto_ = new CbcHeuristicLocal(*model) ; combine_.proto_->setSearchType(combine_.trySwap_) ; } gen = dynamic_cast(combine_.proto_) ; return (combine_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getGreedyCover (CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate) { if (greedyCover_.action_ != CbcGenCtlBlk::CGOff && (greedyCover_.proto_ == 0 || alwaysCreate)) { if (greedyCover_.proto_) { delete greedyCover_.proto_ ; } greedyCover_.proto_ = new CbcHeuristicGreedyCover(*model) ; } gen = dynamic_cast(greedyCover_.proto_) ; return (greedyCover_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getGreedyEquality (CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate) { if (greedyEquality_.action_ != CbcGenCtlBlk::CGOff && (greedyEquality_.proto_ == 0 || alwaysCreate)) { if (greedyEquality_.proto_) { delete greedyEquality_.proto_ ; } greedyEquality_.proto_ = new CbcHeuristicGreedyEquality(*model) ; } gen = dynamic_cast(greedyEquality_.proto_) ; return (greedyEquality_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getRounding (CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate) { if (rounding_.action_ != CbcGenCtlBlk::CGOff && (rounding_.proto_ == 0 || alwaysCreate)) { if (rounding_.proto_) { delete rounding_.proto_ ; } rounding_.proto_ = new CbcRounding(*model) ; } gen = dynamic_cast(rounding_.proto_) ; return (rounding_.action_) ; } CbcGenCtlBlk::CGControl CbcGenCtlBlk::getTreeLocal (CbcTreeLocal *&localTree, CbcModel *model, bool alwaysCreate) { if (localTree_.action_ != CbcGenCtlBlk::CGOff && (localTree_.proto_ == 0 || alwaysCreate)) { if (localTree_.proto_) { delete localTree_.proto_ ; } localTree_.proto_ = new CbcTreeLocal(model, localTree_.soln_, localTree_.range_, localTree_.typeCuts_, localTree_.maxDiverge_, localTree_.timeLimit_, localTree_.nodeLimit_, localTree_.refine_) ; } localTree = localTree_.proto_ ; return (localTree_.action_) ; } /* A bunch of little translation helper routines leading up to a version of setBaBStatus that figures it all out given a CbcModel and BACWhere code. This translation needs to be centralised to avoid sprinkling magic numbers all through the code. Be a bit careful with the translation routines --- they aren't sensitive to where the search stopped. */ CbcGenCtlBlk::BACMajor CbcGenCtlBlk::translateMajor (int status) { switch (status) { case -1: { return (BACNotRun) ; } case 0: { return (BACFinish) ; } case 1: { return (BACStop) ; } case 2: { return (BACAbandon) ; } case 5: { return (BACUser) ; } default: { return (BACInvalid) ; } } } CbcGenCtlBlk::BACMinor CbcGenCtlBlk::translateMinor (int status) { switch (status) { case -1: { return (BACmInvalid) ; } case 0: { return (BACmFinish) ; } case 1: { return (BACmInfeas) ; } case 2: { return (BACmGap) ; } case 3: { return (BACmNodeLimit) ; } case 4: { return (BACmTimeLimit) ; } case 5: { return (BACmUser) ; } case 6: { return (BACmSolnLimit) ; } case 7: { return (BACmUbnd) ; } default: { return (BACmOther) ; } } } /* A bit different --- given an OSI, use its interrogation functions to choose an appropriate BACMinor code. Not everything matches up, eh? */ CbcGenCtlBlk::BACMinor CbcGenCtlBlk::translateMinor (const OsiSolverInterface *osi) { if (osi->isProvenOptimal()) { return (BACmFinish) ; } else if (osi->isProvenPrimalInfeasible()) { return (BACmInfeas) ; } else if (osi->isProvenDualInfeasible()) { return (BACmUbnd) ; } else { return (BACmOther) ; } } /* A routine to set the bab_ status block given a CbcModel and an indication of where we're at in the search. Really, this is just a big mapping from CbcModel codes to CbcGeneric codes. */ void CbcGenCtlBlk::setBaBStatus (const CbcModel *model, BACWhere where, bool haveAnswer, OsiSolverInterface *answerSolver) { CbcGenCtlBlk::BACMajor major ; CbcGenCtlBlk::BACMinor minor ; major = translateMajor(model->status()) ; if (where == CbcGenCtlBlk::BACwBareRoot || where == CbcGenCtlBlk::BACwIPPRelax) { minor = translateMinor(model->solver()) ; } else { minor = translateMinor(model->secondaryStatus()) ; } setBaBStatus(major, minor, where, haveAnswer, answerSolver) ; return ; } /* Last, but not least, a routine to print the result. */ void CbcGenCtlBlk::printBaBStatus () { std::cout << "BAC result: stopped " ; switch (bab_.where_) { case BACwNotStarted: { std::cout << "before root relaxation" ; break ; } case BACwBareRoot: { std::cout << "after root relaxation" ; break ; } case BACwIPP: { std::cout << "after integer preprocessing" ; break ; } case BACwIPPRelax: { std::cout << "after solving preprocessed relaxation" ; break ; } case BACwBAC: { std::cout << "after branch-and-cut" ; break ; } default: { std::cout << "!!invalid phase code!!" ; break ; } } std::cout << std::endl << " Branch-and-cut " ; switch (bab_.majorStatus_) { case BACNotRun: { std::cout << "never got started" ; break ; } case BACFinish: { std::cout << "finished" ; break ; } case BACStop: { std::cout << "stopped on a limit" ; break ; } case BACAbandon: { std::cout << "was abandoned" ; break ; } case BACUser: { std::cout << "stopped due to a user event" ; break ; } default: { std::cout << "!!invalid major status code!!" ; break ; } } std::cout << "; minor status is " ; switch (bab_.minorStatus_) { case BACmFinish: { std::cout << "optimal" ; break ; } case BACmInfeas: { std::cout << "infeasible" ; break ; } case BACmUbnd: { std::cout << "unbounded" ; break ; } case BACmGap: { std::cout << "reached specified integrality gap." ; break ; } case BACmNodeLimit: { std::cout << "reached node limit" ; break ; } case BACmTimeLimit: { std::cout << "reached time limit" ; break ; } case BACmSolnLimit: { std::cout << "reached limit on number of solutions" ; break ; } case BACmUser: { std::cout << "stopped due to a user event" ; break ; } case BACmOther: { std::cout << "other" ; break ; } default: { std::cout << "!!invalid minor status code!!" ; break ; } } std::cout << "." << std::endl ; } CoinMP-1.8.3/Cbc/src/CbcCompare.hpp0000644000175000017500000000164012131054770015302 0ustar renerene/* $Id: CbcCompare.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcCompare_H #define CbcCompare_H class CbcCompareBase; class CbcCompare { public: CbcCompareBase * test_; // Default Constructor CbcCompare () { test_ = NULL; } virtual ~CbcCompare() {} bool operator() (CbcNode * x, CbcNode * y) { return test_->test(x, y); } bool compareNodes (CbcNode * x, CbcNode * y) { return test_->test(x, y); } /// This is alternate test function inline bool alternateTest (CbcNode * x, CbcNode * y) { return test_->alternateTest(x, y); } /// return comparison object inline CbcCompareBase * comparisonObject() const { return test_; } }; #endif CoinMP-1.8.3/Cbc/src/CbcFullNodeInfo.hpp0000644000175000017500000001257212131054770016246 0ustar renerene// $Id: CbcFullNodeInfo.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/24/09 carved from CbcNode #ifndef CbcFullNodeInfo_H #define CbcFullNodeInfo_H #include #include #include "CoinWarmStartBasis.hpp" #include "CoinSearchTree.hpp" #include "CbcBranchBase.hpp" #include "CbcNodeInfo.hpp" class OsiSolverInterface; class OsiSolverBranch; class OsiCuts; class OsiRowCut; class OsiRowCutDebugger; class CoinWarmStartBasis; class CbcCountRowCut; class CbcModel; class CbcNode; class CbcSubProblem; class CbcGeneralBranchingObject; //############################################################################# /** Information required to recreate the subproblem at this node When a subproblem is initially created, it is represented by a CbcNode object and an attached CbcNodeInfo object. The CbcNode contains information needed while the subproblem remains live. The CbcNode is deleted when the last branch arm has been evaluated. The CbcNodeInfo contains information required to maintain the branch-and-cut search tree structure (links and reference counts) and to recreate the subproblem for this node (basis, variable bounds, cutting planes). A CbcNodeInfo object remains in existence until all nodes have been pruned from the subtree rooted at this node. The principle used to maintain the reference count is that the reference count is always the sum of all potential and actual children of the node. Specifically,
    • Once it's determined how the node will branch, the reference count is set to the number of potential children (i.e., the number of arms of the branch).
    • As each child is created by CbcNode::branch() (converting a potential child to the active subproblem), the reference count is decremented.
    • If the child survives and will become a node in the search tree (converting the active subproblem into an actual child), increment the reference count.
    Notice that the active subproblem lives in a sort of limbo, neither a potential or an actual node in the branch-and-cut tree. CbcNodeInfo objects come in two flavours. A CbcFullNodeInfo object contains a full record of the information required to recreate a subproblem. A CbcPartialNodeInfo object expresses this information in terms of differences from the parent. */ /** \brief Holds complete information for recreating a subproblem. A CbcFullNodeInfo object contains all necessary information (bounds, basis, and cuts) required to recreate a subproblem. \todo While there's no explicit statement, the code often makes the implicit assumption that an CbcFullNodeInfo structure will appear only at the root node of the search tree. Things will break if this assumption is violated. */ class CbcFullNodeInfo : public CbcNodeInfo { public: /** \brief Modify model according to information at node The routine modifies the model according to bound information at node, creates a new basis according to information at node, but with the size passed in through basis, and adds any cuts to the addCuts array. \note The basis passed in via basis is solely a vehicle for passing in the desired basis size. It will be deleted and a new basis returned. */ virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis, CbcCountRowCut **addCuts, int ¤tNumberCuts) const ; /// Just apply bounds to one variable - force means overwrite by lower,upper (1=>infeasible) virtual int applyBounds(int iColumn, double & lower, double & upper, int force) ; /** Builds up row basis backwards (until original model). Returns NULL or previous one to apply . Depends on Free being 0 and impossible for cuts */ virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis) const ; // Default Constructor CbcFullNodeInfo (); /** Constructor from continuous or satisfied */ CbcFullNodeInfo (CbcModel * model, int numberRowsAtContinuous); // Copy constructor CbcFullNodeInfo ( const CbcFullNodeInfo &); // Destructor ~CbcFullNodeInfo (); /// Clone virtual CbcNodeInfo * clone() const; /// Lower bounds inline const double * lower() const { return lower_; } /// Set a bound inline void setColLower(int sequence, double value) { lower_[sequence]=value;} /// Mutable lower bounds inline double * mutableLower() const { return lower_; } /// Upper bounds inline const double * upper() const { return upper_; } /// Set a bound inline void setColUpper(int sequence, double value) { upper_[sequence]=value;} /// Mutable upper bounds inline double * mutableUpper() const { return upper_; } protected: // Data /** Full basis This MUST BE A POINTER to avoid cutting extra information in derived warm start classes. */ CoinWarmStartBasis *basis_; int numberIntegers_; // Bounds stored in full double * lower_; double * upper_; private: /// Illegal Assignment operator CbcFullNodeInfo & operator=(const CbcFullNodeInfo& rhs); }; #endif //CbcFullNodeInfo_H CoinMP-1.8.3/Cbc/src/CbcThread.hpp0000644000175000017500000002735512314263032015132 0ustar renerene/* $Id: CbcThread.hpp 2022 2014-03-25 11:18:50Z forrest $ */ // Copyright (C) 2009, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcThread_H #define CbcThread_H #include "CbcModel.hpp" #include "CbcNode.hpp" class OsiObject; class OsiCuts; #ifdef CBC_THREAD class CbcThread; // Use pthreads #define CBC_PTHREAD #ifdef CBC_PTHREAD #include typedef struct { pthread_t thr; long status; } Coin_pthread_t; #endif //#define THREAD_DEBUG 1 /** A class to encapsulate specific thread stuff To use another api with same style - you just need to implement these methods. At present just pthreads */ class CbcSpecificThread { public: // Default Constructor CbcSpecificThread (); // Useful Constructor CbcSpecificThread (CbcSpecificThread * master, pthread_mutex_t * masterMutex); virtual ~CbcSpecificThread(); // Useful stuff void setUsefulStuff (CbcSpecificThread * master, void *& masterMutex); /** Locks a thread if parallel so that stuff like cut pool can be updated and/or used. */ void lockThread(); /** Unlocks a thread if parallel to say cut pool stuff not needed */ void unlockThread(); /// Locks a thread for testing whether to start etc void lockThread2(bool doAnyway = false); /// Unlocks a thread for testing whether to start etc void unlockThread2(bool doAnyway = false); /// Signal void signal(); /// Timed wait in nanoseconds - if negative then seconds void timedWait(int time); /// Actually starts a thread void startThread(void * (*routine ) (void *), CbcThread * thread); /// Exits thread (called from master) - return code should be zero int exit(); /// Exits thread void exitThread(); /// Get status int status() const; /// Set status void setStatus(int value); //} public: // private: CbcSpecificThread * basePointer_; // for getting main mutex and threadid of base #ifdef CBC_PTHREAD pthread_mutex_t *masterMutex_; // for synchronizing pthread_mutex_t mutex2_; // for waking up threads pthread_cond_t condition2_; // for waking up thread Coin_pthread_t threadId_; #endif bool locked_; // For mutex2 }; /** A class to encapsulate thread stuff */ class CbcThread { private: void gutsOfDelete(); void gutsOfCopy(const CbcThread & rhs); public: // Default Constructor CbcThread (); virtual ~CbcThread(); /// Fills in useful stuff void setUsefulStuff (CbcModel * model, int deterministic, CbcModel * baseModel, CbcThread * master, void *& masterMutex); /** Locks a thread if parallel so that stuff like cut pool can be updated and/or used. */ void lockThread(); /** Unlocks a thread if parallel to say cut pool stuff not needed */ void unlockThread(); /// Returns true if locked inline bool isLocked() const { return locked_; } /** Wait for child to have return code NOT == to currentCode type - 0 timed wait 1 wait returns true if return code changed */ bool wait(int type, int currentCode); /// Just wait for so many nanoseconds void waitNano(int time); /// Signal child to carry on void signal(); /// Lock from master with mutex2 and signal before lock void lockFromMaster(); /// Unlock from master with mutex2 and signal after unlock void unlockFromMaster(); /// Lock from thread with mutex2 and signal before lock void lockFromThread(); /// Unlock from thread with mutex2 and signal after unlock void unlockFromThread(); /// Exits thread (called from master) - return code should be zero int exit(); /// Exits thread void exitThread(); /// Waits until returnCode_ goes to zero void waitThread(); /// Get status inline int status() const { return threadStuff_.status(); } /// Set status inline void setStatus(int value) { threadStuff_.setStatus( value); } /// Get return code inline int returnCode() const { return returnCode_; } /// Set return code inline void setReturnCode(int value) { returnCode_ = value; } /// Get base model inline CbcModel * baseModel() const { return baseModel_; } /// Get this model inline CbcModel * thisModel() const { return thisModel_; } /// Get node inline CbcNode * node() const { return node_; } /// Set node inline void setNode(CbcNode * node) { node_ = node; } /// Get created node inline CbcNode * createdNode() const { return createdNode_; } /// Set created node inline void setCreatedNode(CbcNode * node) { createdNode_ = node; } /// Get dantzig state inline int dantzigState() const { return dantzigState_; } /// Set dantzig state inline void setDantzigState(int value) { dantzigState_ = value; } /// Get time in thread inline double timeInThread() const { return timeInThread_; } /// Increment time in thread inline void incrementTimeInThread(double value) { timeInThread_ += value; } /// Get time waiting to start inline double timeWaitingToStart() const { return timeWaitingToStart_; } /// Increment time waiting to start inline void incrementTimeWaitingToStart(double value) { timeWaitingToStart_ += value; } /// Get time locked inline double timeLocked() const { return timeLocked_; } /// Increment time locked inline void incrementTimeLocked(double value) { timeLocked_ += value; } /// Get time waiting to lock inline double timeWaitingToLock() const { return timeWaitingToLock_; } /// Increment time waiting to lock inline void incrementTimeWaitingToLock(double value) { timeWaitingToLock_ += value; } /// Get if deterministic inline int deterministic() const { return deterministic_; } /// Get maxDeleteNode inline int maxDeleteNode() const { return maxDeleteNode_; } /// Set maxDeleteNode inline void setMaxDeleteNode(int value) { maxDeleteNode_ = value; } /// Get nDeleteNode (may be fake i.e. defaultParallelIterations_) inline int nDeleteNode() const { return nDeleteNode_; } /// Set nDeleteNode (may be fake i.e. defaultParallelIterations_) inline void setNDeleteNode(int value) { nDeleteNode_ = value; } /// Clear delNode inline void clearDelNode() { delete delNode_; delNode_ = NULL; } /// Set fake delNode to pass across OsiCuts inline void fakeDelNode(CbcNode ** delNode) { delNode_ = delNode; } /// Get delNode inline CbcNode ** delNode() const { return delNode_; } /// Set delNode inline void setDelNode(CbcNode ** delNode) { delNode_ = delNode; } /// Get number times locked inline int numberTimesLocked() const { return numberTimesLocked_; } /// Get number times unlocked inline int numberTimesUnlocked() const { return numberTimesUnlocked_; } /// Get number of nodes this time inline int nodesThisTime() const { return nodesThisTime_; } /// Set number of nodes this time inline void setNodesThisTime(int value) { nodesThisTime_ = value; } /// Get number of iterations this time inline int iterationsThisTime() const { return iterationsThisTime_; } /// Set number of iterations this time inline void setIterationsThisTime(int value) { iterationsThisTime_ = value; } /// Get save stuff array inline int * saveStuff() { return saveStuff_; } /// Say if locked inline bool locked() const { return locked_; } public: // private: CbcSpecificThread threadStuff_; CbcModel * baseModel_; CbcModel * thisModel_; CbcNode * node_; // filled in every time CbcNode * createdNode_; // filled in every time on return CbcThread * master_; // points back to master thread int returnCode_; // -1 available, 0 busy, 1 finished , 2?? double timeLocked_; double timeWaitingToLock_; double timeWaitingToStart_; double timeInThread_; double timeWhenLocked_; // time when thread got lock (in seconds) int numberTimesLocked_; int numberTimesUnlocked_; int numberTimesWaitingToStart_; int saveStuff_[2]; int dantzigState_; // 0 unset, -1 waiting to be set, 1 set bool locked_; int nDeleteNode_; CbcNode ** delNode_; int maxDeleteNode_; int nodesThisTime_; int iterationsThisTime_; int deterministic_; #ifdef THREAD_DEBUG public: int threadNumber_; int lockCount_; #endif }; /** Base model */ class CbcBaseModel { public: // Default Constructor CbcBaseModel (); /** Constructor with model type -1 cuts 0 opportunistic 1 deterministic */ /** Constructor with model type -1 cuts 0 opportunistic 1 deterministic */ CbcBaseModel (CbcModel & model, int type); virtual ~CbcBaseModel(); /** Stop all threads -1 just check all in good state 0 actually stop */ void stopThreads(int type); /** Wait for threads in tree type 0 - tree looks empty - see if any nodes outstanding 1 - tree not empty 2 - finish and do statistics returns non-zero if keep going */ int waitForThreadsInTree(int type); /** Wait for threads n parallel cuts type 0 - parallel cuts 1 - finishing parallel cuts */ void waitForThreadsInCuts(int type, OsiCuts * eachCuts, int whichGenerator); /// Split model and do work in deterministic parallel void deterministicParallel(); /** Locks a thread if parallel so that stuff like cut pool can be updated and/or used. */ inline void lockThread() { children_[numberThreads_].lockThread(); } /** Unlocks a thread if parallel to say cut pool stuff not needed */ inline void unlockThread() { children_[numberThreads_].unlockThread(); } /// Returns true if locked inline bool isLocked() const { return children_[numberThreads_].locked(); } /// Returns pointer to master thread CbcThread * masterThread() const; /// Returns pointer to a thread model inline CbcModel * model(int i) const { return threadModel_[i]; } /// Returns pointer to a child thread inline CbcThread * child(int thread) const { return children_+thread;} /// Returns number of children inline int numberThreads() const { return numberThreads_;} /// Sets Dantzig state in children void setDantzigState(); private: /// Number of children int numberThreads_; /// Child models (with base model at end) CbcThread * children_; /** type -1 cuts 0 opportunistic 1 deterministic */ int type_; int * threadCount_; CbcModel ** threadModel_; int numberObjects_; OsiObject ** saveObjects_; int threadStats_[6]; int defaultParallelIterations_; int defaultParallelNodes_; }; #else // Dummy threads /** A class to encapsulate thread stuff */ class CbcThread { public: // Default Constructor CbcThread () {} virtual ~CbcThread() {} }; /** Base model */ class CbcBaseModel { public: // Default Constructor (not declared here so that CbcThread.cpp not empty) CbcBaseModel (); virtual ~CbcBaseModel() {} }; #endif #endif CoinMP-1.8.3/Cbc/src/CbcSymmetry.cpp0000644000175000017500000011366412547040710015552 0ustar renerene/* $Id: CbcSymmetry.cpp 925 2012-11-27 19:11:04Z stefan $ * * hacked from CouenneSymmetry.cpp * Name: CbcSymmetry.cpp * Author: Jim Ostrowski (the good bits - rest JJHF) * Purpose: methods for exploiting symmetry * Date: October 13, 2010 * * This file is licensed under the Eclipse Public License (EPL) */ //#define PRINT_MORE 1 #include "CbcConfig.h" #ifdef COIN_HAS_NTY extern "C" { #include "nauty.h" #include "nausparse.h" #ifdef NTY_TRACES #include "traces.h" #endif } #include #include #include #include #include #include #include "CbcSymmetry.hpp" #include "CbcBranchingObject.hpp" #include "CoinTime.hpp" #define NAUTY_MAX_LEVEL 0 #if NAUTY_MAX_LEVEL extern int nauty_maxalllevel; #endif /* Deliberately not threadsafe to save effort Just for statistics and not worth gathering across threads can redo later */ static int nautyBranchCalls_ = 0; static int lastNautyBranchCalls_ = 0; static int nautyBranchSucceeded_ = 0; static int nautyFixCalls_ = 0; static int lastNautyFixCalls_ = 0; static int nautyFixSucceeded_ = 0; static double nautyTime_ = 0.0; static double nautyFixes_= 0.0; static double nautyOtherBranches_ = 0.0; void CbcSymmetry::Node::node(int i, double c , double l, double u, int cod, int s){ index = i; coeff = c; lb = l; ub = u; color = -1; code = cod; sign = s; } inline bool CbcSymmetry::compare (register Node &a, register Node &b) const { if(a.get_code() == b.get_code() ) if(a.get_coeff() == b.get_coeff() ) if(a.get_sign() == b.get_sign() ) if( fabs ( a.get_lb() - b.get_lb() ) <= COUENNE_HACKED_EPS ) if( fabs ( a.get_ub() - b.get_ub() ) <= COUENNE_HACKED_EPS ) return 1; return 0; } void CbcSymmetry::Compute_Symmetry() const{ std::sort(node_info_. begin (), node_info_. end (), node_sort); for (std::vector :: iterator i = node_info_. begin (); i != node_info_. end (); ++i) (*i).color_vertex(-1); int color = 1; for (std::vector :: iterator i = node_info_. begin (); i != node_info_. end (); ++i) { if( (*i).get_color() == -1){ (*i).color_vertex(color); #ifdef PRINT_MORE printf ("Graph vertex %d is given color %d\n", (*i).get_index(), color); #endif nauty_info_ -> color_node((*i).get_index(), color); for (std::vector :: iterator j = i+1; j != node_info_. end (); ++j) if( compare( (*i) , (*j) ) ==1){ (*j).color_vertex(color); nauty_info_ -> color_node((*j).get_index(),color); #ifdef PRINT_MORE printf ("Graph vertex %d is given color %d, the same as vertex %d\n", (*j).get_index(), color, (*i).get_index()); #endif } // else // j = node_info_. end(); color++; } } //Print_Orbits (); nauty_info_ -> computeAuto(); //Print_Orbits (); } int CbcSymmetry::statsOrbits(CbcModel * model, int type) const { char general[200]; int returnCode=0; bool printSomething=true; if (type) { double branchSuccess=0.0; if (nautyBranchSucceeded_) branchSuccess = nautyOtherBranches_/nautyBranchSucceeded_; double fixSuccess=0.0; if (nautyFixSucceeded_) fixSuccess = nautyFixes_/nautyFixSucceeded_; if (nautyBranchCalls_>lastNautyBranchCalls_|| nautyFixCalls_>lastNautyFixCalls_) { sprintf(general,"Orbital branching tried %d times, succeeded %d times - average extra %7.3f, fixing %d times (%d, %7.3f)", nautyBranchCalls_,nautyBranchSucceeded_,branchSuccess, nautyFixCalls_,nautyFixSucceeded_,fixSuccess); lastNautyBranchCalls_=nautyBranchCalls_; lastNautyFixCalls_=nautyFixCalls_; } else { printSomething=false; } } else { returnCode = nauty_info_->getNumGenerators(); if (!nauty_info_->errorStatus()) { if (returnCode && numberUsefulOrbits_) { sprintf (general,"Nauty: %d orbits (%d useful covering %d variables), %d generators, group size: %g - dense size %d, sparse %d - took %g seconds", nauty_info_->getNumOrbits(),numberUsefulOrbits_,numberUsefulObjects_, nauty_info_ -> getNumGenerators () , nauty_info_ -> getGroupSize (), whichOrbit_[0],whichOrbit_[1],nautyTime_); } else { if ((model->moreSpecialOptions2()&(128|256))!=(128|256)) sprintf(general,"Nauty did not find any useful orbits in time %g",nautyTime_); else sprintf(general,"Nauty did not find any useful orbits - but keeping Nauty on"); } } else { // error sprintf(general,"Nauty failed with error code %d (%g seconds)", nauty_info_->errorStatus(),nautyTime_); model->setMoreSpecialOptions2(model->moreSpecialOptions2()&~(128|256)); } } if (printSomething) model->messageHandler()->message(CBC_GENERAL, model->messages()) << general << CoinMessageEol ; return returnCode; } void CbcSymmetry::Print_Orbits () const { //printf ("num gens = %d, num orbits = %d \n", nauty_info_ -> getNumGenerators(), nauty_info_ -> getNumOrbits() ); std::vector > *new_orbits = nauty_info_->getOrbits(); printf ("Nauty: %d generators, group size: %.0g", // nauty_info_->getNumOrbits(), nauty_info_ -> getNumGenerators () , nauty_info_ -> getGroupSize ()); int nNonTrivialOrbits = 0; for (unsigned int i = 0; i < new_orbits -> size(); i++) { if ((*new_orbits)[i].size() > 1) nNonTrivialOrbits++; else continue; // int orbsize = (*new_orbits)[i].size(); // printf( "Orbit %d [size: %d] [", i, orbsize); // copy ((*new_orbits)[i].begin(), (*new_orbits)[i].end(), // std::ostream_iterator(std::cout, " ")); // printf("] \n"); } printf (" (%d non-trivial orbits).\n", nNonTrivialOrbits); #if 1 if (nNonTrivialOrbits) { int orbCnt = 0; std::vector > *orbits = nauty_info_ -> getOrbits (); for (std::vector >::iterator i = orbits -> begin (); i != orbits -> end (); ++i) { printf ("Orbit %d: ", orbCnt++); for (std::vector::iterator j = i -> begin (); j != i -> end (); ++j) printf (" %d", *j); printf ("\n"); } } #endif #if 0 if (nNonTrivialOrbits) for (int i=0; i< nVars (); i++) { std::vector< int > *branch_orbit = Find_Orbit (i); if (branch_orbit -> size () > 1) { printf ("x%04d: ", i); for (std::vector::iterator it = branch_orbit -> begin (); it != branch_orbit -> end (); ++it) printf ("%d ", *it); printf ("\n"); } } #endif delete new_orbits; } void CbcSymmetry::fillOrbits() { for (int i=0;i > *orbits = nauty_info_ -> getOrbits (); for (std::vector >::iterator i = orbits -> begin (); i != orbits -> end (); ++i) { int nUseful=0; int jColumn=-2; for (std::vector::iterator j = i -> begin (); j != i -> end (); ++j) { int iColumn=*j; if (iColumn1) { numberUsefulOrbits_++; numberUsefulObjects_ += nUseful; } else if (jColumn>=0) { assert (nUseful); whichOrbit_[jColumn]=-2; } } delete orbits; } int CbcSymmetry::largestOrbit(const double * lower, const double * upper) const { int * counts = new int[numberUsefulOrbits_]; memset(counts,0,numberUsefulOrbits_*sizeof(int)); for (int i=0;i=0) { if (lower[i]==0.0&&upper[i]==1.0) counts[iOrbit]++; } } int iOrbit=-1; int maxOrbit=0; for (int i=0;imaxOrbit) { maxOrbit=counts[i]; iOrbit=i; } } delete [] counts; return iOrbit; } std::vector *CbcSymmetry::Find_Orbit(int index) const{ std::vector *orbit = new std::vector ; int which_orbit = -1; std::vector > *new_orbits = nauty_info_->getOrbits(); for (unsigned int i = 0; i < new_orbits -> size(); i++) { for (unsigned int j = 0; j < (*new_orbits)[i].size(); j++) { // for (std::vector :: iterator j = new_orbits[i].begin(); new_orbits[i].end(); ++j){ if( (*new_orbits)[i][j] == index) which_orbit = i; } } // for (std::vector :: iterator j = new_orbits[which_orbit].begin(); new_orbits[which_orbit].end(), ++j) for (unsigned int j = 0; j < (*new_orbits)[which_orbit].size(); j++) orbit -> push_back ((*new_orbits)[which_orbit][j]); delete new_orbits; return orbit; } void CbcSymmetry::ChangeBounds (const double * new_lb, const double * new_ub, int num_cols, bool justFixedAtOne) const { if (justFixedAtOne) nautyFixCalls_++; else nautyBranchCalls_++; std::sort(node_info_. begin (), node_info_. end (), index_sort); for (int i = 0; i < num_cols; i++) { // printf("Var %d lower bound: %f upper bound %f \n", i, new_lb[i], new_ub[i]); assert (node_info_[i].get_index () == i); double newLower = new_lb[i]; double newUpper = new_ub[i]; if (justFixedAtOne) { // free up all fixed at zero if (!newLower) newUpper = 1.0; } node_info_[i ].bounds ( newLower , newUpper ); //printf("Var %d INPUT lower bound: %f upper bound %f \n", i, node_info_[i].get_lb(), node_info_[i].get_ub()); } } void CbcSymmetry::setupSymmetry (const OsiSolverInterface & solver) { double startCPU = CoinCpuTime (); const double *objective = solver.getObjCoefficients() ; const double *columnLower = solver.getColLower() ; const double *columnUpper = solver.getColUpper() ; int numberColumns = solver.getNumCols() ; int numberRows = solver.getNumRows(); int iRow, iColumn; // Row copy CoinPackedMatrix matrixByRow(*solver.getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); const double * rowLower = solver.getRowLower(); const double * rowUpper = solver.getRowUpper(); // // Find Coefficients /// initialize nauty int num_affine = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (objective[iColumn] && objective[iColumn]!=1.0) num_affine++; } for (iRow = 0; iRow < numberRows; iRow++) { for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int jColumn = column[j]; double value = elementByRow[j]; if (value!=1.0) num_affine++; } } // Create Nauty object int coef_count= numberRows + numberColumns +1; int nc = num_affine + coef_count; // create graph (part 1) for (iColumn = 0; iColumn < numberColumns; iColumn++) { Node var_vertex; var_vertex.node(iColumn,0.0,columnLower[iColumn],columnUpper[iColumn],-1,-1 ); node_info_.push_back(var_vertex); } // objective int index = numberColumns; { Node vertex; vertex.node( index , 0.0 , -COIN_DBL_MAX, COIN_DBL_MAX, COUENNE_HACKED_EXPRGROUP, 0); node_info_.push_back( vertex); } // compute space for sparse size_t * v = NULL; int * d = NULL; int * e = NULL; bool sparse=false; double spaceDense = nc+WORDSIZE-1; spaceDense *= nc+WORDSIZE-1; spaceDense /= WORDSIZE; int spaceSparse = 0; { size_t numberElements = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = objective[iColumn]; if (value) { if (value==1.0) { numberElements+=2; } else { numberElements+=4; coef_count ++; } } } for (iRow = 0; iRow < numberRows; iRow++) { for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int jColumn = column[j]; double value = elementByRow[j]; if (value==1.0) { numberElements+=2; } else { numberElements+=4; coef_count ++; } } } spaceSparse = 2*nc+numberElements; //printf("Space for sparse is %d for dense %g\n", // spaceSparse,spaceDense); #ifdef NTY_TRACES bool goSparse = true; #else bool goSparse = (spaceSparseaddElement(index,iColumn); nauty_info_->addElement(iColumn,index); } else { Node coef_vertex; coef_vertex.node( coef_count, value, value, value, -2, 0 ); node_info_.push_back(coef_vertex); nauty_info_->addElement(index, coef_count); nauty_info_->addElement(coef_count, index); nauty_info_->addElement(coef_count, iColumn); nauty_info_->addElement(iColumn, coef_count); coef_count ++; } } } index++; for (iRow = 0; iRow < numberRows; iRow++) { Node vertex; vertex.node( index , 0.0 , rowLower[iRow], rowUpper[iRow], COUENNE_HACKED_EXPRGROUP, 0); node_info_.push_back( vertex); for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int jColumn = column[j]; double value = elementByRow[j]; if (value==1.0) { nauty_info_->addElement(index,jColumn); nauty_info_->addElement(jColumn,index); } else { Node coef_vertex; coef_vertex.node( coef_count, value, value, value, -2, 0 ); node_info_.push_back(coef_vertex); nauty_info_->addElement(index, coef_count); nauty_info_->addElement(coef_count, index); nauty_info_->addElement(coef_count, jColumn); nauty_info_->addElement(jColumn, coef_count); coef_count ++; } } index++; } } numberColumns_ = numberColumns; whichOrbit_ = new int [2*numberColumns_]; nautyBranchCalls_ = 0; nautyBranchSucceeded_ = 0; nautyFixCalls_ = 0; nautyFixSucceeded_ = 0; nautyTime_ = 0.0; nautyFixes_= 0.0; nautyOtherBranches_ = 0.0; Compute_Symmetry (); fillOrbits(); //whichOrbit_[2]=numberUsefulOrbits_; //Print_Orbits (); // stats in array if (spaceDensegetNumCols(); char * status = new char [numberColumns]; ChangeBounds(solver->getColLower(), solver->getColUpper(), solver->getNumCols(),true); Compute_Symmetry(); fillOrbits(); int n=0; //#define PRINT_MORE 1 const int * alternativeOrbits = whichOrbit(); if (alternativeOrbits) { for (int i=0;igetColUpper()[i]) { if (solver->getColLower()[i]) { type='1'; } else { double value=solver->getColSolution()[i]; if (value<0.0001) type='L'; else if (value>0.9999) type='U'; else type='X'; } } status[i]=type; } n=0; for (int i=0;i1 printf("In alternative orbit %d - %d free (%c), %d fixed to 0\n", iOrbit,i,status[i],j); #endif status[i]='0'; // can fix on both branches solver->setColUpper(i,0.0); n++; break; } } } } } delete [] status; if (n) { nautyFixSucceeded_++; nautyFixes_ += n; #if PRINT_MORE printf("%d orbital fixes\n",n); #endif } return n; } // Default Constructor CbcSymmetry::CbcSymmetry () : nauty_info_(NULL), numberColumns_(0), numberUsefulOrbits_(0), numberUsefulObjects_(0), whichOrbit_(NULL) { } // Copy constructor CbcSymmetry::CbcSymmetry ( const CbcSymmetry & rhs) { node_info_ = rhs.node_info_; nauty_info_ = new CbcNauty(*rhs.nauty_info_); numberUsefulOrbits_ = rhs.numberUsefulOrbits_; numberUsefulObjects_ = rhs.numberUsefulObjects_; numberColumns_ = rhs.numberColumns_; if (rhs.whichOrbit_) whichOrbit_=CoinCopyOfArray(rhs.whichOrbit_,numberColumns_); else whichOrbit_ = NULL; } // Assignment operator CbcSymmetry & CbcSymmetry::operator=( const CbcSymmetry & rhs) { if (this != &rhs) { delete nauty_info_; node_info_ = rhs.node_info_; nauty_info_ = new CbcNauty(*rhs.nauty_info_); delete [] whichOrbit_; numberColumns_ = rhs.numberColumns_; numberUsefulOrbits_ = rhs.numberUsefulOrbits_; numberUsefulObjects_ = rhs.numberUsefulObjects_; if (rhs.whichOrbit_) whichOrbit_=CoinCopyOfArray(rhs.whichOrbit_,numberColumns_); else whichOrbit_ = NULL; } return *this; } // Destructor CbcSymmetry::~CbcSymmetry () { delete nauty_info_; delete [] whichOrbit_; } CbcNauty::CbcNauty(int vertices, const size_t * v, const int * d, const int * e) { //printf("Need sparse nauty - wordsize %d\n",WORDSIZE); n_ = vertices; m_ = (n_ + WORDSIZE - 1)/WORDSIZE; if (v) nel_ = v[n_]; else nel_ = 0; //printf ("size of long = %d (%d)\nwordsize = %d\nn,m = %d,%d\n", // SIZEOF_LONG, sizeof (long), WORDSIZE, n_, m_); nauty_check (WORDSIZE, m_, n_, NAUTYVERSIONID); /// Apparently sizes are skewed on 64bit machines #define MULTIPLIER 1 if (!nel_) { G_ = (graph *) malloc(MULTIPLIER * m_ * n_ * sizeof(int)); GSparse_ = NULL; } else { G_ = NULL; GSparse_ = (sparsegraph *) malloc(sizeof(sparsegraph)); SG_INIT(*GSparse_); SG_ALLOC(*GSparse_,n_,nel_,"malloc"); GSparse_->nv = n_; /* Number of vertices */ GSparse_->nde = nel_; } lab_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); ptn_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); active_ = NULL; orbits_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); #ifndef NTY_TRACES options_ = (optionblk *) malloc(MULTIPLIER * sizeof(optionblk)); stats_ = (statsblk *) malloc(MULTIPLIER * sizeof(statsblk)); #else options_ = (TracesOptions *) malloc(MULTIPLIER * sizeof(TracesOptions)); stats_ = (TracesStats *) malloc(MULTIPLIER * sizeof(TracesStats)); #endif worksize_ = 100*m_; workspace_ = (setword *) malloc(MULTIPLIER * worksize_*sizeof(setword)); canonG_ = NULL; if ((G_ == 0&&GSparse_ == 0) || lab_ == 0 || ptn_ == 0 || orbits_ == 0 || options_ == 0 || stats_ == 0 || workspace_ == 0) assert(0); // Zero allocated memory if (G_) { memset(G_, 0, m_*n_*sizeof(int)); } else { //for (int i=0;iv[i]=v[i]; //} memcpy(GSparse_->v,v,n_*sizeof(size_t)); memcpy(GSparse_->d,d,n_*sizeof(int)); memcpy(GSparse_->e,e,nel_*sizeof(int)); } memset(lab_, 0, n_*sizeof(int)); memset(ptn_, 0, n_*sizeof(int)); memset(orbits_, 0, n_*sizeof(int)); memset(workspace_, 0, worksize_*sizeof(setword)); #ifndef NTY_TRACES memset(options_, 0,MULTIPLIER * sizeof(optionblk)); #else memset(options_, 0,MULTIPLIER * sizeof(TracesOptions)); #endif // Set the options you want #ifndef NTY_TRACES options_->getcanon = FALSE; options_->digraph = FALSE; options_->writeautoms = FALSE; options_->writemarkers = FALSE; options_->defaultptn = TRUE; options_->cartesian = FALSE; options_->linelength = 78; options_->outfile = NULL; options_->userrefproc = NULL; options_->userautomproc = NULL; options_->userlevelproc = NULL; options_->usernodeproc = NULL; // options_->usertcellproc = NULL; options_->invarproc = NULL; options_->tc_level = 100; options_->mininvarlevel = 0; options_->maxinvarlevel = 1; options_->invararg = 0; options_->dispatch = &dispatch_graph; #else options_->getcanon = FALSE; options_->writeautoms = FALSE; options_->cartesian = FALSE; options_->digraph = FALSE; options_->defaultptn = TRUE; options_->linelength = 78; #endif if (G_) { // Make an empty graph for (int j = 0; j < n_; j++) { set *gv = GRAPHROW(G_, j, m_); EMPTYSET(gv, m_); } } vstat_ = new int[n_]; clearPartitions(); afp_ = NULL; } CbcNauty::~CbcNauty() { if (G_) free(G_); if (GSparse_) { SG_FREE(*GSparse_); free(GSparse_); } if (lab_) free(lab_); if (ptn_) free(ptn_); if (active_) free(active_); if (orbits_) free(orbits_); if (options_) free(options_); if (stats_) free(stats_); if (workspace_) free(workspace_); if (canonG_) free(canonG_); if (vstat_) delete [] vstat_; } // Copy constructor CbcNauty::CbcNauty ( const CbcNauty & rhs) { n_ = rhs.n_; m_ = rhs.m_; nel_ = rhs.nel_; G_ = NULL; GSparse_ = NULL; if (!nel_) { G_ = (graph *) malloc(MULTIPLIER * m_ * n_ * sizeof(int)); } else { GSparse_ = (sparsegraph *) malloc(sizeof(sparsegraph)); SG_INIT(*GSparse_); SG_ALLOC(*GSparse_,n_,nel_,"malloc"); GSparse_->nv = n_; /* Number of vertices */ GSparse_->nde = nel_; } lab_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); ptn_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); orbits_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); #ifndef NTY_TRACES options_ = (optionblk *) malloc(MULTIPLIER * sizeof(optionblk)); stats_ = (statsblk *) malloc(MULTIPLIER * sizeof(statsblk)); #else options_ = (TracesOptions *) malloc(MULTIPLIER * sizeof(TracesOptions)); stats_ = (TracesStats *) malloc(MULTIPLIER * sizeof(TracesStats)); #endif worksize_ = 100*m_; workspace_ = (setword *) malloc(MULTIPLIER * worksize_*sizeof(setword)); vstat_ = new int[n_]; canonG_ = NULL; if ((G_ == 0 && GSparse_ == 0) || lab_ == 0 || ptn_ == 0 || orbits_ == 0 || options_ == 0 || stats_ == 0 || workspace_ == 0) assert(0); // Copy allocated memory if (G_) { memcpy(G_, rhs.G_, m_*n_*sizeof(int)); } else { memcpy(GSparse_->v,rhs.GSparse_->v,n_*sizeof(size_t)); memcpy(GSparse_->d,rhs.GSparse_->d,n_*sizeof(int)); memcpy(GSparse_->e,rhs.GSparse_->e,nel_*sizeof(int)); } memcpy(lab_, rhs.lab_, n_*sizeof(int)); memcpy(ptn_, rhs.ptn_, n_*sizeof(int)); memcpy(orbits_, rhs.orbits_, n_*sizeof(int)); memcpy(workspace_, rhs.workspace_, worksize_*sizeof(setword)); #ifndef NTY_TRACES memcpy(options_, rhs.options_, MULTIPLIER * sizeof(optionblk)); memcpy(stats_, rhs.stats_, MULTIPLIER * sizeof(statsblk)); #else memcpy(options_, rhs.options_,MULTIPLIER * sizeof(TracesOptions)); memcpy(stats_, rhs.stats_, MULTIPLIER * sizeof(TracesStats)); #endif memcpy(vstat_,rhs.vstat_,n_*sizeof(int)); // ? clearPartitions(); active_ = NULL; afp_ = rhs.afp_; // ? no copy ? } // Assignment operator CbcNauty & CbcNauty::operator=( const CbcNauty & rhs) { if (this != &rhs) { if (G_) free(G_); if (GSparse_) { SG_FREE(*GSparse_); free(GSparse_); } if (lab_) free(lab_); if (ptn_) free(ptn_); if (active_) free(active_); if (orbits_) free(orbits_); if (options_) free(options_); if (stats_) free(stats_); if (workspace_) free(workspace_); if (canonG_) free(canonG_); if (vstat_) delete [] vstat_; { n_ = rhs.n_; m_ = rhs.m_; nel_ = rhs.nel_; G_ = NULL; GSparse_ = NULL; if (!nel_) { G_ = (graph *) malloc(MULTIPLIER * m_ * n_ * sizeof(int)); } else { GSparse_ = (sparsegraph *) malloc(sizeof(sparsegraph)); SG_INIT(*GSparse_); SG_ALLOC(*GSparse_,n_,nel_,"malloc"); GSparse_->nv = n_; /* Number of vertices */ GSparse_->nde = nel_; } lab_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); ptn_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); orbits_ = (int *) malloc(MULTIPLIER * n_ * sizeof(int)); #ifndef NTY_TRACES options_ = (optionblk *) malloc(MULTIPLIER * sizeof(optionblk)); stats_ = (statsblk *) malloc(MULTIPLIER * sizeof(statsblk)); #else options_ = (TracesOptions *) malloc(MULTIPLIER * sizeof(TracesOptions)); stats_ = (TracesStats *) malloc(MULTIPLIER * sizeof(TracesStats)); #endif worksize_ = 100*m_; workspace_ = (setword *) malloc(MULTIPLIER * worksize_*sizeof(setword)); vstat_ = new int[n_]; canonG_ = NULL; if ((G_ == 0 && GSparse_ == 0) || lab_ == 0 || ptn_ == 0 || orbits_ == 0 || options_ == 0 || stats_ == 0 || workspace_ == 0) assert(0); // Copy allocated memory if (!nel_) { memcpy(G_, rhs.G_, m_*n_*sizeof(int)); } else { memcpy(GSparse_->v,rhs.GSparse_->v,n_*sizeof(size_t)); memcpy(GSparse_->d,rhs.GSparse_->d,n_*sizeof(int)); memcpy(GSparse_->e,rhs.GSparse_->e,nel_*sizeof(int)); } memcpy(lab_, rhs.lab_, n_*sizeof(int)); memcpy(ptn_, rhs.ptn_, n_*sizeof(int)); memcpy(orbits_, rhs.orbits_, n_*sizeof(int)); memcpy(workspace_, rhs.workspace_, worksize_*sizeof(setword)); #ifndef NTY_TRACES memcpy(options_, rhs.options_, MULTIPLIER * sizeof(optionblk)); memcpy(stats_, rhs.stats_, MULTIPLIER * sizeof(statsblk)); #else memcpy(options_, rhs.options_,MULTIPLIER * sizeof(TracesOptions)); memcpy(stats_, rhs.stats_, MULTIPLIER * sizeof(TracesStats)); #endif memcpy(vstat_,rhs.vstat_,n_*sizeof(int)); // ? clearPartitions(); active_ = NULL; afp_ = rhs.afp_; // ? no copy ? } } return *this; } void CbcNauty::addElement(int ix, int jx) { // Right now die if bad index. Can throw exception later //printf("addelement %d %d \n", ix, jx); assert(ix < n_ && jx < n_); if(ix != jx){ //No Loops set *gv = GRAPHROW(G_, ix, m_); ADDELEMENT(gv, jx); set *gv2 = GRAPHROW(G_, jx, m_); ADDELEMENT(gv2, ix); autoComputed_ = false; } } void CbcNauty::clearPartitions() { for (int j = 0; j < n_; j++) { vstat_[j] = 1; //printf("vstat %d = %d", j, vstat_[j]); } autoComputed_ = false; } void CbcNauty::computeAuto() { // if (autoComputed_) return; //double startCPU = CoinCpuTime (); options_->defaultptn = FALSE; // Here we only implement the partitions // [ fix1 | fix0 (union) free | constraints ] int ix = 0; for( int color = 1; color <= n_; color++){ for (int j = 0; j < n_; j++) { if (vstat_[j] == color) { lab_[ix] = j; ptn_[ix] = color; ix++; } } if (ix > 0) ptn_[ix-1] = 0; } /* for (int j = 0; j < n_; j++) printf("ptn %d = %d lab = %d \n", j, ptn_[j], lab_[j]); */ // Should be number of columns assert(ix == n_); // Now the constraints if needed // Compute Partition if (G_) { #ifndef NTY_TRACES nauty(G_, lab_, ptn_, active_, orbits_, options_, stats_, workspace_, worksize_, m_, n_, canonG_); #else abort(); #endif } else { #if NAUTY_MAX_LEVEL nauty_maxalllevel=NAUTY_MAX_LEVEL; #endif #ifndef NTY_TRACES options_->dispatch = &dispatch_sparse; sparsenauty(GSparse_, lab_, ptn_, orbits_, options_, stats_, NULL); #else //options_->dispatch = &dispatch_sparse; Traces(GSparse_, lab_, ptn_, orbits_, options_, stats_, NULL); #endif } autoComputed_ = true; //double endCPU = CoinCpuTime (); //nautyTime_ += endCPU - startCPU; // Need to make sure all generators are written if (afp_) fflush(afp_); } void CbcNauty::deleteElement(int ix, int jx) { // Right now die if bad index. Can throw exception later assert(ix < n_ && jx < n_); set *gv = GRAPHROW(G_, ix, m_); if (ISELEMENT(gv, jx)) { DELELEMENT(gv, jx); } autoComputed_ = false; } double CbcNauty::getGroupSize() const { if (!autoComputed_) return -1.0; return( stats_->grpsize1 * pow(10.0, (double) stats_->grpsize2) ); } int CbcNauty::getNumGenerators() const { if (!autoComputed_) return -1; return(stats_->numgenerators); } int CbcNauty::getNumOrbits() const { if (!autoComputed_) return -1; return(stats_->numorbits); } std::vector > *CbcNauty::getOrbits() const { std::vector > *orb = new std::vector >; if (!autoComputed_) return orb; orb -> resize(getNumOrbits()); std::multimap orbmap; std::set orbkeys; for (int j = 0; j < n_; j++) { orbkeys.insert(orbits_[j]); orbmap.insert(std::make_pair(orbits_[j], j)); } int orbix = 0; for (std::set::iterator it = orbkeys.begin(); it != orbkeys.end(); ++it) { std::multimap::iterator pos; for (pos = orbmap.lower_bound(*it); pos != orbmap.upper_bound(*it); ++pos) { (*orb)[orbix].push_back(pos->second); } orbix++; } assert(orbix == getNumOrbits()); return orb; } void CbcNauty::getVstat(double *v, int nv) { assert(nv == n_); memcpy(v, vstat_, nv * sizeof(VarStatus)); } /* bool CbcNauty::isAllFixOneOrbit(const std::vector &orbit) const { for(std::vector::const_iterator it = orbit.begin(); it != orbit.end(); ++it) { if (*it >= n_) return false; if (vstat_[*it] != FIX_AT_ONE) return false; } return true; } bool CbcNauty::isAllFreeOrbit(const std::vector &orbit) const { for(std::vector::const_iterator it = orbit.begin(); it != orbit.end(); ++it) { if (*it >= n_) return false; if (vstat_[*it] != FREE) return false; } return true; } bool CbcNauty::isConstraintOrbit(const std::vector &orbit) const { for(std::vector::const_iterator it = orbit.begin(); it != orbit.end(); ++it) { if (*it >= n_) return true; } return false; } bool CbcNauty::isMixedFreeZeroOrbit(const std::vector &orbit) const { bool containsFree = false; bool containsZero = false; for(std::vector::const_iterator it = orbit.begin(); it != orbit.end(); ++it) { if (*it >= n_) return false; if (vstat_[*it] == FREE) containsFree = true; if (vstat_[*it] == FIX_AT_ZERO) containsZero = true; if (containsFree && containsZero) break; } return (containsFree && containsZero); } */ void CbcNauty::setWriteAutoms(const std::string &fname) { afp_ = fopen(fname.c_str(), "w"); options_->writeautoms = TRUE; #ifndef NTY_TRACES options_->writemarkers = FALSE; #endif options_->outfile = afp_; } void CbcNauty::unsetWriteAutoms() { fclose(afp_); options_->writeautoms = FALSE; } // Default Constructor CbcOrbitalBranchingObject::CbcOrbitalBranchingObject() : CbcBranchingObject(), column_(-1), numberOther_(0), numberExtra_(0), fixToZero_(NULL) { } // Useful constructor CbcOrbitalBranchingObject::CbcOrbitalBranchingObject (CbcModel * model, int column, int way , int numberExtra, const int * extraToZero) : CbcBranchingObject(model, -1, way, 0.5), column_(column), numberOther_(0), numberExtra_(0), fixToZero_(NULL) { CbcSymmetry * symmetryInfo = model->symmetryInfo(); assert (symmetryInfo); // Filled in (hopefully) const int * orbit = symmetryInfo->whichOrbit(); int iOrbit=orbit[column]; assert (iOrbit>=0); int numberColumns = model->getNumCols(); numberOther_=-1; for (int i=0;i0); nautyBranchSucceeded_++; nautyOtherBranches_ += numberOther_; numberExtra_ = numberExtra; fixToZero_ = new int [numberOther_+numberExtra_]; int n=0; for (int i=0;ilogLevel()>1) print(); OsiSolverInterface * solver = model_->solver(); if (way_ < 0) { solver->setColUpper(column_,0.0); for ( int i = 0; i < numberOther_+numberExtra_; i++) { solver->setColUpper(fixToZero_[i],0.0); } way_ = 1; // Swap direction } else { solver->setColLower(column_,1.0); for (int i = numberOther_; i < numberOther_+numberExtra_; i++) { solver->setColUpper(fixToZero_[i],0.0); } way_ = -1; // Swap direction } return 0.0; } /* Update bounds in solver as in 'branch' and update given bounds. branchState is -1 for 'down' +1 for 'up' */ void CbcOrbitalBranchingObject::fix(OsiSolverInterface * solver, double * lower, double * upper, int branchState) const { if (branchState < 0) { upper[column_]=0.0; for ( int i = 0; i < numberOther_+numberExtra_; i++) { upper[fixToZero_[i]]=0.0;; } } else { lower[column_]=1.0; for (int i = numberOther_; i < numberOther_+numberExtra_; i++) { upper[fixToZero_[i]]=0.0;; } } } // Print what would happen void CbcOrbitalBranchingObject::print() { if (way_ < 0) { printf("Orbital Down - to zero %d",column_); for ( int i = 0; i < numberOther_+numberExtra_; i++) { printf(" %d",fixToZero_[i]); } } else { printf("Orbital Up - to one %d, to zero",column_); for (int i = numberOther_; i < numberOther_+numberExtra_; i++) { printf(" %d",fixToZero_[i]); } } printf("\n"); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcOrbitalBranchingObject::compareOriginalObject (const CbcBranchingObject* brObj) const { const CbcOrbitalBranchingObject* br = dynamic_cast(brObj); assert(!br); abort(); return 0; } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcOrbitalBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap) { const CbcOrbitalBranchingObject* br = dynamic_cast(brObj); assert(!br); abort(); return CbcRangeDisjoint; } #endif CoinMP-1.8.3/Cbc/src/CbcBranchBase.cpp0000644000175000017500000002210711510742604015700 0ustar renerene/* $Id: CbcBranchBase.cpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "OsiChooseVariable.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchBase.hpp" // Default Constructor CbcObject::CbcObject() : OsiObject(), model_(NULL), id_(-1), position_(-1), preferredWay_(0) { } // Constructor from model CbcObject::CbcObject(CbcModel * model) : OsiObject(), model_(model), id_(-1), position_(-1), preferredWay_(0) { } // Destructor CbcObject::~CbcObject () { } // Copy constructor CbcObject::CbcObject ( const CbcObject & rhs) : OsiObject(rhs) { model_ = rhs.model_; id_ = rhs.id_; position_ = rhs.position_; preferredWay_ = rhs.preferredWay_; } // Assignment operator CbcObject & CbcObject::operator=( const CbcObject & rhs) { if (this != &rhs) { OsiObject::operator=(rhs); model_ = rhs.model_; id_ = rhs.id_; position_ = rhs.position_; preferredWay_ = rhs.preferredWay_; } return *this; } /* Returns floor and ceiling i.e. closest valid points */ void CbcObject::floorCeiling(double & floorValue, double & ceilingValue, double value, double tolerance) const { if (fabs(floor(value + 0.5) - value) > tolerance) { floorValue = floor(value); } else { floorValue = floor(value + 0.5); } ceilingValue = floorValue + 1.0; } /* For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. Returns measure of how much it had to move solution to make feasible */ double CbcObject::feasibleRegion(OsiSolverInterface * /*solver*/) const { //assert (solver==model_->solver()); CbcObject * fudge = const_cast(this); fudge->feasibleRegion(); return 0.0; } /* For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. Returns measure of how much it had to move solution to make feasible */ double CbcObject::feasibleRegion(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * /*info*/) const { //assert (solver==model_->solver()); CbcObject * fudge = const_cast(this); fudge->feasibleRegion(); return 0.0; } /* Create a branching object and indicate which way to branch first. The branching object has to know how to create branches (fix variables, etc.) */ OsiBranchingObject * CbcObject::createOsiBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const { //assert (solver==model_->solver()); CbcObject * fudge = const_cast(this); return fudge->createBranch(solver, info, way); } /* Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ OsiSolverBranch * CbcObject::solverBranch() const { return NULL; } /* Pass in information on branch just done and create CbcObjectUpdateData instance. If object does not need data then backward pointer will be NULL. Assumes can get information from solver */ CbcObjectUpdateData CbcObject::createUpdateInformation(const OsiSolverInterface * /*solver*/, const CbcNode * /*node*/, const CbcBranchingObject * /*branchingObject*/) { return CbcObjectUpdateData(); } // Default Constructor CbcBranchingObject::CbcBranchingObject() : OsiBranchingObject() { model_ = NULL; originalCbcObject_ = NULL; variable_ = -1; way_ = 0; } // Useful constructor CbcBranchingObject::CbcBranchingObject (CbcModel * model, int variable, int way , double value) : OsiBranchingObject(model->solver(), value) { model_ = model; originalCbcObject_ = NULL; variable_ = variable; way_ = way; } // Copy constructor CbcBranchingObject::CbcBranchingObject ( const CbcBranchingObject & rhs) : OsiBranchingObject(rhs) { model_ = rhs.model_; originalCbcObject_ = rhs.originalCbcObject_; variable_ = rhs.variable_; way_ = rhs.way_; value_ = rhs.value_; } // Assignment operator CbcBranchingObject & CbcBranchingObject::operator=( const CbcBranchingObject & rhs) { if (this != &rhs) { OsiBranchingObject::operator=(rhs); model_ = rhs.model_; originalCbcObject_ = rhs.originalCbcObject_; variable_ = rhs.variable_; way_ = rhs.way_; } return *this; } // Destructor CbcBranchingObject::~CbcBranchingObject () { } // Default Constructor CbcBranchDecision::CbcBranchDecision () : object_(NULL), model_(NULL), chooseMethod_(NULL) { } // Copy Constructor CbcBranchDecision::CbcBranchDecision (const CbcBranchDecision &rhs) : object_(NULL), model_(rhs.model_), chooseMethod_(NULL) { if (rhs.chooseMethod_) chooseMethod_ = rhs.chooseMethod_->clone(); } CbcBranchDecision::~CbcBranchDecision() { delete object_; delete chooseMethod_; } /* Compare N branching objects. Return index of best and sets way of branching in chosen object. This routine is used only after strong branching. This is reccommended version as it can be more sophisticated */ int CbcBranchDecision::bestBranch (CbcBranchingObject ** objects, int numberObjects, int /*numberUnsatisfied*/, double * changeUp, int * numberInfeasibilitiesUp, double * changeDown, int * numberInfeasibilitiesDown, double /*objectiveValue*/) { int bestWay = 0; int whichObject = -1; if (numberObjects) { initialize(objects[0]->model()); CbcBranchingObject * bestObject = NULL; for (int i = 0 ; i < numberObjects ; i++) { int betterWay = betterBranch(objects[i], bestObject, changeUp[i], numberInfeasibilitiesUp [i], changeDown[i], numberInfeasibilitiesDown[i] ); if (betterWay) { bestObject = objects[i]; bestWay = betterWay; whichObject = i; } } // set way in best if (whichObject >= 0) objects[whichObject]->way(bestWay); } return whichObject; } // Set (clone) chooseMethod void CbcBranchDecision::setChooseMethod(const OsiChooseVariable & method) { delete chooseMethod_; chooseMethod_ = method.clone(); } // Default constructor CbcConsequence::CbcConsequence() { } // Destructor CbcConsequence::~CbcConsequence () { } // Copy constructor CbcConsequence::CbcConsequence ( const CbcConsequence & /*rhs*/) { } // Assignment operator CbcConsequence & CbcConsequence::operator=( const CbcConsequence & rhs) { if (this != &rhs) { } return *this; } // Default constructor CbcObjectUpdateData::CbcObjectUpdateData() : object_(NULL), way_(0), objectNumber_(-1), change_(0.0), status_(0), intDecrease_(0), branchingValue_(0.0), originalObjective_(COIN_DBL_MAX), cutoff_(COIN_DBL_MAX) { } // Useful constructor CbcObjectUpdateData::CbcObjectUpdateData (CbcObject * object, int way, double change, int status, int intDecrease, double branchingValue) : object_(object), way_(way), objectNumber_(-1), change_(change), status_(status), intDecrease_(intDecrease), branchingValue_(branchingValue), originalObjective_(COIN_DBL_MAX), cutoff_(COIN_DBL_MAX) { } // Destructor CbcObjectUpdateData::~CbcObjectUpdateData () { } // Copy constructor CbcObjectUpdateData::CbcObjectUpdateData ( const CbcObjectUpdateData & rhs) : object_(rhs.object_), way_(rhs.way_), objectNumber_(rhs.objectNumber_), change_(rhs.change_), status_(rhs.status_), intDecrease_(rhs.intDecrease_), branchingValue_(rhs.branchingValue_), originalObjective_(rhs.originalObjective_), cutoff_(rhs.cutoff_) { } // Assignment operator CbcObjectUpdateData & CbcObjectUpdateData::operator=( const CbcObjectUpdateData & rhs) { if (this != &rhs) { object_ = rhs.object_; way_ = rhs.way_; objectNumber_ = rhs.objectNumber_; change_ = rhs.change_; status_ = rhs.status_; intDecrease_ = rhs.intDecrease_; branchingValue_ = rhs.branchingValue_; originalObjective_ = rhs.originalObjective_; cutoff_ = rhs.cutoff_; } return *this; } CoinMP-1.8.3/Cbc/src/CbcCbcParam.cpp0000644000175000017500000000053312131054770015357 0ustar renerene/* $Id: CbcCbcParam.cpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CbcConfig.h" #ifndef COIN_HAS_CBC #define COIN_HAS_CBC #endif #include "CbcOrClpParam.cpp" CoinMP-1.8.3/Cbc/src/CbcGenMessages.cpp0000644000175000017500000001264112131054770016113 0ustar renerene/*! \legal Copyright (C) 2007 Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenMessages.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #include "CbcGenMessages.hpp" #include "CbcGenCtlBlk.hpp" namespace { char svnid[] = "$Id: CbcGenMessages.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } /* Begin file local namespace */ namespace { /* Message definitions. The precise form isn't important here, so long as the method that loads them into a CoinMessages object can come up with values for external ID, detail level, and format string. The use of an enum to provide an internal ID for each message is mainly useful with the internationalisation feature. It makes it easy to slap the same ID on alternate versions of a message. */ typedef struct { CbcGenMsgCode inID ; int exID ; int lvl ; const char *fmt ; } MsgDefn ; static MsgDefn us_en_defns[] = { // informational (0 -- 2999) { CBCGEN_TEST_MSG, 1, 2, "This is the us_en test message, eh." }, { CBCGEN_NEW_SOLVER, 2, 2, "Solver is now \"%s\"." }, // warning (3000 -- 5999) // Non-fatal errors (6000 -- 8999) // Fatal errors (9000 and up) { CBCGEN_CONFUSION, 9001, 1, "Internal confusion, line %d." }, { CBCGEN_DUMMY_END, 999999, 0, "" } } ; /* We seem to need a dummy CoinMessages object to prevent the compiler from complaining that CoinMessages::Language is unintialised. const CoinMessages dummy(0) ; */ /* The author is Canadian, eh. But we'll go with us_en anyways. */ const CoinMessages::Language default_language = CoinMessages::us_en ; } /* End file local namespace */ /*! This function constructs a CoinMessages object filled with a default set of messages, overlaid with whatever is available for the specified language. It is used to establish the initial set of messages, and is also called whenever the language is changed. The latter, because there's no way of guaranteeing that the message sets for alternate languages will all replace the same messages. This approach guarantees that the set of messages is always composed of the default language overlaid with any messages for an alternate language. The default for lang is us_en, specified up in CbcGenCtlBlk.hpp. If you want to change the default language, change the declaration there. That said, you'll also have to provide the necessary message definitions and augment the case statements below. */ void CbcGenCtlBlk::setMessages (CoinMessages::Language lang) { /* If messages exist, in the correct language, we have nothing more to do. */ if (msgs_ && cur_lang_ == lang) { return ; } /* Otherwise, we need to do a wholesale rebuild. Create a new object of the appropriate size. */ CoinMessages *msgs = new CoinMessages(sizeof(us_en_defns) / sizeof(MsgDefn)) ; msgs->setLanguage(lang) ; strcpy(msgs->source_, "CbcG"); /* Yes, this is gloriously redundant, but it's set up in anticipation of future extensions. */ MsgDefn *msgdefn ; switch (lang) { case CoinMessages::us_en: { msgdefn = us_en_defns ; break ; } default: { msgdefn = us_en_defns ; break ; } } /* Open a loop to create and load the messages. */ while (msgdefn->inID != CBCGEN_DUMMY_END) { CoinOneMessage msg(msgdefn->exID, msgdefn->lvl, msgdefn->fmt) ; msgs->addMessage(msgdefn->inID, msg) ; msgdefn++ ; } /* Now, if the local language differs from the default language, load any overrides. Again, useless now, but maybe in the future ... */ if (lang != cur_lang_) { switch (lang) { case CoinMessages::us_en: { msgdefn = us_en_defns ; break; } default: { msgdefn = us_en_defns ; break; } } while (msgdefn->inID != CBCGEN_DUMMY_END) { msgs->replaceMessage(msgdefn->inID, msgdefn->fmt) ; msgdefn++ ; } } /* Each CoinOneMessage has a fixed-length array to hold the message; by default this is 400 chars. Convert to `compressed' CoinOneMessage objects where the array is only as large as necessary. Any attempt to replace a message, or the message text, will automatically trigger a decompress operation before doing the replacement, but the messages will *not* be automatically recompressed. */ msgs->toCompact() ; msgs_ = msgs ; return ; } /* Replaces the current message handler with the handler supplied as a parameter. If ourMsgHandler_ is true, the existing handler is destroyed. */ void CbcGenCtlBlk::passInMessageHandler (CoinMessageHandler *newMsgHandler) { if (msgHandler_ && ourMsgHandler_) { delete msgHandler_ ; } msgHandler_ = newMsgHandler ; ourMsgHandler_ = false ; return ; } /* Start a message. This routine buries the whole business of locating the message handler and messages, getting the log level right, etc. If, by some chance, messages are not yet loaded, do so. */ CoinMessageHandler &CbcGenCtlBlk::message (CbcGenMsgCode inID) { if (!msgs_) { setMessages() ; } msgHandler_->setLogLevel(logLvl_) ; msgHandler_->message(inID, *msgs_) ; return (*msgHandler_) ; } CoinMP-1.8.3/Cbc/src/CbcGenParam.hpp0000644000175000017500000001442112131054770015407 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenParam.hpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #ifndef CbcGenParam_H #define CbcGenParam_H /* \file CbcGenParam.hpp \brief Declarations for parameters that control the cbc-generic main program. */ /* $Id: CbcGenParam.hpp 1899 2013-04-09 18:12:08Z stefan $ */ class CbcGenCtlBlk ; /*! \class CbcGenParam \brief Class for cbc-generic control parameters Adds parameter type codes and push/pull functions to the generic parameter object. */ class CbcGenParam : public CoinParam { public: /*! \name Subtypes */ //@{ /*! \enum CbcGenParamCode \brief Enumeration for cbc-generic parameters These are parameters that control the operation of the cbc-generic main program by operating on a CbcGenCtlBlk object. CBCGEN_FIRSTPARAM and CBCGEN_LASTPARM are markers to allow convenient separation of parameter groups. */ typedef enum { CBCGEN_FIRSTPARAM = 0, GENERALQUERY, FULLGENERALQUERY, HELP, BAB, CLEARCUTS, CLIQUECUTS, COMBINE, COSTSTRATEGY, CPP, CUTDEPTH, CUTSTRATEGY, DEBUG, DIRECTORY, DJFIX, DUMMY, ERRORSALLOWED, EXIT, EXPORT, FLOWCUTS, FPUMP, FPUMPITS, GOMORYCUTS, GREEDY, HEURISTICSTRATEGY, IMPORT, INTPRINT, KNAPSACKCUTS, LOCALTREE, LOGLEVEL, MESSAGES, MIPLIB, MIXEDCUTS, ODDHOLECUTS, OUTDUPROWS, OUTPUTFORMAT, PREPROCESS, PRINTMASK, PRINTOPTIONS, PRINTVERSION, PRIORITYIN, PROBINGCUTS, REDSPLITCUTS, ROUNDING, SOLUTION, SOLVECONTINUOUS, SOLVER, SOS, STDIN, STRENGTHEN, TIGHTENFACTOR, TWOMIRCUTS, UNITTEST, USERCBC, USESOLUTION, VERBOSE, SHOWUNIMP, CBCGEN_LASTPARAM } CbcGenParamCode ; //@} /*! \name Constructors and Destructors Be careful how you specify parameters for the constructors! There's great potential for confusion. */ //@{ /*! \brief Default constructor */ CbcGenParam() ; /*! \brief Constructor for a parameter with a double value The default value is 0.0. Be careful to clearly indicate that \p lower and \p upper are real (double) values to distinguish this constructor from the constructor for an integer parameter. */ CbcGenParam(CbcGenParamCode code, std::string name, std::string help, double lower, double upper, double dflt = 0.0, bool display = true) ; /*! \brief Constructor for a parameter with an integer value The default value is 0. */ CbcGenParam(CbcGenParamCode code, std::string name, std::string help, int lower, int upper, int dflt = 0, bool display = true) ; /*! \brief Constructor for a parameter with keyword values The string supplied as \p firstValue becomes the first keyword. Additional keywords can be added using appendKwd(). Keywords are numbered from zero. It's necessary to specify both the first keyword (\p firstValue) and the default keyword index (\p dflt) in order to distinguish this constructor from the string and action parameter constructors. */ CbcGenParam(CbcGenParamCode code, std::string name, std::string help, std::string firstValue, int dflt, bool display = true) ; /*! \brief Constructor for a string parameter The default string value must be specified explicitly to distinguish a string constructor from an action parameter constructor. */ CbcGenParam(CbcGenParamCode code, std::string name, std::string help, std::string dflt, bool display = true) ; /*! \brief Constructor for an action parameter */ CbcGenParam(CbcGenParamCode code, std::string name, std::string help, bool display = true) ; /*! \brief Copy constructor */ CbcGenParam(const CbcGenParam &orig) ; /*! \brief Clone */ CbcGenParam *clone() ; /*! \brief Assignment */ CbcGenParam &operator=(const CbcGenParam &rhs) ; /*! \brief Destructor */ ~CbcGenParam() ; //@} /*! \name Methods to query and manipulate a parameter object */ //@{ /*! \brief Get the parameter code */ inline CbcGenParamCode paramCode() const { return (paramCode_) ; } /*! \brief Set the parameter code */ inline void setParamCode(CbcGenParamCode code) { paramCode_ = code ; } /*! \brief Get the underlying cbc-generic control object */ inline CbcGenCtlBlk *obj() const { return (obj_) ; } /*! \brief Set the underlying cbc-generic control object */ inline void setObj(CbcGenCtlBlk *obj) { obj_ = obj ; } //@} private: /*! \name Data */ //@{ /// Parameter code CbcGenParamCode paramCode_ ; /// cbc-generic control object CbcGenCtlBlk *obj_ ; //@} } ; /* Declare the utility functions. */ namespace CbcGenParamUtils { void addCbcGenParams(int &numParams, CoinParamVec ¶mVec, CbcGenCtlBlk *ctlBlk) ; void loadGenParamObj(const CoinParamVec paramVec, int first, int last, CbcGenCtlBlk *ctlBlk) ; void saveSolution(const OsiSolverInterface *osi, std::string fileName) ; bool readSolution(std::string fileName, int &numRows, int &numCols, double &objVal, double **rowActivity, double **dualVars, double **primalVars, double **reducedCosts) ; int doBaCParam(CoinParam *param) ; int doDebugParam(CoinParam *param) ; int doExitParam(CoinParam *param) ; int doHelpParam(CoinParam *param) ; int doImportParam(CoinParam *param) ; int doPrintMaskParam(CoinParam *param) ; int doNothingParam(CoinParam *param) ; int doSolutionParam(CoinParam *param) ; int doUnimplementedParam(CoinParam *param) ; int doVersionParam(CoinParam *param) ; int pushCbcGenDblParam(CoinParam *param) ; int pushCbcGenIntParam(CoinParam *param) ; int pushCbcGenKwdParam(CoinParam *param) ; int pushCbcGenStrParam(CoinParam *param) ; int pushCbcGenCutParam(CoinParam *param) ; } #endif CoinMP-1.8.3/Cbc/src/CbcMipStartIO.cpp0000644000175000017500000004476212522137742015723 0ustar renerene#include #include #include #include #include #include #include #include #include #include #include #include "CbcMessage.hpp" #include "CbcHeuristic.hpp" #include #include "CbcMipStartIO.hpp" #include "CoinTime.hpp" using namespace std; bool isNumericStr( const char *str ) { const size_t l = strlen(str); for ( size_t i=0 ; i > &colValues, double &/*solObj*/ ) { #define STR_SIZE 256 FILE *f = fopen( fileName, "r" ); if (!f) return 1; char line[STR_SIZE]; int nLine = 0; char printLine[STR_SIZE]; while (fgets( line, STR_SIZE, f )) { ++nLine; char col[4][STR_SIZE]; int nread = sscanf( line, "%s %s %s %s", col[0], col[1], col[2], col[3] ); if (!nread) continue; /* line with variable value */ if (strlen(col[0])&&isdigit(col[0][0])&&(nread>=3)) { if (!isNumericStr(col[0])) { sprintf( printLine, "Reading: %s, line %d - first column in mipstart file should be numeric, ignoring.", fileName, nLine ); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; continue; } if (!isNumericStr(col[2])) { sprintf( printLine, "Reading: %s, line %d - Third column in mipstart file should be numeric, ignoring.", fileName, nLine ); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; continue; } char *name = col[1]; double value = atof( col[2] ); colValues.push_back( pair(string(name),value) ); } } if (colValues.size()) { sprintf( printLine,"MIPStart values read for %d variables.", static_cast(colValues.size()) ); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; if (colValues.size()getNumCols()) { int numberColumns = model->getNumCols(); OsiSolverInterface *solver = model->solver(); vector< pair< string, double > > fullValues; /* for fast search of column names */ map< string, int > colIdx; for (int i=0;i(solver->getColName(i),0.0) ); colIdx[solver->getColName(i)] = i; } for ( int i=0 ; (i(colValues.size())) ; ++i ) { map< string, int >::const_iterator mIt = colIdx.find( colValues[i].first ); if ( mIt != colIdx.end() ) { const int idx = mIt->second; double v = colValues[i].second; fullValues[idx].second=v; } } colValues=fullValues; } } else { sprintf( printLine, "No mipstart solution read from %s", fileName ); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; return 1; } fclose(f); return 0; } int computeCompleteSolution( CbcModel * model, const vector< string > colNames, const std::vector< std::pair< std::string, double > > &colValues, double *sol, double &obj ) { if (!model->getNumCols()) return 0; int status = 0; double compObj = COIN_DBL_MAX; bool foundIntegerSol = false; OsiSolverInterface *lp = model->solver()->clone(); map< string, int > colIdx; assert( (static_cast(colNames.size())) == lp->getNumCols() ); /* for fast search of column names */ for ( int i=0 ; (i(colNames.size())) ; ++i ) colIdx[colNames[i]] = i; char printLine[STR_SIZE]; int fixed = 0; int notFound = 0; char colNotFound[256] = ""; int nContinuousFixed = 0; #ifndef JUST_FIX_INTEGER #define JUST_FIX_INTEGER 0 #endif #if JUST_FIX_INTEGER > 1 // all not mentioned are at zero for ( int i=0 ; (igetNumCols()) ; ++i ) { if (lp->isInteger(i)) lp->setColBounds( i, 0.0, 0.0 ); } #endif for ( int i=0 ; (i(colValues.size())) ; ++i ) { map< string, int >::const_iterator mIt = colIdx.find( colValues[i].first ); if ( mIt == colIdx.end() ) { if (!notFound) strcpy( colNotFound, colValues[i].first.c_str() ); notFound++; } else { const int idx = mIt->second; double v = colValues[i].second; #if JUST_FIX_INTEGER if (!lp->isInteger(idx)) continue; #endif if (v<1e-8) v = 0.0; if (lp->isInteger(idx)) // just to avoid small v = floor( v+0.5 ); // fractional garbage else nContinuousFixed++; lp->setColBounds( idx, v, v ); ++fixed; } } if (!fixed) { model->messageHandler()->message(CBC_GENERAL, model->messages()) << "Warning: MIPstart solution is not valid, column names do not match, ignoring it." << CoinMessageEol; goto TERMINATE; } if ( notFound >= ( (static_cast(colNames.size())) * 0.5 ) ) { sprintf( printLine, "Warning: %d column names were not found (e.g. %s) while filling solution.", notFound, colNotFound ); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; } #if JUST_FIX_INTEGER lp->setHintParam(OsiDoPresolveInInitial, true, OsiHintDo) ; #endif lp->setDblParam(OsiDualObjectiveLimit,COIN_DBL_MAX); lp->initialSolve(); if ( (lp->isProvenPrimalInfeasible()) || (lp->isProvenDualInfeasible()) ) { if (nContinuousFixed) { model->messageHandler()->message(CBC_GENERAL, model->messages()) << "Trying just fixing integer variables." << CoinMessageEol; int numberColumns = lp->getNumCols(); const double *oldLower = model->solver()->getColLower(); const double *oldUpper = model->solver()->getColUpper(); for ( int i=0 ; iisInteger(i)) { lp->setColLower(i,oldLower[i]); lp->setColUpper(i,oldUpper[i]); } } lp->initialSolve(); } else { model->messageHandler()->message(CBC_GENERAL, model->messages()) << "Fixing only non-zero variables." << CoinMessageEol; /* unfix all variables which are zero */ int notZeroAnymore = 0; for ( int i=0 ; (igetNumCols()) ; ++i ) if ( ((fabs(lp->getColLower()[i])) <= 1e-8) && (fabs(lp->getColLower()[i]-lp->getColUpper()[i]) <= 1e-8) ) { const double *oldLower = model->solver()->getColLower(); const double *oldUpper = model->solver()->getColUpper(); lp->setColLower(i,oldLower[i]); lp->setColUpper(i,oldUpper[i]); notZeroAnymore++; } if (notZeroAnymore) lp->initialSolve(); } } if (!lp->isProvenOptimal()) { model->messageHandler()->message(CBC_GENERAL, model->messages()) << "Warning: mipstart values could not be used to build a solution." << CoinMessageEol; status = 1; goto TERMINATE; } /* some additional effort is needed to provide an integer solution */ if ( lp->getFractionalIndices().size() > 0 ) { sprintf( printLine,"MIPStart solution provided values for %d of %d integer variables, %d variables are still fractional.", fixed, lp->getNumIntegers(), static_cast(lp->getFractionalIndices().size()) ); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; double start = CoinCpuTime(); #if 1 CbcSerendipity heuristic(*model); heuristic.setFractionSmall(2.0); heuristic.setFeasibilityPumpOptions(1008013); int returnCode = heuristic.smallBranchAndBound(lp, 1000, sol, compObj, model->getCutoff(), "ReduceInMIPStart"); if ((returnCode&1) != 0) { sprintf( printLine,"Mini branch and bound defined values for remaining variables in %.2f seconds.", CoinCpuTime()-start); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; foundIntegerSol = true; obj = compObj; } #else CbcModel babModel( *lp ); lp->writeLp("lessFix"); babModel.setLogLevel( 2 ); babModel.setMaximumNodes( 1000 ); babModel.setMaximumSeconds( 60 ); babModel.branchAndBound(); if (babModel.bestSolution()) { sprintf( printLine,"Mini branch and bound defined values for remaining variables in %.2f seconds.", CoinCpuTime()-start); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; copy( babModel.bestSolution(), babModel.bestSolution()+babModel.getNumCols(), sol ); foundIntegerSol = true; obj = compObj = babModel.getObjValue(); } #endif else { model->messageHandler()->message(CBC_GENERAL, model->messages()) << "Warning: mipstart values could not be used to build a solution." << CoinMessageEol; status = 1; goto TERMINATE; } } else { foundIntegerSol = true; obj = compObj = lp->getObjValue(); copy( lp->getColSolution(), lp->getColSolution()+lp->getNumCols(), sol ); } if ( foundIntegerSol ) { sprintf( printLine,"MIPStart provided solution with cost %g", compObj); model->messageHandler()->message(CBC_GENERAL, model->messages()) << printLine << CoinMessageEol; #if 0 { int numberColumns=lp->getNumCols(); double largestInfeasibility = 0.0; double primalTolerance ; double offset; lp->getDblParam(OsiObjOffset, offset); lp->getDblParam(OsiPrimalTolerance, primalTolerance) ; const double *objective = lp->getObjCoefficients() ; const double * rowLower = lp->getRowLower() ; const double * rowUpper = lp->getRowUpper() ; const double * columnLower = lp->getColLower() ; const double * columnUpper = lp->getColUpper() ; int numberRows = lp->getNumRows() ; double *rowActivity = new double[numberRows] ; memset(rowActivity, 0, numberRows*sizeof(double)) ; double *rowSum = new double[numberRows] ; memset(rowSum, 0, numberRows*sizeof(double)) ; const double * element = lp->getMatrixByCol()->getElements(); const int * row = lp->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = lp->getMatrixByCol()->getVectorStarts(); const int * columnLength = lp->getMatrixByCol()->getVectorLengths(); const CoinPackedMatrix * rowCopy = lp->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * elementByRow = rowCopy->getElements(); double objValue=-offset; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = sol[iColumn]; if (lp->isInteger(iColumn)) assert (fabs(value-floor(value+0.5))<1.0e-6); objValue += value*objective[iColumn]; if (value>columnUpper[iColumn]) { if (value-columnUpper[iColumn]>1.0e-8) printf("column %d has value %.12g above %.12g\n",iColumn,value,columnUpper[iColumn]); value=columnUpper[iColumn]; } else if (value1.0e-5) printf("Column %d row %d value %.8g element %g %s\n", iColumn,iRow,value,element[j],lp->isInteger(iColumn) ? "integer" : ""); rowActivity[iRow] += value * element[j]; rowSum[iRow] += fabs(value * element[j]); } } } for (int i = 0 ; i < numberRows ; i++) { #if 0 //def CLP_INVESTIGATE double inf; inf = rowLower[i] - rowActivity[i]; if (inf > primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); inf = rowActivity[i] - rowUpper[i]; if (inf > primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); #endif double infeasibility = CoinMax(rowActivity[i]-rowUpper[i], rowLower[i]-rowActivity[i]); // but allow for errors double factor = CoinMax(1.0,rowSum[i]*1.0e-3); if (infeasibility>largestInfeasibility*factor) { largestInfeasibility = infeasibility/factor; printf("Cinf of %g on row %d sum %g scaled %g\n", infeasibility,i,rowSum[i],largestInfeasibility); if (infeasibility>1.0e10) { for (CoinBigIndex j=rowStart[i]; j 10.0*primalTolerance) printf("Clargest infeasibility is %g - obj %g\n", largestInfeasibility,objValue); else printf("Cfeasible (%g) - obj %g\n", largestInfeasibility,objValue); } #endif for ( int i=0 ; (igetNumCols()) ; ++i ) { #if 0 if (sol[i]<1e-8) sol[i] = 0.0; else if (lp->isInteger(i)) sol[i] = floor( sol[i]+0.5 ); #else if (lp->isInteger(i)) { //if (fabs(sol[i] - floor( sol[i]+0.5 ))>1.0e-8) //printf("bad sol for %d - %.12g\n",i,sol[i]); sol[i] = floor( sol[i]+0.5 ); } #endif } #if 0 { int numberColumns=lp->getNumCols(); double largestInfeasibility = 0.0; double primalTolerance ; double offset; lp->getDblParam(OsiObjOffset, offset); lp->getDblParam(OsiPrimalTolerance, primalTolerance) ; const double *objective = lp->getObjCoefficients() ; const double * rowLower = lp->getRowLower() ; const double * rowUpper = lp->getRowUpper() ; const double * columnLower = lp->getColLower() ; const double * columnUpper = lp->getColUpper() ; int numberRows = lp->getNumRows() ; double *rowActivity = new double[numberRows] ; memset(rowActivity, 0, numberRows*sizeof(double)) ; double *rowSum = new double[numberRows] ; memset(rowSum, 0, numberRows*sizeof(double)) ; const double * element = lp->getMatrixByCol()->getElements(); const int * row = lp->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = lp->getMatrixByCol()->getVectorStarts(); const int * columnLength = lp->getMatrixByCol()->getVectorLengths(); const CoinPackedMatrix * rowCopy = lp->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * elementByRow = rowCopy->getElements(); double objValue=-offset; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = sol[iColumn]; if (lp->isInteger(iColumn)) assert (fabs(value-floor(value+0.5))<1.0e-6); objValue += value*objective[iColumn]; if (value>columnUpper[iColumn]) { if (value-columnUpper[iColumn]>1.0e-8) printf("column %d has value %.12g above %.12g\n",iColumn,value,columnUpper[iColumn]); value=columnUpper[iColumn]; } else if (value primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); inf = rowActivity[i] - rowUpper[i]; if (inf > primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); #endif double infeasibility = CoinMax(rowActivity[i]-rowUpper[i], rowLower[i]-rowActivity[i]); // but allow for errors double factor = CoinMax(1.0,rowSum[i]*1.0e-3); if (infeasibility>largestInfeasibility*factor) { largestInfeasibility = infeasibility/factor; printf("Dinf of %g on row %d sum %g scaled %g\n", infeasibility,i,rowSum[i],largestInfeasibility); if (infeasibility>1.0e10) { for (CoinBigIndex j=rowStart[i]; j 10.0*primalTolerance) printf("Dlargest infeasibility is %g - obj %g\n", largestInfeasibility,objValue); else printf("Dfeasible (%g) - obj %g\n", largestInfeasibility,objValue); } #endif #if JUST_FIX_INTEGER const double * oldLower = model->solver()->getColLower(); const double * oldUpper = model->solver()->getColUpper(); const double * dj = lp->getReducedCost(); int nNaturalLB=0; int nMaybeLB=0; int nForcedLB=0; int nNaturalUB=0; int nMaybeUB=0; int nForcedUB=0; int nOther=0; for ( int i=0 ; igetNumCols() ; ++i ) { if (lp->isInteger(i)) { if (sol[i]==oldLower[i]) { if (dj[i]>1.0e-5) nNaturalLB++; else if (dj[i]<-1.0e-5) nForcedLB++; else nMaybeLB++; } else if (sol[i]==oldUpper[i]) { if (dj[i]<-1.0e-5) nNaturalUB++; else if (dj[i]>1.0e-5) nForcedUB++; else nMaybeUB++; } else { nOther++; } } } printf("%d other, LB %d natural, %d neutral, %d forced, UB %d natural, %d neutral, %d forced\n", nOther,nNaturalLB,nMaybeLB,nForcedLB, nNaturalUB,nMaybeUB,nForcedUB=0); #endif } TERMINATE: delete lp; return status; } #undef STR_SIZE CoinMP-1.8.3/Cbc/src/CbcFathom.cpp0000644000175000017500000000522411510742604015127 0ustar renerene/* $Id: CbcFathom.cpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcFathom.hpp" // Default Constructor CbcFathom::CbcFathom() : model_(NULL), possible_(false) { } // Constructor from model CbcFathom::CbcFathom(CbcModel & model) : model_(&model), possible_(false) { } // Resets stuff if model changes void CbcFathom::resetModel(CbcModel * model) { model_ = model; } // Destructor CbcFathom::~CbcFathom () { } // update model void CbcFathom::setModel(CbcModel * model) { model_ = model; } #ifdef COIN_HAS_CLP //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CbcOsiSolver::CbcOsiSolver () : OsiClpSolverInterface() { cbcModel_ = NULL; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * CbcOsiSolver::clone(bool /*copyData*/) const { //assert (copyData); return new CbcOsiSolver(*this); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CbcOsiSolver::CbcOsiSolver ( const CbcOsiSolver & rhs) : OsiSolverInterface(), // Should not be needed but get warning OsiClpSolverInterface(rhs) { cbcModel_ = rhs.cbcModel_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CbcOsiSolver::~CbcOsiSolver () { } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcOsiSolver & CbcOsiSolver::operator=(const CbcOsiSolver & rhs) { if (this != &rhs) { OsiClpSolverInterface::operator=(rhs); cbcModel_ = rhs.cbcModel_; } return *this; } #endif CoinMP-1.8.3/Cbc/src/CbcGeneral.hpp0000644000175000017500000000302112131054770015264 0ustar renerene// $Id: CbcGeneral.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #ifndef CbcGeneral_H #define CbcGeneral_H #include "CbcBranchBase.hpp" /** Define a catch all class. This will create a list of subproblems */ class CbcGeneral : public CbcObject { public: // Default Constructor CbcGeneral (); /** Useful constructor Just needs to point to model. */ CbcGeneral (CbcModel * model); // Copy constructor CbcGeneral ( const CbcGeneral &); /// Clone virtual CbcObject * clone() const = 0; // Assignment operator CbcGeneral & operator=( const CbcGeneral& rhs); // Destructor ~CbcGeneral (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /// This looks at solution and sets bounds to contain solution virtual void feasibleRegion() = 0; /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Redoes data when sequence numbers change virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns) = 0; protected: /// data }; #endif CoinMP-1.8.3/Cbc/src/CbcConsequence.cpp0000644000175000017500000000153212131054770016157 0ustar renerene// $Id: CbcConsequence.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "CbcConsequence.hpp" // Default constructor CbcConsequence::CbcConsequence() { } // Destructor CbcConsequence::~CbcConsequence () { } // Copy constructor CbcConsequence::CbcConsequence ( const CbcConsequence & /*rhs*/) { } // Assignment operator CbcConsequence & CbcConsequence::operator=( const CbcConsequence & rhs) { if (this != &rhs) { } return *this; } CoinMP-1.8.3/Cbc/src/CbcCutGenerator.cpp0000644000175000017500000015644712522136472016335 0ustar renerene/* $Id: CbcCutGenerator.cpp 2186 2015-05-05 12:53:14Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include #include #include #include #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #else #include "OsiSolverInterface.hpp" #endif //#define CGL_DEBUG 1 #ifdef CGL_DEBUG #include "OsiRowCutDebugger.hpp" #endif #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcCutGenerator.hpp" #include "CbcBranchDynamic.hpp" #include "CglProbing.hpp" #include "CoinTime.hpp" // Default Constructor CbcCutGenerator::CbcCutGenerator () : timeInCutGenerator_(0.0), model_(NULL), generator_(NULL), generatorName_(NULL), whenCutGenerator_(-1), whenCutGeneratorInSub_(-100), switchOffIfLessThan_(0), depthCutGenerator_(-1), depthCutGeneratorInSub_(-1), inaccuracy_(0), numberTimes_(0), numberCuts_(0), numberElements_(0), numberColumnCuts_(0), numberCutsActive_(0), numberCutsAtRoot_(0), numberActiveCutsAtRoot_(0), numberShortCutsAtRoot_(0), switches_(1), maximumTries_(-1) { } // Normal constructor CbcCutGenerator::CbcCutGenerator(CbcModel * model, CglCutGenerator * generator, int howOften, const char * name, bool normal, bool atSolution, bool infeasible, int howOftenInSub, int whatDepth, int whatDepthInSub, int switchOffIfLessThan) : timeInCutGenerator_(0.0), depthCutGenerator_(whatDepth), depthCutGeneratorInSub_(whatDepthInSub), inaccuracy_(0), numberTimes_(0), numberCuts_(0), numberElements_(0), numberColumnCuts_(0), numberCutsActive_(0), numberCutsAtRoot_(0), numberActiveCutsAtRoot_(0), numberShortCutsAtRoot_(0), switches_(1), maximumTries_(-1) { if (howOften < -1900) { setGlobalCuts(true); howOften += 2000; } else if (howOften < -900) { setGlobalCutsAtRoot(true); howOften += 1000; } model_ = model; generator_ = generator->clone(); generator_->refreshSolver(model_->solver()); setNeedsOptimalBasis(generator_->needsOptimalBasis()); whenCutGenerator_ = howOften; whenCutGeneratorInSub_ = howOftenInSub; switchOffIfLessThan_ = switchOffIfLessThan; if (name) generatorName_ = CoinStrdup(name); else generatorName_ = CoinStrdup("Unknown"); setNormal(normal); setAtSolution(atSolution); setWhenInfeasible(infeasible); } // Copy constructor CbcCutGenerator::CbcCutGenerator ( const CbcCutGenerator & rhs) { model_ = rhs.model_; generator_ = rhs.generator_->clone(); //generator_->refreshSolver(model_->solver()); whenCutGenerator_ = rhs.whenCutGenerator_; whenCutGeneratorInSub_ = rhs.whenCutGeneratorInSub_; switchOffIfLessThan_ = rhs.switchOffIfLessThan_; depthCutGenerator_ = rhs.depthCutGenerator_; depthCutGeneratorInSub_ = rhs.depthCutGeneratorInSub_; generatorName_ = CoinStrdup(rhs.generatorName_); switches_ = rhs.switches_; maximumTries_ = rhs.maximumTries_; timeInCutGenerator_ = rhs.timeInCutGenerator_; savedCuts_ = rhs.savedCuts_; inaccuracy_ = rhs.inaccuracy_; numberTimes_ = rhs.numberTimes_; numberCuts_ = rhs.numberCuts_; numberElements_ = rhs.numberElements_; numberColumnCuts_ = rhs.numberColumnCuts_; numberCutsActive_ = rhs.numberCutsActive_; numberCutsAtRoot_ = rhs.numberCutsAtRoot_; numberActiveCutsAtRoot_ = rhs.numberActiveCutsAtRoot_; numberShortCutsAtRoot_ = rhs.numberShortCutsAtRoot_; } // Assignment operator CbcCutGenerator & CbcCutGenerator::operator=( const CbcCutGenerator & rhs) { if (this != &rhs) { delete generator_; free(generatorName_); model_ = rhs.model_; generator_ = rhs.generator_->clone(); generator_->refreshSolver(model_->solver()); whenCutGenerator_ = rhs.whenCutGenerator_; whenCutGeneratorInSub_ = rhs.whenCutGeneratorInSub_; switchOffIfLessThan_ = rhs.switchOffIfLessThan_; depthCutGenerator_ = rhs.depthCutGenerator_; depthCutGeneratorInSub_ = rhs.depthCutGeneratorInSub_; generatorName_ = CoinStrdup(rhs.generatorName_); switches_ = rhs.switches_; maximumTries_ = rhs.maximumTries_; timeInCutGenerator_ = rhs.timeInCutGenerator_; savedCuts_ = rhs.savedCuts_; inaccuracy_ = rhs.inaccuracy_; numberTimes_ = rhs.numberTimes_; numberCuts_ = rhs.numberCuts_; numberElements_ = rhs.numberElements_; numberColumnCuts_ = rhs.numberColumnCuts_; numberCutsActive_ = rhs.numberCutsActive_; numberCutsAtRoot_ = rhs.numberCutsAtRoot_; numberActiveCutsAtRoot_ = rhs.numberActiveCutsAtRoot_; numberShortCutsAtRoot_ = rhs.numberShortCutsAtRoot_; } return *this; } // Destructor CbcCutGenerator::~CbcCutGenerator () { free(generatorName_); delete generator_; } /* This is used to refresh any inforamtion. It also refreshes the solver in the cut generator in case generator wants to do some work */ void CbcCutGenerator::refreshModel(CbcModel * model) { model_ = model; // added test - helps if generator not thread safe if (whenCutGenerator_!=-100) generator_->refreshSolver(model_->solver()); } /* Generate cuts for the model data contained in si. The generated cuts are inserted into and returned in the collection of cuts cs. */ bool CbcCutGenerator::generateCuts( OsiCuts & cs , int fullScan, OsiSolverInterface * solver, CbcNode * node) { /* Make some decisions about whether we'll generate cuts. First convert whenCutGenerator_ to a set of canonical values for comparison to the node count. 0 < mod 1000000, with a result of 0 forced to 1 -99 <= <= 0 convert to 1 -100 = Off, period */ int depth; if (node) depth = node->depth(); else depth = 0; int howOften = whenCutGenerator_; if (dynamic_cast(generator_)) { if (howOften == -100 && model_->doCutsNow(3)) { howOften = 1; // do anyway } } if (howOften == -100) return false; int pass = model_->getCurrentPassNumber() - 1; if (maximumTries_>0) { // howOften means what it says if ((pass%howOften)!=0||depth) return false; else howOften=1; } if (howOften > 0) howOften = howOften % 1000000; else howOften = 1; if (!howOften) howOften = 1; bool returnCode = false; //OsiSolverInterface * solver = model_->solver(); // Reset cuts on first pass if (!pass) savedCuts_ = OsiCuts(); /* Determine if we should generate cuts based on node count. */ bool doThis = (model_->getNodeCount() % howOften) == 0; /* If the user has provided a depth specification, it will override the node count specification. */ if (depthCutGenerator_ > 0) { doThis = (depth % depthCutGenerator_) == 0; if (depth < depthCutGenerator_) doThis = true; // and also at top of tree } /* A few magic numbers ... The distinction between -100 and 100 for howOften is that we can override 100 with fullScan. -100 means no cuts, period. As does the magic number -200 for whenCutGeneratorInSub_. */ // But turn off if 100 if (howOften == 100) doThis = false; // Switch off if special setting if (whenCutGeneratorInSub_ == -200 && model_->parentModel()) { fullScan = 0; doThis = false; } if (fullScan || doThis) { CoinThreadRandom * randomNumberGenerator = NULL; #ifdef COIN_HAS_CLP { OsiClpSolverInterface * clpSolver = dynamic_cast (solver); if (clpSolver) randomNumberGenerator = clpSolver->getModelPtr()->randomNumberGenerator(); } #endif double time1 = 0.0; if (timing()) time1 = CoinCpuTime(); //#define CBC_DEBUG int numberRowCutsBefore = cs.sizeRowCuts() ; int numberColumnCutsBefore = cs.sizeColCuts() ; #ifdef JJF_ZERO int cutsBefore = cs.sizeCuts(); #endif CglTreeInfo info; info.level = depth; info.pass = pass; info.formulation_rows = model_->numberRowsAtContinuous(); info.inTree = node != NULL; info.randomNumberGenerator = randomNumberGenerator; info.options = (globalCutsAtRoot()) ? 8 : 0; if (ineffectualCuts()) info.options |= 32; if (globalCuts()) info.options |= 16; if (fullScan < 0) info.options |= 128; if (whetherInMustCallAgainMode()) info.options |= 1024; // See if we want alternate set of cuts if ((model_->moreSpecialOptions()&16384) != 0) info.options |= 256; if (model_->parentModel()) info.options |= 512; // above had &&!model_->parentModel()&&depth<2) incrementNumberTimesEntered(); CglProbing* generator = dynamic_cast(generator_); //if (!depth&&!pass) //printf("Cut generator %s when %d\n",generatorName_,whenCutGenerator_); if (!generator) { // Pass across model information in case it could be useful //void * saveData = solver->getApplicationData(); //solver->setApplicationData(model_); generator_->generateCuts(*solver, cs, info); //solver->setApplicationData(saveData); } else { // Probing - return tight column bounds CglTreeProbingInfo * info2 = model_->probingInfo(); bool doCuts = false; if (info2 && !depth) { info2->options = (globalCutsAtRoot()) ? 8 : 0; info2->level = depth; info2->pass = pass; info2->formulation_rows = model_->numberRowsAtContinuous(); info2->inTree = node != NULL; info2->randomNumberGenerator = randomNumberGenerator; generator->generateCutsAndModify(*solver, cs, info2); doCuts = true; } else if (depth) { /* The idea behind this is that probing may work in a different way deep in tree. So every now and then try various combinations to see what works. */ #define TRY_NOW_AND_THEN #ifdef TRY_NOW_AND_THEN if ((numberTimes_ == 200 || (numberTimes_ > 200 && (numberTimes_ % 2000) == 0)) && !model_->parentModel() && info.formulation_rows > 200) { /* In tree, every now and then try various combinations maxStack, maxProbe (last 5 digits) 123 is special and means CglProbing will try and be intelligent. */ int test[] = { 100123, 199999, 200123, 299999, 500123, 599999, 1000123, 1099999, 2000123, 2099999 }; int n = static_cast (sizeof(test) / sizeof(int)); int saveStack = generator->getMaxLook(); int saveNumber = generator->getMaxProbe(); int kr1 = 0; int kc1 = 0; int bestStackTree = -1; int bestNumberTree = -1; for (int i = 0; i < n; i++) { //OsiCuts cs2 = cs; int stack = test[i] / 100000; int number = test[i] - 100000 * stack; generator->setMaxLook(stack); generator->setMaxProbe(number); int numberRowCutsBefore = cs.sizeRowCuts() ; int numberColumnCutsBefore = cs.sizeColCuts() ; generator_->generateCuts(*solver, cs, info); int numberRowCuts = cs.sizeRowCuts() - numberRowCutsBefore ; int numberColumnCuts = cs.sizeColCuts() - numberColumnCutsBefore ; #ifdef CLP_INVESTIGATE if (numberRowCuts < kr1 || numberColumnCuts < kc1) printf("Odd "); #endif if (numberRowCuts > kr1 || numberColumnCuts > kc1) { #ifdef CLP_INVESTIGATE printf("*** "); #endif kr1 = numberRowCuts; kc1 = numberColumnCuts; bestStackTree = stack; bestNumberTree = number; doCuts = true; } #ifdef CLP_INVESTIGATE printf("maxStack %d number %d gives %d row cuts and %d column cuts\n", stack, number, numberRowCuts, numberColumnCuts); #endif } generator->setMaxLook(saveStack); generator->setMaxProbe(saveNumber); if (bestStackTree > 0) { generator->setMaxLook(bestStackTree); generator->setMaxProbe(bestNumberTree); #ifdef CLP_INVESTIGATE printf("RRNumber %d -> %d, stack %d -> %d\n", saveNumber, bestNumberTree, saveStack, bestStackTree); #endif } else { // no good generator->setMaxLook(0); #ifdef CLP_INVESTIGATE printf("RRSwitching off number %d -> %d, stack %d -> %d\n", saveNumber, saveNumber, saveStack, 1); #endif } } #endif if (generator->getMaxLook() > 0 && !doCuts) { generator->generateCutsAndModify(*solver, cs, &info); doCuts = true; } } else { // at root - don't always do if (pass < 15 || (pass&1) == 0) { generator->generateCutsAndModify(*solver, cs, &info); doCuts = true; } } if (doCuts && generator->tightLower()) { // probing may have tightened bounds - check const double * tightLower = generator->tightLower(); const double * lower = solver->getColLower(); const double * tightUpper = generator->tightUpper(); const double * upper = solver->getColUpper(); const double * solution = solver->getColSolution(); int j; int numberColumns = solver->getNumCols(); double primalTolerance = 1.0e-8; const char * tightenBounds = generator->tightenBounds(); #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = solver->getRowCutDebugger(); if (debugger && debugger->onOptimalPath(*solver)) { printf("On optimal path CbcCut\n"); int nCols = solver->getNumCols(); const double * optimal = debugger->optimalSolution(); const double * objective = solver->getObjCoefficients(); double objval1 = 0.0, objval2 = 0.0; for (int i = 0; i < nCols; i++) { if (!solver->isInteger(i)) continue; #if CGL_DEBUG>1 printf("%d %g %g %g %g\n", i, lower[i], solution[i], upper[i], optimal[i]); #endif objval1 += solution[i] * objective[i]; objval2 += optimal[i] * objective[i]; assert(optimal[i] >= lower[i] - 1.0e-5 && optimal[i] <= upper[i] + 1.0e-5); assert(optimal[i] >= tightLower[i] - 1.0e-5 && optimal[i] <= tightUpper[i] + 1.0e-5); } printf("current obj %g, integer %g\n", objval1, objval2); } #endif bool feasible = true; if ((model_->getThreadMode()&2) == 0) { for (j = 0; j < numberColumns; j++) { if (solver->isInteger(j)) { if (tightUpper[j] < upper[j]) { double nearest = floor(tightUpper[j] + 0.5); //assert (fabs(tightUpper[j]-nearest)<1.0e-5); may be infeasible solver->setColUpper(j, nearest); if (nearest < solution[j] - primalTolerance) returnCode = true; } if (tightLower[j] > lower[j]) { double nearest = floor(tightLower[j] + 0.5); //assert (fabs(tightLower[j]-nearest)<1.0e-5); may be infeasible solver->setColLower(j, nearest); if (nearest > solution[j] + primalTolerance) returnCode = true; } } else { if (upper[j] > lower[j]) { if (tightUpper[j] == tightLower[j]) { // fix //if (tightLower[j]!=lower[j]) solver->setColLower(j, tightLower[j]); //if (tightUpper[j]!=upper[j]) solver->setColUpper(j, tightUpper[j]); if (tightLower[j] > solution[j] + primalTolerance || tightUpper[j] < solution[j] - primalTolerance) returnCode = true; } else if (tightenBounds && tightenBounds[j]) { solver->setColLower(j, CoinMax(tightLower[j], lower[j])); solver->setColUpper(j, CoinMin(tightUpper[j], upper[j])); if (tightLower[j] > solution[j] + primalTolerance || tightUpper[j] < solution[j] - primalTolerance) returnCode = true; } } } if (upper[j] < lower[j] - 1.0e-3) { feasible = false; break; } } } else { CoinPackedVector lbs; CoinPackedVector ubs; int numberChanged = 0; bool ifCut = false; for (j = 0; j < numberColumns; j++) { if (solver->isInteger(j)) { if (tightUpper[j] < upper[j]) { double nearest = floor(tightUpper[j] + 0.5); //assert (fabs(tightUpper[j]-nearest)<1.0e-5); may be infeasible ubs.insert(j, nearest); numberChanged++; if (nearest < solution[j] - primalTolerance) ifCut = true; } if (tightLower[j] > lower[j]) { double nearest = floor(tightLower[j] + 0.5); //assert (fabs(tightLower[j]-nearest)<1.0e-5); may be infeasible lbs.insert(j, nearest); numberChanged++; if (nearest > solution[j] + primalTolerance) ifCut = true; } } else { if (upper[j] > lower[j]) { if (tightUpper[j] == tightLower[j]) { // fix lbs.insert(j, tightLower[j]); ubs.insert(j, tightUpper[j]); if (tightLower[j] > solution[j] + primalTolerance || tightUpper[j] < solution[j] - primalTolerance) ifCut = true; } else if (tightenBounds && tightenBounds[j]) { lbs.insert(j, CoinMax(tightLower[j], lower[j])); ubs.insert(j, CoinMin(tightUpper[j], upper[j])); if (tightLower[j] > solution[j] + primalTolerance || tightUpper[j] < solution[j] - primalTolerance) ifCut = true; } } } if (upper[j] < lower[j] - 1.0e-3) { feasible = false; break; } } if (numberChanged) { OsiColCut cc; cc.setUbs(ubs); cc.setLbs(lbs); if (ifCut) { cc.setEffectiveness(100.0); } else { cc.setEffectiveness(1.0e-5); } cs.insert(cc); } } if (!feasible) { // not feasible -add infeasible cut OsiRowCut rc; rc.setLb(COIN_DBL_MAX); rc.setUb(0.0); cs.insert(rc); } } //if (!solver->basisIsAvailable()) //returnCode=true; if (!returnCode) { // bounds changed but still optimal #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver); if (clpSolver) { clpSolver->setLastAlgorithm(2); } #endif } #ifdef JJF_ZERO // Pass across info to pseudocosts char * mark = new char[numberColumns]; memset(mark, 0, numberColumns); int nLook = generator->numberThisTime(); const int * lookedAt = generator->lookedAt(); const int * fixedDown = generator->fixedDown(); const int * fixedUp = generator->fixedUp(); for (j = 0; j < nLook; j++) mark[lookedAt[j]] = 1; int numberObjects = model_->numberObjects(); for (int i = 0; i < numberObjects; i++) { CbcSimpleIntegerDynamicPseudoCost * obj1 = dynamic_cast (model_->modifiableObject(i)) ; if (obj1) { int iColumn = obj1->columnNumber(); if (mark[iColumn]) obj1->setProbingInformation(fixedDown[iColumn], fixedUp[iColumn]); } } delete [] mark; #endif } CbcCutModifier * modifier = model_->cutModifier(); if (modifier) { int numberRowCutsAfter = cs.sizeRowCuts() ; int k ; int nOdd = 0; //const OsiSolverInterface * solver = model_->solver(); for (k = numberRowCutsAfter - 1; k >= numberRowCutsBefore; k--) { OsiRowCut & thisCut = cs.rowCut(k) ; int returnCode = modifier->modify(solver, thisCut); if (returnCode) { nOdd++; if (returnCode == 3) cs.eraseRowCut(k); } } if (nOdd) COIN_DETAIL_PRINT(printf("Cut generator %s produced %d cuts of which %d were modified\n", generatorName_, numberRowCutsAfter - numberRowCutsBefore, nOdd)); } { // make all row cuts without test for duplicate int numberRowCutsAfter = cs.sizeRowCuts() ; int k ; #ifdef CGL_DEBUG const OsiRowCutDebugger * debugger = solver->getRowCutDebugger(); #endif //#define WEAKEN_CUTS 1 #ifdef WEAKEN_CUTS const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * solution = solver->getColSolution(); #endif for (k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { OsiRowCut * thisCut = cs.rowCutPtr(k) ; #ifdef WEAKEN_CUTS // weaken cut if coefficients not integer double lb=thisCut->lb(); double ub=thisCut->ub(); if (lb<-1.0e100||ub>1.0e100) { // normal cut CoinPackedVector rpv = thisCut->row(); const int n = rpv.getNumElements(); const int * indices = rpv.getIndices(); const double * elements = rpv.getElements(); double bound=0.0; double sum=0.0; bool integral=true; int nInteger=0; for (int k=0; kisInteger(column)) { nInteger++; double largerBound = CoinMax(fabs(lower[column]), fabs(upper[column])); double solutionBound=fabs(solution[column])+10.0; bound += CoinMin(largerBound,solutionBound); } } #if WEAKEN_CUTS ==1 // leave if all 0-1 if (nInteger==bound) integral=true; #elif WEAKEN_CUTS==4||WEAKEN_CUTS==5 // leave if all 0-1 if (nInteger==bound && n < 40) integral=true; #endif if (!integral) { double weakenBy=1.0e-7*(bound+sum); #if WEAKEN_CUTS==3||WEAKEN_CUTS==5 weakenBy *= 10.0; #endif if (lb<-1.0e100) thisCut->setUb(ub+weakenBy); else thisCut->setLb(lb-weakenBy); } } #endif #ifdef CGL_DEBUG if (debugger && debugger->onOptimalPath(*solver)) { if(debugger->invalidCut(*thisCut)) { #if CGL_DEBUG>1 const double * optimal = debugger->optimalSolution(); CoinPackedVector rpv = thisCut->row(); const int n = rpv.getNumElements(); const int * indices = rpv.getIndices(); const double * elements = rpv.getElements(); double lb=thisCut->lb(); double ub=thisCut->ub(); double sum=0.0; for (int k=0; kub - 1.0e-8 ||sum < lb + 1.0e-8) { double violation=CoinMax(sum-ub,lb-sum); std::cout<1.0e-9) { std::cout<<"( "<invalidCut(*thisCut)); if(debugger->invalidCut(*thisCut)) abort(); } } #endif thisCut->mutableRow().setTestForDuplicateIndex(false); } } // Add in saved cuts if violated if (false && !depth) { const double * solution = solver->getColSolution(); double primalTolerance = 1.0e-7; int numberCuts = savedCuts_.sizeRowCuts() ; for (int k = numberCuts - 1; k >= 0; k--) { const OsiRowCut * thisCut = savedCuts_.rowCutPtr(k) ; double sum = 0.0; int n = thisCut->row().getNumElements(); const int * column = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); assert (n); for (int i = 0; i < n; i++) { double value = element[i]; sum += value * solution[column[i]]; } if (sum > thisCut->ub() + primalTolerance) { sum = sum - thisCut->ub(); } else if (sum < thisCut->lb() - primalTolerance) { sum = thisCut->lb() - sum; } else { sum = 0.0; } if (sum) { // add to candidates and take out here cs.insert(*thisCut); savedCuts_.eraseRowCut(k); } } } if (!atSolution()) { int numberRowCutsAfter = cs.sizeRowCuts() ; int k ; int nEls = 0; int nCuts = numberRowCutsAfter - numberRowCutsBefore; // Remove NULL cuts! int nNull = 0; const double * solution = solver->getColSolution(); bool feasible = true; double primalTolerance = 1.0e-7; int shortCut = (depth) ? -1 : generator_->maximumLengthOfCutInTree(); for (k = numberRowCutsAfter - 1; k >= numberRowCutsBefore; k--) { const OsiRowCut * thisCut = cs.rowCutPtr(k) ; double sum = 0.0; if (thisCut->lb() <= thisCut->ub()) { int n = thisCut->row().getNumElements(); if (n <= shortCut) numberShortCutsAtRoot_++; const int * column = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); if (n <= 0) { // infeasible cut - give up feasible = false; break; } nEls += n; for (int i = 0; i < n; i++) { double value = element[i]; sum += value * solution[column[i]]; } if (sum > thisCut->ub() + primalTolerance) { sum = sum - thisCut->ub(); } else if (sum < thisCut->lb() - primalTolerance) { sum = thisCut->lb() - sum; } else { sum = 0.0; cs.eraseRowCut(k); nNull++; } } } //if (nNull) //printf("%s has %d cuts and %d elements - %d null!\n",generatorName_, // nCuts,nEls,nNull); numberRowCutsAfter = cs.sizeRowCuts() ; nCuts = numberRowCutsAfter - numberRowCutsBefore; nEls = 0; for (k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { const OsiRowCut * thisCut = cs.rowCutPtr(k) ; int n = thisCut->row().getNumElements(); nEls += n; } //printf("%s has %d cuts and %d elements\n",generatorName_, // nCuts,nEls); int nElsNow = solver->getMatrixByCol()->getNumElements(); int numberColumns = solver->getNumCols(); int numberRows = solver->getNumRows(); //double averagePerRow = static_cast(nElsNow)/ //static_cast(numberRows); int nAdd; int nAdd2; int nReasonable; if (!model_->parentModel() && depth < 2) { if (inaccuracy_ < 3) { nAdd = 10000; if (pass > 0 && numberColumns > -500) nAdd = CoinMin(nAdd, nElsNow + 2 * numberRows); } else { nAdd = 10000; if (pass > 0) nAdd = CoinMin(nAdd, nElsNow + 2 * numberRows); } nAdd2 = 5 * numberColumns; nReasonable = CoinMax(nAdd2, nElsNow / 8 + nAdd); if (!depth && !pass) { // allow more nAdd += nElsNow / 2; nAdd2 += nElsNow / 2; nReasonable += nElsNow / 2; } //if (!depth&&ineffectualCuts()) //nReasonable *= 2; } else { nAdd = 200; nAdd2 = 2 * numberColumns; nReasonable = CoinMax(nAdd2, nElsNow / 8 + nAdd); } //#define UNS_WEIGHT 0.1 #ifdef UNS_WEIGHT const double * colLower = solver->getColLower(); const double * colUpper = solver->getColUpper(); #endif if (/*nEls>CoinMax(nAdd2,nElsNow/8+nAdd)*/nCuts && feasible) { //printf("need to remove cuts\n"); // just add most effective #ifndef JJF_ONE int nDelete = nEls - nReasonable; nElsNow = nEls; double * sort = new double [nCuts]; int * which = new int [nCuts]; // For parallel cuts double * element2 = new double [numberColumns]; //#define USE_OBJECTIVE 2 #ifdef USE_OBJECTIVE const double *objective = solver->getObjCoefficients() ; #if USE_OBJECTIVE>1 double objNorm = 0.0; for (int i = 0; i < numberColumns; i++) objNorm += objective[i] * objective[i]; if (objNorm) objNorm = 1.0 / sqrt(objNorm); else objNorm = 1.0; objNorm *= 0.01; // downgrade #endif #endif CoinZeroN(element2, numberColumns); for (k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { const OsiRowCut * thisCut = cs.rowCutPtr(k) ; double sum = 0.0; if (thisCut->lb() <= thisCut->ub()) { int n = thisCut->row().getNumElements(); const int * column = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); assert (n); #ifdef UNS_WEIGHT double normU = 0.0; double norm = 1.0e-3; int nU = 0; for (int i = 0; i < n; i++) { double value = element[i]; int iColumn = column[i]; double solValue = solution[iColumn]; sum += value * solValue; value *= value; norm += value; if (solValue > colLower[iColumn] + 1.0e-6 && solValue < colUpper[iColumn] - 1.0e-6) { normU += value; nU++; } } #ifdef JJF_ZERO int nS = n - nU; if (numberColumns > 20000) { if (nS > 50) { double ratio = 50.0 / nS; normU /= ratio; } } #endif norm += UNS_WEIGHT * (normU - norm); #else double norm = 1.0e-3; #ifdef USE_OBJECTIVE double obj = 0.0; #endif for (int i = 0; i < n; i++) { int iColumn = column[i]; double value = element[i]; sum += value * solution[iColumn]; norm += value * value; #ifdef USE_OBJECTIVE obj += value * objective[iColumn]; #endif } #endif if (sum > thisCut->ub()) { sum = sum - thisCut->ub(); } else if (sum < thisCut->lb()) { sum = thisCut->lb() - sum; } else { sum = 0.0; } #ifdef USE_OBJECTIVE if (sum) { #if USE_OBJECTIVE==1 obj = CoinMax(1.0e-6, fabs(obj)); norm = sqrt(obj * norm); //sum += fabs(obj)*invObjNorm; //printf("sum %g norm %g normobj %g invNorm %g mod %g\n", // sum,norm,obj,invObjNorm,obj*invObjNorm); // normalize sum /= sqrt(norm); #else // normalize norm = 1.0 / sqrt(norm); sum = (sum + objNorm * obj) * norm; #endif } #else // normalize sum /= sqrt(norm); #endif //sum /= pow(norm,0.3); // adjust for length //sum /= pow(reinterpret_cast(n),0.2); //sum /= sqrt((double) n); // randomize //double randomNumber = //model_->randomNumberGenerator()->randomDouble(); //sum *= (0.5+randomNumber); } else { // keep sum = COIN_DBL_MAX; } sort[k-numberRowCutsBefore] = sum; which[k-numberRowCutsBefore] = k; } CoinSort_2(sort, sort + nCuts, which); // Now see which ones are too similar int nParallel = 0; double testValue = (depth > 1) ? 0.99 : 0.999999; for (k = 0; k < nCuts; k++) { int j = which[k]; const OsiRowCut * thisCut = cs.rowCutPtr(j) ; if (thisCut->lb() > thisCut->ub()) break; // cut is infeasible int n = thisCut->row().getNumElements(); const int * column = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); assert (n); double norm = 0.0; double lb = thisCut->lb(); double ub = thisCut->ub(); for (int i = 0; i < n; i++) { double value = element[i]; element2[column[i]] = value; norm += value * value; } int kkk = CoinMin(nCuts, k + 5); for (int kk = k + 1; kk < kkk; kk++) { int jj = which[kk]; const OsiRowCut * thisCut2 = cs.rowCutPtr(jj) ; if (thisCut2->lb() > thisCut2->ub()) break; // cut is infeasible int nB = thisCut2->row().getNumElements(); const int * columnB = thisCut2->row().getIndices(); const double * elementB = thisCut2->row().getElements(); assert (nB); double normB = 0.0; double product = 0.0; for (int i = 0; i < nB; i++) { double value = elementB[i]; normB += value * value; product += value * element2[columnB[i]]; } if (product > 0.0 && product*product > testValue*norm*normB) { bool parallel = true; double lbB = thisCut2->lb(); double ubB = thisCut2->ub(); if ((lb < -1.0e20 && lbB > -1.0e20) || (lbB < -1.0e20 && lb > -1.0e20)) parallel = false; double tolerance; tolerance = CoinMax(fabs(lb), fabs(lbB)) + 1.0e-6; if (fabs(lb - lbB) > tolerance) parallel = false; if ((ub > 1.0e20 && ubB < 1.0e20) || (ubB > 1.0e20 && ub < 1.0e20)) parallel = false; tolerance = CoinMax(fabs(ub), fabs(ubB)) + 1.0e-6; if (fabs(ub - ubB) > tolerance) parallel = false; if (parallel) { nParallel++; sort[k] = 0.0; break; } } } for (int i = 0; i < n; i++) { element2[column[i]] = 0.0; } } delete [] element2; CoinSort_2(sort, sort + nCuts, which); k = 0; while (nDelete > 0 || !sort[k]) { int iCut = which[k]; const OsiRowCut * thisCut = cs.rowCutPtr(iCut) ; int n = thisCut->row().getNumElements(); // may be best, just to save if short if (false && n && sort[k]) { // add to saved cuts savedCuts_.insert(*thisCut); } nDelete -= n; k++; if (k >= nCuts) break; } std::sort(which, which + k); k--; for (; k >= 0; k--) { cs.eraseRowCut(which[k]); } delete [] sort; delete [] which; numberRowCutsAfter = cs.sizeRowCuts() ; #else double * norm = new double [nCuts]; int * which = new int [2*nCuts]; double * score = new double [nCuts]; double * ortho = new double [nCuts]; int nIn = 0; int nOut = nCuts; // For parallel cuts double * element2 = new double [numberColumns]; const double *objective = solver->getObjCoefficients() ; double objNorm = 0.0; for (int i = 0; i < numberColumns; i++) objNorm += objective[i] * objective[i]; if (objNorm) objNorm = 1.0 / sqrt(objNorm); else objNorm = 1.0; objNorm *= 0.1; // weight of 0.1 CoinZeroN(element2, numberColumns); int numberRowCuts = numberRowCutsAfter - numberRowCutsBefore; int iBest = -1; double best = 0.0; int nPossible = 0; double testValue = (depth > 1) ? 0.7 : 0.5; for (k = 0; k < numberRowCuts; k++) { const OsiRowCut * thisCut = cs.rowCutPtr(k + numberRowCutsBefore) ; double sum = 0.0; if (thisCut->lb() <= thisCut->ub()) { int n = thisCut->row().getNumElements(); const int * column = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); assert (n); double normThis = 1.0e-6; double obj = 0.0; for (int i = 0; i < n; i++) { int iColumn = column[i]; double value = element[i]; sum += value * solution[iColumn]; normThis += value * value; obj += value * objective[iColumn]; } if (sum > thisCut->ub()) { sum = sum - thisCut->ub(); } else if (sum < thisCut->lb()) { sum = thisCut->lb() - sum; } else { sum = 0.0; } if (sum) { normThis = 1.0 / sqrt(normThis); norm[k] = normThis; sum *= normThis; obj *= normThis; score[k] = sum + obj * objNorm; ortho[k] = 1.0; } } else { // keep and discard others nIn = 1; which[0] = k; for (int j = 0; j < numberRowCuts; j++) { if (j != k) which[nOut++] = j; } iBest = -1; break; } if (sum) { if (score[k] > best) { best = score[k]; iBest = nPossible; } which[nPossible++] = k; } else { which[nOut++] = k; } } while (iBest >= 0) { int kBest = which[iBest]; int j = which[nIn]; which[iBest] = j; which[nIn++] = kBest; const OsiRowCut * thisCut = cs.rowCutPtr(kBest + numberRowCutsBefore) ; int n = thisCut->row().getNumElements(); nReasonable -= n; if (nReasonable <= 0) { for (k = nIn; k < nPossible; k++) which[nOut++] = which[k]; break; } // Now see which ones are too similar and choose next iBest = -1; best = 0.0; int nOld = nPossible; nPossible = nIn; const int * column = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); assert (n); double normNew = norm[kBest]; for (int i = 0; i < n; i++) { double value = element[i]; element2[column[i]] = value; } for (int j = nIn; j < nOld; j++) { k = which[j]; const OsiRowCut * thisCut2 = cs.rowCutPtr(k + numberRowCutsBefore) ; int nB = thisCut2->row().getNumElements(); const int * columnB = thisCut2->row().getIndices(); const double * elementB = thisCut2->row().getElements(); assert (nB); double normB = norm[k]; double product = 0.0; for (int i = 0; i < nB; i++) { double value = elementB[i]; product += value * element2[columnB[i]]; } double orthoScore = 1.0 - product * normNew * normB; if (orthoScore >= testValue) { ortho[k] = CoinMin(orthoScore, ortho[k]); double test = score[k] + ortho[k]; if (test > best) { best = score[k]; iBest = nPossible; } which[nPossible++] = k; } else { which[nOut++] = k; } } for (int i = 0; i < n; i++) { element2[column[i]] = 0.0; } } delete [] score; delete [] ortho; std::sort(which + nCuts, which + nOut); k = nOut - 1; for (; k >= nCuts; k--) { cs.eraseRowCut(which[k] + numberRowCutsBefore); } delete [] norm; delete [] which; numberRowCutsAfter = cs.sizeRowCuts() ; #endif } } #ifdef CBC_DEBUG { int numberRowCutsAfter = cs.sizeRowCuts() ; int k ; int nBad = 0; for (k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { OsiRowCut thisCut = cs.rowCut(k) ; if (thisCut.lb() > thisCut.ub() || thisCut.lb() > 1.0e8 || thisCut.ub() < -1.0e8) printf("cut from %s has bounds %g and %g!\n", generatorName_, thisCut.lb(), thisCut.ub()); if (thisCut.lb() <= thisCut.ub()) { /* check size of elements. We can allow smaller but this helps debug generators as it is unsafe to have small elements */ int n = thisCut.row().getNumElements(); const int * column = thisCut.row().getIndices(); const double * element = thisCut.row().getElements(); assert (n); for (int i = 0; i < n; i++) { double value = element[i]; if (fabs(value) <= 1.0e-12 || fabs(value) >= 1.0e20) nBad++; } } if (nBad) printf("Cut generator %s produced %d cuts of which %d had tiny or large elements\n", generatorName_, numberRowCutsAfter - numberRowCutsBefore, nBad); } } #endif int numberRowCutsAfter = cs.sizeRowCuts() ; int numberColumnCutsAfter = cs.sizeColCuts() ; if (numberRowCutsBefore < numberRowCutsAfter) { for (int k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { OsiRowCut thisCut = cs.rowCut(k) ; int n = thisCut.row().getNumElements(); numberElements_ += n; } #ifdef JJF_ZERO printf("generator %s generated %d row cuts\n", generatorName_, numberRowCutsAfter - numberRowCutsBefore); #endif numberCuts_ += numberRowCutsAfter - numberRowCutsBefore; } if (numberColumnCutsBefore < numberColumnCutsAfter) { #ifdef JJF_ZERO printf("generator %s generated %d column cuts\n", generatorName_, numberColumnCutsAfter - numberColumnCutsBefore); #endif numberColumnCuts_ += numberColumnCutsAfter - numberColumnCutsBefore; } if (timing()) timeInCutGenerator_ += CoinCpuTime() - time1; // switch off if first time and no good if (node == NULL && !pass ) { if (numberRowCutsAfter - numberRowCutsBefore < switchOffIfLessThan_ /*&& numberCuts_ < switchOffIfLessThan_*/) { // switch off maximumTries_ = 0; whenCutGenerator_=-100; //whenCutGenerator_ = -100; //whenCutGeneratorInSub_ = -200; } } if (maximumTries_>0) { maximumTries_--; if (!maximumTries_) whenCutGenerator_=-100; } } return returnCode; } void CbcCutGenerator::setHowOften(int howOften) { if (howOften >= 1000000) { // leave Probing every SCANCUTS_PROBING howOften = howOften % 1000000; CglProbing* generator = dynamic_cast(generator_); if (generator && howOften > SCANCUTS_PROBING) howOften = SCANCUTS_PROBING + 1000000; else howOften += 1000000; } whenCutGenerator_ = howOften; } void CbcCutGenerator::setWhatDepth(int value) { depthCutGenerator_ = value; } void CbcCutGenerator::setWhatDepthInSub(int value) { depthCutGeneratorInSub_ = value; } // Add in statistics from other void CbcCutGenerator::addStatistics(const CbcCutGenerator * other) { // Time in cut generator timeInCutGenerator_ += other->timeInCutGenerator_; // Number times cut generator entered numberTimes_ += other->numberTimes_; // Total number of cuts added numberCuts_ += other->numberCuts_; // Total number of elements added numberElements_ += other->numberElements_; // Total number of column cuts added numberColumnCuts_ += other->numberColumnCuts_; // Total number of cuts active after (at end of n cut passes at each node) numberCutsActive_ += other->numberCutsActive_; // Number of cuts generated at root numberCutsAtRoot_ += other->numberCutsAtRoot_; // Number of cuts active at root numberActiveCutsAtRoot_ += other->numberActiveCutsAtRoot_; // Number of short cuts at root numberShortCutsAtRoot_ += other->numberShortCutsAtRoot_; } // Scale back statistics by factor void CbcCutGenerator::scaleBackStatistics(int factor) { // leave time // Number times cut generator entered numberTimes_ = (numberTimes_+factor-1)/factor; // Total number of cuts added numberCuts_ = (numberCuts_+factor-1)/factor; // Total number of elements added numberElements_ = (numberElements_+factor-1)/factor; // Total number of column cuts added numberColumnCuts_ = (numberColumnCuts_+factor-1)/factor; // Total number of cuts active after (at end of n cut passes at each node) numberCutsActive_ = (numberCutsActive_+factor-1)/factor; // Number of cuts generated at root numberCutsAtRoot_ = (numberCutsAtRoot_+factor-1)/factor; // Number of cuts active at root numberActiveCutsAtRoot_ = (numberActiveCutsAtRoot_+factor-1)/factor; // Number of short cuts at root numberShortCutsAtRoot_ = (numberShortCutsAtRoot_+factor-1)/factor; } // Create C++ lines to get to current state void CbcCutGenerator::generateTuning( FILE * fp) { fprintf(fp, "// Cbc tuning for generator %s\n", generatorName_); fprintf(fp, " generator->setHowOften(%d);\n", whenCutGenerator_); fprintf(fp, " generator->setSwitchOffIfLessThan(%d);\n", switchOffIfLessThan_); fprintf(fp, " generator->setWhatDepth(%d);\n", depthCutGenerator_); fprintf(fp, " generator->setInaccuracy(%d);\n", inaccuracy_); if (timing()) fprintf(fp, " generator->setTiming(true);\n"); if (normal()) fprintf(fp, " generator->setNormal(true);\n"); if (atSolution()) fprintf(fp, " generator->setAtSolution(true);\n"); if (whenInfeasible()) fprintf(fp, " generator->setWhenInfeasible(true);\n"); if (needsOptimalBasis()) fprintf(fp, " generator->setNeedsOptimalBasis(true);\n"); if (mustCallAgain()) fprintf(fp, " generator->setMustCallAgain(true);\n"); if (whetherToUse()) fprintf(fp, " generator->setWhetherToUse(true);\n"); } CoinMP-1.8.3/Cbc/src/CbcBranchCut.hpp0000644000175000017500000001351011510742604015564 0ustar renerene/* $Id: CbcBranchCut.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcBranchCut_H #define CbcBranchCut_H #include "CbcBranchBase.hpp" #include "OsiRowCut.hpp" #include "CoinPackedMatrix.hpp" /** Define a cut branching class. At present empty - all stuff in descendants */ class CbcBranchCut : public CbcObject { public: // Default Constructor CbcBranchCut (); /** In to maintain normal methods */ CbcBranchCut (CbcModel * model); // Copy constructor CbcBranchCut ( const CbcBranchCut &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcBranchCut & operator=( const CbcBranchCut& rhs); // Destructor ~CbcBranchCut (); /// Infeasibility virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /** Set bounds to contain the current solution. More precisely, for the variable associated with this object, take the value given in the current solution, force it within the current bounds if required, then set the bounds to fix the variable at the integer nearest the solution value. At present this will do nothing */ virtual void feasibleRegion(); /** \brief Return true if branch created by object should fix variables */ virtual bool boundBranch() const ; /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /** \brief Given a valid solution (with reduced costs, etc.), return a branching object which would give a new feasible point in the good direction. The preferred branching object will force the variable to be +/-1 from its current value, depending on the reduced cost and objective sense. If movement in the direction which improves the objective is impossible due to bounds on the variable, the branching object will move in the other direction. If no movement is possible, the method returns NULL. Only the bounds on this variable are considered when determining if the new point is feasible. At present this does nothing */ virtual CbcBranchingObject * preferredNewFeasible() const; /** \brief Given a valid solution (with reduced costs, etc.), return a branching object which would give a new feasible point in a bad direction. As for preferredNewFeasible(), but the preferred branching object will force movement in a direction that degrades the objective. At present this does nothing */ virtual CbcBranchingObject * notPreferredNewFeasible() const ; using CbcObject::resetBounds ; /** Reset original upper and lower bound values from the solver. Handy for updating bounds held in this object after bounds held in the solver have been tightened. */ virtual void resetBounds(); protected: /// data }; /** Cut branching object This object can specify a two-way branch in terms of two cuts */ class CbcCutBranchingObject : public CbcBranchingObject { public: /// Default constructor CbcCutBranchingObject (); /** Create a cut branching object Cut down will applied on way=-1, up on way==1 Assumed down will be first so way_ set to -1 */ CbcCutBranchingObject (CbcModel * model, OsiRowCut & down, OsiRowCut &up, bool canFix); /// Copy constructor CbcCutBranchingObject ( const CbcCutBranchingObject &); /// Assignment operator CbcCutBranchingObject & operator= (const CbcCutBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; /// Destructor virtual ~CbcCutBranchingObject (); using CbcBranchingObject::branch ; /** \brief Sets the bounds for variables or adds a cut depending on the current arm of the branch and advances the object state to the next arm. Returns change in guessed objective on next branch */ virtual double branch(); using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** \brief Return true if branch should fix variables */ virtual bool boundBranch() const; /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return CutBranchingObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); protected: /// Cut for the down arm (way_ = -1) OsiRowCut down_; /// Cut for the up arm (way_ = 1) OsiRowCut up_; /// True if one way can fix variables bool canFix_; }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristic.hpp0000644000175000017500000005522612432625130015662 0ustar renerene/* $Id: CbcHeuristic.hpp 2094 2014-11-18 11:15:36Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristic_H #define CbcHeuristic_H #include #include #include "CoinPackedMatrix.hpp" #include "OsiCuts.hpp" #include "CoinHelperFunctions.hpp" #include "OsiBranchingObject.hpp" class OsiSolverInterface; class CbcModel; //############################################################################# class CbcHeuristicNodeList; class CbcBranchingObject; /** A class describing the branching decisions that were made to get to the node where a heuristic was invoked from */ class CbcHeuristicNode { private: void gutsOfConstructor(CbcModel& model); CbcHeuristicNode(); CbcHeuristicNode& operator=(const CbcHeuristicNode&); private: /// The number of branching decisions made int numObjects_; /** The indices of the branching objects. Note: an index may be listed multiple times. E.g., a general integer variable that has been branched on multiple times. */ CbcBranchingObject** brObj_; public: CbcHeuristicNode(CbcModel& model); CbcHeuristicNode(const CbcHeuristicNode& rhs); ~CbcHeuristicNode(); double distance(const CbcHeuristicNode* node) const; double minDistance(const CbcHeuristicNodeList& nodeList) const; bool minDistanceIsSmall(const CbcHeuristicNodeList& nodeList, const double threshold) const; double avgDistance(const CbcHeuristicNodeList& nodeList) const; }; class CbcHeuristicNodeList { private: void gutsOfDelete(); void gutsOfCopy(const CbcHeuristicNodeList& rhs); private: std::vector nodes_; public: CbcHeuristicNodeList() {} CbcHeuristicNodeList(const CbcHeuristicNodeList& rhs); CbcHeuristicNodeList& operator=(const CbcHeuristicNodeList& rhs); ~CbcHeuristicNodeList(); void append(CbcHeuristicNode*& node); void append(const CbcHeuristicNodeList& nodes); inline const CbcHeuristicNode* node(int i) const { return nodes_[i]; } inline int size() const { return static_cast(nodes_.size()); } }; //############################################################################# /** Heuristic base class */ class CbcHeuristic { private: void gutsOfDelete() {} void gutsOfCopy(const CbcHeuristic & rhs); public: // Default Constructor CbcHeuristic (); // Constructor with model - assumed before cuts CbcHeuristic (CbcModel & model); // Copy constructor CbcHeuristic ( const CbcHeuristic &); virtual ~CbcHeuristic(); /// Clone virtual CbcHeuristic * clone() const = 0; /// Assignment operator CbcHeuristic & operator=(const CbcHeuristic& rhs); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); /// Resets stuff if model changes virtual void resetModel(CbcModel * model) = 0; /** returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value This is called after cuts have been added - so can not add cuts */ virtual int solution(double & objectiveValue, double * newSolution) = 0; /** returns 0 if no solution, 1 if valid solution, -1 if just returning an estimate of best possible solution with better objective value than one passed in Sets solution values if good, sets objective value (only if nonzero code) This is called at same time as cut generators - so can add cuts Default is do nothing */ virtual int solution2(double & /*objectiveValue*/, double * /*newSolution*/, OsiCuts & /*cs*/) { return 0; } /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) virtual void validate() {} /** Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. If 10 added then don't worry if validate says there are funny objects as user knows it will be fine */ inline void setWhen(int value) { when_ = value; } /// Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always inline int when() const { return when_; } /// Sets number of nodes in subtree (default 200) inline void setNumberNodes(int value) { numberNodes_ = value; } /// Gets number of nodes in a subtree (default 200) inline int numberNodes() const { return numberNodes_; } /** Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 16 bit - needs new solution to run 1024 bit - stop all heuristics on max time */ inline void setSwitches(int value) { switches_ = value; } /** Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 16 bit - needs new solution to run 1024 bit - stop all heuristics on max time 65536 bit and above used for temporary communication */ inline int switches() const { return switches_; } /// Whether to exit at once on gap bool exitNow(double bestObjective) const; /// Sets feasibility pump options (-1 is off) inline void setFeasibilityPumpOptions(int value) { feasibilityPumpOptions_ = value; } /// Gets feasibility pump options (-1 is off) inline int feasibilityPumpOptions() const { return feasibilityPumpOptions_; } /// Just set model - do not do anything else inline void setModelOnly(CbcModel * model) { model_ = model; } /// Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0) inline void setFractionSmall(double value) { fractionSmall_ = value; } /// Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0) inline double fractionSmall() const { return fractionSmall_; } /// Get how many solutions the heuristic thought it got inline int numberSolutionsFound() const { return numberSolutionsFound_; } /// Increment how many solutions the heuristic thought it got inline void incrementNumberSolutionsFound() { numberSolutionsFound_++; } /** Do mini branch and bound - return 0 not finished - no solution 1 not finished - solution 2 finished - no solution 3 finished - solution (could add global cut if finished) -1 returned on size -2 time or user event */ int smallBranchAndBound(OsiSolverInterface * solver, int numberNodes, double * newSolution, double & newSolutionValue, double cutoff , std::string name) const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} /// Create C++ lines to get to current state - does work for base class void generateCpp( FILE * fp, const char * heuristic) ; /// Returns true if can deal with "odd" problems e.g. sos type 2 virtual bool canDealWithOdd() const { return false; } /// return name of heuristic inline const char *heuristicName() const { return heuristicName_.c_str(); } /// set name of heuristic inline void setHeuristicName(const char *name) { heuristicName_ = name; } /// Set random number generator seed void setSeed(int value); /// Get random number generator seed int getSeed() const; /// Sets decay factor (for howOften) on failure inline void setDecayFactor(double value) { decayFactor_ = value; } /// Set input solution void setInputSolution(const double * solution, double objValue); /* Runs if bit set 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution */ inline void setWhereFrom(int value) { whereFrom_ = value; } inline int whereFrom() const { return whereFrom_; } /** Upto this depth we call the tree shallow and the heuristic can be called multiple times. That is, the test whether the current node is far from the others where the jeuristic was invoked will not be done, only the frequency will be tested. After that depth the heuristic will can be invoked only once per node, right before branching. That's when it'll be tested whether the heur should run at all. */ inline void setShallowDepth(int value) { shallowDepth_ = value; } /** How often to invoke the heuristics in the shallow part of the tree */ inline void setHowOftenShallow(int value) { howOftenShallow_ = value; } /** How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too. Currently this is tested, but we may switch to avgDistanceToRun_ in the future. */ inline void setMinDistanceToRun(int value) { minDistanceToRun_ = value; } /** Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution */ virtual bool shouldHeurRun(int whereFrom); /** Check whether the heuristic should run this time */ bool shouldHeurRun_randomChoice(); void debugNodes(); void printDistanceToNodes(); /// how many times the heuristic has actually run inline int numRuns() const { return numRuns_; } /// How many times the heuristic could run inline int numCouldRun() const { return numCouldRun_; } /*! \brief Clone, but ... If type is - 0 clone the solver for the model, - 1 clone the continuous solver for the model - Add 2 to say without integer variables which are at low priority - Add 4 to say quite likely infeasible so give up easily (clp only). */ OsiSolverInterface * cloneBut(int type); protected: /// Model CbcModel * model_; /// When flag - 0 off, 1 at root, 2 other than root, 3 always int when_; /// Number of nodes in any sub tree int numberNodes_; /** Feasibility pump options , -1 is off >=0 for feasibility pump itself -2 quick proximity search -3 longer proximity search */ int feasibilityPumpOptions_; /// Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound mutable double fractionSmall_; /// Thread specific random number generator CoinThreadRandom randomNumberGenerator_; /// Name for printing std::string heuristicName_; /// How often to do (code can change) mutable int howOften_; /// How much to increase how often double decayFactor_; /** Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 16 bit - needs new solution to run 1024 bit - stop all heuristics on max time */ mutable int switches_; /* Runs if bit set 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution */ int whereFrom_; /** Upto this depth we call the tree shallow and the heuristic can be called multiple times. That is, the test whether the current node is far from the others where the jeuristic was invoked will not be done, only the frequency will be tested. After that depth the heuristic will can be invoked only once per node, right before branching. That's when it'll be tested whether the heur should run at all. */ int shallowDepth_; /** How often to invoke the heuristics in the shallow part of the tree */ int howOftenShallow_; /** How many invocations happened within the same node when in a shallow part of the tree. */ int numInvocationsInShallow_; /** How many invocations happened when in the deep part of the tree. For every node we count only one invocation. */ int numInvocationsInDeep_; /** After how many deep invocations was the heuristic run last time */ int lastRunDeep_; /// how many times the heuristic has actually run int numRuns_; /** How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too. Currently this is tested, but we may switch to avgDistanceToRun_ in the future. */ int minDistanceToRun_; /// The description of the nodes where this heuristic has been applied CbcHeuristicNodeList runNodes_; /// How many times the heuristic could run int numCouldRun_; /// How many solutions the heuristic thought it got int numberSolutionsFound_; /// How many nodes the heuristic did this go mutable int numberNodesDone_; // Input solution - so can be used as seed double * inputSolution_; #ifdef JJF_ZERO /// Lower bounds of last node where the heuristic found a solution double * lowerBoundLastNode_; /// Upper bounds of last node where the heuristic found a solution double * upperBoundLastNode_; #endif }; /** Rounding class */ class CbcRounding : public CbcHeuristic { public: // Default Constructor CbcRounding (); // Constructor with model - assumed before cuts CbcRounding (CbcModel & model); // Copy constructor CbcRounding ( const CbcRounding &); // Destructor ~CbcRounding (); /// Assignment operator CbcRounding & operator=(const CbcRounding& rhs); /// Clone virtual CbcHeuristic * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts */ virtual int solution(double & objectiveValue, double * newSolution); /** returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts Use solutionValue rather than solvers one */ virtual int solution(double & objectiveValue, double * newSolution, double solutionValue); /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) virtual void validate(); /// Set seed void setSeed(int value) { seed_ = value; } /** Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution */ virtual bool shouldHeurRun(int whereFrom); protected: // Data // Original matrix by column CoinPackedMatrix matrix_; // Original matrix by CoinPackedMatrix matrixByRow_; // Down locks unsigned short * down_; // Up locks unsigned short * up_; // Equality locks unsigned short * equal_; // Seed for random stuff int seed_; }; /** Partial solution class If user knows a partial solution this tries to get an integer solution it uses hotstart information */ class CbcHeuristicPartial : public CbcHeuristic { public: // Default Constructor CbcHeuristicPartial (); /** Constructor with model - assumed before cuts Fixes all variables with priority <= given and does given number of nodes */ CbcHeuristicPartial (CbcModel & model, int fixPriority = 10000, int numberNodes = 200); // Copy constructor CbcHeuristicPartial ( const CbcHeuristicPartial &); // Destructor ~CbcHeuristicPartial (); /// Assignment operator CbcHeuristicPartial & operator=(const CbcHeuristicPartial& rhs); /// Clone virtual CbcHeuristic * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts */ virtual int solution(double & objectiveValue, double * newSolution); /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) virtual void validate(); /// Set priority level void setFixPriority(int value) { fixPriority_ = value; } /** Check whether the heuristic should run at all */ virtual bool shouldHeurRun(int whereFrom); protected: // Data // All variables with abs priority <= this will be fixed int fixPriority_; }; /** heuristic - just picks up any good solution found by solver - see OsiBabSolver */ class CbcSerendipity : public CbcHeuristic { public: // Default Constructor CbcSerendipity (); /* Constructor with model */ CbcSerendipity (CbcModel & model); // Copy constructor CbcSerendipity ( const CbcSerendipity &); // Destructor ~CbcSerendipity (); /// Assignment operator CbcSerendipity & operator=(const CbcSerendipity& rhs); /// Clone virtual CbcHeuristic * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// update model virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) We leave all variables which are at one at this node of the tree to that value and will initially set all others to zero. We then sort all variables in order of their cost divided by the number of entries in rows which are not yet covered. We randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic. We then choose the best one and set it to one and repeat the exercise. */ virtual int solution(double & objectiveValue, double * newSolution); /// Resets stuff if model changes virtual void resetModel(CbcModel * model); protected: }; /** Just One class - this chooses one at random */ class CbcHeuristicJustOne : public CbcHeuristic { public: // Default Constructor CbcHeuristicJustOne (); // Constructor with model - assumed before cuts CbcHeuristicJustOne (CbcModel & model); // Copy constructor CbcHeuristicJustOne ( const CbcHeuristicJustOne &); // Destructor ~CbcHeuristicJustOne (); /// Clone virtual CbcHeuristicJustOne * clone() const; /// Assignment operator CbcHeuristicJustOne & operator=(const CbcHeuristicJustOne& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /** returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts This does Fractional Diving */ virtual int solution(double & objectiveValue, double * newSolution); /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); /// Selects the next variable to branch on /** Returns true if all the fractional variables can be trivially rounded. Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable. This is dummy as never called */ virtual bool selectVariableToBranch(OsiSolverInterface* /*solver*/, const double* /*newSolution*/, int& /*bestColumn*/, int& /*bestRound*/) { return true; } /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) virtual void validate(); /// Adds an heuristic with probability void addHeuristic(const CbcHeuristic * heuristic, double probability); /// Normalize probabilities void normalizeProbabilities(); protected: // Data // Probability of running a heuristic double * probabilities_; // Heuristics CbcHeuristic ** heuristic_; // Number of heuristics int numberHeuristics_; }; #endif CoinMP-1.8.3/Cbc/src/CbcStatistics.cpp0000644000175000017500000001033711510742604016044 0ustar renerene/* $Id: CbcStatistics.cpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CbcStatistics.hpp" CbcStatistics & CbcStatistics::operator=(const CbcStatistics & rhs) { if (this != &rhs) { value_ = rhs.value_; startingObjective_ = rhs.startingObjective_; endingObjective_ = rhs.endingObjective_; id_ = rhs.id_; parentId_ = rhs.parentId_; way_ = rhs.way_; sequence_ = rhs.sequence_; depth_ = rhs.depth_; startingInfeasibility_ = rhs.startingInfeasibility_; endingInfeasibility_ = rhs.endingInfeasibility_; numberIterations_ = rhs.numberIterations_; } return *this; } CbcStatistics::CbcStatistics () : value_ ( 0.0), startingObjective_(0.0), endingObjective_(COIN_DBL_MAX), id_(-1), parentId_(-1), way_ ( 0), sequence_(-1), depth_(0), startingInfeasibility_(-1), endingInfeasibility_(0), numberIterations_(0) { } // First or second branch CbcStatistics::CbcStatistics(CbcNode * node, CbcModel * model) : endingObjective_(COIN_DBL_MAX), endingInfeasibility_(0), numberIterations_(0) { CbcNodeInfo * nodeInfo = node->nodeInfo(); CbcNodeInfo * parent = nodeInfo->parent(); int numberBranches = nodeInfo->numberBranchesLeft(); const CbcBranchingObject * branch = dynamic_cast (node->branchingObject()); const OsiTwoWayBranchingObject * branch2 = dynamic_cast (node->branchingObject()); startingObjective_ = node->objectiveValue(); way_ = node->way(); depth_ = node->depth(); startingInfeasibility_ = node->numberUnsatisfied(); if (branch) { sequence_ = branch->variable(); value_ = branch->value(); } else { const OsiSimpleInteger * obj = dynamic_cast(branch2->originalObject()); assert (obj); sequence_ = obj->columnNumber(); value_ = branch2->value(); } if (parent) parentId_ = parent->nodeNumber(); else parentId_ = -1; if (numberBranches == 2) { id_ = nodeInfo->nodeNumber(); } else { way_ *= 10; id_ = model->getNodeCount2(); } } CbcStatistics::CbcStatistics(const CbcStatistics & rhs) : value_ ( rhs.value_), startingObjective_(rhs.startingObjective_), endingObjective_(rhs.endingObjective_), id_(rhs.id_), parentId_(rhs.parentId_), way_ ( rhs.way_), sequence_(rhs.sequence_), depth_(rhs.depth_), startingInfeasibility_(rhs.startingInfeasibility_), endingInfeasibility_(rhs.endingInfeasibility_), numberIterations_(rhs.numberIterations_) { } CbcStatistics::~CbcStatistics () { } // Update at end of branch void CbcStatistics::endOfBranch(int numberIterations, double objectiveValue) { numberIterations_ = numberIterations; endingObjective_ = objectiveValue; } // Update number of infeasibilities void CbcStatistics::updateInfeasibility(int numberInfeasibilities) { endingInfeasibility_ = numberInfeasibilities; } // Branch found to be infeasible by chooseBranch void CbcStatistics::sayInfeasible() { endingObjective_ = COIN_DBL_MAX; } // Just prints void CbcStatistics::print(const int * sequenceLookup) const { int sequence = -1; if (sequence_ >= 0) sequence = sequenceLookup ? sequenceLookup[sequence_] : sequence_; printf("%6d %6d %5d %6d %7.3f %s %s %13.7g (%5d) -> ", id_, parentId_, depth_, sequence, value_, abs(way_) == 1 ? " left" : "right", way_ < 0 ? "down" : " up ", startingObjective_, startingInfeasibility_); if (endingObjective_ != COIN_DBL_MAX) if (endingInfeasibility_) printf("%13.7g (%5d)\n", endingObjective_, endingInfeasibility_); else printf("%13.7g ** Solution\n", endingObjective_); else printf("cutoff\n"); } CoinMP-1.8.3/Cbc/src/CbcSolverExpandKnapsack.hpp0000644000175000017500000000201612131054770020000 0ustar renerene/* $Id: CbcSolverExpandKnapsack.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolverExpandKnapsack.hpp \brief Expanding possibilities of x*y, where x*y are both integers, constructing a knapsack constraint. Results in a tighter model. */ #ifndef CbcSolverExpandKnapsack_H #define CbcSolverExpandKnapsack_H OsiSolverInterface * expandKnapsack(CoinModel & model, int * whichColumn, int * knapsackStart, int * knapsackRow, int &numberKnapsack, CglStored & stored, int logLevel, int fixedPriority, int SOSPriority, CoinModel & tightenedModel); void afterKnapsack(const CoinModel & coinModel2, const int * whichColumn, const int * knapsackStart, const int * knapsackRow, int numberKnapsack, const double * knapsackSolution, double * solution, int logLevel); #endif CoinMP-1.8.3/Cbc/src/CbcGeneralDepth.cpp0000644000175000017500000006361612131054770016264 0ustar renerene// $Id: CbcGeneralDepth.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcGeneralDepth.hpp" #include "CbcBranchActual.hpp" #include "CbcHeuristicDive.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #include "CoinWarmStartBasis.hpp" #include "ClpNode.hpp" #include "CbcBranchDynamic.hpp" // Default Constructor CbcGeneralDepth::CbcGeneralDepth () : CbcGeneral(), maximumDepth_(0), maximumNodes_(0), whichSolution_(-1), numberNodes_(0), nodeInfo_(NULL) { } // Useful constructor (which are integer indices) CbcGeneralDepth::CbcGeneralDepth (CbcModel * model, int maximumDepth) : CbcGeneral(model), maximumDepth_(maximumDepth), maximumNodes_(0), whichSolution_(-1), numberNodes_(0), nodeInfo_(NULL) { assert(maximumDepth_ < 1000000); if (maximumDepth_ > 0) maximumNodes_ = (1 << maximumDepth_) + 1 + maximumDepth_; else if (maximumDepth_ < 0) maximumNodes_ = 1 + 1 - maximumDepth_; else maximumNodes_ = 0; #define MAX_NODES 100 maximumNodes_ = CoinMin(maximumNodes_, 1 + maximumDepth_ + MAX_NODES); if (maximumNodes_) { nodeInfo_ = new ClpNodeStuff(); nodeInfo_->maximumNodes_ = maximumNodes_; ClpNodeStuff * info = nodeInfo_; // for reduced costs and duals info->solverOptions_ |= 7; if (maximumDepth_ > 0) { info->nDepth_ = maximumDepth_; } else { info->nDepth_ = - maximumDepth_; info->solverOptions_ |= 32; } ClpNode ** nodeInfo = new ClpNode * [maximumNodes_]; for (int i = 0; i < maximumNodes_; i++) nodeInfo[i] = NULL; info->nodeInfo_ = nodeInfo; } else { nodeInfo_ = NULL; } } // Copy constructor CbcGeneralDepth::CbcGeneralDepth ( const CbcGeneralDepth & rhs) : CbcGeneral(rhs) { maximumDepth_ = rhs.maximumDepth_; maximumNodes_ = rhs.maximumNodes_; whichSolution_ = -1; numberNodes_ = 0; if (maximumNodes_) { assert (rhs.nodeInfo_); nodeInfo_ = new ClpNodeStuff(*rhs.nodeInfo_); nodeInfo_->maximumNodes_ = maximumNodes_; ClpNodeStuff * info = nodeInfo_; if (maximumDepth_ > 0) { info->nDepth_ = maximumDepth_; } else { info->nDepth_ = - maximumDepth_; info->solverOptions_ |= 32; } if (!info->nodeInfo_) { ClpNode ** nodeInfo = new ClpNode * [maximumNodes_]; for (int i = 0; i < maximumNodes_; i++) nodeInfo[i] = NULL; info->nodeInfo_ = nodeInfo; } } else { nodeInfo_ = NULL; } } // Clone CbcObject * CbcGeneralDepth::clone() const { return new CbcGeneralDepth(*this); } // Assignment operator CbcGeneralDepth & CbcGeneralDepth::operator=( const CbcGeneralDepth & rhs) { if (this != &rhs) { CbcGeneral::operator=(rhs); delete nodeInfo_; maximumDepth_ = rhs.maximumDepth_; maximumNodes_ = rhs.maximumNodes_; whichSolution_ = -1; numberNodes_ = 0; if (maximumDepth_) { assert (rhs.nodeInfo_); nodeInfo_ = new ClpNodeStuff(*rhs.nodeInfo_); nodeInfo_->maximumNodes_ = maximumNodes_; } else { nodeInfo_ = NULL; } } return *this; } // Destructor CbcGeneralDepth::~CbcGeneralDepth () { delete nodeInfo_; } // Infeasibility - large is 0.5 double CbcGeneralDepth::infeasibility(const OsiBranchingInformation * /*info*/, int &/*preferredWay*/) const { whichSolution_ = -1; // should use genuine OsiBranchingInformation usefulInfo = model_->usefulInformation(); // for now assume only called when correct //if (usefulInfo.depth_>=4&&!model_->parentModel() // &&(usefulInfo.depth_%2)==0) { if (true) { OsiSolverInterface * solver = model_->solver(); OsiClpSolverInterface * clpSolver = dynamic_cast (solver); if (clpSolver) { if ((model_->moreSpecialOptions()&33554432)==0) { ClpNodeStuff * info = nodeInfo_; info->integerTolerance_ = model_->getIntegerTolerance(); info->integerIncrement_ = model_->getCutoffIncrement(); info->numberBeforeTrust_ = model_->numberBeforeTrust(); info->stateOfSearch_ = model_->stateOfSearch(); // Compute "small" change in branch int nBranches = model_->getIntParam(CbcModel::CbcNumberBranches); if (nBranches) { double average = model_->getDblParam(CbcModel::CbcSumChange) / static_cast(nBranches); info->smallChange_ = CoinMax(average * 1.0e-5, model_->getDblParam(CbcModel::CbcSmallestChange)); info->smallChange_ = CoinMax(info->smallChange_, 1.0e-8); } else { info->smallChange_ = 1.0e-8; } int numberIntegers = model_->numberIntegers(); double * down = new double[numberIntegers]; double * up = new double[numberIntegers]; int * priority = new int[numberIntegers]; int * numberDown = new int[numberIntegers]; int * numberUp = new int[numberIntegers]; int * numberDownInfeasible = new int[numberIntegers]; int * numberUpInfeasible = new int[numberIntegers]; model_->fillPseudoCosts(down, up, priority, numberDown, numberUp, numberDownInfeasible, numberUpInfeasible); info->fillPseudoCosts(down, up, priority, numberDown, numberUp, numberDownInfeasible, numberUpInfeasible, numberIntegers); info->presolveType_ = 1; delete [] down; delete [] up; delete [] numberDown; delete [] numberUp; delete [] numberDownInfeasible; delete [] numberUpInfeasible; bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoReducePrint, takeHint, strength); ClpSimplex * simplex = clpSolver->getModelPtr(); int saveLevel = simplex->logLevel(); if (strength != OsiHintIgnore && takeHint && saveLevel == 1) simplex->setLogLevel(0); clpSolver->setBasis(); whichSolution_ = simplex->fathomMany(info); //printf("FAT %d nodes, %d iterations\n", //info->numberNodesExplored_,info->numberIterations_); //printf("CbcBranch %d rows, %d columns\n",clpSolver->getNumRows(), // clpSolver->getNumCols()); model_->incrementExtra(info->numberNodesExplored_, info->numberIterations_); // update pseudo costs double smallest = 1.0e50; double largest = -1.0; OsiObject ** objects = model_->objects(); #ifndef NDEBUG const int * integerVariable = model_->integerVariable(); #endif for (int i = 0; i < numberIntegers; i++) { #ifndef NDEBUG CbcSimpleIntegerDynamicPseudoCost * obj = dynamic_cast (objects[i]) ; assert (obj && obj->columnNumber() == integerVariable[i]); #else CbcSimpleIntegerDynamicPseudoCost * obj = static_cast (objects[i]) ; #endif if (info->numberUp_[i] > 0) { if (info->downPseudo_[i] > largest) largest = info->downPseudo_[i]; if (info->downPseudo_[i] < smallest) smallest = info->downPseudo_[i]; if (info->upPseudo_[i] > largest) largest = info->upPseudo_[i]; if (info->upPseudo_[i] < smallest) smallest = info->upPseudo_[i]; obj->updateAfterMini(info->numberDown_[i], info->numberDownInfeasible_[i], info->downPseudo_[i], info->numberUp_[i], info->numberUpInfeasible_[i], info->upPseudo_[i]); } } //printf("range of costs %g to %g\n",smallest,largest); simplex->setLogLevel(saveLevel); numberNodes_ = info->nNodes_; } else { // Try diving // See if any diving heuristics set to do dive+save CbcHeuristicDive * dive=NULL; for (int i = 0; i < model_->numberHeuristics(); i++) { CbcHeuristicDive * possible = dynamic_cast(model_->heuristic(i)); if (possible&&possible->maxSimplexIterations()==COIN_INT_MAX) { // if more than one then rotate later? //if (possible->canHeuristicRun()) { dive=possible; break; } } assert (dive); // otherwise moreSpecial should have been turned off CbcSubProblem ** nodes=NULL; int branchState=dive->fathom(model_,numberNodes_,nodes); if (branchState) { printf("new solution\n"); whichSolution_=numberNodes_-1; } else { whichSolution_=-1; } #if 0 if (0) { for (int iNode=0;iNodepush(nodes[iNode]) ; } assert (node->nodeInfo()); if (node->nodeInfo()->numberBranchesLeft()) { tree_->push(node) ; } else { node->setActive(false); } } #endif //delete [] nodes; model_->setTemporaryPointer(reinterpret_cast(nodes)); // end try diving } int numberDo = numberNodes_; if (numberDo > 0 || whichSolution_ >= 0) { return 0.5; } else { // no solution return COIN_DBL_MAX; // say infeasible } } else { return -1.0; } } else { return -1.0; } } // This looks at solution and sets bounds to contain solution void CbcGeneralDepth::feasibleRegion() { // Other stuff should have done this } // Redoes data when sequence numbers change void CbcGeneralDepth::redoSequenceEtc(CbcModel * /*model*/, int /*numberColumns*/, const int * /*originalColumns*/) { } //#define CHECK_PATH #ifdef CHECK_PATH extern const double * debuggerSolution_Z; extern int numberColumns_Z; extern int gotGoodNode_Z; #endif CbcBranchingObject * CbcGeneralDepth::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int /*way*/) { int numberDo = numberNodes_; if (whichSolution_ >= 0 && (model_->moreSpecialOptions()&33554432)==0) numberDo--; assert (numberDo > 0); // create object CbcGeneralBranchingObject * branch = new CbcGeneralBranchingObject(model_); // skip solution branch->numberSubProblems_ = numberDo; // If parentBranch_ back in then will have to be 2* branch->numberSubLeft_ = numberDo; branch->setNumberBranches(numberDo); CbcSubProblem * sub = new CbcSubProblem[numberDo]; int iProb = 0; branch->subProblems_ = sub; branch->numberRows_ = model_->solver()->getNumRows(); int iNode; //OsiSolverInterface * solver = model_->solver(); OsiClpSolverInterface * clpSolver = dynamic_cast (solver); assert (clpSolver); ClpSimplex * simplex = clpSolver->getModelPtr(); int numberColumns = simplex->numberColumns(); if ((model_->moreSpecialOptions()&33554432)==0) { double * lowerBefore = CoinCopyOfArray(simplex->getColLower(), numberColumns); double * upperBefore = CoinCopyOfArray(simplex->getColUpper(), numberColumns); ClpNodeStuff * info = nodeInfo_; double * weight = new double[numberNodes_]; int * whichNode = new int [numberNodes_]; // Sort for (iNode = 0; iNode < numberNodes_; iNode++) { if (iNode != whichSolution_) { double objectiveValue = info->nodeInfo_[iNode]->objectiveValue(); double sumInfeasibilities = info->nodeInfo_[iNode]->sumInfeasibilities(); int numberInfeasibilities = info->nodeInfo_[iNode]->numberInfeasibilities(); double thisWeight = 0.0; #if 1 // just closest thisWeight = 1.0e9 * numberInfeasibilities; thisWeight += sumInfeasibilities; thisWeight += 1.0e-7 * objectiveValue; // Try estimate thisWeight = info->nodeInfo_[iNode]->estimatedSolution(); #else thisWeight = 1.0e-3 * numberInfeasibilities; thisWeight += 1.0e-5 * sumInfeasibilities; thisWeight += objectiveValue; #endif whichNode[iProb] = iNode; weight[iProb++] = thisWeight; } } assert (iProb == numberDo); CoinSort_2(weight, weight + numberDo, whichNode); for (iProb = 0; iProb < numberDo; iProb++) { iNode = whichNode[iProb]; ClpNode * node = info->nodeInfo_[iNode]; // move bounds node->applyNode(simplex, 3); // create subproblem sub[iProb] = CbcSubProblem(clpSolver, lowerBefore, upperBefore, node->statusArray(), node->depth()); sub[iProb].objectiveValue_ = node->objectiveValue(); sub[iProb].sumInfeasibilities_ = node->sumInfeasibilities(); sub[iProb].numberInfeasibilities_ = node->numberInfeasibilities(); #ifdef CHECK_PATH if (simplex->numberColumns() == numberColumns_Z) { bool onOptimal = true; const double * columnLower = simplex->columnLower(); const double * columnUpper = simplex->columnUpper(); for (int i = 0; i < numberColumns_Z; i++) { if (iNode == gotGoodNode_Z) printf("good %d %d %g %g\n", iNode, i, columnLower[i], columnUpper[i]); if (columnUpper[i] < debuggerSolution_Z[i] || columnLower[i] > debuggerSolution_Z[i] && simplex->isInteger(i)) { onOptimal = false; break; } } if (onOptimal) { printf("adding to node %x as %d - objs\n", this, iProb); for (int j = 0; j <= iProb; j++) printf("%d %g\n", j, sub[j].objectiveValue_); } } #endif } delete [] weight; delete [] whichNode; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); // restore bounds for ( int j = 0; j < numberColumns; j++) { if (lowerBefore[j] != lower[j]) solver->setColLower(j, lowerBefore[j]); if (upperBefore[j] != upper[j]) solver->setColUpper(j, upperBefore[j]); } delete [] upperBefore; delete [] lowerBefore; } else { // from diving CbcSubProblem ** nodes = reinterpret_cast (model_->temporaryPointer()); assert (nodes); int adjustDepth=info->depth_; assert (numberDo); numberNodes_=0; for (iProb = 0; iProb < numberDo; iProb++) { if ((nodes[iProb]->problemStatus_&2)==0) { // create subproblem (and swap way and/or make inactive) sub[numberNodes_].takeOver(*nodes[iProb],true); // but adjust depth sub[numberNodes_].depth_+=adjustDepth; numberNodes_++; } delete nodes[iProb]; } branch->numberSubProblems_ = numberNodes_; branch->numberSubLeft_ = numberNodes_; branch->setNumberBranches(numberNodes_); if (!numberNodes_) { // infeasible delete branch; branch=NULL; } delete [] nodes; } return branch; } // Default Constructor CbcGeneralBranchingObject::CbcGeneralBranchingObject() : CbcBranchingObject(), subProblems_(NULL), node_(NULL), numberSubProblems_(0), numberSubLeft_(0), whichNode_(-1), numberRows_(0) { // printf("CbcGeneral %x default constructor\n",this); } // Useful constructor CbcGeneralBranchingObject::CbcGeneralBranchingObject (CbcModel * model) : CbcBranchingObject(model, -1, -1, 0.5), subProblems_(NULL), node_(NULL), numberSubProblems_(0), numberSubLeft_(0), whichNode_(-1), numberRows_(0) { //printf("CbcGeneral %x useful constructor\n",this); } // Copy constructor CbcGeneralBranchingObject::CbcGeneralBranchingObject ( const CbcGeneralBranchingObject & rhs) : CbcBranchingObject(rhs), subProblems_(NULL), node_(rhs.node_), numberSubProblems_(rhs.numberSubProblems_), numberSubLeft_(rhs.numberSubLeft_), whichNode_(rhs.whichNode_), numberRows_(rhs.numberRows_) { abort(); if (numberSubProblems_) { subProblems_ = new CbcSubProblem[numberSubProblems_]; for (int i = 0; i < numberSubProblems_; i++) subProblems_[i] = rhs.subProblems_[i]; } } // Assignment operator CbcGeneralBranchingObject & CbcGeneralBranchingObject::operator=( const CbcGeneralBranchingObject & rhs) { if (this != &rhs) { abort(); CbcBranchingObject::operator=(rhs); delete [] subProblems_; numberSubProblems_ = rhs.numberSubProblems_; numberSubLeft_ = rhs.numberSubLeft_; whichNode_ = rhs.whichNode_; numberRows_ = rhs.numberRows_; if (numberSubProblems_) { subProblems_ = new CbcSubProblem[numberSubProblems_]; for (int i = 0; i < numberSubProblems_; i++) subProblems_[i] = rhs.subProblems_[i]; } else { subProblems_ = NULL; } node_ = rhs.node_; } return *this; } CbcBranchingObject * CbcGeneralBranchingObject::clone() const { return (new CbcGeneralBranchingObject(*this)); } // Destructor CbcGeneralBranchingObject::~CbcGeneralBranchingObject () { //printf("CbcGeneral %x destructor\n",this); delete [] subProblems_; } bool doingDoneBranch = false; double CbcGeneralBranchingObject::branch() { double cutoff = model_->getCutoff(); //printf("GenB %x whichNode %d numberLeft %d which %d\n", // this,whichNode_,numberBranchesLeft(),branchIndex()); if (whichNode_ < 0) { assert (node_); bool applied = false; while (numberBranchesLeft()) { int which = branchIndex(); decrementNumberBranchesLeft(); CbcSubProblem * thisProb = subProblems_ + which; if (thisProb->objectiveValue_ < cutoff) { //printf("branch %x (sub %x) which now %d\n",this, // subProblems_,which); OsiSolverInterface * solver = model_->solver(); thisProb->apply(solver); OsiClpSolverInterface * clpSolver = dynamic_cast (solver); assert (clpSolver); // Move status to basis clpSolver->setWarmStart(NULL); //ClpSimplex * simplex = clpSolver->getModelPtr(); node_->setObjectiveValue(thisProb->objectiveValue_); node_->setSumInfeasibilities(thisProb->sumInfeasibilities_); node_->setNumberUnsatisfied(thisProb->numberInfeasibilities_); applied = true; doingDoneBranch = true; break; } else if (numberBranchesLeft()) { node_->nodeInfo()->branchedOn() ; } } if (!applied) { // no good one node_->setObjectiveValue(cutoff + 1.0e20); node_->setSumInfeasibilities(1.0); node_->setNumberUnsatisfied(1); assert (whichNode_ < 0); } } else { decrementNumberBranchesLeft(); CbcSubProblem * thisProb = subProblems_ + whichNode_; assert (thisProb->objectiveValue_ < cutoff); OsiSolverInterface * solver = model_->solver(); thisProb->apply(solver); //OsiClpSolverInterface * clpSolver //= dynamic_cast (solver); //assert (clpSolver); // Move status to basis //clpSolver->setWarmStart(NULL); } return 0.0; } /* Double checks in case node can change its mind! Can change objective etc */ void CbcGeneralBranchingObject::checkIsCutoff(double cutoff) { assert (node_); int first = branchIndex(); int last = first + numberBranchesLeft(); for (int which = first; which < last; which++) { CbcSubProblem * thisProb = subProblems_ + which; if (thisProb->objectiveValue_ < cutoff) { node_->setObjectiveValue(thisProb->objectiveValue_); node_->setSumInfeasibilities(thisProb->sumInfeasibilities_); node_->setNumberUnsatisfied(thisProb->numberInfeasibilities_); break; } } } // Print what would happen void CbcGeneralBranchingObject::print() { //printf("CbcGeneralObject has %d subproblems\n",numberSubProblems_); } // Fill in current objective etc void CbcGeneralBranchingObject::state(double & objectiveValue, double & sumInfeasibilities, int & numberUnsatisfied, int which) const { assert (which >= 0 && which < numberSubProblems_); const CbcSubProblem * thisProb = subProblems_ + which; objectiveValue = thisProb->objectiveValue_; sumInfeasibilities = thisProb->sumInfeasibilities_; numberUnsatisfied = thisProb->numberInfeasibilities_; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcGeneralBranchingObject::compareOriginalObject (const CbcBranchingObject* /*brObj*/) const { throw("must implement"); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcGeneralBranchingObject::compareBranchingObject (const CbcBranchingObject* /*brObj*/, const bool /*replaceIfOverlap*/) { throw("must implement"); } // Default Constructor CbcOneGeneralBranchingObject::CbcOneGeneralBranchingObject() : CbcBranchingObject(), object_(NULL), whichOne_(-1) { //printf("CbcOneGeneral %x default constructor\n",this); } // Useful constructor CbcOneGeneralBranchingObject::CbcOneGeneralBranchingObject (CbcModel * model, CbcGeneralBranchingObject * object, int whichOne) : CbcBranchingObject(model, -1, -1, 0.5), object_(object), whichOne_(whichOne) { //printf("CbcOneGeneral %x useful constructor object %x %d left\n",this, // object_,object_->numberSubLeft_); numberBranches_ = 1; } // Copy constructor CbcOneGeneralBranchingObject::CbcOneGeneralBranchingObject ( const CbcOneGeneralBranchingObject & rhs) : CbcBranchingObject(rhs), object_(rhs.object_), whichOne_(rhs.whichOne_) { } // Assignment operator CbcOneGeneralBranchingObject & CbcOneGeneralBranchingObject::operator=( const CbcOneGeneralBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); object_ = rhs.object_; whichOne_ = rhs.whichOne_; } return *this; } CbcBranchingObject * CbcOneGeneralBranchingObject::clone() const { return (new CbcOneGeneralBranchingObject(*this)); } // Destructor CbcOneGeneralBranchingObject::~CbcOneGeneralBranchingObject () { //printf("CbcOneGeneral %x destructor object %x %d left\n",this, // object_,object_->numberSubLeft_); assert (object_->numberSubLeft_ > 0 && object_->numberSubLeft_ < 1000000); if (!object_->decrementNumberLeft()) { // printf("CbcGeneral %x yy destructor\n",object_); delete object_; } } double CbcOneGeneralBranchingObject::branch() { assert (numberBranchesLeft()); decrementNumberBranchesLeft(); assert (!numberBranchesLeft()); object_->setWhichNode(whichOne_); object_->branch(); return 0.0; } /* Double checks in case node can change its mind! Can change objective etc */ void CbcOneGeneralBranchingObject::checkIsCutoff(double /*cutoff*/) { assert (numberBranchesLeft()); } // Print what would happen void CbcOneGeneralBranchingObject::print() { //printf("CbcOneGeneralObject has 1 subproblem\n"); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcOneGeneralBranchingObject::compareOriginalObject (const CbcBranchingObject* /*brObj*/) const { throw("must implement"); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcOneGeneralBranchingObject::compareBranchingObject (const CbcBranchingObject* /*brObj*/, const bool /*replaceIfOverlap*/) { throw("must implement"); } #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicRandRound.hpp0000644000175000017500000000300612131054770017466 0ustar renerene/* $Id: CbcHeuristicRandRound.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicRandRound_H #define CbcHeuristicRandRound_H #include "CbcHeuristic.hpp" /** LocalSearch class */ class CbcHeuristicRandRound : public CbcHeuristic { public: // Default Constructor CbcHeuristicRandRound (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicRandRound (CbcModel & model); // Copy constructor CbcHeuristicRandRound ( const CbcHeuristicRandRound &); // Destructor ~CbcHeuristicRandRound (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicRandRound & operator=(const CbcHeuristicRandRound& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) needs comments */ virtual int solution(double & objectiveValue, double * newSolution); protected: }; #endif CoinMP-1.8.3/Cbc/src/CbcSOS.hpp0000644000175000017500000002240012403272735014362 0ustar renerene// $Id: CbcSOS.hpp 2070 2014-09-08 09:24:45Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/9/2009-- carved out of CbcBranchActual #ifndef CbcSOS_H #define CbcSOS_H /** \brief Branching object for Special Ordered Sets of type 1 and 2. SOS1 are an ordered set of variables where at most one variable can be non-zero. SOS1 are commonly defined with binary variables (interpreted as selection between alternatives) but this is not necessary. An SOS1 with all binary variables is a special case of a clique (setting any one variable to 1 forces all others to 0). In theory, the implementation makes no assumptions about integrality in Type 1 sets. In practice, there are places where the code seems to have been written with a binary SOS mindset. Current development of SOS branching objects is proceeding in OsiSOS. SOS2 are an ordered set of variables in which at most two consecutive variables can be non-zero and must sum to 1 (interpreted as interpolation between two discrete values). By definition the variables are non-integer. */ class CbcSOS : public CbcObject { public: // Default Constructor CbcSOS (); /** \brief Constructor with SOS type and member information Type specifies SOS 1 or 2. Identifier is an arbitrary value. Which should be an array of variable indices with numberMembers entries. Weights can be used to assign arbitrary weights to variables, in the order they are specified in which. If no weights are provided, a default array of 0, 1, 2, ... is generated. */ CbcSOS (CbcModel * model, int numberMembers, const int * which, const double * weights, int identifier, int type = 1); // Copy constructor CbcSOS ( const CbcSOS &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcSOS & operator=( const CbcSOS& rhs); // Destructor virtual ~CbcSOS (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /// This looks at solution and sets bounds to contain solution virtual void feasibleRegion(); /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /** Pass in information on branch just done and create CbcObjectUpdateData instance. If object does not need data then backward pointer will be NULL. Assumes can get information from solver */ virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface * solver, const CbcNode * node, const CbcBranchingObject * branchingObject); /// Update object by CbcObjectUpdateData virtual void updateInformation(const CbcObjectUpdateData & data) ; using CbcObject::solverBranch ; /** Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ virtual OsiSolverBranch * solverBranch() const; /// Redoes data when sequence numbers change virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns); /// Construct an OsiSOS object OsiSOS * osiObject(const OsiSolverInterface * solver) const; /// Number of members inline int numberMembers() const { return numberMembers_; } /// Members (indices in range 0 ... numberColumns-1) inline const int * members() const { return members_; } /// SOS type inline int sosType() const { return sosType_; } /// Down number times inline int numberTimesDown() const { return numberTimesDown_; } /// Up number times inline int numberTimesUp() const { return numberTimesUp_; } /** Array of weights */ inline const double * weights() const { return weights_; } /// Set number of members inline void setNumberMembers(int n) { numberMembers_ = n; } /// Members (indices in range 0 ... numberColumns-1) inline int * mutableMembers() const { return members_; } /** Array of weights */ inline double * mutableWeights() const { return weights_; } /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const { return (sosType_ == 1 && integerValued_); } /// Set whether set is integer valued or not inline void setIntegerValued(bool yesNo) { integerValued_ = yesNo; } private: /// data /// Members (indices in range 0 ... numberColumns-1) int * members_; /** \brief Weights for individual members Arbitrary weights for members. Can be used to attach meaning to variable values independent of objective coefficients. For example, if the SOS set comprises binary variables used to choose a facility of a given size, the weight could be the corresponding facilty size. Fractional values of the SOS variables can then be used to estimate ideal facility size. Weights cannot be completely arbitrary. From the code, they must be differ by at least 1.0e-7 */ double * weights_; /// Current pseudo-shadow price estimate down mutable double shadowEstimateDown_; /// Current pseudo-shadow price estimate up mutable double shadowEstimateUp_; /// Down pseudo ratio double downDynamicPseudoRatio_; /// Up pseudo ratio double upDynamicPseudoRatio_; /// Number of times we have gone down int numberTimesDown_; /// Number of times we have gone up int numberTimesUp_; /// Number of members int numberMembers_; /// SOS type int sosType_; /// Whether integer valued bool integerValued_; /// Whether odd values e.g. negative bool oddValues_; }; /** Branching object for Special ordered sets Variable_ is the set id number (redundant, as the object also holds a pointer to the set. */ class CbcSOSBranchingObject : public CbcBranchingObject { public: // Default Constructor CbcSOSBranchingObject (); // Useful constructor CbcSOSBranchingObject (CbcModel * model, const CbcSOS * clique, int way, double separator); // Copy constructor CbcSOSBranchingObject ( const CbcSOSBranchingObject &); // Assignment operator CbcSOSBranchingObject & operator=( const CbcSOSBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; // Destructor virtual ~CbcSOSBranchingObject (); using CbcBranchingObject::branch ; /// Does next branch and updates state virtual double branch(); /** Update bounds in solver as in 'branch' and update given bounds. branchState is -1 for 'down' +1 for 'up' */ virtual void fix(OsiSolverInterface * solver, double * lower, double * upper, int branchState) const ; /** Reset every information so that the branching object appears to point to the previous child. This method does not need to modify anything in any solver. */ virtual void previousBranch() { CbcBranchingObject::previousBranch(); computeNonzeroRange(); } using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return SoSBranchObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); /** Fill out the \c firstNonzero_ and \c lastNonzero_ data members */ void computeNonzeroRange(); private: /// data const CbcSOS * set_; /// separator double separator_; /** The following two members describe the range in the members_ of the original object that whose upper bound is not fixed to 0. This is not necessary for Cbc to function correctly, this is there for heuristics so that separate branching decisions on the same object can be pooled into one branching object. */ int firstNonzero_; int lastNonzero_; }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicDive.hpp0000644000175000017500000001333312426717442016476 0ustar renerene/* $Id: CbcHeuristicDive.hpp 2093 2014-11-06 16:17:38Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicDive_H #define CbcHeuristicDive_H #include "CbcHeuristic.hpp" class CbcSubProblem; class OsiRowCut; struct PseudoReducedCost { int var; double pseudoRedCost; }; /** Dive class */ class CbcHeuristicDive : public CbcHeuristic { public: // Default Constructor CbcHeuristicDive (); // Constructor with model - assumed before cuts CbcHeuristicDive (CbcModel & model); // Copy constructor CbcHeuristicDive ( const CbcHeuristicDive &); // Destructor ~CbcHeuristicDive (); /// Clone virtual CbcHeuristicDive * clone() const = 0; /// Assignment operator CbcHeuristicDive & operator=(const CbcHeuristicDive& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} /// Create C++ lines to get to current state - does work for base class void generateCpp( FILE * fp, const char * heuristic); /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); // REMLOVE using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value (only if good) This is called after cuts have been added - so can not add cuts This does Fractional Diving */ virtual int solution(double & objectiveValue, double * newSolution); /// inner part of dive int solution(double & objectiveValue, int & numberNodes, int & numberCuts, OsiRowCut ** cuts, CbcSubProblem ** & nodes, double * newSolution); /** returns 0 if no solution, 1 if valid solution with better objective value than one passed in also returns list of nodes This does Fractional Diving */ int fathom(CbcModel * model, int & numberNodes,CbcSubProblem ** & nodes); /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) virtual void validate(); /// Sets priorities if any void setPriorities(); /// Select candidate binary variables for fixing void selectBinaryVariables(); /// Set percentage of integer variables to fix at bounds void setPercentageToFix(double value) { percentageToFix_ = value; } /// Set maximum number of iterations void setMaxIterations(int value) { maxIterations_ = value; } /// Set maximum number of simplex iterations void setMaxSimplexIterations(int value) { maxSimplexIterations_ = value; } /// Get maximum number of simplex iterations inline int maxSimplexIterations() const { return maxSimplexIterations_; } /// Set maximum number of simplex iterations at root node void setMaxSimplexIterationsAtRoot(int value) { maxSimplexIterationsAtRoot_ = value; } /// Set maximum time allowed void setMaxTime(double value) { maxTime_ = value; } /// Tests if the heuristic can run virtual bool canHeuristicRun(); /** Selects the next variable to branch on Returns true if all the fractional variables can be trivially rounded. Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable. */ virtual bool selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound) = 0; /** Initializes any data which is going to be used repeatedly in selectVariableToBranch */ virtual void initializeData() {} /// Perform reduced cost fixing on integer variables int reducedCostFix (OsiSolverInterface* solver); /// Fix other variables at bounds virtual int fixOtherVariables(OsiSolverInterface * solver, const double * solution, PseudoReducedCost * candidate, const double * random); protected: // Data // Original matrix by column CoinPackedMatrix matrix_; // Original matrix by CoinPackedMatrix matrixByRow_; // Down locks unsigned short * downLocks_; // Up locks unsigned short * upLocks_; /// Extra down array (number Integers long) double * downArray_; /// Extra up array (number Integers long) double * upArray_; /// Array of priorities typedef struct { unsigned int direction:3; // 0 bit off, 1 bit (0 down first, 1 up first) 2 bit non zero don't try other way unsigned int priority:29; } PriorityType; PriorityType * priority_; // Indexes of binary variables with 0 objective coefficient // and in variable bound constraints std::vector binVarIndex_; // Indexes of variable bound rows for each binary variable std::vector vbRowIndex_; // Percentage of integer variables to fix at bounds double percentageToFix_; // Maximum time allowed double maxTime_; // Small objective (i.e. treat zero objective as this) double smallObjective_; // Maximum number of major iterations int maxIterations_; // Maximum number of simplex iterations int maxSimplexIterations_; // Maximum number of simplex iterations at root node int maxSimplexIterationsAtRoot_; }; #endif CoinMP-1.8.3/Cbc/src/CbcSolver.cpp0000644000175000017500000231146012555701430015171 0ustar renerene/* $Id: CbcSolver.cpp 2209 2015-07-28 13:26:48Z forrest $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolver.cpp \brief Second level routines for the cbc stand-alone solver. */ #include "CbcConfig.h" #include "CoinPragma.hpp" #include #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinMpsIO.hpp" #include "CoinModel.hpp" #include "ClpFactorization.hpp" #include "ClpQuadraticObjective.hpp" #include "CoinTime.hpp" #include "ClpSimplex.hpp" #include "ClpSimplexOther.hpp" #include "ClpSolve.hpp" #include "ClpMessage.hpp" #include "ClpPackedMatrix.hpp" #include "ClpPlusMinusOneMatrix.hpp" #include "ClpNetworkMatrix.hpp" #include "ClpDualRowSteepest.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpLinearObjective.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "ClpPrimalColumnDantzig.hpp" #include "ClpPresolve.hpp" #ifndef COIN_HAS_CBC #define COIN_HAS_CBC #endif #include "CbcOrClpParam.hpp" #include "OsiRowCutDebugger.hpp" #include "OsiChooseVariable.hpp" #include "OsiAuxInfo.hpp" #include "CbcMipStartIO.hpp" // for printing #ifndef CLP_OUTPUT_FORMAT #define CLP_OUTPUT_FORMAT %15.8g #endif #define CLP_QUOTE(s) CLP_STRING(s) #define CLP_STRING(s) #s #include "CbcSolverHeuristics.hpp" #ifdef COIN_HAS_GLPK #include "glpk.h" extern glp_tran* cbc_glp_tran; extern glp_prob* cbc_glp_prob; #else #define GLP_UNDEF 1 #define GLP_FEAS 2 #define GLP_INFEAS 3 #define GLP_NOFEAS 4 #define GLP_OPT 5 #endif #ifndef CBC_QUIET #define CBC_QUIET 0 #endif //#define USER_HAS_FAKE_CLP //#define USER_HAS_FAKE_CBC //#define CLP_MALLOC_STATISTICS #ifdef CLP_MALLOC_STATISTICS #include #include #include #include "stolen_from_ekk_malloc.cpp" static double malloc_times = 0.0; static double malloc_total = 0.0; static int malloc_amount[] = {0, 32, 128, 256, 1024, 4096, 16384, 65536, 262144, INT_MAX}; static int malloc_n = 10; double malloc_counts[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; bool malloc_counts_on = true; void * operator new (size_t size) throw (std::bad_alloc) { malloc_times ++; malloc_total += size; int i; for (i = 0; i < malloc_n; i++) { if ((int) size <= malloc_amount[i]) { malloc_counts[i]++; break; } } # ifdef DEBUG_MALLOC void *p; if (malloc_counts_on) p = stolen_from_ekk_mallocBase(size); else p = malloc(size); # else void * p = malloc(size); # endif //char * xx = (char *) p; //memset(xx,0,size); // Initialize random seed //CoinSeedRandom(987654321); return p; } void operator delete (void *p) throw() { # ifdef DEBUG_MALLOC if (malloc_counts_on) stolen_from_ekk_freeBase(p); else free(p); # else free(p); # endif } static void malloc_stats2() { double average = malloc_total / malloc_times; printf("count %g bytes %g - average %g\n", malloc_times, malloc_total, average); for (int i = 0; i < malloc_n; i++) printf("%g ", malloc_counts[i]); printf("\n"); malloc_times = 0.0; malloc_total = 0.0; memset(malloc_counts, 0, sizeof(malloc_counts)); // print results } #else //CLP_MALLOC_STATISTICS //void stolen_from_ekk_memory(void * dummy,int type) //{ //} //bool malloc_counts_on=false; #endif //CLP_MALLOC_STATISTICS //#define DMALLOC #ifdef DMALLOC #include "dmalloc.h" #endif #ifdef WSSMP_BARRIER #define FOREIGN_BARRIER #endif #ifdef UFL_BARRIER #define FOREIGN_BARRIER #endif #ifdef TAUCS_BARRIER #define FOREIGN_BARRIER #endif static int initialPumpTune = -1; #include "CoinWarmStartBasis.hpp" #include "OsiSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #ifndef COIN_HAS_LINK #define COIN_HAS_LINK #endif #ifdef COIN_HAS_LINK #include "CbcLinked.hpp" #endif #include "CglPreProcess.hpp" #include "CglCutGenerator.hpp" #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglRedSplit.hpp" #include "CglRedSplit2.hpp" #include "CglGMI.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding2.hpp" #include "CglTwomir.hpp" #include "CglDuplicateRow.hpp" #include "CglStored.hpp" #include "CglLandP.hpp" #include "CglResidualCapacity.hpp" #include "CglZeroHalf.hpp" //#define CGL_WRITEMPS #ifdef CGL_WRITEMPS extern double * debugSolution; extern int debugNumberColumns; #endif #include "CbcModel.hpp" #include "CbcHeuristic.hpp" #include "CbcHeuristicLocal.hpp" #include "CbcHeuristicPivotAndFix.hpp" //#include "CbcHeuristicPivotAndComplement.hpp" #include "CbcHeuristicRandRound.hpp" #include "CbcHeuristicGreedy.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcHeuristicRINS.hpp" #include "CbcHeuristicDiveCoefficient.hpp" #include "CbcHeuristicDiveFractional.hpp" #include "CbcHeuristicDiveGuided.hpp" #include "CbcHeuristicDiveVectorLength.hpp" #include "CbcHeuristicDivePseudoCost.hpp" #include "CbcHeuristicDiveLineSearch.hpp" #include "CbcTreeLocal.hpp" #include "CbcCompareActual.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchLotsize.hpp" #include "CbcOrClpParam.hpp" #include "CbcCutGenerator.hpp" #include "CbcStrategy.hpp" #include "CbcBranchCut.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcSolverAnalyze.hpp" #include "CbcSolverExpandKnapsack.hpp" #include "CbcSolver.hpp" //#define IN_BRANCH_AND_BOUND (0x01000000|262144) #define IN_BRANCH_AND_BOUND (0x01000000|262144|128|1024|2048) //#define IN_BRANCH_AND_BOUND (0x01000000|262144|128) /* CbcStopNow class definitions. */ CbcStopNow::CbcStopNow() { } CbcStopNow::~CbcStopNow() { } // Copy constructor CbcStopNow::CbcStopNow ( const CbcStopNow & ) { } // Assignment operator CbcStopNow & CbcStopNow::operator=(const CbcStopNow & rhs) { if (this != &rhs) { } return *this; } // Clone CbcStopNow * CbcStopNow::clone() const { return new CbcStopNow(*this); } /* CbcUser class definitions. */ // User stuff (base class) CbcUser::CbcUser() : coinModel_(NULL), userName_("null") { } CbcUser::~CbcUser() { delete coinModel_; } // Copy constructor CbcUser::CbcUser ( const CbcUser & rhs) { if (rhs.coinModel_) coinModel_ = new CoinModel(*rhs.coinModel_); else coinModel_ = NULL; userName_ = rhs.userName_; } // Assignment operator CbcUser & CbcUser::operator=(const CbcUser & rhs) { if (this != &rhs) { if (rhs.coinModel_) coinModel_ = new CoinModel(*rhs.coinModel_); else coinModel_ = NULL; userName_ = rhs.userName_; } return *this; } static void putBackOtherSolutions(CbcModel * presolvedModel, CbcModel * model, CglPreProcess * preProcess) { int numberSolutions=presolvedModel->numberSavedSolutions(); int numberColumns=presolvedModel->getNumCols(); if (numberSolutions>1) { model->deleteSolutions(); double * bestSolution = CoinCopyOfArray(presolvedModel->bestSolution(),numberColumns); //double cutoff = presolvedModel->getCutoff(); double objectiveValue=presolvedModel->getObjValue(); //model->createSpaceForSavedSolutions(numberSolutions-1); for (int iSolution=numberSolutions-1;iSolution>=0;iSolution--) { presolvedModel->setCutoff(COIN_DBL_MAX); presolvedModel->solver()->setColSolution(presolvedModel->savedSolution(iSolution)); //presolvedModel->savedSolutionObjective(iSolution)); preProcess->postProcess(*presolvedModel->solver(),false); model->setBestSolution(preProcess->originalModel()->getColSolution(),model->solver()->getNumCols(), presolvedModel->savedSolutionObjective(iSolution)); } presolvedModel->setBestObjectiveValue(objectiveValue); presolvedModel->solver()->setColSolution(bestSolution); //presolvedModel->setBestSolution(bestSolution,numberColumns,objectiveValue); } } /* CbcSolver class definitions */ CbcSolver::CbcSolver() : babModel_(NULL), userFunction_(NULL), statusUserFunction_(NULL), originalSolver_(NULL), originalCoinModel_(NULL), cutGenerator_(NULL), numberUserFunctions_(0), numberCutGenerators_(0), startTime_(CoinCpuTime()), parameters_(NULL), numberParameters_(0), doMiplib_(false), noPrinting_(false), readMode_(1) { callBack_ = new CbcStopNow(); fillParameters(); } CbcSolver::CbcSolver(const OsiClpSolverInterface & solver) : babModel_(NULL), userFunction_(NULL), statusUserFunction_(NULL), originalSolver_(NULL), originalCoinModel_(NULL), cutGenerator_(NULL), numberUserFunctions_(0), numberCutGenerators_(0), startTime_(CoinCpuTime()), parameters_(NULL), numberParameters_(0), doMiplib_(false), noPrinting_(false), readMode_(1) { callBack_ = new CbcStopNow(); model_ = CbcModel(solver); fillParameters(); } CbcSolver::CbcSolver(const CbcModel & solver) : babModel_(NULL), userFunction_(NULL), statusUserFunction_(NULL), originalSolver_(NULL), originalCoinModel_(NULL), cutGenerator_(NULL), numberUserFunctions_(0), numberCutGenerators_(0), startTime_(CoinCpuTime()), parameters_(NULL), numberParameters_(0), doMiplib_(false), noPrinting_(false), readMode_(1) { callBack_ = new CbcStopNow(); model_ = solver; fillParameters(); } CbcSolver::~CbcSolver() { int i; for (i = 0; i < numberUserFunctions_; i++) delete userFunction_[i]; delete [] userFunction_; for (i = 0; i < numberCutGenerators_; i++) delete cutGenerator_[i]; delete [] cutGenerator_; delete [] statusUserFunction_; delete originalSolver_; delete originalCoinModel_; delete babModel_; delete [] parameters_; delete callBack_; } // Copy constructor CbcSolver::CbcSolver ( const CbcSolver & rhs) : model_(rhs.model_), babModel_(NULL), userFunction_(NULL), statusUserFunction_(NULL), numberUserFunctions_(rhs.numberUserFunctions_), startTime_(CoinCpuTime()), parameters_(NULL), numberParameters_(rhs.numberParameters_), doMiplib_(rhs.doMiplib_), noPrinting_(rhs.noPrinting_), readMode_(rhs.readMode_) { fillParameters(); if (rhs.babModel_) babModel_ = new CbcModel(*rhs.babModel_); userFunction_ = new CbcUser * [numberUserFunctions_]; int i; for (i = 0; i < numberUserFunctions_; i++) userFunction_[i] = rhs.userFunction_[i]->clone(); for (i = 0; i < numberParameters_; i++) parameters_[i] = rhs.parameters_[i]; for (i = 0; i < numberCutGenerators_; i++) cutGenerator_[i] = rhs.cutGenerator_[i]->clone(); callBack_ = rhs.callBack_->clone(); originalSolver_ = NULL; if (rhs.originalSolver_) { OsiSolverInterface * temp = rhs.originalSolver_->clone(); originalSolver_ = dynamic_cast (temp); assert (originalSolver_); } originalCoinModel_ = NULL; if (rhs.originalCoinModel_) originalCoinModel_ = new CoinModel(*rhs.originalCoinModel_); } // Assignment operator CbcSolver & CbcSolver::operator=(const CbcSolver & rhs) { if (this != &rhs) { int i; for (i = 0; i < numberUserFunctions_; i++) delete userFunction_[i]; delete [] userFunction_; for (i = 0; i < numberCutGenerators_; i++) delete cutGenerator_[i]; delete [] statusUserFunction_; delete originalSolver_; delete originalCoinModel_; statusUserFunction_ = NULL; delete babModel_; delete callBack_; numberUserFunctions_ = rhs.numberUserFunctions_; startTime_ = rhs.startTime_; numberParameters_ = rhs.numberParameters_; for (i = 0; i < numberParameters_; i++) parameters_[i] = rhs.parameters_[i]; for (i = 0; i < numberCutGenerators_; i++) cutGenerator_[i] = rhs.cutGenerator_[i]->clone(); noPrinting_ = rhs.noPrinting_; readMode_ = rhs.readMode_; doMiplib_ = rhs.doMiplib_; model_ = rhs.model_; if (rhs.babModel_) babModel_ = new CbcModel(*rhs.babModel_); else babModel_ = NULL; userFunction_ = new CbcUser * [numberUserFunctions_]; for (i = 0; i < numberUserFunctions_; i++) userFunction_[i] = rhs.userFunction_[i]->clone(); callBack_ = rhs.callBack_->clone(); originalSolver_ = NULL; if (rhs.originalSolver_) { OsiSolverInterface * temp = rhs.originalSolver_->clone(); originalSolver_ = dynamic_cast (temp); assert (originalSolver_); } originalCoinModel_ = NULL; if (rhs.originalCoinModel_) originalCoinModel_ = new CoinModel(*rhs.originalCoinModel_); } return *this; } // Get int value int CbcSolver::intValue(CbcOrClpParameterType type) const { return parameters_[whichParam(type, numberParameters_, parameters_)].intValue(); } // Set int value void CbcSolver::setIntValue(CbcOrClpParameterType type, int value) { parameters_[whichParam(type, numberParameters_, parameters_)].setIntValue(value); } // Get double value double CbcSolver::doubleValue(CbcOrClpParameterType type) const { return parameters_[whichParam(type, numberParameters_, parameters_)].doubleValue(); } // Set double value void CbcSolver::setDoubleValue(CbcOrClpParameterType type, double value) { parameters_[whichParam(type, numberParameters_, parameters_)].setDoubleValue(value); } // User function (NULL if no match) CbcUser * CbcSolver::userFunction(const char * name) const { int i; for (i = 0; i < numberUserFunctions_; i++) { if (!strcmp(name, userFunction_[i]->name().c_str())) break; } if (i < numberUserFunctions_) return userFunction_[i]; else return NULL; } void CbcSolver::fillParameters() { int maxParam = 200; CbcOrClpParam * parameters = new CbcOrClpParam [maxParam]; numberParameters_ = 0 ; establishParams(numberParameters_, parameters) ; assert (numberParameters_ <= maxParam); parameters_ = new CbcOrClpParam [numberParameters_]; int i; for (i = 0; i < numberParameters_; i++) parameters_[i] = parameters[i]; delete [] parameters; const char dirsep = CoinFindDirSeparator(); std::string directory; std::string dirSample; std::string dirNetlib; std::string dirMiplib; if (dirsep == '/') { directory = "./"; dirSample = "../../Data/Sample/"; dirNetlib = "../../Data/Netlib/"; dirMiplib = "../../Data/miplib3/"; } else { directory = ".\\"; dirSample = "..\\..\\..\\..\\Data\\Sample\\"; dirNetlib = "..\\..\\..\\..\\Data\\Netlib\\"; dirMiplib = "..\\..\\..\\..\\Data\\miplib3\\"; } std::string defaultDirectory = directory; std::string importFile = ""; std::string exportFile = "default.mps"; std::string importBasisFile = ""; std::string importPriorityFile = ""; std::string mipStartFile = ""; std::string debugFile = ""; std::string printMask = ""; std::string exportBasisFile = "default.bas"; std::string saveFile = "default.prob"; std::string restoreFile = "default.prob"; std::string solutionFile = "stdout"; std::string solutionSaveFile = "solution.file"; int doIdiot = -1; int outputFormat = 2; int substitution = 3; int dualize = 3; int preSolve = 5; int doSprint = -1; int testOsiParameters = -1; int createSolver = 0; ClpSimplex * lpSolver; OsiClpSolverInterface * clpSolver; if (model_.solver()) { clpSolver = dynamic_cast (model_.solver()); assert (clpSolver); lpSolver = clpSolver->getModelPtr(); assert (lpSolver); } else { lpSolver = new ClpSimplex(); clpSolver = new OsiClpSolverInterface(lpSolver, true); createSolver = 1 ; } parameters_[whichParam(CLP_PARAM_ACTION_BASISIN, numberParameters_, parameters_)].setStringValue(importBasisFile); parameters_[whichParam(CBC_PARAM_ACTION_PRIORITYIN, numberParameters_, parameters_)].setStringValue(importPriorityFile); parameters_[whichParam(CBC_PARAM_ACTION_MIPSTART, numberParameters_, parameters_)].setStringValue(mipStartFile); parameters_[whichParam(CLP_PARAM_ACTION_BASISOUT, numberParameters_, parameters_)].setStringValue(exportBasisFile); parameters_[whichParam(CLP_PARAM_ACTION_DEBUG, numberParameters_, parameters_)].setStringValue(debugFile); parameters_[whichParam(CLP_PARAM_ACTION_PRINTMASK, numberParameters_, parameters_)].setStringValue(printMask); parameters_[whichParam(CLP_PARAM_ACTION_DIRECTORY, numberParameters_, parameters_)].setStringValue(directory); parameters_[whichParam(CLP_PARAM_ACTION_DIRSAMPLE, numberParameters_, parameters_)].setStringValue(dirSample); parameters_[whichParam(CLP_PARAM_ACTION_DIRNETLIB, numberParameters_, parameters_)].setStringValue(dirNetlib); parameters_[whichParam(CBC_PARAM_ACTION_DIRMIPLIB, numberParameters_, parameters_)].setStringValue(dirMiplib); parameters_[whichParam(CLP_PARAM_DBL_DUALBOUND, numberParameters_, parameters_)].setDoubleValue(lpSolver->dualBound()); parameters_[whichParam(CLP_PARAM_DBL_DUALTOLERANCE, numberParameters_, parameters_)].setDoubleValue(lpSolver->dualTolerance()); parameters_[whichParam(CLP_PARAM_ACTION_EXPORT, numberParameters_, parameters_)].setStringValue(exportFile); parameters_[whichParam(CLP_PARAM_INT_IDIOT, numberParameters_, parameters_)].setIntValue(doIdiot); parameters_[whichParam(CLP_PARAM_ACTION_IMPORT, numberParameters_, parameters_)].setStringValue(importFile); parameters_[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters_, parameters_)].setDoubleValue(1.0e-8); int iParam = whichParam(CLP_PARAM_INT_SOLVERLOGLEVEL, numberParameters_, parameters_); int value = 1; clpSolver->messageHandler()->setLogLevel(1) ; lpSolver->setLogLevel(1); parameters_[iParam].setIntValue(value); iParam = whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters_, parameters_); model_.messageHandler()->setLogLevel(value); parameters_[iParam].setIntValue(value); parameters_[whichParam(CLP_PARAM_INT_MAXFACTOR, numberParameters_, parameters_)].setIntValue(lpSolver->factorizationFrequency()); parameters_[whichParam(CLP_PARAM_INT_MAXITERATION, numberParameters_, parameters_)].setIntValue(lpSolver->maximumIterations()); parameters_[whichParam(CLP_PARAM_INT_OUTPUTFORMAT, numberParameters_, parameters_)].setIntValue(outputFormat); parameters_[whichParam(CLP_PARAM_INT_PRESOLVEPASS, numberParameters_, parameters_)].setIntValue(preSolve); parameters_[whichParam(CLP_PARAM_INT_PERTVALUE, numberParameters_, parameters_)].setIntValue(lpSolver->perturbation()); parameters_[whichParam(CLP_PARAM_DBL_PRIMALTOLERANCE, numberParameters_, parameters_)].setDoubleValue(lpSolver->primalTolerance()); parameters_[whichParam(CLP_PARAM_DBL_PRIMALWEIGHT, numberParameters_, parameters_)].setDoubleValue(lpSolver->infeasibilityCost()); parameters_[whichParam(CLP_PARAM_ACTION_RESTORE, numberParameters_, parameters_)].setStringValue(restoreFile); parameters_[whichParam(CLP_PARAM_ACTION_SAVE, numberParameters_, parameters_)].setStringValue(saveFile); //parameters_[whichParam(CLP_PARAM_DBL_TIMELIMIT,numberParameters_,parameters_)].setDoubleValue(1.0e8); parameters_[whichParam(CBC_PARAM_DBL_TIMELIMIT_BAB, numberParameters_, parameters_)].setDoubleValue(1.0e8); parameters_[whichParam(CLP_PARAM_ACTION_SOLUTION, numberParameters_, parameters_)].setStringValue(solutionFile); parameters_[whichParam(CLP_PARAM_ACTION_NEXTBESTSOLUTION, numberParameters_, parameters_)].setStringValue(solutionFile); parameters_[whichParam(CLP_PARAM_ACTION_SAVESOL, numberParameters_, parameters_)].setStringValue(solutionSaveFile); parameters_[whichParam(CLP_PARAM_INT_SPRINT, numberParameters_, parameters_)].setIntValue(doSprint); parameters_[whichParam(CLP_PARAM_INT_SUBSTITUTION, numberParameters_, parameters_)].setIntValue(substitution); parameters_[whichParam(CLP_PARAM_INT_DUALIZE, numberParameters_, parameters_)].setIntValue(dualize); parameters_[whichParam(CBC_PARAM_INT_NUMBERBEFORE, numberParameters_, parameters_)].setIntValue(model_.numberBeforeTrust()); parameters_[whichParam(CBC_PARAM_INT_MAXNODES, numberParameters_, parameters_)].setIntValue(model_.getMaximumNodes()); parameters_[whichParam(CBC_PARAM_INT_STRONGBRANCHING, numberParameters_, parameters_)].setIntValue(model_.numberStrong()); parameters_[whichParam(CBC_PARAM_DBL_INFEASIBILITYWEIGHT, numberParameters_, parameters_)].setDoubleValue(model_.getDblParam(CbcModel::CbcInfeasibilityWeight)); parameters_[whichParam(CBC_PARAM_DBL_INTEGERTOLERANCE, numberParameters_, parameters_)].setDoubleValue(model_.getDblParam(CbcModel::CbcIntegerTolerance)); parameters_[whichParam(CBC_PARAM_DBL_INCREMENT, numberParameters_, parameters_)].setDoubleValue(model_.getDblParam(CbcModel::CbcCutoffIncrement)); parameters_[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters_, parameters_)].setIntValue(testOsiParameters); parameters_[whichParam(CBC_PARAM_INT_FPUMPTUNE, numberParameters_, parameters_)].setIntValue(1003); initialPumpTune = 1003; #ifdef CBC_THREAD parameters_[whichParam(CBC_PARAM_INT_THREADS, numberParameters_, parameters_)].setIntValue(0); #endif // Set up likely cut generators and defaults parameters_[whichParam(CBC_PARAM_STR_PREPROCESS, numberParameters_, parameters_)].setCurrentOption("sos"); parameters_[whichParam(CBC_PARAM_INT_MIPOPTIONS, numberParameters_, parameters_)].setIntValue(1057); parameters_[whichParam(CBC_PARAM_INT_CUTPASSINTREE, numberParameters_, parameters_)].setIntValue(1); parameters_[whichParam(CBC_PARAM_INT_MOREMIPOPTIONS, numberParameters_, parameters_)].setIntValue(-1); parameters_[whichParam(CBC_PARAM_INT_MAXHOTITS, numberParameters_, parameters_)].setIntValue(100); parameters_[whichParam(CBC_PARAM_STR_CUTSSTRATEGY, numberParameters_, parameters_)].setCurrentOption("on"); parameters_[whichParam(CBC_PARAM_STR_HEURISTICSTRATEGY, numberParameters_, parameters_)].setCurrentOption("on"); parameters_[whichParam(CBC_PARAM_STR_NODESTRATEGY, numberParameters_, parameters_)].setCurrentOption("fewest"); parameters_[whichParam(CBC_PARAM_STR_GOMORYCUTS, numberParameters_, parameters_)].setCurrentOption("ifmove"); parameters_[whichParam(CBC_PARAM_STR_PROBINGCUTS, numberParameters_, parameters_)].setCurrentOption("ifmove"); parameters_[whichParam(CBC_PARAM_STR_KNAPSACKCUTS, numberParameters_, parameters_)].setCurrentOption("ifmove"); parameters_[whichParam(CBC_PARAM_STR_ZEROHALFCUTS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_REDSPLITCUTS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_REDSPLIT2CUTS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_GMICUTS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_CLIQUECUTS, numberParameters_, parameters_)].setCurrentOption("ifmove"); parameters_[whichParam(CBC_PARAM_STR_MIXEDCUTS, numberParameters_, parameters_)].setCurrentOption("ifmove"); parameters_[whichParam(CBC_PARAM_STR_FLOWCUTS, numberParameters_, parameters_)].setCurrentOption("ifmove"); parameters_[whichParam(CBC_PARAM_STR_TWOMIRCUTS, numberParameters_, parameters_)].setCurrentOption("ifmove"); parameters_[whichParam(CBC_PARAM_STR_LANDPCUTS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_RESIDCUTS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_ROUNDING, numberParameters_, parameters_)].setCurrentOption("on"); parameters_[whichParam(CBC_PARAM_STR_FPUMP, numberParameters_, parameters_)].setCurrentOption("on"); parameters_[whichParam(CBC_PARAM_STR_GREEDY, numberParameters_, parameters_)].setCurrentOption("on"); parameters_[whichParam(CBC_PARAM_STR_COMBINE, numberParameters_, parameters_)].setCurrentOption("on"); parameters_[whichParam(CBC_PARAM_STR_CROSSOVER2, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_PIVOTANDCOMPLEMENT, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_PIVOTANDFIX, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_RANDROUND, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_NAIVE, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_RINS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_DINS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_RENS, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_LOCALTREE, numberParameters_, parameters_)].setCurrentOption("off"); parameters_[whichParam(CBC_PARAM_STR_COSTSTRATEGY, numberParameters_, parameters_)].setCurrentOption("off"); if (createSolver) delete clpSolver; } /* Initialise a subset of the parameters prior to processing any input from the user. Why this choice of subset? */ /*! \todo Guard/replace clp-specific code */ void CbcSolver::fillValuesInSolver() { OsiSolverInterface * solver = model_.solver(); OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); assert (clpSolver); ClpSimplex * lpSolver = clpSolver->getModelPtr(); /* Why are we reaching into the underlying solver(s) for these settings? Shouldn't CbcSolver have its own defaults, which are then imposed on the underlying solver? Coming at if from the other side, if CbcSolver had the capability to use multiple solvers then it definitely makes sense to acquire the defaults from the solver (on the assumption that we haven't processed command line parameters yet, which can then override the defaults). But then it's more of a challenge to avoid solver-specific coding here. */ noPrinting_ = (lpSolver->logLevel() == 0); CoinMessageHandler * generalMessageHandler = clpSolver->messageHandler(); generalMessageHandler->setPrefix(true); lpSolver->setPerturbation(50); lpSolver->messageHandler()->setPrefix(false); parameters_[whichParam(CLP_PARAM_DBL_DUALBOUND, numberParameters_, parameters_)].setDoubleValue(lpSolver->dualBound()); parameters_[whichParam(CLP_PARAM_DBL_DUALTOLERANCE, numberParameters_, parameters_)].setDoubleValue(lpSolver->dualTolerance()); /* Why are we doing this? We read the log level from parameters_, set it into the message handlers for cbc and the underlying solver. Then we read the log level back from the handlers and use it to set the values in parameters_! */ int iParam = whichParam(CLP_PARAM_INT_SOLVERLOGLEVEL, numberParameters_, parameters_); int value = parameters_[iParam].intValue(); clpSolver->messageHandler()->setLogLevel(value) ; lpSolver->setLogLevel(value); iParam = whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters_, parameters_); value = parameters_[iParam].intValue(); model_.messageHandler()->setLogLevel(value); parameters_[whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters_, parameters_)].setIntValue(model_.logLevel()); parameters_[whichParam(CLP_PARAM_INT_SOLVERLOGLEVEL, numberParameters_, parameters_)].setIntValue(lpSolver->logLevel()); parameters_[whichParam(CLP_PARAM_INT_MAXFACTOR, numberParameters_, parameters_)].setIntValue(lpSolver->factorizationFrequency()); parameters_[whichParam(CLP_PARAM_INT_MAXITERATION, numberParameters_, parameters_)].setIntValue(lpSolver->maximumIterations()); parameters_[whichParam(CLP_PARAM_INT_PERTVALUE, numberParameters_, parameters_)].setIntValue(lpSolver->perturbation()); parameters_[whichParam(CLP_PARAM_DBL_PRIMALTOLERANCE, numberParameters_, parameters_)].setDoubleValue(lpSolver->primalTolerance()); parameters_[whichParam(CLP_PARAM_DBL_PRIMALWEIGHT, numberParameters_, parameters_)].setDoubleValue(lpSolver->infeasibilityCost()); parameters_[whichParam(CBC_PARAM_INT_NUMBERBEFORE, numberParameters_, parameters_)].setIntValue(model_.numberBeforeTrust()); parameters_[whichParam(CBC_PARAM_INT_MAXNODES, numberParameters_, parameters_)].setIntValue(model_.getMaximumNodes()); parameters_[whichParam(CBC_PARAM_INT_STRONGBRANCHING, numberParameters_, parameters_)].setIntValue(model_.numberStrong()); parameters_[whichParam(CBC_PARAM_DBL_INFEASIBILITYWEIGHT, numberParameters_, parameters_)].setDoubleValue(model_.getDblParam(CbcModel::CbcInfeasibilityWeight)); parameters_[whichParam(CBC_PARAM_DBL_INTEGERTOLERANCE, numberParameters_, parameters_)].setDoubleValue(model_.getDblParam(CbcModel::CbcIntegerTolerance)); parameters_[whichParam(CBC_PARAM_DBL_INCREMENT, numberParameters_, parameters_)].setDoubleValue(model_.getDblParam(CbcModel::CbcCutoffIncrement)); } // Add user function void CbcSolver::addUserFunction(CbcUser * function) { CbcUser ** temp = new CbcUser * [numberUserFunctions_+1]; int i; for (i = 0; i < numberUserFunctions_; i++) temp[i] = userFunction_[i]; delete [] userFunction_; userFunction_ = temp; userFunction_[numberUserFunctions_++] = function->clone(); delete [] statusUserFunction_; statusUserFunction_ = NULL; } // Set user call back void CbcSolver::setUserCallBack(CbcStopNow * function) { delete callBack_; callBack_ = function->clone(); } // Copy of model on initial load (will contain output solutions) void CbcSolver::setOriginalSolver(OsiClpSolverInterface * originalSolver) { delete originalSolver_; OsiSolverInterface * temp = originalSolver->clone(); originalSolver_ = dynamic_cast (temp); assert (originalSolver_); } // Copy of model on initial load void CbcSolver::setOriginalCoinModel(CoinModel * originalCoinModel) { delete originalCoinModel_; originalCoinModel_ = new CoinModel(*originalCoinModel); } // Add cut generator void CbcSolver::addCutGenerator(CglCutGenerator * generator) { CglCutGenerator ** temp = new CglCutGenerator * [numberCutGenerators_+1]; int i; for (i = 0; i < numberCutGenerators_; i++) temp[i] = cutGenerator_[i]; delete [] cutGenerator_; cutGenerator_ = temp; cutGenerator_[numberCutGenerators_++] = generator->clone(); } /* The only other solver that's ever been used is cplex, and the use is limited -- do the root with clp and all the cbc smarts, then give the problem over to cplex to finish. Although the defines can be read in some places to allow other options, nothing's been tested and success is unlikely. CBC_OTHER_SOLVER == 1 is cplex. */ #if CBC_OTHER_SOLVER==1 # ifndef COIN_HAS_CPX # error "Configuration did not detect cplex installation." # else # include "OsiCpxSolverInterface.hpp" # endif #endif #ifdef COIN_HAS_ASL #include "Cbc_ampl.h" #endif static void statistics(ClpSimplex * originalModel, ClpSimplex * model); static bool maskMatches(const int * starts, char ** masks, std::string & check); static void generateCode(CbcModel * model, const char * fileName, int type, int preProcess); // dummy fake main programs for UserClp and UserCbc void fakeMain (ClpSimplex & model, OsiSolverInterface & osiSolver, CbcModel & babSolver); void fakeMain2 (ClpSimplex & model, OsiClpSolverInterface & osiSolver, int options); // Allow for interrupts // But is this threadsafe? (so switched off by option) #include "CoinSignal.hpp" static CbcModel * currentBranchModel = NULL; extern "C" { static void signal_handler(int whichSignal) { if (currentBranchModel != NULL) { currentBranchModel->sayEventHappened(); // say why stopped if (currentBranchModel->heuristicModel()) currentBranchModel->heuristicModel()->sayEventHappened(); } return; } } //#define CBC_SIG_TRAP #ifdef CBC_SIG_TRAP #include static sigjmp_buf cbc_seg_buffer; extern "C" { static void signal_handler_error(int whichSignal) { siglongjmp(cbc_seg_buffer, 1); } } #endif /* Debug checks on special ordered sets. This is active only for debugging. The entire body of the routine becomes a noop when COIN_DEVELOP is not defined. To avoid compiler warnings, the formal parameters also need to go away. */ #ifdef COIN_DEVELOP void checkSOS(CbcModel * babModel, const OsiSolverInterface * solver) #else void checkSOS(CbcModel * /*babModel*/, const OsiSolverInterface * /*solver*/) #endif { #ifdef COIN_DEVELOP if (!babModel->ownObjects()) return; #if COIN_DEVELOP>2 //const double *objective = solver->getObjCoefficients() ; const double *columnLower = solver->getColLower() ; const double * columnUpper = solver->getColUpper() ; const double * solution = solver->getColSolution(); //int numberRows = solver->getNumRows(); //double direction = solver->getObjSense(); //int iRow,iColumn; #endif // Row copy CoinPackedMatrix matrixByRow(*solver->getMatrixByRow()); //const double * elementByRow = matrixByRow.getElements(); //const int * column = matrixByRow.getIndices(); //const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); // Column copy CoinPackedMatrix matrixByCol(*solver->getMatrixByCol()); const double * element = matrixByCol.getElements(); const int * row = matrixByCol.getIndices(); const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol.getVectorLengths(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); OsiObject ** objects = babModel->objects(); int numberObjects = babModel->numberObjects(); int numberColumns = solver->getNumCols() ; for (int iObj = 0; iObj < numberObjects; iObj++) { CbcSOS * objSOS = dynamic_cast (objects[iObj]) ; if (objSOS) { int n = objSOS->numberMembers(); const int * which = objSOS->members(); #if COIN_DEVELOP>2 const double * weight = objSOS->weights(); #endif int type = objSOS->sosType(); // convexity row? int iColumn; iColumn = which[0]; int j; int convex = -1; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j]; if (rowLower[iRow] == 1.0 && rowUpper[iRow] == 1.0 && value == 1.0) { // possible if (rowLength[iRow] == n) { if (convex == -1) convex = iRow; else convex = -2; } } } printf ("set %d of type %d has %d members - possible convexity row %d\n", iObj, type, n, convex); for (int i = 0; i < n; i++) { iColumn = which[i]; // Column may have been added if (iColumn < numberColumns) { int convex2 = -1; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (iRow == convex) { double value = element[j]; if (value == 1.0) { convex2 = iRow; } } } if (convex2<0 && convex >= 0) { printf("odd convexity row\n"); convex = -2; } #if COIN_DEVELOP>2 printf("col %d has weight %g and value %g, bounds %g %g\n", iColumn, weight[i], solution[iColumn], columnLower[iColumn], columnUpper[iColumn]); #endif } } } } #endif // COIN_DEVELOP } static int dummyCallBack(CbcModel * /*model*/, int /*whereFrom*/) { return 0; } /* Global parameters for command processing. These will need to be moved into an object of some sort in order to make this set of calls thread-safe. */ int CbcOrClpRead_mode = 1; FILE * CbcOrClpReadCommand = stdin; extern int CbcOrClpEnvironmentIndex; int callCbc1(const char * input2, CbcModel & model, int callBack(CbcModel * currentSolver, int whereFrom), CbcSolverUsefulData & parameterData); /* Wrappers for CbcMain0, CbcMain1. The various forms of callCbc will eventually resolve to a call to CbcMain0 followed by a call to callCbc1. */ /* Simplest calling form: supply just a string with the command options. The wrapper creates an OsiClpSolverInterface and calls the next wrapper. */ int callCbc(const std::string input2) { char * input3 = CoinStrdup(input2.c_str()); OsiClpSolverInterface solver1; int returnCode = callCbc(input3, solver1); free(input3); return returnCode; } int callCbc(const char * input2) { { OsiClpSolverInterface solver1; return callCbc(input2, solver1); } } /* Second calling form: supply the command line and an OsiClpSolverInterface. the wrapper will create a CbcModel and call the next wrapper. */ int callCbc(const std::string input2, OsiClpSolverInterface& solver1) { char * input3 = CoinStrdup(input2.c_str()); int returnCode = callCbc(input3, solver1); free(input3); return returnCode; } int callCbc(const char * input2, OsiClpSolverInterface& solver1) { CbcModel model(solver1); return callCbc(input2, model); } /* Third calling form: supply the command line and a CbcModel. This wrapper will actually call CbcMain0 and then call the next set of wrappers (callCbc1) to handle the call to CbcMain1. */ int callCbc(const char * input2, CbcModel & babSolver) { CbcSolverUsefulData data; #ifndef CBC_NO_INTERRUPT data.useSignalHandler_=true; #endif #ifndef CBC_NO_PRINTING data.noPrinting_ = false; #endif CbcMain0(babSolver, data); return callCbc1(input2, babSolver, dummyCallBack, data); } int callCbc(const std::string input2, CbcModel & babSolver) { char * input3 = CoinStrdup(input2.c_str()); CbcMain0(babSolver); int returnCode = callCbc1(input3, babSolver); free(input3); return returnCode; } /* Various overloads of callCbc1. The first pair accepts just a CbcModel and supplements it with a dummy callback routine. The second pair allows the user to supply a callback. See CbcMain1 for further explanation of the callback. The various overloads of callCbc1 resolve to the final version, which breaks the string into individual parameter strings (i.e., creates something that looks like a standard argv vector). */ int callCbc1(const std::string input2, CbcModel & babSolver) { char * input3 = CoinStrdup(input2.c_str()); int returnCode = callCbc1(input3, babSolver); free(input3); return returnCode; } int callCbc1(const char * input2, CbcModel & model) { return callCbc1(input2, model, dummyCallBack); } int callCbc1(const std::string input2, CbcModel & babSolver, int callBack(CbcModel * currentSolver, int whereFrom)) { char * input3 = CoinStrdup(input2.c_str()); int returnCode = callCbc1(input3, babSolver, callBack); free(input3); return returnCode; } int callCbc1(const char * input2, CbcModel & model, int callBack(CbcModel * currentSolver, int whereFrom), CbcSolverUsefulData & parameterData) { char * input = CoinStrdup(input2 ? input2 : "") ; size_t length = strlen(input); bool blank = input[0] == ' '; int n = blank ? 0 : 1; for (size_t i = 0; i < length; i++) { if (blank) { // look for next non blank if (input[i] == ' ') { continue; } else { n++; blank = false; } } else { // look for next blank if (input[i] != ' ') { continue; } else { blank = true; } } } char ** argv = new char * [n+2]; argv[0] = CoinStrdup("cbc"); size_t i = 0; while (input[i] == ' ') i++; for (int j = 0; j < n; j++) { size_t saveI = i; for (; i < length; i++) { // look for next blank if (input[i] != ' ') { continue; } else { break; } } input[i++] = '\0'; argv[j+1] = CoinStrdup(input + saveI); while (input[i] == ' ') i++; } argv[n+1] = CoinStrdup("-quit"); free(input); currentBranchModel = NULL; CbcOrClpRead_mode = 1; CbcOrClpReadCommand = stdin; int returnCode = CbcMain1(n + 2, const_cast(argv), model, callBack,parameterData); for (int k = 0; k < n + 2; k++) free(argv[k]); delete [] argv; return returnCode; } static CbcSolverUsefulData staticParameterData; int callCbc1(const char * input2, CbcModel & model, int callBack(CbcModel * currentSolver, int whereFrom)) { // allow interrupts and printing #ifndef CBC_NO_INTERRUPT staticParameterData.useSignalHandler_=true; #endif #ifndef CBC_NO_PRINTING staticParameterData.noPrinting_ = false; #endif return callCbc1(input2,model,callBack,staticParameterData); } CglPreProcess * cbcPreProcessPointer=NULL; int CbcClpUnitTest (const CbcModel & saveModel, const std::string& dirMiplib, int testSwitch, const double * stuff); int CbcMain1 (int argc, const char *argv[], CbcModel & model) { return CbcMain1(argc, argv, model, dummyCallBack); } #ifdef CBC_THREAD_SAFE // Copies of some input decoding static std::string CoinReadGetCommand(int &whichArgument, int argc, const char *argv[]) { std::string field; if (whichArgument < argc) field = argv[whichArgument++]; else field = "quit"; if (field[0] == '-') field = field.substr(1); return field; } static std::string CoinReadGetString(int &whichArgument, int argc, const char *argv[]) { std::string field; if (whichArgument < argc) field = argv[whichArgument++]; else field = ""; return field; } // valid 0 - okay, 1 bad, 2 not there static int CoinReadGetIntField(int &whichArgument, int argc, const char *argv[], int * valid) { std::string field; if (whichArgument < argc) field = argv[whichArgument++]; else field = "0"; long int value = 0; const char * start = field.c_str(); char * endPointer = NULL; // check valid value = strtol(start, &endPointer, 10); if (*endPointer == '\0') { *valid = 0; } else { *valid = 1; std::cout << "String of " << field; } return static_cast(value); } static double CoinReadGetDoubleField(int &whichArgument, int argc, const char *argv[], int * valid) { std::string field; if (whichArgument < argc) field = argv[whichArgument++]; else field = "0.0"; double value = 0.0; const char * start = field.c_str(); char * endPointer = NULL; // check valid value = strtod(start, &endPointer); if (*endPointer == '\0') { *valid = 0; } else { *valid = 1; std::cout << "String of " << field; } return value; } // Redefine all #define CoinReadGetCommand(x,y) CoinReadGetCommand(whichArgument,x,y) #define CoinReadGetString(x,y) CoinReadGetString(whichArgument,x,y) #define CoinReadGetIntField(x,y,z) CoinReadGetIntField(whichArgument,x,y,z) #define CoinReadGetDoubleField(x,y,z) CoinReadGetDoubleField(whichArgument,x,y,z) #endif // Default Constructor CbcSolverUsefulData::CbcSolverUsefulData() { totalTime_ = 0.0; noPrinting_ = true; useSignalHandler_ = false; establishParams(numberParameters_,parameters_); } /* Copy constructor . */ CbcSolverUsefulData::CbcSolverUsefulData(const CbcSolverUsefulData & rhs) { totalTime_ = rhs.totalTime_; noPrinting_ = rhs.noPrinting_; useSignalHandler_ = rhs.useSignalHandler_; numberParameters_ = rhs.numberParameters_; memcpy(parameters_,rhs.parameters_,sizeof(parameters_)); } // Assignment operator CbcSolverUsefulData & CbcSolverUsefulData::operator=(const CbcSolverUsefulData& rhs) { if (this != &rhs) { totalTime_ = rhs.totalTime_; noPrinting_ = rhs.noPrinting_; useSignalHandler_ = rhs.useSignalHandler_; numberParameters_ = rhs.numberParameters_; memcpy(parameters_,rhs.parameters_,sizeof(parameters_)); } return *this; } // Destructor CbcSolverUsefulData::~CbcSolverUsefulData () { } /* Meaning of whereFrom: 1 after initial solve by dualsimplex etc 2 after preprocessing 3 just before branchAndBound (so user can override) 4 just after branchAndBound (before postprocessing) 5 after postprocessing 6 after a user called heuristic phase */ int CbcMain1 (int argc, const char *argv[], CbcModel & model, int callBack(CbcModel * currentSolver, int whereFrom)) { // allow interrupts and printing staticParameterData.noPrinting_ = false; staticParameterData.useSignalHandler_=true; return CbcMain1(argc,argv,model,callBack,staticParameterData); } static void printGeneralMessage(CbcModel &model,const char * message); /* Meaning of whereFrom: 1 after initial solve by dualsimplex etc 2 after preprocessing 3 just before branchAndBound (so user can override) 4 just after branchAndBound (before postprocessing) 5 after postprocessing 6 after a user called heuristic phase */ int CbcMain1 (int argc, const char *argv[], CbcModel & model, int callBack(CbcModel * currentSolver, int whereFrom), CbcSolverUsefulData & parameterData) { CbcOrClpParam * parameters_ = parameterData.parameters_; int numberParameters_ = parameterData.numberParameters_; double totalTime = parameterData.totalTime_; bool noPrinting = parameterData.noPrinting_; bool useSignalHandler = parameterData.useSignalHandler_; CbcModel & model_ = model; #ifdef CBC_THREAD_SAFE // Initialize argument int whichArgument=1; #endif #ifdef CBC_USE_INITIAL_TIME if (model_.useElapsedTime()) model_.setDblParam(CbcModel::CbcStartSeconds, CoinGetTimeOfDay()); else model_.setDblParam(CbcModel::CbcStartSeconds, CoinCpuTime()); #endif CbcModel * babModel_ = NULL; int returnMode = 1; CbcOrClpRead_mode = 1; int statusUserFunction_[1]; int numberUserFunctions_ = 1; // to allow for ampl // Statistics double statistics_seconds = 0.0, statistics_obj = 0.0; double statistics_sys_seconds = 0.0, statistics_elapsed_seconds = 0.0; CoinWallclockTime(); double statistics_continuous = 0.0, statistics_tighter = 0.0; double statistics_cut_time = 0.0; int statistics_nodes = 0, statistics_iterations = 0; int statistics_nrows = 0, statistics_ncols = 0; int statistics_nprocessedrows = 0, statistics_nprocessedcols = 0; std::string statistics_result; int * statistics_number_cuts = NULL; const char ** statistics_name_generators = NULL; int statistics_number_generators = 0; memset(statusUserFunction_, 0, numberUserFunctions_*sizeof(int)); /* Note This is meant as a stand-alone executable to do as much of coin as possible. It should only have one solver known to it. */ CoinMessageHandler * generalMessageHandler = model_.messageHandler(); generalMessageHandler->setPrefix(false); #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * originalSolver = dynamic_cast (model_.solver()); assert (originalSolver); // Move handler across if not default if (!originalSolver->defaultHandler() && originalSolver->getModelPtr()->defaultHandler()) originalSolver->getModelPtr()->passInMessageHandler(originalSolver->messageHandler()); CoinMessages generalMessages = originalSolver->getModelPtr()->messages(); char generalPrint[10000]; if (originalSolver->getModelPtr()->logLevel() == 0) noPrinting = true; #elif CBC_OTHER_SOLVER==1 OsiCpxSolverInterface * originalSolver = dynamic_cast (model_.solver()); assert (originalSolver); OsiClpSolverInterface dummySolver; OsiCpxSolverInterface * clpSolver = originalSolver; CoinMessages generalMessages = dummySolver.getModelPtr()->messages(); char generalPrint[10000]; noPrinting = true; #endif bool noPrinting_ = noPrinting; // Say not in integer int integerStatus = -1; // Say no resolve after cuts model_.setResolveAfterTakeOffCuts(false); // see if log in list for (int i = 1; i < argc; i++) { if (!strncmp(argv[i], "log", 3)) { const char * equals = strchr(argv[i], '='); if (equals && atoi(equals + 1) != 0) noPrinting_ = false; else noPrinting_ = true; break; } else if (!strncmp(argv[i], "-log", 4) && i < argc - 1) { if (atoi(argv[i+1]) != 0) noPrinting_ = false; else noPrinting_ = true; break; } } double time0; double time0Elapsed = CoinGetTimeOfDay(); { double time1 = CoinCpuTime(), time2; time0 = time1; double time1Elapsed = time0Elapsed; bool goodModel = (originalSolver->getNumCols()) ? true : false; // register signal handler //CoinSighandler_t saveSignal=signal(SIGINT,signal_handler); #if CBC_QUIET < 2 if (useSignalHandler) signal(SIGINT, signal_handler); #endif // Set up all non-standard stuff int cutPass = -1234567; int cutPassInTree = -1234567; int tunePreProcess = 0; int testOsiParameters = -1; // 0 normal, 1 from ampl or MIQP etc (2 allows cuts) int complicatedInteger = 0; OsiSolverInterface * solver = model_.solver(); if (noPrinting_) setCbcOrClpPrinting(false); #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); ClpSimplex * lpSolver = clpSolver->getModelPtr(); if (noPrinting_) { lpSolver->setLogLevel(0); } #else ClpSimplex * lpSolver = NULL; #endif // For priorities etc int * priorities = NULL; int * branchDirection = NULL; double * pseudoDown = NULL; double * pseudoUp = NULL; double * solutionIn = NULL; int * prioritiesIn = NULL; std::vector< std::pair< std::string, double > > mipStart; std::vector< std::pair< std::string, double > > mipStartBefore; int numberSOS = 0; int * sosStart = NULL; int * sosIndices = NULL; char * sosType = NULL; double * sosReference = NULL; int * cut = NULL; int * sosPriority = NULL; CglStored storedAmpl; CoinModel * coinModel = NULL; CoinModel saveCoinModel; CoinModel saveTightenedModel; int * whichColumn = NULL; int * knapsackStart = NULL; int * knapsackRow = NULL; int numberKnapsack = 0; #ifdef COIN_HAS_ASL ampl_info info; { memset(&info, 0, sizeof(info)); if (argc > 2 && !strcmp(argv[2], "-AMPL")) { statusUserFunction_[0] = 1; // see if log in list noPrinting_ = true; for (int i = 1; i < argc; i++) { if (!strncmp(argv[i], "log", 3)) { const char * equals = strchr(argv[i], '='); if (equals && atoi(equals + 1) > 0) { noPrinting_ = false; info.logLevel = atoi(equals + 1); int log = whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters_, parameters_); parameters_[log].setIntValue(info.logLevel); // mark so won't be overWritten info.numberRows = -1234567; break; } } } union { void * voidModel; CoinModel * model; } coinModelStart; coinModelStart.model = NULL; int returnCode = readAmpl(&info, argc, const_cast(argv), & coinModelStart.voidModel); coinModel = coinModelStart.model; if (returnCode) return returnCode; CbcOrClpRead_mode = 2; // so will start with parameters // see if log in list (including environment) for (int i = 1; i < info.numberArguments; i++) { if (!strcmp(info.arguments[i], "log")) { if (i < info.numberArguments - 1 && atoi(info.arguments[i+1]) > 0) noPrinting_ = false; break; } } if (noPrinting_) { model_.messageHandler()->setLogLevel(0); setCbcOrClpPrinting(false); } if (!noPrinting_) printf("%d rows, %d columns and %d elements\n", info.numberRows, info.numberColumns, info.numberElements); #ifdef COIN_HAS_LINK if (!coinModel) { #endif solver->loadProblem(info.numberColumns, info.numberRows, info.starts, info.rows, info.elements, info.columnLower, info.columnUpper, info.objective, info.rowLower, info.rowUpper); // take off cuts if ampl wants that if (info.cut && 0) { printf("AMPL CUTS OFF until global cuts fixed\n"); info.cut = NULL; } if (info.cut) { int numberRows = info.numberRows; int * whichRow = new int [numberRows]; // Row copy const CoinPackedMatrix * matrixByRow = solver->getMatrixByRow(); const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int nDelete = 0; for (int iRow = 0; iRow < numberRows; iRow++) { if (info.cut[iRow]) { whichRow[nDelete++] = iRow; int start = rowStart[iRow]; storedAmpl.addCut(rowLower[iRow], rowUpper[iRow], rowLength[iRow], column + start, elementByRow + start); } } solver->deleteRows(nDelete, whichRow); delete [] whichRow; } #ifdef COIN_HAS_LINK } else { #ifndef CBC_OTHER_SOLVER // save saveCoinModel = *coinModel; // load from coin model OsiSolverLink solver1; OsiSolverInterface * solver2 = solver1.clone(); model_.assignSolver(solver2, false); OsiSolverLink * si = dynamic_cast(model_.solver()) ; assert (si != NULL); si->setDefaultMeshSize(0.001); // need some relative granularity si->setDefaultBound(100.0); double dextra3 = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA3, numberParameters_, parameters_)].doubleValue(); if (dextra3) si->setDefaultMeshSize(dextra3); si->setDefaultBound(100000.0); si->setIntegerPriority(1000); si->setBiLinearPriority(10000); CoinModel * model2 = reinterpret_cast (coinModel); int logLevel = parameters_[whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters_, parameters_)].intValue(); si->load(*model2, true, logLevel); // redo solver = model_.solver(); clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); lpSolver = clpSolver->getModelPtr(); clpSolver->messageHandler()->setLogLevel(0) ; testOsiParameters = 0; parameters_[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters_, parameters_)].setIntValue(0); complicatedInteger = 1; if (info.cut) { printf("Sorry - can't do cuts with LOS as ruins delicate row order\n"); abort(); int numberRows = info.numberRows; int * whichRow = new int [numberRows]; // Row copy const CoinPackedMatrix * matrixByRow = solver->getMatrixByRow(); const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int nDelete = 0; for (int iRow = 0; iRow < numberRows; iRow++) { if (info.cut[iRow]) { whichRow[nDelete++] = iRow; int start = rowStart[iRow]; storedAmpl.addCut(rowLower[iRow], rowUpper[iRow], rowLength[iRow], column + start, elementByRow + start); } } solver->deleteRows(nDelete, whichRow); // and special matrix si->cleanMatrix()->deleteRows(nDelete, whichRow); delete [] whichRow; } #endif } #endif // If we had a solution use it if (info.primalSolution) { solver->setColSolution(info.primalSolution); } // status if (info.rowStatus) { unsigned char * statusArray = lpSolver->statusArray(); int i; for (i = 0; i < info.numberColumns; i++) statusArray[i] = static_cast(info.columnStatus[i]); statusArray += info.numberColumns; for (i = 0; i < info.numberRows; i++) statusArray[i] = static_cast(info.rowStatus[i]); CoinWarmStartBasis * basis = lpSolver->getBasis(); solver->setWarmStart(basis); delete basis; } freeArrays1(&info); // modify objective if necessary solver->setObjSense(info.direction); solver->setDblParam(OsiObjOffset, -info.offset); if (info.offset) { sprintf(generalPrint, "Ampl objective offset is %g", info.offset); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } // Set integer variables (unless nonlinear when set) if (!info.nonLinear) { for (int i = info.numberColumns - info.numberIntegers; i < info.numberColumns; i++) solver->setInteger(i); } goodModel = true; // change argc etc argc = info.numberArguments; argv = const_cast(info.arguments); } } #endif // default action on import int allowImportErrors = 0; int keepImportNames = 1; int doIdiot = -1; int outputFormat = 2; int slpValue = -1; int cppValue = -1; int printOptions = 0; int printMode = 0; int presolveOptions = 0; int substitution = 3; int dualize = 3; int doCrash = 0; int doVector = 0; int doSprint = -1; int doScaling = 4; // set reasonable defaults int preSolve = 5; int preProcess = 4; bool useStrategy = false; bool preSolveFile = false; bool strongChanged = false; bool pumpChanged = false; double djFix = 1.0e100; double tightenFactor = 0.0; const char dirsep = CoinFindDirSeparator(); std::string directory; std::string dirSample; std::string dirNetlib; std::string dirMiplib; if (dirsep == '/') { directory = "./"; dirSample = "../../Data/Sample/"; dirNetlib = "../../Data/Netlib/"; dirMiplib = "../../Data/miplib3/"; } else { directory = ".\\"; dirSample = "..\\..\\..\\..\\Data\\Sample\\"; dirNetlib = "..\\..\\..\\..\\Data\\Netlib\\"; dirMiplib = "..\\..\\..\\..\\Data\\miplib3\\"; } std::string defaultDirectory = directory; std::string importFile = ""; std::string exportFile = "default.mps"; std::string importBasisFile = ""; std::string importPriorityFile = ""; std::string debugFile = ""; std::string printMask = ""; double * debugValues = NULL; int numberDebugValues = -1; int basisHasValues = 0; std::string exportBasisFile = "default.bas"; std::string saveFile = "default.prob"; std::string restoreFile = "default.prob"; std::string solutionFile = "stdout"; std::string solutionSaveFile = "solution.file"; int slog = whichParam(CLP_PARAM_INT_SOLVERLOGLEVEL, numberParameters_, parameters_); int log = whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters_, parameters_); #ifndef CBC_OTHER_SOLVER double normalIncrement = model_.getCutoffIncrement();; #endif if (testOsiParameters >= 0) { // trying nonlinear - switch off some stuff preProcess = 0; } // Set up likely cut generators and defaults int nodeStrategy = 0; bool dominatedCuts = false; int doSOS = 1; int verbose = 0; CglGomory gomoryGen; // try larger limit gomoryGen.setLimitAtRoot(1000); gomoryGen.setLimit(50); // set default action (0=off,1=on,2=root) #ifdef SWAP_GOMORY int gomoryAction = 0; #else int gomoryAction = 3; #endif CglProbing probingGen; probingGen.setUsingObjective(1); probingGen.setMaxPass(1); probingGen.setMaxPassRoot(1); // Number of unsatisfied variables to look at probingGen.setMaxProbe(10); probingGen.setMaxProbeRoot(50); // How far to follow the consequences probingGen.setMaxLook(10); probingGen.setMaxLookRoot(50); probingGen.setMaxLookRoot(10); // Only look at rows with fewer than this number of elements probingGen.setMaxElements(200); probingGen.setMaxElementsRoot(300); probingGen.setRowCuts(3); // set default action (0=off,1=on,2=root) int probingAction = 1; CglKnapsackCover knapsackGen; //knapsackGen.switchOnExpensive(); //knapsackGen.setMaxInKnapsack(100); // set default action (0=off,1=on,2=root) int knapsackAction = 3; CglRedSplit redsplitGen; //redsplitGen.setLimit(100); // set default action (0=off,1=on,2=root) // Off as seems to give some bad cuts int redsplitAction = 0; CglRedSplit2 redsplit2Gen; //redsplit2Gen.setLimit(100); // set default action (0=off,1=on,2=root) // Off int redsplit2Action = 0; CglGMI GMIGen; //GMIGen.setLimit(100); // set default action (0=off,1=on,2=root) #ifdef SWAP_GOMORY int GMIAction = 3; #else // Off int GMIAction = 0; #endif CglFakeClique cliqueGen(NULL, false); //CglClique cliqueGen(false,true); cliqueGen.setStarCliqueReport(false); cliqueGen.setRowCliqueReport(false); cliqueGen.setMinViolation(0.1); // set default action (0=off,1=on,2=root) int cliqueAction = 3; // maxaggr,multiply,criterion(1-3) CglMixedIntegerRounding2 mixedGen(1, true, 1); // set default action (0=off,1=on,2=root) int mixedAction = 3; mixedGen.setDoPreproc(1); // safer (and better) CglFlowCover flowGen; // set default action (0=off,1=on,2=root) int flowAction = 3; CglTwomir twomirGen; twomirGen.setMaxElements(250); // set default action (0=off,1=on,2=root) int twomirAction = 3; #ifndef DEBUG_MALLOC CglLandP landpGen; landpGen.validator().setMinViolation(1.0e-4); #endif // set default action (0=off,1=on,2=root) int landpAction = 0; CglResidualCapacity residualCapacityGen; residualCapacityGen.setDoPreproc(1); // always preprocess // set default action (0=off,1=on,2=root) int residualCapacityAction = 0; CglZeroHalf zerohalfGen; //zerohalfGen.switchOnExpensive(); // set default action (0=off,1=on,2=root) int zerohalfAction = 0; // Stored cuts //bool storedCuts = false; int useCosts = 0; // don't use input solution int useSolution = -1; // total number of commands read int numberGoodCommands = 0; // Set false if user does anything advanced bool defaultSettings = true; // Hidden stuff for barrier int choleskyType = 0; int gamma = 0; int scaleBarrier = 0; int doKKT = 0; int crossover = 2; // do crossover unless quadratic bool biLinearProblem=false; // For names int lengthName = 0; std::vector rowNames; std::vector columnNames; // Default strategy stuff { // try changing tolerance at root #define MORE_CUTS #ifdef MORE_CUTS gomoryGen.setAwayAtRoot(0.005); twomirGen.setAwayAtRoot(0.005); twomirGen.setAway(0.01); //twomirGen.setMirScale(1,1); //twomirGen.setTwomirScale(1,1); //twomirGen.setAMax(2); #else gomoryGen.setAwayAtRoot(0.01); twomirGen.setAwayAtRoot(0.01); twomirGen.setAway(0.01); #endif int iParam; iParam = whichParam(CBC_PARAM_INT_DIVEOPT, numberParameters_, parameters_); parameters_[iParam].setIntValue(2); iParam = whichParam(CBC_PARAM_INT_FPUMPITS, numberParameters_, parameters_); parameters_[iParam].setIntValue(30); iParam = whichParam(CBC_PARAM_INT_FPUMPTUNE, numberParameters_, parameters_); parameters_[iParam].setIntValue(1005043); initialPumpTune = 1005043; iParam = whichParam(CLP_PARAM_INT_PROCESSTUNE, numberParameters_, parameters_); parameters_[iParam].setIntValue(6); tunePreProcess = 6; iParam = whichParam(CBC_PARAM_STR_DIVINGC, numberParameters_, parameters_); parameters_[iParam].setCurrentOption("on"); iParam = whichParam(CBC_PARAM_STR_RINS, numberParameters_, parameters_); parameters_[iParam].setCurrentOption("on"); iParam = whichParam(CBC_PARAM_STR_PROBINGCUTS, numberParameters_, parameters_); parameters_[iParam].setCurrentOption("on"); probingAction = 3; //parameters_[iParam].setCurrentOption("forceOnStrong"); //probingAction = 8; } std::string field; #if CBC_QUIET == 0 if (!noPrinting_) { sprintf(generalPrint, "Welcome to the CBC MILP Solver \n"); if (strcmp(CBC_VERSION, "trunk")){ sprintf(generalPrint + strlen(generalPrint), "Version: %s \n", CBC_VERSION); }else{ sprintf(generalPrint + strlen(generalPrint), "Version: Trunk (unstable) \n"); } sprintf(generalPrint + strlen(generalPrint), "Build Date: %s \n", __DATE__); #ifdef CBC_SVN_REV sprintf(generalPrint + strlen(generalPrint), "Revision Number: %d \n", CBC_SVN_REV); #endif generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; // Print command line if (argc > 1) { bool foundStrategy = false; sprintf(generalPrint, "command line - "); for (int i = 0; i < argc; i++) { if (!argv[i]) break; if (strstr(argv[i], "strat")) foundStrategy = true; sprintf(generalPrint + strlen(generalPrint), "%s ", argv[i]); } if (!foundStrategy) sprintf(generalPrint + strlen(generalPrint), "(default strategy 1)"); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } #endif while (1) { // next command field = CoinReadGetCommand(argc, argv); // Reset time time1 = CoinCpuTime(); time1Elapsed = CoinGetTimeOfDay(); // adjust field if has odd trailing characters char temp [200]; strcpy(temp, field.c_str()); int length = static_cast(strlen(temp)); for (int k = length - 1; k >= 0; k--) { if (temp[k] < ' ') length--; else break; } temp[length] = '\0'; field = temp; // exit if null or similar if (!field.length()) { if (numberGoodCommands == 1 && goodModel) { // we just had file name - do branch and bound field = "branch"; } else if (!numberGoodCommands) { // let's give the sucker a hint std::cout << "CoinSolver takes input from arguments ( - switches to stdin)" << std::endl << "Enter ? for list of commands or help" << std::endl; field = "-"; } else { break; } } // see if ? at end size_t numberQuery = 0; if (field != "?" && field != "???") { size_t length = field.length(); size_t i; for (i = length - 1; i > 0; i--) { if (field[i] == '?') numberQuery++; else break; } field = field.substr(0, length - numberQuery); } // find out if valid command int iParam; int numberMatches = 0; int firstMatch = -1; for ( iParam = 0; iParam < numberParameters_; iParam++ ) { int match = parameters_[iParam].matches(field); if (match == 1) { numberMatches = 1; firstMatch = iParam; break; } else { if (match && firstMatch < 0) firstMatch = iParam; numberMatches += match >> 1; } } if (iParam < numberParameters_ && !numberQuery) { // found CbcOrClpParam found = parameters_[iParam]; CbcOrClpParameterType type = found.type(); int valid; numberGoodCommands++; if (type == CBC_PARAM_ACTION_BAB && goodModel) { #ifndef CBC_USE_INITIAL_TIME if (model_.useElapsedTime()) model_.setDblParam(CbcModel::CbcStartSeconds, CoinGetTimeOfDay()); else model_.setDblParam(CbcModel::CbcStartSeconds, CoinCpuTime()); #endif biLinearProblem=false; // check if any integers #ifndef CBC_OTHER_SOLVER #ifdef COIN_HAS_ASL if (info.numberSos && doSOS && statusUserFunction_[0]) { // SOS numberSOS = info.numberSos; } #endif lpSolver = clpSolver->getModelPtr(); if (!lpSolver->integerInformation() && !numberSOS && !clpSolver->numberSOS() && !model_.numberObjects() && !clpSolver->numberObjects()) type = CLP_PARAM_ACTION_DUALSIMPLEX; #endif } if (type == CBC_PARAM_GENERALQUERY) { bool evenHidden = false; int printLevel = parameters_[whichParam(CLP_PARAM_STR_ALLCOMMANDS, numberParameters_, parameters_)].currentOptionAsInteger(); int convertP[] = {2, 1, 0}; printLevel = convertP[printLevel]; if ((verbose&8) != 0) { // even hidden evenHidden = true; verbose &= ~8; } #ifdef COIN_HAS_ASL if (verbose < 4 && statusUserFunction_[0]) verbose += 4; #endif if (verbose < 4) { std::cout << "In argument list keywords have leading - " ", -stdin or just - switches to stdin" << std::endl; std::cout << "One command per line (and no -)" << std::endl; std::cout << "abcd? gives list of possibilities, if only one + explanation" << std::endl; std::cout << "abcd?? adds explanation, if only one fuller help" << std::endl; std::cout << "abcd without value (where expected) gives current value" << std::endl; std::cout << "abcd value sets value" << std::endl; std::cout << "Commands are:" << std::endl; } else { std::cout << "Cbc options are set within AMPL with commands like:" << std::endl << std::endl; std::cout << " option cbc_options \"cuts=root log=2 feas=on slog=1\"" << std::endl << std::endl; std::cout << "only maximize, dual, primal, help and quit are recognized without =" << std::endl; } int maxAcross = 10; if ((verbose % 4) != 0) maxAcross = 1; int limits[] = {1, 51, 101, 151, 201, 251, 301, 351, 401}; std::vector types; types.push_back("Double parameters:"); types.push_back("Branch and Cut double parameters:"); types.push_back("Integer parameters:"); types.push_back("Branch and Cut integer parameters:"); types.push_back("Keyword parameters:"); types.push_back("Branch and Cut keyword parameters:"); types.push_back("Actions or string parameters:"); types.push_back("Branch and Cut actions:"); int iType; for (iType = 0; iType < 8; iType++) { int across = 0; int lengthLine = 0; if ((verbose % 4) != 0) std::cout << std::endl; std::cout << types[iType] << std::endl; if ((verbose&2) != 0) std::cout << std::endl; for ( iParam = 0; iParam < numberParameters_; iParam++ ) { int type = parameters_[iParam].type(); //printf("%d type %d limits %d %d display %d\n",iParam, // type,limits[iType],limits[iType+1],parameters_[iParam].displayThis()); if ((parameters_[iParam].displayThis() >= printLevel || evenHidden) && type >= limits[iType] && type < limits[iType+1]) { // but skip if not useful for ampl (and in ampl mode) if (verbose >= 4 && (parameters_[iParam].whereUsed()&4) == 0) continue; if (!across) { if ((verbose&2) != 0) std::cout << "Command "; } int length = parameters_[iParam].lengthMatchName() + 1; if (lengthLine + length > 80) { std::cout << std::endl; across = 0; lengthLine = 0; } std::cout << " " << parameters_[iParam].matchName(); lengthLine += length; across++; if (across == maxAcross) { across = 0; if ((verbose % 4) != 0) { // put out description as well if ((verbose&1) != 0) std::cout << " " << parameters_[iParam].shortHelp(); std::cout << std::endl; if ((verbose&2) != 0) { std::cout << "---- description" << std::endl; parameters_[iParam].printLongHelp(); std::cout << "----" << std::endl << std::endl; } } else { std::cout << std::endl; } } } } if (across) std::cout << std::endl; } } else if (type == CBC_PARAM_FULLGENERALQUERY) { std::cout << "Full list of commands is:" << std::endl; int maxAcross = 5; int limits[] = {1, 51, 101, 151, 201, 251, 301, 351, 401}; std::vector types; types.push_back("Double parameters:"); types.push_back("Branch and Cut double parameters:"); types.push_back("Integer parameters:"); types.push_back("Branch and Cut integer parameters:"); types.push_back("Keyword parameters:"); types.push_back("Branch and Cut keyword parameters:"); types.push_back("Actions or string parameters:"); types.push_back("Branch and Cut actions:"); int iType; for (iType = 0; iType < 8; iType++) { int across = 0; std::cout << types[iType] << " "; for ( iParam = 0; iParam < numberParameters_; iParam++ ) { int type = parameters_[iParam].type(); if (type >= limits[iType] && type < limits[iType+1]) { if (!across) std::cout << " "; std::cout << parameters_[iParam].matchName() << " "; across++; if (across == maxAcross) { std::cout << std::endl; across = 0; } } } if (across) std::cout << std::endl; } } else if (type < 101) { // get next field as double double value = CoinReadGetDoubleField(argc, argv, &valid); if (!valid) { if (type < 51) { int returnCode; const char * message = parameters_[iParam].setDoubleParameterWithMessage(lpSolver, value, returnCode); if (!noPrinting_ && strlen(message)) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; } } else if (type < 81) { int returnCode; const char * message = parameters_[iParam].setDoubleParameterWithMessage(model_, value, returnCode); if (!noPrinting_ && strlen(message)) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; } } else { int returnCode; const char * message = parameters_[iParam].setDoubleParameterWithMessage(lpSolver, value, returnCode); if (!noPrinting_ && strlen(message)) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; } switch (type) { case CBC_PARAM_DBL_DJFIX: djFix = value; #ifndef CBC_OTHER_SOLVER if (goodModel && djFix < 1.0e20) { // do some fixing clpSolver = dynamic_cast< OsiClpSolverInterface*> (model_.solver()); clpSolver->initialSolve(); lpSolver = clpSolver->getModelPtr(); int numberColumns = lpSolver->numberColumns(); int i; const char * type = lpSolver->integerInformation(); double * lower = lpSolver->columnLower(); double * upper = lpSolver->columnUpper(); double * solution = lpSolver->primalColumnSolution(); double * dj = lpSolver->dualColumnSolution(); int numberFixed = 0; double dextra4 = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA4, numberParameters_, parameters_)].doubleValue(); if (dextra4) printf("Multiple for continuous dj fixing is %g\n", dextra4); for (i = 0; i < numberColumns; i++) { double djValue = dj[i]; if (!type[i]) djValue *= dextra4; if (type[i] || dextra4) { double value = solution[i]; if (value < lower[i] + 1.0e-5 && djValue > djFix) { solution[i] = lower[i]; upper[i] = lower[i]; numberFixed++; } else if (value > upper[i] - 1.0e-5 && djValue < -djFix) { solution[i] = upper[i]; lower[i] = upper[i]; numberFixed++; } } } sprintf(generalPrint, "%d columns fixed\n", numberFixed); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } #endif break; case CBC_PARAM_DBL_TIGHTENFACTOR: tightenFactor = value; if (!complicatedInteger) defaultSettings = false; // user knows what she is doing break; default: break; } } } else if (valid == 1) { std::cout << " is illegal for double parameter " << parameters_[iParam].name() << " value remains " << parameters_[iParam].doubleValue() << std::endl; } else { std::cout << parameters_[iParam].name() << " has value " << parameters_[iParam].doubleValue() << std::endl; } } else if (type < 201) { // get next field as int int value = CoinReadGetIntField(argc, argv, &valid); if (!valid) { if (type < 151) { if (parameters_[iParam].type() == CLP_PARAM_INT_PRESOLVEPASS) preSolve = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_IDIOT) doIdiot = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_SPRINT) doSprint = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_OUTPUTFORMAT) outputFormat = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_SLPVALUE) slpValue = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_CPP) cppValue = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_PRESOLVEOPTIONS) presolveOptions = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_PRINTOPTIONS) printOptions = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_SUBSTITUTION) substitution = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_DUALIZE) dualize = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_PROCESSTUNE) tunePreProcess = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_USESOLUTION) useSolution = value; else if (parameters_[iParam].type() == CLP_PARAM_INT_VERBOSE) verbose = value; int returnCode; const char * message = parameters_[iParam].setIntParameterWithMessage(lpSolver, value, returnCode); if (!noPrinting_ && strlen(message)) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; } } else { if (parameters_[iParam].type() == CBC_PARAM_INT_CUTPASS) cutPass = value; else if (parameters_[iParam].type() == CBC_PARAM_INT_CUTPASSINTREE) cutPassInTree = value; else if (parameters_[iParam].type() == CBC_PARAM_INT_STRONGBRANCHING || parameters_[iParam].type() == CBC_PARAM_INT_NUMBERBEFORE) strongChanged = true; else if (parameters_[iParam].type() == CBC_PARAM_INT_FPUMPTUNE || parameters_[iParam].type() == CBC_PARAM_INT_FPUMPTUNE2 || parameters_[iParam].type() == CBC_PARAM_INT_FPUMPITS) pumpChanged = true; else if (parameters_[iParam].type() == CBC_PARAM_INT_EXPERIMENT) { int addFlags=0; // switch on some later features if >999 if (value>999) { int switchValue=value/1000; const char * message = NULL; value -= 1000*switchValue; parameters_[whichParam(CBC_PARAM_INT_EXPERIMENT, numberParameters_, parameters_)].setIntValue(0/*value*/); switch (switchValue) { default: case 4: // hotstart 500, -200 cut passes message=parameters_[whichParam(CBC_PARAM_INT_MAXHOTITS, numberParameters_, parameters_)].setIntValueWithMessage(500); if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; message=parameters_[whichParam(CBC_PARAM_INT_CUTPASS, numberParameters_, parameters_)].setIntValueWithMessage(-200); if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; case 3: // multiple 4 message=parameters_[whichParam(CBC_PARAM_INT_MULTIPLEROOTS, numberParameters_, parameters_)].setIntValueWithMessage(4); if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; case 2: // rens plus all diving at root message=parameters_[whichParam(CBC_PARAM_INT_DIVEOPT, numberParameters_, parameters_)].setIntValueWithMessage(16); if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; model_.setNumberAnalyzeIterations(-value); // -tune 7 zero,lagomory,gmi at root - probing on case 1: tunePreProcess=7; message=parameters_[whichParam(CLP_PARAM_INT_PROCESSTUNE, numberParameters_, parameters_)].setIntValueWithMessage(7); if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; //message = parameters_[whichParam(CBC_PARAM_INT_MIPOPTIONS, numberParameters_, parameters_)].setIntValueWithMessage(1025); //if (!noPrinting_&&message) // generalMessageHandler->message(CLP_GENERAL, generalMessages) // << message << CoinMessageEol; message=parameters_[whichParam(CBC_PARAM_STR_PROBINGCUTS, numberParameters_, parameters_)].setCurrentOptionWithMessage("on"); probingAction = 1; if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; message=parameters_[whichParam(CBC_PARAM_STR_ZEROHALFCUTS, numberParameters_, parameters_)].setCurrentOptionWithMessage("root"); if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; message=parameters_[whichParam(CBC_PARAM_STR_LAGOMORYCUTS, numberParameters_, parameters_)].setCurrentOptionWithMessage("root"); if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; #ifdef SWAP_GOMORY GMIAction = 3; message=parameters_[whichParam(CBC_PARAM_STR_GMICUTS, numberParameters_, parameters_)].setCurrentOptionWithMessage("ifmove"); #else GMIAction = 2; message=parameters_[whichParam(CBC_PARAM_STR_GMICUTS, numberParameters_, parameters_)].setCurrentOptionWithMessage("root"); #endif if (!noPrinting_&&message) generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; } value = 0; } if (value>=10) { addFlags = 1048576*(value/10); value = value % 10; parameters_[whichParam(CBC_PARAM_INT_EXPERIMENT, numberParameters_, parameters_)].setIntValue(value); } if (value >= 1) { int values[]={24003,280003,792003,24003,24003}; if (value>=2&&value<=3) { // swap default diving int iParam = whichParam(CBC_PARAM_STR_DIVINGC, numberParameters_, parameters_); parameters_[iParam].setCurrentOption("off"); iParam = whichParam(CBC_PARAM_STR_DIVINGP, numberParameters_, parameters_); parameters_[iParam].setCurrentOption("on"); } int extra4 = values[value-1]+addFlags; parameters_[whichParam(CBC_PARAM_INT_EXTRA4, numberParameters_, parameters_)].setIntValue(extra4); if (!noPrinting_) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << "switching on global root cuts for gomory and knapsack" << CoinMessageEol; generalMessageHandler->message(CLP_GENERAL, generalMessages) << "using OSL factorization" << CoinMessageEol; generalMessageHandler->message(CLP_GENERAL, generalMessages) << "extra options - -rens on -extra4 " <factorization()->forceOtherFactorization(3); parameters_[whichParam(CBC_PARAM_INT_MAXHOTITS, numberParameters_, parameters_)].setIntValue(100); parameters_[whichParam(CBC_PARAM_INT_CUTPASS, numberParameters_, parameters_)].setIntValue(1000); cutPass = 1000; parameters_[whichParam(CBC_PARAM_STR_RENS, numberParameters_, parameters_)].setCurrentOption("on"); } } else if (parameters_[iParam].type() == CBC_PARAM_INT_STRATEGY) { if (value == 0) { gomoryGen.setAwayAtRoot(0.05); int iParam; iParam = whichParam(CBC_PARAM_INT_DIVEOPT, numberParameters_, parameters_); parameters_[iParam].setIntValue(-1); iParam = whichParam(CBC_PARAM_INT_FPUMPITS, numberParameters_, parameters_); parameters_[iParam].setIntValue(20); iParam = whichParam(CBC_PARAM_INT_FPUMPTUNE, numberParameters_, parameters_); parameters_[iParam].setIntValue(1003); initialPumpTune = 1003; iParam = whichParam(CLP_PARAM_INT_PROCESSTUNE, numberParameters_, parameters_); parameters_[iParam].setIntValue(0); tunePreProcess = 0; iParam = whichParam(CBC_PARAM_STR_DIVINGC, numberParameters_, parameters_); parameters_[iParam].setCurrentOption("off"); iParam = whichParam(CBC_PARAM_STR_RINS, numberParameters_, parameters_); parameters_[iParam].setCurrentOption("off"); iParam = whichParam(CBC_PARAM_STR_PROBINGCUTS, numberParameters_, parameters_); // but not if cuts off int jParam = whichParam(CBC_PARAM_STR_CUTSSTRATEGY, numberParameters_, parameters_); jParam = parameters_[jParam].currentOptionAsInteger(); if (jParam) { parameters_[iParam].setCurrentOption("on"); probingAction = 1; } else { parameters_[iParam].setCurrentOption("off"); probingAction = 0; } } } int returnCode; const char * message = parameters_[iParam].setIntParameterWithMessage(model_, value, returnCode); if (!noPrinting_ && strlen(message)) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; } } } else if (valid == 1) { std::cout << " is illegal for integer parameter " << parameters_[iParam].name() << " value remains " << parameters_[iParam].intValue() << std::endl; } else { std::cout << parameters_[iParam].name() << " has value " << parameters_[iParam].intValue() << std::endl; } } else if (type < 301) { // one of several strings std::string value = CoinReadGetString(argc, argv); int action = parameters_[iParam].parameterOption(value); if (action < 0) { if (value != "EOL") { // no match parameters_[iParam].printOptions(); } else { // print current value std::cout << parameters_[iParam].name() << " has value " << parameters_[iParam].currentOption() << std::endl; } } else { const char * message = parameters_[iParam].setCurrentOptionWithMessage(action); if (!noPrinting_ && strlen(message)) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << message << CoinMessageEol; } // for now hard wired switch (type) { case CLP_PARAM_STR_DIRECTION: if (action == 0) lpSolver->setOptimizationDirection(1); else if (action == 1) lpSolver->setOptimizationDirection(-1); else lpSolver->setOptimizationDirection(0); break; case CLP_PARAM_STR_DUALPIVOT: if (action == 0) { ClpDualRowSteepest steep(3); lpSolver->setDualRowPivotAlgorithm(steep); } else if (action == 1) { ClpDualRowDantzig dantzig; //ClpDualRowSteepest dantzig(5); lpSolver->setDualRowPivotAlgorithm(dantzig); } else if (action == 2) { // partial steep ClpDualRowSteepest steep(2); lpSolver->setDualRowPivotAlgorithm(steep); } else { ClpDualRowSteepest steep; lpSolver->setDualRowPivotAlgorithm(steep); } break; case CLP_PARAM_STR_PRIMALPIVOT: if (action == 0) { ClpPrimalColumnSteepest steep(3); lpSolver->setPrimalColumnPivotAlgorithm(steep); } else if (action == 1) { ClpPrimalColumnSteepest steep(0); lpSolver->setPrimalColumnPivotAlgorithm(steep); } else if (action == 2) { ClpPrimalColumnDantzig dantzig; lpSolver->setPrimalColumnPivotAlgorithm(dantzig); } else if (action == 3) { ClpPrimalColumnSteepest steep(4); lpSolver->setPrimalColumnPivotAlgorithm(steep); } else if (action == 4) { ClpPrimalColumnSteepest steep(1); lpSolver->setPrimalColumnPivotAlgorithm(steep); } else if (action == 5) { ClpPrimalColumnSteepest steep(2); lpSolver->setPrimalColumnPivotAlgorithm(steep); } else if (action == 6) { ClpPrimalColumnSteepest steep(10); lpSolver->setPrimalColumnPivotAlgorithm(steep); } break; case CLP_PARAM_STR_SCALING: lpSolver->scaling(action); solver->setHintParam(OsiDoScale, action != 0, OsiHintTry); doScaling = action; break; case CLP_PARAM_STR_AUTOSCALE: lpSolver->setAutomaticScaling(action != 0); break; case CLP_PARAM_STR_SPARSEFACTOR: lpSolver->setSparseFactorization((1 - action) != 0); break; case CLP_PARAM_STR_BIASLU: lpSolver->factorization()->setBiasLU(action); break; case CLP_PARAM_STR_PERTURBATION: if (action == 0) lpSolver->setPerturbation(50); else lpSolver->setPerturbation(100); break; case CLP_PARAM_STR_ERRORSALLOWED: allowImportErrors = action; break; case CLP_PARAM_STR_INTPRINT: printMode = action; break; //case CLP_PARAM_NOTUSED_ALGORITHM: //algorithm = action; //defaultSettings=false; // user knows what she is doing //abort(); //break; case CLP_PARAM_STR_KEEPNAMES: keepImportNames = 1 - action; break; case CLP_PARAM_STR_PRESOLVE: if (action == 0) preSolve = 5; else if (action == 1) preSolve = 0; else if (action == 2) preSolve = 10; else preSolveFile = true; break; case CLP_PARAM_STR_PFI: lpSolver->factorization()->setForrestTomlin(action == 0); break; case CLP_PARAM_STR_FACTORIZATION: lpSolver->factorization()->forceOtherFactorization(action); break; case CLP_PARAM_STR_CRASH: doCrash = action; break; case CLP_PARAM_STR_VECTOR: doVector = action; break; case CLP_PARAM_STR_MESSAGES: lpSolver->messageHandler()->setPrefix(action != 0); break; case CLP_PARAM_STR_CHOLESKY: choleskyType = action; break; case CLP_PARAM_STR_GAMMA: gamma = action; break; case CLP_PARAM_STR_BARRIERSCALE: scaleBarrier = action; break; case CLP_PARAM_STR_KKT: doKKT = action; break; case CLP_PARAM_STR_CROSSOVER: crossover = action; break; case CLP_PARAM_STR_TIME_MODE: model_.setUseElapsedTime(action!=0); break; case CBC_PARAM_STR_SOS: doSOS = action; break; case CBC_PARAM_STR_GOMORYCUTS: defaultSettings = false; // user knows what she is doing gomoryAction = action; break; case CBC_PARAM_STR_PROBINGCUTS: defaultSettings = false; // user knows what she is doing probingAction = action; break; case CBC_PARAM_STR_KNAPSACKCUTS: defaultSettings = false; // user knows what she is doing knapsackAction = action; break; case CBC_PARAM_STR_REDSPLITCUTS: defaultSettings = false; // user knows what she is doing redsplitAction = action; break; case CBC_PARAM_STR_REDSPLIT2CUTS: defaultSettings = false; // user knows what she is doing redsplit2Action = action; break; case CBC_PARAM_STR_GMICUTS: defaultSettings = false; // user knows what she is doing GMIAction = action; break; case CBC_PARAM_STR_CLIQUECUTS: defaultSettings = false; // user knows what she is doing cliqueAction = action; break; case CBC_PARAM_STR_FLOWCUTS: defaultSettings = false; // user knows what she is doing flowAction = action; break; case CBC_PARAM_STR_MIXEDCUTS: defaultSettings = false; // user knows what she is doing mixedAction = action; break; case CBC_PARAM_STR_TWOMIRCUTS: defaultSettings = false; // user knows what she is doing twomirAction = action; break; case CBC_PARAM_STR_LANDPCUTS: defaultSettings = false; // user knows what she is doing landpAction = action; break; case CBC_PARAM_STR_RESIDCUTS: defaultSettings = false; // user knows what she is doing residualCapacityAction = action; break; case CBC_PARAM_STR_ZEROHALFCUTS: defaultSettings = false; // user knows what she is doing zerohalfAction = action; break; case CBC_PARAM_STR_ROUNDING: defaultSettings = false; // user knows what she is doing break; case CBC_PARAM_STR_FPUMP: defaultSettings = false; // user knows what she is doing break; case CBC_PARAM_STR_RINS: break; case CBC_PARAM_STR_DINS: break; case CBC_PARAM_STR_RENS: break; case CBC_PARAM_STR_CUTSSTRATEGY: gomoryAction = action; probingAction = action; knapsackAction = action; cliqueAction = action; flowAction = action; mixedAction = action; twomirAction = action; //landpAction = action; parameters_[whichParam(CBC_PARAM_STR_GOMORYCUTS, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_PROBINGCUTS, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_KNAPSACKCUTS, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_CLIQUECUTS, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_FLOWCUTS, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_MIXEDCUTS, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_TWOMIRCUTS, numberParameters_, parameters_)].setCurrentOption(action); if (!action) { zerohalfAction = action; parameters_[whichParam(CBC_PARAM_STR_ZEROHALFCUTS, numberParameters_, parameters_)].setCurrentOption(action); redsplitAction = action; parameters_[whichParam(CBC_PARAM_STR_REDSPLITCUTS, numberParameters_, parameters_)].setCurrentOption(action); redsplit2Action = action; parameters_[whichParam(CBC_PARAM_STR_REDSPLIT2CUTS, numberParameters_, parameters_)].setCurrentOption(action); GMIAction = action; parameters_[whichParam(CBC_PARAM_STR_GMICUTS, numberParameters_, parameters_)].setCurrentOption(action); landpAction = action; parameters_[whichParam(CBC_PARAM_STR_LANDPCUTS, numberParameters_, parameters_)].setCurrentOption(action); residualCapacityAction = action; parameters_[whichParam(CBC_PARAM_STR_RESIDCUTS, numberParameters_, parameters_)].setCurrentOption(action); } break; case CBC_PARAM_STR_HEURISTICSTRATEGY: parameters_[whichParam(CBC_PARAM_STR_ROUNDING, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_GREEDY, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_COMBINE, numberParameters_, parameters_)].setCurrentOption(action); //parameters_[whichParam(CBC_PARAM_STR_LOCALTREE,numberParameters_,parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_FPUMP, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_DIVINGC, numberParameters_, parameters_)].setCurrentOption(action); parameters_[whichParam(CBC_PARAM_STR_RINS, numberParameters_, parameters_)].setCurrentOption(action); break; case CBC_PARAM_STR_GREEDY: case CBC_PARAM_STR_DIVINGS: case CBC_PARAM_STR_DIVINGC: case CBC_PARAM_STR_DIVINGF: case CBC_PARAM_STR_DIVINGG: case CBC_PARAM_STR_DIVINGL: case CBC_PARAM_STR_DIVINGP: case CBC_PARAM_STR_DIVINGV: case CBC_PARAM_STR_COMBINE: case CBC_PARAM_STR_PIVOTANDCOMPLEMENT: case CBC_PARAM_STR_PIVOTANDFIX: case CBC_PARAM_STR_RANDROUND: case CBC_PARAM_STR_LOCALTREE: case CBC_PARAM_STR_NAIVE: case CBC_PARAM_STR_CPX: defaultSettings = false; // user knows what she is doing break; case CBC_PARAM_STR_COSTSTRATEGY: useCosts = action; break; case CBC_PARAM_STR_NODESTRATEGY: nodeStrategy = action; break; case CBC_PARAM_STR_PREPROCESS: preProcess = action; break; default: //abort(); break; } } } else { // action if (type == CLP_PARAM_ACTION_EXIT) { #ifdef COIN_HAS_ASL if (statusUserFunction_[0]) { if (info.numberIntegers || info.numberBinary) { // integer } else { // linear } writeAmpl(&info); freeArrays2(&info); freeArgs(&info); } #endif break; // stop all } switch (type) { case CLP_PARAM_ACTION_DUALSIMPLEX: case CLP_PARAM_ACTION_PRIMALSIMPLEX: case CLP_PARAM_ACTION_SOLVECONTINUOUS: case CLP_PARAM_ACTION_BARRIER: if (goodModel) { // Say not in integer integerStatus = -1; double objScale = parameters_[whichParam(CLP_PARAM_DBL_OBJSCALE2, numberParameters_, parameters_)].doubleValue(); if (objScale != 1.0) { int iColumn; int numberColumns = lpSolver->numberColumns(); double * dualColumnSolution = lpSolver->dualColumnSolution(); ClpObjective * obj = lpSolver->objectiveAsObject(); assert(dynamic_cast (obj)); double offset; double * objective = obj->gradient(NULL, NULL, offset, true); for (iColumn = 0; iColumn < numberColumns; iColumn++) { dualColumnSolution[iColumn] *= objScale; objective[iColumn] *= objScale;; } int iRow; int numberRows = lpSolver->numberRows(); double * dualRowSolution = lpSolver->dualRowSolution(); for (iRow = 0; iRow < numberRows; iRow++) dualRowSolution[iRow] *= objScale; lpSolver->setObjectiveOffset(objScale*lpSolver->objectiveOffset()); } ClpSolve::SolveType method; ClpSolve::PresolveType presolveType; ClpSimplex * model2 = lpSolver; if (dualize) { bool tryIt = true; double fractionColumn = 1.0; double fractionRow = 1.0; if (dualize == 3) { dualize = 1; int numberColumns = lpSolver->numberColumns(); int numberRows = lpSolver->numberRows(); if (numberRows < 50000 || 5*numberColumns > numberRows) { tryIt = false; } else { fractionColumn = 0.1; fractionRow = 0.1; } } if (tryIt) { model2 = static_cast (model2)->dualOfModel(fractionRow, fractionColumn); if (model2) { sprintf(generalPrint, "Dual of model has %d rows and %d columns", model2->numberRows(), model2->numberColumns()); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; model2->setOptimizationDirection(1.0); } else { model2 = lpSolver; dualize = 0; } } else { dualize = 0; } } if (noPrinting_) lpSolver->setLogLevel(0); ClpSolve solveOptions; solveOptions.setPresolveActions(presolveOptions); solveOptions.setSubstitution(substitution); if (preSolve != 5 && preSolve) { presolveType = ClpSolve::presolveNumber; if (preSolve < 0) { preSolve = - preSolve; if (preSolve <= 100) { presolveType = ClpSolve::presolveNumber; sprintf(generalPrint, "Doing %d presolve passes - picking up non-costed slacks", preSolve); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; solveOptions.setDoSingletonColumn(true); } else { preSolve -= 100; presolveType = ClpSolve::presolveNumberCost; sprintf(generalPrint, "Doing %d presolve passes - picking up costed slacks", preSolve); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } } else if (preSolve) { presolveType = ClpSolve::presolveOn; } else { presolveType = ClpSolve::presolveOff; } solveOptions.setPresolveType(presolveType, preSolve); if (type == CLP_PARAM_ACTION_DUALSIMPLEX || type == CLP_PARAM_ACTION_SOLVECONTINUOUS) { method = ClpSolve::useDual; } else if (type == CLP_PARAM_ACTION_PRIMALSIMPLEX) { method = ClpSolve::usePrimalorSprint; } else { method = ClpSolve::useBarrier; if (crossover == 1) { method = ClpSolve::useBarrierNoCross; } else if (crossover == 2) { ClpObjective * obj = lpSolver->objectiveAsObject(); if (obj->type() > 1) { method = ClpSolve::useBarrierNoCross; presolveType = ClpSolve::presolveOff; solveOptions.setPresolveType(presolveType, preSolve); } } } solveOptions.setSolveType(method); if (preSolveFile) presolveOptions |= 0x40000000; solveOptions.setSpecialOption(4, presolveOptions); solveOptions.setSpecialOption(5, printOptions); if (doVector) { ClpMatrixBase * matrix = lpSolver->clpMatrix(); if (dynamic_cast< ClpPackedMatrix*>(matrix)) { ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); clpMatrix->makeSpecialColumnCopy(); } } if (method == ClpSolve::useDual) { // dual if (doCrash) solveOptions.setSpecialOption(0, 1, doCrash); // crash else if (doIdiot) solveOptions.setSpecialOption(0, 2, doIdiot); // possible idiot } else if (method == ClpSolve::usePrimalorSprint) { // primal // if slp turn everything off if (slpValue > 0) { doCrash = false; doSprint = 0; doIdiot = -1; solveOptions.setSpecialOption(1, 10, slpValue); // slp method = ClpSolve::usePrimal; } if (doCrash) { solveOptions.setSpecialOption(1, 1, doCrash); // crash } else if (doSprint > 0) { // sprint overrides idiot solveOptions.setSpecialOption(1, 3, doSprint); // sprint } else if (doIdiot > 0) { solveOptions.setSpecialOption(1, 2, doIdiot); // idiot } else if (slpValue <= 0) { if (doIdiot == 0) { if (doSprint == 0) solveOptions.setSpecialOption(1, 4); // all slack else solveOptions.setSpecialOption(1, 9); // all slack or sprint } else { if (doSprint == 0) solveOptions.setSpecialOption(1, 8); // all slack or idiot else solveOptions.setSpecialOption(1, 7); // initiative } } if (basisHasValues == -1) solveOptions.setSpecialOption(1, 11); // switch off values } else if (method == ClpSolve::useBarrier || method == ClpSolve::useBarrierNoCross) { int barrierOptions = choleskyType; if (scaleBarrier) barrierOptions |= 8; if (doKKT) barrierOptions |= 16; if (gamma) barrierOptions |= 32 * gamma; if (crossover == 3) barrierOptions |= 256; // try presolve in crossover solveOptions.setSpecialOption(4, barrierOptions); } model2->setMaximumSeconds(model_.getMaximumSeconds()); #ifdef COIN_HAS_LINK OsiSolverInterface * coinSolver = model_.solver(); OsiSolverLink * linkSolver = dynamic_cast< OsiSolverLink*> (coinSolver); if (!linkSolver) { model2->initialSolve(solveOptions); } else { // special solver int testOsiOptions = parameters_[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters_, parameters_)].intValue(); double * solution = NULL; if (testOsiOptions < 10) { solution = linkSolver->nonlinearSLP(slpValue > 0 ? slpValue : 20 , 1.0e-5); } else if (testOsiOptions >= 10) { CoinModel coinModel = *linkSolver->coinModel(); ClpSimplex * tempModel = approximateSolution(coinModel, slpValue > 0 ? slpValue : 50 , 1.0e-5, 0); assert (tempModel); solution = CoinCopyOfArray(tempModel->primalColumnSolution(), coinModel.numberColumns()); model2->setObjectiveValue(tempModel->objectiveValue()); model2->setProblemStatus(tempModel->problemStatus()); model2->setSecondaryStatus(tempModel->secondaryStatus()); delete tempModel; } if (solution) { memcpy(model2->primalColumnSolution(), solution, CoinMin(model2->numberColumns(), linkSolver->coinModel()->numberColumns())*sizeof(double)); delete [] solution; } else { printf("No nonlinear solution\n"); } } #else model2->initialSolve(solveOptions); #endif { // map states /* clp status -1 - unknown e.g. before solve or if postSolve says not optimal 0 - optimal 1 - primal infeasible 2 - dual infeasible 3 - stopped on iterations or time 4 - stopped due to errors 5 - stopped by event handler (virtual int ClpEventHandler::event()) */ /* cbc status -1 before branchAndBound 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found (or check value of best solution) 1 stopped - on maxnodes, maxsols, maxtime 2 difficulties so run was abandoned (5 event user programmed event occurred) */ /* clp secondary status of problem - may get extended 0 - none 1 - primal infeasible because dual limit reached OR probably primal infeasible but can't prove it (main status 4) 2 - scaled problem optimal - unscaled problem has primal infeasibilities 3 - scaled problem optimal - unscaled problem has dual infeasibilities 4 - scaled problem optimal - unscaled problem has primal and dual infeasibilities 5 - giving up in primal with flagged variables 6 - failed due to empty problem check 7 - postSolve says not optimal 8 - failed due to bad element check 9 - status was 3 and stopped on time 100 up - translation of enum from ClpEventHandler */ /* cbc secondary status of problem -1 unset (status_ will also be -1) 0 search completed with solution 1 linear relaxation not feasible (or worse than cutoff) 2 stopped on gap 3 stopped on nodes 4 stopped on time 5 stopped on user event 6 stopped on solutions 7 linear relaxation unbounded 8 stopped on iterations limit */ int iStatus = model2->status(); int iStatus2 = model2->secondaryStatus(); if (iStatus == 0) { iStatus2 = 0; if (found.type() == CBC_PARAM_ACTION_BAB) { // set best solution in model as no integers model_.setBestSolution(model2->primalColumnSolution(), model2->numberColumns(), model2->getObjValue()* model2->getObjSense()); } } else if (iStatus == 1) { iStatus = 0; iStatus2 = 1; // say infeasible } else if (iStatus == 2) { iStatus = 0; iStatus2 = 7; // say unbounded } else if (iStatus == 3) { iStatus = 1; if (iStatus2 == 9) // what does 9 mean ????????????? iStatus2 = 4; else iStatus2 = 3; // Use nodes - as closer than solutions } else if (iStatus == 4) { iStatus = 2; // difficulties iStatus2 = 0; } model_.setProblemStatus(iStatus); model_.setSecondaryStatus(iStatus2); if ((iStatus == 2 || iStatus2 > 0) && !noPrinting_) { std::string statusName[] = {"", "Stopped on ", "Run abandoned", "", "", "User ctrl-c"}; std::string minor[] = {"Optimal solution found", "Linear relaxation infeasible", "Optimal solution found (within gap tolerance)", "node limit", "time limit", "user ctrl-c", "solution limit", "Linear relaxation unbounded", "iterations limit", "Problem proven infeasible"}; sprintf(generalPrint, "\nResult - %s%s\n\n", statusName[iStatus].c_str(), minor[iStatus2].c_str()); sprintf(generalPrint + strlen(generalPrint), "Enumerated nodes: 0\n"); sprintf(generalPrint + strlen(generalPrint), "Total iterations: 0\n"); #if CBC_QUIET == 0 sprintf(generalPrint + strlen(generalPrint), "Time (CPU seconds): %.2f\n", CoinCpuTime() - time0); sprintf(generalPrint + strlen(generalPrint), "Time (Wallclock Seconds): %.2f\n", CoinGetTimeOfDay()-time0Elapsed); #endif generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } //assert (lpSolver==clpSolver->getModelPtr()); assert (clpSolver == model_.solver()); clpSolver->setWarmStart(NULL); // and in babModel if exists if (babModel_) { babModel_->setProblemStatus(iStatus); babModel_->setSecondaryStatus(iStatus2); } int returnCode = callBack(&model, 1); if (returnCode) { // exit if user wants delete babModel_; babModel_ = NULL; return returnCode; } } basisHasValues = 1; if (dualize) { int returnCode = static_cast (lpSolver)->restoreFromDual(model2); if (model2->status() == 3) returnCode = 0; delete model2; if (returnCode && dualize != 2) lpSolver->primal(1); model2 = lpSolver; } #ifdef COIN_HAS_ASL if (statusUserFunction_[0]) { double value = model2->getObjValue(); char buf[300]; int pos = 0; int iStat = model2->status(); if (iStat == 0) { pos += sprintf(buf + pos, "optimal," ); } else if (iStat == 1) { // infeasible pos += sprintf(buf + pos, "infeasible,"); } else if (iStat == 2) { // unbounded pos += sprintf(buf + pos, "unbounded,"); } else if (iStat == 3) { pos += sprintf(buf + pos, "stopped on iterations or time,"); } else if (iStat == 4) { iStat = 7; pos += sprintf(buf + pos, "stopped on difficulties,"); } else if (iStat == 5) { iStat = 3; pos += sprintf(buf + pos, "stopped on ctrl-c,"); } else if (iStat == 6) { // bab infeasible pos += sprintf(buf + pos, "integer infeasible,"); iStat = 1; } else { pos += sprintf(buf + pos, "status unknown,"); iStat = 6; } info.problemStatus = iStat; info.objValue = value; pos += sprintf(buf + pos, " objective %.*g", ampl_obj_prec(), value); sprintf(buf + pos, "\n%d iterations", model2->getIterationCount()); free(info.primalSolution); int numberColumns = model2->numberColumns(); info.primalSolution = reinterpret_cast (malloc(numberColumns * sizeof(double))); CoinCopyN(model2->primalColumnSolution(), numberColumns, info.primalSolution); int numberRows = model2->numberRows(); free(info.dualSolution); info.dualSolution = reinterpret_cast (malloc(numberRows * sizeof(double))); CoinCopyN(model2->dualRowSolution(), numberRows, info.dualSolution); CoinWarmStartBasis * basis = model2->getBasis(); free(info.rowStatus); info.rowStatus = reinterpret_cast (malloc(numberRows * sizeof(int))); free(info.columnStatus); info.columnStatus = reinterpret_cast (malloc(numberColumns * sizeof(int))); // Put basis in int i; // free,basic,ub,lb are 0,1,2,3 for (i = 0; i < numberRows; i++) { CoinWarmStartBasis::Status status = basis->getArtifStatus(i); info.rowStatus[i] = status; } for (i = 0; i < numberColumns; i++) { CoinWarmStartBasis::Status status = basis->getStructStatus(i); info.columnStatus[i] = status; } // put buffer into info strcpy(info.buffer, buf); delete basis; } #endif } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_STATISTICS: if (goodModel) { // If presolve on look at presolved bool deleteModel2 = false; ClpSimplex * model2 = lpSolver; if (preSolve) { ClpPresolve pinfo; int presolveOptions2 = presolveOptions&~0x40000000; if ((presolveOptions2&0xffff) != 0) pinfo.setPresolveActions(presolveOptions2); pinfo.setSubstitution(substitution); if ((printOptions&1) != 0) pinfo.statistics(); double presolveTolerance = parameters_[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters_, parameters_)].doubleValue(); model2 = pinfo.presolvedModel(*lpSolver, presolveTolerance, true, preSolve); if (model2) { printf("Statistics for presolved model\n"); deleteModel2 = true; } else { printf("Presolved model looks infeasible - will use unpresolved\n"); model2 = lpSolver; } } else { printf("Statistics for unpresolved model\n"); model2 = lpSolver; } statistics(lpSolver, model2); if (deleteModel2) delete model2; } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_TIGHTEN: if (goodModel) { int numberInfeasibilities = lpSolver->tightenPrimalBounds(); if (numberInfeasibilities) { sprintf(generalPrint,"** Analysis indicates model infeasible"); printGeneralMessage(model_,generalPrint); } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_PLUSMINUS: if (goodModel) { ClpMatrixBase * saveMatrix = lpSolver->clpMatrix(); ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(saveMatrix); if (clpMatrix) { ClpPlusMinusOneMatrix * newMatrix = new ClpPlusMinusOneMatrix(*(clpMatrix->matrix())); if (newMatrix->getIndices()) { lpSolver->replaceMatrix(newMatrix); delete saveMatrix; sprintf(generalPrint, "Matrix converted to +- one matrix"); printGeneralMessage(model_,generalPrint); } else { sprintf(generalPrint, "Matrix can not be converted to +- 1 matrix"); printGeneralMessage(model_,generalPrint); } } else { sprintf(generalPrint, "Matrix not a ClpPackedMatrix"); printGeneralMessage(model_,generalPrint); } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_OUTDUPROWS: dominatedCuts = true; #ifdef JJF_ZERO if (goodModel) { int numberRows = clpSolver->getNumRows(); //int nOut = outDupRow(clpSolver); CglDuplicateRow dupcuts(clpSolver); storedCuts = dupcuts.outDuplicates(clpSolver) != 0; int nOut = numberRows - clpSolver->getNumRows(); if (nOut && !noPrinting_) sprintf(generalPrint, "%d rows eliminated", nOut); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } #endif break; case CLP_PARAM_ACTION_NETWORK: if (goodModel) { ClpMatrixBase * saveMatrix = lpSolver->clpMatrix(); ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(saveMatrix); if (clpMatrix) { ClpNetworkMatrix * newMatrix = new ClpNetworkMatrix(*(clpMatrix->matrix())); if (newMatrix->getIndices()) { lpSolver->replaceMatrix(newMatrix); delete saveMatrix; sprintf(generalPrint, "Matrix converted to network matrix"); printGeneralMessage(model_,generalPrint); } else { sprintf(generalPrint, "Matrix can not be converted to network matrix"); printGeneralMessage(model_,generalPrint); } } else { sprintf(generalPrint, "Matrix not a ClpPackedMatrix"); printGeneralMessage(model_,generalPrint); } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CBC_PARAM_ACTION_DOHEURISTIC: if (goodModel) { #ifndef CBC_USE_INITIAL_TIME if (model_.useElapsedTime()) model_.setDblParam(CbcModel::CbcStartSeconds, CoinGetTimeOfDay()); else model_.setDblParam(CbcModel::CbcStartSeconds, CoinCpuTime()); #endif int vubAction = parameters_[whichParam(CBC_PARAM_INT_VUBTRY, numberParameters_, parameters_)].intValue(); if (vubAction != -1) { // look at vubs // extra1 is number of ints to leave free // Just ones which affect >= extra3 int extra3 = parameters_[whichParam(CBC_PARAM_INT_EXTRA3, numberParameters_, parameters_)].intValue(); /* 2 is cost above which to fix if feasible 3 is fraction of integer variables fixed if relaxing (0.97) 4 is fraction of all variables fixed if relaxing (0.0) */ double dextra[6]; int extra[5]; extra[1] = parameters_[whichParam(CBC_PARAM_INT_EXTRA1, numberParameters_, parameters_)].intValue(); int exp1 = parameters_[whichParam(CBC_PARAM_INT_EXPERIMENT, numberParameters_, parameters_)].intValue(); if (exp1 == 4 && extra[1] == -1) extra[1] = 999998; dextra[1] = parameters_[whichParam(CBC_PARAM_DBL_FAKEINCREMENT, numberParameters_, parameters_)].doubleValue(); dextra[2] = parameters_[whichParam(CBC_PARAM_DBL_FAKECUTOFF, numberParameters_, parameters_)].doubleValue(); dextra[3] = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA3, numberParameters_, parameters_)].doubleValue(); dextra[4] = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA4, numberParameters_, parameters_)].doubleValue(); dextra[5] = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA5, numberParameters_, parameters_)].doubleValue(); if (!dextra[3]) dextra[3] = 0.97; //OsiClpSolverInterface * newSolver = fixVubs(model_, extra3, vubAction, generalMessageHandler, debugValues, dextra, extra); //assert (!newSolver); } // Actually do heuristics // may need to flip objective bool needFlip = model_.solver()->getObjSense()<0.0; if (needFlip) model_.flipModel(); //if we do then - fix priorities in clonebutmodel_.convertToDynamic(); bool objectsExist = model_.objects() != NULL; if (!objectsExist) { model_.findIntegers(false); model_.convertToDynamic(); } // set priorities etc if (priorities) { OsiObject ** objects = model_.objects(); int numberObjects = model_.numberObjects(); for (int iObj = 0; iObj < numberObjects; iObj++) { CbcSimpleInteger * obj = dynamic_cast (objects[iObj]) ; if (!obj) continue; int iColumn = obj->columnNumber(); if (branchDirection) { obj->setPreferredWay(branchDirection[iColumn]); } if (priorities) { int iPriority = priorities[iColumn]; if (iPriority > 0) obj->setPriority(iPriority); } if (pseudoUp && pseudoUp[iColumn]) { CbcSimpleIntegerPseudoCost * obj1a = dynamic_cast (objects[iObj]) ; assert (obj1a); if (pseudoDown[iColumn] > 0.0) obj1a->setDownPseudoCost(pseudoDown[iColumn]); if (pseudoUp[iColumn] > 0.0) obj1a->setUpPseudoCost(pseudoUp[iColumn]); } } } doHeuristics(&model_, 2, parameters_, numberParameters_, noPrinting_, initialPumpTune); if (!objectsExist) { model_.deleteObjects(false); } if (needFlip) model_.flipModel(); if (model_.bestSolution()) { model_.setProblemStatus(1); model_.setSecondaryStatus(6); #ifdef COIN_HAS_ASL if (statusUserFunction_[0]) { double value = model_.getObjValue(); char buf[300]; int pos = 0; pos += sprintf(buf + pos, "feasible,"); info.problemStatus = 0; info.objValue = value; pos += sprintf(buf + pos, " objective %.*g", ampl_obj_prec(), value); sprintf(buf + pos, "\n0 iterations"); free(info.primalSolution); int numberColumns = lpSolver->numberColumns(); info.primalSolution = reinterpret_cast (malloc(numberColumns * sizeof(double))); CoinCopyN(model_.bestSolution(), numberColumns, info.primalSolution); int numberRows = lpSolver->numberRows(); free(info.dualSolution); info.dualSolution = reinterpret_cast (malloc(numberRows * sizeof(double))); CoinZeroN(info.dualSolution, numberRows); CoinWarmStartBasis * basis = lpSolver->getBasis(); free(info.rowStatus); info.rowStatus = reinterpret_cast (malloc(numberRows * sizeof(int))); free(info.columnStatus); info.columnStatus = reinterpret_cast (malloc(numberColumns * sizeof(int))); // Put basis in int i; // free,basic,ub,lb are 0,1,2,3 for (i = 0; i < numberRows; i++) { CoinWarmStartBasis::Status status = basis->getArtifStatus(i); info.rowStatus[i] = status; } for (i = 0; i < numberColumns; i++) { CoinWarmStartBasis::Status status = basis->getStructStatus(i); info.columnStatus[i] = status; } // put buffer into info strcpy(info.buffer, buf); delete basis; } #endif } int returnCode = callBack(&model, 6); if (returnCode) { // exit if user wants delete babModel_; babModel_ = NULL; return returnCode; } } break; case CBC_PARAM_ACTION_MIPLIB: // User can set options - main difference is lack of model and CglPreProcess goodModel = true; parameters_[whichParam(CBC_PARAM_INT_MULTIPLEROOTS, numberParameters_, parameters_)].setIntValue(0); /* Run branch-and-cut. First set a few options -- node comparison, scaling. Print elapsed time at the end. */ case CBC_PARAM_ACTION_BAB: // branchAndBound // obsolete case STRENGTHEN: if (goodModel) { bool miplib = type == CBC_PARAM_ACTION_MIPLIB; int logLevel = parameters_[slog].intValue(); int truncateColumns=COIN_INT_MAX; int truncateRows=-1; double * truncatedRhsLower=NULL; double * truncatedRhsUpper=NULL; int * newPriorities=NULL; // Reduce printout if (logLevel <= 1) { model_.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); } else { model_.solver()->setHintParam(OsiDoReducePrint, false, OsiHintTry); } { OsiSolverInterface * solver = model_.solver(); #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * si = dynamic_cast(solver) ; assert (si != NULL); si->getModelPtr()->scaling(doScaling); ClpSimplex * lpSolver = si->getModelPtr(); if (doVector) { ClpMatrixBase * matrix = lpSolver->clpMatrix(); if (dynamic_cast< ClpPackedMatrix*>(matrix)) { ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); clpMatrix->makeSpecialColumnCopy(); } } #elif CBC_OTHER_SOLVER==1 OsiCpxSolverInterface * si = dynamic_cast(solver) ; assert (si != NULL); #endif statistics_nrows = si->getNumRows(); statistics_ncols = si->getNumCols(); statistics_nprocessedrows = si->getNumRows(); statistics_nprocessedcols = si->getNumCols(); // See if quadratic #ifndef CBC_OTHER_SOLVER #ifdef COIN_HAS_LINK if (!complicatedInteger) { ClpQuadraticObjective * obj = (dynamic_cast< ClpQuadraticObjective*>(lpSolver->objectiveAsObject())); if (obj) { preProcess = 0; int testOsiOptions = parameters_[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters_, parameters_)].intValue(); parameters_[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters_, parameters_)].setIntValue(CoinMax(0, testOsiOptions)); // create coin model coinModel = lpSolver->createCoinModel(); assert (coinModel); // load from coin model OsiSolverLink solver1; OsiSolverInterface * solver2 = solver1.clone(); model_.assignSolver(solver2, false); OsiSolverLink * si = dynamic_cast(model_.solver()) ; assert (si != NULL); si->setDefaultMeshSize(0.001); // need some relative granularity si->setDefaultBound(100.0); double dextra3 = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA3, numberParameters_, parameters_)].doubleValue(); if (dextra3) si->setDefaultMeshSize(dextra3); si->setDefaultBound(1000.0); si->setIntegerPriority(1000); si->setBiLinearPriority(10000); biLinearProblem=true; si->setSpecialOptions2(2 + 4 + 8); CoinModel * model2 = coinModel; si->load(*model2, true, parameters_[log].intValue()); // redo solver = model_.solver(); clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); lpSolver = clpSolver->getModelPtr(); clpSolver->messageHandler()->setLogLevel(0) ; testOsiParameters = 0; complicatedInteger = 2; // allow cuts OsiSolverInterface * coinSolver = model_.solver(); OsiSolverLink * linkSolver = dynamic_cast< OsiSolverLink*> (coinSolver); if (linkSolver->quadraticModel()) { ClpSimplex * qp = linkSolver->quadraticModel(); //linkSolver->nonlinearSLP(CoinMax(slpValue,10),1.0e-5); qp->nonlinearSLP(CoinMax(slpValue, 40), 1.0e-5); qp->primal(1); OsiSolverLinearizedQuadratic solver2(qp); const double * solution = NULL; // Reduce printout solver2.setHintParam(OsiDoReducePrint, true, OsiHintTry); CbcModel model2(solver2); // Now do requested saves and modifications CbcModel * cbcModel = & model2; OsiSolverInterface * osiModel = model2.solver(); OsiClpSolverInterface * osiclpModel = dynamic_cast< OsiClpSolverInterface*> (osiModel); ClpSimplex * clpModel = osiclpModel->getModelPtr(); // Set changed values CglProbing probing; probing.setMaxProbe(10); probing.setMaxLook(10); probing.setMaxElements(200); probing.setMaxProbeRoot(50); probing.setMaxLookRoot(10); probing.setRowCuts(3); probing.setUsingObjective(true); cbcModel->addCutGenerator(&probing, -1, "Probing", true, false, false, -100, -1, -1); cbcModel->cutGenerator(0)->setTiming(true); CglGomory gomory; gomory.setLimitAtRoot(512); cbcModel->addCutGenerator(&gomory, -98, "Gomory", true, false, false, -100, -1, -1); cbcModel->cutGenerator(1)->setTiming(true); CglKnapsackCover knapsackCover; cbcModel->addCutGenerator(&knapsackCover, -98, "KnapsackCover", true, false, false, -100, -1, -1); cbcModel->cutGenerator(2)->setTiming(true); CglRedSplit redSplit; cbcModel->addCutGenerator(&redSplit, -99, "RedSplit", true, false, false, -100, -1, -1); cbcModel->cutGenerator(3)->setTiming(true); CglClique clique; clique.setStarCliqueReport(false); clique.setRowCliqueReport(false); clique.setMinViolation(0.1); cbcModel->addCutGenerator(&clique, -98, "Clique", true, false, false, -100, -1, -1); cbcModel->cutGenerator(4)->setTiming(true); CglMixedIntegerRounding2 mixedIntegerRounding2; cbcModel->addCutGenerator(&mixedIntegerRounding2, -98, "MixedIntegerRounding2", true, false, false, -100, -1, -1); cbcModel->cutGenerator(5)->setTiming(true); CglFlowCover flowCover; cbcModel->addCutGenerator(&flowCover, -98, "FlowCover", true, false, false, -100, -1, -1); cbcModel->cutGenerator(6)->setTiming(true); CglTwomir twomir; twomir.setMaxElements(250); cbcModel->addCutGenerator(&twomir, -99, "Twomir", true, false, false, -100, -1, -1); cbcModel->cutGenerator(7)->setTiming(true); CbcHeuristicFPump heuristicFPump(*cbcModel); heuristicFPump.setWhen(13); heuristicFPump.setMaximumPasses(20); heuristicFPump.setMaximumRetries(7); heuristicFPump.setHeuristicName("feasibility pump"); heuristicFPump.setInitialWeight(1); heuristicFPump.setFractionSmall(0.6); cbcModel->addHeuristic(&heuristicFPump); CbcRounding rounding(*cbcModel); rounding.setHeuristicName("rounding"); cbcModel->addHeuristic(&rounding); CbcHeuristicLocal heuristicLocal(*cbcModel); heuristicLocal.setHeuristicName("combine solutions"); heuristicLocal.setSearchType(1); heuristicLocal.setFractionSmall(0.6); cbcModel->addHeuristic(&heuristicLocal); CbcHeuristicGreedyCover heuristicGreedyCover(*cbcModel); heuristicGreedyCover.setHeuristicName("greedy cover"); cbcModel->addHeuristic(&heuristicGreedyCover); CbcHeuristicGreedyEquality heuristicGreedyEquality(*cbcModel); heuristicGreedyEquality.setHeuristicName("greedy equality"); cbcModel->addHeuristic(&heuristicGreedyEquality); CbcCompareDefault compare; cbcModel->setNodeComparison(compare); cbcModel->setNumberBeforeTrust(5); cbcModel->setSpecialOptions(2); cbcModel->messageHandler()->setLogLevel(1); cbcModel->setMaximumCutPassesAtRoot(-100); cbcModel->setMaximumCutPasses(1); cbcModel->setMinimumDrop(0.05); // For branchAndBound this may help clpModel->defaultFactorizationFrequency(); clpModel->setDualBound(1.0001e+08); clpModel->setPerturbation(50); osiclpModel->setSpecialOptions(193); osiclpModel->messageHandler()->setLogLevel(0); osiclpModel->setIntParam(OsiMaxNumIterationHotStart, 100); osiclpModel->setHintParam(OsiDoReducePrint, true, OsiHintTry); // You can save some time by switching off message building // clpModel->messagesPointer()->setDetailMessages(100,10000,(int *) NULL); // Solve cbcModel->initialSolve(); if (clpModel->tightenPrimalBounds() != 0) { sprintf(generalPrint, "Problem is infeasible - tightenPrimalBounds!"); printGeneralMessage(model_,generalPrint); break; } clpModel->dual(); // clean up cbcModel->initialSolve(); #ifdef CBC_THREAD int numberThreads = parameters_[whichParam(CBC_PARAM_INT_THREADS, numberParameters_, parameters_)].intValue(); cbcModel->setNumberThreads(numberThreads % 100); cbcModel->setThreadMode(CoinMin(numberThreads / 100, 7)); #endif //setCutAndHeuristicOptions(*cbcModel); cbcModel->branchAndBound(); OsiSolverLinearizedQuadratic * solver3 = dynamic_cast (model2.solver()); assert (solver3); solution = solver3->bestSolution(); double bestObjectiveValue = solver3->bestObjectiveValue(); linkSolver->setBestObjectiveValue(bestObjectiveValue); if (solution) { linkSolver->setBestSolution(solution, solver3->getNumCols()); } CbcHeuristicDynamic3 dynamic(model_); dynamic.setHeuristicName("dynamic pass thru"); model_.addHeuristic(&dynamic); // if convex if ((linkSolver->specialOptions2()&4) != 0 && solution) { int numberColumns = coinModel->numberColumns(); assert (linkSolver->objectiveVariable() == numberColumns); // add OA cut double offset; double * gradient = new double [numberColumns+1]; memcpy(gradient, qp->objectiveAsObject()->gradient(qp, solution, offset, true, 2), numberColumns*sizeof(double)); double rhs = 0.0; int * column = new int[numberColumns+1]; int n = 0; for (int i = 0; i < numberColumns; i++) { double value = gradient[i]; if (fabs(value) > 1.0e-12) { gradient[n] = value; rhs += value * solution[i]; column[n++] = i; } } gradient[n] = -1.0; column[n++] = numberColumns; storedAmpl.addCut(-COIN_DBL_MAX, offset + 1.0e-7, n, column, gradient); delete [] gradient; delete [] column; } // could do three way branching round a) continuous b) best solution printf("obj %g\n", bestObjectiveValue); linkSolver->initialSolve(); } } } #endif #endif if (logLevel <= 1) si->setHintParam(OsiDoReducePrint, true, OsiHintTry); #ifndef CBC_OTHER_SOLVER si->setSpecialOptions(0x40000000); #endif } if (!miplib) { if (!preSolve) { model_.solver()->setHintParam(OsiDoPresolveInInitial, false, OsiHintTry); model_.solver()->setHintParam(OsiDoPresolveInResolve, false, OsiHintTry); } double time1a = CoinCpuTime(); OsiSolverInterface * solver = model_.solver(); #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * si = dynamic_cast(solver) ; if (si) si->setSpecialOptions(si->specialOptions() | 1024); #endif model_.initialSolve(); #ifndef CBC_OTHER_SOLVER ClpSimplex * clpSolver = si->getModelPtr(); int iStatus = clpSolver->status(); int iStatus2 = clpSolver->secondaryStatus(); if (iStatus == 0) { iStatus2 = 0; } else if (iStatus == 1) { iStatus = 0; iStatus2 = 1; // say infeasible } else if (iStatus == 2) { iStatus = 0; iStatus2 = 7; // say unbounded } else if (iStatus == 3) { iStatus = 1; if (iStatus2 == 9) iStatus2 = 4; else iStatus2 = 3; // Use nodes - as closer than solutions } else if (iStatus == 4) { iStatus = 2; // difficulties iStatus2 = 0; } model_.setProblemStatus(iStatus); model_.setSecondaryStatus(iStatus2); si->setWarmStart(NULL); int returnCode = callBack(&model_, 1); if (returnCode) { // exit if user wants delete babModel_; babModel_ = NULL; return returnCode; } if (clpSolver->status() > 0) { // and in babModel if exists if (babModel_) { babModel_->setProblemStatus(iStatus); babModel_->setSecondaryStatus(iStatus2); } if (!noPrinting_) { iStatus = clpSolver->status(); const char * msg[] = {"infeasible", "unbounded", "stopped", "difficulties", "other" }; sprintf(generalPrint, "Problem is %s - %.2f seconds", msg[iStatus-1], CoinCpuTime() - time1a); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } break; } clpSolver->setSpecialOptions(clpSolver->specialOptions() | IN_BRANCH_AND_BOUND); // say is Cbc (and in branch and bound) #elif CBC_OTHER_SOLVER==1 #endif if (!noPrinting_) { sprintf(generalPrint, "Continuous objective value is %g - %.2f seconds", solver->getObjValue(), CoinCpuTime() - time1a); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } if (model_.getMaximumNodes() == -987654321) { // See if No objective! int numberColumns = clpSolver->getNumCols(); const double * obj = clpSolver->getObjCoefficients(); const double * lower = clpSolver->getColLower(); const double * upper = clpSolver->getColUpper(); int nObj = 0; for (int i = 0; i < numberColumns; i++) { if (upper[i] > lower[i] && obj[i]) nObj++; } if (!nObj) { printf("************No objective!!\n"); model_.setMaximumSolutions(1); // Column copy CoinPackedMatrix matrixByCol(*model_.solver()->getMatrixByCol()); //const double * element = matrixByCol.getElements(); //const int * row = matrixByCol.getIndices(); //const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol.getVectorLengths(); for (int i = 0; i < numberColumns; i++) { double value = (CoinDrand48() + 0.5) * 10000; value = 10; value *= columnLength[i]; int iValue = static_cast (value) / 10; //iValue=1; clpSolver->setObjCoeff(i, iValue); } } } #ifndef CBC_OTHER_SOLVER if (!complicatedInteger && preProcess == 0 && clpSolver->tightenPrimalBounds(0.0, 0, true) != 0) { sprintf(generalPrint, "Problem is infeasible - tightenPrimalBounds!"); printGeneralMessage(model_,generalPrint); model_.setProblemStatus(0); model_.setSecondaryStatus(1); // say infeasible for solution integerStatus = 6; // and in babModel if exists if (babModel_) { babModel_->setProblemStatus(0); babModel_->setSecondaryStatus(1); } break; } if (clpSolver->dualBound() == 1.0e10) { ClpSimplex temp = *clpSolver; temp.setLogLevel(0); temp.dual(0, 7); // user did not set - so modify // get largest scaled away from bound double largest = 1.0e-12; double largestScaled = 1.0e-12; int numberRows = temp.numberRows(); const double * rowPrimal = temp.primalRowSolution(); const double * rowLower = temp.rowLower(); const double * rowUpper = temp.rowUpper(); const double * rowScale = temp.rowScale(); int iRow; for (iRow = 0; iRow < numberRows; iRow++) { double value = rowPrimal[iRow]; double above = value - rowLower[iRow]; double below = rowUpper[iRow] - value; if (above < 1.0e12) { largest = CoinMax(largest, above); } if (below < 1.0e12) { largest = CoinMax(largest, below); } if (rowScale) { double multiplier = rowScale[iRow]; above *= multiplier; below *= multiplier; } if (above < 1.0e12) { largestScaled = CoinMax(largestScaled, above); } if (below < 1.0e12) { largestScaled = CoinMax(largestScaled, below); } } int numberColumns = temp.numberColumns(); const double * columnPrimal = temp.primalColumnSolution(); const double * columnLower = temp.columnLower(); const double * columnUpper = temp.columnUpper(); const double * columnScale = temp.columnScale(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = columnPrimal[iColumn]; double above = value - columnLower[iColumn]; double below = columnUpper[iColumn] - value; if (above < 1.0e12) { largest = CoinMax(largest, above); } if (below < 1.0e12) { largest = CoinMax(largest, below); } if (columnScale) { double multiplier = 1.0 / columnScale[iColumn]; above *= multiplier; below *= multiplier; } if (above < 1.0e12) { largestScaled = CoinMax(largestScaled, above); } if (below < 1.0e12) { largestScaled = CoinMax(largestScaled, below); } } #ifdef COIN_DEVELOP if (!noPrinting_) std::cout << "Largest (scaled) away from bound " << largestScaled << " unscaled " << largest << std::endl; #endif clpSolver->setDualBound(CoinMax(1.0001e8, CoinMin(100.0*largest, 1.00001e10))); } si->resolve(); // clean up #endif } // If user made settings then use them if (!defaultSettings) { OsiSolverInterface * solver = model_.solver(); if (!doScaling) solver->setHintParam(OsiDoScale, false, OsiHintTry); #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * si = dynamic_cast(solver) ; assert (si != NULL); // get clp itself ClpSimplex * modelC = si->getModelPtr(); //if (modelC->tightenPrimalBounds()!=0) { //std::cout<<"Problem is infeasible!"<tightenPrimalBounds(tightenFactor) != 0) { sprintf(generalPrint, "Problem is infeasible!"); printGeneralMessage(model_,generalPrint); model_.setProblemStatus(0); model_.setSecondaryStatus(1); // and in babModel if exists if (babModel_) { babModel_->setProblemStatus(0); babModel_->setSecondaryStatus(1); } break; } } #endif } // See if we want preprocessing OsiSolverInterface * saveSolver = NULL; CglPreProcess process; // Say integers in sync bool integersOK = true; delete babModel_; babModel_ = new CbcModel(model_); #ifndef CBC_OTHER_SOLVER int numberChanged = 0; OsiSolverInterface * solver3 = clpSolver->clone(); babModel_->assignSolver(solver3); OsiClpSolverInterface * clpSolver2 = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); if (clpSolver2->messageHandler()->logLevel()) clpSolver2->messageHandler()->setLogLevel(1); if (logLevel > -1) clpSolver2->messageHandler()->setLogLevel(logLevel); lpSolver = clpSolver2->getModelPtr(); if (lpSolver->factorizationFrequency() == 200 && !miplib) { // User did not touch preset int numberRows = lpSolver->numberRows(); const int cutoff1 = 10000; const int cutoff2 = 100000; const int base = 75; const int freq0 = 50; const int freq1 = 200; const int freq2 = 400; const int maximum = 1000; int frequency; if (numberRows < cutoff1) frequency = base + numberRows / freq0; else if (numberRows < cutoff2) frequency = base + cutoff1 / freq0 + (numberRows - cutoff1) / freq1; else frequency = base + cutoff1 / freq0 + (cutoff2 - cutoff1) / freq1 + (numberRows - cutoff2) / freq2; lpSolver->setFactorizationFrequency(CoinMin(maximum, frequency)); } #elif CBC_OTHER_SOLVER==1 OsiSolverInterface * solver3 = model_.solver()->clone(); babModel_->assignSolver(solver3); #endif time2 = CoinCpuTime(); totalTime += time2 - time1; //time1 = time2; double timeLeft = babModel_->getMaximumSeconds(); int numberOriginalColumns = babModel_->solver()->getNumCols(); if (preProcess == 7) { // use strategy instead preProcess = 0; useStrategy = true; #ifdef COIN_HAS_LINK // empty out any cuts if (storedAmpl.sizeRowCuts()) { printf("Emptying ampl stored cuts as internal preprocessing\n"); CglStored temp; storedAmpl = temp; } #endif } if (preProcess && type == CBC_PARAM_ACTION_BAB) { // see whether to switch off preprocessing // only allow SOS and integer OsiObject ** objects = babModel_->objects(); int numberObjects = babModel_->numberObjects(); for (int iObj = 0; iObj < numberObjects; iObj++) { CbcSOS * objSOS = dynamic_cast (objects[iObj]) ; CbcSimpleInteger * objSimpleInteger = dynamic_cast (objects[iObj]) ; if (!objSimpleInteger&&!objSOS) { // find all integers anyway babModel_->findIntegers(true); preProcess=0; break; } } } if (type == CBC_PARAM_ACTION_BAB) { double limit; clpSolver->getDblParam(OsiDualObjectiveLimit, limit); if (clpSolver->getObjValue()*clpSolver->getObjSense() >= limit*clpSolver->getObjSense()) preProcess = 0; } if (mipStartBefore.size()) { CbcModel tempModel=*babModel_; assert (babModel_->getNumCols()==model_.getNumCols()); std::vector< std::string > colNames; for ( int i=0 ; (igetNumCols()) ; ++i ) colNames.push_back( model_.solver()->getColName(i) ); std::vector< double > x( model_.getNumCols(), 0.0 ); double obj; int status = computeCompleteSolution( &tempModel, colNames, mipStartBefore, &x[0], obj ); // set cutoff if (!status) { babModel_->setCutoff(CoinMin(babModel_->getCutoff(),obj+1.0e-4)); babModel_->setBestSolution( &x[0], static_cast(x.size()), obj, false ); babModel_->setSolutionCount(1); model_.setCutoff(CoinMin(model_.getCutoff(),obj+1.0e-4)); model_.setBestSolution( &x[0], static_cast(x.size()), obj, false ); model_.setSolutionCount(1); } } if (preProcess && type == CBC_PARAM_ACTION_BAB) { #ifndef CBC_OTHER_SOLVER // See if sos from mps file if (numberSOS == 0 && clpSolver->numberSOS() && doSOS) { // SOS numberSOS = clpSolver->numberSOS(); const CoinSet * setInfo = clpSolver->setInfo(); sosStart = new int [numberSOS+1]; sosType = new char [numberSOS]; int i; int nTotal = 0; sosStart[0] = 0; for ( i = 0; i < numberSOS; i++) { int type = setInfo[i].setType(); int n = setInfo[i].numberEntries(); sosType[i] = static_cast(type); nTotal += n; sosStart[i+1] = nTotal; } sosIndices = new int[nTotal]; sosReference = new double [nTotal]; for (i = 0; i < numberSOS; i++) { int n = setInfo[i].numberEntries(); const int * which = setInfo[i].which(); const double * weights = setInfo[i].weights(); int base = sosStart[i]; for (int j = 0; j < n; j++) { int k = which[j]; sosIndices[j+base] = k; sosReference[j+base] = weights ? weights[j] : static_cast (j); } } } #endif saveSolver = babModel_->solver()->clone(); /* Do not try and produce equality cliques and do up to 10 passes */ OsiSolverInterface * solver2; { // Tell solver we are in Branch and Cut saveSolver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo) ; // Default set of cut generators CglProbing generator1; generator1.setUsingObjective(1); generator1.setMaxPass(1); generator1.setMaxPassRoot(1); generator1.setMaxProbeRoot(CoinMin(3000, saveSolver->getNumCols())); generator1.setMaxElements(100); generator1.setMaxElementsRoot(200); generator1.setMaxLookRoot(50); if (saveSolver->getNumCols() > 3000) generator1.setMaxProbeRoot(123); generator1.setRowCuts(3); if ((tunePreProcess&1) != 0) { // heavy probing generator1.setMaxPassRoot(2); generator1.setMaxElements(1000); generator1.setMaxProbeRoot(saveSolver->getNumCols()); generator1.setMaxLookRoot(saveSolver->getNumCols()); } if ((babModel_->specialOptions()&65536) != 0) process.setOptions(1); // Add in generators if ((model_.moreSpecialOptions()&65536)==0) process.addCutGenerator(&generator1); int translate[] = {9999, 0, 0, -3, 2, 3, -2, 9999, 4, 5}; process.passInMessageHandler(babModel_->messageHandler()); //process.messageHandler()->setLogLevel(babModel_->logLevel()); #ifdef COIN_HAS_ASL if (info.numberSos && doSOS && statusUserFunction_[0]) { // SOS numberSOS = info.numberSos; sosStart = info.sosStart; sosIndices = info.sosIndices; } #endif if (numberSOS && doSOS) { // SOS int numberColumns = saveSolver->getNumCols(); char * prohibited = new char[numberColumns]; memset(prohibited, 0, numberColumns); int n = sosStart[numberSOS]; for (int i = 0; i < n; i++) { int iColumn = sosIndices[i]; prohibited[iColumn] = 1; } process.passInProhibited(prohibited, numberColumns); delete [] prohibited; } if (0) { // Special integers int numberColumns = saveSolver->getNumCols(); char * prohibited = new char[numberColumns]; memset(prohibited, 0, numberColumns); const CoinPackedMatrix * matrix = saveSolver->getMatrixByCol(); const int * columnLength = matrix->getVectorLengths(); int numberProhibited=0; for (int iColumn = numberColumns-1; iColumn >=0; iColumn--) { if (!saveSolver->isInteger(iColumn)|| columnLength[iColumn]>1) break; numberProhibited++; prohibited[iColumn] = 1; } if (numberProhibited) { process.passInProhibited(prohibited, numberColumns); printf("**** Treating last %d integers as special - give high priority?\n",numberProhibited); } delete [] prohibited; } if (!model_.numberObjects() && true) { /* model may not have created objects If none then create */ model_.findIntegers(true); } if (model_.numberObjects()) { OsiObject ** oldObjects = babModel_->objects(); int numberOldObjects = babModel_->numberObjects(); if (!numberOldObjects) { oldObjects = model_.objects(); numberOldObjects = model_.numberObjects(); } // SOS int numberColumns = saveSolver->getNumCols(); char * prohibited = new char[numberColumns]; memset(prohibited, 0, numberColumns); int numberProhibited = 0; for (int iObj = 0; iObj < numberOldObjects; iObj++) { CbcSOS * obj = dynamic_cast (oldObjects[iObj]) ; if (obj) { int n = obj->numberMembers(); const int * which = obj->members(); for (int i = 0; i < n; i++) { int iColumn = which[i]; prohibited[iColumn] = 1; numberProhibited++; } } CbcLotsize * obj2 = dynamic_cast (oldObjects[iObj]) ; if (obj2) { int iColumn = obj2->columnNumber(); prohibited[iColumn] = 1; numberProhibited++; } } if (numberProhibited) process.passInProhibited(prohibited, numberColumns); delete [] prohibited; } int numberPasses = 10; #ifndef CBC_OTHER_SOLVER if (doSprint > 0) { // Sprint for primal solves ClpSolve::SolveType method = ClpSolve::usePrimalorSprint; ClpSolve::PresolveType presolveType = ClpSolve::presolveOff; int numberPasses = 5; int options[] = {0, 3, 0, 0, 0, 0}; int extraInfo[] = { -1, 20, -1, -1, -1, -1}; extraInfo[1] = doSprint; int independentOptions[] = {0, 0, 3}; ClpSolve clpSolve(method, presolveType, numberPasses, options, extraInfo, independentOptions); // say use in OsiClp clpSolve.setSpecialOption(6, 1); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (saveSolver); osiclp->setSolveOptions(clpSolve); osiclp->setHintParam(OsiDoDualInResolve, false); // switch off row copy osiclp->getModelPtr()->setSpecialOptions(osiclp->getModelPtr()->specialOptions() | 256); osiclp->getModelPtr()->setInfeasibilityCost(1.0e11); } #endif #ifndef CBC_OTHER_SOLVER { OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (saveSolver); osiclp->setSpecialOptions(osiclp->specialOptions() | 1024); int savePerturbation = osiclp->getModelPtr()->perturbation(); //#define CBC_TEMP1 #ifdef CBC_TEMP1 if (savePerturbation == 50) osiclp->getModelPtr()->setPerturbation(52); // try less #endif if ((model_.moreSpecialOptions()&65536)!=0) process.setOptions(2+4+8); // no cuts cbcPreProcessPointer = & process; int saveOptions = osiclp->getModelPtr()->moreSpecialOptions(); if ((model_.specialOptions()&16777216)!=0&& model_.getCutoff()>1.0e30) { osiclp->getModelPtr()->setMoreSpecialOptions(saveOptions|262144); } solver2 = process.preProcessNonDefault(*saveSolver, translate[preProcess], numberPasses, tunePreProcess); /*solver2->writeMps("after"); saveSolver->writeMps("before");*/ osiclp->getModelPtr()->setPerturbation(savePerturbation); osiclp->getModelPtr()->setMoreSpecialOptions(saveOptions); } #elif CBC_OTHER_SOLVER==1 cbcPreProcessPointer = & process; solver2 = process.preProcessNonDefault(*saveSolver, translate[preProcess], numberPasses, tunePreProcess); #endif integersOK = false; // We need to redo if CbcObjects exist // Tell solver we are not in Branch and Cut saveSolver->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; if (solver2) solver2->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; } #ifdef COIN_HAS_ASL if (!solver2 && statusUserFunction_[0]) { // infeasible info.problemStatus = 1; info.objValue = 1.0e100; sprintf(info.buffer, "infeasible/unbounded by pre-processing"); info.primalSolution = NULL; info.dualSolution = NULL; break; } #endif if (!noPrinting_) { if (!solver2) { sprintf(generalPrint, "Pre-processing says infeasible or unbounded"); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } else { //printf("processed model has %d rows, %d columns and %d elements\n", // solver2->getNumRows(),solver2->getNumCols(),solver2->getNumElements()); } } if (!solver2) { // say infeasible for solution integerStatus = 6; delete saveSolver; saveSolver=NULL; model_.setProblemStatus(0); model_.setSecondaryStatus(1); babModel_->setProblemStatus(0); babModel_->setSecondaryStatus(1); } else { statistics_nprocessedrows = solver2->getNumRows(); statistics_nprocessedcols = solver2->getNumCols(); model_.setProblemStatus(-1); babModel_->setProblemStatus(-1); } int returnCode = callBack(babModel_, 2); if (returnCode) { // exit if user wants delete babModel_; babModel_ = NULL; return returnCode; } if (!solver2) break; if (model_.bestSolution()) { // need to redo - in case no better found in BAB // just get integer part right const int * originalColumns = process.originalColumns(); int numberColumns = solver2->getNumCols(); double * bestSolution = babModel_->bestSolution(); const double * oldBestSolution = model_.bestSolution(); for (int i = 0; i < numberColumns; i++) { int jColumn = originalColumns[i]; bestSolution[i] = oldBestSolution[jColumn]; } } //solver2->resolve(); if (preProcess == 2) { OsiClpSolverInterface * clpSolver2 = dynamic_cast< OsiClpSolverInterface*> (solver2); ClpSimplex * lpSolver = clpSolver2->getModelPtr(); lpSolver->writeMps("presolved.mps", 2, 1, lpSolver->optimizationDirection()); printf("Preprocessed model (minimization) on presolved.mps\n"); } { // look at new integers int numberOriginalColumns = process.originalModel()->getNumCols(); const int * originalColumns = process.originalColumns(); OsiClpSolverInterface * osiclp2 = dynamic_cast< OsiClpSolverInterface*> (solver2); int numberColumns = osiclp2->getNumCols(); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (saveSolver); for (int i = 0; i < numberColumns; i++) { int iColumn = originalColumns[i]; if (iColumn < numberOriginalColumns) { if (osiclp2->isInteger(i) && !osiclp->isInteger(iColumn)) osiclp2->setOptionalInteger(i); // say optional } } } // we have to keep solver2 so pass clone solver2 = solver2->clone(); // see if extra variables wanted int threshold = parameters_[whichParam(CBC_PARAM_INT_EXTRA_VARIABLES, numberParameters_, parameters_)].intValue(); int more2 = parameters_[whichParam(CBC_PARAM_INT_MOREMOREMIPOPTIONS, numberParameters_, parameters_)].intValue(); if (threshold || (more2&(512|1024)) != 0) { int numberColumns = solver2->getNumCols(); truncateRows = solver2->getNumRows(); bool modifiedModel=false; int highPriority=0; /* normal - no priorities >10000 equal high priority >20000 higher priority for higher cost */ if (threshold>10000) { highPriority=threshold/10000; threshold -= 10000*highPriority; } const double * columnLower = solver2->getColLower(); const double * columnUpper = solver2->getColUpper(); const double * objective = solver2->getObjCoefficients(); int numberIntegers = 0; int numberBinary = 0; int numberTotalIntegers=0; double * obj = new double [numberColumns]; int * which = new int [numberColumns]; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (solver2->isInteger(iColumn)) { numberTotalIntegers++; if (columnUpper[iColumn] > columnLower[iColumn]) { numberIntegers++; if (columnLower[iColumn] == 0.0 && columnUpper[iColumn] == 1) numberBinary++; } } } int numberSort=0; int numberZero=0; int numberZeroContinuous=0; int numberDifferentObj=0; int numberContinuous=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn]) { if (solver2->isInteger(iColumn)) { if (!objective[iColumn]) { numberZero++; } else { obj[numberSort]= fabs(objective[iColumn]); which[numberSort++]=iColumn; } } else if (objective[iColumn]) { numberContinuous++; } else { numberZeroContinuous++; } } } CoinSort_2(obj,obj+numberSort,which); double last=obj[0]; for (int jColumn = 1; jColumn < numberSort; jColumn++) { if (fabs(obj[jColumn]-last)>1.0e-12) { numberDifferentObj++; last=obj[jColumn]; } } numberDifferentObj++; sprintf(generalPrint,"Problem has %d integers (%d of which binary) and %d continuous", numberIntegers,numberBinary,numberColumns-numberIntegers); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; if (numberColumns>numberIntegers) { sprintf(generalPrint,"%d continuous have nonzero objective, %d have zero objective", numberContinuous,numberZeroContinuous); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } sprintf(generalPrint,"%d integer have nonzero objective, %d have zero objective, %d different nonzero (taking abs)", numberSort,numberZero,numberDifferentObj); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; if (numberDifferentObj<=threshold + (numberZero) ? 1 : 0 && numberDifferentObj) { int * backward=NULL; if (highPriority) { newPriorities = new int [numberTotalIntegers+numberDifferentObj+numberColumns]; backward=newPriorities+numberTotalIntegers+numberDifferentObj; numberTotalIntegers=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (solver2->isInteger(iColumn)) { backward[iColumn]=numberTotalIntegers; newPriorities[numberTotalIntegers++]=10000; } } } int iLast=0; double last=obj[0]; for (int jColumn = 1; jColumn < numberSort; jColumn++) { if (fabs(obj[jColumn]-last)>1.0e-12) { sprintf(generalPrint,"%d variables have objective of %g", jColumn-iLast,last); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; iLast=jColumn; last=obj[jColumn]; } } sprintf(generalPrint,"%d variables have objective of %g", numberSort-iLast,last); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; int spaceNeeded=numberSort+numberDifferentObj; int * columnAdd = new int[spaceNeeded+numberDifferentObj+1]; double * elementAdd = new double[spaceNeeded]; int * rowAdd = new int[numberDifferentObj+1]; double * objectiveNew = new double[3*numberDifferentObj]; double * lowerNew = objectiveNew+numberDifferentObj; double * upperNew = lowerNew+numberDifferentObj; memset(columnAdd+spaceNeeded,0, (numberDifferentObj+1)*sizeof(int)); iLast=0; last=obj[0]; numberDifferentObj=0; int priorityLevel=9999; int numberElements=0; rowAdd[0]=0; for (int jColumn = 1; jColumn < numberSort+1; jColumn++) { if (jColumn==numberSort||fabs(obj[jColumn]-last)>1.0e-12) { // not if just one if (jColumn-iLast>1) { // do priority if (highPriority==1) { newPriorities[numberTotalIntegers+numberDifferentObj] = 500; } else if (highPriority==2) { newPriorities[numberTotalIntegers+numberDifferentObj] = priorityLevel; priorityLevel--; } int iColumn=which[iLast]; objectiveNew[numberDifferentObj]=objective[iColumn]; double lower=0.0; double upper=0.0; for (int kColumn=iLast;kColumnsetObjCoeff(iColumn,0.0); double lowerValue=columnLower[iColumn]; double upperValue=columnUpper[iColumn]; double elementValue=-1.0; if (objectiveNew[numberDifferentObj]*objective[iColumn]<0.0) { lowerValue=-columnUpper[iColumn]; upperValue=-columnLower[iColumn]; elementValue=1.0; } columnAdd[numberElements]=iColumn; elementAdd[numberElements++]=elementValue; if (lower!=-COIN_DBL_MAX) { if (lowerValue!=-COIN_DBL_MAX) lower += lowerValue; else lower=-COIN_DBL_MAX; } if (upper!=COIN_DBL_MAX) { if (upperValue!=COIN_DBL_MAX) upper += upperValue; else upper=COIN_DBL_MAX; } } columnAdd[numberElements]=numberColumns+numberDifferentObj; elementAdd[numberElements++]=1.0; lowerNew[numberDifferentObj]=lower; upperNew[numberDifferentObj]=upper; numberDifferentObj++; rowAdd[numberDifferentObj]=numberElements; } else if (highPriority) { // just one // do priority int iColumn=which[iLast]; int iInt=backward[iColumn]; if (highPriority==1) { newPriorities[iInt] = 500; } else { newPriorities[iInt] = priorityLevel; priorityLevel--; } } if (jColumnaddCols(numberDifferentObj, columnAdd+spaceNeeded, NULL, NULL, lowerNew, upperNew,objectiveNew); // add constraints and make integer if all integer in group for (int iObj=0; iObj < numberDifferentObj; iObj++) { lowerNew[iObj]=0.0; upperNew[iObj]=0.0; solver2->setInteger(numberColumns+iObj); } solver2->addRows(numberDifferentObj, rowAdd,columnAdd,elementAdd, lowerNew, upperNew); sprintf(generalPrint,"Replacing model - %d new variables",numberDifferentObj); modifiedModel=true; } delete [] columnAdd; delete [] elementAdd; delete [] rowAdd; delete [] objectiveNew; } delete [] which; delete [] obj; if ((more2&(512|1024)) != 0) { // try for row slacks etc // later do row branching int iRow, iColumn; int numberColumns = solver2->getNumCols(); int numberRows = solver2->getNumRows(); int fudgeObjective = more2&512; int addSlacks = more2&1024; if (fudgeObjective) { bool moveObj = false; fudgeObjective = 0; const double * objective = solver2->getObjCoefficients(); const double * columnLower = solver2->getColLower(); const double * columnUpper = solver2->getColUpper(); double * newValues = new double [numberColumns+1]; int * newColumn = new int [numberColumns+1]; bool allInteger=true; int n=0; double newLower = 0.0; double newUpper = 0.0; for (iColumn=0;iColumnisInteger(iColumn)) { allInteger=false; break; } else { double value = objective[iColumn]; double nearest = floor(value+0.5); if (fabs(value-nearest)>1.0e-8) { allInteger=false; break; } else { newValues[n]=nearest; newColumn[n++]=iColumn; if (nearest>0.0) { newLower += CoinMax(columnLower[iColumn],-1.0e20)*nearest; newUpper += CoinMin(columnUpper[iColumn],1.0e20)*nearest; } else { newUpper += CoinMax(columnLower[iColumn],-1.0e20)*nearest; newLower += CoinMin(columnUpper[iColumn],1.0e20)*nearest; } } } } } if (allInteger && n) { fudgeObjective = n; solver2->addCol(0,NULL,NULL,newLower,newUpper,0.0,"obj_col"); solver2->setInteger(numberColumns); newValues[n]=-1.0; newColumn[n++]=numberColumns; solver2->addRow(n,newColumn,newValues,0.0,0.0); if (moveObj) { memset(newValues,0,numberColumns*sizeof(double)); newValues[numberColumns]=1.0; solver2->setObjective(newValues); } numberRows++; numberColumns++; } delete [] newValues; delete [] newColumn; } if (addSlacks) { bool moveObj = false; addSlacks=0; // get row copy const CoinPackedMatrix * matrix = solver2->getMatrixByRow(); const double * element = matrix->getElements(); const int * column = matrix->getIndices(); const CoinBigIndex * rowStart = matrix->getVectorStarts(); const int * rowLength = matrix->getVectorLengths(); const double * rowLower = solver2->getRowLower(); const double * rowUpper = solver2->getRowUpper(); const double * columnLower = solver2->getColLower(); const double * columnUpper = solver2->getColUpper(); // maximum space for additional columns CoinBigIndex * newColumnStart = new CoinBigIndex[numberRows+1]; newColumnStart[0]=0; int * newRow = new int [numberRows]; double * newElement = new double [numberRows]; double * newObjective = new double [numberRows]; double * newColumnLower = new double [numberRows]; double * newColumnUpper = new double [numberRows]; double * oldObjective = CoinCopyOfArray(solver2->getObjCoefficients(), numberColumns); for (iRow=0;iRowisInteger(iColumn)) { allInteger=false; break; } else { double value = element[j]; double nearest = floor(value+0.5); if (fabs(value-nearest)>1.0e-8) { allInteger=false; break; } else { if (!oldObjective[iColumn]) constantObjective=COIN_DBL_MAX; if (!constantObjective) { constantObjective=oldObjective[iColumn]/nearest; } else if (constantObjective!=COIN_DBL_MAX) { double newConstant=oldObjective[iColumn]/nearest; if (constantObjective>0.0) { if (newConstant<=0.0) constantObjective=COIN_DBL_MAX; else constantObjective=CoinMin(constantObjective,newConstant); } else { if (newConstant>=0.0) constantObjective=COIN_DBL_MAX; else constantObjective=CoinMax(constantObjective,newConstant); } } if (nearest>0.0) { newLower += CoinMax(columnLower[iColumn],-1.0e20)*nearest; newUpper += CoinMin(columnUpper[iColumn],1.0e20)*nearest; } else { newUpper += CoinMax(columnLower[iColumn],-1.0e20)*nearest; newLower += CoinMin(columnUpper[iColumn],1.0e20)*nearest; } } } } if (allInteger) { newColumnStart[addSlacks+1]=addSlacks+1; newRow[addSlacks]=iRow; newElement[addSlacks]=-1.0; newObjective[addSlacks] = 0.0; if (moveObj && constantObjective != COIN_DBL_MAX) { // move some of objective here if looks constant newObjective[addSlacks]=constantObjective; for (int j=rowStart[iRow];jsetObjective(oldObjective); solver2->addCols(addSlacks,newColumnStart,newRow,newElement, newColumnLower,newColumnUpper,newObjective); truncatedRhsLower = CoinCopyOfArray(solver2->getRowLower(),numberRows); truncatedRhsUpper = CoinCopyOfArray(solver2->getRowUpper(),numberRows); for (int j=0;jsetRowLower(iRow,0.0); solver2->setRowUpper(iRow,0.0); int iColumn = j+numberColumns; solver2->setInteger(iColumn); std::string name = solver2->getRowName(iRow); name += "_int"; solver2->setColName(iColumn,name); } } } if (fudgeObjective||addSlacks) { modifiedModel=true; if (fudgeObjective && addSlacks) { sprintf(generalPrint,"Objective integer added with %d elements and %d Integer slacks added", fudgeObjective,addSlacks); } else if (fudgeObjective) { // just objective sprintf(generalPrint,"Objective integer added with %d elements", fudgeObjective); more2 &= ~1024; } else { // just slacks sprintf(generalPrint,"%d Integer slacks added",addSlacks); more2 &= ~512; } } else { more2 &= ~(512|1024); } parameters_[whichParam(CBC_PARAM_INT_MOREMOREMIPOPTIONS, numberParameters_, parameters_)].setIntValue(more2); } if (modifiedModel) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; truncateColumns=numberColumns; } } babModel_->assignSolver(solver2); babModel_->setOriginalColumns(process.originalColumns(), truncateColumns); babModel_->initialSolve(); babModel_->setMaximumSeconds(timeLeft - (CoinCpuTime() - time2)); } // now tighten bounds if (!miplib) { #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * si = dynamic_cast(babModel_->solver()) ; assert (si != NULL); // get clp itself ClpSimplex * modelC = si->getModelPtr(); //if (noPrinting_) //modelC->setLogLevel(0); if (!complicatedInteger && modelC->tightenPrimalBounds() != 0) { sprintf(generalPrint, "Problem is infeasible!"); printGeneralMessage(model_,generalPrint); model_.setProblemStatus(0); model_.setSecondaryStatus(1); // say infeasible for solution integerStatus = 6; delete saveSolver; saveSolver=NULL; // and in babModel_ if exists if (babModel_) { babModel_->setProblemStatus(0); babModel_->setSecondaryStatus(1); } break; } si->resolve(); #elif CBC_OTHER_SOLVER==1 #endif } if (debugValues) { // for debug std::string problemName ; babModel_->solver()->getStrParam(OsiProbName, problemName) ; babModel_->solver()->activateRowCutDebugger(problemName.c_str()) ; twomirGen.probname_ = CoinStrdup(problemName.c_str()); // checking seems odd //redsplitGen.set_given_optsol(babModel_->solver()->getRowCutDebuggerAlways()->optimalSolution(), // babModel_->getNumCols()); } int testOsiOptions = parameters_[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters_, parameters_)].intValue(); //#ifdef COIN_HAS_ASL #ifndef JJF_ONE // If linked then see if expansion wanted { OsiSolverLink * solver3 = dynamic_cast (babModel_->solver()); int options = parameters_[whichParam(CBC_PARAM_INT_MIPOPTIONS, numberParameters_, parameters_)].intValue() / 10000; if (solver3 || (options&16) != 0) { if (options) { /* 1 - force mini branch and bound 2 - set priorities high on continuous 4 - try adding OA cuts 8 - try doing quadratic linearization 16 - try expanding knapsacks */ if ((options&16)) { int numberColumns = saveCoinModel.numberColumns(); int numberRows = saveCoinModel.numberRows(); whichColumn = new int[numberColumns]; knapsackStart = new int[numberRows+1]; knapsackRow = new int[numberRows]; numberKnapsack = 10000; int extra1 = parameters_[whichParam(CBC_PARAM_INT_EXTRA1, numberParameters_, parameters_)].intValue(); int extra2 = parameters_[whichParam(CBC_PARAM_INT_EXTRA2, numberParameters_, parameters_)].intValue(); int logLevel = parameters_[log].intValue(); OsiSolverInterface * solver = expandKnapsack(saveCoinModel, whichColumn, knapsackStart, knapsackRow, numberKnapsack, storedAmpl, logLevel, extra1, extra2, saveTightenedModel); if (solver) { #ifndef CBC_OTHER_SOLVER clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); assert (clpSolver); lpSolver = clpSolver->getModelPtr(); #endif babModel_->assignSolver(solver); testOsiOptions = 0; // allow gomory complicatedInteger = 0; #ifdef COIN_HAS_ASL // Priorities already done free(info.priorities); info.priorities = NULL; #endif } else { numberKnapsack = 0; delete [] whichColumn; delete [] knapsackStart; delete [] knapsackRow; whichColumn = NULL; knapsackStart = NULL; knapsackRow = NULL; } } } } } #endif if (useCosts && testOsiOptions < 0) { int numberColumns = babModel_->getNumCols(); int * sort = new int[numberColumns]; double * dsort = new double[numberColumns]; int * priority = new int [numberColumns]; const double * objective = babModel_->getObjCoefficients(); const double * lower = babModel_->getColLower() ; const double * upper = babModel_->getColUpper() ; const CoinPackedMatrix * matrix = babModel_->solver()->getMatrixByCol(); const int * columnLength = matrix->getVectorLengths(); int iColumn; int n = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (babModel_->isInteger(iColumn)) { sort[n] = n; if (useCosts == 1) dsort[n++] = -fabs(objective[iColumn]); else if (useCosts == 2) dsort[n++] = iColumn; else if (useCosts == 3) dsort[n++] = upper[iColumn] - lower[iColumn]; else if (useCosts == 4) dsort[n++] = -(upper[iColumn] - lower[iColumn]); else if (useCosts == 5) dsort[n++] = -columnLength[iColumn]; else if (useCosts == 6) dsort[n++] = (columnLength[iColumn]==1) ? -1.0 : 0.0; else if (useCosts == 7) dsort[n++] = (objective[iColumn]) ? -1.0 : 0.0; } } CoinSort_2(dsort, dsort + n, sort); int level = 0; double last = -1.0e100; for (int i = 0; i < n; i++) { int iPut = sort[i]; if (dsort[i] != last) { level++; last = dsort[i]; } priority[iPut] = level; } if(newPriorities ) { // get rid of delete [] newPriorities; newPriorities = NULL; } babModel_->passInPriorities( priority, false); integersOK = true; delete [] priority; delete [] sort; delete [] dsort; } // Set up heuristics doHeuristics(babModel_, ((!miplib) ? 1 : 10), parameters_, numberParameters_, noPrinting_, initialPumpTune); if (!miplib) { if (parameters_[whichParam(CBC_PARAM_STR_LOCALTREE, numberParameters_, parameters_)].currentOptionAsInteger()) { CbcTreeLocal localTree(babModel_, NULL, 10, 0, 0, 10000, 2000); babModel_->passInTreeHandler(localTree); } } if (type == CBC_PARAM_ACTION_MIPLIB) { if (babModel_->numberStrong() == 5 && babModel_->numberBeforeTrust() == 5) babModel_->setNumberBeforeTrust(10); } int experimentFlag = parameters_[whichParam(CBC_PARAM_INT_EXPERIMENT, numberParameters_, parameters_)].intValue(); int strategyFlag = parameters_[whichParam(CBC_PARAM_INT_STRATEGY, numberParameters_, parameters_)].intValue(); int bothFlags = CoinMax(CoinMin(experimentFlag, 1), strategyFlag); // add cut generators if wanted int switches[30]; int accuracyFlag[30]; char doAtEnd[30]; memset(doAtEnd,0,30); int numberGenerators = 0; int translate[] = { -100, -1, -99, -98, 1, -1098, -999, 1, 1, 1, -1}; int maximumSlowPasses = parameters_[whichParam(CBC_PARAM_INT_MAX_SLOW_CUTS, numberParameters_, parameters_)].intValue(); if (probingAction) { int numberColumns = babModel_->solver()->getNumCols(); if (probingAction > 7) { probingGen.setMaxElements(numberColumns); probingGen.setMaxElementsRoot(numberColumns); } probingGen.setMaxProbeRoot(CoinMin(2000, numberColumns)); probingGen.setMaxProbeRoot(123); probingGen.setMaxProbe(123); probingGen.setMaxLookRoot(20); if (probingAction == 7 || probingAction == 9) probingGen.setRowCuts(-3); // strengthening etc just at root if (probingAction == 8 || probingAction == 9) { // Number of unsatisfied variables to look at probingGen.setMaxProbeRoot(numberColumns); probingGen.setMaxProbe(numberColumns); // How far to follow the consequences probingGen.setMaxLook(50); probingGen.setMaxLookRoot(50); } if (probingAction == 10) { probingGen.setMaxPassRoot(2); probingGen.setMaxProbeRoot(numberColumns); probingGen.setMaxLookRoot(numberColumns); } // If 5 then force on int iAction = translate[probingAction]; if (probingAction == 5) iAction = 1; babModel_->addCutGenerator(&probingGen, iAction, "Probing"); accuracyFlag[numberGenerators] = 5; switches[numberGenerators++] = 0; } if (gomoryAction && (complicatedInteger != 1 || (gomoryAction == 1 || gomoryAction >= 4))) { // try larger limit int numberColumns = babModel_->getNumCols(); if (gomoryAction == 7) { gomoryAction = 4; gomoryGen.setLimitAtRoot(numberColumns); gomoryGen.setLimit(numberColumns); } else if (gomoryAction == 8) { gomoryAction = 3; gomoryGen.setLimitAtRoot(numberColumns); gomoryGen.setLimit(200); } else if (numberColumns > 5000) { //#define MORE_CUTS2 #ifdef MORE_CUTS2 // try larger limit gomoryGen.setLimitAtRoot(numberColumns); gomoryGen.setLimit(200); #else gomoryGen.setLimitAtRoot(2000); //gomoryGen.setLimit(200); #endif } else { #ifdef MORE_CUTS2 // try larger limit gomoryGen.setLimitAtRoot(numberColumns); gomoryGen.setLimit(200); #endif } int cutLength = parameters_[whichParam(CBC_PARAM_INT_CUTLENGTH, numberParameters_, parameters_)].intValue(); if (cutLength != -1) { gomoryGen.setLimitAtRoot(cutLength); if (cutLength < 10000000) { gomoryGen.setLimit(cutLength); } else { gomoryGen.setLimit(cutLength % 10000000); } } int laGomory = parameters_[whichParam(CBC_PARAM_STR_LAGOMORYCUTS, numberParameters_, parameters_)].currentOptionAsInteger(); int gType = translate[gomoryAction]; if (!laGomory) { // Normal babModel_->addCutGenerator(&gomoryGen, translate[gomoryAction], "Gomory"); accuracyFlag[numberGenerators] = 3; switches[numberGenerators++] = 0; } else { laGomory--; int type = (laGomory % 3)+1; int when = laGomory/3; char atEnd = (when<2) ? 1 : 0; int gomoryTypeMajor = 10; if (when<3) { // normal as well babModel_->addCutGenerator(&gomoryGen, gType, "Gomory"); accuracyFlag[numberGenerators] = 3; switches[numberGenerators++] = 0; if (when==2) gomoryTypeMajor=20; } else { when--; // so on gomoryTypeMajor=20; } if (!when) gType=-99; // root gomoryGen.passInOriginalSolver(babModel_->solver()); if ((type&1) !=0) { // clean gomoryGen.setGomoryType(gomoryTypeMajor+1); babModel_->addCutGenerator(&gomoryGen, gType, "GomoryL1"); accuracyFlag[numberGenerators] = 3; doAtEnd[numberGenerators]=atEnd; if (atEnd) { babModel_->cutGenerator(numberGenerators)->setMaximumTries(99999999); babModel_->cutGenerator(numberGenerators)->setHowOften(1); } switches[numberGenerators++] = 0; } if ((type&2) !=0) { // simple gomoryGen.setGomoryType(gomoryTypeMajor+2); babModel_->addCutGenerator(&gomoryGen, gType, "GomoryL2"); accuracyFlag[numberGenerators] = 3; doAtEnd[numberGenerators]=atEnd; if (atEnd) { babModel_->cutGenerator(numberGenerators)->setMaximumTries(99999999); babModel_->cutGenerator(numberGenerators)->setHowOften(1); } switches[numberGenerators++] = 0; } } } #ifdef CLIQUE_ANALYSIS if (miplib && !storedAmpl.sizeRowCuts()) { printf("looking at probing\n"); babModel_->addCutGenerator(&storedAmpl, 1, "Stored"); } #endif if (knapsackAction) { babModel_->addCutGenerator(&knapsackGen, translate[knapsackAction], "Knapsack"); accuracyFlag[numberGenerators] = 1; switches[numberGenerators++] = -2; } if (redsplitAction && !complicatedInteger) { babModel_->addCutGenerator(&redsplitGen, translate[redsplitAction], "Reduce-and-split"); accuracyFlag[numberGenerators] = 5; // slow ? - just do a few times if (redsplitAction!=1) { babModel_->cutGenerator(numberGenerators)->setMaximumTries(maximumSlowPasses); babModel_->cutGenerator(numberGenerators)->setHowOften(10); } switches[numberGenerators++] = 1; } if (redsplit2Action && !complicatedInteger) { int maxLength=256; if (redsplit2Action>2) { redsplit2Action-=2; maxLength=COIN_INT_MAX; } CglRedSplit2Param & parameters = redsplit2Gen.getParam(); parameters.setMaxNonzeroesTab(maxLength); babModel_->addCutGenerator(&redsplit2Gen, translate[redsplit2Action], "Reduce-and-split(2)"); accuracyFlag[numberGenerators] = 5; // slow ? - just do a few times if (redsplit2Action!=1) { babModel_->cutGenerator(numberGenerators)->setHowOften(maximumSlowPasses); babModel_->cutGenerator(numberGenerators)->setMaximumTries(maximumSlowPasses); babModel_->cutGenerator(numberGenerators)->setHowOften(5); } switches[numberGenerators++] = 1; } if (GMIAction && !complicatedInteger) { if (GMIAction>5) { // long GMIAction-=5; CglGMIParam & parameters = GMIGen.getParam(); parameters.setMaxSupportRel(1.0); } babModel_->addCutGenerator(&GMIGen, translate[GMIAction], "Gomory(2)"); if (GMIAction==5) { // just at end and root GMIAction=2; doAtEnd[numberGenerators]=1; babModel_->cutGenerator(numberGenerators)->setMaximumTries(99999999); babModel_->cutGenerator(numberGenerators)->setHowOften(1); } accuracyFlag[numberGenerators] = 5; switches[numberGenerators++] = 0; } if (cliqueAction) { babModel_->addCutGenerator(&cliqueGen, translate[cliqueAction], "Clique"); accuracyFlag[numberGenerators] = 0; switches[numberGenerators++] = 0; } if (mixedAction) { babModel_->addCutGenerator(&mixedGen, translate[mixedAction], "MixedIntegerRounding2"); accuracyFlag[numberGenerators] = 2; switches[numberGenerators++] = 0; } if (flowAction) { babModel_->addCutGenerator(&flowGen, translate[flowAction], "FlowCover"); accuracyFlag[numberGenerators] = 2; switches[numberGenerators++] = 0; } if (twomirAction && (complicatedInteger != 1 || (twomirAction == 1 || twomirAction >= 4))) { // try larger limit int numberColumns = babModel_->getNumCols(); if (twomirAction == 7) { twomirAction = 4; twomirGen.setMaxElements(numberColumns); } else if (numberColumns > 5000 && twomirAction == 4) { twomirGen.setMaxElements(2000); } int laTwomir = parameters_[whichParam(CBC_PARAM_STR_LATWOMIRCUTS, numberParameters_, parameters_)].currentOptionAsInteger(); int twomirType = translate[twomirAction]; if (!laTwomir) { // Normal babModel_->addCutGenerator(&twomirGen, translate[twomirAction], "TwoMirCuts"); accuracyFlag[numberGenerators] = 4; switches[numberGenerators++] = 1; } else { laTwomir--; int type = (laTwomir % 3)+1; int when = laTwomir/3; char atEnd = (when<2) ? 1 : 0; int twomirTypeMajor = 10; if (when<3) { // normal as well babModel_->addCutGenerator(&twomirGen, translate[twomirAction], "TwoMirCuts"); accuracyFlag[numberGenerators] = 4; switches[numberGenerators++] = 1; if (when==2) twomirTypeMajor=10; } else { when--; // so on twomirTypeMajor=20; } if (!when) twomirType=-99; // root twomirGen.passInOriginalSolver(babModel_->solver()); if ((type&1) !=0) { // clean twomirGen.setTwomirType(twomirTypeMajor+1); babModel_->addCutGenerator(&twomirGen, twomirType, "TwoMirCutsL1"); accuracyFlag[numberGenerators] = 4; doAtEnd[numberGenerators]=atEnd; switches[numberGenerators++] = atEnd ? 0 : 1; } if ((type&2) !=0) { // simple twomirGen.setTwomirType(twomirTypeMajor+2); babModel_->addCutGenerator(&twomirGen, twomirType, "TwoMirCutsL2"); accuracyFlag[numberGenerators] = 4; doAtEnd[numberGenerators]=atEnd; switches[numberGenerators++] = atEnd ? 0 : 1; } } } #ifndef DEBUG_MALLOC if (landpAction) { babModel_->addCutGenerator(&landpGen, translate[landpAction], "LiftAndProject"); accuracyFlag[numberGenerators] = 5; // slow ? - just do a few times if (landpAction!=1) { babModel_->cutGenerator(numberGenerators)->setMaximumTries(maximumSlowPasses); babModel_->cutGenerator(numberGenerators)->setHowOften(10); } switches[numberGenerators++] = 1; } #endif if (residualCapacityAction) { babModel_->addCutGenerator(&residualCapacityGen, translate[residualCapacityAction], "ResidualCapacity"); accuracyFlag[numberGenerators] = 5; switches[numberGenerators++] = 1; } if (zerohalfAction) { if (zerohalfAction > 4) { //zerohalfAction -=4; zerohalfGen.setFlags(1); } babModel_->addCutGenerator(&zerohalfGen, translate[zerohalfAction], "ZeroHalf"); accuracyFlag[numberGenerators] = 5; babModel_->cutGenerator(numberGenerators)-> setNeedsRefresh(true); switches[numberGenerators++] = 2; } if (dominatedCuts) babModel_->setSpecialOptions(babModel_->specialOptions() | 64); // Say we want timings numberGenerators = babModel_->numberCutGenerators(); int iGenerator; int cutDepth = parameters_[whichParam(CBC_PARAM_INT_CUTDEPTH, numberParameters_, parameters_)].intValue(); for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = babModel_->cutGenerator(iGenerator); int howOften = generator->howOften(); if (howOften == -98 || howOften == -99 || generator->maximumTries()>0) generator->setSwitchOffIfLessThan(switches[iGenerator]); // Use if any at root as more likely later and fairly cheap //if (switches[iGenerator]==-2) //generator->setWhetherToUse(true); generator->setInaccuracy(accuracyFlag[iGenerator]); if (doAtEnd[iGenerator]) { generator->setWhetherCallAtEnd(true); //generator->setMustCallAgain(true); } generator->setTiming(true); if (cutDepth >= 0) generator->setWhatDepth(cutDepth) ; } // Could tune more if (!miplib) { double minimumDrop = fabs(babModel_->solver()->getObjValue()) * 1.0e-5 + 1.0e-5; babModel_->setMinimumDrop(CoinMin(5.0e-2, minimumDrop)); if (cutPass == -1234567) { if (babModel_->getNumCols() < 500) babModel_->setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (babModel_->getNumCols() < 5000) babModel_->setMaximumCutPassesAtRoot(100); // use minimum drop else babModel_->setMaximumCutPassesAtRoot(20); } else { babModel_->setMaximumCutPassesAtRoot(cutPass); } if (cutPassInTree == -1234567) babModel_->setMaximumCutPasses(4); else babModel_->setMaximumCutPasses(cutPassInTree); } else if (cutPass != -1234567) { babModel_->setMaximumCutPassesAtRoot(cutPass); } // Do more strong branching if small //if (babModel_->getNumCols()<5000) //babModel_->setNumberStrong(20); // Switch off strong branching if wanted //if (babModel_->getNumCols()>10*babModel_->getNumRows()) //babModel_->setNumberStrong(0); if (!noPrinting_) { int iLevel = parameters_[log].intValue(); if (iLevel < 0) { if (iLevel > -10) { babModel_->setPrintingMode(1); } else { babModel_->setPrintingMode(2); iLevel += 10; parameters_[log].setIntValue(iLevel); } iLevel = -iLevel; } babModel_->messageHandler()->setLogLevel(iLevel); if (babModel_->getNumCols() > 2000 || babModel_->getNumRows() > 1500 || babModel_->messageHandler()->logLevel() > 1) babModel_->setPrintFrequency(100); } babModel_->solver()->setIntParam(OsiMaxNumIterationHotStart, parameters_[whichParam(CBC_PARAM_INT_MAXHOTITS, numberParameters_, parameters_)].intValue()); #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); // go faster stripes if ((osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500)) { osiclp->setupForRepeatedUse(2, parameters_[slog].intValue()); if (bothFlags >= 1) { ClpSimplex * lp = osiclp->getModelPtr(); int specialOptions = lp->specialOptions(); lp->setSpecialOptions(specialOptions | (2048 + 4096)); } } else { osiclp->setupForRepeatedUse(0, parameters_[slog].intValue()); } if (bothFlags >= 2) { ClpSimplex * lp = osiclp->getModelPtr(); int specialOptions = lp->specialOptions(); lp->setSpecialOptions(specialOptions | (2048 + 4096)); } double increment = babModel_->getCutoffIncrement();; int * changed = NULL; if (!miplib && increment == normalIncrement) changed = analyze( osiclp, numberChanged, increment, false, generalMessageHandler, noPrinting); #elif CBC_OTHER_SOLVER==1 double increment = babModel_->getCutoffIncrement();; #endif if (debugValues) { int numberColumns = babModel_->solver()->getNumCols(); if (numberDebugValues == numberColumns) { // for debug babModel_->solver()->activateRowCutDebugger(debugValues) ; } else { int numberOriginalColumns = process.originalModel()->getNumCols(); if (numberDebugValues <= numberOriginalColumns) { const int * originalColumns = process.originalColumns(); double * newValues = new double [numberColumns]; // in case preprocess added columns! // need to find values OsiSolverInterface * siCopy = babModel_->solver()->clone(); for (int i = 0; i < numberColumns; i++) { int jColumn = originalColumns[i]; if (jColumn < numberDebugValues && siCopy->isInteger(i)) { // integer variable double soln = floor(debugValues[jColumn] + 0.5); // Set bounds to fix variable to its solution siCopy->setColUpper(i, soln); siCopy->setColLower(i, soln); } } // All integers have been fixed at optimal value. // Now solve to get continuous values siCopy->setHintParam(OsiDoScale, false); siCopy->initialSolve(); if (siCopy->isProvenOptimal()) { memcpy(newValues, siCopy->getColSolution(), numberColumns*sizeof(double)); } else { printf("BAD debug file\n"); siCopy->writeMps("Bad"); exit(22); } delete siCopy; // for debug babModel_->solver()->activateRowCutDebugger(newValues) ; delete [] newValues; } else { printf("debug file has incorrect number of columns\n"); } } } babModel_->setCutoffIncrement(CoinMax(babModel_->getCutoffIncrement(), increment)); // Turn this off if you get problems // Used to be automatically set int mipOptions = parameters_[whichParam(CBC_PARAM_INT_MIPOPTIONS, numberParameters_, parameters_)].intValue() % 10000; if (mipOptions != (1057) && mipOptions != 1025 ) { sprintf(generalPrint, "mip options %d", mipOptions); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } #ifndef CBC_OTHER_SOLVER osiclp->setSpecialOptions(mipOptions); #elif CBC_OTHER_SOLVER==1 #endif // probably faster to use a basis to get integer solutions babModel_->setSpecialOptions(babModel_->specialOptions() | 2); currentBranchModel = babModel_; //OsiSolverInterface * strengthenedModel=NULL; if (type == CBC_PARAM_ACTION_BAB || type == CBC_PARAM_ACTION_MIPLIB) { if (strategyFlag == 1) { // try reduced model babModel_->setSpecialOptions(babModel_->specialOptions() | 512); } if (experimentFlag >= 5 || strategyFlag == 2) { // try reduced model at root babModel_->setSpecialOptions(babModel_->specialOptions() | 32768); } { int depthMiniBab = parameters_[whichParam(CBC_PARAM_INT_DEPTHMINIBAB, numberParameters_, parameters_)].intValue(); if (depthMiniBab != -1) babModel_->setFastNodeDepth(depthMiniBab); } int extra4 = parameters_[whichParam(CBC_PARAM_INT_EXTRA4, numberParameters_, parameters_)].intValue(); if (extra4 >= 0) { int strategy = extra4 % 10; extra4 /= 10; int method = extra4 % 100; extra4 /= 100; extra4 = strategy + method * 8 + extra4 * 1024; babModel_->setMoreSpecialOptions(extra4); } int moreMipOptions = parameters_[whichParam(CBC_PARAM_INT_MOREMIPOPTIONS, numberParameters_, parameters_)].intValue(); if (moreMipOptions >= 0) { sprintf(generalPrint, "more mip options %d", moreMipOptions); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; #if 1 // some options may have been set already // e.g. use elapsed time babModel_->setMoreSpecialOptions(moreMipOptions|babModel_->moreSpecialOptions()); #else OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); if (moreMipOptions == 10000) { // test memory saving moreMipOptions -= 10000; ClpSimplex * lpSolver = osiclp->getModelPtr(); lpSolver->setPersistenceFlag(1); // switch off row copy if few rows if (lpSolver->numberRows() < 150) lpSolver->setSpecialOptions(lpSolver->specialOptions() | 256); } if (moreMipOptions < 10000 && moreMipOptions) { if (((moreMipOptions + 1) % 1000000) != 0) babModel_->setSearchStrategy(moreMipOptions % 1000000); } else if (moreMipOptions < 100000) { // try reduced model babModel_->setSpecialOptions(babModel_->specialOptions() | 512); } // go faster stripes if ( moreMipOptions >= 999999) { if (osiclp) { int save = osiclp->specialOptions(); osiclp->setupForRepeatedUse(2, 0); osiclp->setSpecialOptions(save | osiclp->specialOptions()); } } #endif } } { int extra1 = parameters_[whichParam(CBC_PARAM_INT_EXTRA1, numberParameters_, parameters_)].intValue(); if (extra1 != -1) { if (extra1 < 0) { if (extra1 == -7777) extra1 = -1; else if (extra1 == -8888) extra1 = 1; babModel_->setWhenCuts(-extra1); } else if (extra1 < 19000) { babModel_->setSearchStrategy(extra1); printf("XXXXX searchStrategy %d\n", extra1); } else { int n = extra1 - 20000; if (!n) n--; babModel_->setNumberAnalyzeIterations(n); printf("XXXXX analyze %d\n", extra1); } } else if (bothFlags >= 1) { babModel_->setWhenCuts(999998); } } if (type == CBC_PARAM_ACTION_BAB) { #ifdef COIN_HAS_ASL if (statusUserFunction_[0]) { priorities = info.priorities; branchDirection = info.branchDirection; pseudoDown = info.pseudoDown; pseudoUp = info.pseudoUp; solutionIn = info.primalSolution; prioritiesIn = info.priorities; if (info.numberSos && doSOS) { // SOS numberSOS = info.numberSos; sosStart = info.sosStart; sosIndices = info.sosIndices; sosType = info.sosType; sosReference = info.sosReference; sosPriority = info.sosPriority; } } #endif const int * originalColumns = preProcess ? process.originalColumns() : NULL; //if (model.getMIPStart().size()) // mipStart = model.getMIPStart(); if (mipStart.size() && !mipStartBefore.size() && babModel_->getNumCols()) { std::vector< std::string > colNames; if (preProcess) { std::vector< std::pair< std::string, double > > mipStart2; int numberOriginalColumns = model_.solver()->getNumCols(); for ( int i=0 ; (isolver()->getNumCols()) ; ++i ) { int iColumn = babModel_->originalColumns()[i]; if (iColumn>=0 && iColumn < numberOriginalColumns) { colNames.push_back( model_.solver()->getColName( iColumn ) ); babModel_->solver()->setColName(i,model_.solver()->getColName(iColumn)); mipStart2.push_back(mipStart[iColumn]); } else { // created variable char newName[15]; sprintf(newName,"C%7.7d",i); colNames.push_back( newName ); } } mipStart = mipStart2; } else { for ( int i=0 ; (isolver()->getNumCols()) ; ++i ) colNames.push_back( model_.solver()->getColName(i) ); } //printf("--- %s %d\n", babModel_->solver()->getColName(0).c_str(), babModel_->solver()->getColNames().size() ); //printf("-- SIZES of models %d %d %d\n", model_.getNumCols(), babModel_->solver()->getNumCols(), babModel_->solver()->getColNames().size() ); std::vector< double > x( babModel_->getNumCols(), 0.0 ); double obj; int status = computeCompleteSolution( babModel_, colNames, mipStart, &x[0], obj ); if (!status) { babModel_->setBestSolution( &x[0], static_cast(x.size()), obj, false ); babModel_->setSolutionCount(1); } } if (solutionIn && useSolution >= 0) { if (!prioritiesIn) { int n; if (preProcess) { int numberColumns = babModel_->getNumCols(); // extend arrays in case SOS n = originalColumns[numberColumns-1] + 1; } else { n = babModel_->getNumCols(); } prioritiesIn = reinterpret_cast (malloc(n * sizeof(int))); for (int i = 0; i < n; i++) prioritiesIn[i] = 100; } if (preProcess) { int numberColumns = babModel_->getNumCols(); // extend arrays in case SOS int n = originalColumns[numberColumns-1] + 1; int nSmaller = CoinMin(n, numberOriginalColumns); double * solutionIn2 = new double [n]; int * prioritiesIn2 = new int[n]; int i; for (i = 0; i < nSmaller; i++) { solutionIn2[i] = solutionIn[i]; prioritiesIn2[i] = prioritiesIn[i]; } for (; i < n; i++) { solutionIn2[i] = 0.0; prioritiesIn2[i] = 1000000; } #ifndef NDEBUG int iLast = -1; #endif for (i = 0; i < numberColumns; i++) { int iColumn = originalColumns[i]; #ifndef NDEBUG assert (iColumn > iLast); iLast = iColumn; #endif solutionIn2[i] = solutionIn2[iColumn]; if (prioritiesIn) prioritiesIn2[i] = prioritiesIn2[iColumn]; } if (useSolution) babModel_->setHotstartSolution(solutionIn2, prioritiesIn2); else babModel_->setBestSolution(solutionIn2, numberColumns, COIN_DBL_MAX, true); delete [] solutionIn2; delete [] prioritiesIn2; } else { if (useSolution) babModel_->setHotstartSolution(solutionIn, prioritiesIn); else babModel_->setBestSolution(solutionIn, babModel_->getNumCols(), COIN_DBL_MAX, true); } } OsiSolverInterface * testOsiSolver = (testOsiOptions >= 0) ? babModel_->solver() : NULL; if (!testOsiSolver) { // ************************************************************* // CbcObjects if (preProcess && (process.numberSOS() || babModel_->numberObjects())) { int numberSOS = process.numberSOS(); int numberIntegers = babModel_->numberIntegers(); /* model may not have created objects If none then create */ if (!numberIntegers || !babModel_->numberObjects()) { int type = (pseudoUp) ? 1 : 0; babModel_->findIntegers(true, type); numberIntegers = babModel_->numberIntegers(); integersOK = true; } OsiObject ** oldObjects = babModel_->objects(); // Do sets and priorities OsiObject ** objects = new OsiObject * [numberSOS]; // set old objects to have low priority int numberOldObjects = babModel_->numberObjects(); int numberColumns = babModel_->getNumCols(); // backward pointer to new variables // extend arrays in case SOS assert (originalColumns); int n = CoinMin(truncateColumns,numberColumns); n = originalColumns[n-1] + 1; n = CoinMax(n, CoinMax(numberColumns, numberOriginalColumns)); int * newColumn = new int[n]; int i; for (i = 0; i < numberOriginalColumns; i++) newColumn[i] = -1; for (i = 0; i < CoinMin(truncateColumns,numberColumns); i++) newColumn[originalColumns[i]] = i; if (!integersOK) { // Change column numbers etc int n = 0; for (int iObj = 0; iObj < numberOldObjects; iObj++) { int iColumn = oldObjects[iObj]->columnNumber(); if (iColumn < 0 || iColumn >= numberOriginalColumns) { oldObjects[n++] = oldObjects[iObj]; } else { iColumn = newColumn[iColumn]; if (iColumn >= 0) { CbcSimpleInteger * obj = dynamic_cast (oldObjects[iObj]) ; if (obj) { obj->setColumnNumber(iColumn); } else { // only other case allowed is lotsizing CbcLotsize * obj2 = dynamic_cast (oldObjects[iObj]) ; assert (obj2); obj2->setModelSequence(iColumn); } oldObjects[n++] = oldObjects[iObj]; } else { delete oldObjects[iObj]; } } } babModel_->setNumberObjects(n); numberOldObjects = n; babModel_->zapIntegerInformation(); } int nMissing = 0; for (int iObj = 0; iObj < numberOldObjects; iObj++) { if (process.numberSOS()) oldObjects[iObj]->setPriority(numberColumns + 1); int iColumn = oldObjects[iObj]->columnNumber(); if (iColumn < 0 || iColumn >= numberOriginalColumns) { CbcSOS * obj = dynamic_cast (oldObjects[iObj]) ; if (obj) { int n = obj->numberMembers(); int * which = obj->mutableMembers(); double * weights = obj->mutableWeights(); int nn = 0; for (i = 0; i < n; i++) { int iColumn = which[i]; int jColumn = newColumn[iColumn]; if (jColumn >= 0) { which[nn] = jColumn; weights[nn++] = weights[i]; } else { nMissing++; } } obj->setNumberMembers(nn); } continue; } if (originalColumns) iColumn = originalColumns[iColumn]; if (branchDirection) { CbcSimpleInteger * obj = dynamic_cast (oldObjects[iObj]) ; if (obj) { obj->setPreferredWay(branchDirection[iColumn]); } else { CbcObject * obj = dynamic_cast (oldObjects[iObj]) ; assert (obj); obj->setPreferredWay(branchDirection[iColumn]); } } if (pseudoUp) { CbcSimpleIntegerPseudoCost * obj1a = dynamic_cast (oldObjects[iObj]) ; assert (obj1a); if (pseudoDown[iColumn] > 0.0) obj1a->setDownPseudoCost(pseudoDown[iColumn]); if (pseudoUp[iColumn] > 0.0) obj1a->setUpPseudoCost(pseudoUp[iColumn]); } } if (nMissing) { sprintf(generalPrint, "%d SOS variables vanished due to pre processing? - check validity?", nMissing); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } delete [] newColumn; const int * starts = process.startSOS(); const int * which = process.whichSOS(); const int * type = process.typeSOS(); const double * weight = process.weightSOS(); int iSOS; for (iSOS = 0; iSOS < numberSOS; iSOS++) { int iStart = starts[iSOS]; int n = starts[iSOS+1] - iStart; //#define MAKE_SOS_CLIQUES #ifndef MAKE_SOS_CLIQUES objects[iSOS] = new CbcSOS(babModel_, n, which + iStart, weight + iStart, iSOS, type[iSOS]); #else objects[iSOS] = new CbcClique(babModel_, 1, n, which + iStart, NULL,-iSOS-1); #endif // branch on long sets first objects[iSOS]->setPriority(numberColumns - n); } if (numberSOS) babModel_->addObjects(numberSOS, objects); for (iSOS = 0; iSOS < numberSOS; iSOS++) delete objects[iSOS]; delete [] objects; } else if (priorities || branchDirection || pseudoDown || pseudoUp || numberSOS) { // do anyway for priorities etc int numberIntegers = babModel_->numberIntegers(); /* model may not have created objects If none then create */ if (!numberIntegers || !babModel_->numberObjects()) { int type = (pseudoUp) ? 1 : 0; babModel_->findIntegers(true, type); } if (numberSOS) { // Do sets and priorities OsiObject ** objects = new OsiObject * [numberSOS]; int iSOS; if (originalColumns) { // redo sequence numbers int numberColumns = babModel_->getNumCols(); int nOld = originalColumns[numberColumns-1] + 1; int * back = new int[nOld]; int i; for (i = 0; i < nOld; i++) back[i] = -1; for (i = 0; i < numberColumns; i++) back[originalColumns[i]] = i; // Really need better checks int nMissing = 0; int n = sosStart[numberSOS]; for (i = 0; i < n; i++) { int iColumn = sosIndices[i]; int jColumn = back[iColumn]; if (jColumn >= 0) sosIndices[i] = jColumn; else nMissing++; } delete [] back; if (nMissing) { sprintf(generalPrint, "%d SOS variables vanished due to pre processing? - check validity?", nMissing); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } for (iSOS = 0; iSOS < numberSOS; iSOS++) { int iStart = sosStart[iSOS]; int n = sosStart[iSOS+1] - iStart; objects[iSOS] = new CbcSOS(babModel_, n, sosIndices + iStart, sosReference + iStart, iSOS, sosType[iSOS]); if (sosPriority) objects[iSOS]->setPriority(sosPriority[iSOS]); else if (!prioritiesIn) objects[iSOS]->setPriority(10); // rather than 1000 } // delete any existing SOS objects int numberObjects = babModel_->numberObjects(); OsiObject ** oldObjects = babModel_->objects(); int nNew = 0; for (int i = 0; i < numberObjects; i++) { OsiObject * objThis = oldObjects[i]; CbcSOS * obj1 = dynamic_cast (objThis) ; OsiSOS * obj2 = dynamic_cast (objThis) ; if (!obj1 && !obj2) { oldObjects[nNew++] = objThis; } else { delete objThis; } } babModel_->setNumberObjects(nNew); babModel_->addObjects(numberSOS, objects); for (iSOS = 0; iSOS < numberSOS; iSOS++) delete objects[iSOS]; delete [] objects; } } OsiObject ** objects = babModel_->objects(); int numberObjects = babModel_->numberObjects(); for (int iObj = 0; iObj < numberObjects; iObj++) { // skip sos CbcSOS * objSOS = dynamic_cast (objects[iObj]) ; if (objSOS) continue; #ifdef MAKE_SOS_CLIQUES // skip cliques CbcClique * objClique = dynamic_cast (objects[iObj]) ; if (objClique) continue; #endif int iColumn = objects[iObj]->columnNumber(); assert (iColumn >= 0); if (originalColumns) iColumn = originalColumns[iColumn]; if (branchDirection) { CbcSimpleInteger * obj = dynamic_cast (objects[iObj]) ; if (obj) { obj->setPreferredWay(branchDirection[iColumn]); } else { CbcObject * obj = dynamic_cast (objects[iObj]) ; assert (obj); obj->setPreferredWay(branchDirection[iColumn]); } } if (priorities) { int iPriority = priorities[iColumn]; if (iPriority > 0) objects[iObj]->setPriority(iPriority); } if (pseudoUp && pseudoUp[iColumn]) { CbcSimpleIntegerPseudoCost * obj1a = dynamic_cast (objects[iObj]) ; assert (obj1a); if (pseudoDown[iColumn] > 0.0) obj1a->setDownPseudoCost(pseudoDown[iColumn]); if (pseudoUp[iColumn] > 0.0) obj1a->setUpPseudoCost(pseudoUp[iColumn]); } } // ************************************************************* } else { // ************************************************************* // OsiObjects // Find if none int numberIntegers = testOsiSolver->getNumIntegers(); /* model may not have created objects If none then create */ if (!numberIntegers || !testOsiSolver->numberObjects()) { //int type = (pseudoUp) ? 1 : 0; testOsiSolver->findIntegers(false); numberIntegers = testOsiSolver->getNumIntegers(); } if (preProcess && process.numberSOS()) { int numberSOS = process.numberSOS(); OsiObject ** oldObjects = testOsiSolver->objects(); // Do sets and priorities OsiObject ** objects = new OsiObject * [numberSOS]; // set old objects to have low priority int numberOldObjects = testOsiSolver->numberObjects(); int numberColumns = testOsiSolver->getNumCols(); for (int iObj = 0; iObj < numberOldObjects; iObj++) { oldObjects[iObj]->setPriority(numberColumns + 1); int iColumn = oldObjects[iObj]->columnNumber(); assert (iColumn >= 0); if (iColumn >= numberOriginalColumns) continue; if (originalColumns) iColumn = originalColumns[iColumn]; if (branchDirection) { OsiSimpleInteger * obj = dynamic_cast (oldObjects[iObj]) ; if (obj) { obj->setPreferredWay(branchDirection[iColumn]); } else { OsiObject2 * obj = dynamic_cast (oldObjects[iObj]) ; if (obj) obj->setPreferredWay(branchDirection[iColumn]); } } if (pseudoUp) { abort(); } } const int * starts = process.startSOS(); const int * which = process.whichSOS(); const int * type = process.typeSOS(); const double * weight = process.weightSOS(); int iSOS; for (iSOS = 0; iSOS < numberSOS; iSOS++) { int iStart = starts[iSOS]; int n = starts[iSOS+1] - iStart; objects[iSOS] = new OsiSOS(testOsiSolver, n, which + iStart, weight + iStart, type[iSOS]); // branch on long sets first objects[iSOS]->setPriority(numberColumns - n); } testOsiSolver->addObjects(numberSOS, objects); for (iSOS = 0; iSOS < numberSOS; iSOS++) delete objects[iSOS]; delete [] objects; } else if (priorities || branchDirection || pseudoDown || pseudoUp || numberSOS) { if (numberSOS) { // Do sets and priorities OsiObject ** objects = new OsiObject * [numberSOS]; int iSOS; if (originalColumns) { // redo sequence numbers int numberColumns = testOsiSolver->getNumCols(); int nOld = originalColumns[numberColumns-1] + 1; int * back = new int[nOld]; int i; for (i = 0; i < nOld; i++) back[i] = -1; for (i = 0; i < numberColumns; i++) back[originalColumns[i]] = i; // Really need better checks int nMissing = 0; int n = sosStart[numberSOS]; for (i = 0; i < n; i++) { int iColumn = sosIndices[i]; int jColumn = back[iColumn]; if (jColumn >= 0) sosIndices[i] = jColumn; else nMissing++; } delete [] back; if (nMissing) { sprintf(generalPrint, "%d SOS variables vanished due to pre processing? - check validity?", nMissing); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } for (iSOS = 0; iSOS < numberSOS; iSOS++) { int iStart = sosStart[iSOS]; int n = sosStart[iSOS+1] - iStart; objects[iSOS] = new OsiSOS(testOsiSolver, n, sosIndices + iStart, sosReference + iStart, sosType[iSOS]); if (sosPriority) objects[iSOS]->setPriority(sosPriority[iSOS]); else if (!prioritiesIn) objects[iSOS]->setPriority(10); // rather than 1000 } // delete any existing SOS objects int numberObjects = testOsiSolver->numberObjects(); OsiObject ** oldObjects = testOsiSolver->objects(); int nNew = 0; for (int i = 0; i < numberObjects; i++) { OsiObject * objThis = oldObjects[i]; OsiSOS * obj1 = dynamic_cast (objThis) ; OsiSOS * obj2 = dynamic_cast (objThis) ; if (!obj1 && !obj2) { oldObjects[nNew++] = objThis; } else { delete objThis; } } testOsiSolver->setNumberObjects(nNew); testOsiSolver->addObjects(numberSOS, objects); for (iSOS = 0; iSOS < numberSOS; iSOS++) delete objects[iSOS]; delete [] objects; } } OsiObject ** objects = testOsiSolver->objects(); int numberObjects = testOsiSolver->numberObjects(); int logLevel = parameters_[log].intValue(); for (int iObj = 0; iObj < numberObjects; iObj++) { // skip sos OsiSOS * objSOS = dynamic_cast (objects[iObj]) ; if (objSOS) { if (logLevel > 2) printf("Set %d is SOS - priority %d\n", iObj, objSOS->priority()); continue; } int iColumn = objects[iObj]->columnNumber(); if (iColumn >= 0) { if (originalColumns) iColumn = originalColumns[iColumn]; if (branchDirection) { OsiSimpleInteger * obj = dynamic_cast (objects[iObj]) ; if (obj) { obj->setPreferredWay(branchDirection[iColumn]); } else { OsiObject2 * obj = dynamic_cast (objects[iObj]) ; if (obj) obj->setPreferredWay(branchDirection[iColumn]); } } if (priorities) { int iPriority = priorities[iColumn]; if (iPriority > 0) objects[iObj]->setPriority(iPriority); } if (logLevel > 2) printf("Obj %d is int? - priority %d\n", iObj, objects[iObj]->priority()); if (pseudoUp && pseudoUp[iColumn]) { abort(); } } } // ************************************************************* } int statistics = (printOptions > 0) ? printOptions : 0; #ifdef COIN_HAS_ASL if (!statusUserFunction_[0]) { #endif free(priorities); priorities = NULL; free(branchDirection); branchDirection = NULL; free(pseudoDown); pseudoDown = NULL; free(pseudoUp); pseudoUp = NULL; free(solutionIn); solutionIn = NULL; free(prioritiesIn); prioritiesIn = NULL; free(sosStart); sosStart = NULL; free(sosIndices); sosIndices = NULL; free(sosType); sosType = NULL; free(sosReference); sosReference = NULL; free(cut); cut = NULL; free(sosPriority); sosPriority = NULL; #ifdef COIN_HAS_ASL } #endif if (nodeStrategy) { // change default if (nodeStrategy > 2) { // up or down int way = (((nodeStrategy - 1) % 1) == 1) ? -1 : +1; babModel_->setPreferredWay(way); #ifdef JJF_ZERO OsiObject ** objects = babModel_->objects(); int numberObjects = babModel_->numberObjects(); for (int iObj = 0; iObj < numberObjects; iObj++) { CbcObject * obj = dynamic_cast (objects[iObj]) ; assert (obj); obj->setPreferredWay(way); } #endif } if (nodeStrategy == 2 || nodeStrategy > 4) { // depth CbcCompareDefault compare; compare.setWeight(-3.0); babModel_->setNodeComparison(compare); } else if (nodeStrategy == 0) { // hybrid was default i.e. mixture of low depth and infeasibility } else if (nodeStrategy == 1) { // real fewest CbcCompareDefault compare; compare.setWeight(-2.0); babModel_->setNodeComparison(compare); } } if (cppValue >= 0) { int prepro = useStrategy ? -1 : preProcess; // generate code FILE * fp = fopen("user_driver.cpp", "w"); if (fp) { // generate enough to do BAB babModel_->generateCpp(fp, 1); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); // Make general so do factorization int factor = osiclp->getModelPtr()->factorizationFrequency(); osiclp->getModelPtr()->setFactorizationFrequency(200); osiclp->generateCpp(fp); osiclp->getModelPtr()->setFactorizationFrequency(factor); //solveOptions.generateCpp(fp); fclose(fp); // now call generate code generateCode(babModel_, "user_driver.cpp", cppValue, prepro); } else { std::cout << "Unable to open file user_driver.cpp" << std::endl; } } if (!babModel_->numberStrong() && babModel_->numberBeforeTrust() > 0) babModel_->setNumberBeforeTrust(0); if (useStrategy) { CbcStrategyDefault strategy(1, babModel_->numberStrong(), babModel_->numberBeforeTrust()); strategy.setupPreProcessing(1); babModel_->setStrategy(strategy); } if (testOsiOptions >= 0) { sprintf(generalPrint, "Testing OsiObject options %d", testOsiOptions); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; if (!numberSOS) { babModel_->solver()->findIntegersAndSOS(false); #ifdef COIN_HAS_LINK // If linked then pass in model OsiSolverLink * solver3 = dynamic_cast (babModel_->solver()); if (solver3) { CbcHeuristicDynamic3 serendipity(*babModel_); serendipity.setHeuristicName("linked"); babModel_->addHeuristic(&serendipity); double dextra3 = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA3, numberParameters_, parameters_)].doubleValue(); if (dextra3) solver3->setMeshSizes(dextra3); int options = parameters_[whichParam(CBC_PARAM_INT_MIPOPTIONS, numberParameters_, parameters_)].intValue() / 10000; CglStored stored; if (options) { printf("nlp options %d\n", options); /* 1 - force mini branch and bound 2 - set priorities high on continuous 4 - try adding OA cuts 8 - try doing quadratic linearization 16 - try expanding knapsacks 32 - OA cuts strictly concave 64 - no branching at all on bilinear x-x! */ if ((options&2)) { solver3->setBiLinearPriorities(10, tightenFactor > 0.0 ? tightenFactor : 1.0); } else if (tightenFactor > 0.0) { // set grid size for all continuous bi-linear solver3->setMeshSizes(tightenFactor); } if ((options&4)) { solver3->setSpecialOptions2(solver3->specialOptions2() | (8 + 4)); // say convex solver3->sayConvex((options&32) == 0); } int extra1 = parameters_[whichParam(CBC_PARAM_INT_EXTRA1, numberParameters_, parameters_)].intValue(); if ((options&1) != 0 && extra1 > 0) solver3->setFixedPriority(extra1); double cutoff = COIN_DBL_MAX; if ((options&8)) cutoff = solver3->linearizedBAB(&stored); if (cutoff < babModel_->getCutoff()) { babModel_->setCutoff(cutoff); // and solution //babModel_->setBestObjectiveValue(solver3->bestObjectiveValue()); babModel_->setBestSolution(solver3->bestSolution(), solver3->getNumCols(), solver3->bestObjectiveValue()); } if ((options&64)) solver3->setBranchingStrategyOnVariables(16, -1, 4); } solver3->setCbcModel(babModel_); if (stored.sizeRowCuts()) babModel_->addCutGenerator(&stored, 1, "Stored"); CglTemporary temp; babModel_->addCutGenerator(&temp, 1, "OnceOnly"); //choose.setNumberBeforeTrusted(2000); //choose.setNumberStrong(20); } // For temporary testing of heuristics //int testOsiOptions = parameters_[whichParam(CBC_PARAM_INT_TESTOSI,numberParameters_,parameters_)].intValue(); if (testOsiOptions >= 10) { if (testOsiOptions >= 20) testOsiOptions -= 10; printf("*** Temp heuristic with mode %d\n", testOsiOptions - 10); OsiSolverLink * solver3 = dynamic_cast (babModel_->solver()); assert (solver3) ; int extra1 = parameters_[whichParam(CBC_PARAM_INT_EXTRA1, numberParameters_, parameters_)].intValue(); solver3->setBiLinearPriority(extra1); printf("bilinear priority now %d\n", extra1); int extra2 = parameters_[whichParam(CBC_PARAM_INT_EXTRA2, numberParameters_, parameters_)].intValue(); double saveDefault = solver3->defaultBound(); solver3->setDefaultBound(static_cast (extra2)); double * solution = solver3->heuristicSolution(slpValue > 0 ? slpValue : 40 , 1.0e-5, testOsiOptions - 10); solver3->setDefaultBound(saveDefault); if (!solution) printf("Heuristic failed\n"); } #endif } else { // move across babModel_->deleteObjects(false); //babModel_->addObjects(babModel_->solver()->numberObjects(),babModel_->solver()->objects()); } CbcBranchDefaultDecision decision; if (babModel_->numberStrong()) { OsiChooseStrong choose(babModel_->solver()); choose.setNumberBeforeTrusted(babModel_->numberBeforeTrust()); choose.setNumberStrong(babModel_->numberStrong()); choose.setShadowPriceMode(testOsiOptions); decision.setChooseMethod(choose); } else { OsiChooseVariable choose(babModel_->solver()); decision.setChooseMethod(choose); } babModel_->setBranchingMethod(decision); if (useCosts && testOsiOptions >= 0) { if(newPriorities ) { // get rid of delete [] newPriorities; newPriorities = NULL; } int numberColumns = babModel_->getNumCols(); int * sort = new int[numberColumns]; double * dsort = new double[numberColumns]; int * priority = new int [numberColumns]; const double * objective = babModel_->getObjCoefficients(); const double * lower = babModel_->getColLower() ; const double * upper = babModel_->getColUpper() ; const CoinPackedMatrix * matrix = babModel_->solver()->getMatrixByCol(); const int * columnLength = matrix->getVectorLengths(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { sort[iColumn] = iColumn; if (useCosts == 1) dsort[iColumn] = -fabs(objective[iColumn]); else if (useCosts == 2) dsort[iColumn] = iColumn; else if (useCosts == 3) dsort[iColumn] = upper[iColumn] - lower[iColumn]; else if (useCosts == 4) dsort[iColumn] = -(upper[iColumn] - lower[iColumn]); else if (useCosts == 5) dsort[iColumn] = -columnLength[iColumn]; } CoinSort_2(dsort, dsort + numberColumns, sort); int level = 0; double last = -1.0e100; for (int i = 0; i < numberColumns; i++) { int iPut = sort[i]; if (dsort[i] != last) { level++; last = dsort[i]; } priority[iPut] = level; } OsiObject ** objects = babModel_->objects(); int numberObjects = babModel_->numberObjects(); for (int iObj = 0; iObj < numberObjects; iObj++) { OsiObject * obj = objects[iObj] ; int iColumn = obj->columnNumber(); if (iColumn >= 0) obj->setPriority(priority[iColumn]); } delete [] priority; delete [] sort; delete [] dsort; } } checkSOS(babModel_, babModel_->solver()); if (doSprint > 0) { // Sprint for primal solves ClpSolve::SolveType method = ClpSolve::usePrimalorSprint; ClpSolve::PresolveType presolveType = ClpSolve::presolveOff; int numberPasses = 5; int options[] = {0, 3, 0, 0, 0, 0}; int extraInfo[] = { -1, 20, -1, -1, -1, -1}; extraInfo[1] = doSprint; int independentOptions[] = {0, 0, 3}; ClpSolve clpSolve(method, presolveType, numberPasses, options, extraInfo, independentOptions); // say use in OsiClp clpSolve.setSpecialOption(6, 1); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); osiclp->setSolveOptions(clpSolve); osiclp->setHintParam(OsiDoDualInResolve, false); // switch off row copy osiclp->getModelPtr()->setSpecialOptions(osiclp->getModelPtr()->specialOptions() | 256); osiclp->getModelPtr()->setInfeasibilityCost(1.0e11); } #ifdef COIN_HAS_LINK if (storedAmpl.sizeRowCuts()) { if (preProcess) { const int * originalColumns = process.originalColumns(); int numberColumns = babModel_->getNumCols(); int * newColumn = new int[numberOriginalColumns]; int i; for (i = 0; i < numberOriginalColumns; i++) newColumn[i] = -1; for (i = 0; i < numberColumns; i++) { int iColumn = originalColumns[i]; newColumn[iColumn] = i; } int * buildColumn = new int[numberColumns]; // Build up valid cuts int nBad = 0; int nCuts = storedAmpl.sizeRowCuts(); CglStored newCuts; for (i = 0; i < nCuts; i++) { const OsiRowCut * cut = storedAmpl.rowCutPointer(i); double lb = cut->lb(); double ub = cut->ub(); int n = cut->row().getNumElements(); const int * column = cut->row().getIndices(); const double * element = cut->row().getElements(); bool bad = false; for (int i = 0; i < n; i++) { int iColumn = column[i]; iColumn = newColumn[iColumn]; if (iColumn >= 0) { buildColumn[i] = iColumn; } else { bad = true; break; } } if (!bad) { newCuts.addCut(lb, ub, n, buildColumn, element); } else { nBad++; } } storedAmpl = newCuts; if (nBad) printf("%d cuts dropped\n", nBad); delete [] newColumn; delete [] buildColumn; } } #endif #ifdef CLP_MALLOC_STATISTICS malloc_stats(); malloc_stats2(); #endif #ifndef CBC_OTHER_SOLVER if (outputFormat == 5) { osiclp = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); lpSolver = osiclp->getModelPtr(); lpSolver->setPersistenceFlag(1); } #endif #ifdef COIN_HAS_ASL // add in lotsizing if (statusUserFunction_[0] && info.special) { int numberColumns = babModel_->getNumCols(); int i; int n = 0; if (preProcess) { const int * originalColumns = process.originalColumns(); for (i = 0; i < numberColumns; i++) { int iColumn = originalColumns[i]; assert (iColumn >= i); int iType = info.special[iColumn]; if (iType) { assert (iType == 1); n++; } info.special[i] = iType; } } if (n) { int numberIntegers = 0; int numberOldObjects = 0; OsiObject ** oldObjects = NULL; const double * lower = babModel_->solver()->getColLower(); const double * upper = babModel_->solver()->getColUpper(); if (testOsiOptions < 0) { // ************************************************************* // CbcObjects numberIntegers = babModel_->numberIntegers(); /* model may not have created objects If none then create */ if (!numberIntegers || !babModel_->numberObjects()) { int type = (pseudoUp) ? 1 : 0; babModel_->findIntegers(true, type); numberIntegers = babModel_->numberIntegers(); } oldObjects = babModel_->objects(); numberOldObjects = babModel_->numberObjects(); } else { numberIntegers = testOsiSolver->getNumIntegers(); if (!numberIntegers || !testOsiSolver->numberObjects()) { /* model may not have created objects If none then create */ testOsiSolver->findIntegers(false); numberIntegers = testOsiSolver->getNumIntegers(); } oldObjects = testOsiSolver->objects(); numberOldObjects = testOsiSolver->numberObjects(); } OsiObject ** objects = new OsiObject * [n]; n = 0; // set new objects to have one lower priority double ranges[] = { -COIN_DBL_MAX, -1.0, 1.0, COIN_DBL_MAX}; for (int iObj = 0; iObj < numberOldObjects; iObj++) { int iColumn = oldObjects[iObj]->columnNumber(); if (iColumn >= 0 && info.special[iColumn]) { if (lower[iColumn] <= -1.0 && upper[iColumn] >= 0.0) { ranges[0] = lower[iColumn]; ranges[3] = upper[iColumn]; int priority = oldObjects[iObj]->priority(); if (testOsiOptions < 0) { objects[n] = new CbcLotsize(babModel_, iColumn, 2, ranges, true); } else { objects[n] = new OsiLotsize(testOsiSolver, iColumn, 2, ranges, true); } objects[n++]->setPriority (priority - 1); } } } if (testOsiOptions < 0) { babModel_->addObjects(n, objects); } else { testOsiSolver->addObjects(n, objects); } for (i = 0; i < n; i++) delete objects[i]; delete [] objects; } } #endif if (storedAmpl.sizeRowCuts()) { //babModel_->addCutGenerator(&storedAmpl,1,"AmplStored"); int numberRowCuts = storedAmpl.sizeRowCuts(); for (int i = 0; i < numberRowCuts; i++) { const OsiRowCut * rowCutPointer = storedAmpl.rowCutPointer(i); babModel_->makeGlobalCut(rowCutPointer); } } // If defaults then increase trust for small models if (!strongChanged) { int numberColumns = babModel_->getNumCols(); if (numberColumns <= 50) babModel_->setNumberBeforeTrust(1000); else if (numberColumns <= 100) babModel_->setNumberBeforeTrust(100); else if (numberColumns <= 300) babModel_->setNumberBeforeTrust(50); } #ifdef CBC_THREAD int numberThreads = parameters_[whichParam(CBC_PARAM_INT_THREADS, numberParameters_, parameters_)].intValue(); babModel_->setNumberThreads(numberThreads % 100); babModel_->setThreadMode(numberThreads / 100); #endif int returnCode = callBack(babModel_, 3); if (returnCode) { // exit if user wants delete babModel_; babModel_ = NULL; return returnCode; } #ifndef CBC_OTHER_SOLVER osiclp = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); lpSolver = osiclp->getModelPtr(); int hotits = parameters_[whichParam(CBC_PARAM_INT_MAXHOTITS, numberParameters_, parameters_)].intValue(); if (hotits>100) { osiclp->setSpecialOptions(osiclp->specialOptions()&~32); osiclp->setIntParam(OsiMaxNumIterationHotStart, hotits); } else { osiclp->setIntParam(OsiMaxNumIterationHotStart, hotits); } #elif CBC_OTHER_SOLVER==1 #endif if ((experimentFlag >= 1 || strategyFlag >= 1) && babModel_->fastNodeDepth() == -1) { if (babModel_->solver()->getNumCols() + babModel_->solver()->getNumRows() < 500) babModel_->setFastNodeDepth(-12); } else if (babModel_->fastNodeDepth() == -999) { babModel_->setFastNodeDepth(-1); } int heurOptions = parameters_[whichParam(CBC_PARAM_INT_HOPTIONS, numberParameters_, parameters_)].intValue(); if (heurOptions > 100) babModel_->setSpecialOptions(babModel_->specialOptions() | 8192); #ifndef CBC_OTHER_SOLVER #ifdef CLP_MULTIPLE_FACTORIZATIONS int denseCode = parameters_[whichParam(CBC_PARAM_INT_DENSE, numberParameters_, parameters_)].intValue(); int smallCode = parameters_[whichParam(CBC_PARAM_INT_SMALLFACT, numberParameters_, parameters_)].intValue(); if (bothFlags >= 1) { if (denseCode < 0) denseCode = 40; if (smallCode < 0 && !lpSolver->factorization()->isDenseOrSmall()) smallCode = 40; } if (denseCode > 0) { lpSolver->factorization()->setGoDenseThreshold(denseCode); assert (osiclp == babModel_->solver()); osiclp->setSpecialOptions(osiclp->specialOptions() | 1024); } if (smallCode > 0 && smallCode > denseCode) lpSolver->factorization()->setGoSmallThreshold(smallCode); //if (denseCode>=lpSolver->numberRows()) { //lpSolver->factorization()->goDense(); //} if (lpSolver->factorization()->goOslThreshold() > 1000) { // use osl in gomory (may not if CglGomory decides not to) int numberGenerators = babModel_->numberCutGenerators(); int nGomory=0; for (int iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = babModel_->cutGenerator(iGenerator); CglGomory * gomory = dynamic_cast (generator->generator()); if (gomory) { if (nGomory<2) { gomory->useAlternativeFactorization(); } else if (gomory->originalSolver()) { OsiClpSolverInterface * clpSolver = dynamic_cast(gomory->originalSolver()); if (clpSolver) { ClpSimplex * simplex = clpSolver->getModelPtr(); simplex->factorization()->setGoOslThreshold(0); } } nGomory++; } } } #endif #endif #ifdef CLIQUE_ANALYSIS if (!storedAmpl.sizeRowCuts()) { printf("looking at probing\n"); babModel_->addCutGenerator(&storedAmpl, 1, "Stored"); } #endif if (useSolution > 1) { // use hotstart to try and find solution CbcHeuristicPartial partial(*babModel_, 10000, useSolution); partial.setHeuristicName("Partial solution given"); babModel_->addHeuristic(&partial); } if (logLevel <= 1) babModel_->solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); #ifdef CBC_TEMP1 if (osiclp->getModelPtr()->perturbation() == 50) osiclp->getModelPtr()->setPerturbation(52); // try less #endif #ifdef JJF_ZERO if (osiclp->getNumCols() == 29404) { void restoreSolution(ClpSimplex * lpSolver, std::string fileName, int mode); restoreSolution(osiclp->getModelPtr(), "debug.file", 0); int numberColumns = osiclp->getNumCols(); const double * solution = osiclp->getColSolution(); const int * originalColumns = process.originalColumns(); for (int i = 0; i < numberColumns; i++) { int iColumn = originalColumns[i]; if (saveSolver->isInteger(iColumn)) { double value = solution[i]; double value2 = floor(value + 0.5); assert (fabs(value - value2) < 1.0e-3); saveSolver->setColLower(iColumn, value2); saveSolver->setColUpper(iColumn, value2); } } saveSolver->writeMps("fixed"); babModel_->setBestSolution(osiclp->getColSolution(), osiclp->getNumCols(), 1.5325e10); } else { babModel_->branchAndBound(statistics); } #else #ifdef ORBITAL CbcOrbital orbit(babModel_); orbit.morph(); exit(1); #endif int hOp1 = parameters_[whichParam(CBC_PARAM_INT_HOPTIONS, numberParameters_, parameters_)].intValue() / 100000; if (hOp1 % 10) { CbcCompareDefault compare; compare.setBreadthDepth(hOp1 % 10); babModel_->setNodeComparison(compare); } #if CBC_OTHER_SOLVER==1 if (dynamic_cast (babModel_->solver())) babModel_->solver()->messageHandler()->setLogLevel(0); #endif if (parameters_[whichParam(CBC_PARAM_STR_CPX, numberParameters_, parameters_)].currentOptionAsInteger()) { babModel_->setSpecialOptions(babModel_->specialOptions() | 16384); //if (babModel_->fastNodeDepth()==-1) babModel_->setFastNodeDepth(-2); // Use Cplex at root } int hOp2 = parameters_[whichParam(CBC_PARAM_INT_HOPTIONS, numberParameters_, parameters_)].intValue() / 10000; if (hOp2 % 10) { babModel_->setSpecialOptions(babModel_->specialOptions() | 16384); if (babModel_->fastNodeDepth() == -1) babModel_->setFastNodeDepth(-2); // Use Cplex at root } if (experimentFlag >= 5) { CbcModel donor(*babModel_); int options = babModel_->specialOptions(); donor.setSpecialOptions(options | 262144); ClpSimplex * lpSolver2; OsiClpSolverInterface * clpSolver2; clpSolver2 = dynamic_cast (donor.solver()); assert (clpSolver2); lpSolver2 = clpSolver2->getModelPtr(); assert (lpSolver2); if (lpSolver->factorization()->isDenseOrSmall()) { lpSolver2->factorization()->forceOtherFactorization(0); lpSolver2->factorization()->setGoOslThreshold(0); lpSolver2->factorization()->setGoDenseThreshold(0); lpSolver2->factorization()->setGoSmallThreshold(0); lpSolver2->allSlackBasis(); lpSolver2->initialSolve(); int numberGenerators = donor.numberCutGenerators(); for (int iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = donor.cutGenerator(iGenerator); CglGomory * gomory = dynamic_cast (generator->generator()); if (gomory) gomory->useAlternativeFactorization(false); } } else { printf("code this\n"); abort(); } babModel_->setSpecialOptions(options | 524288); CglStored * stored = new CglStored(donor.getNumCols()); donor.setStoredRowCuts(stored); donor.branchAndBound(0); babModel_->setStoredRowCuts(donor.storedRowCuts()); donor.setStoredRowCuts(NULL); } // We may have priorities from extra variables int more2 = parameters_[whichParam(CBC_PARAM_INT_MOREMOREMIPOPTIONS, numberParameters_, parameters_)].intValue(); if(newPriorities ) { if (truncateColumnsgetNumCols()) { // set new ones as high prority babModel_->passInPriorities(newPriorities,false); } delete [] newPriorities; } else if ((more2&(512|1024)) != 0) { babModel_->findIntegers(true); int numberIntegers = babModel_->numberIntegers(); int * newPriorities = new int [numberIntegers]; int n = numberIntegers - (babModel_->getNumCols()-truncateColumns); for (int i=0;ipriority(i); #if 1 int ixxxxxx = parameters_[whichParam(CBC_PARAM_INT_MAXNODES, numberParameters_, parameters_)].intValue(); int obj_priority=1000; int slack_priority=1000; if (ixxxxxx>=1000000&&ixxxxxx<1010000) { ixxxxxx -= 1000000; if (ixxxxxx == 0) { obj_priority=1000; slack_priority=1000; } else if(ixxxxxx == 1) { obj_priority=10000; slack_priority=10000; } else if(ixxxxxx == 2) { obj_priority=100; slack_priority=100; } else if(ixxxxxx == 3) { obj_priority=100; slack_priority=10000; } else if(ixxxxxx == 4) { obj_priority=10000; slack_priority=100; } else if(ixxxxxx == 5) { obj_priority=100; slack_priority=200; } else if(ixxxxxx == 6) { obj_priority=200; slack_priority=100; } else { abort(); } } if ((more2&512)!=0) { newPriorities[n++]=obj_priority; } if ((more2&1024)!=0) { for (int i=n;ipassInPriorities(newPriorities,false); delete [] newPriorities; } #ifdef JJF_ZERO int extra5 = parameters_[whichParam(EXTRA5, numberParameters_, parameters_)].intValue(); if (extra5 > 0) { int numberGenerators = babModel_->numberCutGenerators(); for (int iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = babModel_->cutGenerator(iGenerator); CglGomory * gomory = dynamic_cast (generator->generator()); if (gomory) { CglGomory gomory2(*gomory); gomory2.useAlternativeFactorization(!gomory->alternativeFactorization()); babModel_->addCutGenerator(&gomory2, -99, "Gomory2"); } } } #endif int specialOptions = parameters_[whichParam(CBC_PARAM_INT_STRONG_STRATEGY, numberParameters_, parameters_)].intValue(); if (specialOptions>=0) babModel_->setStrongStrategy(specialOptions); int jParam = whichParam(CBC_PARAM_STR_CUTOFF_CONSTRAINT, numberParameters_, parameters_); if(parameters_[jParam].currentOptionAsInteger()) { babModel_->setCutoffAsConstraint(true); int moreOptions=babModel_->moreSpecialOptions(); if(parameters_[jParam].currentOptionAsInteger()==4) babModel_->setMoreSpecialOptions(moreOptions|4194304); } int multipleRoot = parameters_[whichParam(CBC_PARAM_INT_MULTIPLEROOTS, numberParameters_, parameters_)].intValue(); if (multipleRoot<10000) { babModel_->setMultipleRootTries(multipleRoot); } else { // will be doing repeated solves and saves int numberGoes=multipleRoot/10000; multipleRoot-=10000*numberGoes; int moreOptions=babModel_->moreSpecialOptions(); if (numberGoes<100) { remove("global.cuts"); remove("global.fix"); moreOptions |= (67108864|134217728); } else { moreOptions |= 67108864*(numberGoes/100); numberGoes=numberGoes%100; } babModel_->setMultipleRootTries(multipleRoot); babModel_->setMoreSpecialOptions(moreOptions); int numberColumns=babModel_->getNumCols(); double * bestValues=new double [numberGoes]; double ** bestSolutions=new double * [numberGoes]; int * which=new int[numberGoes]; int numberSolutions=0; sprintf(generalPrint,"Starting %d passes each with %d solvers", numberGoes, multipleRoot%10); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; for (int iGo=0;iGomessage(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; CbcModel tempModel=*babModel_; tempModel.setMaximumNodes(0); // switch off cuts if none generated int numberGenerators = tempModel.numberCutGenerators(); for (int iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = tempModel.cutGenerator(iGenerator); generator->setSwitchOffIfLessThan(1); } // random tempModel.setRandomSeed(tempModel.getRandomSeed()+100000000*(iGo+1+5*numberGoes)); for (int i=0;isetSeed(tempModel.heuristic(i)->getSeed()+100000000*iGo); #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * solver = dynamic_cast (tempModel.solver()); ClpSimplex * simplex = solver->getModelPtr(); int solverSeed=simplex->randomNumberGenerator()->getSeed(); simplex->setRandomSeed(solverSeed+100000000*(iGo+1)); #endif tempModel.branchAndBound(); if (tempModel.bestSolution()) { bestSolutions[numberSolutions]= CoinCopyOfArray(tempModel.bestSolution(), numberColumns); bestValues[numberSolutions]=-tempModel.getMinimizationObjValue(); which[numberSolutions]=numberSolutions; numberSolutions++; } } // allow solutions double sense = babModel_->solver()->getObjSense();; CoinSort_2(bestValues,bestValues+numberSolutions,which); babModel_->setMoreSpecialOptions(moreOptions&(~16777216)); for (int i=0;igetCutoff()) { babModel_->setBestSolution(bestSolutions[k],numberColumns, -bestValues[i]*sense,true); babModel_->incrementUsed(bestSolutions[k]); } delete [] bestSolutions[k]; } babModel_->setMoreSpecialOptions(moreOptions); if (numberSolutions) sprintf(generalPrint,"Ending major passes - best solution %g",-bestValues[numberSolutions-1]); else sprintf(generalPrint,"Ending major passes - no solution found"); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; delete [] which; delete [] bestValues; delete [] bestSolutions; } if (biLinearProblem) babModel_->setSpecialOptions(babModel_->specialOptions() &(~(512|32768))); babModel_->setMoreSpecialOptions2(parameters_[whichParam(CBC_PARAM_INT_MOREMOREMIPOPTIONS, numberParameters_, parameters_)].intValue()); #ifdef COIN_HAS_NTY { int jParam = whichParam(CBC_PARAM_STR_ORBITAL, numberParameters_, parameters_); if(parameters_[jParam].currentOptionAsInteger()) { int k = parameters_[jParam].currentOptionAsInteger(); babModel_->setMoreSpecialOptions2(babModel_->moreSpecialOptions2() | (k*128)); } } #endif babModel_->branchAndBound(statistics); if (truncateColumnssolver()->getNumCols()) { OsiSolverInterface * solverX = babModel_->solver(); int numberColumns=solverX->getNumCols(); int numberRows=solverX->getNumRows(); int numberDelete = numberColumns-truncateColumns; int * delStuff=new int [numberDelete]; for (int i=0;ideleteCols(numberDelete,delStuff); numberDelete = numberRows-truncateRows; for (int i=0;ideleteRows(numberDelete,delStuff); delete [] delStuff; if (truncatedRhsLower) { numberRows=solverX->getNumRows(); for (int i=0;isetRowLower(i,truncatedRhsLower[i]); solverX->setRowUpper(i,truncatedRhsUpper[i]); } delete [] truncatedRhsLower; delete [] truncatedRhsUpper; } } //#define CLP_FACTORIZATION_INSTRUMENT #ifdef CLP_FACTORIZATION_INSTRUMENT extern double factorization_instrument(int type); double facTime = factorization_instrument(0); printf("Factorization %g seconds\n", facTime); #endif #endif #ifdef COIN_DEVELOP #ifndef JJF_ONE { int numberColumns = babModel_->getNumCols(); const double * solution = babModel_->bestSolution(); if (solution && numberColumns < 1000) { for (int i = 0; i < numberColumns; i++) { if (solution[i]) printf("SOL %d %.18g\n", i, solution[i]); } } } #endif void printHistory(const char * file/*,CbcModel * model*/); printHistory("branch.log"/*,babModel_*/); #endif returnCode = callBack(babModel_, 4); if (returnCode) { // exit if user wants model_.moveInfo(*babModel_); delete babModel_; babModel_ = NULL; return returnCode; } else { int numberSolutions = babModel_->numberSavedSolutions(); if (numberSolutions>1) { for (int iSolution=numberSolutions-1;iSolution>=0;iSolution--) { model_.setBestSolution(babModel_->savedSolution(iSolution), model_.solver()->getNumCols(), babModel_->savedSolutionObjective(iSolution)); } } } #ifdef CLP_MALLOC_STATISTICS malloc_stats(); malloc_stats2(); #endif checkSOS(babModel_, babModel_->solver()); } else if (type == CBC_PARAM_ACTION_MIPLIB) { int typeOfCuts = babModel_->numberCutGenerators() ? 1 : -1; CbcStrategyDefault strategy(typeOfCuts, babModel_->numberStrong(), babModel_->numberBeforeTrust()); // Set up pre-processing int translate2[] = {9999, 1, 1, 3, 2, 4, 5, 6, 6}; if (preProcess) strategy.setupPreProcessing(translate2[ preProcess ]); babModel_->setStrategy(strategy); #ifdef CBC_THREAD int numberThreads = parameters_[whichParam(CBC_PARAM_INT_THREADS, numberParameters_, parameters_)].intValue(); babModel_->setNumberThreads(numberThreads % 100); babModel_->setThreadMode(numberThreads / 100); #endif #ifndef CBC_OTHER_SOLVER if (outputFormat == 5) { osiclp = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); lpSolver = osiclp->getModelPtr(); lpSolver->setPersistenceFlag(1); } #endif if (testOsiOptions >= 0) { printf("Testing OsiObject options %d\n", testOsiOptions); CbcBranchDefaultDecision decision; OsiChooseStrong choose(babModel_->solver()); choose.setNumberBeforeTrusted(babModel_->numberBeforeTrust()); choose.setNumberStrong(babModel_->numberStrong()); choose.setShadowPriceMode(testOsiOptions); //babModel_->deleteObjects(false); decision.setChooseMethod(choose); babModel_->setBranchingMethod(decision); } model_ = *babModel_; #ifndef CBC_OTHER_SOLVER { osiclp = dynamic_cast< OsiClpSolverInterface*> (model_.solver()); lpSolver = osiclp->getModelPtr(); lpSolver->setSpecialOptions(lpSolver->specialOptions() | IN_BRANCH_AND_BOUND); // say is Cbc (and in branch and bound) if (lpSolver->factorization()->goOslThreshold() > 1000) { // use osl in gomory (may not if CglGomory decides not to) int numberGenerators = model_.numberCutGenerators(); for (int iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = model_.cutGenerator(iGenerator); CglGomory * gomory = dynamic_cast (generator->generator()); if (gomory) gomory->useAlternativeFactorization(); } } } #endif /* LL: this was done in CoinSolve.cpp: main(argc, argv). I have moved it here so that the miplib directory location could be passed to CbcClpUnitTest. */ /* JJF: No need to have 777 flag at all - user says -miplib */ int extra2 = parameters_[whichParam(CBC_PARAM_INT_EXTRA2, numberParameters_, parameters_)].intValue(); double stuff[11]; stuff[0] = parameters_[whichParam(CBC_PARAM_DBL_FAKEINCREMENT, numberParameters_, parameters_)].doubleValue(); stuff[1] = parameters_[whichParam(CBC_PARAM_DBL_FAKECUTOFF, numberParameters_, parameters_)].doubleValue(); stuff[2] = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA3, numberParameters_, parameters_)].doubleValue(); stuff[3] = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA4, numberParameters_, parameters_)].doubleValue(); stuff[4] = parameters_[whichParam(CBC_PARAM_INT_DENSE, numberParameters_, parameters_)].intValue(); stuff[5] = parameters_[whichParam(CBC_PARAM_INT_EXTRA1, numberParameters_, parameters_)].intValue(); stuff[6] = parameters_[whichParam(CBC_PARAM_INT_EXTRA3, numberParameters_, parameters_)].intValue(); stuff[7] = parameters_[whichParam(CBC_PARAM_INT_DEPTHMINIBAB, numberParameters_, parameters_)].intValue(); stuff[8] = bothFlags; stuff[9] = doVector; stuff[10] = parameters_[whichParam(CBC_PARAM_INT_SMALLFACT, numberParameters_, parameters_)].intValue(); if ( dominatedCuts) model_.setSpecialOptions(model_.specialOptions() | 64); if (parameters_[whichParam(CBC_PARAM_STR_CPX, numberParameters_, parameters_)].currentOptionAsInteger()) { model_.setSpecialOptions(model_.specialOptions() | 16384); //if (model_.fastNodeDepth()==-1) model_.setFastNodeDepth(-2); // Use Cplex at root } int hOp2 = parameters_[whichParam(CBC_PARAM_INT_HOPTIONS, numberParameters_, parameters_)].intValue() / 10000; if (hOp2 % 10) { model_.setSpecialOptions(model_.specialOptions() | 16384); if (model_.fastNodeDepth() == -1) model_.setFastNodeDepth(-2); // Use Cplex at root } int multipleRoot = parameters_[whichParam(CBC_PARAM_INT_MULTIPLEROOTS, numberParameters_, parameters_)].intValue(); model_.setMultipleRootTries(multipleRoot); int specialOptions = parameters_[whichParam(CBC_PARAM_INT_STRONG_STRATEGY, numberParameters_, parameters_)].intValue(); if (specialOptions>=0) model_.setStrongStrategy(specialOptions); if (!pumpChanged) { // Make more lightweight for (int iHeur = 0; iHeur < model_.numberHeuristics(); iHeur++) { CbcHeuristic * heuristic = model_.heuristic(iHeur); CbcHeuristicFPump* pump = dynamic_cast(heuristic); if (pump) { CbcHeuristicFPump heuristic4(model_); heuristic4.setFractionSmall(0.5); heuristic4.setMaximumPasses(5); heuristic4.setFeasibilityPumpOptions(30); heuristic4.setWhen(13); heuristic4.setHeuristicName("feasibility pump"); //CbcHeuristicFPump & pump2 = pump; *pump = heuristic4; } } } int returnCode = CbcClpUnitTest(model_, dirMiplib, extra2, stuff); babModel_ = NULL; return returnCode; } else { abort(); // can't get here //strengthenedModel = babModel_->strengthenedModel(); } currentBranchModel = NULL; #ifndef CBC_OTHER_SOLVER osiclp = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); if (debugFile == "createAfterPre" && babModel_->bestSolution()) { lpSolver = osiclp->getModelPtr(); //move best solution (should be there -- but ..) int n = lpSolver->getNumCols(); memcpy(lpSolver->primalColumnSolution(), babModel_->bestSolution(), n*sizeof(double)); saveSolution(osiclp->getModelPtr(), "debug.file"); } #endif statistics_cut_time = 0.0; if (!noPrinting_) { // Print more statistics sprintf(generalPrint, "Cuts at root node changed objective from %g to %g", babModel_->getContinuousObjective(), babModel_->rootObjectiveAfterCuts()); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; numberGenerators = babModel_->numberCutGenerators(); statistics_number_cuts = new int [numberGenerators];; statistics_number_generators = numberGenerators; statistics_name_generators = new const char *[numberGenerators]; char timing[30]; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CbcCutGenerator * generator = babModel_->cutGenerator(iGenerator); statistics_name_generators[iGenerator] = generator->cutGeneratorName(); statistics_number_cuts[iGenerator] = generator->numberCutsInTotal(); sprintf(generalPrint, "%s was tried %d times and created %d cuts of which %d were active after adding rounds of cuts", generator->cutGeneratorName(), generator->numberTimesEntered(), generator->numberCutsInTotal() + generator->numberColumnCuts(), generator->numberCutsActive()); if (generator->timing()) { sprintf(timing, " (%.3f seconds)", generator->timeInCutGenerator()); strcat(generalPrint, timing); statistics_cut_time += generator->timeInCutGenerator(); } CglStored * stored = dynamic_cast(generator->generator()); if (stored && !generator->numberCutsInTotal()) continue; #ifndef CLP_INVESTIGATE CglImplication * implication = dynamic_cast(generator->generator()); if (implication && !generator->numberCutsInTotal()) continue; #endif generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } #ifdef COIN_DEVELOP printf("%d solutions found by heuristics\n", babModel_->getNumberHeuristicSolutions()); // Not really generator but I am feeling lazy for (iGenerator = 0; iGenerator < babModel_->numberHeuristics(); iGenerator++) { CbcHeuristic * heuristic = babModel_->heuristic(iGenerator); if (heuristic->numRuns()) { // Need to bring others inline sprintf(generalPrint, "%s was tried %d times out of %d and created %d solutions\n", heuristic->heuristicName(), heuristic->numRuns(), heuristic->numCouldRun(), heuristic->numberSolutionsFound()); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } #endif } // adjust time to allow for children on some systems time2 = CoinCpuTime() + CoinCpuTimeJustChildren(); totalTime += time2 - time1; // For best solution double * bestSolution = NULL; // Say in integer if (babModel_->status()) { // treat as stopped integerStatus = 3; } else { if (babModel_->isProvenOptimal()) { integerStatus = 0; } else if (!babModel_->bestSolution()) { // infeasible integerStatus = 6; delete saveSolver; saveSolver=NULL; } } if (babModel_->getMinimizationObjValue() < 1.0e50 && type == CBC_PARAM_ACTION_BAB) { // post process int n; if (preProcess) { n = saveSolver->getNumCols(); bestSolution = new double [n]; #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); #else OsiCpxSolverInterface * clpSolver = dynamic_cast< OsiCpxSolverInterface*> (babModel_->solver()); #endif // Save bounds on processed model const int * originalColumns = process.originalColumns(); int numberColumns2 = clpSolver->getNumCols(); double * solution2 = new double[n]; double * lower2 = new double [n]; double * upper2 = new double [n]; for (int i = 0; i < n; i++) { solution2[i] = COIN_DBL_MAX; lower2[i] = COIN_DBL_MAX; upper2[i] = -COIN_DBL_MAX; } const double *columnLower = clpSolver->getColLower() ; const double * columnUpper = clpSolver->getColUpper() ; const double * solution = babModel_->bestSolution(); for (int i = 0; i < numberColumns2; i++) { int jColumn = originalColumns[i]; if (jColumn < n) { solution2[jColumn] = solution[i]; lower2[jColumn] = columnLower[i]; upper2[jColumn] = columnUpper[i]; } } #ifndef CBC_OTHER_SOLVER ClpSimplex * lpSolver = clpSolver->getModelPtr(); lpSolver->setSpecialOptions(lpSolver->specialOptions() | IN_BRANCH_AND_BOUND); // say is Cbc (and in branch and bound) #endif // put back any saved solutions putBackOtherSolutions(babModel_,&model_,&process); process.postProcess(*babModel_->solver()); #ifdef COIN_DEVELOP if (model_.bestSolution() && fabs(model_.getMinimizationObjValue() - babModel_->getMinimizationObjValue()) < 1.0e-8) { const double * b1 = model_.bestSolution(); const double * b2 = saveSolver->getColSolution(); const double * columnLower = saveSolver->getColLower() ; const double * columnUpper = saveSolver->getColUpper() ; for (int i = 0; i < n; i++) { if (fabs(b1[i] - b2[i]) > 1.0e-7) { printf("%d %g %g %g %g\n", i, b1[i], b2[i], columnLower[i], columnUpper[i]); } } } #endif bool tightenB = false; { int n = babModel_->numberObjects(); for (int i = 0; i < n; i++) { const OsiObject * obj = babModel_->object(i); if (!dynamic_cast(obj)) { tightenB = true; break; } } } // Solution now back in saveSolver // Double check bounds columnLower = saveSolver->getColLower() ; columnUpper = saveSolver->getColUpper() ; solution = saveSolver->getColSolution(); int numberChanged = 0; for (int i = 0; i < n; i++) { if (!saveSolver->isInteger(i) && !tightenB) continue; if (lower2[i] != COIN_DBL_MAX) { if (lower2[i] != columnLower[i] || upper2[i] != columnUpper[i]) { if (lower2[i] < columnLower[i] || upper2[i] > columnUpper[i]) { #ifdef COIN_DEVELOP printf("odd bounds tighter"); printf("%d bab bounds %g %g now %g %g\n", i, lower2[i], upper2[i], columnLower[i], columnUpper[i]); #endif } else { #ifdef COIN_DEVELOP printf("%d bab bounds %g %g now %g %g\n", i, lower2[i], upper2[i], columnLower[i], columnUpper[i]); #endif numberChanged++; saveSolver->setColLower(i, lower2[i]); saveSolver->setColUpper(i, upper2[i]); } } } } #ifdef JJF_ZERO // See if sos so we can fix OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (saveSolver); if (osiclp && osiclp->numberSOS()) { // SOS numberSOS = osiclp->numberSOS(); const CoinSet * setInfo = osiclp->setInfo(); int i; for ( i = 0; i < numberSOS; i++) { int type = setInfo[i].setType(); int n = setInfo[i].numberEntries(); const int * which = setInfo[i].which(); int first = -1; int last = -1; for (int j = 0; j < n; j++) { int iColumn = which[j]; if (fabs(solution[iColumn]) > 1.0e-7) { last = j; if (first < 0) first = j; } } assert (last - first < type); for (int j = 0; j < n; j++) { if (j < first || j > last) { int iColumn = which[j]; saveSolver->setColLower(iColumn, 0.0); saveSolver->setColUpper(iColumn, 0.0); } } } } #endif delete [] solution2; delete [] lower2; delete [] upper2; if (numberChanged) { sprintf(generalPrint, "%d bounds tightened after postprocessing\n", numberChanged); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } saveSolver->resolve(); if (!saveSolver->isProvenOptimal()) { // try all slack CoinWarmStartBasis * basis = dynamic_cast (babModel_->solver()->getEmptyWarmStart()); saveSolver->setWarmStart(basis); delete basis; saveSolver->initialSolve(); #ifdef COIN_DEVELOP saveSolver->writeMps("inf2"); #endif OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (saveSolver); if (osiclp) osiclp->getModelPtr()->checkUnscaledSolution(); } if (!saveSolver->isProvenOptimal()) { generalMessageHandler->message(CLP_GENERAL, generalMessages) << "Accuracy problem on post-processing - maybe try without pre-processing" << CoinMessageEol; } //assert (saveSolver->isProvenOptimal()); #ifndef CBC_OTHER_SOLVER // and original solver originalSolver->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); assert (n >= originalSolver->getNumCols()); n = originalSolver->getNumCols(); originalSolver->setColLower(saveSolver->getColLower()); originalSolver->setColUpper(saveSolver->getColUpper()); // basis CoinWarmStartBasis * basis = dynamic_cast (babModel_->solver()->getWarmStart()); originalSolver->setBasis(*basis); delete basis; originalSolver->resolve(); if (!originalSolver->isProvenOptimal()) { // try all slack CoinWarmStartBasis * basis = dynamic_cast (babModel_->solver()->getEmptyWarmStart()); originalSolver->setBasis(*basis); delete basis; originalSolver->initialSolve(); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (originalSolver); if (osiclp) osiclp->getModelPtr()->checkUnscaledSolution(); } assert (originalSolver->isProvenOptimal()); #endif babModel_->assignSolver(saveSolver); memcpy(bestSolution, babModel_->solver()->getColSolution(), n*sizeof(double)); } else { n = babModel_->solver()->getNumCols(); bestSolution = new double [n]; memcpy(bestSolution, babModel_->solver()->getColSolution(), n*sizeof(double)); } if (returnMode == 1&&model_.numberSavedSolutions()<2) { model_.deleteSolutions(); model_.setBestSolution(bestSolution, n, babModel_->getMinimizationObjValue()); } babModel_->deleteSolutions(); babModel_->setBestSolution(bestSolution, n, babModel_->getMinimizationObjValue()); #ifndef CBC_OTHER_SOLVER // and put back in very original solver { ClpSimplex * original = originalSolver->getModelPtr(); double * lower = original->columnLower(); double * upper = original->columnUpper(); double * solution = original->primalColumnSolution(); int n = original->numberColumns(); //assert (!n||n==babModel_->solver()->getNumCols()); for (int i = 0; i < n; i++) { solution[i] = bestSolution[i]; if (originalSolver->isInteger(i)) { lower[i] = solution[i]; upper[i] = solution[i]; } } // basis CoinWarmStartBasis * basis = dynamic_cast (babModel_->solver()->getWarmStart()); originalSolver->setBasis(*basis); delete basis; originalSolver->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); originalSolver->resolve(); if (!originalSolver->isProvenOptimal()) { // try all slack CoinWarmStartBasis * basis = dynamic_cast (babModel_->solver()->getEmptyWarmStart()); originalSolver->setBasis(*basis); delete basis; originalSolver->initialSolve(); OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (originalSolver); if (osiclp) osiclp->getModelPtr()->checkUnscaledSolution(); #ifdef CLP_INVESTIGATE if (!originalSolver->isProvenOptimal()) { if (saveSolver) { printf("saveSolver and originalSolver matrices saved\n"); saveSolver->writeMps("infA"); } else { printf("originalSolver matrix saved\n"); originalSolver->writeMps("infB"); } } #endif } assert (originalSolver->isProvenOptimal()); } #endif checkSOS(babModel_, babModel_->solver()); } else if (model_.bestSolution() && type == CBC_PARAM_ACTION_BAB && model_.getMinimizationObjValue() < 1.0e50 && preProcess) { sprintf(generalPrint, "Restoring heuristic best solution of %g", model_.getMinimizationObjValue()); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; int n = saveSolver->getNumCols(); bestSolution = new double [n]; // Put solution now back in saveSolver saveSolver->setColSolution(model_.bestSolution()); babModel_->assignSolver(saveSolver); saveSolver=NULL; babModel_->setMinimizationObjValue(model_.getMinimizationObjValue()); memcpy(bestSolution, babModel_->solver()->getColSolution(), n*sizeof(double)); #ifndef CBC_OTHER_SOLVER // and put back in very original solver { ClpSimplex * original = originalSolver->getModelPtr(); double * lower = original->columnLower(); double * upper = original->columnUpper(); double * solution = original->primalColumnSolution(); int n = original->numberColumns(); //assert (!n||n==babModel_->solver()->getNumCols()); for (int i = 0; i < n; i++) { solution[i] = bestSolution[i]; if (originalSolver->isInteger(i)) { lower[i] = solution[i]; upper[i] = solution[i]; } } // basis CoinWarmStartBasis * basis = dynamic_cast (babModel_->solver()->getWarmStart()); originalSolver->setBasis(*basis); delete basis; } #endif } #ifndef CBC_OTHER_SOLVER //if (type==CBC_PARAM_ACTION_STRENGTHEN&&strengthenedModel) //clpSolver = dynamic_cast< OsiClpSolverInterface*> (strengthenedModel); #ifdef COIN_HAS_ASL else if (statusUserFunction_[0]) clpSolver = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); #endif lpSolver = clpSolver->getModelPtr(); if (numberChanged) { for (int i = 0; i < numberChanged; i++) { int iColumn = changed[i]; clpSolver->setContinuous(iColumn); } delete [] changed; } #endif if (type == CBC_PARAM_ACTION_BAB) { #ifndef CBC_OTHER_SOLVER //move best solution (should be there -- but ..) int n = lpSolver->getNumCols(); if (bestSolution) { memcpy(lpSolver->primalColumnSolution(), bestSolution, n*sizeof(double)); // now see what that does to row solution int numberRows = lpSolver->numberRows(); double * rowSolution = lpSolver->primalRowSolution(); memset (rowSolution, 0, numberRows*sizeof(double)); lpSolver->clpMatrix()->times(1.0, bestSolution, rowSolution); lpSolver->setObjectiveValue(babModel_->getObjValue()); } if (debugFile == "create" && bestSolution) { saveSolution(lpSolver, "debug.file"); } #else if (bestSolution) { model_.solver()->setColSolution(bestSolution); } #endif delete saveSolver; delete [] bestSolution; std::string statusName[] = {"", "Stopped on ", "Run abandoned", "", "", "User ctrl-c"}; std::string minor[] = {"Optimal solution found", "Linear relaxation infeasible", "Optimal solution found (within gap tolerance)", "node limit", "time limit", "user ctrl-c", "solution limit", "Linear relaxation unbounded", "Problem proven infeasible"}; int iStat = babModel_->status(); int iStat2 = babModel_->secondaryStatus(); if (!iStat && !iStat2 && !bestSolution) iStat2 = 8; if (!iStat && iStat2==1 && bestSolution) iStat2 = 0; // solution and search completed statistics_seconds = time2 - time1; statistics_sys_seconds = CoinSysTime(); statistics_elapsed_seconds = CoinWallclockTime(); statistics_obj = babModel_->getObjValue(); statistics_continuous = babModel_->getContinuousObjective(); statistics_tighter = babModel_->rootObjectiveAfterCuts(); statistics_nodes = babModel_->getNodeCount(); statistics_iterations = babModel_->getIterationCount();; statistics_result = statusName[iStat];; if (!noPrinting_) { sprintf(generalPrint, "\nResult - %s%s\n", statusName[iStat].c_str(), minor[iStat2].c_str()); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; if (babModel_->bestSolution()){ sprintf(generalPrint, "Objective value: %.8f\n", babModel_->getObjValue()); }else{ sprintf(generalPrint, "No feasible solution found\n"); } if (iStat2 >= 2 && iStat2 <=6){ sprintf(generalPrint + strlen(generalPrint), "Lower bound: %.3f\n", babModel_->getBestPossibleObjValue()); if (babModel_->bestSolution()){ sprintf(generalPrint + strlen(generalPrint), "Gap: %.2f\n", (babModel_->getObjValue()-babModel_->getBestPossibleObjValue())/ fabs(babModel_->getBestPossibleObjValue())); } } sprintf(generalPrint + strlen(generalPrint), "Enumerated nodes: %d\n", babModel_->getNodeCount()); sprintf(generalPrint + strlen(generalPrint), "Total iterations: %d\n", babModel_->getIterationCount()); #if CBC_QUIET == 0 sprintf(generalPrint + strlen(generalPrint), "Time (CPU seconds): %.2f\n", CoinCpuTime() - time1); sprintf(generalPrint + strlen(generalPrint), "Time (Wallclock seconds): %.2f\n", CoinGetTimeOfDay() - time1Elapsed); #endif generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } int returnCode = callBack(babModel_, 5); if (returnCode) { // exit if user wants model_.moveInfo(*babModel_); delete babModel_; babModel_ = NULL; return returnCode; } #ifdef COIN_HAS_ASL if (statusUserFunction_[0]) { clpSolver = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); lpSolver = clpSolver->getModelPtr(); double value = babModel_->getObjValue()*lpSolver->getObjSense(); char buf[300]; int pos=0; if (iStat==0) { if (babModel_->getObjValue()<1.0e40) { pos += sprintf(buf+pos,"optimal," ); } else { // infeasible iStat=1; pos += sprintf(buf+pos,"infeasible,"); } } else if (iStat==1) { if (iStat2!=6) iStat=3; else iStat=4; pos += sprintf(buf+pos,"stopped on %s,",minor[iStat2].c_str()); } else if (iStat==2) { iStat = 7; pos += sprintf(buf+pos,"stopped on difficulties,"); } else if (iStat==5) { iStat = 3; pos += sprintf(buf+pos,"stopped on ctrl-c,"); } else { pos += sprintf(buf+pos,"status unknown,"); iStat=6; } info.problemStatus=iStat; info.objValue = value; if (babModel_->getObjValue()<1.0e40) { int precision = ampl_obj_prec(); if (precision>0) pos += sprintf(buf+pos," objective %.*g",precision, value); else pos += sprintf(buf+pos," objective %g",value); } sprintf(buf+pos,"\n%d nodes, %d iterations, %g seconds", babModel_->getNodeCount(), babModel_->getIterationCount(), totalTime); if (bestSolution) { free(info.primalSolution); if (!numberKnapsack) { info.primalSolution = (double *) malloc(n*sizeof(double)); CoinCopyN(lpSolver->primalColumnSolution(),n,info.primalSolution); int numberRows = lpSolver->numberRows(); free(info.dualSolution); info.dualSolution = (double *) malloc(numberRows*sizeof(double)); CoinCopyN(lpSolver->dualRowSolution(),numberRows,info.dualSolution); } else { // expanded knapsack info.dualSolution=NULL; int numberColumns = saveCoinModel.numberColumns(); info.primalSolution = (double *) malloc(numberColumns*sizeof(double)); // Fills in original solution (coinModel length) afterKnapsack(saveTightenedModel, whichColumn, knapsackStart, knapsackRow, numberKnapsack, lpSolver->primalColumnSolution(), info.primalSolution,1); } } else { info.primalSolution=NULL; info.dualSolution=NULL; } // put buffer into info strcpy(info.buffer,buf); } #endif } else { sprintf(generalPrint, "Model strengthened - now has %d rows", clpSolver->getNumRows()); printGeneralMessage(model_,generalPrint); } time1 = time2; #ifdef COIN_HAS_ASL if (statusUserFunction_[0]) { // keep if going to be destroyed OsiSolverInterface * solver = babModel_->solver(); OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); ClpSimplex * lpSolver2 = clpSolver->getModelPtr(); if (lpSolver == lpSolver2) babModel_->setModelOwnsSolver(false); } #endif //delete babModel_; //babModel_=NULL; } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break ; case CLP_PARAM_ACTION_IMPORT: { #ifdef COIN_HAS_ASL if (!statusUserFunction_[0]) { #endif free(priorities); priorities = NULL; free(branchDirection); branchDirection = NULL; free(pseudoDown); pseudoDown = NULL; free(pseudoUp); pseudoUp = NULL; free(solutionIn); solutionIn = NULL; free(prioritiesIn); prioritiesIn = NULL; free(sosStart); sosStart = NULL; free(sosIndices); sosIndices = NULL; free(sosType); sosType = NULL; free(sosReference); sosReference = NULL; free(cut); cut = NULL; free(sosPriority); sosPriority = NULL; #ifdef COIN_HAS_ASL } #endif //delete babModel_; //babModel_=NULL; // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; // See if gmpl file int gmpl = 0; std::string gmplData; if (field == "-" || field == "stdin") { // stdin canOpen = true; fileName = "-"; } else if (field == "stdin_lp") { // stdin canOpen = true; fileName = "-"; gmpl = -1; //.lp format } else { // See if .lp { const char * c_name = field.c_str(); size_t length = strlen(c_name); if (length > 3 && !strncmp(c_name + length - 3, ".lp", 3)) gmpl = -1; // .lp } bool absolutePath; if (dirsep == '/') { // non Windows (or cygwin) absolutePath = (field[0] == '/'); } else { //Windows (non cycgwin) absolutePath = (field[0] == '\\'); // but allow for : if (strchr(field.c_str(), ':')) absolutePath = true; } if (absolutePath) { fileName = field; size_t length = field.size(); size_t percent = field.find('%'); if (percent < length && percent > 0) { gmpl = 1; fileName = field.substr(0, percent); gmplData = field.substr(percent + 1); if (percent < length - 1) gmpl = 2; // two files printf("GMPL model file %s and data file %s\n", fileName.c_str(), gmplData.c_str()); } } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; // See if gmpl (model & data) - or even lp file size_t length = field.size(); size_t percent = field.find('%'); if (percent0) { gmpl = 1; fileName = directory + field.substr(0, percent); gmplData = directory + field.substr(percent + 1); if (percent < length - 1) gmpl = 2; // two files printf("GMPL model file %s and data file %s\n", fileName.c_str(), gmplData.c_str()); } } std::string name = fileName; if (fileCoinReadable(name)) { // can open - lets go for it canOpen = true; if (gmpl == 2) { FILE *fp; fp = fopen(gmplData.c_str(), "r"); if (fp) { fclose(fp); } else { canOpen = false; sprintf(generalPrint, "Unable to open file %s",gmplData.c_str()); printGeneralMessage(model_,generalPrint); } } } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } } if (canOpen) { int status; #ifndef CBC_OTHER_SOLVER ClpSimplex * lpSolver = clpSolver->getModelPtr(); if (!gmpl) { status = clpSolver->readMps(fileName.c_str(), keepImportNames != 0, allowImportErrors != 0); } else if (gmpl > 0) { status = lpSolver->readGMPL(fileName.c_str(), (gmpl == 2) ? gmplData.c_str() : NULL, keepImportNames != 0); } else { #ifdef KILL_ZERO_READLP status = clpSolver->readLp(fileName.c_str(), lpSolver->getSmallElementValue()); #else status = clpSolver->readLp(fileName.c_str(), 1.0e-12); #endif } #else status = clpSolver->readMps(fileName.c_str(), ""); #endif if (!status || (status > 0 && allowImportErrors)) { #ifndef CBC_OTHER_SOLVER if (keepImportNames) { lengthName = lpSolver->lengthNames(); rowNames = *(lpSolver->rowNames()); columnNames = *(lpSolver->columnNames()); } else { lengthName = 0; } goodModel = true; // sets to all slack (not necessary?) lpSolver->createStatus(); // make sure integer int numberColumns = lpSolver->numberColumns(); for (int i = 0; i < numberColumns; i++) { if (lpSolver->isInteger(i)) clpSolver->setInteger(i); } #else lengthName = 0; goodModel = true; #endif time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; // Go to canned file if just input file if (CbcOrClpRead_mode == 2 && argc == 2) { // only if ends .mps char * find = const_cast(strstr(fileName.c_str(), ".mps")); if (find && find[4] == '\0') { find[1] = 'p'; find[2] = 'a'; find[3] = 'r'; FILE *fp = fopen(fileName.c_str(), "r"); if (fp) { CbcOrClpReadCommand = fp; // Read from that file CbcOrClpRead_mode = -1; } } } } else { // errors sprintf(generalPrint, "There were %d errors on input",status); printGeneralMessage(model_,generalPrint); } } } break; case CLP_PARAM_ACTION_MODELIN: #ifndef CBC_OTHER_SOLVER #ifdef COIN_HAS_LINK { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field == "-") { // stdin canOpen = true; fileName = "-"; } else { bool absolutePath; if (dirsep == '/') { // non Windows (or cygwin) absolutePath = (field[0] == '/'); } else { //Windows (non cycgwin) absolutePath = (field[0] == '\\'); // but allow for : if (strchr(field.c_str(), ':')) absolutePath = true; } if (absolutePath) { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "r"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } } if (canOpen) { CoinModel coinModel(fileName.c_str(), 2); // load from coin model OsiSolverLink solver1; OsiSolverInterface * solver2 = solver1.clone(); model_.assignSolver(solver2, false); OsiSolverLink * si = dynamic_cast(model_.solver()) ; assert (si != NULL); si->setDefaultMeshSize(0.001); // need some relative granularity si->setDefaultBound(100.0); double dextra3 = parameters_[whichParam(CBC_PARAM_DBL_DEXTRA3, numberParameters_, parameters_)].doubleValue(); if (dextra3) si->setDefaultMeshSize(dextra3); si->setDefaultBound(100.0); si->setIntegerPriority(1000); si->setBiLinearPriority(10000); CoinModel * model2 = &coinModel; si->load(*model2); // redo solver = model_.solver(); clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); lpSolver = clpSolver->getModelPtr(); clpSolver->messageHandler()->setLogLevel(0) ; testOsiParameters = 0; complicatedInteger = 2; } } #endif #endif break; case CLP_PARAM_ACTION_EXPORT: if (goodModel) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "w"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } if (canOpen) { // If presolve on then save presolved bool deleteModel2 = false; ClpSimplex * model2 = lpSolver; if (dualize && dualize < 3) { model2 = static_cast (model2)->dualOfModel(); sprintf(generalPrint, "Dual of model has %d rows and %d columns", model2->numberRows(), model2->numberColumns()); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; model2->setOptimizationDirection(1.0); } #ifndef CBC_OTHER_SOLVER #ifdef COIN_HAS_ASL if (info.numberSos && doSOS && statusUserFunction_[0]) { // SOS numberSOS = info.numberSos; sosStart = info.sosStart; sosIndices = info.sosIndices; sosReference = info.sosReference; clpSolver->setSOSData(numberSOS, info.sosType, sosStart, sosIndices, sosReference); } #endif numberSOS = clpSolver->numberSOS(); if (numberSOS) preSolve = false; #endif if (preSolve) { ClpPresolve pinfo; int presolveOptions2 = presolveOptions&~0x40000000; if ((presolveOptions2&0xffff) != 0) pinfo.setPresolveActions(presolveOptions2); if ((printOptions&1) != 0) pinfo.statistics(); double presolveTolerance = parameters_[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters_, parameters_)].doubleValue(); model2 = pinfo.presolvedModel(*lpSolver, presolveTolerance, true, preSolve); if (model2) { printf("Saving presolved model on %s\n", fileName.c_str()); deleteModel2 = true; } else { printf("Presolved model looks infeasible - saving original on %s\n", fileName.c_str()); deleteModel2 = false; model2 = lpSolver; } model2->writeMps(fileName.c_str(), (outputFormat - 1) / 2, 1 + ((outputFormat - 1)&1)); if (deleteModel2) delete model2; } else { printf("Saving model on %s\n", fileName.c_str()); if (numberSOS) { // Convert names int iRow; int numberRows = model2->numberRows(); int iColumn; int numberColumns = model2->numberColumns(); char ** rowNames = NULL; char ** columnNames = NULL; if (model2->lengthNames()) { rowNames = new char * [numberRows]; for (iRow = 0; iRow < numberRows; iRow++) { rowNames[iRow] = CoinStrdup(model2->rowName(iRow).c_str()); } columnNames = new char * [numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) { columnNames[iColumn] = CoinStrdup(model2->columnName(iColumn).c_str()); } } // see if extension lp bool writeLp=false; { int lengthName = strlen(fileName.c_str()); if (lengthName>3&&!strcmp(fileName.c_str()+lengthName-3,".lp")) writeLp=true; } if (!writeLp) { remove(fileName.c_str()); clpSolver->writeMpsNative(fileName.c_str(), const_cast (rowNames), const_cast (columnNames), (outputFormat - 1) / 2, 1 + ((outputFormat - 1)&1)); } else { FILE *fp = fopen(fileName.c_str(), "w"); assert (fp); clpSolver->writeLp(fp,1.0e-12); } if (rowNames) { for (iRow = 0; iRow < numberRows; iRow++) { free(rowNames[iRow]); } delete [] rowNames; for (iColumn = 0; iColumn < numberColumns; iColumn++) { free(columnNames[iColumn]); } delete [] columnNames; } } else { #ifdef COIN_HAS_LINK OsiSolverLink * linkSolver = dynamic_cast< OsiSolverLink*> (clpSolver); if (!linkSolver || !linkSolver->quadraticModel()) model2->writeMps(fileName.c_str(), (outputFormat - 1) / 2, 1 + ((outputFormat - 1)&1)); else linkSolver->quadraticModel()->writeMps(fileName.c_str(), (outputFormat - 1) / 2, 1 + ((outputFormat - 1)&1)); #endif } } time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_BASISIN: if (goodModel) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field == "-") { // stdin canOpen = true; fileName = "-"; } else { if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "r"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } } if (canOpen) { #ifndef CBC_OTHER_SOLVER int values = lpSolver->readBasis(fileName.c_str()); if (values == 0) basisHasValues = -1; else basisHasValues = 1; assert (lpSolver == clpSolver->getModelPtr()); clpSolver->setWarmStart(NULL); #endif } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CBC_PARAM_ACTION_PRIORITYIN: if (goodModel) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "r"); if (fp) { // can open - lets go for it std::string headings[] = {"name", "number", "direction", "priority", "up", "down", "solution", "priin" }; int got[] = { -1, -1, -1, -1, -1, -1, -1, -1}; int order[8]; bool useMasks = false; if (strstr(fileName.c_str(),"mask_")) { // look more closely const char * name = fileName.c_str(); int length = strlen(name); for (int i=length-1;i>=0;i--) { if (name[i]==dirsep) { name += i+1; break; } } useMasks = !strncmp(name,"mask_",5); } assert(sizeof(got) == sizeof(order)); int nAcross = 0; char line[1000]; int numberColumns = lpSolver->numberColumns(); if (!fgets(line, 1000, fp)) { std::cout << "Odd file " << fileName << std::endl; } else { char * pos = line; char * put = line; while (*pos >= ' ' && *pos != '\n') { if (*pos != ' ' && *pos != '\t') { *put = static_cast(tolower(*pos)); put++; } pos++; } *put = '\0'; pos = line; int i; bool good = true; while (pos) { char * comma = strchr(pos, ','); if (comma) *comma = '\0'; for (i = 0; i < static_cast (sizeof(got) / sizeof(int)); i++) { if (headings[i] == pos) { if (got[i] < 0) { order[nAcross] = i; got[i] = nAcross++; } else { // duplicate good = false; } break; } } if (i == static_cast (sizeof(got) / sizeof(int))) good = false; if (comma) { *comma = ','; pos = comma + 1; } else { break; } } if (got[0] < 0 && got[1] < 0) good = false; if (got[0] >= 0 && got[1] >= 0) good = false; if (got[0] >= 0 && !lpSolver->lengthNames()) good = false; int numberFields = 99; if (good && (strstr(fileName.c_str(), ".mst") || strstr(fileName.c_str(), ".MST") || strstr(fileName.c_str(), ".csv"))) { numberFields = 0; for (i = 2; i < static_cast (sizeof(got) / sizeof(int)); i++) { if (got[i] >= 0) numberFields++; } if (!numberFields) { // Like Cplex format order[nAcross] = 6; got[6] = nAcross++; } } if (good) { char ** columnNames = new char * [numberColumns]; //pseudoDown = NULL; //pseudoUp = NULL; //branchDirection = NULL; //if (got[5]!=-1) pseudoDown = reinterpret_cast (malloc(numberColumns * sizeof(double))); //if (got[4]!=-1) pseudoUp = reinterpret_cast (malloc(numberColumns * sizeof(double))); //if (got[2]!=-1) branchDirection = reinterpret_cast (malloc(numberColumns * sizeof(int))); priorities = reinterpret_cast (malloc(numberColumns * sizeof(int))); free(solutionIn); solutionIn = NULL; free(prioritiesIn); prioritiesIn = NULL; int iColumn; if (got[6] >= 0) { solutionIn = reinterpret_cast (malloc(numberColumns * sizeof(double))); for (iColumn = 0; iColumn < numberColumns; iColumn++) solutionIn[iColumn] = -COIN_DBL_MAX; } if (got[7] >= 0 || !numberFields) { prioritiesIn = reinterpret_cast (malloc(numberColumns * sizeof(int))); for (iColumn = 0; iColumn < numberColumns; iColumn++) prioritiesIn[iColumn] = 10000; } for (iColumn = 0; iColumn < numberColumns; iColumn++) { columnNames[iColumn] = CoinStrdup(lpSolver->columnName(iColumn).c_str()); //if (got[5]!=-1) pseudoDown[iColumn] = 0.0; //if (got[4]!=-1) pseudoUp[iColumn] = 0.0; //if (got[2]!=-1) branchDirection[iColumn] = 0; priorities[iColumn] = useMasks ? -123456789 : 0; } int nBadPseudo = 0; int nBadDir = 0; int nBadPri = 0; int nBadName = 0; int nBadLine = 0; int nLine = 0; iColumn = -1; int lowestPriority=-COIN_INT_MAX; bool needCard = true; while (!needCard || fgets(line, 1000, fp)) { if (!strncmp(line, "ENDATA", 6)|| !strncmp(line, "endata", 6)) break; nLine++; if (!useMasks) iColumn = -1; else needCard=false; double up = 0.0; double down = 0.0; int pri = 0; int dir = 0; double solValue = COIN_DBL_MAX; int priValue = 1000000; char * pos = line; char * put = line; if (!numberFields) { // put in , for (i = 4; i < 100; i++) { if (line[i] == ' ' || line[i] == '\t') { line[i] = ','; break; } } } while (*pos >= ' ' && *pos != '\n') { if (*pos != ' ' && *pos != '\t') { *put = *pos; put++; } pos++; } *put = '\0'; pos = line; for (int i = 0; i < nAcross; i++) { char * comma = strchr(pos, ','); if (comma) { *comma = '\0'; } else if (i < nAcross - 1) { nBadLine++; break; } switch (order[i]) { // name case 0: iColumn++; for (; iColumn < numberColumns; iColumn++) { if (priorities[iColumn]!=-123456789) { if (!strcmp(columnNames[iColumn], pos)) break; } else { // mask (at present ? and trailing *) const char * name = columnNames[iColumn]; int length=strlen(name); int lengthMask=strlen(pos); bool asterisk = pos[lengthMask-1]=='*'; if (asterisk) length=lengthMask-1; int i; for (i=0;i= numberColumns) iColumn = -1; break; // direction case 2: if (*pos == 'D') dir = -1; else if (*pos == 'U') dir = 1; else if (*pos == 'N') dir = 0; else if (*pos == '1' && *(pos + 1) == '\0') dir = 1; else if (*pos == '0' && *(pos + 1) == '\0') dir = 0; else if (*pos == '1' && *(pos + 1) == '1' && *(pos + 2) == '\0') dir = -1; else dir = -2; // bad break; // priority case 3: pri = atoi(pos); lowestPriority=CoinMax(lowestPriority,pri); break; // up case 4: up = atof(pos); break; // down case 5: down = atof(pos); break; // sol value case 6: solValue = atof(pos); break; // priority in value case 7: priValue = atoi(pos); break; } if (comma) { *comma = ','; pos = comma + 1; } } if (iColumn >= 0) { if (down < 0.0) { nBadPseudo++; down = 0.0; } if (up < 0.0) { nBadPseudo++; up = 0.0; } if (!up) up = down; if (!down) down = up; if (dir < -1 || dir > 1) { nBadDir++; dir = 0; } if (pri < 0) { nBadPri++; pri = 0; } //if (got[5]!=-1) pseudoDown[iColumn] = down; //if (got[4]!=-1) pseudoUp[iColumn] = up; //if (got[2]!=-1) branchDirection[iColumn] = dir; priorities[iColumn] = pri; if (solValue != COIN_DBL_MAX) { assert (solutionIn); solutionIn[iColumn] = solValue; } if (priValue != 1000000) { assert (prioritiesIn); prioritiesIn[iColumn] = priValue; } } else if (!useMasks) { nBadName++; } } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (priorities[iColumn] == -123456789) priorities[iColumn] = lowestPriority+1; } if (!noPrinting_) { printf("%d fields and %d records", nAcross, nLine); if (nBadPseudo) printf(" %d bad pseudo costs", nBadPseudo); if (nBadDir) printf(" %d bad directions", nBadDir); if (nBadPri) printf(" %d bad priorities", nBadPri); if (nBadName) printf(" ** %d records did not match on name/sequence", nBadName); printf("\n"); } for (iColumn = 0; iColumn < numberColumns; iColumn++) { free(columnNames[iColumn]); } delete [] columnNames; } else { std::cout << "Duplicate or unknown keyword - or name/number fields wrong" << line << std::endl; } } fclose(fp); } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CBC_PARAM_ACTION_MIPSTART: if (goodModel) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } sprintf(generalPrint,"opening mipstart file %s.",fileName.c_str() ); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; double msObj; readMIPStart( &model_, fileName.c_str(), mipStart, msObj ); // copy to before preprocess if has .before. if (strstr(fileName.c_str(),".before.")) { mipStartBefore = mipStart; sprintf(generalPrint,"file %s will be used before preprocessing.",fileName.c_str() ); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_DEBUG: if (goodModel) { delete [] debugValues; debugValues = NULL; // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); debugFile = field; if (debugFile == "create" || debugFile == "createAfterPre") { printf("Will create a debug file so this run should be a good one\n"); break; } } std::string fileName; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "rb"); if (fp) { // can open - lets go for it int numRows; double obj; size_t nRead; nRead = fread(&numRows, sizeof(int), 1, fp); if (nRead != 1) throw("Error in fread"); nRead = fread(&numberDebugValues, sizeof(int), 1, fp); if (nRead != 1) throw("Error in fread"); nRead = fread(&obj, sizeof(double), 1, fp); if (nRead != 1) throw("Error in fread"); debugValues = new double[numberDebugValues+numRows]; nRead = fread(debugValues, sizeof(double), numRows, fp); if (nRead != static_cast(numRows)) throw("Error in fread"); nRead = fread(debugValues, sizeof(double), numRows, fp); if (nRead != static_cast(numRows)) throw("Error in fread"); nRead = fread(debugValues, sizeof(double), numberDebugValues, fp); if (nRead != static_cast(numberDebugValues)) throw("Error in fread"); printf("%d doubles read into debugValues\n", numberDebugValues); #ifdef CGL_WRITEMPS debugSolution = debugValues; debugNumberColumns = numberDebugValues; #endif if (numberDebugValues < 200) { for (int i = 0; i < numberDebugValues; i++) { if (clpSolver->isInteger(i) && debugValues[i]) printf("%d %g\n", i, debugValues[i]); } } fclose(fp); } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_PRINTMASK: // get next field { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { parameters_[iParam].setStringValue(name); printMask = name; } else { parameters_[iParam].printString(); } } break; case CLP_PARAM_ACTION_BASISOUT: if (goodModel) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "w"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } if (canOpen) { ClpSimplex * model2 = lpSolver; model2->writeBasis(fileName.c_str(), outputFormat > 1, outputFormat - 2); time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_SAVE: { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "wb"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } if (canOpen) { int status; // If presolve on then save presolved bool deleteModel2 = false; ClpSimplex * model2 = lpSolver; if (preSolve) { ClpPresolve pinfo; double presolveTolerance = parameters_[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters_, parameters_)].doubleValue(); model2 = pinfo.presolvedModel(*lpSolver, presolveTolerance, false, preSolve); if (model2) { printf("Saving presolved model on %s\n", fileName.c_str()); deleteModel2 = true; } else { printf("Presolved model looks infeasible - saving original on %s\n", fileName.c_str()); deleteModel2 = false; model2 = lpSolver; } } else { printf("Saving model on %s\n", fileName.c_str()); } status = model2->saveModel(fileName.c_str()); if (deleteModel2) delete model2; if (!status) { goodModel = true; time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } else { // errors sprintf(generalPrint, "There were errors on output"); printGeneralMessage(model_,generalPrint); } } } break; case CLP_PARAM_ACTION_RESTORE: { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "rb"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } if (canOpen) { int status = lpSolver->restoreModel(fileName.c_str()); if (!status) { goodModel = true; time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } else { // errors sprintf(generalPrint, "There were errors on input"); printGeneralMessage(model_,generalPrint); } } } break; case CLP_PARAM_ACTION_MAXIMIZE: lpSolver->setOptimizationDirection(-1); break; case CLP_PARAM_ACTION_MINIMIZE: lpSolver->setOptimizationDirection(1); break; case CLP_PARAM_ACTION_ALLSLACK: lpSolver->allSlackBasis(true); break; case CLP_PARAM_ACTION_REVERSE: if (goodModel) { int iColumn; int numberColumns = lpSolver->numberColumns(); double * dualColumnSolution = lpSolver->dualColumnSolution(); ClpObjective * obj = lpSolver->objectiveAsObject(); assert(dynamic_cast (obj)); double offset; double * objective = obj->gradient(NULL, NULL, offset, true); for (iColumn = 0; iColumn < numberColumns; iColumn++) { dualColumnSolution[iColumn] = dualColumnSolution[iColumn]; objective[iColumn] = -objective[iColumn]; } int iRow; int numberRows = lpSolver->numberRows(); double * dualRowSolution = lpSolver->dualRowSolution(); for (iRow = 0; iRow < numberRows; iRow++) dualRowSolution[iRow] = dualRowSolution[iRow]; } break; case CLP_PARAM_ACTION_DIRECTORY: { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { size_t length = name.length(); if (length > 0 && name[length-1] == dirsep) { directory = name; } else { directory = name + dirsep; } parameters_[iParam].setStringValue(directory); } else { parameters_[iParam].printString(); } } break; case CLP_PARAM_ACTION_DIRSAMPLE: { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { size_t length = name.length(); if (length > 0 && name[length-1] == dirsep) { dirSample = name; } else { dirSample = name + dirsep; } parameters_[iParam].setStringValue(dirSample); } else { parameters_[iParam].printString(); } } break; case CLP_PARAM_ACTION_DIRNETLIB: { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { size_t length = name.length(); if (length > 0 && name[length-1] == dirsep) { dirNetlib = name; } else { dirNetlib = name + dirsep; } parameters_[iParam].setStringValue(dirNetlib); } else { parameters_[iParam].printString(); } } break; case CBC_PARAM_ACTION_DIRMIPLIB: { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { size_t length = name.length(); if (length > 0 && name[length-1] == dirsep) { dirMiplib = name; } else { dirMiplib = name + dirsep; } parameters_[iParam].setStringValue(dirMiplib); } else { parameters_[iParam].printString(); } } break; case CLP_PARAM_ACTION_STDIN: CbcOrClpRead_mode = -1; break; case CLP_PARAM_ACTION_NETLIB_DUAL: case CLP_PARAM_ACTION_NETLIB_EITHER: case CLP_PARAM_ACTION_NETLIB_BARRIER: case CLP_PARAM_ACTION_NETLIB_PRIMAL: case CLP_PARAM_ACTION_NETLIB_TUNE: { printf("unit test is now only from clp - does same thing\n"); //return(22); } break; case CLP_PARAM_ACTION_UNITTEST: { CbcClpUnitTest(model_, dirSample, -2, NULL); } break; case CLP_PARAM_ACTION_FAKEBOUND: if (goodModel) { // get bound double value = CoinReadGetDoubleField(argc, argv, &valid); if (!valid) { sprintf(generalPrint, "Setting %s to DEBUG %g",parameters_[iParam].name().c_str(),value); printGeneralMessage(model_,generalPrint); int iRow; int numberRows = lpSolver->numberRows(); double * rowLower = lpSolver->rowLower(); double * rowUpper = lpSolver->rowUpper(); for (iRow = 0; iRow < numberRows; iRow++) { // leave free ones for now if (rowLower[iRow] > -1.0e20 || rowUpper[iRow] < 1.0e20) { rowLower[iRow] = CoinMax(rowLower[iRow], -value); rowUpper[iRow] = CoinMin(rowUpper[iRow], value); } } int iColumn; int numberColumns = lpSolver->numberColumns(); double * columnLower = lpSolver->columnLower(); double * columnUpper = lpSolver->columnUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { // leave free ones for now if (columnLower[iColumn] > -1.0e20 || columnUpper[iColumn] < 1.0e20) { columnLower[iColumn] = CoinMax(columnLower[iColumn], -value); columnUpper[iColumn] = CoinMin(columnUpper[iColumn], value); } } } else if (valid == 1) { abort(); } else { std::cout << "enter value for " << parameters_[iParam].name() << std::endl; } } break; case CLP_PARAM_ACTION_REALLY_SCALE: if (goodModel) { ClpSimplex newModel(*lpSolver, lpSolver->scalingFlag()); printf("model really really scaled\n"); *lpSolver = newModel; } break; case CLP_PARAM_ACTION_USERCLP: #ifdef USER_HAS_FAKE_CLP // Replace the sample code by whatever you want if (goodModel) { // Way of using an existing piece of code OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model_.solver()); ClpSimplex * lpSolver = clpSolver->getModelPtr(); // set time from integer model double timeToGo = model_.getMaximumSeconds(); lpSolver->setMaximumSeconds(timeToGo); int extra1 = parameters_[whichParam(CBC_PARAM_INT_EXTRA1, numberParameters_, parameters_)].intValue(); fakeMain2(*lpSolver, *clpSolver, extra1); lpSolver = clpSolver->getModelPtr(); #ifdef COIN_HAS_ASL // My actual usage has objective only in clpSolver //double objectiveValue=clpSolver->getObjValue(); //int iStat = lpSolver->status(); //int iStat2 = lpSolver->secondaryStatus(); #endif } #endif break; case CBC_PARAM_ACTION_USERCBC: #ifdef USER_HAS_FAKE_CBC // Replace the sample code by whatever you want if (goodModel) { // Way of using an existing piece of code OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model_.solver()); ClpSimplex * lpSolver = clpSolver->getModelPtr(); // set time from integer model double timeToGo = model_.getMaximumSeconds(); lpSolver->setMaximumSeconds(timeToGo); fakeMain(*lpSolver, *clpSolver, model); #ifdef COIN_HAS_ASL // My actual usage has objective only in clpSolver double objectiveValue = clpSolver->getObjValue(); int iStat = lpSolver->status(); int iStat2 = lpSolver->secondaryStatus(); #endif // make sure solution back in correct place clpSolver = dynamic_cast< OsiClpSolverInterface*> (model_.solver()); lpSolver = clpSolver->getModelPtr(); #ifdef COIN_HAS_ASL if (statusUserFunction_[0]) { int n = clpSolver->getNumCols(); double value = objectiveValue * lpSolver->getObjSense(); char buf[300]; int pos = 0; std::string minor[] = {"", "", "gap", "nodes", "time", "", "solutions", "user ctrl-c"}; if (iStat == 0) { if (objectiveValue < 1.0e40) { pos += sprintf(buf + pos, "optimal," ); } else { // infeasible iStat = 1; pos += sprintf(buf + pos, "infeasible,"); } } else if (iStat == 1) { if (iStat2 != 6) iStat = 3; else iStat = 4; pos += sprintf(buf + pos, "stopped on %s,", minor[iStat2].c_str()); } else if (iStat == 2) { iStat = 7; pos += sprintf(buf + pos, "stopped on difficulties,"); } else if (iStat == 5) { iStat = 3; pos += sprintf(buf + pos, "stopped on ctrl-c,"); } else if (iStat == 6) { // bab infeasible pos += sprintf(buf + pos, "integer infeasible,"); iStat = 1; } else { pos += sprintf(buf + pos, "status unknown,"); iStat = 6; } info.problemStatus = iStat; info.objValue = value; if (objectiveValue < 1.0e40) pos += sprintf(buf + pos, " objective %.*g", ampl_obj_prec(), value); sprintf(buf + pos, "\n%d nodes, %d iterations", model_.getNodeCount(), model_.getIterationCount()); if (objectiveValue < 1.0e50) { free(info.primalSolution); info.primalSolution = (double *) malloc(n * sizeof(double)); CoinCopyN(lpSolver->primalColumnSolution(), n, info.primalSolution); int numberRows = lpSolver->numberRows(); free(info.dualSolution); info.dualSolution = (double *) malloc(numberRows * sizeof(double)); CoinCopyN(lpSolver->dualRowSolution(), numberRows, info.dualSolution); } else { info.primalSolution = NULL; info.dualSolution = NULL; } // put buffer into info strcpy(info.buffer, buf); } #endif } #endif break; case CLP_PARAM_ACTION_HELP: std::cout << "Cbc version " << CBC_VERSION << ", build " << __DATE__ << std::endl; std::cout << "Non default values:-" << std::endl; std::cout << "Perturbation " << lpSolver->perturbation() << " (default 100)" << std::endl; CoinReadPrintit( "Presolve being done with 5 passes\n\ Dual steepest edge steep/partial on matrix shape and factorization density\n\ Clpnnnn taken out of messages\n\ If Factorization frequency default then done on size of matrix\n\n\ (-)unitTest, (-)netlib or (-)netlibp will do standard tests\n\n\ You can switch to interactive mode at any time so\n\ clp watson.mps -scaling off -primalsimplex\nis the same as\n\ clp watson.mps -\nscaling off\nprimalsimplex" ); break; case CLP_PARAM_ACTION_CSVSTATISTICS: { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } int state = 0; char buffer[1000]; FILE *fp = fopen(fileName.c_str(), "r"); if (fp) { // file already there state = 1; char * getBuffer = fgets(buffer, 1000, fp); if (getBuffer) { // assume header there state = 2; } fclose(fp); } fp = fopen(fileName.c_str(), "a"); if (fp) { // can open - lets go for it // first header if needed if (state != 2) { fprintf(fp, "Name,result,time,sys,elapsed,objective,continuous,tightened,cut_time,nodes,iterations,rows,columns,processed_rows,processed_columns"); for (int i = 0; i < statistics_number_generators; i++) fprintf(fp, ",%s", statistics_name_generators[i]); fprintf(fp, ",runtime_options"); fprintf(fp, "\n"); } strcpy(buffer, argv[1]); char * slash = buffer; for (int i = 0; i < static_cast(strlen(buffer)); i++) { if (buffer[i] == '/' || buffer[i] == '\\') slash = buffer + i + 1; } fprintf(fp, "%s,%s,%.2f,%.2f,%.2f,%.16g,%g,%g,%.2f,%d,%d,%d,%d,%d,%d", slash, statistics_result.c_str(), statistics_seconds, statistics_sys_seconds, statistics_elapsed_seconds, statistics_obj, statistics_continuous, statistics_tighter, statistics_cut_time, statistics_nodes, statistics_iterations, statistics_nrows, statistics_ncols, statistics_nprocessedrows, statistics_nprocessedcols); for (int i = 0; i < statistics_number_generators; i++) fprintf(fp, ",%d", statistics_number_cuts[i]); fprintf(fp, ","); for (int i = 1; i < argc; i++) { if (strstr(argv[i], ".gz") || strstr(argv[i], ".mps")) continue; if (!argv[i] || !strncmp(argv[i], "-csv", 4)) break; fprintf(fp, "%s ", argv[i]); } fprintf(fp, "\n"); fclose(fp); } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } } break; case CLP_PARAM_ACTION_SOLUTION: case CLP_PARAM_ACTION_NEXTBESTSOLUTION: case CLP_PARAM_ACTION_GMPL_SOLUTION: if (goodModel) { ClpSimplex * saveLpSolver = NULL; // get next field field = CoinReadGetString(argc, argv); bool append = false; if (field == "append$") { field = "$"; append = true; } if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; FILE *fp = NULL; if (field == "-" || field == "EOL" || field == "stdout") { // stdout fp = stdout; } else if (field == "stderr") { // stderr fp = stderr; } else { bool absolutePath; if (dirsep == '/') { // non Windows (or cygwin) absolutePath = (field[0] == '/'); } else { //Windows (non cycgwin) absolutePath = (field[0] == '\\'); // but allow for : if (strchr(field.c_str(), ':')) absolutePath = true; } if (absolutePath) { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } if (!append) fp = fopen(fileName.c_str(), "w"); else fp = fopen(fileName.c_str(), "a"); } if (fp) { #ifndef CBC_OTHER_SOLVER // See if Glpk if (type == CLP_PARAM_ACTION_GMPL_SOLUTION) { int numberRows = lpSolver->getNumRows(); int numberColumns = lpSolver->getNumCols(); int numberGlpkRows=numberRows+1; #ifdef COIN_HAS_GLPK if (cbc_glp_prob) { // from gmpl numberGlpkRows=glp_get_num_rows(cbc_glp_prob); if (numberGlpkRows!=numberRows) printf("Mismatch - cbc %d rows, glpk %d\n", numberRows,numberGlpkRows); } #endif fprintf(fp,"%d %d\n",numberGlpkRows, numberColumns); int iStat = lpSolver->status(); int iStat2 = GLP_UNDEF; bool integerProblem = false; if (integerStatus >= 0){ iStat = integerStatus; integerProblem = true; } if (iStat == 0) { // optimal if (integerProblem) iStat2 = GLP_OPT; else iStat2 = GLP_FEAS; } else if (iStat == 1) { // infeasible iStat2 = GLP_NOFEAS; } else if (iStat == 2) { // unbounded // leave as 1 } else if (iStat >= 3 && iStat <= 5) { if (babModel_ && !babModel_->bestSolution()) iStat2 = GLP_NOFEAS; else iStat2 = GLP_FEAS; } else if (iStat == 6) { // bab infeasible iStat2 = GLP_NOFEAS; } lpSolver->computeObjectiveValue(false); double objValue = clpSolver->getObjValue(); if (integerProblem) fprintf(fp,"%d %g\n",iStat2,objValue); else fprintf(fp,"%d 2 %g\n",iStat2,objValue); if (numberGlpkRows > numberRows) { // objective as row if (integerProblem) { fprintf(fp,"%g\n",objValue); } else { fprintf(fp,"4 %g 1.0\n",objValue); } } int lookup[6]= {4,1,3,2,4,5}; const double * primalRowSolution = lpSolver->primalRowSolution(); const double * dualRowSolution = lpSolver->dualRowSolution(); for (int i=0;igetRowStatus(i)], primalRowSolution[i],dualRowSolution[i]); } } const double * primalColumnSolution = lpSolver->primalColumnSolution(); const double * dualColumnSolution = lpSolver->dualColumnSolution(); for (int i=0;igetColumnStatus(i)], primalColumnSolution[i],dualColumnSolution[i]); } } fclose(fp); #ifdef COIN_HAS_GLPK if (cbc_glp_prob) { if (integerProblem) { glp_read_mip(cbc_glp_prob,fileName.c_str()); glp_mpl_postsolve(cbc_glp_tran, cbc_glp_prob, GLP_MIP); } else { glp_read_sol(cbc_glp_prob,fileName.c_str()); glp_mpl_postsolve(cbc_glp_tran, cbc_glp_prob, GLP_SOL); } // free up as much as possible glp_free(cbc_glp_prob); glp_mpl_free_wksp(cbc_glp_tran); cbc_glp_prob = NULL; cbc_glp_tran = NULL; //gmp_free_mem(); /* check that no memory blocks are still allocated */ glp_free_env(); } #endif break; } if (printMode < 5) { if (type == CLP_PARAM_ACTION_NEXTBESTSOLUTION) { // save const double * nextBestSolution = model_.savedSolution(1); if (!nextBestSolution) { sprintf(generalPrint, "All alternative solutions printed"); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; break; } else { sprintf(generalPrint, "Alternative solution - %d remaining",model_.numberSavedSolutions()-2); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } saveLpSolver = lpSolver; assert (clpSolver->getModelPtr()==saveLpSolver); lpSolver = new ClpSimplex(*saveLpSolver); #ifndef NDEBUG ClpSimplex * oldSimplex = clpSolver->swapModelPtr(lpSolver); assert (oldSimplex==saveLpSolver); #else clpSolver->swapModelPtr(lpSolver); #endif double * solution = lpSolver->primalColumnSolution(); double * lower = lpSolver->columnLower(); double * upper = lpSolver->columnUpper(); int numberColumns=lpSolver->numberColumns(); memcpy(solution,nextBestSolution,numberColumns*sizeof(double)); model_.deleteSavedSolution(1); for (int i = 0; i < numberColumns; i++) { if (clpSolver->isInteger(i)) { double value=floor(solution[i]+0.5); lower[i]=value; upper[i]=value; } } lpSolver->allSlackBasis(); lpSolver->initialSolve(); } // Write solution header (suggested by Luigi Poderico) // Refresh solver lpSolver = clpSolver->getModelPtr(); lpSolver->computeObjectiveValue(false); double objValue = lpSolver->getObjValue(); int iStat = lpSolver->status(); int iStat2 = -1; if (integerStatus >= 0){ iStat = integerStatus; iStat2 = babModel_->secondaryStatus(); } if (iStat == 0) { fprintf(fp, "Optimal" ); if (iStat2 == 2){ fprintf(fp, " (within gap tolerance)" ); } } else if (iStat == 1) { // infeasible fprintf(fp, "Infeasible" ); } else if (iStat == 2) { // unbounded fprintf(fp, "Unbounded" ); } else if (iStat >= 3 && iStat <= 5) { if (iStat == 3) { if (iStat2 == 4){ fprintf(fp, "Stopped on time" ); }else{ fprintf(fp, "Stopped on iterations" ); } } else if (iStat == 4){ fprintf(fp, "Stopped on difficulties" ); } else { fprintf(fp, "Stopped on ctrl-c" ); } if (babModel_ && !babModel_->bestSolution()) fprintf(fp, " (no integer solution - continuous used)"); } else if (iStat == 6) { // bab infeasible fprintf(fp, "Integer infeasible" ); } else { fprintf(fp, "Status unknown" ); } fprintf(fp, " - objective value %.8f\n", objValue); } #endif // make fancy later on int iRow; int numberRows = clpSolver->getNumRows(); const double * dualRowSolution = clpSolver->getRowPrice(); const double * primalRowSolution = clpSolver->getRowActivity(); const double * rowLower = clpSolver->getRowLower(); const double * rowUpper = clpSolver->getRowUpper(); double primalTolerance ; clpSolver->getDblParam(OsiPrimalTolerance, primalTolerance); size_t lengthPrint = static_cast(CoinMax(lengthName, 8)); bool doMask = (printMask != "" && lengthName); int * maskStarts = NULL; int maxMasks = 0; char ** masks = NULL; if (doMask) { int nAst = 0; const char * pMask2 = printMask.c_str(); char pMask[100]; size_t iChar; size_t lengthMask = strlen(pMask2); assert (lengthMask < 100); if (*pMask2 == '"') { if (pMask2[lengthMask-1] != '"') { printf("mismatched \" in mask %s\n", pMask2); break; } else { strcpy(pMask, pMask2 + 1); *strchr(pMask, '"') = '\0'; } } else if (*pMask2 == '\'') { if (pMask2[lengthMask-1] != '\'') { printf("mismatched ' in mask %s\n", pMask2); break; } else { strcpy(pMask, pMask2 + 1); *strchr(pMask, '\'') = '\0'; } } else { strcpy(pMask, pMask2); } if (lengthMask > static_cast(lengthName)) { printf("mask %s too long - skipping\n", pMask); break; } maxMasks = 1; for (iChar = 0; iChar < lengthMask; iChar++) { if (pMask[iChar] == '*') { nAst++; maxMasks *= (lengthName + 1); } } int nEntries = 1; maskStarts = new int[lengthName+2]; masks = new char * [maxMasks]; char ** newMasks = new char * [maxMasks]; int i; for (i = 0; i < maxMasks; i++) { masks[i] = new char[lengthName+1]; newMasks[i] = new char[lengthName+1]; } strcpy(masks[0], pMask); for (int iAst = 0; iAst < nAst; iAst++) { int nOldEntries = nEntries; nEntries = 0; for (int iEntry = 0; iEntry < nOldEntries; iEntry++) { char * oldMask = masks[iEntry]; char * ast = strchr(oldMask, '*'); assert (ast); size_t length = strlen(oldMask) - 1; size_t nBefore = ast - oldMask; size_t nAfter = length - nBefore; // and add null nAfter++; for (int i = 0; i <= lengthName - static_cast(length); i++) { char * maskOut = newMasks[nEntries]; memcpy(maskOut, oldMask, nBefore); for (int k = 0; k < i; k++) maskOut[k+nBefore] = '?'; memcpy(maskOut + nBefore + i, ast + 1, nAfter); nEntries++; assert (nEntries <= maxMasks); } } char ** temp = masks; masks = newMasks; newMasks = temp; } // Now extend and sort int * sort = new int[nEntries]; for (i = 0; i < nEntries; i++) { char * maskThis = masks[i]; size_t length = strlen(maskThis); while (length > 0 && maskThis[length-1] == ' ') length--; maskThis[length] = '\0'; sort[i] = static_cast(length); } CoinSort_2(sort, sort + nEntries, masks); int lastLength = -1; for (i = 0; i < nEntries; i++) { int length = sort[i]; while (length > lastLength) maskStarts[++lastLength] = i; } maskStarts[++lastLength] = nEntries; delete [] sort; for (i = 0; i < maxMasks; i++) delete [] newMasks[i]; delete [] newMasks; } if (printMode > 5) { ClpSimplex * solver = clpSolver->getModelPtr(); int numberColumns = solver->numberColumns(); // column length unless rhs ranging int number = numberColumns; switch (printMode) { // bound ranging case 6: fprintf(fp,"Bound ranging"); break; // rhs ranging case 7: fprintf(fp,"Rhs ranging"); number = numberRows; break; // objective ranging case 8: fprintf(fp,"Objective ranging"); break; } if (lengthName) fprintf(fp,",name"); fprintf(fp,",increase,variable,decrease,variable\n"); int * which = new int [ number]; if (printMode != 7) { if (!doMask) { for (int i = 0; i < number;i ++) which[i]=i; } else { int n = 0; for (int i = 0; i < number;i ++) { if (maskMatches(maskStarts,masks,columnNames[i])) which[n++]=i; } if (n) { number=n; } else { printf("No names match - doing all\n"); for (int i = 0; i < number;i ++) which[i]=i; } } } else { if (!doMask) { for (int i = 0; i < number;i ++) which[i]=i+numberColumns; } else { int n = 0; for (int i = 0; i < number;i ++) { if (maskMatches(maskStarts,masks,rowNames[i])) which[n++]=i+numberColumns; } if (n) { number=n; } else { printf("No names match - doing all\n"); for (int i = 0; i < number;i ++) which[i]=i+numberColumns; } } } double * valueIncrease = new double [ number]; int * sequenceIncrease = new int [ number]; double * valueDecrease = new double [ number]; int * sequenceDecrease = new int [ number]; switch (printMode) { // bound or rhs ranging case 6: case 7: solver->primalRanging(numberRows, which, valueIncrease, sequenceIncrease, valueDecrease, sequenceDecrease); break; // objective ranging case 8: solver->dualRanging(number, which, valueIncrease, sequenceIncrease, valueDecrease, sequenceDecrease); break; } for (int i = 0; i < number; i++) { int iWhich = which[i]; fprintf(fp, "%d,", (iWhich 2 && printMode < 5) { for (iRow = 0; iRow < numberRows; iRow++) { int type = printMode - 3; if (primalRowSolution[iRow] > rowUpper[iRow] + primalTolerance || primalRowSolution[iRow] < rowLower[iRow] - primalTolerance) { fprintf(fp, "** "); type = 2; } else if (fabs(primalRowSolution[iRow]) > 1.0e-8) { type = 1; } else if (numberRows < 50) { type = 3; } if (doMask && !maskMatches(maskStarts, masks, rowNames[iRow])) type = 0; if (type) { fprintf(fp, "%7d ", iRow); if (lengthName) { const char * name = rowNames[iRow].c_str(); size_t n = strlen(name); size_t i; for (i = 0; i < n; i++) fprintf(fp, "%c", name[i]); for (; i < lengthPrint; i++) fprintf(fp, " "); } fprintf(fp, printFormat, primalRowSolution[iRow], dualRowSolution[iRow]); } } } int iColumn; int numberColumns = clpSolver->getNumCols(); const double * dualColumnSolution = clpSolver->getReducedCost(); const double * primalColumnSolution = clpSolver->getColSolution(); const double * columnLower = clpSolver->getColLower(); const double * columnUpper = clpSolver->getColUpper(); if (printMode != 2) { if (printMode == 5) { if (lengthName) fprintf(fp, "name"); else fprintf(fp, "number"); fprintf(fp, ",solution\n"); } for (iColumn = 0; iColumn < numberColumns; iColumn++) { int type = (printMode > 3) ? 1 : 0; if (primalColumnSolution[iColumn] > columnUpper[iColumn] + primalTolerance || primalColumnSolution[iColumn] < columnLower[iColumn] - primalTolerance) { fprintf(fp, "** "); type = 2; } else if (fabs(primalColumnSolution[iColumn]) > 1.0e-8) { type = 1; } else if (numberColumns < 50) { type = 3; } // see if integer if ((!clpSolver->isInteger(iColumn) || fabs(primalColumnSolution[iColumn]) < 1.0e-8) && printMode == 1) type = 0; if (doMask && !maskMatches(maskStarts, masks, columnNames[iColumn])) type = 0; if (type) { if (printMode != 5) { fprintf(fp, "%7d ", iColumn); if (lengthName) { const char * name = columnNames[iColumn].c_str(); size_t n = strlen(name); size_t i; for (i = 0; i < n; i++) fprintf(fp, "%c", name[i]); for (; i < lengthPrint; i++) fprintf(fp, " "); } fprintf(fp, printFormat, primalColumnSolution[iColumn], dualColumnSolution[iColumn]); } else { char temp[100]; if (lengthName) { const char * name = columnNames[iColumn].c_str(); for (int i = 0; i < lengthName; i++) temp[i] = name[i]; temp[lengthName] = '\0'; } else { sprintf(temp, "%7d", iColumn); } sprintf(temp + strlen(temp), ", %15.8g", primalColumnSolution[iColumn]); size_t n = strlen(temp); size_t k = 0; for (size_t i = 0; i < n + 1; i++) { if (temp[i] != ' ') temp[k++] = temp[i]; } fprintf(fp, "%s\n", temp); } } } if (type == CLP_PARAM_ACTION_NEXTBESTSOLUTION) { if(saveLpSolver) { clpSolver->swapModelPtr(saveLpSolver); delete lpSolver; lpSolver=saveLpSolver; saveLpSolver=NULL; } } } else { // special format suitable for OsiRowCutDebugger int n = 0; bool comma = false; bool newLine = false; fprintf(fp, "\tint intIndicesV[]={\n"); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (primalColumnSolution[iColumn] > 0.5 && model_.solver()->isInteger(iColumn)) { if (comma) fprintf(fp, ","); if (newLine) fprintf(fp, "\n"); fprintf(fp, "%d ", iColumn); comma = true; newLine = false; n++; if (n == 10) { n = 0; newLine = true; } } } fprintf(fp, "};\n"); n = 0; comma = false; newLine = false; fprintf(fp, "\tdouble intSolnV[]={\n"); for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (primalColumnSolution[iColumn] > 0.5 && model_.solver()->isInteger(iColumn)) { if (comma) fprintf(fp, ","); if (newLine) fprintf(fp, "\n"); int value = static_cast (primalColumnSolution[iColumn] + 0.5); fprintf(fp, "%d. ", value); comma = true; newLine = false; n++; if (n == 10) { n = 0; newLine = true; } } } fprintf(fp, "};\n"); } if (fp != stdout) fclose(fp); if (masks) { delete [] maskStarts; for (int i = 0; i < maxMasks; i++) delete [] masks[i]; delete [] masks; } } else { sprintf(generalPrint, "Unable to open file %s",fileName.c_str()); printGeneralMessage(model_,generalPrint); } } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_SAVESOL: if (goodModel) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } saveSolution(lpSolver, fileName); } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; case CLP_PARAM_ACTION_DUMMY: break; case CLP_PARAM_ACTION_ENVIRONMENT: CbcOrClpEnvironmentIndex = 0; break; case CLP_PARAM_ACTION_PARAMETRICS: if (goodModel) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters_[iParam].stringValue(); } else if (field == "EOL") { parameters_[iParam].printString(); break; } else { parameters_[iParam].setStringValue(field); } std::string fileName; //bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } static_cast (lpSolver)->parametrics(fileName.c_str()); time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } else { sprintf(generalPrint, "** Current model not valid"); printGeneralMessage(model_,generalPrint); } break; default: abort(); } } } else if (!numberMatches) { std::cout << "No match for " << field << " - ? for list of commands" << std::endl; } else if (numberMatches == 1) { if (!numberQuery) { std::cout << "Short match for " << field << " - completion: "; std::cout << parameters_[firstMatch].matchName() << std::endl; } else if (numberQuery) { std::cout << parameters_[firstMatch].matchName() << " : "; std::cout << parameters_[firstMatch].shortHelp() << std::endl; if (numberQuery >= 2) parameters_[firstMatch].printLongHelp(); } } else { if (!numberQuery) std::cout << "Multiple matches for " << field << " - possible completions:" << std::endl; else std::cout << "Completions of " << field << ":" << std::endl; for ( iParam = 0; iParam < numberParameters_; iParam++ ) { int match = parameters_[iParam].matches(field); if (match && parameters_[iParam].displayThis()) { std::cout << parameters_[iParam].matchName(); if (numberQuery >= 2) std::cout << " : " << parameters_[iParam].shortHelp(); std::cout << std::endl; } } } } } #if CBC_QUIET == 0 sprintf(generalPrint , "Total time (CPU seconds): %.2f (Wallclock seconds): %.2f\n", CoinCpuTime() - time0, CoinGetTimeOfDay() - time0Elapsed); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; #endif #ifdef COIN_HAS_GLPK if (cbc_glp_prob) { // free up as much as possible glp_free(cbc_glp_prob); glp_mpl_free_wksp(cbc_glp_tran); glp_free_env(); cbc_glp_prob = NULL; cbc_glp_tran = NULL; } #endif delete [] statistics_number_cuts; delete [] statistics_name_generators; // By now all memory should be freed #ifdef DMALLOC //dmalloc_log_unfreed(); //dmalloc_shutdown(); #endif if (babModel_) { model_.moveInfo(*babModel_); #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * clpSolver0 = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver()); ClpSimplex * lpSolver0 = clpSolver0->getModelPtr(); OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model_.solver()); ClpSimplex * lpSolver = clpSolver->getModelPtr(); if (lpSolver0 != lpSolver && lpSolver != originalSolver->getModelPtr()) lpSolver->moveInfo(*lpSolver0); //babModel_->setModelOwnsSolver(false); #endif } #ifdef CBC_SIG_TRAP // On Sun sometimes seems to be error - try and get round it CoinSighandler_t saveSignal = SIG_DFL; // register signal handler saveSignal = signal(SIGSEGV, signal_handler_error); // to force failure!babModel_->setNumberObjects(20000); if (!sigsetjmp(cbc_seg_buffer, 1)) { #endif delete babModel_; #ifdef CBC_SIG_TRAP } else { std::cerr << "delete babModel_ failed" << std::endl; } #endif babModel_ = NULL; model_.solver()->setWarmStart(NULL); //sprintf(generalPrint, "Total time %.2f", CoinCpuTime() - time0); //generalMessageHandler->message(CLP_GENERAL, generalMessages) //<< generalPrint //<< CoinMessageEol; return 0; } int CbcMain (int argc, const char *argv[], CbcModel & model) { CbcMain0(model); return CbcMain1(argc, argv, model); } void CbcMain0 (CbcModel & model) { CbcMain0(model,staticParameterData); } void CbcMain0 (CbcModel & model, CbcSolverUsefulData & parameterData) { CbcOrClpParam * parameters = parameterData.parameters_; int numberParameters = parameterData.numberParameters_; #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface * originalSolver = dynamic_cast (model.solver()); #elif CBC_OTHER_SOLVER==1 OsiCpxSolverInterface * originalSolver = dynamic_cast (model.solver()); // Dummy solvers OsiClpSolverInterface dummySolver; ClpSimplex * lpSolver = dummySolver.getModelPtr(); OsiCpxSolverInterface * clpSolver = originalSolver; #endif assert (originalSolver); CoinMessageHandler * generalMessageHandler = originalSolver->messageHandler(); generalMessageHandler->setPrefix(true); #ifndef CBC_OTHER_SOLVER OsiSolverInterface * solver = model.solver(); OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); ClpSimplex * lpSolver = clpSolver->getModelPtr(); lpSolver->setPerturbation(50); lpSolver->messageHandler()->setPrefix(false); #endif //establishParams(numberParameters, parameters) ; const char dirsep = CoinFindDirSeparator(); std::string directory; std::string dirSample; std::string dirNetlib; std::string dirMiplib; if (dirsep == '/') { directory = "./"; dirSample = "../../Data/Sample/"; dirNetlib = "../../Data/Netlib/"; dirMiplib = "../../Data/miplib3/"; } else { directory = ".\\"; dirSample = "..\\..\\..\\..\\Data\\Sample\\"; dirNetlib = "..\\..\\..\\..\\Data\\Netlib\\"; dirMiplib = "..\\..\\..\\..\\Data\\miplib3\\"; } std::string defaultDirectory = directory; std::string importFile = ""; std::string exportFile = "default.mps"; std::string importBasisFile = ""; std::string importPriorityFile = ""; std::string debugFile = ""; std::string printMask = ""; std::string exportBasisFile = "default.bas"; std::string saveFile = "default.prob"; std::string restoreFile = "default.prob"; std::string solutionFile = "stdout"; std::string solutionSaveFile = "solution.file"; int doIdiot = -1; int outputFormat = 2; int substitution = 3; int dualize = 3; int preSolve = 5; int doSprint = -1; int testOsiParameters = -1; parameters[whichParam(CLP_PARAM_ACTION_BASISIN, numberParameters, parameters)].setStringValue(importBasisFile); parameters[whichParam(CBC_PARAM_ACTION_PRIORITYIN, numberParameters, parameters)].setStringValue(importPriorityFile); parameters[whichParam(CLP_PARAM_ACTION_BASISOUT, numberParameters, parameters)].setStringValue(exportBasisFile); parameters[whichParam(CLP_PARAM_ACTION_DEBUG, numberParameters, parameters)].setStringValue(debugFile); parameters[whichParam(CLP_PARAM_ACTION_PRINTMASK, numberParameters, parameters)].setStringValue(printMask); parameters[whichParam(CLP_PARAM_ACTION_DIRECTORY, numberParameters, parameters)].setStringValue(directory); parameters[whichParam(CLP_PARAM_ACTION_DIRSAMPLE, numberParameters, parameters)].setStringValue(dirSample); parameters[whichParam(CLP_PARAM_ACTION_DIRNETLIB, numberParameters, parameters)].setStringValue(dirNetlib); parameters[whichParam(CBC_PARAM_ACTION_DIRMIPLIB, numberParameters, parameters)].setStringValue(dirMiplib); parameters[whichParam(CLP_PARAM_DBL_DUALBOUND, numberParameters, parameters)].setDoubleValue(lpSolver->dualBound()); parameters[whichParam(CLP_PARAM_DBL_DUALTOLERANCE, numberParameters, parameters)].setDoubleValue(lpSolver->dualTolerance()); parameters[whichParam(CLP_PARAM_ACTION_EXPORT, numberParameters, parameters)].setStringValue(exportFile); parameters[whichParam(CLP_PARAM_INT_IDIOT, numberParameters, parameters)].setIntValue(doIdiot); parameters[whichParam(CLP_PARAM_ACTION_IMPORT, numberParameters, parameters)].setStringValue(importFile); parameters[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters, parameters)].setDoubleValue(1.0e-8); int slog = whichParam(CLP_PARAM_INT_SOLVERLOGLEVEL, numberParameters, parameters); int log = whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters, parameters); parameters[slog].setIntValue(1); clpSolver->messageHandler()->setLogLevel(1) ; model.messageHandler()->setLogLevel(1); lpSolver->setLogLevel(1); parameters[log].setIntValue(1); parameters[whichParam(CLP_PARAM_INT_MAXFACTOR, numberParameters, parameters)].setIntValue(lpSolver->factorizationFrequency()); parameters[whichParam(CLP_PARAM_INT_MAXITERATION, numberParameters, parameters)].setIntValue(lpSolver->maximumIterations()); parameters[whichParam(CLP_PARAM_INT_OUTPUTFORMAT, numberParameters, parameters)].setIntValue(outputFormat); parameters[whichParam(CLP_PARAM_INT_PRESOLVEPASS, numberParameters, parameters)].setIntValue(preSolve); parameters[whichParam(CLP_PARAM_INT_PERTVALUE, numberParameters, parameters)].setIntValue(lpSolver->perturbation()); parameters[whichParam(CLP_PARAM_DBL_PRIMALTOLERANCE, numberParameters, parameters)].setDoubleValue(lpSolver->primalTolerance()); parameters[whichParam(CLP_PARAM_DBL_PRIMALWEIGHT, numberParameters, parameters)].setDoubleValue(lpSolver->infeasibilityCost()); parameters[whichParam(CLP_PARAM_ACTION_RESTORE, numberParameters, parameters)].setStringValue(restoreFile); parameters[whichParam(CLP_PARAM_ACTION_SAVE, numberParameters, parameters)].setStringValue(saveFile); //parameters[whichParam(CLP_PARAM_DBL_TIMELIMIT,numberParameters,parameters)].setDoubleValue(1.0e8); parameters[whichParam(CBC_PARAM_DBL_TIMELIMIT_BAB, numberParameters, parameters)].setDoubleValue(1.0e8); parameters[whichParam(CLP_PARAM_ACTION_SOLUTION, numberParameters, parameters)].setStringValue(solutionFile); parameters[whichParam(CLP_PARAM_ACTION_NEXTBESTSOLUTION, numberParameters, parameters)].setStringValue(solutionFile); parameters[whichParam(CLP_PARAM_ACTION_SAVESOL, numberParameters, parameters)].setStringValue(solutionSaveFile); parameters[whichParam(CLP_PARAM_INT_SPRINT, numberParameters, parameters)].setIntValue(doSprint); parameters[whichParam(CLP_PARAM_INT_SUBSTITUTION, numberParameters, parameters)].setIntValue(substitution); parameters[whichParam(CLP_PARAM_INT_DUALIZE, numberParameters, parameters)].setIntValue(dualize); model.setNumberBeforeTrust(10); parameters[whichParam(CBC_PARAM_INT_NUMBERBEFORE, numberParameters, parameters)].setIntValue(5); parameters[whichParam(CBC_PARAM_INT_MAXNODES, numberParameters, parameters)].setIntValue(model.getMaximumNodes()); model.setNumberStrong(5); parameters[whichParam(CBC_PARAM_INT_STRONGBRANCHING, numberParameters, parameters)].setIntValue(model.numberStrong()); parameters[whichParam(CBC_PARAM_DBL_INFEASIBILITYWEIGHT, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcInfeasibilityWeight)); parameters[whichParam(CBC_PARAM_DBL_INTEGERTOLERANCE, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcIntegerTolerance)); parameters[whichParam(CBC_PARAM_DBL_INCREMENT, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcCutoffIncrement)); parameters[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters, parameters)].setIntValue(testOsiParameters); parameters[whichParam(CBC_PARAM_INT_FPUMPTUNE, numberParameters, parameters)].setIntValue(1003); initialPumpTune = 1003; #ifdef CBC_THREAD parameters[whichParam(CBC_PARAM_INT_THREADS, numberParameters, parameters)].setIntValue(0); #endif // Set up likely cut generators and defaults parameters[whichParam(CBC_PARAM_STR_PREPROCESS, numberParameters, parameters)].setCurrentOption("sos"); parameters[whichParam(CBC_PARAM_INT_MIPOPTIONS, numberParameters, parameters)].setIntValue(1057); parameters[whichParam(CBC_PARAM_INT_CUTPASSINTREE, numberParameters, parameters)].setIntValue(1); parameters[whichParam(CBC_PARAM_INT_MOREMIPOPTIONS, numberParameters, parameters)].setIntValue(-1); parameters[whichParam(CBC_PARAM_INT_MAXHOTITS, numberParameters, parameters)].setIntValue(100); parameters[whichParam(CBC_PARAM_STR_CUTSSTRATEGY, numberParameters, parameters)].setCurrentOption("on"); parameters[whichParam(CBC_PARAM_STR_HEURISTICSTRATEGY, numberParameters, parameters)].setCurrentOption("on"); parameters[whichParam(CBC_PARAM_STR_NODESTRATEGY, numberParameters, parameters)].setCurrentOption("fewest"); parameters[whichParam(CBC_PARAM_STR_GOMORYCUTS, numberParameters, parameters)].setCurrentOption("ifmove"); parameters[whichParam(CBC_PARAM_STR_PROBINGCUTS, numberParameters, parameters)].setCurrentOption("ifmove"); parameters[whichParam(CBC_PARAM_STR_KNAPSACKCUTS, numberParameters, parameters)].setCurrentOption("ifmove"); parameters[whichParam(CBC_PARAM_STR_ZEROHALFCUTS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_REDSPLITCUTS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_REDSPLIT2CUTS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_GMICUTS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_CLIQUECUTS, numberParameters, parameters)].setCurrentOption("ifmove"); parameters[whichParam(CBC_PARAM_STR_MIXEDCUTS, numberParameters, parameters)].setCurrentOption("ifmove"); parameters[whichParam(CBC_PARAM_STR_FLOWCUTS, numberParameters, parameters)].setCurrentOption("ifmove"); parameters[whichParam(CBC_PARAM_STR_TWOMIRCUTS, numberParameters, parameters)].setCurrentOption("root"); parameters[whichParam(CBC_PARAM_STR_LANDPCUTS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_RESIDCUTS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_ROUNDING, numberParameters, parameters)].setCurrentOption("on"); parameters[whichParam(CBC_PARAM_STR_FPUMP, numberParameters, parameters)].setCurrentOption("on"); parameters[whichParam(CBC_PARAM_STR_GREEDY, numberParameters, parameters)].setCurrentOption("on"); parameters[whichParam(CBC_PARAM_STR_COMBINE, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_CROSSOVER2, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_PIVOTANDCOMPLEMENT, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_PIVOTANDFIX, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_RANDROUND, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_NAIVE, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_RINS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_DINS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_RENS, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_LOCALTREE, numberParameters, parameters)].setCurrentOption("off"); parameters[whichParam(CBC_PARAM_STR_COSTSTRATEGY, numberParameters, parameters)].setCurrentOption("off"); } /* Routines to print statistics. */ static void breakdown(const char * name, int numberLook, const double * region) { double range[] = { -COIN_DBL_MAX, -1.0e15, -1.0e11, -1.0e8, -1.0e5, -1.0e4, -1.0e3, -1.0e2, -1.0e1, -1.0, -1.0e-1, -1.0e-2, -1.0e-3, -1.0e-4, -1.0e-5, -1.0e-8, -1.0e-11, -1.0e-15, 0.0, 1.0e-15, 1.0e-11, 1.0e-8, 1.0e-5, 1.0e-4, 1.0e-3, 1.0e-2, 1.0e-1, 1.0, 1.0e1, 1.0e2, 1.0e3, 1.0e4, 1.0e5, 1.0e8, 1.0e11, 1.0e15, COIN_DBL_MAX }; int nRanges = static_cast (sizeof(range) / sizeof(double)); int * number = new int[nRanges]; memset(number, 0, nRanges*sizeof(int)); int * numberExact = new int[nRanges]; memset(numberExact, 0, nRanges*sizeof(int)); int i; for ( i = 0; i < numberLook; i++) { double value = region[i]; for (int j = 0; j < nRanges; j++) { if (value == range[j]) { numberExact[j]++; break; } else if (value < range[j]) { number[j]++; break; } } } printf("\n%s has %d entries\n", name, numberLook); for (i = 0; i < nRanges; i++) { if (number[i]) printf("%d between %g and %g", number[i], range[i-1], range[i]); if (numberExact[i]) { if (number[i]) printf(", "); printf("%d exactly at %g", numberExact[i], range[i]); } if (number[i] + numberExact[i]) printf("\n"); } delete [] number; delete [] numberExact; } static void sortOnOther(int * column, const CoinBigIndex * rowStart, int * order, int * other, int nRow, int nInRow, int where) { if (nRow < 2 || where >= nInRow) return; // do initial sort int kRow; int iRow; for ( kRow = 0; kRow < nRow; kRow++) { iRow = order[kRow]; other[kRow] = column[rowStart[iRow] + where]; } CoinSort_2(other, other + nRow, order); int first = 0; iRow = order[0]; int firstC = column[rowStart[iRow] + where]; kRow = 1; while (kRow < nRow) { int lastC = 9999999;; for (; kRow < nRow + 1; kRow++) { if (kRow < nRow) { iRow = order[kRow]; lastC = column[rowStart[iRow] + where]; } else { lastC = 9999999; } if (lastC > firstC) break; } // sort sortOnOther(column, rowStart, order + first, other, kRow - first, nInRow, where + 1); firstC = lastC; first = kRow; } } static void statistics(ClpSimplex * originalModel, ClpSimplex * model) { int numberColumns = originalModel->numberColumns(); const char * integerInformation = originalModel->integerInformation(); const double * columnLower = originalModel->columnLower(); const double * columnUpper = originalModel->columnUpper(); int numberIntegers = 0; int numberBinary = 0; int iRow, iColumn; if (integerInformation) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerInformation[iColumn]) { if (columnUpper[iColumn] > columnLower[iColumn]) { numberIntegers++; if (columnLower[iColumn] == 0.0 && columnUpper[iColumn] == 1) numberBinary++; } } } printf("Original problem has %d integers (%d of which binary)\n", numberIntegers,numberBinary); } numberColumns = model->numberColumns(); int numberRows = model->numberRows(); columnLower = model->columnLower(); columnUpper = model->columnUpper(); const double * rowLower = model->rowLower(); const double * rowUpper = model->rowUpper(); const double * objective = model->objective(); if (model->integerInformation()) { const char * integerInformation = model->integerInformation(); int numberIntegers = 0; int numberBinary = 0; double * obj = new double [numberColumns]; int * which = new int [numberColumns]; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn]) { if (integerInformation[iColumn]) { numberIntegers++; if (columnLower[iColumn] == 0.0 && columnUpper[iColumn] == 1) numberBinary++; } } } if(numberColumns != originalModel->numberColumns()) printf("Presolved problem has %d integers (%d of which binary)\n", numberIntegers,numberBinary); for (int ifInt=0;ifInt<2;ifInt++) { for (int ifAbs=0;ifAbs<2;ifAbs++) { int numberSort=0; int numberZero=0; int numberDifferentObj=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn]) { if (!ifInt||integerInformation[iColumn]) { obj[numberSort]=(ifAbs) ? fabs(objective[iColumn]) : objective[iColumn]; which[numberSort++]=iColumn; if (!objective[iColumn]) numberZero++; } } } CoinSort_2(obj,obj+numberSort,which); double last=obj[0]; for (int jColumn = 1; jColumn < numberSort; jColumn++) { if (fabs(obj[jColumn]-last)>1.0e-12) { numberDifferentObj++; last=obj[jColumn]; } } numberDifferentObj++; printf("==== "); if (ifInt) printf("for integers "); if (!ifAbs) printf("%d zero objective ",numberZero); else printf("absolute objective values "); printf("%d different\n",numberDifferentObj); bool saveModel=false; int target=model->logLevel(); if (target>10000) { if (ifInt&&!ifAbs) saveModel=true; target-=10000; } if (target<=100) target=12; else target-=100; if (numberDifferentObj1.0e-12) { printf("%d variables have objective of %g\n", jColumn-iLast,last); iLast=jColumn; last=obj[jColumn]; } } printf("%d variables have objective of %g\n", numberSort-iLast,last); if (saveModel) { int spaceNeeded=numberSort+numberDifferentObj; int * columnAdd = new int[spaceNeeded+numberDifferentObj+1]; double * elementAdd = new double[spaceNeeded]; int * rowAdd = new int[2*numberDifferentObj+1]; int * newIsInteger = rowAdd+numberDifferentObj+1; double * objectiveNew = new double[3*numberDifferentObj]; double * lowerNew = objectiveNew+numberDifferentObj; double * upperNew = lowerNew+numberDifferentObj; memset(columnAdd+spaceNeeded,0, (numberDifferentObj+1)*sizeof(int)); ClpSimplex tempModel=*model; int iLast=0; double last=obj[0]; numberDifferentObj=0; int numberElements=0; rowAdd[0]=0; double * objective = tempModel.objective(); for (int jColumn = 1; jColumn < numberSort+1; jColumn++) { if (jColumn==numberSort||fabs(obj[jColumn]-last)>1.0e-12) { // not if just one if (jColumn-iLast>1) { bool allInteger=integerInformation!=NULL; int iColumn=which[iLast]; objectiveNew[numberDifferentObj]=objective[iColumn]; double lower=0.0; double upper=0.0; for (int kColumn=iLast;kColumnproblemName(); if (ifInt) tempName += "_int"; if (ifAbs) tempName += "_abs"; tempName += ".mps"; tempModel.writeMps(tempName.c_str()); } } } } delete [] which; delete [] obj; printf("===== end objective counts\n"); } CoinPackedMatrix * matrix = model->matrix(); CoinBigIndex numberElements = matrix->getNumElements(); const int * columnLength = matrix->getVectorLengths(); //const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); int * number = new int[numberRows+1]; memset(number, 0, (numberRows + 1)*sizeof(int)); int numberObjSingletons = 0; /* cType 0 0/inf, 1 0/up, 2 lo/inf, 3 lo/up, 4 free, 5 fix, 6 -inf/0, 7 -inf/up, 8 0/1 */ int cType[9]; std::string cName[] = {"0.0->inf,", "0.0->up,", "lo->inf,", "lo->up,", "free,", "fixed,", "-inf->0.0,", "-inf->up,", "0.0->1.0" }; int nObjective = 0; memset(cType, 0, sizeof(cType)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; if (length == 1 && objective[iColumn]) numberObjSingletons++; number[length]++; if (objective[iColumn]) nObjective++; if (columnLower[iColumn] > -1.0e20) { if (columnLower[iColumn] == 0.0) { if (columnUpper[iColumn] > 1.0e20) cType[0]++; else if (columnUpper[iColumn] == 1.0) cType[8]++; else if (columnUpper[iColumn] == 0.0) cType[5]++; else cType[1]++; } else { if (columnUpper[iColumn] > 1.0e20) cType[2]++; else if (columnUpper[iColumn] == columnLower[iColumn]) cType[5]++; else cType[3]++; } } else { if (columnUpper[iColumn] > 1.0e20) cType[4]++; else if (columnUpper[iColumn] == 0.0) cType[6]++; else cType[7]++; } } /* rType 0 E 0, 1 E 1, 2 E -1, 3 E other, 4 G 0, 5 G 1, 6 G other, 7 L 0, 8 L 1, 9 L other, 10 Range 0/1, 11 Range other, 12 free */ int rType[13]; std::string rName[] = {"E 0.0,", "E 1.0,", "E -1.0,", "E other,", "G 0.0,", "G 1.0,", "G other,", "L 0.0,", "L 1.0,", "L other,", "Range 0.0->1.0,", "Range other,", "Free" }; memset(rType, 0, sizeof(rType)); for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow] > -1.0e20) { if (rowLower[iRow] == 0.0) { if (rowUpper[iRow] > 1.0e20) rType[4]++; else if (rowUpper[iRow] == 1.0) rType[10]++; else if (rowUpper[iRow] == 0.0) rType[0]++; else rType[11]++; } else if (rowLower[iRow] == 1.0) { if (rowUpper[iRow] > 1.0e20) rType[5]++; else if (rowUpper[iRow] == rowLower[iRow]) rType[1]++; else rType[11]++; } else if (rowLower[iRow] == -1.0) { if (rowUpper[iRow] > 1.0e20) rType[6]++; else if (rowUpper[iRow] == rowLower[iRow]) rType[2]++; else rType[11]++; } else { if (rowUpper[iRow] > 1.0e20) rType[6]++; else if (rowUpper[iRow] == rowLower[iRow]) rType[3]++; else rType[11]++; } } else { if (rowUpper[iRow] > 1.0e20) rType[12]++; else if (rowUpper[iRow] == 0.0) rType[7]++; else if (rowUpper[iRow] == 1.0) rType[8]++; else rType[9]++; } } // Basic statistics printf("\n\nProblem has %d rows, %d columns (%d with objective) and %d elements\n", numberRows, numberColumns, nObjective, numberElements); if (number[0] + number[1]) { printf("There are "); if (numberObjSingletons) printf("%d singletons with objective ", numberObjSingletons); int numberNoObj = number[1] - numberObjSingletons; if (numberNoObj) printf("%d singletons with no objective ", numberNoObj); if (number[0]) printf("** %d columns have no entries", number[0]); printf("\n"); } printf("Column breakdown:\n"); int k; for (k = 0; k < static_cast (sizeof(cType) / sizeof(int)); k++) { printf("%d of type %s ", cType[k], cName[k].c_str()); if (((k + 1) % 3) == 0) printf("\n"); } if ((k % 3) != 0) printf("\n"); printf("Row breakdown:\n"); for (k = 0; k < static_cast (sizeof(rType) / sizeof(int)); k++) { printf("%d of type %s ", rType[k], rName[k].c_str()); if (((k + 1) % 3) == 0) printf("\n"); } if ((k % 3) != 0) printf("\n"); //#define SYM #ifndef SYM if (model->logLevel() < 2) return ; #endif int kMax = model->logLevel() > 3 ? 1000000 : 10; k = 0; for (iRow = 1; iRow <= numberRows; iRow++) { if (number[iRow]) { k++; printf("%d columns have %d entries\n", number[iRow], iRow); if (k == kMax) break; } } if (k < numberRows) { int kk = k; k = 0; for (iRow = numberRows; iRow >= 1; iRow--) { if (number[iRow]) { k++; if (k == kMax) break; } } if (k > kk) { printf("\n .........\n\n"); iRow = k; k = 0; for (; iRow < numberRows; iRow++) { if (number[iRow]) { k++; printf("%d columns have %d entries\n", number[iRow], iRow); if (k == kMax) break; } } } } delete [] number; printf("\n\n"); if (model->logLevel() == 63 #ifdef SYM || true #endif ) { // get column copy CoinPackedMatrix columnCopy = *matrix; const int * columnLength = columnCopy.getVectorLengths(); number = new int[numberRows+1]; memset(number, 0, (numberRows + 1)*sizeof(int)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; number[length]++; } k = 0; for (iRow = 1; iRow <= numberRows; iRow++) { if (number[iRow]) { k++; } } int * row = columnCopy.getMutableIndices(); const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); double * element = columnCopy.getMutableElements(); int * order = new int[numberColumns]; int * other = new int[numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; order[iColumn] = iColumn; other[iColumn] = length; CoinBigIndex start = columnStart[iColumn]; CoinSort_2(row + start, row + start + length, element + start); } CoinSort_2(other, other + numberColumns, order); int jColumn = number[0] + number[1]; for (iRow = 2; iRow <= numberRows; iRow++) { if (number[iRow]) { printf("XX %d columns have %d entries\n", number[iRow], iRow); int kColumn = jColumn + number[iRow]; sortOnOther(row, columnStart, order + jColumn, other, number[iRow], iRow, 0); // Now print etc if (iRow < 500000) { for (int lColumn = jColumn; lColumn < kColumn; lColumn++) { iColumn = order[lColumn]; CoinBigIndex start = columnStart[iColumn]; if (model->logLevel() == 63) { printf("column %d %g <= ", iColumn, columnLower[iColumn]); for (CoinBigIndex i = start; i < start + iRow; i++) printf("( %d, %g) ", row[i], element[i]); printf("<= %g\n", columnUpper[iColumn]); } } } jColumn = kColumn; } } delete [] order; delete [] other; delete [] number; } // get row copy CoinPackedMatrix rowCopy = *matrix; rowCopy.reverseOrdering(); const int * rowLength = rowCopy.getVectorLengths(); number = new int[numberColumns+1]; memset(number, 0, (numberColumns + 1)*sizeof(int)); if (model->logLevel() > 3) { // get column copy CoinPackedMatrix columnCopy = *matrix; const int * columnLength = columnCopy.getVectorLengths(); const int * row = columnCopy.getIndices(); const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); const double * element = columnCopy.getElements(); const double * elementByRow = rowCopy.getElements(); const int * rowStart = rowCopy.getVectorStarts(); const int * column = rowCopy.getIndices(); int nPossibleZeroCost=0; int nPossibleNonzeroCost=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; if (columnLower[iColumn]<-1.0e30&&columnUpper[iColumn]>1.0e30) { if (length==1) { printf("Singleton free %d - cost %g\n",iColumn,objective[iColumn]); } else if (length==2) { int iRow0=row[columnStart[iColumn]]; int iRow1=row[columnStart[iColumn]+1]; double element0=element[columnStart[iColumn]]; double element1=element[columnStart[iColumn]+1]; int n0=rowLength[iRow0]; int n1=rowLength[iRow1]; printf("Doubleton free %d - cost %g - %g in %srow with %d entries and %g in %srow with %d entries\n", iColumn,objective[iColumn],element0,(rowLower[iRow0]==rowUpper[iRow0]) ? "==" : "",n0, element1,(rowLower[iRow1]==rowUpper[iRow1]) ? "==" : "",n1); } } if (length==1) { int iRow=row[columnStart[iColumn]]; double value=COIN_DBL_MAX; for (int i=rowStart[iRow];ilogLevel() > 4) printf("Singleton %d with no objective in row with %d elements - rhs %g,%g\n",iColumn,rowLength[iRow],rowLower[iRow],rowUpper[iRow]); nPossibleZeroCost++; } else if (value!=-COIN_DBL_MAX) { if (model->logLevel() > 4) printf("Singleton %d (%s) with objective in row %d (%s) with %d equal elements - rhs %g,%g\n",iColumn,model->getColumnName(iColumn).c_str(), iRow,model->getRowName(iRow).c_str(), rowLength[iRow],rowLower[iRow],rowUpper[iRow]); nPossibleNonzeroCost++; } } } if (nPossibleZeroCost||nPossibleNonzeroCost) printf("%d singletons with zero cost, %d with valid cost\n", nPossibleZeroCost,nPossibleNonzeroCost); // look for DW int * blockStart = new int [2*(numberRows+numberColumns)+1+numberRows]; int * columnBlock = blockStart+numberRows; int * nextColumn = columnBlock+numberColumns; int * blockCount = nextColumn+numberColumns; int * blockEls = blockCount+numberRows+1; int direction[2]={-1,1}; int bestBreak=-1; double bestValue=0.0; int iPass=0; int halfway=(numberRows+1)/2; int firstMaster=-1; int lastMaster=-2; while (iPass<2) { int increment=direction[iPass]; int start= increment>0 ? 0 : numberRows-1; int stop=increment>0 ? numberRows : -1; int numberBlocks=0; int thisBestBreak=-1; double thisBestValue=COIN_DBL_MAX; int numberRowsDone=0; int numberMarkedColumns=0; int maximumBlockSize=0; for (int i=0;i=0) { // column marked if (iBlock<0) { // put row in that block iBlock=whichColumnBlock; } else if (iBlock!=whichColumnBlock) { // merge blockCount[iBlock]+=blockCount[whichColumnBlock]; blockCount[whichColumnBlock]=0; int jColumn=blockStart[whichColumnBlock]; while (jColumn>=0) { columnBlock[jColumn]=iBlock; iColumn=jColumn; jColumn=nextColumn[jColumn]; } nextColumn[iColumn]=blockStart[iBlock]; blockStart[iBlock]=blockStart[whichColumnBlock]; blockStart[whichColumnBlock]=-1; } } } int n=numberMarkedColumns; if (iBlock<0) { //new block if (rowLength[iRow]) { numberBlocks++; iBlock=numberBlocks; int jColumn=column[rowStart[iRow]]; columnBlock[jColumn]=iBlock; blockStart[iBlock]=jColumn; numberMarkedColumns++; for (CoinBigIndex j=rowStart[iRow]+1;j maximumBlockSize&&numberRowsDone>halfway) { thisBestBreak=iRow; thisBestValue=static_cast(maximumBlockSize)/ static_cast(numberRowsDone); } } if (thisBestBreak==stop) thisBestValue=COIN_DBL_MAX; iPass++; if (iPass==1) { bestBreak=thisBestBreak; bestValue=thisBestValue; } else { if (bestValue=0) { blockCount[iBlock]++; blockEls[iBlock]+=rowLength[iRow]; } else { if (iBlock==-2) numberMaster++; else numberEmpty++; } } int numberEmptyColumns=0; int numberMasterColumns=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { int iBlock=columnBlock[iColumn]; if (iBlock>=0) { nextColumn[iBlock]++; } else { if (columnLength[iColumn]) numberMasterColumns++; else numberEmptyColumns++; } } int largestRows=0; int largestColumns=0; for (int i=0;ilargestRows+largestColumns) { largestRows=blockCount[i]; largestColumns=nextColumn[i]; } } bool useful=true; if (numberMaster>halfway||largestRows*3>numberRows) useful=false; printf("%s %d blocks (largest %d,%d), %d master rows (%d empty) out of %d, %d master columns (%d empty) out of %d\n", useful ? "**Useful" : "NoGood", numberBlocks,largestRows,largestColumns,numberMaster,numberEmpty,numberRows, numberMasterColumns,numberEmptyColumns,numberColumns); FILE * fp=NULL; bool justIntegers=true; bool oneFile=true; int logLevel = model->logLevel(); if (logLevel>19) { logLevel-=2; oneFile=true; fp = fopen("fake.bnd","w"); } if (logLevel==19) justIntegers=false; for (int i=0;i= 17 && logLevel <= 21) { int * whichRows=new int[numberRows+numberColumns]; int * whichColumns=whichRows+numberRows; char name[20]; for (int iBlock=0;iBlockgetRowName(iRow); subset.setRowName(jRow,name); } int nInteger=0; for (int jColumn=0;jColumnisInteger(iColumn)) { subset.setInteger(jColumn); nInteger++; } std::string name = model->getColumnName(iColumn); subset.setColumnName(jColumn,name); } if (logLevel == 17) { subset.writeMps(name,0,1); } else if (nInteger) { OsiClpSolverInterface subset2(&subset); CbcModel smallModel(subset2); smallModel.branchAndBound(); const double * solution = smallModel.bestSolution(); if (solution) { if (!oneFile) { sprintf(name,"block%d.bnd",iBlock); fp = fopen(name,"w"); assert (fp); } fprintf(fp,"BBB objective %g for block %d\n", smallModel.getObjValue(),iBlock); for (int jColumn=0;jColumn= 1; iColumn--) { if (number[iColumn]) { k++; if (k == kMax) break; } } if (k > kk) { printf("\n .........\n\n"); iColumn = k; k = 0; for (; iColumn < numberColumns; iColumn++) { if (number[iColumn]) { k++; printf("%d rows have %d entries\n", number[iColumn], iColumn); if (k == kMax) break; } } } } if (model->logLevel() == 63 #ifdef SYM || true #endif ) { int * column = rowCopy.getMutableIndices(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); double * element = rowCopy.getMutableElements(); int * order = new int[numberRows]; int * other = new int[numberRows]; for (iRow = 0; iRow < numberRows; iRow++) { int length = rowLength[iRow]; order[iRow] = iRow; other[iRow] = length; CoinBigIndex start = rowStart[iRow]; CoinSort_2(column + start, column + start + length, element + start); } CoinSort_2(other, other + numberRows, order); int jRow = number[0] + number[1]; double * weight = new double[numberRows]; double * randomColumn = new double[numberColumns+1]; double * randomRow = new double [numberRows+1]; int * sortRow = new int [numberRows]; int * possibleRow = new int [numberRows]; int * backRow = new int [numberRows]; int * stackRow = new int [numberRows]; int * sortColumn = new int [numberColumns]; int * possibleColumn = new int [numberColumns]; int * backColumn = new int [numberColumns]; int * backColumn2 = new int [numberColumns]; int * mapRow = new int [numberRows]; int * mapColumn = new int [numberColumns]; int * stackColumn = new int [numberColumns]; double randomLower = CoinDrand48(); double randomUpper = CoinDrand48(); double randomInteger = CoinDrand48(); int * startAdd = new int[numberRows+1]; int * columnAdd = new int [2*numberElements]; double * elementAdd = new double[2*numberElements]; int nAddRows = 0; startAdd[0] = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { randomColumn[iColumn] = CoinDrand48(); backColumn2[iColumn] = -1; } for (iColumn = 2; iColumn <= numberColumns; iColumn++) { if (number[iColumn]) { printf("XX %d rows have %d entries\n", number[iColumn], iColumn); int kRow = jRow + number[iColumn]; sortOnOther(column, rowStart, order + jRow, other, number[iColumn], iColumn, 0); // Now print etc if (iColumn < 500000) { int nLook = 0; for (int lRow = jRow; lRow < kRow; lRow++) { iRow = order[lRow]; CoinBigIndex start = rowStart[iRow]; if (model->logLevel() == 63) { printf("row %d %g <= ", iRow, rowLower[iRow]); for (CoinBigIndex i = start; i < start + iColumn; i++) printf("( %d, %g) ", column[i], element[i]); printf("<= %g\n", rowUpper[iRow]); } int first = column[start]; double sum = 0.0; for (CoinBigIndex i = start; i < start + iColumn; i++) { int jColumn = column[i]; double value = element[i]; jColumn -= first; assert (jColumn >= 0); sum += value * randomColumn[jColumn]; } if (rowLower[iRow] > -1.0e30 && rowLower[iRow]) sum += rowLower[iRow] * randomLower; else if (!rowLower[iRow]) sum += 1.234567e-7 * randomLower; if (rowUpper[iRow] < 1.0e30 && rowUpper[iRow]) sum += rowUpper[iRow] * randomUpper; else if (!rowUpper[iRow]) sum += 1.234567e-7 * randomUpper; sortRow[nLook] = iRow; randomRow[nLook++] = sum; // best way is to number unique elements and bounds and use if (fabs(sum) > 1.0e4) sum *= 1.0e-6; weight[iRow] = sum; } assert (nLook <= numberRows); CoinSort_2(randomRow, randomRow + nLook, sortRow); randomRow[nLook] = COIN_DBL_MAX; double last = -COIN_DBL_MAX; int iLast = -1; for (int iLook = 0; iLook < nLook + 1; iLook++) { if (randomRow[iLook] > last) { if (iLast >= 0) { int n = iLook - iLast; if (n > 1) { //printf("%d rows possible?\n",n); } } iLast = iLook; last = randomRow[iLook]; } } } jRow = kRow; } } CoinPackedMatrix columnCopy = *matrix; const int * columnLength = columnCopy.getVectorLengths(); const int * row = columnCopy.getIndices(); const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); const double * elementByColumn = columnCopy.getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; CoinBigIndex start = columnStart[iColumn]; double sum = objective[iColumn]; if (columnLower[iColumn] > -1.0e30 && columnLower[iColumn]) sum += columnLower[iColumn] * randomLower; else if (!columnLower[iColumn]) sum += 1.234567e-7 * randomLower; if (columnUpper[iColumn] < 1.0e30 && columnUpper[iColumn]) sum += columnUpper[iColumn] * randomUpper; else if (!columnUpper[iColumn]) sum += 1.234567e-7 * randomUpper; if (model->isInteger(iColumn)) sum += 9.87654321e-6 * randomInteger; for (CoinBigIndex i = start; i < start + length; i++) { int iRow = row[i]; sum += elementByColumn[i] * weight[iRow]; } sortColumn[iColumn] = iColumn; randomColumn[iColumn] = sum; } { CoinSort_2(randomColumn, randomColumn + numberColumns, sortColumn); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int i = sortColumn[iColumn]; backColumn[i] = iColumn; } randomColumn[numberColumns] = COIN_DBL_MAX; double last = -COIN_DBL_MAX; int iLast = -1; for (int iLook = 0; iLook < numberColumns + 1; iLook++) { if (randomColumn[iLook] > last) { if (iLast >= 0) { int n = iLook - iLast; if (n > 1) { //printf("%d columns possible?\n",n); } for (int i = iLast; i < iLook; i++) { possibleColumn[sortColumn[i]] = n; } } iLast = iLook; last = randomColumn[iLook]; } } for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex start = rowStart[iRow]; double sum = 0.0; int length = rowLength[iRow]; for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; double value = element[i]; jColumn = backColumn[jColumn]; sum += value * randomColumn[jColumn]; //if (iColumn==23089||iRow==23729) //printf("row %d cola %d colb %d value %g rand %g sum %g\n", // iRow,jColumn,column[i],value,randomColumn[jColumn],sum); } sortRow[iRow] = iRow; randomRow[iRow] = weight[iRow]; randomRow[iRow] = sum; } CoinSort_2(randomRow, randomRow + numberRows, sortRow); for (iRow = 0; iRow < numberRows; iRow++) { int i = sortRow[iRow]; backRow[i] = iRow; } randomRow[numberRows] = COIN_DBL_MAX; last = -COIN_DBL_MAX; iLast = -1; // Do backward indices from order for (iRow = 0; iRow < numberRows; iRow++) { other[order[iRow]] = iRow; } for (int iLook = 0; iLook < numberRows + 1; iLook++) { if (randomRow[iLook] > last) { if (iLast >= 0) { int n = iLook - iLast; if (n > 1) { //printf("%d rows possible?\n",n); // Within group sort as for original "order" for (int i = iLast; i < iLook; i++) { int jRow = sortRow[i]; order[i] = other[jRow]; } CoinSort_2(order + iLast, order + iLook, sortRow + iLast); } for (int i = iLast; i < iLook; i++) { possibleRow[sortRow[i]] = n; } } iLast = iLook; last = randomRow[iLook]; } } // Temp out for (int iLook = 0; iLook < numberRows - 1000000; iLook++) { iRow = sortRow[iLook]; CoinBigIndex start = rowStart[iRow]; int length = rowLength[iRow]; int numberPossible = possibleRow[iRow]; for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; if (possibleColumn[jColumn] != numberPossible) numberPossible = -1; } int n = numberPossible; if (numberPossible > 1) { //printf("pppppossible %d\n",numberPossible); for (int jLook = iLook + 1; jLook < iLook + numberPossible; jLook++) { int jRow = sortRow[jLook]; CoinBigIndex start2 = rowStart[jRow]; assert (numberPossible == possibleRow[jRow]); assert(length == rowLength[jRow]); for (CoinBigIndex i = start2; i < start2 + length; i++) { int jColumn = column[i]; if (possibleColumn[jColumn] != numberPossible) numberPossible = -1; } } if (numberPossible < 2) { // switch off for (int jLook = iLook; jLook < iLook + n; jLook++) possibleRow[sortRow[jLook]] = -1; } // skip rest iLook += n - 1; } else { possibleRow[iRow] = -1; } } for (int iLook = 0; iLook < numberRows; iLook++) { iRow = sortRow[iLook]; int numberPossible = possibleRow[iRow]; // Only if any integers int numberIntegers = 0; CoinBigIndex start = rowStart[iRow]; int length = rowLength[iRow]; for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; if (model->isInteger(jColumn)) numberIntegers++; } if (numberPossible > 1 && !numberIntegers) { //printf("possible %d - but no integers\n",numberPossible); } if (numberPossible > 1 && (numberIntegers || false)) { // printf("possible %d - %d integers\n", numberPossible, numberIntegers); int lastLook = iLook; int nMapRow = -1; for (int jLook = iLook + 1; jLook < iLook + numberPossible; jLook++) { // stop if too many failures if (jLook > iLook + 10 && nMapRow < 0) break; // Create identity mapping int i; for (i = 0; i < numberRows; i++) mapRow[i] = i; for (i = 0; i < numberColumns; i++) mapColumn[i] = i; int offset = jLook - iLook; int nStackC = 0; // build up row and column mapping int nStackR = 1; stackRow[0] = iLook; bool good = true; while (nStackR) { nStackR--; int look1 = stackRow[nStackR]; int look2 = look1 + offset; assert (randomRow[look1] == randomRow[look2]); int row1 = sortRow[look1]; int row2 = sortRow[look2]; assert (mapRow[row1] == row1); assert (mapRow[row2] == row2); mapRow[row1] = row2; mapRow[row2] = row1; CoinBigIndex start1 = rowStart[row1]; CoinBigIndex offset2 = rowStart[row2] - start1; int length = rowLength[row1]; assert( length == rowLength[row2]); for (CoinBigIndex i = start1; i < start1 + length; i++) { int jColumn1 = column[i]; int jColumn2 = column[i+offset2]; if (randomColumn[backColumn[jColumn1]] != randomColumn[backColumn[jColumn2]]) { good = false; break; } if (mapColumn[jColumn1] == jColumn1) { // not touched assert (mapColumn[jColumn2] == jColumn2); if (jColumn1 != jColumn2) { // Put on stack mapColumn[jColumn1] = jColumn2; mapColumn[jColumn2] = jColumn1; stackColumn[nStackC++] = jColumn1; } } else { if (mapColumn[jColumn1] != jColumn2 || mapColumn[jColumn2] != jColumn1) { // bad good = false; printf("bad col\n"); break; } } } if (!good) break; while (nStackC) { nStackC--; int iColumn = stackColumn[nStackC]; int iColumn2 = mapColumn[iColumn]; assert (iColumn != iColumn2); int length = columnLength[iColumn]; assert (length == columnLength[iColumn2]); CoinBigIndex start = columnStart[iColumn]; CoinBigIndex offset2 = columnStart[iColumn2] - start; for (CoinBigIndex i = start; i < start + length; i++) { int iRow = row[i]; int iRow2 = row[i+offset2]; if (mapRow[iRow] == iRow) { // First (but be careful) if (iRow != iRow2) { //mapRow[iRow]=iRow2; //mapRow[iRow2]=iRow; int iBack = backRow[iRow]; int iBack2 = backRow[iRow2]; if (randomRow[iBack] == randomRow[iBack2] && iBack2 - iBack == offset) { stackRow[nStackR++] = iBack; } else { //printf("randomRow diff - weights %g %g\n", // weight[iRow],weight[iRow2]); // bad good = false; break; } } } else { if (mapRow[iRow] != iRow2 || mapRow[iRow2] != iRow) { // bad good = false; printf("bad row\n"); break; } } } if (!good) break; } } // then check OK if (good) { for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex start = rowStart[iRow]; int length = rowLength[iRow]; if (mapRow[iRow] == iRow) { for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; backColumn2[jColumn] = i - start; } for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; if (mapColumn[jColumn] != jColumn) { int jColumn2 = mapColumn[jColumn]; CoinBigIndex i2 = backColumn2[jColumn2]; if (i2 < 0) { good = false; } else if (element[i] != element[i2+start]) { good = false; } } } for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; backColumn2[jColumn] = -1; } } else { int row2 = mapRow[iRow]; assert (iRow = mapRow[row2]); if (rowLower[iRow] != rowLower[row2] || rowLower[row2] != rowLower[iRow]) good = false; CoinBigIndex offset2 = rowStart[row2] - start; for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; double value = element[i]; int jColumn2 = column[i+offset2]; double value2 = element[i+offset2]; if (value != value2 || mapColumn[jColumn] != jColumn2 || mapColumn[jColumn2] != jColumn) good = false; } } } if (good) { // check rim for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (mapColumn[iColumn] != iColumn) { int iColumn2 = mapColumn[iColumn]; if (objective[iColumn] != objective[iColumn2]) good = false; if (columnLower[iColumn] != columnLower[iColumn2]) good = false; if (columnUpper[iColumn] != columnUpper[iColumn2]) good = false; if (model->isInteger(iColumn) != model->isInteger(iColumn2)) good = false; } } } if (good) { // temp if (nMapRow < 0) { //const double * solution = model->primalColumnSolution(); // find mapped int nMapColumn = 0; for (int i = 0; i < numberColumns; i++) { if (mapColumn[i] > i) nMapColumn++; } nMapRow = 0; int kRow = -1; for (int i = 0; i < numberRows; i++) { if (mapRow[i] > i) { nMapRow++; kRow = i; } } printf("%d columns, %d rows\n", nMapColumn, nMapRow); if (nMapRow == 1) { CoinBigIndex start = rowStart[kRow]; int length = rowLength[kRow]; printf("%g <= ", rowLower[kRow]); for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; if (mapColumn[jColumn] != jColumn) printf("* "); printf("%d,%g ", jColumn, element[i]); } printf("<= %g\n", rowUpper[kRow]); } } // temp int row1 = sortRow[lastLook]; int row2 = sortRow[jLook]; lastLook = jLook; CoinBigIndex start1 = rowStart[row1]; CoinBigIndex offset2 = rowStart[row2] - start1; int length = rowLength[row1]; assert( length == rowLength[row2]); CoinBigIndex put = startAdd[nAddRows]; double multiplier = length < 11 ? 2.0 : 1.125; double value = 1.0; for (CoinBigIndex i = start1; i < start1 + length; i++) { int jColumn1 = column[i]; int jColumn2 = column[i+offset2]; columnAdd[put] = jColumn1; elementAdd[put++] = value; columnAdd[put] = jColumn2; elementAdd[put++] = -value; value *= multiplier; } nAddRows++; startAdd[nAddRows] = put; } else { printf("ouch - did not check out as good\n"); } } } // skip rest iLook += numberPossible - 1; } } } if (nAddRows) { double * lower = new double [nAddRows]; double * upper = new double[nAddRows]; int i; //const double * solution = model->primalColumnSolution(); for (i = 0; i < nAddRows; i++) { lower[i] = 0.0; upper[i] = COIN_DBL_MAX; } printf("Adding %d rows with %d elements\n", nAddRows, startAdd[nAddRows]); //ClpSimplex newModel(*model); //newModel.addRows(nAddRows,lower,upper,startAdd,columnAdd,elementAdd); //newModel.writeMps("modified.mps"); delete [] lower; delete [] upper; } delete [] startAdd; delete [] columnAdd; delete [] elementAdd; delete [] order; delete [] other; delete [] randomColumn; delete [] weight; delete [] randomRow; delete [] sortRow; delete [] backRow; delete [] possibleRow; delete [] sortColumn; delete [] backColumn; delete [] backColumn2; delete [] possibleColumn; delete [] mapRow; delete [] mapColumn; delete [] stackRow; delete [] stackColumn; } delete [] number; // Now do breakdown of ranges breakdown("Elements", numberElements, elementByColumn); breakdown("RowLower", numberRows, rowLower); breakdown("RowUpper", numberRows, rowUpper); breakdown("ColumnLower", numberColumns, columnLower); breakdown("ColumnUpper", numberColumns, columnUpper); breakdown("Objective", numberColumns, objective); } static bool maskMatches(const int * starts, char ** masks, std::string & check) { // back to char as I am old fashioned const char * checkC = check.c_str(); size_t length = strlen(checkC); while (length > 0 && checkC[length-1] == ' ') length--; for (int i = starts[length]; i < starts[length+1]; i++) { char * thisMask = masks[i]; size_t k; for ( k = 0; k < length; k++) { if (thisMask[k] != '?' && thisMask[k] != checkC[k]) break; } if (k == length) return true; } return false; } static void clean(char * temp) { char * put = temp; while (*put >= ' ') put++; *put = '\0'; } static void generateCode(CbcModel * /*model*/, const char * fileName, int type, int preProcess) { // options on code generation bool sizecode = (type & 4) != 0; type &= 3; FILE * fp = fopen(fileName, "r"); assert (fp); int numberLines = 0; #define MAXLINES 5000 #define MAXONELINE 200 char line[MAXLINES][MAXONELINE]; strcpy(line[numberLines++], "0#if defined(_MSC_VER)"); strcpy(line[numberLines++], "0// Turn off compiler warning about long names"); strcpy(line[numberLines++], "0# pragma warning(disable:4786)"); strcpy(line[numberLines++], "0#endif\n"); strcpy(line[numberLines++], "0#include "); strcpy(line[numberLines++], "0#include "); strcpy(line[numberLines++], "0#include \"OsiClpSolverInterface.hpp\""); strcpy(line[numberLines++], "0#include \"CbcModel.hpp\""); strcpy(line[numberLines++], "0#include \"CbcCutGenerator.hpp\""); strcpy(line[numberLines++], "0#include \"CbcStrategy.hpp\""); strcpy(line[numberLines++], "0#include \"CglPreProcess.hpp\""); strcpy(line[numberLines++], "0#include \"CoinTime.hpp\""); if (preProcess > 0) strcpy(line[numberLines++], "0#include \"CglProbing.hpp\""); // possibly redundant // To allow generated 5's to be just before branchAndBound - do rest here strcpy(line[numberLines++], "5 cbcModel->initialSolve();"); strcpy(line[numberLines++], "5 if (clpModel->tightenPrimalBounds()!=0) {"); strcpy(line[numberLines++], "5 std::cout<<\"Problem is infeasible - tightenPrimalBounds!\"<dual(); // clean up"); if (sizecode) { // override some settings strcpy(line[numberLines++], "5 // compute some things using problem size"); strcpy(line[numberLines++], "5 cbcModel->setMinimumDrop(CoinMin(5.0e-2,"); strcpy(line[numberLines++], "5 fabs(cbcModel->getMinimizationObjValue())*1.0e-3+1.0e-4));"); strcpy(line[numberLines++], "5 if (cbcModel->getNumCols()<500)"); strcpy(line[numberLines++], "5 cbcModel->setMaximumCutPassesAtRoot(-100); // always do 100 if possible"); strcpy(line[numberLines++], "5 else if (cbcModel->getNumCols()<5000)"); strcpy(line[numberLines++], "5 cbcModel->setMaximumCutPassesAtRoot(100); // use minimum drop"); strcpy(line[numberLines++], "5 else"); strcpy(line[numberLines++], "5 cbcModel->setMaximumCutPassesAtRoot(20);"); strcpy(line[numberLines++], "5 cbcModel->setMaximumCutPasses(1);"); } if (preProcess <= 0) { // no preprocessing or strategy if (preProcess) { strcpy(line[numberLines++], "5 // Preprocessing using CbcStrategy"); strcpy(line[numberLines++], "5 CbcStrategyDefault strategy(1,5,5);"); strcpy(line[numberLines++], "5 strategy.setupPreProcessing(1);"); strcpy(line[numberLines++], "5 cbcModel->setStrategy(strategy);"); } } else { int translate[] = {9999, 0, 0, -1, 2, 3, -2}; strcpy(line[numberLines++], "5 // Hand coded preprocessing"); strcpy(line[numberLines++], "5 CglPreProcess process;"); strcpy(line[numberLines++], "5 OsiSolverInterface * saveSolver=cbcModel->solver()->clone();"); strcpy(line[numberLines++], "5 // Tell solver we are in Branch and Cut"); strcpy(line[numberLines++], "5 saveSolver->setHintParam(OsiDoInBranchAndCut,true,OsiHintDo) ;"); strcpy(line[numberLines++], "5 // Default set of cut generators"); strcpy(line[numberLines++], "5 CglProbing generator1;"); strcpy(line[numberLines++], "5 generator1.setUsingObjective(1);"); strcpy(line[numberLines++], "5 generator1.setMaxPass(3);"); strcpy(line[numberLines++], "5 generator1.setMaxProbeRoot(saveSolver->getNumCols());"); strcpy(line[numberLines++], "5 generator1.setMaxElements(100);"); strcpy(line[numberLines++], "5 generator1.setMaxLookRoot(50);"); strcpy(line[numberLines++], "5 generator1.setRowCuts(3);"); strcpy(line[numberLines++], "5 // Add in generators"); strcpy(line[numberLines++], "5 process.addCutGenerator(&generator1);"); strcpy(line[numberLines++], "5 process.messageHandler()->setLogLevel(cbcModel->logLevel());"); strcpy(line[numberLines++], "5 OsiSolverInterface * solver2 = "); sprintf(line[numberLines++], "5 process.preProcessNonDefault(*saveSolver,%d,10);", translate[preProcess]); strcpy(line[numberLines++], "5 // Tell solver we are not in Branch and Cut"); strcpy(line[numberLines++], "5 saveSolver->setHintParam(OsiDoInBranchAndCut,false,OsiHintDo) ;"); strcpy(line[numberLines++], "5 if (solver2)"); strcpy(line[numberLines++], "5 solver2->setHintParam(OsiDoInBranchAndCut,false,OsiHintDo) ;"); strcpy(line[numberLines++], "5 if (!solver2) {"); strcpy(line[numberLines++], "5 std::cout<<\"Pre-processing says infeasible!\"<getNumRows()"); strcpy(line[numberLines++], "5 <<\" rows, \"<getNumCols()"); strcpy(line[numberLines++], "5 <<\" columns and \"<getNumElements()"); strcpy(line[numberLines++], "5 <<\" elements\"<getNumElements()<clone();"); strcpy(line[numberLines++], "5 cbcModel->assignSolver(solver2);"); strcpy(line[numberLines++], "5 cbcModel->initialSolve();"); } while (fgets(line[numberLines], MAXONELINE, fp)) { assert (numberLines < MAXLINES); clean(line[numberLines]); numberLines++; } fclose(fp); strcpy(line[numberLines++], "0\nint main (int argc, const char *argv[])\n{"); strcpy(line[numberLines++], "0 OsiClpSolverInterface solver1;"); strcpy(line[numberLines++], "0 int status=1;"); strcpy(line[numberLines++], "0 if (argc<2)"); strcpy(line[numberLines++], "0 std::cout<<\"Please give file name\"< (osiModel);"); strcpy(line[numberLines++], "0 ClpSimplex * clpModel = osiclpModel->getModelPtr();"); // add in comments about messages strcpy(line[numberLines++], "3 // You can save some time by switching off message building"); strcpy(line[numberLines++], "3 // clpModel->messagesPointer()->setDetailMessages(100,10000,(int *) NULL);"); // add in actual solve strcpy(line[numberLines++], "5 cbcModel->branchAndBound();"); strcpy(line[numberLines++], "8 std::cout<getNodeCount()<<\" nodes with objective \""); strcpy(line[numberLines++], "8 <getObjValue()"); strcpy(line[numberLines++], "8 <<(!cbcModel->status() ? \" Finished\" : \" Not finished\")"); strcpy(line[numberLines++], "8 <getMinimizationObjValue()<1.0e50) {"); if (preProcess > 0) { strcpy(line[numberLines++], "5 // post process"); strcpy(line[numberLines++], "5 process.postProcess(*cbcModel->solver());"); strcpy(line[numberLines++], "5 // Solution now back in saveSolver"); strcpy(line[numberLines++], "5 cbcModel->assignSolver(saveSolver);"); strcpy(line[numberLines++], "5 memcpy(cbcModel->bestSolution(),cbcModel->solver()->getColSolution(),"); strcpy(line[numberLines++], "5 numberColumns*sizeof(double));"); } strcpy(line[numberLines++], "5 // put back in original solver"); strcpy(line[numberLines++], "5 solver1.setColSolution(cbcModel->bestSolution());"); strcpy(line[numberLines++], "5 const double * solution = solver1.getColSolution();"); strcpy(line[numberLines++], "8 \n // Now you would use solution etc etc\n"); strcpy(line[numberLines++], "5"); strcpy(line[numberLines++], "5 // Get names from solver1 (as OsiSolverInterface may lose)"); strcpy(line[numberLines++], "5 std::vector columnNames = *solver1.getModelPtr()->columnNames();"); strcpy(line[numberLines++], "5 "); strcpy(line[numberLines++], "5 int iColumn;"); strcpy(line[numberLines++], "5 std::cout<1.0e-7&&solver1.isInteger(iColumn)) "); strcpy(line[numberLines++], "5 std::cout< 0) wanted[1] = wanted[6] = 1; if (type > 1) wanted[2] = wanted[4] = wanted[7] = 1; std::string header[9] = { "", "Save values", "Redundant save of default values", "Set changed values", "Redundant set default values", "Solve", "Restore values", "Redundant restore values", "Finish up" }; for (int iType = 0; iType < 9; iType++) { if (!wanted[iType]) continue; int n = 0; int iLine; for (iLine = 0; iLine < numberLines; iLine++) { if (line[iLine][0] == '0' + iType) { if (!n && header[iType] != "") fprintf(fp, "\n // %s\n\n", header[iType].c_str()); n++; // skip save and clp as cloned if (!strstr(line[iLine], "save") || (!strstr(line[iLine], "clpMo") && !strstr(line[iLine], "_Osi"))) fprintf(fp, "%s\n", line[iLine] + 1); } } } fclose(fp); printf("C++ file written to %s\n", fileName); } // Print a general message static void printGeneralMessage(CbcModel &model,const char * message) { #ifndef DISALLOW_PRINTING model.messageHandler()->message(CBC_FPUMP1, model.messages()) << message << CoinMessageEol; #endif } /* Version 1.00.00 November 16 2005. This is to stop me (JJF) messing about too much. Tuning changes should be noted here. The testing next version may be activated by CBC_NEXT_VERSION This applies to OsiClp, Clp etc Version 1.00.01 November 24 2005 Added several classes for advanced users. This can't affect code (if you don't use it) Made some tiny changes (for N way branching) which should not change anything. CbcNWay object class - for N way branching this also allows use of CbcConsequence class. CbcBranchAllDifferent object class - for branching on general integer variables to stop them having same value so branches are x >= y+1 and x <= y-1. Added two new Cgl classes - CglAllDifferent which does column fixing (too slowly) and CglStored which just has a list of cuts which can be activated. Modified preprocess option to SOS Version 1.00.02 December 9 2005 Added use of CbcStrategy to do clean preprocessing Added use of referenceSolver for cleaner repetition of Cbc Version 1.01.00 February 2 2006 Added first try at Ampl interface Version 1.04 June 2007 Goes parallel Version 2.00 September 2007 Improvements to feaspump Source code changes so up to 2.0 */ CoinMP-1.8.3/Cbc/src/CbcTreeLocal.cpp0000644000175000017500000020251212075572125015570 0ustar renerene/* $Id: CbcTreeLocal.cpp 1839 2013-01-16 18:41:25Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CbcModel.hpp" #include "CbcNode.hpp" #include "CbcTreeLocal.hpp" #include "CoinPackedMatrix.hpp" #include "CoinTime.hpp" #include "OsiRowCutDebugger.hpp" #include #ifdef JJF_ZERO // gdb doesn't always put breakpoints in this virtual function // just stick xxxxxx() where you want to start static void xxxxxx() { printf("break\n"); } #endif CbcTreeLocal::CbcTreeLocal() : localNode_(NULL), bestSolution_(NULL), savedSolution_(NULL), saveNumberSolutions_(0), model_(NULL), originalLower_(NULL), originalUpper_(NULL), range_(0), typeCuts_(-1), maxDiversification_(0), diversification_(0), nextStrong_(false), rhs_(0.0), savedGap_(0.0), bestCutoff_(0.0), timeLimit_(0), startTime_(0), nodeLimit_(0), startNode_(-1), searchType_(-1), refine_(false) { } /* Constructor with solution. range is upper bound on difference from given solution. maxDiversification is maximum number of diversifications to try timeLimit is seconds in subTree nodeLimit is nodes in subTree */ CbcTreeLocal::CbcTreeLocal(CbcModel * model, const double * solution , int range, int typeCuts, int maxDiversification, int timeLimit, int nodeLimit, bool refine) : localNode_(NULL), bestSolution_(NULL), savedSolution_(NULL), saveNumberSolutions_(0), model_(model), originalLower_(NULL), originalUpper_(NULL), range_(range), typeCuts_(typeCuts), maxDiversification_(maxDiversification), diversification_(0), nextStrong_(false), rhs_(0.0), savedGap_(0.0), bestCutoff_(0.0), timeLimit_(timeLimit), startTime_(0), nodeLimit_(nodeLimit), startNode_(-1), searchType_(-1), refine_(refine) { OsiSolverInterface * solver = model_->solver(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); //const double * solution = solver->getColSolution(); //const double * objective = solver->getObjCoefficients(); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); // Get increment model_->analyzeObjective(); { // needed to sync cutoffs double value ; solver->getDblParam(OsiDualObjectiveLimit, value) ; model_->setCutoff(value * solver->getObjSense()); } bestCutoff_ = model_->getCutoff(); // save current gap savedGap_ = model_->getDblParam(CbcModel::CbcAllowableGap); // make sure integers found model_->findIntegers(false); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; double direction = solver->getObjSense(); double newSolutionValue = 1.0e50; if (solution) { // copy solution solver->setColSolution(solution); newSolutionValue = direction * solver->getObjValue(); } originalLower_ = new double [numberIntegers]; originalUpper_ = new double [numberIntegers]; bool all01 = true; int number01 = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; originalLower_[i] = lower[iColumn]; originalUpper_[i] = upper[iColumn]; if (upper[iColumn] - lower[iColumn] > 1.5) all01 = false; else if (upper[iColumn] - lower[iColumn] == 1.0) number01++; } if (all01 && !typeCuts_) typeCuts_ = 1; // may as well so we don't have to deal with refine if (!number01 && !typeCuts_) { if (model_->messageHandler()->logLevel() > 1) printf("** No 0-1 variables and local search only on 0-1 - switching off\n"); typeCuts_ = -1; } else { if (model_->messageHandler()->logLevel() > 1) { std::string type; if (all01) { printf("%d 0-1 variables normal local cuts\n", number01); } else if (typeCuts_) { printf("%d 0-1 variables, %d other - general integer local cuts\n", number01, numberIntegers - number01); } else { printf("%d 0-1 variables, %d other - local cuts but just on 0-1 variables\n", number01, numberIntegers - number01); } printf("maximum diversifications %d, initial cutspace %d, max time %d seconds, max nodes %d\n", maxDiversification_, range_, timeLimit_, nodeLimit_); } } int numberColumns = model_->getNumCols(); savedSolution_ = new double [numberColumns]; memset(savedSolution_, 0, numberColumns*sizeof(double)); if (solution) { rhs_ = range_; // Check feasible int goodSolution = createCut(solution, cut_); if (goodSolution >= 0) { for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = floor(solution[iColumn] + 0.5); // fix so setBestSolution will work solver->setColLower(iColumn, value); solver->setColUpper(iColumn, value); } model_->reserveCurrentSolution(); // Create cut and get total gap if (newSolutionValue < bestCutoff_) { model_->setBestSolution(CBC_ROUNDING, newSolutionValue, solution); bestCutoff_ = model_->getCutoff(); // save as best solution memcpy(savedSolution_, model_->bestSolution(), numberColumns*sizeof(double)); } for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; // restore bounds solver->setColLower(iColumn, originalLower_[i]); solver->setColUpper(iColumn, originalUpper_[i]); } // make sure can't stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, -1.0e50); } else { model_ = NULL; } } else { // no solution rhs_ = 1.0e50; // make sure can't stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, -1.0e50); } } CbcTreeLocal::~CbcTreeLocal() { delete [] originalLower_; delete [] originalUpper_; delete [] bestSolution_; delete [] savedSolution_; delete localNode_; } // Copy constructor CbcTreeLocal::CbcTreeLocal ( const CbcTreeLocal & rhs) : CbcTree(rhs), saveNumberSolutions_(rhs.saveNumberSolutions_), model_(rhs.model_), range_(rhs.range_), typeCuts_(rhs.typeCuts_), maxDiversification_(rhs.maxDiversification_), diversification_(rhs.diversification_), nextStrong_(rhs.nextStrong_), rhs_(rhs.rhs_), savedGap_(rhs.savedGap_), bestCutoff_(rhs.bestCutoff_), timeLimit_(rhs.timeLimit_), startTime_(rhs.startTime_), nodeLimit_(rhs.nodeLimit_), startNode_(rhs.startNode_), searchType_(rhs.searchType_), refine_(rhs.refine_) { cut_ = rhs.cut_; fixedCut_ = rhs.fixedCut_; if (rhs.localNode_) localNode_ = new CbcNode(*rhs.localNode_); else localNode_ = NULL; if (rhs.originalLower_) { int numberIntegers = model_->numberIntegers(); originalLower_ = new double [numberIntegers]; memcpy(originalLower_, rhs.originalLower_, numberIntegers*sizeof(double)); originalUpper_ = new double [numberIntegers]; memcpy(originalUpper_, rhs.originalUpper_, numberIntegers*sizeof(double)); } else { originalLower_ = NULL; originalUpper_ = NULL; } if (rhs.bestSolution_) { int numberColumns = model_->getNumCols(); bestSolution_ = new double [numberColumns]; memcpy(bestSolution_, rhs.bestSolution_, numberColumns*sizeof(double)); } else { bestSolution_ = NULL; } if (rhs.savedSolution_) { int numberColumns = model_->getNumCols(); savedSolution_ = new double [numberColumns]; memcpy(savedSolution_, rhs.savedSolution_, numberColumns*sizeof(double)); } else { savedSolution_ = NULL; } } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcTreeLocal & CbcTreeLocal::operator=(const CbcTreeLocal & rhs) { if (this != &rhs) { CbcTree::operator=(rhs); saveNumberSolutions_ = rhs.saveNumberSolutions_; cut_ = rhs.cut_; fixedCut_ = rhs.fixedCut_; delete localNode_; if (rhs.localNode_) localNode_ = new CbcNode(*rhs.localNode_); else localNode_ = NULL; model_ = rhs.model_; range_ = rhs.range_; typeCuts_ = rhs.typeCuts_; maxDiversification_ = rhs.maxDiversification_; diversification_ = rhs.diversification_; nextStrong_ = rhs.nextStrong_; rhs_ = rhs.rhs_; savedGap_ = rhs.savedGap_; bestCutoff_ = rhs.bestCutoff_; timeLimit_ = rhs.timeLimit_; startTime_ = rhs.startTime_; nodeLimit_ = rhs.nodeLimit_; startNode_ = rhs.startNode_; searchType_ = rhs.searchType_; refine_ = rhs.refine_; delete [] originalLower_; delete [] originalUpper_; if (rhs.originalLower_) { int numberIntegers = model_->numberIntegers(); originalLower_ = new double [numberIntegers]; memcpy(originalLower_, rhs.originalLower_, numberIntegers*sizeof(double)); originalUpper_ = new double [numberIntegers]; memcpy(originalUpper_, rhs.originalUpper_, numberIntegers*sizeof(double)); } else { originalLower_ = NULL; originalUpper_ = NULL; } delete [] bestSolution_; if (rhs.bestSolution_) { int numberColumns = model_->getNumCols(); bestSolution_ = new double [numberColumns]; memcpy(bestSolution_, rhs.bestSolution_, numberColumns*sizeof(double)); } else { bestSolution_ = NULL; } delete [] savedSolution_; if (rhs.savedSolution_) { int numberColumns = model_->getNumCols(); savedSolution_ = new double [numberColumns]; memcpy(savedSolution_, rhs.savedSolution_, numberColumns*sizeof(double)); } else { savedSolution_ = NULL; } } return *this; } // Clone CbcTree * CbcTreeLocal::clone() const { return new CbcTreeLocal(*this); } // Pass in solution (so can be used after heuristic) void CbcTreeLocal::passInSolution(const double * solution, double solutionValue) { int numberColumns = model_->getNumCols(); delete [] savedSolution_; savedSolution_ = new double [numberColumns]; memcpy(savedSolution_, solution, numberColumns*sizeof(double)); rhs_ = range_; // Check feasible int goodSolution = createCut(solution, cut_); if (goodSolution >= 0) { bestCutoff_ = CoinMin(solutionValue, model_->getCutoff()); } else { model_ = NULL; } } // Return the top node of the heap CbcNode * CbcTreeLocal::top() const { #ifdef CBC_DEBUG int smallest = 9999999; int largest = -1; double smallestD = 1.0e30; double largestD = -1.0e30; int n = nodes_.size(); for (int i = 0; i < n; i++) { int nn = nodes_[i]->nodeInfo()->nodeNumber(); double dd = nodes_[i]->objectiveValue(); largest = CoinMax(largest, nn); smallest = CoinMin(smallest, nn); largestD = CoinMax(largestD, dd); smallestD = CoinMin(smallestD, dd); } if (model_->messageHandler()->logLevel() > 1) { printf("smallest %d, largest %d, top %d\n", smallest, largest, nodes_.front()->nodeInfo()->nodeNumber()); printf("smallestD %g, largestD %g, top %g\n", smallestD, largestD, nodes_.front()->objectiveValue()); } #endif return nodes_.front(); } // Add a node to the heap void CbcTreeLocal::push(CbcNode * x) { if (typeCuts_ >= 0 && !nodes_.size() && searchType_ < 0) { startNode_ = model_->getNodeCount(); // save copy of node localNode_ = new CbcNode(*x); if (cut_.row().getNumElements()) { // Add to global cuts // we came in with solution model_->makeGlobalCut(cut_); if (model_->messageHandler()->logLevel() > 1) printf("initial cut - rhs %g %g\n", cut_.lb(), cut_.ub()); searchType_ = 1; } else { // stop on first solution searchType_ = 0; } startTime_ = static_cast (CoinCpuTime()); saveNumberSolutions_ = model_->getSolutionCount(); } nodes_.push_back(x); #ifdef CBC_DEBUG if (model_->messageHandler()->logLevel() > 0) printf("pushing node onto heap %d %x %x\n", x->nodeInfo()->nodeNumber(), x, x->nodeInfo()); #endif std::push_heap(nodes_.begin(), nodes_.end(), comparison_); } // Remove the top node from the heap void CbcTreeLocal::pop() { std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); } // Test if empty - does work if so bool CbcTreeLocal::empty() { if (typeCuts_ < 0) return !nodes_.size(); /* state - 0 iterating 1 subtree finished optimal solution for subtree found 2 subtree finished and no solution found 3 subtree exiting and solution found 4 subtree exiting and no solution found */ int state = 0; assert (searchType_ != 2); if (searchType_) { if (CoinCpuTime() - startTime_ > timeLimit_ || model_->getNodeCount() - startNode_ >= nodeLimit_) { state = 4; } } else { if (model_->getSolutionCount() > saveNumberSolutions_) { state = 4; } } if (!nodes_.size()) state = 2; if (!state) { return false; } // Finished this phase int numberColumns = model_->getNumCols(); if (model_->getSolutionCount() > saveNumberSolutions_) { if (model_->getCutoff() < bestCutoff_) { // Save solution if (!bestSolution_) bestSolution_ = new double [numberColumns]; memcpy(bestSolution_, model_->bestSolution(), numberColumns*sizeof(double)); bestCutoff_ = model_->getCutoff(); } state--; } // get rid of all nodes (safe even if already done) double bestPossibleObjective; cleanTree(model_, -COIN_DBL_MAX, bestPossibleObjective); double increment = model_->getDblParam(CbcModel::CbcCutoffIncrement) ; if (model_->messageHandler()->logLevel() > 1) printf("local state %d after %d nodes and %d seconds, new solution %g, best solution %g, k was %g\n", state, model_->getNodeCount() - startNode_, static_cast (CoinCpuTime()) - startTime_, model_->getCutoff() + increment, bestCutoff_ + increment, rhs_); saveNumberSolutions_ = model_->getSolutionCount(); bool finished = false; bool lastTry = false; switch (state) { case 1: // solution found and subtree exhausted if (rhs_ > 1.0e30) { finished = true; } else { // find global cut and reverse reverseCut(1); searchType_ = 1; // first false rhs_ = range_; // reset range nextStrong_ = false; // save best solution in this subtree memcpy(savedSolution_, model_->bestSolution(), numberColumns*sizeof(double)); } break; case 2: // solution not found and subtree exhausted if (rhs_ > 1.0e30) { finished = true; } else { // find global cut and reverse reverseCut(2); searchType_ = 1; // first false if (diversification_ < maxDiversification_) { if (nextStrong_) { diversification_++; // cut is valid so don't model_->setCutoff(1.0e50); searchType_ = 0; } nextStrong_ = true; rhs_ += range_ / 2; } else { // This will be last try (may hit max time) lastTry = true; if (!maxDiversification_) typeCuts_ = -1; // make sure can't start again model_->setCutoff(bestCutoff_); if (model_->messageHandler()->logLevel() > 1) printf("Exiting local search with current set of cuts\n"); rhs_ = 1.0e100; // Can now stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, savedGap_); } } break; case 3: // solution found and subtree not exhausted if (rhs_ < 1.0e30) { if (searchType_) { if (!typeCuts_ && refine_ && searchType_ == 1) { // We need to check we have best solution given these 0-1 values OsiSolverInterface * subSolver = model_->continuousSolver()->clone(); CbcModel * subModel = model_->subTreeModel(subSolver); CbcTree normalTree; subModel->passInTreeHandler(normalTree); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); const double * solution = model_->bestSolution(); int i; int numberColumns = model_->getNumCols(); for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = floor(solution[iColumn] + 0.5); if (!typeCuts_ && originalUpper_[i] - originalLower_[i] > 1.0) continue; // skip as not 0-1 if (originalLower_[i] == originalUpper_[i]) continue; subSolver->setColLower(iColumn, value); subSolver->setColUpper(iColumn, value); } subSolver->initialSolve(); // We can copy cutoff // But adjust subModel->setCutoff(model_->getCutoff() + model_->getDblParam(CbcModel::CbcCutoffIncrement) + 1.0e-6); subModel->setSolutionCount(0); assert (subModel->isProvenOptimal()); if (!subModel->typePresolve()) { subModel->branchAndBound(); if (subModel->status()) { model_->incrementSubTreeStopped(); } //printf("%g %g %g %g\n",subModel->getCutoff(),model_->getCutoff(), // subModel->getMinimizationObjValue(),model_->getMinimizationObjValue()); double newCutoff = subModel->getMinimizationObjValue() - subModel->getDblParam(CbcModel::CbcCutoffIncrement) ; if (subModel->getSolutionCount()) { if (!subModel->status()) assert (subModel->isProvenOptimal()); memcpy(model_->bestSolution(), subModel->bestSolution(), numberColumns*sizeof(double)); model_->setCutoff(newCutoff); } } else if (subModel->typePresolve() == 1) { CbcModel * model2 = subModel->integerPresolve(true); if (model2) { // Do complete search model2->branchAndBound(); // get back solution subModel->originalModel(model2, false); if (model2->status()) { model_->incrementSubTreeStopped(); } double newCutoff = model2->getMinimizationObjValue() - model2->getDblParam(CbcModel::CbcCutoffIncrement) ; if (model2->getSolutionCount()) { if (!model2->status()) assert (model2->isProvenOptimal()); memcpy(model_->bestSolution(), subModel->bestSolution(), numberColumns*sizeof(double)); model_->setCutoff(newCutoff); } delete model2; } else { // infeasible - could just be - due to cutoff } } else { // too dangerous at present assert (subModel->typePresolve() != 2); } if (model_->getCutoff() < bestCutoff_) { // Save solution if (!bestSolution_) bestSolution_ = new double [numberColumns]; memcpy(bestSolution_, model_->bestSolution(), numberColumns*sizeof(double)); bestCutoff_ = model_->getCutoff(); } delete subModel; } // we have done search to make sure best general solution searchType_ = 1; // Reverse cut weakly reverseCut(3, rhs_); } else { searchType_ = 1; // delete last cut deleteCut(cut_); } } else { searchType_ = 1; } // save best solution in this subtree memcpy(savedSolution_, model_->bestSolution(), numberColumns*sizeof(double)); nextStrong_ = false; rhs_ = range_; break; case 4: // solution not found and subtree not exhausted if (maxDiversification_) { if (nextStrong_) { // Reverse cut weakly reverseCut(4, rhs_); model_->setCutoff(1.0e50); diversification_++; searchType_ = 0; } else { // delete last cut deleteCut(cut_); searchType_ = 1; } nextStrong_ = true; rhs_ += range_ / 2; } else { // special case when using as heuristic // Reverse cut weakly if lb -infinity reverseCut(4, rhs_); // This will be last try (may hit max time0 lastTry = true; model_->setCutoff(bestCutoff_); if (model_->messageHandler()->logLevel() > 1) printf("Exiting local search with current set of cuts\n"); rhs_ = 1.0e100; // Can now stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, savedGap_); typeCuts_ = -1; } break; } if (rhs_ < 1.0e30 || lastTry) { int goodSolution = createCut(savedSolution_, cut_); if (goodSolution >= 0) { // Add to global cuts model_->makeGlobalCut(cut_); CbcRowCuts * global = model_->globalCuts(); int n = global->sizeRowCuts(); OsiRowCut * rowCut = global->rowCutPtr(n - 1); if (model_->messageHandler()->logLevel() > 1) printf("inserting cut - now %d cuts, rhs %g %g, cutspace %g, diversification %d\n", n, rowCut->lb(), rowCut->ub(), rhs_, diversification_); const OsiRowCutDebugger *debugger = model_->solver()->getRowCutDebuggerAlways() ; if (debugger) { if (debugger->invalidCut(*rowCut)) printf("ZZZZTree Global cut - cuts off optimal solution!\n"); } for (int i = 0; i < n; i++) { rowCut = global->rowCutPtr(i); if (model_->messageHandler()->logLevel() > 0) printf("%d - rhs %g %g\n", i, rowCut->lb(), rowCut->ub()); } } // put back node startTime_ = static_cast (CoinCpuTime()); startNode_ = model_->getNodeCount(); if (localNode_) { // save copy of node CbcNode * localNode2 = new CbcNode(*localNode_); // But localNode2 now owns cuts so swap //printf("pushing local node2 onto heap %d %x %x\n",localNode_->nodeNumber(), // localNode_,localNode_->nodeInfo()); nodes_.push_back(localNode_); localNode_ = localNode2; std::make_heap(nodes_.begin(), nodes_.end(), comparison_); } } return finished; } // We may have got an intelligent tree so give it one more chance void CbcTreeLocal::endSearch() { if (typeCuts_ >= 0) { // copy best solution to model int numberColumns = model_->getNumCols(); if (bestSolution_ && bestCutoff_ < model_->getCutoff()) { memcpy(model_->bestSolution(), bestSolution_, numberColumns*sizeof(double)); model_->setCutoff(bestCutoff_); // recompute objective value const double * objCoef = model_->getObjCoefficients(); double objOffset = 0.0; model_->continuousSolver()->getDblParam(OsiObjOffset, objOffset); // Compute dot product of objCoef and colSol and then adjust by offset double objValue = -objOffset; for ( int i = 0 ; i < numberColumns ; i++ ) objValue += objCoef[i] * bestSolution_[i]; model_->setMinimizationObjValue(objValue); } // Can now stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, savedGap_); } } // Create cut int CbcTreeLocal::createCut(const double * solution, OsiRowCut & rowCut) { if (rhs_ > 1.0e20) return -1; OsiSolverInterface * solver = model_->solver(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); //const double * solution = solver->getColSolution(); //const double * objective = solver->getObjCoefficients(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); // relax primalTolerance *= 1000.0; int numberRows = model_->getNumRows(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; // Check feasible double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); solver->getMatrixByCol()->times(solution, rowActivity) ; int goodSolution = 0; // check was feasible for (i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i] - primalTolerance) { goodSolution = -1; } else if (rowActivity[i] > rowUpper[i] + primalTolerance) { goodSolution = -1; } } delete [] rowActivity; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = solution[iColumn]; if (fabs(floor(value + 0.5) - value) > integerTolerance) { goodSolution = -1; } } // zap cut if (goodSolution == 0) { // Create cut and get total gap CoinPackedVector cut; double rhs = rhs_; double maxValue = 0.0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = floor(solution[iColumn] + 0.5); /* typeCuts_ == 0 restricts to binary, 1 allows general integer. But we're still restricted to being up against a bound. Consider: the notion is that the cut restricts us to a k-neighbourhood. For binary variables, this amounts to k variables which change value. For general integer, we could end up with a single variable sucking up all of k (hence mu --- the variable must swing to its other bound to look like a movement of 1). For variables in the middle of a range, we're talking about fabs(sol - x). */ if (!typeCuts_ && originalUpper_[i] - originalLower_[i] > 1.0) continue; // skip as not 0-1 if (originalLower_[i] == originalUpper_[i]) continue; double mu = 1.0 / (originalUpper_[i] - originalLower_[i]); if (value == originalLower_[i]) { rhs += mu * originalLower_[i]; cut.insert(iColumn, 1.0); maxValue += originalUpper_[i]; } else if (value == originalUpper_[i]) { rhs -= mu * originalUpper_[i]; cut.insert(iColumn, -1.0); maxValue += originalLower_[i]; } } if (maxValue < rhs - primalTolerance) { if (model_->messageHandler()->logLevel() > 1) printf("slack cut\n"); goodSolution = 1; } rowCut.setRow(cut); rowCut.setLb(-COIN_DBL_MAX); rowCut.setUb(rhs); rowCut.setGloballyValid(); if (model_->messageHandler()->logLevel() > 1) printf("Cut size: %i Cut rhs: %g\n", cut.getNumElements(), rhs); #ifdef CBC_DEBUG if (model_->messageHandler()->logLevel() > 0) { int k; for (k = 0; k < cut.getNumElements(); k++) { printf("%i %g ", cut.getIndices()[k], cut.getElements()[k]); if ((k + 1) % 5 == 0) printf("\n"); } if (k % 5 != 0) printf("\n"); } #endif return goodSolution; } else { if (model_->messageHandler()->logLevel() > 1) printf("Not a good solution\n"); return -1; } } // Other side of last cut branch void CbcTreeLocal::reverseCut(int state, double bias) { // find global cut CbcRowCuts * global = model_->globalCuts(); int n = global->sizeRowCuts(); int i; OsiRowCut * rowCut = NULL; for ( i = 0; i < n; i++) { rowCut = global->rowCutPtr(i); if (cut_ == *rowCut) { break; } } if (!rowCut) { // must have got here in odd way e.g. strong branching return; } if (rowCut->lb() > -1.0e10) return; // get smallest element double smallest = COIN_DBL_MAX; CoinPackedVector row = cut_.row(); for (int k = 0; k < row.getNumElements(); k++) smallest = CoinMin(smallest, fabs(row.getElements()[k])); if (!typeCuts_ && !refine_) { // Reverse cut very very weakly if (state > 2) smallest = 0.0; } // replace by other way if (model_->messageHandler()->logLevel() > 1) printf("reverseCut - changing cut %d out of %d, old rhs %g %g ", i, n, rowCut->lb(), rowCut->ub()); rowCut->setLb(rowCut->ub() + smallest - bias); rowCut->setUb(COIN_DBL_MAX); if (model_->messageHandler()->logLevel() > 1) printf("new rhs %g %g, bias %g smallest %g ", rowCut->lb(), rowCut->ub(), bias, smallest); const OsiRowCutDebugger *debugger = model_->solver()->getRowCutDebuggerAlways() ; if (debugger) { if (debugger->invalidCut(*rowCut)) printf("ZZZZTree Global cut - cuts off optimal solution!\n"); } } // Delete last cut branch void CbcTreeLocal::deleteCut(OsiRowCut & cut) { // find global cut CbcRowCuts * global = model_->globalCuts(); int n = global->sizeRowCuts(); int i; OsiRowCut * rowCut = NULL; for ( i = 0; i < n; i++) { rowCut = global->rowCutPtr(i); if (cut == *rowCut) { break; } } assert (i < n); // delete last cut if (model_->messageHandler()->logLevel() > 1) printf("deleteCut - deleting cut %d out of %d, rhs %g %g\n", i, n, rowCut->lb(), rowCut->ub()); global->eraseRowCut(i); } // Create C++ lines to get to current state void CbcTreeLocal::generateCpp( FILE * fp) { CbcTreeLocal other; fprintf(fp, "0#include \"CbcTreeLocal.hpp\"\n"); fprintf(fp, "5 CbcTreeLocal localTree(cbcModel,NULL);\n"); if (range_ != other.range_) fprintf(fp, "5 localTree.setRange(%d);\n", range_); if (typeCuts_ != other.typeCuts_) fprintf(fp, "5 localTree.setTypeCuts(%d);\n", typeCuts_); if (maxDiversification_ != other.maxDiversification_) fprintf(fp, "5 localTree.setMaxDiversification(%d);\n", maxDiversification_); if (timeLimit_ != other.timeLimit_) fprintf(fp, "5 localTree.setTimeLimit(%d);\n", timeLimit_); if (nodeLimit_ != other.nodeLimit_) fprintf(fp, "5 localTree.setNodeLimit(%d);\n", nodeLimit_); if (refine_ != other.refine_) fprintf(fp, "5 localTree.setRefine(%s);\n", refine_ ? "true" : "false"); fprintf(fp, "5 cbcModel->passInTreeHandler(localTree);\n"); } CbcTreeVariable::CbcTreeVariable() : localNode_(NULL), bestSolution_(NULL), savedSolution_(NULL), saveNumberSolutions_(0), model_(NULL), originalLower_(NULL), originalUpper_(NULL), range_(0), typeCuts_(-1), maxDiversification_(0), diversification_(0), nextStrong_(false), rhs_(0.0), savedGap_(0.0), bestCutoff_(0.0), timeLimit_(0), startTime_(0), nodeLimit_(0), startNode_(-1), searchType_(-1), refine_(false) { } /* Constructor with solution. range is upper bound on difference from given solution. maxDiversification is maximum number of diversifications to try timeLimit is seconds in subTree nodeLimit is nodes in subTree */ CbcTreeVariable::CbcTreeVariable(CbcModel * model, const double * solution , int range, int typeCuts, int maxDiversification, int timeLimit, int nodeLimit, bool refine) : localNode_(NULL), bestSolution_(NULL), savedSolution_(NULL), saveNumberSolutions_(0), model_(model), originalLower_(NULL), originalUpper_(NULL), range_(range), typeCuts_(typeCuts), maxDiversification_(maxDiversification), diversification_(0), nextStrong_(false), rhs_(0.0), savedGap_(0.0), bestCutoff_(0.0), timeLimit_(timeLimit), startTime_(0), nodeLimit_(nodeLimit), startNode_(-1), searchType_(-1), refine_(refine) { OsiSolverInterface * solver = model_->solver(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); //const double * solution = solver->getColSolution(); //const double * objective = solver->getObjCoefficients(); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); // Get increment model_->analyzeObjective(); { // needed to sync cutoffs double value ; solver->getDblParam(OsiDualObjectiveLimit, value) ; model_->setCutoff(value * solver->getObjSense()); } bestCutoff_ = model_->getCutoff(); // save current gap savedGap_ = model_->getDblParam(CbcModel::CbcAllowableGap); // make sure integers found model_->findIntegers(false); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; double direction = solver->getObjSense(); double newSolutionValue = 1.0e50; if (solution) { // copy solution solver->setColSolution(solution); newSolutionValue = direction * solver->getObjValue(); } originalLower_ = new double [numberIntegers]; originalUpper_ = new double [numberIntegers]; bool all01 = true; int number01 = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; originalLower_[i] = lower[iColumn]; originalUpper_[i] = upper[iColumn]; if (upper[iColumn] - lower[iColumn] > 1.5) all01 = false; else if (upper[iColumn] - lower[iColumn] == 1.0) number01++; } if (all01 && !typeCuts_) typeCuts_ = 1; // may as well so we don't have to deal with refine if (!number01 && !typeCuts_) { if (model_->messageHandler()->logLevel() > 1) printf("** No 0-1 variables and local search only on 0-1 - switching off\n"); typeCuts_ = -1; } else { if (model_->messageHandler()->logLevel() > 1) { std::string type; if (all01) { printf("%d 0-1 variables normal local cuts\n", number01); } else if (typeCuts_) { printf("%d 0-1 variables, %d other - general integer local cuts\n", number01, numberIntegers - number01); } else { printf("%d 0-1 variables, %d other - local cuts but just on 0-1 variables\n", number01, numberIntegers - number01); } printf("maximum diversifications %d, initial cutspace %d, max time %d seconds, max nodes %d\n", maxDiversification_, range_, timeLimit_, nodeLimit_); } } int numberColumns = model_->getNumCols(); savedSolution_ = new double [numberColumns]; memset(savedSolution_, 0, numberColumns*sizeof(double)); if (solution) { rhs_ = range_; // Check feasible int goodSolution = createCut(solution, cut_); if (goodSolution >= 0) { for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = floor(solution[iColumn] + 0.5); // fix so setBestSolution will work solver->setColLower(iColumn, value); solver->setColUpper(iColumn, value); } model_->reserveCurrentSolution(); // Create cut and get total gap if (newSolutionValue < bestCutoff_) { model_->setBestSolution(CBC_ROUNDING, newSolutionValue, solution); bestCutoff_ = model_->getCutoff(); // save as best solution memcpy(savedSolution_, model_->bestSolution(), numberColumns*sizeof(double)); } for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; // restore bounds solver->setColLower(iColumn, originalLower_[i]); solver->setColUpper(iColumn, originalUpper_[i]); } // make sure can't stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, -1.0e50); } else { model_ = NULL; } } else { // no solution rhs_ = 1.0e50; // make sure can't stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, -1.0e50); } } CbcTreeVariable::~CbcTreeVariable() { delete [] originalLower_; delete [] originalUpper_; delete [] bestSolution_; delete [] savedSolution_; delete localNode_; } // Copy constructor CbcTreeVariable::CbcTreeVariable ( const CbcTreeVariable & rhs) : CbcTree(rhs), saveNumberSolutions_(rhs.saveNumberSolutions_), model_(rhs.model_), range_(rhs.range_), typeCuts_(rhs.typeCuts_), maxDiversification_(rhs.maxDiversification_), diversification_(rhs.diversification_), nextStrong_(rhs.nextStrong_), rhs_(rhs.rhs_), savedGap_(rhs.savedGap_), bestCutoff_(rhs.bestCutoff_), timeLimit_(rhs.timeLimit_), startTime_(rhs.startTime_), nodeLimit_(rhs.nodeLimit_), startNode_(rhs.startNode_), searchType_(rhs.searchType_), refine_(rhs.refine_) { cut_ = rhs.cut_; fixedCut_ = rhs.fixedCut_; if (rhs.localNode_) localNode_ = new CbcNode(*rhs.localNode_); else localNode_ = NULL; if (rhs.originalLower_) { int numberIntegers = model_->numberIntegers(); originalLower_ = new double [numberIntegers]; memcpy(originalLower_, rhs.originalLower_, numberIntegers*sizeof(double)); originalUpper_ = new double [numberIntegers]; memcpy(originalUpper_, rhs.originalUpper_, numberIntegers*sizeof(double)); } else { originalLower_ = NULL; originalUpper_ = NULL; } if (rhs.bestSolution_) { int numberColumns = model_->getNumCols(); bestSolution_ = new double [numberColumns]; memcpy(bestSolution_, rhs.bestSolution_, numberColumns*sizeof(double)); } else { bestSolution_ = NULL; } if (rhs.savedSolution_) { int numberColumns = model_->getNumCols(); savedSolution_ = new double [numberColumns]; memcpy(savedSolution_, rhs.savedSolution_, numberColumns*sizeof(double)); } else { savedSolution_ = NULL; } } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcTreeVariable & CbcTreeVariable::operator=(const CbcTreeVariable & rhs) { if (this != &rhs) { CbcTree::operator=(rhs); saveNumberSolutions_ = rhs.saveNumberSolutions_; cut_ = rhs.cut_; fixedCut_ = rhs.fixedCut_; delete localNode_; if (rhs.localNode_) localNode_ = new CbcNode(*rhs.localNode_); else localNode_ = NULL; model_ = rhs.model_; range_ = rhs.range_; typeCuts_ = rhs.typeCuts_; maxDiversification_ = rhs.maxDiversification_; diversification_ = rhs.diversification_; nextStrong_ = rhs.nextStrong_; rhs_ = rhs.rhs_; savedGap_ = rhs.savedGap_; bestCutoff_ = rhs.bestCutoff_; timeLimit_ = rhs.timeLimit_; startTime_ = rhs.startTime_; nodeLimit_ = rhs.nodeLimit_; startNode_ = rhs.startNode_; searchType_ = rhs.searchType_; refine_ = rhs.refine_; delete [] originalLower_; delete [] originalUpper_; if (rhs.originalLower_) { int numberIntegers = model_->numberIntegers(); originalLower_ = new double [numberIntegers]; memcpy(originalLower_, rhs.originalLower_, numberIntegers*sizeof(double)); originalUpper_ = new double [numberIntegers]; memcpy(originalUpper_, rhs.originalUpper_, numberIntegers*sizeof(double)); } else { originalLower_ = NULL; originalUpper_ = NULL; } delete [] bestSolution_; if (rhs.bestSolution_) { int numberColumns = model_->getNumCols(); bestSolution_ = new double [numberColumns]; memcpy(bestSolution_, rhs.bestSolution_, numberColumns*sizeof(double)); } else { bestSolution_ = NULL; } delete [] savedSolution_; if (rhs.savedSolution_) { int numberColumns = model_->getNumCols(); savedSolution_ = new double [numberColumns]; memcpy(savedSolution_, rhs.savedSolution_, numberColumns*sizeof(double)); } else { savedSolution_ = NULL; } } return *this; } // Clone CbcTree * CbcTreeVariable::clone() const { return new CbcTreeVariable(*this); } // Pass in solution (so can be used after heuristic) void CbcTreeVariable::passInSolution(const double * solution, double solutionValue) { int numberColumns = model_->getNumCols(); delete [] savedSolution_; savedSolution_ = new double [numberColumns]; memcpy(savedSolution_, solution, numberColumns*sizeof(double)); rhs_ = range_; // Check feasible int goodSolution = createCut(solution, cut_); if (goodSolution >= 0) { bestCutoff_ = CoinMin(solutionValue, model_->getCutoff()); } else { model_ = NULL; } } // Return the top node of the heap CbcNode * CbcTreeVariable::top() const { #ifdef CBC_DEBUG int smallest = 9999999; int largest = -1; double smallestD = 1.0e30; double largestD = -1.0e30; int n = nodes_.size(); for (int i = 0; i < n; i++) { int nn = nodes_[i]->nodeInfo()->nodeNumber(); double dd = nodes_[i]->objectiveValue(); largest = CoinMax(largest, nn); smallest = CoinMin(smallest, nn); largestD = CoinMax(largestD, dd); smallestD = CoinMin(smallestD, dd); } if (model_->messageHandler()->logLevel() > 1) { printf("smallest %d, largest %d, top %d\n", smallest, largest, nodes_.front()->nodeInfo()->nodeNumber()); printf("smallestD %g, largestD %g, top %g\n", smallestD, largestD, nodes_.front()->objectiveValue()); } #endif return nodes_.front(); } // Add a node to the heap void CbcTreeVariable::push(CbcNode * x) { if (typeCuts_ >= 0 && !nodes_.size() && searchType_ < 0) { startNode_ = model_->getNodeCount(); // save copy of node localNode_ = new CbcNode(*x); if (cut_.row().getNumElements()) { // Add to global cuts // we came in with solution model_->makeGlobalCut(cut_); if (model_->messageHandler()->logLevel() > 1) printf("initial cut - rhs %g %g\n", cut_.lb(), cut_.ub()); searchType_ = 1; } else { // stop on first solution searchType_ = 0; } startTime_ = static_cast (CoinCpuTime()); saveNumberSolutions_ = model_->getSolutionCount(); } nodes_.push_back(x); #ifdef CBC_DEBUG if (model_->messageHandler()->logLevel() > 0) printf("pushing node onto heap %d %x %x\n", x->nodeInfo()->nodeNumber(), x, x->nodeInfo()); #endif std::push_heap(nodes_.begin(), nodes_.end(), comparison_); } // Remove the top node from the heap void CbcTreeVariable::pop() { std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); } // Test if empty - does work if so bool CbcTreeVariable::empty() { if (typeCuts_ < 0) return !nodes_.size(); /* state - 0 iterating 1 subtree finished optimal solution for subtree found 2 subtree finished and no solution found 3 subtree exiting and solution found 4 subtree exiting and no solution found */ int state = 0; assert (searchType_ != 2); if (searchType_) { if (CoinCpuTime() - startTime_ > timeLimit_ || model_->getNodeCount() - startNode_ >= nodeLimit_) { state = 4; } } else { if (model_->getSolutionCount() > saveNumberSolutions_) { state = 4; } } if (!nodes_.size()) state = 2; if (!state) { return false; } // Finished this phase int numberColumns = model_->getNumCols(); if (model_->getSolutionCount() > saveNumberSolutions_) { if (model_->getCutoff() < bestCutoff_) { // Save solution if (!bestSolution_) bestSolution_ = new double [numberColumns]; memcpy(bestSolution_, model_->bestSolution(), numberColumns*sizeof(double)); bestCutoff_ = model_->getCutoff(); } state--; } // get rid of all nodes (safe even if already done) double bestPossibleObjective; cleanTree(model_, -COIN_DBL_MAX, bestPossibleObjective); double increment = model_->getDblParam(CbcModel::CbcCutoffIncrement) ; if (model_->messageHandler()->logLevel() > 1) printf("local state %d after %d nodes and %d seconds, new solution %g, best solution %g, k was %g\n", state, model_->getNodeCount() - startNode_, static_cast (CoinCpuTime()) - startTime_, model_->getCutoff() + increment, bestCutoff_ + increment, rhs_); saveNumberSolutions_ = model_->getSolutionCount(); bool finished = false; bool lastTry = false; switch (state) { case 1: // solution found and subtree exhausted if (rhs_ > 1.0e30) { finished = true; } else { // find global cut and reverse reverseCut(1); searchType_ = 1; // first false rhs_ = range_; // reset range nextStrong_ = false; // save best solution in this subtree memcpy(savedSolution_, model_->bestSolution(), numberColumns*sizeof(double)); } break; case 2: // solution not found and subtree exhausted if (rhs_ > 1.0e30) { finished = true; } else { // find global cut and reverse reverseCut(2); searchType_ = 1; // first false if (diversification_ < maxDiversification_) { if (nextStrong_) { diversification_++; // cut is valid so don't model_->setCutoff(1.0e50); searchType_ = 0; } nextStrong_ = true; rhs_ += range_ / 2; } else { // This will be last try (may hit max time) lastTry = true; if (!maxDiversification_) typeCuts_ = -1; // make sure can't start again model_->setCutoff(bestCutoff_); if (model_->messageHandler()->logLevel() > 1) printf("Exiting local search with current set of cuts\n"); rhs_ = 1.0e100; // Can now stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, savedGap_); } } break; case 3: // solution found and subtree not exhausted if (rhs_ < 1.0e30) { if (searchType_) { if (!typeCuts_ && refine_ && searchType_ == 1) { // We need to check we have best solution given these 0-1 values OsiSolverInterface * subSolver = model_->continuousSolver()->clone(); CbcModel * subModel = model_->subTreeModel(subSolver); CbcTree normalTree; subModel->passInTreeHandler(normalTree); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); const double * solution = model_->bestSolution(); int i; int numberColumns = model_->getNumCols(); for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = floor(solution[iColumn] + 0.5); if (!typeCuts_ && originalUpper_[i] - originalLower_[i] > 1.0) continue; // skip as not 0-1 if (originalLower_[i] == originalUpper_[i]) continue; subSolver->setColLower(iColumn, value); subSolver->setColUpper(iColumn, value); } subSolver->initialSolve(); // We can copy cutoff // But adjust subModel->setCutoff(model_->getCutoff() + model_->getDblParam(CbcModel::CbcCutoffIncrement) + 1.0e-6); subModel->setSolutionCount(0); assert (subModel->isProvenOptimal()); if (!subModel->typePresolve()) { subModel->branchAndBound(); if (subModel->status()) { model_->incrementSubTreeStopped(); } //printf("%g %g %g %g\n",subModel->getCutoff(),model_->getCutoff(), // subModel->getMinimizationObjValue(),model_->getMinimizationObjValue()); double newCutoff = subModel->getMinimizationObjValue() - subModel->getDblParam(CbcModel::CbcCutoffIncrement) ; if (subModel->getSolutionCount()) { if (!subModel->status()) assert (subModel->isProvenOptimal()); memcpy(model_->bestSolution(), subModel->bestSolution(), numberColumns*sizeof(double)); model_->setCutoff(newCutoff); } } else if (subModel->typePresolve() == 1) { CbcModel * model2 = subModel->integerPresolve(true); if (model2) { // Do complete search model2->branchAndBound(); // get back solution subModel->originalModel(model2, false); if (model2->status()) { model_->incrementSubTreeStopped(); } double newCutoff = model2->getMinimizationObjValue() - model2->getDblParam(CbcModel::CbcCutoffIncrement) ; if (model2->getSolutionCount()) { if (!model2->status()) assert (model2->isProvenOptimal()); memcpy(model_->bestSolution(), subModel->bestSolution(), numberColumns*sizeof(double)); model_->setCutoff(newCutoff); } delete model2; } else { // infeasible - could just be - due to cutoff } } else { // too dangerous at present assert (subModel->typePresolve() != 2); } if (model_->getCutoff() < bestCutoff_) { // Save solution if (!bestSolution_) bestSolution_ = new double [numberColumns]; memcpy(bestSolution_, model_->bestSolution(), numberColumns*sizeof(double)); bestCutoff_ = model_->getCutoff(); } delete subModel; } // we have done search to make sure best general solution searchType_ = 1; // Reverse cut weakly reverseCut(3, rhs_); } else { searchType_ = 1; // delete last cut deleteCut(cut_); } } else { searchType_ = 1; } // save best solution in this subtree memcpy(savedSolution_, model_->bestSolution(), numberColumns*sizeof(double)); nextStrong_ = false; rhs_ = range_; break; case 4: // solution not found and subtree not exhausted if (maxDiversification_) { if (nextStrong_) { // Reverse cut weakly reverseCut(4, rhs_); model_->setCutoff(1.0e50); diversification_++; searchType_ = 0; } else { // delete last cut deleteCut(cut_); searchType_ = 1; } nextStrong_ = true; rhs_ += range_ / 2; } else { // special case when using as heuristic // Reverse cut weakly if lb -infinity reverseCut(4, rhs_); // This will be last try (may hit max time0 lastTry = true; model_->setCutoff(bestCutoff_); if (model_->messageHandler()->logLevel() > 1) printf("Exiting local search with current set of cuts\n"); rhs_ = 1.0e100; // Can now stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, savedGap_); typeCuts_ = -1; } break; } if (rhs_ < 1.0e30 || lastTry) { int goodSolution = createCut(savedSolution_, cut_); if (goodSolution >= 0) { // Add to global cuts model_->makeGlobalCut(cut_); CbcRowCuts * global = model_->globalCuts(); int n = global->sizeRowCuts(); OsiRowCut * rowCut = global->rowCutPtr(n - 1); if (model_->messageHandler()->logLevel() > 1) printf("inserting cut - now %d cuts, rhs %g %g, cutspace %g, diversification %d\n", n, rowCut->lb(), rowCut->ub(), rhs_, diversification_); const OsiRowCutDebugger *debugger = model_->solver()->getRowCutDebuggerAlways() ; if (debugger) { if (debugger->invalidCut(*rowCut)) printf("ZZZZTree Global cut - cuts off optimal solution!\n"); } for (int i = 0; i < n; i++) { rowCut = global->rowCutPtr(i); if (model_->messageHandler()->logLevel() > 1) printf("%d - rhs %g %g\n", i, rowCut->lb(), rowCut->ub()); } } // put back node startTime_ = static_cast (CoinCpuTime()); startNode_ = model_->getNodeCount(); if (localNode_) { // save copy of node CbcNode * localNode2 = new CbcNode(*localNode_); // But localNode2 now owns cuts so swap //printf("pushing local node2 onto heap %d %x %x\n",localNode_->nodeNumber(), // localNode_,localNode_->nodeInfo()); nodes_.push_back(localNode_); localNode_ = localNode2; std::make_heap(nodes_.begin(), nodes_.end(), comparison_); } } return finished; } // We may have got an intelligent tree so give it one more chance void CbcTreeVariable::endSearch() { if (typeCuts_ >= 0) { // copy best solution to model int numberColumns = model_->getNumCols(); if (bestSolution_ && bestCutoff_ < model_->getCutoff()) { memcpy(model_->bestSolution(), bestSolution_, numberColumns*sizeof(double)); model_->setCutoff(bestCutoff_); // recompute objective value const double * objCoef = model_->getObjCoefficients(); double objOffset = 0.0; model_->continuousSolver()->getDblParam(OsiObjOffset, objOffset); // Compute dot product of objCoef and colSol and then adjust by offset double objValue = -objOffset; for ( int i = 0 ; i < numberColumns ; i++ ) objValue += objCoef[i] * bestSolution_[i]; model_->setMinimizationObjValue(objValue); } // Can now stop on gap model_->setDblParam(CbcModel::CbcAllowableGap, savedGap_); } } // Create cut int CbcTreeVariable::createCut(const double * solution, OsiRowCut & rowCut) { if (rhs_ > 1.0e20) return -1; OsiSolverInterface * solver = model_->solver(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); //const double * solution = solver->getColSolution(); //const double * objective = solver->getObjCoefficients(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); // relax primalTolerance *= 1000.0; int numberRows = model_->getNumRows(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; // Check feasible double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); solver->getMatrixByCol()->times(solution, rowActivity) ; int goodSolution = 0; // check was feasible for (i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i] - primalTolerance) { goodSolution = -1; } else if (rowActivity[i] > rowUpper[i] + primalTolerance) { goodSolution = -1; } } delete [] rowActivity; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = solution[iColumn]; if (fabs(floor(value + 0.5) - value) > integerTolerance) { goodSolution = -1; } } // zap cut if (goodSolution == 0) { // Create cut and get total gap CoinPackedVector cut; double rhs = rhs_; double maxValue = 0.0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = floor(solution[iColumn] + 0.5); if (!typeCuts_ && originalUpper_[i] - originalLower_[i] > 1.0) continue; // skip as not 0-1 if (originalLower_[i] == originalUpper_[i]) continue; double mu = 1.0 / (originalUpper_[i] - originalLower_[i]); if (value == originalLower_[i]) { rhs += mu * originalLower_[i]; cut.insert(iColumn, 1.0); maxValue += originalUpper_[i]; } else if (value == originalUpper_[i]) { rhs -= mu * originalUpper_[i]; cut.insert(iColumn, -1.0); maxValue += originalLower_[i]; } } if (maxValue < rhs - primalTolerance) { if (model_->messageHandler()->logLevel() > 1) printf("slack cut\n"); goodSolution = 1; } rowCut.setRow(cut); rowCut.setLb(-COIN_DBL_MAX); rowCut.setUb(rhs); rowCut.setGloballyValid(); if (model_->messageHandler()->logLevel() > 1) printf("Cut size: %i Cut rhs: %g\n", cut.getNumElements(), rhs); #ifdef CBC_DEBUG if (model_->messageHandler()->logLevel() > 0) { int k; for (k = 0; k < cut.getNumElements(); k++) { printf("%i %g ", cut.getIndices()[k], cut.getElements()[k]); if ((k + 1) % 5 == 0) printf("\n"); } if (k % 5 != 0) printf("\n"); } #endif return goodSolution; } else { if (model_->messageHandler()->logLevel() > 1) printf("Not a good solution\n"); return -1; } } // Other side of last cut branch void CbcTreeVariable::reverseCut(int state, double bias) { // find global cut CbcRowCuts * global = model_->globalCuts(); int n = global->sizeRowCuts(); int i; OsiRowCut * rowCut = NULL; for ( i = 0; i < n; i++) { rowCut = global->rowCutPtr(i); if (cut_ == *rowCut) { break; } } if (!rowCut) { // must have got here in odd way e.g. strong branching return; } if (rowCut->lb() > -1.0e10) return; // get smallest element double smallest = COIN_DBL_MAX; CoinPackedVector row = cut_.row(); for (int k = 0; k < row.getNumElements(); k++) smallest = CoinMin(smallest, fabs(row.getElements()[k])); if (!typeCuts_ && !refine_) { // Reverse cut very very weakly if (state > 2) smallest = 0.0; } // replace by other way if (model_->messageHandler()->logLevel() > 1) printf("reverseCut - changing cut %d out of %d, old rhs %g %g ", i, n, rowCut->lb(), rowCut->ub()); rowCut->setLb(rowCut->ub() + smallest - bias); rowCut->setUb(COIN_DBL_MAX); if (model_->messageHandler()->logLevel() > 1) printf("new rhs %g %g, bias %g smallest %g ", rowCut->lb(), rowCut->ub(), bias, smallest); const OsiRowCutDebugger *debugger = model_->solver()->getRowCutDebuggerAlways() ; if (debugger) { if (debugger->invalidCut(*rowCut)) printf("ZZZZTree Global cut - cuts off optimal solution!\n"); } } // Delete last cut branch void CbcTreeVariable::deleteCut(OsiRowCut & cut) { // find global cut CbcRowCuts * global = model_->globalCuts(); int n = global->sizeRowCuts(); int i; OsiRowCut * rowCut = NULL; for ( i = 0; i < n; i++) { rowCut = global->rowCutPtr(i); if (cut == *rowCut) { break; } } assert (i < n); // delete last cut if (model_->messageHandler()->logLevel() > 1) printf("deleteCut - deleting cut %d out of %d, rhs %g %g\n", i, n, rowCut->lb(), rowCut->ub()); global->eraseRowCut(i); } // Create C++ lines to get to current state void CbcTreeVariable::generateCpp( FILE * fp) { CbcTreeVariable other; fprintf(fp, "0#include \"CbcTreeVariable.hpp\"\n"); fprintf(fp, "5 CbcTreeVariable variableTree(cbcModel,NULL);\n"); if (range_ != other.range_) fprintf(fp, "5 variableTree.setRange(%d);\n", range_); if (typeCuts_ != other.typeCuts_) fprintf(fp, "5 variableTree.setTypeCuts(%d);\n", typeCuts_); if (maxDiversification_ != other.maxDiversification_) fprintf(fp, "5 variableTree.setMaxDiversification(%d);\n", maxDiversification_); if (timeLimit_ != other.timeLimit_) fprintf(fp, "5 variableTree.setTimeLimit(%d);\n", timeLimit_); if (nodeLimit_ != other.nodeLimit_) fprintf(fp, "5 variableTree.setNodeLimit(%d);\n", nodeLimit_); if (refine_ != other.refine_) fprintf(fp, "5 variableTree.setRefine(%s);\n", refine_ ? "true" : "false"); fprintf(fp, "5 cbcModel->passInTreeHandler(variableTree);\n"); } CoinMP-1.8.3/Cbc/src/CbcHeuristicDivePseudoCost.hpp0000644000175000017500000000402212131054770020471 0ustar renerene/* $Id: CbcHeuristicDivePseudoCost.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicDivePseudoCost_H #define CbcHeuristicDivePseudoCost_H #include "CbcHeuristicDive.hpp" /** DivePseudoCost class */ class CbcHeuristicDivePseudoCost : public CbcHeuristicDive { public: // Default Constructor CbcHeuristicDivePseudoCost (); // Constructor with model - assumed before cuts CbcHeuristicDivePseudoCost (CbcModel & model); // Copy constructor CbcHeuristicDivePseudoCost ( const CbcHeuristicDivePseudoCost &); // Destructor ~CbcHeuristicDivePseudoCost (); /// Clone virtual CbcHeuristicDivePseudoCost * clone() const; /// Assignment operator CbcHeuristicDivePseudoCost & operator=(const CbcHeuristicDivePseudoCost& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Selects the next variable to branch on /** Returns true if all the fractional variables can be trivially rounded. Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable. */ virtual bool selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound); /** Initializes any data which is going to be used repeatedly in selectVariableToBranch */ virtual void initializeData() ; /// Fix other variables at bounds virtual int fixOtherVariables(OsiSolverInterface * solver, const double * solution, PseudoReducedCost * candidate, const double * random); }; #endif CoinMP-1.8.3/Cbc/src/CbcBranchDecision.cpp0000644000175000017500000000532612131054770016567 0ustar renerene// $Id: CbcBranchDecision.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "OsiChooseVariable.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchBase.hpp" #include "CbcBranchDecision.hpp" // Default Constructor CbcBranchDecision::CbcBranchDecision () : object_(NULL), model_(NULL), chooseMethod_(NULL) { } // Copy Constructor CbcBranchDecision::CbcBranchDecision (const CbcBranchDecision &rhs) : object_(NULL), model_(rhs.model_), chooseMethod_(NULL) { if (rhs.chooseMethod_) chooseMethod_ = rhs.chooseMethod_->clone(); } CbcBranchDecision::~CbcBranchDecision() { delete object_; delete chooseMethod_; } /* Compare N branching objects. Return index of best and sets way of branching in chosen object. This routine is used only after strong branching. This is reccommended version as it can be more sophisticated */ int CbcBranchDecision::bestBranch (CbcBranchingObject ** objects, int numberObjects, int /*numberUnsatisfied*/, double * changeUp, int * numberInfeasibilitiesUp, double * changeDown, int * numberInfeasibilitiesDown, double /*objectiveValue*/) { int bestWay = 0; int whichObject = -1; if (numberObjects) { initialize(objects[0]->model()); CbcBranchingObject * bestObject = NULL; for (int i = 0 ; i < numberObjects ; i++) { int betterWay = betterBranch(objects[i], bestObject, changeUp[i], numberInfeasibilitiesUp [i], changeDown[i], numberInfeasibilitiesDown[i] ); if (betterWay) { bestObject = objects[i]; bestWay = betterWay; whichObject = i; } } // set way in best if (whichObject >= 0) objects[whichObject]->way(bestWay); } return whichObject; } // Set (clone) chooseMethod void CbcBranchDecision::setChooseMethod(const OsiChooseVariable & method) { delete chooseMethod_; chooseMethod_ = method.clone(); } CoinMP-1.8.3/Cbc/src/CbcObject.cpp0000644000175000017500000000761012131054770015120 0ustar renerene// $Id: CbcObject.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "OsiChooseVariable.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchBase.hpp" // Default Constructor CbcObject::CbcObject() : OsiObject(), model_(NULL), id_(-1), position_(-1), preferredWay_(0) { } // Constructor from model CbcObject::CbcObject(CbcModel * model) : OsiObject(), model_(model), id_(-1), position_(-1), preferredWay_(0) { } // Destructor CbcObject::~CbcObject () { } // Copy constructor CbcObject::CbcObject ( const CbcObject & rhs) : OsiObject(rhs) { model_ = rhs.model_; id_ = rhs.id_; position_ = rhs.position_; preferredWay_ = rhs.preferredWay_; } // Assignment operator CbcObject & CbcObject::operator=( const CbcObject & rhs) { if (this != &rhs) { OsiObject::operator=(rhs); model_ = rhs.model_; id_ = rhs.id_; position_ = rhs.position_; preferredWay_ = rhs.preferredWay_; } return *this; } /* Returns floor and ceiling i.e. closest valid points */ void CbcObject::floorCeiling(double & floorValue, double & ceilingValue, double value, double tolerance) const { if (fabs(floor(value + 0.5) - value) > tolerance) { floorValue = floor(value); } else { floorValue = floor(value + 0.5); } ceilingValue = floorValue + 1.0; } /* For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. Returns measure of how much it had to move solution to make feasible */ double CbcObject::feasibleRegion(OsiSolverInterface * /*solver*/) const { //assert (solver==model_->solver()); CbcObject * fudge = const_cast(this); fudge->feasibleRegion(); return 0.0; } /* For the variable(s) referenced by the object, look at the current solution and set bounds to match the solution. Returns measure of how much it had to move solution to make feasible */ double CbcObject::feasibleRegion(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * /*info*/) const { //assert (solver==model_->solver()); CbcObject * fudge = const_cast(this); fudge->feasibleRegion(); return 0.0; } /* Create a branching object and indicate which way to branch first. The branching object has to know how to create branches (fix variables, etc.) */ OsiBranchingObject * CbcObject::createOsiBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const { //assert (solver==model_->solver()); CbcObject * fudge = const_cast(this); return fudge->createBranch(solver, info, way); } /* Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ OsiSolverBranch * CbcObject::solverBranch() const { return NULL; } /* Pass in information on branch just done and create CbcObjectUpdateData instance. If object does not need data then backward pointer will be NULL. Assumes can get information from solver */ CbcObjectUpdateData CbcObject::createUpdateInformation(const OsiSolverInterface * /*solver*/, const CbcNode * /*node*/, const CbcBranchingObject * /*branchingObject*/) { return CbcObjectUpdateData(); } CoinMP-1.8.3/Cbc/src/CbcHeuristicPivotAndFix.hpp0000644000175000017500000000303412131054770017766 0ustar renerene/* $Id: CbcHeuristicPivotAndFix.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicPivotAndFix_H #define CbcHeuristicPivotAndFix_H #include "CbcHeuristic.hpp" /** LocalSearch class */ class CbcHeuristicPivotAndFix : public CbcHeuristic { public: // Default Constructor CbcHeuristicPivotAndFix (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicPivotAndFix (CbcModel & model); // Copy constructor CbcHeuristicPivotAndFix ( const CbcHeuristicPivotAndFix &); // Destructor ~CbcHeuristicPivotAndFix (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicPivotAndFix & operator=(const CbcHeuristicPivotAndFix& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) needs comments */ virtual int solution(double & objectiveValue, double * newSolution); protected: }; #endif CoinMP-1.8.3/Cbc/src/CbcThread.cpp0000644000175000017500000021467212433615222015131 0ustar renerene/* $Id: CbcThread.cpp 2097 2014-11-21 10:57:22Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" //#define THREAD_DEBUG #include #include #include #include #include "CbcEventHandler.hpp" #include "OsiSolverInterface.hpp" #include "OsiRowCutDebugger.hpp" #include "CbcThread.hpp" #include "CbcTree.hpp" #include "CbcHeuristic.hpp" #include "CbcCutGenerator.hpp" #include "CbcModel.hpp" #include "CbcFathom.hpp" #include "CbcSimpleIntegerDynamicPseudoCost.hpp" #include "ClpDualRowDantzig.hpp" #include "OsiAuxInfo.hpp" #include "CoinTime.hpp" #ifdef CBC_THREAD /// Thread functions static void * doNodesThread(void * voidInfo); static void * doCutsThread(void * voidInfo); static void * doHeurThread(void * voidInfo); // Default Constructor CbcSpecificThread::CbcSpecificThread () : basePointer_(NULL), masterMutex_(NULL), locked_(false) { #ifdef CBC_PTHREAD pthread_mutex_init(&mutex2_, NULL); pthread_cond_init(&condition2_, NULL); threadId_.status = 0; #else #endif } // Useful Constructor CbcSpecificThread::CbcSpecificThread (CbcSpecificThread * master, pthread_mutex_t * masterMutex) : basePointer_(master), masterMutex_(masterMutex), locked_(false) { #ifdef CBC_PTHREAD pthread_mutex_init(&mutex2_, NULL); pthread_cond_init(&condition2_, NULL); threadId_.status = 0; #else #endif } // Useful stuff void CbcSpecificThread::setUsefulStuff (CbcSpecificThread * master, void *& masterMutex) { #ifdef CBC_PTHREAD basePointer_ = master; if (masterMutex) { masterMutex_ = reinterpret_cast(masterMutex); } else { // create master mutex masterMutex_ = new pthread_mutex_t; pthread_mutex_init(masterMutex_, NULL); masterMutex = reinterpret_cast(masterMutex_); } #else #endif } CbcSpecificThread::~CbcSpecificThread() { #ifdef CBC_PTHREAD pthread_mutex_destroy (&mutex2_); if (basePointer_ == this) { pthread_mutex_destroy (masterMutex_); delete masterMutex_; } #else #endif } /* Locks a thread if parallel so that stuff like cut pool can be updated and/or used. */ void CbcSpecificThread::lockThread() { #ifdef CBC_PTHREAD // Use master mutex assert (basePointer_->masterMutex_ == masterMutex_); pthread_mutex_lock (masterMutex_); #else #endif } /* Unlocks a thread if parallel to say cut pool stuff not needed */ void CbcSpecificThread::unlockThread() { #ifdef CBC_PTHREAD // Use master mutex pthread_mutex_unlock (masterMutex_); #else #endif } // Locks a thread for testing whether to start etc void CbcSpecificThread::lockThread2(bool doAnyway) { if (!locked_ || doAnyway) { #ifdef CBC_PTHREAD pthread_mutex_lock (&mutex2_); #else #endif locked_ = true; } } // Unlocks a thread for testing whether to start etc void CbcSpecificThread::unlockThread2(bool doAnyway) { if (locked_ || doAnyway) { #ifdef CBC_PTHREAD pthread_mutex_unlock (&mutex2_); #else #endif locked_ = false; } } #ifdef HAVE_CLOCK_GETTIME inline int my_gettime(struct timespec* tp) { return clock_gettime(CLOCK_REALTIME, tp); } #else #ifndef _MSC_VER inline int my_gettime(struct timespec* tp) { struct timeval tv; int ret = gettimeofday(&tv, NULL); tp->tv_sec = tv.tv_sec; tp->tv_nsec = tv.tv_usec * 1000; return ret; } #else inline int my_gettime(struct timespec* tp) { double t = CoinGetTimeOfDay(); tp->tv_sec = (int)floor(t); tp->tv_nsec = (int)((tp->tv_sec - floor(t)) / 1000000.0); return 0; } #endif #endif // Get time static double getTime() { struct timespec absTime2; my_gettime(&absTime2); double time2 = absTime2.tv_sec + 1.0e-9 * static_cast(absTime2.tv_nsec); return time2; } // Timed wait in nanoseconds - if negative then seconds void CbcSpecificThread::timedWait(int time) { #ifdef CBC_PTHREAD struct timespec absTime; my_gettime(&absTime); if (time > 0) { absTime.tv_nsec += time; if (absTime.tv_nsec >= 1000000000) { absTime.tv_nsec -= 1000000000; absTime.tv_sec++; } } else { absTime.tv_sec -= time; } pthread_cond_timedwait(&condition2_, &mutex2_, &absTime); #else #endif } // Signal void CbcSpecificThread::signal() { #ifdef CBC_PTHREAD pthread_cond_signal(&condition2_); #else #endif } // Actually starts a thread void CbcSpecificThread::startThread(void * (*routine ) (void *), CbcThread * thread) { #ifdef CBC_PTHREAD pthread_create(&(threadId_.thr), NULL, routine, thread); threadId_.status = 1; #else #endif } // Exits thread (from master) int CbcSpecificThread::exit() { #ifdef CBC_PTHREAD pthread_cond_signal(&condition2_); // unlock return pthread_join(threadId_.thr, NULL); #else #endif } // Exits thread void CbcSpecificThread::exitThread() { #ifdef CBC_PTHREAD pthread_mutex_unlock(&mutex2_); pthread_exit(NULL); #else #endif } // Get status int CbcSpecificThread::status() const { #ifdef CBC_PTHREAD return static_cast(threadId_.status); #else #endif } // Set status void CbcSpecificThread::setStatus(int value) { #ifdef CBC_PTHREAD threadId_.status = value; #else #endif } // Parallel heuristics void parallelHeuristics (int numberThreads, int sizeOfData, void * argBundle) { Coin_pthread_t * threadId = new Coin_pthread_t [numberThreads]; char * args = reinterpret_cast(argBundle); for (int i = 0; i < numberThreads; i++) { pthread_create(&(threadId[i].thr), NULL, doHeurThread, args + i*sizeOfData); } // now wait for (int i = 0; i < numberThreads; i++) { pthread_join(threadId[i].thr, NULL); } delete [] threadId; } // End of specific thread stuff /// Default constructor CbcThread::CbcThread() : baseModel_(NULL), thisModel_(NULL), node_(NULL), // filled in every time createdNode_(NULL), // filled in every time on return returnCode_(-1), // -1 available, 0 busy, 1 finished , 2?? timeLocked_(0.0), timeWaitingToLock_(0.0), timeWaitingToStart_(0.0), timeInThread_(0.0), numberTimesLocked_(0), numberTimesUnlocked_(0), numberTimesWaitingToStart_(0), dantzigState_(0), // 0 unset, -1 waiting to be set, 1 set locked_(false), nDeleteNode_(0), delNode_(NULL), maxDeleteNode_(0), nodesThisTime_(0), iterationsThisTime_(0), deterministic_(0) { } void CbcThread::gutsOfDelete() { baseModel_ = NULL; thisModel_ = NULL; node_ = NULL; createdNode_ = NULL; delNode_ = NULL; } // Destructor CbcThread::~CbcThread() { } // Fills in useful stuff void CbcThread::setUsefulStuff (CbcModel * model, int deterministic, CbcModel * baseModel, CbcThread * master, void *& masterMutex) { baseModel_ = baseModel; thisModel_ = model; deterministic_ = deterministic; threadStuff_.setUsefulStuff(&master->threadStuff_, masterMutex); node_ = NULL; createdNode_ = NULL; master_ = master; returnCode_ = -1; timeLocked_ = 0.0; timeWaitingToLock_ = 0.0; timeWaitingToStart_ = 0.0; timeInThread_ = 0.0; numberTimesLocked_ = 0; numberTimesUnlocked_ = 0; numberTimesWaitingToStart_ = 0; dantzigState_ = 0; // 0 unset, -1 waiting to be set, 1 set locked_ = false; delNode_ = NULL; maxDeleteNode_ = 0; nDeleteNode_ = 0; nodesThisTime_ = 0; iterationsThisTime_ = 0; if (model != baseModel) { // thread thisModel_->setInfoInChild(-3, this); if (deterministic_ >= 0) thisModel_->moveToModel(baseModel, -1); if (deterministic == -1) threadStuff_.startThread( doCutsThread, this); else threadStuff_.startThread( doNodesThread, this); } } /* Locks a thread if parallel so that stuff like cut pool can be updated and/or used. */ void CbcThread::lockThread() { if (!locked_) { double time2 = getTime(); threadStuff_.lockThread(); locked_ = true; timeWhenLocked_ = getTime(); timeWaitingToLock_ += timeWhenLocked_ - time2;; numberTimesLocked_++; #ifdef THREAD_DEBUG lockCount_ ++; #if THREAD_DEBUG>1 if (threadNumber_ == -1) printf("locking master %d\n", lockCount_); else printf("locking thread %d %d\n", threadNumber_, lockCount_); #endif } else { if (threadNumber_ == -1) printf("master already locked %d\n", lockCount_); else printf("thread already locked %d %d\n", threadNumber_, lockCount_); #endif } } /* Unlocks a thread if parallel */ void CbcThread::unlockThread() { if (locked_) { locked_ = false; threadStuff_.unlockThread(); double time2 = getTime(); timeLocked_ += time2 - timeWhenLocked_; numberTimesUnlocked_++; #ifdef THREAD_DEBUG #if THREAD_DEBUG>1 if (threadNumber_ == -1) printf("unlocking master %d\n", lockCount_); else printf("unlocking thread %d %d\n", threadNumber_, lockCount_); #endif } else { if (threadNumber_ == -1) printf("master already unlocked %d\n", lockCount_); else printf("thread already unlocked %d %d\n", threadNumber_, lockCount_); #endif } } /* Wait for child to have return code NOT == to currentCode type - 0 timed wait 1 wait returns true if return code changed */ bool CbcThread::wait(int type, int currentCode) { if (!type) { // just timed wait master_->threadStuff_.lockThread2(); master_->threadStuff_.timedWait(1000000); master_->threadStuff_.unlockThread2(); } else { // wait until return code changes while (returnCode_ == currentCode) { threadStuff_.signal(); master_->threadStuff_.lockThread2(); master_->threadStuff_.timedWait(1000000); master_->threadStuff_.unlockThread2(); } } return (returnCode_ != currentCode); } #if 0 pthread_cond_signal(&condition2_); - if (!locked_) { pthread_mutex_lock (&mutex2_); locked_ = true; } - pthread_cond_timedwait(&condition2_, &mutex2_, &absTime); - if (locked_) { pthread_mutex_unlock (&mutex2_); locked_ = false; } #endif // Waits until returnCode_ goes to zero void CbcThread::waitThread() { double time = getTime(); threadStuff_.lockThread2(); while (returnCode_) { threadStuff_.timedWait(-10); // 10 seconds } timeWaitingToStart_ += getTime() - time; numberTimesWaitingToStart_++; } // Just wait for so many nanoseconds void CbcThread::waitNano(int time) { threadStuff_.lockThread2(); threadStuff_.timedWait(time); threadStuff_.unlockThread2(); } // Signal child to carry on void CbcThread::signal() { threadStuff_.signal(); } // Lock from master with mutex2 and signal before lock void CbcThread::lockFromMaster() { threadStuff_.signal(); master_->threadStuff_.lockThread2(true); } // Unlock from master with mutex2 and signal after unlock void CbcThread::unlockFromMaster() { master_->threadStuff_.unlockThread2(true); // unlock anyway threadStuff_.signal(); } // Lock from thread with mutex2 and signal before lock void CbcThread::lockFromThread() { master_->threadStuff_.signal(); threadStuff_.lockThread2(); } // Unlock from thread with mutex2 and signal after unlock void CbcThread::unlockFromThread() { master_->threadStuff_.signal(); threadStuff_.unlockThread2(); } // Exits thread (from master) int CbcThread::exit() { return threadStuff_.exit(); } // Exits thread void CbcThread::exitThread() { threadStuff_.exitThread(); } // Default constructor CbcBaseModel::CbcBaseModel() : numberThreads_(0), children_(NULL), type_(0), threadCount_(NULL), threadModel_(NULL), numberObjects_(0), saveObjects_(NULL), defaultParallelIterations_(400), defaultParallelNodes_(2) { } // Constructor with model CbcBaseModel::CbcBaseModel (CbcModel & model, int type) : children_(NULL), type_(type), threadCount_(NULL), threadModel_(NULL), numberObjects_(0), saveObjects_(NULL), defaultParallelIterations_(400), defaultParallelNodes_(2) { numberThreads_ = model.getNumberThreads(); if (numberThreads_) { children_ = new CbcThread [numberThreads_+1]; // Do a partial one for base model void * mutex_main = NULL; children_[numberThreads_].setUsefulStuff(&model, type_, &model, children_ + numberThreads_, mutex_main); #ifdef THREAD_DEBUG children_[numberThreads_].threadNumber_ = -1; children_[numberThreads_].lockCount_ = 0; #endif threadCount_ = new int [numberThreads_]; CoinZeroN(threadCount_, numberThreads_); threadModel_ = new CbcModel * [numberThreads_+1]; memset(threadStats_, 0, sizeof(threadStats_)); if (type_ > 0) { // May need for deterministic numberObjects_ = model.numberObjects(); saveObjects_ = new OsiObject * [numberObjects_]; for (int i = 0; i < numberObjects_; i++) { saveObjects_[i] = model.object(i)->clone(); } } // we don't want a strategy object CbcStrategy * saveStrategy = model.strategy(); model.setStrategy(NULL); for (int i = 0; i < numberThreads_; i++) { //threadModel_[i] = new CbcModel(model, true); threadModel_[i] = model. clone (true); threadModel_[i]->synchronizeHandlers(1); #ifdef COIN_HAS_CLP // Solver may need to know about model CbcModel * thisModel = threadModel_[i]; CbcOsiSolver * solver = dynamic_cast(thisModel->solver()) ; if (solver) solver->setCbcModel(thisModel); #endif children_[i].setUsefulStuff(threadModel_[i], type_, &model, children_ + numberThreads_, mutex_main); #ifdef THREAD_DEBUG children_[i].threadNumber_ = i; children_[i].lockCount_ = 0; #endif } model.setStrategy(saveStrategy); } } // Stop threads void CbcBaseModel::stopThreads(int type) { CbcModel * baseModel = children_[0].baseModel(); if (type < 0) { // max nodes ? bool finished = false; while (!finished) { finished = true; for (int i = 0; i < numberThreads_; i++) { if (abs(children_[i].returnCode()) != 1) { children_[i].wait(1, 0); finished=false; } } } for (int i = 0; i < numberThreads_; i++) { baseModel->incrementExtra(threadModel_[i]->getExtraNodeCount(), threadModel_[i]->numberExtraIterations(), threadModel_[i]->getFathomCount()); threadModel_[i]->zeroExtra(); } return; } for (int i = 0; i < numberThreads_; i++) { children_[i].wait(1, 0); assert (children_[i].returnCode() == -1); baseModel->incrementExtra(threadModel_[i]->getExtraNodeCount(), threadModel_[i]->numberExtraIterations(), threadModel_[i]->getFathomCount()); threadModel_[i]->setInfoInChild(-2, NULL); children_[i].setReturnCode( 0); children_[i].exit(); children_[i].setStatus( 0); } // delete models and solvers for (int i = 0; i < numberThreads_; i++) { threadModel_[i]->setInfoInChild(type_, NULL); delete threadModel_[i]; } delete [] children_; delete [] threadModel_; for (int i = 0; i < numberObjects_; i++) delete saveObjects_[i]; delete [] saveObjects_; children_ = NULL; threadModel_ = NULL; saveObjects_ = NULL; numberObjects_ = 0; numberThreads_ = 0; } // Wait for threads in tree int CbcBaseModel::waitForThreadsInTree(int type) { CbcModel * baseModel = children_[0].baseModel(); int anyLeft = 0; // May be able to combine parts later if (type == 0) { bool locked = true; #ifdef COIN_DEVELOP printf("empty\n"); #endif // may still be outstanding nodes while (true) { int iThread; for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].status()) { if (children_[iThread].returnCode() == 0) { break; } } } if (iThread < numberThreads_) { #ifdef COIN_DEVELOP printf("waiting for thread %d code 0\n", iThread); #endif unlockThread(); locked = false; children_[iThread].wait(1, 0); assert(children_[iThread].returnCode() == 1); threadModel_[iThread]->moveToModel(baseModel, 1); #ifdef THREAD_PRINT printf("off thread2 %d node %x\n", iThread, children_[iThread].node()); #endif children_[iThread].setNode(NULL); anyLeft = 1; assert (children_[iThread].returnCode() == 1); if (children_[iThread].dantzigState() == -1) { // 0 unset, -1 waiting to be set, 1 set children_[iThread].setDantzigState(1); CbcModel * model = children_[iThread].thisModel(); OsiClpSolverInterface * clpSolver2 = dynamic_cast (model->solver()); assert (clpSolver2); ClpSimplex * simplex2 = clpSolver2->getModelPtr(); ClpDualRowDantzig dantzig; simplex2->setDualRowPivotAlgorithm(dantzig); } // say available children_[iThread].setReturnCode( -1); threadStats_[4]++; #ifdef COIN_DEVELOP printf("thread %d code now -1\n", iThread); #endif break; } else { #ifdef COIN_DEVELOP printf("no threads at code 0 \n"); #endif // now check if any have just finished for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].status()) { if (children_[iThread].returnCode() == 1) break; } } if (iThread < numberThreads_) { unlockThread(); locked = false; threadModel_[iThread]->moveToModel(baseModel, 1); #ifdef THREAD_PRINT printf("off thread3 %d node %x\n", iThread, children_[iThread].node()); #endif children_[iThread].setNode(NULL); anyLeft = 1; assert (children_[iThread].returnCode() == 1); // say available children_[iThread].setReturnCode( -1); threadStats_[4]++; #ifdef COIN_DEVELOP printf("thread %d code now -1\n", iThread); #endif break; } } if (!baseModel->tree()->empty()) { #ifdef COIN_DEVELOP printf("tree not empty!!!!!!\n"); #endif if (locked) unlockThread(); return 1; break; } for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].status()) { if (children_[iThread].returnCode() != -1) { printf("bad end of tree\n"); abort(); } } } break; } #ifdef COIN_DEVELOP printf("finished ************\n"); #endif if (locked) unlockThread(); return anyLeft; } else if (type == 1) { // normal double cutoff = baseModel->getCutoff(); CbcNode * node = baseModel->tree()->bestNode(cutoff) ; // Possible one on tree worse than cutoff if (!node || node->objectiveValue() > cutoff) return 1; threadStats_[0]++; //need to think int iThread; // Start one off if any available for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode() == -1) { break; } } if (iThread < numberThreads_) { children_[iThread].setNode(node); #ifdef THREAD_PRINT printf("empty thread %d node %x\n", iThread, children_[iThread].node()); #endif assert (children_[iThread].returnCode() == -1); // say in use threadModel_[iThread]->moveToModel(baseModel, 0); // This has to be AFTER moveToModel children_[iThread].setReturnCode( 0); children_[iThread].signal(); threadCount_[iThread]++; } lockThread(); // see if any finished for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode() > 0) break; } unlockThread(); if (iThread < numberThreads_) { threadModel_[iThread]->moveToModel(baseModel, 1); #ifdef THREAD_PRINT printf("off thread4 %d node %x\n", iThread, children_[iThread].node()); #endif children_[iThread].setNode(NULL); anyLeft = 1; assert (children_[iThread].returnCode() == 1); // say available children_[iThread].setReturnCode( -1); // carry on threadStats_[3]++; } else { // Start one off if any available for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode() == -1) break; } if (iThread < numberThreads_) { // If any on tree get if (!baseModel->tree()->empty()) { //node = baseModel->tree()->bestNode(cutoff) ; //assert (node); threadStats_[1]++; return 1; // ** get another node } } // wait (for debug could sleep and use test) bool finished = false; while (!finished) { double time = getTime(); children_[numberThreads_].wait(0, 0); children_[numberThreads_].incrementTimeInThread(getTime() - time); for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode() > 0) { finished = true; break; } else if (children_[iThread].returnCode() == 0) { children_[iThread].signal(); // unlock } } } assert (iThread < numberThreads_); // move information to model threadModel_[iThread]->moveToModel(baseModel, 1); anyLeft = 1; #ifdef THREAD_PRINT printf("off thread %d node %x\n", iThread, children_[iThread].node()); #endif children_[iThread].setNode(NULL); assert (children_[iThread].returnCode() == 1); // say available children_[iThread].setReturnCode( -1); } // carry on threadStats_[2]++; for (int iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].status()) { if (children_[iThread].returnCode() != -1) { anyLeft = 1; break; } } } return anyLeft; } else if (type == 2) { if (!baseModel->tree()->empty()) { // max nodes ? bool finished = false; while (!finished) { finished = true; for (int iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode() == 0) { double time = getTime(); children_[numberThreads_].wait(0, 0); children_[numberThreads_].incrementTimeInThread(getTime() - time); finished = false; children_[iThread].signal(); // unlock } } } } int i; // do statistics // Seems to be bug in CoinCpu on Linux - does threads as well despite documentation double time = 0.0; for (i = 0; i < numberThreads_; i++) time += children_[i].timeInThread(); bool goodTimer = time < (baseModel->getCurrentSeconds()); for (i = 0; i < numberThreads_; i++) { while (children_[i].returnCode() == 0) { children_[i].signal(); double time = getTime(); children_[numberThreads_].wait(0, 0); children_[numberThreads_].incrementTimeInThread(getTime() - time); } children_[i].lockFromMaster(); threadModel_[i]->setNumberThreads(0); // say exit if (children_[i].deterministic() > 0) delete [] children_[i].delNode(); if (children_[i].node()) { delete children_[i].node(); children_[i].setNode(NULL); } children_[i].setReturnCode( 0); children_[i].unlockFromMaster(); #ifndef NDEBUG int returnCode = children_[i].exit(); assert (!returnCode); #else children_[i].exit(); #endif children_[i].setStatus( 0); //else threadModel_[i]->moveToModel(baseModel, 2); assert (children_[i].numberTimesLocked() == children_[i].numberTimesUnlocked()); baseModel->messageHandler()->message(CBC_THREAD_STATS, baseModel->messages()) << "Thread"; baseModel->messageHandler()->printing(true) << i << threadCount_[i] << children_[i].timeWaitingToStart(); baseModel->messageHandler()->printing(goodTimer) << children_[i].timeInThread(); baseModel->messageHandler()->printing(false) << 0.0; baseModel->messageHandler()->printing(true) << children_[i].numberTimesLocked() << children_[i].timeLocked() << children_[i].timeWaitingToLock() << CoinMessageEol; } assert (children_[numberThreads_].numberTimesLocked() == children_[numberThreads_].numberTimesUnlocked()); baseModel->messageHandler()->message(CBC_THREAD_STATS, baseModel->messages()) << "Main thread"; baseModel->messageHandler()->printing(false) << 0 << 0 << 0.0; baseModel->messageHandler()->printing(false) << 0.0; baseModel->messageHandler()->printing(true) << children_[numberThreads_].timeInThread(); baseModel->messageHandler()->printing(true) << children_[numberThreads_].numberTimesLocked() << children_[numberThreads_].timeLocked() << children_[numberThreads_].timeWaitingToLock() << CoinMessageEol; // delete models (here in case some point to others) for (i = 0; i < numberThreads_; i++) { // make sure handler will be deleted threadModel_[i]->setDefaultHandler(true); //delete threadModel_[i]; } } else { abort(); } return 0; } void CbcBaseModel::waitForThreadsInCuts(int type, OsiCuts * eachCuts, int whichGenerator) { if (type == 0) { // cuts while doing bool finished = false; int iThread = -1; // see if any available for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode()) { finished = true; break; } else if (children_[iThread].returnCode() == 0) { children_[iThread].signal(); } } while (!finished) { children_[numberThreads_].waitNano(1000000); for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode() > 0) { finished = true; break; } else if (children_[iThread].returnCode() == 0) { children_[iThread].signal(); } } } assert (iThread < numberThreads_); assert (children_[iThread].returnCode()); // Use dantzigState to signal which generator children_[iThread].setDantzigState(whichGenerator); // and delNode for eachCuts children_[iThread].fakeDelNode(reinterpret_cast (eachCuts)); // allow to start children_[iThread].setReturnCode( 0); children_[iThread].signal(); } else if (type == 1) { // cuts - finish up for (int iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode() == 0) { bool finished = false; while (!finished) { children_[numberThreads_].wait(0, 0); if (children_[iThread].returnCode() > 0) { finished = true; break; //#ifndef NEW_STYLE_PTHREAD //} else if (children_[iThread].returnCode_ == 0) { //pthread_cond_signal(&children_[iThread].threadStuff_.condition2_); // unlock //#endif } } } assert (children_[iThread].returnCode()); // say available children_[iThread].setReturnCode( -1); //delete threadModel_[iThread]->solver(); //threadModel_[iThread]->setSolver(NULL); } } else { abort(); } } // Returns pointer to master thread CbcThread * CbcBaseModel::masterThread() const { return children_ + numberThreads_; } // Split model and do work in deterministic parallel void CbcBaseModel::deterministicParallel() { CbcModel * baseModel = children_[0].baseModel(); for (int i = 0; i < numberThreads_; i++) threadCount_[i]++; int saveTreeSize = baseModel->tree()->size(); // For now create threadModel - later modify splitModel CbcModel ** threadModel = new CbcModel * [numberThreads_]; int iThread; for (iThread = 0; iThread < numberThreads_; iThread++) threadModel[iThread] = children_[iThread].thisModel(); int nAffected = baseModel->splitModel(numberThreads_, threadModel, defaultParallelNodes_); // do all until finished for (iThread = 0; iThread < numberThreads_; iThread++) { // obviously tune children_[iThread].setNDeleteNode(defaultParallelIterations_); } // Save current state int iObject; OsiObject ** object = baseModel->objects(); for (iObject = 0; iObject < numberObjects_; iObject++) { saveObjects_[iObject]->updateBefore(object[iObject]); } //#define FAKE_PARALLEL #ifndef FAKE_PARALLEL for (iThread = 0; iThread < numberThreads_; iThread++) { children_[iThread].setReturnCode( 0); children_[iThread].signal(); } // wait bool finished = false; double time = getTime(); while (!finished) { children_[numberThreads_].waitNano( 1000000); // millisecond finished = true; for (iThread = 0; iThread < numberThreads_; iThread++) { if (children_[iThread].returnCode() <= 0) { finished = false; } } } for (iThread = 0; iThread < numberThreads_; iThread++) children_[iThread].setReturnCode(-1); #else // wait bool finished = false; double time = getTime(); for (iThread = 0; iThread < numberThreads_; iThread++) { children_[iThread].setReturnCode( 0); children_[iThread].signal(); while (!finished) { children_[numberThreads_].waitNano( 1000000); // millisecond finished = (children_[iThread].returnCode() >0); } children_[iThread].setReturnCode(-1); finished=false; } #endif children_[numberThreads_].incrementTimeInThread(getTime() - time); // Unmark marked for (int i = 0; i < nAffected; i++) { baseModel->walkback()[i]->unmark(); } int iModel; double scaleFactor = 1.0; for (iModel = 0; iModel < numberThreads_; iModel++) { //printf("model %d tree size %d\n",iModel,threadModel[iModel]->baseModel->tree()->size()); if (saveTreeSize > 4*numberThreads_*defaultParallelNodes_) { if (!threadModel[iModel]->tree()->size()) { scaleFactor *= 1.05; } } threadModel[iModel]->moveToModel(baseModel, 11); // Update base model OsiObject ** threadObject = threadModel[iModel]->objects(); for (iObject = 0; iObject < numberObjects_; iObject++) { object[iObject]->updateAfter(threadObject[iObject], saveObjects_[iObject]); } } if (scaleFactor != 1.0) { int newNumber = static_cast (defaultParallelNodes_ * scaleFactor + 0.5001); if (newNumber*2 < defaultParallelIterations_) { if (defaultParallelNodes_ == 1) newNumber = 2; if (newNumber != defaultParallelNodes_) { char general[200]; sprintf(general, "Changing tree size from %d to %d", defaultParallelNodes_, newNumber); baseModel->messageHandler()->message(CBC_GENERAL, baseModel->messages()) << general << CoinMessageEol ; defaultParallelNodes_ = newNumber; } } } delete [] threadModel; } // Destructor CbcBaseModel::~CbcBaseModel() { delete [] threadCount_; #if 1 for (int i = 0; i < numberThreads_; i++) delete threadModel_[i]; delete [] threadModel_; delete [] children_; #endif for (int i = 0; i < numberObjects_; i++) delete saveObjects_[i]; delete [] saveObjects_; } // Sets Dantzig state in children void CbcBaseModel::setDantzigState() { for (int i = 0; i < numberThreads_; i++) { children_[i].setDantzigState(-1); } } static void * doNodesThread(void * voidInfo) { CbcThread * stuff = reinterpret_cast (voidInfo); CbcModel * thisModel = stuff->thisModel(); CbcModel * baseModel = stuff->baseModel(); while (true) { stuff->waitThread(); //printf("start node %x\n",stuff->node); int mode = thisModel->getNumberThreads(); if (mode) { // normal double time2 = CoinCpuTime(); assert (stuff->returnCode() == 0); if (thisModel->parallelMode() >= 0) { CbcNode * node = stuff->node(); //assert (node->nodeInfo()); CbcNode * createdNode = stuff->createdNode(); // try and see if this has slipped through if (node) { thisModel->doOneNode(baseModel, node, createdNode); } else { //printf("null node\n"); createdNode=NULL; } stuff->setNode(node); stuff->setCreatedNode(createdNode); stuff->setReturnCode( 1); } else { assert (!stuff->node()); assert (!stuff->createdNode()); int numberIterations = stuff->nDeleteNode(); int nDeleteNode = 0; int maxDeleteNode = stuff->maxDeleteNode(); CbcNode ** delNode = stuff->delNode(); int returnCode = 1; // this should be updated by heuristics strong branching etc etc assert (numberIterations > 0); thisModel->setNumberThreads(0); int nodesThisTime = thisModel->getNodeCount(); int iterationsThisTime = thisModel->getIterationCount(); int strongThisTime = thisModel->numberStrongIterations(); thisModel->setStopNumberIterations(thisModel->getIterationCount() + numberIterations); int numberColumns = thisModel->getNumCols(); int * used = CoinCopyOfArray(thisModel->usedInSolution(), numberColumns); int numberSolutions = thisModel->getSolutionCount(); while (true) { if (thisModel->tree()->empty()) { returnCode = 1 + 1; #ifdef CLP_INVESTIGATE_2 printf("%x tree empty - time %18.6f\n", thisModel, CoinGetTimeOfDay() - 1.2348e9); #endif break; } #define NODE_ITERATIONS 2 int nodesNow = thisModel->getNodeCount(); int iterationsNow = thisModel->getIterationCount(); int strongNow = thisModel->numberStrongIterations(); bool exit1 = (NODE_ITERATIONS * ((nodesNow - nodesThisTime) + ((strongNow - strongThisTime) >> 1)) + (iterationsNow - iterationsThisTime) > numberIterations); //bool exit2 =(thisModel->getIterationCount()>thisModel->getStopNumberIterations()) ; //assert (exit1==exit2); if (exit1 && nodesNow - nodesThisTime >= 10) { // out of loop //printf("out of loop\n"); #ifdef CLP_INVESTIGATE3 printf("%x tree %d nodes left, done %d and %d its - time %18.6f\n", thisModel, thisModel->tree()->size(), nodesNow - nodesThisTime, iterationsNow - iterationsThisTime, CoinGetTimeOfDay() - 1.2348e9); #endif break; } double cutoff = thisModel->getCutoff() ; CbcNode *node = thisModel->tree()->bestNode(cutoff) ; // Possible one on tree worse than cutoff if (!node) continue; CbcNode * createdNode = NULL; // Do real work of node thisModel->doOneNode(NULL, node, createdNode); assert (createdNode); if (!createdNode->active()) { delete createdNode; } else { // Say one more pointing to this **** postpone if marked node->nodeInfo()->increment() ; thisModel->tree()->push(createdNode) ; } if (node->active()) { assert (node->nodeInfo()); if (node->nodeInfo()->numberBranchesLeft()) { thisModel->tree()->push(node) ; } else { node->setActive(false); } } else { if (node->nodeInfo()) { if (!node->nodeInfo()->numberBranchesLeft()) node->nodeInfo()->allBranchesGone(); // can clean up // So will delete underlying stuff node->setActive(true); } if (nDeleteNode == maxDeleteNode) { maxDeleteNode = (3 * maxDeleteNode) / 2 + 10; stuff->setMaxDeleteNode(maxDeleteNode); stuff->setDelNode(new CbcNode * [maxDeleteNode]); for (int i = 0; i < nDeleteNode; i++) stuff->delNode()[i] = delNode[i]; delete [] delNode; delNode = stuff->delNode(); } delNode[nDeleteNode++] = node; } } // end of this sub-tree int * usedA = thisModel->usedInSolution(); for (int i = 0; i < numberColumns; i++) { usedA[i] -= used[i]; } delete [] used; thisModel->setSolutionCount(thisModel->getSolutionCount() - numberSolutions); stuff->setNodesThisTime(thisModel->getNodeCount() - nodesThisTime); stuff->setIterationsThisTime(thisModel->getIterationCount() - iterationsThisTime); stuff->setNDeleteNode(nDeleteNode); stuff->setReturnCode( returnCode); thisModel->setNumberThreads(mode); } //printf("end node %x\n",stuff->node); stuff->unlockFromThread(); stuff->incrementTimeInThread(CoinCpuTime() - time2); } else { // exit break; } } //printf("THREAD exiting\n"); stuff->exitThread(); return NULL; } static void * doHeurThread(void * voidInfo) { typedef struct { double solutionValue; CbcModel * model; double * solution; int foundSol; } argBundle; argBundle * stuff = reinterpret_cast (voidInfo); stuff->foundSol = stuff->model->heuristic(0)->solution(stuff->solutionValue, stuff->solution); return NULL; } static void * doCutsThread(void * voidInfo) { CbcThread * stuff = reinterpret_cast (voidInfo); CbcModel * thisModel = stuff->thisModel(); while (true) { stuff->waitThread(); //printf("start node %x\n",stuff->node); int mode = thisModel->getNumberThreads(); if (mode) { // normal assert (stuff->returnCode() == 0); int fullScan = thisModel->getNodeCount() == 0 ? 1 : 0; //? was >0 CbcCutGenerator * generator = thisModel->cutGenerator(stuff->dantzigState()); generator->refreshModel(thisModel); OsiCuts * cuts = reinterpret_cast (stuff->delNode()); OsiSolverInterface * thisSolver = thisModel->solver(); generator->generateCuts(*cuts, fullScan, thisSolver, NULL); stuff->setReturnCode( 1); stuff->unlockFromThread(); } else { // exit break; } } stuff->exitThread(); return NULL; } // Split up nodes - returns number of CbcNodeInfo's affected int CbcModel::splitModel(int numberModels, CbcModel ** model, int numberNodes) { int iModel; int i; for (iModel = 0; iModel < numberModels; iModel++) { CbcModel * otherModel = model[iModel]; otherModel->moveToModel(this, 10); assert (!otherModel->tree()->size()); otherModel->tree()->resetNodeNumbers(); otherModel->bestPossibleObjective_ = bestPossibleObjective_; otherModel->sumChangeObjective1_ = sumChangeObjective1_; otherModel->sumChangeObjective2_ = sumChangeObjective2_; int numberColumns = solver_->getNumCols(); if (otherModel->bestSolution_) { assert (bestSolution_); memcpy(otherModel->bestSolution_, bestSolution_, numberColumns*sizeof(double)); } else if (bestSolution_) { otherModel->bestSolution_ = CoinCopyOfArray(bestSolution_, numberColumns); } otherModel->globalCuts_ = globalCuts_; otherModel->numberSolutions_ = numberSolutions_; otherModel->numberHeuristicSolutions_ = numberHeuristicSolutions_; otherModel->numberNodes_ = numberNodes_; otherModel->numberIterations_ = numberIterations_; #ifdef JJF_ZERO if (maximumNumberCuts_ > otherModel->maximumNumberCuts_) { otherModel->maximumNumberCuts_ = maximumNumberCuts_; delete [] otherModel->addedCuts_; otherModel->addedCuts_ = new CbcCountRowCut * [maximumNumberCuts_]; } if (maximumDepth_ > otherModel->maximumDepth_) { otherModel->maximumDepth_ = maximumDepth_; delete [] otherModel->walkback_; otherModel->walkback_ = new CbcNodeInfo * [maximumDepth_]; } #endif otherModel->currentNumberCuts_ = currentNumberCuts_; if (otherModel->usedInSolution_) { assert (usedInSolution_); memcpy(otherModel->usedInSolution_, usedInSolution_, numberColumns*sizeof(int)); } else if (usedInSolution_) { otherModel->usedInSolution_ = CoinCopyOfArray(usedInSolution_, numberColumns); } /// ??? tree_; // Need flag (stopNumberIterations_>0?) which says don't update cut etc counts for (i = 0; i < numberObjects_; i++) { otherModel->object_[i]->updateBefore(object_[i]); } otherModel->maximumDepthActual_ = maximumDepthActual_; // Real cuts are in node info otherModel->numberOldActiveCuts_ = numberOldActiveCuts_; otherModel->numberNewCuts_ = numberNewCuts_; otherModel->numberStrongIterations_ = numberStrongIterations_; } double cutoff = getCutoff(); int nAffected = 0; while (!tree_->empty()) { for (iModel = 0; iModel < numberModels; iModel++) { if (tree_->empty()) break; CbcModel * otherModel = model[iModel]; CbcNode * node = tree_->bestNode(cutoff) ; CbcNodeInfo * nodeInfo = node->nodeInfo(); assert (nodeInfo); if (!nodeInfo->marked()) { //while (nodeInfo&&!nodeInfo->marked()) { if (nAffected == maximumDepth_) { redoWalkBack(); } nodeInfo->mark(); //nodeInfo->incrementCuts(1000000); walkback_[nAffected++] = nodeInfo; //nodeInfo = nodeInfo->parent() ; //} } // Make node join otherModel OsiBranchingObject * bobj = node->modifiableBranchingObject(); CbcBranchingObject * cbcobj = dynamic_cast (bobj); //assert (cbcobj); if (cbcobj) { CbcObject * object = cbcobj->object(); assert (object); int position = object->position(); assert (position >= 0); assert (object_[position] == object); CbcObject * objectNew = dynamic_cast (otherModel->object_[position]); cbcobj->setOriginalObject(objectNew); } otherModel->tree_->push(node); } numberNodes--; if (!numberNodes) break; } return nAffected; } // Start threads void CbcModel::startSplitModel(int /*numberIterations*/) { abort(); } // Merge models void CbcModel::mergeModels(int /*numberModel*/, CbcModel ** /*model*/, int /*numberNodes*/) { abort(); } /* Move/copy information from one model to another -1 - initial setup 0 - from base model 1 - to base model (and reset) 2 - add in final statistics etc (and reset so can do clean destruction) 10 - from base model (deterministic) 11 - to base model (deterministic) */ void CbcModel::moveToModel(CbcModel * baseModel, int mode) { #ifdef THREAD_DEBUG { CbcThread * stuff = reinterpret_cast (masterThread_); if (stuff) printf("mode %d node_ %p createdNode_ %p - stuff %p\n", mode,stuff->node(),stuff->createdNode(),stuff); else printf("mode %d null stuff\n",mode); } #endif if (mode == 0) { setCutoff(baseModel->getCutoff()); bestObjective_ = baseModel->bestObjective_; //assert (!baseModel->globalCuts_.sizeRowCuts()); if (numberSolutions_ < baseModel->numberSolutions_&& baseModel->bestSolution_) { int numberColumns = solver_->getNumCols(); if (!bestSolution_) bestSolution_ = new double [numberColumns]; memcpy(bestSolution_,baseModel->bestSolution_, numberColumns*sizeof(double)); numberSolutions_ = baseModel->numberSolutions_; } stateOfSearch_ = baseModel->stateOfSearch_; numberNodes_ = baseModel->numberNodes_; numberIterations_ = baseModel->numberIterations_; numberFixedAtRoot_ = numberIterations_; // for statistics numberSolves_ = 0; phase_ = baseModel->phase_; assert (!nextRowCut_); nodeCompare_ = baseModel->nodeCompare_; tree_ = baseModel->tree_; assert (!subTreeModel_); //branchingMethod_ = NULL; // need something but what numberOldActiveCuts_ = baseModel->numberOldActiveCuts_; cutModifier_ = NULL; assert (!analyzeResults_); CbcThread * stuff = reinterpret_cast (masterThread_); assert (stuff); //if (stuff) stuff->setCreatedNode(NULL); // ?? searchStrategy_; searchStrategy_ = baseModel->searchStrategy_; stuff->saveStuff()[0] = searchStrategy_; stateOfSearch_ = baseModel->stateOfSearch_; stuff->saveStuff()[1] = stateOfSearch_; for (int iObject = 0 ; iObject < numberObjects_ ; iObject++) { CbcSimpleIntegerDynamicPseudoCost * dynamicObject = dynamic_cast (object_[iObject]) ; if (dynamicObject) { CbcSimpleIntegerDynamicPseudoCost * baseObject = dynamic_cast (baseModel->object_[iObject]) ; assert (baseObject); dynamicObject->copySome(baseObject); } } // add new global cuts CbcRowCuts * baseGlobal = baseModel->globalCuts(); CbcRowCuts * thisGlobal = globalCuts(); int baseNumberCuts = baseGlobal->sizeRowCuts(); int thisNumberCuts = thisGlobal->sizeRowCuts(); for (int i=thisNumberCuts;iaddCutIfNotDuplicate(*baseGlobal->cut(i)); } numberGlobalCutsIn_ = baseNumberCuts; } else if (mode == 1) { lockThread(); CbcThread * stuff = reinterpret_cast (masterThread_); assert (stuff); //stateOfSearch_ if (stuff->saveStuff()[0] != searchStrategy_) { #ifdef COIN_DEVELOP printf("changing searchStrategy from %d to %d\n", baseModel->searchStrategy_, searchStrategy_); #endif baseModel->searchStrategy_ = searchStrategy_; } if (stuff->saveStuff()[1] != stateOfSearch_) { #ifdef COIN_DEVELOP printf("changing stateOfSearch from %d to %d\n", baseModel->stateOfSearch_, stateOfSearch_); #endif baseModel->stateOfSearch_ = stateOfSearch_; } if (numberUpdateItems_) { for (int i = 0; i < numberUpdateItems_; i++) { CbcObjectUpdateData * update = updateItems_ + i; int objectNumber = update->objectNumber_; CbcObject * object = dynamic_cast (baseModel->object_[objectNumber]); if (object) object->updateInformation(*update); } numberUpdateItems_ = 0; } if (eventHappened_) baseModel->eventHappened_ = true; baseModel->numberNodes_++; baseModel->numberIterations_ += numberIterations_ - numberFixedAtRoot_; baseModel->numberSolves_ += numberSolves_; if (stuff->node()) baseModel->tree_->push(stuff->node()); if (stuff->createdNode()) baseModel->tree_->push(stuff->createdNode()); // add new global cuts to base and take off CbcRowCuts * baseGlobal = baseModel->globalCuts(); CbcRowCuts * thisGlobal = globalCuts(); int thisNumberCuts = thisGlobal->sizeRowCuts(); for (int i=thisNumberCuts-1;i>=numberGlobalCutsIn_;i--) { baseGlobal->addCutIfNotDuplicate(*thisGlobal->cut(i),thisGlobal->cut(i)->whichRow()); thisGlobal->eraseRowCut(i); } //thisGlobal->truncate(numberGlobalCutsIn_); numberGlobalCutsIn_ = 999999; unlockThread(); } else if (mode == 2) { baseModel->sumChangeObjective1_ += sumChangeObjective1_; baseModel->sumChangeObjective2_ += sumChangeObjective2_; //baseModel->numberIterations_ += numberIterations_; for (int iGenerator = 0; iGenerator < numberCutGenerators_; iGenerator++) { CbcCutGenerator * generator = baseModel->generator_[iGenerator]; CbcCutGenerator * generator2 = generator_[iGenerator]; generator->incrementNumberTimesEntered(generator2->numberTimesEntered()); generator->incrementNumberCutsInTotal(generator2->numberCutsInTotal()); generator->incrementNumberCutsActive(generator2->numberCutsActive()); generator->incrementTimeInCutGenerator(generator2->timeInCutGenerator()); } if (parallelMode() >= 0) nodeCompare_ = NULL; baseModel->maximumDepthActual_ = CoinMax(baseModel->maximumDepthActual_, maximumDepthActual_); baseModel->numberDJFixed_ += numberDJFixed_; baseModel->numberStrongIterations_ += numberStrongIterations_; int i; for (i = 0; i < 3; i++) baseModel->strongInfo_[i] += strongInfo_[i]; if (parallelMode() >= 0) { walkback_ = NULL; lastNodeInfo_ = NULL; lastNumberCuts_ = NULL; lastCut_ = NULL; //addedCuts_ = NULL; tree_ = NULL; } if ((moreSpecialOptions2_&32)!=0) delete eventHandler_; eventHandler_ = NULL; delete solverCharacteristics_; solverCharacteristics_ = NULL; bool newMethod = (baseModel->branchingMethod_ && baseModel->branchingMethod_->chooseMethod()); if (newMethod) { // new method - we were using base models numberObjects_ = 0; object_ = NULL; } } else if (mode == -1) { delete eventHandler_; if ((moreSpecialOptions2_&32)==0||!baseModel->eventHandler_) { eventHandler_ = baseModel->eventHandler_; } else { eventHandler_ = baseModel->eventHandler_->clone(); eventHandler_->setModel(this); } assert (!statistics_); assert(baseModel->solverCharacteristics_); solverCharacteristics_ = new OsiBabSolver (*baseModel->solverCharacteristics_); solverCharacteristics_->setSolver(solver_); setMaximumNodes(COIN_INT_MAX); if (parallelMode() >= 0) { delete [] walkback_; //delete [] addedCuts_; walkback_ = NULL; //addedCuts_ = NULL; delete [] lastNodeInfo_ ; lastNodeInfo_ = NULL; delete [] lastNumberCuts_ ; lastNumberCuts_ = NULL; delete [] lastCut_ ; lastCut_ = NULL; delete tree_; tree_ = NULL; delete nodeCompare_; nodeCompare_ = NULL; } else { delete tree_; tree_ = new CbcTree(); tree_->setComparison(*nodeCompare_) ; } delete continuousSolver_; continuousSolver_ = baseModel->continuousSolver_->clone(); // make sure solvers have correct message handler solver_->passInMessageHandler(handler_); continuousSolver_->passInMessageHandler(handler_); bool newMethod = (baseModel->branchingMethod_ && baseModel->branchingMethod_->chooseMethod()); if (newMethod) { // new method uses solver - but point to base model // We may update an object in wrong order - shouldn't matter? numberObjects_ = baseModel->numberObjects_; if (parallelMode() >= 0) { object_ = baseModel->object_; } else { printf("*****WARNING - fix testosi option\n"); object_ = baseModel->object_; } } int i; for (i = 0; i < numberHeuristics_; i++) { delete heuristic_[i]; heuristic_[i] = baseModel->heuristic_[i]->clone(); heuristic_[i]->setModelOnly(this); } for (i = 0; i < numberCutGenerators_; i++) { delete generator_[i]; generator_[i] = new CbcCutGenerator(*baseModel->generator_[i]); // refreshModel was overkill as thought too many rows if (generator_[i]->needsRefresh()) generator_[i]->refreshModel(this); else generator_[i]->setModel(this); } } else if (mode == 10) { setCutoff(baseModel->getCutoff()); bestObjective_ = baseModel->bestObjective_; //assert (!baseModel->globalCuts_.sizeRowCuts()); numberSolutions_ = baseModel->numberSolutions_; assert (usedInSolution_); assert (baseModel->usedInSolution_); memcpy(usedInSolution_, baseModel->usedInSolution_, solver_->getNumCols()*sizeof(int)); stateOfSearch_ = baseModel->stateOfSearch_; //numberNodes_ = baseModel->numberNodes_; //numberIterations_ = baseModel->numberIterations_; //numberFixedAtRoot_ = numberIterations_; // for statistics phase_ = baseModel->phase_; assert (!nextRowCut_); delete nodeCompare_; nodeCompare_ = baseModel->nodeCompare_->clone(); tree_->setComparison(*nodeCompare_) ; assert (!subTreeModel_); //branchingMethod_ = NULL; // need something but what numberOldActiveCuts_ = baseModel->numberOldActiveCuts_; cutModifier_ = NULL; assert (!analyzeResults_); CbcThread * stuff = reinterpret_cast (masterThread_); assert (stuff); //if (stuff) stuff->setCreatedNode(NULL); // ?? searchStrategy_; searchStrategy_ = baseModel->searchStrategy_; stuff->saveStuff()[0] = searchStrategy_; stateOfSearch_ = baseModel->stateOfSearch_; stuff->saveStuff()[1] = stateOfSearch_; OsiObject ** baseObject = baseModel->object_; for (int iObject = 0 ; iObject < numberObjects_ ; iObject++) { object_[iObject]->updateBefore(baseObject[iObject]); } //delete [] stuff->nodeCount; //stuff->nodeCount = new int [baseModel->maximumDepth_+1]; } else if (mode == 11) { if (parallelMode() < 0) { // from deterministic CbcThread * stuff = reinterpret_cast (masterThread_); assert (stuff); // Move solution etc // might as well mark all including continuous int numberColumns = solver_->getNumCols(); for (int i = 0; i < numberColumns; i++) { baseModel->usedInSolution_[i] += usedInSolution_[i]; //usedInSolution_[i]=0; } baseModel->numberSolutions_ += numberSolutions_; if (bestObjective_ < baseModel->bestObjective_ && bestObjective_ < baseModel->getCutoff()) { baseModel->bestObjective_ = bestObjective_ ; int numberColumns = solver_->getNumCols(); if (!baseModel->bestSolution_) baseModel->bestSolution_ = new double[numberColumns]; CoinCopyN(bestSolution_, numberColumns, baseModel->bestSolution_); baseModel->setCutoff(getCutoff()); baseModel->handler_->message(CBC_ROUNDING, messages_) << bestObjective_ << "heuristic" << baseModel->numberIterations_ << baseModel->numberNodes_ << getCurrentSeconds() << CoinMessageEol; } //stateOfSearch_ if (stuff->saveStuff()[0] != searchStrategy_) { #ifdef COIN_DEVELOP printf("changing searchStrategy from %d to %d\n", baseModel->searchStrategy_, searchStrategy_); #endif baseModel->searchStrategy_ = searchStrategy_; } if (stuff->saveStuff()[1] != stateOfSearch_) { #ifdef COIN_DEVELOP printf("changing stateOfSearch from %d to %d\n", baseModel->stateOfSearch_, stateOfSearch_); #endif baseModel->stateOfSearch_ = stateOfSearch_; } int i; if (eventHappened_) baseModel->eventHappened_ = true; baseModel->numberNodes_ += stuff->nodesThisTime(); baseModel->numberIterations_ += stuff->iterationsThisTime(); double cutoff = baseModel->getCutoff(); while (!tree_->empty()) { CbcNode * node = tree_->bestNode(COIN_DBL_MAX) ; if (node->objectiveValue() < cutoff) { assert(node->nodeInfo()); // Make node join correctly OsiBranchingObject * bobj = node->modifiableBranchingObject(); CbcBranchingObject * cbcobj = dynamic_cast (bobj); if (cbcobj) { CbcObject * object = cbcobj->object(); assert (object); int position = object->position(); assert (position >= 0); assert (object_[position] == object); CbcObject * objectNew = dynamic_cast (baseModel->object_[position]); cbcobj->setOriginalObject(objectNew); } baseModel->tree_->push(node); } else { delete node; } } for (i = 0; i < stuff->nDeleteNode(); i++) { //printf("CbcNode %x stuff delete\n",stuff->delNode[i]); delete stuff->delNode()[i]; } } } else { abort(); } } // Generate one round of cuts - parallel mode int CbcModel::parallelCuts(CbcBaseModel * master, OsiCuts & theseCuts, CbcNode * /*node*/, OsiCuts & slackCuts, int lastNumberCuts) { /* Is it time to scan the cuts in order to remove redundant cuts? If so, set up to do it. */ int fullScan = 0 ; if ((numberNodes_ % SCANCUTS) == 0 || (specialOptions_&256) != 0) { fullScan = 1 ; if (!numberNodes_ || (specialOptions_&256) != 0) fullScan = 2; specialOptions_ &= ~256; // mark as full scan done } // do cuts independently OsiCuts * eachCuts = new OsiCuts [numberCutGenerators_];; int i; assert (master); for (i = 0; i < numberThreads_; i++) { // set solver here after cloning master->model(i)->solver_ = solver_->clone(); master->model(i)->numberNodes_ = (fullScan) ? 1 : 0; } // generate cuts int status = 0; const OsiRowCutDebugger * debugger = NULL; bool onOptimalPath = false; for (i = 0; i < numberCutGenerators_; i++) { bool generate = generator_[i]->normal(); // skip if not optimal and should be (maybe a cut generator has fixed variables) if (generator_[i]->needsOptimalBasis() && !solver_->basisIsAvailable()) generate = false; if (generator_[i]->switchedOff()) generate = false;; if (generate) { master->waitForThreadsInCuts(0, eachCuts + i, i); } } // wait master->waitForThreadsInCuts(1, eachCuts, 0); // Now put together for (i = 0; i < numberCutGenerators_; i++) { // add column cuts int numberColumnCutsBefore = theseCuts.sizeColCuts() ; int numberColumnCuts = eachCuts[i].sizeColCuts(); int numberColumnCutsAfter = numberColumnCutsBefore + numberColumnCuts; int j; for (j = 0; j < numberColumnCuts; j++) { theseCuts.insert(eachCuts[i].colCut(j)); } int numberRowCutsBefore = theseCuts.sizeRowCuts() ; int numberRowCuts = eachCuts[i].sizeRowCuts(); // insert good cuts if (numberRowCuts) { int n = numberRowCuts; numberRowCuts = 0; for (j = 0; j < n; j++) { const OsiRowCut * thisCut = eachCuts[i].rowCutPtr(j) ; if (thisCut->lb() <= 1.0e10 && thisCut->ub() >= -1.0e10) { theseCuts.insert(eachCuts[i].rowCut(j)); numberRowCuts++; } } if (generator_[i]->mustCallAgain() && status >= 0) status = 1; // say must go round } int numberRowCutsAfter = numberRowCutsBefore + numberRowCuts; if (numberRowCuts) { // Check last cut to see if infeasible const OsiRowCut * thisCut = theseCuts.rowCutPtr(numberRowCutsAfter - 1) ; if (thisCut->lb() > thisCut->ub()) { status = -1; // sub-problem is infeasible break; } } #ifdef CBC_DEBUG { int k ; for (k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { OsiRowCut thisCut = theseCuts.rowCut(k) ; /* check size of elements. We can allow smaller but this helps debug generators as it is unsafe to have small elements */ int n = thisCut.row().getNumElements(); const int * column = thisCut.row().getIndices(); const double * element = thisCut.row().getElements(); //assert (n); for (int i = 0; i < n; i++) { double value = element[i]; assert(fabs(value) > 1.0e-12 && fabs(value) < 1.0e20); } } } #endif if ((specialOptions_&1) != 0) { if (onOptimalPath) { int k ; for (k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { OsiRowCut thisCut = theseCuts.rowCut(k) ; if (debugger->invalidCut(thisCut)) { solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_); solver_->writeMpsNative("badCut.mps", NULL, NULL, 2); #ifdef NDEBUG printf("Cut generator %d (%s) produced invalid cut (%dth in this go)\n", i, generator_[i]->cutGeneratorName(), k - numberRowCutsBefore); const double *lower = getColLower() ; const double *upper = getColUpper() ; int numberColumns = solver_->getNumCols(); for (int i = 0; i < numberColumns; i++) printf("%d bounds %g,%g\n", i, lower[i], upper[i]); abort(); #endif } assert(!debugger->invalidCut(thisCut)) ; } } } /* The cut generator has done its thing, and maybe it generated some cuts. Do a bit of bookkeeping: load whichGenerator[i] with the index of the generator responsible for a cut, and place cuts flagged as global in the global cut pool for the model. lastNumberCuts is the sum of cuts added in previous iterations; it's the offset to the proper starting position in whichGenerator. */ int numberBefore = numberRowCutsBefore + numberColumnCutsBefore + lastNumberCuts ; int numberAfter = numberRowCutsAfter + numberColumnCutsAfter + lastNumberCuts ; // possibly extend whichGenerator resizeWhichGenerator(numberBefore, numberAfter); for (j = numberRowCutsBefore; j < numberRowCutsAfter; j++) { whichGenerator_[numberBefore++] = i ; const OsiRowCut * thisCut = theseCuts.rowCutPtr(j) ; if (thisCut->lb() > thisCut->ub()) status = -1; // sub-problem is infeasible if (thisCut->globallyValid()) { // add to global list OsiRowCut newCut(*thisCut); newCut.setGloballyValid(true); newCut.mutableRow().setTestForDuplicateIndex(false); globalCuts_.addCutIfNotDuplicate(newCut) ; } } for (j = numberColumnCutsBefore; j < numberColumnCutsAfter; j++) { //whichGenerator_[numberBefore++] = i ; const OsiColCut * thisCut = theseCuts.colCutPtr(j) ; if (thisCut->globallyValid()) { // add to global list makeGlobalCut(thisCut); } } } // Add in any violated saved cuts if (!theseCuts.sizeRowCuts() && !theseCuts.sizeColCuts()) { int numberOld = theseCuts.sizeRowCuts() + lastNumberCuts; int numberCuts = slackCuts.sizeRowCuts() ; int i; // possibly extend whichGenerator resizeWhichGenerator(numberOld, numberOld + numberCuts); double primalTolerance; solver_->getDblParam(OsiPrimalTolerance, primalTolerance) ; for ( i = 0; i < numberCuts; i++) { const OsiRowCut * thisCut = slackCuts.rowCutPtr(i) ; if (thisCut->violated(cbcColSolution_) > 100.0*primalTolerance) { if (messageHandler()->logLevel() > 2) printf("Old cut added - violation %g\n", thisCut->violated(cbcColSolution_)) ; whichGenerator_[numberOld++] = 999; theseCuts.insert(*thisCut) ; } } } delete [] eachCuts; return status; } /* Locks a thread if parallel so that stuff like cut pool can be updated and/or used. */ void CbcModel::lockThread() { if (masterThread_ && (threadMode_&1) == 0) masterThread_->lockThread(); } /* Unlocks a thread if parallel */ void CbcModel::unlockThread() { if (masterThread_ && (threadMode_&1) == 0) masterThread_->unlockThread(); } // Returns true if locked bool CbcModel::isLocked() const { if (masterThread_) { return (masterThread_->locked()); } else { return true; } } // Stop a child void CbcModel::setInfoInChild(int type, CbcThread * info) { if (type == -3) { // set up masterThread_ = info; } else if (type == -2) { numberThreads_ = 0; // signal to stop } else { // make sure message handler will be deleted defaultHandler_ = true; ownObjects_ = false; delete solverCharacteristics_; solverCharacteristics_ = NULL; if (type >= 0) { delete [] object_; // may be able to when all over to CbcThread for (int i = 0; i < numberCutGenerators_; i++) { delete generator_[i]; generator_[i] = NULL; //delete virginGenerator_[i]; //virginGenerator_[i]=NULL; } //generator_[0] = NULL; //delete [] generator_; //generator_ = NULL; numberCutGenerators_ = 0; } else { for (int i = 0; i < numberCutGenerators_; i++) { generator_[i] = NULL; } } object_ = NULL; } } /// Indicates whether Cbc library has been compiled with multithreading support bool CbcModel::haveMultiThreadSupport() { return true; } #else // Default constructor CbcBaseModel::CbcBaseModel() {} bool CbcModel::haveMultiThreadSupport() { return false; } #endif CoinMP-1.8.3/Cbc/src/CbcCompareDefault.hpp0000644000175000017500000000721312131054770016611 0ustar renerene// $Id: CbcCompareDefault.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCompareActual #ifndef CbcCompareDefault_H #define CbcCompareDefault_H //############################################################################# /* These are alternative strategies for node traversal. They can take data etc for fine tuning At present the node list is stored as a heap and the "test" comparison function returns true if node y is better than node x. */ #include "CbcNode.hpp" #include "CbcCompareBase.hpp" #include "CbcCompare.hpp" class CbcModel; /* This is an example of a more complex rule with data It is default after first solution If weight is 0.0 then it is computed to hit first solution less 5% */ class CbcCompareDefault : public CbcCompareBase { public: /// Default Constructor CbcCompareDefault () ; /// Constructor with weight CbcCompareDefault (double weight); /// Copy constructor CbcCompareDefault ( const CbcCompareDefault &rhs); /// Assignment operator CbcCompareDefault & operator=( const CbcCompareDefault& rhs); /// Clone virtual CbcCompareBase * clone() const; /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp); ~CbcCompareDefault() ; /* This returns true if weighted value of node y is less than weighted value of node x */ virtual bool test (CbcNode * x, CbcNode * y) ; using CbcCompareBase::newSolution ; /// This allows method to change behavior as it is called /// after each solution virtual bool newSolution(CbcModel * model, double objectiveAtContinuous, int numberInfeasibilitiesAtContinuous) ; /// This allows method to change behavior /// Return true if want tree re-sorted virtual bool every1000Nodes(CbcModel * model, int numberNodes); /* if weight == -1.0 then fewest infeasibilities (before solution) if -2.0 then do breadth first just for first 1000 nodes if -3.0 then depth first before solution */ inline double getWeight() const { return weight_; } inline void setWeight(double weight) { weight_ = weight; } /// Cutoff inline double getCutoff() const { return cutoff_; } inline void setCutoff(double cutoff) { cutoff_ = cutoff; } /// Best possible solution inline double getBestPossible() const { return bestPossible_; } inline void setBestPossible(double bestPossible) { bestPossible_ = bestPossible; } /// Depth above which want to explore first inline void setBreadthDepth(int value) { breadthDepth_ = value; } /// Start dive void startDive(CbcModel * model); /// Clean up diving (i.e. switch off or prepare) void cleanDive(); protected: /// Weight for each infeasibility double weight_; /// Weight for each infeasibility - computed from solution double saveWeight_; /// Cutoff double cutoff_; /// Best possible solution double bestPossible_; /// Number of solutions int numberSolutions_; /// Tree size (at last check) int treeSize_; /// Depth above which want to explore first int breadthDepth_; /// Chosen node from estimated (-1 is off) int startNodeNumber_; /// Node number when dive started int afterNodeNumber_; /// Indicates doing setup for diving bool setupForDiving_ ; }; #endif //CbcCompareDefault_H CoinMP-1.8.3/Cbc/src/CbcPartialNodeInfo.cpp0000644000175000017500000002222112176740617016736 0ustar renerene// $Id: CbcPartialNodeInfo.cpp 1951 2013-08-02 14:26:23Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/24/09 carved from CbcNode #include "CbcConfig.h" #include //#define CBC_DEBUG 1 //#define CHECK_CUT_COUNTS //#define CHECK_NODE //#define CBC_CHECK_BASIS #include #include #define CUTS #include "CoinPragma.hpp" #include "OsiSolverInterface.hpp" #include "OsiChooseVariable.hpp" #include "OsiAuxInfo.hpp" #include "OsiSolverBranch.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinTime.hpp" #include "CbcModel.hpp" #include "CbcNode.hpp" #include "CbcStatistics.hpp" #include "CbcStrategy.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchDynamic.hpp" #include "OsiRowCut.hpp" #include "OsiRowCutDebugger.hpp" #include "OsiCuts.hpp" #include "CbcCountRowCut.hpp" #include "CbcFeasibilityBase.hpp" #include "CbcMessage.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #include "ClpSimplexOther.hpp" #endif using namespace std; #include "CglCutGenerator.hpp" // Default constructor CbcPartialNodeInfo::CbcPartialNodeInfo() : CbcNodeInfo(), basisDiff_(NULL), variables_(NULL), newBounds_(NULL), numberChangedBounds_(0) { /* this space intentionally left blank */ } // Constructor from current state CbcPartialNodeInfo::CbcPartialNodeInfo (CbcNodeInfo *parent, CbcNode *owner, int numberChangedBounds, const int *variables, const double *boundChanges, const CoinWarmStartDiff *basisDiff) : CbcNodeInfo(parent, owner) { basisDiff_ = basisDiff->clone() ; #ifdef CBC_CHECK_BASIS std::cout << "Constructor (" << this << ") " << std::endl ; #endif numberChangedBounds_ = numberChangedBounds; size_t size = numberChangedBounds_ * (sizeof(double) + sizeof(int)); char * temp = new char [size]; newBounds_ = reinterpret_cast (temp); variables_ = reinterpret_cast (newBounds_ + numberChangedBounds_); int i ; for (i = 0; i < numberChangedBounds_; i++) { variables_[i] = variables[i]; newBounds_[i] = boundChanges[i]; } } CbcPartialNodeInfo::CbcPartialNodeInfo (const CbcPartialNodeInfo & rhs) : CbcNodeInfo(rhs) { basisDiff_ = rhs.basisDiff_->clone() ; #ifdef CBC_CHECK_BASIS std::cout << "Copy constructor (" << this << ") from " << this << std::endl ; #endif numberChangedBounds_ = rhs.numberChangedBounds_; size_t size = numberChangedBounds_ * (sizeof(double) + sizeof(int)); char * temp = new char [size]; newBounds_ = reinterpret_cast (temp); variables_ = reinterpret_cast (newBounds_ + numberChangedBounds_); int i ; for (i = 0; i < numberChangedBounds_; i++) { variables_[i] = rhs.variables_[i]; newBounds_[i] = rhs.newBounds_[i]; } } CbcNodeInfo * CbcPartialNodeInfo::clone() const { return (new CbcPartialNodeInfo(*this)); } CbcPartialNodeInfo::~CbcPartialNodeInfo () { delete basisDiff_ ; delete [] newBounds_; } /** The basis supplied as a parameter is incrementally modified, and lower and upper bounds on variables in the model are incrementally modified. Any cuts associated with this node are added to the list in addCuts. */ void CbcPartialNodeInfo::applyToModel (CbcModel *model, CoinWarmStartBasis *&basis, CbcCountRowCut **addCuts, int ¤tNumberCuts) const { OsiSolverInterface *solver = model->solver(); if ((active_&4) != 0 && basis) { basis->applyDiff(basisDiff_) ; #ifdef CBC_CHECK_BASIS std::cout << "Basis (after applying " << this << ") " << std::endl ; basis->print() ; #endif } // branch - do bounds int i; if ((active_&1) != 0) { for (i = 0; i < numberChangedBounds_; i++) { int variable = variables_[i]; int k = variable & 0x3fffffff; if ((variable&0x80000000) == 0) { // lower bound changing //#define CBC_PRINT2 #ifdef CBC_PRINT2 if (solver->getColLower()[k] != newBounds_[i]) printf("lower change for column %d - from %g to %g\n", k, solver->getColLower()[k], newBounds_[i]); #endif #ifndef NDEBUG if ((variable&0x40000000) == 0 && false) { double oldValue = solver->getColLower()[k]; assert (newBounds_[i] > oldValue - 1.0e-8); if (newBounds_[i] < oldValue + 1.0e-8) printf("bad null lower change for column %d - bound %g\n", k, oldValue); } #endif solver->setColLower(k, newBounds_[i]); } else { // upper bound changing #ifdef CBC_PRINT2 if (solver->getColUpper()[k] != newBounds_[i]) printf("upper change for column %d - from %g to %g\n", k, solver->getColUpper()[k], newBounds_[i]); #endif #ifndef NDEBUG if ((variable&0x40000000) == 0 && false) { double oldValue = solver->getColUpper()[k]; assert (newBounds_[i] < oldValue + 1.0e-8); if (newBounds_[i] > oldValue - 1.0e-8) printf("bad null upper change for column %d - bound %g\n", k, oldValue); } #endif solver->setColUpper(k, newBounds_[i]); } } } if ((active_&2) != 0) { for (i = 0; i < numberCuts_; i++) { addCuts[currentNumberCuts+i] = cuts_[i]; if (cuts_[i] && model->messageHandler()->logLevel() > 4) { cuts_[i]->print(); } } currentNumberCuts += numberCuts_; } return ; } // Just apply bounds to one variable (1=>infeasible) int CbcPartialNodeInfo::applyBounds(int iColumn, double & lower, double & upper, int force) { // branch - do bounds int i; int found = 0; double newLower = -COIN_DBL_MAX; double newUpper = COIN_DBL_MAX; for (i = 0; i < numberChangedBounds_; i++) { int variable = variables_[i]; int k = variable & 0x3fffffff; if (k == iColumn) { if ((variable&0x80000000) == 0) { // lower bound changing found |= 1; newLower = CoinMax(newLower, newBounds_[i]); if ((force&1) == 0) { if (lower > newBounds_[i]) COIN_DETAIL_PRINT(printf("%d odd lower going from %g to %g\n", iColumn, lower, newBounds_[i])); lower = newBounds_[i]; } else { newBounds_[i] = lower; variables_[i] |= 0x40000000; // say can go odd way } } else { // upper bound changing found |= 2; newUpper = CoinMin(newUpper, newBounds_[i]); if ((force&2) == 0) { if (upper < newBounds_[i]) COIN_DETAIL_PRINT(printf("%d odd upper going from %g to %g\n", iColumn, upper, newBounds_[i])); upper = newBounds_[i]; } else { newBounds_[i] = upper; variables_[i] |= 0x40000000; // say can go odd way } } } } newLower = CoinMax(newLower, lower); newUpper = CoinMin(newUpper, upper); int nAdd = 0; if ((force&2) != 0 && (found&2) == 0) { // need to add new upper nAdd++; } if ((force&1) != 0 && (found&1) == 0) { // need to add new lower nAdd++; } if (nAdd) { size_t size = (numberChangedBounds_ + nAdd) * (sizeof(double) + sizeof(int)); char * temp = new char [size]; double * newBounds = reinterpret_cast (temp); int * variables = reinterpret_cast (newBounds + numberChangedBounds_ + nAdd); int i ; for (i = 0; i < numberChangedBounds_; i++) { variables[i] = variables_[i]; newBounds[i] = newBounds_[i]; } delete [] newBounds_; newBounds_ = newBounds; variables_ = variables; if ((force&2) != 0 && (found&2) == 0) { // need to add new upper int variable = iColumn | 0x80000000; variables_[numberChangedBounds_] = variable; newBounds_[numberChangedBounds_++] = newUpper; } if ((force&1) != 0 && (found&1) == 0) { // need to add new lower int variable = iColumn; variables_[numberChangedBounds_] = variable; newBounds_[numberChangedBounds_++] = newLower; } } return (newUpper >= newLower) ? 0 : 1; } /* Builds up row basis backwards (until original model). Returns NULL or previous one to apply . Depends on Free being 0 and impossible for cuts */ CbcNodeInfo * CbcPartialNodeInfo::buildRowBasis(CoinWarmStartBasis & basis ) const { basis.applyDiff(basisDiff_) ; return parent_ ; } CoinMP-1.8.3/Cbc/src/CbcLinked.hpp0000644000175000017500000012201112131054770015116 0ustar renerene/* $Id: CbcLinked.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CglLinked_H #define CglLinked_H /* THIS CONTAINS STUFF THAT SHOULD BE IN OsiSolverLink OsiBranchLink CglTemporary */ #include "CoinModel.hpp" #include "OsiClpSolverInterface.hpp" #include "OsiChooseVariable.hpp" #include "CbcFathom.hpp" class CbcModel; class CoinPackedMatrix; class OsiLinkedBound; class OsiObject; class CglStored; class CglTemporary; /** This is to allow the user to replace initialSolve and resolve This version changes coefficients */ class OsiSolverLink : public CbcOsiSolver { public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /** Problem specific Returns -1 if node fathomed and no solution 0 if did nothing 1 if node fathomed and solution allFixed is true if all LinkedBound variables are fixed */ virtual int fathom(bool allFixed) ; /** Solves nonlinear problem from CoinModel using SLP - may be used as crash for other algorithms when number of iterations small. Also exits if all problematical variables are changing less than deltaTolerance Returns solution array */ double * nonlinearSLP(int numberPasses, double deltaTolerance); /** Solve linearized quadratic objective branch and bound. Return cutoff and OA cut */ double linearizedBAB(CglStored * cut) ; /** Solves nonlinear problem from CoinModel using SLP - and then tries to get heuristic solution Returns solution array mode - 0 just get continuous 1 round and try normal bab 2 use defaultBound_ to bound integer variables near current solution */ double * heuristicSolution(int numberPasses, double deltaTolerance, int mode); /// Do OA cuts int doAOCuts(CglTemporary * cutGen, const double * solution, const double * solution2); //@} /**@name Constructors and destructors */ //@{ /// Default Constructor OsiSolverLink (); /** This creates from a coinModel object if errors.then number of sets is -1 This creates linked ordered sets information. It assumes - for product terms syntax is yy*f(zz) also just f(zz) is allowed and even a constant modelObject not const as may be changed as part of process. */ OsiSolverLink( CoinModel & modelObject); // Other way with existing object void load( CoinModel & modelObject, bool tightenBounds = false, int logLevel = 1); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiSolverLink (const OsiSolverLink &); /// Assignment operator OsiSolverLink & operator=(const OsiSolverLink& rhs); /// Destructor virtual ~OsiSolverLink (); //@} /**@name Sets and Gets */ //@{ /// Add a bound modifier void addBoundModifier(bool upperBoundAffected, bool useUpperBound, int whichVariable, int whichVariableAffected, double multiplier = 1.0); /// Update coefficients - returns number updated if in updating mode int updateCoefficients(ClpSimplex * solver, CoinPackedMatrix * matrix); /// Analyze constraints to see which are convex (quadratic) void analyzeObjects(); /// Add reformulated bilinear constraints void addTighterConstraints(); /// Objective value of best solution found internally inline double bestObjectiveValue() const { return bestObjectiveValue_; } /// Set objective value of best solution found internally inline void setBestObjectiveValue(double value) { bestObjectiveValue_ = value; } /// Best solution found internally inline const double * bestSolution() const { return bestSolution_; } /// Set best solution found internally void setBestSolution(const double * solution, int numberColumns); /// Set special options inline void setSpecialOptions2(int value) { specialOptions2_ = value; } /// Say convex (should work it out) - if convex false then strictly concave void sayConvex(bool convex); /// Get special options inline int specialOptions2() const { return specialOptions2_; } /** Clean copy of matrix So we can add rows */ CoinPackedMatrix * cleanMatrix() const { return matrix_; } /** Row copy of matrix Just genuine columns and rows Linear part */ CoinPackedMatrix * originalRowCopy() const { return originalRowCopy_; } /// Copy of quadratic model if one ClpSimplex * quadraticModel() const { return quadraticModel_; } /// Gets correct form for a quadratic row - user to delete CoinPackedMatrix * quadraticRow(int rowNumber, double * linear) const; /// Default meshSize inline double defaultMeshSize() const { return defaultMeshSize_; } inline void setDefaultMeshSize(double value) { defaultMeshSize_ = value; } /// Default maximumbound inline double defaultBound() const { return defaultBound_; } inline void setDefaultBound(double value) { defaultBound_ = value; } /// Set integer priority inline void setIntegerPriority(int value) { integerPriority_ = value; } /// Get integer priority inline int integerPriority() const { return integerPriority_; } /// Objective transfer variable if one inline int objectiveVariable() const { return objectiveVariable_; } /// Set biLinear priority inline void setBiLinearPriority(int value) { biLinearPriority_ = value; } /// Get biLinear priority inline int biLinearPriority() const { return biLinearPriority_; } /// Return CoinModel inline const CoinModel * coinModel() const { return &coinModel_; } /// Set all biLinear priorities on x-x variables void setBiLinearPriorities(int value, double meshSize = 1.0); /** Set options and priority on all or some biLinear variables 1 - on I-I 2 - on I-x 4 - on x-x or combinations. -1 means leave (for priority value and strategy value) */ void setBranchingStrategyOnVariables(int strategyValue, int priorityValue = -1, int mode = 7); /// Set all mesh sizes on x-x variables void setMeshSizes(double value); /** Two tier integer problem where when set of variables with priority less than this are fixed the problem becomes an easier integer problem */ void setFixedPriority(int priorityValue); //@} //--------------------------------------------------------------------------- protected: /**@name functions */ //@{ /// Do real work of initialize //void initialize(ClpSimplex * & solver, OsiObject ** & object) const; /// Do real work of delete void gutsOfDestructor(bool justNullify = false); /// Do real work of copy void gutsOfCopy(const OsiSolverLink & rhs) ; //@} /**@name Private member data */ //@{ /** Clean copy of matrix Marked coefficients will be multiplied by L or U */ CoinPackedMatrix * matrix_; /** Row copy of matrix Just genuine columns and rows */ CoinPackedMatrix * originalRowCopy_; /// Copy of quadratic model if one ClpSimplex * quadraticModel_; /// Number of rows with nonLinearities int numberNonLinearRows_; /// Starts of lists int * startNonLinear_; /// Row number for a list int * rowNonLinear_; /** Indicator whether is convex, concave or neither -1 concave, 0 neither, +1 convex */ int * convex_; /// Indices in a list/row int * whichNonLinear_; /// Model in CoinModel format CoinModel coinModel_; /// Number of variables in tightening phase int numberVariables_; /// Information OsiLinkedBound * info_; /** 0 bit (1) - call fathom (may do mini B&B) 1 bit (2) - quadratic only in objective (add OA cuts) 2 bit (4) - convex 3 bit (8) - try adding OA cuts 4 bit (16) - add linearized constraints */ int specialOptions2_; /// Objective transfer row if one int objectiveRow_; /// Objective transfer variable if one int objectiveVariable_; /// Objective value of best solution found internally double bestObjectiveValue_; /// Default mesh double defaultMeshSize_; /// Default maximum bound double defaultBound_; /// Best solution found internally double * bestSolution_; /// Priority for integers int integerPriority_; /// Priority for bilinear int biLinearPriority_; /// Number of variables which when fixed help int numberFix_; /// list of fixed variables int * fixVariables_; //@} }; /** List of bounds which depend on other bounds */ class OsiLinkedBound { public: //--------------------------------------------------------------------------- /**@name Action methods */ //@{ /// Update other bounds void updateBounds(ClpSimplex * solver); //@} /**@name Constructors and destructors */ //@{ /// Default Constructor OsiLinkedBound (); /// Useful Constructor OsiLinkedBound(OsiSolverInterface * model, int variable, int numberAffected, const int * positionL, const int * positionU, const double * multiplier); /// Copy constructor OsiLinkedBound (const OsiLinkedBound &); /// Assignment operator OsiLinkedBound & operator=(const OsiLinkedBound& rhs); /// Destructor ~OsiLinkedBound (); //@} /**@name Sets and Gets */ //@{ /// Get variable inline int variable() const { return variable_; } /// Add a bound modifier void addBoundModifier(bool upperBoundAffected, bool useUpperBound, int whichVariable, double multiplier = 1.0); //@} private: typedef struct { double multiplier; // to use in computation int affected; // variable or element affected /* 0 - LB of variable affected 1 - UB of variable affected 2 - element in position (affected) affected */ unsigned char affect; unsigned char ubUsed; // nonzero if UB of this variable is used /* 0 - use x*multiplier 1 - use multiplier/x 2 - if UB use min of current upper and x*multiplier, if LB use max of current lower and x*multiplier */ unsigned char type; // type of computation } boundElementAction; /**@name Private member data */ //@{ /// Pointer back to model OsiSolverInterface * model_; /// Variable int variable_; /// Number of variables/elements affected int numberAffected_; /// Maximum number of variables/elements affected int maximumAffected_; /// Actions boundElementAction * affected_; //@} }; #include "CbcHeuristic.hpp" /** heuristic - just picks up any good solution */ class CbcHeuristicDynamic3 : public CbcHeuristic { public: // Default Constructor CbcHeuristicDynamic3 (); /* Constructor with model */ CbcHeuristicDynamic3 (CbcModel & model); // Copy constructor CbcHeuristicDynamic3 ( const CbcHeuristicDynamic3 &); // Destructor ~CbcHeuristicDynamic3 (); /// Clone virtual CbcHeuristic * clone() const; /// update model virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) We leave all variables which are at one at this node of the tree to that value and will initially set all others to zero. We then sort all variables in order of their cost divided by the number of entries in rows which are not yet covered. We randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic. We then choose the best one and set it to one and repeat the exercise. */ virtual int solution(double & objectiveValue, double * newSolution); /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// Returns true if can deal with "odd" problems e.g. sos type 2 virtual bool canDealWithOdd() const { return true; } protected: private: /// Illegal Assignment operator CbcHeuristicDynamic3 & operator=(const CbcHeuristicDynamic3& rhs); }; #include "OsiBranchingObject.hpp" /** Define Special Linked Ordered Sets. */ class CoinWarmStartBasis; class OsiOldLink : public OsiSOS { public: // Default Constructor OsiOldLink (); /** Useful constructor - A valid solution is if all variables are zero apart from k*numberLink to (k+1)*numberLink-1 where k is 0 through numberInSet-1. The length of weights array is numberInSet. For this constructor the variables in matrix are the numberInSet*numberLink starting at first. If weights null then 0,1,2.. */ OsiOldLink (const OsiSolverInterface * solver, int numberMembers, int numberLinks, int first, const double * weights, int setNumber); /** Useful constructor - A valid solution is if all variables are zero apart from k*numberLink to (k+1)*numberLink-1 where k is 0 through numberInSet-1. The length of weights array is numberInSet. For this constructor the variables are given by list - grouped. If weights null then 0,1,2.. */ OsiOldLink (const OsiSolverInterface * solver, int numberMembers, int numberLinks, int typeSOS, const int * which, const double * weights, int setNumber); // Copy constructor OsiOldLink ( const OsiOldLink &); /// Clone virtual OsiObject * clone() const; // Assignment operator OsiOldLink & operator=( const OsiOldLink& rhs); // Destructor virtual ~OsiOldLink (); using OsiObject::infeasibility ; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int & whichWay) const; using OsiObject::feasibleRegion ; /** Set bounds to fix the variable at the current (integer) value. Given an integer value, set the lower and upper bounds to fix the variable. Returns amount it had to move variable. */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** Creates a branching object The preferred direction is set by \p way, 0 for down, 1 for up. */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; /// Redoes data when sequence numbers change virtual void resetSequenceEtc(int numberColumns, const int * originalColumns); /// Number of links for each member inline int numberLinks() const { return numberLinks_; } /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const { return false; } /** \brief Return true if branch should only bound variables */ virtual bool boundBranch() const { return false; } private: /// data /// Number of links int numberLinks_; }; /** Branching object for Linked ordered sets */ class OsiOldLinkBranchingObject : public OsiSOSBranchingObject { public: // Default Constructor OsiOldLinkBranchingObject (); // Useful constructor OsiOldLinkBranchingObject (OsiSolverInterface * solver, const OsiOldLink * originalObject, int way, double separator); // Copy constructor OsiOldLinkBranchingObject ( const OsiOldLinkBranchingObject &); // Assignment operator OsiOldLinkBranchingObject & operator=( const OsiOldLinkBranchingObject& rhs); /// Clone virtual OsiBranchingObject * clone() const; // Destructor virtual ~OsiOldLinkBranchingObject (); using OsiBranchingObject::branch ; /// Does next branch and updates state virtual double branch(OsiSolverInterface * solver); using OsiBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(const OsiSolverInterface * solver = NULL); private: /// data }; /** Define data for one link */ class OsiOneLink { public: // Default Constructor OsiOneLink (); /** Useful constructor - */ OsiOneLink (const OsiSolverInterface * solver, int xRow, int xColumn, int xyRow, const char * functionString); // Copy constructor OsiOneLink ( const OsiOneLink &); // Assignment operator OsiOneLink & operator=( const OsiOneLink& rhs); // Destructor virtual ~OsiOneLink (); /// data /// Row which defines x (if -1 then no x) int xRow_; /// Column which defines x int xColumn_; /// Output row int xyRow; /// Function std::string function_; }; /** Define Special Linked Ordered Sets. New style members and weights may be stored in SOS object This is for y and x*f(y) and z*g(y) etc */ class OsiLink : public OsiSOS { public: // Default Constructor OsiLink (); /** Useful constructor - */ OsiLink (const OsiSolverInterface * solver, int yRow, int yColumn, double meshSize); // Copy constructor OsiLink ( const OsiLink &); /// Clone virtual OsiObject * clone() const; // Assignment operator OsiLink & operator=( const OsiLink& rhs); // Destructor virtual ~OsiLink (); using OsiObject::infeasibility ; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int & whichWay) const; using OsiObject::feasibleRegion ; /** Set bounds to fix the variable at the current (integer) value. Given an integer value, set the lower and upper bounds to fix the variable. Returns amount it had to move variable. */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** Creates a branching object The preferred direction is set by \p way, 0 for down, 1 for up. */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; /// Redoes data when sequence numbers change virtual void resetSequenceEtc(int numberColumns, const int * originalColumns); /// Number of links for each member inline int numberLinks() const { return numberLinks_; } /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const { return false; } /** \brief Return true if branch should only bound variables */ virtual bool boundBranch() const { return false; } private: /// data /// Current increment for y points double meshSize_; /// Links OsiOneLink * data_; /// Number of links int numberLinks_; /// Row which defines y int yRow_; /// Column which defines y int yColumn_; }; /** Branching object for Linked ordered sets */ class OsiLinkBranchingObject : public OsiTwoWayBranchingObject { public: // Default Constructor OsiLinkBranchingObject (); // Useful constructor OsiLinkBranchingObject (OsiSolverInterface * solver, const OsiLink * originalObject, int way, double separator); // Copy constructor OsiLinkBranchingObject ( const OsiLinkBranchingObject &); // Assignment operator OsiLinkBranchingObject & operator=( const OsiLinkBranchingObject& rhs); /// Clone virtual OsiBranchingObject * clone() const; // Destructor virtual ~OsiLinkBranchingObject (); using OsiBranchingObject::branch ; /// Does next branch and updates state virtual double branch(OsiSolverInterface * solver); using OsiBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(const OsiSolverInterface * solver = NULL); private: /// data }; /** Define BiLinear objects This models x*y where one or both are integer */ class OsiBiLinear : public OsiObject2 { public: // Default Constructor OsiBiLinear (); /** Useful constructor - This Adds in rows and variables to construct valid Linked Ordered Set Adds extra constraints to match other x/y So note not const solver */ OsiBiLinear (OsiSolverInterface * solver, int xColumn, int yColumn, int xyRow, double coefficient, double xMesh, double yMesh, int numberExistingObjects = 0, const OsiObject ** objects = NULL ); /** Useful constructor - This Adds in rows and variables to construct valid Linked Ordered Set Adds extra constraints to match other x/y So note not const model */ OsiBiLinear (CoinModel * coinModel, int xColumn, int yColumn, int xyRow, double coefficient, double xMesh, double yMesh, int numberExistingObjects = 0, const OsiObject ** objects = NULL ); // Copy constructor OsiBiLinear ( const OsiBiLinear &); /// Clone virtual OsiObject * clone() const; // Assignment operator OsiBiLinear & operator=( const OsiBiLinear& rhs); // Destructor virtual ~OsiBiLinear (); using OsiObject::infeasibility ; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int & whichWay) const; using OsiObject::feasibleRegion ; /** Set bounds to fix the variable at the current (integer) value. Given an integer value, set the lower and upper bounds to fix the variable. Returns amount it had to move variable. */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /** Creates a branching object The preferred direction is set by \p way, 0 for down, 1 for up. */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; /// Redoes data when sequence numbers change virtual void resetSequenceEtc(int numberColumns, const int * originalColumns); // This does NOT set mutable stuff virtual double checkInfeasibility(const OsiBranchingInformation * info) const; /** \brief Return true if object can take part in normal heuristics */ virtual bool canDoHeuristics() const { return false; } /** \brief Return true if branch should only bound variables */ virtual bool boundBranch() const { return (branchingStrategy_&4) != 0; } /// X column inline int xColumn() const { return xColumn_; } /// Y column inline int yColumn() const { return yColumn_; } /// X row inline int xRow() const { return xRow_; } /// Y row inline int yRow() const { return yRow_; } /// XY row inline int xyRow() const { return xyRow_; } /// Coefficient inline double coefficient() const { return coefficient_; } /// Set coefficient inline void setCoefficient(double value) { coefficient_ = value; } /// First lambda (of 4) inline int firstLambda() const { return firstLambda_; } /// X satisfied if less than this away from mesh inline double xSatisfied() const { return xSatisfied_; } inline void setXSatisfied(double value) { xSatisfied_ = value; } /// Y satisfied if less than this away from mesh inline double ySatisfied() const { return ySatisfied_; } inline void setYSatisfied(double value) { ySatisfied_ = value; } /// X other satisfied if less than this away from mesh inline double xOtherSatisfied() const { return xOtherSatisfied_; } inline void setXOtherSatisfied(double value) { xOtherSatisfied_ = value; } /// Y other satisfied if less than this away from mesh inline double yOtherSatisfied() const { return yOtherSatisfied_; } inline void setYOtherSatisfied(double value) { yOtherSatisfied_ = value; } /// X meshSize inline double xMeshSize() const { return xMeshSize_; } inline void setXMeshSize(double value) { xMeshSize_ = value; } /// Y meshSize inline double yMeshSize() const { return yMeshSize_; } inline void setYMeshSize(double value) { yMeshSize_ = value; } /// XY satisfied if two version differ by less than this inline double xySatisfied() const { return xySatisfied_; } inline void setXYSatisfied(double value) { xySatisfied_ = value; } /// Set sizes and other stuff void setMeshSizes(const OsiSolverInterface * solver, double x, double y); /** branching strategy etc bottom 2 bits 0 branch on either, 1 branch on x, 2 branch on y next bit 4 set to say don't update coefficients next bit 8 set to say don't use in feasible region next bit 16 set to say - Always satisfied !! */ inline int branchingStrategy() const { return branchingStrategy_; } inline void setBranchingStrategy(int value) { branchingStrategy_ = value; } /** Simple quadratic bound marker. 0 no 1 L if coefficient pos, G if negative i.e. value is ub on xy 2 G if coefficient pos, L if negative i.e. value is lb on xy 3 E If bound then real coefficient is 1.0 and coefficient_ is bound */ inline int boundType() const { return boundType_; } inline void setBoundType(int value) { boundType_ = value; } /// Does work of branching void newBounds(OsiSolverInterface * solver, int way, short xOrY, double separator) const; /// Updates coefficients - returns number updated int updateCoefficients(const double * lower, const double * upper, double * objective, CoinPackedMatrix * matrix, CoinWarmStartBasis * basis) const; /// Returns true value of single xyRow coefficient double xyCoefficient(const double * solution) const; /// Get LU coefficients from matrix void getCoefficients(const OsiSolverInterface * solver, double xB[2], double yB[2], double xybar[4]) const; /// Compute lambdas (third entry in each .B is current value) (nonzero if bad) double computeLambdas(const double xB[3], const double yB[3], const double xybar[4], double lambda[4]) const; /// Adds in data for extra row with variable coefficients void addExtraRow(int row, double multiplier); /// Sets infeasibility and other when pseudo shadow prices void getPseudoShadow(const OsiBranchingInformation * info); /// Gets sum of movements to correct value double getMovement(const OsiBranchingInformation * info); protected: /// Compute lambdas if coefficients not changing void computeLambdas(const OsiSolverInterface * solver, double lambda[4]) const; /// data /// Coefficient double coefficient_; /// x mesh double xMeshSize_; /// y mesh double yMeshSize_; /// x satisfied if less than this away from mesh double xSatisfied_; /// y satisfied if less than this away from mesh double ySatisfied_; /// X other satisfied if less than this away from mesh double xOtherSatisfied_; /// Y other satisfied if less than this away from mesh double yOtherSatisfied_; /// xy satisfied if less than this away from true double xySatisfied_; /// value of x or y to branch about mutable double xyBranchValue_; /// x column int xColumn_; /// y column int yColumn_; /// First lambda (of 4) int firstLambda_; /** branching strategy etc bottom 2 bits 0 branch on either, 1 branch on x, 2 branch on y next bit 4 set to say don't update coefficients next bit 8 set to say don't use in feasible region next bit 16 set to say - Always satisfied !! */ int branchingStrategy_; /** Simple quadratic bound marker. 0 no 1 L if coefficient pos, G if negative i.e. value is ub on xy 2 G if coefficient pos, L if negative i.e. value is lb on xy 3 E If bound then real coefficient is 1.0 and coefficient_ is bound */ int boundType_; /// x row int xRow_; /// y row (-1 if x*x) int yRow_; /// Output row int xyRow_; /// Convexity row int convexity_; /// Number of extra rows (coefficients to be modified) int numberExtraRows_; /// Multiplier for coefficient on row double * multiplier_; /// Row number int * extraRow_; /// Which chosen -1 none, 0 x, 1 y mutable short chosen_; }; /** Branching object for BiLinear objects */ class OsiBiLinearBranchingObject : public OsiTwoWayBranchingObject { public: // Default Constructor OsiBiLinearBranchingObject (); // Useful constructor OsiBiLinearBranchingObject (OsiSolverInterface * solver, const OsiBiLinear * originalObject, int way, double separator, int chosen); // Copy constructor OsiBiLinearBranchingObject ( const OsiBiLinearBranchingObject &); // Assignment operator OsiBiLinearBranchingObject & operator=( const OsiBiLinearBranchingObject& rhs); /// Clone virtual OsiBranchingObject * clone() const; // Destructor virtual ~OsiBiLinearBranchingObject (); using OsiBranchingObject::branch ; /// Does next branch and updates state virtual double branch(OsiSolverInterface * solver); using OsiBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(const OsiSolverInterface * solver = NULL); /** \brief Return true if branch should only bound variables */ virtual bool boundBranch() const; private: /// data /// 1 means branch on x, 2 branch on y short chosen_; }; /** Define Continuous BiLinear objects for an == bound This models x*y = b where both are continuous */ class OsiBiLinearEquality : public OsiBiLinear { public: // Default Constructor OsiBiLinearEquality (); /** Useful constructor - This Adds in rows and variables to construct Ordered Set for x*y = b So note not const solver */ OsiBiLinearEquality (OsiSolverInterface * solver, int xColumn, int yColumn, int xyRow, double rhs, double xMesh); // Copy constructor OsiBiLinearEquality ( const OsiBiLinearEquality &); /// Clone virtual OsiObject * clone() const; // Assignment operator OsiBiLinearEquality & operator=( const OsiBiLinearEquality& rhs); // Destructor virtual ~OsiBiLinearEquality (); /// Possible improvement virtual double improvement(const OsiSolverInterface * solver) const; /** change grid if type 0 then use solution and make finer if 1 then back to original returns mesh size */ double newGrid(OsiSolverInterface * solver, int type) const; /// Number of points inline int numberPoints() const { return numberPoints_; } inline void setNumberPoints(int value) { numberPoints_ = value; } private: /// Number of points int numberPoints_; }; /// Define a single integer class - but one where you keep branching until fixed even if satisfied class OsiSimpleFixedInteger : public OsiSimpleInteger { public: /// Default Constructor OsiSimpleFixedInteger (); /// Useful constructor - passed solver index OsiSimpleFixedInteger (const OsiSolverInterface * solver, int iColumn); /// Useful constructor - passed solver index and original bounds OsiSimpleFixedInteger (int iColumn, double lower, double upper); /// Useful constructor - passed simple integer OsiSimpleFixedInteger (const OsiSimpleInteger &); /// Copy constructor OsiSimpleFixedInteger ( const OsiSimpleFixedInteger &); /// Clone virtual OsiObject * clone() const; /// Assignment operator OsiSimpleFixedInteger & operator=( const OsiSimpleFixedInteger& rhs); /// Destructor virtual ~OsiSimpleFixedInteger (); using OsiObject::infeasibility ; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int & whichWay) const; /** Creates a branching object The preferred direction is set by \p way, 0 for down, 1 for up. */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; protected: /// data }; /** Define a single variable class which is involved with OsiBiLinear objects. This is used so can make better decision on where to branch as it can look at all objects. This version sees if it can re-use code from OsiSimpleInteger even if not an integer variable. If not then need to duplicate code. */ class OsiUsesBiLinear : public OsiSimpleInteger { public: /// Default Constructor OsiUsesBiLinear (); /// Useful constructor - passed solver index OsiUsesBiLinear (const OsiSolverInterface * solver, int iColumn, int type); /// Useful constructor - passed solver index and original bounds OsiUsesBiLinear (int iColumn, double lower, double upper, int type); /// Useful constructor - passed simple integer OsiUsesBiLinear (const OsiSimpleInteger & rhs, int type); /// Copy constructor OsiUsesBiLinear ( const OsiUsesBiLinear & rhs); /// Clone virtual OsiObject * clone() const; /// Assignment operator OsiUsesBiLinear & operator=( const OsiUsesBiLinear& rhs); /// Destructor virtual ~OsiUsesBiLinear (); using OsiObject::infeasibility ; /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int & whichWay) const; /** Creates a branching object The preferred direction is set by \p way, 0 for down, 1 for up. */ virtual OsiBranchingObject * createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) const; using OsiObject::feasibleRegion ; /** Set bounds to fix the variable at the current value. Given an current value, set the lower and upper bounds to fix the variable. Returns amount it had to move variable. */ virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const; /// Add all bi-linear objects void addBiLinearObjects(OsiSolverLink * solver); protected: /// data /// Number of bilinear objects (maybe could be more general) int numberBiLinear_; /// Type of variable - 0 continuous, 1 integer int type_; /// Objects OsiObject ** objects_; }; /** This class chooses a variable to branch on This is just as OsiChooseStrong but it fakes it so only first so many are looked at in this phase */ class OsiChooseStrongSubset : public OsiChooseStrong { public: /// Default Constructor OsiChooseStrongSubset (); /// Constructor from solver (so we can set up arrays etc) OsiChooseStrongSubset (const OsiSolverInterface * solver); /// Copy constructor OsiChooseStrongSubset (const OsiChooseStrongSubset &); /// Assignment operator OsiChooseStrongSubset & operator= (const OsiChooseStrongSubset& rhs); /// Clone virtual OsiChooseVariable * clone() const; /// Destructor virtual ~OsiChooseStrongSubset (); /** Sets up strong list and clears all if initialize is true. Returns number of infeasibilities. If returns -1 then has worked out node is infeasible! */ virtual int setupList ( OsiBranchingInformation *info, bool initialize); /** Choose a variable Returns - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from bestObjectIndex() and bestWhichWay() We can pick up a forced branch (can change bound) from firstForcedObjectIndex() and firstForcedWhichWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution() If fixVariables is true then 2,3,4 are all really same as problem changed */ virtual int chooseVariable( OsiSolverInterface * solver, OsiBranchingInformation *info, bool fixVariables); /// Number of objects to use inline int numberObjectsToUse() const { return numberObjectsToUse_; } /// Set number of objects to use inline void setNumberObjectsToUse(int value) { numberObjectsToUse_ = value; } protected: // Data /// Number of objects to be used (and set in solver) int numberObjectsToUse_; }; #include #include "CglStored.hpp" class CoinWarmStartBasis; /** Stored Temporary Cut Generator Class - destroyed after first use */ class CglTemporary : public CglStored { public: /**@name Generate Cuts */ //@{ /** Generate Mixed Integer Stored cuts for the model of the solver interface, si. Insert the generated cuts into OsiCut, cs. This generator just looks at previously stored cuts and inserts any that are violated by enough */ virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info = CglTreeInfo()); //@} /**@name Constructors and destructors */ //@{ /// Default constructor CglTemporary (); /// Copy constructor CglTemporary (const CglTemporary & rhs); /// Clone virtual CglCutGenerator * clone() const; /// Assignment operator CglTemporary & operator=(const CglTemporary& rhs); /// Destructor virtual ~CglTemporary (); //@} private: // Private member methods // Private member data }; //############################################################################# /** This is to allow the user to replace initialSolve and resolve */ class OsiSolverLinearizedQuadratic : public OsiClpSolverInterface { public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); //@} /**@name Constructors and destructors */ //@{ /// Default Constructor OsiSolverLinearizedQuadratic (); /// Useful constructor (solution should be good) OsiSolverLinearizedQuadratic( ClpSimplex * quadraticModel); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiSolverLinearizedQuadratic (const OsiSolverLinearizedQuadratic &); /// Assignment operator OsiSolverLinearizedQuadratic & operator=(const OsiSolverLinearizedQuadratic& rhs); /// Destructor virtual ~OsiSolverLinearizedQuadratic (); //@} /**@name Sets and Gets */ //@{ /// Objective value of best solution found internally inline double bestObjectiveValue() const { return bestObjectiveValue_; } /// Best solution found internally const double * bestSolution() const { return bestSolution_; } /// Set special options inline void setSpecialOptions3(int value) { specialOptions3_ = value; } /// Get special options inline int specialOptions3() const { return specialOptions3_; } /// Copy of quadratic model if one ClpSimplex * quadraticModel() const { return quadraticModel_; } //@} //--------------------------------------------------------------------------- protected: /**@name functions */ //@{ /**@name Private member data */ //@{ /// Objective value of best solution found internally double bestObjectiveValue_; /// Copy of quadratic model if one ClpSimplex * quadraticModel_; /// Best solution found internally double * bestSolution_; /** 0 bit (1) - don't do mini B&B 1 bit (2) - quadratic only in objective */ int specialOptions3_; //@} }; class ClpSimplex; /** Return an approximate solution to a CoinModel. Lots of bounds may be odd to force a solution. mode = 0 just tries to get a continuous solution */ ClpSimplex * approximateSolution(CoinModel & coinModel, int numberPasses, double deltaTolerance, int mode = 0); #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicFPump.cpp0000644000175000017500000043151712522136472016634 0ustar renerene/* $Id: CbcHeuristicFPump.cpp 2186 2015-05-05 12:53:14Z stefan $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif #include "CbcMessage.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchDynamic.hpp" #include "CoinHelperFunctions.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinTime.hpp" #include "CbcEventHandler.hpp" #ifdef SWITCH_VARIABLES #include "CbcSimpleIntegerDynamicPseudoCost.hpp" #endif // Default Constructor CbcHeuristicFPump::CbcHeuristicFPump() : CbcHeuristic(), startTime_(0.0), maximumTime_(0.0), fakeCutoff_(COIN_DBL_MAX), absoluteIncrement_(0.0), relativeIncrement_(0.0), defaultRounding_(0.49999), initialWeight_(0.0), weightFactor_(0.1), artificialCost_(COIN_DBL_MAX), iterationRatio_(0.0), reducedCostMultiplier_(1.0), maximumPasses_(100), maximumRetries_(1), accumulate_(0), fixOnReducedCosts_(1), roundExpensive_(false) { setWhen(1); } // Constructor from model CbcHeuristicFPump::CbcHeuristicFPump(CbcModel & model, double downValue, bool roundExpensive) : CbcHeuristic(model), startTime_(0.0), maximumTime_(0.0), fakeCutoff_(COIN_DBL_MAX), absoluteIncrement_(0.0), relativeIncrement_(0.0), defaultRounding_(downValue), initialWeight_(0.0), weightFactor_(0.1), artificialCost_(COIN_DBL_MAX), iterationRatio_(0.0), reducedCostMultiplier_(1.0), maximumPasses_(100), maximumRetries_(1), accumulate_(0), fixOnReducedCosts_(1), roundExpensive_(roundExpensive) { setWhen(1); } // Destructor CbcHeuristicFPump::~CbcHeuristicFPump () { } // Clone CbcHeuristic * CbcHeuristicFPump::clone() const { return new CbcHeuristicFPump(*this); } // Create C++ lines to get to current state void CbcHeuristicFPump::generateCpp( FILE * fp) { CbcHeuristicFPump other; fprintf(fp, "0#include \"CbcHeuristicFPump.hpp\"\n"); fprintf(fp, "3 CbcHeuristicFPump heuristicFPump(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicFPump"); if (maximumPasses_ != other.maximumPasses_) fprintf(fp, "3 heuristicFPump.setMaximumPasses(%d);\n", maximumPasses_); else fprintf(fp, "4 heuristicFPump.setMaximumPasses(%d);\n", maximumPasses_); if (maximumRetries_ != other.maximumRetries_) fprintf(fp, "3 heuristicFPump.setMaximumRetries(%d);\n", maximumRetries_); else fprintf(fp, "4 heuristicFPump.setMaximumRetries(%d);\n", maximumRetries_); if (accumulate_ != other.accumulate_) fprintf(fp, "3 heuristicFPump.setAccumulate(%d);\n", accumulate_); else fprintf(fp, "4 heuristicFPump.setAccumulate(%d);\n", accumulate_); if (fixOnReducedCosts_ != other.fixOnReducedCosts_) fprintf(fp, "3 heuristicFPump.setFixOnReducedCosts(%d);\n", fixOnReducedCosts_); else fprintf(fp, "4 heuristicFPump.setFixOnReducedCosts(%d);\n", fixOnReducedCosts_); if (maximumTime_ != other.maximumTime_) fprintf(fp, "3 heuristicFPump.setMaximumTime(%g);\n", maximumTime_); else fprintf(fp, "4 heuristicFPump.setMaximumTime(%g);\n", maximumTime_); if (fakeCutoff_ != other.fakeCutoff_) fprintf(fp, "3 heuristicFPump.setFakeCutoff(%g);\n", fakeCutoff_); else fprintf(fp, "4 heuristicFPump.setFakeCutoff(%g);\n", fakeCutoff_); if (absoluteIncrement_ != other.absoluteIncrement_) fprintf(fp, "3 heuristicFPump.setAbsoluteIncrement(%g);\n", absoluteIncrement_); else fprintf(fp, "4 heuristicFPump.setAbsoluteIncrement(%g);\n", absoluteIncrement_); if (relativeIncrement_ != other.relativeIncrement_) fprintf(fp, "3 heuristicFPump.setRelativeIncrement(%g);\n", relativeIncrement_); else fprintf(fp, "4 heuristicFPump.setRelativeIncrement(%g);\n", relativeIncrement_); if (defaultRounding_ != other.defaultRounding_) fprintf(fp, "3 heuristicFPump.setDefaultRounding(%g);\n", defaultRounding_); else fprintf(fp, "4 heuristicFPump.setDefaultRounding(%g);\n", defaultRounding_); if (initialWeight_ != other.initialWeight_) fprintf(fp, "3 heuristicFPump.setInitialWeight(%g);\n", initialWeight_); else fprintf(fp, "4 heuristicFPump.setInitialWeight(%g);\n", initialWeight_); if (weightFactor_ != other.weightFactor_) fprintf(fp, "3 heuristicFPump.setWeightFactor(%g);\n", weightFactor_); else fprintf(fp, "4 heuristicFPump.setWeightFactor(%g);\n", weightFactor_); if (artificialCost_ != other.artificialCost_) fprintf(fp, "3 heuristicFPump.setArtificialCost(%g);\n", artificialCost_); else fprintf(fp, "4 heuristicFPump.setArtificialCost(%g);\n", artificialCost_); if (iterationRatio_ != other.iterationRatio_) fprintf(fp, "3 heuristicFPump.setIterationRatio(%g);\n", iterationRatio_); else fprintf(fp, "4 heuristicFPump.setIterationRatio(%g);\n", iterationRatio_); if (reducedCostMultiplier_ != other.reducedCostMultiplier_) fprintf(fp, "3 heuristicFPump.setReducedCostMultiplier(%g);\n", reducedCostMultiplier_); else fprintf(fp, "4 heuristicFPump.setReducedCostMultiplier(%g);\n", reducedCostMultiplier_); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicFPump);\n"); } // Copy constructor CbcHeuristicFPump::CbcHeuristicFPump(const CbcHeuristicFPump & rhs) : CbcHeuristic(rhs), startTime_(rhs.startTime_), maximumTime_(rhs.maximumTime_), fakeCutoff_(rhs.fakeCutoff_), absoluteIncrement_(rhs.absoluteIncrement_), relativeIncrement_(rhs.relativeIncrement_), defaultRounding_(rhs.defaultRounding_), initialWeight_(rhs.initialWeight_), weightFactor_(rhs.weightFactor_), artificialCost_(rhs.artificialCost_), iterationRatio_(rhs.iterationRatio_), reducedCostMultiplier_(rhs.reducedCostMultiplier_), maximumPasses_(rhs.maximumPasses_), maximumRetries_(rhs.maximumRetries_), accumulate_(rhs.accumulate_), fixOnReducedCosts_(rhs.fixOnReducedCosts_), roundExpensive_(rhs.roundExpensive_) { } // Assignment operator CbcHeuristicFPump & CbcHeuristicFPump::operator=( const CbcHeuristicFPump & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); startTime_ = rhs.startTime_; maximumTime_ = rhs.maximumTime_; fakeCutoff_ = rhs.fakeCutoff_; absoluteIncrement_ = rhs.absoluteIncrement_; relativeIncrement_ = rhs.relativeIncrement_; defaultRounding_ = rhs.defaultRounding_; initialWeight_ = rhs.initialWeight_; weightFactor_ = rhs.weightFactor_; artificialCost_ = rhs.artificialCost_; iterationRatio_ = rhs.iterationRatio_; reducedCostMultiplier_ = rhs.reducedCostMultiplier_; maximumPasses_ = rhs.maximumPasses_; maximumRetries_ = rhs.maximumRetries_; accumulate_ = rhs.accumulate_; fixOnReducedCosts_ = rhs.fixOnReducedCosts_; roundExpensive_ = rhs.roundExpensive_; } return *this; } // Resets stuff if model changes void CbcHeuristicFPump::resetModel(CbcModel * ) { } /**************************BEGIN MAIN PROCEDURE ***********************************/ // See if feasibility pump will give better solution // Sets value of solution // Returns 1 if solution, 0 if not int CbcHeuristicFPump::solution(double & solutionValue, double * betterSolution) { startTime_ = CoinCpuTime(); numCouldRun_++; double incomingObjective = solutionValue; #define LEN_PRINT 200 char pumpPrint[LEN_PRINT]; pumpPrint[0] = '\0'; /* Decide if we want to run. Standard values for when are described in CbcHeuristic.hpp. If we're off, or running only at root and this isn't the root, bail out. The double test (against phase, then atRoot and passNumber) has a fair bit of redundancy, but the results will differ depending on whether we're actually at the root of the main search tree or at the root of a small tree (recursive call to branchAndBound). FPump also supports some exotic values (11 -- 15) for when, described in CbcHeuristicFPump.hpp. */ if (!when() || (when() == 1 && model_->phase() != 1)) return 0; // switched off #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif // See if at root node bool atRoot = model_->getNodeCount() == 0; int passNumber = model_->getCurrentPassNumber(); // just do once if (!atRoot) return 0; int options = feasibilityPumpOptions_; if ((options % 1000000) > 0) { int kOption = options / 1000000; options = options % 1000000; /* Add 10 to do even if solution 1 - do after cuts 2 - do after cuts (not before) 3 - not used do after every cut round (and after cuts) k not used do after every (k-2)th round */ if (kOption < 10 && model_->getSolutionCount()) return 0; if (model_->getSolutionCount()) kOption = kOption % 10; bool good; if (kOption == 1) { good = (passNumber == 999999); } else if (kOption == 2) { good = (passNumber == 999999); passNumber = 2; // so won't run before //} else if (kOption==3) { //good = true; } else { //good = (((passNumber-1)%(kOption-2))==0); good = false; } if (passNumber > 1 && !good) return 0; } else { if (passNumber > 1) return 0; } // loop round doing repeated pumps double cutoff; model_->solver()->getDblParam(OsiDualObjectiveLimit, cutoff); double direction = model_->solver()->getObjSense(); cutoff *= direction; int numberBandBsolutions = 0; double firstCutoff = fabs(cutoff); cutoff = CoinMin(cutoff, solutionValue); // check plausible and space for rounded solution int numberColumns = model_->getNumCols(); int numberIntegers = model_->numberIntegers(); const int * integerVariableOrig = model_->integerVariable(); double iterationLimit = -1.0; //iterationRatio_=1.0; if (iterationRatio_ > 0.0) iterationLimit = (2 * model_->solver()->getNumRows() + 2 * numberColumns) * iterationRatio_; int totalNumberIterations = 0; int averageIterationsPerTry = -1; int numberIterationsLastPass = 0; // 1. initially check 0-1 /* I'm skeptical of the above comment, but it's likely accurate as the default. Bit 4 or bit 8 needs to be set in order to consider working with general integers. */ int i, j; int general = 0; int * integerVariable = new int[numberIntegers]; const double * lower = model_->solver()->getColLower(); const double * upper = model_->solver()->getColUpper(); bool doGeneral = (accumulate_ & 4) != 0; int numberUnsatisfied=0; double sumUnsatisfied=0.0; const double * initialSolution = model_->solver()->getColSolution(); j = 0; /* Scan the objects, recording the columns and counting general integers. Seems like the NDEBUG tests could be made into an applicability test. If a scan of the objects reveals complex objects, just clean up and return failure. */ for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariableOrig[i]; #ifndef NDEBUG const OsiObject * object = model_->object(i); const CbcSimpleInteger * integerObject = dynamic_cast (object); const OsiSimpleInteger * integerObject2 = dynamic_cast (object); assert(integerObject || integerObject2); #endif double value = initialSolution[iColumn]; double nearest = floor(value + 0.5); sumUnsatisfied += fabs(value - nearest); if (fabs(value - nearest) > 1.0e-6) numberUnsatisfied++; if (upper[iColumn] - lower[iColumn] > 1.000001) { general++; if (doGeneral) integerVariable[j++] = iColumn; } else { integerVariable[j++] = iColumn; } } /* If 2/3 of integers are general integers, and we're not going to work with them, might as well go home. The else case is unclear to me. We reach it if general integers are less than 2/3 of the total, or if either of bit 4 or 8 is set. But only bit 8 is used in the decision. (Let manyGen = 1 if more than 2/3 of integers are general integers. Then a k-map on manyGen, bit4, and bit8 shows it clearly.) So there's something odd here. In the case where bit4 = 1 and bit8 = 0, we've included general integers in integerVariable, but we're not going to process them. */ if (general*3 > 2*numberIntegers && !doGeneral) { delete [] integerVariable; return 0; } else if ((accumulate_&4) == 0) { doGeneral = false; j = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariableOrig[i]; if (upper[iColumn] - lower[iColumn] < 1.000001) integerVariable[j++] = iColumn; } } if (!general) doGeneral = false; #ifdef CLP_INVESTIGATE if (doGeneral) printf("DOing general with %d out of %d\n", general, numberIntegers); #endif sprintf(pumpPrint, "Initial state - %d integers unsatisfied sum - %g", numberUnsatisfied, sumUnsatisfied); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; /* This `closest solution' will satisfy integrality, but violate some other constraints? */ // For solution closest to feasible if none found int * closestSolution = general ? NULL : new int[numberIntegers]; double closestObjectiveValue = COIN_DBL_MAX; int numberIntegersOrig = numberIntegers; numberIntegers = j; double * newSolution = new double [numberColumns]; double newSolutionValue = COIN_DBL_MAX; int maxSolutions = model_->getMaximumSolutions(); int numberSolutions=0; bool solutionFound = false; int * usedColumn = NULL; double * lastSolution = NULL; int fixContinuous = 0; bool fixInternal = false; bool allSlack = false; if (when_ >= 21 && when_ <= 25) { when_ -= 10; allSlack = true; } double time1 = CoinCpuTime(); /* Obtain a relaxed lp solution. */ model_->solver()->resolve(); if (!model_->solver()->isProvenOptimal()) { delete[] integerVariable; delete[] newSolution; if (closestSolution) delete[] closestSolution; return 0; } numRuns_++; if (cutoff < 1.0e50 && false) { // Fix on djs double direction = model_->solver()->getObjSense() ; double gap = cutoff - model_->solver()->getObjValue() * direction ; double tolerance; model_->solver()->getDblParam(OsiDualTolerance, tolerance) ; if (gap > 0.0) { gap += 100.0 * tolerance; int nFix = model_->solver()->reducedCostFix(gap); printf("dj fixing fixed %d variables\n", nFix); } } /* I have no idea why we're doing this, except perhaps that saveBasis will be automagically deleted on exit from the routine. */ CoinWarmStartBasis saveBasis; CoinWarmStartBasis * basis = dynamic_cast(model_->solver()->getWarmStart()) ; if (basis) { saveBasis = * basis; delete basis; } double continuousObjectiveValue = model_->solver()->getObjValue() * model_->solver()->getObjSense(); double * firstPerturbedObjective = NULL; double * firstPerturbedSolution = NULL; double firstPerturbedValue = COIN_DBL_MAX; if (when_ >= 11 && when_ <= 15) { fixInternal = when_ > 11 && when_ < 15; if (when_ < 13) fixContinuous = 0; else if (when_ != 14) fixContinuous = 1; else fixContinuous = 2; when_ = 1; if ((accumulate_&1) != 0) { usedColumn = new int [numberColumns]; for (int i = 0; i < numberColumns; i++) usedColumn[i] = -1; } lastSolution = CoinCopyOfArray(model_->solver()->getColSolution(), numberColumns); } int finalReturnCode = 0; int totalNumberPasses = 0; int numberTries = 0; CoinWarmStartBasis bestBasis; bool exitAll = false; //double saveBestObjective = model_->getMinimizationObjValue(); OsiSolverInterface * solver = NULL; double artificialFactor = 0.00001; // also try rounding! double * roundingSolution = new double[numberColumns]; double roundingObjective = solutionValue; CbcRounding roundingHeuristic(*model_); int dualPass = 0; int secondPassOpt = 0; #define RAND_RAND #ifdef RAND_RAND int offRandom = 0; #endif int maximumAllowed = -1; bool moreIterations = false; if (options > 0) { if (options >= 1000) maximumAllowed = options / 1000; int options2 = (options % 1000) / 100; #ifdef RAND_RAND offRandom = options2 & 1; #endif moreIterations = (options2 & 2) != 0; secondPassOpt = (options / 10) % 10; /* 1 to 7 - re-use solution 8 use dual and current solution(ish) 9 use dual and allslack 1 - primal and mod obj 2 - dual and mod obj 3 - primal and no mod obj add 3 to redo current solution */ if (secondPassOpt >= 8) { dualPass = secondPassOpt - 7; secondPassOpt = 0; } } // Number of passes to do int maximumPasses = maximumPasses_; #ifdef COIN_HAS_CLP { OsiClpSolverInterface * clpSolver = dynamic_cast (model_->solver()); if (clpSolver ) { if (maximumPasses == 30) { if (clpSolver->fakeObjective()) maximumPasses = 100; // feasibility problem? } randomNumberGenerator_.randomize(); if (model_->getRandomSeed()!=-1) clpSolver->getModelPtr()->setRandomSeed(randomNumberGenerator_.getSeed()); clpSolver->getModelPtr()->randomNumberGenerator()->randomize(); } } #endif #ifdef RAND_RAND double * randomFactor = new double [numberColumns]; for (int i = 0; i < numberColumns; i++) { double value = floor(1.0e3 * randomNumberGenerator_.randomDouble()); randomFactor[i] = 1.0 + value * 1.0e-4; } #endif // guess exact multiple of objective double exactMultiple = model_->getCutoffIncrement(); exactMultiple *= 2520; if (fabs(exactMultiple / 0.999 - floor(exactMultiple / 0.999 + 0.5)) < 1.0e-9) exactMultiple /= 2520.0 * 0.999; else if (fabs(exactMultiple - floor(exactMultiple + 0.5)) < 1.0e-9) exactMultiple /= 2520.0; else exactMultiple = 0.0; // check for rounding errors (only for integral case) if (fabs(exactMultiple - floor(exactMultiple + 0.5)) < 1.0e-8) exactMultiple = floor(exactMultiple + 0.5); //printf("exact multiple %g\n",exactMultiple); // Clone solver for rounding OsiSolverInterface * clonedSolver = cloneBut(2); // wasmodel_->solver()->clone(); while (!exitAll) { // Cutoff rhs double useRhs = COIN_DBL_MAX; double useOffset = 0.0; int numberPasses = 0; artificialFactor *= 10.0; int lastMove = (!numberTries) ? -10 : 1000000; double lastSumInfeas = COIN_DBL_MAX; numberTries++; // Clone solver - otherwise annoys root node computations solver = cloneBut(2); // was model_->solver()->clone(); #ifdef COIN_HAS_CLP { OsiClpSolverInterface * clpSolver = dynamic_cast (solver); if (clpSolver) { // better to clean up using primal? ClpSimplex * lp = clpSolver->getModelPtr(); int options = lp->specialOptions(); lp->setSpecialOptions(options | 8192); //lp->setSpecialOptions(options|0x01000000); #ifdef CLP_INVESTIGATE clpSolver->setHintParam(OsiDoReducePrint, false, OsiHintTry); lp->setLogLevel(CoinMax(1, lp->logLevel())); #endif } } #endif if (CoinMin(fakeCutoff_, cutoff) < 1.0e50) { // Fix on djs double direction = solver->getObjSense() ; double gap = CoinMin(fakeCutoff_, cutoff) - solver->getObjValue() * direction ; double tolerance; solver->getDblParam(OsiDualTolerance, tolerance) ; if (gap > 0.0 && (fixOnReducedCosts_ == 1 || (numberTries == 1 && fixOnReducedCosts_ == 2))) { gap += 100.0 * tolerance; gap *= reducedCostMultiplier_; int nFix = solver->reducedCostFix(gap); if (nFix) { sprintf(pumpPrint, "Reduced cost fixing fixed %d variables on major pass %d", nFix, numberTries); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; //pumpPrint[0]='\0'; } } } // if cutoff exists then add constraint bool useCutoff = (fabs(cutoff) < 1.0e20 && (fakeCutoff_ != COIN_DBL_MAX || numberTries > 1)); bool tryOneClosePass=fakeCutoff_getObjValue(); // but there may be a close one if (firstCutoff < 2.0*solutionValue && numberTries == 1 && CoinMin(cutoff, fakeCutoff_) < 1.0e20) useCutoff = true; if (useCutoff || tryOneClosePass) { double rhs = CoinMin(cutoff, fakeCutoff_); if (tryOneClosePass) { // If way off then .05 if (fakeCutoff_<=-1.0e100) { // use value as percentage - so 100==0.0, 101==1.0 etc // probably something like pow I could use but ... double fraction = 0.0; while (fakeCutoff_<-1.01e100) { fakeCutoff_ *= 0.1; fraction += 0.01; } rhs = solver->getObjValue()+fraction*fabs(solver->getObjValue()); } else { rhs = 2.0*solver->getObjValue()-fakeCutoff_; // flip difference } fakeCutoff_=COIN_DBL_MAX; } const double * objective = solver->getObjCoefficients(); int numberColumns = solver->getNumCols(); int * which = new int[numberColumns]; double * els = new double[numberColumns]; int nel = 0; for (int i = 0; i < numberColumns; i++) { double value = objective[i]; if (value) { which[nel] = i; els[nel++] = direction * value; } } solver->getDblParam(OsiObjOffset, useOffset); #ifdef COIN_DEVELOP if (useOffset) printf("CbcHeuristicFPump obj offset %g\n", useOffset); #endif useOffset *= direction; // Tweak rhs and save useRhs = rhs; #ifdef JJF_ZERO double tempValue = 60.0 * useRhs; if (fabs(tempValue - floor(tempValue + 0.5)) < 1.0e-7 && rhs != fakeCutoff_) { // add a little useRhs += 1.0e-5; } #endif solver->addRow(nel, which, els, -COIN_DBL_MAX, useRhs + useOffset); delete [] which; delete [] els; bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); solver->setHintParam(OsiDoDualInResolve, true, OsiHintDo); solver->resolve(); solver->setHintParam(OsiDoDualInResolve, takeHint, strength); if (!solver->isProvenOptimal()) { // presumably max time or some such exitAll = true; break; } } solver->setDblParam(OsiDualObjectiveLimit, 1.0e50); solver->resolve(); // Solver may not be feasible if (!solver->isProvenOptimal()) { exitAll = true; break; } const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * solution = solver->getColSolution(); if (lastSolution) memcpy(lastSolution, solution, numberColumns*sizeof(double)); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); // 2 space for last rounded solutions #define NUMBER_OLD 4 double ** oldSolution = new double * [NUMBER_OLD]; for (j = 0; j < NUMBER_OLD; j++) { oldSolution[j] = new double[numberColumns]; for (i = 0; i < numberColumns; i++) oldSolution[j][i] = -COIN_DBL_MAX; } // 3. Replace objective with an initial 0-valued objective double * saveObjective = new double [numberColumns]; memcpy(saveObjective, solver->getObjCoefficients(), numberColumns*sizeof(double)); for (i = 0; i < numberColumns; i++) { solver->setObjCoeff(i, 0.0); } bool finished = false; double direction = solver->getObjSense(); int returnCode = 0; bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); solver->setHintParam(OsiDoDualInResolve, false); //solver->messageHandler()->setLogLevel(0); // 4. Save objective offset so we can see progress double saveOffset; solver->getDblParam(OsiObjOffset, saveOffset); // Get amount for original objective double scaleFactor = 0.0; #ifdef COIN_DEVELOP double largestCost = 0.0; int nArtificial = 0; #endif for (i = 0; i < numberColumns; i++) { double value = saveObjective[i]; scaleFactor += value * value; #ifdef COIN_DEVELOP largestCost = CoinMax(largestCost, fabs(value)); if (value*direction >= artificialCost_) nArtificial++; #endif } if (scaleFactor) scaleFactor = (initialWeight_ * sqrt(static_cast (numberIntegers))) / sqrt(scaleFactor); #ifdef CLP_INVESTIGATE #ifdef COIN_DEVELOP if (scaleFactor || nArtificial) printf("Using %g fraction of original objective (decay %g) - largest %g - %d artificials\n", scaleFactor, weightFactor_, largestCost, nArtificial); #else if (scaleFactor) printf("Using %g fraction of original objective (decay %g)\n", scaleFactor, weightFactor_); #endif #endif // This is an array of sums of infeasibilities so can see if "bobbling" #define SIZE_BOBBLE 20 double saveSumInf[SIZE_BOBBLE]; CoinFillN(saveSumInf, SIZE_BOBBLE, COIN_DBL_MAX); // 0 before doing anything int bobbleMode = 0; // 5. MAIN WHILE LOOP //bool newLineNeeded=false; /* finished occurs exactly twice in this routine: immediately above, where it's set to false, and here in the loop condition. */ while (!finished) { double newTrueSolutionValue = 0.0; double newSumInfeas = 0.0; int newNumberInfeas = 0; returnCode = 0; if (model_->maximumSecondsReached()) { exitAll = true; break; } // see what changed if (usedColumn) { for (i = 0; i < numberColumns; i++) { if (fabs(solution[i] - lastSolution[i]) > 1.0e-8) usedColumn[i] = numberPasses; lastSolution[i] = solution[i]; } } if (averageIterationsPerTry >= 0) { int n = totalNumberIterations - numberIterationsLastPass; double perPass = totalNumberIterations / (totalNumberPasses + numberPasses + 1.0e-5); perPass /= (solver->getNumRows() + numberColumns); double test = moreIterations ? 0.3 : 0.05; if (n > CoinMax(20000, 3*averageIterationsPerTry) && (switches_&2) == 0 && maximumPasses<200 && perPass>test) { exitAll = true; } } // Exit on exact total number if maximumPasses large if ((maximumPasses >= 200 || (switches_&2) != 0) && numberPasses + totalNumberPasses >= maximumPasses) exitAll = true; bool exitThis = false; if (iterationLimit < 0.0) { if (numberPasses >= maximumPasses) { // If going well then keep going if maximumPasses small if (lastMove < numberPasses - 4 || lastMove == 1000000) exitThis = true; if (maximumPasses > 20 || numberPasses >= 40) exitThis = true; } } if (iterationLimit > 0.0 && totalNumberIterations > iterationLimit && numberPasses > 15) { // exiting on iteration count exitAll = true; } else if (maximumPasses<30 && numberPasses>100) { // too many passes anyway exitAll = true; } if (maximumTime_ > 0.0 && CoinCpuTime() >= startTime_ + maximumTime_) { exitAll = true; // force exit switches_ |= 2048; } if (exitAll || exitThis) break; memcpy(newSolution, solution, numberColumns*sizeof(double)); int flip; if (numberPasses == 0 && false) { // always use same seed randomNumberGenerator_.setSeed(987654321); } returnCode = rounds(solver, newSolution,/*saveObjective,*/ numberIntegers, integerVariable, /*pumpPrint,*/numberPasses, /*roundExpensive_,*/defaultRounding_, &flip); if (numberPasses == 0 && false) { // Make sure random will be different for (i = 1; i < numberTries; i++) randomNumberGenerator_.randomDouble(); } numberPasses++; if (returnCode) { // SOLUTION IS INTEGER // Put back correct objective for (i = 0; i < numberColumns; i++) solver->setObjCoeff(i, saveObjective[i]); // solution - but may not be better // Compute using dot product solver->setDblParam(OsiObjOffset, saveOffset); newSolutionValue = -saveOffset; for ( i = 0 ; i < numberColumns ; i++ ) newSolutionValue += saveObjective[i] * newSolution[i]; newSolutionValue *= direction; sprintf(pumpPrint, "Solution found of %g", newSolutionValue); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; //newLineNeeded=false; if (newSolutionValue < solutionValue) { double saveValue = solutionValue; if (!doGeneral) { int numberLeft = 0; for (i = 0; i < numberIntegersOrig; i++) { int iColumn = integerVariableOrig[i]; double value = floor(newSolution[iColumn] + 0.5); if (solver->isBinary(iColumn)) { solver->setColLower(iColumn, value); solver->setColUpper(iColumn, value); } else { if (fabs(value - newSolution[iColumn]) > 1.0e-7) numberLeft++; } } if (numberLeft) { sprintf(pumpPrint, "Branch and bound needed to clear up %d general integers", numberLeft); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; returnCode = smallBranchAndBound(solver, numberNodes_, newSolution, newSolutionValue, solutionValue, "CbcHeuristicFpump"); if (returnCode < 0) { if (returnCode == -2) exitAll = true; returnCode = 0; // returned on size or event } if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } if (returnCode != 1) newSolutionValue = saveValue; if (returnCode && newSolutionValue < saveValue) numberBandBsolutions++; } else if (numberColumns>numberIntegersOrig) { // relax continuous bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); //solver->setHintParam(OsiDoReducePrint, false, OsiHintTry); solver->setHintParam(OsiDoDualInResolve, false, OsiHintDo); //solver->setHintParam(OsiDoScale, false, OsiHintDo); solver->resolve(); solver->setHintParam(OsiDoDualInResolve, takeHint, strength); if (solver->isProvenOptimal()) { memcpy(newSolution,solver->getColSolution(), numberColumns*sizeof(double)); newSolutionValue = -saveOffset; for ( i = 0 ; i < numberColumns ; i++ ) { newSolutionValue += saveObjective[i] * newSolution[i]; } newSolutionValue *= direction; sprintf(pumpPrint, "Relaxing continuous gives %g", newSolutionValue); //#define DEBUG_BEST #ifdef DEBUG_BEST { int numberColumns=solver->getNumCols(); FILE * fp = fopen("solution.data2","wb"); printf("Solution data on file solution.data2\n"); size_t numberWritten; numberWritten=fwrite(&numberColumns,sizeof(int),1,fp); assert (numberWritten==1); numberWritten=fwrite(&newSolutionValue,sizeof(double),1,fp); assert (numberWritten==1); numberWritten=fwrite(newSolution,sizeof(double),numberColumns,fp); assert (numberWritten==numberColumns); fclose(fp); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); int numberRows = solver->getNumRows() ; double *rowActivity = new double[numberRows] ; memset(rowActivity, 0, numberRows*sizeof(double)) ; const double * element = solver->getMatrixByCol()->getElements(); const int * row = solver->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver->getMatrixByCol()->getVectorLengths(); double largestAway=0.0; int away=-1; double saveOffset; solver->getDblParam(OsiObjOffset, saveOffset); double newSolutionValue = -saveOffset; const double * objective = solver->getObjCoefficients(); for ( int iColumn=0 ; iColumnisInteger(iColumn)) { double intValue = floor(value+0.5); if (fabs(value-intValue)>largestAway) { largestAway=fabs(value-intValue); away=iColumn; } } } printf("Largest away from int at column %d was %g - obj %g\n",away, largestAway,newSolutionValue); double largestInfeasibility=0.0; for (int i = 0 ; i < numberRows ; i++) { #if 0 //def CLP_INVESTIGATE double inf; inf = rowLower[i] - rowActivity[i]; if (inf > primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); inf = rowActivity[i] - rowUpper[i]; if (inf > primalTolerance) printf("Row %d inf %g %g <= %g <= %g\n", i, inf, rowLower[i], rowActivity[i], rowUpper[i]); #endif double infeasibility = CoinMax(rowActivity[i]-rowUpper[i], rowLower[i]-rowActivity[i]); if (infeasibility>largestInfeasibility) { largestInfeasibility = infeasibility; printf("Binf of %g on row %d\n", infeasibility,i); } } delete [] rowActivity ; printf("Blargest infeasibility is %g - obj %g\n", largestInfeasibility,newSolutionValue); } #endif } else { sprintf(pumpPrint,"Infeasible when relaxing continuous!\n"); } model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; } } if (returnCode && newSolutionValue < saveValue) { memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); solutionFound = true; if (exitNow(newSolutionValue)) exitAll = true; CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; if (basis) { bestBasis = * basis; delete basis; int action = model_->dealWithEventHandler(CbcEventHandler::heuristicSolution, newSolutionValue, betterSolution); if (action == 0) { double * saveOldSolution = CoinCopyOfArray(model_->bestSolution(), numberColumns); double saveObjectiveValue = model_->getMinimizationObjValue(); model_->setBestSolution(betterSolution, numberColumns, newSolutionValue); if (saveOldSolution && saveObjectiveValue < model_->getMinimizationObjValue()) model_->setBestSolution(saveOldSolution, numberColumns, saveObjectiveValue); delete [] saveOldSolution; } if (action == 0 || model_->maximumSecondsReached()) { exitAll = true; // exit break; } } if ((accumulate_&1) != 0) { model_->incrementUsed(betterSolution); // for local search } solutionValue = newSolutionValue; solutionFound = true; numberSolutions++; if (numberSolutions>=maxSolutions) exitAll = true; if (general && saveValue != newSolutionValue) { sprintf(pumpPrint, "Cleaned solution of %g", solutionValue); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; } if (exitNow(newSolutionValue)) exitAll = true; } else { sprintf(pumpPrint, "Mini branch and bound could not fix general integers"); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; } } else { sprintf(pumpPrint, "After further testing solution no better than previous of %g", solutionValue); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; //newLineNeeded=false; returnCode = 0; } break; } else { // SOLUTION IS not INTEGER // 1. check for loop bool matched; for (int k = NUMBER_OLD - 1; k > 0; k--) { double * b = oldSolution[k]; matched = true; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (newSolution[iColumn] != b[iColumn]) { matched = false; break; } } if (matched) break; } int numberPerturbed = 0; if (matched || numberPasses % 100 == 0) { // perturbation //sprintf(pumpPrint+strlen(pumpPrint)," perturbation applied"); //newLineNeeded=true; double factorX[10] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; double factor = 1.0; double target = -1.0; double * randomX = new double [numberIntegers]; for (i = 0; i < numberIntegers; i++) randomX[i] = CoinMax(0.0, randomNumberGenerator_.randomDouble() - 0.3); for (int k = 0; k < 10; k++) { #ifdef COIN_DEVELOP_x printf("kpass %d\n", k); #endif int numberX[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = randomX[i]; double difference = fabs(solution[iColumn] - newSolution[iColumn]); for (int j = 0; j < 10; j++) { if (difference + value*factorX[j] > 0.5) numberX[j]++; } } if (target < 0.0) { if (numberX[9] <= 200) break; // not very many changes target = CoinMax(200.0, CoinMin(0.05 * numberX[9], 1000.0)); } int iX = -1; int iBand = -1; for (i = 0; i < 10; i++) { #ifdef COIN_DEVELOP_x printf("** %d changed at %g\n", numberX[i], factorX[i]); #endif if (numberX[i] >= target && numberX[i] < 2.0*target && iX < 0) iX = i; if (iBand<0 && numberX[i]>target) { iBand = i; factor = factorX[i]; } } if (iX >= 0) { factor = factorX[iX]; break; } else { assert (iBand >= 0); double hi = factor; double lo = (iBand > 0) ? factorX[iBand-1] : 0.0; double diff = (hi - lo) / 9.0; for (i = 0; i < 10; i++) { factorX[i] = lo; lo += diff; } } } for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = randomX[i]; double difference = fabs(solution[iColumn] - newSolution[iColumn]); if (difference + value*factor > 0.5) { numberPerturbed++; if (newSolution[iColumn] < lower[iColumn] + primalTolerance) { newSolution[iColumn] += 1.0; } else if (newSolution[iColumn] > upper[iColumn] - primalTolerance) { newSolution[iColumn] -= 1.0; } else { // general integer if (difference + value > 0.75) newSolution[iColumn] += 1.0; else newSolution[iColumn] -= 1.0; } } } delete [] randomX; } else { for (j = NUMBER_OLD - 1; j > 0; j--) { for (i = 0; i < numberColumns; i++) oldSolution[j][i] = oldSolution[j-1][i]; } for (j = 0; j < numberColumns; j++) oldSolution[0][j] = newSolution[j]; } // 2. update the objective function based on the new rounded solution double offset = 0.0; double costValue = (1.0 - scaleFactor) * solver->getObjSense(); int numberChanged = 0; const double * oldObjective = solver->getObjCoefficients(); bool fixOnesAtBound=false; if (tryOneClosePass&&numberPasses==2) { // take off tryOneClosePass=false; int n=solver->getNumRows()-1; double rhs = solver->getRowUpper()[n]; solver->setRowUpper(n,rhs+1.0e15); useRhs+=1.0e15; fixOnesAtBound=true; } for (i = 0; i < numberColumns; i++) { // below so we can keep original code and allow for objective int iColumn = i; // Special code for "artificials" if (direction*saveObjective[iColumn] >= artificialCost_) { //solver->setObjCoeff(iColumn,scaleFactor*saveObjective[iColumn]); solver->setObjCoeff(iColumn, (artificialFactor*saveObjective[iColumn]) / artificialCost_); } if (!solver->isBinary(iColumn) && !doGeneral) continue; // deal with fixed variables (i.e., upper=lower) if (fabs(lower[iColumn] - upper[iColumn]) < primalTolerance || !solver->isInteger(iColumn)) { //if (lower[iColumn] > 1. - primalTolerance) solver->setObjCoeff(iColumn,-costValue); //else solver->setObjCoeff(iColumn,costValue); continue; } double newValue = 0.0; if (newSolution[iColumn] < lower[iColumn] + primalTolerance) { newValue = costValue + scaleFactor * saveObjective[iColumn]; if (fixOnesAtBound) newValue = 100.0*costValue; } else { if (newSolution[iColumn] > upper[iColumn] - primalTolerance) { newValue = -costValue + scaleFactor * saveObjective[iColumn]; if (fixOnesAtBound) newValue = -100.0*costValue; } } #ifdef RAND_RAND if (!offRandom) newValue *= randomFactor[iColumn]; #endif if (newValue != oldObjective[iColumn]) { numberChanged++; } solver->setObjCoeff(iColumn, newValue); offset += costValue * newSolution[iColumn]; } if (numberPasses==1 && !totalNumberPasses && (model_->specialOptions()&8388608)!=0) { // doing multiple solvers - make a real difference - flip 5% for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = floor(newSolution[iColumn]+0.5); if (fabs(value-solution[iColumn])>primalTolerance) { value = randomNumberGenerator_.randomDouble(); if(value<0.05) { //printf("Flipping %d - random %g\n",iColumn,value); solver->setObjCoeff(iColumn,-solver->getObjCoefficients()[iColumn]); } } } } solver->setDblParam(OsiObjOffset, -offset); if (!general && false) { // Solve in two goes - first keep satisfied ones fixed double * saveLower = new double [numberIntegers]; double * saveUpper = new double [numberIntegers]; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; saveLower[i] = COIN_DBL_MAX; saveUpper[i] = -COIN_DBL_MAX; if (solution[iColumn] < lower[iColumn] + primalTolerance) { saveUpper[i] = upper[iColumn]; solver->setColUpper(iColumn, lower[iColumn]); } else if (solution[iColumn] > upper[iColumn] - primalTolerance) { saveLower[i] = lower[iColumn]; solver->setColLower(iColumn, upper[iColumn]); } } solver->resolve(); if (!solver->isProvenOptimal()) { // presumably max time or some such exitAll = true; break; } for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (saveLower[i] != COIN_DBL_MAX) solver->setColLower(iColumn, saveLower[i]); if (saveUpper[i] != -COIN_DBL_MAX) solver->setColUpper(iColumn, saveUpper[i]); saveUpper[i] = -COIN_DBL_MAX; } memcpy(newSolution, solution, numberColumns*sizeof(double)); int flip; returnCode = rounds(solver, newSolution,/*saveObjective,*/ numberIntegers, integerVariable, /*pumpPrint,*/numberPasses, /*roundExpensive_,*/defaultRounding_, &flip); numberPasses++; if (returnCode) { // solution - but may not be better // Compute using dot product double newSolutionValue = -saveOffset; for ( i = 0 ; i < numberColumns ; i++ ) newSolutionValue += saveObjective[i] * newSolution[i]; newSolutionValue *= direction; sprintf(pumpPrint, "Intermediate solution found of %g", newSolutionValue); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; if (newSolutionValue < solutionValue) { memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; solutionFound = true; numberSolutions++; if (numberSolutions>=maxSolutions) exitAll = true; if (exitNow(newSolutionValue)) exitAll = true; if (basis) { bestBasis = * basis; delete basis; int action = model_->dealWithEventHandler(CbcEventHandler::heuristicSolution, newSolutionValue, betterSolution); if (!action) { double * saveOldSolution = CoinCopyOfArray(model_->bestSolution(), numberColumns); double saveObjectiveValue = model_->getMinimizationObjValue(); model_->setBestSolution(betterSolution, numberColumns, newSolutionValue); if (saveOldSolution && saveObjectiveValue < model_->getMinimizationObjValue()) model_->setBestSolution(saveOldSolution, numberColumns, saveObjectiveValue); delete [] saveOldSolution; } if (!action || model_->maximumSecondsReached()) { exitAll = true; // exit break; } } if ((accumulate_&1) != 0) { model_->incrementUsed(betterSolution); // for local search } solutionValue = newSolutionValue; solutionFound = true; numberSolutions++; if (numberSolutions>=maxSolutions) exitAll = true; if (exitNow(newSolutionValue)) exitAll = true; } else { returnCode = 0; } } } int numberIterations = 0; if (!doGeneral) { // faster to do from all slack!!!! if (allSlack) { CoinWarmStartBasis dummy; solver->setWarmStart(&dummy); } #ifdef COIN_DEVELOP printf("%d perturbed out of %d columns (%d changed)\n", numberPerturbed, numberColumns, numberChanged); #endif bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); if (dualPass && numberChanged > 2) { solver->setHintParam(OsiDoDualInResolve, true); // dual may be better if (dualPass == 1 && 2*numberChanged < numberColumns && (numberChanged < 5000 || 6*numberChanged < numberColumns)) { // but we need to make infeasible CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; if (basis) { // modify const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double * solution = CoinCopyOfArray(solver->getColSolution(), numberColumns); const double * objective = solver->getObjCoefficients(); int nChanged = 0; for (i = 0; i < numberIntegersOrig; i++) { int iColumn = integerVariableOrig[i]; #ifdef RAND_RAND if (nChanged > numberChanged) break; #endif if (objective[iColumn] > 0.0) { if (basis->getStructStatus(iColumn) == CoinWarmStartBasis::atUpperBound) { solution[iColumn] = lower[iColumn]; basis->setStructStatus(iColumn, CoinWarmStartBasis::atLowerBound); nChanged++; } } else if (objective[iColumn] < 0.0) { if (basis->getStructStatus(iColumn) == CoinWarmStartBasis::atLowerBound) { solution[iColumn] = upper[iColumn]; basis->setStructStatus(iColumn, CoinWarmStartBasis::atUpperBound); nChanged++; } } } if (!nChanged) { for (i = 0; i < numberIntegersOrig; i++) { int iColumn = integerVariableOrig[i]; if (objective[iColumn] > 0.0) { if (basis->getStructStatus(iColumn) == CoinWarmStartBasis::basic) { solution[iColumn] = lower[iColumn]; basis->setStructStatus(iColumn, CoinWarmStartBasis::atLowerBound); break; } } else if (objective[iColumn] < 0.0) { if (basis->getStructStatus(iColumn) == CoinWarmStartBasis::basic) { solution[iColumn] = upper[iColumn]; basis->setStructStatus(iColumn, CoinWarmStartBasis::atUpperBound); break; } } } } solver->setColSolution(solution); delete [] solution; solver->setWarmStart(basis); delete basis; } } else { // faster to do from all slack!!!! ??? CoinWarmStartBasis dummy; solver->setWarmStart(&dummy); } } if (numberTries > 1 && numberPasses == 1 && firstPerturbedObjective) { // Modify to use convex combination // use basis from first time solver->setWarmStart(&saveBasis); // and objective if (secondPassOpt < 3 || (secondPassOpt >= 4 && secondPassOpt < 6)) solver->setObjective(firstPerturbedObjective); // and solution solver->setColSolution(firstPerturbedSolution); //if (secondPassOpt==2||secondPassOpt==5|| if (firstPerturbedValue > cutoff) solver->setHintParam(OsiDoDualInResolve, true); // dual may be better } solver->resolve(); if (!solver->isProvenOptimal()) { // presumably max time or some such exitAll = true; break; } solver->setHintParam(OsiDoDualInResolve, takeHint); newTrueSolutionValue = -saveOffset; newSumInfeas = 0.0; newNumberInfeas = 0; { const double * newSolution = solver->getColSolution(); for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++ ) { if (solver->isInteger(iColumn)) { double value = newSolution[iColumn]; double nearest = floor(value + 0.5); newSumInfeas += fabs(value - nearest); if (fabs(value - nearest) > 1.0e-6) { newNumberInfeas++; } } newTrueSolutionValue += saveObjective[iColumn] * newSolution[iColumn]; } newTrueSolutionValue *= direction; if (numberPasses == 1 && secondPassOpt) { if (numberTries == 1 || secondPassOpt > 3) { // save basis CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; if (basis) { saveBasis = * basis; delete basis; } delete [] firstPerturbedObjective; delete [] firstPerturbedSolution; firstPerturbedObjective = CoinCopyOfArray(solver->getObjCoefficients(), numberColumns); firstPerturbedSolution = CoinCopyOfArray(solver->getColSolution(), numberColumns); firstPerturbedValue = newTrueSolutionValue; } } if (newNumberInfeas && newNumberInfeas < 15) { #ifdef JJF_ZERO roundingObjective = solutionValue; OsiSolverInterface * saveSolver = model_->swapSolver(solver); double * currentObjective = CoinCopyOfArray(solver->getObjCoefficients(), numberColumns); solver->setObjective(saveObjective); double saveOffset2; solver->getDblParam(OsiObjOffset, saveOffset2); solver->setDblParam(OsiObjOffset, saveOffset); int ifSol = roundingHeuristic.solution(roundingObjective, roundingSolution); solver->setObjective(currentObjective); solver->setDblParam(OsiObjOffset, saveOffset2); delete [] currentObjective; model_->swapSolver(saveSolver); if (ifSol > 0) abort(); #endif int numberRows = solver->getNumRows(); double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); int * which = new int[newNumberInfeas]; int * stack = new int[newNumberInfeas+1]; double * baseValue = new double[newNumberInfeas]; int * whichRow = new int[numberRows]; double * rowValue = new double[numberRows]; memset(rowValue, 0, numberRows*sizeof(double)); int nRow = 0; // Column copy const double * element = solver->getMatrixByCol()->getElements(); const int * row = solver->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver->getMatrixByCol()->getVectorLengths(); int n = 0; double contrib = 0.0; for ( i = 0 ; i < numberColumns ; i++ ) { double value = newSolution[i]; if (solver->isInteger(i)) { double nearest = floor(value + 0.5); if (fabs(value - nearest) > 1.0e-6) { //printf("Column %d value %g\n",i,value); for (CoinBigIndex j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; //printf("row %d element %g\n",iRow,element[j]); if (!rowValue[iRow]) { rowValue[iRow] = 1.0; whichRow[nRow++] = iRow; } } baseValue[n] = floor(value); contrib += saveObjective[i] * value; value = 0.0; stack[n] = 0; which[n++] = i; } } for (CoinBigIndex j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } if (newNumberInfeas < 15) { stack[n] = newNumberInfeas + 100; int iStack = n; memset(rowValue, 0, numberRows*sizeof(double)); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); while (iStack >= 0) { double contrib2 = 0.0; // Could do faster for (int k = 0 ; k < n ; k++ ) { i = which[k]; double value = baseValue[k] + stack[k]; contrib2 += saveObjective[i] * value; for (CoinBigIndex j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowValue[iRow] += value * element[j]; } } // check if feasible bool feasible = true; for (int k = 0; k < nRow; k++) { i = whichRow[k]; double value = rowValue[i] + rowActivity[i]; rowValue[i] = 0.0; if (value < rowLower[i] - 1.0e-7 || value > rowUpper[i] + 1.0e-7) feasible = false; } if (feasible) { double newObj = newTrueSolutionValue * direction; newObj += contrib2 - contrib; newObj *= direction; #ifdef COIN_DEVELOP printf("FFFeasible! - obj %g\n", newObj); #endif if (newObj < roundingObjective - 1.0e-6) { #ifdef COIN_DEVELOP printf("FBetter\n"); #endif roundingObjective = newObj; memcpy(roundingSolution, newSolution, numberColumns*sizeof(double)); for (int k = 0 ; k < n ; k++ ) { i = which[k]; double value = baseValue[k] + stack[k]; roundingSolution[i] = value; } } } while (iStack >= 0 && stack[iStack]) { stack[iStack]--; iStack--; } if (iStack >= 0) { stack[iStack] = 1; iStack = n; stack[n] = 1; } } } delete [] rowActivity; delete [] which; delete [] stack; delete [] baseValue; delete [] whichRow; delete [] rowValue; } } if (true) { OsiSolverInterface * saveSolver = model_->swapSolver(clonedSolver); clonedSolver->setColSolution(solver->getColSolution()); CbcRounding heuristic1(*model_); heuristic1.setHeuristicName("rounding in feaspump!"); heuristic1.setWhen(1); roundingObjective = CoinMin(roundingObjective, solutionValue); double testSolutionValue = newTrueSolutionValue; int returnCode = heuristic1.solution(roundingObjective, roundingSolution, testSolutionValue) ; if (returnCode == 1) { #ifdef COIN_DEVELOP printf("rounding obj of %g?\n", roundingObjective); #endif //roundingObjective = newSolutionValue; //} else { //roundingObjective = COIN_DBL_MAX; } model_->swapSolver(saveSolver); } if (!solver->isProvenOptimal()) { // presumably max time or some such exitAll = true; break; } // in case very dubious solver lower = solver->getColLower(); upper = solver->getColUpper(); solution = solver->getColSolution(); numberIterations = solver->getIterationCount(); } else { int * addStart = new int[2*general+1]; int * addIndex = new int[4*general]; double * addElement = new double[4*general]; double * addLower = new double[2*general]; double * addUpper = new double[2*general]; double * obj = new double[general]; int nAdd = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (newSolution[iColumn] > lower[iColumn] + primalTolerance && newSolution[iColumn] < upper[iColumn] - primalTolerance) { assert (upper[iColumn] - lower[iColumn] > 1.00001); obj[nAdd] = 1.0; addLower[nAdd] = 0.0; addUpper[nAdd] = COIN_DBL_MAX; nAdd++; } } OsiSolverInterface * solver2 = solver; if (nAdd) { CoinZeroN(addStart, nAdd + 1); solver2 = solver->clone(); solver2->addCols(nAdd, addStart, NULL, NULL, addLower, addUpper, obj); // feasible solution double * sol = new double[nAdd+numberColumns]; memcpy(sol, solution, numberColumns*sizeof(double)); // now rows int nAdd = 0; int nEl = 0; int nAddRow = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (newSolution[iColumn] > lower[iColumn] + primalTolerance && newSolution[iColumn] < upper[iColumn] - primalTolerance) { addLower[nAddRow] = -newSolution[iColumn];; addUpper[nAddRow] = COIN_DBL_MAX; addIndex[nEl] = iColumn; addElement[nEl++] = -1.0; addIndex[nEl] = numberColumns + nAdd; addElement[nEl++] = 1.0; nAddRow++; addStart[nAddRow] = nEl; addLower[nAddRow] = newSolution[iColumn];; addUpper[nAddRow] = COIN_DBL_MAX; addIndex[nEl] = iColumn; addElement[nEl++] = 1.0; addIndex[nEl] = numberColumns + nAdd; addElement[nEl++] = 1.0; nAddRow++; addStart[nAddRow] = nEl; sol[nAdd+numberColumns] = fabs(sol[iColumn] - newSolution[iColumn]); nAdd++; } } solver2->setColSolution(sol); delete [] sol; solver2->addRows(nAddRow, addStart, addIndex, addElement, addLower, addUpper); } delete [] addStart; delete [] addIndex; delete [] addElement; delete [] addLower; delete [] addUpper; delete [] obj; solver2->resolve(); if (!solver2->isProvenOptimal()) { // presumably max time or some such exitAll = true; break; } //assert (solver2->isProvenOptimal()); if (nAdd) { solver->setColSolution(solver2->getColSolution()); numberIterations = solver2->getIterationCount(); delete solver2; } else { numberIterations = solver->getIterationCount(); } lower = solver->getColLower(); upper = solver->getColUpper(); solution = solver->getColSolution(); newTrueSolutionValue = -saveOffset; newSumInfeas = 0.0; newNumberInfeas = 0; { const double * newSolution = solver->getColSolution(); for ( i = 0 ; i < numberColumns ; i++ ) { if (solver->isInteger(i)) { double value = newSolution[i]; double nearest = floor(value + 0.5); newSumInfeas += fabs(value - nearest); if (fabs(value - nearest) > 1.0e-6) newNumberInfeas++; } newTrueSolutionValue += saveObjective[i] * newSolution[i]; } newTrueSolutionValue *= direction; } } if (lastMove != 1000000) { if (newSumInfeas < lastSumInfeas) { lastMove = numberPasses; lastSumInfeas = newSumInfeas; } else if (newSumInfeas > lastSumInfeas + 1.0e-5) { lastMove = 1000000; // going up } } totalNumberIterations += numberIterations; if (solver->getNumRows() < 3000) sprintf(pumpPrint, "Pass %3d: suminf. %10.5f (%d) obj. %g iterations %d", numberPasses + totalNumberPasses, newSumInfeas, newNumberInfeas, newTrueSolutionValue, numberIterations); else sprintf(pumpPrint, "Pass %3d: (%.2f seconds) suminf. %10.5f (%d) obj. %g iterations %d", numberPasses + totalNumberPasses, model_->getCurrentSeconds(), newSumInfeas, newNumberInfeas, newTrueSolutionValue, numberIterations); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; CbcEventHandler *eventHandler = model_->getEventHandler() ; if (eventHandler) { typedef struct { double newSumInfeas; double trueSolutionValue; double spareDouble[2]; OsiSolverInterface * solver; void * sparePointer[2]; int numberPasses; int totalNumberPasses; int numberInfeas; int numberIterations; int spareInt[3]; } HeurPass; HeurPass temp; temp.solver=solver; temp.newSumInfeas = newSumInfeas; temp.trueSolutionValue = newTrueSolutionValue; temp.numberPasses=numberPasses; temp.totalNumberPasses=totalNumberPasses; temp.numberInfeas=newNumberInfeas; temp.numberIterations=numberIterations; CbcEventHandler::CbcAction status = eventHandler->event(CbcEventHandler::heuristicPass, &temp); if (status==CbcEventHandler::killSolution) { exitAll = true; break; } } if (closestSolution && solver->getObjValue() < closestObjectiveValue) { int i; const double * objective = solver->getObjCoefficients(); for (i = 0; i < numberIntegersOrig; i++) { int iColumn = integerVariableOrig[i]; if (objective[iColumn] > 0.0) closestSolution[i] = 0; else closestSolution[i] = 1; } closestObjectiveValue = solver->getObjValue(); } // See if we need to think about changing rhs if ((switches_&12) != 0 && useRhs < 1.0e50) { double oldRhs = useRhs; bool trying = false; if ((switches_&4) != 0 && numberPasses && (numberPasses % 50) == 0) { if (solutionValue > 1.0e20) { // only if no genuine solution double gap = useRhs - continuousObjectiveValue; useRhs += 0.1 * gap; if (exactMultiple) { useRhs = exactMultiple * ceil(useRhs / exactMultiple); useRhs = CoinMax(useRhs, oldRhs + exactMultiple); } trying = true; } } if ((switches_&8) != 0) { // Put in new suminf and check double largest = newSumInfeas; double smallest = newSumInfeas; for (int i = 0; i < SIZE_BOBBLE - 1; i++) { double value = saveSumInf[i+1]; saveSumInf[i] = value; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } saveSumInf[SIZE_BOBBLE-1] = newSumInfeas; if (smallest*1.5 > largest && smallest > 2.0) { if (bobbleMode == 0) { // go closer double gap = oldRhs - continuousObjectiveValue; useRhs -= 0.4 * gap; if (exactMultiple) { double value = floor(useRhs / exactMultiple); useRhs = CoinMin(value * exactMultiple, oldRhs - exactMultiple); } if (useRhs < continuousObjectiveValue) { // skip decrease bobbleMode = 1; useRhs = oldRhs; } } if (bobbleMode) { trying = true; // weaken if (solutionValue < 1.0e20) { double gap = solutionValue - oldRhs; useRhs += 0.3 * gap; } else { double gap = oldRhs - continuousObjectiveValue; useRhs += 0.05 * gap; } if (exactMultiple) { double value = ceil(useRhs / exactMultiple); useRhs = CoinMin(value * exactMultiple, solutionValue - exactMultiple); } } bobbleMode++; // reset CoinFillN(saveSumInf, SIZE_BOBBLE, COIN_DBL_MAX); } } if (useRhs != oldRhs) { // tidy up if (exactMultiple) { double value = floor(useRhs / exactMultiple); double bestPossible = ceil(continuousObjectiveValue / exactMultiple); useRhs = CoinMax(value, bestPossible) * exactMultiple; } else { useRhs = CoinMax(useRhs, continuousObjectiveValue); } int k = solver->getNumRows() - 1; solver->setRowUpper(k, useRhs + useOffset); bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); if (useRhs < oldRhs) { solver->setHintParam(OsiDoDualInResolve, true); solver->resolve(); } else if (useRhs > oldRhs) { solver->setHintParam(OsiDoDualInResolve, false); solver->resolve(); } solver->setHintParam(OsiDoDualInResolve, takeHint); if (!solver->isProvenOptimal()) { // presumably max time or some such exitAll = true; break; } } else if (trying) { // doesn't look good break; } } } // reduce scale factor scaleFactor *= weightFactor_; } // END WHILE // see if rounding worked! if (roundingObjective < solutionValue) { if (roundingObjective < solutionValue - 1.0e-6*fabs(roundingObjective)) { sprintf(pumpPrint, "Rounding solution of %g is better than previous of %g\n", roundingObjective, solutionValue); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; } solutionValue = roundingObjective; newSolutionValue = solutionValue; memcpy(betterSolution, roundingSolution, numberColumns*sizeof(double)); solutionFound = true; numberSolutions++; if (numberSolutions>=maxSolutions) exitAll = true; if (exitNow(roundingObjective)) exitAll = true; } if (!solutionFound) { sprintf(pumpPrint, "No solution found this major pass"); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; } //} delete solver; solver = NULL; for ( j = 0; j < NUMBER_OLD; j++) delete [] oldSolution[j]; delete [] oldSolution; delete [] saveObjective; if (usedColumn && !exitAll) { OsiSolverInterface * newSolver = cloneBut(3); // was model_->continuousSolver()->clone(); #if 0 //def COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (newSolver); if (clpSolver) { ClpSimplex * simplex = clpSolver->getModelPtr(); simplex->writeMps("start.mps",2,1); } #endif const double * colLower = newSolver->getColLower(); const double * colUpper = newSolver->getColUpper(); bool stopBAB = false; int allowedPass = -1; if (maximumAllowed > 0) allowedPass = CoinMax(numberPasses - maximumAllowed, -1); while (!stopBAB) { stopBAB = true; int i; int nFix = 0; int nFixI = 0; int nFixC = 0; int nFixC2 = 0; for (i = 0; i < numberIntegersOrig; i++) { int iColumn = integerVariableOrig[i]; //const OsiObject * object = model_->object(i); //double originalLower; //double originalUpper; //getIntegerInformation( object,originalLower, originalUpper); //assert(colLower[iColumn]==originalLower); //newSolver->setColLower(iColumn,CoinMax(colLower[iColumn],originalLower)); newSolver->setColLower(iColumn, colLower[iColumn]); //assert(colUpper[iColumn]==originalUpper); //newSolver->setColUpper(iColumn,CoinMin(colUpper[iColumn],originalUpper)); newSolver->setColUpper(iColumn, colUpper[iColumn]); if (usedColumn[iColumn] <= allowedPass) { double value = lastSolution[iColumn]; double nearest = floor(value + 0.5); if (fabs(value - nearest) < 1.0e-7) { if (nearest == colLower[iColumn]) { newSolver->setColUpper(iColumn, colLower[iColumn]); nFix++; } else if (nearest == colUpper[iColumn]) { newSolver->setColLower(iColumn, colUpper[iColumn]); nFix++; } else if (fixInternal) { newSolver->setColLower(iColumn, nearest); newSolver->setColUpper(iColumn, nearest); nFix++; nFixI++; } } } } if (fixContinuous) { for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn) && usedColumn[iColumn] <= allowedPass) { double value = lastSolution[iColumn]; if (value < colLower[iColumn] + 1.0e-8) { newSolver->setColUpper(iColumn, colLower[iColumn]); nFixC++; } else if (value > colUpper[iColumn] - 1.0e-8) { newSolver->setColLower(iColumn, colUpper[iColumn]); nFixC++; } else if (fixContinuous == 2) { newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); nFixC++; nFixC2++; } } } } newSolver->initialSolve(); if (!newSolver->isProvenOptimal()) { //newSolver->writeMps("bad.mps"); //assert (newSolver->isProvenOptimal()); exitAll = true; break; } sprintf(pumpPrint, "Before mini branch and bound, %d integers at bound fixed and %d continuous", nFix, nFixC); if (nFixC2 + nFixI != 0) sprintf(pumpPrint + strlen(pumpPrint), " of which %d were internal integer and %d internal continuous", nFixI, nFixC2); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; double saveValue = newSolutionValue; if (newSolutionValue - model_->getCutoffIncrement() > continuousObjectiveValue - 1.0e-7) { double saveFraction = fractionSmall_; if (numberTries > 1 && !numberBandBsolutions) fractionSmall_ *= 0.5; // Give branch and bound a bit more freedom double cutoff2 = newSolutionValue + CoinMax(model_->getCutoffIncrement(), 1.0e-3); #if 0 { OsiClpSolverInterface * clpSolver = dynamic_cast (newSolver); if (clpSolver) { ClpSimplex * simplex = clpSolver->getModelPtr(); simplex->writeMps("testA.mps",2,1); } } #endif int returnCode2 = smallBranchAndBound(newSolver, numberNodes_, newSolution, newSolutionValue, cutoff2, "CbcHeuristicLocalAfterFPump"); fractionSmall_ = saveFraction; if (returnCode2 < 0) { if (returnCode2 == -2) { exitAll = true; returnCode = 0; } else { returnCode2 = 0; // returned on size - try changing //#define ROUND_AGAIN #ifdef ROUND_AGAIN if (numberTries == 1 && numberPasses > 20 && allowedPass < numberPasses - 1) { allowedPass = (numberPasses + allowedPass) >> 1; sprintf(pumpPrint, "Fixing all variables which were last changed on pass %d and trying again", allowedPass); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; stopBAB = false; continue; } #endif } } if ((returnCode2&2) != 0) { // could add cut returnCode2 &= ~2; } if (returnCode2) { numberBandBsolutions++; // may not have got solution earlier returnCode |= 1; } } else { // no need exitAll = true; //returnCode=0; } // recompute solution value if (returnCode && true) { #if 0 { OsiClpSolverInterface * clpSolver = dynamic_cast (newSolver); if (clpSolver) { ClpSimplex * simplex = clpSolver->getModelPtr(); simplex->writeMps("testB.mps",2,1); } } #endif delete newSolver; newSolver = cloneBut(3); // was model_->continuousSolver()->clone(); newSolutionValue = -saveOffset; double newSumInfeas = 0.0; const double * obj = newSolver->getObjCoefficients(); for (int i = 0 ; i < numberColumns ; i++ ) { if (newSolver->isInteger(i)) { double value = newSolution[i]; double nearest = floor(value + 0.5); newSumInfeas += fabs(value - nearest); } newSolutionValue += obj[i] * newSolution[i]; } newSolutionValue *= direction; } bool gotSolution = false; if (returnCode && newSolutionValue < saveValue) { sprintf(pumpPrint, "Mini branch and bound improved solution from %g to %g (%.2f seconds)", saveValue, newSolutionValue, model_->getCurrentSeconds()); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); gotSolution = true; if (fixContinuous && nFixC + nFixC2 > 0) { // may be able to do even better int nFixed = 0; const double * lower = model_->solver()->getColLower(); const double * upper = model_->solver()->getColUpper(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = newSolution[iColumn]; if (newSolver->isInteger(iColumn)) { value = floor(newSolution[iColumn] + 0.5); newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); nFixed++; } else { newSolver->setColLower(iColumn, lower[iColumn]); newSolver->setColUpper(iColumn, upper[iColumn]); if (value < lower[iColumn]) value = lower[iColumn]; else if (value > upper[iColumn]) value = upper[iColumn]; } newSolution[iColumn] = value; } newSolver->setColSolution(newSolution); //#define CLP_INVESTIGATE2 #ifdef CLP_INVESTIGATE2 { // check // get row activities int numberRows = newSolver->getNumRows(); double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); newSolver->getMatrixByCol()->times(newSolution, rowActivity) ; double largestInfeasibility = primalTolerance; double sumInfeasibility = 0.0; int numberBadRows = 0; const double * rowLower = newSolver->getRowLower(); const double * rowUpper = newSolver->getRowUpper(); for (i = 0 ; i < numberRows ; i++) { double value; value = rowLower[i] - rowActivity[i]; if (value > primalTolerance) { numberBadRows++; largestInfeasibility = CoinMax(largestInfeasibility, value); sumInfeasibility += value; } value = rowActivity[i] - rowUpper[i]; if (value > primalTolerance) { numberBadRows++; largestInfeasibility = CoinMax(largestInfeasibility, value); sumInfeasibility += value; } } printf("%d bad rows, largest inf %g sum %g\n", numberBadRows, largestInfeasibility, sumInfeasibility); delete [] rowActivity; } #endif #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (newSolver); if (clpSolver) { ClpSimplex * simplex = clpSolver->getModelPtr(); //simplex->writeBasis("test.bas",true,2); //simplex->writeMps("test.mps",2,1); if (nFixed*3 > numberColumns*2) simplex->allSlackBasis(); // may as well go from all slack int logLevel=simplex->logLevel(); if (logLevel<=1) simplex->setLogLevel(0); simplex->primal(1); simplex->setLogLevel(logLevel); clpSolver->setWarmStart(NULL); } #endif newSolver->initialSolve(); if (newSolver->isProvenOptimal()) { double value = newSolver->getObjValue() * newSolver->getObjSense(); if (value < newSolutionValue) { //newSolver->writeMpsNative("query.mps", NULL, NULL, 2); #ifdef JJF_ZERO { double saveOffset; newSolver->getDblParam(OsiObjOffset, saveOffset); const double * obj = newSolver->getObjCoefficients(); double newTrueSolutionValue = -saveOffset; double newSumInfeas = 0.0; int numberColumns = newSolver->getNumCols(); const double * solution = newSolver->getColSolution(); for (int i = 0 ; i < numberColumns ; i++ ) { if (newSolver->isInteger(i)) { double value = solution[i]; double nearest = floor(value + 0.5); newSumInfeas += fabs(value - nearest); } if (solution[i]) printf("%d obj %g val %g - total %g\n", i, obj[i], solution[i], newTrueSolutionValue); newTrueSolutionValue += obj[i] * solution[i]; } printf("obj %g - inf %g\n", newTrueSolutionValue, newSumInfeas); } #endif sprintf(pumpPrint, "Freeing continuous variables gives a solution of %g", value); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; newSolutionValue = value; memcpy(betterSolution, newSolver->getColSolution(), numberColumns*sizeof(double)); } } else { //newSolver->writeMps("bad3.mps"); sprintf(pumpPrint, "On closer inspection solution is not valid"); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; exitAll = true; break; } } } else { sprintf(pumpPrint, "Mini branch and bound did not improve solution (%.2f seconds)", model_->getCurrentSeconds()); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; if (returnCode && newSolutionValue < saveValue + 1.0e-3 && nFixC + nFixC2) { // may be able to do better const double * lower = model_->solver()->getColLower(); const double * upper = model_->solver()->getColUpper(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (newSolver->isInteger(iColumn)) { double value = floor(newSolution[iColumn] + 0.5); newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); } else { newSolver->setColLower(iColumn, lower[iColumn]); newSolver->setColUpper(iColumn, upper[iColumn]); } } newSolver->initialSolve(); if (newSolver->isProvenOptimal()) { double value = newSolver->getObjValue() * newSolver->getObjSense(); if (value < saveValue) { sprintf(pumpPrint, "Freeing continuous variables gives a solution of %g", value); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; //newSolver->writeMpsNative("query2.mps", NULL, NULL, 2); newSolutionValue = value; memcpy(betterSolution, newSolver->getColSolution(), numberColumns*sizeof(double)); gotSolution = true; } } } } if (gotSolution) { if ((accumulate_&1) != 0) { model_->incrementUsed(betterSolution); // for local search } solutionValue = newSolutionValue; solutionFound = true; numberSolutions++; if (numberSolutions>=maxSolutions) exitAll = true; if (exitNow(newSolutionValue)) exitAll = true; CoinWarmStartBasis * basis = dynamic_cast(newSolver->getWarmStart()) ; if (basis) { bestBasis = * basis; delete basis; int action = model_->dealWithEventHandler(CbcEventHandler::heuristicSolution, newSolutionValue, betterSolution); if (action == 0) { double * saveOldSolution = CoinCopyOfArray(model_->bestSolution(), numberColumns); double saveObjectiveValue = model_->getMinimizationObjValue(); model_->setBestSolution(betterSolution, numberColumns, newSolutionValue); if (saveOldSolution && saveObjectiveValue < model_->getMinimizationObjValue()) model_->setBestSolution(saveOldSolution, numberColumns, saveObjectiveValue); delete [] saveOldSolution; } if (!action || model_->getCurrentSeconds() > model_->getMaximumSeconds()) { exitAll = true; // exit break; } } } } // end stopBAB while delete newSolver; } if (solutionFound) finalReturnCode = 1; cutoff = CoinMin(cutoff, solutionValue - model_->getCutoffIncrement()); if (numberTries >= maximumRetries_ || !solutionFound || exitAll || cutoff < continuousObjectiveValue + 1.0e-7) { break; } else { solutionFound = false; if (absoluteIncrement_ > 0.0 || relativeIncrement_ > 0.0) { double gap = relativeIncrement_ * fabs(solutionValue); double change = CoinMax(gap, absoluteIncrement_); cutoff = CoinMin(cutoff, solutionValue - change); } else { //double weights[10]={0.1,0.1,0.2,0.2,0.2,0.3,0.3,0.3,0.4,0.5}; double weights[10] = {0.1, 0.2, 0.3, 0.3, 0.4, 0.4, 0.4, 0.5, 0.5, 0.6}; cutoff -= weights[CoinMin(numberTries-1, 9)] * (cutoff - continuousObjectiveValue); } // But round down if (exactMultiple) cutoff = exactMultiple * floor(cutoff / exactMultiple); if (cutoff < continuousObjectiveValue) break; sprintf(pumpPrint, "Round again with cutoff of %g", cutoff); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; if ((accumulate_&3) < 2 && usedColumn) { for (int i = 0; i < numberColumns; i++) usedColumn[i] = -1; } averageIterationsPerTry = totalNumberIterations / numberTries; numberIterationsLastPass = totalNumberIterations; totalNumberPasses += numberPasses - 1; } } /* End of the `exitAll' loop. */ #ifdef RAND_RAND delete [] randomFactor; #endif delete solver; // probably NULL but do anyway if (!finalReturnCode && closestSolution && closestObjectiveValue <= 10.0 && usedColumn && !model_->maximumSecondsReached()) { // try a bit of branch and bound OsiSolverInterface * newSolver = cloneBut(1); // was model_->continuousSolver()->clone(); const double * colLower = newSolver->getColLower(); const double * colUpper = newSolver->getColUpper(); int i; double rhs = 0.0; for (i = 0; i < numberIntegersOrig; i++) { int iColumn = integerVariableOrig[i]; int direction = closestSolution[i]; closestSolution[i] = iColumn; if (direction == 0) { // keep close to LB rhs += colLower[iColumn]; lastSolution[i] = 1.0; } else { // keep close to UB rhs -= colUpper[iColumn]; lastSolution[i] = -1.0; } } newSolver->addRow(numberIntegersOrig, closestSolution, lastSolution, -COIN_DBL_MAX, rhs + 10.0); //double saveValue = newSolutionValue; //newSolver->writeMps("sub"); int returnCode = smallBranchAndBound(newSolver, numberNodes_, newSolution, newSolutionValue, newSolutionValue, "CbcHeuristicLocalAfterFPump"); if (returnCode < 0) returnCode = 0; // returned on size if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } if (returnCode) { //printf("old sol of %g new of %g\n",saveValue,newSolutionValue); memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); //abort(); solutionValue = newSolutionValue; solutionFound = true; numberSolutions++; if (numberSolutions>=maxSolutions) exitAll = true; if (exitNow(newSolutionValue)) exitAll = true; } delete newSolver; } delete clonedSolver; delete [] roundingSolution; delete [] usedColumn; delete [] lastSolution; delete [] newSolution; delete [] closestSolution; delete [] integerVariable; delete [] firstPerturbedObjective; delete [] firstPerturbedSolution; if (solutionValue == incomingObjective) sprintf(pumpPrint, "After %.2f seconds - Feasibility pump exiting - took %.2f seconds", model_->getCurrentSeconds(), CoinCpuTime() - time1); else if (numberSolutions < maxSolutions) sprintf(pumpPrint, "After %.2f seconds - Feasibility pump exiting with objective of %g - took %.2f seconds", model_->getCurrentSeconds(), solutionValue, CoinCpuTime() - time1); else sprintf(pumpPrint, "After %.2f seconds - Feasibility pump exiting with objective of %g (stopping after %d solutions) - took %.2f seconds", model_->getCurrentSeconds(), solutionValue, numberSolutions,CoinCpuTime() - time1); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << pumpPrint << CoinMessageEol; if (bestBasis.getNumStructural()) model_->setBestSolutionBasis(bestBasis); //model_->setMinimizationObjValue(saveBestObjective); if ((accumulate_&1) != 0 && numberSolutions > 1 && !model_->getSolutionCount()) { model_->setSolutionCount(1); // for local search model_->setNumberHeuristicSolutions(1); } #ifdef COIN_DEVELOP { double ncol = model_->solver()->getNumCols(); double nrow = model_->solver()->getNumRows(); printf("XXX total iterations %d ratios - %g %g %g\n", totalNumberIterations, static_cast (totalNumberIterations) / nrow, static_cast (totalNumberIterations) / ncol, static_cast (totalNumberIterations) / (2*nrow + 2*ncol)); } #endif return finalReturnCode; } /**************************END MAIN PROCEDURE ***********************************/ // update model void CbcHeuristicFPump::setModel(CbcModel * model) { model_ = model; } /* Rounds solution - down if < downValue returns 1 if current is a feasible solution */ int CbcHeuristicFPump::rounds(OsiSolverInterface * solver, double * solution, //const double * objective, int numberIntegers, const int * integerVariable, /*char * pumpPrint,*/ int iter, /*bool roundExpensive,*/ double downValue, int *flip) { double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance ; solver->getDblParam(OsiPrimalTolerance, primalTolerance) ; int i; const double * cost = solver->getObjCoefficients(); int flip_up = 0; int flip_down = 0; double v = randomNumberGenerator_.randomDouble() * 20.0; int nn = 10 + static_cast (v); int nnv = 0; int * list = new int [nn]; double * val = new double [nn]; for (i = 0; i < nn; i++) val[i] = .001; const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int numberRows = solver->getNumRows(); if (false && (iter&1) != 0) { // Do set covering variables const CoinPackedMatrix * matrixByRow = solver->getMatrixByRow(); const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); for (i = 0; i < numberRows; i++) { if (rowLower[i] == 1.0 && rowUpper[i] == 1.0) { bool cover = true; double largest = 0.0; int jColumn = -1; for (CoinBigIndex k = rowStart[i]; k < rowStart[i] + rowLength[i]; k++) { int iColumn = column[k]; if (elementByRow[k] != 1.0 || !solver->isInteger(iColumn)) { cover = false; break; } else { if (solution[iColumn]) { double value = solution[iColumn] * (randomNumberGenerator_.randomDouble() + 5.0); if (value > largest) { largest = value; jColumn = iColumn; } } } } if (cover) { for (CoinBigIndex k = rowStart[i]; k < rowStart[i] + rowLength[i]; k++) { int iColumn = column[k]; if (iColumn == jColumn) solution[iColumn] = 1.0; else solution[iColumn] = 0.0; } } } } } int numberColumns = solver->getNumCols(); #ifdef JJF_ZERO // Do set covering variables const CoinPackedMatrix * matrixByRow = solver->getMatrixByRow(); const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); double * sortTemp = new double[numberColumns]; int * whichTemp = new int [numberColumns]; char * rowTemp = new char [numberRows]; memset(rowTemp, 0, numberRows); for (i = 0; i < numberColumns; i++) whichTemp[i] = -1; int nSOS = 0; for (i = 0; i < numberRows; i++) { if (rowLower[i] == 1.0 && rowUpper[i] == 1.0) { bool cover = true; for (CoinBigIndex k = rowStart[i]; k < rowStart[i] + rowLength[i]; k++) { int iColumn = column[k]; if (elementByRow[k] != 1.0 || !solver->isInteger(iColumn)) { cover = false; break; } } if (cover) { rowTemp[i] = 1; nSOS++; for (CoinBigIndex k = rowStart[i]; k < rowStart[i] + rowLength[i]; k++) { int iColumn = column[k]; double value = solution[iColumn]; whichTemp[iColumn] = iColumn; } } } } if (nSOS) { // Column copy const CoinPackedMatrix * matrixByColumn = solver->getMatrixByCol(); //const double * element = matrixByColumn->getElements(); const int * row = matrixByColumn->getIndices(); const CoinBigIndex * columnStart = matrixByColumn->getVectorStarts(); const int * columnLength = matrixByColumn->getVectorLengths(); int nLook = 0; for (i = 0; i < numberColumns; i++) { if (whichTemp[i] >= 0) { whichTemp[nLook] = i; double value = solution[i]; if (value < 0.5) value *= (0.1 * randomNumberGenerator_.randomDouble() + 0.3); sortTemp[nLook++] = -value; } } CoinSort_2(sortTemp, sortTemp + nLook, whichTemp); double smallest = 1.0; int nFix = 0; int nOne = 0; for (int j = 0; j < nLook; j++) { int jColumn = whichTemp[j]; double thisValue = solution[jColumn]; if (!thisValue) continue; if (thisValue == 1.0) nOne++; smallest = CoinMin(smallest, thisValue); solution[jColumn] = 1.0; double largest = 0.0; for (CoinBigIndex jEl = columnStart[jColumn]; jEl < columnStart[jColumn] + columnLength[jColumn]; jEl++) { int jRow = row[jEl]; if (rowTemp[jRow]) { for (CoinBigIndex k = rowStart[jRow]; k < rowStart[jRow] + rowLength[jRow]; k++) { int iColumn = column[k]; if (solution[iColumn]) { if (iColumn != jColumn) { double value = solution[iColumn]; if (value > largest) largest = value; solution[iColumn] = 0.0; } } } } } if (largest > thisValue) printf("%d was at %g - chosen over a value of %g\n", jColumn, thisValue, largest); nFix++; } printf("%d fixed out of %d (%d at one already)\n", nFix, nLook, nOne); } delete [] sortTemp; delete [] whichTemp; delete [] rowTemp; #endif const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); // Check if valid with current solution (allow for 0.99999999s) double newSumInfeas = 0.0; int newNumberInfeas = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = solution[iColumn]; double round = floor(value + 0.5); if (fabs(value - round) > primalTolerance) { newSumInfeas += fabs(value-round); newNumberInfeas++; } } if (!newNumberInfeas) { // may be able to use solution even if 0.99999's double * saveLower = CoinCopyOfArray(columnLower, numberColumns); double * saveUpper = CoinCopyOfArray(columnUpper, numberColumns); double * saveSolution = CoinCopyOfArray(solution, numberColumns); double * tempSolution = CoinCopyOfArray(solution, numberColumns); CoinWarmStartBasis * saveBasis = dynamic_cast(solver->getWarmStart()) ; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = solution[iColumn]; double round = floor(value + 0.5); solver->setColLower(iColumn, round); solver->setColUpper(iColumn, round); tempSolution[iColumn] = round; } solver->setColSolution(tempSolution); delete [] tempSolution; solver->resolve(); solver->setColLower(saveLower); solver->setColUpper(saveUpper); solver->setWarmStart(saveBasis); delete [] saveLower; delete [] saveUpper; delete saveBasis; if (!solver->isProvenOptimal()) { solver->setColSolution(saveSolution); } delete [] saveSolution; if (solver->isProvenOptimal()) { // feasible delete [] list; delete [] val; return 1; } } //double * saveSolution = CoinCopyOfArray(solution,numberColumns); // return rounded solution for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = solution[iColumn]; double round = floor(value + primalTolerance); if (value - round > downValue) round += 1.; #ifndef JJF_ONE if (round < integerTolerance && cost[iColumn] < -1. + integerTolerance) flip_down++; if (round > 1. - integerTolerance && cost[iColumn] > 1. - integerTolerance) flip_up++; #else if (round < columnLower[iColumn] + integerTolerance && cost[iColumn] < -1. + integerTolerance) flip_down++; if (round > columnUpper[iColumn] - integerTolerance && cost[iColumn] > 1. - integerTolerance) flip_up++; #endif if (flip_up + flip_down == 0) { for (int k = 0; k < nn; k++) { if (fabs(value - round) > val[k]) { nnv++; for (int j = nn - 2; j >= k; j--) { val[j+1] = val[j]; list[j+1] = list[j]; } val[k] = fabs(value - round); list[k] = iColumn; break; } } } solution[iColumn] = round; } if (nnv > nn) nnv = nn; //if (iter != 0) //sprintf(pumpPrint+strlen(pumpPrint),"up = %5d , down = %5d", flip_up, flip_down); *flip = flip_up + flip_down; if (*flip == 0 && iter != 0) { //sprintf(pumpPrint+strlen(pumpPrint)," -- rand = %4d (%4d) ", nnv, nn); for (i = 0; i < nnv; i++) { // was solution[list[i]] = 1. - solution[list[i]]; but does that work for 7>=x>=6 int index = list[i]; double value = solution[index]; if (value <= 1.0) { solution[index] = 1.0 - value; } else if (value < columnLower[index] + integerTolerance) { solution[index] = value + 1.0; } else if (value > columnUpper[index] - integerTolerance) { solution[index] = value - 1.0; } else { solution[index] = value - 1.0; } } *flip = nnv; } else { //sprintf(pumpPrint+strlen(pumpPrint)," "); } delete [] list; delete [] val; //iter++; // get row activities double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); solver->getMatrixByCol()->times(solution, rowActivity) ; double largestInfeasibility = primalTolerance; double sumInfeasibility = 0.0; int numberBadRows = 0; for (i = 0 ; i < numberRows ; i++) { double value; value = rowLower[i] - rowActivity[i]; if (value > primalTolerance) { numberBadRows++; largestInfeasibility = CoinMax(largestInfeasibility, value); sumInfeasibility += value; } value = rowActivity[i] - rowUpper[i]; if (value > primalTolerance) { numberBadRows++; largestInfeasibility = CoinMax(largestInfeasibility, value); sumInfeasibility += value; } } #ifdef JJF_ZERO if (largestInfeasibility > primalTolerance && numberBadRows*10 < numberRows) { // Can we improve by flipping for (int iPass = 0; iPass < 10; iPass++) { int numberColumns = solver->getNumCols(); const CoinPackedMatrix * matrixByCol = solver->getMatrixByCol(); const double * element = matrixByCol->getElements(); const int * row = matrixByCol->getIndices(); const CoinBigIndex * columnStart = matrixByCol->getVectorStarts(); const int * columnLength = matrixByCol->getVectorLengths(); double oldSum = sumInfeasibility; // First improve by moving continuous ones for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!solver->isInteger(iColumn)) { double solValue = solution[iColumn]; double thetaUp = columnUpper[iColumn] - solValue; double improvementUp = 0.0; if (thetaUp > primalTolerance) { // can go up for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double distanceUp = rowUpper[iRow] - rowActivity[iRow]; double distanceDown = rowLower[iRow] - rowActivity[iRow]; double el = element[j]; if (el > 0.0) { // positive element if (distanceUp > 0.0) { if (thetaUp*el > distanceUp) thetaUp = distanceUp / el; } else { improvementUp -= el; } if (distanceDown > 0.0) { if (thetaUp*el > distanceDown) thetaUp = distanceDown / el; improvementUp += el; } } else { // negative element if (distanceDown < 0.0) { if (thetaUp*el < distanceDown) thetaUp = distanceDown / el; } else { improvementUp += el; } if (distanceUp < 0.0) { if (thetaUp*el < distanceUp) thetaUp = distanceUp / el; improvementUp -= el; } } } } double thetaDown = solValue - columnLower[iColumn]; double improvementDown = 0.0; if (thetaDown > primalTolerance) { // can go down for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double distanceUp = rowUpper[iRow] - rowActivity[iRow]; double distanceDown = rowLower[iRow] - rowActivity[iRow]; double el = -element[j]; // not change in sign form up if (el > 0.0) { // positive element if (distanceUp > 0.0) { if (thetaDown*el > distanceUp) thetaDown = distanceUp / el; } else { improvementDown -= el; } if (distanceDown > 0.0) { if (thetaDown*el > distanceDown) thetaDown = distanceDown / el; improvementDown += el; } } else { // negative element if (distanceDown < 0.0) { if (thetaDown*el < distanceDown) thetaDown = distanceDown / el; } else { improvementDown += el; } if (distanceUp < 0.0) { if (thetaDown*el < distanceUp) thetaDown = distanceUp / el; improvementDown -= el; } } } if (thetaUp < 1.0e-8) improvementUp = 0.0; if (thetaDown < 1.0e-8) improvementDown = 0.0; double theta; if (improvementUp >= improvementDown) { theta = thetaUp; } else { improvementUp = improvementDown; theta = -thetaDown; } if (improvementUp > 1.0e-8 && fabs(theta) > 1.0e-8) { // Could move double oldSum = 0.0; double newSum = 0.0; solution[iColumn] += theta; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double lower = rowLower[iRow]; double upper = rowUpper[iRow]; double value = rowActivity[iRow]; if (value > upper) oldSum += value - upper; else if (value < lower) oldSum += lower - value; value += theta * element[j]; rowActivity[iRow] = value; if (value > upper) newSum += value - upper; else if (value < lower) newSum += lower - value; } assert (newSum <= oldSum); sumInfeasibility += newSum - oldSum; } } } } // Now flip some integers? #ifdef JJF_ZERO for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double solValue = solution[iColumn]; assert (fabs(solValue - floor(solValue + 0.5)) < 1.0e-8); double improvementUp = 0.0; if (columnUpper[iColumn] >= solValue + 1.0) { // can go up double oldSum = 0.0; double newSum = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double lower = rowLower[iRow]; double upper = rowUpper[iRow]; double value = rowActivity[iRow]; if (value > upper) oldSum += value - upper; else if (value < lower) oldSum += lower - value; value += element[j]; if (value > upper) newSum += value - upper; else if (value < lower) newSum += lower - value; } improvementUp = oldSum - newSum; } double improvementDown = 0.0; if (columnLower[iColumn] <= solValue - 1.0) { // can go down double oldSum = 0.0; double newSum = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double lower = rowLower[iRow]; double upper = rowUpper[iRow]; double value = rowActivity[iRow]; if (value > upper) oldSum += value - upper; else if (value < lower) oldSum += lower - value; value -= element[j]; if (value > upper) newSum += value - upper; else if (value < lower) newSum += lower - value; } improvementDown = oldSum - newSum; } double theta; if (improvementUp >= improvementDown) { theta = 1.0; } else { improvementUp = improvementDown; theta = -1.0; } if (improvementUp > 1.0e-8 && fabs(theta) > 1.0e-8) { // Could move double oldSum = 0.0; double newSum = 0.0; solution[iColumn] += theta; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double lower = rowLower[iRow]; double upper = rowUpper[iRow]; double value = rowActivity[iRow]; if (value > upper) oldSum += value - upper; else if (value < lower) oldSum += lower - value; value += theta * element[j]; rowActivity[iRow] = value; if (value > upper) newSum += value - upper; else if (value < lower) newSum += lower - value; } assert (newSum <= oldSum); sumInfeasibility += newSum - oldSum; } } #else int bestColumn = -1; double bestImprovement = primalTolerance; double theta = 0.0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double solValue = solution[iColumn]; assert (fabs(solValue - floor(solValue + 0.5)) < 1.0e-8); double improvementUp = 0.0; if (columnUpper[iColumn] >= solValue + 1.0) { // can go up double oldSum = 0.0; double newSum = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double lower = rowLower[iRow]; double upper = rowUpper[iRow]; double value = rowActivity[iRow]; if (value > upper) oldSum += value - upper; else if (value < lower) oldSum += lower - value; value += element[j]; if (value > upper) newSum += value - upper; else if (value < lower) newSum += lower - value; } improvementUp = oldSum - newSum; } double improvementDown = 0.0; if (columnLower[iColumn] <= solValue - 1.0) { // can go down double oldSum = 0.0; double newSum = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double lower = rowLower[iRow]; double upper = rowUpper[iRow]; double value = rowActivity[iRow]; if (value > upper) oldSum += value - upper; else if (value < lower) oldSum += lower - value; value -= element[j]; if (value > upper) newSum += value - upper; else if (value < lower) newSum += lower - value; } improvementDown = oldSum - newSum; } double improvement = CoinMax(improvementUp, improvementDown); if (improvement > bestImprovement) { bestImprovement = improvement; bestColumn = iColumn; if (improvementUp > improvementDown) theta = 1.0; else theta = -1.0; } } if (bestColumn >= 0) { // Could move int iColumn = bestColumn; double oldSum = 0.0; double newSum = 0.0; solution[iColumn] += theta; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double lower = rowLower[iRow]; double upper = rowUpper[iRow]; double value = rowActivity[iRow]; if (value > upper) oldSum += value - upper; else if (value < lower) oldSum += lower - value; value += theta * element[j]; rowActivity[iRow] = value; if (value > upper) newSum += value - upper; else if (value < lower) newSum += lower - value; } assert (newSum <= oldSum); sumInfeasibility += newSum - oldSum; } #endif if (oldSum <= sumInfeasibility + primalTolerance) break; // no good } } //delete [] saveSolution; #endif delete [] rowActivity; return (largestInfeasibility > primalTolerance) ? 0 : 1; } // Set maximum Time (default off) - also sets starttime to current void CbcHeuristicFPump::setMaximumTime(double value) { startTime_ = CoinCpuTime(); maximumTime_ = value; } # ifdef COIN_HAS_CLP //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CbcDisasterHandler::CbcDisasterHandler (CbcModel * model) : OsiClpDisasterHandler(), cbcModel_(model) { if (model) { osiModel_ = dynamic_cast (model->solver()); if (osiModel_) setSimplex(osiModel_->getModelPtr()); } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CbcDisasterHandler::CbcDisasterHandler (const CbcDisasterHandler & rhs) : OsiClpDisasterHandler(rhs), cbcModel_(rhs.cbcModel_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CbcDisasterHandler::~CbcDisasterHandler () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcDisasterHandler & CbcDisasterHandler::operator=(const CbcDisasterHandler & rhs) { if (this != &rhs) { OsiClpDisasterHandler::operator=(rhs); cbcModel_ = rhs.cbcModel_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpDisasterHandler * CbcDisasterHandler::clone() const { return new CbcDisasterHandler(*this); } // Type of disaster 0 can fix, 1 abort int CbcDisasterHandler::typeOfDisaster() { if (!cbcModel_->parentModel() && (cbcModel_->specialOptions()&2048) == 0) { return 0; } else { if (cbcModel_->parentModel()) cbcModel_->setMaximumNodes(0); return 1; } } /* set model. */ void CbcDisasterHandler::setCbcModel(CbcModel * model) { cbcModel_ = model; if (model) { osiModel_ = dynamic_cast (model->solver()); if (osiModel_) setSimplex(osiModel_->getModelPtr()); else setSimplex(NULL); } } #endif CoinMP-1.8.3/Cbc/src/CbcObjectUpdateData.hpp0000644000175000017500000000304612131054770017061 0ustar renerene// $Id: CbcObjectUpdateData.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #ifndef CbcObjectUpdateData_H #define CbcObjectUpdateData_H #include "CbcObject.hpp" /* This stores data so an object can be updated */ class CbcObjectUpdateData { public: /// Default Constructor CbcObjectUpdateData (); /// Useful constructor CbcObjectUpdateData (CbcObject * object, int way, double change, int status, int intDecrease_, double branchingValue); /// Copy constructor CbcObjectUpdateData ( const CbcObjectUpdateData &); /// Assignment operator CbcObjectUpdateData & operator=( const CbcObjectUpdateData& rhs); /// Destructor virtual ~CbcObjectUpdateData (); public: /// data /// Object CbcObject * object_; /// Branch as defined by instance of CbcObject int way_; /// Object number int objectNumber_; /// Change in objective double change_; /// Status 0 Optimal, 1 infeasible, 2 unknown int status_; /// Decrease in number unsatisfied int intDecrease_; /// Branching value double branchingValue_; /// Objective value before branching double originalObjective_; /// Current cutoff double cutoff_; }; #endif CoinMP-1.8.3/Cbc/src/CbcGenSolvers.cpp0000644000175000017500000001565112131054770016005 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenSolvers.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ /* This file contains routines related to handling Osi solvers. The technique is to maintain a map of OsiSolverInterface objects as prototypes of the available solvers. */ #include "CbcConfig.h" #include "CoinPragma.hpp" #include "OsiSolverInterface.hpp" /* Include class definitions for the solvers that are available. If CBC_DEFAULT_SOLVER is not defined in CbcConfig.h, set it to the first available solver. NOTE: Processing of keyword parameters is made case-independent by forcing lower case comparison. Maps, on the other hand, are case-sensitive. The solver names given here must contain only lower case letters and must match the keywords used when defining the keywords for the solver parameter. */ #ifdef COIN_HAS_CLP # include "OsiClpSolverInterface.hpp" # ifndef CBC_DEFAULT_SOLVER # define CBC_DEFAULT_SOLVER "clp" # endif #endif #ifdef COIN_HAS_CPX # include "OsiCpxSolverInterface.hpp" # ifndef CBC_DEFAULT_SOLVER # define CBC_DEFAULT_SOLVER "cpx" # endif #endif #ifdef COIN_HAS_DYLP # include "OsiDylpSolverInterface.hpp" # ifndef CBC_DEFAULT_SOLVER # define CBC_DEFAULT_SOLVER "dylp" # endif #endif #ifdef COIN_HAS_GLPK # include "OsiGlpkSolverInterface.hpp" # ifndef CBC_DEFAULT_SOLVER # define CBC_DEFAULT_SOLVER "glpk" # endif #endif #ifdef COIN_HAS_MSK # include "OsiMskSolverInterface.hpp" # ifndef CBC_DEFAULT_SOLVER # define CBC_DEFAULT_SOLVER "msk" # endif #endif #ifdef COIN_HAS_SPX # include "OsiSpxSolverInterface.hpp" # ifndef CBC_DEFAULT_SOLVER # define CBC_DEFAULT_SOLVER "spx" # endif #endif #include "CoinParam.hpp" #include "CbcModel.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" #include "CbcGenCbcParam.hpp" #include "CbcGenOsiParam.hpp" namespace { char svnid[] = "$Id: CbcGenSolvers.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } /* Unnamed local namespace to hide the data structures used to maintain the vector of OsiSolverInterface objects. */ namespace { /* Data types for a vector of OsiSolverInterface objects. */ typedef std::map solverMap_t ; typedef solverMap_t::const_iterator solverMapIter_t ; /* The solver map. */ solverMap_t solvers ; } // end unnamed local namespace namespace CbcGenSolvers { /* Create a vector of solver prototypes and establish a default solver. Creating multiple solvers is moderately expensive; if you're not interested in experimenting with solvers other than clp, you're likely better off just working with the cbc main program (CoinSolve.cpp). The businesss with CBC_DEFAULT_SOLVER will select the first available solver as the default, unless overridden at compile time. */ OsiSolverInterface *setupSolvers () { /* Populate the vector of OsiSolverInterface objects. */ # ifdef COIN_HAS_CLP solvers["clp"] = new OsiClpSolverInterface ; # endif # ifdef COIN_HAS_CPX solvers["cpx"] = new OsiCpxSolverInterface ; # endif # ifdef COIN_HAS_DYLP solvers["dylp"] = new OsiDylpSolverInterface ; # endif # ifdef COIN_HAS_GLPK solvers["glpk"] = new OsiGlpkSolverInterface ; # endif # ifdef COIN_HAS_MSK solvers["msk"] = new OsiMskSolverInterface ; # endif # ifdef COIN_HAS_SPX solvers["spx"] = new OsiSpxSolverInterface ; # endif /* Set the standard default values in each solver. */ for (solverMapIter_t solverIter = solvers.begin() ; solverIter != solvers.end() ; solverIter++) { OsiSolverInterface *osi = solverIter->second ; osi->messageHandler()->setLogLevel(0) ; CbcOsiParamUtils::setOsiSolverInterfaceDefaults(osi) ; } /* If we don't have a default solver, we're deeply confused. */ OsiSolverInterface *dflt_solver = solvers[CBC_DEFAULT_SOLVER] ; if (dflt_solver) { std::cout << "Default solver is " << CBC_DEFAULT_SOLVER << std::endl ; } else { std::cerr << "No solvers!" << std::endl ; } return (dflt_solver) ; } /* Cleanup routine to delete the vector of OsiSolverInterface objects. */ void deleteSolvers () { for (solverMapIter_t solverIter = solvers.begin() ; solverIter != solvers.end() ; solverIter++) { if (solverIter->second) delete solverIter->second ; } } /* The `push' routine for the solver parameter. The basic operation is to clone the requested solver and assign it to the current CbcModel object. */ int changeCbcSolver (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; CoinMessageHandler *msghandler = ctlBlk->messageHandler() ; /* Setup to return nonfatal/fatal error (1/-1) by default. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* Try to locate the solver specified by the user. */ const std::string solverName = genParam->kwdVal() ; OsiSolverInterface *protoOsi = solvers[solverName] ; if (protoOsi == 0) { std::cerr << "Can't find solver \"" << solverName << "\" in the solvers vector." << std::endl ; return (retval) ; } ctlBlk->dfltSolver_ = protoOsi ; /* We have a solver. */ ctlBlk->message(CBCGEN_NEW_SOLVER) << solverName << CoinMessageEol ; CbcModel *model = ctlBlk->model_ ; assert (model != 0) ; OsiSolverInterface *newOsi = protoOsi->clone() ; model->assignSolver(newOsi) ; return (0) ; } /* This routine sets up a solver parameter object. It doesn't initialise the object being acted upon (a CbcGenCtlBlk); that's done back in the calling routine where we're setting up the cbc-generic parameter vector. */ void setupSolverParam (CbcGenParam &solverParam) { /* Basic setup: parameter type, name, parameter code. */ solverParam.setType(CoinParam::coinParamKwd) ; solverParam.setName("solver") ; solverParam.setParamCode(CbcGenParam::SOLVER) ; /* Add the solvers and set the default value. */ for (solverMapIter_t solverIter = solvers.begin() ; solverIter != solvers.end() ; solverIter++) { solverParam.appendKwd(solverIter->first) ; } solverParam.setKwdVal(CBC_DEFAULT_SOLVER) ; solverParam.setDisplay(true) ; solverParam.setPushFunc(changeCbcSolver) ; /* And add the help strings. */ solverParam.setShortHelp("Specify underlying LP solver") ; solverParam.setLongHelp( "Select the underlying LP solver that will be used to solve the continuous relaxations of subproblems." ) ; } } // end namespace CbcGenSolvers CoinMP-1.8.3/Cbc/src/CbcGenSolution.cpp0000644000175000017500000004501112131054770016155 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenSolution.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinSort.hpp" #include "CoinFileIO.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" namespace { char svnid[] = "$Id: CbcGenSolution.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } namespace { /* Helper routine to generate masks for selecting names to print. Returns true if masks are generated without error, false otherwise. This is John Forrest's code, shamelessly stolen from CoinSolve and tweaked just enough to allow it to be yanked out of the main body of CoinSolve. Returns the number of generated masks, -1 on error. */ int generateMasks (std::string proto, int longestName, int *&maskStarts, char **&finalMasks) { int nAst = 0 ; const char *pMask2 = proto.c_str() ; char pMask[100] ; int iChar ; int lengthMask = strlen(pMask2) ; assert (lengthMask < 100) ; int maxMasks = -1 ; maskStarts = 0 ; finalMasks = 0 ; /* Remove surrounding matched quotes if present. Abort if unmatched. */ if (*pMask2 == '"') { if (pMask2[lengthMask-1] != '"') { printf("generateMasks: Mismatched \" in mask %s\n", pMask2) ; return (-1) ; } else { strcpy(pMask, pMask2 + 1) ; *strchr(pMask, '"') = '\0' ; } } else if (*pMask2 == '\'') { if (pMask2[lengthMask-1] != '\'') { printf("mismatched ' in mask %s\n", pMask2) ; return (maxMasks) ; } else { strcpy(pMask, pMask2 + 1) ; *strchr(pMask, '\'') = '\0' ; } } else { strcpy(pMask, pMask2) ; } /* Mask should not be longer than longest name. */ if (lengthMask > longestName) { printf("mask %s too long - skipping\n", pMask) ; return (maxMasks) ; } /* Expand `*' to multiple masks with varying number of `?' characters. */ maxMasks = 1 ; for (iChar = 0; iChar < lengthMask; iChar++) { if (pMask[iChar] == '*') { nAst++ ; maxMasks *= (longestName + 1) ; } } int nEntries = 1 ; maskStarts = new int[longestName+2] ; char ** masks = new char * [maxMasks] ; char ** newMasks = new char * [maxMasks] ; int i ; for (i = 0; i < maxMasks; i++) { masks[i] = new char[longestName+1] ; newMasks[i] = new char[longestName+1] ; } strcpy(masks[0], pMask) ; for (int iAst = 0; iAst < nAst; iAst++) { int nOldEntries = nEntries ; nEntries = 0 ; for (int iEntry = 0; iEntry < nOldEntries; iEntry++) { char * oldMask = masks[iEntry] ; char * ast = strchr(oldMask, '*') ; assert (ast) ; int length = strlen(oldMask) - 1 ; int nBefore = ast - oldMask ; int nAfter = length - nBefore ; // and add null nAfter++ ; for (int i = 0; i <= longestName - length; i++) { char * maskOut = newMasks[nEntries] ; memcpy(maskOut, oldMask, nBefore) ; for (int k = 0; k < i; k++) maskOut[k+nBefore] = '?' ; memcpy(maskOut + nBefore + i, ast + 1, nAfter) ; nEntries++ ; assert (nEntries <= maxMasks) ; } } char ** temp = masks ; masks = newMasks ; newMasks = temp ; } /* Trim trailing blanks and record final length. */ int * sort = new int[nEntries] ; for (i = 0; i < nEntries; i++) { char * maskThis = masks[i] ; int length = strlen(maskThis) ; while (maskThis[length-1] == ' ') length-- ; maskThis[length] = '\0' ; sort[i] = length ; } /* Sort by length. */ CoinSort_2(sort, sort + nEntries, masks) ; int lastLength = -1 ; for (i = 0; i < nEntries; i++) { int length = sort[i] ; while (length > lastLength) maskStarts[++lastLength] = i ; } maskStarts[++lastLength] = nEntries ; delete [] sort ; for (i = 0; i < maxMasks; i++) delete [] newMasks[i] ; delete [] newMasks ; finalMasks = masks ; return (maxMasks) ; } /* Utility routine to check a string against the array of masks. Borrowed from CoinSolve. */ bool maskMatches (const int *starts, char **masks, const char *checkC) { int length = strlen(checkC); while (checkC[length-1] == ' ') length--; for (int i = starts[length]; i < starts[length+1]; i++) { char * thisMask = masks[i]; int k; for ( k = 0; k < length; k++) { if (thisMask[k] != '?' && thisMask[k] != checkC[k]) break; } if (k == length) return true; } return (false) ; } } // end unnamed namespace /* Routine to write out the solution. Minimally adapted from John's code in CoinSolve to break out a few subroutines and use generic OSI functions. The print mode is established by the printingOptions command, and the integer coding is established by the order of declaration of the keyword parameters. As of 060920, known modes are normal (0) print nonzero primal variables integer (1) print nonzero integer primal variables special (2) print in a format suitable for OsiRowCutDebugger rows (3) `normal', plus rows with nonzero row activity all (4) all primal variables and row activities */ int CbcGenParamUtils::doSolutionParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; CbcModel *model = ctlBlk->model_ ; assert (model != 0) ; /* Setup to return nonfatal/fatal error (1/-1) by default. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* It's hard to print a solution we don't have. */ if (ctlBlk->bab_.haveAnswer_ == false) { std::cout << "There is no solution available to print." << std::endl ; return (retval) ; } OsiSolverInterface *osi = ctlBlk->bab_.answerSolver_ ; assert (osi != 0) ; /* Figure out where we're going to write the solution. As special cases, `$' says `use the previous output file' and `-' says `use stdout'. cbc will also accept `no string value' as stdout, but that'd be a real pain in this architecture. */ std::string field = genParam->strVal() ; std::string fileName ; if (field == "$") { fileName = ctlBlk->lastSolnOut_ ; field = fileName ; } if (field == "-") { fileName = "stdout" ; field = fileName ; } else { fileName = field ; } if (!(fileName == "stdout" || fileName == "stderr")) { if (fileName[0] == '~') { char dirSep = CoinFindDirSeparator() ; if (fileName[1] == dirSep) { char *environVar = getenv("HOME") ; if (environVar) { std::string home(environVar) ; fileName = home + fileName.substr(1) ; } } } if (!(fileAbsPath(fileName) || fileName.substr(0, 2) == "./")) { fileName = ctlBlk->dfltDirectory_ + fileName ; } } /* See if we can open the file. Bail out if the open fails. */ FILE *fp ; if (fileName == "stdout") { fp = stdout ; } else if (fileName == "stderr") { fp = stderr ; } else { fp = fopen(fileName.c_str(), "w") ; fp = fopen(fileName.c_str(), "w") ; } if (!fp) { std::cout << "Unable to open file `" << fileName << "', original name '" << genParam->strVal() << "'." << std::endl ; return (retval) ; } else { std::cout << "Writing solution to `" << fileName << "'." << std::endl ; } int m = osi->getNumRows() ; int n = osi->getNumCols() ; int iColumn ; const double *primalColSolution = osi->getColSolution() ; /* Separate printing a solution for humans from printing a solution for the row cut debugger. For the row cut debugger, we want to produce C++ code that can be pasted into the debugger's set of known problems. */ if (ctlBlk->printMode_ == 2) { int k = 0 ; bool newLine = true ; bool comma = false ; fprintf(fp, " int intIndicesV[] = {") ; for (iColumn = 0 ; iColumn < n ; iColumn++ ) { if (fabs(primalColSolution[iColumn]) > 0.5 && osi->isInteger(iColumn)) { if (newLine) { fprintf(fp, "\n\t") ; newLine = false ; } else { fprintf(fp, ", ") ; } fprintf(fp, "%d", iColumn) ; if (++k == 10) { k = 0 ; newLine = true ; } } } fprintf(fp, "\n } ;\n") ; k = 0 ; newLine = true ; fprintf(fp, " double intSolnV[] = {") ; for (iColumn = 0 ; iColumn < n ; iColumn++) { double value = primalColSolution[iColumn] ; if (fabs(value) > 0.5 && osi->isInteger(iColumn)) { if (newLine) { fprintf(fp, "\n\t") ; newLine = false ; } else { fprintf(fp, ", ") ; } if (value > 0) { value = floor(value + .5) ; } else { value = ceil(value - .5) ; } int ivalue = static_cast(value) ; fprintf(fp, "%d.0", ivalue) ; if (++k == 10) { k = 0 ; newLine = true ; } } } fprintf(fp, "\n } ;\n") ; return (0) ; } /* Begin the code to generate output meant for a human. What's our longest name? Scan the names we're going to print. printMode_ of 3 or 4 requires we scan the row names too. Force between 8 and 20 characters in any event. */ int longestName = 0 ; for (int j = 0 ; j < n ; j++) { int len = osi->getColName(j).length() ; longestName = CoinMax(longestName, len) ; } if (ctlBlk->printMode_ >= 3) { for (int i = 0 ; i < m ; i++) { int len = osi->getRowName(i).length() ; longestName = CoinMax(longestName, len) ; } } /* Generate masks if we need to do so. */ bool doMask = ctlBlk->printMask_ != "" ; int *maskStarts = NULL ; int maxMasks = 0 ; char **masks = NULL ; if (doMask) { maxMasks = generateMasks(ctlBlk->printMask_, longestName, maskStarts, masks) ; if (maxMasks < 0) { return (retval) ; } } /* Force the space allocated to names to be between 8 and 20 characters. */ if (longestName < 8) { longestName = 8 ; } else if (longestName > 20) { longestName = 20 ; } /* Print requested components of the row solution. Only modes 3 (rows) and 4 (all) will print row information. For the rows that we print, print both the row activity and the value of the associated dual. Which to print? Violated constraints will always be flagged to print. Otherwise, if m < 50 or all rows are requested, print all rows. Otherwise, print tight constraints (non-zero dual). All of this is filtered through printMask, if specified. */ double primalTolerance ; osi->getDblParam(OsiPrimalTolerance, primalTolerance) ; int iRow ; if (ctlBlk->printMode_ >= 3) { const double *dualRowSolution = osi->getRowPrice() ; const double *primalRowSolution = osi->getRowActivity() ; const double *rowLower = osi->getRowLower() ; const double *rowUpper = osi->getRowUpper() ; fprintf(fp, "\n %7s %-*s%15s%15s\n\n", "Index", longestName, "Row", "Activity", "Dual") ; for (iRow = 0 ; iRow < m ; iRow++) { bool violated = false ; bool print = false ; if (primalRowSolution[iRow] > rowUpper[iRow] + primalTolerance || primalRowSolution[iRow] < rowLower[iRow] - primalTolerance) { violated = true ; print = true ; } else { if (m < 50 || ctlBlk->printMode_ >= 4) { print = true ; } else if (fabs(dualRowSolution[iRow]) > 1.0e-8) { print = true ; } } const char *name = osi->getRowName(iRow).c_str() ; if (doMask && !maskMatches(maskStarts, masks, name)) { print = false ; } if (print) { if (violated) { fprintf(fp, "** ") ; } else { fprintf(fp, "%3s", " ") ; } fprintf(fp, "%7d %-*s%15.8g%15.8g\n", iRow, longestName, name, primalRowSolution[iRow], dualRowSolution[iRow]) ; } } fprintf(fp, "\n") ; } /* Now do the columns. This first block handles all modes except 2 (special). Out-of-bounds variables are flagged with `**'. If there are less than 50 variables, all are printed. All of this is filtered through `integer only' and can be further filtered using printMask. */ if (ctlBlk->printMode_ != 2) { const double *columnLower = osi->getColLower() ; const double *columnUpper = osi->getColUpper() ; const double *dualColSolution = osi->getReducedCost() ; fprintf(fp, "\n %7s %-*s%15s%15s\n\n", "Index", longestName, "Column", "Value", "Reduced Cost") ; for (iColumn = 0 ; iColumn < n ; iColumn++) { bool violated = false ; bool print = false ; if (primalColSolution[iColumn] > columnUpper[iColumn] + primalTolerance || primalColSolution[iColumn] < columnLower[iColumn] - primalTolerance) { violated = true ; print = true ; } else { if (n < 50 || ctlBlk->printMode_ == 4) { print = true ; } else if (fabs(primalColSolution[iColumn]) > 1.0e-8) { if (ctlBlk->printMode_ == 1) { print = osi->isInteger(iColumn) ; } else { print = true ; } } } const char *name = osi->getColName(iColumn).c_str() ; if (doMask && !maskMatches(maskStarts, masks, name)) { print = false ; } if (print) { if (violated) { fprintf(fp, "** ") ; } else { fprintf(fp, "%3s", " ") ; } fprintf(fp, "%7d %-*s%15.8g%15.8g\n", iColumn, longestName, name, primalColSolution[iColumn], dualColSolution[iColumn]) ; } } } /* Close out the file, but don't close stdout. Delete any masks. */ if (fp != stdout) { fclose(fp) ; } if (masks) { delete [] maskStarts ; for (int i = 0 ; i < maxMasks ; i++) delete [] masks[i] ; delete [] masks ; } return (0) ; } /* Routine to do initial verification of a print mask. We don't generate the full set of print masks here, but we do some verification checks to make sure it's valid. */ int CbcGenParamUtils::doPrintMaskParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; /* Setup to return nonfatal/fatal error (1/-1) by default. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } /* Now do a bit of verification of the mask. It should be non-null and, if quoted, the quotes should be matched. Aribtrarily put the absolute maximum length at 50 characters. If we have a model loaded, that'll be tightened to the length of the longest name. */ std::string maskProto = param->strVal() ; int maskLen = maskProto.length() ; if (maskLen <= 0 || maskLen > 50) { std::cerr << "Mask |" << maskProto << "| is " << maskLen << " characters; should be between " << 0 << " and " << 50 << "." << std::endl ; return (retval) ; } /* Remove surrounding matched quotes if present. Abort if unmatched. */ if (maskProto[0] == '"' || maskProto[0] == '\'') { char quoteChar = maskProto[0] ; if (maskProto[maskLen-1] != quoteChar) { std::cerr << "Mismatched quotes around mask |" << maskProto << "|." << std::endl ; return (retval) ; } else { maskProto = maskProto.substr(1, maskLen - 2) ; } } /* Mask should not be longer than longest name. Of course, if we don't have a model, we can't do this check. */ if (ctlBlk->goodModel_) { CbcModel *model = ctlBlk->model_ ; assert (model != 0) ; OsiSolverInterface *osi = model->solver() ; assert (osi != 0) ; int longestName = 0 ; int n = osi->getNumCols() ; for (int j = 0 ; j < n ; j++) { int len = osi->getColName(j).length() ; longestName = CoinMax(longestName, len) ; } int m = osi->getNumRows() ; for (int i = 0 ; i < m ; i++) { int len = osi->getRowName(i).length() ; longestName = CoinMax(longestName, len) ; } if (maskLen > longestName) { std::cerr << "Mask |" << maskProto << "| has " << maskLen << " chars; this" << " is longer than the longest name (" << longestName << " chars)." << std::endl ; return (retval) ; } } ctlBlk->printMask_ = maskProto ; return (0) ; } CoinMP-1.8.3/Cbc/src/CbcHeuristic.cpp0000644000175000017500000035764612500627015015670 0ustar renerene/* $Id: CbcHeuristic.cpp 2162 2015-03-13 18:35:57Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include #include #include #include //#define PRINT_DEBUG #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristic.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcHeuristicRINS.hpp" #include "CbcEventHandler.hpp" #include "CbcStrategy.hpp" #include "CglPreProcess.hpp" #include "CglGomory.hpp" #include "CglProbing.hpp" #include "OsiAuxInfo.hpp" #include "OsiRowCutDebugger.hpp" #include "OsiPresolve.hpp" #include "CbcBranchActual.hpp" #include "CbcCutGenerator.hpp" //============================================================================== CbcHeuristicNode::CbcHeuristicNode(const CbcHeuristicNode& rhs) { numObjects_ = rhs.numObjects_; brObj_ = new CbcBranchingObject*[numObjects_]; for (int i = 0; i < numObjects_; ++i) { brObj_[i] = rhs.brObj_[i]->clone(); } } void CbcHeuristicNodeList::gutsOfDelete() { for (int i = (static_cast(nodes_.size())) - 1; i >= 0; --i) { delete nodes_[i]; } } void CbcHeuristicNodeList::gutsOfCopy(const CbcHeuristicNodeList& rhs) { append(rhs); } CbcHeuristicNodeList::CbcHeuristicNodeList(const CbcHeuristicNodeList& rhs) { gutsOfCopy(rhs); } CbcHeuristicNodeList& CbcHeuristicNodeList::operator= (const CbcHeuristicNodeList & rhs) { if (this != &rhs) { gutsOfDelete(); gutsOfCopy(rhs); } return *this; } CbcHeuristicNodeList::~CbcHeuristicNodeList() { gutsOfDelete(); } void CbcHeuristicNodeList::append(CbcHeuristicNode*& node) { nodes_.push_back(node); node = NULL; } void CbcHeuristicNodeList::append(const CbcHeuristicNodeList& nodes) { nodes_.reserve(nodes_.size() + nodes.size()); for (int i = 0; i < nodes.size(); ++i) { CbcHeuristicNode* node = new CbcHeuristicNode(*nodes.node(i)); append(node); } } //============================================================================== #define DEFAULT_WHERE ((255-2-16)*(1+256)) // Default Constructor CbcHeuristic::CbcHeuristic() : model_(NULL), when_(2), numberNodes_(200), feasibilityPumpOptions_(-1), fractionSmall_(1.0), heuristicName_("Unknown"), howOften_(1), decayFactor_(0.0), switches_(0), whereFrom_(DEFAULT_WHERE), shallowDepth_(1), howOftenShallow_(1), numInvocationsInShallow_(0), numInvocationsInDeep_(0), lastRunDeep_(0), numRuns_(0), minDistanceToRun_(1), runNodes_(), numCouldRun_(0), numberSolutionsFound_(0), numberNodesDone_(0), inputSolution_(NULL) { // As CbcHeuristic virtual need to modify .cpp if above change } // Constructor from model CbcHeuristic::CbcHeuristic(CbcModel & model) : model_(&model), when_(2), numberNodes_(200), feasibilityPumpOptions_(-1), fractionSmall_(1.0), heuristicName_("Unknown"), howOften_(1), decayFactor_(0.0), switches_(0), whereFrom_(DEFAULT_WHERE), shallowDepth_(1), howOftenShallow_(1), numInvocationsInShallow_(0), numInvocationsInDeep_(0), lastRunDeep_(0), numRuns_(0), minDistanceToRun_(1), runNodes_(), numCouldRun_(0), numberSolutionsFound_(0), numberNodesDone_(0), inputSolution_(NULL) { } void CbcHeuristic::gutsOfCopy(const CbcHeuristic & rhs) { model_ = rhs.model_; when_ = rhs.when_; numberNodes_ = rhs.numberNodes_; feasibilityPumpOptions_ = rhs.feasibilityPumpOptions_; fractionSmall_ = rhs.fractionSmall_; randomNumberGenerator_ = rhs.randomNumberGenerator_; heuristicName_ = rhs.heuristicName_; howOften_ = rhs.howOften_; decayFactor_ = rhs.decayFactor_; switches_ = rhs.switches_; whereFrom_ = rhs.whereFrom_; shallowDepth_ = rhs.shallowDepth_; howOftenShallow_ = rhs.howOftenShallow_; numInvocationsInShallow_ = rhs.numInvocationsInShallow_; numInvocationsInDeep_ = rhs.numInvocationsInDeep_; lastRunDeep_ = rhs.lastRunDeep_; numRuns_ = rhs.numRuns_; numCouldRun_ = rhs.numCouldRun_; minDistanceToRun_ = rhs.minDistanceToRun_; runNodes_ = rhs.runNodes_; numberSolutionsFound_ = rhs.numberSolutionsFound_; numberNodesDone_ = rhs.numberNodesDone_; if (rhs.inputSolution_) { int numberColumns = model_->getNumCols(); setInputSolution(rhs.inputSolution_, rhs.inputSolution_[numberColumns]); } } // Copy constructor CbcHeuristic::CbcHeuristic(const CbcHeuristic & rhs) { inputSolution_ = NULL; gutsOfCopy(rhs); } // Assignment operator CbcHeuristic & CbcHeuristic::operator=( const CbcHeuristic & rhs) { if (this != &rhs) { gutsOfDelete(); gutsOfCopy(rhs); } return *this; } void CbcHeurDebugNodes(CbcModel* model_) { CbcNode* node = model_->currentNode(); CbcNodeInfo* nodeInfo = node->nodeInfo(); std::cout << "===============================================================\n"; while (nodeInfo) { const CbcNode* node = nodeInfo->owner(); printf("nodeinfo: node %i\n", nodeInfo->nodeNumber()); { const CbcIntegerBranchingObject* brPrint = dynamic_cast(nodeInfo->parentBranch()); if (!brPrint) { printf(" parentBranch: NULL\n"); } else { const double* downBounds = brPrint->downBounds(); const double* upBounds = brPrint->upBounds(); int variable = brPrint->variable(); int way = brPrint->way(); printf(" parentBranch: var %i downBd [%i,%i] upBd [%i,%i] way %i\n", variable, static_cast(downBounds[0]), static_cast(downBounds[1]), static_cast(upBounds[0]), static_cast(upBounds[1]), way); } } if (! node) { printf(" owner: NULL\n"); } else { printf(" owner: node %i depth %i onTree %i active %i", node->nodeNumber(), node->depth(), node->onTree(), node->active()); const OsiBranchingObject* osibr = nodeInfo->owner()->branchingObject(); const CbcBranchingObject* cbcbr = dynamic_cast(osibr); const CbcIntegerBranchingObject* brPrint = dynamic_cast(cbcbr); if (!brPrint) { printf(" ownerBranch: NULL\n"); } else { const double* downBounds = brPrint->downBounds(); const double* upBounds = brPrint->upBounds(); int variable = brPrint->variable(); int way = brPrint->way(); printf(" ownerbranch: var %i downBd [%i,%i] upBd [%i,%i] way %i\n", variable, static_cast(downBounds[0]), static_cast(downBounds[1]), static_cast(upBounds[0]), static_cast(upBounds[1]), way); } } nodeInfo = nodeInfo->parent(); } } void CbcHeuristic::debugNodes() { CbcHeurDebugNodes(model_); } void CbcHeuristic::printDistanceToNodes() { const CbcNode* currentNode = model_->currentNode(); if (currentNode != NULL) { CbcHeuristicNode* nodeDesc = new CbcHeuristicNode(*model_); for (int i = runNodes_.size() - 1; i >= 0; --i) { nodeDesc->distance(runNodes_.node(i)); } runNodes_.append(nodeDesc); } } bool CbcHeuristic::shouldHeurRun(int whereFrom) { assert (whereFrom >= 0 && whereFrom < 16); // take off 8 (code - likes new solution) whereFrom &= 7; if ((whereFrom_&(1 << whereFrom)) == 0) return false; // No longer used for original purpose - so use for ever run at all JJF #ifndef JJF_ONE // Don't run if hot start or no rows! if (model_ && (model_->hotstartSolution()||!model_->getNumRows())) return false; else return true; #else #ifdef JJF_ZERO const CbcNode* currentNode = model_->currentNode(); if (currentNode == NULL) { return false; } debugNodes(); // return false; const int depth = currentNode->depth(); #else int depth = model_->currentDepth(); #endif const int nodeCount = model_->getNodeCount(); // FIXME: check that this is // correct in parallel if (nodeCount == 0 || depth <= shallowDepth_) { // what to do when we are in the shallow part of the tree if (model_->getCurrentPassNumber() == 1) { // first time in the node... numInvocationsInShallow_ = 0; } ++numInvocationsInShallow_; // Very large howOftenShallow_ will give the original test: // (model_->getCurrentPassNumber() != 1) // if ((numInvocationsInShallow_ % howOftenShallow_) != 1) { if ((numInvocationsInShallow_ % howOftenShallow_) != 0) { return false; } // LL: should we save these nodes in the list of nodes where the heur was // LL: run? #ifndef JJF_ONE if (currentNode != NULL) { // Get where we are and create the appropriate CbcHeuristicNode object CbcHeuristicNode* nodeDesc = new CbcHeuristicNode(*model_); runNodes_.append(nodeDesc); } #endif } else { // deeper in the tree if (model_->getCurrentPassNumber() == 1) { // first time in the node... ++numInvocationsInDeep_; } if (numInvocationsInDeep_ - lastRunDeep_ < howOften_) { return false; } if (model_->getCurrentPassNumber() > 1) { // Run the heuristic only when first entering the node. // LL: I don't think this is right. It should run just before strong // LL: branching, I believe. return false; } // Get where we are and create the appropriate CbcHeuristicNode object CbcHeuristicNode* nodeDesc = new CbcHeuristicNode(*model_); //#ifdef PRINT_DEBUG #ifndef JJF_ONE const double minDistanceToRun = 1.5 * log((double)depth) / log((double)2); #else const double minDistanceToRun = minDistanceToRun_; #endif #ifdef PRINT_DEBUG double minDistance = nodeDesc->minDistance(runNodes_); std::cout << "minDistance = " << minDistance << ", minDistanceToRun = " << minDistanceToRun << std::endl; #endif if (nodeDesc->minDistanceIsSmall(runNodes_, minDistanceToRun)) { delete nodeDesc; return false; } runNodes_.append(nodeDesc); lastRunDeep_ = numInvocationsInDeep_; // ++lastRunDeep_; } ++numRuns_; return true; #endif } bool CbcHeuristic::shouldHeurRun_randomChoice() { if (!when_) return false; int depth = model_->currentDepth(); // when_ -999 is special marker to force to run if (depth != 0 && when_ != -999) { const double numerator = depth * depth; const double denominator = exp(depth * log(2.0)); double probability = numerator / denominator; double randomNumber = randomNumberGenerator_.randomDouble(); int when = when_ % 100; if (when > 2 && when < 8) { /* JJF adjustments 3 only at root and if no solution 4 only at root and if this heuristic has not got solution 5 decay (but only if no solution) 6 if depth <3 or decay 7 run up to 2 times if solution found 4 otherwise */ switch (when) { case 3: default: if (model_->bestSolution()) probability = -1.0; break; case 4: if (numberSolutionsFound_) probability = -1.0; break; case 5: assert (decayFactor_); if (model_->bestSolution()) { probability = -1.0; } else if (numCouldRun_ > 1000) { decayFactor_ *= 0.99; probability *= decayFactor_; } break; case 6: if (depth >= 3) { if ((numCouldRun_ % howOften_) == 0 && numberSolutionsFound_*howOften_ < numCouldRun_) { //#define COIN_DEVELOP #ifdef COIN_DEVELOP int old = howOften_; #endif howOften_ = CoinMin(CoinMax(static_cast (howOften_ * 1.1), howOften_ + 1), 1000000); #ifdef COIN_DEVELOP printf("Howoften changed from %d to %d for %s\n", old, howOften_, heuristicName_.c_str()); #endif } probability = 1.0 / howOften_; if (model_->bestSolution()) probability *= 0.5; } else { probability = 1.1; } break; case 7: if ((model_->bestSolution() && numRuns_ >= 2) || numRuns_ >= 4) probability = -1.0; break; } } if (randomNumber > probability) return false; if (model_->getCurrentPassNumber() > 1) return false; #ifdef COIN_DEVELOP printf("Running %s, random %g probability %g\n", heuristicName_.c_str(), randomNumber, probability); #endif } else { #ifdef COIN_DEVELOP printf("Running %s, depth %d when %d\n", heuristicName_.c_str(), depth, when_); #endif } ++numRuns_; return true; } // Resets stuff if model changes void CbcHeuristic::resetModel(CbcModel * model) { model_ = model; } // Set seed void CbcHeuristic::setSeed(int value) { if (value==0) { double time = fabs(CoinGetTimeOfDay()); while (time>=COIN_INT_MAX) time *= 0.5; value = static_cast(time); char printArray[100]; sprintf(printArray, "using time of day seed was changed from %d to %d", randomNumberGenerator_.getSeed(), value); if (model_) model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << printArray << CoinMessageEol; } randomNumberGenerator_.setSeed(value); } // Get seed int CbcHeuristic::getSeed() const { return randomNumberGenerator_.getSeed(); } // Create C++ lines to get to current state void CbcHeuristic::generateCpp( FILE * fp, const char * heuristic) { // hard coded as CbcHeuristic virtual if (when_ != 2) fprintf(fp, "3 %s.setWhen(%d);\n", heuristic, when_); else fprintf(fp, "4 %s.setWhen(%d);\n", heuristic, when_); if (numberNodes_ != 200) fprintf(fp, "3 %s.setNumberNodes(%d);\n", heuristic, numberNodes_); else fprintf(fp, "4 %s.setNumberNodes(%d);\n", heuristic, numberNodes_); if (feasibilityPumpOptions_ != -1) fprintf(fp, "3 %s.setFeasibilityPumpOptions(%d);\n", heuristic, feasibilityPumpOptions_); else fprintf(fp, "4 %s.setFeasibilityPumpOptions(%d);\n", heuristic, feasibilityPumpOptions_); if (fractionSmall_ != 1.0) fprintf(fp, "3 %s.setFractionSmall(%g);\n", heuristic, fractionSmall_); else fprintf(fp, "4 %s.setFractionSmall(%g);\n", heuristic, fractionSmall_); if (heuristicName_ != "Unknown") fprintf(fp, "3 %s.setHeuristicName(\"%s\");\n", heuristic, heuristicName_.c_str()) ; else fprintf(fp, "4 %s.setHeuristicName(\"%s\");\n", heuristic, heuristicName_.c_str()) ; if (decayFactor_ != 0.0) fprintf(fp, "3 %s.setDecayFactor(%g);\n", heuristic, decayFactor_); else fprintf(fp, "4 %s.setDecayFactor(%g);\n", heuristic, decayFactor_); if (switches_ != 0) fprintf(fp, "3 %s.setSwitches(%d);\n", heuristic, switches_); else fprintf(fp, "4 %s.setSwitches(%d);\n", heuristic, switches_); if (whereFrom_ != DEFAULT_WHERE) fprintf(fp, "3 %s.setWhereFrom(%d);\n", heuristic, whereFrom_); else fprintf(fp, "4 %s.setWhereFrom(%d);\n", heuristic, whereFrom_); if (shallowDepth_ != 1) fprintf(fp, "3 %s.setShallowDepth(%d);\n", heuristic, shallowDepth_); else fprintf(fp, "4 %s.setShallowDepth(%d);\n", heuristic, shallowDepth_); if (howOftenShallow_ != 1) fprintf(fp, "3 %s.setHowOftenShallow(%d);\n", heuristic, howOftenShallow_); else fprintf(fp, "4 %s.setHowOftenShallow(%d);\n", heuristic, howOftenShallow_); if (minDistanceToRun_ != 1) fprintf(fp, "3 %s.setMinDistanceToRun(%d);\n", heuristic, minDistanceToRun_); else fprintf(fp, "4 %s.setMinDistanceToRun(%d);\n", heuristic, minDistanceToRun_); } // Destructor CbcHeuristic::~CbcHeuristic () { delete [] inputSolution_; } // update model void CbcHeuristic::setModel(CbcModel * model) { model_ = model; } /* Clone but .. type 0 clone solver, 1 clone continuous solver Add 2 to say without integer variables which are at low priority Add 4 to say quite likely infeasible so give up easily.*/ OsiSolverInterface * CbcHeuristic::cloneBut(int type) { OsiSolverInterface * solver; if ((type&1) == 0 || !model_->continuousSolver()) solver = model_->solver()->clone(); else solver = model_->continuousSolver()->clone(); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver); #endif if ((type&2) != 0) { int n = model_->numberObjects(); int priority = model_->continuousPriority(); if (priority < COIN_INT_MAX) { for (int i = 0; i < n; i++) { const OsiObject * obj = model_->object(i); const CbcSimpleInteger * thisOne = dynamic_cast (obj); if (thisOne) { int iColumn = thisOne->columnNumber(); if (thisOne->priority() >= priority) solver->setContinuous(iColumn); } } } #ifdef COIN_HAS_CLP if (clpSolver) { for (int i = 0; i < n; i++) { const OsiObject * obj = model_->object(i); const CbcSimpleInteger * thisOne = dynamic_cast (obj); if (thisOne) { int iColumn = thisOne->columnNumber(); if (clpSolver->isOptionalInteger(iColumn)) clpSolver->setContinuous(iColumn); } } } #endif } #ifdef COIN_HAS_CLP if ((type&4) != 0 && clpSolver) { int options = clpSolver->getModelPtr()->moreSpecialOptions(); clpSolver->getModelPtr()->setMoreSpecialOptions(options | 64); } #endif return solver; } // Whether to exit at once on gap bool CbcHeuristic::exitNow(double bestObjective) const { if ((switches_&2048) != 0) { // exit may be forced - but unset for next time switches_ &= ~2048; if ((switches_&1024) != 0) return true; } else if ((switches_&1) == 0) { return false; } // See if can stop on gap OsiSolverInterface * solver = model_->solver(); double bestPossibleObjective = solver->getObjValue() * solver->getObjSense(); double absGap = CoinMax(model_->getAllowableGap(), model_->getHeuristicGap()); double fracGap = CoinMax(model_->getAllowableFractionGap(), model_->getHeuristicFractionGap()); double testGap = CoinMax(absGap, fracGap * CoinMax(fabs(bestObjective), fabs(bestPossibleObjective))); if (bestObjective - bestPossibleObjective < testGap && model_->getCutoffIncrement() >= 0.0) { return true; } else { return false; } } #ifdef HISTORY_STATISTICS extern bool getHistoryStatistics_; #endif static double sizeRatio(int numberRowsNow, int numberColumnsNow, int numberRowsStart, int numberColumnsStart) { double valueNow; if (numberRowsNow*10 > numberColumnsNow || numberColumnsNow < 200) { valueNow = 2 * numberRowsNow + numberColumnsNow; } else { // long and thin - rows are more important if (numberRowsNow*40 > numberColumnsNow) valueNow = 10 * numberRowsNow + numberColumnsNow; else valueNow = 200 * numberRowsNow + numberColumnsNow; } double valueStart; if (numberRowsStart*10 > numberColumnsStart || numberColumnsStart < 200) { valueStart = 2 * numberRowsStart + numberColumnsStart; } else { // long and thin - rows are more important if (numberRowsStart*40 > numberColumnsStart) valueStart = 10 * numberRowsStart + numberColumnsStart; else valueStart = 200 * numberRowsStart + numberColumnsStart; } //printf("sizeProblem Now %g, %d rows, %d columns\nsizeProblem Start %g, %d rows, %d columns\n", // valueNow,numberRowsNow,numberColumnsNow, // valueStart,numberRowsStart,numberColumnsStart); if (10*numberRowsNow < 8*numberRowsStart || 10*numberColumnsNow < 7*numberColumnsStart) return valueNow / valueStart; else if (10*numberRowsNow < 9*numberRowsStart) return 1.1*(valueNow / valueStart); else if (numberRowsNow < numberRowsStart) return 1.5*(valueNow / valueStart); else return 2.0*(valueNow / valueStart); } //static int saveModel=0; // Do mini branch and bound (return 1 if solution) int CbcHeuristic::smallBranchAndBound(OsiSolverInterface * solver, int numberNodes, double * newSolution, double & newSolutionValue, double cutoff, std::string name) const { CbcEventHandler *eventHandler = model_->getEventHandler() ; // Use this fraction double fractionSmall = fractionSmall_; int maximumSolutions = model_->getMaximumSolutions(); int iterationMultiplier = 100; if (eventHandler) { typedef struct { double fractionSmall; double spareDouble[3]; OsiSolverInterface * solver; void * sparePointer[2]; int numberNodes; int maximumSolutions; int iterationMultiplier; int howOften; int spareInt[3]; } SmallMod; SmallMod temp; temp.solver=solver; temp.fractionSmall=fractionSmall; temp.numberNodes=numberNodes; temp.iterationMultiplier=iterationMultiplier; temp.howOften=howOften_; temp.maximumSolutions=maximumSolutions; CbcEventHandler::CbcAction status = eventHandler->event(CbcEventHandler::smallBranchAndBound, &temp); if (status==CbcEventHandler::killSolution) return -1; if (status==CbcEventHandler::takeAction) { fractionSmall=temp.fractionSmall; numberNodes=temp.numberNodes; iterationMultiplier=temp.iterationMultiplier; howOften_=temp.howOften; maximumSolutions=temp.maximumSolutions; } } #if 0 if (saveModel || model_->getMaximumSolutions()==100) { printf("writing model\n"); solver->writeMpsNative("before.mps", NULL, NULL, 2, 1); } #endif // size before int shiftRows = 0; if (numberNodes < 0) shiftRows = solver->getNumRows() - numberNodes_; int numberRowsStart = solver->getNumRows() - shiftRows; int numberColumnsStart = solver->getNumCols(); #ifdef CLP_INVESTIGATE printf("%s has %d rows, %d columns\n", name.c_str(), solver->getNumRows(), solver->getNumCols()); #endif double before = 2 * numberRowsStart + numberColumnsStart; if (before > 40000.0) { // fairly large - be more conservative double multiplier = 1.0 - 0.3 * CoinMin(100000.0, before - 40000.0) / 100000.0; if (multiplier < 1.0) { fractionSmall *= multiplier; #ifdef CLP_INVESTIGATE printf("changing fractionSmall from %g to %g for %s\n", fractionSmall_, fractionSmall, name.c_str()); #endif } } #ifdef COIN_HAS_CLP OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver); if (osiclp && (osiclp->specialOptions()&65536) == 0) { // go faster stripes if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) { osiclp->setupForRepeatedUse(2, 0); } else { osiclp->setupForRepeatedUse(0, 0); } // Turn this off if you get problems // Used to be automatically set osiclp->setSpecialOptions(osiclp->specialOptions() | (128 + 64 - 128)); ClpSimplex * lpSolver = osiclp->getModelPtr(); lpSolver->setSpecialOptions(lpSolver->specialOptions() | 0x01000000); // say is Cbc (and in branch and bound) lpSolver->setSpecialOptions(lpSolver->specialOptions() | (/*16384+*/4096 + 512 + 128)); } #endif #ifdef HISTORY_STATISTICS getHistoryStatistics_ = false; #endif #ifdef COIN_DEVELOP int status = 0; #endif int logLevel = model_->logLevel(); #define LEN_PRINT 250 char generalPrint[LEN_PRINT]; // Do presolve to see if possible int numberColumns = solver->getNumCols(); char * reset = NULL; int returnCode = 1; int saveModelOptions = model_->specialOptions(); //assert ((saveModelOptions&2048) == 0); model_->setSpecialOptions(saveModelOptions | 2048); if (fractionSmall<1.0) { int saveLogLevel = solver->messageHandler()->logLevel(); if (saveLogLevel == 1) solver->messageHandler()->setLogLevel(0); OsiPresolve * pinfo = new OsiPresolve(); int presolveActions = 0; // Allow dual stuff on integers presolveActions = 1; // Do not allow all +1 to be tampered with //if (allPlusOnes) //presolveActions |= 2; // allow transfer of costs // presolveActions |= 4; pinfo->setPresolveActions(presolveActions); OsiSolverInterface * presolvedModel = pinfo->presolvedModel(*solver, 1.0e-8, true, 2); delete pinfo; // see if too big if (presolvedModel) { int afterRows = presolvedModel->getNumRows(); int afterCols = presolvedModel->getNumCols(); //#define COIN_DEVELOP #ifdef COIN_DEVELOP_z if (numberNodes < 0) { solver->writeMpsNative("before.mps", NULL, NULL, 2, 1); presolvedModel->writeMpsNative("after1.mps", NULL, NULL, 2, 1); } #endif delete presolvedModel; double ratio = sizeRatio(afterRows - shiftRows, afterCols, numberRowsStart, numberColumnsStart); double after = 2 * afterRows + afterCols; if (ratio > fractionSmall && after > 300 && numberNodes >= 0) { // Need code to try again to compress further using used const int * used = model_->usedInSolution(); int maxUsed = 0; int iColumn; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn]) { if (solver->isBinary(iColumn)) maxUsed = CoinMax(maxUsed, used[iColumn]); } } if (maxUsed) { reset = new char [numberColumns]; int nFix = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { reset[iColumn] = 0; if (upper[iColumn] > lower[iColumn]) { if (solver->isBinary(iColumn) && used[iColumn] == maxUsed) { bool setValue = true; if (maxUsed == 1) { double randomNumber = randomNumberGenerator_.randomDouble(); if (randomNumber > 0.3) setValue = false; } if (setValue) { reset[iColumn] = 1; solver->setColLower(iColumn, 1.0); nFix++; } } } } pinfo = new OsiPresolve(); presolveActions = 0; // Allow dual stuff on integers presolveActions = 1; // Do not allow all +1 to be tampered with //if (allPlusOnes) //presolveActions |= 2; // allow transfer of costs // presolveActions |= 4; pinfo->setPresolveActions(presolveActions); presolvedModel = pinfo->presolvedModel(*solver, 1.0e-8, true, 2); delete pinfo; if (presolvedModel) { // see if too big int afterRows2 = presolvedModel->getNumRows(); int afterCols2 = presolvedModel->getNumCols(); delete presolvedModel; double ratio = sizeRatio(afterRows2 - shiftRows, afterCols2, numberRowsStart, numberColumnsStart); double after = 2 * afterRows2 + afterCols2; if (ratio > fractionSmall && (after > 300 || numberNodes < 0)) { sprintf(generalPrint, "Full problem %d rows %d columns, reduced to %d rows %d columns - %d fixed gives %d, %d - still too large", solver->getNumRows(), solver->getNumCols(), afterRows, afterCols, nFix, afterRows2, afterCols2); // If much too big - give up if (ratio > 0.75) returnCode = -1; } else { sprintf(generalPrint, "Full problem %d rows %d columns, reduced to %d rows %d columns - %d fixed gives %d, %d - ok now", solver->getNumRows(), solver->getNumCols(), afterRows, afterCols, nFix, afterRows2, afterCols2); } model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << generalPrint << CoinMessageEol; } else { returnCode = 2; // infeasible } } } else if (ratio > fractionSmall && after > 300 && numberNodes >=0) { returnCode = -1; } } else { returnCode = 2; // infeasible } solver->messageHandler()->setLogLevel(saveLogLevel); } if (returnCode == 2 || returnCode == -1) { model_->setSpecialOptions(saveModelOptions); delete [] reset; #ifdef HISTORY_STATISTICS getHistoryStatistics_ = true; #endif //printf("small no good\n"); return returnCode; } // Reduce printout bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoReducePrint, takeHint, strength); solver->setHintParam(OsiDoReducePrint, true, OsiHintTry); solver->setHintParam(OsiDoPresolveInInitial, false, OsiHintTry); double signedCutoff = cutoff*solver->getObjSense(); solver->setDblParam(OsiDualObjectiveLimit, signedCutoff); solver->initialSolve(); if (solver->isProvenOptimal()) { CglPreProcess process; OsiSolverInterface * solver2 = NULL; if ((model_->moreSpecialOptions()&65536)!=0) process.setOptions(2+4+8+16); // no cuts else process.setOptions(16); // no complicated dupcol stuff /* Do not try and produce equality cliques and do up to 2 passes (normally) 5 if restart */ int numberPasses = 2; if ((model_->moreSpecialOptions2()&16)!=0) { // quick process.setOptions(2+4+8+16); // no cuts numberPasses = 1; } if (numberNodes < 0) { numberPasses = 5; // Say some rows cuts int numberRows = solver->getNumRows(); if (numberNodes_ < numberRows && true /* think */) { char * type = new char[numberRows]; memset(type, 0, numberNodes_); memset(type + numberNodes_, 1, numberRows - numberNodes_); process.passInRowTypes(type, numberRows); delete [] type; } } if (logLevel <= 1) process.messageHandler()->setLogLevel(0); if (!solver->defaultHandler()&& solver->messageHandler()->logLevel(0)!=-1000) process.passInMessageHandler(solver->messageHandler()); #ifdef CGL_DEBUG /* We're debugging. (specialOptions 1) */ if ((model_->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = solver->getRowCutDebugger() ; if (debugger) { process.setApplicationData(const_cast(debugger->optimalSolution())); } } #endif solver2 = process.preProcessNonDefault(*solver, false, numberPasses); if (!solver2) { if (logLevel > 1) printf("Pre-processing says infeasible\n"); returnCode = 2; // so will be infeasible } else { #ifdef COIN_DEVELOP_z if (numberNodes < 0) { solver2->writeMpsNative("after2.mps", NULL, NULL, 2, 1); } #endif // see if too big double ratio = sizeRatio(solver2->getNumRows() - shiftRows, solver2->getNumCols(), numberRowsStart, numberColumnsStart); double after = 2 * solver2->getNumRows() + solver2->getNumCols(); if (ratio > fractionSmall && (after > 300 || numberNodes < 0)) { sprintf(generalPrint, "Full problem %d rows %d columns, reduced to %d rows %d columns - too large", solver->getNumRows(), solver->getNumCols(), solver2->getNumRows(), solver2->getNumCols()); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << generalPrint << CoinMessageEol; returnCode = -1; //printf("small no good2\n"); } else { sprintf(generalPrint, "Full problem %d rows %d columns, reduced to %d rows %d columns", solver->getNumRows(), solver->getNumCols(), solver2->getNumRows(), solver2->getNumCols()); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << generalPrint << CoinMessageEol; } #ifdef CGL_DEBUG if ((model_->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = solver2->getRowCutDebugger() ; if (debugger) { printf("On optimal path after preprocessing\n"); } } #endif if (returnCode == 1) { solver2->resolve(); CbcModel model(*solver2); double startTime=model_->getDblParam(CbcModel::CbcStartSeconds); model.setDblParam(CbcModel::CbcStartSeconds,startTime); // move seed across model.randomNumberGenerator()->setSeed(model_->randomNumberGenerator()->getSeed()); if (numberNodes >= 0) { // normal model.setSpecialOptions(saveModelOptions | 2048); if (logLevel <= 1 && feasibilityPumpOptions_ != -3) model.setLogLevel(0); else model.setLogLevel(logLevel); // No small fathoming model.setFastNodeDepth(-1); model.setCutoff(signedCutoff); model.setStrongStrategy(0); // Don't do if original fraction > 1.0 and too large if (fractionSmall_>1.0 && fractionSmall_ < 1000000.0) { /* 1.4 means -1 nodes if >.4 2.4 means -1 nodes if >.5 and 0 otherwise 3.4 means -1 nodes if >.6 and 0 or 5 4.4 means -1 nodes if >.7 and 0, 5 or 10 */ double fraction = fractionSmall_-floor(fractionSmall_); if (ratio>fraction) { int type = static_cast(floor(fractionSmall_*0.1)); int over = static_cast(ceil(ratio-fraction)); int maxNodes[]={-1,0,5,10}; if (type>over) numberNodes=maxNodes[type-over]; else numberNodes=-1; } } model.setMaximumNodes(numberNodes); model.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); if ((saveModelOptions&2048) == 0) model.setMoreSpecialOptions(model_->moreSpecialOptions()); model.setMoreSpecialOptions2(model_->moreSpecialOptions2()); // off conflict analysis model.setMoreSpecialOptions(model.moreSpecialOptions()&~4194304); // Lightweight CbcStrategyDefaultSubTree strategy(model_, 1, 5, 1, 0); model.setStrategy(strategy); model.solver()->setIntParam(OsiMaxNumIterationHotStart, 10); model.setMaximumCutPassesAtRoot(CoinMin(20, CoinAbs(model_->getMaximumCutPassesAtRoot()))); model.setMaximumCutPasses(CoinMin(10, model_->getMaximumCutPasses())); // Set best solution (even if bad for this submodel) if (model_->bestSolution()) { const double * bestSolution = model_->bestSolution(); int numberColumns2 = model.solver()->getNumCols(); double * bestSolution2 = new double [numberColumns2]; const int * originalColumns = process.originalColumns(); for (int iColumn=0;iColumnmessageHandler()->message(CBC_RESTART, model_->messages()) << solver2->getNumRows() << solver2->getNumCols() << CoinMessageEol; // going for full search and copy across more stuff model.gutsOfCopy(*model_, 2); #ifdef CGL_DEBUG if ((model_->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = model.solver()->getRowCutDebugger() ; if (debugger) { printf("On optimal path BB\n"); } } #endif assert (!model_->heuristicModel()); model_->setHeuristicModel(&model); for (int i = 0; i < model.numberCutGenerators(); i++) { CbcCutGenerator * generator = model.cutGenerator(i); CglGomory * gomory = dynamic_cast (generator->generator()); if (gomory&&gomory->originalSolver()) gomory->passInOriginalSolver(model.solver()); generator->setTiming(true); // Turn on if was turned on int iOften = model_->cutGenerator(i)->howOften(); #ifdef CLP_INVESTIGATE printf("Gen %d often %d %d\n", i, generator->howOften(), iOften); #endif if (iOften > 0) generator->setHowOften(iOften % 1000000); if (model_->cutGenerator(i)->howOftenInSub() == -200) generator->setHowOften(-100); } model.setCutoff(signedCutoff); // make sure can't do nested search! but allow heuristics model.setSpecialOptions((model.specialOptions()&(~(512 + 2048))) | 1024); bool takeHint; OsiHintStrength strength; // Switch off printing if asked to model_->solver()->getHintParam(OsiDoReducePrint, takeHint, strength); model.solver()->setHintParam(OsiDoReducePrint, takeHint, strength); // no cut generators if none in parent CbcStrategyDefault strategy(model_->numberCutGenerators() ? 1 : -1, model_->numberStrong(), model_->numberBeforeTrust()); // Set up pre-processing - no strategy.setupPreProcessing(0); // was (4); model.setStrategy(strategy); //model.solver()->writeMps("crunched"); int numberCuts = process.cuts().sizeRowCuts(); if (numberCuts) { // add in cuts CglStored cuts = process.cuts(); model.addCutGenerator(&cuts, 1, "Stored from first"); model.cutGenerator(model.numberCutGenerators()-1)->setGlobalCuts(true); } } // Do search if (logLevel > 1) model_->messageHandler()->message(CBC_START_SUB, model_->messages()) << name << model.getMaximumNodes() << CoinMessageEol; // probably faster to use a basis to get integer solutions model.setSpecialOptions(model.specialOptions() | 2); #ifdef CBC_THREAD if (model_->getNumberThreads() > 0 && (model_->getThreadMode()&4) != 0) { // See if at root node bool atRoot = model_->getNodeCount() == 0; int passNumber = model_->getCurrentPassNumber(); if (atRoot && passNumber == 1) model.setNumberThreads(model_->getNumberThreads()); } #endif model.setParentModel(*model_); model.setMaximumSolutions(maximumSolutions); model.setOriginalColumns(process.originalColumns()); model.setSearchStrategy(-1); // If no feasibility pump then insert a lightweight one if (feasibilityPumpOptions_ >= 0 || feasibilityPumpOptions_ == -2) { CbcHeuristicFPump * fpump = NULL; for (int i = 0; i < model.numberHeuristics(); i++) { CbcHeuristicFPump* pump = dynamic_cast(model.heuristic(i)); if (pump) { fpump = pump; break; } } if (!fpump) { CbcHeuristicFPump heuristic4; // use any cutoff heuristic4.setFakeCutoff(0.5*COIN_DBL_MAX); if (fractionSmall_<=1.0) heuristic4.setMaximumPasses(10); int pumpTune = feasibilityPumpOptions_; if (pumpTune==-2) pumpTune = 4; // proximity if (pumpTune > 0) { /* >=10000000 for using obj >=1000000 use as accumulate switch >=1000 use index+1 as number of large loops >=100 use 0.05 objvalue as increment %100 == 10,20 etc for experimentation 1 == fix ints at bounds, 2 fix all integral ints, 3 and continuous at bounds 4 and static continuous, 5 as 3 but no internal integers 6 as 3 but all slack basis! */ double value = solver2->getObjSense() * solver2->getObjValue(); int w = pumpTune / 10; int ix = w % 10; w /= 10; int c = w % 10; w /= 10; int r = w; int accumulate = r / 1000; r -= 1000 * accumulate; if (accumulate >= 10) { int which = accumulate / 10; accumulate -= 10 * which; which--; // weights and factors double weight[] = {0.1, 0.1, 0.5, 0.5, 1.0, 1.0, 5.0, 5.0}; double factor[] = {0.1, 0.5, 0.1, 0.5, 0.1, 0.5, 0.1, 0.5}; heuristic4.setInitialWeight(weight[which]); heuristic4.setWeightFactor(factor[which]); } // fake cutoff if (c) { double cutoff; solver2->getDblParam(OsiDualObjectiveLimit, cutoff); cutoff = CoinMin(cutoff, value + 0.1 * fabs(value) * c); heuristic4.setFakeCutoff(cutoff); } if (r) { // also set increment //double increment = (0.01*i+0.005)*(fabs(value)+1.0e-12); double increment = 0.0; heuristic4.setAbsoluteIncrement(increment); heuristic4.setAccumulate(accumulate); heuristic4.setMaximumRetries(r + 1); } pumpTune = pumpTune % 100; if (pumpTune == 6) pumpTune = 13; if (pumpTune != 13) pumpTune = pumpTune % 10; heuristic4.setWhen(pumpTune); if (ix) { heuristic4.setFeasibilityPumpOptions(ix*10); } } model.addHeuristic(&heuristic4, "feasibility pump", 0); } } else if (feasibilityPumpOptions_==-3) { // add all (except this) for (int i = 0; i < model_->numberHeuristics(); i++) { if (strcmp(heuristicName(),model_->heuristic(i)->heuristicName())) model.addHeuristic(model_->heuristic(i)); } } // modify heuristics for (int i = 0; i < model.numberHeuristics(); i++) { // reset lastNode CbcHeuristicRINS * rins = dynamic_cast(model.heuristic(i)); if (rins) { rins->setLastNode(-1000); rins->setSolutionCount(0); } } //printf("sol %x\n",inputSolution_); #ifdef CGL_DEBUG if ((model_->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = model.solver()->getRowCutDebugger() ; if (debugger) { printf("On optimal path CC\n"); } } #endif if (inputSolution_) { // translate and add a serendipity heuristic int numberColumns = solver2->getNumCols(); const int * which = process.originalColumns(); OsiSolverInterface * solver3 = solver2->clone(); for (int i = 0; i < numberColumns; i++) { if (solver3->isInteger(i)) { int k = which[i]; double value = inputSolution_[k]; //if (value) //printf("orig col %d now %d val %g\n", // k,i,value); solver3->setColLower(i, value); solver3->setColUpper(i, value); } } solver3->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); solver3->resolve(); if (!solver3->isProvenOptimal()) { // Try just setting nonzeros OsiSolverInterface * solver4 = solver2->clone(); for (int i = 0; i < numberColumns; i++) { if (solver4->isInteger(i)) { int k = which[i]; double value = floor(inputSolution_[k] + 0.5); if (value) { solver3->setColLower(i, value); solver3->setColUpper(i, value); } } } solver4->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); solver4->resolve(); int nBad = -1; if (solver4->isProvenOptimal()) { nBad = 0; const double * solution = solver4->getColSolution(); for (int i = 0; i < numberColumns; i++) { if (solver4->isInteger(i)) { double value = floor(solution[i] + 0.5); if (fabs(value - solution[i]) > 1.0e-6) nBad++; } } } if (nBad) { delete solver4; } else { delete solver3; solver3 = solver4; } } if (solver3->isProvenOptimal()) { // good CbcSerendipity heuristic(model); double value = solver3->getObjSense() * solver3->getObjValue(); heuristic.setInputSolution(solver3->getColSolution(), value); value = value + 1.0e-7*(1.0 + fabs(value)); value *= solver3->getObjSense(); model.setCutoff(value); model.addHeuristic(&heuristic, "Previous solution", 0); //printf("added seren\n"); } else { double value = model_->getMinimizationObjValue(); value = value + 1.0e-7*(1.0 + fabs(value)); value *= solver3->getObjSense(); model.setCutoff(value); sprintf(generalPrint, "Unable to insert previous solution - using cutoff of %g", value); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << generalPrint << CoinMessageEol; #ifdef CLP_INVESTIGATE printf("NOT added seren\n"); solver3->writeMps("bad_seren"); solver->writeMps("orig_seren"); #endif } delete solver3; } if (model_->searchStrategy() == 2) { model.setNumberStrong(5); model.setNumberBeforeTrust(5); } if (model.getNumCols()) { if (numberNodes >= 0) { setCutAndHeuristicOptions(model); // not too many iterations model.setMaximumNumberIterations(iterationMultiplier*(numberNodes + 10)); // Not fast stuff model.setFastNodeDepth(-1); //model.solver()->writeMps("before"); } else if (model.fastNodeDepth() >= 1000000) { // already set model.setFastNodeDepth(model.fastNodeDepth() - 1000000); } model.setWhenCuts(999998); #define ALWAYS_DUAL #ifdef ALWAYS_DUAL OsiSolverInterface * solverD = model.solver(); bool takeHint; OsiHintStrength strength; solverD->getHintParam(OsiDoDualInResolve, takeHint, strength); solverD->setHintParam(OsiDoDualInResolve, true, OsiHintDo); #endif model.passInEventHandler(model_->getEventHandler()); // say model_ is sitting there int saveOptions = model_->specialOptions(); model_->setSpecialOptions(saveOptions|1048576); // and switch off debugger model.setSpecialOptions(model.specialOptions()&(~1)); #if 0 //def COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (model.solver()); if (clpSolver) clpSolver->zapDebugger(); #endif #ifdef CONFLICT_CUTS if ((model_->moreSpecialOptions()&4194304)!=0) model.zapGlobalCuts(); #endif #ifdef CGL_DEBUG if ((model_->specialOptions()&1) != 0) { const OsiRowCutDebugger *debugger = model.solver()->getRowCutDebugger() ; if (debugger) { printf("On optimal path DD\n"); } } #endif model.branchAndBound(); model_->setHeuristicModel(NULL); model_->setSpecialOptions(saveOptions); #ifdef ALWAYS_DUAL solverD = model.solver(); solverD->setHintParam(OsiDoDualInResolve, takeHint, strength); #endif numberNodesDone_ = model.getNodeCount(); #ifdef COIN_DEVELOP printf("sub branch %d nodes, %d iterations - max %d\n", model.getNodeCount(), model.getIterationCount(), 100*(numberNodes + 10)); #endif if (numberNodes < 0) { model_->incrementIterationCount(model.getIterationCount()); model_->incrementNodeCount(model.getNodeCount()); // update best solution (in case ctrl-c) // !!! not a good idea - think a bit harder //model_->setMinimizationObjValue(model.getMinimizationObjValue()); for (int iGenerator = 0; iGenerator < model.numberCutGenerators(); iGenerator++) { CbcCutGenerator * generator = model.cutGenerator(iGenerator); sprintf(generalPrint, "%s was tried %d times and created %d cuts of which %d were active after adding rounds of cuts (%.3f seconds)", generator->cutGeneratorName(), generator->numberTimesEntered(), generator->numberCutsInTotal() + generator->numberColumnCuts(), generator->numberCutsActive(), generator->timeInCutGenerator()); CglStored * stored = dynamic_cast(generator->generator()); if (stored && !generator->numberCutsInTotal()) continue; #ifndef CLP_INVESTIGATE CglImplication * implication = dynamic_cast(generator->generator()); if (implication) continue; #endif model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << generalPrint << CoinMessageEol; } } } else { // empty model model.setMinimizationObjValue(model.solver()->getObjSense()*model.solver()->getObjValue()); } if (logLevel > 1) model_->messageHandler()->message(CBC_END_SUB, model_->messages()) << name << CoinMessageEol; if (model.getMinimizationObjValue() < CoinMin(cutoff, 1.0e30)) { // solution if (model.getNumCols()) returnCode = model.isProvenOptimal() ? 3 : 1; else returnCode = 3; // post process #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model.solver()); if (clpSolver) { ClpSimplex * lpSolver = clpSolver->getModelPtr(); lpSolver->setSpecialOptions(lpSolver->specialOptions() | 0x01000000); // say is Cbc (and in branch and bound) } #endif //if (fractionSmall_ < 1000000.0) process.postProcess(*model.solver()); if (solver->isProvenOptimal() && solver->getObjValue()*solver->getObjSense() < cutoff) { // Solution now back in solver int numberColumns = solver->getNumCols(); memcpy(newSolution, solver->getColSolution(), numberColumns*sizeof(double)); newSolutionValue = model.getMinimizationObjValue(); } else { // odd - but no good returnCode = 0; // so will be infeasible } } else { // no good returnCode = model.isProvenInfeasible() ? 2 : 0; // so will be infeasible } int totalNumberIterations = model.getIterationCount() + process.numberIterationsPre() + process.numberIterationsPost(); if (totalNumberIterations > 100*(numberNodes + 10) && fractionSmall_ < 1000000.0) { // only allow smaller problems fractionSmall = fractionSmall_; fractionSmall_ *= 0.9; #ifdef CLP_INVESTIGATE printf("changing fractionSmall from %g to %g for %s as %d iterations\n", fractionSmall, fractionSmall_, name.c_str(), totalNumberIterations); #endif } if (model.status() == 5) model_->sayEventHappened(); #ifdef COIN_DEVELOP if (model.isProvenInfeasible()) status = 1; else if (model.isProvenOptimal()) status = 2; #endif } } } else { returnCode = 2; // infeasible finished if (logLevel > 1){ printf("Infeasible on initial solve\n"); } } model_->setSpecialOptions(saveModelOptions); model_->setLogLevel(logLevel); if (returnCode == 1 || returnCode == 2) { OsiSolverInterface * solverC = model_->continuousSolver(); if (false && solverC) { const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * lowerC = solverC->getColLower(); const double * upperC = solverC->getColUpper(); bool good = true; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (solverC->isInteger(iColumn)) { if (lower[iColumn] > lowerC[iColumn] && upper[iColumn] < upperC[iColumn]) { good = false; printf("CUT - can't add\n"); break; } } } if (good) { double * cut = new double [numberColumns]; int * which = new int [numberColumns]; double rhs = -1.0; int n = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (solverC->isInteger(iColumn)) { if (lower[iColumn] == upperC[iColumn]) { rhs += lower[iColumn]; cut[n] = 1.0; which[n++] = iColumn; } else if (upper[iColumn] == lowerC[iColumn]) { rhs -= upper[iColumn]; cut[n] = -1.0; which[n++] = iColumn; } } } printf("CUT has %d entries\n", n); OsiRowCut newCut; newCut.setLb(-COIN_DBL_MAX); newCut.setUb(rhs); newCut.setRow(n, which, cut, false); model_->makeGlobalCut(newCut); delete [] cut; delete [] which; } } #ifdef COIN_DEVELOP if (status == 1) printf("heuristic could add cut because infeasible (%s)\n", heuristicName_.c_str()); else if (status == 2) printf("heuristic could add cut because optimal (%s)\n", heuristicName_.c_str()); #endif } if (reset) { for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (reset[iColumn]) solver->setColLower(iColumn, 0.0); } delete [] reset; } #ifdef HISTORY_STATISTICS getHistoryStatistics_ = true; #endif solver->setHintParam(OsiDoReducePrint, takeHint, strength); return returnCode; } // Set input solution void CbcHeuristic::setInputSolution(const double * solution, double objValue) { delete [] inputSolution_; inputSolution_ = NULL; if (model_ && solution) { int numberColumns = model_->getNumCols(); inputSolution_ = new double [numberColumns+1]; memcpy(inputSolution_, solution, numberColumns*sizeof(double)); inputSolution_[numberColumns] = objValue; } } //############################################################################## inline int compare3BranchingObjects(const CbcBranchingObject* br0, const CbcBranchingObject* br1) { const int t0 = br0->type(); const int t1 = br1->type(); if (t0 < t1) { return -1; } if (t0 > t1) { return 1; } return br0->compareOriginalObject(br1); } //============================================================================== inline bool compareBranchingObjects(const CbcBranchingObject* br0, const CbcBranchingObject* br1) { return compare3BranchingObjects(br0, br1) < 0; } //============================================================================== void CbcHeuristicNode::gutsOfConstructor(CbcModel& model) { // CbcHeurDebugNodes(&model); CbcNode* node = model.currentNode(); brObj_ = new CbcBranchingObject*[node->depth()]; CbcNodeInfo* nodeInfo = node->nodeInfo(); int cnt = 0; while (nodeInfo->parentBranch() != NULL) { const OsiBranchingObject* br = nodeInfo->parentBranch(); const CbcBranchingObject* cbcbr = dynamic_cast(br); if (! cbcbr) { throw CoinError("CbcHeuristicNode can be used only with CbcBranchingObjects.\n", "gutsOfConstructor", "CbcHeuristicNode", __FILE__, __LINE__); } brObj_[cnt] = cbcbr->clone(); brObj_[cnt]->previousBranch(); ++cnt; nodeInfo = nodeInfo->parent(); } std::sort(brObj_, brObj_ + cnt, compareBranchingObjects); if (cnt <= 1) { numObjects_ = cnt; } else { numObjects_ = 0; CbcBranchingObject* br = NULL; // What should this be? for (int i = 1; i < cnt; ++i) { if (compare3BranchingObjects(brObj_[numObjects_], brObj_[i]) == 0) { int comp = brObj_[numObjects_]->compareBranchingObject(brObj_[i], br != 0); switch (comp) { case CbcRangeSame: // the same range case CbcRangeDisjoint: // disjoint decisions // should not happen! we are on a chain! abort(); case CbcRangeSubset: // brObj_[numObjects_] is a subset of brObj_[i] delete brObj_[i]; break; case CbcRangeSuperset: // brObj_[i] is a subset of brObj_[numObjects_] delete brObj_[numObjects_]; brObj_[numObjects_] = brObj_[i]; break; case CbcRangeOverlap: // overlap delete brObj_[i]; delete brObj_[numObjects_]; brObj_[numObjects_] = br; break; } continue; } else { brObj_[++numObjects_] = brObj_[i]; } } ++numObjects_; } } //============================================================================== CbcHeuristicNode::CbcHeuristicNode(CbcModel& model) { gutsOfConstructor(model); } //============================================================================== double CbcHeuristicNode::distance(const CbcHeuristicNode* node) const { const double disjointWeight = 1; const double overlapWeight = 0.4; const double subsetWeight = 0.2; int countDisjointWeight = 0; int countOverlapWeight = 0; int countSubsetWeight = 0; int i = 0; int j = 0; double dist = 0.0; #ifdef PRINT_DEBUG printf(" numObjects_ = %i, node->numObjects_ = %i\n", numObjects_, node->numObjects_); #endif while ( i < numObjects_ && j < node->numObjects_) { CbcBranchingObject* br0 = brObj_[i]; const CbcBranchingObject* br1 = node->brObj_[j]; #ifdef PRINT_DEBUG const CbcIntegerBranchingObject* brPrint0 = dynamic_cast(br0); const double* downBounds = brPrint0->downBounds(); const double* upBounds = brPrint0->upBounds(); int variable = brPrint0->variable(); int way = brPrint0->way(); printf(" br0: var %i downBd [%i,%i] upBd [%i,%i] way %i\n", variable, static_cast(downBounds[0]), static_cast(downBounds[1]), static_cast(upBounds[0]), static_cast(upBounds[1]), way); const CbcIntegerBranchingObject* brPrint1 = dynamic_cast(br1); downBounds = brPrint1->downBounds(); upBounds = brPrint1->upBounds(); variable = brPrint1->variable(); way = brPrint1->way(); printf(" br1: var %i downBd [%i,%i] upBd [%i,%i] way %i\n", variable, static_cast(downBounds[0]), static_cast(downBounds[1]), static_cast(upBounds[0]), static_cast(upBounds[1]), way); #endif const int brComp = compare3BranchingObjects(br0, br1); if (brComp < 0) { dist += subsetWeight; countSubsetWeight++; ++i; } else if (brComp > 0) { dist += subsetWeight; countSubsetWeight++; ++j; } else { const int comp = br0->compareBranchingObject(br1, false); switch (comp) { case CbcRangeSame: // do nothing break; case CbcRangeDisjoint: // disjoint decisions dist += disjointWeight; countDisjointWeight++; break; case CbcRangeSubset: // subset one way or another case CbcRangeSuperset: dist += subsetWeight; countSubsetWeight++; break; case CbcRangeOverlap: // overlap dist += overlapWeight; countOverlapWeight++; break; } ++i; ++j; } } dist += subsetWeight * (numObjects_ - i + node->numObjects_ - j); countSubsetWeight += (numObjects_ - i + node->numObjects_ - j); COIN_DETAIL_PRINT(printf("subset = %i, overlap = %i, disjoint = %i\n", countSubsetWeight, countOverlapWeight, countDisjointWeight)); return dist; } //============================================================================== CbcHeuristicNode::~CbcHeuristicNode() { for (int i = 0; i < numObjects_; ++i) { delete brObj_[i]; } delete [] brObj_; } //============================================================================== double CbcHeuristicNode::minDistance(const CbcHeuristicNodeList& nodeList) const { double minDist = COIN_DBL_MAX; for (int i = nodeList.size() - 1; i >= 0; --i) { minDist = CoinMin(minDist, distance(nodeList.node(i))); } return minDist; } //============================================================================== bool CbcHeuristicNode::minDistanceIsSmall(const CbcHeuristicNodeList& nodeList, const double threshold) const { for (int i = nodeList.size() - 1; i >= 0; --i) { if (distance(nodeList.node(i)) >= threshold) { continue; } else { return true; } } return false; } //============================================================================== double CbcHeuristicNode::avgDistance(const CbcHeuristicNodeList& nodeList) const { if (nodeList.size() == 0) { return COIN_DBL_MAX; } double sumDist = 0; for (int i = nodeList.size() - 1; i >= 0; --i) { sumDist += distance(nodeList.node(i)); } return sumDist / nodeList.size(); } //############################################################################## // Default Constructor CbcRounding::CbcRounding() : CbcHeuristic() { // matrix and row copy will automatically be empty seed_ = 7654321; down_ = NULL; up_ = NULL; equal_ = NULL; //whereFrom_ |= 16*(1+256); // allow more often } // Constructor from model CbcRounding::CbcRounding(CbcModel & model) : CbcHeuristic(model) { // Get a copy of original matrix (and by row for rounding); assert(model.solver()); if (model.solver()->getNumRows()) { matrix_ = *model.solver()->getMatrixByCol(); matrixByRow_ = *model.solver()->getMatrixByRow(); validate(); } down_ = NULL; up_ = NULL; equal_ = NULL; seed_ = 7654321; //whereFrom_ |= 16*(1+256); // allow more often } // Destructor CbcRounding::~CbcRounding () { delete [] down_; delete [] up_; delete [] equal_; } // Clone CbcHeuristic * CbcRounding::clone() const { return new CbcRounding(*this); } // Create C++ lines to get to current state void CbcRounding::generateCpp( FILE * fp) { CbcRounding other; fprintf(fp, "0#include \"CbcHeuristic.hpp\"\n"); fprintf(fp, "3 CbcRounding rounding(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "rounding"); if (seed_ != other.seed_) fprintf(fp, "3 rounding.setSeed(%d);\n", seed_); else fprintf(fp, "4 rounding.setSeed(%d);\n", seed_); fprintf(fp, "3 cbcModel->addHeuristic(&rounding);\n"); } //#define NEW_ROUNDING // Copy constructor CbcRounding::CbcRounding(const CbcRounding & rhs) : CbcHeuristic(rhs), matrix_(rhs.matrix_), matrixByRow_(rhs.matrixByRow_), seed_(rhs.seed_) { #ifdef NEW_ROUNDING int numberColumns = matrix_.getNumCols(); down_ = CoinCopyOfArray(rhs.down_, numberColumns); up_ = CoinCopyOfArray(rhs.up_, numberColumns); equal_ = CoinCopyOfArray(rhs.equal_, numberColumns); #else down_ = NULL; up_ = NULL; equal_ = NULL; #endif } // Assignment operator CbcRounding & CbcRounding::operator=( const CbcRounding & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); matrix_ = rhs.matrix_; matrixByRow_ = rhs.matrixByRow_; #ifdef NEW_ROUNDING delete [] down_; delete [] up_; delete [] equal_; int numberColumns = matrix_.getNumCols(); down_ = CoinCopyOfArray(rhs.down_, numberColumns); up_ = CoinCopyOfArray(rhs.up_, numberColumns); equal_ = CoinCopyOfArray(rhs.equal_, numberColumns); #else down_ = NULL; up_ = NULL; equal_ = NULL; #endif seed_ = rhs.seed_; } return *this; } // Resets stuff if model changes void CbcRounding::resetModel(CbcModel * model) { model_ = model; // Get a copy of original matrix (and by row for rounding); assert(model_->solver()); matrix_ = *model_->solver()->getMatrixByCol(); matrixByRow_ = *model_->solver()->getMatrixByRow(); validate(); } /* Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution */ bool CbcRounding::shouldHeurRun(int whereFrom) { if (whereFrom!=4) { return CbcHeuristic::shouldHeurRun(whereFrom); } else { numCouldRun_++; return shouldHeurRun_randomChoice(); } } // See if rounding will give solution // Sets value of solution // Assumes rhs for original matrix still okay // At present only works with integers // Fix values if asked for // Returns 1 if solution, 0 if not int CbcRounding::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; // See if to do if (!when() || (when() % 10 == 1 && model_->phase() != 1) || (when() % 10 == 2 && (model_->phase() != 2 && model_->phase() != 3))) return 0; // switched off numRuns_++; #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif OsiSolverInterface * solver = model_->solver(); double direction = solver->getObjSense(); double newSolutionValue = direction * solver->getObjValue(); return solution(solutionValue, betterSolution, newSolutionValue); } // See if rounding will give solution // Sets value of solution // Assumes rhs for original matrix still okay // At present only works with integers // Fix values if asked for // Returns 1 if solution, 0 if not int CbcRounding::solution(double & solutionValue, double * betterSolution, double newSolutionValue) { // See if to do if (!when() || (when() % 10 == 1 && model_->phase() != 1) || (when() % 10 == 2 && (model_->phase() != 2 && model_->phase() != 3))) return 0; // switched off OsiSolverInterface * solver = model_->solver(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); const double * solution = solver->getColSolution(); const double * objective = solver->getObjCoefficients(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); double useTolerance = primalTolerance; int numberRows = matrix_.getNumRows(); assert (numberRows <= solver->getNumRows()); if (numberRows == 0){ return 0; } int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int i; double direction = solver->getObjSense(); //double newSolutionValue = direction*solver->getObjValue(); int returnCode = 0; // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); // Get solution array for heuristic solution int numberColumns = solver->getNumCols(); double * newSolution = new double [numberColumns]; memcpy(newSolution, solution, numberColumns*sizeof(double)); double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); for (i = 0; i < numberColumns; i++) { int j; double value = newSolution[i]; if (value < lower[i]) { value = lower[i]; newSolution[i] = value; } else if (value > upper[i]) { value = upper[i]; newSolution[i] = value; } if (value) { for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } // check was feasible - if not adjust (cleaning may move) for (i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i]) { //assert (rowActivity[i]>rowLower[i]-1000.0*primalTolerance); rowActivity[i] = rowLower[i]; } else if (rowActivity[i] > rowUpper[i]) { //assert (rowActivity[i] integerTolerance) { double below = floor(value); double newValue = newSolution[iColumn]; double cost = direction * objective[iColumn]; double move; if (cost > 0.0) { // try up move = 1.0 - (value - below); } else if (cost < 0.0) { // try down move = below - value; } else { // won't be able to move unless we can grab another variable double randomNumber = randomNumberGenerator_.randomDouble(); // which way? if (randomNumber < 0.5) move = below - value; else move = 1.0 - (value - below); } newValue += move; newSolution[iColumn] = newValue; newSolutionValue += move * cost; int j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += move * element[j]; } } } double penalty = 0.0; const char * integerType = model_->integerType(); // see if feasible - just using singletons for (i = 0; i < numberRows; i++) { double value = rowActivity[i]; double thisInfeasibility = 0.0; if (value < rowLower[i] - primalTolerance) thisInfeasibility = value - rowLower[i]; else if (value > rowUpper[i] + primalTolerance) thisInfeasibility = value - rowUpper[i]; if (thisInfeasibility) { // See if there are any slacks I can use to fix up // maybe put in coding for multiple slacks? double bestCost = 1.0e50; int k; int iBest = -1; double addCost = 0.0; double newValue = 0.0; double changeRowActivity = 0.0; double absInfeasibility = fabs(thisInfeasibility); for (k = rowStart[i]; k < rowStart[i] + rowLength[i]; k++) { int iColumn = column[k]; // See if all elements help if (columnLength[iColumn] == 1) { double currentValue = newSolution[iColumn]; double elementValue = elementByRow[k]; double lowerValue = lower[iColumn]; double upperValue = upper[iColumn]; double gap = rowUpper[i] - rowLower[i]; double absElement = fabs(elementValue); if (thisInfeasibility*elementValue > 0.0) { // we want to reduce if ((currentValue - lowerValue)*absElement >= absInfeasibility) { // possible - check if integer double distance = absInfeasibility / absElement; double thisCost = -direction * objective[iColumn] * distance; if (integerType[iColumn]) { distance = ceil(distance - useTolerance); if (currentValue - distance >= lowerValue - useTolerance) { if (absInfeasibility - distance*absElement < -gap - useTolerance) thisCost = 1.0e100; // no good else thisCost = -direction * objective[iColumn] * distance; } else { thisCost = 1.0e100; // no good } } if (thisCost < bestCost) { bestCost = thisCost; iBest = iColumn; addCost = thisCost; newValue = currentValue - distance; changeRowActivity = -distance * elementValue; } } } else { // we want to increase if ((upperValue - currentValue)*absElement >= absInfeasibility) { // possible - check if integer double distance = absInfeasibility / absElement; double thisCost = direction * objective[iColumn] * distance; if (integerType[iColumn]) { distance = ceil(distance - 1.0e-7); assert (currentValue - distance <= upperValue + useTolerance); if (absInfeasibility - distance*absElement < -gap - useTolerance) thisCost = 1.0e100; // no good else thisCost = direction * objective[iColumn] * distance; } if (thisCost < bestCost) { bestCost = thisCost; iBest = iColumn; addCost = thisCost; newValue = currentValue + distance; changeRowActivity = distance * elementValue; } } } } } if (iBest >= 0) { /*printf("Infeasibility of %g on row %d cost %g\n", thisInfeasibility,i,addCost);*/ newSolution[iBest] = newValue; thisInfeasibility = 0.0; newSolutionValue += addCost; rowActivity[i] += changeRowActivity; } penalty += fabs(thisInfeasibility); } } if (penalty) { // see if feasible using any // first continuous double penaltyChange = 0.0; int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerType[iColumn]) continue; double currentValue = newSolution[iColumn]; double lowerValue = lower[iColumn]; double upperValue = upper[iColumn]; int j; int anyBadDown = 0; int anyBadUp = 0; double upImprovement = 0.0; double downImprovement = 0.0; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (rowUpper[iRow] > rowLower[iRow]) { double value = element[j]; if (rowActivity[iRow] > rowUpper[iRow] + primalTolerance) { // infeasible above downImprovement += value; upImprovement -= value; if (value > 0.0) anyBadUp++; else anyBadDown++; } else if (rowActivity[iRow] > rowUpper[iRow] - primalTolerance) { // feasible at ub if (value > 0.0) { upImprovement -= value; anyBadUp++; } else { downImprovement += value; anyBadDown++; } } else if (rowActivity[iRow] > rowLower[iRow] + primalTolerance) { // feasible in interior } else if (rowActivity[iRow] > rowLower[iRow] - primalTolerance) { // feasible at lb if (value < 0.0) { upImprovement += value; anyBadUp++; } else { downImprovement -= value; anyBadDown++; } } else { // infeasible below downImprovement -= value; upImprovement += value; if (value < 0.0) anyBadUp++; else anyBadDown++; } } else { // equality row double value = element[j]; if (rowActivity[iRow] > rowUpper[iRow] + primalTolerance) { // infeasible above downImprovement += value; upImprovement -= value; if (value > 0.0) anyBadUp++; else anyBadDown++; } else if (rowActivity[iRow] < rowLower[iRow] - primalTolerance) { // infeasible below downImprovement -= value; upImprovement += value; if (value < 0.0) anyBadUp++; else anyBadDown++; } else { // feasible - no good anyBadUp = -1; anyBadDown = -1; break; } } } // could change tests for anyBad if (anyBadUp) upImprovement = 0.0; if (anyBadDown) downImprovement = 0.0; double way = 0.0; double improvement = 0.0; if (downImprovement > 0.0 && currentValue > lowerValue) { way = -1.0; improvement = downImprovement; } else if (upImprovement > 0.0 && currentValue < upperValue) { way = 1.0; improvement = upImprovement; } if (way) { // can improve double distance; if (way > 0.0) distance = upperValue - currentValue; else distance = currentValue - lowerValue; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j] * way; if (rowActivity[iRow] > rowUpper[iRow] + primalTolerance) { // infeasible above assert (value < 0.0); double gap = rowActivity[iRow] - rowUpper[iRow]; if (gap + value*distance < 0.0) distance = -gap / value; } else if (rowActivity[iRow] < rowLower[iRow] - primalTolerance) { // infeasible below assert (value > 0.0); double gap = rowActivity[iRow] - rowLower[iRow]; if (gap + value*distance > 0.0) distance = -gap / value; } else { // feasible if (value > 0) { double gap = rowActivity[iRow] - rowUpper[iRow]; if (gap + value*distance > 0.0) distance = -gap / value; } else { double gap = rowActivity[iRow] - rowLower[iRow]; if (gap + value*distance < 0.0) distance = -gap / value; } } } //move penaltyChange += improvement * distance; distance *= way; newSolution[iColumn] += distance; newSolutionValue += direction * objective[iColumn] * distance; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j]; rowActivity[iRow] += distance * value; } } } // and now all if improving double lastChange = penaltyChange ? 1.0 : 0.0; int numberPasses=0; while (lastChange > 1.0e-2 && numberPasses < 1000) { lastChange = 0; numberPasses++; for (iColumn = 0; iColumn < numberColumns; iColumn++) { bool isInteger = (integerType[iColumn] != 0); double currentValue = newSolution[iColumn]; double lowerValue = lower[iColumn]; double upperValue = upper[iColumn]; int j; int anyBadDown = 0; int anyBadUp = 0; double upImprovement = 0.0; double downImprovement = 0.0; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j]; if (isInteger) { if (value > 0.0) { if (rowActivity[iRow] + value > rowUpper[iRow] + primalTolerance) anyBadUp++; if (rowActivity[iRow] - value < rowLower[iRow] - primalTolerance) anyBadDown++; } else { if (rowActivity[iRow] - value > rowUpper[iRow] + primalTolerance) anyBadDown++; if (rowActivity[iRow] + value < rowLower[iRow] - primalTolerance) anyBadUp++; } } if (rowUpper[iRow] > rowLower[iRow]) { if (rowActivity[iRow] > rowUpper[iRow] + primalTolerance) { // infeasible above downImprovement += value; upImprovement -= value; if (value > 0.0) anyBadUp++; else anyBadDown++; } else if (rowActivity[iRow] > rowUpper[iRow] - primalTolerance) { // feasible at ub if (value > 0.0) { upImprovement -= value; anyBadUp++; } else { downImprovement += value; anyBadDown++; } } else if (rowActivity[iRow] > rowLower[iRow] + primalTolerance) { // feasible in interior } else if (rowActivity[iRow] > rowLower[iRow] - primalTolerance) { // feasible at lb if (value < 0.0) { upImprovement += value; anyBadUp++; } else { downImprovement -= value; anyBadDown++; } } else { // infeasible below downImprovement -= value; upImprovement += value; if (value < 0.0) anyBadUp++; else anyBadDown++; } } else { // equality row if (rowActivity[iRow] > rowUpper[iRow] + primalTolerance) { // infeasible above downImprovement += value; upImprovement -= value; if (value > 0.0) anyBadUp++; else anyBadDown++; } else if (rowActivity[iRow] < rowLower[iRow] - primalTolerance) { // infeasible below downImprovement -= value; upImprovement += value; if (value < 0.0) anyBadUp++; else anyBadDown++; } else { // feasible - no good anyBadUp = -1; anyBadDown = -1; break; } } } // could change tests for anyBad if (anyBadUp) upImprovement = 0.0; if (anyBadDown) downImprovement = 0.0; double way = 0.0; double improvement = 0.0; if (downImprovement > 0.0 && currentValue > lowerValue) { way = -1.0; improvement = downImprovement; if (isInteger&¤tValue 0.0 && currentValue < upperValue) { way = 1.0; improvement = upImprovement; if (isInteger&¤tValue>upperValue-0.99) continue; // no good } if (way) { // can improve double distance = COIN_DBL_MAX; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j] * way; if (rowActivity[iRow] > rowUpper[iRow] + primalTolerance) { // infeasible above assert (value < 0.0); double gap = rowActivity[iRow] - rowUpper[iRow]; if (gap + value*distance < 0.0) { // If integer then has to move by 1 if (!isInteger) distance = -gap / value; else distance = CoinMax(-gap / value, 1.0); } } else if (rowActivity[iRow] < rowLower[iRow] - primalTolerance) { // infeasible below assert (value > 0.0); double gap = rowActivity[iRow] - rowLower[iRow]; if (gap + value*distance > 0.0) { // If integer then has to move by 1 if (!isInteger) distance = -gap / value; else distance = CoinMax(-gap / value, 1.0); } } else { // feasible if (value > 0) { double gap = rowActivity[iRow] - rowUpper[iRow]; if (gap + value*distance > 0.0) distance = -gap / value; } else { double gap = rowActivity[iRow] - rowLower[iRow]; if (gap + value*distance < 0.0) distance = -gap / value; } } } if (isInteger) distance = floor(distance + 1.05e-8); if (!distance) { // should never happen //printf("zero distance in CbcRounding - debug\n"); } //move lastChange += improvement * distance; distance *= way; newSolution[iColumn] += distance; newSolutionValue += direction * objective[iColumn] * distance; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j]; rowActivity[iRow] += distance * value; } } } penaltyChange += lastChange; } penalty -= penaltyChange; if (penalty < 1.0e-5*fabs(penaltyChange)) { // recompute penalty = 0.0; for (i = 0; i < numberRows; i++) { double value = rowActivity[i]; if (value < rowLower[i] - primalTolerance) penalty += rowLower[i] - value; else if (value > rowUpper[i] + primalTolerance) penalty += value - rowUpper[i]; } } } // Could also set SOS (using random) and repeat if (!penalty) { // See if we can do better //seed_++; //CoinSeedRandom(seed_); // Random number between 0 and 1. double randomNumber = randomNumberGenerator_.randomDouble(); int iPass; int start[2]; int end[2]; int iRandom = static_cast (randomNumber * (static_cast (numberIntegers))); start[0] = iRandom; end[0] = numberIntegers; start[1] = 0; end[1] = iRandom; for (iPass = 0; iPass < 2; iPass++) { int i; for (i = start[iPass]; i < end[iPass]; i++) { int iColumn = integerVariable[i]; #ifndef NDEBUG double value = newSolution[iColumn]; assert (fabs(floor(value + 0.5) - value) < integerTolerance); #endif double cost = direction * objective[iColumn]; double move = 0.0; if (cost > 0.0) move = -1.0; else if (cost < 0.0) move = 1.0; while (move) { bool good = true; double newValue = newSolution[iColumn] + move; if (newValue < lower[iColumn] - useTolerance || newValue > upper[iColumn] + useTolerance) { move = 0.0; } else { // see if we can move int j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double newActivity = rowActivity[iRow] + move * element[j]; if (newActivity < rowLower[iRow] - primalTolerance || newActivity > rowUpper[iRow] + primalTolerance) { good = false; break; } } if (good) { newSolution[iColumn] = newValue; newSolutionValue += move * cost; int j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += move * element[j]; } } else { move = 0.0; } } } } } // Just in case of some stupidity double objOffset = 0.0; solver->getDblParam(OsiObjOffset, objOffset); newSolutionValue = -objOffset; for ( i = 0 ; i < numberColumns ; i++ ) newSolutionValue += objective[i] * newSolution[i]; newSolutionValue *= direction; //printf("new solution value %g %g\n",newSolutionValue,solutionValue); if (newSolutionValue < solutionValue) { // paranoid check memset(rowActivity, 0, numberRows*sizeof(double)); for (i = 0; i < numberColumns; i++) { int j; double value = newSolution[i]; if (value) { for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } // check was approximately feasible bool feasible = true; for (i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i]) { if (rowActivity[i] < rowLower[i] - 1000.0*primalTolerance) feasible = false; } else if (rowActivity[i] > rowUpper[i]) { if (rowActivity[i] > rowUpper[i] + 1000.0*primalTolerance) feasible = false; } } if (feasible) { // new solution memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); solutionValue = newSolutionValue; //printf("** Solution of %g found by rounding\n",newSolutionValue); returnCode = 1; } else { // Can easily happen //printf("Debug CbcRounding giving bad solution\n"); } } } #ifdef NEW_ROUNDING if (!returnCode) { #ifdef JJF_ZERO // back to starting point memcpy(newSolution, solution, numberColumns*sizeof(double)); memset(rowActivity, 0, numberRows*sizeof(double)); for (i = 0; i < numberColumns; i++) { int j; double value = newSolution[i]; if (value < lower[i]) { value = lower[i]; newSolution[i] = value; } else if (value > upper[i]) { value = upper[i]; newSolution[i] = value; } if (value) { for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } // check was feasible - if not adjust (cleaning may move) for (i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i]) { //assert (rowActivity[i]>rowLower[i]-1000.0*primalTolerance); rowActivity[i] = rowLower[i]; } else if (rowActivity[i] > rowUpper[i]) { //assert (rowActivity[i] 1.0e-8) candidate[nCandidate++] = iColumn; } } if (true) { // Rounding as in Berthold while (nCandidate) { double infeasibility = 1.0e-7; int iRow = -1; for (i = 0; i < numberRows; i++) { double value = 0.0; if (rowActivity[i] < rowLower[i]) { value = rowLower[i] - rowActivity[i]; } else if (rowActivity[i] > rowUpper[i]) { value = rowActivity[i] - rowUpper[i]; } if (value > infeasibility) { infeasibility = value; iRow = i; } } if (iRow >= 0) { // infeasible } else { // feasible } } } else { // Shifting as in Berthold } delete [] candidate; } #endif delete [] newSolution; delete [] rowActivity; return returnCode; } // update model void CbcRounding::setModel(CbcModel * model) { model_ = model; // Get a copy of original matrix (and by row for rounding); assert(model_->solver()); if (model_->solver()->getNumRows()) { matrix_ = *model_->solver()->getMatrixByCol(); matrixByRow_ = *model_->solver()->getMatrixByRow(); // make sure model okay for heuristic validate(); } } // Validate model i.e. sets when_ to 0 if necessary (may be NULL) void CbcRounding::validate() { if (model_ && (when() % 100) < 10) { if (model_->numberIntegers() != model_->numberObjects() && (model_->numberObjects() || (model_->specialOptions()&1024) == 0)) { int numberOdd = 0; for (int i = 0; i < model_->numberObjects(); i++) { if (!model_->object(i)->canDoHeuristics()) numberOdd++; } if (numberOdd) setWhen(0); } } #ifdef NEW_ROUNDING int numberColumns = matrix_.getNumCols(); down_ = new unsigned short [numberColumns]; up_ = new unsigned short [numberColumns]; equal_ = new unsigned short [numberColumns]; // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); const double * rowLower = model.solver()->getRowLower(); const double * rowUpper = model.solver()->getRowUpper(); for (int i = 0; i < numberColumns; i++) { int down = 0; int up = 0; int equal = 0; if (columnLength[i] > 65535) { equal[0] = 65535; break; // unlikely to work } for (CoinBigIndex j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; if (rowLower[iRow] > -1.0e20 && rowUpper[iRow] < 1.0e20) { equal++; } else if (element[j] > 0.0) { if (rowUpper[iRow] < 1.0e20) up++; else down--; } else { if (rowLower[iRow] > -1.0e20) up++; else down--; } } down_[i] = (unsigned short) down; up_[i] = (unsigned short) up; equal_[i] = (unsigned short) equal; } #else down_ = NULL; up_ = NULL; equal_ = NULL; #endif } // Default Constructor CbcHeuristicPartial::CbcHeuristicPartial() : CbcHeuristic() { fixPriority_ = 10000; } // Constructor from model CbcHeuristicPartial::CbcHeuristicPartial(CbcModel & model, int fixPriority, int numberNodes) : CbcHeuristic(model) { fixPriority_ = fixPriority; setNumberNodes(numberNodes); validate(); } // Destructor CbcHeuristicPartial::~CbcHeuristicPartial () { } // Clone CbcHeuristic * CbcHeuristicPartial::clone() const { return new CbcHeuristicPartial(*this); } // Create C++ lines to get to current state void CbcHeuristicPartial::generateCpp( FILE * fp) { CbcHeuristicPartial other; fprintf(fp, "0#include \"CbcHeuristic.hpp\"\n"); fprintf(fp, "3 CbcHeuristicPartial partial(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "partial"); if (fixPriority_ != other.fixPriority_) fprintf(fp, "3 partial.setFixPriority(%d);\n", fixPriority_); else fprintf(fp, "4 partial.setFixPriority(%d);\n", fixPriority_); fprintf(fp, "3 cbcModel->addHeuristic(&partial);\n"); } //#define NEW_PARTIAL // Copy constructor CbcHeuristicPartial::CbcHeuristicPartial(const CbcHeuristicPartial & rhs) : CbcHeuristic(rhs), fixPriority_(rhs.fixPriority_) { } // Assignment operator CbcHeuristicPartial & CbcHeuristicPartial::operator=( const CbcHeuristicPartial & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); fixPriority_ = rhs.fixPriority_; } return *this; } // Resets stuff if model changes void CbcHeuristicPartial::resetModel(CbcModel * model) { model_ = model; // Get a copy of original matrix (and by row for partial); assert(model_->solver()); validate(); } // See if partial will give solution // Sets value of solution // Assumes rhs for original matrix still okay // At present only works with integers // Fix values if asked for // Returns 1 if solution, 0 if not int CbcHeuristicPartial::solution(double & solutionValue, double * betterSolution) { // Return if already done if (fixPriority_ < 0) return 0; // switched off #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif const double * hotstartSolution = model_->hotstartSolution(); const int * hotstartPriorities = model_->hotstartPriorities(); if (!hotstartSolution) return 0; OsiSolverInterface * solver = model_->solver(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); OsiSolverInterface * newSolver = model_->continuousSolver()->clone(); const double * colLower = newSolver->getColLower(); const double * colUpper = newSolver->getColUpper(); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); int i; int numberFixed = 0; int returnCode = 0; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (abs(hotstartPriorities[iColumn]) <= fixPriority_) { double value = hotstartSolution[iColumn]; double lower = colLower[iColumn]; double upper = colUpper[iColumn]; value = CoinMax(value, lower); value = CoinMin(value, upper); if (fabs(value - floor(value + 0.5)) < 1.0e-8) { value = floor(value + 0.5); newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); numberFixed++; } } } if (numberFixed > numberIntegers / 5 - 100000000) { #ifdef COIN_DEVELOP printf("%d integers fixed\n", numberFixed); #endif returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, model_->getCutoff(), "CbcHeuristicPartial"); if (returnCode < 0) returnCode = 0; // returned on size //printf("return code %d",returnCode); if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; //printf("could add cut with %d elements (if all 0-1)\n",nFix); } else { //printf("\n"); } } fixPriority_ = -1; // switch off delete newSolver; return returnCode; } // update model void CbcHeuristicPartial::setModel(CbcModel * model) { model_ = model; assert(model_->solver()); // make sure model okay for heuristic validate(); } // Validate model i.e. sets when_ to 0 if necessary (may be NULL) void CbcHeuristicPartial::validate() { if (model_ && (when() % 100) < 10) { if (model_->numberIntegers() != model_->numberObjects()) setWhen(0); } } bool CbcHeuristicPartial::shouldHeurRun(int /*whereFrom*/) { return true; } // Default Constructor CbcSerendipity::CbcSerendipity() : CbcHeuristic() { } // Constructor from model CbcSerendipity::CbcSerendipity(CbcModel & model) : CbcHeuristic(model) { } // Destructor CbcSerendipity::~CbcSerendipity () { } // Clone CbcHeuristic * CbcSerendipity::clone() const { return new CbcSerendipity(*this); } // Create C++ lines to get to current state void CbcSerendipity::generateCpp( FILE * fp) { fprintf(fp, "0#include \"CbcHeuristic.hpp\"\n"); fprintf(fp, "3 CbcSerendipity serendipity(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "serendipity"); fprintf(fp, "3 cbcModel->addHeuristic(&serendipity);\n"); } // Copy constructor CbcSerendipity::CbcSerendipity(const CbcSerendipity & rhs) : CbcHeuristic(rhs) { } // Assignment operator CbcSerendipity & CbcSerendipity::operator=( const CbcSerendipity & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); } return *this; } // Returns 1 if solution, 0 if not int CbcSerendipity::solution(double & solutionValue, double * betterSolution) { if (!model_) return 0; #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif if (!inputSolution_) { // get information on solver type OsiAuxInfo * auxInfo = model_->solver()->getAuxiliaryInfo(); OsiBabSolver * auxiliaryInfo = dynamic_cast< OsiBabSolver *> (auxInfo); if (auxiliaryInfo) { return auxiliaryInfo->solution(solutionValue, betterSolution, model_->solver()->getNumCols()); } else { return 0; } } else { int numberColumns = model_->getNumCols(); double value = inputSolution_[numberColumns]; int returnCode = 0; if (value < solutionValue) { solutionValue = value; memcpy(betterSolution, inputSolution_, numberColumns*sizeof(double)); returnCode = 1; } delete [] inputSolution_; inputSolution_ = NULL; model_ = NULL; // switch off return returnCode; } } // update model void CbcSerendipity::setModel(CbcModel * model) { model_ = model; } // Resets stuff if model changes void CbcSerendipity::resetModel(CbcModel * model) { model_ = model; } // Default Constructor CbcHeuristicJustOne::CbcHeuristicJustOne() : CbcHeuristic(), probabilities_(NULL), heuristic_(NULL), numberHeuristics_(0) { } // Constructor from model CbcHeuristicJustOne::CbcHeuristicJustOne(CbcModel & model) : CbcHeuristic(model), probabilities_(NULL), heuristic_(NULL), numberHeuristics_(0) { } // Destructor CbcHeuristicJustOne::~CbcHeuristicJustOne () { for (int i = 0; i < numberHeuristics_; i++) delete heuristic_[i]; delete [] heuristic_; delete [] probabilities_; } // Clone CbcHeuristicJustOne * CbcHeuristicJustOne::clone() const { return new CbcHeuristicJustOne(*this); } // Create C++ lines to get to current state void CbcHeuristicJustOne::generateCpp( FILE * fp) { CbcHeuristicJustOne other; fprintf(fp, "0#include \"CbcHeuristicJustOne.hpp\"\n"); fprintf(fp, "3 CbcHeuristicJustOne heuristicJustOne(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicJustOne"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicJustOne);\n"); } // Copy constructor CbcHeuristicJustOne::CbcHeuristicJustOne(const CbcHeuristicJustOne & rhs) : CbcHeuristic(rhs), probabilities_(NULL), heuristic_(NULL), numberHeuristics_(rhs.numberHeuristics_) { if (numberHeuristics_) { probabilities_ = CoinCopyOfArray(rhs.probabilities_, numberHeuristics_); heuristic_ = new CbcHeuristic * [numberHeuristics_]; for (int i = 0; i < numberHeuristics_; i++) heuristic_[i] = rhs.heuristic_[i]->clone(); } } // Assignment operator CbcHeuristicJustOne & CbcHeuristicJustOne::operator=( const CbcHeuristicJustOne & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); for (int i = 0; i < numberHeuristics_; i++) delete heuristic_[i]; delete [] heuristic_; delete [] probabilities_; probabilities_ = NULL; heuristic_ = NULL; numberHeuristics_ = rhs.numberHeuristics_; if (numberHeuristics_) { probabilities_ = CoinCopyOfArray(rhs.probabilities_, numberHeuristics_); heuristic_ = new CbcHeuristic * [numberHeuristics_]; for (int i = 0; i < numberHeuristics_; i++) heuristic_[i] = rhs.heuristic_[i]->clone(); } } return *this; } // Sets value of solution // Returns 1 if solution, 0 if not int CbcHeuristicJustOne::solution(double & solutionValue, double * betterSolution) { #ifdef DIVE_DEBUG std::cout << "solutionValue = " << solutionValue << std::endl; #endif ++numCouldRun_; // test if the heuristic can run if (!shouldHeurRun_randomChoice() || !numberHeuristics_) return 0; double randomNumber = randomNumberGenerator_.randomDouble(); int i; for (i = 0; i < numberHeuristics_; i++) { if (randomNumber < probabilities_[i]) break; } assert (i < numberHeuristics_); int returnCode; //model_->unsetDivingHasRun(); #ifdef COIN_DEVELOP printf("JustOne running %s\n", heuristic_[i]->heuristicName()); #endif returnCode = heuristic_[i]->solution(solutionValue, betterSolution); #ifdef COIN_DEVELOP if (returnCode) printf("JustOne running %s found solution\n", heuristic_[i]->heuristicName()); #endif return returnCode; } // Resets stuff if model changes void CbcHeuristicJustOne::resetModel(CbcModel * model) { CbcHeuristic::resetModel(model); for (int i = 0; i < numberHeuristics_; i++) heuristic_[i]->resetModel(model); } // update model (This is needed if cliques update matrix etc) void CbcHeuristicJustOne::setModel(CbcModel * model) { CbcHeuristic::setModel(model); for (int i = 0; i < numberHeuristics_; i++) heuristic_[i]->setModel(model); } // Validate model i.e. sets when_ to 0 if necessary (may be NULL) void CbcHeuristicJustOne::validate() { CbcHeuristic::validate(); for (int i = 0; i < numberHeuristics_; i++) heuristic_[i]->validate(); } // Adds an heuristic with probability void CbcHeuristicJustOne::addHeuristic(const CbcHeuristic * heuristic, double probability) { CbcHeuristic * thisOne = heuristic->clone(); thisOne->setWhen(-999); CbcHeuristic ** tempH = CoinCopyOfArrayPartial(heuristic_, numberHeuristics_ + 1, numberHeuristics_); delete [] heuristic_; heuristic_ = tempH; heuristic_[numberHeuristics_] = thisOne; double * tempP = CoinCopyOfArrayPartial(probabilities_, numberHeuristics_ + 1, numberHeuristics_); delete [] probabilities_; probabilities_ = tempP; probabilities_[numberHeuristics_] = probability; numberHeuristics_++; } // Normalize probabilities void CbcHeuristicJustOne::normalizeProbabilities() { double sum = 0.0; for (int i = 0; i < numberHeuristics_; i++) sum += probabilities_[i]; double multiplier = 1.0 / sum; sum = 0.0; for (int i = 0; i < numberHeuristics_; i++) { sum += probabilities_[i]; probabilities_[i] = sum * multiplier; } assert (fabs(probabilities_[numberHeuristics_-1] - 1.0) < 1.0e-5); probabilities_[numberHeuristics_-1] = 1.000001; } CoinMP-1.8.3/Cbc/src/CbcTree.cpp0000644000175000017500000014135112433615222014612 0ustar renerene/* $Id: CbcTree.cpp 2097 2014-11-21 10:57:22Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CbcModel.hpp" #include "CbcNode.hpp" #include "CbcTree.hpp" #include "CbcThread.hpp" #include "CbcCountRowCut.hpp" #include "CbcCompareActual.hpp" #include "CbcBranchActual.hpp" #if CBC_DEBUG_HEAP > 0 namespace { /* The next few methods test that the heap property (parent equal or better than either child) is maintained in the heap. Originally created to sort out why `cbc -unitTest' triggered an `Invalid heap' error in a MSVS debug build. */ /* Predicate test. The parent should be better or equal to the child. Since the predicate comparison_(x,y) returns true if y (child) is strictly better, we want failure on the initial test. Clearly, success for comparison(x,y) and comparison(y,x) is also a failure. Returns true if the predicate passes, false if it fails. */ bool check_pred (CbcCompareBase &pred, CbcNode *parent, CbcNode *child) { if (parent == 0 || child == 0) return (false) ; if (!pred(parent,child)) return (true) ; else if (pred(child,parent)) std::cout << " Heap predicate failure! (x vector mapping assumed here is valid for the MSVS heap implementation. No guarantee it's valid elsewhere. */ void CbcTree::validateHeap () { if (comparison_.test_ == 0) { std::cout << " Invalid heap (no predicate)!" << std::endl ; return ; } std::vector::const_iterator curNode,lastNode ; curNode = nodes_.begin() ; lastNode = nodes_.end() ; int curNdx = 0 ; int parNdx = 0 ; if (curNode == lastNode) return ; if (*curNode == 0) { std::cout << " Invalid heap[" << curNdx << "] (null entry)!" << std::endl ; } std::vector::const_iterator parent ; std::vector::const_iterator &child = curNode ; for (parent = curNode ; ++curNode != lastNode ; ++parent, ++parNdx) { curNdx++ ; if (*parent == 0) { std::cout << " Invalid heap[" << parNdx << "] (parent null entry)!" << std::endl ; curNode++ ; curNdx++ ; continue ; } if (*curNode == 0) { std::cout << " Invalid heap[" << curNdx << "] (left child null entry)!" << std::endl ; } else { if (!check_pred(*comparison_.test_,*parent,*child)) { std::cout << " Invalid heap (left child better)!" << std::endl ; CbcNode *node = *parent ; std::cout << " Parent [" << parNdx << "] (" << std::hex << node << std::dec << ") unsat " << node->numberUnsatisfied() << ", depth " << node->depth() << ", obj " << node->objectiveValue() << "." << std::endl ; node = *child ; std::cout << " Child [" << curNdx << "] (" << std::hex << node << std::dec << ") unsat " << node->numberUnsatisfied() << ", depth " << node->depth() << ", obj " << node->objectiveValue() << "." << std::endl ; } } curNode++ ; curNdx++ ; if (curNode == lastNode) break ; if (*curNode == 0) { std::cout << " Invalid heap[" << curNdx << "] (right child null entry)!" << std::endl ; } else { if (!check_pred(*comparison_.test_,*parent,*child)) { std::cout << " Invalid heap (right child better)!" << std::endl ; CbcNode *node = *parent ; std::cout << " Parent [" << parNdx << "] (" << std::hex << node << std::dec << ") unsat " << node->numberUnsatisfied() << ", depth " << node->depth() << ", obj " << node->objectiveValue() << "." << std::endl ; node = *child ; std::cout << " Child [" << curNdx << "] (" << std::hex << node << std::dec << ") unsat " << node->numberUnsatisfied() << ", depth " << node->depth() << ", obj " << node->objectiveValue() << "." << std::endl ; } } } return ; } #endif // CBC_DEBUG_HEAP CbcTree::CbcTree() { maximumNodeNumber_ = 0; numberBranching_ = 0; maximumBranching_ = 0; branched_ = NULL; newBound_ = NULL; } CbcTree::~CbcTree() { delete [] branched_; delete [] newBound_; } // Copy constructor CbcTree::CbcTree ( const CbcTree & rhs) { nodes_ = rhs.nodes_; maximumNodeNumber_ = rhs.maximumNodeNumber_; numberBranching_ = rhs.numberBranching_; maximumBranching_ = rhs.maximumBranching_; if (maximumBranching_ > 0) { branched_ = CoinCopyOfArray(rhs.branched_, maximumBranching_); newBound_ = CoinCopyOfArray(rhs.newBound_, maximumBranching_); } else { branched_ = NULL; newBound_ = NULL; } } // Assignment operator CbcTree & CbcTree::operator=(const CbcTree & rhs) { if (this != &rhs) { nodes_ = rhs.nodes_; maximumNodeNumber_ = rhs.maximumNodeNumber_; delete [] branched_; delete [] newBound_; numberBranching_ = rhs.numberBranching_; maximumBranching_ = rhs.maximumBranching_; if (maximumBranching_ > 0) { branched_ = CoinCopyOfArray(rhs.branched_, maximumBranching_); newBound_ = CoinCopyOfArray(rhs.newBound_, maximumBranching_); } else { branched_ = NULL; newBound_ = NULL; } } return *this; } /* Rebuild the heap. */ void CbcTree::rebuild () { std::make_heap(nodes_.begin(), nodes_.end(), comparison_); # if CBC_DEBUG_HEAP > 1 std::cout << " HEAP: rebuild complete." << std::endl ; # endif # if CBC_DEBUG_HEAP > 0 validateHeap() ; # endif } // Adds branching information to complete state void CbcTree::addBranchingInformation(const CbcModel * model, const CbcNodeInfo * nodeInfo, const double * currentLower, const double * currentUpper) { const OsiBranchingObject * objA = nodeInfo->owner()->branchingObject(); const CbcIntegerBranchingObject * objBranch = dynamic_cast (objA); if (objBranch) { const CbcObject * objB = objBranch->object(); const CbcSimpleInteger * obj = dynamic_cast (objB); assert (obj); int iColumn = obj->columnNumber(); const double * down = objBranch->downBounds(); const double * up = objBranch->upBounds(); assert (currentLower[iColumn] == down[0]); assert (currentUpper[iColumn] == up[1]); if (dynamic_cast (nodeInfo)) { const CbcPartialNodeInfo * info = dynamic_cast (nodeInfo); const double * newBounds = info->newBounds(); const int * variables = info->variables(); int numberChanged = info->numberChangedBounds(); for (int i = 0; i < numberChanged; i++) { int jColumn = variables[i]; int kColumn = jColumn & (~0x80000000); if (iColumn == kColumn) { jColumn |= 0x40000000; #ifndef NDEBUG double value = newBounds[i]; if ((jColumn&0x80000000) == 0) { assert (value == up[0]); } else { assert (value == down[1]); } #endif } if (numberBranching_ == maximumBranching_) increaseSpace(); newBound_[numberBranching_] = static_cast (newBounds[i]); branched_[numberBranching_++] = jColumn; } } else { const CbcFullNodeInfo * info = dynamic_cast (nodeInfo); int numberIntegers = model->numberIntegers(); const int * which = model->integerVariable(); const double * newLower = info->lower(); const double * newUpper = info->upper(); if (numberBranching_ == maximumBranching_) increaseSpace(); assert (newLower[iColumn] == up[0] || newUpper[iColumn] == down[1]); int jColumn = iColumn | 0x40000000; if (newLower[iColumn] == up[0]) { newBound_[numberBranching_] = static_cast (up[0]); } else { newBound_[numberBranching_] = static_cast (down[1]); jColumn |= 0x80000000; } branched_[numberBranching_++] = jColumn; for (int i = 0; i < numberIntegers; i++) { int jColumn = which[i]; assert (currentLower[jColumn] == newLower[jColumn] || currentUpper[jColumn] == newUpper[jColumn]); if (jColumn != iColumn) { bool changed = false; double value; if (newLower[jColumn] > currentLower[jColumn]) { value = newLower[jColumn]; changed = true; } else if (newUpper[jColumn] < currentUpper[jColumn]) { value = newUpper[jColumn]; jColumn |= 0x80000000; changed = true; } if (changed) { if (numberBranching_ == maximumBranching_) increaseSpace(); newBound_[numberBranching_] = static_cast (value); branched_[numberBranching_++] = jColumn; } } } } } else { // switch off delete [] branched_; delete [] newBound_; maximumBranching_ = -1; branched_ = NULL; newBound_ = NULL; } } // Increase space for data void CbcTree::increaseSpace() { assert (numberBranching_ == maximumBranching_); maximumBranching_ = (3 * maximumBranching_ + 10) >> 1; unsigned int * temp1 = CoinCopyOfArrayPartial(branched_, maximumBranching_, numberBranching_); delete [] branched_; branched_ = temp1; int * temp2 = CoinCopyOfArrayPartial(newBound_, maximumBranching_, numberBranching_); delete [] newBound_; newBound_ = temp2; } // Clone CbcTree * CbcTree::clone() const { return new CbcTree(*this); } #ifndef CBC_DUBIOUS_HEAP /* Set comparison predicate and re-sort the heap. Note that common usage is to tweak the incumbent predicate and then call this method to rebuild the heap. Hence we cannot check for heap validity at entry. rebuild() will check on the way out, if CBC_DEBUG_HEAP is set. TODO: remove the call to cleanDive and put it somewhere appropriate. */ void CbcTree::setComparison(CbcCompareBase &compare) { # if CBC_DEBUG_HEAP > 1 std::cout << " HEAP: resetting comparison predicate." << std::endl ; # endif comparison_.test_ = &compare; /* From a software engineering point of view, setComparison has no business knowing anything about the comparison function. Need to look for a better solution. Perhaps a callback comparable to newSolution, executing when the comparison method is set (i.e., in setComparison). -- lh, 100921 -- */ CbcCompareDefault *compareD = dynamic_cast(&compare); if (compareD) { // clean up diving compareD->cleanDive(); } rebuild() ; } // Return the top node of the heap CbcNode * CbcTree::top() const { return nodes_.front(); } // Add a node to the heap void CbcTree::push(CbcNode * x) { x->setNodeNumber(maximumNodeNumber_); lastObjective_ = x->objectiveValue(); lastDepth_ = x->depth(); lastUnsatisfied_ = x->numberUnsatisfied(); maximumNodeNumber_++; # if CBC_DEBUG_HEAP > 2 CbcNodeInfo *info = x->nodeInfo() ; assert(info) ; std::cout << " HEAP: Pushing node " << x->nodeNumber() << "(" << std::hex << x << std::dec << ") obj " << x->objectiveValue() << ", ref " << info->decrement(0) << ", todo " << info->numberBranchesLeft() << ", refd by " << info->numberPointingToThis() << "." << std::endl ; assert(x->objectiveValue() != COIN_DBL_MAX); # endif # if CBC_DEBUG_HEAP > 0 validateHeap() ; # endif x->setOnTree(true); nodes_.push_back(x); std::push_heap(nodes_.begin(), nodes_.end(), comparison_); # if CBC_DEBUG_HEAP > 0 validateHeap() ; # endif } // Remove the top node from the heap void CbcTree::pop() { # if CBC_DEBUG_HEAP > 2 CbcNode *node = nodes_.front() ; CbcNodeInfo *info = node->nodeInfo() ; assert(info) ; std::cout << " HEAP: Popping node " << node->nodeNumber() << "(" << std::hex << node << std::dec << ") obj " << node->objectiveValue() << ", ref " << info->decrement(0) << ", todo " << info->numberBranchesLeft() << ", refd by " << info->numberPointingToThis() << "." << std::endl ; # endif # if CBC_DEBUG_HEAP > 0 validateHeap() ; # endif nodes_.front()->setOnTree(false); std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); # if CBC_DEBUG_HEAP > 0 validateHeap() ; # endif } // Test if empty *** note may be overridden bool CbcTree::empty() { return nodes_.empty(); } /* Return the best node from the heap. Note that best is offered a chance (checkIsCutoff) to reevaluate itself and make arbitrary changes. A caller should be prepared to check that the returned node is acceptable. There's quite a bit of suspect code here, much of it disabled in some way. The net effect at present is to return the top node on the heap after offering the node an opportunity to reevaluate itself. Documentation for checkIsCutoff() puts no restrictions on allowable changes. -- lh, 100921 -- */ CbcNode * CbcTree::bestNode(double cutoff) { # if CBC_DEBUG_HEAP > 0 validateHeap() ; # endif /* This code is problematic. As of 100921, there's really no loop. If front() == null, an assert will trigger. checkIsCutoff seems to be work in progress; comments assert that it can make pretty much arbitrary changes to best. If best can change its objective, there's a good possibility the heap is invalid. */ CbcNode * best = NULL; while (!best && nodes_.size()) { best = nodes_.front(); if (best) assert(best->objectiveValue() != COIN_DBL_MAX && best->nodeInfo()); if (best && best->objectiveValue() != COIN_DBL_MAX && best->nodeInfo()) assert (best->nodeInfo()->numberBranchesLeft()); if (best && best->objectiveValue() >= cutoff) { // double check in case node can change its mind! best->checkIsCutoff(cutoff); } if (!best || best->objectiveValue() >= cutoff) { #ifdef JJF_ZERO // take off std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); delete best; best = NULL; #else // let code get rid of it assert (best); #endif } } /* See if the comparison object wants us to do a full scan with the alternative criteria. The net effect is to confirm best by the alternative criteria, or identify a competitor and erase it. This code is problematic. Nulling an arbitrary node will in general break the heap property. Disabled some time ago, as noted in several places. */ if (false && best && comparison_.test_->fullScan()) { CbcNode * saveBest = best; size_t n = nodes_.size(); size_t iBest = -1; for (size_t i = 0; i < n; i++) { // temp assert (nodes_[i]); assert (nodes_[i]->nodeInfo()); if (nodes_[i] && nodes_[i]->objectiveValue() != COIN_DBL_MAX && nodes_[i]->nodeInfo()) assert (nodes_[i]->nodeInfo()->numberBranchesLeft()); if (nodes_[i] && nodes_[i]->objectiveValue() < cutoff && comparison_.alternateTest(best, nodes_[i])) { best = nodes_[i]; iBest = i; } } if (best == saveBest) { // can pop // take off std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); } else { // make impossible nodes_[iBest] = NULL; } } else if (best) { # if CBC_DEBUG_HEAP > 2 CbcNode *node = nodes_.front() ; CbcNodeInfo *info = node->nodeInfo() ; assert(info) ; std::cout << " bestNode: Popping node " << node->nodeNumber() << "(" << std::hex << node << std::dec << ") obj " << node->objectiveValue() << ", ref " << info->decrement(0) << ", todo " << info->numberBranchesLeft() << ", refd by " << info->numberPointingToThis() << "." << std::endl ; # endif // take off std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); } #if CBC_DEBUG_HEAP > 0 validateHeap() ; #endif if (best) best->setOnTree(false); return best; } /*! \brief Prune the tree using an objective function cutoff This routine removes all nodes with objective worse than the specified cutoff value. */ void CbcTree::cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective) { # if CBC_DEBUG_HEAP > 1 std::cout << " cleanTree: beginning clean." << std::endl ; # endif # if CBC_DEBUG_HEAP > 0 validateHeap() ; # endif int j; int nNodes = size(); CbcNode ** nodeArray = new CbcNode * [nNodes]; int * depth = new int [nNodes]; int k = 0; int kDelete = nNodes; bestPossibleObjective = 1.0e100 ; /* Destructively scan the heap. Nodes to be retained go into the front of nodeArray, nodes to be deleted into the back. Store the depth in a correlated array for nodes to be deleted. */ for (j = 0; j < nNodes; j++) { CbcNode * node = top(); pop(); double value = node ? node->objectiveValue() : COIN_DBL_MAX; if (node && value >= cutoff) { // double check in case node can change its mind! value = node->checkIsCutoff(cutoff); } if (value >= cutoff || !node->active()) { if (node) { if (cutoff<-1.0e30) node->nodeInfo()->deactivate(7); nodeArray[--kDelete] = node; depth[kDelete] = node->depth(); } } else { bestPossibleObjective = CoinMin(bestPossibleObjective, value); nodeArray[k++] = node; } } /* Rebuild the heap using the retained nodes. */ for (j = 0; j < k; j++) { push(nodeArray[j]); } # if CBC_DEBUG_HEAP > 1 std::cout << " cleanTree: finished rebuild." << std::endl ; # endif # if CBC_DEBUG_HEAP > 0 validateHeap() ; # endif /* Sort the list of nodes to be deleted, nondecreasing. */ CoinSort_2(depth + kDelete, depth + nNodes, nodeArray + kDelete); /* Work back from deepest to shallowest. In spite of the name, addCuts1 is just a preparatory step. When it returns, the following will be true: * all cuts are removed from the solver's copy of the constraint system; * lastws will be a basis appropriate for the specified node; * variable bounds will be adjusted to be appropriate for the specified node; * addedCuts_ (returned via addedCuts()) will contain a list of cuts that should be added to the constraint system at this node (but they have not actually been added). Then we scan the cut list for the node. Decrement the reference count for the cut, and if it's gone to 0, really delete it. I don't yet see why the checks for status != basic and addedCuts_[i] != 0 are necessary. When reconstructing a node, these checks are used to skip over loose cuts, excluding them from the reconstituted basis. But here we're just interested in correcting the reference count. Tight/loose should make no difference. Arguably a separate routine should be used in place of addCuts1. It's doing more work than needed, modifying the model to match a subproblem at a node that will be discarded. Then again, we seem to need the basis. */ for (j = nNodes - 1; j >= kDelete; j--) { CbcNode * node = nodeArray[j]; CoinWarmStartBasis *lastws = (cutoff!=-COIN_DBL_MAX) ? model->getEmptyBasis() : NULL; model->addCuts1(node, lastws); // Decrement cut counts assert (node); //assert (node->nodeInfo()); int numberLeft = (node->nodeInfo()) ? node->nodeInfo()->numberBranchesLeft() : 0; if (cutoff != -COIN_DBL_MAX) { // normal for (int i = 0; i < model->currentNumberCuts(); i++) { // take off node CoinWarmStartBasis::Status status = lastws->getArtifStatus(i + model->numberRowsAtContinuous()); if (status != CoinWarmStartBasis::basic && model->addedCuts()[i]) { if (!model->addedCuts()[i]->decrement(numberLeft)) delete model->addedCuts()[i]; } } } else { // quick for (int i = 0; i < model->currentNumberCuts(); i++) { // take off node if (model->addedCuts()[i]) { if (model->parallelMode()!=1||true) { if (!model->addedCuts()[i]->decrement(numberLeft)) delete model->addedCuts()[i]; } } } } #ifdef CBC_THREAD if (model->parallelMode() > 0 && model->master()) { // delete reference to node int numberThreads = model->master()->numberThreads(); for (int i=0;imaster()->child(i); if (child->createdNode()==node) child->setCreatedNode(NULL); } } #endif // node should not have anything pointing to it if (node->nodeInfo()) node->nodeInfo()->throwAway(); delete node ; delete lastws ; } delete [] nodeArray; delete [] depth; #ifdef CBC_THREAD if (model->parallelMode() > 0 && model->master()) { // need to adjust for ones not on tree CbcBaseModel * master = model->master(); int numberThreads = master->numberThreads(); for (int i=0;ichild(i); if (child->node()) { double value = child->node()->objectiveValue(); // adjust bestPossibleObjective = CoinMin(bestPossibleObjective, value); } } } #endif } // Return the best node of the heap using alternate criterion CbcNode * CbcTree::bestAlternate() { size_t n = nodes_.size(); CbcNode * best = NULL; if (n) { best = nodes_[0]; for (size_t i = 1; i < n; i++) { if (comparison_.alternateTest(best, nodes_[i])) { best = nodes_[i]; } } } return best; } #ifdef JJF_ZERO // not used, reference removed in CbcModel.cpp CbcTreeArray::CbcTreeArray() : CbcTree(), lastNode_(NULL), lastNodePopped_(NULL), switches_(0) { } CbcTreeArray::~CbcTreeArray() { } // Copy constructor CbcTreeArray::CbcTreeArray ( const CbcTreeArray & rhs) : CbcTree(rhs), lastNode_(rhs.lastNode_), lastNodePopped_(rhs.lastNodePopped_), switches_(rhs.switches_) { } // Assignment operator CbcTreeArray & CbcTreeArray::operator=(const CbcTreeArray & rhs) { if (this != &rhs) { CbcTree::operator=(rhs); lastNode_ = rhs.lastNode_; lastNodePopped_ = rhs.lastNodePopped_; switches_ = rhs.switches_; } return *this; } // Clone CbcTree * CbcTreeArray::clone() const { return new CbcTreeArray(*this); } // Set comparison function and resort heap void CbcTreeArray::setComparison(CbcCompareBase &compare) { comparison_.test_ = &compare; rebuild() ; } // Add a node to the heap void CbcTreeArray::push(CbcNode * x) { /*printf("push obj %g, refcount %d, left %d, pointing to %d\n", x->objectiveValue(),x->nodeInfo()->decrement(0), x->nodeInfo()->numberBranchesLeft(),x->nodeInfo()->numberPointingToThis());*/ assert(x->objectiveValue() != COIN_DBL_MAX && x->nodeInfo()); x->setOnTree(true); if (lastNode_) { if (lastNode_->nodeInfo()->parent() == x->nodeInfo()) { // x is parent of lastNode_ so put x on heap //#define CBCTREE_PRINT #ifdef CBCTREE_PRINT printf("pushX x %x (%x at depth %d n %d) is parent of lastNode_ %x (%x at depth %d n %d)\n", x, x->nodeInfo(), x->depth(), x->nodeNumber(), lastNode_, lastNode_->nodeInfo(), lastNode_->depth(), lastNode_->nodeNumber()); #endif nodes_.push_back(x); } else { x->setNodeNumber(maximumNodeNumber_); maximumNodeNumber_++; #ifdef CBCTREE_PRINT printf("pushLast x %x (%x at depth %d n %d) is parent of lastNode_ %x (%x at depth %d n %d)\n", x, x->nodeInfo(), x->depth(), x->nodeNumber(), lastNode_, lastNode_->nodeInfo(), lastNode_->depth(), lastNode_->nodeNumber()); #endif nodes_.push_back(lastNode_); lastNode_ = x; } std::push_heap(nodes_.begin(), nodes_.end(), comparison_); } else { x->setNodeNumber(maximumNodeNumber_); maximumNodeNumber_++; if (x != lastNodePopped_) { lastNode_ = x; #ifdef CBCTREE_PRINT printf("pushNULL x %x (%x at depth %d n %d)\n", x, x->nodeInfo(), x->depth(), x->nodeNumber()); #endif } else { // means other way was infeasible #ifdef CBCTREE_PRINT printf("push_other_infeasible x %x (%x at depth %d n %d)\n", x, x->nodeInfo(), x->depth(), x->nodeNumber()); #endif nodes_.push_back(x); std::push_heap(nodes_.begin(), nodes_.end(), comparison_); } } } // Test if empty *** note may be overridden bool CbcTreeArray::empty() { return nodes_.empty() && (lastNode_ == NULL); } // Gets best node and takes off heap CbcNode * CbcTreeArray::bestNode(double cutoff) { CbcNode * best = NULL; // See if we want last node or best on heap if (lastNode_) { #ifdef CBCTREE_PRINT printf("Best lastNode_ %x (%x at depth %d) - nodeNumber %d obj %g\n", lastNode_, lastNode_->nodeInfo(), lastNode_->depth(), lastNode_->nodeNumber(), lastNode_->objectiveValue()); #endif assert (lastNode_->onTree()); int nodeNumber = lastNode_->nodeNumber(); bool useLastNode = false; if (nodeNumber + 1 == maximumNodeNumber_) { // diving - look further CbcCompareDefault * compareDefault = dynamic_cast (comparison_.test_); assert (compareDefault); double bestPossible = compareDefault->getBestPossible(); double cutoff = compareDefault->getCutoff(); double objValue = lastNode_->objectiveValue(); if (cutoff < 1.0e20) { if (objValue - bestPossible < 0.999*(cutoff - bestPossible)) useLastNode = true; } else { useLastNode = true; } } if (useLastNode) { lastNode_->setOnTree(false); best = lastNode_; lastNode_ = NULL; assert(best->objectiveValue() != COIN_DBL_MAX && best->nodeInfo()); if (best->objectiveValue() != COIN_DBL_MAX && best->nodeInfo()) assert (best->nodeInfo()->numberBranchesLeft()); if (best->objectiveValue() >= cutoff) { // double check in case node can change its mind! best->checkIsCutoff(cutoff); } lastNodePopped_ = best; return best; } else { // put on tree nodes_.push_back(lastNode_); lastNode_->setNodeNumber(maximumNodeNumber_); maximumNodeNumber_++; lastNode_ = NULL; std::push_heap(nodes_.begin(), nodes_.end(), comparison_); } } while (!best && nodes_.size()) { best = nodes_.front(); if (best) assert(best->objectiveValue() != COIN_DBL_MAX && best->nodeInfo()); if (best && best->objectiveValue() != COIN_DBL_MAX && best->nodeInfo()) assert (best->nodeInfo()->numberBranchesLeft()); if (best && best->objectiveValue() >= cutoff) { // double check in case node can change its mind! best->checkIsCutoff(cutoff); } if (!best || best->objectiveValue() >= cutoff) { // let code get rid of it assert (best); } } lastNodePopped_ = best; #ifdef CBCTREE_PRINT if (best) printf("Heap returning node %x (%x at depth %d) - nodeNumber %d - obj %g\n", best, best->nodeInfo(), best->depth(), best->nodeNumber(), best->objectiveValue()); else printf("Heap returning Null\n"); #endif if (best) { // take off std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); } #ifdef DEBUG_CBC_HEAP if (best) { int n = nodes_.size(); bool good = true; for (int i = 0; i < n; i++) { // temp assert (nodes_[i]); if (!comparison_.compareNodes(nodes_[i], best)) { good = false; CbcNode * x = nodes_[i]; printf("i=%d x is better nun %d depth %d obj %g, best nun %d depth %d obj %g\n", i, x->numberUnsatisfied(), x->depth(), x->objectiveValue(), best->numberUnsatisfied(), best->depth(), best->objectiveValue()); } } if (!good) { // compare best to all int i; for (i = 0; i < n; i++) { CbcNode * x = nodes_[i]; printf("i=%d x is nun %d depth %d obj %g", i, x->numberUnsatisfied(), x->depth(), x->objectiveValue()); if (!comparison_.compareNodes(x, best)) { printf(" - best is worse!\n"); } else { printf("\n"); } } // Now compare amongst rest for (i = 0; i < n; i++) { CbcNode * x = nodes_[i]; printf("For i=%d ", i); for (int j = i + 1; j < n; j++) { CbcNode * y = nodes_[j]; if (!comparison_.compareNodes(x, y)) { printf(" b %d", j); } else { printf(" w %d", j); } } printf("\n"); } assert(good); } } #endif if (best) best->setOnTree(false); return best; } double CbcTreeArray::getBestPossibleObjective() { double bestPossibleObjective = 1e100; for (int i = 0 ; i < static_cast (nodes_.size()) ; i++) { if (nodes_[i] && nodes_[i]->objectiveValue() < bestPossibleObjective) { bestPossibleObjective = nodes_[i]->objectiveValue(); } } if (lastNode_) { bestPossibleObjective = CoinMin(bestPossibleObjective, lastNode_->objectiveValue()); } #ifdef CBC_THREAD if (model->parallelMode() > 0 && model->master()) { // need to adjust for ones not on tree CbcBaseModel * master = model->master(); int numberThreads = master->numberThreads(); for (int i=0;ichild(i); if (child->node()) { double value = child->node()->objectiveValue(); // adjust bestPossibleObjective = CoinMin(bestPossibleObjective, value); } } } #endif CbcCompareDefault * compareDefault = dynamic_cast (comparison_.test_); assert (compareDefault); compareDefault->setBestPossible(bestPossibleObjective); return bestPossibleObjective; } /*! \brief Prune the tree using an objective function cutoff This routine removes all nodes with objective worst than the specified cutoff value. */ void CbcTreeArray::cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective) { int j; int nNodes = size(); int lastNode = nNodes + 1; CbcNode ** nodeArray = new CbcNode * [lastNode]; int * depth = new int [lastNode]; int k = 0; int kDelete = lastNode; bestPossibleObjective = 1.0e100 ; /* Destructively scan the heap. Nodes to be retained go into the front of nodeArray, nodes to be deleted into the back. Store the depth in a correlated array for nodes to be deleted. */ for (j = 0; j < nNodes; j++) { CbcNode * node = nodes_.front(); nodes_.front()->setOnTree(false); std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); double value = node ? node->objectiveValue() : COIN_DBL_MAX; if (node && value >= cutoff) { // double check in case node can change its mind! value = node->checkIsCutoff(cutoff); } if (value >= cutoff || !node->active()) { if (node) { nodeArray[--kDelete] = node; depth[kDelete] = node->depth(); } } else { bestPossibleObjective = CoinMin(bestPossibleObjective, value); nodeArray[k++] = node; } } #ifdef CBC_THREAD if (model->parallelMode() > 0 && model->master()) { // need to adjust for ones not on tree CbcBaseModel * master = model->master(); int numberThreads = master->numberThreads(); for (int i=0;ichild(i); if (child->node()) { double value = child->node()->objectiveValue(); // adjust bestPossibleObjective = CoinMin(bestPossibleObjective, value); } } } #endif if (lastNode_) { double value = lastNode_->objectiveValue(); bestPossibleObjective = CoinMin(bestPossibleObjective, value); if (value >= cutoff || !lastNode_->active()) { nodeArray[--kDelete] = lastNode_; depth[kDelete] = lastNode_->depth(); lastNode_ = NULL; } } CbcCompareDefault * compareDefault = dynamic_cast (comparison_.test_); assert (compareDefault); compareDefault->setBestPossible(bestPossibleObjective); compareDefault->setCutoff(cutoff); /* Rebuild the heap using the retained nodes. */ for (j = 0; j < k; j++) { CbcNode * node = nodeArray[j]; node->setOnTree(true); nodes_.push_back(node); std::push_heap(nodes_.begin(), nodes_.end(), comparison_); } /* Sort the list of nodes to be deleted, nondecreasing. */ CoinSort_2(depth + kDelete, depth + lastNode, nodeArray + kDelete); /* Work back from deepest to shallowest. In spite of the name, addCuts1 is just a preparatory step. When it returns, the following will be true: * all cuts are removed from the solver's copy of the constraint system; * lastws will be a basis appropriate for the specified node; * variable bounds will be adjusted to be appropriate for the specified node; * addedCuts_ (returned via addedCuts()) will contain a list of cuts that should be added to the constraint system at this node (but they have not actually been added). Then we scan the cut list for the node. Decrement the reference count for the cut, and if it's gone to 0, really delete it. I don't yet see why the checks for status != basic and addedCuts_[i] != 0 are necessary. When reconstructing a node, these checks are used to skip over loose cuts, excluding them from the reconstituted basis. But here we're just interested in correcting the reference count. Tight/loose should make no difference. Arguably a separate routine should be used in place of addCuts1. It's doing more work than needed, modifying the model to match a subproblem at a node that will be discarded. Then again, we seem to need the basis. */ for (j = lastNode - 1; j >= kDelete; j--) { CbcNode * node = nodeArray[j]; CoinWarmStartBasis *lastws = model->getEmptyBasis() ; model->addCuts1(node, lastws); // Decrement cut counts assert (node); //assert (node->nodeInfo()); int numberLeft = (node->nodeInfo()) ? node->nodeInfo()->numberBranchesLeft() : 0; int i; for (i = 0; i < model->currentNumberCuts(); i++) { // take off node CoinWarmStartBasis::Status status = lastws->getArtifStatus(i + model->numberRowsAtContinuous()); if (status != CoinWarmStartBasis::basic && model->addedCuts()[i]) { if (!model->addedCuts()[i]->decrement(numberLeft)) delete model->addedCuts()[i]; } } // node should not have anything pointing to it if (node->nodeInfo()) node->nodeInfo()->throwAway(); delete node ; delete lastws ; } delete [] nodeArray; delete [] depth; } #endif #else // defined(CBC_DUBIOUS_HEAP) /* Unclear whether this code is useful any longer. Likely stale. See note in CbcCompareDefault.hpp re. CBC_DUBIOUS_HEAP. -- lh, 100921 -- */ // Set comparison function and resort heap void CbcTree::setComparison(CbcCompareBase &compare) { comparison_.test_ = &compare; std::vector newNodes = nodes_; nodes_.resize(0); while (newNodes.size() > 0) { push( newNodes.back()); newNodes.pop_back(); } } // Return the top node of the heap CbcNode * CbcTree::top() const { return nodes_.front(); } // Add a node to the heap void CbcTree::push(CbcNode * x) { x->setNodeNumber(maximumNodeNumber_); maximumNodeNumber_++; /*printf("push obj %g, refcount %d, left %d, pointing to %d\n", x->objectiveValue(),x->nodeInfo()->decrement(0), x->nodeInfo()->numberBranchesLeft(),x->nodeInfo()->numberPointingToThis());*/ assert(x->objectiveValue() != COIN_DBL_MAX && x->nodeInfo()); #ifdef JJF_ZERO nodes_.push_back(x); push_heap(nodes_.begin(), nodes_.end(), comparison_); #else realpush(x); #endif } // Remove the top node from the heap void CbcTree::pop() { #ifdef JJF_ZERO std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); #else if (nodes_.size()) { //CbcNode* s = nodes_.front(); realpop(); //delete s; } assert (nodes_.size() >= 0); #endif } // Test if empty *** note may be overridden bool CbcTree::empty() { return nodes_.empty(); } // Gets best node and takes off heap CbcNode * CbcTree::bestNode(double cutoff) { CbcNode * best = NULL; while (!best && nodes_.size()) { best = nodes_.front(); if (best) assert(best->objectiveValue() != COIN_DBL_MAX && best->nodeInfo()); if (best && best->objectiveValue() != COIN_DBL_MAX && best->nodeInfo()) assert (best->nodeInfo()->numberBranchesLeft()); if (best && best->objectiveValue() >= cutoff) { // double check in case node can change its mind! best->checkIsCutoff(cutoff); } if (!best || best->objectiveValue() >= cutoff) { #ifdef JJF_ZERO // take off std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); delete best; best = NULL; #else // let code get rid of it assert (best); #endif } } // switched off for now if (best && comparison_.test_->fullScan() && false) { CbcNode * saveBest = best; int n = nodes_.size(); int iBest = -1; for (int i = 0; i < n; i++) { // temp assert (nodes_[i]); assert (nodes_[i]->nodeInfo()); if (nodes_[i] && nodes_[i]->objectiveValue() != COIN_DBL_MAX && nodes_[i]->nodeInfo()) assert (nodes_[i]->nodeInfo()->numberBranchesLeft()); if (nodes_[i] && nodes_[i]->objectiveValue() < cutoff && comparison_.alternateTest(best, nodes_[i])) { best = nodes_[i]; iBest = i; } } if (best == saveBest) { // can pop // take off std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); } else { // make impossible nodes_[iBest] = NULL; } } else if (best) { // take off #ifdef JJF_ZERO std::pop_heap(nodes_.begin(), nodes_.end(), comparison_); nodes_.pop_back(); #else realpop(); #endif } #ifdef DEBUG_CBC_HEAP if (best) { int n = nodes_.size(); bool good = true; for (int i = 0; i < n; i++) { // temp assert (nodes_[i]); if (!comparison_.compareNodes(nodes_[i], best)) { good = false; CbcNode * x = nodes_[i]; printf("i=%d x is better nun %d depth %d obj %g, best nun %d depth %d obj %g\n", i, x->numberUnsatisfied(), x->depth(), x->objectiveValue(), best->numberUnsatisfied(), best->depth(), best->objectiveValue()); } } if (!good) { // compare best to all int i; for (i = 0; i < n; i++) { CbcNode * x = nodes_[i]; printf("i=%d x is nun %d depth %d obj %g", i, x->numberUnsatisfied(), x->depth(), x->objectiveValue()); if (!comparison_.compareNodes(x, best)) { printf(" - best is worse!\n"); } else { printf("\n"); } } // Now compare amongst rest for (i = 0; i < n; i++) { CbcNode * x = nodes_[i]; printf("For i=%d ", i); for (int j = i + 1; j < n; j++) { CbcNode * y = nodes_[j]; if (!comparison_.compareNodes(x, y)) { printf(" b %d", j); } else { printf(" w %d", j); } } printf("\n"); } assert(good); } } #endif if (best) best->setOnTree(false); return best; } /*! \brief Prune the tree using an objective function cutoff This routine removes all nodes with objective worst than the specified cutoff value. */ void CbcTree::cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective) { int j; int nNodes = nodes_.size(); CbcNode ** nodeArray = new CbcNode * [nNodes]; int * depth = new int [nNodes]; int k = 0; int kDelete = nNodes; bestPossibleObjective = 1.0e100 ; /* Destructively scan the heap. Nodes to be retained go into the front of nodeArray, nodes to be deleted into the back. Store the depth in a correlated array for nodes to be deleted. */ for (j = 0; j < nNodes; j++) { CbcNode * node = top(); pop(); double value = node ? node->objectiveValue() : COIN_DBL_MAX; if (node && value >= cutoff) { // double check in case node can change its mind! value = node->checkIsCutoff(cutoff); } bestPossibleObjective = CoinMin(bestPossibleObjective, value); if (value >= cutoff) { if (node) { nodeArray[--kDelete] = node; depth[kDelete] = node->depth(); } } else { nodeArray[k++] = node; } } #ifdef CBC_THREAD if (model->parallelMode() > 0 && model->master()) { // need to adjust for ones not on tree CbcBaseModel * master = model->master(); int numberThreads = master->numberThreads(); for (int i=0;ichild(i); if (child->node()) { double value = child->node()->objectiveValue(); // adjust bestPossibleObjective = CoinMin(bestPossibleObjective, value); } } } #endif /* Rebuild the heap using the retained nodes. */ for (j = 0; j < k; j++) { push(nodeArray[j]); } /* Sort the list of nodes to be deleted, nondecreasing. */ CoinSort_2(depth + kDelete, depth + nNodes, nodeArray + kDelete); /* Work back from deepest to shallowest. In spite of the name, addCuts1 is just a preparatory step. When it returns, the following will be true: * all cuts are removed from the solver's copy of the constraint system; * lastws will be a basis appropriate for the specified node; * variable bounds will be adjusted to be appropriate for the specified node; * addedCuts_ (returned via addedCuts()) will contain a list of cuts that should be added to the constraint system at this node (but they have not actually been added). Then we scan the cut list for the node. Decrement the reference count for the cut, and if it's gone to 0, really delete it. I don't yet see why the checks for status != basic and addedCuts_[i] != 0 are necessary. When reconstructing a node, these checks are used to skip over loose cuts, excluding them from the reconstituted basis. But here we're just interested in correcting the reference count. Tight/loose should make no difference. Arguably a separate routine should be used in place of addCuts1. It's doing more work than needed, modifying the model to match a subproblem at a node that will be discarded. Then again, we seem to need the basis. */ for (j = nNodes - 1; j >= kDelete; j--) { CbcNode * node = nodeArray[j]; CoinWarmStartBasis *lastws = model->getEmptyBasis() ; model->addCuts1(node, lastws); // Decrement cut counts assert (node); //assert (node->nodeInfo()); int numberLeft = (node->nodeInfo()) ? node->nodeInfo()->numberBranchesLeft() : 0; int i; for (i = 0; i < model->currentNumberCuts(); i++) { // take off node CoinWarmStartBasis::Status status = lastws->getArtifStatus(i + model->numberRowsAtContinuous()); if (status != CoinWarmStartBasis::basic && model->addedCuts()[i]) { if (!model->addedCuts()[i]->decrement(numberLeft)) delete model->addedCuts()[i]; } } // node should not have anything pointing to it if (node->nodeInfo()) node->nodeInfo()->throwAway(); delete node ; delete lastws ; } delete [] nodeArray; delete [] depth; } // Return the best node of the heap using alternate criterion CbcNode * CbcTree::bestAlternate() { int n = nodes_.size(); CbcNode * best = NULL; if (n) { best = nodes_[0]; for (int i = 1; i < n; i++) { if (comparison_.alternateTest(best, nodes_[i])) { best = nodes_[i]; } } } return best; } void CbcTree::realpop() { if (nodes_.size() > 0) { nodes_[0] = nodes_.back(); nodes_.pop_back(); fixTop(); } assert (nodes_.size() >= 0); } /* After changing data in the top node, fix the heap */ void CbcTree::fixTop() { const int size = nodes_.size(); if (size > 1) { CbcNode** candidates = &nodes_[0]; CbcNode* s = candidates[0]; --candidates; int pos = 1; int ch; for (ch = 2; ch < size; pos = ch, ch *= 2) { if (!comparison_.compareNodes(candidates[ch+1], candidates[ch])) ++ch; if (!comparison_.compareNodes(s, candidates[ch])) break; candidates[pos] = candidates[ch]; } if (ch == size) { if (!comparison_.compareNodes(candidates[ch], s)) { candidates[pos] = candidates[ch]; pos = ch; } } candidates[pos] = s; } } void CbcTree::realpush(CbcNode * node) { node->setOnTree(true); nodes_.push_back(node); CbcNode** candidates = &nodes_[0]; --candidates; int pos = nodes_.size(); int ch; for (ch = pos / 2; ch != 0; pos = ch, ch /= 2) { if (!comparison_.compareNodes(candidates[ch], node)) break; candidates[pos] = candidates[ch]; } candidates[pos] = node; } #endif double CbcTree::getBestPossibleObjective() { double r_val = 1e100; for (int i = 0 ; i < static_cast (nodes_.size()) ; i++) { if (nodes_[i] && nodes_[i]->objectiveValue() < r_val) { r_val = nodes_[i]->objectiveValue(); } } return r_val; } CoinMP-1.8.3/Cbc/src/CbcSubProblem.hpp0000644000175000017500000000432012131054770015764 0ustar renerene// $Id: CbcSubProblem.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #ifndef CbcSubProblem_H #define CbcSubProblem_H #ifdef COIN_HAS_CLP #include "ClpSimplex.hpp" #include "ClpNode.hpp" /** Defines a general subproblem Basis will be made more compact later */ class CoinWarmStartDiff; class CbcSubProblem { public: /// Default constructor CbcSubProblem (); /// Constructor from model CbcSubProblem (const OsiSolverInterface * solver, const double * lowerBefore, const double * upperBefore, const unsigned char * status, int depth); /// Copy constructor CbcSubProblem ( const CbcSubProblem &); /// Assignment operator CbcSubProblem & operator= (const CbcSubProblem& rhs); /// Destructor virtual ~CbcSubProblem (); /// Take over void takeOver ( CbcSubProblem &, bool cleanup); /// Apply subproblem (1=bounds, 2=basis, 3=both) void apply(OsiSolverInterface * model, int what = 3) const; public: /// Value of objective double objectiveValue_; /// Sum of infeasibilities double sumInfeasibilities_; /// Branch value double branchValue_; /// Dj on branching variable at end double djValue_; /** Which variable (top bit if upper bound changing) next bit if changing on down branch only */ int * variables_; /// New bound double * newBounds_; /// Status mutable CoinWarmStartBasis * status_; /// Depth int depth_; /// Number of Extra bound changes int numberChangedBounds_; /// Number of infeasibilities int numberInfeasibilities_; /** Status 1 bit going up on first, 2 bit set first branch infeasible on second, 4 bit redundant branch, bits after 256 give reason for stopping (just last node) 0 - solution 1 - infeasible 2 - maximum depth >2 - error or max time or something */ int problemStatus_; /// Variable branched on int branchVariable_; }; #endif //COIN_HAS_CLP #endif CoinMP-1.8.3/Cbc/src/CbcFollowOn.cpp0000644000175000017500000006312312131054770015452 0ustar renerene// $Id: CbcFollowOn.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcFollowOn.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchCut.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## // Default Constructor CbcFollowOn::CbcFollowOn () : CbcObject(), rhs_(NULL) { } // Useful constructor CbcFollowOn::CbcFollowOn (CbcModel * model) : CbcObject(model) { assert (model); OsiSolverInterface * solver = model_->solver(); matrix_ = *solver->getMatrixByCol(); matrix_.removeGaps(); matrix_.setExtraGap(0.0); matrixByRow_ = *solver->getMatrixByRow(); int numberRows = matrix_.getNumRows(); rhs_ = new int[numberRows]; int i; const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); for (i = 0; i < numberRows; i++) { rhs_[i] = 0; double value = rowLower[i]; if (value == rowUpper[i]) { if (floor(value) == value && value >= 1.0 && value < 10.0) { // check elements bool good = true; for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (!solver->isBinary(iColumn)) good = false; double elValue = elementByRow[j]; if (floor(elValue) != elValue || value < 1.0) good = false; } if (good) rhs_[i] = static_cast (value); } } } } // Copy constructor CbcFollowOn::CbcFollowOn ( const CbcFollowOn & rhs) : CbcObject(rhs), matrix_(rhs.matrix_), matrixByRow_(rhs.matrixByRow_) { int numberRows = matrix_.getNumRows(); rhs_ = CoinCopyOfArray(rhs.rhs_, numberRows); } // Clone CbcObject * CbcFollowOn::clone() const { return new CbcFollowOn(*this); } // Assignment operator CbcFollowOn & CbcFollowOn::operator=( const CbcFollowOn & rhs) { if (this != &rhs) { CbcObject::operator=(rhs); delete [] rhs_; matrix_ = rhs.matrix_; matrixByRow_ = rhs.matrixByRow_; int numberRows = matrix_.getNumRows(); rhs_ = CoinCopyOfArray(rhs.rhs_, numberRows); } return *this; } // Destructor CbcFollowOn::~CbcFollowOn () { delete [] rhs_; } // As some computation is needed in more than one place - returns row int CbcFollowOn::gutsOfFollowOn(int & otherRow, int & preferredWay) const { int whichRow = -1; otherRow = -1; int numberRows = matrix_.getNumRows(); int i; // For sorting int * sort = new int [numberRows]; int * isort = new int [numberRows]; // Column copy //const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); const double * solution = solver->getColSolution(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); int nSort = 0; for (i = 0; i < numberRows; i++) { if (rhs_[i]) { // check elements double smallest = 1.0e10; double largest = 0.0; int rhsValue = rhs_[i]; int number1 = 0; int numberUnsatisfied = 0; for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; double value = elementByRow[j]; double solValue = solution[iColumn]; if (columnLower[iColumn] != columnUpper[iColumn]) { smallest = CoinMin(smallest, value); largest = CoinMax(largest, value); if (value == 1.0) number1++; if (solValue < 1.0 - integerTolerance && solValue > integerTolerance) numberUnsatisfied++; } else { rhsValue -= static_cast(value * floor(solValue + 0.5)); } } if (numberUnsatisfied > 1) { if (smallest < largest) { // probably no good but check a few things assert (largest <= rhsValue); if (number1 == 1 && largest == rhsValue) printf("could fix\n"); } else if (largest == rhsValue) { sort[nSort] = i; isort[nSort++] = -numberUnsatisfied; } } } } if (nSort > 1) { CoinSort_2(isort, isort + nSort, sort); CoinZeroN(isort, numberRows); double * other = new double[numberRows]; CoinZeroN(other, numberRows); int * which = new int[numberRows]; //#define COUNT #ifndef COUNT bool beforeSolution = model_->getSolutionCount() == 0; #endif for (int k = 0; k < nSort - 1; k++) { i = sort[k]; int numberUnsatisfied = 0; int n = 0; int j; for (j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (columnLower[iColumn] != columnUpper[iColumn]) { double solValue = solution[iColumn] - columnLower[iColumn]; if (solValue < 1.0 - integerTolerance && solValue > integerTolerance) { numberUnsatisfied++; for (int jj = columnStart[iColumn]; jj < columnStart[iColumn] + columnLength[iColumn]; jj++) { int iRow = row[jj]; if (rhs_[iRow]) { other[iRow] += solValue; if (isort[iRow]) { isort[iRow]++; } else { isort[iRow] = 1; which[n++] = iRow; } } } } } } double total = 0.0; // Take out row double sumThis = other[i]; other[i] = 0.0; assert (numberUnsatisfied == isort[i]); // find one nearest half if solution, one if before solution int iBest = -1; double dtarget = 0.5 * total; #ifdef COUNT int target = (numberUnsatisfied + 1) >> 1; int best = numberUnsatisfied; #else double best; if (beforeSolution) best = dtarget; else best = 1.0e30; #endif for (j = 0; j < n; j++) { int iRow = which[j]; double dvalue = other[iRow]; other[iRow] = 0.0; #ifdef COUNT int value = isort[iRow]; #endif isort[iRow] = 0; if (fabs(dvalue) < 1.0e-8 || fabs(sumThis - dvalue) < 1.0e-8) continue; if (dvalue < integerTolerance || dvalue > 1.0 - integerTolerance) continue; #ifdef COUNT if (abs(value - target) < best && value != numberUnsatisfied) { best = abs(value - target); iBest = iRow; if (dvalue < dtarget) preferredWay = 1; else preferredWay = -1; } #else if (beforeSolution) { if (fabs(dvalue - dtarget) > best) { best = fabs(dvalue - dtarget); iBest = iRow; if (dvalue < dtarget) preferredWay = 1; else preferredWay = -1; } } else { if (fabs(dvalue - dtarget) < best) { best = fabs(dvalue - dtarget); iBest = iRow; if (dvalue < dtarget) preferredWay = 1; else preferredWay = -1; } } #endif } if (iBest >= 0) { whichRow = i; otherRow = iBest; break; } } delete [] which; delete [] other; } delete [] sort; delete [] isort; return whichRow; } double CbcFollowOn::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { int otherRow = 0; int whichRow = gutsOfFollowOn(otherRow, preferredWay); if (whichRow < 0) return 0.0; else return 2.0* model_->getDblParam(CbcModel::CbcIntegerTolerance); } // This looks at solution and sets bounds to contain solution void CbcFollowOn::feasibleRegion() { } CbcBranchingObject * CbcFollowOn::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * /*info*/, int way) { int otherRow = 0; int preferredWay; int whichRow = gutsOfFollowOn(otherRow, preferredWay); assert(way == preferredWay); assert (whichRow >= 0); int numberColumns = matrix_.getNumCols(); // Column copy //const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Row copy //const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); //OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); //const double * solution = solver->getColSolution(); int nUp = 0; int nDown = 0; int * upList = new int[numberColumns]; int * downList = new int[numberColumns]; int j; for (j = rowStart[whichRow]; j < rowStart[whichRow] + rowLength[whichRow]; j++) { int iColumn = column[j]; if (columnLower[iColumn] != columnUpper[iColumn]) { bool up = true; for (int jj = columnStart[iColumn]; jj < columnStart[iColumn] + columnLength[iColumn]; jj++) { int iRow = row[jj]; if (iRow == otherRow) { up = false; break; } } if (up) upList[nUp++] = iColumn; else downList[nDown++] = iColumn; } } //printf("way %d\n",way); // create object //printf("would fix %d down and %d up\n",nDown,nUp); CbcBranchingObject * branch = new CbcFixingBranchingObject(model_, way, nDown, downList, nUp, upList); delete [] upList; delete [] downList; return branch; } //############################################################################## // Default Constructor CbcFixingBranchingObject::CbcFixingBranchingObject() : CbcBranchingObject() { numberDown_ = 0; numberUp_ = 0; downList_ = NULL; upList_ = NULL; } // Useful constructor CbcFixingBranchingObject::CbcFixingBranchingObject (CbcModel * model, int way , int numberOnDownSide, const int * down, int numberOnUpSide, const int * up) : CbcBranchingObject(model, 0, way, 0.5) { numberDown_ = numberOnDownSide; numberUp_ = numberOnUpSide; downList_ = CoinCopyOfArray(down, numberDown_); upList_ = CoinCopyOfArray(up, numberUp_); } // Copy constructor CbcFixingBranchingObject::CbcFixingBranchingObject ( const CbcFixingBranchingObject & rhs) : CbcBranchingObject(rhs) { numberDown_ = rhs.numberDown_; numberUp_ = rhs.numberUp_; downList_ = CoinCopyOfArray(rhs.downList_, numberDown_); upList_ = CoinCopyOfArray(rhs.upList_, numberUp_); } // Assignment operator CbcFixingBranchingObject & CbcFixingBranchingObject::operator=( const CbcFixingBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); delete [] downList_; delete [] upList_; numberDown_ = rhs.numberDown_; numberUp_ = rhs.numberUp_; downList_ = CoinCopyOfArray(rhs.downList_, numberDown_); upList_ = CoinCopyOfArray(rhs.upList_, numberUp_); } return *this; } CbcBranchingObject * CbcFixingBranchingObject::clone() const { return (new CbcFixingBranchingObject(*this)); } // Destructor CbcFixingBranchingObject::~CbcFixingBranchingObject () { delete [] downList_; delete [] upList_; } double CbcFixingBranchingObject::branch() { decrementNumberBranchesLeft(); OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); int i; // *** for way - up means fix all those in up section if (way_ < 0) { #ifdef FULL_PRINT printf("Down Fix "); #endif //printf("Down Fix %d\n",numberDown_); for (i = 0; i < numberDown_; i++) { int iColumn = downList_[i]; model_->solver()->setColUpper(iColumn, columnLower[iColumn]); #ifdef FULL_PRINT printf("Setting bound on %d to lower bound\n", iColumn); #endif } way_ = 1; // Swap direction } else { #ifdef FULL_PRINT printf("Up Fix "); #endif //printf("Up Fix %d\n",numberUp_); for (i = 0; i < numberUp_; i++) { int iColumn = upList_[i]; model_->solver()->setColUpper(iColumn, columnLower[iColumn]); #ifdef FULL_PRINT printf("Setting bound on %d to lower bound\n", iColumn); #endif } way_ = -1; // Swap direction } #ifdef FULL_PRINT printf("\n"); #endif return 0.0; } void CbcFixingBranchingObject::print() { int i; // *** for way - up means fix all those in up section if (way_ < 0) { printf("Down Fix "); for (i = 0; i < numberDown_; i++) { int iColumn = downList_[i]; printf("%d ", iColumn); } } else { printf("Up Fix "); for (i = 0; i < numberUp_; i++) { int iColumn = upList_[i]; printf("%d ", iColumn); } } printf("\n"); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcFixingBranchingObject::compareOriginalObject (const CbcBranchingObject* /*brObj*/) const { throw("must implement"); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcFixingBranchingObject::compareBranchingObject (const CbcBranchingObject* /*brObj*/, const bool /*replaceIfOverlap*/) { #ifdef JJF_ZERO //ndef NDEBUG const CbcFixingBranchingObject* br = dynamic_cast(brObj); assert(br); #endif // If two FixingBranchingObject's have the same base object then it's pretty // much guaranteed throw("must implement"); } //############################################################################## //############################################################################## // Default Constructor CbcIdiotBranch::CbcIdiotBranch () : CbcObject() { id_ = 1000000000 + CutBranchingObj; } // Useful constructor CbcIdiotBranch::CbcIdiotBranch (CbcModel * model) : CbcObject(model) { assert (model); id_ = 1000000000 + CutBranchingObj; } // Copy constructor CbcIdiotBranch::CbcIdiotBranch ( const CbcIdiotBranch & rhs) : CbcObject(rhs), randomNumberGenerator_(rhs.randomNumberGenerator_), savedRandomNumberGenerator_(rhs.savedRandomNumberGenerator_) { } // Clone CbcObject * CbcIdiotBranch::clone() const { return new CbcIdiotBranch(*this); } // Assignment operator CbcIdiotBranch & CbcIdiotBranch::operator=( const CbcIdiotBranch & rhs) { if (this != &rhs) { CbcObject::operator=(rhs); randomNumberGenerator_ = rhs.randomNumberGenerator_; savedRandomNumberGenerator_ = rhs.savedRandomNumberGenerator_; } return *this; } // Destructor CbcIdiotBranch::~CbcIdiotBranch () { } double CbcIdiotBranch::infeasibility(const OsiBranchingInformation * info, int &preferredWay) const { randomNumberGenerator_ = savedRandomNumberGenerator_; double rhs = buildCut(info,0,preferredWay).ub(); double fraction = rhs-floor(rhs); if (fraction>0.5) fraction=1.0-fraction; return fraction; } // This looks at solution and sets bounds to contain solution void CbcIdiotBranch::feasibleRegion() { } CbcBranchingObject * CbcIdiotBranch::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) { // down and up randomNumberGenerator_ = savedRandomNumberGenerator_; int preferredWay; OsiRowCut downCut = buildCut(info,0,preferredWay); double rhs = downCut.ub(); assert(rhs == downCut.lb()); OsiRowCut upCut =downCut; downCut.setUb(floor(rhs)); downCut.setLb(-COIN_DBL_MAX); upCut.setLb(ceil(rhs)); upCut.setUb(COIN_DBL_MAX); CbcBranchingObject * branch = new CbcCutBranchingObject(model_, downCut,upCut,true); return branch; } // Initialize for branching void CbcIdiotBranch::initializeForBranching(CbcModel * ) { savedRandomNumberGenerator_ = randomNumberGenerator_; } // Build "cut" OsiRowCut CbcIdiotBranch::buildCut(const OsiBranchingInformation * info,int /*type*/,int & preferredWay) const { int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int * which = new int [numberIntegers]; double * away = new double [numberIntegers]; const double * solution = info->solution_; const double * lower = info->lower_; const double * upper = info->upper_; double integerTolerance = model_->getIntegerTolerance(); //int nMax=CoinMin(4,numberIntegers/2); int n=0; for (int i=0;iintegerTolerance) { double random = 0.0; //0.25*randomNumberGenerator_.randomDouble(); away[n]=-fabs(value-nearest)*(1.0+random); which[n++]=iColumn; } #else double distanceDown = value-floor(value); if (distanceDown>10.0*integerTolerance&&distanceDown<0.1) { double random = 0.0; //0.25*randomNumberGenerator_.randomDouble(); away[n]=distanceDown*(1.0+random); which[n++]=iColumn; } #endif } CoinSort_2(away,away+n,which); OsiRowCut possibleCut; possibleCut.setUb(0.0); if (n>1) { int nUse=0; double useRhs=0.0; double best=0.0; double rhs = 0.0; double scaleFactor=1.0; /* should be able to be clever to find best cut maybe don't do if away >0.45 maybe don't be random maybe do complete enumeration on biggest k (where sum of k >= 1.0) maybe allow +-1 */ for (int i=0;ibest) { nUse=i+1; best=distance; useRhs=rhs; } } // create cut if (nUse>1) { possibleCut.setRow(nUse,which,away); possibleCut.setLb(useRhs); possibleCut.setUb(useRhs); } } delete [] which; delete [] away; return possibleCut; } #if 0 //############################################################################## // Default Constructor CbcBoundingBranchingObject::CbcBoundingBranchingObject() : CbcBranchingObject() { branchCut_.setUb(0.0); } // Useful constructor CbcBoundingBranchingObject::CbcBoundingBranchingObject (CbcModel * model, int way , const OsiRowCut * cut) : CbcBranchingObject(model, 0, way, 0.5) { branchCut_ = *cut; } // Copy constructor CbcBoundingBranchingObject::CbcBoundingBranchingObject ( const CbcBoundingBranchingObject & rhs) : CbcBranchingObject(rhs) { branchCut_ = rhs.branchCut_; } // Assignment operator CbcBoundingBranchingObject & CbcBoundingBranchingObject::operator=( const CbcBoundingBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); branchCut_ = rhs.branchCut_; } return *this; } CbcBranchingObject * CbcBoundingBranchingObject::clone() const { return (new CbcBoundingBranchingObject(*this)); } // Destructor CbcBoundingBranchingObject::~CbcBoundingBranchingObject () { } double CbcBoundingBranchingObject::branch() { decrementNumberBranchesLeft(); OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); int i; // *** for way - up means bound all those in up section if (way_ < 0) { #ifdef FULL_PRINT printf("Down Bound "); #endif //printf("Down Bound %d\n",numberDown_); for (i = 0; i < numberDown_; i++) { int iColumn = downList_[i]; model_->solver()->setColUpper(iColumn, columnLower[iColumn]); #ifdef FULL_PRINT printf("Setting bound on %d to lower bound\n", iColumn); #endif } way_ = 1; // Swap direction } else { #ifdef FULL_PRINT printf("Up Bound "); #endif //printf("Up Bound %d\n",numberUp_); for (i = 0; i < numberUp_; i++) { int iColumn = upList_[i]; model_->solver()->setColUpper(iColumn, columnLower[iColumn]); #ifdef FULL_PRINT printf("Setting bound on %d to lower bound\n", iColumn); #endif } way_ = -1; // Swap direction } #ifdef FULL_PRINT printf("\n"); #endif return 0.0; } void CbcBoundingBranchingObject::print() { OsiRowCut cut = branchCut_; if (way_ < 0) { printf("Down Fix "); cut.setUb(floor(branchCut_.ub())); cut.setLb(-COIN_DBL_MAX); } else { printf("Up Fix "); cut.setLb(ceil(branchCut_.lb())); cut.setUb(COIN_DBL_MAX); } printf("\n"); cut.print(); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcBoundingBranchingObject::compareOriginalObject (const CbcBranchingObject* /*brObj*/) const { throw("must implement"); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcBoundingBranchingObject::compareBranchingObject (const CbcBranchingObject* /*brObj*/, const bool /*replaceIfOverlap*/) { #ifdef JJF_ZERO //ndef NDEBUG const CbcBoundingBranchingObject* br = dynamic_cast(brObj); assert(br); #endif // If two BoundingBranchingObject's have the same base object then it's pretty // much guaranteed throw("must implement"); } //############################################################################## #endif CoinMP-1.8.3/Cbc/src/CbcSolver.hpp0000644000175000017500000003077512254633271015206 0ustar renerene/* $Id: CbcSolver.hpp 1998 2013-12-19 18:11:05Z forrest $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolver.hpp \brief Defines CbcSolver, the proposed top-level class for the new-style cbc solver. This class is currently an orphan. With the removal of all code flagged with the NEW_STYLE_SOLVER, this class is never instantiated (and cannot be instantiated). It is available to be coopted as a top-level object wrapping the current CbcMain0 and CbcMain1, should that appear to be a desireable path forward. -- lh, 091211 -- */ #ifndef CbcSolver_H #define CbcSolver_H #include #include #include "CoinMessageHandler.hpp" #include "OsiClpSolverInterface.hpp" #if CBC_OTHER_SOLVER==1 #include "OsiCpxSolverInterface.hpp" #endif #include "CbcModel.hpp" #include "CbcOrClpParam.hpp" class CbcUser; class CbcStopNow; class CglCutGenerator; //############################################################################# /*! \brief This allows the use of the standalone solver in a flexible manner. It has an original OsiClpSolverInterface and CbcModel which it can use repeatedly, e.g., to get a heuristic solution and then start again. So I [jjf] will need a primitive scripting language which can then call solve and manipulate solution value and solution arrays. Also provides for user callback functions. Currently two ideas in gestation, CbcUser and CbcStopNow. The latter seems limited to deciding whether or not to stop. The former seems completely general, with a notion of importing and exporting, and a `solve', which should be interpreted as `do whatever this user function does'. Parameter initialisation is at last centralised in fillParameters(). */ class CbcSolver { public: ///@name Solve method //@{ /** This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing) */ int solve(int argc, const char * argv[], int returnMode); /** This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing) */ int solve(const char * input, int returnMode); //@} ///@name Constructors and destructors etc //@{ /// Default Constructor CbcSolver(); /// Constructor from solver CbcSolver(const OsiClpSolverInterface &); /// Constructor from model CbcSolver(const CbcModel &); /** Copy constructor . */ CbcSolver(const CbcSolver & rhs); /// Assignment operator CbcSolver & operator=(const CbcSolver& rhs); /// Destructor ~CbcSolver (); /// Fill with standard parameters void fillParameters(); /*! \brief Set default values in solvers from parameters Misleading. The current code actually reads default values from the underlying solvers and installs them as default values for a subset of parameters in #parameters_. */ void fillValuesInSolver(); /// Add user function void addUserFunction(CbcUser * function); /// Set user call back void setUserCallBack(CbcStopNow * function); /// Add cut generator void addCutGenerator(CglCutGenerator * generator); //@} ///@name miscellaneous methods to line up with old //@{ // analyze model int * analyze(OsiClpSolverInterface * solverMod, int & numberChanged, double & increment, bool changeInt, CoinMessageHandler * generalMessageHandler); /** 1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later) */ //int doHeuristics(CbcModel * model, int type); /** Updates model_ from babModel_ according to returnMode returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing) */ void updateModel(ClpSimplex * model2, int returnMode); //@} ///@name useful stuff //@{ /// Get int value int intValue(CbcOrClpParameterType type) const; /// Set int value void setIntValue(CbcOrClpParameterType type, int value); /// Get double value double doubleValue(CbcOrClpParameterType type) const; /// Set double value void setDoubleValue(CbcOrClpParameterType type, double value); /// User function (NULL if no match) CbcUser * userFunction(const char * name) const; /// Return original Cbc model inline CbcModel * model() { return &model_; } /// Return updated Cbc model inline CbcModel * babModel() { return babModel_; } /// Number of userFunctions inline int numberUserFunctions() const { return numberUserFunctions_; } /// User function array inline CbcUser ** userFunctionArray() const { return userFunction_; } /// Copy of model on initial load (will contain output solutions) inline OsiClpSolverInterface * originalSolver() const { return originalSolver_; } /// Copy of model on initial load inline CoinModel * originalCoinModel() const { return originalCoinModel_; } /// Copy of model on initial load (will contain output solutions) void setOriginalSolver(OsiClpSolverInterface * originalSolver); /// Copy of model on initial load void setOriginalCoinModel(CoinModel * originalCoinModel); /// Number of cutgenerators inline int numberCutGenerators() const { return numberCutGenerators_; } /// Cut generator array inline CglCutGenerator ** cutGeneratorArray() const { return cutGenerator_; } /// Start time inline double startTime() const { return startTime_; } /// Whether to print to std::cout inline void setPrinting(bool onOff) { noPrinting_ = !onOff; } /// Where to start reading commands inline void setReadMode(int value) { readMode_ = value; } //@} private: ///@name Private member data //@{ /// Reference model CbcModel model_; /// Updated model CbcModel * babModel_; /// User functions CbcUser ** userFunction_; /** Status of user functions 0 - not used 1 - needs cbc_load 2 - available - data in coinModel 3 - data loaded - can do cbc_save */ int * statusUserFunction_; /// Copy of model on initial load (will contain output solutions) OsiClpSolverInterface * originalSolver_; /// Copy of model on initial load CoinModel * originalCoinModel_; /// Cut generators CglCutGenerator ** cutGenerator_; /// Number of user functions int numberUserFunctions_; /// Number of cut generators int numberCutGenerators_; /// Stop now stuff CbcStopNow * callBack_; /// Cpu time at instantiation double startTime_; /// Parameters and values CbcOrClpParam * parameters_; /// Number of parameters int numberParameters_ ; /// Whether to do miplib test bool doMiplib_; /// Whether to print to std::cout bool noPrinting_; /// Where to start reading commands int readMode_; //@} }; //############################################################################# /// Structure to hold useful arrays typedef struct { // Priorities int * priorities_; // SOS priorities int * sosPriority_; // Direction to branch first int * branchDirection_; // Input solution double * primalSolution_; // Down pseudo costs double * pseudoDown_; // Up pseudo costs double * pseudoUp_; } CbcSolverUsefulData2; //############################################################################# /** The CbcSolver class was taken out at a 9/12/09 meeting This is a feeble replacement. At present everything is public */ class CbcSolverUsefulData { public: ///@name Constructors and destructors etc //@{ /// Default Constructor CbcSolverUsefulData(); /** Copy constructor . */ CbcSolverUsefulData(const CbcSolverUsefulData & rhs); /// Assignment operator CbcSolverUsefulData & operator=(const CbcSolverUsefulData& rhs); /// Destructor ~CbcSolverUsefulData (); //@} ///@name Member data //@{ // For time double totalTime_; // Parameters CbcOrClpParam parameters_[CBCMAXPARAMETERS]; // Printing bool noPrinting_; // Whether to use signal handler bool useSignalHandler_; // Number of Parameters int numberParameters_; // Default pump tuning int initialPumpTune_; //@} }; /// And this uses it // When we want to load up CbcModel with options first void CbcMain0 (CbcModel & babSolver,CbcSolverUsefulData & solverData); int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom),CbcSolverUsefulData & solverData); //############################################################################# /*! \brief A class to allow the use of unknown user functionality For example, access to a modelling language (CbcAmpl). */ class CbcUser { public: ///@name import/export methods //@{ /*! \brief Import - gets full command arguments \return - -1 - no action - 0 - data read in without error - 1 - errors */ virtual int importData(CbcSolver * /*model*/, int & /*argc*/, char ** /*argv[]*/) { return -1; } /*! \brief Export Values for mode: - 1 OsiClpSolver - 2 CbcModel - add 10 if infeasible from odd situation */ virtual void exportSolution(CbcSolver * /*model*/, int /*mode*/, const char * /*message*/ = NULL) {} /// Export Data (i.e. at very end) virtual void exportData(CbcSolver * /*model*/) {} /// Get useful stuff virtual void fillInformation(CbcSolver * /*model*/, CbcSolverUsefulData & /*info*/) {} //@} ///@name usage methods //@{ /// CoinModel if valid inline CoinModel *coinModel() const { return coinModel_; } /// Other info - needs expanding virtual void * stuff() { return NULL; } /// Name inline std::string name() const { return userName_; } /// Solve (whatever that means) virtual void solve(CbcSolver * model, const char * options) = 0; /// Returns true if function knows about option virtual bool canDo(const char * options) = 0; //@} ///@name Constructors and destructors etc //@{ /// Default Constructor CbcUser(); /// Copy constructor CbcUser(const CbcUser & rhs); /// Assignment operator CbcUser & operator=(const CbcUser& rhs); /// Clone virtual CbcUser * clone() const = 0; /// Destructor virtual ~CbcUser (); //@} protected: ///@name Private member data //@{ /// CoinModel CoinModel * coinModel_; /// Name of user function std::string userName_; //@} }; //############################################################################# /*! \brief Support the use of a call back class to decide whether to stop Definitely under construction. */ class CbcStopNow { public: ///@name Decision methods //@{ /*! \brief Import Values for whereFrom: - 1 after initial solve by dualsimplex etc - 2 after preprocessing - 3 just before branchAndBound (so user can override) - 4 just after branchAndBound (before postprocessing) - 5 after postprocessing - 6 after a user called heuristic phase \return 0 if good nonzero return code to stop */ virtual int callBack(CbcModel * /*currentSolver*/, int /*whereFrom*/) { return 0; } //@} ///@name Constructors and destructors etc //@{ /// Default Constructor CbcStopNow(); /** Copy constructor . */ CbcStopNow(const CbcStopNow & rhs); /// Assignment operator CbcStopNow & operator=(const CbcStopNow& rhs); /// Clone virtual CbcStopNow * clone() const; /// Destructor virtual ~CbcStopNow (); //@} private: ///@name Private member data //@{ //@} }; #endif CoinMP-1.8.3/Cbc/src/CbcFullNodeInfo.cpp0000644000175000017500000001432512361442754016247 0ustar renerene// $Id: CbcFullNodeInfo.cpp 2048 2014-07-16 09:29:16Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/24/09 carved from CbcNode #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include //#define CBC_DEBUG 1 //#define CHECK_CUT_COUNTS //#define CHECK_NODE //#define CBC_CHECK_BASIS #include #include #define CUTS #include "OsiSolverInterface.hpp" #include "OsiChooseVariable.hpp" #include "OsiAuxInfo.hpp" #include "OsiSolverBranch.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinTime.hpp" #include "CbcModel.hpp" #include "CbcNode.hpp" #include "CbcStatistics.hpp" #include "CbcStrategy.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchDynamic.hpp" #include "OsiRowCut.hpp" #include "OsiRowCutDebugger.hpp" #include "OsiCuts.hpp" #include "CbcCountRowCut.hpp" #include "CbcFeasibilityBase.hpp" #include "CbcMessage.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #include "ClpSimplexOther.hpp" #endif using namespace std; #include "CglCutGenerator.hpp" CbcFullNodeInfo::CbcFullNodeInfo() : CbcNodeInfo(), basis_(), numberIntegers_(0), lower_(NULL), upper_(NULL) { } CbcFullNodeInfo::CbcFullNodeInfo(CbcModel * model, int numberRowsAtContinuous) : CbcNodeInfo(NULL, model->currentNode()) { OsiSolverInterface * solver = model->solver(); numberRows_ = numberRowsAtContinuous; numberIntegers_ = model->numberIntegers(); int numberColumns = model->getNumCols(); lower_ = new double [numberColumns]; upper_ = new double [numberColumns]; const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); int i; for (i = 0; i < numberColumns; i++) { lower_[i] = lower[i]; upper_[i] = upper[i]; } basis_ = dynamic_cast(solver->getWarmStart()); } CbcFullNodeInfo::CbcFullNodeInfo(const CbcFullNodeInfo & rhs) : CbcNodeInfo(rhs) { basis_ = dynamic_cast(rhs.basis_->clone()) ; numberIntegers_ = rhs.numberIntegers_; lower_ = NULL; upper_ = NULL; if (rhs.lower_ != NULL) { int numberColumns = basis_->getNumStructural(); lower_ = new double [numberColumns]; upper_ = new double [numberColumns]; assert (upper_ != NULL); memcpy(lower_, rhs.lower_, numberColumns*sizeof(double)); memcpy(upper_, rhs.upper_, numberColumns*sizeof(double)); } } CbcNodeInfo * CbcFullNodeInfo::clone() const { return (new CbcFullNodeInfo(*this)); } CbcFullNodeInfo::~CbcFullNodeInfo () { delete basis_ ; delete [] lower_; delete [] upper_; } /* The basis supplied as a parameter is deleted and replaced with a new basis appropriate for the node, and lower and upper bounds on variables are reset according to the stored bounds arrays. Any cuts associated with this node are added to the list in addCuts, but not actually added to the constraint system in the model. Why pass in a basis at all? The short answer is ``We need the parameter to pass out a basis, so might as well use it to pass in the size.'' A longer answer is that in practice we take a memory allocation hit up in addCuts1 (the only place applyToModel is called) when we setSize() the basis that's passed in. It's immediately tossed here in favour of a clone of the basis attached to this nodeInfo. This can probably be fixed, given a bit of thought. */ void CbcFullNodeInfo::applyToModel (CbcModel *model, CoinWarmStartBasis *&basis, CbcCountRowCut **addCuts, int ¤tNumberCuts) const { OsiSolverInterface *solver = model->solver() ; // may be end game if (!active_) return; // branch - do bounds assert ((active_&~16) == 7 || (active_&~16) == 15); int i; solver->setColLower(lower_); solver->setColUpper(upper_); if (basis) { int numberColumns = model->getNumCols(); // move basis - but make sure size stays // for bon-min - should not be needed int numberRows = model->getNumRows(); int numberRows = basis->getNumArtificial(); delete basis ; if (basis_) { basis = dynamic_cast(basis_->clone()) ; basis->resize(numberRows, numberColumns); #ifdef CBC_CHECK_BASIS std::cout << "Basis (after applying root " << this << ") " << std::endl ; basis->print() ; #endif } else { // We have a solver without a basis basis = NULL; } } for (i = 0; i < numberCuts_; i++) addCuts[currentNumberCuts+i] = cuts_[i]; currentNumberCuts += numberCuts_; assert(!parent_); return ; } // Just apply bounds to one variable (1=>infeasible) int CbcFullNodeInfo::applyBounds(int iColumn, double & lower, double & upper, int force) { if ((force && 1) == 0) { if (lower > lower_[iColumn]) COIN_DETAIL_PRINT(printf("%d odd lower going from %g to %g\n", iColumn, lower, lower_[iColumn])); lower = lower_[iColumn]; } else { lower_[iColumn] = lower; } if ((force && 2) == 0) { if (upper < upper_[iColumn]) COIN_DETAIL_PRINT(printf("%d odd upper going from %g to %g\n", iColumn, upper, upper_[iColumn])); upper = upper_[iColumn]; } else { upper_[iColumn] = upper; } return (upper_[iColumn] >= lower_[iColumn]) ? 0 : 1; } /* Builds up row basis backwards (until original model). Returns NULL or previous one to apply . Depends on Free being 0 and impossible for cuts */ CbcNodeInfo * CbcFullNodeInfo::buildRowBasis(CoinWarmStartBasis & basis ) const { const unsigned int * saved = reinterpret_cast (basis_->getArtificialStatus()); unsigned int * now = reinterpret_cast (basis.getArtificialStatus()); int number = basis_->getNumArtificial() >> 4;; int i; for (i = 0; i < number; i++) { if (!now[i]) now[i] = saved[i]; } return NULL; } CoinMP-1.8.3/Cbc/src/CbcHeuristicDive.cpp0000644000175000017500000015741412522137742016476 0ustar renerene/* $Id: CbcHeuristicDive.cpp 2187 2015-05-05 13:04:34Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcHeuristicDive.hpp" #include "CbcStrategy.hpp" #include "CbcModel.hpp" #include "CbcSubProblem.hpp" #include "CbcSimpleInteger.hpp" #include "OsiAuxInfo.hpp" #include "CoinTime.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif //#define DIVE_FIX_BINARY_VARIABLES //#define DIVE_DEBUG #ifdef DIVE_DEBUG #define DIVE_PRINT=2 #endif // Default Constructor CbcHeuristicDive::CbcHeuristicDive() : CbcHeuristic() { // matrix and row copy will automatically be empty downLocks_ = NULL; upLocks_ = NULL; downArray_ = NULL; upArray_ = NULL; priority_ = NULL; percentageToFix_ = 0.2; maxIterations_ = 100; maxSimplexIterations_ = 10000; maxSimplexIterationsAtRoot_ = 1000000; maxTime_ = 600; whereFrom_ = 255 - 2 - 16 + 256; decayFactor_ = 1.0; smallObjective_ = 1.0e-10; } // Constructor from model CbcHeuristicDive::CbcHeuristicDive(CbcModel & model) : CbcHeuristic(model) { downLocks_ = NULL; upLocks_ = NULL; downArray_ = NULL; upArray_ = NULL; priority_ = NULL; // Get a copy of original matrix assert(model.solver()); // model may have empty matrix - wait until setModel const CoinPackedMatrix * matrix = model.solver()->getMatrixByCol(); if (matrix) { matrix_ = *matrix; matrixByRow_ = *model.solver()->getMatrixByRow(); validate(); } percentageToFix_ = 0.2; maxTime_ = 600; smallObjective_ = 1.0e-10; maxIterations_ = 100; maxSimplexIterations_ = 10000; maxSimplexIterationsAtRoot_ = 1000000; whereFrom_ = 255 - 2 - 16 + 256; decayFactor_ = 1.0; smallObjective_ = 1.0e-10; } // Destructor CbcHeuristicDive::~CbcHeuristicDive () { delete [] downLocks_; delete [] upLocks_; delete [] priority_; assert (!downArray_); } // Create C++ lines to get to current state void CbcHeuristicDive::generateCpp( FILE * fp, const char * heuristic) { // hard coded as CbcHeuristic virtual CbcHeuristic::generateCpp(fp, heuristic); if (percentageToFix_ != 0.2) fprintf(fp, "3 %s.setPercentageToFix(%.f);\n", heuristic, percentageToFix_); else fprintf(fp, "4 %s.setPercentageToFix(%.f);\n", heuristic, percentageToFix_); if (maxIterations_ != 100) fprintf(fp, "3 %s.setMaxIterations(%d);\n", heuristic, maxIterations_); else fprintf(fp, "4 %s.setMaxIterations(%d);\n", heuristic, maxIterations_); if (maxSimplexIterations_ != 10000) fprintf(fp, "3 %s.setMaxSimplexIterations(%d);\n", heuristic, maxSimplexIterations_); else fprintf(fp, "4 %s.setMaxSimplexIterations(%d);\n", heuristic, maxSimplexIterations_); if (maxTime_ != 600) fprintf(fp, "3 %s.setMaxTime(%.2f);\n", heuristic, maxTime_); else fprintf(fp, "4 %s.setMaxTime(%.2f);\n", heuristic, maxTime_); } // Copy constructor CbcHeuristicDive::CbcHeuristicDive(const CbcHeuristicDive & rhs) : CbcHeuristic(rhs), matrix_(rhs.matrix_), matrixByRow_(rhs.matrixByRow_), percentageToFix_(rhs.percentageToFix_), maxTime_(rhs.maxTime_), smallObjective_(rhs.smallObjective_), maxIterations_(rhs.maxIterations_), maxSimplexIterations_(rhs.maxSimplexIterations_), maxSimplexIterationsAtRoot_(rhs.maxSimplexIterationsAtRoot_) { downArray_ = NULL; upArray_ = NULL; if (rhs.downLocks_) { int numberIntegers = model_->numberIntegers(); downLocks_ = CoinCopyOfArray(rhs.downLocks_, numberIntegers); upLocks_ = CoinCopyOfArray(rhs.upLocks_, numberIntegers); priority_ = CoinCopyOfArray(rhs.priority_, numberIntegers); } else { downLocks_ = NULL; upLocks_ = NULL; priority_ = NULL; } } // Assignment operator CbcHeuristicDive & CbcHeuristicDive::operator=( const CbcHeuristicDive & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); matrix_ = rhs.matrix_; matrixByRow_ = rhs.matrixByRow_; percentageToFix_ = rhs.percentageToFix_; maxIterations_ = rhs.maxIterations_; maxSimplexIterations_ = rhs.maxSimplexIterations_; maxSimplexIterationsAtRoot_ = rhs.maxSimplexIterationsAtRoot_; maxTime_ = rhs.maxTime_; smallObjective_ = rhs.smallObjective_; delete [] downLocks_; delete [] upLocks_; delete [] priority_; if (rhs.downLocks_) { int numberIntegers = model_->numberIntegers(); downLocks_ = CoinCopyOfArray(rhs.downLocks_, numberIntegers); upLocks_ = CoinCopyOfArray(rhs.upLocks_, numberIntegers); priority_ = CoinCopyOfArray(rhs.priority_, numberIntegers); } else { downLocks_ = NULL; upLocks_ = NULL; priority_ = NULL; } } return *this; } // Resets stuff if model changes void CbcHeuristicDive::resetModel(CbcModel * model) { model_ = model; assert(model_->solver()); // Get a copy of original matrix const CoinPackedMatrix * matrix = model_->solver()->getMatrixByCol(); // model may have empty matrix - wait until setModel if (matrix) { matrix_ = *matrix; matrixByRow_ = *model->solver()->getMatrixByRow(); validate(); } setPriorities(); } // update model void CbcHeuristicDive::setModel(CbcModel * model) { model_ = model; assert(model_->solver()); // Get a copy of original matrix const CoinPackedMatrix * matrix = model_->solver()->getMatrixByCol(); if (matrix) { matrix_ = *matrix; matrixByRow_ = *model->solver()->getMatrixByRow(); // make sure model okay for heuristic validate(); } setPriorities(); } // Sets priorities if any void CbcHeuristicDive::setPriorities() { delete [] priority_; assert (model_); priority_=NULL; if (!model_->objects()) return; bool gotPriorities=false; int numberIntegers = model_->numberIntegers(); int priority1=-COIN_INT_MAX; int priority2=COIN_INT_MAX; smallObjective_=0.0; const double * objective = model_->solver()->getObjCoefficients(); int numberObjects = model_->numberObjects(); for (int i = 0; i < numberObjects; i++) { OsiObject * object = model_->modifiableObject(i); const CbcSimpleInteger * thisOne = dynamic_cast (object); if (!thisOne) continue; // Not integer int iColumn = thisOne->columnNumber(); smallObjective_ += objective[iColumn]; int level=thisOne->priority(); priority1=CoinMax(priority1,level); priority2=CoinMin(priority2,level); if (thisOne->preferredWay()!=0) gotPriorities=true; } smallObjective_ = CoinMax(1.0e-10,1.0e-5*(smallObjective_/numberIntegers)); if (gotPriorities || priority1>priority2) { priority_ = new PriorityType [numberIntegers]; int nInteger=0; for (int i = 0; i < numberObjects; i++) { OsiObject * object = model_->modifiableObject(i); const CbcSimpleInteger * thisOne = dynamic_cast (object); if (!thisOne) continue; // Not integer int level=thisOne->priority()-priority2; assert (level<(1<<29)); assert (nInteger(level); int direction=0; if (thisOne->preferredWay()<0) direction=1; else if (thisOne->preferredWay()>0) direction=1|1; // at present don't try other way is not used priority_[nInteger++].direction=static_cast(direction); } assert (nInteger==numberIntegers); } } bool CbcHeuristicDive::canHeuristicRun() { if (model_->bestSolution()||model_->getNodeCount()) { if (when_==3 || (when_==4 && numberSolutionsFound_) ) return false; } return shouldHeurRun_randomChoice(); } inline bool compareBinaryVars(const PseudoReducedCost obj1, const PseudoReducedCost obj2) { return obj1.pseudoRedCost > obj2.pseudoRedCost; } // inner part of dive int CbcHeuristicDive::solution(double & solutionValue, int & numberNodes, int & numberCuts, OsiRowCut ** cuts, CbcSubProblem ** & nodes, double * newSolution) { #if DIVE_PRINT int nRoundInfeasible = 0; int nRoundFeasible = 0; printf("Entering %s - fix %.1f%% maxTime %.2f maxPasses %d - max iterations %d (at root %d) - when to do %d\n", heuristicName_.c_str(),percentageToFix_*100.0,maxTime_,maxIterations_, maxSimplexIterations_,maxSimplexIterationsAtRoot_,when()); #endif int reasonToStop = 0; double time1 = CoinCpuTime(); int numberSimplexIterations = 0; int maxSimplexIterations = (model_->getNodeCount()) ? maxSimplexIterations_ : maxSimplexIterationsAtRoot_; int maxIterationsInOneSolve = (maxSimplexIterations<1000000) ? 1000 : 10000; // but can't be exactly coin_int_max maxSimplexIterations = CoinMin(maxSimplexIterations,COIN_INT_MAX>>3); bool fixGeneralIntegers=false; int maxIterations = maxIterations_; int saveSwitches = switches_; if ((maxIterations_%10)!=0) { int digit = maxIterations_%10; maxIterations -= digit; switches_ |= 65536; if ((digit&3)!=0) fixGeneralIntegers=true; } OsiSolverInterface * solver = cloneBut(6); // was model_->solver()->clone(); # ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver); if (clpSolver) { ClpSimplex * clpSimplex = clpSolver->getModelPtr(); int oneSolveIts = clpSimplex->maximumIterations(); oneSolveIts = CoinMin(1000+2*(clpSimplex->numberRows()+clpSimplex->numberColumns()),oneSolveIts); if (maxSimplexIterations>1000000) maxIterationsInOneSolve=oneSolveIts; clpSimplex->setMaximumIterations(oneSolveIts); if (!nodes) { // say give up easily clpSimplex->setMoreSpecialOptions(clpSimplex->moreSpecialOptions() | 64); } else { // get ray int specialOptions = clpSimplex->specialOptions(); specialOptions &= ~0x3100000; specialOptions |= 32; clpSimplex->setSpecialOptions(specialOptions); clpSolver->setSpecialOptions(clpSolver->specialOptions() | 1048576); if ((model_->moreSpecialOptions()&16777216)!=0) { // cutoff is constraint clpSolver->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX); } } } # endif const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); const double * solution = solver->getColSolution(); const double * objective = solver->getObjCoefficients(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); int numberRows = matrix_.getNumRows(); assert (numberRows <= solver->getNumRows()); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); double direction = solver->getObjSense(); // 1 for min, -1 for max double newSolutionValue = direction * solver->getObjValue(); int returnCode = 0; // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); #ifdef DIVE_FIX_BINARY_VARIABLES // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); #endif // Get solution array for heuristic solution int numberColumns = solver->getNumCols(); memcpy(newSolution, solution, numberColumns*sizeof(double)); // vectors to store the latest variables fixed at their bounds int* columnFixed = new int [numberIntegers+numberColumns]; int * back = columnFixed + numberIntegers; double* originalBound = new double [numberIntegers+2*numberColumns]; double * lowerBefore = originalBound+numberIntegers; double * upperBefore = lowerBefore+numberColumns; memcpy(lowerBefore,lower,numberColumns*sizeof(double)); memcpy(upperBefore,upper,numberColumns*sizeof(double)); double * lastDjs=newSolution+numberColumns; bool * fixedAtLowerBound = new bool [numberIntegers]; PseudoReducedCost * candidate = new PseudoReducedCost [numberIntegers]; double * random = new double [numberIntegers]; int maxNumberAtBoundToFix = static_cast (floor(percentageToFix_ * numberIntegers)); assert (!maxNumberAtBoundToFix||!nodes); // count how many fractional variables int numberFractionalVariables = 0; for (int i=0;i integerTolerance) { numberFractionalVariables++; } } const double* reducedCost = NULL; // See if not NLP if (!model_->solverCharacteristics() || model_->solverCharacteristics()->reducedCostsAccurate()) reducedCost = solver->getReducedCost(); int iteration = 0; int numberAtBoundFixed = 0; int numberGeneralFixed = 0; // fixed as satisfied but not at bound int numberReducedCostFixed = 0; while (numberFractionalVariables) { iteration++; // initialize any data initializeData(); // select a fractional variable to bound int bestColumn = -1; int bestRound; // -1 rounds down, +1 rounds up bool canRound = selectVariableToBranch(solver, newSolution, bestColumn, bestRound); // if the solution is not trivially roundable, we don't try to round; // if the solution is trivially roundable, we try to round. However, // if the rounded solution is worse than the current incumbent, // then we don't round and proceed normally. In this case, the // bestColumn will be a trivially roundable variable if (canRound) { // check if by rounding all fractional variables // we get a solution with an objective value // better than the current best integer solution double delta = 0.0; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; if (fabs(floor(value + 0.5) - value) > integerTolerance) { assert(downLocks_[i] == 0 || upLocks_[i] == 0); double obj = objective[iColumn]; if (downLocks_[i] == 0 && upLocks_[i] == 0) { if (direction * obj >= 0.0) delta += (floor(value) - value) * obj; else delta += (ceil(value) - value) * obj; } else if (downLocks_[i] == 0) delta += (floor(value) - value) * obj; else delta += (ceil(value) - value) * obj; } } if (direction*(solver->getObjValue() + delta) < solutionValue) { #if DIVE_PRINT nRoundFeasible++; #endif if (!nodes||bestColumn<0) { // Round all the fractional variables for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; if (fabs(floor(value + 0.5) - value) > integerTolerance) { assert(downLocks_[i] == 0 || upLocks_[i] == 0); if (downLocks_[i] == 0 && upLocks_[i] == 0) { if (direction * objective[iColumn] >= 0.0) newSolution[iColumn] = floor(value); else newSolution[iColumn] = ceil(value); } else if (downLocks_[i] == 0) newSolution[iColumn] = floor(value); else newSolution[iColumn] = ceil(value); } } break; } else { // can't round if going to use in branching int i; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[bestColumn]; if (fabs(floor(value + 0.5) - value) > integerTolerance) { if (iColumn==bestColumn) { assert(downLocks_[i] == 0 || upLocks_[i] == 0); double obj = objective[bestColumn]; if (downLocks_[i] == 0 && upLocks_[i] == 0) { if (direction * obj >= 0.0) bestRound=-1; else bestRound=1; } else if (downLocks_[i] == 0) bestRound=-1; else bestRound=1; break; } } } } } #if DIVE_PRINT else nRoundInfeasible++; #endif } // do reduced cost fixing #if DIVE_PRINT>1 numberReducedCostFixed = reducedCostFix(solver); #else reducedCostFix(solver); #endif numberAtBoundFixed = 0; numberGeneralFixed = 0; // fixed as satisfied but not at bound #ifdef DIVE_FIX_BINARY_VARIABLES // fix binary variables based on pseudo reduced cost if (binVarIndex_.size()) { int cnt = 0; int n = static_cast(binVarIndex_.size()); for (int j = 0; j < n; j++) { int iColumn1 = binVarIndex_[j]; double value = newSolution[iColumn1]; if (fabs(value) <= integerTolerance && lower[iColumn1] != upper[iColumn1]) { double maxPseudoReducedCost = 0.0; #ifdef DIVE_DEBUG std::cout << "iColumn1 = " << iColumn1 << ", value = " << value << std::endl; #endif int iRow = vbRowIndex_[j]; double chosenValue = 0.0; for (int k = rowStart[iRow]; k < rowStart[iRow] + rowLength[iRow]; k++) { int iColumn2 = column[k]; #ifdef DIVE_DEBUG std::cout << "iColumn2 = " << iColumn2 << std::endl; #endif if (iColumn1 != iColumn2) { double pseudoReducedCost = fabs(reducedCost[iColumn2] * elementByRow[k]); #ifdef DIVE_DEBUG int k2; for (k2 = rowStart[iRow]; k2 < rowStart[iRow] + rowLength[iRow]; k2++) { if (column[k2] == iColumn1) break; } std::cout << "reducedCost[" << iColumn2 << "] = " << reducedCost[iColumn2] << ", elementByRow[" << iColumn2 << "] = " << elementByRow[k] << ", elementByRow[" << iColumn1 << "] = " << elementByRow[k2] << ", pseudoRedCost = " << pseudoReducedCost << std::endl; #endif if (pseudoReducedCost > maxPseudoReducedCost) maxPseudoReducedCost = pseudoReducedCost; } else { // save value chosenValue = fabs(elementByRow[k]); } } assert (chosenValue); maxPseudoReducedCost /= chosenValue; #ifdef DIVE_DEBUG std::cout << ", maxPseudoRedCost = " << maxPseudoReducedCost << std::endl; #endif candidate[cnt].var = iColumn1; candidate[cnt++].pseudoRedCost = maxPseudoReducedCost; } } #ifdef DIVE_DEBUG std::cout << "candidates for rounding = " << cnt << std::endl; #endif std::sort(candidate, candidate + cnt, compareBinaryVars); for (int i = 0; i < cnt; i++) { int iColumn = candidate[i].var; if (numberAtBoundFixed < maxNumberAtBoundToFix) { columnFixed[numberAtBoundFixed] = iColumn; originalBound[numberAtBoundFixed] = upper[iColumn]; fixedAtLowerBound[numberAtBoundFixed] = true; solver->setColUpper(iColumn, lower[iColumn]); numberAtBoundFixed++; if (numberAtBoundFixed == maxNumberAtBoundToFix) break; } } } #endif // fix other integer variables that are at their bounds int cnt = 0; #ifdef GAP double gap = 1.0e30; #endif int fixPriority=COIN_INT_MAX; if (reducedCost && true) { #ifndef JJF_ONE cnt = fixOtherVariables(solver, solution, candidate, random); if (priority_) { for (int i = 0; i < cnt; i++) { int iColumn = candidate[i].var; if (upper[iColumn] > lower[iColumn]) { int j=back[iColumn]; fixPriority = CoinMin(fixPriority,static_cast(priority_[j].priority)); } } } #else #ifdef GAP double cutoff = model_->getCutoff() ; if (cutoff < 1.0e20 && false) { double direction = solver->getObjSense() ; gap = cutoff - solver->getObjValue() * direction ; gap *= 0.1; // Fix more if plausible double tolerance; solver->getDblParam(OsiDualTolerance, tolerance) ; if (gap <= 0.0) gap = tolerance; gap += 100.0 * tolerance; } int nOverGap = 0; #endif int numberFree = 0; int numberFixed = 0; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (upper[iColumn] > lower[iColumn]) { numberFree++; if (priority_) { fixPriority = CoinMin(fixPriority,static_cast(priority_[i].priority)); } double value = newSolution[iColumn]; if (fabs(floor(value + 0.5) - value) <= integerTolerance) { candidate[cnt].var = iColumn; candidate[cnt++].pseudoRedCost = fabs(reducedCost[iColumn] * random[i]); #ifdef GAP if (fabs(reducedCost[iColumn]) > gap) nOverGap++; #endif } } else { numberFixed++; } } #ifdef GAP int nLeft = maxNumberAtBoundToFix - numberAtBoundFixed; #ifdef CLP_INVESTIGATE4 printf("cutoff %g obj %g nover %d - %d free, %d fixed\n", cutoff, solver->getObjValue(), nOverGap, numberFree, numberFixed); #endif if (nOverGap > nLeft && true) { nOverGap = CoinMin(nOverGap, nLeft + maxNumberAtBoundToFix / 2); maxNumberAtBoundToFix += nOverGap - nLeft; } #else #ifdef CLP_INVESTIGATE4 printf("cutoff %g obj %g - %d free, %d fixed\n", model_->getCutoff(), solver->getObjValue(), numberFree, numberFixed); #endif #endif #endif } else { for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (upper[iColumn] > lower[iColumn]) { if (priority_) { fixPriority = CoinMin(fixPriority,static_cast(priority_[i].priority)); } double value = newSolution[iColumn]; if (fabs(floor(value + 0.5) - value) <= integerTolerance) { candidate[cnt].var = iColumn; candidate[cnt++].pseudoRedCost = numberIntegers - i; } } } } std::sort(candidate, candidate + cnt, compareBinaryVars); // If getting on fix all if (iteration*3>maxIterations_*2) fixPriority=COIN_INT_MAX; for (int i = 0; i < cnt; i++) { int iColumn = candidate[i].var; if (upper[iColumn] > lower[iColumn]) { double value = newSolution[iColumn]; if (fabs(floor(value + 0.5) - value) <= integerTolerance && numberAtBoundFixed < maxNumberAtBoundToFix) { // fix the variable at one of its bounds if (fabs(lower[iColumn] - value) <= integerTolerance || fixGeneralIntegers) { if (priority_) { int j=back[iColumn]; if (priority_[j].priority>fixPriority) continue; // skip - only fix ones at high priority int thisRound=static_cast(priority_[j].direction); if ((thisRound&1)!=0) { // for now force way if((thisRound&2)!=0) continue; } } if (fabs(lower[iColumn] - value) <= integerTolerance) { columnFixed[numberAtBoundFixed] = iColumn; originalBound[numberAtBoundFixed] = upper[iColumn]; fixedAtLowerBound[numberAtBoundFixed] = true; solver->setColUpper(iColumn, lower[iColumn]); } else { // fix to interior value numberGeneralFixed++; double fixValue = floor(value + 0.5); columnFixed[numberAtBoundFixed] = iColumn; originalBound[numberAtBoundFixed] = upper[iColumn]; fixedAtLowerBound[numberAtBoundFixed] = true; solver->setColUpper(iColumn, fixValue); numberAtBoundFixed++; columnFixed[numberAtBoundFixed] = iColumn; originalBound[numberAtBoundFixed] = lower[iColumn]; fixedAtLowerBound[numberAtBoundFixed] = false; solver->setColLower(iColumn, fixValue); } //if (priority_) //printf("fixing %d (priority %d) to lower bound of %g\n", // iColumn,priority_[back[iColumn]].priority,lower[iColumn]); numberAtBoundFixed++; } else if (fabs(upper[iColumn] - value) <= integerTolerance) { if (priority_) { int j=back[iColumn]; if (priority_[j].priority>fixPriority) continue; // skip - only fix ones at high priority int thisRound=static_cast(priority_[j].direction); if ((thisRound&1)!=0) { // for now force way if((thisRound&2)==0) continue; } } columnFixed[numberAtBoundFixed] = iColumn; originalBound[numberAtBoundFixed] = lower[iColumn]; fixedAtLowerBound[numberAtBoundFixed] = false; solver->setColLower(iColumn, upper[iColumn]); //if (priority_) //printf("fixing %d (priority %d) to upper bound of %g\n", // iColumn,priority_[back[iColumn]].priority,upper[iColumn]); numberAtBoundFixed++; } if (numberAtBoundFixed == maxNumberAtBoundToFix) break; } } } double originalBoundBestColumn; double bestColumnValue; int whichWay; if (bestColumn >= 0) { bestColumnValue = newSolution[bestColumn]; if (bestRound < 0) { originalBoundBestColumn = upper[bestColumn]; solver->setColUpper(bestColumn, floor(bestColumnValue)); #ifdef DIVE_DEBUG if (priority_) { printf("setting %d (priority %d) upper bound to %g (%g)\n", bestColumn,priority_[back[bestColumn]].priority,floor(bestColumnValue),bestColumnValue); } #endif whichWay=0; } else { originalBoundBestColumn = lower[bestColumn]; solver->setColLower(bestColumn, ceil(bestColumnValue)); #ifdef DIVE_DEBUG if (priority_) { printf("setting %d (priority %d) lower bound to %g (%g)\n", bestColumn,priority_[back[bestColumn]].priority,ceil(bestColumnValue),bestColumnValue); } #endif whichWay=1; } } else { break; } int originalBestRound = bestRound; int saveModelOptions = model_->specialOptions(); while (1) { model_->setSpecialOptions(saveModelOptions | 2048); solver->resolve(); numberSimplexIterations += solver->getIterationCount(); #if DIVE_PRINT>1 int numberFractionalVariables = 0; double sumFractionalVariables=0.0; int numberFixed=0; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; double away = fabs(floor(value + 0.5) - value); if (away > integerTolerance) { numberFractionalVariables++; sumFractionalVariables += away; } if (upper[iColumn]==lower[iColumn]) numberFixed++; } printf("pass %d obj %g %s its %d total %d fixed %d +(%d,%d)",iteration, solver->getObjValue(),solver->isProvenOptimal() ? "opt" : "infeasible", solver->getIterationCount(), solver->getIterationCount()+numberSimplexIterations, numberFixed, numberReducedCostFixed, numberAtBoundFixed-numberGeneralFixed); if (solver->isProvenOptimal()) { printf(" - %d at bound, %d away (sum %g)\n", numberIntegers-numberFixed-numberFractionalVariables, numberFractionalVariables,sumFractionalVariables); } else { printf("\n"); if (fixGeneralIntegers) { int digit = maxIterations_%10; if (digit==1) { // switch off for now switches_=saveSwitches; fixGeneralIntegers=false; } else if (digit==2) { // switch off always switches_=saveSwitches; fixGeneralIntegers=false; maxIterations_ -= digit; } } } #else if (!solver->isProvenOptimal()) { if (fixGeneralIntegers) { int digit = maxIterations_%10; if (digit==1) { // switch off for now switches_=saveSwitches; fixGeneralIntegers=false; } else if (digit==2) { // switch off always switches_=saveSwitches; fixGeneralIntegers=false; maxIterations_ -= digit; } } } #endif model_->setSpecialOptions(saveModelOptions); if (!solver->isAbandoned()&&!solver->isIterationLimitReached()) { //numberSimplexIterations += solver->getIterationCount(); } else { numberSimplexIterations = maxSimplexIterations + 1; reasonToStop += 100; break; } if (!solver->isProvenOptimal()) { if (nodes) { if (solver->isProvenPrimalInfeasible()) { if (maxSimplexIterationsAtRoot_!=COIN_INT_MAX) { // stop now printf("stopping on first infeasibility\n"); break; } else if (cuts) { // can do conflict cut printf("could do intermediate conflict cut\n"); bool localCut; OsiRowCut * cut = model_->conflictCut(solver,localCut); if (cut) { if (!localCut) { model_->makePartialCut(cut,solver); cuts[numberCuts++]=cut; } else { delete cut; } } } } else { reasonToStop += 10; break; } } if (numberAtBoundFixed > 0) { // Remove the bound fix for variables that were at bounds for (int i = 0; i < numberAtBoundFixed; i++) { int iColFixed = columnFixed[i]; if (fixedAtLowerBound[i]) solver->setColUpper(iColFixed, originalBound[i]); else solver->setColLower(iColFixed, originalBound[i]); } numberAtBoundFixed = 0; } else if (bestRound == originalBestRound) { bestRound *= (-1); whichWay |=2; if (bestRound < 0) { solver->setColLower(bestColumn, originalBoundBestColumn); solver->setColUpper(bestColumn, floor(bestColumnValue)); } else { solver->setColLower(bestColumn, ceil(bestColumnValue)); solver->setColUpper(bestColumn, originalBoundBestColumn); } } else break; } else break; } if (!solver->isProvenOptimal() || direction*solver->getObjValue() >= solutionValue) { reasonToStop += 1; } else if (iteration > maxIterations_) { reasonToStop += 2; } else if (CoinCpuTime() - time1 > maxTime_) { reasonToStop += 3; } else if (numberSimplexIterations > maxSimplexIterations) { reasonToStop += 4; // also switch off #if DIVE_PRINT printf("switching off diving as too many iterations %d, %d allowed\n", numberSimplexIterations, maxSimplexIterations); #endif when_ = 0; } else if (solver->getIterationCount() > maxIterationsInOneSolve && iteration > 3 && !nodes) { reasonToStop += 5; // also switch off #if DIVE_PRINT printf("switching off diving one iteration took %d iterations (total %d)\n", solver->getIterationCount(), numberSimplexIterations); #endif when_ = 0; } memcpy(newSolution, solution, numberColumns*sizeof(double)); numberFractionalVariables = 0; double sumFractionalVariables=0.0; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; double away = fabs(floor(value + 0.5) - value); if (away > integerTolerance) { numberFractionalVariables++; sumFractionalVariables += away; } } if (nodes) { // save information //branchValues[numberNodes]=bestColumnValue; //statuses[numberNodes]=whichWay+(bestColumn<<2); //bases[numberNodes]=solver->getWarmStart(); ClpSimplex * simplex = clpSolver->getModelPtr(); CbcSubProblem * sub = new CbcSubProblem(clpSolver,lowerBefore,upperBefore, simplex->statusArray(),numberNodes); nodes[numberNodes]=sub; // other stuff sub->branchValue_=bestColumnValue; sub->problemStatus_=whichWay; sub->branchVariable_=bestColumn; sub->objectiveValue_ = simplex->objectiveValue(); sub->sumInfeasibilities_ = sumFractionalVariables; sub->numberInfeasibilities_ = numberFractionalVariables; printf("DiveNode %d column %d way %d bvalue %g obj %g\n", numberNodes,sub->branchVariable_,sub->problemStatus_, sub->branchValue_,sub->objectiveValue_); numberNodes++; if (solver->isProvenOptimal()) { memcpy(lastDjs,solver->getReducedCost(),numberColumns*sizeof(double)); memcpy(lowerBefore,lower,numberColumns*sizeof(double)); memcpy(upperBefore,upper,numberColumns*sizeof(double)); } } if (!numberFractionalVariables||reasonToStop) break; } if (nodes) { printf("Exiting dive for reason %d\n",reasonToStop); if (reasonToStop>1) { printf("problems in diving\n"); int whichWay=nodes[numberNodes-1]->problemStatus_; CbcSubProblem * sub; if ((whichWay&2)==0) { // leave both ways sub = new CbcSubProblem(*nodes[numberNodes-1]); nodes[numberNodes++]=sub; } else { sub = nodes[numberNodes-1]; } if ((whichWay&1)==0) sub->problemStatus_=whichWay|1; else sub->problemStatus_=whichWay&~1; } if (!numberNodes) { // was good at start! - create fake clpSolver->resolve(); numberSimplexIterations += clpSolver->getIterationCount(); ClpSimplex * simplex = clpSolver->getModelPtr(); CbcSubProblem * sub = new CbcSubProblem(clpSolver,lowerBefore,upperBefore, simplex->statusArray(),numberNodes); nodes[numberNodes]=sub; // other stuff sub->branchValue_=0.0; sub->problemStatus_=0; sub->branchVariable_=-1; sub->objectiveValue_ = simplex->objectiveValue(); sub->sumInfeasibilities_ = 0.0; sub->numberInfeasibilities_ = 0; printf("DiveNode %d column %d way %d bvalue %g obj %g\n", numberNodes,sub->branchVariable_,sub->problemStatus_, sub->branchValue_,sub->objectiveValue_); numberNodes++; assert (solver->isProvenOptimal()); } nodes[numberNodes-1]->problemStatus_ |= 256*reasonToStop; // use djs as well if (solver->isProvenPrimalInfeasible()&&cuts) { // can do conflict cut and re-order printf("could do final conflict cut\n"); bool localCut; OsiRowCut * cut = model_->conflictCut(solver,localCut); if (cut) { printf("cut - need to use conflict and previous djs\n"); if (!localCut) { model_->makePartialCut(cut,solver); cuts[numberCuts++]=cut; } else { delete cut; } } else { printf("bad conflict - just use previous djs\n"); } } } // re-compute new solution value double objOffset = 0.0; solver->getDblParam(OsiObjOffset, objOffset); newSolutionValue = -objOffset; for (int i = 0 ; i < numberColumns ; i++ ) newSolutionValue += objective[i] * newSolution[i]; newSolutionValue *= direction; //printf("new solution value %g %g\n",newSolutionValue,solutionValue); if (newSolutionValue < solutionValue && !reasonToStop) { double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); // paranoid check memset(rowActivity, 0, numberRows*sizeof(double)); for (int i = 0; i < numberColumns; i++) { int j; double value = newSolution[i]; if (value) { for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } // check was approximately feasible bool feasible = true; for (int i = 0; i < numberRows; i++) { if (rowActivity[i] < rowLower[i]) { if (rowActivity[i] < rowLower[i] - 1000.0*primalTolerance) feasible = false; } else if (rowActivity[i] > rowUpper[i]) { if (rowActivity[i] > rowUpper[i] + 1000.0*primalTolerance) feasible = false; } } for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; if (fabs(floor(value + 0.5) - value) > integerTolerance) { feasible = false; break; } } if (feasible) { // new solution solutionValue = newSolutionValue; //printf("** Solution of %g found by CbcHeuristicDive\n",newSolutionValue); //if (cuts) //clpSolver->getModelPtr()->writeMps("good8.mps", 2); returnCode = 1; } else { // Can easily happen //printf("Debug CbcHeuristicDive giving bad solution\n"); } delete [] rowActivity; } #if DIVE_PRINT std::cout << heuristicName_ << " nRoundInfeasible = " << nRoundInfeasible << ", nRoundFeasible = " << nRoundFeasible << ", returnCode = " << returnCode << ", reasonToStop = " << reasonToStop << ", simplexIts = " << numberSimplexIterations << ", iterations = " << iteration << std::endl; #endif delete [] columnFixed; delete [] originalBound; delete [] fixedAtLowerBound; delete [] candidate; delete [] random; delete [] downArray_; downArray_ = NULL; delete [] upArray_; upArray_ = NULL; delete solver; switches_ = saveSwitches; return returnCode; } // See if diving will give better solution // Sets value of solution // Returns 1 if solution, 0 if not int CbcHeuristicDive::solution(double & solutionValue, double * betterSolution) { int nodeCount = model_->getNodeCount(); if (feasibilityPumpOptions_>0 && (nodeCount % feasibilityPumpOptions_) != 0) return 0; ++numCouldRun_; // test if the heuristic can run if (!canHeuristicRun()) return 0; #ifdef JJF_ZERO // See if to do if (!when() || (when() % 10 == 1 && model_->phase() != 1) || (when() % 10 == 2 && (model_->phase() != 2 && model_->phase() != 3))) return 0; // switched off #endif #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif #ifdef DIVE_DEBUG std::cout << "solutionValue = " << solutionValue << std::endl; #endif // Get solution array for heuristic solution int numberColumns = model_->solver()->getNumCols(); double * newSolution = CoinCopyOfArray(model_->solver()->getColSolution(), numberColumns); int numberCuts=0; int numberNodes=-1; CbcSubProblem ** nodes=NULL; int returnCode=solution(solutionValue,numberNodes,numberCuts, NULL,nodes, newSolution); if (returnCode==1) memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); delete [] newSolution; return returnCode; } /* returns 0 if no solution, 1 if valid solution with better objective value than one passed in also returns list of nodes This does Fractional Diving */ int CbcHeuristicDive::fathom(CbcModel * model, int & numberNodes, CbcSubProblem ** & nodes) { double solutionValue = model->getCutoff(); numberNodes=0; // Get solution array for heuristic solution int numberColumns = model_->solver()->getNumCols(); double * newSolution = new double [4*numberColumns]; double * lastDjs = newSolution+numberColumns; double * originalLower = lastDjs+numberColumns; double * originalUpper = originalLower+numberColumns; memcpy(originalLower,model_->solver()->getColLower(), numberColumns*sizeof(double)); memcpy(originalUpper,model_->solver()->getColUpper(), numberColumns*sizeof(double)); int numberCuts=0; OsiRowCut ** cuts = NULL; //new OsiRowCut * [maxIterations_]; nodes=new CbcSubProblem * [maxIterations_+2]; int returnCode=solution(solutionValue,numberNodes,numberCuts, cuts,nodes, newSolution); if (returnCode==1) { // copy to best solution ? or put in solver printf("Solution from heuristic fathom\n"); } int numberFeasibleNodes=numberNodes; if (returnCode!=1) numberFeasibleNodes--; if (numberFeasibleNodes>0) { CoinWarmStartBasis * basis = nodes[numberFeasibleNodes-1]->status_; //double * sort = new double [numberFeasibleNodes]; //int * whichNode = new int [numberFeasibleNodes]; //int numberNodesNew=0; // use djs on previous unless feasible for (int iNode=0;iNodebranchValue_; int iStatus=sub->problemStatus_; int iColumn = sub->branchVariable_; bool secondBranch = (iStatus&2)!=0; bool branchUp; if (!secondBranch) branchUp = (iStatus&1)!=0; else branchUp = (iStatus&1)==0; double djValue=lastDjs[iColumn]; sub->djValue_=fabs(djValue); if (!branchUp&&floor(branchValue)==originalLower[iColumn] &&basis->getStructStatus(iColumn) == CoinWarmStartBasis::atLowerBound) { if (djValue>0.0) { // naturally goes to LB printf("ignoring branch down on %d (node %d) from value of %g - branch was %s - dj %g\n", iColumn,iNode,branchValue,secondBranch ? "second" : "first", djValue); sub->problemStatus_ |= 4; //} else { // put on list //sort[numberNodesNew]=djValue; //whichNode[numberNodesNew++]=iNode; } } else if (branchUp&&ceil(branchValue)==originalUpper[iColumn] &&basis->getStructStatus(iColumn) == CoinWarmStartBasis::atUpperBound) { if (djValue<0.0) { // naturally goes to UB printf("ignoring branch up on %d (node %d) from value of %g - branch was %s - dj %g\n", iColumn,iNode,branchValue,secondBranch ? "second" : "first", djValue); sub->problemStatus_ |= 4; //} else { // put on list //sort[numberNodesNew]=-djValue; //whichNode[numberNodesNew++]=iNode; } } } // use conflict to order nodes for (int iCut=0;iCutnumberIntegers() != model_->numberObjects() && (model_->numberObjects() || (model_->specialOptions()&1024) == 0)) { int numberOdd = 0; for (int i = 0; i < model_->numberObjects(); i++) { if (!model_->object(i)->canDoHeuristics()) numberOdd++; } if (numberOdd) setWhen(0); } } int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); delete [] downLocks_; delete [] upLocks_; downLocks_ = new unsigned short [numberIntegers]; upLocks_ = new unsigned short [numberIntegers]; // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); const double * rowLower = model_->solver()->getRowLower(); const double * rowUpper = model_->solver()->getRowUpper(); for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; int down = 0; int up = 0; if (columnLength[iColumn] > 65535) { setWhen(0); break; // unlikely to work } for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (rowLower[iRow] > -1.0e20 && rowUpper[iRow] < 1.0e20) { up++; down++; } else if (element[j] > 0.0) { if (rowUpper[iRow] < 1.0e20) up++; else down++; } else { if (rowLower[iRow] > -1.0e20) up++; else down++; } } downLocks_[i] = static_cast (down); upLocks_[i] = static_cast (up); } #ifdef DIVE_FIX_BINARY_VARIABLES selectBinaryVariables(); #endif } // Select candidate binary variables for fixing void CbcHeuristicDive::selectBinaryVariables() { // Row copy const double * elementByRow = matrixByRow_.getElements(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); const int numberRows = matrixByRow_.getNumRows(); const int numberCols = matrixByRow_.getNumCols(); const double * lower = model_->solver()->getColLower(); const double * upper = model_->solver()->getColUpper(); const double * rowLower = model_->solver()->getRowLower(); const double * rowUpper = model_->solver()->getRowUpper(); // const char * integerType = model_->integerType(); // const int numberIntegers = model_->numberIntegers(); // const int * integerVariable = model_->integerVariable(); const double * objective = model_->solver()->getObjCoefficients(); // vector to store the row number of variable bound rows int* rowIndexes = new int [numberCols]; memset(rowIndexes, -1, numberCols*sizeof(int)); for (int i = 0; i < numberRows; i++) { int positiveBinary = -1; int negativeBinary = -1; int nPositiveOther = 0; int nNegativeOther = 0; for (int k = rowStart[i]; k < rowStart[i] + rowLength[i]; k++) { int iColumn = column[k]; if (model_->solver()->isInteger(iColumn) && lower[iColumn] == 0.0 && upper[iColumn] == 1.0 && objective[iColumn] == 0.0 && elementByRow[k] > 0.0 && positiveBinary < 0) positiveBinary = iColumn; else if (model_->solver()->isInteger(iColumn) && lower[iColumn] == 0.0 && upper[iColumn] == 1.0 && objective[iColumn] == 0.0 && elementByRow[k] < 0.0 && negativeBinary < 0) negativeBinary = iColumn; else if ((elementByRow[k] > 0.0 && lower[iColumn] >= 0.0) || (elementByRow[k] < 0.0 && upper[iColumn] <= 0.0)) nPositiveOther++; else if ((elementByRow[k] > 0.0 && lower[iColumn] <= 0.0) || (elementByRow[k] < 0.0 && upper[iColumn] >= 0.0)) nNegativeOther++; if (nPositiveOther > 0 && nNegativeOther > 0) break; } int binVar = -1; if (positiveBinary >= 0 && (negativeBinary >= 0 || nNegativeOther > 0) && nPositiveOther == 0 && rowLower[i] == 0.0 && rowUpper[i] > 0.0) binVar = positiveBinary; else if (negativeBinary >= 0 && (positiveBinary >= 0 || nPositiveOther > 0) && nNegativeOther == 0 && rowLower[i] < 0.0 && rowUpper[i] == 0.0) binVar = negativeBinary; if (binVar >= 0) { if (rowIndexes[binVar] == -1) rowIndexes[binVar] = i; else if (rowIndexes[binVar] >= 0) rowIndexes[binVar] = -2; } } for (int j = 0; j < numberCols; j++) { if (rowIndexes[j] >= 0) { binVarIndex_.push_back(j); vbRowIndex_.push_back(rowIndexes[j]); } } #ifdef DIVE_DEBUG std::cout << "number vub Binary = " << binVarIndex_.size() << std::endl; #endif delete [] rowIndexes; } /* Perform reduced cost fixing on integer variables. The variables in question are already nonbasic at bound. We're just nailing down the current situation. */ int CbcHeuristicDive::reducedCostFix (OsiSolverInterface* solver) { //return 0; // temp #ifndef JJF_ONE if (!model_->solverCharacteristics()->reducedCostsAccurate()) return 0; //NLP #endif double cutoff = model_->getCutoff() ; if (cutoff > 1.0e20) return 0; #ifdef DIVE_DEBUG std::cout << "cutoff = " << cutoff << std::endl; #endif double direction = solver->getObjSense() ; double gap = cutoff - solver->getObjValue() * direction ; gap *= 0.5; // Fix more double tolerance; solver->getDblParam(OsiDualTolerance, tolerance) ; if (gap <= 0.0) gap = tolerance; //return 0; gap += 100.0 * tolerance; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); const double *lower = solver->getColLower() ; const double *upper = solver->getColUpper() ; const double *solution = solver->getColSolution() ; const double *reducedCost = solver->getReducedCost() ; int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); int numberFixed = 0 ; # ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver); ClpSimplex * clpSimplex = NULL; if (clpSolver) clpSimplex = clpSolver->getModelPtr(); # endif for (int i = 0 ; i < numberIntegers ; i++) { int iColumn = integerVariable[i] ; double djValue = direction * reducedCost[iColumn] ; if (upper[iColumn] - lower[iColumn] > integerTolerance) { if (solution[iColumn] < lower[iColumn] + integerTolerance && djValue > gap) { #ifdef COIN_HAS_CLP // may just have been fixed before if (clpSimplex) { if (clpSimplex->getColumnStatus(iColumn) == ClpSimplex::basic) { #ifdef COIN_DEVELOP printf("DJfix %d has status of %d, dj of %g gap %g, bounds %g %g\n", iColumn, clpSimplex->getColumnStatus(iColumn), djValue, gap, lower[iColumn], upper[iColumn]); #endif } else { assert(clpSimplex->getColumnStatus(iColumn) == ClpSimplex::atLowerBound || clpSimplex->getColumnStatus(iColumn) == ClpSimplex::isFixed); } } #endif solver->setColUpper(iColumn, lower[iColumn]) ; numberFixed++ ; } else if (solution[iColumn] > upper[iColumn] - integerTolerance && -djValue > gap) { #ifdef COIN_HAS_CLP // may just have been fixed before if (clpSimplex) { if (clpSimplex->getColumnStatus(iColumn) == ClpSimplex::basic) { #ifdef COIN_DEVELOP printf("DJfix %d has status of %d, dj of %g gap %g, bounds %g %g\n", iColumn, clpSimplex->getColumnStatus(iColumn), djValue, gap, lower[iColumn], upper[iColumn]); #endif } else { assert(clpSimplex->getColumnStatus(iColumn) == ClpSimplex::atUpperBound || clpSimplex->getColumnStatus(iColumn) == ClpSimplex::isFixed); } } #endif solver->setColLower(iColumn, upper[iColumn]) ; numberFixed++ ; } } } return numberFixed; } // Fix other variables at bounds int CbcHeuristicDive::fixOtherVariables(OsiSolverInterface * solver, const double * solution, PseudoReducedCost * candidate, const double * random) { const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); const double* reducedCost = solver->getReducedCost(); // fix other integer variables that are at their bounds int cnt = 0; #ifdef GAP double direction = solver->getObjSense(); // 1 for min, -1 for max double gap = 1.0e30; #endif #ifdef GAP double cutoff = model_->getCutoff() ; if (cutoff < 1.0e20 && false) { double direction = solver->getObjSense() ; gap = cutoff - solver->getObjValue() * direction ; gap *= 0.1; // Fix more if plausible double tolerance; solver->getDblParam(OsiDualTolerance, tolerance) ; if (gap <= 0.0) gap = tolerance; gap += 100.0 * tolerance; } int nOverGap = 0; #endif int numberFree = 0; int numberFixedAlready = 0; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (upper[iColumn] > lower[iColumn]) { numberFree++; double value = solution[iColumn]; if (fabs(floor(value + 0.5) - value) <= integerTolerance) { candidate[cnt].var = iColumn; candidate[cnt++].pseudoRedCost = fabs(reducedCost[iColumn] * random[i]); #ifdef GAP if (fabs(reducedCost[iColumn]) > gap) nOverGap++; #endif } } else { numberFixedAlready++; } } #ifdef GAP int nLeft = maxNumberToFix - numberFixedAlready; #ifdef CLP_INVESTIGATE4 printf("cutoff %g obj %g nover %d - %d free, %d fixed\n", cutoff, solver->getObjValue(), nOverGap, numberFree, numberFixedAlready); #endif if (nOverGap > nLeft && true) { nOverGap = CoinMin(nOverGap, nLeft + maxNumberToFix / 2); maxNumberToFix += nOverGap - nLeft; } #else #ifdef CLP_INVESTIGATE4 printf("cutoff %g obj %g - %d free, %d fixed\n", model_->getCutoff(), solver->getObjValue(), numberFree, numberFixedAlready); #endif #endif return cnt; } CoinMP-1.8.3/Cbc/src/CbcMessage.cpp0000644000175000017500000001405212432625130015272 0ustar renerene/* $Id: CbcMessage.cpp 2094 2014-11-18 11:15:36Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcMessage.hpp" #include typedef struct { CBC_Message internalNumber; int externalNumber; // or continuation char detail; const char * message; } Cbc_message; static Cbc_message us_english[] = { {CBC_END_GOOD, 1, 1, "Search completed - best objective %.16g, took %d iterations and %d nodes (%.2f seconds)"}, {CBC_MAXNODES, 3, 1, "Exiting on maximum nodes"}, {CBC_SOLUTION, 4, 1, "Integer solution of %g found after %d iterations and %d nodes (%.2f seconds)"}, {CBC_END, 5, 1, "Partial search - best objective %g (best possible %g), took %d iterations and %d nodes (%.2f seconds)"}, {CBC_INFEAS, 6, 1, "The LP relaxation is infeasible or too expensive"}, {CBC_STRONG, 7, 4, "Strong branching on %d (%d), down %g (%d) up %g (%d) value %g"}, {CBC_SOLINDIVIDUAL, 8, 2, "%d has value %g"}, {CBC_INTEGERINCREMENT, 9, 3, "Objective coefficients multiple of %g"}, {CBC_STATUS, 10, 1, "After %d nodes, %d on tree, %g best solution, best possible %g (%.2f seconds)"}, {CBC_GAP, 11, 1, "Exiting as integer gap of %g less than %g or %g%%"}, {CBC_ROUNDING, 12, 1, "Integer solution of %g found by %s after %d iterations and %d nodes (%.2f seconds)"}, {CBC_ROOT, 13, 1, "At root node, %d cuts changed objective from %g to %g in %d passes"}, {CBC_GENERATOR, 14, 1, "Cut generator %d (%s) - %d row cuts average %.1f elements, %d column cuts (%d active) %? in %.3f seconds - new frequency is %d"}, {CBC_BRANCH, 15, 3, "Node %d Obj %g Unsat %d depth %d"}, {CBC_STRONGSOL, 16, 1, "Integer solution of %g found by strong branching after %d iterations and %d nodes (%.2f seconds)"}, {CBC_VUB_PASS, 17, 1, "%d solved, %d variables fixed, %d tightened"}, {CBC_VUB_END, 18, 1, "After tightenVubs, %d variables fixed, %d tightened"}, {CBC_MAXSOLS, 19, 1, "Exiting on maximum solutions"}, {CBC_MAXTIME, 20, 1, "Exiting on maximum time"}, {CBC_NOTFEAS1, 21, 2, "On closer inspection node is infeasible"}, {CBC_NOTFEAS2, 22, 2, "On closer inspection objective value of %g above cutoff of %g"}, {CBC_NOTFEAS3, 23, 2, "Allowing solution, even though largest row infeasibility is %g"}, {CBC_TREE_SOL, 24, 1, "Integer solution of %g found by subtree after %d iterations and %d nodes (%.2f seconds)"}, {CBC_ITERATE_STRONG, 25, 3, "%d cleanup iterations before strong branching"}, {CBC_PRIORITY, 26, 1, "Setting priorities for objects %d to %d inclusive (out of %d)"}, {CBC_EVENT, 27, 1, "Exiting on user event"}, {CBC_START_SUB, 28, 1, "Starting sub-tree for %s - maximum nodes %d"}, {CBC_END_SUB, 29, 1, "Ending sub-tree for %s"}, {CBC_THREAD_STATS, 30, 1, "%s%? %d used %d times, waiting to start %g, %?%g cpu time,%? %g waiting for threads, %? %d locks, %g locked, %g waiting for locks"}, {CBC_CUTS_STATS, 31, 1, "%d added rows had average density of %g"}, {CBC_STRONG_STATS, 32, 1, "Strong branching done %d times (%d iterations), fathomed %d nodes and fixed %d variables"}, {CBC_SOLUTION2, 33, 1, "Integer solution of %g found (by alternate solver) after %d iterations and %d nodes (%.2f seconds)"}, {CBC_UNBOUNDED, 34, 1, "The LP relaxation is unbounded!"}, {CBC_OTHER_STATS, 35, 1, "Maximum depth %d, %g variables fixed on reduced cost"}, {CBC_HEURISTICS_OFF, 36, 1, "Heuristics switched off as %d branching objects are of wrong type"}, {CBC_STATUS2, 37, 1, "%d nodes, %d on tree, best %g - possible %g depth %d unsat %d value %g its %d (%.2f seconds)"}, {CBC_FPUMP1, 38, 1, "%s"}, {CBC_FPUMP2, 39, 2, "%s"}, {CBC_STATUS3, 40, 1, "%d nodes (+%d/%d), %d on tree, best %g - possible %g depth %d unsat %d its %d (+%d) (%.2f seconds)"}, {CBC_OTHER_STATS2, 41, 1, "Maximum depth %d, %g variables fixed on reduced cost (complete fathoming %d times, %d nodes taking %d iterations)"}, {CBC_RELAXED1, 42, 1, "Possible objective of %.18g but variable %d is %g from integer value, integer tolerance %g"}, {CBC_RELAXED2, 43, 2, "Possible objective of %.18g but had to fudge solution with tolerance of %g - check scaling of problem?"}, {CBC_RESTART, 44, 1, "Reduced cost fixing - %d rows, %d columns - restarting search"}, {CBC_GENERAL, 45, 1, "%s"}, {CBC_ROOT_DETAIL, 46, 2, "Root node pass %d, %d rows, %d total tight cuts - objective %g"}, {CBC_CUTOFF_WARNING1, 47, 1, "Cutoff set to %g - equivalent to best solution of %g"}, {CBC_END_SOLUTION, 48, 2, "Final check on integer solution of %g found after %d iterations and %d nodes (%.2f seconds)"}, #ifndef NO_FATHOM_PRINT {CBC_FATHOM_CHANGE, 49, 1, "Complete fathoming at depth >= %d"}, #endif {CBC_MAXITERS, 50, 1, "Exiting on maximum number of iterations"}, {CBC_NOINT, 3007, 1, "No integer variables - nothing to do"}, {CBC_WARNING_STRONG, 3008, 1, "Strong branching is fixing too many variables, too expensively!"}, {CBC_DUMMY_END, 999999, 0, ""} }; /* Constructor */ CbcMessage::CbcMessage(Language language) : CoinMessages(sizeof(us_english) / sizeof(Cbc_message)) { language_ = language; strcpy(source_, "Cbc"); class_ = 0; // branch and bound Cbc_message * message = us_english; while (message->internalNumber != CBC_DUMMY_END) { CoinOneMessage oneMessage(message->externalNumber, message->detail, message->message); addMessage(message->internalNumber, oneMessage); message ++; } // Put into compact form toCompact(); // now override any language ones //switch (language) { //default: message = NULL; // break; //} // replace if any found if (message) { while (message->internalNumber != CBC_DUMMY_END) { replaceMessage(message->internalNumber, message->message); message ++; } } } CoinMP-1.8.3/Cbc/src/CbcBranchAllDifferent.cpp0000644000175000017500000001047012131054770017365 0ustar renerene// $Id: CbcBranchAllDifferent.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/13/2009-- carved out of CbcBranchCut #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchCut.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" #include "CbcBranchAllDifferent.hpp" /** Default Constructor */ CbcBranchAllDifferent::CbcBranchAllDifferent () : CbcBranchCut(), numberInSet_(0), which_(NULL) { } /* Useful constructor - passed set of variables */ CbcBranchAllDifferent::CbcBranchAllDifferent (CbcModel * model, int numberInSet, const int * members) : CbcBranchCut(model) { numberInSet_ = numberInSet; which_ = CoinCopyOfArray(members, numberInSet_); } // Copy constructor CbcBranchAllDifferent::CbcBranchAllDifferent ( const CbcBranchAllDifferent & rhs) : CbcBranchCut(rhs) { numberInSet_ = rhs.numberInSet_; which_ = CoinCopyOfArray(rhs.which_, numberInSet_); } // Clone CbcObject * CbcBranchAllDifferent::clone() const { return new CbcBranchAllDifferent(*this); } // Assignment operator CbcBranchAllDifferent & CbcBranchAllDifferent::operator=( const CbcBranchAllDifferent & rhs) { if (this != &rhs) { CbcBranchCut::operator=(rhs); delete [] which_; numberInSet_ = rhs.numberInSet_; which_ = CoinCopyOfArray(rhs.which_, numberInSet_); } return *this; } // Destructor CbcBranchAllDifferent::~CbcBranchAllDifferent () { delete [] which_; } CbcBranchingObject * CbcBranchAllDifferent::createCbcBranch(OsiSolverInterface * /*solver*/ , const OsiBranchingInformation * /*info*/, int /*way*/) { // by default way must be -1 //assert (way==-1); const double * solution = model_->testSolution(); double * values = new double[numberInSet_]; int * which = new int[numberInSet_]; int i; for (i = 0; i < numberInSet_; i++) { int iColumn = which_[i]; values[i] = solution[iColumn]; which[i] = iColumn; } CoinSort_2(values, values + numberInSet_, which); double last = -1.0; double closest = 1.0; int worst = -1; for (i = 0; i < numberInSet_; i++) { if (values[i] - last < closest) { closest = values[i] - last; worst = i - 1; } last = values[i]; } assert (closest <= 0.99999); OsiRowCut down; down.setLb(-COIN_DBL_MAX); down.setUb(-1.0); int pair[2]; double elements[] = {1.0, -1.0}; pair[0] = which[worst]; pair[1] = which[worst+1]; delete [] values; delete [] which; down.setRow(2, pair, elements); // up is same - just with rhs changed OsiRowCut up = down; up.setLb(1.0); up.setUb(COIN_DBL_MAX); // Say is not a fix type branch CbcCutBranchingObject * newObject = new CbcCutBranchingObject(model_, down, up, false); if (model_->messageHandler()->logLevel() > 1) printf("creating cut in CbcBranchCut\n"); return newObject; } double CbcBranchAllDifferent::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { preferredWay = -1; //OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); double * values = new double[numberInSet_]; int i; for (i = 0; i < numberInSet_; i++) { int iColumn = which_[i]; values[i] = solution[iColumn]; } std::sort(values, values + numberInSet_); double last = -1.0; double closest = 1.0; for (i = 0; i < numberInSet_; i++) { if (values[i] - last < closest) { closest = values[i] - last; } last = values[i]; } delete [] values; if (closest > 0.99999) return 0.0; else return 0.5*(1.0 - closest); } CoinMP-1.8.3/Cbc/src/CbcGenOsiParam.hpp0000644000175000017500000001306012131054770016060 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenOsiParam.hpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #ifndef CbcOsiParam_H #define CbcOsiParam_H /* \file CbcGenOsiParam.hpp \brief Declarations for parameters that act on a OsiSolverInterface object. */ /* $Id: CbcGenOsiParam.hpp 1899 2013-04-09 18:12:08Z stefan $ */ /*! \class CbcOsiParam \brief Class for control parameters that act on a OsiSolverInterface object. Adds parameter type codes and push/pull functions to the generic parameter object. */ class CbcOsiParam : public CoinParam { public: /*! \name Subtypes */ //@{ /*! \enum CbcOsiParamCode \brief Enumeration for parameters that control an OsiSolverInterface object These are parameters that control the operation of an OsiSolverInterface object. CBCOSI_FIRSTPARAM and CBCOSI_LASTPARAM are markers to allow convenient separation of parameter groups. */ typedef enum { CBCOSI_FIRSTPARAM = CbcCbcParam::CBCCBC_LASTPARAM + 1, ALGORITHM, ALLSLACK, AUTOSCALE, BARRIER, BARRIERSCALE, BASISIN, BASISOUT, BIASLU, CHOLESKY, CRASH, CROSSOVER, DUALBOUND, DUALPIVOT, DUALSIMPLEX, DUALTOLERANCE, FAKEBOUND, GAMMA, IDIOT, KEEPNAMES, KKT, MAXITERATION, MAXHOTITS, NETLIB_BARRIER, NETLIB_DUAL, NETLIB_PRIMAL, NETWORK, OBJSCALE, PERTURBATION, PERTVALUE, PFI, PLUSMINUS, PRESOLVE, PRESOLVEOPTIONS, PRESOLVEPASS, PRIMALPIVOT, PRIMALSIMPLEX, PRIMALTOLERANCE, REALLY_SCALE, RESTORE, REVERSE, RHSSCALE, SAVE, SCALING, SLPVALUE, SOLVERLOGLEVEL, SPARSEFACTOR, SPECIALOPTIONS, SPRINT, TIGHTEN, CBCOSI_LASTPARAM } CbcOsiParamCode ; //@} /*! \name Constructors and Destructors Be careful how you specify parameters for the constructors! There's great potential for confusion. */ //@{ /*! \brief Default constructor */ CbcOsiParam() ; /*! \brief Constructor for a parameter with a double value The default value is 0.0. Be careful to clearly indicate that \p lower and \p upper are real (double) values to distinguish this constructor from the constructor for an integer parameter. */ CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help, double lower, double upper, double dflt = 0.0, bool display = true) ; /*! \brief Constructor for a parameter with an integer value The default value is 0. */ CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help, int lower, int upper, int dflt = 0, bool display = true) ; /*! \brief Constructor for a parameter with keyword values The string supplied as \p firstValue becomes the first keyword. Additional keywords can be added using appendKwd(). Keywords are numbered from zero. It's necessary to specify both the first keyword (\p firstValue) and the default keyword index (\p dflt) in order to distinguish this constructor from the string and action parameter constructors. */ CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help, std::string firstValue, int dflt, bool display = true) ; /*! \brief Constructor for a string parameter The default string value must be specified explicitly to distinguish a string constructor from an action parameter constructor. */ CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help, std::string dflt, bool display = true) ; /*! \brief Constructor for an action parameter */ CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help, bool display = true) ; /*! \brief Copy constructor */ CbcOsiParam(const CbcOsiParam &orig) ; /*! \brief Clone */ CbcOsiParam *clone() ; /*! \brief Assignment */ CbcOsiParam &operator=(const CbcOsiParam &rhs) ; /*! \brief Destructor */ ~CbcOsiParam() ; //@} /*! \name Methods to query and manipulate a parameter object */ //@{ /*! \brief Get the parameter code */ inline CbcOsiParamCode paramCode() const { return (paramCode_) ; } /*! \brief Set the parameter code */ inline void setParamCode(CbcOsiParamCode code) { paramCode_ = code ; } /*! \brief Get the underlying OsiSolverInterface object */ inline OsiSolverInterface *obj() const { return (obj_) ; } /*! \brief Set the underlying OsiSolverInterace object */ inline void setObj(OsiSolverInterface *obj) { obj_ = obj ; } //@} private: /*! \name Data */ //@{ /// Parameter code CbcOsiParamCode paramCode_ ; /// OsiSolverInterface object OsiSolverInterface *obj_ ; //@} } ; /* Declare the utility functions. */ namespace CbcOsiParamUtils { void addCbcOsiParams(int &numParams, CoinParamVec ¶mVec, OsiSolverInterface *osi) ; void loadOsiParamObj(const CoinParamVec paramVec, CbcGenCtlBlk *ctlBlk) ; void setOsiSolverInterfaceDefaults(OsiSolverInterface *osi) ; int pushCbcOsiLogLevel(CoinParam *param) ; int pushCbcOsiInt(CoinParam *param) ; int pushCbcOsiDbl(CoinParam *param) ; int pushCbcOsiKwd(CoinParam *param) ; int pushCbcOsiHint(CoinParam *param) ; } #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicGreedy.hpp0000644000175000017500000002113611513124702017011 0ustar renerene/* $Id: CbcHeuristicGreedy.hpp 1585 2011-01-11 19:04:34Z forrest $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicGreedy_H #define CbcHeuristicGreedy_H #include "CbcHeuristic.hpp" /** Greedy heuristic classes */ class CbcHeuristicGreedyCover : public CbcHeuristic { public: // Default Constructor CbcHeuristicGreedyCover (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicGreedyCover (CbcModel & model); // Copy constructor CbcHeuristicGreedyCover ( const CbcHeuristicGreedyCover &); // Destructor ~CbcHeuristicGreedyCover (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicGreedyCover & operator=(const CbcHeuristicGreedyCover& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) We leave all variables which are at one at this node of the tree to that value and will initially set all others to zero. We then sort all variables in order of their cost divided by the number of entries in rows which are not yet covered. We randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic. We then choose the best one and set it to one and repeat the exercise. */ virtual int solution(double & objectiveValue, double * newSolution); /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) virtual void validate() ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /* Algorithm 0 - use current upper bounds 1 - use original upper bounds If 10 added perturb ratios more if 100 added round up all >=0.5 */ inline int algorithm() const { return algorithm_; } inline void setAlgorithm(int value) { algorithm_ = value; } // Only do this many times inline int numberTimes() const { return numberTimes_; } inline void setNumberTimes(int value) { numberTimes_ = value; } protected: /// Guts of constructor from a CbcModel void gutsOfConstructor(CbcModel * model); // Data // Original matrix by column CoinPackedMatrix matrix_; // original number of rows int originalNumberRows_; /* Algorithm 0 - use current upper bounds 1 - use original upper bounds If 10 added perturb ratios more */ int algorithm_; /// Do this many times int numberTimes_; }; class CbcHeuristicGreedyEquality : public CbcHeuristic { public: // Default Constructor CbcHeuristicGreedyEquality (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicGreedyEquality (CbcModel & model); // Copy constructor CbcHeuristicGreedyEquality ( const CbcHeuristicGreedyEquality &); // Destructor ~CbcHeuristicGreedyEquality (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicGreedyEquality & operator=(const CbcHeuristicGreedyEquality& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) We leave all variables which are at one at this node of the tree to that value and will initially set all others to zero. We then sort all variables in order of their cost divided by the number of entries in rows which are not yet covered. We randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic. We then choose the best one and set it to one and repeat the exercise. */ virtual int solution(double & objectiveValue, double * newSolution); /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) virtual void validate() ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /* Algorithm 0 - use current upper bounds 1 - use original upper bounds If 10 added perturb ratios more if 100 added round up all >=0.5 */ inline int algorithm() const { return algorithm_; } inline void setAlgorithm(int value) { algorithm_ = value; } // Fraction of rhs to cover before branch and cut inline void setFraction(double value) { fraction_ = value; } inline double fraction() const { return fraction_; } // Only do this many times inline int numberTimes() const { return numberTimes_; } inline void setNumberTimes(int value) { numberTimes_ = value; } protected: /// Guts of constructor from a CbcModel void gutsOfConstructor(CbcModel * model); // Data // Original matrix by column CoinPackedMatrix matrix_; // Fraction of rhs to cover before branch and cut double fraction_; // original number of rows int originalNumberRows_; /* Algorithm 0 - use current upper bounds 1 - use original upper bounds If 10 added perturb ratios more */ int algorithm_; /// Do this many times int numberTimes_; }; /** Greedy heuristic for SOS and L rows (and positive elements) */ class CbcHeuristicGreedySOS : public CbcHeuristic { public: // Default Constructor CbcHeuristicGreedySOS (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicGreedySOS (CbcModel & model); // Copy constructor CbcHeuristicGreedySOS ( const CbcHeuristicGreedySOS &); // Destructor ~CbcHeuristicGreedySOS (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicGreedySOS & operator=(const CbcHeuristicGreedySOS& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) We leave all variables which are at one at this node of the tree to that value and will initially set all others to zero. We then sort all variables in order of their cost divided by the number of entries in rows which are not yet covered. We randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic. We then choose the best one and set it to one and repeat the exercise. */ virtual int solution(double & objectiveValue, double * newSolution); /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) virtual void validate() ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /* Algorithm Bits 1 bit - use current model, otherwise original 2 - use current solution as starting point, otherwise pure greedy 4 - as 2 but use merit not merit/size 8 - use duals to modify greedy 16 - use duals on GUB/SOS in special way */ inline int algorithm() const { return algorithm_; } inline void setAlgorithm(int value) { algorithm_ = value; } // Only do this many times inline int numberTimes() const { return numberTimes_; } inline void setNumberTimes(int value) { numberTimes_ = value; } protected: /// Guts of constructor from a CbcModel void gutsOfConstructor(CbcModel * model); // Data // Original RHS - if -1.0 then SOS otherwise <= value double * originalRhs_; // Original matrix by column CoinPackedMatrix matrix_; // original number of rows int originalNumberRows_; /* Algorithm */ int algorithm_; /// Do this many times int numberTimes_; }; #endif CoinMP-1.8.3/Cbc/src/CbcCompareEstimate.cpp0000644000175000017500000000354012131054770016772 0ustar renerene// $Id: CbcCompareEstimate.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCompareActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CbcMessage.hpp" #include "CbcModel.hpp" #include "CbcTree.hpp" #include "CbcCompareActual.hpp" #include "CoinError.hpp" #include "CbcCompareEstimate.hpp" /** Default Constructor */ CbcCompareEstimate::CbcCompareEstimate () : CbcCompareBase() { test_ = this; } // Copy constructor CbcCompareEstimate::CbcCompareEstimate ( const CbcCompareEstimate & rhs) : CbcCompareBase(rhs) { } // Clone CbcCompareBase * CbcCompareEstimate::clone() const { return new CbcCompareEstimate(*this); } // Assignment operator CbcCompareEstimate & CbcCompareEstimate::operator=( const CbcCompareEstimate & rhs) { if (this != &rhs) { CbcCompareBase::operator=(rhs); } return *this; } // Destructor CbcCompareEstimate::~CbcCompareEstimate () { } // Returns true if y better than x bool CbcCompareEstimate::test (CbcNode * x, CbcNode * y) { double testX = x->guessedObjectiveValue(); double testY = y->guessedObjectiveValue(); if (testX != testY) return testX > testY; else return equalityTest(x, y); // so ties will be broken in consistent manner } // Create C++ lines to get to current state void CbcCompareEstimate::generateCpp( FILE * fp) { fprintf(fp, "0#include \"CbcCompareActual.hpp\"\n"); fprintf(fp, "3 CbcCompareEstimate compare;\n"); fprintf(fp, "3 cbcModel->setNodeComparison(compare);\n"); } CoinMP-1.8.3/Cbc/src/CbcEventHandler.cpp0000644000175000017500000000716312172722151016274 0ustar renerene/* $Id: CbcEventHandler.cpp 1943 2013-07-21 09:05:45Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Shamelessly adapted from ClpEventHandler. #include "CoinPragma.hpp" #include "CbcEventHandler.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CbcEventHandler::CbcEventHandler (CbcModel *model) : model_(model), dfltAction_(CbcEventHandler::noAction), eaMap_(0) { /* nothing more required */ } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- /* Here we need to clone the event/action map, if it exists */ CbcEventHandler::CbcEventHandler (const CbcEventHandler & rhs) : model_(rhs.model_), dfltAction_(rhs.dfltAction_), eaMap_(0) { if (rhs.eaMap_ != 0) { eaMap_ = new eaMapPair(*rhs.eaMap_) ; } } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcEventHandler& CbcEventHandler::operator=(const CbcEventHandler & rhs) { if (this != &rhs) { model_ = rhs.model_ ; dfltAction_ = rhs.dfltAction_ ; if (rhs.eaMap_ != 0) { eaMap_ = new eaMapPair(*rhs.eaMap_) ; } else { eaMap_ = 0 ; } } return (*this) ; } //---------------------------------------------------------------- // Clone //------------------------------------------------------------------- CbcEventHandler* CbcEventHandler::clone() const { return (new CbcEventHandler(*this)) ; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- /* Take care to free the event/action map. */ CbcEventHandler::~CbcEventHandler () { if (eaMap_ != 0) delete eaMap_ ; } //------------------------------------------------------------------- // event() -- return the action for an event. //------------------------------------------------------------------- CbcEventHandler::CbcAction CbcEventHandler::event(CbcEvent event) /* If an event/action map exists and contains an entry for the event, return it. Otherwise return the default action. */ { if (eaMap_ != 0) { eaMapPair::iterator entry = eaMap_->find(event) ; if (entry != eaMap_->end()) { return (entry->second) ; } else { return (dfltAction_) ; } } else { return (dfltAction_) ; } } //------------------------------------------------------------------- // event() -- return the action for an event. //------------------------------------------------------------------- CbcEventHandler::CbcAction CbcEventHandler::event(CbcEvent event, void * /*data*/) /* If an event/action map exists and contains an entry for the event, return it. Otherwise return the default action. */ { if (eaMap_ != 0) { eaMapPair::iterator entry = eaMap_->find(event) ; if (entry != eaMap_->end()) { return (entry->second) ; } else { return (dfltAction_) ; } } else { return (dfltAction_) ; } } CoinMP-1.8.3/Cbc/src/CbcSimpleInteger.cpp0000644000175000017500000005723512172722151016471 0ustar renerene// $Id: CbcSimpleInteger.cpp 1943 2013-07-21 09:05:45Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/9/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcSimpleInteger.hpp" #include "CbcSimpleIntegerDynamicPseudoCost.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## /** Default Constructor Equivalent to an unspecified binary variable. */ CbcSimpleInteger::CbcSimpleInteger () : CbcObject(), originalLower_(0.0), originalUpper_(1.0), breakEven_(0.5), columnNumber_(-1), preferredWay_(0) { } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ CbcSimpleInteger::CbcSimpleInteger ( CbcModel * model, int iColumn, double breakEven) : CbcObject(model) { columnNumber_ = iColumn ; originalLower_ = model->solver()->getColLower()[columnNumber_] ; originalUpper_ = model->solver()->getColUpper()[columnNumber_] ; breakEven_ = breakEven; assert (breakEven_ > 0.0 && breakEven_ < 1.0); preferredWay_ = 0; } // Copy constructor CbcSimpleInteger::CbcSimpleInteger ( const CbcSimpleInteger & rhs) : CbcObject(rhs) { columnNumber_ = rhs.columnNumber_; originalLower_ = rhs.originalLower_; originalUpper_ = rhs.originalUpper_; breakEven_ = rhs.breakEven_; preferredWay_ = rhs.preferredWay_; } // Clone CbcObject * CbcSimpleInteger::clone() const { return new CbcSimpleInteger(*this); } // Assignment operator CbcSimpleInteger & CbcSimpleInteger::operator=( const CbcSimpleInteger & rhs) { if (this != &rhs) { CbcObject::operator=(rhs); columnNumber_ = rhs.columnNumber_; originalLower_ = rhs.originalLower_; originalUpper_ = rhs.originalUpper_; breakEven_ = rhs.breakEven_; preferredWay_ = rhs.preferredWay_; } return *this; } // Destructor CbcSimpleInteger::~CbcSimpleInteger () { } // Construct an OsiSimpleInteger object OsiSimpleInteger * CbcSimpleInteger::osiObject() const { OsiSimpleInteger * obj = new OsiSimpleInteger(columnNumber_, originalLower_, originalUpper_); obj->setPriority(priority()); return obj; } double CbcSimpleInteger::infeasibility(const OsiBranchingInformation * info, int &preferredWay) const { double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); double nearest = floor(value + (1.0 - breakEven_)); assert (breakEven_ > 0.0 && breakEven_ < 1.0); if (nearest > value) preferredWay = 1; else preferredWay = -1; if (preferredWay_) preferredWay = preferredWay_; double weight = fabs(value - nearest); // normalize so weight is 0.5 at break even if (nearest < value) weight = (0.5 / breakEven_) * weight; else weight = (0.5 / (1.0 - breakEven_)) * weight; if (fabs(value - nearest) <= info->integerTolerance_) return 0.0; else return weight; } double CbcSimpleInteger::feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const { double value = info->solution_[columnNumber_]; #ifdef COIN_DEVELOP if (fabs(value - floor(value + 0.5)) > 1.0e-5) printf("value for %d away from integer %g\n", columnNumber_, value); #endif double newValue = CoinMax(value, info->lower_[columnNumber_]); newValue = CoinMin(newValue, info->upper_[columnNumber_]); newValue = floor(newValue + 0.5); solver->setColLower(columnNumber_, newValue); solver->setColUpper(columnNumber_, newValue); #ifdef SWITCH_VARIABLES const CbcSwitchingBinary * sObject = dynamic_cast (this); if (sObject) sObject->setAssociatedBounds(solver,1); #endif return fabs(value - newValue); } /* Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ OsiSolverBranch * CbcSimpleInteger::solverBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * info) const { double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); assert (info->upper_[columnNumber_] > info->lower_[columnNumber_]); #ifndef NDEBUG double nearest = floor(value + 0.5); assert (fabs(value - nearest) > info->integerTolerance_); #endif OsiSolverBranch * branch = new OsiSolverBranch(); branch->addBranch(columnNumber_, value); return branch; } // Creates a branching object CbcBranchingObject * CbcSimpleInteger::createCbcBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * info, int way) { CbcIntegerBranchingObject * branch = new CbcIntegerBranchingObject(model_, 0, -1, 0.5); fillCreateBranch(branch, info, way); return branch; } // Fills in a created branching object void CbcSimpleInteger::fillCreateBranch(CbcIntegerBranchingObject * branch, const OsiBranchingInformation * info, int way) { branch->setOriginalObject(this); double value = info->solution_[columnNumber_]; value = CoinMax(value, info->lower_[columnNumber_]); value = CoinMin(value, info->upper_[columnNumber_]); assert (info->upper_[columnNumber_] > info->lower_[columnNumber_]); if (!info->hotstartSolution_ && priority_ != -999) { #if 0 // out because of very strong branching ndef NDEBUG double nearest = floor(value + 0.5); assert (fabs(value - nearest) > info->integerTolerance_); #endif } else if (info->hotstartSolution_) { double targetValue = info->hotstartSolution_[columnNumber_]; if (way > 0) value = targetValue - 0.1; else value = targetValue + 0.1; } else { if (value <= info->lower_[columnNumber_]) value += 0.1; else if (value >= info->upper_[columnNumber_]) value -= 0.1; } assert (value >= info->lower_[columnNumber_] && value <= info->upper_[columnNumber_]); branch->fillPart(columnNumber_, way, value); } /* Column number if single column object -1 otherwise, so returns >= 0 Used by heuristics */ int CbcSimpleInteger::columnNumber() const { return columnNumber_; } /* Reset variable bounds to their original values. Bounds may be tightened, so it may be good to be able to set this info in object. */ void CbcSimpleInteger::resetBounds(const OsiSolverInterface * solver) { originalLower_ = solver->getColLower()[columnNumber_] ; originalUpper_ = solver->getColUpper()[columnNumber_] ; } /* Change column numbers after preprocessing */ void CbcSimpleInteger::resetSequenceEtc(int /*numberColumns*/, const int * originalColumns) { //assert (numberColumns>0); int iColumn; #ifdef JJF_ZERO for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnNumber_ == originalColumns[iColumn]) break; } assert (iColumn < numberColumns); #else iColumn = originalColumns[columnNumber_]; assert (iColumn >= 0); #endif columnNumber_ = iColumn; } // This looks at solution and sets bounds to contain solution /** More precisely: it first forces the variable within the existing bounds, and then tightens the bounds to fix the variable at the nearest integer value. */ void CbcSimpleInteger::feasibleRegion() { abort(); } //############################################################################## // Default Constructor CbcIntegerBranchingObject::CbcIntegerBranchingObject() : CbcBranchingObject() { down_[0] = 0.0; down_[1] = 0.0; up_[0] = 0.0; up_[1] = 0.0; #ifdef FUNNY_BRANCHING2 variables_ = NULL; newBounds_ = NULL; numberExtraChangedBounds_ = 0; #endif } // Useful constructor CbcIntegerBranchingObject::CbcIntegerBranchingObject (CbcModel * model, int variable, int way , double value) : CbcBranchingObject(model, variable, way, value) { int iColumn = variable; assert (model_->solver()->getNumCols() > 0); down_[0] = model_->solver()->getColLower()[iColumn]; down_[1] = floor(value_); up_[0] = ceil(value_); up_[1] = model->getColUpper()[iColumn]; #ifdef FUNNY_BRANCHING2 variables_ = NULL; newBounds_ = NULL; numberExtraChangedBounds_ = 0; #endif } // Does part of constructor void CbcIntegerBranchingObject::fillPart (int variable, int way , double value) { //originalObject_=NULL; branchIndex_ = 0; value_ = value; numberBranches_ = 2; //model_= model; //originalCbcObject_=NULL; variable_ = variable; way_ = way; int iColumn = variable; down_[0] = model_->solver()->getColLower()[iColumn]; down_[1] = floor(value_); up_[0] = ceil(value_); up_[1] = model_->getColUpper()[iColumn]; // fix extreme cases if (up_[0]==1.0) down_[1]=0.0; if (down_[1]==0.0) up_[0]=1.0; } // Useful constructor for fixing CbcIntegerBranchingObject::CbcIntegerBranchingObject (CbcModel * model, int variable, int way, double lowerValue, double upperValue) : CbcBranchingObject(model, variable, way, lowerValue) { setNumberBranchesLeft(1); down_[0] = lowerValue; down_[1] = upperValue; up_[0] = lowerValue; up_[1] = upperValue; #ifdef FUNNY_BRANCHING2 variables_ = NULL; newBounds_ = NULL; numberExtraChangedBounds_ = 0; #endif } // Copy constructor CbcIntegerBranchingObject::CbcIntegerBranchingObject ( const CbcIntegerBranchingObject & rhs) : CbcBranchingObject(rhs) { down_[0] = rhs.down_[0]; down_[1] = rhs.down_[1]; up_[0] = rhs.up_[0]; up_[1] = rhs.up_[1]; #ifdef FUNNY_BRANCHING2 numberExtraChangedBounds_ = rhs.numberExtraChangedBounds_; int size = numberExtraChangedBounds_ * (sizeof(double) + sizeof(int)); char * temp = new char [size]; newBounds_ = (double *) temp; variables_ = (int *) (newBounds_ + numberExtraChangedBounds_); int i ; for (i = 0; i < numberExtraChangedBounds_; i++) { variables_[i] = rhs.variables_[i]; newBounds_[i] = rhs.newBounds_[i]; } #endif } // Assignment operator CbcIntegerBranchingObject & CbcIntegerBranchingObject::operator=( const CbcIntegerBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); down_[0] = rhs.down_[0]; down_[1] = rhs.down_[1]; up_[0] = rhs.up_[0]; up_[1] = rhs.up_[1]; #ifdef FUNNY_BRANCHING2 delete [] newBounds_; numberExtraChangedBounds_ = rhs.numberExtraChangedBounds_; int size = numberExtraChangedBounds_ * (sizeof(double) + sizeof(int)); char * temp = new char [size]; newBounds_ = (double *) temp; variables_ = (int *) (newBounds_ + numberExtraChangedBounds_); int i ; for (i = 0; i < numberExtraChangedBounds_; i++) { variables_[i] = rhs.variables_[i]; newBounds_[i] = rhs.newBounds_[i]; } #endif } return *this; } CbcBranchingObject * CbcIntegerBranchingObject::clone() const { return (new CbcIntegerBranchingObject(*this)); } // Destructor CbcIntegerBranchingObject::~CbcIntegerBranchingObject () { // for debugging threads way_ = -23456789; #ifdef FUNNY_BRANCHING2 delete [] newBounds_; #endif } /* Perform a branch by adjusting the bounds of the specified variable. Note that each arm of the branch advances the object to the next arm by advancing the value of way_. Providing new values for the variable's lower and upper bounds for each branching direction gives a little bit of additional flexibility and will be easily extensible to multi-way branching. Returns change in guessed objective on next branch */ double CbcIntegerBranchingObject::branch() { // for debugging threads if (way_ < -1 || way_ > 100000) { printf("way %d, left %d, iCol %d, variable %d\n", way_, numberBranchesLeft(), originalCbcObject_->columnNumber(), variable_); assert (way_ != -23456789); } decrementNumberBranchesLeft(); if (down_[1] == -COIN_DBL_MAX) return 0.0; int iColumn = originalCbcObject_->columnNumber(); assert (variable_ == iColumn); double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; //#define CBCSIMPLE_TIGHTEN_BOUNDS #ifndef CBCSIMPLE_TIGHTEN_BOUNDS #ifdef COIN_DEVELOP if (olb != down_[0] || oub != up_[1]) { if (way_ > 0) printf("branching up on var %d: [%g,%g] => [%g,%g] - other [%g,%g]\n", iColumn, olb, oub, up_[0], up_[1], down_[0], down_[1]) ; else printf("branching down on var %d: [%g,%g] => [%g,%g] - other [%g,%g]\n", iColumn, olb, oub, down_[0], down_[1], up_[0], up_[1]) ; } #endif #endif if (way_ < 0) { #ifdef CBC_DEBUG { double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; printf("branching down on var %d: [%g,%g] => [%g,%g]\n", iColumn, olb, oub, down_[0], down_[1]) ; } #endif #ifndef CBCSIMPLE_TIGHTEN_BOUNDS model_->solver()->setColLower(iColumn, down_[0]); #else model_->solver()->setColLower(iColumn, CoinMax(down_[0], olb)); #endif model_->solver()->setColUpper(iColumn, down_[1]); //#define CBC_PRINT2 #ifdef CBC_PRINT2 printf("%d branching down has bounds %g %g", iColumn, down_[0], down_[1]); #endif #ifdef FUNNY_BRANCHING2 // branch - do extra bounds for (int i = 0; i < numberExtraChangedBounds_; i++) { int variable = variables_[i]; if ((variable&0x40000000) != 0) { // for going down int k = variable & 0x3fffffff; assert (k != iColumn); if ((variable&0x80000000) == 0) { // lower bound changing #ifdef CBC_PRINT2 printf(" extra for %d changes lower from %g to %g", k, model_->solver()->getColLower()[k], newBounds_[i]); #endif model_->solver()->setColLower(k, newBounds_[i]); } else { // upper bound changing #ifdef CBC_PRINT2 printf(" extra for %d changes upper from %g to %g", k, model_->solver()->getColUpper()[k], newBounds_[i]); #endif model_->solver()->setColUpper(k, newBounds_[i]); } } } #endif #ifdef CBC_PRINT2 printf("\n"); #endif way_ = 1; } else { #ifdef CBC_DEBUG { double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; printf("branching up on var %d: [%g,%g] => [%g,%g]\n", iColumn, olb, oub, up_[0], up_[1]) ; } #endif model_->solver()->setColLower(iColumn, up_[0]); #ifndef CBCSIMPLE_TIGHTEN_BOUNDS model_->solver()->setColUpper(iColumn, up_[1]); #else model_->solver()->setColUpper(iColumn, CoinMin(up_[1], oub)); #endif #ifdef CBC_PRINT2 printf("%d branching up has bounds %g %g", iColumn, up_[0], up_[1]); #endif #ifdef FUNNY_BRANCHING2 // branch - do extra bounds for (int i = 0; i < numberExtraChangedBounds_; i++) { int variable = variables_[i]; if ((variable&0x40000000) == 0) { // for going up int k = variable & 0x3fffffff; assert (k != iColumn); if ((variable&0x80000000) == 0) { // lower bound changing #ifdef CBC_PRINT2 printf(" extra for %d changes lower from %g to %g", k, model_->solver()->getColLower()[k], newBounds_[i]); #endif model_->solver()->setColLower(k, newBounds_[i]); } else { // upper bound changing #ifdef CBC_PRINT2 printf(" extra for %d changes upper from %g to %g", k, model_->solver()->getColUpper()[k], newBounds_[i]); #endif model_->solver()->setColUpper(k, newBounds_[i]); } } } #endif #ifdef CBC_PRINT2 printf("\n"); #endif way_ = -1; // Swap direction } double nlb = model_->solver()->getColLower()[iColumn]; double nub = model_->solver()->getColUpper()[iColumn]; if (nlb < olb) { #ifdef CBC_PRINT2 printf("bad lb change for column %d from %g to %g\n", iColumn, olb, nlb); #endif //abort(); model_->solver()->setColLower(iColumn, CoinMin(olb, nub)); nlb = olb; } if (nub > oub) { #ifdef CBC_PRINT2 printf("bad ub change for column %d from %g to %g\n", iColumn, oub, nub); #endif //abort(); model_->solver()->setColUpper(iColumn, CoinMax(oub, nlb)); } #ifdef CBC_PRINT2 if (nlb < olb + 1.0e-8 && nub > oub - 1.0e-8 && false) printf("bad null change for column %d - bounds %g,%g\n", iColumn, olb, oub); #endif #ifdef SWITCH_VARIABLES if (model_->logLevel()>2) printf("for column %d - old bounds %g,%g - new %g,%g\n", iColumn, olb, oub, nlb,nub); CbcSwitchingBinary * sObject = dynamic_cast (originalCbcObject_); if (sObject) sObject->setAssociatedBounds(); //(dynamic_cast(originalCbcObject_))->setAssociatedBounds(); #endif return 0.0; } /* Update bounds in solver as in 'branch' and update given bounds. branchState is -1 for 'down' +1 for 'up' */ void CbcIntegerBranchingObject::fix(OsiSolverInterface * /*solver*/, double * lower, double * upper, int branchState) const { int iColumn = originalCbcObject_->columnNumber(); assert (variable_ == iColumn); if (branchState < 0) { model_->solver()->setColLower(iColumn, down_[0]); lower[iColumn] = down_[0]; model_->solver()->setColUpper(iColumn, down_[1]); upper[iColumn] = down_[1]; } else { model_->solver()->setColLower(iColumn, up_[0]); lower[iColumn] = up_[0]; model_->solver()->setColUpper(iColumn, up_[1]); upper[iColumn] = up_[1]; } } // Change (tighten) bounds in object to reflect bounds in solver. // Return true if now fixed bool CbcIntegerBranchingObject::tighten(OsiSolverInterface * solver) { double lower = solver->getColLower()[variable_]; double upper = solver->getColUpper()[variable_]; assert (upper>lower); down_[0] = CoinMax(down_[0],lower); up_[0] = CoinMax(up_[0],lower); down_[1] = CoinMin(down_[1],upper); up_[1] = CoinMin(up_[1],upper); return (down_[0]==up_[1]); } #ifdef FUNNY_BRANCHING2 // Deactivate bounds for branching void CbcIntegerBranchingObject::deactivate() { down_[1] = -COIN_DBL_MAX; } int CbcIntegerBranchingObject::applyExtraBounds(int iColumn, double lower, double upper, int way) { // branch - do bounds int i; int found = 0; if (variable_ == iColumn) { printf("odd applyExtra %d\n", iColumn); if (way < 0) { down_[0] = CoinMax(lower, down_[0]); down_[1] = CoinMin(upper, down_[1]); assert (down_[0] <= down_[1]); } else { up_[0] = CoinMax(lower, up_[0]); up_[1] = CoinMin(upper, up_[1]); assert (up_[0] <= up_[1]); } return 0; } int check = (way < 0) ? 0x40000000 : 0; double newLower = lower; double newUpper = upper; for (i = 0; i < numberExtraChangedBounds_; i++) { int variable = variables_[i]; if ((variable&0x40000000) == check) { int k = variable & 0x3fffffff; if (k == iColumn) { if ((variable&0x80000000) == 0) { // lower bound changing found |= 1; newBounds_[i] = CoinMax(lower, newBounds_[i]); newLower = newBounds_[i]; } else { // upper bound changing found |= 2; newBounds_[i] = CoinMin(upper, newBounds_[i]); newUpper = newBounds_[i]; } } } } int nAdd = 0; if ((found&2) == 0) { // need to add new upper nAdd++; } if ((found&1) == 0) { // need to add new lower nAdd++; } if (nAdd) { int size = (numberExtraChangedBounds_ + nAdd) * (sizeof(double) + sizeof(int)); char * temp = new char [size]; double * newBounds = (double *) temp; int * variables = (int *) (newBounds + numberExtraChangedBounds_ + nAdd); int i ; for (i = 0; i < numberExtraChangedBounds_; i++) { variables[i] = variables_[i]; newBounds[i] = newBounds_[i]; } delete [] newBounds_; newBounds_ = newBounds; variables_ = variables; if ((found&2) == 0) { // need to add new upper int variable = iColumn | 0x80000000; variables_[numberExtraChangedBounds_] = variable; newBounds_[numberExtraChangedBounds_++] = newUpper; } if ((found&1) == 0) { // need to add new lower int variable = iColumn; variables_[numberExtraChangedBounds_] = variable; newBounds_[numberExtraChangedBounds_++] = newLower; } } return (newUpper >= newLower) ? 0 : 1; } #endif // Print what would happen void CbcIntegerBranchingObject::print() { int iColumn = originalCbcObject_->columnNumber(); assert (variable_ == iColumn); if (way_ < 0) { { double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; printf("CbcInteger would branch down on var %d (int var %d): [%g,%g] => [%g,%g]\n", iColumn, variable_, olb, oub, down_[0], down_[1]) ; } } else { { double olb, oub ; olb = model_->solver()->getColLower()[iColumn] ; oub = model_->solver()->getColUpper()[iColumn] ; printf("CbcInteger would branch up on var %d (int var %d): [%g,%g] => [%g,%g]\n", iColumn, variable_, olb, oub, up_[0], up_[1]) ; } } } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcIntegerBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap) { const CbcIntegerBranchingObject* br = dynamic_cast(brObj); assert(br); double* thisBd = way_ < 0 ? down_ : up_; const double* otherBd = br->way_ < 0 ? br->down_ : br->up_; return CbcCompareRanges(thisBd, otherBd, replaceIfOverlap); } CoinMP-1.8.3/Cbc/src/CbcFollowOn.hpp0000644000175000017500000001471212131054770015457 0ustar renerene// $Id: CbcFollowOn.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #ifndef CbcFollowOn_H #define CbcFollowOn_H #include "CbcBranchBase.hpp" #include "OsiRowCut.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" /** Define a follow on class. The idea of this is that in air-crew scheduling problems crew may fly in on flight A and out on flight B or on some other flight. A useful branch is one which on one side fixes all which go out on flight B to 0, while the other branch fixes all those that do NOT go out on flight B to 0. This branching rule should be in addition to normal rules and have a high priority. */ class CbcFollowOn : public CbcObject { public: // Default Constructor CbcFollowOn (); /** Useful constructor */ CbcFollowOn (CbcModel * model); // Copy constructor CbcFollowOn ( const CbcFollowOn &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcFollowOn & operator=( const CbcFollowOn& rhs); // Destructor ~CbcFollowOn (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /// This looks at solution and sets bounds to contain solution virtual void feasibleRegion(); /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// As some computation is needed in more than one place - returns row virtual int gutsOfFollowOn(int & otherRow, int & preferredWay) const; protected: /// data /// Matrix CoinPackedMatrix matrix_; /// Matrix by row CoinPackedMatrix matrixByRow_; /// Possible rhs (if 0 then not possible) int * rhs_; }; /** General Branching Object class. Each way fixes some variables to lower bound */ class CbcFixingBranchingObject : public CbcBranchingObject { public: // Default Constructor CbcFixingBranchingObject (); // Useful constructor CbcFixingBranchingObject (CbcModel * model, int way, int numberOnDownSide, const int * down, int numberOnUpSide, const int * up); // Copy constructor CbcFixingBranchingObject ( const CbcFixingBranchingObject &); // Assignment operator CbcFixingBranchingObject & operator=( const CbcFixingBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; // Destructor virtual ~CbcFixingBranchingObject (); using CbcBranchingObject::branch ; /// Does next branch and updates state virtual double branch(); #ifdef JJF_ZERO // No need to override. Default works fine. /** Reset every information so that the branching object appears to point to the previous child. This method does not need to modify anything in any solver. */ virtual void previousBranch(); #endif using CbcBranchingObject::print ; /** \brief Print something about branch - only if log level high */ virtual void print(); /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return FollowOnBranchObj; } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ virtual CbcRangeCompare compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); private: /// data /// Number on down list int numberDown_; /// Number on up list int numberUp_; /// downList - variables to fix to lb on down branch int * downList_; /// upList - variables to fix to lb on up branch int * upList_; }; /** Define an idiotic idea class. The idea of this is that we take some integer variables away from integer and sum them with some randomness to get signed sum close to 0.5. We then can branch to exclude that gap. This branching rule should be in addition to normal rules and have a high priority. */ class CbcIdiotBranch : public CbcObject { public: // Default Constructor CbcIdiotBranch (); /** Useful constructor */ CbcIdiotBranch (CbcModel * model); // Copy constructor CbcIdiotBranch ( const CbcIdiotBranch &); /// Clone virtual CbcObject * clone() const; // Assignment operator CbcIdiotBranch & operator=( const CbcIdiotBranch& rhs); // Destructor ~CbcIdiotBranch (); /// Infeasibility - large is 0.5 virtual double infeasibility(const OsiBranchingInformation * info, int &preferredWay) const; using CbcObject::feasibleRegion ; /// This looks at solution and sets bounds to contain solution virtual void feasibleRegion(); /// Creates a branching object virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; /// Initialize for branching virtual void initializeForBranching(CbcModel * ); protected: /// Build "cut" OsiRowCut buildCut(const OsiBranchingInformation * info,int type,int & preferredWay) const; /// data /// Thread specific random number generator mutable CoinThreadRandom randomNumberGenerator_; /// Saved version of thread specific random number generator mutable CoinThreadRandom savedRandomNumberGenerator_; }; #endif CoinMP-1.8.3/Cbc/src/CbcBranchActual.hpp0000644000175000017500000000133611510742604016245 0ustar renerene/* $Id: CbcBranchActual.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcBranchActual_H #define CbcBranchActual_H #include "CbcBranchBase.hpp" #include "CoinPackedMatrix.hpp" #include "CbcClique.hpp" #include "CbcSOS.hpp" #include "CbcSimpleInteger.hpp" #include "CbcNWay.hpp" #include "CbcSimpleIntegerPseudoCost.hpp" #include "CbcBranchDefaultDecision.hpp" #include "CbcFollowOn.hpp" #include "CbcFixVariable.hpp" #include "CbcDummyBranchingObject.hpp" #include "CbcGeneral.hpp" #include "CbcGeneralDepth.hpp" #include "CbcSubProblem.hpp" #endif CoinMP-1.8.3/Cbc/src/CbcBranchDynamic.hpp0000644000175000017500000001634111510742604016422 0ustar renerene/* $Id: CbcBranchDynamic.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcBranchDynamic_H #define CbcBranchDynamic_H #include "CoinPackedMatrix.hpp" #include "CbcSimpleIntegerDynamicPseudoCost.hpp" #include "CbcBranchActual.hpp" /** Branching decision dynamic class This class implements a simple algorithm (betterBranch()) for choosing a branching variable when dynamic pseudo costs. */ class CbcBranchDynamicDecision : public CbcBranchDecision { public: // Default Constructor CbcBranchDynamicDecision (); // Copy constructor CbcBranchDynamicDecision ( const CbcBranchDynamicDecision &); virtual ~CbcBranchDynamicDecision(); /// Clone virtual CbcBranchDecision * clone() const; /// Initialize, e.g. before the start of branch selection at a node virtual void initialize(CbcModel * model); /** \brief Compare two branching objects. Return nonzero if \p thisOne is better than \p bestSoFar. The routine compares branches using the values supplied in \p numInfUp and \p numInfDn until a solution is found by search, after which it uses the values supplied in \p changeUp and \p changeDn. The best branching object seen so far and the associated parameter values are remembered in the \c CbcBranchDynamicDecision object. The nonzero return value is +1 if the up branch is preferred, -1 if the down branch is preferred. As the names imply, the assumption is that the values supplied for \p numInfUp and \p numInfDn will be the number of infeasibilities reported by the branching object, and \p changeUp and \p changeDn will be the estimated change in objective. Other measures can be used if desired. Because an \c CbcBranchDynamicDecision object remembers the current best branching candidate (#bestObject_) as well as the values used in the comparison, the parameter \p bestSoFar is redundant, hence unused. */ virtual int betterBranch(CbcBranchingObject * thisOne, CbcBranchingObject * bestSoFar, double changeUp, int numInfUp, double changeDn, int numInfDn); /** Sets or gets best criterion so far */ virtual void setBestCriterion(double value); virtual double getBestCriterion() const; /** Says whether this method can handle both methods - 1 better, 2 best, 3 both */ virtual int whichMethod() { return 3; } /** Saves a clone of current branching object. Can be used to update information on object causing branch - after branch */ virtual void saveBranchingObject(OsiBranchingObject * object) ; /** Pass in information on branch just done. assumes object can get information from solver */ virtual void updateInformation(OsiSolverInterface * solver, const CbcNode * node); private: /// Illegal Assignment operator CbcBranchDynamicDecision & operator=(const CbcBranchDynamicDecision& rhs); /// data /// "best" so far double bestCriterion_; /// Change up for best double bestChangeUp_; /// Number of infeasibilities for up int bestNumberUp_; /// Change down for best double bestChangeDown_; /// Number of infeasibilities for down int bestNumberDown_; /// Pointer to best branching object CbcBranchingObject * bestObject_; }; /** Simple branching object for an integer variable with pseudo costs This object can specify a two-way branch on an integer variable. For each arm of the branch, the upper and lower bounds on the variable can be independently specified. Variable_ holds the index of the integer variable in the integerVariable_ array of the model. */ class CbcDynamicPseudoCostBranchingObject : public CbcIntegerBranchingObject { public: /// Default constructor CbcDynamicPseudoCostBranchingObject (); /** Create a standard floor/ceiling branch object Specifies a simple two-way branch. Let \p value = x*. One arm of the branch will be is lb <= x <= floor(x*), the other ceil(x*) <= x <= ub. Specify way = -1 to set the object state to perform the down arm first, way = 1 for the up arm. */ CbcDynamicPseudoCostBranchingObject (CbcModel *model, int variable, int way , double value, CbcSimpleIntegerDynamicPseudoCost * object) ; /** Create a degenerate branch object Specifies a `one-way branch'. Calling branch() for this object will always result in lowerValue <= x <= upperValue. Used to fix a variable when lowerValue = upperValue. */ CbcDynamicPseudoCostBranchingObject (CbcModel *model, int variable, int way, double lowerValue, double upperValue) ; /// Copy constructor CbcDynamicPseudoCostBranchingObject ( const CbcDynamicPseudoCostBranchingObject &); /// Assignment operator CbcDynamicPseudoCostBranchingObject & operator= (const CbcDynamicPseudoCostBranchingObject& rhs); /// Clone virtual CbcBranchingObject * clone() const; /// Destructor virtual ~CbcDynamicPseudoCostBranchingObject (); /// Does part of constructor void fillPart (int variable, int way , double value, CbcSimpleIntegerDynamicPseudoCost * object) ; using CbcBranchingObject::branch ; /** \brief Sets the bounds for the variable according to the current arm of the branch and advances the object state to the next arm. This version also changes guessed objective value */ virtual double branch(); /** Some branchingObjects may claim to be able to skip strong branching. If so they have to fill in CbcStrongInfo. The object mention in incoming CbcStrongInfo must match. Returns nonzero if skip is wanted */ virtual int fillStrongInfo( CbcStrongInfo & info); /// Change in guessed inline double changeInGuessed() const { return changeInGuessed_; } /// Set change in guessed inline void setChangeInGuessed(double value) { changeInGuessed_ = value; } /// Return object inline CbcSimpleIntegerDynamicPseudoCost * object() const { return object_; } /// Set object inline void setObject(CbcSimpleIntegerDynamicPseudoCost * object) { object_ = object; } /** Return the type (an integer identifier) of \c this */ virtual CbcBranchObjType type() const { return DynamicPseudoCostBranchObj; } // LL: compareOriginalObject and compareBranchingObject are inherited from // CbcIntegerBranchingObject thus need not be declared/defined here. After // all, this kind of branching object is simply using pseudocosts to make // decisions, but once the decisions are made they are the same kind as in // the underlying class. protected: /// Change in guessed objective value for next branch double changeInGuessed_; /// Pointer back to object CbcSimpleIntegerDynamicPseudoCost * object_; }; #endif CoinMP-1.8.3/Cbc/src/config_default.h0000644000175000017500000000437512131054770015725 0ustar renerene /* include the COIN-OR-wide system specific configure header */ #include "configall_system.h" /* include the public project specific macros */ #include "config_cbc_default.h" /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Define to the debug sanity check level (0 is no test) */ #define COIN_CBC_CHECKLEVEL 0 /* Define to the debug verbosity level (0 is no output) */ #define COIN_CBC_VERBOSITY 0 /* Define to 1 if the Cgl package is used */ #define COIN_HAS_CGL 1 /* Define to 1 if the Clp package is used */ #define COIN_HAS_CLP 1 /* Define to 1 if the CoinUtils package is used */ #define COIN_HAS_COINUTILS 1 /* Define to 1 if the Osi package is used */ #define COIN_HAS_OSI 1 /* Define to 1 if the Vol package is used */ #define COIN_HAS_VOL 1 /* Define to 1 if the Cplex package is used */ /* #undef COIN_HAS_CPX */ /* Define to 1 if the Dylp package is used */ /* #undef COIN_HAS_DYLP */ /* Define to 1 if the Glpk package is used */ /* #undef COIN_HAS_GLPK */ /* Define to 1 if the Mosek package is used */ /* #undef COIN_HAS_MSK */ /* Define to 1 if the Soplex package is used */ /* #undef COIN_HAS_SPX */ /* Define to 1 if the Sym package is used */ /* #undef COIN_HAS_SYM */ /* Define to 1 if the Xpress package is used */ /* #undef COIN_HAS_XPR */ /* For additional information about how to set OSICBC_DFLT_SOLVER, OSICBC_DFLT_SOLVER_CLP, and OSICBC_DFLT_SOLVER_HPP, please see comments at the beginning of OsiCbcSolverInterface.cpp. Unless you know what you're doing, you should use clp with OsiCbc. Just uncomment the next three defines. */ /* Define to the name of the default solver interface class, e.g., OsiClpSolverInterface. */ /* #define OSICBC_DFLT_SOLVER OsiClpSolverInterface */ /* Define this symbol if clp is the default solver. */ /* #define OSICBC_DFLT_SOLVER_CLP 1 */ /* Define to the name of the .hpp file for the default solver interface class, e.g., "OsiClpSolverInterface.hpp" (include quotes) */ /* #define OSICBC_DFLT_SOLVER_HPP "OsiClpSolverInterface.hpp" */ CoinMP-1.8.3/Cbc/src/CbcHeuristicRENS.cpp0000644000175000017500000010326612452506557016360 0ustar renerene// $Id: CbcHeuristicRENS.cpp 2105 2015-01-05 13:11:11Z forrest $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // edwin 12/5/09 carved out of CbcHeuristicRINS #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristicRENS.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinSort.hpp" #include "CbcBranchActual.hpp" #include "CbcStrategy.hpp" #include "CglPreProcess.hpp" // Default Constructor CbcHeuristicRENS::CbcHeuristicRENS() : CbcHeuristic() { numberTries_ = 0; rensType_ = 0; whereFrom_ = 256 + 1; } // Constructor with model - assumed before cuts CbcHeuristicRENS::CbcHeuristicRENS(CbcModel & model) : CbcHeuristic(model) { numberTries_ = 0; rensType_ = 0; whereFrom_ = 256 + 1; } // Destructor CbcHeuristicRENS::~CbcHeuristicRENS () { } // Clone CbcHeuristic * CbcHeuristicRENS::clone() const { return new CbcHeuristicRENS(*this); } // Assignment operator CbcHeuristicRENS & CbcHeuristicRENS::operator=( const CbcHeuristicRENS & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); numberTries_ = rhs.numberTries_; rensType_ = rhs.rensType_; } return *this; } // Copy constructor CbcHeuristicRENS::CbcHeuristicRENS(const CbcHeuristicRENS & rhs) : CbcHeuristic(rhs), numberTries_(rhs.numberTries_), rensType_(rhs.rensType_) { } // Resets stuff if model changes void CbcHeuristicRENS::resetModel(CbcModel * ) { } int CbcHeuristicRENS::solution(double & solutionValue, double * betterSolution) { int returnCode = 0; const double * bestSolution = model_->bestSolution(); bool returnNow=false; if ((numberTries_&&(rensType_&16)==0) || numberTries_>1 || (when() < 2 && bestSolution)) returnNow=true;; // If 32 bit set then do once with bestSolution if ((rensType_&32)!=0&&bestSolution) returnNow=false; if (returnNow) return 0; // switch off next time if bestSolution if (bestSolution) { if ((rensType_&32)!=0) rensType_ &= ~32; // switch off but leave bestSolution else bestSolution=NULL; // null bestSolution so won't use } numberTries_++; #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif double saveFractionSmall=fractionSmall_; OsiSolverInterface * solver = model_->solver(); int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); OsiSolverInterface * newSolver = cloneBut(3); // was model_->continuousSolver()->clone(); const double * currentSolution = newSolver->getColSolution(); int type = rensType_&15; if (type<12) newSolver->resolve(); double direction = newSolver->getObjSense(); double cutoff=model_->getCutoff(); newSolver->setDblParam(OsiDualObjectiveLimit, 1.0e100); //cutoff *= direction; double gap = cutoff - newSolver->getObjValue() * direction ; double tolerance; newSolver->getDblParam(OsiDualTolerance, tolerance) ; if ((gap > 0.0 || !newSolver->isProvenOptimal())&&type<12) { gap += 100.0 * tolerance; int nFix = newSolver->reducedCostFix(gap); if (nFix) { char line [200]; sprintf(line, "Reduced cost fixing fixed %d variables", nFix); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << line << CoinMessageEol; } } else if (type<12) { return 0; // finished? } int numberColumns = solver->getNumCols(); double * dj = CoinCopyOfArray(solver->getReducedCost(),numberColumns); double djTolerance = (type!=1) ? -1.0e30 : 1.0e-4; const double * colLower = newSolver->getColLower(); const double * colUpper = newSolver->getColUpper(); double * contribution = NULL; int numberFixed = 0; if (type==3) { double total=0.0; int n=0; CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; if (basis&&basis->getNumArtificial()) { for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn]>colLower[iColumn]&& basis->getStructStatus(iColumn) != CoinWarmStartBasis::basic) { n++; total += fabs(dj[iColumn]); } } if (n) djTolerance = (0.01*total)/static_cast(n); delete basis; } } else if (type>=5&&type<=12) { /* 5 fix sets at one 6 fix on dj but leave unfixed SOS slacks 7 fix sets at one but use pi 8 fix all at zero but leave unfixed SOS slacks 9 as 8 but only fix all at zero if just one in set nonzero 10 fix all "stable" ones 11 fix all "stable" ones - approach 2 12 layered approach */ // SOS type fixing bool fixSets = (type==5)||(type==7)||(type==10)||(type==11); CoinWarmStartBasis * basis = dynamic_cast(solver->getWarmStart()) ; if (basis&&basis->getNumArtificial()) { //const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int numberRows = solver->getNumRows(); // Column copy const CoinPackedMatrix * matrix = solver->getMatrixByCol(); const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); double * bestDj = new double [numberRows]; for (int i=0;icolLower[iColumn]) { CoinBigIndex j; if (currentSolution[iColumn]>1.0e-6&& currentSolution[iColumn]<0.999999) { for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (bestDj[iRow]<1.0e30) { if (element[j] != 1.0) bestDj[iRow]=1.0e30; else bestDj[iRow]=1.0e25; } } } else if ( basis->getStructStatus(iColumn) != CoinWarmStartBasis::basic) { for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (bestDj[iRow]<1.0e25) { if (element[j] != 1.0) bestDj[iRow]=1.0e30; else bestDj[iRow]=CoinMin(fabs(dj[iColumn]),bestDj[iRow]); } } } } } // Just leave one slack in each set { const double * objective = newSolver->getObjCoefficients(); int * best = new int [numberRows]; double * cheapest = new double[numberRows]; for (int i=0;icolLower[iColumn]) { if (columnLength[iColumn]==1) { CoinBigIndex j = columnStart[iColumn]; int iRow = row[j]; if (bestDj[iRow]<1.0e30) { double obj = direction*objective[iColumn]; if (objcolLower[iColumn]) { if (columnLength[iColumn]==1) { CoinBigIndex j = columnStart[iColumn]; int iRow = row[j]; if (bestDj[iRow]<1.0e30) { if (best[iRow]!=-1&&iColumn!=best[iRow]) { newSolver->setColUpper(iColumn,0.0); } } } } } delete [] best; delete [] cheapest; } int nSOS=0; double * sort = new double [numberRows]; const double * pi = newSolver->getRowPrice(); if (type==12) { contribution = new double [numberRows]; for (int i=0;i8*numberRows) { if (type<10) { std::sort(sort,sort+nSOS); int last = static_cast(nSOS*0.9*fractionSmall_); double tolerance = sort[last]; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn]>colLower[iColumn]) { CoinBigIndex j; if (currentSolution[iColumn]<=1.0e-6|| currentSolution[iColumn]>=0.999999) { if (fixSets) { for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double useDj; if (type==5) useDj = bestDj[iRow]; else if (type==7) useDj= -fabs(pi[iRow]); else useDj= fabs(pi[iRow]); if (bestDj[iRow]<1.0e30&&useDj>=tolerance) { numberFixed++; if (currentSolution[iColumn]<=1.0e-6) newSolver->setColUpper(iColumn,0.0); else if (currentSolution[iColumn]>=0.999999) newSolver->setColLower(iColumn,1.0); } } } else if (columnLength[iColumn]==1) { // leave more slacks int iRow = row[columnStart[iColumn]]; if (bestDj[iRow]<1.0e30) { // fake dj dj[iColumn] *= 0.000001; } } else if (type==8||type==9) { if (currentSolution[iColumn]<=1.0e-6) { if (type==8) { dj[iColumn] *= 1.0e6; } else { bool fix=false; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (bestDj[iRow]<1.0e25) { fix=true; break; } } if (fix) { dj[iColumn] *= 1.0e6; } } } else { dj[iColumn] *= 0.000001; } } } } } if (fixSets) djTolerance = 1.0e30; } else if (type==10) { double * saveUpper = new double [numberRows]; memset(saveUpper,0,numberRows*sizeof(double)); char * mark = new char [numberColumns]; char * nonzero = new char [numberColumns]; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn]>colLower[iColumn]) { CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; saveUpper[iRow] += element[j]; } } } double sum=0.0; double sumRhs=0.0; const double * rowUpper = newSolver->getRowUpper(); for (int i=0;i=1.0e30) { sum += saveUpper[i]; sumRhs += rowUpper[i]; } } double averagePerSet = sum/static_cast(numberRows); // allow this extra double factor = averagePerSet*fractionSmall_*numberRows; factor = 1.0+factor/sumRhs; fractionSmall_ = 0.5; memcpy(saveUpper,rowUpper,numberRows*sizeof(double)); // loosen up for (int i=0;i=1.0e30) { newSolver->setRowUpper(i,factor*saveUpper[i]); } } newSolver->resolve(); const double * solution = newSolver->getColSolution(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { mark[iColumn]=0; nonzero[iColumn]=0; if (colUpper[iColumn]>colLower[iColumn]&& solution[iColumn]>0.9999) mark[iColumn]=1; else if (solution[iColumn]>0.00001) nonzero[iColumn]=1; } // slightly small for (int i=0;i=1.0e30) { newSolver->setRowUpper(i,saveUpper[i]*0.9999); } } newSolver->resolve(); int nCheck=2; if (newSolver->isProvenOptimal()) { for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn]>colLower[iColumn]&& solution[iColumn]>0.9999) mark[iColumn]++; else if (solution[iColumn]>0.00001) nonzero[iColumn]=1; } } else { nCheck=1; } // correct values for (int i=0;i=1.0e30) { newSolver->setRowUpper(i,saveUpper[i]); } } newSolver->resolve(); int nFixed=0; int nFixedToZero=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn]>colLower[iColumn]) { if (solution[iColumn]>0.9999&&mark[iColumn]==nCheck) { newSolver->setColLower(iColumn,1.0); nFixed++; } else if (!mark[iColumn]&&!nonzero[iColumn]&& columnLength[iColumn]>1&&solution[iColumn]<0.00001) { newSolver->setColUpper(iColumn,0.0); nFixedToZero++; } } } char line[100]; sprintf(line,"Heuristic %s fixed %d to one (and %d to zero)", heuristicName(), nFixed,nFixedToZero); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << line << CoinMessageEol; delete [] mark; delete []nonzero; delete [] saveUpper; numberFixed=numberColumns; djTolerance = 1.0e30; } else if (type==11) { double * saveUpper = CoinCopyOfArray(newSolver->getRowUpper(),numberRows); char * mark = new char [numberColumns]; char * nonzero = new char [numberColumns]; // save basis and solution CoinWarmStartBasis * basis = dynamic_cast(newSolver->getWarmStart()) ; assert(basis != NULL); double * saveSolution = CoinCopyOfArray(newSolver->getColSolution(), numberColumns); double factors[] = {1.1,1.05,1.01,0.98}; int nPass = (sizeof(factors)/sizeof(double))-1; double factor=factors[0]; double proportion = fractionSmall_; fractionSmall_ = 0.5; // loosen up for (int i=0;i=1.0e30) { newSolver->setRowUpper(i,factor*saveUpper[i]); } } bool takeHint; OsiHintStrength strength; newSolver->getHintParam(OsiDoDualInResolve, takeHint, strength); newSolver->setHintParam(OsiDoDualInResolve, false, OsiHintDo); newSolver->resolve(); newSolver->setHintParam(OsiDoDualInResolve, true, OsiHintDo); const double * solution = newSolver->getColSolution(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { mark[iColumn]=0; nonzero[iColumn]=0; if (colUpper[iColumn]>colLower[iColumn]&& solution[iColumn]>0.9999) mark[iColumn]=1; else if (solution[iColumn]>0.00001) nonzero[iColumn]=1; } int nCheck=2; for (int iPass=0;iPass=1.0e30) { newSolver->setRowUpper(i,saveUpper[i]*factor); } } newSolver->resolve(); if (newSolver->isProvenOptimal()) { nCheck++; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn]>colLower[iColumn]&& solution[iColumn]>0.9999) mark[iColumn]++; else if (solution[iColumn]>0.00001) nonzero[iColumn]++; } } } // correct values for (int i=0;i=1.0e30) { newSolver->setRowUpper(i,saveUpper[i]); } } newSolver->setColSolution(saveSolution); delete [] saveSolution; newSolver->setWarmStart(basis); delete basis ; newSolver->setHintParam(OsiDoDualInResolve, takeHint, strength); newSolver->resolve(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn]>colLower[iColumn]&& solution[iColumn]>0.9999) mark[iColumn]++; else if (solution[iColumn]>0.00001) nonzero[iColumn]++; } int nFixed=0; int numberSetsToFix = static_cast(nSOS*(1.0-proportion)); int * mixed = new int[numberRows]; memset(mixed,0,numberRows*sizeof(int)); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn]>colLower[iColumn]) { int iSOS=-1; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (bestDj[iRow]<1.0e25) { iSOS=iRow; break; } } if (iSOS>=0) { int numberTimesAtOne = mark[iColumn]; int numberTimesNonZero = nonzero[iColumn]+ numberTimesAtOne; if (numberTimesAtOnecolLower[iColumn]) { if (solution[iColumn]>0.9999) { int iSOS=-1; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (bestDj[iRow]<1.0e25) { iSOS=iRow; break; } } if (iSOS>=0&&sort[iSOS]) { newSolver->setColLower(iColumn,1.0); nFixed++; } } } } char line[100]; sprintf(line,"Heuristic %s fixed %d to one (%d sets)", heuristicName(), nFixed,nSOS); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << line << CoinMessageEol; delete [] mark; delete [] nonzero; delete [] saveUpper; numberFixed=numberColumns; djTolerance = 1.0e30; } } delete basis; delete [] sort; delete [] bestDj; if (10*nSOS<=8*numberRows) { // give up delete [] contribution; delete newSolver; return 0; } } } // Do dj to get right number if (type==4||type==6||(type>7&&type<10)) { double * sort = new double [numberColumns]; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { sort[iColumn]=1.0e30; if (colUpper[iColumn]>colLower[iColumn]) { sort[iColumn] = fabs(dj[iColumn]); } } std::sort(sort,sort+numberColumns); int last = static_cast(numberColumns*fractionSmall_); djTolerance = CoinMax(sort[last],1.0e-5); delete [] sort; } else if (type==12) { // Do layered in a different way int numberRows = solver->getNumRows(); // Column copy const CoinPackedMatrix * matrix = newSolver->getMatrixByCol(); const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); int * whichRow = new int[numberRows]; int * whichSet = new int [numberColumns]; int nSOS=0; for (int i=0;icolLower[iColumn]) { CoinBigIndex j; double sum=0.0; int iSOS=-1; int n=0; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (contribution[iRow]>=0.0) { iSOS=iRow; n++; } else { sum += fabs(element[j]); } } if (n>1) COIN_DETAIL_PRINT(printf("Too many SOS entries (%d) for column %d\n", n,iColumn)); if (sum) { assert (iSOS>=0); contribution[iSOS] += sum; whichRow[iSOS]++; whichSet[iColumn]=iSOS; } else { whichSet[iColumn]=iSOS+numberRows; } } } int * chunk = new int [numberRows]; for (int i=0;i(whichRow[i]); } else { contribution[i] = COIN_DBL_MAX; } whichRow[i]=i; } newSolver->setDblParam(OsiDualObjectiveLimit, 1.0e100); double * saveLower = CoinCopyOfArray(colLower,numberColumns); double * saveUpper = CoinCopyOfArray(colUpper,numberColumns); CoinSort_2(contribution,contribution+numberRows,whichRow); // Set do nothing solution for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if(whichSet[iColumn]>=numberRows) newSolver->setColLower(iColumn,1.0); } newSolver->resolve(); int nChunk = (nSOS+9)/10; int nPass=0; int inChunk=0; for (int i=0;i=0) { if (iSOS>=numberRows) iSOS-=numberRows; if (chunk[iSOS]==iPass-1&&betterSolution[iColumn]>0.9999) { newSolver->setColLower(iColumn,1.0); } else if (chunk[iSOS]==iPass) { newSolver->setColLower(iColumn,saveLower[iColumn]); newSolver->setColUpper(iColumn,saveUpper[iColumn]); } } } // solve returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, model_->getCutoff(), "CbcHeuristicRENS"); if (returnCode < 0) { returnCode = 0; // returned on size break; } else if ((returnCode&1)==0) { // no good break; } } if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } delete [] chunk; delete [] saveLower; delete [] saveUpper; delete [] whichRow; delete [] whichSet; delete [] contribution; delete newSolver; return returnCode; } double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); int i; int numberTightened = 0; int numberAtBound = 0; int numberContinuous = numberColumns - numberIntegers; /* 0 - allow fixing 1 - don't allow fixing */ char * marked = new char [numberColumns]; memset(marked,0,numberColumns); if (bestSolution) { for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = currentSolution[iColumn]; double lower = colLower[iColumn]; double upper = colUpper[iColumn]; value = CoinMax(value, lower); value = CoinMin(value, upper); if (fabs(bestSolution[iColumn]-value)>0.999) marked[iColumn]=1; } } if ((rensType_&(64|128))!=0&&model_->objects()) { int lowPriority=-COIN_INT_MAX; int highPriority=COIN_INT_MAX; for (i = 0; i < numberIntegers; i++) { int priority=model_->priority(i); lowPriority=CoinMax(lowPriority,priority); highPriority=CoinMin(highPriority,priority); } if (highPrioritypriority(i); if (priority==keepPriority) marked[iColumn]=1; } } } for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = currentSolution[iColumn]; double lower = colLower[iColumn]; double upper = colUpper[iColumn]; value = CoinMax(value, lower); value = CoinMin(value, upper); double djValue=dj[iColumn]*direction; bool dontFix=marked[iColumn]!=0; #define RENS_FIX_ONLY_LOWER #ifndef RENS_FIX_ONLY_LOWER if (fabs(value - floor(value + 0.5)) < 1.0e-8) { value = floor(value + 0.5); if (dontFix) { continue; } if (value == lower || value == upper) numberAtBound++; newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); numberFixed++; } else if (colUpper[iColumn] - colLower[iColumn] >= 2.0) { numberTightened++; newSolver->setColLower(iColumn, floor(value)); newSolver->setColUpper(iColumn, ceil(value)); } #else if (fabs(value - floor(value + 0.5)) < 1.0e-8 && floor(value + 0.5) == lower && djValue > djTolerance ) { if (dontFix) { continue; } value = floor(value + 0.5); numberAtBound++; newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); numberFixed++; } else if (fabs(value - floor(value + 0.5)) < 1.0e-8 && floor(value + 0.5) == upper && -djValue > djTolerance && (djTolerance > 0.0||type==2)) { value = floor(value + 0.5); if (dontFix) { continue; } numberAtBound++; newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); numberFixed++; } else if (colUpper[iColumn] - colLower[iColumn] >= 2.0 && djTolerance <0.0) { numberTightened++; if (fabs(value - floor(value + 0.5)) < 1.0e-8) { value = floor(value + 0.5); if (value < upper) { newSolver->setColLower(iColumn, CoinMax(value - 1.0, lower)); newSolver->setColUpper(iColumn, CoinMin(value + 1.0, upper)); } else { newSolver->setColLower(iColumn, upper - 1.0); } } else { newSolver->setColLower(iColumn, floor(value)); newSolver->setColUpper(iColumn, ceil(value)); } } #endif } delete [] marked; delete [] dj; if (numberFixed > numberIntegers / 5) { if ( numberFixed < numberColumns / 5) { #define RENS_FIX_CONTINUOUS #ifdef RENS_FIX_CONTINUOUS const double * colLower = newSolver->getColLower(); //const double * colUpper = newSolver->getColUpper(); int nAtLb = 0; double sumDj = 0.0; const double * dj = newSolver->getReducedCost(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn)) { double value = currentSolution[iColumn]; if (value < colLower[iColumn] + 1.0e-8) { double djValue = dj[iColumn] * direction; nAtLb++; sumDj += djValue; } } } if (nAtLb) { // fix some continuous double * sort = new double[nAtLb]; int * which = new int [nAtLb]; double threshold = CoinMax((0.01 * sumDj) / static_cast(nAtLb), 1.0e-6); int nFix2 = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn)) { double value = currentSolution[iColumn]; if (value < colLower[iColumn] + 1.0e-8) { double djValue = dj[iColumn] * direction; if (djValue > threshold) { sort[nFix2] = -djValue; which[nFix2++] = iColumn; } } } } CoinSort_2(sort, sort + nFix2, which); nFix2 = CoinMin(nFix2, (numberColumns - numberFixed) / 2); for (int i = 0; i < nFix2; i++) { int iColumn = which[i]; newSolver->setColUpper(iColumn, colLower[iColumn]); } delete [] sort; delete [] which; #ifdef CLP_INVESTIGATE2 printf("%d integers fixed (%d tightened) (%d at bound), and %d continuous fixed at lb\n", numberFixed, numberTightened, numberAtBound, nFix2); #endif } #endif } #ifdef COIN_DEVELOP printf("%d integers fixed and %d tightened\n", numberFixed, numberTightened); #endif returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, model_->getCutoff(), "CbcHeuristicRENS"); if (returnCode < 0 || returnCode == 0) { #ifdef RENS_FIX_CONTINUOUS if (numberContinuous > numberIntegers && numberFixed >= numberColumns / 5) { const double * colLower = newSolver->getColLower(); //const double * colUpper = newSolver->getColUpper(); int nAtLb = 0; double sumDj = 0.0; const double * dj = newSolver->getReducedCost(); double direction = newSolver->getObjSense(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn)) { double value = currentSolution[iColumn]; if (value < colLower[iColumn] + 1.0e-8) { double djValue = dj[iColumn] * direction; nAtLb++; sumDj += djValue; } } } if (nAtLb) { // fix some continuous double * sort = new double[nAtLb]; int * which = new int [nAtLb]; double threshold = CoinMax((0.01 * sumDj) / static_cast(nAtLb), 1.0e-6); int nFix2 = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!newSolver->isInteger(iColumn)) { double value = currentSolution[iColumn]; if (value < colLower[iColumn] + 1.0e-8) { double djValue = dj[iColumn] * direction; if (djValue > threshold) { sort[nFix2] = -djValue; which[nFix2++] = iColumn; } } } } CoinSort_2(sort, sort + nFix2, which); nFix2 = CoinMin(nFix2, (numberColumns - numberFixed) / 2); for (int i = 0; i < nFix2; i++) { int iColumn = which[i]; newSolver->setColUpper(iColumn, colLower[iColumn]); } delete [] sort; delete [] which; #ifdef CLP_INVESTIGATE2 printf("%d integers fixed (%d tightened) (%d at bound), and %d continuous fixed at lb\n", numberFixed, numberTightened, numberAtBound, nFix2); #endif } returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, model_->getCutoff(), "CbcHeuristicRENS"); } #endif if (returnCode < 0 || returnCode == 0) { // Do passes fixing up those >0.9 and // down those < 0.05 #define RENS_PASS 3 //#define KEEP_GOING #ifdef KEEP_GOING double * saveLower = CoinCopyOfArray(colLower,numberColumns); double * saveUpper = CoinCopyOfArray(colUpper,numberColumns); bool badPass=false; int nSolved=0; #endif for (int iPass=0;iPasscolLower[iColumn]) { if (newSolver->isInteger(iColumn)) { double value = currentSolution[iColumn]; double fixTo = floor(value+0.1); if (fixTo>value || value-fixTo < 0.05) { // above 0.9 or below 0.05 nFixed++; newSolver->setColLower(iColumn, fixTo); newSolver->setColUpper(iColumn, fixTo); } } } else if (newSolver->isInteger(iColumn)) { nFixedAlready++; } else { nFixedContinuous++; } } #ifdef CLP_INVESTIGATE2 printf("%d more integers fixed (total %d) plus %d continuous\n", nFixed,nFixed+nFixedAlready,nFixedContinuous); #endif #ifdef KEEP_GOING if (nFixed) { newSolver->resolve(); if (!newSolver->isProvenOptimal()) { badPass=true; break; } else { nSolved++; memcpy(saveLower,colLower,numberColumns*sizeof(double)); memcpy(saveUpper,colUpper,numberColumns*sizeof(double)); } } else { break; } #else if (nFixed) { newSolver->resolve(); if (!newSolver->isProvenOptimal()) { returnCode=0; break; } returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, model_->getCutoff(), "CbcHeuristicRENS"); } else { returnCode=0; } if (returnCode>=0) break; } if (returnCode < 0) returnCode = 0; // returned on size #endif } #ifdef KEEP_GOING if (badPass) { newSolver->setColLower(saveLower); newSolver->setColUpper(saveUpper); newSolver->resolve(); } delete [] saveLower; delete [] saveUpper; if (nSolved) returnCode = smallBranchAndBound(newSolver, numberNodes_, betterSolution, solutionValue, model_->getCutoff(), "CbcHeuristicRENS"); else returnCode=0; } #endif } //printf("return code %d",returnCode); if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; #ifdef COIN_DEVELOP if (!numberTightened && numberFixed == numberAtBound) printf("could add cut with %d elements\n", numberFixed); #endif } else { //printf("\n"); } } //delete [] whichRow; //delete [] contribution; delete newSolver; fractionSmall_ = saveFractionSmall; return returnCode; } // update model void CbcHeuristicRENS::setModel(CbcModel * model) { model_ = model; } CoinMP-1.8.3/Cbc/src/CoinSolve.cpp0000644000175000017500000002555611534210055015210 0ustar renerene/* $Id: CoinSolve.cpp 1607 2011-03-04 16:15:41Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolver.cpp \brief Main routine for the cbc stand-alone solver. */ #include "CbcConfig.h" #include "CoinPragma.hpp" #include "CbcModel.hpp" #include "OsiClpSolverInterface.hpp" /* We have the following compile-time symbols. CBC_OTHER_SOLVER CoinSolve.cpp, CbcSolver.[cpp,hpp], CbcModel.cpp A value of 1 says `cplex'. Other values not defined. The intent with cplex is to apply all of cbc's smarts at the root, then hand the problem over to cplex to finish. Cplex is not used as an alternate lp solver under cbc control. Usage in CbcModel is a fake; a small bit of code that's now `#if 0'. CLP_DEBUG_MALLOC This ties in with the functions clp_malloc, clp_free, and clp_memory, which are defined in CoinOslFactorization.cpp. (Right where you'd expect to find them, eh?). Looks to be a relatively nice debugging wrapper for standard C malloc. Calls standard C malloc/free directly if CLP_DEBUG_MALLOC is not defined. Worth consideration for breaking out as a separate utility. The hooks for new and delete defined here should be incorporated. Absolutely not thread safe --- lots of static variables. Hmmm ... is it still the case that standard C malloc and C++ new/delete do not play well together? 'Cause the hooks here for new and delete will not escape from this file. */ #if CBC_OTHER_SOLVER == 1 # ifndef COIN_HAS_CPX # error "Configuration did not detect cplex installation." # else # include "OsiCpxSolverInterface.hpp" # endif #endif /* Hooks for a debugging wrapper for malloc/free. This bit of definition hooks C++ new / delete and diverts them into the debugging wrapper. */ //#define CLP_DEBUG_MALLOC #ifdef CLP_DEBUG_MALLOC /*extern "C" */void clp_memory(int type); /*extern "C" */ void * clp_malloc(int length); /*extern "C" */ void clp_free(void * array); #include #include #include void * operator new (size_t size) throw (std::bad_alloc) { void * p = clp_malloc(size); return p; } void operator delete (void *p) throw() { clp_free(p); } #endif // CLP_DEBUG_MALLOC #include #include #include #include #include #include // define TEST_MESSAGE_HANDLER to check works on all messages // #define TEST_MESSAGE_HANDLER #ifdef TEST_MESSAGE_HANDLER // This driver shows how to trap messages - this is just as in unitTest.cpp // ****** THis code is similar to MyMessageHandler.hpp and MyMessagehandler.cpp #include "CoinMessageHandler.hpp" /** This just adds a model to CoinMessage and a void pointer so user can trap messages and do useful stuff. This is used in Clp/Test/unitTest.cpp The file pointer is just there as an example of user stuff. -- lh 071026 -- An accurate summary. Nothing is actually happening here except that messages will be prefixed with "==", which serves the purpose of demonstrating that this message handler is active. The extra parameters (CbcModel, FILE) are unused. */ class CbcModel; class MyMessageHandler2 : public CoinMessageHandler { public: /**@name Overrides */ //@{ virtual int print(); //@} /**@name set and get */ //@{ /// Model const CbcModel * model() const; void setModel(CbcModel * model); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ MyMessageHandler2(); /// Constructor with pointer to model MyMessageHandler2(CbcModel * model, FILE * userPointer = NULL); /** Destructor */ virtual ~MyMessageHandler2(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ MyMessageHandler2(const MyMessageHandler2&); /** The copy constructor from an CoinSimplexMessageHandler. */ MyMessageHandler2(const CoinMessageHandler&); MyMessageHandler2& operator=(const MyMessageHandler2&); /// Clone virtual CoinMessageHandler * clone() const ; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer back to model CbcModel * model_; //@} }; //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- MyMessageHandler2::MyMessageHandler2 () : CoinMessageHandler(), model_(NULL) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- MyMessageHandler2::MyMessageHandler2 (const MyMessageHandler2 & rhs) : CoinMessageHandler(rhs), model_(rhs.model_) { } MyMessageHandler2::MyMessageHandler2 (const CoinMessageHandler & rhs) : CoinMessageHandler(), model_(NULL) { } // Constructor with pointer to model MyMessageHandler2::MyMessageHandler2(CbcModel * model, FILE * userPointer) : CoinMessageHandler(), model_(model) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- MyMessageHandler2::~MyMessageHandler2 () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- MyMessageHandler2 & MyMessageHandler2::operator=(const MyMessageHandler2 & rhs) { if (this != &rhs) { CoinMessageHandler::operator=(rhs); model_ = rhs.model_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CoinMessageHandler * MyMessageHandler2::clone() const { return new MyMessageHandler2(*this); } int MyMessageHandler2::print() { // Just add == fprintf(fp_, " == "); fprintf(fp_, "%s\n", messageBuffer_); return 0; } const CbcModel * MyMessageHandler2::model() const { return model_; } void MyMessageHandler2::setModel(CbcModel * model) { model_ = model; } #endif /* TEST_MESSAGE_HANDLER */ //############################################################################# // To use USERCBC or USERCLP change 0 to 1 in defines and add in your fake main program(s) and any other code //#define USER_HAS_FAKE_CBC //#define USER_HAS_FAKE_CLP #ifdef USER_HAS_FAKE_CBC #endif void fakeMain (ClpSimplex & model, OsiSolverInterface & /*osiSolver*/, CbcModel & babSolver) { #ifdef USER_HAS_FAKE_CBC #else printf("Dummy user cbc code - model has %d rows and %d columns\n", model.getNumRows(), model.getNumCols()); // Reduce printout babSolver.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); // Do complete search babSolver.branchAndBound(); #endif } // Clp stuff #ifdef USER_HAS_FAKE_CLP #endif void fakeMain2 (ClpSimplex & /*model*/, OsiClpSolverInterface & osiSolver, int /*options*/) { #ifdef USER_HAS_FAKE_CLP #else ClpSimplex * lpSolver = osiSolver.getModelPtr(); printf("Dummy user clp code - model has %d rows and %d columns\n", lpSolver->numberRows(), lpSolver->numberColumns()); osiSolver.initialSolve(); #endif } // End any fake main program //############################################################################# // void CbcClpUnitTest (const CbcModel & saveModel); #ifdef CBC_STATISTICS int osi_crunch = 0; static int cbc_resolve = 0; int osi_primal = 0; int osi_dual = 0; int osi_hot = 0; void cbc_resolve_check(const OsiSolverInterface * solver) { cbc_resolve++; printf("R %d stats %d %d %d\n", cbc_resolve, solver->getNumRows(), solver->getNumCols(), solver->getMatrixByCol()->getNumElements()); if ((cbc_resolve % 1000) == 0) printf("RR %d resolve crunch %d primal %d dual %d hot %d\n", cbc_resolve, osi_crunch, osi_primal, osi_dual, osi_hot); } #endif int main (int argc, const char *argv[]) { int returnCode = 0; #ifdef CLP_DEBUG_MALLOC clp_memory(0); #endif { #ifndef CBC_OTHER_SOLVER OsiClpSolverInterface solver1; #elif CBC_OTHER_SOLVER==1 OsiCpxSolverInterface solver1; #endif CbcModel model(solver1); // define TEST_MESSAGE_HANDLER at top of file to check works on all messages #ifdef TEST_MESSAGE_HANDLER MyMessageHandler2 messageHandler(&model); std::cout << "Testing derived message handler" << std::endl; model.passInMessageHandler(&messageHandler); OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model.solver()); // Could use different handlers (if different log levels) clpSolver->passInMessageHandler(&messageHandler); //clpSolver->getModelPtr()->passInMessageHandler(&messageHandler); #endif // initialize CbcMain0(model); #ifdef TEST_MESSAGE_HANDLER // Set log levels same so can use one message handler clpSolver->messageHandler()->setLogLevel(1) ; model.messageHandler()->setLogLevel(1); // switch off some printing void setCbcOrClpPrinting(bool yesNo); setCbcOrClpPrinting(false); #endif returnCode = CbcMain1 (argc, argv, model); } #ifdef CLP_DEBUG_MALLOC clp_memory(1); #endif if (returnCode != 777) { return returnCode; } else { return 0; } } /* Version 1.00.00 November 16 2005. This is to stop me (JJF) messing about too much. Tuning changes should be noted here. The testing next version may be activated by CBC_NEXT_VERSION This applies to OsiClp, Clp etc Version 1.00.01 November 24 2005 Added several classes for advanced users. This can't affect code (if you don't use it) Made some tiny changes (for N way branching) which should not change anything. CbcNWay object class - for N way branching this also allows use of CbcConsequence class. CbcBranchAllDifferent object class - for branching on general integer variables to stop them having same value so branches are x >= y+1 and x <= y-1. Added two new Cgl classes - CglAllDifferent which does column fixing (too slowly) and CglStored which just has a list of cuts which can be activated. Modified preprocess option to SOS Version 1.00.02 December 9 2005 Added use of CbcStrategy to do clean preprocessing Added use of referenceSolver for cleaner repetition of Cbc Version 1.01.00 February 2 2006 Added first try at Ampl interface Made dummy program so real main can be called from other programs */ CoinMP-1.8.3/Cbc/src/CbcHeuristicDINS.hpp0000644000175000017500000000511712131054770016334 0ustar renerene// $Id: CbcHeuristicDINS.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // edwin 12/5/09 carved out of CbcHeuristicRINS #ifndef CbcHeuristicDINS_H #define CbcHeuristicDINS_H #include "CbcHeuristic.hpp" class CbcHeuristicDINS : public CbcHeuristic { public: // Default Constructor CbcHeuristicDINS (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicDINS (CbcModel & model); // Copy constructor CbcHeuristicDINS ( const CbcHeuristicDINS &); // Destructor ~CbcHeuristicDINS (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicDINS & operator=(const CbcHeuristicDINS& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) This does Relaxation Induced Neighborhood Search */ virtual int solution(double & objectiveValue, double * newSolution); /// This version fixes stuff and does IP int solutionFix(double & objectiveValue, double * newSolution, const int * keep); /// Sets how often to do it inline void setHowOften(int value) { howOften_ = value; } /// Sets maximum number of solutions kept inline void setMaximumKeep(int value) { maximumKeepSolutions_ = value; } /// Sets tightness of extra constraint inline void setConstraint(int value) { localSpace_ = value; } protected: // Data /// Number of solutions so we can do something at solution int numberSolutions_; /// How often to do (code can change) int howOften_; /// Number of successes int numberSuccesses_; /// Number of tries int numberTries_; /// Maximum number of solutions to keep int maximumKeepSolutions_; /// Number of solutions kept int numberKeptSolutions_; /// Number of integer variables int numberIntegers_; /// Local parameter int localSpace_; /// Values of integer variables int ** values_; }; #endif CoinMP-1.8.3/Cbc/src/CbcGenCbcParam.cpp0000644000175000017500000000660512131054770016017 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenCbcParam.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinParam.hpp" #include "CbcModel.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" #include "CbcGenCbcParam.hpp" namespace { char svnid[] = "$Id: CbcGenCbcParam.cpp 1899 2013-04-09 18:12:08Z stefan $" ; } /* Constructors and destructors There's a generic constructor and one for integer, double, keyword, string, and action parameters. */ /* Default constructor. */ CbcCbcParam::CbcCbcParam () : CoinParam(), paramCode_(CbcCbcParamCode(0)), obj_(0) { /* Nothing to be done here */ } /* Constructor for double parameter */ CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, std::string name, std::string help, double lower, double upper, double dflt, bool display) : CoinParam(name, help, lower, upper, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for integer parameter */ CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, std::string name, std::string help, int lower, int upper, int dflt, bool display) : CoinParam(name, help, lower, upper, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for keyword parameter. */ CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, std::string name, std::string help, std::string firstValue, int dflt, bool display) : CoinParam(name, help, firstValue, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for string parameter. */ CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, std::string name, std::string help, std::string dflt, bool display) : CoinParam(name, help, dflt, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Constructor for action parameter. */ CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, std::string name, std::string help, bool display) : CoinParam(name, help, display), paramCode_(code), obj_(0) { /* Nothing to be done here */ } /* Copy constructor. */ CbcCbcParam::CbcCbcParam (const CbcCbcParam &orig) : CoinParam(orig), paramCode_(orig.paramCode_), obj_(orig.obj_) { /* Nothing to be done here */ } /* Clone */ CbcCbcParam *CbcCbcParam::clone () { return (new CbcCbcParam(*this)) ; } CbcCbcParam &CbcCbcParam::operator= (const CbcCbcParam & rhs) { if (this != &rhs) { CoinParam::operator=(rhs) ; paramCode_ = rhs.paramCode_ ; obj_ = rhs.obj_ ; } return *this ; } /* Destructor */ CbcCbcParam::~CbcCbcParam () { /* Nothing more to do */ } CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveGuided.hpp0000644000175000017500000000320412131054770017603 0ustar renerene/* $Id: CbcHeuristicDiveGuided.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicDiveGuided_H #define CbcHeuristicDiveGuided_H #include "CbcHeuristicDive.hpp" /** DiveGuided class */ class CbcHeuristicDiveGuided : public CbcHeuristicDive { public: // Default Constructor CbcHeuristicDiveGuided (); // Constructor with model - assumed before cuts CbcHeuristicDiveGuided (CbcModel & model); // Copy constructor CbcHeuristicDiveGuided ( const CbcHeuristicDiveGuided &); // Destructor ~CbcHeuristicDiveGuided (); /// Clone virtual CbcHeuristicDiveGuided * clone() const; /// Assignment operator CbcHeuristicDiveGuided & operator=(const CbcHeuristicDiveGuided& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Tests if the heuristic can run virtual bool canHeuristicRun(); /// Selects the next variable to branch on /** Returns true if all the fractional variables can be trivially rounded. Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable. */ virtual bool selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound); }; #endif CoinMP-1.8.3/Cbc/src/CbcBranchDynamic.cpp0000644000175000017500000007075312405244616016430 0ustar renerene/* $Id: CbcBranchDynamic.cpp 2073 2014-09-14 07:53:50Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG //#define TRACE_ONE 19 #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchDynamic.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" // Removing magic constants. // This is a very small number, added to something to make sure it's non-zero. // Useful, for example in denominators of ratios to avoid any possible division by zero # define nonZeroAmount 1.0e-30 // Increasing the size of an array when it grows to the end of its alloted space. // In this file, only used for the history of the outcome of a branch. // New size is size_scale_numerator* / size_scale_denominator + additive_size_increase. #define size_scale_numerator 3 #define size_scale_denominator 2 #define additive_size_increase 100 // Explanation of options used in this file // TYPE2 defines a strategy for computing pseudocosts // 0 means to just use the absolute change in objective // 1 means use the relative change in objective // 2 means use a convex combination of absolute and relative objective changes // For option 2 (TYPE2 == 2), the specific combination is controlled by TYPERATIO // Includes a TYPERATIO fraction of the absolute change and (1 - TYPERATIO) fraction of // the relative change. So should in general have 0 <= TYPERATIO <= 1. But for the // equality cases, you're better off using the other strategy (TYPE2) options. #ifdef COIN_DEVELOP typedef struct { double sumUp_; double upEst_; // or change in obj in update double sumDown_; double downEst_; // or movement in value in update int sequence_; int numberUp_; int numberUpInf_; int numberDown_; int numberDownInf_; char where_; char status_; } History; static History * history = NULL; static int numberHistory = 0; static int maxHistory = 0; static bool getHistoryStatistics_ = true; static void increaseHistory() { if (numberHistory == maxHistory) { // This was originally 3 * maxHistory/2 + 100 maxHistory = additive_size_increase + (size_scale_numerator * maxHistory) / size_scale_denominator; History * temp = new History [maxHistory]; memcpy(temp, history, numberHistory*sizeof(History)); delete [] history; history = temp; } } static bool addRecord(History newOne) { //if (!getHistoryStatistics_) return false; bool fromCompare = false; int i; for ( i = numberHistory - 1; i >= 0; i--) { if (newOne.sequence_ != history[i].sequence_) continue; if (newOne.where_ != history[i].where_) continue; if (newOne.numberUp_ != history[i].numberUp_) continue; if (newOne.sumUp_ != history[i].sumUp_) continue; if (newOne.numberUpInf_ != history[i].numberUpInf_) continue; if (newOne.upEst_ != history[i].upEst_) continue; if (newOne.numberDown_ != history[i].numberDown_) continue; if (newOne.sumDown_ != history[i].sumDown_) continue; if (newOne.numberDownInf_ != history[i].numberDownInf_) continue; if (newOne.downEst_ != history[i].downEst_) continue; // If B knock out previous B if (newOne.where_ == 'C') { fromCompare = true; if (newOne.status_ == 'B') { int j; for (j = i - 1; j >= 0; j--) { if (history[j].where_ == 'C') { if (history[j].status_ == 'I') { break; } else if (history[j].status_ == 'B') { history[j].status_ = ' '; break; } } } } break; } } if (i == -1 || fromCompare) { //add increaseHistory(); history[numberHistory++] = newOne; return true; } else { return false; } } #endif // Default Constructor CbcBranchDynamicDecision::CbcBranchDynamicDecision() : CbcBranchDecision() { bestCriterion_ = 0.0; bestChangeUp_ = 0.0; bestNumberUp_ = 0; bestChangeDown_ = 0.0; bestNumberDown_ = 0; bestObject_ = NULL; } // Copy constructor CbcBranchDynamicDecision::CbcBranchDynamicDecision ( const CbcBranchDynamicDecision & rhs) : CbcBranchDecision() { bestCriterion_ = rhs.bestCriterion_; bestChangeUp_ = rhs.bestChangeUp_; bestNumberUp_ = rhs.bestNumberUp_; bestChangeDown_ = rhs.bestChangeDown_; bestNumberDown_ = rhs.bestNumberDown_; bestObject_ = rhs.bestObject_; } CbcBranchDynamicDecision::~CbcBranchDynamicDecision() { } // Clone CbcBranchDecision * CbcBranchDynamicDecision::clone() const { return new CbcBranchDynamicDecision(*this); } // Initialize i.e. before start of choosing at a node void CbcBranchDynamicDecision::initialize(CbcModel * /*model*/) { bestCriterion_ = 0.0; bestChangeUp_ = 0.0; bestNumberUp_ = 0; bestChangeDown_ = 0.0; bestNumberDown_ = 0; bestObject_ = NULL; #ifdef COIN_DEVELOP History hist; hist.where_ = 'C'; hist.status_ = 'I'; hist.sequence_ = 55555; hist.numberUp_ = 0; hist.numberUpInf_ = 0; hist.sumUp_ = 0.0; hist.upEst_ = 0.0; hist.numberDown_ = 0; hist.numberDownInf_ = 0; hist.sumDown_ = 0.0; hist.downEst_ = 0.0; addRecord(hist); #endif } /* Saves a clone of current branching object. Can be used to update information on object causing branch - after branch */ void CbcBranchDynamicDecision::saveBranchingObject(OsiBranchingObject * object) { OsiBranchingObject * obj = object->clone(); #ifndef NDEBUG CbcBranchingObject * obj2 = dynamic_cast(obj); assert (obj2); #if COIN_DEVELOP>1 CbcDynamicPseudoCostBranchingObject * branchingObject = dynamic_cast(obj); if (!branchingObject) printf("no dynamic branching object Dynamic Decision\n"); #endif #else CbcBranchingObject * obj2 = static_cast(obj); #endif //object_=branchingObject; object_ = obj2; } /* Pass in information on branch just done. assumes object can get information from solver */ /* The expectation is that this method will be called after the branch has been imposed on the constraint system and resolve() has executed. Note that the CbcBranchDecision is a property of the CbcModel. Note also that this method is reaching right through the CbcBranchingObject to update information in the underlying CbcObject. That's why we delete the branchingObject at the end of the method --- the next time we're called, the CbcObject will be different. */ void CbcBranchDynamicDecision::updateInformation(OsiSolverInterface * solver, const CbcNode * node) { assert (object_); const CbcModel * model = object_->model(); double originalValue = node->objectiveValue(); int originalUnsatisfied = node->numberUnsatisfied(); double objectiveValue = solver->getObjValue() * model->getObjSense(); int unsatisfied = 0; int i; int numberIntegers = model->numberIntegers();; const double * solution = solver->getColSolution(); //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); /* Gain access to the associated CbcBranchingObject and its underlying CbcObject. Seems like we'd want to distinguish between no branching object and a branching object of the wrong type. Just deleting an object of the wrong type hides many sins. Hmmm ... if we're using the OSI side of the hierarchy, is this indicated by a null object_? Nah, then we have an assert failure off the top. */ CbcDynamicPseudoCostBranchingObject * branchingObject = dynamic_cast(object_); if (!branchingObject) { delete object_; object_ = NULL; return; } CbcSimpleIntegerDynamicPseudoCost * object = branchingObject->object(); /* change is the change in objective due to the branch we've just imposed. It's possible we may have gone infeasible. */ double change = CoinMax(0.0, objectiveValue - originalValue); // probably should also ignore if stopped // FIXME. Could use enum to avoid numbers for iStatus (e.g. optimal, unknown, infeasible) int iStatus; if (solver->isProvenOptimal()) iStatus = 0; // optimal else if (solver->isIterationLimitReached() && !solver->isDualObjectiveLimitReached()) iStatus = 2; // unknown else iStatus = 1; // infeasible /* If we're feasible according to the solver, evaluate integer feasibility. */ bool feasible = iStatus != 1; if (feasible) { double integerTolerance = model->getDblParam(CbcModel::CbcIntegerTolerance); const int * integerVariable = model->integerVariable(); for (i = 0; i < numberIntegers; i++) { int j = integerVariable[i]; double value = solution[j]; double nearest = floor(value + 0.5); if (fabs(value - nearest) > integerTolerance) unsatisfied++; } } /* Finally, update the object. Defaults (080104) are TYPE2 = 0, INFEAS = 1. Pseudocosts are at heart the average of actual costs for a branch. We just need to update the information used to calculate that average. */ int way = object_->way(); double value = object_->value(); //#define TYPE2 1 //#define TYPERATIO 0.9 if (way < 0) { // down if (feasible) { double movement = value - floor(value); movement = CoinMax(movement, MINIMUM_MOVEMENT); //printf("(down change %g value down %g ",change,movement); object->incrementNumberTimesDown(); object->addToSumDownChange(nonZeroAmount + movement); object->addToSumDownDecrease(originalUnsatisfied - unsatisfied); #if TYPE2==0 object->addToSumDownCost(change / (nonZeroAmount + movement)); object->setDownDynamicPseudoCost(object->sumDownCost() / static_cast (object->numberTimesDown())); #elif TYPE2==1 object->addToSumDownCost(change); object->setDownDynamicPseudoCost(object->sumDownCost() / object->sumDownChange()); #elif TYPE2==2 object->addToSumDownCost(change*TYPERATIO + (1.0 - TYPERATIO)*change / (nonZeroAmount + movement)); object->setDownDynamicPseudoCost(object->sumDownCost()*(TYPERATIO / object->sumDownChange() + (1.0 - TYPERATIO) / (double) object->numberTimesDown())); #endif } else { //printf("(down infeasible value down %g ",change,movement); object->incrementNumberTimesDown(); object->incrementNumberTimesDownInfeasible(); #if INFEAS==2 double distanceToCutoff = 0.0; double objectiveValue = model->getCurrentMinimizationObjValue(); distanceToCutoff = model->getCutoff() - originalValue; if (distanceToCutoff < 1.0e20) change = distanceToCutoff * 2.0; else change = object->downDynamicPseudoCost() * movement * 10.0; change = CoinMax(1.0e-12 * (1.0 + fabs(originalValue)), change); object->addToSumDownChange(nonZeroAmount + movement); object->addToSumDownDecrease(originalUnsatisfied - unsatisfied); #if TYPE2==0 object->addToSumDownCost(change / (nonZeroAmount + movement)); object->setDownDynamicPseudoCost(object->sumDownCost() / (double) object->numberTimesDown()); #elif TYPE2==1 object->addToSumDownCost(change); object->setDownDynamicPseudoCost(object->sumDownCost() / object->sumDownChange()); #elif TYPE2==2 object->addToSumDownCost(change*TYPERATIO + (1.0 - TYPERATIO)*change / (nonZeroAmount + movement)); object->setDownDynamicPseudoCost(object->sumDownCost()*(TYPERATIO / object->sumDownChange() + (1.0 - TYPERATIO) / (double) object->numberTimesDown())); #endif #endif } } else { // up if (feasible) { double movement = ceil(value) - value; movement = CoinMax(movement, MINIMUM_MOVEMENT); //printf("(up change %g value down %g ",change,movement); object->incrementNumberTimesUp(); object->addToSumUpChange(nonZeroAmount + movement); object->addToSumUpDecrease(unsatisfied - originalUnsatisfied); #if TYPE2==0 object->addToSumUpCost(change / (nonZeroAmount + movement)); object->setUpDynamicPseudoCost(object->sumUpCost() / static_cast (object->numberTimesUp())); #elif TYPE2==1 object->addToSumUpCost(change); object->setUpDynamicPseudoCost(object->sumUpCost() / object->sumUpChange()); #elif TYPE2==2 object->addToSumUpCost(change*TYPERATIO + (1.0 - TYPERATIO)*change / (nonZeroAmount + movement)); object->setUpDynamicPseudoCost(object->sumUpCost()*(TYPERATIO / object->sumUpChange() + (1.0 - TYPERATIO) / (double) object->numberTimesUp())); #endif } else { //printf("(up infeasible value down %g ",change,movement); object->incrementNumberTimesUp(); object->incrementNumberTimesUpInfeasible(); #if INFEAS==2 double distanceToCutoff = 0.0; double objectiveValue = model->getCurrentMinimizationObjValue(); distanceToCutoff = model->getCutoff() - originalValue; if (distanceToCutoff < 1.0e20) change = distanceToCutoff * 2.0; else change = object->upDynamicPseudoCost() * movement * 10.0; change = CoinMax(1.0e-12 * (1.0 + fabs(originalValue)), change); object->addToSumUpChange(nonZeroAmount + movement); object->addToSumUpDecrease(unsatisfied - originalUnsatisfied); #if TYPE2==0 object->addToSumUpCost(change / (nonZeroAmount + movement)); object->setUpDynamicPseudoCost(object->sumUpCost() / (double) object->numberTimesUp()); #elif TYPE2==1 object->addToSumUpCost(change); object->setUpDynamicPseudoCost(object->sumUpCost() / object->sumUpChange()); #elif TYPE2==2 object->addToSumUpCost(change*TYPERATIO + (1.0 - TYPERATIO)*change / (nonZeroAmount + movement)); object->setUpDynamicPseudoCost(object->sumUpCost()*(TYPERATIO / object->sumUpChange() + (1.0 - TYPERATIO) / (double) object->numberTimesUp())); #endif #endif } } //object->print(1,0.5); delete object_; object_ = NULL; } /* Simple dynamic decision algorithm. Compare based on infeasibility (numInfUp, numInfDown) until a solution is found by search, then switch to change in objective (changeUp, changeDown). Note that bestSoFar is remembered in bestObject_, so the parameter bestSoFar is unused. */ int CbcBranchDynamicDecision::betterBranch(CbcBranchingObject * thisOne, CbcBranchingObject * /*bestSoFar*/, double changeUp, int numInfUp, double changeDown, int numInfDown) { CbcModel * model = thisOne->model(); int stateOfSearch = model->stateOfSearch() % 10; int betterWay = 0; double value = 0.0; if (!bestObject_) { bestCriterion_ = -1.0e30; bestNumberUp_ = COIN_INT_MAX; bestNumberDown_ = COIN_INT_MAX; } // maybe branch up more if no solution or not many nodes done? if (stateOfSearch <= 2) { //#define TRY_STUFF 1 #ifdef TRY_STUFF // before solution - choose smallest number // could add in depth as well int bestNumber = CoinMin(bestNumberUp_, bestNumberDown_); if (numInfUp < numInfDown) { if (numInfUp < bestNumber) { betterWay = 1; } else if (numInfUp == bestNumber) { if (changeUp < bestChangeUp_) betterWay = 1; } } else if (numInfUp > numInfDown) { if (numInfDown < bestNumber) { betterWay = -1; } else if (numInfDown == bestNumber) { if (changeDown < bestChangeDown_) betterWay = -1; } } else { // up and down have same number bool better = false; if (numInfUp < bestNumber) { better = true; } else if (numInfUp == bestNumber) { if (CoinMin(changeUp, changeDown) < CoinMin(bestChangeUp_, bestChangeDown_) - 1.0e-5) better = true;; } if (better) { // see which way if (changeUp <= changeDown) betterWay = 1; else betterWay = -1; } } if (betterWay) { value = CoinMin(numInfUp, numInfDown); } #else // use pseudo shadow prices modified by locks // test testosi #ifndef JJF_ONE double objectiveValue = model->getCurrentMinimizationObjValue(); double distanceToCutoff = model->getCutoff() - objectiveValue; if (distanceToCutoff < 1.0e20) distanceToCutoff *= 10.0; else distanceToCutoff = 1.0e2 + fabs(objectiveValue); distanceToCutoff = CoinMax(distanceToCutoff, 1.0e-12 * (1.0 + fabs(objectiveValue))); double continuousObjective = model->getContinuousObjective(); double distanceToCutoffC = model->getCutoff() - continuousObjective; if (distanceToCutoffC > 1.0e20) distanceToCutoffC = 1.0e2 + fabs(objectiveValue); distanceToCutoffC = CoinMax(distanceToCutoffC, 1.0e-12 * (1.0 + fabs(objectiveValue))); int numberInfC = model->getContinuousInfeasibilities(); double perInf = distanceToCutoffC / static_cast (numberInfC); assert (perInf > 0.0); //int numberIntegers = model->numberIntegers(); changeDown += perInf * numInfDown; changeUp += perInf * numInfUp; #ifdef JJF_ZERO if (numInfDown == 1) { if (numInfUp == 1) { changeUp += 1.0e6; changeDown += 1.0e6; } else if (changeDown <= 1.5*changeUp) { changeUp += 1.0e6; } } else if (numInfUp == 1 && changeUp <= 1.5*changeDown) { changeDown += 1.0e6; } #endif #endif double minValue = CoinMin(changeDown, changeUp); double maxValue = CoinMax(changeDown, changeUp); value = WEIGHT_BEFORE * minValue + (1.0 - WEIGHT_BEFORE) * maxValue; if (value > bestCriterion_ + 1.0e-8) { if (changeUp <= 1.5*changeDown) { betterWay = 1; } else { betterWay = -1; } } #endif } else { #define TRY_STUFF 2 #if TRY_STUFF > 1 // Get current number of infeasibilities, cutoff and current objective CbcNode * node = model->currentNode(); int numberUnsatisfied = node->numberUnsatisfied(); double cutoff = model->getCutoff(); double objectiveValue = node->objectiveValue(); #endif // got a solution double minValue = CoinMin(changeDown, changeUp); double maxValue = CoinMax(changeDown, changeUp); // Reduce #ifdef TRY_STUFF //maxValue = CoinMin(maxValue,minValue*4.0); #else //maxValue = CoinMin(maxValue,minValue*2.0); #endif #ifndef WEIGHT_PRODUCT value = WEIGHT_AFTER * minValue + (1.0 - WEIGHT_AFTER) * maxValue; #else double minProductWeight = model->getDblParam(CbcModel::CbcSmallChange); value = CoinMax(minValue, minProductWeight) * CoinMax(maxValue, minProductWeight); //value += minProductWeight*minValue; #endif double useValue = value; double useBest = bestCriterion_; #if TRY_STUFF>1 int thisNumber = CoinMin(numInfUp, numInfDown); int bestNumber = CoinMin(bestNumberUp_, bestNumberDown_); double distance = cutoff - objectiveValue; assert (distance >= 0.0); if (useValue + 0.1*distance > useBest && useValue*1.1 > useBest && useBest + 0.1*distance > useValue && useBest*1.1 > useValue) { // not much in it - look at unsatisfied if (thisNumber < numberUnsatisfied || bestNumber < numberUnsatisfied) { double perInteger = distance / (static_cast (numberUnsatisfied)); useValue += thisNumber * perInteger; useBest += bestNumber * perInteger; } } #endif if (useValue > useBest + 1.0e-8) { if (changeUp <= 1.5*changeDown) { betterWay = 1; } else { betterWay = -1; } } } #ifdef COIN_DEVELOP History hist; { CbcDynamicPseudoCostBranchingObject * branchingObject = dynamic_cast(thisOne); if (branchingObject) { CbcSimpleIntegerDynamicPseudoCost * object = branchingObject->object(); assert (object); hist.where_ = 'C'; hist.status_ = ' '; hist.sequence_ = object->columnNumber(); hist.numberUp_ = object->numberTimesUp(); hist.numberUpInf_ = numInfUp; hist.sumUp_ = object->sumUpCost(); hist.upEst_ = changeUp; hist.numberDown_ = object->numberTimesDown(); hist.numberDownInf_ = numInfDown; hist.sumDown_ = object->sumDownCost(); hist.downEst_ = changeDown; } } #endif if (betterWay) { #ifdef COIN_DEVELOP hist.status_ = 'B'; #endif // maybe change better way CbcDynamicPseudoCostBranchingObject * branchingObject = dynamic_cast(thisOne); if (branchingObject) { CbcSimpleIntegerDynamicPseudoCost * object = branchingObject->object(); double separator = object->upDownSeparator(); if (separator > 0.0) { const double * solution = thisOne->model()->testSolution(); double valueVariable = solution[object->columnNumber()]; betterWay = (valueVariable - floor(valueVariable) >= separator) ? 1 : -1; } } bestCriterion_ = value; bestChangeUp_ = changeUp; bestNumberUp_ = numInfUp; bestChangeDown_ = changeDown; bestNumberDown_ = numInfDown; bestObject_ = thisOne; // See if user is overriding way if (thisOne->object() && thisOne->object()->preferredWay()) betterWay = thisOne->object()->preferredWay(); } #ifdef COIN_DEVELOP addRecord(hist); #endif return betterWay; } /* Sets or gets best criterion so far */ void CbcBranchDynamicDecision::setBestCriterion(double value) { bestCriterion_ = value; } double CbcBranchDynamicDecision::getBestCriterion() const { return bestCriterion_; } #ifdef COIN_DEVELOP void printHistory(const char * file) { if (!numberHistory) return; FILE * fp = fopen(file, "w"); assert(fp); int numberIntegers = 0; int i; for (i = 0; i < numberHistory; i++) { if (history[i].where_ != 'C' || history[i].status_ != 'I') numberIntegers = CoinMax(numberIntegers, history[i].sequence_); } numberIntegers++; for (int iC = 0; iC < numberIntegers; iC++) { int n = 0; for (i = 0; i < numberHistory; i++) { if (history[i].sequence_ == iC) { if (!n) fprintf(fp, "XXX %d\n", iC); n++; fprintf(fp, "%c%c up %8d %8d %12.5f %12.5f down %8d %8d %12.5f %12.5f\n", history[i].where_, history[i].status_, history[i].numberUp_, history[i].numberUpInf_, history[i].sumUp_, history[i].upEst_, history[i].numberDown_, history[i].numberDownInf_, history[i].sumDown_, history[i].downEst_); } } } fclose(fp); } #endif // Default Constructor CbcDynamicPseudoCostBranchingObject::CbcDynamicPseudoCostBranchingObject() : CbcIntegerBranchingObject() { changeInGuessed_ = 1.0e-5; object_ = NULL; } // Useful constructor CbcDynamicPseudoCostBranchingObject::CbcDynamicPseudoCostBranchingObject (CbcModel * model, int variable, int way , double value, CbcSimpleIntegerDynamicPseudoCost * object) : CbcIntegerBranchingObject(model, variable, way, value) { changeInGuessed_ = 1.0e-5; object_ = object; } // Does part of work for constructor void CbcDynamicPseudoCostBranchingObject::fillPart (int variable, int way , double value, CbcSimpleIntegerDynamicPseudoCost * object) { CbcIntegerBranchingObject::fillPart(variable, way, value); changeInGuessed_ = 1.0e-5; object_ = object; } // Useful constructor for fixing CbcDynamicPseudoCostBranchingObject::CbcDynamicPseudoCostBranchingObject (CbcModel * model, int variable, int way, double lowerValue, double /*upperValue*/) : CbcIntegerBranchingObject(model, variable, way, lowerValue) { changeInGuessed_ = 1.0e100; object_ = NULL; } // Copy constructor CbcDynamicPseudoCostBranchingObject::CbcDynamicPseudoCostBranchingObject ( const CbcDynamicPseudoCostBranchingObject & rhs) : CbcIntegerBranchingObject(rhs) { changeInGuessed_ = rhs.changeInGuessed_; object_ = rhs.object_; } // Assignment operator CbcDynamicPseudoCostBranchingObject & CbcDynamicPseudoCostBranchingObject::operator=( const CbcDynamicPseudoCostBranchingObject & rhs) { if (this != &rhs) { CbcIntegerBranchingObject::operator=(rhs); changeInGuessed_ = rhs.changeInGuessed_; object_ = rhs.object_; } return *this; } CbcBranchingObject * CbcDynamicPseudoCostBranchingObject::clone() const { return (new CbcDynamicPseudoCostBranchingObject(*this)); } // Destructor CbcDynamicPseudoCostBranchingObject::~CbcDynamicPseudoCostBranchingObject () { } /* Perform a branch by adjusting the bounds of the specified variable. Note that each arm of the branch advances the object to the next arm by advancing the value of way_. Providing new values for the variable's lower and upper bounds for each branching direction gives a little bit of additional flexibility and will be easily extensible to multi-way branching. Returns change in guessed objective on next branch */ double CbcDynamicPseudoCostBranchingObject::branch() { CbcIntegerBranchingObject::branch(); return changeInGuessed_; } /* Some branchingObjects may claim to be able to skip strong branching. If so they have to fill in CbcStrongInfo. The object mention in incoming CbcStrongInfo must match. Returns nonzero if skip is wanted */ int CbcDynamicPseudoCostBranchingObject::fillStrongInfo( CbcStrongInfo & info) { assert (object_); assert (info.possibleBranch == this); info.upMovement = object_->upDynamicPseudoCost() * (ceil(value_) - value_); info.downMovement = object_->downDynamicPseudoCost() * (value_ - floor(value_)); info.numIntInfeasUp -= static_cast (object_->sumUpDecrease() / (1.0e-12 + static_cast (object_->numberTimesUp()))); info.numIntInfeasUp = CoinMax(info.numIntInfeasUp, 0); info.numObjInfeasUp = 0; info.finishedUp = false; info.numItersUp = 0; info.numIntInfeasDown -= static_cast (object_->sumDownDecrease() / (1.0e-12 + static_cast (object_->numberTimesDown()))); info.numIntInfeasDown = CoinMax(info.numIntInfeasDown, 0); info.numObjInfeasDown = 0; info.finishedDown = false; info.numItersDown = 0; info.fix = 0; if (object_->numberTimesUp() < object_->numberBeforeTrust() + 2*object_->numberTimesUpInfeasible() || object_->numberTimesDown() < object_->numberBeforeTrust() + 2*object_->numberTimesDownInfeasible()) { return 0; } else { return 1; } } CoinMP-1.8.3/Cbc/src/CbcHeuristicVND.hpp0000644000175000017500000000456412131054770016233 0ustar renerene// $Id: CbcHeuristicVND.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // edwin 12/5/09 carved out of CbcHeuristicRINS #ifndef CbcHeuristicVND_H #define CbcHeuristicVND_H #include "CbcHeuristic.hpp" /** LocalSearch class */ class CbcHeuristicVND : public CbcHeuristic { public: // Default Constructor CbcHeuristicVND (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicVND (CbcModel & model); // Copy constructor CbcHeuristicVND ( const CbcHeuristicVND &); // Destructor ~CbcHeuristicVND (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicVND & operator=(const CbcHeuristicVND& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) This does Relaxation Induced Neighborhood Search */ virtual int solution(double & objectiveValue, double * newSolution); /// This version fixes stuff and does IP int solutionFix(double & objectiveValue, double * newSolution, const int * keep); /// Sets how often to do it inline void setHowOften(int value) { howOften_ = value; } /// base solution array so we can set inline double * baseSolution() const { return baseSolution_; } protected: // Data /// Number of solutions so we can do something at solution int numberSolutions_; /// How often to do (code can change) int howOften_; /// Number of successes int numberSuccesses_; /// Number of tries int numberTries_; /// Node when last done int lastNode_; /// Step size for decomposition int stepSize_; int k_; int kmax_; int nDifferent_; /// Base solution double * baseSolution_; }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicDW.hpp0000644000175000017500000002364112207141633016112 0ustar renerene// $Id: CbcHeuristicDW.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicDW_H #define CbcHeuristicDW_H #include "CbcHeuristic.hpp" /** This is unlike the other heuristics in that it is very very compute intensive. It tries to find a DW structure and use that */ class CbcHeuristicDW : public CbcHeuristic { public: // Default Constructor CbcHeuristicDW (); /* Constructor with model - assumed before cuts */ CbcHeuristicDW (CbcModel & model, int keepContinuous=0); /* Constructor with model - assumed before cuts */ CbcHeuristicDW (CbcModel & model, int callBack(CbcHeuristicDW * currentHeuristic, CbcModel * thisModel, int whereFrom), int keepContinuous=0); // Copy constructor CbcHeuristicDW ( const CbcHeuristicDW &); // Destructor ~CbcHeuristicDW (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicDW & operator=(const CbcHeuristicDW& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) This does Relaxation Induced Neighborhood Search */ virtual int solution(double & objectiveValue, double * newSolution); /** Return number of blocks <=0 - no usable structure */ inline int numberBlocks() const { return numberBlocks_;} /// Pass in a solution void passInSolution(const double * solution); /// Pass in continuous solution void passInContinuousSolution(const double * solution); /** DW Proposal actions fullDWEverySoOften - 0 - off k - every k times solution gets better */ void setProposalActions(int fullDWEverySoOften); /// Objective value when whichDw created double objectiveValueWhen(int whichDW) const; /// Number of columns in DW int numberColumnsDW(int whichDW) const; /// Solver inline OsiSolverInterface * solver() const { return solver_;} /// DW model (user must delete) OsiSolverInterface * DWModel(int whichDW) const; /// Best objective value inline double bestObjective() const { return bestObjective_;} /// Best solution found so far inline const double * bestSolution() const { return bestSolution_;} /// Continuous solution inline const double * continuousSolution() const { return continuousSolution_;} /// Reduced costs of fixed solution inline const double * fixedDj() const { return fixedDj_;} /// Objective at which DW updated inline const double * objectiveDW() const { return objectiveDW_;} /// Number of times we have added to DW model inline int numberDWTimes() const { return numberDWTimes_;} /// Number of columns in DW inline const int * numberColumnsDW() const { return numberColumnsDW_;} /// Set number of passes inline void setNumberPasses(int value) { numberPasses_ = value;} /// Set number of passes without better solution inline void setNumberBadPasses(int value) { numberBadPasses_ = value;} /// Set number free integers needed (Base value) inline void setNumberNeeded(int value) { nNeededBase_ = value;} /// Get number free integers needed (Base value) inline int getNumberNeeded() const {return nNeededBase_;} /// Set number free integers needed (Current value) inline void setCurrentNumberNeeded(int value) { nNeeded_ = value;} /// Get number free integers needed (Current value) inline int getCurrentNumberNeeded() const {return nNeeded_;} /// Set number nodes (could be done in callback) (Base value) inline void setNumberNodes(int value) { nNodesBase_ = value;} /// Get number nodes (could be done in callback) (Base value) inline int getNumberNodes() const {return nNodesBase_;} /// Set number nodes (could be done in callback) (Current value) inline void setCurrentNumberNodes(int value) { nNodes_ = value;} /// Get number nodes (could be done in callback) (Current value) inline int getCurrentNumberNodes() const {return nNodes_;} /// Set target objective inline void setTargetObjective(double value) { targetObjective_ = value;} /// Sets how often to do it inline void setHowOften(int value) { howOften_ = value; } /// Block for every row inline const int * whichRowBlock() const { return whichRowBlock_;} /// Block for every column inline const int * whichColumnBlock() const { return whichColumnBlock_;} /// Initial Lower bounds inline double * initialLower() const { return saveLower_;} /// Initial Upper bounds inline double * initialUpper() const { return saveUpper_;} /// Local integer arrays (each numberBlocks_ long) inline int * intArrays() const { return intArray_;} /// Local double arrays (each numberBlocks_ long) inline double * doubleArrays() const { return doubleArray_;} /// Phase of solution inline int phase() const { return phase_;} /// Pass number inline int pass() const { return pass_;} /// Which columns are in block inline const int * columnsInBlock() const { return columnsInBlock_;} /// Starts for columnsInBlock inline const int * startColumnBlock() const { return startColumnBlock_;} /// Number of integer variables in each block inline const int * intsInBlock() const { return intsInBlock_;} /// Objective value (could also check validity) double objectiveValue(const double * solution); private: /// Guts of copy void gutsOfCopy(const CbcHeuristicDW & rhs); /// Guts of delete void gutsOfDelete(); /// Set default values void setDefaults(); /// Find structure void findStructure(); /// Set up DW structure void setupDWStructures(); /// Add DW proposals int addDW(const double * solution,int numberBlocksUsed, const int * whichBlocks); protected: typedef int (*heuristicCallBack) (CbcHeuristicDW * ,CbcModel *, int) ; // Data /// Target objective double targetObjective_; /// Best objective value double bestObjective_; /// Objective value last time double lastObjective_; /** Call back whereFrom - 0 - after blocks found but before data setup 1 - after blocks sorted but before used 2 - just before normal branch and bound 3 - after DW has been updated 4 - if better solution found 5 - every time a block might be used next few for adjustment of nNeeded etc 6 - complete search done - no solution 7 - stopped on nodes - no improvement 8 - improving (same as 4 but after nNeeded changed Pointers to local data given by following pointers */ heuristicCallBack functionPointer_; /// Local integer arrays (each numberBlocks_ long) int * intArray_; /// Local double arrays (each numberBlocks_ long) double * doubleArray_; /// Base solver OsiSolverInterface * solver_; /// DW solver OsiSolverInterface * dwSolver_; /// Best solution found so far double * bestSolution_; /// Continuous solution double * continuousSolution_; /// Reduced costs of fixed solution double * fixedDj_; /// Original lower bounds double * saveLower_; /// Original Upper bounds double * saveUpper_; /// random numbers for master rows double * random_; /// Weights for each proposal double * weights_; /// Objective at which DW updated double * objectiveDW_; /// Number of columns in each DW int * numberColumnsDW_; /// Block for every row int * whichRowBlock_; /// Block for every column int * whichColumnBlock_; /// Block number for each proposal int * dwBlock_; /// Points back to master rows int * backwardRow_; /// Which rows are in blocke int * rowsInBlock_; /// Which columns are in block int * columnsInBlock_; /// Starts for rowsInBlock int * startRowBlock_; /// Starts for columnsInBlock int * startColumnBlock_; /// Number of integer variables in each block int * intsInBlock_; /// Bits set for 1 integers in each block unsigned int * fingerPrint_; /// Affinity each block has for other (will be triangular?) unsigned short * affinity_; /** DW Proposal actions fullDWEverySoOften - 0 - off k - every k times solution gets better */ int fullDWEverySoOften_; /// Number of passes int numberPasses_; /// How often to do (code can change) int howOften_; /// Current maximum number of DW proposals int maximumDW_; /// Number of DW proposals int numberDW_; /// Number of times we have added to DW model int numberDWTimes_; /// Number of unsigned ints needed for each block of fingerPrint int sizeFingerPrint_; /// Number of columns in master int numberMasterColumns_; /// Number of rows in master int numberMasterRows_; /// Number of blocks int numberBlocks_; /// Action on decomposition - 1 keep continuous, 0 don't int keepContinuous_; /// Phase of solution int phase_; /// Pass number int pass_; /// Base number of integers needed int nNeededBase_; /// Base number of nodes needed int nNodesBase_; /// Base number of integers needed int nNeeded_; /// Base number of nodes needed int nNodes_; /// Number of passes without better solution int numberBadPasses_; // 0 - fine, 1 can't be better, 2 max node int solveState_; }; #endif CoinMP-1.8.3/Cbc/src/CbcEventHandler.hpp0000644000175000017500000001551012246147201016273 0ustar renerene/* Copyright (C) 2006, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcEventHandler.hpp 1987 2013-11-29 17:27:29Z forrest $ */ #ifndef CbcEventHandler_H #define CbcEventHandler_H /*! \file CbcEventHandler.hpp \brief Event handling for cbc This file contains the declaration of CbcEventHandler, used for event handling in cbc. The central method is CbcEventHandler::event(). The default semantics of this call are `ask for the action to take in reponse to this event'. The call is made at the point in the code where the event occurs (e.g., when a solution is found, or when a node is added to or removed from the search tree). The return value specifies the action to perform in response to the event (e.g., continue, or stop). This is a lazy class. Initially, it knows nothing about specific events, and returns dfltAction_ for any event. This makes for a trivial constructor and fast startup. The only place where the list of known events or actions is hardwired is in the enum definitions for CbcEvent and CbcAction, respectively. At the first call to setAction, a map is created to hold (Event,Action) pairs, and this map will be consulted ever after. Events not in the map will still return the default value. For serious extensions, derive a subclass and replace event() with a function that suits you better. The function has access to the CbcModel via a pointer held in the CbcEventHandler object, and can do as much thinking as it likes before returning an answer. You can also print as much information as you want. The model is held as a const, however, so you can't alter reality. The design of the class deliberately matches ClpEventHandler, so that other solvers can participate in cbc without breaking the patterns set by clp-specific code. */ #include #include /* May well already be declared, but can't hurt. */ class CbcModel ; /* cvs/svn: $Id: CbcEventHandler.hpp 1987 2013-11-29 17:27:29Z forrest $ */ /*! \class CbcEventHandler \brief Base class for Cbc event handling. Up front: We're not talking about unanticipated events here. We're talking about anticipated events, in the sense that the code is going to make a call to event() and is prepared to obey the return value that it receives. The general pattern for usage is as follows:
    1. Create a CbcEventHandler object. This will be initialised with a set of default actions for every recognised event.
    2. Attach the event handler to the CbcModel object.
    3. When execution reaches the point where an event occurs, call the event handler as CbcEventHandler::event(the event). The return value will specify what the code should do in response to the event.
    The return value associated with an event can be changed at any time. */ class CbcEventHandler { public: /*! \brief Events known to cbc */ enum CbcEvent { /*! Processing of the current node is complete. */ node = 200, /*! A tree status interval has arrived. */ treeStatus, /*! A solution has been found. */ solution, /*! A heuristic solution has been found. */ heuristicSolution, /*! A solution will be found unless user takes action (first check). */ beforeSolution1, /*! A solution will be found unless user takes action (thorough check). */ beforeSolution2, /*! After failed heuristic. */ afterHeuristic, /*! On entry to small branch and bound. */ smallBranchAndBound, /*! After a pass of heuristic. */ heuristicPass, /*! When converting constraints to cuts. */ convertToCuts, /*! End of search. */ endSearch } ; /*! \brief Action codes returned by the event handler. Specific values are chosen to match ClpEventHandler return codes. */ enum CbcAction { /*! Continue --- no action required. */ noAction = -1, /*! Stop --- abort the current run at the next opportunity. */ stop = 0, /*! Restart --- restart branch-and-cut search; do not undo root node processing. */ restart, /*! RestartRoot --- undo root node and start branch-and-cut afresh. */ restartRoot, /*! Add special cuts. */ addCuts, /*! Pretend solution never happened. */ killSolution, /*! Take action on modified data. */ takeAction } ; /*! \brief Data type for event/action pairs */ typedef std::map eaMapPair ; /*! \name Event Processing */ //@{ /*! \brief Return the action to be taken for an event. Return the action that should be taken in response to the event passed as the parameter. The default implementation simply reads a return code from a map. */ virtual CbcAction event(CbcEvent whichEvent) ; /*! \brief Return the action to be taken for an event - and modify data. Return the action that should be taken in response to the event passed as the parameter. The default implementation simply reads a return code from a map. */ virtual CbcAction event(CbcEvent whichEvent, void * data) ; //@} /*! \name Constructors and destructors */ //@{ /*! \brief Default constructor. */ CbcEventHandler(CbcModel *model = 0 /* was NULL but 4.6 complains */) ; /*! \brief Copy constructor. */ CbcEventHandler(const CbcEventHandler &orig) ; /*! \brief Assignment. */ CbcEventHandler& operator=(const CbcEventHandler &rhs) ; /*! \brief Clone (virtual) constructor. */ virtual CbcEventHandler* clone() const ; /*! \brief Destructor. */ virtual ~CbcEventHandler() ; //@} /*! \name Set/Get methods */ //@{ /*! \brief Set model. */ inline void setModel(CbcModel *model) { model_ = model ; } /*! \brief Get model. */ inline const CbcModel* getModel() const { return model_ ; } /*! \brief Set the default action */ inline void setDfltAction(CbcAction action) { dfltAction_ = action ; } /*! \brief Set the action code associated with an event */ inline void setAction(CbcEvent event, CbcAction action) { if (eaMap_ == 0) { eaMap_ = new eaMapPair ; } (*eaMap_)[event] = action ; } //@} protected: /*! \name Data members Protected (as opposed to private) to allow access by derived classes. */ //@{ /*! \brief Pointer to associated CbcModel */ CbcModel *model_ ; /*! \brief Default action */ CbcAction dfltAction_ ; /*! \brief Pointer to a map that holds non-default event/action pairs */ eaMapPair *eaMap_ ; //@} } ; #endif CoinMP-1.8.3/Cbc/src/Cbc_ampl.cpp0000644000175000017500000015221412334344417015010 0ustar renerene/* $Id: Cbc_ampl.cpp 2035 2014-05-13 07:26:07Z forrest $ */ /**************************************************************** Copyright (C) 1997-2000 Lucent Technologies Modifications for Coin - Copyright (C) 2006, International Business Machines Corporation and others. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of Lucent or any of its entities not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ /*! \file Cbc_ampl.cpp Interface routines for AMPL. */ #include "CbcConfig.h" #ifdef COIN_HAS_ASL #ifdef HAVE_UNISTD_H # include "unistd.h" #endif #include "CoinUtilsConfig.h" #include "CoinHelperFunctions.hpp" #include "CoinModel.hpp" #include "CoinSort.hpp" #include "CoinPackedMatrix.hpp" #include "CoinMpsIO.hpp" #include "CoinFloatEqual.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif #include "Cbc_ampl.h" extern "C" { # include "getstub.h" # include "asl_pfgh.h" } #include #include /* so decodePhrase and clpCheck can access */ static ampl_info * saveInfo = NULL; // Set to 1 if algorithm found static char algFound[20] = ""; static char* checkPhrase(Option_Info *oi, keyword *kw, char *v) { if (strlen(v)) printf("string %s\n", v); // Say algorithm found strcpy(algFound, kw->desc); return v; } static char* checkPhrase2(Option_Info *oi, keyword *kw, char *v) { if (strlen(v)) printf("string %s\n", v); // put out keyword saveInfo->arguments = (char **) realloc(saveInfo->arguments, (saveInfo->numberArguments + 1) * sizeof(char *)); saveInfo->arguments[saveInfo->numberArguments++] = strdup(kw->desc); return v; } static fint decodePhrase(char * phrase, ftnlen length) { char * blank = strchr(phrase, ' '); if (blank) { /* split arguments */ *blank = '\0'; saveInfo->arguments = (char **) realloc(saveInfo->arguments, (saveInfo->numberArguments + 2) * sizeof(char *)); saveInfo->arguments[saveInfo->numberArguments++] = strdup(phrase); *blank = ' '; phrase = blank + 1; /* move on */ if (strlen(phrase)) saveInfo->arguments[saveInfo->numberArguments++] = strdup(phrase); } else if (strlen(phrase)) { saveInfo->arguments = (char **) realloc(saveInfo->arguments, (saveInfo->numberArguments + 1) * sizeof(char *)); saveInfo->arguments[saveInfo->numberArguments++] = strdup(phrase); } return 0; } static void sos_kludge(int nsos, int *sosbeg, double *sosref, int * sosind) { // Adjust sosref if necessary to make monotonic increasing int i, j, k; // first sort for (i = 0; i < nsos; i++) { k = sosbeg[i]; int end = sosbeg[i+1]; CoinSort_2(sosref + k, sosref + end, sosind + k); } double t, t1; for (i = j = 0; i++ < nsos; ) { k = sosbeg[i]; t = sosref[j]; while (++j < k) { t1 = sosref[j]; t += 1e-10; if (t1 <= t) sosref[j] = t1 = t + 1e-10; t = t1; } } } static char xxxxxx[20]; #define VP (char*) static keyword keywds[] = { /* must be sorted */ { const_cast("barrier"), checkPhrase, (char *) xxxxxx , const_cast("-barrier")}, { const_cast("dual"), checkPhrase, (char *) xxxxxx , const_cast("-dualsimplex")}, { const_cast("help"), checkPhrase2, (char *) xxxxxx , const_cast("-?")}, { const_cast("initial"), checkPhrase, (char *) xxxxxx , const_cast("-initialsolve")}, { const_cast("max"), checkPhrase2, (char *) xxxxxx , const_cast("-maximize")}, { const_cast("maximize"), checkPhrase2, (char *) xxxxxx , const_cast("-maximize")}, { const_cast("primal"), checkPhrase, (char *) xxxxxx , const_cast("-primalsimplex")}, { const_cast("quit"), checkPhrase2, (char *) xxxxxx , const_cast("-quit")}, { const_cast("wantsol"), WS_val, NULL, const_cast("write .sol file (without -AMPL)")} }; static Option_Info Oinfo = { const_cast("cbc"), const_cast("CBC " CBC_VERSION), const_cast("cbc_options"), keywds, nkeywds, 0, 0, 0, decodePhrase, 0, 0, 0, 20130502 }; // strdup used to avoid g++ compiler warning static SufDecl suftab[] = { #ifdef JJF_ZERO { const_cast("current"), 0, ASL_Sufkind_con | ASL_Sufkind_outonly }, { const_cast("current"), 0, ASL_Sufkind_var | ASL_Sufkind_outonly }, { const_cast("direction"), 0, ASL_Sufkind_var }, { const_cast("down"), 0, ASL_Sufkind_con | ASL_Sufkind_outonly }, { const_cast("down"), 0, ASL_Sufkind_var | ASL_Sufkind_outonly }, { const_cast("priority"), 0, ASL_Sufkind_var }, #endif { const_cast("cut"), 0, ASL_Sufkind_con }, { const_cast("direction"), 0, ASL_Sufkind_var }, { const_cast("downPseudocost"), 0, ASL_Sufkind_var | ASL_Sufkind_real }, { const_cast("priority"), 0, ASL_Sufkind_var }, { const_cast("ref"), 0, ASL_Sufkind_var | ASL_Sufkind_real }, { const_cast("sos"), 0, ASL_Sufkind_var }, { const_cast("sos"), 0, ASL_Sufkind_con }, { const_cast("sosno"), 0, ASL_Sufkind_var | ASL_Sufkind_real }, { const_cast("sosref"), 0, ASL_Sufkind_var | ASL_Sufkind_real }, { const_cast("special"), 0, ASL_Sufkind_var }, { const_cast("special"), 0, ASL_Sufkind_con }, /*{ const_cast("special"), 0, ASL_Sufkind_con },*/ { const_cast("sstatus"), 0, ASL_Sufkind_var, 0 }, { const_cast("sstatus"), 0, ASL_Sufkind_con, 0 }, { const_cast("upPseudocost"), 0, ASL_Sufkind_var | ASL_Sufkind_real } #ifdef JJF_ZERO { const_cast("unbdd"), 0, ASL_Sufkind_var | ASL_Sufkind_outonly}, { const_cast("up"), 0, ASL_Sufkind_con | ASL_Sufkind_outonly }, { const_cast("up"), 0, ASL_Sufkind_var | ASL_Sufkind_outonly } #endif }; #include "float.h" #include "limits.h" static ASL *asl = NULL; static FILE *nl = NULL; static void mip_stuff(void) { int i; double *pseudoUp, *pseudoDown; int *priority, *direction; // To label cuts (there will be other uses for special) int *cut; // To label special variables - at present 1= must be >= 1 or <= -1 int * special; SufDesc *dpup, *dpdown, *dpri, *ddir, *dcut, *dspecial; ddir = suf_get("direction", ASL_Sufkind_var); direction = ddir->u.i; dpri = suf_get("priority", ASL_Sufkind_var); priority = dpri->u.i; dspecial = suf_get("special", ASL_Sufkind_con); dcut = suf_get("cut", ASL_Sufkind_con); cut = dcut->u.i; if (!cut) { // try special dcut = suf_get("special", ASL_Sufkind_con); cut = dcut->u.i; } dspecial = suf_get("special", ASL_Sufkind_var); special = dspecial->u.i; dpdown = suf_get("downPseudocost", ASL_Sufkind_var); pseudoDown = dpdown->u.r; dpup = suf_get("upPseudocost", ASL_Sufkind_var); pseudoUp = dpup->u.r; assert(saveInfo); int numberColumns = saveInfo->numberColumns; if (direction) { int baddir = 0; saveInfo->branchDirection = (int *) malloc(numberColumns * sizeof(int)); for (i = 0; i < numberColumns; i++) { int value = direction[i]; if (value < -1 || value > 1) { baddir++; value = 0; } saveInfo->branchDirection[i] = value; } if (baddir) fprintf(Stderr, "Treating %d .direction values outside [-1, 1] as 0.\n", baddir); } if (priority) { int badpri = 0; saveInfo->priorities = (int *) malloc(numberColumns * sizeof(int)); for (i = 0; i < numberColumns; i++) { int value = priority[i]; if (value < 0) { badpri++; value = 0; } saveInfo->priorities[i] = value; } if (badpri) fprintf(Stderr, "Treating %d negative .priority values as 0\n", badpri); } if (special) { int badspecial = 0; saveInfo->special = (int *) malloc(numberColumns * sizeof(int)); for (i = 0; i < numberColumns; i++) { int value = special[i]; if (value < 0) { badspecial++; value = 0; } saveInfo->special[i] = value; } if (badspecial) fprintf(Stderr, "Treating %d negative special values as 0\n", badspecial); } int numberRows = saveInfo->numberRows; if (cut) { int badcut = 0; saveInfo->cut = (int *) malloc(numberRows * sizeof(int)); for (i = 0; i < numberRows; i++) { int value = cut[i]; if (value < 0) { badcut++; value = 0; } saveInfo->cut[i] = value; } if (badcut) fprintf(Stderr, "Treating %d negative cut values as 0\n", badcut); } if (pseudoDown || pseudoUp) { int badpseudo = 0; if (!pseudoDown || !pseudoUp) fprintf(Stderr, "Only one set of pseudocosts - assumed same\n"); saveInfo->pseudoDown = (double *) malloc(numberColumns * sizeof(double)); saveInfo->pseudoUp = (double *) malloc(numberColumns * sizeof(double)); for (i = 0; i < numberColumns; i++) { double valueD = 0.0, valueU = 0.0; if (pseudoDown) { valueD = pseudoDown[i]; if (valueD < 0) { badpseudo++; valueD = 0.0; } } if (pseudoUp) { valueU = pseudoUp[i]; if (valueU < 0) { badpseudo++; valueU = 0.0; } } if (!valueD) valueD = valueU; if (!valueU) valueU = valueD; saveInfo->pseudoDown[i] = valueD; saveInfo->pseudoUp[i] = valueU; } if (badpseudo) fprintf(Stderr, "Treating %d negative pseudoCosts as 0.0\n", badpseudo); } } static void stat_map(int *stat, int n, int *map, int mx, const char *what) { int bad, i, i1 = 0, j, j1 = 0; static char badfmt[] = "Coin driver: %s[%d] = %d\n"; for (i = bad = 0; i < n; i++) { if ((j = stat[i]) >= 0 && j <= mx) stat[i] = map[j]; else { stat[i] = 0; i1 = i; j1 = j; if (!bad++) fprintf(Stderr, badfmt, what, i, j); } } if (bad > 1) { if (bad == 2) fprintf(Stderr, badfmt, what, i1, j1); else fprintf(Stderr, "Coin driver: %d messages about bad %s values suppressed.\n", bad - 1, what); } } int readAmpl(ampl_info * info, int argc, char **argv, void ** coinModel) { char *stub; ograd *og; int i; SufDesc *csd; SufDesc *rsd; /*bool *basis, *lower;*/ /*double *LU, *c, lb, objadj, *rshift, *shift, t, ub, *x, *x0, *x1;*/ char * environment = getenv("cbc_options"); char tempBuffer[20]; double * obj; double * columnLower; double * columnUpper; double * rowLower; double * rowUpper; char ** saveArgv = argv; char fileName[1000]; if (argc > 1) strcpy(fileName, argv[1]); else fileName[0] = '\0'; int nonLinearType = -1; // testosi parameter - if >= 10 then go in through coinModel for (i = 1; i < argc; i++) { if (!strncmp(argv[i], "testosi", 7)) { char * equals = strchr(argv[i], '='); if (equals && atoi(equals + 1) >= 10 && atoi(equals + 1) <= 20) { nonLinearType = atoi(equals + 1); break; } } } int saveArgc = argc; if (info->numberRows != -1234567) memset(info, 0, sizeof(ampl_info)); // overwrite unless magic number set /* save so can be accessed by decodePhrase */ saveInfo = info; info->numberArguments = 0; info->arguments = (char **) malloc(2 * sizeof(char *)); info->arguments[info->numberArguments++] = strdup("ampl"); info->arguments[info->numberArguments++] = strdup("cbc"); asl = ASL_alloc(ASL_read_f); stub = getstub(&argv, &Oinfo); if (!stub) usage_ASL(&Oinfo, 1); nl = jac0dim(stub, 0); suf_declare(suftab, sizeof(suftab) / sizeof(SufDecl)); /* set A_vals to get the constraints column-wise (malloc so can be freed) */ A_vals = (double *) malloc(nzc * sizeof(double)); if (!A_vals) { printf("no memory\n"); return 1; } /* say we want primal solution */ want_xpi0 = 1; /* for basis info */ info->columnStatus = (int *) malloc(n_var * sizeof(int)); for (int i=0;icolumnStatus[i]=3; info->rowStatus = (int *) malloc(n_con * sizeof(int)); for (int i=0;irowStatus[i]=1; csd = suf_iput("sstatus", ASL_Sufkind_var, info->columnStatus); rsd = suf_iput("sstatus", ASL_Sufkind_con, info->rowStatus); if (!(nlvc + nlvo) && nonLinearType < 10) { /* read linear model*/ f_read(nl, 0); // see if any sos if (true) { char *sostype; int nsosnz, *sosbeg, *sosind, * sospri; double *sosref; int nsos; int i = ASL_suf_sos_explict_free; int copri[2], **p_sospri; copri[0] = 0; copri[1] = 0; p_sospri = &sospri; nsos = suf_sos(i, &nsosnz, &sostype, p_sospri, copri, &sosbeg, &sosind, &sosref); if (nsos) { info->numberSos = nsos; info->sosType = (char *) malloc(nsos); info->sosPriority = (int *) malloc(nsos * sizeof(int)); info->sosStart = (int *) malloc((nsos + 1) * sizeof(int)); info->sosIndices = (int *) malloc(nsosnz * sizeof(int)); info->sosReference = (double *) malloc(nsosnz * sizeof(double)); sos_kludge(nsos, sosbeg, sosref, sosind); for (int i = 0; i < nsos; i++) { char ichar = sostype[i]; assert (ichar == '1' || ichar == '2'); info->sosType[i] = static_cast(ichar - '0'); } memcpy(info->sosPriority, sospri, nsos*sizeof(int)); memcpy(info->sosStart, sosbeg, (nsos + 1)*sizeof(int)); memcpy(info->sosIndices, sosind, nsosnz*sizeof(int)); memcpy(info->sosReference, sosref, nsosnz*sizeof(double)); } } /*sos_finish(&specialOrderedInfo, 0, &j, 0, 0, 0, 0, 0);*/ Oinfo.uinfo = tempBuffer; if (getopts(argv, &Oinfo)) return 1; /* objective*/ obj = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) obj[i] = 0.0; if (n_obj) { for (og = Ograd[0]; og; og = og->next) obj[og->varno] = og->coef; } if (objtype[0]) info->direction = -1.0; else info->direction = 1.0; info->offset = objconst(0); /* Column bounds*/ columnLower = (double *) malloc(n_var * sizeof(double)); columnUpper = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) { columnLower[i] = LUv[2*i]; if (columnLower[i] <= negInfinity) columnLower[i] = -COIN_DBL_MAX; columnUpper[i] = LUv[2*i+1]; if (columnUpper[i] >= Infinity) columnUpper[i] = COIN_DBL_MAX; } /* Row bounds*/ rowLower = (double *) malloc(n_con * sizeof(double)); rowUpper = (double *) malloc(n_con * sizeof(double)); for (i = 0; i < n_con; i++) { rowLower[i] = LUrhs[2*i]; if (rowLower[i] <= negInfinity) rowLower[i] = -COIN_DBL_MAX; rowUpper[i] = LUrhs[2*i+1]; if (rowUpper[i] >= Infinity) rowUpper[i] = COIN_DBL_MAX; } info->numberRows = n_con; info->numberColumns = n_var; info->numberElements = nzc; info->numberBinary = nbv; info->numberIntegers = niv + nbv; info->objective = obj; info->rowLower = rowLower; info->rowUpper = rowUpper; info->columnLower = columnLower; info->columnUpper = columnUpper; info->starts = A_colstarts; /*A_colstarts=NULL;*/ info->rows = A_rownos; /*A_rownos=NULL;*/ info->elements = A_vals; /*A_vals=NULL;*/ info->primalSolution = NULL; /* put in primalSolution if exists */ if (X0) { info->primalSolution = (double *) malloc(n_var * sizeof(double)); memcpy(info->primalSolution, X0, n_var*sizeof(double)); } info->dualSolution = NULL; if (niv + nbv > 0) mip_stuff(); // get any extra info if ((!(niv + nbv) && (csd->kind & ASL_Sufkind_input)) || (rsd->kind & ASL_Sufkind_input)) { /* convert status - need info on map */ static int map[] = {1, 3, 1, 1, 2, 1, 1}; stat_map(info->columnStatus, n_var, map, 6, "incoming columnStatus"); stat_map(info->rowStatus, n_con, map, 6, "incoming rowStatus"); } else { /* all slack basis */ // leave status for output */ #ifdef JJF_ZERO free(info->rowStatus); info->rowStatus = NULL; free(info->columnStatus); info->columnStatus = NULL; #endif } } else { // QP // Add .nl if not there if (!strstr(fileName, ".nl")) strcat(fileName, ".nl"); CoinModel * model = new CoinModel((nonLinearType > 10) ? 2 : 1, fileName, info); if (model->numberRows() > 0 || model->numberColumns() > 0) *coinModel = (void *) model; Oinfo.uinfo = tempBuffer; if (getopts(argv, &Oinfo)) return 1; Oinfo.wantsol = 1; if (objtype[0]) info->direction = -1.0; else info->direction = 1.0; model->setOptimizationDirection(info->direction); info->offset = objconst(0); info->numberRows = n_con; info->numberColumns = n_var; info->numberElements = nzc; info->numberBinary = nbv; int numberIntegers = niv + nlvci + nlvoi + nbv; if (nlvci + nlvoi + nlvc + nlvo) { // Non linear // No idea if there are overlaps so compute int numberIntegers = 0; for ( i = 0; i < n_var; i++) { if (model->columnIsInteger(i)) numberIntegers++; } } info->numberIntegers = numberIntegers; // Say nonlinear if it is info->nonLinear = nlvc + nlvo; if (numberIntegers > 0) { mip_stuff(); // get any extra info if (info->cut) model->setCutMarker(info->numberRows, info->cut); if (info->priorities) model->setPriorities(info->numberColumns, info->priorities); } } /* add -solve - unless something there already - also check for sleep=yes */ { int found = 0; int foundLog = 0; int foundSleep = 0; const char * something[] = {"solve", "branch", "duals", "primals", "user"}; for (i = 0; i < info->numberArguments; i++) { unsigned int j; const char * argument = info->arguments[i]; for (j = 0; j < sizeof(something) / sizeof(char *); j++) { const char * check = something[j]; if (!strncmp(argument, check, sizeof(check))) { found = (int)(j + 1); } else if (!strncmp(argument, "log", 3)) { foundLog = 1; } else if (!strncmp(argument, "sleep", 5)) { foundSleep = 1; } } } if (foundLog) { /* print options etc */ for (i = 0; i < saveArgc; i++) printf("%s ", saveArgv[i]); printf("\n"); if (environment) printf("env %s\n", environment); /*printf("%d rows %d columns %d elements\n",n_con,n_var,nzc);*/ } if (!found) { if (!strlen(algFound)) { info->arguments = (char **) realloc(info->arguments, (info->numberArguments + 1) * sizeof(char *)); info->arguments[info->numberArguments++] = strdup("-solve"); } else { // use algorithm from keyword info->arguments = (char **) realloc(info->arguments, (info->numberArguments + 1) * sizeof(char *)); info->arguments[info->numberArguments++] = strdup(algFound); } } if (foundSleep) { /* let user copy .nl file */ fprintf(stderr, "You can copy .nl file %s for debug purposes or attach debugger\n", saveArgv[1]); fprintf(stderr, "Type q to quit, anything else to continue\n"); int getChar = getc(stdin); if (getChar == 'q' || getChar == 'Q') exit(1); } } /* add -quit */ info->arguments = (char **) realloc(info->arguments, (info->numberArguments + 1) * sizeof(char *)); info->arguments[info->numberArguments++] = strdup("-quit"); return 0; } void freeArrays1(ampl_info * info) { free(info->objective); info->objective = NULL; free(info->rowLower); info->rowLower = NULL; free(info->rowUpper); info->rowUpper = NULL; free(info->columnLower); info->columnLower = NULL; free(info->columnUpper); info->columnUpper = NULL; /* this one not freed by ASL_free */ free(info->elements); info->elements = NULL; free(info->primalSolution); info->primalSolution = NULL; free(info->dualSolution); info->dualSolution = NULL; /*free(info->rowStatus); info->rowStatus=NULL; free(info->columnStatus); info->columnStatus=NULL;*/ } void freeArrays2(ampl_info * info) { free(info->primalSolution); info->primalSolution = NULL; free(info->dualSolution); info->dualSolution = NULL; free(info->rowStatus); info->rowStatus = NULL; free(info->columnStatus); info->columnStatus = NULL; free(info->priorities); info->priorities = NULL; free(info->branchDirection); info->branchDirection = NULL; free(info->pseudoDown); info->pseudoDown = NULL; free(info->pseudoUp); info->pseudoUp = NULL; free(info->sosType); info->sosType = NULL; free(info->sosPriority); info->sosPriority = NULL; free(info->sosStart); info->sosStart = NULL; free(info->sosIndices); info->sosIndices = NULL; free(info->sosReference); info->sosReference = NULL; free(info->cut); info->cut = NULL; ASL_free(&asl); } void freeArgs(ampl_info * info) { int i; for ( i = 0; i < info->numberArguments; i++) free(info->arguments[i]); free(info->arguments); } int ampl_obj_prec() { int precision = obj_prec(); if (precision<=0) precision=15; return precision; } void writeAmpl(ampl_info * info) { char buf[1000]; typedef struct { const char *msg; int code; int wantObj; } Sol_info; static Sol_info solinfo[] = { { "optimal solution", 000, 1 }, { "infeasible", 200, 1 }, { "unbounded", 300, 0 }, { "iteration limit etc", 400, 1 }, { "solution limit", 401, 1 }, { "ran out of space", 500, 0 }, { "status unknown", 501, 1 }, { "bug!", 502, 0 }, { "best MIP solution so far restored", 101, 1 }, { "failed to restore best MIP solution", 503, 1 }, { "optimal (?) solution", 100, 1 } }; /* convert status - need info on map */ static int map[] = {0, 3, 4, 1}; sprintf(buf, "%s %s", Oinfo.bsname, info->buffer); solve_result_num = solinfo[info->problemStatus].code; if (info->columnStatus) { stat_map(info->columnStatus, n_var, map, 4, "outgoing columnStatus"); stat_map(info->rowStatus, n_con, map, 4, "outgoing rowStatus"); suf_iput("sstatus", ASL_Sufkind_var, info->columnStatus); suf_iput("sstatus", ASL_Sufkind_con, info->rowStatus); } write_sol(buf, info->primalSolution, info->dualSolution, &Oinfo); } /* Read a problem from AMPL nl file */ CoinModel::CoinModel( int nonLinear, const char * fileName, const void * info) : CoinBaseModel(), maximumRows_(0), maximumColumns_(0), numberElements_(0), maximumElements_(0), numberQuadraticElements_(0), maximumQuadraticElements_(0), rowLower_(NULL), rowUpper_(NULL), rowType_(NULL), objective_(NULL), columnLower_(NULL), columnUpper_(NULL), integerType_(NULL), columnType_(NULL), start_(NULL), elements_(NULL), packedMatrix_(NULL), quadraticElements_(NULL), sortIndices_(NULL), sortElements_(NULL), sortSize_(0), sizeAssociated_(0), associated_(NULL), numberSOS_(0), startSOS_(NULL), memberSOS_(NULL), typeSOS_(NULL), prioritySOS_(NULL), referenceSOS_(NULL), priority_(NULL), cut_(NULL), moreInfo_(NULL), type_(-1), noNames_(false), links_(0) { problemName_ = ""; int status = 0; if (!strcmp(fileName, "-") || !strcmp(fileName, "stdin")) { // stdin } else { std::string name = fileName; bool readable = fileCoinReadable(name); if (!readable) { std::cerr << "Unable to open file " << fileName << std::endl; status = -1; } } if (!status) { gdb(nonLinear, fileName, info); } } #ifdef JJF_ZERO static real qterm(ASL *asl, fint *colq, fint *rowq, real *delsq) { double t, t1, *x, *x0, *xe; fint *rq0, *rqe; t = 0.; x0 = x = X0; xe = x + n_var; rq0 = rowq; while (x < xe) { t1 = *x++; rqe = rq0 + *++colq; while (rowq < rqe) t += t1 * x0[*rowq++]**delsq++; } return 0.5 * t; } #endif // stolen from IPopt with changes typedef struct { double obj_sign_; ASL_pfgh * asl_; double * non_const_x_; int * column_; // for jacobian int * rowStart_; double * gradient_; double * constraintValues_; int nz_h_full_; // number of nonzeros in hessian int nerror_; bool objval_called_with_current_x_; bool conval_called_with_current_x_; bool jacval_called_with_current_x_; } CbcAmplInfo; void CoinModel::gdb( int nonLinear, const char * fileName, const void * info) { const ampl_info * amplInfo = (const ampl_info *) info; ograd *og = NULL; int i; SufDesc *csd = NULL; SufDesc *rsd = NULL; /*bool *basis, *lower;*/ /*double *LU, *c, lb, objadj, *rshift, *shift, t, ub, *x, *x0, *x1;*/ //char tempBuffer[20]; double * objective = NULL; double * columnLower = NULL; double * columnUpper = NULL; double * rowLower = NULL; double * rowUpper = NULL; int * columnStatus = NULL; int * rowStatus = NULL; int numberRows = -1; int numberColumns = -1; int numberElements = -1; int numberBinary = -1; int numberIntegers = -1; int numberAllNonLinearBoth = 0; int numberIntegerNonLinearBoth = 0; int numberAllNonLinearConstraints = 0; int numberIntegerNonLinearConstraints = 0; int numberAllNonLinearObjective = 0; int numberIntegerNonLinearObjective = 0; double * primalSolution = NULL; double direction = 1.0; char * stub = strdup(fileName); CoinPackedMatrix matrixByRow; fint ** colqp = NULL; int *z = NULL; if (nonLinear == 0) { // linear asl = ASL_alloc(ASL_read_f); nl = jac0dim(stub, 0); free(stub); suf_declare(suftab, sizeof(suftab) / sizeof(SufDecl)); /* set A_vals to get the constraints column-wise (malloc so can be freed) */ A_vals = (double *) malloc(nzc * sizeof(double)); if (!A_vals) { printf("no memory\n"); return ; } /* say we want primal solution */ want_xpi0 = 1; /* for basis info */ columnStatus = (int *) malloc(n_var * sizeof(int)); rowStatus = (int *) malloc(n_con * sizeof(int)); csd = suf_iput("sstatus", ASL_Sufkind_var, columnStatus); rsd = suf_iput("sstatus", ASL_Sufkind_con, rowStatus); /* read linear model*/ f_read(nl, 0); // see if any sos if (true) { char *sostype; int nsosnz, *sosbeg, *sosind, * sospri; double *sosref; int nsos; int i = ASL_suf_sos_explict_free; int copri[2], **p_sospri; copri[0] = 0; copri[1] = 0; p_sospri = &sospri; nsos = suf_sos(i, &nsosnz, &sostype, p_sospri, copri, &sosbeg, &sosind, &sosref); if (nsos) { abort(); #ifdef JJF_ZERO info->numberSos = nsos; info->sosType = (char *) malloc(nsos); info->sosPriority = (int *) malloc(nsos * sizeof(int)); info->sosStart = (int *) malloc((nsos + 1) * sizeof(int)); info->sosIndices = (int *) malloc(nsosnz * sizeof(int)); info->sosReference = (double *) malloc(nsosnz * sizeof(double)); sos_kludge(nsos, sosbeg, sosref, sosind); for (int i = 0; i < nsos; i++) { int ichar = sostype[i]; assert (ichar == '1' || ichar == '2'); info->sosType[i] = ichar - '0'; } memcpy(info->sosPriority, sospri, nsos*sizeof(int)); memcpy(info->sosStart, sosbeg, (nsos + 1)*sizeof(int)); memcpy(info->sosIndices, sosind, nsosnz*sizeof(int)); memcpy(info->sosReference, sosref, nsosnz*sizeof(double)); #endif } } /*sos_finish(&specialOrderedInfo, 0, &j, 0, 0, 0, 0, 0);*/ //Oinfo.uinfo = tempBuffer; //if (getopts(argv, &Oinfo)) //return 1; /* objective*/ objective = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) objective[i] = 0.0; if (n_obj) { for (og = Ograd[0]; og; og = og->next) objective[og->varno] = og->coef; } if (objtype[0]) direction = -1.0; else direction = 1.0; objectiveOffset_ = objconst(0); /* Column bounds*/ columnLower = (double *) malloc(n_var * sizeof(double)); columnUpper = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) { columnLower[i] = LUv[2*i]; if (columnLower[i] <= negInfinity) columnLower[i] = -COIN_DBL_MAX; columnUpper[i] = LUv[2*i+1]; if (columnUpper[i] >= Infinity) columnUpper[i] = COIN_DBL_MAX; } /* Row bounds*/ rowLower = (double *) malloc(n_con * sizeof(double)); rowUpper = (double *) malloc(n_con * sizeof(double)); for (i = 0; i < n_con; i++) { rowLower[i] = LUrhs[2*i]; if (rowLower[i] <= negInfinity) rowLower[i] = -COIN_DBL_MAX; rowUpper[i] = LUrhs[2*i+1]; if (rowUpper[i] >= Infinity) rowUpper[i] = COIN_DBL_MAX; } numberRows = n_con; numberColumns = n_var; numberElements = nzc; numberBinary = nbv; numberIntegers = niv; /* put in primalSolution if exists */ if (X0) { primalSolution = (double *) malloc(n_var * sizeof(double)); memcpy( primalSolution, X0, n_var*sizeof(double)); } //double * dualSolution=NULL; if (niv + nbv > 0) mip_stuff(); // get any extra info if ((!(niv + nbv) && (csd->kind & ASL_Sufkind_input)) || (rsd->kind & ASL_Sufkind_input)) { /* convert status - need info on map */ static int map[] = {1, 3, 1, 1, 2, 1, 1}; stat_map(columnStatus, n_var, map, 6, "incoming columnStatus"); stat_map(rowStatus, n_con, map, 6, "incoming rowStatus"); } else { /* all slack basis */ // leave status for output */ #ifdef JJF_ZERO free(rowStatus); rowStatus = NULL; free(columnStatus); columnStatus = NULL; #endif } CoinPackedMatrix columnCopy(true, numberRows, numberColumns, numberElements, A_vals, A_rownos, A_colstarts, NULL); matrixByRow.reverseOrderedCopyOf(columnCopy); } else if (nonLinear == 1) { // quadratic asl = ASL_alloc(ASL_read_fg); nl = jac0dim(stub, (ftnlen) strlen(stub)); free(stub); suf_declare(suftab, sizeof(suftab) / sizeof(SufDecl)); /* read model*/ X0 = (double*) malloc(n_var * sizeof(double)); CoinZeroN(X0, n_var); qp_read(nl, 0); assert (n_obj == 1); int nz = 1 + n_con; colqp = (fint**) malloc(nz * (2 * sizeof(int*) + sizeof(double*))); fint ** rowqp = colqp + nz; double ** delsqp = (double **)(rowqp + nz); z = (int*) malloc(nz * sizeof(int)); for (i = 0; i <= n_con; i++) { z[i] = nqpcheck(-i, rowqp + i, colqp + i, delsqp + i); } qp_opify(); /* objective*/ objective = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) objective[i] = 0.0; if (n_obj) { for (og = Ograd[0]; og; og = og->next) objective[og->varno] = og->coef; } if (objtype[0]) direction = -1.0; else direction = 1.0; objectiveOffset_ = objconst(0); /* Column bounds*/ columnLower = (double *) malloc(n_var * sizeof(double)); columnUpper = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) { columnLower[i] = LUv[2*i]; if (columnLower[i] <= negInfinity) columnLower[i] = -COIN_DBL_MAX; columnUpper[i] = LUv[2*i+1]; if (columnUpper[i] >= Infinity) columnUpper[i] = COIN_DBL_MAX; } // Build by row from scratch //matrixByRow.reserve(n_var,nzc,true); // say row orderded matrixByRow.transpose(); /* Row bounds*/ rowLower = (double *) malloc(n_con * sizeof(double)); rowUpper = (double *) malloc(n_con * sizeof(double)); CoinBigIndex * rowStart = new CoinBigIndex [n_con+1]; int * column = new int [nzc]; double * element = new double [nzc]; rowStart[0] = 0; numberElements = 0; for (i = 0; i < n_con; i++) { rowLower[i] = LUrhs[2*i]; if (rowLower[i] <= negInfinity) rowLower[i] = -COIN_DBL_MAX; rowUpper[i] = LUrhs[2*i+1]; if (rowUpper[i] >= Infinity) rowUpper[i] = COIN_DBL_MAX; for (cgrad * cg = Cgrad[i]; cg; cg = cg->next) { column[numberElements] = cg->varno; element[numberElements++] = cg->coef; } rowStart[i+1] = numberElements; } assert (numberElements == nzc); matrixByRow.appendRows(n_con, rowStart, column, element); delete [] rowStart; delete [] column; delete [] element; numberRows = n_con; numberColumns = n_var; //numberElements=nzc; numberBinary = nbv; numberIntegers = niv; numberAllNonLinearBoth = nlvb; numberIntegerNonLinearBoth = nlvbi; numberAllNonLinearConstraints = nlvc; numberIntegerNonLinearConstraints = nlvci; numberAllNonLinearObjective = nlvo; numberIntegerNonLinearObjective = nlvoi; /* say we want primal solution */ want_xpi0 = 1; //double * dualSolution=NULL; // save asl // Fix memory leak one day CbcAmplInfo * info = new CbcAmplInfo; //amplGamsData_ = info; info->asl_ = NULL; // as wrong form asl; info->nz_h_full_ = -1; // number of nonzeros in hessian info->objval_called_with_current_x_ = false; info->nerror_ = 0; info->obj_sign_ = direction; info->conval_called_with_current_x_ = false; info->non_const_x_ = NULL; info->jacval_called_with_current_x_ = false; info->rowStart_ = NULL; info->column_ = NULL; info->gradient_ = NULL; info->constraintValues_ = NULL; } else if (nonLinear == 2) { // General nonlinear! //ASL_pfgh* asl = (ASL_pfgh*)ASL_alloc(ASL_read_pfgh); asl = ASL_alloc(ASL_read_pfgh); nl = jac0dim(stub, (ftnlen) strlen(stub)); free(stub); suf_declare(suftab, sizeof(suftab) / sizeof(SufDecl)); /* read model*/ X0 = (double*) malloc(n_var * sizeof(double)); CoinZeroN(X0, n_var); // code stolen from Ipopt int retcode = pfgh_read(nl, ASL_return_read_err | ASL_findgroups); switch (retcode) { case ASL_readerr_none : {} break; case ASL_readerr_nofile : { printf( "Cannot open .nl file\n"); exit(-1); } break; case ASL_readerr_nonlin : { assert(false); // this better not be an error! printf( "model involves nonlinearities (ed0read)\n"); exit(-1); } break; case ASL_readerr_argerr : { printf( "user-defined function with bad args\n"); exit(-1); } break; case ASL_readerr_unavail : { printf( "user-defined function not available\n"); exit(-1); } break; case ASL_readerr_corrupt : { printf( "corrupt .nl file\n"); exit(-1); } break; case ASL_readerr_bug : { printf( "bug in .nl reader\n"); exit(-1); } break; case ASL_readerr_CLP : { printf( "ASL error message: \"solver cannot handle CLP extensions\"\n"); exit(-1); } break; default: { printf( "Unknown error in stub file read. retcode = %d\n", retcode); exit(-1); } break; } // see "changes" in solvers directory of ampl code... hesset(1, 0, 1, 0, nlc); assert (n_obj == 1); // find the nonzero structure for the hessian // parameters to sphsetup: int coeff_obj = 1; // coefficient of the objective fn ??? int mult_supplied = 1; // multipliers will be supplied int uptri = 1; // only need the upper triangular part // save asl // Fix memory leak one day CbcAmplInfo * info = new CbcAmplInfo; moreInfo_ = (void *) info; //amplGamsData_ = info; info->asl_ = (ASL_pfgh *) asl; // This is not easy to get from ampl so save info->nz_h_full_ = sphsetup(-1, coeff_obj, mult_supplied, uptri); info->objval_called_with_current_x_ = false; info->nerror_ = 0; info->obj_sign_ = direction; info->conval_called_with_current_x_ = false; info->non_const_x_ = NULL; info->jacval_called_with_current_x_ = false; // Look at nonlinear if (nzc) { n_conjac[1] = nlc; // just nonlinear int * rowStart = new int [nlc+1]; info->rowStart_ = rowStart; // See how many int current_nz = 0; for (int i = 0; i < nlc; i++) { for (cgrad* cg = Cgrad[i]; cg; cg = cg->next) { current_nz++; } } // setup the structure int * column = new int [current_nz]; info->column_ = column; current_nz = 0; rowStart[0] = 0; for (int i = 0; i < nlc; i++) { for (cgrad* cg = Cgrad[i]; cg; cg = cg->next) { cg->goff = current_nz; //iRow[cg->goff] = i ; //jCol[cg->goff] = cg->varno + 1; column[cg->goff] = cg->varno ; current_nz++; } rowStart[i+1] = current_nz; } info->gradient_ = new double [nzc]; info->constraintValues_ = new double [nlc]; } /* objective*/ objective = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) objective[i] = 0.0; if (n_obj) { for (og = Ograd[0]; og; og = og->next) objective[og->varno] = og->coef; } if (objtype[0]) direction = -1.0; else direction = 1.0; objectiveOffset_ = objconst(0); /* Column bounds*/ columnLower = (double *) malloc(n_var * sizeof(double)); columnUpper = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) { columnLower[i] = LUv[2*i]; if (columnLower[i] <= negInfinity) columnLower[i] = -COIN_DBL_MAX; columnUpper[i] = LUv[2*i+1]; if (columnUpper[i] >= Infinity) columnUpper[i] = COIN_DBL_MAX; } // Build by row from scratch //matrixByRow.reserve(n_var,nzc,true); // say row orderded matrixByRow.transpose(); CoinBigIndex * rowStart = new CoinBigIndex [n_con+1]; int * column = new int [nzc]; double * element = new double [nzc]; rowStart[0] = 0; numberElements = 0; /* Row bounds*/ rowLower = (double *) malloc(n_con * sizeof(double)); rowUpper = (double *) malloc(n_con * sizeof(double)); for (i = 0; i < n_con; i++) { rowLower[i] = LUrhs[2*i]; if (rowLower[i] <= negInfinity) rowLower[i] = -COIN_DBL_MAX; rowUpper[i] = LUrhs[2*i+1]; if (rowUpper[i] >= Infinity) rowUpper[i] = COIN_DBL_MAX; for (cgrad * cg = Cgrad[i]; cg; cg = cg->next) { column[numberElements] = cg->varno; double value = cg->coef; if (!value) value = -1.2345e-29; element[numberElements++] = value; } rowStart[i+1] = numberElements; } assert (numberElements == nzc); matrixByRow.appendRows(n_con, rowStart, column, element); delete [] rowStart; delete [] column; delete [] element; numberRows = n_con; numberColumns = n_var; numberElements = nzc; numberBinary = nbv; numberIntegers = niv; numberAllNonLinearBoth = nlvb; numberIntegerNonLinearBoth = nlvbi; numberAllNonLinearConstraints = nlvc; numberIntegerNonLinearConstraints = nlvci; numberAllNonLinearObjective = nlvo; numberIntegerNonLinearObjective = nlvoi; /* say we want primal solution */ want_xpi0 = 1; //double * dualSolution=NULL; } else { abort(); } // set problem name problemName_ = "???"; // Build by row from scratch const double * element = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); for (i = 0; i < numberRows; i++) { addRow(rowLength[i], column + rowStart[i], element + rowStart[i], rowLower[i], rowUpper[i]); } // Now do column part for (i = 0; i < numberColumns; i++) { setColumnBounds(i, columnLower[i], columnUpper[i]); setColumnObjective(i, objective[i]); } for ( i = numberColumns - numberBinary - numberIntegers; i < numberColumns; i++) { setColumnIsInteger(i, true); } // and non linear for (i = numberAllNonLinearBoth - numberIntegerNonLinearBoth; i < numberAllNonLinearBoth; i++) { setColumnIsInteger(i, true); } for (i = numberAllNonLinearConstraints - numberIntegerNonLinearConstraints; i < numberAllNonLinearConstraints; i++) { setColumnIsInteger(i, true); } for (i = numberAllNonLinearObjective - numberIntegerNonLinearObjective; i < numberAllNonLinearObjective; i++) { setColumnIsInteger(i, true); } free(columnLower); free(columnUpper); free(rowLower); free(rowUpper); free(objective); // space for building a row char * temp = new char [30*numberColumns_]; // do names int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { char name[9]; sprintf(name, "r%7.7d", iRow); setRowName(iRow, name); } int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { char name[9]; sprintf(name, "c%7.7d", iColumn); setColumnName(iColumn, name); } if (colqp) { // add in quadratic int nz = 1 + n_con; int nOdd = 0; fint ** rowqp = colqp + nz; double ** delsqp = (double **)(rowqp + nz); for (i = 0; i <= n_con; i++) { int nels = z[i]; if (nels) { double * element = delsqp[i]; int * start = (int *) colqp[i]; int * row = (int *) rowqp[i]; if (!element) { // odd row - probably not quadratic nOdd++; continue; } #ifdef JJF_ZERO printf("%d quadratic els\n", nels); for (int j = 0; j < n_var; j++) { for (int k = start[j]; k < start[j+1]; k++) printf("%d %d %g\n", j, row[k], element[k]); } #endif if (i) { int iRow = i - 1; for (int j = 0; j < n_var; j++) { for (int k = start[j]; k < start[j+1]; k++) { int kColumn = row[k]; double value = element[k]; // ampl gives twice with assumed 0.5 if (kColumn < j) continue; else if (kColumn == j) value *= 0.5; const char * expr = getElementAsString(iRow, j); double constant = 0.0; bool linear; if (expr && strcmp(expr, "Numeric")) { linear = false; } else { constant = getElement(iRow, j); linear = true; } char temp2[30]; if (value == 1.0) sprintf(temp2, "c%7.7d", kColumn); else sprintf(temp2, "%g*c%7.7d", value, kColumn); if (linear) { if (!constant) strcpy(temp, temp2); else if (value > 0.0) sprintf(temp, "%g+%s", constant, temp2); else sprintf(temp, "%g%s", constant, temp2); } else { if (value > 0.0) sprintf(temp, "%s+%s", expr, temp2); else sprintf(temp, "%s%s", expr, temp2); } assert (static_cast(strlen(temp)) < 30*numberColumns_); setElement(iRow, j, temp); if (amplInfo->logLevel > 1) printf("el for row %d column c%7.7d is %s\n", iRow, j, temp); } } } else { // objective for (int j = 0; j < n_var; j++) { for (int k = start[j]; k < start[j+1]; k++) { int kColumn = row[k]; double value = element[k]; // ampl gives twice with assumed 0.5 if (kColumn < j) continue; else if (kColumn == j) value *= 0.5; const char * expr = getColumnObjectiveAsString(j); double constant = 0.0; bool linear; if (expr && strcmp(expr, "Numeric")) { linear = false; } else { constant = getColumnObjective(j); linear = true; } char temp2[30]; if (value == 1.0) sprintf(temp2, "c%7.7d", kColumn); else sprintf(temp2, "%g*c%7.7d", value, kColumn); if (linear) { if (!constant) strcpy(temp, temp2); else if (value > 0.0) sprintf(temp, "%g+%s", constant, temp2); else sprintf(temp, "%g%s", constant, temp2); } else { if (value > 0.0) sprintf(temp, "%s+%s", expr, temp2); else sprintf(temp, "%s%s", expr, temp2); } assert (static_cast(strlen(temp)) < 30*numberColumns_); setObjective(j, temp); if (amplInfo->logLevel > 1) printf("el for objective column c%7.7d is %s\n", j, temp); } } } } } if (nOdd) { printf("%d non-linear constraints could not be converted to quadratic\n", nOdd); exit(77); } } delete [] temp; free(colqp); free(z); // see if any sos { char *sostype; int nsosnz, *sosbeg, *sosind, * sospri; double *sosref; int nsos; int i = ASL_suf_sos_explict_free; int copri[2], **p_sospri; copri[0] = 0; copri[1] = 0; p_sospri = &sospri; nsos = suf_sos(i, &nsosnz, &sostype, p_sospri, copri, &sosbeg, &sosind, &sosref); if (nsos) { numberSOS_ = nsos; typeSOS_ = new int [numberSOS_]; prioritySOS_ = new int [numberSOS_]; startSOS_ = new int [numberSOS_+1]; memberSOS_ = new int[nsosnz]; referenceSOS_ = new double [nsosnz]; sos_kludge(nsos, sosbeg, sosref, sosind); for (int i = 0; i < nsos; i++) { int ichar = sostype[i]; assert (ichar == '1' || ichar == '2'); typeSOS_[i] = ichar - '0'; } memcpy(prioritySOS_, sospri, nsos*sizeof(int)); memcpy(startSOS_, sosbeg, (nsos + 1)*sizeof(int)); memcpy(memberSOS_, sosind, nsosnz*sizeof(int)); memcpy(referenceSOS_, sosref, nsosnz*sizeof(double)); } } } #else #include "Cbc_ampl.h" int readAmpl(ampl_info * , int , char **, void ** ) { return 0; } void freeArrays1(ampl_info *) { } void freeArrays2(ampl_info *) { } void freeArgs(ampl_info * ) { } int ampl_obj_prec() { return 0; } void writeAmpl(ampl_info * ) { } #endif CoinMP-1.8.3/Cbc/src/CbcSolverAnalyze.hpp0000644000175000017500000000120312131054770016505 0ustar renerene/* $Id: CbcSolverAnalyze.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolverAnalyze.hpp \brief Look to see if a constraint is all-integer (variables & coeffs), or could be all integer. */ #ifndef CbcSolverAnalyze_H #define CbcSolverAnalyze_H int * analyze(OsiClpSolverInterface * solverMod, int & numberChanged, double & increment, bool changeInt, CoinMessageHandler * generalMessageHandler, bool noPrinting); #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicPivotAndFix.cpp0000644000175000017500000004714412432625130017771 0ustar renerene/* $Id: CbcHeuristicPivotAndFix.cpp 2094 2014-11-18 11:15:36Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristicPivotAndFix.hpp" #include "OsiClpSolverInterface.hpp" #include "CoinTime.hpp" //#define FORNOW // Default Constructor CbcHeuristicPivotAndFix::CbcHeuristicPivotAndFix() : CbcHeuristic() { } // Constructor with model - assumed before cuts CbcHeuristicPivotAndFix::CbcHeuristicPivotAndFix(CbcModel & model) : CbcHeuristic(model) { } // Destructor CbcHeuristicPivotAndFix::~CbcHeuristicPivotAndFix () { } // Clone CbcHeuristic * CbcHeuristicPivotAndFix::clone() const { return new CbcHeuristicPivotAndFix(*this); } // Create C++ lines to get to current state void CbcHeuristicPivotAndFix::generateCpp( FILE * fp) { CbcHeuristicPivotAndFix other; fprintf(fp, "0#include \"CbcHeuristicPivotAndFix.hpp\"\n"); fprintf(fp, "3 CbcHeuristicPivotAndFix heuristicPFX(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicPFX"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicPFX);\n"); } // Copy constructor CbcHeuristicPivotAndFix::CbcHeuristicPivotAndFix(const CbcHeuristicPivotAndFix & rhs) : CbcHeuristic(rhs) { } // Assignment operator CbcHeuristicPivotAndFix & CbcHeuristicPivotAndFix::operator=( const CbcHeuristicPivotAndFix & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); } return *this; } // Resets stuff if model changes void CbcHeuristicPivotAndFix::resetModel(CbcModel * /*model*/) { //CbcHeuristic::resetModel(model); } /* Comments needed Returns 1 if solution, 0 if not */ int CbcHeuristicPivotAndFix::solution(double & /*solutionValue*/, double * /*betterSolution*/) { numCouldRun_++; // Todo: Ask JJHF what this for. std::cout << "Entering Pivot-and-Fix Heuristic" << std::endl; #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif #ifdef FORNOW std::cout << "Lucky you! You're in the Pivot-and-Fix Heuristic" << std::endl; // The struct should be moved to member data typedef struct { int numberSolutions; int maximumSolutions; int numberColumns; double ** solution; int * numberUnsatisfied; } clpSolution; double start = CoinCpuTime(); OsiClpSolverInterface * clpSolverOriginal = dynamic_cast (model_->solver()); assert (clpSolverOriginal); OsiClpSolverInterface *clpSolver(clpSolverOriginal); ClpSimplex * simplex = clpSolver->getModelPtr(); // Initialize the structure holding the solutions clpSolution solutions; // Set typeStruct field of ClpTrustedData struct to one. // This tells Clp it's "Mahdi!" ClpTrustedData trustedSolutions; trustedSolutions.typeStruct = 1; trustedSolutions.data = &solutions; solutions.numberSolutions = 0; solutions.maximumSolutions = 0; solutions.numberColumns = simplex->numberColumns(); solutions.solution = NULL; solutions.numberUnsatisfied = NULL; simplex->setTrustedUserPointer(&trustedSolutions); // Solve from all slack to get some points simplex->allSlackBasis(); simplex->primal(); // ------------------------------------------------- // Get the problem information // - get the number of cols and rows int numCols = clpSolver->getNumCols(); int numRows = clpSolver->getNumRows(); // - get the right hand side of the rows const double * rhs = clpSolver->getRightHandSide(); // - find the integer variables bool * varClassInt = new bool[numCols]; int numInt = 0; for (int i = 0; i < numCols; i++) { if (clpSolver->isContinuous(i)) varClassInt[i] = 0; else { varClassInt[i] = 1; numInt++; } } // -Get the rows sense const char * rowSense; rowSense = clpSolver->getRowSense(); // -Get the objective coefficients const double *objCoefficients = clpSolver->getObjCoefficients(); double *originalObjCoeff = new double [numCols]; for (int i = 0; i < numCols; i++) originalObjCoeff[i] = objCoefficients[i]; // -Get the matrix of the problem double ** matrix = new double * [numRows]; for (int i = 0; i < numRows; i++) { matrix[i] = new double[numCols]; for (int j = 0; j < numCols; j++) matrix[i][j] = 0; } const CoinPackedMatrix* matrixByRow = clpSolver->getMatrixByRow(); const double * matrixElements = matrixByRow->getElements(); const int * matrixIndices = matrixByRow->getIndices(); const int * matrixStarts = matrixByRow->getVectorStarts(); for (int j = 0; j < numRows; j++) { for (int i = matrixStarts[j]; i < matrixStarts[j+1]; i++) { matrix[j][matrixIndices[i]] = matrixElements[i]; } } // The newObj is the randomly perturbed constraint used to find new // corner points double * newObj = new double [numCols]; // Set the random seed srand ( time(NULL) + 1); int randNum; // We're going to add a new row to the LP formulation // after finding each new solution. // Adding a new row requires the new elements and the new indices. // The elements are original objective function coefficients. // The indicies are the (dense) columns indices stored in addRowIndex. // The rhs is the value of the new solution stored in solutionValue. int * addRowIndex = new int[numCols]; for (int i = 0; i < numCols; i++) addRowIndex[i] = i; // The number of feasible solutions found by the PF heuristic. // This controls the return code of the solution() method. int numFeasibles = 0; // Shuffle the rows int * index = new int [numRows]; for (int i = 0; i < numRows; i++) index[i] = i; for (int i = 0; i < numRows; i++) { int temp = index[i]; int randNumTemp = i + (rand() % (numRows - i)); index[i] = index[randNumTemp]; index[randNumTemp] = temp; } // In the clpSolution struct, we store a lot of column solutions. // For each perturb objective, we store the solution from each // iteration of the LP solve. // For each perturb objective, we look at the collection of // solutions to do something extremly intelligent :-) // We could (and should..and will :-) wipe out the block of // solutions when we're done with them. But for now, we just move on // and store the next block of solutions for the next (perturbed) // objective. // The variable startIndex tells us where the new block begins. int startIndex = 0; // At most "fixThreshold" number of integer variables can be unsatisfied // for calling smallBranchAndBound(). // The PF Heuristic only fixes fixThreshold number of variables to // their integer values. Not more. Not less. The reason is to give // the smallBB some opportunity to find better solutions. If we fix // everything it might be too many (leading the heuristic to come up // with infeasibility rather than a useful result). // (This is an important paramater. And it is dynamically set.) double fixThreshold; /* if(numInt > 400) fixThreshold = 17*sqrt(numInt); if(numInt<=400 && numInt>100) fixThreshold = 5*sqrt(numInt); if(numInt<=100) fixThreshold = 4*sqrt(numInt); */ // Initialize fixThreshold based on the number of integer // variables if (numInt <= 100) fixThreshold = .35 * numInt; if (numInt > 100 && numInt < 1000) fixThreshold = .85 * numInt; if (numInt >= 1000) fixThreshold = .1 * numInt; // Whenever the dynamic system for changing fixThreshold // kicks in, it changes the parameter by the // fixThresholdChange amount. // (The 25% should be member data and tuned. Another paper!) double fixThresholdChange = 0.25 * fixThreshold; // maxNode is the maximum number of nodes we allow smallBB to // search. It's initialized to 400 and changed dynamically. // The 400 should be member data, if we become virtuous. int maxNode = 400; // We control the decision to change maxNode through the boolean // variable changeMaxNode. The boolean variable is initialized to // true and gets set to false under a condition (and is never true // again.) // It's flipped off and stays off (in the current incarnation of PF) bool changeMaxNode = 1; // The sumReturnCode is used for the dynamic system that sets // fixThreshold and changeMaxNode. // // We track what's happening in sumReturnCode. There are 8 switches. // The first 5 switches corresponds to a return code for smallBB. // // We want to know how many times we consecutively get the same // return code. // // If "good" return codes are happening often enough, we're happy. // // If a "bad" returncodes happen consecutively, we want to // change something. // // The switch 5 is the number of times PF didn't call smallBB // becuase the number of integer variables that took integer values // was less than fixThreshold. // // The swicth 6 was added for a brilliant idea...to be announced // later (another paper!) // // The switch 7 is the one that changes the max node. Read the // code. (Todo: Verbalize the brilliant idea for the masses.) // int sumReturnCode[8]; /* sumReturnCode[0] ~ -1 --> problem too big for smallBB sumReturnCode[1] ~ 0 --> smallBB not finshed and no soln sumReturnCode[2] ~ 1 --> smallBB not finshed and there is a soln sumReturnCode[3] ~ 2 --> smallBB finished and no soln sumReturnCode[4] ~ 3 --> smallBB finished and there is a soln sumReturnCode[5] ~ didn't call smallBranchAndBound too few to fix sumReturnCode[6] ~ didn't call smallBranchAndBound too many unsatisfied sumReturnCode[7] ~ the same as sumReturnCode[1] but becomes zero just if the returnCode is not 0 */ for (int i = 0; i < 8; i++) sumReturnCode[i] = 0; int * colIndex = new int[numCols]; for (int i = 0; i < numCols; i++) colIndex[i] = i; double cutoff = COIN_DBL_MAX; bool didMiniBB; // Main loop for (int i = 0; i < numRows; i++) { // track the number of mini-bb for the dynamic threshold setting didMiniBB = 0; for (int k = startIndex; k < solutions.numberSolutions; k++) //if the point has 0 unsatisfied variables; make sure it is //feasible. Check integer feasiblity and constraints. if (solutions.numberUnsatisfied[k] == 0) { double feasibility = 1; //check integer feasibility for (int icol = 0; icol < numCols; icol++) { double closest = floor(solutions.solution[k][icol] + 0.5); if (varClassInt[icol] && (fabs(solutions.solution[k][icol] - closest) > 1e-6)) { feasibility = 0; break; } } //check if the solution satisfies the constraints for (int irow = 0; irow < numRows; irow++) { double lhs = 0; for (int j = 0; j < numCols; j++) lhs += matrix[irow][j] * solutions.solution[k][j]; if (rowSense[irow] == 'L' && lhs > rhs[irow] + 1e-6) { feasibility = 0; break; } if (rowSense[irow] == 'G' && lhs < rhs[irow] - 1e-6) { feasibility = 0; break; } if (rowSense[irow] == 'E' && (lhs - rhs[irow] > 1e-6 || lhs - rhs[irow] < -1e-6)) { feasibility = 0; break; } } //if feasible, find the objective value and set the cutoff // for the smallBB and add a new constraint to the LP // (and update the best solution found so far for the // return arguments) if (feasibility) { double objectiveValue = 0; for (int j = 0; j < numCols; j++) objectiveValue += solutions.solution[k][j] * originalObjCoeff[j]; cutoff = objectiveValue; clpSolver->addRow(numCols, addRowIndex, originalObjCoeff, -COIN_DBL_MAX, cutoff); // Todo: pick up the best solution in the block (not // the last). solutionValue = objectiveValue; for (int m = 0; m < numCols; m++) betterSolution[m] = solutions.solution[k][m]; numFeasibles++; } } // Go through the block of solution and decide if to call smallBB for (int k = startIndex; k < solutions.numberSolutions; k++) { if (solutions.numberUnsatisfied[k] <= fixThreshold) { // get new copy OsiSolverInterface * newSolver; newSolver = new OsiClpSolverInterface(*clpSolver); newSolver->setObjSense(1); newSolver->setObjective(originalObjCoeff); int numberColumns = newSolver->getNumCols(); int numFixed = 0; // Fix the first fixThreshold number of integer vars // that are satisfied for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++) { if (newSolver->isInteger(iColumn)) { double value = solutions.solution[k][iColumn]; double intValue = floor(value + 0.5); if (fabs(value - intValue) < 1.0e-5) { newSolver->setColLower(iColumn, intValue); newSolver->setColUpper(iColumn, intValue); numFixed++; if (numFixed > numInt - fixThreshold) break; } } } COIN_DETAIL_PRINT(printf("numFixed: %d\n", numFixed)); COIN_DETAIL_PRINT(printf("fixThreshold: %f\n", fixThreshold)); COIN_DETAIL_PRINT(printf("numInt: %d\n", numInt)); double *newSolution = new double[numCols]; double newSolutionValue; // Call smallBB on the modified problem int returnCode = smallBranchAndBound(newSolver, maxNode, newSolution, newSolutionValue, cutoff, "mini"); // If smallBB found a solution, update the better // solution and solutionValue (we gave smallBB our // cutoff, so it only finds improving solutions) if (returnCode == 1 || returnCode == 3) { numFeasibles ++; solutionValue = newSolutionValue; for (int m = 0; m < numCols; m++) betterSolution[m] = newSolution[m]; COIN_DETAIL_PRINT(printf("cutoff: %f\n", newSolutionValue)); COIN_DETAIL_PRINT(printf("time: %.2lf\n", CoinCpuTime() - start)); } didMiniBB = 1; COIN_DETAIL_PRINT(printf("returnCode: %d\n", returnCode)); //Update sumReturnCode array for (int iRC = 0; iRC < 6; iRC++) { if (iRC == returnCode + 1) sumReturnCode[iRC]++; else sumReturnCode[iRC] = 0; } if (returnCode != 0) sumReturnCode[7] = 0; else sumReturnCode[7]++; if (returnCode == 1 || returnCode == 3) { cutoff = newSolutionValue; clpSolver->addRow(numCols, addRowIndex, originalObjCoeff, -COIN_DBL_MAX, cutoff); COIN_DETAIL_PRINT(printf("******************\n\n*****************\n")); } break; } } if (!didMiniBB && solutions.numberSolutions - startIndex > 0) { sumReturnCode[5]++; for (int iRC = 0; iRC < 5; iRC++) sumReturnCode[iRC] = 0; } //Change "fixThreshold" if needed // using the data we've recorded in sumReturnCode if (sumReturnCode[1] >= 3) fixThreshold -= fixThresholdChange; if (sumReturnCode[7] >= 3 && changeMaxNode) { maxNode *= 5; changeMaxNode = 0; } if (sumReturnCode[3] >= 3 && fixThreshold < 0.95 * numInt) fixThreshold += fixThresholdChange; if (sumReturnCode[5] >= 4) fixThreshold += fixThresholdChange; if (sumReturnCode[0] > 3) fixThreshold -= fixThresholdChange; startIndex = solutions.numberSolutions; //Check if the maximum iterations limit is reached // rlh: Ask John how this is working with the change to trustedUserPtr. if (solutions.numberSolutions > 20000) break; // The first time in this loop PF solves orig LP. //Generate the random objective function randNum = rand() % 10 + 1; randNum = fmod(randNum, 2); for (int j = 0; j < numCols; j++) { if (randNum == 1) if (fabs(matrix[index[i]][j]) < 1e-6) newObj[j] = 0.1; else newObj[j] = matrix[index[i]][j] * 1.1; else if (fabs(matrix[index[i]][j]) < 1e-6) newObj[j] = -0.1; else newObj[j] = matrix[index[i]][j] * 0.9; } clpSolver->setObjective(newObj); if (rowSense[i] == 'L') clpSolver->setObjSense(-1); else // Todo #1: We don't need to solve the LPs to optimality. // We just need corner points. // There's a problem in stopping Clp that needs to be looked // into. So for now, we solve optimality. clpSolver->setObjSense(1); // simplex->setMaximumIterations(100); clpSolver->getModelPtr()->primal(1); // simplex->setMaximumIterations(100000); #ifdef COIN_DETAIL printf("cutoff: %f\n", cutoff); printf("time: %.2f\n", CoinCpuTime() - start); for (int iRC = 0; iRC < 8; iRC++) printf("%d ", sumReturnCode[iRC]); printf("\nfixThreshold: %f\n", fixThreshold); printf("numInt: %d\n", numInt); printf("\n---------------------------------------------------------------- %d\n", i); #endif //temp: if (i > 3) break; } COIN_DETAIL_PRINT(printf("Best Feasible Found: %f\n", cutoff)); COIN_DETAIL_PRINT(printf("Total time: %.2f\n", CoinCpuTime() - start)); if (numFeasibles == 0) { return 0; } // We found something better std::cout << "See you soon! You're leaving the Pivot-and-Fix Heuristic" << std::endl; std::cout << std::endl; return 1; #endif return 0; } // update model void CbcHeuristicPivotAndFix::setModel(CbcModel * ) { // probably same as resetModel } CoinMP-1.8.3/Cbc/src/CbcGeneral.cpp0000644000175000017500000000332712131054770015270 0ustar renerene// $Id: CbcGeneral.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcGeneral.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" // Default Constructor CbcGeneral::CbcGeneral() : CbcObject() { } // Constructor from model CbcGeneral::CbcGeneral(CbcModel * model) : CbcObject(model) { } // Destructor CbcGeneral::~CbcGeneral () { } // Copy constructor CbcGeneral::CbcGeneral ( const CbcGeneral & rhs) : CbcObject(rhs) { } #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #include "CoinWarmStartBasis.hpp" #include "ClpNode.hpp" #include "CbcBranchDynamic.hpp" // Assignment operator CbcGeneral & CbcGeneral::operator=( const CbcGeneral & rhs) { if (this != &rhs) { CbcObject::operator=(rhs); } return *this; } // Infeasibility - large is 0.5 double CbcGeneral::infeasibility(const OsiBranchingInformation * /*info*/, int &/*preferredWay*/) const { abort(); return 0.0; } CbcBranchingObject * CbcGeneral::createCbcBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * /*info*/, int /*way*/) { abort(); return NULL; } #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicDW.cpp0000644000175000017500000020670112432625130016104 0ustar renerene// $Id: CbcHeuristicDW.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristicDW.hpp" #include "CbcStrategy.hpp" #include "ClpPresolve.hpp" #include "CglProbing.hpp" static int dummyCallBack(CbcHeuristicDW * /*heuristic*/, CbcModel * /*thisModel*/ , int /*whereFrom*/) { return 0; } // Default Constructor CbcHeuristicDW::CbcHeuristicDW() : CbcHeuristic() { setDefaults(); } // Constructor with model - assumed before cuts CbcHeuristicDW::CbcHeuristicDW(CbcModel & model, int keepContinuous) : CbcHeuristic(model) { setDefaults(); functionPointer_ = dummyCallBack; assert(model.solver()); solver_ = model.solver()->clone(); findStructure(); } /* Constructor with model - assumed before cuts */ CbcHeuristicDW::CbcHeuristicDW (CbcModel & model, int callBack(CbcHeuristicDW * currentHeuristic, CbcModel * thisModel, int whereFrom), int keepContinuous) : CbcHeuristic(model) { setDefaults(); functionPointer_ = callBack; assert(model.solver()); solver_ = model.solver()->clone(); findStructure(); } // Set default values void CbcHeuristicDW::setDefaults() { targetObjective_ = -COIN_DBL_MAX; bestObjective_ = COIN_DBL_MAX; lastObjective_ = COIN_DBL_MAX; fullDWEverySoOften_ = 0; numberPasses_ = 0; howOften_ = 100; decayFactor_ = 0.5; functionPointer_ = NULL; solver_=NULL; dwSolver_=NULL; bestSolution_=NULL; continuousSolution_ = NULL; fixedDj_ = NULL; saveLower_=NULL; saveUpper_=NULL; random_=NULL; affinity_=NULL; weights_=NULL; objectiveDW_=NULL; numberColumnsDW_=NULL; whichRowBlock_=NULL; whichColumnBlock_=NULL; dwBlock_=NULL; backwardRow_=NULL; rowsInBlock_=NULL; columnsInBlock_=NULL; startRowBlock_=NULL; startColumnBlock_=NULL; intsInBlock_=NULL; fingerPrint_=NULL; fullDWEverySoOften_=0; numberPasses_=0; numberBadPasses_=COIN_INT_MAX; maximumDW_=0; numberDW_=0; numberDWTimes_=0; sizeFingerPrint_=0; numberMasterColumns_=0; numberMasterRows_=0; numberBlocks_=0; keepContinuous_=0; phase_=0; pass_ = 0; nNeededBase_=200; nNodesBase_=500; nNeeded_=nNeededBase_; nNodes_=nNodesBase_; solveState_=0; } // Guts of copy void CbcHeuristicDW::gutsOfCopy(const CbcHeuristicDW & rhs) { targetObjective_ = rhs.targetObjective_; bestObjective_ = rhs.bestObjective_; lastObjective_ = rhs.lastObjective_; fullDWEverySoOften_ = rhs.fullDWEverySoOften_; numberPasses_ = rhs.numberPasses_; numberBadPasses_= rhs.numberBadPasses_; howOften_ = rhs.howOften_; decayFactor_ = rhs.decayFactor_; fullDWEverySoOften_ = rhs.fullDWEverySoOften_; numberPasses_ = rhs.numberPasses_; maximumDW_ = rhs.maximumDW_; numberDW_ = rhs.numberDW_; numberDWTimes_ = rhs.numberDWTimes_; sizeFingerPrint_ = rhs.sizeFingerPrint_; numberMasterColumns_ = rhs.numberMasterColumns_; numberMasterRows_ = rhs.numberMasterRows_; numberBlocks_ = rhs.numberBlocks_; keepContinuous_ = rhs.keepContinuous_; phase_ = rhs.phase_; pass_ = rhs.pass_; nNeededBase_ = rhs.nNeededBase_; nNodesBase_ = rhs.nNodesBase_; nNeeded_ = rhs.nNeeded_; nNodes_ = rhs.nNodes_; solveState_ = rhs.solveState_; functionPointer_ = rhs.functionPointer_; if (rhs.solver_) solver_ = rhs.solver_->clone(); else solver_ = NULL; if (rhs.dwSolver_) dwSolver_ = rhs.dwSolver_->clone(); else dwSolver_=NULL; if (rhs.saveLower_) { int numberColumns = solver_->getNumCols(); int numberRows = solver_->getNumRows(); saveLower_ = CoinCopyOfArray(rhs.saveLower_,numberColumns); saveUpper_ = CoinCopyOfArray(rhs.saveUpper_,numberColumns); whichColumnBlock_ = CoinCopyOfArray(rhs.whichColumnBlock_,numberColumns); columnsInBlock_ = CoinCopyOfArray(rhs.columnsInBlock_,numberColumns); whichRowBlock_ = CoinCopyOfArray(rhs.whichRowBlock_,numberRows); rowsInBlock_ = CoinCopyOfArray(rhs.rowsInBlock_,numberRows); if (rhs.affinity_) affinity_ = CoinCopyOfArray(rhs.affinity_,numberBlocks_*numberBlocks_); else affinity_ = NULL; backwardRow_ = CoinCopyOfArray(rhs.backwardRow_,numberRows); startRowBlock_ = CoinCopyOfArray(rhs.startRowBlock_,numberBlocks_+1); startColumnBlock_ = CoinCopyOfArray(rhs.startColumnBlock_,numberBlocks_+1); intsInBlock_ = CoinCopyOfArray(rhs.intsInBlock_,numberBlocks_); } else { saveLower_=NULL; saveUpper_=NULL; affinity_=NULL; whichRowBlock_=NULL; whichColumnBlock_=NULL; backwardRow_=NULL; rowsInBlock_=NULL; columnsInBlock_=NULL; startRowBlock_=NULL; startColumnBlock_=NULL; intsInBlock_=NULL; } if (rhs.weights_) { assert (maximumDW_); weights_ = CoinCopyOfArray(rhs.weights_,maximumDW_); random_ = CoinCopyOfArray(rhs.random_,numberMasterRows_); dwBlock_ = CoinCopyOfArray(rhs.dwBlock_,maximumDW_); fingerPrint_ = CoinCopyOfArray(rhs.fingerPrint_, sizeFingerPrint_*maximumDW_); objectiveDW_ = CoinCopyOfArray(rhs.objectiveDW_,numberDWTimes_); numberColumnsDW_ = CoinCopyOfArray(rhs.numberColumnsDW_,numberDWTimes_); } else { random_=NULL; weights_=NULL; objectiveDW_=NULL; numberColumnsDW_=NULL; dwBlock_=NULL; fingerPrint_=NULL; } if (rhs.bestSolution_) { int numberColumns = solver_->getNumCols(); bestSolution_ = CoinCopyOfArray(rhs.bestSolution_,numberColumns); } else { bestSolution_=NULL; } if (rhs.continuousSolution_) { int numberColumns = solver_->getNumCols(); continuousSolution_ = CoinCopyOfArray(rhs.continuousSolution_,numberColumns); } else { continuousSolution_=NULL; } if (rhs.fixedDj_) { int numberColumns = solver_->getNumCols(); fixedDj_ = CoinCopyOfArray(rhs.fixedDj_,numberColumns); } else { fixedDj_=NULL; } } // Guts of delete void CbcHeuristicDW::gutsOfDelete() { delete solver_; delete dwSolver_; delete [] bestSolution_; delete [] continuousSolution_; delete [] fixedDj_; delete [] saveLower_; delete [] saveUpper_; delete [] random_; delete [] affinity_; delete [] weights_; delete [] objectiveDW_; delete [] numberColumnsDW_; delete [] whichRowBlock_; delete [] whichColumnBlock_; delete [] dwBlock_; delete [] backwardRow_; delete [] rowsInBlock_; delete [] columnsInBlock_; delete [] startRowBlock_; delete [] startColumnBlock_; delete [] intsInBlock_; delete [] fingerPrint_; //functionPointer_ = NULL; solver_ = NULL; dwSolver_=NULL; bestSolution_=NULL; continuousSolution_ = NULL; fixedDj_ = NULL; saveLower_=NULL; saveUpper_=NULL; random_=NULL; affinity_=NULL; weights_=NULL; objectiveDW_=NULL; numberColumnsDW_ = NULL; whichRowBlock_=NULL; whichColumnBlock_=NULL; dwBlock_=NULL; backwardRow_=NULL; rowsInBlock_=NULL; columnsInBlock_=NULL; startRowBlock_=NULL; startColumnBlock_=NULL; intsInBlock_=NULL; fingerPrint_=NULL; numberBlocks_=0; } // Destructor CbcHeuristicDW::~CbcHeuristicDW () { gutsOfDelete(); } // Clone CbcHeuristic * CbcHeuristicDW::clone() const { return new CbcHeuristicDW(*this); } // Assignment operator CbcHeuristicDW & CbcHeuristicDW::operator=( const CbcHeuristicDW & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); gutsOfDelete(); gutsOfCopy(rhs); } return *this; } // Create C++ lines to get to current state void CbcHeuristicDW::generateCpp( FILE * fp) { abort(); } // Copy constructor CbcHeuristicDW::CbcHeuristicDW(const CbcHeuristicDW & rhs) : CbcHeuristic(rhs) { gutsOfCopy(rhs); } // Resets stuff if model changes void CbcHeuristicDW::resetModel(CbcModel * model) { if (model_&&numberBlocks_&& model->getNumCols()!=model->getNumCols()) abort(); model_=model; } /* First tries setting a variable to better value. If feasible then tries setting others. If not feasible then tries swaps Returns 1 if solution, 0 if not */ int CbcHeuristicDW::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; int returnCode = 0; const double * bestSolutionIn = model_->bestSolution(); if (!bestSolutionIn && !bestSolution_) return 0; // No solution found yet if (numberBlocks_<3) return 0; // no point #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif if (bestSolutionIn&&objectiveValue(bestSolutionIn)messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; double startTime = CoinCpuTime(); double startTimeElapsed = CoinGetTimeOfDay(); CoinWarmStart * basis = NULL; lastObjective_ = COIN_DBL_MAX; int passesToDW = dwSolver_ ? 0 : -1; bool goodSolution=true; int numberColumns = solver_->getNumCols(); int logLevel = model_->messageHandler()->logLevel(); // For moment just OsiClp OsiClpSolverInterface * solver = dynamic_cast (solver_); ClpSimplex * simplex = solver->getModelPtr(); double * columnLower = simplex->columnLower(); double * columnUpper = simplex->columnUpper(); const double * cost = solver->getObjCoefficients(); const double * dj = solver->getReducedCost(); assert (solver); if (!continuousSolution_) { bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); solver->setHintParam(OsiDoDualInResolve, false, OsiHintDo); solver->resolve(); solver->setHintParam(OsiDoDualInResolve, takeHint, OsiHintDo); continuousSolution_ = CoinCopyOfArray(solver->getColSolution(), numberColumns); } // data arrays // Block order for choosing (after sort) int * whichBlock = new int [8*numberBlocks_]; memset(whichBlock,0,8*numberBlocks_*sizeof(int)); // Count of number of times block chosen int * doneBlock = whichBlock + numberBlocks_; // Pass at which block last used int * whenBlock = doneBlock+numberBlocks_; // Number of Big Djs' (? artificial costs) in block int * bigDjBlock = whenBlock+numberBlocks_; // Number of times block has helped improve solution int * goodBlock = bigDjBlock+numberBlocks_; int * priorityBlock = goodBlock+numberBlocks_; int * orderBlock = priorityBlock+numberBlocks_; // block can be fixed if nothing in master rows, maybe always same as continuous int * fixedBlock = orderBlock+numberBlocks_; // Mixture of stuff to sort blocks on double * blockSort = new double [4*numberBlocks_]; // Reduced cost (d sub j was old notation) contribution double * blockDj = blockSort + numberBlocks_; // Difference between current best and continuous solutions double * blockDiff = blockDj+numberBlocks_; // Difference between current best and continuous solutions (just integers) double * blockDiffInt = blockDiff+numberBlocks_; delete [] fixedDj_; fixedDj_ = CoinCopyOfArray(dj,numberColumns); int numberImproving=0; int * whenBetter = new int [numberPasses_]; double * improvement = new double [numberPasses_]; // First has number int ** improvingBlocks = new int * [numberPasses_]; int numberBlocksUsed = numberBlocks_; // Get basic priority order for (int i=0;igetMatrixByCol()->getElements(); const int * row = solver->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver->getMatrixByCol()->getVectorLengths(); for (int iBlock=0;iBlock=0) nElInMaster++; } if (fabs(bestSolution_[iColumn]-continuousSolution_[iColumn])<1.0e-5) { numberDifferentContinuous++; if (solver->isInteger(iColumn)) numberDifferentContinuousJustInts++; } } if (!nElInMaster) { fixedBlock[iBlock]=10; numberNoMaster++; } else if (!numberDifferentContinuous) { fixedBlock[iBlock]=2; numberSameAsContinuous++; } else if (!numberDifferentContinuousJustInts) { fixedBlock[iBlock]=1; numberSameAsContinuousJustInts++; } } if (numberNoMaster) { sprintf(dwPrint,"*** %d blocks have no elements in master - can be solved seperately", numberNoMaster); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; } sprintf(dwPrint,"With initial best solution %d blocks were same as continuous, %d when just looking at integers", numberSameAsContinuous,numberSameAsContinuousJustInts); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; int lastGoodPass=0; for (pass_=0;pass_bestObjective_+1.0e-3 ? "improving" : ""); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; } if ((pass_%10)==9) { for (int iImp=CoinMax(1,numberImproving-10);iImpmessageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; if (logLevel>1) { for (int i=0;i1) { int * count = new int [numberImproving+1]; memset(count,0,(numberImproving+1)*sizeof(int)); for (int i=0;inumberBadPasses_) { sprintf(dwPrint,"Exiting on lack of progress"); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; break; } if (model_->getNodeCount()>=model_->getMaximumNodes()|| model_->maximumSecondsReached()) { sprintf(dwPrint,"Exiting on time or interrupt"); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; break; } if (bestObjective_>=lastObjective_-1.0e-3) { // what now // 0 - fine, 1 can't be better, 2 max node //assert(solveState); if (solveState_<2) { // more in sprintf(dwPrint,"No improvement - think we need more variables "); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; nNeeded_ += nNeeded_/10; nNeeded_ = CoinMin(nNeeded_,800); nNodes_=nNodesBase_; (*(functionPointer_))(this,NULL,6); } else { // more nodes fewer in sprintf(dwPrint,"No improvement - stopped on nodes - think we need more nodes "); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; if (phase_) { nNodes_ += nNodes_/5; nNodes_ = CoinMin(nNodes_,1000); } nNeeded_ -= nNeeded_/20; nNeeded_ = CoinMax(nNeeded_,50); (*(functionPointer_))(this,NULL,7); } } else { // improving (*(functionPointer_))(this,NULL,4); solveState_=0; //lastObjective_=bestObjective_; if (phase_) { //nNeededBase_ += nNeededBase_/50; //nNodesBase_ += nNodesBase_/50; } nNeeded_ -= nNeeded_/10; nNeeded_=CoinMax(nNeededBase_,nNeeded_); nNodes_=nNodesBase_; (*(functionPointer_))(this,NULL,8); } sprintf(dwPrint,"new needed %d, nodes %d",nNeeded_,nNodes_); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; for ( int i=0 ; iisInteger(i)) { double value = floor(bestSolution_[i]+0.5); columnLower[i] = value; columnUpper[i] = value; } else { columnLower[i] = saveLower_[i]; columnUpper[i] = saveUpper_[i]; } } if (goodSolution) { lastGoodPass=pass_; int lastNumberDW=numberDW_; solver->setColSolution(bestSolution_); solver->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; if (basis) { solver->setWarmStart(basis); delete basis; basis=NULL; } solver->resolve(); solver->setHintParam(OsiDoReducePrint, true, OsiHintDo, 0) ; if (solver->getObjValue()getColSolution(), numberColumns*sizeof(double)); bestObjective_ = solver->getObjValue(); int * blocks = new int [numberBlocksUsed+1]; blocks[0]=numberBlocksUsed; memcpy(blocks+1,whichBlock,numberBlocksUsed*sizeof(int)); improvingBlocks[numberImproving]=blocks; whenBetter[numberImproving]=pass_; improvement[numberImproving]=lastObjective_-bestObjective_; numberImproving++; lastObjective_=bestObjective_; if (pass_) { // update good for (int i=0;i0) { addDW(bestSolution_,numberBlocksUsed, whichBlock); } if (passesToDW==0) { passesToDW = fullDWEverySoOften_; const double * duals = solver->getRowPrice(); double * bestSolution2 = CoinCopyOfArray(bestSolution_, numberColumns); // Column copy const double * element = solver->getMatrixByCol()->getElements(); const int * row = solver->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver->getMatrixByCol()->getVectorLengths(); int numberUsed=0; for (int iBlock=0;iBlockgetModelPtr(), startRowBlock_[iBlock+1]-startRowBlock_[iBlock], rowsInBlock_+startRowBlock_[iBlock], end-start, columnsInBlock_+startColumnBlock_[iBlock]); tempModel->setLogLevel(0); tempModel->setDualObjectiveLimit(COIN_DBL_MAX); double * objectiveX = tempModel->objective(); double * columnLowerX = tempModel->columnLower(); double * columnUpperX = tempModel->columnUpper(); for (int i=start;iisInteger(iColumn)) tempModel->setInteger(jColumn); double cost=objectiveX[jColumn]; for (CoinBigIndex j=columnStart[iColumn]; j=0) { cost -= elementValue * duals[iRow]; } } objectiveX[jColumn]=cost; } OsiClpSolverInterface solverX(tempModel,true); CbcModel modelX(solverX); modelX.setLogLevel(1); modelX.setMoreSpecialOptions2(57); // need to stop after solutions and nodes //modelX.setMaximumNodes(nNodes_); modelX.setMaximumSolutions(1); modelX.branchAndBound(); const double * bestSolutionX = modelX.bestSolution(); if (bestSolutionX) { whichBlock[numberUsed++]=iBlock; for (int i=start;iisInteger(i)) { double value = floor(bestSolution2[i]+0.5); columnLower[i] = value; columnUpper[i] = value; } else { columnLower[i] = saveLower_[i]; columnUpper[i] = saveUpper_[i]; } } solver_->resolve(); if (solver_->isProvenOptimal()) { printf ("DW1 sol %g\n",solver->getObjValue()); } } // now try purer DW bool takeHint; OsiHintStrength strength; dwSolver_->getHintParam(OsiDoDualInResolve, takeHint, strength); dwSolver_->setHintParam(OsiDoDualInResolve, false, OsiHintDo); dwSolver_->resolve(); dwSolver_->setHintParam(OsiDoDualInResolve, takeHint, OsiHintDo); duals = dwSolver_->getRowPrice(); numberUsed=0; for (int iBlock=0;iBlockgetModelPtr(), startRowBlock_[iBlock+1]-startRowBlock_[iBlock], rowsInBlock_+startRowBlock_[iBlock], end-start, columnsInBlock_+startColumnBlock_[iBlock]); tempModel->setLogLevel(0); tempModel->setDualObjectiveLimit(COIN_DBL_MAX); double * objectiveX = tempModel->objective(); double * columnLowerX = tempModel->columnLower(); double * columnUpperX = tempModel->columnUpper(); double convexityDual = duals[numberMasterRows_+iBlock]; for (int i=start;iisInteger(iColumn)) tempModel->setInteger(jColumn); double cost=objectiveX[jColumn]; for (CoinBigIndex j=columnStart[iColumn]; j=0) { // duals are from dw cost -= elementValue * duals[backwardRow_[iRow]]; } } objectiveX[jColumn]=cost; } OsiClpSolverInterface solverX(tempModel,true); solverX.initialSolve(); double cObj=solverX.getObjValue(); CbcModel modelX(solverX); modelX.setLogLevel(1); modelX.setMoreSpecialOptions2(57); modelX.setMaximumSolutions(1); modelX.branchAndBound(); sprintf(dwPrint,"Block %d contobj %g intobj %g convdual %g", iBlock,cObj,modelX.getObjValue(),convexityDual); model_->messageHandler()->message(CBC_FPUMP2, model_->messages()) << dwPrint << CoinMessageEol; const double * bestSolutionX = modelX.bestSolution(); if (bestSolutionX) { whichBlock[numberUsed++]=iBlock; for (int i=start;iisInteger(i)) { double value = floor(bestSolution2[i]+0.5); columnLower[i] = value; columnUpper[i] = value; } else { columnLower[i] = saveLower_[i]; columnUpper[i] = saveUpper_[i]; } } solver_->resolve(); if (solver_->isProvenOptimal()) { printf ("DW sol %g\n",solver->getObjValue()); } } delete [] bestSolution2; } passesToDW--; if (numberDW_>lastNumberDW) { intArray_=NULL; doubleArray_=NULL; (*(functionPointer_))(this,NULL,3); } } for (int i=0;i=0) { columnLower[i]=bestSolution_[i]; columnUpper[i]=bestSolution_[i]; } } for (int iBlock=0;iBlockisInteger(iColumn)) blockDiffInt[iBlock] += fabs((bestSolution_[iColumn]-continuousSolution_[iColumn])) *(fabs(cost[iColumn])+1.0e-5); } if (solver->isInteger(iColumn)) { if (bestSolution_[iColumn]saveLower_[iColumn]+1.0e-1) { if (fixedDj_[iColumn]>1.0e-5) blockDj[iBlock]-=fixedDj_[iColumn]; if (fixedDj_[iColumn]>1.0e4) bigDjBlock[iBlock]++; } } } } // Get average dj and difference int numberInDj=0; double averageDj=1.0e-12; int numberInDiff=0; double averageDiff=1.0e-12; for (int i=0;i=0.0); if (blockDiff[i]>0.0) { numberInDiff++; averageDiff += blockDiff[i]; } } if (numberInDj) averageDj /= static_cast(numberInDj); if (numberInDiff) averageDiff /= static_cast(numberInDiff); double ratioDiff = averageDj/averageDiff; // downplay ratioDiff *= 1.0e-3; for (int i=0;i(intsInBlock_[i]); //blockSort[i] /= sqrt(static_cast(intsInBlock_[i])); if (doneBlock[i]) { blockSort[i] /= static_cast(doneBlock[i]+1); if (whenBlock[i]>pass_-10) blockSort[i]+= 1.0e2*averageDj; } } CoinSort_2(blockSort,blockSort+numberBlocks_,whichBlock); // allow user to modify intArray_=whichBlock; doubleArray_=blockSort; (*(functionPointer_))(this,NULL,1); int numberBlocksIn=0; for (int iTry=0;iTry<2;iTry++) { int nFreed=0; int nBigDjBlock=0; numberBlocksUsed=0; for (int i=0;i=0); if ((doneBlock[iBlock]&&!phase_)||!blockSort[i]) { //printf("already done block %d - dj %g\n",iBlock,blockDj[i]); skipBlock=true; } else if (bigDjBlock[iBlock]) { nBigDjBlock++; if (nBigDjBlock>20&&!phase_) { skipBlock=true; } } int returnCode = (*(functionPointer_))(this,NULL,5); if (returnCode<0) skipBlock=true; else if (returnCode>0) skipBlock=false; if (skipBlock) { whichBlock[i] -= 1000000; } else { // free up sprintf(dwPrint,"freeing block %d (already freed %d times) - dj %g, diff %g, diffint %g - %d columns (%d integer)", iBlock,doneBlock[iBlock],blockDj[iBlock], blockDiff[iBlock],blockDiffInt[iBlock], startColumnBlock_[iBlock+1]-startColumnBlock_[iBlock], intsInBlock_[iBlock]); model_->messageHandler()->message(CBC_FPUMP2, model_->messages()) << dwPrint << CoinMessageEol; numberBlocksIn++; doneBlock[iBlock]++; whenBlock[iBlock]=pass_; nFreed += intsInBlock_[iBlock]; for (int j=startColumnBlock_[iBlock]; j=nNeeded_ && numberBlocksIn>3) break; } } sprintf(dwPrint,"%d big dj blocks found",nBigDjBlock); model_->messageHandler()->message(CBC_FPUMP2, model_->messages()) << dwPrint << CoinMessageEol; if (nFreed) break; phase_=1; // round again sprintf(dwPrint,"Changing phase"); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; for (int i=0;i=0) whichBlock[n++]=whichBlock[i]; } numberBlocksUsed = n; int nFixedInts=0; int nFixedContinuous=0; int nFreeInts=0; int nFreeContinuous=0; int nFreeMaster=0; int nFixedMaster=0; for ( int i=0 ; icolumnLower[i]) { if (kBlock>=0) { if (solver->isInteger(i)) nFreeInts++; else nFreeContinuous++; } else { nFreeMaster++; } } else { if (kBlock>=0) { if (solver->isInteger(i)) nFixedInts++; else nFixedContinuous++; } else { nFixedMaster++; } } } sprintf(dwPrint,"Fixed %d ints, %d c, %d m - free %d, %d, %d", nFixedInts,nFixedContinuous,nFixedMaster, nFreeInts,nFreeContinuous,nFreeMaster); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; // But free up and then fix again for ( int i=0 ; i=0&&solver->isInteger(i)&&whenBlock[kBlock]!=pass_) { columnLower[i]=bestSolution_[i]; columnUpper[i]=bestSolution_[i]; } } bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); solver->setHintParam(OsiDoDualInResolve, false, OsiHintDo); solver->messageHandler()->setLogLevel(1) ; solver->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; solver->resolve(); solver->setHintParam(OsiDoReducePrint, true, OsiHintDo, 0) ; //solver->messageHandler()->setLogLevel(0) ; solver->setHintParam(OsiDoDualInResolve, takeHint, strength); if (solver->getObjValue()>bestObjective_+1.0e-5*(1.0+fabs(bestObjective_))) { // trouble if (logLevel>1) { for (int i=0;iwriteMps("bad","mps"); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); if (logLevel>1) { printf("best obj %g\n",objectiveValue(bestSolution_)); for ( int i=0 ; iupper[i]+1.0e-5) printf("column %d (block %d) %g %g <= %g <= %g %g\n", i,whichColumnBlock_[i],saveLower_[i], lower[i],value,upper[i],saveUpper_[i]); } } //abort(); sprintf(dwPrint,"**** Continuous below best - bad solution passed in?!"); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; // give up break; } const double * tempSol = solver->getColSolution(); // But free up and then fix again for ( int i=0 ; i=0&&!solver->isInteger(i)&&whenBlock[kBlock]!=pass_) { columnLower[i]=tempSol[i]; columnUpper[i]=tempSol[i]; } } solver->getHintParam(OsiDoDualInResolve, takeHint, strength); solver->setHintParam(OsiDoDualInResolve, false, OsiHintDo); solver->messageHandler()->setLogLevel(1) ; solver->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; solver->resolve(); solver->setHintParam(OsiDoReducePrint, true, OsiHintDo, 0) ; //solver->messageHandler()->setLogLevel(0) ; solver->setHintParam(OsiDoDualInResolve, takeHint, strength); //solver->messageHandler()->setLogLevel(0) ; //lp->setLogLevel(0); ClpPresolve pinfo; // fix small infeasibilities pinfo.setPresolveActions(pinfo.presolveActions()|0x4000); int numberPasses = 2; // can change this ClpSimplex * model2 = pinfo.presolvedModel(*simplex, 1.0e-8, true, numberPasses, true); if (!model2) { abort(); } else { sprintf(dwPrint,"Reduced model has %d rows and %d columns", model2->numberRows(),model2->numberColumns()); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; //model2->setLogLevel(0); OsiClpSolverInterface solver2(model2); solver2.setWarmStart(NULL); //solver2.messageHandler()->setLogLevel(0) ; CbcModel model(solver2); model.setMaximumNodes(nNodes_); //model.setMaximumSolutions(2); model.solver()->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; model.solver()->setHintParam(OsiDoPresolveInInitial, false, OsiHintDo, 0) ; //model.solver()->setHintParam(OsiDoPresolveInResolve, false, OsiHintDo, 0) ; model.initialSolve(); if (bestObjective_ > model.solver()->getObjValue()+1.0e-1) { const double * dj = model.solver()->getReducedCost(); int nFix=0; const double * lower = model.solver()->getColLower(); const double * upper = model.solver()->getColUpper(); const double * solution = model.solver()->getColSolution(); double gap = CoinMax(bestObjective_-model.solver()->getObjValue(), 1.0e-3); int numberColumns2=model.solver()->getNumCols(); #ifdef HOT_START // Set up hot start const int * originalColumns = pinfo.originalColumns(); double * hot = new double[2*numberColumns2]; int * hotPriorities = new int[numberColumns2*2]; double * hotWeight = hot+numberColumns2; memset(hot,0,numberColumns2*sizeof(double)); int * sort = hotPriorities+numberColumns2; for (int i=0;i0.0) hotWeight[i]=fixedDj_[iColumn]; } else if (bestSolution_[i]>saveUpper_[iColumn]-1.0e-6) { if (fixedDj_[i]<0.0) hotWeight[i]=-fixedDj_[iColumn]; } if (solution[i]gap) { solver2.setColUpper(i,saveLower_[iColumn]); nFix++; } } else if (solution[i]>saveUpper_[iColumn]-1.0e-6) { if (-dj[i]>gap) { solver2.setColLower(i,saveUpper_[iColumn]); nFix++; } } } } CoinSort_2(hotWeight,hotWeight+numberColumns2,sort); for (int i=0;i1) { if (nFix) printf("Fixed another %d integers\n",nFix); } { // priorities memset(priorityBlock,0,numberBlocks_*sizeof(int)); for (int i=0;i=0) priorityBlock[iBlock]=i+1; } #if 1 assert (numberBlocks_<4000); // But make sure we do one block before next for (int i=0;igetNumCols(); const int * original = pinfo.originalColumns(); int * priorities = new int [numberColumns2]; int n=0; for (int i=0;igetNumberThreads()); model.solver()->setHintParam(OsiDoReducePrint, true, OsiHintDo, 0) ; model.setPrintingMode(1); model.setCutoff(lastObjective_-model_->getCutoffIncrement()); model.setLogLevel(1); intArray_=NULL; doubleArray_=NULL; (*(functionPointer_))(this,&model,2); model.branchAndBound(); if (logLevel>1) { printf("After B&B status %d objective %g\n",model.status(), model.getMinimizationObjValue()); } int modelStatus = model.status(); model.solver()->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; if (model.bestSolution() && model.getMinimizationObjValue()1.0e-5) { if (logLevel>1) { printf("bad %d %g\n",i,bestSolution2[i]); } } else { solver->setColLower(iColumn,value); solver->setColUpper(iColumn,value); } } } pinfo.postsolve(true); delete model2; bool takeHint; OsiHintStrength strength; solver->getHintParam(OsiDoDualInResolve, takeHint, strength); solver->setHintParam(OsiDoDualInResolve, false, OsiHintDo); solver->messageHandler()->setLogLevel(1) ; solver->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; solver->resolve(); if (basis) delete basis; basis = solver->getWarmStart(); memcpy(fixedDj_,solver->getReducedCost(), numberColumns*sizeof(double)); solver->setHintParam(OsiDoReducePrint, true, OsiHintDo, 0) ; //solver->messageHandler()->setLogLevel(0) ; solver->setHintParam(OsiDoDualInResolve, takeHint, strength); //solver-> CbcModel model(*solver); model.setNumberBeforeTrust(-1); model.setNumberStrong(0); model.setMoreSpecialOptions2(57); model.branchAndBound(); if (model.getMinimizationObjValue()1) { for (int i=0;iisInteger(i)) { if (fabs(bestSolution_[i]-floor(bestSolution_[i]+0.5))>1.0e-5) { printf("bad after %d %g\n",i,bestSolution_[i]); } } } } goodSolution=true; } } else if (modelStatus!=0) { // stopped on nodes // 0 - fine, 1 can't be better, 2 max node solveState_=2; pinfo.destroyPresolve(); delete model2; } else { // complete search solveState_=1; pinfo.destroyPresolve(); delete model2; } } else { // can't be better // 0 - fine, 1 can't be better, 2 max node solveState_=1; pinfo.destroyPresolve(); delete model2; } } } delete [] whichBlock; delete [] blockSort; delete [] whenBetter; delete [] improvement; for (int i=0;igetNumCols()*sizeof(double)); } return returnCode; } // update model void CbcHeuristicDW::setModel(CbcModel * model) { if (model!=model_) { gutsOfDelete(); model_ = model; assert(model->solver()); solver_ = model->solver()->clone(); findStructure(); } } // Find structure void CbcHeuristicDW::findStructure() { int numberRows = solver_->getNumRows(); int numberColumns = solver_->getNumCols(); // look for DW int * blockStart = new int [3*(numberRows+numberColumns)+1]; int * columnBlock = blockStart+numberRows; int * nextColumn = columnBlock+numberColumns; int * blockCount = nextColumn+numberColumns; int * blockEls = blockCount+numberRows+1; int * countIntegers = blockEls+numberRows; memset(countIntegers,0,numberColumns*sizeof(int)); int direction[2]={-1,1}; int bestBreak=-1; double bestValue=0.0; int iPass=0; int halfway=(numberRows+1)/2; int firstMaster=-1; int lastMaster=-2; char dwPrint[200]; // Column copy const CoinPackedMatrix * columnCopy = solver_->getMatrixByCol(); //const double * element = columnCopy->getElements(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); // Row copy const CoinPackedMatrix * rowCopy = solver_->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); //const double * elementByRow = rowCopy->getElements(); while (iPass<2) { int increment=direction[iPass]; int start= increment>0 ? 0 : numberRows-1; int stop=increment>0 ? numberRows : -1; int numberBlocks=0; int thisBestBreak=-1; double thisBestValue=COIN_DBL_MAX; int numberRowsDone=0; int numberMarkedColumns=0; int maximumBlockSize=0; for (int i=0;i=0) { // column marked if (iBlock<0) { // put row in that block iBlock=whichColumnBlock; } else if (iBlock!=whichColumnBlock) { // merge blockCount[iBlock]+=blockCount[whichColumnBlock]; blockCount[whichColumnBlock]=0; int jColumn=blockStart[whichColumnBlock]; while (jColumn>=0) { columnBlock[jColumn]=iBlock; iColumn=jColumn; jColumn=nextColumn[jColumn]; } nextColumn[iColumn]=blockStart[iBlock]; blockStart[iBlock]=blockStart[whichColumnBlock]; blockStart[whichColumnBlock]=-1; } } } int n=numberMarkedColumns; if (iBlock<0) { //new block if (rowLength[iRow]) { numberBlocks++; iBlock=numberBlocks; int jColumn=column[rowStart[iRow]]; columnBlock[jColumn]=iBlock; blockStart[iBlock]=jColumn; numberMarkedColumns++; for (CoinBigIndex j=rowStart[iRow]+1;j maximumBlockSize&&numberRowsDone>halfway) { thisBestBreak=iRow; thisBestValue=static_cast(maximumBlockSize)/ static_cast(numberRowsDone); } } if (thisBestBreak==stop) thisBestValue=COIN_DBL_MAX; iPass++; if (iPass==1) { bestBreak=thisBestBreak; bestValue=thisBestValue; } else { if (bestValuemessageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; for (int i=0;i=0) { blockCount[iBlock]++; blockEls[iBlock]+=rowLength[iRow]; } else { if (iBlock==-2) numberMaster++; else numberEmpty++; } } int numberEmptyColumns=0; int numberMasterColumns=0; int numberMasterIntegers=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { int iBlock=columnBlock[iColumn]; bool isInteger = (solver_->isInteger(iColumn)); if (iBlock>=0) { nextColumn[iBlock]++; if (isInteger) countIntegers[iBlock]++; } else { if (isInteger) numberMasterIntegers++; if (columnLength[iColumn]) numberMasterColumns++; else numberEmptyColumns++; } } int largestRows=0; int largestColumns=0; for (int i=0;ilargestRows+largestColumns) { largestRows=blockCount[i]; largestColumns=nextColumn[i]; } } bool useful=true; if (numberMaster>halfway||largestRows*3>numberRows) useful=false; sprintf(dwPrint,"%s %d blocks (largest %d,%d), %d master rows (%d empty) out of %d, %d master columns (%d empty, %d integer) out of %d", useful ? "**Useful" : "NoGood", numberBlocks,largestRows,largestColumns,numberMaster,numberEmpty,numberRows, numberMasterColumns,numberEmptyColumns,numberMasterIntegers, numberColumns); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; // columnBlock is columnBlock and blockStart is rowBlock // See if we want to compress if (!keepContinuous_) { // use blockEls int newNumber=0; for (int i=0;imessageHandler()->message(CBC_FPUMP2, model_->messages()) << dwPrint << CoinMessageEol; if (countIntegers[i]) { blockEls[i]=newNumber; newNumber++; } else { blockEls[i]=-1; } } for (int i=0;i=0) blockStart[i]=blockEls[iBlock]; } for (int i=0;i=0) columnBlock[i]=blockEls[iBlock]; } if (newNumbermessageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; } numberBlocks=newNumber; } // now set up structures numberBlocks_ = numberBlocks; // so callBack can modify whichRowBlock_ = blockStart; whichColumnBlock_ = columnBlock; intArray_=NULL; doubleArray_=NULL; (*(functionPointer_))(this,NULL,0); saveLower_=CoinCopyOfArray(solver_->getColLower(),numberColumns); saveUpper_=CoinCopyOfArray(solver_->getColUpper(),numberColumns); startRowBlock_ = new int [numberBlocks_+2]; backwardRow_ = new int [numberRows]; rowsInBlock_ = new int [numberRows]; whichRowBlock_ = new int [numberRows]; startColumnBlock_ = new int [numberBlocks_+2]; columnsInBlock_ = new int [numberColumns]; whichColumnBlock_ = new int [numberColumns]; intsInBlock_ = new int [numberBlocks_]; // use for counts memset(rowsInBlock_,0,numberBlocks_*sizeof(int)); numberMasterRows_=0; for (int i=0;i=0) { rowsInBlock_[iBlock]++; whichRowBlock_[i]=iBlock; backwardRow_[i]=-1; } else { whichRowBlock_[i]=-1; backwardRow_[i]=numberMasterRows_; numberMasterRows_++; } } memset(columnsInBlock_,0,numberBlocks_*sizeof(int)); memset(intsInBlock_,0,numberBlocks_*sizeof(int)); numberMasterColumns_=0; for (int i=0;i=0) { columnsInBlock_[iBlock]++; whichColumnBlock_[i]=iBlock; if (solver_->isInteger(i)) intsInBlock_[iBlock]++; } else { whichColumnBlock_[i]=-1; numberMasterColumns_++; } } // starts int nRow=0; int nColumn=0; int maxIntsInBlock=0; for (int i=0;i0;i--) startRowBlock_[i]=startRowBlock_[i-1]; startRowBlock_[0]=0; for ( int i=0 ; i0;i--) startColumnBlock_[i]=startColumnBlock_[i-1]; startColumnBlock_[0]=0; if (numberBlocks_<10000) { affinity_ = new unsigned short [numberBlocks_*numberBlocks_]; // compute space needed int * build = new int [numberMasterRows_]; memset(build,0,numberMasterRows_*sizeof(int)); int nSpace=0; for (int iBlock=0;iBlock=0) build[iRow] ++; } } for (int i=0;i=0) build[iRow] ++; } } for (int i=0;irowJ) { j++; if (j65535) sum = 65535; unsigned short value = static_cast(sum); affinity_[iBlock*numberBlocks+jBlock]=value; affinity_[jBlock*numberBlocks+iBlock]=value; } } // statistics int nTotalZero=0; int base=0; for (int iBlock=0;iBlock(nTotalZero) /(numberBlocks*numberBlocks))); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; delete [] starts; delete [] build; } else { sprintf(dwPrint,"Too many blocks - no affinity"); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; } if (fullDWEverySoOften_>0) { setupDWStructures(); } } delete [] blockStart; } // Add DW proposals int CbcHeuristicDW::addDW(const double * solution,int numberBlocksUsed, const int * whichBlocks) { char dwPrint[200]; if (numberDW_+numberBlocksUsed>maximumDW_) { // extend int n = maximumDW_+5*numberBlocks_; double * weightsT = new double [n]; int * dwBlockT = new int[n]; unsigned int * fingerT = new unsigned int [n*sizeFingerPrint_]; memcpy(weightsT,weights_,numberDW_*sizeof(double)); memcpy(dwBlockT,dwBlock_,numberDW_*sizeof(int)); memcpy(fingerT,fingerPrint_, numberDW_*sizeFingerPrint_*sizeof(unsigned int)); delete [] weights_; weights_=weightsT; delete [] dwBlock_; dwBlock_=dwBlockT; delete [] fingerPrint_; fingerPrint_ = fingerT; maximumDW_=n; } //int numberColumns = solver_->getNumCols(); //int numberRows = solver_->getNumRows(); // get space to add elements #define MAX_ADD 100000 int * startsDW = new int[numberBlocks_+1+MAX_ADD]; int * rowDW = startsDW+numberBlocks_+1; double * elementDW = new double[MAX_ADD+3*numberBlocks_+numberMasterRows_]; double * newCost = elementDW+MAX_ADD; double * newLower = newCost+numberBlocks_; double * newUpper = newLower+numberBlocks_; double * build = newUpper+numberBlocks_; memset(build,0,numberMasterRows_*sizeof(double)); int nAdd=0; int nTotalAdded=0; int nEls=0; startsDW[0]=0; // Column copy const double * element = solver_->getMatrixByCol()->getElements(); const int * row = solver_->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver_->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver_->getMatrixByCol()->getVectorLengths(); const double * objective = solver_->getObjCoefficients(); for (int jBlock=0;jBlockisInteger(iColumn); double value = solution[iColumn]; if (isInteger) { if(value>1.0e-6) finger[0] |= 1<=0) { nElInMaster++; double elementValue=element[j]; build[iRow]+=value*elementValue; if (isInteger) { nElIntInMaster++; if (value) nElIntInMaster1++; thisWeight += random_[iRow]*value*elementValue; } else { value = 0.0001*floor(value*10000.0+0.5); } thisWeightC += random_[iRow]*value*elementValue; } } } // see if already in sprintf(dwPrint,"block %d nel %d nelInt %d nelInt1 %d - weight %g (%g)", iBlock,nElInMaster,nElIntInMaster,nElIntInMaster1, thisWeight,thisWeightC); model_->messageHandler()->message(CBC_FPUMP2, model_->messages()) << dwPrint << CoinMessageEol; int iProposal; for (iProposal=0;iProposalmessageHandler()->message(CBC_FPUMP2, model_->messages()) << dwPrint << CoinMessageEol; memset(build,0,numberMasterRows_*sizeof(double)); //iProposal=numberDW; } if (iProposal==numberDW_) { // new // could build in stages assert (nEls+numberMasterRows_1.0e-10) { elementDW[nEls]=value; rowDW[nEls++]=i; } } } // convexity elementDW[nEls]=1.0; rowDW[nEls++]=numberMasterRows_+iBlock; weights_[nAdd+numberDW_]=thisWeightC; dwBlock_[nAdd+numberDW_]=iBlock; newLower[nAdd]=0.0; newUpper[nAdd]=1.0; newCost[nAdd++]=thisCost; startsDW[nAdd]=nEls; } if (nEls+numberMasterRows_>MAX_ADD) { sprintf(dwPrint,"Adding %d proposals with %d elements - out of room", nAdd,nEls); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; dwSolver_->addCols(nAdd,startsDW,rowDW,elementDW,newLower, newUpper,newCost); numberDW_+=nAdd; nTotalAdded+=nAdd; nAdd=0; nEls=0; } } if (nAdd) { sprintf(dwPrint,"Adding %d proposals with %d elements", nAdd,nEls); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; dwSolver_->addCols(nAdd,startsDW,rowDW,elementDW,newLower, newUpper,newCost); nTotalAdded+=nAdd; numberDW_+=nAdd; } delete [] startsDW; delete [] elementDW; if (nTotalAdded) { double * objs = new double[numberDWTimes_+1]; memcpy(objs,objectiveDW_,numberDWTimes_*sizeof(double)); delete [] objectiveDW_; objectiveDW_=objs; int * temp = new int[numberDWTimes_+1]; memcpy(temp,numberColumnsDW_,numberDWTimes_*sizeof(int)); delete [] numberColumnsDW_; numberColumnsDW_=temp; numberColumnsDW_[numberDWTimes_]= dwSolver_->getNumCols(); objectiveDW_[numberDWTimes_++]= objectiveValue(solution); } return nTotalAdded; } // Pass in a solution void CbcHeuristicDW::passInSolution(const double * solution) { if (fullDWEverySoOften_>0) { int * which = new int[numberBlocks_]; for (int i=0;igetNumCols(); if (!bestSolution_) bestSolution_ = new double [numberColumns]; memcpy(bestSolution_,solution,numberColumns*sizeof(double)); } } // Pass in continuous solution void CbcHeuristicDW::passInContinuousSolution(const double * solution) { int numberColumns = solver_->getNumCols(); if (!continuousSolution_) continuousSolution_ = new double [numberColumns]; memcpy(continuousSolution_,solution,numberColumns*sizeof(double)); } // Objective value (could also check validity) double CbcHeuristicDW::objectiveValue(const double * solution) { // compute objective value double objOffset = 0.0; solver_->getDblParam(OsiObjOffset, objOffset); double objectiveValue = -objOffset; int numberColumns = solver_->getNumCols(); const double * objective = solver_->getObjCoefficients(); int logLevel = model_->messageHandler()->logLevel(); for (int i=0;i1) { if (solver_->isInteger(i)) { if (fabs(value-floor(value+0.5))>1.0e-7) printf("Bad integer value for %d of %g\n",i,value); } } objectiveValue += objective[i]*value; } return objectiveValue; } // Objective value when whichDw created double CbcHeuristicDW::objectiveValueWhen(int whichDW) const { if (whichDW>=numberDWTimes_) return COIN_DBL_MAX; else return objectiveDW_[whichDW]; } // Number of columns in DW int CbcHeuristicDW::numberColumnsDW(int whichDW) const { if (whichDW>=numberDWTimes_) return COIN_INT_MAX; else return numberColumnsDW_[whichDW]; } // DW model (user must delete) OsiSolverInterface * CbcHeuristicDW::DWModel(int whichDW) const { if (whichDW>=numberDWTimes_) return NULL; OsiSolverInterface * newSolver = dwSolver_->clone(); int numberColumns2=newSolver->getNumCols(); int numberColumns=numberColumnsDW_[whichDW]; if (numberColumnsdeleteCols(numberColumns2-numberColumns,del); delete [] del; } // Set all to integer that need setting for (int i=numberMasterColumns_;isetContinuous(i); } int numberDW=numberColumns-numberMasterColumns_; for (int iBlock=0;iBlocksetInteger(iColumn); } } } } //newSolver->writeMps("dw","mps"); return newSolver; } /* DW Proposal actions fullDWEverySoOften - 0 - off k - every k times solution gets better */ void CbcHeuristicDW::setProposalActions(int fullDWEverySoOften) { fullDWEverySoOften_=fullDWEverySoOften; if (fullDWEverySoOften_>0&&!random_) setupDWStructures(); } // Set up DW structure void CbcHeuristicDW::setupDWStructures() { char dwPrint[200]; random_=new double [numberMasterRows_]; for (int i=0;igetNumCols(); int numberRows = solver_->getNumRows(); int * tempRow = new int [numberRows+numberColumns]; int * tempColumn = tempRow + numberRows; int numberMasterRows=0; for (int i=0;i(solver_); ClpSimplex * tempModel = new ClpSimplex(solver->getModelPtr(), numberMasterRows,tempRow, numberMasterColumns,tempColumn); // add convexity constraints double * rhs = new double[numberBlocks_]; for (int i=0;iaddRows(numberBlocks_,rhs,rhs,NULL,NULL,NULL); delete [] rhs; OsiClpSolverInterface * clpSolver = new OsiClpSolverInterface(tempModel,true); clpSolver->getModelPtr()->setDualObjectiveLimit(COIN_DBL_MAX); dwSolver_ = clpSolver; sprintf(dwPrint,"DW model has %d master rows, %d master columns and %d convexity rows", numberMasterRows,numberMasterColumns,numberBlocks_); model_->messageHandler()->message(CBC_FPUMP1, model_->messages()) << dwPrint << CoinMessageEol; // do master integers for (int i=0;iisInteger(iColumn)) dwSolver_->setInteger(i); } delete [] tempRow; } CoinMP-1.8.3/Cbc/src/CbcGenCbcParam.hpp0000644000175000017500000001202212131054770016012 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenCbcParam.hpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #ifndef CbcCbcParam_H #define CbcCbcParam_H /* \file CbcGenCbcParam.hpp \brief Declarations for parameters that act on a CbcModel object. */ /* $Id: CbcGenCbcParam.hpp 1899 2013-04-09 18:12:08Z stefan $ */ /*! \class CbcCbcParam \brief Class for control parameters that act on a CbcModel object. Adds parameter type codes and push/pull functions to the generic parameter object. */ class CbcCbcParam : public CoinParam { public: /*! \name Subtypes */ //@{ /*! \enum CbcCbcParamCode \brief Enumeration for parameters that control a CbcModel object These are parameters that control the operation of a CbcModel object. CBCCBC_FIRSTPARAM and CBCCBC_LASTPARAM are markers to allow convenient separation of parameter groups. */ typedef enum { CBCCBC_FIRSTPARAM = CbcGenParam::CBCGEN_LASTPARAM + 1, ALLOWABLEGAP, COSTSTRATEGY, CUTDEPTH, CUTOFF, CUTPASS, DIRECTION, GAPRATIO, INCREMENT, INFEASIBILITYWEIGHT, INTEGERTOLERANCE, LOGLEVEL, MAXIMIZE, MAXNODES, MINIMIZE, MIPOPTIONS, MOREMIPOPTIONS, NUMBERANALYZE, NUMBERBEFORE, NUMBERMINI, STRONGBRANCHING, TIMELIMIT_BAB, CBCCBC_LASTPARAM } CbcCbcParamCode ; //@} /*! \name Constructors and Destructors Be careful how you specify parameters for the constructors! There's great potential for confusion. */ //@{ /*! \brief Default constructor */ CbcCbcParam() ; /*! \brief Constructor for a parameter with a double value The default value is 0.0. Be careful to clearly indicate that \p lower and \p upper are real (double) values to distinguish this constructor from the constructor for an integer parameter. */ CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help, double lower, double upper, double dflt = 0.0, bool display = true) ; /*! \brief Constructor for a parameter with an integer value The default value is 0. */ CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help, int lower, int upper, int dflt = 0, bool display = true) ; /*! \brief Constructor for a parameter with keyword values The string supplied as \p firstValue becomes the first keyword. Additional keywords can be added using appendKwd(). Keywords are numbered from zero. It's necessary to specify both the first keyword (\p firstValue) and the default keyword index (\p dflt) in order to distinguish this constructor from the string and action parameter constructors. */ CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help, std::string firstValue, int dflt, bool display = true) ; /*! \brief Constructor for a string parameter The default string value must be specified explicitly to distinguish a string constructor from an action parameter constructor. */ CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help, std::string dflt, bool display = true) ; /*! \brief Constructor for an action parameter */ CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help, bool display = true) ; /*! \brief Copy constructor */ CbcCbcParam(const CbcCbcParam &orig) ; /*! \brief Clone */ CbcCbcParam *clone() ; /*! \brief Assignment */ CbcCbcParam &operator=(const CbcCbcParam &rhs) ; /*! \brief Destructor */ ~CbcCbcParam() ; //@} /*! \name Methods to query and manipulate a parameter object */ //@{ /*! \brief Get the parameter code */ inline CbcCbcParamCode paramCode() const { return (paramCode_) ; } /*! \brief Set the parameter code */ inline void setParamCode(CbcCbcParamCode code) { paramCode_ = code ; } /*! \brief Get the underlying CbcModel object */ inline CbcModel *obj() const { return (obj_) ; } /*! \brief Set the underlying CbcModel object */ inline void setObj(CbcModel *obj) { obj_ = obj ; } //@} private: /*! \name Data */ //@{ /// Parameter code CbcCbcParamCode paramCode_ ; /// CbcModel object CbcModel *obj_ ; //@} } ; /* Declare the utility functions. */ namespace CbcCbcParamUtils { void addCbcCbcParams(int &numParams, CoinParamVec ¶mVec, CbcModel *model) ; void loadCbcParamObj(const CoinParamVec paramVec, int first, int last, CbcModel *model) ; void setCbcModelDefaults (CbcModel *model) ; int pushCbcCbcDbl(CoinParam *param) ; int pushCbcCbcInt(CoinParam *param) ; } #endif CoinMP-1.8.3/Cbc/src/CbcSOS.cpp0000644000175000017500000011235012403272735014361 0ustar renerene// $Id: CbcSOS.cpp 2070 2014-09-08 09:24:45Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/9/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcSOS.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## // Default Constructor CbcSOS::CbcSOS () : CbcObject(), members_(NULL), weights_(NULL), shadowEstimateDown_(1.0), shadowEstimateUp_(1.0), downDynamicPseudoRatio_(0.0), upDynamicPseudoRatio_(0.0), numberTimesDown_(0), numberTimesUp_(0), numberMembers_(0), sosType_(-1), integerValued_(false), oddValues_(false) { } // Useful constructor (which are indices) CbcSOS::CbcSOS (CbcModel * model, int numberMembers, const int * which, const double * weights, int identifier, int type) : CbcObject(model), shadowEstimateDown_(1.0), shadowEstimateUp_(1.0), downDynamicPseudoRatio_(0.0), upDynamicPseudoRatio_(0.0), numberTimesDown_(0), numberTimesUp_(0), numberMembers_(numberMembers), sosType_(type), oddValues_(false) { id_ = identifier; integerValued_ = type == 1; if (integerValued_) { // check all members integer OsiSolverInterface * solver = model->solver(); if (solver) { for (int i = 0; i < numberMembers_; i++) { if (!solver->isInteger(which[i])) integerValued_ = false; } } else { // can't tell integerValued_ = false; } } if (numberMembers_) { const OsiSolverInterface * solver = model_->solver(); const double * lower = solver->getColLower(); for (int i = 0; i < numberMembers_; i++) { if (lower[which[i]]<0.0) { oddValues_ = true; // mark as odd } } // check >= 0.0 members_ = new int[numberMembers_]; weights_ = new double[numberMembers_]; memcpy(members_, which, numberMembers_*sizeof(int)); if (weights) { memcpy(weights_, weights, numberMembers_*sizeof(double)); } else { for (int i = 0; i < numberMembers_; i++) weights_[i] = i; } // sort so weights increasing CoinSort_2(weights_, weights_ + numberMembers_, members_); /* Force all weights to be distinct; note that the separation enforced here (1.0e-10) is not sufficien to pass the test in infeasibility(). */ double last = -COIN_DBL_MAX; int i; for (i = 0; i < numberMembers_; i++) { double possible = CoinMax(last + 1.0e-10, weights_[i]); weights_[i] = possible; last = possible; } } else { members_ = NULL; weights_ = NULL; } assert (sosType_ > 0 && sosType_ < 3); } // Copy constructor CbcSOS::CbcSOS ( const CbcSOS & rhs) : CbcObject(rhs) { shadowEstimateDown_ = rhs.shadowEstimateDown_; shadowEstimateUp_ = rhs.shadowEstimateUp_; downDynamicPseudoRatio_ = rhs.downDynamicPseudoRatio_; upDynamicPseudoRatio_ = rhs.upDynamicPseudoRatio_; numberTimesDown_ = rhs.numberTimesDown_; numberTimesUp_ = rhs.numberTimesUp_; numberMembers_ = rhs.numberMembers_; sosType_ = rhs.sosType_; integerValued_ = rhs.integerValued_; oddValues_ = rhs.oddValues_; if (numberMembers_) { members_ = new int[numberMembers_]; weights_ = new double[numberMembers_]; memcpy(members_, rhs.members_, numberMembers_*sizeof(int)); memcpy(weights_, rhs.weights_, numberMembers_*sizeof(double)); } else { members_ = NULL; weights_ = NULL; } } // Clone CbcObject * CbcSOS::clone() const { return new CbcSOS(*this); } // Assignment operator CbcSOS & CbcSOS::operator=( const CbcSOS & rhs) { if (this != &rhs) { CbcObject::operator=(rhs); delete [] members_; delete [] weights_; shadowEstimateDown_ = rhs.shadowEstimateDown_; shadowEstimateUp_ = rhs.shadowEstimateUp_; downDynamicPseudoRatio_ = rhs.downDynamicPseudoRatio_; upDynamicPseudoRatio_ = rhs.upDynamicPseudoRatio_; numberTimesDown_ = rhs.numberTimesDown_; numberTimesUp_ = rhs.numberTimesUp_; numberMembers_ = rhs.numberMembers_; sosType_ = rhs.sosType_; integerValued_ = rhs.integerValued_; oddValues_ = rhs.oddValues_; if (numberMembers_) { members_ = new int[numberMembers_]; weights_ = new double[numberMembers_]; memcpy(members_, rhs.members_, numberMembers_*sizeof(int)); memcpy(weights_, rhs.weights_, numberMembers_*sizeof(double)); } else { members_ = NULL; weights_ = NULL; } } return *this; } // Destructor CbcSOS::~CbcSOS () { delete [] members_; delete [] weights_; } /* Routine to calculate standard infeasibility of an SOS set and return a preferred branching direction. This routine looks to have undergone incomplete revision. There is vestigial code. preferredWay is unconditionally set to 1. There used to be a comment `large is 0.5' but John removed it at some point. Have to check to see if it no longer applies or if John thought it provided too much information. */ double CbcSOS::infeasibility(const OsiBranchingInformation * info, int &preferredWay) const { int j; int firstNonZero = -1; int lastNonZero = -1; OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); //double largestValue=0.0; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double weight = 0.0; double sum = 0.0; // check bounds etc double lastWeight = -1.0e100; for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; /* The value used here (1.0e-7) is larger than the value enforced in the constructor. */ if (lastWeight >= weights_[j] - 1.0e-7) throw CoinError("Weights too close together in SOS", "infeasibility", "CbcSOS"); double value = CoinMax(lower[iColumn], solution[iColumn]); sum += value; /* If we're not making assumptions about integrality, why check integerTolerance here? Convenient tolerance? Why not just check against the upper bound? The calculation of weight looks to be a relic --- in the end, the value isn't used to calculate either the return value or preferredWay. */ if (fabs(value) > integerTolerance && (upper[iColumn] > 0.0 || oddValues_)) { // Possibly due to scaling a fixed variable might slip through if (value > upper[iColumn]) { value = upper[iColumn]; // Could change to #ifdef CBC_DEBUG #ifndef NDEBUG if (model_->messageHandler()->logLevel() > 2 && value > upper[iColumn] + integerTolerance) printf("** Variable %d (%d) has value %g and upper bound of %g\n", iColumn, j, value, upper[iColumn]); #endif } if (value < lower[iColumn]) { value = lower[iColumn]; // Could change to #ifdef CBC_DEBUG #ifndef NDEBUG if (model_->messageHandler()->logLevel() > 2 && value < lower[iColumn] - integerTolerance) printf("** Variable %d (%d) has value %g and lower bound of %g\n", iColumn, j, value, lower[iColumn]); #endif } weight += weights_[j] * value; if (firstNonZero < 0) firstNonZero = j; lastNonZero = j; } } /* ?? */ preferredWay = 1; /* SOS1 allows one nonzero; SOS2 allows two consecutive nonzeros. Infeasibility is calculated as (.5)(range of nonzero values)/(number of members). So if the first and last elements of the set are nonzero, we have maximum infeasibility. */ if (lastNonZero - firstNonZero >= sosType_) { // find where to branch if (!oddValues_) weight /= sum; else weight = 0.5*(weights_[firstNonZero]+weights_[lastNonZero]); if (info->defaultDual_ >= 0.0 && info->usefulRegion_ && info->columnStart_) { assert (sosType_ == 1); int iWhere; for (iWhere = firstNonZero; iWhere < lastNonZero - 1; iWhere++) { if (weight < weights_[iWhere+1]) { break; } } int jColumnDown = members_[iWhere]; int jColumnUp = members_[iWhere+1]; int n = 0; CoinBigIndex j; double objMove = info->objective_[jColumnDown]; for (j = info->columnStart_[jColumnDown]; j < info->columnStart_[jColumnDown] + info->columnLength_[jColumnDown]; j++) { double value = info->elementByColumn_[j]; int iRow = info->row_[j]; info->indexRegion_[n++] = iRow; info->usefulRegion_[iRow] = value; } for (iWhere = firstNonZero; iWhere < lastNonZero; iWhere++) { int jColumn = members_[iWhere]; double solValue = info->solution_[jColumn]; if (!solValue) continue; objMove -= info->objective_[jColumn] * solValue; for (j = info->columnStart_[jColumn]; j < info->columnStart_[jColumn] + info->columnLength_[jColumn]; j++) { double value = -info->elementByColumn_[j] * solValue; int iRow = info->row_[j]; double oldValue = info->usefulRegion_[iRow]; if (!oldValue) { info->indexRegion_[n++] = iRow; } else { value += oldValue; if (!value) value = 1.0e-100; } info->usefulRegion_[iRow] = value; } } const double * pi = info->pi_; const double * activity = info->rowActivity_; const double * lower = info->rowLower_; const double * upper = info->rowUpper_; double tolerance = info->primalTolerance_; double direction = info->direction_; shadowEstimateDown_ = objMove * direction; bool infeasible = false; for (int k = 0; k < n; k++) { int iRow = info->indexRegion_[k]; double movement = info->usefulRegion_[iRow]; // not this time info->usefulRegion_[iRow]=0.0; #if 0 if (lower[iRow] < -1.0e20) { if (pi[iRow] > 1.0e-3) { printf("Bad pi on row %d of %g\n",iRow,pi[iRow]); } } if (upper[iRow] >1.0e20) { if (pi[iRow] < -1.0e-3) { printf("Bad pi on row %d of %g\n",iRow,pi[iRow]); } } #endif double valueP = pi[iRow] * direction; // if move makes infeasible then make at least default double newValue = activity[iRow] + movement; if (newValue > upper[iRow] + tolerance || newValue < lower[iRow] - tolerance) { shadowEstimateDown_ += fabs(movement) * CoinMax(fabs(valueP), info->defaultDual_); infeasible = true; } } if (shadowEstimateDown_ < info->integerTolerance_) { if (!infeasible) { shadowEstimateDown_ = 1.0e-10; #ifdef COIN_DEVELOP printf("zero pseudoShadowPrice\n"); #endif } else shadowEstimateDown_ = info->integerTolerance_; } // And other way // take off objMove -= info->objective_[jColumnDown]; for (j = info->columnStart_[jColumnDown]; j < info->columnStart_[jColumnDown] + info->columnLength_[jColumnDown]; j++) { double value = -info->elementByColumn_[j]; int iRow = info->row_[j]; double oldValue = info->usefulRegion_[iRow]; if (!oldValue) { info->indexRegion_[n++] = iRow; } else { value += oldValue; if (!value) value = 1.0e-100; } info->usefulRegion_[iRow] = value; } // add on objMove += info->objective_[jColumnUp]; for (j = info->columnStart_[jColumnUp]; j < info->columnStart_[jColumnUp] + info->columnLength_[jColumnUp]; j++) { double value = info->elementByColumn_[j]; int iRow = info->row_[j]; double oldValue = info->usefulRegion_[iRow]; if (!oldValue) { info->indexRegion_[n++] = iRow; } else { value += oldValue; if (!value) value = 1.0e-100; } info->usefulRegion_[iRow] = value; } shadowEstimateUp_ = objMove * direction; infeasible = false; for (int k = 0; k < n; k++) { int iRow = info->indexRegion_[k]; double movement = info->usefulRegion_[iRow]; info->usefulRegion_[iRow] = 0.0; #if 0 if (lower[iRow] < -1.0e20) { if (pi[iRow] > 1.0e-3) { printf("Bad pi on row %d of %g\n",iRow,pi[iRow]); } } if (upper[iRow] >1.0e20) { if (pi[iRow] < -1.0e-3) { printf("Bad pi on row %d of %g\n",iRow,pi[iRow]); } } #endif double valueP = pi[iRow] * direction; // if move makes infeasible then make at least default double newValue = activity[iRow] + movement; if (newValue > upper[iRow] + tolerance || newValue < lower[iRow] - tolerance) { shadowEstimateUp_ += fabs(movement) * CoinMax(fabs(valueP), info->defaultDual_); infeasible = true; } } if (shadowEstimateUp_ < info->integerTolerance_) { if (!infeasible) { shadowEstimateUp_ = 1.0e-10; #ifdef COIN_DEVELOP printf("zero pseudoShadowPrice\n"); #endif } else shadowEstimateUp_ = info->integerTolerance_; } // adjust double downCost = shadowEstimateDown_; double upCost = shadowEstimateUp_; if (numberTimesDown_) downCost *= downDynamicPseudoRatio_ / static_cast (numberTimesDown_); if (numberTimesUp_) upCost *= upDynamicPseudoRatio_ / static_cast (numberTimesUp_); #define WEIGHT_AFTER 0.7 #define WEIGHT_BEFORE 0.1 int stateOfSearch = model_->stateOfSearch() % 10; double returnValue = 0.0; double minValue = CoinMin(downCost, upCost); double maxValue = CoinMax(downCost, upCost); if (stateOfSearch <= 2) { // no branching solution returnValue = WEIGHT_BEFORE * minValue + (1.0 - WEIGHT_BEFORE) * maxValue; } else { returnValue = WEIGHT_AFTER * minValue + (1.0 - WEIGHT_AFTER) * maxValue; } #ifdef PRINT_SHADOW printf("%d id - down %d %g up %d %g shadow %g, %g returned %g\n", id_, numberTimesDown_, downDynamicPseudoRatio_, numberTimesUp_, upDynamicPseudoRatio_, shadowEstimateDown_, shadowEstimateUp_, returnValue); #endif return returnValue; } else { double value = lastNonZero - firstNonZero + 1; value *= 0.5 / static_cast (numberMembers_); return value; } } else { return 0.0; // satisfied } } // This looks at solution and sets bounds to contain solution void CbcSOS::feasibleRegion() { int j; int firstNonZero = -1; int lastNonZero = -1; OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double weight = 0.0; double sum = 0.0; for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; double value = CoinMax(lower[iColumn], solution[iColumn]); sum += value; if (fabs(value) > integerTolerance && (upper[iColumn] || oddValues_)) { weight += weights_[j] * value; if (firstNonZero < 0) firstNonZero = j; lastNonZero = j; } } // Might get here in odd situation if so fix all if (lastNonZero - firstNonZero < sosType_) { for (j = 0; j < firstNonZero; j++) { int iColumn = members_[j]; solver->setColLower(iColumn, 0.0); solver->setColUpper(iColumn, 0.0); } for (j = lastNonZero + 1; j < numberMembers_; j++) { int iColumn = members_[j]; solver->setColLower(iColumn, 0.0); solver->setColUpper(iColumn, 0.0); } } else { for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; solver->setColUpper(iColumn, 0.0); // make infeasible solver->setColLower(iColumn, 1.0); } } } // Redoes data when sequence numbers change void CbcSOS::redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns) { model_ = model; int n2 = 0; for (int j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; int i; for (i = 0; i < numberColumns; i++) { if (originalColumns[i] == iColumn) break; } if (i < numberColumns) { members_[n2] = i; weights_[n2++] = weights_[j]; } } if (n2 < numberMembers_) { COIN_DETAIL_PRINT(printf("** SOS number of members reduced from %d to %d!\n",numberMembers_,n2)); numberMembers_ = n2; } } CbcBranchingObject * CbcSOS::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * /*info*/, int way) { int j; const double * solution = model_->testSolution(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); //OsiSolverInterface * solver = model_->solver(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); int firstNonFixed = -1; int lastNonFixed = -1; int firstNonZero = -1; int lastNonZero = -1; double weight = 0.0; double sum = 0.0; for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; if (upper[iColumn] || oddValues_) { double value = CoinMax(lower[iColumn], solution[iColumn]); sum += value; if (firstNonFixed < 0) firstNonFixed = j; lastNonFixed = j; if (fabs(value) > integerTolerance) { weight += weights_[j] * value; if (firstNonZero < 0) firstNonZero = j; lastNonZero = j; } } } assert (lastNonZero - firstNonZero >= sosType_) ; // find where to branch if (!oddValues_) weight /= sum; else weight = 0.5*(weights_[firstNonZero]+weights_[lastNonZero]); int iWhere; double separator = 0.0; for (iWhere = firstNonZero; iWhere < lastNonZero; iWhere++) if (weight < weights_[iWhere+1]) break; assert (iWheresetOriginalObject(this); return branch; } /* Pass in information on branch just done and create CbcObjectUpdateData instance. If object does not need data then backward pointer will be NULL. Assumes can get information from solver */ CbcObjectUpdateData CbcSOS::createUpdateInformation(const OsiSolverInterface * solver, const CbcNode * node, const CbcBranchingObject * branchingObject) { double originalValue = node->objectiveValue(); int originalUnsatisfied = node->numberUnsatisfied(); double objectiveValue = solver->getObjValue() * solver->getObjSense(); int unsatisfied = 0; int i; //might be base model - doesn't matter int numberIntegers = model_->numberIntegers();; const double * solution = solver->getColSolution(); //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); double change = CoinMax(0.0, objectiveValue - originalValue); int iStatus; if (solver->isProvenOptimal()) iStatus = 0; // optimal else if (solver->isIterationLimitReached() && !solver->isDualObjectiveLimitReached()) iStatus = 2; // unknown else iStatus = 1; // infeasible bool feasible = iStatus != 1; if (feasible) { double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); const int * integerVariable = model_->integerVariable(); for (i = 0; i < numberIntegers; i++) { int j = integerVariable[i]; double value = solution[j]; double nearest = floor(value + 0.5); if (fabs(value - nearest) > integerTolerance) unsatisfied++; } } int way = branchingObject->way(); way = - way; // because after branch so moved on double value = branchingObject->value(); CbcObjectUpdateData newData (this, way, change, iStatus, originalUnsatisfied - unsatisfied, value); newData.originalObjective_ = originalValue; // Solvers know about direction double direction = solver->getObjSense(); solver->getDblParam(OsiDualObjectiveLimit, newData.cutoff_); newData.cutoff_ *= direction; return newData; } // Update object by CbcObjectUpdateData void CbcSOS::updateInformation(const CbcObjectUpdateData & data) { bool feasible = data.status_ != 1; int way = data.way_; //double value = data.branchingValue_; double originalValue = data.originalObjective_; double change = data.change_; if (way < 0) { // down if (!feasible) { double distanceToCutoff = 0.0; //double objectiveValue = model_->getCurrentMinimizationObjValue(); distanceToCutoff = model_->getCutoff() - originalValue; if (distanceToCutoff < 1.0e20) change = distanceToCutoff * 2.0; else change = (downDynamicPseudoRatio_ * shadowEstimateDown_ + 1.0e-3) * 10.0; } change = CoinMax(1.0e-12 * (1.0 + fabs(originalValue)), change); #ifdef PRINT_SHADOW if (numberTimesDown_) printf("Updating id %d - down change %g (true %g) - ndown %d estimated change %g - raw shadow estimate %g\n", id_, change, data.change_, numberTimesDown_, shadowEstimateDown_* (downDynamicPseudoRatio_ / ((double) numberTimesDown_)), shadowEstimateDown_); else printf("Updating id %d - down change %g (true %g) - shadow estimate %g\n", id_, change, data.change_, shadowEstimateDown_); #endif numberTimesDown_++; downDynamicPseudoRatio_ += change / shadowEstimateDown_; } else { // up if (!feasible) { double distanceToCutoff = 0.0; //double objectiveValue = model_->getCurrentMinimizationObjValue(); distanceToCutoff = model_->getCutoff() - originalValue; if (distanceToCutoff < 1.0e20) change = distanceToCutoff * 2.0; else change = (upDynamicPseudoRatio_ * shadowEstimateUp_ + 1.0e-3) * 10.0; } change = CoinMax(1.0e-12 * (1.0 + fabs(originalValue)), change); #ifdef PRINT_SHADOW if (numberTimesUp_) printf("Updating id %d - up change %g (true %g) - nup %d estimated change %g - raw shadow estimate %g\n", id_, change, data.change_, numberTimesUp_, shadowEstimateUp_* (upDynamicPseudoRatio_ / ((double) numberTimesUp_)), shadowEstimateUp_); else printf("Updating id %d - up change %g (true %g) - shadow estimate %g\n", id_, change, data.change_, shadowEstimateUp_); #endif numberTimesUp_++; upDynamicPseudoRatio_ += change / shadowEstimateUp_; } } /* Create an OsiSolverBranch object This returns NULL if branch not represented by bound changes */ OsiSolverBranch * CbcSOS::solverBranch() const { int j; const double * solution = model_->testSolution(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); OsiSolverInterface * solver = model_->solver(); const double * upper = solver->getColUpper(); int firstNonFixed = -1; int lastNonFixed = -1; int firstNonZero = -1; int lastNonZero = -1; double weight = 0.0; double sum = 0.0; double * fix = new double[numberMembers_]; int * which = new int[numberMembers_]; for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; // fix all on one side or other (even if fixed) fix[j] = 0.0; which[j] = iColumn; if (upper[iColumn] || oddValues_) { double value = CoinMax(0.0, solution[iColumn]); sum += value; if (firstNonFixed < 0) firstNonFixed = j; lastNonFixed = j; if (value > integerTolerance) { weight += weights_[j] * value; if (firstNonZero < 0) firstNonZero = j; lastNonZero = j; } } } assert (lastNonZero - firstNonZero >= sosType_) ; // find where to branch if (!oddValues_) weight /= sum; else weight = 0.5*(weights_[firstNonZero]+weights_[lastNonZero]); // down branch fixes ones above weight to 0 int iWhere; int iDownStart = 0; int iUpEnd = 0; for (iWhere = firstNonZero; iWhere < lastNonZero; iWhere++) if (weight < weights_[iWhere+1]) break; if (sosType_ == 1) { // SOS 1 iUpEnd = iWhere + 1; iDownStart = iUpEnd; } else { // SOS 2 if (iWhere == firstNonFixed) iWhere++;; if (iWhere == lastNonFixed - 1) iWhere = lastNonFixed - 2; iUpEnd = iWhere + 1; iDownStart = iUpEnd + 1; } // OsiSolverBranch * branch = new OsiSolverBranch(); branch->addBranch(-1, 0, NULL, NULL, numberMembers_ - iDownStart, which + iDownStart, fix); branch->addBranch(1, 0, NULL, NULL, iUpEnd, which, fix); delete [] fix; delete [] which; return branch; } // Construct an OsiSOS object OsiSOS * CbcSOS::osiObject(const OsiSolverInterface * solver) const { OsiSOS * obj = new OsiSOS(solver, numberMembers_, members_, weights_, sosType_); obj->setPriority(priority()); return obj; } // Default Constructor CbcSOSBranchingObject::CbcSOSBranchingObject() : CbcBranchingObject(), firstNonzero_(-1), lastNonzero_(-1) { set_ = NULL; separator_ = 0.0; } // Useful constructor CbcSOSBranchingObject::CbcSOSBranchingObject (CbcModel * model, const CbcSOS * set, int way , double separator) : CbcBranchingObject(model, set->id(), way, 0.5) { set_ = set; separator_ = separator; computeNonzeroRange(); } // Copy constructor CbcSOSBranchingObject::CbcSOSBranchingObject (const CbcSOSBranchingObject & rhs) : CbcBranchingObject(rhs), firstNonzero_(rhs.firstNonzero_), lastNonzero_(rhs.lastNonzero_) { set_ = rhs.set_; separator_ = rhs.separator_; } // Assignment operator CbcSOSBranchingObject & CbcSOSBranchingObject::operator=( const CbcSOSBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); set_ = rhs.set_; separator_ = rhs.separator_; firstNonzero_ = rhs.firstNonzero_; lastNonzero_ = rhs.lastNonzero_; } return *this; } CbcBranchingObject * CbcSOSBranchingObject::clone() const { return (new CbcSOSBranchingObject(*this)); } // Destructor CbcSOSBranchingObject::~CbcSOSBranchingObject () { } void CbcSOSBranchingObject::computeNonzeroRange() { const int numberMembers = set_->numberMembers(); const double * weights = set_->weights(); int i = 0; if (way_ < 0) { for ( i = 0; i < numberMembers; i++) { if (weights[i] > separator_) break; } assert (i < numberMembers); firstNonzero_ = 0; lastNonzero_ = i; } else { for ( i = 0; i < numberMembers; i++) { if (weights[i] >= separator_) break; } assert (i < numberMembers); firstNonzero_ = i; lastNonzero_ = numberMembers; } } double CbcSOSBranchingObject::branch() { decrementNumberBranchesLeft(); int numberMembers = set_->numberMembers(); const int * which = set_->members(); const double * weights = set_->weights(); OsiSolverInterface * solver = model_->solver(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); // *** for way - up means fix all those in down section if (way_ < 0) { int i; for ( i = 0; i < numberMembers; i++) { if (weights[i] > separator_) break; } assert (i < numberMembers); for (; i < numberMembers; i++) { solver->setColLower(which[i], 0.0); solver->setColUpper(which[i], 0.0); } way_ = 1; // Swap direction } else { int i; for ( i = 0; i < numberMembers; i++) { if (weights[i] >= separator_) { break; } else { solver->setColLower(which[i], 0.0); solver->setColUpper(which[i], 0.0); } } assert (i < numberMembers); way_ = -1; // Swap direction } computeNonzeroRange(); double predictedChange=0.0; for (int i = 0; i < numberMembers; i++) { int iColumn=which[i]; if (lower[iColumn]>upper[iColumn]) predictedChange=COIN_DBL_MAX; } return predictedChange; } /* Update bounds in solver as in 'branch' and update given bounds. branchState is -1 for 'down' +1 for 'up' */ void CbcSOSBranchingObject::fix(OsiSolverInterface * solver, double * lower, double * upper, int branchState) const { int numberMembers = set_->numberMembers(); const int * which = set_->members(); const double * weights = set_->weights(); //const double * lower = solver->getColLower(); //const double * upper = solver->getColUpper(); // *** for way - up means fix all those in down section if (branchState < 0) { int i; for ( i = 0; i < numberMembers; i++) { if (weights[i] > separator_) break; } assert (i < numberMembers); for (; i < numberMembers; i++) { solver->setColLower(which[i], 0.0); lower[which[i]] = 0.0; solver->setColUpper(which[i], 0.0); upper[which[i]] = 0.0; } } else { int i; for ( i = 0; i < numberMembers; i++) { if (weights[i] >= separator_) { break; } else { solver->setColLower(which[i], 0.0); lower[which[i]] = 0.0; solver->setColUpper(which[i], 0.0); upper[which[i]] = 0.0; } } assert (i < numberMembers); } } // Print what would happen void CbcSOSBranchingObject::print() { int numberMembers = set_->numberMembers(); const int * which = set_->members(); const double * weights = set_->weights(); OsiSolverInterface * solver = model_->solver(); //const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); int first = numberMembers; int last = -1; int numberFixed = 0; int numberOther = 0; int i; for ( i = 0; i < numberMembers; i++) { double bound = upper[which[i]]; if (bound) { first = CoinMin(first, i); last = CoinMax(last, i); } } // *** for way - up means fix all those in down section if (way_ < 0) { printf("SOS Down"); for ( i = 0; i < numberMembers; i++) { double bound = upper[which[i]]; if (weights[i] > separator_) break; else if (bound) numberOther++; } assert (i < numberMembers); for (; i < numberMembers; i++) { double bound = upper[which[i]]; if (bound) numberFixed++; } } else { printf("SOS Up"); for ( i = 0; i < numberMembers; i++) { double bound = upper[which[i]]; if (weights[i] >= separator_) break; else if (bound) numberFixed++; } assert (i < numberMembers); for (; i < numberMembers; i++) { double bound = upper[which[i]]; if (bound) numberOther++; } } printf(" - at %g, free range %d (%g) => %d (%g), %d would be fixed, %d other way\n", separator_, which[first], weights[first], which[last], weights[last], numberFixed, numberOther); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcSOSBranchingObject::compareOriginalObject (const CbcBranchingObject* brObj) const { const CbcSOSBranchingObject* br = dynamic_cast(brObj); assert(br); const CbcSOS* s0 = set_; const CbcSOS* s1 = br->set_; if (s0->sosType() != s1->sosType()) { return s0->sosType() - s1->sosType(); } if (s0->numberMembers() != s1->numberMembers()) { return s0->numberMembers() - s1->numberMembers(); } const int memberCmp = memcmp(s0->members(), s1->members(), s0->numberMembers() * sizeof(int)); if (memberCmp != 0) { return memberCmp; } return memcmp(s0->weights(), s1->weights(), s0->numberMembers() * sizeof(double)); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcSOSBranchingObject::compareBranchingObject (const CbcBranchingObject* brObj, const bool replaceIfOverlap) { const CbcSOSBranchingObject* br = dynamic_cast(brObj); assert(br); if (firstNonzero_ < br->firstNonzero_) { if (lastNonzero_ >= br->lastNonzero_) { return CbcRangeSuperset; } else if (lastNonzero_ <= br->firstNonzero_) { return CbcRangeDisjoint; } else { // overlap if (replaceIfOverlap) { firstNonzero_ = br->firstNonzero_; } return CbcRangeOverlap; } } else if (firstNonzero_ > br->firstNonzero_) { if (lastNonzero_ <= br->lastNonzero_) { return CbcRangeSubset; } else if (firstNonzero_ >= br->lastNonzero_) { return CbcRangeDisjoint; } else { // overlap if (replaceIfOverlap) { lastNonzero_ = br->lastNonzero_; } return CbcRangeOverlap; } } else { if (lastNonzero_ == br->lastNonzero_) { return CbcRangeSame; } return lastNonzero_ < br->lastNonzero_ ? CbcRangeSubset : CbcRangeSuperset; } return CbcRangeSame; // fake return } CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveCoefficient.hpp0000644000175000017500000000317112131054770020623 0ustar renerene/* $Id: CbcHeuristicDiveCoefficient.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicDiveCoefficient_H #define CbcHeuristicDiveCoefficient_H #include "CbcHeuristicDive.hpp" /** DiveCoefficient class */ class CbcHeuristicDiveCoefficient : public CbcHeuristicDive { public: // Default Constructor CbcHeuristicDiveCoefficient (); // Constructor with model - assumed before cuts CbcHeuristicDiveCoefficient (CbcModel & model); // Copy constructor CbcHeuristicDiveCoefficient ( const CbcHeuristicDiveCoefficient &); // Destructor ~CbcHeuristicDiveCoefficient (); /// Clone virtual CbcHeuristicDiveCoefficient * clone() const; /// Assignment operator CbcHeuristicDiveCoefficient & operator=(const CbcHeuristicDiveCoefficient& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Selects the next variable to branch on /** Returns true if all the fractional variables can be trivially rounded. Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable. */ virtual bool selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound); }; #endif CoinMP-1.8.3/Cbc/src/CbcModel.cpp0000644000175000017500000275104012534103171014754 0ustar renerene/* $Id: CbcModel.cpp 2199 2015-06-04 17:10:17Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include //#define CBC_DEBUG 1 //#define CHECK_CUT_COUNTS //#define CHECK_NODE //#define CHECK_NODE_FULL //#define NODE_LOG //#define GLOBAL_CUTS_JUST_POINTERS #ifdef CGL_DEBUG_GOMORY extern int gomory_try; #endif #include #include #include #ifdef COIN_HAS_CLP // include Presolve from Clp #include "ClpPresolve.hpp" #include "OsiClpSolverInterface.hpp" #include "ClpNode.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpSimplexPrimal.hpp" #endif #include "CbcEventHandler.hpp" #include "OsiSolverInterface.hpp" #include "OsiAuxInfo.hpp" #include "OsiSolverBranch.hpp" #include "OsiChooseVariable.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinPackedMatrix.hpp" #include "CoinHelperFunctions.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchDynamic.hpp" #include "CbcHeuristic.hpp" #include "CbcHeuristicFPump.hpp" #include "CbcHeuristicRINS.hpp" #include "CbcHeuristicDive.hpp" #include "CbcModel.hpp" #include "CbcTreeLocal.hpp" #include "CbcStatistics.hpp" #include "CbcStrategy.hpp" #include "CbcMessage.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "OsiRowCutDebugger.hpp" #include "OsiCuts.hpp" #include "CbcCountRowCut.hpp" #include "CbcCutGenerator.hpp" #include "CbcFeasibilityBase.hpp" #include "CbcFathom.hpp" #include "CbcFullNodeInfo.hpp" #ifdef COIN_HAS_NTY #include "CbcSymmetry.hpp" #endif // include Probing #include "CglProbing.hpp" #include "CglGomory.hpp" #include "CglTwomir.hpp" // include preprocessing #include "CglPreProcess.hpp" #include "CglDuplicateRow.hpp" #include "CglStored.hpp" #include "CglClique.hpp" #include "CglKnapsackCover.hpp" #include "CoinTime.hpp" #include "CoinMpsIO.hpp" #include "CbcCompareActual.hpp" #include "CbcTree.hpp" // This may be dummy #include "CbcThread.hpp" /* Various functions local to CbcModel.cpp */ static void * doRootCbcThread(void * voidInfo); namespace { //------------------------------------------------------------------- // Returns the greatest common denominator of two // positive integers, a and b, found using Euclid's algorithm //------------------------------------------------------------------- static int gcd(int a, int b) { int remainder = -1; // make sure a<=b (will always remain so) if (a > b) { // Swap a and b int temp = a; a = b; b = temp; } // if zero then gcd is nonzero (zero may occur in rhs of packed) if (!a) { if (b) { return b; } else { printf("**** gcd given two zeros!!\n"); abort(); } } while (remainder) { remainder = b % a; b = a; a = remainder; } return b; } #ifdef CHECK_NODE_FULL /* Routine to verify that tree linkage is correct. The invariant that is tested is reference count = (number of actual references) + (number of branches left) The routine builds a set of paired arrays, info and count, by traversing the tree. Each CbcNodeInfo is recorded in info, and the number of times it is referenced (via the parent field) is recorded in count. Then a final check is made to see if the numberPointingToThis_ field agrees. */ void verifyTreeNodes (const CbcTree * branchingTree, const CbcModel &model) { if (model.getNodeCount() == 661) return; printf("*** CHECKING tree after %d nodes\n", model.getNodeCount()) ; int j ; int nNodes = branchingTree->size() ; # define MAXINFO 1000 int *count = new int [MAXINFO] ; CbcNodeInfo **info = new CbcNodeInfo*[MAXINFO] ; int nInfo = 0 ; /* Collect all CbcNodeInfo objects in info, by starting from each live node and traversing back to the root. Nodes in the live set should have unexplored branches remaining. TODO: The `while (nodeInfo)' loop could be made to break on reaching a common ancester (nodeInfo is found in info[k]). Alternatively, the check could change to signal an error if nodeInfo is not found above a common ancestor. */ for (j = 0 ; j < nNodes ; j++) { CbcNode *node = branchingTree->nodePointer(j) ; if (!node) continue; CbcNodeInfo *nodeInfo = node->nodeInfo() ; int change = node->nodeInfo()->numberBranchesLeft() ; assert(change) ; while (nodeInfo) { int k ; for (k = 0 ; k < nInfo ; k++) { if (nodeInfo == info[k]) break ; } if (k == nInfo) { assert(nInfo < MAXINFO) ; nInfo++ ; info[k] = nodeInfo ; count[k] = 0 ; } nodeInfo = nodeInfo->parent() ; } } /* Walk the info array. For each nodeInfo, look up its parent in info and increment the corresponding count. */ for (j = 0 ; j < nInfo ; j++) { CbcNodeInfo *nodeInfo = info[j] ; nodeInfo = nodeInfo->parent() ; if (nodeInfo) { int k ; for (k = 0 ; k < nInfo ; k++) { if (nodeInfo == info[k]) break ; } assert (k < nInfo) ; count[k]++ ; } } /* Walk the info array one more time and check that the invariant holds. The number of references (numberPointingToThis()) should equal the sum of the number of actual references (held in count[]) plus the number of potential references (unexplored branches, numberBranchesLeft()). */ for (j = 0; j < nInfo; j++) { CbcNodeInfo * nodeInfo = info[j] ; if (nodeInfo) { int k ; for (k = 0; k < nInfo; k++) if (nodeInfo == info[k]) break ; printf("Nodeinfo %x - %d left, %d count\n", nodeInfo, nodeInfo->numberBranchesLeft(), nodeInfo->numberPointingToThis()) ; assert(nodeInfo->numberPointingToThis() == count[k] + nodeInfo->numberBranchesLeft()) ; } } delete [] count ; delete [] info ; return ; } #endif /* CHECK_NODE_FULL */ #ifdef CHECK_CUT_COUNTS /* Routine to verify that cut reference counts are correct. */ void verifyCutCounts (const CbcTree * branchingTree, CbcModel &model) { printf("*** CHECKING cuts after %d nodes\n", model.getNodeCount()) ; int j ; int nNodes = branchingTree->size() ; /* cut.tempNumber_ exists for the purpose of doing this verification. Clear it in all cuts. We traverse the tree by starting from each live node and working back to the root. At each CbcNodeInfo, check for cuts. */ for (j = 0 ; j < nNodes ; j++) { CbcNode *node = branchingTree->nodePointer(j) ; CbcNodeInfo * nodeInfo = node->nodeInfo() ; assert (node->nodeInfo()->numberBranchesLeft()) ; while (nodeInfo) { int k ; for (k = 0 ; k < nodeInfo->numberCuts() ; k++) { CbcCountRowCut *cut = nodeInfo->cuts()[k] ; if (cut) cut->tempNumber_ = 0; } nodeInfo = nodeInfo->parent() ; } } /* Walk the live set again, this time collecting the list of cuts in use at each node. addCuts1 will collect the cuts in model.addedCuts_. Take into account that when we recreate the basis for a node, we compress out the slack cuts. */ for (j = 0 ; j < nNodes ; j++) { CoinWarmStartBasis *debugws = model.getEmptyBasis() ; CbcNode *node = branchingTree->nodePointer(j) ; CbcNodeInfo *nodeInfo = node->nodeInfo(); int change = node->nodeInfo()->numberBranchesLeft() ; printf("Node %d %x (info %x) var %d way %d obj %g", j, node, node->nodeInfo(), node->columnNumber(), node->way(), node->objectiveValue()) ; model.addCuts1(node, debugws) ; int i ; int numberRowsAtContinuous = model.numberRowsAtContinuous() ; CbcCountRowCut **addedCuts = model.addedCuts() ; for (i = 0 ; i < model.currentNumberCuts() ; i++) { CoinWarmStartBasis::Status status = debugws->getArtifStatus(i + numberRowsAtContinuous) ; if (status != CoinWarmStartBasis::basic && addedCuts[i]) { addedCuts[i]->tempNumber_ += change ; } } while (nodeInfo) { nodeInfo = nodeInfo->parent() ; if (nodeInfo) printf(" -> %x", nodeInfo); } printf("\n") ; delete debugws ; } /* The moment of truth: We've tallied up the references by direct scan of the search tree. Check for agreement with the count in the cut. TODO: Rewrite to check and print mismatch only when tempNumber_ == 0? */ for (j = 0 ; j < nNodes ; j++) { CbcNode *node = branchingTree->nodePointer(j) ; CbcNodeInfo *nodeInfo = node->nodeInfo(); while (nodeInfo) { int k ; for (k = 0 ; k < nodeInfo->numberCuts() ; k++) { CbcCountRowCut *cut = nodeInfo->cuts()[k] ; if (cut && cut->tempNumber_ >= 0) { if (cut->tempNumber_ != cut->numberPointingToThis()) printf("mismatch %x %d %x %d %d\n", nodeInfo, k, cut, cut->tempNumber_, cut->numberPointingToThis()) ; else printf(" match %x %d %x %d %d\n", nodeInfo, k, cut, cut->tempNumber_, cut->numberPointingToThis()) ; cut->tempNumber_ = -1 ; } } nodeInfo = nodeInfo->parent() ; } } return ; } #endif /* CHECK_CUT_COUNTS */ #ifdef CHECK_CUT_SIZE /* Routine to verify that cut reference counts are correct. */ void verifyCutSize (const CbcTree * branchingTree, CbcModel &model) { int j ; int nNodes = branchingTree->size() ; int totalCuts = 0; /* cut.tempNumber_ exists for the purpose of doing this verification. Clear it in all cuts. We traverse the tree by starting from each live node and working back to the root. At each CbcNodeInfo, check for cuts. */ for (j = 0 ; j < nNodes ; j++) { CbcNode *node = branchingTree->nodePointer(j) ; CbcNodeInfo * nodeInfo = node->nodeInfo() ; assert (node->nodeInfo()->numberBranchesLeft()) ; while (nodeInfo) { totalCuts += nodeInfo->numberCuts(); nodeInfo = nodeInfo->parent() ; } } printf("*** CHECKING cuts (size) after %d nodes - %d cuts\n", model.getNodeCount(), totalCuts) ; return ; } #endif /* CHECK_CUT_SIZE */ } /* End unnamed namespace for CbcModel.cpp */ void CbcModel::analyzeObjective () /* Try to find a minimum change in the objective function. The first scan checks that there are no continuous variables with non-zero coefficients, and grabs the largest objective coefficient associated with an unfixed integer variable. The second scan attempts to scale up the objective coefficients to a point where they are sufficiently close to integer that we can pretend they are integer, and calculate a gcd over the coefficients of interest. This will be the minimum increment for the scaled coefficients. The final action is to scale the increment back for the original coefficients and install it, if it's better than the existing value. John's note: We could do better than this. John's second note - apologies for changing s to z */ { const double *objective = getObjCoefficients() ; const double *lower = getColLower() ; const double *upper = getColUpper() ; /* Scan continuous and integer variables to see if continuous are cover or network with integral rhs. */ double continuousMultiplier = 1.0; double * coeffMultiplier = NULL; double largestObj = 0.0; double smallestObj = COIN_DBL_MAX; { const double *rowLower = getRowLower() ; const double *rowUpper = getRowUpper() ; int numberRows = solver_->getNumRows() ; double * rhs = new double [numberRows]; memset(rhs, 0, numberRows*sizeof(double)); int iColumn; int numberColumns = solver_->getNumCols() ; // Column copy of matrix int problemType = -1; const double * element = solver_->getMatrixByCol()->getElements(); const int * row = solver_->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver_->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver_->getMatrixByCol()->getVectorLengths(); int numberInteger = 0; int numberIntegerObj = 0; int numberGeneralIntegerObj = 0; int numberIntegerWeight = 0; int numberContinuousObj = 0; double cost = COIN_DBL_MAX; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] == lower[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; rhs[iRow] += lower[iColumn] * element[j]; } } else { double objValue = objective[iColumn]; if (solver_->isInteger(iColumn)) numberInteger++; if (objValue) { if (!solver_->isInteger(iColumn)) { numberContinuousObj++; } else { largestObj = CoinMax(largestObj, fabs(objValue)); smallestObj = CoinMin(smallestObj, fabs(objValue)); numberIntegerObj++; if (cost == COIN_DBL_MAX) cost = objValue; else if (cost != objValue) cost = -COIN_DBL_MAX; int gap = static_cast (upper[iColumn] - lower[iColumn]); if (gap > 1) { numberGeneralIntegerObj++; numberIntegerWeight += gap; } } } } } int iType = 0; if (!numberContinuousObj && numberIntegerObj <= 5 && numberIntegerWeight <= 100 && numberIntegerObj*3 < numberObjects_ && !parentModel_ && solver_->getNumRows() > 100) iType = 1 + 4 + (((moreSpecialOptions_&536870912)==0) ? 2 : 0); else if (!numberContinuousObj && numberIntegerObj <= 100 && numberIntegerObj*5 < numberObjects_ && numberIntegerWeight <= 100 && !parentModel_ && solver_->getNumRows() > 100 && cost != -COIN_DBL_MAX) iType = 4 + (((moreSpecialOptions_&536870912)==0) ? 2 : 0); else if (!numberContinuousObj && numberIntegerObj <= 100 && numberIntegerObj*5 < numberObjects_ && !parentModel_ && solver_->getNumRows() > 100 && cost != -COIN_DBL_MAX) iType = 8; int iTest = getMaximumNodes(); if (iTest >= 987654320 && iTest < 987654330 && numberObjects_ && !parentModel_) { iType = iTest - 987654320; printf("Testing %d integer variables out of %d objects (%d integer) have cost of %g - %d continuous\n", numberIntegerObj, numberObjects_, numberInteger, cost, numberContinuousObj); if (iType == 9) exit(77); if (numberContinuousObj) iType = 0; } //if (!numberContinuousObj&&(numberIntegerObj<=5||cost!=-COIN_DBL_MAX)&& //numberIntegerObj*3getNumRows()>100) { if (iType) { /* A) put high priority on (if none) B) create artificial objective (if clp) */ int iPriority = -1; for (int i = 0; i < numberObjects_; i++) { int k = object_[i]->priority(); if (iPriority == -1) iPriority = k; else if (iPriority != k) iPriority = -2; } bool branchOnSatisfied = ((iType & 1) != 0); bool createFake = ((iType & 2) != 0); bool randomCost = ((iType & 4) != 0); if (iPriority >= 0) { char general[200]; if (cost == -COIN_DBL_MAX) { sprintf(general, "%d integer variables out of %d objects (%d integer) have costs - high priority", numberIntegerObj, numberObjects_, numberInteger); } else if (cost == COIN_DBL_MAX) { sprintf(general, "No integer variables out of %d objects (%d integer) have costs", numberObjects_, numberInteger); branchOnSatisfied = false; } else { sprintf(general, "%d integer variables out of %d objects (%d integer) have cost of %g - high priority", numberIntegerObj, numberObjects_, numberInteger, cost); } messageHandler()->message(CBC_GENERAL, messages()) << general << CoinMessageEol ; sprintf(general, "branch on satisfied %c create fake objective %c random cost %c", branchOnSatisfied ? 'Y' : 'N', createFake ? 'Y' : 'N', randomCost ? 'Y' : 'N'); messageHandler()->message(CBC_GENERAL, messages()) << general << CoinMessageEol ; // switch off clp type branching // no ? fastNodeDepth_ = -1; int highPriority = (branchOnSatisfied) ? -999 : 100; for (int i = 0; i < numberObjects_; i++) { CbcSimpleInteger * thisOne = dynamic_cast (object_[i]); object_[i]->setPriority(1000); if (thisOne) { int iColumn = thisOne->columnNumber(); if (objective[iColumn]) thisOne->setPriority(highPriority); } } } #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver && createFake) { // Create artificial objective to be used when all else fixed int numberColumns = clpSolver->getNumCols(); double * fakeObj = new double [numberColumns]; // Column copy const CoinPackedMatrix * matrixByCol = clpSolver->getMatrixByCol(); //const double * element = matrixByCol.getElements(); //const int * row = matrixByCol.getIndices(); //const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol->getVectorLengths(); const double * solution = clpSolver->getColSolution(); #ifdef JJF_ZERO int nAtBound = 0; for (int i = 0; i < numberColumns; i++) { double lowerValue = lower[i]; double upperValue = upper[i]; if (clpSolver->isInteger(i)) { double lowerValue = lower[i]; double upperValue = upper[i]; double value = solution[i]; if (value < lowerValue + 1.0e-6 || value > upperValue - 1.0e-6) nAtBound++; } } #endif /* Generate a random objective function for problems where the given objective function is not terribly useful. (Nearly feasible, single integer variable, that sort of thing. */ CoinDrand48(true, 1234567); for (int i = 0; i < numberColumns; i++) { double lowerValue = lower[i]; double upperValue = upper[i]; double value = (randomCost) ? ceil((CoinDrand48() + 0.5) * 1000) : i + 1 + columnLength[i] * 1000; value *= 0.001; //value += columnLength[i]; if (lowerValue > -1.0e5 || upperValue < 1.0e5) { if (fabs(lowerValue) > fabs(upperValue)) value = - value; if (clpSolver->isInteger(i)) { double solValue = solution[i]; // Better to add in 0.5 or 1.0?? if (solValue < lowerValue + 1.0e-6) value = fabs(value) + 0.5; //fabs(value*1.5); else if (solValue > upperValue - 1.0e-6) value = -fabs(value) - 0.5; //-fabs(value*1.5); } } else { value = 0.0; } fakeObj[i] = value; } // pass to solver clpSolver->setFakeObjective(fakeObj); delete [] fakeObj; } #endif } else if (largestObj < smallestObj*5.0 && !parentModel_ && !numberContinuousObj && !numberGeneralIntegerObj && numberIntegerObj*2 < CoinMin(numberColumns,20)) { // up priorities on costed int iPriority = -1; for (int i = 0; i < numberObjects_; i++) { int k = object_[i]->priority(); if (iPriority == -1) iPriority = k; else if (iPriority != k) iPriority = -2; } if (iPriority >= 100) { #if CBC_USEFUL_PRINTING>1 printf("Setting variables with obj to high priority\n"); #endif for (int i = 0; i < numberObjects_; i++) { CbcSimpleInteger * obj = dynamic_cast (object_[i]) ; if (obj) { int iColumn = obj->columnNumber(); if (objective[iColumn]) object_[i]->setPriority(iPriority - 1); } } } } int iRow; for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow] > -1.0e20 && fabs(rowLower[iRow] - rhs[iRow] - floor(rowLower[iRow] - rhs[iRow] + 0.5)) > 1.0e-10) { continuousMultiplier = 0.0; break; } if (rowUpper[iRow] < 1.0e20 && fabs(rowUpper[iRow] - rhs[iRow] - floor(rowUpper[iRow] - rhs[iRow] + 0.5)) > 1.0e-10) { continuousMultiplier = 0.0; break; } // set rhs to limiting value if (rowLower[iRow] != rowUpper[iRow]) { if (rowLower[iRow] > -1.0e20) { if (rowUpper[iRow] < 1.0e20) { // no good continuousMultiplier = 0.0; break; } else { rhs[iRow] = rowLower[iRow] - rhs[iRow]; if (problemType < 0) problemType = 3; // set cover else if (problemType != 3) problemType = 4; } } else { rhs[iRow] = rowUpper[iRow] - rhs[iRow]; if (problemType < 0) problemType = 1; // set partitioning <= else if (problemType != 1) problemType = 4; } } else { rhs[iRow] = rowUpper[iRow] - rhs[iRow]; if (problemType < 0) problemType = 3; // set partitioning == else if (problemType != 2) problemType = 2; } if (fabs(rhs[iRow] - 1.0) > 1.0e-12) problemType = 4; } if (continuousMultiplier) { // 1 network, 2 cover, 4 negative cover int possible = 7; bool unitRhs = true; // See which rows could be set cover for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn] + 1.0e-8) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { double value = element[j]; if (value == 1.0) { } else if (value == -1.0) { rhs[row[j]] = -0.5; } else { rhs[row[j]] = -COIN_DBL_MAX; } } } } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn] + 1.0e-8) { if (!isInteger(iColumn)) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; double rhsValue = 0.0; // 1 all ones, -1 all -1s, 2 all +- 1, 3 no good int type = 0; for (CoinBigIndex j = start; j < end; j++) { double value = element[j]; if (fabs(value) != 1.0) { type = 3; break; } else if (value == 1.0) { if (!type) type = 1; else if (type != 1) type = 2; } else { if (!type) type = -1; else if (type != -1) type = 2; } int iRow = row[j]; if (rhs[iRow] == -COIN_DBL_MAX) { type = 3; break; } else if (rhs[iRow] == -0.5) { // different values unitRhs = false; } else if (rhsValue) { if (rhsValue != rhs[iRow]) unitRhs = false; } else { rhsValue = rhs[iRow]; } } // if no elements OK if (type == 3) { // no good possible = 0; break; } else if (type == 2) { if (end - start > 2) { // no good possible = 0; break; } else { // only network possible &= 1; if (!possible) break; } } else if (type == 1) { // only cover possible &= 2; if (!possible) break; } else if (type == -1) { // only negative cover possible &= 4; if (!possible) break; } } } } if ((possible == 2 || possible == 4) && !unitRhs) { #if COIN_DEVELOP>1 printf("XXXXXX Continuous all +1 but different rhs\n"); #endif possible = 0; } // may be all integer if (possible != 7) { if (!possible) continuousMultiplier = 0.0; else if (possible == 1) continuousMultiplier = 1.0; else continuousMultiplier = 0.0; // 0.5 was incorrect; #if COIN_DEVELOP>1 if (continuousMultiplier) printf("XXXXXX multiplier of %g\n", continuousMultiplier); #endif if (continuousMultiplier == 0.5) { coeffMultiplier = new double [numberColumns]; bool allOne = true; for (iColumn = 0; iColumn < numberColumns; iColumn++) { coeffMultiplier[iColumn] = 1.0; if (upper[iColumn] > lower[iColumn] + 1.0e-8) { if (!isInteger(iColumn)) { CoinBigIndex start = columnStart[iColumn]; int iRow = row[start]; double value = rhs[iRow]; assert (value >= 0.0); if (value != 0.0 && value != 1.0) allOne = false; coeffMultiplier[iColumn] = 0.5 * value; } } } if (allOne) { // back to old way delete [] coeffMultiplier; coeffMultiplier = NULL; } } } else { // all integer problemType_ = problemType; #if COIN_DEVELOP>1 printf("Problem type is %d\n", problemType_); #endif } } // But try again if (continuousMultiplier < 1.0) { memset(rhs, 0, numberRows*sizeof(double)); int * count = new int [numberRows]; memset(count, 0, numberRows*sizeof(int)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; if (upper[iColumn] == lower[iColumn]) { for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; rhs[iRow] += lower[iColumn] * element[j]; } } else if (solver_->isInteger(iColumn)) { for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; if (fabs(element[j] - floor(element[j] + 0.5)) > 1.0e-10) rhs[iRow] = COIN_DBL_MAX; } } else { for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; count[iRow]++; if (fabs(element[j]) != 1.0) rhs[iRow] = COIN_DBL_MAX; } } } // now look at continuous bool allGood = true; double direction = solver_->getObjSense() ; int numberObj = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn]) { double objValue = objective[iColumn] * direction; if (objValue && !solver_->isInteger(iColumn)) { numberObj++; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; if (objValue > 0.0) { // wants to be as low as possible if (lower[iColumn] < -1.0e10 || fabs(lower[iColumn] - floor(lower[iColumn] + 0.5)) > 1.0e-10) { allGood = false; break; } else if (upper[iColumn] < 1.0e10 && fabs(upper[iColumn] - floor(upper[iColumn] + 0.5)) > 1.0e-10) { allGood = false; break; } bool singletonRow = true; bool equality = false; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; if (count[iRow] > 1) singletonRow = false; else if (rowLower[iRow] == rowUpper[iRow]) equality = true; double rhsValue = rhs[iRow]; double lowerValue = rowLower[iRow]; double upperValue = rowUpper[iRow]; if (rhsValue < 1.0e20) { if (lowerValue > -1.0e20) lowerValue -= rhsValue; if (upperValue < 1.0e20) upperValue -= rhsValue; } if (fabs(rhsValue) > 1.0e20 || fabs(rhsValue - floor(rhsValue + 0.5)) > 1.0e-10 || fabs(element[j]) != 1.0) { // no good allGood = false; break; } if (element[j] > 0.0) { if (lowerValue > -1.0e20 && fabs(lowerValue - floor(lowerValue + 0.5)) > 1.0e-10) { // no good allGood = false; break; } } else { if (upperValue < 1.0e20 && fabs(upperValue - floor(upperValue + 0.5)) > 1.0e-10) { // no good allGood = false; break; } } } if (!singletonRow && end > start + 1 && !equality) allGood = false; if (!allGood) break; } else { // wants to be as high as possible if (upper[iColumn] > 1.0e10 || fabs(upper[iColumn] - floor(upper[iColumn] + 0.5)) > 1.0e-10) { allGood = false; break; } else if (lower[iColumn] > -1.0e10 && fabs(lower[iColumn] - floor(lower[iColumn] + 0.5)) > 1.0e-10) { allGood = false; break; } bool singletonRow = true; bool equality = false; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; if (count[iRow] > 1) singletonRow = false; else if (rowLower[iRow] == rowUpper[iRow]) equality = true; double rhsValue = rhs[iRow]; double lowerValue = rowLower[iRow]; double upperValue = rowUpper[iRow]; if (rhsValue < 1.0e20) { if (lowerValue > -1.0e20) lowerValue -= rhsValue; if (upperValue < 1.0e20) upperValue -= rhsValue; } if (fabs(rhsValue) > 1.0e20 || fabs(rhsValue - floor(rhsValue + 0.5)) > 1.0e-10 || fabs(element[j]) != 1.0) { // no good allGood = false; break; } if (element[j] < 0.0) { if (lowerValue > -1.0e20 && fabs(lowerValue - floor(lowerValue + 0.5)) > 1.0e-10) { // no good allGood = false; break; } } else { if (upperValue < 1.0e20 && fabs(upperValue - floor(upperValue + 0.5)) > 1.0e-10) { // no good allGood = false; break; } } } if (!singletonRow && end > start + 1 && !equality) allGood = false; if (!allGood) break; } } } } delete [] count; if (allGood) { #if COIN_DEVELOP>1 if (numberObj) printf("YYYY analysis says all continuous with costs will be integer\n"); #endif continuousMultiplier = 1.0; } } delete [] rhs; } /* Take a first scan to see if there are unfixed continuous variables in the objective. If so, the minimum objective change could be arbitrarily small. Also pick off the maximum coefficient of an unfixed integer variable. If the objective is found to contain only integer variables, set the fathoming discipline to strict. */ double maximumCost = 0.0 ; //double trueIncrement=0.0; int iColumn ; int numberColumns = getNumCols() ; double scaleFactor = 1.0; // due to rhs etc /* Original model did not have integer bounds. */ if ((specialOptions_&65536) == 0) { /* be on safe side (later look carefully as may be able to to get 0.5 say if bounds are multiples of 0.5 */ for (iColumn = 0 ; iColumn < numberColumns ; iColumn++) { if (upper[iColumn] > lower[iColumn] + 1.0e-8) { double value; value = fabs(lower[iColumn]); if (floor(value + 0.5) != value) { scaleFactor = CoinMin(scaleFactor, 0.5); if (floor(2.0*value + 0.5) != 2.0*value) { scaleFactor = CoinMin(scaleFactor, 0.25); if (floor(4.0*value + 0.5) != 4.0*value) { scaleFactor = 0.0; } } } value = fabs(upper[iColumn]); if (floor(value + 0.5) != value) { scaleFactor = CoinMin(scaleFactor, 0.5); if (floor(2.0*value + 0.5) != 2.0*value) { scaleFactor = CoinMin(scaleFactor, 0.25); if (floor(4.0*value + 0.5) != 4.0*value) { scaleFactor = 0.0; } } } } } } bool possibleMultiple = continuousMultiplier != 0.0 && scaleFactor != 0.0 ; if (possibleMultiple) { for (iColumn = 0 ; iColumn < numberColumns ; iColumn++) { if (upper[iColumn] > lower[iColumn] + 1.0e-8) { maximumCost = CoinMax(maximumCost, fabs(objective[iColumn])) ; } } } setIntParam(CbcModel::CbcFathomDiscipline, possibleMultiple) ; /* If a nontrivial increment is possible, try and figure it out. We're looking for gcd(c) for all c that are coefficients of unfixed integer variables. Since the c might not be integers, try and inflate them sufficiently that they look like integers (and we'll deflate the gcd later). 2520.0 is used as it is a nice multiple of 2,3,5,7 */ if (possibleMultiple && maximumCost) { int increment = 0 ; double multiplier = 2520.0 ; while (10.0*multiplier*maximumCost < 1.0e8) multiplier *= 10.0 ; int bigIntegers = 0; // Count of large costs which are integer for (iColumn = 0 ; iColumn < numberColumns ; iColumn++) { if (upper[iColumn] > lower[iColumn] + 1.0e-8) { double objValue = fabs(objective[iColumn]); if (!isInteger(iColumn)) { if (!coeffMultiplier) objValue *= continuousMultiplier; else objValue *= coeffMultiplier[iColumn]; } if (objValue) { double value = objValue * multiplier ; if (value < 2.1e9) { int nearest = static_cast (floor(value + 0.5)) ; if (fabs(value - floor(value + 0.5)) > 1.0e-8) { increment = 0 ; break ; } else if (!increment) { increment = nearest ; } else { increment = gcd(increment, nearest) ; } } else { // large value - may still be multiple of 1.0 if (fabs(objValue - floor(objValue + 0.5)) > 1.0e-8) { increment = 0; break; } else { bigIntegers++; } } } } } delete [] coeffMultiplier; /* If the increment beats the current value for objective change, install it. */ if (increment) { double value = increment ; double cutoff = getDblParam(CbcModel::CbcCutoffIncrement) ; if (bigIntegers) { // allow for 1.0 increment = gcd(increment, static_cast (multiplier)); value = increment; } value /= multiplier ; value *= scaleFactor; //trueIncrement=CoinMax(cutoff,value);; if (value*0.999 > cutoff) { messageHandler()->message(CBC_INTEGERINCREMENT, messages()) << value << CoinMessageEol ; setDblParam(CbcModel::CbcCutoffIncrement, CoinMax(value*0.999,value-1.0e-4)) ; } } } return ; } /* saveModel called (carved out of) BranchandBound */ void CbcModel::saveModel(OsiSolverInterface * saveSolver, double * checkCutoffForRestart, bool * feasible) { if (saveSolver && (specialOptions_&32768) != 0) { // See if worth trying reduction *checkCutoffForRestart = getCutoff(); bool tryNewSearch = solverCharacteristics_->reducedCostsAccurate() && (*checkCutoffForRestart < 1.0e20); int numberColumns = getNumCols(); if (tryNewSearch) { #if CBC_USEFUL_PRINTING>1 printf("after %d nodes, cutoff %g - looking\n", numberNodes_, getCutoff()); #endif saveSolver->resolve(); double direction = saveSolver->getObjSense() ; double gap = *checkCutoffForRestart - saveSolver->getObjValue() * direction ; double tolerance; saveSolver->getDblParam(OsiDualTolerance, tolerance) ; if (gap <= 0.0) gap = tolerance; gap += 100.0 * tolerance; double integerTolerance = getDblParam(CbcIntegerTolerance) ; const double *lower = saveSolver->getColLower() ; const double *upper = saveSolver->getColUpper() ; const double *solution = saveSolver->getColSolution() ; const double *reducedCost = saveSolver->getReducedCost() ; int numberFixed = 0 ; int numberFixed2 = 0; for (int i = 0 ; i < numberIntegers_ ; i++) { int iColumn = integerVariable_[i] ; double djValue = direction * reducedCost[iColumn] ; if (upper[iColumn] - lower[iColumn] > integerTolerance) { if (solution[iColumn] < lower[iColumn] + integerTolerance && djValue > gap) { saveSolver->setColUpper(iColumn, lower[iColumn]) ; numberFixed++ ; } else if (solution[iColumn] > upper[iColumn] - integerTolerance && -djValue > gap) { saveSolver->setColLower(iColumn, upper[iColumn]) ; numberFixed++ ; } } else { numberFixed2++; } } #ifdef COIN_DEVELOP /* We're debugging. (specialOptions 1) */ if ((specialOptions_&1) != 0) { const OsiRowCutDebugger *debugger = saveSolver->getRowCutDebugger() ; if (debugger) { printf("Contains optimal\n") ; OsiSolverInterface * temp = saveSolver->clone(); const double * solution = debugger->optimalSolution(); const double *lower = temp->getColLower() ; const double *upper = temp->getColUpper() ; int n = temp->getNumCols(); for (int i = 0; i < n; i++) { if (temp->isInteger(i)) { double value = floor(solution[i] + 0.5); assert (value >= lower[i] && value <= upper[i]); temp->setColLower(i, value); temp->setColUpper(i, value); } } temp->writeMps("reduced_fix"); delete temp; saveSolver->writeMps("reduced"); } else { abort(); } } printf("Restart could fix %d integers (%d already fixed)\n", numberFixed + numberFixed2, numberFixed2); #endif numberFixed += numberFixed2; if (numberFixed*20 < numberColumns) tryNewSearch = false; } if (tryNewSearch) { // back to solver without cuts? OsiSolverInterface * solver2 = continuousSolver_->clone(); const double *lower = saveSolver->getColLower() ; const double *upper = saveSolver->getColUpper() ; for (int i = 0 ; i < numberIntegers_ ; i++) { int iColumn = integerVariable_[i] ; solver2->setColLower(iColumn, lower[iColumn]); solver2->setColUpper(iColumn, upper[iColumn]); } // swap delete saveSolver; saveSolver = solver2; double * newSolution = new double[numberColumns]; double objectiveValue = *checkCutoffForRestart; CbcSerendipity heuristic(*this); if (bestSolution_) heuristic.setInputSolution(bestSolution_, bestObjective_); heuristic.setFractionSmall(0.9); heuristic.setFeasibilityPumpOptions(1008013); // Use numberNodes to say how many are original rows heuristic.setNumberNodes(continuousSolver_->getNumRows()); #ifdef COIN_DEVELOP if (continuousSolver_->getNumRows() < saveSolver->getNumRows()) printf("%d rows added ZZZZZ\n", solver_->getNumRows() - continuousSolver_->getNumRows()); #endif int returnCode = heuristic.smallBranchAndBound(saveSolver, -1, newSolution, objectiveValue, *checkCutoffForRestart, "Reduce"); if (returnCode < 0) { #ifdef COIN_DEVELOP printf("Restart - not small enough to do search after fixing\n"); #endif delete [] newSolution; } else { if ((returnCode&1) != 0) { // increment number of solutions so other heuristics can test numberSolutions_++; numberHeuristicSolutions_++; lastHeuristic_ = NULL; setBestSolution(CBC_ROUNDING, objectiveValue, newSolution) ; } delete [] newSolution; *feasible = false; // stop search } #if 0 // probably not needed def CBC_THREAD if (master_) { lockThread(); if (parallelMode() > 0) { while (master_->waitForThreadsInTree(0)) { lockThread(); double dummyBest; tree_->cleanTree(this, -COIN_DBL_MAX, dummyBest) ; //unlockThread(); } } master_->waitForThreadsInTree(2); delete master_; master_ = NULL; masterThread_ = NULL; } #endif } } } /* Adds integers, called from BranchandBound() */ void CbcModel::AddIntegers() { int numberColumns = continuousSolver_->getNumCols(); int numberRows = continuousSolver_->getNumRows(); int numberOriginalIntegers = numberIntegers_; int * del = new int [CoinMax(numberColumns, numberRows)]; int * original = new int [numberColumns]; char * possibleRow = new char [numberRows]; { const CoinPackedMatrix * rowCopy = continuousSolver_->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowLower = continuousSolver_->getRowLower(); const double * rowUpper = continuousSolver_->getRowUpper(); const double * element = rowCopy->getElements(); for (int i = 0; i < numberRows; i++) { int nLeft = 0; bool possible = false; if (rowLower[i] < -1.0e20) { double value = rowUpper[i]; if (fabs(value - floor(value + 0.5)) < 1.0e-8) possible = true; } else if (rowUpper[i] > 1.0e20) { double value = rowLower[i]; if (fabs(value - floor(value + 0.5)) < 1.0e-8) possible = true; } else { double value = rowUpper[i]; if (rowLower[i] == rowUpper[i] && fabs(value - floor(value + 0.5)) < 1.0e-8) possible = true; } double allSame = (possible) ? 0.0 : -1.0; for (CoinBigIndex j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (continuousSolver_->isInteger(iColumn)) { if (fabs(element[j]) != 1.0) possible = false; } else { nLeft++; if (!allSame) { allSame = fabs(element[j]); } else if (allSame>0.0) { if (allSame!=fabs(element[j])) allSame = -1.0; } } } if (nLeft == rowLength[i] && allSame > 0.0) possibleRow[i] = 2; else if (possible || !nLeft) possibleRow[i] = 1; else possibleRow[i] = 0; } } int nDel = 0; for (int i = 0; i < numberColumns; i++) { original[i] = i; if (continuousSolver_->isInteger(i)) del[nDel++] = i; } { // we must not exclude current best solution (rounding errors) // also not if large values const int * row = continuousSolver_->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = continuousSolver_->getMatrixByCol()->getVectorStarts(); const int * columnLength = continuousSolver_->getMatrixByCol()->getVectorLengths(); const double * solution = continuousSolver_->getColSolution(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!continuousSolver_->isInteger(iColumn)) { double value = bestSolution_ ? bestSolution_[iColumn] : 0.0; double value2 = solution[iColumn]; if (fabs(value-floor(value+0.5))>1.0e-8 || fabs(value2)>1.0e3) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; possibleRow[iRow]=0; } } } } } int nExtra = 0; OsiSolverInterface * copy1 = continuousSolver_->clone(); int nPass = 0; while (nDel && nPass < 10) { nPass++; OsiSolverInterface * copy2 = copy1->clone(); int nLeft = 0; for (int i = 0; i < nDel; i++) original[del[i]] = -1; for (int i = 0; i < numberColumns; i++) { int kOrig = original[i]; if (kOrig >= 0) original[nLeft++] = kOrig; } assert (nLeft == numberColumns - nDel); copy2->deleteCols(nDel, del); numberColumns = copy2->getNumCols(); const CoinPackedMatrix * rowCopy = copy2->getMatrixByRow(); numberRows = rowCopy->getNumRows(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowLower = copy2->getRowLower(); const double * rowUpper = copy2->getRowUpper(); const double * element = rowCopy->getElements(); const CoinPackedMatrix * columnCopy = copy2->getMatrixByCol(); const int * columnLength = columnCopy->getVectorLengths(); nDel = 0; // Could do gcd stuff on ones with costs for (int i = 0; i < numberRows; i++) { if (!rowLength[i]) { del[nDel++] = i; } else if (possibleRow[i]) { if (rowLength[i] == 1) { int k = rowStart[i]; int iColumn = column[k]; if (!copy2->isInteger(iColumn)) { double mult = 1.0 / fabs(element[k]); if (rowLower[i] < -1.0e20) { // treat rhs as multiple of 1 unless elements all same double value = ((possibleRow[i]==2) ? rowUpper[i] : 1.0) * mult; if (fabs(value - floor(value + 0.5)) < 1.0e-8) { del[nDel++] = i; if (columnLength[iColumn] == 1) { copy2->setInteger(iColumn); int kOrig = original[iColumn]; setOptionalInteger(kOrig); } } } else if (rowUpper[i] > 1.0e20) { // treat rhs as multiple of 1 unless elements all same double value = ((possibleRow[i]==2) ? rowLower[i] : 1.0) * mult; if (fabs(value - floor(value + 0.5)) < 1.0e-8) { del[nDel++] = i; if (columnLength[iColumn] == 1) { copy2->setInteger(iColumn); int kOrig = original[iColumn]; setOptionalInteger(kOrig); } } } else { // treat rhs as multiple of 1 unless elements all same double value = ((possibleRow[i]==2) ? rowUpper[i] : 1.0) * mult; if (rowLower[i] == rowUpper[i] && fabs(value - floor(value + 0.5)) < 1.0e-8) { del[nDel++] = i; copy2->setInteger(iColumn); int kOrig = original[iColumn]; setOptionalInteger(kOrig); } } } } else { // only if all singletons bool possible = false; if (rowLower[i] < -1.0e20) { double value = rowUpper[i]; if (fabs(value - floor(value + 0.5)) < 1.0e-8) possible = true; } else if (rowUpper[i] > 1.0e20) { double value = rowLower[i]; if (fabs(value - floor(value + 0.5)) < 1.0e-8) possible = true; } else { double value = rowUpper[i]; if (rowLower[i] == rowUpper[i] && fabs(value - floor(value + 0.5)) < 1.0e-8) possible = true; } if (possible) { for (CoinBigIndex j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (columnLength[iColumn] != 1 || fabs(element[j]) != 1.0) { possible = false; break; } } if (possible) { for (CoinBigIndex j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (!copy2->isInteger(iColumn)) { copy2->setInteger(iColumn); int kOrig = original[iColumn]; setOptionalInteger(kOrig); } } del[nDel++] = i; } } } } } if (nDel) { copy2->deleteRows(nDel, del); // pack down possible int n=0; for (int i=0;i=0) possibleRow[n++]=possibleRow[i]; } } if (nDel != numberRows) { nDel = 0; for (int i = 0; i < numberColumns; i++) { if (copy2->isInteger(i)) { del[nDel++] = i; nExtra++; } } } else { nDel = 0; } delete copy1; copy1 = copy2->clone(); delete copy2; } // See if what's left is a network bool couldBeNetwork = false; if (copy1->getNumRows() && copy1->getNumCols()) { #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (copy1); if (false && clpSolver) { numberRows = clpSolver->getNumRows(); char * rotate = new char[numberRows]; int n = clpSolver->getModelPtr()->findNetwork(rotate, 1.0); delete [] rotate; #if CBC_USEFUL_PRINTING>1 printf("INTA network %d rows out of %d\n", n, numberRows); #endif if (CoinAbs(n) == numberRows) { couldBeNetwork = true; for (int i = 0; i < numberRows; i++) { if (!possibleRow[i]) { couldBeNetwork = false; #if CBC_USEFUL_PRINTING>1 printf("but row %d is bad\n", i); #endif break; } } } } else #endif { numberColumns = copy1->getNumCols(); numberRows = copy1->getNumRows(); const double * rowLower = copy1->getRowLower(); const double * rowUpper = copy1->getRowUpper(); couldBeNetwork = true; for (int i = 0; i < numberRows; i++) { if (rowLower[i] > -1.0e20 && fabs(rowLower[i] - floor(rowLower[i] + 0.5)) > 1.0e-12) { couldBeNetwork = false; break; } if (rowUpper[i] < 1.0e20 && fabs(rowUpper[i] - floor(rowUpper[i] + 0.5)) > 1.0e-12) { couldBeNetwork = false; break; } if (possibleRow[i]==0) { couldBeNetwork = false; break; } } if (couldBeNetwork) { const CoinPackedMatrix * matrixByCol = copy1->getMatrixByCol(); const double * element = matrixByCol->getElements(); //const int * row = matrixByCol->getIndices(); const CoinBigIndex * columnStart = matrixByCol->getVectorStarts(); const int * columnLength = matrixByCol->getVectorLengths(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; if (end > start + 2) { couldBeNetwork = false; break; } int type = 0; for (CoinBigIndex j = start; j < end; j++) { double value = element[j]; if (fabs(value) != 1.0) { couldBeNetwork = false; break; } else if (value == 1.0) { if ((type&1) == 0) type |= 1; else type = 7; } else if (value == -1.0) { if ((type&2) == 0) type |= 2; else type = 7; } } if (type > 3) { couldBeNetwork = false; break; } } } } } if (couldBeNetwork) { for (int i = 0; i < numberColumns; i++) setOptionalInteger(original[i]); } if (nExtra || couldBeNetwork) { numberColumns = copy1->getNumCols(); numberRows = copy1->getNumRows(); if (!numberColumns || !numberRows) { int numberColumns = solver_->getNumCols(); for (int i = 0; i < numberColumns; i++) assert(solver_->isInteger(i)); } #if CBC_USEFUL_PRINTING>1 if (couldBeNetwork || nExtra) printf("INTA %d extra integers, %d left%s\n", nExtra, numberColumns, couldBeNetwork ? ", all network" : ""); #endif findIntegers(true, 2); convertToDynamic(); } #if CBC_USEFUL_PRINTING>1 if (!couldBeNetwork && copy1->getNumCols() && copy1->getNumRows()) { printf("INTA %d rows and %d columns remain\n", copy1->getNumRows(), copy1->getNumCols()); if (copy1->getNumCols() < 200) { copy1->writeMps("moreint"); printf("INTA Written remainder to moreint.mps.gz %d rows %d cols\n", copy1->getNumRows(), copy1->getNumCols()); } } #endif delete copy1; delete [] del; delete [] original; delete [] possibleRow; // double check increment analyzeObjective(); // If any changes - tell code if(numberOriginalIntegersgetObjSense()<0.0); if (flipObjective) flipModel(); dblParam_[CbcOptimizationDirection] = 1.0; // was solver_->getObjSense(); strongInfo_[0] = 0; strongInfo_[1] = 0; strongInfo_[2] = 0; strongInfo_[3] = 0; strongInfo_[4] = 0; strongInfo_[5] = 0; strongInfo_[6] = 0; numberStrongIterations_ = 0; currentNode_ = NULL; // See if should do cuts old way if (parallelMode() < 0) { specialOptions_ |= 4096 + 8192; } else if (parallelMode() > 0) { specialOptions_ |= 4096; } int saveMoreSpecialOptions = moreSpecialOptions_; if (dynamic_cast (tree_)) specialOptions_ |= 4096 + 8192; #ifdef COIN_HAS_CLP { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { // pass in disaster handler CbcDisasterHandler handler(this); clpSolver->passInDisasterHandler(&handler); // Initialise solvers seed (unless users says not) if ((specialOptions_&4194304)==0) clpSolver->getModelPtr()->setRandomSeed(1234567); #ifdef JJF_ZERO // reduce factorization frequency int frequency = clpSolver->getModelPtr()->factorizationFrequency(); clpSolver->getModelPtr()->setFactorizationFrequency(CoinMin(frequency, 120)); #endif } } #endif // original solver (only set if pre-processing) OsiSolverInterface * originalSolver = NULL; int numberOriginalObjects = numberObjects_; OsiObject ** originalObject = NULL; // Save whether there were any objects bool noObjects = (numberObjects_ == 0); // Set up strategies /* See if the user has supplied a strategy object and deal with it if present. The call to setupOther will set numberStrong_ and numberBeforeTrust_, and perform integer preprocessing, if requested. We need to hang on to a pointer to solver_. setupOther will assign a preprocessed solver to model, but will instruct assignSolver not to trash the existing one. */ if (strategy_) { // May do preprocessing originalSolver = solver_; strategy_->setupOther(*this); if (strategy_->preProcessState()) { // pre-processing done if (strategy_->preProcessState() < 0) { // infeasible (or unbounded) status_ = 0 ; if (!solver_->isProvenDualInfeasible()) { handler_->message(CBC_INFEAS, messages_) << CoinMessageEol ; secondaryStatus_ = 1; } else { handler_->message(CBC_UNBOUNDED, messages_) << CoinMessageEol ; secondaryStatus_ = 7; } originalContinuousObjective_ = COIN_DBL_MAX; if (flipObjective) flipModel(); return ; } else if (numberObjects_ && object_) { numberOriginalObjects = numberObjects_; // redo sequence numberIntegers_ = 0; int numberColumns = getNumCols(); int nOrig = originalSolver->getNumCols(); CglPreProcess * process = strategy_->process(); assert (process); const int * originalColumns = process->originalColumns(); // allow for cliques etc nOrig = CoinMax(nOrig, originalColumns[numberColumns-1] + 1); // try and redo debugger OsiRowCutDebugger * debugger = const_cast (solver_->getRowCutDebuggerAlways()); if (debugger) { if (numberColumns<=debugger->numberColumns()) debugger->redoSolution(numberColumns, originalColumns); else debugger=NULL; // no idea how to handle (SOS?) } // User-provided solution might have been best. Synchronise. if (bestSolution_) { // need to redo - in case no better found in BAB // just get integer part right for (int i = 0; i < numberColumns; i++) { int jColumn = originalColumns[i]; bestSolution_[i] = bestSolution_[jColumn]; } } originalObject = object_; // object number or -1 int * temp = new int[nOrig]; int iColumn; for (iColumn = 0; iColumn < nOrig; iColumn++) temp[iColumn] = -1; int iObject; int nNonInt = 0; for (iObject = 0; iObject < numberOriginalObjects; iObject++) { iColumn = originalObject[iObject]->columnNumber(); if (iColumn < 0) { nNonInt++; } else { temp[iColumn] = iObject; } } int numberNewIntegers = 0; int numberOldIntegers = 0; int numberOldOther = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = originalColumns[iColumn]; if (temp[jColumn] >= 0) { int iObject = temp[jColumn]; CbcSimpleInteger * obj = dynamic_cast (originalObject[iObject]) ; if (obj) numberOldIntegers++; else numberOldOther++; } else if (isInteger(iColumn)) { numberNewIntegers++; } } /* Allocate an array to hold the indices of the integer variables. Make a large enough array for all objects */ numberObjects_ = numberNewIntegers + numberOldIntegers + numberOldOther + nNonInt; object_ = new OsiObject * [numberObjects_]; delete [] integerVariable_; integerVariable_ = new int [numberNewIntegers+numberOldIntegers]; /* Walk the variables again, filling in the indices and creating objects for the integer variables. Initially, the objects hold the index and upper & lower bounds. */ numberIntegers_ = 0; int n = originalColumns[numberColumns-1] + 1; int * backward = new int[n]; int i; for ( i = 0; i < n; i++) backward[i] = -1; for (i = 0; i < numberColumns; i++) backward[originalColumns[i]] = i; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = originalColumns[iColumn]; if (temp[jColumn] >= 0) { int iObject = temp[jColumn]; CbcSimpleInteger * obj = dynamic_cast (originalObject[iObject]) ; if (obj) { object_[numberIntegers_] = originalObject[iObject]->clone(); // redo ids etc //object_[numberIntegers_]->resetSequenceEtc(numberColumns,originalColumns); object_[numberIntegers_]->resetSequenceEtc(numberColumns, backward); integerVariable_[numberIntegers_++] = iColumn; } } else if (isInteger(iColumn)) { object_[numberIntegers_] = new CbcSimpleInteger(this, iColumn); integerVariable_[numberIntegers_++] = iColumn; } } delete [] backward; numberObjects_ = numberIntegers_; // Now append other column stuff for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = originalColumns[iColumn]; if (temp[jColumn] >= 0) { int iObject = temp[jColumn]; CbcSimpleInteger * obj = dynamic_cast (originalObject[iObject]) ; if (!obj) { object_[numberObjects_] = originalObject[iObject]->clone(); // redo ids etc CbcObject * obj = dynamic_cast (object_[numberObjects_]) ; assert (obj); obj->redoSequenceEtc(this, numberColumns, originalColumns); numberObjects_++; } } } // now append non column stuff for (iObject = 0; iObject < numberOriginalObjects; iObject++) { iColumn = originalObject[iObject]->columnNumber(); if (iColumn < 0) { // already has column numbers changed object_[numberObjects_] = originalObject[iObject]->clone(); #ifdef JJF_ZERO // redo ids etc CbcObject * obj = dynamic_cast (object_[numberObjects_]) ; assert (obj); obj->redoSequenceEtc(this, numberColumns, originalColumns); #endif numberObjects_++; } } delete [] temp; if (!numberObjects_) handler_->message(CBC_NOINT, messages_) << CoinMessageEol ; } else { int numberColumns = getNumCols(); CglPreProcess * process = strategy_->process(); assert (process); const int * originalColumns = process->originalColumns(); // try and redo debugger OsiRowCutDebugger * debugger = const_cast (solver_->getRowCutDebuggerAlways()); if (debugger) debugger->redoSolution(numberColumns, originalColumns); } } else { //no preprocessing originalSolver = NULL; } strategy_->setupCutGenerators(*this); strategy_->setupHeuristics(*this); // Set strategy print level to models strategy_->setupPrinting(*this, handler_->logLevel()); } eventHappened_ = false; CbcEventHandler *eventHandler = getEventHandler() ; if (eventHandler) eventHandler->setModel(this); #define CLIQUE_ANALYSIS #ifdef CLIQUE_ANALYSIS // set up for probing // If we're doing clever stuff with cliques, additional info here. if (!parentModel_) probingInfo_ = new CglTreeProbingInfo(solver_); else probingInfo_ = NULL; #else probingInfo_ = NULL; #endif // Try for dominated columns if ((specialOptions_&64) != 0) { CglDuplicateRow dupcuts(solver_); dupcuts.setMode(2); CglStored * storedCuts = dupcuts.outDuplicates(solver_); if (storedCuts) { COIN_DETAIL_PRINT(printf("adding dup cuts\n")); addCutGenerator(storedCuts, 1, "StoredCuts from dominated", true, false, false, -200); } } if (!nodeCompare_) nodeCompare_ = new CbcCompareDefault();; // See if hot start wanted CbcCompareBase * saveCompare = NULL; // User supplied hotstart. Adapt for preprocessing. if (hotstartSolution_) { if (strategy_ && strategy_->preProcessState() > 0) { CglPreProcess * process = strategy_->process(); assert (process); int n = solver_->getNumCols(); const int * originalColumns = process->originalColumns(); // columns should be in order ... but double * tempS = new double[n]; for (int i = 0; i < n; i++) { int iColumn = originalColumns[i]; tempS[i] = hotstartSolution_[iColumn]; } delete [] hotstartSolution_; hotstartSolution_ = tempS; if (hotstartPriorities_) { int * tempP = new int [n]; for (int i = 0; i < n; i++) { int iColumn = originalColumns[i]; tempP[i] = hotstartPriorities_[iColumn]; } delete [] hotstartPriorities_; hotstartPriorities_ = tempP; } } saveCompare = nodeCompare_; // depth first nodeCompare_ = new CbcCompareDepth(); } if (!problemFeasibility_) problemFeasibility_ = new CbcFeasibilityBase(); # ifdef CBC_DEBUG std::string problemName ; solver_->getStrParam(OsiProbName, problemName) ; printf("Problem name - %s\n", problemName.c_str()) ; solver_->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; # endif /* Assume we're done, and see if we're proven wrong. */ status_ = 0 ; secondaryStatus_ = 0; phase_ = 0; /* Scan the variables, noting the integer variables. Create an CbcSimpleInteger object for each integer variable. */ findIntegers(false) ; // Say not dynamic pseudo costs ownership_ &= ~0x40000000; // If dynamic pseudo costs then do if (numberBeforeTrust_) convertToDynamic(); // Set up char array to say if integer (speed) delete [] integerInfo_; { int n = solver_->getNumCols(); integerInfo_ = new char [n]; for (int i = 0; i < n; i++) { if (solver_->isInteger(i)) integerInfo_[i] = 1; else integerInfo_[i] = 0; } } if (preferredWay_) { // set all unset ones for (int iObject = 0 ; iObject < numberObjects_ ; iObject++) { CbcObject * obj = dynamic_cast (object_[iObject]) ; if (obj && !obj->preferredWay()) obj->setPreferredWay(preferredWay_); } } /* Ensure that objects on the lists of OsiObjects, heuristics, and cut generators attached to this model all refer to this model. */ synchronizeModel() ; if (!solverCharacteristics_) { OsiBabSolver * solverCharacteristics = dynamic_cast (solver_->getAuxiliaryInfo()); if (solverCharacteristics) { solverCharacteristics_ = solverCharacteristics; } else { // replace in solver OsiBabSolver defaultC; solver_->setAuxiliaryInfo(&defaultC); solverCharacteristics_ = dynamic_cast (solver_->getAuxiliaryInfo()); } } solverCharacteristics_->setSolver(solver_); // Set so we can tell we are in initial phase in resolve continuousObjective_ = -COIN_DBL_MAX ; /* Solve the relaxation. Apparently there are circumstances where this will be non-trivial --- i.e., we've done something since initialSolve that's trashed the solution to the continuous relaxation. */ /* Tell solver we are in Branch and Cut Could use last parameter for subtle differences */ solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; #ifdef COIN_HAS_CLP { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { ClpSimplex * clpSimplex = clpSolver->getModelPtr(); if ((specialOptions_&32) == 0) { // take off names (unless going to be saving) if (numberAnalyzeIterations_>=0||(-numberAnalyzeIterations_&64)==0) clpSimplex->dropNames(); } // no crunch if mostly continuous if ((clpSolver->specialOptions()&(1 + 8)) != (1 + 8)) { int numberColumns = solver_->getNumCols(); if (numberColumns > 1000 && numberIntegers_*4 < numberColumns) clpSolver->setSpecialOptions(clpSolver->specialOptions()&(~1)); } //#define NO_CRUNCH #ifdef NO_CRUNCH printf("TEMP switching off crunch\n"); int iOpt = clpSolver->specialOptions(); iOpt &= ~1; iOpt |= 65536; clpSolver->setSpecialOptions(iOpt); #endif } } #endif bool feasible; numberSolves_ = 0 ; { // check int numberOdd = 0; for (int i = 0; i < numberObjects_; i++) { CbcSimpleInteger * obj = dynamic_cast (object_[i]) ; if (!obj) numberOdd++; } if (numberOdd) moreSpecialOptions_ |= 1073741824; } // If NLP then we assume already solved outside branchAndbound if (!solverCharacteristics_->solverType() || solverCharacteristics_->solverType() == 4) { feasible = resolve(NULL, 0) != 0 ; } else { // pick up given status feasible = (solver_->isProvenOptimal() && !solver_->isDualObjectiveLimitReached()) ; } if (problemFeasibility_->feasible(this, 0) < 0) { feasible = false; // pretend infeasible } numberSavedSolutions_ = 0; int saveNumberStrong = numberStrong_; int saveNumberBeforeTrust = numberBeforeTrust_; /* If the linear relaxation of the root is infeasible, bail out now. Otherwise, continue with processing the root node. */ if (!feasible) { status_ = 0 ; if (!solver_->isProvenDualInfeasible()) { handler_->message(CBC_INFEAS, messages_) << CoinMessageEol ; secondaryStatus_ = 1; } else { handler_->message(CBC_UNBOUNDED, messages_) << CoinMessageEol ; secondaryStatus_ = 7; } originalContinuousObjective_ = COIN_DBL_MAX; if (bestSolution_ && ((specialOptions_&8388608)==0||(specialOptions_&2048)!=0)) { // best solution found by various heuristics - set solution char general[200]; sprintf(general,"Solution of %g already found by heuristic", bestObjective_); messageHandler()->message(CBC_GENERAL, messages()) << general << CoinMessageEol ; setCutoff(1.0e50) ; // As best solution should be worse than cutoff // change cutoff as constraint if wanted if (cutoffRowNumber_>=0) { if (solver_->getNumRows()>cutoffRowNumber_) solver_->setRowUpper(cutoffRowNumber_,1.0e50); } // also in continuousSolver_ if (continuousSolver_) { // Solvers know about direction double direction = solver_->getObjSense(); continuousSolver_->setDblParam(OsiDualObjectiveLimit, 1.0e50*direction); } else { continuousSolver_ = solver_->clone(); } phase_ = 5; double increment = getDblParam(CbcModel::CbcCutoffIncrement) ; if ((specialOptions_&4) == 0) bestObjective_ += 100.0 * increment + 1.0e-3; // only set if we are going to solve setBestSolution(CBC_END_SOLUTION, bestObjective_, bestSolution_, 1) ; continuousSolver_->resolve() ; if (!continuousSolver_->isProvenOptimal()) { continuousSolver_->messageHandler()->setLogLevel(2) ; continuousSolver_->initialSolve() ; } delete solver_ ; solver_ = continuousSolver_ ; setPointers(solver_); continuousSolver_ = NULL ; } solverCharacteristics_ = NULL; if (flipObjective) flipModel(); return ; } else if (!numberObjects_) { // nothing to do // Undo preprocessing performed during BaB. if (strategy_ && strategy_->preProcessState() > 0) { // undo preprocessing CglPreProcess * process = strategy_->process(); assert (process); int n = originalSolver->getNumCols(); if (bestSolution_) { delete [] bestSolution_; bestSolution_ = new double [n]; process->postProcess(*solver_); } strategy_->deletePreProcess(); // Solution now back in originalSolver delete solver_; solver_ = originalSolver; if (bestSolution_) { bestObjective_ = solver_->getObjValue() * solver_->getObjSense(); memcpy(bestSolution_, solver_->getColSolution(), n*sizeof(double)); } // put back original objects if there were any if (originalObject) { int iColumn; assert (ownObjects_); for (iColumn = 0; iColumn < numberObjects_; iColumn++) delete object_[iColumn]; delete [] object_; numberObjects_ = numberOriginalObjects; object_ = originalObject; delete [] integerVariable_; numberIntegers_ = 0; for (iColumn = 0; iColumn < n; iColumn++) { if (solver_->isInteger(iColumn)) numberIntegers_++; } integerVariable_ = new int[numberIntegers_]; numberIntegers_ = 0; for (iColumn = 0; iColumn < n; iColumn++) { if (solver_->isInteger(iColumn)) integerVariable_[numberIntegers_++] = iColumn; } } } if (flipObjective) flipModel(); solverCharacteristics_ = NULL; bestObjective_ = solver_->getObjValue() * solver_->getObjSense(); int numberColumns = solver_->getNumCols(); delete [] bestSolution_; bestSolution_ = new double[numberColumns]; CoinCopyN(solver_->getColSolution(), numberColumns, bestSolution_); return ; } /* See if we're using the Osi side of the branching hierarchy. If so, either convert existing CbcObjects to OsiObjects, or generate them fresh. In the first case, CbcModel owns the objects on the object_ list. In the second case, the solver holds the objects and object_ simply points to the solver's list. 080417 The conversion code here (the block protected by `if (obj)') cannot possibly be correct. On the Osi side, descent is OsiObject -> OsiObject2 -> all other Osi object classes. On the Cbc side, it's OsiObject -> CbcObject -> all other Cbc object classes. It's structurally impossible for any Osi object to descend from CbcObject. The only thing I can see is that this is really dead code, and object detection is now handled from the Osi side. */ // Convert to Osi if wanted //OsiBranchingInformation * persistentInfo = NULL; if (branchingMethod_ && branchingMethod_->chooseMethod()) { //persistentInfo = new OsiBranchingInformation(solver_); if (numberOriginalObjects) { for (int iObject = 0 ; iObject < numberObjects_ ; iObject++) { CbcObject * obj = dynamic_cast (object_[iObject]) ; if (obj) { CbcSimpleInteger * obj2 = dynamic_cast (obj) ; if (obj2) { // back to Osi land object_[iObject] = obj2->osiObject(); delete obj; } else { OsiSimpleInteger * obj3 = dynamic_cast (obj) ; if (!obj3) { OsiSOS * obj4 = dynamic_cast (obj) ; if (!obj4) { CbcSOS * obj5 = dynamic_cast (obj) ; if (obj5) { // back to Osi land object_[iObject] = obj5->osiObject(solver_); } else { printf("Code up CbcObject type in Osi land\n"); abort(); } } } } } } // and add to solver //if (!solver_->numberObjects()) { solver_->addObjects(numberObjects_, object_); //} else { //if (solver_->numberObjects()!=numberOriginalObjects) { //printf("should have trapped that solver has objects before\n"); //abort(); //} //} } else { /* As of 080104, findIntegersAndSOS is misleading --- the default OSI implementation finds only integers. */ // do from solver deleteObjects(false); solver_->findIntegersAndSOS(false); numberObjects_ = solver_->numberObjects(); object_ = solver_->objects(); ownObjects_ = false; } branchingMethod_->chooseMethod()->setSolver(solver_); } // take off heuristics if have to (some do not work with SOS, for example) // object should know what's safe. { int numberOdd = 0; int numberSOS = 0; for (int i = 0; i < numberObjects_; i++) { if (!object_[i]->canDoHeuristics()) numberOdd++; CbcSOS * obj = dynamic_cast (object_[i]) ; if (obj) numberSOS++; } if (numberOdd) { if (numberHeuristics_ && (specialOptions_&1024)==0 ) { int k = 0; for (int i = 0; i < numberHeuristics_; i++) { if (!heuristic_[i]->canDealWithOdd()) delete heuristic_[i]; else heuristic_[k++] = heuristic_[i]; } if (!k) { delete [] heuristic_; heuristic_ = NULL; } numberHeuristics_ = k; handler_->message(CBC_HEURISTICS_OFF, messages_) << numberOdd << CoinMessageEol ; } // If odd switch off AddIntegers specialOptions_ &= ~65536; // switch off fast nodes for now fastNodeDepth_ = -1; moreSpecialOptions_ &= ~33554432; // no diving } else if (numberSOS) { specialOptions_ |= 128; // say can do SOS in dynamic mode // switch off fast nodes for now fastNodeDepth_ = -1; moreSpecialOptions_ &= ~33554432; // no diving } if (numberThreads_ > 0) { // switch off fast nodes for now //fastNodeDepth_ = -1; } } // Save objective (just so user can access it) originalContinuousObjective_ = solver_->getObjValue()* solver_->getObjSense(); bestPossibleObjective_ = originalContinuousObjective_; sumChangeObjective1_ = 0.0; sumChangeObjective2_ = 0.0; /* OsiRowCutDebugger knows an optimal answer for a subset of MIP problems. Assuming it recognises the problem, when called upon it will check a cut to see if it cuts off the optimal answer. */ // If debugger exists set specialOptions_ bit if (solver_->getRowCutDebuggerAlways()) { specialOptions_ |= 1; } # ifdef CBC_DEBUG if ((specialOptions_&1) == 0) solver_->activateRowCutDebugger(problemName.c_str()) ; if (solver_->getRowCutDebuggerAlways()) specialOptions_ |= 1; # endif /* Begin setup to process a feasible root node. */ bestObjective_ = CoinMin(bestObjective_, 1.0e50) ; if (!bestSolution_) { numberSolutions_ = 0 ; numberHeuristicSolutions_ = 0 ; } stateOfSearch_ = 0; // Everything is minimization { // needed to sync cutoffs double value ; solver_->getDblParam(OsiDualObjectiveLimit, value) ; dblParam_[CbcCurrentCutoff] = value * solver_->getObjSense(); } double cutoff = getCutoff() ; double direction = solver_->getObjSense() ; dblParam_[CbcOptimizationDirection] = direction; if (cutoff < 1.0e20 && direction < 0.0) messageHandler()->message(CBC_CUTOFF_WARNING1, messages()) << cutoff << -cutoff << CoinMessageEol ; if (cutoff > bestObjective_) cutoff = bestObjective_ ; setCutoff(cutoff) ; /* We probably already have a current solution, but just in case ... */ int numberColumns = getNumCols() ; if (!currentSolution_) currentSolution_ = new double[numberColumns] ; testSolution_ = currentSolution_; /* Create a copy of the solver, thus capturing the original (root node) constraint system (aka the continuous system). */ delete continuousSolver_; continuousSolver_ = solver_->clone() ; #ifdef COIN_HAS_NTY // maybe allow on fix and restart later if ((moreSpecialOptions2_&(128|256))!=0&&!parentModel_) { symmetryInfo_ = new CbcSymmetry(); symmetryInfo_->setupSymmetry(*continuousSolver_); int numberGenerators = symmetryInfo_->statsOrbits(this,0); if (!symmetryInfo_->numberUsefulOrbits()&&(moreSpecialOptions2_&(128|256))!=(128|256)) { delete symmetryInfo_; symmetryInfo_=NULL; moreSpecialOptions2_ &= ~(128|256); } if ((moreSpecialOptions2_&(128|256))==(128|256)) { //moreSpecialOptions2_ &= ~256; } } #endif // add cutoff as constraint if wanted if (cutoffRowNumber_==-2) { if (!parentModel_) { int numberColumns=solver_->getNumCols(); double * obj = CoinCopyOfArray(solver_->getObjCoefficients(),numberColumns); int * indices = new int [numberColumns]; int n=0; for (int i=0;igetDblParam(OsiObjOffset, offset); cutoffRowNumber_ = solver_->getNumRows(); solver_->addRow(n,indices,obj,-COIN_DBL_MAX,CoinMin(cutoff,1.0e25)+offset); } else { // no objective! cutoffRowNumber_ = -1; } delete [] indices; delete [] obj; } else { // switch off cutoffRowNumber_ = -1; } } numberRowsAtContinuous_ = getNumRows() ; solver_->saveBaseModel(); /* Check the objective to see if we can deduce a nontrivial increment. If it's better than the current value for CbcCutoffIncrement, it'll be installed. */ if (solverCharacteristics_->reducedCostsAccurate()) analyzeObjective() ; { // may be able to change cutoff now double cutoff = getCutoff(); double increment = getDblParam(CbcModel::CbcCutoffIncrement) ; if (cutoff > bestObjective_ - increment) { cutoff = bestObjective_ - increment ; setCutoff(cutoff) ; } } #ifdef COIN_HAS_CLP // Possible save of pivot method ClpDualRowPivot * savePivotMethod = NULL; { // pass tolerance and increment to solver OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) clpSolver->setStuff(getIntegerTolerance(), getCutoffIncrement()); #ifdef CLP_RESOLVE if ((moreSpecialOptions_&1048576)!=0&&!parentModel_&&clpSolver) { resolveClp(clpSolver,0); } #endif } #endif /* Set up for cut generation. addedCuts_ holds the cuts which are relevant for the active subproblem. whichGenerator will be used to record the generator that produced a given cut. */ #define INITIAL_MAXIMUM_WHICH 1000 maximumWhich_ = INITIAL_MAXIMUM_WHICH ; delete [] whichGenerator_; whichGenerator_ = new int[maximumWhich_] ; memset(whichGenerator_, 0, maximumWhich_*sizeof(int)); maximumNumberCuts_ = 0 ; currentNumberCuts_ = 0 ; delete [] addedCuts_ ; addedCuts_ = NULL ; OsiObject ** saveObjects = NULL; maximumRows_ = numberRowsAtContinuous_; currentDepth_ = 0; workingBasis_.resize(maximumRows_, numberColumns); /* Set up an empty heap and associated data structures to hold the live set (problems which require further exploration). */ CbcCompareDefault * compareActual = dynamic_cast (nodeCompare_); if (compareActual) { compareActual->setBestPossible(direction*solver_->getObjValue()); compareActual->setCutoff(getCutoff()); #ifdef JJF_ZERO if (false && !numberThreads_ && !parentModel_) { printf("CbcTreeArray ? threads ? parentArray\n"); // Setup new style tree delete tree_; tree_ = new CbcTreeArray(); } #endif } tree_->setComparison(*nodeCompare_) ; /* Used to record the path from a node to the root of the search tree, so that we can then traverse from the root to the node when restoring a subproblem. */ maximumDepth_ = 10 ; delete [] walkback_ ; walkback_ = new CbcNodeInfo * [maximumDepth_] ; lastDepth_ = 0; delete [] lastNodeInfo_ ; lastNodeInfo_ = new CbcNodeInfo * [maximumDepth_] ; delete [] lastNumberCuts_ ; lastNumberCuts_ = new int [maximumDepth_] ; maximumCuts_ = 100; lastNumberCuts2_ = 0; delete [] lastCut_; lastCut_ = new const OsiRowCut * [maximumCuts_]; /* Used to generate bound edits for CbcPartialNodeInfo. */ double * lowerBefore = new double [numberColumns] ; double * upperBefore = new double [numberColumns] ; /* Set up to run heuristics and generate cuts at the root node. The heavy lifting is hidden inside the calls to doHeuristicsAtRoot and solveWithCuts. To start, tell cut generators they can be a bit more aggressive at the root node. QUESTION: phase_ = 0 is documented as `initial solve', phase = 1 as `solve with cuts at root'. Is phase_ = 1 the correct indication when doHeurisiticsAtRoot is called to run heuristics outside of the main cut / heurisitc / reoptimise loop in solveWithCuts? Generate cuts at the root node and reoptimise. solveWithCuts does the heavy lifting. It will iterate a generate/reoptimise loop (including reduced cost fixing) until no cuts are generated, the change in objective falls off, or the limit on the number of rounds of cut generation is exceeded. At the end of all this, any cuts will be recorded in cuts and also installed in the solver's constraint system. We'll have reoptimised, and removed any slack cuts (numberOldActiveCuts_ and numberNewCuts_ have been adjusted accordingly). Tell cut generators they can be a bit more aggressive at root node TODO: Why don't we make a copy of the solution after solveWithCuts? TODO: If numberUnsatisfied == 0, don't we have a solution? */ phase_ = 1; int iCutGenerator; for (iCutGenerator = 0; iCutGenerator < numberCutGenerators_; iCutGenerator++) { // If parallel switch off global cuts if (numberThreads_) { generator_[iCutGenerator]->setGlobalCuts(false); generator_[iCutGenerator]->setGlobalCutsAtRoot(false); } CglCutGenerator * generator = generator_[iCutGenerator]->generator(); generator->setAggressiveness(generator->getAggressiveness() + 100); if (!generator->canDoGlobalCuts()) generator->setGlobalCuts(false); } OsiCuts cuts ; int anyAction = -1 ; numberOldActiveCuts_ = 0 ; numberNewCuts_ = 0 ; // Array to mark solution delete [] usedInSolution_; usedInSolution_ = new int[numberColumns]; CoinZeroN(usedInSolution_, numberColumns); /* For printing totals and for CbcNode (numberNodes_) */ numberIterations_ = 0 ; numberNodes_ = 0 ; numberNodes2_ = 0 ; maximumStatistics_ = 0; maximumDepthActual_ = 0; numberDJFixed_ = 0.0; if (!parentModel_) { if ((specialOptions_&262144) != 0) { // create empty stored cuts //storedRowCuts_ = new CglStored(solver_->getNumCols()); } else if ((specialOptions_&524288) != 0 && storedRowCuts_) { // tighten and set best solution // A) tight bounds on integer variables /* storedRowCuts_ are coming in from outside, probably for nonlinear. John was unsure about origin. */ const double * lower = solver_->getColLower(); const double * upper = solver_->getColUpper(); const double * tightLower = storedRowCuts_->tightLower(); const double * tightUpper = storedRowCuts_->tightUpper(); int nTightened = 0; for (int i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable_[i]; if (tightLower[iColumn] > lower[iColumn]) { nTightened++; solver_->setColLower(iColumn, tightLower[iColumn]); } if (tightUpper[iColumn] < upper[iColumn]) { nTightened++; solver_->setColUpper(iColumn, tightUpper[iColumn]); } } if (nTightened) COIN_DETAIL_PRINT(printf("%d tightened by alternate cuts\n", nTightened)); if (storedRowCuts_->bestObjective() < bestObjective_) { // B) best solution double objValue = storedRowCuts_->bestObjective(); setBestSolution(CBC_SOLUTION, objValue, storedRowCuts_->bestSolution()) ; // Do heuristics // Allow RINS for (int i = 0; i < numberHeuristics_; i++) { CbcHeuristicRINS * rins = dynamic_cast (heuristic_[i]); if (rins) { rins->setLastNode(-100); } } } } } #ifdef SWITCH_VARIABLES // see if any switching variables if (numberIntegers_getNumCols()) findSwitching(); #endif /* Run heuristics at the root. This is the only opportunity to run FPump; it will be removed from the heuristics list by doHeuristicsAtRoot. */ // See if multiple runs wanted CbcModel ** rootModels=NULL; if (!parentModel_&&multipleRootTries_%100) { double rootTimeCpu=CoinCpuTime(); double startTimeRoot=CoinGetTimeOfDay(); int numberRootThreads=1; /* undocumented fine tuning aabbcc where cc is number of tries bb if nonzero is number of threads aa if nonzero just do heuristics */ int numberModels = multipleRootTries_%100; #ifdef CBC_THREAD numberRootThreads = (multipleRootTries_/100)%100; if (!numberRootThreads) numberRootThreads=numberModels; #endif int otherOptions = (multipleRootTries_/10000)%100; rootModels = new CbcModel * [numberModels]; unsigned int newSeed = randomSeed_; if (newSeed==0) { double time = fabs(CoinGetTimeOfDay()); while (time>=COIN_INT_MAX) time *= 0.5; newSeed = static_cast(time); } else if (newSeed<0) { newSeed = 123456789; #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { newSeed += clpSolver->getModelPtr()->randomNumberGenerator()->getSeed(); } #endif } CoinWarmStartBasis * basis = dynamic_cast (solver_->getEmptyWarmStart()); for (int i=0;isetNumberThreads(0); rootModels[i]->setMaximumNodes(otherOptions ? -1 : 0); rootModels[i]->setRandomSeed(newSeed+10000000*i); rootModels[i]->randomNumberGenerator()->setSeed(newSeed+50000000*i); rootModels[i]->setMultipleRootTries(0); // use seed rootModels[i]->setSpecialOptions(specialOptions_ |(4194304|8388608)); rootModels[i]->setMoreSpecialOptions(moreSpecialOptions_ & (~(134217728|4194304))); rootModels[i]->setMoreSpecialOptions2(moreSpecialOptions2_ & (~(128|256))); rootModels[i]->solver_->setWarmStart(basis); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (rootModels[i]->solver_); #define NEW_RANDOM_BASIS #ifdef NEW_RANDOM_BASIS if (i==0) continue; #endif if (clpSolver) { ClpSimplex * simplex = clpSolver->getModelPtr(); if (defaultHandler_) simplex->setDefaultMessageHandler(); simplex->setRandomSeed(newSeed+20000000*i); simplex->allSlackBasis(); int logLevel=simplex->logLevel(); if (logLevel==1) simplex->setLogLevel(0); if (i!=0) { #ifdef NEW_RANDOM_BASIS int numberRows = simplex->numberRows(); int throwOut=20;//2+numberRows/100; for (int iThrow=0;iThrowrandomNumberGenerator()->randomDouble(); int iStart=static_cast(random*numberRows); for (int j=iStart;jgetRowStatus(j)!=ClpSimplex::basic) { simplex->setRowStatus(j,ClpSimplex::basic); break; } } } clpSolver->setWarmStart(NULL); #else double random = simplex->randomNumberGenerator()->randomDouble(); int bias = static_cast(random*(numberIterations/4)); simplex->setMaximumIterations(numberIterations/2+bias); simplex->primal(); simplex->setMaximumIterations(COIN_INT_MAX); simplex->dual(); #endif } else { #ifndef NEW_RANDOM_BASIS simplex->primal(); #endif #endif } #ifdef NEW_RANDOM_BASIS simplex->setLogLevel(logLevel); clpSolver->setWarmStart(NULL); #endif } for (int j=0;jheuristic_[j]->setSeed(rootModels[i]->heuristic_[j]->getSeed()+100000000*i); for (int j=0;jgenerator_[j]->generator()->refreshSolver(rootModels[i]->solver_); } delete basis; #ifdef CBC_THREAD if (numberRootThreads==1) { #endif for (int iModel=0;iModelgetMaximumNodes()) { feasible=false; break; } } #ifdef CBC_THREAD } else { Coin_pthread_t * threadId = new Coin_pthread_t [numberRootThreads]; for (int kModel=0;kModelgetMaximumNodes()) finished=true; } if (finished) { feasible=false; break; } } delete [] threadId; } #endif // sort solutions int * which = new int [numberModels]; double * value = new double [numberModels]; int numberSolutions=0; for (int iModel=0;iModelbestSolution()) { which[numberSolutions]=iModel; value[numberSolutions++]= -rootModels[iModel]->getMinimizationObjValue(); } } char general[100]; rootTimeCpu=CoinCpuTime()-rootTimeCpu; if (numberRootThreads==1) sprintf(general,"Multiple root solvers took a total of %.2f seconds\n", rootTimeCpu); else sprintf(general,"Multiple root solvers took a total of %.2f seconds (%.2f elapsed)\n", rootTimeCpu,CoinGetTimeOfDay()-startTimeRoot); messageHandler()->message(CBC_GENERAL, messages()) << general << CoinMessageEol ; CoinSort_2(value,value+numberSolutions,which); // to get name CbcHeuristicRINS dummyHeuristic; dummyHeuristic.setHeuristicName("Multiple root solvers"); lastHeuristic_=&dummyHeuristic; for (int i=0;ibestSolution()); } } lastHeuristic_=NULL; delete [] which; delete [] value; } // Do heuristics if (numberObjects_&&!rootModels) doHeuristicsAtRoot(); if (solverCharacteristics_->solutionAddsCuts()) { // With some heuristics solver needs a resolve here solver_->resolve(); if(!isProvenOptimal()){ solver_->initialSolve(); } } /* Grepping through the code, it would appear that this is a command line debugging hook. There's no obvious place in the code where this is set to a negative value. User hook, says John. */ if ( intParam_[CbcMaxNumNode] < 0 ||numberSolutions_>=getMaximumSolutions()) eventHappened_ = true; // stop as fast as possible stoppedOnGap_ = false ; // See if can stop on gap bestPossibleObjective_ = solver_->getObjValue() * solver_->getObjSense(); if(canStopOnGap()) { if (bestPossibleObjective_ < getCutoff()) stoppedOnGap_ = true ; feasible = false; //eventHappened_=true; // stop as fast as possible } /* Set up for statistics collection, if requested. Standard values are documented in CbcModel.hpp. The magic number 100 will trigger a dump of CbcSimpleIntegerDynamicPseudoCost objects (no others). Looks like another command line debugging hook. */ statistics_ = NULL; // Do on switch if (doStatistics > 0 && doStatistics <= 100) { maximumStatistics_ = 10000; statistics_ = new CbcStatistics * [maximumStatistics_]; memset(statistics_, 0, maximumStatistics_*sizeof(CbcStatistics *)); } // See if we can add integers if (noObjects && numberIntegers_ < solver_->getNumCols() && (specialOptions_&65536) != 0 && !parentModel_) AddIntegers(); /* Do an initial round of cut generation for the root node. Depending on the type of underlying solver, we may want to do this even if the initial query to the objects indicates they're satisfied. solveWithCuts does the heavy lifting. It will iterate a generate/reoptimise loop (including reduced cost fixing) until no cuts are generated, the change in objective falls off, or the limit on the number of rounds of cut generation is exceeded. At the end of all this, any cuts will be recorded in cuts and also installed in the solver's constraint system. We'll have reoptimised, and removed any slack cuts (numberOldActiveCuts_ and numberNewCuts_ have been adjusted accordingly). */ int iObject ; int numberUnsatisfied = 0 ; delete [] currentSolution_; currentSolution_ = new double [numberColumns]; testSolution_ = currentSolution_; memcpy(currentSolution_, solver_->getColSolution(), numberColumns*sizeof(double)) ; // point to useful information OsiBranchingInformation usefulInfo = usefulInformation(); for (iObject = 0 ; iObject < numberObjects_ ; iObject++) { double infeasibility = object_[iObject]->checkInfeasibility(&usefulInfo) ; if (infeasibility ) numberUnsatisfied++ ; } // replace solverType double * tightBounds = NULL; if (solverCharacteristics_->tryCuts()) { if (numberUnsatisfied) { // User event if (!eventHappened_ && feasible) { if (rootModels) { // for fixings int numberColumns=solver_->getNumCols(); tightBounds = new double [2*numberColumns]; { const double * lower = solver_->getColLower(); const double * upper = solver_->getColUpper(); for (int i=0;igetNumRows(); int maxCuts=0; for (int i=0;isolver(); const double * lower = solvers[i]->getColLower(); const double * upper = solvers[i]->getColUpper(); for (int j=0;jgetNumRows(); assert (numberRows2>=numberRows); maxCuts += numberRows2-numberRows; // accumulate statistics for (int j=0;jaddStatistics(rootModels[i]->cutGenerator(j)); } } for (int j=0;jscaleBackStatistics(numberModels); } //CbcRowCuts rowCut(maxCuts); const OsiRowCutDebugger *debugger = NULL; if ((specialOptions_&1) != 0) debugger = solver_->getRowCutDebugger() ; for (int iModel=0;iModelgetNumRows(); const CoinPackedMatrix * rowCopy = solvers[iModel]->getMatrixByRow(); const int * rowLength = rowCopy->getVectorLengths(); const double * elements = rowCopy->getElements(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowLower = solvers[iModel]->getRowLower(); const double * rowUpper = solvers[iModel]->getRowUpper(); for (int iRow=numberRows;iRowinvalidCut(rc)); globalCuts_.addCutIfNotDuplicate(rc); } //int cutsAdded=globalCuts_.numberCuts()-numberCuts; //numberCuts += cutsAdded; //printf("Model %d gave %d cuts (out of %d possible)\n", // iModel,cutsAdded,numberRows2-numberRows); } // normally replace global cuts //if (!globalCuts_.()) //globalCuts_=rowCutrowCut.addCuts(globalCuts_); //rowCut.addCuts(globalCuts_); int nTightened=0; assert(feasible); { double tolerance=1.0e-5; const double * lower = solver_->getColLower(); const double * upper = solver_->getColUpper(); for (int i=0;itightBounds[2*i+1]+1.0e-9) { feasible=false; char general[200]; sprintf(general,"Solvers give infeasible bounds on %d %g,%g was %g,%g - search finished\n", i,tightBounds[2*i+0],tightBounds[2*i+1],lower[i],upper[i]); messageHandler()->message(CBC_GENERAL,messages()) << general << CoinMessageEol ; break; } double oldLower=lower[i]; double oldUpper=upper[i]; if (tightBounds[2*i+0]>oldLower+tolerance) { nTightened++; solver_->setColLower(i,tightBounds[2*i+0]); } if (tightBounds[2*i+1]setColUpper(i,tightBounds[2*i+1]); } } } delete [] tightBounds; tightBounds=NULL; char printBuffer[200]; sprintf(printBuffer,"%d solvers added %d different cuts out of pool of %d", numberModels,globalCuts_.sizeRowCuts(),maxCuts); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; if (nTightened) { sprintf(printBuffer,"%d bounds were tightened", nTightened); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; } delete [] solvers; } if (!parentModel_&&(moreSpecialOptions_&67108864) != 0) { // load cuts from file FILE * fp = fopen("global.cuts","rb"); if (fp) { size_t nRead; int numberColumns=solver_->getNumCols(); int numCols; nRead = fread(&numCols, sizeof(int), 1, fp); if (nRead != 1) throw("Error in fread"); if (numberColumns!=numCols) { printf("Mismatch on columns %d %d\n",numberColumns,numCols); fclose(fp); } else { // If rootModel just do some double threshold=-1.0; if (!multipleRootTries_) threshold=0.5; int initialCuts=0; int initialGlobal = globalCuts_.sizeRowCuts(); double * elements = new double [numberColumns+2]; int * indices = new int [numberColumns]; int numberEntries=1; while (numberEntries>0) { nRead = fread(&numberEntries, sizeof(int), 1, fp); if (nRead != 1) throw("Error in fread"); double randomNumber=randomNumberGenerator_.randomDouble(); if (numberEntries>0) { initialCuts++; nRead = fread(elements, sizeof(double), numberEntries+2, fp); if (nRead != static_cast(numberEntries+2)) throw("Error in fread"); nRead = fread(indices, sizeof(int), numberEntries, fp); if (nRead != static_cast(numberEntries)) throw("Error in fread"); if (randomNumber>threshold) { OsiRowCut rc; rc.setLb(elements[numberEntries]); rc.setUb(elements[numberEntries+1]); rc.setRow(numberEntries,indices,elements, false); rc.setGloballyValidAsInteger(2); globalCuts_.addCutIfNotDuplicate(rc) ; } } } fclose(fp); // fixes int nTightened=0; fp = fopen("global.fix","rb"); if (fp) { nRead = fread(indices, sizeof(int), 2, fp); if (nRead != 2) throw("Error in fread"); if (numberColumns!=indices[0]) { printf("Mismatch on columns %d %d\n",numberColumns, indices[0]); } else { indices[0]=1; while (indices[0]>=0) { nRead = fread(indices, sizeof(int), 2, fp); if (nRead != 2) throw("Error in fread"); int iColumn=indices[0]; if (iColumn>=0) { nTightened++; nRead = fread(elements, sizeof(double), 4, fp); if (nRead != 4) throw("Error in fread"); solver_->setColLower(iColumn,elements[0]); solver_->setColUpper(iColumn,elements[1]); } } } } if (fp) fclose(fp); char printBuffer[200]; sprintf(printBuffer,"%d cuts read in of which %d were unique, %d bounds tightened", initialCuts, globalCuts_.sizeRowCuts()-initialGlobal,nTightened); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; delete [] elements; delete [] indices; } } } if (feasible) feasible = solveWithCuts(cuts, maximumCutPassesAtRoot_, NULL); if (multipleRootTries_&& (moreSpecialOptions_&134217728)!=0) { FILE * fp=NULL; size_t nRead; int numberColumns=solver_->getNumCols(); int initialCuts=0; if ((moreSpecialOptions_&134217728)!=0) { // append so go down to end fp = fopen("global.cuts","r+b"); if (fp) { int numCols; nRead = fread(&numCols, sizeof(int), 1, fp); if (nRead != 1) throw("Error in fread"); if (numberColumns!=numCols) { printf("Mismatch on columns %d %d\n",numberColumns,numCols); fclose(fp); fp=NULL; } } } double * elements = new double [numberColumns+2]; int * indices = new int [numberColumns]; if (fp) { int numberEntries=1; while (numberEntries>0) { fpos_t position; fgetpos(fp, &position); nRead = fread(&numberEntries, sizeof(int), 1, fp); if (nRead != 1) throw("Error in fread"); if (numberEntries>0) { initialCuts++; nRead = fread(elements, sizeof(double), numberEntries+2, fp); if (nRead != static_cast(numberEntries+2)) throw("Error in fread"); nRead = fread(indices, sizeof(int), numberEntries, fp); if (nRead != static_cast(numberEntries)) throw("Error in fread"); } else { // end fsetpos(fp, &position); } } } else { fp = fopen("global.cuts","wb"); size_t nWrite; nWrite=fwrite(&numberColumns,sizeof(int),1,fp); if (nWrite != 1) throw("Error in fwrite"); } size_t nWrite; // now append binding cuts int numberC=continuousSolver_->getNumRows(); int numberRows=solver_->getNumRows(); printf("Saving %d cuts (up from %d)\n", initialCuts+numberRows-numberC,initialCuts); const double * rowLower = solver_->getRowLower(); const double * rowUpper = solver_->getRowUpper(); // Row copy CoinPackedMatrix matrixByRow(*solver_->getMatrixByRow()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); for (int iRow=numberC;iRow(n+2)) throw("Error in fwrite"); nWrite=fwrite(indices,sizeof(int),n,fp); if (nWrite != static_cast(n)) throw("Error in fwrite"); } // eof marker int eofMarker=-1; nWrite=fwrite(&eofMarker,sizeof(int),1,fp); if (nWrite != 1) throw("Error in fwrite"); fclose(fp); // do tighter bounds (? later extra to original columns) int nTightened=0; const double * lower = solver_->getColLower(); const double * upper = solver_->getColUpper(); const double * originalLower = continuousSolver_->getColLower(); const double * originalUpper = continuousSolver_->getColUpper(); double tolerance=1.0e-5; for (int i=0;ioriginalLower[i]+tolerance) { nTightened++; } if (upper[i]originalLower[i]+tolerance) { nTightened++; } if (upper[i]getColLower(); const double * upper = solver_->getColUpper(); const double * tightLower = storedRowCuts_->tightLower(); const double * tightUpper = storedRowCuts_->tightUpper(); int nTightened = 0; for (int i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable_[i]; if (tightLower[iColumn] > lower[iColumn]) { nTightened++; solver_->setColLower(iColumn, tightLower[iColumn]); } if (tightUpper[iColumn] < upper[iColumn]) { nTightened++; solver_->setColUpper(iColumn, tightUpper[iColumn]); } } if (nTightened) COIN_DETAIL_PRINT(printf("%d tightened by alternate cuts\n", nTightened)); if (storedRowCuts_->bestObjective() < bestObjective_) { // B) best solution double objValue = storedRowCuts_->bestObjective(); setBestSolution(CBC_SOLUTION, objValue, storedRowCuts_->bestSolution()) ; // Do heuristics // Allow RINS for (int i = 0; i < numberHeuristics_; i++) { CbcHeuristicRINS * rins = dynamic_cast (heuristic_[i]); if (rins) { rins->setLastNode(-100); } } doHeuristicsAtRoot(); } #ifdef JJF_ZERO int nCuts = storedRowCuts_->sizeRowCuts(); // add to global list for (int i = 0; i < nCuts; i++) { OsiRowCut newCut(*storedRowCuts_->rowCutPointer(i)); newCut.setGloballyValidAsInteger(2); newCut.mutableRow().setTestForDuplicateIndex(false); globalCuts_.insert(newCut) ; } #else addCutGenerator(storedRowCuts_, -99, "Stored from previous run", true, false, false, -200); #endif // Set cuts as active delete [] addedCuts_ ; maximumNumberCuts_ = cuts.sizeRowCuts(); if (maximumNumberCuts_) { addedCuts_ = new CbcCountRowCut * [maximumNumberCuts_]; } else { addedCuts_ = NULL; } for (int i = 0; i < maximumNumberCuts_; i++) addedCuts_[i] = new CbcCountRowCut(*cuts.rowCutPtr(i), NULL, -1, -1, 2); COIN_DETAIL_PRINT(printf("size %d\n", cuts.sizeRowCuts())); cuts = OsiCuts(); currentNumberCuts_ = maximumNumberCuts_; feasible = solveWithCuts(cuts, maximumCutPassesAtRoot_, NULL); for (int i = 0; i < maximumNumberCuts_; i++) delete addedCuts_[i]; } delete storedRowCuts_; storedRowCuts_ = NULL; } } else { feasible = false; } } else if (solverCharacteristics_->solutionAddsCuts() || solverCharacteristics_->alwaysTryCutsAtRootNode()) { // may generate cuts and turn the solution //to an infeasible one feasible = solveWithCuts(cuts, 2, NULL); } } if (rootModels) { int numberModels = multipleRootTries_%100; for (int i=0;imipFeasible()) feasible = false; // If max nodes==0 - don't do strong branching if (!getMaximumNodes()) { if (feasible) feasible=false; else setMaximumNodes(1); //allow to stop on success } topOfTree_=NULL; #ifdef CLP_RESOLVE if ((moreSpecialOptions_&2097152)!=0&&!parentModel_&&feasible) { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) resolveClp(clpSolver,0); } #endif // make cut generators less aggressive for (iCutGenerator = 0; iCutGenerator < numberCutGenerators_; iCutGenerator++) { CglCutGenerator * generator = generator_[iCutGenerator]->generator(); generator->setAggressiveness(generator->getAggressiveness() - 100); } currentNumberCuts_ = numberNewCuts_ ; if (solverCharacteristics_->solutionAddsCuts()) { // With some heuristics solver needs a resolve here (don't know if this is bug in heuristics) solver_->resolve(); if(!isProvenOptimal()){ solver_->initialSolve(); } } // See if can stop on gap bestPossibleObjective_ = solver_->getObjValue() * solver_->getObjSense(); if(canStopOnGap()) { if (bestPossibleObjective_ < getCutoff()) stoppedOnGap_ = true ; feasible = false; } // User event if (eventHappened_) feasible = false; #if defined(COIN_HAS_CLP)&&defined(COIN_HAS_CPX) /* This is the notion of using Cbc stuff to get going, then calling cplex to finish off. */ if (feasible && (specialOptions_&16384) != 0 && fastNodeDepth_ == -2 && !parentModel_) { // Use Cplex to do search! double time1 = CoinCpuTime(); OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); OsiCpxSolverInterface cpxSolver; double direction = clpSolver->getObjSense(); cpxSolver.setObjSense(direction); // load up cplex const CoinPackedMatrix * matrix = continuousSolver_->getMatrixByCol(); const double * rowLower = continuousSolver_->getRowLower(); const double * rowUpper = continuousSolver_->getRowUpper(); const double * columnLower = continuousSolver_->getColLower(); const double * columnUpper = continuousSolver_->getColUpper(); const double * objective = continuousSolver_->getObjCoefficients(); cpxSolver.loadProblem(*matrix, columnLower, columnUpper, objective, rowLower, rowUpper); double * setSol = new double [numberIntegers_]; int * setVar = new int [numberIntegers_]; // cplex doesn't know about objective offset double offset = clpSolver->getModelPtr()->objectiveOffset(); for (int i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable_[i]; cpxSolver.setInteger(iColumn); if (bestSolution_) { setSol[i] = bestSolution_[iColumn]; setVar[i] = iColumn; } } CPXENVptr env = cpxSolver.getEnvironmentPtr(); CPXLPptr lpPtr = cpxSolver.getLpPtr(OsiCpxSolverInterface::KEEPCACHED_ALL); cpxSolver.switchToMIP(); if (bestSolution_) { CPXcopymipstart(env, lpPtr, numberIntegers_, setVar, setSol); } if (clpSolver->getNumRows() > continuousSolver_->getNumRows() && false) { // add cuts const CoinPackedMatrix * matrix = clpSolver->getMatrixByRow(); const double * rhs = clpSolver->getRightHandSide(); const char * rowSense = clpSolver->getRowSense(); const double * elementByRow = matrix->getElements(); const int * column = matrix->getIndices(); const CoinBigIndex * rowStart = matrix->getVectorStarts(); const int * rowLength = matrix->getVectorLengths(); int nStart = continuousSolver_->getNumRows(); int nRows = clpSolver->getNumRows(); int size = rowStart[nRows-1] + rowLength[nRows-1] - rowStart[nStart]; int nAdd = 0; double * rmatval = new double [size]; int * rmatind = new int [size]; int * rmatbeg = new int [nRows-nStart+1]; size = 0; rmatbeg[0] = 0; for (int i = nStart; i < nRows; i++) { for (int k = rowStart[i]; k < rowStart[i] + rowLength[i]; k++) { rmatind[size] = column[k]; rmatval[size++] = elementByRow[k]; } nAdd++; rmatbeg[nAdd] = size; } CPXaddlazyconstraints(env, lpPtr, nAdd, size, rhs, rowSense, rmatbeg, rmatind, rmatval, NULL); CPXsetintparam( env, CPX_PARAM_REDUCE, // CPX_PREREDUCE_NOPRIMALORDUAL (0) CPX_PREREDUCE_PRIMALONLY); } if (getCutoff() < 1.0e50) { double useCutoff = getCutoff() + offset; if (bestObjective_ < 1.0e50) useCutoff = bestObjective_ + offset + 1.0e-7; cpxSolver.setDblParam(OsiDualObjectiveLimit, useCutoff* direction); if ( direction > 0.0 ) CPXsetdblparam( env, CPX_PARAM_CUTUP, useCutoff ) ; // min else CPXsetdblparam( env, CPX_PARAM_CUTLO, useCutoff ) ; // max } CPXsetdblparam(env, CPX_PARAM_EPGAP, dblParam_[CbcAllowableFractionGap]); delete [] setSol; delete [] setVar; char printBuffer[200]; if (offset) { sprintf(printBuffer, "Add %g to all Cplex messages for true objective", -offset); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; cpxSolver.setDblParam(OsiObjOffset, offset); } cpxSolver.branchAndBound(); double timeTaken = CoinCpuTime() - time1; sprintf(printBuffer, "Cplex took %g seconds", timeTaken); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; numberExtraNodes_ = CPXgetnodecnt(env, lpPtr); numberExtraIterations_ = CPXgetmipitcnt(env, lpPtr); double value = cpxSolver.getObjValue() * direction; if (cpxSolver.isProvenOptimal() && value <= getCutoff()) { feasible = true; clpSolver->setWarmStart(NULL); // try and do solution double * newSolution = CoinCopyOfArray(cpxSolver.getColSolution(), getNumCols()); setBestSolution(CBC_STRONGSOL, value, newSolution) ; delete [] newSolution; } feasible = false; } #endif if (!parentModel_&&(moreSpecialOptions_&268435456) != 0) { // try idiotic idea CbcObject * obj = new CbcIdiotBranch(this); obj->setPriority(1); // temp addObjects(1, &obj); delete obj; } /* A hook to use clp to quickly explore some part of the tree. */ if (fastNodeDepth_ == 1000 &&/*!parentModel_*/(specialOptions_&2048) == 0) { fastNodeDepth_ = -1; CbcObject * obj = new CbcFollowOn(this); obj->setPriority(1); addObjects(1, &obj); delete obj; } int saveNumberSolves = numberSolves_; int saveNumberIterations = numberIterations_; if ((fastNodeDepth_ >= 0||(moreSpecialOptions_&33554432)!=0) &&/*!parentModel_*/(specialOptions_&2048) == 0) { // add in a general depth object doClp int type = (fastNodeDepth_ <= 100) ? fastNodeDepth_ : -(fastNodeDepth_ - 100); if ((moreSpecialOptions_&33554432)!=0) type=12; else fastNodeDepth_ += 1000000; // mark as done CbcObject * obj = new CbcGeneralDepth(this, type); addObjects(1, &obj); delete obj; // fake number of objects numberObjects_--; if (parallelMode() < -1) { // But make sure position is correct OsiObject * obj2 = object_[numberObjects_]; obj = dynamic_cast (obj2); assert (obj); obj->setPosition(numberObjects_); } } #ifdef COIN_HAS_CLP #ifdef NO_CRUNCH if (true) { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver && !parentModel_) { ClpSimplex * clpSimplex = clpSolver->getModelPtr(); clpSimplex->setSpecialOptions(clpSimplex->specialOptions() | 131072); //clpSimplex->startPermanentArrays(); clpSimplex->setPersistenceFlag(2); } } #endif #endif // Save copy of solver OsiSolverInterface * saveSolver = NULL; if (!parentModel_ && (specialOptions_&(512 + 32768)) != 0) saveSolver = solver_->clone(); double checkCutoffForRestart = 1.0e100; saveModel(saveSolver, &checkCutoffForRestart, &feasible); if ((specialOptions_&262144) != 0 && !parentModel_) { // Save stuff and return! storedRowCuts_->saveStuff(bestObjective_, bestSolution_, solver_->getColLower(), solver_->getColUpper()); delete [] lowerBefore; delete [] upperBefore; delete saveSolver; if (flipObjective) flipModel(); return; } /* We've taken the continuous relaxation as far as we can. Time to branch. The first order of business is to actually create a node. chooseBranch currently uses strong branching to evaluate branch object candidates, unless forced back to simple branching. If chooseBranch concludes that a branching candidate is monotone (anyAction == -1) or infeasible (anyAction == -2) when forced to integer values, it returns here immediately. Monotone variables trigger a call to resolve(). If the problem remains feasible, try again to choose a branching variable. At the end of the loop, resolved == true indicates that some variables were fixed. Loss of feasibility will result in the deletion of newNode. */ bool resolved = false ; CbcNode *newNode = NULL ; numberFixedAtRoot_ = 0; numberFixedNow_ = 0; if (!parentModel_&&(moreSpecialOptions2_&2)!=0) { #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { if (getCutoff()>1.0e20) { printf("Zapping costs\n"); int numberColumns=solver_->getNumCols(); double * zeroCost = new double [numberColumns]; // could make small random memset(zeroCost,0,numberColumns*sizeof(double)); solver_->setObjective(zeroCost); double objValue = solver_->getObjValue(); solver_->setDblParam(OsiObjOffset,-objValue); clpSolver->getModelPtr()->setObjectiveValue(objValue); delete [] zeroCost; } else { moreSpecialOptions2_ &= ~2; } } else { #endif moreSpecialOptions2_ &= ~2; #ifdef COIN_HAS_CLP } #endif } int numberIterationsAtContinuous = numberIterations_; //solverCharacteristics_->setSolver(solver_); if (feasible) { // mark all cuts as globally valid int numberCuts=cuts.sizeRowCuts(); resizeWhichGenerator(0,numberCuts); for (int i=0;isetGloballyValid(); whichGenerator_[i]=20000+(whichGenerator_[i]%10000); } #define HOTSTART -1 #if HOTSTART<0 if (bestSolution_ && !parentModel_ && !hotstartSolution_ && (moreSpecialOptions_&1024) != 0) { // Set priorities so only branch on ones we need to // use djs and see if only few branches needed #ifndef NDEBUG double integerTolerance = getIntegerTolerance() ; #endif bool possible = true; const double * saveLower = continuousSolver_->getColLower(); const double * saveUpper = continuousSolver_->getColUpper(); for (int i = 0; i < numberObjects_; i++) { const CbcSimpleInteger * thisOne = dynamic_cast (object_[i]); if (thisOne) { int iColumn = thisOne->columnNumber(); if (saveUpper[iColumn] > saveLower[iColumn] + 1.5) { possible = false; break; } } else { possible = false; break; } } if (possible) { OsiSolverInterface * solver = continuousSolver_->clone(); int numberColumns = solver->getNumCols(); for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++) { double value = bestSolution_[iColumn] ; value = CoinMax(value, saveLower[iColumn]) ; value = CoinMin(value, saveUpper[iColumn]) ; value = floor(value + 0.5); if (solver->isInteger(iColumn)) { solver->setColLower(iColumn, value); solver->setColUpper(iColumn, value); } } solver->setHintParam(OsiDoDualInResolve, false, OsiHintTry); // objlim and all slack double direction = solver->getObjSense(); solver->setDblParam(OsiDualObjectiveLimit, 1.0e50*direction); CoinWarmStartBasis * basis = dynamic_cast (solver->getEmptyWarmStart()); solver->setWarmStart(basis); delete basis; bool changed = true; hotstartPriorities_ = new int [numberColumns]; for (int iColumn = 0; iColumn < numberColumns; iColumn++) hotstartPriorities_[iColumn] = 1; while (changed) { changed = false; solver->resolve(); if (!solver->isProvenOptimal()) { possible = false; break; } const double * dj = solver->getReducedCost(); const double * colLower = solver->getColLower(); const double * colUpper = solver->getColUpper(); const double * solution = solver->getColSolution(); int nAtLbNatural = 0; int nAtUbNatural = 0; int nZeroDj = 0; int nForced = 0; for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++) { double value = solution[iColumn] ; value = CoinMax(value, saveLower[iColumn]) ; value = CoinMin(value, saveUpper[iColumn]) ; if (solver->isInteger(iColumn)) { assert(fabs(value - solution[iColumn]) <= integerTolerance) ; if (hotstartPriorities_[iColumn] == 1) { if (dj[iColumn] < -1.0e-6) { // negative dj if (saveUpper[iColumn] == colUpper[iColumn]) { nAtUbNatural++; hotstartPriorities_[iColumn] = 2; solver->setColLower(iColumn, saveLower[iColumn]); solver->setColUpper(iColumn, saveUpper[iColumn]); } else { nForced++; } } else if (dj[iColumn] > 1.0e-6) { // positive dj if (saveLower[iColumn] == colLower[iColumn]) { nAtLbNatural++; hotstartPriorities_[iColumn] = 2; solver->setColLower(iColumn, saveLower[iColumn]); solver->setColUpper(iColumn, saveUpper[iColumn]); } else { nForced++; } } else { // zero dj nZeroDj++; } } } } #if CBC_USEFUL_PRINTING>1 printf("%d forced, %d naturally at lower, %d at upper - %d zero dj\n", nForced, nAtLbNatural, nAtUbNatural, nZeroDj); #endif if (nAtLbNatural || nAtUbNatural) { changed = true; } else { if (nForced + nZeroDj > 5000 || (nForced + nZeroDj)*2 > numberIntegers_) possible = false; } } delete solver; } if (possible) { setHotstartSolution(bestSolution_); if (!saveCompare) { // create depth first comparison saveCompare = nodeCompare_; // depth first nodeCompare_ = new CbcCompareDepth(); tree_->setComparison(*nodeCompare_) ; } } else { delete [] hotstartPriorities_; hotstartPriorities_ = NULL; } } #endif #if HOTSTART>0 if (hotstartSolution_ && !hotstartPriorities_) { // Set up hot start OsiSolverInterface * solver = solver_->clone(); double direction = solver_->getObjSense() ; int numberColumns = solver->getNumCols(); double * saveLower = CoinCopyOfArray(solver->getColLower(), numberColumns); double * saveUpper = CoinCopyOfArray(solver->getColUpper(), numberColumns); // move solution solver->setColSolution(hotstartSolution_); // point to useful information const double * saveSolution = testSolution_; testSolution_ = solver->getColSolution(); OsiBranchingInformation usefulInfo = usefulInformation(); testSolution_ = saveSolution; /* Run through the objects and use feasibleRegion() to set variable bounds so as to fix the variables specified in the objects at their value in this solution. Since the object list contains (at least) one object for every integer variable, this has the effect of fixing all integer variables. */ for (int i = 0; i < numberObjects_; i++) object_[i]->feasibleRegion(solver, &usefulInfo); solver->resolve(); assert (solver->isProvenOptimal()); double gap = CoinMax((solver->getObjValue() - solver_->getObjValue()) * direction, 0.0) ; const double * dj = solver->getReducedCost(); const double * colLower = solver->getColLower(); const double * colUpper = solver->getColUpper(); const double * solution = solver->getColSolution(); int nAtLbNatural = 0; int nAtUbNatural = 0; int nAtLbNaturalZero = 0; int nAtUbNaturalZero = 0; int nAtLbFixed = 0; int nAtUbFixed = 0; int nAtOther = 0; int nAtOtherNatural = 0; int nNotNeeded = 0; delete [] hotstartSolution_; hotstartSolution_ = new double [numberColumns]; delete [] hotstartPriorities_; hotstartPriorities_ = new int [numberColumns]; int * order = (int *) saveUpper; int nFix = 0; double bestRatio = COIN_DBL_MAX; for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++) { double value = solution[iColumn] ; value = CoinMax(value, saveLower[iColumn]) ; value = CoinMin(value, saveUpper[iColumn]) ; double sortValue = COIN_DBL_MAX; if (solver->isInteger(iColumn)) { assert(fabs(value - solution[iColumn]) <= 1.0e-5) ; double value2 = floor(value + 0.5); if (dj[iColumn] < -1.0e-6) { // negative dj //assert (value2==colUpper[iColumn]); if (saveUpper[iColumn] == colUpper[iColumn]) { nAtUbNatural++; sortValue = 0.0; double value = -dj[iColumn]; if (value > gap) nFix++; else if (gap < value*bestRatio) bestRatio = gap / value; if (saveLower[iColumn] != colLower[iColumn]) { nNotNeeded++; sortValue = 1.0e20; } } else if (saveLower[iColumn] == colUpper[iColumn]) { nAtLbFixed++; sortValue = dj[iColumn]; } else { nAtOther++; sortValue = 0.0; if (saveLower[iColumn] != colLower[iColumn] && saveUpper[iColumn] != colUpper[iColumn]) { nNotNeeded++; sortValue = 1.0e20; } } } else if (dj[iColumn] > 1.0e-6) { // positive dj //assert (value2==colLower[iColumn]); if (saveLower[iColumn] == colLower[iColumn]) { nAtLbNatural++; sortValue = 0.0; double value = dj[iColumn]; if (value > gap) nFix++; else if (gap < value*bestRatio) bestRatio = gap / value; if (saveUpper[iColumn] != colUpper[iColumn]) { nNotNeeded++; sortValue = 1.0e20; } } else if (saveUpper[iColumn] == colLower[iColumn]) { nAtUbFixed++; sortValue = -dj[iColumn]; } else { nAtOther++; sortValue = 0.0; if (saveLower[iColumn] != colLower[iColumn] && saveUpper[iColumn] != colUpper[iColumn]) { nNotNeeded++; sortValue = 1.0e20; } } } else { // zero dj if (value2 == saveUpper[iColumn]) { nAtUbNaturalZero++; sortValue = 0.0; if (saveLower[iColumn] != colLower[iColumn]) { nNotNeeded++; sortValue = 1.0e20; } } else if (value2 == saveLower[iColumn]) { nAtLbNaturalZero++; sortValue = 0.0; } else { nAtOtherNatural++; sortValue = 0.0; if (saveLower[iColumn] != colLower[iColumn] && saveUpper[iColumn] != colUpper[iColumn]) { nNotNeeded++; sortValue = 1.0e20; } } } #if HOTSTART==3 sortValue = -fabs(dj[iColumn]); #endif } hotstartSolution_[iColumn] = value ; saveLower[iColumn] = sortValue; order[iColumn] = iColumn; } COIN_DETAIL_PRINT(printf("** can fix %d columns - best ratio for others is %g on gap of %g\n", nFix, bestRatio, gap)); int nNeg = 0; CoinSort_2(saveLower, saveLower + numberColumns, order); for (int i = 0; i < numberColumns; i++) { if (saveLower[i] < 0.0) { nNeg++; #if HOTSTART==2||HOTSTART==3 // swap sign ? saveLower[i] = -saveLower[i]; #endif } } CoinSort_2(saveLower, saveLower + nNeg, order); for (int i = 0; i < numberColumns; i++) { #if HOTSTART==1 hotstartPriorities_[order[i]] = 100; #else hotstartPriorities_[order[i]] = -(i + 1); #endif } COIN_DETAIL_PRINT(printf("nAtLbNat %d,nAtUbNat %d,nAtLbNatZero %d,nAtUbNatZero %d,nAtLbFixed %d,nAtUbFixed %d,nAtOther %d,nAtOtherNat %d, useless %d %d\n", nAtLbNatural, nAtUbNatural, nAtLbNaturalZero, nAtUbNaturalZero, nAtLbFixed, nAtUbFixed, nAtOther, nAtOtherNatural, nNotNeeded, nNeg)); delete [] saveLower; delete [] saveUpper; if (!saveCompare) { // create depth first comparison saveCompare = nodeCompare_; // depth first nodeCompare_ = new CbcCompareDepth(); tree_->setComparison(*nodeCompare_) ; } } #endif newNode = new CbcNode ; // Set objective value (not so obvious if NLP etc) setObjectiveValue(newNode, NULL); anyAction = -1 ; // To make depth available we may need a fake node CbcNode fakeNode; if (!currentNode_) { // Not true if sub trees assert (!numberNodes_); currentNode_ = &fakeNode; } phase_ = 3; // only allow 1000 passes int numberPassesLeft = 1000; // This is first crude step if (numberAnalyzeIterations_ && !parentModel_) { delete [] analyzeResults_; //int numberColumns = solver_->getNumCols(); analyzeResults_ = new double [5*numberIntegers_]; numberFixedAtRoot_ = newNode->analyze(this, analyzeResults_); if (numberFixedAtRoot_ > 0) { COIN_DETAIL_PRINT(printf("%d fixed by analysis\n", numberFixedAtRoot_)); setPointers(solver_); numberFixedNow_ = numberFixedAtRoot_; } else if (numberFixedAtRoot_ < 0) { COIN_DETAIL_PRINT(printf("analysis found to be infeasible\n")); anyAction = -2; delete newNode ; newNode = NULL ; feasible = false ; } } OsiSolverBranch * branches = NULL; if (feasible) anyAction = chooseBranch(newNode, numberPassesLeft, NULL, cuts, resolved, NULL, NULL, NULL, branches); if (anyAction == -2 || newNode->objectiveValue() >= cutoff) { if (anyAction != -2) { // zap parent nodeInfo #ifdef COIN_DEVELOP printf("zapping CbcNodeInfo %x\n", newNode->nodeInfo()->parent()); #endif if (newNode->nodeInfo()) newNode->nodeInfo()->nullParent(); } delete newNode ; newNode = NULL ; feasible = false ; } } if (newNode && probingInfo_) { int number01 = probingInfo_->numberIntegers(); //const fixEntry * entry = probingInfo_->fixEntries(); const int * toZero = probingInfo_->toZero(); //const int * toOne = probingInfo_->toOne(); //const int * integerVariable = probingInfo_->integerVariable(); if (toZero[number01]) { CglTreeProbingInfo info(*probingInfo_); if ((moreSpecialOptions2_&64)!=0&&!parentModel_) { /* Marginal idea. Further exploration probably good. Build some extra cliques from probing info. Not quite worth the effort? */ CglProbing generator1; generator1.setUsingObjective(false); generator1.setMaxPass(1); generator1.setMaxPassRoot(1); generator1.setMaxLook(100); generator1.setRowCuts(3); generator1.setMaxElements(300); generator1.setMaxProbeRoot(solver_->getNumCols()); CoinThreadRandom randomGenerator; //CglTreeProbingInfo info(solver_); info.level = 0; info.formulation_rows = solver_->getNumRows(); info.inTree = false; info.randomNumberGenerator=&randomGenerator; info.pass=4; generator1.setMode(8); OsiCuts cs; generator1.generateCutsAndModify(*solver_,cs,&info); // very clunky OsiSolverInterface * temp = generator1.cliqueModel(solver_,2); CglPreProcess dummy; OsiSolverInterface * newSolver=dummy.cliqueIt(*temp,0.0001); delete temp; OsiSolverInterface * fake = NULL; if (newSolver) { #if 0 int numberCliques = generator1.numberCliques(); cliqueEntry * entry = generator1.cliqueEntry(); cliqueType * type = new cliqueType [numberCliques]; int * start = new int [numberCliques+1]; start[numberCliques]=2*numberCliques; int n=0; for (int i=0;iwriteMps("fake"); CglFakeClique cliqueGen(fake); cliqueGen.setStarCliqueReport(false); cliqueGen.setRowCliqueReport(false); cliqueGen.setMinViolation(0.1); addCutGenerator(&cliqueGen, 1, "Fake cliques", true, false, false, -200); generator_[numberCutGenerators_-1]->setTiming(true); for (int i = 0; i < numberCutGenerators_; i++) { CglKnapsackCover * cutGen = dynamic_cast(generator_[i]->generator()); if (cutGen) { cutGen->createCliques(*fake,2,200,false); } } } } if (probingInfo_->packDown()) { #if CBC_USEFUL_PRINTING>1 printf("%d implications on %d 0-1\n", toZero[number01], number01); #endif // Create a cut generator that remembers implications discovered at root. CglImplication implication(probingInfo_); addCutGenerator(&implication, 1, "ImplicationCuts", true, false, false, -200); generator_[numberCutGenerators_-1]->setGlobalCuts(true); generator_[numberCutGenerators_-1]->setTiming(true); } else { delete probingInfo_; probingInfo_ = NULL; } } else { delete probingInfo_; probingInfo_ = NULL; } } /* At this point, the root subproblem is infeasible or fathomed by bound (newNode == NULL), or we're live with an objective value that satisfies the current objective cutoff. */ assert (!newNode || newNode->objectiveValue() <= cutoff) ; // Save address of root node as we don't want to delete it /* The common case is that the lp relaxation is feasible but doesn't satisfy integrality (i.e., newNode->branchingObject(), indicating we've been able to select a branching variable). Remove any cuts that have gone slack due to forcing monotone variables. Then tack on an CbcFullNodeInfo object and full basis (via createInfo()) and stash the new cuts in the nodeInfo (via addCuts()). If, by some miracle, we have an integral solution at the root (newNode->branchingObject() is NULL), takeOffCuts() will ensure that the solver holds a valid solution for use by setBestSolution(). */ CoinWarmStartBasis *lastws = NULL ; if (feasible && newNode->branchingObject()) { if (resolved) { takeOffCuts(cuts, false, NULL) ; # ifdef CHECK_CUT_COUNTS { printf("Number of rows after chooseBranch fix (root)" "(active only) %d\n", numberRowsAtContinuous_ + numberNewCuts_ + numberOldActiveCuts_) ; const CoinWarmStartBasis* debugws = dynamic_cast (solver_->getWarmStart()) ; debugws->print() ; delete debugws ; } # endif } //newNode->createInfo(this,NULL,NULL,NULL,NULL,0,0) ; //newNode->nodeInfo()->addCuts(cuts, // newNode->numberBranches(),whichGenerator_) ; if (lastws) delete lastws ; lastws = dynamic_cast(solver_->getWarmStart()) ; } /* Continuous data to be used later */ continuousObjective_ = solver_->getObjValue() * solver_->getObjSense(); continuousInfeasibilities_ = 0 ; if (newNode) { continuousObjective_ = newNode->objectiveValue() ; delete [] continuousSolution_; continuousSolution_ = CoinCopyOfArray(solver_->getColSolution(), numberColumns); continuousInfeasibilities_ = newNode->numberUnsatisfied() ; } /* Bound may have changed so reset in objects */ { int i ; for (i = 0; i < numberObjects_; i++) object_[i]->resetBounds(solver_) ; } /* Feasible? Then we should have either a live node prepped for future expansion (indicated by variable() >= 0), or (miracle of miracles) an integral solution at the root node. initializeInfo sets the reference counts in the nodeInfo object. Since this node is still live, push it onto the heap that holds the live set. */ if (newNode) { if (newNode->branchingObject()) { newNode->initializeInfo() ; tree_->push(newNode) ; // save pointer to root node - so can pick up bounds if (!topOfTree_) topOfTree_ = dynamic_cast(newNode->nodeInfo()) ; if (statistics_) { if (numberNodes2_ == maximumStatistics_) { maximumStatistics_ = 2 * maximumStatistics_; CbcStatistics ** temp = new CbcStatistics * [maximumStatistics_]; memset(temp, 0, maximumStatistics_*sizeof(CbcStatistics *)); memcpy(temp, statistics_, numberNodes2_*sizeof(CbcStatistics *)); delete [] statistics_; statistics_ = temp; } assert (!statistics_[numberNodes2_]); statistics_[numberNodes2_] = new CbcStatistics(newNode, this); } numberNodes2_++; # ifdef CHECK_NODE printf("Node %x on tree\n", newNode) ; # endif } else { // continuous is integer double objectiveValue = newNode->objectiveValue(); setBestSolution(CBC_SOLUTION, objectiveValue, solver_->getColSolution()) ; if (eventHandler) { // we are stopping anyway so no need to test return code eventHandler->event(CbcEventHandler::solution); } delete newNode ; newNode = NULL ; } } if (printFrequency_ <= 0) { printFrequency_ = 1000 ; if (getNumCols() > 2000) printFrequency_ = 100 ; } /* It is possible that strong branching fixes one variable and then the code goes round again and again. This can take too long. So we need to warn user - just once. */ numberLongStrong_ = 0; CbcNode * createdNode = NULL; #ifdef CBC_THREAD if ((specialOptions_&2048) != 0) numberThreads_ = 0; if (numberThreads_ ) { nodeCompare_->sayThreaded(); // need to use addresses master_ = new CbcBaseModel(*this, (parallelMode() < -1) ? 1 : 0); masterThread_ = master_->masterThread(); } #endif #ifdef COIN_HAS_CLP { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver && !parentModel_) { clpSolver->computeLargestAway(); } } #endif /* At last, the actual branch-and-cut search loop, which will iterate until the live set is empty or we hit some limit (integrality gap, time, node count, etc.). The overall flow is to rebuild a subproblem, reoptimise using solveWithCuts(), choose a branching pattern with chooseBranch(), and finally add the node to the live set. The first action is to winnow the live set to remove nodes which are worse than the current objective cutoff. */ if (solver_->getRowCutDebuggerAlways()) { OsiRowCutDebugger * debuggerX = const_cast (solver_->getRowCutDebuggerAlways()); const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (!debugger) { // infeasible!! printf("before search\n"); const double * lower = solver_->getColLower(); const double * upper = solver_->getColUpper(); const double * solution = debuggerX->optimalSolution(); int numberColumns = solver_->getNumCols(); for (int i = 0; i < numberColumns; i++) { if (solver_->isInteger(i)) { if (solution[i] < lower[i] - 1.0e-6 || solution[i] > upper[i] + 1.0e-6) printf("**** "); printf("%d %g <= %g <= %g\n", i, lower[i], solution[i], upper[i]); } } //abort(); } } { // may be able to change cutoff now double cutoff = getCutoff(); double increment = getDblParam(CbcModel::CbcCutoffIncrement) ; if (cutoff > bestObjective_ - increment) { cutoff = bestObjective_ - increment ; setCutoff(cutoff) ; } } #ifdef CBC_THREAD bool goneParallel = false; #endif #define MAX_DEL_NODE 1 CbcNode * delNode[MAX_DEL_NODE+1]; int nDeleteNode = 0; // For Printing etc when parallel int lastEvery1000 = 0; int lastPrintEvery = 0; int numberConsecutiveInfeasible = 0; #define PERTURB_IN_FATHOM #ifdef PERTURB_IN_FATHOM // allow in fathom if ((moreSpecialOptions_& 262144) != 0) specialOptions_ |= 131072; #endif while (true) { lockThread(); #ifdef COIN_HAS_CLP // See if we want dantzig row choice goToDantzig(100, savePivotMethod); #endif if (tree_->empty()) { #ifdef CBC_THREAD if (parallelMode() > 0 && master_) { int anyLeft = master_->waitForThreadsInTree(0); if (!anyLeft) { master_->stopThreads(-1); break; } } else { break; } #else break; #endif } else { unlockThread(); } // If done 50/100 nodes see if worth trying reduction if (numberNodes_ >= nextCheckRestart) { if (nextCheckRestart<100) nextCheckRestart=100; else nextCheckRestart=COIN_INT_MAX; #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver && ((specialOptions_&131072) == 0) && true) { ClpSimplex * simplex = clpSolver->getModelPtr(); int perturbation = simplex->perturbation(); #if CBC_USEFUL_PRINTING>1 printf("Testing its n,s %d %d solves n,s %d %d - pert %d\n", numberIterations_, saveNumberIterations, numberSolves_, saveNumberSolves, perturbation); #endif if (perturbation == 50 && (numberIterations_ - saveNumberIterations) < 8*(numberSolves_ - saveNumberSolves)) { // switch off perturbation simplex->setPerturbation(100); #if CBC_USEFUL_PRINTING>1 printf("Perturbation switched off\n"); #endif } } #endif /* Decide if we want to do a restart. */ if (saveSolver && (specialOptions_&(512 + 32768)) != 0) { bool tryNewSearch = solverCharacteristics_->reducedCostsAccurate() && (getCutoff() < 1.0e20 && getCutoff() < checkCutoffForRestart); int numberColumns = getNumCols(); if (tryNewSearch) { // adding increment back allows current best - tiny bit weaker checkCutoffForRestart = getCutoff() + getCutoffIncrement() ; #if CBC_USEFUL_PRINTING>1 printf("after %d nodes, cutoff %g - looking\n", numberNodes_, getCutoff()); #endif saveSolver->resolve(); double direction = saveSolver->getObjSense() ; double gap = checkCutoffForRestart - saveSolver->getObjValue() * direction ; double tolerance; saveSolver->getDblParam(OsiDualTolerance, tolerance) ; if (gap <= 0.0) gap = tolerance; gap += 100.0 * tolerance; double integerTolerance = getDblParam(CbcIntegerTolerance) ; const double *lower = saveSolver->getColLower() ; const double *upper = saveSolver->getColUpper() ; const double *solution = saveSolver->getColSolution() ; const double *reducedCost = saveSolver->getReducedCost() ; int numberFixed = 0 ; int numberFixed2 = 0; #ifdef COIN_DEVELOP printf("gap %g\n", gap); #endif for (int i = 0 ; i < numberIntegers_ ; i++) { int iColumn = integerVariable_[i] ; double djValue = direction * reducedCost[iColumn] ; if (upper[iColumn] - lower[iColumn] > integerTolerance) { if (solution[iColumn] < lower[iColumn] + integerTolerance && djValue > gap) { //printf("%d to lb on dj of %g - bounds %g %g\n", // iColumn,djValue,lower[iColumn],upper[iColumn]); saveSolver->setColUpper(iColumn, lower[iColumn]) ; numberFixed++ ; } else if (solution[iColumn] > upper[iColumn] - integerTolerance && -djValue > gap) { //printf("%d to ub on dj of %g - bounds %g %g\n", // iColumn,djValue,lower[iColumn],upper[iColumn]); saveSolver->setColLower(iColumn, upper[iColumn]) ; numberFixed++ ; } } else { //printf("%d has dj of %g - already fixed to %g\n", // iColumn,djValue,lower[iColumn]); numberFixed2++; } } #ifdef COIN_DEVELOP if ((specialOptions_&1) != 0) { const OsiRowCutDebugger *debugger = saveSolver->getRowCutDebugger() ; if (debugger) { printf("Contains optimal\n") ; OsiSolverInterface * temp = saveSolver->clone(); const double * solution = debugger->optimalSolution(); const double *lower = temp->getColLower() ; const double *upper = temp->getColUpper() ; int n = temp->getNumCols(); for (int i = 0; i < n; i++) { if (temp->isInteger(i)) { double value = floor(solution[i] + 0.5); assert (value >= lower[i] && value <= upper[i]); temp->setColLower(i, value); temp->setColUpper(i, value); } } temp->writeMps("reduced_fix"); delete temp; saveSolver->writeMps("reduced"); } else { abort(); } } printf("Restart could fix %d integers (%d already fixed)\n", numberFixed + numberFixed2, numberFixed2); #endif numberFixed += numberFixed2; if (numberFixed*10 < numberColumns && numberFixed*4 < numberIntegers_) tryNewSearch = false; } #ifdef CONFLICT_CUTS // temporary if ((moreSpecialOptions_&4194304)!=0) tryNewSearch=false; #endif if (tryNewSearch) { // back to solver without cuts? OsiSolverInterface * solver2 = saveSolver->clone(); const double *lower = saveSolver->getColLower() ; const double *upper = saveSolver->getColUpper() ; for (int i = 0 ; i < numberIntegers_ ; i++) { int iColumn = integerVariable_[i] ; solver2->setColLower(iColumn, lower[iColumn]); solver2->setColUpper(iColumn, upper[iColumn]); } // swap delete saveSolver; saveSolver = solver2; double * newSolution = new double[numberColumns]; double objectiveValue = checkCutoffForRestart; // Save the best solution so far. CbcSerendipity heuristic(*this); if (bestSolution_) heuristic.setInputSolution(bestSolution_, bestObjective_); // Magic number heuristic.setFractionSmall(0.8); // `pumpTune' to stand-alone solver for explanations. heuristic.setFeasibilityPumpOptions(1008013); // Use numberNodes to say how many are original rows heuristic.setNumberNodes(continuousSolver_->getNumRows()); #ifdef COIN_DEVELOP if (continuousSolver_->getNumRows() < solver_->getNumRows()) printf("%d rows added ZZZZZ\n", solver_->getNumRows() - continuousSolver_->getNumRows()); #endif int returnCode = heuristic.smallBranchAndBound(saveSolver, -1, newSolution, objectiveValue, checkCutoffForRestart, "Reduce"); if (returnCode < 0) { #ifdef COIN_DEVELOP printf("Restart - not small enough to do search after fixing\n"); #endif delete [] newSolution; } else { // 1 for sol'n, 2 for finished, 3 for both if ((returnCode&1) != 0) { // increment number of solutions so other heuristics can test numberSolutions_++; numberHeuristicSolutions_++; lastHeuristic_ = NULL; setBestSolution(CBC_ROUNDING, objectiveValue, newSolution) ; } delete [] newSolution; #ifdef CBC_THREAD if (master_) { lockThread(); if (parallelMode() > 0) { while (master_->waitForThreadsInTree(0)) { lockThread(); double dummyBest; tree_->cleanTree(this, -COIN_DBL_MAX, dummyBest) ; //unlockThread(); } } else { double dummyBest; tree_->cleanTree(this, -COIN_DBL_MAX, dummyBest) ; } master_->waitForThreadsInTree(2); delete master_; master_ = NULL; masterThread_ = NULL; } #endif if (tree_->size()) { double dummyBest; tree_->cleanTree(this, -COIN_DBL_MAX, dummyBest) ; } break; } } delete saveSolver; saveSolver = NULL; } } /* Check for abort on limits: node count, solution count, time, integrality gap. */ if (!(numberNodes_ < intParam_[CbcMaxNumNode] && numberSolutions_ < intParam_[CbcMaxNumSol] && !maximumSecondsReached() && !stoppedOnGap_ && !eventHappened_ && (maximumNumberIterations_ < 0 || numberIterations_ < maximumNumberIterations_))) { // out of loop break; } #ifdef BONMIN assert(!solverCharacteristics_->solutionAddsCuts() || solverCharacteristics_->mipFeasible()); #endif // Sets percentage of time when we try diving. Diving requires a bit of heap reorganisation, because // we need to replace the comparison function to dive, and that requires reordering to retain the // heap property. #define DIVE_WHEN 1000 #define DIVE_STOP 2000 int kNode = numberNodes_ % 4000; if (numberNodes_<100000 && kNode>DIVE_WHEN && kNode <= DIVE_STOP) { if (!parallelMode()) { if (kNode == DIVE_WHEN + 1 || numberConsecutiveInfeasible > 1) { CbcCompareDefault * compare = dynamic_cast (nodeCompare_); // Don't interfere if user has replaced the compare function. if (compare) { //printf("Redoing tree\n"); compare->startDive(this); numberConsecutiveInfeasible = 0; } } } } // replace current cutoff? if (cutoff > getCutoff()) { double newCutoff = getCutoff(); if (analyzeResults_) { // see if we could fix any (more) int n = 0; double * newLower = analyzeResults_; double * objLower = newLower + numberIntegers_; double * newUpper = objLower + numberIntegers_; double * objUpper = newUpper + numberIntegers_; for (int i = 0; i < numberIntegers_; i++) { if (objLower[i] > newCutoff) { n++; if (objUpper[i] > newCutoff) { newCutoff = -COIN_DBL_MAX; break; } // add as global cut objLower[i]=-COIN_DBL_MAX; OsiRowCut rc; rc.setLb(newLower[i]); rc.setUb(COIN_DBL_MAX); double one=1.0; rc.setRow(1,integerVariable_+i,&one,false); rc.setGloballyValidAsInteger(2); globalCuts_.addCutIfNotDuplicate(rc) ; } else if (objUpper[i] > newCutoff) { n++; // add as global cut objUpper[i]=-COIN_DBL_MAX; OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb(newUpper[i]); double one=1.0; rc.setRow(1,integerVariable_+i,&one,false); rc.setGloballyValidAsInteger(2); globalCuts_.addCutIfNotDuplicate(rc) ; } } if (newCutoff == -COIN_DBL_MAX) { COIN_DETAIL_PRINT(printf("Root analysis says finished\n")); } else if (n > numberFixedNow_) { COIN_DETAIL_PRINT(printf("%d more fixed by analysis - now %d\n", n - numberFixedNow_, n)); numberFixedNow_ = n; } } if (eventHandler) { if (!eventHandler->event(CbcEventHandler::solution)) { eventHappened_ = true; // exit } newCutoff = getCutoff(); } lockThread(); /* Clean the tree to reflect the new solution, then see if the node comparison predicate wants to make any changes. If so, call setComparison for the side effect of rebuilding the heap. */ tree_->cleanTree(this,newCutoff,bestPossibleObjective_) ; if (nodeCompare_->newSolution(this) || nodeCompare_->newSolution(this,continuousObjective_, continuousInfeasibilities_)) { tree_->setComparison(*nodeCompare_) ; } if (tree_->empty()) { continue; } unlockThread(); } cutoff = getCutoff() ; /* Periodic activities: Opportunities to + tweak the nodeCompare criteria, + check if we've closed the integrality gap enough to quit, + print a summary line to let the user know we're working */ if (numberNodes_ >= lastEvery1000) { lockThread(); #ifdef COIN_HAS_CLP // See if we want dantzig row choice goToDantzig(1000, savePivotMethod); #endif lastEvery1000 = numberNodes_ + 1000; bool redoTree = nodeCompare_->every1000Nodes(this, numberNodes_) ; #ifdef CHECK_CUT_SIZE verifyCutSize (tree_, *this); #endif // redo tree if requested if (redoTree) tree_->setComparison(*nodeCompare_) ; unlockThread(); } // Had hotstart before, now switched off if (saveCompare && !hotstartSolution_) { // hotstart switched off delete nodeCompare_; // off depth first nodeCompare_ = saveCompare; saveCompare = NULL; // redo tree lockThread(); tree_->setComparison(*nodeCompare_) ; unlockThread(); } if (numberNodes_ >= lastPrintEvery) { lastPrintEvery = numberNodes_ + printFrequency_; lockThread(); int nNodes = tree_->size() ; //MODIF PIERRE bestPossibleObjective_ = tree_->getBestPossibleObjective(); #ifdef CBC_THREAD if (parallelMode() > 0 && master_) { // need to adjust for ones not on tree int numberThreads = master_->numberThreads(); for (int i=0;ichild(i); if (child->node()) { // adjust double value = child->node()->objectiveValue(); bestPossibleObjective_ = CoinMin(bestPossibleObjective_, value); } } } #endif unlockThread(); #if CBC_USEFUL_PRINTING>1 if (getCutoff() < 1.0e20) { if (fabs(getCutoff() - (bestObjective_ - getCutoffIncrement())) > 1.0e-6 && !parentModel_) printf("model cutoff in status %g, best %g, increment %g\n", getCutoff(), bestObjective_, getCutoffIncrement()); assert (getCutoff() < bestObjective_ - getCutoffIncrement() + 1.0e-6 + 1.0e-10*fabs(bestObjective_)); } #endif if (!intParam_[CbcPrinting]) { // Parallel may not have any nodes if (!nNodes) bestPossibleObjective_ = lastBestPossibleObjective; else lastBestPossibleObjective = bestPossibleObjective_; messageHandler()->message(CBC_STATUS, messages()) << numberNodes_ << CoinMax(nNodes,1) << bestObjective_ << bestPossibleObjective_ << getCurrentSeconds() << CoinMessageEol ; } else if (intParam_[CbcPrinting] == 1) { messageHandler()->message(CBC_STATUS2, messages()) << numberNodes_ << nNodes << bestObjective_ << bestPossibleObjective_ << tree_->lastDepth() << tree_->lastUnsatisfied() << tree_->lastObjective() << numberIterations_ << getCurrentSeconds() << CoinMessageEol ; } else if (!numberExtraIterations_) { messageHandler()->message(CBC_STATUS2, messages()) << numberNodes_ << nNodes << bestObjective_ << bestPossibleObjective_ << tree_->lastDepth() << tree_->lastUnsatisfied() << numberIterations_ << getCurrentSeconds() << CoinMessageEol ; } else { messageHandler()->message(CBC_STATUS3, messages()) << numberNodes_ << numberFathoms_ << numberExtraNodes_ << nNodes << bestObjective_ << bestPossibleObjective_ << tree_->lastDepth() << tree_->lastUnsatisfied() << numberIterations_ << numberExtraIterations_ << getCurrentSeconds() << CoinMessageEol ; } #ifdef COIN_HAS_NTY if (symmetryInfo_) symmetryInfo_->statsOrbits(this,1); #endif #if PRINT_CONFLICT==1 if (numberConflictCuts>lastNumberConflictCuts) { double length = lengthConflictCuts/numberConflictCuts; printf("%d new conflict cuts - total %d - average length %g\n", numberConflictCuts-lastNumberConflictCuts, numberConflictCuts,length); lastNumberConflictCuts = numberConflictCuts; } #endif if (eventHandler && !eventHandler->event(CbcEventHandler::treeStatus)) { eventHappened_ = true; // exit } } // See if can stop on gap if(canStopOnGap()) { stoppedOnGap_ = true ; } #ifdef CHECK_NODE_FULL verifyTreeNodes(tree_, *this) ; # endif # ifdef CHECK_CUT_COUNTS verifyCutCounts(tree_, *this) ; # endif /* Now we come to the meat of the loop. To create the active subproblem, we'll pop the most promising node in the live set, rebuild the subproblem it represents, and then execute the current arm of the branch to create the active subproblem. */ CbcNode * node = NULL; #ifdef CBC_THREAD if (!parallelMode() || parallelMode() == -1) { #endif node = tree_->bestNode(cutoff) ; // Possible one on tree worse than cutoff // Weird comparison function can leave ineligible nodes on tree if (!node || node->objectiveValue() > cutoff) continue; // Do main work of solving node here doOneNode(this, node, createdNode); #ifdef JJF_ZERO if (node) { if (createdNode) { printf("Node %d depth %d, created %d depth %d\n", node->nodeNumber(), node->depth(), createdNode->nodeNumber(), createdNode->depth()); } else { printf("Node %d depth %d, no created node\n", node->nodeNumber(), node->depth()); } } else if (createdNode) { printf("Node exhausted, created %d depth %d\n", createdNode->nodeNumber(), createdNode->depth()); } else { printf("Node exhausted, no created node\n"); numberConsecutiveInfeasible = 2; } #endif //if (createdNode) //numberConsecutiveInfeasible=0; //else //numberConsecutiveInfeasible++; #ifdef CBC_THREAD } else if (parallelMode() > 0) { //lockThread(); //node = tree_->bestNode(cutoff) ; // Possible one on tree worse than cutoff if (true || !node || node->objectiveValue() > cutoff) { assert (master_); if (master_) { int anyLeft = master_->waitForThreadsInTree(1); // may need to go round again if (anyLeft) { continue; } else { master_->stopThreads(-1); } } } //unlockThread(); } else { // Deterministic parallel if ((tree_->size() < CoinMax(numberThreads_, 8)|| hotstartSolution_) && !goneParallel) { node = tree_->bestNode(cutoff) ; // Possible one on tree worse than cutoff if (!node || node->objectiveValue() > cutoff) continue; // Do main work of solving node here doOneNode(this, node, createdNode); assert (createdNode); if (!createdNode->active()) { delete createdNode; createdNode = NULL; } else { // Say one more pointing to this node->nodeInfo()->increment() ; tree_->push(createdNode) ; } if (node->active()) { assert (node->nodeInfo()); if (node->nodeInfo()->numberBranchesLeft()) { tree_->push(node) ; } else { node->setActive(false); } } else { if (node->nodeInfo()) { if (!node->nodeInfo()->numberBranchesLeft()) node->nodeInfo()->allBranchesGone(); // can clean up // So will delete underlying stuff node->setActive(true); } delNode[nDeleteNode++] = node; node = NULL; } if (nDeleteNode >= MAX_DEL_NODE) { for (int i = 0; i < nDeleteNode; i++) { //printf("trying to del %d %x\n",i,delNode[i]); delete delNode[i]; //printf("done to del %d %x\n",i,delNode[i]); } nDeleteNode = 0; } } else { // Split and solve master_->deterministicParallel(); goneParallel = true; } } #endif } if (nDeleteNode) { for (int i = 0; i < nDeleteNode; i++) { delete delNode[i]; } nDeleteNode = 0; } #ifdef CBC_THREAD if (master_) { master_->stopThreads(-1); master_->waitForThreadsInTree(2); // adjust time to allow for children on some systems //dblParam_[CbcStartSeconds] -= CoinCpuTimeJustChildren(); } #endif /* End of the non-abort actions. The next block of code is executed if we've aborted because we hit one of the limits. Clean up by deleting the live set and break out of the node processing loop. Note that on an abort, node may have been pushed back onto the tree for further processing, in which case it'll be deleted in cleanTree. We need to check. */ if (!(numberNodes_ < intParam_[CbcMaxNumNode] && numberSolutions_ < intParam_[CbcMaxNumSol] && !maximumSecondsReached() && !stoppedOnGap_ && !eventHappened_ && (maximumNumberIterations_ < 0 || numberIterations_ < maximumNumberIterations_)) ) { if (tree_->size()) { double dummyBest; tree_->cleanTree(this, -COIN_DBL_MAX, dummyBest) ; #if 0 // Does not seem to be needed def CBC_THREAD if (parallelMode() > 0 && master_) { // see if any dangling nodes int numberThreads = master_->numberThreads(); for (int i=0;ichild(i); //if (child->createdNode()) //printf("CHILD_NODE %p\n",child->createdNode()); delete child->createdNode(); } } #endif } delete nextRowCut_; /* order is important here: * maximumSecondsReached() should be checked before eventHappened_ and * isNodeLimitReached() should be checked after eventHappened_ * reason is, that at timelimit, eventHappened_ is set to true to make Cbc stop fast * and if Ctrl+C is hit, then the nodelimit is set to -1 to make Cbc stop */ if (stoppedOnGap_) { messageHandler()->message(CBC_GAP, messages()) << bestObjective_ - bestPossibleObjective_ << dblParam_[CbcAllowableGap] << dblParam_[CbcAllowableFractionGap]*100.0 << CoinMessageEol ; secondaryStatus_ = 2; status_ = 0 ; } else if (maximumSecondsReached()) { handler_->message(CBC_MAXTIME, messages_) << CoinMessageEol ; secondaryStatus_ = 4; status_ = 1 ; } else if (numberSolutions_ >= intParam_[CbcMaxNumSol]) { handler_->message(CBC_MAXSOLS, messages_) << CoinMessageEol ; secondaryStatus_ = 6; status_ = 1 ; } else if (isNodeLimitReached()) { handler_->message(CBC_MAXNODES, messages_) << CoinMessageEol ; secondaryStatus_ = 3; status_ = 1 ; } else if (maximumNumberIterations_ >= 0 && numberIterations_ >= maximumNumberIterations_) { handler_->message(CBC_MAXITERS, messages_) << CoinMessageEol ; secondaryStatus_ = 8; status_ = 1 ; } else { handler_->message(CBC_EVENT, messages_) << CoinMessageEol ; secondaryStatus_ = 5; status_ = 5 ; } } #ifdef CBC_THREAD if (master_) { delete master_; master_ = NULL; masterThread_ = NULL; } #endif /* That's it, we've exhausted the search tree, or broken out of the loop because we hit some limit on evaluation. We may have got an intelligent tree so give it one more chance */ // Tell solver we are not in Branch and Cut solver_->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo, NULL) ; tree_->endSearch(); // If we did any sub trees - did we give up on any? if ( numberStoppedSubTrees_) status_ = 1; numberNodes_ += numberExtraNodes_; numberIterations_ += numberExtraIterations_; if (eventHandler) { eventHandler->event(CbcEventHandler::endSearch); } if (!status_) { // Set best possible unless stopped on gap if (secondaryStatus_ != 2) bestPossibleObjective_ = bestObjective_; handler_->message(CBC_END_GOOD, messages_) << bestObjective_ << numberIterations_ << numberNodes_ << getCurrentSeconds() << CoinMessageEol ; } else { handler_->message(CBC_END, messages_) << bestObjective_ << bestPossibleObjective_ << numberIterations_ << numberNodes_ << getCurrentSeconds() << CoinMessageEol ; } if ((moreSpecialOptions_&4194304)!=0) { // Conflict cuts int numberCuts = globalCuts_.sizeRowCuts(); int nConflict=0; double sizeConflict = 0.0; for (int i=0;iwhichRow()==1) { nConflict++; sizeConflict += cut->row().getNumElements(); } } if (nConflict) { sizeConflict /= nConflict; char general[200]; sprintf(general, "%d conflict cuts generated - average length %g", nConflict,sizeConflict); messageHandler()->message(CBC_GENERAL, messages()) << general << CoinMessageEol ; } } if (numberStrongIterations_) handler_->message(CBC_STRONG_STATS, messages_) << strongInfo_[0] << numberStrongIterations_ << strongInfo_[2] << strongInfo_[1] << CoinMessageEol ; if (!numberExtraNodes_) handler_->message(CBC_OTHER_STATS, messages_) << maximumDepthActual_ << numberDJFixed_ << CoinMessageEol ; else handler_->message(CBC_OTHER_STATS2, messages_) << maximumDepthActual_ << numberDJFixed_ << numberFathoms_ << numberExtraNodes_ << numberExtraIterations_ << CoinMessageEol ; #ifdef COIN_HAS_NTY if (symmetryInfo_) symmetryInfo_->statsOrbits(this,1); #endif if (doStatistics == 100) { for (int i = 0; i < numberObjects_; i++) { CbcSimpleIntegerDynamicPseudoCost * obj = dynamic_cast (object_[i]) ; if (obj) obj->print(); } } if (statistics_) { // report in some way int * lookup = new int[numberObjects_]; int i; for (i = 0; i < numberObjects_; i++) lookup[i] = -1; bool goodIds = false; //true; for (i = 0; i < numberObjects_; i++) { int iColumn = object_[i]->columnNumber(); if (iColumn >= 0 && iColumn < numberColumns) { if (lookup[i] == -1) { lookup[i] = iColumn; } else { goodIds = false; break; } } else { goodIds = false; break; } } if (!goodIds) { delete [] lookup; lookup = NULL; } if (doStatistics >= 3) { printf(" node parent depth column value obj inf\n"); for ( i = 0; i < numberNodes2_; i++) { statistics_[i]->print(lookup); } } if (doStatistics > 1) { // Find last solution int k; for (k = numberNodes2_ - 1; k >= 0; k--) { if (statistics_[k]->endingObjective() != COIN_DBL_MAX && !statistics_[k]->endingInfeasibility()) break; } if (k >= 0) { int depth = statistics_[k]->depth(); int * which = new int[depth+1]; for (i = depth; i >= 0; i--) { which[i] = k; k = statistics_[k]->parentNode(); } printf(" node parent depth column value obj inf\n"); for (i = 0; i <= depth; i++) { statistics_[which[i]]->print(lookup); } delete [] which; } } // now summary int maxDepth = 0; double averageSolutionDepth = 0.0; int numberSolutions = 0; double averageCutoffDepth = 0.0; double averageSolvedDepth = 0.0; int numberCutoff = 0; int numberDown = 0; int numberFirstDown = 0; double averageInfDown = 0.0; double averageObjDown = 0.0; int numberCutoffDown = 0; int numberUp = 0; int numberFirstUp = 0; double averageInfUp = 0.0; double averageObjUp = 0.0; int numberCutoffUp = 0; double averageNumberIterations1 = 0.0; double averageValue = 0.0; for ( i = 0; i < numberNodes2_; i++) { int depth = statistics_[i]->depth(); int way = statistics_[i]->way(); double value = statistics_[i]->value(); double startingObjective = statistics_[i]->startingObjective(); int startingInfeasibility = statistics_[i]->startingInfeasibility(); double endingObjective = statistics_[i]->endingObjective(); int endingInfeasibility = statistics_[i]->endingInfeasibility(); maxDepth = CoinMax(depth, maxDepth); // Only for completed averageNumberIterations1 += statistics_[i]->numberIterations(); averageValue += value; if (endingObjective != COIN_DBL_MAX && !endingInfeasibility) { numberSolutions++; averageSolutionDepth += depth; } if (endingObjective == COIN_DBL_MAX) { numberCutoff++; averageCutoffDepth += depth; if (way < 0) { numberDown++; numberCutoffDown++; if (way == -1) numberFirstDown++; } else { numberUp++; numberCutoffUp++; if (way == 1) numberFirstUp++; } } else { averageSolvedDepth += depth; if (way < 0) { numberDown++; averageInfDown += startingInfeasibility - endingInfeasibility; averageObjDown += endingObjective - startingObjective; if (way == -1) numberFirstDown++; } else { numberUp++; averageInfUp += startingInfeasibility - endingInfeasibility; averageObjUp += endingObjective - startingObjective; if (way == 1) numberFirstUp++; } } } // Now print if (numberSolutions) averageSolutionDepth /= static_cast (numberSolutions); int numberSolved = numberNodes2_ - numberCutoff; double averageNumberIterations2 = numberIterations_ - averageNumberIterations1 - numberIterationsAtContinuous; if (numberCutoff) { averageCutoffDepth /= static_cast (numberCutoff); averageNumberIterations2 /= static_cast (numberCutoff); } if (numberNodes2_) averageValue /= static_cast (numberNodes2_); if (numberSolved) { averageNumberIterations1 /= static_cast (numberSolved); averageSolvedDepth /= static_cast (numberSolved); } printf("%d solution(s) were found (by branching) at an average depth of %g\n", numberSolutions, averageSolutionDepth); printf("average value of variable being branched on was %g\n", averageValue); printf("%d nodes were cutoff at an average depth of %g with iteration count of %g\n", numberCutoff, averageCutoffDepth, averageNumberIterations2); printf("%d nodes were solved at an average depth of %g with iteration count of %g\n", numberSolved, averageSolvedDepth, averageNumberIterations1); if (numberDown) { averageInfDown /= static_cast (numberDown); averageObjDown /= static_cast (numberDown); } printf("Down %d nodes (%d first, %d second) - %d cutoff, rest decrease numinf %g increase obj %g\n", numberDown, numberFirstDown, numberDown - numberFirstDown, numberCutoffDown, averageInfDown, averageObjDown); if (numberUp) { averageInfUp /= static_cast (numberUp); averageObjUp /= static_cast (numberUp); } printf("Up %d nodes (%d first, %d second) - %d cutoff, rest decrease numinf %g increase obj %g\n", numberUp, numberFirstUp, numberUp - numberFirstUp, numberCutoffUp, averageInfUp, averageObjUp); for ( i = 0; i < numberNodes2_; i++) delete statistics_[i]; delete [] statistics_; statistics_ = NULL; maximumStatistics_ = 0; delete [] lookup; } /* If we think we have a solution, restore and confirm it with a call to setBestSolution(). We need to reset the cutoff value so as not to fathom the solution on bounds. Note that calling setBestSolution( ..., true) leaves the continuousSolver_ bounds vectors fixed at the solution value. Running resolve() here is a failsafe --- setBestSolution has already reoptimised using the continuousSolver_. If for some reason we fail to prove optimality, run the problem again after instructing the solver to tell us more. If all looks good, replace solver_ with continuousSolver_, so that the outside world will be able to obtain information about the solution using public methods. Don't replace if we are trying to save cuts */ if (bestSolution_ && (solverCharacteristics_->solverType() < 2 || solverCharacteristics_->solverType() == 4) && ((specialOptions_&8388608)==0||(specialOptions_&2048)!=0)) { setCutoff(1.0e50) ; // As best solution should be worse than cutoff // change cutoff as constraint if wanted if (cutoffRowNumber_>=0) { if (solver_->getNumRows()>cutoffRowNumber_) solver_->setRowUpper(cutoffRowNumber_,1.0e50); } // also in continuousSolver_ if (continuousSolver_) { // Solvers know about direction double direction = solver_->getObjSense(); continuousSolver_->setDblParam(OsiDualObjectiveLimit, 1.0e50*direction); } phase_ = 5; double increment = getDblParam(CbcModel::CbcCutoffIncrement) ; if ((specialOptions_&4) == 0) bestObjective_ += 100.0 * increment + 1.0e-3; // only set if we are going to solve setBestSolution(CBC_END_SOLUTION, bestObjective_, bestSolution_, 1) ; continuousSolver_->resolve() ; if (!continuousSolver_->isProvenOptimal()) { continuousSolver_->messageHandler()->setLogLevel(2) ; continuousSolver_->initialSolve() ; } delete solver_ ; // above deletes solverCharacteristics_ solverCharacteristics_ = NULL; solver_ = continuousSolver_ ; setPointers(solver_); continuousSolver_ = NULL ; } /* Clean up dangling objects. continuousSolver_ may already be toast. */ delete lastws ; if (saveObjects) { for (int i = 0; i < numberObjects_; i++) delete saveObjects[i]; delete [] saveObjects; } numberStrong_ = saveNumberStrong; numberBeforeTrust_ = saveNumberBeforeTrust; delete [] whichGenerator_ ; whichGenerator_ = NULL; delete [] lowerBefore ; delete [] upperBefore ; delete [] walkback_ ; walkback_ = NULL ; delete [] lastNodeInfo_ ; lastNodeInfo_ = NULL; delete [] lastNumberCuts_ ; lastNumberCuts_ = NULL; delete [] lastCut_; lastCut_ = NULL; delete [] addedCuts_ ; addedCuts_ = NULL ; //delete persistentInfo; // Get rid of characteristics solverCharacteristics_ = NULL; if (continuousSolver_) { delete continuousSolver_ ; continuousSolver_ = NULL ; } /* Destroy global cuts by replacing with an empty OsiCuts object. */ globalCuts_ = CbcRowCuts() ; delete globalConflictCuts_; globalConflictCuts_=NULL; if (!bestSolution_ && (specialOptions_&8388608)==0) { // make sure lp solver is infeasible int numberColumns = solver_->getNumCols(); const double * columnLower = solver_->getColLower(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (solver_->isInteger(iColumn)) solver_->setColUpper(iColumn, columnLower[iColumn]); } solver_->initialSolve(); } #ifdef COIN_HAS_CLP { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { // Possible restore of pivot method if (savePivotMethod) { // model may have changed savePivotMethod->setModel(NULL); clpSolver->getModelPtr()->setDualRowPivotAlgorithm(*savePivotMethod); delete savePivotMethod; } clpSolver->setLargestAway(-1.0); } } #endif if ((fastNodeDepth_ >= 1000000 || (moreSpecialOptions_&33554432)!=0) && !parentModel_) { // delete object off end delete object_[numberObjects_]; if ((moreSpecialOptions_&33554432)==0) fastNodeDepth_ -= 1000000; } delete saveSolver; // Undo preprocessing performed during BaB. if (strategy_ && strategy_->preProcessState() > 0) { // undo preprocessing CglPreProcess * process = strategy_->process(); assert (process); int n = originalSolver->getNumCols(); if (bestSolution_) { delete [] bestSolution_; bestSolution_ = new double [n]; process->postProcess(*solver_); } strategy_->deletePreProcess(); // Solution now back in originalSolver delete solver_; solver_ = originalSolver; if (bestSolution_) { bestObjective_ = solver_->getObjValue() * solver_->getObjSense(); memcpy(bestSolution_, solver_->getColSolution(), n*sizeof(double)); } // put back original objects if there were any if (originalObject) { int iColumn; assert (ownObjects_); for (iColumn = 0; iColumn < numberObjects_; iColumn++) delete object_[iColumn]; delete [] object_; numberObjects_ = numberOriginalObjects; object_ = originalObject; delete [] integerVariable_; numberIntegers_ = 0; for (iColumn = 0; iColumn < n; iColumn++) { if (solver_->isInteger(iColumn)) numberIntegers_++; } integerVariable_ = new int[numberIntegers_]; numberIntegers_ = 0; for (iColumn = 0; iColumn < n; iColumn++) { if (solver_->isInteger(iColumn)) integerVariable_[numberIntegers_++] = iColumn; } } } if (flipObjective) flipModel(); #ifdef COIN_HAS_CLP { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) clpSolver->setFakeObjective(reinterpret_cast (NULL)); } #endif moreSpecialOptions_ = saveMoreSpecialOptions; return ; } // Solve the initial LP relaxation void CbcModel::initialSolve() { assert (solver_); // Double check optimization directions line up dblParam_[CbcOptimizationDirection] = solver_->getObjSense(); // Check if bounds are all integral (as may get messed up later) checkModel(); if (!solverCharacteristics_) { OsiBabSolver * solverCharacteristics = dynamic_cast (solver_->getAuxiliaryInfo()); if (solverCharacteristics) { solverCharacteristics_ = solverCharacteristics; } else { // replace in solver OsiBabSolver defaultC; solver_->setAuxiliaryInfo(&defaultC); solverCharacteristics_ = dynamic_cast (solver_->getAuxiliaryInfo()); } } solverCharacteristics_->setSolver(solver_); solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; solver_->initialSolve(); solver_->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo, NULL) ; if (!solver_->isProvenOptimal()) solver_->resolve(); // But set up so Jon Lee will be happy status_ = -1; secondaryStatus_ = -1; originalContinuousObjective_ = solver_->getObjValue() * solver_->getObjSense(); bestPossibleObjective_ = originalContinuousObjective_; if (solver_->isProvenDualInfeasible()) originalContinuousObjective_ = -COIN_DBL_MAX; delete [] continuousSolution_; continuousSolution_ = CoinCopyOfArray(solver_->getColSolution(), solver_->getNumCols()); setPointers(solver_); solverCharacteristics_ = NULL; } /*! \brief Get an empty basis object Return an empty CoinWarmStartBasis object with the requested capacity, appropriate for the current solver. The object is cloned from the object cached as emptyWarmStart_. If there is no cached object, the routine queries the solver for a warm start object, empties it, and caches the result. */ CoinWarmStartBasis *CbcModel::getEmptyBasis (int ns, int na) const { CoinWarmStartBasis *emptyBasis ; /* Acquire an empty basis object, if we don't yet have one. */ if (emptyWarmStart_ == 0) { if (solver_ == 0) { throw CoinError("Cannot construct basis without solver!", "getEmptyBasis", "CbcModel") ; } emptyBasis = dynamic_cast(solver_->getEmptyWarmStart()) ; if (emptyBasis == 0) { throw CoinError( "Solver does not appear to use a basis-oriented warm start.", "getEmptyBasis", "CbcModel") ; } emptyBasis->setSize(0, 0) ; emptyWarmStart_ = dynamic_cast(emptyBasis) ; } /* Clone the empty basis object, resize it as requested, and return. */ emptyBasis = dynamic_cast(emptyWarmStart_->clone()) ; assert(emptyBasis) ; if (ns != 0 || na != 0) emptyBasis->setSize(ns, na) ; return (emptyBasis) ; } /** Default Constructor Creates an empty model without an associated solver. */ CbcModel::CbcModel() : solver_(NULL), ownership_(0x80000000), continuousSolver_(NULL), referenceSolver_(NULL), defaultHandler_(true), emptyWarmStart_(NULL), bestObjective_(COIN_DBL_MAX), bestPossibleObjective_(COIN_DBL_MAX), sumChangeObjective1_(0.0), sumChangeObjective2_(0.0), bestSolution_(NULL), savedSolutions_(NULL), currentSolution_(NULL), testSolution_(NULL), globalConflictCuts_(NULL), minimumDrop_(1.0e-4), numberSolutions_(0), numberSavedSolutions_(0), maximumSavedSolutions_(0), stateOfSearch_(0), whenCuts_(-1), hotstartSolution_(NULL), hotstartPriorities_(NULL), numberHeuristicSolutions_(0), numberNodes_(0), numberNodes2_(0), numberIterations_(0), numberSolves_(0), status_(-1), secondaryStatus_(-1), numberIntegers_(0), numberRowsAtContinuous_(0), cutoffRowNumber_(-1), maximumNumberCuts_(0), phase_(0), currentNumberCuts_(0), maximumDepth_(0), walkback_(NULL), lastNodeInfo_(NULL), lastCut_(NULL), lastDepth_(0), lastNumberCuts2_(0), maximumCuts_(0), lastNumberCuts_(NULL), addedCuts_(NULL), nextRowCut_(NULL), currentNode_(NULL), integerVariable_(NULL), integerInfo_(NULL), continuousSolution_(NULL), usedInSolution_(NULL), specialOptions_(0), moreSpecialOptions_(0), moreSpecialOptions2_(0), topOfTree_(NULL), subTreeModel_(NULL), heuristicModel_(NULL), numberStoppedSubTrees_(0), presolve_(0), numberStrong_(5), numberBeforeTrust_(10), numberPenalties_(20), stopNumberIterations_(-1), penaltyScaleFactor_(3.0), numberAnalyzeIterations_(0), analyzeResults_(NULL), numberInfeasibleNodes_(0), problemType_(0), printFrequency_(0), numberCutGenerators_(0), generator_(NULL), virginGenerator_(NULL), numberHeuristics_(0), heuristic_(NULL), lastHeuristic_(NULL), fastNodeDepth_(-1), eventHandler_(NULL), #ifdef COIN_HAS_NTY symmetryInfo_(NULL), #endif numberObjects_(0), object_(NULL), ownObjects_(true), originalColumns_(NULL), howOftenGlobalScan_(3), numberGlobalViolations_(0), numberExtraIterations_(0), numberExtraNodes_(0), numberFathoms_(0), continuousObjective_(COIN_DBL_MAX), originalContinuousObjective_(COIN_DBL_MAX), continuousInfeasibilities_(COIN_INT_MAX), maximumCutPassesAtRoot_(20), maximumCutPasses_(10), preferredWay_(0), currentPassNumber_(0), maximumWhich_(INITIAL_MAXIMUM_WHICH), maximumRows_(0), randomSeed_(-1), multipleRootTries_(0), currentDepth_(0), whichGenerator_(NULL), maximumStatistics_(0), statistics_(NULL), maximumDepthActual_(0), numberDJFixed_(0.0), probingInfo_(NULL), numberFixedAtRoot_(0), numberFixedNow_(0), stoppedOnGap_(false), eventHappened_(false), numberLongStrong_(0), numberOldActiveCuts_(0), numberNewCuts_(0), searchStrategy_(-1), strongStrategy_(0), numberStrongIterations_(0), resolveAfterTakeOffCuts_(true), maximumNumberIterations_(-1), continuousPriority_(COIN_INT_MAX), numberUpdateItems_(0), maximumNumberUpdateItems_(0), updateItems_(NULL), storedRowCuts_(NULL), numberThreads_(0), threadMode_(0), numberGlobalCutsIn_(0), master_(NULL), masterThread_(NULL) { memset(intParam_, 0, sizeof(intParam_)); intParam_[CbcMaxNumNode] = 2147483647; intParam_[CbcMaxNumSol] = 9999999; memset(dblParam_, 0, sizeof(dblParam_)); dblParam_[CbcIntegerTolerance] = 1e-6; dblParam_[CbcCutoffIncrement] = 1e-5; dblParam_[CbcAllowableGap] = 1.0e-10; dblParam_[CbcMaximumSeconds] = 1.0e100; dblParam_[CbcCurrentCutoff] = 1.0e100; dblParam_[CbcOptimizationDirection] = 1.0; dblParam_[CbcCurrentObjectiveValue] = 1.0e100; dblParam_[CbcCurrentMinimizationObjectiveValue] = 1.0e100; strongInfo_[0] = 0; strongInfo_[1] = 0; strongInfo_[2] = 0; strongInfo_[3] = 0; strongInfo_[4] = 0; strongInfo_[5] = 0; strongInfo_[6] = 0; solverCharacteristics_ = NULL; nodeCompare_ = new CbcCompareDefault();; problemFeasibility_ = new CbcFeasibilityBase(); tree_ = new CbcTree(); branchingMethod_ = NULL; cutModifier_ = NULL; strategy_ = NULL; parentModel_ = NULL; cbcColLower_ = NULL; cbcColUpper_ = NULL; cbcRowLower_ = NULL; cbcRowUpper_ = NULL; cbcColSolution_ = NULL; cbcRowPrice_ = NULL; cbcReducedCost_ = NULL; cbcRowActivity_ = NULL; appData_ = NULL; handler_ = new CoinMessageHandler(); handler_->setLogLevel(2); messages_ = CbcMessage(); //eventHandler_ = new CbcEventHandler() ; } /** Constructor from solver. Creates a model complete with a clone of the solver passed as a parameter. */ CbcModel::CbcModel(const OsiSolverInterface &rhs) : continuousSolver_(NULL), referenceSolver_(NULL), defaultHandler_(true), emptyWarmStart_(NULL), bestObjective_(COIN_DBL_MAX), bestPossibleObjective_(COIN_DBL_MAX), sumChangeObjective1_(0.0), sumChangeObjective2_(0.0), globalConflictCuts_(NULL), minimumDrop_(1.0e-4), numberSolutions_(0), numberSavedSolutions_(0), maximumSavedSolutions_(0), stateOfSearch_(0), whenCuts_(-1), hotstartSolution_(NULL), hotstartPriorities_(NULL), numberHeuristicSolutions_(0), numberNodes_(0), numberNodes2_(0), numberIterations_(0), numberSolves_(0), status_(-1), secondaryStatus_(-1), numberRowsAtContinuous_(0), cutoffRowNumber_(-1), maximumNumberCuts_(0), phase_(0), currentNumberCuts_(0), maximumDepth_(0), walkback_(NULL), lastNodeInfo_(NULL), lastCut_(NULL), lastDepth_(0), lastNumberCuts2_(0), maximumCuts_(0), lastNumberCuts_(NULL), addedCuts_(NULL), nextRowCut_(NULL), currentNode_(NULL), integerInfo_(NULL), specialOptions_(0), moreSpecialOptions_(0), moreSpecialOptions2_(0), topOfTree_(NULL), subTreeModel_(NULL), heuristicModel_(NULL), numberStoppedSubTrees_(0), presolve_(0), numberStrong_(5), numberBeforeTrust_(10), numberPenalties_(20), stopNumberIterations_(-1), penaltyScaleFactor_(3.0), numberAnalyzeIterations_(0), analyzeResults_(NULL), numberInfeasibleNodes_(0), problemType_(0), printFrequency_(0), numberCutGenerators_(0), generator_(NULL), virginGenerator_(NULL), numberHeuristics_(0), heuristic_(NULL), lastHeuristic_(NULL), fastNodeDepth_(-1), eventHandler_(NULL), #ifdef COIN_HAS_NTY symmetryInfo_(NULL), #endif numberObjects_(0), object_(NULL), ownObjects_(true), originalColumns_(NULL), howOftenGlobalScan_(3), numberGlobalViolations_(0), numberExtraIterations_(0), numberExtraNodes_(0), numberFathoms_(0), continuousObjective_(COIN_DBL_MAX), originalContinuousObjective_(COIN_DBL_MAX), continuousInfeasibilities_(COIN_INT_MAX), maximumCutPassesAtRoot_(20), maximumCutPasses_(10), preferredWay_(0), currentPassNumber_(0), maximumWhich_(INITIAL_MAXIMUM_WHICH), maximumRows_(0), randomSeed_(-1), multipleRootTries_(0), currentDepth_(0), whichGenerator_(NULL), maximumStatistics_(0), statistics_(NULL), maximumDepthActual_(0), numberDJFixed_(0.0), probingInfo_(NULL), numberFixedAtRoot_(0), numberFixedNow_(0), stoppedOnGap_(false), eventHappened_(false), numberLongStrong_(0), numberOldActiveCuts_(0), numberNewCuts_(0), searchStrategy_(-1), strongStrategy_(0), numberStrongIterations_(0), resolveAfterTakeOffCuts_(true), maximumNumberIterations_(-1), continuousPriority_(COIN_INT_MAX), numberUpdateItems_(0), maximumNumberUpdateItems_(0), updateItems_(NULL), storedRowCuts_(NULL), numberThreads_(0), threadMode_(0), numberGlobalCutsIn_(0), master_(NULL), masterThread_(NULL) { memset(intParam_, 0, sizeof(intParam_)); intParam_[CbcMaxNumNode] = 2147483647; intParam_[CbcMaxNumSol] = 9999999; memset(dblParam_, 0, sizeof(dblParam_)); dblParam_[CbcIntegerTolerance] = 1e-6; dblParam_[CbcCutoffIncrement] = 1e-5; dblParam_[CbcAllowableGap] = 1.0e-10; dblParam_[CbcMaximumSeconds] = 1.0e100; dblParam_[CbcCurrentCutoff] = 1.0e100; dblParam_[CbcOptimizationDirection] = 1.0; dblParam_[CbcCurrentObjectiveValue] = 1.0e100; dblParam_[CbcCurrentMinimizationObjectiveValue] = 1.0e100; strongInfo_[0] = 0; strongInfo_[1] = 0; strongInfo_[2] = 0; strongInfo_[3] = 0; strongInfo_[4] = 0; strongInfo_[5] = 0; strongInfo_[6] = 0; solverCharacteristics_ = NULL; nodeCompare_ = new CbcCompareDefault();; problemFeasibility_ = new CbcFeasibilityBase(); tree_ = new CbcTree(); branchingMethod_ = NULL; cutModifier_ = NULL; strategy_ = NULL; parentModel_ = NULL; appData_ = NULL; solver_ = rhs.clone(); handler_ = new CoinMessageHandler(); if (!solver_->defaultHandler()&& solver_->messageHandler()->logLevel(0)!=-1000) passInMessageHandler(solver_->messageHandler()); handler_->setLogLevel(2); messages_ = CbcMessage(); //eventHandler_ = new CbcEventHandler() ; referenceSolver_ = solver_->clone(); ownership_ = 0x80000000; cbcColLower_ = NULL; cbcColUpper_ = NULL; cbcRowLower_ = NULL; cbcRowUpper_ = NULL; cbcColSolution_ = NULL; cbcRowPrice_ = NULL; cbcReducedCost_ = NULL; cbcRowActivity_ = NULL; // Initialize solution and integer variable vectors bestSolution_ = NULL; // to say no solution found savedSolutions_ = NULL; numberIntegers_ = 0; int numberColumns = solver_->getNumCols(); int iColumn; if (numberColumns) { // Space for current solution currentSolution_ = new double[numberColumns]; continuousSolution_ = CoinCopyOfArray(solver_->getColSolution(),numberColumns); usedInSolution_ = new int[numberColumns]; CoinZeroN(usedInSolution_, numberColumns); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if ( solver_->isInteger(iColumn)) numberIntegers_++; } } else { // empty model currentSolution_ = NULL; continuousSolution_ = NULL; usedInSolution_ = NULL; } testSolution_ = currentSolution_; if (numberIntegers_) { integerVariable_ = new int [numberIntegers_]; numberIntegers_ = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if ( solver_->isInteger(iColumn)) integerVariable_[numberIntegers_++] = iColumn; } } else { integerVariable_ = NULL; } } static int * resizeInt(int * array,int oldLength, int newLength) { if (!array) return NULL; assert (newLength>oldLength); int * newArray = new int [newLength]; memcpy(newArray,array,oldLength*sizeof(int)); delete [] array; memset(newArray+oldLength,0,(newLength-oldLength)*sizeof(int)); return newArray; } static double * resizeDouble(double * array,int oldLength, int newLength) { if (!array) return NULL; assert (newLength>oldLength); double * newArray = new double [newLength]; memcpy(newArray,array,oldLength*sizeof(double)); delete [] array; memset(newArray+oldLength,0,(newLength-oldLength)*sizeof(double)); return newArray; } /* Assign a solver to the model (model assumes ownership) The integer variable vector is initialized if it's not already present. If deleteSolver then current solver deleted (if model owned) Assuming ownership matches usage in OsiSolverInterface (cf. assignProblem, loadProblem). TODO: What to do about solver parameters? A simple copy likely won't do it, because the SI must push the settings into the underlying solver. In the context of switching solvers in cbc, this means that command line settings will get lost. Stash the command line somewhere and reread it here, maybe? TODO: More generally, how much state should be transferred from the old solver to the new solver? Best perhaps to see how usage develops. What's done here mimics the CbcModel(OsiSolverInterface) constructor. */ void CbcModel::assignSolver(OsiSolverInterface *&solver, bool deleteSolver) { // resize stuff if exists if (solver && solver_) { int nOld = solver_->getNumCols(); int nNew = solver->getNumCols(); if (nNew > nOld) { originalColumns_ = resizeInt(originalColumns_,nOld,nNew); usedInSolution_ = resizeInt(usedInSolution_,nOld,nNew); continuousSolution_ = resizeDouble(continuousSolution_,nOld,nNew); hotstartSolution_ = resizeDouble(hotstartSolution_,nOld,nNew); bestSolution_ = resizeDouble(bestSolution_,nOld,nNew); currentSolution_ = resizeDouble(currentSolution_,nOld,nNew); if (savedSolutions_) { for (int i = 0; i < maximumSavedSolutions_; i++) savedSolutions_[i] = resizeDouble(savedSolutions_[i],nOld,nNew); } } } // Keep the current message level for solver (if solver exists) if (solver_) solver->messageHandler()->setLogLevel(solver_->messageHandler()->logLevel()) ; if (modelOwnsSolver() && deleteSolver) { solverCharacteristics_ = NULL; delete solver_ ; } solver_ = solver; solver = NULL ; setModelOwnsSolver(true) ; /* Basis information is solver-specific. */ if (emptyWarmStart_) { delete emptyWarmStart_ ; emptyWarmStart_ = 0 ; } bestSolutionBasis_ = CoinWarmStartBasis(); /* Initialize integer variable vector. */ numberIntegers_ = 0; int numberColumns = solver_->getNumCols(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if ( solver_->isInteger(iColumn)) numberIntegers_++; } delete [] integerVariable_; if (numberIntegers_) { integerVariable_ = new int [numberIntegers_]; numberIntegers_ = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if ( solver_->isInteger(iColumn)) integerVariable_[numberIntegers_++] = iColumn; } } else { integerVariable_ = NULL; } return ; } // Cloning method CbcModel *CbcModel::clone (bool cloneHandler) { return new CbcModel (*this, cloneHandler); } // Copy constructor. CbcModel::CbcModel(const CbcModel & rhs, bool cloneHandler) : continuousSolver_(NULL), referenceSolver_(NULL), defaultHandler_(rhs.defaultHandler_), emptyWarmStart_(NULL), bestObjective_(rhs.bestObjective_), bestPossibleObjective_(rhs.bestPossibleObjective_), sumChangeObjective1_(rhs.sumChangeObjective1_), sumChangeObjective2_(rhs.sumChangeObjective2_), globalConflictCuts_(NULL), minimumDrop_(rhs.minimumDrop_), numberSolutions_(rhs.numberSolutions_), numberSavedSolutions_(rhs.numberSavedSolutions_), maximumSavedSolutions_(rhs.maximumSavedSolutions_), stateOfSearch_(rhs.stateOfSearch_), whenCuts_(rhs.whenCuts_), numberHeuristicSolutions_(rhs.numberHeuristicSolutions_), numberNodes_(rhs.numberNodes_), numberNodes2_(rhs.numberNodes2_), numberIterations_(rhs.numberIterations_), numberSolves_(rhs.numberSolves_), status_(rhs.status_), secondaryStatus_(rhs.secondaryStatus_), specialOptions_(rhs.specialOptions_), moreSpecialOptions_(rhs.moreSpecialOptions_), moreSpecialOptions2_(rhs.moreSpecialOptions2_), topOfTree_(NULL), subTreeModel_(rhs.subTreeModel_), heuristicModel_(NULL), numberStoppedSubTrees_(rhs.numberStoppedSubTrees_), presolve_(rhs.presolve_), numberStrong_(rhs.numberStrong_), numberBeforeTrust_(rhs.numberBeforeTrust_), numberPenalties_(rhs.numberPenalties_), stopNumberIterations_(rhs.stopNumberIterations_), penaltyScaleFactor_(rhs.penaltyScaleFactor_), numberAnalyzeIterations_(rhs.numberAnalyzeIterations_), analyzeResults_(NULL), numberInfeasibleNodes_(rhs.numberInfeasibleNodes_), problemType_(rhs.problemType_), printFrequency_(rhs.printFrequency_), fastNodeDepth_(rhs.fastNodeDepth_), howOftenGlobalScan_(rhs.howOftenGlobalScan_), numberGlobalViolations_(rhs.numberGlobalViolations_), numberExtraIterations_(rhs.numberExtraIterations_), numberExtraNodes_(rhs.numberExtraNodes_), numberFathoms_(rhs.numberFathoms_), continuousObjective_(rhs.continuousObjective_), originalContinuousObjective_(rhs.originalContinuousObjective_), continuousInfeasibilities_(rhs.continuousInfeasibilities_), maximumCutPassesAtRoot_(rhs.maximumCutPassesAtRoot_), maximumCutPasses_( rhs.maximumCutPasses_), preferredWay_(rhs.preferredWay_), currentPassNumber_(rhs.currentPassNumber_), maximumWhich_(rhs.maximumWhich_), maximumRows_(0), randomSeed_(rhs.randomSeed_), multipleRootTries_(rhs.multipleRootTries_), currentDepth_(0), whichGenerator_(NULL), maximumStatistics_(0), statistics_(NULL), maximumDepthActual_(0), numberDJFixed_(0.0), probingInfo_(NULL), numberFixedAtRoot_(rhs.numberFixedAtRoot_), numberFixedNow_(rhs.numberFixedNow_), stoppedOnGap_(rhs.stoppedOnGap_), eventHappened_(rhs.eventHappened_), numberLongStrong_(rhs.numberLongStrong_), numberOldActiveCuts_(rhs.numberOldActiveCuts_), numberNewCuts_(rhs.numberNewCuts_), searchStrategy_(rhs.searchStrategy_), strongStrategy_(rhs.strongStrategy_), numberStrongIterations_(rhs.numberStrongIterations_), resolveAfterTakeOffCuts_(rhs.resolveAfterTakeOffCuts_), maximumNumberIterations_(rhs.maximumNumberIterations_), continuousPriority_(rhs.continuousPriority_), numberUpdateItems_(rhs.numberUpdateItems_), maximumNumberUpdateItems_(rhs.maximumNumberUpdateItems_), updateItems_(NULL), storedRowCuts_(NULL), numberThreads_(rhs.numberThreads_), threadMode_(rhs.threadMode_), numberGlobalCutsIn_(rhs.numberGlobalCutsIn_), master_(NULL), masterThread_(NULL) { memcpy(intParam_, rhs.intParam_, sizeof(intParam_)); memcpy(dblParam_, rhs.dblParam_, sizeof(dblParam_)); strongInfo_[0] = rhs.strongInfo_[0]; strongInfo_[1] = rhs.strongInfo_[1]; strongInfo_[2] = rhs.strongInfo_[2]; strongInfo_[3] = rhs.strongInfo_[3]; strongInfo_[4] = rhs.strongInfo_[4]; strongInfo_[5] = rhs.strongInfo_[5]; strongInfo_[6] = rhs.strongInfo_[6]; solverCharacteristics_ = NULL; if (rhs.emptyWarmStart_) emptyWarmStart_ = rhs.emptyWarmStart_->clone() ; if (defaultHandler_ || cloneHandler) { handler_ = new CoinMessageHandler(); handler_->setLogLevel(2); } else { handler_ = rhs.handler_; } messageHandler()->setLogLevel(rhs.messageHandler()->logLevel()); numberCutGenerators_ = rhs.numberCutGenerators_; if (numberCutGenerators_) { generator_ = new CbcCutGenerator * [numberCutGenerators_]; virginGenerator_ = new CbcCutGenerator * [numberCutGenerators_]; int i; for (i = 0; i < numberCutGenerators_; i++) { generator_[i] = new CbcCutGenerator(*rhs.generator_[i]); virginGenerator_[i] = new CbcCutGenerator(*rhs.virginGenerator_[i]); } } else { generator_ = NULL; virginGenerator_ = NULL; } globalCuts_ = rhs.globalCuts_; numberHeuristics_ = rhs.numberHeuristics_; if (numberHeuristics_) { heuristic_ = new CbcHeuristic * [numberHeuristics_]; int i; for (i = 0; i < numberHeuristics_; i++) { heuristic_[i] = rhs.heuristic_[i]->clone(); } } else { heuristic_ = NULL; } lastHeuristic_ = NULL; if (rhs.eventHandler_) { eventHandler_ = rhs.eventHandler_->clone() ; } else { eventHandler_ = NULL ; } ownObjects_ = rhs.ownObjects_; if (ownObjects_) { numberObjects_ = rhs.numberObjects_; if (numberObjects_) { object_ = new OsiObject * [numberObjects_]; int i; for (i = 0; i < numberObjects_; i++) { object_[i] = (rhs.object_[i])->clone(); CbcObject * obj = dynamic_cast (object_[i]) ; // Could be OsiObjects if (obj) obj->setModel(this); } } else { object_ = NULL; } } else { // assume will be redone numberObjects_ = 0; object_ = NULL; } if (rhs.continuousSolver_) { continuousSolver_ = rhs.continuousSolver_->clone() ; } else { continuousSolver_ = NULL ; } if (rhs.referenceSolver_) referenceSolver_ = rhs.referenceSolver_->clone(); else referenceSolver_ = NULL; solver_ = rhs.solver_->clone(); if (rhs.originalColumns_) { int numberColumns = solver_->getNumCols(); originalColumns_ = new int [numberColumns]; memcpy(originalColumns_, rhs.originalColumns_, numberColumns*sizeof(int)); } else { originalColumns_ = NULL; } if (maximumNumberUpdateItems_) { updateItems_ = new CbcObjectUpdateData [maximumNumberUpdateItems_]; for (int i = 0; i < maximumNumberUpdateItems_; i++) updateItems_[i] = rhs.updateItems_[i]; } if (maximumWhich_ && rhs.whichGenerator_) whichGenerator_ = CoinCopyOfArray(rhs.whichGenerator_, maximumWhich_); nodeCompare_ = rhs.nodeCompare_->clone(); problemFeasibility_ = rhs.problemFeasibility_->clone(); tree_ = rhs.tree_->clone(); if (rhs.branchingMethod_) branchingMethod_ = rhs.branchingMethod_->clone(); else branchingMethod_ = NULL; if (rhs.cutModifier_) cutModifier_ = rhs.cutModifier_->clone(); else cutModifier_ = NULL; cbcColLower_ = NULL; cbcColUpper_ = NULL; cbcRowLower_ = NULL; cbcRowUpper_ = NULL; cbcColSolution_ = NULL; cbcRowPrice_ = NULL; cbcReducedCost_ = NULL; cbcRowActivity_ = NULL; if (rhs.strategy_) strategy_ = rhs.strategy_->clone(); else strategy_ = NULL; parentModel_ = rhs.parentModel_; appData_ = rhs.appData_; messages_ = rhs.messages_; ownership_ = rhs.ownership_ | 0x80000000; messageHandler()->setLogLevel(rhs.messageHandler()->logLevel()); numberIntegers_ = rhs.numberIntegers_; randomNumberGenerator_ = rhs.randomNumberGenerator_; if (numberIntegers_) { integerVariable_ = new int [numberIntegers_]; memcpy(integerVariable_, rhs.integerVariable_, numberIntegers_*sizeof(int)); integerInfo_ = CoinCopyOfArray(rhs.integerInfo_, solver_->getNumCols()); } else { integerVariable_ = NULL; integerInfo_ = NULL; } if (rhs.hotstartSolution_) { int numberColumns = solver_->getNumCols(); hotstartSolution_ = CoinCopyOfArray(rhs.hotstartSolution_, numberColumns); hotstartPriorities_ = CoinCopyOfArray(rhs.hotstartPriorities_, numberColumns); } else { hotstartSolution_ = NULL; hotstartPriorities_ = NULL; } if (rhs.bestSolution_) { int numberColumns = solver_->getNumCols(); bestSolution_ = new double[numberColumns]; memcpy(bestSolution_, rhs.bestSolution_, numberColumns*sizeof(double)); } else { bestSolution_ = NULL; } int numberColumns = solver_->getNumCols(); if (maximumSavedSolutions_ && rhs.savedSolutions_) { savedSolutions_ = new double * [maximumSavedSolutions_]; for (int i = 0; i < maximumSavedSolutions_; i++) savedSolutions_[i] = CoinCopyOfArray(rhs.savedSolutions_[i], numberColumns + 2); } else { savedSolutions_ = NULL; } // Space for current solution currentSolution_ = new double[numberColumns]; continuousSolution_ = CoinCopyOfArray(solver_->getColSolution(),numberColumns); usedInSolution_ = new int[numberColumns]; CoinZeroN(usedInSolution_, numberColumns); testSolution_ = currentSolution_; numberRowsAtContinuous_ = rhs.numberRowsAtContinuous_; cutoffRowNumber_ = rhs.cutoffRowNumber_; maximumNumberCuts_ = rhs.maximumNumberCuts_; phase_ = rhs.phase_; currentNumberCuts_ = rhs.currentNumberCuts_; maximumDepth_ = rhs.maximumDepth_; // These are only used as temporary arrays so need not be filled if (maximumNumberCuts_) { addedCuts_ = new CbcCountRowCut * [maximumNumberCuts_]; } else { addedCuts_ = NULL; } bestSolutionBasis_ = rhs.bestSolutionBasis_; nextRowCut_ = NULL; currentNode_ = NULL; if (maximumDepth_) { walkback_ = new CbcNodeInfo * [maximumDepth_]; lastNodeInfo_ = new CbcNodeInfo * [maximumDepth_] ; lastNumberCuts_ = new int [maximumDepth_] ; } else { walkback_ = NULL; lastNodeInfo_ = NULL; lastNumberCuts_ = NULL; } maximumCuts_ = rhs.maximumCuts_; if (maximumCuts_) { lastCut_ = new const OsiRowCut * [maximumCuts_] ; } else { lastCut_ = NULL; } #ifdef COIN_HAS_NTY if (rhs.symmetryInfo_) symmetryInfo_ = new CbcSymmetry(*rhs.symmetryInfo_); else symmetryInfo_ = NULL; #endif synchronizeModel(); if (cloneHandler && !defaultHandler_) { delete handler_; CoinMessageHandler * handler = rhs.handler_->clone(); passInMessageHandler(handler); } } // Assignment operator CbcModel & CbcModel::operator=(const CbcModel & rhs) { if (this != &rhs) { if (modelOwnsSolver()) { solverCharacteristics_ = NULL; delete solver_; solver_ = NULL; } gutsOfDestructor(); if (defaultHandler_) { delete handler_; handler_ = NULL; } defaultHandler_ = rhs.defaultHandler_; if (defaultHandler_) { handler_ = new CoinMessageHandler(); handler_->setLogLevel(2); } else { handler_ = rhs.handler_; } messages_ = rhs.messages_; messageHandler()->setLogLevel(rhs.messageHandler()->logLevel()); if (rhs.solver_) { solver_ = rhs.solver_->clone() ; } else { solver_ = 0 ; } ownership_ = 0x80000000; delete continuousSolver_ ; if (rhs.continuousSolver_) { continuousSolver_ = rhs.continuousSolver_->clone() ; } else { continuousSolver_ = 0 ; } delete referenceSolver_; if (rhs.referenceSolver_) { referenceSolver_ = rhs.referenceSolver_->clone() ; } else { referenceSolver_ = NULL ; } delete emptyWarmStart_ ; if (rhs.emptyWarmStart_) { emptyWarmStart_ = rhs.emptyWarmStart_->clone() ; } else { emptyWarmStart_ = 0 ; } bestObjective_ = rhs.bestObjective_; bestPossibleObjective_ = rhs.bestPossibleObjective_; sumChangeObjective1_ = rhs.sumChangeObjective1_; sumChangeObjective2_ = rhs.sumChangeObjective2_; delete [] bestSolution_; if (rhs.bestSolution_) { int numberColumns = rhs.getNumCols(); bestSolution_ = new double[numberColumns]; memcpy(bestSolution_, rhs.bestSolution_, numberColumns*sizeof(double)); } else { bestSolution_ = NULL; } for (int i = 0; i < maximumSavedSolutions_; i++) delete [] savedSolutions_[i]; delete [] savedSolutions_; savedSolutions_ = NULL; int numberColumns = rhs.getNumCols(); if (numberColumns) { // Space for current solution currentSolution_ = new double[numberColumns]; continuousSolution_ = CoinCopyOfArray(solver_->getColSolution(),numberColumns); usedInSolution_ = new int[numberColumns]; CoinZeroN(usedInSolution_, numberColumns); } else { currentSolution_ = NULL; continuousSolution_ = NULL; usedInSolution_ = NULL; } if (maximumSavedSolutions_) { savedSolutions_ = new double * [maximumSavedSolutions_]; for (int i = 0; i < maximumSavedSolutions_; i++) savedSolutions_[i] = CoinCopyOfArray(rhs.savedSolutions_[i], numberColumns + 2); } else { savedSolutions_ = NULL; } testSolution_ = currentSolution_; minimumDrop_ = rhs.minimumDrop_; numberSolutions_ = rhs.numberSolutions_; numberSavedSolutions_ = rhs.numberSavedSolutions_; maximumSavedSolutions_ = rhs.maximumSavedSolutions_; stateOfSearch_ = rhs.stateOfSearch_; whenCuts_ = rhs.whenCuts_; numberHeuristicSolutions_ = rhs.numberHeuristicSolutions_; numberNodes_ = rhs.numberNodes_; numberNodes2_ = rhs.numberNodes2_; numberIterations_ = rhs.numberIterations_; numberSolves_ = rhs.numberSolves_; status_ = rhs.status_; secondaryStatus_ = rhs.secondaryStatus_; specialOptions_ = rhs.specialOptions_; moreSpecialOptions_ = rhs.moreSpecialOptions_; moreSpecialOptions2_ = rhs.moreSpecialOptions2_; subTreeModel_ = rhs.subTreeModel_; heuristicModel_ = NULL; numberStoppedSubTrees_ = rhs.numberStoppedSubTrees_; presolve_ = rhs.presolve_; numberStrong_ = rhs.numberStrong_; numberBeforeTrust_ = rhs.numberBeforeTrust_; numberPenalties_ = rhs.numberPenalties_; stopNumberIterations_ = rhs.stopNumberIterations_; penaltyScaleFactor_ = rhs.penaltyScaleFactor_; numberAnalyzeIterations_ = rhs.numberAnalyzeIterations_; delete [] analyzeResults_; analyzeResults_ = NULL; numberInfeasibleNodes_ = rhs.numberInfeasibleNodes_; problemType_ = rhs.problemType_; printFrequency_ = rhs.printFrequency_; howOftenGlobalScan_ = rhs.howOftenGlobalScan_; numberGlobalViolations_ = rhs.numberGlobalViolations_; numberExtraIterations_ = rhs.numberExtraIterations_; numberExtraNodes_ = rhs.numberExtraNodes_; numberFathoms_ = rhs.numberFathoms_; continuousObjective_ = rhs.continuousObjective_; originalContinuousObjective_ = rhs.originalContinuousObjective_; continuousInfeasibilities_ = rhs.continuousInfeasibilities_; maximumCutPassesAtRoot_ = rhs.maximumCutPassesAtRoot_; maximumCutPasses_ = rhs.maximumCutPasses_; randomSeed_ = rhs.randomSeed_; multipleRootTries_ = rhs.multipleRootTries_; preferredWay_ = rhs.preferredWay_; currentPassNumber_ = rhs.currentPassNumber_; memcpy(intParam_, rhs.intParam_, sizeof(intParam_)); memcpy(dblParam_, rhs.dblParam_, sizeof(dblParam_)); globalCuts_ = rhs.globalCuts_; delete globalConflictCuts_; globalConflictCuts_=NULL; int i; for (i = 0; i < numberCutGenerators_; i++) { delete generator_[i]; delete virginGenerator_[i]; } delete [] generator_; delete [] virginGenerator_; delete [] heuristic_; maximumWhich_ = rhs.maximumWhich_; delete [] whichGenerator_; whichGenerator_ = NULL; if (maximumWhich_ && rhs.whichGenerator_) whichGenerator_ = CoinCopyOfArray(rhs.whichGenerator_, maximumWhich_); maximumRows_ = 0; currentDepth_ = 0; randomNumberGenerator_ = rhs.randomNumberGenerator_; workingBasis_ = CoinWarmStartBasis(); for (i = 0; i < maximumStatistics_; i++) delete statistics_[i]; delete [] statistics_; maximumStatistics_ = 0; statistics_ = NULL; delete probingInfo_; probingInfo_ = NULL; numberFixedAtRoot_ = rhs.numberFixedAtRoot_; numberFixedNow_ = rhs.numberFixedNow_; stoppedOnGap_ = rhs.stoppedOnGap_; eventHappened_ = rhs.eventHappened_; numberLongStrong_ = rhs.numberLongStrong_; numberOldActiveCuts_ = rhs.numberOldActiveCuts_; numberNewCuts_ = rhs.numberNewCuts_; resolveAfterTakeOffCuts_ = rhs.resolveAfterTakeOffCuts_; maximumNumberIterations_ = rhs.maximumNumberIterations_; continuousPriority_ = rhs.continuousPriority_; numberUpdateItems_ = rhs.numberUpdateItems_; maximumNumberUpdateItems_ = rhs.maximumNumberUpdateItems_; delete [] updateItems_; if (maximumNumberUpdateItems_) { updateItems_ = new CbcObjectUpdateData [maximumNumberUpdateItems_]; for (i = 0; i < maximumNumberUpdateItems_; i++) updateItems_[i] = rhs.updateItems_[i]; } else { updateItems_ = NULL; } numberThreads_ = rhs.numberThreads_; threadMode_ = rhs.threadMode_; numberGlobalCutsIn_ = rhs.numberGlobalCutsIn_; delete master_; master_ = NULL; masterThread_ = NULL; searchStrategy_ = rhs.searchStrategy_; strongStrategy_ = rhs.strongStrategy_; numberStrongIterations_ = rhs.numberStrongIterations_; strongInfo_[0] = rhs.strongInfo_[0]; strongInfo_[1] = rhs.strongInfo_[1]; strongInfo_[2] = rhs.strongInfo_[2]; strongInfo_[3] = rhs.strongInfo_[3]; strongInfo_[4] = rhs.strongInfo_[4]; strongInfo_[5] = rhs.strongInfo_[5]; strongInfo_[6] = rhs.strongInfo_[6]; solverCharacteristics_ = NULL; lastHeuristic_ = NULL; numberCutGenerators_ = rhs.numberCutGenerators_; if (numberCutGenerators_) { generator_ = new CbcCutGenerator * [numberCutGenerators_]; virginGenerator_ = new CbcCutGenerator * [numberCutGenerators_]; int i; for (i = 0; i < numberCutGenerators_; i++) { generator_[i] = new CbcCutGenerator(*rhs.generator_[i]); virginGenerator_[i] = new CbcCutGenerator(*rhs.virginGenerator_[i]); } } else { generator_ = NULL; virginGenerator_ = NULL; } numberHeuristics_ = rhs.numberHeuristics_; if (numberHeuristics_) { heuristic_ = new CbcHeuristic * [numberHeuristics_]; memcpy(heuristic_, rhs.heuristic_, numberHeuristics_*sizeof(CbcHeuristic *)); } else { heuristic_ = NULL; } lastHeuristic_ = NULL; if (eventHandler_) delete eventHandler_ ; if (rhs.eventHandler_) { eventHandler_ = rhs.eventHandler_->clone() ; } else { eventHandler_ = NULL ; } fastNodeDepth_ = rhs.fastNodeDepth_; if (ownObjects_) { for (i = 0; i < numberObjects_; i++) delete object_[i]; delete [] object_; numberObjects_ = rhs.numberObjects_; if (numberObjects_) { object_ = new OsiObject * [numberObjects_]; int i; for (i = 0; i < numberObjects_; i++) object_[i] = (rhs.object_[i])->clone(); } else { object_ = NULL; } } else { // assume will be redone numberObjects_ = 0; object_ = NULL; } delete [] originalColumns_; if (rhs.originalColumns_) { int numberColumns = rhs.getNumCols(); originalColumns_ = new int [numberColumns]; memcpy(originalColumns_, rhs.originalColumns_, numberColumns*sizeof(int)); } else { originalColumns_ = NULL; } nodeCompare_ = rhs.nodeCompare_->clone(); problemFeasibility_ = rhs.problemFeasibility_->clone(); delete tree_; tree_ = rhs.tree_->clone(); if (rhs.branchingMethod_) branchingMethod_ = rhs.branchingMethod_->clone(); else branchingMethod_ = NULL; if (rhs.cutModifier_) cutModifier_ = rhs.cutModifier_->clone(); else cutModifier_ = NULL; delete strategy_; if (rhs.strategy_) strategy_ = rhs.strategy_->clone(); else strategy_ = NULL; parentModel_ = rhs.parentModel_; appData_ = rhs.appData_; delete [] integerVariable_; numberIntegers_ = rhs.numberIntegers_; if (numberIntegers_) { integerVariable_ = new int [numberIntegers_]; memcpy(integerVariable_, rhs.integerVariable_, numberIntegers_*sizeof(int)); integerInfo_ = CoinCopyOfArray(rhs.integerInfo_, rhs.getNumCols()); } else { integerVariable_ = NULL; integerInfo_ = NULL; } if (rhs.hotstartSolution_) { int numberColumns = solver_->getNumCols(); hotstartSolution_ = CoinCopyOfArray(rhs.hotstartSolution_, numberColumns); hotstartPriorities_ = CoinCopyOfArray(rhs.hotstartPriorities_, numberColumns); } else { hotstartSolution_ = NULL; hotstartPriorities_ = NULL; } numberRowsAtContinuous_ = rhs.numberRowsAtContinuous_; cutoffRowNumber_ = rhs.cutoffRowNumber_; maximumNumberCuts_ = rhs.maximumNumberCuts_; phase_ = rhs.phase_; currentNumberCuts_ = rhs.currentNumberCuts_; maximumDepth_ = rhs.maximumDepth_; delete [] addedCuts_; delete [] walkback_; // These are only used as temporary arrays so need not be filled if (maximumNumberCuts_) { addedCuts_ = new CbcCountRowCut * [maximumNumberCuts_]; } else { addedCuts_ = NULL; } delete [] lastNodeInfo_ ; delete [] lastNumberCuts_ ; delete [] lastCut_; bestSolutionBasis_ = rhs.bestSolutionBasis_; nextRowCut_ = NULL; currentNode_ = NULL; if (maximumDepth_) { walkback_ = new CbcNodeInfo * [maximumDepth_]; lastNodeInfo_ = new CbcNodeInfo * [maximumDepth_] ; lastNumberCuts_ = new int [maximumDepth_] ; } else { walkback_ = NULL; lastNodeInfo_ = NULL; lastNumberCuts_ = NULL; } maximumCuts_ = rhs.maximumCuts_; if (maximumCuts_) { lastCut_ = new const OsiRowCut * [maximumCuts_] ; } else { lastCut_ = NULL; } #ifdef COIN_HAS_NTY if (rhs.symmetryInfo_) symmetryInfo_ = new CbcSymmetry(*rhs.symmetryInfo_); else symmetryInfo_ = NULL; #endif synchronizeModel(); cbcColLower_ = NULL; cbcColUpper_ = NULL; cbcRowLower_ = NULL; cbcRowUpper_ = NULL; cbcColSolution_ = NULL; cbcRowPrice_ = NULL; cbcReducedCost_ = NULL; cbcRowActivity_ = NULL; } return *this; } // Destructor CbcModel::~CbcModel () { if (defaultHandler_) { delete handler_; handler_ = NULL; } delete tree_; tree_ = NULL; if (modelOwnsSolver()) { delete solver_; solver_ = NULL; } gutsOfDestructor(); delete eventHandler_ ; eventHandler_ = NULL ; #ifdef CBC_THREAD // Get rid of all threaded stuff delete master_; #endif } // Clears out as much as possible (except solver) void CbcModel::gutsOfDestructor() { delete referenceSolver_; referenceSolver_ = NULL; int i; for (i = 0; i < numberCutGenerators_; i++) { delete generator_[i]; delete virginGenerator_[i]; } delete [] generator_; delete [] virginGenerator_; generator_ = NULL; virginGenerator_ = NULL; for (i = 0; i < numberHeuristics_; i++) delete heuristic_[i]; delete [] heuristic_; heuristic_ = NULL; delete nodeCompare_; nodeCompare_ = NULL; delete problemFeasibility_; problemFeasibility_ = NULL; delete [] originalColumns_; originalColumns_ = NULL; delete strategy_; delete [] updateItems_; updateItems_ = NULL; numberUpdateItems_ = 0; maximumNumberUpdateItems_ = 0; gutsOfDestructor2(); } // Clears out enough to reset CbcModel void CbcModel::gutsOfDestructor2() { delete [] integerInfo_; integerInfo_ = NULL; delete [] integerVariable_; integerVariable_ = NULL; int i; if (ownObjects_) { for (i = 0; i < numberObjects_; i++) delete object_[i]; delete [] object_; } ownObjects_ = true; object_ = NULL; numberIntegers_ = 0; numberObjects_ = 0; // Below here is whatever consensus is ownership_ = 0x80000000; delete branchingMethod_; branchingMethod_ = NULL; delete cutModifier_; cutModifier_ = NULL; topOfTree_ = NULL; resetModel(); #ifdef COIN_HAS_NTY delete symmetryInfo_; symmetryInfo_ = NULL; #endif } // Clears out enough to reset CbcModel void CbcModel::resetModel() { delete emptyWarmStart_ ; emptyWarmStart_ = NULL; delete continuousSolver_; continuousSolver_ = NULL; numberSavedSolutions_ = 0; delete [] bestSolution_; bestSolution_ = NULL; if (savedSolutions_) { for (int i = 0; i < maximumSavedSolutions_; i++) delete [] savedSolutions_[i]; delete [] savedSolutions_; savedSolutions_ = NULL; } delete [] currentSolution_; currentSolution_ = NULL; delete [] continuousSolution_; continuousSolution_ = NULL; solverCharacteristics_ = NULL; delete [] usedInSolution_; usedInSolution_ = NULL; testSolution_ = NULL; lastHeuristic_ = NULL; delete [] addedCuts_; addedCuts_ = NULL; nextRowCut_ = NULL; currentNode_ = NULL; delete [] walkback_; walkback_ = NULL; delete [] lastNodeInfo_ ; lastNodeInfo_ = NULL; delete [] lastNumberCuts_ ; lastNumberCuts_ = NULL; delete [] lastCut_; lastCut_ = NULL; delete [] whichGenerator_; whichGenerator_ = NULL; for (int i = 0; i < maximumStatistics_; i++) delete statistics_[i]; delete [] statistics_; statistics_ = NULL; maximumDepthActual_ = 0; numberDJFixed_ = 0.0; if (probingInfo_) { delete probingInfo_; probingInfo_ = NULL; if (!generator_) numberCutGenerators_=0; // also get rid of cut generator int n=0; for (int i = 0; i < numberCutGenerators_; i++) { CglImplication * cutGen; cutGen = dynamic_cast(generator_[i]->generator()); if (!cutGen) { generator_[n]=generator_[i]; virginGenerator_[n]=virginGenerator_[i]; n++; } else { cutGen->setProbingInfo(NULL); delete generator_[i]; cutGen = dynamic_cast(virginGenerator_[i]->generator()); assert (cutGen); cutGen->setProbingInfo(NULL); delete virginGenerator_[i]; } } numberCutGenerators_=n; } maximumStatistics_ = 0; delete [] analyzeResults_; analyzeResults_ = NULL; bestObjective_ = COIN_DBL_MAX; bestPossibleObjective_ = COIN_DBL_MAX; sumChangeObjective1_ = 0.0; sumChangeObjective2_ = 0.0; numberSolutions_ = 0; stateOfSearch_ = 0; delete [] hotstartSolution_; hotstartSolution_ = NULL; delete [] hotstartPriorities_; hotstartPriorities_ = NULL; numberHeuristicSolutions_ = 0; numberNodes_ = 0; numberNodes2_ = 0; numberIterations_ = 0; numberSolves_ = 0; status_ = -1; secondaryStatus_ = -1; maximumNumberCuts_ = 0; phase_ = 0; currentNumberCuts_ = 0; maximumDepth_ = 0; nextRowCut_ = NULL; currentNode_ = NULL; // clear out tree if (tree_ && tree_->size()) tree_->cleanTree(this, -1.0e100, bestPossibleObjective_) ; subTreeModel_ = NULL; heuristicModel_ = NULL; numberStoppedSubTrees_ = 0; numberInfeasibleNodes_ = 0; numberGlobalViolations_ = 0; numberExtraIterations_ = 0; numberExtraNodes_ = 0; numberFathoms_ = 0; continuousObjective_ = 0.0; originalContinuousObjective_ = 0.0; continuousInfeasibilities_ = 0; numberFixedAtRoot_ = 0; numberFixedNow_ = 0; stoppedOnGap_ = false; eventHappened_ = false; numberLongStrong_ = 0; numberOldActiveCuts_ = 0; numberNewCuts_ = 0; searchStrategy_ = -1; strongStrategy_ = 0; numberStrongIterations_ = 0; // Parameters which need to be reset setCutoff(COIN_DBL_MAX); dblParam_[CbcCutoffIncrement] = 1e-5; dblParam_[CbcCurrentCutoff] = 1.0e100; dblParam_[CbcCurrentObjectiveValue] = 1.0e100; dblParam_[CbcCurrentMinimizationObjectiveValue] = 1.0e100; delete globalConflictCuts_; globalConflictCuts_=NULL; } /* Most of copy constructor mode - 0 copy but don't delete before 1 copy and delete before 2 copy and delete before (but use virgin generators) */ void CbcModel::gutsOfCopy(const CbcModel & rhs, int mode) { minimumDrop_ = rhs.minimumDrop_; specialOptions_ = rhs.specialOptions_; moreSpecialOptions_ = rhs.moreSpecialOptions_; moreSpecialOptions2_ = rhs.moreSpecialOptions2_; numberStrong_ = rhs.numberStrong_; numberBeforeTrust_ = rhs.numberBeforeTrust_; numberPenalties_ = rhs.numberPenalties_; printFrequency_ = rhs.printFrequency_; fastNodeDepth_ = rhs.fastNodeDepth_; howOftenGlobalScan_ = rhs.howOftenGlobalScan_; maximumCutPassesAtRoot_ = rhs.maximumCutPassesAtRoot_; maximumCutPasses_ = rhs.maximumCutPasses_; randomSeed_ = rhs.randomSeed_; multipleRootTries_ = rhs.multipleRootTries_; preferredWay_ = rhs.preferredWay_; resolveAfterTakeOffCuts_ = rhs.resolveAfterTakeOffCuts_; maximumNumberIterations_ = rhs.maximumNumberIterations_; numberSavedSolutions_ = rhs.numberSavedSolutions_; maximumSavedSolutions_ = rhs.maximumSavedSolutions_; if (maximumSavedSolutions_) { int n = solver_->getNumCols(); savedSolutions_ = new double * [maximumSavedSolutions_]; for (int i = 0; i < maximumSavedSolutions_; i++) savedSolutions_[i] = CoinCopyOfArray(rhs.savedSolutions_[i], n + 2); } continuousPriority_ = rhs.continuousPriority_; numberThreads_ = rhs.numberThreads_; threadMode_ = rhs.threadMode_; numberGlobalCutsIn_ = rhs.numberGlobalCutsIn_; delete master_; master_ = NULL; masterThread_ = NULL; memcpy(intParam_, rhs.intParam_, sizeof(intParam_)); memcpy(dblParam_, rhs.dblParam_, sizeof(dblParam_)); int i; if (mode) { for (i = 0; i < numberCutGenerators_; i++) { delete generator_[i]; delete virginGenerator_[i]; } delete [] generator_; delete [] virginGenerator_; for (i = 0; i < numberHeuristics_; i++) { delete heuristic_[i]; } delete [] heuristic_; delete eventHandler_; delete branchingMethod_; } numberCutGenerators_ = rhs.numberCutGenerators_; if (numberCutGenerators_) { generator_ = new CbcCutGenerator * [numberCutGenerators_]; virginGenerator_ = new CbcCutGenerator * [numberCutGenerators_]; int i; for (i = 0; i < numberCutGenerators_; i++) { if (mode < 2) { generator_[i] = new CbcCutGenerator(*rhs.generator_[i]); } else { generator_[i] = new CbcCutGenerator(*rhs.virginGenerator_[i]); // But copy across maximumTries and switches generator_[i]->setMaximumTries(rhs.generator_[i]->maximumTries()); generator_[i]->setSwitches(rhs.generator_[i]->switches()); } virginGenerator_[i] = new CbcCutGenerator(*rhs.virginGenerator_[i]); } } else { generator_ = NULL; virginGenerator_ = NULL; } numberHeuristics_ = rhs.numberHeuristics_; if (numberHeuristics_) { heuristic_ = new CbcHeuristic * [numberHeuristics_]; int i; for (i = 0; i < numberHeuristics_; i++) { heuristic_[i] = rhs.heuristic_[i]->clone(); } } else { heuristic_ = NULL; } if (rhs.eventHandler_) eventHandler_ = rhs.eventHandler_->clone() ; else eventHandler_ = NULL ; if (rhs.branchingMethod_) branchingMethod_ = rhs.branchingMethod_->clone(); else branchingMethod_ = NULL; messageHandler()->setLogLevel(rhs.messageHandler()->logLevel()); whenCuts_ = rhs.whenCuts_; #ifdef COIN_HAS_NTY if (rhs.symmetryInfo_) symmetryInfo_ = new CbcSymmetry (*rhs.symmetryInfo_); else symmetryInfo_ = NULL; #endif synchronizeModel(); } // Move status, nodes etc etc across void CbcModel::moveInfo(const CbcModel & rhs) { bestObjective_ = rhs.bestObjective_; bestPossibleObjective_ = rhs.bestPossibleObjective_; numberSolutions_ = rhs.numberSolutions_; numberHeuristicSolutions_ = rhs.numberHeuristicSolutions_; numberNodes_ = rhs.numberNodes_; numberNodes2_ = rhs.numberNodes2_; numberIterations_ = rhs.numberIterations_; numberSolves_ = rhs.numberSolves_; status_ = rhs.status_; secondaryStatus_ = rhs.secondaryStatus_; numberStoppedSubTrees_ = rhs.numberStoppedSubTrees_; numberInfeasibleNodes_ = rhs.numberInfeasibleNodes_; continuousObjective_ = rhs.continuousObjective_; originalContinuousObjective_ = rhs.originalContinuousObjective_; continuousInfeasibilities_ = rhs.continuousInfeasibilities_; numberFixedAtRoot_ = rhs.numberFixedAtRoot_; numberFixedNow_ = rhs.numberFixedNow_; stoppedOnGap_ = rhs.stoppedOnGap_; eventHappened_ = rhs.eventHappened_; numberLongStrong_ = rhs.numberLongStrong_; numberStrongIterations_ = rhs.numberStrongIterations_; strongInfo_[0] = rhs.strongInfo_[0]; strongInfo_[1] = rhs.strongInfo_[1]; strongInfo_[2] = rhs.strongInfo_[2]; strongInfo_[3] = rhs.strongInfo_[3]; strongInfo_[4] = rhs.strongInfo_[4]; strongInfo_[5] = rhs.strongInfo_[5]; strongInfo_[6] = rhs.strongInfo_[6]; numberRowsAtContinuous_ = rhs.numberRowsAtContinuous_; cutoffRowNumber_ = rhs.cutoffRowNumber_; maximumDepth_ = rhs.maximumDepth_; } // Save a copy of the current solver so can be reset to void CbcModel::saveReferenceSolver() { delete referenceSolver_; referenceSolver_ = solver_->clone(); } // Uses a copy of reference solver to be current solver void CbcModel::resetToReferenceSolver() { delete solver_; solver_ = referenceSolver_->clone(); // clear many things gutsOfDestructor2(); // Reset cutoff // Solvers know about direction double direction = solver_->getObjSense(); double value; solver_->getDblParam(OsiDualObjectiveLimit, value); setCutoff(value*direction); } // Are there a numerical difficulties? bool CbcModel::isAbandoned() const { return status_ == 2; } // Is optimality proven? bool CbcModel::isProvenOptimal() const { if (!status_ && bestObjective_ < 1.0e30) return true; else return false; } // Is infeasiblity proven (or none better than cutoff)? bool CbcModel::isProvenInfeasible() const { if (!status_ && (bestObjective_ >= 1.0e30 && (secondaryStatus_==0||secondaryStatus_==1))) return true; else return false; } // Was continuous solution unbounded bool CbcModel::isContinuousUnbounded() const { if (!status_ && secondaryStatus_ == 7) return true; else return false; } // Was continuous solution unbounded bool CbcModel::isProvenDualInfeasible() const { if (!status_ && secondaryStatus_ == 7) return true; else return false; } // Node limit reached? bool CbcModel::isNodeLimitReached() const { return numberNodes_ >= intParam_[CbcMaxNumNode]; } // Time limit reached? bool CbcModel::isSecondsLimitReached() const { if (status_ == 1 && secondaryStatus_ == 4) return true; else return false; } // Solution limit reached? bool CbcModel::isSolutionLimitReached() const { return numberSolutions_ >= intParam_[CbcMaxNumSol]; } // Set language void CbcModel::newLanguage(CoinMessages::Language language) { messages_ = CbcMessage(language); } void CbcModel::setNumberStrong(int number) { if (number < 0) numberStrong_ = 0; else numberStrong_ = number; } void CbcModel::setNumberBeforeTrust(int number) { if (number < -3) { numberBeforeTrust_ = 0; } else { numberBeforeTrust_ = number; //numberStrong_ = CoinMax(numberStrong_,1); } } void CbcModel::setNumberPenalties(int number) { if (number <= 0) { numberPenalties_ = 0; } else { numberPenalties_ = number; } } void CbcModel::setPenaltyScaleFactor(double value) { if (value <= 0) { penaltyScaleFactor_ = 3.0; } else { penaltyScaleFactor_ = value; } } void CbcModel::setHowOftenGlobalScan(int number) { if (number < -1) howOftenGlobalScan_ = 0; else howOftenGlobalScan_ = number; } // Add one generator void CbcModel::addCutGenerator(CglCutGenerator * generator, int howOften, const char * name, bool normal, bool atSolution, bool whenInfeasible, int howOftenInSub, int whatDepth, int whatDepthInSub) { CbcCutGenerator ** temp = generator_; generator_ = new CbcCutGenerator * [numberCutGenerators_+1]; memcpy(generator_, temp, numberCutGenerators_*sizeof(CbcCutGenerator *)); delete[] temp ; generator_[numberCutGenerators_] = new CbcCutGenerator(this, generator, howOften, name, normal, atSolution, whenInfeasible, howOftenInSub, whatDepth, whatDepthInSub); // and before any changes temp = virginGenerator_; virginGenerator_ = new CbcCutGenerator * [numberCutGenerators_+1]; memcpy(virginGenerator_, temp, numberCutGenerators_*sizeof(CbcCutGenerator *)); delete[] temp ; virginGenerator_[numberCutGenerators_++] = new CbcCutGenerator(this, generator, howOften, name, normal, atSolution, whenInfeasible, howOftenInSub, whatDepth, whatDepthInSub); } // Add one heuristic void CbcModel::addHeuristic(CbcHeuristic * generator, const char *name, int before) { CbcHeuristic ** temp = heuristic_; heuristic_ = new CbcHeuristic * [numberHeuristics_+1]; memcpy(heuristic_, temp, numberHeuristics_*sizeof(CbcHeuristic *)); delete [] temp; int where; if (before < 0 || before >= numberHeuristics_) { where = numberHeuristics_; } else { // move up for (int i = numberHeuristics_; i > before; i--) heuristic_[i] = heuristic_[i-1]; where = before; } heuristic_[where] = generator->clone(); if (name) heuristic_[where]->setHeuristicName(name) ; #ifndef SAME_HEURISTIC_SEED heuristic_[where]->setSeed(987654321 + where); #else heuristic_[where]->setSeed(987654321); #endif numberHeuristics_++ ; } /* The last subproblem handled by the solver is not necessarily related to the one being recreated, so the first action is to remove all cuts from the constraint system. Next, traverse the tree from node to the root to determine the basis size required for this subproblem and create an empty basis with the right capacity. Finally, traverse the tree from root to node, adjusting bounds in the constraint system, adjusting the basis, and collecting the cuts that must be added to the constraint system. applyToModel does the heavy lifting. addCuts1 is used in contexts where all that's desired is the list of cuts: the node is already fathomed, and we're collecting cuts so that we can adjust reference counts as we prune nodes. Arguably the two functions should be separated. The culprit is applyToModel, which performs cut collection and model adjustment. Certainly in the contexts where all we need is a list of cuts, there's no point in passing in a valid basis --- an empty basis will do just fine. */ bool CbcModel::addCuts1 (CbcNode * node, CoinWarmStartBasis *&lastws) { int nNode = 0; CbcNodeInfo * nodeInfo = node->nodeInfo(); int numberColumns = getNumCols(); /* Accumulate the path from node to the root in walkback_, and accumulate a cut count in currentNumberCuts. original comment: when working then just unwind until where new node joins old node (for cuts?) */ int currentNumberCuts = 0; while (nodeInfo) { //printf("nNode = %d, nodeInfo = %x\n",nNode,nodeInfo); walkback_[nNode++] = nodeInfo; currentNumberCuts += nodeInfo->numberCuts() ; nodeInfo = nodeInfo->parent() ; if (nNode == maximumDepth_) { redoWalkBack(); } } resizeWhichGenerator(currentNumberCuts_,currentNumberCuts); currentNumberCuts_ = currentNumberCuts; if (currentNumberCuts > maximumNumberCuts_) { maximumNumberCuts_ = currentNumberCuts; delete [] addedCuts_; addedCuts_ = new CbcCountRowCut * [maximumNumberCuts_]; } /* This last bit of code traverses the path collected in walkback_ from the root back to node. At the end of the loop, * lastws will be an appropriate basis for node; * variable bounds in the constraint system will be set to be correct for node; and * addedCuts_ will be set to a list of cuts that need to be added to the constraint system at node. applyToModel does all the heavy lifting. */ bool sameProblem = false; if ((specialOptions_&4096) == 0) { #if 0 { int n1 = numberRowsAtContinuous_; for (int i = 0; i < lastDepth_; i++) n1 += lastNumberCuts_[i]; int n2 = numberRowsAtContinuous_; for (int i = 0; i < nNode; i++) n2 += walkback_[i]->numberCuts(); //printf("ROWS a %d - old thinks %d new %d\n",solver_->getNumRows(),n1,n2); } #endif int nDel = 0; int nAdd = 0; int n = CoinMin(lastDepth_, nNode); int i; int difference = lastDepth_ - nNode; int iZ = lastDepth_; int iN = 0; // Last is reversed to minimize copying if (difference > 0) { for (i = 0; i < difference; i++) { // delete rows nDel += lastNumberCuts_[--iZ]; } } else if (difference < 0) { for (i = 0; i < -difference; i++) { // add rows nAdd += walkback_[i]->numberCuts(); } iN = -difference; } for (i = 0; i < n; i++) { iZ--; if (lastNodeInfo_[iZ] == walkback_[iN]) { break; } else { // delete rows nDel += lastNumberCuts_[iZ]; // add rows nAdd += walkback_[iN++]->numberCuts(); } } assert (i < n || lastDepth_ == 0); //printf("lastDepth %d thisDepth %d match at %d, rows+-= %d %d\n", // lastDepth_,nNode,n-i,nAdd,nDel); sameProblem = (!nAdd) && (!nDel); if (lastDepth_) { while (iN >= 0) { lastNumberCuts_[iZ] = walkback_[iN]->numberCuts(); lastNodeInfo_[iZ++] = walkback_[iN--]; } } else { lastNumberCuts_[0] = walkback_[0]->numberCuts(); lastNodeInfo_[0] = walkback_[0]; } lastDepth_ = nNode; } currentDepth_ = nNode; /* Remove all cuts from the constraint system. (original comment includes ``see note below for later efficiency'', but the reference isn't clear to me). */ /* Create an empty basis with sufficient capacity for the constraint system we'll construct: original system plus cuts. Make sure we have capacity to record those cuts in addedCuts_. The method of adjusting the basis at a FullNodeInfo object (the root, for example) is to use a copy constructor to duplicate the basis held in the nodeInfo, then resize it and return the new basis object. Guaranteed, lastws will point to a different basis when it returns. We pass in a basis because we need the parameter to return the allocated basis, and it's an easy way to pass in the size. But we take a hit for memory allocation. */ if (lastws) lastws->setSize(numberColumns, numberRowsAtContinuous_ + currentNumberCuts); currentNumberCuts = 0; while (nNode) { --nNode; walkback_[nNode]->applyToModel(this, lastws, addedCuts_, currentNumberCuts); } #ifndef NDEBUG if (lastws&&!lastws->fullBasis()) { #ifdef COIN_DEVELOP printf("******* bad basis\n"); #endif int numberRows = lastws->getNumArtificial(); int i; for (i = 0; i < numberRows; i++) lastws->setArtifStatus(i, CoinWarmStartBasis::basic); int numberColumns = lastws->getNumStructural(); for (i = 0; i < numberColumns; i++) { if (lastws->getStructStatus(i) == CoinWarmStartBasis::basic) lastws->setStructStatus(i, CoinWarmStartBasis::atLowerBound); } } #endif return sameProblem; } /* adjustCuts might be a better name: If the node is feasible, we sift through the cuts collected by addCuts1, add the ones that are tight and omit the ones that are loose. If the node is infeasible, we just adjust the reference counts to reflect that we're about to prune this node and its descendants. */ int CbcModel::addCuts (CbcNode *node, CoinWarmStartBasis *&lastws) { /* addCuts1 performs step 1 of restoring the subproblem at this node; see the comments there. */ bool sameProblem = addCuts1(node, lastws); int i; int numberColumns = getNumCols(); if (solver_->getNumRows() > maximumRows_) { maximumRows_ = solver_->getNumRows(); workingBasis_.resize(maximumRows_, numberColumns); } CbcNodeInfo * nodeInfo = node->nodeInfo(); double cutoff = getCutoff() ; int currentNumberCuts = currentNumberCuts_; /* If the node can't be fathomed by bound, reinstall tight cuts in the constraint system. Even if there are no cuts, we'll want to set the reconstructed basis in the solver. */ if (node->objectiveValue() < cutoff || numberThreads_) { //# define CBC_CHECK_BASIS # ifdef CBC_CHECK_BASIS printf("addCuts: expanded basis; rows %d+%d\n", numberRowsAtContinuous_, currentNumberCuts); lastws->print(); # endif /* Adjust the basis and constraint system so that we retain only active cuts. There are three steps: 1) Scan the basis. Sort the cuts into effective cuts to be kept and loose cuts to be dropped. 2) Drop the loose cuts and resize the basis to fit. 3) Install the tight cuts in the constraint system (applyRowCuts) and and install the basis (setWarmStart). Use of compressRows conveys we're compressing the basis and not just tweaking the artificialStatus_ array. */ if (currentNumberCuts > 0) { int numberToAdd = 0; const OsiRowCut **addCuts; int numberToDrop = 0 ; int *cutsToDrop ; addCuts = new const OsiRowCut* [currentNumberCuts]; cutsToDrop = new int[currentNumberCuts] ; assert (currentNumberCuts + numberRowsAtContinuous_ <= lastws->getNumArtificial()); assert (currentNumberCuts <= maximumWhich_); // we will read from whichGenerator_[0..currentNumberCuts-1] below, so should have all these entries // the above assert fails in certain situations, which indicates a bug in the code below // as a workaround, resize whichGenerator_ to make sure we can read all entries without an invalid read from valgrind (and subsequent crash somewhere, seems so) resizeWhichGenerator(maximumWhich_, currentNumberCuts); for (i = 0; i < currentNumberCuts; i++) { CoinWarmStartBasis::Status status = lastws->getArtifStatus(i + numberRowsAtContinuous_); if (addedCuts_[i] && (status != CoinWarmStartBasis::basic || (addedCuts_[i]->effectiveness() > 1.0e10 && !addedCuts_[i]->canDropCut(solver_, i + numberRowsAtContinuous_)))) { # ifdef CHECK_CUT_COUNTS printf("Using cut %d %x as row %d\n", i, addedCuts_[i], numberRowsAtContinuous_ + numberToAdd); # endif assert (igetRowCutDebugger() ; if (debugger) CoinAssert (!debugger->invalidCut(*addedCuts_[i])); } #endif } else { # ifdef CHECK_CUT_COUNTS printf("Dropping cut %d %x\n", i, addedCuts_[i]); # endif addedCuts_[i] = NULL; cutsToDrop[numberToDrop++] = numberRowsAtContinuous_ + i ; } } assert (lastws->fullBasis()); int numberRowsNow = numberRowsAtContinuous_ + numberToAdd; lastws->compressRows(numberToDrop, cutsToDrop) ; lastws->resize(numberRowsNow, numberColumns); // Take out as local search can give bad basisassert (lastws->fullBasis()); bool canMissStuff = false; if ((specialOptions_&4096) == 0) { bool redoCuts = true; if (CoinAbs(lastNumberCuts2_ - numberToAdd) < 5) { int numberToCheck = CoinMin(lastNumberCuts2_, numberToAdd); int i1 = 0; int i2 = 0; int nDiff = 0; int nSame = 0; if (lastNumberCuts2_ == numberToAdd) { for (int i = 0; i < numberToCheck; i++) { if (lastCut_[i1++] != addCuts[i2++]) { nDiff++; } else { nSame++; } } } else if (lastNumberCuts2_ > numberToAdd) { int nDiff2 = lastNumberCuts2_ - numberToAdd; for (int i = 0; i < numberToCheck; i++) { if (lastCut_[i1] != addCuts[i2]) { nDiff++; while (nDiff2) { i1++; nDiff2--; if (lastCut_[i1] == addCuts[i2]) { nSame++; break; } else { nDiff++; } } } else { nSame++; } } nDiff += nDiff2; } else { int nDiff2 = numberToAdd - lastNumberCuts2_; for (int i = 0; i < numberToCheck; i++) { if (lastCut_[i1] != addCuts[i2]) { nDiff++; while (nDiff2) { i2++; nDiff2--; if (lastCut_[i1] == addCuts[i2]) { nSame++; break; } else { nDiff++; } } } else { nSame++; } } nDiff += nDiff2; } canMissStuff = !nDiff && sameProblem; // But only if number of rows looks OK if (numberRowsAtContinuous_ + numberToAdd != solver_->getNumRows()) canMissStuff = false; } else { //printf("add now %d add last %d NO2\n",numberToAdd,lastNumberCuts2_); } assert (lastws->fullBasis() && numberRowsAtContinuous_ + numberToAdd == numberRowsNow); if (redoCuts) { if (numberToAdd > maximumCuts_) { delete [] lastCut_; maximumCuts_ = 2 * numberToAdd + 10; lastCut_ = new const OsiRowCut * [maximumCuts_]; } lastNumberCuts2_ = numberToAdd; for (int i = 0; i < numberToAdd; i++) lastCut_[i] = addCuts[i]; } } if (!canMissStuff) { //if (canMissStuff) //solver_->writeMps("before"); //printf("Not Skipped\n"); //int n1=solver_->getNumRows(); if ((specialOptions_&4096) == 0) { solver_->restoreBaseModel(numberRowsAtContinuous_); } else { // *** Fix later int numberCuts = solver_->getNumRows() - numberRowsAtContinuous_; int *which = new int[numberCuts]; for (i = 0 ; i < numberCuts ; i++) which[i] = i + numberRowsAtContinuous_; solver_->deleteRows(numberCuts, which); delete [] which; } //#define CHECK_DEBUGGER #ifdef CHECK_DEBUGGER if ((specialOptions_&1) != 0 ) { const OsiRowCutDebugger * debugger = solver_->getRowCutDebugger(); if (debugger) { for (int j=0;jinvalidCut(*addCuts[j])); //addCuts[j]->print(); } } #endif solver_->applyRowCuts(numberToAdd, addCuts); } # ifdef CBC_CHECK_BASIS printf("addCuts: stripped basis; rows %d + %d\n", numberRowsAtContinuous_, numberToAdd); lastws->print(); # endif delete [] addCuts; delete [] cutsToDrop ; } /* Set the basis in the solver. */ solver_->setWarmStart(lastws); /* Clean up and we're out of here. */ numberNodes_++; return 0; } /* This node has been fathomed by bound as we try to revive it out of the live set. Adjust the cut reference counts to reflect that we no longer need to explore the remaining branch arms, hence they will no longer reference any cuts. Cuts whose reference count falls to zero are deleted. */ else { int i; if (currentNumberCuts) { lockThread(); int numberLeft = nodeInfo->numberBranchesLeft(); for (i = 0 ; i < currentNumberCuts ; i++) { if (addedCuts_[i]) { if (!addedCuts_[i]->decrement(numberLeft)) { delete addedCuts_[i]; addedCuts_[i] = NULL; } } } unlockThread(); } return 1 ; } } /* Makes all handlers same. If makeDefault 1 then makes top level default and rest point to that. If 2 then each is copy */ void CbcModel::synchronizeHandlers(int /*makeDefault*/) { bool defaultHandler = defaultHandler_; if (!defaultHandler_) { // Must have clone handler_ = handler_->clone(); defaultHandler_ = true; } #ifdef COIN_HAS_CLP if (!defaultHandler) { OsiClpSolverInterface * solver; solver = dynamic_cast(solver_) ; if (solver) { solver->passInMessageHandler(handler_); solver->getModelPtr()->passInMessageHandler(handler_); } solver = dynamic_cast(continuousSolver_) ; if (solver) { solver->passInMessageHandler(handler_); solver->getModelPtr()->passInMessageHandler(handler_); } } #endif } /* Perform reduced cost fixing on integer variables. The variables in question are already nonbasic at bound. We're just nailing down the current situation. */ int CbcModel::reducedCostFix () { if (!solverCharacteristics_->reducedCostsAccurate()) return 0; //NLP double cutoff = getCutoff() ; double direction = solver_->getObjSense() ; double gap = cutoff - solver_->getObjValue() * direction ; double tolerance; solver_->getDblParam(OsiDualTolerance, tolerance) ; if (gap <= 0.0) gap = tolerance; //return 0; gap += 100.0 * tolerance; double integerTolerance = getDblParam(CbcIntegerTolerance) ; const double *lower = solver_->getColLower() ; const double *upper = solver_->getColUpper() ; const double *solution = solver_->getColSolution() ; const double *reducedCost = solver_->getReducedCost() ; int numberFixed = 0 ; int numberTightened = 0 ; # ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); ClpSimplex * clpSimplex = NULL; if (clpSolver) clpSimplex = clpSolver->getModelPtr(); # endif for (int i = 0 ; i < numberIntegers_ ; i++) { int iColumn = integerVariable_[i] ; double djValue = direction * reducedCost[iColumn] ; double boundGap = upper[iColumn] - lower[iColumn]; if (boundGap > integerTolerance) { if (solution[iColumn] < lower[iColumn] + integerTolerance && djValue*boundGap > gap) { #ifdef COIN_HAS_CLP // may just have been fixed before if (clpSimplex) { if (clpSimplex->getColumnStatus(iColumn) == ClpSimplex::basic) { #ifdef COIN_DEVELOP printf("DJfix %d has status of %d, dj of %g gap %g, bounds %g %g\n", iColumn, clpSimplex->getColumnStatus(iColumn), djValue, gap, lower[iColumn], upper[iColumn]); #endif } else { assert(clpSimplex->getColumnStatus(iColumn) == ClpSimplex::atLowerBound || clpSimplex->getColumnStatus(iColumn) == ClpSimplex::isFixed); } } #endif double newBound = lower[iColumn]; if (boundGap > 1.99) { boundGap = gap / djValue + 1.0e-4 * boundGap; newBound = lower[iColumn] + floor(boundGap); numberTightened++; //if (newBound) //printf("tighter - gap %g dj %g newBound %g\n", // gap,djValue,newBound); } solver_->setColUpper(iColumn, newBound) ; numberFixed++ ; } else if (solution[iColumn] > upper[iColumn] - integerTolerance && -djValue > boundGap*gap) { #ifdef COIN_HAS_CLP // may just have been fixed before if (clpSimplex) { if (clpSimplex->getColumnStatus(iColumn) == ClpSimplex::basic) { #ifdef COIN_DEVELOP printf("DJfix %d has status of %d, dj of %g gap %g, bounds %g %g\n", iColumn, clpSimplex->getColumnStatus(iColumn), djValue, gap, lower[iColumn], upper[iColumn]); #endif } else { assert(clpSimplex->getColumnStatus(iColumn) == ClpSimplex::atUpperBound || clpSimplex->getColumnStatus(iColumn) == ClpSimplex::isFixed); } } #endif double newBound = upper[iColumn]; if (boundGap > 1.99) { boundGap = -gap / djValue + 1.0e-4 * boundGap; newBound = upper[iColumn] - floor(boundGap); //if (newBound) //printf("tighter - gap %g dj %g newBound %g\n", // gap,djValue,newBound); numberTightened++; } solver_->setColLower(iColumn, newBound) ; numberFixed++ ; } } } numberDJFixed_ += numberFixed - numberTightened; #ifdef SWITCH_VARIABLES if (numberFixed) fixAssociated(NULL,0); #endif return numberFixed; } // Collect coding to replace whichGenerator void CbcModel::resizeWhichGenerator(int numberNow, int numberAfter) { if (numberAfter > maximumWhich_) { #define MAXIMUM_WHICH_INCREMENT 100 #define MAXIMUM_WHICH_MULTIPLIER 2 //printf("maximumWhich from %d to %d (%d needed)\n",maximumWhich_, // CoinMax(maximumWhich_ * MAXIMUM_WHICH_MULTIPLIER + MAXIMUM_WHICH_INCREMENT, numberAfter), // numberAfter); maximumWhich_ = CoinMax(maximumWhich_ * MAXIMUM_WHICH_MULTIPLIER + MAXIMUM_WHICH_INCREMENT, numberAfter) ; //maximumWhich_ = numberAfter ; int * temp = new int[2*maximumWhich_] ; memcpy(temp, whichGenerator_, numberNow*sizeof(int)) ; delete [] whichGenerator_ ; whichGenerator_ = temp ; memset(whichGenerator_ + numberNow, 0, (maximumWhich_ - numberNow)*sizeof(int)); } } /** Solve the model using cuts This version takes off redundant cuts from node. Returns true if feasible. \todo Why do I need to resolve the problem? What has been done between the last relaxation and calling solveWithCuts? If numberTries == 0 then user did not want any cuts. */ bool CbcModel::solveWithCuts (OsiCuts &cuts, int numberTries, CbcNode *node) /* Parameters: numberTries: (i) the maximum number of iterations for this round of cut generation; if negative then we don't mind if drop is tiny. cuts: (o) all cuts generated in this round of cut generation node: (i) So we can update dynamic pseudo costs */ { #ifdef JJF_ZERO if (node && numberTries > 1) { if (currentDepth_ < 5) numberTries *= 4; // boost else if (currentDepth_ < 10) numberTries *= 2; // boost } #endif #define CUT_HISTORY 7 double cut_obj[CUT_HISTORY]; for (int j = 0; j < CUT_HISTORY; j++) cut_obj[j] = -COIN_DBL_MAX; # ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); int saveClpOptions = 0; if (clpSolver) saveClpOptions = clpSolver->specialOptions(); # endif //solver_->writeMps("saved"); #ifdef CBC_THREAD /* Thread mode makes a difference here only when it specifies using separate threads to generate cuts at the root (bit 2^1 set in threadMode_). In which case we'll create an array of empty CbcModels (!). Solvers will be cloned later. Don't start up threads here if we're already threaded. */ CbcBaseModel * master = NULL; if (numberThreads_ && (threadMode_&2) != 0 && !numberNodes_) { master = new CbcBaseModel(*this, -1); } #endif bool feasible = true ; int violated = 0 ; int numberRowsAtStart = solver_->getNumRows() ; //printf("solver had %d rows\n",numberRowsAtStart); int numberColumns = solver_->getNumCols() ; CoinBigIndex numberElementsAtStart = solver_->getNumElements(); numberOldActiveCuts_ = numberRowsAtStart - numberRowsAtContinuous_ ; numberNewCuts_ = cuts.sizeRowCuts(); int lastNumberCuts = numberNewCuts_ ; if (numberNewCuts_) { // from multiple root passes const OsiRowCut **addCuts = new const OsiRowCut* [numberNewCuts_]; for (int i = 0; i < numberNewCuts_; i++) { addCuts[i] = cuts.rowCutPtr(i); } solver_->applyRowCuts(numberNewCuts_, addCuts); delete [] addCuts; } bool onOptimalPath = false ; const OsiRowCutDebugger *debugger = NULL; if ((specialOptions_&1) != 0) { /* See OsiRowCutDebugger for details. In a nutshell, make sure that current variable values do not conflict with a known optimal solution. (Obviously this can be fooled when there are multiple solutions.) */ debugger = solver_->getRowCutDebugger() ; if (debugger) onOptimalPath = (debugger->onOptimalPath(*solver_)) ; } /* As the final action in each round of cut generation (the numberTries loop), we'll call takeOffCuts to remove slack cuts. These are saved into slackCuts and rechecked immediately after the cut generation phase of the loop. */ OsiCuts slackCuts; /* lh: Resolve the problem The resolve will also refresh cached copies of the solver solution (cbcColLower_, ...) held by CbcModel. This resolve looks like the best point to capture a warm start for use in the case where cut generation proves ineffective and we need to back out a few tight cuts. I've always maintained that this resolve is unnecessary. Let's put in a hook to report if it's every nontrivial. -lh Resolve the problem. If we've lost feasibility, might as well bail out right after the debug stuff. The resolve will also refresh cached copies of the solver solution (cbcColLower_, ...) held by CbcModel. */ double objectiveValue = solver_->getObjValue() * solver_->getObjSense(); if (node) { objectiveValue = node->objectiveValue(); } int save = moreSpecialOptions_; if ((moreSpecialOptions_&4194304)!=0) moreSpecialOptions_ |= 8388608; int returnCode = resolve(node ? node->nodeInfo() : NULL, 1); moreSpecialOptions_=save; #ifdef CONFLICT_CUTS #ifdef COIN_HAS_CLP // if infeasible conflict analysis if (solver_->isProvenPrimalInfeasible()&&!parentModel_&& (moreSpecialOptions_&4194304)!=0&&clpSolver) { if (!topOfTree_ && masterThread_) topOfTree_ = masterThread_->master_->baseModel_->topOfTree_; assert (topOfTree_); int iType=0; OsiRowCut * cut = clpSolver->modelCut(topOfTree_->lower(), topOfTree_->upper(), numberRowsAtContinuous_,whichGenerator_,iType); if (cut) { //cut->print(); if (!iType) { int badCut = makeGlobalCut(cut) ; if (!badCut) { #if PRINT_CONFLICT==1 numberConflictCuts++; lengthConflictCuts += cut->row().getNumElements(); #endif #if PRINT_CONFLICT<2 if (handler_->logLevel() > 1) { #endif printf("Conflict cut at depth %d (%d elements)\n", currentDepth_,cut->row().getNumElements()); if (cut->row().getNumElements()<3) cut->print(); #if PRINT_CONFLICT<2 } #endif } if ((specialOptions_&1) != 0) { debugger = continuousSolver_->getRowCutDebugger() ; if (debugger) { if (debugger->invalidCut(*cut)) { continuousSolver_->applyRowCuts(1,cut); continuousSolver_->writeMps("bad"); } CoinAssert (!debugger->invalidCut(*cut)); } } } else { makePartialCut(cut); } delete cut; } } if ((moreSpecialOptions_&4194304)!=0&&solver_->isProvenPrimalInfeasible() &&clpSolver&&clpSolver->lastAlgorithm()==2&& clpSolver->getModelPtr()->infeasibilityRay()&& !parentModel_) { printf("ray exists\n"); } #endif #endif double lastObjective = solver_->getObjValue() * solver_->getObjSense(); cut_obj[CUT_HISTORY-1] = lastObjective; //double firstObjective = lastObjective+1.0e-8+1.0e-12*fabs(lastObjective); /* Contemplate the result of the resolve. - CbcModel::resolve() has a hook that calls CbcStrategy::status to look over the solution. The net result is that resolve can return 0 (infeasible), 1 (feasible), or -1 (feasible, but do no further work). - CbcFeasbililityBase::feasible() can return 0 (no comment), 1 (pretend this is an integer solution), or -1 (pretend this is infeasible). As of 080104, this seems to be a stub to allow overrides, with a default implementation that always returns 0. Setting numberTries = 0 for `do no more work' is problematic. The main cut generation loop will still execute once, so we do not observe the `no further work' semantics. As best I can see, allBranchesGone is a null function as of 071220. */ if (node && node->nodeInfo() && !node->nodeInfo()->numberBranchesLeft()) node->nodeInfo()->allBranchesGone(); // can clean up feasible = returnCode != 0 ; if (returnCode < 0) numberTries = 0; if (problemFeasibility_->feasible(this, 0) < 0) { feasible = false; // pretend infeasible } //#define CHECK_KNOWN_SOLUTION #ifdef CHECK_KNOWN_SOLUTION if (onOptimalPath && (solver_->isDualObjectiveLimitReached()|| !feasible)) { printf("help 1\n"); } #endif /* NEW_UPDATE_OBJECT is defined to 0 when unthreaded (CBC_THREAD undefined), 2 when threaded. No sign of 1 as of 071220. At present, there are two sets of hierarchies for branching classes. Call them CbcHier and OsiHier. For example, we have OsiBranchingObject, with children CbcBranchingObject and OsiTwoWayBranchingObject. All specialisations descend from one of these two children. Similarly, there is OsiObject, with children CbcObject and OsiObject2. In the original setup, there's a single CbcBranchDecision object attached to CbcModel (branchingMethod_). It has a field to hold the current CbcHier branching object, and the updateInformation routine reaches through the branching object to update the underlying CbcHier object. NEW_UPDATE_OBJECT = 0 would seem to assume the original setup. But, if we're using the OSI hierarchy for objects and branching, a call to a nontrivial branchingMethod_->updateInformation would have no effect (it would expect a CbcObject to work on) or perhaps crash. For the default CbcBranchDefaultDecision, updateInformation is a noop (actually defined in the base CbcBranchDecision class). NEW_UPDATE_OBJECT = 2 looks like it's prepared to cope with either CbcHier or OsiHier, but it'll be executed only when threads are activated. See the comments below. The setup is scary. But ... if the OsiHier update actually reaches right through to the object list in the solver, it should work just fine in unthreaded mode. It would seem that the appropriate thing to do in unthreaded mode would be to choose between the existing code for NEW_UPDATE_OBJECT = 0 and the OsiHier code for NEW_UPDATE_OBJECT = 2. But I'm going to let John hash that out. The worst that can happen is inefficiency because I'm not properly updating an object. */ // Update branching information if wanted if (node && branchingMethod_) { OsiBranchingObject * bobj = node->modifiableBranchingObject(); CbcBranchingObject * cbcobj = dynamic_cast (bobj); if (cbcobj && cbcobj->object()) { CbcObject * object = cbcobj->object(); CbcObjectUpdateData update = object->createUpdateInformation(solver_, node, cbcobj); // have to compute object number as not saved CbcSimpleInteger * simpleObject = static_cast (object) ; int iObject = simpleObject->position(); #ifndef NDEBUG int iColumn = simpleObject->columnNumber(); int jObject; for (jObject = 0 ; jObject < numberObjects_ ; jObject++) { simpleObject = static_cast (object_[jObject]) ; if (simpleObject->columnNumber() == iColumn) break; } assert (jObject < numberObjects_ && iObject == jObject); #else #ifdef CBCMODEL_TIGHTEN_BOUNDS int iColumn = simpleObject->columnNumber(); #endif #endif update.objectNumber_ = iObject; // Care! We must be careful not to update the same variable in parallel threads. addUpdateInformation(update); //#define CBCMODEL_TIGHTEN_BOUNDS #ifdef CBCMODEL_TIGHTEN_BOUNDS double cutoff = getCutoff() ; if (feasible && cutoff < 1.0e20) { int way = cbcobj->way(); // way is what will be taken next way = -way; double value = cbcobj->value(); //const double * lower = solver_->getColLower(); //const double * upper = solver_->getColUpper(); double objectiveChange = lastObjective - objectiveValue; if (objectiveChange > 1.0e-5) { CbcIntegerBranchingObject * branch = dynamic_cast (cbcobj) ; assert (branch); if (way < 0) { double down = value - floor(value); double changePer = objectiveChange / (down + 1.0e-7); double distance = (cutoff - objectiveValue) / changePer; distance += 1.0e-3; if (distance < 5.0) { double newLower = ceil(value - distance); const double * downBounds = branch->downBounds(); if (newLower > downBounds[0]) { //printf("%d way %d bounds %g %g value %g\n", // iColumn,way,lower[iColumn],upper[iColumn],value); //printf("B Could increase lower bound on %d from %g to %g\n", // iColumn,downBounds[0],newLower); solver_->setColLower(iColumn, newLower); } } } else { double up = ceil(value) - value; double changePer = objectiveChange / (up + 1.0e-7); double distance = (cutoff - objectiveValue) / changePer; distance += 1.0e-3; if (distance < 5.0) { double newUpper = floor(value + distance); const double * upBounds = branch->upBounds(); if (newUpper < upBounds[1]) { //printf("%d way %d bounds %g %g value %g\n", // iColumn,way,lower[iColumn],upper[iColumn],value); //printf("B Could decrease upper bound on %d from %g to %g\n", // iColumn,upBounds[1],newUpper); solver_->setColUpper(iColumn, newUpper); } } } } } #endif } else { OsiIntegerBranchingObject * obj = dynamic_cast (bobj); if (obj) { const OsiObject * object = obj->originalObject(); // have to compute object number as not saved int iObject; int iColumn = object->columnNumber(); for (iObject = 0 ; iObject < numberObjects_ ; iObject++) { if (object_[iObject]->columnNumber() == iColumn) break; } assert (iObject < numberObjects_); int branch = obj->firstBranch(); if (obj->branchIndex() == 2) branch = 1 - branch; assert (branch == 0 || branch == 1); double originalValue = node->objectiveValue(); double objectiveValue = solver_->getObjValue() * solver_->getObjSense(); double changeInObjective = CoinMax(0.0, objectiveValue - originalValue); double value = obj->value(); double movement; if (branch) movement = ceil(value) - value; else movement = value - floor(value); branchingMethod_->chooseMethod()->updateInformation(iObject, branch, changeInObjective, movement, 0 /*(feasible) ? 0 : 1; */); } } } #ifdef CBC_DEBUG if (feasible) { printf("Obj value %g (%s) %d rows\n", solver_->getObjValue(), (solver_->isProvenOptimal()) ? "proven" : "unproven", solver_->getNumRows()) ; } else { printf("Infeasible %d rows\n", solver_->getNumRows()) ; } #endif if ((specialOptions_&1) != 0) { /* If the RowCutDebugger said we were compatible with the optimal solution, and now we're suddenly infeasible, we might be confused. Then again, we may have fathomed by bound, heading for a rediscovery of an optimal solution. */ if (onOptimalPath && !solver_->isDualObjectiveLimitReached()) { if (!feasible) { solver_->writeMpsNative("infeas.mps", NULL, NULL, 2); solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_); CoinWarmStartBasis *slack = dynamic_cast(solver_->getEmptyWarmStart()) ; solver_->setWarmStart(slack); delete slack ; solver_->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; solver_->initialSolve(); } assert(feasible) ; } } if (!feasible) { numberInfeasibleNodes_++; # ifdef COIN_HAS_CLP if (clpSolver) clpSolver->setSpecialOptions(saveClpOptions); # endif return (false) ; } double change = lastObjective - objectiveValue; if (change > 1.0e-10) { dblParam_[CbcSmallestChange] = CoinMin(dblParam_[CbcSmallestChange], change); dblParam_[CbcSumChange] += change; dblParam_[CbcLargestChange] = CoinMax(dblParam_[CbcLargestChange], change); intParam_[CbcNumberBranches]++; } sumChangeObjective1_ += solver_->getObjValue() * solver_->getObjSense() - objectiveValue ; if ( maximumSecondsReached() ) numberTries = 0; // exit if ((moreSpecialOptions2_&(2048|4096))!=0 && currentDepth_>5) { // howOftenGlobalScan_ = 10; int type = (moreSpecialOptions2_&(2048|4096))>>11; if (type==1) { int n=0; int k=currentDepth_; while (k) { if ((k&1)!=0) n++; k = k >>1; } if (n>1) numberTries=0; } else if (type==2) { if ((currentDepth_%4)!=0) numberTries=0; } else { if ((currentDepth_%8)!=0) numberTries=0; } } //if ((numberNodes_%100)==0) //printf("XXa sum obj changed by %g\n",sumChangeObjective1_); objectiveValue = solver_->getObjValue() * solver_->getObjSense(); // Return at once if numberTries zero if (!numberTries) { cuts = OsiCuts(); numberNewCuts_ = 0; # ifdef COIN_HAS_CLP if (clpSolver) clpSolver->setSpecialOptions(saveClpOptions); # endif setPointers(solver_); return true; } /* Do reduced cost fixing. */ int xxxxxx = 0; if (xxxxxx) solver_->resolve(); reducedCostFix() ; /* Set up for at most numberTries rounds of cut generation. If numberTries is negative, we'll ignore the minimumDrop_ cutoff and keep generating cuts for the specified number of rounds. */ double minimumDrop = minimumDrop_ ; bool allowZeroIterations = false; int maximumBadPasses = 0; if (numberTries < 0) { numberTries = -numberTries ; // minimumDrop *= 1.0e-5 ; // if (numberTries >= -1000000) { //numberTries=100; minimumDrop = -1.0; // } //numberTries=CoinMax(numberTries,100); allowZeroIterations = true; } int saveNumberTries=numberTries; /* Is it time to scan the cuts in order to remove redundant cuts? If so, set up to do it. */ int fullScan = 0 ; if ((numberNodes_ % SCANCUTS) == 0 || (specialOptions_&256) != 0) { fullScan = 1 ; if (!numberNodes_ || (specialOptions_&256) != 0) fullScan = 2; specialOptions_ &= ~256; // mark as full scan done } double direction = solver_->getObjSense() ; double startObjective = solver_->getObjValue() * direction ; currentPassNumber_ = 0 ; // Really primalIntegerTolerance; relates to an illposed problem with various // integer solutions depending on integer tolerance. //double primalTolerance = 1.0e-7 ; // We may need to keep going on bool keepGoing = false; // Say we have not tried one last time int numberLastAttempts = 0; /* Get experimental option as to when to stop adding cuts 0 - old style 1 - new style 2 - new style plus don't break if zero cuts first time 3 - as 2 but last drop has to be >0.1*min to say OK */ int experimentBreak = (moreSpecialOptions_ >> 11) & 3; // Whether to increase minimum drop bool increaseDrop = (moreSpecialOptions_ & 8192) != 0; for (int i = 0; i < numberCutGenerators_; i++) generator_[i]->setWhetherInMustCallAgainMode(false); /* Begin cut generation loop. Cuts generated during each iteration are collected in theseCuts. The loop can be divided into four phases: 1) Prep: Fix variables using reduced cost. In the first iteration only, consider scanning globalCuts_ and activating any applicable cuts. 2) Cut Generation: Call each generator and heuristic registered in the generator_ and heuristic_ arrays. Newly generated global cuts are copied to globalCuts_ at this time. 3) Cut Installation and Reoptimisation: Install column and row cuts in the solver. Copy row cuts to cuts (parameter). Reoptimise. 4) Cut Purging: takeOffCuts() removes inactive cuts from the solver, and does the necessary bookkeeping in the model. */ do { currentPassNumber_++ ; numberTries-- ; if (numberTries < 0 && keepGoing) { // switch off all normal generators (by the generator's opinion of normal) // Intended for situations where the primal problem really isn't complete, // and there are `not normal' cut generators that will augment. for (int i = 0; i < numberCutGenerators_; i++) { if (!generator_[i]->mustCallAgain()) generator_[i]->setSwitchedOff(true); else generator_[i]->setWhetherInMustCallAgainMode(true); } } keepGoing = false; OsiCuts theseCuts ; /* Scan previously generated global column and row cuts to see if any are useful. */ int numberViolated = 0; if ((currentPassNumber_ == 1 ||!numberNodes_) && howOftenGlobalScan_ > 0 && (numberNodes_ % howOftenGlobalScan_) == 0 && (doCutsNow(1) || true)) { // global column cuts now done in node at top of tree int numberCuts = numberCutGenerators_ ? globalCuts_.sizeRowCuts() : 0; if (numberCuts) { // possibly extend whichGenerator resizeWhichGenerator(numberViolated, numberViolated + numberCuts); // only add new cuts up to 10% of current elements int numberElements = solver_->getNumElements(); int numberColumns = solver_->getNumCols(); int maximumAdd = CoinMax(numberElements/10,2*numberColumns)+100; double * violations = new double[numberCuts]; int * which = new int[numberCuts]; int numberPossible=0; for (int i = 0; i < numberCuts; i++) { OsiRowCut * thisCut = globalCuts_.rowCutPtr(i) ; double violation = thisCut->violated(cbcColSolution_); if(thisCut->effectiveness() == COIN_DBL_MAX) { // see if already there int j; for (j = 0; j < currentNumberCuts_; j++) { if (addedCuts_[j]==thisCut) break; } if (j==currentNumberCuts_) violation = COIN_DBL_MAX; //else //printf("already done??\n"); } if (violation > 0.005) { violations[numberPossible]=-violation; which[numberPossible++]=i; } } CoinSort_2(violations,violations+numberPossible,which); for (int i = 0; i < numberPossible; i++) { int k=which[i]; OsiRowCut * thisCut = globalCuts_.rowCutPtr(k) ; assert (thisCut->violated(cbcColSolution_) > 0.005/*primalTolerance*/ || thisCut->effectiveness() == COIN_DBL_MAX); #define CHECK_DEBUGGER #ifdef CHECK_DEBUGGER if ((specialOptions_&1) != 0 && ! parentModel_) { CoinAssert (!solver_->getRowCutDebuggerAlways()->invalidCut(*thisCut)); } #endif #if 0 //ndef NDEBUG printf("Global cut added - violation %g\n", thisCut->violated(cbcColSolution_)) ; #endif whichGenerator_[numberViolated++] = 20099; #ifndef GLOBAL_CUTS_JUST_POINTERS theseCuts.insert(*thisCut) ; #else theseCuts.insert(thisCut) ; #endif if (violations[i]!=-COIN_DBL_MAX) maximumAdd -= thisCut->row().getNumElements(); if (maximumAdd<0) break; } delete [] which; delete [] violations; numberGlobalViolations_ += numberViolated; } } /* Generate new cuts (global and/or local) and/or apply heuristics. If CglProbing is used, then it should be first as it can fix continuous variables. At present, CglProbing is the only case where generateCuts will return true. generateCuts actually modifies variable bounds in the solver when CglProbing indicates that it can fix a variable. Reoptimisation is required to take full advantage. The need to resolve here should only happen after a heuristic solution. optimalBasisIsAvailable resolves to basisIsAvailable, which seems to be part of the old OsiSimplex API. Doc'n says `Returns true if a basis is available and the problem is optimal. Should be used to see if the BinvARow type operations are possible and meaningful.' Which means any solver other the clp is probably doing a lot of unnecessary resolves right here. (Note default OSI implementation of optimalBasisIsAvailable always returns false.) */ if (solverCharacteristics_->warmStart() && !solver_->optimalBasisIsAvailable()) { //printf("XXXXYY no opt basis\n"); #ifdef JJF_ZERO//def COIN_HAS_CLP //OsiClpSolverInterface * clpSolver //= dynamic_cast (solver_); int save = 0; if (clpSolver) { save = clpSolver->specialOptions(); clpSolver->setSpecialOptions(save | 2048/*4096*/); // Bonmin } #endif resolve(node ? node->nodeInfo() : NULL, 3); #ifdef JJF_ZERO//def COIN_HAS_CLP if (clpSolver) clpSolver->setSpecialOptions(save); #if CBC_USEFUL_PRINTING>1 if (clpSolver->getModelPtr()->numberIterations()) printf("ITS %d pass %d\n", clpSolver->getModelPtr()->numberIterations(), currentPassNumber_); #endif #endif } if (nextRowCut_) { // branch was a cut - add it theseCuts.insert(*nextRowCut_); if (handler_->logLevel() > 1) nextRowCut_->print(); const OsiRowCut * cut = nextRowCut_; double lb = cut->lb(); double ub = cut->ub(); int n = cut->row().getNumElements(); const int * column = cut->row().getIndices(); const double * element = cut->row().getElements(); double sum = 0.0; for (int i = 0; i < n; i++) { int iColumn = column[i]; double value = element[i]; //if (cbcColSolution_[iColumn]>1.0e-7) //printf("value of %d is %g\n",iColumn,cbcColSolution_[iColumn]); sum += value * cbcColSolution_[iColumn]; } delete nextRowCut_; nextRowCut_ = NULL; if (handler_->logLevel() > 1) printf("applying branch cut, sum is %g, bounds %g %g\n", sum, lb, ub); // possibly extend whichGenerator resizeWhichGenerator(numberViolated, numberViolated + 1); // set whichgenerator (also serves as marker to say don't delete0 whichGenerator_[numberViolated++] = 20098; } // reset probing info //if (probingInfo_) //probingInfo_->initializeFixing(); int i; // If necessary make cut generators work harder bool strongCuts = (!node && cut_obj[CUT_HISTORY-1] != -COIN_DBL_MAX && fabs(cut_obj[CUT_HISTORY-1] - cut_obj[CUT_HISTORY-2]) < 1.0e-7 + 1.0e-6 * fabs(cut_obj[CUT_HISTORY-1])); for (i = 0; i < numberCutGenerators_; i++) generator_[i]->setIneffectualCuts(strongCuts); // Print details if (!node) { handler_->message(CBC_ROOT_DETAIL, messages_) << currentPassNumber_ << solver_->getNumRows() << solver_->getNumRows() - numberRowsAtContinuous_ << solver_->getObjValue() << CoinMessageEol ; } //Is Necessary for Bonmin? Always keepGoing if cuts have been generated in last iteration (taken from similar code in Cbc-2.4) if (solverCharacteristics_->solutionAddsCuts()&&numberViolated) { for (i = 0;imustCallAgain()) { keepGoing=true; // say must go round break; } } } if(!keepGoing){ // Status for single pass of cut generation int status = 0; /* threadMode with bit 2^1 set indicates we should use threads for root cut generation. */ if ((threadMode_&2) == 0 || numberNodes_) { status = serialCuts(theseCuts, node, slackCuts, lastNumberCuts); } else { // do cuts independently #ifdef CBC_THREAD status = parallelCuts(master, theseCuts, node, slackCuts, lastNumberCuts); #endif } // Do we need feasible and violated? feasible = (status >= 0); if (status == 1) keepGoing = true; else if (status == 2) numberTries = 0; if (!feasible) violated = -2; } //if (!feasible) //break; /* End of the loop to exercise each generator - try heuristics - unless at root node and first pass */ if ((numberNodes_ || currentPassNumber_ != 1) && true) { double * newSolution = new double [numberColumns] ; double heuristicValue = getCutoff() ; int found = -1; // no solution found int whereFrom = numberNodes_ ? 4 : 1; for (i = 0; i < numberHeuristics_; i++) { // skip if can't run here if (!heuristic_[i]->shouldHeurRun(whereFrom)) continue; // see if heuristic will do anything double saveValue = heuristicValue ; int ifSol = heuristic_[i]->solution(heuristicValue, newSolution); //theseCuts) ; if (ifSol > 0) { // better solution found heuristic_[i]->incrementNumberSolutionsFound(); found = i ; incrementUsed(newSolution); lastHeuristic_ = heuristic_[found]; #ifdef HEURISTIC_INFORM printf("HEUR %s where %d A\n", lastHeuristic_->heuristicName(), whereFrom); #endif // CBC_ROUNDING is symbolic; just says found by heuristic setBestSolution(CBC_ROUNDING, heuristicValue, newSolution) ; whereFrom |= 8; // say solution found } else if (ifSol < 0) { heuristicValue = saveValue ; } } /* Did any of the heuristics turn up a new solution? Record it before we free the vector. */ if (found >= 0) { phase_ = 4; CbcTreeLocal * tree = dynamic_cast (tree_); if (tree) tree->passInSolution(bestSolution_, heuristicValue); } delete [] newSolution ; } #ifdef JJF_ZERO // switch on to get all cuts printed theseCuts.printCuts() ; #endif int numberColumnCuts = theseCuts.sizeColCuts() ; int numberRowCuts = theseCuts.sizeRowCuts() ; if (violated >= 0) violated = numberRowCuts + numberColumnCuts ; /* Apply column cuts (aka bound tightening). This may be partially redundant for column cuts returned by CglProbing, as generateCuts installs bounds from CglProbing when it determines it can fix a variable. TODO: Looks like the use of violated has evolved. The value set above is completely ignored. All that's left is violated == -1 indicates some cut is violated, violated == -2 indicates infeasibility. Only infeasibility warrants exceptional action. TODO: Strikes me that this code will fail to detect infeasibility, because the breaks escape the inner loops but the outer loop keeps going. Infeasibility in an early cut will be overwritten if a later cut is merely violated. */ if (numberColumnCuts) { #ifdef CBC_DEBUG double * oldLower = new double [numberColumns] ; double * oldUpper = new double [numberColumns] ; memcpy(oldLower, cbcColLower_, numberColumns*sizeof(double)) ; memcpy(oldUpper, cbcColUpper_, numberColumns*sizeof(double)) ; #endif double integerTolerance = getDblParam(CbcIntegerTolerance) ; for (int i = 0; i < numberColumnCuts; i++) { const OsiColCut * thisCut = theseCuts.colCutPtr(i) ; const CoinPackedVector & lbs = thisCut->lbs() ; const CoinPackedVector & ubs = thisCut->ubs() ; int j ; int n ; const int * which ; const double * values ; n = lbs.getNumElements() ; which = lbs.getIndices() ; values = lbs.getElements() ; for (j = 0; j < n; j++) { int iColumn = which[j] ; double value = cbcColSolution_[iColumn] ; #if CBC_DEBUG>1 printf("%d %g %g %g %g\n", iColumn, oldLower[iColumn], cbcColSolution_[iColumn], oldUpper[iColumn], values[j]) ; #endif solver_->setColLower(iColumn, values[j]) ; if (value < values[j] - integerTolerance) violated = -1 ; if (values[j] > cbcColUpper_[iColumn] + integerTolerance) { // infeasible violated = -2 ; break ; } } n = ubs.getNumElements() ; which = ubs.getIndices() ; values = ubs.getElements() ; for (j = 0; j < n; j++) { int iColumn = which[j] ; double value = cbcColSolution_[iColumn] ; #if CBC_DEBUG>1 printf("%d %g %g %g %g\n", iColumn, oldLower[iColumn], cbcColSolution_[iColumn], oldUpper[iColumn], values[j]) ; #endif solver_->setColUpper(iColumn, values[j]) ; if (value > values[j] + integerTolerance) violated = -1 ; if (values[j] < cbcColLower_[iColumn] - integerTolerance) { // infeasible violated = -2 ; break ; } } } #ifdef CBC_DEBUG delete [] oldLower ; delete [] oldUpper ; #endif } /* End installation of column cuts. The break here escapes the numberTries loop. */ if (violated == -2 || !feasible) { // infeasible feasible = false ; violated = -2; if (!numberNodes_) messageHandler()->message(CBC_INFEAS, messages()) << CoinMessageEol ; break ; } /* Now apply the row (constraint) cuts. This is a bit more work because we need to obtain and augment the current basis. TODO: Why do this work, if there are no row cuts? The current basis will do just fine. */ int numberRowsNow = solver_->getNumRows() ; #ifndef NDEBUG assert(numberRowsNow == numberRowsAtStart + lastNumberCuts) ; #else // ? maybe clue to threaded problems if (numberRowsNow != numberRowsAtStart + lastNumberCuts) { fprintf(stderr, "*** threaded error - numberRowsNow(%d) != numberRowsAtStart(%d)+lastNumberCuts(%d)\n", numberRowsNow, numberRowsAtStart, lastNumberCuts); fprintf(stdout, "*** threaded error - numberRowsNow(%d) != numberRowsAtStart(%d)+lastNumberCuts(%d)\n", numberRowsNow, numberRowsAtStart, lastNumberCuts); abort(); } #endif int numberToAdd = theseCuts.sizeRowCuts() ; numberNewCuts_ = lastNumberCuts + numberToAdd ; // resize whichGenerator resizeWhichGenerator(lastNumberCuts,numberNewCuts_); /* Now actually add the row cuts and reoptimise. Install the cuts in the solver using applyRowCuts and augment the basis with the corresponding slack. We also add each row cut to the set of row cuts (cuts.insert()) supplied as a parameter. The new basis must be set with setWarmStart(). TODO: Seems to me the original code could allocate addCuts with size 0, if numberRowCuts was 0 and numberColumnCuts was nonzero. That might explain the memory fault noted in the comment by AJK. Unfortunately, just commenting out the delete[] results in massive memory leaks. Try a revision to separate the row cut case. Why do we need addCuts at all? A typing issue, apparently: OsiCut vs. OsiRowCut. TODO: It looks to me as if numberToAdd and numberRowCuts are identical at this point. Confirm & get rid of one of them. TODO: Any reason why the three loops can't be consolidated? */ const OsiRowCut ** addCuts = NULL; if (numberRowCuts > 0 || numberColumnCuts > 0) { if (numberToAdd > 0) { int i ; int * whichGenerator = whichGenerator_ + lastNumberCuts; // Faster to add all at once addCuts = new const OsiRowCut * [numberToAdd] ; for (i = 0 ; i < numberToAdd ; i++) { addCuts[i] = &theseCuts.rowCut(i) ; whichGenerator[i]=90; } if ((specialOptions_&262144) != 0 && !parentModel_) { //save for (i = 0 ; i < numberToAdd ; i++) storedRowCuts_->addCut(*addCuts[i]); } solver_->applyRowCuts(numberToAdd, addCuts) ; CoinWarmStartBasis * basis = dynamic_cast(solver_->getWarmStart()) ; assert(basis != NULL); // make sure not volume /* dylp bug Consistent size used by OsiDylp as sanity check. Implicit resize seen as an error. Hence this call to resize is necessary. */ basis->resize(numberRowsAtStart + numberNewCuts_, numberColumns) ; for (i = 0 ; i < numberToAdd ; i++) { basis->setArtifStatus(numberRowsNow + i, CoinWarmStartBasis::basic) ; } if (solver_->setWarmStart(basis) == false) { throw CoinError("Fail setWarmStart() after cut installation.", "solveWithCuts", "CbcModel") ; } delete basis; } //solver_->setHintParam(OsiDoDualInResolve,false,OsiHintTry); feasible = ( resolve(node ? node->nodeInfo() : NULL, 2) != 0) ; //solver_->setHintParam(OsiDoDualInResolve,true,OsiHintTry); if ( maximumSecondsReached() ) { numberTries = -1000; // exit feasible = false; break; } # ifdef CBC_DEBUG printf("Obj value after cuts %g %d rows\n", solver_->getObjValue(), solver_->getNumRows()) ; if (onOptimalPath && !solver_->isDualObjectiveLimitReached()) assert(feasible) ; # endif } /* No cuts. Cut short the cut generation (numberTries) loop. */ else if (numberLastAttempts > 2 || experimentBreak < 2) { numberTries = 0 ; } /* If the problem is still feasible, first, call takeOffCuts() to remove cuts that are now slack. takeOffCuts() will call the solver to reoptimise if that's needed to restore a valid solution. Next, see if we should quit due to diminishing returns: * we've tried three rounds of cut generation and we're getting insufficient improvement in the objective; or * we generated no cuts; or * the solver declared optimality with 0 iterations after we added the cuts generated in this round. If we decide to keep going, prep for the next iteration. It just seems more safe to tell takeOffCuts() to call resolve(), even if we're not continuing cut generation. Otherwise code executed between here and final disposition of the node will need to be careful not to access the lp solution. It can happen that we lose feasibility in takeOffCuts --- numerical jitters when the cutoff bound is epsilon less than the current best, and we're evaluating an alternative optimum. TODO: After successive rounds of code motion, there seems no need to distinguish between the two checks for aborting the cut generation loop. Confirm and clean up. */ if (feasible) { int cutIterations = solver_->getIterationCount() ; if (numberOldActiveCuts_ + numberNewCuts_ && (numberNewCuts_ || doCutsNow(1)) ) { OsiCuts * saveCuts = node ? NULL : &slackCuts; int nDel = takeOffCuts(cuts, resolveAfterTakeOffCuts_, saveCuts, numberToAdd, addCuts) ; if (nDel) lastNumberCuts2_ = 0; if (solver_->isDualObjectiveLimitReached() && resolveAfterTakeOffCuts_) { feasible = false ; # ifdef CBC_DEBUG double z = solver_->getObjValue() ; double cut = getCutoff() ; printf("Lost feasibility by %g in takeOffCuts; z = %g, cutoff = %g\n", z - cut, z, cut) ; # endif } } delete [] addCuts ; if (feasible) { numberRowsAtStart = numberOldActiveCuts_ + numberRowsAtContinuous_ ; lastNumberCuts = numberNewCuts_ ; double thisObj = direction * solver_->getObjValue(); bool badObj = (allowZeroIterations) ? thisObj < cut_obj[0] + minimumDrop : thisObj < cut_obj[CUT_HISTORY-1] + minimumDrop; #ifdef JJF_ZERO // probably not a good idea if (!badObj) numberLastAttempts = CoinMax(0, numberLastAttempts - 1); #endif // Compute maximum number of bad passes if (minimumDrop > 0.0) { if (increaseDrop) { // slowly increase minimumDrop; breakpoints are rule-of-thumb if (currentPassNumber_ == 13) minimumDrop = CoinMax(1.5 * minimumDrop, 1.0e-5 * fabs(thisObj)); else if (currentPassNumber_ > 20 && (currentPassNumber_ % 5) == 0) minimumDrop = CoinMax(1.1 * minimumDrop, 1.0e-5 * fabs(thisObj)); else if (currentPassNumber_ > 50) minimumDrop = CoinMax(1.1 * minimumDrop, 1.0e-5 * fabs(thisObj)); } int nBadPasses = 0; // The standard way of determining escape if (!experimentBreak) { double test = 0.01 * minimumDrop; double goodDrop = COIN_DBL_MAX; for (int j = CUT_HISTORY - 1; j >= 0; j--) { if (thisObj - cut_obj[j] < test) { nBadPasses++; } else { goodDrop = (thisObj - cut_obj[j]) / static_cast(nBadPasses + 1); break; } } maximumBadPasses = CoinMax(maximumBadPasses, nBadPasses); if (nBadPasses < maximumBadPasses && goodDrop > minimumDrop) badObj = false; // carry on } else { // Experimental escape calculations //if (currentPassNumber_==13||currentPassNumber_>50) //minimumDrop = CoinMax(1.5*minimumDrop,1.0e-5*fabs(thisObj)); double test = 0.1 * minimumDrop; double goodDrop = (thisObj - cut_obj[0]) / static_cast(CUT_HISTORY); double objValue = thisObj; for (int j = CUT_HISTORY - 1; j >= 0; j--) { if (objValue - cut_obj[j] < test) { nBadPasses++; objValue = cut_obj[j]; } else { break; } } #if CBC_USEFUL_PRINTING>12 if (!parentModel_ && !numberNodes_) printf("badObj %s nBad %d maxBad %d goodDrop %g minDrop %g thisDrop %g obj %g\n", badObj ? "true" : "false", nBadPasses, maximumBadPasses, goodDrop, minimumDrop, thisObj - cut_obj[CUT_HISTORY-1], solver_->getObjValue()); #endif maximumBadPasses = CoinMax(maximumBadPasses, nBadPasses); if (nBadPasses < 2 || goodDrop > 2.0*minimumDrop) { if (experimentBreak <= 2 || goodDrop > 0.1*minimumDrop) badObj = false; // carry on } if (experimentBreak > 1 && goodDrop < minimumDrop) numberLastAttempts++; } } // magic numbers, they seemed reasonable; there's a possibility here of going more than // nominal number of passes if we're doing really well. if (numberTries == 1 && currentDepth_ < 12 && currentPassNumber_ < 10) { double drop[12] = {1.0, 2.0, 3.0, 10.0, 10.0, 10.0, 10.0, 20.0, 100.0, 100.0, 1000.0, 1000.0}; if (thisObj - lastObjective > drop[currentDepth_]*minimumDrop) { numberTries++; #if CBC_USEFUL_PRINTING>1 //printf("drop %g %g %d\n",thisObj,lastObjective,currentPassNumber_); #endif } } for (int j = 0; j < CUT_HISTORY - 1; j++) cut_obj[j] = cut_obj[j+1]; cut_obj[CUT_HISTORY-1] = thisObj; bool allowEarlyTermination = currentPassNumber_ >= 10; if (currentDepth_ > 10 || (currentDepth_ > 5 && numberColumns > 200)) allowEarlyTermination = true; //if (badObj && (currentPassNumber_ >= 10 || (currentDepth_>10)) if (badObj && allowEarlyTermination //&&(currentPassNumber_>=10||lastObjective>firstObjective) && !keepGoing) { numberTries = 0 ; } if (numberRowCuts + numberColumnCuts == 0 || (cutIterations == 0 && !allowZeroIterations) ) { // maybe give it one more try if (numberLastAttempts > 2 || currentDepth_ || experimentBreak < 2) numberTries=0 ; else numberLastAttempts++; } if (numberTries > 0) { reducedCostFix() ; lastObjective = direction * solver_->getObjValue() ; } } } else { // not feasible delete [] addCuts ; } /* We've lost feasibility --- this node won't be referencing the cuts we've been collecting, so decrement the reference counts. */ if (!feasible) { int i ; if (currentNumberCuts_) { lockThread(); for (i = 0; i < currentNumberCuts_; i++) { // take off node if (addedCuts_[i]) { if (!addedCuts_[i]->decrement()) delete addedCuts_[i] ; addedCuts_[i] = NULL ; } } unlockThread(); } numberTries = 0 ; keepGoing=false; } if (numberTries ==0 && feasible && !keepGoing && !parentModel_ && !numberNodes_) { for (int i = 0; i < numberCutGenerators_; i++) { if (generator_[i]->whetherCallAtEnd() &&!generator_[i]->whetherInMustCallAgainMode()) { // give it some goes and switch off numberTries=(saveNumberTries+4)/5; generator_[i]->setWhetherCallAtEnd(false); } } } } while (numberTries > 0 || keepGoing) ; /* End cut generation loop. */ { // switch on for (int i = 0; i < numberCutGenerators_; i++) generator_[i]->setSwitchedOff(false); } //check feasibility. //If solution seems to be integer feasible calling setBestSolution //will eventually add extra global cuts which we need to install at //the nodes if (feasible && solverCharacteristics_->solutionAddsCuts()) { //check integer feasibility bool integerFeasible = true; const double * save = testSolution_; testSolution_ = solver_->getColSolution(); // point to useful information OsiBranchingInformation usefulInfo = usefulInformation(); for (int i = 0; i < numberObjects_ && integerFeasible; i++) { double infeasibility = object_[i]->checkInfeasibility(&usefulInfo); if (infeasibility) integerFeasible = false; } testSolution_ = save; // Consider the possibility that some alternatives here only make sense in context // of bonmin. if (integerFeasible) { //update double objValue = solver_->getObjValue(); int numberGlobalBefore = globalCuts_.sizeRowCuts(); // SOLUTION2 so won't up cutoff or print message setBestSolution(CBC_SOLUTION2, objValue, solver_->getColSolution(), 0); int numberGlobalAfter = globalCuts_.sizeRowCuts(); int numberToAdd = numberGlobalAfter - numberGlobalBefore; if (numberToAdd > 0) //We have added some cuts say they are tight at that node //Basis and lp should already have been updated { feasible = (solver_->isProvenOptimal() && !solver_->isDualObjectiveLimitReached()) ; if (feasible) { int numberCuts = numberNewCuts_ = cuts.sizeRowCuts(); // possibly extend whichGenerator resizeWhichGenerator(numberCuts, numberToAdd + numberCuts); for (int i = numberGlobalBefore ; i < numberGlobalAfter ; i++) { whichGenerator_[numberNewCuts_++] = 20099; #ifndef GLOBAL_CUTS_JUST_POINTERS cuts.insert(*globalCuts_.rowCutPtr(i)) ; #else OsiRowCut * rowCutPointer = globalCuts_.rowCutPtr(i); cuts.insert(rowCutPointer) ; #endif } numberNewCuts_ = lastNumberCuts + numberToAdd; //now take off the cuts which are not tight anymore takeOffCuts(cuts, resolveAfterTakeOffCuts_, NULL) ; if (solver_->isDualObjectiveLimitReached() && resolveAfterTakeOffCuts_) { feasible = false ; } } if (!feasible) { //node will be fathomed lockThread(); for (int i = 0; i < currentNumberCuts_; i++) { // take off node if (addedCuts_[i]) { if (!addedCuts_[i]->decrement()) delete addedCuts_[i] ; addedCuts_[i] = NULL ; } } unlockThread(); } } } } /* End of code block to check for a solution, when cuts may be added as a result of a feasible solution. Reduced cost fix at end. Must also check feasible, in case we've popped out because a generator indicated we're infeasible. */ if (feasible && solver_->isProvenOptimal()) reducedCostFix() ; // If at root node do heuristics if (!numberNodes_ && !maximumSecondsReached()) { // First see if any cuts are slack int numberRows = solver_->getNumRows(); int numberAdded = numberRows - numberRowsAtContinuous_; if (numberAdded) { CoinWarmStartBasis * basis = dynamic_cast(solver_->getWarmStart()) ; assert(basis != NULL); int * added = new int[numberAdded]; int nDelete = 0; for (int j = numberRowsAtContinuous_; j < numberRows; j++) { if (basis->getArtifStatus(j) == CoinWarmStartBasis::basic) { //printf("%d slack!\n",j); added[nDelete++] = j; } } if (nDelete) { solver_->deleteRows(nDelete, added); } delete [] added; delete basis ; } // mark so heuristics can tell int savePass = currentPassNumber_; currentPassNumber_ = 999999; double * newSolution = new double [numberColumns] ; double heuristicValue = getCutoff() ; int found = -1; // no solution found if (feasible) { int whereFrom = node ? 3 : 2; for (int i = 0; i < numberHeuristics_; i++) { // skip if can't run here if (!heuristic_[i]->shouldHeurRun(whereFrom)) continue; // see if heuristic will do anything double saveValue = heuristicValue ; int ifSol = heuristic_[i]->solution(heuristicValue, newSolution); if (ifSol > 0) { // better solution found heuristic_[i]->incrementNumberSolutionsFound(); found = i ; incrementUsed(newSolution); lastHeuristic_ = heuristic_[found]; #ifdef HEURISTIC_INFORM printf("HEUR %s where %d B\n", lastHeuristic_->heuristicName(), whereFrom); #endif setBestSolution(CBC_ROUNDING, heuristicValue, newSolution) ; whereFrom |= 8; // say solution found } else { heuristicValue = saveValue ; } } } currentPassNumber_ = savePass; if (found >= 0) { phase_ = 4; } delete [] newSolution ; } // Up change due to cuts if (feasible) sumChangeObjective2_ += solver_->getObjValue() * solver_->getObjSense() - objectiveValue ; //if ((numberNodes_%100)==0) //printf("XXb sum obj changed by %g\n",sumChangeObjective2_); /* End of cut generation loop. Now, consider if we want to disable or adjust the frequency of use for any of the cut generators. If the client specified a positive number for howOften, it will never change. If the original value was negative, it'll be converted to 1000000+|howOften|, and this value will be adjusted each time fullScan is true. Actual cut generation is performed every howOften%1000000 nodes; the 1000000 offset is just a convenient way to specify that the frequency is adjustable. During cut generation, we recorded the number of cuts produced by each generator for this node. For all cuts, whichGenerator records the generator that produced a cut. TODO: All this should probably be hidden in a method of the CbcCutGenerator class. lh: TODO: Can the loop that scans over whichGenerator to accumulate per generator counts be replaced by values in countRowCuts and countColumnCuts? << I think the answer is yes, but not the other way 'round. Row and column cuts are block interleaved in whichGenerator. >> The root is automatically a full scan interval. At the root, decide if we're going to do cuts in the tree, and whether we should keep the cuts we have. Codes for willBeCutsInTree: -1: no cuts in tree and currently active cuts seem ineffective; delete them 0: no cuts in tree but currently active cuts seem effective; make them into architecturals (faster than treating them as cuts) 1: cuts will be generated in the tree; currently active cuts remain as cuts -lh */ #ifdef NODE_LOG int fatherNum = (node == NULL) ? -1 : node->nodeNumber(); double value = (node == NULL) ? -1 : node->branchingObject()->value(); string bigOne = (solver_->getIterationCount() > 30) ? "*******" : ""; string way = (node == NULL) ? "" : (node->branchingObject()->way()) == 1 ? "Down" : "Up"; std::cout << "Node " << numberNodes_ << ", father " << fatherNum << ", #iterations " << solver_->getIterationCount() << ", sol value : " << solver_->getObjValue() << std::endl; #endif if (fullScan && numberCutGenerators_) { /* If cuts just at root node then it will probably be faster to update matrix and leave all in */ int willBeCutsInTree = 0; double thisObjective = solver_->getObjValue() * direction ; // get sizes int numberRowsAdded = solver_->getNumRows() - numberRowsAtStart; CoinBigIndex numberElementsAdded = solver_->getNumElements() - numberElementsAtStart ; double densityOld = static_cast (numberElementsAtStart) / static_cast (numberRowsAtStart); double densityNew = numberRowsAdded ? (static_cast (numberElementsAdded)) / static_cast (numberRowsAdded) : 0.0; /* If we're at the root, and we added cuts, and the cuts haven't changed the objective, and the cuts resulted in a significant increase (> 20%) in nonzero coefficients, do no cuts in the tree and ditch the current cuts. They're not cost-effective. */ if (!numberNodes_) { if (!parentModel_) { //printf("%d global cuts\n",globalCuts_.sizeRowCuts()) ; if ((specialOptions_&1) != 0) { //specialOptions_ &= ~1; int numberCuts = globalCuts_.sizeRowCuts(); const OsiRowCutDebugger *debugger = continuousSolver_->getRowCutDebugger() ; if (debugger) { for (int i = 0; i < numberCuts; i++) { OsiRowCut * cut = globalCuts_.rowCutPtr(i) ; if (debugger->invalidCut(*cut)) { continuousSolver_->applyRowCuts(1,cut); continuousSolver_->writeMps("bad"); printf("BAD cut\n"); } //CoinAssert (!debugger->invalidCut(*cut)); } } } } //solver_->writeMps("second"); if (numberRowsAdded) handler_->message(CBC_CUTS_STATS, messages_) << numberRowsAdded << densityNew << CoinMessageEol ; if (thisObjective - startObjective < 1.0e-5 && numberElementsAdded > 0.2*numberElementsAtStart) willBeCutsInTree = -1; int whenC = whenCuts_; if (whenC == 999999 || whenC == 999998) { int size = continuousSolver_->getNumRows() + continuousSolver_->getNumCols(); bool smallProblem = size <= 550; smallProblem = false; #if CBC_USEFUL_PRINTING>1 int maxPass = maximumCutPasses_; #endif if (thisObjective - startObjective < 1.0e-5) { // No change in objective function if (numberElementsAdded > 0.2*numberElementsAtStart) { if (whenCuts_ == 999999) { whenCuts_ = 5000010; if (!smallProblem) maximumCutPasses_ = CoinMax(maximumCutPasses_ >> 1, 1); } else if (whenCuts_ == 999998) { whenCuts_ = 5000010; if (!smallProblem) maximumCutPasses_ = CoinMax(maximumCutPasses_ >> 1, 1); } #ifdef JJF_ZERO } else if (currentPassNumber_ < CoinMin(CoinAbs(maximumCutPassesAtRoot_), 8)) { if (whenCuts_ == 999999) { whenCuts_ = 8000008; maximumCutPasses_ = 1; } else if (whenCuts_ == 999998) { whenCuts_ = 10000008; maximumCutPasses_ = 1; } } else if (currentPassNumber_ < CoinMin(CoinAbs(maximumCutPassesAtRoot_), 50)) { if (whenCuts_ == 999999) { whenCuts_ = 8000008; maximumCutPasses_ = 1; } else if (whenCuts_ == 999998) { whenCuts_ = 10000006; maximumCutPasses_ = 1; } } else if (currentPassNumber_ < CoinAbs(maximumCutPassesAtRoot_)) { if (whenCuts_ == 999999) { whenCuts_ = 8000008; maximumCutPasses_ = 1; } else if (whenCuts_ == 999998) { whenCuts_ = 10000004; maximumCutPasses_ = 1; } #endif } else { if (whenCuts_ == 999999) { whenCuts_ = 8000008; if (!smallProblem) maximumCutPasses_ = CoinMax(maximumCutPasses_ >> 1, 1); } else if (whenCuts_ == 999998) { whenCuts_ = 10000004; if (!smallProblem) maximumCutPasses_ = CoinMax(maximumCutPasses_ >> 1, 1); } } } else { // Objective changed #ifdef JJF_ZERO if (currentPassNumber_ < CoinMin(CoinAbs(maximumCutPassesAtRoot_), 8)) { if (whenCuts_ == 999999) { whenCuts_ = 8000008; maximumCutPasses_ = 1; } else if (whenCuts_ == 999998) { whenCuts_ = 10000008; maximumCutPasses_ = 1; } } else if (currentPassNumber_ < CoinMin(CoinAbs(maximumCutPassesAtRoot_), 50)) { if (whenCuts_ == 999999) { whenCuts_ = 8000008; maximumCutPasses_ = 1; } else if (whenCuts_ == 999998) { whenCuts_ = 10000004; maximumCutPasses_ = 1; } } else #endif if (currentPassNumber_ < CoinAbs(maximumCutPassesAtRoot_)) { if (whenCuts_ == 999999) { whenCuts_ = 8000008; if (!smallProblem) maximumCutPasses_ = CoinMax(maximumCutPasses_ >> 1, 1); } else if (whenCuts_ == 999998) { whenCuts_ = 10000004; if (!smallProblem) maximumCutPasses_ = CoinMax(maximumCutPasses_ >> 1, 1); } } else { if (whenCuts_ == 999999) { whenCuts_ = 10000004; maximumCutPasses_ = CoinMax(maximumCutPasses_, 2); } else if (whenCuts_ == 999998) { whenCuts_ = 11000002; maximumCutPasses_ = CoinMax(maximumCutPasses_, 2); } } } // Set bit to say don't try too hard if seems reasonable if (maximumCutPasses_ <= 5) whenCuts_ += 100000; //// end #if CBC_USEFUL_PRINTING>1 printf("changing whenCuts from %d to %d and cutPasses from %d to %d objchange %g\n", whenC, whenCuts_, maxPass, maximumCutPasses_, thisObjective - startObjective); #endif } } /* Noop block 071219. */ if ((numberRowsAdded > 100 + 0.5*numberRowsAtStart || numberElementsAdded > 0.5*numberElementsAtStart) && (densityNew > 200.0 && numberRowsAdded > 100 && densityNew > 2.0*densityOld)) { // much bigger //if (thisObjective-startObjective<0.1*fabs(startObjective)+1.0e-5) //willBeCutsInTree=-1; //printf("Cuts will be taken off , %d rows added with density %g\n", // numberRowsAdded,densityNew); } /* Noop block 071219. */ if (densityNew > 100.0 && numberRowsAdded > 2 && densityNew > 2.0*densityOld) { //if (thisObjective-startObjective<0.1*fabs(startObjective)+1.0e-5) //willBeCutsInTree=-2; //printf("Density says no cuts ? , %d rows added with density %g\n", // numberRowsAdded,densityNew); } // Root node or every so often - see what to turn off /* Hmmm ... > -90 for any generator will overrule previous decision to do no cuts in tree and delete existing cuts. */ int i ; for (i = 0; i < numberCutGenerators_; i++) { int howOften = generator_[i]->howOften() ; if (howOften > -90) willBeCutsInTree = 0; } if (!numberNodes_) { handler_->message(CBC_ROOT, messages_) << numberNewCuts_ << startObjective << thisObjective << currentPassNumber_ << CoinMessageEol ; } /* Count the number of cuts produced by each cut generator on this call. Not clear to me that the accounting is equivalent here. whichGenerator_ records the generator for column and row cuts. So unless numberNewCuts is row cuts only, we're double counting for JUST_ACTIVE. Note too the multiplier applied to column cuts. */ if (!numberNodes_) { double value = CoinMax(minimumDrop_, 0.005 * (thisObjective - startObjective) / static_cast (currentPassNumber_)); if (numberColumns < 200) value = CoinMax(minimumDrop_, 0.1 * value); #if CBC_USEFUL_PRINTING>1 printf("Minimum drop for cuts was %g, now is %g\n", minimumDrop_, value); #endif minimumDrop_ = value; } int * count = new int[numberCutGenerators_] ; memset(count, 0, numberCutGenerators_*sizeof(int)) ; int numberActiveGenerators = 0; for (i = 0; i < numberNewCuts_; i++) { int iGenerator = whichGenerator_[i]; //assert (iGenerator>=0); if (iGenerator>=0) iGenerator=iGenerator%10000; if (iGenerator >= 0 && iGenerator < numberCutGenerators_) count[iGenerator]++ ; } // add in any active cuts if at root node (for multiple solvers) #ifdef CHECK_KNOWN_SOLUTION if (onOptimalPath && (solver_->isDualObjectiveLimitReached()|| !feasible)) { printf("help 2\n"); } #endif if (!numberNodes_) { for (i = 0; i < numberCutGenerators_; i++) count[i] += generator_[i]->numberCutsActive(); } double totalCuts = 0.0 ; //#define JUST_ACTIVE for (i = 0; i < numberCutGenerators_; i++) { if (generator_[i]->numberCutsInTotal() || generator_[i]->numberColumnCuts()) numberActiveGenerators++; #ifdef JUST_ACTIVE double value = count[i] ; #else double value = generator_[i]->numberCutsInTotal() ; #endif totalCuts += value; } /* Open up a loop to step through the cut generators and decide what (if any) adjustment should be made for calling frequency. */ int iProbing = -1; double smallProblem = (0.2 * totalCuts) / static_cast (numberActiveGenerators) ; for (i = 0; i < numberCutGenerators_; i++) { int howOften = generator_[i]->howOften() ; /* Probing can be set to just do column cuts in treee. But if doing good then leave as on Ok, let me try to explain this. rowCuts = 3 says do disaggregation (1<<0) and coefficient (1<<1) cuts. But if the value is negative, there's code at the entry to generateCuts, and generateCutsAndModify, that temporarily changes the value to 4 (1<<2) if we're in a search tree. Which does nothing to explain this next bit. We set a boolean, convert howOften to the code for `generate while objective is improving', and change over to `do everywhere'. Hmmm ... now I write it out, this makes sense in the context of the original comment. If we're doing well (objective improving) we'll keep probing fully active. */ bool probingWasOnBut = false; CglProbing * probing = dynamic_cast(generator_[i]->generator()); if (probing && !numberNodes_) { if (generator_[i]->numberCutsInTotal()) { // If large number of probing - can be biased smallProblem = (0.2 * (totalCuts - generator_[i]->numberCutsInTotal())) / static_cast (numberActiveGenerators - 1) ; } iProbing = i; if (probing->rowCuts() == -3) { probingWasOnBut = true; howOften = -98; probing->setRowCuts(3); } } /* Convert `as long as objective is improving' into `only at root' if we've decided cuts just aren't worth it. */ if (willBeCutsInTree < 0 && howOften == -98) howOften = -99; /* And check to see if the objective is improving. But don't do the check if the user has specified some minimum number of cuts. This exclusion seems bogus, or at least counterintuitive. Why would a user suspect that setting a minimum cut limit would invalidate the objective check? Nor do I see the point in comparing the number of rows and columns in the second test. */ if (!probing && howOften == -98 && !generator_[i]->numberShortCutsAtRoot() && generator_[i]->numberCutsInTotal()) { // switch off as no short cuts generated //printf("Switch off %s?\n",generator_[i]->cutGeneratorName()); howOften = -99; } if (howOften == -98 && generator_[i]->switchOffIfLessThan() > 0) { if (thisObjective - startObjective < 0.005*fabs(startObjective) + 1.0e-5) howOften = -99; // switch off if (thisObjective - startObjective < 0.1*fabs(startObjective) + 1.0e-5 && 5*solver_->getNumRows() < solver_->getNumCols()) howOften = -99; // switch off } if (generator_[i]->maximumTries()!=-1) howOften = CoinMin(howOften,-99); // switch off /* Below -99, this generator is switched off. There's no need to consider further. Then again, there was no point in persisting this far! */ if (howOften < -99) { // may have been switched off - report if (!numberNodes_) { int n = generator_[i]->numberCutsInTotal(); if (n) { double average = 0.0; average = generator_[i]->numberElementsInTotal(); average /= n; handler_->message(CBC_GENERATOR, messages_) << i << generator_[i]->cutGeneratorName() << n << average << generator_[i]->numberColumnCuts() << generator_[i]->numberCutsActive() + generator_[i]->numberColumnCuts(); handler_->printing(generator_[i]->timing()) << generator_[i]->timeInCutGenerator(); handler_->message() << -100 << CoinMessageEol ; } } continue ; } /* Adjust, if howOften is adjustable. */ if (howOften < 0 || howOften >= 1000000) { if ( !numberNodes_) { /* If root only, or objective improvement but no cuts generated, switch off. If it's just that the generator found no cuts at the root, give it one more chance. */ // If small number switch mostly off #ifdef JUST_ACTIVE double thisCuts = count[i] + 5.0 * generator_[i]->numberColumnCuts() ; #else double thisCuts = generator_[i]->numberCutsInTotal() + 5.0 * generator_[i]->numberColumnCuts() ; #endif // Allow on smaller number if <-1 if (generator_[i]->switchOffIfLessThan() < 0) { double multiplier[] = {2.0, 5.0}; int iSwitch = -generator_[i]->switchOffIfLessThan() - 1; assert (iSwitch >= 0 && iSwitch < 2); thisCuts *= multiplier[iSwitch]; } if (!thisCuts || howOften == -99) { if (howOften == -99 || howOften == -98) { howOften = -100 ; } else { howOften = 1000000 + SCANCUTS; // wait until next time if (probing) { // not quite so drastic howOften = 1000000 + 1; probing->setMaxLook(1); probing->setMaxProbe(123); } } /* Not productive, but not zero either. */ } else if ((thisCuts + generator_[i]->numberColumnCuts() < smallProblem) && !generator_[i] ->whetherToUse()) { /* Not unadjustable every node, and not strong probing. */ if (howOften != 1 && !probingWasOnBut) { /* No depth spec, or not adjustable every node. */ if (generator_[i]->whatDepth() < 0 || howOften != -1) { int k = static_cast (sqrt(smallProblem / thisCuts)) ; /* Not objective improvement, set to new frequency, otherwise turn off. */ if (howOften != -98) howOften = k + 1000000 ; else howOften = -100; /* Depth spec, or adjustable every node. Force to unadjustable every node. */ } else { howOften = 1; } /* Unadjustable every node, or strong probing. Force unadjustable every node and force not strong probing? I don't understand. */ } else { howOften = 1; // allow cuts probingWasOnBut = false; } /* Productive cut generator. Say we'll do it every node, adjustable. But if the objective isn't improving, restrict that to every fifth depth level (whatDepth overrides howOften in generateCuts). */ } else { if (thisObjective - startObjective < 0.1*fabs(startObjective) + 1.0e-5 && generator_[i]->whatDepth() < 0) generator_[i]->setWhatDepth(5); howOften = 1 + 1000000 ; } } /* End root actions. sumChangeObjective2_ is the objective change due to cuts. If we're getting much better results from branching over a large number of nodes, switch off cuts. Except it doesn't, really --- it just puts off the decision 'til the next full scan, when it'll put it off again unless cuts look better. */ // If cuts useless switch off if (numberNodes_ >= 100000 && sumChangeObjective1_ > 2.0e2*(sumChangeObjective2_ + 1.0e-12)) { howOften = 1000000 + SCANCUTS; // wait until next time //printf("switch off cut %d due to lack of use\n",i); } } /* Ok, that's the frequency adjustment bit. Now, if we're at the root, force probing back on at every node, for column cuts at least, even if it looks useless for row cuts. Notice that if it looked useful, the values set above mean we'll be doing strong probing in the tree subject to objective improvement. */ if (!numberNodes_) { if (probingWasOnBut && howOften == -100) { probing->setRowCuts(-3); howOften = 1; } if (howOften == 1) generator_[i]->setWhatDepth(1); if (howOften >= 0 && generator_[i]->generator()->mayGenerateRowCutsInTree()) willBeCutsInTree = 1; } /* Set the new frequency in the generator. If this is an adjustable frequency, use the value to set whatDepth. Hey! Seems like this could override the user's depth setting. */ generator_[i]->setHowOften(howOften) ; if (howOften >= 1000000 && howOften < 2000000 && 0) { // Go to depth int bias = 1; if (howOften == 1 + 1000000) generator_[i]->setWhatDepth(bias + 1); else if (howOften <= 10 + 1000000) generator_[i]->setWhatDepth(bias + 2); else generator_[i]->setWhatDepth(bias + 1000); } int newFrequency = generator_[i]->howOften() % 1000000 ; // increment cut counts generator_[i]->incrementNumberCutsActive(count[i]); CglStored * stored = dynamic_cast(generator_[i]->generator()); if (stored && !generator_[i]->numberCutsInTotal()) continue; double average = 0.0; int n = generator_[i]->numberCutsInTotal(); if (n) { average = generator_[i]->numberElementsInTotal(); average /= n; } if (handler_->logLevel() > 1 || !numberNodes_) { handler_->message(CBC_GENERATOR, messages_) << i << generator_[i]->cutGeneratorName() //<numberCutsInTotal()<numberColumnCuts() << generator_[i]->numberCutsActive() + generator_[i]->numberColumnCuts(); handler_->printing(!numberNodes_ && generator_[i]->timing()) << generator_[i]->timeInCutGenerator(); handler_->message() << newFrequency << CoinMessageEol ; } } /* End loop to adjust cut generator frequency of use. */ delete [] count ; if ( !numberNodes_) { // save statistics for (i = 0; i < numberCutGenerators_; i++) { generator_[i]->setNumberCutsAtRoot(generator_[i]->numberCutsInTotal()); generator_[i]->setNumberActiveCutsAtRoot(generator_[i]->numberCutsActive()); } /* Garbage code 071219 */ // decide on pseudo cost strategy int howOften = iProbing >= 0 ? generator_[iProbing]->howOften() : 0; if ((howOften % 1000000) != 1) howOften = 0; //if (howOften) { //CglProbing * probing = dynamic_cast(generator_[iProbing]->generator()); //} howOften = 0; if (howOften) { COIN_DETAIL_PRINT(printf("** method 1\n")); //CglProbing * probing = dynamic_cast(generator_[iProbing]->generator()); generator_[iProbing]->setWhatDepth(1); // could set no row cuts //if (thisObjective-startObjective<0.001*fabs(startObjective)+1.0e-5) // probing->setRowCuts(0); for (int i = 0; i < numberObjects_; i++) { CbcSimpleIntegerDynamicPseudoCost * obj = dynamic_cast (object_[i]) ; if (obj) obj->setMethod(1); } } if (willBeCutsInTree == -2) willBeCutsInTree = 0; /* End garbage code. Now I've reached the problem area. This is a problem only at the root node, so that should simplify the issue of finding a workable basis? Or maybe not. */ if ( willBeCutsInTree <= 0) { // Take off cuts cuts = OsiCuts(); numberNewCuts_ = 0; if (!willBeCutsInTree) { // update size of problem numberRowsAtContinuous_ = solver_->getNumRows() ; } else { // take off cuts int numberRows = solver_->getNumRows(); int numberAdded = numberRows - numberRowsAtContinuous_; if (numberAdded) { int * added = new int[numberAdded]; for (int i = 0; i < numberAdded; i++) added[i] = i + numberRowsAtContinuous_; solver_->deleteRows(numberAdded, added); delete [] added; // resolve so optimal resolve(solver_); } } #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { // Maybe solver might like to know only column bounds will change //int options = clpSolver->specialOptions(); //clpSolver->setSpecialOptions(options|128); clpSolver->synchronizeModel(); } #endif } else { #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { // make sure factorization can't carry over int options = clpSolver->specialOptions(); clpSolver->setSpecialOptions(options&(~8)); } #endif } } } else { #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { // Maybe solver might like to know only column bounds will change //int options = clpSolver->specialOptions(); //clpSolver->setSpecialOptions(options|128); clpSolver->synchronizeModel(); } #endif if (numberCutGenerators_) { int i; // What if not feasible as cuts may have helped if (feasible) { for (i = 0; i < numberNewCuts_; i++) { int iGenerator = whichGenerator_[i]; #ifdef CONFLICT_CUTS assert (iGenerator>=0); #endif if (iGenerator>=0) iGenerator=iGenerator%10000; if (iGenerator >= 0 && iGenerator < numberCutGenerators_) generator_[iGenerator]->incrementNumberCutsActive(); } } } } #ifdef CHECK_CUT_COUNTS if (feasible) { CoinWarmStartBasis * basis = dynamic_cast(solver_->getWarmStart()) ; printf("solveWithCuts: Number of rows at end (only active cuts) %d\n", numberRowsAtContinuous_ + numberNewCuts_ + numberOldActiveCuts_) ; basis->print() ; delete basis; } #endif #ifdef CHECK_KNOWN_SOLUTION if (onOptimalPath && (solver_->isDualObjectiveLimitReached()|| !feasible)) { printf("help\n"); } #endif #ifdef CBC_DEBUG if (onOptimalPath && !solver_->isDualObjectiveLimitReached()) assert(feasible) ; #endif # ifdef COIN_HAS_CLP if (clpSolver) clpSolver->setSpecialOptions(saveClpOptions); # endif #ifdef CBC_THREAD // Get rid of all threaded stuff if (master) { master->stopThreads(0); delete master; } #endif // make sure pointers are up to date setPointers(solver_); return feasible ; } // Generate one round of cuts - serial mode int CbcModel::serialCuts(OsiCuts & theseCuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts) { /* Is it time to scan the cuts in order to remove redundant cuts? If so, set up to do it. */ int fullScan = 0 ; if ((numberNodes_ % SCANCUTS) == 0 || (specialOptions_&256) != 0) { fullScan = 1 ; if (!numberNodes_ || (specialOptions_&256) != 0) fullScan = 2; specialOptions_ &= ~256; // mark as full scan done } # if 0 //def COIN_HAS_CLP // check basis OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { ClpSimplex * simplex = clpSolver->getModelPtr(); int numberTotal=simplex->numberRows()+simplex->numberColumns(); int superbasic=0; for (int i=0;igetStatus(i)==ClpSimplex::superBasic) superbasic++; } if (superbasic) { printf("%d superbasic!\n",superbasic); clpSolver->resolve(); superbasic=0; for (int i=0;igetStatus(i)==ClpSimplex::superBasic) superbasic++; } assert (!superbasic); } } # endif int switchOff = (!doCutsNow(1) && !fullScan) ? 1 : 0; int status = 0; int i; for (i = 0; i < numberCutGenerators_; i++) { int numberRowCutsBefore = theseCuts.sizeRowCuts() ; int numberColumnCutsBefore = theseCuts.sizeColCuts() ; int numberRowCutsAfter = numberRowCutsBefore; int numberColumnCutsAfter = numberColumnCutsBefore; /*printf("GEN %d %s switches %d\n", i,generator_[i]->cutGeneratorName(), generator_[i]->switches());*/ bool generate = generator_[i]->normal(); // skip if not optimal and should be (maybe a cut generator has fixed variables) if (generator_[i]->howOften() == -100 || (generator_[i]->needsOptimalBasis() && !solver_->basisIsAvailable()) || generator_[i]->switchedOff()) generate = false; if (switchOff&&!generator_[i]->mustCallAgain()) { // switch off if default if (generator_[i]->howOften() == 1 && generator_[i]->whatDepth() < 0) { generate = false; } else if (currentDepth_ > -10 && switchOff == 2) { generate = false; } } if (generator_[i]->whetherCallAtEnd()) generate=false; const OsiRowCutDebugger * debugger = NULL; bool onOptimalPath = false; if (generate) { bool mustResolve = generator_[i]->generateCuts(theseCuts, fullScan, solver_, node) ; numberRowCutsAfter = theseCuts.sizeRowCuts() ; if (fullScan && generator_[i]->howOften() == 1000000 + SCANCUTS_PROBING) { CglProbing * probing = dynamic_cast(generator_[i]->generator()); if (probing && (numberRowCutsBefore < numberRowCutsAfter || numberColumnCutsBefore < theseCuts.sizeColCuts())) { // switch on generator_[i]->setHowOften(1); } } if (numberRowCutsBefore < numberRowCutsAfter && generator_[i]->mustCallAgain() && status >= 0) /*printf("%s before %d after %d must %c atend %c off %c endmode %c\n", generator_[i]->cutGeneratorName(), numberRowCutsBefore,numberRowCutsAfter, generator_[i]->mustCallAgain() ? 'Y': 'N', generator_[i]->whetherCallAtEnd() ? 'Y': 'N', generator_[i]->switchedOff() ? 'Y': 'N', generator_[i]->whetherInMustCallAgainMode() ? 'Y': 'N');*/ if (numberRowCutsBefore < numberRowCutsAfter && generator_[i]->mustCallAgain() && status >= 0) status = 1 ; // say must go round // Check last cut to see if infeasible /* The convention is that if the generator proves infeasibility, it should return as its last cut something with lb > ub. */ if (numberRowCutsBefore < numberRowCutsAfter) { const OsiRowCut * thisCut = theseCuts.rowCutPtr(numberRowCutsAfter - 1) ; if (thisCut->lb() > thisCut->ub()) { status = -1; // sub-problem is infeasible break; } } #ifdef CBC_DEBUG { int k ; for (k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { OsiRowCut thisCut = theseCuts.rowCut(k) ; /* check size of elements. We can allow smaller but this helps debug generators as it is unsafe to have small elements */ int n = thisCut.row().getNumElements(); const int * column = thisCut.row().getIndices(); const double * element = thisCut.row().getElements(); //assert (n); for (int i = 0; i < n; i++) { double value = element[i]; assert(fabs(value) > 1.0e-12 && fabs(value) < 1.0e20); } } } #endif if (mustResolve /*|| (specialOptions_&1) != 0*/) { int returnCode = resolve(node ? node->nodeInfo() : NULL, 2); if (returnCode == 0) status = -1; if (returnCode < 0 && !status) status = 2; if ((specialOptions_&1) != 0) { debugger = solver_->getRowCutDebugger() ; if (debugger) onOptimalPath = (debugger->onOptimalPath(*solver_)) ; else onOptimalPath = false; if (onOptimalPath && !solver_->isDualObjectiveLimitReached()) assert(status >= 0) ; } if (status < 0) break ; } } numberRowCutsAfter = theseCuts.sizeRowCuts() ; numberColumnCutsAfter = theseCuts.sizeColCuts() ; if ((specialOptions_&1) != 0) { if (onOptimalPath) { int k ; for (k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { OsiRowCut thisCut = theseCuts.rowCut(k) ; if (debugger->invalidCut(thisCut)) { solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_); solver_->writeMpsNative("badCut.mps", NULL, NULL, 2); printf("Cut generator %d (%s) produced invalid cut (%dth in this go)\n", i, generator_[i]->cutGeneratorName(), k - numberRowCutsBefore); const double *lower = getColLower() ; const double *upper = getColUpper() ; int numberColumns = solver_->getNumCols(); if (numberColumns < 200) { for (int i = 0; i < numberColumns; i++) printf("%d bounds %g,%g\n", i, lower[i], upper[i]); } abort(); } assert(!debugger->invalidCut(thisCut)) ; } } } /* The cut generator has done its thing, and maybe it generated some cuts. Do a bit of bookkeeping: load whichGenerator[i] with the index of the generator responsible for a cut, and place cuts flagged as global in the global cut pool for the model. lastNumberCuts is the sum of cuts added in previous iterations; it's the offset to the proper starting position in whichGenerator. */ int numberBefore = numberRowCutsBefore + lastNumberCuts ; int numberAfter = numberRowCutsAfter + lastNumberCuts ; // possibly extend whichGenerator resizeWhichGenerator(numberBefore, numberAfter); int j ; /* Look for numerically unacceptable cuts. */ bool dodgyCuts = false; for (j = numberRowCutsBefore; j < numberRowCutsAfter; j++) { const OsiRowCut * thisCut = theseCuts.rowCutPtr(j) ; if (thisCut->lb() > 1.0e10 || thisCut->ub() < -1.0e10) { dodgyCuts = true; break; } whichGenerator_[numberBefore++] = i+20000 ; if (!numberNodes_||generator_[i]->globalCuts()) whichGenerator_[numberBefore-1]=i+10000; if (thisCut->lb() > thisCut->ub()) status = -1; // sub-problem is infeasible if (thisCut->globallyValid()||!numberNodes_) { // add to global list OsiRowCut newCut(*thisCut); newCut.setGloballyValid(true); newCut.mutableRow().setTestForDuplicateIndex(false); globalCuts_.addCutIfNotDuplicate(newCut) ; whichGenerator_[numberBefore-1] = i+10000 ; } } if (dodgyCuts) { for (int k = numberRowCutsAfter - 1; k >= j; k--) { const OsiRowCut * thisCut = theseCuts.rowCutPtr(k) ; if (thisCut->lb() > thisCut->ub()) status = -1; // sub-problem is infeasible if (thisCut->lb() > 1.0e10 || thisCut->ub() < -1.0e10) theseCuts.eraseRowCut(k); } numberRowCutsAfter = theseCuts.sizeRowCuts() ; for (; j < numberRowCutsAfter; j++) { const OsiRowCut * thisCut = theseCuts.rowCutPtr(j) ; whichGenerator_[numberBefore++] = i+20000 ; if (!numberNodes_||generator_[i]->globalCuts()) whichGenerator_[numberBefore-1]=i+10000; if (thisCut->globallyValid()) { // add to global list OsiRowCut newCut(*thisCut); newCut.setGloballyValid(true); newCut.mutableRow().setTestForDuplicateIndex(false); globalCuts_.addCutIfNotDuplicate(newCut) ; whichGenerator_[numberBefore-1]=i+10000; } } } for (j = numberColumnCutsBefore; j < numberColumnCutsAfter; j++) { //whichGenerator_[numberBefore++] = i ; const OsiColCut * thisCut = theseCuts.colCutPtr(j) ; if (thisCut->globallyValid()) { // fix makeGlobalCut(thisCut); } } } /* End of loop to run each cut generator. */ if (status >= 0) { // delete null cuts int nCuts = theseCuts.sizeRowCuts() ; int k ; for (k = nCuts - 1; k >= 0; k--) { const OsiRowCut * thisCut = theseCuts.rowCutPtr(k) ; int n = thisCut->row().getNumElements(); if (!n) theseCuts.eraseRowCut(k); } } // Add in any violated saved cuts if (!theseCuts.sizeRowCuts() && !theseCuts.sizeColCuts()) { int numberOld = theseCuts.sizeRowCuts() + lastNumberCuts; int numberCuts = slackCuts.sizeRowCuts() ; int i; // possibly extend whichGenerator resizeWhichGenerator(numberOld, numberOld + numberCuts); double primalTolerance; solver_->getDblParam(OsiPrimalTolerance, primalTolerance) ; for ( i = 0; i < numberCuts; i++) { const OsiRowCut * thisCut = slackCuts.rowCutPtr(i) ; if (thisCut->violated(cbcColSolution_) > 100.0*primalTolerance) { if (messageHandler()->logLevel() > 2) printf("Old cut added - violation %g\n", thisCut->violated(cbcColSolution_)) ; whichGenerator_[numberOld++] = 20097; theseCuts.insert(*thisCut) ; } } } return status; } /* Remove slack cuts. We obtain a basis and scan it. Cuts with basic slacks are purged. If any cuts are purged, resolve() is called to restore the solution held in the solver. If resolve() pivots, there's the possibility that a slack may be pivoted in (trust me :-), so the process iterates. Setting allowResolve to false will suppress reoptimisation (but see note below). At the level of the solver's constraint system, loose cuts are really deleted. There's an implicit assumption that deleteRows will also update the active basis in the solver. At the level of nodes and models, it's more complicated. New cuts exist only in the collection of cuts passed as a parameter. They are deleted from the collection and that's the end of them. Older cuts have made it into addedCuts_. Two separate actions are needed. The reference count for the CbcCountRowCut object is decremented. If this count falls to 0, the node which owns the cut is located, the reference to the cut is removed, and then the cut object is destroyed (courtesy of the CbcCountRowCut destructor). We also need to set the addedCuts_ entry to NULL. This is important so that when it comes time to generate basis edits we can tell this cut was dropped from the basis during processing of the node. NOTE: In general, it's necessary to call resolve() after purging slack cuts. Deleting constraints constitutes a change in the problem, and an OSI is not required to maintain a valid solution when the problem is changed. But ... it's really useful to maintain the active basis, and the OSI is supposed to do that. (Yes, it's splitting hairs.) In some places, it's possible to know that the solution will never be consulted after this call, only the basis. (E.g., this routine is called as a last act before generating info to place the node in the live set.) For such use, set allowResolve to false. TODO: No real harm would be done if we just ignored the rare occasion when the call to resolve() pivoted a slack back into the basis. It's a minor inefficiency, at worst. But it does break assertions which check that there are no loose cuts in the basis. It might be better to remove the assertions. */ int CbcModel::takeOffCuts (OsiCuts &newCuts, bool allowResolve, OsiCuts * saveCuts, int numberNewCuts, const OsiRowCut ** addedCuts) { // int resolveIterations = 0 ; int numberDropped = 0; int firstOldCut = numberRowsAtContinuous_ ; int totalNumberCuts = numberNewCuts_ + numberOldActiveCuts_ ; assert (numberRowsAtContinuous_+totalNumberCuts== solver_->getNumRows()); int *solverCutIndices = new int[totalNumberCuts] ; int *newCutIndices = new int[numberNewCuts_] ; const CoinWarmStartBasis* ws ; CoinWarmStartBasis::Status status ; //#define COIN_HAS_CLP_KEEP_STATUS #ifdef COIN_HAS_CLP_KEEP_STATUS int problemStatus=-1; OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) problemStatus=clpSolver->getModelPtr()->status(); #endif bool needPurge = true ; /* The outer loop allows repetition of purge in the event that reoptimisation changes the basis. To start an iteration, clear the deletion counts and grab the current basis. */ while (needPurge) { int numberNewToDelete = 0 ; int numberOldToDelete = 0 ; int i ; int kCut=0; ws = dynamic_cast(solver_->getWarmStart()) ; /* Scan the basis entries of the old cuts generated prior to this round of cut generation. Loose cuts are `removed' by decrementing their reference count and setting the addedCuts_ entry to NULL. (If the reference count falls to 0, they're really deleted. See CbcModel and CbcCountRowCut doc'n for principles of cut handling.) */ int oldCutIndex = 0 ; if (numberOldActiveCuts_) { lockThread(); for (i = 0 ; i < numberOldActiveCuts_ ; i++) { status = ws->getArtifStatus(i + firstOldCut) ; while (!addedCuts_[oldCutIndex]) oldCutIndex++ ; assert(oldCutIndex < currentNumberCuts_) ; // always leave if from nextRowCut_ if (status == CoinWarmStartBasis::basic && (addedCuts_[oldCutIndex]->effectiveness() <= 1.0e10 || addedCuts_[oldCutIndex]->canDropCut(solver_, i + firstOldCut))) { solverCutIndices[numberOldToDelete++] = i + firstOldCut ; if (saveCuts) { // send to cut pool OsiRowCut * slackCut = addedCuts_[oldCutIndex]; if (slackCut->effectiveness() != -1.234) { slackCut->setEffectiveness(-1.234); slackCut->setGloballyValid(); saveCuts->insert(*slackCut); } } if (addedCuts_[oldCutIndex]->decrement() == 0) delete addedCuts_[oldCutIndex] ; addedCuts_[oldCutIndex] = NULL ; oldCutIndex++ ; } else { int iGenerator = addedCuts_[oldCutIndex]->whichCutGenerator(); if (iGenerator==-1) iGenerator=100; whichGenerator_[kCut++] = iGenerator ; oldCutIndex++; } } unlockThread(); } /* Scan the basis entries of the new cuts generated with this round of cut generation. At this point, newCuts is the only record of the new cuts, so when we delete loose cuts from newCuts, they're really gone. newCuts is a vector, so it's most efficient to compress it (eraseRowCut) from back to front. */ int firstNewCut = firstOldCut + numberOldActiveCuts_ ; int nCuts = newCuts.sizeRowCuts(); for (i = 0 ; i < nCuts ; i++) { status = ws->getArtifStatus(i + firstNewCut) ; if (status == CoinWarmStartBasis::basic && /*whichGenerator_[i]!=-2*/newCuts.rowCutPtr(i)->effectiveness() < 1.0e20) { solverCutIndices[numberNewToDelete+numberOldToDelete] = i + firstNewCut ; newCutIndices[numberNewToDelete++] = i ; } else { // save which generator did it // 20098 means branch cut! assert (whichGenerator_[i]!=20098); // ?? what if it is - memory leak? whichGenerator_[kCut++] = whichGenerator_[i] ; } } int baseRow = firstNewCut + nCuts; //OsiRowCut ** mutableAdded = const_cast(addedCuts); int numberTotalToDelete = numberNewToDelete + numberOldToDelete; for (i = 0 ; i < numberNewCuts ; i++) { status = ws->getArtifStatus(i + baseRow) ; if (status != CoinWarmStartBasis::basic || /*whichGenerator_[i+nCuts]==-2*/addedCuts[i]->effectiveness() >= 1.0e20) { newCuts.insert(*addedCuts[i]) ; //newCuts.insert(mutableAdded[i]) ; //mutableAdded[i]=NULL; //if (status == CoinWarmStartBasis::basic&&whichGenerator_[i]!=-2) { // save which generator did it //whichGenerator_[k++] = whichGenerator_[i+nCuts] ; //} } else { solverCutIndices[numberTotalToDelete++] = i + baseRow ; } } numberNewCuts = 0; numberNewCuts_ = newCuts.sizeRowCuts(); delete ws ; for (i = numberNewToDelete - 1 ; i >= 0 ; i--) { int iCut = newCutIndices[i] ; if (saveCuts) { // send to cut pool OsiRowCut * slackCut = newCuts.rowCutPtrAndZap(iCut); if (slackCut->effectiveness() != -1.234) { slackCut->setEffectiveness(-1.234); slackCut->setGloballyValid(); saveCuts->insert(slackCut); } else { delete slackCut; } } else { newCuts.eraseRowCut(iCut) ; } } /* Did we delete anything? If so, delete the cuts from the constraint system held in the solver and reoptimise unless we're forbidden to do so. If the call to resolve() results in pivots, there's the possibility we again have basic slacks. Repeat the purging loop. */ if (numberTotalToDelete > 0 ) { solver_->deleteRows(numberTotalToDelete, solverCutIndices) ; numberDropped += numberTotalToDelete; numberNewCuts_ -= numberNewToDelete ; assert (numberNewCuts_ == newCuts.sizeRowCuts()); numberOldActiveCuts_ -= numberOldToDelete ; # ifdef CBC_DEBUG printf("takeOffCuts: purged %d+%d cuts\n", numberOldToDelete, numberNewToDelete ); # endif if (allowResolve) { phase_ = 3; // can do quick optimality check int easy = 2; solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, &easy) ; resolve(solver_) ; setPointers(solver_); solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; if (solver_->getIterationCount() == 0) { needPurge = false ; } # ifdef CBC_DEBUG else { printf( "Repeating purging loop. %d iters.\n", solver_->getIterationCount()); } # endif } else { needPurge = false ; } } else { needPurge = false ; } } #ifdef COIN_HAS_CLP_KEEP_STATUS // need to check further that only zero duals dropped if (clpSolver) // status may have got to -1 clpSolver->getModelPtr()->setProblemStatus(problemStatus); #endif /* Clean up and return. */ delete [] solverCutIndices ; delete [] newCutIndices ; return numberDropped; } /* Return values: 1: feasible 0: infeasible -1: feasible and finished (do no more work on this subproblem) */ int CbcModel::resolve(CbcNodeInfo * parent, int whereFrom, double * saveSolution, double * saveLower, double * saveUpper) { #ifdef CBC_STATISTICS void cbc_resolve_check(const OsiSolverInterface * solver); cbc_resolve_check(solver_); #endif bool onOptimalPath = false; if ((specialOptions_&1) != 0) { const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (debugger) { onOptimalPath = true; printf("On optimal path d\n") ; } } // We may have deliberately added in violated cuts - check to avoid message int iRow; int numberRows = solver_->getNumRows(); const double * rowLower = solver_->getRowLower(); const double * rowUpper = solver_->getRowUpper(); bool feasible = true; for (iRow = numberRowsAtContinuous_; iRow < numberRows; iRow++) { if (rowLower[iRow] > rowUpper[iRow] + 1.0e-8) feasible = false; } // Can't happen if strong branching as would have been found before if ((!numberStrong_||(moreSpecialOptions_&1073741824)!=0) && numberObjects_ > numberIntegers_) { int iColumn; int numberColumns = solver_->getNumCols(); const double * columnLower = solver_->getColLower(); const double * columnUpper = solver_->getColUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLower[iColumn] > columnUpper[iColumn] + 1.0e-5) feasible = false; } } #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); #endif /* Reoptimize. Consider the possibility that we should fathom on bounds. But be careful --- where the objective takes on integral values, we may want to keep a solution where the objective is right on the cutoff. */ if (feasible) { int nTightened = 0; #ifdef COIN_HAS_CLP // Pierre pointed out that this is not valid for all solvers // so just do if Clp if ((specialOptions_&1) != 0 && onOptimalPath) { solver_->writeMpsNative("before-tighten.mps", NULL, NULL, 2); } if (clpSolver && (!currentNode_ || (currentNode_->depth()&2) != 0) && !solverCharacteristics_->solutionAddsCuts() && (moreSpecialOptions_&1073741824)==0) nTightened = clpSolver->tightenBounds(); if (nTightened) { //printf("%d bounds tightened\n",nTightened); if ((specialOptions_&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (!debugger) { // tighten did something??? solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_); solver_->writeMpsNative("infeas4.mps", NULL, NULL, 2); printf("Not on optimalpath aaaa\n"); //abort(); onOptimalPath = false; } } } #endif if (nTightened >= 0) { resolve(solver_) ; numberIterations_ += solver_->getIterationCount() ; feasible = (solver_->isProvenOptimal() && !solver_->isDualObjectiveLimitReached()) ; if (feasible) { // double check double testValue = solver_->getObjSense() * solver_->getObjValue(); //double cutoff = getCutoff(); if (bestObjective_ - getCutoffIncrement() < testValue) { #if CBC_USEFUL_PRINTING>1 double value ; solver_->getDblParam(OsiDualObjectiveLimit, value) ; printf("Should cutoff as obj %.18g, best %.18g, inc %.18g - solver cutoff %.18g model cutoff %.18g\n", testValue, bestObjective_, getCutoffIncrement(), value, getCutoff()); #endif feasible = false; } } else if (solver_->isAbandoned()) { setMaximumSeconds(-COIN_DBL_MAX); } #ifdef COIN_HAS_CLP if (clpSolver && feasible && !numberNodes_ && false) { double direction = solver_->getObjSense() ; double tolerance; solver_->getDblParam(OsiDualTolerance, tolerance) ; double primalTolerance; solver_->getDblParam(OsiPrimalTolerance, primalTolerance) ; const double *lower = solver_->getColLower() ; const double *upper = solver_->getColUpper() ; const double *solution = solver_->getColSolution() ; const double *reducedCost = solver_->getReducedCost() ; ClpSimplex * clpSimplex = clpSolver->getModelPtr(); double * rowLower = clpSimplex->rowLower(); double * rowUpper = clpSimplex->rowUpper(); int numberRows = clpSimplex->numberRows(); double * saveRowLower = CoinCopyOfArray(rowLower, numberRows); double * saveRowUpper = CoinCopyOfArray(rowUpper, numberRows); { const double * dual = clpSimplex->dualRowSolution(); const double * rowActivity = clpSimplex->primalRowSolution(); for (int iRow = 0 ; iRow < numberRows ; iRow++) { double djValue = direction * dual[iRow] ; double lowerValue = rowLower[iRow]; double upperValue = rowUpper[iRow]; if (rowActivity[iRow] < lowerValue + primalTolerance && djValue > tolerance) { rowUpper[iRow] = lowerValue; assert (clpSimplex->getRowStatus(iRow) != ClpSimplex::basic); } else if (rowActivity[iRow] > upperValue - primalTolerance && djValue < -tolerance) { rowLower[iRow] = upperValue; assert (clpSimplex->getRowStatus(iRow) != ClpSimplex::basic); } } } int numberColumns = solver_->getNumCols(); double * objective = clpSimplex->objective(); double * saveObj = CoinCopyOfArray(objective, numberColumns); double objValue = 0.01; bool someFree = false; for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++) { double djValue = direction * reducedCost[iColumn] ; double lowerValue = lower[iColumn]; double upperValue = upper[iColumn]; if (solution[iColumn] < lowerValue + primalTolerance && djValue > tolerance) { objective[iColumn] = 1.0e8 * direction; assert (clpSimplex->getColumnStatus(iColumn) != ClpSimplex::basic); } else if (solution[iColumn] > upperValue - primalTolerance && djValue < -tolerance) { objective[iColumn] = -1.0e8 * direction; assert (clpSimplex->getColumnStatus(iColumn) != ClpSimplex::basic); } else if (lowerValue > -1.0e20 || upperValue < 1.0e20) { assert (fabs(djValue) <= tolerance); if (fabs(lowerValue) < fabs(upperValue)) objective[iColumn] = objValue * direction; else objective[iColumn] = -objValue * direction; objValue += 0.01; } else { objective[iColumn] = 0.0; someFree = true; } } if (!someFree) clpSimplex->primal(1); memcpy(objective, saveObj, numberColumns*sizeof(double)); delete [] saveObj; memcpy(rowLower, saveRowLower, numberRows*sizeof(double)); delete [] saveRowLower; memcpy(rowUpper, saveRowUpper, numberRows*sizeof(double)); delete [] saveRowUpper; if (!someFree) { clpSimplex->primal(1); //assert (clpSimplex->numberIterations()<10); } //clpSimplex->writeMps("xx"); //clpSimplex->primal(1); clpSolver->setWarmStart(NULL); } #endif if ((specialOptions_&1) != 0 && onOptimalPath) { if (!solver_->getRowCutDebugger()) { // tighten did something??? solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_); solver_->writeMpsNative("infeas4.mps", NULL, NULL, 2); //assert (solver_->getRowCutDebugger()) ; printf("Not on optimalpath e\n"); //abort(); } } } else { feasible = false; } } if (0 && feasible) { const double * lb = solver_->getColLower(); const double * ub = solver_->getColUpper(); const double * x = solver_->getColSolution(); const double * dj = solver_->getReducedCost(); int numberColumns = solver_->getNumCols(); for (int i = 0; i < numberColumns; i++) { if (dj[i] > 1.0e-4 && ub[i] - lb[i] > 1.0e-4 && x[i] > lb[i] + 1.0e-4) printf("error %d %g %g %g %g\n", i, dj[i], lb[i], x[i], ub[i]); if (dj[i] < -1.0e-4 && ub[i] - lb[i] > 1.0e-4 && x[i] < ub[i] - 1.0e-4) printf("error %d %g %g %g %g\n", i, dj[i], lb[i], x[i], ub[i]); } } if (false && !feasible && continuousObjective_ < -1.0e30) { // at root node - double double check bool saveTakeHint; OsiHintStrength saveStrength; solver_->getHintParam(OsiDoDualInResolve, saveTakeHint, saveStrength); if (saveTakeHint || saveStrength == OsiHintIgnore) { solver_->setHintParam(OsiDoDualInResolve, false, OsiHintDo) ; resolve(solver_); solver_->setHintParam(OsiDoDualInResolve, saveTakeHint, saveStrength); numberIterations_ += solver_->getIterationCount() ; feasible = solver_->isProvenOptimal(); // solver_->writeMps("infeas"); } } #ifdef JJF_ZERO if (cutModifier_ && feasible && !solverCharacteristics_->solutionAddsCuts()) { //double increment = getDblParam(CbcModel::CbcCutoffIncrement) ; double cutoff ; solver_->getDblParam(OsiDualObjectiveLimit, cutoff) ; double distance = fabs(cutoff - solver_->getObjValue()); if (distance < 10.0*trueIncrement) { double offset; solver_->getDblParam(OsiObjOffset, offset); double objFixedValue = -offset; double objValue = 0.0; double direction = solver_->getObjSense(); const double * solution = solver_->getColSolution(); const double * objective = solver_->getObjCoefficients(); const double * columnLower = solver_->getColLower(); const double * columnUpper = solver_->getColUpper(); int numberColumns = solver_->getNumCols(); int increment = 0 ; double multiplier = 1.0 / trueIncrement; int bigIntegers = 0; // Count of large costs which are integer for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; // make sure clean value = CoinMin(value, columnUpper[iColumn]); value = CoinMax(value, columnLower[iColumn]); double cost = direction * objective[iColumn]; if (cost) { if (columnLower[iColumn] < columnUpper[iColumn]) { objValue += value * cost; value = fabs(cost) * multiplier ; if (value < 2.1e9) { int nearest = static_cast (floor(value + 0.5)) ; assert (fabs(value - floor(value + 0.5)) < 1.0e-8); if (!increment) increment = nearest ; else increment = gcd(increment, nearest) ; } else { // large value - may still be multiple of 1.0 value = fabs(objective[iColumn]); assert(fabs(value - floor(value + 0.5)) < 1.0e-8); bigIntegers++; } } else { // fixed objFixedValue += value * cost; } } } if (increment) { double value = increment ; value /= multiplier ; if (value > trueIncrement) { double x = objValue / value; x = ceil(x - 1.0e-5); x *= value; //printf("fixed %g, variable %g -> %g, sum %g - cutoff %g\n", // objFixedValue,objValue,x,x+objFixedValue,cutoff); x += objFixedValue; if (x > cutoff + 1.0e-5*fabs(cutoff) + 1.0e-5) { //printf("Node cutoff\n"); feasible = false; } } else { value = trueIncrement; double x = objValue / value; x = ceil(x - 1.0e-5); x *= value; x += objFixedValue; if (x > cutoff + 1.0e-5*fabs(cutoff) + 1.0e-5) { //printf("Node cutoff\n"); feasible = false; } } } } } #endif setPointers(solver_); if (feasible && saveSolution) { // called from CbcNode assert (saveLower); assert (saveUpper); int numberColumns = solver_->getNumCols(); memcpy(saveSolution, solver_->getColSolution(), numberColumns*sizeof(double)); reserveCurrentSolution(saveSolution); memcpy(saveLower, solver_->getColLower(), numberColumns*sizeof(double)); memcpy(saveUpper, solver_->getColUpper(), numberColumns*sizeof(double)); } #ifdef COIN_HAS_CLP if (clpSolver && !feasible) { // make sure marked infeasible if (!clpSolver->isProvenDualInfeasible()) clpSolver->getModelPtr()->setProblemStatus(1); } #endif int returnStatus = feasible ? 1 : 0; if (strategy_) { /* Possible returns from status: -1: no recommendation 0: treat as optimal 1: treat as optimal and finished (no more resolves, cuts, etc.) 2: treat as infeasible. */ // user can play clever tricks here int status = strategy_->status(this, parent, whereFrom); if (status >= 0) { if (status == 0) returnStatus = 1; else if (status == 1) returnStatus = -1; else returnStatus = 0; } } #if 0 if ((specialOptions_&1) != 0 && onOptimalPath) { const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (!debugger) { // tighten did something??? solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_); solver_->writeMpsNative("infeas4.mps", NULL, NULL, 2); printf("Not on optimalpath aaaa\n"); //abort(); } else { printf("Still on optimal path\n"); } } #endif return returnStatus ; } /* Set up objects. Only do ones whose length is in range. If makeEquality true then a new model may be returned if modifications had to be made, otherwise "this" is returned. Could use Probing at continuous to extend objects */ CbcModel * CbcModel::findCliques(bool makeEquality, int atLeastThisMany, int lessThanThis, int /*defaultValue*/) { // No objects are allowed to exist assert(numberObjects_ == numberIntegers_ || !numberObjects_); CoinPackedMatrix matrixByRow(*solver_->getMatrixByRow()); int numberRows = solver_->getNumRows(); int numberColumns = solver_->getNumCols(); // We may want to add columns int numberSlacks = 0; int * rows = new int[numberRows]; double * element = new double[numberRows]; int iRow; findIntegers(true); numberObjects_ = numberIntegers_; int numberCliques = 0; OsiObject ** object = new OsiObject * [numberRows]; int * which = new int[numberIntegers_]; char * type = new char[numberIntegers_]; int * lookup = new int[numberColumns]; int i; for (i = 0; i < numberColumns; i++) lookup[i] = -1; for (i = 0; i < numberIntegers_; i++) lookup[integerVariable_[i]] = i; // Statistics int totalP1 = 0, totalM1 = 0; int numberBig = 0, totalBig = 0; int numberFixed = 0; // Row copy const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); // Column lengths for slacks const int * columnLength = solver_->getMatrixByCol()->getVectorLengths(); const double * lower = getColLower(); const double * upper = getColUpper(); const double * rowLower = getRowLower(); const double * rowUpper = getRowUpper(); /* Scan the rows, looking for individual rows that are clique constraints. */ for (iRow = 0; iRow < numberRows; iRow++) { int numberP1 = 0, numberM1 = 0; int j; double upperValue = rowUpper[iRow]; double lowerValue = rowLower[iRow]; bool good = true; int slack = -1; /* Does this row qualify? All variables must be binary and all coefficients +/- 1.0. Variables with positive coefficients are recorded at the low end of which, variables with negative coefficients the high end. */ for (j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; int iInteger = lookup[iColumn]; if (upper[iColumn] - lower[iColumn] < 1.0e-8) { // fixed upperValue -= lower[iColumn] * elementByRow[j]; lowerValue -= lower[iColumn] * elementByRow[j]; continue; } else if (upper[iColumn] != 1.0 || lower[iColumn] != 0.0) { good = false; break; } else if (iInteger < 0) { good = false; break; } else { if (columnLength[iColumn] == 1) slack = iInteger; } if (fabs(elementByRow[j]) != 1.0) { good = false; break; } else if (elementByRow[j] > 0.0) { which[numberP1++] = iInteger; } else { numberM1++; which[numberIntegers_-numberM1] = iInteger; } } int iUpper = static_cast (floor(upperValue + 1.0e-5)); int iLower = static_cast (ceil(lowerValue - 1.0e-5)); /* What do we have? If the row upper bound is greater than 1-numberM1, this isn't a clique. If the row upper bound is 1-numberM1, we have the classic clique (an SOS1 on binary variables, if numberM1 = 0). If the upper bound equals numberM1, we can fix all variables. If the upper bound is less than numberM1, we're infeasible. A similar analysis applies using numberP1 against the lower bound. */ int state = 0; if (upperValue < 1.0e6) { if (iUpper == 1 - numberM1) state = 1; else if (iUpper == -numberM1) state = 2; else if (iUpper < -numberM1) state = 3; } if (!state && lowerValue > -1.0e6) { if (-iLower == 1 - numberP1) state = -1; else if (-iLower == -numberP1) state = -2; else if (-iLower < -numberP1) state = -3; } /* What to do? If we learned nothing, move on to the next iteration. If we're infeasible, we're outta here. If we decided we can fix variables, do it. */ if (good && state) { if (abs(state) == 3) { // infeasible numberObjects_ = -1; break; } else if (abs(state) == 2) { // we can fix all numberFixed += numberP1 + numberM1; if (state > 0) { // fix all +1 at 0, -1 at 1 for (i = 0; i < numberP1; i++) solver_->setColUpper(integerVariable_[which[i]], 0.0); for (i = 0; i < numberM1; i++) solver_->setColLower(integerVariable_[which[numberIntegers_-i-1]], 1.0); } else { // fix all +1 at 1, -1 at 0 for (i = 0; i < numberP1; i++) solver_->setColLower(integerVariable_[which[i]], 1.0); for (i = 0; i < numberM1; i++) solver_->setColUpper(integerVariable_[which[numberIntegers_-i-1]], 0.0); } } else { /* And the final case: we have a clique constraint. If it's within the allowed size range, make a clique object. */ int length = numberP1 + numberM1; if (length >= atLeastThisMany && length < lessThanThis) { // create object bool addOne = false; int objectType; /* Choose equality (type 1) or inequality (type 0). If we're forcing equalities, add a slack. */ if (iLower == iUpper) { objectType = 1; } else { if (makeEquality) { objectType = 1; element[numberSlacks] = state; rows[numberSlacks++] = iRow; addOne = true; } else { objectType = 0; } } /* Record the strong values for the variables. Variables with positive coefficients force all others when set to 1; variables with negative coefficients force when set to 0. If the clique is formed against the row lower bound, convert to the canonical form of a clique against the row upper bound. */ if (state > 0) { totalP1 += numberP1; totalM1 += numberM1; for (i = 0; i < numberP1; i++) type[i] = 1; for (i = 0; i < numberM1; i++) { which[numberP1] = which[numberIntegers_-i-1]; type[numberP1++] = 0; } } else { totalP1 += numberM1; totalM1 += numberP1; for (i = 0; i < numberP1; i++) type[i] = 0; for (i = 0; i < numberM1; i++) { which[numberP1] = which[numberIntegers_-i-1]; type[numberP1++] = 1; } } if (addOne) { // add in slack which[numberP1] = numberIntegers_ + numberSlacks - 1; slack = numberP1; type[numberP1++] = 1; } else if (slack >= 0) { for (i = 0; i < numberP1; i++) { if (which[i] == slack) { slack = i; } } } object[numberCliques] = new CbcClique(this, objectType, numberP1, which, type, 1000000 + numberCliques, slack); numberCliques++; } else if (numberP1 + numberM1 >= lessThanThis) { // too big numberBig++; totalBig += numberP1 + numberM1; } } } } delete [] which; delete [] type; delete [] lookup; #if COIN_DEVELOP>1 if (numberCliques < 0) { printf("*** Problem infeasible\n"); } else { if (numberCliques) printf("%d cliques of average size %g found, %d P1, %d M1\n", numberCliques, (static_cast(totalP1 + totalM1)) / (static_cast (numberCliques)), totalP1, totalM1); else printf("No cliques found\n"); if (numberBig) printf("%d large cliques ( >= %d) found, total %d\n", numberBig, lessThanThis, totalBig); if (numberFixed) printf("%d variables fixed\n", numberFixed); } #endif /* If required, augment the constraint matrix with clique slacks. Seems like we should be able to add the necessary integer objects without a complete rebuild of existing integer objects, but I'd need to look further to confirm that (lh, 071219). Finally, add the clique objects. */ if (numberCliques > 0 && numberSlacks && makeEquality) { COIN_DETAIL_PRINT(printf("adding %d integer slacks\n", numberSlacks)); // add variables to make equality rows int * temp = new int[numberIntegers_+numberSlacks]; memcpy(temp, integerVariable_, numberIntegers_*sizeof(int)); // Get new model CbcModel * newModel = new CbcModel(*this); OsiSolverInterface * newSolver = newModel->solver(); for (i = 0; i < numberSlacks; i++) { temp[i+numberIntegers_] = i + numberColumns; int iRow = rows[i]; double value = element[i]; double lowerValue = 0.0; double upperValue = 1.0; double objValue = 0.0; CoinPackedVector column(1, &iRow, &value); newSolver->addCol(column, lowerValue, upperValue, objValue); // set integer newSolver->setInteger(numberColumns + i); if (value > 0) newSolver->setRowLower(iRow, rowUpper[iRow]); else newSolver->setRowUpper(iRow, rowLower[iRow]); } // replace list of integers for (i = 0; i < newModel->numberObjects_; i++) delete newModel->object_[i]; newModel->numberObjects_ = 0; delete [] newModel->object_; newModel->object_ = NULL; newModel->findIntegers(true); //Set up all integer objects for (i = 0; i < numberIntegers_; i++) { newModel->modifiableObject(i)->setPriority(object_[i]->priority()); } if (originalColumns_) { // old model had originalColumns delete [] newModel->originalColumns_; newModel->originalColumns_ = new int[numberColumns+numberSlacks]; memcpy(newModel->originalColumns_, originalColumns_, numberColumns*sizeof(int)); // mark as not in previous model for (i = numberColumns; i < numberColumns + numberSlacks; i++) newModel->originalColumns_[i] = -1; } delete [] rows; delete [] element; newModel->addObjects(numberCliques, object); assert (ownObjects_); for (; i < numberCliques; i++) delete object[i]; delete [] object; newModel->synchronizeModel(); return newModel; } else { assert (ownObjects_); if (numberCliques > 0) { addObjects(numberCliques, object); for (; i < numberCliques; i++) delete object[i]; synchronizeModel(); } delete [] object; delete [] rows; delete [] element; return this; } } // Fill in useful estimates void CbcModel::pseudoShadow(int iActive) { assert (iActive<2*8*32 && iActive> -3); if (iActive == -1) { if (numberNodes_) { // zero out for (int i = 0; i < numberObjects_; i++) { CbcSimpleIntegerDynamicPseudoCost * obj1 = dynamic_cast (object_[i]) ; if (obj1) { //assert (obj1->downShadowPrice()>0.0); #define P_FACTOR 1.0 #ifndef JJF_ONE obj1->setDownShadowPrice(-P_FACTOR*obj1->downShadowPrice()); obj1->setUpShadowPrice(-P_FACTOR*obj1->upShadowPrice()); #else double pCost; double sCost; pCost = obj1->downDynamicPseudoCost(); sCost = P_FACTOR * obj1->downShadowPrice(); if (!obj1->numberTimesDown() || sCost > pCost) obj1->updateDownDynamicPseudoCost(sCost); obj1->setDownShadowPrice(0.0); pCost = obj1->upDynamicPseudoCost(); sCost = P_FACTOR * obj1->upShadowPrice(); if (!obj1->numberTimesUp() || sCost > pCost) obj1->updateUpDynamicPseudoCost(sCost); obj1->setUpShadowPrice(0.0); #endif } } } return; } bool doShadow = false; if (!iActive || iActive >= 32) { doShadow = true; if (iActive >= 32) iActive -= 32; } double * rowWeight = NULL; double * columnWeight = NULL; int numberColumns = solver_->getNumCols() ; int numberRows = solver_->getNumRows() ; // Column copy of matrix const double * element = solver_->getMatrixByCol()->getElements(); const int * row = solver_->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver_->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver_->getMatrixByCol()->getVectorLengths(); const double * dual = solver_->getRowPrice(); const double * solution = solver_->getColSolution(); const double * dj = solver_->getReducedCost(); bool useMax = false; bool useAlpha = false; if (iActive) { // Use Patel and Chinneck ideas rowWeight = new double [numberRows]; columnWeight = new double [numberColumns]; // add in active constraints double tolerance = 1.0e-5; const double *rowLower = getRowLower() ; const double *rowUpper = getRowUpper() ; const double *rowActivity = solver_->getRowActivity(); const double * lower = getColLower(); const double * upper = getColUpper(); CoinZeroN(rowWeight, numberRows); /* 1 A weight 1 2 B weight 1/sum alpha 3 L weight 1/number integer 4 M weight 1/number active integer 7 O weight 1/number integer and use alpha 8 P weight 1/number active integer and use alpha 9 up subtract 8 and use maximum */ if (iActive > 8) { iActive -= 8; useMax = true; } if (iActive > 4) { iActive -= 4; useAlpha = true; } switch (iActive) { // A case 1: for (int iRow = 0; iRow < numberRows; iRow++) { if (rowActivity[iRow] > rowUpper[iRow] - tolerance || rowActivity[iRow] < rowLower[iRow] + tolerance) { rowWeight[iRow] = 1.0; } } break; // B case 2: for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; rowWeight[iRow] += fabs(element[j]); } } } for (int iRow = 0; iRow < numberRows; iRow++) { if (rowWeight[iRow]) rowWeight[iRow] = 1.0 / rowWeight[iRow]; } break; // L case 3: for (int jColumn = 0; jColumn < numberIntegers_; jColumn++) { int iColumn = integerVariable_[jColumn]; if (upper[iColumn] > lower[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; rowWeight[iRow]++; } } } for (int iRow = 0; iRow < numberRows; iRow++) { if (rowWeight[iRow]) rowWeight[iRow] = 1.0 / rowWeight[iRow]; } break; // M case 4: for (int jColumn = 0; jColumn < numberIntegers_; jColumn++) { int iColumn = integerVariable_[jColumn]; double value = solution[iColumn]; if (fabs(value - floor(value + 0.5)) > 1.0e-5) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; rowWeight[iRow]++; } } } for (int iRow = 0; iRow < numberRows; iRow++) { if (rowWeight[iRow]) rowWeight[iRow] = 1.0 / rowWeight[iRow]; } break; } if (doShadow) { for (int iRow = 0; iRow < numberRows; iRow++) { rowWeight[iRow] *= dual[iRow]; } } dual = rowWeight; } const double *objective = solver_->getObjCoefficients() ; double direction = solver_->getObjSense(); double * down = new double[numberColumns]; double * up = new double[numberColumns]; double upSum = 1.0e-20; double downSum = 1.0e-20; int numberIntegers = 0; if (doShadow) { // shadow prices if (!useMax) { for (int jColumn = 0; jColumn < numberIntegers_; jColumn++) { int iColumn = integerVariable_[jColumn]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; double upValue = 0.0; double downValue = 0.0; double value = direction * objective[iColumn]; if (value) { if (value > 0.0) upValue += value; else downValue -= value; } for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; value = -dual[iRow]; assert (fabs(dual[iRow]) < 1.0e50); if (value) { value *= element[j]; if (value > 0.0) upValue += value; else downValue -= value; } } up[iColumn] = upValue; down[iColumn] = downValue; if (solver_->isInteger(iColumn)) { if (!numberNodes_ && handler_->logLevel() > 1) printf("%d - up %g down %g cost %g\n", iColumn, upValue, downValue, objective[iColumn]); upSum += upValue; downSum += downValue; numberIntegers++; } } } else { for (int jColumn = 0; jColumn < numberIntegers_; jColumn++) { int iColumn = integerVariable_[jColumn]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; double upValue = 0.0; double downValue = 0.0; double value = direction * objective[iColumn]; if (value) { if (value > 0.0) upValue += value; else downValue -= value; } for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; value = -dual[iRow]; if (value) { value *= element[j]; if (value > 0.0) upValue = CoinMax(upValue, value); else downValue = CoinMax(downValue, -value); } } up[iColumn] = upValue; down[iColumn] = downValue; if (solver_->isInteger(iColumn)) { if (!numberNodes_ && handler_->logLevel() > 1) printf("%d - up %g down %g cost %g\n", iColumn, upValue, downValue, objective[iColumn]); upSum += upValue; downSum += downValue; numberIntegers++; } } } } else { for (int jColumn = 0; jColumn < numberIntegers_; jColumn++) { int iColumn = integerVariable_[jColumn]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; double upValue = 0.0; double downValue = 0.0; double value = direction * objective[iColumn]; if (value) { if (value > 0.0) upValue += value; else downValue -= value; } double weight = 0.0; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; value = -dual[iRow]; double thisWeight = rowWeight[iRow]; if (useAlpha) thisWeight *= fabs(element[j]); if (!useMax) weight += thisWeight; else weight = CoinMax(weight, thisWeight); if (value) { value *= element[j]; if (value > 0.0) upValue += value; else downValue -= value; } } columnWeight[iColumn] = weight; // use dj if bigger double djValue = dj[iColumn]; upValue = CoinMax(upValue, djValue); downValue = CoinMax(downValue, -djValue); up[iColumn] = upValue; down[iColumn] = downValue; if (solver_->isInteger(iColumn)) { if (!numberNodes_ && handler_->logLevel() > 1) printf("%d - dj %g up %g down %g cost %g\n", iColumn, djValue, upValue, downValue, objective[iColumn]); upSum += upValue; downSum += downValue; numberIntegers++; } } if (numberIntegers) { double averagePrice = (0.5 * (upSum + downSum)) / static_cast(numberIntegers); //averagePrice *= 0.1; averagePrice *= 100.0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double weight = columnWeight[iColumn]; up[iColumn] += averagePrice * weight; down[iColumn] += averagePrice * weight; } } } delete [] rowWeight; delete [] columnWeight; if (numberIntegers) { double smallDown = 0.0001 * (downSum / static_cast (numberIntegers)); double smallUp = 0.0001 * (upSum / static_cast (numberIntegers)); #define PSEUDO_FACTOR 5.0e-1 double pseudoFactor = PSEUDO_FACTOR; //if (!numberNodes_) //pseudoFactor=0.0; for (int i = 0; i < numberObjects_; i++) { CbcSimpleIntegerDynamicPseudoCost * obj1 = dynamic_cast (object_[i]) ; if (obj1 && obj1->upShadowPrice() >= 0.0) { int iColumn = obj1->columnNumber(); double upPseudoCost = obj1->upDynamicPseudoCost(); double saveUp = upPseudoCost; upPseudoCost = CoinMax(pseudoFactor * upPseudoCost, smallUp); upPseudoCost = CoinMax(upPseudoCost, up[iColumn]); upPseudoCost = CoinMax(upPseudoCost, 0.001 * down[iColumn]); obj1->setUpShadowPrice(upPseudoCost); if (upPseudoCost > saveUp && !numberNodes_ && handler_->logLevel() > 1) printf("For %d up went from %g to %g\n", iColumn, saveUp, upPseudoCost); double downPseudoCost = obj1->downDynamicPseudoCost(); double saveDown = downPseudoCost; downPseudoCost = CoinMax(pseudoFactor * downPseudoCost, smallDown); downPseudoCost = CoinMax(downPseudoCost, down[iColumn]); downPseudoCost = CoinMax(downPseudoCost, 0.001 * up[iColumn]); obj1->setDownShadowPrice(downPseudoCost); if (downPseudoCost > saveDown && !numberNodes_ && handler_->logLevel() > 1) printf("For %d down went from %g to %g\n", iColumn, saveDown, downPseudoCost); } } } delete [] down; delete [] up; } /* Set branching priorities. Setting integer priorities looks pretty robust; the call to findIntegers makes sure that SimpleInteger objects are in place. Setting priorities for other objects is entirely dependent on their existence, and the routine may quietly fail in several directions. */ void CbcModel::passInPriorities (const int * priorities, bool ifObject) { findIntegers(false); int i; if (priorities) { int i0 = 0; int i1 = numberObjects_ - 1; if (ifObject) { for (i = numberIntegers_; i < numberObjects_; i++) { object_[i]->setPriority(priorities[i-numberIntegers_]); } i0 = numberIntegers_; } else { for (i = 0; i < numberIntegers_; i++) { object_[i]->setPriority(priorities[i]); } i1 = numberIntegers_ - 1; } messageHandler()->message(CBC_PRIORITY, messages()) << i0 << i1 << numberObjects_ << CoinMessageEol ; } } // Delete all object information void CbcModel::deleteObjects(bool getIntegers) { if (ownObjects_) { int i; for (i = 0; i < numberObjects_; i++) delete object_[i]; delete [] object_; } object_ = NULL; numberObjects_ = 0; if (getIntegers && ownObjects_) findIntegers(true); } /*! Ensure all attached objects (OsiObjects, heuristics, and cut generators) point to this model. */ void CbcModel::synchronizeModel() { if (!numberObjects_) return; int i; for (i = 0; i < numberHeuristics_; i++) heuristic_[i]->setModel(this); for (i = 0; i < numberObjects_; i++) { CbcObject * obj = dynamic_cast (object_[i]) ; if (obj) { obj->setModel(this); obj->setPosition(i); } } for (i = 0; i < numberCutGenerators_; i++) generator_[i]->refreshModel(this); if (!solverCharacteristics_) { OsiBabSolver * solverCharacteristics = dynamic_cast (solver_->getAuxiliaryInfo()); if (solverCharacteristics) { solverCharacteristics_ = solverCharacteristics; } else { // replace in solver OsiBabSolver defaultC; solver_->setAuxiliaryInfo(&defaultC); solverCharacteristics_ = dynamic_cast (solver_->getAuxiliaryInfo()); } } solverCharacteristics_->setSolver(solver_); } // Fill in integers and create objects /** The routine first does a scan to count the number of integer variables. It then creates an array, integerVariable_, to store the indices of the integer variables, and an array of `objects', one for each variable. The scan is repeated, this time recording the index of each integer variable in integerVariable_, and creating an CbcSimpleInteger object that contains information about the integer variable. Initially, this is just the index and upper & lower bounds. \todo Note the assumption in cbc that the first numberIntegers_ objects are CbcSimpleInteger. In particular, the code which handles the startAgain case assumes that if the object_ array exists it can simply replace the first numberInteger_ objects. This is arguably unsafe. I am going to re-order if necessary */ void CbcModel::findIntegers(bool startAgain, int type) { assert(solver_); /* No need to do this if we have previous information, unless forced to start over. */ if (numberIntegers_ && !startAgain && object_) return; /* Clear out the old integer variable list, then count the number of integer variables. */ delete [] integerVariable_; integerVariable_ = NULL; numberIntegers_ = 0; int numberColumns = getNumCols(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (isInteger(iColumn)) numberIntegers_++; } // Find out how many old non-integer objects there are int nObjects = 0; OsiObject ** oldObject = object_; int iObject; // also see where old ones were char * mark = new char[numberColumns]; CoinZeroN(mark, numberColumns); int iPriority = -100000; for (iObject = 0; iObject < numberObjects_; iObject++) { iPriority = CoinMax(iPriority, object_[iObject]->priority()); CbcSimpleInteger * obj = dynamic_cast (oldObject[iObject]) ; if (obj) { int iColumn = obj->columnNumber(); if (iColumn >= 0 && iColumn < numberColumns) mark[iColumn] = 1; delete oldObject[iObject]; } else { oldObject[nObjects++] = oldObject[iObject]; } } // See if there any SOS #ifdef COIN_HAS_CLP if (!nObjects) { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver && (clpSolver->numberSOS() || clpSolver->numberObjects())) { // deal with sos const CoinSet * setInfo = clpSolver->setInfo(); int numberSOS = clpSolver->numberSOS(); if (numberSOS) { nObjects = 0; delete [] oldObject; oldObject = new OsiObject * [numberSOS]; for (int i = 0; i < numberSOS; i++) { int type = setInfo[i].setType(); int n = setInfo[i].numberEntries(); const int * which = setInfo[i].which(); const double * weights = setInfo[i].weights(); oldObject[nObjects++] = new CbcSOS(this, n, which, weights, i, type); } } else { // objects - only works with SOS at present int numberObjects = clpSolver->numberObjects(); nObjects = 0; delete [] oldObject; oldObject = new OsiObject * [numberObjects]; OsiObject ** osiObjects = clpSolver->objects(); for (int i = 0; i < numberObjects; i++) { OsiSOS * obj = dynamic_cast (osiObjects[i]) ; if (obj) { int type = obj->setType(); int n = obj->numberMembers(); const int * which = obj->members(); const double * weights = obj->weights(); oldObject[nObjects++] = new CbcSOS(this, n, which, weights, i, type); } } } } } #endif /* Found any? Allocate an array to hold the indices of the integer variables. Make a large enough array for all objects */ delete [] integerVariable_; object_ = new OsiObject * [numberIntegers_+nObjects]; numberObjects_ = numberIntegers_ + nObjects; integerVariable_ = new int [numberIntegers_]; /* Walk the variables again, filling in the indices and creating objects for the integer variables. Initially, the objects hold the index and upper & lower bounds. */ numberIntegers_ = 0; if (type == 2) continuousPriority_ = iPriority + 1; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (isInteger(iColumn)) { if (!type) { object_[numberIntegers_] = new CbcSimpleInteger(this, iColumn); } else if (type == 1) { object_[numberIntegers_] = new CbcSimpleIntegerPseudoCost(this, iColumn, 0.3); } else if (type == 2) { object_[numberIntegers_] = new CbcSimpleInteger(this, iColumn); if (mark[iColumn]) { // could up priority on costs if all costs same?? } else { object_[numberIntegers_]->setPriority(iPriority + 1); } } integerVariable_[numberIntegers_++] = iColumn; } } delete [] mark; // Now append other objects memcpy(object_ + numberIntegers_, oldObject, nObjects*sizeof(OsiObject *)); // Delete old array (just array) delete [] oldObject; if (!numberObjects_) handler_->message(CBC_NOINT, messages_) << CoinMessageEol ; } /* If numberBeforeTrust >0 then we are going to use CbcBranchDynamic. Scan and convert CbcSimpleInteger objects */ void CbcModel::convertToDynamic() { int iObject; const double * cost = solver_->getObjCoefficients(); bool allDynamic = true; for (iObject = 0; iObject < numberObjects_; iObject++) { CbcSimpleInteger * obj1 = dynamic_cast (object_[iObject]) ; CbcSimpleIntegerPseudoCost * obj1a = dynamic_cast (object_[iObject]) ; CbcSimpleIntegerDynamicPseudoCost * obj2 = dynamic_cast (object_[iObject]) ; if (obj1 && !obj2) { // replace int iColumn = obj1->columnNumber(); int priority = obj1->priority(); int preferredWay = obj1->preferredWay(); double costValue = CoinMax(1.0e-5, fabs(cost[iColumn])); // treat as if will cost what it says up double upCost = costValue; #ifndef BRANCH_BREAKEVEN #define BRANCH_BREAKEVEN 0.3 #else preferredWay=1; #endif // and balance at breakeven of 0.3 double downCost = ((1.0-BRANCH_BREAKEVEN) * upCost) / BRANCH_BREAKEVEN; if (obj1a) { upCost = obj1a->upPseudoCost(); downCost = obj1a->downPseudoCost(); } delete object_[iObject]; CbcSimpleIntegerDynamicPseudoCost * newObject = new CbcSimpleIntegerDynamicPseudoCost(this, iColumn, 1.0e0*downCost, 1.0e0*upCost); //newObject->setNumberBeforeTrust(numberBeforeTrust_); newObject->setPriority(priority); newObject->setPosition(iObject); newObject->setPreferredWay(preferredWay); object_[iObject] = newObject; } else if (!obj2) { CbcObject * obj3 = dynamic_cast (object_[iObject]) ; if (!obj3 || !obj3->optionalObject()) allDynamic = false; } else { // synchronize trust //obj2->setNumberBeforeTrust(numberBeforeTrust_); } } if (branchingMethod_) { if ((branchingMethod_->whichMethod()&1) == 0 && !branchingMethod_->chooseMethod()) { // Need a method which can do better delete branchingMethod_; branchingMethod_ = NULL; } } if (allDynamic) ownership_ |= 0x40000000; if (!branchingMethod_ && allDynamic) { // create one branchingMethod_ = new CbcBranchDynamicDecision(); } #ifdef SWITCH_VARIABLES // see if any switching variables if (numberIntegers_getNumCols()) findSwitching(); #endif synchronizeNumberBeforeTrust(); } #ifdef SWITCH_VARIABLES // Convert Dynamic to Switching int CbcModel::findSwitching() { if ((moreSpecialOptions2_&1)==0) return 0; const CoinPackedMatrix * rowCopy = solver_->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowLower = solver_->getRowLower(); const double * rowUpper = solver_->getRowUpper(); const double * columnLower = solver_->getColLower(); const double * columnUpper = solver_->getColUpper(); const double * element = rowCopy->getElements(); //const double * element = solver_->getMatrixByCol()->getElements(); const int * row = solver_->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver_->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver_->getMatrixByCol()->getVectorLengths(); int numberRows = solver_->getNumRows(); int numberColumns = solver_->getNumCols(); int * sort = new int[2*numberRows+2+numberColumns]; int * whichRow = sort+numberRows+1; int * marked = whichRow+numberRows+1; memset(marked,0,numberColumns*sizeof(int)); int nnSwitch=0; int nnSwitchTotal=0; int n2Switch=0; double largeRatio1=1000.0; double largeRatio2=100.0; for (int i=0;i (object_[i])) continue; int nAdd=0; bool takeThis=false; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; if (rowLength[iRow]!=2) { continue; } // for now just 0.0 in rhs if (!rowLower[iRow]) { if (rowUpper[iRow]!=COIN_DBL_MAX) continue; } else if (rowLower[iRow]!=-COIN_DBL_MAX) { continue; } else if (rowUpper[iRow]) { continue; } CoinBigIndex k = rowStart[iRow]; double bValue, cValue; int cColumn; if (column[k]==iColumn) { bValue=element[k]; cValue=element[k+1]; cColumn=column[k+1]; } else { bValue=element[k+1]; cValue=element[k]; cColumn=column[k]; } if (solver_->isInteger(cColumn)) continue; if (columnLower[cColumn]<0.0) continue; if (bValue*cValue>0.0) continue; if (fabs(bValue)>largeRatio1*fabs(cValue)) takeThis=true; // add to list whichRow[nAdd]=iRow; sort[nAdd++]=cColumn; } if (nAdd) { n2Switch++; CoinSort_2(sort,sort+nAdd,whichRow); int last=sort[0]; for (int k=1;k (object_[i]); if (thisOne) { assert(iColumn == thisOne->columnNumber()); object_[i]=new CbcSwitchingBinary(thisOne,nAdd,sort,whichRow); delete thisOne; } else { CbcSimpleInteger * thisOne = dynamic_cast (object_[i]); assert (thisOne); assert(iColumn == thisOne->columnNumber()); CbcSimpleIntegerDynamicPseudoCost tempObj(this,iColumn,0.1); object_[i]=new CbcSwitchingBinary(&tempObj,nAdd,sort,whichRow); delete thisOne; } } } // see if there is an interesting row for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; // for now just 0.0 in rhs if (!rowLower[iRow]) { if (rowUpper[iRow]!=COIN_DBL_MAX) continue; } else if (rowLower[iRow]!=-COIN_DBL_MAX) { continue; } else if (rowUpper[iRow]) { continue; } int nOther=0; double bEl=0.0; double cMax=-COIN_DBL_MAX; double cMin=COIN_DBL_MAX; for (CoinBigIndex k = rowStart[iRow]; kisInteger(jColumn)) { cMin=-1.0; cMax=1.0; break; } else { cMax=CoinMax(cMax,element[k]); cMin=CoinMin(cMin,element[k]); if (columnLower[jColumn]<0.0) { cMin=-1.0; cMax=1.0; break; } } } } double largestC = CoinMax(fabs(cMin),fabs(cMax)); if (((cMin>0.0&&bEl<0.0&&!rowUpper[iRow])|| (cMin<0.0&&bEl>0.0&&!rowLower[iRow]))&&cMin*cMax>0.0&& fabs(bEl)>largeRatio2*largestC) { // forces to zero CbcSwitchingBinary * object = dynamic_cast (object_[i]); if (!object) { // create empty one CbcSimpleIntegerDynamicPseudoCost * thisOne = dynamic_cast (object_[i]); if (thisOne) { assert(iColumn == thisOne->columnNumber()); object=new CbcSwitchingBinary(thisOne,0,sort,whichRow); delete thisOne; } else { CbcSimpleInteger * thisOne = dynamic_cast (object_[i]); assert (thisOne); assert(iColumn == thisOne->columnNumber()); CbcSimpleIntegerDynamicPseudoCost tempObj(this,iColumn,0.1); object=new CbcSwitchingBinary(&tempObj,0,sort,whichRow); delete thisOne; } object_[i]=object; } object->addZeroSwitches(nOther,sort); nnSwitch++; nnSwitchTotal+=nOther; } } } if (n2Switch+nnSwitch) { if (handler_->logLevel()>2) printf("%d two switch variables - %d multi (total multi %d)\n", n2Switch,nnSwitch,nnSwitchTotal); memset(whichRow,0,(numberRows+1)*sizeof(int)); for (int i=0;ilogLevel()>2) { for (int i=0;i (object_[i]); if (object) { n += object->setAssociatedBounds(solver,cleanBasis); } } nChanged+=n; } } return nChanged; } /* Debug associated variables printLevel - 1 summary if bad on fixed 2 summary if bad on satisfied 3 for individuals */ int CbcModel::checkAssociated(const OsiSolverInterface * solver, const double * solution,int printLevel) { int nBad=0; int nBadFixed=0; if ((moreSpecialOptions2_&4)!=0) { int nAt0=0; int nAt1=0; int nBetween=0; for (int i=0;i (object_[i]); if (object) { int state[3]; nBad += object->checkAssociatedBounds(solver,solution,printLevel,state, nBadFixed); if (state[0]==0) nBetween++; else if (state[0]==-1) nAt0++; else nAt1++; } } if (handler_->logLevel()>2) { if (printLevel>1||(printLevel==1&&nBadFixed)) { printf("%d switches, %d at 0, %d at 1, %d between - %d bad values (%d when fixed)\n", nBetween+nAt0+nAt1,nAt0,nAt1,nBetween,nBad,nBadFixed); if (nBadFixed && printLevel!=3) checkAssociated(solver,solution,3); } } } return nBad; } #endif // Set numberBeforeTrust in all objects void CbcModel::synchronizeNumberBeforeTrust(int type) { int iObject; for (iObject = 0; iObject < numberObjects_; iObject++) { CbcSimpleIntegerDynamicPseudoCost * obj2 = dynamic_cast (object_[iObject]) ; if (obj2) { // synchronize trust if (!type) { obj2->setNumberBeforeTrust(numberBeforeTrust_); } else if (type == 1) { int value = obj2->numberBeforeTrust(); value = (value * 11) / 10 + 1; value = CoinMax(numberBeforeTrust_, value); obj2->setNumberBeforeTrust(value); } else { assert (type == 2); int value = obj2->numberBeforeTrust(); int n = CoinMax(obj2->numberTimesDown(), obj2->numberTimesUp()); if (n >= value) { value = CoinMin(CoinMin(n+1,3*(value+1)/2),5*numberBeforeTrust_); obj2->setNumberBeforeTrust(value); } } } } } /* Add in any object information (objects are cloned - owner can delete originals */ void CbcModel::addObjects(int numberObjects, CbcObject ** objects) { // If integers but not enough objects fudge if (numberIntegers_ > numberObjects_ || !numberObjects_) findIntegers(true); /* But if incoming objects inherit from simple integer we just want to replace */ int numberColumns = solver_->getNumCols(); /** mark is -1 if not integer, >=0 if using existing simple integer and >=numberColumns if using new integer */ int * mark = new int[numberColumns]; int i; for (i = 0; i < numberColumns; i++) mark[i] = -1; int newNumberObjects = numberObjects; int newIntegers = 0; for (i = 0; i < numberObjects; i++) { CbcSimpleInteger * obj = dynamic_cast (objects[i]) ; if (obj) { int iColumn = obj->columnNumber(); assert (iColumn >= 0); mark[iColumn] = i + numberColumns; newIntegers++; } } // and existing for (i = 0; i < numberObjects_; i++) { CbcSimpleInteger * obj = dynamic_cast (object_[i]) ; if (obj) { int iColumn = obj->columnNumber(); if (mark[iColumn] < 0) { newIntegers++; newNumberObjects++; mark[iColumn] = i; } } else { // some other object - keep newNumberObjects++; } } delete [] integerVariable_; integerVariable_ = NULL; #if COIN_DEVELOP>1 if (newIntegers != numberIntegers_) printf("changing number of integers from %d to %d\n", numberIntegers_, newIntegers); #endif numberIntegers_ = newIntegers; integerVariable_ = new int [numberIntegers_]; OsiObject ** temp = new OsiObject * [newNumberObjects]; // Put integers first newIntegers = 0; numberIntegers_ = 0; for (i = 0; i < numberColumns; i++) { int which = mark[i]; if (which >= 0) { if (!isInteger(i)) { newIntegers++; solver_->setInteger(i); } if (which < numberColumns) { temp[numberIntegers_] = object_[which]; object_[which] = NULL; } else { temp[numberIntegers_] = objects[which-numberColumns]->clone(); } integerVariable_[numberIntegers_++] = i; } } #if COIN_DEVELOP>1 if (newIntegers) printf("%d variables were declared integer\n", newIntegers); #endif int n = numberIntegers_; // Now rest of old for (i = 0; i < numberObjects_; i++) { if (object_[i]) { CbcSimpleInteger * obj = dynamic_cast (object_[i]) ; if (obj) { delete object_[i]; } else { temp[n++] = object_[i]; } } } // and rest of new for (i = 0; i < numberObjects; i++) { CbcSimpleInteger * obj = dynamic_cast (objects[i]) ; if (!obj) { temp[n] = objects[i]->clone(); CbcObject * obj = dynamic_cast (temp[n]) ; if (obj) obj->setModel(this); n++; } } delete [] mark; assert (ownObjects_); delete [] object_; object_ = temp; assert (n == newNumberObjects); numberObjects_ = newNumberObjects; } /* Add in any object information (objects are cloned - owner can delete originals */ void CbcModel::addObjects(int numberObjects, OsiObject ** objects) { // If integers but not enough objects fudge if (numberIntegers_ > numberObjects_) findIntegers(true); /* But if incoming objects inherit from simple integer we just want to replace */ int numberColumns = solver_->getNumCols(); /** mark is -1 if not integer, >=0 if using existing simple integer and >=numberColumns if using new integer */ int * mark = new int[numberColumns]; int i; for (i = 0; i < numberColumns; i++) mark[i] = -1; int newNumberObjects = numberObjects; int newIntegers = 0; for (i = 0; i < numberObjects; i++) { CbcSimpleInteger * obj = dynamic_cast (objects[i]) ; if (obj) { int iColumn = obj->columnNumber(); mark[iColumn] = i + numberColumns; newIntegers++; } else { OsiSimpleInteger * obj2 = dynamic_cast (objects[i]) ; if (obj2) { // Osi takes precedence int iColumn = obj2->columnNumber(); mark[iColumn] = i + numberColumns; newIntegers++; } } } // and existing for (i = 0; i < numberObjects_; i++) { CbcSimpleInteger * obj = dynamic_cast (object_[i]) ; if (obj) { int iColumn = obj->columnNumber(); if (mark[iColumn] < 0) { newIntegers++; newNumberObjects++; mark[iColumn] = i; } } } delete [] integerVariable_; integerVariable_ = NULL; #if COIN_DEVELOP>1 if (newIntegers != numberIntegers_) printf("changing number of integers from %d to %d\n", numberIntegers_, newIntegers); #endif numberIntegers_ = newIntegers; integerVariable_ = new int [numberIntegers_]; OsiObject ** temp = new OsiObject * [newNumberObjects]; // Put integers first newIntegers = 0; numberIntegers_ = 0; for (i = 0; i < numberColumns; i++) { int which = mark[i]; if (which >= 0) { if (!isInteger(i)) { newIntegers++; solver_->setInteger(i); } if (which < numberColumns) { temp[numberIntegers_] = object_[which]; object_[which] = NULL; } else { temp[numberIntegers_] = objects[which-numberColumns]->clone(); } integerVariable_[numberIntegers_++] = i; } } #if COIN_DEVELOP>1 if (newIntegers) printf("%d variables were declared integer\n", newIntegers); #endif int n = numberIntegers_; // Now rest of old for (i = 0; i < numberObjects_; i++) { if (object_[i]) { CbcSimpleInteger * obj = dynamic_cast (object_[i]) ; if (obj) { delete object_[i]; } else { temp[n++] = object_[i]; } } } // and rest of new for (i = 0; i < numberObjects; i++) { CbcSimpleInteger * obj = dynamic_cast (objects[i]) ; OsiSimpleInteger * obj2 = dynamic_cast (objects[i]) ; if (!obj && !obj2) { temp[n] = objects[i]->clone(); CbcObject * obj = dynamic_cast (temp[n]) ; if (obj) obj->setModel(this); n++; } } delete [] mark; assert (ownObjects_); delete [] object_; object_ = temp; assert (n == newNumberObjects); numberObjects_ = newNumberObjects; } /** This routine sets the objective cutoff value used for fathoming and determining monotonic variables. If the fathoming discipline is strict, a small tolerance is added to the new cutoff. This avoids problems due to roundoff when the target value is exact. The common example would be an IP with only integer variables in the objective. If the target is set to the exact value z of the optimum, it's possible to end up fathoming an ancestor of the solution because the solver returns z+epsilon. Determining if strict fathoming is needed is best done by analysis. In cbc, that's analyseObjective. The default is false. In cbc we always minimize so add epsilon */ void CbcModel::setCutoff (double value) { #ifdef JJF_ZERO double tol = 0 ; int fathomStrict = getIntParam(CbcFathomDiscipline) ; if (fathomStrict == 1) { solver_->getDblParam(OsiDualTolerance, tol) ; tol = tol * (1 + fabs(value)) ; value += tol ; } #endif dblParam_[CbcCurrentCutoff] = value; if (solver_) { // Solvers know about direction double direction = solver_->getObjSense(); solver_->setDblParam(OsiDualObjectiveLimit, value*direction); } } /* Call this to really test if a valid solution can be feasible. The cutoff is passed in as a parameter so that we don't need to worry here after swapping solvers. The solution is assumed to be numberColumns in size. If fixVariables is true then the bounds of the continuous solver are updated. The routine returns the objective value determined by reoptimizing from scratch. If the solution is rejected, this will be worse than the cutoff. TODO: There's an issue with getting the correct cutoff value: We update the cutoff in the regular solver, but not in continuousSolver_. But our only use for continuousSolver_ is verifying candidate solutions. Would it make sense to update the cutoff? Then we wouldn't need to step around isDualObjectiveLimitReached(). */ double CbcModel::checkSolution (double cutoff, double *solution, int fixVariables, double objectiveValue) { int numberContinuousColumns=continuousSolver_->getNumCols(); if (!solverCharacteristics_->solutionAddsCuts()) { // Can trust solution int numberColumns = solver_->getNumCols(); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpContinuousSolver = dynamic_cast (continuousSolver_); int modifiedTolerances=0; #ifndef CBC_LEAVE_PERTURBATION_ON_CHECK_SOLUTION int savePerturbation=-1; #endif #ifndef CBC_LEAVE_TOLERANCE_ON_CHECK_SOLUTION double savePrimalTolerance=0.0; #endif #ifndef CBC_LEAVE_SCALING_ON_CHECK_SOLUTION int saveScaling=-1; #endif if (clpContinuousSolver ) { // be more accurate if possible ClpSimplex * clp = clpContinuousSolver->getModelPtr(); #ifndef CBC_LEAVE_PERTURBATION_ON_CHECK_SOLUTION savePerturbation=clp->perturbation(); #endif #ifndef CBC_LEAVE_TOLERANCE_ON_CHECK_SOLUTION savePrimalTolerance=clp->primalTolerance(); #endif #ifndef CBC_LEAVE_SCALING_ON_CHECK_SOLUTION saveScaling=clp->scalingFlag(); #endif #ifndef CBC_LEAVE_TOLERANCE_ON_CHECK_SOLUTION if (savePrimalTolerance>0.9999999e-7) { modifiedTolerances |= 1; clp->setPrimalTolerance(1.0e-8); } #endif #ifndef CBC_LEAVE_PERTURBATION_ON_CHECK_SOLUTION if (savePerturbation<100) { modifiedTolerances |= 2; clp->setPerturbation(100); } #endif #ifndef CBC_LEAVE_SCALING_ON_CHECK_SOLUTION if (saveScaling) { modifiedTolerances |= 4; clp->scaling(0); } #endif } #endif /* Grab the continuous solver (the pristine copy of the problem, made before starting to work on the root node). Save the bounds on the variables. Install the solution passed as a parameter, and copy it to the model's currentSolution_. TODO: This is a belt-and-suspenders approach. Once the code has settled a bit, we can cast a critical eye here. */ OsiSolverInterface * saveSolver = solver_; if (continuousSolver_) solver_ = continuousSolver_; // save basis and solution CoinWarmStartBasis * basis = dynamic_cast(solver_->getWarmStart()) ; assert(basis != NULL); double * saveSolution = CoinCopyOfArray(solver_->getColSolution(), solver_->getNumCols()); // move solution to continuous copy solver_->setColSolution(solution); // Put current solution in safe place // Point to current solution const double * save = testSolution_; // Safe as will be const inside infeasibility() testSolution_ = solver_->getColSolution(); //memcpy(currentSolution_,solver_->getColSolution(), // numberColumns*sizeof(double)); //solver_->messageHandler()->setLogLevel(4); // save original bounds double * saveUpper = new double[numberColumns]; double * saveLower = new double[numberColumns]; memcpy(saveUpper, getColUpper(), numberColumns*sizeof(double)); memcpy(saveLower, getColLower(), numberColumns*sizeof(double)); //#define CLP_INVESTIGATE4 #if CBC_USEFUL_PRINTING>14 { int nBad=checkAssociated(solver_,solver_->getColSolution(),1); if (nBad) checkAssociated(solver_,solver_->getColSolution(),3); double largestInfeasibility = 0.0; double primalTolerance ; double offset; solver_->getDblParam(OsiObjOffset, offset); solver_->getDblParam(OsiPrimalTolerance, primalTolerance) ; const double *objective = getObjCoefficients() ; const double * rowLower = solver_->getRowLower() ; const double * rowUpper = solver_->getRowUpper() ; const double * columnLower = solver_->getColLower() ; const double * columnUpper = solver_->getColUpper() ; int numberRows = solver_->getNumRows() ; double *rowActivity = new double[numberRows] ; memset(rowActivity, 0, numberRows*sizeof(double)) ; double *rowSum = new double[numberRows] ; memset(rowSum, 0, numberRows*sizeof(double)) ; int * marked = new int [numberColumns]; for (int i=0;i (object_[i]); if (object) { int iColumn = object->columnNumber(); const int * other = object->otherVariable(); marked[iColumn]=-3-other[0]; int n=object->numberOther(); for (int k=0;kgetMatrixByCol()->getElements(); const int * row = solver_->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver_->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver_->getMatrixByCol()->getVectorLengths(); const CoinPackedMatrix * rowCopy = solver_->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * elementByRow = rowCopy->getElements(); double objValue=-offset; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; objValue += value*objective[iColumn]; if (value>columnUpper[iColumn]) { if (value-columnUpper[iColumn]>1.0e-8) printf("column %d has value %.12g above %.12g\n",iColumn,value,columnUpper[iColumn]); value=columnUpper[iColumn]; } else if (value primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); inf = rowActivity[i] - rowUpper[i]; if (inf > primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); #endif double infeasibility = CoinMax(rowActivity[i]-rowUpper[i], rowLower[i]-rowActivity[i]); // but allow for errors double factor = CoinMax(1.0,rowSum[i]*1.0e-3); if (infeasibility>largestInfeasibility*factor) { largestInfeasibility = infeasibility/factor; printf("Ainf of %g on row %d sum %g scaled %g\n", infeasibility,i,rowSum[i],largestInfeasibility); if (infeasibility>1.0e10) { for (CoinBigIndex j=rowStart[i]; j 10.0*primalTolerance) printf("Alargest infeasibility is %g - obj %g\n", largestInfeasibility,objValue); else printf("Afeasible (%g) - obj %g\n", largestInfeasibility,objValue); } #endif // point to useful information OsiBranchingInformation usefulInfo = usefulInformation(); /* Run through the objects and use feasibleRegion() to set variable bounds so as to fix the variables specified in the objects at their value in this solution. Since the object list contains (at least) one object for every integer variable, this has the effect of fixing all integer variables. */ int i; for (i = 0; i < numberObjects_; i++) object_[i]->feasibleRegion(solver_, &usefulInfo); #if CBC_USEFUL_PRINTING>14 { int nBad=checkAssociated(solver_,solver_->getColSolution(),1); if (nBad) checkAssociated(solver_,solver_->getColSolution(),3); double largestInfeasibility = 0.0; double primalTolerance ; double offset; solver_->getDblParam(OsiObjOffset, offset); solver_->getDblParam(OsiPrimalTolerance, primalTolerance) ; const double *objective = getObjCoefficients() ; const double * rowLower = solver_->getRowLower() ; const double * rowUpper = solver_->getRowUpper() ; const double * columnLower = solver_->getColLower() ; const double * columnUpper = solver_->getColUpper() ; int numberRows = solver_->getNumRows() ; double *rowActivity = new double[numberRows] ; memset(rowActivity, 0, numberRows*sizeof(double)) ; double *rowSum = new double[numberRows] ; memset(rowSum, 0, numberRows*sizeof(double)) ; int * marked = new int [numberColumns]; for (int i=0;i (object_[i]); if (object) { int iColumn = object->columnNumber(); const int * other = object->otherVariable(); marked[iColumn]=-3-other[0]; int n=object->numberOther(); for (int k=0;kgetMatrixByCol()->getElements(); const int * row = solver_->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver_->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver_->getMatrixByCol()->getVectorLengths(); const CoinPackedMatrix * rowCopy = solver_->getMatrixByRow(); const int * column = rowCopy->getIndices(); const int * rowLength = rowCopy->getVectorLengths(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * elementByRow = rowCopy->getElements(); double objValue=-offset; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; objValue += value*objective[iColumn]; if (value>columnUpper[iColumn]) { if (value-columnUpper[iColumn]>1.0e-8) printf("column %d has value %.12g above %.12g\n",iColumn,value,columnUpper[iColumn]); value=columnUpper[iColumn]; } else if (value primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); inf = rowActivity[i] - rowUpper[i]; if (inf > primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); #endif double infeasibility = CoinMax(rowActivity[i]-rowUpper[i], rowLower[i]-rowActivity[i]); // but allow for errors double factor = CoinMax(1.0,rowSum[i]*1.0e-3); if (infeasibility>largestInfeasibility*factor) { largestInfeasibility = infeasibility/factor; printf("inf of %g on row %d sum %g scaled %g\n", infeasibility,i,rowSum[i],largestInfeasibility); if (infeasibility>1.0e10) { for (CoinBigIndex j=rowStart[i]; j 10.0*primalTolerance) printf("Largest infeasibility is %g - obj %g\n", largestInfeasibility,objValue); else printf("Feasible (%g) - obj %g\n", largestInfeasibility,objValue); } #endif // If relaxed then leave bounds on basic variables if (fixVariables == -1 && (specialOptions_&16) == 0) { CoinWarmStartBasis * basis = dynamic_cast(saveSolver->getWarmStart()) ; assert(basis != NULL); #ifdef JJF_ZERO //ndef CBC_OTHER_SOLVER for (i = 0; i < numberObjects_; i++) { CbcSimpleInteger * obj = dynamic_cast (object_[i]) ; if (obj) { int iColumn = obj->columnNumber(); if (basis->getStructStatus(iColumn) == CoinWarmStartBasis::basic) { solver_->setColLower(iColumn, saveLower[iColumn]); solver_->setColUpper(iColumn, saveUpper[iColumn]); } } } #endif delete basis; } // We can switch off check if ((specialOptions_&4) == 0 && (moreSpecialOptions2_&10) != 8) { // Be on safe side - unless very few integers and large bool allSlack = (specialOptions_&2) == 0 && solverCharacteristics_->warmStart(); if (numberIntegers_*4>solver_->getNumCols()||solver_->getNumCols()<10000) allSlack = true; if (allSlack) { /* Remove any existing warm start information to be sure there is no residual influence on initialSolve(). */ CoinWarmStartBasis *slack = dynamic_cast(solver_->getEmptyWarmStart()) ; solver_->setWarmStart(slack); delete slack ; } else { if (bestSolutionBasis_.getNumStructural() == solver_->getNumCols() && bestSolutionBasis_.getNumArtificial() == solver_->getNumRows()) solver_->setWarmStart(&bestSolutionBasis_); } // Give a hint to do dual bool saveTakeHint; OsiHintStrength saveStrength; #ifndef NDEBUG bool gotHint = (solver_->getHintParam(OsiDoDualInInitial, saveTakeHint, saveStrength)); assert (gotHint); #else (solver_->getHintParam(OsiDoDualInInitial, saveTakeHint, saveStrength)); #endif solver_->setHintParam(OsiDoDualInInitial, true, OsiHintTry); solver_->initialSolve(); #ifdef SWITCH_VARIABLES if (solver_->isProvenOptimal()) { int nBad=checkAssociated(solver_,solver_->getColSolution(),1); if (nBad) checkAssociated(solver_,solver_->getColSolution(),3); } #endif #ifdef JJF_ZERO if (solver_->isProvenOptimal()) { solver_->writeMpsNative("feasible.mps",NULL,NULL,2); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver ) { clpSolver->getModelPtr()->writeBasis("feasible.bas",true); } #endif printf("XXXXXXXXXXXX - saving feasible\n"); } #endif if (!solver_->isProvenOptimal()) { #if CBC_FEASIBILITY_INVESTIGATE printf("checkSolution infeas! Retrying with primal.\n"); #endif //bool saveTakeHint; //OsiHintStrength saveStrength; //bool savePrintHint; //solver_->writeMpsNative("infeas.mps", NULL, NULL, 2); //bool gotHint = (solver_->getHintParam(OsiDoReducePrint,savePrintHint,saveStrength)); //gotHint = (solver_->getHintParam(OsiDoScale,saveTakeHint,saveStrength)); //solver_->setHintParam(OsiDoScale,false,OsiHintTry); //solver_->setHintParam(OsiDoReducePrint,false,OsiHintTry) ; solver_->setHintParam(OsiDoDualInInitial, false, OsiHintTry); solver_->initialSolve(); //solver_->setHintParam(OsiDoScale,saveTakeHint,saveStrength); //solver_->setHintParam(OsiDoReducePrint,savePrintHint,OsiHintTry) ; // go from all slack now specialOptions_ &= ~2; if (!solver_->isProvenOptimal()) { CoinWarmStartBasis *slack = dynamic_cast(solver_->getEmptyWarmStart()) ; solver_->setWarmStart(slack); delete slack ; #if CBC_FEASIBILITY_INVESTIGATE printf("checkSolution infeas! Retrying wihout basis and with primal.\n"); #endif solver_->initialSolve(); //solver_->writeMps("bad"); #ifdef COIN_HAS_CLP if (!solver_->isProvenOptimal()&&modifiedTolerances) { // Restore ClpSimplex * clp = clpContinuousSolver->getModelPtr(); #ifndef CBC_LEAVE_TOLERANCE_ON_CHECK_SOLUTION clp->setPrimalTolerance(savePrimalTolerance); #endif #ifndef CBC_LEAVE_PERTURBATION_ON_CHECK_SOLUTION clp->setPerturbation(savePerturbation); #endif #ifndef CBC_LEAVE_SCALING_ON_CHECK_SOLUTION clp->scaling(saveScaling); #endif solver_->resolve(); } #endif #if CBC_FEASIBILITY_INVESTIGATE if (!solver_->isProvenOptimal()) { printf("checkSolution still infeas!\n"); } #endif } } //assert(solver_->isProvenOptimal()); solver_->setHintParam(OsiDoDualInInitial, saveTakeHint, saveStrength); objectiveValue = solver_->getObjValue() * solver_->getObjSense(); } bestSolutionBasis_ = CoinWarmStartBasis(); /* Check that the solution still beats the objective cutoff. If it passes, make a copy of the primal variable values and do some cleanup and checks: + Values of all variables are are within original bounds and values of all integer variables are within tolerance of integral. + There are no constraint violations. There really should be no need for the check against original bounds. Perhaps an opportunity for a sanity check? */ if (objectiveValue > cutoff && objectiveValue < cutoff + 1.0e-8 + 1.0e-8*fabs(cutoff)) cutoff = objectiveValue; // relax if ((solver_->isProvenOptimal() || (specialOptions_&4) != 0) && objectiveValue <= cutoff) { memcpy(solution , solver_->getColSolution(), numberColumns*sizeof(double)) ; int iColumn; #ifndef NDEBUG double integerTolerance = getIntegerTolerance() ; #endif #if CBC_FEASIBILITY_INVESTIGATE const double * dj = solver_->getReducedCost(); const double * colLower = saveSolver->getColLower(); const double * colUpper = saveSolver->getColUpper(); int nAtLbNatural = 0; int nAtUbNatural = 0; int nAtLbNaturalZero = 0; int nAtUbNaturalZero = 0; int nAtLbFixed = 0; int nAtUbFixed = 0; int nAtOther = 0; int nAtOtherNatural = 0; int nNotNeeded = 0; #endif for (iColumn = 0 ; iColumn < numberContinuousColumns ; iColumn++) { double value = solution[iColumn] ; value = CoinMax(value, saveLower[iColumn]) ; value = CoinMin(value, saveUpper[iColumn]) ; if (solver_->isInteger(iColumn)) { assert(fabs(value - solution[iColumn]) <= 100.0*integerTolerance) ; #if CBC_FEASIBILITY_INVESTIGATE double value2 = floor(value + 0.5); if (dj[iColumn] < -1.0e-6) { // negative dj //assert (value2==colUpper[iColumn]); if (saveUpper[iColumn] == colUpper[iColumn]) { nAtUbNatural++; if (saveLower[iColumn] != colLower[iColumn]) nNotNeeded++; } else if (saveLower[iColumn] == colUpper[iColumn]) { nAtLbFixed++; } else { nAtOther++; if (saveLower[iColumn] != colLower[iColumn] && saveUpper[iColumn] != colUpper[iColumn]) nNotNeeded++; } } else if (dj[iColumn] > 1.0e-6) { // positive dj //assert (value2==colLower[iColumn]); if (saveLower[iColumn] == colLower[iColumn]) { nAtLbNatural++; if (saveUpper[iColumn] != colUpper[iColumn]) nNotNeeded++; } else if (saveUpper[iColumn] == colLower[iColumn]) { nAtUbFixed++; } else { nAtOther++; if (saveLower[iColumn] != colLower[iColumn] && saveUpper[iColumn] != colUpper[iColumn]) nNotNeeded++; } } else { // zero dj if (value2 == saveUpper[iColumn]) { nAtUbNaturalZero++; if (saveLower[iColumn] != colLower[iColumn]) nNotNeeded++; } else if (value2 == saveLower[iColumn]) { nAtLbNaturalZero++; } else { nAtOtherNatural++; if (saveLower[iColumn] != colLower[iColumn] && saveUpper[iColumn] != colUpper[iColumn]) nNotNeeded++; } } #endif } solution[iColumn] = value ; } #if CBC_FEASIBILITY_INVESTIGATE printf("nAtLbNat %d,nAtUbNat %d,nAtLbNatZero %d,nAtUbNatZero %d,nAtLbFixed %d,nAtUbFixed %d,nAtOther %d,nAtOtherNat %d, useless %d\n", nAtLbNatural, nAtUbNatural, nAtLbNaturalZero, nAtUbNaturalZero, nAtLbFixed, nAtUbFixed, nAtOther, nAtOtherNatural, nNotNeeded); //if (currentNode_) //printf(" SOL at depth %d\n",currentNode_->depth()); //else //printf(" SOL at unknown depth\n"); #endif if ((specialOptions_&16) == 0) { #ifdef JJF_ZERO // check without scaling bool saveTakeHint; OsiHintStrength saveStrength; solver_->getHintParam(OsiDoScale, saveTakeHint, saveStrength); solver_->setHintParam(OsiDoScale, false, OsiHintTry); solver_->resolve(); solver_->setHintParam(OsiDoScale, saveTakeHint, saveStrength); #endif double largestInfeasibility = 0.0; double primalTolerance ; solver_->getDblParam(OsiPrimalTolerance, primalTolerance) ; const double * rowLower = solver_->getRowLower() ; const double * rowUpper = solver_->getRowUpper() ; int numberRows = solver_->getNumRows() ; double *rowActivity = new double[numberRows] ; memset(rowActivity, 0, numberRows*sizeof(double)) ; double *rowSum = new double[numberRows] ; memset(rowSum, 0, numberRows*sizeof(double)) ; const double * element = solver_->getMatrixByCol()->getElements(); const int * row = solver_->getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = solver_->getMatrixByCol()->getVectorStarts(); const int * columnLength = solver_->getMatrixByCol()->getVectorLengths(); double offset; solver_->getDblParam(OsiObjOffset, offset); double objValue=-offset; const double *objective = getObjCoefficients() ; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; objValue += value*objective[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; rowSum[iRow] += fabs(value * element[j]); } } } for (i = 0 ; i < numberRows ; i++) { #if CBC_FEASIBILITY_INVESTIGATE>1 double inf; inf = rowLower[i] - rowActivity[i]; if (inf > primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); inf = rowActivity[i] - rowUpper[i]; if (inf > primalTolerance) printf("Row %d inf %g sum %g %g <= %g <= %g\n", i, inf, rowSum[i], rowLower[i], rowActivity[i], rowUpper[i]); #endif double infeasibility = CoinMax(rowActivity[i]-rowUpper[i], rowLower[i]-rowActivity[i]); // but allow for errors double factor = CoinMax(1.0,rowSum[i]*1.0e-3); if (infeasibility>largestInfeasibility*factor) { largestInfeasibility = infeasibility/factor; //printf("inf of %g on row %d sum %g scaled %g\n", // infeasibility,i,rowSum[i],largestInfeasibility); } } delete [] rowActivity ; delete [] rowSum; #if CBC_FEASIBILITY_INVESTIGATE==0 if (handler_->logLevel()>2) { #endif if (largestInfeasibility > 10.0*primalTolerance) printf("BLargest infeasibility is %g - obj %g (%g)\n", largestInfeasibility,objValue,objectiveValue); else printf("BFeasible (%g) - obj %g %g\n", largestInfeasibility,objValue,objectiveValue); #if CBC_FEASIBILITY_INVESTIGATE==0 } #else solver_->writeMpsNative("BFeasible.mps",NULL,NULL,2); #endif //if (fabs(objValue-objectiveValue)>1.0e-7*fabs(objectiveValue)) { //printf("Bad obj values\n"); objectiveValue = objValue; //} #if CBC_FEASIBILITY_INVESTIGATE if (largestInfeasibility > 10.0*primalTolerance) printf("XX largest infeasibility is %g\n", largestInfeasibility); #endif if (largestInfeasibility > 200.0*primalTolerance) { handler_->message(CBC_NOTFEAS3, messages_) << largestInfeasibility << CoinMessageEol ; objectiveValue = 1.0e50 ; } } } else { objectiveValue = 1.0e50 ; } /* Regardless of what we think of the solution, we may need to restore the original bounds of the continuous solver. Unfortunately, const'ness prevents us from simply reversing the memcpy used to make these snapshots. */ if (fixVariables <= 0) { for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++) { solver_->setColLower(iColumn, saveLower[iColumn]) ; solver_->setColUpper(iColumn, saveUpper[iColumn]) ; } } delete [] saveLower; delete [] saveUpper; solver_->setColSolution(saveSolution); delete [] saveSolution; solver_->setWarmStart(basis); delete basis ; /* Restore the usual solver. */ solver_ = saveSolver; testSolution_ = save; #ifdef COIN_HAS_CLP if (modifiedTolerances) { // Restore ClpSimplex * clp = clpContinuousSolver->getModelPtr(); #ifndef CBC_LEAVE_TOLERANCE_ON_CHECK_SOLUTION clp->setPrimalTolerance(savePrimalTolerance); #endif #ifndef CBC_LEAVE_PERTURBATION_ON_CHECK_SOLUTION clp->setPerturbation(savePerturbation); #endif #ifndef CBC_LEAVE_SCALING_ON_CHECK_SOLUTION clp->scaling(saveScaling); #endif } #endif return objectiveValue; } else { // Outer approximation or similar //If this is true then the solution comes from the nlp we don't need to resolve the same nlp with ipopt //solverCharacteristics_->setSolver(solver_); bool solutionComesFromNlp = solverCharacteristics_->bestObjectiveValue() < cutoff; double objectiveValue; int numberColumns = solver_->getNumCols(); double *saveLower = NULL; double * saveUpper = NULL; if (! solutionComesFromNlp) { //Otherwise solution already comes from ipopt and cuts are known if (fixVariables > 0) { //Will temporarily fix all integer valued var // save original bounds saveUpper = new double[numberColumns]; saveLower = new double[numberColumns]; memcpy(saveUpper, solver_->getColUpper(), numberColumns*sizeof(double)); memcpy(saveLower, solver_->getColLower(), numberColumns*sizeof(double)); //in any case solution should be already loaded into solver_ /* Run through the objects and use feasibleRegion() to set variable bounds so as to fix the variables specified in the objects at their value in this solution. Since the object list contains (at least) one object for every integer variable, this has the effect of fixing all integer variables. */ const double * save = testSolution_; testSolution_ = solution; // point to useful information OsiBranchingInformation usefulInfo = usefulInformation(); for (int i = 0; i < numberObjects_; i++) object_[i]->feasibleRegion(solver_, &usefulInfo); testSolution_ = save; resolve(solver_); } /* Now step through the cut generators and see if any of them are flagged to run when a new solution is discovered. Only global cuts are useful. (The solution being evaluated may not correspond to the current location in the search tree --- discovered by heuristic, for example.) */ OsiCuts theseCuts; int i; int lastNumberCuts = 0; // reset probing info //if (probingInfo_) //probingInfo_->initializeFixing(); for (i = 0; i < numberCutGenerators_; i++) { if (generator_[i]->atSolution()) { generator_[i]->generateCuts(theseCuts, 1, solver_, NULL); int numberCuts = theseCuts.sizeRowCuts(); for (int j = lastNumberCuts; j < numberCuts; j++) { const OsiRowCut * thisCut = theseCuts.rowCutPtr(j); if (thisCut->globallyValid()) { // if ((specialOptions_&1)!=0) // { // /* As these are global cuts - // a) Always get debugger object // b) Not fatal error to cutoff optimal (if we have just got optimal) // */ // const OsiRowCutDebugger *debugger = solver_->getRowCutDebuggerAlways() ; // if (debugger) // { // if(debugger->invalidCut(*thisCut)) // printf("ZZZZ Global cut - cuts off optimal solution!\n"); // } // } // add to global list OsiRowCut newCut(*thisCut); newCut.setGloballyValid(true); newCut.mutableRow().setTestForDuplicateIndex(false); globalCuts_.addCutIfNotDuplicate(newCut) ; } else { // obviously wrong if (handler_->logLevel() > 1) printf("Cut generator %s set to run on new solution but NOT globally valid!!\n", generator_[i]->cutGeneratorName()); } } } } // int numberCuts = theseCuts.sizeColCuts(); // for (i=0;igloballyValid()) { // // add to global list // globalCuts_.insert(*thisCut); // } // } //have to retrieve the solution and its value from the nlp } double newObjectiveValue = cutoff; if (solverCharacteristics_->solution(newObjectiveValue, const_cast (solution), numberColumns)) { objectiveValue = newObjectiveValue; } else { objectiveValue = 2e50; } if (!solutionComesFromNlp && fixVariables > 0) { for (int iColumn = 0 ; iColumn < numberColumns ; iColumn++) { solver_->setColLower(iColumn, saveLower[iColumn]) ; solver_->setColUpper(iColumn, saveUpper[iColumn]) ; } delete [] saveLower; delete [] saveUpper; solver_->resolve(); } //If the variables were fixed the cutting plane procedure may have believed that the node could be fathomed //re-establish truth.- should do no harm for non nlp if (!solutionComesFromNlp && fixVariables > 0) solverCharacteristics_->setMipBound(-COIN_DBL_MAX); return objectiveValue; } } /* Call this routine from anywhere when a solution is found. The solution vector is assumed to contain one value for each structural variable. The first action is to run checkSolution() to confirm the objective and feasibility. If this check causes the solution to be rejected, we're done. If fixVariables = true, the variable bounds held by the continuous solver will be left fixed to the values in the solution; otherwise they are restored to the original values. If the solution is accepted, install it as the best solution. The routine also contains a hook to run any cut generators that are flagged to run when a new solution is discovered. There's a potential hazard because the cut generators see the continuous solver >after< possible restoration of original bounds (which may well invalidate the solution). */ void CbcModel::setBestSolution (CBC_Message how, double & objectiveValue, const double *solutionIn, int fixVariables) { double * solution = CoinCopyOfArray(solutionIn, solver_->getNumCols()); #ifdef JJF_ZERO { double saveOffset; solver_->getDblParam(OsiObjOffset, saveOffset); const double * obj = solver_->getObjCoefficients(); double newTrueSolutionValue = -saveOffset; double newSumInfeas = 0.0; int numberColumns = solver_->getNumCols(); for (int i = 0 ; i < numberColumns ; i++ ) { if (solver_->isInteger(i)) { double value = solution[i]; double nearest = floor(value + 0.5); newSumInfeas += fabs(value - nearest); } if (solution[i]) printf("%d obj %g val %g - total %g true\n", i, obj[i], solution[i], newTrueSolutionValue); newTrueSolutionValue += obj[i] * solution[i]; } printf("obj %g\n", newTrueSolutionValue); } #endif if (!solverCharacteristics_->solutionAddsCuts()) { // Can trust solution double cutoff = getCutoff(); if (cutoff < 1.0e30) cutoff = CoinMin(cutoff, bestObjective_) ; /* Double check the solution to catch pretenders. */ double saveObjectiveValue = objectiveValue; // save basis CoinWarmStartBasis * basis = dynamic_cast(solver_->getWarmStart()) ; assert(basis != NULL); objectiveValue = checkSolution(cutoff, solution, fixVariables, objectiveValue); if (cutoff>1.0e40&&objectiveValue<1.0e10) saveObjectiveValue = objectiveValue; // take anyway if (saveObjectiveValue + 1.0e-3 +1.0e-7*fabs(saveObjectiveValue) < objectiveValue) { #if CBC_FEASIBILITY_INVESTIGATE printf("First try at solution had objective %.16g, rechecked as %.16g\n", saveObjectiveValue, objectiveValue); #endif // try again with basic variables with original bounds // save basis CoinWarmStartBasis * basis2 = dynamic_cast(solver_->getWarmStart()) ; assert(basis2 != NULL); solver_->setWarmStart(basis); int numberColumns = solver_->getNumCols(); double * solution2 = CoinCopyOfArray(solutionIn, numberColumns); double objectiveValue2 = saveObjectiveValue; objectiveValue2 = checkSolution(cutoff, solution2, -1, objectiveValue2); #if CBC_FEASIBILITY_INVESTIGATE printf("Relaxed second try had objective of %.16g\n", objectiveValue2); #endif if (objectiveValue2 + 1.0e-7 < objectiveValue) { // Now check tolerances double integerTolerance = dblParam_[CbcIntegerTolerance]; double tolerance; solver_->getDblParam(OsiPrimalTolerance, tolerance) ; double largestAway = 0.0; int iAway = -1; double largestInfeasibility = tolerance; #if CBC_FEASIBILITY_INVESTIGATE int iInfeas = -1; #endif const double * columnLower = continuousSolver_->getColLower(); const double * columnUpper = continuousSolver_->getColUpper(); int i; for (i = 0; i < numberColumns; i++) { double value = solution2[i]; if (value > columnUpper[i] + largestInfeasibility) { #if CBC_FEASIBILITY_INVESTIGATE iInfeas = i; #endif largestInfeasibility = value - columnUpper[i]; } else if (value < columnLower[i] - largestInfeasibility) { #if CBC_FEASIBILITY_INVESTIGATE iInfeas = i; #endif largestInfeasibility = columnLower[i] - value; } } for (i = 0; i < numberObjects_; i++) { CbcSimpleInteger * obj = dynamic_cast (object_[i]) ; if (obj) { int iColumn = obj->columnNumber(); double value = solution2[iColumn]; value = fabs(floor(value + 0.5) - value); if (value > largestAway) { iAway = iColumn; largestAway = value; } } } #if CBC_FEASIBILITY_INVESTIGATE if (iInfeas >= 0) printf("Largest infeasibility of %g on column %d - tolerance %g\n", largestInfeasibility, iInfeas, tolerance); #endif if (largestAway > integerTolerance) { handler_->message(CBC_RELAXED1, messages_) << objectiveValue2 << iAway << largestAway << integerTolerance << CoinMessageEol ; } else { handler_->message(CBC_RELAXED2, messages_) << objectiveValue2 << integerTolerance << CoinMessageEol ; // take CoinCopyN(solution2, numberColumns, solution); objectiveValue = objectiveValue2; } } else if (!parentModel_) { // not good messageHandler()->message(CBC_FPUMP2, messages()) << "On closer inspection - solution discarded" << CoinMessageEol ; } delete [] solution2; solver_->setWarmStart(basis2); delete basis2 ; } delete basis ; if (objectiveValue > cutoff && objectiveValue < cutoff + 1.0e-8 + 1.0e-8*fabs(cutoff)) cutoff = objectiveValue; // relax CbcEventHandler::CbcAction action = dealWithEventHandler(CbcEventHandler::beforeSolution2, objectiveValue, solution); if (action == CbcEventHandler::killSolution) { // Pretend solution never happened objectiveValue = cutoff + 1.0e30; } if (objectiveValue > cutoff || objectiveValue > 1.0e30) { if (objectiveValue > 1.0e30) handler_->message(CBC_NOTFEAS1, messages_) << CoinMessageEol ; else handler_->message(CBC_NOTFEAS2, messages_) << objectiveValue << cutoff << CoinMessageEol ; } else if (objectiveValue < bestObjective_) { /* We have a winner. Install it as the new incumbent. Bump the objective cutoff value and solution counts. Give the user the good news. */ specialOptions_ |= 256; // mark as full cut scan should be done saveBestSolution(solution, objectiveValue); //bestObjective_ = objectiveValue; //int numberColumns = solver_->getNumCols(); //if (!bestSolution_) //bestSolution_ = new double[numberColumns]; //CoinCopyN(solution,numberColumns,bestSolution_); cutoff = bestObjective_ - dblParam_[CbcCutoffIncrement]; // But allow for rounding errors if (dblParam_[CbcCutoffIncrement] == 1e-5) { #if CBC_FEASIBILITY_INVESTIGATE if (saveObjectiveValue + 1.0e-7 < bestObjective_) printf("First try at solution had objective %.16g, rechecked as %.16g\n", saveObjectiveValue, bestObjective_); #endif saveObjectiveValue = CoinMax(saveObjectiveValue, bestObjective_ - 0.0000001 * fabs(bestObjective_)); cutoff = CoinMin(bestObjective_, saveObjectiveValue) - 1.0e-5; if (fabs(cutoff + 1.0e-5 - floor(cutoff + 0.5)) < 1.0e-8) cutoff -= 2.0e-5; } if (!parentModel_&&(moreSpecialOptions2_&2)!=0) { // put back objective solver_->setObjective(continuousSolver_->getObjCoefficients()); double offset; continuousSolver_->getDblParam(OsiObjOffset,offset); solver_->setDblParam(OsiObjOffset,offset); moreSpecialOptions2_ &= ~2; } // This is not correct - that way cutoff can go up if maximization //double direction = solver_->getObjSense(); //setCutoff(cutoff*direction); setCutoff(cutoff); // change cutoff as constraint if wanted if (cutoffRowNumber_>=0) { if (solver_->getNumRows()>cutoffRowNumber_) { double offset; solver_->getDblParam(OsiObjOffset, offset); solver_->setRowUpper(cutoffRowNumber_,cutoff+offset); } } if (how == CBC_ROUNDING) numberHeuristicSolutions_++; numberSolutions_++; if (how != CBC_ROUNDING) { handler_->message(how, messages_) << bestObjective_ << numberIterations_ << numberNodes_ << getCurrentSeconds() << CoinMessageEol; } else { const char * name ; if (lastHeuristic_) name = lastHeuristic_->heuristicName(); else name = "Reduced search"; handler_->message(CBC_ROUNDING, messages_) << bestObjective_ << name << numberIterations_ << numberNodes_ << getCurrentSeconds() << CoinMessageEol; dealWithEventHandler(CbcEventHandler::heuristicSolution, objectiveValue, solution); } /* Now step through the cut generators and see if any of them are flagged to run when a new solution is discovered. Only global cuts are useful. (The solution being evaluated may not correspond to the current location in the search tree --- discovered by heuristic, for example.) */ OsiCuts theseCuts; int i; int lastNumberCuts = 0; // reset probing info //if (probingInfo_) //probingInfo_->initializeFixing(); for (i = 0; i < numberCutGenerators_; i++) { bool generate = generator_[i]->atSolution(); // skip if not optimal and should be (maybe a cut generator has fixed variables) if (generator_[i]->needsOptimalBasis() && !solver_->basisIsAvailable()) generate = false; if (generate) { generator_[i]->generateCuts(theseCuts, 1, solver_, NULL); int numberCuts = theseCuts.sizeRowCuts(); for (int j = lastNumberCuts; j < numberCuts; j++) { const OsiRowCut * thisCut = theseCuts.rowCutPtr(j); if (thisCut->globallyValid()) { if ((specialOptions_&1) != 0) { /* As these are global cuts - a) Always get debugger object b) Not fatal error to cutoff optimal (if we have just got optimal) */ const OsiRowCutDebugger *debugger = solver_->getRowCutDebuggerAlways() ; if (debugger) { if (debugger->invalidCut(*thisCut)) printf("ZZZZ Global cut - cuts off optimal solution!\n"); } } // add to global list OsiRowCut newCut(*thisCut); newCut.setGloballyValid(true); newCut.mutableRow().setTestForDuplicateIndex(false); globalCuts_.addCutIfNotDuplicate(newCut) ; generator_[i]->incrementNumberCutsInTotal(); } } } } int numberCuts = theseCuts.sizeColCuts(); for (i = 0; i < numberCuts; i++) { const OsiColCut * thisCut = theseCuts.colCutPtr(i); if (thisCut->globallyValid()) { // fix makeGlobalCut(thisCut); } } } } else { // Outer approximation or similar double cutoff = getCutoff() ; /* Double check the solution to catch pretenders. */ int numberRowBefore = solver_->getNumRows(); int numberColBefore = solver_->getNumCols(); double *saveColSol = NULL; CoinWarmStart * saveWs = NULL; // if(how!=CBC_SOLUTION) return; if (how == CBC_ROUNDING)//We don't want to make any change to solver_ //take a snapshot of current state { //save solution saveColSol = new double[numberColBefore]; CoinCopyN(solver_->getColSolution(), numberColBefore, saveColSol); //save warm start saveWs = solver_->getWarmStart(); } //run check solution this will eventually generate cuts //if in strongBranching or heuristic will do only one cut generation iteration // by fixing variables. if (!fixVariables && ((how == CBC_ROUNDING) || (how == CBC_STRONGSOL))) fixVariables = 1; double * candidate = new double[numberColBefore]; CoinCopyN(solution, numberColBefore, candidate); objectiveValue = checkSolution(cutoff, candidate, fixVariables, objectiveValue); //If it was an heuristic solution we have to clean up the solver if (how == CBC_ROUNDING) { //delete the cuts int currentNumberRowCuts = solver_->getNumRows() - numberRowBefore; int currentNumberColCuts = solver_->getNumCols() - numberColBefore; if (CoinMax(currentNumberColCuts, currentNumberRowCuts) > 0) { int *which = new int[CoinMax(currentNumberColCuts, currentNumberRowCuts)]; if (currentNumberRowCuts) { for (int i = 0 ; i < currentNumberRowCuts ; i++) which[i] = i + numberRowBefore; solver_->deleteRows(currentNumberRowCuts, which); } if (currentNumberColCuts) { for (int i = 0 ; i < currentNumberColCuts ; i++) which[i] = i + numberColBefore; solver_->deleteCols(currentNumberColCuts, which); } delete [] which; } // Reset solution and warm start info solver_->setColSolution(saveColSol); solver_->setWarmStart(saveWs); delete [] saveColSol; delete saveWs; } if (objectiveValue > cutoff) { // message only for solution if (how == CBC_SOLUTION) { if (!solverCharacteristics_->solutionAddsCuts()) { if (objectiveValue > 1.0e30) handler_->message(CBC_NOTFEAS1, messages_) << CoinMessageEol ; else handler_->message(CBC_NOTFEAS2, messages_) << objectiveValue << cutoff << CoinMessageEol ; } } } else { /* We have a winner. Install it as the new incumbent. Bump the objective cutoff value and solution counts. Give the user the good news. NB - Not all of this if from solve with cuts */ saveBestSolution(candidate, objectiveValue); //bestObjective_ = objectiveValue; //int numberColumns = solver_->getNumCols(); //if (!bestSolution_) //bestSolution_ = new double[numberColumns]; //CoinCopyN(candidate,numberColumns,bestSolution_); // don't update if from solveWithCuts if (how != CBC_SOLUTION2) { if (how == CBC_ROUNDING) numberHeuristicSolutions_++; cutoff = bestObjective_ - dblParam_[CbcCutoffIncrement]; // This is not correct - that way cutoff can go up if maximization //double direction = solver_->getObjSense(); //setCutoff(cutoff*direction); setCutoff(cutoff); // change cutoff as constraint if wanted if (cutoffRowNumber_>=0) { if (solver_->getNumRows()>cutoffRowNumber_) { double offset; solver_->getDblParam(OsiObjOffset, offset); solver_->setRowUpper(cutoffRowNumber_,cutoff+offset); } } numberSolutions_++; if (how != CBC_ROUNDING) { handler_->message(how, messages_) << bestObjective_ << numberIterations_ << numberNodes_ << getCurrentSeconds() << CoinMessageEol; } else { assert (lastHeuristic_); const char * name = lastHeuristic_->heuristicName(); handler_->message(CBC_ROUNDING, messages_) << bestObjective_ << name << numberIterations_ << numberNodes_ << getCurrentSeconds() << CoinMessageEol; } } } delete [] candidate; } delete [] solution; return ; } // Deals with event handler and solution CbcEventHandler::CbcAction CbcModel::dealWithEventHandler(CbcEventHandler::CbcEvent event, double objValue, const double * solution) { CbcEventHandler *eventHandler = getEventHandler() ; if (eventHandler) { // Temporarily put in best double saveObj = bestObjective_; int numberColumns = solver_->getNumCols(); double * saveSol = CoinCopyOfArray(bestSolution_, numberColumns); if (!saveSol) bestSolution_ = new double [numberColumns]; bestObjective_ = objValue; memcpy(bestSolution_, solution, numberColumns*sizeof(double)); CbcEventHandler::CbcAction action = eventHandler->event(event); bestObjective_ = saveObj; if (saveSol) { memcpy(bestSolution_, saveSol, numberColumns*sizeof(double)); delete [] saveSol; } else { delete [] bestSolution_; bestSolution_ = NULL; } return action; } else { return CbcEventHandler::noAction; } } /* Test the current solution for feasibility. Calculate the number of standard integer infeasibilities, then scan the remaining objects to see if any of them report infeasibilities. Currently (2003.08) the only object besides SimpleInteger is Clique, hence the comments about `odd ones' infeasibilities. */ bool CbcModel::feasibleSolution(int & numberIntegerInfeasibilities, int & numberObjectInfeasibilities) const { int numberUnsatisfied = 0; //double sumUnsatisfied=0.0; int j; // Point to current solution const double * save = testSolution_; // Safe as will be const inside infeasibility() testSolution_ = solver_->getColSolution(); // Put current solution in safe place //memcpy(currentSolution_,solver_->getColSolution(), // solver_->getNumCols()*sizeof(double)); // point to useful information OsiBranchingInformation usefulInfo = usefulInformation(); #define SIMPLE_INTEGER #ifdef SIMPLE_INTEGER const double * solution = usefulInfo.solution_; const double * lower = usefulInfo.lower_; const double * upper = usefulInfo.upper_; double tolerance = usefulInfo.integerTolerance_; #endif for (j = 0; j < numberIntegers_; j++) { #ifndef SIMPLE_INTEGER const OsiObject * object = object_[j]; double infeasibility = object->checkInfeasibility(&usefulInfo); if (infeasibility) { assert (infeasibility > 0); numberUnsatisfied++; //sumUnsatisfied += infeasibility; } #else int iColumn = integerVariable_[j]; double value = solution[iColumn]; value = CoinMax(value, lower[iColumn]); value = CoinMin(value, upper[iColumn]); double nearest = floor(value + 0.5); if (fabs(value - nearest) > tolerance) { numberUnsatisfied++; } #endif } numberIntegerInfeasibilities = numberUnsatisfied; for (; j < numberObjects_; j++) { const OsiObject * object = object_[j]; double infeasibility = object->checkInfeasibility(&usefulInfo); if (infeasibility) { assert (infeasibility > 0); numberUnsatisfied++; //sumUnsatisfied += infeasibility; } } // and restore testSolution_ = save; numberObjectInfeasibilities = numberUnsatisfied - numberIntegerInfeasibilities; return (!numberUnsatisfied); } /* For all vubs see if we can tighten bounds by solving Lp's type - 0 just vubs 1 all (could be very slow) -1 just vubs where variable away from bound Returns false if not feasible */ bool CbcModel::tightenVubs(int type, bool allowMultipleBinary, double useCutoff) { CoinPackedMatrix matrixByRow(*solver_->getMatrixByRow()); int numberRows = solver_->getNumRows(); int numberColumns = solver_->getNumCols(); int iRow, iColumn; // Row copy //const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); const double * colUpper = solver_->getColUpper(); const double * colLower = solver_->getColLower(); //const double * rowUpper = solver_->getRowUpper(); //const double * rowLower = solver_->getRowLower(); const double * objective = solver_->getObjCoefficients(); //double direction = solver_->getObjSense(); const double * colsol = solver_->getColSolution(); int numberVub = 0; int * continuous = new int[numberColumns]; if (type >= 0) { double * sort = new double[numberColumns]; for (iRow = 0; iRow < numberRows; iRow++) { int j; int numberBinary = 0; int numberUnsatisfiedBinary = 0; int numberContinuous = 0; int iCont = -1; double weight = 1.0e30; for (j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; if (colUpper[iColumn] - colLower[iColumn] > 1.0e-8) { if (solver_->isFreeBinary(iColumn)) { numberBinary++; /* For sort I make naive assumption: x - a * delta <=0 or -x + a * delta >= 0 */ if (colsol[iColumn] > colLower[iColumn] + 1.0e-6 && colsol[iColumn] < colUpper[iColumn] - 1.0e-6) { numberUnsatisfiedBinary++; weight = CoinMin(weight, fabs(objective[iColumn])); } } else { numberContinuous++; iCont = iColumn; } } } if (numberContinuous == 1 && numberBinary) { if (numberBinary == 1 || allowMultipleBinary) { // treat as vub if (!numberUnsatisfiedBinary) weight = -1.0; // at end sort[numberVub] = -weight; continuous[numberVub++] = iCont; } } } if (type > 0) { // take so many CoinSort_2(sort, sort + numberVub, continuous); numberVub = CoinMin(numberVub, type); } delete [] sort; } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) continuous[iColumn] = iColumn; numberVub = numberColumns; } bool feasible = tightenVubs(numberVub, continuous, useCutoff); delete [] continuous; return feasible; } // This version is just handed a list of variables bool CbcModel::tightenVubs(int numberSolves, const int * which, double useCutoff) { int numberColumns = solver_->getNumCols(); int iColumn; OsiSolverInterface * solver = solver_; double saveCutoff = getCutoff() ; double * objective = new double[numberColumns]; memcpy(objective, solver_->getObjCoefficients(), numberColumns*sizeof(double)); double direction = solver_->getObjSense(); // add in objective if there is a cutoff if (useCutoff < 1.0e30) { // get new version of model solver = solver_->clone(); CoinPackedVector newRow; for (iColumn = 0; iColumn < numberColumns; iColumn++) { solver->setObjCoeff(iColumn, 0.0); // zero out in new model if (objective[iColumn]) newRow.insert(iColumn, direction * objective[iColumn]); } solver->addRow(newRow, -COIN_DBL_MAX, useCutoff); // signal no objective delete [] objective; objective = NULL; } setCutoff(COIN_DBL_MAX); bool * vub = new bool [numberColumns]; int iVub; // mark vub columns for (iColumn = 0; iColumn < numberColumns; iColumn++) vub[iColumn] = false; for (iVub = 0; iVub < numberSolves; iVub++) vub[which[iVub]] = true; OsiCuts cuts; // First tighten bounds anyway if CglProbing there CglProbing* generator = NULL; int iGen; // reset probing info //if (probingInfo_) //probingInfo_->initializeFixing(); for (iGen = 0; iGen < numberCutGenerators_; iGen++) { generator = dynamic_cast(generator_[iGen]->generator()); if (generator) break; } int numberFixed = 0; int numberTightened = 0; int numberFixedByProbing = 0; int numberTightenedByProbing = 0; int printFrequency = (numberSolves + 19) / 20; // up to 20 messages int save[4] = {0, 0, 0, 0}; if (generator) { // set to cheaper and then restore at end save[0] = generator->getMaxPass(); save[1] = generator->getMaxProbe(); save[2] = generator->getMaxLook(); save[3] = generator->rowCuts(); generator->setMaxPass(1); generator->setMaxProbe(10); generator->setMaxLook(50); generator->setRowCuts(0); // Probing - return tight column bounds CglTreeInfo info; generator->generateCutsAndModify(*solver, cuts, &info); const double * tightLower = generator->tightLower(); const double * lower = solver->getColLower(); const double * tightUpper = generator->tightUpper(); const double * upper = solver->getColUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { double newUpper = tightUpper[iColumn]; double newLower = tightLower[iColumn]; if (newUpper < upper[iColumn] - 1.0e-8*(fabs(upper[iColumn]) + 1) || newLower > lower[iColumn] + 1.0e-8*(fabs(lower[iColumn]) + 1)) { if (newUpper < newLower) { fprintf(stderr, "Problem is infeasible\n"); return false; } if (newUpper == newLower) { numberFixed++; numberFixedByProbing++; solver->setColLower(iColumn, newLower); solver->setColUpper(iColumn, newUpper); COIN_DETAIL_PRINT(printf("Column %d, new bounds %g %g\n", iColumn, newLower, newUpper)); } else if (vub[iColumn]) { numberTightened++; numberTightenedByProbing++; if (!solver->isInteger(iColumn)) { // relax newLower = CoinMax(lower[iColumn], newLower - 1.0e-5 * (fabs(lower[iColumn]) + 1)); newUpper = CoinMin(upper[iColumn], newUpper + 1.0e-5 * (fabs(upper[iColumn]) + 1)); } solver->setColLower(iColumn, newLower); solver->setColUpper(iColumn, newUpper); } } } } CoinWarmStart * ws = solver->getWarmStart(); double * solution = new double [numberColumns]; memcpy(solution, solver->getColSolution(), numberColumns*sizeof(double)); for (iColumn = 0; iColumn < numberColumns; iColumn++) solver->setObjCoeff(iColumn, 0.0); //solver->messageHandler()->setLogLevel(2); for (iVub = 0; iVub < numberSolves; iVub++) { iColumn = which[iVub]; int iTry; for (iTry = 0; iTry < 2; iTry++) { double saveUpper = solver->getColUpper()[iColumn]; double saveLower = solver->getColLower()[iColumn]; double value; if (iTry == 1) { // try all way up solver->setObjCoeff(iColumn, -1.0); } else { // try all way down solver->setObjCoeff(iColumn, 1.0); } solver->initialSolve(); setPointers(continuousSolver_); value = solver->getColSolution()[iColumn]; bool change = false; if (iTry == 1) { if (value < saveUpper - 1.0e-4) { if (solver->isInteger(iColumn)) { value = floor(value + 0.00001); } else { // relax a bit value = CoinMin(saveUpper, value + 1.0e-8 * (fabs(saveUpper) + 1)); } if (value - saveLower < 1.0e-7) value = saveLower; // make sure exactly same solver->setColUpper(iColumn, value); saveUpper = value; change = true; } } else { if (value > saveLower + 1.0e-4) { if (solver->isInteger(iColumn)) { value = ceil(value - 0.00001); } else { // relax a bit value = CoinMax(saveLower, value - 1.0e-8 * (fabs(saveLower) + 1)); } if (saveUpper - value < 1.0e-7) value = saveUpper; // make sure exactly same solver->setColLower(iColumn, value); saveLower = value; change = true; } } solver->setObjCoeff(iColumn, 0.0); if (change) { if (saveUpper == saveLower) numberFixed++; else numberTightened++; int saveFixed = numberFixed; int jColumn; if (generator) { // Probing - return tight column bounds cuts = OsiCuts(); CglTreeInfo info; generator->generateCutsAndModify(*solver, cuts, &info); const double * tightLower = generator->tightLower(); const double * lower = solver->getColLower(); const double * tightUpper = generator->tightUpper(); const double * upper = solver->getColUpper(); for (jColumn = 0; jColumn < numberColumns; jColumn++) { double newUpper = tightUpper[jColumn]; double newLower = tightLower[jColumn]; if (newUpper < upper[jColumn] - 1.0e-8*(fabs(upper[jColumn]) + 1) || newLower > lower[jColumn] + 1.0e-8*(fabs(lower[jColumn]) + 1)) { if (newUpper < newLower) { fprintf(stderr, "Problem is infeasible\n"); return false; } if (newUpper == newLower) { numberFixed++; numberFixedByProbing++; solver->setColLower(jColumn, newLower); solver->setColUpper(jColumn, newUpper); } else if (vub[jColumn]) { numberTightened++; numberTightenedByProbing++; if (!solver->isInteger(jColumn)) { // relax newLower = CoinMax(lower[jColumn], newLower - 1.0e-8 * (fabs(lower[jColumn]) + 1)); newUpper = CoinMin(upper[jColumn], newUpper + 1.0e-8 * (fabs(upper[jColumn]) + 1)); } solver->setColLower(jColumn, newLower); solver->setColUpper(jColumn, newUpper); } } } } if (numberFixed > saveFixed) { // original solution may not be feasible // go back to true costs to solve if exists if (objective) { for (jColumn = 0; jColumn < numberColumns; jColumn++) solver->setObjCoeff(jColumn, objective[jColumn]); } solver->setColSolution(solution); solver->setWarmStart(ws); solver->resolve(); if (!solver->isProvenOptimal()) { fprintf(stderr, "Problem is infeasible\n"); return false; } delete ws; ws = solver->getWarmStart(); memcpy(solution, solver->getColSolution(), numberColumns*sizeof(double)); for (jColumn = 0; jColumn < numberColumns; jColumn++) solver->setObjCoeff(jColumn, 0.0); } } solver->setColSolution(solution); solver->setWarmStart(ws); } if (iVub % printFrequency == 0) handler_->message(CBC_VUB_PASS, messages_) << iVub + 1 << numberFixed << numberTightened << CoinMessageEol; } handler_->message(CBC_VUB_END, messages_) << numberFixed << numberTightened << CoinMessageEol; delete ws; delete [] solution; // go back to true costs to solve if exists if (objective) { for (iColumn = 0; iColumn < numberColumns; iColumn++) solver_->setObjCoeff(iColumn, objective[iColumn]); delete [] objective; } delete [] vub; if (generator) { /*printf("Probing fixed %d and tightened %d\n", numberFixedByProbing, numberTightenedByProbing);*/ if (generator_[iGen]->howOften() == -1 && (numberFixedByProbing + numberTightenedByProbing)*5 > (numberFixed + numberTightened)) generator_[iGen]->setHowOften(1000000 + 1); generator->setMaxPass(save[0]); generator->setMaxProbe(save[1]); generator->setMaxLook(save[2]); generator->setRowCuts(save[3]); } if (solver != solver_) { // move bounds across const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); const double * lowerOrig = solver_->getColLower(); const double * upperOrig = solver_->getColUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { solver_->setColLower(iColumn, CoinMax(lower[iColumn], lowerOrig[iColumn])); solver_->setColUpper(iColumn, CoinMin(upper[iColumn], upperOrig[iColumn])); } delete solver; } setCutoff(saveCutoff); return true; } // Pass in Message handler (not deleted at end) void CbcModel::passInMessageHandler(CoinMessageHandler * handler) { if (defaultHandler_) { delete handler_; handler_ = NULL; } defaultHandler_ = false; handler_ = handler; if (solver_) solver_->passInMessageHandler(handler); if (continuousSolver_) continuousSolver_->passInMessageHandler(handler); if (referenceSolver_) referenceSolver_->passInMessageHandler(handler); } void CbcModel::passInTreeHandler(CbcTree & tree) { delete tree_; tree_ = tree.clone(); } // Make sure region there void CbcModel::reserveCurrentSolution(const double * solution) { int numberColumns = getNumCols() ; if (!currentSolution_) currentSolution_ = new double[numberColumns] ; testSolution_ = currentSolution_; if (solution) memcpy(currentSolution_, solution, numberColumns*sizeof(double)); } /* For passing in an CbcModel to do a sub Tree (with derived tree handlers). Passed in model must exist for duration of branch and bound */ void CbcModel::passInSubTreeModel(CbcModel & model) { subTreeModel_ = &model; } // For retrieving a copy of subtree model with given OsiSolver or NULL CbcModel * CbcModel::subTreeModel(OsiSolverInterface * solver) const { const CbcModel * subModel = subTreeModel_; if (!subModel) subModel = this; // Get new copy CbcModel * newModel = new CbcModel(*subModel); if (solver) newModel->assignSolver(solver); return newModel; } //############################################################################# // Set/Get Application Data // This is a pointer that the application can store into and retrieve // from the solverInterface. // This field is the application to optionally define and use. //############################################################################# void CbcModel::setApplicationData(void * appData) { appData_ = appData; } //----------------------------------------------------------------------------- void * CbcModel::getApplicationData() const { return appData_; } // Set a pointer to a row cut which will be added instead of normal branching. void CbcModel::setNextRowCut(const OsiRowCut & cut) { nextRowCut_ = new OsiRowCut(cut); nextRowCut_->setEffectiveness(COIN_DBL_MAX); // mark so will always stay } // Just update objectiveValue void CbcModel::setBestObjectiveValue( double objectiveValue) { bestObjective_ = objectiveValue; } double CbcModel::getBestPossibleObjValue() const { return CoinMin(bestPossibleObjective_, bestObjective_) * solver_->getObjSense() ; } // Make given rows (L or G) into global cuts and remove from lp void CbcModel::makeGlobalCuts(int number, const int * which) { const double * rowLower = solver_->getRowLower(); const double * rowUpper = solver_->getRowUpper(); int numberRows = solver_->getNumRows(); // Row copy const double * elementByRow = solver_->getMatrixByRow()->getElements(); const int * column = solver_->getMatrixByRow()->getIndices(); const CoinBigIndex * rowStart = solver_->getMatrixByRow()->getVectorStarts(); const int * rowLength = solver_->getMatrixByRow()->getVectorLengths(); // Not all rows may be good so we need new array int * whichDelete = new int[numberRows]; int nDelete = 0; for (int i = 0; i < number; i++) { int iRow = which[i]; if (iRow >= 0 && iRow < numberRows) { if (rowLower[iRow] < -1.0e20 || rowUpper[iRow] > 1.0e20) { whichDelete[nDelete++] = iRow; OsiRowCut thisCut; thisCut.setLb(rowLower[iRow]); thisCut.setUb(rowUpper[iRow]); int start = rowStart[iRow]; thisCut.setRow(rowLength[iRow], column + start, elementByRow + start, false); thisCut.setGloballyValid(true); globalCuts_.addCutIfNotDuplicate(thisCut) ; } } } if (nDelete) solver_->deleteRows(nDelete, whichDelete); delete [] whichDelete; } // Make given cut into a global cut int CbcModel::makeGlobalCut(const OsiRowCut * cut) { if (cut->row().getNumElements()>1-1) { OsiRowCut newCut(*cut); newCut.setGloballyValidAsInteger(2); newCut.mutableRow().setTestForDuplicateIndex(false); return globalCuts_.addCutIfNotDuplicate(newCut,1) ; } else { assert (cut->row().getNumElements()==1); int iColumn = cut->row().getIndices()[0]; double value = cut->row().getElements()[0]; double lb = cut->lb(); double ub = cut->ub(); if (value>0) { if (lb>-COIN_DBL_MAX) lb /= value; if (ub-COIN_DBL_MAX) ub = lb/value; else ub = COIN_DBL_MAX; if (saveUblogLevel() > 1) { #endif printf("Conflict cut at depth %d (%d elements)\n", currentDepth_,cut->row().getNumElements()); cut->print(); #if PRINT_CONFLICT==0 } #endif const double * lower; const double * upper; if (topOfTree_) { lower = topOfTree_->lower(); upper = topOfTree_->upper(); lb = CoinMax(lb,lower[iColumn]); topOfTree_->setColLower(iColumn,lb); ub = CoinMin(ub,upper[iColumn]); topOfTree_->setColUpper(iColumn,ub); } else { lower = solver_->getColLower(); upper = solver_->getColUpper(); lb = CoinMax(lb,lower[iColumn]); solver_->setColLower(iColumn,lb); ub = CoinMin(ub,upper[iColumn]); solver_->setColUpper(iColumn,ub); } return 1; } } // Make given cut into a global cut int CbcModel::makeGlobalCut(const OsiRowCut & cut) { OsiRowCut newCut(cut); newCut.setGloballyValid(true); newCut.mutableRow().setTestForDuplicateIndex(false); return globalCuts_.addCutIfNotDuplicate(newCut) ; } // Make given column cut into a global cut void CbcModel::makeGlobalCut(const OsiColCut * cut) { const double * lower; const double * upper; if (topOfTree_) { lower = topOfTree_->lower(); upper = topOfTree_->upper(); } else { lower = solver_->getColLower(); upper = solver_->getColUpper(); } int nLower=cut->lbs().getNumElements(); const int * indexLower=cut->lbs().getIndices(); const double * boundLower=cut->lbs().getElements(); for (int i=0;isetColLower(iColumn,newValue); else solver_->setColLower(iColumn,newValue); } int nUpper=cut->ubs().getNumElements(); const int * indexUpper=cut->ubs().getIndices(); const double * boundUpper=cut->ubs().getElements(); for (int i=0;isetColUpper(iColumn,newValue); else solver_->setColUpper(iColumn,newValue); } } // Make given column cut into a global cut void CbcModel::makeGlobalCut(const OsiColCut & cut) { const double * lower; const double * upper; if (topOfTree_) { lower = topOfTree_->lower(); upper = topOfTree_->upper(); } else { lower = solver_->getColLower(); upper = solver_->getColUpper(); } int nLower=cut.lbs().getNumElements(); const int * indexLower=cut.lbs().getIndices(); const double * boundLower=cut.lbs().getElements(); for (int i=0;isetColLower(iColumn,newValue); else solver_->setColLower(iColumn,newValue); } int nUpper=cut.ubs().getNumElements(); const int * indexUpper=cut.ubs().getIndices(); const double * boundUpper=cut.ubs().getElements(); for (int i=0;isetColUpper(iColumn,newValue); else solver_->setColUpper(iColumn,newValue); } } // Make partial cut into a global cut and save void CbcModel::makePartialCut(const OsiRowCut * partialCut, const OsiSolverInterface * solver) { // get greedy cut double bSum = partialCut->lb(); assert (bSum<0.0); if (!solver) solver=solver_; int nConflict = partialCut->row().getNumElements(); const int * column = partialCut->row().getIndices(); const double * element = partialCut->row().getElements(); double * originalLower = topOfTree_->mutableLower(); const double * columnLower = solver->getColLower(); double * originalUpper = topOfTree_->mutableUpper(); const double * columnUpper = solver->getColUpper(); int nC=nConflict; while (nConflict) { int iColumn = column[nConflict-1]; double farkasValue = element[nConflict-1]; double change; if (farkasValue>0.0) { change=farkasValue*(originalUpper[iColumn]-columnUpper[iColumn]); } else { change=farkasValue*(originalLower[iColumn]-columnLower[iColumn]); } if (bSum+change>-1.0e-4) break; nConflict--; bSum += change; } OsiRowCut newCut; newCut.setUb(COIN_DBL_MAX); double lo=1.0; double * values = new double[nConflict]; for (int i=0;i1) { if ((specialOptions_&1) != 0) { const OsiRowCutDebugger *debugger = continuousSolver_->getRowCutDebugger() ; if (debugger) { if (debugger->invalidCut(newCut)) { continuousSolver_->applyRowCuts(1,&newCut); continuousSolver_->writeMps("bad"); } CoinAssert (!debugger->invalidCut(newCut)); } } newCut.setGloballyValidAsInteger(2); newCut.mutableRow().setTestForDuplicateIndex(false); globalCuts_.addCutIfNotDuplicate(newCut) ; } else { // change bounds int iColumn=column[0]; if (values[0]<0.0) { // change upper bound double newUpper = -lo; assert (newUpperoriginalLower[iColumn]); printf("Changing lower bound on %d from %g to %g\n", iColumn,originalLower[iColumn],newLower); originalLower[iColumn]=newLower; } } // add to partial cuts if (globalConflictCuts_) { globalConflictCuts_->addCutIfNotDuplicateWhenGreedy(*partialCut,2); } delete [] values; } // Make partial cuts into global cuts void CbcModel::makeGlobalCuts() { } void CbcModel::setNodeComparison(CbcCompareBase * compare) { delete nodeCompare_; nodeCompare_ = compare->clone(); } void CbcModel::setNodeComparison(CbcCompareBase & compare) { delete nodeCompare_; nodeCompare_ = compare.clone(); } void CbcModel::setProblemFeasibility(CbcFeasibilityBase * feasibility) { delete problemFeasibility_; problemFeasibility_ = feasibility->clone(); } void CbcModel::setProblemFeasibility(CbcFeasibilityBase & feasibility) { delete problemFeasibility_; problemFeasibility_ = feasibility.clone(); } // Set the strategy. Clones void CbcModel::setStrategy(CbcStrategy & strategy) { delete strategy_; strategy_ = strategy.clone(); } // Increases usedInSolution for nonzeros void CbcModel::incrementUsed(const double * solution) { if(usedInSolution_) { // might as well mark all including continuous int numberColumns = solver_->getNumCols(); for (int i = 0; i < numberColumns; i++) { if (solution[i]) usedInSolution_[i]++; } } } // Are there numerical difficulties (for initialSolve) ? bool CbcModel::isInitialSolveAbandoned() const { if (status_ != -1) { return false; } else { return solver_->isAbandoned(); } } // Is optimality proven (for initialSolve) ? bool CbcModel::isInitialSolveProvenOptimal() const { if (status_ != -1) { return fabs(originalContinuousObjective_) < 1.0e50; } else { return solver_->isProvenOptimal(); } } // Is primal infeasiblity proven (for initialSolve) ? bool CbcModel::isInitialSolveProvenPrimalInfeasible() const { if (status_ != -1) { if (status_ == 0 && secondaryStatus_ == 7) return false; else return originalContinuousObjective_ >= 1.0e50; } else { return solver_->isProvenPrimalInfeasible(); } } // Is dual infeasiblity proven (for initialSolve) ? bool CbcModel::isInitialSolveProvenDualInfeasible() const { if (status_ != -1) { if (status_ == 0 && secondaryStatus_ == 7) return true; else return false; } else { return solver_->isProvenDualInfeasible(); } } // Set pointers for speed void CbcModel::setPointers(const OsiSolverInterface * solver) { /// Pointer to array[getNumCols()] (for speed) of column lower bounds cbcColLower_ = solver_->getColLower(); /// Pointer to array[getNumCols()] (for speed) of column upper bounds cbcColUpper_ = solver_->getColUpper(); /// Pointer to array[getNumRows()] (for speed) of row lower bounds cbcRowLower_ = solver_->getRowLower(); /// Pointer to array[getNumRows()] (for speed) of row upper bounds cbcRowUpper_ = solver_->getRowUpper(); /// Pointer to array[getNumCols()] (for speed) of primal solution vector cbcColSolution_ = solver_->getColSolution(); /// Pointer to array[getNumRows()] (for speed) of dual prices cbcRowPrice_ = solver_->getRowPrice(); /// Get a pointer to array[getNumCols()] (for speed) of reduced costs if (solverCharacteristics_ && solverCharacteristics_->reducedCostsAccurate()) cbcReducedCost_ = solver_->getReducedCost(); else cbcReducedCost_ = NULL; /// Pointer to array[getNumRows()] (for speed) of row activity levels. cbcRowActivity_ = solver_->getRowActivity(); dblParam_[CbcCurrentObjectiveValue] = solver->getObjValue(); dblParam_[CbcCurrentMinimizationObjectiveValue] = dblParam_[CbcCurrentObjectiveValue] * dblParam_[CbcOptimizationDirection]; } /* Delete any existing handler and create a clone of the one supplied. */ void CbcModel::passInEventHandler (const CbcEventHandler *eventHandler) { delete eventHandler_; eventHandler_ = NULL ; if (eventHandler) { eventHandler_ = eventHandler->clone(); eventHandler_->setModel(this); } } /* CbcEventHandler* CbcModel::eventHandler is inlined in CbcModel.hpp. */ // Encapsulates solver resolve int CbcModel::resolve(OsiSolverInterface * solver) { numberSolves_++; #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver); #endif #ifdef CLIQUE_ANALYSIS if (probingInfo_ && currentDepth_ > 0) { int nFix = probingInfo_->fixColumns(*solver); #ifdef SWITCH_VARIABLES if (nFix>0) fixAssociated(solver_,0); #endif if (nFix < 0) { #ifdef COIN_HAS_CLP if (clpSolver) clpSolver->getModelPtr()->setProblemStatus(1); #endif return 0; } } #endif #ifdef COIN_HAS_CLP if (clpSolver) { /*bool takeHint; OsiHintStrength strength; bool gotHint = (clpSolver->getHintParam(OsiDoDualInResolve,takeHint,strength)); assert (gotHint); int algorithm=-1; if (strength!=OsiHintIgnore) algorithm = takeHint ? -1 : 1; assert (algorithm==-1);*/ //clpSolver->setHintParam(OsiDoDualInResolve,true,OsiHintTry); ClpSimplex * clpSimplex = clpSolver->getModelPtr(); int save = clpSimplex->specialOptions(); if ((moreSpecialOptions_&8388608)==0) clpSimplex->setSpecialOptions(save | 0x11000000); // say is Cbc (and in branch and bound) else clpSimplex->setSpecialOptions(save | 0x11200000); // say is Cbc (and in branch and bound - but save ray) int save2 = clpSolver->specialOptions(); if (false && (save2&2048) == 0) { // see if worthwhile crunching int nFixed = 0; const double * columnLower = clpSimplex->columnLower(); const double * columnUpper = clpSimplex->columnUpper(); for (int i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable_[i]; if (columnLower[iColumn] == columnUpper[iColumn]) nFixed++; } if (nFixed*20 < clpSimplex->numberColumns()) { double d = nFixed; printf("%d fixed out of %d - ratio %g\n", nFixed, clpSimplex->numberColumns(), d / clpSimplex->numberColumns()); clpSolver->setSpecialOptions(save2 | 2048); } } #ifdef CHECK_KNOWN_SOLUTION bool onOptimalPath = false; if ((specialOptions_&1) != 0) { const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (debugger) { onOptimalPath = true; printf("On optimal path before resolve\n") ; } } #endif clpSolver->resolve(); #ifdef CHECK_KNOWN_SOLUTION if ((specialOptions_&1) != 0&&onOptimalPath) { const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (debugger) { printf("On optimal path after resolve\n") ; } else { solver_->writeMpsNative("badSolve.mps", NULL, NULL, 2); printf("NOT on optimal path after resolve\n") ; } } #endif if (!numberNodes_) { double error = CoinMax(clpSimplex->largestDualError(), clpSimplex->largestPrimalError()); if (error > 1.0e-2 || !clpSolver->isProvenOptimal()) { #if CBC_USEFUL_PRINTING>1 printf("Problem was %s largest dual error %g largest primal %g - safer cuts\n", clpSolver->isProvenOptimal() ? "optimal" : "!infeasible", clpSimplex->largestDualError(), clpSimplex->largestPrimalError()); #endif if (!clpSolver->isProvenOptimal()) { clpSolver->setSpecialOptions(save2 | 2048); clpSimplex->allSlackBasis(true); clpSolver->resolve(); if (!clpSolver->isProvenOptimal()) { bool takeHint; OsiHintStrength strength; clpSolver->getHintParam(OsiDoDualInResolve, takeHint, strength); clpSolver->setHintParam(OsiDoDualInResolve, false, OsiHintDo); clpSolver->resolve(); clpSolver->setHintParam(OsiDoDualInResolve, takeHint, strength); } } // make cuts safer for (int iCutGenerator = 0; iCutGenerator < numberCutGenerators_; iCutGenerator++) { CglCutGenerator * generator = generator_[iCutGenerator]->generator(); CglGomory * cgl1 = dynamic_cast(generator); if (cgl1) { cgl1->setLimitAtRoot(cgl1->getLimit()); } CglTwomir * cgl2 = dynamic_cast(generator); if (cgl2) { generator_[iCutGenerator]->setHowOften(-100); } } } } clpSolver->setSpecialOptions(save2); #if CBC_USEFUL_PRINTING>1 if (clpSimplex->numberIterations() > 1000) printf("node %d took %d iterations\n", numberNodes_, clpSimplex->numberIterations()); #endif clpSimplex->setSpecialOptions(save); if (clpSimplex->status()==4) clpSimplex->setProblemStatus(1); } else { solver->resolve(); } #else solver->resolve(); #endif #ifdef SWITCH_VARIABLES if (solver_->isProvenOptimal()) { int nBad=checkAssociated(solver_,solver_->getColSolution(),0); if (nBad) checkAssociated(solver_,solver_->getColSolution(),1); } #endif return solver->isProvenOptimal() ? 1 : 0; } #ifdef CLP_RESOLVE // Special purpose resolve int CbcModel::resolveClp(OsiClpSolverInterface * clpSolver, int type) { numberSolves_++; ClpSimplex * clpSimplex = clpSolver->getModelPtr(); int save = clpSimplex->specialOptions(); clpSimplex->setSpecialOptions(save | 0x11000000); // say is Cbc (and in branch and bound) int save2 = clpSolver->specialOptions(); clpSolver->resolve(); if (!numberNodes_) { double error = CoinMax(clpSimplex->largestDualError(), clpSimplex->largestPrimalError()); if (error > 1.0e-2 || !clpSolver->isProvenOptimal()) { #if CBC_USEFUL_PRINTING>1 printf("Problem was %s largest dual error %g largest primal %g - safer cuts\n", clpSolver->isProvenOptimal() ? "optimal" : "!infeasible", clpSimplex->largestDualError(), clpSimplex->largestPrimalError()); #endif if (!clpSolver->isProvenOptimal()) { clpSolver->setSpecialOptions(save2 | 2048); clpSimplex->allSlackBasis(true); clpSolver->resolve(); if (!clpSolver->isProvenOptimal()) { bool takeHint; OsiHintStrength strength; clpSolver->getHintParam(OsiDoDualInResolve, takeHint, strength); clpSolver->setHintParam(OsiDoDualInResolve, false, OsiHintDo); clpSolver->resolve(); clpSolver->setHintParam(OsiDoDualInResolve, takeHint, strength); } } // make cuts safer for (int iCutGenerator = 0; iCutGenerator < numberCutGenerators_; iCutGenerator++) { CglCutGenerator * generator = generator_[iCutGenerator]->generator(); CglGomory * cgl1 = dynamic_cast(generator); if (cgl1) { cgl1->setLimitAtRoot(cgl1->getLimit()); } CglTwomir * cgl2 = dynamic_cast(generator); if (cgl2) { generator_[iCutGenerator]->setHowOften(-100); } } } } clpSolver->setSpecialOptions(save2); #if CBC_USEFUL_PRINTING>1 if (clpSimplex->numberIterations() > 1000) printf("node %d took %d iterations\n", numberNodes_, clpSimplex->numberIterations()); #endif if (type==0 && clpSolver->isProvenOptimal()) { ClpSimplex newModel(*clpSimplex); newModel.primal(); int numberColumns = newModel.numberColumns(); int numberRows = newModel.numberRows(); double * obj = new double [numberColumns]; int * which = new int [numberColumns]; const double * solution = clpSimplex->primalColumnSolution(); double rhs=1.0e-8; int numberObj=0; double integerTolerance = getDblParam(CbcIntegerTolerance) ; double * objective = newModel.objective(); for (int i=0;iupper[iSequence]-integerTolerance) { objective[iSequence]=-1.0; numberUb++; } else if (fabs(value - nearest) <= integerTolerance) { // fix?? lower[iSequence]=nearest; upper[iSequence]=nearest; numberInt++; } else { lower[iSequence]=floor(value); upper[iSequence]=ceil(value); if (value>nearest) { objective[iSequence]=1.0; sumInf += value-nearest; } else { objective[iSequence]=-1.0; sumInf -= value-nearest; } numberInf++; } } printf("XX %d inf (sum %g), %d at lb %d at ub %d other integer\n", numberInf,sumInf,numberLb,numberUb,numberInt); if (numberInf) { newModel.primal(1); if (!newModel.isProvenOptimal()) { printf("not optimal - scaling issue - switch off\n"); clpSimplex->setSpecialOptions(save); if (clpSimplex->status()==4) clpSimplex->setProblemStatus(1); return clpSolver->isProvenOptimal() ? 1 : 0; } //newModel.writeMps("bad.mps"); //assert (newModel.isProvenOptimal()); printf("%d iterations\n",newModel.numberIterations()); int numberInf2 = 0; int numberLb2 = 0; int numberUb2 = 0; int numberInt2 = 0; double sumInf2=0.0; const double * solution = newModel.primalColumnSolution(); const double * lower = clpSimplex->columnLower(); const double * upper = clpSimplex->columnUpper(); for (int i=0;iupper[iSequence]-integerTolerance) { numberUb2++; } else if (fabs(value - nearest) <= integerTolerance) { numberInt2++; } else { if (value>nearest) { sumInf2 += value-nearest; } else { sumInf2 -= value-nearest; } numberInf2++; } } printf("XXX %d inf (sum %g), %d at lb %d at ub %d other integer\n", numberInf2,sumInf2,numberLb2,numberUb2,numberInt2); if (sumInf2objective(), numberColumns*sizeof(double)); memcpy(newModel.columnLower(), clpSimplex->columnLower(), numberColumns*sizeof(double)); memcpy(newModel.columnUpper(), clpSimplex->columnUpper(), numberColumns*sizeof(double)); newModel.setClpScaledMatrix(NULL); newModel.primal(1); printf("%d iterations\n",newModel.numberIterations()); int numberInf3 = 0; int numberLb3 = 0; int numberUb3 = 0; int numberInt3 = 0; double sumInf3=0.0; const double * solution = newModel.primalColumnSolution(); const double * lower = clpSimplex->columnLower(); const double * upper = clpSimplex->columnUpper(); for (int i=0;iupper[iSequence]-integerTolerance) { numberUb3++; } else if (fabs(value - nearest) <= integerTolerance) { numberInt3++; } else { if (value>nearest) { sumInf3 += value-nearest; } else { sumInf3 -= value-nearest; } numberInf3++; } } printf("XXXXX %d inf (sum %g), %d at lb %d at ub %d other integer\n", numberInf3,sumInf3,numberLb3,numberUb3,numberInt3); if (sumInf3primalColumnSolution(), newModel.primalColumnSolution(), numberColumns*sizeof(double)); memcpy(clpSimplex->dualColumnSolution(), newModel.dualColumnSolution(), numberColumns*sizeof(double)); memcpy(clpSimplex->primalRowSolution(), newModel.primalRowSolution(), numberRows*sizeof(double)); memcpy(clpSimplex->dualRowSolution(), newModel.dualRowSolution(), numberRows*sizeof(double)); memcpy(clpSimplex->statusArray(), newModel.statusArray(), (numberColumns+numberRows)*sizeof(unsigned char)); clpSolver->setWarmStart(NULL); } } } } clpSimplex->setSpecialOptions(save); if (clpSimplex->status()==4) clpSimplex->setProblemStatus(1); return clpSolver->isProvenOptimal() ? 1 : 0; } #endif /*! \todo It'd be really nice if there were an overload for this method that allowed a separate value for the underlying solver's log level. The overload could be coded to allow an increase in the log level of the underlying solver. It's worth contemplating whether OSI should have a setLogLevel method that's more specific than the hint mechanism. */ // Set log level void CbcModel::setLogLevel(int value) { handler_->setLogLevel(value); // Reduce print out in Osi if (solver_) { int oldLevel = solver_->messageHandler()->logLevel(); if (value < oldLevel) solver_->messageHandler()->setLogLevel(value); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { ClpSimplex * clpSimplex = clpSolver->getModelPtr(); oldLevel = clpSimplex->logLevel(); if (value < oldLevel) clpSimplex->setLogLevel(value); } #else // COIN_HAS_CLP /* For generic OSI solvers, if the new log level is 0, try the DoReducePrint hint for emphasis. */ if (value == 0) { solver_->setHintParam(OsiDoReducePrint, true, OsiHintDo) ; } #endif // COIN_HAS_CLP } } /* Pass in target solution and optional priorities. If priorities then >0 means only branch if incorrect while <0 means branch even if correct. +1 or -1 are highest priority */ void CbcModel::setHotstartSolution(const double * solution, const int * priorities) { if (solution == NULL) { delete [] hotstartSolution_; hotstartSolution_ = NULL; delete [] hotstartPriorities_; hotstartPriorities_ = NULL; } else { int numberColumns = solver_->getNumCols(); hotstartSolution_ = CoinCopyOfArray(solution, numberColumns); hotstartPriorities_ = CoinCopyOfArray(priorities, numberColumns); for (int i = 0; i < numberColumns; i++) { if (hotstartSolution_[i] == -COIN_DBL_MAX) { hotstartSolution_[i] = 0.0; hotstartPriorities_[i] += 10000; } if (solver_->isInteger(i)) hotstartSolution_[i] = floor(hotstartSolution_[i] + 0.5); } } } // Increment strong info void CbcModel::incrementStrongInfo(int numberTimes, int numberIterations, int numberFixed, bool ifInfeasible) { strongInfo_[0] += numberTimes; numberStrongIterations_ += numberIterations; strongInfo_[1] += numberFixed; if (ifInfeasible) strongInfo_[2] ++; } /* Set objective value in a node. This is separated out so that odd solvers can use. It may look at extra information in solverCharacteriscs_ and will also use bound from parent node */ void CbcModel::setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const { double newObjValue = solver_->getObjSense() * solver_->getObjValue(); // If odd solver take its bound if (solverCharacteristics_) { newObjValue = CoinMax(newObjValue, solverCharacteristics_->mipBound()); // Reset bound anyway (no harm if not odd) solverCharacteristics_->setMipBound(-COIN_DBL_MAX); } // If not root then use max of this and parent if (parentNode) newObjValue = CoinMax(newObjValue, parentNode->objectiveValue()); thisNode->setObjectiveValue(newObjValue); } // Current time since start of branchAndbound double CbcModel::getCurrentSeconds() const { if (!useElapsedTime()) return CoinCpuTime() - getDblParam(CbcStartSeconds); else return CoinGetTimeOfDay() - getDblParam(CbcStartSeconds); } /* Encapsulates choosing a variable - anyAction: -2 infeasible -1 round again 0 done At the point where chooseBranch is called, we've decided that this problem will need to be placed in the live set and we need to choose a branching variable. Parameters: newNode: the node just created for the active subproblem. oldNode: newNode's parent. lastws: oldNode's basis lowerBefore, upperBefore: column bound arrays for oldNode cuts: list of cuts added to newNode. resolved: (o) set to true if newNode is resolved during processing branches: (o) will be filled in with ... ? Null on entry */ int CbcModel::chooseBranch(CbcNode * &newNode, int numberPassesLeft, CbcNode * oldNode, OsiCuts & cuts, bool & resolved, CoinWarmStartBasis *lastws, const double * lowerBefore, const double * upperBefore, OsiSolverBranch * & branches) { // Set state of search /* 0 - outside CbcNode 1 - no solutions 2 - all heuristic solutions 3 - a solution reached by branching (could be strong) 4 - no solution but many nodes add 10 if depth >= K K is currently hardcoded to 8, a few lines below. CBCMODEL_DEBUG: Seems like stateOfSearch_ should be 2 if numberHeuristicSolutions_ == numberSolutions_. */ stateOfSearch_ = 1; if (numberSolutions_ > 0) { if (numberHeuristicSolutions_ == numberSolutions_) stateOfSearch_ = 3; else stateOfSearch_ = 3; } if (numberNodes_ > 2*numberObjects_ + 1000) { stateOfSearch_ = 4; } //stateOfSearch_=3; if (currentNode_ && currentNode_->depth() >= 8) stateOfSearch_ += 10; //printf("STate %d, %d nodes - parent %c - sol %d %d\n", // stateOfSearch_,numberNodes_,parentModel_ ? 'Y' :'N', // numberSolutions_,numberHeuristicSolutions_); int anyAction = -1 ; resolved = false ; if (newNode->objectiveValue() >= getCutoff()) anyAction = -2; branches = NULL; bool feasible = true; int branchingState = -1; // Compute "small" change in branch int nBranches = intParam_[CbcNumberBranches]; if (nBranches) { double average = dblParam_[CbcSumChange] / static_cast(nBranches); dblParam_[CbcSmallChange] = CoinMax(average * 1.0e-5, dblParam_[CbcSmallestChange]); dblParam_[CbcSmallChange] = CoinMax(dblParam_[CbcSmallChange], 1.0e-8); } else { dblParam_[CbcSmallChange] = 1.0e-8; } #ifdef JJF_ZERO // Say not on optimal path bool onOptimalPath = false; if ((specialOptions_&1) != 0) { /* This doesn't work as intended --- getRowCutDebugger will return null unless the current feasible solution region includes the optimal solution that RowCutDebugger knows. There's no way to tell inactive from off the optimal path. */ const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (debugger) { onOptimalPath = true; printf("On optimal path - choose\n") ; } } #endif currentNode_ = newNode; // so can be used elsewhere // Remember number of rows to restore at the end of the loop int saveNumberRows=solver_->getNumRows(); /* Enough preparation. Get down to the business of choosing a branching variable. */ while (anyAction == -1) { // Set objective value (not so obvious if NLP etc) setObjectiveValue(newNode, oldNode); //if (numberPassesLeft<=0) //branchingState=1; /* Is there a CbcBranchDecision object installed? Does it specify a chooseVariable method? If not, we're using the old (Cbc) side of the branch decision hierarchy. In quick summary, CbcNode::chooseBranch uses strong branching on any objects, while CbcNode::chooseDynamicBranch uses dynamic branching, but only on simple integers (-3 is the code for punt due to complex objects). Serious bugs remain on the Cbc side, particularly in chooseDynamicBranch. */ if (!branchingMethod_ || !branchingMethod_->chooseMethod()) { #ifdef COIN_HAS_CLP bool doClp = oldNode && (oldNode->depth() % 2) == 1; if (!doCutsNow(1)) doClp = true; //doClp = true; int testDepth = 5; // Don't do if many iterations per node int totalNodes = numberNodes_ + numberExtraNodes_; int totalIterations = numberIterations_ + numberExtraIterations_; bool diving=false; if ((moreSpecialOptions_&33554432)!=0) { testDepth=COIN_INT_MAX; if (oldNode&&(oldNode->depth()==-2||oldNode->depth()==4)) diving=true; } if (totalNodes*40 < totalIterations || numberNodes_ < 1000) { doClp = false; //} else if (oldNode&&fastNodeDepth_>=0&&oldNode->depth()>=testDepth&&(specialOptions_&2048)==0) { //printf("size %d %d - cuts %d - nodes %d its %d %c\n",solver_->getNumRows(), // solver_->getNumCols(),cuts.sizeRowCuts(), // totalNodes,totalIterations,doClp ? 'Y' : 'N'); } if (oldNode && ((fastNodeDepth_ >= 0 && oldNode->depth() >= testDepth && doClp)||diving) &&/*!parentModel_*/(specialOptions_&2048) == 0 && !cuts.sizeRowCuts()) { OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) { anyAction = newNode->chooseClpBranch(this, oldNode) ; if (anyAction != -1) break; } } #endif #ifdef COIN_HAS_CLP int save=0; OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver&&(moreSpecialOptions_&4194304)!=0) { ClpSimplex * clpSimplex = clpSolver->getModelPtr(); save=clpSimplex->specialOptions(); clpSimplex->setSpecialOptions(save | 0x11200000); // say is Cbc (and in branch and bound - but save ray) } #endif #ifdef COIN_HAS_NTY if (symmetryInfo_) { CbcNodeInfo * infoX = oldNode ? oldNode->nodeInfo() : NULL; bool worthTrying = false; if (infoX) { CbcNodeInfo * info = infoX; for (int i=0;iparent()) { worthTrying = true; break; } info = info->parent(); if (info->symmetryWorked()) { worthTrying = true; break; } } } else { worthTrying=true; } if ((moreSpecialOptions2_&(128|256))==(128|256)&¤tDepth_>5) worthTrying=false; if (worthTrying) { int n=symmetryInfo_->orbitalFixing(solver_); if (n) { #if PRINT_MORE==0 if (logLevel()>1) printf("%d orbital fixes\n",n); #endif solver_->resolve(); if(!isProvenOptimal()) { if (logLevel()>1) printf("infeasible after orbital fixing\n"); } } } } #endif if (numberBeforeTrust_ == 0 ) { anyAction = newNode->chooseBranch(this, oldNode, numberPassesLeft) ; } else { anyAction = newNode->chooseDynamicBranch(this, oldNode, branches, numberPassesLeft) ; if (anyAction == -3) anyAction = newNode->chooseBranch(this, oldNode, numberPassesLeft) ; // dynamic did nothing } #ifdef COIN_HAS_CLP if (clpSolver&&(moreSpecialOptions_&4194304)!=0) { ClpSimplex * clpSimplex = clpSolver->getModelPtr(); clpSimplex->setSpecialOptions(save); } #endif /* We're on the new (Osi) side of the branching hierarchy. */ } else { OsiBranchingInformation usefulInfo = usefulInformation(); anyAction = newNode->chooseOsiBranch(this, oldNode, &usefulInfo, branchingState) ;; // Osi method //branchingState=0; } if (!oldNode) { if (numberUpdateItems_) { for (int i = 0; i < numberUpdateItems_; i++) { CbcObjectUpdateData * update = updateItems_ + i; CbcObject * object = dynamic_cast (update->object_); #ifndef NDEBUG bool found = false; for (int j = 0; j < numberObjects_; j++) { if (update->object_ == object_[j]) { found = true; break; } } assert (found); #endif //if (object) //assert (object==object_[update->objectNumber_]); if (object) object->updateInformation(*update); } numberUpdateItems_ = 0; } } if (solverCharacteristics_ && solverCharacteristics_->solutionAddsCuts() && // we are in some OA based bab feasible && (newNode->numberUnsatisfied() == 0) //solution has become integer feasible during strong branching ) { //in the present case we need to check here integer infeasibility if the node is not fathomed we will have to do the loop // again //std::cout< normal () && (!generator_ [i] -> needsOptimalBasis () || solver_ -> basisIsAvailable ())) generator_ [i] -> generateCuts (feasCuts, 1 /* = fullscan */, solver_, NULL); } solver_ -> applyCuts (feasCuts); resolve(solver_); double objval = solver_->getObjValue(); lastHeuristic_ = NULL; setBestSolution(CBC_SOLUTION, objval, solver_->getColSolution()) ; int easy = 2; if (!solverCharacteristics_->mipFeasible())//did we prove that the node could be pruned? feasible = false; // Reset the bound now solverCharacteristics_->setMipBound(-COIN_DBL_MAX); solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, &easy) ; feasible &= resolve(oldNode ? oldNode->nodeInfo() : NULL, 11) != 0 ; solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; resolved = true ; if (problemFeasibility_->feasible(this, 0) < 0) { feasible = false; // pretend infeasible } if (feasible) anyAction = -1; else anyAction = -2; } /* Yep, false positives for sure. And no easy way to distinguish honest infeasibility from `found a solution and tightened objective target.' if (onOptimalPath) assert (anyAction!=-2); // can be useful but gives false positives on strong */ numberPassesLeft--; if (numberPassesLeft <= -1) { if (!numberLongStrong_ && !numberThreads_) messageHandler()->message(CBC_WARNING_STRONG, messages()) << CoinMessageEol ; numberLongStrong_++; } if (anyAction == -1) { // can do quick optimality check int easy = 2; solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, &easy) ; feasible = resolve(oldNode ? oldNode->nodeInfo() : NULL, 11) != 0 ; solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo, NULL) ; resolved = true ; if (problemFeasibility_->feasible(this, 0) < 0) { feasible = false; // pretend infeasible } if (feasible) { // Set objective value (not so obvious if NLP etc) setObjectiveValue(newNode, oldNode); reducedCostFix() ; if (newNode->objectiveValue() >= getCutoff()) anyAction = -2; } else { anyAction = -2 ; } } } //A candidate has been found; restore the subproblem. if( saveNumberRowsgetNumRows()) { // delete rows - but leave solution int n = solver_->getNumRows(); int * del = new int [n-saveNumberRows]; for (int i=saveNumberRows;ideleteRows(n-saveNumberRows,del); delete [] del; } /* End main loop to choose a branching variable. */ if (anyAction >= 0) { if (resolved) { /* Used to be that when the node was not fathomed (branching object present) the solution was not needed. But that's no longer the case --- heuristics are applied, and they may want the solution. */ // bool needValidSolution = (newNode->branchingObject() == NULL) ; bool needValidSolution = true ; takeOffCuts(cuts, needValidSolution , NULL) ; # ifdef CHECK_CUT_COUNTS { printf("Number of rows after chooseBranch fix (node)" "(active only) %d\n", numberRowsAtContinuous_ + numberNewCuts_ + numberOldActiveCuts_) ; const CoinWarmStartBasis* debugws = dynamic_cast (solver_->getWarmStart()) ; debugws->print() ; delete debugws ; } # endif } { OsiBranchingObject * branchingObject = newNode->modifiableBranchingObject(); CbcGeneralBranchingObject * generalBranch = dynamic_cast (branchingObject); if (generalBranch && false) { int numberProblems = generalBranch->numberSubProblems(); for (int i = 0; i < numberProblems; i++) { double objectiveValue; double sumInfeasibilities; int numberUnsatisfied; generalBranch->state(objectiveValue, sumInfeasibilities, numberUnsatisfied, i); printf("node %d obj %g sumI %g numI %i rel depth %d\n", i, objectiveValue, sumInfeasibilities, numberUnsatisfied, generalBranch->subProblem(i)->depth_); } } if (generalBranch) { int numberProblems = generalBranch->numberSubProblems(); newNode->setBranchingObject(NULL); CbcNode * newNode2 = NULL; assert (numberProblems); int nProbMinus1 = numberProblems - 1; lockThread(); for (int i = 0; i < currentNumberCuts_; i++) { if (addedCuts_[i]) addedCuts_[i]->increment(nProbMinus1) ; } unlockThread(); for (int i = 0; i < numberProblems; i++) { double objectiveValue; double sumInfeasibilities; int numberUnsatisfied; generalBranch->state(objectiveValue, sumInfeasibilities, numberUnsatisfied, i); //printf("node %d obj %g sumI %g numI %i rel depth %d\n", // i,objectiveValue,sumInfeasibilities,numberUnsatisfied, // generalBranch->subProblem(i)->depth_); newNode2 = new CbcNode(); newNode2->setDepth(generalBranch->subProblem(i)->depth_ + currentDepth_); generalBranch->subProblem(i)->apply(solver_, 8); // basis newNode2->setNumberUnsatisfied(numberUnsatisfied); newNode2->setSumInfeasibilities(sumInfeasibilities); newNode2->setGuessedObjectiveValue(objectiveValue); newNode2->setObjectiveValue(objectiveValue); CbcOneGeneralBranchingObject * object = new CbcOneGeneralBranchingObject(this, generalBranch, i); newNode2->setBranchingObject(object); assert (lastws->fullBasis()); newNode2->createInfo(this, oldNode, lastws, lowerBefore, upperBefore, numberOldActiveCuts_, numberNewCuts_) ; newNode2->nodeInfo()->setNumberBranchesLeft(1); //newNode2->nodeInfo()->unsetParentBasedData(); if (i < nProbMinus1) { //OsiBranchingObject * object = oldNode->modifiableBranchingObject(); CbcNodeInfo * nodeInfo = oldNode->nodeInfo(); //object->incrementNumberBranchesLeft(); nodeInfo->incrementNumberPointingToThis(); newNode2->nodeInfo()->setNodeNumber(numberNodes2_); //newNode2->nodeInfo()->setNumberBranchesLeft(1); newNode2->initializeInfo(); numberNodes2_++; tree_->push(newNode2); } } delete newNode; newNode = newNode2; } else { if (lastws) { if (parallelMode() < -1) { lastws->fixFullBasis(); } else { if ((specialOptions_&8192) == 0) assert (lastws->fullBasis()); else lastws->fixFullBasis(); } } newNode->createInfo(this, oldNode, lastws, lowerBefore, upperBefore, numberOldActiveCuts_, numberNewCuts_) ; } } if (newNode->numberUnsatisfied()) { maximumDepthActual_ = CoinMax(maximumDepthActual_, newNode->depth()); // Number of branches is in oldNode! newNode->initializeInfo() ; if (cuts.sizeRowCuts()) { int initialNumber = ((threadMode_ & 1) == 0) ? 0 : 1000000000; lockThread(); newNode->nodeInfo()->addCuts(cuts, newNode->numberBranches(), //whichGenerator_, initialNumber) ; unlockThread(); } } } else { anyAction = -2 ; // Reset bound anyway (no harm if not odd) solverCharacteristics_->setMipBound(-COIN_DBL_MAX); } // May have slipped through i.e. anyAction == 0 and objective above cutoff // I think this will screw up cut reference counts if executed. // We executed addCuts just above. (lh) if ( anyAction >= 0 ) { assert (newNode); if (newNode->objectiveValue() >= getCutoff()) { anyAction = -2; // say bad after all // zap parent nodeInfo #ifdef COIN_DEVELOP printf("zapping3 CbcNodeInfo %x\n", newNode->nodeInfo()->parent()); #endif if (newNode->nodeInfo()) newNode->nodeInfo()->nullParent(); } } stateOfSearch_ = 0; // outside chooseBranch #ifdef JJF_ZERO if (onOptimalPath) { const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (!debugger) { printf("NOT On optimal path - choose\n") ; abort(); } else { printf("Still On optimal path - choose\n") ; if (anyAction == -2) { printf("anyAction 2!!\n"); abort(); } } } #endif return anyAction; } /* For advanced applications you may wish to modify the behavior of Cbc e.g. if the solver is a NLP solver then you may not have an exact optimum solution at each step. Information could be built into OsiSolverInterface but this is an alternative so that that interface does not have to be changed. If something similar is useful to enough solvers then it could be migrated. You can also pass in by using solver->setAuxiliaryInfo. You should do that if solver is odd - if solver is normal simplex then use this */ void CbcModel::passInSolverCharacteristics(OsiBabSolver * solverCharacteristics) { solverCharacteristics_ = solverCharacteristics; } // Generate an OsiBranchingInformation object OsiBranchingInformation CbcModel::usefulInformation() const { OsiBranchingInformation usefulInfo(solver_, normalSolver(), false); // and modify usefulInfo.solution_ = testSolution_; usefulInfo.integerTolerance_ = dblParam_[CbcIntegerTolerance] ; usefulInfo.hotstartSolution_ = hotstartSolution_; usefulInfo.numberSolutions_ = numberSolutions_; usefulInfo.numberBranchingSolutions_ = numberSolutions_ - numberHeuristicSolutions_; usefulInfo.depth_ = -1; return usefulInfo; } void CbcModel::setBestSolution(const double * solution, int numberColumns, double objectiveValue, bool checkSolution) { // May be odd discontinuities - so only check if asked if (checkSolution) { assert (numberColumns == solver_->getNumCols()); double * saveLower = CoinCopyOfArray(solver_->getColLower(), numberColumns); double * saveUpper = CoinCopyOfArray(solver_->getColUpper(), numberColumns); // Fix integers int numberAway = 0; for (int i = 0; i < numberColumns; i++) { if (solver_->isInteger(i)) { double value = solution[i]; double intValue = floor(value + 0.5); if (fabs(value - intValue) > 1.0e-4) numberAway++; solver_->setColLower(i, intValue); solver_->setColUpper(i, intValue); } } // Save basis CoinWarmStart * saveBasis = solver_->getWarmStart(); // Solve solver_->initialSolve(); char printBuffer[200]; if (numberAway) { sprintf(printBuffer, "Warning %d integer variables were more than 1.0e-4 away from integer", numberAway); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; } bool looksGood = solver_->isProvenOptimal(); if (looksGood) { double direction = solver_->getObjSense() ; double objValue = direction * solver_->getObjValue(); if (objValue > objectiveValue + 1.0e-8*(1.0 + fabs(objectiveValue))) { sprintf(printBuffer, "Given objective value %g, computed %g", objectiveValue, objValue); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; } // Use this as objective value and solution objectiveValue = objValue; solution = solver_->getColSolution(); // Save current basis CoinWarmStartBasis* ws = dynamic_cast (solver_->getWarmStart()) ; assert(ws); setBestSolutionBasis(*ws); delete ws; } // Restore basis solver_->setWarmStart(saveBasis); delete saveBasis; // Restore bounds solver_->setColLower(saveLower); delete [] saveLower; solver_->setColUpper(saveUpper); delete [] saveUpper; // Return if no good if (!looksGood) { messageHandler()->message(CBC_GENERAL, messages()) << "Error solution not saved as not feasible" << CoinMessageEol ; return; } else { // message sprintf(printBuffer, "Solution with objective value %g saved", objectiveValue); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; } } if (bestSolution_) saveExtraSolution(bestSolution_, bestObjective_); bestObjective_ = objectiveValue; // may be able to change cutoff now double cutoff = getCutoff(); double increment = getDblParam(CbcModel::CbcCutoffIncrement) ; if (cutoff > objectiveValue - increment) { cutoff = objectiveValue - increment ; setCutoff(cutoff) ; // change cutoff as constraint if wanted if (cutoffRowNumber_>=0) { if (solver_->getNumRows()>cutoffRowNumber_) { double offset; solver_->getDblParam(OsiObjOffset, offset); solver_->setRowUpper(cutoffRowNumber_,cutoff+offset); if (continuousSolver_&&solver_->getNumCols()>continuousSolver_->getNumCols()) { solver_->setRowUpper(cutoffRowNumber_,floor(cutoff)+offset); solver_->setRowLower(cutoffRowNumber_,floor(cutoff)+offset); } } } } int n = CoinMax(numberColumns, solver_->getNumCols()); delete [] bestSolution_; bestSolution_ = new double [n]; memset(bestSolution_, 0, n*sizeof(double)); memcpy(bestSolution_, solution, numberColumns*sizeof(double)); } /* Do heuristics at root. 0 - don't delete 1 - delete 2 - just delete - don't even use Parameter of 2 means what it says --- the routine will do nothing except delete the existing heuristics. A feasibility pump is always deleted, independent of the parameter value, as it's only useful at the root. The routine is called from branchAndBound to process the root node. But it will also be called when we've recursed into branchAndBound via smallBaB. */ void CbcModel::doHeuristicsAtRoot(int deleteHeuristicsAfterwards) { int numberColumns = getNumCols() ; double * newSolution = new double [numberColumns] ; int i; if (deleteHeuristicsAfterwards != 2) { /* If mode == 1, we delete and recreate here, then delete at the bottom. The create/delete part makes sense, but why delete the existing array? Seems like it should be preserved and restored. */ if (deleteHeuristicsAfterwards) { delete [] usedInSolution_; usedInSolution_ = new int [numberColumns]; CoinZeroN(usedInSolution_, numberColumns); } double heuristicValue = getCutoff() ; int found = -1; // no solution found CbcEventHandler *eventHandler = getEventHandler() ; if (eventHandler) eventHandler->setModel(this); /* currentPassNumber_ is described as `cut pass number'. Again, seems a bit cavalier to just change it. Whether this has any effect is determined by individual heuristics. Typically there will be a check at the front of the solution() routine that determines whether it will run or simply return. Root heuristics are characterised by node count of 0. In addition, currentPassNumber_ can be checked to to limit execution in terms of passes through cut generation / heuristic execution in solveWithCuts. */ currentPassNumber_ = 1; // so root heuristics will run /* A loop to run the heuristics. incrementUsed will mark entries in usedInSolution corresponding to variables that are nonzero in the solution. CBC_ROUNDING just identifies a message template, not the heuristic. */ // Modify based on size etc adjustHeuristics(); // See if already within allowable gap bool exitNow = false; for (i = 0; i < numberHeuristics_; i++) { if (heuristic_[i]->exitNow(bestObjective_)) exitNow = true; } if (!exitNow) { /** -1 first time otherwise number of solutions last time */ int lastSolutionCount = -1; while (lastSolutionCount) { int thisSolutionCount=0; #ifdef CBC_THREAD if ((threadMode_&4) != 0) { typedef struct { double solutionValue; CbcModel * model; double * solution; int foundSol; } argBundle; int chunk; if (!numberThreads_) chunk = numberHeuristics_; else chunk = numberThreads_; for (int iChunk = 0; iChunk < numberHeuristics_; iChunk += chunk) { argBundle * parameters = new argBundle [chunk]; for (int i = 0; i < chunk; i++) parameters[i].model = NULL; int nThisTime = CoinMin(numberHeuristics_ - iChunk, chunk); for (int i = iChunk; i < iChunk + nThisTime; i++) { // skip if can't run here if (!heuristic_[i]->shouldHeurRun(0)) continue; if (lastSolutionCount>0&& (heuristic_[i]->switches()&16)==0) continue; // no point parameters[i-iChunk].solutionValue = heuristicValue; // Don't want a strategy object CbcStrategy * saveStrategy = strategy_; strategy_ = NULL; CbcModel * newModel = new CbcModel(*this); strategy_ = saveStrategy; assert (!newModel->continuousSolver_); if (continuousSolver_) newModel->continuousSolver_ = continuousSolver_->clone(); else newModel->continuousSolver_ = solver_->clone(); parameters[i-iChunk].model = newModel; parameters[i-iChunk].solution = new double [numberColumns];; parameters[i-iChunk].foundSol = 0; //newModel->gutsOfCopy(*this,-1); for (int j = 0; j < numberHeuristics_; j++) delete newModel->heuristic_[j]; //newModel->heuristic_ = new CbcHeuristic * [1]; newModel->heuristic_[0] = heuristic_[i]->clone(); newModel->heuristic_[0]->setModel(newModel); newModel->heuristic_[0]->resetModel(newModel); newModel->numberHeuristics_ = 1; } void parallelHeuristics (int numberThreads, int sizeOfData, void * argBundle); parallelHeuristics(nThisTime, static_cast(sizeof(argBundle)), parameters); double cutoff = heuristicValue; for (int i = 0; i < chunk; i++) { if (parameters[i].model) { if (parameters[i].foundSol > 0 && parameters[i].solutionValue < heuristicValue) { memcpy(newSolution, parameters[i].solution, numberColumns*sizeof(double)); lastHeuristic_ = heuristic_[i+iChunk]; double value = parameters[i].solutionValue; setBestSolution(CBC_ROUNDING, value, newSolution) ; // Double check valid if (getCutoff() < cutoff) { cutoff = getCutoff(); heuristicValue = value; heuristic_[i+iChunk]->incrementNumberSolutionsFound(); incrementUsed(newSolution); // increment number of solutions so other heuristics can test thisSolutionCount++; numberHeuristicSolutions_++; found = i + iChunk ; } } if (heuristic_[i+iChunk]->exitNow(bestObjective_) || (parameters[i].model->heuristic(0)->switches()&(1024 + 2048)) == (1024 + 2048)) exitNow = true; delete [] parameters[i].solution; delete parameters[i].model; } } delete [] parameters; if (exitNow) break; } } else { #endif int whereFrom = 0; for (i = 0; i < numberHeuristics_; i++) { // skip if can't run here if (!heuristic_[i]->shouldHeurRun(whereFrom)) continue; if (lastSolutionCount>0&& (heuristic_[i]->switches()&16)==0) continue; // no point if (maximumSecondsReached()) { thisSolutionCount=-1000000; break; } // see if heuristic will do anything double saveValue = heuristicValue ; double before = getCurrentSeconds(); int ifSol = heuristic_[i]->solution(heuristicValue, newSolution); if (handler_->logLevel()>1) { char line[100]; sprintf(line,"Heuristic %s took %g seconds (%s)", heuristic_[i]->heuristicName(), getCurrentSeconds()-before, ifSol ? "good" : "no good"); handler_->message(CBC_GENERAL, messages_) << line << CoinMessageEol ; } //#define DEBUG_BEST #ifdef DEBUG_BEST FILE * fp = fopen("solution.data","rb"); if (!fp&&ifSol>0) { int numberColumns=getNumCols(); fp = fopen("solution.data","wb"); printf("Solution data on file solution.data\n"); size_t numberWritten; numberWritten=fwrite(&numberColumns,sizeof(int),1,fp); assert (numberWritten==1); numberWritten=fwrite(&heuristicValue,sizeof(double),1,fp); assert (numberWritten==1); numberWritten=fwrite(newSolution,sizeof(double),numberColumns,fp); assert (numberWritten==numberColumns); fclose(fp); } else if (fp) { int numberColumns=getNumCols(); int numberColumnsX; size_t numberRead; numberRead=fread(&numberColumnsX,sizeof(int),1,fp); assert (numberRead==1); if (numberColumns==numberColumnsX) { numberRead=fread(&heuristicValue,sizeof(double),1,fp); assert (numberRead==1); numberRead=fread(newSolution,sizeof(double),numberColumns,fp); assert (numberRead==numberColumns); ifSol=1; } fclose(fp); } #endif if (ifSol > 0) { // better solution found double currentObjective = bestObjective_; CbcHeuristic * saveHeuristic = lastHeuristic_; lastHeuristic_ = heuristic_[i]; setBestSolution(CBC_ROUNDING, heuristicValue, newSolution) ; if (bestObjective_ < currentObjective) { thisSolutionCount++; heuristic_[i]->incrementNumberSolutionsFound(); found = i ; incrementUsed(newSolution); // increment number of solutions so other heuristics can test // numberSolutions_++; numberHeuristicSolutions_++; #ifdef HEURISTIC_INFORM printf("HEUR %s where %d C\n", lastHeuristic_->heuristicName(), whereFrom); #endif whereFrom |= 8; // say solution found if (heuristic_[i]->exitNow(bestObjective_) ||numberSolutions_>=getMaximumSolutions()) { thisSolutionCount=-1000000; break; } if (eventHandler) { if (!eventHandler->event(CbcEventHandler::heuristicSolution)) { eventHappened_ = true; // exit thisSolutionCount=-1000000; break; } } double testGap = CoinMax(dblParam_[CbcAllowableGap], CoinMax(fabs(bestObjective_), fabs(bestPossibleObjective_)) * dblParam_[CbcAllowableFractionGap]); if (bestObjective_ - bestPossibleObjective_ < testGap && getCutoffIncrement() >= 0.0 &&bestPossibleObjective_ < 1.0e30) { if (bestPossibleObjective_ < getCutoff()) stoppedOnGap_ = true ; //eventHappened_=true; // stop as fast as possible thisSolutionCount=-1000000; break; } reducedCostFix(); } else { // NOT better solution #if CBC_USEFUL_PRINTING>1 printf("HEUR %s where %d REJECTED i==%d\n", heuristic_[i]->heuristicName(), whereFrom, i); #endif lastHeuristic_ = saveHeuristic; heuristicValue = saveValue ; } } else { heuristicValue = saveValue ; } if (eventHandler) { if (!eventHandler->event(CbcEventHandler::afterHeuristic)) { eventHappened_ = true; // exit thisSolutionCount=-1000000; break; } } } #ifdef CBC_THREAD } #endif if (thisSolutionCount<=0) break; lastSolutionCount=thisSolutionCount; } } currentPassNumber_ = 0; /* Did any of the heuristics turn up a new solution? Record it before we free the vector. tree_ will not necessarily be a CbcTreeLocal; the main model gets a CbcTree by default. CbcTreeLocal actually implements a k-neighbourhood search heuristic. This initialises it with a solution and creates the k-neighbourhood cut. */ if (found >= 0) { CbcTreeLocal * tree = dynamic_cast (tree_); if (tree) tree->passInSolution(bestSolution_, heuristicValue); if (eventHandler) { if (!eventHandler->event(CbcEventHandler::solution)) { eventHappened_ = true; // exit } } } } /* Cleanup. The feasibility pump heuristic is a root heuristic to look for an initial feasible solution. It's had its chance; remove it. For modes 1 and 2, all the heuristics are deleted. */ if (!deleteHeuristicsAfterwards) { for (i = 0; i < numberHeuristics_; i++) { // delete FPump CbcHeuristicFPump * pump = dynamic_cast (heuristic_[i]); if (pump && pump->feasibilityPumpOptions() < 1000000) { delete pump; numberHeuristics_ --; for (int j = i; j < numberHeuristics_; j++) heuristic_[j] = heuristic_[j+1]; } } } else { // delete all for (i = 0; i < numberHeuristics_; i++) delete heuristic_[i]; numberHeuristics_ = 0; delete [] heuristic_; heuristic_ = NULL; delete [] usedInSolution_; usedInSolution_ = NULL; } delete [] newSolution ; } // Zap integer information in problem (may leave object info) void CbcModel::zapIntegerInformation(bool leaveObjects) { numberIntegers_ = 0; delete [] integerVariable_; integerVariable_ = NULL; if (!leaveObjects && ownObjects_) { int i; for (i = 0; i < numberObjects_; i++) delete object_[i]; delete [] object_; numberObjects_ = 0; object_ = NULL; } } // Create C++ lines to get to current state void CbcModel::generateCpp( FILE * fp, int /*options*/) { // Do cut generators int i; for (i = 0; i < numberCutGenerators_; i++) { CglCutGenerator * generator = generator_[i]->generator(); std::string name = generator->generateCpp(fp); int howOften = generator_[i]->howOften(); int howOftenInSub = generator_[i]->howOftenInSub(); int whatDepth = generator_[i]->whatDepth(); int whatDepthInSub = generator_[i]->whatDepthInSub(); bool normal = generator_[i]->normal(); bool atSolution = generator_[i]->atSolution(); bool whenInfeasible = generator_[i]->whenInfeasible(); bool timing = generator_[i]->timing(); fprintf(fp, "3 cbcModel->addCutGenerator(&%s,%d,", name.c_str(), howOften); // change name name[0] = static_cast(toupper(name[0])); fprintf(fp, "\"%s\",%s,%s,%s,%d,%d,%d);\n", name.c_str(), normal ? "true" : "false", atSolution ? "true" : "false", whenInfeasible ? "true" : "false", howOftenInSub, whatDepth, whatDepthInSub); fprintf(fp, "3 cbcModel->cutGenerator(%d)->setTiming(%s);\n", i, timing ? "true" : "false"); fprintf(fp, "3 \n"); } for (i = 0; i < numberHeuristics_; i++) { CbcHeuristic * heuristic = heuristic_[i]; heuristic->generateCpp(fp); fprintf(fp, "3 \n"); } if (nodeCompare_) nodeCompare_->generateCpp(fp); tree_->generateCpp(fp); CbcModel defaultModel; CbcModel * other = &defaultModel; int iValue1, iValue2; double dValue1, dValue2; iValue1 = this->getMaximumNodes(); iValue2 = other->getMaximumNodes(); fprintf(fp, "%d int save_getMaximumNodes = cbcModel->getMaximumNodes();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setMaximumNodes(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setMaximumNodes(save_getMaximumNodes);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->getMaximumSolutions(); iValue2 = other->getMaximumSolutions(); fprintf(fp, "%d int save_getMaximumSolutions = cbcModel->getMaximumSolutions();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setMaximumSolutions(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setMaximumSolutions(save_getMaximumSolutions);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->numberStrong(); iValue2 = other->numberStrong(); fprintf(fp, "%d int save_numberStrong = cbcModel->numberStrong();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setNumberStrong(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setNumberStrong(save_numberStrong);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->numberBeforeTrust(); iValue2 = other->numberBeforeTrust(); fprintf(fp, "%d int save_numberBeforeTrust = cbcModel->numberBeforeTrust();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setNumberBeforeTrust(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setNumberBeforeTrust(save_numberBeforeTrust);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->numberPenalties(); iValue2 = other->numberPenalties(); fprintf(fp, "%d int save_numberPenalties = cbcModel->numberPenalties();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setNumberPenalties(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setNumberPenalties(save_numberPenalties);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->howOftenGlobalScan(); iValue2 = other->howOftenGlobalScan(); fprintf(fp, "%d int save_howOftenGlobalScan = cbcModel->howOftenGlobalScan();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setHowOftenGlobalScan(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setHowOftenGlobalScan(save_howOftenGlobalScan);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->printFrequency(); iValue2 = other->printFrequency(); fprintf(fp, "%d int save_printFrequency = cbcModel->printFrequency();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setPrintFrequency(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setPrintFrequency(save_printFrequency);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->getPrintingMode(); iValue2 = other->getPrintingMode(); fprintf(fp, "%d int save_printingMode = cbcModel->getPrintingMode();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setPrintingMode(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setPrintingMode(save_printingMode);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->searchStrategy(); iValue2 = other->searchStrategy(); fprintf(fp, "%d int save_searchStrategy = cbcModel->searchStrategy();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setSearchStrategy(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setSearchStrategy(save_searchStrategy);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->specialOptions(); iValue2 = other->specialOptions(); fprintf(fp, "%d int save_cbcSpecialOptions = cbcModel->specialOptions();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setSpecialOptions(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setSpecialOptions(save_cbcSpecialOptions);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->messageHandler()->logLevel(); iValue2 = other->messageHandler()->logLevel(); fprintf(fp, "%d int save_cbcMessageLevel = cbcModel->messageHandler()->logLevel();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->messageHandler()->setLogLevel(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->messageHandler()->setLogLevel(save_cbcMessageLevel);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->getMaximumCutPassesAtRoot(); iValue2 = other->getMaximumCutPassesAtRoot(); fprintf(fp, "%d int save_getMaximumCutPassesAtRoot = cbcModel->getMaximumCutPassesAtRoot();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setMaximumCutPassesAtRoot(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setMaximumCutPassesAtRoot(save_getMaximumCutPassesAtRoot);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->getMaximumCutPasses(); iValue2 = other->getMaximumCutPasses(); fprintf(fp, "%d int save_getMaximumCutPasses = cbcModel->getMaximumCutPasses();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setMaximumCutPasses(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setMaximumCutPasses(save_getMaximumCutPasses);\n", iValue1 == iValue2 ? 7 : 6); iValue1 = this->getPreferredWay(); iValue2 = other->getPreferredWay(); fprintf(fp, "%d int save_getPreferredWay = cbcModel->getPreferredWay();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setPreferredWay(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d cbcModel->setPreferredWay(save_getPreferredWay);\n", iValue1 == iValue2 ? 7 : 6); dValue1 = this->getMinimumDrop(); dValue2 = other->getMinimumDrop(); fprintf(fp, "%d double save_getMinimumDrop = cbcModel->getMinimumDrop();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setMinimumDrop(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d cbcModel->setMinimumDrop(save_getMinimumDrop);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->getIntegerTolerance(); dValue2 = other->getIntegerTolerance(); fprintf(fp, "%d double save_getIntegerTolerance = cbcModel->getIntegerTolerance();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setIntegerTolerance(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d cbcModel->setIntegerTolerance(save_getIntegerTolerance);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->getInfeasibilityWeight(); dValue2 = other->getInfeasibilityWeight(); fprintf(fp, "%d double save_getInfeasibilityWeight = cbcModel->getInfeasibilityWeight();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setInfeasibilityWeight(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d cbcModel->setInfeasibilityWeight(save_getInfeasibilityWeight);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->getCutoffIncrement(); dValue2 = other->getCutoffIncrement(); fprintf(fp, "%d double save_getCutoffIncrement = cbcModel->getCutoffIncrement();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setCutoffIncrement(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d cbcModel->setCutoffIncrement(save_getCutoffIncrement);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->getAllowableGap(); dValue2 = other->getAllowableGap(); fprintf(fp, "%d double save_getAllowableGap = cbcModel->getAllowableGap();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setAllowableGap(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d cbcModel->setAllowableGap(save_getAllowableGap);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->getAllowableFractionGap(); dValue2 = other->getAllowableFractionGap(); fprintf(fp, "%d double save_getAllowableFractionGap = cbcModel->getAllowableFractionGap();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setAllowableFractionGap(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d cbcModel->setAllowableFractionGap(save_getAllowableFractionGap);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->getMaximumSeconds(); dValue2 = other->getMaximumSeconds(); fprintf(fp, "%d double save_cbcMaximumSeconds = cbcModel->getMaximumSeconds();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d cbcModel->setMaximumSeconds(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d cbcModel->setMaximumSeconds(save_cbcMaximumSeconds);\n", dValue1 == dValue2 ? 7 : 6); } // So we can use osiObject or CbcObject during transition void getIntegerInformation(const OsiObject * object, double & originalLower, double & originalUpper) { const CbcSimpleInteger * integerObject = dynamic_cast (object); if (integerObject) { // get original bounds originalLower = integerObject->originalLowerBound(); originalUpper = integerObject->originalUpperBound(); } else { const OsiSimpleInteger * integerObject = dynamic_cast (object); assert (integerObject); // get original bounds originalLower = integerObject->originalLowerBound(); originalUpper = integerObject->originalUpperBound(); } } // Set original columns as created by preprocessing void CbcModel::setOriginalColumns(const int * originalColumns,int numberGood) { int numberColumns = getNumCols(); delete [] originalColumns_; originalColumns_ = new int [numberColumns]; int numberCopy=CoinMin(numberColumns,numberGood); memcpy(originalColumns_,originalColumns,numberCopy*sizeof(int)); for (int i=numberCopy;iclone(); } /* Set the cut modifier method */ void CbcModel::setCutModifier(CbcCutModifier & modifier) { delete cutModifier_; cutModifier_ = modifier.clone(); } /* Do one node - broken out for clarity? also for parallel (when baseModel!=this) Returns 1 if solution found node NULL on return if no branches left newNode NULL if no new node created */ int CbcModel::doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode) { int foundSolution = 0; int saveNumberCutGenerators=numberCutGenerators_; if ((moreSpecialOptions_&33554432)!=0 && (specialOptions_&2048)==0) { if (node&&(node->depth()==-2||node->depth()==4)) numberCutGenerators_=0; // so can dive and branch } currentNode_ = node; // so can be accessed elsewhere double bestObjective = bestObjective_; numberUpdateItems_ = 0; // Say not on optimal path bool onOptimalPath = false; # ifdef CHECK_NODE printf("Node %x popped from tree - %d left, %d count\n", node, node->nodeInfo()->numberBranchesLeft(), node->nodeInfo()->numberPointingToThis()) ; printf("\tdepth = %d, z = %g, unsat = %d\n", //var = %d.\n", node->depth(), node->objectiveValue(), node->numberUnsatisfied()); //node->columnNumber()) ; # endif /* Rebuild the subproblem for this node: Call addCuts() to adjust the model to recreate the subproblem for this node (set proper variable bounds, add cuts, create a basis). This may result in the problem being fathomed by bound or infeasibility. Returns 1 if node is fathomed. Execute the current arm of the branch: If the problem survives, save the resulting variable bounds and call branch() to modify variable bounds according to the current arm of the branching object. If we're processing the final arm of the branching object, flag the node for removal from the live set. */ /* Used to generate bound edits for CbcPartialNodeInfo. */ int numberColumns = getNumCols() ; double * lowerBefore = new double [numberColumns] ; double * upperBefore = new double [numberColumns] ; if (parallelMode() >= 0) newNode = NULL ; else newNode = new CbcNode(); bool feasible = true; CoinWarmStartBasis *lastws = new CoinWarmStartBasis(); lockThread(); // point to genuine ones //int save1 = maximumNumberCuts_; //maximumNumberCuts_ = baseModel->maximumNumberCuts_; //addedCuts_ = baseModel->addedCuts_; if (parallelMode() >= 0) { maximumDepth_ = baseModel->maximumDepth_; walkback_ = baseModel->walkback_; lastNodeInfo_ = baseModel->lastNodeInfo_; lastNumberCuts_ = baseModel->lastNumberCuts_; lastCut_ = baseModel->lastCut_; lastNumberCuts2_ = baseModel->lastNumberCuts2_; } int save2 = maximumDepth_; int retCode = addCuts(node, lastws); #ifdef SWITCH_VARIABLES fixAssociated(solver_,0); #endif //if (save1maximumNumberCuts_ = maximumNumberCuts_; //baseModel->addedCuts_ = addedCuts_; //} if (parallelMode() >= 0 && save2 < maximumDepth_) { // increased baseModel->maximumDepth_ = maximumDepth_; baseModel->walkback_ = walkback_; baseModel->lastNodeInfo_ = lastNodeInfo_; baseModel->lastNumberCuts_ = lastNumberCuts_; baseModel->lastCut_ = lastCut_; baseModel->lastNumberCuts2_ = lastNumberCuts2_; } int branchesLeft = 0; if (!retCode) { unlockThread(); int i ; const double * lower = getColLower() ; const double * upper = getColUpper() ; for (i = 0 ; i < numberColumns ; i++) { lowerBefore[i] = lower[i] ; upperBefore[i] = upper[i] ; } if ((solverCharacteristics_->extraCharacteristics()&2) != 0) { solverCharacteristics_->setBeforeLower(lowerBefore); solverCharacteristics_->setBeforeUpper(upperBefore); } lockThread(); assert (node->objectiveValue() < 1.0e200); if (messageHandler()->logLevel() > 2) node->modifiableBranchingObject()->print(); if (branchingMethod_ && branchingMethod_->chooseMethod()) { branchesLeft = node->branch(solver_); // new way } else { // old way so need to cheat OsiBranchingObject * branch2 = node->modifiableBranchingObject(); #ifndef NDEBUG CbcBranchingObject * branch = dynamic_cast (branch2) ; assert (branch); #else CbcBranchingObject * branch = static_cast (branch2) ; #endif #if 1 branch->setModel(this); branchesLeft = node->branch(NULL); // old way #else branchesLeft = node->branch(solver_); #endif if (parallelMode() >= 0) branch->setModel(baseModel); } assert (branchesLeft == node->nodeInfo()->numberBranchesLeft()); if (parallelMode() > 0) { assert(masterThread_); assert (node->nodeInfo()); node->nodeInfo()->increment() ; unlockThread(); } if ((specialOptions_&1) != 0) { /* This doesn't work as intended --- getRowCutDebugger will return null unless the current feasible solution region includes the optimal solution that RowCutDebugger knows. There's no way to tell inactive from off the optimal path. */ const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ; if (debugger) { onOptimalPath = true; printf("On optimal path\n") ; } } /* Reoptimize, possibly generating cuts and/or using heuristics to find solutions. Cut reference counts are unaffected unless we lose feasibility, in which case solveWithCuts() will make the adjustment. */ phase_ = 2; OsiCuts cuts ; int saveNumber = numberIterations_; if (solverCharacteristics_->solutionAddsCuts()) { int returnCode = resolve(node ? node->nodeInfo() : NULL, 1); feasible = returnCode != 0; if (feasible) { int iObject ; int numberUnsatisfied = 0 ; memcpy(currentSolution_, solver_->getColSolution(), numberColumns*sizeof(double)) ; // point to useful information OsiBranchingInformation usefulInfo = usefulInformation(); for (iObject = 0 ; iObject < numberObjects_ ; iObject++) { double infeasibility = object_[iObject]->checkInfeasibility(&usefulInfo) ; if (infeasibility ) numberUnsatisfied++ ; } if (returnCode > 0) { if (numberUnsatisfied) { feasible = solveWithCuts(cuts, maximumCutPasses_, node); } else { // may generate cuts and turn the solution //to an infeasible one feasible = solveWithCuts(cuts, 1, node); } } // check extra info on feasibility if (!solverCharacteristics_->mipFeasible()) { feasible = false; solverCharacteristics_->setMipBound(-COIN_DBL_MAX); } } } else { // normal if (false) { const double * lower = solver_->getColLower(); const double * upper = solver_->getColUpper(); printf("STATE before solve\n"); for (int i = 0; i < 100; i++) if (lower[i] || !upper[i]) printf("%d fixed to %g\n", i, lower[i]); } #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if ((clpSolver || (specialOptions_&16384) != 0) && fastNodeDepth_ < -1 && (specialOptions_&2048) == 0) { #define FATHOM_BIAS -2 if (numberNodes_ == 1) { int numberNodesBeforeFathom = 500; if (fastNodeDepth_ < -1000001) { numberNodesBeforeFathom = (-fastNodeDepth_) / 1000000; numberNodesBeforeFathom = 250 * numberNodesBeforeFathom; } #ifdef COIN_DEVELOP int fastNodeDepth1 = -fastNodeDepth_ % 1000000; printf("initial depth %d after %d nodes\n", FATHOM_BIAS + fastNodeDepth1, numberNodesBeforeFathom); #endif } //#endif ClpNodeStuff stuff; ClpNodeStuff * info = &stuff; /* Used to generate bound edits for CbcPartialNodeInfo. */ //double * lowerBefore = NULL; //double * upperBefore = NULL; int fastNodeDepth1 = -fastNodeDepth_ % 1000000; int numberNodesBeforeFathom = 500; if (fastNodeDepth_ < -1000001) { numberNodesBeforeFathom = (-fastNodeDepth_) / 1000000; numberNodesBeforeFathom = 100 * numberNodesBeforeFathom; } int go_fathom = FATHOM_BIAS + fastNodeDepth1; if ((specialOptions_&16384) != 0) numberNodesBeforeFathom = 0; if (node->depth() >= go_fathom && (specialOptions_&2048) == 0 //if (node->depth()>=FATHOM_BIAS-fastNodeDepth_&&!parentModel_ && numberNodes_ >= numberNodesBeforeFathom && !hotstartSolution_) { #ifndef COIN_HAS_CPX specialOptions_ &= ~16384; #endif if ((specialOptions_&16384) == 0) { info->integerTolerance_ = getIntegerTolerance(); info->integerIncrement_ = getCutoffIncrement(); info->numberBeforeTrust_ = numberBeforeTrust_; info->stateOfSearch_ = 1; if (numberSolutions_ > 0) { info->stateOfSearch_ = 3; } if (numberNodes_ > 2*numberObjects_ + 1000) { info->stateOfSearch_ = 4; } // Compute "small" change in branch int nBranches = intParam_[CbcNumberBranches]; if (nBranches) { double average = dblParam_[CbcSumChange] / static_cast(nBranches); info->smallChange_ = CoinMax(average * 1.0e-5, dblParam_[CbcSmallestChange]); info->smallChange_ = CoinMax(info->smallChange_, 1.0e-8); } else { info->smallChange_ = 1.0e-8; } double * down = new double[numberIntegers_]; double * up = new double[numberIntegers_]; int * priority = new int[numberIntegers_]; int * numberDown = new int[numberIntegers_]; int * numberUp = new int[numberIntegers_]; int * numberDownInfeasible = new int[numberIntegers_]; int * numberUpInfeasible = new int[numberIntegers_]; fillPseudoCosts(down, up, priority, numberDown, numberUp, numberDownInfeasible, numberUpInfeasible); // See if all priorities same bool allSame = true; int kPriority = priority[0]; for (int i = 1; i < numberIntegers_; i++) { if (kPriority != priority[i]) { allSame = false; break; } } ClpSimplex * simplex = clpSolver->getModelPtr(); if (allSame && false) { // change priorities on general const double * lower = simplex->columnLower(); const double * upper = simplex->columnUpper(); for (int i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable_[i]; if (upper[iColumn] > lower[iColumn] + 1.1) priority[i] = kPriority + 1; } } info->fillPseudoCosts(down, up, priority, numberDown, numberUp, numberDownInfeasible, numberUpInfeasible, numberIntegers_); info->presolveType_ = 1; // for reduced costs and duals info->solverOptions_ |= 7; delete [] down; delete [] up; delete [] numberDown; delete [] priority; delete [] numberUp; delete [] numberDownInfeasible; delete [] numberUpInfeasible; bool takeHint; OsiHintStrength strength; solver_->getHintParam(OsiDoReducePrint, takeHint, strength); //printf("mod cutoff %g solver %g offset %g\n", // getCutoff(),simplex->dualObjectiveLimit(),simplex->objectiveOffset()); int saveLevel = simplex->logLevel(); if (strength != OsiHintIgnore && takeHint && saveLevel == 1) simplex->setLogLevel(0); clpSolver->setBasis(); int perturbation = simplex->perturbation(); if ((specialOptions_&131072) != 0) { //assert (perturbation == 100); simplex->setPerturbation(50); } int saveMoreOptions = simplex->moreSpecialOptions(); int flags = (moreSpecialOptions_>>18)&3; simplex->setMoreSpecialOptions(saveMoreOptions|flags<<11); #ifndef NO_FATHOM_PRINT info->startingDepth_ = node->depth(); info->nodeCalled_ = numberNodes_; info->handler_ = handler_; #endif feasible = simplex->fathom(info) != 0; simplex->setMoreSpecialOptions(saveMoreOptions); simplex->setPerturbation(perturbation); incrementExtra(info->numberNodesExplored_, info->numberIterations_); char general[200]; int fathomStatus=info->nNodes_; if (feasible) fathomStatus=1; sprintf(general, "fathom took %d nodes, %d iterations - status %d", info->numberNodesExplored_, info->numberIterations_,fathomStatus); messageHandler()->message(CBC_FPUMP2, messages()) << general << CoinMessageEol ; if (info->numberNodesExplored_ > 10000 /* && !feasible */ && (moreSpecialOptions_&524288) == 0 && info->nNodes_>=0) { fastNodeDepth_ --; #ifndef NO_FATHOM_PRINT if ((moreSpecialOptions_&262144) != 0) handler_->message(CBC_FATHOM_CHANGE, messages_) << FATHOM_BIAS - fastNodeDepth_ << CoinMessageEol ; #endif #if CBC_USEFUL_PRINTING>0 printf(">10000 - depth now %d so at depth >= %d\n", fastNodeDepth_, FATHOM_BIAS - fastNodeDepth_); #endif } if (info->nNodes_ < 0) { // we gave up //abort(); fastNodeDepth_ -= (info->nNodes_==-10) ? 5 : 2; #ifndef NO_FATHOM_PRINT if ((moreSpecialOptions_&262144) != 0) handler_->message(CBC_FATHOM_CHANGE, messages_) << FATHOM_BIAS - fastNodeDepth_ << CoinMessageEol ; #endif #if CBC_USEFUL_PRINTING>0 printf("gave up fastNodeDepth now %d - so at depth >= %d\n", fastNodeDepth_, FATHOM_BIAS - fastNodeDepth_); #endif if (feasible) { // Save bounds round bestSolution //double * saveLower = CoinCopyOfArray(solver_->getColLower(), // numberColumns); //double * saveUpper = CoinCopyOfArray(solver_->getColUpper(), // numberColumns); clpSolver->setWarmStart(NULL); // try and do solution double value = simplex->objectiveValue(); double * newSolution = CoinCopyOfArray(simplex->primalColumnSolution(), numberColumns); setBestSolution(CBC_STRONGSOL, value, newSolution) ; delete [] newSolution; //solver_->setColLower(saveLower); //solver_->setColUpper(saveUpper); //delete [] saveLower; //delete [] saveUpper; } // say feasible so will redo node feasible = true; } else { if (feasible) { clpSolver->setWarmStart(NULL); // try and do solution double value = simplex->objectiveValue(); double * newSolution = CoinCopyOfArray(simplex->primalColumnSolution(), numberColumns); setBestSolution(CBC_STRONGSOL, value, newSolution) ; // in case of inaccuracy simplex->setObjectiveValue(CoinMax(bestObjective_, simplex->objectiveValue())); delete [] newSolution; } // update pseudo costs double smallest = 1.0e50; double largest = -1.0; for (int i = 0; i < numberIntegers_; i++) { CbcSimpleIntegerDynamicPseudoCost * obj = dynamic_cast (object_[i]) ; if (!obj) continue; assert (obj->columnNumber() == integerVariable_[i]); if (info->numberUp_[i] > 0) { if (info->downPseudo_[i] > largest) largest = info->downPseudo_[i]; if (info->downPseudo_[i] < smallest) smallest = info->downPseudo_[i]; if (info->upPseudo_[i] > largest) largest = info->upPseudo_[i]; if (info->upPseudo_[i] < smallest) smallest = info->upPseudo_[i]; obj->updateAfterMini(info->numberDown_[i], info->numberDownInfeasible_[i], info->downPseudo_[i], info->numberUp_[i], info->numberUpInfeasible_[i], info->upPseudo_[i]); } } //printf("range of costs %g to %g\n",smallest,largest); } simplex->setLogLevel(saveLevel); #ifdef COIN_HAS_CPX } else { // try cplex OsiCpxSolverInterface cpxSolver; double direction = clpSolver->getObjSense(); cpxSolver.setObjSense(direction); // load up cplex const CoinPackedMatrix * matrix = clpSolver->getMatrixByCol(); const double * rowLower = clpSolver->getRowLower(); const double * rowUpper = clpSolver->getRowUpper(); const double * columnLower = clpSolver->getColLower(); const double * columnUpper = clpSolver->getColUpper(); const double * objective = clpSolver->getObjCoefficients(); cpxSolver.loadProblem(*matrix, columnLower, columnUpper, objective, rowLower, rowUpper); double * setSol = new double [numberIntegers_]; int * setVar = new int [numberIntegers_]; // cplex doesn't know about objective offset double offset = clpSolver->getModelPtr()->objectiveOffset(); for (int i = 0; i < numberIntegers_; i++) { int iColumn = integerVariable_[i]; cpxSolver.setInteger(iColumn); if (bestSolution_) { setSol[i] = bestSolution_[iColumn]; setVar[i] = iColumn; } } CPXENVptr env = cpxSolver.getEnvironmentPtr(); CPXLPptr lpPtr = cpxSolver.getLpPtr(OsiCpxSolverInterface::KEEPCACHED_ALL); cpxSolver.switchToMIP(); if (bestSolution_) { CPXcopymipstart(env, lpPtr, numberIntegers_, setVar, setSol); } if (getCutoff() < 1.0e50) { double useCutoff = getCutoff() + offset; if (bestObjective_ < 1.0e50) useCutoff = bestObjective_ + offset + 1.0e-7; cpxSolver.setDblParam(OsiDualObjectiveLimit, useCutoff* direction); if ( direction > 0.0 ) CPXsetdblparam( env, CPX_PARAM_CUTUP, useCutoff ) ; // min else CPXsetdblparam( env, CPX_PARAM_CUTLO, useCutoff ) ; // max } CPXsetdblparam(env, CPX_PARAM_EPGAP, dblParam_[CbcAllowableFractionGap]); delete [] setSol; delete [] setVar; if (offset) { char printBuffer[200]; sprintf(printBuffer, "Add %g to all Cplex messages for true objective", -offset); messageHandler()->message(CBC_GENERAL, messages()) << printBuffer << CoinMessageEol ; cpxSolver.setDblParam(OsiObjOffset, offset); } cpxSolver.branchAndBound(); numberExtraNodes_ += CPXgetnodecnt(env, lpPtr); numberExtraIterations_ += CPXgetmipitcnt(env, lpPtr); double value = cpxSolver.getObjValue() * direction; if (cpxSolver.isProvenOptimal() && value <= getCutoff()) { feasible = true; clpSolver->setWarmStart(NULL); // try and do solution double * newSolution = CoinCopyOfArray(cpxSolver.getColSolution(), getNumCols()); setBestSolution(CBC_STRONGSOL, value, newSolution) ; delete [] newSolution; } #endif } } } if (feasible) { //int numberPasses = doCutsNow(1) ? maximumCutPasses_ : 0; int numberPasses = /*doCutsNow(1) ?*/ maximumCutPasses_ /*: 0*/; feasible = solveWithCuts(cuts, numberPasses, node); } #else feasible = solveWithCuts(cuts, maximumCutPasses_, node); #endif } if ((specialOptions_&1) != 0 && onOptimalPath) { if(solver_->getRowCutDebuggerAlways()->optimalValue()getRowCutDebugger() || !feasible) { // dj fix did something??? solver_->writeMpsNative("infeas2.mps", NULL, NULL, 2); solver_->getRowCutDebuggerAlways()->printOptimalSolution(*solver_); #ifndef NDEBUG const OsiRowCutDebugger * debugger = solver_->getRowCutDebugger() ; #endif assert (debugger) ; int numberRows0=continuousSolver_->getNumRows(); int numberRows=solver_->getNumRows(); const CoinPackedMatrix * rowCopy = solver_->getMatrixByRow(); const int * rowLength = rowCopy->getVectorLengths(); const double * elements = rowCopy->getElements(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * rowLower = solver_->getRowLower(); const double * rowUpper = solver_->getRowUpper(); for (int iRow=numberRows0;iRowinvalidCut(rc)); } assert (feasible); } } } if (statistics_) { assert (numberNodes2_); assert (statistics_[numberNodes2_-1]); assert (statistics_[numberNodes2_-1]->node() == numberNodes2_ - 1); statistics_[numberNodes2_-1]->endOfBranch(numberIterations_ - saveNumber, feasible ? solver_->getObjValue() : COIN_DBL_MAX); } /* Are we still feasible? If so, create a node and do the work to attach a branching object, reoptimising as needed if chooseBranch() identifies monotone objects. Finally, attach a partial nodeInfo object and store away any cuts that we created back in solveWithCuts. addCuts() will initialise the reference counts for these new cuts. This next test can be problematic if we've discovered an alternate equivalent answer and subsequently fathom the solution known to the row cut debugger due to bounds. */ if (onOptimalPath) { bool objLim = solver_->isDualObjectiveLimitReached() ; if (!feasible && !objLim) { if(solver_->getRowCutDebuggerAlways()->optimalValue()getRowCutDebuggerAlways()->printOptimalSolution(*solver_); solver_->writeMpsNative("infeas.mps", NULL, NULL, 2); CoinWarmStartBasis *slack = dynamic_cast(solver_->getEmptyWarmStart()) ; solver_->setWarmStart(slack); delete slack ; solver_->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ; solver_->initialSolve(); assert (!solver_->isProvenOptimal()); assert (feasible || objLim); } } } bool checkingNode = false; if (feasible) { #ifdef FUNNY_BRANCHING2 // Far too clever if ((numberThreads_ == -10 || true) && node->numberBranches() == 2) { // see if any parent branches redundant // Look at state of "node" CbcNodeInfo * nodeInfo = node->nodeInfo(); if (nodeInfo) { // See if any branched variables off bounds const double * dj = solver_->getReducedCost(); const double * lower = solver_->getColLower(); const double * upper = solver_->getColUpper(); const double * solution = solver_->getColSolution(); int numberColumns = solver_->getNumCols(); double * currentLower = CoinCopyOfArray(lower, numberColumns); double * currentUpper = CoinCopyOfArray(upper, numberColumns); char * touched = new char[numberColumns]; memset(touched, 0, numberColumns); double direction = solver_->getObjSense() ; bool canDelete = nodeInfo->numberBranchesLeft() > 0; //int numberBounds = nodeInfo->numberChangedBounds(); //const int * which = nodeInfo->variables(); //const double * bounds = nodeInfo->newBounds(); const OsiBranchingObject * obj = node->branchingObject(); const CbcIntegerBranchingObject * objectI = dynamic_cast (obj); if (objectI) { const CbcSimpleInteger * object1 = dynamic_cast (objectI->object()); int iColumn1 = -1; int way1 = 0; const double * bounds1 = NULL; bool zeroOne1 = false; if (object1) { iColumn1 = object1->columnNumber(); double originalLower1 = object1->originalLowerBound(); double originalUpper1 = object1->originalUpperBound(); // Unset all bounds from parents CbcPartialNodeInfo * partial = dynamic_cast(nodeInfo); touched[iColumn1] = 1; if (partial) { /* maybe don't do if obj hasn't changed as then you might get loop at present just 0-1 as need to know original bound */ int n = partial->numberChangedBounds(); const int * which = partial->variables(); const double * values = partial->newBounds(); for (int i = 0; i < n; i++) { int variable = which[i]; int k = variable & 0x3fffffff; assert (k != iColumn1); if (!touched[k]) { if ((variable&0x80000000) == 0) { // lower bound changing assert (currentLower[k] == 1.0); currentLower[k] = 0.0; } else { // upper bound changing assert (currentUpper[k] == 0.0); currentUpper[k] = 1.0; } } } } zeroOne1 = originalLower1 == 0.0 && originalUpper1 == 1.0; way1 = objectI->way(); assert (way1 == -1 || way1 == 1); int kWay = way1; //way1 = -way1; // what last branch did // work out using bounds if (objectI->downBounds()[1] >= upper[iColumn1] && objectI->downBounds()[0] <= lower[iColumn1]) way1 = -1; else way1 = 1; assert (kWay == -way1); if (way1 < 0) { // must have been down branch bounds1 = objectI->downBounds(); } else { // must have been up branch bounds1 = objectI->upBounds(); } // double check bounds assert (bounds1[0] <= lower[iColumn1] && bounds1[1] >= upper[iColumn1]); } bool inBetween = false; #ifdef CBC_PRINT2 printf("%d (way %d) with down bounds %g, %g and up bounds %g, %g current bounds %g, %g solution %g dj %g (bleft %d)\n", iColumn1, way1, objectI->downBounds()[0], objectI->downBounds()[1], objectI->upBounds()[0], objectI->upBounds()[1], lower[iColumn1], upper[iColumn1], solution[iColumn1], dj[iColumn1], nodeInfo->numberBranchesLeft()); #endif while (nodeInfo->parent()) { nodeInfo = nodeInfo->parent(); CbcNode * nodeLook = nodeInfo->mutableOwner(); if (!nodeLook || nodeLook->objectiveValue() == 0.5*COIN_DBL_MAX) continue; OsiBranchingObject * obj = nodeLook->modifiableBranchingObject(); CbcIntegerBranchingObject * objectI = dynamic_cast (obj); //const OsiObject * object2a = obj->originalObject(); //assert (object2a); const CbcSimpleInteger * object2 = dynamic_cast (objectI->object()); if (nodeInfo->numberBranchesLeft() && object2) { int iColumn2 = object2->columnNumber(); double originalLower = object2->originalLowerBound(); double originalUpper = object2->originalUpperBound(); bool zeroOne2 = originalLower == 0.0 && originalUpper == 1.0; zeroOne1 = true; // temp double newUpper = originalUpper; double newLower = originalLower; //double value = solution[iColumn2]; double djValue = dj[iColumn2] * direction; int way = objectI->way(); assert (way == -1 || way == 1); way = -way; // what last branch did #ifdef CBC_PRINT2 printf("%d (way %d) with down bounds %g, %g and up bounds %g, %g current bounds %g, %g solution %g dj %g (bleft %d)\n", iColumn2, way, objectI->downBounds()[0], objectI->downBounds()[1], objectI->upBounds()[0], objectI->upBounds()[1], lower[iColumn2], upper[iColumn2], solution[iColumn2], djValue, nodeInfo->numberBranchesLeft()); #endif /*if (objectI->downBounds()[0]==0&&objectI->downBounds()[1]==1&& objectI->upBounds()[0]==0&&objectI->upBounds()[1]==1) assert(lower[iColumn2]downBounds(); if (djValue > 1.0e-3 || solution[iColumn2] < upper[iColumn2] - 1.0e-5) { if (canDelete) { //nRedundantDown++; #ifndef JJF_ONE COIN_DETAIL_PRINT(printf("%d redundant branch down with bounds %g, %g current upper %g solution %g dj %g\n", iColumn2, bounds[0], bounds[1], upper[iColumn2], solution[iColumn2], djValue)); #endif if (bounds[0] == bounds[1] || zeroOne2 || (bounds[0] == lower[iColumn2] && false)) { { // get rid of node as far as branching nodeLook->setObjectiveValue(0.5*COIN_DBL_MAX); objectI->deactivate(); } previousBounds(node, nodeInfo, iColumn2, newLower, newUpper, 2); solver_->setColUpper(iColumn2, newUpper); assert (newLower == lower[iColumn2]); } else { COIN_DETAIL_PRINT(printf("SKipping\n")); } } else if (iColumn1 >= 0 && iColumn1 != iColumn2 && (!inBetween || true) && zeroOne1 && zeroOne2 && false) { #ifndef JJF_ONE if (true) { // add in bounds newLower = bounds1[0]; newUpper = bounds1[1]; COIN_DETAIL_PRINT(printf("setting bounds of %g and %g (column %d) on other branch for column %d\n", newLower, newUpper, iColumn1, iColumn2)); int infeasible = objectI->applyExtraBounds(iColumn1, newLower, newUpper, objectI->way()); if (infeasible) { COIN_DETAIL_PRINT(printf("infeasa!\n")); // get rid of node as far as branching nodeLook->setObjectiveValue(0.5*COIN_DBL_MAX); } } #endif } //break; } else { inBetween = true; } } else { // must have been up branch const double * bounds = objectI->upBounds(); if (djValue < -1.0e-3 || solution[iColumn2] > lower[iColumn2] + 1.0e-5) { if (canDelete) { //nRedundantUp++; #ifndef JJF_ONE COIN_DETAIL_PRINT(printf("%d redundant branch up with bounds %g, %g current lower %g solution %g dj %g\n", iColumn2, bounds[0], bounds[1], lower[iColumn2], solution[iColumn2], djValue)); #endif if (bounds[0] == bounds[1] || zeroOne2 || (bounds[1] == upper[iColumn2] && false)) { { // get rid of node as far as branching nodeLook->setObjectiveValue(0.5*COIN_DBL_MAX); objectI->deactivate(); } previousBounds(node, nodeInfo, iColumn2, newLower, newUpper, 1); solver_->setColLower(iColumn2, newLower); assert (newUpper == upper[iColumn2]); } else { COIN_DETAIL_PRINT(printf("SKipping\n")); } } else if (iColumn1 >= 0 && iColumn1 != iColumn2 && (!inBetween || true) && zeroOne1 && zeroOne2 && false) { #ifndef JJF_ONE // add in bounds newLower = bounds1[0]; newUpper = bounds1[1]; COIN_DETAIL_PRINT(printf("setting bounds of %g and %g (column %d) on other branch for column %d\n", newLower, newUpper, iColumn1, iColumn2)); int infeasible = objectI->applyExtraBounds(iColumn1, newLower, newUpper, objectI->way()); if (infeasible) { COIN_DETAIL_PRINT(printf("infeasb!\n")); // get rid of node as far as branching nodeLook->setObjectiveValue(0.5*COIN_DBL_MAX); } #endif } // break; } else { inBetween = true; } } } else { // odd break; } } } delete [] currentLower; delete [] currentUpper; } } #endif if (parallelMode() >= 0) newNode = new CbcNode() ; #if 0 // Try diving if (parallelMode() >= 0 && (specialOptions_&2048) == 0) { // See if any diving heuristics set to do dive+save CbcHeuristicDive * dive=NULL; for (int i = 0; i < numberHeuristics_; i++) { CbcHeuristicDive * possible = dynamic_cast(heuristic_[i]); if (possible&&possible->maxSimplexIterations()==COIN_INT_MAX) { // if more than one then rotate later? //if (possible->canHeuristicRun()) { if (node->depth()==0||node->depth()==5) { dive=possible; break; } } } if (dive) { int numberNodes; CbcSubProblem ** nodes=NULL; int branchState=dive->fathom(this,numberNodes,nodes); if (branchState) { printf("new solution\n"); } if (0) { for (int iNode=0;iNodepush(nodes[iNode]) ; } assert (node->nodeInfo()); if (node->nodeInfo()->numberBranchesLeft()) { tree_->push(node) ; } else { node->setActive(false); } } delete [] nodes; } } // end try diving #endif // Set objective value (not so obvious if NLP etc) setObjectiveValue(newNode, node); int anyAction = -1 ; bool resolved = false ; if (newNode->objectiveValue() >= getCutoff()) { anyAction = -2; } else {// only allow at most a few passes int numberPassesLeft = 5; checkingNode = true; OsiSolverBranch * branches = NULL; // point to useful information anyAction = chooseBranch(newNode, numberPassesLeft, node, cuts, resolved, lastws, lowerBefore, upperBefore, branches); } /* If we end up infeasible, we can delete the new node immediately. Since this node won't be needing the cuts we collected, decrement the reference counts. If we are feasible, then we'll be placing this node into the live set, so increment the reference count in the current (parent) nodeInfo. */ lockThread(); if (anyAction == -2) { if (parallelMode() > 0) { assert (masterThread_); assert (node->nodeInfo()); node->nodeInfo()->decrement() ; delete newNode ; assert (node->nodeInfo()); node->nodeInfo()->increment() ; newNode = NULL ; } else if (parallelMode() == 0) { delete newNode ; newNode = NULL ; } else { //assert (newNode->active()); newNode->setActive(false); } // say strong doing well if (checkingNode) setSpecialOptions(specialOptions_ | 8); for (i = 0 ; i < currentNumberCuts_ ; i++) { if (addedCuts_[i]) { if (!addedCuts_[i]->decrement(1)) { delete addedCuts_[i] ; } addedCuts_[i] = NULL; //} } } } else { assert (node->nodeInfo()); if (parallelMode() >= 0) node->nodeInfo()->increment() ; if ((numberNodes_ % 20) == 0) { // say strong not doing as well setSpecialOptions(specialOptions_&~8); } } unlockThread(); } /* At this point, there are three possibilities: * newNode is live and will require further branching to resolve (variable() >= 0). Increment the cut reference counts by numberBranches() to allow for use by children of this node, and decrement by 1 because we've executed one arm of the branch of our parent (consuming one reference). Before we push newNode onto the search tree, try for a heuristic solution. * We have a solution, in which case newNode is non-null but we have no branching variable. Decrement the cut counts and save the solution. * The node was found to be infeasible, in which case it's already been deleted, and newNode is null. */ if (eventHandler_ && !eventHandler_->event(CbcEventHandler::node)) { eventHappened_ = true; // exit } if (parallelMode() >= 0) assert (!newNode || newNode->objectiveValue() <= getCutoff()) ; else assert (!newNode->active() || newNode->objectiveValue() <= getCutoff()) ; if (statistics_) { assert (numberNodes2_); assert (statistics_[numberNodes2_-1]); assert (statistics_[numberNodes2_-1]->node() == numberNodes2_ - 1); if (newNode && newNode->active()) statistics_[numberNodes2_-1]->updateInfeasibility(newNode->numberUnsatisfied()); else statistics_[numberNodes2_-1]->sayInfeasible(); } lockThread(); bool locked = true; if (parallelMode() <= 0) { if (numberUpdateItems_) { for (i = 0; i < numberUpdateItems_; i++) { CbcObjectUpdateData * update = updateItems_ + i; CbcObject * object = dynamic_cast (update->object_); #ifndef NDEBUG bool found = false; for (int j = 0; j < numberObjects_; j++) { if (update->object_ == object_[j]) { found = true; break; } } assert (found); #endif //if (object) //assert (object==object_[update->objectNumber_]); if (object) object->updateInformation(*update); } numberUpdateItems_ = 0; } } if (newNode) if (newNode && newNode->active()) { if (newNode->branchingObject() == NULL) { const double * solution = solver_->getColSolution(); CbcEventHandler::CbcAction action = dealWithEventHandler(CbcEventHandler::beforeSolution1, getSolverObjValue(), solution); if (action == CbcEventHandler::addCuts || solverCharacteristics_->solverType() == 4) { // need to check if any cuts would do anything OsiCuts theseCuts; // reset probing info //if (probingInfo_) //probingInfo_->initializeFixing(solver_); for (int i = 0; i < numberCutGenerators_; i++) { bool generate = generator_[i]->normal(); // skip if not optimal and should be (maybe a cut generator has fixed variables) if (generator_[i]->needsOptimalBasis() && !solver_->basisIsAvailable()) generate = false; if (!generator_[i]->mustCallAgain()) generate = false; // only special cuts if (generate) { generator_[i]->generateCuts(theseCuts, -1, solver_, NULL) ; int numberRowCutsAfter = theseCuts.sizeRowCuts() ; if (numberRowCutsAfter) break; } } int numberRowCutsAfter = theseCuts.sizeRowCuts() ; if (numberRowCutsAfter || action == CbcEventHandler::addCuts) { // need dummy branch newNode->setBranchingObject(new CbcDummyBranchingObject(this)); newNode->nodeInfo()->initializeInfo(1); } } } if (newNode->branchingObject()) { handler_->message(CBC_BRANCH, messages_) << numberNodes_ << newNode->objectiveValue() << newNode->numberUnsatisfied() << newNode->depth() << CoinMessageEol ; // Increment cut counts (taking off current) int numberLeft = newNode->numberBranches() ; for (i = 0; i < currentNumberCuts_; i++) { if (addedCuts_[i]) { # ifdef CHECK_CUT_COUNTS printf("Count on cut %x increased by %d\n", addedCuts_[i], numberLeft - 1) ; # endif addedCuts_[i]->increment(numberLeft - 1) ; } } unlockThread(); locked = false; double estValue = newNode->guessedObjectiveValue() ; int found = -1 ; double * newSolution = new double [numberColumns] ; double heurValue = getCutoff() ; int iHeur ; int whereFrom = 3; // allow more heuristics currentPassNumber_=0; for (iHeur = 0 ; iHeur < numberHeuristics_ ; iHeur++) { // skip if can't run here if (!heuristic_[iHeur]->shouldHeurRun(whereFrom)) continue; double saveValue = heurValue ; int ifSol = heuristic_[iHeur]->solution(heurValue, newSolution) ; if (ifSol > 0) { // new solution found heuristic_[iHeur]->incrementNumberSolutionsFound(); found = iHeur ; if (parallelMode() > 0) { lockThread(); baseModel->incrementUsed(newSolution); unlockThread(); } else { lastHeuristic_ = heuristic_[found]; #ifdef HEURISTIC_INFORM printf("HEUR %s where %d D\n", lastHeuristic_->heuristicName(), whereFrom); #endif setBestSolution(CBC_ROUNDING, heurValue, newSolution) ; foundSolution = 1; whereFrom |= 8; // say solution found } } else if (ifSol < 0) { // just returning an estimate estValue = heurValue; //CoinMin(heurValue, estValue) ; heurValue = saveValue ; } } if (found >= 0 && parallelMode() > 0) { lastHeuristic_ = heuristic_[found]; #if CBC_USEFUL_PRINTING>1 printf("HEUR %s where %d D\n", lastHeuristic_->heuristicName(), whereFrom); #endif setBestSolution(CBC_ROUNDING, heurValue, newSolution) ; foundSolution = 1; } delete [] newSolution ; newNode->setGuessedObjectiveValue(estValue) ; if (parallelMode() >= 0) { if (!masterThread_) // only if serial tree_->push(newNode) ; } if (statistics_) { if (numberNodes2_ == maximumStatistics_) { maximumStatistics_ = 2 * maximumStatistics_; CbcStatistics ** temp = new CbcStatistics * [maximumStatistics_]; memset(temp, 0, maximumStatistics_*sizeof(CbcStatistics *)); memcpy(temp, statistics_, numberNodes2_*sizeof(CbcStatistics *)); delete [] statistics_; statistics_ = temp; } assert (!statistics_[numberNodes2_]); statistics_[numberNodes2_] = new CbcStatistics(newNode, this); } numberNodes2_++; # ifdef CHECK_NODE printf("Node %x pushed on tree c\n", newNode) ; # endif } else { if (solverCharacteristics_ && //we may be in a non standard bab solverCharacteristics_->solutionAddsCuts()// we are in some kind of OA based bab. ) { std::cerr << "You should never get here" << std::endl; throw CoinError("Nodes should not be fathomed on integer infeasibility in this setting", "branchAndBound", "CbcModel") ; } for (i = 0 ; i < currentNumberCuts_ ; i++) { if (addedCuts_[i]) { if (!addedCuts_[i]->decrement(1)) { delete addedCuts_[i] ; addedCuts_[i] = NULL; } } } double objectiveValue = newNode->objectiveValue(); lastHeuristic_ = NULL; // Just possible solver did not know about a solution from another thread! if (objectiveValue < getCutoff()) { incrementUsed(solver_->getColSolution()); setBestSolution(CBC_SOLUTION, objectiveValue, solver_->getColSolution()) ; // Check if was found if (bestObjective_ < getCutoff()) foundSolution = 1; } //assert(nodeInfo->numberPointingToThis() <= 2) ; if (parallelMode() >= 0) { // avoid accidental pruning, if newNode was final branch arm node->nodeInfo()->increment(); delete newNode ; newNode = NULL; node->nodeInfo()->decrement() ; } else { newNode->setActive(false); } } } if (branchesLeft) { // set nodenumber correctly if (node->nodeInfo()) node->nodeInfo()->setNodeNumber(numberNodes2_); if (parallelMode() >= 0) { if (!masterThread_) // only if serial tree_->push(node) ; } if (statistics_) { if (numberNodes2_ == maximumStatistics_) { maximumStatistics_ = 2 * maximumStatistics_; CbcStatistics ** temp = new CbcStatistics * [maximumStatistics_]; memset(temp, 0, maximumStatistics_*sizeof(CbcStatistics *)); memcpy(temp, statistics_, numberNodes2_*sizeof(CbcStatistics *)); delete [] statistics_; statistics_ = temp; } assert (!statistics_[numberNodes2_]); statistics_[numberNodes2_] = new CbcStatistics(node, this); } numberNodes2_++; //nodeOnTree=true; // back on tree //deleteNode = false ; # ifdef CHECK_NODE printf("Node %x pushed back on tree - %d left, %d count\n", node, node->nodeInfo()->numberBranchesLeft(), node->nodeInfo()->numberPointingToThis()) ; # endif if (parallelMode() > 0) { assert (node->nodeInfo()); node->nodeInfo()->decrement() ; } } else { /* This node has been completely expanded and can be removed from the live set. */ if (parallelMode() > 0) { assert (masterThread_) ; assert (node->nodeInfo()); node->nodeInfo()->decrement() ; } assert (node->nodeInfo()); if (parallelMode() >= 0) { if (!node->nodeInfo()->numberBranchesLeft()) node->nodeInfo()->allBranchesGone(); // can clean up delete node ; node = NULL; } else { node->setActive(false); } } if (locked) unlockThread(); } else { // add cuts found to be infeasible (on bound)! COIN_DETAIL_PRINT(printf("found to be infeas! - branches left %d - cutoff %g\n", node->nodeInfo()->numberBranchesLeft(), getCutoff())); #ifdef COIN_DETAIL node->print(); #endif //abort(); assert (node->nodeInfo()); if (parallelMode() >= 0) { if (!node->nodeInfo()->numberBranchesLeft()) node->nodeInfo()->allBranchesGone(); // can clean up delete node; node = NULL; } else { node->setActive(false); } } /* Delete cuts to get back to the original system. I'm thinking this is redundant --- the call to addCuts that conditions entry to this code block also performs this action. */ #ifndef JJF_ONE //if (numberThreads_) { int numberToDelete = getNumRows() - numberRowsAtContinuous_ ; if (numberToDelete) { int * delRows = new int[numberToDelete] ; int i ; for (i = 0 ; i < numberToDelete ; i++) delRows[i] = i + numberRowsAtContinuous_ ; solver_->deleteRows(numberToDelete, delRows) ; delete [] delRows ; } numberNewCuts_=0; } #endif delete lastws ; delete [] lowerBefore ; delete [] upperBefore ; if (bestObjective > bestObjective_) foundSolution = 2; if (parallelMode() > 0 && foundSolution) { lockThread(); // might as well mark all including continuous int numberColumns = solver_->getNumCols(); for (int i = 0; i < numberColumns; i++) { baseModel->usedInSolution_[i] += usedInSolution_[i]; usedInSolution_[i] = 0; } if (bestObjective_ < baseModel->bestObjective_ && bestObjective_ < baseModel->getCutoff()) { baseModel->bestObjective_ = bestObjective_ ; int numberColumns = solver_->getNumCols(); if (!baseModel->bestSolution_) baseModel->bestSolution_ = new double[numberColumns]; CoinCopyN(bestSolution_, numberColumns, baseModel->bestSolution_); baseModel->setCutoff(getCutoff()); baseModel->handler_->message(CBC_ROUNDING, messages_) << bestObjective_ << "heuristic" << baseModel->numberIterations_ << baseModel->numberNodes_ << getCurrentSeconds() << CoinMessageEol; } baseModel->numberSolutions_++; unlockThread(); } numberCutGenerators_=saveNumberCutGenerators; return foundSolution; } // Adds an update information object void CbcModel::addUpdateInformation(const CbcObjectUpdateData & data) { if (numberUpdateItems_ == maximumNumberUpdateItems_) { maximumNumberUpdateItems_ += 10; CbcObjectUpdateData * temp = new CbcObjectUpdateData [maximumNumberUpdateItems_]; for (int i = 0; i < maximumNumberUpdateItems_ - 10; i++) temp[i] = updateItems_[i]; delete [] updateItems_; updateItems_ = temp; } updateItems_[numberUpdateItems_++] = data; } // Returns bounds just before where - initially original bounds - also sets bounds void CbcModel::previousBounds (CbcNode * node, CbcNodeInfo * where, int iColumn, double & lower, double & upper, int force) { int i; int nNode = 0; CbcNodeInfo * nodeInfo = node->nodeInfo(); int nWhere = -1; /* Accumulate the path from node to the root in walkback_ */ while (nodeInfo) { //printf("nNode = %d, nodeInfo = %x\n",nNode,nodeInfo); walkback_[nNode++] = nodeInfo; nodeInfo = nodeInfo->parent() ; if (nNode == maximumDepth_) { redoWalkBack(); } if (nodeInfo == where) nWhere = nNode; } assert (nWhere >= 0); nWhere = nNode - nWhere; for (i = 0; i < nWhere; i++) { --nNode; walkback_[nNode]->applyBounds(iColumn, lower, upper, 0); } // correct bounds walkback_[nNode]->applyBounds(iColumn, lower, upper, 3); CbcNode * nodeLook = walkback_[nNode]->mutableOwner(); if (nodeLook) { OsiBranchingObject * obj = nodeLook->modifiableBranchingObject(); CbcIntegerBranchingObject * objectI = dynamic_cast (obj); //const OsiObject * object2 = obj->orig #ifndef NDEBUG const CbcSimpleInteger * object2 = dynamic_cast (objectI->object()); assert (object2); assert (iColumn == object2->columnNumber()); #endif double bounds[2]; bounds[0] = lower; bounds[1] = upper; objectI->setDownBounds(bounds); objectI->setUpBounds(bounds); } while (nNode) { --nNode; walkback_[nNode]->applyBounds(iColumn, lower, upper, force); #ifdef JJF_ZERO CbcNode * nodeLook = walkback_[nNode]->mutableOwner(); if (nodeLook) { const OsiBranchingObject * obj = nodeLook->branchingObject(); const CbcIntegerBranchingObject * objectI = dynamic_cast (obj); //const OsiObject * object2 = obj->orig const CbcSimpleInteger * object2 = dynamic_cast (objectI->object()); assert (object2); int iColumn2 = object2->columnNumber(); assert (iColumn != iColumn2); } #endif } } /* Return pseudo costs If not all integers or not pseudo costs - returns all zero Length of arrays are numberIntegers() and entries correspond to integerVariable()[i] User must allocate arrays before call */ void CbcModel::fillPseudoCosts(double * downCosts, double * upCosts, int * priority, int * numberDown, int * numberUp, int * numberDownInfeasible, int * numberUpInfeasible) const { CoinFillN(downCosts, numberIntegers_, 1.0); CoinFillN(upCosts, numberIntegers_, 1.0); if (priority) { CoinFillN(priority, numberIntegers_, 1000000); } if (numberDown) { CoinFillN(numberDown, numberIntegers_, 1); CoinFillN(numberUp, numberIntegers_, 1); } if (numberDownInfeasible) { CoinZeroN(numberDownInfeasible, numberIntegers_); CoinZeroN(numberUpInfeasible, numberIntegers_); } int numberColumns = getNumCols(); int * back = new int[numberColumns]; int i; for (i = 0; i < numberColumns; i++) back[i] = -1; for (i = 0; i < numberIntegers_; i++) back[integerVariable_[i]] = i; #if CBC_USEFUL_PRINTING>1 int numberNot = 0; #endif for ( i = 0; i < numberObjects_; i++) { CbcSimpleIntegerDynamicPseudoCost * obj = dynamic_cast (object_[i]) ; if (!obj) continue; #if CBC_USEFUL_PRINTING>1 if (obj->numberTimesDown() < numberBeforeTrust_ || obj->numberTimesUp() < numberBeforeTrust_) numberNot++; #endif int iColumn = obj->columnNumber(); iColumn = back[iColumn]; assert (iColumn >= 0); if (priority) priority[iColumn] = obj->priority(); downCosts[iColumn] = obj->downDynamicPseudoCost(); upCosts[iColumn] = obj->upDynamicPseudoCost(); if (numberDown) { numberDown[iColumn] = obj->numberTimesDown(); numberUp[iColumn] = obj->numberTimesUp(); } if (numberDownInfeasible) { numberDownInfeasible[iColumn] = obj->numberTimesDownInfeasible(); numberUpInfeasible[iColumn] = obj->numberTimesUpInfeasible(); } } #if CBC_USEFUL_PRINTING>5 if (priority) printf("Before fathom %d not trusted out of %d\n", numberNot, numberIntegers_); #endif delete [] back; } // Redo walkback arrays void CbcModel::redoWalkBack() { int nNode = maximumDepth_; maximumDepth_ *= 2; CbcNodeInfo ** temp = new CbcNodeInfo * [maximumDepth_]; CbcNodeInfo ** temp2 = new CbcNodeInfo * [maximumDepth_]; int * temp3 = new int [maximumDepth_]; for (int i = 0; i < nNode; i++) { temp[i] = walkback_[i]; temp2[i] = lastNodeInfo_[i]; temp3[i] = lastNumberCuts_[i]; } delete [] walkback_; walkback_ = temp; delete [] lastNodeInfo_ ; lastNodeInfo_ = temp2; delete [] lastNumberCuts_ ; lastNumberCuts_ = temp3; } /* Return true if we want to do cuts If allowForTopOfTree zero then just does on multiples of depth if 1 then allows for doing at top of tree if 2 then says if cuts allowed anywhere apart from root if 3 then gives smallest valid depth >shallow */ bool CbcModel::doCutsNow(int allowForTopOfTree) const { int whenCutsUse = whenCuts_; int alwaysReturnAt10 = whenCutsUse % 100000; if (whenCutsUse > 0 && alwaysReturnAt10) { whenCutsUse -= alwaysReturnAt10; if (currentDepth_ > 10) return false; } //if (currentDepth_>10) //return false; #define TRY_IDEA1 2 int size = continuousSolver_->getNumRows() + continuousSolver_->getNumCols(); if (true && (whenCutsUse < 0 || (size <= 500 - 500*TRY_IDEA1 && allowForTopOfTree != 3))) { int whenCuts = (size <= 500) ? -1 : 1; //whenCuts = (size<=500) ? 1 :1; if (parentModel_) whenCuts = 1; //int nodeDepth = currentDepth_-1; bool doCuts2 = !(currentDepth_ > 11 && (currentDepth_ & 1) == whenCuts); if (fastNodeDepth_ > 0 && currentDepth_ > 10) doCuts2 = false; //printf("when %d node %d depth %d size %d doing cuts %s\n",whenCutsUse, // numberNodes_,currentDepth_,size,doCuts2 ? "yes" : "no"); return doCuts2; } //if (!parentModel_&¤tDepth_==7) //printf("q\n"); int top = whenCutsUse / 1000000; int shallow = top ? (top - 1) : 9; int when = whenCutsUse - 1000000 * top; #if TRY_IDEA1 if (when<15 && when>1 && size <= 500) when /= 2; #endif if ((when > 15 || (top && top < 5)) && currentDepth_ > when) when = 100000; // off bool doCuts = when ? ((currentDepth_ % when) == 0) || (when == 1) : false; if (allowForTopOfTree == 1 && currentDepth_ <= shallow) { doCuts = true; } else if (allowForTopOfTree == 2 && shallow >= 1) { doCuts = true; #if TRY_IDEA1<2 } else if (allowForTopOfTree == 3 && doCuts) { // only if first if (currentDepth_ <= shallow || currentDepth_ - when > shallow) doCuts = false; #else } else if (allowForTopOfTree == 3) { // only exactly at 10 doCuts = (currentDepth_ == 10); #endif } //if (!doCuts&¤tDepth_&&!parentModel_) //printf("zzz\n"); return doCuts; } // See if can stop on gap bool CbcModel::canStopOnGap() const { bool returnCode=false; if (bestObjective_<1.0e50) { double testGap = CoinMax(dblParam_[CbcAllowableGap], CoinMax(fabs(bestObjective_), fabs(bestPossibleObjective_)) * dblParam_[CbcAllowableFractionGap]); returnCode = (bestObjective_ - bestPossibleObjective_ < testGap && getCutoffIncrement() >= 0.0); } #if 0 if (returnCode) { if (fabs(bestObjective_+1469650.0)<1.0) { fprintf(stderr,"BAD - cr to continue\n"); fflush(stdout); char xx; xx=getc(stdin); } } #endif return returnCode; } // Adjust heuristics based on model void CbcModel::adjustHeuristics() { int numberRows = solver_->getNumRows(); int numberColumns = solver_->getNumCols(); int nTree = CoinMax(10000, 2 * numberRows + numberColumns); int nRoot = CoinMax(40000, 8 * numberRows + 4 * numberColumns); for (int i = 0; i < numberHeuristics_; i++) { CbcHeuristicDive * heuristic = dynamic_cast (heuristic_[i]); if (heuristic && heuristic->maxSimplexIterations()!=COIN_INT_MAX) { heuristic->setMaxSimplexIterations(nTree); heuristic->setMaxSimplexIterationsAtRoot(nRoot); } } } // Number of saved solutions (including best) int CbcModel::numberSavedSolutions() const { if (!bestSolution_) return 0; else return numberSavedSolutions_ + 1; } // Set maximum number of extra saved solutions void CbcModel::setMaximumSavedSolutions(int value) { if (value < maximumSavedSolutions_) { for (int i = value; i < maximumSavedSolutions_; i++) delete [] savedSolutions_[i]; maximumSavedSolutions_ = value; numberSavedSolutions_ = CoinMin(numberSavedSolutions_, maximumSavedSolutions_); if (!maximumSavedSolutions_) delete [] savedSolutions_; } else if (value > maximumSavedSolutions_) { double ** temp = new double * [value]; int i; for ( i = 0; i < maximumSavedSolutions_; i++) temp[i] = savedSolutions_[i]; for ( ; i < value; i++) temp[i] = NULL; delete [] savedSolutions_; maximumSavedSolutions_ = value; savedSolutions_ = temp; } } // Return a saved solution objective (0==best) - COIN_DBL_MAX if off end double CbcModel::savedSolutionObjective(int which) const { if (which == 0) { return bestObjective_; } else if (which <= numberSavedSolutions_) { double * sol = savedSolutions_[which-1]; assert (static_cast(sol[0]) == solver_->getNumCols()); return sol[1]; } else { return COIN_DBL_MAX; } } // Return a saved solution (0==best) - NULL if off end const double * CbcModel::savedSolution(int which) const { if (which == 0) { return bestSolution_; } else if (which <= numberSavedSolutions_) { double * sol = savedSolutions_[which-1]; assert (static_cast(sol[0]) == solver_->getNumCols()); return sol + 2; } else { return NULL; } } // Save a solution void CbcModel::saveExtraSolution(const double * solution, double objectiveValue) { double * save = NULL; if (maximumSavedSolutions_) { if (!savedSolutions_) { savedSolutions_ = new double * [maximumSavedSolutions_]; for (int i = 0; i < maximumSavedSolutions_; i++) savedSolutions_[i] = NULL; } int n = solver_->getNumCols(); int k; for (k = numberSavedSolutions_ - 1; k >= 0; k--) { double * sol = savedSolutions_[k]; assert (static_cast(sol[0]) == n); if (objectiveValue > sol[1]) break; } k++; // where to put if (k < maximumSavedSolutions_) { if (numberSavedSolutions_ == maximumSavedSolutions_) { save = savedSolutions_[numberSavedSolutions_-1]; } else { save = new double [n+2]; numberSavedSolutions_++; } // move up for (int j = maximumSavedSolutions_ - 1; j > k; j--) savedSolutions_[j] = savedSolutions_[j-1]; savedSolutions_[k] = save; save[0] = n; save[1] = objectiveValue; memcpy(save + 2, solution, n*sizeof(double)); } } } // Save a solution to best and move current to saved void CbcModel::saveBestSolution(const double * solution, double objectiveValue) { int n = solver_->getNumCols(); if (bestSolution_) saveExtraSolution(bestSolution_, bestObjective_); else bestSolution_ = new double [n]; bestObjective_ = objectiveValue; memcpy(bestSolution_, solution, n*sizeof(double)); } // Delete best and saved solutions void CbcModel::deleteSolutions() { delete [] bestSolution_; bestSolution_ = NULL; for (int i = 0; i < maximumSavedSolutions_; i++) { delete [] savedSolutions_[i]; savedSolutions_[i] = NULL; } numberSavedSolutions_ = 0; } // Delete a saved solution and move others up void CbcModel::deleteSavedSolution(int which) { if (which >0 && which <= numberSavedSolutions_) { delete [] savedSolutions_[which-1]; // move up numberSavedSolutions_--; for (int j = which-1; j (solver_); if (clpSolver && numberNodes_ >= numberNodes && numberNodes_ < 2*numberNodes && clpSolver->getNumRows() < 10000) { if (numberIterations_ < (numberSolves_ + numberNodes_)*10) { //if (numberIterations_getModelPtr(); ClpDualRowPivot * pivotMethod = simplex->dualRowPivot(); ClpDualRowDantzig * pivot = dynamic_cast< ClpDualRowDantzig*>(pivotMethod); if (!pivot) { savePivotMethod = pivotMethod->clone(true); ClpDualRowDantzig dantzig; simplex->setDualRowPivotAlgorithm(dantzig); #ifdef COIN_DEVELOP printf("%d node, %d iterations ->Dantzig\n", numberNodes_, numberIterations_); #endif #ifdef CBC_THREAD if (master_) master_->setDantzigState(); #endif } } } } } #else CbcModel::goToDantzig(int numberNodes, ClpDualRowPivot *& savePivotMethod) { printf("Need Clp to go to Dantzig\n"); abort(); } #endif // Below this is deprecated or at least fairly deprecated /* Do Integer Presolve. Returns new model. I have to work out cleanest way of getting solution to original problem at end. So this is very preliminary. */ CbcModel * CbcModel::integerPresolve(bool weak) { status_ = 0; // solve LP //solver_->writeMps("bad"); bool feasible = (resolve(NULL, 3) != 0); CbcModel * newModel = NULL; if (feasible) { // get a new model newModel = new CbcModel(*this); newModel->messageHandler()->setLogLevel(messageHandler()->logLevel()); feasible = newModel->integerPresolveThisModel(solver_, weak); } if (!feasible) { handler_->message(CBC_INFEAS, messages_) << CoinMessageEol; status_ = 0; secondaryStatus_ = 1; delete newModel; return NULL; } else { newModel->synchronizeModel(); // make sure everything that needs solver has it return newModel; } } /* Do Integer Presolve - destroying current model */ bool CbcModel::integerPresolveThisModel(OsiSolverInterface * originalSolver, bool weak) { printf("DEPRECATED\n"); status_ = 0; // solve LP bool feasible = (resolve(NULL, 3) != 0); bestObjective_ = 1.0e50; numberSolutions_ = 0; numberHeuristicSolutions_ = 0; double cutoff = getCutoff() ; double direction = solver_->getObjSense(); if (cutoff < 1.0e20 && direction < 0.0) messageHandler()->message(CBC_CUTOFF_WARNING1, messages()) << cutoff << -cutoff << CoinMessageEol ; if (cutoff > bestObjective_) cutoff = bestObjective_ ; setCutoff(cutoff) ; int iColumn; int numberColumns = getNumCols(); int originalNumberColumns = numberColumns; currentPassNumber_ = 0; synchronizeModel(); // make sure everything that needs solver has it if (!solverCharacteristics_) { OsiBabSolver * solverCharacteristics = dynamic_cast (solver_->getAuxiliaryInfo()); if (solverCharacteristics) { solverCharacteristics_ = solverCharacteristics; } else { // replace in solver OsiBabSolver defaultC; solver_->setAuxiliaryInfo(&defaultC); solverCharacteristics_ = dynamic_cast (solver_->getAuxiliaryInfo()); } } solverCharacteristics_->setSolver(solver_); // just point to solver_ delete continuousSolver_; continuousSolver_ = solver_; // get a copy of original so we can fix bounds OsiSolverInterface * cleanModel = originalSolver->clone(); #ifdef CBC_DEBUG std::string problemName; cleanModel->getStrParam(OsiProbName, problemName); printf("Problem name - %s\n", problemName.c_str()); cleanModel->activateRowCutDebugger(problemName.c_str()); const OsiRowCutDebugger * debugger = cleanModel->getRowCutDebugger(); #endif // array which points from original columns to presolved int * original = new int[numberColumns]; // arrays giving bounds - only ones found by probing // rest will be found by presolve double * originalLower = new double[numberColumns]; double * originalUpper = new double[numberColumns]; { const double * lower = getColLower(); const double * upper = getColUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { original[iColumn] = iColumn; originalLower[iColumn] = lower[iColumn]; originalUpper[iColumn] = upper[iColumn]; } } findIntegers(true); // save original integers int * originalIntegers = new int[numberIntegers_]; int originalNumberIntegers = numberIntegers_; memcpy(originalIntegers, integerVariable_, numberIntegers_*sizeof(int)); int todo = 20; if (weak) todo = 1; while (currentPassNumber_ < todo) { currentPassNumber_++; numberSolutions_ = 0; // this will be set false to break out of loop with presolved problem bool doIntegerPresolve = (currentPassNumber_ != 20); // Current number of free integer variables // Get increment in solutions { const double * objective = cleanModel->getObjCoefficients(); const double * lower = cleanModel->getColLower(); const double * upper = cleanModel->getColUpper(); double maximumCost = 0.0; bool possibleMultiple = true; int numberChanged = 0; for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) { if (originalUpper[iColumn] > originalLower[iColumn]) { if ( cleanModel->isInteger(iColumn)) { maximumCost = CoinMax(maximumCost, fabs(objective[iColumn])); } else if (objective[iColumn]) { possibleMultiple = false; } } if (originalUpper[iColumn] < upper[iColumn]) { #ifdef CBC_DEBUG printf("Changing upper bound on %d from %g to %g\n", iColumn, upper[iColumn], originalUpper[iColumn]); #endif cleanModel->setColUpper(iColumn, originalUpper[iColumn]); numberChanged++; } if (originalLower[iColumn] > lower[iColumn]) { #ifdef CBC_DEBUG printf("Changing lower bound on %d from %g to %g\n", iColumn, lower[iColumn], originalLower[iColumn]); #endif cleanModel->setColLower(iColumn, originalLower[iColumn]); numberChanged++; } } // if first pass - always try if (currentPassNumber_ == 1) numberChanged += 1; if (possibleMultiple && maximumCost) { int increment = 0; double multiplier = 2520.0; while (10.0*multiplier*maximumCost < 1.0e8) multiplier *= 10.0; for (int j = 0; j < originalNumberIntegers; j++) { iColumn = originalIntegers[j]; if (originalUpper[iColumn] > originalLower[iColumn]) { if (objective[iColumn]) { double value = fabs(objective[iColumn]) * multiplier; int nearest = static_cast (floor(value + 0.5)); if (fabs(value - floor(value + 0.5)) > 1.0e-8 || value > 2.1e9) { increment = 0; break; // no good } else if (!increment) { // first increment = nearest; } else { increment = gcd(increment, nearest); } } } } if (increment) { double value = increment; value /= multiplier; if (value*0.999 > dblParam_[CbcCutoffIncrement]) { messageHandler()->message(CBC_INTEGERINCREMENT, messages()) << value << CoinMessageEol; dblParam_[CbcCutoffIncrement] = value * 0.999; } } } if (!numberChanged) { doIntegerPresolve = false; // not doing any better } } #ifdef CBC_DEBUG if (debugger) assert(debugger->onOptimalPath(*cleanModel)); #endif #ifdef COIN_HAS_CLP // do presolve - for now just clp but easy to get osi interface OsiClpSolverInterface * clpSolver = dynamic_cast (cleanModel); if (clpSolver) { ClpSimplex * clp = clpSolver->getModelPtr(); clp->messageHandler()->setLogLevel(cleanModel->messageHandler()->logLevel()); ClpPresolve pinfo; //printf("integerPresolve - temp switch off doubletons\n"); //pinfo.setPresolveActions(4); ClpSimplex * model2 = pinfo.presolvedModel(*clp, 1.0e-8); if (!model2) { // presolve found to be infeasible feasible = false; } else { // update original array const int * originalColumns = pinfo.originalColumns(); // just slot in new solver OsiClpSolverInterface * temp = new OsiClpSolverInterface(model2, true); numberColumns = temp->getNumCols(); for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) original[iColumn] = -1; for (iColumn = 0; iColumn < numberColumns; iColumn++) original[originalColumns[iColumn]] = iColumn; // copy parameters temp->copyParameters(*solver_); // and specialized ones temp->setSpecialOptions(clpSolver->specialOptions()); delete solver_; solver_ = temp; setCutoff(cutoff); deleteObjects(); if (!numberObjects_) { // Nothing left doIntegerPresolve = false; weak = true; break; } synchronizeModel(); // make sure everything that needs solver has it // just point to solver_ continuousSolver_ = solver_; feasible = (resolve(NULL, 3) != 0); if (!feasible || !doIntegerPresolve || weak) break; // see if we can get solution by heuristics int found = -1; int iHeuristic; double * newSolution = new double [numberColumns]; double heuristicValue = getCutoff(); int whereFrom = 0; for (iHeuristic = 0; iHeuristic < numberHeuristics_; iHeuristic++) { // skip if can't run here if (!heuristic_[iHeuristic]->shouldHeurRun(whereFrom)) continue; double saveValue = heuristicValue; int ifSol = heuristic_[iHeuristic]->solution(heuristicValue, newSolution); if (ifSol > 0) { // better solution found heuristic_[iHeuristic]->incrementNumberSolutionsFound(); found = iHeuristic; incrementUsed(newSolution); whereFrom |= 8; // say solution found } else if (ifSol < 0) { heuristicValue = saveValue; } } if (found >= 0) { // We probably already have a current solution, but just in case ... int numberColumns = getNumCols() ; if (!currentSolution_) currentSolution_ = new double[numberColumns] ; testSolution_ = currentSolution_; // better solution save lastHeuristic_ = heuristic_[found]; #ifdef HEURISTIC_INFORM printf("HEUR %s where %d oddE\n", lastHeuristic_->heuristicName(), whereFrom); #endif setBestSolution(CBC_ROUNDING, heuristicValue, newSolution); // update cutoff cutoff = getCutoff(); } delete [] newSolution; // Space for type of cuts maximumWhich_ = INITIAL_MAXIMUM_WHICH; delete [] whichGenerator_ ; whichGenerator_ = new int[maximumWhich_]; // save number of rows numberRowsAtContinuous_ = getNumRows(); maximumNumberCuts_ = 0; currentNumberCuts_ = 0; delete [] addedCuts_; addedCuts_ = NULL; // maximum depth for tree walkback maximumDepth_ = 10; delete [] walkback_; walkback_ = new CbcNodeInfo * [maximumDepth_]; lastDepth_ = 0; delete [] lastNodeInfo_ ; lastNodeInfo_ = new CbcNodeInfo * [maximumDepth_] ; delete [] lastNumberCuts_ ; lastNumberCuts_ = new int [maximumDepth_] ; maximumCuts_ = 100; delete [] lastCut_; lastCut_ = new const OsiRowCut * [maximumCuts_]; OsiCuts cuts; numberOldActiveCuts_ = 0; numberNewCuts_ = 0; feasible = solveWithCuts(cuts, maximumCutPassesAtRoot_, NULL); currentNumberCuts_ = numberNewCuts_; delete [] whichGenerator_; whichGenerator_ = NULL; delete [] walkback_; walkback_ = NULL; delete [] addedCuts_; addedCuts_ = NULL; if (feasible) { // fix anything in original which integer presolve fixed // for now just integers const double * lower = solver_->getColLower(); const double * upper = solver_->getColUpper(); int i; for (i = 0; i < originalNumberIntegers; i++) { iColumn = originalIntegers[i]; int jColumn = original[iColumn]; if (jColumn >= 0) { if (upper[jColumn] < originalUpper[iColumn]) originalUpper[iColumn] = upper[jColumn]; if (lower[jColumn] > originalLower[iColumn]) originalLower[iColumn] = lower[jColumn]; } } } } } #endif if (!feasible || !doIntegerPresolve) { break; } } //solver_->writeMps("xx"); delete cleanModel; delete [] originalIntegers; numberColumns = getNumCols(); delete [] originalColumns_; originalColumns_ = new int[numberColumns]; numberColumns = 0; for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) { int jColumn = original[iColumn]; if (jColumn >= 0) originalColumns_[numberColumns++] = iColumn; } delete [] original; delete [] originalLower; delete [] originalUpper; deleteObjects(); synchronizeModel(); // make sure everything that needs solver has it continuousSolver_ = NULL; currentNumberCuts_ = 0; return feasible; } // Put back information into original model - after integerpresolve void CbcModel::originalModel(CbcModel * presolvedModel, bool weak) { solver_->copyParameters(*(presolvedModel->solver_)); bestObjective_ = presolvedModel->bestObjective_; delete [] bestSolution_; findIntegers(true); if (presolvedModel->bestSolution_) { int numberColumns = getNumCols(); int numberOtherColumns = presolvedModel->getNumCols(); //bestSolution_ = new double[numberColumns]; // set up map int * back = new int[numberColumns]; int i; for (i = 0; i < numberColumns; i++) back[i] = -1; for (i = 0; i < numberOtherColumns; i++) back[presolvedModel->originalColumns_[i]] = i; int iColumn; // set ones in presolved model to values double * otherSolution = presolvedModel->bestSolution_; //const double * lower = getColLower(); for (i = 0; i < numberIntegers_; i++) { iColumn = integerVariable_[i]; int jColumn = back[iColumn]; //bestSolution_[iColumn]=lower[iColumn]; if (jColumn >= 0) { double value = floor(otherSolution[jColumn] + 0.5); solver_->setColLower(iColumn, value); solver_->setColUpper(iColumn, value); //bestSolution_[iColumn]=value; } } delete [] back; #ifdef JJF_ZERO // ** looks as if presolve needs more intelligence // do presolve - for now just clp but easy to get osi interface OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); assert (clpSolver); ClpSimplex * clp = clpSolver->getModelPtr(); Presolve pinfo; ClpSimplex * model2 = pinfo.presolvedModel(*clp, 1.0e-8); model2->primal(1); pinfo.postsolve(true); const double * solution = solver_->getColSolution(); for (i = 0; i < numberIntegers_; i++) { iColumn = integerVariable_[i]; double value = floor(solution[iColumn] + 0.5); solver_->setColLower(iColumn, value); solver_->setColUpper(iColumn, value); } #else if (!weak) { // for now give up int save = numberCutGenerators_; numberCutGenerators_ = 0; bestObjective_ = 1.0e100; branchAndBound(); numberCutGenerators_ = save; } #endif if (bestSolution_) { // solve problem resolve(NULL, 3); // should be feasible if (!currentSolution_) currentSolution_ = new double[numberColumns] ; testSolution_ = currentSolution_; #ifndef NDEBUG int numberIntegerInfeasibilities; int numberObjectInfeasibilities; assert(feasibleSolution(numberIntegerInfeasibilities, numberObjectInfeasibilities)); #endif } } else { bestSolution_ = NULL; } numberSolutions_ = presolvedModel->numberSolutions_; numberHeuristicSolutions_ = presolvedModel->numberHeuristicSolutions_; numberNodes_ = presolvedModel->numberNodes_; numberIterations_ = presolvedModel->numberIterations_; status_ = presolvedModel->status_; secondaryStatus_ = presolvedModel->secondaryStatus_; synchronizeModel(); } void CbcModel::setOptionalInteger(int index) { #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver_); if (clpSolver) clpSolver->setOptionalInteger(index); else #endif solver_->setInteger(index); } // Return true if maximum time reached bool CbcModel::maximumSecondsReached() const { double totalTime = getCurrentSeconds() ; double maxSeconds = getMaximumSeconds(); bool hitMaxTime = (totalTime >= maxSeconds); if (parentModel_ && !hitMaxTime) { // In a sub tree assert (parentModel_); maxSeconds = parentModel_->getMaximumSeconds(); hitMaxTime = (totalTime >= maxSeconds); } if (hitMaxTime) { // Set eventHappened_ so will by-pass as much stuff as possible eventHappened_ = true; } return hitMaxTime; } // Check original model before it gets messed up void CbcModel::checkModel() { int iColumn ; int numberColumns = getNumCols() ; const double *lower = getColLower() ; const double *upper = getColUpper() ; int setFlag = 65536; for (iColumn = 0 ; iColumn < numberColumns ; iColumn++) { if (upper[iColumn] > lower[iColumn] + 1.0e-8) { double value; value = fabs(lower[iColumn]); if (floor(value + 0.5) != value) { setFlag = 0; break; } value = fabs(upper[iColumn]); if (floor(value + 0.5) != value) { setFlag = 0; break; } } } specialOptions_ |= setFlag; } static void flipSolver(OsiSolverInterface * solver, double newCutoff) { if (solver) { double objValue = solver->getObjValue(); double objectiveOffset; solver->setObjSense(-solver->getObjSense()); solver->getDblParam(OsiObjOffset,objectiveOffset); solver->setDblParam(OsiObjOffset,-objectiveOffset); int numberColumns = solver->getNumCols(); double * array = CoinCopyOfArray(solver->getObjCoefficients(),numberColumns); for (int i=0;isetObjective(array); delete [] array; solver->setDblParam(OsiDualObjectiveLimit,newCutoff); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (solver); if (clpSolver) { double * dj = clpSolver->getModelPtr()->dualColumnSolution(); for (int i=0;igetNumRows(); double * pi = clpSolver->getModelPtr()->dualRowSolution(); for (int i=0;igetModelPtr()->setObjectiveValue(-objValue); } else { #endif // update values solver->resolve(); #ifdef COIN_HAS_CLP } #endif } } /* Flip direction of optimization on all models */ void CbcModel::flipModel() { if (parentModel_) return; // I think cutoff is always minimization double cutoff=getCutoff(); flipSolver(referenceSolver_,cutoff); flipSolver(continuousSolver_,cutoff); flipSolver(solver_,cutoff); } #ifdef CBC_KEEP_DEPRECATED /* preProcess problem - replacing solver If makeEquality true then <= cliques converted to ==. Presolve will be done numberPasses times. Returns NULL if infeasible If makeEquality is 1 add slacks to get cliques, if 2 add slacks to get sos (but only if looks plausible) and keep sos info */ CglPreProcess * CbcModel::preProcess( int makeEquality, int numberPasses, int tuning) { CglPreProcess * process = new CglPreProcess(); // Default set of cut generators CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(3); generator1.setMaxProbeRoot(solver_->getNumCols()); generator1.setMaxElements(100); generator1.setMaxLookRoot(50); generator1.setRowCuts(3); // Add in generators process->addCutGenerator(&generator1); process->messageHandler()->setLogLevel(this->logLevel()); /* model may not have created objects If none then create */ if (!numberIntegers_ || !numberObjects_) { this->findIntegers(true, 1); } // Do SOS int i; int numberSOS2 = 0; for (i = 0; i < numberObjects_; i++) { CbcSOS * objSOS = dynamic_cast (object_[i]) ; if (objSOS) { int type = objSOS->sosType(); if (type == 2) numberSOS2++; } } if (numberSOS2) { // SOS int numberColumns = solver_->getNumCols(); char * prohibited = new char[numberColumns]; memset(prohibited, 0, numberColumns); for (i = 0; i < numberObjects_; i++) { CbcSOS * objSOS = dynamic_cast (object_[i]) ; if (objSOS) { int type = objSOS->sosType(); if (type == 2) { int n = objSOS->numberMembers(); const int * which = objSOS->members(); for (int j = 0; j < n; j++) { int iColumn = which[j]; prohibited[iColumn] = 1; } } } } process->passInProhibited(prohibited, numberColumns); delete [] prohibited; } // Tell solver we are not in Branch and Cut solver_->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo) ; OsiSolverInterface * newSolver = process->preProcessNonDefault(*solver_, makeEquality, numberPasses, tuning); // Tell solver we are not in Branch and Cut solver_->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; if (newSolver) { int numberOriginalObjects = numberObjects_; OsiSolverInterface * originalSolver = solver_; solver_ = newSolver->clone(); // clone as process owns solver // redo sequence numberIntegers_ = 0; int numberColumns = solver_->getNumCols(); int nOrig = originalSolver->getNumCols(); const int * originalColumns = process->originalColumns(); // allow for cliques etc nOrig = CoinMax(nOrig, originalColumns[numberColumns-1] + 1); OsiObject ** originalObject = object_; // object number or -1 int * temp = new int[nOrig]; int iColumn; for (iColumn = 0; iColumn < nOrig; iColumn++) temp[iColumn] = -1; int iObject; numberObjects_ = 0; int nNonInt = 0; for (iObject = 0; iObject < numberOriginalObjects; iObject++) { iColumn = originalObject[iObject]->columnNumber(); if (iColumn < 0) { nNonInt++; } else { temp[iColumn] = iObject; } } int numberNewIntegers = 0; int numberOldIntegers = 0; int numberOldOther = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = originalColumns[iColumn]; if (temp[jColumn] >= 0) { int iObject = temp[jColumn]; CbcSimpleInteger * obj = dynamic_cast (originalObject[iObject]) ; if (obj) numberOldIntegers++; else numberOldOther++; } else if (isInteger(iColumn)) { numberNewIntegers++; } } /* Allocate an array to hold the indices of the integer variables. Make a large enough array for all objects */ numberObjects_ = numberNewIntegers + numberOldIntegers + numberOldOther + nNonInt; object_ = new OsiObject * [numberObjects_]; delete [] integerVariable_; integerVariable_ = new int [numberNewIntegers+numberOldIntegers]; /* Walk the variables again, filling in the indices and creating objects for the integer variables. Initially, the objects hold the index and upper & lower bounds. */ numberIntegers_ = 0; int n = originalColumns[numberColumns-1] + 1; int * backward = new int[n]; int i; for ( i = 0; i < n; i++) backward[i] = -1; for (i = 0; i < numberColumns; i++) backward[originalColumns[i]] = i; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = originalColumns[iColumn]; if (temp[jColumn] >= 0) { int iObject = temp[jColumn]; CbcSimpleInteger * obj = dynamic_cast (originalObject[iObject]) ; if (obj) { object_[numberIntegers_] = originalObject[iObject]->clone(); // redo ids etc //object_[numberIntegers_]->resetSequenceEtc(numberColumns,originalColumns); object_[numberIntegers_]->resetSequenceEtc(numberColumns, backward); integerVariable_[numberIntegers_++] = iColumn; } } else if (isInteger(iColumn)) { object_[numberIntegers_] = new CbcSimpleInteger(this, iColumn); integerVariable_[numberIntegers_++] = iColumn; } } delete [] backward; numberObjects_ = numberIntegers_; // Now append other column stuff for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = originalColumns[iColumn]; if (temp[jColumn] >= 0) { int iObject = temp[jColumn]; CbcSimpleInteger * obj = dynamic_cast (originalObject[iObject]) ; if (!obj) { object_[numberObjects_] = originalObject[iObject]->clone(); // redo ids etc CbcObject * obj = dynamic_cast (object_[numberObjects_]) ; assert (obj); obj->redoSequenceEtc(this, numberColumns, originalColumns); numberObjects_++; } } } // now append non column stuff for (iObject = 0; iObject < numberOriginalObjects; iObject++) { iColumn = originalObject[iObject]->columnNumber(); if (iColumn < 0) { object_[numberObjects_] = originalObject[iObject]->clone(); // redo ids etc CbcObject * obj = static_cast (object_[numberObjects_]) ; assert (obj); obj->redoSequenceEtc(this, numberColumns, originalColumns); numberObjects_++; } delete originalObject[iObject]; } delete [] originalObject; delete [] temp; if (!numberObjects_) handler_->message(CBC_NOINT, messages_) << CoinMessageEol ; return process; } else { // infeasible delete process; return NULL; } } /* Does postprocessing - original solver back. User has to delete process */ void CbcModel::postProcess(CglPreProcess * process) { process->postProcess(*solver_); delete solver_; solver_ = process->originalModel(); } /* Process root node and return a strengthened model The method assumes that initialSolve() has been called to solve the LP relaxation. It processes the root node and then returns a pointer to the strengthened model (or NULL if infeasible) */ OsiSolverInterface * CbcModel::strengthenedModel() { /* Switch off heuristics */ int saveNumberHeuristics = numberHeuristics_; numberHeuristics_ = 0; /* Scan the variables, noting the integer variables. Create an CbcSimpleInteger object for each integer variable. */ findIntegers(false) ; /* Ensure that objects on the lists of OsiObjects, heuristics, and cut generators attached to this model all refer to this model. */ synchronizeModel() ; // Set so we can tell we are in initial phase in resolve continuousObjective_ = -COIN_DBL_MAX ; /* Solve the relaxation. Apparently there are circumstances where this will be non-trivial --- i.e., we've done something since initialSolve that's trashed the solution to the continuous relaxation. */ bool feasible = resolve(NULL, 0) != 0 ; /* If the linear relaxation of the root is infeasible, bail out now. Otherwise, continue with processing the root node. */ if (!feasible) { handler_->message(CBC_INFEAS, messages_) << CoinMessageEol ; return NULL; } // Save objective (just so user can access it) originalContinuousObjective_ = solver_->getObjValue(); /* Begin setup to process a feasible root node. */ bestObjective_ = CoinMin(bestObjective_, 1.0e50) ; numberSolutions_ = 0 ; numberHeuristicSolutions_ = 0 ; // Everything is minimization double cutoff = getCutoff() ; double direction = solver_->getObjSense() ; if (cutoff < 1.0e20 && direction < 0.0) messageHandler()->message(CBC_CUTOFF_WARNING1, messages()) << cutoff << -cutoff << CoinMessageEol ; if (cutoff > bestObjective_) cutoff = bestObjective_ ; setCutoff(cutoff) ; /* We probably already have a current solution, but just in case ... */ int numberColumns = getNumCols() ; if (!currentSolution_) currentSolution_ = new double[numberColumns] ; testSolution_ = currentSolution_; /* Create a copy of the solver, thus capturing the original (root node) constraint system (aka the continuous system). */ continuousSolver_ = solver_->clone() ; numberRowsAtContinuous_ = getNumRows() ; /* Check the objective to see if we can deduce a nontrivial increment. If it's better than the current value for CbcCutoffIncrement, it'll be installed. */ analyzeObjective() ; /* Set up for cut generation. addedCuts_ holds the cuts which are relevant for the active subproblem. whichGenerator will be used to record the generator that produced a given cut. */ maximumWhich_ = INITIAL_MAXIMUM_WHICH ; delete [] whichGenerator_ ; whichGenerator_ = new int[maximumWhich_] ; maximumNumberCuts_ = 0 ; currentNumberCuts_ = 0 ; delete [] addedCuts_ ; addedCuts_ = NULL ; /* Generate cuts at the root node and reoptimise. solveWithCuts does the heavy lifting. It will iterate a generate/reoptimise loop (including reduced cost fixing) until no cuts are generated, the change in objective falls off, or the limit on the number of rounds of cut generation is exceeded. At the end of all this, any cuts will be recorded in cuts and also installed in the solver's constraint system. We'll have reoptimised, and removed any slack cuts (numberOldActiveCuts_ and numberNewCuts_ have been adjusted accordingly). Tell cut generators they can be a bit more aggressive at root node */ int iCutGenerator; for (iCutGenerator = 0; iCutGenerator < numberCutGenerators_; iCutGenerator++) { CglCutGenerator * generator = generator_[iCutGenerator]->generator(); generator->setAggressiveness(generator->getAggressiveness() + 100); } OsiCuts cuts ; numberOldActiveCuts_ = 0 ; numberNewCuts_ = 0 ; { int iObject ; int numberUnsatisfied = 0 ; memcpy(currentSolution_, solver_->getColSolution(), numberColumns*sizeof(double)) ; // point to useful information OsiBranchingInformation usefulInfo = usefulInformation(); for (iObject = 0 ; iObject < numberObjects_ ; iObject++) { double infeasibility = object_[iObject]->checkInfeasibility(&usefulInfo) ; if (infeasibility) numberUnsatisfied++ ; } if (numberUnsatisfied) { feasible = solveWithCuts(cuts, maximumCutPassesAtRoot_, NULL) ; } } /* We've taken the continuous relaxation as far as we can. */ OsiSolverInterface * newSolver = NULL; if (feasible) { // make copy of current solver newSolver = solver_->clone(); } /* Clean up dangling objects. continuousSolver_ may already be toast. */ delete [] whichGenerator_ ; whichGenerator_ = NULL; delete [] walkback_ ; walkback_ = NULL ; delete [] lastNodeInfo_ ; lastNodeInfo_ = NULL; delete [] lastNumberCuts_ ; lastNumberCuts_ = NULL; delete [] lastCut_; lastCut_ = NULL; delete [] addedCuts_ ; addedCuts_ = NULL ; if (continuousSolver_) { delete continuousSolver_ ; continuousSolver_ = NULL ; } /* Destroy global cuts by replacing with an empty OsiCuts object. */ globalCuts_ = OsiCuts() ; delete globalConflictCuts_; globalConflictCuts_=NULL; numberHeuristics_ = saveNumberHeuristics; return newSolver; } /* create a submodel from partially fixed problem The method creates a new clean model with given bounds. */ CbcModel * CbcModel::cleanModel(const double * lower, const double * upper) { OsiSolverInterface * solver = continuousSolver_->clone(); int numberIntegers = numberIntegers_; const int * integerVariable = integerVariable_; int i; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = object_[i]; #ifndef NDEBUG const CbcSimpleInteger * integerObject = dynamic_cast (object); assert(integerObject); #else const CbcSimpleInteger * integerObject = static_cast (object); #endif // get original bounds double originalLower = integerObject->originalLowerBound(); double originalUpper = integerObject->originalUpperBound(); solver->setColLower(iColumn, CoinMax(lower[iColumn], originalLower)); solver->setColUpper(iColumn, CoinMin(upper[iColumn], originalUpper)); } CbcModel * model = new CbcModel(*solver); // off some messages if (handler_->logLevel() <= 1) { model->messagesPointer()->setDetailMessage(3, 9); model->messagesPointer()->setDetailMessage(3, 6); model->messagesPointer()->setDetailMessage(3, 4); model->messagesPointer()->setDetailMessage(3, 1); model->messagesPointer()->setDetailMessage(3, 13); model->messagesPointer()->setDetailMessage(3, 14); model->messagesPointer()->setDetailMessage(3, 3007); } // Cuts for ( i = 0; i < numberCutGenerators_; i++) { int howOften = generator_[i]->howOftenInSub(); if (howOften > -100) { CbcCutGenerator * generator = virginGenerator_[i]; CglCutGenerator * cglGenerator = generator->generator(); model->addCutGenerator(cglGenerator, howOften, generator->cutGeneratorName(), generator->normal(), generator->atSolution(), generator->whenInfeasible(), -100, generator->whatDepthInSub(), -1); } } double cutoff = getCutoff(); model->setCutoff(cutoff); return model; } /* Invoke the branch & cut algorithm on partially fixed problem The method uses a subModel created by cleanModel. The search ends when the tree is exhausted or maximum nodes is reached. If better solution found then it is saved. Returns 0 if search completed and solution, 1 if not completed and solution, 2 if completed and no solution, 3 if not completed and no solution. Normally okay to do subModel immediately followed by subBranchandBound (== other form of subBranchAndBound) but may need to get at model for advanced features. Deletes model */ int CbcModel::subBranchAndBound(CbcModel * model, CbcModel * presolvedModel, int maximumNodes) { int i; double cutoff = model->getCutoff(); CbcModel * model2; if (presolvedModel) model2 = presolvedModel; else model2 = model; // Do complete search for (i = 0; i < numberHeuristics_; i++) { model2->addHeuristic(heuristic_[i]); model2->heuristic(i)->resetModel(model2); } // Definition of node choice model2->setNodeComparison(nodeCompare_->clone()); //model2->solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); model2->messageHandler()->setLogLevel(CoinMax(0, handler_->logLevel() - 1)); //model2->solver()->messageHandler()->setLogLevel(2); model2->setMaximumCutPassesAtRoot(maximumCutPassesAtRoot_); model2->setPrintFrequency(50); model2->setIntParam(CbcModel::CbcMaxNumNode, maximumNodes); model2->branchAndBound(); delete model2->nodeComparison(); if (model2->getMinimizationObjValue() > cutoff) { // no good if (model != model2) delete model2; delete model; return 2; } if (model != model2) { // get back solution model->originalModel(model2, false); delete model2; } int status; if (model->getMinimizationObjValue() < cutoff && model->bestSolution()) { double objValue = model->getObjValue(); const double * solution = model->bestSolution(); setBestSolution(CBC_TREE_SOL, objValue, solution); status = 0; } else { status = 2; } if (model->status()) status ++ ; // not finished search delete model; return status; } /* Invoke the branch & cut algorithm on partially fixed problem The method creates a new model with given bounds, presolves it then proceeds to explore the branch & cut search tree. The search ends when the tree is exhausted or maximum nodes is reached. Returns 0 if search completed and solution, 1 if not completed and solution, 2 if completed and no solution, 3 if not completed and no solution. */ int CbcModel::subBranchAndBound(const double * lower, const double * upper, int maximumNodes) { OsiSolverInterface * solver = continuousSolver_->clone(); int numberIntegers = numberIntegers_; const int * integerVariable = integerVariable_; int i; for (i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; const OsiObject * object = object_[i]; #ifndef NDEBUG const CbcSimpleInteger * integerObject = dynamic_cast (object); assert(integerObject); #else const CbcSimpleInteger * integerObject = static_cast (object); #endif // get original bounds double originalLower = integerObject->originalLowerBound(); double originalUpper = integerObject->originalUpperBound(); solver->setColLower(iColumn, CoinMax(lower[iColumn], originalLower)); solver->setColUpper(iColumn, CoinMin(upper[iColumn], originalUpper)); } CbcModel model(*solver); // off some messages if (handler_->logLevel() <= 1) { model.messagesPointer()->setDetailMessage(3, 9); model.messagesPointer()->setDetailMessage(3, 6); model.messagesPointer()->setDetailMessage(3, 4); model.messagesPointer()->setDetailMessage(3, 1); model.messagesPointer()->setDetailMessage(3, 3007); } double cutoff = getCutoff(); model.setCutoff(cutoff); // integer presolve CbcModel * model2 = model.integerPresolve(false); if (!model2 || !model2->getNumRows()) { delete model2; delete solver; return 2; } if (handler_->logLevel() > 1) printf("Reduced model has %d rows and %d columns\n", model2->getNumRows(), model2->getNumCols()); // Do complete search // Cuts for ( i = 0; i < numberCutGenerators_; i++) { int howOften = generator_[i]->howOftenInSub(); if (howOften > -100) { CbcCutGenerator * generator = virginGenerator_[i]; CglCutGenerator * cglGenerator = generator->generator(); model2->addCutGenerator(cglGenerator, howOften, generator->cutGeneratorName(), generator->normal(), generator->atSolution(), generator->whenInfeasible(), -100, generator->whatDepthInSub(), -1); } } for (i = 0; i < numberHeuristics_; i++) { model2->addHeuristic(heuristic_[i]); model2->heuristic(i)->resetModel(model2); } // Definition of node choice model2->setNodeComparison(nodeCompare_->clone()); //model2->solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); model2->messageHandler()->setLogLevel(CoinMax(0, handler_->logLevel() - 1)); //model2->solver()->messageHandler()->setLogLevel(2); model2->setMaximumCutPassesAtRoot(maximumCutPassesAtRoot_); model2->setPrintFrequency(50); model2->setIntParam(CbcModel::CbcMaxNumNode, maximumNodes); model2->branchAndBound(); delete model2->nodeComparison(); if (model2->getMinimizationObjValue() > cutoff) { // no good delete model2; delete solver; return 2; } // get back solution model.originalModel(model2, false); delete model2; int status; if (model.getMinimizationObjValue() < cutoff && model.bestSolution()) { double objValue = model.getObjValue(); const double * solution = model.bestSolution(); setBestSolution(CBC_TREE_SOL, objValue, solution); status = 0; } else { status = 2; } if (model.status()) status ++ ; // not finished search delete solver; return status; } #endif static void * doRootCbcThread(void * voidInfo) { CbcModel * model = reinterpret_cast (voidInfo); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast (model->solver()); char general[200]; if (clpSolver) { sprintf(general,"Starting multiple root solver"); model->messageHandler()->message(CBC_GENERAL, model->messages()) << general << CoinMessageEol ; clpSolver->setHintParam(OsiDoReducePrint, true, OsiHintTry); ClpSimplex * simplex = clpSolver->getModelPtr(); int logLevel=simplex->logLevel(); if (logLevel<=1) simplex->setLogLevel(0); simplex->dual(); simplex->setLogLevel(logLevel); clpSolver->setWarmStart(NULL); } else { model->initialSolve(); sprintf(general,"Solver did %d iterations in initialSolve\n", model->solver()->getIterationCount()); model->messageHandler()->message(CBC_GENERAL, model->messages()) << general << CoinMessageEol ; } #endif model->branchAndBound(); sprintf(general,"Ending multiple root solver"); model->messageHandler()->message(CBC_GENERAL, model->messages()) << general << CoinMessageEol ; return NULL; } OsiRowCut * CbcModel::conflictCut(const OsiSolverInterface * solver, bool & localCuts) { OsiRowCut * cut=NULL; localCuts=false; # ifdef COIN_HAS_CLP const OsiClpSolverInterface * clpSolver = dynamic_cast (solver); if (clpSolver&&topOfTree_) { int debugMode=0; const double * originalLower = topOfTree_->lower(); const double * originalUpper = topOfTree_->upper(); int typeCut = 1; ClpSimplex * simplex = clpSolver->getModelPtr(); assert(simplex->status()==1); if(simplex->ray()) { { int numberRows=simplex->numberRows(); double * saveRay=CoinCopyOfArray(simplex->ray(),numberRows); #define SAFE_RAY #ifdef SAFE_RAY ClpSimplex & tempSimplex=*simplex; #else ClpSimplex tempSimplex=*simplex; #endif int logLevel=simplex->logLevel(); tempSimplex.setLogLevel(63); tempSimplex.scaling(0); tempSimplex.dual(); tempSimplex.setLogLevel(logLevel); if (!tempSimplex.numberIterations()) { double * ray = tempSimplex.ray(); int nBad=0; for (int i=0;i1.0e-3) { if (debugMode) printf("row %d true %g bad %g - diff %g\n", i,ray[i],saveRay[i],ray[i]-saveRay[i]); nBad++; } } if (nBad) printf("%d mismatch crunch ray values\n",nBad); } delete [] saveRay; } // make sure we use non-scaled versions ClpPackedMatrix * saveMatrix = simplex->swapScaledMatrix(NULL); double * saveScale = simplex->swapRowScale(NULL); //printf("Could do normal cut\n"); // could use existing arrays int numberRows=simplex->numberRows(); int numberColumns=simplex->numberColumns(); double * farkas = new double [2*numberColumns+numberRows]; double * bound = farkas + numberColumns; double * effectiveRhs = bound + numberColumns; // sign as internally for dual - so swap if primal /*const*/ double * ray = simplex->ray(); // have to get rid of local cut rows if (whichGenerator_) { const int * whichGenerator = whichGenerator_ - numberRowsAtContinuous_; int badRows=0; for (int iRow=numberRowsAtContinuous_;iRow=0&&iType<20000)) { if (fabs(ray[iRow])>1.0e-10) { badRows++; } else { ray[iRow]=0.0; } } } if (badRows) { if ((debugMode&1)!=0) printf("%d rows from local cuts\n",badRows); localCuts=true; } } // get farkas row memset(farkas,0,(2*numberColumns+numberRows)*sizeof(double)); simplex->transposeTimes(-1.0,ray,farkas); //const char * integerInformation = simplex->integerType_; //assert (integerInformation); int sequenceOut = simplex->sequenceOut(); // Put nonzero bounds in bound const double * columnLower = simplex->columnLower(); const double * columnUpper = simplex->columnUpper(); int numberBad=0; for (int i=0;igetStatus(i)==ClpSimplex::basic) { // treat as zero if small if (fabs(value)<1.0e-8) { value=0.0; farkas[i]=0.0; } if (value) { //printf("basic %d direction %d farkas %g\n", // i,simplex->directionOut(),value); if (value<0.0) boundValue=columnLower[i]; else boundValue=columnUpper[i]; } } else if (fabs(value)>1.0e-10) { if (value<0.0) boundValue=columnLower[i]; else boundValue=columnUpper[i]; } bound[i]=boundValue; if (fabs(boundValue)>1.0e10) numberBad++; } const double * rowLower = simplex->rowLower(); const double * rowUpper = simplex->rowUpper(); //int pivotRow = simplex->spareIntArray_[3]; //bool badPivot=pivotRow<0; for (int i=0;igetRowStatus(i)==ClpSimplex::basic) { // treat as zero if small if (fabs(value)<1.0e-8) { value=0.0; ray[i]=0.0; } if (value) { //printf("row basic %d direction %d ray %g\n", // i,simplex->directionOut(),value); if (value<0.0) rhsValue=rowLower[i]; else rhsValue=rowUpper[i]; } } else if (fabs(value)>1.0e-10) { if (value<0.0) rhsValue=rowLower[i]; else rhsValue=rowUpper[i]; } effectiveRhs[i]=rhsValue; } simplex->times(-1.0,bound,effectiveRhs); simplex->swapRowScale(saveScale); simplex->swapScaledMatrix(saveMatrix); double bSum=0.0; for (int i=0;i-1.0e-4) { #ifndef NDEBUG printf("bad BOUND bSum %g - %d bad\n", bSum,numberBad); #endif } else { const char * integerInformation = simplex->integerInformation(); assert (integerInformation); int * conflict = new int[numberColumns]; double * sort = new double [numberColumns]; double relax=0.0; int nConflict=0; int nOriginal=0; int nFixed=0; for (int iColumn=0;iColumngetStatus(iColumn),columnLower[iColumn], simplex->primalColumnSolution()[iColumn],columnUpper[iColumn], originalLower[iColumn],originalUpper[iColumn], farkas[iColumn]); double gap = originalUpper[iColumn]-originalLower[iColumn]; if (!gap) continue; if (gap==columnUpper[iColumn]-columnLower[iColumn]) nOriginal++; if (columnUpper[iColumn]==columnLower[iColumn]) nFixed++; if (fabs(farkas[iColumn])<1.0e-15) { farkas[iColumn]=0.0; continue; } // temp if (gap>=20000.0&&false) { // can't use if (farkas[iColumn]<0.0) { assert(originalLower[iColumn]-columnLower[iColumn]<=0.0); // farkas is negative - relax lower bound all way relax += farkas[iColumn]*(originalLower[iColumn]-columnLower[iColumn]); } else { assert(originalUpper[iColumn]-columnUpper[iColumn]>=0.0); // farkas is positive - relax upper bound all way relax += farkas[iColumn]*(originalUpper[iColumn]-columnUpper[iColumn]); } continue; } if (originalLower[iColumn]==columnLower[iColumn]) { if (farkas[iColumn]>0.0&&(simplex->getStatus(iColumn)==ClpSimplex::atUpperBound ||simplex->getStatus(iColumn)==ClpSimplex::isFixed ||iColumn==sequenceOut)) { // farkas is positive - add to list gap=originalUpper[iColumn]-columnUpper[iColumn]; if (gap) { sort[nConflict]=-farkas[iColumn]*gap; conflict[nConflict++]=iColumn; } //assert (gap>columnUpper[iColumn]-columnLower[iColumn]); } } else if (originalUpper[iColumn]==columnUpper[iColumn]) { if (farkas[iColumn]<0.0&&(simplex->getStatus(iColumn)==ClpSimplex::atLowerBound ||simplex->getStatus(iColumn)==ClpSimplex::isFixed ||iColumn==sequenceOut)) { // farkas is negative - add to list gap=columnLower[iColumn]-originalLower[iColumn]; if (gap) { sort[nConflict]=farkas[iColumn]*gap; conflict[nConflict++]=iColumn; } //assert (gap>columnUpper[iColumn]-columnLower[iColumn]); } } else { // can't use if (farkas[iColumn]<0.0) { assert(originalLower[iColumn]-columnLower[iColumn]<=0.0); // farkas is negative - relax lower bound all way relax += farkas[iColumn]*(originalLower[iColumn]-columnLower[iColumn]); } else { assert(originalUpper[iColumn]-columnUpper[iColumn]>=0.0); // farkas is positive - relax upper bound all way relax += farkas[iColumn]*(originalUpper[iColumn]-columnUpper[iColumn]); } } assert(relax>=0.0); } else { // not integer - but may have been got at double gap = originalUpper[iColumn]-originalLower[iColumn]; if (gap>columnUpper[iColumn]-columnLower[iColumn]) { // can't use if (farkas[iColumn]<0.0) { assert(originalLower[iColumn]-columnLower[iColumn]<=0.0); // farkas is negative - relax lower bound all way relax += farkas[iColumn]*(originalLower[iColumn]-columnLower[iColumn]); } else { assert(originalUpper[iColumn]-columnUpper[iColumn]>=0.0); // farkas is positive - relax upper bound all way relax += farkas[iColumn]*(originalUpper[iColumn]-columnUpper[iColumn]); } } } } if (relax+bSum>-1.0e-4||!nConflict) { if (relax+bSum>-1.0e-4) { #ifndef NDEBUG printf("General integers relax bSum to %g\n",relax+bSum); #endif } else { printf("All variables relaxed and still infeasible - what does this mean?\n"); int nR=0; for (int i=0;i1.0e-10) nR++; else ray[i]=0.0; } int nC=0; for (int i=0;i1.0e-10) nC++; else farkas[i]=0.0; } if (nR<3&&nC<5) { printf("BAD %d nonzero rows, %d nonzero columns\n",nR,nC); } } } else { printf("BOUNDS violation bSum %g (relaxed %g) - %d at original bounds, %d fixed - %d in conflict\n",bSum, relax+bSum,nOriginal,nFixed,nConflict); CoinSort_2(sort,sort+nConflict,conflict); int nC=nConflict; bSum+=relax; double saveBsum = bSum; while (nConflict) { //int iColumn=conflict[nConflict-1]; double change=-sort[nConflict-1]; if (bSum+change>-1.0e-4) break; nConflict--; bSum += change; } if (!nConflict) { int nR=0; for (int i=0;i1.0e-10) nR++; else ray[i]=0.0; } int nC=0; for (int i=0;i1.0e-10) nC++; else farkas[i]=0.0; } if (nR<3&&nC<5) { printf("BAD2 %d nonzero rows, %d nonzero columns\n",nR,nC); } } // no point doing if no reduction (or big?) ? if (nConflictsetUb(COIN_DBL_MAX); if (!typeCut) { double lo=1.0; for (int i=0;isetLb(lo); cut->setRow(nConflict,conflict,sort); printf("CUT has %d (started at %d) - final bSum %g\n",nConflict,nC,bSum); } else { // just save for use later // first take off small int nC2=nC; while (nC2) { //int iColumn=conflict[nConflict-1]; double change=-sort[nC2-1]; if (saveBsum+change>-1.0e-4||change>1.0e-4) break; nC2--; saveBsum += change; } cut->setLb(saveBsum); for (int i=0;isetRow(nC2,conflict,sort); printf("Stem CUT has %d (greedy %d - with small %d) - saved bSum %g final greedy bSum %g\n", nC2,nConflict,nC,saveBsum,bSum); } } } delete [] conflict; delete [] sort; } delete [] farkas; } else { printf("No dual ray\n"); } } #endif return cut; } CoinMP-1.8.3/Cbc/src/CbcNode.hpp0000644000175000017500000002715512207141633014611 0ustar renerene/* $Id: CbcNode.hpp 1957 2013-08-27 15:19:55Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcNode_H #define CbcNode_H #include #include #include "CoinWarmStartBasis.hpp" #include "CoinSearchTree.hpp" #include "CbcBranchBase.hpp" #include "CbcNodeInfo.hpp" #include "CbcFullNodeInfo.hpp" #include "CbcPartialNodeInfo.hpp" class OsiSolverInterface; class OsiSolverBranch; class OsiCuts; class OsiRowCut; class OsiRowCutDebugger; class CoinWarmStartBasis; class CbcCountRowCut; class CbcModel; class CbcNode; class CbcSubProblem; class CbcGeneralBranchingObject; /** Information required while the node is live When a subproblem is initially created, it is represented by an CbcNode object and an attached CbcNodeInfo object. The CbcNode contains information (depth, branching instructions), that's needed while the subproblem remains `live', i.e., while the subproblem is not fathomed and there are branch arms still be be evaluated. The CbcNode is deleted when the last branch arm has been evaluated. The CbcNodeInfo object contains the information needed to maintain the search tree and recreate the subproblem for the node. It remains in existence until there are no nodes remaining in the subtree rooted at this node. */ class CbcNode : public CoinTreeNode { public: /// Default Constructor CbcNode (); /// Construct and increment parent reference count CbcNode (CbcModel * model, CbcNode * lastNode); /// Copy constructor CbcNode (const CbcNode &); /// Assignment operator CbcNode & operator= (const CbcNode& rhs); /// Destructor ~CbcNode (); /** Create a description of the subproblem at this node The CbcNodeInfo structure holds the information (basis & variable bounds) required to recreate the subproblem for this node. It also links the node to its parent (via the parent's CbcNodeInfo object). If lastNode == NULL, a CbcFullNodeInfo object will be created. All parameters except \p model are unused. If lastNode != NULL, a CbcPartialNodeInfo object will be created. Basis and bounds information will be stored in the form of differences between the parent subproblem and this subproblem. (More precisely, \p lastws, \p lastUpper, \p lastLower, \p numberOldActiveCuts, and \p numberNewCuts are used.) */ void createInfo(CbcModel * model, CbcNode * lastNode, const CoinWarmStartBasis *lastws, const double * lastLower, const double * lastUpper, int numberOldActiveCuts, int numberNewCuts); /** Create a branching object for the node The routine scans the object list of the model and selects a set of unsatisfied objects as candidates for branching. The candidates are evaluated, and an appropriate branch object is installed. The numberPassesLeft is decremented to stop fixing one variable each time and going on and on (e.g. for stock cutting, air crew scheduling) If evaluation determines that an object is monotone or infeasible, the routine returns immediately. In the case of a monotone object, the branch object has already been called to modify the model. Return value:
    • 0: A branching object has been installed
    • -1: A monotone object was discovered
    • -2: An infeasible object was discovered
    */ int chooseBranch (CbcModel * model, CbcNode * lastNode, int numberPassesLeft); /** Create a branching object for the node - when dynamic pseudo costs The routine scans the object list of the model and selects a set of unsatisfied objects as candidates for branching. The candidates are evaluated, and an appropriate branch object is installed. This version gives preference in evaluation to variables which have not been evaluated many times. It also uses numberStrong to say give up if last few tries have not changed incumbent. See Achterberg, Koch and Martin. The numberPassesLeft is decremented to stop fixing one variable each time and going on and on (e.g. for stock cutting, air crew scheduling) If evaluation determines that an object is monotone or infeasible, the routine returns immediately. In the case of a monotone object, the branch object has already been called to modify the model. Return value:
    • 0: A branching object has been installed
    • -1: A monotone object was discovered
    • -2: An infeasible object was discovered
    • >0: Number of quich branching objects (and branches will be non NULL)
    */ int chooseDynamicBranch (CbcModel * model, CbcNode * lastNode, OsiSolverBranch * & branches, int numberPassesLeft); /** Create a branching object for the node The routine scans the object list of the model and selects a set of unsatisfied objects as candidates for branching. The candidates are evaluated, and an appropriate branch object is installed. The numberPassesLeft is decremented to stop fixing one variable each time and going on and on (e.g. for stock cutting, air crew scheduling) If evaluation determines that an object is monotone or infeasible, the routine returns immediately. In the case of a monotone object, the branch object has already been called to modify the model. Return value:
    • 0: A branching object has been installed
    • -1: A monotone object was discovered
    • -2: An infeasible object was discovered
    Branch state:
    • -1: start
    • -1: A monotone object was discovered
    • -2: An infeasible object was discovered
    */ int chooseOsiBranch (CbcModel * model, CbcNode * lastNode, OsiBranchingInformation * usefulInfo, int branchState); /** Create a branching object for the node The routine scans the object list of the model and selects a set of unsatisfied objects as candidates for branching. It then solves a series of problems and a CbcGeneral branch object is installed. If evaluation determines that an object is infeasible, the routine returns immediately. Return value:
    • 0: A branching object has been installed
    • -2: An infeasible object was discovered
    */ int chooseClpBranch (CbcModel * model, CbcNode * lastNode); int analyze(CbcModel * model, double * results); /// Decrement active cut counts void decrementCuts(int change = 1); /// Decrement all active cut counts in chain starting at parent void decrementParentCuts(CbcModel * model, int change = 1); /// Nulls out node info void nullNodeInfo(); /** Initialize reference counts in attached CbcNodeInfo This is a convenience routine, which will initialize the reference counts in the attached CbcNodeInfo object based on the attached OsiBranchingObject. \sa CbcNodeInfo::initializeInfo(int). */ void initializeInfo(); /// Does next branch and updates state int branch(OsiSolverInterface * solver); /** Double checks in case node can change its mind! Returns objective value Can change objective etc */ double checkIsCutoff(double cutoff); // Information to make basis and bounds inline CbcNodeInfo * nodeInfo() const { return nodeInfo_; } // Objective value inline double objectiveValue() const { return objectiveValue_; } inline void setObjectiveValue(double value) { objectiveValue_ = value; } /// Number of arms defined for the attached OsiBranchingObject. inline int numberBranches() const { if (branch_) return (branch_->numberBranches()) ; else return (-1) ; } /* Active arm of the attached OsiBranchingObject. In the simplest instance, coded -1 for the down arm of the branch, +1 for the up arm. But see OsiBranchingObject::way() Use nodeInfo--.numberBranchesLeft_ to see how active */ int way() const; /// Depth in branch-and-cut search tree inline int depth() const { return depth_; } /// Set depth in branch-and-cut search tree inline void setDepth(int value) { depth_ = value; } /// Get the number of objects unsatisfied at this node. inline int numberUnsatisfied() const { return numberUnsatisfied_; } /// Set the number of objects unsatisfied at this node. inline void setNumberUnsatisfied(int value) { numberUnsatisfied_ = value; } /// Get sum of "infeasibilities" reported by each object inline double sumInfeasibilities() const { return sumInfeasibilities_; } /// Set sum of "infeasibilities" reported by each object inline void setSumInfeasibilities(double value) { sumInfeasibilities_ = value; } // Guessed objective value (for solution) inline double guessedObjectiveValue() const { return guessedObjectiveValue_; } inline void setGuessedObjectiveValue(double value) { guessedObjectiveValue_ = value; } /// Branching object for this node inline const OsiBranchingObject * branchingObject() const { return branch_; } /// Modifiable branching object for this node inline OsiBranchingObject * modifiableBranchingObject() const { return branch_; } /// Set branching object for this node (takes ownership) inline void setBranchingObject(OsiBranchingObject * branchingObject) { branch_ = branchingObject; } /// The node number inline int nodeNumber() const { return nodeNumber_; } inline void setNodeNumber(int node) { nodeNumber_ = node; } /// Returns true if on tree inline bool onTree() const { return (state_&1) != 0; } /// Sets true if on tree inline void setOnTree(bool yesNo) { if (yesNo) state_ |= 1; else state_ &= ~1; } /// Returns true if active inline bool active() const { return (state_&2) != 0; } /// Sets true if active inline void setActive(bool yesNo) { if (yesNo) state_ |= 2; else state_ &= ~2; } /// Get state (really for debug) inline int getState() const { return state_;} /// Set state (really for debug) inline void setState(int value) { state_ = value;} /// Print void print() const; /// Debug inline void checkInfo() const { assert (nodeInfo_->numberBranchesLeft() == branch_->numberBranchesLeft()); } private: // Data /// Information to make basis and bounds CbcNodeInfo * nodeInfo_; /// Objective value double objectiveValue_; /// Guessed satisfied Objective value double guessedObjectiveValue_; /// Sum of "infeasibilities" reported by each object double sumInfeasibilities_; /// Branching object for this node OsiBranchingObject * branch_; /// Depth of the node in the search tree int depth_; /// The number of objects unsatisfied at this node. int numberUnsatisfied_; /// The node number int nodeNumber_; /** State 1 - on tree 2 - active */ int state_; }; #endif CoinMP-1.8.3/Cbc/src/CbcFathom.hpp0000644000175000017500000000652512130274306015137 0ustar renerene/* $Id: CbcFathom.hpp 1889 2013-04-07 13:46:46Z stefan $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcFathom_H #define CbcFathom_H #include "CbcConfig.h" /* This file contains two classes, CbcFathom and CbcOsiSolver. It's unclear why they're in the same file. CbcOsiSolver is a base class for CbcLinked. --lh, 071031 -- */ class CbcModel; //############################################################################# /** Fathom base class. The idea is that after some branching the problem will be effectively smaller than the original problem and maybe there will be a more specialized technique which can completely fathom this branch quickly. One method is to presolve the problem to give a much smaller new problem and then do branch and cut on that. Another might be dynamic programming. */ class CbcFathom { public: // Default Constructor CbcFathom (); // Constructor with model - assumed before cuts CbcFathom (CbcModel & model); virtual ~CbcFathom(); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); /// Clone virtual CbcFathom * clone() const = 0; /// Resets stuff if model changes virtual void resetModel(CbcModel * model) = 0; /** returns 0 if no fathoming attempted, 1 fully fathomed, 2 incomplete search, 3 incomplete search but treat as complete. If solution then newSolution will not be NULL and will be freed by CbcModel. It is expected that the solution is better than best so far but CbcModel will double check. If returns 3 then of course there is no guarantee of global optimum */ virtual int fathom(double *& newSolution) = 0; // Is this method possible inline bool possible() const { return possible_; } protected: /// Model CbcModel * model_; /// Possible - if this method of fathoming can be used bool possible_; private: /// Illegal Assignment operator CbcFathom & operator=(const CbcFathom& rhs); }; #include "OsiClpSolverInterface.hpp" //############################################################################# /** This is for codes where solver needs to know about CbcModel Seems to provide only one value-added feature, a CbcModel object. */ class CbcOsiSolver : public OsiClpSolverInterface { public: /**@name Constructors and destructors */ //@{ /// Default Constructor CbcOsiSolver (); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor CbcOsiSolver (const CbcOsiSolver &); /// Assignment operator CbcOsiSolver & operator=(const CbcOsiSolver& rhs); /// Destructor virtual ~CbcOsiSolver (); //@} /**@name Sets and Gets */ //@{ /// Set Cbc Model inline void setCbcModel(CbcModel * model) { cbcModel_ = model; } /// Return Cbc Model inline CbcModel * cbcModel() const { return cbcModel_; } //@} //--------------------------------------------------------------------------- protected: /**@name Private member data */ //@{ /// Pointer back to CbcModel CbcModel * cbcModel_; //@} }; #endif CoinMP-1.8.3/Cbc/src/CbcFathomDynamicProgramming.hpp0000644000175000017500000001331711510742604020646 0ustar renerene/* $Id: CbcFathomDynamicProgramming.hpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcFathomDynamicProgramming_H #define CbcFathomDynamicProgramming_H #include "CbcFathom.hpp" //############################################################################# /** FathomDynamicProgramming class. The idea is that after some branching the problem will be effectively smaller than the original problem and maybe there will be a more specialized technique which can completely fathom this branch quickly. This is a dynamic programming implementation which is very fast for some specialized problems. It expects small integral rhs, an all integer problem and positive integral coefficients. At present it can not do general set covering problems just set partitioning. It can find multiple optima for various rhs combinations. The main limiting factor is size of state space. Each 1 rhs doubles the size of the problem. 2 or 3 rhs quadruples, 4,5,6,7 by 8 etc. */ class CbcFathomDynamicProgramming : public CbcFathom { public: // Default Constructor CbcFathomDynamicProgramming (); // Constructor with model - assumed before cuts CbcFathomDynamicProgramming (CbcModel & model); // Copy constructor CbcFathomDynamicProgramming(const CbcFathomDynamicProgramming & rhs); virtual ~CbcFathomDynamicProgramming(); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); /// Clone virtual CbcFathom * clone() const; /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /** returns 0 if no fathoming attempted, 1 fully fathomed , 2 incomplete search, 3 incomplete search but treat as complete. If solution then newSolution will not be NULL and will be freed by CbcModel. It is expected that the solution is better than best so far but CbcModel will double check. If returns 3 then of course there is no guarantee of global optimum */ virtual int fathom(double *& newSolution); /// Maximum size allowed inline int maximumSize() const { return maximumSizeAllowed_; } inline void setMaximumSize(int value) { maximumSizeAllowed_ = value; } /// Returns type of algorithm and sets up arrays int checkPossible(int allowableSize = 0); // set algorithm inline void setAlgorithm(int value) { algorithm_ = value; } /** Tries a column returns true if was used in making any changes. */ bool tryColumn(int numberElements, const int * rows, const double * coefficients, double cost, int upper = COIN_INT_MAX); /// Returns cost array inline const double * cost() const { return cost_; } /// Returns back array inline const int * back() const { return back_; } /// Gets bit pattern for target result inline int target() const { return target_; } /// Sets bit pattern for target result inline void setTarget(int value) { target_ = value; } private: /// Does deleteions void gutsOfDelete(); /** Adds one attempt of one column of type 0, returns true if was used in making any changes */ bool addOneColumn0(int numberElements, const int * rows, double cost); /** Adds one attempt of one column of type 1, returns true if was used in making any changes. At present the user has to call it once for each possible value */ bool addOneColumn1(int numberElements, const int * rows, const int * coefficients, double cost); /** Adds one attempt of one column of type 1, returns true if was used in making any changes. At present the user has to call it once for each possible value. This version is when there are enough 1 rhs to do faster */ bool addOneColumn1A(int numberElements, const int * rows, const int * coefficients, double cost); /// Gets bit pattern from original column int bitPattern(int numberElements, const int * rows, const int * coefficients); /// Gets bit pattern from original column int bitPattern(int numberElements, const int * rows, const double * coefficients); /// Fills in original column (dense) from bit pattern - returning number nonzero int decodeBitPattern(int bitPattern, int * values, int numberRows); protected: /// Size of states (power of 2 unless just one constraint) int size_; /** Type - 0 coefficients and rhs all 1, 1 - coefficients > 1 or rhs > 1 */ int type_; /// Space for states double * cost_; /// Which state produced this cheapest one int * back_; /// Some rows may be satisified so we need a lookup int * lookup_; /// Space for sorted indices int * indices_; /// Number of active rows int numberActive_; /// Maximum size allowed int maximumSizeAllowed_; /// Start bit for each active row int * startBit_; /// Number bits for each active row int * numberBits_; /// Effective rhs int * rhs_; /// Space for sorted coefficients int * coefficients_; /// Target pattern int target_; /// Number of Non 1 rhs int numberNonOne_; /// Current bit pattern int bitPattern_; /// Current algorithm int algorithm_; private: /// Illegal Assignment operator CbcFathomDynamicProgramming & operator=(const CbcFathomDynamicProgramming& rhs); }; #endif CoinMP-1.8.3/Cbc/src/CbcSimpleIntegerPseudoCost.cpp0000644000175000017500000002123212131054770020466 0ustar renerene// $Id: CbcSimpleIntegerPseudoCost.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcSimpleIntegerPseudoCost.hpp" #include "CbcSimpleIntegerDynamicPseudoCost.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## /** Default Constructor Equivalent to an unspecified binary variable. */ CbcSimpleIntegerPseudoCost::CbcSimpleIntegerPseudoCost () : CbcSimpleInteger(), downPseudoCost_(1.0e-5), upPseudoCost_(1.0e-5), upDownSeparator_(-1.0), method_(0) { } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ CbcSimpleIntegerPseudoCost::CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn, double breakEven) : CbcSimpleInteger(model, iColumn, breakEven) { const double * cost = model->getObjCoefficients(); double costValue = CoinMax(1.0e-5, fabs(cost[iColumn])); // treat as if will cost what it says up upPseudoCost_ = costValue; // and balance at breakeven downPseudoCost_ = ((1.0 - breakEven_) * upPseudoCost_) / breakEven_; upDownSeparator_ = -1.0; method_ = 0; } /** Useful constructor Loads actual upper & lower bounds for the specified variable. */ CbcSimpleIntegerPseudoCost::CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn, double downPseudoCost, double upPseudoCost) : CbcSimpleInteger(model, iColumn) { downPseudoCost_ = CoinMax(1.0e-10, downPseudoCost); upPseudoCost_ = CoinMax(1.0e-10, upPseudoCost); breakEven_ = upPseudoCost_ / (upPseudoCost_ + downPseudoCost_); upDownSeparator_ = -1.0; method_ = 0; } // Useful constructor - passed and model index and pseudo costs CbcSimpleIntegerPseudoCost::CbcSimpleIntegerPseudoCost (CbcModel * model, int /*dummy*/, int iColumn, double downPseudoCost, double upPseudoCost) { *this = CbcSimpleIntegerPseudoCost(model, iColumn, downPseudoCost, upPseudoCost); columnNumber_ = iColumn; } // Copy constructor CbcSimpleIntegerPseudoCost::CbcSimpleIntegerPseudoCost ( const CbcSimpleIntegerPseudoCost & rhs) : CbcSimpleInteger(rhs), downPseudoCost_(rhs.downPseudoCost_), upPseudoCost_(rhs.upPseudoCost_), upDownSeparator_(rhs.upDownSeparator_), method_(rhs.method_) { } // Clone CbcObject * CbcSimpleIntegerPseudoCost::clone() const { return new CbcSimpleIntegerPseudoCost(*this); } // Assignment operator CbcSimpleIntegerPseudoCost & CbcSimpleIntegerPseudoCost::operator=( const CbcSimpleIntegerPseudoCost & rhs) { if (this != &rhs) { CbcSimpleInteger::operator=(rhs); downPseudoCost_ = rhs.downPseudoCost_; upPseudoCost_ = rhs.upPseudoCost_; upDownSeparator_ = rhs.upDownSeparator_; method_ = rhs.method_; } return *this; } // Destructor CbcSimpleIntegerPseudoCost::~CbcSimpleIntegerPseudoCost () { } CbcBranchingObject * CbcSimpleIntegerPseudoCost::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * /*info*/, int way) { //OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); #ifndef NDEBUG double nearest = floor(value + 0.5); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); assert (upper[columnNumber_] > lower[columnNumber_]); #endif if (!model_->hotstartSolution()) { assert (fabs(value - nearest) > integerTolerance); } else { const double * hotstartSolution = model_->hotstartSolution(); double targetValue = hotstartSolution[columnNumber_]; if (way > 0) value = targetValue - 0.1; else value = targetValue + 0.1; } CbcIntegerPseudoCostBranchingObject * newObject = new CbcIntegerPseudoCostBranchingObject(model_, columnNumber_, way, value); double up = upPseudoCost_ * (ceil(value) - value); double down = downPseudoCost_ * (value - floor(value)); double changeInGuessed = up - down; if (way > 0) changeInGuessed = - changeInGuessed; changeInGuessed = CoinMax(0.0, changeInGuessed); //if (way>0) //changeInGuessed += 1.0e8; // bias to stay up newObject->setChangeInGuessed(changeInGuessed); newObject->setOriginalObject(this); return newObject; } double CbcSimpleIntegerPseudoCost::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const { OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); if (upper[columnNumber_] == lower[columnNumber_]) { // fixed preferredWay = 1; return 0.0; } double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); /*printf("%d %g %g %g %g\n",columnNumber_,value,lower[columnNumber_], solution[columnNumber_],upper[columnNumber_]);*/ double nearest = floor(value + 0.5); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double below = floor(value + integerTolerance); double above = below + 1.0; if (above > upper[columnNumber_]) { above = below; below = above - 1; } double downCost = CoinMax((value - below) * downPseudoCost_, 0.0); double upCost = CoinMax((above - value) * upPseudoCost_, 0.0); if (downCost >= upCost) preferredWay = 1; else preferredWay = -1; // See if up down choice set if (upDownSeparator_ > 0.0) { preferredWay = (value - below >= upDownSeparator_) ? 1 : -1; } if (preferredWay_) preferredWay = preferredWay_; if (fabs(value - nearest) <= integerTolerance) { return 0.0; } else { // can't get at model so 1,2 don't make sense assert(method_ < 1 || method_ > 2); if (!method_) return CoinMin(downCost, upCost); else return CoinMax(downCost, upCost); } } // Return "up" estimate double CbcSimpleIntegerPseudoCost::upEstimate() const { OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); if (upper[columnNumber_] == lower[columnNumber_]) { // fixed return 0.0; } double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double below = floor(value + integerTolerance); double above = below + 1.0; if (above > upper[columnNumber_]) { above = below; below = above - 1; } double upCost = CoinMax((above - value) * upPseudoCost_, 0.0); return upCost; } // Return "down" estimate double CbcSimpleIntegerPseudoCost::downEstimate() const { OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); if (upper[columnNumber_] == lower[columnNumber_]) { // fixed return 0.0; } double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double below = floor(value + integerTolerance); double above = below + 1.0; if (above > upper[columnNumber_]) { above = below; below = above - 1; } double downCost = CoinMax((value - below) * downPseudoCost_, 0.0); return downCost; } CoinMP-1.8.3/Cbc/src/CbcHeuristicGreedy.cpp0000644000175000017500000017227612432625130017022 0ustar renerene/* $Id: CbcHeuristicGreedy.cpp 2094 2014-11-18 11:15:36Z forrest $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcStrategy.hpp" #include "CbcHeuristicGreedy.hpp" #include "CoinSort.hpp" #include "CglPreProcess.hpp" // Default Constructor CbcHeuristicGreedyCover::CbcHeuristicGreedyCover() : CbcHeuristic() { // matrix will automatically be empty originalNumberRows_ = 0; algorithm_ = 0; numberTimes_ = 100; } // Constructor from model CbcHeuristicGreedyCover::CbcHeuristicGreedyCover(CbcModel & model) : CbcHeuristic(model) { gutsOfConstructor(&model); algorithm_ = 0; numberTimes_ = 100; whereFrom_ = 1; } // Destructor CbcHeuristicGreedyCover::~CbcHeuristicGreedyCover () { } // Clone CbcHeuristic * CbcHeuristicGreedyCover::clone() const { return new CbcHeuristicGreedyCover(*this); } // Guts of constructor from a CbcModel void CbcHeuristicGreedyCover::gutsOfConstructor(CbcModel * model) { model_ = model; // Get a copy of original matrix assert(model->solver()); if (model->solver()->getNumRows()) { matrix_ = *model->solver()->getMatrixByCol(); } originalNumberRows_ = model->solver()->getNumRows(); } // Create C++ lines to get to current state void CbcHeuristicGreedyCover::generateCpp( FILE * fp) { CbcHeuristicGreedyCover other; fprintf(fp, "0#include \"CbcHeuristicGreedy.hpp\"\n"); fprintf(fp, "3 CbcHeuristicGreedyCover heuristicGreedyCover(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicGreedyCover"); if (algorithm_ != other.algorithm_) fprintf(fp, "3 heuristicGreedyCover.setAlgorithm(%d);\n", algorithm_); else fprintf(fp, "4 heuristicGreedyCover.setAlgorithm(%d);\n", algorithm_); if (numberTimes_ != other.numberTimes_) fprintf(fp, "3 heuristicGreedyCover.setNumberTimes(%d);\n", numberTimes_); else fprintf(fp, "4 heuristicGreedyCover.setNumberTimes(%d);\n", numberTimes_); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicGreedyCover);\n"); } // Copy constructor CbcHeuristicGreedyCover::CbcHeuristicGreedyCover(const CbcHeuristicGreedyCover & rhs) : CbcHeuristic(rhs), matrix_(rhs.matrix_), originalNumberRows_(rhs.originalNumberRows_), algorithm_(rhs.algorithm_), numberTimes_(rhs.numberTimes_) { } // Assignment operator CbcHeuristicGreedyCover & CbcHeuristicGreedyCover::operator=( const CbcHeuristicGreedyCover & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); matrix_ = rhs.matrix_; originalNumberRows_ = rhs.originalNumberRows_; algorithm_ = rhs.algorithm_; numberTimes_ = rhs.numberTimes_; } return *this; } // Returns 1 if solution, 0 if not int CbcHeuristicGreedyCover::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; if (!model_) return 0; // See if to do if (!when() || (when() == 1 && model_->phase() != 1)) return 0; // switched off if (model_->getNodeCount() > numberTimes_) return 0; #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif // See if at root node bool atRoot = model_->getNodeCount() == 0; int passNumber = model_->getCurrentPassNumber(); if (atRoot && passNumber > 1) return 0; OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); // And original upper bounds in case we want to use them const double * originalUpper = model_->continuousSolver()->getColUpper(); // But not if algorithm says so if ((algorithm_ % 10) == 0) originalUpper = columnUpper; const double * rowLower = solver->getRowLower(); const double * solution = solver->getColSolution(); const double * objective = solver->getObjCoefficients(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); // This is number of rows when matrix was passed in int numberRows = originalNumberRows_; if (!numberRows) return 0; // switched off numRuns_++; assert (numberRows == matrix_.getNumRows()); int iRow, iColumn; double direction = solver->getObjSense(); double offset; solver->getDblParam(OsiObjOffset, offset); double newSolutionValue = -offset; int returnCode = 0; // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Get solution array for heuristic solution int numberColumns = solver->getNumCols(); double * newSolution = new double [numberColumns]; double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); bool allOnes = true; // Get rounded down solution for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double value = solution[iColumn]; if (solver->isInteger(iColumn)) { // Round down integer if (fabs(floor(value + 0.5) - value) < integerTolerance) { value = floor(CoinMax(value + 1.0e-3, columnLower[iColumn])); } else { value = CoinMax(floor(value), columnLower[iColumn]); } } // make sure clean value = CoinMin(value, columnUpper[iColumn]); value = CoinMax(value, columnLower[iColumn]); newSolution[iColumn] = value; double cost = direction * objective[iColumn]; newSolutionValue += value * cost; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; if (element[j] != 1.0) allOnes = false; } } // See if we round up bool roundup = ((algorithm_ % 100) != 0); if (roundup && allOnes) { // Get rounded up solution for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double value = solution[iColumn]; if (solver->isInteger(iColumn)) { // but round up if no activity if (roundup && value >= 0.499999 && !newSolution[iColumn]) { bool choose = true; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (rowActivity[iRow]) { choose = false; break; } } if (choose) { newSolution[iColumn] = 1.0; double cost = direction * objective[iColumn]; newSolutionValue += cost; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += 1.0; } } } } } } // Get initial list int * which = new int [numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) which[iColumn] = iColumn; int numberLook = numberColumns; // See if we want to perturb more double perturb = ((algorithm_ % 10) == 0) ? 0.1 : 0.25; // Keep going round until a solution while (true) { // Get column with best ratio int bestColumn = -1; double bestRatio = COIN_DBL_MAX; double bestStepSize = 0.0; int newNumber = 0; for (int jColumn = 0; jColumn < numberLook; jColumn++) { int iColumn = which[jColumn]; CoinBigIndex j; double value = newSolution[iColumn]; double cost = direction * objective[iColumn]; if (solver->isInteger(iColumn)) { // use current upper or original upper if (value + 0.99 < originalUpper[iColumn]) { double sum = 0.0; int numberExact = 0; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double gap = rowLower[iRow] - rowActivity[iRow]; double elementValue = allOnes ? 1.0 : element[j]; if (gap > 1.0e-7) { sum += CoinMin(elementValue, gap); if (fabs(elementValue - gap) < 1.0e-7) numberExact++; } } // could bias if exact if (sum > 0.0) { // add to next time which[newNumber++] = iColumn; double ratio = (cost / sum) * (1.0 + perturb * randomNumberGenerator_.randomDouble()); // If at root choose first if (atRoot) ratio = iColumn; if (ratio < bestRatio) { bestRatio = ratio; bestColumn = iColumn; bestStepSize = 1.0; } } } } else { // continuous if (value < columnUpper[iColumn]) { // Go through twice - first to get step length double step = 1.0e50; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (rowActivity[iRow] < rowLower[iRow] - 1.0e-10 && element[j]*step + rowActivity[iRow] >= rowLower[iRow]) { step = (rowLower[iRow] - rowActivity[iRow]) / element[j];; } } // now ratio if (step < 1.0e50) { // add to next time which[newNumber++] = iColumn; assert (step > 0.0); double sum = 0.0; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double newActivity = element[j] * step + rowActivity[iRow]; if (rowActivity[iRow] < rowLower[iRow] - 1.0e-10 && newActivity >= rowLower[iRow] - 1.0e-12) { sum += element[j]; } } assert (sum > 0.0); double ratio = (cost / sum) * (1.0 + perturb * randomNumberGenerator_.randomDouble()); if (ratio < bestRatio) { bestRatio = ratio; bestColumn = iColumn; bestStepSize = step; } } } } } if (bestColumn < 0) break; // we have finished // Increase chosen column newSolution[bestColumn] += bestStepSize; double cost = direction * objective[bestColumn]; newSolutionValue += bestStepSize * cost; for (CoinBigIndex j = columnStart[bestColumn]; j < columnStart[bestColumn] + columnLength[bestColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += bestStepSize * element[j]; } } delete [] which; if (newSolutionValue < solutionValue) { // check feasible memset(rowActivity, 0, numberRows*sizeof(double)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double value = newSolution[iColumn]; if (value) { for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } // check was approximately feasible bool feasible = true; for (iRow = 0; iRow < numberRows; iRow++) { if (rowActivity[iRow] < rowLower[iRow]) { if (rowActivity[iRow] < rowLower[iRow] - 10.0*primalTolerance) feasible = false; } } if (feasible) { // new solution memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); solutionValue = newSolutionValue; //printf("** Solution of %g found by rounding\n",newSolutionValue); returnCode = 1; } else { // Can easily happen //printf("Debug CbcHeuristicGreedyCover giving bad solution\n"); } } delete [] newSolution; delete [] rowActivity; return returnCode; } // update model void CbcHeuristicGreedyCover::setModel(CbcModel * model) { gutsOfConstructor(model); validate(); } // Resets stuff if model changes void CbcHeuristicGreedyCover::resetModel(CbcModel * model) { gutsOfConstructor(model); } // Validate model i.e. sets when_ to 0 if necessary (may be NULL) void CbcHeuristicGreedyCover::validate() { if (model_ && when() < 10) { if (model_->numberIntegers() != model_->numberObjects() && (model_->numberObjects() || (model_->specialOptions()&1024) == 0)) { int numberOdd = 0; for (int i = 0; i < model_->numberObjects(); i++) { if (!model_->object(i)->canDoHeuristics()) numberOdd++; } if (numberOdd) setWhen(0); } // Only works if costs positive, coefficients positive and all rows G OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); const double * rowUpper = solver->getRowUpper(); const double * objective = solver->getObjCoefficients(); double direction = solver->getObjSense(); int numberRows = solver->getNumRows(); int numberColumns = solver->getNumCols(); // Column copy matrix_.setDimensions(numberRows,numberColumns); const double * element = matrix_.getElements(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); bool good = true; for (int iRow = 0; iRow < numberRows; iRow++) { if (rowUpper[iRow] < 1.0e30) good = false; } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (objective[iColumn]*direction < 0.0) good = false; if (columnLower[iColumn] < 0.0) good = false; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (element[j] < 0.0) good = false; } } if (!good) setWhen(0); // switch off } } // Default Constructor CbcHeuristicGreedyEquality::CbcHeuristicGreedyEquality() : CbcHeuristic() { // matrix will automatically be empty fraction_ = 1.0; // no branch and bound originalNumberRows_ = 0; algorithm_ = 0; numberTimes_ = 100; whereFrom_ = 1; } // Constructor from model CbcHeuristicGreedyEquality::CbcHeuristicGreedyEquality(CbcModel & model) : CbcHeuristic(model) { // Get a copy of original matrix gutsOfConstructor(&model); fraction_ = 1.0; // no branch and bound algorithm_ = 0; numberTimes_ = 100; whereFrom_ = 1; } // Destructor CbcHeuristicGreedyEquality::~CbcHeuristicGreedyEquality () { } // Clone CbcHeuristic * CbcHeuristicGreedyEquality::clone() const { return new CbcHeuristicGreedyEquality(*this); } // Guts of constructor from a CbcModel void CbcHeuristicGreedyEquality::gutsOfConstructor(CbcModel * model) { model_ = model; // Get a copy of original matrix assert(model->solver()); if (model->solver()->getNumRows()) { matrix_ = *model->solver()->getMatrixByCol(); } originalNumberRows_ = model->solver()->getNumRows(); } // Create C++ lines to get to current state void CbcHeuristicGreedyEquality::generateCpp( FILE * fp) { CbcHeuristicGreedyEquality other; fprintf(fp, "0#include \"CbcHeuristicGreedy.hpp\"\n"); fprintf(fp, "3 CbcHeuristicGreedyEquality heuristicGreedyEquality(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicGreedyEquality"); if (algorithm_ != other.algorithm_) fprintf(fp, "3 heuristicGreedyEquality.setAlgorithm(%d);\n", algorithm_); else fprintf(fp, "4 heuristicGreedyEquality.setAlgorithm(%d);\n", algorithm_); if (fraction_ != other.fraction_) fprintf(fp, "3 heuristicGreedyEquality.setFraction(%g);\n", fraction_); else fprintf(fp, "4 heuristicGreedyEquality.setFraction(%g);\n", fraction_); if (numberTimes_ != other.numberTimes_) fprintf(fp, "3 heuristicGreedyEquality.setNumberTimes(%d);\n", numberTimes_); else fprintf(fp, "4 heuristicGreedyEquality.setNumberTimes(%d);\n", numberTimes_); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicGreedyEquality);\n"); } // Copy constructor CbcHeuristicGreedyEquality::CbcHeuristicGreedyEquality(const CbcHeuristicGreedyEquality & rhs) : CbcHeuristic(rhs), matrix_(rhs.matrix_), fraction_(rhs.fraction_), originalNumberRows_(rhs.originalNumberRows_), algorithm_(rhs.algorithm_), numberTimes_(rhs.numberTimes_) { } // Assignment operator CbcHeuristicGreedyEquality & CbcHeuristicGreedyEquality::operator=( const CbcHeuristicGreedyEquality & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); matrix_ = rhs.matrix_; fraction_ = rhs.fraction_; originalNumberRows_ = rhs.originalNumberRows_; algorithm_ = rhs.algorithm_; numberTimes_ = rhs.numberTimes_; } return *this; } // Returns 1 if solution, 0 if not int CbcHeuristicGreedyEquality::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; if (!model_) return 0; // See if to do if (!when() || (when() == 1 && model_->phase() != 1)) return 0; // switched off if (model_->getNodeCount() > numberTimes_) return 0; // See if at root node bool atRoot = model_->getNodeCount() == 0; int passNumber = model_->getCurrentPassNumber(); if (atRoot && passNumber > 1) return 0; OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); // And original upper bounds in case we want to use them const double * originalUpper = model_->continuousSolver()->getColUpper(); // But not if algorithm says so if ((algorithm_ % 10) == 0) originalUpper = columnUpper; const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); const double * solution = solver->getColSolution(); const double * objective = solver->getObjCoefficients(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); // This is number of rows when matrix was passed in int numberRows = originalNumberRows_; if (!numberRows) return 0; // switched off numRuns_++; assert (numberRows == matrix_.getNumRows()); int iRow, iColumn; double direction = solver->getObjSense(); double offset; solver->getDblParam(OsiObjOffset, offset); double newSolutionValue = -offset; int returnCode = 0; // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); // Get solution array for heuristic solution int numberColumns = solver->getNumCols(); double * newSolution = new double [numberColumns]; double * rowActivity = new double[numberRows]; memset(rowActivity, 0, numberRows*sizeof(double)); double rhsNeeded = 0; for (iRow = 0; iRow < numberRows; iRow++) rhsNeeded += rowUpper[iRow]; rhsNeeded *= fraction_; bool allOnes = true; // Get rounded down solution for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double value = solution[iColumn]; if (solver->isInteger(iColumn)) { // Round down integer if (fabs(floor(value + 0.5) - value) < integerTolerance) { value = floor(CoinMax(value + 1.0e-3, columnLower[iColumn])); } else { value = CoinMax(floor(value), columnLower[iColumn]); } } // make sure clean value = CoinMin(value, columnUpper[iColumn]); value = CoinMax(value, columnLower[iColumn]); newSolution[iColumn] = value; double cost = direction * objective[iColumn]; newSolutionValue += value * cost; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; rhsNeeded -= value * element[j]; if (element[j] != 1.0) allOnes = false; } } // See if we round up bool roundup = ((algorithm_ % 100) != 0); if (roundup && allOnes) { // Get rounded up solution for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double value = solution[iColumn]; if (solver->isInteger(iColumn)) { // but round up if no activity if (roundup && value >= 0.6 && !newSolution[iColumn]) { bool choose = true; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (rowActivity[iRow]) { choose = false; break; } } if (choose) { newSolution[iColumn] = 1.0; double cost = direction * objective[iColumn]; newSolutionValue += cost; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += 1.0; rhsNeeded -= 1.0; } } } } } } // Get initial list int * which = new int [numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) which[iColumn] = iColumn; int numberLook = numberColumns; // See if we want to perturb more double perturb = ((algorithm_ % 10) == 0) ? 0.1 : 0.25; // Keep going round until a solution while (true) { // Get column with best ratio int bestColumn = -1; double bestRatio = COIN_DBL_MAX; double bestStepSize = 0.0; int newNumber = 0; for (int jColumn = 0; jColumn < numberLook; jColumn++) { int iColumn = which[jColumn]; CoinBigIndex j; double value = newSolution[iColumn]; double cost = direction * objective[iColumn]; if (solver->isInteger(iColumn)) { // use current upper or original upper if (value + 0.9999 < originalUpper[iColumn]) { double movement = 1.0; double sum = 0.0; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double gap = rowUpper[iRow] - rowActivity[iRow]; double elementValue = allOnes ? 1.0 : element[j]; sum += elementValue; if (movement*elementValue > gap) { movement = gap / elementValue; } } if (movement > 0.999999) { // add to next time which[newNumber++] = iColumn; double ratio = (cost / sum) * (1.0 + perturb * randomNumberGenerator_.randomDouble()); // If at root if (atRoot) { if (fraction_ == 1.0) ratio = iColumn; // choose first else ratio = - solution[iColumn]; // choose largest } if (ratio < bestRatio) { bestRatio = ratio; bestColumn = iColumn; bestStepSize = 1.0; } } } } else { // continuous if (value < columnUpper[iColumn]) { double movement = 1.0e50; double sum = 0.0; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (element[j]*movement + rowActivity[iRow] > rowUpper[iRow]) { movement = (rowUpper[iRow] - rowActivity[iRow]) / element[j];; } sum += element[j]; } // now ratio if (movement > 1.0e-7) { // add to next time which[newNumber++] = iColumn; double ratio = (cost / sum) * (1.0 + perturb * randomNumberGenerator_.randomDouble()); if (ratio < bestRatio) { bestRatio = ratio; bestColumn = iColumn; bestStepSize = movement; } } } } } if (bestColumn < 0) break; // we have finished // Increase chosen column newSolution[bestColumn] += bestStepSize; double cost = direction * objective[bestColumn]; newSolutionValue += bestStepSize * cost; for (CoinBigIndex j = columnStart[bestColumn]; j < columnStart[bestColumn] + columnLength[bestColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += bestStepSize * element[j]; rhsNeeded -= bestStepSize * element[j]; } if (rhsNeeded < 1.0e-8) break; } delete [] which; if (fraction_ < 1.0 && rhsNeeded < 1.0e-8 && newSolutionValue < solutionValue) { // do branch and cut // fix all nonzero OsiSolverInterface * newSolver = model_->continuousSolver()->clone(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (newSolver->isInteger(iColumn)) newSolver->setColLower(iColumn, newSolution[iColumn]); } int returnCode = smallBranchAndBound(newSolver, 200, newSolution, newSolutionValue, solutionValue, "CbcHeuristicGreedy"); if (returnCode < 0) returnCode = 0; // returned on size if ((returnCode&2) != 0) { // could add cut returnCode &= ~2; } rhsNeeded = 1.0 - returnCode; delete newSolver; } if (newSolutionValue < solutionValue && rhsNeeded < 1.0e-8) { // check feasible memset(rowActivity, 0, numberRows*sizeof(double)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double value = newSolution[iColumn]; if (value) { for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } // check was approximately feasible bool feasible = true; for (iRow = 0; iRow < numberRows; iRow++) { if (rowActivity[iRow] < rowLower[iRow]) { if (rowActivity[iRow] < rowLower[iRow] - 10.0*primalTolerance) feasible = false; } } if (feasible) { // new solution memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); solutionValue = newSolutionValue; returnCode = 1; } } delete [] newSolution; delete [] rowActivity; if (atRoot && fraction_ == 1.0) { // try quick search fraction_ = 0.4; int newCode = this->solution(solutionValue, betterSolution); if (newCode) returnCode = 1; fraction_ = 1.0; } return returnCode; } // update model void CbcHeuristicGreedyEquality::setModel(CbcModel * model) { gutsOfConstructor(model); validate(); } // Resets stuff if model changes void CbcHeuristicGreedyEquality::resetModel(CbcModel * model) { gutsOfConstructor(model); } // Validate model i.e. sets when_ to 0 if necessary (may be NULL) void CbcHeuristicGreedyEquality::validate() { if (model_ && when() < 10) { if (model_->numberIntegers() != model_->numberObjects()) setWhen(0); // Only works if costs positive, coefficients positive and all rows E or L // And if values are integer OsiSolverInterface * solver = model_->solver(); const double * columnLower = solver->getColLower(); const double * rowUpper = solver->getRowUpper(); const double * rowLower = solver->getRowLower(); const double * objective = solver->getObjCoefficients(); double direction = solver->getObjSense(); int numberRows = solver->getNumRows(); int numberColumns = solver->getNumCols(); matrix_.setDimensions(numberRows,numberColumns); // Column copy const double * element = matrix_.getElements(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); bool good = true; for (int iRow = 0; iRow < numberRows; iRow++) { if (rowUpper[iRow] > 1.0e30) good = false; if (rowLower[iRow] > 0.0 && rowLower[iRow] != rowUpper[iRow]) good = false; if (floor(rowUpper[iRow] + 0.5) != rowUpper[iRow]) good = false; } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (objective[iColumn]*direction < 0.0) good = false; if (columnLower[iColumn] < 0.0) good = false; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (element[j] < 0.0) good = false; if (floor(element[j] + 0.5) != element[j]) good = false; } } if (!good) setWhen(0); // switch off } } // Default Constructor CbcHeuristicGreedySOS::CbcHeuristicGreedySOS() : CbcHeuristic() { originalRhs_ = NULL; // matrix will automatically be empty originalNumberRows_ = 0; algorithm_ = 0; numberTimes_ = 100; } // Constructor from model CbcHeuristicGreedySOS::CbcHeuristicGreedySOS(CbcModel & model) : CbcHeuristic(model) { gutsOfConstructor(&model); algorithm_ = 2; numberTimes_ = 100; whereFrom_ = 1; } // Destructor CbcHeuristicGreedySOS::~CbcHeuristicGreedySOS () { delete [] originalRhs_; } // Clone CbcHeuristic * CbcHeuristicGreedySOS::clone() const { return new CbcHeuristicGreedySOS(*this); } // Guts of constructor from a CbcModel void CbcHeuristicGreedySOS::gutsOfConstructor(CbcModel * model) { model_ = model; // Get a copy of original matrix assert(model->solver()); if (model->solver()->getNumRows()) { matrix_ = *model->solver()->getMatrixByCol(); } originalNumberRows_ = model->solver()->getNumRows(); originalRhs_ = new double [originalNumberRows_]; } // Create C++ lines to get to current state void CbcHeuristicGreedySOS::generateCpp( FILE * fp) { CbcHeuristicGreedySOS other; fprintf(fp, "0#include \"CbcHeuristicGreedy.hpp\"\n"); fprintf(fp, "3 CbcHeuristicGreedySOS heuristicGreedySOS(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicGreedySOS"); if (algorithm_ != other.algorithm_) fprintf(fp, "3 heuristicGreedySOS.setAlgorithm(%d);\n", algorithm_); else fprintf(fp, "4 heuristicGreedySOS.setAlgorithm(%d);\n", algorithm_); if (numberTimes_ != other.numberTimes_) fprintf(fp, "3 heuristicGreedySOS.setNumberTimes(%d);\n", numberTimes_); else fprintf(fp, "4 heuristicGreedySOS.setNumberTimes(%d);\n", numberTimes_); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicGreedySOS);\n"); } // Copy constructor CbcHeuristicGreedySOS::CbcHeuristicGreedySOS(const CbcHeuristicGreedySOS & rhs) : CbcHeuristic(rhs), matrix_(rhs.matrix_), originalNumberRows_(rhs.originalNumberRows_), algorithm_(rhs.algorithm_), numberTimes_(rhs.numberTimes_) { originalRhs_ = CoinCopyOfArray(rhs.originalRhs_,originalNumberRows_); } // Assignment operator CbcHeuristicGreedySOS & CbcHeuristicGreedySOS::operator=( const CbcHeuristicGreedySOS & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); matrix_ = rhs.matrix_; originalNumberRows_ = rhs.originalNumberRows_; algorithm_ = rhs.algorithm_; numberTimes_ = rhs.numberTimes_; delete [] originalRhs_; originalRhs_ = CoinCopyOfArray(rhs.originalRhs_,originalNumberRows_); } return *this; } // Returns 1 if solution, 0 if not int CbcHeuristicGreedySOS::solution(double & solutionValue, double * betterSolution) { numCouldRun_++; if (!model_) return 0; // See if to do if (!when() || (when() == 1 && model_->phase() != 1)) return 0; // switched off if (model_->getNodeCount() > numberTimes_) return 0; // See if at root node bool atRoot = model_->getNodeCount() == 0; int passNumber = model_->getCurrentPassNumber(); if (atRoot && passNumber > 1) return 0; OsiSolverInterface * solver = model_->solver(); int numberColumns = solver->getNumCols(); // This is number of rows when matrix was passed in int numberRows = originalNumberRows_; if (!numberRows) return 0; // switched off const double * columnLower = solver->getColLower(); const double * columnUpper = solver->getColUpper(); // modified rhs double * rhs = CoinCopyOfArray(originalRhs_,numberRows); // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); int * sosRow = new int [numberColumns]; int nonSOS=0; // If bit set then use current if ((algorithm_&1)!=0) { const CoinPackedMatrix * matrix = solver->getMatrixByCol(); element = matrix->getElements(); row = matrix->getIndices(); columnStart = matrix->getVectorStarts(); columnLength = matrix->getVectorLengths(); //rhs = new double [numberRows]; const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); bool good = true; for (int iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow] == 1.0 && rowUpper[iRow] == 1.0) { // SOS rhs[iRow]=-1.0; } else if (rowLower[iRow] > 0.0 && rowUpper[iRow] < 1.0e10) { good = false; } else if (rowUpper[iRow] < 0.0) { good = false; } else if (rowUpper[iRow] < 1.0e10) { rhs[iRow]=rowUpper[iRow]; } else { rhs[iRow]=rowLower[iRow]; } } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!columnLength[iColumn]) continue; if (columnLower[iColumn] < 0.0 || columnUpper[iColumn] > 1.0) good = false; CoinBigIndex j; int nSOS=0; int iSOS=-1; if (!solver->isInteger(iColumn)) good = false; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (element[j] < 0.0) good = false; int iRow = row[j]; if (rhs[iRow]==-1.0) { if (element[j] != 1.0) good = false; iSOS=iRow; nSOS++; } } if (nSOS>1) good = false; else if (!nSOS) nonSOS++; sosRow[iColumn] = iSOS; } if (!good) { delete [] sosRow; delete [] rhs; setWhen(0); // switch off return 0; } } else { abort(); // not allowed yet } const double * solution = solver->getColSolution(); const double * objective = solver->getObjCoefficients(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double primalTolerance; solver->getDblParam(OsiPrimalTolerance, primalTolerance); numRuns_++; assert (numberRows == matrix_.getNumRows()); // set up linked list for sets int * firstGub = new int [numberRows]; int * nextGub = new int [numberColumns]; int iRow, iColumn; double direction = solver->getObjSense(); double * slackCost = new double [numberRows]; double * modifiedCost = CoinCopyOfArray(objective,numberColumns); for (int iRow = 0;iRow < numberRows; iRow++) { slackCost[iRow]=1.0e30; firstGub[iRow]=-1; } // Take off cost of gub slack for (int iColumn = 0; iColumn < numberColumns; iColumn++) { nextGub[iColumn]=-1; int iRow = sosRow[iColumn]; if (columnLength[iColumn] == 1&&iRow>=0) { // SOS slack double cost = direction*objective[iColumn]; assert (rhs[iRow]<0.0); slackCost[iRow]=CoinMin(slackCost[iRow],cost); } } double offset2 = 0.0; char * sos = new char [numberRows]; for (int iRow = 0;iRow < numberRows; iRow++) { sos[iRow]=0; if (rhs[iRow]<0.0) { sos[iRow]=1; rhs[iRow]=1.0; } else if (rhs[iRow] != rowUpper[iRow]) { // G row sos[iRow]=-1; } if( slackCost[iRow] == 1.0e30) { slackCost[iRow]=0.0; } else { offset2 += slackCost[iRow]; sos[iRow] = 2; } } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double cost = direction * modifiedCost[iColumn]; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (sos[iRow]>0) { cost -= slackCost[iRow]; if (firstGub[iRow]<0) { firstGub[iRow]=iColumn; } else { int jColumn = firstGub[iRow]; while (nextGub[jColumn]>=0) jColumn=nextGub[jColumn]; nextGub[jColumn]=iColumn; } // Only in one sos break; } } modifiedCost[iColumn] = cost; } delete [] slackCost; double offset; solver->getDblParam(OsiObjOffset, offset); double newSolutionValue = -offset+offset2; int returnCode = 0; // Get solution array for heuristic solution double * newSolution = new double [numberColumns]; double * rowActivity = new double[numberRows]; double * contribution = new double [numberColumns]; int * which = new int [numberColumns]; double * newSolution0 = new double [numberColumns]; if ((algorithm_&(2|4))==0) { // get solution as small as possible for (iColumn = 0; iColumn < numberColumns; iColumn++) newSolution0[iColumn] = columnLower[iColumn]; } else { // Get rounded down solution for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; // Round down integer if (fabs(floor(value + 0.5) - value) < integerTolerance) { value = floor(CoinMax(value + 1.0e-3, columnLower[iColumn])); } else { value = CoinMax(floor(value), columnLower[iColumn]); } // make sure clean value = CoinMin(value, columnUpper[iColumn]); value = CoinMax(value, columnLower[iColumn]); newSolution0[iColumn] = value; } } double * rowWeight = new double [numberRows]; for (int i=0;irowWeight[iRow]||(algorithm_&(2|4))!=0) forSort += element[j]; else forSort += 0.1*element[j]; #else forSort += rowWeight[iRow]*element[j]; #endif break; case 0: // L row if (gap 1.0e-24) forSort=1.0; // Use smallest cost if will fit if (willFit && (hasSlack||gRow) && value == 0.0 && columnUpper[iColumn]) { if (hasSlack && !gRow) { if (cost>1.0e-12) { forSort = 2.0e30; } else if (cost==1.0e-12) { if (!isSlack) forSort = 1.0e29; else forSort = 1.0e28; } else { forSort = cost/forSort; } } else { if (!gRow||true) forSort = (cost+costBias)/forSort; else forSort = 1.0e-12/forSort; } } else { // put at end forSort = 1.0e30; } which[iColumn]=iColumn; contribution[iColumn]= forSort; } CoinSort_2(contribution,contribution+numberColumns,which); // Go through columns int nAdded=0; int nSlacks=0; for (int jColumn = 0; jColumn < numberColumns; jColumn++) { if (contribution[jColumn]>=1.0e30) break; int iColumn = which[jColumn]; double value = newSolution[iColumn]; if (value) continue; bool possible = true; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (sos[iRow]>0&&rowActivity[iRow]) { possible = false; } else { double gap = rhs[iRow] - rowActivity[iRow]+1.0e-8; if (gap=0) possible = false; } } if (possible) { //#define REPORT 1 #ifdef REPORT if ((nAdded%1000)==0) { double gap=0.0; for (int i=0;i1.0e20) gap += CoinMax(rowLower[i]-rowActivity[i],0.0); } if (gap) printf("after %d added gap %g - %d slacks\n", nAdded,gap,nSlacks); } #endif nAdded++; if (columnLength[iColumn]==1) nSlacks++; // Increase chosen column newSolution[iColumn] = 1.0; double cost = modifiedCost[iColumn]; newSolutionValue += cost; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += element[j]; } } } #ifdef REPORT { double under=0.0; double over=0.0; double gap = 0.0; int nUnder=0; int nOver=0; int nGap=0; for (iRow = 0; iRow < numberRows; iRow++) { if (rowActivity[iRow] < rowLower[iRow] - 10.0*primalTolerance) { double value = rowLower[iRow]-rowActivity[iRow]; #if REPORT>1 printf("below on %d is %g - activity %g lower %g\n", iRow,value,rowActivity[iRow],rowLower[iRow]); #endif under += value; nUnder++; } else if (rowActivity[iRow] > rowUpper[iRow] + 10.0*primalTolerance) { double value = rowActivity[iRow]-rowUpper[iRow]; #if REPORT>1 printf("above on %d is %g - activity %g upper %g\n", iRow,value,rowActivity[iRow],rowUpper[iRow]); #endif over += value; nOver++; } else { double value = rowActivity[iRow]-rowLower[iRow]; if (value && value < 1.0e20) { #if REPORT>1 printf("gap on %d is %g - activity %g lower %g\n", iRow,value,rowActivity[iRow],rowLower[iRow]); #endif gap += value; nGap++; } } } printf("final under %g (%d) - over %g (%d) - free %g (%d) - %d added - solvalue %g\n", under,nUnder,over,nOver,gap,nGap,nAdded,newSolutionValue); } #endif double gap = 0.0; double over = 0.0; int nL=0; int nG=0; int nUnder=0; for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow]<-1.0e20) nL++; if (rowUpper[iRow]>1.0e20) nG++; if (rowActivity[iRow] < rowLower[iRow] - 10.0*primalTolerance) { gap += rowLower[iRow]-rowActivity[iRow]; nUnder++; rowWeight[iRow] *= 1.1; } else if (rowActivity[iRow] > rowUpper[iRow] + 10.0*primalTolerance) { gap += rowActivity[iRow]-rowUpper[iRow]; } else { over += rowActivity[iRow]-rowLower[iRow]; //rowWeight[iRow] *= 0.9; } } if (nG&&!nL) { // can we fix // get list of columns which can go down without making // things much worse int nPossible=0; int nEasyDown=0; int nSlackDown=0; for (int iColumn=0;iColumncolumnLower[iColumn]) { bool canGoDown=true; bool under = false; int iSos=-1; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (sos[iRow]<0) { double over = rowActivity[iRow]-rowLower[iRow]; if (over>=0.0&&element[j]>over+1.0e-12) { canGoDown=false; break; } else if (over<0.0) { under = true; } } else { iSos=iRow; } } if (canGoDown) { if (!under) { if (iSos>=0) { // find cheapest double cheapest=modifiedCost[iColumn]; int iCheapest = -1; int jColumn = firstGub[iSos]; assert (jColumn>=0); while (jColumn>=0) { if (modifiedCost[jColumn]=0) { // Decrease column newSolution[iColumn] = 0.0; newSolutionValue -= modifiedCost[iColumn]; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] -= element[j]; } // Increase chosen column newSolution[iCheapest] = 1.0; newSolutionValue += modifiedCost[iCheapest]; for (CoinBigIndex j = columnStart[iCheapest]; j < columnStart[iCheapest] + columnLength[iCheapest]; j++) { int iRow = row[j]; rowActivity[iRow] += element[j]; } nEasyDown++; if (columnLength[iColumn]>1) { //printf("%d is easy down\n",iColumn); } else { nSlackDown++; } } } else if (modifiedCost[iColumn]>0.0) { // easy down // Decrease column newSolution[iColumn] = 0.0; newSolutionValue -= modifiedCost[iColumn]; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] -= element[j]; } nEasyDown++; } } else { which[nPossible++]=iColumn; } } } } #ifdef REPORT printf("%d possible down, %d easy down of which %d are slacks\n", nPossible,nEasyDown,nSlackDown); #endif double * needed = new double [numberRows]; for (int i=0;icolumnLower[iColumn]) { int iSos=-1; double value=0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (sos[iRow]<0) { if (needed[iRow]) value += CoinMin(element[j]/needed[iRow],1.0); } else { iSos=iRow; } } if (value && iSos<0) { weight[nPossible]=-value; sort[nPossible++]=iColumn; } } } CoinSort_2(weight,weight+nPossible,sort); for (int i=0;ibestSolution()) { double * weight = new double [numberColumns]; int * sort = new int [numberColumns]; // look at ones in sets const double * goodSolution = model_->bestSolution(); int nPossible=0; double largestWeight=0.0; for (int iColumn=0;iColumncolumnLower[iColumn]) { int iSos=-1; double value=0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (sos[iRow]<0) { if (needed[iRow]) value += CoinMin(element[j]/needed[iRow],1.0); } else { iSos=iRow; } } if (value&&iSos>=0) { // see if value bigger than current int jColumn = firstGub[iSos]; assert (jColumn>=0); while (jColumn>=0) { if (newSolution[jColumn]) break; jColumn = nextGub[jColumn]; } assert (jColumn>=0); double value2=0.0; for (CoinBigIndex j = columnStart[jColumn]; j < columnStart[jColumn] + columnLength[jColumn]; j++) { int iRow = row[j]; if (needed[iRow]) value2 += CoinMin(element[j]/needed[iRow],1.0); } if (value>value2) { weight[nPossible]=-(value-value2); largestWeight = CoinMax(largestWeight,(value-value2)); sort[nPossible++]=iColumn; } } } } if (nPossible) { double * temp = new double [numberRows]; int * which2 = new int [numberRows]; memset(temp,0,numberRows*sizeof(double)); // modify so ones just more than gap best if (largestWeight>gap&&nUnder==1) { double offset = 4*largestWeight; for (int i=0;igap-1.0e-12) weight[i] = -(offset-(value-gap)); } } CoinSort_2(weight,weight+nPossible,sort); for (int i=0;i=0) { iSos=iRow; } } int jColumn = firstGub[iSos]; assert (jColumn>=0); while (jColumn>=0) { if (newSolution[jColumn]) break; jColumn = nextGub[jColumn]; } assert (jColumn>=0); for (CoinBigIndex j = columnStart[jColumn]; j < columnStart[jColumn] + columnLength[jColumn]; j++) { int iRow = row[j]; if (!temp[iRow]) which2[n++]=iRow; temp[iRow] -= element[j]; } double helps = 0.0; for (int i=0;i1.0e-8) { if (rowActivity[iRow]0.0) { newSolution[iColumn]=1.0; newSolution[jColumn]=0.0; newSolutionValue += modifiedCost[iColumn]-modifiedCost[jColumn]; for (int i=0;i1 printf("below on %d is %g - activity %g lower %g\n", iRow,value,rowActivity[iRow],rowLower[iRow]); #endif gap += value; } else if (rowActivity[iRow] > rowUpper[iRow] + 10.0*primalTolerance) { double value = rowActivity[iRow]-rowUpper[iRow]; #if REPORT>1 printf("above on %d is %g - activity %g upper %g\n", iRow,value,rowActivity[iRow],rowUpper[iRow]); #endif gap += value; } else { double value = rowActivity[iRow]-rowLower[iRow]; if (value) { #if REPORT>1 printf("over on %d is %g - activity %g lower %g\n", iRow,value,rowActivity[iRow],rowLower[iRow]); #endif over += value; } } } printf("modified final gap %g - over %g - %d added - solvalue %g\n", gap,over,nAdded,newSolutionValue); } #endif if (!gap) { break; } else { if (iPass==0) { costBias = 10.0*newSolutionValue/static_cast(nAdded); } else { costBias *= 10.0; } } } delete [] newSolution0; delete [] rowWeight; delete [] sos; delete [] firstGub; delete [] nextGub; if (newSolutionValue < solutionValue) { // check feasible memset(rowActivity, 0, numberRows*sizeof(double)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double value = newSolution[iColumn]; if (value) { for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; rowActivity[iRow] += value * element[j]; } } } // check was approximately feasible bool feasible = true; for (iRow = 0; iRow < numberRows; iRow++) { if (rowActivity[iRow] < rowLower[iRow]) { if (rowActivity[iRow] < rowLower[iRow] - 10.0*primalTolerance) feasible = false; } else if (rowActivity[iRow] > rowUpper[iRow]) { if (rowActivity[iRow] > rowUpper[iRow] + 10.0*primalTolerance) feasible = false; } } if (feasible) { // new solution memcpy(betterSolution, newSolution, numberColumns*sizeof(double)); solutionValue = newSolutionValue; //printf("** Solution of %g found by rounding\n",newSolutionValue); returnCode = 1; } else { // Can easily happen //printf("Debug CbcHeuristicGreedySOS giving bad solution\n"); } } delete [] sosRow; delete [] newSolution; delete [] rowActivity; delete [] modifiedCost; delete [] contribution; delete [] which; delete [] rhs; return returnCode; } // update model void CbcHeuristicGreedySOS::setModel(CbcModel * model) { delete [] originalRhs_; gutsOfConstructor(model); validate(); } // Resets stuff if model changes void CbcHeuristicGreedySOS::resetModel(CbcModel * model) { delete [] originalRhs_; gutsOfConstructor(model); } // Validate model i.e. sets when_ to 0 if necessary (may be NULL) void CbcHeuristicGreedySOS::validate() { if (model_ && when() < 10) { if (model_->numberIntegers() != model_->numberObjects() && (model_->numberObjects() || (model_->specialOptions()&1024) == 0)) { int numberOdd = 0; for (int i = 0; i < model_->numberObjects(); i++) { if (!model_->object(i)->canDoHeuristics()) numberOdd++; } if (numberOdd) setWhen(0); } // Only works if coefficients positive and all rows L/G or SOS OsiSolverInterface * solver = model_->solver(); const double * columnUpper = solver->getColUpper(); const double * columnLower = solver->getColLower(); const double * rowLower = solver->getRowLower(); const double * rowUpper = solver->getRowUpper(); int numberRows = solver->getNumRows(); // Column copy const double * element = matrix_.getElements(); const int * row = matrix_.getIndices(); const CoinBigIndex * columnStart = matrix_.getVectorStarts(); const int * columnLength = matrix_.getVectorLengths(); bool good = true; assert (originalRhs_); for (int iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow] == 1.0 && rowUpper[iRow] == 1.0) { // SOS originalRhs_[iRow]=-1.0; } else if (rowLower[iRow] > 0.0 && rowUpper[iRow] < 1.0e10) { good = false; } else if (rowUpper[iRow] < 0.0) { good = false; } else if (rowUpper[iRow] < 1.0e10) { originalRhs_[iRow]=rowUpper[iRow]; } else { originalRhs_[iRow]=rowLower[iRow]; } } int numberColumns = solver->getNumCols(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (!columnLength[iColumn]) continue; if (columnLower[iColumn] < 0.0 || columnUpper[iColumn] > 1.0) good = false; CoinBigIndex j; int nSOS=0; if (!solver->isInteger(iColumn)) good = false; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (element[j] < 0.0) good = false; int iRow = row[j]; if (originalRhs_[iRow]==-1.0) { if (element[j] != 1.0) good = false; nSOS++; } } if (nSOS > 1) good = false; } if (!good) setWhen(0); // switch off } } CoinMP-1.8.3/Cbc/src/OsiCbc/0000755000175000017500000000000012600453456013741 5ustar renereneCoinMP-1.8.3/Cbc/src/OsiCbc/Makefile.in0000644000175000017500000006566312547035070016024 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ # Plus the appropriate include directories for the default solver. @OSICBC_DFLT_SOLVER_CLP_TRUE@am__append_1 = ${CLP_CFLAGS} @OSICBC_DFLT_SOLVER_CPX_TRUE@am__append_2 = ${CPX_CFLAGS} @OSICBC_DFLT_SOLVER_DYLP_TRUE@am__append_3 = ${DYLP_CFLAGS} @OSICBC_DFLT_SOLVER_GLPK_TRUE@am__append_4 = ${GLPK_CFLAGS} @OSICBC_DFLT_SOLVER_GRB_TRUE@am__append_5 = ${GRB_CFLAGS} @OSICBC_DFLT_SOLVER_MSK_TRUE@am__append_6 = ${MSK_CFLAGS} @OSICBC_DFLT_SOLVER_SYM_TRUE@am__append_7 = ${SYM_CFLAGS} @OSICBC_DFLT_SOLVER_XPR_TRUE@am__append_8 = ${XPR_CFLAGS} subdir = src/OsiCbc DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_cbc.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libOsiCbc_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) ../libCbc.la am_libOsiCbc_la_OBJECTS = OsiCbcSolverInterface.lo libOsiCbc_la_OBJECTS = $(am_libOsiCbc_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsiCbc_la_SOURCES) DIST_SOURCES = $(libOsiCbc_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ ASL_CFLAGS = @ASL_CFLAGS@ ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ ASL_DATA = @ASL_DATA@ ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ ASL_LIBS = @ASL_LIBS@ ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CBCGENERIC_CFLAGS = @CBCGENERIC_CFLAGS@ CBCGENERIC_CFLAGS_INSTALLED = @CBCGENERIC_CFLAGS_INSTALLED@ CBCGENERIC_DEPENDENCIES = @CBCGENERIC_DEPENDENCIES@ CBCGENERIC_LIBS = @CBCGENERIC_LIBS@ CBCGENERIC_LIBS_INSTALLED = @CBCGENERIC_LIBS_INSTALLED@ CBCGENERIC_PCLIBS = @CBCGENERIC_PCLIBS@ CBCGENERIC_PCREQUIRES = @CBCGENERIC_PCREQUIRES@ CBCLIB_CFLAGS = @CBCLIB_CFLAGS@ CBCLIB_CFLAGS_INSTALLED = @CBCLIB_CFLAGS_INSTALLED@ CBCLIB_DEPENDENCIES = @CBCLIB_DEPENDENCIES@ CBCLIB_LIBS = @CBCLIB_LIBS@ CBCLIB_LIBS_INSTALLED = @CBCLIB_LIBS_INSTALLED@ CBCLIB_PCLIBS = @CBCLIB_PCLIBS@ CBCLIB_PCREQUIRES = @CBCLIB_PCREQUIRES@ CBC_BUILD_CBC_GENERIC_FALSE = @CBC_BUILD_CBC_GENERIC_FALSE@ CBC_BUILD_CBC_GENERIC_TRUE = @CBC_BUILD_CBC_GENERIC_TRUE@ CBC_SVN_REV = @CBC_SVN_REV@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CLP_CFLAGS = @CLP_CFLAGS@ CLP_CFLAGS_INSTALLED = @CLP_CFLAGS_INSTALLED@ CLP_DATA = @CLP_DATA@ CLP_DATA_INSTALLED = @CLP_DATA_INSTALLED@ CLP_DEPENDENCIES = @CLP_DEPENDENCIES@ CLP_LIBS = @CLP_LIBS@ CLP_LIBS_INSTALLED = @CLP_LIBS_INSTALLED@ COINDEPEND_CFLAGS = @COINDEPEND_CFLAGS@ COINDEPEND_CFLAGS_INSTALLED = @COINDEPEND_CFLAGS_INSTALLED@ COINDEPEND_DATA = @COINDEPEND_DATA@ COINDEPEND_DATA_INSTALLED = @COINDEPEND_DATA_INSTALLED@ COINDEPEND_DEPENDENCIES = @COINDEPEND_DEPENDENCIES@ COINDEPEND_LIBS = @COINDEPEND_LIBS@ COINDEPEND_LIBS_INSTALLED = @COINDEPEND_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ COIN_HAS_CLP_FALSE = @COIN_HAS_CLP_FALSE@ COIN_HAS_CLP_TRUE = @COIN_HAS_CLP_TRUE@ COIN_HAS_COINDEPEND_FALSE = @COIN_HAS_COINDEPEND_FALSE@ COIN_HAS_COINDEPEND_TRUE = @COIN_HAS_COINDEPEND_TRUE@ COIN_HAS_CPX_FALSE = @COIN_HAS_CPX_FALSE@ COIN_HAS_CPX_TRUE = @COIN_HAS_CPX_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_DYLP_FALSE = @COIN_HAS_DYLP_FALSE@ COIN_HAS_DYLP_TRUE = @COIN_HAS_DYLP_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_GRB_FALSE = @COIN_HAS_GRB_FALSE@ COIN_HAS_GRB_TRUE = @COIN_HAS_GRB_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MIPLIB3_FALSE = @COIN_HAS_MIPLIB3_FALSE@ COIN_HAS_MIPLIB3_TRUE = @COIN_HAS_MIPLIB3_TRUE@ COIN_HAS_MSK_FALSE = @COIN_HAS_MSK_FALSE@ COIN_HAS_MSK_TRUE = @COIN_HAS_MSK_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_NTY_FALSE = @COIN_HAS_NTY_FALSE@ COIN_HAS_NTY_TRUE = @COIN_HAS_NTY_TRUE@ COIN_HAS_OSITESTS_FALSE = @COIN_HAS_OSITESTS_FALSE@ COIN_HAS_OSITESTS_TRUE = @COIN_HAS_OSITESTS_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_SPX_FALSE = @COIN_HAS_SPX_FALSE@ COIN_HAS_SPX_TRUE = @COIN_HAS_SPX_TRUE@ COIN_HAS_VOL_FALSE = @COIN_HAS_VOL_FALSE@ COIN_HAS_VOL_TRUE = @COIN_HAS_VOL_TRUE@ COIN_HAS_XPR_FALSE = @COIN_HAS_XPR_FALSE@ COIN_HAS_XPR_TRUE = @COIN_HAS_XPR_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPX_CFLAGS = @CPX_CFLAGS@ CPX_CFLAGS_INSTALLED = @CPX_CFLAGS_INSTALLED@ CPX_DATA = @CPX_DATA@ CPX_DATA_INSTALLED = @CPX_DATA_INSTALLED@ CPX_DEPENDENCIES = @CPX_DEPENDENCIES@ CPX_LIBS = @CPX_LIBS@ CPX_LIBS_INSTALLED = @CPX_LIBS_INSTALLED@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ DYLP_CFLAGS = @DYLP_CFLAGS@ DYLP_CFLAGS_INSTALLED = @DYLP_CFLAGS_INSTALLED@ DYLP_DATA = @DYLP_DATA@ DYLP_DATA_INSTALLED = @DYLP_DATA_INSTALLED@ DYLP_DEPENDENCIES = @DYLP_DEPENDENCIES@ DYLP_LIBS = @DYLP_LIBS@ DYLP_LIBS_INSTALLED = @DYLP_LIBS_INSTALLED@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ GRB_CFLAGS = @GRB_CFLAGS@ GRB_CFLAGS_INSTALLED = @GRB_CFLAGS_INSTALLED@ GRB_DATA = @GRB_DATA@ GRB_DATA_INSTALLED = @GRB_DATA_INSTALLED@ GRB_DEPENDENCIES = @GRB_DEPENDENCIES@ GRB_LIBS = @GRB_LIBS@ GRB_LIBS_INSTALLED = @GRB_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MIPLIB3_CFLAGS = @MIPLIB3_CFLAGS@ MIPLIB3_CFLAGS_INSTALLED = @MIPLIB3_CFLAGS_INSTALLED@ MIPLIB3_DATA = @MIPLIB3_DATA@ MIPLIB3_DATA_INSTALLED = @MIPLIB3_DATA_INSTALLED@ MIPLIB3_DEPENDENCIES = @MIPLIB3_DEPENDENCIES@ MIPLIB3_LIBS = @MIPLIB3_LIBS@ MIPLIB3_LIBS_INSTALLED = @MIPLIB3_LIBS_INSTALLED@ MPICC = @MPICC@ MPICXX = @MPICXX@ MSK_CFLAGS = @MSK_CFLAGS@ MSK_CFLAGS_INSTALLED = @MSK_CFLAGS_INSTALLED@ MSK_DATA = @MSK_DATA@ MSK_DATA_INSTALLED = @MSK_DATA_INSTALLED@ MSK_DEPENDENCIES = @MSK_DEPENDENCIES@ MSK_LIBS = @MSK_LIBS@ MSK_LIBS_INSTALLED = @MSK_LIBS_INSTALLED@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ NTYINCDIR = @NTYINCDIR@ NTYLIB = @NTYLIB@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OSICBC_DFLT_SOLVER_CLP_FALSE = @OSICBC_DFLT_SOLVER_CLP_FALSE@ OSICBC_DFLT_SOLVER_CLP_TRUE = @OSICBC_DFLT_SOLVER_CLP_TRUE@ OSICBC_DFLT_SOLVER_CPX_FALSE = @OSICBC_DFLT_SOLVER_CPX_FALSE@ OSICBC_DFLT_SOLVER_CPX_TRUE = @OSICBC_DFLT_SOLVER_CPX_TRUE@ OSICBC_DFLT_SOLVER_DYLP_FALSE = @OSICBC_DFLT_SOLVER_DYLP_FALSE@ OSICBC_DFLT_SOLVER_DYLP_TRUE = @OSICBC_DFLT_SOLVER_DYLP_TRUE@ OSICBC_DFLT_SOLVER_GLPK_FALSE = @OSICBC_DFLT_SOLVER_GLPK_FALSE@ OSICBC_DFLT_SOLVER_GLPK_TRUE = @OSICBC_DFLT_SOLVER_GLPK_TRUE@ OSICBC_DFLT_SOLVER_GRB_FALSE = @OSICBC_DFLT_SOLVER_GRB_FALSE@ OSICBC_DFLT_SOLVER_GRB_TRUE = @OSICBC_DFLT_SOLVER_GRB_TRUE@ OSICBC_DFLT_SOLVER_MSK_FALSE = @OSICBC_DFLT_SOLVER_MSK_FALSE@ OSICBC_DFLT_SOLVER_MSK_TRUE = @OSICBC_DFLT_SOLVER_MSK_TRUE@ OSICBC_DFLT_SOLVER_SPX_FALSE = @OSICBC_DFLT_SOLVER_SPX_FALSE@ OSICBC_DFLT_SOLVER_SPX_TRUE = @OSICBC_DFLT_SOLVER_SPX_TRUE@ OSICBC_DFLT_SOLVER_SYM_FALSE = @OSICBC_DFLT_SOLVER_SYM_FALSE@ OSICBC_DFLT_SOLVER_SYM_TRUE = @OSICBC_DFLT_SOLVER_SYM_TRUE@ OSICBC_DFLT_SOLVER_VOL_FALSE = @OSICBC_DFLT_SOLVER_VOL_FALSE@ OSICBC_DFLT_SOLVER_VOL_TRUE = @OSICBC_DFLT_SOLVER_VOL_TRUE@ OSICBC_DFLT_SOLVER_XPR_FALSE = @OSICBC_DFLT_SOLVER_XPR_FALSE@ OSICBC_DFLT_SOLVER_XPR_TRUE = @OSICBC_DFLT_SOLVER_XPR_TRUE@ OSITESTS_CFLAGS = @OSITESTS_CFLAGS@ OSITESTS_CFLAGS_INSTALLED = @OSITESTS_CFLAGS_INSTALLED@ OSITESTS_DATA = @OSITESTS_DATA@ OSITESTS_DATA_INSTALLED = @OSITESTS_DATA_INSTALLED@ OSITESTS_DEPENDENCIES = @OSITESTS_DEPENDENCIES@ OSITESTS_LIBS = @OSITESTS_LIBS@ OSITESTS_LIBS_INSTALLED = @OSITESTS_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SPX_CFLAGS = @SPX_CFLAGS@ SPX_CFLAGS_INSTALLED = @SPX_CFLAGS_INSTALLED@ SPX_DATA = @SPX_DATA@ SPX_DATA_INSTALLED = @SPX_DATA_INSTALLED@ SPX_DEPENDENCIES = @SPX_DEPENDENCIES@ SPX_LIBS = @SPX_LIBS@ SPX_LIBS_INSTALLED = @SPX_LIBS_INSTALLED@ STRIP = @STRIP@ VERSION = @VERSION@ VOL_CFLAGS = @VOL_CFLAGS@ VOL_CFLAGS_INSTALLED = @VOL_CFLAGS_INSTALLED@ VOL_DATA = @VOL_DATA@ VOL_DATA_INSTALLED = @VOL_DATA_INSTALLED@ VOL_DEPENDENCIES = @VOL_DEPENDENCIES@ VOL_LIBS = @VOL_LIBS@ VOL_LIBS_INSTALLED = @VOL_LIBS_INSTALLED@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ XPR_CFLAGS = @XPR_CFLAGS@ XPR_CFLAGS_INSTALLED = @XPR_CFLAGS_INSTALLED@ XPR_DATA = @XPR_DATA@ XPR_DATA_INSTALLED = @XPR_DATA_INSTALLED@ XPR_DEPENDENCIES = @XPR_DEPENDENCIES@ XPR_LIBS = @XPR_LIBS@ XPR_LIBS_INSTALLED = @XPR_LIBS_INSTALLED@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiCbc # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiCbc.la # List all source files for this library, including headers libOsiCbc_la_SOURCES = OsiCbcSolverInterface.cpp OsiCbcSolverInterface.hpp # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libOsiCbc_la_LIBADD = $(CBCLIB_LIBS) ../libCbc.la # This is for libtool (on Windows) libOsiCbc_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINDEPEND_CFLAGS) \ $(am__append_1) $(am__append_2) $(am__append_3) \ $(am__append_4) $(am__append_5) $(am__append_6) \ $(am__append_7) $(am__append_8) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiCbcSolverInterface.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/OsiCbc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/OsiCbc/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsiCbc.la: $(libOsiCbc_la_OBJECTS) $(libOsiCbc_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsiCbc_la_LDFLAGS) $(libOsiCbc_la_OBJECTS) $(libOsiCbc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiCbcSolverInterface.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool 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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # 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: CoinMP-1.8.3/Cbc/src/OsiCbc/Makefile.am0000644000175000017500000000434012243462640015774 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1979 2013-11-21 19:57:20Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiCbc # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiCbc.la # List all source files for this library, including headers libOsiCbc_la_SOURCES = OsiCbcSolverInterface.cpp OsiCbcSolverInterface.hpp # List all additionally required libraries if DEPENDENCY_LINKING libOsiCbc_la_LIBADD = $(CBCLIB_LIBS) ../libCbc.la endif # This is for libtool (on Windows) libOsiCbc_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINDEPEND_CFLAGS) # Plus the appropriate include directories for the default solver. if OSICBC_DFLT_SOLVER_CLP AM_CPPFLAGS += ${CLP_CFLAGS} endif if OSICBC_DFLT_SOLVER_CPX AM_CPPFLAGS += ${CPX_CFLAGS} endif if OSICBC_DFLT_SOLVER_DYLP AM_CPPFLAGS += ${DYLP_CFLAGS} endif if OSICBC_DFLT_SOLVER_GLPK AM_CPPFLAGS += ${GLPK_CFLAGS} endif if OSICBC_DFLT_SOLVER_GRB AM_CPPFLAGS += ${GRB_CFLAGS} endif if OSICBC_DFLT_SOLVER_MSK AM_CPPFLAGS += ${MSK_CFLAGS} endif if OSICBC_DFLT_SOLVER_SYM AM_CPPFLAGS += ${SYM_CFLAGS} endif if OSICBC_DFLT_SOLVER_XPR AM_CPPFLAGS += ${XPR_CFLAGS} endif # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiCbcSolverInterface.hpp CoinMP-1.8.3/Cbc/src/OsiCbc/OsiCbcSolverInterface.cpp0000644000175000017500000006675312411761614020642 0ustar renerene// $Id: OsiCbcSolverInterface.cpp 2083 2014-09-28 10:31:40Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "OsiConfig.h" #include "CoinTime.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" /* Default solver configuration: In any environment, clp is the default if you do nothing. The necessary definitions will be handled by the configure script (based on the value specified for --with-osicbc-default-solver) in any environment where configure is available. The results can be found in inc/config_osi.h, which is created during configuration from config_osi.h.in and placed in the build directory. In an environment which does not use configure (MS Visual Studio, for example) the preferred method is to edit the definitions in inc/OsiConfig.h. The symbols are left undefined by default because some older environments (e.g., MS Visual Studio v7 or earlier) will not accept an #include directive which uses a macro to specify the file. In such an environment, if you want to use a solver other than OsiClp, you'll need to make the changes here. */ #ifndef OSICBC_DFLT_SOLVER #define OSICBC_DFLT_SOLVER OsiClpSolverInterface #define OSICBC_CLP_DFLT_SOLVER #include "OsiClpSolverInterface.hpp" #else #include OSICBC_DFLT_SOLVER_HPP #endif #include "OsiCbcSolverInterface.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #ifdef OSICBC_CLP_DFLT_SOLVER #include "ClpPresolve.hpp" #endif //############################################################################# // Solve methods //############################################################################# void OsiCbcSolverInterface::initialSolve() { modelPtr_->solver()->initialSolve(); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::resolve() { modelPtr_->solver()->resolve(); } //############################################################################# // Parameter related methods //############################################################################# bool OsiCbcSolverInterface::setIntParam(OsiIntParam key, int value) { return modelPtr_->solver()->setIntParam(key,value);; } //----------------------------------------------------------------------------- bool OsiCbcSolverInterface::setDblParam(OsiDblParam key, double value) { return modelPtr_->solver()->setDblParam(key,value); } //----------------------------------------------------------------------------- bool OsiCbcSolverInterface::setStrParam(OsiStrParam key, const std::string & value) { return modelPtr_->solver()->setStrParam(key,value); } //----------------------------------------------------------------------------- bool OsiCbcSolverInterface::getIntParam(OsiIntParam key, int& value) const { return modelPtr_->solver()->getIntParam(key,value); } //----------------------------------------------------------------------------- bool OsiCbcSolverInterface::getDblParam(OsiDblParam key, double& value) const { return modelPtr_->solver()->getDblParam(key,value); } //----------------------------------------------------------------------------- bool OsiCbcSolverInterface::getStrParam(OsiStrParam key, std::string & value) const { if ( key==OsiSolverName ) { std::string value2; modelPtr_->solver()->getStrParam(key,value2); value = "cbc"+value2; return true; } return modelPtr_->solver()->getStrParam(key,value); } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# bool OsiCbcSolverInterface::isAbandoned() const { if (modelPtr_->status()!=-1) return modelPtr_->isAbandoned(); else return modelPtr_->solver()->isAbandoned(); } bool OsiCbcSolverInterface::isProvenOptimal() const { if (modelPtr_->status()!=-1) return modelPtr_->isProvenOptimal(); else return modelPtr_->solver()->isProvenOptimal(); } bool OsiCbcSolverInterface::isProvenPrimalInfeasible() const { if (modelPtr_->status()!=-1) return modelPtr_->isProvenInfeasible(); else return modelPtr_->solver()->isProvenPrimalInfeasible(); } bool OsiCbcSolverInterface::isProvenDualInfeasible() const { if (modelPtr_->status()!=-1) return modelPtr_->isProvenDualInfeasible(); else return modelPtr_->solver()->isProvenDualInfeasible(); } bool OsiCbcSolverInterface::isPrimalObjectiveLimitReached() const { return modelPtr_->solver()->isPrimalObjectiveLimitReached(); } bool OsiCbcSolverInterface::isDualObjectiveLimitReached() const { return modelPtr_->solver()->isDualObjectiveLimitReached(); } bool OsiCbcSolverInterface::isIterationLimitReached() const { if (modelPtr_->status()!=-1) return modelPtr_->isNodeLimitReached(); else return modelPtr_->solver()->isIterationLimitReached(); } //############################################################################# // WarmStart related methods //############################################################################# CoinWarmStart *OsiCbcSolverInterface::getEmptyWarmStart () const { return modelPtr_->solver()->getEmptyWarmStart(); } CoinWarmStart* OsiCbcSolverInterface::getWarmStart() const { return modelPtr_->solver()->getWarmStart(); } //----------------------------------------------------------------------------- bool OsiCbcSolverInterface::setWarmStart(const CoinWarmStart* warmstart) { return modelPtr_->solver()->setWarmStart(warmstart); } //############################################################################# // Hotstart related methods (primarily used in strong branching) //############################################################################# void OsiCbcSolverInterface::markHotStart() { modelPtr_->solver()->markHotStart(); } void OsiCbcSolverInterface::solveFromHotStart() { modelPtr_->solver()->solveFromHotStart(); } void OsiCbcSolverInterface::unmarkHotStart() { modelPtr_->solver()->unmarkHotStart(); } //############################################################################# // Problem information methods (original data) //############################################################################# //------------------------------------------------------------------ const char * OsiCbcSolverInterface::getRowSense() const { return modelPtr_->solver()->getRowSense(); } //------------------------------------------------------------------ const double * OsiCbcSolverInterface::getRightHandSide() const { return modelPtr_->solver()->getRightHandSide(); } //------------------------------------------------------------------ const double * OsiCbcSolverInterface::getRowRange() const { return modelPtr_->solver()->getRowRange(); } //------------------------------------------------------------------ // Return information on integrality //------------------------------------------------------------------ bool OsiCbcSolverInterface::isContinuous(int colNumber) const { return modelPtr_->solver()->isContinuous(colNumber); } //------------------------------------------------------------------ //------------------------------------------------------------------ // Row and column copies of the matrix ... //------------------------------------------------------------------ const CoinPackedMatrix * OsiCbcSolverInterface::getMatrixByRow() const { return modelPtr_->solver()->getMatrixByRow(); } const CoinPackedMatrix * OsiCbcSolverInterface::getMatrixByCol() const { return modelPtr_->solver()->getMatrixByCol(); } //------------------------------------------------------------------ std::vector OsiCbcSolverInterface::getDualRays(int maxNumRays, bool fullRay) const { return modelPtr_->solver()->getDualRays(maxNumRays,fullRay); } //------------------------------------------------------------------ std::vector OsiCbcSolverInterface::getPrimalRays(int maxNumRays) const { return modelPtr_->solver()->getPrimalRays(maxNumRays); } //############################################################################# void OsiCbcSolverInterface::setContinuous(int index) { modelPtr_->solver()->setContinuous(index); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::setInteger(int index) { modelPtr_->solver()->setInteger(index); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::setContinuous(const int* indices, int len) { modelPtr_->solver()->setContinuous(indices,len); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::setInteger(const int* indices, int len) { modelPtr_->solver()->setInteger(indices,len); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::setColSolution(const double * cs) { modelPtr_->solver()->setColSolution(cs); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::setRowPrice(const double * rs) { modelPtr_->solver()->setRowPrice(rs); } //############################################################################# // Problem modifying methods (matrix) //############################################################################# void OsiCbcSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { modelPtr_->solver()->addCol(vec,collb,colub,obj); } /* Add a column (primal variable) to the problem. */ void OsiCbcSolverInterface::addCol(int numberElements, const int * rows, const double * elements, const double collb, const double colub, const double obj) { modelPtr_->solver()->addCol(numberElements, rows, elements, collb,colub,obj); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj) { modelPtr_->solver()->addCols(numcols,cols,collb,colub,obj); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::deleteCols(const int num, const int * columnIndices) { modelPtr_->solver()->deleteCols(num,columnIndices); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { modelPtr_->solver()->addRow(vec,rowlb,rowub); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { modelPtr_->solver()->addRow(vec,rowsen,rowrhs,rowrng); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub) { modelPtr_->solver()->addRows(numrows,rows,rowlb,rowub); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng) { modelPtr_->solver()->addRows(numrows,rows,rowsen,rowrhs,rowrng); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::deleteRows(const int num, const int * rowIndices) { modelPtr_->solver()->deleteRows(num,rowIndices); } //############################################################################# // Methods to input a problem //############################################################################# void OsiCbcSolverInterface::loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { modelPtr_->solver()->loadProblem(matrix,collb,colub,obj,rowlb,rowub); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub) { modelPtr_->solver()->assignProblem(matrix,collb,colub,obj,rowlb,rowub); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) { modelPtr_->solver()->loadProblem(matrix,collb,colub,obj,rowsen,rowrhs,rowrng); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng) { modelPtr_->solver()->assignProblem(matrix,collb,colub,obj,rowsen,rowrhs,rowrng); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { modelPtr_->solver()->loadProblem(numcols,numrows,start,index,value, collb,colub,obj,rowlb,rowub); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) { modelPtr_->solver()->loadProblem(numcols,numrows,start,index,value, collb,colub,obj,rowsen,rowrhs,rowrng); } //----------------------------------------------------------------------------- // Write mps files //----------------------------------------------------------------------------- void OsiCbcSolverInterface::writeMps(const char * filename, const char * extension, double objSense) const { modelPtr_->solver()->writeMps(filename,extension,objSense); } int OsiCbcSolverInterface::writeMpsNative(const char *filename, const char ** rowNames, const char ** columnNames, int formatType,int numberAcross,double objSense) const { return modelPtr_->solver()->writeMpsNative(filename, rowNames, columnNames, formatType, numberAcross,objSense); } //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiCbcSolverInterface::OsiCbcSolverInterface (OsiSolverInterface * solver, CbcStrategy * strategy) : OsiSolverInterface() { if (solver) { modelPtr_=new CbcModel(*solver); } else { OSICBC_DFLT_SOLVER solverDflt; modelPtr_=new CbcModel(solverDflt); } if (strategy) { modelPtr_->setStrategy(*strategy); } else { CbcStrategyDefault defaultStrategy; modelPtr_->setStrategy(defaultStrategy); } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * OsiCbcSolverInterface::clone(bool CopyData) const { if (CopyData) { return new OsiCbcSolverInterface(*this); } else { return new OsiCbcSolverInterface(); } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiCbcSolverInterface::OsiCbcSolverInterface ( const OsiCbcSolverInterface & rhs) : OsiSolverInterface(rhs) { assert (rhs.modelPtr_); modelPtr_ = new CbcModel(*rhs.modelPtr_); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiCbcSolverInterface::~OsiCbcSolverInterface () { delete modelPtr_; } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiCbcSolverInterface & OsiCbcSolverInterface::operator=(const OsiCbcSolverInterface& rhs) { if (this != &rhs) { OsiSolverInterface::operator=(rhs); delete modelPtr_; modelPtr_=new CbcModel(*rhs.modelPtr_); } return *this; } //############################################################################# // Applying cuts //############################################################################# void OsiCbcSolverInterface::applyRowCut( const OsiRowCut & rowCut ) { modelPtr_->solver()->applyRowCuts(1,&rowCut); } /* Apply a collection of row cuts which are all effective. applyCuts seems to do one at a time which seems inefficient. */ void OsiCbcSolverInterface::applyRowCuts(int numberCuts, const OsiRowCut * cuts) { modelPtr_->solver()->applyRowCuts(numberCuts,cuts); } /* Apply a collection of row cuts which are all effective. applyCuts seems to do one at a time which seems inefficient. */ void OsiCbcSolverInterface::applyRowCuts(int numberCuts, const OsiRowCut ** cuts) { modelPtr_->solver()->applyRowCuts(numberCuts, cuts); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::applyColCut( const OsiColCut & cc ) { const double * lower = modelPtr_->solver()->getColLower(); const double * upper = modelPtr_->solver()->getColUpper(); const CoinPackedVector & lbs = cc.lbs(); const CoinPackedVector & ubs = cc.ubs(); int i; for ( i=0; i lower[iCol] ) modelPtr_->solver()->setColLower(iCol, value); } for ( i=0; isolver()->setColUpper(iCol, value); } } /* Read an mps file from the given filename (defaults to Osi reader) - returns number of errors (see OsiMpsReader class) */ int OsiCbcSolverInterface::readMps(const char *filename, const char *extension ) { return modelPtr_->solver()->readMps(filename,extension); } // Get pointer to array[getNumCols()] of primal solution vector const double * OsiCbcSolverInterface::getColSolution() const { return modelPtr_->solver()->getColSolution(); } // Get pointer to array[getNumRows()] of dual prices const double * OsiCbcSolverInterface::getRowPrice() const { return modelPtr_->solver()->getRowPrice(); } // Get a pointer to array[getNumCols()] of reduced costs const double * OsiCbcSolverInterface::getReducedCost() const { return modelPtr_->solver()->getReducedCost(); } /* Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ const double * OsiCbcSolverInterface::getRowActivity() const { return modelPtr_->solver()->getRowActivity(); } double OsiCbcSolverInterface::getObjValue() const { return modelPtr_->solver()->getObjValue(); } /* Set an objective function coefficient */ void OsiCbcSolverInterface::setObjCoeff( int elementIndex, double elementValue ) { modelPtr_->solver()->setObjCoeff(elementIndex,elementValue); } /* Set a single column lower bound
    Use -DBL_MAX for -infinity. */ void OsiCbcSolverInterface::setColLower( int elementIndex, double elementValue ) { modelPtr_->solver()->setColLower(elementIndex,elementValue); } /* Set a single column upper bound
    Use DBL_MAX for infinity. */ void OsiCbcSolverInterface::setColUpper( int elementIndex, double elementValue ) { modelPtr_->solver()->setColUpper(elementIndex,elementValue); } /* Set a single column lower and upper bound */ void OsiCbcSolverInterface::setColBounds( int elementIndex, double lower, double upper ) { modelPtr_->solver()->setColBounds(elementIndex,lower,upper); } void OsiCbcSolverInterface::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { modelPtr_->solver()->setColSetBounds(indexFirst,indexLast,boundList); } //------------------------------------------------------------------ /* Set a single row lower bound
    Use -DBL_MAX for -infinity. */ void OsiCbcSolverInterface::setRowLower( int elementIndex, double elementValue ) { modelPtr_->solver()->setRowLower(elementIndex,elementValue); } /* Set a single row upper bound
    Use DBL_MAX for infinity. */ void OsiCbcSolverInterface::setRowUpper( int elementIndex, double elementValue ) { modelPtr_->solver()->setRowUpper(elementIndex,elementValue); } /* Set a single row lower and upper bound */ void OsiCbcSolverInterface::setRowBounds( int elementIndex, double lower, double upper ) { modelPtr_->solver()->setRowBounds(elementIndex,lower,upper); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::setRowType(int i, char sense, double rightHandSide, double range) { modelPtr_->solver()->setRowType(i,sense,rightHandSide,range); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { modelPtr_->solver()->setRowSetBounds(indexFirst,indexLast,boundList); } //----------------------------------------------------------------------------- void OsiCbcSolverInterface::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { modelPtr_->solver()->setRowSetTypes(indexFirst,indexLast,senseList,rhsList,rangeList); } // Set a hint parameter bool OsiCbcSolverInterface::setHintParam(OsiHintParam key, bool yesNo, OsiHintStrength strength, void * otherInformation) { return modelPtr_->solver()->setHintParam(key,yesNo, strength, otherInformation); } // Get a hint parameter bool OsiCbcSolverInterface::getHintParam(OsiHintParam key, bool & yesNo, OsiHintStrength & strength, void *& otherInformation) const { return modelPtr_->solver()->getHintParam(key,yesNo, strength, otherInformation); } // Get a hint parameter bool OsiCbcSolverInterface::getHintParam(OsiHintParam key, bool & yesNo, OsiHintStrength & strength) const { return modelPtr_->solver()->getHintParam(key,yesNo, strength); } int OsiCbcSolverInterface::getNumCols() const { return modelPtr_->solver()->getNumCols(); } int OsiCbcSolverInterface::getNumRows() const { return modelPtr_->solver()->getNumRows(); } int OsiCbcSolverInterface::getNumElements() const { return modelPtr_->solver()->getNumElements(); } const double * OsiCbcSolverInterface::getColLower() const { return modelPtr_->solver()->getColLower(); } const double * OsiCbcSolverInterface::getColUpper() const { return modelPtr_->solver()->getColUpper(); } const double * OsiCbcSolverInterface::getRowLower() const { return modelPtr_->solver()->getRowLower(); } const double * OsiCbcSolverInterface::getRowUpper() const { return modelPtr_->solver()->getRowUpper(); } const double * OsiCbcSolverInterface::getObjCoefficients() const { return modelPtr_->solver()->getObjCoefficients(); } double OsiCbcSolverInterface::getObjSense() const { return modelPtr_->solver()->getObjSense(); } double OsiCbcSolverInterface::getInfinity() const { return modelPtr_->solver()->getInfinity(); } int OsiCbcSolverInterface::getIterationCount() const { return modelPtr_->solver()->getIterationCount(); } void OsiCbcSolverInterface::setObjSense(double s ) { modelPtr_->setObjSense(s); } // Invoke solver's built-in enumeration algorithm void OsiCbcSolverInterface::branchAndBound() { *messageHandler() << "Warning: Use of OsiCbc is deprecated." << CoinMessageEol; *messageHandler() << "To enjoy the full performance of Cbc, use the CbcSolver interface." << CoinMessageEol; modelPtr_->branchAndBound(); } /* Name discipline support -- lh, 070328 -- For safety, there's really nothing to it but to pass each call of an impure virtual method on to the underlying solver. Otherwise we just can't know if it's been overridden or not. */ std::string OsiCbcSolverInterface::dfltRowColName (char rc, int ndx, unsigned digits) const { return (modelPtr_->solver()->dfltRowColName(rc,ndx,digits)) ; } std::string OsiCbcSolverInterface::getObjName (unsigned maxLen) const { return (modelPtr_->solver()->getObjName(maxLen)) ; } std::string OsiCbcSolverInterface::getRowName (int ndx, unsigned maxLen) const { return (modelPtr_->solver()->getRowName(ndx,maxLen)) ; } const OsiSolverInterface::OsiNameVec &OsiCbcSolverInterface::getRowNames () { return (modelPtr_->solver()->getRowNames()) ; } std::string OsiCbcSolverInterface::getColName (int ndx, unsigned maxLen) const { return (modelPtr_->solver()->getColName(ndx,maxLen)) ; } const OsiSolverInterface::OsiNameVec &OsiCbcSolverInterface::getColNames () { return (modelPtr_->solver()->getColNames()) ; } void OsiCbcSolverInterface::setRowNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart) { modelPtr_->solver()->setRowNames(srcNames,srcStart,len,tgtStart) ; } void OsiCbcSolverInterface::deleteRowNames (int tgtStart, int len) { modelPtr_->solver()->deleteRowNames(tgtStart,len) ; } void OsiCbcSolverInterface::setColNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart) { modelPtr_->solver()->setColNames(srcNames,srcStart,len,tgtStart) ; } void OsiCbcSolverInterface::deleteColNames (int tgtStart, int len) { modelPtr_->solver()->deleteColNames(tgtStart,len) ; } /* These last three are the only functions that would normally be overridden. */ /* Set objective function name. */ void OsiCbcSolverInterface::setObjName (std::string name) { modelPtr_->solver()->setObjName(name) ; } /* Set a row name, to make sure both the solver and OSI see the same name. */ void OsiCbcSolverInterface::setRowName (int ndx, std::string name) { modelPtr_->solver()->setRowName(ndx,name) ; } /* Set a column name, to make sure both the solver and OSI see the same name. */ void OsiCbcSolverInterface::setColName (int ndx, std::string name) { modelPtr_->solver()->setColName(ndx,name) ; } // Pass in Message handler (not deleted at end) void OsiCbcSolverInterface::passInMessageHandler(CoinMessageHandler * handler) { OsiSolverInterface::passInMessageHandler(handler); if (modelPtr_) modelPtr_->passInMessageHandler(handler); } // So unit test can find out if NDEBUG set bool OsiCbcHasNDEBUG() { #ifdef NDEBUG return true; #else return false; #endif } CoinMP-1.8.3/Cbc/src/OsiCbc/OsiCbcSolverInterface.hpp0000644000175000017500000007211712131054770020633 0ustar renerene// $Id: OsiCbcSolverInterface.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiCbcSolverInterface_H #define OsiCbcSolverInterface_H #include #include #include #include "CbcModel.hpp" #include "CoinPackedMatrix.hpp" #include "OsiSolverInterface.hpp" #include "CbcStrategy.hpp" #include "CoinWarmStartBasis.hpp" class OsiRowCut; class OsiClpSolverInterface; static const double OsiCbcInfinity = COIN_DBL_MAX; //############################################################################# /** Cbc Solver Interface Instantiation of OsiCbcSolverInterface for the Model Algorithm. */ class OsiCbcSolverInterface : virtual public OsiSolverInterface { friend void OsiCbcSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound(); //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the cbc algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Set a string parameter bool setStrParam(OsiStrParam key, const std::string & value); // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; // Set a hint parameter - overrides OsiSolverInterface virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void * otherInformation=NULL); /// Get a hint parameter virtual bool getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength, void *& otherInformation) const; using OsiSolverInterface::getHintParam ; /// Get a hint parameter virtual bool getHintParam(OsiHintParam key, bool& yesNo, OsiHintStrength& strength) const; //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ //@{ /*! \brief Get an empty warm start object This routine returns an empty CoinWarmStartBasis object. Its purpose is to provide a way to give a client a warm start basis object of the appropriate type, which can resized and modified as desired. */ virtual CoinWarmStart *getEmptyWarmStart () const; /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching).
    The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
    NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const; /// Get number of rows virtual int getNumRows() const; /// Get number of nonzero elements virtual int getNumElements() const ; /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const; /** Get pointer to array[getNumRows()] of row constraint senses.
    • 'L' <= constraint
    • 'E' = constraint
    • 'G' >= constraint
    • 'R' ranged constraint
    • 'N' free constraint
    */ virtual const char * getRowSense() const; /** Get pointer to array[getNumRows()] of rows right-hand sides
    • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
    • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'N' then rhs()[i] == 0.0
    */ virtual const double * getRightHandSide() const ; /** Get pointer to array[getNumRows()] of row ranges.
    • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
    • if rowsense()[i] != 'R' then rowrange()[i] is undefined
    */ virtual const double * getRowRange() const ; /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const ; /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const ; /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const; /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const ; /// Return true if column is continuous virtual bool isContinuous(int colNumber) const; /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const; //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const; /// Get objective function value virtual double getObjValue() const; /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const ; /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay = false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; //@} /*! \name Methods for row and column names. Because OsiCbc is a pass-through class, it's necessary to override any virtual method in order to be sure we catch an override by the underlying solver. See the OsiSolverInterface class documentation for detailed descriptions. */ //@{ /*! \brief Generate a standard name of the form Rnnnnnnn or Cnnnnnnn */ virtual std::string dfltRowColName(char rc, int ndx, unsigned digits = 7) const ; /*! \brief Return the name of the objective function */ virtual std::string getObjName (unsigned maxLen = std::string::npos) const ; /*! \brief Set the name of the objective function */ virtual void setObjName (std::string name) ; /*! \brief Return the name of the row. */ virtual std::string getRowName(int rowIndex, unsigned maxLen = std::string::npos) const ; /*! \brief Return a pointer to a vector of row names */ virtual const OsiNameVec &getRowNames() ; /*! \brief Set a row name */ virtual void setRowName(int ndx, std::string name) ; /*! \brief Set multiple row names */ virtual void setRowNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart) ; /*! \brief Delete len row names starting at index tgtStart */ virtual void deleteRowNames(int tgtStart, int len) ; /*! \brief Return the name of the column */ virtual std::string getColName(int colIndex, unsigned maxLen = std::string::npos) const ; /*! \brief Return a pointer to a vector of column names */ virtual const OsiNameVec &getColNames() ; /*! \brief Set a column name */ virtual void setColName(int ndx, std::string name) ; /*! \brief Set multiple column names */ virtual void setColNames(OsiNameVec &srcNames, int srcStart, int len, int tgtStart) ; /*! \brief Delete len column names starting at index tgtStart */ virtual void deleteColNames(int tgtStart, int len) ; //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ); using OsiSolverInterface::setColLower ; /** Set a single column lower bound
    Use -DBL_MAX for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ); using OsiSolverInterface::setColUpper ; /** Set a single column upper bound
    Use DBL_MAX for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound */ virtual void setColBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
    The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound
    Use -DBL_MAX for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
    Use DBL_MAX for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ) ; /** Set a single row lower and upper bound */ virtual void setRowBounds( int elementIndex, double lower, double upper ) ; /** Set the type of a single row
    */ virtual void setRowType(int index, char sense, double rightHandSide, double range); /** Set the bounds on a number of rows simultaneously
    The default implementation just invokes setRowLower() and setRowUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
    The default implementation just invokes setRowType() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose any characteristics changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s ); /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
    Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ using OsiSolverInterface::addCol ; /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); /** Add a column (primal variable) to the problem. */ virtual void addCol(int numberElements, const int * rows, const double * elements, const double collb, const double colub, const double obj) ; using OsiSolverInterface::addCols ; /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); /** */ virtual void deleteCols(const int num, const int * colIndices); using OsiSolverInterface::addRow ; /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); using OsiSolverInterface::addRows ; /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); /** */ virtual void deleteRows(const int num, const int * rowIndices); //----------------------------------------------------------------------- /** Apply a collection of row cuts which are all effective. applyCuts seems to do one at a time which seems inefficient. */ virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts); /** Apply a collection of row cuts which are all effective. applyCuts seems to do one at a time which seems inefficient. This uses array of pointers */ virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts); //@} //@} //--------------------------------------------------------------------------- public: /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • obj: all variables have 0 objective coefficient
    • rowsen: all rows are >=
    • rowrhs: all right hand sides are 0
    • rowrng: 0 for the ranged rows
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); using OsiSolverInterface::readMps ; /** Read an mps file from the given filename (defaults to Osi reader) - returns number of errors (see OsiMpsReader class) */ virtual int readMps(const char *filename, const char *extension = "mps") ; /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; /** Write the problem into an mps file of the given filename, names may be null. formatType is 0 - normal 1 - extra accuracy 2 - IEEE hex (later) Returns non-zero on I/O error */ virtual int writeMpsNative(const char *filename, const char ** rowNames, const char ** columnNames, int formatType=0,int numberAcross=2, double objSense=0.0) const ; //@} /**@name Message handling (extra for Cbc messages). Normally I presume you would want the same language. If not then you could use underlying model pointer */ //@{ /// Set language void newLanguage(CoinMessages::Language language); void setLanguage(CoinMessages::Language language) {newLanguage(language);} //@} //--------------------------------------------------------------------------- /**@name Cbc specific public interfaces */ //@{ /// Get pointer to Cbc model inline CbcModel * getModelPtr() const { return modelPtr_;} /// Get pointer to underlying solver inline OsiSolverInterface * getRealSolverPtr() const { return modelPtr_->solver();} /// Set cutoff bound on the objective function. inline void setCutoff(double value) { modelPtr_->setCutoff(value);} /// Get the cutoff bound on the objective function - always as minimize inline double getCutoff() const { return modelPtr_->getCutoff();} /// Set the CbcModel::CbcMaxNumNode maximum node limit inline void setMaximumNodes( int value) { modelPtr_->setMaximumNodes(value);} /// Get the CbcModel::CbcMaxNumNode maximum node limit inline int getMaximumNodes() const { return modelPtr_->getMaximumNodes();} /// Set the CbcModel::CbcMaxNumSol maximum number of solutions inline void setMaximumSolutions( int value) { modelPtr_->setMaximumSolutions(value);} /// Get the CbcModel::CbcMaxNumSol maximum number of solutions inline int getMaximumSolutions() const { return modelPtr_->getMaximumSolutions();} /// Set the CbcModel::CbcMaximumSeconds maximum number of seconds inline void setMaximumSeconds( double value) { modelPtr_->setMaximumSeconds(value);} /// Get the CbcModel::CbcMaximumSeconds maximum number of seconds inline double getMaximumSeconds() const { return modelPtr_->getMaximumSeconds();} /// Node limit reached? inline bool isNodeLimitReached() const { return modelPtr_->isNodeLimitReached();} /// Solution limit reached? inline bool isSolutionLimitReached() const { return modelPtr_->isSolutionLimitReached();} /// Get how many Nodes it took to solve the problem. inline int getNodeCount() const { return modelPtr_->getNodeCount();} /// Final status of problem - 0 finished, 1 stopped, 2 difficulties inline int status() const { return modelPtr_->status();} /** Pass in a message handler It is the client's responsibility to destroy a message handler installed by this routine; it will not be destroyed when the solver interface is destroyed. */ virtual void passInMessageHandler(CoinMessageHandler * handler); //@} //--------------------------------------------------------------------------- /**@name Constructors and destructors */ //@{ /// Default Constructor OsiCbcSolverInterface (OsiSolverInterface * solver=NULL, CbcStrategy * strategy=NULL); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiCbcSolverInterface (const OsiCbcSolverInterface &); #if 0 /// Borrow constructor - only delete one copy OsiCbcSolverInterface (CbcModel * rhs, bool reallyOwn=false); /// Releases so won't error void releaseCbc(); #endif /// Assignment operator OsiCbcSolverInterface & operator=(const OsiCbcSolverInterface& rhs); /// Destructor virtual ~OsiCbcSolverInterface (); //@} //--------------------------------------------------------------------------- protected: ///@name Protected methods //@{ /** Apply a row cut (append to constraint matrix). */ virtual void applyRowCut(const OsiRowCut& rc); /** Apply a column cut (adjust one or more bounds). */ virtual void applyColCut(const OsiColCut& cc); //@} /**@name Protected member data */ //@{ /// Cbc model represented by this class instance mutable CbcModel * modelPtr_; //@} }; // So unit test can find out if NDEBUG set bool OsiCbcHasNDEBUG(); //############################################################################# /** A function that tests the methods in the OsiCbcSolverInterface class. */ void OsiCbcSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Cbc/src/unitTestClp.cpp0000644000175000017500000006046512452506557015602 0ustar renerene/* $Id: unitTestClp.cpp 2105 2015-01-05 13:11:11Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include "CoinTime.hpp" #include "CoinFileIO.hpp" #include "CbcModel.hpp" #include "CbcHeuristic.hpp" #include "CbcCutGenerator.hpp" #include "CbcBranchCut.hpp" #include "CglProbing.hpp" #include "OsiClpSolverInterface.hpp" #include "ClpFactorization.hpp" #include "OsiRowCutDebugger.hpp" //############################################################################# #ifdef NDEBUG #undef NDEBUG #endif //############################################################################# // Display message on stdout and stderr void testingMessage( const char * const msg ) { std::cout << msg; //cout <(std::cout.precision()) ; /* Set the range of problems to be tested. testSwitch = -2 is special and is picked up below. */ int loSet = 0 ; int hiSet = 0 ; if (testSwitch == -1) { loSet = 0 ; hiSet = 1 ; } else if (testSwitch >= 0) { loSet = static_cast(stuff[6]) ; hiSet = testSwitch ; std::cout << "Solving miplib problems in sets " << loSet << ":" << hiSet << "." << std::endl ; } /* Vectors to hold test problem names and characteristics. */ std::vector mpsName ; std::vector nRows ; std::vector nCols ; std::vector objValueC ; std::vector objValue ; std::vector testSet ; std::vector rowCutDebugger ; /* A macro to make the vector creation marginally readable. Parameters are name, rows, columns, integer objective, continuous objective, set ID, row cut debugger To enable the row cut debugger for a given problem, change the last parameter to true. Don't forget to turn it off before committing changes! */ #define PUSH_MPS(zz_mpsName_zz,\ zz_nRows_zz,zz_nCols_zz,zz_objValue_zz,zz_objValueC_zz, \ zz_testSet_zz, zz_rcDbg_zz) \ mpsName.push_back(zz_mpsName_zz) ; \ nRows.push_back(zz_nRows_zz) ; \ nCols.push_back(zz_nCols_zz) ; \ objValueC.push_back(zz_objValueC_zz) ; \ testSet.push_back(zz_testSet_zz) ; \ objValue.push_back(zz_objValue_zz) ; \ rowCutDebugger.push_back(zz_rcDbg_zz) ; /* Push the miplib problems. Except for -2 (unitTest), push all, even if we're not going to do all of them. */ if (testSwitch == -2) { PUSH_MPS("p0033", 16, 33, 3089, 2520.57, 0, false); PUSH_MPS("p0201", 133, 201, 7615, 6875.0, 0, false); // PUSH_MPS("flugpl", 18, 18, 1201500, 1167185.7, 0, false); } else { /* Load up the problem vector. Note that the row counts here include the objective function. */ #if 1 PUSH_MPS("10teams", 230, 2025, 924, 917, 1, false); PUSH_MPS("air03", 124, 10757, 340160, 338864.25, 0, false); PUSH_MPS("air04", 823, 8904, 56137, 55535.436, 2, false); PUSH_MPS("air05", 426, 7195, 26374, 25877.609, 2, false); PUSH_MPS("arki001", 1048, 1388, 7580813.0459, 7579599.80787, 7, false); PUSH_MPS("bell3a", 123, 133, 878430.32, 862578.64, 0, false); PUSH_MPS("bell5", 91, 104, 8966406.49, 8608417.95, 1, false); PUSH_MPS("blend2", 274, 353, 7.598985, 6.9156751140, 0, false); PUSH_MPS("cap6000", 2176, 6000, -2451377, -2451537.325, 1, false); PUSH_MPS("dano3mip", 3202, 13873, 728.1111, 576.23162474, 7, false); PUSH_MPS("danoint", 664, 521, 65.67, 62.637280418, 6, false); PUSH_MPS("dcmulti", 290, 548, 188182, 183975.5397, 0, false); PUSH_MPS("dsbmip", 1182, 1886, -305.19817501, -305.19817501, 0, false); PUSH_MPS("egout", 98, 141, 568.101, 149.589, 0, false); PUSH_MPS("enigma", 21, 100, 0.0, 0.0, 0, false); PUSH_MPS("fast0507", 507, 63009, 174, 172.14556668, 5, false); PUSH_MPS("fiber", 363, 1298, 405935.18000, 156082.51759, 0, false); PUSH_MPS("fixnet6", 478, 878, 3983, 1200.88, 1, false); PUSH_MPS("flugpl", 18, 18, 1201500, 1167185.7, 0, false); PUSH_MPS("gen", 780, 870, 112313, 112130.0, 0, false); PUSH_MPS("gesa2", 1392, 1224, 25779856.372, 25476489.678, 1, false); PUSH_MPS("gesa2_o", 1248, 1224, 25779856.372, 25476489.678, 1, false); PUSH_MPS("gesa3", 1368, 1152, 27991042.648, 27833632.451, 0, false); PUSH_MPS("gesa3_o", 1224, 1152, 27991042.648, 27833632.451, 0, false); PUSH_MPS("gt2", 29, 188, 21166.000, 13460.233074, 0, false); PUSH_MPS("harp2", 112, 2993, -73899798.00, -74353341.502, 6, false); PUSH_MPS("khb05250", 101, 1350, 106940226, 95919464.0, 0, false); PUSH_MPS("l152lav", 97, 1989, 4722, 4656.36, 1, false); PUSH_MPS("lseu", 28, 89, 1120, 834.68, 0, false); PUSH_MPS("mas74", 13, 151, 11801.18573, 10482.79528, 3, false); PUSH_MPS("mas76", 12, 151, 40005.05414, 38893.9036, 2, false); PUSH_MPS("misc03", 96, 160, 3360, 1910., 0, false); PUSH_MPS("misc06", 820, 1808, 12850.8607, 12841.6, 0, false); PUSH_MPS("misc07", 212, 260, 2810, 1415.0, 1, false); PUSH_MPS("mitre", 2054, 10724, 115155, 114740.5184, 1, false); PUSH_MPS("mkc", 3411, 5325, -553.75, -611.85, 7, false); // suboptimal PUSH_MPS("mod008", 6, 319, 307, 290.9, 0, false); PUSH_MPS("mod010", 146, 2655, 6548, 6532.08, 0, false); PUSH_MPS("mod011", 4480, 10958, -54558535, -62121982.55, 2, false); PUSH_MPS("modglob", 291, 422, 20740508, 20430947., 2, false); PUSH_MPS("noswot", 182, 128, -43, -43.0, 6, false); PUSH_MPS("nw04", 36, 87482, 16862, 16310.66667, 1, false); PUSH_MPS("p0033", 16, 33, 3089, 2520.57, 0, false); PUSH_MPS("p0201", 133, 201, 7615, 6875.0, 0, false); PUSH_MPS("p0282", 241, 282, 258411, 176867.50, 0, false); PUSH_MPS("p0548", 176, 548, 8691, 315.29, 0, false); PUSH_MPS("p2756", 755, 2756, 3124, 2688.75, 0, false); PUSH_MPS("pk1", 45, 86, 11.0, 0.0, 2, false); PUSH_MPS("pp08a", 136, 240, 7350.0, 2748.3452381, 1, false); PUSH_MPS("pp08aCUTS", 246, 240, 7350.0, 5480.6061563, 1, false); PUSH_MPS("qiu", 1192, 840, -132.873137, -931.638857, 3, false); PUSH_MPS("qnet1", 503, 1541, 16029.692681, 14274.102667, 0, false); PUSH_MPS("qnet1_o", 456, 1541, 16029.692681, 12095.571667, 0, false); PUSH_MPS("rentacar", 6803, 9557, 30356761, 28806137.644, 0, false); PUSH_MPS("rgn", 24, 180, 82.1999, 48.7999, 0, false); PUSH_MPS("rout", 291, 556, 1077.56, 981.86428571, 3, false); PUSH_MPS("set1ch", 492, 712, 54537.75, 32007.73, 5, false); PUSH_MPS("seymour", 4944, 1372, 423, 403.84647413, 7, false); PUSH_MPS("seymour_1", 4944, 1372, 410.76370, 403.84647413, 5, false); PUSH_MPS("stein27", 118, 27, 18, 13.0, 0, false); PUSH_MPS("stein45", 331, 45, 30, 22.0, 1, false); PUSH_MPS("swath", 884, 6805, 497.603, 334.4968581, 7, false); PUSH_MPS("vpm1", 234, 378, 20, 15.4167, 0, false); #endif PUSH_MPS("vpm2", 234, 378, 13.75, 9.8892645972, 0, false); } #undef PUSH_MPS /* Normally the problems are executed in order. Define RANDOM_ORDER below to randomize. #define RANDOM_ORDER */ int which[100]; int nLoop = static_cast(mpsName.size()); assert (nLoop <= 100); for (int i = 0; i < nLoop; i++) which[i] = i; # ifdef RANDOM_ORDER unsigned int iTime = static_cast(CoinGetTimeOfDay()-1.256e9); std::cout << "Time (seed) " << iTime << "." << std::endl ; double sort[100]; CoinDrand48(true,iTime); for (int i = 0; i < nLoop; i++) sort[i] = CoinDrand48(); CoinSort_2(sort,sort+nLoop,which); # endif int problemCnt = 0; for (m = 0 ; m < mpsName.size() ; m++) { int setID = testSet[m]; if (loSet <= setID && setID <= hiSet) problemCnt++; } int numberFailures = 0; int numberAttempts = 0; int numProbSolved = 0; double timeTaken = 0.0; //#define CLP_FACTORIZATION_INSTRUMENT # ifdef CLP_FACTORIZATION_INSTRUMENT double timeTakenFac = 0.0; # endif /* Open the main loop to step through the MPS problems. */ for (unsigned int mw = 0 ; mw < mpsName.size() ; mw++) { m = which[mw]; int setID = testSet[m]; // Skip if problem is not in specified problem set(s) if (!(loSet <= setID && setID <= hiSet)) continue ; numberAttempts++; std::cout << " processing mps file: " << mpsName[m] << " (" << numberAttempts << " out of " << problemCnt << ")" << std::endl ; /* Stage 1: Read the MPS and make sure the size of the constraint matrix is correct. */ CbcModel *model = new CbcModel(saveModel) ; std::string fn = dirMiplib+mpsName[m] ; if (!CbcTestMpsFile(fn)) { std::cout << "ERROR: Cannot find MPS file " << fn << "." << std::endl ; continue; } model->solver()->readMps(fn.c_str(), "") ; assert(model->getNumRows() == nRows[m]) ; assert(model->getNumCols() == nCols[m]) ; // Careful! We're initialising for the benefit of other code. CoinDrand48(true,1234567); //printf("RAND1 %g %g\n",CoinDrand48(true,1234567),model->randomNumberGenerator()->randomDouble()); //printf("RAND1 %g\n",CoinDrand48(true,1234567)); // Higher limits for the serious problems. int testMaximumNodes = 200000; if (hiSet > 1) testMaximumNodes = 20000000; if (model->getMaximumNodes() > testMaximumNodes) { model->setMaximumNodes(testMaximumNodes); } /* Stage 2: Call solver to solve the problem. */ # ifdef CLP_FACTORIZATION_INSTRUMENT extern double factorization_instrument(int type); double facTime1 = factorization_instrument(0); std::cout << "Factorization - initial solve " << facTime1 << " seconds." << std::endl ; timeTakenFac += facTime1; # endif double startTime = CoinCpuTime()+CoinCpuTimeJustChildren(); // Setup specific to clp OsiClpSolverInterface *siClp = dynamic_cast(model->solver()) ; ClpSimplex *modelC = NULL; if (siClp) { modelC = siClp->getModelPtr(); ClpMatrixBase * matrix = modelC->clpMatrix(); ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); if (stuff && stuff[9] && clpMatrix) { // vector matrix! clpMatrix->makeSpecialColumnCopy(); } # ifdef JJF_ZERO if (clpMatrix) { int numberRows = clpMatrix->getNumRows(); int numberColumns = clpMatrix->getNumCols(); double * elements = clpMatrix->getMutableElements(); const int * row = clpMatrix->getIndices(); const CoinBigIndex * columnStart = clpMatrix->getVectorStarts(); const int * columnLength = clpMatrix->getVectorLengths(); double * smallest = new double [numberRows]; double * largest = new double [numberRows]; char * flag = new char [numberRows]; CoinZeroN(flag, numberRows); for (int i = 0; i < numberRows; i++) { smallest[i] = COIN_DBL_MAX; largest[i] = 0.0; } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { bool isInteger = modelC->isInteger(iColumn); CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = fabs(elements[j]); if (!isInteger) flag[iRow] = 1; smallest[iRow] = CoinMin(smallest[iRow], value); largest[iRow] = CoinMax(largest[iRow], value); } } double * rowLower = modelC->rowLower(); double * rowUpper = modelC->rowUpper(); bool changed = false; for (int i = 0; i < numberRows; i++) { if (flag[i] && smallest[i] > 10.0 && false) { smallest[i] = 1.0 / smallest[i]; if (rowLower[i] > -1.0e20) rowLower[i] *= smallest[i]; if (rowUpper[i] < 1.0e20) rowUpper[i] *= smallest[i]; changed = true; } else { smallest[i] = 0.0; } } if (changed) { printf("SCALED\n"); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (smallest[iRow]) elements[j] *= smallest[iRow]; } } } delete [] smallest; delete [] largest; delete [] flag; } # endif // JJF_ZERO model->checkModel(); modelC->tightenPrimalBounds(0.0, 0, true); model->initialSolve(); if (modelC->dualBound() == 1.0e10) { // user did not set - so modify // get largest scaled away from bound ClpSimplex temp = *modelC; temp.dual(0, 7); double largestScaled = 1.0e-12; double largest = 1.0e-12; int numberRows = temp.numberRows(); const double * rowPrimal = temp.primalRowSolution(); const double * rowLower = temp.rowLower(); const double * rowUpper = temp.rowUpper(); const double * rowScale = temp.rowScale(); int iRow; for (iRow = 0; iRow < numberRows; iRow++) { double value = rowPrimal[iRow]; double above = value - rowLower[iRow]; double below = rowUpper[iRow] - value; if (above < 1.0e12) { largest = CoinMax(largest, above); } if (below < 1.0e12) { largest = CoinMax(largest, below); } if (rowScale) { double multiplier = rowScale[iRow]; above *= multiplier; below *= multiplier; } if (above < 1.0e12) { largestScaled = CoinMax(largestScaled, above); } if (below < 1.0e12) { largestScaled = CoinMax(largestScaled, below); } } int numberColumns = temp.numberColumns(); const double * columnPrimal = temp.primalColumnSolution(); const double * columnLower = temp.columnLower(); const double * columnUpper = temp.columnUpper(); const double * columnScale = temp.columnScale(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = columnPrimal[iColumn]; double above = value - columnLower[iColumn]; double below = columnUpper[iColumn] - value; if (above < 1.0e12) { largest = CoinMax(largest, above); } if (below < 1.0e12) { largest = CoinMax(largest, below); } if (columnScale) { double multiplier = 1.0 / columnScale[iColumn]; above *= multiplier; below *= multiplier; } if (above < 1.0e12) { largestScaled = CoinMax(largestScaled, above); } if (below < 1.0e12) { largestScaled = CoinMax(largestScaled, below); } } std::cout << "Largest (scaled) away from bound " << largestScaled << " unscaled " << largest << std::endl; # ifdef JJF_ZERO modelC->setDualBound(CoinMax(1.0001e8, CoinMin(1000.0*largestScaled,1.00001e10))); # else modelC->setDualBound(CoinMax(1.0001e9, CoinMin(1000.0*largestScaled,1.0001e10))); # endif } } // end clp-specific setup /* Cut passes: For small models (n < 500) always do 100 passes, if possible (-100). For larger models, use minimum drop to stop (100, 20). */ model->setMinimumDrop(CoinMin(5.0e-2, fabs(model->getMinimizationObjValue())*1.0e-3+1.0e-4)); if (CoinAbs(model->getMaximumCutPassesAtRoot()) <= 100) { if (model->getNumCols() < 500) { model->setMaximumCutPassesAtRoot(-100); } else if (model->getNumCols() < 5000) { model->setMaximumCutPassesAtRoot(100); } else { model->setMaximumCutPassesAtRoot(20); } } // If defaults then increase trust for small models if (model->numberStrong() == 5 && model->numberBeforeTrust() == 10) { int numberColumns = model->getNumCols(); if (numberColumns <= 50) { model->setNumberBeforeTrust(1000); } else if (numberColumns <= 100) { model->setNumberBeforeTrust(100); } else if (numberColumns <= 300) { model->setNumberBeforeTrust(50); } } //if (model->getNumCols()>=500) { // switch off Clp stuff //model->setFastNodeDepth(-1); //} /* Activate the row cut debugger, if requested. */ if (rowCutDebugger[m] == true) { std::string probName ; model->solver()->getStrParam(OsiProbName,probName) ; model->solver()->activateRowCutDebugger(probName.c_str()) ; if (model->solver()->getRowCutDebugger()) std::cout << "Row cut debugger activated for " ; else std::cout << "Failed to activate row cut debugger for " ; std::cout << mpsName[m] << "." << std::endl ; } setCutAndHeuristicOptions(*model) ; /* More clp-specific setup. */ if (siClp) { # ifdef CLP_MULTIPLE_FACTORIZATIONS if (!modelC->factorization()->isDenseOrSmall()) { int denseCode = stuff ? static_cast (stuff[4]) : -1; int smallCode = stuff ? static_cast (stuff[10]) : -1; if (stuff && stuff[8] >= 1) { if (denseCode < 0) denseCode = 40; if (smallCode < 0) smallCode = 40; } if (denseCode > 0) modelC->factorization()->setGoDenseThreshold(denseCode); if (smallCode > 0) modelC->factorization()->setGoSmallThreshold(smallCode); if (denseCode >= modelC->numberRows()) { //printf("problem going dense\n"); //modelC->factorization()->goDenseOrSmall(modelC->numberRows()); } } # endif if (stuff && stuff[8] >= 1) { printf("Fast node size Columns %d rows %d - depth %d\n", modelC->numberColumns(),modelC->numberRows(), model->fastNodeDepth()); if (modelC->numberColumns() + modelC->numberRows() <= 10000 && model->fastNodeDepth() == -1) model->setFastNodeDepth(-10/*-9*/); } } #ifdef CONFLICT_CUTS { model->setCutoffAsConstraint(true); int moreOptions=model->moreSpecialOptions(); model->setMoreSpecialOptions(moreOptions|4194304); } #endif /* Finally, the actual call to solve the MIP with branch-and-cut. */ model->branchAndBound(); # ifdef CLP_FACTORIZATION_INSTRUMENT double facTime = factorization_instrument(0); std::cout << "Factorization " << facTime << " seconds." << std::endl , timeTakenFac += facTime; # endif /* Stage 3: Do the statistics and check the answer. */ double timeOfSolution = CoinCpuTime()+CoinCpuTimeJustChildren()-startTime; std::cout << "Cuts at root node changed objective from " << model->getContinuousObjective() << " to " << model->rootObjectiveAfterCuts() << std::endl ; int numberGenerators = model->numberCutGenerators(); for (int iGenerator = 0 ; iGenerator < numberGenerators ; iGenerator++) { CbcCutGenerator *generator = model->cutGenerator(iGenerator); # ifdef CLIQUE_ANALYSIS # ifndef CLP_INVESTIGATE CglImplication *implication = dynamic_cast(generator->generator()); if (implication) continue; # endif # endif std::cout << generator->cutGeneratorName() << " was tried " << generator->numberTimesEntered() << " times and created " << generator->numberCutsInTotal() << " cuts of which " << generator->numberCutsActive() << " were active after adding rounds of cuts"; if (generator->timing()) std::cout << " (" << generator->timeInCutGenerator() << " seconds)" ; std::cout << "." << std::endl; } std::cout << model->getNumberHeuristicSolutions() << " solutions found by heuristics." << std::endl ; int numberHeuristics = model->numberHeuristics(); for (int iHeuristic = 0 ; iHeuristic < numberHeuristics ; iHeuristic++) { CbcHeuristic *heuristic = model->heuristic(iHeuristic); if (heuristic->numRuns()) { std::cout << heuristic->heuristicName() << " was tried " << heuristic->numRuns() << " times out of " << heuristic->numCouldRun() << " and created " << heuristic->numberSolutionsFound() << " solutions." << std::endl ; } } /* Check for the correct answer. */ if (!model->status()) { double objActual = model->getObjValue() ; double objExpect = objValue[m] ; double tolerance = CoinMin(fabs(objActual),fabs(objExpect)) ; tolerance = CoinMax(1.0e-5,1.0e-5*tolerance) ; //CoinRelFltEq eq(1.0e-3) ; std::cout << "cbc_clp (" << mpsName[m] << ") " << std::setprecision(10) << objActual ; if (fabs(objActual-objExpect) < tolerance) { std::cout << std::setprecision(dfltPrecision) << "; okay" ; numProbSolved++; } else { std::cout << " != " << objExpect << std::setprecision(dfltPrecision) << "; error = " << fabs(objExpect-objActual) ; numberFailures++; //#ifdef COIN_DEVELOP //abort(); //#endif } } else { std::cout << "cbc_clp (" << mpsName[m] << ") status not optimal; " << "assuming too many nodes" ; } timeTaken += timeOfSolution; std::cout << " -- (" << model->getNodeCount() << " n / " << model->getIterationCount() << " i / " << timeOfSolution << " s) (subtotal " << timeTaken << " seconds)" << std::endl; delete model; } /* End main loop on MPS problems. Print a summary and calculate the return value. */ int returnCode = 0; std::cout << "cbc_clp solved " << numProbSolved << " out of " << numberAttempts; int numberOnNodes = numberAttempts-numProbSolved-numberFailures; if (numberFailures || numberOnNodes) { if (numberOnNodes) { std::cout << " (" << numberOnNodes << " stopped on nodes)"; returnCode = numberOnNodes; } if (numberFailures) { std::cout << " (" << numberFailures << " gave bad answer!)"; returnCode += 100*numberFailures; } } std::cout << " and took " << timeTaken << " seconds." << std::endl; if (testSwitch == -2) { if (numberFailures || numberOnNodes) { std::cout << "****** Unit Test failed." << std::endl ; std::cerr << "****** Unit Test failed." << std::endl ; } else { std::cerr << "****** Unit Test succeeded." << std::endl ; } } # ifdef CLP_FACTORIZATION_INSTRUMENT std::cout << "Total factorization time " << timeTakenFac << "seconds." << std::endl ; # endif return (returnCode) ; } CoinMP-1.8.3/Cbc/src/config_cbc_default.h0000644000175000017500000000110312600277660016524 0ustar renerene /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC PUBLIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Version number of project */ #define CBC_VERSION "2.9.6" /* Major Version number of project */ #define CBC_VERSION_MAJOR 2 /* Minor Version number of project */ #define CBC_VERSION_MINOR 9 /* Release Version number of project */ #define CBC_VERSION_RELEASE 6 CoinMP-1.8.3/Cbc/src/CbcBranchDefaultDecision.cpp0000644000175000017500000004077012131054770020076 0ustar renerene// $Id: CbcBranchDefaultDecision.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchDefaultDecision.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## // Default Constructor CbcBranchDefaultDecision::CbcBranchDefaultDecision() : CbcBranchDecision() { bestCriterion_ = 0.0; bestChangeUp_ = 0.0; bestNumberUp_ = 0; bestChangeDown_ = 0.0; bestObject_ = NULL; bestNumberDown_ = 0; } // Copy constructor CbcBranchDefaultDecision::CbcBranchDefaultDecision ( const CbcBranchDefaultDecision & rhs) : CbcBranchDecision(rhs) { bestCriterion_ = rhs.bestCriterion_; bestChangeUp_ = rhs.bestChangeUp_; bestNumberUp_ = rhs.bestNumberUp_; bestChangeDown_ = rhs.bestChangeDown_; bestNumberDown_ = rhs.bestNumberDown_; bestObject_ = rhs.bestObject_; model_ = rhs.model_; } CbcBranchDefaultDecision::~CbcBranchDefaultDecision() { } // Clone CbcBranchDecision * CbcBranchDefaultDecision::clone() const { return new CbcBranchDefaultDecision(*this); } // Initialize i.e. before start of choosing at a node void CbcBranchDefaultDecision::initialize(CbcModel * model) { bestCriterion_ = 0.0; bestChangeUp_ = 0.0; bestNumberUp_ = 0; bestChangeDown_ = 0.0; bestNumberDown_ = 0; bestObject_ = NULL; model_ = model; } /* Simple default decision algorithm. Compare based on infeasibility (numInfUp, numInfDn) until a solution is found by search, then switch to change in objective (changeUp, changeDn). Note that bestSoFar is remembered in bestObject_, so the parameter bestSoFar is unused. */ int CbcBranchDefaultDecision::betterBranch(CbcBranchingObject * thisOne, CbcBranchingObject * /*bestSoFar*/, double changeUp, int numInfUp, double changeDn, int numInfDn) { bool beforeSolution = cbcModel()->getSolutionCount() == cbcModel()->getNumberHeuristicSolutions();; int betterWay = 0; if (beforeSolution) { if (!bestObject_) { bestNumberUp_ = COIN_INT_MAX; bestNumberDown_ = COIN_INT_MAX; } // before solution - choose smallest number // could add in depth as well int bestNumber = CoinMin(bestNumberUp_, bestNumberDown_); if (numInfUp < numInfDn) { if (numInfUp < bestNumber) { betterWay = 1; } else if (numInfUp == bestNumber) { if (changeUp < bestCriterion_) betterWay = 1; } } else if (numInfUp > numInfDn) { if (numInfDn < bestNumber) { betterWay = -1; } else if (numInfDn == bestNumber) { if (changeDn < bestCriterion_) betterWay = -1; } } else { // up and down have same number bool better = false; if (numInfUp < bestNumber) { better = true; } else if (numInfUp == bestNumber) { if (CoinMin(changeUp, changeDn) < bestCriterion_) better = true;; } if (better) { // see which way if (changeUp <= changeDn) betterWay = 1; else betterWay = -1; } } } else { if (!bestObject_) { bestCriterion_ = -1.0; } // got a solution if (changeUp <= changeDn) { if (changeUp > bestCriterion_) betterWay = 1; } else { if (changeDn > bestCriterion_) betterWay = -1; } } if (betterWay) { bestCriterion_ = CoinMin(changeUp, changeDn); bestChangeUp_ = changeUp; bestNumberUp_ = numInfUp; bestChangeDown_ = changeDn; bestNumberDown_ = numInfDn; bestObject_ = thisOne; // See if user is overriding way if (thisOne->object() && thisOne->object()->preferredWay()) betterWay = thisOne->object()->preferredWay(); } return betterWay; } /* Sets or gets best criterion so far */ void CbcBranchDefaultDecision::setBestCriterion(double value) { bestCriterion_ = value; } double CbcBranchDefaultDecision::getBestCriterion() const { return bestCriterion_; } /* Compare N branching objects. Return index of best and sets way of branching in chosen object. This routine is used only after strong branching. */ int CbcBranchDefaultDecision::bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied, double * changeUp, int * numberInfeasibilitiesUp, double * changeDown, int * numberInfeasibilitiesDown, double objectiveValue) { int bestWay = 0; int whichObject = -1; if (numberObjects) { CbcModel * model = cbcModel(); // at continuous //double continuousObjective = model->getContinuousObjective(); //int continuousInfeasibilities = model->getContinuousInfeasibilities(); // average cost to get rid of infeasibility //double averageCostPerInfeasibility = //(objectiveValue-continuousObjective)/ //(double) (abs(continuousInfeasibilities-numberUnsatisfied)+1); /* beforeSolution is : 0 - before any solution n - n heuristic solutions but no branched one -1 - branched solution found */ int numberSolutions = model->getSolutionCount(); double cutoff = model->getCutoff(); int method = 0; int i; if (numberSolutions) { int numberHeuristic = model->getNumberHeuristicSolutions(); if (numberHeuristic < numberSolutions) { method = 1; } else { method = 2; // look further for ( i = 0 ; i < numberObjects ; i++) { int numberNext = numberInfeasibilitiesUp[i]; if (numberNext < numberUnsatisfied) { int numberUp = numberUnsatisfied - numberInfeasibilitiesUp[i]; double perUnsatisfied = changeUp[i] / static_cast (numberUp); double estimatedObjective = objectiveValue + numberUnsatisfied * perUnsatisfied; if (estimatedObjective < cutoff) method = 3; } numberNext = numberInfeasibilitiesDown[i]; if (numberNext < numberUnsatisfied) { int numberDown = numberUnsatisfied - numberInfeasibilitiesDown[i]; double perUnsatisfied = changeDown[i] / static_cast (numberDown); double estimatedObjective = objectiveValue + numberUnsatisfied * perUnsatisfied; if (estimatedObjective < cutoff) method = 3; } } } method = 2; } else { method = 0; } // Uncomment next to force method 4 //method=4; // FIXME This should be an enum. It will be easier to // understand in the code than numbers. /* Methods : 0 - fewest infeasibilities 1 - largest min change in objective 2 - as 1 but use sum of changes if min close 3 - predicted best solution 4 - take cheapest up branch if infeasibilities same */ int bestNumber = COIN_INT_MAX; double bestCriterion = -1.0e50; double alternativeCriterion = -1.0; double bestEstimate = 1.0e100; switch (method) { case 0: // could add in depth as well for ( i = 0 ; i < numberObjects ; i++) { int thisNumber = CoinMin(numberInfeasibilitiesUp[i], numberInfeasibilitiesDown[i]); if (thisNumber <= bestNumber) { int betterWay = 0; if (numberInfeasibilitiesUp[i] < numberInfeasibilitiesDown[i]) { if (numberInfeasibilitiesUp[i] < bestNumber) { betterWay = 1; } else { if (changeUp[i] < bestCriterion) betterWay = 1; } } else if (numberInfeasibilitiesUp[i] > numberInfeasibilitiesDown[i]) { if (numberInfeasibilitiesDown[i] < bestNumber) { betterWay = -1; } else { if (changeDown[i] < bestCriterion) betterWay = -1; } } else { // up and down have same number bool better = false; if (numberInfeasibilitiesUp[i] < bestNumber) { better = true; } else if (numberInfeasibilitiesUp[i] == bestNumber) { if (CoinMin(changeUp[i], changeDown[i]) < bestCriterion) better = true;; } if (better) { // see which way if (changeUp[i] <= changeDown[i]) betterWay = 1; else betterWay = -1; } } if (betterWay) { bestCriterion = CoinMin(changeUp[i], changeDown[i]); bestNumber = thisNumber; whichObject = i; bestWay = betterWay; } } } break; case 1: for ( i = 0 ; i < numberObjects ; i++) { int betterWay = 0; if (changeUp[i] <= changeDown[i]) { if (changeUp[i] > bestCriterion) betterWay = 1; } else { if (changeDown[i] > bestCriterion) betterWay = -1; } if (betterWay) { bestCriterion = CoinMin(changeUp[i], changeDown[i]); whichObject = i; bestWay = betterWay; } } break; case 2: for ( i = 0 ; i < numberObjects ; i++) { double change = CoinMin(changeUp[i], changeDown[i]); double sum = changeUp[i] + changeDown[i]; bool take = false; if (change > 1.1*bestCriterion) take = true; else if (change > 0.9*bestCriterion && sum + change > bestCriterion + alternativeCriterion) take = true; if (take) { if (changeUp[i] <= changeDown[i]) { if (changeUp[i] > bestCriterion) bestWay = 1; } else { if (changeDown[i] > bestCriterion) bestWay = -1; } bestCriterion = change; alternativeCriterion = sum; whichObject = i; } } break; case 3: for ( i = 0 ; i < numberObjects ; i++) { int numberNext = numberInfeasibilitiesUp[i]; if (numberNext < numberUnsatisfied) { int numberUp = numberUnsatisfied - numberInfeasibilitiesUp[i]; double perUnsatisfied = changeUp[i] / static_cast (numberUp); double estimatedObjective = objectiveValue + numberUnsatisfied * perUnsatisfied; if (estimatedObjective < bestEstimate) { bestEstimate = estimatedObjective; bestWay = 1; whichObject = i; } } numberNext = numberInfeasibilitiesDown[i]; if (numberNext < numberUnsatisfied) { int numberDown = numberUnsatisfied - numberInfeasibilitiesDown[i]; double perUnsatisfied = changeDown[i] / static_cast (numberDown); double estimatedObjective = objectiveValue + numberUnsatisfied * perUnsatisfied; if (estimatedObjective < bestEstimate) { bestEstimate = estimatedObjective; bestWay = -1; whichObject = i; } } } break; case 4: // if number infeas same then cheapest up // first get best number or when going down // now choose smallest change up amongst equal number infeas for ( i = 0 ; i < numberObjects ; i++) { int thisNumber = CoinMin(numberInfeasibilitiesUp[i], numberInfeasibilitiesDown[i]); if (thisNumber <= bestNumber) { int betterWay = 0; if (numberInfeasibilitiesUp[i] < numberInfeasibilitiesDown[i]) { if (numberInfeasibilitiesUp[i] < bestNumber) { betterWay = 1; } else { if (changeUp[i] < bestCriterion) betterWay = 1; } } else if (numberInfeasibilitiesUp[i] > numberInfeasibilitiesDown[i]) { if (numberInfeasibilitiesDown[i] < bestNumber) { betterWay = -1; } else { if (changeDown[i] < bestCriterion) betterWay = -1; } } else { // up and down have same number bool better = false; if (numberInfeasibilitiesUp[i] < bestNumber) { better = true; } else if (numberInfeasibilitiesUp[i] == bestNumber) { if (CoinMin(changeUp[i], changeDown[i]) < bestCriterion) better = true;; } if (better) { // see which way if (changeUp[i] <= changeDown[i]) betterWay = 1; else betterWay = -1; } } if (betterWay) { bestCriterion = CoinMin(changeUp[i], changeDown[i]); bestNumber = thisNumber; whichObject = i; bestWay = betterWay; } } } bestCriterion = 1.0e50; for ( i = 0 ; i < numberObjects ; i++) { int thisNumber = numberInfeasibilitiesUp[i]; if (thisNumber == bestNumber && changeUp) { if (changeUp[i] < bestCriterion) { bestCriterion = changeUp[i]; whichObject = i; bestWay = 1; } } } break; } // set way in best if (whichObject >= 0) { CbcBranchingObject * bestObject = objects[whichObject]; if (bestObject->object() && bestObject->object()->preferredWay()) bestWay = bestObject->object()->preferredWay(); bestObject->way(bestWay); } else { COIN_DETAIL_PRINT(printf("debug\n")); } } return whichObject; } CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveFractional.cpp0000644000175000017500000000751512426717442020501 0ustar renerene/* $Id: CbcHeuristicDiveFractional.cpp 2093 2014-11-06 16:17:38Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcHeuristicDiveFractional.hpp" #include "CbcStrategy.hpp" // Default Constructor CbcHeuristicDiveFractional::CbcHeuristicDiveFractional() : CbcHeuristicDive() { } // Constructor from model CbcHeuristicDiveFractional::CbcHeuristicDiveFractional(CbcModel & model) : CbcHeuristicDive(model) { } // Destructor CbcHeuristicDiveFractional::~CbcHeuristicDiveFractional () { } // Clone CbcHeuristicDiveFractional * CbcHeuristicDiveFractional::clone() const { return new CbcHeuristicDiveFractional(*this); } // Create C++ lines to get to current state void CbcHeuristicDiveFractional::generateCpp( FILE * fp) { CbcHeuristicDiveFractional other; fprintf(fp, "0#include \"CbcHeuristicDiveFractional.hpp\"\n"); fprintf(fp, "3 CbcHeuristicDiveFractional heuristicDiveFractional(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicDiveFractional"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicDiveFractional);\n"); } // Copy constructor CbcHeuristicDiveFractional::CbcHeuristicDiveFractional(const CbcHeuristicDiveFractional & rhs) : CbcHeuristicDive(rhs) { } // Assignment operator CbcHeuristicDiveFractional & CbcHeuristicDiveFractional::operator=( const CbcHeuristicDiveFractional & rhs) { if (this != &rhs) { CbcHeuristicDive::operator=(rhs); } return *this; } bool CbcHeuristicDiveFractional::selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound) { int numberIntegers = model_->numberIntegers(); const int * integerVariable = model_->integerVariable(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); bestColumn = -1; bestRound = -1; // -1 rounds down, +1 rounds up double bestFraction = COIN_DBL_MAX; bool allTriviallyRoundableSoFar = true; int bestPriority = COIN_INT_MAX; for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; double value = newSolution[iColumn]; double fraction = value - floor(value); int round = 0; if (fabs(floor(value + 0.5) - value) > integerTolerance) { if (allTriviallyRoundableSoFar || (downLocks_[i] > 0 && upLocks_[i] > 0)) { if (allTriviallyRoundableSoFar && downLocks_[i] > 0 && upLocks_[i] > 0) { allTriviallyRoundableSoFar = false; bestFraction = COIN_DBL_MAX; } // the variable cannot be rounded if (fraction < 0.5) round = -1; else { round = 1; fraction = 1.0 - fraction; } // if variable is not binary, penalize it if (!solver->isBinary(iColumn)) fraction *= 1000.0; // if priorities then use if (priority_) { int thisRound=static_cast(priority_[i].direction); if ((thisRound&1)!=0) round = ((thisRound&2)==0) ? -1 : +1; if (priority_[i].priority>bestPriority) { fraction=COIN_DBL_MAX; } else if (priority_[i].priority(priority_[i].priority); bestFraction=COIN_DBL_MAX; } } if (fraction < bestFraction) { bestColumn = iColumn; bestFraction = fraction; bestRound = round; } } } } return allTriviallyRoundableSoFar; } CoinMP-1.8.3/Cbc/src/CbcCutSubsetModifier.hpp0000644000175000017500000000317512131054770017321 0ustar renerene// $Id: CbcCutSubsetModifier.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCutGenerator #ifndef CbcCutSubsetModifier_H #define CbcCutSubsetModifier_H #include "OsiSolverInterface.hpp" #include "OsiCuts.hpp" #include "CglCutGenerator.hpp" #include "CbcCutModifier.hpp" class CbcModel; class OsiRowCut; class OsiRowCutDebugger; /** Simple cut modifier base class In exotic circumstances - cuts may need to be modified a) strengthened - changed b) weakened - changed c) deleted - set to NULL d) unchanged initially get rid of cuts with variables >= k could weaken */ class CbcCutSubsetModifier : public CbcCutModifier { public: /// Default Constructor CbcCutSubsetModifier (); /// Useful Constructor CbcCutSubsetModifier (int firstOdd); // Copy constructor CbcCutSubsetModifier ( const CbcCutSubsetModifier &); /// Destructor virtual ~CbcCutSubsetModifier(); /// Assignment CbcCutSubsetModifier & operator=(const CbcCutSubsetModifier& rhs); /// Clone virtual CbcCutModifier * clone() const ; /** Returns 0 unchanged 1 strengthened 2 weakened 3 deleted */ virtual int modify(const OsiSolverInterface * solver, OsiRowCut & cut) ; /// Create C++ lines to get to current state virtual void generateCpp( FILE * ) {} protected: /// data /// First odd variable int firstOdd_; }; #endif //CbcCutSubsetModifier_H CoinMP-1.8.3/Cbc/src/Cbc_ampl.h0000644000175000017500000000323711510742604014450 0ustar renerene/* $Id: Cbc_ampl.h 1573 2011-01-05 01:12:36Z lou $ */ /* Copyright (C) 2006, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #ifndef AmplInterface_H #define AmplInterface_H typedef struct { int numberRows; int numberColumns; int numberBinary; int numberIntegers; /* non binary */ int numberSos; int numberElements; int numberArguments; int problemStatus; double direction; double offset; double objValue; double * objective; double * rowLower; double * rowUpper; double * columnLower; double * columnUpper; int * starts; int * rows; double * elements; double * primalSolution; double * dualSolution; int * columnStatus; int * rowStatus; int * priorities; int * branchDirection; double * pseudoDown; double * pseudoUp; char * sosType; int * sosPriority; int * sosStart; int * sosIndices; double * sosReference; int * cut; int * special; char ** arguments; char buffer[300]; int logLevel; int nonLinear; } ampl_info; #ifdef __cplusplus extern "C" { #endif /* return nonzero if bad */ int readAmpl(ampl_info * info, int argc, char ** argv, void ** coinModel); /* frees some input arrays */ void freeArrays1(ampl_info * info); /* frees rest */ void freeArrays2(ampl_info * info); /* frees fake arguments */ void freeArgs(ampl_info * info); /* writes ampl stuff */ void writeAmpl(ampl_info * info); /* objective precision */ int ampl_obj_prec(); #ifdef __cplusplus } #endif #endif CoinMP-1.8.3/Cbc/src/CbcCutModifier.cpp0000644000175000017500000000217512131054770016125 0ustar renerene// $Id: CbcCutModifier.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //Edwin 11/25/09 carved out of CbcCutGenerator #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include #include #include #include #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #else #include "OsiSolverInterface.hpp" #endif #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcCutGenerator.hpp" #include "CbcBranchDynamic.hpp" #include "CglProbing.hpp" #include "CoinTime.hpp" #include "CbcCutModifier.hpp" // Default Constructor CbcCutModifier::CbcCutModifier() { } // Destructor CbcCutModifier::~CbcCutModifier () { } // Copy constructor CbcCutModifier::CbcCutModifier ( const CbcCutModifier & /*rhs*/) { } // Assignment operator CbcCutModifier & CbcCutModifier::operator=( const CbcCutModifier & rhs) { if (this != &rhs) { } return *this; } CoinMP-1.8.3/Cbc/src/CbcSolverExpandKnapsack.cpp0000644000175000017500000006201712131054770020002 0ustar renerene/* $Id: CbcSolverExpandKnapsack.cpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolverExpandKnapsack.cpp Returns OsiSolverInterface (User should delete) On entry numberKnapsack is maximum number of Total entries Expanding possibilities of x*y, where x*y are both integers, constructing a knapsack constraint. Results in a tighter model. */ #include "CbcConfig.h" #include "CoinPragma.hpp" #include "OsiSolverInterface.hpp" #include "CglStored.hpp" #ifndef COIN_HAS_LINK #define COIN_HAS_LINK #endif #ifdef COIN_HAS_LINK #include "CbcLinked.hpp" #endif #ifdef COIN_HAS_LINK OsiSolverInterface * expandKnapsack(CoinModel & model, int * whichColumn, int * knapsackStart, int * knapsackRow, int &numberKnapsack, CglStored & stored, int logLevel, int fixedPriority, int SOSPriority, CoinModel & tightenedModel) { int maxTotal = numberKnapsack; // load from coin model OsiSolverLink *si = new OsiSolverLink(); OsiSolverInterface * finalModel = NULL; si->setDefaultMeshSize(0.001); // need some relative granularity si->setDefaultBound(100.0); si->setDefaultMeshSize(0.01); si->setDefaultBound(100000.0); si->setIntegerPriority(1000); si->setBiLinearPriority(10000); si->load(model, true, logLevel); // get priorities const int * priorities = model.priorities(); int numberColumns = model.numberColumns(); if (priorities) { OsiObject ** objects = si->objects(); int numberObjects = si->numberObjects(); for (int iObj = 0; iObj < numberObjects; iObj++) { int iColumn = objects[iObj]->columnNumber(); if (iColumn >= 0 && iColumn < numberColumns) { #ifndef NDEBUG OsiSimpleInteger * obj = dynamic_cast (objects[iObj]) ; #endif assert (obj); int iPriority = priorities[iColumn]; if (iPriority > 0) objects[iObj]->setPriority(iPriority); } } if (fixedPriority > 0) { si->setFixedPriority(fixedPriority); } if (SOSPriority < 0) SOSPriority = 100000; } CoinModel coinModel = *si->coinModel(); assert(coinModel.numberRows() > 0); tightenedModel = coinModel; int numberRows = coinModel.numberRows(); // Mark variables int * whichKnapsack = new int [numberColumns]; int iRow, iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) whichKnapsack[iColumn] = -1; int kRow; bool badModel = false; // analyze if (logLevel > 1) { for (iRow = 0; iRow < numberRows; iRow++) { /* Just obvious one at first positive non unit coefficients all integer positive rowUpper for now - linear (but further down in code may use nonlinear) column bounds should be tight */ //double lower = coinModel.getRowLower(iRow); double upper = coinModel.getRowUpper(iRow); if (upper < 1.0e10) { CoinModelLink triple = coinModel.firstInRow(iRow); bool possible = true; int n = 0; int n1 = 0; while (triple.column() >= 0) { int iColumn = triple.column(); const char * el = coinModel.getElementAsString(iRow, iColumn); if (!strcmp("Numeric", el)) { if (coinModel.columnLower(iColumn) == coinModel.columnUpper(iColumn)) { triple = coinModel.next(triple); continue; // fixed } double value = coinModel.getElement(iRow, iColumn); if (value < 0.0) { possible = false; } else { n++; if (value == 1.0) n1++; if (coinModel.columnLower(iColumn) < 0.0) possible = false; if (!coinModel.isInteger(iColumn)) possible = false; if (whichKnapsack[iColumn] >= 0) possible = false; } } else { possible = false; // non linear } triple = coinModel.next(triple); } if (n - n1 > 1 && possible) { double lower = coinModel.getRowLower(iRow); double upper = coinModel.getRowUpper(iRow); CoinModelLink triple = coinModel.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); lower -= coinModel.columnLower(iColumn) * triple.value(); upper -= coinModel.columnLower(iColumn) * triple.value(); triple = coinModel.next(triple); } printf("%d is possible %g <=", iRow, lower); // print triple = coinModel.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); if (coinModel.columnLower(iColumn) != coinModel.columnUpper(iColumn)) printf(" (%d,el %g up %g)", iColumn, triple.value(), coinModel.columnUpper(iColumn) - coinModel.columnLower(iColumn)); triple = coinModel.next(triple); } printf(" <= %g\n", upper); } } } } numberKnapsack = 0; for (kRow = 0; kRow < numberRows; kRow++) { iRow = kRow; /* Just obvious one at first positive non unit coefficients all integer positive rowUpper for now - linear (but further down in code may use nonlinear) column bounds should be tight */ //double lower = coinModel.getRowLower(iRow); double upper = coinModel.getRowUpper(iRow); if (upper < 1.0e10) { CoinModelLink triple = coinModel.firstInRow(iRow); bool possible = true; int n = 0; int n1 = 0; while (triple.column() >= 0) { int iColumn = triple.column(); const char * el = coinModel.getElementAsString(iRow, iColumn); if (!strcmp("Numeric", el)) { if (coinModel.columnLower(iColumn) == coinModel.columnUpper(iColumn)) { triple = coinModel.next(triple); continue; // fixed } double value = coinModel.getElement(iRow, iColumn); if (value < 0.0) { possible = false; } else { n++; if (value == 1.0) n1++; if (coinModel.columnLower(iColumn) < 0.0) possible = false; if (!coinModel.isInteger(iColumn)) possible = false; if (whichKnapsack[iColumn] >= 0) possible = false; } } else { possible = false; // non linear } triple = coinModel.next(triple); } if (n - n1 > 1 && possible) { // try CoinModelLink triple = coinModel.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); if (coinModel.columnLower(iColumn) != coinModel.columnUpper(iColumn)) whichKnapsack[iColumn] = numberKnapsack; triple = coinModel.next(triple); } knapsackRow[numberKnapsack++] = iRow; } } } if (logLevel > 0) printf("%d out of %d candidate rows are possible\n", numberKnapsack, numberRows); // Check whether we can get rid of nonlinearities /* mark rows -2 in knapsack and other variables -1 not involved n only in knapsack n */ int * markRow = new int [numberRows]; for (iRow = 0; iRow < numberRows; iRow++) markRow[iRow] = -1; int canDo = 1; // OK and linear for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinModelLink triple = coinModel.firstInColumn(iColumn); int iKnapsack = whichKnapsack[iColumn]; bool linear = true; // See if quadratic objective const char * expr = coinModel.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { linear = false; } while (triple.row() >= 0) { int iRow = triple.row(); if (iKnapsack >= 0) { if (markRow[iRow] == -1) { markRow[iRow] = iKnapsack; } else if (markRow[iRow] != iKnapsack) { markRow[iRow] = -2; } } const char * expr = coinModel.getElementAsString(iRow, iColumn); if (strcmp(expr, "Numeric")) { linear = false; } triple = coinModel.next(triple); } if (!linear) { if (whichKnapsack[iColumn] < 0) { canDo = 0; break; } else { canDo = 2; } } } int * markKnapsack = NULL; double * coefficient = NULL; double * linear = NULL; int * whichRow = NULL; int * lookupRow = NULL; badModel = (canDo == 0); if (numberKnapsack && canDo) { /* double check - OK if no nonlinear nonlinear only on columns in knapsack nonlinear only on columns in knapsack * ONE other - same for all in knapsack AND that is only row connected to knapsack (theoretically could split knapsack if two other and small numbers) also ONE could be ONE expression - not just a variable */ int iKnapsack; markKnapsack = new int [numberKnapsack]; coefficient = new double [numberKnapsack]; linear = new double [numberColumns]; for (iKnapsack = 0; iKnapsack < numberKnapsack; iKnapsack++) markKnapsack[iKnapsack] = -1; if (canDo == 2) { for (iRow = -1; iRow < numberRows; iRow++) { int numberOdd; CoinPackedMatrix * row = coinModel.quadraticRow(iRow, linear, numberOdd); if (row) { // see if valid const double * element = row->getElements(); const int * column = row->getIndices(); const CoinBigIndex * columnStart = row->getVectorStarts(); const int * columnLength = row->getVectorLengths(); int numberLook = row->getNumCols(); for (int i = 0; i < numberLook; i++) { int iKnapsack = whichKnapsack[i]; if (iKnapsack < 0) { // might be able to swap - but for now can't have knapsack in for (int j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iColumn = column[j]; if (whichKnapsack[iColumn] >= 0) { canDo = 0; // no good badModel = true; break; } } } else { // OK if in same knapsack - or maybe just one int marked = markKnapsack[iKnapsack]; for (int j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iColumn = column[j]; if (whichKnapsack[iColumn] != iKnapsack && whichKnapsack[iColumn] >= 0) { canDo = 0; // no good badModel = true; break; } else if (marked == -1) { markKnapsack[iKnapsack] = iColumn; marked = iColumn; coefficient[iKnapsack] = element[j]; coinModel.associateElement(coinModel.columnName(iColumn), 1.0); } else if (marked != iColumn) { badModel = true; canDo = 0; // no good break; } else { // could manage with different coefficients - but for now ... assert(coefficient[iKnapsack] == element[j]); } } } } delete row; } } } if (canDo) { // for any rows which are cuts whichRow = new int [numberRows]; lookupRow = new int [numberRows]; bool someNonlinear = false; double maxCoefficient = 1.0; for (iKnapsack = 0; iKnapsack < numberKnapsack; iKnapsack++) { if (markKnapsack[iKnapsack] >= 0) { someNonlinear = true; int iColumn = markKnapsack[iKnapsack]; maxCoefficient = CoinMax(maxCoefficient, fabs(coefficient[iKnapsack] * coinModel.columnUpper(iColumn))); } } if (someNonlinear) { // associate all columns to stop possible error messages for (iColumn = 0; iColumn < numberColumns; iColumn++) { coinModel.associateElement(coinModel.columnName(iColumn), 1.0); } } ClpSimplex tempModel; tempModel.loadProblem(coinModel); // Create final model - first without knapsacks int nCol = 0; int nRow = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (markRow[iRow] < 0) { lookupRow[iRow] = nRow; whichRow[nRow++] = iRow; } else { lookupRow[iRow] = -1; } } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (whichKnapsack[iColumn] < 0) whichColumn[nCol++] = iColumn; } ClpSimplex finalModelX(&tempModel, nRow, whichRow, nCol, whichColumn, false, false, false); OsiClpSolverInterface finalModelY(&finalModelX, true); finalModel = finalModelY.clone(); finalModelY.releaseClp(); // Put back priorities const int * priorities = model.priorities(); if (priorities) { finalModel->findIntegers(false); OsiObject ** objects = finalModel->objects(); int numberObjects = finalModel->numberObjects(); for (int iObj = 0; iObj < numberObjects; iObj++) { int iColumn = objects[iObj]->columnNumber(); if (iColumn >= 0 && iColumn < nCol) { #ifndef NDEBUG OsiSimpleInteger * obj = dynamic_cast (objects[iObj]) ; #endif assert (obj); int iPriority = priorities[whichColumn[iColumn]]; if (iPriority > 0) objects[iObj]->setPriority(iPriority); } } } for (iRow = 0; iRow < numberRows; iRow++) { whichRow[iRow] = iRow; } int numberOther = finalModel->getNumCols(); int nLargest = 0; int nelLargest = 0; int nTotal = 0; for (iKnapsack = 0; iKnapsack < numberKnapsack; iKnapsack++) { iRow = knapsackRow[iKnapsack]; int nCreate = maxTotal; int nelCreate = coinModel.expandKnapsack(iRow, nCreate, NULL, NULL, NULL, NULL); if (nelCreate < 0) badModel = true; nTotal += nCreate; nLargest = CoinMax(nLargest, nCreate); nelLargest = CoinMax(nelLargest, nelCreate); } if (nTotal > maxTotal) badModel = true; if (!badModel) { // Now arrays for building nelLargest = CoinMax(nelLargest, nLargest) + 1; double * buildObj = new double [nLargest]; double * buildElement = new double [nelLargest]; int * buildStart = new int[nLargest+1]; int * buildRow = new int[nelLargest]; // alow for integers in knapsacks OsiObject ** object = new OsiObject * [numberKnapsack+nTotal]; int nSOS = 0; int nObj = numberKnapsack; for (iKnapsack = 0; iKnapsack < numberKnapsack; iKnapsack++) { knapsackStart[iKnapsack] = finalModel->getNumCols(); iRow = knapsackRow[iKnapsack]; int nCreate = 10000; coinModel.expandKnapsack(iRow, nCreate, buildObj, buildStart, buildRow, buildElement); // Redo row numbers for (iColumn = 0; iColumn < nCreate; iColumn++) { for (int j = buildStart[iColumn]; j < buildStart[iColumn+1]; j++) { int jRow = buildRow[j]; jRow = lookupRow[jRow]; assert (jRow >= 0 && jRow < nRow); buildRow[j] = jRow; } } finalModel->addCols(nCreate, buildStart, buildRow, buildElement, NULL, NULL, buildObj); int numberFinal = finalModel->getNumCols(); for (iColumn = numberOther; iColumn < numberFinal; iColumn++) { if (markKnapsack[iKnapsack] < 0) { finalModel->setColUpper(iColumn, maxCoefficient); finalModel->setInteger(iColumn); } else { finalModel->setColUpper(iColumn, maxCoefficient + 1.0); finalModel->setInteger(iColumn); } OsiSimpleInteger * sosObject = new OsiSimpleInteger(finalModel, iColumn); sosObject->setPriority(1000000); object[nObj++] = sosObject; buildRow[iColumn-numberOther] = iColumn; buildElement[iColumn-numberOther] = 1.0; } if (markKnapsack[iKnapsack] < 0) { // convexity row finalModel->addRow(numberFinal - numberOther, buildRow, buildElement, 1.0, 1.0); } else { int iColumn = markKnapsack[iKnapsack]; int n = numberFinal - numberOther; buildRow[n] = iColumn; buildElement[n++] = -fabs(coefficient[iKnapsack]); // convexity row (sort of) finalModel->addRow(n, buildRow, buildElement, 0.0, 0.0); OsiSOS * sosObject = new OsiSOS(finalModel, n - 1, buildRow, NULL, 1); sosObject->setPriority(iKnapsack + SOSPriority); // Say not integral even if is (switch off heuristics) sosObject->setIntegerValued(false); object[nSOS++] = sosObject; } numberOther = numberFinal; } finalModel->addObjects(nObj, object); for (iKnapsack = 0; iKnapsack < nObj; iKnapsack++) delete object[iKnapsack]; delete [] object; // Can we move any rows to cuts const int * cutMarker = coinModel.cutMarker(); if (cutMarker && 0) { printf("AMPL CUTS OFF until global cuts fixed\n"); cutMarker = NULL; } if (cutMarker) { // Row copy const CoinPackedMatrix * matrixByRow = finalModel->getMatrixByRow(); const double * elementByRow = matrixByRow->getElements(); const int * column = matrixByRow->getIndices(); const CoinBigIndex * rowStart = matrixByRow->getVectorStarts(); const int * rowLength = matrixByRow->getVectorLengths(); const double * rowLower = finalModel->getRowLower(); const double * rowUpper = finalModel->getRowUpper(); int nDelete = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (cutMarker[iRow] && lookupRow[iRow] >= 0) { int jRow = lookupRow[iRow]; whichRow[nDelete++] = jRow; int start = rowStart[jRow]; stored.addCut(rowLower[jRow], rowUpper[jRow], rowLength[jRow], column + start, elementByRow + start); } } finalModel->deleteRows(nDelete, whichRow); } knapsackStart[numberKnapsack] = finalModel->getNumCols(); delete [] buildObj; delete [] buildElement; delete [] buildStart; delete [] buildRow; finalModel->writeMps("full"); } } } delete [] whichKnapsack; delete [] markRow; delete [] markKnapsack; delete [] coefficient; delete [] linear; delete [] whichRow; delete [] lookupRow; delete si; si = NULL; if (!badModel && finalModel) { finalModel->setDblParam(OsiObjOffset, coinModel.objectiveOffset()); return finalModel; } else { delete finalModel; printf("can't make knapsacks - did you set fixedPriority (extra1)\n"); return NULL; } } #endif //COIN_HAS_LINK // Fills in original solution (coinModel length) void afterKnapsack(const CoinModel & coinModel2, const int * whichColumn, const int * knapsackStart, const int * knapsackRow, int numberKnapsack, const double * knapsackSolution, double * solution, int logLevel) { CoinModel coinModel = coinModel2; int numberColumns = coinModel.numberColumns(); int iColumn; // associate all columns to stop possible error messages for (iColumn=0;iColumn1.0e-5) { if (k>=0) { printf("Two nonzero values for knapsack %d at (%d,%g) and (%d,%g)\n",iKnapsack, k,knapsackSolution[k],iColumn,knapsackSolution[iColumn]); abort(); } k=iColumn; assert (fabs(floor(knapsackSolution[iColumn]+0.5)-knapsackSolution[iColumn])<1.0e-5); } } if (k>=0) { int iRow = knapsackRow[iKnapsack]; int nCreate = 10000; int nel=coinModel.expandKnapsack(iRow,nCreate,NULL,NULL,buildRow,buildElement,k-knapsackStart[iKnapsack]); assert (nel); if (logLevel>0) printf("expanded column %d in knapsack %d has %d nonzero entries:\n", k-knapsackStart[iKnapsack],iKnapsack,nel); for (int i=0;i0) printf("%d - original %d has value %g\n",i,jColumn,value); solution[jColumn]=value; } } } delete [] buildRow; delete [] buildElement; #if 0 for (iColumn=0;iColumn1.0e-5&&coinModel.isInteger(iColumn)) printf("%d %g\n",iColumn,solution[iColumn]); } #endif } CoinMP-1.8.3/Cbc/src/CbcBranchingObject.cpp0000644000175000017500000000341012131054770016726 0ustar renerene// $Id: CbcBranchingObject.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/12/2009 carved from CbcBranchBase #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "OsiChooseVariable.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcBranchBase.hpp" // Default Constructor CbcBranchingObject::CbcBranchingObject() : OsiBranchingObject() { model_ = NULL; originalCbcObject_ = NULL; variable_ = -1; way_ = 0; } // Useful constructor CbcBranchingObject::CbcBranchingObject (CbcModel * model, int variable, int way , double value) : OsiBranchingObject(model->solver(), value) { model_ = model; originalCbcObject_ = NULL; variable_ = variable; way_ = way; } // Copy constructor CbcBranchingObject::CbcBranchingObject ( const CbcBranchingObject & rhs) : OsiBranchingObject(rhs) { model_ = rhs.model_; originalCbcObject_ = rhs.originalCbcObject_; variable_ = rhs.variable_; way_ = rhs.way_; value_ = rhs.value_; } // Assignment operator CbcBranchingObject & CbcBranchingObject::operator=( const CbcBranchingObject & rhs) { if (this != &rhs) { OsiBranchingObject::operator=(rhs); model_ = rhs.model_; originalCbcObject_ = rhs.originalCbcObject_; variable_ = rhs.variable_; way_ = rhs.way_; } return *this; } // Destructor CbcBranchingObject::~CbcBranchingObject () { } CoinMP-1.8.3/Cbc/src/CbcGenBaB.cpp0000644000175000017500000007460612131054770015001 0ustar renerene/* Copyright (C) 2007, Lou Hafer, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). $Id: CbcGenBaB.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /* This file is part of cbc-generic. */ #include #include "CoinTime.hpp" #include "OsiSolverInterface.hpp" #include "OsiChooseVariable.hpp" #include "CglPreProcess.hpp" #include "CbcModel.hpp" #include "CbcCutGenerator.hpp" #include "CbcBranchActual.hpp" #include "CbcStrategy.hpp" #include "CbcGenCtlBlk.hpp" #include "CbcGenParam.hpp" #include "CbcGenCbcParam.hpp" #define CBC_TRACK_SOLVERS 1 // #define COIN_CBC_VERBOSITY 5 /* The support functions for the main branch-and-cut action routine. */ namespace { char svnid[] = "$Id: CbcGenBaB.cpp 1899 2013-04-09 18:12:08Z stefan $" ; /* A hack to fix variables based on reduced cost prior to branch-and-cut. Note that we're *not* looking at the integrality gap here. Given the reduced costs of the root relaxation, we're simply placing a bet that variables with really unfavourable reduced costs that are at their most favourable bound in the root relaxation will never move from that bound. For the standard OsiSolverInterface, this requires a bit of effort as the solution and bounds arrays are const and the functions to change them have incompatible interfaces. */ void reducedCostHack (OsiSolverInterface *osi, double threshold) { int numCols = osi->getNumCols() ; int i ; const double *lower = osi->getColLower() ; const double *upper = osi->getColUpper() ; const double *solution = osi->getColSolution() ; const double *dj = osi->getReducedCost() ; /* First task: scan the columns looking for variables that are at their favourable bound and have reduced cost that exceeds the threshold. Remember the column index and the value. */ double *chgBnds = new double [numCols] ; int *chgCols = new int [numCols] ; int numFixed = 0 ; for (i = 0 ; i < numCols ; i++) { if (osi->isInteger(i)) { double value = solution[i] ; if (value < lower[i] + 1.0e-5 && dj[i] > threshold) { chgCols[numFixed] = i ; chgBnds[numFixed] = lower[i] ; numFixed++ ; } else if (value > upper[i] - 1.0e-5 && dj[i] < -threshold) { chgCols[numFixed] = i ; chgBnds[numFixed] = upper[i] ; numFixed++ ; } } } /* Second task: For variables that we want to fix, we need to: * Prepare an array with the new lower and upper bounds for variables that will be fixed. setColSetBounds requires an array with column indices and an array with new values for both bounds. * Set the correct value in a copy of the current solution. setColSolution requires a complete solution. */ if (numFixed > 0) { double *newSoln = CoinCopyOfArray(solution, numCols) ; double *newBnds = new double [2*numFixed] ; double *bndPtr = &newBnds[0] ; for (i = 0 ; i < numFixed ; i++) { int j = chgCols[i] ; double val = chgBnds[i] ; *bndPtr++ = val ; *bndPtr++ = val ; newSoln[j] = val ; } osi->setColSetBounds(&chgCols[0], &chgCols[numFixed], &newBnds[0]) ; osi->setColSolution(&newSoln[0]) ; std::cout << "Reduced cost fixing prior to B&C: " << numFixed << " columns fixed." << std::endl ; delete[] newSoln ; delete[] newBnds ; } delete[] chgBnds ; delete[] chgCols ; return ; } /* Helper routine to solve a continuous relaxation and print something intelligent when the result is other than optimal. Returns true if the result is optimal, false otherwise. */ bool solveRelaxation (CbcModel *model) { OsiSolverInterface *osi = model->solver() ; model->initialSolve() ; if (!(osi->isProvenOptimal())) { bool reason = false ; if (osi->isProvenPrimalInfeasible()) { std::cout << "Continuous relaxation is primal infeasible." << std::endl ; reason = true ; } if (osi->isProvenDualInfeasible()) { std::cout << "Continuous relaxation is dual infeasible." << std::endl ; reason = true ; } if (osi->isIterationLimitReached()) { std::cout << "Continuous solver reached iteration limit." << std::endl ; reason = true ; } if (osi->isAbandoned()) { std::cout << "Continuous solver abandoned the problem." << std::endl ; reason = true ; } if (reason == false) { std::cout << "Continuous solver failed for unknown reason." << std::endl ; } return (false) ; } return (true) ; } /* Helper routine to establish a priority vector. */ void setupPriorities (CbcModel *model, CbcGenCtlBlk::BPControl how) { int numCols = model->getNumCols() ; int *sort = new int[numCols] ; double *dsort = new double[numCols] ; int *priority = new int[numCols] ; const double *objective = model->getObjCoefficients() ; int iColumn ; int n = 0 ; bool priorityOK = true ; for (iColumn = 0 ; iColumn < numCols ; iColumn++) { if (model->isInteger(iColumn)) { sort[n] = n ; if (how == CbcGenCtlBlk::BPCost) { dsort[n++] = -objective[iColumn] ; } else if (how == CbcGenCtlBlk::BPOrder) { dsort[n++] = iColumn ; } else { std::cerr << "setupPriorities: Unrecognised priority specification." << std::endl ; priorityOK = false ; } } } if (priorityOK) { CoinSort_2(dsort, dsort + n, sort) ; int level = 0 ; double last = -1.0e100 ; for (int i = 0 ; i < n ; i++) { int iPut = sort[i] ; if (dsort[i] != last) { level++ ; last = dsort[i] ; } priority[iPut] = level ; } model->passInPriorities(priority, false) ; } delete [] priority ; delete [] sort ; delete [] dsort ; return ; } /* Helper routine to install a batch of heuristics. Each call to getXXXHeuristic will return a pointer to the heuristic object in gen iff the heuristic is enabled. */ void installHeuristics (CbcGenCtlBlk *ctlBlk, CbcModel *model) { CbcGenCtlBlk::CGControl action ; CbcHeuristic *gen ; CbcTreeLocal *localTree ; /* FPump goes first because it only works before there's a solution. */ action = ctlBlk->getFPump(gen, model) ; if (action != CbcGenCtlBlk::CGOff) { model->addHeuristic(gen, "FPump") ; } action = ctlBlk->getRounding(gen, model) ; if (action != CbcGenCtlBlk::CGOff) { model->addHeuristic(gen, "Rounding") ; } action = ctlBlk->getCombine(gen, model) ; if (action != CbcGenCtlBlk::CGOff) { model->addHeuristic(gen, "Combine") ; } action = ctlBlk->getGreedyCover(gen, model) ; if (action != CbcGenCtlBlk::CGOff) { model->addHeuristic(gen, "GCov") ; } action = ctlBlk->getGreedyEquality(gen, model) ; if (action != CbcGenCtlBlk::CGOff) { model->addHeuristic(gen, "GEq") ; } /* This one's a bit different. We acquire the local tree and install it in the model. */ action = ctlBlk->getTreeLocal(localTree, model) ; if (action != CbcGenCtlBlk::CGOff) { model->passInTreeHandler(*localTree) ; } return ; } /* Helper routine to install cut generators. I need to install the new lift-and-project generator (LandP). Also need to figure out stored cuts. */ void installCutGenerators (CbcGenCtlBlk *ctlBlk, CbcModel *model) { int switches[20] ; int genCnt = 0 ; CbcGenCtlBlk::CGControl action ; CglCutGenerator *gen ; /* The magic numbers for the howOften parameter that determines how often the generator is invoked. -100 is disabled, -99 is root only, -98 will stay active only so long as it generates cuts that improve the objective. A value 1 <= k <= 90 means the generator will be called every k nodes. If k is negative, then it can be switched off if unproductive. If k is positive, it'll carry on regardless. */ int howOften[CbcGenCtlBlk::CGMarker] ; howOften[CbcGenCtlBlk::CGOff] = -100 ; howOften[CbcGenCtlBlk::CGOn] = -1 ; howOften[CbcGenCtlBlk::CGRoot] = -99 ; howOften[CbcGenCtlBlk::CGIfMove] = -98 ; howOften[CbcGenCtlBlk::CGForceOn] = 1 ; howOften[CbcGenCtlBlk::CGForceBut] = 1 ; /* A negative value for rowCuts means that the specified actions happen only at the root. */ action = ctlBlk->getProbing(gen) ; if (action != CbcGenCtlBlk::CGOff) { if (action == CbcGenCtlBlk::CGForceBut) { CglProbing *probingGen = dynamic_cast(gen) ; probingGen->setRowCuts(-3) ; } model->addCutGenerator(gen, howOften[action], "Probing") ; switches[genCnt++] = 0 ; } action = ctlBlk->getGomory(gen) ; if (action != CbcGenCtlBlk::CGOff) { model->addCutGenerator(gen, howOften[action], "Gomory") ; switches[genCnt++] = -1 ; } action = ctlBlk->getKnapsack(gen) ; if (action != CbcGenCtlBlk::CGOff) { model->addCutGenerator(gen, howOften[action], "Knapsack") ; switches[genCnt++] = 0 ; } action = ctlBlk->getRedSplit(gen) ; if (action != CbcGenCtlBlk::CGOff) { model->addCutGenerator(gen, howOften[action], "RedSplit") ; switches[genCnt++] = 1 ; } action = ctlBlk->getClique(gen) ; if (action != CbcGenCtlBlk::CGOff) { model->addCutGenerator(gen, howOften[action], "Clique") ; switches[genCnt++] = 0 ; } action = ctlBlk->getMir(gen) ; if (action != CbcGenCtlBlk::CGOff) { model->addCutGenerator(gen, howOften[action], "MIR2") ; switches[genCnt++] = -1 ; } action = ctlBlk->getFlow(gen) ; if (action != CbcGenCtlBlk::CGOff) { model->addCutGenerator(gen, howOften[action], "Flow") ; switches[genCnt++] = 1 ; } action = ctlBlk->getTwomir(gen) ; if (action != CbcGenCtlBlk::CGOff) { model->addCutGenerator(gen, howOften[action], "2-MIR") ; switches[genCnt++] = 1 ; } /* Set control parameters on cut generators. cutDepth says `use this generator when (depth in tree) mod cutDepth == 0'. setSwitchOffIfLessThan says `switch this generator off if the number of cuts at the root is less than the given value'. Sort of. I need to document the magic numbers for howOften , etc. */ genCnt = model->numberCutGenerators() ; int iGen ; for (iGen = 0 ; iGen < genCnt ; iGen++) { CbcCutGenerator *generator = model->cutGenerator(iGen) ; int howOften = generator->howOften() ; if (howOften == -98 || howOften == -99) { generator->setSwitchOffIfLessThan(switches[iGen]) ; } generator->setTiming(true) ; int cutDepth = ctlBlk->getCutDepth() ; if (cutDepth >= 0) { generator->setWhatDepth(cutDepth) ; } } /* Now some additional control parameters that affect cut generation activity. Minimum drop is the minimum objective degradation required to continue with cut passes. We want at least .05 unless the objective is tiny, in which case we'll drop down to a floor of .0001. */ { double objFrac = fabs(model->getMinimizationObjValue()) * .001 + .0001 ; double minDrop = CoinMin(.05, objFrac) ; model->setMinimumDrop(minDrop) ; } /* Set the maximum number of rounds of cut generation at the root and at nodes in the tree. If the value is positive, cut generation will terminate early if the objective degradation doesn't meet the minimum drop requirement. If the value is negatie, minimum drop is not considered. At the root, for small problems, push for 100 passes (really we're betting that we'll stop because no cuts were generated). For medium size problems, the same but say we can quit if we're not achieving the minimum drop. For big problems, cut the number of rounds to 20. The user may have expressed an opinion; if so, it's already set. Once we're in the tree, aim for one pass per activation. */ if (ctlBlk->setByUser_[CbcCbcParam::CUTPASS] == false) { int numCols = model->getNumCols() ; if (numCols < 500) model->setMaximumCutPassesAtRoot(-100) ; else if (numCols < 5000) model->setMaximumCutPassesAtRoot(100) ; else model->setMaximumCutPassesAtRoot(20) ; } model->setMaximumCutPasses(1) ; return ; } /* Install `objects' (integers, SOS sets, etc.) in the OSI. Cribbed from CoinSolve 061216 and subjected to moderate rewriting. A substantial amount of code that's only relevant for AMPL has been deleted. We're only supporting OsiObjects in cbc-generic. */ void setupObjects (OsiSolverInterface *osi, bool didIPP, CglPreProcess *ippObj) { int numInts = osi->getNumIntegers() ; int numObjs = osi->numberObjects() ; /* Does this OSI have defined objects already? If not, we'd best define the basic integer objects. */ if (numInts == 0 || numObjs == 0) { osi->findIntegers(false) ; numInts = osi->getNumIntegers() ; numObjs = osi->numberObjects() ; } /* If we did preprocessing and discovered SOS sets, create SOS objects and install them in the OSI. The priority of SOS objects is set so that larger sets have higher (lower numeric value) priority. The priority of the original objects is reset to be lower than the priority of any SOS object. Since the SOS objects are copied into the OSI, we need to delete our originals once they've been installed. It's not clear to me that this is the right thing to do, particularly if the OSI comes equipped with complex objects. -- lh, 061216 -- */ if (didIPP && ippObj->numberSOS()) { OsiObject **oldObjs = osi->objects() ; int numCols = osi->getNumCols() ; for (int iObj = 0 ; iObj < numObjs ; iObj++) { oldObjs[iObj]->setPriority(numCols + 1) ; } int numSOS = ippObj->numberSOS() ; OsiObject **sosObjs = new OsiObject *[numSOS] ; const int *starts = ippObj->startSOS() ; const int *which = ippObj->whichSOS() ; const int *type = ippObj->typeSOS() ; const double *weight = ippObj->weightSOS() ; int iSOS ; for (iSOS = 0 ; iSOS < numSOS ; iSOS++) { int iStart = starts[iSOS] ; int sosLen = starts[iSOS+1] - iStart ; sosObjs[iSOS] = new OsiSOS(osi, sosLen, which + iStart, weight + iStart, type[iSOS]) ; sosObjs[iSOS]->setPriority(numCols - sosLen) ; } osi->addObjects(numSOS, sosObjs) ; for (iSOS = 0 ; iSOS < numSOS ; iSOS++) delete sosObjs[iSOS] ; delete [] sosObjs ; } return ; } } // end local namespace namespace CbcGenParamUtils { /* Run branch-and-cut. */ int doBaCParam (CoinParam *param) { assert (param != 0) ; CbcGenParam *genParam = dynamic_cast(param) ; assert (genParam != 0) ; CbcGenCtlBlk *ctlBlk = genParam->obj() ; assert (ctlBlk != 0) ; CbcModel *model = ctlBlk->model_ ; assert (model != 0) ; /* Setup to return nonfatal/fatal error (1/-1) by default. */ int retval ; if (CoinParamUtils::isInteractive()) { retval = 1 ; } else { retval = -1 ; } ctlBlk->setBaBStatus(CbcGenCtlBlk::BACAbandon, CbcGenCtlBlk::BACmInvalid, CbcGenCtlBlk::BACwNotStarted, false, 0) ; /* We ain't gonna do squat without a good model. */ if (!ctlBlk->goodModel_) { std::cout << "** Current model not valid!" << std::endl ; return (retval) ; } /* Start the clock ticking. */ double time1 = CoinCpuTime() ; double time2 ; /* Create a clone of the model which we can modify with impunity. Extract the underlying solver for convenient access. */ CbcModel babModel(*model) ; OsiSolverInterface *babSolver = babModel.solver() ; assert (babSolver != 0) ; # if CBC_TRACK_SOLVERS > 0 std::cout << "doBaCParam: initial babSolver is " << std::hex << babSolver << std::dec << ", log level " << babSolver->messageHandler()->logLevel() << "." << std::endl ; # endif /* Solve the root relaxation. Bail unless it solves to optimality. */ if (!solveRelaxation(&babModel)) { ctlBlk->setBaBStatus(&babModel, CbcGenCtlBlk::BACwBareRoot) ; return (0) ; } # if COIN_CBC_VERBOSITY > 0 std::cout << "doBaCParam: initial relaxation z = " << babSolver->getObjValue() << "." << std::endl ; # endif /* Are we up for fixing variables based on reduced cost alone? */ if (ctlBlk->djFix_.action_ == true) { reducedCostHack(babSolver, ctlBlk->djFix_.threshold_) ; } /* Time to consider preprocessing. We'll do a bit of setup before getting to the meat of the issue. preIppSolver will hold a clone of the unpreprocessed constraint system. We'll need it when we postprocess. ippSolver holds the preprocessed constraint system. Again, we clone it and give the clone to babModel for B&C. Presumably we need an unmodified copy of the preprocessed system to do postprocessing, but the copy itself is hidden inside the preprocess object. */ OsiSolverInterface *preIppSolver = 0 ; CglPreProcess ippObj ; bool didIPP = false ; int numberChanged = 0 ; int numberOriginalColumns = babSolver->getNumCols() ; CbcGenCtlBlk::IPPControl ippAction = ctlBlk->getIPPAction() ; if (!(ippAction == CbcGenCtlBlk::IPPOff || ippAction == CbcGenCtlBlk::IPPStrategy)) { double timeLeft = babModel.getMaximumSeconds() ; preIppSolver = babSolver->clone() ; OsiSolverInterface *ippSolver ; # if CBC_TRACK_SOLVERS > 0 std::cout << "doBaCParam: clone made prior to IPP is " << std::hex << preIppSolver << std::dec << ", log level " << preIppSolver->messageHandler()->logLevel() << "." << std::endl ; # endif preIppSolver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo) ; ippObj.messageHandler()->setLogLevel(babModel.logLevel()) ; CglProbing probingGen ; probingGen.setUsingObjective(true) ; probingGen.setMaxPass(3) ; probingGen.setMaxProbeRoot(preIppSolver->getNumCols()) ; probingGen.setMaxElements(100) ; probingGen.setMaxLookRoot(50) ; probingGen.setRowCuts(3) ; ippObj.addCutGenerator(&probingGen) ; /* For preProcessNonDefault, the 2nd parameter controls the conversion of clique and SOS constraints. 0 does nothing, -1 converts <= to ==, and 2 and 3 form SOS sets under strict and not-so-strict conditions, respectively. */ int convert = 0 ; if (ippAction == CbcGenCtlBlk::IPPEqual) { convert = -1 ; } else if (ippAction == CbcGenCtlBlk::IPPEqualAll) { convert = -2 ; } else if (ippAction == CbcGenCtlBlk::IPPSOS) { convert = 2 ; } else if (ippAction == CbcGenCtlBlk::IPPTrySOS) { convert = 3 ; } ippSolver = ippObj.preProcessNonDefault(*preIppSolver, convert, 10) ; # if CBC_TRACK_SOLVERS > 0 std::cout << "doBaCParam: solver returned from IPP is " << std::hex << ippSolver << std::dec ; if (ippSolver) { std::cout << ", log level " << ippSolver->messageHandler()->logLevel() ; } std::cout << "." << std::endl ; # endif /* ippSolver == 0 is success of a sort --- integer preprocess has found the problem to be infeasible or unbounded. Need to think about how to indicate status. */ if (!ippSolver) { std::cout << "Integer preprocess says infeasible or unbounded" << std::endl ; delete preIppSolver ; ctlBlk->setBaBStatus(&babModel, CbcGenCtlBlk::BACwIPP) ; return (0) ; } # if COIN_CBC_VERBOSITY > 0 else { std::cout << "After integer preprocessing, model has " << ippSolver->getNumRows() << " rows, " << ippSolver->getNumCols() << " columns, and " << ippSolver->getNumElements() << " elements." << std::endl ; } # endif preIppSolver->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; ippSolver->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; if (ippAction == CbcGenCtlBlk::IPPSave) { ippSolver->writeMps("presolved", "mps", 1.0) ; std::cout << "Integer preprocessed model written to `presolved.mps' " << "as minimisation problem." << std::endl ; } OsiSolverInterface *osiTmp = ippSolver->clone() ; babModel.assignSolver(osiTmp) ; babSolver = babModel.solver() ; # if CBC_TRACK_SOLVERS > 0 std::cout << "doBaCParam: clone of IPP solver passed to babModel is " << std::hex << babSolver << std::dec << ", log level " << babSolver->messageHandler()->logLevel() << "." << std::endl ; # endif if (!solveRelaxation(&babModel)) { delete preIppSolver ; ctlBlk->setBaBStatus(&babModel, CbcGenCtlBlk::BACwIPPRelax) ; return (0) ; } # if COIN_CBC_VERBOSITY > 0 std::cout << "doBaCParam: presolved relaxation z = " << babSolver->getObjValue() << "." << std::endl ; # endif babModel.setMaximumSeconds(timeLeft - (CoinCpuTime() - time1)) ; didIPP = true ; } /* At this point, babModel and babSolver hold the constraint system we'll use for B&C (either the original system or the preprocessed system) and we have a solution to the lp relaxation. If we're using the COSTSTRATEGY option, set up priorities here and pass them to the babModel. */ if (ctlBlk->priorityAction_ != CbcGenCtlBlk::BPOff) { setupPriorities(&babModel, ctlBlk->priorityAction_) ; } /* Install heuristics and cutting planes. */ installHeuristics(ctlBlk, &babModel) ; installCutGenerators(ctlBlk, &babModel) ; /* Set up status print frequency for babModel. */ if (babModel.getNumCols() > 2000 || babModel.getNumRows() > 1500 || babModel.messageHandler()->logLevel() > 1) babModel.setPrintFrequency(100) ; /* If we've read in a known good solution for debugging, activate the row cut debugger. */ if (ctlBlk->debugSol_.values_) { if (ctlBlk->debugSol_.numCols_ == babModel.getNumCols()) { babSolver->activateRowCutDebugger(ctlBlk->debugSol_.values_) ; } else { std::cout << "doBaCParam: debug file has incorrect number of columns." << std::endl ; } } /* Set ratio-based integrality gap, if specified by user. */ if (ctlBlk->setByUser_[CbcCbcParam::GAPRATIO] == true) { double obj = babSolver->getObjValue() ; double gapRatio = babModel.getDblParam(CbcModel::CbcAllowableFractionGap) ; double gap = gapRatio * (1.0e-5 + fabs(obj)) ; babModel.setAllowableGap(gap) ; std::cout << "doBaCParam: Continuous objective = " << obj << ", so allowable gap set to " << gap << std::endl ; } /* A bit of mystery code. As best I can figure, setSpecialOptions(2) suppresses the removal of warm start information when checkSolution runs an lp to check a solution. John's comment, ``probably faster to use a basis to get integer solutions'' makes some sense in this context. Didn't try to track down moreMipOptions just yet. */ babModel.setSpecialOptions(babModel.specialOptions() | 2) ; /* { int ndx = whichParam(MOREMIPOPTIONS,numberParameters,parameters) ; int moreMipOptions = parameters[ndx].intValue() ; if (moreMipOptions >= 0) { printf("more mip options %d\n",moreMipOptions); babModel.setSearchStrategy(moreMipOptions); } } */ /* Begin the final run-up to branch-and-cut. Make sure that objects are set up in the solver. It's possible that whoever loaded the model into the solver also set up objects. But it's also entirely likely that none exist to this point (and interesting to note that IPP doesn't need to know anything about objects). */ setupObjects(babSolver, didIPP, &ippObj) ; /* Set the branching method. We can't do this until we establish objects, because the constructor will set up arrays based on the number of objects, and there's no provision to set this information after creation. Arguably not good --- it'd be nice to set this in the prototype model that's cloned for this routine. In CoinSolve, shadowPriceMode is handled with the TESTOSI option. */ OsiChooseStrong strong(babSolver) ; strong.setNumberBeforeTrusted(babModel.numberBeforeTrust()) ; strong.setNumberStrong(babModel.numberStrong()) ; strong.setShadowPriceMode(ctlBlk->chooseStrong_.shadowPriceMode_) ; CbcBranchDefaultDecision decision ; decision.setChooseMethod(strong) ; babModel.setBranchingMethod(decision) ; /* Here I've deleted a huge block of code that deals with external priorities, branch direction, pseudocosts, and solution. (PRIORITYIN) Also a block of code that generates C++ code. */ /* Set up strategy for branch-and-cut. Note that the integer code supplied to setupPreProcessing is *not* compatible with the IPPAction enum. But at least it's documented. See desiredPreProcess_ in CbcStrategyDefault. `1' is accidentally equivalent to IPPOn. */ if (ippAction == CbcGenCtlBlk::IPPStrategy) { CbcStrategyDefault strategy(true, 5, 5) ; strategy.setupPreProcessing(1) ; babModel.setStrategy(strategy) ; } /* Yes! At long last, we're ready for the big call. Do branch and cut. In general, the solver used to return the solution will not be the solver we passed in, so reset babSolver here. */ int statistics = (ctlBlk->printOpt_ > 0) ? ctlBlk->printOpt_ : 0 ; # if CBC_TRACK_SOLVERS > 0 std::cout << "doBaCParam: solver at call to branchAndBound is " << std::hex << babModel.solver() << std::dec << ", log level " << babModel.solver()->messageHandler()->logLevel() << "." << std::endl ; # endif babModel.branchAndBound(statistics) ; babSolver = babModel.solver() ; # if CBC_TRACK_SOLVERS > 0 std::cout << "doBaCParam: solver at return from branchAndBound is " << std::hex << babModel.solver() << std::dec << ", log level " << babModel.solver()->messageHandler()->logLevel() << "." << std::endl ; # endif /* Write out solution to preprocessed model. */ if (ctlBlk->debugCreate_ == "createAfterPre" && babModel.bestSolution()) { CbcGenParamUtils::saveSolution(babSolver, "debug.file") ; } /* Print some information about branch-and-cut. */ # if COIN_CBC_VERBOSITY > 0 std::cout << "Cuts at root node changed objective from " << babModel.getContinuousObjective() << " to " << babModel.rootObjectiveAfterCuts() << std::endl ; for (int iGen = 0 ; iGen < babModel.numberCutGenerators() ; iGen++) { CbcCutGenerator *generator = babModel.cutGenerator(iGen) ; std::cout << generator->cutGeneratorName() << " was tried " << generator->numberTimesEntered() << " times and created " << generator->numberCutsInTotal() << " cuts of which " << generator->numberCutsActive() << " were active after adding rounds of cuts" ; if (generator->timing()) { std::cout << " ( " << generator->timeInCutGenerator() << " seconds)" ; } std::cout << std::endl ; } # endif time2 = CoinCpuTime(); ctlBlk->totalTime_ += time2 - time1; /* If we performed integer preprocessing, time to back it out. */ if (ippAction != CbcGenCtlBlk::IPPOff) { # if CBC_TRACK_SOLVERS > 0 std::cout << "doBaCParam: solver passed to IPP postprocess is " << std::hex << babSolver << std::dec << "." << std::endl ; # endif ippObj.postProcess(*babSolver); babModel.assignSolver(preIppSolver) ; babSolver = babModel.solver() ; # if CBC_TRACK_SOLVERS > 0 std::cout << "doBaCParam: solver in babModel after IPP postprocess is " << std::hex << babSolver << std::dec << "." << std::endl ; # endif } /* Write out postprocessed solution to debug file, if requested. */ if (ctlBlk->debugCreate_ == "create" && babModel.bestSolution()) { CbcGenParamUtils::saveSolution(babSolver, "debug.file") ; } /* If we have a good solution, detach the solver with the answer. Fill in the rest of the status information for the benefit of the wider world. */ bool keepAnswerSolver = false ; OsiSolverInterface *answerSolver = 0 ; if (babModel.bestSolution()) { babModel.setModelOwnsSolver(false) ; keepAnswerSolver = true ; answerSolver = babSolver ; } ctlBlk->setBaBStatus(&babModel, CbcGenCtlBlk::BACwBAC, keepAnswerSolver, answerSolver) ; /* And one last bit of information & statistics. */ ctlBlk->printBaBStatus() ; std::cout << " " ; if (keepAnswerSolver) { std::cout << "objective " << babModel.getObjValue() << "; " ; } std::cout << babModel.getNodeCount() << " nodes and " << babModel.getIterationCount() << " iterations - took " << time2 - time1 << " seconds" << std::endl ; return (0) ; } } // end namespace CbcGenParamutils CoinMP-1.8.3/Cbc/src/CbcStrategy.cpp0000644000175000017500000011273311552601170015515 0ustar renerene/* $Id: CbcStrategy.cpp 1641 2011-04-17 15:08:40Z forrest $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include #include #include #include #include "OsiSolverInterface.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #endif #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcStrategy.hpp" #include "CbcCutGenerator.hpp" #include "CbcBranchActual.hpp" #include "CbcNode.hpp" #include "CoinWarmStart.hpp" #include "CglPreProcess.hpp" // Cuts #include "CglGomory.hpp" #include "CglProbing.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" #include "CglFlowCover.hpp" #include "CglMixedIntegerRounding2.hpp" // Heuristics #include "CbcHeuristic.hpp" #include "CbcHeuristicLocal.hpp" #include "CbcHeuristicRINS.hpp" // Default Constructor CbcStrategy::CbcStrategy() : depth_(0), preProcessState_(0), process_(NULL) { } // Destructor CbcStrategy::~CbcStrategy () { delete process_; } // Delete pre-processing object to save memory void CbcStrategy::deletePreProcess() { delete process_; process_ = NULL; } // Return a new Full node information pointer (descendant of CbcFullNodeInfo) CbcNodeInfo * CbcStrategy::fullNodeInfo(CbcModel * model, int numberRowsAtContinuous) const { return new CbcFullNodeInfo(model, numberRowsAtContinuous); } // Return a new Partial node information pointer (descendant of CbcPartialNodeInfo) CbcNodeInfo * CbcStrategy::partialNodeInfo(CbcModel * /*model*/, CbcNodeInfo * parent, CbcNode * owner, int numberChangedBounds, const int * variables, const double * boundChanges, const CoinWarmStartDiff *basisDiff) const { return new CbcPartialNodeInfo(parent, owner, numberChangedBounds, variables, boundChanges, basisDiff); } /* After a CbcModel::resolve this can return a status -1 no effect 0 treat as optimal 1 as 0 but do not do any more resolves (i.e. no more cuts) 2 treat as infeasible */ int CbcStrategy::status(CbcModel * /*model*/, CbcNodeInfo * /*parent*/, int /*whereFrom*/) { return -1; } // Default Constructor CbcStrategyDefault::CbcStrategyDefault(int cutsOnlyAtRoot, int numberStrong, int numberBeforeTrust, int printLevel) : CbcStrategy(), cutsOnlyAtRoot_(cutsOnlyAtRoot), numberStrong_(numberStrong), numberBeforeTrust_(numberBeforeTrust), printLevel_(printLevel), desiredPreProcess_(0), preProcessPasses_(0) { } // Destructor CbcStrategyDefault::~CbcStrategyDefault () { } // Clone CbcStrategy * CbcStrategyDefault::clone() const { return new CbcStrategyDefault(*this); } // Copy constructor CbcStrategyDefault::CbcStrategyDefault(const CbcStrategyDefault & rhs) : CbcStrategy(rhs), cutsOnlyAtRoot_(rhs.cutsOnlyAtRoot_), numberStrong_(rhs.numberStrong_), numberBeforeTrust_(rhs.numberBeforeTrust_), printLevel_(rhs.printLevel_), desiredPreProcess_(rhs.desiredPreProcess_), preProcessPasses_(rhs.preProcessPasses_) { setNested(rhs.getNested()); } /* Set up cut generators. Will instantiate Probing, Gomory, Knapsack, Clique, FlowCover, and MIR2 generators. Probing should be the first in the vector of generators as it tightens bounds on continuous variables. Cut generators already installed will dominate cut generators instantiated here. There's a classic magic number overloaded parameter example here. The variable genFlags below is interpreted as single-bit flags to control whether a cut generator will be instantiated: Probing:1, Gomory:2, Knapsack:4, Clique:8, FlowCover:16, MIR2:32. Normally it's hardcoded to 63. If CBC_GENERATE_TEST is defined, and the model's node limit is set between 190000 and 190064, genFlags is loaded with the low-order bits. */ void CbcStrategyDefault::setupCutGenerators(CbcModel & model) { if (cutsOnlyAtRoot_ < 0) return; // no cuts wanted // Magic number overloaded parameter -- see comment at head. int genFlags = 63; # ifdef CBC_GENERATE_TEST int nNodes = model.getMaximumNodes(); if (nNodes >= 190000 && nNodes < 190064) genFlags = nNodes - 190000; # endif CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(1); generator1.setMaxPassRoot(1); // Number of unsatisfied variables to look at generator1.setMaxProbe(10); // How far to follow the consequences generator1.setMaxLook(10); // Only look at rows with fewer than this number of elements generator1.setMaxElements(200); generator1.setMaxElementsRoot(300); //generator1.setRowCuts(3); CglGomory generator2; // try larger limit generator2.setLimit(300); CglKnapsackCover generator3; //CglOddHole generator4; //generator4.setMinimumViolation(0.005); //generator4.setMinimumViolationPer(0.00002); // try larger limit //generator4.setMaximumEntries(200); CglClique generator5; generator5.setStarCliqueReport(false); generator5.setRowCliqueReport(false); CglMixedIntegerRounding2 mixedGen; CglFlowCover flowGen; /* Add in generators. Do not override generators already installed. */ int setting = cutsOnlyAtRoot_ ? -99 : -1; int numberGenerators = model.numberCutGenerators(); int iGenerator; bool found; found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglProbing * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found && (genFlags&1) != 0) model.addCutGenerator(&generator1, setting, "Probing"); found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglGomory * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found && (genFlags&2) != 0) model.addCutGenerator(&generator2, setting, "Gomory"); found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglKnapsackCover * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found && (genFlags&4) != 0) model.addCutGenerator(&generator3, setting, "Knapsack"); //model.addCutGenerator(&generator4,setting,"OddHole"); found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglClique * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found && (genFlags&8) != 0) model.addCutGenerator(&generator5, setting, "Clique"); found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglFlowCover * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found && (genFlags&16) != 0) model.addCutGenerator(&flowGen, setting, "FlowCover"); found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglMixedIntegerRounding2 * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found && (genFlags&32) != 0) model.addCutGenerator(&mixedGen, setting, "MixedIntegerRounding2"); // Say we want timings int newNumberGenerators = model.numberCutGenerators(); for (iGenerator = numberGenerators; iGenerator < newNumberGenerators; iGenerator++) { CbcCutGenerator * generator = model.cutGenerator(iGenerator); generator->setTiming(true); } // Caution! Undocumented magic numbers. int currentPasses = model.getMaximumCutPassesAtRoot(); if (currentPasses >= 0) { if (model.getNumCols() < 5000) model.setMaximumCutPassesAtRoot(CoinMax(50, currentPasses)); // use minimum drop else model.setMaximumCutPassesAtRoot(CoinMax(20, currentPasses)); } else { currentPasses = -currentPasses; if (model.getNumCols() < 500) model.setMaximumCutPassesAtRoot(-CoinMax(100, currentPasses)); // always do 100 if possible else model.setMaximumCutPassesAtRoot(-CoinMax(20, currentPasses)); } } // Setup heuristics void CbcStrategyDefault::setupHeuristics(CbcModel & model) { // Allow rounding heuristic CbcRounding heuristic1(model); heuristic1.setHeuristicName("rounding"); int numberHeuristics = model.numberHeuristics(); int iHeuristic; bool found; found = false; for (iHeuristic = 0; iHeuristic < numberHeuristics; iHeuristic++) { CbcHeuristic * heuristic = model.heuristic(iHeuristic); CbcRounding * cgl = dynamic_cast(heuristic); if (cgl) { found = true; break; } } if (!found) model.addHeuristic(&heuristic1); #ifdef JJF_ZERO // Allow join solutions CbcHeuristicLocal heuristic2(model); heuristic2.setHeuristicName("join solutions"); heuristic2.setSearchType(1); found = false; for (iHeuristic = 0; iHeuristic < numberHeuristics; iHeuristic++) { CbcHeuristic * heuristic = model.heuristic(iHeuristic); CbcHeuristicLocal * cgl = dynamic_cast(heuristic); if (cgl) { found = true; break; } } if (!found) model.addHeuristic(&heuristic2); #endif } // Do printing stuff void CbcStrategyDefault::setupPrinting(CbcModel & model, int modelLogLevel) { if (!modelLogLevel) { model.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); model.messageHandler()->setLogLevel(0); model.solver()->messageHandler()->setLogLevel(0); } else if (modelLogLevel == 1) { model.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); model.messageHandler()->setLogLevel(1); model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(CoinMax(2, model.messageHandler()->logLevel())); model.solver()->messageHandler()->setLogLevel(CoinMax(1, model.solver()->messageHandler()->logLevel())); model.setPrintFrequency(CoinMin(50, model.printFrequency())); } } /* Aside from setting CbcModel::numberStrong_ and numberBeforeTrust, the big activity is integer preprocessing. Surely this code to do preprocessing duplicates code to do preprocessing up in the solver main routine. Most of the effort goes into manipulating SOS sets. */ // Other stuff e.g. strong branching void CbcStrategyDefault::setupOther(CbcModel & model) { // See if preprocessing wanted if (desiredPreProcess_) { delete process_; /* Inaccurate as of 080122 --- assignSolver (below) can now be instructed not to delete the existing solver when the preprocessed solver is assigned to the model. 'Course, we do need to hold on to a pointer somewhere, and that must be captured before this call. */ // solver_ should have been cloned outside CglPreProcess * process = new CglPreProcess(); // Pass in models message handler process->passInMessageHandler(model.messageHandler()); OsiSolverInterface * solver = model.solver(); #ifdef COIN_HAS_CLP OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); if (clpSolver && false) { // see if all coefficients multiple of 0.01 (close enough) CoinPackedMatrix * matrix = clpSolver->getModelPtr()->matrix(); double * element = matrix->getMutableElements(); //const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); int numberInt = 0; int numberNon = 0; int numberClose = 0; int numberColumns = clpSolver->getNumCols(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { for (int j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { //int iRow = row[j]; double value1 = element[j]; double value = fabs(value1); if (value > 1.0e7) { if (value != floor(value)) numberNon++; else numberInt++; } else { int iValue = static_cast( 100 * (value + 0.005)); double value2 = iValue; if (value2 == 100.0*value) { numberInt++; } else if (fabs(value2 - 100.0*value) < 1.0e-5) { numberClose++; } else { numberNon++; } } } } if (!numberNon && numberClose) { COIN_DETAIL_PRINT(printf("Tidying %d multiples of 0.01, %d close\n", numberInt, numberClose)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { for (int j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { //int iRow = row[j]; double value1 = element[j]; double value = fabs(value1); if (value < 1.0e7) { int iValue = static_cast( 100 * (value + 0.005)); double value2 = iValue; if (value2 != 100.0*value) { value2 *= 0.01; if (fabs(value - floor(value + 0.5)) <= 1.0e-7) value2 = floor(value + 0.5); if (value1 < 0.0) value2 = -value2; element[j] = value2; } } } } } } #endif { // mark some columns as ineligible for presolve int numberColumns = solver->getNumCols(); char * prohibited = new char[numberColumns]; memset(prohibited, 0, numberColumns); int numberProhibited = 0; /* Create CbcSimpleInteger objects would be more accurate in the general case. The `false' parameter says we won't delete existing objects. Only Clp will produce SOS objects in findIntegers (080122), and that's where a possible conversion can occur. If clp is holding OsiSOS objects, they'll be converted to CbcSOS objects. */ // convert to Cbc integers model.findIntegers(false); int numberObjects = model.numberObjects(); if (numberObjects) { OsiObject ** objects = model.objects(); for (int iObject = 0; iObject < numberObjects; iObject++) { CbcSOS * obj = dynamic_cast (objects[iObject]) ; if (obj) { // SOS int n = obj->numberMembers(); const int * which = obj->members(); for (int i = 0; i < n; i++) { int iColumn = which[i]; prohibited[iColumn] = 1; numberProhibited++; } } } } if (numberProhibited) process->passInProhibited(prohibited, numberColumns); delete [] prohibited; } int logLevel = model.messageHandler()->logLevel(); #ifdef COIN_HAS_CLP //OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); ClpSimplex * lpSolver = NULL; if (clpSolver) { if (clpSolver->messageHandler()->logLevel()) clpSolver->messageHandler()->setLogLevel(1); if (logLevel > -1) clpSolver->messageHandler()->setLogLevel(CoinMin(logLevel, clpSolver->messageHandler()->logLevel())); lpSolver = clpSolver->getModelPtr(); /// If user left factorization frequency then compute lpSolver->defaultFactorizationFrequency(); } #endif // Tell solver we are in Branch and Cut solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo) ; // Default set of cut generators // Limited set that could reduce problem size (drop rows / fix values) CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(1); generator1.setMaxPassRoot(1); generator1.setMaxProbeRoot(CoinMin(3000, solver->getNumCols())); generator1.setMaxProbeRoot(123); generator1.setMaxElements(100); generator1.setMaxElementsRoot(200); generator1.setMaxLookRoot(50); generator1.setRowCuts(3); //generator1.messageHandler()->setLogLevel(logLevel); // Not needed with pass in process->messageHandler()->setLogLevel(logLevel); // Add in generators process->addCutGenerator(&generator1); int translate[] = {9999, 0, 2, -2, 3, 4, 4, 4}; OsiSolverInterface * solver2 = process->preProcessNonDefault(*solver, translate[desiredPreProcess_], preProcessPasses_, 6); // Tell solver we are not in Branch and Cut solver->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; if (solver2) solver2->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; bool feasible = true; if (!solver2) { feasible = false; //printf("Pre-processing says infeasible\n"); delete process; preProcessState_ = -1; process_ = NULL; } else { // now tighten bounds #ifdef COIN_HAS_CLP if (clpSolver) { // model has changed solver = model.solver(); OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver); ClpSimplex * lpSolver = clpSolver->getModelPtr(); lpSolver->passInMessageHandler(solver->messageHandler()); if (lpSolver->tightenPrimalBounds() == 0) { lpSolver->dual(); } else { feasible = false; } } #endif if (feasible) { preProcessState_ = 1; process_ = process; /* Note that original solver will be kept (with false) and that final solver will also be kept. This is for post-processing Keep in mind when examining this that linear presolve does not understand SOS. */ OsiSolverInterface * solver3 = solver2->clone(); model.assignSolver(solver3, false); if (process_->numberSOS()) { int numberSOS = process_->numberSOS(); int numberIntegers = model.numberIntegers(); /* model may not have created objects If none then create NOTE - put back to original column numbers as CbcModel will pack down ALL as it doesn't know where from */ bool someObjects = model.numberObjects() > 0; if (!numberIntegers || !model.numberObjects()) { model.findIntegers(true); numberIntegers = model.numberIntegers(); } OsiObject ** oldObjects = model.objects(); // Do sets and priorities OsiObject ** objects = new OsiObject * [numberSOS]; // set old objects to have low priority int numberOldObjects = model.numberObjects(); int numberColumns = model.getNumCols(); for (int iObj = 0; iObj < numberOldObjects; iObj++) { int oldPriority = oldObjects[iObj]->priority(); oldObjects[iObj]->setPriority(numberColumns + oldPriority); } const int * starts = process_->startSOS(); const int * which = process_->whichSOS(); const int * type = process_->typeSOS(); const double * weight = process_->weightSOS(); int iSOS; for (iSOS = 0; iSOS < numberSOS; iSOS++) { int iStart = starts[iSOS]; int n = starts[iSOS+1] - iStart; objects[iSOS] = new CbcSOS(&model, n, which + iStart, weight + iStart, iSOS, type[iSOS]); // branch on long sets first objects[iSOS]->setPriority(numberColumns - n); } model.addObjects(numberSOS, objects); for (iSOS = 0; iSOS < numberSOS; iSOS++) delete objects[iSOS]; delete [] objects; if (!someObjects) { // put back old column numbers const int * originalColumns = process_->originalColumns(); // use reverse lookup to fake it int n = originalColumns[numberColumns-1] + 1; int * fake = new int[n]; int i; // This was wrong (now is correct) - so could never have been called abort(); for ( i = 0; i < n; i++) fake[i] = -1; for (i = 0; i < numberColumns; i++) fake[originalColumns[i]] = i; for (int iObject = 0; iObject < model.numberObjects(); iObject++) { // redo ids etc CbcSimpleInteger * obj = dynamic_cast (model.modifiableObject(iObject)) ; if (obj) { obj->resetSequenceEtc(n, fake); } else { // redo ids etc CbcObject * obj = dynamic_cast (model.modifiableObject(iObject)) ; assert (obj); obj->redoSequenceEtc(&model, n, fake); } } delete [] fake; } } } else { //printf("Pre-processing says infeasible\n"); delete process; preProcessState_ = -1; process_ = NULL; } } } model.setNumberStrong(numberStrong_); model.setNumberBeforeTrust(numberBeforeTrust_); } // Create C++ lines to get to current state void CbcStrategyDefault::generateCpp( FILE * fp) { fprintf(fp, "0#include \"CbcStrategy.hpp\"\n"); fprintf(fp, "3 CbcStrategyDefault strategy(%s,%d,%d,%d);\n", cutsOnlyAtRoot_ ? "1" : "0", numberStrong_, numberBeforeTrust_, printLevel_); fprintf(fp, "3 strategy.setupPreProcessing(%d,%d);\n", desiredPreProcess_, preProcessPasses_); } // Default Constructor CbcStrategyDefaultSubTree::CbcStrategyDefaultSubTree(CbcModel * parent , int cutsOnlyAtRoot, int numberStrong, int numberBeforeTrust, int printLevel) : CbcStrategy(), parentModel_(parent), cutsOnlyAtRoot_(cutsOnlyAtRoot), numberStrong_(numberStrong), numberBeforeTrust_(numberBeforeTrust), printLevel_(printLevel) { } // Destructor CbcStrategyDefaultSubTree::~CbcStrategyDefaultSubTree () { } // Clone CbcStrategy * CbcStrategyDefaultSubTree::clone() const { return new CbcStrategyDefaultSubTree(*this); } // Copy constructor CbcStrategyDefaultSubTree::CbcStrategyDefaultSubTree(const CbcStrategyDefaultSubTree & rhs) : CbcStrategy(rhs), parentModel_(rhs.parentModel_), cutsOnlyAtRoot_(rhs.cutsOnlyAtRoot_), numberStrong_(rhs.numberStrong_), numberBeforeTrust_(rhs.numberBeforeTrust_), printLevel_(rhs.printLevel_) { setNested(rhs.getNested()); } // Setup cut generators void CbcStrategyDefaultSubTree::setupCutGenerators(CbcModel & model) { // Set up some cut generators and defaults if (cutsOnlyAtRoot_ < 0) return; // no cuts wanted // Probing first as gets tight bounds on continuous CglProbing generator1; generator1.setUsingObjective(true); generator1.setMaxPass(1); // Number of unsatisfied variables to look at generator1.setMaxProbe(10); // How far to follow the consequences generator1.setMaxLook(10); // Only look at rows with fewer than this number of elements generator1.setMaxElements(200); //generator1.setRowCuts(3); CglGomory generator2; // try larger limit generator2.setLimit(300); CglKnapsackCover generator3; //CglOddHole generator4; //generator4.setMinimumViolation(0.005); //generator4.setMinimumViolationPer(0.00002); // try larger limit //generator4.setMaximumEntries(200); CglClique generator5; generator5.setStarCliqueReport(false); generator5.setRowCliqueReport(false); CglMixedIntegerRounding2 mixedGen; CglFlowCover flowGen; // Add in generators int setting = cutsOnlyAtRoot_ ? -99 : -1; int numberGenerators = model.numberCutGenerators(); int numberParentGenerators = parentModel_->numberCutGenerators(); int iGenerator; bool found; found = false; int howOften = 0; for (iGenerator = 0; iGenerator < numberParentGenerators; iGenerator++) { CglCutGenerator * generator = parentModel_->cutGenerator(iGenerator)->generator(); CglProbing * cgl = dynamic_cast(generator); if (cgl) { found = true; howOften = parentModel_->cutGenerator(iGenerator)->howOften(); break; } } if (found && (howOften >= -1 || howOften == -98)) { found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglProbing * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found) { if (howOften == -1) howOften = -98; else if (howOften == -98) howOften = -99; model.addCutGenerator(&generator1, setting, "Probing"); CbcCutGenerator * generator = model.cutGenerator(numberGenerators); generator->setHowOften(howOften); numberGenerators++; } } found = false; for (iGenerator = 0; iGenerator < numberParentGenerators; iGenerator++) { CglCutGenerator * generator = parentModel_->cutGenerator(iGenerator)->generator(); CglGomory * cgl = dynamic_cast(generator); if (cgl) { found = true; howOften = parentModel_->cutGenerator(iGenerator)->howOften(); break; } } if (found && howOften >= 0) { found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglGomory * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found) model.addCutGenerator(&generator2, setting, "Gomory"); } found = false; for (iGenerator = 0; iGenerator < numberParentGenerators; iGenerator++) { CglCutGenerator * generator = parentModel_->cutGenerator(iGenerator)->generator(); CglKnapsackCover * cgl = dynamic_cast(generator); if (cgl) { found = true; howOften = parentModel_->cutGenerator(iGenerator)->howOften(); break; } } if (found && howOften >= 0) { found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglKnapsackCover * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found) model.addCutGenerator(&generator3, setting, "Knapsack"); } found = false; for (iGenerator = 0; iGenerator < numberParentGenerators; iGenerator++) { CglCutGenerator * generator = parentModel_->cutGenerator(iGenerator)->generator(); CglClique * cgl = dynamic_cast(generator); if (cgl) { found = true; howOften = parentModel_->cutGenerator(iGenerator)->howOften(); break; } } if (found && howOften >= 0) { found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglClique * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found) model.addCutGenerator(&generator5, setting, "Clique"); } found = false; for (iGenerator = 0; iGenerator < numberParentGenerators; iGenerator++) { CglCutGenerator * generator = parentModel_->cutGenerator(iGenerator)->generator(); CglFlowCover * cgl = dynamic_cast(generator); if (cgl) { found = true; howOften = parentModel_->cutGenerator(iGenerator)->howOften(); break; } } if (found && howOften >= 0) { found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglFlowCover * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found) model.addCutGenerator(&flowGen, setting, "FlowCover"); found = false; } for (iGenerator = 0; iGenerator < numberParentGenerators; iGenerator++) { CglCutGenerator * generator = parentModel_->cutGenerator(iGenerator)->generator(); CglMixedIntegerRounding2 * cgl = dynamic_cast(generator); if (cgl) { found = true; howOften = parentModel_->cutGenerator(iGenerator)->howOften(); break; } } if (found && howOften >= 0) { found = false; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglMixedIntegerRounding2 * cgl = dynamic_cast(generator); if (cgl) { found = true; break; } } if (!found) model.addCutGenerator(&mixedGen, setting, "MixedIntegerRounding2"); } #ifdef JJF_ZERO // Say we want timings int newNumberGenerators = model.numberCutGenerators(); for (iGenerator = numberGenerators; iGenerator < newNumberGenerators; iGenerator++) { CbcCutGenerator * generator = model.cutGenerator(iGenerator); generator->setTiming(true); } #endif if (model.getNumCols() < -500) model.setMaximumCutPassesAtRoot(-100); // always do 100 if possible else if (model.getNumCols() < 5000) model.setMaximumCutPassesAtRoot(100); // use minimum drop else model.setMaximumCutPassesAtRoot(20); } // Setup heuristics void CbcStrategyDefaultSubTree::setupHeuristics(CbcModel & model) { // Allow rounding heuristic CbcRounding heuristic1(model); heuristic1.setHeuristicName("rounding"); int numberHeuristics = model.numberHeuristics(); int iHeuristic; bool found; found = false; for (iHeuristic = 0; iHeuristic < numberHeuristics; iHeuristic++) { CbcHeuristic * heuristic = model.heuristic(iHeuristic); CbcRounding * cgl = dynamic_cast(heuristic); if (cgl) { found = true; break; } } if (!found) model.addHeuristic(&heuristic1); if ((model.moreSpecialOptions()&32768)!=0) { // Allow join solutions CbcHeuristicLocal heuristic2(model); heuristic2.setHeuristicName("join solutions"); //sheuristic2.setSearchType(1); found = false; for (iHeuristic = 0; iHeuristic < numberHeuristics; iHeuristic++) { CbcHeuristic * heuristic = model.heuristic(iHeuristic); CbcHeuristicLocal * cgl = dynamic_cast(heuristic); if (cgl) { found = true; break; } } if (!found) model.addHeuristic(&heuristic2); // Allow RINS CbcHeuristicRINS heuristic5(model); heuristic5.setHeuristicName("RINS"); heuristic5.setFractionSmall(0.5); heuristic5.setDecayFactor(5.0); //heuristic5.setSearchType(1); found = false; for (iHeuristic = 0; iHeuristic < numberHeuristics; iHeuristic++) { CbcHeuristic * heuristic = model.heuristic(iHeuristic); CbcHeuristicLocal * cgl = dynamic_cast(heuristic); if (cgl) { found = true; break; } } if (!found) model.addHeuristic(&heuristic5); } } // Do printing stuff void CbcStrategyDefaultSubTree::setupPrinting(CbcModel & model, int modelLogLevel) { if (!modelLogLevel) { model.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); model.messageHandler()->setLogLevel(0); model.solver()->messageHandler()->setLogLevel(0); } else if (modelLogLevel == 1) { model.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); model.messageHandler()->setLogLevel(1); model.solver()->messageHandler()->setLogLevel(0); } else { model.messageHandler()->setLogLevel(2); model.solver()->messageHandler()->setLogLevel(1); model.setPrintFrequency(50); } } // Other stuff e.g. strong branching void CbcStrategyDefaultSubTree::setupOther(CbcModel & model) { model.setNumberStrong(numberStrong_); model.setNumberBeforeTrust(numberBeforeTrust_); } // For uniform setting of cut and heuristic options void setCutAndHeuristicOptions(CbcModel & model) { int numberGenerators = model.numberCutGenerators(); int iGenerator; for (iGenerator = 0; iGenerator < numberGenerators; iGenerator++) { CglCutGenerator * generator = model.cutGenerator(iGenerator)->generator(); CglProbing * cglProbing = dynamic_cast(generator); if (cglProbing) { cglProbing->setUsingObjective(1); cglProbing->setMaxPass(1); cglProbing->setMaxPassRoot(1); // Number of unsatisfied variables to look at cglProbing->setMaxProbe(10); cglProbing->setMaxProbeRoot(50); //cglProbing->setMaxProbeRoot(123); // How far to follow the consequences cglProbing->setMaxLook(5); cglProbing->setMaxLookRoot(50); cglProbing->setMaxLookRoot(10); // Only look at rows with fewer than this number of elements cglProbing->setMaxElements(200); cglProbing->setMaxElementsRoot(300); cglProbing->setRowCuts(3); } #ifdef JJF_ZERO CglGomory * cglGomory = dynamic_cast(generator); if (cglGomory) { // try larger limit cglGomory->setLimitAtRoot(1000); cglGomory->setLimit(50); } CglKnapsackCover * cglKnapsackCover = dynamic_cast(generator); if (cglKnapsackCover) { } #endif } } CoinMP-1.8.3/Cbc/src/CbcParam.cpp0000644000175000017500000003667311510742604014765 0ustar renerene/* $Id: CbcParam.cpp 1573 2011-01-05 01:12:36Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include "CbcParam.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CbcParam::CbcParam () : type_(CBC_PARAM_NOTUSED_INVALID), lowerDoubleValue_(0.0), upperDoubleValue_(0.0), lowerIntValue_(0), upperIntValue_(0), lengthName_(0), lengthMatch_(0), definedKeyWords_(), name_(), shortHelp_(), longHelp_(), action_(CBC_PARAM_NOTUSED_INVALID), currentKeyWord_(-1) { } // Other constructors CbcParam::CbcParam (std::string name, std::string help, double lower, double upper, CbcParameterType type, bool display) : type_(type), lowerIntValue_(0), upperIntValue_(0), definedKeyWords_(), name_(name), shortHelp_(help), longHelp_(), action_(type), currentKeyWord_(-1) { lowerDoubleValue_ = lower; upperDoubleValue_ = upper; gutsOfConstructor(); } CbcParam::CbcParam (std::string name, std::string help, int lower, int upper, CbcParameterType type, bool display) : type_(type), lowerDoubleValue_(0.0), upperDoubleValue_(0.0), definedKeyWords_(), name_(name), shortHelp_(help), longHelp_(), action_(type), currentKeyWord_(-1) { gutsOfConstructor(); lowerIntValue_ = lower; upperIntValue_ = upper; } // Other strings will be added by append CbcParam::CbcParam (std::string name, std::string help, std::string firstValue, CbcParameterType type, int defaultIndex, bool display) : type_(type), lowerDoubleValue_(0.0), upperDoubleValue_(0.0), lowerIntValue_(0), upperIntValue_(0), definedKeyWords_(), name_(name), shortHelp_(help), longHelp_(), action_(type), currentKeyWord_(0) { gutsOfConstructor(); definedKeyWords_.push_back(firstValue); } // Action CbcParam::CbcParam (std::string name, std::string help, CbcParameterType type, int indexNumber, bool display) : type_(type), lowerDoubleValue_(0.0), upperDoubleValue_(0.0), lowerIntValue_(0), upperIntValue_(0), definedKeyWords_(), name_(name), shortHelp_(help), longHelp_(), action_(type), currentKeyWord_(-1) { gutsOfConstructor(); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CbcParam::CbcParam (const CbcParam & rhs) { type_ = rhs.type_; lowerDoubleValue_ = rhs.lowerDoubleValue_; upperDoubleValue_ = rhs.upperDoubleValue_; lowerIntValue_ = rhs.lowerIntValue_; upperIntValue_ = rhs.upperIntValue_; lengthName_ = rhs.lengthName_; lengthMatch_ = rhs.lengthMatch_; definedKeyWords_ = rhs.definedKeyWords_; name_ = rhs.name_; shortHelp_ = rhs.shortHelp_; longHelp_ = rhs.longHelp_; action_ = rhs.action_; currentKeyWord_ = rhs.currentKeyWord_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CbcParam::~CbcParam () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcParam & CbcParam::operator=(const CbcParam & rhs) { if (this != &rhs) { type_ = rhs.type_; lowerDoubleValue_ = rhs.lowerDoubleValue_; upperDoubleValue_ = rhs.upperDoubleValue_; lowerIntValue_ = rhs.lowerIntValue_; upperIntValue_ = rhs.upperIntValue_; lengthName_ = rhs.lengthName_; lengthMatch_ = rhs.lengthMatch_; definedKeyWords_ = rhs.definedKeyWords_; name_ = rhs.name_; shortHelp_ = rhs.shortHelp_; longHelp_ = rhs.longHelp_; action_ = rhs.action_; currentKeyWord_ = rhs.currentKeyWord_; } return *this; } void CbcParam::gutsOfConstructor() { std::string::size_type shriekPos = name_.find('!'); lengthName_ = name_.length(); if ( shriekPos == std::string::npos ) { //does not contain '!' lengthMatch_ = lengthName_; } else { lengthMatch_ = shriekPos; name_ = name_.substr(0, shriekPos) + name_.substr(shriekPos + 1); lengthName_--; } } // Insert string (only valid for keywords) void CbcParam::append(std::string keyWord) { definedKeyWords_.push_back(keyWord); } int CbcParam::matches (std::string input) const { // look up strings to do more elegantly if (input.length() > lengthName_) { return 0; } else { unsigned int i; for (i = 0; i < input.length(); i++) { if (tolower(name_[i]) != tolower(input[i])) break; } if (i < input.length()) { return 0; } else if (i >= lengthMatch_) { return 1; } else { // matched but too short return 2; } } } // Returns name which could match std::string CbcParam::matchName ( ) const { if (lengthMatch_ == lengthName_) return name_; else return name_.substr(0, lengthMatch_) + "(" + name_.substr(lengthMatch_) + ")"; } // Returns parameter option which matches (-1 if none) int CbcParam::parameterOption ( std::string check ) const { int numberItems = definedKeyWords_.size(); if (!numberItems) { return -1; } else { int whichItem = 0; unsigned int it; for (it = 0; it < definedKeyWords_.size(); it++) { std::string thisOne = definedKeyWords_[it]; std::string::size_type shriekPos = thisOne.find('!'); unsigned int length1 = thisOne.length(); unsigned int length2 = length1; if ( shriekPos != std::string::npos ) { //contains '!' length2 = shriekPos; thisOne = thisOne.substr(0, shriekPos) + thisOne.substr(shriekPos + 1); length1 = thisOne.length(); } if (check.length() <= length1) { unsigned int i; for (i = 0; i < check.length(); i++) { if (tolower(thisOne[i]) != tolower(check[i])) break; } if (i < check.length()) { whichItem++; } else if (i >= length2) { break; } } else { whichItem++; } } if (whichItem < numberItems) return whichItem; else return -1; } } // Prints parameter options void CbcParam::printOptions ( ) const { std::cout << "Possible options for " << name_ << " are:" << std::endl; unsigned int it; for (it = 0; it < definedKeyWords_.size(); it++) { std::string thisOne = definedKeyWords_[it]; std::string::size_type shriekPos = thisOne.find('!'); if ( shriekPos != std::string::npos ) { //contains '!' thisOne = thisOne.substr(0, shriekPos) + "(" + thisOne.substr(shriekPos + 1) + ")"; } std::cout << thisOne << std::endl; } } int CbcParam::setDoubleParameter (OsiSolverInterface * model, double value) const { if (value < lowerDoubleValue_ || value > upperDoubleValue_) { std::cout << value << " was provided for " << name_ << " - valid range is " << lowerDoubleValue_ << " to " << upperDoubleValue_ << std::endl; return 1; } else { double oldValue; switch (type_) { case CLP_PARAM_DBL_DUALTOLERANCE: model->getDblParam(OsiDualTolerance, oldValue); model->setDblParam(OsiDualTolerance, value); break; case CLP_PARAM_DBL_PRIMALTOLERANCE: model->getDblParam(OsiPrimalTolerance, oldValue); model->setDblParam(OsiPrimalTolerance, value); break; default: oldValue = 0.0; // to avoid compiler message abort(); } std::cout << name_ << " was changed from " << oldValue << " to " << value << std::endl; return 0; } } int CbcParam::checkDoubleParameter (double value) const { if (value < lowerDoubleValue_ || value > upperDoubleValue_) { std::cout << value << " was provided for " << name_ << " - valid range is " << lowerDoubleValue_ << " to " << upperDoubleValue_ << std::endl; return 1; } else { return 0; } } double CbcParam::doubleParameter (OsiSolverInterface * model) const { double value; bool getDblParamRetValue; switch (type_) { case CLP_PARAM_DBL_DUALTOLERANCE: getDblParamRetValue = model->getDblParam(OsiDualTolerance, value); assert(getDblParamRetValue); break; case CLP_PARAM_DBL_PRIMALTOLERANCE: getDblParamRetValue = model->getDblParam(OsiPrimalTolerance, value); assert(getDblParamRetValue); break; default: abort(); } return value; } int CbcParam::setIntParameter (OsiSolverInterface * model, int value) const { if (value < lowerIntValue_ || value > upperIntValue_) { std::cout << value << " was provided for " << name_ << " - valid range is " << lowerIntValue_ << " to " << upperIntValue_ << std::endl; return 1; } else { int oldValue; switch (type_) { case CLP_PARAM_INT_LOGLEVEL: oldValue = model->messageHandler()->logLevel(); model->messageHandler()->setLogLevel(value); break; default: oldValue = 0; // to avoid compiler message abort(); } std::cout << name_ << " was changed from " << oldValue << " to " << value << std::endl; return 0; } } int CbcParam::intParameter (OsiSolverInterface * model) const { int value = 0; switch (type_) { case CLP_PARAM_INT_LOGLEVEL: //value=model->logLevel(); break; default: abort(); } return value; } int CbcParam::setDoubleParameter (CbcModel &model, double value) const { if (value < lowerDoubleValue_ || value > upperDoubleValue_) { std::cout << value << " was provided for " << name_ << " - valid range is " << lowerDoubleValue_ << " to " << upperDoubleValue_ << std::endl; return 1; } else { double oldValue; switch (type_) { case CBC_PARAM_DBL_INFEASIBILITYWEIGHT: oldValue = model.getDblParam(CbcModel::CbcInfeasibilityWeight); model.setDblParam(CbcModel::CbcInfeasibilityWeight, value); break; case CBC_PARAM_DBL_INTEGERTOLERANCE: oldValue = model.getDblParam(CbcModel::CbcIntegerTolerance); model.setDblParam(CbcModel::CbcIntegerTolerance, value); break; case CBC_PARAM_DBL_INCREMENT: oldValue = model.getDblParam(CbcModel::CbcCutoffIncrement); model.setDblParam(CbcModel::CbcCutoffIncrement, value); case CBC_PARAM_DBL_ALLOWABLEGAP: oldValue = model.getDblParam(CbcModel::CbcAllowableGap); model.setDblParam(CbcModel::CbcAllowableGap, value); break; case CLP_PARAM_DBL_TIMELIMIT: { oldValue = model.getDblParam(CbcModel::CbcMaximumSeconds) ; model.setDblParam(CbcModel::CbcMaximumSeconds, value) ; break ; } case CLP_PARAM_DBL_DUALTOLERANCE: case CLP_PARAM_DBL_PRIMALTOLERANCE: setDoubleParameter(model.solver(), value); return 0; // to avoid message default: oldValue = 0.0; // to avoid compiler message abort(); } std::cout << name_ << " was changed from " << oldValue << " to " << value << std::endl; return 0; } } double CbcParam::doubleParameter (CbcModel &model) const { double value; switch (type_) { case CBC_PARAM_DBL_INFEASIBILITYWEIGHT: value = model.getDblParam(CbcModel::CbcInfeasibilityWeight); break; case CBC_PARAM_DBL_INTEGERTOLERANCE: value = model.getDblParam(CbcModel::CbcIntegerTolerance); break; case CBC_PARAM_DBL_INCREMENT: value = model.getDblParam(CbcModel::CbcCutoffIncrement); case CBC_PARAM_DBL_ALLOWABLEGAP: value = model.getDblParam(CbcModel::CbcAllowableGap); break; case CLP_PARAM_DBL_TIMELIMIT: { value = model.getDblParam(CbcModel::CbcMaximumSeconds) ; break ; } case CLP_PARAM_DBL_DUALTOLERANCE: case CLP_PARAM_DBL_PRIMALTOLERANCE: value = doubleParameter(model.solver()); break; default: abort(); } return value; } int CbcParam::setIntParameter (CbcModel &model, int value) const { if (value < lowerIntValue_ || value > upperIntValue_) { std::cout << value << " was provided for " << name_ << " - valid range is " << lowerIntValue_ << " to " << upperIntValue_ << std::endl; return 1; } else { int oldValue; switch (type_) { case CLP_PARAM_INT_LOGLEVEL: oldValue = model.messageHandler()->logLevel(); model.messageHandler()->setLogLevel(value); break; case CLP_PARAM_INT_SOLVERLOGLEVEL: oldValue = model.solver()->messageHandler()->logLevel(); model.solver()->messageHandler()->setLogLevel(value); break; case CBC_PARAM_INT_MAXNODES: oldValue = model.getIntParam(CbcModel::CbcMaxNumNode); model.setIntParam(CbcModel::CbcMaxNumNode, value); break; case CBC_PARAM_INT_STRONGBRANCHING: oldValue = model.numberStrong(); model.setNumberStrong(value); break; default: oldValue = 0; // to avoid compiler message abort(); } std::cout << name_ << " was changed from " << oldValue << " to " << value << std::endl; return 0; } } int CbcParam::intParameter (CbcModel &model) const { int value; switch (type_) { case CLP_PARAM_INT_LOGLEVEL: value = model.messageHandler()->logLevel(); break; case CLP_PARAM_INT_SOLVERLOGLEVEL: value = model.solver()->messageHandler()->logLevel(); break; case CBC_PARAM_INT_MAXNODES: value = model.getIntParam(CbcModel::CbcMaxNumNode); break; case CBC_PARAM_INT_STRONGBRANCHING: value = model.numberStrong(); break; default: abort(); } return value; } CoinMP-1.8.3/Cbc/src/CbcLinkedUtils.cpp0000644000175000017500000006167712131054770016156 0ustar renerene// Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* $Id: CbcLinkedUtils.cpp 1899 2013-04-09 18:12:08Z stefan $ */ /*! \file CbcAugmentClpSimplex.cpp \brief Hooks to Ampl (for CbcLinked) This code is a condensation of ClpAmplStuff.cpp, renamed to better reflect its current place in cbc. The code here had ties to NEW_STYLE_SOLVER code. During the 091209 Watson meeting, NEW_STYLE_SOLVER code was eliminated. The code here was condensed from ClpAmplStuff.cpp. The hook into CbcLinked is loadNonLinear. Once you bring that in, all the rest follows. Still, we're down about 400 lines of code. In the process, it appears that ClpAmplObjective.cpp was never needed here; the code was hooked into ClpAmplStuff.cpp. --lh, 091209 -- */ #include "ClpConfig.h" #include "CbcConfig.h" #ifdef COIN_HAS_ASL #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "ClpFactorization.hpp" #include "ClpSimplex.hpp" #include "ClpAmplObjective.hpp" #include "ClpConstraintAmpl.hpp" #include "ClpMessage.hpp" #include "CoinUtilsConfig.h" #include "CoinHelperFunctions.hpp" #include "CoinWarmStartBasis.hpp" #include "OsiSolverInterface.hpp" #include "Cbc_ampl.h" #include "CoinTime.hpp" #include "CglStored.hpp" #include "CoinModel.hpp" #include "CbcLinked.hpp" extern "C" { //# include "getstub.h" # include "asl_pfgh.h" } // stolen from IPopt with changes typedef struct { double obj_sign_; ASL_pfgh * asl_; double * non_const_x_; int * column_; // for jacobian int * rowStart_; double * gradient_; double * constraintValues_; int nz_h_full_; // number of nonzeros in hessian int nerror_; bool objval_called_with_current_x_; bool conval_called_with_current_x_; bool jacval_called_with_current_x_; } CbcAmplInfo; //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpAmplObjective::ClpAmplObjective () : ClpObjective() { type_ = 12; objective_ = NULL; amplObjective_ = NULL; gradient_ = NULL; offset_ = 0.0; } bool get_constraints_linearity(void * amplInfo, int n, int * const_types) { CbcAmplInfo * info = (CbcAmplInfo *) amplInfo; ASL_pfgh* asl = info->asl_; //check that n is good assert(n == n_con); // check that there are no network constraints assert(nlnc == 0 && lnc == 0); //the first nlc constraints are non linear the rest is linear int i; for (i = 0; i < nlc; i++) { const_types[i] = 1; } // the rest is linear for (i = nlc; i < n_con; i++) const_types[i] = 0; return true; } static bool internal_objval(CbcAmplInfo * info , double & obj_val) { ASL_pfgh* asl = info->asl_; info->objval_called_with_current_x_ = false; // in case the call below fails if (n_obj == 0) { obj_val = 0; info->objval_called_with_current_x_ = true; return true; } else { double retval = objval(0, info->non_const_x_, (fint*)&info->nerror_); if (!info->nerror_) { obj_val = info->obj_sign_ * retval; info->objval_called_with_current_x_ = true; return true; } else { abort(); } } return false; } static bool internal_conval(CbcAmplInfo * info , double * g) { ASL_pfgh* asl = info->asl_; info->conval_called_with_current_x_ = false; // in case the call below fails assert (g); conval(info->non_const_x_, g, (fint*)&info->nerror_); if (!info->nerror_) { info->conval_called_with_current_x_ = true; return true; } else { abort(); } return false; } static bool apply_new_x(CbcAmplInfo * info , bool new_x, int n, const double * x) { ASL_pfgh* asl = info->asl_; if (new_x) { // update the flags so these methods are called // before evaluating the hessian info->conval_called_with_current_x_ = false; info->objval_called_with_current_x_ = false; info->jacval_called_with_current_x_ = false; //copy the data to the non_const_x_ if (!info->non_const_x_) { info->non_const_x_ = new double [n]; } for (int i = 0; i < n; i++) { info->non_const_x_[i] = x[i]; } // tell ampl that we have a new x xknowne(info->non_const_x_, (fint*)&info->nerror_); return info->nerror_ ? false : true; } return true; } static bool eval_f(void * amplInfo, int n, const double * x, bool new_x, double & obj_value) { CbcAmplInfo * info = (CbcAmplInfo *) amplInfo; if (!apply_new_x(info, new_x, n, x)) { return false; } return internal_objval(info, obj_value); } static bool eval_grad_f(void * amplInfo, int n, const double * x, bool new_x, double * grad_f) { CbcAmplInfo * info = (CbcAmplInfo *) amplInfo; ASL_pfgh* asl = info->asl_; if (!apply_new_x(info, new_x, n, x)) { return false; } int i; if (n_obj == 0) { for (i = 0; i < n; i++) { grad_f[i] = 0.; } } else { objgrd(0, info->non_const_x_, grad_f, (fint*)&info->nerror_); if (info->nerror_) { return false; } if (info->obj_sign_ == -1) { for (i = 0; i < n; i++) { grad_f[i] = -grad_f[i]; } } } return true; } static bool eval_g(void * amplInfo, int n, const double * x, bool new_x, double * g) { CbcAmplInfo * info = (CbcAmplInfo *) amplInfo; #ifndef NDEBUG ASL_pfgh* asl = info->asl_; #endif // warning: n_var is a macro that assumes we have a variable called asl assert(n == n_var); if (!apply_new_x(info, new_x, n, x)) { return false; } return internal_conval(info, g); } static bool eval_jac_g(void * amplInfo, int n, const double * x, bool new_x, double * values) { CbcAmplInfo * info = (CbcAmplInfo *) amplInfo; ASL_pfgh* asl = info->asl_; assert(n == n_var); assert (values); if (!apply_new_x(info, new_x, n, x)) { return false; } jacval(info->non_const_x_, values, (fint*)&info->nerror_); if (!info->nerror_) { return true; } else { abort(); } return false; } //------------------------------------------------------------------- // Useful Constructor //------------------------------------------------------------------- ClpAmplObjective::ClpAmplObjective (void * amplInfo) : ClpObjective() { type_ = 12; activated_ = 1; gradient_ = NULL; objective_ = NULL; offset_ = 0.0; amplObjective_ = amplInfo; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpAmplObjective::ClpAmplObjective (const ClpAmplObjective & rhs) : ClpObjective(rhs) { amplObjective_ = rhs.amplObjective_; offset_ = rhs.offset_; type_ = rhs.type_; if (!amplObjective_) { objective_ = NULL; gradient_ = NULL; } else { CbcAmplInfo * info = (CbcAmplInfo *) amplObjective_; ASL_pfgh* asl = info->asl_; int numberColumns = n_var;; if (rhs.objective_) { objective_ = new double [numberColumns]; memcpy(objective_, rhs.objective_, numberColumns*sizeof(double)); } else { objective_ = NULL; } if (rhs.gradient_) { gradient_ = new double [numberColumns]; memcpy(gradient_, rhs.gradient_, numberColumns*sizeof(double)); } else { gradient_ = NULL; } } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpAmplObjective::~ClpAmplObjective () { delete [] objective_; delete [] gradient_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpAmplObjective & ClpAmplObjective::operator=(const ClpAmplObjective & rhs) { if (this != &rhs) { delete [] objective_; delete [] gradient_; amplObjective_ = rhs.amplObjective_; offset_ = rhs.offset_; type_ = rhs.type_; if (!amplObjective_) { objective_ = NULL; gradient_ = NULL; } else { CbcAmplInfo * info = (CbcAmplInfo *) amplObjective_; ASL_pfgh* asl = info->asl_; int numberColumns = n_var;; if (rhs.objective_) { objective_ = new double [numberColumns]; memcpy(objective_, rhs.objective_, numberColumns*sizeof(double)); } else { objective_ = NULL; } if (rhs.gradient_) { gradient_ = new double [numberColumns]; memcpy(gradient_, rhs.gradient_, numberColumns*sizeof(double)); } else { gradient_ = NULL; } } } return *this; } // Returns gradient double * ClpAmplObjective::gradient(const ClpSimplex * model, const double * solution, double & offset, bool refresh, int includeLinear) { if (model) assert (model->optimizationDirection() == 1.0); #ifndef NDEBUG bool scaling = model && (model->rowScale() || model->objectiveScale() != 1.0 || model->optimizationDirection() != 1.0); #endif const double * cost = NULL; if (model) cost = model->costRegion(); if (!cost) { // not in solve cost = objective_; #ifndef NDEBUG scaling = false; #endif } assert (!scaling); if (!amplObjective_ || !solution || !activated_) { offset = offset_; return objective_; } else { if (refresh || !gradient_) { CbcAmplInfo * info = (CbcAmplInfo *) amplObjective_; ASL_pfgh* asl = info->asl_; int numberColumns = n_var;; if (!gradient_) gradient_ = new double[numberColumns]; assert (solution); eval_grad_f(amplObjective_, numberColumns, solution, true, gradient_); // Is this best way? double objValue = 0.0; eval_f(amplObjective_, numberColumns, solution, false, objValue); double objValue2 = 0.0; for (int i = 0; i < numberColumns; i++) objValue2 += gradient_[i] * solution[i]; offset_ = objValue2 - objValue; // or other way??? if (model && model->optimizationDirection() != 1.0) { offset *= model->optimizationDirection(); for (int i = 0; i < numberColumns; i++) gradient_[i] *= -1.0; } } offset = offset_; return gradient_; } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpObjective * ClpAmplObjective::clone() const { return new ClpAmplObjective(*this); } // Resize objective void ClpAmplObjective::resize(int newNumberColumns) { CbcAmplInfo * info = (CbcAmplInfo *) amplObjective_; ASL_pfgh* asl = info->asl_; int numberColumns = n_var;; if (numberColumns != newNumberColumns) { abort(); } } // Delete columns in objective void ClpAmplObjective::deleteSome(int numberToDelete, const int * which) { if (numberToDelete) abort(); } /* Returns reduced gradient.Returns an offset (to be added to current one). */ double ClpAmplObjective::reducedGradient(ClpSimplex * model, double * region, bool useFeasibleCosts) { int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); //work space CoinIndexedVector * workSpace = model->rowArray(0); CoinIndexedVector arrayVector; arrayVector.reserve(numberRows + 1); int iRow; #ifdef CLP_DEBUG workSpace->checkClear(); #endif double * array = arrayVector.denseVector(); int * index = arrayVector.getIndices(); int number = 0; const double * costNow = gradient(model, model->solutionRegion(), offset_, true, useFeasibleCosts ? 2 : 1); double * cost = model->costRegion(); const int * pivotVariable = model->pivotVariable(); for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; double value; if (iPivot < numberColumns) value = costNow[iPivot]; else if (!useFeasibleCosts) value = cost[iPivot]; else value = 0.0; if (value) { array[iRow] = value; index[number++] = iRow; } } arrayVector.setNumElements(number); // Btran basic costs model->factorization()->updateColumnTranspose(workSpace, &arrayVector); double * work = workSpace->denseVector(); ClpFillN(work, numberRows, 0.0); // now look at dual solution double * rowReducedCost = region + numberColumns; double * dual = rowReducedCost; const double * rowCost = cost + numberColumns; for (iRow = 0; iRow < numberRows; iRow++) { dual[iRow] = array[iRow]; } double * dj = region; ClpDisjointCopyN(costNow, numberColumns, dj); model->transposeTimes(-1.0, dual, dj); for (iRow = 0; iRow < numberRows; iRow++) { // slack double value = dual[iRow]; value += rowCost[iRow]; rowReducedCost[iRow] = value; } return offset_; } /* Returns step length which gives minimum of objective for solution + theta * change vector up to maximum theta. arrays are numberColumns+numberRows */ double ClpAmplObjective::stepLength(ClpSimplex * model, const double * solution, const double * change, double maximumTheta, double & currentObj, double & predictedObj, double & thetaObj) { // Assume convex CbcAmplInfo * info = (CbcAmplInfo *) amplObjective_; ASL_pfgh* asl = info->asl_; int numberColumns = n_var;; double * tempSolution = new double [numberColumns]; double * tempGradient = new double [numberColumns]; // current eval_f(amplObjective_, numberColumns, solution, true, currentObj); double objA = currentObj; double thetaA = 0.0; // at maximum int i; for (i = 0; i < numberColumns; i++) tempSolution[i] = solution[i] + maximumTheta * change[i]; eval_f(amplObjective_, numberColumns, tempSolution, true, thetaObj); double objC = thetaObj; double thetaC = maximumTheta; double objB = 0.5 * (objA + objC); double thetaB = 0.5 * maximumTheta; double gradientNorm = 1.0e6; while (gradientNorm > 1.0e-6 && thetaC - thetaA > 1.0e-8) { for (i = 0; i < numberColumns; i++) tempSolution[i] = solution[i] + thetaB * change[i]; eval_grad_f(amplObjective_, numberColumns, tempSolution, true, tempGradient); eval_f(amplObjective_, numberColumns, tempSolution, false, objB); double changeObj = 0.0; gradientNorm = 0.0; for (i = 0; i < numberColumns; i++) { changeObj += tempGradient[i] * change[i]; gradientNorm += tempGradient[i] * tempGradient[i]; } gradientNorm = fabs(changeObj) / sqrt(gradientNorm); // Should try and get quadratic convergence by interpolation if (changeObj < 0.0) { // increasing is good thetaA = thetaB; } else { // decreasing is good thetaC = thetaB; } thetaB = 0.5 * (thetaA + thetaC); } delete [] tempSolution; delete [] tempGradient; predictedObj = objB; return thetaB; } // Return objective value (without any ClpModel offset) (model may be NULL) double ClpAmplObjective::objectiveValue(const ClpSimplex * model, const double * solution) const { CbcAmplInfo * info = (CbcAmplInfo *) amplObjective_; ASL_pfgh* asl = info->asl_; int numberColumns = n_var;; // current double currentObj = 0.0; eval_f(amplObjective_, numberColumns, solution, true, currentObj); return currentObj; } // Scale objective void ClpAmplObjective::reallyScale(const double * columnScale) { abort(); } /* Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ int ClpAmplObjective::markNonlinear(char * which) { int iColumn; CbcAmplInfo * info = (CbcAmplInfo *) amplObjective_; ASL_pfgh* asl = info->asl_; int nonLinear = CoinMax(nlvc, nlvo); for (iColumn = 0; iColumn < nonLinear; iColumn++) { which[iColumn] = 1; } int numberNonLinearColumns = 0; int numberColumns = n_var;; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (which[iColumn]) numberNonLinearColumns++; } return numberNonLinearColumns; } // Say we have new primal solution - so may need to recompute void ClpAmplObjective::newXValues() { CbcAmplInfo * info = (CbcAmplInfo *) amplObjective_; info->conval_called_with_current_x_ = false; info->objval_called_with_current_x_ = false; info->jacval_called_with_current_x_ = false; } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpConstraintAmpl::ClpConstraintAmpl () : ClpConstraint() { type_ = 3; column_ = NULL; coefficient_ = NULL; numberCoefficients_ = 0; amplInfo_ = NULL; } //------------------------------------------------------------------- // Useful Constructor //------------------------------------------------------------------- ClpConstraintAmpl::ClpConstraintAmpl (int row, void * amplInfo) : ClpConstraint() { type_ = 3; rowNumber_ = row; amplInfo_ = amplInfo; CbcAmplInfo * info = (CbcAmplInfo *) amplInfo_; #ifndef NDEBUG ASL_pfgh* asl = info->asl_; #endif // warning: nlc is a macro that assumes we have a variable called asl assert (rowNumber_ < nlc); numberCoefficients_ = info->rowStart_[rowNumber_+1] - info->rowStart_[rowNumber_]; column_ = CoinCopyOfArray(info->column_ + info->rowStart_[rowNumber_], numberCoefficients_); coefficient_ = new double [numberCoefficients_];; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpConstraintAmpl::ClpConstraintAmpl (const ClpConstraintAmpl & rhs) : ClpConstraint(rhs) { numberCoefficients_ = rhs.numberCoefficients_; column_ = CoinCopyOfArray(rhs.column_, numberCoefficients_); coefficient_ = CoinCopyOfArray(rhs.coefficient_, numberCoefficients_); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpConstraintAmpl::~ClpConstraintAmpl () { delete [] column_; delete [] coefficient_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpConstraintAmpl & ClpConstraintAmpl::operator=(const ClpConstraintAmpl & rhs) { if (this != &rhs) { delete [] column_; delete [] coefficient_; numberCoefficients_ = rhs.numberCoefficients_; column_ = CoinCopyOfArray(rhs.column_, numberCoefficients_); coefficient_ = CoinCopyOfArray(rhs.coefficient_, numberCoefficients_); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpConstraint * ClpConstraintAmpl::clone() const { return new ClpConstraintAmpl(*this); } // Returns gradient int ClpConstraintAmpl::gradient(const ClpSimplex * model, const double * solution, double * gradient, double & functionValue, double & offset, bool useScaling, bool refresh) const { CbcAmplInfo * info = (CbcAmplInfo *) amplInfo_; ASL_pfgh* asl = info->asl_; int numberColumns = n_var;; // If not done then do all if (!info->jacval_called_with_current_x_) { bool getStuff = eval_g(amplInfo_, numberColumns, solution, true, info->constraintValues_); assert (getStuff); getStuff = eval_jac_g(amplInfo_, numberColumns, solution, false, info->gradient_); assert (getStuff); info->jacval_called_with_current_x_ = getStuff; } if (refresh || !lastGradient_) { functionValue_ = info->constraintValues_[rowNumber_]; offset_ = functionValue_; // sign?? if (!lastGradient_) lastGradient_ = new double[numberColumns]; CoinZeroN(lastGradient_, numberColumns); assert (!(model && model->rowScale() && useScaling)); int i; int start = info->rowStart_[rowNumber_]; assert (numberCoefficients_ == info->rowStart_[rowNumber_+1] - start); for (i = 0; i < numberCoefficients_; i++) { int iColumn = column_[i]; double valueS = solution[iColumn]; double valueG = info->gradient_[start+i]; lastGradient_[iColumn] = valueG; offset_ -= valueS * valueG; } } functionValue = functionValue_; offset = offset_; memcpy(gradient, lastGradient_, numberColumns*sizeof(double)); return 0; } // Resize constraint void ClpConstraintAmpl::resize(int newNumberColumns) { abort(); } // Delete columns in constraint void ClpConstraintAmpl::deleteSome(int numberToDelete, const int * which) { if (numberToDelete) { abort(); } } // Scale constraint void ClpConstraintAmpl::reallyScale(const double * columnScale) { abort(); } /* Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ int ClpConstraintAmpl::markNonlinear(char * which) const { CbcAmplInfo * info = (CbcAmplInfo *) amplInfo_; ASL_pfgh* asl = info->asl_; int iColumn; int numberNon = 0; int nonLinear = CoinMax(nlvc, nlvo); for (iColumn = 0; iColumn < numberCoefficients_; iColumn++) { int jColumn = column_[iColumn]; if (jColumn < nonLinear) { which[jColumn] = 1; numberNon++; } } return numberNon; } /* Given a zeroed array sets possible nonzero coefficients to 1. Returns number of nonzeros */ int ClpConstraintAmpl::markNonzero(char * which) const { int iColumn; for (iColumn = 0; iColumn < numberCoefficients_; iColumn++) { which[column_[iColumn]] = 1; } return numberCoefficients_; } // Number of coefficients int ClpConstraintAmpl::numberCoefficients() const { return numberCoefficients_; } // Say we have new primal solution - so may need to recompute void ClpConstraintAmpl::newXValues() { CbcAmplInfo * info = (CbcAmplInfo *) amplInfo_; info->conval_called_with_current_x_ = false; info->objval_called_with_current_x_ = false; info->jacval_called_with_current_x_ = false; } /* Load nonlinear part of problem from AMPL info Returns 0 if linear 1 if quadratic objective 2 if quadratic constraints 3 if nonlinear objective 4 if nonlinear constraints -1 on failure */ int ClpSimplex::loadNonLinear(void * amplInfo, int & numberConstraints, ClpConstraint ** & constraints) { numberConstraints = 0; constraints = NULL; CbcAmplInfo * info = (CbcAmplInfo *) amplInfo; ASL_pfgh* asl = info->asl_; // For moment don't say quadratic int type = 0; if (nlo + nlc) { // nonlinear if (!nlc) { type = 3; delete objective_; objective_ = new ClpAmplObjective(amplInfo); } else { type = 4; numberConstraints = nlc; constraints = new ClpConstraint * [numberConstraints]; if (nlo) { delete objective_; objective_ = new ClpAmplObjective(amplInfo); } for (int i = 0; i < numberConstraints; i++) { constraints[i] = new ClpConstraintAmpl(i, amplInfo); } } } return type; } #else #include "ClpSimplex.hpp" #include "ClpConstraint.hpp" int ClpSimplex::loadNonLinear(void * , int & , ClpConstraint ** & ) { abort(); return 0; } #endif CoinMP-1.8.3/Cbc/src/CbcFixVariable.cpp0000644000175000017500000001362712131054770016113 0ustar renerene// $Id: CbcFixVariable.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcFixVariable.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## // Default Constructor CbcFixVariable::CbcFixVariable () : CbcConsequence(), numberStates_(0), states_(NULL), startLower_(NULL), startUpper_(NULL), newBound_(NULL), variable_(NULL) { } // One useful Constructor CbcFixVariable::CbcFixVariable (int numberStates, const int * states, const int * numberNewLower, const int ** newLowerValue, const int ** lowerColumn, const int * numberNewUpper, const int ** newUpperValue, const int ** upperColumn) : CbcConsequence(), states_(NULL), startLower_(NULL), startUpper_(NULL), newBound_(NULL), variable_(NULL) { // How much space numberStates_ = numberStates; if (numberStates_) { states_ = new int[numberStates_]; memcpy(states_, states, numberStates_*sizeof(int)); int i; int n = 0; startLower_ = new int[numberStates_+1]; startUpper_ = new int[numberStates_+1]; startLower_[0] = 0; //count for (i = 0; i < numberStates_; i++) { n += numberNewLower[i]; startUpper_[i] = n; n += numberNewUpper[i]; startLower_[i+1] = n; } newBound_ = new double [n]; variable_ = new int [n]; n = 0; for (i = 0; i < numberStates_; i++) { int j; int k; const int * bound; const int * variable; k = numberNewLower[i]; bound = newLowerValue[i]; variable = lowerColumn[i]; for (j = 0; j < k; j++) { newBound_[n] = bound[j]; variable_[n++] = variable[j]; } k = numberNewUpper[i]; bound = newUpperValue[i]; variable = upperColumn[i]; for (j = 0; j < k; j++) { newBound_[n] = bound[j]; variable_[n++] = variable[j]; } } } } // Copy constructor CbcFixVariable::CbcFixVariable ( const CbcFixVariable & rhs) : CbcConsequence(rhs) { numberStates_ = rhs.numberStates_; states_ = NULL; startLower_ = NULL; startUpper_ = NULL; newBound_ = NULL; variable_ = NULL; if (numberStates_) { states_ = CoinCopyOfArray(rhs.states_, numberStates_); startLower_ = CoinCopyOfArray(rhs.startLower_, numberStates_ + 1); startUpper_ = CoinCopyOfArray(rhs.startUpper_, numberStates_ + 1); int n = startLower_[numberStates_]; newBound_ = CoinCopyOfArray(rhs.newBound_, n); variable_ = CoinCopyOfArray(rhs.variable_, n); } } // Clone CbcConsequence * CbcFixVariable::clone() const { return new CbcFixVariable(*this); } // Assignment operator CbcFixVariable & CbcFixVariable::operator=( const CbcFixVariable & rhs) { if (this != &rhs) { CbcConsequence::operator=(rhs); delete [] states_; delete [] startLower_; delete [] startUpper_; delete [] newBound_; delete [] variable_; states_ = NULL; startLower_ = NULL; startUpper_ = NULL; newBound_ = NULL; variable_ = NULL; numberStates_ = rhs.numberStates_; if (numberStates_) { states_ = CoinCopyOfArray(rhs.states_, numberStates_); startLower_ = CoinCopyOfArray(rhs.startLower_, numberStates_ + 1); startUpper_ = CoinCopyOfArray(rhs.startUpper_, numberStates_ + 1); int n = startLower_[numberStates_]; newBound_ = CoinCopyOfArray(rhs.newBound_, n); variable_ = CoinCopyOfArray(rhs.variable_, n); } } return *this; } // Destructor CbcFixVariable::~CbcFixVariable () { delete [] states_; delete [] startLower_; delete [] startUpper_; delete [] newBound_; delete [] variable_; } // Set up a startLower for a single member void CbcFixVariable::applyToSolver(OsiSolverInterface * solver, int state) const { assert (state == -9999 || state == 9999); // Find state int find; for (find = 0; find < numberStates_; find++) if (states_[find] == state) break; if (find == numberStates_) return; int i; // Set new lower bounds for (i = startLower_[find]; i < startUpper_[find]; i++) { int iColumn = variable_[i]; double value = newBound_[i]; double oldValue = solver->getColLower()[iColumn]; //printf("for %d old lower bound %g, new %g",iColumn,oldValue,value); solver->setColLower(iColumn, CoinMax(value, oldValue)); //printf(" => %g\n",solver->getColLower()[iColumn]); } // Set new upper bounds for (i = startUpper_[find]; i < startLower_[find+1]; i++) { int iColumn = variable_[i]; double value = newBound_[i]; double oldValue = solver->getColUpper()[iColumn]; //printf("for %d old upper bound %g, new %g",iColumn,oldValue,value); solver->setColUpper(iColumn, CoinMin(value, oldValue)); //printf(" => %g\n",solver->getColUpper()[iColumn]); } } CoinMP-1.8.3/Cbc/src/CbcHeuristicRENS.hpp0000644000175000017500000000366312452506557016365 0ustar renerene// $Id: CbcHeuristicRENS.hpp 2105 2015-01-05 13:11:11Z forrest $ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // edwin 12/5/09 carved out of CbcHeuristicRINS #ifndef CbcHeuristicRENS_H #define CbcHeuristicRENS_H #include "CbcHeuristic.hpp" /** LocalSearch class */ class CbcHeuristicRENS : public CbcHeuristic { public: // Default Constructor CbcHeuristicRENS (); /* Constructor with model - assumed before cuts Initial version does not do Lps */ CbcHeuristicRENS (CbcModel & model); // Copy constructor CbcHeuristicRENS ( const CbcHeuristicRENS &); // Destructor ~CbcHeuristicRENS (); /// Clone virtual CbcHeuristic * clone() const; /// Assignment operator CbcHeuristicRENS & operator=(const CbcHeuristicRENS& rhs); /// Resets stuff if model changes virtual void resetModel(CbcModel * model); /// update model (This is needed if cliques update matrix etc) virtual void setModel(CbcModel * model); using CbcHeuristic::solution ; /** returns 0 if no solution, 1 if valid solution. Sets solution values if good, sets objective value (only if good) This does Relaxation Extension Neighborhood Search Does not run if when_<2 and a solution exists */ virtual int solution(double & objectiveValue, double * newSolution); /// Set type inline void setRensType(int value) { rensType_ = value;} protected: // Data /// Number of tries int numberTries_; /** Type 0 - fix at LB 1 - fix on dj 2 - fix at UB as well 3 - fix on 0.01*average dj add 16 to allow two tries 32 - if solution exists use to keep more variables 64 - if priorities keep high priority 128 - if priorities keep low priority */ int rensType_; }; #endif CoinMP-1.8.3/Cbc/src/CbcNodeInfo.cpp0000644000175000017500000003435712433615222015423 0ustar renerene// $Id: CbcNodeInfo.cpp 2097 2014-11-21 10:57:22Z forrest $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/24/09 carved from CbcNode #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CbcConfig.h" #include //#define CBC_DEBUG 1 //#define CHECK_CUT_COUNTS //#define CHECK_NODE //#define CBC_CHECK_BASIS #include #include #define CUTS #include "OsiSolverInterface.hpp" #include "OsiChooseVariable.hpp" #include "OsiAuxInfo.hpp" #include "OsiSolverBranch.hpp" #include "CoinWarmStartBasis.hpp" #include "CoinTime.hpp" #include "CbcModel.hpp" #include "CbcNode.hpp" #include "CbcStatistics.hpp" #include "CbcStrategy.hpp" #include "CbcBranchActual.hpp" #include "CbcBranchDynamic.hpp" #include "OsiRowCut.hpp" #include "OsiRowCutDebugger.hpp" #include "OsiCuts.hpp" #include "CbcCountRowCut.hpp" #include "CbcFeasibilityBase.hpp" #include "CbcMessage.hpp" #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #include "ClpSimplexOther.hpp" #endif using namespace std; #include "CglCutGenerator.hpp" #include "CbcNodeInfo.hpp" // Default Constructor CbcNodeInfo::CbcNodeInfo () : numberPointingToThis_(0), parent_(NULL), parentBranch_(NULL), owner_(NULL), numberCuts_(0), nodeNumber_(0), cuts_(NULL), numberRows_(0), numberBranchesLeft_(0), active_(7) { #ifdef CHECK_NODE printf("CbcNodeInfo %p Constructor\n", this); #endif } void CbcNodeInfo::setParentBasedData() { if (parent_) { numberRows_ = parent_->numberRows_ + parent_->numberCuts_; //parent_->increment(); if (parent_->owner()) { const OsiBranchingObject* br = parent_->owner()->branchingObject(); assert(br); parentBranch_ = br->clone(); } } } void CbcNodeInfo::unsetParentBasedData() { if (parent_) { numberRows_ = 0; if (parent_->owner()) { delete parentBranch_; parentBranch_ = NULL; } } } #ifdef JJF_ZERO // Constructor given parent CbcNodeInfo::CbcNodeInfo (CbcNodeInfo * parent) : numberPointingToThis_(2), parent_(parent), parentBranch_(NULL), owner_(NULL), numberCuts_(0), nodeNumber_(0), cuts_(NULL), numberRows_(0), numberBranchesLeft_(2), active_(7) { #ifdef CHECK_NODE printf("CbcNodeInfo %p Constructor from parent %p\n", this, parent_); #endif //setParentBasedData(); } #endif // Copy Constructor CbcNodeInfo::CbcNodeInfo (const CbcNodeInfo & rhs) : numberPointingToThis_(rhs.numberPointingToThis_), parent_(rhs.parent_), parentBranch_(NULL), owner_(rhs.owner_), numberCuts_(rhs.numberCuts_), nodeNumber_(rhs.nodeNumber_), cuts_(NULL), numberRows_(rhs.numberRows_), numberBranchesLeft_(rhs.numberBranchesLeft_), active_(rhs.active_) { #ifdef CHECK_NODE printf("CbcNodeInfo %p Copy constructor\n", this); #endif if (numberCuts_) { cuts_ = new CbcCountRowCut * [numberCuts_]; int n = 0; for (int i = 0; i < numberCuts_; i++) { CbcCountRowCut * thisCut = rhs.cuts_[i]; if (thisCut) { // I think this is correct - new one should take priority thisCut->setInfo(this, n); thisCut->increment(numberBranchesLeft_); cuts_[n++] = thisCut; } } numberCuts_ = n; } if (rhs.parentBranch_) { parentBranch_ = rhs.parentBranch_->clone(); } } // Constructor given parent and owner CbcNodeInfo::CbcNodeInfo (CbcNodeInfo * parent, CbcNode * owner) : numberPointingToThis_(2), parent_(parent), parentBranch_(NULL), owner_(owner), numberCuts_(0), nodeNumber_(0), cuts_(NULL), numberRows_(0), numberBranchesLeft_(2), active_(7) { #ifdef CHECK_NODE printf("CbcNodeInfo %p Constructor from parent %p\n", this, parent_); #endif //setParentBasedData(); } /** Take care to detach from the owning CbcNode and decrement the reference count in the parent. If this is the last nodeInfo object pointing to the parent, make a recursive call to delete the parent. */ CbcNodeInfo::~CbcNodeInfo() { #ifdef CHECK_NODE printf("CbcNodeInfo %p Destructor parent %p\n", this, parent_); printf("cuts %p - number %d\n",cuts_,numberCuts_); #endif assert(!numberPointingToThis_); // But there may be some left (max nodes?) for (int i = 0; i < numberCuts_; i++) { if (cuts_[i]) { #ifndef GLOBAL_CUTS_JUST_POINTERS delete cuts_[i]; #else if (cuts_[i]->globallyValidAsInteger() != 2) delete cuts_[i]; #endif } } delete [] cuts_; if (owner_) owner_->nullNodeInfo(); if (parent_) { int numberLinks = parent_->decrement(); if (!numberLinks) delete parent_; } delete parentBranch_; } //#define ALLCUTS void CbcNodeInfo::decrementCuts(int change) { int i; // get rid of all remaining if negative int changeThis; if (change < 0) changeThis = numberBranchesLeft_; else changeThis = change; // decrement cut counts for (i = 0; i < numberCuts_; i++) { if (cuts_[i]) { int number = cuts_[i]->decrement(changeThis); if (!number) { //printf("info %p del cut %d %p\n",this,i,cuts_[i]); #ifndef GLOBAL_CUTS_JUST_POINTERS delete cuts_[i]; #else if (cuts_[i]->globallyValidAsInteger() != 2) delete cuts_[i]; #endif cuts_[i] = NULL; } } } } void CbcNodeInfo::incrementCuts(int change) { int i; assert (change > 0); // increment cut counts for (i = 0; i < numberCuts_; i++) { if (cuts_[i]) cuts_[i]->increment(change); } } void CbcNodeInfo::decrementParentCuts(CbcModel * model, int change) { if (parent_) { // get rid of all remaining if negative int changeThis; if (change < 0) changeThis = numberBranchesLeft_; else changeThis = change; int i; // Get over-estimate of space needed for basis CoinWarmStartBasis & dummy = model->workingBasis(); dummy.setSize(0, numberRows_ + numberCuts_); buildRowBasis(dummy); /* everything is zero (i.e. free) so we can use to see if latest basis */ CbcNodeInfo * thisInfo = parent_; while (thisInfo) thisInfo = thisInfo->buildRowBasis(dummy); // decrement cut counts thisInfo = parent_; int numberRows = numberRows_; while (thisInfo) { for (i = thisInfo->numberCuts_ - 1; i >= 0; i--) { CoinWarmStartBasis::Status status = dummy.getArtifStatus(--numberRows); #ifdef ALLCUTS status = CoinWarmStartBasis::isFree; #endif if (thisInfo->cuts_[i]) { int number = 1; if (status != CoinWarmStartBasis::basic) { // tight - drop 1 or 2 if (change < 0) number = thisInfo->cuts_[i]->decrement(changeThis); else number = thisInfo->cuts_[i]->decrement(change); } if (!number) { #ifndef GLOBAL_CUTS_JUST_POINTERS delete thisInfo->cuts_[i]; #else if (thisInfo->cuts_[i]->globallyValidAsInteger() != 2) delete thisInfo->cuts_[i]; #endif thisInfo->cuts_[i] = NULL; } } } thisInfo = thisInfo->parent_; } } } #ifdef JJF_ZERO void CbcNodeInfo::incrementParentCuts(CbcModel * model, int change) { if (parent_) { int i; // Get over-estimate of space needed for basis CoinWarmStartBasis & dummy = model->workingBasis(); dummy.setSize(0, numberRows_ + numberCuts_); /* everything is zero (i.e. free) so we can use to see if latest basis */ buildRowBasis(dummy); CbcNodeInfo * thisInfo = parent_; while (thisInfo) thisInfo = thisInfo->buildRowBasis(dummy); // increment cut counts thisInfo = parent_; int numberRows = numberRows_; while (thisInfo) { for (i = thisInfo->numberCuts_ - 1; i >= 0; i--) { CoinWarmStartBasis::Status status = dummy.getArtifStatus(--numberRows); #ifdef ALLCUTS status = CoinWarmStartBasis::isFree; #endif if (thisInfo->cuts_[i] && status != CoinWarmStartBasis::basic) { thisInfo->cuts_[i]->increment(change); } } thisInfo = thisInfo->parent_; } } } #endif /* Append cuts to the cuts_ array in a nodeInfo. The initial reference count is set to numberToBranchOn, which will normally be the number of arms defined for the CbcBranchingObject attached to the CbcNode that owns this CbcNodeInfo. */ void CbcNodeInfo::addCuts (OsiCuts & cuts, int numberToBranchOn, /*int * whichGenerator,*/int numberPointingToThis) { int numberCuts = cuts.sizeRowCuts(); if (numberCuts) { int i; if (!numberCuts_) { cuts_ = new CbcCountRowCut * [numberCuts]; } else { CbcCountRowCut ** temp = new CbcCountRowCut * [numberCuts+numberCuts_]; memcpy(temp, cuts_, numberCuts_*sizeof(CbcCountRowCut *)); delete [] cuts_; cuts_ = temp; } for (i = 0; i < numberCuts; i++) { CbcCountRowCut * thisCut = new CbcCountRowCut(*cuts.rowCutPtr(i), this, numberCuts_, -1, numberPointingToThis); thisCut->increment(numberToBranchOn); cuts_[numberCuts_++] = thisCut; #ifdef CBC_DEBUG #if CBC_DEBUG>1 int n = thisCut->row().getNumElements(); printf("Cut %d has %d entries, rhs %g %g =>", i, n, thisCut->lb(), thisCut->ub()); int j; const int * index = thisCut->row().getIndices(); const double * element = thisCut->row().getElements(); for (j = 0; j < n; j++) { printf(" (%d,%g)", index[j], element[j]); assert(fabs(element[j]) > 1.00e-12); } printf("\n"); #else int n = thisCut->row().getNumElements(); int j; const double * element = thisCut->row().getElements(); for (j = 0; j < n; j++) { assert(fabs(element[j]) > 1.00e-12); } #endif #endif } } } void CbcNodeInfo::addCuts(int numberCuts, CbcCountRowCut ** cut, int numberToBranchOn) { if (numberCuts) { int i; if (!numberCuts_) { cuts_ = new CbcCountRowCut * [numberCuts]; } else { CbcCountRowCut ** temp = new CbcCountRowCut * [numberCuts+numberCuts_]; memcpy(temp, cuts_, numberCuts_*sizeof(CbcCountRowCut *)); delete [] cuts_; cuts_ = temp; } for (i = 0; i < numberCuts; i++) { CbcCountRowCut * thisCut = cut[i]; thisCut->setInfo(this, numberCuts_); //printf("info %p cut %d %p\n",this,i,thisCut); thisCut->increment(numberToBranchOn); cuts_[numberCuts_++] = thisCut; #ifdef CBC_DEBUG int n = thisCut->row().getNumElements(); #if CBC_DEBUG>1 printf("Cut %d has %d entries, rhs %g %g =>", i, n, thisCut->lb(), thisCut->ub()); #endif int j; #if CBC_DEBUG>1 const int * index = thisCut->row().getIndices(); #endif const double * element = thisCut->row().getElements(); for (j = 0; j < n; j++) { #if CBC_DEBUG>1 printf(" (%d,%g)", index[j], element[j]); #endif assert(fabs(element[j]) > 1.00e-12); } printf("\n"); #endif } } } // delete cuts void CbcNodeInfo::deleteCuts(int numberToDelete, CbcCountRowCut ** cuts) { int i; int j; int last = -1; for (i = 0; i < numberToDelete; i++) { CbcCountRowCut * next = cuts[i]; for (j = last + 1; j < numberCuts_; j++) { if (next == cuts_[j]) break; } if (j == numberCuts_) { // start from beginning for (j = 0; j < last; j++) { if (next == cuts_[j]) break; } assert(j < last); } last = j; int number = cuts_[j]->decrement(); if (!number) { #ifndef GLOBAL_CUTS_JUST_POINTERS delete cuts_[j]; #else if (cuts_[j]->globallyValidAsInteger() != 2) delete cuts_[j]; #endif } cuts_[j] = NULL; } j = 0; for (i = 0; i < numberCuts_; i++) { if (cuts_[i]) cuts_[j++] = cuts_[i]; } numberCuts_ = j; } // delete cuts void CbcNodeInfo::deleteCuts(int numberToDelete, int * which) { int i; for (i = 0; i < numberToDelete; i++) { int iCut = which[i]; int number = cuts_[iCut]->decrement(); if (!number) { #ifndef GLOBAL_CUTS_JUST_POINTERS delete cuts_[iCut]; #else if (cuts_[iCut]->globallyValidAsInteger() != 2) delete cuts_[iCut]; #endif } cuts_[iCut] = NULL; } int j = 0; for (i = 0; i < numberCuts_; i++) { if (cuts_[i]) cuts_[j++] = cuts_[i]; } numberCuts_ = j; } // Really delete a cut void CbcNodeInfo::deleteCut(int whichOne) { assert(whichOne < numberCuts_); cuts_[whichOne] = NULL; } /* Deactivate node information. 1 - bounds 2 - cuts 4 - basis! */ void CbcNodeInfo::deactivate(int mode) { active_ &= (~mode); if (mode==7) { for (int i = 0; i < numberCuts_; i++) { delete cuts_[i]; cuts_[i] = NULL; } delete [] cuts_; cuts_=NULL; numberCuts_=0; } } CoinMP-1.8.3/Cbc/src/CbcDummyBranchingObject.cpp0000644000175000017500000000547112131054770017753 0ustar renerene// $Id: CbcDummyBranchingObject.cpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include //#define CBC_DEBUG #include "CoinTypes.hpp" #include "OsiSolverInterface.hpp" #include "OsiSolverBranch.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcDummyBranchingObject.hpp" #include "CbcBranchActual.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" //############################################################################## // Default Constructor CbcDummyBranchingObject::CbcDummyBranchingObject(CbcModel * model) : CbcBranchingObject(model, 0, 0, 0.5) { setNumberBranchesLeft(1); } // Copy constructor CbcDummyBranchingObject::CbcDummyBranchingObject ( const CbcDummyBranchingObject & rhs) : CbcBranchingObject(rhs) { } // Assignment operator CbcDummyBranchingObject & CbcDummyBranchingObject::operator=( const CbcDummyBranchingObject & rhs) { if (this != &rhs) { CbcBranchingObject::operator=(rhs); } return *this; } CbcBranchingObject * CbcDummyBranchingObject::clone() const { return (new CbcDummyBranchingObject(*this)); } // Destructor CbcDummyBranchingObject::~CbcDummyBranchingObject () { } /* Perform a dummy branch */ double CbcDummyBranchingObject::branch() { decrementNumberBranchesLeft(); return 0.0; } // Print what would happen void CbcDummyBranchingObject::print() { printf("Dummy branch\n"); } /** Compare the original object of \c this with the original object of \c brObj. Assumes that there is an ordering of the original objects. This method should be invoked only if \c this and brObj are of the same type. Return negative/0/positive depending on whether \c this is smaller/same/larger than the argument. */ int CbcDummyBranchingObject::compareOriginalObject (const CbcBranchingObject* /*brObj*/) const { throw("must implement"); } /** Compare the \c this with \c brObj. \c this and \c brObj must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if \c replaceIfOverlap is true) replace the current branching object with one whose feasible region is the overlap. */ CbcRangeCompare CbcDummyBranchingObject::compareBranchingObject (const CbcBranchingObject* /*brObj*/, const bool /*replaceIfOverlap*/) { throw("must implement"); } CoinMP-1.8.3/Cbc/src/ClpAmplObjective.hpp0000644000175000017500000000660112131054770016471 0ustar renerene/* $Id: ClpAmplObjective.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpAmplObjective_H #define ClpAmplObjective_H #include "ClpObjective.hpp" #include "CoinPackedMatrix.hpp" //############################################################################# /** Ampl Objective Class */ class ClpAmplObjective : public ClpObjective { public: ///@name Stuff //@{ /** Returns gradient. If Ampl then solution may be NULL, also returns an offset (to be added to current one) If refresh is false then uses last solution Uses model for scaling includeLinear 0 - no, 1 as is, 2 as feasible */ virtual double * gradient(const ClpSimplex * model, const double * solution, double & offset, bool refresh, int includeLinear = 2); /// Resize objective /** Returns reduced gradient.Returns an offset (to be added to current one). */ virtual double reducedGradient(ClpSimplex * model, double * region, bool useFeasibleCosts); /** Returns step length which gives minimum of objective for solution + theta * change vector up to maximum theta. arrays are numberColumns+numberRows Also sets current objective, predicted and at maximumTheta */ virtual double stepLength(ClpSimplex * model, const double * solution, const double * change, double maximumTheta, double & currentObj, double & predictedObj, double & thetaObj); /// Return objective value (without any ClpModel offset) (model may be NULL) virtual double objectiveValue(const ClpSimplex * model, const double * solution) const ; virtual void resize(int newNumberColumns) ; /// Delete columns in objective virtual void deleteSome(int numberToDelete, const int * which) ; /// Scale objective virtual void reallyScale(const double * columnScale) ; /** Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ virtual int markNonlinear(char * which); /// Say we have new primal solution - so may need to recompute virtual void newXValues() ; //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpAmplObjective(); /// Constructor from ampl info ClpAmplObjective(void * amplInfo); /** Copy constructor . */ ClpAmplObjective(const ClpAmplObjective & rhs); /// Assignment operator ClpAmplObjective & operator=(const ClpAmplObjective& rhs); /// Destructor virtual ~ClpAmplObjective (); /// Clone virtual ClpObjective * clone() const; //@} ///@name Gets and sets //@{ /// Linear objective double * linearObjective() const; //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// Saved offset double offset_; /// Ampl info void * amplObjective_; /// Objective double * objective_; /// Gradient double * gradient_; //@} }; #endif CoinMP-1.8.3/Cbc/src/CbcHeuristicRandRound.cpp0000644000175000017500000004257212432625130017472 0ustar renerene/* $Id: CbcHeuristicRandRound.cpp 2094 2014-11-18 11:15:36Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include #include #include "CoinHelperFunctions.hpp" #include "OsiSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcMessage.hpp" #include "CbcHeuristicRandRound.hpp" #include "OsiClpSolverInterface.hpp" #include "CoinTime.hpp" static inline int intRand(const int range) { return static_cast (floor(CoinDrand48() * range)); } // Default Constructor CbcHeuristicRandRound::CbcHeuristicRandRound() : CbcHeuristic() { } // Constructor with model - assumed before cuts CbcHeuristicRandRound::CbcHeuristicRandRound(CbcModel & model) : CbcHeuristic(model) { model_ = &model; setWhen(1); } // Destructor CbcHeuristicRandRound::~CbcHeuristicRandRound () { } // Clone CbcHeuristic * CbcHeuristicRandRound::clone() const { return new CbcHeuristicRandRound(*this); } // Create C++ lines to get to current state void CbcHeuristicRandRound::generateCpp( FILE * fp) { CbcHeuristicRandRound other; fprintf(fp, "0#include \"CbcHeuristicRandRound.hpp\"\n"); fprintf(fp, "3 CbcHeuristicRandRound heuristicPFX(*cbcModel);\n"); CbcHeuristic::generateCpp(fp, "heuristicPFX"); fprintf(fp, "3 cbcModel->addHeuristic(&heuristicPFX);\n"); } // Copy constructor CbcHeuristicRandRound::CbcHeuristicRandRound(const CbcHeuristicRandRound & rhs) : CbcHeuristic(rhs) { } // Assignment operator CbcHeuristicRandRound & CbcHeuristicRandRound::operator=( const CbcHeuristicRandRound & rhs) { if (this != &rhs) { CbcHeuristic::operator=(rhs); } return *this; } // Resets stuff if model changes void CbcHeuristicRandRound::resetModel(CbcModel * model) { CbcHeuristic::resetModel(model); } /* Randomized Rounding Heuristic Returns 1 if solution, 0 if not */ int CbcHeuristicRandRound::solution(double & solutionValue, double * betterSolution) { // rlh: Todo: Memory Cleanup // std::cout << "Entering the Randomized Rounding Heuristic" << std::endl; setWhen(1); // setWhen(1) didn't have the effect I expected (e.g., run once). // Run only once. // // See if at root node bool atRoot = model_->getNodeCount() == 0; int passNumber = model_->getCurrentPassNumber(); // Just do once if (!atRoot || passNumber > 1) { // std::cout << "Leaving the Randomized Rounding Heuristic" << std::endl; return 0; } std::cout << "Entering the Randomized Rounding Heuristic" << std::endl; typedef struct { int numberSolutions; int maximumSolutions; int numberColumns; double ** solution; int * numberUnsatisfied; } clpSolution; double start = CoinCpuTime(); numCouldRun_++; // #ifdef HEURISTIC_INFORM printf("Entering heuristic %s - nRuns %d numCould %d when %d\n", heuristicName(),numRuns_,numCouldRun_,when_); #endif // Todo: Ask JJHF what "number of times // the heuristic could run" means. OsiSolverInterface * solver = model_->solver()->clone(); double primalTolerance ; solver->getDblParam(OsiPrimalTolerance, primalTolerance) ; OsiClpSolverInterface * clpSolver = dynamic_cast (solver); assert (clpSolver); ClpSimplex * simplex = clpSolver->getModelPtr(); // Initialize the structure holding the solutions for the Simplex iterations clpSolution solutions; // Set typeStruct field of ClpTrustedData struct to 1 to indicate // desired behavior for RandRound heuristic (which is what?) ClpTrustedData trustedSolutions; trustedSolutions.typeStruct = 1; trustedSolutions.data = &solutions; solutions.numberSolutions = 0; solutions.maximumSolutions = 0; solutions.numberColumns = simplex->numberColumns(); solutions.solution = NULL; solutions.numberUnsatisfied = NULL; simplex->setTrustedUserPointer(&trustedSolutions); // Solve from all slack to get some points simplex->allSlackBasis(); // Calling primal() invalidates pointers to some rim vectors, // like...row sense (!) simplex->primal(); // 1. Okay - so a workaround would be to copy the data I want BEFORE // calling primal. // 2. Another approach is to ask the simplex solvers NOT to mess up my // rims. // 3. See freeCachedResults() for what is getting // deleted. Everything else points into the structure. // ...or use collower and colupper rather than rowsense. // ..store address of where one of these // Store the basic problem information // -Get the number of columns, rows and rhs vector int numCols = clpSolver->getNumCols(); int numRows = clpSolver->getNumRows(); // Find the integer variables (use columnType(?)) // One if not continuous, that is binary or general integer) // columnType() = 0 continuous // = 1 binary // = 2 general integer bool * varClassInt = new bool[numCols]; const char* columnType = clpSolver->columnType(); int numGenInt = 0; for (int i = 0; i < numCols; i++) { if (clpSolver->isContinuous(i)) varClassInt[i] = 0; else varClassInt[i] = 1; if (columnType[i] == 2) numGenInt++; } // Heuristic is for problems with general integer variables. // If there are none, quit. if (numGenInt++ < 1) { delete [] varClassInt ; std::cout << "Leaving the Randomized Rounding Heuristic" << std::endl; return 0; } // -Get the rows sense const char * rowSense; rowSense = clpSolver->getRowSense(); // -Get the objective coefficients double *originalObjCoeff = CoinCopyOfArray(clpSolver->getObjCoefficients(), numCols); // -Get the matrix of the problem // rlh: look at using sparse representation double ** matrix = new double * [numRows]; for (int i = 0; i < numRows; i++) { matrix[i] = new double[numCols]; for (int j = 0; j < numCols; j++) matrix[i][j] = 0; } const CoinPackedMatrix* matrixByRow = clpSolver->getMatrixByRow(); const double * matrixElements = matrixByRow->getElements(); const int * matrixIndices = matrixByRow->getIndices(); const int * matrixStarts = matrixByRow->getVectorStarts(); for (int j = 0; j < numRows; j++) { for (int i = matrixStarts[j]; i < matrixStarts[j+1]; i++) { matrix[j][matrixIndices[i]] = matrixElements[i]; } } double * newObj = new double [numCols]; srand ( static_cast(time(NULL) + 1)); int randNum; // Shuffle the rows: // Put the rows in a random order // so that the optimal solution is a different corner point than the // starting point. int * index = new int [numRows]; for (int i = 0; i < numRows; i++) index[i] = i; for (int i = 0; i < numRows; i++) { int temp = index[i]; int randNumTemp = i + intRand(numRows - i); index[i] = index[randNumTemp]; index[randNumTemp] = temp; } // Start finding corner points by iteratively doing the following: // - contruct a randomly tilted objective // - solve for (int i = 0; i < numRows; i++) { // TODO: that 10,000 could be a param in the member data if (solutions.numberSolutions > 10000) break; randNum = intRand(2); for (int j = 0; j < numCols; j++) { // for row i and column j vary the coefficient "a bit" if (randNum == 1) // if the element is zero, then set the new obj // coefficient to 0.1 (i.e., round up) if (fabs(matrix[index[i]][j]) < primalTolerance) newObj[j] = 0.1; else // if the element is nonzero, then increase the new obj // coefficient "a bit" newObj[j] = matrix[index[i]][j] * 1.1; else // if randnum is 2, then // if the element is zero, then set the new obj coeffient // to NEGATIVE 0.1 (i.e., round down) if (fabs(matrix[index[i]][j]) < primalTolerance) newObj[j] = -0.1; else // if the element is nonzero, then DEcrease the new obj coeffienct "a bit" newObj[j] = matrix[index[i]][j] * 0.9; } // Use the new "tilted" objective clpSolver->setObjective(newObj); // Based on the row sense, we decide whether to max or min if (rowSense[i] == 'L') clpSolver->setObjSense(-1); else clpSolver->setObjSense(1); // Solve with primal simplex simplex->primal(1); // rlh+ll: This was the original code. But we already have the // model pointer (it's in simplex). And, calling getModelPtr() // invalidates the cached data in the OsiClpSolverInterface // object, which means our precious rowsens is lost. So let's // not use the line below... /******* clpSolver->getModelPtr()->primal(1); */ printf("---------------------------------------------------------------- %d\n", i); } // Iteratively do this process until... // either you reach the max number of corner points (aka 10K) // or all the rows have been used as an objective. // Look at solutions int numberSolutions = solutions.numberSolutions; //const char * integerInfo = simplex->integerInformation(); //const double * columnLower = simplex->columnLower(); //const double * columnUpper = simplex->columnUpper(); printf("there are %d solutions\n", numberSolutions); // Up to here we have all the corner points // Now we need to do the random walks and roundings double ** cornerPoints = new double * [numberSolutions]; for (int j = 0; j < numberSolutions; j++) cornerPoints[j] = solutions.solution[j]; bool feasibility = 1; // rlh: use some COIN max instead of 1e30 (?) double bestObj = 1e30; std::vector< std::vector > feasibles; int numFeasibles = 0; // Check the feasibility of the corner points int numCornerPoints = numberSolutions; const double * rhs = clpSolver->getRightHandSide(); // rlh: row sense hasn't changed. why a fresh copy? // Delete next line. rowSense = clpSolver->getRowSense(); for (int i = 0; i < numCornerPoints; i++) { //get the objective value for this this point double objValue = 0; for (int k = 0; k < numCols; k++) objValue += cornerPoints[i][k] * originalObjCoeff[k]; if (objValue < bestObj) { // check integer feasibility feasibility = 1; for (int j = 0; j < numCols; j++) { if (varClassInt[j]) { double closest = floor(cornerPoints[i][j] + 0.5); if (fabs(cornerPoints[i][j] - closest) > primalTolerance) { feasibility = 0; break; } } } // check all constraints satisfied if (feasibility) { for (int irow = 0; irow < numRows; irow++) { double lhs = 0; for (int j = 0; j < numCols; j++) { lhs += matrix[irow][j] * cornerPoints[i][j]; } if (rowSense[irow] == 'L' && lhs > rhs[irow] + primalTolerance) { feasibility = 0; break; } if (rowSense[irow] == 'G' && lhs < rhs[irow] - primalTolerance) { feasibility = 0; break; } if (rowSense[irow] == 'E' && (lhs - rhs[irow] > primalTolerance || lhs - rhs[irow] < -primalTolerance)) { feasibility = 0; break; } } } if (feasibility) { numFeasibles++; feasibles.push_back(std::vector (numCols)); for (int k = 0; k < numCols; k++) feasibles[numFeasibles-1][k] = cornerPoints[i][k]; printf("obj: %f\n", objValue); if (objValue < bestObj) bestObj = objValue; } } } int numFeasibleCorners; numFeasibleCorners = numFeasibles; //find the center of gravity of the corner points as the first random point double * rp = new double[numCols]; for (int i = 0; i < numCols; i++) { rp[i] = 0; for (int j = 0; j < numCornerPoints; j++) { rp[i] += cornerPoints[j][i]; } rp[i] = rp[i] / numCornerPoints; } //------------------------------------------- //main loop: // -generate the next random point // -round the random point // -check the feasibility of the random point //------------------------------------------- srand ( static_cast(time(NULL) + 1)); int numRandomPoints = 0; while (numRandomPoints < 50000) { numRandomPoints++; //generate the next random point int randomIndex = intRand(numCornerPoints); double random = CoinDrand48(); for (int i = 0; i < numCols; i++) { rp[i] = (random * (cornerPoints[randomIndex][i] - rp[i])) + rp[i]; } //CRISP ROUNDING //round the random point just generated double * roundRp = new double[numCols]; for (int i = 0; i < numCols; i++) { roundRp[i] = rp[i]; if (varClassInt[i]) { if (rp[i] >= 0) { if (fmod(rp[i], 1) > 0.5) roundRp[i] = floor(rp[i]) + 1; else roundRp[i] = floor(rp[i]); } else { if (fabs(fmod(rp[i], 1)) > 0.5) roundRp[i] = floor(rp[i]); else roundRp[i] = floor(rp[i]) + 1; } } } //SOFT ROUNDING // Look at original files for the "how to" on soft rounding; // Soft rounding omitted here. //Check the feasibility of the rounded random point // -Check the feasibility // -Get the rows sense rowSense = clpSolver->getRowSense(); rhs = clpSolver->getRightHandSide(); //get the objective value for this feasible point double objValue = 0; for (int i = 0; i < numCols; i++) objValue += roundRp[i] * originalObjCoeff[i]; if (objValue < bestObj) { feasibility = 1; for (int i = 0; i < numRows; i++) { double lhs = 0; for (int j = 0; j < numCols; j++) { lhs += matrix[i][j] * roundRp[j]; } if (rowSense[i] == 'L' && lhs > rhs[i] + primalTolerance) { feasibility = 0; break; } if (rowSense[i] == 'G' && lhs < rhs[i] - primalTolerance) { feasibility = 0; break; } if (rowSense[i] == 'E' && (lhs - rhs[i] > primalTolerance || lhs - rhs[i] < -primalTolerance)) { feasibility = 0; break; } } if (feasibility) { printf("Feasible Found.\n"); printf("%.2f\n", CoinCpuTime() - start); numFeasibles++; feasibles.push_back(std::vector (numCols)); for (int i = 0; i < numCols; i++) feasibles[numFeasibles-1][i] = roundRp[i]; printf("obj: %f\n", objValue); if (objValue < bestObj) bestObj = objValue; } } delete [] roundRp; } printf("Number of Feasible Corners: %d\n", numFeasibleCorners); printf("Number of Feasibles Found: %d\n", numFeasibles); if (numFeasibles > 0) printf("Best Objective: %f\n", bestObj); printf("time: %.2f\n", CoinCpuTime() - start); if (numFeasibles == 0) { // cleanup delete [] varClassInt; for (int i = 0; i < numRows; i++) delete matrix[i]; delete [] matrix; delete [] newObj; delete [] index; for (int i = 0; i < numberSolutions; i++) delete cornerPoints[i]; delete [] cornerPoints; delete [] rp; return 0; } // We found something better solutionValue = bestObj; for (int k = 0; k < numCols; k++) { betterSolution[k] = feasibles[numFeasibles-1][k]; } delete [] varClassInt; for (int i = 0; i < numRows; i++) delete matrix[i]; delete [] matrix; delete [] newObj; delete [] index; for (int i = 0; i < numberSolutions; i++) delete cornerPoints[i]; delete [] cornerPoints; delete [] rp; std::cout << "Leaving the Randomized Rounding Heuristic" << std::endl; return 1; } // update model void CbcHeuristicRandRound::setModel(CbcModel * model) { CbcHeuristic::setModel(model); } CoinMP-1.8.3/Cbc/src/CbcHeuristicDiveLineSearch.hpp0000644000175000017500000000315412131054770020423 0ustar renerene/* $Id: CbcHeuristicDiveLineSearch.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CbcHeuristicDiveLineSearch_H #define CbcHeuristicDiveLineSearch_H #include "CbcHeuristicDive.hpp" /** DiveLineSearch class */ class CbcHeuristicDiveLineSearch : public CbcHeuristicDive { public: // Default Constructor CbcHeuristicDiveLineSearch (); // Constructor with model - assumed before cuts CbcHeuristicDiveLineSearch (CbcModel & model); // Copy constructor CbcHeuristicDiveLineSearch ( const CbcHeuristicDiveLineSearch &); // Destructor ~CbcHeuristicDiveLineSearch (); /// Clone virtual CbcHeuristicDiveLineSearch * clone() const; /// Assignment operator CbcHeuristicDiveLineSearch & operator=(const CbcHeuristicDiveLineSearch& rhs); /// Create C++ lines to get to current state virtual void generateCpp( FILE * fp) ; /// Selects the next variable to branch on /** Returns true if all the fractional variables can be trivially rounded. Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable. */ virtual bool selectVariableToBranch(OsiSolverInterface* solver, const double* newSolution, int& bestColumn, int& bestRound); }; #endif CoinMP-1.8.3/Cbc/src/CbcSolverHeuristics.hpp0000644000175000017500000000264112131054770017233 0ustar renerene/* $Id: CbcSolverHeuristics.hpp 1899 2013-04-09 18:12:08Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*! \file CbcSolverHeuristics.hpp \brief Routines for doing heuristics. */ #ifndef CbcSolverHeuristics_H #define CbcSolverHeuristics_H void crunchIt(ClpSimplex * model); /* On input doAction - 0 just fix in original and return NULL 1 return fixed non-presolved solver 2 as one but use presolve Inside this 3 use presolve and fix ones with large cost ? do heuristics and set best solution ? do BAB and just set best solution 10+ then use lastSolution and relax a few -2 cleanup afterwards if using 2 On output - number fixed */ OsiClpSolverInterface * fixVubs(CbcModel & model, int skipZero2, int & doAction, CoinMessageHandler * /*generalMessageHandler*/, const double * lastSolution, double dextra[6], int extra[5]); /** 1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later) */ int doHeuristics(CbcModel * model, int type, CbcOrClpParam *parameters_, int numberParameters_,int noPrinting_,int initialPumpTune) ; #endif //CbcSolverHeuristics_H CoinMP-1.8.3/Cbc/src/CbcFixVariable.hpp0000644000175000017500000000371012131054770016110 0ustar renerene// $Id: CbcFixVariable.hpp 1899 2013-04-09 18:12:08Z stefan $ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Edwin 11/10/2009-- carved out of CbcBranchActual #ifndef CbcFixVariable_H #define CbcFixVariable_H #include "CbcBranchBase.hpp" /** Class for consequent bounds. When a variable is branched on it normally interacts with other variables by means of equations. There are cases where we want to step outside LP and do something more directly e.g. fix bounds. This class is for that. A state of -9999 means at LB, +9999 means at UB, others mean if fixed to that value. */ class CbcFixVariable : public CbcConsequence { public: // Default Constructor CbcFixVariable (); // One useful Constructor CbcFixVariable (int numberStates, const int * states, const int * numberNewLower, const int ** newLowerValue, const int ** lowerColumn, const int * numberNewUpper, const int ** newUpperValue, const int ** upperColumn); // Copy constructor CbcFixVariable ( const CbcFixVariable & rhs); // Assignment operator CbcFixVariable & operator=( const CbcFixVariable & rhs); /// Clone virtual CbcConsequence * clone() const; /// Destructor virtual ~CbcFixVariable (); /** Apply to an LP solver. Action depends on state */ virtual void applyToSolver(OsiSolverInterface * solver, int state) const; protected: /// Number of states int numberStates_; /// Values of integers for various states int * states_; /// Start of information for each state (setting new lower) int * startLower_; /// Start of information for each state (setting new upper) int * startUpper_; /// For each variable new bounds double * newBound_; /// Variable int * variable_; }; #endif CoinMP-1.8.3/Cbc/AUTHORS0000644000175000017500000000010110755030022013035 0ustar renereneForrest, John J. Hafer, Lou Goncalves, Joao P.: Diving heuristicsCoinMP-1.8.3/Externals0000644000175000017500000000070211512720306013200 0ustar renereneBuildTools https://projects.coin-or.org/svn/BuildTools/stable/0.7 CoinUtils https://projects.coin-or.org/svn/CoinUtils/stable/2.8/CoinUtils Clp https://projects.coin-or.org/svn/Clp/stable/1.14/Clp Osi https://projects.coin-or.org/svn/Osi/stable/0.105/Osi Cgl https://projects.coin-or.org/svn/Cgl/stable/0.57/Cgl Cbc https://projects.coin-or.org/svn/Cbc/stable/2.7/Cbc Data/Sample https://projects.coin-or.org/svn/Data/stable/1.0/Sample CoinMP-1.8.3/configure0000755000175000017500000040416512600330564013234 0ustar renerene#! /bin/sh # From configure.ac 0.9. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for CoinMP 1.8.3. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # # Copyright 2006 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package CoinMP which is distributed # under the Common Public License. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='CoinMP' PACKAGE_TARNAME='coinmp' PACKAGE_VERSION='1.8.3' PACKAGE_STRING='CoinMP 1.8.3' PACKAGE_BUGREPORT='coinmp@list.coin-or.org' ac_unique_file="configure.ac" ac_default_prefix=`pwd` ac_subdirs_all="$ac_subdirs_all Data/Sample" ac_subdirs_all="$ac_subdirs_all CoinUtils" ac_subdirs_all="$ac_subdirs_all Osi" ac_subdirs_all="$ac_subdirs_all Clp" ac_subdirs_all="$ac_subdirs_all Cgl" ac_subdirs_all="$ac_subdirs_all Cbc" ac_subdirs_all="$ac_subdirs_all CoinMP" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOLM4 have_autoconf have_automake have_svn BUILDTOOLSDIR AUX_DIR abs_source_dir abs_lib_dir abs_include_dir abs_bin_dir HAVE_EXTERNALS_TRUE HAVE_EXTERNALS_FALSE COIN_SKIP_PROJECTS subdirs LIBEXT VPATH_DISTCLEANFILES ABSBUILDDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_COIN_SKIP_PROJECTS_set=${COIN_SKIP_PROJECTS+set} ac_env_COIN_SKIP_PROJECTS_value=$COIN_SKIP_PROJECTS ac_cv_env_COIN_SKIP_PROJECTS_set=${COIN_SKIP_PROJECTS+set} ac_cv_env_COIN_SKIP_PROJECTS_value=$COIN_SKIP_PROJECTS # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures CoinMP 1.8.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of CoinMP 1.8.3:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-sample-lib linker flags for using project Sample --with-sample-incdir directory with header files for using project Sample --with-sample-datadir directory with data files for using project Sample --with-coinutils-lib linker flags for using project CoinUtils --with-coinutils-incdir directory with header files for using project CoinUtils --with-coinutils-datadir directory with data files for using project CoinUtils --with-osi-lib linker flags for using project Osi --with-osi-incdir directory with header files for using project Osi --with-osi-datadir directory with data files for using project Osi --with-clp-lib linker flags for using project Clp --with-clp-incdir directory with header files for using project Clp --with-clp-datadir directory with data files for using project Clp --with-cgl-lib linker flags for using project Cgl --with-cgl-incdir directory with header files for using project Cgl --with-cgl-datadir directory with data files for using project Cgl --with-cbc-lib linker flags for using project Cbc --with-cbc-incdir directory with header files for using project Cbc --with-cbc-datadir directory with data files for using project Cbc --with-coinmp-lib linker flags for using project CoinMP --with-coinmp-incdir directory with header files for using project CoinMP --with-coinmp-datadir directory with data files for using project CoinMP Some influential environment variables: COIN_SKIP_PROJECTS Set to the subdirectories of projects that should be skipped in the configuration Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF CoinMP configure 1.8.3 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package CoinMP which is distributed under the Common Public License. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by CoinMP $as_me 1.8.3, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # List one file in the package so that the configure script can test # whether the package is actually there # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. ############################################################################# # We only need automake to generate Makefiles for the distribution # ############################################################################# # Initialize automake echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi am__api_version="1.9" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='coinmp' VERSION='1.8.3' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME echo "$as_me:$LINENO: checking whether we are using the correct autotools" >&5 echo $ECHO_N "checking whether we are using the correct autotools... $ECHO_C" >&6 if test "${ac_cv_use_correct_autotools+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_correct_autotools=check fi echo "$as_me:$LINENO: result: $ac_cv_use_correct_autotools" >&5 echo "${ECHO_T}$ac_cv_use_correct_autotools" >&6 if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_autoconf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_autoconf"; then ac_cv_prog_have_autoconf="$have_autoconf" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_autoconf="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_autoconf" && ac_cv_prog_have_autoconf="no" fi fi have_autoconf=$ac_cv_prog_have_autoconf if test -n "$have_autoconf"; then echo "$as_me:$LINENO: result: $have_autoconf" >&5 echo "${ECHO_T}$have_autoconf" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_autoconf = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of autoconf" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of autoconf... $ECHO_C" >&6 autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of autoconf as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of autoconf as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location echo "$as_me:$LINENO: checking whether autoconf is coming from the correct location" >&5 echo $ECHO_N "checking whether autoconf is coming from the correct location... $ECHO_C" >&6 autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if we have automake # Extract the first word of "automake", so it can be a program name with args. set dummy automake; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_automake+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_automake"; then ac_cv_prog_have_automake="$have_automake" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_automake="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_automake" && ac_cv_prog_have_automake="no" fi fi have_automake=$ac_cv_prog_have_automake if test -n "$have_automake"; then echo "$as_me:$LINENO: result: $have_automake" >&5 echo "${ECHO_T}$have_automake" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_automake = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of automake" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of automake... $ECHO_C" >&6 automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of automake as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of automake as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable automake is picked up from the correct location echo "$as_me:$LINENO: checking whether automake is coming from the correct location" >&5 echo $ECHO_N "checking whether automake is coming from the correct location... $ECHO_C" >&6 automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` if test -r $want_dir/libtool/ltmain.sh; then have_ltmain=yes : else have_ltmain=no : fi echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of libtool." >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of libtool.... $ECHO_C" >&6 if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of libtool." >&5 echo "$as_me: error: You don't have the correct version of libtool." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: I cannot find the ltmain.sh file." >&5 echo "$as_me: error: I cannot find the ltmain.sh file." >&2;} { (exit 1); exit 1; }; } fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi if test -r $want_dir/aclocal/libtool.m4; then LIBTOOLM4="$want_dir/aclocal/libtool.m4" : else { { echo "$as_me:$LINENO: error: I cannot find the libtool.m4 file." >&5 echo "$as_me: error: I cannot find the libtool.m4 file." >&2;} { (exit 1); exit 1; }; } : fi # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https # Extract the first word of "svn", so it can be a program name with args. set dummy svn; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svn"; then ac_cv_prog_have_svn="$have_svn" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svn="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svn" && ac_cv_prog_have_svn="no" fi fi have_svn=$ac_cv_prog_have_svn if test -n "$have_svn"; then echo "$as_me:$LINENO: result: $have_svn" >&5 echo "${ECHO_T}$have_svn" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$have_svn = xyes; then echo "$as_me:$LINENO: checking whether svn understands https" >&5 echo $ECHO_N "checking whether svn understands https... $ECHO_C" >&6 if test "${ac_cv_svn_understands_https+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out fi echo "$as_me:$LINENO: result: $ac_cv_svn_understands_https" >&5 echo "${ECHO_T}$ac_cv_svn_understands_https" >&6 fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else { { echo "$as_me:$LINENO: error: Cannot find the BuildTools directory" >&5 echo "$as_me: error: Cannot find the BuildTools directory" >&2;} { (exit better disable maintainer mode.); exit better disable maintainer mode.; }; } fi fi fi # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` abs_lib_dir=$full_prefix/lib abs_include_dir=$full_prefix/include abs_bin_dir=$full_prefix/bin if test $coin_have_externals = yes && test x$have_svn = xyes; then HAVE_EXTERNALS_TRUE= HAVE_EXTERNALS_FALSE='#' else HAVE_EXTERNALS_TRUE='#' HAVE_EXTERNALS_FALSE= fi # AC_MSG_NOTICE([End automake initialisation.]) ############################################################################# # Check which subprojects are there # ############################################################################# echo "$as_me:$LINENO: checking whether source of project Sample is available and should be compiled" >&5 echo $ECHO_N "checking whether source of project Sample is available and should be compiled... $ECHO_C" >&6 coin_has_sample=notGiven coin_reason= # check if user wants to skip project in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Sample"; then coin_has_sample="no" coin_reason="Sample has been specified in COIN_SKIP_PROJECTS" fi if test $dir = "Data/Sample"; then coin_has_sample="no" coin_reason="Data/Sample has been specified in COIN_SKIP_PROJECTS" fi done fi if test "$coin_has_sample" != no; then # Check whether --with-m4_tolower(Sample) or --without-m4_tolower(Sample) was given. if test "${with_sample+set}" = set; then withval="$with_sample" if test "$withval" = no ; then coin_has_sample="no" coin_reason="--without-sample has been specified" fi fi; fi if test "$coin_has_sample" != no; then # Check whether --with-m4_tolower(Sample)-lib or --without-m4_tolower(Sample)-lib was given. if test "${with_sample_lib+set}" = set; then withval="$with_sample_lib" if test "$withval" = no ; then coin_has_sample="no" coin_reason="--without-sample-lib has been specified" else coin_has_sample="no" coin_reason="--with-sample-lib has been specified" fi fi; fi if test "$coin_has_sample" != no; then # Check whether --with-m4_tolower(Sample)-incdir or --without-m4_tolower(Sample)-incdir was given. if test "${with_sample_incdir+set}" = set; then withval="$with_sample_incdir" if test "$withval" = no ; then coin_has_sample="no" coin_reason="--without-sample-incdir has been specified" else coin_has_sample="no" coin_reason="--with-sample-incdir has been specified" fi fi; fi if test "$coin_has_sample" != no; then # Check whether --with-m4_tolower(Sample)-datadir or --without-m4_tolower(Sample)-datadir was given. if test "${with_sample_datadir+set}" = set; then withval="$with_sample_datadir" if test "$withval" = no ; then coin_has_sample="no" coin_reason="--without-sample-datadir has been specified" else coin_has_sample="no" coin_reason="--with-sample-datadir has been specified" fi fi; fi # check if project is available in present directory if test "$coin_has_sample" = notGiven; then coin_has_sample=no if test -d $srcdir/Data/Sample; then coin_reason="source in Data/Sample" # If a third argument is given, then we have to check if one one the files given in that third argument is present. # If none of the files in the third argument is available, then we consider the project directory as non-existing. # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient. coin_has_sample="yes" fi fi if test -z "$coin_reason" ; then echo "$as_me:$LINENO: result: $coin_has_sample" >&5 echo "${ECHO_T}$coin_has_sample" >&6 else echo "$as_me:$LINENO: result: $coin_has_sample, $coin_reason" >&5 echo "${ECHO_T}$coin_has_sample, $coin_reason" >&6 fi if test "$coin_has_sample" = yes ; then if test -r $srcdir/Data/Sample/configure; then coin_subdirs="$coin_subdirs Data/Sample" subdirs="$subdirs Data/Sample" fi fi echo "$as_me:$LINENO: checking whether source of project CoinUtils is available and should be compiled" >&5 echo $ECHO_N "checking whether source of project CoinUtils is available and should be compiled... $ECHO_C" >&6 coin_has_coinutils=notGiven coin_reason= # check if user wants to skip project in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "CoinUtils"; then coin_has_coinutils="no" coin_reason="CoinUtils has been specified in COIN_SKIP_PROJECTS" fi done fi if test "$coin_has_coinutils" != no; then # Check whether --with-m4_tolower(CoinUtils) or --without-m4_tolower(CoinUtils) was given. if test "${with_coinutils+set}" = set; then withval="$with_coinutils" if test "$withval" = no ; then coin_has_coinutils="no" coin_reason="--without-coinutils has been specified" fi fi; fi if test "$coin_has_coinutils" != no; then # Check whether --with-m4_tolower(CoinUtils)-lib or --without-m4_tolower(CoinUtils)-lib was given. if test "${with_coinutils_lib+set}" = set; then withval="$with_coinutils_lib" if test "$withval" = no ; then coin_has_coinutils="no" coin_reason="--without-coinutils-lib has been specified" else coin_has_coinutils="no" coin_reason="--with-coinutils-lib has been specified" fi fi; fi if test "$coin_has_coinutils" != no; then # Check whether --with-m4_tolower(CoinUtils)-incdir or --without-m4_tolower(CoinUtils)-incdir was given. if test "${with_coinutils_incdir+set}" = set; then withval="$with_coinutils_incdir" if test "$withval" = no ; then coin_has_coinutils="no" coin_reason="--without-coinutils-incdir has been specified" else coin_has_coinutils="no" coin_reason="--with-coinutils-incdir has been specified" fi fi; fi if test "$coin_has_coinutils" != no; then # Check whether --with-m4_tolower(CoinUtils)-datadir or --without-m4_tolower(CoinUtils)-datadir was given. if test "${with_coinutils_datadir+set}" = set; then withval="$with_coinutils_datadir" if test "$withval" = no ; then coin_has_coinutils="no" coin_reason="--without-coinutils-datadir has been specified" else coin_has_coinutils="no" coin_reason="--with-coinutils-datadir has been specified" fi fi; fi # check if project is available in present directory if test "$coin_has_coinutils" = notGiven; then coin_has_coinutils=no if test -d $srcdir/CoinUtils; then coin_reason="source in CoinUtils" # If a third argument is given, then we have to check if one one the files given in that third argument is present. # If none of the files in the third argument is available, then we consider the project directory as non-existing. # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient. coin_has_coinutils="yes" fi fi if test -z "$coin_reason" ; then echo "$as_me:$LINENO: result: $coin_has_coinutils" >&5 echo "${ECHO_T}$coin_has_coinutils" >&6 else echo "$as_me:$LINENO: result: $coin_has_coinutils, $coin_reason" >&5 echo "${ECHO_T}$coin_has_coinutils, $coin_reason" >&6 fi if test "$coin_has_coinutils" = yes ; then if test -r $srcdir/CoinUtils/configure; then coin_subdirs="$coin_subdirs CoinUtils" subdirs="$subdirs CoinUtils" fi fi echo "$as_me:$LINENO: checking whether source of project Osi is available and should be compiled" >&5 echo $ECHO_N "checking whether source of project Osi is available and should be compiled... $ECHO_C" >&6 coin_has_osi=notGiven coin_reason= # check if user wants to skip project in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Osi"; then coin_has_osi="no" coin_reason="Osi has been specified in COIN_SKIP_PROJECTS" fi done fi if test "$coin_has_osi" != no; then # Check whether --with-m4_tolower(Osi) or --without-m4_tolower(Osi) was given. if test "${with_osi+set}" = set; then withval="$with_osi" if test "$withval" = no ; then coin_has_osi="no" coin_reason="--without-osi has been specified" fi fi; fi if test "$coin_has_osi" != no; then # Check whether --with-m4_tolower(Osi)-lib or --without-m4_tolower(Osi)-lib was given. if test "${with_osi_lib+set}" = set; then withval="$with_osi_lib" if test "$withval" = no ; then coin_has_osi="no" coin_reason="--without-osi-lib has been specified" else coin_has_osi="no" coin_reason="--with-osi-lib has been specified" fi fi; fi if test "$coin_has_osi" != no; then # Check whether --with-m4_tolower(Osi)-incdir or --without-m4_tolower(Osi)-incdir was given. if test "${with_osi_incdir+set}" = set; then withval="$with_osi_incdir" if test "$withval" = no ; then coin_has_osi="no" coin_reason="--without-osi-incdir has been specified" else coin_has_osi="no" coin_reason="--with-osi-incdir has been specified" fi fi; fi if test "$coin_has_osi" != no; then # Check whether --with-m4_tolower(Osi)-datadir or --without-m4_tolower(Osi)-datadir was given. if test "${with_osi_datadir+set}" = set; then withval="$with_osi_datadir" if test "$withval" = no ; then coin_has_osi="no" coin_reason="--without-osi-datadir has been specified" else coin_has_osi="no" coin_reason="--with-osi-datadir has been specified" fi fi; fi # check if project is available in present directory if test "$coin_has_osi" = notGiven; then coin_has_osi=no if test -d $srcdir/Osi; then coin_reason="source in Osi" # If a third argument is given, then we have to check if one one the files given in that third argument is present. # If none of the files in the third argument is available, then we consider the project directory as non-existing. # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient. coin_has_osi="yes" fi fi if test -z "$coin_reason" ; then echo "$as_me:$LINENO: result: $coin_has_osi" >&5 echo "${ECHO_T}$coin_has_osi" >&6 else echo "$as_me:$LINENO: result: $coin_has_osi, $coin_reason" >&5 echo "${ECHO_T}$coin_has_osi, $coin_reason" >&6 fi if test "$coin_has_osi" = yes ; then if test -r $srcdir/Osi/configure; then coin_subdirs="$coin_subdirs Osi" subdirs="$subdirs Osi" fi fi echo "$as_me:$LINENO: checking whether source of project Clp is available and should be compiled" >&5 echo $ECHO_N "checking whether source of project Clp is available and should be compiled... $ECHO_C" >&6 coin_has_clp=notGiven coin_reason= # check if user wants to skip project in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Clp"; then coin_has_clp="no" coin_reason="Clp has been specified in COIN_SKIP_PROJECTS" fi done fi if test "$coin_has_clp" != no; then # Check whether --with-m4_tolower(Clp) or --without-m4_tolower(Clp) was given. if test "${with_clp+set}" = set; then withval="$with_clp" if test "$withval" = no ; then coin_has_clp="no" coin_reason="--without-clp has been specified" fi fi; fi if test "$coin_has_clp" != no; then # Check whether --with-m4_tolower(Clp)-lib or --without-m4_tolower(Clp)-lib was given. if test "${with_clp_lib+set}" = set; then withval="$with_clp_lib" if test "$withval" = no ; then coin_has_clp="no" coin_reason="--without-clp-lib has been specified" else coin_has_clp="no" coin_reason="--with-clp-lib has been specified" fi fi; fi if test "$coin_has_clp" != no; then # Check whether --with-m4_tolower(Clp)-incdir or --without-m4_tolower(Clp)-incdir was given. if test "${with_clp_incdir+set}" = set; then withval="$with_clp_incdir" if test "$withval" = no ; then coin_has_clp="no" coin_reason="--without-clp-incdir has been specified" else coin_has_clp="no" coin_reason="--with-clp-incdir has been specified" fi fi; fi if test "$coin_has_clp" != no; then # Check whether --with-m4_tolower(Clp)-datadir or --without-m4_tolower(Clp)-datadir was given. if test "${with_clp_datadir+set}" = set; then withval="$with_clp_datadir" if test "$withval" = no ; then coin_has_clp="no" coin_reason="--without-clp-datadir has been specified" else coin_has_clp="no" coin_reason="--with-clp-datadir has been specified" fi fi; fi # check if project is available in present directory if test "$coin_has_clp" = notGiven; then coin_has_clp=no if test -d $srcdir/Clp; then coin_reason="source in Clp" # If a third argument is given, then we have to check if one one the files given in that third argument is present. # If none of the files in the third argument is available, then we consider the project directory as non-existing. # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient. coin_has_clp="yes" fi fi if test -z "$coin_reason" ; then echo "$as_me:$LINENO: result: $coin_has_clp" >&5 echo "${ECHO_T}$coin_has_clp" >&6 else echo "$as_me:$LINENO: result: $coin_has_clp, $coin_reason" >&5 echo "${ECHO_T}$coin_has_clp, $coin_reason" >&6 fi if test "$coin_has_clp" = yes ; then if test -r $srcdir/Clp/configure; then coin_subdirs="$coin_subdirs Clp" subdirs="$subdirs Clp" fi fi echo "$as_me:$LINENO: checking whether source of project Cgl is available and should be compiled" >&5 echo $ECHO_N "checking whether source of project Cgl is available and should be compiled... $ECHO_C" >&6 coin_has_cgl=notGiven coin_reason= # check if user wants to skip project in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Cgl"; then coin_has_cgl="no" coin_reason="Cgl has been specified in COIN_SKIP_PROJECTS" fi done fi if test "$coin_has_cgl" != no; then # Check whether --with-m4_tolower(Cgl) or --without-m4_tolower(Cgl) was given. if test "${with_cgl+set}" = set; then withval="$with_cgl" if test "$withval" = no ; then coin_has_cgl="no" coin_reason="--without-cgl has been specified" fi fi; fi if test "$coin_has_cgl" != no; then # Check whether --with-m4_tolower(Cgl)-lib or --without-m4_tolower(Cgl)-lib was given. if test "${with_cgl_lib+set}" = set; then withval="$with_cgl_lib" if test "$withval" = no ; then coin_has_cgl="no" coin_reason="--without-cgl-lib has been specified" else coin_has_cgl="no" coin_reason="--with-cgl-lib has been specified" fi fi; fi if test "$coin_has_cgl" != no; then # Check whether --with-m4_tolower(Cgl)-incdir or --without-m4_tolower(Cgl)-incdir was given. if test "${with_cgl_incdir+set}" = set; then withval="$with_cgl_incdir" if test "$withval" = no ; then coin_has_cgl="no" coin_reason="--without-cgl-incdir has been specified" else coin_has_cgl="no" coin_reason="--with-cgl-incdir has been specified" fi fi; fi if test "$coin_has_cgl" != no; then # Check whether --with-m4_tolower(Cgl)-datadir or --without-m4_tolower(Cgl)-datadir was given. if test "${with_cgl_datadir+set}" = set; then withval="$with_cgl_datadir" if test "$withval" = no ; then coin_has_cgl="no" coin_reason="--without-cgl-datadir has been specified" else coin_has_cgl="no" coin_reason="--with-cgl-datadir has been specified" fi fi; fi # check if project is available in present directory if test "$coin_has_cgl" = notGiven; then coin_has_cgl=no if test -d $srcdir/Cgl; then coin_reason="source in Cgl" # If a third argument is given, then we have to check if one one the files given in that third argument is present. # If none of the files in the third argument is available, then we consider the project directory as non-existing. # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient. coin_has_cgl="yes" fi fi if test -z "$coin_reason" ; then echo "$as_me:$LINENO: result: $coin_has_cgl" >&5 echo "${ECHO_T}$coin_has_cgl" >&6 else echo "$as_me:$LINENO: result: $coin_has_cgl, $coin_reason" >&5 echo "${ECHO_T}$coin_has_cgl, $coin_reason" >&6 fi if test "$coin_has_cgl" = yes ; then if test -r $srcdir/Cgl/configure; then coin_subdirs="$coin_subdirs Cgl" subdirs="$subdirs Cgl" fi fi echo "$as_me:$LINENO: checking whether source of project Cbc is available and should be compiled" >&5 echo $ECHO_N "checking whether source of project Cbc is available and should be compiled... $ECHO_C" >&6 coin_has_cbc=notGiven coin_reason= # check if user wants to skip project in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Cbc"; then coin_has_cbc="no" coin_reason="Cbc has been specified in COIN_SKIP_PROJECTS" fi done fi if test "$coin_has_cbc" != no; then # Check whether --with-m4_tolower(Cbc) or --without-m4_tolower(Cbc) was given. if test "${with_cbc+set}" = set; then withval="$with_cbc" if test "$withval" = no ; then coin_has_cbc="no" coin_reason="--without-cbc has been specified" fi fi; fi if test "$coin_has_cbc" != no; then # Check whether --with-m4_tolower(Cbc)-lib or --without-m4_tolower(Cbc)-lib was given. if test "${with_cbc_lib+set}" = set; then withval="$with_cbc_lib" if test "$withval" = no ; then coin_has_cbc="no" coin_reason="--without-cbc-lib has been specified" else coin_has_cbc="no" coin_reason="--with-cbc-lib has been specified" fi fi; fi if test "$coin_has_cbc" != no; then # Check whether --with-m4_tolower(Cbc)-incdir or --without-m4_tolower(Cbc)-incdir was given. if test "${with_cbc_incdir+set}" = set; then withval="$with_cbc_incdir" if test "$withval" = no ; then coin_has_cbc="no" coin_reason="--without-cbc-incdir has been specified" else coin_has_cbc="no" coin_reason="--with-cbc-incdir has been specified" fi fi; fi if test "$coin_has_cbc" != no; then # Check whether --with-m4_tolower(Cbc)-datadir or --without-m4_tolower(Cbc)-datadir was given. if test "${with_cbc_datadir+set}" = set; then withval="$with_cbc_datadir" if test "$withval" = no ; then coin_has_cbc="no" coin_reason="--without-cbc-datadir has been specified" else coin_has_cbc="no" coin_reason="--with-cbc-datadir has been specified" fi fi; fi # check if project is available in present directory if test "$coin_has_cbc" = notGiven; then coin_has_cbc=no if test -d $srcdir/Cbc; then coin_reason="source in Cbc" # If a third argument is given, then we have to check if one one the files given in that third argument is present. # If none of the files in the third argument is available, then we consider the project directory as non-existing. # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient. coin_has_cbc="yes" fi fi if test -z "$coin_reason" ; then echo "$as_me:$LINENO: result: $coin_has_cbc" >&5 echo "${ECHO_T}$coin_has_cbc" >&6 else echo "$as_me:$LINENO: result: $coin_has_cbc, $coin_reason" >&5 echo "${ECHO_T}$coin_has_cbc, $coin_reason" >&6 fi if test "$coin_has_cbc" = yes ; then if test -r $srcdir/Cbc/configure; then coin_subdirs="$coin_subdirs Cbc" subdirs="$subdirs Cbc" fi fi echo "$as_me:$LINENO: checking whether source of project CoinMP is available and should be compiled" >&5 echo $ECHO_N "checking whether source of project CoinMP is available and should be compiled... $ECHO_C" >&6 coin_has_coinmp=notGiven coin_reason= # check if user wants to skip project in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "CoinMP"; then coin_has_coinmp="no" coin_reason="CoinMP has been specified in COIN_SKIP_PROJECTS" fi done fi if test "$coin_has_coinmp" != no; then # Check whether --with-m4_tolower(CoinMP) or --without-m4_tolower(CoinMP) was given. if test "${with_coinmp+set}" = set; then withval="$with_coinmp" if test "$withval" = no ; then coin_has_coinmp="no" coin_reason="--without-coinmp has been specified" fi fi; fi if test "$coin_has_coinmp" != no; then # Check whether --with-m4_tolower(CoinMP)-lib or --without-m4_tolower(CoinMP)-lib was given. if test "${with_coinmp_lib+set}" = set; then withval="$with_coinmp_lib" if test "$withval" = no ; then coin_has_coinmp="no" coin_reason="--without-coinmp-lib has been specified" else coin_has_coinmp="no" coin_reason="--with-coinmp-lib has been specified" fi fi; fi if test "$coin_has_coinmp" != no; then # Check whether --with-m4_tolower(CoinMP)-incdir or --without-m4_tolower(CoinMP)-incdir was given. if test "${with_coinmp_incdir+set}" = set; then withval="$with_coinmp_incdir" if test "$withval" = no ; then coin_has_coinmp="no" coin_reason="--without-coinmp-incdir has been specified" else coin_has_coinmp="no" coin_reason="--with-coinmp-incdir has been specified" fi fi; fi if test "$coin_has_coinmp" != no; then # Check whether --with-m4_tolower(CoinMP)-datadir or --without-m4_tolower(CoinMP)-datadir was given. if test "${with_coinmp_datadir+set}" = set; then withval="$with_coinmp_datadir" if test "$withval" = no ; then coin_has_coinmp="no" coin_reason="--without-coinmp-datadir has been specified" else coin_has_coinmp="no" coin_reason="--with-coinmp-datadir has been specified" fi fi; fi # check if project is available in present directory if test "$coin_has_coinmp" = notGiven; then coin_has_coinmp=no if test -d $srcdir/CoinMP; then coin_reason="source in CoinMP" # If a third argument is given, then we have to check if one one the files given in that third argument is present. # If none of the files in the third argument is available, then we consider the project directory as non-existing. # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient. coin_has_coinmp="yes" fi fi if test -z "$coin_reason" ; then echo "$as_me:$LINENO: result: $coin_has_coinmp" >&5 echo "${ECHO_T}$coin_has_coinmp" >&6 else echo "$as_me:$LINENO: result: $coin_has_coinmp, $coin_reason" >&5 echo "${ECHO_T}$coin_has_coinmp, $coin_reason" >&6 fi if test "$coin_has_coinmp" = yes ; then if test -r $srcdir/CoinMP/configure; then coin_subdirs="$coin_subdirs CoinMP" subdirs="$subdirs CoinMP" fi fi ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) ac_config_files="$ac_config_files Makefile" # Finally, we let configure write all the output... echo "$as_me:$LINENO: checking which command should be used to link input files" >&5 echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac echo "$as_me:$LINENO: result: $coin_link_input_cmd" >&5 echo "${ECHO_T}$coin_link_input_cmd" >&6 if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_EXTERNALS_TRUE}" && test -z "${HAVE_EXTERNALS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by CoinMP $as_me 1.8.3, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ CoinMP config.status 1.8.3 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBTOOLM4@,$LIBTOOLM4,;t t s,@have_autoconf@,$have_autoconf,;t t s,@have_automake@,$have_automake,;t t s,@have_svn@,$have_svn,;t t s,@BUILDTOOLSDIR@,$BUILDTOOLSDIR,;t t s,@AUX_DIR@,$AUX_DIR,;t t s,@abs_source_dir@,$abs_source_dir,;t t s,@abs_lib_dir@,$abs_lib_dir,;t t s,@abs_include_dir@,$abs_include_dir,;t t s,@abs_bin_dir@,$abs_bin_dir,;t t s,@HAVE_EXTERNALS_TRUE@,$HAVE_EXTERNALS_TRUE,;t t s,@HAVE_EXTERNALS_FALSE@,$HAVE_EXTERNALS_FALSE,;t t s,@COIN_SKIP_PROJECTS@,$COIN_SKIP_PROJECTS,;t t s,@subdirs@,$subdirs,;t t s,@LIBEXT@,$LIBEXT,;t t s,@VPATH_DISTCLEANFILES@,$VPATH_DISTCLEANFILES,;t t s,@ABSBUILDDIR@,$ABSBUILDDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file and --srcdir arguments so they do not pile up. ac_sub_configure_args= ac_prev= for ac_arg in $ac_configure_args; do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d $srcdir/$ac_dir || continue { echo "$as_me:$LINENO: configuring in $ac_dir" >&5 echo "$as_me: configuring in $ac_dir" >&6;} { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" elif test -f $ac_srcdir/configure; then ac_sub_configure="$SHELL '$ac_srcdir/configure'" elif test -f $ac_srcdir/configure.in; then ac_sub_configure=$ac_configure else { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative path. ac_sub_cache_file=$ac_top_builddir$cache_file ;; esac { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval $ac_sub_configure $ac_sub_configure_args \ --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} { (exit 1); exit 1; }; } fi cd $ac_popdir done fi if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then { echo "$as_me:$LINENO: Copying data files for VPATH configuration" >&5 echo "$as_me: Copying data files for VPATH configuration" >&6;} else { echo "$as_me:$LINENO: Creating VPATH links for data files" >&5 echo "$as_me: Creating VPATH links for data files" >&6;} fi for file in $coin_vpath_link_files; do dir=`(dirname "./$file") 2>/dev/null || $as_expr X"./$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"./$file" : 'X\(//\)[^/]' \| \ X"./$file" : 'X\(//\)$' \| \ X"./$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"./$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test -d $dir; then : ; else { if $as_mkdir_p; then mkdir -p $dir else as_dir=$dir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dir" >&5 echo "$as_me: error: cannot create directory $dir" >&2;} { (exit 1); exit 1; }; }; } fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi { echo "$as_me:$LINENO: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&5 echo "$as_me: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&6;} if test x$coin_projectdir = xyes; then { echo "$as_me:$LINENO: Configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} else { echo "$as_me:$LINENO: Main configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Main configuration of $PACKAGE_NAME successful" >&6;} fi else { echo "$as_me:$LINENO: No configuration of $PACKAGE_NAME necessary" >&5 echo "$as_me: No configuration of $PACKAGE_NAME necessary" >&6;} fi CoinMP-1.8.3/INSTALL0000644000175000017500000000777111050155655012364 0ustar renerene********************************************************************** *** DOWNLOAD *** ********************************************************************** You can obtain the source code for the CoinMP package in two ways: 1. Obtain the source directly from the COIN-OR subversion repository (recommended). For this you needs the program 'svn' installed on your machine, and output of "svn --version" must contain "handles 'https' scheme". Assuming that you want to download the code into a subdirectory "COIN-CoinMP", you type svn co https://projects.coin-or.org/svn/CoinMP/stable/1.2 Coin-CoinMP 2. Download the tarball from http://www.coin-or.org/download/source/CoinMP extract it, for example, with gunzip CoinMP-1.2.0.tgz tar xvf CoinMP-1.2.0.tar (Here "-1.2.0" is of course replaced by the actual release string in the tarball you downloaded.) More detailed download instructions can be found at https://projects.coin-or.org/BuildTools/wiki/user-download ********************************************************************** ********************************************************************** *** MS Visual Studio Build *** ********************************************************************** ********************************************************************** To build the 'CoinMP.dll', start MS Visual Studio 8 (2005) or 9 (2008), open the solution file 'CoinMP.sln' in the CoinMP\MSVisualStudio\v8 folder and select 'Build Solution' from the 'Build' menu. ********************************************************************** ********************************************************************** *** Unix Build *** ********************************************************************** ********************************************************************** These instructions are for UNIX-like systems (including Linux, Cygwin and MSys). ********************************************************************** *** Unix CONFIGURATION *** ********************************************************************** Go into the directory that you just downloaded or extracted (e.g., Coin-CoinMP or CoinMP_2006Jun07). Then you type ./configure Note that you might have to specify additional options, in case you don't want to use the default choices that configure makes (e.g., compilers). Please visit https://projects.coin-or.org/BuildTools/wiki/user-configure and the CoinMP Trac page https://projects.coin-or.org/CoinMP for more information. If everything went fine, you will see at the end of the output "Main configuration of CoinMP successful" ********************************************************************** *** Unix COMPILATION AND INSTALLATION *** ********************************************************************** In the directory where you ran the configure script: 1. Compile the code by typing make 2. To test if the code works, you can type make test 3. To install the code, you type make install After this, you will find the executables, libraries and header files in the "bin", "lib" and "include" subdirectory, respectively. More information on the compilation and installation can be found at https://projects.coin-or.org/BuildTools/wiki/user-compile ********************************************************************** *** UNIX: USING THE LIBRARIES *** ********************************************************************** Now you can link your own code with the installed libraries. You can find examples in the CoinMP/examples/ subdirectory, see also the information at https://projects.coin-or.org/BuildTools/wiki/user-examples >>>>>>> .r50 CoinMP-1.8.3/ltmain.sh0000755000175000017500000057753010461157122013157 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/config.guess0000755000175000017500000012706311032507331013640 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/CoinMP/0000755000175000017500000000000013150507612012441 5ustar renereneCoinMP-1.8.3/CoinMP/Makefile.in0000644000175000017500000007667212507770203014533 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. # Author: Andreas Waechter IBM 2006-04-13 # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball @ALWAYS_FALSE@am__append_1 = test DIST_COMMON = README $(am__configure_deps) \ $(srcdir)/BuildTools/Makemain.inc $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/coinmp-uninstalled.pc.in \ $(srcdir)/coinmp.pc.in $(top_srcdir)/configure \ $(top_srcdir)/examples/Makefile.in AUTHORS config.guess \ config.sub depcomp install-sh ltmain.sh missing @HAVE_EXTERNALS_TRUE@am__append_2 = Dependencies @HAVE_EXTERNALS_TRUE@am__append_3 = .Dependencies-stamp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_coinmp.h CONFIG_CLEAN_FILES = examples/Makefile coinmp.pc coinmp-uninstalled.pc SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(addlibsdir)" \ "$(DESTDIR)$(pkgconfiglibdir)" addlibsDATA_INSTALL = $(INSTALL_DATA) pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) DATA = $(addlibs_DATA) $(pkgconfiglib_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = src test DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CBC_CFLAGS = @CBC_CFLAGS@ CBC_CFLAGS_INSTALLED = @CBC_CFLAGS_INSTALLED@ CBC_DATA = @CBC_DATA@ CBC_DATA_INSTALLED = @CBC_DATA_INSTALLED@ CBC_DEPENDENCIES = @CBC_DEPENDENCIES@ CBC_LIBS = @CBC_LIBS@ CBC_LIBS_INSTALLED = @CBC_LIBS_INSTALLED@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINMP_CFLAGS = @COINMP_CFLAGS@ COINMP_CFLAGS_INSTALLED = @COINMP_CFLAGS_INSTALLED@ COINMP_DEPENDENCIES = @COINMP_DEPENDENCIES@ COINMP_LIBS = @COINMP_LIBS@ COINMP_LIBS_INSTALLED = @COINMP_LIBS_INSTALLED@ COINMP_PCLIBS = @COINMP_PCLIBS@ COINMP_PCREQUIRES = @COINMP_PCREQUIRES@ COINMP_SVN_REV = @COINMP_SVN_REV@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_CBC_FALSE = @COIN_HAS_CBC_FALSE@ COIN_HAS_CBC_TRUE = @COIN_HAS_CBC_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src $(am__append_1) ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = examples/Makefile examples/example.c $(am__append_2) ######################################################################## # Installation of the addlibs file # # Installation of the examples dir # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = coinmp.pc addlibsdir = $(DESTDIR)$(datadir)/coin/doc/CoinMP addlibs_DATA = examples/Makefile examples/example.c ######################################################################## # Maintainer Stuff # ######################################################################## # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = $(am__append_3) $(VPATH_DISTCLEANFILES) DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) COIN_HAS_DOXYGEN = @COIN_HAS_DOXYGEN_TRUE@TRUE COIN_HAS_LATEX = @COIN_HAS_LATEX_TRUE@TRUE all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/BuildTools/Makemain.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) examples/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ coinmp.pc: $(top_builddir)/config.status $(srcdir)/coinmp.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ coinmp-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/coinmp-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-addlibsDATA: $(addlibs_DATA) @$(NORMAL_INSTALL) test -z "$(addlibsdir)" || $(mkdir_p) "$(DESTDIR)$(addlibsdir)" @list='$(addlibs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(addlibsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(addlibsdir)/$$f'"; \ $(addlibsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(addlibsdir)/$$f"; \ done uninstall-addlibsDATA: @$(NORMAL_UNINSTALL) @list='$(addlibs_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(addlibsdir)/$$f'"; \ rm -f "$(DESTDIR)$(addlibsdir)/$$f"; \ done install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ 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; } \ END { 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: ctags-recursive $(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; } \ END { 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) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/BuildTools $(distdir)/examples @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(addlibsdir)" "$(DESTDIR)$(pkgconfiglibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-addlibsDATA install-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-exec-am: install-exec-local install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-addlibsDATA uninstall-info-am uninstall-local \ uninstall-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-local \ clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-libtool distclean-local \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-addlibsDATA install-am install-data \ install-data-am install-data-hook install-exec install-exec-am \ install-exec-local install-info install-info-am install-man \ install-pkgconfiglibDATA install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-libtool \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-addlibsDATA uninstall-am uninstall-hook \ uninstall-info-am uninstall-local uninstall-pkgconfiglibDATA ######################################################################## # Extra Targets # ######################################################################## test: all cd test; make test unitTest: test clean-local: if test -r test/Makefile; then cd test; make clean; fi distclean-local: if test -r test/Makefile; then cd test; make distclean; fi .PHONY: test unitTest install-data-hook: @$(mkdir_p) "$(addlibsdir)" @COIN_HAS_PKGCONFIG_TRUE@ PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ @COIN_HAS_PKGCONFIG_TRUE@ $(PKG_CONFIG) --libs coinmp > $(addlibsdir)/coinmp_addlibs.txt @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCoinMP.lib @CBCLIB_LIBS_INSTALLED@" > $(addlibsdir)/coin_addlibs.txt @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lCoinMP @COINMP_LIBS_INSTALLED@ > $(addlibsdir)/coinmp_addlibs.txt uninstall-hook: rm -f $(addlibsdir)/coinmp_addlibs.txt install-exec-local: install-doc uninstall-local: uninstall-doc doxygen-docs: if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ doxygen doxydoc/doxygen.conf;\ fi;\ fi pdf-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/latex"; then \ if test "$(COIN_HAS_LATEX)" = TRUE; then \ cd doxydoc/latex;\ $(MAKE) pdf;\ cd -;\ fi;\ fi;\ fi clean-doxygen-docs: if test -d "doxydoc/"; then \ cd doxydoc ;\ rm -rf html latex *.log *.tag;\ fi install-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc"; \ $(INSTALL_DATA) @coin_doxy_tagname@ "$(DESTDIR)$(DocInstallDir)/@coin_doxy_tagname@";\ if test -f "doxydoc/latex/refman.pdf"; then \ $(INSTALL_DATA) doxydoc/latex/refman.pdf "$(DESTDIR)$(DocInstallDir)";\ fi;\ if test -d "doxydoc/html"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/search/" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc/search/"; \ $(INSTALL_DATA) doxydoc/html/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc";\ $(INSTALL_DATA) doxydoc/html/search/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc/search";\ fi;\ fi;\ fi uninstall-doxygen-docs: if test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/"; then \ rm -rf "$(DESTDIR)$(DocInstallDir)/doxydoc/"; \ fi if test -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; then \ rm -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; \ fi all-doxygen-docs: for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) doxygen-docs) \ fi ; \ done ; clean-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) clean-doxygen-docs) \ fi ; \ done ; install-all-doxygen-docs: all-doxygen-docs for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) install-doxygen-docs) \ fi ; \ done ; uninstall-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) uninstall-doxygen-docs) \ fi ; \ done ; install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## # Make sure acinclude is using most recent coin.m4 @MAINTAINER_MODE_TRUE@$(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 @MAINTAINER_MODE_TRUE@ cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date @MAINTAINER_MODE_TRUE@$(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh @MAINTAINER_MODE_TRUE@ cp $< $@ # Take care of updating externals (if Dependencies file exists) @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@$(top_builddir)/Makefile: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@.Dependencies-stamp: $(srcdir)/Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); BuildTools/set_externals Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ touch .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@update-externals: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); svn update .PHONY: install-doc uninstall-doc update-externals # 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: CoinMP-1.8.3/CoinMP/examples/0000755000175000017500000000000012600453454014262 5ustar renereneCoinMP-1.8.3/CoinMP/examples/Makefile.in0000644000175000017500000000543511617524426016343 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. # $Id: Makefile.in 726 2006-04-17 04:16:00Z andreasw $ ########################################################################## # You can modify this example makefile to fit for your own program. # # Usually, you only need to change the five CHANGEME entries below. # ########################################################################## EXNAME = example # CHANGEME: This should be the name of your executable EXE = $(EXNAME)@EXEEXT@ # CHANGEME: Here is the name of all object files corresponding to the source # code that you wrote in order to define the problem statement OBJS = $(EXNAME).@OBJEXT@ # CHANGEME: Additional libraries ADDLIBS = # CHANGEME: Additional flags for compilation (e.g., include flags) ADDINCFLAGS = # CHANGEME: Directory to the sources for the (example) problem definition # files SRCDIR = @srcdir@ VPATH = @srcdir@ ########################################################################## # Usually, you don't have to change anything below. Note that if you # # change certain compiler options, you might have to recompile the # # COIN package. # ########################################################################## COIN_HAS_PKGCONFIG = @COIN_HAS_PKGCONFIG_TRUE@TRUE COIN_CXX_IS_CL = @COIN_CXX_IS_CL_TRUE@TRUE COIN_HAS_DATASTOCHASTIC = @COIN_HAS_DATASTOCHASTIC_TRUE@TRUE # C Compiler command CC = @CC@ # C Compiler options CFLAGS = @CFLAGS@ # additional C Compiler options for linking CLINKFLAGS = @RPATH_FLAGS@ # Include directories (we use the CYGPATH_W variables to allow compilation with Windows compilers) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags coinmp` else INCL = @COINMP_CFLAGS_INSTALLED@ endif INCL += $(ADDINCFLAGS) # Linker flags ifeq ($(COIN_HAS_PKGCONFIG), TRUE) LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs coinmp` else ifeq ($(COIN_CXX_IS_CL), TRUE) LIBS = -link -libpath:`$(CYGPATH_W) @abs_lib_dir@` libCoinMP.lib @COINMP_LIBS_INSTALLED@ else LIBS = -L@abs_lib_dir@ -lCoinMP @COINMP_LIBS_INSTALLED@ endif endif # The following is necessary under cygwin, if native compilers are used CYGPATH_W = @CYGPATH_W@ all: $(EXE) .SUFFIXES: .c .o .obj $(EXE): $(OBJS) bla=;\ for file in $(OBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \ $(CC) $(CLINKFLAGS) $(CFLAGS) -o $@ $$bla $(LIBS) $(ADDLIBS) clean: rm -rf $(EXE) $(OBJS) .c.o: $(CC) $(CFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$< .c.obj: $(CC) $(CFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi` CoinMP-1.8.3/CoinMP/examples/example.c0000644000175000017500000005455111617524426016100 0ustar renerene /* example.c * $Id: example.c 428 2011-08-07 15:02:46Z stefan $ */ #include #include #include #include #include #include "CoinMP.h" int SOLVCALL MsgLogCallback(char* MessageStr) { fprintf(stdout, "%s", MessageStr); return 0; } int SOLVCALL IterCallback(int IterCount, double ObjectValue, int IsFeasible, double InfeasValue) { fprintf(stdout, "ITER: iter=%d, obj=%.20g, feas=%d, infeas=%.20g\n", IterCount, ObjectValue, IsFeasible, InfeasValue); return 0; } int SOLVCALL MipNodeCallback(int IterCount, int MipNodeCount, double BestBound, double BestInteger, int IsMipImproved) { fprintf(stdout, "NODE: iter=%d, node=%d, bound=%.20g, best=%.20g, %s\n", IterCount, MipNodeCount, BestBound, BestInteger, IsMipImproved ? "Improved" : ""); return 0; } void GetAndCheckSolution(double optimalValue, HPROB hProb) { int solutionStatus; const char* solutionText; double objectValue; int i; int colCount; double* xValues; const char* ColName; const char* problemName; problemName = CoinGetProblemName(hProb); solutionStatus = CoinGetSolutionStatus(hProb); solutionText = CoinGetSolutionText(hProb); objectValue = CoinGetObjectValue(hProb); fprintf(stdout, "\n---------------------------------------\n"); fprintf(stdout, "Problem Name: %s\n", problemName); fprintf(stdout, "Solution Result: %s\n", solutionText ); fprintf(stdout, "Solution Status: %d\n", solutionStatus); fprintf(stdout, "Optimal Value: %.20g\n", objectValue); fprintf(stdout, "---------------------------------------\n"); colCount = CoinGetColCount(hProb); xValues = (double* )malloc(colCount * sizeof(double)); CoinGetSolutionValues(hProb, xValues, NULL, NULL, NULL); for (i = 0; i < colCount; i++) { if (xValues[i] != 0.0) { ColName = CoinGetColName(hProb, i); fprintf(stdout, "%s = %.20g\n", ColName, xValues[i]); } } fprintf(stdout, "---------------------------------------\n\n"); assert(solutionStatus==0); assert(strcmp(solutionText,"Optimal solution found")==0); if (optimalValue != 0.0) { assert( fabs(objectValue-optimalValue) < 0.001 ); } } void RunTestProblem(char* problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double* objectCoeffs, double* lowerBounds, double* upperBounds, char* rowType, double* rhsValues, double* rangeValues, int* matrixBegin, int* matrixCount, int* matrixIndex, double* matrixValues, char** colNames, char** rowNames, char* objectName, double* initValues, char* columnType) { HPROB hProb; int result; char filename[260]; fprintf(stdout, "Solve Problem: %s (obj=%.20g)\n", problemName, optimalValue); hProb = CoinCreateProblem(problemName); result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues); result = CoinLoadNames(hProb, colNames, rowNames, objectName); if (columnType) { result = CoinLoadInteger(hProb, columnType); } result = CoinCheckProblem(hProb); if (result != SOLV_CALL_SUCCESS) { fprintf(stdout, "Check Problem failed (result = %d)\n", result); } /* result = CoinSetMsgLogCallback(hProb, &MsgLogCallback); */ if (columnType == NULL) result = CoinSetIterCallback(hProb, &IterCallback); else { result = CoinSetMipNodeCallback(hProb, &MipNodeCallback); } result = CoinOptimizeProblem(hProb, 0); strcpy(filename, problemName); strcat(filename, ".mps"); result = CoinWriteFile(hProb, SOLV_FILE_MPS, filename); GetAndCheckSolution(optimalValue, hProb); CoinUnloadProblem(hProb); } void RunTestProblemBuf(char* problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double* objectCoeffs, double* lowerBounds, double* upperBounds, char* rowType, double* rhsValues, double* rangeValues, int* matrixBegin, int* matrixCount, int* matrixIndex, double* matrixValues, char* colNamesBuf, char* rowNamesBuf, char* objectName, double* initValues, char* columnType) { HPROB hProb; int result; char filename[260]; fprintf(stdout, "Solve Problem: %s (obj=%.20g)\n", problemName, optimalValue); hProb = CoinCreateProblem(problemName); result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues); result = CoinLoadNamesBuf(hProb, colNamesBuf, rowNamesBuf, objectName); if (columnType) { result = CoinLoadInteger(hProb, columnType); } result = CoinCheckProblem(hProb); if (result != SOLV_CALL_SUCCESS) { fprintf(stdout, "Check Problem failed (result = %d)\n", result); } /* result = CoinSetMsgLogCallback(hProb, &MsgLogCallback); */ if (columnType == NULL) result = CoinSetIterCallback(hProb, &IterCallback); else { result = CoinSetMipNodeCallback(hProb, &MipNodeCallback); } result = CoinOptimizeProblem(hProb, 0); strcpy(filename, problemName); strcat(filename, ".mps"); result = CoinWriteFile(hProb, SOLV_FILE_MPS, filename); GetAndCheckSolution(optimalValue, hProb); CoinUnloadProblem(hProb); } void RunTestProblemMip(char* problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double* objectCoeffs, double* lowerBounds, double* upperBounds, char* rowType, double* rhsValues, double* rangeValues, int* matrixBegin, int* matrixCount, int* matrixIndex, double* matrixValues, char** colNames, char** rowNames, char* objectName, double* initValues, char* columnType, int sosCount, int sosNZCount, int* sosType, int* sosPrior, int* sosBegin, int* sosIndex, double* sosRef, int semiCount, int* semiIndex, int priorCount, int* priorIndex, int* priorValues, int* priorBranch) { HPROB hProb; int result; char filename[260]; fprintf(stdout, "Solve Problem: %s (obj=%.20g)\n", problemName, optimalValue); hProb = CoinCreateProblem(problemName); result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues); result = CoinLoadNames(hProb, colNames, rowNames, objectName); if (columnType) { result = CoinLoadInteger(hProb, columnType); } if (priorCount > 0) { result = CoinLoadPriority(hProb, priorCount, priorIndex, priorValues, priorBranch); } if (sosCount > 0) { result = CoinLoadSos(hProb, sosCount, sosNZCount, sosType, sosPrior, sosBegin, sosIndex, sosRef); } if (semiCount > 0) { result = CoinLoadSemiCont(hProb, semiCount, semiIndex); } result = CoinCheckProblem(hProb); if (result != SOLV_CALL_SUCCESS) { fprintf(stdout, "Check Problem failed (result = %d)\n", result); } /* result = CoinSetMsgLogCallback(hProb, &MsgLogCallback); */ if ((columnType == NULL) && (sosCount == 0) && (semiCount == 0)) result = CoinSetIterCallback(hProb, &IterCallback); else { result = CoinSetMipNodeCallback(hProb, &MipNodeCallback); } strcpy(filename, problemName); strcat(filename, ".mps"); result = CoinWriteFile(hProb, SOLV_FILE_MPS, filename); result = CoinOptimizeProblem(hProb, 0); GetAndCheckSolution(optimalValue, hProb); CoinUnloadProblem(hProb); } /************************************************************************* * This problem is copied from coinutils\test\CoinPackedMatrixTest * * 3x1 + x2 - 2x4 - x5 - x8 * 2x2 + 1.1x3 * x3 + x6 * 2.8x4 -1.2x7 * 5.6x1 + x5 + 1.9x8 * *************************************************************************/ void SolveProblemCoinTest(void) { char* problemName = "CoinTest"; int colCount=8; int rowCount=5; int nonZeroCount=14; int rangeCount = 0; char* objectName = "obj"; int objectSense = SOLV_OBJSENS_MAX; double objectConst = 0.0; double objectCoeffs[8] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; double lowerBounds[8] = { 0., 0., 0., 0., 0., 0., 0. }; double upperBounds[8] = { 1000000., 1000000., 1000000., 1000000., 1000000., 1000000., 1000000., 1000000. }; char rowType[5] = { 'L', 'L', 'L', 'L', 'L' }; double rhsValues[5] = { 14., 80., 50., 50., 50. }; int matrixBegin[8+1]={0,2,4,6,8,10,11,12,14}; int matrixCount[8]={2,2,2,2,2,1,1,2}; int matrixIndex[14]={0,4,0,1,1,2,0,3,0,4,2,3,0,4}; double matrixValues[14]={3., 5.6, 1., 2., 1.1, 1., -2., 2.8, -1., 1., 1., -1.2, -1., 1.9}; char* colNames[8] = {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8"}; char* rowNames[5] = {"r1", "r2", "r3", "r4", "r5"}; double initValues[8] = { 0., 0., 0., 0., 0., 0., 0., 0. }; double optimalValue = 1428729.2857143; RunTestProblem(problemName, optimalValue, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, NULL, matrixBegin, matrixCount, matrixIndex, matrixValues, colNames, rowNames, objectName, initValues, NULL); } void SolveProblemBakery(void) { char* problemName = "Bakery"; int colCount = 2; int rowCount = 3; int nonZeroCount = 4 ; int rangeCount = 0; char* objectName = "Profit"; int objectSense = SOLV_OBJSENS_MAX; double objectConst = - 4000.0 / 30.0; double objectCoeffs[2] = { 0.05 , 0.08 }; double lowerBounds[2] = { 0, 0 }; double upperBounds[2] = { 1000000, 1000000 }; char rowType[3] = { 'L', 'L' , 'L' }; double rhsValues[3] = { 1400 , 8000 , 5000 }; int matrixBegin[2+1] = { 0 , 2, 4 }; int matrixCount[2] = { 2 , 2 }; int matrixIndex[4] = { 0, 1, 0, 2}; double matrixValues[4] = { 0.1, 1, 0.2, 1}; char* colNames[2] = {"Sun", "Moon"}; char* rowNames[3] = {"c1", "c2", "c3"}; double optimalValue = 506.66666667; RunTestProblem(problemName, optimalValue, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, NULL, matrixBegin, matrixCount, matrixIndex, matrixValues, colNames, rowNames, objectName, NULL, NULL); } void SolveProblemAfiro(void) { char* probname = "Afiro"; int ncol = 32; int nrow = 27; int nels = 83; int nrng = 0; char* objectname = "Cost"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[32]={0, -0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.32, 0, 0, 0, -0.6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.48, 0, 0, 10}; double dclo[32]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; double dcup[32]={1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037}; char rtyp[27]= {'E', 'E', 'L', 'L', 'E', 'E', 'L', 'L', 'L', 'L', 'E', 'E', 'L', 'L', 'E', 'E', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L'}; double drhs[27]={0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 0, 0, 500, 0, 0, 44, 500, 0, 0, 0, 0, 0, 0, 0, 0, 310, 300}; int mbeg[32+1]={0, 4, 6, 8, 10, 14, 18, 22, 26, 28, 30, 32, 34, 36, 38, 40, 44, 46, 48, 50, 52, 56, 60, 64, 68, 70, 72, 74, 76, 78, 80, 82, 83}; int mcnt[32]={4, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1}; int midx[83]={0, 1, 2, 23, 0, 3, 0, 21, 1, 25, 4, 5, 6, 24, 4, 5, 7, 24, 4, 5, 8, 24, 4, 5, 9, 24, 6, 20, 7, 20, 8, 20, 9, 20, 3, 4, 4, 22, 5, 26, 10, 11, 12, 21, 10, 13, 10, 23, 10, 20, 11, 25, 14, 15, 16, 22, 14, 15, 17, 22, 14, 15, 18, 22, 14, 15, 19, 22, 16, 20, 17, 20, 18, 20, 19, 20, 13, 15, 15, 24, 14, 26, 15}; double mval[83]={-1, -1.06, 1, 0.301, 1, -1, 1, -1, 1, 1, -1, -1.06, 1, 0.301, -1, -1.06, 1, 0.313, -1, -0.96, 1, 0.313, -1, -0.86, 1, 0.326, -1, 2.364, -1, 2.386, -1, 2.408, -1, 2.429, 1.4, 1, 1, -1, 1, 1, -1, -0.43, 1, 0.109, 1, -1, 1, -1, 1, -1, 1, 1, -0.43, 1, 1, 0.109, -0.43, 1, 1, 0.108, -0.39, 1, 1, 0.108, -0.37, 1, 1, 0.107, -1, 2.191, -1, 2.219, -1, 2.249, -1, 2.279, 1.4, -1, 1, -1, 1, 1, 1}; char* colnames[32] = {"x01", "x02", "x03", "x04", "x06", "x07", "x08", "x09", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x22", "x23", "x24", "x25", "x26", "x28", "x29", "x30", "x31", "x32", "x33", "x34", "x35", "x36", "x37", "x38", "x39"}; char* rownames[27] = {"r09", "r10", "x05", "x21", "r12", "r13", "x17", "x18", "x19", "x20", "r19", "r20", "x27", "x44", "r22", "r23", "x40", "x41", "x42", "x43", "x45", "x46", "x47", "x48", "x49", "x50", "x51"}; /*char* colnamesBuf = "x01\0" "x02\0" "x03\0" "x04\0" "x06\0" "x07\0" "x08\0" "x09\0" "x10\0" "x11\0" "x12\0" "x13\0" "x14\0" "x15\0" "x16\0" "x22\0" "x23\0" "x24\0" "x25\0" "x26\0" "x28\0" "x29\0" "x30\0" "x31\0" "x32\0" "x33\0" "x34\0" "x35\0" "x36\0" "x37\0" "x38\0" "x39";*/ /*char* rownamesBuf = "r09\0" "r10\0" "x05\0" "x21\0" "r12\0" "r13\0" "x17\0" "x18\0" "x19\0" "x20\0" "r19\0" "r20\0" "x27\0" "x44\0" "r22\0" "r23\0" "x40\0" "x41\0" "x42\0" "x43\0" "x45\0" "x46\0" "x47\0" "x48\0" "x49\0" "x50\0" "x51";*/ double optimalValue = -464.753142857; RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, NULL, mbeg, mcnt, midx, mval, colnames, rownames, objectname, NULL, NULL); } void SolveProblemP0033(void) { char* probname = "P0033"; int ncol = 33; int nrow = 15; int nels = 98; int nrng = 0; char* objectname = "Obj"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[33]={171, 171, 171, 171, 163, 162, 163, 69, 69, 183, 183, 183, 183, 49, 183, 258, 517, 250, 500, 250, 500, 159, 318, 159, 318, 159, 318, 159, 318, 114, 228, 159, 318}; double dclo[33]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; double dcup[33]={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; char rtyp[15]= { 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L' }; double drhs[15]={1, 1, 1, 1, -5, 2700, -2600, -100, -900, -1656, -335, -1026, -5, -500, -270}; int mbeg[33+1]={0, 3, 6, 10, 14, 19, 24, 26, 31, 36, 38, 41, 45, 49, 53, 54, 55, 56, 58, 60, 61, 62, 66, 70, 73, 76, 80, 84, 87, 90, 93, 96, 97, 98}; int mcnt[33]={3, 3, 4, 4, 5, 5, 2, 5, 5, 2, 3, 4, 4, 4, 1, 1, 1, 2, 2, 1, 1, 4, 4, 3, 3, 4, 4, 3, 3, 3, 3, 1, 1}; int midx[98]={0, 8, 9, 0, 12, 13, 0, 5, 6, 9, 0, 5, 6, 7, 1, 5, 6, 10, 11, 1, 5, 6, 8, 9, 1, 14, 2, 5, 6, 10, 11, 2, 5, 6, 8, 9, 3, 4, 3, 10, 11, 3, 5, 6, 11, 3, 5, 6, 9, 5, 6, 8, 9, 3, 4, 4, 12, 13, 12, 13, 13, 13, 5, 6, 10, 11, 5, 6, 10, 11, 5, 6, 11, 5, 6, 11, 5, 6, 8, 9, 5, 6, 8, 9, 5, 6, 9, 5, 6, 9, 5, 6, 7, 5, 6, 7, 14, 14}; double mval[98]={1, -300, -300, 1, -300, -300, 1, 300, -300, -300, 1, 300, -300, -300, 1, 285, -285, -285, -285, 1, 285, -285, -285, -285, 1, -285, 1, 265, -265, -265, -265, 1, 265, -265, -265, -265, 1, -230, 1, -230, -230, 1, 230, -230, -230, 1, 230, -230, -230, 190, -190, -190, -190, 1, -200, -400, -200, -200, -400, -400, -200, -400, 200, -200, -200, -200, 400, -400, -400, -400, 200, -200, -200, 400, -400, -400, 200, -200, -200, -200, 400, -400, -400, -400, 200, -200, -200, 400, -400, -400, 200, -200, -200, 400, -400, -400, -200, -400}; char* colnames[33] = {"c157", "c158", "c159", "c160", "c161", "c162", "c163", "c164", "c165", "c166", "c167", "c168", "c169", "c170", "c171", "c172", "c173", "c174", "c175", "c176", "c177", "c178", "c179", "c180", "c181", "c182", "c183", "c184", "c185", "c186", "c187", "c188", "c189"}; char* rownames[15] = {"r114", "r115", "r116", "r117", "r118", "r119", "r120", "r121", "r122", "r123", "r124", "r125", "r126", "r127", "r128"}; /*char* colnamesBuf = "c157\0" "c158\0" "c159\0" "c160\0" "c161\0" "c162\0" "c163\0" "c164\0" "c165\0" "c166\0" "c167\0" "c168\0" "c169\0" "c170\0" "c171\0" "c172\0" "c173\0" "c174\0" "c175\0" "c176\0" "c177\0" "c178\0" "c179\0" "c180\0" "c181\0" "c182\0" "c183\0" "c184\0" "c185\0" "c186\0" "c187\0" "c188\0" "c189";*/ /*char* rownamesBuf = "r114\0" "r115\0" "r116\0" "r117\0" "r118\0" "r119\0" "r120\0" "r121\0" "r122\0" "r123\0" "r124\0" "r125\0" "r126\0" "r127\0" "r128";*/ char ctyp[33] = { 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B' }; double optimalValue = 3089.0; RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, NULL, mbeg, mcnt, midx, mval, colnames, rownames, objectname, NULL, ctyp); } void SolveProblemExmip1(void) { char* probname = "Exmip1"; int ncol = 8; int nrow = 5; int nels = 14; int nrng = 2; char* objectname = "z"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[8]={1, 0, 0, 0, 2, 0, 0, -1}; double dclo[8]={2.5, 0, 0, 0, 0.5, 0, 0, 0}; double dcup[8]={1e+037, 4.1, 1e+037, 1e+037, 4, 1e+037, 1e+037, 4.3}; char rtyp[5]= {'G', 'L', 'E', 'G', 'L'}; double drhs[5]={2.5, 2.1, 4, 1.8, 15}; double drng[5]={0, 0, 0, -3.2, 12}; int mbeg[8+1]={0, 2, 4, 6, 8, 10, 11, 12, 14}; int mcnt[8]={2, 2, 2, 2, 2, 1, 1, 2}; int midx[14]={0, 4, 0, 1, 1, 2, 0, 3, 0, 4, 2, 3, 0, 4}; double mval[14]={3, 5.6, 1, 2, 1.1, 1, -2, 2.8, -1, 1, 1, -1.2, -1, 1.9}; char* colnames[8] = {"col01", "col02", "col03", "col04", "col05", "col06", "col07", "col08"}; char* rownames[5] = {"row01", "row02", "row03", "row04", "row05"}; /*char* colnamesBuf = "col01\0" "col02\0" "col03\0" "col04\0" "col05\0" "col06\0" "col07\0" "col08";*/ /*char* rownamesBuf = "row01\0" "row02\0" "row03\0" "row04\0" "row05";*/ char ctyp[8] = { 'C', 'C', 'B', 'B', 'C', 'C', 'C', 'C'}; double optimalValue = 3.23684210526; RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, drng, mbeg, mcnt, midx, mval, colnames, rownames, objectname, NULL, ctyp); } void SolveProblemGamsSos1a(void) { char* probname = "GamsSos1a"; int ncol = 3; int nrow = 1; int nels = 3; int nrng = 0; char* objectname = "z"; int objsens = SOLV_OBJSENS_MAX; double objconst = 0.0; double dobj[3]={0.9, 1.0, 1.1}; double dclo[3]={0, 0, 0}; double dcup[3]={0.8, 0.6, 0.6}; double drlo[1]={-1e+37}; double drup[1]={1.0}; int mbeg[3+1]={0, 1, 2, 3}; int mcnt[3]={1, 1, 1}; int midx[3]={0, 0, 0}; double mval[3]={1, 1, 1}; char* colnames[3] = {"x1", "x2", "x3"}; char* rownames[1] = {"xsum"}; int sosCount = 1; int sosNZCount = 3; int sosType[1] = {1}; int sosBegin[1+1] = {0, 3}; int sosIndex[3] = {0, 1, 2}; double optimalValue = 0.72; RunTestProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, NULL, drlo, drup, mbeg, mcnt, midx, mval, colnames, rownames, objectname, NULL, NULL, sosCount, sosNZCount, sosType, NULL, sosBegin, sosIndex, NULL, 0, NULL, 0, NULL, NULL, NULL); } void SolveProblemGamsSos2a(void) { char* probname = "GamsSos2a"; int ncol = 7; int nrow = 5; int nels = 15; int nrng = 0; char* objectname = "z"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[7]={0, 0, 0, 0, 0, 1, 1}; double dclo[7]={0.0, 0, 0, -1e+37, -1e+37, 0, 0}; double dcup[7]={1e+37, 1e+37, 1e+37, 1e+37, 1e+37, 1e+37, 1e+37}; char rtyp[5]= {'E', 'E', 'E', 'G', 'G'}; double drhs[5]={1, 0, 0, -1.3, 1.3}; int mbeg[7+1]={0, 3, 6, 9, 10, 13, 14, 15}; int mcnt[7]={3, 3, 3, 1, 3, 1, 1}; int midx[15]={0, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 3, 4, 3, 4}; double mval[15]={1, 1, 1, 1, 2, 2, 1, 3, 3, -1, -1, -1, 1, 1, 1}; char* colnames[7] = {"w1", "w2", "w3", "x", "fx", "fplus", "fminus"}; char* rownames[5] = {"wsum", "xdef", "fxdef", "gapplus", "gapminus"}; int sosCount = 1; int sosNZCount = 3; int sosType[1] = {2}; int sosBegin[1+1] = {0, 3}; int sosIndex[3] = {0, 1, 2}; double optimalValue = 0.0; RunTestProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, NULL, mbeg, mcnt, midx, mval, colnames, rownames, objectname, NULL, NULL, sosCount, sosNZCount, sosType, NULL, sosBegin, sosIndex, NULL, 0, NULL, 0, NULL, NULL, NULL); } void SolveProblemSemiCont(void) { char* probname = "SemiCont"; int ncol = 4; int nrow = 3; int nels = 6; int nrng = 0; char* objectname = "z"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[7]={0.0, 1.0, 1.0, 0.0}; double dclo[7]={2.8, 0.0, 0.0, 0.0}; double dcup[7]={10.0, 1e+37, 1e+37, 1e+37}; char rtyp[5]= {'L', 'G', 'E'}; double drhs[5]={8.9, 8.9, 10.0}; int mbeg[4+1]={0, 1, 2, 3, 6}; int mcnt[4]={1, 1, 1, 3}; int midx[6]={2, 0, 1, 0, 1, 2}; double mval[15]={1, -1, 1, 1, 1, 1}; char* colnames[7] = {"s", "pup", "plo", "x"}; char* rownames[5] = {"bigx", "smallx", "f"}; int semiCount = 1; int semiIndex[1] = {0}; double optimalValue = 1.1; RunTestProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, NULL, mbeg, mcnt, midx, mval, colnames, rownames, objectname, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, semiCount, semiIndex, 0, NULL, NULL, NULL); } int main (int argc, char* argv[]) { const char* SolverName; double CoinVersion; CoinInitSolver(""); SolverName = CoinGetSolverName(); CoinVersion = CoinGetVersion(); fprintf(stdout, "UnitTest: %s version %.20g\n\n", SolverName, CoinVersion); SolveProblemCoinTest(); SolveProblemBakery(); SolveProblemAfiro(); SolveProblemP0033(); SolveProblemExmip1(); SolveProblemGamsSos1a(); SolveProblemGamsSos2a(); SolveProblemSemiCont(); fprintf(stdout, "All unit tests completed successfully\n" ); CoinFreeSolver(); return 0; } CoinMP-1.8.3/CoinMP/examples/csharp/0000755000175000017500000000000012600453454015542 5ustar renereneCoinMP-1.8.3/CoinMP/examples/csharp/ProblemGamsSos1a.cs0000644000175000017500000000417311300433154021204 0ustar renereneusing System.Windows.Forms; using Coin.CoinMP; namespace CoinMPTest { public static class ProblemGamsSos1a { public static void Solve(SolveProblem solveProblem) { const int NUM_COLS = 3; const int NUM_ROWS = 1; const int NUM_NZ = 3; const int NUM_RNG = 0; const double DBL_MAX = 1e37; const int NUM_SOS = 1; const int NUM_SOSNZ = 3; string probname = "GamsSos1a"; int ncol = NUM_COLS; int nrow = NUM_ROWS; int nels = NUM_NZ; int nrng = NUM_RNG; string objectname = "z"; int objsens = CoinMP.SOLV_OBJSENS_MAX; double objconst = 0.0; double[] dobj = new double[NUM_COLS] {0.9, 1.0, 1.1}; double[] dclo = new double[NUM_COLS] {0, 0, 0}; double[] dcup = new double[NUM_COLS] {0.8, 0.6, 0.6}; //char[] rtyp = new char[NUM_ROWS] {}; //double[] drhs = new double[NUM_ROWS] {}; //double[] drng = new double[NUM_ROWS] {}; double[] drlo = {-DBL_MAX}; double[] drup = {1.0}; int[] mbeg = new int[NUM_COLS+1] {0, 1, 2, 3}; int[] mcnt = new int[NUM_COLS] {1, 1, 1}; int[] midx = new int[NUM_NZ] {0, 0, 0}; double[] mval = new double[NUM_NZ] {1, 1, 1}; string[] colNames = new string[NUM_COLS] {"x1", "x2", "x3"}; string[] rowNames = new string[NUM_ROWS] {"xsum"}; int sosCount = 1; int sosNZCount = 3; int[] sosType = new int[NUM_SOS] {1}; int[] sosBegin = new int[NUM_SOS+1] {0, 3}; int[] sosIndex = new int[NUM_SOSNZ] {0, 1, 2}; double optimalValue = 0.72; solveProblem.RunProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, null, drlo, drup, mbeg, mcnt, midx, mval, colNames, rowNames, objectname, null, null, sosCount, sosNZCount, sosType, null, sosBegin, sosIndex, null, 0, null, 0, null, null, null); } } } CoinMP-1.8.3/CoinMP/examples/csharp/bin/0000755000175000017500000000000012600453454016312 5ustar renereneCoinMP-1.8.3/CoinMP/examples/csharp/bin/x86/0000755000175000017500000000000012600453454016737 5ustar renereneCoinMP-1.8.3/CoinMP/examples/csharp/bin/x86/Release/0000755000175000017500000000000012600453454020317 5ustar renereneCoinMP-1.8.3/CoinMP/examples/csharp/bin/x86/Release/CoinMPTestCS9.exe0000644000175000017500000011300012246707167023332 0ustar renereneMZÿÿ¸@€º´ Í!¸LÍ!This program cannot be run in DOS mode. $PELWŒ›Rà Œ®« À@ @…X«SÀØà ̪  H.text´‹ Œ `.rsrcØÀŽ@@.reloc à”@B«H U¬U°Spð?ð?ð?ð?ð?ð?ð?ð?€„.A€„.A€„.A€„.A€„.A€„.A€„.A€„.ALLLLL,@T@I@I@I@ @ffffff@ð?@š™™™™™ñ?ð?Àffffff@ð¿ð?ð?333333ó¿ð¿ffffffþ?0Ÿrp    rp# %Ð:(    %Ð;(  &%Ð<(   %Ð=(   '%Ð>(  '%Ð?( '%Ð@(  %ÐA( (rp¢r!p¢r'p¢r-p¢r3p¢r9p¢r?p¢rEp¢(rKp¢rQp¢rWp¢r]p¢rcp¢ #†’$IùÌ5A      o‹*ÍÌÌÌÌÌì?ð?š™™™™™ñ?š™™™™™é?333333ã?333333ã?ð?ð?ð?0%’rip    r}p# %ÐB(    %ÐC(   #iWC¸žÇ¡  #ð?¡ '%ÐD(  '%ÐE( ' %ÐF( (rp¢r‡p¢rp¢(r“p¢'ž'  ž '!!ž!ž!# ×£p= ç?      o*$@iWC¸žGiWC¸žGiWC¸žGLGEÍÌÌÌÌÌ!@ÍÌÌÌÌÌ!@$@ð?ð¿ð?ð?ð?ð?0%–rp    r}p# #ð?¡#ð?¡ #ffffff@¡  %ÐG(  &%ÐH(   %ÐI(  '%ÐJ(  '%ÐK( '%ÐL(  %ÐM( (r¯p¢r³p¢r»p¢rÃp¢(rÇp¢rÑp¢rßp¢'#š™™™™™ñ?      o*iWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGEEEGGð?ÍÌÌÌÌÌô¿ÍÌÌÌÌÌô? ð?ð?ð?ð?@@ð?@@ð¿ð¿ð¿ð?ð?ð?0%rãp    r}p# #ð?¡#ð?¡ #iWC¸žÇ¡#iWC¸žÇ¡  %ÐN(  &%ÐO(   %ÐP(  '%ÐQ(  '%ÐR( '%ÐS(  %ÐT( (r÷p¢rýp¢rp¢rÃp¢r p¢rp¢rp¢(r)p¢r3p¢r=p¢rIp¢rYp¢'ž'ž'žž#      o*ð?@ð¿iWC¸žGffffff@iWC¸žGiWC¸žG@iWC¸žGiWC¸žG333333@@iWC¸žÇiWC¸žÇÍÌÌÌÌÌü?@iWC¸žGÍÌÌÌÌÌ@@@.@ @ffffff@ð?@š™™™™™ñ?ð?Àffffff@ð¿ð?ð?333333ó¿ð¿ffffffþ?CCBBCCCC0¿rkp    r}p# %ÐU(  #@¡#à?¡  %ÐV(   %ÐW(   %ÐX(   '%ÐY(  '%ÐZ( '%Ð[(  %Ð\( (ryp¢r…p¢r‘p¢rp¢r©p¢rµp¢rÁp¢rÍp¢(rÙp¢råp¢rñp¢rýp¢r p¢&%Ð]( #ŠBCy å @      oŒ*Z( ( s ( *z,{, {o ( *0s }s }s }( {O cs o {rpo {ns o! {o" {r+po# {o$ {þ s% o& {  cs o {r=po {os o! {o" {rOpo# {o$ {þ s% o& { s o {o' {r[po {o( { ± Es o! {o" "À@"PAs) (* (+  Í ‘s (, (- {o. (- {o. (- {o. rip( rpo# (/ (0 *0o(1 ds2 (r—p(&o3 (&(# {({r™p(4 ({r«pŒ (4 (*0C {{s„ ((((((((*2{(*:(5 }*:(5 }*{*"}*–{,{%o6 o7 (8 o# *ª{,!{%o6 o7 r¿p(9 o# *’{,{%o6 r¿p(8 o# *f{,{r—po# *n,%o6 o7 (8 o# *‚,%o6 o7 r¿p(9 o# *j,%o6 r¿p(8 o# *>, r—po# *š™™™™™Ù¿{®GázÔ¿333333㿸…ëQ¸Þ¿$@iWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGEELLEELLLLEELLEELLLLLLLLLLLT@T@@@F@@@`s@Àr@  "$&(,.0248<@DFHJLNPRS       ð¿ö(\Âõð¿ð?Ý$•CÓ?ð?ð¿ð?ð¿ð?ð?ð¿ö(\Âõð¿ð?Ý$•CÓ?ð¿ö(\Âõð¿ð?Õxé&1Ô?𿸅ëQ¸î¿ð?Õxé&1Ô?ð¿…ëQ¸…ë¿ð?w¾Ÿ/ÝÔ?ð¿¶óýÔxé@ð¿J +‡@ð¿Ý$•C@ð¿;ßO—n@ffffffö?ð?ð?ð¿ð?ð?ð¿…ëQ¸…Û¿ð?•C‹lç»?ð?ð¿ð?ð¿ð?ð¿ð?ð?…ëQ¸…Û¿ð?ð?•C‹lç»?…ëQ¸…Û¿ð?ð?ÙÎ÷S㥻?ö(\ÂõØ¿ð?ð?ÙÎ÷S㥻?®Gáz®×¿ð?ð?1¬Zd»?ð¿ºI +‡@ð¿—nƒÀ@ð¿Ë¡E¶óý@ð¿¬Zd;@ffffffö?ð¿ð?ð¿ð?ð?ð?0c rÅp   S rÑp# %Ð^(    %Ð_(  &%Ð`(   %Ða(  !'%Ðb(   '%Ðc( S'%Ðd( S %Ðe(  (rÛp¢rãp¢rëp¢róp¢rûp¢rp¢r p¢rp¢rp¢ r#p¢ r+p¢ r3p¢ r;p¢ rCp¢rKp¢rSp¢r[p¢rcp¢rkp¢rsp¢r{p¢rƒp¢r‹p¢r“p¢r›p¢r£p¢r«p¢r³p¢r»p¢rÃp¢rËp¢rÓp¢(rÛp¢rãp¢rëp¢róp¢rûp¢rp¢r p¢rp¢rp¢ r#p¢ r+p¢ r3p¢ r;p¢ rCp¢rKp¢rSp¢r[p¢rcp¢rkp¢rsp¢r{p¢rƒp¢r‹p¢r“p¢r›p¢r£p¢r«p¢#@†ß }À      o‹*LLLà•@@¿@ˆ³@š™™™™™¹?ð?š™™™™™É?ð?0u r³p    rÁp#«ªªªªª`À #š™™™™™©?¡#{®Gáz´?¡   #€„.A¡#€„.A¡ &%Ðf(   %Ðg(  'žž 'žž'žž %Ðh( (rÏp¢r×p¢(rp¢r!p¢r'p¢#»«ªªª@      o‹*`e@`e@`e@`e@`d@@d@`d@@Q@@Q@àf@àf@àf@àf@€H@àf@ p@(€@@o@@@@o@@@àc@às@àc@às@àc@às@àc@às@€\@€l@àc@às@ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?LLLLLLLLLLLLLLLð?ð?ð?ð?À¥@P¤ÀYÀ ŒÀà™ÀðtÀÀÀ@ÀàpÀ $&)-15678:<=>BFILPTWZ]`ab                   ð?ÀrÀÀrÀð?ÀrÀÀrÀð?Àr@ÀrÀÀrÀð?Àr@ÀrÀÀrÀð?Ðq@ÐqÀÐqÀÐqÀð?Ðq@ÐqÀÐqÀÐqÀð?ÐqÀð?p@pÀpÀpÀð?p@pÀpÀpÀð?ÀlÀð?ÀlÀÀlÀð?Àl@ÀlÀÀlÀð?Àl@ÀlÀÀlÀÀg@ÀgÀÀgÀÀgÀð?iÀyÀiÀiÀyÀyÀiÀyÀi@iÀiÀiÀy@yÀyÀyÀi@iÀiÀy@yÀyÀi@iÀiÀiÀy@yÀyÀyÀi@iÀiÀy@yÀyÀi@iÀiÀy@yÀyÀiÀyÀBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB0  ráp !  b ríp#! %Ði( !  ! %Ðj(  &%Ðk(   %Ðl(  "'%Ðm(  !'%Ðn( b'%Ðo( b %Ðp( !(rõp¢rÿp¢r p¢rp¢rp¢r'p¢r1p¢r;p¢rEp¢ rOp¢ rYp¢ rcp¢ rmp¢ rwp¢rp¢r‹p¢r•p¢rŸp¢r©p¢r³p¢r½p¢rÇp¢rÑp¢rÛp¢råp¢rïp¢rùp¢rp¢r p¢rp¢r!p¢r+p¢ r5p¢(r?p¢rIp¢rSp¢r]p¢rgp¢rqp¢r{p¢r…p¢rp¢ r™p¢ r£p¢ r­p¢ r·p¢ rÁp¢rËp¢!&%Ðq( #"¨@      o‹*0Q s: o; 1:šrÕp(8 o< & +šrÕp(8 o< &X o; 2Þo7 *.( (> *R((()*04     (((+*03     (((+*2(7(> *6(<(> *6(?(> *"(E*2(H(> *6(f(> *6(i(> *6(q(> *(5 *~(5 s }5s }6*~(5 s }5s }6*~(5 s }5s }6*2{5o*6{5o*2{6o*6{6o*b{6rÙp(8 o*0Æ{6rãpo(8 (G (I (K {5rcp(8 o{5r‡p(8 o{5r«pŒ'(4 o{5rÏp¢ Œ ¢róp¢Œ ¢rùp¢(? o{5rãpo(: (O&+A™#.+(={5rýp™Œ (@ oX2¹{5rãpo{5o,rpŒ'(4 (A &#.O Y(B #ü©ñÒMbP?7<  rp¢  Œ ¢ rp¢ Œ ¢ (? (A &*0${5o{5 r)p¢ ¢ rIp¢ Œ ¢ rùp¢ (? o{5rãpo('      (( (* ,{5rWpo,(/ ,{5r…po(6 , {5r³pŒ'rùp(@ oþ‰sv (B (F (S (Š(5 *01     (‹*0l{5o{5 r)p¢ ¢ rIp¢ Œ ¢ rùp¢ (? o{5rãpo('      (( (* ,{5rWpo,(/ ,{5r…po!1!"#$(0 1(1 1  (2 (6 , {5r³pŒ'rùp(@ oþ‰sv (B (F róp(8 (S (Š(5 *~7*Vs(D t€7*(E *(5 *03~8(G , rýpÐ(H oI sJ €8~8*~9*€9*´ÎÊムlSystem.Resources.ResourceReader, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSetPADPADP´´ÎÊムlSystem.Resources.ResourceReader, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSetPADPADP´BSJB v2.0.50727lä"#~P#ì #Strings aLf>xư øL L(>>2Ð >Ý > Œ Î ¹ $0 û$ûAû`ûyû’û­ûÈûáõûûL9s`o¯oÛ>'oB>}oŒ>’>É>0>û>7> JL> ›LÀ±Ü± L'> >L XLr± xL ¡L³ÐXv ŽL ™L«>Ì´êx 91 >6 >Z ûp °‰ °,7,H,X,i,€w,, Š, •,¢,°,½ÄÐ 5vß 5zì 5~ü,5‚ 7Ž+8‘â:•L‰r•Ήr•ÿ‰r•6‰r•g‰r•˜‰r•ɉr•‰r•G‰r•x‰r•щr•‰r•n‰r•ï‰r• ‰r•Q‰r•4‰r•z‰r•«‰r•݉r•‰r•A‰r•s‰r•á‰r•'‰r•l‰r•²‰r•ä‰r•‰r•Ñÿ! !%R%V€–RV€¨RV€¹RV€ÍRV€àRV€ñRV€RV€RV€-RV€=RV€LRV€\RV€lRV€}RV€ŽRV€ŸRV€±RV€ÄRV€×RV€çRV€øRV€ RV€RV€'RV€:RV€HRV€URV€fRV€wRV€ˆRV€–RV€ªRV€¾RV€ÔRV€èRV€ûRV€RV€#RV€8RV€LRV€`RV€wRV€‰RV€œRV€°RV€ÇRV€ÛR Ô Ôh u­ ƒÚ ‡i°µ°ë¾ÂSƄʵÎçÒ3d• ©½ÊíM2QFZ‹VŸÎ³¾ÇÂÛÊ Š=o”ƒ°—°«Â¿ÂÓÆçÊûÎÒ#Rxfx—}É‚û‡-Œ_‘‘–¥M¹ÍÊÿõõDúX”Šÿž‡Ð 3ø!–¥ $–¥ `&–¥ p)–¥ X-–¥ #/‘«:/ÄÜ\/äp1†"ì12);2C) H2†" W2†"0 f2†Z6 n2†e0 w2†p; 2†z;È2†„í2†Œ3–p@#3–z@D3–„G_3–ŒGp;–¥  ?–¥ DDDDIS^ipi{‡–Ÿ§²¾Ê × ã ï ÷  %1‡>JV‡^gV‡–Ÿ§²¾Ê × ã ï ÷  %1>JV‡–Ÿ§²¾Ê × ã ï ÷  %1^gV‡–Ÿ§²¾Ê × ã p y %1^gV‡‚‡‡˜£®º‡ÆÏÚâëôý‡‡",6‡AN[dlt| †  š‡‡‡‡‡{i‡‡‡¤‡¤‡¤¨i‡°‡°‡°´i‡¼‡Ë‡Ø‡è‡‡‡‡‡ïi‡‡‡‡‡ü=IU‡alw‚‡—‡¡ª‡¡·‡Å‡‡‡Ñ‡Ú‡å‡åÑîø‡å ‡å ‡åÚi‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡ÑÚi‡Ñ‡Ñ‡Ñi‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ(‡Ñ‡Ñ‡Ñ2i‡Ñ2>èEEP>Y>è`jv`jvP>Y>è`š¤°`š¤°P>Ya >>¾Â‡{–ϧ²¾ Ê × ã ï ÷ %1^gÜ‚ç{–ϧ²¾ Ê × ã p y %1^gÜ‚ç{–ϧ²¾ Ê × ã ï ÷ %1^gÜ‚çÆÏÚâëôý !˜"£#®$ï>q"y"";‰";‘";™";¡";©";±";¹";Á"É";Ñ";Ù";á"¥ñ"«ù" "¥´I"QVQiûQ‹YÜÜ1"9"a£i"aÆaÓ;q"aáaê«a÷;y "a4#‰J9c*™"1¡‰7¡¯>ÁaâE±ïKaóa"I"«IRAV "a"g +gAkAqI"!G=IQB¹";Á~øANATɦ[Ù°cá"é÷à!"ñ" ! *ùH 0ùc 9a"?"LUZ U$_(d,i0n4s8x<}@_DdHiLnP‚T‡XŒ\‘`–dZh_lUp_tdx›|i€ „¥ˆªŒn_”d˜›œi  ¤¥¨ª¬n°¯´´¸¹¼¾ÀÃÄÈÈÍÌ‚ÐÒ.#l.+l.‹ü.Kl.ƒó.3r.;\.CŽ.\.[l.c¼.sæ.{S©[SÀ£_É[SC“_C‡c3_c“_c郓_@ ($ 8p  0!"<#x$%6&Ø'„(€)L*˜+,-ˆ.ˆ/0B1ÖRJ[™Ñ\b›ÃHhxG MMa M„ ~ › …†‡ˆŽ ’ “ ” k9;= ?LAyE‹G I¯K¿MÎOÞQðSÿW]A_Tadcueg’i¤k¶mÈoòsuw+yP}_†ƒ•…§‡½‰Ñ‹èü‘, •@ —W ™j ›~  Ÿ£ ¡¹ £Ï ¥ä §ñ ©ÿ « ­ ¯3 ±F ³[ µk ·} ¹” »¬ ½Â ¿Õ Áç à ŠÇ6 ÉT Ën Í  Ѳ Óä ×û Ù Û* Ý; ßL á^ ㊠çž éµ P : ;Ð <à =!>0!?P!@ˆ!A¨#BÀ#CØ#Dè#Eø#F°%GÐ%HØ%Ið%J&K&L0&M(N@(OP(Px(Q˜(R¸(Sø(Tˆ+UÈ+V,W0,XX,Y€,Z ,[Ø,\H-]p3^p4_p5`¨5a€6b7cˆ7dØ8eà>fè>g?h¨@i°Aj¸BkØBlPCmØCn`DoèEpøHq€Í5L>±ž ¸Ë     !"#$%&'()*+,-./01CoinMPTestCS9.exeProblemCoinTestCoinMPTestProblemGamsSos1aProblemSemiContProblemGamsSos2aProblemExMip1ProgramformCoinMPLogHandlerProblemAfiroProblemBakeryProblemP0033CoinMPCoin.CoinMPMsgLogDelegateIterDelegateMipNodeDelegateSolveProblemSettingsCoinMPTestCS9.PropertiesResourcesmscorlibSystemObjectSystem.Windows.FormsFormMulticastDelegateSystem.ConfigurationApplicationSettingsBaseSolveMainSystem.ComponentModelIContainercomponentsDisposeInitializeComponentButtonbtnRunTestbtnClearTextBoxtxtLog.ctorEventArgsbtnRunTest_ClickbtnClear_Click_txtLogget_txtLogset_txtLogWriteTextWriteLineNewLineEmptyTextSOLV_CALL_SUCCESSSOLV_CALL_FAILEDSOLV_METHOD_DEFAULTSOLV_METHOD_PRIMALSOLV_METHOD_DUALSOLV_METHOD_NETWORKSOLV_METHOD_BARRIERSOLV_METHOD_BENDERSSOLV_METHOD_DEQSOLV_METHOD_EVSOLV_FEATURE_LPSOLV_FEATURE_QPSOLV_FEATURE_QCPSOLV_FEATURE_NLPSOLV_FEATURE_MIPSOLV_FEATURE_MIQPSOLV_FEATURE_MIQCPSOLV_FEATURE_MINLPSOLV_FEATURE_SPSOLV_OBJSENS_MAXSOLV_OBJSENS_MINSOLV_FILE_LOGSOLV_FILE_BASISSOLV_FILE_MIPSTARTSOLV_FILE_MPSSOLV_FILE_LPSOLV_FILE_BINARYSOLV_FILE_OUTPUTSOLV_FILE_BINOUTSOLV_FILE_IISSOLV_CHECK_COLCOUNTSOLV_CHECK_ROWCOUNTSOLV_CHECK_RANGECOUNTSOLV_CHECK_OBJSENSESOLV_CHECK_ROWTYPESOLV_CHECK_MATBEGINSOLV_CHECK_MATCOUNTSOLV_CHECK_MATBEGCNTSOLV_CHECK_MATBEGNZSOLV_CHECK_MATINDEXSOLV_CHECK_MATINDEXROWSOLV_CHECK_BOUNDSSOLV_CHECK_COLTYPESOLV_CHECK_COLNAMESSOLV_CHECK_COLNAMESLENSOLV_CHECK_ROWNAMESSOLV_CHECK_ROWNAMSLENGenerateNamesBufCoinInitSolverCoinFreeSolverCoinGetSolverNameSystem.TextStringBuilderCoinGetSolverNameBufCoinGetVersionStrIntPtrCoinGetVersionStrCoinGetVersionStrBufCoinGetVersionCoinGetFeaturesCoinGetMethodsCoinGetInfinityCoinCreateProblemCoinLoadMatrixCoinLoadNamesBufCoinLoadNamesCoinLoadProblemBufCoinLoadProblemCoinLoadInitValuesCoinLoadIntegerCoinLoadPriorityCoinLoadSosCoinLoadSemiContCoinLoadQuadraticCoinLoadNonlinearCoinUnloadProblemCoinCheckProblemCoinGetProblemNameIntPtrCoinGetProblemNameCoinGetProblemNameBufCoinGetColCountCoinGetRowCountCoinGetColNameIntPtrCoinGetColNameCoinGetColNameBufCoinGetRowNameIntPtrCoinGetRowNameCoinGetRowNameBufCoinSetMsgLogCallbackCoinSetIterCallbackCoinSetMipNodeCallbackCoinOptimizeProblemCoinGetSolutionStatusCoinGetSolutionTextIntPtrCoinGetSolutionTextCoinGetSolutionTextBufCoinGetObjectValueCoinGetMipBestBoundCoinGetIterCountCoinGetMipNodeCountCoinGetSolutionValuesCoinGetSolutionRangesCoinGetSolutionBasisCoinReadFileCoinWriteFileCoinOpenLogFileCoinCloseLogFileCoinGetOptionCountCoinLocateOptionIDCoinLocateOptionNameCoinGetOptionIDCoinGetOptionInfoCoinGetIntOptionMinMaxCoinGetRealOptionMinMaxCoinGetOptionNamesBufCoinGetOptionGroupCoinGetOptionTypeCoinGetIntOptionDefaultValueCoinGetIntOptionMinValueCoinGetIntOptionMaxValueCoinGetRealOptionDefaultValueCoinGetRealOptionMinValueCoinGetRealOptionMaxValueCoinGetOptionNameIntPtrCoinGetOptionNameCoinGetOptionNameBufCoinGetOptionShortNameIntPtrCoinGetOptionShortNameCoinGetOptionShortNameBufCoinGetOptionChangedCoinGetIntOptionCoinSetIntOptionCoinGetRealOptionCoinSetRealOptionCoinGetStringOptionIntPtrCoinGetStringOptionCoinGetStringOptionBufCoinSetStringOptionInvokeIAsyncResultAsyncCallbackBeginInvokeEndInvokelogTxtlogMsgget_msgLogset_msgLogMsgLogCallbackGetAndCheckSolutionRunProblemRunProblemMipmsgLogdefaultInstanceget_DefaultDefaultSystem.ResourcesResourceManagerresourceManSystem.GlobalizationCultureInforesourceCultureget_ResourceManagerget_Cultureset_CultureCulturesolveProblemdisposingsenderevaluetextnamesListlicenseStrsolverNamebuflenversionStrproblemNamehProbcolCountrowCountnzCountrangeCountobjectSenseobjectConstobjectCoeffslowerBoundsupperBoundsrowTyperhsValuesrangeValuesmatrixBeginmatrixCountmatrixIndexmatrixValuescolNamesBufrowNamesBufobjNamecolNamesrowNamesrowLowerrowUpperinitValuescolumnTypepriorCountpriorIndexpriorValuesPriorBranchsosCountsosNZCountsosTypesosPriorsosBeginsosIndexsosRefsemiCountsemiIndexquadBeginquadCountquadIndexquadValuesnlpTreeCountnlpLineCountnlpBeginnlpOpernlpArg1nlpArg2nlpIndex1nlpIndex2nlpValue1nlpValue2colcolNamerowrowNamemsgLogDelegateiterDelegatemipNodeDelegatemethodsolutionTextactivitySystem.Runtime.InteropServicesInAttributeOutAttributereducedCostslackValuesshadowPriceobjLoRangeobjUpRangerhsLoRangerhsUpRangecolStatusrowStatusfileTypereadFilenamewriteFilenamelogFilenameoptionIDoptionNameoptionNrgroupTypeoptionTypeminValuemaxValueshortNameintValuerealValuestringValueobjectmessageStrcallbackresultiterCountobjectValueisFeasibleinfeasValuemipNodeCountbestBoundbestIntegerisMipImprovedmsgoptimalValuenonZeroCountobjectNamecolTypepriorBranchSystem.ReflectionAssemblyTitleAttributeAssemblyDescriptionAttributeAssemblyConfigurationAttributeAssemblyCompanyAttributeAssemblyProductAttributeAssemblyCopyrightAttributeAssemblyTrademarkAttributeAssemblyCultureAttributeComVisibleAttributeGuidAttributeAssemblyVersionAttributeAssemblyFileVersionAttributeSystem.DiagnosticsDebuggableAttributeDebuggingModesSystem.Runtime.CompilerServicesCompilationRelaxationsAttributeRuntimeCompatibilityAttributeCoinMPTestCS9Double{08100927-AB3A-4B7E-93EF-2BE963368846}CompilerGeneratedAttributeValueType__StaticArrayInitTypeSize=64$$method0x6000001-1RuntimeHelpersArrayRuntimeFieldHandleInitializeArray$$method0x6000001-2Char__StaticArrayInitTypeSize=10$$method0x6000001-3__StaticArrayInitTypeSize=40$$method0x6000001-4Int32__StaticArrayInitTypeSize=36$$method0x6000001-5__StaticArrayInitTypeSize=32$$method0x6000001-6__StaticArrayInitTypeSize=56$$method0x6000001-7__StaticArrayInitTypeSize=112$$method0x6000001-8String__StaticArrayInitTypeSize=24$$method0x6000002-1$$method0x6000002-2__StaticArrayInitTypeSize=16$$method0x6000002-3__StaticArrayInitTypeSize=12$$method0x6000002-4$$method0x6000002-5$$method0x6000003-1__StaticArrayInitTypeSize=6$$method0x6000003-2$$method0x6000003-3__StaticArrayInitTypeSize=20$$method0x6000003-4$$method0x6000003-5$$method0x6000003-6__StaticArrayInitTypeSize=48$$method0x6000003-7$$method0x6000004-1$$method0x6000004-2$$method0x6000004-3$$method0x6000004-4__StaticArrayInitTypeSize=28$$method0x6000004-5__StaticArrayInitTypeSize=60$$method0x6000004-6__StaticArrayInitTypeSize=120$$method0x6000004-7$$method0x6000005-1$$method0x6000005-2$$method0x6000005-3$$method0x6000005-4$$method0x6000005-5$$method0x6000005-6$$method0x6000005-7$$method0x6000005-8$$method0x6000005-9STAThreadAttributeApplicationEnableVisualStylesSetCompatibleTextRenderingDefaultRunIDisposableControlSuspendLayoutSystem.DrawingPointset_Locationset_NameSizeset_Sizeset_TabIndexset_TextButtonBaseset_UseVisualStyleBackColorEventHandleradd_ClickTextBoxBaseset_MultilineScrollBarsset_ScrollBarsSizeFContainerControlset_AutoScaleDimensionsAutoScaleModeset_AutoScaleModeset_ClientSizeControlCollectionget_ControlsAddResumeLayoutPerformLayoutget_CapacityConcatget_TextToString__StaticArrayInitTypeSize=256$$method0x6000018-1$$method0x6000018-2__StaticArrayInitTypeSize=54$$method0x6000018-3__StaticArrayInitTypeSize=216$$method0x6000018-4__StaticArrayInitTypeSize=132$$method0x6000018-5__StaticArrayInitTypeSize=128$$method0x6000018-6__StaticArrayInitTypeSize=332$$method0x6000018-7__StaticArrayInitTypeSize=664$$method0x6000018-8$$method0x6000019-1$$method0x6000019-2$$method0x6000019-3__StaticArrayInitTypeSize=264$$method0x600001a-1$$method0x600001a-2__StaticArrayInitTypeSize=30$$method0x600001a-3$$method0x600001a-4__StaticArrayInitTypeSize=136$$method0x600001a-5$$method0x600001a-6__StaticArrayInitTypeSize=392$$method0x600001a-7__StaticArrayInitTypeSize=784$$method0x600001a-8__StaticArrayInitTypeSize=66$$method0x600001a-9GetLengthAppendDllImportAttributecoinmp.dllMarshalPtrToStringAnsiMessageBoxDialogResultShowMathAbsSystem.CodeDom.CompilerGeneratedCodeAttribute.cctorSettingsBaseSynchronizedDebuggerNonUserCodeAttributeReferenceEqualsTypeRuntimeTypeHandleGetTypeFromHandleAssemblyget_AssemblyEditorBrowsableAttributeEditorBrowsableStateCoinMPTestCS9.Properties.Resources.resourcesCoinMPTest.formCoinMP.resourcesCoinTestobjc1c2c3c4c5c6c7c8r1r2r3r4r5GamsSos1azx1x2x3 xsumSemiContspupplox bigx smallxfGamsSos2aw1w2w3fx fplus fminus wsum xdef fxdefgapplusgapminus Exmip1 col01 col02 col03 col04 col05 col06 col07 col08 row01 row02 row03 row04 row05btnRunTestRun TestbtnClear Clear txtLogformCoinMPCoinMP TestSolver: Version:  Afiro Costx01x02x03x04x06x07x08x09x10x11x12x13x14x15x16x22x23x24x25x26x28x29x30x31x32x33x34x35x36x37x38x39r09r10x05x21r12r13x17x18x19x20r19r20x27x44r22r23x40x41x42x43x45x46x47x48x49x50x51 Bakery ProfitSun Moon P0033Obj c157 c158 c159 c160 c161 c162 c163 c164 c165 c166 c167 c168 c169 c170 c171 c172 c173 c174 c175 c176 c177 c178 c179 c180 c181 c182 c183 c184 c185 c186 c187 c188 c189 r114 r115 r116 r117 r118 r119 r120 r121 r122 r123 r124 r125 r126 r127 r128 *** ---------------------------------------------------------------#Problem Name: #Solution Result: #Solution Status: #Optimal Value:  () = status= Obj= <> Solve Problem: (obj=-CoinLoadProblem failed-CoinLoadInteger failed?Check Problem failed (result = .mpsECoinMPTestCS9.Properties.Resources' :«~K“ï+éc6ˆF·z\V4à‰D   !   (ÿÿÿÿ @€     %         !       #       !               %%8<@           %%     )- )   )  -   ) -$   (          &          > $          HHH1515515 u T €‘€•X\`dhl+         ptx;"            |€€€„.         €ˆ€Œ€7          )          °?_Õ :  €µ €¹ €Á €É   €Í €Õ €Ù €±  %D €”€˜€œ€ €¤€¨€¬'        1          €°€´€¸€¼€À€Ä)          %%€é    8 XKMicrosoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator9.0.0.0€õ€õ@3System.Resources.Tools.StronglyTypedResourceBuilder2.0.0.0€ý  1   CoinMPTestMaximal Software, Inc.-(Copyright © Maximal Software, Inc. 2009)$346a8329-bd15-4402-af8c-cac9d0c091f6 1.0.0.0TWrapNonExceptionThrowsWŒ›RoèªèŒRSDSŽ ê|#(K²“ËPtáó}E:\COIN\CoinMP\CoinMP_trunk17\CoinMP\examples\csharp\obj\x86\Release\CoinMPTestCS9.pdb€«ž« «_CorExeMainmscoree.dllÿ% @ €8€P€h€€ ÀDèÃêD4VS_VERSION_INFO½ïþ?DVarFileInfo$Translation°¤StringFileInfo€000004b0PCompanyNameMaximal Software, Inc.@ FileDescriptionCoinMPTest0FileVersion1.0.0.0DInternalNameCoinMPTestCS9.exet(LegalCopyrightCopyright © Maximal Software, Inc. 2009LOriginalFilenameCoinMPTestCS9.exe8 ProductNameCoinMPTest4ProductVersion1.0.0.08Assembly Version1.0.0.0   °;CoinMP-1.8.3/CoinMP/examples/csharp/bin/x64/0000755000175000017500000000000012600453454016733 5ustar renereneCoinMP-1.8.3/CoinMP/examples/csharp/bin/x64/Release/0000755000175000017500000000000012600453454020313 5ustar renereneCoinMP-1.8.3/CoinMP/examples/csharp/bin/x64/Release/CoinMPTestCS9.exe0000644000175000017500000011200012246707235023321 0ustar renereneMZÿÿ¸@€º´ Í!¸LÍ!This program cannot be run in DOS mode. $PEd†\Œ›Rð" Œ @ à@…@@ ÀØ̪ H.textW‹ Œ `.rsrcØÀŽ@@.relocà”@BH U¬U°Spð?ð?ð?ð?ð?ð?ð?ð?€„.A€„.A€„.A€„.A€„.A€„.A€„.A€„.ALLLLL,@T@I@I@I@ @ffffff@ð?@š™™™™™ñ?ð?Àffffff@ð¿ð?ð?333333ó¿ð¿ffffffþ?0Ÿrp    rp# %Ð:(    %Ð;(  &%Ð<(   %Ð=(   '%Ð>(  '%Ð?( '%Ð@(  %ÐA( (rp¢r!p¢r'p¢r-p¢r3p¢r9p¢r?p¢rEp¢(rKp¢rQp¢rWp¢r]p¢rcp¢ #†’$IùÌ5A      o‹*ÍÌÌÌÌÌì?ð?š™™™™™ñ?š™™™™™é?333333ã?333333ã?ð?ð?ð?0%’rip    r}p# %ÐB(    %ÐC(   #iWC¸žÇ¡  #ð?¡ '%ÐD(  '%ÐE( ' %ÐF( (rp¢r‡p¢rp¢(r“p¢'ž'  ž '!!ž!ž!# ×£p= ç?      o*$@iWC¸žGiWC¸žGiWC¸žGLGEÍÌÌÌÌÌ!@ÍÌÌÌÌÌ!@$@ð?ð¿ð?ð?ð?ð?0%–rp    r}p# #ð?¡#ð?¡ #ffffff@¡  %ÐG(  &%ÐH(   %ÐI(  '%ÐJ(  '%ÐK( '%ÐL(  %ÐM( (r¯p¢r³p¢r»p¢rÃp¢(rÇp¢rÑp¢rßp¢'#š™™™™™ñ?      o*iWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGEEEGGð?ÍÌÌÌÌÌô¿ÍÌÌÌÌÌô? ð?ð?ð?ð?@@ð?@@ð¿ð¿ð¿ð?ð?ð?0%rãp    r}p# #ð?¡#ð?¡ #iWC¸žÇ¡#iWC¸žÇ¡  %ÐN(  &%ÐO(   %ÐP(  '%ÐQ(  '%ÐR( '%ÐS(  %ÐT( (r÷p¢rýp¢rp¢rÃp¢r p¢rp¢rp¢(r)p¢r3p¢r=p¢rIp¢rYp¢'ž'ž'žž#      o*ð?@ð¿iWC¸žGffffff@iWC¸žGiWC¸žG@iWC¸žGiWC¸žG333333@@iWC¸žÇiWC¸žÇÍÌÌÌÌÌü?@iWC¸žGÍÌÌÌÌÌ@@@.@ @ffffff@ð?@š™™™™™ñ?ð?Àffffff@ð¿ð?ð?333333ó¿ð¿ffffffþ?CCBBCCCC0¿rkp    r}p# %ÐU(  #@¡#à?¡  %ÐV(   %ÐW(   %ÐX(   '%ÐY(  '%ÐZ( '%Ð[(  %Ð\( (ryp¢r…p¢r‘p¢rp¢r©p¢rµp¢rÁp¢rÍp¢(rÙp¢råp¢rñp¢rýp¢r p¢&%Ð]( #ŠBCy å @      oŒ*Z( ( s ( *z,{, {o ( *0s }s }s }( {O cs o {rpo {ns o! {o" {r+po# {o$ {þ s% o& {  cs o {r=po {os o! {o" {rOpo# {o$ {þ s% o& { s o {o' {r[po {o( { ± Es o! {o" "À@"PAs) (* (+  Í ‘s (, (- {o. (- {o. (- {o. rip( rpo# (/ (0 *0o(1 ds2 (r—p(&o3 (&(# {({r™p(4 ({r«pŒ (4 (*0C {{s„ ((((((((*2{(*:(5 }*:(5 }*{*"}*–{,{%o6 o7 (8 o# *ª{,!{%o6 o7 r¿p(9 o# *’{,{%o6 r¿p(8 o# *f{,{r—po# *n,%o6 o7 (8 o# *‚,%o6 o7 r¿p(9 o# *j,%o6 r¿p(8 o# *>, r—po# *š™™™™™Ù¿{®GázÔ¿333333㿸…ëQ¸Þ¿$@iWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGiWC¸žGEELLEELLLLEELLEELLLLLLLLLLLT@T@@@F@@@`s@Àr@  "$&(,.0248<@DFHJLNPRS       ð¿ö(\Âõð¿ð?Ý$•CÓ?ð?ð¿ð?ð¿ð?ð?ð¿ö(\Âõð¿ð?Ý$•CÓ?ð¿ö(\Âõð¿ð?Õxé&1Ô?𿸅ëQ¸î¿ð?Õxé&1Ô?ð¿…ëQ¸…ë¿ð?w¾Ÿ/ÝÔ?ð¿¶óýÔxé@ð¿J +‡@ð¿Ý$•C@ð¿;ßO—n@ffffffö?ð?ð?ð¿ð?ð?ð¿…ëQ¸…Û¿ð?•C‹lç»?ð?ð¿ð?ð¿ð?ð¿ð?ð?…ëQ¸…Û¿ð?ð?•C‹lç»?…ëQ¸…Û¿ð?ð?ÙÎ÷S㥻?ö(\ÂõØ¿ð?ð?ÙÎ÷S㥻?®Gáz®×¿ð?ð?1¬Zd»?ð¿ºI +‡@ð¿—nƒÀ@ð¿Ë¡E¶óý@ð¿¬Zd;@ffffffö?ð¿ð?ð¿ð?ð?ð?0c rÅp   S rÑp# %Ð^(    %Ð_(  &%Ð`(   %Ða(  !'%Ðb(   '%Ðc( S'%Ðd( S %Ðe(  (rÛp¢rãp¢rëp¢róp¢rûp¢rp¢r p¢rp¢rp¢ r#p¢ r+p¢ r3p¢ r;p¢ rCp¢rKp¢rSp¢r[p¢rcp¢rkp¢rsp¢r{p¢rƒp¢r‹p¢r“p¢r›p¢r£p¢r«p¢r³p¢r»p¢rÃp¢rËp¢rÓp¢(rÛp¢rãp¢rëp¢róp¢rûp¢rp¢r p¢rp¢rp¢ r#p¢ r+p¢ r3p¢ r;p¢ rCp¢rKp¢rSp¢r[p¢rcp¢rkp¢rsp¢r{p¢rƒp¢r‹p¢r“p¢r›p¢r£p¢r«p¢#@†ß }À      o‹*LLLà•@@¿@ˆ³@š™™™™™¹?ð?š™™™™™É?ð?0u r³p    rÁp#«ªªªªª`À #š™™™™™©?¡#{®Gáz´?¡   #€„.A¡#€„.A¡ &%Ðf(   %Ðg(  'žž 'žž'žž %Ðh( (rÏp¢r×p¢(rp¢r!p¢r'p¢#»«ªªª@      o‹*`e@`e@`e@`e@`d@@d@`d@@Q@@Q@àf@àf@àf@àf@€H@àf@ p@(€@@o@@@@o@@@àc@às@àc@às@àc@às@àc@às@€\@€l@àc@às@ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?ð?LLLLLLLLLLLLLLLð?ð?ð?ð?À¥@P¤ÀYÀ ŒÀà™ÀðtÀÀÀ@ÀàpÀ $&)-15678:<=>BFILPTWZ]`ab                   ð?ÀrÀÀrÀð?ÀrÀÀrÀð?Àr@ÀrÀÀrÀð?Àr@ÀrÀÀrÀð?Ðq@ÐqÀÐqÀÐqÀð?Ðq@ÐqÀÐqÀÐqÀð?ÐqÀð?p@pÀpÀpÀð?p@pÀpÀpÀð?ÀlÀð?ÀlÀÀlÀð?Àl@ÀlÀÀlÀð?Àl@ÀlÀÀlÀÀg@ÀgÀÀgÀÀgÀð?iÀyÀiÀiÀyÀyÀiÀyÀi@iÀiÀiÀy@yÀyÀyÀi@iÀiÀy@yÀyÀi@iÀiÀiÀy@yÀyÀyÀi@iÀiÀy@yÀyÀi@iÀiÀy@yÀyÀiÀyÀBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB0  ráp !  b ríp#! %Ði( !  ! %Ðj(  &%Ðk(   %Ðl(  "'%Ðm(  !'%Ðn( b'%Ðo( b %Ðp( !(rõp¢rÿp¢r p¢rp¢rp¢r'p¢r1p¢r;p¢rEp¢ rOp¢ rYp¢ rcp¢ rmp¢ rwp¢rp¢r‹p¢r•p¢rŸp¢r©p¢r³p¢r½p¢rÇp¢rÑp¢rÛp¢råp¢rïp¢rùp¢rp¢r p¢rp¢r!p¢r+p¢ r5p¢(r?p¢rIp¢rSp¢r]p¢rgp¢rqp¢r{p¢r…p¢rp¢ r™p¢ r£p¢ r­p¢ r·p¢ rÁp¢rËp¢!&%Ðq( #"¨@      o‹*0Q s: o; 1:šrÕp(8 o< & +šrÕp(8 o< &X o; 2Þo7 *.( (> *R((()*04     (((+*03     (((+*2(7(> *6(<(> *6(?(> *"(E*2(H(> *6(f(> *6(i(> *6(q(> *(5 *~(5 s }5s }6*~(5 s }5s }6*~(5 s }5s }6*2{5o*6{5o*2{6o*6{6o*b{6rÙp(8 o*0Æ{6rãpo(8 (G (I (K {5rcp(8 o{5r‡p(8 o{5r«pŒ'(4 o{5rÏp¢ Œ ¢róp¢Œ ¢rùp¢(? o{5rãpo(: (O&+A™#.+(={5rýp™Œ (@ oX2¹{5rãpo{5o,rpŒ'(4 (A &#.O Y(B #ü©ñÒMbP?7<  rp¢  Œ ¢ rp¢ Œ ¢ (? (A &*0${5o{5 r)p¢ ¢ rIp¢ Œ ¢ rùp¢ (? o{5rãpo('      (( (* ,{5rWpo,(/ ,{5r…po(6 , {5r³pŒ'rùp(@ oþ‰sv (B (F (S (Š(5 *01     (‹*0l{5o{5 r)p¢ ¢ rIp¢ Œ ¢ rùp¢ (? o{5rãpo('      (( (* ,{5rWpo,(/ ,{5r…po!1!"#$(0 1(1 1  (2 (6 , {5r³pŒ'rùp(@ oþ‰sv (B (F róp(8 (S (Š(5 *~7*Vs(D t€7*(E *(5 *03~8(G , rýpÐ(H oI sJ €8~8*~9*€9*´ÎÊムlSystem.Resources.ResourceReader, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSetPADPADP´´ÎÊムlSystem.Resources.ResourceReader, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSetPADPADP´BSJB v2.0.50727lä"#~P#ì #Strings aLf>xư øL L(>>2Ð >Ý > Œ Î ¹ $0 û$ûAû`ûyû’û­ûÈûáõûûL9s`o¯oÛ>'oB>}oŒ>’>É>0>û>7> JL> ›LÀ±Ü± L'> >L XLr± xL ¡L³ÐXv ŽL ™L«>Ì´êx 91 >6 >Z ûp °‰ °,7,H,X,i,€w,, Š, •,¢,°,½ÄÐ 5vß 5zì 5~ü,5‚ 7Ž+8‘â:•L‰r•Ήr•ÿ‰r•6‰r•g‰r•˜‰r•ɉr•‰r•G‰r•x‰r•щr•‰r•n‰r•ï‰r• ‰r•Q‰r•4‰r•z‰r•«‰r•݉r•‰r•A‰r•s‰r•á‰r•'‰r•l‰r•²‰r•ä‰r•‰r•Ñÿ! !%R%V€–RV€¨RV€¹RV€ÍRV€àRV€ñRV€RV€RV€-RV€=RV€LRV€\RV€lRV€}RV€ŽRV€ŸRV€±RV€ÄRV€×RV€çRV€øRV€ RV€RV€'RV€:RV€HRV€URV€fRV€wRV€ˆRV€–RV€ªRV€¾RV€ÔRV€èRV€ûRV€RV€#RV€8RV€LRV€`RV€wRV€‰RV€œRV€°RV€ÇRV€ÛR Ô Ôh u­ ƒÚ ‡i°µ°ë¾ÂSƄʵÎçÒ3d• ©½ÊíM2QFZ‹VŸÎ³¾ÇÂÛÊ Š=o”ƒ°—°«Â¿ÂÓÆçÊûÎÒ#Rxfx—}É‚û‡-Œ_‘‘–¥M¹ÍÊÿõõDúX”Šÿž‡Ð 3ø!–¥ $–¥ `&–¥ p)–¥ X-–¥ #/‘«:/ÄÜ\/äp1†"ì12);2C) H2†" W2†"0 f2†Z6 n2†e0 w2†p; 2†z;È2†„í2†Œ3–p@#3–z@D3–„G_3–ŒGp;–¥  ?–¥ DDDDIS^ipi{‡–Ÿ§²¾Ê × ã ï ÷  %1‡>JV‡^gV‡–Ÿ§²¾Ê × ã ï ÷  %1>JV‡–Ÿ§²¾Ê × ã ï ÷  %1^gV‡–Ÿ§²¾Ê × ã p y %1^gV‡‚‡‡˜£®º‡ÆÏÚâëôý‡‡",6‡AN[dlt| †  š‡‡‡‡‡{i‡‡‡¤‡¤‡¤¨i‡°‡°‡°´i‡¼‡Ë‡Ø‡è‡‡‡‡‡ïi‡‡‡‡‡ü=IU‡alw‚‡—‡¡ª‡¡·‡Å‡‡‡Ñ‡Ú‡å‡åÑîø‡å ‡å ‡åÚi‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ‡ÑÚi‡Ñ‡Ñ‡Ñi‡Ñ‡Ñ‡Ñ‡Ñ‡Ñ(‡Ñ‡Ñ‡Ñ2i‡Ñ2>èEEP>Y>è`jv`jvP>Y>è`š¤°`š¤°P>Ya >>¾Â‡{–ϧ²¾ Ê × ã ï ÷ %1^gÜ‚ç{–ϧ²¾ Ê × ã p y %1^gÜ‚ç{–ϧ²¾ Ê × ã ï ÷ %1^gÜ‚çÆÏÚâëôý !˜"£#®$ï>q"y"";‰";‘";™";¡";©";±";¹";Á"É";Ñ";Ù";á"¥ñ"«ù" "¥´I"QVQiûQ‹YÜÜ1"9"a£i"aÆaÓ;q"aáaê«a÷;y "a4#‰J9c*™"1¡‰7¡¯>ÁaâE±ïKaóa"I"«IRAV "a"g +gAkAqI"!G=IQB¹";Á~øANATɦ[Ù°cá"é÷à!"ñ" ! *ùH 0ùc 9a"?"LUZ U$_(d,i0n4s8x<}@_DdHiLnP‚T‡XŒ\‘`–dZh_lUp_tdx›|i€ „¥ˆªŒn_”d˜›œi  ¤¥¨ª¬n°¯´´¸¹¼¾ÀÃÄÈÈÍÌ‚ÐÒ.#l.+l.‹ü.Kl.ƒó.3r.;\.CŽ.\.[l.c¼.sæ.{S©[SÀ£_É[SC“_C‡c3_c“_c郓_@ ($ 8p  0!"<#x$%6&Ø'„(€)L*˜+,-ˆ.ˆ/0B1ÖRJ[™Ñ\b›ÃHhxG MMa M„ ~ › …†‡ˆŽ ’ “ ” k9;= ?LAyE‹G I¯K¿MÎOÞQðSÿW]A_Tadcueg’i¤k¶mÈoòsuw+yP}_†ƒ•…§‡½‰Ñ‹èü‘, •@ —W ™j ›~  Ÿ£ ¡¹ £Ï ¥ä §ñ ©ÿ « ­ ¯3 ±F ³[ µk ·} ¹” »¬ ½Â ¿Õ Áç à ŠÇ6 ÉT Ën Í  Ѳ Óä ×û Ù Û* Ý; ßL á^ ㊠çž éµ P : ;Ð <à =!>0!?P!@ˆ!A¨#BÀ#CØ#Dè#Eø#F°%GÐ%HØ%Ið%J&K&L0&M(N@(OP(Px(Q˜(R¸(Sø(Tˆ+UÈ+V,W0,XX,Y€,Z ,[Ø,\H-]p3^p4_p5`¨5a€6b7cˆ7dØ8eà>fè>g?h¨@i°Aj¸BkØBlPCmØCn`DoèEpøHq€Í5L>±ž ¸Ë     !"#$%&'()*+,-./01CoinMPTestCS9.exeProblemCoinTestCoinMPTestProblemGamsSos1aProblemSemiContProblemGamsSos2aProblemExMip1ProgramformCoinMPLogHandlerProblemAfiroProblemBakeryProblemP0033CoinMPCoin.CoinMPMsgLogDelegateIterDelegateMipNodeDelegateSolveProblemSettingsCoinMPTestCS9.PropertiesResourcesmscorlibSystemObjectSystem.Windows.FormsFormMulticastDelegateSystem.ConfigurationApplicationSettingsBaseSolveMainSystem.ComponentModelIContainercomponentsDisposeInitializeComponentButtonbtnRunTestbtnClearTextBoxtxtLog.ctorEventArgsbtnRunTest_ClickbtnClear_Click_txtLogget_txtLogset_txtLogWriteTextWriteLineNewLineEmptyTextSOLV_CALL_SUCCESSSOLV_CALL_FAILEDSOLV_METHOD_DEFAULTSOLV_METHOD_PRIMALSOLV_METHOD_DUALSOLV_METHOD_NETWORKSOLV_METHOD_BARRIERSOLV_METHOD_BENDERSSOLV_METHOD_DEQSOLV_METHOD_EVSOLV_FEATURE_LPSOLV_FEATURE_QPSOLV_FEATURE_QCPSOLV_FEATURE_NLPSOLV_FEATURE_MIPSOLV_FEATURE_MIQPSOLV_FEATURE_MIQCPSOLV_FEATURE_MINLPSOLV_FEATURE_SPSOLV_OBJSENS_MAXSOLV_OBJSENS_MINSOLV_FILE_LOGSOLV_FILE_BASISSOLV_FILE_MIPSTARTSOLV_FILE_MPSSOLV_FILE_LPSOLV_FILE_BINARYSOLV_FILE_OUTPUTSOLV_FILE_BINOUTSOLV_FILE_IISSOLV_CHECK_COLCOUNTSOLV_CHECK_ROWCOUNTSOLV_CHECK_RANGECOUNTSOLV_CHECK_OBJSENSESOLV_CHECK_ROWTYPESOLV_CHECK_MATBEGINSOLV_CHECK_MATCOUNTSOLV_CHECK_MATBEGCNTSOLV_CHECK_MATBEGNZSOLV_CHECK_MATINDEXSOLV_CHECK_MATINDEXROWSOLV_CHECK_BOUNDSSOLV_CHECK_COLTYPESOLV_CHECK_COLNAMESSOLV_CHECK_COLNAMESLENSOLV_CHECK_ROWNAMESSOLV_CHECK_ROWNAMSLENGenerateNamesBufCoinInitSolverCoinFreeSolverCoinGetSolverNameSystem.TextStringBuilderCoinGetSolverNameBufCoinGetVersionStrIntPtrCoinGetVersionStrCoinGetVersionStrBufCoinGetVersionCoinGetFeaturesCoinGetMethodsCoinGetInfinityCoinCreateProblemCoinLoadMatrixCoinLoadNamesBufCoinLoadNamesCoinLoadProblemBufCoinLoadProblemCoinLoadInitValuesCoinLoadIntegerCoinLoadPriorityCoinLoadSosCoinLoadSemiContCoinLoadQuadraticCoinLoadNonlinearCoinUnloadProblemCoinCheckProblemCoinGetProblemNameIntPtrCoinGetProblemNameCoinGetProblemNameBufCoinGetColCountCoinGetRowCountCoinGetColNameIntPtrCoinGetColNameCoinGetColNameBufCoinGetRowNameIntPtrCoinGetRowNameCoinGetRowNameBufCoinSetMsgLogCallbackCoinSetIterCallbackCoinSetMipNodeCallbackCoinOptimizeProblemCoinGetSolutionStatusCoinGetSolutionTextIntPtrCoinGetSolutionTextCoinGetSolutionTextBufCoinGetObjectValueCoinGetMipBestBoundCoinGetIterCountCoinGetMipNodeCountCoinGetSolutionValuesCoinGetSolutionRangesCoinGetSolutionBasisCoinReadFileCoinWriteFileCoinOpenLogFileCoinCloseLogFileCoinGetOptionCountCoinLocateOptionIDCoinLocateOptionNameCoinGetOptionIDCoinGetOptionInfoCoinGetIntOptionMinMaxCoinGetRealOptionMinMaxCoinGetOptionNamesBufCoinGetOptionGroupCoinGetOptionTypeCoinGetIntOptionDefaultValueCoinGetIntOptionMinValueCoinGetIntOptionMaxValueCoinGetRealOptionDefaultValueCoinGetRealOptionMinValueCoinGetRealOptionMaxValueCoinGetOptionNameIntPtrCoinGetOptionNameCoinGetOptionNameBufCoinGetOptionShortNameIntPtrCoinGetOptionShortNameCoinGetOptionShortNameBufCoinGetOptionChangedCoinGetIntOptionCoinSetIntOptionCoinGetRealOptionCoinSetRealOptionCoinGetStringOptionIntPtrCoinGetStringOptionCoinGetStringOptionBufCoinSetStringOptionInvokeIAsyncResultAsyncCallbackBeginInvokeEndInvokelogTxtlogMsgget_msgLogset_msgLogMsgLogCallbackGetAndCheckSolutionRunProblemRunProblemMipmsgLogdefaultInstanceget_DefaultDefaultSystem.ResourcesResourceManagerresourceManSystem.GlobalizationCultureInforesourceCultureget_ResourceManagerget_Cultureset_CultureCulturesolveProblemdisposingsenderevaluetextnamesListlicenseStrsolverNamebuflenversionStrproblemNamehProbcolCountrowCountnzCountrangeCountobjectSenseobjectConstobjectCoeffslowerBoundsupperBoundsrowTyperhsValuesrangeValuesmatrixBeginmatrixCountmatrixIndexmatrixValuescolNamesBufrowNamesBufobjNamecolNamesrowNamesrowLowerrowUpperinitValuescolumnTypepriorCountpriorIndexpriorValuesPriorBranchsosCountsosNZCountsosTypesosPriorsosBeginsosIndexsosRefsemiCountsemiIndexquadBeginquadCountquadIndexquadValuesnlpTreeCountnlpLineCountnlpBeginnlpOpernlpArg1nlpArg2nlpIndex1nlpIndex2nlpValue1nlpValue2colcolNamerowrowNamemsgLogDelegateiterDelegatemipNodeDelegatemethodsolutionTextactivitySystem.Runtime.InteropServicesInAttributeOutAttributereducedCostslackValuesshadowPriceobjLoRangeobjUpRangerhsLoRangerhsUpRangecolStatusrowStatusfileTypereadFilenamewriteFilenamelogFilenameoptionIDoptionNameoptionNrgroupTypeoptionTypeminValuemaxValueshortNameintValuerealValuestringValueobjectmessageStrcallbackresultiterCountobjectValueisFeasibleinfeasValuemipNodeCountbestBoundbestIntegerisMipImprovedmsgoptimalValuenonZeroCountobjectNamecolTypepriorBranchSystem.ReflectionAssemblyTitleAttributeAssemblyDescriptionAttributeAssemblyConfigurationAttributeAssemblyCompanyAttributeAssemblyProductAttributeAssemblyCopyrightAttributeAssemblyTrademarkAttributeAssemblyCultureAttributeComVisibleAttributeGuidAttributeAssemblyVersionAttributeAssemblyFileVersionAttributeSystem.DiagnosticsDebuggableAttributeDebuggingModesSystem.Runtime.CompilerServicesCompilationRelaxationsAttributeRuntimeCompatibilityAttributeCoinMPTestCS9Double{9BAC171A-2103-4BB4-A024-AA6EAD921C75}CompilerGeneratedAttributeValueType__StaticArrayInitTypeSize=64$$method0x6000001-1RuntimeHelpersArrayRuntimeFieldHandleInitializeArray$$method0x6000001-2Char__StaticArrayInitTypeSize=10$$method0x6000001-3__StaticArrayInitTypeSize=40$$method0x6000001-4Int32__StaticArrayInitTypeSize=36$$method0x6000001-5__StaticArrayInitTypeSize=32$$method0x6000001-6__StaticArrayInitTypeSize=56$$method0x6000001-7__StaticArrayInitTypeSize=112$$method0x6000001-8String__StaticArrayInitTypeSize=24$$method0x6000002-1$$method0x6000002-2__StaticArrayInitTypeSize=16$$method0x6000002-3__StaticArrayInitTypeSize=12$$method0x6000002-4$$method0x6000002-5$$method0x6000003-1__StaticArrayInitTypeSize=6$$method0x6000003-2$$method0x6000003-3__StaticArrayInitTypeSize=20$$method0x6000003-4$$method0x6000003-5$$method0x6000003-6__StaticArrayInitTypeSize=48$$method0x6000003-7$$method0x6000004-1$$method0x6000004-2$$method0x6000004-3$$method0x6000004-4__StaticArrayInitTypeSize=28$$method0x6000004-5__StaticArrayInitTypeSize=60$$method0x6000004-6__StaticArrayInitTypeSize=120$$method0x6000004-7$$method0x6000005-1$$method0x6000005-2$$method0x6000005-3$$method0x6000005-4$$method0x6000005-5$$method0x6000005-6$$method0x6000005-7$$method0x6000005-8$$method0x6000005-9STAThreadAttributeApplicationEnableVisualStylesSetCompatibleTextRenderingDefaultRunIDisposableControlSuspendLayoutSystem.DrawingPointset_Locationset_NameSizeset_Sizeset_TabIndexset_TextButtonBaseset_UseVisualStyleBackColorEventHandleradd_ClickTextBoxBaseset_MultilineScrollBarsset_ScrollBarsSizeFContainerControlset_AutoScaleDimensionsAutoScaleModeset_AutoScaleModeset_ClientSizeControlCollectionget_ControlsAddResumeLayoutPerformLayoutget_CapacityConcatget_TextToString__StaticArrayInitTypeSize=256$$method0x6000018-1$$method0x6000018-2__StaticArrayInitTypeSize=54$$method0x6000018-3__StaticArrayInitTypeSize=216$$method0x6000018-4__StaticArrayInitTypeSize=132$$method0x6000018-5__StaticArrayInitTypeSize=128$$method0x6000018-6__StaticArrayInitTypeSize=332$$method0x6000018-7__StaticArrayInitTypeSize=664$$method0x6000018-8$$method0x6000019-1$$method0x6000019-2$$method0x6000019-3__StaticArrayInitTypeSize=264$$method0x600001a-1$$method0x600001a-2__StaticArrayInitTypeSize=30$$method0x600001a-3$$method0x600001a-4__StaticArrayInitTypeSize=136$$method0x600001a-5$$method0x600001a-6__StaticArrayInitTypeSize=392$$method0x600001a-7__StaticArrayInitTypeSize=784$$method0x600001a-8__StaticArrayInitTypeSize=66$$method0x600001a-9GetLengthAppendDllImportAttributecoinmp.dllMarshalPtrToStringAnsiMessageBoxDialogResultShowMathAbsSystem.CodeDom.CompilerGeneratedCodeAttribute.cctorSettingsBaseSynchronizedDebuggerNonUserCodeAttributeReferenceEqualsTypeRuntimeTypeHandleGetTypeFromHandleAssemblyget_AssemblyEditorBrowsableAttributeEditorBrowsableStateCoinMPTestCS9.Properties.Resources.resourcesCoinMPTest.formCoinMP.resourcesCoinTestobjc1c2c3c4c5c6c7c8r1r2r3r4r5GamsSos1azx1x2x3 xsumSemiContspupplox bigx smallxfGamsSos2aw1w2w3fx fplus fminus wsum xdef fxdefgapplusgapminus Exmip1 col01 col02 col03 col04 col05 col06 col07 col08 row01 row02 row03 row04 row05btnRunTestRun TestbtnClear Clear txtLogformCoinMPCoinMP TestSolver: Version:  Afiro Costx01x02x03x04x06x07x08x09x10x11x12x13x14x15x16x22x23x24x25x26x28x29x30x31x32x33x34x35x36x37x38x39r09r10x05x21r12r13x17x18x19x20r19r20x27x44r22r23x40x41x42x43x45x46x47x48x49x50x51 Bakery ProfitSun Moon P0033Obj c157 c158 c159 c160 c161 c162 c163 c164 c165 c166 c167 c168 c169 c170 c171 c172 c173 c174 c175 c176 c177 c178 c179 c180 c181 c182 c183 c184 c185 c186 c187 c188 c189 r114 r115 r116 r117 r118 r119 r120 r121 r122 r123 r124 r125 r126 r127 r128 *** ---------------------------------------------------------------#Problem Name: #Solution Result: #Solution Status: #Optimal Value:  () = status= Obj= <> Solve Problem: (obj=-CoinLoadProblem failed-CoinLoadInteger failed?Check Problem failed (result = .mpsECoinMPTestCS9.Properties.Resources¬›!´K $ªn­’u·z\V4à‰D   !   (ÿÿÿÿ @€     %         !       #       !               %%8<@           %%     )- )   )  -   ) -$   (          &          > $          HHH1515515 u T €‘€•X\`dhl+         ptx;"            |€€€„.         €ˆ€Œ€7          )          °?_Õ :  €µ €¹ €Á €É   €Í €Õ €Ù €±  %D €”€˜€œ€ €¤€¨€¬'        1          €°€´€¸€¼€À€Ä)          %%€é    8 XKMicrosoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator9.0.0.0€õ€õ@3System.Resources.Tools.StronglyTypedResourceBuilder2.0.0.0€ý  1   CoinMPTestMaximal Software, Inc.-(Copyright © Maximal Software, Inc. 2009)$346a8329-bd15-4402-af8c-cac9d0c091f6 1.0.0.0TWrapNonExceptionThrows\Œ›RoèªèŒRSDSv%l”ÔïÐO¡w×nõ-ê„E:\COIN\CoinMP\CoinMP_trunk17\CoinMP\examples\csharp\obj\x64\Release\CoinMPTestCS9.pdb €8€P€h€€ ÀDèÃêD4VS_VERSION_INFO½ïþ?DVarFileInfo$Translation°¤StringFileInfo€000004b0PCompanyNameMaximal Software, Inc.@ FileDescriptionCoinMPTest0FileVersion1.0.0.0DInternalNameCoinMPTestCS9.exet(LegalCopyrightCopyright © Maximal Software, Inc. 2009LOriginalFilenameCoinMPTestCS9.exe8 ProductNameCoinMPTest4ProductVersion1.0.0.08Assembly Version1.0.0.0 CoinMP-1.8.3/CoinMP/examples/csharp/ProblemAfiro.cs0000644000175000017500000001034711207653002020450 0ustar renereneusing System.Windows.Forms; using Coin.CoinMP; namespace CoinMPTest { public static class ProblemAfiro { public static void Solve(SolveProblem solveProblem) { const int NUM_COLS = 32; const int NUM_ROWS = 27; const int NUM_NZ = 83; const int NUM_RNG = 0; const double DBL_MAX = 1e+037; string probname = "Afiro"; int ncol = NUM_COLS; int nrow = NUM_ROWS; int nels = NUM_NZ; int nrng = NUM_RNG; string objectname = "Cost"; int objsens = CoinMP.SOLV_OBJSENS_MIN; double objconst = 0.0; double[] dobj = new double[NUM_COLS] {0, -0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.32, 0, 0, 0, -0.6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.48, 0, 0, 10}; double[] dclo = new double[NUM_COLS] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; double[] dcup = new double[NUM_COLS] {DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX}; char[] rtyp = new char[NUM_ROWS] {'E', 'E', 'L', 'L', 'E', 'E', 'L', 'L', 'L', 'L', 'E', 'E', 'L', 'L', 'E', 'E', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L'}; double[] drhs = new double[NUM_ROWS] {0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 0, 0, 500, 0, 0, 44, 500, 0, 0, 0, 0, 0, 0, 0, 0, 310, 300}; int[] mbeg = new int[NUM_COLS+1] {0, 4, 6, 8, 10, 14, 18, 22, 26, 28, 30, 32, 34, 36, 38, 40, 44, 46, 48, 50, 52, 56, 60, 64, 68, 70, 72, 74, 76, 78, 80, 82, 83}; int[] mcnt = new int[NUM_COLS] {4, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1}; int[] midx = new int[NUM_NZ] {0, 1, 2, 23, 0, 3, 0, 21, 1, 25, 4, 5, 6, 24, 4, 5, 7, 24, 4, 5, 8, 24, 4, 5, 9, 24, 6, 20, 7, 20, 8, 20, 9, 20, 3, 4, 4, 22, 5, 26, 10, 11, 12, 21, 10, 13, 10, 23, 10, 20, 11, 25, 14, 15, 16, 22, 14, 15, 17, 22, 14, 15, 18, 22, 14, 15, 19, 22, 16, 20, 17, 20, 18, 20, 19, 20, 13, 15, 15, 24, 14, 26, 15}; double[] mval = new double[NUM_NZ] {-1, -1.06, 1, 0.301, 1, -1, 1, -1, 1, 1, -1, -1.06, 1, 0.301, -1, -1.06, 1, 0.313, -1, -0.96, 1, 0.313, -1, -0.86, 1, 0.326, -1, 2.364, -1, 2.386, -1, 2.408, -1, 2.429, 1.4, 1, 1, -1, 1, 1, -1, -0.43, 1, 0.109, 1, -1, 1, -1, 1, -1, 1, 1, -0.43, 1, 1, 0.109, -0.43, 1, 1, 0.108, -0.39, 1, 1, 0.108, -0.37, 1, 1, 0.107, -1, 2.191, -1, 2.219, -1, 2.249, -1, 2.279, 1.4, -1, 1, -1, 1, 1, 1}; string[] colNames = new string[NUM_COLS] {"x01", "x02", "x03", "x04", "x06", "x07", "x08", "x09", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x22", "x23", "x24", "x25", "x26", "x28", "x29", "x30", "x31", "x32", "x33", "x34", "x35", "x36", "x37", "x38", "x39"}; string[] rowNames = new string[NUM_ROWS] {"r09", "r10", "x05", "x21", "r12", "r13", "x17", "x18", "x19", "x20", "r19", "r20", "x27", "x44", "r22", "r23", "x40", "x41", "x42", "x43", "x45", "x46", "x47", "x48", "x49", "x50", "x51"}; double optimalValue = -464.753142857; solveProblem.RunProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, null, mbeg, mcnt, midx, mval, colNames, rowNames, objectname, null, null); } } } CoinMP-1.8.3/CoinMP/examples/csharp/CoinMPTestCS9.sln0000644000175000017500000000230512246722215020564 0ustar renerene Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoinMPTestCS9", "CoinMPTestCS9.csproj", "{7B683424-97BB-43AC-87B4-E05F798B5313}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7B683424-97BB-43AC-87B4-E05F798B5313}.Debug|x64.ActiveCfg = Debug|x64 {7B683424-97BB-43AC-87B4-E05F798B5313}.Debug|x64.Build.0 = Debug|x64 {7B683424-97BB-43AC-87B4-E05F798B5313}.Debug|x86.ActiveCfg = Debug|x86 {7B683424-97BB-43AC-87B4-E05F798B5313}.Debug|x86.Build.0 = Debug|x86 {7B683424-97BB-43AC-87B4-E05F798B5313}.Release|x64.ActiveCfg = Release|x64 {7B683424-97BB-43AC-87B4-E05F798B5313}.Release|x64.Build.0 = Release|x64 {7B683424-97BB-43AC-87B4-E05F798B5313}.Release|x86.ActiveCfg = Release|x86 {7B683424-97BB-43AC-87B4-E05F798B5313}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/CoinMP/examples/csharp/ProblemCoinTest.cs0000644000175000017500000000546311207653002021143 0ustar renereneusing System.Windows.Forms; using Coin.CoinMP; //************************************************************************* //* This problem is copied from coinutils\test\CoinPackedMatrixTest //* //* 3x1 + x2 - 2x4 - x5 - x8 //* 2x2 + 1.1x3 //* x3 + x6 //* 2.8x4 -1.2x7 //* 5.6x1 + x5 + 1.9x8 //* //************************************************************************* namespace CoinMPTest { public static class ProblemCoinTest { public static void Solve(SolveProblem solveProblem) { const int NUM_COLS = 8; const int NUM_ROWS = 5; const int NUM_NZ = 14; string problemName = "CoinTest"; int colCount = NUM_COLS; int rowCount = NUM_ROWS; int nonZeroCount = NUM_NZ; int rangeCount = 0; string objectName = "obj"; int objectSense = CoinMP.SOLV_OBJSENS_MAX; double objectConst = 0.0; double[] objectCoeffs = new double[NUM_COLS] { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; double[] lowerBounds = new double[NUM_COLS] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; double[] upperBounds = new double[NUM_COLS] { 1000000.0, 1000000.0, 1000000.0, 1000000.0, 1000000.0, 1000000.0, 1000000.0, 1000000.0 }; char[] rowType = new char[NUM_ROWS] { 'L', 'L', 'L', 'L', 'L' }; double[] rhsValues = new double[NUM_ROWS] { 14.0, 80.0, 50.0, 50.0, 50.0 }; int[] matrixBegin = new int[NUM_COLS+1] {0, 2, 4, 6, 8, 10, 11, 12, 14}; int[] matrixCount = new int[NUM_COLS] {2, 2, 2, 2, 2, 1, 1, 2}; int[] matrixIndex = new int[NUM_NZ] {0, 4, 0, 1, 1, 2, 0, 3, 0, 4, 2, 3, 0, 4}; double[] matrixValues = new double[NUM_NZ] {3.0, 5.6, 1.0, 2.0, 1.1, 1.0, -2.0, 2.8, -1.0, 1.0, 1.0, -1.2, -1.0, 1.9}; string[] colNames = new string[NUM_COLS] {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8"}; string[] rowNames = new string[NUM_ROWS] {"r1", "r2", "r3", "r4", "r5"}; double[] initValues = new double[NUM_COLS] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; double optimalValue = 1428729.2857143; solveProblem.RunProblem(problemName, optimalValue, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, null, matrixBegin, matrixCount, matrixIndex, matrixValues, colNames, rowNames, objectName, initValues, null); } } }CoinMP-1.8.3/CoinMP/examples/csharp/Coinmp.cs0000644000175000017500000004337112217000773017322 0ustar renereneusing System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace Coin.CoinMP { public class CoinMP { public const int SOLV_CALL_SUCCESS = 0; public const int SOLV_CALL_FAILED = -1; public const int SOLV_METHOD_DEFAULT = 0; public const int SOLV_METHOD_PRIMAL = 0x1; public const int SOLV_METHOD_DUAL = 0x2; public const int SOLV_METHOD_NETWORK = 0x4; public const int SOLV_METHOD_BARRIER = 0x8; public const int SOLV_METHOD_BENDERS = 0x100; public const int SOLV_METHOD_DEQ = 0x200; public const int SOLV_METHOD_EV = 0x400; public const int SOLV_FEATURE_LP = 0x1; public const int SOLV_FEATURE_QP = 0x2; public const int SOLV_FEATURE_QCP = 0x4; public const int SOLV_FEATURE_NLP = 0x8; public const int SOLV_FEATURE_MIP = 0x10; public const int SOLV_FEATURE_MIQP = 0x20; public const int SOLV_FEATURE_MIQCP = 0x40; public const int SOLV_FEATURE_MINLP = 0x80; public const int SOLV_FEATURE_SP = 0x10000; public const int SOLV_OBJSENS_MAX = -1; public const int SOLV_OBJSENS_MIN = 1; public const int SOLV_FILE_LOG = 0; public const int SOLV_FILE_BASIS = 1; public const int SOLV_FILE_MIPSTART = 2; public const int SOLV_FILE_MPS = 3; public const int SOLV_FILE_LP = 4; public const int SOLV_FILE_BINARY = 5; public const int SOLV_FILE_OUTPUT = 6; public const int SOLV_FILE_BINOUT = 7; public const int SOLV_FILE_IIS = 8; public const int SOLV_CHECK_COLCOUNT = 1; public const int SOLV_CHECK_ROWCOUNT = 2; public const int SOLV_CHECK_RANGECOUNT = 3; public const int SOLV_CHECK_OBJSENSE = 4; public const int SOLV_CHECK_ROWTYPE = 5; public const int SOLV_CHECK_MATBEGIN = 6; public const int SOLV_CHECK_MATCOUNT = 7; public const int SOLV_CHECK_MATBEGCNT = 8; public const int SOLV_CHECK_MATBEGNZ = 9; public const int SOLV_CHECK_MATINDEX = 10; public const int SOLV_CHECK_MATINDEXROW = 11; public const int SOLV_CHECK_BOUNDS = 12; public const int SOLV_CHECK_COLTYPE = 13; public const int SOLV_CHECK_COLNAMES = 14; public const int SOLV_CHECK_COLNAMESLEN = 15; public const int SOLV_CHECK_ROWNAMES = 16; public const int SOLV_CHECK_ROWNAMSLEN = 17; private static string GenerateNamesBuf(string[] namesList) { int i; StringBuilder namesBuf = new StringBuilder(); if (namesList.GetLength(0) > 0) { namesBuf.Append(namesList[0] + "\0"); for (i = 1; i < namesList.GetLength(0); i++) { namesBuf.Append(namesList[i] + "\0"); } } return namesBuf.ToString(); } public delegate int MsgLogDelegate(string messageStr); public delegate int IterDelegate(int iterCount, double objectValue, int isFeasible, double infeasValue); public delegate int MipNodeDelegate(int iterCount, int mipNodeCount, double bestBound, double bestInteger, int isMipImproved); [DllImport("coinmp.dll")] public static extern int CoinInitSolver(string licenseStr); [DllImport("coinmp.dll")] public static extern int CoinFreeSolver(); [DllImport("coinmp.dll")] public static extern string CoinGetSolverName(); [DllImport("coinmp.dll")] public static extern int CoinGetSolverNameBuf(StringBuilder solverName, int buflen); [DllImport("coinmp.dll", EntryPoint = "CoinGetVersionStr")] public static extern IntPtr CoinGetVersionStrIntPtr(); public static string CoinGetVersionStr() { return Marshal.PtrToStringAnsi(CoinGetVersionStrIntPtr()); } [DllImport("coinmp.dll")] public static extern int CoinGetVersionStrBuf(StringBuilder versionStr, int buflen); [DllImport("coinmp.dll")] public static extern double CoinGetVersion(); [DllImport("coinmp.dll")] public static extern int CoinGetFeatures(); [DllImport("coinmp.dll")] public static extern int CoinGetMethods(); [DllImport("coinmp.dll")] public static extern double CoinGetInfinity(); [DllImport("coinmp.dll")] public static extern IntPtr CoinCreateProblem(string problemName); [DllImport("coinmp.dll")] public static extern int CoinLoadMatrix(IntPtr hProb, int colCount, int rowCount, int nzCount, int rangeCount, int objectSense, double objectConst, double[] objectCoeffs, double[] lowerBounds, double[] upperBounds, char[] rowType, double[] rhsValues, double[] rangeValues, int[] matrixBegin, int[] matrixCount, int[] matrixIndex, double[] matrixValues); [DllImport("coinmp.dll")] public static extern int CoinLoadNamesBuf(IntPtr hProb, string colNamesBuf, string rowNamesBuf, string objName); public static int CoinLoadNames(IntPtr hProb, string[] colNames, string[] rowNames, string objName) { return CoinLoadNamesBuf(hProb, GenerateNamesBuf(colNames), GenerateNamesBuf(rowNames), objName); } [DllImport("coinmp.dll")] public static extern int CoinLoadProblemBuf(IntPtr hProb, int colCount, int rowCount, int nzCount, int rangeCount, int objectSense, double objectConst, double[] objectCoeffs, double[] lowerBounds, double[] upperBounds, char[] rowType, double[] rhsValues, double[] rangeValues, int[] matrixBegin, int[] matrixCount, int[] matrixIndex, double[] matrixValues, string colNamesBuf, string rowNamesBuf, string objName); public static int CoinLoadProblem(IntPtr hProb, int colCount, int rowCount, int nzCount, int rangeCount, int objectSense, double objectConst, double[] objectCoeffs, double[] lowerBounds, double[] upperBounds, char[] rowType, double[] rhsValues, double[] rangeValues, int[] matrixBegin, int[] matrixCount, int[] matrixIndex, double[] matrixValues, string[] colNames, string[] rowNames, string objName) { return CoinLoadProblemBuf(hProb, colCount, rowCount, nzCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues, GenerateNamesBuf(colNames), GenerateNamesBuf(rowNames), objName); } // when there is no rowType argument, CoinLoadProblem switches to rowLower and rowUpper arguments public static int CoinLoadProblem(IntPtr hProb, int colCount, int rowCount, int nzCount, int rangeCount, int objectSense, double objectConst, double[] objectCoeffs, double[] lowerBounds, double[] upperBounds, double[] rowLower, double[] rowUpper, int[] matrixBegin, int[] matrixCount, int[] matrixIndex, double[] matrixValues, string[] colNames, string[] rowNames, string objName) { return CoinLoadProblemBuf(hProb, colCount, rowCount, nzCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, null, rowLower, rowUpper, matrixBegin, matrixCount, matrixIndex, matrixValues, GenerateNamesBuf(colNames), GenerateNamesBuf(rowNames), objName); } [DllImport("coinmp.dll")] public static extern int CoinLoadInitValues(IntPtr hProb, double[] initValues); [DllImport("coinmp.dll")] public static extern int CoinLoadInteger(IntPtr hProb, char[] columnType); [DllImport("coinmp.dll")] public static extern int CoinLoadPriority(IntPtr hProb, int priorCount, int[] priorIndex, int[] priorValues, int[] PriorBranch); [DllImport("coinmp.dll")] public static extern int CoinLoadSos(IntPtr hProb, int sosCount, int sosNZCount, int[] sosType, int[] sosPrior, int[] sosBegin, int[] sosIndex, double[] sosRef); [DllImport("coinmp.dll")] public static extern int CoinLoadSemiCont(IntPtr hProb, int semiCount, int[] semiIndex); [DllImport("coinmp.dll")] public static extern int CoinLoadQuadratic(IntPtr hProb, int[] quadBegin, int[] quadCount, int[] quadIndex, double[] quadValues); [DllImport("coinmp.dll")] public static extern int CoinLoadNonlinear(IntPtr hProb, int nlpTreeCount, int nlpLineCount, int[] nlpBegin, int[] nlpOper, int[] nlpArg1, int[] nlpArg2, int[] nlpIndex1, int[] nlpIndex2, double[] nlpValue1, double[] nlpValue2); [DllImport("coinmp.dll")] public static extern int CoinUnloadProblem(IntPtr hProb); [DllImport("coinmp.dll")] public static extern int CoinCheckProblem(IntPtr hProb); [DllImport("coinmp.dll", EntryPoint = "CoinGetProblemName")] public static extern IntPtr CoinGetProblemNameIntPtr(IntPtr hProb); public static string CoinGetProblemName(IntPtr hProb) { return Marshal.PtrToStringAnsi(CoinGetProblemNameIntPtr(hProb)); } [DllImport("coinmp.dll")] public static extern int CoinGetProblemNameBuf(IntPtr hProb, StringBuilder problemName, int buflen); [DllImport("coinmp.dll")] public static extern int CoinGetColCount(IntPtr hProb); [DllImport("coinmp.dll")] public static extern int CoinGetRowCount(IntPtr hProb); [DllImport("coinmp.dll", EntryPoint = "CoinGetColName")] public static extern IntPtr CoinGetColNameIntPtr(IntPtr hProb, int col); public static string CoinGetColName(IntPtr hProb, int col) { return Marshal.PtrToStringAnsi(CoinGetColNameIntPtr(hProb, col)); } [DllImport("coinmp.dll")] public static extern int CoinGetColNameBuf(IntPtr hProb, int col, StringBuilder colName, int buflen); [DllImport("coinmp.dll", EntryPoint = "CoinGetRowName")] public static extern IntPtr CoinGetRowNameIntPtr(IntPtr hProb, int row); public static string CoinGetRowName(IntPtr hProb, int row) { return Marshal.PtrToStringAnsi(CoinGetRowNameIntPtr(hProb, row)); } [DllImport("coinmp.dll")] public static extern int CoinGetRowNameBuf(IntPtr hProb, int row, StringBuilder rowName, int buflen); [DllImport("coinmp.dll")] public static extern int CoinSetMsgLogCallback(IntPtr hProb, MsgLogDelegate msgLogDelegate); [DllImport("coinmp.dll")] public static extern int CoinSetIterCallback(IntPtr hProb, IterDelegate iterDelegate); [DllImport("coinmp.dll")] public static extern int CoinSetMipNodeCallback(IntPtr hProb, MipNodeDelegate mipNodeDelegate); [DllImport("coinmp.dll")] public static extern int CoinOptimizeProblem(IntPtr hProb, int method); public static int CoinOptimizeProblem(IntPtr hProb) { return CoinOptimizeProblem(hProb, SOLV_METHOD_DEFAULT); } [DllImport("coinmp.dll")] public static extern int CoinGetSolutionStatus(IntPtr hProb); [DllImport("coinmp.dll", EntryPoint = "CoinGetSolutionText")] public static extern IntPtr CoinGetSolutionTextIntPtr(IntPtr hProb); public static string CoinGetSolutionText(IntPtr hProb) { return Marshal.PtrToStringAnsi(CoinGetSolutionTextIntPtr(hProb)); } [DllImport("coinmp.dll")] public static extern int CoinGetSolutionTextBuf(IntPtr hProb, StringBuilder solutionText, int buflen); [DllImport("coinmp.dll")] public static extern double CoinGetObjectValue(IntPtr hProb); [DllImport("coinmp.dll")] public static extern double CoinGetMipBestBound(IntPtr hProb); [DllImport("coinmp.dll")] public static extern int CoinGetIterCount(IntPtr hProb); [DllImport("coinmp.dll")] public static extern int CoinGetMipNodeCount(IntPtr hProb); [DllImport("coinmp.dll")] public static extern int CoinGetSolutionValues(IntPtr hProb, [In, Out] double[] activity, [In, Out] double[] reducedCost, [In, Out] double[] slackValues, [In, Out] double[] shadowPrice); [DllImport("coinmp.dll")] public static extern int CoinGetSolutionRanges(IntPtr hProb, [In, Out] double[] objLoRange, [In, Out] double[] objUpRange, [In, Out] double[] rhsLoRange, [In, Out] double[] rhsUpRange); [DllImport("coinmp.dll")] public static extern int CoinGetSolutionBasis(IntPtr hProb, [In, Out] int[] colStatus, [In, Out] double[] rowStatus); [DllImport("coinmp.dll")] public static extern int CoinReadFile(IntPtr hProb, int fileType, string readFilename); [DllImport("coinmp.dll")] public static extern int CoinWriteFile(IntPtr hProb, int fileType, string writeFilename); [DllImport("coinmp.dll")] public static extern int CoinOpenLogFile(IntPtr hProb, string logFilename); [DllImport("coinmp.dll")] public static extern int CoinCloseLogFile(IntPtr hProb); [DllImport("coinmp.dll")] public static extern int CoinGetOptionCount(IntPtr hProb); [DllImport("coinmp.dll")] public static extern int CoinLocateOptionID(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern int CoinLocateOptionName(IntPtr hProb, string optionName); [DllImport("coinmp.dll")] public static extern int CoinGetOptionID(IntPtr hProb, int optionNr); [DllImport("coinmp.dll")] public static extern int CoinGetOptionInfo(IntPtr hProb, int optionNr, [In, Out] int[] optionID, [In, Out] int[] groupType, [In, Out] int[] optionType); [DllImport("coinmp.dll")] public static extern int CoinGetIntOptionMinMax(IntPtr hProb, int optionNr, [In, Out] int[] minValue, [In, Out] int[] maxValue); [DllImport("coinmp.dll")] public static extern int CoinGetRealOptionMinMax(IntPtr hProb, int optionNr, [In, Out] double[] minValue, [In, Out] double[] maxValue); [DllImport("coinmp.dll")] public static extern int CoinGetOptionNamesBuf(IntPtr hProb, int optionNr, StringBuilder optionName, StringBuilder shortName, int buflen); [DllImport("coinmp.dll")] public static extern int CoinGetOptionGroup(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern int CoinGetOptionType(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern int CoinGetIntOptionDefaultValue(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern int CoinGetIntOptionMinValue(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern int CoinGetIntOptionMaxValue(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern double CoinGetRealOptionDefaultValue(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern double CoinGetRealOptionMinValue(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern double CoinGetRealOptionMaxValue(IntPtr hProb, int optionID); [DllImport("coinmp.dll", EntryPoint = "CoinGetOptionName")] public static extern IntPtr CoinGetOptionNameIntPtr(IntPtr hProb, int optionID); public static string CoinGetOptionName(IntPtr hProb, int optionID) { return Marshal.PtrToStringAnsi(CoinGetOptionNameIntPtr(hProb, optionID)); } [DllImport("coinmp.dll")] public static extern int CoinGetOptionNameBuf(IntPtr hProb, int optionID, StringBuilder optionName, int buflen); [DllImport("coinmp.dll", EntryPoint = "CoinGetOptionShortName")] public static extern IntPtr CoinGetOptionShortNameIntPtr(IntPtr hProb, int optionID); public static string CoinGetOptionShortName(IntPtr hProb, int optionID) { return Marshal.PtrToStringAnsi(CoinGetOptionShortNameIntPtr(hProb, optionID)); } [DllImport("coinmp.dll")] public static extern int CoinGetOptionShortNameBuf(IntPtr hProb, int optionID, StringBuilder shortName, int buflen); [DllImport("coinmp.dll")] public static extern int CoinGetOptionChanged(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern int CoinGetIntOption(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern int CoinSetIntOption(IntPtr hProb, int optionID, int intValue); [DllImport("coinmp.dll")] public static extern int CoinGetRealOption(IntPtr hProb, int optionID); [DllImport("coinmp.dll")] public static extern int CoinSetRealOption(IntPtr hProb, int optionID, double realValue); [DllImport("coinmp.dll", EntryPoint = "CoinGetStringOption")] public static extern IntPtr CoinGetStringOptionIntPtr(IntPtr hProb, int optionID); public static string CoinGetStringOption(IntPtr hProb, int optionID) { return Marshal.PtrToStringAnsi(CoinGetStringOptionIntPtr(hProb, optionID)); } [DllImport("coinmp.dll")] public static extern int CoinGetStringOptionBuf(IntPtr hProb, int optionID, StringBuilder stringValue, int buflen); [DllImport("coinmp.dll")] public static extern int CoinSetStringOption(IntPtr hProb, int optionID, string stringValue); } } CoinMP-1.8.3/CoinMP/examples/csharp/Program.cs0000644000175000017500000000074211207653002017474 0ustar renereneusing System; using System.Collections.Generic; using System.Windows.Forms; namespace CoinMPTest { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new formCoinMP()); } } }CoinMP-1.8.3/CoinMP/examples/csharp/ProblemBakery.cs0000644000175000017500000000366711207653002020634 0ustar renereneusing System.Windows.Forms; using Coin.CoinMP; namespace CoinMPTest { public static class ProblemBakery { public static void Solve(SolveProblem solveProblem) { const int NUM_COLS = 2; const int NUM_ROWS = 3; const int NUM_NZ = 4; string problemName = "Bakery"; int colCount = NUM_COLS; int rowCount = NUM_ROWS; int nonZeroCount = NUM_NZ; int rangeCount = 0; string objectName = "Profit"; int objectSense = CoinMP.SOLV_OBJSENS_MAX; double objectConst = -4000.0 / 30.0; double[] objectCoeffs = new double[NUM_COLS] { 0.05, 0.08 }; double[] lowerBounds = new double[NUM_COLS] { 0.0, 0.0 }; double[] upperBounds = new double[NUM_COLS] { 1000000.0, 1000000.0 }; char[] rowType = new char[NUM_ROWS] { 'L', 'L', 'L' }; double[] rhsValues = new double[NUM_ROWS] { 1400, 8000, 5000 }; double[] rangeValues = new double[NUM_ROWS] { 0.0, 0.0, 0.0 }; int[] matrixBegin = new int[NUM_COLS + 1] { 0, 2, 4 }; int[] matrixCount = new int[NUM_COLS] { 2, 2 }; int[] matrixIndex = new int[NUM_NZ] { 0, 1, 0, 2 }; double[] matrixValues = new double[NUM_NZ] { 0.1, 1.0, 0.2, 1.0 }; string[] colNames = new string[NUM_COLS] { "Sun", "Moon" }; string[] rowNames = new string[NUM_ROWS] { "c1", "c2", "c3" }; double optimalValue = 506.66666667; solveProblem.RunProblem(problemName, optimalValue, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, null, matrixBegin, matrixCount, matrixIndex, matrixValues, colNames, rowNames, objectName, null, null); } } }CoinMP-1.8.3/CoinMP/examples/csharp/SolveProblem.cs0000644000175000017500000002173412217001165020501 0ustar renereneusing System; using System.Text; using System.Windows.Forms; using Coin.CoinMP; namespace CoinMPTest { public class SolveProblem { LogHandler logTxt = null; LogHandler logMsg = null; public SolveProblem() { logTxt = new LogHandler(null); logMsg = new LogHandler(null); } public SolveProblem(TextBox txtLog) { logTxt = new LogHandler(txtLog); logMsg = new LogHandler(null); } public SolveProblem(TextBox txtLog, TextBox msgLog) { logTxt = new LogHandler(txtLog); logMsg = new LogHandler(msgLog); } public TextBox txtLog { get { return logTxt.txtLog; } set { logTxt.txtLog = value; } } public TextBox msgLog { get { return logMsg.txtLog; } set { logMsg.txtLog = value; } } private int MsgLogCallback(string msg) { logMsg.WriteLine("*** " + msg); return 0; } public void GetAndCheckSolution(double optimalValue, IntPtr hProb) { logMsg.WriteLine("---------------------------------------------------------------"); String problemName = CoinMP.CoinGetProblemName(hProb); int solutionStatus = CoinMP.CoinGetSolutionStatus(hProb); String solutionText = CoinMP.CoinGetSolutionText(hProb); double objectValue = CoinMP.CoinGetObjectValue(hProb); logTxt.WriteLine("Problem Name: " + problemName); logTxt.WriteLine("Solution Result: " + solutionText); logTxt.WriteLine("Solution Status: " + solutionStatus); logTxt.WriteLine("Optimal Value: " + objectValue + " (" + optimalValue + ")"); logTxt.WriteLine("---------------------------------------------------------------"); int colCount = CoinMP.CoinGetColCount(hProb); double[] xValues = new double[colCount]; int result = CoinMP.CoinGetSolutionValues(hProb, xValues, null, null, null); for (int i = 0; i < colCount; i++) { if (xValues[i] != 0.0) { String colName = CoinMP.CoinGetColName(hProb, i); logTxt.WriteLine(colName + " = " + xValues[i]); } } logTxt.WriteLine("---------------------------------------------------------------"); logTxt.NewLine(); if (solutionStatus != 0) { MessageBox.Show("status="+solutionStatus, problemName); } if (optimalValue != 0.0) { if (Math.Abs(objectValue - optimalValue) >= 0.001) { MessageBox.Show("Obj=" + objectValue + " <> " + optimalValue, problemName); } } } public void RunProblem(string problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double[] objectCoeffs, double[] lowerBounds, double[] upperBounds, char[] rowType, double[] rhsValues, double[] rangeValues, int[] matrixBegin, int[] matrixCount, int[] matrixIndex, double[] matrixValues, string[] colNames, string[] rowNames, string objectName, double[] initValues, char[] colType) { logTxt.NewLine(); logTxt.WriteLine("Solve Problem: " + problemName + " (obj=" + optimalValue + ")"); logTxt.WriteLine("---------------------------------------------------------------"); IntPtr hProb = CoinMP.CoinCreateProblem(problemName); int result = CoinMP.CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues); result = CoinMP.CoinLoadNames(hProb, colNames, rowNames, objectName); if (result != 0) { logTxt.WriteLine("CoinLoadProblem failed"); } if (colType != null) { result = CoinMP.CoinLoadInteger(hProb, colType); if (result != 0) { logTxt.WriteLine("CoinLoadInteger failed"); } } result = CoinMP.CoinCheckProblem(hProb); if (result != 0) { logTxt.WriteLine("Check Problem failed (result = " + result + ")"); } CoinMP.MsgLogDelegate MsgLogDelegate = new CoinMP.MsgLogDelegate(MsgLogCallback); result = CoinMP.CoinSetMsgLogCallback(hProb, MsgLogDelegate); result = CoinMP.CoinOptimizeProblem(hProb); result = CoinMP.CoinWriteFile(hProb, CoinMP.SOLV_FILE_MPS, problemName); GetAndCheckSolution(optimalValue, hProb); result = CoinMP.CoinUnloadProblem(hProb); } public void RunProblem(string problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double[] objectCoeffs, double[] lowerBounds, double[] upperBounds, double[] rowLower, double[] rowUpper, int[] matrixBegin, int[] matrixCount, int[] matrixIndex, double[] matrixValues, string[] colNames, string[] rowNames, string objectName, double[] initValues, char[] colType) { RunProblem(problemName, optimalValue, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, null, rowLower, rowUpper, matrixBegin, matrixCount, matrixIndex, matrixValues, colNames, rowNames, objectName, initValues, colType); } public void RunProblemMip(string problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double[] objectCoeffs, double[] lowerBounds, double[] upperBounds, char[] rowType, double[] rhsValues, double[] rangeValues, int[] matrixBegin, int[] matrixCount, int[] matrixIndex, double[] matrixValues, string[] colNames, string[] rowNames, string objectName, double[] initValues, char[] colType, int sosCount, int sosNZCount, int[] sosType, int[] sosPrior, int[] sosBegin, int[] sosIndex, double[] sosRef, int semiCount, int[] semiIndex, int priorCount, int[] priorIndex, int[] priorValues, int[] priorBranch) { logTxt.NewLine(); logTxt.WriteLine("Solve Problem: " + problemName + " (obj=" + optimalValue + ")"); logTxt.WriteLine("---------------------------------------------------------------"); IntPtr hProb = CoinMP.CoinCreateProblem(problemName); int result = CoinMP.CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues); result = CoinMP.CoinLoadNames(hProb, colNames, rowNames, objectName); if (result != 0) { logTxt.WriteLine("CoinLoadProblem failed"); } if (colType != null) { result = CoinMP.CoinLoadInteger(hProb, colType); if (result != 0) { logTxt.WriteLine("CoinLoadInteger failed"); } } if (priorCount > 0) { result = CoinMP.CoinLoadPriority(hProb, priorCount, priorIndex, priorValues, priorBranch); } if (sosCount > 0) { result = CoinMP.CoinLoadSos(hProb, sosCount, sosNZCount, sosType, sosPrior, sosBegin, sosIndex, sosRef); } if (semiCount > 0) { result = CoinMP.CoinLoadSemiCont(hProb, semiCount, semiIndex); } result = CoinMP.CoinCheckProblem(hProb); if (result != 0) { logTxt.WriteLine("Check Problem failed (result = " + result + ")"); } CoinMP.MsgLogDelegate MsgLogDelegate = new CoinMP.MsgLogDelegate(MsgLogCallback); result = CoinMP.CoinSetMsgLogCallback(hProb, MsgLogDelegate); result = CoinMP.CoinOptimizeProblem(hProb); result = CoinMP.CoinWriteFile(hProb, CoinMP.SOLV_FILE_MPS, problemName + ".mps"); GetAndCheckSolution(optimalValue, hProb); result = CoinMP.CoinUnloadProblem(hProb); } } } CoinMP-1.8.3/CoinMP/examples/csharp/Form1.Designer.cs0000644000175000017500000000637611207653002020621 0ustar renerenenamespace CoinMPTest { partial class formCoinMP { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.btnRunTest = new System.Windows.Forms.Button(); this.btnClear = new System.Windows.Forms.Button(); this.txtLog = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // btnRunTest // this.btnRunTest.Location = new System.Drawing.Point(79, 355); this.btnRunTest.Name = "btnRunTest"; this.btnRunTest.Size = new System.Drawing.Size(110, 31); this.btnRunTest.TabIndex = 0; this.btnRunTest.Text = "Run Test"; this.btnRunTest.UseVisualStyleBackColor = true; this.btnRunTest.Click += new System.EventHandler(this.btnRunTest_Click); // // btnClear // this.btnClear.Location = new System.Drawing.Point(261, 355); this.btnClear.Name = "btnClear"; this.btnClear.Size = new System.Drawing.Size(111, 31); this.btnClear.TabIndex = 1; this.btnClear.Text = "Clear"; this.btnClear.UseVisualStyleBackColor = true; this.btnClear.Click += new System.EventHandler(this.btnClear_Click); // // txtLog // this.txtLog.Location = new System.Drawing.Point(14, 12); this.txtLog.Multiline = true; this.txtLog.Name = "txtLog"; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.txtLog.Size = new System.Drawing.Size(433, 325); this.txtLog.TabIndex = 2; // // formCoinMP // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(461, 401); this.Controls.Add(this.txtLog); this.Controls.Add(this.btnClear); this.Controls.Add(this.btnRunTest); this.Name = "formCoinMP"; this.Text = "CoinMP Test"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button btnRunTest; private System.Windows.Forms.Button btnClear; private System.Windows.Forms.TextBox txtLog; } } CoinMP-1.8.3/CoinMP/examples/csharp/LogHandler.cs0000644000175000017500000000351311207653002020103 0ustar renereneusing System.Windows.Forms; namespace CoinMPTest { public class LogHandler { TextBox _txtLog = null; public LogHandler() { _txtLog = null; } public LogHandler(TextBox txtLog) { _txtLog = txtLog; } public TextBox txtLog { get { return _txtLog; } set { _txtLog = value; } } public void WriteText(string text) { if (_txtLog != null) { _txtLog.Text += text.ToString(); } } public void WriteLine(string text) { if (_txtLog != null) { _txtLog.Text += text.ToString() + "\r\n"; } } public void NewLine() { if (_txtLog != null) { _txtLog.Text += "\r\n"; } } public void EmptyText() { if (_txtLog != null) { _txtLog.Text = ""; } } public static void WriteText(TextBox txtLog, string text) { if (txtLog != null) { txtLog.Text += text.ToString(); } } public static void WriteLine(TextBox txtLog, string text) { if (txtLog != null) { txtLog.Text += text.ToString() + "\r\n"; } } public static void NewLine(TextBox txtLog) { if (txtLog != null) { txtLog.Text += "\r\n"; } } public static void EmptyText(TextBox txtLog) { if (txtLog != null) { txtLog.Text = ""; } } } }CoinMP-1.8.3/CoinMP/examples/csharp/Properties/0000755000175000017500000000000012600453454017676 5ustar renereneCoinMP-1.8.3/CoinMP/examples/csharp/Properties/AssemblyInfo.cs0000644000175000017500000000244011207653002022611 0ustar renereneusing System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("CoinMPTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Maximal Software, Inc.")] [assembly: AssemblyProduct("CoinMPTest")] [assembly: AssemblyCopyright("Copyright © Maximal Software, Inc. 2009")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("346a8329-bd15-4402-af8c-cac9d0c091f6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] CoinMP-1.8.3/CoinMP/examples/csharp/Properties/Settings.settings0000644000175000017500000000037111207653002023252 0ustar renerene CoinMP-1.8.3/CoinMP/examples/csharp/Properties/Resources.Designer.cs0000644000175000017500000000544511207653002023737 0ustar renerene//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:2.0.50727.3082 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace CoinMPTestCS9.Properties { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CoinMPTestCS9.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } CoinMP-1.8.3/CoinMP/examples/csharp/Properties/Settings.Designer.cs0000644000175000017500000000210611207653002023554 0ustar renerene//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:2.0.50727.3082 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace CoinMPTestCS9.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } CoinMP-1.8.3/CoinMP/examples/csharp/Properties/Resources.resx0000644000175000017500000001275411207653002022555 0ustar renerene text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 CoinMP-1.8.3/CoinMP/examples/csharp/ProblemP0033.cs0000644000175000017500000001051611207653002020113 0ustar renereneusing System.Windows.Forms; using Coin.CoinMP; namespace CoinMPTest { public static class ProblemP0033 { public static void Solve(SolveProblem solveProblem) { const int NUM_COLS = 33; const int NUM_ROWS = 15; const int NUM_NZ = 98; const int NUM_RNG = 0; string probname = "P0033"; int ncol = NUM_COLS; int nrow = NUM_ROWS; int nels = NUM_NZ; int nrng = NUM_RNG; string objectname = "Obj"; int objsens = CoinMP.SOLV_OBJSENS_MIN; double objconst = 0.0; double[] dobj = new double[NUM_COLS] {171, 171, 171, 171, 163, 162, 163, 69, 69, 183, 183, 183, 183, 49, 183, 258, 517, 250, 500, 250, 500, 159, 318, 159, 318, 159, 318, 159, 318, 114, 228, 159, 318}; double[] dclo = new double[NUM_COLS] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; double[] dcup = new double[NUM_COLS] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; char[] rtyp = new char[NUM_ROWS] { 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L' }; double[] drhs = new double[NUM_ROWS] {1, 1, 1, 1, -5, 2700, -2600, -100, -900, -1656, -335, -1026, -5, -500, -270}; int[] mbeg = new int[NUM_COLS + 1] {0, 3, 6, 10, 14, 19, 24, 26, 31, 36, 38, 41, 45, 49, 53, 54, 55, 56, 58, 60, 61, 62, 66, 70, 73, 76, 80, 84, 87, 90, 93, 96, 97, 98}; int[] mcnt = new int[NUM_COLS] {3, 3, 4, 4, 5, 5, 2, 5, 5, 2, 3, 4, 4, 4, 1, 1, 1, 2, 2, 1, 1, 4, 4, 3, 3, 4, 4, 3, 3, 3, 3, 1, 1}; int[] midx = new int[NUM_NZ] {0, 8, 9, 0, 12, 13, 0, 5, 6, 9, 0, 5, 6, 7, 1, 5, 6, 10, 11, 1, 5, 6, 8, 9, 1, 14, 2, 5, 6, 10, 11, 2, 5, 6, 8, 9, 3, 4, 3, 10, 11, 3, 5, 6, 11, 3, 5, 6, 9, 5, 6, 8, 9, 3, 4, 4, 12, 13, 12, 13, 13, 13, 5, 6, 10, 11, 5, 6, 10, 11, 5, 6, 11, 5, 6, 11, 5, 6, 8, 9, 5, 6, 8, 9, 5, 6, 9, 5, 6, 9, 5, 6, 7, 5, 6, 7, 14, 14}; double[] mval = new double[NUM_NZ] {1, -300, -300, 1, -300, -300, 1, 300, -300, -300, 1, 300, -300, -300, 1, 285, -285, -285, -285, 1, 285, -285, -285, -285, 1, -285, 1, 265, -265, -265, -265, 1, 265, -265, -265, -265, 1, -230, 1, -230, -230, 1, 230, -230, -230, 1, 230, -230, -230, 190, -190, -190, -190, 1, -200, -400, -200, -200, -400, -400, -200, -400, 200, -200, -200, -200, 400, -400, -400, -400, 200, -200, -200, 400, -400, -400, 200, -200, -200, -200, 400, -400, -400, -400, 200, -200, -200, 400, -400, -400, 200, -200, -200, 400, -400, -400, -200, -400}; string[] colNames = new string[NUM_COLS] {"c157", "c158", "c159", "c160", "c161", "c162", "c163", "c164", "c165", "c166", "c167", "c168", "c169", "c170", "c171", "c172", "c173", "c174", "c175", "c176", "c177", "c178", "c179", "c180", "c181", "c182", "c183", "c184", "c185", "c186", "c187", "c188", "c189"}; string[] rowNames = new string[NUM_ROWS] {"r114", "r115", "r116", "r117", "r118", "r119", "r120", "r121", "r122", "r123", "r124", "r125", "r126", "r127", "r128"}; char[] ctyp = new char[NUM_COLS] { 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B' }; double optimalValue = 3089.0; solveProblem.RunProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, null, mbeg, mcnt, midx, mval, colNames, rowNames, objectname, null, ctyp); } } } CoinMP-1.8.3/CoinMP/examples/csharp/ProblemExMip1.cs0000644000175000017500000000440211207653002020506 0ustar renereneusing System.Windows.Forms; using Coin.CoinMP; // exmip1.mps in Mps/Sample namespace CoinMPTest { public static class ProblemExMip1 { public static void Solve(SolveProblem solveProblem) { const int NUM_COLS = 8; const int NUM_ROWS = 5; const int NUM_NZ = 14; const int NUM_RNG = 2; const double DBL_MAX = 1e37; string probname = "Exmip1"; int ncol = NUM_COLS; int nrow = NUM_ROWS; int nels = NUM_NZ; int nrng = NUM_RNG; string objectname = "z"; int objsens = CoinMP.SOLV_OBJSENS_MIN; double objconst = 0.0; double[] dobj = new double[NUM_COLS] {1, 0, 0, 0, 2, 0, 0, -1}; double[] dclo = new double[NUM_COLS] {2.5, 0, 0, 0, 0.5, 0, 0, 0}; double[] dcup = new double[NUM_COLS] {DBL_MAX, 4.1, DBL_MAX, DBL_MAX, 4, DBL_MAX, DBL_MAX, 4.3}; //char[] rtyp = new char[NUM_ROWS] {'G', 'L', 'E', 'R', 'R'}; //double[] drhs = new double[NUM_ROWS] {2.5, 2.1, 4, 1.8, 15}; //double[] drng = new double[NUM_ROWS] {0, 0, 0, -3.2, 12}; double[] drlo = {2.5, -DBL_MAX, -DBL_MAX, 1.8, 3.0}; double[] drup = {DBL_MAX, 2.1, 4.0, 5.0, 15.0}; int[] mbeg = new int[NUM_COLS+1] {0, 2, 4, 6, 8, 10, 11, 12, 14}; int[] mcnt = new int[NUM_COLS] {2, 2, 2, 2, 2, 1, 1, 2}; int[] midx = new int[NUM_NZ] {0, 4, 0, 1, 1, 2, 0, 3, 0, 4, 2, 3, 0, 4}; double[] mval = new double[NUM_NZ] {3, 5.6, 1, 2, 1.1, 1, -2, 2.8, -1, 1, 1, -1.2, -1, 1.9}; string[] colNames = new string[NUM_COLS] {"col01", "col02", "col03", "col04", "col05", "col06", "col07", "col08"}; string[] rowNames = new string[NUM_ROWS] {"row01", "row02", "row03", "row04", "row05"}; char[] ctyp = new char[NUM_COLS] { 'C', 'C', 'B', 'B', 'C', 'C', 'C', 'C' }; double optimalValue = 3.23684210526; solveProblem.RunProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, drlo, drup, mbeg, mcnt, midx, mval, colNames, rowNames, objectname, null, ctyp); } } } CoinMP-1.8.3/CoinMP/examples/csharp/Form1.cs0000644000175000017500000000306111300433154017044 0ustar renereneusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Coin.CoinMP; namespace CoinMPTest { public partial class formCoinMP : Form { public formCoinMP() { int result; int length; double version; StringBuilder solverName = new StringBuilder(100); InitializeComponent(); result = CoinMP.CoinInitSolver(""); length = CoinMP.CoinGetSolverNameBuf(solverName, solverName.Capacity); version = CoinMP.CoinGetVersion(); LogHandler.EmptyText(txtLog); LogHandler.WriteLine(txtLog, "Solver: " + solverName); LogHandler.WriteLine(txtLog, "Version: " + version); } private void btnRunTest_Click(object sender, EventArgs e) { SolveProblem solveProblem = new SolveProblem(txtLog, txtLog); ProblemBakery.Solve(solveProblem); ProblemCoinTest.Solve(solveProblem); ProblemAfiro.Solve(solveProblem); ProblemP0033.Solve(solveProblem); ProblemExMip1.Solve(solveProblem); ProblemGamsSos1a.Solve(solveProblem); ProblemGamsSos2a.Solve(solveProblem); ProblemSemiCont.Solve(solveProblem); } private void btnClear_Click(object sender, EventArgs e) { LogHandler.EmptyText(txtLog); } } } CoinMP-1.8.3/CoinMP/examples/csharp/CoinMPTestCS9.csproj0000644000175000017500000001112612246722215021271 0ustar renerene Debug AnyCPU 9.0.21022 2.0 {7B683424-97BB-43AC-87B4-E05F798B5313} WinExe Properties CoinMPTestCS9 CoinMPTestCS9 2.0 true bin\x86\Debug\ DEBUG;TRACE full x86 prompt bin\x86\Release\ TRACE true pdbonly x86 prompt true bin\x64\Debug\ DEBUG;TRACE full x64 prompt bin\x64\Release\ TRACE true pdbonly x64 prompt Form Form1.cs Designer Form1.cs ResXFileCodeGenerator Resources.Designer.cs Designer True Resources.resx True SettingsSingleFileGenerator Settings.Designer.cs True Settings.settings True CoinMP-1.8.3/CoinMP/examples/csharp/ProblemGamsSos2a.cs0000644000175000017500000000451711300433154021207 0ustar renereneusing System.Windows.Forms; using Coin.CoinMP; namespace CoinMPTest { public static class ProblemGamsSos2a { public static void Solve(SolveProblem solveProblem) { const int NUM_COLS = 7; const int NUM_ROWS = 5; const int NUM_NZ = 15; const int NUM_RNG = 0; const double DBL_MAX = 1e37; const int NUM_SOS = 1; const int NUM_SOSNZ = 3; string probname = "GamsSos2a"; int ncol = NUM_COLS; int nrow = NUM_ROWS; int nels = NUM_NZ; int nrng = NUM_RNG; string objectname = "z"; int objsens = CoinMP.SOLV_OBJSENS_MIN; double objconst = 0.0; double[] dobj = new double[NUM_COLS] {0, 0, 0, 0, 0, 1, 1}; double[] dclo = new double[NUM_COLS] {0.0, 0, 0, -DBL_MAX, -DBL_MAX, 0, 0}; double[] dcup = new double[NUM_COLS] {DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX}; char[] rtyp = new char[NUM_ROWS] {'E', 'E', 'E', 'G', 'G'}; double[] drhs = new double[NUM_ROWS] {1, 0, 0, -1.3, 1.3}; int[] mbeg = new int[NUM_COLS+1] {0, 3, 6, 9, 10, 13, 14, 15}; int[] mcnt = new int[NUM_COLS] {3, 3, 3, 1, 3, 1, 1}; int[] midx = new int[NUM_NZ] {0, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 3, 4, 3, 4}; double[] mval = new double[NUM_NZ] {1, 1, 1, 1, 2, 2, 1, 3, 3, -1, -1, -1, 1, 1, 1}; string[] colNames = new string[NUM_COLS] {"w1", "w2", "w3", "x", "fx", "fplus", "fminus"}; string[] rowNames = new string[NUM_ROWS] {"wsum", "xdef", "fxdef", "gapplus", "gapminus"}; int sosCount = 1; int sosNZCount = 3; int[] sosType = new int[NUM_SOS] {2}; int[] sosBegin = new int[NUM_SOS+1] {0, 3}; int[] sosIndex = new int[NUM_SOSNZ] {0, 1, 2}; double optimalValue = 0.0; solveProblem.RunProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, null, mbeg, mcnt, midx, mval, colNames, rowNames, objectname, null, null, sosCount, sosNZCount, sosType, null, sosBegin, sosIndex, null, 0, null, 0, null, null, null); } } } CoinMP-1.8.3/CoinMP/examples/csharp/Form1.resx0000644000175000017500000001326611207653002017432 0ustar renerene text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 CoinMP-1.8.3/CoinMP/examples/csharp/ProblemsSemiCont.cs0000644000175000017500000000362411300433154021312 0ustar renereneusing System.Windows.Forms; using Coin.CoinMP; namespace CoinMPTest { public static class ProblemSemiCont { public static void Solve(SolveProblem solveProblem) { const int NUM_COLS = 4; const int NUM_ROWS = 3; const int NUM_NZ = 6; const int NUM_RNG = 0; const double DBL_MAX = 1e37; const int NUM_SEMI = 1; string probname = "SemiCont"; int ncol = NUM_COLS; int nrow = NUM_ROWS; int nels = NUM_NZ; int nrng = NUM_RNG; string objectname = "z"; int objsens = CoinMP.SOLV_OBJSENS_MIN; double objconst = 0.0; double[] dobj = new double[NUM_COLS] {0.0, 1.0, 1.0, 0.0}; double[] dclo = new double[NUM_COLS] {2.8, 0.0, 0.0, 0.0}; double[] dcup = new double[NUM_COLS] {10.0, DBL_MAX, DBL_MAX, DBL_MAX}; char[] rtyp = new char[NUM_ROWS] {'L', 'G', 'E'}; double[] drhs = new double[NUM_ROWS] {8.9, 8.9, 10.0}; int[] mbeg = new int[NUM_COLS+1] {0, 1, 2, 3, 6}; int[] mcnt = new int[NUM_COLS] {1, 1, 1, 3}; int[] midx = new int[NUM_NZ] {2, 0, 1, 0, 1, 2}; double[] mval = new double[NUM_NZ] {1, -1, 1, 1, 1, 1}; string[] colNames = new string[NUM_COLS] {"s", "pup", "plo", "x"}; string[] rowNames = new string[NUM_ROWS] {"bigx", "smallx", "f"}; int semiCount = 1; int[] semiIndex = new int[NUM_SEMI] {0}; double optimalValue = 1.1; solveProblem.RunProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, null, mbeg, mcnt, midx, mval, colNames, rowNames, objectname, null, null, 0, 0, null, null, null, null, null, semiCount, semiIndex, 0, null, null, null); } } } CoinMP-1.8.3/CoinMP/examples/vb6/0000755000175000017500000000000012600453454014757 5ustar renereneCoinMP-1.8.3/CoinMP/examples/vb6/RunProblem.bas0000644000175000017500000000715611300432161017530 0ustar renereneAttribute VB_Name = "RunProblem" Option Explicit Const MAX_NAME_LEN As Long = 100 Private Function MsgLogCallback(ByVal MessageStr As String) As Long LogWriteLine MessageStr End Function Public Sub RunTestProblem(ByVal problemName As String, ByVal optimalValue As Double, _ ByVal colCount As Long, ByVal rowCount As Long, ByVal nonZeroCount As Long, _ ByVal rangeCount As Long, ByVal objectSense As Long, ByVal objectConst As Double, _ ByRef objectCoeffs As Double, ByRef lowerBounds As Double, ByRef upperBounds As Double, _ ByRef rowType As Byte, ByRef rhsValues As Double, ByRef rangeValues As Double, _ ByRef matrixBegin As Long, ByRef matrixCount As Long, ByRef matrixIndex As Long, _ ByRef matrixValues As Double, ByRef colNames() As String, ByRef rowNames() As String, _ ByVal objectName As String, ByRef InitValues As Double, ByRef colType As Byte) Dim hProb As Long Dim solutionStatus As Long Dim solutionText As String Dim objectValue As Double Dim activity() As Double Dim reduced() As Double Dim slack() As Double Dim shadow() As Double Dim colName As String Dim result As Long Dim length As Long Dim i As Integer Dim ch As String LogWriteLine "" LogWriteLine "Solve Problem: " & problemName & " (" & optimalValue & ")" hProb = CoinCreateProblem(problemName) result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, _ objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, _ rowType, rhsValues, rangeValues, matrixBegin, matrixCount, _ matrixIndex, matrixValues) If (result <> 0) Then LogWriteLine "CoinLoadMatrix failed" End If result = CoinLoadNames(hProb, colNames, rowNames, objectName) If (result <> 0) Then LogWriteLine "CoinLoadNames failed" End If If colType Then result = CoinLoadInteger(hProb, colType) If (result <> 0) Then LogWriteLine "CoinLoadInteger failed" End If End If result = CoinCheckProblem(hProb) If result <> 0 Then LogWriteLine "Check Problem failed (result = " & result & ")" End If 'result = CoinSetMsgLogCallback(hProb, AddressOf MsgLogCallback) result = CoinOptimizeProblem(hProb, 0) result = CoinWriteFile(hProb, SOLV_FILE_MPS, problemName + ".mps") problemName = CoinGetProblemName(hProb) solutionStatus = CoinGetSolutionStatus(hProb) solutionText = CoinGetSolutionText(hProb) objectValue = CoinGetObjectValue(hProb) LogWriteLine "---------------------------------------------------------------" LogWriteLine "Problem Name: " & problemName LogWriteLine "Solution Result: " & solutionText LogWriteLine "Solution Status: " & solutionStatus LogWriteLine "Optimal Value: " & objectValue & " (" & optimalValue & ")" LogWriteLine "---------------------------------------------------------------" colCount = CoinGetColCount(hProb) rowCount = CoinGetRowCount(hProb) ReDim activity(colCount) ReDim reduced(colCount) ReDim slack(rowCount) ReDim shadow(rowCount) result = CoinGetSolutionValues(hProb, activity(0), reduced(0), slack(0), shadow(0)) For i = 0 To colCount - 1 If activity(i) <> 0# Then colName = CoinGetColName(hProb, i) LogWriteLine colName & " = " & activity(i) End If Next i LogWriteLine "---------------------------------------------------------------" LogWriteLine "" result = CoinUnloadProblem(hProb) End Sub CoinMP-1.8.3/CoinMP/examples/vb6/SolveCoinTest.bas0000644000175000017500000001074511207660114020211 0ustar renereneAttribute VB_Name = "SolveCoinTest" Option Explicit '************************************************************************* '* This problem is copied from coinutils\test\CoinPackedMatrixTest '* '* 3x1 + x2 - 2x4 - x5 - x8 '* 2x2 + 1.1x3 '* x3 + x6 '* 2.8x4 -1.2x7 '* 5.6x1 + x5 + 1.9x8 '* '************************************************************************* Public Sub SolveProblemCoinTest() Const NUM_COLS As Long = 8 Const NUM_ROWS As Long = 5 Const NUM_NZ As Long = 14 Dim problemName As String Dim colCount As Long Dim rowCount As Long Dim nonZeroCount As Long Dim rangeCount As Long Dim objectName As String Dim objectSense As Long Dim objectConst As Double Dim objectCoeffs(NUM_COLS) As Double Dim lowerBounds(NUM_COLS) As Double Dim upperBounds(NUM_COLS) As Double Dim rowType(NUM_ROWS) As Byte Dim rhsValues(NUM_ROWS) As Double Dim rangeValues(NUM_ROWS) As Double Dim matrixBegin(NUM_COLS + 1) As Long Dim matrixCount(NUM_COLS) As Long Dim matrixIndex(NUM_NZ) As Long Dim matrixValues(NUM_NZ) As Double Dim colNames(NUM_COLS) As String Dim rowNames(NUM_ROWS) As String Dim colNamesBuf As String Dim rowNamesBuf As String Dim InitValues(NUM_COLS) As Double Dim colType(NUM_COLS) As Byte Dim optimalValue As Double problemName = "CoinTest" colCount = NUM_COLS rowCount = NUM_ROWS nonZeroCount = NUM_NZ rangeCount = 0 objectName = "obj" objectSense = SOLV_OBJSENS_MAX objectConst = 0# objectCoeffs(0) = 1# objectCoeffs(1) = 1# objectCoeffs(2) = 1# objectCoeffs(3) = 1# objectCoeffs(4) = 1# objectCoeffs(5) = 1# objectCoeffs(6) = 1# objectCoeffs(7) = 1# lowerBounds(0) = 0 lowerBounds(1) = 0 lowerBounds(2) = 0 lowerBounds(3) = 0 lowerBounds(4) = 0 lowerBounds(5) = 0 lowerBounds(6) = 0 lowerBounds(7) = 0 upperBounds(0) = 1000000 upperBounds(1) = 1000000 upperBounds(2) = 1000000 upperBounds(3) = 1000000 upperBounds(4) = 1000000 upperBounds(5) = 1000000 upperBounds(6) = 1000000 upperBounds(7) = 1000000 rowType(0) = Asc("L") rowType(1) = Asc("L") rowType(2) = Asc("L") rowType(3) = Asc("L") rowType(4) = Asc("L") rhsValues(0) = 14 rhsValues(1) = 80 rhsValues(2) = 50 rhsValues(3) = 50 rhsValues(4) = 50 matrixBegin(0) = 0 matrixBegin(1) = 2 matrixBegin(2) = 4 matrixBegin(3) = 6 matrixBegin(4) = 8 matrixBegin(5) = 10 matrixBegin(6) = 11 matrixBegin(7) = 12 matrixBegin(8) = 14 matrixCount(0) = 2 matrixCount(1) = 2 matrixCount(2) = 2 matrixCount(3) = 2 matrixCount(4) = 2 matrixCount(5) = 1 matrixCount(6) = 1 matrixCount(7) = 2 matrixIndex(0) = 0 matrixIndex(1) = 4 matrixIndex(2) = 0 matrixIndex(3) = 1 matrixIndex(4) = 1 matrixIndex(5) = 2 matrixIndex(6) = 0 matrixIndex(7) = 3 matrixIndex(8) = 0 matrixIndex(9) = 4 matrixIndex(10) = 2 matrixIndex(11) = 3 matrixIndex(12) = 0 matrixIndex(13) = 4 matrixValues(0) = 3 matrixValues(1) = 5.6 matrixValues(2) = 1 matrixValues(3) = 2 matrixValues(4) = 1.1 matrixValues(5) = 1 matrixValues(6) = -2 matrixValues(7) = 2.8 matrixValues(8) = -1 matrixValues(9) = 1 matrixValues(10) = 1 matrixValues(11) = -1.2 matrixValues(12) = -1 matrixValues(13) = 1.9 colNames(0) = "c1" colNames(1) = "c2" colNames(2) = "c3" colNames(3) = "c4" colNames(4) = "c5" colNames(5) = "c6" colNames(6) = "c7" colNames(7) = "c8" 'colNamesBuf = "c1" & vbNullChar & _ ' "c2" & vbNullChar & _ ' "c3" & vbNullChar & _ ' "c4" & vbNullChar & _ ' "c5" & vbNullChar & _ ' "c6" & vbNullChar & _ ' "c7" & vbNullChar & _ ' "c8" & vbNullChar rowNames(0) = "r1" rowNames(1) = "r2" rowNames(2) = "r3" rowNames(3) = "r4" rowNames(4) = "r5" 'rowNamesBuf = "r1" & vbNullChar & _ ' "r2" & vbNullChar & _ ' "r3" & vbNullChar & _ ' "r4" & vbNullChar & _ ' "r5" & vbNullChar colNamesBuf = CoinGenerateNamesBuf(colNames, NUM_COLS) rowNamesBuf = CoinGenerateNamesBuf(rowNames, NUM_ROWS) optimalValue = 1428729.2857143 RunTestProblem problemName, optimalValue, colCount, rowCount, _ nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs(0), _ lowerBounds(0), upperBounds(0), rowType(0), rhsValues(0), 0&, _ matrixBegin(0), matrixCount(0), matrixIndex(0), matrixValues(0), _ colNames, rowNames, objectName, 0&, 0& End Sub CoinMP-1.8.3/CoinMP/examples/vb6/SolveAfiro.bas0000644000175000017500000003153011207660114017514 0ustar renereneAttribute VB_Name = "SolveAfiro" Option Explicit Public Sub SolveProblemAfiro() Const NUM_COLS As Long = 32 Const NUM_ROWS As Long = 27 Const NUM_NZ As Long = 83 Const NUM_RNG As Long = 0 Dim problemName As String Dim colCount As Long Dim rowCount As Long Dim nonZeroCount As Long Dim rangeCount As Long Dim objectName As String Dim objectSense As Long Dim objectConst As Double Dim objectCoeffs(NUM_COLS) As Double Dim lowerBounds(NUM_COLS) As Double Dim upperBounds(NUM_COLS) As Double Dim rowType(NUM_ROWS) As Byte Dim rhsValues(NUM_ROWS) As Double Dim rangeValues(NUM_ROWS) As Double Dim matrixBegin(NUM_COLS + 1) As Long Dim matrixCount(NUM_COLS) As Long Dim matrixIndex(NUM_NZ) As Long Dim matrixValues(NUM_NZ) As Double Dim colNames(NUM_COLS) As String Dim rowNames(NUM_ROWS) As String Dim colNamesBuf As String Dim rowNamesBuf As String Dim InitValues(NUM_COLS) As Double Dim colType(NUM_COLS) As Byte Dim optimalValue As Double problemName = "Afiro" colCount = NUM_COLS rowCount = NUM_ROWS nonZeroCount = NUM_NZ rangeCount = NUM_RNG objectName = "Cost" objectSense = SOLV_OBJSENS_MIN objectConst = 0# objectCoeffs(0) = 0 objectCoeffs(1) = -0.4 objectCoeffs(2) = 0 objectCoeffs(3) = 0 objectCoeffs(4) = 0 objectCoeffs(5) = 0 objectCoeffs(6) = 0 objectCoeffs(7) = 0 objectCoeffs(8) = 0 objectCoeffs(9) = 0 objectCoeffs(10) = 0 objectCoeffs(11) = 0 objectCoeffs(12) = -0.32 objectCoeffs(13) = 0 objectCoeffs(14) = 0 objectCoeffs(15) = 0 objectCoeffs(16) = -0.6 objectCoeffs(17) = 0 objectCoeffs(18) = 0 objectCoeffs(19) = 0 objectCoeffs(20) = 0 objectCoeffs(21) = 0 objectCoeffs(22) = 0 objectCoeffs(23) = 0 objectCoeffs(24) = 0 objectCoeffs(25) = 0 objectCoeffs(26) = 0 objectCoeffs(27) = 0 objectCoeffs(28) = -0.48 objectCoeffs(29) = 0 objectCoeffs(30) = 0 objectCoeffs(31) = 10 lowerBounds(0) = 0 lowerBounds(1) = 0 lowerBounds(2) = 0 lowerBounds(3) = 0 lowerBounds(4) = 0 lowerBounds(5) = 0 lowerBounds(6) = 0 lowerBounds(7) = 0 lowerBounds(8) = 0 lowerBounds(9) = 0 lowerBounds(10) = 0 lowerBounds(11) = 0 lowerBounds(12) = 0 lowerBounds(13) = 0 lowerBounds(14) = 0 lowerBounds(15) = 0 lowerBounds(16) = 0 lowerBounds(17) = 0 lowerBounds(18) = 0 lowerBounds(19) = 0 lowerBounds(20) = 0 lowerBounds(21) = 0 lowerBounds(22) = 0 lowerBounds(23) = 0 lowerBounds(24) = 0 lowerBounds(25) = 0 lowerBounds(26) = 0 lowerBounds(27) = 0 lowerBounds(28) = 0 lowerBounds(29) = 0 lowerBounds(30) = 0 lowerBounds(31) = 0 upperBounds(0) = 1E+37 upperBounds(1) = 1E+37 upperBounds(2) = 1E+37 upperBounds(3) = 1E+37 upperBounds(4) = 1E+37 upperBounds(5) = 1E+37 upperBounds(6) = 1E+37 upperBounds(7) = 1E+37 upperBounds(8) = 1E+37 upperBounds(9) = 1E+37 upperBounds(10) = 1E+37 upperBounds(11) = 1E+37 upperBounds(12) = 1E+37 upperBounds(13) = 1E+37 upperBounds(14) = 1E+37 upperBounds(15) = 1E+37 upperBounds(16) = 1E+37 upperBounds(17) = 1E+37 upperBounds(18) = 1E+37 upperBounds(19) = 1E+37 upperBounds(20) = 1E+37 upperBounds(21) = 1E+37 upperBounds(22) = 1E+37 upperBounds(23) = 1E+37 upperBounds(24) = 1E+37 upperBounds(25) = 1E+37 upperBounds(26) = 1E+37 upperBounds(27) = 1E+37 upperBounds(28) = 1E+37 upperBounds(29) = 1E+37 upperBounds(30) = 1E+37 upperBounds(31) = 1E+37 rowType(0) = Asc("E") rowType(1) = Asc("E") rowType(2) = Asc("L") rowType(3) = Asc("L") rowType(4) = Asc("E") rowType(5) = Asc("E") rowType(6) = Asc("L") rowType(7) = Asc("L") rowType(8) = Asc("L") rowType(9) = Asc("L") rowType(10) = Asc("E") rowType(11) = Asc("E") rowType(12) = Asc("L") rowType(13) = Asc("L") rowType(14) = Asc("E") rowType(15) = Asc("E") rowType(16) = Asc("L") rowType(17) = Asc("L") rowType(18) = Asc("L") rowType(19) = Asc("L") rowType(20) = Asc("L") rowType(21) = Asc("L") rowType(22) = Asc("L") rowType(23) = Asc("L") rowType(24) = Asc("L") rowType(25) = Asc("L") rowType(26) = Asc("L") rhsValues(0) = 0 rhsValues(1) = 0 rhsValues(2) = 80 rhsValues(3) = 0 rhsValues(4) = 0 rhsValues(5) = 0 rhsValues(6) = 80 rhsValues(7) = 0 rhsValues(8) = 0 rhsValues(9) = 0 rhsValues(10) = 0 rhsValues(11) = 0 rhsValues(12) = 500 rhsValues(13) = 0 rhsValues(14) = 0 rhsValues(15) = 44 rhsValues(16) = 500 rhsValues(17) = 0 rhsValues(18) = 0 rhsValues(19) = 0 rhsValues(20) = 0 rhsValues(21) = 0 rhsValues(22) = 0 rhsValues(23) = 0 rhsValues(24) = 0 rhsValues(25) = 310 rhsValues(26) = 300 matrixBegin(0) = 0 matrixBegin(1) = 4 matrixBegin(2) = 6 matrixBegin(3) = 8 matrixBegin(4) = 10 matrixBegin(5) = 14 matrixBegin(6) = 18 matrixBegin(7) = 22 matrixBegin(8) = 26 matrixBegin(9) = 28 matrixBegin(10) = 30 matrixBegin(11) = 32 matrixBegin(12) = 34 matrixBegin(13) = 36 matrixBegin(14) = 38 matrixBegin(15) = 40 matrixBegin(16) = 44 matrixBegin(17) = 46 matrixBegin(18) = 48 matrixBegin(19) = 50 matrixBegin(20) = 52 matrixBegin(21) = 56 matrixBegin(22) = 60 matrixBegin(23) = 64 matrixBegin(24) = 68 matrixBegin(25) = 70 matrixBegin(26) = 72 matrixBegin(27) = 74 matrixBegin(28) = 76 matrixBegin(29) = 78 matrixBegin(30) = 80 matrixBegin(31) = 82 matrixBegin(32) = 83 matrixCount(0) = 4 matrixCount(1) = 2 matrixCount(2) = 2 matrixCount(3) = 2 matrixCount(4) = 4 matrixCount(5) = 4 matrixCount(6) = 4 matrixCount(7) = 4 matrixCount(8) = 2 matrixCount(9) = 2 matrixCount(10) = 2 matrixCount(11) = 2 matrixCount(12) = 2 matrixCount(13) = 2 matrixCount(14) = 2 matrixCount(15) = 4 matrixCount(16) = 2 matrixCount(17) = 2 matrixCount(18) = 2 matrixCount(19) = 2 matrixCount(20) = 4 matrixCount(21) = 4 matrixCount(22) = 4 matrixCount(23) = 4 matrixCount(24) = 2 matrixCount(25) = 2 matrixCount(26) = 2 matrixCount(27) = 2 matrixCount(28) = 2 matrixCount(29) = 2 matrixCount(30) = 2 matrixCount(31) = 1 matrixIndex(0) = 0 matrixIndex(1) = 1 matrixIndex(2) = 2 matrixIndex(3) = 23 matrixIndex(4) = 0 matrixIndex(5) = 3 matrixIndex(6) = 0 matrixIndex(7) = 21 matrixIndex(8) = 1 matrixIndex(9) = 25 matrixIndex(10) = 4 matrixIndex(11) = 5 matrixIndex(12) = 6 matrixIndex(13) = 24 matrixIndex(14) = 4 matrixIndex(15) = 5 matrixIndex(16) = 7 matrixIndex(17) = 24 matrixIndex(18) = 4 matrixIndex(19) = 5 matrixIndex(20) = 8 matrixIndex(21) = 24 matrixIndex(22) = 4 matrixIndex(23) = 5 matrixIndex(24) = 9 matrixIndex(25) = 24 matrixIndex(26) = 6 matrixIndex(27) = 20 matrixIndex(28) = 7 matrixIndex(29) = 20 matrixIndex(30) = 8 matrixIndex(31) = 20 matrixIndex(32) = 9 matrixIndex(33) = 20 matrixIndex(34) = 3 matrixIndex(35) = 4 matrixIndex(36) = 4 matrixIndex(37) = 22 matrixIndex(38) = 5 matrixIndex(39) = 26 matrixIndex(40) = 10 matrixIndex(41) = 11 matrixIndex(42) = 12 matrixIndex(43) = 21 matrixIndex(44) = 10 matrixIndex(45) = 13 matrixIndex(46) = 10 matrixIndex(47) = 23 matrixIndex(48) = 10 matrixIndex(49) = 20 matrixIndex(50) = 11 matrixIndex(51) = 25 matrixIndex(52) = 14 matrixIndex(53) = 15 matrixIndex(54) = 16 matrixIndex(55) = 22 matrixIndex(56) = 14 matrixIndex(57) = 15 matrixIndex(58) = 17 matrixIndex(59) = 22 matrixIndex(60) = 14 matrixIndex(61) = 15 matrixIndex(62) = 18 matrixIndex(63) = 22 matrixIndex(64) = 14 matrixIndex(65) = 15 matrixIndex(66) = 19 matrixIndex(67) = 22 matrixIndex(68) = 16 matrixIndex(69) = 20 matrixIndex(70) = 17 matrixIndex(71) = 20 matrixIndex(72) = 18 matrixIndex(73) = 20 matrixIndex(74) = 19 matrixIndex(75) = 20 matrixIndex(76) = 13 matrixIndex(77) = 15 matrixIndex(78) = 15 matrixIndex(79) = 24 matrixIndex(80) = 14 matrixIndex(81) = 26 matrixIndex(82) = 15 matrixValues(0) = -1 matrixValues(1) = -1.06 matrixValues(2) = 1 matrixValues(3) = 0.301 matrixValues(4) = 1 matrixValues(5) = -1 matrixValues(6) = 1 matrixValues(7) = -1 matrixValues(8) = 1 matrixValues(9) = 1 matrixValues(10) = -1 matrixValues(11) = -1.06 matrixValues(12) = 1 matrixValues(13) = 0.301 matrixValues(14) = -1 matrixValues(15) = -1.06 matrixValues(16) = 1 matrixValues(17) = 0.313 matrixValues(18) = -1 matrixValues(19) = -0.96 matrixValues(20) = 1 matrixValues(21) = 0.313 matrixValues(22) = -1 matrixValues(23) = -0.86 matrixValues(24) = 1 matrixValues(25) = 0.326 matrixValues(26) = -1 matrixValues(27) = 2.364 matrixValues(28) = -1 matrixValues(29) = 2.386 matrixValues(30) = -1 matrixValues(31) = 2.408 matrixValues(32) = -1 matrixValues(33) = 2.429 matrixValues(34) = 1.4 matrixValues(35) = 1 matrixValues(36) = 1 matrixValues(37) = -1 matrixValues(38) = 1 matrixValues(39) = 1 matrixValues(40) = -1 matrixValues(41) = -0.43 matrixValues(42) = 1 matrixValues(43) = 0.109 matrixValues(44) = 1 matrixValues(45) = -1 matrixValues(46) = 1 matrixValues(47) = -1 matrixValues(48) = 1 matrixValues(49) = -1 matrixValues(50) = 1 matrixValues(51) = 1 matrixValues(52) = -0.43 matrixValues(53) = 1 matrixValues(54) = 1 matrixValues(55) = 0.109 matrixValues(56) = -0.43 matrixValues(57) = 1 matrixValues(58) = 1 matrixValues(59) = 0.108 matrixValues(60) = -0.39 matrixValues(61) = 1 matrixValues(62) = 1 matrixValues(63) = 0.108 matrixValues(64) = -0.37 matrixValues(65) = 1 matrixValues(66) = 1 matrixValues(67) = 0.107 matrixValues(68) = -1 matrixValues(69) = 2.191 matrixValues(70) = -1 matrixValues(71) = 2.219 matrixValues(72) = -1 matrixValues(73) = 2.249 matrixValues(74) = -1 matrixValues(75) = 2.279 matrixValues(76) = 1.4 matrixValues(77) = -1 matrixValues(78) = 1 matrixValues(79) = -1 matrixValues(80) = 1 matrixValues(81) = 1 matrixValues(82) = 1 colNames(0) = "x01" colNames(1) = "x02" colNames(2) = "x03" colNames(3) = "x04" colNames(4) = "x06" colNames(5) = "x07" colNames(6) = "x08" colNames(7) = "x09" colNames(8) = "x10" colNames(9) = "x11" colNames(10) = "x12" colNames(11) = "x13" colNames(12) = "x14" colNames(13) = "x15" colNames(14) = "x16" colNames(15) = "x22" colNames(16) = "x23" colNames(17) = "x24" colNames(18) = "x25" colNames(19) = "x26" colNames(20) = "x28" colNames(21) = "x29" colNames(22) = "x30" colNames(23) = "x31" colNames(24) = "x32" colNames(25) = "x33" colNames(26) = "x34" colNames(27) = "x35" colNames(28) = "x36" colNames(29) = "x37" colNames(30) = "x38" colNames(31) = "x39" 'colNamesBuf = "x01" & vbNullChar & "x02" & vbNullChar & _ ' "x03" & vbNullChar & "x04" & vbNullChar & _ ' "x06" & vbNullChar & "x07" & vbNullChar & _ ' "x08" & vbNullChar & "x09" & vbNullChar & _ ' "x10" & vbNullChar & "x11" & vbNullChar & _ ' "x12" & vbNullChar & "x13" & vbNullChar & _ ' "x14" & vbNullChar & "x15" & vbNullChar & _ ' "x16" & vbNullChar & _ ' "x22" & vbNullChar & "x23" & vbNullChar & _ ' "x24" & vbNullChar & "x25" & vbNullChar & _ ' "x26" & vbNullChar & _ ' "x28" & vbNullChar & "x29" & vbNullChar & _ ' "x30" & vbNullChar & "x31" & vbNullChar & _ ' "x32" & vbNullChar & "x33" & vbNullChar & _ ' "x34" & vbNullChar & "x35" & vbNullChar & _ ' "x36" & vbNullChar & "x37" & vbNullChar & _ ' "x38" & vbNullChar & "x39" & vbNullChar rowNames(0) = "r09" rowNames(1) = "r10" rowNames(2) = "x05" rowNames(3) = "x21" rowNames(4) = "r12" rowNames(5) = "r13" rowNames(6) = "x17" rowNames(7) = "x18" rowNames(8) = "x19" rowNames(9) = "x20" rowNames(10) = "r19" rowNames(11) = "r20" rowNames(12) = "x27" rowNames(13) = "x44" rowNames(14) = "r22" rowNames(15) = "r23" rowNames(16) = "x40" rowNames(17) = "x41" rowNames(18) = "x42" rowNames(19) = "x43" rowNames(20) = "x45" rowNames(21) = "x46" rowNames(22) = "x47" rowNames(23) = "x48" rowNames(24) = "x49" rowNames(25) = "x50" rowNames(26) = "x51" 'rowNamesBuf = "r09" & vbNullChar & "r10" & vbNullChar & _ ' "x05" & vbNullChar & "x21" & vbNullChar & _ ' "r12" & vbNullChar & "r13" & vbNullChar & _ ' "x17" & vbNullChar & "x18" & vbNullChar & _ ' "x19" & vbNullChar & "x20" & vbNullChar & _ ' "r19" & vbNullChar & "r20" & vbNullChar & _ ' "x27" & vbNullChar & "x44" & vbNullChar & _ ' "r22" & vbNullChar & "r23" & vbNullChar & _ ' "x40" & vbNullChar & "x41" & vbNullChar & _ ' "x42" & vbNullChar & "x43" & vbNullChar & _ ' "x45" & vbNullChar & "x46" & vbNullChar & _ ' "x47" & vbNullChar & "x48" & vbNullChar & _ ' "x49" & vbNullChar & "x50" & vbNullChar & _ ' "x51" & vbNullChar colNamesBuf = CoinGenerateNamesBuf(colNames, NUM_COLS) rowNamesBuf = CoinGenerateNamesBuf(rowNames, NUM_ROWS) optimalValue = -464.753142857 RunTestProblem problemName, optimalValue, colCount, rowCount, _ nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs(0), _ lowerBounds(0), upperBounds(0), rowType(0), rhsValues(0), 0&, _ matrixBegin(0), matrixCount(0), matrixIndex(0), matrixValues(0), _ colNames, rowNames, objectName, 0&, 0& End Sub CoinMP-1.8.3/CoinMP/examples/vb6/FrmCoinMP.frm0000644000175000017500000000417711210165302017254 0ustar renereneVERSION 5.00 Begin VB.Form frmCoinMP Caption = "CoinMP Test" ClientHeight = 6720 ClientLeft = 60 ClientTop = 450 ClientWidth = 7485 LinkTopic = "Form1" ScaleHeight = 6720 ScaleWidth = 7485 StartUpPosition = 3 'Windows Default Begin VB.TextBox txt Height = 5535 Left = 240 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 2 Top = 240 Width = 6975 End Begin VB.CommandButton cmdClear Caption = "Clear" Height = 495 Left = 4200 TabIndex = 1 Top = 6000 Width = 1335 End Begin VB.CommandButton cmdRunTest Caption = "Run Test" Height = 495 Left = 1560 TabIndex = 0 Top = 6000 Width = 1335 End End Attribute VB_Name = "frmCoinMP" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Const MAX_NAME_LEN As Long = 100 Private Sub cmdClear_Click() LogEmptyText End Sub Private Sub cmdRunTest_Click() Call SolveProblemBakery Call SolveProblemCoinTest Call SolveProblemAfiro Call SolveProblemP0033 Call SolveProblemExMip1 End Sub Private Sub Form_Load() Dim result As Long Dim length As Long Dim solverName As String Dim version As Double result = CoinInitSolver("") solverName = String(MAX_NAME_LEN, vbNullChar) length = CoinGetSolverNameBuf(solverName, MAX_NAME_LEN) solverName = Left(solverName, length) version = CoinGetVersion() LogEmptyText LogWriteLine "Solver: " & solverName LogWriteLine "Version: " & version End Sub Private Sub Form_Unload(Cancel As Integer) Dim result As Long result = CoinFreeSolver() LogWriteLine "All unit tests completed successfully" End Sub CoinMP-1.8.3/CoinMP/examples/vb6/CoinMPTestVB6.exe0000644000175000017500000017000012246064556017772 0ustar renereneMZÿÿ¸@Ⱥ´ Í!¸LÍ!This program cannot be run in DOS mode. $×6¤É“WÊš“WÊš“WÊšKÄš’WÊšÜuÚšWÊš¥qÇš’WÊšRich“WÊšPEL¢c˜Rà À0ðÐ@Oœ”Æ(ð 8 ø.textl»À `.dataDÐÐ@À.rsrc ðà@@lÚ[JMSVBVM60.DLL†“£rù £r7¢r1h¤r)¢rbr¤rº£rß¡r·p¢rA £rvj¢r:àrt¢¡rn£rþÁ¡rñŸ¡r£r£rrêb£rt› rÄ¡r®Æ¡r¢rý ”rö £r ár›¢r‡› rÜ¢r“•£r…š rò¢rßG¢r¿ r‰£rº£rM¢ru¤r+”£rgè r7¢¡r:£r:£rJl¢rl¢rn£r©ý¢r¤5”rÙÆ¡r×£”röm¤r­m¢rÀ’£r0l¢ríî¢rD–£rüÆ¡rÝ¢r¯Ÿ¡rìk¢r;K@¿K@”M@ÀM@œM@bN@iN@ðO@×O@€Q@XQ@äR@¸R@HT@T@¤U@xU@>@@¯ÀçZ@µ]@š^@sg@1g@333333ó¿|p@š™™™™™ Àð¿Ÿ{@@†ß }À®Gáz®×¿ö(\ÂõØ¿…ëQ¸…Û¿…ëQ¸…뿸…ëQ¸î¿ö(\Âõ𿸅ëQ¸Þ¿333333ã¿{®GázÔ¿š™™™™™Ù¿.Ÿ@'Å@ÿ%L@ÿ%„@ÿ%˜@ÿ%@@ÿ%4@ÿ%¨@ÿ%@ÿ%¼@ÿ%D@ÿ%¸@ÿ%¬@ÿ%@ÿ%d@ÿ%Œ@ÿ%$@ÿ%@ÿ%Ô@ÿ%@ÿ%è@ÿ%œ@ÿ%H@ÿ%x@ÿ%à@ÿ%Ü@ÿ%`@ÿ%°@ÿ%´@ÿ%l@ÿ%(@ÿ% @ÿ%Ð@ÿ%ˆ@ÿ%@ÿ%Ì@ÿ%”@ÿ%@ÿ%Ø@ÿ%ð@ÿ%,@ÿ%È@ÿ% @ÿ%T@ÿ%8@ÿ%€@ÿ% @ÿ%t@ÿ%X@ÿ%ì@ÿ%@ÿ%0@ÿ%¤@ÿ%<@ÿ%\@ÿ%ä@ÿ%Ä@ÿ%h@ÿ%@ÿ%|@ÿ%P@ÿ%p@ÿ%À@h4@èîÿÿÿ0@#4`’‡1±F£Ø þ´_Ü®prjCoinMPÿÌ1 ¯ªOBIŽã­z¾g{Õr]"J‰ý¿d´º:O­3™fÏ· ª`Ó“ÁH frmCoinMP  CoinMP TestB#ÿÿÿÿ$Form15<Â=@Fÿtxtðð?Ÿÿÿ'cmdClearClearhp7ïÿ, cmdRunTestRun Testp7ïÿ  @ÿÿÿÿÿÿÿÿ„!@Ð@ÍS”@  @ÿÿÿÿÿÿÿÿT!@,Ð@P¹›Ì@  @ÿÿÿÿÿÿÿÿä!@<Ð@pZS@  @ÿÿÿÿÿÿÿÿD"@LÐ@Xº›<@  @ÿÿÿÿÿÿÿÿt"@\Ð@ ZSt@  @ÿÿÿÿÿÿÿÿ"@lÐ@[S¬@  @ÿÿÿÿÿÿÿÿ´!@ŒÐ@0[Sä@P ¯ªOBIŽã­z¾g{@@LVB5!6&*~ <@ð0ÿÿÿéä@\@ü@x†”•CoinMPTestVB6CoinMPTestVB6prjCoinMP  @ÿÿÿÿÿÿÿÿ$!@|Ð@D @ @ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRÐ8@„8@48@è7@œ7@h7@7@Ì6@x6@(6@Ô5@\5@5@°4@\4@4@Ä3@x3@(3@Ø2@ˆ2@<2@ô1@¤1@X1@ 1@À0@x0@,0@ä/@”/@D/@ô.@¨.@\.@.@Ä-@t-@$-@Ø,@„,@8,@è+@œ+@P+@+@À*@p*@$*@Ø)@Œ)@@)@ä(@ (@T(@ (@À'@t'@'@Ô&@ˆ&@@&@ø%@°%@P%@%@°$@h$@ô  @àJ@Æ@<Ð@†@Ð@@D  @LJ@ÿÿÿÿô @Ð@ÀÌSð@D#@ð@ø@ô@ø@·hl˜@0Ù@@UnT#@d#@@4t#@¨@4n„#@@8ì#@ÿÿÿÿ@ 4n$@ÿÿÿÿ@<$@˜@04nü#@@@t#@ @4n$@t @ @Ž @› @ø@x@Ö@Ü@â@l @ @x@Ö@Ü@â@† @“ @H@x@Ö@Ü@â@p@x@Ö@Ü@â@y @l$3éw*l$?éÚ*l$7éM+l$7éP-¬Ð@ŒJ@ÿÿÿÿœÐ@A¶]}ªNÎ@ ãÀWTôÇé ô @¸"@  x@ÿÿÿÿ$$@Ä"@¤"@ÿÿƒ€Ô@ÿÿÿÿ0$@„Ð@Ð"@Pÿÿ€”@ÿÿÿÿ0$@4Ð@Ü"@ÿÿ€\@ÿÿÿÿ0$@$Ð@è"@ÿÿ€¬@ÿÿÿÿ0$@”Ð@ô"@ÿÿ€Ì@ÿÿÿÿ0$@DÐ@#@ÿÿ€t@ÿÿÿÿ0$@tÐ@#@ÿÿ€@ÿÿÿÿ0$@TÐ@#@ÿÿ€<@ÿÿÿÿ0$@dÐ@(#@ÿÿ€prjCoinMPfrmCoinMPLibCoinMPSolveBakeryLogWriteRunProblemSolveCoinTestSolveExMip1SolveAfiroSolveP0033Õr]"J‰ý¿d´º-–®¹µJ–þ˜˜ ¯ªOBIŽã­z¾g{%;A ¶BW‘†›¨åòN­3™fÏ· ª`Ó“cmdClear.=ûüú h§8+3qµC:\Apps\MSVStudio6\VB98\VB6.OLBVB#@  #@À#@ðÕ@˜+R:O­3™fÏ· ª`Ó“txtFormâN­3™fÏ· ª`Ó“cmdRunTest L  CoinMP.dllCoinInitSolverH$@X$@ôÕ@¡üÕ@ Àtÿàhh$@¸@ÿÐÿàCoinFreeSolverH$@ $@Ö@¡Ö@ Àtÿàh°$@¸@ÿÐÿàCoinGetSolverNameBufH$@è$@ Ö@¡Ö@ Àtÿàh%@¸@ÿÐÿàCoinGetVersionStrBufH$@8%@Ö@¡ Ö@ ÀtÿàhP%@¸@ÿÐÿàCoinGetVersionCoinGetOptionTypeH$@ˆ%@$Ö@¡,Ö@ Àtÿàh°%@¸@ÿÐÿàCoinGetFeaturesH$@è%@0Ö@¡8Ö@ Àtÿàhø%@¸@ÿÐÿàCoinGetMethodsH$@0&@<Ö@¡DÖ@ Àtÿàh@&@¸@ÿÐÿàCoinGetInfinityH$@x&@HÖ@¡PÖ@ Àtÿàhˆ&@¸@ÿÐÿàCoinCreateProblemH$@À&@TÖ@¡\Ö@ ÀtÿàhÔ&@¸@ÿÐÿàCoinLoadMatrixH$@ '@`Ö@¡hÖ@ Àtÿàh'@¸@ÿÐÿàCoinLoadNamesBufx09H$@T'@lÖ@¡tÖ@ Àtÿàht'@¸@ÿÐÿàCoinLoadProblemBufH$@¬'@xÖ@¡€Ö@ ÀtÿàhÀ'@¸@ÿÐÿàCoinLoadInitValuesH$@ø'@„Ö@¡ŒÖ@ Àtÿàh (@¸@ÿÐÿàCoinLoadIntegerH$@D(@Ö@¡˜Ö@ ÀtÿàhT(@¸@ÿÐÿàCoinLoadPriorityH$@Œ(@œÖ@¡¤Ö@ Àtÿàh (@¸@ÿÐÿà CoinLoadSosH$@Ø(@¨Ö@¡°Ö@ Àtÿàhä(@¸@ÿÐÿàCoinLoadSemiContx08H$@)@´Ö@¡¼Ö@ Àtÿàh@)@¸@ÿÐÿàCoinLoadQuadraticH$@x)@ÀÖ@¡ÈÖ@ ÀtÿàhŒ)@¸@ÿÐÿàCoinLoadNonlinearH$@Ä)@ÌÖ@¡ÔÖ@ ÀtÿàhØ)@¸@ÿÐÿàCoinUnloadProblemH$@*@ØÖ@¡àÖ@ Àtÿàh$*@¸@ÿÐÿàCoinCheckProblemH$@\*@äÖ@¡ìÖ@ Àtÿàhp*@¸@ÿÐÿàCoinGetProblemNameBufH$@¨*@ðÖ@¡øÖ@ ÀtÿàhÀ*@¸@ÿÐÿàCoinGetColCountH$@ø*@üÖ@¡×@ Àtÿàh+@¸@ÿÐÿàCoinGetRowCountH$@@+@×@¡×@ ÀtÿàhP+@¸@ÿÐÿàCoinGetColNameBufH$@ˆ+@×@¡×@ Àtÿàhœ+@¸@ÿÐÿàCoinGetRowNameBufH$@Ô+@ ×@¡(×@ Àtÿàhè+@¸@ÿÐÿàCoinSetMsgLogCallbackH$@ ,@,×@¡4×@ Àtÿàh8,@¸@ÿÐÿàCoinSetIterCallbackH$@p,@8×@¡@×@ Àtÿàh„,@¸@ÿÐÿàCoinSetMipNodeCallbackH$@¼,@D×@¡L×@ ÀtÿàhØ,@¸@ÿÐÿàCoinOptimizeProblemH$@-@P×@¡X×@ Àtÿàh$-@¸@ÿÐÿàCoinGetSolutionStatusH$@\-@\×@¡d×@ Àtÿàht-@¸@ÿÐÿàCoinGetSolutionTextBufH$@¬-@h×@¡p×@ ÀtÿàhÄ-@¸@ÿÐÿàCoinGetObjectValueH$@ü-@t×@¡|×@ Àtÿàh.@¸@ÿÐÿàCoinGetMipBestBoundH$@H.@€×@¡ˆ×@ Àtÿàh\.@¸@ÿÐÿàCoinGetIterCountH$@”.@Œ×@¡”×@ Àtÿàh¨.@¸@ÿÐÿàCoinGetMipNodeCountH$@à.@˜×@¡ ×@ Àtÿàhô.@¸@ÿÐÿàCoinGetSolutionValuesH$@,/@¤×@¡¬×@ ÀtÿàhD/@¸@ÿÐÿàCoinGetSolutionRangesH$@|/@°×@¡¸×@ Àtÿàh”/@¸@ÿÐÿàCoinGetSolutionBasisH$@Ì/@¼×@¡Ä×@ Àtÿàhä/@¸@ÿÐÿà CoinReadFileH$@0@È×@¡Ð×@ Àtÿàh,0@¸@ÿÐÿàCoinWriteFileH$@d0@Ô×@¡Ü×@ Àtÿàhx0@¸@ÿÐÿàCoinOpenLogFileH$@°0@à×@¡è×@ ÀtÿàhÀ0@¸@ÿÐÿàCoinCloseLogFileH$@ø0@ì×@¡ô×@ Àtÿàh 1@¸@ÿÐÿàCoinGetOptionCountH$@D1@ø×@¡Ø@ ÀtÿàhX1@¸@ÿÐÿàCoinLocateOptionIDH$@1@Ø@¡ Ø@ Àtÿàh¤1@¸@ÿÐÿàCoinLocateOptionNameH$@Ü1@Ø@¡Ø@ Àtÿàhô1@¸@ÿÐÿàCoinGetOptionIDH$@,2@Ø@¡$Ø@ Àtÿàh<2@¸@ÿÐÿàCoinGetOptionInfoH$@t2@(Ø@¡0Ø@ Àtÿàhˆ2@¸@ÿÐÿàCoinGetIntOptionMinMaxH$@À2@4Ø@¡<Ø@ ÀtÿàhØ2@¸@ÿÐÿàCoinGetRealOptionMinMaxH$@3@@Ø@¡HØ@ Àtÿàh(3@¸@ÿÐÿàCoinGetOptionNamesBufH$@`3@LØ@¡TØ@ Àtÿàhx3@¸@ÿÐÿàCoinGetOptionGroupH$@°3@XØ@¡`Ø@ ÀtÿàhÄ3@¸@ÿÐÿàx07H$@œ%@dØ@¡lØ@ Àtÿàh4@¸@ÿÐÿàCoinGetIntOptionDefaultValueH$@<4@pØ@¡xØ@ Àtÿàh\4@¸@ÿÐÿàCoinGetIntOptionMaxValueH$@”4@|Ø@¡„Ø@ Àtÿàh°4@¸@ÿÐÿàCoinGetIntOptionMinValueH$@è4@ˆØ@¡Ø@ Àtÿàh5@¸@ÿÐÿàCoinGetRealOptionDefaultValueH$@<5@”Ø@¡œØ@ Àtÿàh\5@¸@ÿÐÿàCoinGetRealOptionMaxValueCoinSetIntOptionx06H$@”5@ Ø@¡¨Ø@ ÀtÿàhÔ5@¸@ÿÐÿàCoinGetRealOptionMinValueH$@ 6@¬Ø@¡´Ø@ Àtÿàh(6@¸@ÿÐÿàCoinGetOptionNameBufH$@`6@¸Ø@¡ÀØ@ Àtÿàhx6@¸@ÿÐÿàCoinGetOptionShortNameBufH$@°6@ÄØ@¡ÌØ@ ÀtÿàhÌ6@¸@ÿÐÿàCoinGetOptionChangedH$@7@ÐØ@¡ØØ@ Àtÿàh7@¸@ÿÐÿàCoinGetIntOptionH$@T7@ÜØ@¡äØ@ Àtÿàhh7@¸@ÿÐÿàH$@´5@èØ@¡ðØ@ Àtÿàhœ7@¸@ÿÐÿàCoinGetRealOptionH$@Ô7@ôØ@¡üØ@ Àtÿàhè7@¸@ÿÐÿàCoinSetRealOptionH$@ 8@Ù@¡Ù@ Àtÿàh48@¸@ÿÐÿàCoinGetStringOptionBufH$@l8@ Ù@¡Ù@ Àtÿàh„8@¸@ÿÐÿàCoinSetStringOptionH$@¼8@Ù@¡ Ù@ ÀtÿàhÐ8@¸@ÿÐÿàSolver: Version: ’JAll unit tests completed successfullyVBA6.DLL__vbaStrCopy__vbaFreeStrList__vbaStrR8__vbaStrCat__vbaFreeVar__vbaFreeStrc3__vbaStrToUnicode__vbaFreeVarList__vbaVarDup__vbaStrVarMove__vbaStrMovex04__vbaSetSystemError__vbaStrToAnsi__vbaErrorOverflow__vbaGenerateBoundsError Bakery ProfitLSunMoonc1c2’’’’’’’’’__vbaAryDestruct__vbaUI1I4__vbaUI1I2__vbaAryConstruct2áN­3™fÏ· ª`Ó“ __vbaFreeObj__vbaFreeObjList__vbaHresultCheckObj__vbaNew2__vbaObjSetSolve Problem:  ()*CoinLoadMatrix failed(CoinLoadNames failed,CoinLoadInteger failed>Check Problem failed (result = .mps~---------------------------------------------------------------"Problem Name: "Solution Result: "Solution Status: "Optimal Value:  = __vbaI2I4__vbaAryUnlock__vbaAryLock__vbaRedim__vbaStrI4CoinTestobjc4c5c6c7c8r1r2r3r4r5’ ’’ ’ ’’ ’x03’’’ ExMip1zGE col01 col02 col03 col04 col05 col06 col07 col08 row01 row02 row03 row04 row05CB AfiroCostx01x02x10x11x12x13x14x15x16x22x23x24x25x26x28x29x30x31x32x33x34x35x36x37x38x39r09r10x05x21r12r13x17x18x19x20r19r20x27x44r22r23x40x41x42x43x45x46x47x48x49x50x51’!’’"’!’’!’T’’T’! P0033Objc157c158c159c160c161c162c163c164c165c166c167c168c169c170c171c172c173c174c175c176c177c178c179c180c181c182c183c184c185c186c187c188c189r114r115r116r117r118r119r120r121r122r123r124r125r126r127r128’"’’#’"’’c’’c’"LJ@ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿx@ÿÿÿÿJ@J@J@J@L  @ÿÿÿÿ(J@ÿÿÿÿÄ#@t#@$Ù@Ä#@ì#@(Ù@Ä#@$@,Ù@ÌÌÌÌÌÌÌÌééééÌÌÌÌÌÌÌÌÌÌÌÌU‹ìƒì h†@d¡Pd‰%ƒìSVW‰eôÇEøø@‹E‹Èƒá‰Mü$þP‰E‹ÿRèÌÇEü‹EP‹ÿQ‹Eü‹Mì_^d‰ [‹å]ÂU‹ìƒì h†@d¡Pd‰%ƒìSVW‰eôÇEø@‹E‹Èƒá‰Mü$þP‰E‹ÿRè, è7èb1èíTè8&ÇEü‹EP‹ÿQ‹Eü‹Mì_^d‰ [‹å]ÂU‹ìƒì h†@d¡Pd‰%ƒì`SVW‰eôÇEø@‹E‹Èƒá‰Mü$þP‰E‹ÿREÔ3ÿh@$@P‰}؉}Ô‰}Љ}À‰}°‰} ÿÈ@Pè8Øÿÿ‹,@ÿÓMÔÿð@U MÀÇE¨9@ÇE ÿÌ@MÀU°QjdRÿ”@E°Pÿ@‹5Ø@‹ÐMØÿÖM°UÀQRjÿ@‹EØƒÄ MÔjdPQÿÈ@PèUØÿÿ‰EœÿÓ‹UÔEØRPÿˆ@MÔÿð@‹UœMØE ‰M¨RÇE @PMÀQÿÐ@UÀRÿ@‹ÐMØÿÖMÀÿ @è«ØÿÿÝ]”ÿÓèÙ‹EØ‹(@h9@PÿÓ‹ÐMÔÿÖMÔQè(MÔÿð@‹U˜‹E”h(9@RPÿl@‹ÐMÔÿÖPÿÓ‹ÐMÐÿÖMÐQèòUÐEÔRPjÿ´@ƒÄ ‰}ü›hÊM@ë$MÐUÔQRjÿ´@E°MÀPQjÿ@ƒÄÃMØÿð@ËEP‹ÿR‹Eü‹Mì_^d‰ [‹å]ÂU‹ìƒì h†@d¡Pd‰%ƒìSVW‰eôÇEø@‹E‹Èƒá‰Mü$þP‰E‹ÿR3ö‰uäèÖÿÿÿ,@º`9@Mäÿ°@EäPèMäÿð@‰uühtN@ë Mäÿð@ÃËEP‹ÿQ‹Eü‹Mì_^d‰ [‹å]ÂU‹ìƒì h†@d¡Pd‰%ƒì$SVW‰eôÇEø(@‹} 3ɉMè‰Mà‹‰MÜ;ÁŽã‹]‹;Át!fƒ8u‹p‹H÷Þ;ñrÿT@µëÿT@‹ ‹(@‹Q ‹Ph9@ÿÓ‹ÐMèÿØ@‹?¾ƒï€Î‰}Ð;÷{‹M‹…Àt&fƒ8u ‹P‹H‹þ+ú;ùrÿT@½‹}ÐëÿT@‹Uè‹MR‹‹J ‹RÿÓ‹ÐMÜÿØ@Ph9@ÿÓ‹ÐMèÿØ@MÜÿð@¸ÆpP‹ðë‹UèMàÿ°@húO@ëöEüt Màÿð@MÜÿð@ÃMèÿð@ËMì‹Eà_^d‰ [‹å]Âÿ @U‹ìƒìh†@d¡Pd‰%ƒì@SVW‰eøÇEü8@‹U3öMà‰uì‰uè‰uà‰u܉u؉uÔ‰uЉủuȉuÄÿ°@‹]Sè¢Úÿÿ‹øÿ,@S‰}ìèÙÚÿÿ‹øÿ,@‹M EìPQ‰}èèùýÿÿ‹=Ø@‹ÐMÈÿ׋EUèRPèßýÿÿ‹ÐMÄÿ׋MÄ‹Eà‹UȉM´M̉uĉuÈ‹5È@PQ‰U°ÿÖ‹U´PMÔÿ×UÐPRÿÖ‹U°PMÜÿ×PEØPÿÖPSè{Öÿÿ‹ðÿ,@‹MÌUàQRÿˆ@EÄMÈPUÌQEÐRMÔPUØQEÜRPj‰uäÿ´@ƒÄ hŠQ@ë(MÄUÈQEÌRMÐPUÔQEØRMÜPQjÿ´@ƒÄ ÃMàÿð@ËMðf‹Eä_^d‰ [‹å]ÂU‹ìƒì h†@d¡Pd‰%ƒìLSVW‰eôÇEøH@3ÀU¬M̉Eè‰Eà‰E܉ẺE¼ÇE´9@ÇE¬ÿÌ@EÌM¼PhèQÿ”@‹5@U¼RÿÖ‹=Ø@‹ÐMèÿ×E¼MÌPQjÿ@‹UèƒÄ EÜhèRPÿÈ@‹MPQèxØÿÿ‹Øÿ,@‹UÜEèRPÿˆ@MÜÿð@U¬SEÌMèRP‰M´ÇE¬@ÿÐ@MÌQÿÖ‹ÐMàÿ×MÌÿ @hîR@ë,öEüt Màÿð@MÜÿð@U¼EÌRPjÿ@ƒÄ ÃMèÿð@ËMì‹Eà_^d‰ [‹å]ÂU‹ìƒì h†@d¡Pd‰%ƒìLSVW‰eôÇEøX@3ÀU¬M̉Eè‰Eà‰E܉ẺE¼ÇE´9@ÇE¬ÿÌ@EÌM¼PhèQÿ”@‹5@U¼RÿÖ‹=Ø@‹ÐMèÿ×E¼MÌPQjÿ@‹UèƒÄ EÜhèRPÿÈ@‹M ‹UPQRèð×ÿÿ‹Øÿ,@‹EÜMèPQÿˆ@MÜÿð@E¬SMÌUèPQ‰U´ÇE¬@ÿÐ@UÌRÿÖ‹ÐMàÿ×MÌÿ @hRT@ë,öEüt Màÿð@MÜÿð@E¼MÌPQjÿ@ƒÄ ÃMèÿð@ËMì‹Eà_^d‰ [‹å]ÂU‹ìƒì h†@d¡Pd‰%ƒìLSVW‰eôÇEøh@3ÀU¬M̉Eè‰Eà‰E܉ẺE¼ÇE´9@ÇE¬ÿÌ@EÌM¼PhèQÿ”@‹5@U¼RÿÖ‹=Ø@‹ÐMàÿ×E¼MÌPQjÿ@‹UàƒÄ EÜhèRPÿÈ@‹MPQè¼Øÿÿ‹Øÿ,@‹UÜEàRPÿˆ@MÜÿð@U¬SEÌMàRP‰M´ÇE¬@ÿÐ@MÌQÿÖ‹ÐMèÿ×MÌÿ @h®U@ë,öEüt Mèÿð@MÜÿð@U¼EÌRPjÿ@ƒÄ ÃMàÿð@ËMì‹Eè_^d‰ [‹å]ÂU‹ìƒìh†@d¡Pd‰%ì8SVW‰eøÇEüˆ@‹5X@jEÄ3ÛhD9@P‰]ì‰] ‰\ÿÿÿ‰ÿÿÿ‰øþÿÿ‰Øþÿÿˆ(þÿÿ‰$þÿÿ‰ þÿÿ‰þÿÿ‰þÿÿ‰þÿÿ‰þÿÿ‰ þÿÿ‰þÿÿ‰þÿÿ‰þÿÿ‰üýÿÿ‰øýÿÿ‰ôýÿÿ‰ðýÿÿ‰èýÿÿ‰ìýÿÿ‰àýÿÿ‰äýÿÿÿÖjM¨h@;@QÿÖjU„h\;@RÿÖj…dÿÿÿhx;@PÿÖjDÿÿÿhD9@QÿÖj•(ÿÿÿh”;@RÿÖj…ÿÿÿh°;@PÿÖjàþÿÿhÌ;@QÿÖj•Àþÿÿhè;@RÿÖj…¤þÿÿhD9@PÿÖjˆþÿÿh<@QÿÖj•hþÿÿh <@RÿÖj…Lþÿÿhè;@PÿÖj0þÿÿhD9@QÿÖ‹5°@ºØ:@ÿÿÿÿÖºì:@M ÿÖÝ€@ƒ=Ð@uÜ5x@ëÿ5|@ÿ5x@èôºÿÿ‹•°þÿÿ‹= @h;@Çš™™™Ý]äßਠ…ˆ‹…°þÿÿÇ@™™©?‹°þÿÿÇA{®G‹•°þÿÿÇB áz´?‹…Pÿÿÿ‰‹Pÿÿÿ‰Y‹•Pÿÿÿ‰Z‹…Pÿÿÿ‰X ‹<þÿÿ¸€„.A‰‹•<þÿÿ‰B‹<þÿÿ‰Y‹•<þÿÿ‰B ÿ׋Èÿt@‹4ÿÿÿh;@ˆÿ׋Èÿt@‹•4ÿÿÿh;@ˆBÿ׋Èÿt@‹4ÿÿÿˆA‹•Xþÿÿ‰‹…XþÿÿÇ@à•@‹Xþÿÿ¿‰Y‹•XþÿÿÇB @¿@‹…Xþÿÿ‰X‹XþÿÿÇAˆ³@‹U‰‹E‰x‹MÇA‹• ÿÿÿ‰:‹… ÿÿÿ‰x‹ìþÿÿ‰‹•ìþÿÿÇB‹…ìþÿÿ‰X‹ìþÿÿ‰y ‹•”þÿÿÇš™™™‹…”þÿÿÇ@™™¹?‹”þÿÿ¸ð?‰Y‹•”þÿÿ‰B ‹”þÿÿÇAš™™™‹•”þÿÿÇB™™É?‹”þÿÿ‰Y‹•”þÿÿ‰B‹tþÿÿº;@ÿÖ‹…tþÿÿº;@HÿÖ‹M´º$;@ÿÖ‹M´º0;@ƒÁÿÖ‹E´º:@HÿÖ• þÿÿ…$þÿÿhþÿÿRP‰½ þÿÿ‰$þÿÿèÃôÿÿ‹5Ø@‹ÐøþÿÿÿÖM¨• þÿÿÇ… þÿÿ‰$þÿÿR…$þÿÿPèôÿÿ‹ÐØþÿÿÿÖ3Éÿ€@M¨ˆ…(þÿÿ•hþÿÿ‰ þÿÿ…(þÿÿ‰•$þÿÿ‹U àýÿÿPQ… þÿÿR‹•”þÿÿ$þÿÿP‹…ìþÿÿQ‹ ÿÿÿR‹UPQ‹Xþÿÿ…èýÿÿR‹•4ÿÿÿP‹…<þÿÿQ‹PÿÿÿR‹•°þÿÿP‹EèQ‹MäR‹•ÿÿÿPQjÿSjjWhªª@h»«ªR‰àýÿÿ‰äýÿÿ‰èýÿÿ‰ìýÿÿèß›hK\@‹=ð@Mìÿ׋58@$þÿÿ3ÛEÄQS‰…$þÿÿÿÖ… þÿÿU¨PS‰• þÿÿÿÖM ÿוþÿÿM„RS‰þÿÿÿÖþÿÿ…dÿÿÿQS‰…þÿÿÿÖ\ÿÿÿÿ×…þÿÿ•DÿÿÿPS‰•þÿÿÿÖ•þÿÿ(ÿÿÿRS‰þÿÿÿÖÿÿÿÿ× þÿÿ…ÿÿÿQS‰… þÿÿÿÖøþÿÿÿ×…þÿÿ•àþÿÿPS‰•þÿÿÿÖØþÿÿÿוþÿÿÀþÿÿRS‰þÿÿÿÖþÿÿ…¤þÿÿQS‰…þÿÿÿÖ…üýÿÿ•ˆþÿÿPS‰•üýÿÿÿÖ•øýÿÿhþÿÿRS‰øýÿÿÿÖôýÿÿ…LþÿÿQS‰…ôýÿÿÿÖ…ðýÿÿ•0þÿÿPS‰•ðýÿÿÿÖËMð_^d‰ [‹å]Ãé+¶ÿÿU‹ìƒìh†@d¡Pd‰%ƒì(SVW‰eøÇEü˜@¡Ð@3Û;É]ì‰]è‰]ä‰]à‰]ÜuhÐ@hx@ÿ¤@¡Ð@‹Pÿ‘ü‹5<@UÜPRÿÖ‹ø¡Ð@;ÃuhÐ@hx@ÿ¤@¡Ð@‹Pÿ‘üUàPRÿÖ‹ðMìQV‹ÿ ;ÃÛâ}h hx<@VPÿ0@‹E‹Uì‹5(@‹‹RQÿÖ‹ÐMèÿØ@PhŒ<@ÿÖ‹ÐMäÿØ@PWÿ“¤…ÀÛâ}h¤hx<@WPÿ0@UäEèRMìPQjÿ´@UÜEàRPjÿ@ƒÄhÞ]@ë(MäUèQEìRPjÿ´@MÜUàQRjÿ@ƒÄÃËMð_^d‰ [‹å]ÂU‹ìƒìh†@d¡Pd‰%ƒìSVW‰eøÇEü¨@¡Ð@ÇEì…ÀuhÐ@hx@ÿ¤@¡Ð@‹Pÿ‘üUìPRÿ<@‹ðh@$@V‹ÿ¤…ÀÛâ}h¤hx<@VPÿ0@Mìÿì@h¥^@ë Mìÿì@ÃËMð_^d‰ [‹å]ÃU‹ìƒìh†@d¡Pd‰%ì¨SVW‰eøÇEüÀ@‹U‹5°@3ÀMÔ‰Eè‰Eä‰Eà‰EÔ‰ẺEĉE¸‰E´‰E°‰E¬‰E¨‰E¤‰E ‰Eœ‰E˜‰E”‰E‰EŒ‰EˆÿÖ‹U`MàÿÖº@$@MœÿÖEœPè ýÿÿMœÿð@‹MÔ‹=(@hì<@Qÿ׋5Ø@‹ÐMœÿÖPh=@ÿ׋ÐM˜ÿÖ‹UP‹E RPÿl@‹ÐM”ÿÖPÿ׋ÐMÿÖPh=@ÿ׋ÐMŒÿÖMŒQè²üÿÿUŒERM”PU˜QEœRPjÿ´@‹MÔƒÄUœQRÿÈ@PèûÆÿÿ‹Ø‰]€ÿ,@‹EœMÔPQÿˆ@Mœÿð@‹UT‹EP‹MLR‹UHP‹EDQ‹M@R‹U@Mœÿ°@EœPèdúÿÿMœÿð@‹MÔh>@Qÿ׋ÐMœÿÖUœRè@úÿÿMœÿð@‹E´h¸>@Pÿ׋ÐMœÿÖMœQèúÿÿMœÿð@‹U€hà>@Rÿ@‹ÐMœÿÖPÿ׋ÐM˜ÿÖE˜PèêùÿÿM˜UœQRjÿ´@‹…|ÿÿÿ‹xÿÿÿƒÄ h?@PQÿl@‹ÐMœÿÖPÿ׋ÐM˜ÿÖPh=@ÿ׋ÐM”ÿÖ‹UP‹E RPÿl@‹ÐMÿÖPÿ׋ÐMŒÿÖPh=@ÿ׋ÐMˆÿÖMˆQèfùÿÿUˆEŒRMPU”QE˜RMœPQjÿ´@ƒÄº >@Mœÿ°@UœRè,ùÿÿMœÿð@SèÍÇÿÿ‰E€ÿ,@‹E€S‰EèÈÿÿ‰E€ÿ,@‹MjQjU°jRjh€ÿh@‹EjPjMÌjQjh€ÿh@‹U€jRjEÄjPjh€ÿh@‹M€ƒÄTUäjQjjRjh€ÿh@‹EäƒÄM PQÿÄ@‹E …Àt3fƒ8u-‹H‹P÷Ù;ʉhÿÿÿr ÿT@‹hÿÿÿ͉•Xÿÿÿë ÿT@‰…Xÿÿÿ‹EÄM¤PQÿÄ@‹M¤…Ét3fƒ9u-‹A‹Q÷Ø;‰…lÿÿÿr ÿT@‹…lÿÿÿʼn•Tÿÿÿë ÿT@‰…Tÿÿÿ‹EÌM¨PQÿÄ@‹M¨…Ét3fƒ9u-‹A‹Q÷Ø;‰…pÿÿÿr ÿT@‹…pÿÿÿʼn•Pÿÿÿë ÿT@‰…Pÿÿÿ‹E°M¬PQÿÄ@‹M¬…Ét,fƒ9u&‹A‹Q÷Ø;‰…tÿÿÿrÿT@‹M¬‹…tÿÿÿÁàë ÿT@‹M¬‹U ‹I È‹R •XÿÿÿR‹U¤‹R •TÿÿÿR‹U¨‹R •PÿÿÿRQSèÊÿÿÿ,@U¬Rÿä@E¨Pÿä@M¤Qÿä@U Rÿä@‹Mƒé€6ÿ\@‹M°‰…`ÿÿÿ3À‰Eìf;…`ÿÿÿ*…Ét/fƒ9u)‹Q¿À+‹Q;‰…tÿÿÿrÿT@‹M°‹…tÿÿÿÁàë ÿT@‹M°‹Q Ýܸ@ßàöÄ@…À¿EìPS‰…Lÿÿÿèõìÿÿ‹ÐMèÿÖ‹E°…Àt3fƒ8u-‹Lÿÿÿ‹P+Ê‹P;ʉtÿÿÿr ÿT@‹tÿÿÿÍëÿT@‹M艅HÿÿÿQh0?@ÿ׋ÐMœÿÖ‹U°P‹…Hÿÿÿ‹J ‹TR‹Pÿl@‹ÐM˜ÿÖPÿ׋ÐM”ÿÖM”QèÀõÿÿU”E˜RMœPQjÿ´@‹M°ƒÄ¸fEì€ó‰EìéÉþÿÿ‹5°@º >@MœÿÖUœRèvõÿÿ‹=ð@Mœÿ׺@$@MœÿÖEœPèXõÿÿMœÿ×SèÃÿÿÿ,@›h¹g@ëB‹5ä@M¬QÿÖU¨RÿÖE¤PÿÖM QÿÖUˆEŒRMPU”QE˜RMœPQjÿ´@ƒÄË5ð@MèÿÖ‹=8@UäRjÿ×MàÿÖMÔÿÖEÌPjÿ×MÄQjÿ×M¸ÿÖM´ÿÖU°Rjÿ×ËMð_^d‰ [‹å]Âdÿ @U‹ìƒìh†@d¡Pd‰%ì0SVW‰eøÇEüØ@‹5X@jEÈ3Ûh@@P‰]¤‰ ÿÿÿ‰ÿÿÿ‰àþÿÿˆ0þÿÿ‰,þÿÿ‰(þÿÿ‰$þÿÿ‰ þÿÿ‰þÿÿ‰þÿÿ‰þÿÿ‰þÿÿ‰ þÿÿ‰þÿÿ‰þÿÿ‰þÿÿ‰üýÿÿ‰øýÿÿ‰ðýÿÿ‰ôýÿÿ‰èýÿÿ‰ìýÿÿÿÖjM¬h8@@QÿÖjUˆhT@@RÿÖj…hÿÿÿhp@@PÿÖjLÿÿÿh@@QÿÖj•0ÿÿÿhŒ@@RÿÖj…ÿÿÿh¨@@PÿÖjèþÿÿhÄ@@QÿÖj•Èþÿÿhì@@RÿÖj…¬þÿÿh@@PÿÖjþÿÿhA@QÿÖj•pþÿÿh$A@RÿÖj…Tþÿÿhì@@PÿÖj8þÿÿh@@QÿÖ‹5°@º€?@ ÿÿÿÿÖº˜?@M¤ÿÖ‹•¸þÿÿ¿ð?‰‹…¸þÿÿ‰x‹¸þÿÿ‰Y‹•¸þÿÿ‰z ‹…¸þÿÿ‰X‹¸þÿÿ‰y‹•¸þÿÿ‰Z‹…¸þÿÿ‰x‹¸þÿÿ‰Y ‹•¸þÿÿ‰z$‹…¸þÿÿ‰X(‹¸þÿÿ‰y,‹•¸þÿÿ‰Z0‹…¸þÿÿ‰x4‹¸þÿÿ‰Y8‹•¸þÿÿ‰z<‹…Xÿÿÿ‰‹Xÿÿÿ‰Y‹•Xÿÿÿ‰Z‹…Xÿÿÿ‰X ‹Xÿÿÿ‰Y‹•Xÿÿÿ‰Z‹…Xÿÿÿ‰X‹Xÿÿÿ‰Y‹•Xÿÿÿ‰Z ‹…Xÿÿÿ‰X$‹Xÿÿÿ‰Y(‹•Xÿÿÿh;@‰Z,‹…Xÿÿÿ‰X0‹Xÿÿÿ‰Y4‹•Xÿÿÿ‰Z8‹…Xÿÿÿ‰X<‹Dþÿÿ¸€„.A‰‹•Dþÿÿ‰B‹Dþÿÿ‰Y‹•Dþÿÿ‰B ‹Dþÿÿ‰Y‹•Dþÿÿ‰B‹Dþÿÿ‰Y‹•Dþÿÿ‰B‹Dþÿÿ‰Y ‹•Dþÿÿ‰B$‹Dþÿÿ‰Y(‹•Dþÿÿ‰B,‹Dþÿÿ‰Y0‹•Dþÿÿ‰B4‹Dþÿÿ‰Y8‹•Dþÿÿ‰B<ÿ @‹Èÿt@‹<ÿÿÿh;@ˆÿ @‹Èÿt@‹•<ÿÿÿh;@ˆBÿ @‹Èÿt@‹<ÿÿÿh;@ˆAÿ @‹Èÿt@‹•<ÿÿÿh;@ˆBÿ @‹Èÿt@‹<ÿÿÿˆA‹•`þÿÿ‰‹…`þÿÿÇ@,@‹`þÿÿ‰Y‹•`þÿÿÇB T@‹…`þÿÿ‰X‹`þÿÿ¸I@‰A‹•`þÿÿ‰Z‹`þÿÿ‰A‹•`þÿÿ‰Z ‹`þÿÿ‰A$‹U”¸‰‹M”‰A‹U”ÇB‹M”ÇA ‹U”ÇB‹M”ÇA ‹U”ÇB ‹M”ÇA ‹U”ÇB ‹ÿÿÿ‰‹•ÿÿÿ‰B‹ÿÿÿ‰A‹•ÿÿÿ‰B ‹ÿÿÿ‰A‹•ÿÿÿ¹‰J‹•ÿÿÿ‰J‹•ÿÿÿ‰B‹•ôþÿÿ‰‹•ôþÿÿÇB‹•ôþÿÿ‰Z‹•ôþÿÿ‰J ‹•ôþÿÿ‰J‹ôþÿÿ‰A‹•ôþÿÿ‰Z‹ôþÿÿÇA‹•ôþÿÿ¹‰Z ‹•ôþÿÿ‰J$‹•ôþÿÿ‰B(‹…ôþÿÿÇ@,‹•ôþÿÿ‰Z0‹…ôþÿÿ‰H4‹œþÿÿ‰‹•œþÿÿÇB@‹…œþÿÿ¹ffff‰H‹•œþÿÿÝÐ@ÇB ff@‹…œþÿÿ‰X‹•œþÿÿ‰z‹…œþÿÿ‰X‹•œþÿÿÇB@‹…œþÿÿÇ@ š™™™‹•œþÿÿÇB$™™ñ?‹…œþÿÿ‰X(‹•œþÿÿ‰z,‹…œþÿÿ‰X0‹•œþÿÿÇB4À‹…œþÿÿ‰H8‹•œþÿÿÇB‹U”ÇBXB‹U”ÇB\F‹U”ÇB`I‹U”ÇBdL‹U”ÇBhP‹U”ÇBlT‹U”ÇBpW‹U”ÇBtZ‹U”ÇBx]‹U”ÇB|`‹U”Ç‚€a‹U”Ç‚„b‹•ÿÿÿ‰ ‹•ÿÿÿ‰J‹•ÿÿÿ¹‰J‹•ÿÿÿ‰J ‹•ÿÿÿ¹‰J‹•ÿÿÿ‰J‹•ÿÿÿÇB‹•ÿÿÿ‰J‹•ÿÿÿ‰J ‹•ÿÿÿÇB$‹•ÿÿÿÇB(‹•ÿÿÿÇB,‹•ÿÿÿÇB0‹•ÿÿÿÇB4‹•ÿÿÿÇB8‹•ÿÿÿÇB<‹•ÿÿÿÇB@‹•ÿÿÿÇBD‹•ÿÿÿÇBH‹•ÿÿÿÇBL‹•ÿÿÿÇBP‹•ÿÿÿÇBT‹•ÿÿÿÇBX‹•ÿÿÿÇB\‹•ÿÿÿÇB`‹•ÿÿÿÇBd‹•ÿÿÿÇBh‹•ÿÿÿÇBl‹•ÿÿÿÇBp‹•ÿÿÿÇBt‹•ÿÿÿÇBx‹•ÿÿÿÇB|‹•ÿÿÿÇ‚€‹•ôþÿÿ‰2‹•ôþÿÿÇB‹•ôþÿÿÇB ‹•ôþÿÿ‰r ‹•ôþÿÿÇB ‹•ôþÿÿÇB ‹•ôþÿÿ‰r‹•ôþÿÿ‰J‹•ôþÿÿ‰B ‹•ôþÿÿÇB$ ‹•ôþÿÿ‰r(‹•ôþÿÿ‰J,‹•ôþÿÿ‰B0‹•ôþÿÿÇB4‹•ôþÿÿÇB8‹•ôþÿÿ‰J<‹•ôþÿÿ‰B@‹•ôþÿÿÇBD ‹•ôþÿÿÇBH ‹•ôþÿÿÇBL‹•ôþÿÿ‰JP‹•ôþÿÿ‰BT‹•ôþÿÿÇBX‹•ôþÿÿÇB\ ‹•ôþÿÿÇB`‹•ôþÿÿÇBd‹•ôþÿÿÇBh‹•ôþÿÿ‰Jl‹•ôþÿÿ‰Bp‹•ôþÿÿÇBt ‹•ôþÿÿÇBx ‹•ôþÿÿÇB|‹•ôþÿÿ‰Š€‹•ôþÿÿ‰‚„‹•ôþÿÿÇ‚ˆ‹•ôþÿÿÇ‚Œ ‹•ôþÿÿÇ‚‹•ôþÿÿÇ‚”‹•ôþÿÿÇ‚˜‹•ôþÿÿÇ‚œ ‹•ôþÿÿÇ‚  ‹•ôþÿÿÇ‚¤‹•ôþÿÿ‰Š¨‹•ôþÿÿ‰‚¬‹•ôþÿÿÇ‚° ‹•ôþÿÿÇ‚´‹•ôþÿÿ‰Š¸‹•ôþÿÿ‰‚¼‹•ôþÿÿÇ‚À ‹•ôþÿÿ‰ŠÄ‹•ôþÿÿ‰‚È‹•ôþÿÿǂ̋•ôþÿÿǂР‹•ôþÿÿǂԋ•ôþÿÿǂ؋•ôþÿÿǂ܋•ôþÿÿÇ‚à ‹•ôþÿÿÇ‚ä ‹•ôþÿÿÇ‚è ‹•ôþÿÿÇ‚ì ‹•ôþÿÿǂ𠋕ôþÿÿÇ‚ô ‹•ôþÿÿ‰Šø‹•ôþÿÿ‰‚ü‹•ôþÿÿÇ‚ ‹•ôþÿÿÇ‚ ‹•ôþÿÿ‰Š‹•ôþÿÿ‰‚ ‹•ôþÿÿÇ‚ ‹•ôþÿÿÇ‚ ‹•ôþÿÿ‰Š‹•ôþÿÿ‰‚‹•ôþÿÿÇ‚  ‹•ôþÿÿ‰Š$‹•ôþÿÿ‰‚(‹•ôþÿÿÇ‚, ‹•ôþÿÿ‰Š0‹•ôþÿÿ‰‚4‹•ôþÿÿÇ‚8‹•ôþÿÿÇ‚< ‹•ôþÿÿ‰Š@‹•ôþÿÿ‰‚D‹•ôþÿÿÇ‚H‹•ôþÿÿÇ‚L ‹•ôþÿÿ‰ŠP‹•ôþÿÿ‰‚T‹•ôþÿÿÇ‚X ‹•ôþÿÿ‰Š\‹•ôþÿÿ‰‚`‹•ôþÿÿÇ‚d ‹•ôþÿÿ‰Šh‹•ôþÿÿ‰‚l‹•ôþÿÿÇ‚p‹•ôþÿÿ‰Št‹ôþÿÿ‰x‹•ôþÿÿ¸Ç‚|‹ôþÿÿ‰€‹•ôþÿÿ¹ð?‰‚„‹…œþÿÿ‰0‹•œþÿÿ‰J‹…œþÿÿ‰p‹•œþÿÿ¸ÀrÀ‰B ‹•œþÿÿ‰r‹•œþÿÿ‰B‹•œþÿÿ‰r‹•œþÿÿ‰J‹•œþÿÿ‰r ‹•œþÿÿ‰B$‹•œþÿÿ‰r(‹•œþÿÿ‰B,‹•œþÿÿ‰r0‹•œþÿÿ‰J4‹•œþÿÿ‰r8‹•œþÿÿÇB<Àr@‹•œþÿÿ‰r@‹•œþÿÿ‰BD‹•œþÿÿ‰rH‹•œþÿÿ‰BL‹•œþÿÿ‰rP‹•œþÿÿ‰JT‹•œþÿÿ‰rX‹•œþÿÿÇB\Àr@‹•œþÿÿ‰r`‹•œþÿÿ‰Bd‹•œþÿÿ‰rh‹•œþÿÿ‰Bl‹…œþÿÿ‰pp‹•œþÿÿ‰Jt‹…œþÿÿ‰px‹•œþÿÿÇB|Ðq@‹…œþÿÿ‰°€‹•œþÿÿ¸ÐqÀ‰‚„‹•œþÿÿ‰²ˆ‹•œþÿÿ‰‚Œ‹•œþÿÿ‰²‹•œþÿÿ‰‚”‹•œþÿÿ‰²˜‹•œþÿÿ‰Šœ‹•œþÿÿ‰² ‹•œþÿÿÇ‚¤Ðq@‹•œþÿÿ‰²¨‹•œþÿÿ‰‚¬‹•œþÿÿ‰²°‹•œþÿÿ‰‚´‹•œþÿÿ‰²¸‹•œþÿÿ‰‚¼‹•œþÿÿ‰²À‹•œþÿÿ‰ŠÄ‹•œþÿÿ‰²È‹•œþÿÿ‰‚Ì‹…œþÿÿ‰°Ð‹•œþÿÿ‰ŠÔ‹…œþÿÿ‰°Ø‹•œþÿÿÇ‚Üp@‹…œþÿÿ‰°à‹•œþÿÿ¸pÀ‰‚ä‹•œþÿÿ‰²è‹•œþÿÿ‰‚ì‹•œþÿÿ‰²ð‹•œþÿÿ‰‚ô‹•œþÿÿ‰²ø‹•œþÿÿ‰Šü‹•œþÿÿ‰²‹•œþÿÿÇ‚p@‹•œþÿÿ‰²‹•œþÿÿ‰‚ ‹•œþÿÿ‰²‹•œþÿÿ‰‚‹•œþÿÿ‰²‹•œþÿÿ‰‚‹…œþÿÿ‰° ‹•œþÿÿ‰Š$‹…œþÿÿ‰°(‹•œþÿÿ¸ÀlÀ‰‚,‹•œþÿÿ‰²0‹•œþÿÿ‰Š4‹•œþÿÿ‰²8‹•œþÿÿ‰‚<‹•œþÿÿ‰²@‹•œþÿÿ‰‚D‹•œþÿÿ‰²H‹•œþÿÿ‰ŠL‹•œþÿÿ‰²P‹•œþÿÿÇ‚TÀl@‹•œþÿÿ‰²X‹•œþÿÿ‰‚\‹•œþÿÿ‰²`‹•œþÿÿ‰‚d‹•œþÿÿ‰²h‹•œþÿÿ‰Šl‹•œþÿÿ‰²p‹•œþÿÿÇ‚tÀl@‹•œþÿÿ‰²x‹•œþÿÿ‰‚|‹•œþÿÿ‰²€‹•œþÿÿ‰‚„‹…œþÿÿ‰°ˆ‹•œþÿÿÇ‚ŒÀg@‹…œþÿÿ‰°‹•œþÿÿ¸ÀgÀ‰‚”‹•œþÿÿ‰²˜‹•œþÿÿ‰‚œ‹•œþÿÿ‰² ‹•œþÿÿ‰‚¤‹…œþÿÿ‰°¨‹•œþÿÿ‰Š¬‹…œþÿÿ¹iÀ‰°°‹•œþÿÿ‰Š´‹…œþÿÿ‰°¸‹•œþÿÿ¸yÀ‰‚¼‹•œþÿÿ‰²À‹•œþÿÿ‰ŠÄ‹•œþÿÿ‰²È‹•œþÿÿ‰ŠÌ‹•œþÿÿ‰²Ð‹•œþÿÿ‰‚Ô‹•œþÿÿ‰²Ø‹•œþÿÿ‰‚Ü‹•œþÿÿ‰²à‹•œþÿÿ‰Šä‹•œþÿÿ‰²è‹•œþÿÿ‰‚ì‹•œþÿÿ‰²ð‹•œþÿÿÇ‚ôi@‹•œþÿÿ‰²ø‹•œþÿÿ‰Šü‹•œþÿÿ‰²‹•œþÿÿ‰Š‹•œþÿÿ‰²‹•œþÿÿ‰Š ‹•œþÿÿ‰²‹•œþÿÿÇ‚y@‹•œþÿÿ‰²‹•œþÿÿ‰‚‹•œþÿÿ‰² ‹•œþÿÿ‰‚$‹•œþÿÿ‰²(‹•œþÿÿ‰‚,‹•œþÿÿ‰²0‹•œþÿÿÇ‚4i@‹•œþÿÿ‰²8‹•œþÿÿ‰Š<‹•œþÿÿ‰²@‹•œþÿÿ‰ŠD‹•œþÿÿ‰²H‹•œþÿÿÇ‚Ly@‹•œþÿÿ‰²P‹•œþÿÿ‰‚T‹•œþÿÿ‰²X‹•œþÿÿ‰‚\‹•œþÿÿ‰²`‹•œþÿÿÇ‚di@‹•œþÿÿ‰²h‹•œþÿÿ‰Šl‹•œþÿÿ‰²p‹•œþÿÿ‰Št‹•œþÿÿ‰²x‹•œþÿÿ‰Š|‹•œþÿÿ‰²€‹•œþÿÿÇ‚„y@‹•œþÿÿ‰²ˆ‹•œþÿÿ‰‚Œ‹•œþÿÿ‰²‹•œþÿÿ‰‚”‹•œþÿÿ‰²˜‹•œþÿÿ‰‚œ‹•œþÿÿ‰² ‹•œþÿÿÇ‚¤i@‹•œþÿÿ‰²¨‹•œþÿÿ‰Š¬‹•œþÿÿ‰²°‹•œþÿÿ‰Š´‹•œþÿÿ‰²¸‹•œþÿÿÇ‚¼y@‹•œþÿÿ‰²À‹•œþÿÿ‰‚Ä‹•œþÿÿ‰²È‹•œþÿÿ‰‚Ì‹•œþÿÿ‰²Ð‹•œþÿÿÇ‚Ôi@‹•œþÿÿ‰²Ø‹•œþÿÿ‰ŠÜ‹•œþÿÿ‰²à‹•œþÿÿ‰Šä‹•œþÿÿ‰²è‹•œþÿÿÇ‚ìy@‹•œþÿÿ‰²ð‹•œþÿÿ‰‚ô‹•œþÿÿ‰²ø‹•œþÿÿ‰‚ü‹•œþÿÿ‰²‹•œþÿÿ‰Š‹œþÿÿ‰±‹•œþÿÿ‰‚ ‹|þÿÿºF@ÿ׋…|þÿÿº,F@Hÿ׋|þÿÿºÊHÊ^ÊjÊ|ʎʞʲÊÄÊd€ÒÊâÊôÊi€Ë ËË&Ë0ËBËLË\ËMSVBVM60.DLL_CIcos_adj_fptan__vbaStrI4__vbaFreeVar__vbaStrVarMove__vbaFreeVarList_adj_fdiv_m64__vbaFreeObjList_adj_fprem1__vbaStrCat__vbaSetSystemError__vbaHresultCheckObj_adj_fdiv_m32__vbaAryDestruct__vbaObjSet_adj_fdiv_m16i_adj_fdivr_m16i_CIsin__vbaChkstkEVENT_SINK_AddRef__vbaGenerateBoundsError__vbaAryConstruct2__vbaI2I4DllFunctionCall_adj_fpatan__vbaRedim__vbaStrR8EVENT_SINK_Release__vbaUI1I2_CIsqrtEVENT_SINK_QueryInterface__vbaUI1I4__vbaExceptHandler__vbaStrToUnicode_adj_fprem_adj_fdivr_m64__vbaFPException_CIlog__vbaErrorOverflow__vbaNew2_adj_fdiv_m32i_adj_fdivr_m32i__vbaStrCopy__vbaFreeStrList_adj_fdivr_m32_adj_fdiv_r__vbaAryLock__vbaStrToAnsi__vbaVarDup_CIatan__vbaStrMove_allmul_CItan__vbaAryUnlock_CIexp__vbaFreeObj__vbaFreeStr¢c˜RX€@€(€¢c˜R€€¢c˜R˜€¢c˜R1uà€2uÈ€3u°€¢c˜R ø¢c˜R¢c˜R¢c˜R(¢c˜R8PñL°œó0°Ìó(°ôôè°Ü÷0°L4VS_VERSION_INFO½ïþDVarFileInfo$Translation °¬StringFileInfoˆ040904B0P.CompanyNameMaximal Software, Inc.<ProductNameCoinMPTestVB6, FileVersion1.000 ProductVersion1.00<InternalNameCoinMPTestVB6L$OriginalFilenameCoinMPTestVB6.exe 01u è2u(3u( À€€€€€€€€€€€€ÀÀÀÿÿÿÿÿÿÿÿÿÿÿÿðwÿÿðwpÿÿÿðpÿÿÿðÿÿÿðÿÿ€€àîààÿÿÿÿÿøÀÀÀÀÀÀÀÀÇÿÿÿÿÿÿÿ( @€€€€€€€€€€€€€ÀÀÀÿÿÿÿÿÿÿÿÿÿÿÿÿpÿÿÿwpÿÿÿÿÿÿwwpÿÿÿÿÿÿÿÿwpÿÿÿÿÿÿÿÿpÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿˆˆÿÿÿÿˆˆÿÿˆˆîîîîîîîÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÁÿÿüÿ€øøøøÿøÿøÿøÿøÿøÿøÿøÿøÿøÿøÿø?ÿøÿÿø?ÿÿûÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ( @ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÁÿÿü<ÿÃüø?üûÿüûÿüûÿýÿûÿýÿûÿýÿûÿýÿûÿýÿûÿýÿûÿýÿûÿýÿûÿÁÿûü=ÿûÃÁÿø 0 Then namesBuf = NamesList(0) + vbNullChar For i = 1 To Count - 1 namesBuf = namesBuf + NamesList(i) + vbNullChar Next i End If CoinGenerateNamesBuf = namesBuf End Function Public Function CoinGetSolverName() As String Dim solverName As String Dim length As Long solverName = String(1000, vbNullChar) length = CoinGetSolverNameBuf(solverName, 1000) CoinGetSolverName = Left(solverName, length) End Function Public Function CoinGetVersionStr() As String Dim versionStr As String Dim length As Long versionStr = String(1000, vbNullChar) length = CoinGetVersionStrBuf(versionStr, 1000) CoinGetVersionStr = Left(versionStr, length) End Function Public Function CoinLoadNames(ByVal hProb As Long, _ ByRef colNames() As String, ByRef rowNames() As String, ByVal objName As String) As Integer Dim colCount As Long Dim rowCount As Long colCount = CoinGetColCount(hProb) rowCount = CoinGetRowCount(hProb) CoinLoadNames = CoinLoadNamesBuf(hProb, CoinGenerateNamesBuf(colNames, colCount), _ CoinGenerateNamesBuf(rowNames, rowCount), objName) End Function Public Function CoinLoadProblem(ByVal hProb As Long, _ ByVal colCount As Long, ByVal rowCount As Long, _ ByVal nonZeroCount As Long, ByVal rangeCount As Long, _ ByVal objectSense As Long, ByVal objectConst As Double, ByRef objectCoeffs As Double, _ ByRef lowerBounds As Double, ByRef upperBounds As Double, ByRef rowType As Byte, _ ByRef rhsValues As Double, ByRef rangeValues As Double, ByRef matrixBegin As Long, _ ByRef matrixCount As Long, ByRef matrixIndex As Long, ByRef matrixValues As Double, _ ByRef colNames() As String, ByRef rowNames() As String, ByVal objName As String) As Integer CoinLoadProblem = CoinLoadProblemBuf(hProb, colCount, rowCount, nonZeroCount, rangeCount, _ objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, _ rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues, _ CoinGenerateNamesBuf(colNames, colCount), CoinGenerateNamesBuf(rowNames, rowCount), _ objName) End Function Public Function CoinGetProblemName(ByVal hProb As Long) As String Dim problemName As String Dim length As Long problemName = String(1000, vbNullChar) length = CoinGetProblemNameBuf(hProb, problemName, 1000) CoinGetProblemName = Left(problemName, length) End Function Public Function CoinGetColName(ByVal hProb As Long, ByVal col As Long) As String Dim colName As String Dim length As Long colName = String(1000, vbNullChar) length = CoinGetColNameBuf(hProb, col, colName, 1000) CoinGetColName = Left(colName, length) End Function Public Function CoinGetRowName(ByVal hProb As Long, ByVal row As Long) As String Dim rowName As String Dim length As Long rowName = String(1000, vbNullChar) length = CoinGetRowNameBuf(hProb, row, rowName, 1000) CoinGetRowName = Left(rowName, length) End Function Public Function CoinGetSolutionText(ByVal hProb As Long) As String Dim solutionText As String Dim length As Long solutionText = String(1000, vbNullChar) length = CoinGetSolutionTextBuf(hProb, solutionText, 1000) CoinGetSolutionText = Left(solutionText, length) End Function Public Function CoinGetOptionName(ByVal hProb As Long, ByVal OptionID As Long) As String Dim optionName As String Dim length As Long optionName = String(1000, vbNullChar) length = CoinGetOptionNameBuf(hProb, OptionID, optionName, 1000) CoinGetOptionName = Left(optionName, length) End Function Public Function CoinGetOptionShortName(ByVal hProb As Long, ByVal OptionID As Long) As String Dim shortName As String Dim length As Long shortName = String(1000, vbNullChar) length = CoinGetOptionShortNameBuf(hProb, OptionID, shortName, 1000) CoinGetOptionShortName = Left(shortName, length) End Function Public Function CoinGetStringOption(ByVal hProb As Long, ByVal OptionID As Long) As String Dim stringOption As String Dim length As Long stringOption = String(1000, vbNullChar) length = CoinGetStringOptionBuf(hProb, OptionID, stringOption, 1000) CoinGetStringOption = Left(stringOption, length) End Function CoinMP-1.8.3/CoinMP/examples/vb6/CoinMPTestVB6.vbp0000644000175000017500000000173211207660114017771 0ustar renereneType=Exe Form=FrmCoinMP.frm Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation Module=LibCoinMP; LibCoinMP.bas Module=SolveBakery; SolveBakery.bas Module=LogWrite; LogWrite.bas Module=RunProblem; RunProblem.bas Module=SolveCoinTest; SolveCoinTest.bas Module=SolveExMip1; SolveExMip1.bas Module=SolveAfiro; SolveAfiro.bas Module=SolveP0033; SolveP0033.bas IconForm="frmCoinMP" Startup="frmCoinMP" ExeName32="CoinMPTestVB6.exe" Command32="" Name="prjCoinMP" HelpContextID="0" CompatibleMode="0" MajorVer=1 MinorVer=0 RevisionVer=0 AutoIncrementVer=0 ServerSupportFiles=0 VersionCompanyName="Maximal Software, Inc." CompilationType=0 OptimizationType=0 FavorPentiumPro(tm)=0 CodeViewDebugInfo=0 NoAliasing=0 BoundsCheck=0 OverflowCheck=0 FlPointCheck=0 FDIVCheck=0 UnroundedFP=0 StartMode=0 Unattended=0 Retained=0 ThreadPerObject=0 MaxNumberOfThreads=1 [MS Transaction Server] AutoRefresh=1 CoinMP-1.8.3/CoinMP/MSVisualStudio/0000755000175000017500000000000012600453454015337 5ustar renereneCoinMP-1.8.3/CoinMP/MSVisualStudio/v9/0000755000175000017500000000000012600453454015675 5ustar renereneCoinMP-1.8.3/CoinMP/MSVisualStudio/v9/CoinMP.sln0000644000175000017500000003142012217015262017533 0ustar renerene Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libClp", "..\..\..\Clp\MSVisualStudio\v9\libClp\libClp.vcproj", "{4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v9\libCoinUtils\libCoinUtils.vcproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCgl", "..\..\..\Cgl\MSVisualStudio\v9\libCgl\libCgl.vcproj", "{DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCbc", "..\..\..\Cbc\MSVisualStudio\v9\libCbc\libCbc.vcproj", "{363BA154-FEC9-4E1E-BC23-93CEC58AB785}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "..\..\..\Osi\MSVisualStudio\v9\libOsi\libOsi.vcproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiClp", "..\..\..\Clp\MSVisualStudio\v9\libOsiClp\libOsiClp.vcproj", "{02D45875-A8CF-41B9-990B-3699C0ECFE10}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoinMP", "CoinMP\CoinMP.vcproj", "{175F0674-F0B9-479C-9C9D-76969C06D794}" ProjectSection(ProjectDependencies) = postProject {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} = {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42} {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} {363BA154-FEC9-4E1E-BC23-93CEC58AB785} = {363BA154-FEC9-4E1E-BC23-93CEC58AB785} {02D45875-A8CF-41B9-990B-3699C0ECFE10} = {02D45875-A8CF-41B9-990B-3699C0ECFE10} {71DA4595-E8A7-4B21-A00A-D96D29D11E3E} = {71DA4595-E8A7-4B21-A00A-D96D29D11E3E} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unitTest", "unitTest\unitTest.vcproj", "{9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}" ProjectSection(ProjectDependencies) = postProject {175F0674-F0B9-479C-9C9D-76969C06D794} = {175F0674-F0B9-479C-9C9D-76969C06D794} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCbcSolver", "..\..\..\Cbc\MSVisualStudio\v9\libCbcSolver\libCbcSolver.vcproj", "{71DA4595-E8A7-4B21-A00A-D96D29D11E3E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|Mixed Platforms = Debug|Mixed Platforms Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU Release|Mixed Platforms = Release|Mixed Platforms Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Any CPU.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.Build.0 = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.ActiveCfg = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.Build.0 = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Any CPU.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Mixed Platforms.Build.0 = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.Build.0 = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.ActiveCfg = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Any CPU.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Any CPU.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Mixed Platforms.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Any CPU.ActiveCfg = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.ActiveCfg = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|Win32.Build.0 = Debug|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.ActiveCfg = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Debug|x64.Build.0 = Debug|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Any CPU.ActiveCfg = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Mixed Platforms.Build.0 = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.ActiveCfg = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|Win32.Build.0 = Release|Win32 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.ActiveCfg = Release|x64 {DBEA3904-F0B8-408A-9E1A-6497FEBE8C42}.Release|x64.Build.0 = Release|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Any CPU.ActiveCfg = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Win32.ActiveCfg = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|Win32.Build.0 = Debug|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|x64.ActiveCfg = Debug|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Debug|x64.Build.0 = Debug|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Any CPU.ActiveCfg = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Mixed Platforms.Build.0 = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Win32.ActiveCfg = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|Win32.Build.0 = Release|Win32 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|x64.ActiveCfg = Release|x64 {363BA154-FEC9-4E1E-BC23-93CEC58AB785}.Release|x64.Build.0 = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Any CPU.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Any CPU.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Mixed Platforms.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Any CPU.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.Build.0 = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.ActiveCfg = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.Build.0 = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Any CPU.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Mixed Platforms.Build.0 = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.Build.0 = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.ActiveCfg = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.Build.0 = Release|x64 {175F0674-F0B9-479C-9C9D-76969C06D794}.Debug|Any CPU.ActiveCfg = Debug|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Debug|Win32.ActiveCfg = Debug|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Debug|Win32.Build.0 = Debug|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Debug|x64.ActiveCfg = Debug|x64 {175F0674-F0B9-479C-9C9D-76969C06D794}.Release|Any CPU.ActiveCfg = Release|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Release|Mixed Platforms.Build.0 = Release|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Release|Win32.ActiveCfg = Release|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Release|Win32.Build.0 = Release|Win32 {175F0674-F0B9-479C-9C9D-76969C06D794}.Release|x64.ActiveCfg = Release|x64 {175F0674-F0B9-479C-9C9D-76969C06D794}.Release|x64.Build.0 = Release|x64 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Debug|Any CPU.ActiveCfg = Debug|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Debug|Win32.ActiveCfg = Debug|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Debug|Win32.Build.0 = Debug|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Debug|x64.ActiveCfg = Debug|x64 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Release|Any CPU.ActiveCfg = Release|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Release|Mixed Platforms.Build.0 = Release|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Release|Win32.ActiveCfg = Release|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Release|Win32.Build.0 = Release|Win32 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Release|x64.ActiveCfg = Release|x64 {9F2D36EA-6D9E-42CB-A648-BCC0CB3E68E6}.Release|x64.Build.0 = Release|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Any CPU.ActiveCfg = Debug|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Win32.ActiveCfg = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|Win32.Build.0 = Debug|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|x64.ActiveCfg = Debug|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Debug|x64.Build.0 = Debug|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Any CPU.ActiveCfg = Release|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Mixed Platforms.Build.0 = Release|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Win32.ActiveCfg = Release|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|Win32.Build.0 = Release|Win32 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|x64.ActiveCfg = Release|x64 {71DA4595-E8A7-4B21-A00A-D96D29D11E3E}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/CoinMP/MSVisualStudio/v9/CoinMP/0000755000175000017500000000000012600453454017022 5ustar renereneCoinMP-1.8.3/CoinMP/MSVisualStudio/v9/CoinMP/CoinMP.vcproj0000644000175000017500000002454411512730565021407 0ustar renerene CoinMP-1.8.3/CoinMP/MSVisualStudio/v9/CoinMP/resource.h0000644000175000017500000000062011045745600021017 0ustar renerene//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by CoinMP.rc // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif CoinMP-1.8.3/CoinMP/MSVisualStudio/v9/CoinMP/CoinMP.rc0000644000175000017500000000447512263025430020501 0ustar renerene// Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "windows.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE BEGIN "resource.h\0" END 2 TEXTINCLUDE BEGIN "#include ""windows.h""\r\n" "\0" END 3 TEXTINCLUDE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 1,7,6,0 PRODUCTVERSION 1,7,6,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Maximal Software, Inc." VALUE "FileDescription", "CoinMP Dynamic Link Library" VALUE "FileVersion", "1, 7, 6, 0" VALUE "InternalName", "CoinMP" VALUE "LegalCopyright", "Copyright (C) 2002-2013" VALUE "OriginalFilename", "CoinMP.dll" VALUE "ProductName", "CoinMP Dynamic Link Library" VALUE "ProductVersion", "1, 7, 6, 0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED CoinMP-1.8.3/CoinMP/MSVisualStudio/v9/x64/0000755000175000017500000000000012600453454016316 5ustar renereneCoinMP-1.8.3/CoinMP/MSVisualStudio/v9/x64/Release/0000755000175000017500000000000012600453454017676 5ustar renereneCoinMP-1.8.3/CoinMP/MSVisualStudio/v9/release/0000755000175000017500000000000012600453454017315 5ustar renereneCoinMP-1.8.3/CoinMP/MSVisualStudio/v9/unitTest/0000755000175000017500000000000012600453454017514 5ustar renereneCoinMP-1.8.3/CoinMP/MSVisualStudio/v9/unitTest/unitTest.vcproj0000644000175000017500000001661511512730676022576 0ustar renerene CoinMP-1.8.3/CoinMP/Makefile.am0000644000175000017500000000554112462103760014503 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. ## $Id: Makefile.am 632 2015-01-28 06:55:44Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball if ALWAYS_FALSE SUBDIRS += test endif ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = \ examples/Makefile \ examples/example.c ######################################################################## # Extra Targets # ######################################################################## test: all cd test; make test unitTest: test clean-local: if test -r test/Makefile; then cd test; make clean; fi distclean-local: if test -r test/Makefile; then cd test; make distclean; fi .PHONY: test unitTest ######################################################################## # Installation of the addlibs file # # Installation of the examples dir # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = coinmp.pc addlibsdir = $(DESTDIR)$(datadir)/coin/doc/CoinMP addlibs_DATA = examples/Makefile examples/example.c install-data-hook: @$(mkdir_p) "$(addlibsdir)" if COIN_HAS_PKGCONFIG PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ $(PKG_CONFIG) --libs coinmp > $(addlibsdir)/coinmp_addlibs.txt else if COIN_CXX_IS_CL echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCoinMP.lib @CBCLIB_LIBS_INSTALLED@" > $(addlibsdir)/coin_addlibs.txt else echo -L@abs_lib_dir@ -lCoinMP @COINMP_LIBS_INSTALLED@ > $(addlibsdir)/coinmp_addlibs.txt endif endif uninstall-hook: rm -f $(addlibsdir)/coinmp_addlibs.txt install-exec-local: install-doc uninstall-local: uninstall-doc ######################################################################## # Maintainer Stuff # ######################################################################## # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = include BuildTools/Makemain.inc CoinMP-1.8.3/CoinMP/depcomp0000755000175000017500000003710011617525272014027 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/CoinMP/LICENSE0000644000175000017500000002706211032522061013445 0ustar renereneCommon Public License Version 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. CoinMP-1.8.3/CoinMP/README0000644000175000017500000000220111043701366013315 0ustar renerene CoinMP.dll is a Windows dynamic linked library (DLL) that supports most of the functionality of COIN-OR LP, COIN-OR Branch-and-Cut and Cut Generation Library projects. This CoinMP.dll distribution of the COIN-OR projects for Windows has the advantages of being: high portability, does not require any compilation, easy to use, and can be used from any other Windows application. For information how to build CoinMP, see the INSTALL file in the folder above. To use CoinMP in your own application, link in the CoinMP.lib file in the CoinMP\MSVisualStudio\v8\Release folder and copy the CoinMP.dll file to the same directory as your application. The header file CoinMP.h in the CoinMP\src folder contains the prototypes for all the functions in the DLL. The interface to this library designed to be as simple as possible, but still provide similar functionality as other solver DLL's availble. The CoinMP.dll file will work as is with the MPL for Windows Modeling System by Maximal Software. Simply copy the DLL file into the Mplwin4 installation directory and restart MPL. Bjarni Kristjansson Maximal Software CoinMP-1.8.3/CoinMP/config.sub0000755000175000017500000007772611617525272014457 0ustar renerene#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/CoinMP/makezip.bat0000644000175000017500000000376312246722562014612 0ustar renerenerd /s /q CoinMP_dist mkdir CoinMP_dist cd CoinMP_dist mkdir bin mkdir bin64 mkdir include mkdir src mkdir test mkdir examples cd examples mkdir vb6 mkdir csharp cd csharp mkdir Properties mkdir bin cd bin mkdir x86 cd x86 mkdir Release cd .. mkdir x64 cd x64 mkdir Release cd ..\..\..\.. copy ..\MSVisualStudio\v9\release\coinmp.dll bin copy ..\MSVisualStudio\v9\release\coinmp.exp bin copy ..\MSVisualStudio\v9\release\coinmp.lib bin copy ..\MSVisualStudio\v9\release\unittest.exe bin copy ..\examples\vb6\CoinMPTestVB6.exe bin copy ..\examples\csharp\bin\x86\Release\CoinMPTestCS9.exe bin copy ..\MSVisualStudio\v9\x64\release\coinmp.dll bin64 copy ..\MSVisualStudio\v9\x64\release\coinmp.exp bin64 copy ..\MSVisualStudio\v9\x64\release\coinmp.lib bin64 copy ..\MSVisualStudio\v9\x64\release\unittest.exe bin64 copy ..\examples\csharp\bin\x64\Release\CoinMPTestCS9.exe bin64 copy ..\src\CoinMP.h include copy ..\src\*.cpp src copy ..\src\*.c src copy ..\src\*.h src copy ..\src\*.def src copy ..\test\unittest.cpp test copy ..\examples\example.c examples copy ..\examples\vb6\*.bas examples\vb6 copy ..\examples\vb6\CoinMPTestVB6.vbp examples\vb6 copy ..\examples\vb6\CoinMPTestVB6.exe examples\vb6 copy ..\examples\vb6\FrmCoinMP.frm examples\vb6 copy ..\examples\csharp\*.cs examples\csharp copy ..\examples\csharp\*.csproj examples\csharp copy ..\examples\csharp\*.sln examples\csharp copy ..\examples\csharp\Form1.resx examples\csharp copy ..\examples\csharp\Properties\*.cs examples\csharp\Properties copy ..\examples\csharp\Properties\Resources.resx examples\csharp\Properties copy ..\examples\csharp\Properties\Settings.settings examples\csharp\Properties copy ..\examples\csharp\bin\x86\Release\CoinMPTestCS9.exe examples\csharp\bin\x86\Release copy ..\examples\csharp\bin\x64\Release\CoinMPTestCS9.exe examples\csharp\bin\x64\Release cd .. CoinMP-1.8.3/CoinMP/configure0000755000175000017500000272624312600330564014367 0ustar renerene#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for CoinMP 1.8.3. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # # Copyright 2006 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package CoinMP which is distributed # under the Common Public License. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='CoinMP' PACKAGE_TARNAME='coinmp' PACKAGE_VERSION='1.8.3' PACKAGE_STRING='CoinMP 1.8.3' PACKAGE_BUGREPORT='coinmp@list.coin-or.org' ac_unique_file="src/CoinMP.h" ac_default_prefix=`pwd` # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os ALWAYS_FALSE_TRUE ALWAYS_FALSE_FALSE have_svnversion COINMP_SVN_REV CDEFS ADD_CFLAGS DBG_CFLAGS OPT_CFLAGS sol_cc_compiler CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT COIN_CC_IS_CL_TRUE COIN_CC_IS_CL_FALSE MPICC CXXDEFS ADD_CXXFLAGS DBG_CXXFLAGS OPT_CXXFLAGS CXX CXXFLAGS ac_ct_CXX COIN_CXX_IS_CL_TRUE COIN_CXX_IS_CL_FALSE MPICXX EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOLM4 have_autoconf have_automake have_svn BUILDTOOLSDIR AUX_DIR abs_source_dir abs_lib_dir abs_include_dir abs_bin_dir HAVE_EXTERNALS_TRUE HAVE_EXTERNALS_FALSE host host_cpu host_vendor host_os ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ac_c_preproc_warn_flag ac_cxx_preproc_warn_flag RPATH_FLAGS DEPENDENCY_LINKING_TRUE DEPENDENCY_LINKING_FALSE LT_LDFLAGS PKG_CONFIG ac_ct_PKG_CONFIG COIN_HAS_PKGCONFIG_TRUE COIN_HAS_PKGCONFIG_FALSE COIN_PKG_CONFIG_PATH COIN_PKG_CONFIG_PATH_UNINSTALLED CBC_LIBS CBC_CFLAGS CBC_DATA CBC_DEPENDENCIES CBC_LIBS_INSTALLED CBC_CFLAGS_INSTALLED CBC_DATA_INSTALLED COINMP_CFLAGS COINMP_LIBS COINMP_PCLIBS COINMP_PCREQUIRES COINMP_DEPENDENCIES COINMP_CFLAGS_INSTALLED COINMP_LIBS_INSTALLED COIN_HAS_CBC_TRUE COIN_HAS_CBC_FALSE LIBEXT VPATH_DISTCLEANFILES ABSBUILDDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CDEFS_set=${CDEFS+set} ac_env_CDEFS_value=$CDEFS ac_cv_env_CDEFS_set=${CDEFS+set} ac_cv_env_CDEFS_value=$CDEFS ac_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_cv_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_cv_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_cv_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_cv_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_cv_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_cv_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_MPICC_set=${MPICC+set} ac_env_MPICC_value=$MPICC ac_cv_env_MPICC_set=${MPICC+set} ac_cv_env_MPICC_value=$MPICC ac_env_CXXDEFS_set=${CXXDEFS+set} ac_env_CXXDEFS_value=$CXXDEFS ac_cv_env_CXXDEFS_set=${CXXDEFS+set} ac_cv_env_CXXDEFS_value=$CXXDEFS ac_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_cv_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_cv_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_cv_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_cv_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_cv_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_cv_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_MPICXX_set=${MPICXX+set} ac_env_MPICXX_value=$MPICXX ac_cv_env_MPICXX_set=${MPICXX+set} ac_cv_env_MPICXX_value=$MPICXX ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP ac_env_F77_set=${F77+set} ac_env_F77_value=$F77 ac_cv_env_F77_set=${F77+set} ac_cv_env_F77_value=$F77 ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_env_PKG_CONFIG_value=$PKG_CONFIG ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures CoinMP 1.8.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of CoinMP 1.8.3:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug compile all projects with debug options tests (implies --disable-shared) --enable-debug-coinmp compile project CoinMP with debug compiler flags --enable-msvc Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin. --enable-static[=PKGS] build static libraries [default=no] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-dependency-linking disable linking library dependencies into shared libraries --disable-pkg-config disable use of pkg-config (if available) --disable-interpackage-dependencies disables deduction of Makefile dependencies from package linker flags Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-coinmp-verbosity specify the debug verbosity level for project CoinMP --with-coinmp-checklevel specify the sanity check level for project CoinMP --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-coin-instdir prefix of installation directory for precompiled COIN packages --with-cbc-lib linker flags for using package Cbc --with-cbc-incdir directory with header files for using package Cbc --with-cbc-datadir directory with data files for using package Cbc Some influential environment variables: CDEFS Additional -D flags to be used when compiling C code. ADD_CFLAGS Additional C compiler options DBG_CFLAGS Debug C compiler options OPT_CFLAGS Optimize C compiler options CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory MPICC C MPI Compiler CXXDEFS Additional -D flags to be used when compiling C++ code. ADD_CXXFLAGS Additional C++ compiler options DBG_CXXFLAGS Debug C++ compiler options OPT_CXXFLAGS Optimize C++ compiler options CXX C++ compiler command CXXFLAGS C++ compiler flags MPICXX C++ MPI Compiler CPP C preprocessor CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags PKG_CONFIG path to pkg-config utility Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF CoinMP configure 1.8.3 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package CoinMP which is distributed under the Common Public License. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by CoinMP $as_me 1.8.3, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # List one file in the package so that the configure script can test # whether the package is actually there # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. # As backup, we make sure we don't loose an FLIBS if it has been set # by the user save_FLIBS="$FLIBS" # A useful makefile conditional that is always false if false; then ALWAYS_FALSE_TRUE= ALWAYS_FALSE_FALSE='#' else ALWAYS_FALSE_TRUE='#' ALWAYS_FALSE_FALSE= fi # We set the following variable so that we know later in AC_COIN_FINALIZE # that we are in a project main directory coin_projectdir=yes # Set the project's version numbers cat >>confdefs.h <<_ACEOF #define COINMP_VERSION "$PACKAGE_VERSION" _ACEOF coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'` coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'` coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'` if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi cat >>confdefs.h <<_ACEOF #define COINMP_VERSION_MAJOR $coin_majorver _ACEOF cat >>confdefs.h <<_ACEOF #define COINMP_VERSION_MINOR $coin_minorver _ACEOF cat >>confdefs.h <<_ACEOF #define COINMP_VERSION_RELEASE $coin_releasever _ACEOF # We use the following variable to have a string with the upper case # version of the project name COIN_PRJCT=COINMP # Set the project's SVN revision number. The complicated sed expression # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up # as a single number. # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svnversion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svnversion"; then ac_cv_prog_have_svnversion="$have_svnversion" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svnversion="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svnversion" && ac_cv_prog_have_svnversion="no" fi fi have_svnversion=$ac_cv_prog_have_svnversion if test -n "$have_svnversion"; then echo "$as_me:$LINENO: result: $have_svnversion" >&5 echo "${ECHO_T}$have_svnversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$have_svnversion" = xyes; then svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null` if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then COINMP_SVN_REV=`echo $svn_rev_tmp | sed -n -e 's/^[0-9]*://' -e 's/\([0-9]\)[^0-9]*$/\1/p'` cat >>confdefs.h <<_ACEOF #define COINMP_SVN_REV $COINMP_SVN_REV _ACEOF fi fi # Capture libtool library version, if given. coin_libversion=9:3:8 # Check if user wants to produce debugging code echo "$as_me:$LINENO: checking whether we want to compile in debug mode" >&5 echo $ECHO_N "checking whether we want to compile in debug mode... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" case "${enableval}" in yes) coin_debug_compile=true if test "${enable_shared+set}" = set; then :; else enable_shared=no fi ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug" >&2;} { (exit 1); exit 1; }; } ;; esac else coin_debug_compile=false fi; # Check whether --enable-debug-coinmp or --disable-debug-coinmp was given. if test "${enable_debug_coinmp+set}" = set; then enableval="$enable_debug_coinmp" case "${enableval}" in yes) coin_debug_compile=true ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug-coinmp" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug-coinmp" >&2;} { (exit 1); exit 1; }; } ;; esac else : fi; # m4_ifvaln([CoinMP], if test $coin_debug_compile = true; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Check whether --with-coinmp-verbosity or --without-coinmp-verbosity was given. if test "${with_coinmp_verbosity+set}" = set; then withval="$with_coinmp_verbosity" if test "$withval" = yes; then withval=1 fi coin_coinmp_verbosity=$withval else coin_coinmp_verbosity=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_COINMP_VERBOSITY $coin_coinmp_verbosity _ACEOF # Check whether --with-coinmp-checklevel or --without-coinmp-checklevel was given. if test "${with_coinmp_checklevel+set}" = set; then withval="$with_coinmp_checklevel" if test "$withval" = yes; then withval=1 fi coin_coinmp_checklevel=$withval else coin_coinmp_checklevel=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_COINMP_CHECKLEVEL $coin_coinmp_checklevel _ACEOF # m4_ifvaln([CoinMP], # Get the name of the C++ compiler and appropriate compiler options # for backward compatibility # Check whether --enable-doscompile or --disable-doscompile was given. if test "${enable_doscompile+set}" = set; then enableval="$enable_doscompile" enable_doscompile=$enableval else enable_doscompile=no fi; # Check whether --enable-msvc or --disable-msvc was given. if test "${enable_msvc+set}" = set; then enableval="$enable_msvc" enable_msvc=$enableval else enable_msvc=no if test "$enable_doscompile" = msvc ; then enable_msvc=yes elif test "$enable_doscompile" != no ; then { { echo "$as_me:$LINENO: error: --enable-doscompile=$enable_doscompile not supported anymore." >&5 echo "$as_me: error: --enable-doscompile=$enable_doscompile not supported anymore." >&2;} { (exit 1); exit 1; }; } fi fi; if test "$enable_msvc" = MD; then enable_shared=yes enable_msvc=yes fi if test "$enable_msvc" = yes; then case $build in *-cygwin* | *-mingw*) ;; *) { { echo "$as_me:$LINENO: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&5 echo "$as_me: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&2;} { (exit 1); exit 1; }; } ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # For consistency, we set the C compiler to the same value of the C++ # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" { echo "$as_me:$LINENO: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&5 echo "$as_me: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&2;} fi ;; esac fi coin_has_cc=yes save_cflags="$CFLAGS" # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. # Depending on the user's PATH, when Studio/Workshop cc is not present we may # find /usr/ucb/cc, which is almost certainly not a good choice for the C # compiler. In this case, put cc after gcc. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl gcc" else comps="gcc icl cl" fi ;; *-*-solaris*) # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_sol_cc_compiler+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$sol_cc_compiler"; then ac_cv_prog_sol_cc_compiler="$sol_cc_compiler" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_sol_cc_compiler="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_sol_cc_compiler shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set sol_cc_compiler to just the basename; use the full file name. shift ac_cv_prog_sol_cc_compiler="$as_dir/$ac_word${1+' '}$@" fi fi fi fi sol_cc_compiler=$ac_cv_prog_sol_cc_compiler if test -n "$sol_cc_compiler"; then echo "$as_me:$LINENO: result: $sol_cc_compiler" >&5 echo "${ECHO_T}$sol_cc_compiler" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$sol_cc_compiler" = "cc" ; then comps="cc xlc gcc pgcc icc" else comps="xlc gcc pgcc icc cc" fi ;; *-*-darwin*) comps="clang gcc cc" ;; *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;; *-linux-*) comps="xlc gcc cc pgcc icc" ;; *) comps="xlc_r xlc cc gcc pgcc icc" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } # AC_MSG_NOTICE([C compiler candidates: $comps]) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -z "$CC" ; then { { echo "$as_me:$LINENO: error: Failed to find a C compiler!" >&5 echo "$as_me: error: Failed to find a C compiler!" >&2;} { (exit 1); exit 1; }; } fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; esac if test $coin_cc_is_cl = true; then COIN_CC_IS_CL_TRUE= COIN_CC_IS_CL_FALSE='#' else COIN_CC_IS_CL_TRUE='#' COIN_CC_IS_CL_FALSE= fi # Check if a project specific CFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} if test x$coin_tmp = xset; then eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} fi fi if test x"$CFLAGS" = x; then coin_add_cflags= coin_opt_cflags= coin_dbg_cflags= coin_warn_cflags= if test "$GCC" = "yes"; then case "$CC" in icc* | */icc*) ;; *) coin_opt_cflags="-O3" coin_add_cflags="-pipe" coin_dbg_cflags="-g -O0" coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cflags="-pedantic-errors $coin_warn_cflags" ;; esac esac fi if test -z "$coin_opt_cflags"; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' coin_dbg_cflags='-MDd' else coin_opt_cflags='-MT -O2' coin_dbg_cflags='-MTd' fi coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -Ox' coin_dbg_cflags='-MDd -debug' else coin_opt_cflags='-MT -Ox' coin_dbg_cflags='-MTd -debug' fi coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CC" in icc* | */icc*) coin_opt_cflags="-O3 -ip -mp1" coin_add_cflags="" coin_dbg_cflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cflags="-i_dynamic $coin_add_cflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgcc* | */pgcc*) coin_opt_cflags="-fast" coin_add_cflags="-Kieee -pc 64" coin_dbg_cflags="-g" ;; esac ;; *-ibm-*) case "$CC" in xlc* | */xlc* | mpxlc* | */mpxlc*) coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_cflags="-g" ;; esac ;; *-hp-*) coin_opt_cflags="-O" coin_add_cflags="-Ae" coin_dbg_cflags="-g" ;; *-*-solaris*) coin_opt_cflags="-xO4" coin_dbg_cflags="-g" ;; *-sgi-*) coin_opt_cflags="-O -OPT:Olimit=0" coin_dbg_cflags="-g" ;; esac fi if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then coin_dbg_cflags="-g" fi if test -z "$coin_opt_cflags"; then # Try if -O option works if nothing else is set CFLAGS="-O" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cflags" = xyes; then coin_warn_cflags= fi if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" fi DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" if test "$coin_debug_compile" = "true"; then CFLAGS="$DBG_CFLAGS" else CFLAGS="$OPT_CFLAGS" fi else CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$CFLAGS" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$CFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CFLAGS works save_CFLAGS="$CFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&2;} CFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C compiler options are: $CFLAGS" >&5 echo "$as_me: C compiler options are: $CFLAGS" >&6;} if test x"$MPICC" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C compiler $MPICC" >&5 echo "$as_me: Will use MPI C compiler $MPICC" >&6;} CC="$MPICC" fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #Let's try if that overcomes configuration problem with VC++ 6.0 ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_has_cxx=yes save_cxxflags="$CXXFLAGS" # For *-*-solaris*, promote Studio/Workshop compiler to front of list. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl g++" else comps="g++ icl cl" fi ;; *-*-solaris*) comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; *-darwin*) comps="clang++ g++ c++ CC" ;; *-linux-gnu*) comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;; *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } # AC_MSG_NOTICE([C++ compiler candidates: $comps]) ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler #thus, we test here whether $CXX is actually working ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking whether C++ compiler $CXX works" >&5 echo $ECHO_N "checking whether C++ compiler $CXX works... $ECHO_C" >&6; cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&5 echo "$as_me: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_cxx_is_cl=false # It seems that we need to cleanup something here for the Windows case "$CXX" in clang* | */clang*) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh mv confdefs.hh confdefs.h coin_cxx_is_cl=true ;; esac # add automake conditional so we can recognize cl compiler in makefile if test $coin_cxx_is_cl = true; then COIN_CXX_IS_CL_TRUE= COIN_CXX_IS_CL_FALSE='#' else COIN_CXX_IS_CL_TRUE='#' COIN_CXX_IS_CL_FALSE= fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CXXFLAGS="$save_cxxflags" # Check if a project specific CXXFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} if test x$coin_tmp = xset; then eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} fi fi if test x"$CXXFLAGS" = x; then # ToDo decide whether we want -DNDEBUG for optimization coin_add_cxxflags= coin_opt_cxxflags= coin_dbg_cxxflags= coin_warn_cxxflags= if test "$GXX" = "yes"; then case "$CXX" in icpc* | */icpc*) ;; *) # ToDo decide about unroll-loops coin_opt_cxxflags="-O3" coin_add_cxxflags="-pipe" coin_dbg_cxxflags="-g -O0" coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" ;; esac esac fi # Note that we do not need to cover GCC in the following tests. if test -z "$coin_opt_cxxflags"; then case $build in *-cygwin* | *-mingw*) case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -O2' coin_dbg_cxxflags='-MDd' else coin_opt_cxxflags='-MT -O2' coin_dbg_cxxflags='-MTd' fi coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -Ox' coin_dbg_cxxflags='-MDd -debug' else coin_opt_cxxflags='-MT -Ox' coin_dbg_cxxflags='-MTd -debug' fi coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CXX" in icpc* | */icpc*) coin_opt_cxxflags="-O3 -ip -mp1" coin_add_cxxflags="" coin_dbg_cxxflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CXXFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cxxflags="-i_dynamic $coin_add_cxxflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgCC* | */pgCC*) coin_opt_cxxflags="-fast" coin_add_cxxflags="-Kieee -pc 64" coin_dbg_cxxflags="-g" ;; esac ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" coin_dbg_cxxflags="-g" ;; esac ;; *-hp-*) case "$CXX" in aCC* | */aCC* ) coin_opt_cxxflags="-O" coin_add_cxxflags="-AA" coin_dbg_cxxflags="-g" ;; esac ;; *-*-solaris*) coin_opt_cxxflags="-O4" coin_dbg_cxxflags="-g" ;; esac fi # Generic flag settings. If these don't work, add a case above. if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then coin_dbg_cxxflags="-g" fi if test -z "$coin_opt_cxxflags"; then # Try if -O option works if nothing else is set CXXFLAGS=-O cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cxxflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cxxflags" = xyes; then coin_warn_cxxflags= fi # Do final setup of flags based on values determined above. if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" fi DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test "$coin_debug_compile" = "true"; then CXXFLAGS="$DBG_CXXFLAGS" else CXXFLAGS="$OPT_CXXFLAGS" fi # Handle the case where CXXFLAGS was set externally. else CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$CXXFLAGS" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$CXXFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CXXFLAGS works save_CXXFLAGS="$CXXFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&2;} CXXFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C++ compiler options are: $CXXFLAGS" >&5 echo "$as_me: C++ compiler options are: $CXXFLAGS" >&6;} if test x"$MPICXX" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C++ compiler $MPICXX" >&5 echo "$as_me: Will use MPI C++ compiler $MPICXX" >&6;} CXX="$MPICXX" fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Initialize automake and libtool { # START coin_disable_shared=no # Test if force_shared has been set if test "x" = xforce_shared; then if test x$enable_shared = xno; then { { echo "$as_me:$LINENO: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&5 echo "$as_me: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&2;} { (exit 1); exit 1; }; } fi enable_shared=yes; else case $build in *-cygwin* | *-mingw*) coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in clang* ) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Building of DLLs not supported in this configuration." >&5 echo "$as_me: Building of DLLs not supported in this configuration." >&6;} ;; *gcc*) if test x"$enable_dependency_linking" = xyes; then coin_disable_shared=no else { echo "$as_me:$LINENO: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&5 echo "$as_me: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&2;} fi ;; *) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; esac fi ;; *-aix*) coin_disable_shared=yes platform=AIX if test x"$enable_shared" = xyes; then { echo "$as_me:$LINENO: WARNING: Shared objects are not supported." >&5 echo "$as_me: WARNING: Shared objects are not supported." >&2;} fi ;; esac fi if test x"$coin_disable_shared" = xyes; then if test x"$enable_shared" = xyes; then : else # we don't disable shared, because it was not selected anyway coin_disable_shared=no fi enable_shared=no fi # By default, we only want the shared objects to be compiled # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=no fi; # Initialize automake echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='coinmp' VERSION='1.8.3' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi depcc="$CXX" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME echo "$as_me:$LINENO: checking whether we are using the correct autotools" >&5 echo $ECHO_N "checking whether we are using the correct autotools... $ECHO_C" >&6 if test "${ac_cv_use_correct_autotools+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_correct_autotools=check fi echo "$as_me:$LINENO: result: $ac_cv_use_correct_autotools" >&5 echo "${ECHO_T}$ac_cv_use_correct_autotools" >&6 if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_autoconf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_autoconf"; then ac_cv_prog_have_autoconf="$have_autoconf" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_autoconf="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_autoconf" && ac_cv_prog_have_autoconf="no" fi fi have_autoconf=$ac_cv_prog_have_autoconf if test -n "$have_autoconf"; then echo "$as_me:$LINENO: result: $have_autoconf" >&5 echo "${ECHO_T}$have_autoconf" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_autoconf = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of autoconf" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of autoconf... $ECHO_C" >&6 autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of autoconf as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of autoconf as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location echo "$as_me:$LINENO: checking whether autoconf is coming from the correct location" >&5 echo $ECHO_N "checking whether autoconf is coming from the correct location... $ECHO_C" >&6 autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if we have automake # Extract the first word of "automake", so it can be a program name with args. set dummy automake; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_automake+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_automake"; then ac_cv_prog_have_automake="$have_automake" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_automake="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_automake" && ac_cv_prog_have_automake="no" fi fi have_automake=$ac_cv_prog_have_automake if test -n "$have_automake"; then echo "$as_me:$LINENO: result: $have_automake" >&5 echo "${ECHO_T}$have_automake" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_automake = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of automake" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of automake... $ECHO_C" >&6 automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of automake as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of automake as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable automake is picked up from the correct location echo "$as_me:$LINENO: checking whether automake is coming from the correct location" >&5 echo $ECHO_N "checking whether automake is coming from the correct location... $ECHO_C" >&6 automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` if test -r $want_dir/libtool/ltmain.sh; then have_ltmain=yes : else have_ltmain=no : fi echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of libtool." >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of libtool.... $ECHO_C" >&6 if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of libtool." >&5 echo "$as_me: error: You don't have the correct version of libtool." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: I cannot find the ltmain.sh file." >&5 echo "$as_me: error: I cannot find the ltmain.sh file." >&2;} { (exit 1); exit 1; }; } fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi if test -r $want_dir/aclocal/libtool.m4; then LIBTOOLM4="$want_dir/aclocal/libtool.m4" : else { { echo "$as_me:$LINENO: error: I cannot find the libtool.m4 file." >&5 echo "$as_me: error: I cannot find the libtool.m4 file." >&2;} { (exit 1); exit 1; }; } : fi # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https # Extract the first word of "svn", so it can be a program name with args. set dummy svn; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svn"; then ac_cv_prog_have_svn="$have_svn" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svn="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svn" && ac_cv_prog_have_svn="no" fi fi have_svn=$ac_cv_prog_have_svn if test -n "$have_svn"; then echo "$as_me:$LINENO: result: $have_svn" >&5 echo "${ECHO_T}$have_svn" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$have_svn = xyes; then echo "$as_me:$LINENO: checking whether svn understands https" >&5 echo $ECHO_N "checking whether svn understands https... $ECHO_C" >&6 if test "${ac_cv_svn_understands_https+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out fi echo "$as_me:$LINENO: result: $ac_cv_svn_understands_https" >&5 echo "${ECHO_T}$ac_cv_svn_understands_https" >&6 fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else { { echo "$as_me:$LINENO: error: Cannot find the BuildTools directory" >&5 echo "$as_me: error: Cannot find the BuildTools directory" >&2;} { (exit better disable maintainer mode.); exit better disable maintainer mode.; }; } fi fi fi # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` abs_lib_dir=$full_prefix/lib abs_include_dir=$full_prefix/include abs_bin_dir=$full_prefix/bin if test $coin_have_externals = yes && test x$have_svn = xyes; then HAVE_EXTERNALS_TRUE= HAVE_EXTERNALS_FALSE='#' else HAVE_EXTERNALS_TRUE='#' HAVE_EXTERNALS_FALSE= fi # AC_MSG_NOTICE([End automake initialisation.]) LIBTOOL= if test -f ../libtool; then coin_config_dir=.. LIBTOOL='$(SHELL) $(top_builddir)/../libtool' fi if test "x$LIBTOOL" = x; then if test -f ../../libtool; then coin_config_dir=../.. LIBTOOL='$(SHELL) $(top_builddir)/../../libtool' fi fi if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) # Stuff for libtool # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi; echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done fi SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix4* | aix5*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | kfreebsd*-gnu | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 5814 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to coinmp@list.coin-or.org ## ## -------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done F77=$ac_ct_F77 fi # Provide some information about the compiler. echo "$as_me:6948:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 else echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux*) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6 else echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 fi echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6 if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6 objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAGIC_CMD=: fi fi fi ;; esac enable_dlopen=no enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default fi; test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8015: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8019: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8283: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8287: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 if test x"$lt_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works=yes fi else lt_prog_compiler_static_works=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 if test x"$lt_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8387: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:8391: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix3*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs=no ;; esac fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var" || \ test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which library types will actually be built echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags or --without-tags was given. if test "${with_tags+set}" = set; then withval="$with_tags" tagnames="$withval" fi; if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_CXX=yes else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_CXX=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_CXX='+b $libdir' ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix3*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. We must also pass each convience library through # to the system linker between allextract/defaultextract. # The C++ compiler will combine linker options so we # cannot just pass the convience library names through # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix3*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; solaris*) case $cc_basename in CC*) # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. postdeps_CXX='-lCstd -lCrun' ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13176: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:13180: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_CXX=yes fi else lt_prog_compiler_static_works_CXX=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 if test x"$lt_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13280: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:13284: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var_CXX" || \ test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6 if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_CXX" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code=" subroutine t\n return\n end\n" # Code to be used in simple link tests lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14850: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14854: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_F77=yes fi else lt_prog_compiler_static_works_F77=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 if test x"$lt_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14954: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:14958: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix3*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_F77=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_F77=yes else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_F77=no ;; esac fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var_F77" || \ test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6 if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_F77" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no old_archive_cmds_GCJ=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17161: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17165: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_GCJ='-Qoption ld ';; *) lt_prog_compiler_wl_GCJ='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; unicos*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_can_build_shared_GCJ=no ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17429: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17433: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_GCJ=yes fi else lt_prog_compiler_static_works_GCJ=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17533: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:17537: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix3*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_GCJ=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = no; then runpath_var= hardcode_libdir_flag_spec_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_GCJ=yes else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_GCJ=no ;; esac fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6 test "$ld_shlibs_GCJ" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ pic_flag=$lt_prog_compiler_pic_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var_GCJ" || \ test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6 if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_GCJ" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_RC" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion # No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- # AC_REQUIRE([AC_COIN_DLFCN_H]) # NEW: If libtool exists in the directory higher up, we use that one # instead of creating a new one # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED # out in front of this macro body. You'll notice that LIBTOOL is already # defined here. We'll have to count on this macro not being called if libtool # already exists, or at least move the libtool fixes outside the conditional. # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".]) # This test is therefore removed. -- lh, 061214 -- # if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Calling PROG_LIBTOOL.]) # AC_MSG_NOTICE([Finished PROG_LIBTOOL.]) { echo "$as_me:$LINENO: Build is \"$build\"." >&5 echo "$as_me: Build is \"$build\"." >&6;} mydos2unix='| dos2unix' case $build in *-mingw*) CYGPATH_W=echo mydos2unix= ;; esac case $build in # Here we need to check if -m32 is specified. If so, we need to correct # sys_lib_search_path_spec *-cygwin* | *-mingw*) case "$CXX" in clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? { echo "$as_me:$LINENO: Applying patches to libtool for CLANG compiler" >&5 echo "$as_me: Applying patches to libtool for CLANG compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Applying patches to libtool for cl compiler" >&5 echo "$as_me: Applying patches to libtool for cl compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%lib /OUT:%lib -OUT:%' \ -e "s%cygpath -w%$CYGPATH_W%" \ -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$1"'); done%' \ -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$1"') '"$mydos2unix"'%' \ -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ libtool > conftest.bla ;; *) { echo "$as_me:$LINENO: Applying patches to libtool for GNU compiler" >&5 echo "$as_me: Applying patches to libtool for GNU compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; esac mv conftest.bla libtool chmod 755 libtool ;; *x86_64-*) if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then { echo "$as_me:$LINENO: Applying patches to libtool for 32bit compilation" >&5 echo "$as_me: Applying patches to libtool for 32bit compilation" >&6;} sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi ;; *-solaris*) if test "$GCC" = yes && \ (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then hdwisa=`isainfo | sed -e 's/\([^ ]*\) .*$/\1/'` if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then { echo "$as_me:$LINENO: Applying patches to libtool for 64-bit GCC compilation" >&5 echo "$as_me: Applying patches to libtool for 64-bit GCC compilation" >&6;} fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then # AC_MSG_NOTICE(Compensating for broken gcc) for lib in $fixlibtmp ; do if test -d "${lib}${hdwisa}" ; then syslibpath64="$syslibpath64 ${lib}${hdwisa}/" fi done syslibpath64="${syslibpath64} ${fixlibtmp}" else syslibpath64="$fixlibtmp" fi sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi # AC_MSG_NOTICE(Result is ) # $EGREP 'sys_lib_search_path_spec=' libtool fi ;; # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. *-darwin*) { echo "$as_me:$LINENO: Applying patches to libtool for Darwin" >&5 echo "$as_me: Applying patches to libtool for Darwin" >&6;} sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool ;; esac # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of # the macro. -- lh, 061214 -- # fi # AC_MSG_NOTICE([End libtool initialisation.]) # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) # set RPATH_FLAGS to the compiler link flags required to hardcode location # of the shared objects RPATH_FLAGS= if test $enable_shared = yes; then case $build in *-linux-*) if test "$GXX" = "yes"; then RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" done fi ;; *-darwin*) RPATH_FLAGS=nothing ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) RPATH_FLAGS=nothing ;; esac ;; *-hp-*) RPATH_FLAGS=nothing ;; *-mingw32) RPATH_FLAGS=nothing ;; *-*-solaris*) RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -R$dir" done esac if test "$RPATH_FLAGS" = ""; then { echo "$as_me:$LINENO: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&5 echo "$as_me: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&2;} fi if test "$RPATH_FLAGS" = "nothing"; then RPATH_FLAGS= fi fi else { echo "$as_me:$LINENO: Using libtool script in directory $coin_config_dir" >&5 echo "$as_me: Using libtool script in directory $coin_config_dir" >&6;} # get all missing information from the config.log file # output variables and defines as_save_IFS=$IFS IFS=' ' for oneline in `cat $coin_config_dir/config.status`; do case "$oneline" in # First some automake conditionals s,@am__fastdep* | s,@AR@* | s,@CPP@* | s,@CPPFLAGS@* | s,@CXXCPP@* | \ s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \ s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \ s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; s,@DEFS@* ) command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; esac done IFS=$as_save_IFS # And some defines (assuming here that the packages base dir # doesn't have a config.h file for word in $defsline; do # echo word $word case $word in -DHAVE_[A-Z_]*_H=1 | -DSTDC_HEADERS=1 ) i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` # echo dd $i echo $i >>confdefs.h ;; esac done fi # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) # Check whether --enable-dependency-linking or --disable-dependency-linking was given. if test "${enable_dependency_linking+set}" = set; then enableval="$enable_dependency_linking" dependency_linking="$enableval" else dependency_linking=auto fi; if test "$dependency_linking" = auto; then # On Cygwin and AIX, building DLLs doesn't work dependency_linking=no if test x"$coin_disable_shared" = xno; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) dependency_linking=no ;; *gcc*) dependency_linking=yes ;; *) dependency_linking=yes ;; esac ;; *) dependency_linking=yes ;; esac fi fi if test "$dependency_linking" = yes ; then LT_LDFLAGS="-no-undefined" else LT_LDFLAGS= fi if test "$dependency_linking" = yes; then DEPENDENCY_LINKING_TRUE= DEPENDENCY_LINKING_FALSE='#' else DEPENDENCY_LINKING_TRUE='#' DEPENDENCY_LINKING_FALSE= fi # Check if we want to set the library version echo "$as_me:$LINENO: checking if library version is set" >&5 echo $ECHO_N "checking if library version is set... $ECHO_C" >&6 if test x"$coin_libversion" != x; then LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion" echo "$as_me:$LINENO: result: $coin_libversion" >&5 echo "${ECHO_T}$coin_libversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi #END } ############################################################################# # COIN-OR components # ############################################################################# # Required packages. # We need Clp, Cbc, and the OSI interface to CLP to build CoinCbc.cpp. # Check whether --enable-pkg-config or --disable-pkg-config was given. if test "${enable_pkg_config+set}" = set; then enableval="$enable_pkg_config" use_pkgconfig="$enableval" else if test x$coin_cc_is_cl = xtrue; then use_pkgconfig=no else use_pkgconfig=yes fi fi; if test $use_pkgconfig = yes ; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PKG_CONFIG=$ac_cv_prog_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_PKG_CONFIG"; then ac_ct_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_PKG_CONFIG"; then ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG if test -n "$ac_ct_PKG_CONFIG"; then echo "$as_me:$LINENO: result: $ac_ct_PKG_CONFIG" >&5 echo "${ECHO_T}$ac_ct_PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi PKG_CONFIG=$ac_ct_PKG_CONFIG else PKG_CONFIG="$ac_cv_prog_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.16.0 echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 PKG_CONFIG="" fi fi # check if pkg-config supports the short-errors flag if test -n "$PKG_CONFIG" && \ $PKG_CONFIG --atleast-pkgconfig-version 0.20; then pkg_short_errors=" --short-errors " else pkg_short_errors="" fi fi if test -n "$PKG_CONFIG"; then COIN_HAS_PKGCONFIG_TRUE= COIN_HAS_PKGCONFIG_FALSE='#' else COIN_HAS_PKGCONFIG_TRUE='#' COIN_HAS_PKGCONFIG_FALSE= fi # assemble pkg-config search path for installed projects COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" # let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there # best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig, # unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}... if test "x${prefix}" = xNONE ; then COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" else COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi # Check whether --with-coin-instdir or --without-coin-instdir was given. if test "${with_coin_instdir+set}" = set; then withval="$with_coin_instdir" if test -d "$withval"; then : ; else { { echo "$as_me:$LINENO: error: argument for --with-coin-instdir not a directory" >&5 echo "$as_me: error: argument for --with-coin-instdir not a directory" >&2;} { (exit 1); exit 1; }; } fi COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi; # assemble additional pkg-config search paths for uninstalled projects if test x$coin_projectdir = xyes ; then # if we are in a project setup, then in a classic setup, we want to find uninstalled projects # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory # unfortunately, if the user set prefix, then we do not know where the project base directory is located # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data) COIN_PKG_CONFIG_PATH_UNINSTALLED= if test -f ../coin_subdirs.txt ; then for i in `cat ../coin_subdirs.txt` ; do if test -d ../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi if test -f ../../coin_subdirs.txt ; then for i in `cat ../../coin_subdirs.txt` ; do if test -d ../../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi fi if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then { echo "$as_me:$LINENO: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&5 echo "$as_me: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&2;} fi echo "$as_me:$LINENO: checking for COIN-OR package Cbc" >&5 echo $ECHO_N "checking for COIN-OR package Cbc... $ECHO_C" >&6 coin_has_cbc=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Cbc"; then coin_has_cbc=skipping fi done fi if test "$coin_has_cbc" != skipping; then # Check whether --with-m4_tolower(Cbc) or --without-m4_tolower(Cbc) was given. if test "${with_cbc+set}" = set; then withval="$with_cbc" if test "$withval" = no ; then coin_has_cbc=skipping fi fi; fi CBC_LIBS= CBC_CFLAGS= CBC_DATA= CBC_DEPENDENCIES= CBC_PCLIBS= CBC_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_cbc != skipping; then # Check whether --with-m4_tolower(Cbc)-lib or --without-m4_tolower(Cbc)-lib was given. if test "${with_cbc_lib+set}" = set; then withval="$with_cbc_lib" if test "$withval" = no ; then coin_has_cbc=skipping else coin_has_cbc=yes CBC_LIBS="$withval" CBC_PCLIBS="$withval" COINMP_PCLIBS="$withval $COINMP_PCLIBS" COINMP_LIBS="$withval $COINMP_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CBC_LIBS_INSTALLED="$withval" COINMP_LIBS_INSTALLED="$withval $COINMP_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_cbc != skipping; then # Check whether --with-m4_tolower(Cbc)-incdir or --without-m4_tolower(Cbc)-incdir was given. if test "${with_cbc_incdir+set}" = set; then withval="$with_cbc_incdir" if test "$withval" = no ; then coin_has_cbc=skipping else coin_has_cbc=yes CBC_CFLAGS="-I`${CYGPATH_W} $withval`" COINMP_CFLAGS="-I`${CYGPATH_W} $withval` $COINMP_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CBC_CFLAGS_INSTALLED="$CBC_CFLAGS" COINMP_CFLAGS_INSTALLED="$CBC_CFLAGS $COINMP_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_cbc != skipping; then # Check whether --with-m4_tolower(Cbc)-datadir or --without-m4_tolower(Cbc)-datadir was given. if test "${with_cbc_datadir+set}" = set; then withval="$with_cbc_datadir" if test "$withval" = no ; then coin_has_cbc=skipping else coin_has_cbc=yes CBC_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then CBC_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_cbc = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "cbc clp osi-clp"; then CBC_VERSIONS=`$PKG_CONFIG --modversion "cbc clp osi-clp" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "cbc clp osi-clp" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CBC_CFLAGS="$cflags" CBC_LIBS=`$PKG_CONFIG --libs "cbc clp osi-clp" 2>/dev/null` CBC_DATA=`$PKG_CONFIG --variable=datadir "cbc clp osi-clp" 2>/dev/null` coin_has_cbc=yes echo "$as_me:$LINENO: result: yes: $CBC_VERSIONS" >&5 echo "${ECHO_T}yes: $CBC_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then CBC_LIBS=`echo " $CBC_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi CBC_PCREQUIRES="cbc clp osi-clp" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CoinMP COINMP_PCREQUIRES="cbc clp osi-clp $COINMP_PCREQUIRES" COINMP_CFLAGS="$CBC_CFLAGS $COINMP_CFLAGS" COINMP_LIBS="$CBC_LIBS $COINMP_LIBS" else CBC_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "cbc clp osi-clp"` coin_has_cbc=notGiven echo "$as_me:$LINENO: result: not given: $CBC_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $CBC_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Cbc without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Cbc without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Cbc (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Cbc (fallback)... $ECHO_C" >&6 coin_has_cbc=notGiven CBC_LIBS= CBC_LIBS_INSTALLED= CBC_CFLAGS= CBC_CFLAGS_INSTALLED= CBC_DATA= CBC_DATA_INSTALLED= CBC_PCLIBS= CBC_PCREQUIRES= # initial list of dependencies is "cbc clp osi-clp", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="cbc clp osi-clp" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$CBC_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` CBC_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$CBC_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi CBC_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CBC_CFLAGS="$projcflags $CBC_CFLAGS" # set LIBS variable CBC_LIBS="$projlibs $CBC_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi CBC_CFLAGS_INSTALLED="$projcflags $CBC_CFLAGS_INSTALLED" # set LIBS variable CBC_LIBS_INSTALLED="$projlibs $CBC_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_cbc=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_CBC 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then CBC_LIBS=`echo " $CBC_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` CBC_LIBS_INSTALLED=`echo " $CBC_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi CBC_PCREQUIRES="cbc clp osi-clp" COINMP_PCREQUIRES="cbc clp osi-clp $COINMP_PCREQUIRES" COINMP_CFLAGS="$CBC_CFLAGS $COINMP_CFLAGS" COINMP_LIBS="$CBC_LIBS $COINMP_LIBS" COINMP_CFLAGS_INSTALLED="$CBC_CFLAGS_INSTALLED $COINMP_CFLAGS_INSTALLED" COINMP_LIBS_INSTALLED="$CBC_LIBS_INSTALLED $COINMP_LIBS_INSTALLED" fi if test $coin_has_cbc != notGiven && test $coin_has_cbc != skipping; then COIN_HAS_CBC_TRUE= COIN_HAS_CBC_FALSE='#' else COIN_HAS_CBC_TRUE='#' COIN_HAS_CBC_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_cbc" >&5 echo "${ECHO_T}$coin_has_cbc" >&6 fi if test $coin_has_cbc != skipping && test $coin_has_cbc != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_CBC 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) CBC_DEPENDENCIES=`echo " $CBC_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` COINMP_DEPENDENCIES=`echo " $COINMP_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$CBC_CFLAGS" ; then { echo "$as_me:$LINENO: Cbc CFLAGS are $CBC_CFLAGS" >&5 echo "$as_me: Cbc CFLAGS are $CBC_CFLAGS" >&6;} fi if test -n "$CBC_LIBS" ; then { echo "$as_me:$LINENO: Cbc LIBS are $CBC_LIBS" >&5 echo "$as_me: Cbc LIBS are $CBC_LIBS" >&6;} fi if test -n "$CBC_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Cbc DEPENDENCIES are $CBC_DEPENDENCIES" >&5 echo "$as_me: Cbc DEPENDENCIES are $CBC_DEPENDENCIES" >&6;} fi if test -n "$CBC_DATA" ; then { echo "$as_me:$LINENO: Cbc DATA is $CBC_DATA" >&5 echo "$as_me: Cbc DATA is $CBC_DATA" >&6;} fi if test -n "$CBC_PCLIBS" ; then { echo "$as_me:$LINENO: Cbc PCLIBS are $CBC_PCLIBS" >&5 echo "$as_me: Cbc PCLIBS are $CBC_PCLIBS" >&6;} fi if test -n "$CBC_PCREQUIRES" ; then { echo "$as_me:$LINENO: Cbc PCREQUIRES are $CBC_PCREQUIRES" >&5 echo "$as_me: Cbc PCREQUIRES are $CBC_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CoinMP CFLAGS are $COINMP_CFLAGS" >&5 echo "$as_me: CoinMP CFLAGS are $COINMP_CFLAGS" >&6;} { echo "$as_me:$LINENO: CoinMP LIBS are $COINMP_LIBS" >&5 echo "$as_me: CoinMP LIBS are $COINMP_LIBS" >&6;} { echo "$as_me:$LINENO: CoinMP DEPENDENCIES are $COINMP_DEPENDENCIES" >&5 echo "$as_me: CoinMP DEPENDENCIES are $COINMP_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_cbc != notGiven && test $coin_has_cbc != skipping; then COIN_HAS_CBC_TRUE= COIN_HAS_CBC_FALSE='#' else COIN_HAS_CBC_TRUE='#' COIN_HAS_CBC_FALSE= fi if test $coin_has_cbc != yes; then { { echo "$as_me:$LINENO: error: \"Required package Cbc unavailable.\"" >&5 echo "$as_me: error: \"Required package Cbc unavailable.\"" >&2;} { (exit 1); exit 1; }; } fi ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) ac_config_files="$ac_config_files Makefile src/Makefile test/Makefile examples/Makefile coinmp.pc coinmp-uninstalled.pc" # Here put the location and name of the configuration header file ac_config_headers="$ac_config_headers src/config.h src/config_coinmp.h" # Finally, we let configure write all the output... echo "$as_me:$LINENO: checking which command should be used to link input files" >&5 echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac echo "$as_me:$LINENO: result: $coin_link_input_cmd" >&5 echo "${ECHO_T}$coin_link_input_cmd" >&6 if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${ALWAYS_FALSE_TRUE}" && test -z "${ALWAYS_FALSE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CC_IS_CL_TRUE}" && test -z "${COIN_CC_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CXX_IS_CL_TRUE}" && test -z "${COIN_CXX_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_EXTERNALS_TRUE}" && test -z "${HAVE_EXTERNALS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${DEPENDENCY_LINKING_TRUE}" && test -z "${DEPENDENCY_LINKING_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_PKGCONFIG_TRUE}" && test -z "${COIN_HAS_PKGCONFIG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_CBC_TRUE}" && test -z "${COIN_HAS_CBC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_CBC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_CBC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_CBC_TRUE}" && test -z "${COIN_HAS_CBC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_CBC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_CBC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by CoinMP $as_me 1.8.3, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ CoinMP config.status 1.8.3 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "coinmp.pc" ) CONFIG_FILES="$CONFIG_FILES coinmp.pc" ;; "coinmp-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES coinmp-uninstalled.pc" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "src/config_coinmp.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config_coinmp.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@ALWAYS_FALSE_TRUE@,$ALWAYS_FALSE_TRUE,;t t s,@ALWAYS_FALSE_FALSE@,$ALWAYS_FALSE_FALSE,;t t s,@have_svnversion@,$have_svnversion,;t t s,@COINMP_SVN_REV@,$COINMP_SVN_REV,;t t s,@CDEFS@,$CDEFS,;t t s,@ADD_CFLAGS@,$ADD_CFLAGS,;t t s,@DBG_CFLAGS@,$DBG_CFLAGS,;t t s,@OPT_CFLAGS@,$OPT_CFLAGS,;t t s,@sol_cc_compiler@,$sol_cc_compiler,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@COIN_CC_IS_CL_TRUE@,$COIN_CC_IS_CL_TRUE,;t t s,@COIN_CC_IS_CL_FALSE@,$COIN_CC_IS_CL_FALSE,;t t s,@MPICC@,$MPICC,;t t s,@CXXDEFS@,$CXXDEFS,;t t s,@ADD_CXXFLAGS@,$ADD_CXXFLAGS,;t t s,@DBG_CXXFLAGS@,$DBG_CXXFLAGS,;t t s,@OPT_CXXFLAGS@,$OPT_CXXFLAGS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@COIN_CXX_IS_CL_TRUE@,$COIN_CXX_IS_CL_TRUE,;t t s,@COIN_CXX_IS_CL_FALSE@,$COIN_CXX_IS_CL_FALSE,;t t s,@MPICXX@,$MPICXX,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBTOOLM4@,$LIBTOOLM4,;t t s,@have_autoconf@,$have_autoconf,;t t s,@have_automake@,$have_automake,;t t s,@have_svn@,$have_svn,;t t s,@BUILDTOOLSDIR@,$BUILDTOOLSDIR,;t t s,@AUX_DIR@,$AUX_DIR,;t t s,@abs_source_dir@,$abs_source_dir,;t t s,@abs_lib_dir@,$abs_lib_dir,;t t s,@abs_include_dir@,$abs_include_dir,;t t s,@abs_bin_dir@,$abs_bin_dir,;t t s,@HAVE_EXTERNALS_TRUE@,$HAVE_EXTERNALS_TRUE,;t t s,@HAVE_EXTERNALS_FALSE@,$HAVE_EXTERNALS_FALSE,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@CXXCPP@,$CXXCPP,;t t s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@ac_c_preproc_warn_flag@,$ac_c_preproc_warn_flag,;t t s,@ac_cxx_preproc_warn_flag@,$ac_cxx_preproc_warn_flag,;t t s,@RPATH_FLAGS@,$RPATH_FLAGS,;t t s,@DEPENDENCY_LINKING_TRUE@,$DEPENDENCY_LINKING_TRUE,;t t s,@DEPENDENCY_LINKING_FALSE@,$DEPENDENCY_LINKING_FALSE,;t t s,@LT_LDFLAGS@,$LT_LDFLAGS,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@ac_ct_PKG_CONFIG@,$ac_ct_PKG_CONFIG,;t t s,@COIN_HAS_PKGCONFIG_TRUE@,$COIN_HAS_PKGCONFIG_TRUE,;t t s,@COIN_HAS_PKGCONFIG_FALSE@,$COIN_HAS_PKGCONFIG_FALSE,;t t s,@COIN_PKG_CONFIG_PATH@,$COIN_PKG_CONFIG_PATH,;t t s,@COIN_PKG_CONFIG_PATH_UNINSTALLED@,$COIN_PKG_CONFIG_PATH_UNINSTALLED,;t t s,@CBC_LIBS@,$CBC_LIBS,;t t s,@CBC_CFLAGS@,$CBC_CFLAGS,;t t s,@CBC_DATA@,$CBC_DATA,;t t s,@CBC_DEPENDENCIES@,$CBC_DEPENDENCIES,;t t s,@CBC_LIBS_INSTALLED@,$CBC_LIBS_INSTALLED,;t t s,@CBC_CFLAGS_INSTALLED@,$CBC_CFLAGS_INSTALLED,;t t s,@CBC_DATA_INSTALLED@,$CBC_DATA_INSTALLED,;t t s,@COINMP_CFLAGS@,$COINMP_CFLAGS,;t t s,@COINMP_LIBS@,$COINMP_LIBS,;t t s,@COINMP_PCLIBS@,$COINMP_PCLIBS,;t t s,@COINMP_PCREQUIRES@,$COINMP_PCREQUIRES,;t t s,@COINMP_DEPENDENCIES@,$COINMP_DEPENDENCIES,;t t s,@COINMP_CFLAGS_INSTALLED@,$COINMP_CFLAGS_INSTALLED,;t t s,@COINMP_LIBS_INSTALLED@,$COINMP_LIBS_INSTALLED,;t t s,@COIN_HAS_CBC_TRUE@,$COIN_HAS_CBC_TRUE,;t t s,@COIN_HAS_CBC_FALSE@,$COIN_HAS_CBC_FALSE,;t t s,@LIBEXT@,$LIBEXT,;t t s,@VPATH_DISTCLEANFILES@,$VPATH_DISTCLEANFILES,;t t s,@ABSBUILDDIR@,$ABSBUILDDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then { echo "$as_me:$LINENO: Copying data files for VPATH configuration" >&5 echo "$as_me: Copying data files for VPATH configuration" >&6;} else { echo "$as_me:$LINENO: Creating VPATH links for data files" >&5 echo "$as_me: Creating VPATH links for data files" >&6;} fi for file in $coin_vpath_link_files; do dir=`(dirname "./$file") 2>/dev/null || $as_expr X"./$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"./$file" : 'X\(//\)[^/]' \| \ X"./$file" : 'X\(//\)$' \| \ X"./$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"./$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test -d $dir; then : ; else { if $as_mkdir_p; then mkdir -p $dir else as_dir=$dir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dir" >&5 echo "$as_me: error: cannot create directory $dir" >&2;} { (exit 1); exit 1; }; }; } fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi { echo "$as_me:$LINENO: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&5 echo "$as_me: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&6;} if test x$coin_projectdir = xyes; then { echo "$as_me:$LINENO: Configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} else { echo "$as_me:$LINENO: Main configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Main configuration of $PACKAGE_NAME successful" >&6;} fi else { echo "$as_me:$LINENO: No configuration of $PACKAGE_NAME necessary" >&5 echo "$as_me: No configuration of $PACKAGE_NAME necessary" >&6;} fi CoinMP-1.8.3/CoinMP/ltmain.sh0000755000175000017500000057753011617525272014315 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/CoinMP/config.guess0000755000175000017500000012706311617525272015002 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/CoinMP/test/0000755000175000017500000000000012600453454013423 5ustar renereneCoinMP-1.8.3/CoinMP/test/Makefile.in0000644000175000017500000003777412243462650015513 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ noinst_PROGRAMS = unitTest$(EXEEXT) subdir = test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_coinmp.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) am_unitTest_OBJECTS = unitTest.$(OBJEXT) unitTest_OBJECTS = $(am_unitTest_OBJECTS) am__DEPENDENCIES_1 = unitTest_DEPENDENCIES = ../src/libCoinMP.la $(am__DEPENDENCIES_1) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(unitTest_SOURCES) DIST_SOURCES = $(unitTest_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CBC_CFLAGS = @CBC_CFLAGS@ CBC_CFLAGS_INSTALLED = @CBC_CFLAGS_INSTALLED@ CBC_DATA = @CBC_DATA@ CBC_DATA_INSTALLED = @CBC_DATA_INSTALLED@ CBC_DEPENDENCIES = @CBC_DEPENDENCIES@ CBC_LIBS = @CBC_LIBS@ CBC_LIBS_INSTALLED = @CBC_LIBS_INSTALLED@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINMP_CFLAGS = @COINMP_CFLAGS@ COINMP_CFLAGS_INSTALLED = @COINMP_CFLAGS_INSTALLED@ COINMP_DEPENDENCIES = @COINMP_DEPENDENCIES@ COINMP_LIBS = @COINMP_LIBS@ COINMP_LIBS_INSTALLED = @COINMP_LIBS_INSTALLED@ COINMP_PCLIBS = @COINMP_PCLIBS@ COINMP_PCREQUIRES = @COINMP_PCREQUIRES@ COINMP_SVN_REV = @COINMP_SVN_REV@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_CBC_FALSE = @COIN_HAS_CBC_FALSE@ COIN_HAS_CBC_TRUE = @COIN_HAS_CBC_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign unitTest_SOURCES = unitTest.cpp # List libraries of COIN projects unitTest_LDADD = ../src/libCoinMP.la $(COINMP_LIBS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` $(COINMP_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 test/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign test/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done unitTest$(EXEEXT): $(unitTest_OBJECTS) $(unitTest_DEPENDENCIES) @rm -f unitTest$(EXEEXT) $(CXXLINK) $(unitTest_LDFLAGS) $(unitTest_OBJECTS) $(unitTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unitTest.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 $(PROGRAMS) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: 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: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS 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-exec \ install-exec-am install-info install-info-am install-man \ 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 \ uninstall-info-am test: unitTest$(EXEEXT) ./unitTest$(EXEEXT) .PHONY: test # 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: CoinMP-1.8.3/CoinMP/test/Makefile.am0000644000175000017500000000253511617524426015471 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. ## $Id: Makefile.am 428 2011-08-07 15:02:46Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # unitTest for CoinMP # ######################################################################## noinst_PROGRAMS = unitTest unitTest_SOURCES = unitTest.cpp # List libraries of COIN projects unitTest_LDADD = ../src/libCoinMP.la $(COINMP_LIBS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` $(COINMP_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` test: unitTest$(EXEEXT) ./unitTest$(EXEEXT) .PHONY: test ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = CoinMP-1.8.3/CoinMP/test/unitTest.cpp0000644000175000017500000005305012246456500015752 0ustar renerene /* unitTest.cpp */ // $Id: unitTest.cpp 583 2013-11-30 21:48:48Z bjarni $ #include #include #include #include #include #include "CoinMP.h" int SOLVCALL MsgLogCallback(const char* messageStr, void *userParam) { fprintf(stdout, "*** MsgCB: %s\n", messageStr); return 0; } int SOLVCALL IterCallback(int iterCount, double objectValue, int isFeasible, double infeasValue, void *userParam) { fprintf(stdout, "*** IterCB: iter=%d, obj=%.12g, feas=%d, infeas=%.12g\n", iterCount, objectValue, isFeasible, infeasValue); return 0; } int SOLVCALL MipNodeCallback(int iterCount, int nodeCount, double bestBound, double bestInteger, int isImproved, void *userParam) { fprintf(stdout, "*** NodeCB: iter=%d, node=%d, bound=%.12g, best=%.12g %s\n", iterCount, nodeCount, bestBound, bestInteger, isImproved ? "*" : ""); return 0; } void GetAndCheckSolution(double optimalValue, HPROB hProb) { int solutionStatus; const char* solutionText; double objectValue; int i; int colCount; double* xValues; const char* ColName; const char* problemName; problemName = CoinGetProblemName(hProb); solutionStatus = CoinGetSolutionStatus(hProb); solutionText = CoinGetSolutionText(hProb); objectValue = CoinGetObjectValue(hProb); fprintf(stdout, "\n---------------------------------------\n"); fprintf(stdout, "Problem Name: %s\n", problemName); fprintf(stdout, "Solution Result: %s\n", solutionText ); fprintf(stdout, "Solution Status: %d\n", solutionStatus); fprintf(stdout, "Optimal Value: %.12g\n", objectValue); fprintf(stdout, "---------------------------------------\n"); colCount = CoinGetColCount(hProb); xValues = (double* )malloc(colCount * sizeof(double)); CoinGetSolutionValues(hProb, xValues, NULL, NULL, NULL); for (i = 0; i < colCount; i++) { if (xValues[i] != 0.0) { ColName = CoinGetColName(hProb, i); fprintf(stdout, "%s = %.12g\n", ColName, xValues[i]); } } fprintf(stdout, "---------------------------------------\n\n"); assert(solutionStatus==0); assert(strcmp(solutionText,"Optimal solution found")==0); if (optimalValue != 0.0) { assert( fabs(objectValue-optimalValue) < 0.001 ); } } void RunTestProblem(const char* problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double* objectCoeffs, double* lowerBounds, double* upperBounds, const char* rowType, double* rhsValues, double* rangeValues, int* matrixBegin, int* matrixCount, int* matrixIndex, double* matrixValues, char** colNames, char** rowNames, const char* objectName, double* initValues, const char* columnType) { HPROB hProb; int result; char filename[260]; const char *userParam = "ProblemData"; fprintf(stdout, "Solve Problem: %s (obj=%.12g)\n", problemName, optimalValue); hProb = CoinCreateProblem(problemName); result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues); result = CoinLoadNames(hProb, colNames, rowNames, objectName); if (columnType) { result = CoinLoadInteger(hProb, columnType); } result = CoinCheckProblem(hProb); if (result != SOLV_CALL_SUCCESS) { fprintf(stdout, "Check Problem failed (result = %d)\n", result); } result = CoinRegisterMsgLogCallback(hProb, &MsgLogCallback, (void*)userParam); if (columnType == NULL) result = CoinRegisterLPIterCallback(hProb, &IterCallback, (void*)userParam); else { result = CoinRegisterMipNodeCallback(hProb, &MipNodeCallback, (void*)userParam); } result = CoinOptimizeProblem(hProb, 0); strcpy(filename, problemName); strcat(filename, ".mps"); result = CoinWriteFile(hProb, SOLV_FILE_MPS, filename); GetAndCheckSolution(optimalValue, hProb); CoinUnloadProblem(hProb); } void RunTestProblemBuf(const char* problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double* objectCoeffs, double* lowerBounds, double* upperBounds, const char* rowType, double* rhsValues, double* rangeValues, int* matrixBegin, int* matrixCount, int* matrixIndex, double* matrixValues, const char* colNamesBuf, const char* rowNamesBuf, const char* objectName, double* initValues, const char* columnType) { HPROB hProb; int result; char filename[260]; const char *userParam = "ProblemData"; fprintf(stdout, "Solve Problem: %s (obj=%.12g)\n", problemName, optimalValue); hProb = CoinCreateProblem(problemName); result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues); result = CoinLoadNamesBuf(hProb, colNamesBuf, rowNamesBuf, objectName); if (columnType) { result = CoinLoadInteger(hProb, columnType); } result = CoinCheckProblem(hProb); if (result != SOLV_CALL_SUCCESS) { fprintf(stdout, "Check Problem failed (result = %d)\n", result); } result = CoinRegisterMsgLogCallback(hProb, &MsgLogCallback, (void*)userParam); if (columnType == NULL) result = CoinRegisterLPIterCallback(hProb, &IterCallback, (void*)userParam); else { result = CoinRegisterMipNodeCallback(hProb, &MipNodeCallback, (void*)userParam); } result = CoinOptimizeProblem(hProb, 0); strcpy(filename, problemName); strcat(filename, ".mps"); result = CoinWriteFile(hProb, SOLV_FILE_MPS, filename); GetAndCheckSolution(optimalValue, hProb); CoinUnloadProblem(hProb); } void RunTestProblemMip(const char* problemName, double optimalValue, int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense, double objectConst, double* objectCoeffs, double* lowerBounds, double* upperBounds, const char* rowType, double* rhsValues, double* rangeValues, int* matrixBegin, int* matrixCount, int* matrixIndex, double* matrixValues, char** colNames, char** rowNames, const char* objectName, double* initValues, const char* columnType, int sosCount, int sosNZCount, int* sosType, int* sosPrior, int* sosBegin, int* sosIndex, double* sosRef, int semiCount, int* semiIndex, int priorCount, int* priorIndex, int* priorValues, int* priorBranch) { HPROB hProb; int result; char filename[260]; const char *userParam = "ProblemData"; fprintf(stdout, "Solve Problem: %s (obj=%.12g)\n", problemName, optimalValue); hProb = CoinCreateProblem(problemName); result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, rangeValues, matrixBegin, matrixCount, matrixIndex, matrixValues); result = CoinLoadNames(hProb, colNames, rowNames, objectName); if (columnType) { result = CoinLoadInteger(hProb, columnType); } if (priorCount > 0) { result = CoinLoadPriority(hProb, priorCount, priorIndex, priorValues, priorBranch); } if (sosCount > 0) { result = CoinLoadSos(hProb, sosCount, sosNZCount, sosType, sosPrior, sosBegin, sosIndex, sosRef); } if (semiCount > 0) { result = CoinLoadSemiCont(hProb, semiCount, semiIndex); } result = CoinCheckProblem(hProb); if (result != SOLV_CALL_SUCCESS) { fprintf(stdout, "Check Problem failed (result = %d)\n", result); } result = CoinRegisterMsgLogCallback(hProb, &MsgLogCallback, (void*)userParam); if ((columnType == NULL) && (sosCount == 0) && (semiCount == 0)) result = CoinRegisterLPIterCallback(hProb, &IterCallback, (void*)userParam); else { result = CoinRegisterMipNodeCallback(hProb, &MipNodeCallback, (void*)userParam); } strcpy(filename, problemName); strcat(filename, ".mps"); result = CoinWriteFile(hProb, SOLV_FILE_MPS, filename); result = CoinOptimizeProblem(hProb, 0); GetAndCheckSolution(optimalValue, hProb); CoinUnloadProblem(hProb); } /************************************************************************* * This problem is copied from coinutils\test\CoinPackedMatrixTest * * 3x1 + x2 - 2x4 - x5 - x8 * 2x2 + 1.1x3 * x3 + x6 * 2.8x4 -1.2x7 * 5.6x1 + x5 + 1.9x8 * *************************************************************************/ void SolveProblemCoinTest(void) { const char* problemName = "CoinTest"; int colCount=8; int rowCount=5; int nonZeroCount=14; int rangeCount = 0; const char* objectName = "obj"; int objectSense = SOLV_OBJSENS_MAX; double objectConst = 0.0; double objectCoeffs[8] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; double lowerBounds[8] = { 0., 0., 0., 0., 0., 0., 0. }; double upperBounds[8] = { 1000000., 1000000., 1000000., 1000000., 1000000., 1000000., 1000000., 1000000. }; char rowType[5] = { 'L', 'L', 'L', 'L', 'L' }; double rhsValues[5] = { 14., 80., 50., 50., 50. }; int matrixBegin[8+1]={0,2,4,6,8,10,11,12,14}; int matrixCount[8]={2,2,2,2,2,1,1,2}; int matrixIndex[14]={0,4,0,1,1,2,0,3,0,4,2,3,0,4}; double matrixValues[14]={3., 5.6, 1., 2., 1.1, 1., -2., 2.8, -1., 1., 1., -1.2, -1., 1.9}; const char* colNames[8] = {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8"}; const char* rowNames[5] = {"r1", "r2", "r3", "r4", "r5"}; double initValues[8] = { 0., 0., 0., 0., 0., 0., 0., 0. }; double optimalValue = 1428729.2857143; RunTestProblem(problemName, optimalValue, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, NULL, matrixBegin, matrixCount, matrixIndex, matrixValues, const_cast(colNames), const_cast(rowNames), objectName, initValues, NULL); } void SolveProblemBakery(void) { const char* problemName = "Bakery"; int colCount = 2; int rowCount = 3; int nonZeroCount = 4 ; int rangeCount = 0; const char* objectName = "Profit"; int objectSense = SOLV_OBJSENS_MAX; double objectConst = - 4000.0 / 30.0; double objectCoeffs[2] = { 0.05 , 0.08 }; double lowerBounds[2] = { 0, 0 }; double upperBounds[2] = { 1000000, 1000000 }; char rowType[3] = { 'L', 'L' , 'L' }; double rhsValues[3] = { 1400 , 8000 , 5000 }; int matrixBegin[2+1] = { 0 , 2, 4 }; int matrixCount[2] = { 2 , 2 }; int matrixIndex[4] = { 0, 1, 0, 2}; double matrixValues[4] = { 0.1, 1, 0.2, 1}; const char* colNames[2] = {"Sun", "Moon"}; const char* rowNames[3] = {"c1", "c2", "c3"}; double optimalValue = 506.66666667; RunTestProblem(problemName, optimalValue, colCount, rowCount, nonZeroCount, rangeCount, objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds, rowType, rhsValues, NULL, matrixBegin, matrixCount, matrixIndex, matrixValues, const_cast(colNames), const_cast(rowNames), objectName, NULL, NULL); } void SolveProblemAfiro(void) { const char* probname = "Afiro"; int ncol = 32; int nrow = 27; int nels = 83; int nrng = 0; const char* objectname = "Cost"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[32]={0, -0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.32, 0, 0, 0, -0.6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.48, 0, 0, 10}; double dclo[32]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; double dcup[32]={1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037, 1e+037}; char rtyp[27]= {'E', 'E', 'L', 'L', 'E', 'E', 'L', 'L', 'L', 'L', 'E', 'E', 'L', 'L', 'E', 'E', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L'}; double drhs[27]={0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 0, 0, 500, 0, 0, 44, 500, 0, 0, 0, 0, 0, 0, 0, 0, 310, 300}; int mbeg[32+1]={0, 4, 6, 8, 10, 14, 18, 22, 26, 28, 30, 32, 34, 36, 38, 40, 44, 46, 48, 50, 52, 56, 60, 64, 68, 70, 72, 74, 76, 78, 80, 82, 83}; int mcnt[32]={4, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1}; int midx[83]={0, 1, 2, 23, 0, 3, 0, 21, 1, 25, 4, 5, 6, 24, 4, 5, 7, 24, 4, 5, 8, 24, 4, 5, 9, 24, 6, 20, 7, 20, 8, 20, 9, 20, 3, 4, 4, 22, 5, 26, 10, 11, 12, 21, 10, 13, 10, 23, 10, 20, 11, 25, 14, 15, 16, 22, 14, 15, 17, 22, 14, 15, 18, 22, 14, 15, 19, 22, 16, 20, 17, 20, 18, 20, 19, 20, 13, 15, 15, 24, 14, 26, 15}; double mval[83]={-1, -1.06, 1, 0.301, 1, -1, 1, -1, 1, 1, -1, -1.06, 1, 0.301, -1, -1.06, 1, 0.313, -1, -0.96, 1, 0.313, -1, -0.86, 1, 0.326, -1, 2.364, -1, 2.386, -1, 2.408, -1, 2.429, 1.4, 1, 1, -1, 1, 1, -1, -0.43, 1, 0.109, 1, -1, 1, -1, 1, -1, 1, 1, -0.43, 1, 1, 0.109, -0.43, 1, 1, 0.108, -0.39, 1, 1, 0.108, -0.37, 1, 1, 0.107, -1, 2.191, -1, 2.219, -1, 2.249, -1, 2.279, 1.4, -1, 1, -1, 1, 1, 1}; const char* colnames[32] = {"x01", "x02", "x03", "x04", "x06", "x07", "x08", "x09", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x22", "x23", "x24", "x25", "x26", "x28", "x29", "x30", "x31", "x32", "x33", "x34", "x35", "x36", "x37", "x38", "x39"}; const char* rownames[27] = {"r09", "r10", "x05", "x21", "r12", "r13", "x17", "x18", "x19", "x20", "r19", "r20", "x27", "x44", "r22", "r23", "x40", "x41", "x42", "x43", "x45", "x46", "x47", "x48", "x49", "x50", "x51"}; double optimalValue = -464.753142857; RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, NULL, mbeg, mcnt, midx, mval, const_cast(colnames), const_cast(rownames), objectname, NULL, NULL); } void SolveProblemP0033(void) { const char* probname = "P0033"; int ncol = 33; int nrow = 15; int nels = 98; int nrng = 0; const char* objectname = "Obj"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[33]={171, 171, 171, 171, 163, 162, 163, 69, 69, 183, 183, 183, 183, 49, 183, 258, 517, 250, 500, 250, 500, 159, 318, 159, 318, 159, 318, 159, 318, 114, 228, 159, 318}; double dclo[33]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; double dcup[33]={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; char rtyp[15]= { 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L' }; double drhs[15]={1, 1, 1, 1, -5, 2700, -2600, -100, -900, -1656, -335, -1026, -5, -500, -270}; int mbeg[33+1]={0, 3, 6, 10, 14, 19, 24, 26, 31, 36, 38, 41, 45, 49, 53, 54, 55, 56, 58, 60, 61, 62, 66, 70, 73, 76, 80, 84, 87, 90, 93, 96, 97, 98}; int mcnt[33]={3, 3, 4, 4, 5, 5, 2, 5, 5, 2, 3, 4, 4, 4, 1, 1, 1, 2, 2, 1, 1, 4, 4, 3, 3, 4, 4, 3, 3, 3, 3, 1, 1}; int midx[98]={0, 8, 9, 0, 12, 13, 0, 5, 6, 9, 0, 5, 6, 7, 1, 5, 6, 10, 11, 1, 5, 6, 8, 9, 1, 14, 2, 5, 6, 10, 11, 2, 5, 6, 8, 9, 3, 4, 3, 10, 11, 3, 5, 6, 11, 3, 5, 6, 9, 5, 6, 8, 9, 3, 4, 4, 12, 13, 12, 13, 13, 13, 5, 6, 10, 11, 5, 6, 10, 11, 5, 6, 11, 5, 6, 11, 5, 6, 8, 9, 5, 6, 8, 9, 5, 6, 9, 5, 6, 9, 5, 6, 7, 5, 6, 7, 14, 14}; double mval[98]={1, -300, -300, 1, -300, -300, 1, 300, -300, -300, 1, 300, -300, -300, 1, 285, -285, -285, -285, 1, 285, -285, -285, -285, 1, -285, 1, 265, -265, -265, -265, 1, 265, -265, -265, -265, 1, -230, 1, -230, -230, 1, 230, -230, -230, 1, 230, -230, -230, 190, -190, -190, -190, 1, -200, -400, -200, -200, -400, -400, -200, -400, 200, -200, -200, -200, 400, -400, -400, -400, 200, -200, -200, 400, -400, -400, 200, -200, -200, -200, 400, -400, -400, -400, 200, -200, -200, 400, -400, -400, 200, -200, -200, 400, -400, -400, -200, -400}; const char* colnames[33] = {"c157", "c158", "c159", "c160", "c161", "c162", "c163", "c164", "c165", "c166", "c167", "c168", "c169", "c170", "c171", "c172", "c173", "c174", "c175", "c176", "c177", "c178", "c179", "c180", "c181", "c182", "c183", "c184", "c185", "c186", "c187", "c188", "c189"}; const char* rownames[15] = {"r114", "r115", "r116", "r117", "r118", "r119", "r120", "r121", "r122", "r123", "r124", "r125", "r126", "r127", "r128"}; char ctyp[33] = { 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B' }; double optimalValue = 3089.0; RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, NULL, mbeg, mcnt, midx, mval, const_cast(colnames), const_cast(rownames), objectname, NULL, ctyp); } void SolveProblemExmip1(void) { const char* probname = "Exmip1"; int ncol = 8; int nrow = 5; int nels = 14; int nrng = 2; const char* objectname = "z"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[8]={1, 0, 0, 0, 2, 0, 0, -1}; double dclo[8]={2.5, 0, 0, 0, 0.5, 0, 0, 0}; double dcup[8]={1e+037, 4.1, 1e+037, 1e+037, 4, 1e+037, 1e+037, 4.3}; char rtyp[5]= {'G', 'L', 'E', 'G', 'L'}; double drhs[5]={2.5, 2.1, 4, 1.8, 15}; double drng[5]={0, 0, 0, -3.2, 12}; int mbeg[8+1]={0, 2, 4, 6, 8, 10, 11, 12, 14}; int mcnt[8]={2, 2, 2, 2, 2, 1, 1, 2}; int midx[14]={0, 4, 0, 1, 1, 2, 0, 3, 0, 4, 2, 3, 0, 4}; double mval[14]={3, 5.6, 1, 2, 1.1, 1, -2, 2.8, -1, 1, 1, -1.2, -1, 1.9}; const char* colnames[8] = {"col01", "col02", "col03", "col04", "col05", "col06", "col07", "col08"}; const char* rownames[5] = {"row01", "row02", "row03", "row04", "row05"}; char ctyp[8] = { 'C', 'C', 'B', 'B', 'C', 'C', 'C', 'C'}; double optimalValue = 3.23684210526; RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, drng, mbeg, mcnt, midx, mval, const_cast(colnames), const_cast(rownames), objectname, NULL, ctyp); } void SolveProblemGamsSos1a(void) { const char* probname = "GamsSos1a"; int ncol = 3; int nrow = 1; int nels = 3; int nrng = 0; const char* objectname = "z"; int objsens = SOLV_OBJSENS_MAX; double objconst = 0.0; double dobj[3]={0.9, 1.0, 1.1}; double dclo[3]={0, 0, 0}; double dcup[3]={0.8, 0.6, 0.6}; double drlo[1]={-1e+37}; double drup[1]={1.0}; int mbeg[3+1]={0, 1, 2, 3}; int mcnt[3]={1, 1, 1}; int midx[3]={0, 0, 0}; double mval[3]={1, 1, 1}; const char* colnames[3] = {"x1", "x2", "x3"}; const char* rownames[1] = {"xsum"}; int sosCount = 1; int sosNZCount = 3; int sosType[1] = {1}; int sosBegin[1+1] = {0, 3}; int sosIndex[3] = {0, 1, 2}; double optimalValue = 0.72; RunTestProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, NULL, drlo, drup, mbeg, mcnt, midx, mval, const_cast(colnames), const_cast(rownames), objectname, NULL, NULL, sosCount, sosNZCount, sosType, NULL, sosBegin, sosIndex, NULL, 0, NULL, 0, NULL, NULL, NULL); } void SolveProblemGamsSos2a(void) { const char* probname = "GamsSos2a"; int ncol = 7; int nrow = 5; int nels = 15; int nrng = 0; const char* objectname = "z"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[7]={0, 0, 0, 0, 0, 1, 1}; double dclo[7]={0.0, 0, 0, -1e+37, -1e+37, 0, 0}; double dcup[7]={1e+37, 1e+37, 1e+37, 1e+37, 1e+37, 1e+37, 1e+37}; char rtyp[5]= {'E', 'E', 'E', 'G', 'G'}; double drhs[5]={1, 0, 0, -1.3, 1.3}; int mbeg[7+1]={0, 3, 6, 9, 10, 13, 14, 15}; int mcnt[7]={3, 3, 3, 1, 3, 1, 1}; int midx[15]={0, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 3, 4, 3, 4}; double mval[15]={1, 1, 1, 1, 2, 2, 1, 3, 3, -1, -1, -1, 1, 1, 1}; const char* colnames[7] = {"w1", "w2", "w3", "x", "fx", "fplus", "fminus"}; const char* rownames[5] = {"wsum", "xdef", "fxdef", "gapplus", "gapminus"}; int sosCount = 1; int sosNZCount = 3; int sosType[1] = {2}; int sosBegin[1+1] = {0, 3}; int sosIndex[3] = {0, 1, 2}; double optimalValue = 0.0; RunTestProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, NULL, mbeg, mcnt, midx, mval, const_cast(colnames), const_cast(rownames), objectname, NULL, NULL, sosCount, sosNZCount, sosType, NULL, sosBegin, sosIndex, NULL, 0, NULL, 0, NULL, NULL, NULL); } void SolveProblemSemiCont(void) { const char* probname = "SemiCont"; int ncol = 4; int nrow = 3; int nels = 6; int nrng = 0; const char* objectname = "z"; int objsens = SOLV_OBJSENS_MIN; double objconst = 0.0; double dobj[4]={0.0, 1.0, 1.0, 0.0}; double dclo[4]={2.8, 0.0, 0.0, 0.0}; double dcup[4]={10.0, 1e+37, 1e+37, 1e+37}; char rtyp[3]= {'L', 'G', 'E'}; double drhs[3]={8.9, 8.9, 10.0}; int mbeg[4+1]={0, 1, 2, 3, 6}; int mcnt[4]={1, 1, 1, 3}; int midx[6]={2, 0, 1, 0, 1, 2}; double mval[6]={1, -1, 1, 1, 1, 1}; const char* colnames[4] = {"s", "pup", "plo", "x"}; const char* rownames[3] = {"bigx", "smallx", "f"}; int semiCount = 1; int semiIndex[1] = {0}; double optimalValue = 1.1; RunTestProblemMip(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, dobj, dclo, dcup, rtyp, drhs, NULL, mbeg, mcnt, midx, mval, const_cast(colnames), const_cast(rownames), objectname, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, semiCount, semiIndex, 0, NULL, NULL, NULL); } int main (int argc, char* argv[]) { const char* SolverName; double CoinVersion; CoinInitSolver(""); SolverName = CoinGetSolverName(); CoinVersion = CoinGetVersion(); fprintf(stdout, "UnitTest: %s version %.20g\n\n", SolverName, CoinVersion); SolveProblemCoinTest(); SolveProblemBakery(); SolveProblemAfiro(); SolveProblemP0033(); SolveProblemExmip1(); SolveProblemGamsSos1a(); SolveProblemGamsSos2a(); SolveProblemSemiCont(); fprintf(stdout, "All unit tests completed successfully\n" ); CoinFreeSolver(); return 0; } CoinMP-1.8.3/CoinMP/missing0000755000175000017500000002540611617525272014057 0ustar renerene#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/CoinMP/coinmp.pc.in0000644000175000017500000000050411617524426014666 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: CoinMP Description: Simple C API for COIN-OR Solvers Clp and Cbc URL: https://projects.coin-or.org/CoinMP Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lCoinMP @COINMP_PCLIBS@ Cflags: -I${includedir} Requires: @COINMP_PCREQUIRES@ CoinMP-1.8.3/CoinMP/install-sh0000755000175000017500000002202111617525272014452 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/CoinMP/configure.ac0000644000175000017500000000607412600330564014735 0ustar renerene# Copyright (C) 2006 International Business Machines. # All Rights Reserved. # This file is distributed under the Common Public License. ## $Id: configure.ac 650 2015-09-22 19:52:20Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 ############################################################################# # Names and other basic things # ############################################################################# AC_PREREQ(2.59) AC_INIT([CoinMP],[1.8.3],[coinmp@list.coin-or.org]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package CoinMP which is distributed under the Common Public License.]) # List one file in the package so that the configure script can test # whether the package is actually there AC_CONFIG_SRCDIR(src/CoinMP.h) # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. AC_PREFIX_DEFAULT([`pwd`]) ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type AC_CANONICAL_BUILD # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. AC_COIN_PROJECTDIR_INIT(CoinMP,9:3:8) # Check if user wants to produce debugging code AC_COIN_DEBUG_COMPILE(CoinMP) # Get the name of the C++ compiler and appropriate compiler options AC_COIN_PROG_CXX # Initialize automake and libtool AC_COIN_INIT_AUTO_TOOLS ############################################################################# # COIN-OR components # ############################################################################# # Required packages. # We need Clp, Cbc, and the OSI interface to CLP to build CoinCbc.cpp. AC_COIN_CHECK_PACKAGE(Cbc, [cbc clp osi-clp], [CoinMP]) if test $coin_has_cbc != yes; then AC_MSG_ERROR("Required package Cbc unavailable.") fi ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) AC_CONFIG_FILES([Makefile src/Makefile test/Makefile examples/Makefile coinmp.pc coinmp-uninstalled.pc]) # Here put the location and name of the configuration header file AC_CONFIG_HEADER([src/config.h src/config_coinmp.h]) # Finally, we let configure write all the output... AC_COIN_FINALIZE CoinMP-1.8.3/CoinMP/coinmp-uninstalled.pc.in0000644000175000017500000000046311617524426017212 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src Name: CoinMP Description: Simple C API for COIN-OR Solvers Clp and Cbc URL: https://projects.coin-or.org/CoinMP Version: @PACKAGE_VERSION@ Libs: ${libdir}/libCoinMP.la @COINMP_PCLIBS@ Cflags: -I@abs_source_dir@/src -I@ABSBUILDDIR@/src Requires: @COINMP_PCREQUIRES@ CoinMP-1.8.3/CoinMP/src/0000755000175000017500000000000012600453454013233 5ustar renereneCoinMP-1.8.3/CoinMP/src/CoinSolver.h0000644000175000017500000000336311654410576015502 0ustar renerene /* CoinSolver.h */ #ifndef _COINSOLVER_H_ #define _COINSOLVER_H_ #if defined(_MSC_VER) && !defined(HAVE_CONFIG_H) #define SOLVCALL __stdcall #else #define SOLVCALL #endif typedef int (SOLVCALL * COIN_MSGLOG_CB)(const char* MessageStr, void* UserParam); typedef int (SOLVCALL *COIN_LPITER_CB)(int IterCount, double ObjectValue, int IsFeasible, double InfeasValue, void* UserParam); typedef int (SOLVCALL *COIN_MIPNODE_CB)(int IterCount, int MipNodeCount, double BestBound, double BestInteger, int IsMipImproved, void* UserParam); /* Depreciated, use COIN_XXX_CB instead */ typedef int (SOLVCALL *MSGLOGCALLBACK)(const char* MessageStr); typedef int (SOLVCALL *ITERCALLBACK)(int IterCount, double ObjectValue, int IsFeasible, double InfeasValue); typedef int (SOLVCALL *MIPNODECALLBACK)(int IterCount, int MipNodeCount, double BestBound, double BestInteger, int IsMipImproved); typedef struct { char LogFilename[260]; COIN_MSGLOG_CB MsgLogCB; COIN_LPITER_CB LPIterCB; COIN_MIPNODE_CB MipNodeCB; void* MsgLogParam; void* LPIterParam; void* MipNodeParam; MSGLOGCALLBACK MsgLogCallback; ITERCALLBACK IterCallback; MIPNODECALLBACK MipNodeCallback; } SOLVERINFO, *PSOLVER; #ifdef __cplusplus extern "C" { #endif PSOLVER coinCreateSolverObject(void); void coinClearSolverObject(PSOLVER pSolver); void coinSetLogFilename(PSOLVER pSolver, const char* LogFilename); const char* coinGetLogFilename(PSOLVER pSolver); #ifdef __cplusplus } #endif #endif /* _COINSOLVER_H_ */ CoinMP-1.8.3/CoinMP/src/Makefile.in0000644000175000017500000005532412243462650015312 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/config_coinmp.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h config_coinmp.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libCoinMP_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) am_libCoinMP_la_OBJECTS = CoinMP.lo CoinProblem.lo CoinResult.lo \ CoinSolver.lo CoinOption.lo CoinCbc.lo libCoinMP_la_OBJECTS = $(am_libCoinMP_la_OBJECTS) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCoinMP_la_SOURCES) DIST_SOURCES = $(libCoinMP_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CBC_CFLAGS = @CBC_CFLAGS@ CBC_CFLAGS_INSTALLED = @CBC_CFLAGS_INSTALLED@ CBC_DATA = @CBC_DATA@ CBC_DATA_INSTALLED = @CBC_DATA_INSTALLED@ CBC_DEPENDENCIES = @CBC_DEPENDENCIES@ CBC_LIBS = @CBC_LIBS@ CBC_LIBS_INSTALLED = @CBC_LIBS_INSTALLED@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINMP_CFLAGS = @COINMP_CFLAGS@ COINMP_CFLAGS_INSTALLED = @COINMP_CFLAGS_INSTALLED@ COINMP_DEPENDENCIES = @COINMP_DEPENDENCIES@ COINMP_LIBS = @COINMP_LIBS@ COINMP_LIBS_INSTALLED = @COINMP_LIBS_INSTALLED@ COINMP_PCLIBS = @COINMP_PCLIBS@ COINMP_PCREQUIRES = @COINMP_PCREQUIRES@ COINMP_SVN_REV = @COINMP_SVN_REV@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_CBC_FALSE = @COIN_HAS_CBC_FALSE@ COIN_HAS_CBC_TRUE = @COIN_HAS_CBC_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCoinMP # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in the 'lib' directory lib_LTLIBRARIES = libCoinMP.la # List all source files for this library, including headers libCoinMP_la_SOURCES = \ CoinMP.cpp CoinMP.h \ CoinProblem.c CoinProblem.h \ CoinResult.c CoinResult.h \ CoinSolver.c CoinSolver.h \ CoinOption.c CoinOption.h \ CoinCbc.cpp CoinCbc.h \ CoinMPConfig.h # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libCoinMP_la_LIBADD = $(COINMP_LIBS) # This is for libtool (on Windows) libCoinMP_la_LDFLAGS = $(LT_LDFLAGS) ######################################################################## # Additional flags # ######################################################################## # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. # "top_srcdir" refers to the basic directory for the main package that is # being compiled. AM_CPPFLAGS = $(COINMP_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'install' includecoindir = $(includedir)/coin includecoin_HEADERS = CoinMP.h all: config.h config_coinmp.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ config_coinmp.h: stamp-h2 @if test ! -f $@; then \ rm -f stamp-h2; \ $(MAKE) stamp-h2; \ else :; fi stamp-h2: $(srcdir)/config_coinmp.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status src/config_coinmp.h distclean-hdr: -rm -f config.h stamp-h1 config_coinmp.h stamp-h2 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libCoinMP.la: $(libCoinMP_la_OBJECTS) $(libCoinMP_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libCoinMP_la_LDFLAGS) $(libCoinMP_la_OBJECTS) $(libCoinMP_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinCbc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinMP.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinOption.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinProblem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinResult.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinSolver.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in config_coinmp.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_coinmp.h.in $(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; } \ END { 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) config.h.in config_coinmp.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_coinmp.h.in $(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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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) config.h config_coinmp.h installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-exec-local install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am \ install-exec-local install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local ####################################################################### # Create the Config.h file that has all public defines and install it # ####################################################################### install-exec-local: $(install_sh_DATA) config_coinmp.h $(DESTDIR)$(includecoindir)/CoinMPConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/CoinMPConfig.h # 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: CoinMP-1.8.3/CoinMP/src/Makefile.am0000644000175000017500000000470412243462650015275 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Common Public License. ## $Id: Makefile.am 547 2013-11-21 19:57:28Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCoinMP # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in the 'lib' directory lib_LTLIBRARIES = libCoinMP.la # List all source files for this library, including headers libCoinMP_la_SOURCES = \ CoinMP.cpp CoinMP.h \ CoinProblem.c CoinProblem.h \ CoinResult.c CoinResult.h \ CoinSolver.c CoinSolver.h \ CoinOption.c CoinOption.h \ CoinCbc.cpp CoinCbc.h \ CoinMPConfig.h # List all additionally required libraries if DEPENDENCY_LINKING libCoinMP_la_LIBADD = $(COINMP_LIBS) endif # This is for libtool (on Windows) libCoinMP_la_LDFLAGS = $(LT_LDFLAGS) ######################################################################## # Additional flags # ######################################################################## # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. # "top_srcdir" refers to the basic directory for the main package that is # being compiled. AM_CPPFLAGS = $(COINMP_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'install' includecoindir = $(includedir)/coin includecoin_HEADERS = CoinMP.h ####################################################################### # Create the Config.h file that has all public defines and install it # ####################################################################### install-exec-local: $(install_sh_DATA) config_coinmp.h $(DESTDIR)$(includecoindir)/CoinMPConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/CoinMPConfig.h CoinMP-1.8.3/CoinMP/src/CoinMP.h0000644000175000017500000005533412217014474014542 0ustar renerene/************************************************************************/ /* */ /* CoinMP Solver Maximal Software */ /* */ /* File : 'coinmp.h' */ /* */ /* Version : 1.7 */ /* */ /* Author : Bjarni Kristjansson, Maximal Software */ /* */ /* Copyright (c) 2002-2013 Bjarni Kristjansson */ /* */ /************************************************************************/ /* $Id: CoinMP.h 524 2013-09-20 09:45:32Z bjarni $ */ #ifndef _COINMP_H_ #define _COINMP_H_ #if defined(_MSC_VER) && !defined(HAVE_CONFIG_H) # define SOLVCALL __stdcall # if defined(SOLVER_EXPORT) && !defined(_WIN64) # define SOLVAPI __declspec(dllexport) # endif # if defined(SOLVER_IMPORT) # define SOLVAPI __declspec(dllimport) # endif #endif #ifndef SOLVAPI #define SOLVAPI #endif #ifndef SOLVCALL #define SOLVCALL #endif #ifndef SOLV_LINK_LIB #ifndef SOLV_LINK_DLL #define SOLV_LINK_LIB #endif #endif #define SOLV_CALL_SUCCESS 0 #define SOLV_CALL_FAILED -1 #define SOLV_METHOD_DEFAULT 0x00000000L #define SOLV_METHOD_PRIMAL 0x00000001L #define SOLV_METHOD_DUAL 0x00000002L #define SOLV_METHOD_NETWORK 0x00000004L #define SOLV_METHOD_BARRIER 0x00000008L #define SOLV_METHOD_BENDERS 0x00000100L #define SOLV_METHOD_DEQ 0x00000200L #define SOLV_METHOD_EV 0x00000400L #define SOLV_FEATURE_LP 0x00000001L #define SOLV_FEATURE_QP 0x00000002L #define SOLV_FEATURE_QCP 0x00000004L #define SOLV_FEATURE_NLP 0x00000008L #define SOLV_FEATURE_MIP 0x00000010L #define SOLV_FEATURE_MIQP 0x00000020L #define SOLV_FEATURE_MIQCP 0x00000040L #define SOLV_FEATURE_MINLP 0x00000080L #define SOLV_FEATURE_SP 0x00010000L #define SOLV_OBJSENS_MAX -1 #define SOLV_OBJSENS_MIN 1 #define SOLV_FILE_LOG 0 #define SOLV_FILE_BASIS 1 #define SOLV_FILE_MIPSTART 2 #define SOLV_FILE_MPS 3 #define SOLV_FILE_LP 4 #define SOLV_FILE_BINARY 5 #define SOLV_FILE_OUTPUT 6 #define SOLV_FILE_BINOUT 7 #define SOLV_FILE_IIS 8 #define SOLV_CHECK_COLCOUNT 1 #define SOLV_CHECK_ROWCOUNT 2 #define SOLV_CHECK_RANGECOUNT 3 #define SOLV_CHECK_OBJSENSE 4 #define SOLV_CHECK_ROWTYPE 5 #define SOLV_CHECK_MATBEGIN 6 #define SOLV_CHECK_MATCOUNT 7 #define SOLV_CHECK_MATBEGCNT 8 #define SOLV_CHECK_MATBEGNZ 9 #define SOLV_CHECK_MATINDEX 10 #define SOLV_CHECK_MATINDEXROW 11 #define SOLV_CHECK_BOUNDS 12 #define SOLV_CHECK_COLTYPE 13 #define SOLV_CHECK_COLNAMES 14 #define SOLV_CHECK_COLNAMESLEN 15 #define SOLV_CHECK_ROWNAMES 16 #define SOLV_CHECK_ROWNAMSLEN 17 typedef void *HPROB; #ifdef __cplusplus extern "C" { #endif typedef int (SOLVCALL * COIN_MSGLOG_CB)(const char* MessageStr, void* UserParam); typedef int (SOLVCALL *COIN_LPITER_CB)(int IterCount, double ObjectValue, int IsFeasible, double InfeasValue, void* UserParam); typedef int (SOLVCALL *COIN_MIPNODE_CB)(int IterCount, int MipNodeCount, double BestBound, double BestInteger, int IsMipImproved, void* UserParam); /* Depreciated, use COIN_XXX_CB instead */ typedef int (SOLVCALL * MSGLOGCALLBACK)(const char* MessageStr); typedef int (SOLVCALL *ITERCALLBACK)(int IterCount, double ObjectValue, int IsFeasible, double InfeasValue); typedef int (SOLVCALL *MIPNODECALLBACK)(int IterCount, int MipNodeCount, double BestBound, double BestInteger, int IsMipImproved); #ifdef SOLV_LINK_LIB SOLVAPI int SOLVCALL CoinInitSolver(const char* LicenseStr); SOLVAPI int SOLVCALL CoinFreeSolver(void); SOLVAPI const char* SOLVCALL CoinGetSolverName(void); SOLVAPI int SOLVCALL CoinGetSolverNameBuf(char* SolverName, int buflen); SOLVAPI const char* SOLVCALL CoinGetVersionStr(void); SOLVAPI int SOLVCALL CoinGetVersionStrBuf(char* VersionStr, int buflen); SOLVAPI double SOLVCALL CoinGetVersion(void); SOLVAPI int SOLVCALL CoinGetFeatures(void); SOLVAPI int SOLVCALL CoinGetMethods(void); SOLVAPI double SOLVCALL CoinGetInfinity(void); SOLVAPI HPROB SOLVCALL CoinCreateProblem(const char* ProblemName); SOLVAPI int SOLVCALL CoinLoadMatrix(HPROB hProb, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues); SOLVAPI int SOLVCALL CoinLoadNames(HPROB hProb, char** ColNamesList, char** RowNamesList, const char* ObjectName); SOLVAPI int SOLVCALL CoinLoadNamesBuf(HPROB hProb, const char* ColNamesBuf, const char* RowNamesBuf, const char* ObjectName); SOLVAPI int SOLVCALL CoinLoadProblem(HPROB hProb, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues, char** ColNamesList, char** RowNamesList, const char* ObjectName); SOLVAPI int SOLVCALL CoinLoadProblemBuf(HPROB hProb, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues, const char* ColNamesBuf, const char* RowNamesBuf, const char* ObjectName); SOLVAPI int SOLVCALL CoinLoadInitValues(HPROB hProb, double* InitValues); SOLVAPI int SOLVCALL CoinLoadInteger(HPROB hProb, const char* ColumnType); SOLVAPI int SOLVCALL CoinLoadPriority(HPROB hProb, int PriorCount, int* PriorIndex, int* PriorValues, int* PriorBranch); SOLVAPI int SOLVCALL CoinLoadSos(HPROB hProb, int SosCount, int SosNZCount, int* SosType, int* SosPrior, int* SosBegin, int* SosIndex, double* SosRef); SOLVAPI int SOLVCALL CoinLoadSemiCont(HPROB hProb, int SemiCount, int* SemiIndex); SOLVAPI int SOLVCALL CoinLoadQuadratic(HPROB hProb, int* QuadBegin, int* QuadCount, int* QuadIndex, double* QuadValues); SOLVAPI int SOLVCALL CoinLoadNonlinear(HPROB hProb, int NlpTreeCount, int NlpLineCount, int* NlpBegin, int* NlpOper, int* NlpArg1, int* NlpArg2, int* NlpIndex1, int* NlpIndex2, double* NlpValue1, double* NlpValue2); SOLVAPI int SOLVCALL CoinUnloadProblem(HPROB hProb); SOLVAPI int SOLVCALL CoinCheckProblem(HPROB hProb); /* Depreciated, use CoinLoadNamesBuf instead //SOLVAPI int SOLVCALL CoinSetLoadNamesType(HPROB hProb, int LoadNamesType); */ SOLVAPI const char* SOLVCALL CoinGetProblemName(HPROB hProb); SOLVAPI int SOLVCALL CoinGetProblemNameBuf(HPROB hProb, char* ProblemName, int buflen); SOLVAPI int SOLVCALL CoinGetColCount(HPROB hProb); SOLVAPI int SOLVCALL CoinGetRowCount(HPROB hProb); SOLVAPI const char* SOLVCALL CoinGetColName(HPROB hProb, int col); SOLVAPI int SOLVCALL CoinGetColNameBuf(HPROB hProb, int col, char* ColName, int buflen); SOLVAPI const char* SOLVCALL CoinGetRowName(HPROB hProb, int row); SOLVAPI int SOLVCALL CoinGetRowNameBuf(HPROB hProb, int row, char* RowName, int buflen); SOLVAPI int SOLVCALL CoinRegisterMsgLogCallback(HPROB hProb, COIN_MSGLOG_CB MsgLogCB, void* UserParam); SOLVAPI int SOLVCALL CoinRegisterLPIterCallback(HPROB hProb, COIN_LPITER_CB LPIterCB, void* UserParam); SOLVAPI int SOLVCALL CoinRegisterMipNodeCallback(HPROB hProb, COIN_MIPNODE_CB MipNodeCB, void* UserParam); /* Depreciated, use CoinRegisterXxxCallback instead */ SOLVAPI int SOLVCALL CoinSetMsgLogCallback(HPROB hProb, MSGLOGCALLBACK MsgLogCallback); SOLVAPI int SOLVCALL CoinSetIterCallback(HPROB hProb, ITERCALLBACK IterCallback); SOLVAPI int SOLVCALL CoinSetMipNodeCallback(HPROB hProb, MIPNODECALLBACK MipNodeCallback); SOLVAPI int SOLVCALL CoinOptimizeProblem(HPROB hProb, int Method); SOLVAPI int SOLVCALL CoinGetSolutionStatus(HPROB hProb); SOLVAPI const char* SOLVCALL CoinGetSolutionText(HPROB hProb); SOLVAPI int SOLVCALL CoinGetSolutionTextBuf(HPROB hProb, char* SolutionText, int buflen); SOLVAPI double SOLVCALL CoinGetObjectValue(HPROB hProb); SOLVAPI double SOLVCALL CoinGetMipBestBound(HPROB hProb); SOLVAPI int SOLVCALL CoinGetIterCount(HPROB hProb); SOLVAPI int SOLVCALL CoinGetMipNodeCount(HPROB hProb); SOLVAPI int SOLVCALL CoinGetSolutionValues(HPROB hProb, double* Activity, double* ReducedCost, double* SlackValues, double* ShadowPrice); SOLVAPI int SOLVCALL CoinGetSolutionRanges(HPROB hProb, double* ObjLoRange, double* ObjUpRange, double* RhsLoRange, double* RhsUpRange); SOLVAPI int SOLVCALL CoinGetSolutionBasis(HPROB hProb, int* ColStatus, int* RowStatus); SOLVAPI int SOLVCALL CoinReadFile(HPROB hProb, int FileType, const char* ReadFilename); SOLVAPI int SOLVCALL CoinWriteFile(HPROB hProb, int FileType, const char* WriteFilename); SOLVAPI int SOLVCALL CoinOpenLogFile(HPROB hProb, const char* LogFilename); SOLVAPI int SOLVCALL CoinCloseLogFile(HPROB hProb); SOLVAPI int SOLVCALL CoinGetOptionCount(HPROB hProb); SOLVAPI int SOLVCALL CoinLocateOptionID(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinLocateOptionName(HPROB hProb, const char* OptionName); SOLVAPI int SOLVCALL CoinGetOptionID(HPROB hProb, int OptionNr); SOLVAPI int SOLVCALL CoinGetOptionInfo(HPROB hProb, int OptionNr, int* OptionID, int* GroupType, int* OptionType); SOLVAPI int SOLVCALL CoinGetIntOptionMinMax(HPROB hProb, int OptionNr, int* MinValue, int* MaxValue); SOLVAPI int SOLVCALL CoinGetRealOptionMinMax(HPROB hProb, int OptionNr, double* MinValue, double* MaxValue); SOLVAPI int SOLVCALL CoinGetOptionNamesBuf(HPROB hProb, int OptionNr, char* OptionName, char* ShortName, int buflen); SOLVAPI int SOLVCALL CoinGetOptionGroup(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinGetOptionType(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinGetIntOptionDefaultValue(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinGetIntOptionMinValue(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinGetIntOptionMaxValue(HPROB hProb, int OptionID); SOLVAPI double SOLVCALL CoinGetRealOptionDefaultValue(HPROB hProb, int OptionID); SOLVAPI double SOLVCALL CoinGetRealOptionMinValue(HPROB hProb, int OptionID); SOLVAPI double SOLVCALL CoinGetRealOptionMaxValue(HPROB hProb, int OptionID); SOLVAPI const char* SOLVCALL CoinGetOptionName(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinGetOptionNameBuf(HPROB hProb, int OptionID, char* OptionName, int buflen); SOLVAPI const char* SOLVCALL CoinGetOptionShortName(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinGetOptionShortNameBuf(HPROB hProb, int OptionID, char* ShortName, int buflen); SOLVAPI int SOLVCALL CoinGetOptionChanged(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinGetIntOption(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinSetIntOption(HPROB hProb, int OptionID, int IntValue); SOLVAPI double SOLVCALL CoinGetRealOption(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinSetRealOption(HPROB hProb, int OptionID, double RealValue); SOLVAPI const char* SOLVCALL CoinGetStringOption(HPROB hProb, int OptionID); SOLVAPI int SOLVCALL CoinGetStringOptionBuf(HPROB hProb, int OptionID, char* StringValue, int buflen); SOLVAPI int SOLVCALL CoinSetStringOption(HPROB hProb, int OptionID, const char* StringValue); #endif #ifdef SOLV_LINK_DLL int (SOLVCALL *CoinInitSolver)(const char* LicenseStr); int (SOLVCALL *CoinFreeSolver)(void); const char* (SOLVCALL *CoinGetSolverName)(void); int (SOLVCALL *CoinGetSolverNameBuf)(char* SolverName, int buflen); const char* (SOLVCALL *CoinGetVersionStr)(void); int (SOLVCALL *CoinGetVersionStrBuf)(char* VersionStr, int buflen); double (SOLVCALL *CoinGetVersion)(void); int (SOLVCALL *CoinGetFeatures)(void); int (SOLVCALL *CoinGetMethods)(void); double (SOLVCALL *CoinGetInfinity)(void); HPROB (SOLVCALL *CoinCreateProblem)(const char* ProblemName); int (SOLVCALL *CoinLoadMatrix)(HPROB hProb, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues); int (SOLVCALL *CoinLoadNames)(HPROB hProb, char** ColNamesList, char** RowNamesList, const char* ObjectName); int (SOLVCALL *CoinLoadNamesBuf)(HPROB hProb, const char* ColNamesBuf, const char* RowNamesBuf, const char* ObjectName); int (SOLVCALL *CoinLoadProblem)(HPROB hProb, int ColCount, int RowCount, int NonZeroCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues, char** ColNamesList, char** RowNamesList, const char* objName); int (SOLVCALL *CoinLoadProblemBuf)(HPROB hProb, int ColCount, int RowCount, int NonZeroCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues, const char* ColNamesBuf, const char* RowNamesBuf, const char* ObjectName); int (SOLVCALL *CoinLoadInitValues)(HPROB hProb, double* InitValues); int (SOLVCALL *CoinLoadInteger)(HPROB hProb, const char* ColumnType); int (SOLVCALL *CoinLoadPriority)(HPROB hProb, int PriorCount, int* PriorIndex, int* PriorValues, int* PriorBranch); int (SOLVCALL *CoinLoadSos)(HPROB hProb, int SosCount, int SosNZCount, int* SosType, int* SosPrior, int* SosBegin, int* SosIndex, double* SosRef); int (SOLVCALL *CoinLoadSemiCont)(HPROB hProb, int SemiCount, int* SemiIndex); int (SOLVCALL *CoinLoadQuadratic)(HPROB hProb, int* QuadBegin, int* QuadCount, int* QuadIndex, double* QuadValues); int (SOLVCALL *CoinLoadNonlinear)(HPROB hProb, int NlpTreeCount, int NlpLineCount, int* NlpBegin, int* NlpOper, int* NlpArg1, int* NlpArg2, int* NlpIndex1, int* NlpIndex2, double* NlpValue1, double* NlpValue2); int (SOLVCALL *CoinUnloadProblem)(HPROB hProb); int (SOLVCALL *CoinCheckProblem)(HPROB hProb); /* int (SOLVCALL *CoinSetLoadNamesType)(HPROB hProb, int LoadNamesType); */ const char* (SOLVCALL *CoinGetProblemName)(HPROB hProb); int (SOLVCALL *CoinGetProblemNameBuf)(HPROB hProb, char* ProblemName, int buflen); int (SOLVCALL *CoinGetColCount)(HPROB hProb); int (SOLVCALL *CoinGetRowCount)(HPROB hProb); const char* (SOLVCALL *CoinGetColName)(HPROB hProb, int col); int (SOLVCALL *CoinGetColNameBuf)(HPROB hProb, int col, char* ColName, int buflen); const char* (SOLVCALL *CoinGetRowName)(HPROB hProb, int row); int (SOLVCALL *CoinGetRowNameBuf)(HPROB hProb, int row, char* RowName, int buflen); void (SOLVCALL *CoinRegisterMsgLogCallback)(HPROB hProb, COIN_MSGLOG_CB MsgLogCB, void* UserParam); void (SOLVCALL *CoinRegisterLPIterCallback)(HPROB hProb, COIN_LPITER_CB LPIterCB, void* UserParam); void (SOLVCALL *CoinRegisterMipNodeCallback)(HPROB hProb, COIN_MIPNODE_CB MipNodeCB, void* UserParam); /* Depreciated, use CoinRegisterXxxCallback instead */ void (SOLVCALL *CoinSetMsgLogCallback)(HPROB hProb, MSGLOGCALLBACK MsgLogCallback); void (SOLVCALL *CoinSetIterCallback)(HPROB hProb, ITERCALLBACK IterCallback); void (SOLVCALL *CoinSetMipNodeCallback)(HPROB hProb, MIPNODECALLBACK MipNodeCallback); int (SOLVCALL *CoinOptimizeProblem)(HPROB hProb, int Method); int (SOLVCALL *CoinGetSolutionStatus)(HPROB hProb); const char* (SOLVCALL *CoinGetSolutionText)(HPROB hProb); int (SOLVCALL *CoinGetSolutionTextBuf)(HPROB hProb, char* SolutionText, int buflen); double (SOLVCALL *CoinGetObjectValue)(HPROB hProb); double (SOLVCALL *CoinGetMipBestBound)(HPROB hProb); int (SOLVCALL *CoinGetIterCount)(HPROB hProb); int (SOLVCALL *CoinGetMipNodeCount)(HPROB hProb); int (SOLVCALL *CoinGetSolutionValues)(HPROB hProb, double* Activity, double* ReducedCost, double* SlackValues, double* ShadowPrice); int (SOLVCALL *CoinGetSolutionRanges)(HPROB hProb, double* ObjLoRange, double* ObjUpRange, double* RhsLoRange, double* RhsUpRange); int (SOLVCALL *CoinGetSolutionBasis)(HPROB hProb, int* ColStatus, int* RowStatus); void (SOLVCALL *CoinReadFile)(HPROB hProb, int FileType, const char* ReadFilename); void (SOLVCALL *CoinWriteFile)(HPROB hProb, int FileType, const char* WriteFilename); void (SOLVCALL *CoinOpenLogFile)(HPROB hProb, const char* LogFilename); void (SOLVCALL *CoinCloseLogFile)(HPROB hProb); int (SOLVCALL *CoinGetOptionCount)(HPROB hProb); int (SOLVCALL *CoinLocateOptionID)(HPROB hProb, int OptionID); int (SOLVCALL *CoinLocateOptionName)(HPROB hProb, const char* OptionName); int (SOLVCALL *CoinGetOptionID)(HPROB hProb, int OptionNr); int (SOLVCALL *CoinGetOptionInfo)(HPROB hProb, int OptionNr, int* OptionID, int* GroupType, int* OptionType); int (SOLVCALL *CoinGetIntOptionMinMax)(HPROB hProb, int OptionNr, int* MinValue, int* MaxValue); int (SOLVCALL *CoinGetRealOptionMinMax)(HPROB hProb, int OptionNr, double* MinValue, double* MaxValue); int (SOLVCALL *CoinGetOptionNames)(HPROB hProb, int OptionNr, char* OptionName, char* ShortName, int buflen); int (SOLVCALL *CoinGetOptionGroup)(HPROB hProb, int OptionID); int (SOLVCALL *CoinGetOptionType)(HPROB hProb, int OptionID); int (SOLVCALL *CoinGetIntOptionDefaultValue)(HPROB hProb, int OptionID); int (SOLVCALL *CoinGetIntOptionMinValue)(HPROB hProb, int OptionID); int (SOLVCALL *CoinGetIntOptionMaxValue)(HPROB hProb, int OptionID); double (SOLVCALL *CoinGetRealOptionDefaultValue)(HPROB hProb, int OptionID); double (SOLVCALL *CoinGetRealOptionMinValue)(HPROB hProb, int OptionID); double (SOLVCALL *CoinGetRealOptionMaxValue)(HPROB hProb, int OptionID); const char* (SOLVCALL *CoinGetOptionName)(HPROB hProb, int OptionID); int (SOLVCALL *CoinGetOptionNameBuf)(HPROB hProb, int OptionID, char* OptionName, int buflen); const char* (SOLVCALL *CoinGetOptionShortName)(HPROB hProb, int OptionID); int (SOLVCALL *CoinGetOptionShortNameBuf)(HPROB hProb, int OptionID, char* ShortName, int buflen); int (SOLVCALL *CoinGetOptionChanged)(HPROB hProb, int OptionID); int (SOLVCALL *CoinGetIntOption)(HPROB hProb, int OptionID); int (SOLVCALL *CoinSetIntOption)(HPROB hProb, int OptionID, int IntValue); double (SOLVCALL *CoinGetRealOption)(HPROB hProb, int OptionID); int (SOLVCALL *CoinSetRealOption)(HPROB hProb, int OptionID, double RealValue); const char* (SOLVCALL *CoinGetStringOption)(HPROB hProb, int OptionID); int (SOLVCALL *CoinGetStringOptionBuf)(HPROB hProb, int OptionID, char* StringValue, int buflen); int (SOLVCALL *CoinSetStringOption)(HPROB hProb, int OptionID, const char* StringValue); #endif #ifdef __cplusplus } #endif #define COIN_INT_SOLVEMETHOD 1 #define COIN_INT_PRESOLVETYPE 2 #define COIN_INT_SCALING 3 #define COIN_INT_PERTURBATION 4 #define COIN_INT_PRIMALPIVOTALG 5 #define COIN_INT_DUALPIVOTALG 6 #define COIN_INT_LOGLEVEL 7 #define COIN_INT_MAXITER 8 #define COIN_INT_CRASHIND 9 #define COIN_INT_CRASHPIVOT 10 #define COIN_REAL_CRASHGAP 11 #define COIN_REAL_PRIMALOBJLIM 12 #define COIN_REAL_DUALOBJLIM 13 #define COIN_REAL_PRIMALOBJTOL 14 #define COIN_REAL_DUALOBJTOL 15 #define COIN_REAL_MAXSECONDS 16 #define COIN_INT_MIPMAXNODES 17 #define COIN_INT_MIPMAXSOL 18 #define COIN_REAL_MIPMAXSEC 19 #define COIN_INT_MIPFATHOMDISC 20 #define COIN_INT_MIPHOTSTART 21 /* #define COIN_INT_MIPFORCEPRIOR 21 */ #define COIN_INT_MIPMINIMUMDROP 22 #define COIN_INT_MIPMAXCUTPASS 23 #define COIN_INT_MIPMAXPASSROOT 24 #define COIN_INT_MIPSTRONGBRANCH 25 #define COIN_INT_MIPSCANGLOBCUTS 26 #define COIN_REAL_MIPINTTOL 30 #define COIN_REAL_MIPINFWEIGHT 31 #define COIN_REAL_MIPCUTOFF 32 #define COIN_REAL_MIPABSGAP 33 #define COIN_REAL_MIPFRACGAP 34 #define COIN_INT_MIPCUT_PROBING 110 #define COIN_INT_MIPPROBE_FREQ 111 #define COIN_INT_MIPPROBE_MODE 112 #define COIN_INT_MIPPROBE_USEOBJ 113 #define COIN_INT_MIPPROBE_MAXPASS 114 #define COIN_INT_MIPPROBE_MAXPROBE 115 #define COIN_INT_MIPPROBE_MAXLOOK 116 #define COIN_INT_MIPPROBE_ROWCUTS 117 #define COIN_INT_MIPCUT_GOMORY 120 #define COIN_INT_MIPGOMORY_FREQ 121 #define COIN_INT_MIPGOMORY_LIMIT 122 #define COIN_REAL_MIPGOMORY_AWAY 123 #define COIN_INT_MIPCUT_KNAPSACK 130 #define COIN_INT_MIPKNAPSACK_FREQ 131 #define COIN_INT_MIPKNAPSACK_MAXIN 132 #define COIN_INT_MIPCUT_ODDHOLE 140 #define COIN_INT_MIPODDHOLE_FREQ 141 #define COIN_REAL_MIPODDHOLE_MINVIOL 142 #define COIN_REAL_MIPODDHOLE_MINVIOLPER 143 #define COIN_INT_MIPODDHOLE_MAXENTRIES 144 #define COIN_INT_MIPCUT_CLIQUE 150 #define COIN_INT_MIPCLIQUE_FREQ 151 #define COIN_INT_MIPCLIQUE_PACKING 152 #define COIN_INT_MIPCLIQUE_STAR 153 #define COIN_INT_MIPCLIQUE_STARMETHOD 154 #define COIN_INT_MIPCLIQUE_STARMAXLEN 155 #define COIN_INT_MIPCLIQUE_STARREPORT 156 #define COIN_INT_MIPCLIQUE_ROW 157 #define COIN_INT_MIPCLIQUE_ROWMAXLEN 158 #define COIN_INT_MIPCLIQUE_ROWREPORT 159 #define COIN_REAL_MIPCLIQUE_MINVIOL 160 #define COIN_INT_MIPCUT_LIFTPROJECT 170 #define COIN_INT_MIPLIFTPRO_FREQ 171 #define COIN_INT_MIPLIFTPRO_BETAONE 172 #define COIN_INT_MIPCUT_SIMPROUND 180 #define COIN_INT_MIPSIMPROUND_FREQ 181 #define COIN_INT_MIPUSECBCMAIN 200 #endif /* _COINMP_H_ */ CoinMP-1.8.3/CoinMP/src/CoinResult.c0000644000175000017500000000301511504277235015470 0ustar renerene /* CoinResult.h */ #include #include #include "CoinResult.h" PRESULT coinCreateResultObject(void) { PRESULT pResult; pResult = (PRESULT)malloc(sizeof(RESULTINFO)); memset(pResult, 0, sizeof(RESULTINFO)); pResult->SolutionStatus = 0; strcpy(pResult->SolutionText, ""); pResult->ObjectValue = 0.0; pResult->MipBestBound = 0.0; pResult->IterCount = 0; pResult->MipNodeCount = 0; pResult->ColActivity = NULL; pResult->ReducedCost = NULL; pResult->RowActivity = NULL; pResult->SlackValues = NULL; pResult->ShadowPrice = NULL; pResult->ObjLoRange = NULL; pResult->ObjUpRange = NULL; pResult->RhsLoRange = NULL; pResult->RhsUpRange = NULL; pResult->ColStatus = NULL; pResult->RowStatus = NULL; return pResult; } void coinClearResultObject(PRESULT pResult) { if (!pResult) { return; } if (pResult->ColActivity) free(pResult->ColActivity); if (pResult->ReducedCost) free(pResult->ReducedCost); if (pResult->RowActivity) free(pResult->RowActivity); if (pResult->SlackValues) free(pResult->SlackValues); if (pResult->ShadowPrice) free(pResult->ShadowPrice); if (pResult->ObjLoRange) free(pResult->ObjLoRange); if (pResult->ObjUpRange) free(pResult->ObjUpRange); if (pResult->ObjUpRange) free(pResult->ObjUpRange); if (pResult->RhsUpRange) free(pResult->RhsUpRange); if (pResult->ColStatus) free(pResult->ColStatus); if (pResult->ColStatus) free(pResult->ColStatus); free(pResult); } CoinMP-1.8.3/CoinMP/src/config_coinmp_default.h0000644000175000017500000000111712600330564017716 0ustar renerene /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC PUBLIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Version number of project */ #define COINMP_VERSION "1.8.3" /* Major Version number of project */ #define COINMP_VERSION_MAJOR 1 /* Minor Version number of project */ #define COINMP_VERSION_MINOR 8 /* Release Version number of project */ #define COINMP_VERSION_RELEASE 3 CoinMP-1.8.3/CoinMP/src/CoinOption.h0000644000175000017500000000603611301112440015452 0ustar renerene /* CoinOption.h */ #ifndef _COINOPTION_H_ #define _COINOPTION_H_ #if defined(_MSC_VER) && !defined(HAVE_CONFIG_H) #define SOLVCALL __stdcall #else #define SOLVCALL #endif #undef MAXINT #undef MAXREAL #define MAXINT 2100000000L #define MAXREAL COIN_DBL_MAX #define ROUND(x) (((x)>0)?((long)((x)+0.5)):((long)((x)-0.5))) #define OPT_NONE 0 #define OPT_ONOFF 1 #define OPT_LIST 2 #define OPT_INT 3 #define OPT_REAL 4 #define OPT_STRING 5 #define GRP_NONE 0 #define GRP_OTHER 0 #define GRP_SIMPLEX 1 #define GRP_PREPROC 2 #define GRP_LOGFILE 3 #define GRP_LIMITS 4 #define GRP_MIPSTRAT 5 #define GRP_MIPCUTS 6 #define GRP_MIPTOL 7 #define GRP_BARRIER 8 #define GRP_NETWORK 9 typedef int OPTINT; typedef double OPTVAL; typedef struct { char OptionName[32]; char ShortName[32]; int GroupType; OPTVAL DefaultValue; OPTVAL CurrentValue; OPTVAL MinValue; OPTVAL MaxValue; int OptionType; int changed; int OptionID; } SOLVOPTINFO, *PSOLVOPT; typedef PSOLVOPT OPTIONTABLE; typedef struct { int OptionCount; int OptionCopy; OPTIONTABLE OptionTable; } OPTIONINFO, *POPTION; #ifdef __cplusplus extern "C" { #endif POPTION coinCreateOptionObject(void); void coinClearOptionObject(POPTION pOption); void coinSetOptionTable(POPTION pOption, OPTIONTABLE OptionTable, int OptionCount); void coinCopyOptionTable(POPTION pOption, OPTIONTABLE OptionTable, int OptionCount); int coinGetOptionCount(POPTION pOption); int coinGetOptionID(POPTION pOption, int OptionNr); int coinLocateOptionID(POPTION pOption, int OptionID); int coinGetOptionType(POPTION pOption, int OptionID); int coinGetOptionGroup(POPTION pOption, int OptionID); int coinLocateOptionName(POPTION pOption, const char* OptionName); const char* coinGetOptionName(POPTION pOption, int OptionID); int coinGetOptionNameBuf(POPTION pOption, int OptionID, char* OptionName, int buflen); const char* coinGetOptionShortName(POPTION pOption, int OptionNr); int coinGetOptionShortNameBuf(POPTION pOption, int OptionNr, char* ShortName, int buflen); int coinGetIntOptionDefaultValue(POPTION pOption, int OptionID); int coinGetIntOptionMinValue(POPTION pOption, int OptionID); int coinGetIntOptionMaxValue(POPTION pOption, int OptionID); double coinGetRealOptionDefaultValue(POPTION pOption, int OptionID); double coinGetRealOptionMinValue(POPTION pOption, int OptionID); double coinGetRealOptionMaxValue(POPTION pOption, int OptionID); int coinGetOptionChanged(POPTION pOption, int OptionID); int coinGetIntOption(POPTION pOption, int OptionID); int coinSetIntOption(POPTION pOption, int OptionID, int IntValue); double coinGetRealOption(POPTION pOption, int OptionID); int coinSetRealOption(POPTION pOption, int OptionID, double RealValue); #ifdef __cplusplus } #endif #endif /* _COINOPTION_H_ */ CoinMP-1.8.3/CoinMP/src/CoinOption.c0000644000175000017500000001525712246420725015473 0ustar renerene /* CoinOption.c */ #include #include #include "CoinOption.h" #ifdef _WIN32 #define STRING_COMPARE_NOCASE(s1, s2) strcmpi(s1, s2) #else #define STRING_COMPARE_NOCASE(s1, s2) strcasecmp(s1, s2) #endif POPTION coinCreateOptionObject() { POPTION pOption; pOption = (POPTION)malloc(sizeof(OPTIONINFO)); memset(pOption, 0, sizeof(OPTIONINFO)); pOption->OptionCount = 0; pOption->OptionCopy = 0; pOption->OptionTable = NULL; return pOption; } void coinClearOptionObject(POPTION pOption) { if (!pOption) { return; } if (pOption->OptionCopy && pOption->OptionTable) { free(pOption->OptionTable); } free(pOption); } void coinCopyOptionTable(POPTION pOption, OPTIONTABLE OptionTable, int OptionCount) { if (!pOption) { return; } if (OptionCount > 0) { pOption->OptionCount = OptionCount; pOption->OptionTable = (PSOLVOPT)malloc(OptionCount * sizeof(SOLVOPTINFO)); memcpy(pOption->OptionTable, OptionTable, OptionCount * sizeof(SOLVOPTINFO)); pOption->OptionCopy = 1; } } void coinSetOptionTable(POPTION pOption, OPTIONTABLE OptionTable, int OptionCount) { if (!pOption) { return; } pOption->OptionTable = OptionTable; pOption->OptionCount = OptionCount; } int coinGetOptionCount(POPTION pOption) { if (pOption == NULL) { return 0; } return pOption->OptionCount; } int coinGetOptionID(POPTION pOption, int OptionNr) { if ((OptionNr < 0) || (OptionNr >= pOption->OptionCount)) { return -1; } return pOption->OptionTable[OptionNr].OptionID; } int coinLocateOptionID(POPTION pOption, int OptionID) { int i; for (i = 0; i < pOption->OptionCount; i++) { if (OptionID == pOption->OptionTable[i].OptionID) { return i; } } return -1; } int coinGetOptionType(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return OPT_NONE; } return pOption->OptionTable[OptionNr].OptionType; } int coinGetOptionGroup(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return GRP_NONE; } return pOption->OptionTable[OptionNr].GroupType; } int coinLocateOptionName(POPTION pOption, const char* OptionName) { int i; for (i = 0; i < pOption->OptionCount; i++) { if (STRING_COMPARE_NOCASE(OptionName, pOption->OptionTable[i].OptionName) == 0) { /* BK 2013/11/28: Was !=, thanks to Miles Lubin for pointing this out */ return pOption->OptionTable[i].OptionID; } if (STRING_COMPARE_NOCASE(OptionName, pOption->OptionTable[i].ShortName) == 0) { return pOption->OptionTable[i].OptionID; } } return -1; } const char* coinGetOptionName(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return ""; } return pOption->OptionTable[OptionNr].OptionName; } int coinGetOptionNameBuf(POPTION pOption, int OptionID, char* OptionName, int buflen) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { if (OptionName) { strcpy(OptionName, ""); } return -1; } if (OptionName) { strncpy(OptionName, pOption->OptionTable[OptionNr].OptionName, buflen-1); OptionName[buflen-1] = '\0'; } return 0; } const char* coinGetOptionShortName(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return ""; } return pOption->OptionTable[OptionNr].ShortName; } int coinGetOptionShortNameBuf(POPTION pOption, int OptionID, char* ShortName, int buflen) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { if (ShortName) { strcpy(ShortName, ""); } return -1; } if (ShortName) { strncpy(ShortName, pOption->OptionTable[OptionNr].ShortName, buflen-1); ShortName[buflen-1] = '\0'; } return 0; } int coinGetIntOptionDefaultValue(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0; } return (int)pOption->OptionTable[OptionNr].DefaultValue; } int coinGetIntOptionMinValue(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0; } return (int)pOption->OptionTable[OptionNr].MinValue; } int coinGetIntOptionMaxValue(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0; } return (int)pOption->OptionTable[OptionNr].MaxValue; } double coinGetRealOptionDefaultValue(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0.0; } return pOption->OptionTable[OptionNr].DefaultValue; } double coinGetRealOptionMinValue(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0.0; } return pOption->OptionTable[OptionNr].MinValue; } double coinGetRealOptionMaxValue(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0.0; } return pOption->OptionTable[OptionNr].MaxValue; } int coinGetOptionChanged(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0; } return pOption->OptionTable[OptionNr].changed; } int coinGetIntOption(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0; } return (int)pOption->OptionTable[OptionNr].CurrentValue; } int coinSetIntOption(POPTION pOption, int OptionID, int IntValue) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return -1; } pOption->OptionTable[OptionNr].CurrentValue = IntValue; pOption->OptionTable[OptionNr].changed = 1; return 0; } double coinGetRealOption(POPTION pOption, int OptionID) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return 0.0; } return pOption->OptionTable[OptionNr].CurrentValue; } int coinSetRealOption(POPTION pOption, int OptionID, double RealValue) { int OptionNr; OptionNr = coinLocateOptionID(pOption, OptionID); if (OptionNr == -1) { return -1; } pOption->OptionTable[OptionNr].CurrentValue = RealValue; pOption->OptionTable[OptionNr].changed = 1; return 0; } CoinMP-1.8.3/CoinMP/src/config.h.in0000644000175000017500000000374611617524426015275 0ustar renerene/* src/config.h.in. Generated from configure.ac by autoheader. */ /* SVN revision number of project */ #undef COINMP_SVN_REV /* Version number of project */ #undef COINMP_VERSION /* Major Version number of project */ #undef COINMP_VERSION_MAJOR /* Minor Version number of project */ #undef COINMP_VERSION_MINOR /* Release Version number of project */ #undef COINMP_VERSION_RELEASE /* Define to the debug sanity check level (0 is no test) */ #undef COIN_COINMP_CHECKLEVEL /* Define to the debug verbosity level (0 is no output) */ #undef COIN_COINMP_VERBOSITY /* Define to 1 if the Cbc package is available */ #undef COIN_HAS_CBC /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION CoinMP-1.8.3/CoinMP/src/CoinCbc.cpp0000644000175000017500000014325012246456256015255 0ustar renerene /* CoinCbc.cpp */ #include #include "CoinProblem.h" #include "CoinResult.h" #include "CoinSolver.h" #include "CoinOption.h" #include #include "CoinHelperFunctions.hpp" #include "CoinMessageHandler.hpp" #include "ClpSimplex.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "ClpDualRowSteepest.hpp" #include "ClpEventHandler.hpp" #include "OsiSolverInterface.hpp" #include "OsiClpSolverInterface.hpp" #include "CbcModel.hpp" #include "CbcSolver.hpp" #include "CbcEventHandler.hpp" #include "CbcBranchActual.hpp" // CbcSOS #include "CbcBranchLotsize.hpp" // CbcLotsize #include "CglProbing.hpp" #include "CglGomory.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" #include "CglLiftAndProject.hpp" #include "CglSimpleRounding.hpp" #include "CoinCbc.h" #define NEW_STYLE_CBCMAIN typedef void *HCBC; /************************************************************************/ /* Message Callback Handler */ /************************************************************************/ class CBMessageHandler : public CoinMessageHandler { public: void registerCallback(COIN_MSGLOG_CB MsgLogCB, void *MsgLogParam); void setCallback(MSGLOGCALLBACK msgCallback); virtual int print(); /** Default constructor. */ CBMessageHandler(); /** Destructor */ virtual ~CBMessageHandler(); /** The copy constructor. */ CBMessageHandler(const CBMessageHandler & rhs); /// Assignment CBMessageHandler& operator=(const CBMessageHandler & rhs); /// Clone virtual CoinMessageHandler * clone() const ; private: COIN_MSGLOG_CB MsgLogCB_; void *MsgLogParam_; MSGLOGCALLBACK msgCallback_; }; void CBMessageHandler::registerCallback(COIN_MSGLOG_CB MsgLogCB, void *MsgLogParam) { MsgLogCB_ = MsgLogCB; MsgLogParam_ = MsgLogParam; msgCallback_ = NULL; } void CBMessageHandler::setCallback(MSGLOGCALLBACK msgCallback) { msgCallback_ = msgCallback; MsgLogCB_ = NULL; MsgLogParam_ = NULL; } int CBMessageHandler::print() { if (MsgLogCB_) MsgLogCB_(const_cast(messageBuffer()), MsgLogParam_); else { msgCallback_(const_cast(messageBuffer())); } return CoinMessageHandler::print(); } // Default Constructor CBMessageHandler::CBMessageHandler () : CoinMessageHandler() { MsgLogCB_ = NULL; MsgLogParam_ = NULL; msgCallback_ = NULL; } // Copy constructor CBMessageHandler::CBMessageHandler (const CBMessageHandler & rhs) : CoinMessageHandler(rhs) {} // Destructor CBMessageHandler::~CBMessageHandler () {} // Assignment operator CBMessageHandler & CBMessageHandler::operator=(const CBMessageHandler& rhs) { if (this != &rhs) { CoinMessageHandler::operator=(rhs); } return *this; } // Clone CoinMessageHandler * CBMessageHandler::clone() const { CBMessageHandler * messagehandler; messagehandler = new CBMessageHandler(*this); messagehandler->MsgLogCB_ = this->MsgLogCB_; messagehandler->MsgLogParam_ = this->MsgLogParam_; messagehandler->msgCallback_ = this->msgCallback_; return messagehandler; } /************************************************************************/ /* Iteration Callback Handler */ /************************************************************************/ class CBIterHandler : public ClpEventHandler { public: void registerLPIterCallback(COIN_LPITER_CB LPIterCB, void* LPIterParam); void setIterCallback(ITERCALLBACK iterCallback); virtual int event(Event whichEvent); /** Default constructor. */ CBIterHandler(); /// Constructor with pointer to model (redundant as setEventHandler does) CBIterHandler(ClpSimplex * model); /** Destructor */ virtual ~CBIterHandler(); /** The copy constructor. */ CBIterHandler(const CBIterHandler & rhs); /// Assignment CBIterHandler& operator=(const CBIterHandler & rhs); /// Clone virtual ClpEventHandler * clone() const ; private: COIN_LPITER_CB LPIterCB_; void* LPIterParam_; ITERCALLBACK iterCallback_; }; void CBIterHandler::registerLPIterCallback(COIN_LPITER_CB LPIterCB, void* LPIterParam) { LPIterCB_ = LPIterCB; LPIterParam_ = LPIterParam; iterCallback_ = NULL; } void CBIterHandler::setIterCallback(ITERCALLBACK iterCallback) { iterCallback_ = iterCallback; LPIterCB_ = NULL; LPIterParam_ = NULL; } int CBIterHandler::event(Event whichEvent) { int numIter; double objValue; int isPrimalFeasible; int isDualFeasible; double sumPrimalInfeas; double sumDualInfeas; int cancelAsap; if ((whichEvent==endOfIteration)) { numIter = model_->getIterationCount(); objValue = model_->getObjValue(); sumDualInfeas = model_->sumDualInfeasibilities(); sumPrimalInfeas = model_->sumPrimalInfeasibilities(); isPrimalFeasible = model_->primalFeasible(); isDualFeasible = model_->dualFeasible(); if (LPIterCB_) cancelAsap = LPIterCB_(numIter, objValue, isPrimalFeasible&&isDualFeasible, sumPrimalInfeas, LPIterParam_); else { cancelAsap = iterCallback_(numIter, objValue, isPrimalFeasible&&isDualFeasible, sumPrimalInfeas); } if (cancelAsap) { return 5; } } return -1; } // Default Constructor CBIterHandler::CBIterHandler () : ClpEventHandler() { LPIterCB_ = NULL; LPIterParam_ = NULL; iterCallback_ = NULL; } // Copy constructor CBIterHandler::CBIterHandler (const CBIterHandler & rhs) : ClpEventHandler(rhs) {} // Constructor with pointer to model CBIterHandler::CBIterHandler(ClpSimplex * model) : ClpEventHandler(model) {} // Destructor CBIterHandler::~CBIterHandler () {} // Assignment operator CBIterHandler & CBIterHandler::operator=(const CBIterHandler& rhs) { if (this != &rhs) { ClpEventHandler::operator=(rhs); } return *this; } // Clone ClpEventHandler * CBIterHandler::clone() const { CBIterHandler * iterhandler; iterhandler = new CBIterHandler(*this); iterhandler->LPIterCB_ = this->LPIterCB_; iterhandler->LPIterParam_ = this->LPIterParam_; iterhandler->iterCallback_ = this->iterCallback_; return iterhandler; } /************************************************************************/ /* MIP Node Callback Handler */ /************************************************************************/ class CBNodeHandler : public CbcEventHandler { public: void registerCallback(COIN_MIPNODE_CB MipNodeCB, void* MipNodeParam); void setCallback(MIPNODECALLBACK mipNodeCallback); virtual CbcAction event(CbcEvent whichEvent); /** Default constructor. */ CBNodeHandler(); /// Constructor with pointer to model (redundant as setEventHandler does) //JPF CBNodeHandler(ClpSimplex * model); CBNodeHandler(CbcModel * model); /** Destructor */ virtual ~CBNodeHandler(); /** The copy constructor. */ CBNodeHandler(const CBNodeHandler & rhs); /// Assignment CBNodeHandler& operator=(const CBNodeHandler & rhs); /// Clone virtual CbcEventHandler * clone() const ; private: COIN_MIPNODE_CB MipNodeCB_; void* MipNodeParam_; MIPNODECALLBACK mipNodeCallback_; int lastSolCount_; }; void CBNodeHandler::registerCallback(COIN_MIPNODE_CB MipNodeCB, void* MipNodeParam) { MipNodeCB_ = MipNodeCB; MipNodeParam_ = MipNodeParam; mipNodeCallback_ = NULL; lastSolCount_ = 0; } void CBNodeHandler::setCallback(MIPNODECALLBACK mipNodeCallback) { mipNodeCallback_ = mipNodeCallback; MipNodeCB_ = NULL; MipNodeParam_ = NULL; lastSolCount_ = 0; } CBNodeHandler::CbcAction CBNodeHandler::event(CbcEvent whichEvent) { int numIter; int numNodes; double bestBound; double objValue; int solCount; int cancelAsap; if (whichEvent==node) { numIter = model_->getIterationCount(); numNodes = model_->getNodeCount(); objValue = model_->getObjValue(); bestBound = model_->getBestPossibleObjValue(); solCount = model_->getSolutionCount(); if (MipNodeCB_) cancelAsap = MipNodeCB_(numIter, numNodes, bestBound, objValue, solCount != lastSolCount_, MipNodeParam_); else { cancelAsap = mipNodeCallback_(numIter, numNodes, bestBound, objValue, solCount != lastSolCount_); } lastSolCount_ = solCount; if (cancelAsap) { return stop; } } return noAction; } // Default Constructor CBNodeHandler::CBNodeHandler () : CbcEventHandler() { MipNodeCB_ = NULL; MipNodeParam_ = NULL; mipNodeCallback_ = NULL; lastSolCount_ = 0; } // Copy constructor CBNodeHandler::CBNodeHandler (const CBNodeHandler & rhs) : CbcEventHandler(rhs) {} // Constructor with pointer to model //JPF: CBNodeHandler::CBNodeHandler(ClpSimplex * model) : CbcEventHandler(model) {} CBNodeHandler::CBNodeHandler(CbcModel * model) : CbcEventHandler(model) {} // Destructor CBNodeHandler::~CBNodeHandler () {} // Assignment operator CBNodeHandler & CBNodeHandler::operator=(const CBNodeHandler& rhs) { if (this != &rhs) { CbcEventHandler::operator=(rhs); } return *this; } // Clone CbcEventHandler * CBNodeHandler::clone() const { CBNodeHandler * nodehandler; nodehandler = new CBNodeHandler(*this); nodehandler->MipNodeCB_ = this->MipNodeCB_; nodehandler->MipNodeParam_ = this->MipNodeParam_; nodehandler->lastSolCount_ = this->lastSolCount_; nodehandler->mipNodeCallback_ = this->mipNodeCallback_; return nodehandler; } /************************************************************************/ /* Coin Problem Info Structure */ /************************************************************************/ typedef struct { ClpSimplex *clp; ClpSolve *clp_presolve; OsiClpSolverInterface *osi; CbcModel *cbc; CglProbing *probing; CglGomory *gomory; CglKnapsackCover *knapsack; CglOddHole *oddhole; CglClique *clique; CglLiftAndProject *liftpro; CglSimpleRounding *rounding; // callback handlers CBMessageHandler *msghandler; CBIterHandler *iterhandler; CBNodeHandler *nodehandler; } CBCINFO, *PCBC; HCBC CbcCreateSolverObject(void) { PCBC pCbc; pCbc = (PCBC)malloc(sizeof(CBCINFO)); if (!pCbc) { return NULL; } memset(pCbc, 0, sizeof(CBCINFO)); pCbc->clp = new ClpSimplex(); pCbc->clp_presolve = new ClpSolve(); pCbc->osi = new OsiClpSolverInterface(pCbc->clp); pCbc->cbc = NULL; /* ERRORFIX 2005/2/22: Crashes if not NULL when trying to set message handler */ pCbc->msghandler = NULL; pCbc->iterhandler = NULL; pCbc->nodehandler = NULL; return (HCBC)pCbc; } void CbcClearSolverObject(HCBC hCbc) { PCBC pCbc = (PCBC)hCbc; if (!pCbc) { return; } if (pCbc->clp) delete pCbc->clp; if (pCbc->clp_presolve) delete pCbc->clp_presolve; //if (pCbc->osi) delete pCbc->osi; if (pCbc->cbc) delete pCbc->cbc; if (pCbc->msghandler) delete pCbc->msghandler; if (pCbc->iterhandler) delete pCbc->iterhandler; if (pCbc->nodehandler) delete pCbc->nodehandler; free(pCbc); } /************************************************************************/ /* Callback Handling */ /************************************************************************/ int CbcRegisterMsgLogCallback(HCBC hCbc, int LogLevel, COIN_MSGLOG_CB MsgLogCB, void *MsgLogParam) { PCBC pCbc = (PCBC)hCbc; if (!MsgLogCB) { return CBC_CALL_FAILED; } delete pCbc->msghandler; pCbc->msghandler = new CBMessageHandler(); pCbc->msghandler->registerCallback(MsgLogCB, MsgLogParam); pCbc->msghandler->setLogLevel(LogLevel); if (pCbc->clp) pCbc->clp->passInMessageHandler(pCbc->msghandler); if (pCbc->cbc) pCbc->cbc->passInMessageHandler(pCbc->msghandler); if (pCbc->osi) pCbc->osi->passInMessageHandler(pCbc->msghandler); return CBC_CALL_SUCCESS; } int CbcRegisterLPIterCallback(HCBC hCbc, COIN_LPITER_CB LPIterCB, void* LPIterParam) { PCBC pCbc = (PCBC)hCbc; if (!LPIterCB) { return CBC_CALL_FAILED; } delete pCbc->iterhandler; pCbc->iterhandler = new CBIterHandler(pCbc->clp); pCbc->iterhandler->registerLPIterCallback(LPIterCB, LPIterParam); if (pCbc->clp) pCbc->clp->passInEventHandler(pCbc->iterhandler); return CBC_CALL_SUCCESS; } int CbcRegisterMipNodeCallback(HCBC hCbc, COIN_MIPNODE_CB MipNodeCB, void* MipNodeParam) { PCBC pCbc = (PCBC)hCbc; if (!MipNodeCB) { return CBC_CALL_FAILED; } delete pCbc->nodehandler; pCbc->nodehandler = new CBNodeHandler(pCbc->cbc); pCbc->nodehandler->registerCallback(MipNodeCB, MipNodeParam); if (pCbc->cbc) pCbc->cbc->passInEventHandler(pCbc->nodehandler); return CBC_CALL_SUCCESS; } // Depreciated int CbcSetMsgLogCallback(HCBC hCbc, int LogLevel, MSGLOGCALLBACK MsgLogCallback) { PCBC pCbc = (PCBC)hCbc; if (!MsgLogCallback) { return CBC_CALL_FAILED; } delete pCbc->msghandler; pCbc->msghandler = new CBMessageHandler(); pCbc->msghandler->setCallback(MsgLogCallback); pCbc->msghandler->setLogLevel(LogLevel); if (pCbc->clp) pCbc->clp->passInMessageHandler(pCbc->msghandler); if (pCbc->cbc) pCbc->cbc->passInMessageHandler(pCbc->msghandler); if (pCbc->osi) pCbc->osi->passInMessageHandler(pCbc->msghandler); return CBC_CALL_SUCCESS; } // Depreciated int CbcSetIterCallback(HCBC hCbc, ITERCALLBACK IterCallback) { PCBC pCbc = (PCBC)hCbc; if (!IterCallback) { return CBC_CALL_FAILED; } delete pCbc->iterhandler; pCbc->iterhandler = new CBIterHandler(pCbc->clp); pCbc->iterhandler->setIterCallback(IterCallback); if (pCbc->clp) pCbc->clp->passInEventHandler(pCbc->iterhandler); return CBC_CALL_SUCCESS; } // Depreciated int CbcSetMipNodeCallback(HCBC hCbc, MIPNODECALLBACK MipNodeCallback) { PCBC pCbc = (PCBC)hCbc; if (!MipNodeCallback) { return CBC_CALL_FAILED; } delete pCbc->nodehandler; pCbc->nodehandler = new CBNodeHandler(pCbc->cbc); pCbc->nodehandler->setCallback(MipNodeCallback); if (pCbc->cbc) pCbc->cbc->passInEventHandler(pCbc->nodehandler); return CBC_CALL_SUCCESS; } int CbcSetAllCallbacks(HCBC hCbc, PSOLVER pSolver, POPTION pOption) { int logLevel; logLevel = coinGetIntOption(pOption, COIN_INT_LOGLEVEL); CbcRegisterMsgLogCallback(hCbc, logLevel, pSolver->MsgLogCB, pSolver->MsgLogParam); CbcRegisterLPIterCallback(hCbc, pSolver->LPIterCB, pSolver->LPIterParam); CbcRegisterMipNodeCallback(hCbc, pSolver->MipNodeCB, pSolver->MipNodeParam); return CBC_CALL_SUCCESS; } /************************************************************************/ /* Option Setting */ /************************************************************************/ int CbcSetClpOptions(HCBC hCbc, POPTION pOption) { PCBC pCbc = (PCBC)hCbc; ClpSolve::SolveType method; ClpSolve::PresolveType presolve; /* check if it has been changed, leave alone otherwise */ if (coinGetOptionChanged(pOption, COIN_INT_SCALING)) pCbc->clp->scaling(coinGetIntOption(pOption, COIN_INT_SCALING)); if (coinGetOptionChanged(pOption, COIN_INT_PERTURBATION)) pCbc->clp->setPerturbation(coinGetIntOption(pOption, COIN_INT_PERTURBATION)); if (coinGetOptionChanged(pOption, COIN_REAL_MAXSECONDS)) pCbc->clp->setMaximumSeconds(coinGetRealOption(pOption, COIN_REAL_MAXSECONDS)); if (coinGetOptionChanged(pOption, COIN_INT_MAXITER)) pCbc->clp->setMaximumIterations(coinGetIntOption(pOption, COIN_INT_MAXITER)); if (coinGetOptionChanged(pOption, COIN_REAL_PRIMALOBJLIM)) pCbc->clp->setPrimalObjectiveLimit(coinGetRealOption(pOption, COIN_REAL_PRIMALOBJLIM)); if (coinGetOptionChanged(pOption, COIN_REAL_DUALOBJLIM)) pCbc->clp->setDualObjectiveLimit(coinGetRealOption(pOption, COIN_REAL_DUALOBJLIM)); if (coinGetOptionChanged(pOption, COIN_REAL_PRIMALOBJTOL)) pCbc->clp->setPrimalTolerance(coinGetRealOption(pOption, COIN_REAL_PRIMALOBJTOL)); if (coinGetOptionChanged(pOption, COIN_REAL_DUALOBJTOL)) pCbc->clp->setDualTolerance(coinGetRealOption(pOption, COIN_REAL_DUALOBJTOL)); if (coinGetOptionChanged(pOption, COIN_INT_PRIMALPIVOTALG)) { ClpPrimalColumnSteepest primalSteepest(coinGetIntOption(pOption, COIN_INT_PRIMALPIVOTALG)); pCbc->clp->setPrimalColumnPivotAlgorithm(primalSteepest); } if (coinGetOptionChanged(pOption, COIN_INT_DUALPIVOTALG)) { ClpDualRowSteepest dualSteepest(coinGetIntOption(pOption, COIN_INT_DUALPIVOTALG)); pCbc->clp->setDualRowPivotAlgorithm(dualSteepest); } if (coinGetOptionChanged(pOption, COIN_INT_CRASHIND)) { if (coinGetIntOption(pOption, COIN_INT_CRASHIND)) { pCbc->clp->crash(coinGetRealOption(pOption, COIN_REAL_CRASHGAP), coinGetIntOption(pOption, COIN_INT_CRASHPIVOT)); } } if (coinGetOptionChanged(pOption, COIN_INT_SOLVEMETHOD)) { switch (coinGetIntOption(pOption, COIN_INT_SOLVEMETHOD)) { case 0: method = ClpSolve::useDual; break; case 1: method = ClpSolve::usePrimal; break; case 2: method = ClpSolve::usePrimalorSprint; break; case 3: method = ClpSolve::useBarrier; break; case 4: method = ClpSolve::useBarrierNoCross; break; case 5: method = ClpSolve::automatic; break; default: method = ClpSolve::usePrimal; } pCbc->clp->setSolveType(method); //ClpSolve::usePrimal } if (coinGetOptionChanged(pOption, COIN_INT_PRESOLVETYPE)) { switch (coinGetIntOption(pOption, COIN_INT_PRESOLVETYPE)) { case 0: presolve = ClpSolve::presolveOn; break; case 1: presolve = ClpSolve::presolveOff; break; case 2: presolve = ClpSolve::presolveNumber; break; default: presolve = ClpSolve::presolveOn; } pCbc->clp_presolve->setPresolveType(presolve); //ClpSolve::presolveOn } return 1; } int CbcSetCbcOptions(HCBC hCbc, POPTION pOption) { PCBC pCbc = (PCBC)hCbc; if (!pCbc->cbc) { return 0; } if (coinGetOptionChanged(pOption, COIN_INT_MIPMAXNODES)) pCbc->cbc->setMaximumNodes(coinGetIntOption(pOption, COIN_INT_MIPMAXNODES)); if (coinGetOptionChanged(pOption, COIN_INT_MIPMAXSOL)) pCbc->cbc->setMaximumSolutions(coinGetIntOption(pOption, COIN_INT_MIPMAXSOL)); if (coinGetOptionChanged(pOption, COIN_REAL_MIPMAXSEC)) pCbc->cbc->setDblParam(CbcModel::CbcMaximumSeconds,coinGetRealOption(pOption, COIN_REAL_MIPMAXSEC)); if (coinGetOptionChanged(pOption, COIN_INT_MIPFATHOMDISC)) pCbc->cbc->setIntParam(CbcModel::CbcFathomDiscipline,coinGetIntOption(pOption, COIN_INT_MIPFATHOMDISC)); // JPF commented: pCbc->cbc->setHotstartStrategy(coinGetIntOption(pOption, COIN_INT_MIPHOTSTART)); // pCbc->cbc->setForcePriority(coinGetIntOption(pOption, COIN_INT_MIPFORCEPRIOR)); if (coinGetOptionChanged(pOption, COIN_INT_MIPMINIMUMDROP)) pCbc->cbc->setMinimumDrop(coinGetIntOption(pOption, COIN_INT_MIPMINIMUMDROP)); if (coinGetOptionChanged(pOption, COIN_INT_MIPMAXPASSROOT)) pCbc->cbc->setMaximumCutPassesAtRoot(coinGetIntOption(pOption, COIN_INT_MIPMAXPASSROOT)); if (coinGetOptionChanged(pOption, COIN_INT_MIPMAXCUTPASS)) pCbc->cbc->setMaximumCutPasses(coinGetIntOption(pOption, COIN_INT_MIPMAXCUTPASS)); if (coinGetOptionChanged(pOption, COIN_INT_MIPSTRONGBRANCH)) pCbc->cbc->setNumberStrong(coinGetIntOption(pOption, COIN_INT_MIPSTRONGBRANCH)); if (coinGetOptionChanged(pOption, COIN_INT_MIPSCANGLOBCUTS)) pCbc->cbc->setHowOftenGlobalScan(coinGetIntOption(pOption, COIN_INT_MIPSCANGLOBCUTS)); if (coinGetOptionChanged(pOption, COIN_REAL_MIPINTTOL)) pCbc->cbc->setIntegerTolerance(coinGetRealOption(pOption, COIN_REAL_MIPINTTOL)); if (coinGetOptionChanged(pOption, COIN_REAL_MIPINFWEIGHT)) pCbc->cbc->setInfeasibilityWeight(coinGetRealOption(pOption, COIN_REAL_MIPINFWEIGHT)); if (coinGetOptionChanged(pOption, COIN_REAL_MIPCUTOFF)) pCbc->cbc->setDblParam(CbcModel::CbcCutoffIncrement,coinGetRealOption(pOption, COIN_REAL_MIPCUTOFF)); if (coinGetOptionChanged(pOption, COIN_REAL_MIPABSGAP)) pCbc->cbc->setAllowableGap(coinGetRealOption(pOption, COIN_REAL_MIPABSGAP)); if (coinGetOptionChanged(pOption, COIN_REAL_MIPFRACGAP)) pCbc->cbc->setAllowableFractionGap(coinGetRealOption(pOption, COIN_REAL_MIPFRACGAP)); return 1; } int CbcSetCglOptions(HCBC hCbc, POPTION pOption) { PCBC pCbc = (PCBC)hCbc; /* see CbcModel.hpp has commments on calling cuts */ if (coinGetIntOption(pOption, COIN_INT_MIPCUT_PROBING)) { pCbc->probing = new CglProbing(); if (coinGetOptionChanged(pOption, COIN_INT_MIPPROBE_MODE)) pCbc->probing->setMode(coinGetIntOption(pOption, COIN_INT_MIPPROBE_MODE)); if (coinGetOptionChanged(pOption, COIN_INT_MIPPROBE_USEOBJ)) pCbc->probing->setUsingObjective(coinGetIntOption(pOption, COIN_INT_MIPPROBE_USEOBJ) ? true : false); if (coinGetOptionChanged(pOption, COIN_INT_MIPPROBE_MAXPASS)) pCbc->probing->setMaxPass(coinGetIntOption(pOption, COIN_INT_MIPPROBE_MAXPASS)); if (coinGetOptionChanged(pOption, COIN_INT_MIPPROBE_MAXPROBE)) pCbc->probing->setMaxProbe(coinGetIntOption(pOption, COIN_INT_MIPPROBE_MAXPROBE)); if (coinGetOptionChanged(pOption, COIN_INT_MIPPROBE_MAXLOOK)) pCbc->probing->setMaxLook(coinGetIntOption(pOption, COIN_INT_MIPPROBE_MAXLOOK)); if (coinGetOptionChanged(pOption, COIN_INT_MIPPROBE_ROWCUTS)) pCbc->probing->setRowCuts(coinGetIntOption(pOption, COIN_INT_MIPPROBE_ROWCUTS)); pCbc->cbc->addCutGenerator(pCbc->probing,coinGetIntOption(pOption, COIN_INT_MIPPROBE_FREQ),"Probing"); } if (coinGetIntOption(pOption, COIN_INT_MIPCUT_GOMORY)) { pCbc->gomory = new CglGomory(); if (coinGetOptionChanged(pOption, COIN_INT_MIPGOMORY_LIMIT)) pCbc->gomory->setLimit(coinGetIntOption(pOption, COIN_INT_MIPGOMORY_LIMIT)); if (coinGetOptionChanged(pOption, COIN_REAL_MIPGOMORY_AWAY)) pCbc->gomory->setAway(coinGetRealOption(pOption, COIN_REAL_MIPGOMORY_AWAY)); pCbc->cbc->addCutGenerator(pCbc->gomory,coinGetIntOption(pOption, COIN_INT_MIPGOMORY_FREQ),"Gomory"); } if (coinGetIntOption(pOption, COIN_INT_MIPCUT_KNAPSACK)) { pCbc->knapsack = new CglKnapsackCover(); if (coinGetOptionChanged(pOption, COIN_INT_MIPKNAPSACK_MAXIN)) pCbc->knapsack->setMaxInKnapsack(coinGetIntOption(pOption, COIN_INT_MIPKNAPSACK_MAXIN)); pCbc->cbc->addCutGenerator(pCbc->knapsack,coinGetIntOption(pOption, COIN_INT_MIPKNAPSACK_FREQ),"Knapsack"); } if (coinGetIntOption(pOption, COIN_INT_MIPCUT_ODDHOLE)) { pCbc->oddhole= new CglOddHole(); if (coinGetOptionChanged(pOption, COIN_REAL_MIPODDHOLE_MINVIOL)) pCbc->oddhole->setMinimumViolation(coinGetRealOption(pOption, COIN_REAL_MIPODDHOLE_MINVIOL)); if (coinGetOptionChanged(pOption, COIN_REAL_MIPODDHOLE_MINVIOLPER)) pCbc->oddhole->setMinimumViolationPer(coinGetRealOption(pOption, COIN_REAL_MIPODDHOLE_MINVIOLPER)); if (coinGetOptionChanged(pOption, COIN_INT_MIPODDHOLE_MAXENTRIES)) pCbc->oddhole->setMaximumEntries(coinGetIntOption(pOption, COIN_INT_MIPODDHOLE_MAXENTRIES)); pCbc->cbc->addCutGenerator(pCbc->oddhole,coinGetIntOption(pOption, COIN_INT_MIPODDHOLE_FREQ),"OddHole"); } if (coinGetIntOption(pOption, COIN_INT_MIPCUT_CLIQUE)) { pCbc->clique= new CglClique(coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_PACKING) ? true : false); if (coinGetOptionChanged(pOption, COIN_INT_MIPCLIQUE_STAR)) pCbc->clique->setDoStarClique(coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_STAR) ? true : false); if (coinGetOptionChanged(pOption, COIN_INT_MIPCLIQUE_STARMETHOD)) pCbc->clique->setStarCliqueNextNodeMethod((CglClique::scl_next_node_method)coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_STARMETHOD)); if (coinGetOptionChanged(pOption, COIN_INT_MIPCLIQUE_STARMAXLEN)) pCbc->clique->setStarCliqueCandidateLengthThreshold(coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_STARMAXLEN)); if (coinGetOptionChanged(pOption, COIN_INT_MIPCLIQUE_STARREPORT)) pCbc->clique->setStarCliqueReport(coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_STARREPORT) ? true : false); if (coinGetOptionChanged(pOption, COIN_INT_MIPCLIQUE_ROW)) pCbc->clique->setDoRowClique(coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_ROW) ? true : false); if (coinGetOptionChanged(pOption, COIN_INT_MIPCLIQUE_ROWMAXLEN)) pCbc->clique->setRowCliqueCandidateLengthThreshold(coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_ROWMAXLEN)); if (coinGetOptionChanged(pOption, COIN_INT_MIPCLIQUE_ROWREPORT)) pCbc->clique->setRowCliqueReport(coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_ROWREPORT) ? true : false); if (coinGetOptionChanged(pOption, COIN_REAL_MIPCLIQUE_MINVIOL)) pCbc->clique->setMinViolation(coinGetRealOption(pOption, COIN_REAL_MIPCLIQUE_MINVIOL)); pCbc->cbc->addCutGenerator(pCbc->clique,coinGetIntOption(pOption, COIN_INT_MIPCLIQUE_FREQ),"Clique"); } if (coinGetIntOption(pOption, COIN_INT_MIPCUT_LIFTPROJECT)) { pCbc->liftpro = new CglLiftAndProject(); if (coinGetOptionChanged(pOption, COIN_INT_MIPLIFTPRO_BETAONE)) pCbc->liftpro->setBeta(coinGetIntOption(pOption, COIN_INT_MIPLIFTPRO_BETAONE) ? 1 : -1); pCbc->cbc->addCutGenerator(pCbc->liftpro,coinGetIntOption(pOption, COIN_INT_MIPLIFTPRO_FREQ),"LiftProject"); } if (coinGetIntOption(pOption, COIN_INT_MIPCUT_SIMPROUND)) { pCbc->rounding = new CglSimpleRounding(); pCbc->cbc->addCutGenerator(pCbc->rounding,coinGetIntOption(pOption, COIN_INT_MIPSIMPROUND_FREQ),"Rounding"); } return 1; } /************************************************************************/ /* Setup CBC Objects */ /************************************************************************/ void CbcCopyNamesList(HCBC hCbc, PPROBLEM pProblem) { int i; PCBC pCbc = (PCBC)hCbc; /* Load names */ if (pProblem->RowNamesList || pProblem->ColNamesList) { std::vector rowNamesVect; std::vector colNamesVect; rowNamesVect.reserve(pProblem->RowCount); colNamesVect.reserve(pProblem->ColCount); if (pProblem->RowNamesList) { for (i = 0; i < pProblem->RowCount; i++) { rowNamesVect.push_back(pProblem->RowNamesList[i]); } } if (pProblem->ColNamesList) { for (i = 0; i < pProblem->ColCount; i++) { colNamesVect.push_back(pProblem->ColNamesList[i]); } } pCbc->clp->copyNames(rowNamesVect, colNamesVect); } } int CbcSetColumnIntegers(HCBC hCbc, PPROBLEM pProblem) { int i; PCBC pCbc = (PCBC)hCbc; if (pProblem->numInts == 0) { return CBC_CALL_FAILED; } for (i = 0; i < pProblem->ColCount; i++) { if (pProblem->IsInt[i]) { pCbc->cbc->solver()->setInteger(i); pCbc->osi->setInteger(i); } } return CBC_CALL_SUCCESS; } int CbcAddPriorObjects(HCBC hCbc, PPROBLEM pProblem) { int *priorVar; int *priorCbc; int i,k; PCBC pCbc = (PCBC)hCbc; if ((pProblem->PriorCount == 0) || (pProblem->numInts == 0)) { return CBC_CALL_FAILED; } priorVar = (int *)malloc(pProblem->ColCount * sizeof(int)); if (!priorVar) { return CBC_CALL_FAILED; } //reset the priorVar for (i = 0; i < pProblem->ColCount; i++) { priorVar[i] = 1000; } for (i = 0; i < pProblem->PriorCount; i++) { if ((pProblem->PriorIndex[i] < 0) || (pProblem->PriorIndex[i] >= pProblem->ColCount)) { free(priorVar); return CBC_CALL_FAILED; } priorVar[pProblem->PriorIndex[i]] = pProblem->PriorValues[i]; } //Create an array to give to cbc priorCbc = (int *)malloc(pProblem->numInts * sizeof(int)); if (!priorCbc) { free(priorVar); return CBC_CALL_FAILED; } k = 0; for (i = 0; i < pProblem->ColCount; i++) { if (pProblem->IsInt[i]) { priorCbc[k++] = priorVar[i]; } } pCbc->cbc->passInPriorities(priorCbc, false); free(priorCbc); free(priorVar); return CBC_CALL_SUCCESS; } int CbcAddSosObjects(HCBC hCbc, PPROBLEM pProblem) { int sos, count; int* which; int type; PCBC pCbc = (PCBC)hCbc; if (pProblem->SosCount == 0) { return CBC_CALL_FAILED; } for (sos = 0; sos < pProblem->SosCount; sos++) { count = pProblem->SosBegin[sos+1] - pProblem->SosBegin[sos]; which = &pProblem->SosIndex[pProblem->SosBegin[sos]]; type = pProblem->SosType[sos]; CbcObject *sosObject = new CbcSOS(pCbc->cbc, count, which, NULL, 0, type); pCbc->cbc->addObjects(1, &sosObject); delete sosObject; } return CBC_CALL_SUCCESS; } int CbcAddSemiContObjects(HCBC hCbc, PPROBLEM pProblem) { double points[4]; int i, semicol; PCBC pCbc = (PCBC)hCbc; if (pProblem->SemiCount == 0) { return CBC_CALL_FAILED; } points[0] = 0.0; points[1] = 0.0; for (i = 0; i < pProblem->SemiCount; i++ ) { semicol = pProblem->SemiIndex[i]; points[2] = pProblem->LowerBounds[semicol]; points[3] = pProblem->UpperBounds[semicol]; CbcObject *semiObject = new CbcLotsize(pCbc->cbc, semicol, 2, points, true); pCbc->cbc->addObjects(1, &semiObject); delete semiObject; } return CBC_CALL_SUCCESS; } int CbcLoadAllSolverObjects(HCBC hCbc, PPROBLEM pProblem) { PCBC pCbc = (PCBC)hCbc; int i, col; int result; double* storeLowerBound = NULL; if (pProblem->SemiCount > 0) { storeLowerBound = (double *)malloc(pProblem->ColCount * sizeof(double)); if (!storeLowerBound) { return CBC_CALL_FAILED; } memcpy(storeLowerBound, pProblem->LowerBounds, pProblem->ColCount * sizeof(double)); for (i = 0; i < pProblem->SemiCount; i++) { col = pProblem->SemiIndex[i]; pProblem->LowerBounds[col] = 0.0; } } pCbc->clp->setOptimizationDirection(pProblem->ObjectSense); pCbc->clp->loadProblem(pProblem->ColCount, pProblem->RowCount, pProblem->MatrixBegin, pProblem->MatrixIndex, pProblem->MatrixValues, pProblem->LowerBounds, pProblem->UpperBounds, pProblem->ObjectCoeffs, pProblem->RowLower, pProblem->RowUpper); if (pProblem->SemiCount > 0) { memcpy(pProblem->LowerBounds, storeLowerBound, pProblem->ColCount * sizeof(double)); free(storeLowerBound); } CbcCopyNamesList(hCbc, pProblem); if (pProblem->SolveAsMIP) { if (!pCbc->cbc) { pCbc->cbc = new CbcModel(*pCbc->osi); } result = CbcSetColumnIntegers(hCbc, pProblem); result = CbcAddPriorObjects(hCbc, pProblem); result = CbcAddSosObjects(hCbc, pProblem); result = CbcAddSemiContObjects(hCbc, pProblem); } return CBC_CALL_SUCCESS; } extern int CbcOrClpRead_mode; int CbcSolveProblem(HCBC hCbc, PPROBLEM pProblem, POPTION pOption, int Method) { PCBC pCbc = (PCBC)hCbc; if (!pProblem->SolveAsMIP) { CbcSetClpOptions(hCbc, pOption); if (coinGetOptionChanged(pOption, COIN_INT_PRESOLVETYPE)) pCbc->clp->initialSolve(*pCbc->clp_presolve); else { pCbc->clp->initialSolve(); } } else { #ifdef NEW_STYLE_CBCMAIN if (coinGetIntOption(pOption, COIN_INT_MIPUSECBCMAIN)) { CbcMain0(*pCbc->cbc); CbcSetClpOptions(hCbc, pOption); CbcSetCbcOptions(hCbc, pOption); //CbcSetCglOptions(hProb); BK: CbcMain1 will call the Cgl's automatically CbcOrClpRead_mode = 1; // BK: Fix bug in CbcMain1, CbcOrClpRead_mode not initialized (CpcSolver.cpp, stable 2.2) int logLevel = coinGetIntOption(pOption, COIN_INT_LOGLEVEL); if (logLevel == 1) { const int argc = 3; const char* argv[] = {"CoinMP", "-solve", "-quit"}; CbcMain1(argc, argv, *pCbc->cbc); } else { char logstr[100]; // BK 2013/11/28: Allows setting the log level from CoinMP. Thanks to Miles Lubin for suggesting this sprintf(logstr, "%d", logLevel); const int argc = 5; const char* argv[] = {"CoinMP", "-log", logstr, "-solve", "-quit"}; CbcMain1(argc, argv, *pCbc->cbc); } } else #endif { CbcSetClpOptions(hCbc, pOption); CbcSetCbcOptions(hCbc, pOption); CbcSetCglOptions(hCbc, pOption); pCbc->cbc->initialSolve(); pCbc->cbc->branchAndBound(); } } return CBC_CALL_SUCCESS; } int CbcRetrieveSolutionResults(HCBC hCbc, PPROBLEM pProblem, PRESULT pResult) { PCBC pCbc = (PCBC)hCbc; const double* columnPrimal; const double* columnDual; const double* rowPrimal; const double* rowDual; int i; if (!pProblem->SolveAsMIP) { pResult->SolutionStatus = pCbc->clp->status(); pResult->ObjectValue = pCbc->clp->objectiveValue(); pResult->MipBestBound = 0.0; pResult->IterCount = pCbc->clp->numberIterations(); pResult->MipNodeCount = 0; } else { pResult->SolutionStatus = pCbc->cbc->status(); pResult->ObjectValue = pCbc->cbc->getObjValue(); pResult->MipBestBound = pCbc->cbc->getBestPossibleObjValue(); pResult->IterCount = pCbc->cbc->getIterationCount(); pResult->MipNodeCount = pCbc->cbc->getNodeCount(); } switch (pResult->SolutionStatus) { case 0: strcpy(pResult->SolutionText, "Optimal solution found"); break; case 1: strcpy(pResult->SolutionText, "Problem primal infeasible"); break; case 2: strcpy(pResult->SolutionText, "Problem dual infeasible"); break; case 3: strcpy(pResult->SolutionText, "Stopped on iterations"); break; case 4: strcpy(pResult->SolutionText, "Stopped due to errors"); break; case 5: strcpy(pResult->SolutionText, "Stopped by user"); break; default: sprintf(pResult->SolutionText, "Unknown CBC solution status (%d)", pResult->SolutionStatus); break; } if (!pProblem->SolveAsMIP) { columnPrimal = pCbc->clp->primalColumnSolution(); columnDual = pCbc->clp->dualColumnSolution(); rowPrimal = pCbc->clp->primalRowSolution(); rowDual = pCbc->clp->dualRowSolution(); pResult->ColActivity = (double*) malloc(pProblem->ColCount * sizeof(double)); pResult->ReducedCost = (double*) malloc(pProblem->ColCount * sizeof(double)); pResult->RowActivity = (double*) malloc(pProblem->RowCount * sizeof(double)); pResult->SlackValues = (double*) malloc(pProblem->RowCount * sizeof(double)); pResult->ShadowPrice = (double*) malloc(pProblem->RowCount * sizeof(double)); if (!pResult->ColActivity || !pResult->ReducedCost || !pResult->RowActivity || !pResult->SlackValues || !pResult->ShadowPrice) { return CBC_CALL_FAILED; } memcpy(pResult->ColActivity, columnPrimal, pProblem->ColCount * sizeof(double)); memcpy(pResult->ReducedCost, columnDual, pProblem->ColCount * sizeof(double)); memcpy(pResult->RowActivity, rowPrimal, pProblem->RowCount * sizeof(double)); memcpy(pResult->ShadowPrice, rowDual, pProblem->RowCount * sizeof(double)); for (i = 0; i < pProblem->RowCount; i++) { pResult->SlackValues[i] = pProblem->RHSValues[i] - pResult->RowActivity[i]; } } else { columnPrimal = pCbc->cbc->solver()->getColSolution(); pResult->ColActivity = (double*) malloc(pProblem->ColCount * sizeof(double)); if (!pResult->ColActivity) { return CBC_CALL_FAILED; } memcpy(pResult->ColActivity, columnPrimal, pProblem->ColCount * sizeof(double)); } return CBC_CALL_SUCCESS; } int CbcOptimizeProblem(PPROBLEM pProblem, PRESULT pResult, PSOLVER pSolver, POPTION pOption, int Method) { HCBC hCbc; int result; hCbc = CbcCreateSolverObject(); result = CbcLoadAllSolverObjects(hCbc, pProblem); result = CbcSetAllCallbacks(hCbc, pSolver, pOption); result = CbcSolveProblem(hCbc, pProblem, pOption, Method); result = CbcRetrieveSolutionResults(hCbc, pProblem, pResult); CbcClearSolverObject(hCbc); return CBC_CALL_SUCCESS; } int CbcReadMpsFile(PPROBLEM pProblem, const char *ReadFilename) { PCBC pCbc; HCBC hCbc; hCbc = CbcCreateSolverObject(); pCbc = (PCBC)hCbc; pCbc->clp->readMps(ReadFilename, 1, 0); CbcClearSolverObject(hCbc); return CBC_CALL_SUCCESS; } int CbcWriteMpsFile(PPROBLEM pProblem, const char *WriteFilename) { int result; PCBC pCbc; HCBC hCbc; const char* extension; hCbc = CbcCreateSolverObject(); pCbc = (PCBC)hCbc; result = CbcLoadAllSolverObjects(hCbc, pProblem); if (strstr(WriteFilename, ".mps") == NULL) extension = "mps"; else { extension = ""; } pCbc->osi->writeMps(WriteFilename, extension, pProblem->ObjectSense); //result = CbcClearAllSolverObjects(hCbc); CbcClearSolverObject(hCbc); return CBC_CALL_SUCCESS; } /************************************************************************/ /* Option Table */ /************************************************************************/ #define OPTIONCOUNT 68 SOLVOPTINFO OptionTable[OPTIONCOUNT] = { {"SolveMethod", "SolveMethod", GRP_SIMPLEX, 0, 0, 0, 5, OPT_LIST, 0, COIN_INT_SOLVEMETHOD}, /*enum SolveType { useDual=0, usePrimal, usePrimalorSprint, useBarrier, useBarrierNoCross, automatic*/ {"PresolveType", "Presolve", GRP_SIMPLEX, 0, 0, 0, 2, OPT_LIST, 0, COIN_INT_PRESOLVETYPE}, /*enum PresolveType { presolveOn=0, presolveOff, presolveNumber }; */ {"Scaling", "Scaling", GRP_SIMPLEX, 3, 3, 0, 4, OPT_LIST, 0, COIN_INT_SCALING}, /* Sets or unsets scaling, 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later) */ {"Perturbation", "Perturb", GRP_SIMPLEX, 100, 100, 0, 100, OPT_INT, 0, COIN_INT_PERTURBATION}, /* 0 - Off, 50 - On, 100 - Only if clp stalls */ {"PrimalColPivotAlg", "PrimPivAlg", GRP_SIMPLEX, 1, 1, 0, 4, OPT_LIST, 0, COIN_INT_PRIMALPIVOTALG}, /*0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 and 2 depending on factorization 4 starts as partial dantzig/devex but then may switch between 0 and 2.*/ {"DualRowPivotAlg", "DualPivAlg", GRP_SIMPLEX, 1, 1, 0, 3, OPT_LIST, 0, COIN_INT_DUALPIVOTALG}, /*0 is uninitialized, 1 full, 2 is partial uninitialized, 3 starts as 2 but may switch to 1.*/ {"LogLevel", "LogLevel", GRP_LOGFILE, 1, 1, 0, 4, OPT_LIST, 0, COIN_INT_LOGLEVEL}, {"MaxIterations", "MaxIter", GRP_LIMITS, 99999999, 99999999, 0, MAXINT, OPT_INT, 0, COIN_INT_MAXITER}, {"MaxSeconds", "MaxSeconds", GRP_LIMITS, -1.0, -1.0, -1.0, MAXREAL, OPT_REAL, 0, COIN_REAL_MAXSECONDS}, {"CrashInd", "CrashInd", GRP_SIMPLEX, 0, 0, 0, 1, OPT_ONOFF, 0, COIN_INT_CRASHIND}, {"CrashPivot", "CrashPivot", GRP_SIMPLEX, 0, 0, -1, 2, OPT_LIST, 0, COIN_INT_CRASHPIVOT}, {"CrashGap", "CrashGap", GRP_SIMPLEX, 1000.0, 1000.0, 0.0, MAXREAL, OPT_REAL, 0, COIN_REAL_CRASHGAP}, {"PrimalObjectLimit", "PrimalObjLim", GRP_SIMPLEX, MAXREAL, MAXREAL, 0.0, MAXREAL, OPT_REAL, 0, COIN_REAL_PRIMALOBJLIM}, {"DualObjectLimit", "DualObjLim", GRP_SIMPLEX, MAXREAL, MAXREAL, 0.0, MAXREAL, OPT_REAL, 0, COIN_REAL_DUALOBJLIM}, {"PrimalTolerance", "PrimalTol", GRP_SIMPLEX, 1e-7, 1e-7, 0.0, MAXREAL, OPT_REAL, 0, COIN_REAL_PRIMALOBJTOL}, {"DualTolerance", "DualTol", GRP_SIMPLEX, 1e-7, 1e-7, 0.0, MAXREAL, OPT_REAL, 0, COIN_REAL_DUALOBJTOL}, {"MipMaxNodes", "MipMaxNodes", GRP_LIMITS, 9999999, 9999999, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPMAXNODES}, {"MipMaxSolutions", "MipMaxSol", GRP_LIMITS, 9999999, 9999999, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPMAXSOL}, {"MipMaxSeconds", "MipMaxSec", GRP_LIMITS, 1e100, 1e100, 0.0, MAXREAL, OPT_REAL, 0, COIN_REAL_MIPMAXSEC}, {"MipFathomDiscipline", "FathomDisc", GRP_MIPSTRAT, 0, 0, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPFATHOMDISC}, {"MipHotStart", "HotStart", GRP_MIPSTRAT, 0, 0, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPHOTSTART}, // {"MipForcePriority", "ForcePrior", GRP_MIPSTRAT, -1, -1,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPFORCEPRIOR}, {"MipMinimumDrop", "MinimumDrop", GRP_MIPSTRAT, 1e-4, 1e-4,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPMINIMUMDROP}, {"MipMaxCutPasses", "MaxCutPass", GRP_MIPSTRAT, 2, 2,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPMAXCUTPASS}, {"MipMaxCutPassAtRoot", "MaxPassRoot", GRP_MIPSTRAT, 50, 50,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPMAXPASSROOT}, {"MipStrongBranching", "StrongBranch", GRP_MIPSTRAT, 5, 5, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPSTRONGBRANCH}, {"MipScanGlobalCuts", "ScanGlobCuts", GRP_MIPSTRAT, 1, 1, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPSCANGLOBCUTS}, {"MipIntegerTolerance", "MipIntTol", GRP_MIPTOL, 1e-6, 1e-6, 0.0, 1.0, OPT_REAL, 0, COIN_REAL_MIPINTTOL}, {"MipInfeasWeight", "MipInfWeight", GRP_MIPTOL, 0.0, 0.0, 0.0, MAXREAL, OPT_REAL, 0, COIN_REAL_MIPINFWEIGHT}, {"MipCutoffIncrement", "MipCutIncr", GRP_MIPTOL, 1e-5, 1e-5, 0.0, 1.0, OPT_REAL, 0, COIN_REAL_MIPCUTOFF}, {"MipAllowableGap", "MipAbsGap", GRP_MIPTOL, 1e-10, 1e-10, 0.0, MAXREAL, OPT_REAL, 0, COIN_REAL_MIPABSGAP}, {"MipFractionalGap", "MipFracGap", GRP_MIPTOL, 1e-10, 1e-10, 0.0, 1.0, OPT_REAL, 0, COIN_REAL_MIPFRACGAP}, /* Probing */ {"MipCutProbing", "CutProbing", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCUT_PROBING}, {"MipProbeFrequency", "ProbeFreq", GRP_MIPCUTS, -1, -1,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPPROBE_FREQ}, {"MipProbeMode", "ProbeMode", GRP_MIPCUTS, 1, 1, 0, 2, OPT_LIST, 0, COIN_INT_MIPPROBE_MODE}, {"MipProbeUseObjective", "UseObject", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPPROBE_USEOBJ}, {"MipProbeMaxPass", "MaxPass", GRP_MIPCUTS, 3, 3, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPPROBE_MAXPASS}, {"MipProbeMaxProbe", "MaxProbe", GRP_MIPCUTS, 100, 100, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPPROBE_MAXPROBE}, {"MipProbeMaxLook", "MaxLook", GRP_MIPCUTS, 50, 50, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPPROBE_MAXLOOK}, {"MipProbeRowCuts", "RowCuts", GRP_MIPCUTS, 3, 3, 0, 3, OPT_LIST, 0, COIN_INT_MIPPROBE_ROWCUTS}, /* Gomory cuts */ {"MipCutGomory", "CutGomory", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCUT_GOMORY}, {"MipGomoryFrequency", "GomoryFreq", GRP_MIPCUTS, -1, -1,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPGOMORY_FREQ}, {"MipGomoryLimit", "GomoryLimit", GRP_MIPCUTS, 50, 50, 1, MAXINT, OPT_INT, 0, COIN_INT_MIPGOMORY_LIMIT}, {"MipGomoryAway", "GomoryAway", GRP_MIPCUTS, 0.05, 0.05, 0.0001, 0.5, OPT_REAL, 0, COIN_REAL_MIPGOMORY_AWAY}, /* Knapsack cuts */ {"MipCutKnapsack", "CutKnapsack", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCUT_KNAPSACK}, {"MipKnapsackFrequency", "KrapsackFreq", GRP_MIPCUTS, -1, -1,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPKNAPSACK_FREQ}, {"MipKnapsackMaxIn", "KnapsackMaxIn",GRP_MIPCUTS, 50, 50, 1, MAXINT, OPT_INT, 0, COIN_INT_MIPKNAPSACK_MAXIN}, /* Oddhole cuts */ {"MipCutOddHole", "CutOddHole", GRP_MIPCUTS, 0, 0, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCUT_ODDHOLE}, {"MipOddHoleFrequency", "OddHoleFreq", GRP_MIPCUTS, -1, -1,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPODDHOLE_FREQ}, {"MipOddHoleMinViolation", "MinViolation", GRP_MIPCUTS, 0.001, 0.001,1.01e-8, 0.5, OPT_REAL, 0, COIN_REAL_MIPODDHOLE_MINVIOL}, {"MipOddHoleMinViolPer", "MinViolPer", GRP_MIPCUTS, 0.0003, 0.0003,1.01e-8, 0.25, OPT_REAL, 0, COIN_REAL_MIPODDHOLE_MINVIOLPER}, {"MipOddHoleMaxEntries", "MaxEntries", GRP_MIPCUTS, 100, 100, 3, MAXINT, OPT_INT, 0, COIN_INT_MIPODDHOLE_MAXENTRIES}, /* Clique cuts */ {"MipCutClique", "CutClique", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCUT_CLIQUE}, {"MipCliqueFrequency", "CliqueFreq", GRP_MIPCUTS, -1, -1,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPCLIQUE_FREQ}, {"MipCliquePacking", "CliquePacking",GRP_MIPCUTS, 0, 0, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCLIQUE_PACKING}, {"MipCliqueStar", "CliqueStar", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCLIQUE_STAR}, {"MipCliqueStarMethod", "StarMethod", GRP_MIPCUTS, 2, 2, 0, 2, OPT_LIST, 0, COIN_INT_MIPCLIQUE_STARMETHOD}, {"MipCliqueStarMaxLen", "StarMaxLen", GRP_MIPCUTS, 12, 12, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPCLIQUE_STARMAXLEN}, {"MipCliqueStarReport", "StarReport", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCLIQUE_STARREPORT}, {"MipCliqueRow", "CliqueRow", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCLIQUE_ROW}, {"MipCliqueRowMaxLen", "ClqRowMaxLen", GRP_MIPCUTS, 12, 12, 0, MAXINT, OPT_INT, 0, COIN_INT_MIPCLIQUE_ROWMAXLEN}, {"MipCliqueRowReport", "ClqRowReport", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCLIQUE_ROWREPORT}, {"MipCliqueMinViolation", "ClqMinViol", GRP_MIPCUTS, -1.0, -1.0,-MAXREAL,MAXREAL, OPT_REAL, 0, COIN_REAL_MIPCLIQUE_MINVIOL}, /* Lift and Project */ {"MipCutLiftAndProject", "CutLiftPro", GRP_MIPCUTS, 0, 0, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCUT_LIFTPROJECT}, {"MipLiftCoverFrequency", "LiftProFreq", GRP_MIPCUTS, -1, -1,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPLIFTPRO_FREQ}, {"MipLiftCoverBetaOne", "LiftProBeta", GRP_MIPCUTS, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPLIFTPRO_BETAONE}, /* Simple Rounding */ {"MipCutSimpleRounding", "CutSimpRound", GRP_MIPCUTS, 0, 0, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPCUT_SIMPROUND}, {"MipSimpleRoundFrequency","SimpRoundFreq",GRP_MIPCUTS, -1, -1,-MAXINT, MAXINT, OPT_INT, 0, COIN_INT_MIPSIMPROUND_FREQ}, {"MipUseCbcMain", "UseCbcMain", GRP_MIPSTRAT, 1, 1, 0, 1, OPT_ONOFF, 0, COIN_INT_MIPUSECBCMAIN} }; int CbcGetOptionCount(void) { return OPTIONCOUNT; } SOLVOPTINFO *CbcGetOptionTable(void) { return &OptionTable[0]; } int CbcGetOptionID(int OptionNr) { if ((OptionNr < 0) || (OptionNr >= OPTIONCOUNT)) { return -1; } return OptionTable[OptionNr].OptionID; } int CbcLocateOptionID(int OptionID) { int i; SOLVOPTINFO *OptionTable; OptionTable = CbcGetOptionTable(); for (i = 0; i < CbcGetOptionCount(); i++) { if (OptionID == OptionTable[i].OptionID) { return i; } } return -1; } SOLVOPTINFO *CbcGetOptionEntry(int OptionID) { int OptionNr; SOLVOPTINFO *OptionTable; OptionTable = CbcGetOptionTable(); OptionNr = CbcLocateOptionID(OptionID); if (OptionNr < 0) { return NULL; } return &OptionTable[OptionNr]; } int CbcGetOptionChanged(int OptionID) { SOLVOPTINFO *OptionEntry; OptionEntry = CbcGetOptionEntry(OptionID); if (!OptionEntry) { return 0; } return OptionEntry->changed; } int CbcGetIntOption(int OptionID) { SOLVOPTINFO *OptionEntry; OptionEntry = CbcGetOptionEntry(OptionID); if (!OptionEntry) { return 0; } if (OptionEntry->OptionType == OPT_REAL) { return 0; } return (int)OptionEntry->CurrentValue; } int CbcSetIntOption(int OptionID, int IntValue) { SOLVOPTINFO *OptionEntry; OptionEntry = CbcGetOptionEntry(OptionID); if (!OptionEntry) { return CBC_CALL_FAILED; } if (OptionEntry->OptionType == OPT_REAL) { return CBC_CALL_FAILED; } //coinWriteMsgLog("%s[%d] = %d (was %d)",OptionEntry->OptionName, OptionNr, IntValue, (int)OptionEntry->CurrentValue); OptionEntry->CurrentValue = IntValue; OptionEntry->changed = 1; return CBC_CALL_SUCCESS; } double CbcGetRealOption(int OptionID) { SOLVOPTINFO *OptionEntry; OptionEntry = CbcGetOptionEntry(OptionID); if (!OptionEntry) { return 0.0; } if (OptionEntry->OptionType != OPT_REAL) { return 0.0; } return OptionEntry->CurrentValue; } int CbcSetRealOption(int OptionID, double RealValue) { SOLVOPTINFO *OptionEntry; OptionEntry = CbcGetOptionEntry(OptionID); if (!OptionEntry) { return CBC_CALL_FAILED; } if (OptionEntry->OptionType != OPT_REAL) { return CBC_CALL_FAILED; } //coinWriteMsgLog("%s[%d] = %lg (was %lg)",OptionTable[OptionNr].OptionName, OptionNr, RealValue, OptionTable[OptionNr].CurrentValue); OptionEntry->CurrentValue = RealValue; OptionEntry->changed = 1; return CBC_CALL_SUCCESS; } //double // DualTolerance // PrimalTolerance // DualBound // PrimalWeight (setInfeasibilityCost) // MaxTime (setMaximumSeconds) // ObjScale (setObjectiveScale) // RhsScale (setRhsScale) //int //LogLevel (setLogLovel/model->factorization()->messageLevel(8);) //MaxFactor (model->factorization()->maximumPivots(value); //PertValue (setPerturbation) //MaxIteration (setMaximumIterations) //AutoScale off //Barrier //BiasLU UU (UX, LX, LL) //Crash off //Direction min //Directory //dualBound 1e-20, 1e12 //dualPivot Automatic, (Dantzig, partial, Steepest) //DualSimplex //dualTolerance 1e-20,1e12 //Exit //ErrorsAllowed //FakeBound //Help //Idiot //Import //KeepNames //LogLevel //Maximize //MaxFactor 1, 999999 //MaxIteration 0, 99999999 //Messages //ObjScale -1e20, 1e20 //PresolvePass 0, 100 //PertValue -5000, 102, false //Perturbation On, off //PlusMinus -1, false //Presolve On //PrimalPivot Automatic, (Dantzig, partial, Steepest, change, sprint) //PrimalSimplex //PrimalTolerance 1e-20,1e12 //PrimalWeight 1e20, 1e20 //RhsScale -1e20, 1.20 //Scaling Off, Equilibrium, geometric, automatic //MaxTime 0.0, 1e12 //SparseFactor On, Off //SprintCrash -1, 500 CoinMP-1.8.3/CoinMP/src/CoinMP.def0000644000175000017500000001255412246055117015047 0ustar renerene LIBRARY "CoinMP" EXPORTS CoinInitSolver CoinFreeSolver CoinGetSolverName CoinGetSolverNameBuf CoinGetVersionStr CoinGetVersionStrBuf CoinGetVersion CoinGetFeatures CoinGetMethods CoinGetInfinity CoinCreateProblem CoinLoadMatrix CoinLoadNames CoinLoadNamesBuf CoinLoadProblem CoinLoadProblemBuf CoinLoadInitValues CoinLoadInteger CoinLoadPriority CoinLoadSos CoinLoadSemiCont CoinLoadQuadratic CoinLoadNonlinear CoinUnloadProblem CoinCheckProblem CoinGetProblemName CoinGetProblemNameBuf CoinGetColCount CoinGetRowCount CoinGetColName CoinGetColNameBuf CoinGetRowName CoinGetRowNameBuf CoinRegisterMsgLogCallback CoinRegisterLPIterCallback CoinRegisterMipNodeCallback CoinSetMsgLogCallback CoinSetIterCallback CoinSetMipNodeCallback CoinOptimizeProblem CoinGetSolutionStatus CoinGetSolutionText CoinGetSolutionTextBuf CoinGetObjectValue CoinGetMipBestBound CoinGetIterCount CoinGetMipNodeCount CoinGetSolutionValues CoinGetSolutionRanges CoinGetSolutionBasis CoinReadFile CoinWriteFile CoinOpenLogFile CoinCloseLogFile CoinGetOptionCount CoinLocateOptionID CoinLocateOptionName CoinGetOptionID CoinGetOptionInfo CoinGetIntOptionMinMax CoinGetRealOptionMinMax CoinGetOptionNamesBuf CoinGetOptionGroup CoinGetOptionType CoinGetIntOptionDefaultValue CoinGetIntOptionMinValue CoinGetIntOptionMaxValue CoinGetRealOptionDefaultValue CoinGetRealOptionMinValue CoinGetRealOptionMaxValue CoinGetOptionName CoinGetOptionNameBuf CoinGetOptionShortName CoinGetOptionShortNameBuf CoinGetOptionChanged CoinGetIntOption CoinSetIntOption CoinGetRealOption CoinSetRealOption CoinGetStringOption CoinGetStringOptionBuf CoinSetStringOption Clp_newModel Clp_deleteModel ClpSolve_new ClpSolve_delete Clp_loadProblem Clp_loadQuadraticObjective Clp_readMps Clp_copyInIntegerInformation Clp_deleteIntegerInformation Clp_resize Clp_deleteRows Clp_addRows Clp_deleteColumns Clp_addColumns Clp_chgRowLower Clp_chgRowUpper Clp_chgColumnLower Clp_chgColumnUpper Clp_chgObjCoefficients Clp_dropNames Clp_copyNames Clp_numberRows Clp_numberColumns Clp_primalTolerance Clp_setPrimalTolerance Clp_dualTolerance Clp_setDualTolerance Clp_dualObjectiveLimit Clp_setDualObjectiveLimit Clp_objectiveOffset Clp_setObjectiveOffset Clp_problemName Clp_setProblemName Clp_numberIterations Clp_setNumberIterations Clp_setMaximumIterations Clp_maximumSeconds Clp_setMaximumSeconds Clp_hitMaximumIterations Clp_status Clp_setProblemStatus Clp_secondaryStatus Clp_setSecondaryStatus Clp_optimizationDirection Clp_setOptimizationDirection Clp_primalRowSolution Clp_primalColumnSolution Clp_dualRowSolution Clp_dualColumnSolution Clp_rowLower Clp_rowUpper Clp_objective Clp_columnLower Clp_columnUpper Clp_getNumElements Clp_getVectorStarts Clp_getIndices Clp_getVectorLengths Clp_getElements Clp_objectiveValue Clp_integerInformation Clp_infeasibilityRay Clp_unboundedRay Clp_statusExists Clp_statusArray Clp_copyinStatus Clp_getColumnStatus Clp_getRowStatus Clp_setColumnStatus Clp_setRowStatus Clp_setUserPointer Clp_getUserPointer Clp_registerCallBack Clp_clearCallBack Clp_setLogLevel Clp_logLevel Clp_lengthNames Clp_rowName Clp_columnName Clp_initialSolve Clp_initialSolveWithOptions Clp_initialDualSolve Clp_initialPrimalSolve Clp_initialBarrierSolve Clp_initialBarrierNoCrossSolve Clp_dual Clp_primal Clp_idiot Clp_scaling Clp_scalingFlag Clp_crash Clp_primalFeasible Clp_dualFeasible Clp_dualBound Clp_setDualBound Clp_infeasibilityCost Clp_setInfeasibilityCost Clp_perturbation Clp_setPerturbation Clp_algorithm Clp_setAlgorithm Clp_sumDualInfeasibilities Clp_numberDualInfeasibilities Clp_sumPrimalInfeasibilities Clp_numberPrimalInfeasibilities Clp_saveModel Clp_restoreModel Clp_checkSolution Clp_getNumRows Clp_getNumCols Clp_getIterationCount Clp_isAbandoned Clp_isProvenOptimal Clp_isProvenPrimalInfeasible Clp_isProvenDualInfeasible Clp_isPrimalObjectiveLimitReached Clp_isDualObjectiveLimitReached Clp_isIterationLimitReached Clp_getObjSense Clp_setObjSense Clp_getRowActivity Clp_getColSolution Clp_setColSolution Clp_getRowPrice Clp_getReducedCost Clp_getRowLower Clp_getRowUpper Clp_getObjCoefficients Clp_getColLower Clp_getColUpper Clp_getObjValue Clp_printModel Clp_getSmallElementValue Clp_setSmallElementValue ClpSolve_setSpecialOption ClpSolve_getSpecialOption ClpSolve_setSolveType ClpSolve_getSolveType ClpSolve_setPresolveType ClpSolve_getPresolveType ClpSolve_getPresolvePasses ClpSolve_getExtraInfo ClpSolve_setInfeasibleReturn ClpSolve_infeasibleReturn ClpSolve_doDual ClpSolve_setDoDual ClpSolve_doSingleton ClpSolve_setDoSingleton ClpSolve_doDoubleton ClpSolve_setDoDoubleton ClpSolve_doTripleton ClpSolve_setDoTripleton ClpSolve_doTighten ClpSolve_setDoTighten ClpSolve_doForcing ClpSolve_setDoForcing ClpSolve_doImpliedFree ClpSolve_setDoImpliedFree ClpSolve_doDupcol ClpSolve_setDoDupcol ClpSolve_doDuprow ClpSolve_setDoDuprow ClpSolve_doSingletonColumn ClpSolve_setDoSingletonColumn ClpSolve_presolveActions ClpSolve_setPresolveActions ClpSolve_substitution ClpSolve_setSubstitution CoinMP-1.8.3/CoinMP/src/CoinMP.cpp0000644000175000017500000006425612263025313015073 0ustar renerene/************************************************************************/ /* */ /* CoinMP Solver Maximal Software */ /* */ /* File : 'coinmp.cpp' */ /* */ /* Version : 1.7 */ /* */ /* Author : Bjarni Kristjansson, Maximal Software */ /* */ /* Copyright (c) 2002-2013 Bjarni Kristjansson */ /* */ /************************************************************************/ // $Id: CoinMP.cpp 627 2014-01-07 16:26:51Z bjarni $ #include #include #include #include #include #include "CoinProblem.h" #include "CoinResult.h" #include "CoinSolver.h" #include "CoinOption.h" #include "CoinCbc.h" #include "config_coinmp_default.h" #define SOLVER_EXPORT #define SOLV_LINK_LIB #include "CoinMP.h" const char* COINMP_VERSIONSTR = "1.7.6"; const int COINMP_VERSIONINT = 176; const double COINMP_VERSIONDBL = 1.76; const char* COINMP_NAME = "CoinMP"; /************************************************************************/ /* Solver Initialization */ /************************************************************************/ SOLVAPI int SOLVCALL CoinInitSolver(const char* LicenseStr) { return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinFreeSolver(void) { return SOLV_CALL_SUCCESS; } /************************************************************************/ /* Solver Queries */ /************************************************************************/ SOLVAPI const char* SOLVCALL CoinGetSolverName(void) { return COINMP_NAME; } SOLVAPI int SOLVCALL CoinGetSolverNameBuf(char* SolverName, int buflen) { strncpy(SolverName, CoinGetSolverName(), buflen-1); SolverName[buflen-1] = '\0'; return (int)strlen(SolverName); } SOLVAPI const char* SOLVCALL CoinGetVersionStr(void) { return COINMP_VERSIONSTR; } SOLVAPI int SOLVCALL CoinGetVersionStrBuf(char* VersionStr, int buflen) { strncpy(VersionStr, CoinGetVersionStr(), buflen-1); VersionStr[buflen-1] = '\0'; return (int)strlen(VersionStr); } SOLVAPI double SOLVCALL CoinGetVersion(void) { return COINMP_VERSIONDBL; } SOLVAPI int SOLVCALL CoinGetFeatures(void) { return SOLV_FEATURE_LP | SOLV_FEATURE_MIP; } SOLVAPI int SOLVCALL CoinGetMethods(void) { return SOLV_METHOD_PRIMAL | SOLV_METHOD_DUAL | SOLV_METHOD_BARRIER; } SOLVAPI double SOLVCALL CoinGetInfinity(void) { return COIN_DBL_MAX; } /************************************************************************/ /* Coin Problem Info Structure */ /************************************************************************/ typedef struct { PPROBLEM pProblem; PRESULT pResult; PSOLVER pSolver; POPTION pOption; } COININFO, *PCOIN; /************************************************************************/ /* Create/Load Problem */ /************************************************************************/ SOLVAPI HPROB SOLVCALL CoinCreateProblem(const char* ProblemName) { PCOIN pCoin; pCoin = (PCOIN) malloc(sizeof(COININFO)); pCoin->pProblem = coinCreateProblemObject(); pCoin->pResult = coinCreateResultObject(); pCoin->pSolver = coinCreateSolverObject(); pCoin->pOption = coinCreateOptionObject(); coinSetProblemName(pCoin->pProblem, ProblemName); coinCopyOptionTable(pCoin->pOption, CbcGetOptionTable(), CbcGetOptionCount()); return (HPROB)pCoin; } SOLVAPI int SOLVCALL CoinUnloadProblem(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; if (pCoin) { coinClearProblemObject(pCoin->pProblem); coinClearResultObject(pCoin->pResult); coinClearSolverObject(pCoin->pSolver); coinClearOptionObject(pCoin->pOption); } free(pCoin); pCoin = NULL; return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadMatrix(HPROB hProb, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues) { PCOIN pCoin = (PCOIN)hProb; PPROBLEM pProblem = pCoin->pProblem; if (!coinStoreMatrix(pProblem, ColCount, RowCount, NZCount, RangeCount, ObjectSense, ObjectConst, ObjectCoeffs, LowerBounds, UpperBounds, RowType, RHSValues, RangeValues, MatrixBegin, MatrixCount, MatrixIndex, MatrixValues)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadNames(HPROB hProb, char** ColNamesList, char** RowNamesList, const char* ObjectName) { PCOIN pCoin = (PCOIN)hProb; if (!coinStoreNamesList(pCoin->pProblem, ColNamesList, RowNamesList, ObjectName)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadNamesBuf(HPROB hProb, const char* ColNamesBuf, const char* RowNamesBuf, const char* ObjectName) { PCOIN pCoin = (PCOIN)hProb; if (!coinStoreNamesBuf(pCoin->pProblem, ColNamesBuf, RowNamesBuf, ObjectName)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadProblem(HPROB hProb, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues, char** ColNamesList, char** RowNamesList, const char* ObjectName) { PCOIN pCoin = (PCOIN)hProb; PPROBLEM pProblem = pCoin->pProblem; if (!coinStoreMatrix(pProblem, ColCount, RowCount, NZCount, RangeCount, ObjectSense, ObjectConst, ObjectCoeffs, LowerBounds, UpperBounds, RowType, RHSValues, RangeValues, MatrixBegin, MatrixCount, MatrixIndex, MatrixValues)) { return SOLV_CALL_FAILED; } if (!coinStoreNamesList(pProblem, ColNamesList, RowNamesList, ObjectName)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } // CoinLoadProblemBuf accepts ColNamesBuf/RowNamesBuf as character buffer with \0 after each name SOLVAPI int SOLVCALL CoinLoadProblemBuf(HPROB hProb, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues, const char* ColNamesBuf, const char* RowNamesBuf, const char* ObjectName) { PCOIN pCoin = (PCOIN)hProb; PPROBLEM pProblem = pCoin->pProblem; if (!coinStoreMatrix(pProblem, ColCount, RowCount, NZCount, RangeCount, ObjectSense, ObjectConst, ObjectCoeffs, LowerBounds, UpperBounds, RowType, RHSValues, RangeValues, MatrixBegin, MatrixCount, MatrixIndex, MatrixValues)) { return SOLV_CALL_FAILED; } if (!coinStoreNamesBuf(pProblem, ColNamesBuf, RowNamesBuf, ObjectName)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadInitValues(HPROB hProb, double* InitValues) { PCOIN pCoin = (PCOIN)hProb; if (!coinStoreInitValues(pCoin->pProblem, InitValues)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadInteger(HPROB hProb, const char* ColType) { PCOIN pCoin = (PCOIN)hProb; PPROBLEM pProblem = pCoin->pProblem; if (!coinStoreInteger(pProblem, ColType)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadPriority(HPROB hProb, int PriorCount, int* PriorIndex, int* PriorValues, int* PriorBranch) { PCOIN pCoin = (PCOIN)hProb; if (!coinStorePriority(pCoin->pProblem, PriorCount, PriorIndex, PriorValues, PriorBranch)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadSos(HPROB hProb, int SosCount, int SosNZCount, int* SosType, int* SosPrior, int* SosBegin, int* SosIndex, double* SosRef) { PCOIN pCoin = (PCOIN)hProb; if (!coinStoreSos(pCoin->pProblem, SosCount, SosNZCount, SosType, SosPrior, SosBegin, SosIndex, SosRef)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadSemiCont(HPROB hProb, int SemiCount, int* SemiIndex) { PCOIN pCoin = (PCOIN)hProb; if (!coinStoreSemiCont(pCoin->pProblem, SemiCount, SemiIndex)) { return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinLoadQuadratic(HPROB hProb, int* QuadBegin, int* QuadCount, int* QuadIndex, double* QuadValues) { return SOLV_CALL_FAILED; } SOLVAPI int SOLVCALL CoinLoadNonlinear(HPROB hProb, int NlpTreeCount, int NlpLineCount, int* NlpBegin, int* NlpOper, int* NlpArg1, int* NlpArg2, int* NlpIndex1, int* NlpIndex2, double* NlpValue1, double* NlpValue2) { return SOLV_CALL_FAILED; } #define CHECK_MAXNAMELEN 100 SOLVAPI int SOLVCALL CoinCheckProblem(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; PPROBLEM pProblem = pCoin->pProblem; int i; if (pProblem->ColCount == 0) { return SOLV_CHECK_COLCOUNT; } if ((pProblem->RowCount < 0) || (pProblem->NZCount < 0) || (pProblem->RangeCount < 0)) { return SOLV_CHECK_ROWCOUNT; } if ((pProblem->RangeCount > pProblem->RowCount)) { return SOLV_CHECK_RANGECOUNT; } if ((pProblem->ObjectSense < -1) || (pProblem->ObjectSense > 1)) { return SOLV_CHECK_OBJSENSE; } if (pProblem->RowType && (pProblem->RowCount > 0)) { for (i = 0; i < pProblem->RowCount; i++) { if ((pProblem->RowType[i] != 'L') && (pProblem->RowType[i] != 'E') && (pProblem->RowType[i] != 'G') && (pProblem->RowType[i] != 'R') && (pProblem->RowType[i] != 'N')) { return SOLV_CHECK_ROWTYPE; } } } if (pProblem->NZCount > 0) { for (i = 0; i < pProblem->ColCount; i++) { if (pProblem->MatrixBegin[i] < 0) { return SOLV_CHECK_MATBEGIN; } if (pProblem->MatrixCount[i] < 0) { return SOLV_CHECK_MATCOUNT; } if (pProblem->MatrixBegin[i+1] - pProblem->MatrixBegin[i] != pProblem->MatrixCount[i]) { return SOLV_CHECK_MATBEGCNT; } } if (pProblem->MatrixBegin[pProblem->ColCount] != pProblem->NZCount) { return 100 + pProblem->MatrixBegin[pProblem->ColCount]; } for (i = 0; i < pProblem->NZCount; i++) { if (pProblem->MatrixIndex[i] < 0) { return SOLV_CHECK_MATINDEX; } if (pProblem->MatrixIndex[i] >= pProblem->RowCount) { return SOLV_CHECK_MATINDEXROW; } } } if (pProblem->LowerBounds && pProblem->UpperBounds) { for (i = 0; i < pProblem->ColCount; i++) { if (pProblem->LowerBounds[i] > pProblem->UpperBounds[i]) { return SOLV_CHECK_BOUNDS; } } } if (pProblem->ColType) { for (i = 0; i < pProblem->ColCount; i++) { if ((pProblem->ColType[i] != 'C') && (pProblem->ColType[i] != 'B') && (pProblem->ColType[i] != 'I')) { return SOLV_CHECK_COLTYPE; } } } if (pProblem->ColNamesBuf) { if (pProblem->lenColNamesBuf <= 0) { return SOLV_CHECK_COLNAMES; } if (pProblem->lenColNamesBuf > pProblem->ColCount * CHECK_MAXNAMELEN) { return SOLV_CHECK_COLNAMESLEN; } } if (pProblem->RowNamesBuf) { if (pProblem->lenRowNamesBuf <= 0) { return SOLV_CHECK_ROWNAMES; } if (pProblem->lenRowNamesBuf > pProblem->RowCount * CHECK_MAXNAMELEN) { return SOLV_CHECK_ROWNAMSLEN; } } return SOLV_CALL_SUCCESS; } /************************************************************************/ /* Problem Queries */ /************************************************************************/ SOLVAPI const char* SOLVCALL CoinGetProblemName(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pProblem->ProblemName; } SOLVAPI int SOLVCALL CoinGetProblemNameBuf(HPROB hProb, char* ProbName, int buflen) { strncpy(ProbName, CoinGetProblemName(hProb), buflen-1); ProbName[buflen-1] = '\0'; return (int)strlen(ProbName); } SOLVAPI int SOLVCALL CoinGetColCount(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pProblem->ColCount; } SOLVAPI int SOLVCALL CoinGetRowCount(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pProblem->RowCount; } SOLVAPI const char* SOLVCALL CoinGetColName(HPROB hProb, int col) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pProblem->ColNamesList[col]; } SOLVAPI int SOLVCALL CoinGetColNameBuf(HPROB hProb, int col, char* ColName, int buflen) { strncpy(ColName, CoinGetColName(hProb, col), buflen-1); ColName[buflen-1] = '\0'; return (int)strlen(ColName); } SOLVAPI const char* SOLVCALL CoinGetRowName(HPROB hProb, int row) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pProblem->RowNamesList[row]; } SOLVAPI int SOLVCALL CoinGetRowNameBuf(HPROB hProb, int row, char* RowName, int buflen) { strncpy(RowName, CoinGetRowName(hProb, row), buflen-1); RowName[buflen-1] = '\0'; return (int)strlen(RowName); } SOLVAPI int SOLVCALL CoinRegisterMsgLogCallback(HPROB hProb, COIN_MSGLOG_CB MsgLogCB, void *UserParam) { PCOIN pCoin = (PCOIN)hProb; pCoin->pSolver->MsgLogCB = MsgLogCB; pCoin->pSolver->MsgLogParam = UserParam; return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinRegisterLPIterCallback(HPROB hProb, COIN_LPITER_CB LPIterCB, void *UserParam) { PCOIN pCoin = (PCOIN)hProb; pCoin->pSolver->LPIterCB = LPIterCB; pCoin->pSolver->LPIterParam = UserParam; return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinRegisterMipNodeCallback(HPROB hProb, COIN_MIPNODE_CB MipNodeCB, void *UserParam) { PCOIN pCoin = (PCOIN)hProb; pCoin->pSolver->MipNodeCB = MipNodeCB; pCoin->pSolver->MipNodeParam = UserParam; return SOLV_CALL_SUCCESS; } // Depreciated, use CoinRegisterMsgLogCallback instead SOLVAPI int SOLVCALL CoinSetMsgLogCallback(HPROB hProb, MSGLOGCALLBACK MsgLogCallback) { PCOIN pCoin = (PCOIN)hProb; pCoin->pSolver->MsgLogCallback = MsgLogCallback; return SOLV_CALL_SUCCESS; } // Depreciated, use CoinRegisterLPIterCallback instead SOLVAPI int SOLVCALL CoinSetIterCallback(HPROB hProb, ITERCALLBACK IterCallback) { PCOIN pCoin = (PCOIN)hProb; pCoin->pSolver->IterCallback = IterCallback; return SOLV_CALL_SUCCESS; } // Depreciated, use CoinRegisterMipNodeCallback instead SOLVAPI int SOLVCALL CoinSetMipNodeCallback(HPROB hProb, MIPNODECALLBACK MipNodeCallback) { PCOIN pCoin = (PCOIN)hProb; pCoin->pSolver->MipNodeCallback = MipNodeCallback; return SOLV_CALL_SUCCESS; } /************************************************************************/ /* Optimization */ /************************************************************************/ SOLVAPI int SOLVCALL CoinOptimizeProblem(HPROB hProb, int Method) { PCOIN pCoin = (PCOIN)hProb; return CbcOptimizeProblem(pCoin->pProblem, pCoin->pResult, pCoin->pSolver, pCoin->pOption, Method); } /************************************************************************/ /* Solution status */ /************************************************************************/ SOLVAPI int SOLVCALL CoinGetSolutionStatus(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pResult->SolutionStatus; } SOLVAPI const char* SOLVCALL CoinGetSolutionText(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pResult->SolutionText; } SOLVAPI int SOLVCALL CoinGetSolutionTextBuf(HPROB hProb, char* SolutionText, int buflen) { strncpy(SolutionText, CoinGetSolutionText(hProb), buflen-1); SolutionText[buflen-1] = '\0'; return (int)strlen(SolutionText); } SOLVAPI double SOLVCALL CoinGetObjectValue(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pResult->ObjectValue + pCoin->pProblem->ObjectConst; } SOLVAPI double SOLVCALL CoinGetMipBestBound(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pResult->MipBestBound; } SOLVAPI int SOLVCALL CoinGetIterCount(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pResult->IterCount; } SOLVAPI int SOLVCALL CoinGetMipNodeCount(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return pCoin->pResult->MipNodeCount; } /************************************************************************/ /* Solution retrieval */ /************************************************************************/ SOLVAPI int SOLVCALL CoinGetSolutionValues(HPROB hProb, double* Activity, double* ReducedCost, double* SlackValues, double* ShadowPrice) { PCOIN pCoin = (PCOIN)hProb; PPROBLEM pProblem = pCoin->pProblem; PRESULT pResult = pCoin->pResult; if (Activity && pResult->ColActivity) { memcpy(Activity, pResult->ColActivity, pProblem->ColCount * sizeof(double)); } if (ReducedCost && pResult->ReducedCost) { memcpy(ReducedCost, pResult->ReducedCost, pProblem->ColCount * sizeof(double)); } if (SlackValues && pResult->SlackValues) { memcpy(SlackValues, pResult->SlackValues, pProblem->RowCount * sizeof(double)); } if (ShadowPrice && pResult->ShadowPrice) { memcpy(ShadowPrice, pResult->ShadowPrice, pProblem->RowCount * sizeof(double)); } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinGetSolutionRanges(HPROB hProb, double* ObjLoRange, double* ObjUpRange, double* RhsLoRange, double* RhsUpRange) { PCOIN pCoin = (PCOIN)hProb; PPROBLEM pProblem = pCoin->pProblem; PRESULT pResult = pCoin->pResult; if (ObjLoRange && pResult->ObjLoRange) { memcpy(ObjLoRange, pResult->ObjLoRange, pProblem->ColCount * sizeof(double)); } if (ObjUpRange && pResult->ObjUpRange) { memcpy(ObjUpRange, pResult->ObjUpRange, pProblem->ColCount * sizeof(double)); } if (RhsLoRange && pResult->RhsLoRange) { memcpy(RhsLoRange, pResult->RhsLoRange, pProblem->RowCount * sizeof(double)); } if (RhsUpRange && pResult->RhsUpRange) { memcpy(RhsUpRange, pResult->RhsUpRange, pProblem->RowCount * sizeof(double)); } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinGetSolutionBasis(HPROB hProb, int* ColStatus, int* RowStatus) { PCOIN pCoin = (PCOIN)hProb; PPROBLEM pProblem = pCoin->pProblem; PRESULT pResult = pCoin->pResult; if (ColStatus && pResult->ColStatus) { memcpy(ColStatus, pResult->ColStatus, pProblem->ColCount * sizeof(int)); } if (RowStatus && pResult->RowStatus) { memcpy(RowStatus, pResult->RowStatus, pProblem->RowCount * sizeof(int)); } return SOLV_CALL_SUCCESS; } /************************************************************************/ /* File Handling */ /************************************************************************/ SOLVAPI int SOLVCALL CoinReadFile(HPROB hProb, int FileType, const char* ReadFilename) { PCOIN pCoin = (PCOIN)hProb; switch (FileType) { case SOLV_FILE_MPS: return CbcReadMpsFile(pCoin->pProblem, ReadFilename); case SOLV_FILE_LP: case SOLV_FILE_BASIS: case SOLV_FILE_IIS: default: return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinWriteFile(HPROB hProb, int FileType, const char* WriteFilename) { PCOIN pCoin = (PCOIN)hProb; switch (FileType) { case SOLV_FILE_MPS: return CbcWriteMpsFile(pCoin->pProblem, WriteFilename); case SOLV_FILE_LP: case SOLV_FILE_BASIS: case SOLV_FILE_IIS: default: return SOLV_CALL_FAILED; } return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinOpenLogFile(HPROB hProb, const char* logFilename) { PCOIN pCoin = (PCOIN)hProb; strcpy(pCoin->pSolver->LogFilename, logFilename); return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinCloseLogFile(HPROB hProb) { return SOLV_CALL_SUCCESS; } /************************************************************************/ /* Option Handling */ /************************************************************************/ SOLVAPI int SOLVCALL CoinGetOptionCount(HPROB hProb) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionCount(pCoin->pOption); } SOLVAPI int SOLVCALL CoinLocateOptionID(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinLocateOptionID(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinLocateOptionName(HPROB hProb, const char* OptionName) { PCOIN pCoin = (PCOIN)hProb; return coinLocateOptionName(pCoin->pOption, OptionName); } SOLVAPI int SOLVCALL CoinGetOptionID(HPROB hProb, int OptionNr) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionID(pCoin->pOption, OptionNr); } SOLVAPI int SOLVCALL CoinGetOptionInfo(HPROB hProb, int OptionNr, int* OptionID, int* GroupType, int* OptionType) { PCOIN pCoin = (PCOIN)hProb; int optionID; optionID = coinGetOptionID(pCoin->pOption, OptionNr); if (OptionID) *OptionID = optionID; if (OptionType) *OptionType = coinGetOptionType(pCoin->pOption, optionID); if (GroupType) *GroupType = coinGetOptionGroup(pCoin->pOption, optionID); return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinGetIntOptionMinMax(HPROB hProb, int OptionNr, int* MinValue, int* MaxValue) { PCOIN pCoin = (PCOIN)hProb; int optionID; optionID = coinGetOptionID(pCoin->pOption, OptionNr); if (MinValue) *MinValue = coinGetIntOptionMinValue(pCoin->pOption, optionID); if (MaxValue) *MaxValue = coinGetIntOptionMaxValue(pCoin->pOption, optionID); return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinGetRealOptionMinMax(HPROB hProb, int OptionNr, double* MinValue, double* MaxValue) { PCOIN pCoin = (PCOIN)hProb; int optionID; optionID = coinGetOptionID(pCoin->pOption, OptionNr); if (MinValue) *MinValue = coinGetRealOptionMinValue(pCoin->pOption, optionID); if (MaxValue) *MaxValue = coinGetRealOptionMaxValue(pCoin->pOption, optionID); return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinGetOptionNamesBuf(HPROB hProb, int OptionNr, char* OptionName, char* ShortName, int buflen) { PCOIN pCoin = (PCOIN)hProb; int optionID; optionID = coinGetOptionID(pCoin->pOption, OptionNr); if (OptionName) coinGetOptionNameBuf(pCoin->pOption, optionID, OptionName, buflen); if (ShortName) coinGetOptionShortNameBuf(pCoin->pOption, optionID, ShortName, buflen); return SOLV_CALL_SUCCESS; } SOLVAPI int SOLVCALL CoinGetOptionGroup(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionGroup(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinGetOptionType(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionType(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinGetIntOptionDefaultValue(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetIntOptionDefaultValue(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinGetIntOptionMinValue(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetIntOptionMinValue(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinGetIntOptionMaxValue(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetIntOptionMaxValue(pCoin->pOption, OptionID); } SOLVAPI double SOLVCALL CoinGetRealOptionDefaultValue(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetRealOptionDefaultValue(pCoin->pOption, OptionID); } SOLVAPI double SOLVCALL CoinGetRealOptionMinValue(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetRealOptionMinValue(pCoin->pOption, OptionID); } SOLVAPI double SOLVCALL CoinGetRealOptionMaxValue(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetRealOptionMaxValue(pCoin->pOption, OptionID); } SOLVAPI const char* SOLVCALL CoinGetOptionName(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionName(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinGetOptionNameBuf(HPROB hProb, int OptionID, char* OptionName, int buflen) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionNameBuf(pCoin->pOption, OptionID, OptionName, buflen); } SOLVAPI const char* SOLVCALL CoinGetOptionShortName(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionShortName(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinGetOptionShortNameBuf(HPROB hProb, int OptionID, char* ShortName, int buflen) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionShortNameBuf(pCoin->pOption, OptionID, ShortName, buflen); } SOLVAPI int SOLVCALL CoinGetOptionChanged(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetOptionChanged(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinGetIntOption(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetIntOption(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinSetIntOption(HPROB hProb, int OptionID, int IntValue) { PCOIN pCoin = (PCOIN)hProb; return coinSetIntOption(pCoin->pOption, OptionID, IntValue); } SOLVAPI double SOLVCALL CoinGetRealOption(HPROB hProb, int OptionID) { PCOIN pCoin = (PCOIN)hProb; return coinGetRealOption(pCoin->pOption, OptionID); } SOLVAPI int SOLVCALL CoinSetRealOption(HPROB hProb, int OptionID, double RealValue) { PCOIN pCoin = (PCOIN)hProb; return coinSetRealOption(pCoin->pOption, OptionID, RealValue); } SOLVAPI const char* SOLVCALL CoinGetStringOption(HPROB hProb, int OptionID) { return ""; } SOLVAPI int SOLVCALL CoinGetStringOptionBuf(HPROB hProb, int OptionID, char* StringValue, int buflen) { return SOLV_CALL_FAILED; } SOLVAPI int SOLVCALL CoinSetStringOption(HPROB hProb, int OptionID, const char* StringValue) { return SOLV_CALL_FAILED; } /************************************************************************/ /* DLL Handling */ /************************************************************************/ #if defined(_MSC_VER) #define WIN32_LEAN_AND_MEAN #include static HINSTANCE g_hInstance; BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: g_hInstance = hInstance; break; case DLL_PROCESS_DETACH: break; } return 1; } #endif CoinMP-1.8.3/CoinMP/src/CoinSolver.c0000644000175000017500000000165411654364276015503 0ustar renerene /* CoinSolver.c */ #include #include #include "CoinSolver.h" PSOLVER coinCreateSolverObject() { PSOLVER pSolver; pSolver = (PSOLVER)malloc(sizeof(SOLVERINFO)); memset(pSolver, 0, sizeof(SOLVERINFO)); strcpy(pSolver->LogFilename, ""); pSolver->MsgLogCB = NULL; pSolver->LPIterCB = NULL; pSolver->MipNodeCB = NULL; pSolver->MsgLogParam = NULL; pSolver->LPIterParam = NULL; pSolver->MipNodeParam = NULL; pSolver->MsgLogCallback = NULL; pSolver->IterCallback = NULL; pSolver->MipNodeCallback = NULL; return pSolver; } void coinClearSolverObject(PSOLVER pSolver) { if (!pSolver) { return; } free(pSolver); } void coinSetLogFilename(PSOLVER pSolver, const char* LogFilename) { if (LogFilename) { strcpy(pSolver->LogFilename, LogFilename); } } const char* coinGetLogFilename(PSOLVER pSolver) { return pSolver->LogFilename; } CoinMP-1.8.3/CoinMP/src/CoinCbc.h0000644000175000017500000001037012246056244014707 0ustar renerene /* CoinCbc.cpp */ #ifndef _COINCBC_H_ #define _COINCBC_H_ #include #include #include #include #include #include #include "ClpSimplex.hpp" #include "CbcModel.hpp" #include "CglProbing.hpp" #include "CglGomory.hpp" #include "CglKnapsackCover.hpp" #include "CglOddHole.hpp" #include "CglClique.hpp" #include "CglLiftAndProject.hpp" #include "CglSimpleRounding.hpp" #if defined(_MSC_VER) && !defined(HAVE_CONFIG_H) #define SOLVCALL __stdcall #else #define SOLVCALL #endif #ifdef __cplusplus extern "C" { #endif #define CBC_CALL_SUCCESS 0 #define CBC_CALL_FAILED -1 int CbcOptimizeProblem(PPROBLEM pProblem, PRESULT pResult, PSOLVER pSolver, POPTION pOption, int Method); int CbcReadMpsFile(PPROBLEM pProblem, const char *ReadFilename); int CbcWriteMpsFile(PPROBLEM pProblem, const char *WriteFilename); int CbcGetOptionCount(void); int CbcGetOptionID(int OptionNr); SOLVOPTINFO *CbcGetOptionTable(void); //int CbcLocateOptionID(int OptionID); SOLVOPTINFO *CbcGetOptionEntry(int OptionID); int CbcGetOptionChanged(int OptionID); int CbcGetIntOption(int OptionID); int CbcSetIntOption(int OptionID, int IntValue); double CbcGetRealOption(int OptionID); int CbcSetRealOption(int OptionID, double RealValue); #ifdef __cplusplus } #endif #define COIN_INT_SOLVEMETHOD 1 #define COIN_INT_PRESOLVETYPE 2 #define COIN_INT_SCALING 3 #define COIN_INT_PERTURBATION 4 #define COIN_INT_PRIMALPIVOTALG 5 #define COIN_INT_DUALPIVOTALG 6 #define COIN_INT_LOGLEVEL 7 #define COIN_INT_MAXITER 8 #define COIN_INT_CRASHIND 9 #define COIN_INT_CRASHPIVOT 10 #define COIN_REAL_CRASHGAP 11 #define COIN_REAL_PRIMALOBJLIM 12 #define COIN_REAL_DUALOBJLIM 13 #define COIN_REAL_PRIMALOBJTOL 14 #define COIN_REAL_DUALOBJTOL 15 #define COIN_REAL_MAXSECONDS 16 #define COIN_INT_MIPMAXNODES 17 #define COIN_INT_MIPMAXSOL 18 #define COIN_REAL_MIPMAXSEC 19 #define COIN_INT_MIPFATHOMDISC 20 #define COIN_INT_MIPHOTSTART 21 //#define COIN_INT_MIPFORCEPRIOR 21 #define COIN_INT_MIPMINIMUMDROP 22 #define COIN_INT_MIPMAXCUTPASS 23 #define COIN_INT_MIPMAXPASSROOT 24 #define COIN_INT_MIPSTRONGBRANCH 25 #define COIN_INT_MIPSCANGLOBCUTS 26 #define COIN_REAL_MIPINTTOL 30 #define COIN_REAL_MIPINFWEIGHT 31 #define COIN_REAL_MIPCUTOFF 32 #define COIN_REAL_MIPABSGAP 33 #define COIN_REAL_MIPFRACGAP 34 #define COIN_INT_MIPCUT_PROBING 110 #define COIN_INT_MIPPROBE_FREQ 111 #define COIN_INT_MIPPROBE_MODE 112 #define COIN_INT_MIPPROBE_USEOBJ 113 #define COIN_INT_MIPPROBE_MAXPASS 114 #define COIN_INT_MIPPROBE_MAXPROBE 115 #define COIN_INT_MIPPROBE_MAXLOOK 116 #define COIN_INT_MIPPROBE_ROWCUTS 117 #define COIN_INT_MIPCUT_GOMORY 120 #define COIN_INT_MIPGOMORY_FREQ 121 #define COIN_INT_MIPGOMORY_LIMIT 122 #define COIN_REAL_MIPGOMORY_AWAY 123 #define COIN_INT_MIPCUT_KNAPSACK 130 #define COIN_INT_MIPKNAPSACK_FREQ 131 #define COIN_INT_MIPKNAPSACK_MAXIN 132 #define COIN_INT_MIPCUT_ODDHOLE 140 #define COIN_INT_MIPODDHOLE_FREQ 141 #define COIN_REAL_MIPODDHOLE_MINVIOL 142 #define COIN_REAL_MIPODDHOLE_MINVIOLPER 143 #define COIN_INT_MIPODDHOLE_MAXENTRIES 144 #define COIN_INT_MIPCUT_CLIQUE 150 #define COIN_INT_MIPCLIQUE_FREQ 151 #define COIN_INT_MIPCLIQUE_PACKING 152 #define COIN_INT_MIPCLIQUE_STAR 153 #define COIN_INT_MIPCLIQUE_STARMETHOD 154 #define COIN_INT_MIPCLIQUE_STARMAXLEN 155 #define COIN_INT_MIPCLIQUE_STARREPORT 156 #define COIN_INT_MIPCLIQUE_ROW 157 #define COIN_INT_MIPCLIQUE_ROWMAXLEN 158 #define COIN_INT_MIPCLIQUE_ROWREPORT 159 #define COIN_REAL_MIPCLIQUE_MINVIOL 160 #define COIN_INT_MIPCUT_LIFTPROJECT 170 #define COIN_INT_MIPLIFTPRO_FREQ 171 #define COIN_INT_MIPLIFTPRO_BETAONE 172 #define COIN_INT_MIPCUT_SIMPROUND 180 #define COIN_INT_MIPSIMPROUND_FREQ 181 #define COIN_INT_MIPUSECBCMAIN 200 #endif /* _COINCBC_H_ */ CoinMP-1.8.3/CoinMP/src/CoinProblem.c0000644000175000017500000004022311654406741015616 0ustar renerene /* CoinProblem.c */ #include #include #include /* DBL_MAX */ #include "CoinProblem.h" PPROBLEM coinCreateProblemObject() { PPROBLEM pProblem; pProblem = (PPROBLEM)malloc(sizeof(PROBLEMINFO)); memset(pProblem, 0, sizeof(PROBLEMINFO)); pProblem->ColCount = 0; pProblem->RowCount = 0; pProblem->NZCount = 0; pProblem->RangeCount = 0; pProblem->ObjectSense = 0; pProblem->ObjectConst = 0.0; pProblem->lenColNamesBuf = 0; pProblem->lenRowNamesBuf = 0; pProblem->lenObjNameBuf = 0; pProblem->ObjectCoeffs = NULL; pProblem->RHSValues = NULL; pProblem->RangeValues = NULL; pProblem->RowType = NULL; pProblem->MatrixBegin = NULL; pProblem->MatrixCount = NULL; pProblem->MatrixIndex = NULL; pProblem->MatrixValues = NULL; pProblem->LowerBounds = NULL; pProblem->UpperBounds = NULL; pProblem->ColNamesBuf = NULL; pProblem->RowNamesBuf = NULL; pProblem->ColNamesList = NULL; pProblem->RowNamesList = NULL; pProblem->ObjectName = NULL; pProblem->InitValues = NULL; pProblem->RowLower = NULL; pProblem->RowUpper = NULL; pProblem->ColType = NULL; pProblem->SolveAsMIP = 0; pProblem->IntCount = 0; pProblem->BinCount = 0; pProblem->numInts = 0; pProblem->IsInt = NULL; pProblem->PriorCount = 0; pProblem->PriorIndex = NULL; pProblem->PriorValues = NULL; pProblem->PriorBranch = NULL; pProblem->SosCount = 0; pProblem->SosNZCount = 0; pProblem->SosType = NULL; pProblem->SosPrior = NULL; pProblem->SosBegin = NULL; pProblem->SosIndex = NULL; pProblem->SosRef = NULL; pProblem->SemiCount = 0; pProblem->SemiIndex = NULL; pProblem->SemiIndex = NULL; return pProblem; } void coinClearProblemObject(PPROBLEM pProblem) { if (!pProblem) { return; } if (pProblem->ObjectCoeffs) free(pProblem->ObjectCoeffs); if (pProblem->RHSValues) free(pProblem->RHSValues); if (pProblem->RangeValues) free(pProblem->RangeValues); if (pProblem->RowType) free(pProblem->RowType); if (pProblem->MatrixBegin) free(pProblem->MatrixBegin); if (pProblem->MatrixCount) free(pProblem->MatrixCount); if (pProblem->MatrixIndex) free(pProblem->MatrixIndex); if (pProblem->MatrixValues) free(pProblem->MatrixValues); if (pProblem->LowerBounds) free(pProblem->LowerBounds); if (pProblem->UpperBounds) free(pProblem->UpperBounds); if (pProblem->ColNamesBuf) free(pProblem->ColNamesBuf); if (pProblem->RowNamesBuf) free(pProblem->RowNamesBuf); if (pProblem->ColNamesList) free(pProblem->ColNamesList); if (pProblem->RowNamesList) free(pProblem->RowNamesList); if (pProblem->ObjectName) free(pProblem->ObjectName); if (pProblem->InitValues) free(pProblem->InitValues); if (pProblem->RowLower) free(pProblem->RowLower); if (pProblem->RowUpper) free(pProblem->RowUpper); if (pProblem->ColType) free(pProblem->ColType); if (pProblem->PriorIndex) free(pProblem->PriorIndex); if (pProblem->PriorValues) free(pProblem->PriorValues); if (pProblem->PriorBranch) free(pProblem->PriorBranch); if (pProblem->SemiIndex) free(pProblem->SemiIndex); if (pProblem->SosType) free(pProblem->SosType); if (pProblem->SosPrior) free(pProblem->SosPrior); if (pProblem->SosBegin) free(pProblem->SosBegin); if (pProblem->SosIndex) free(pProblem->SosIndex); if (pProblem->SosRef) free(pProblem->SosRef); free(pProblem); } void coinSetProblemName(PPROBLEM pProblem, const char *ProblemName) { size_t len; len = strlen(ProblemName); if (len >= sizeof(pProblem->ProblemName)) { len = sizeof(pProblem->ProblemName) - 1; } strncpy(pProblem->ProblemName, ProblemName, len); pProblem->ProblemName[len] = '\0'; } int coinStoreMatrix(PPROBLEM pProblem, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues) { if (ColCount == 0) { return 0; } pProblem->ColCount = ColCount; pProblem->RowCount = RowCount; pProblem->NZCount = NZCount; pProblem->RangeCount = RangeCount; pProblem->ObjectSense = ObjectSense; pProblem->ObjectConst = ObjectConst; if (ObjectCoeffs) pProblem->ObjectCoeffs = (double*) malloc(pProblem->ColCount * sizeof(double)); if (LowerBounds) pProblem->LowerBounds = (double*) malloc(pProblem->ColCount * sizeof(double)); if (UpperBounds) pProblem->UpperBounds = (double*) malloc(pProblem->ColCount * sizeof(double)); if (RowType) pProblem->RowType = (char*) malloc(pProblem->RowCount * sizeof(char)); if (RHSValues) pProblem->RHSValues = (double*) malloc(pProblem->RowCount * sizeof(double)); if (RangeValues) pProblem->RangeValues = (double*) malloc(pProblem->RowCount * sizeof(double)); if (MatrixBegin) pProblem->MatrixBegin = (int*) malloc((pProblem->ColCount+1) * sizeof(int)); if (MatrixCount) pProblem->MatrixCount = (int*) malloc(pProblem->ColCount * sizeof(int)); if (MatrixIndex) pProblem->MatrixIndex = (int*) malloc(pProblem->NZCount * sizeof(int)); if (MatrixValues) pProblem->MatrixValues = (double*) malloc(pProblem->NZCount * sizeof(double)); if ((ObjectCoeffs && !pProblem->ObjectCoeffs) || (LowerBounds && !pProblem->LowerBounds) || (UpperBounds && !pProblem->UpperBounds) || (RowType && !pProblem->RowType) || (RHSValues && !pProblem->RHSValues) || (RangeValues && !pProblem->RangeValues) || (MatrixBegin && !pProblem->MatrixBegin) || (MatrixCount && !pProblem->MatrixCount) || (MatrixIndex && !pProblem->MatrixIndex) || (MatrixValues && !pProblem->MatrixValues)) { return 0; } if (ObjectCoeffs) memcpy(pProblem->ObjectCoeffs, ObjectCoeffs, pProblem->ColCount * sizeof(double)); if (LowerBounds) memcpy(pProblem->LowerBounds, LowerBounds, pProblem->ColCount * sizeof(double)); if (UpperBounds) memcpy(pProblem->UpperBounds, UpperBounds, pProblem->ColCount * sizeof(double)); if (RowType) memcpy(pProblem->RowType, RowType, pProblem->RowCount * sizeof(char)); if (RHSValues) memcpy(pProblem->RHSValues, RHSValues, pProblem->RowCount * sizeof(double)); if (RangeValues) memcpy(pProblem->RangeValues, RangeValues, pProblem->RowCount * sizeof(double)); if (MatrixBegin) memcpy(pProblem->MatrixBegin, MatrixBegin, (pProblem->ColCount+1) * sizeof(int)); if (MatrixCount) memcpy(pProblem->MatrixCount, MatrixCount, pProblem->ColCount * sizeof(int)); if (MatrixIndex) memcpy(pProblem->MatrixIndex, MatrixIndex, pProblem->NZCount * sizeof(int)); if (MatrixValues) memcpy(pProblem->MatrixValues, MatrixValues, pProblem->NZCount * sizeof(double)); if (!coinComputeRowLowerUpper(pProblem, DBL_MAX)) { return 0; } return 1; } int coinStoreNamesList(PPROBLEM pProblem, char** ColNamesList, char** RowNamesList, const char* ObjectName) { if (ObjectName) { pProblem->lenObjNameBuf = (int)strlen(ObjectName) + 1; pProblem->ObjectName = (char*) malloc(pProblem->lenObjNameBuf * sizeof(char)); if (!pProblem->ObjectName) { return 0; } memcpy(pProblem->ObjectName, ObjectName, pProblem->lenObjNameBuf * sizeof(char)); } if (ColNamesList) { pProblem->lenColNamesBuf = coinGetLenNameListBuf(ColNamesList, pProblem->ColCount); pProblem->ColNamesList = (char**) malloc(pProblem->ColCount * sizeof(char* )); pProblem->ColNamesBuf = (char*) malloc(pProblem->lenColNamesBuf * sizeof(char)); if (!pProblem->ColNamesList && !pProblem->ColNamesBuf) { return 0; } coinCopyNamesList(pProblem->ColNamesList, pProblem->ColNamesBuf, ColNamesList, pProblem->ColCount); } if (RowNamesList) { pProblem->lenRowNamesBuf = coinGetLenNameListBuf(RowNamesList, pProblem->RowCount); pProblem->RowNamesList = (char**) malloc(pProblem->RowCount * sizeof(char* )); pProblem->RowNamesBuf = (char*) malloc(pProblem->lenRowNamesBuf * sizeof(char)); if (!pProblem->RowNamesList && !pProblem->RowNamesBuf) { return 0; } coinCopyNamesList(pProblem->RowNamesList, pProblem->RowNamesBuf, RowNamesList, pProblem->RowCount); } return 1; } int coinStoreNamesBuf(PPROBLEM pProblem, const char* ColNamesBuf, const char* RowNamesBuf, const char* ObjectName) { char** ColNamesList; char** RowNamesList; int result; ColNamesList = (char**)malloc(pProblem->ColCount * sizeof(char*)); RowNamesList = (char**)malloc(pProblem->RowCount * sizeof(char*)); if (!ColNamesList && !RowNamesList) { return 0; } coinSetupNamesList(ColNamesList, ColNamesBuf, pProblem->ColCount); coinSetupNamesList(RowNamesList, RowNamesBuf, pProblem->RowCount); result = coinStoreNamesList(pProblem, ColNamesList, RowNamesList, ObjectName); if (ColNamesList) free(ColNamesList); if (RowNamesList) free(RowNamesList); return result; } int coinStoreInitValues(PPROBLEM pProblem, double* InitValues) { if (!InitValues) { return 0; } pProblem->InitValues = (double* ) malloc(pProblem->ColCount * sizeof(double)); if (!pProblem->InitValues) { return 0; } memcpy(pProblem->InitValues, InitValues, pProblem->ColCount * sizeof(double)); return 1; } int coinStoreInteger(PPROBLEM pProblem, const char* ColType) { int numInts; if (pProblem->ColCount == 0) { return 0; } if (!ColType) { return 0; } pProblem->ColType = (char* )malloc(pProblem->ColCount * sizeof(char)); if (!pProblem->ColType) { return 0; } memcpy(pProblem->ColType, ColType, pProblem->ColCount * sizeof(char)); numInts = coinComputeIntVariables(pProblem); pProblem->SolveAsMIP = (numInts > 0); return 1; } int coinStorePriority(PPROBLEM pProblem, int PriorCount, int* PriorIndex, int* PriorValues, int* PriorBranch) { if (PriorCount == 0) { return 0; } pProblem->PriorCount = PriorCount; if (PriorIndex) pProblem->PriorIndex = (int* )malloc(PriorCount * sizeof(int)); if (PriorValues) pProblem->PriorValues = (int* )malloc(PriorCount * sizeof(int)); if (PriorBranch) pProblem->PriorBranch = (int* )malloc(PriorCount * sizeof(int)); if ((PriorIndex && !pProblem->PriorIndex) || (PriorValues && !pProblem->PriorValues) || (PriorBranch && !pProblem->PriorBranch)) { return 0; } if (PriorIndex) memcpy(pProblem->PriorIndex, PriorIndex, PriorCount * sizeof(int)); if (PriorValues) memcpy(pProblem->PriorValues, PriorValues, PriorCount * sizeof(int)); if (PriorBranch) memcpy(pProblem->PriorBranch, PriorBranch, PriorCount * sizeof(int)); return 0; } int coinStoreSos(PPROBLEM pProblem, int SosCount, int SosNZCount, int* SosType, int* SosPrior, int* SosBegin, int* SosIndex, double* SosRef) { if ((SosCount == 0) || (SosNZCount == 0)) { return 0; } pProblem->SosCount = SosCount; pProblem->SosNZCount = SosNZCount; if (SosType) pProblem->SosType = (int* )malloc(SosCount * sizeof(int)); if (SosPrior) pProblem->SosPrior = (int* )malloc(SosCount * sizeof(int)); if (SosBegin) pProblem->SosBegin = (int* )malloc((SosCount+1) * sizeof(int)); if (SosIndex) pProblem->SosIndex = (int* )malloc(SosNZCount * sizeof(int)); if (SosRef) pProblem->SosRef = (double* )malloc(SosNZCount* sizeof(double)); if ((SosType && !pProblem->SosType) || (SosPrior && !pProblem->SosPrior) || (SosBegin && !pProblem->SosBegin) || (SosIndex && !pProblem->SosIndex) || (SosRef && !pProblem->SosRef)) { return 0; } if (SosType) memcpy(pProblem->SosType, SosType, SosCount * sizeof(int)); if (SosPrior) memcpy(pProblem->SosPrior, SosPrior, SosCount * sizeof(int)); if (SosBegin) memcpy(pProblem->SosBegin, SosBegin, (SosCount+1) * sizeof(int)); if (SosIndex) memcpy(pProblem->SosIndex, SosIndex, SosNZCount * sizeof(int)); if (SosRef) memcpy(pProblem->SosRef, SosRef, SosNZCount * sizeof(double)); pProblem->SolveAsMIP = 1; return 1; } int coinStoreSemiCont(PPROBLEM pProblem, int SemiCount, int* SemiIndex) { if (SemiCount == 0) { return 0; } if (!SemiIndex) { return 0; } pProblem->SemiCount = SemiCount; pProblem->SemiIndex = (int* )malloc(pProblem->SemiCount * sizeof(int)); if (!pProblem->SemiIndex) { return 0; } memcpy(pProblem->SemiIndex, SemiIndex, pProblem->SemiCount * sizeof(int)); pProblem->SolveAsMIP = 1; return 1; } int coinComputeRowLowerUpper(PPROBLEM pProblem, double CoinDblMax) { int i; double RangeABS, RangeValue; if (pProblem->RowCount == 0) { return 0; } pProblem->RowLower = (double* )malloc(pProblem->RowCount*sizeof(double)); pProblem->RowUpper = (double* )malloc(pProblem->RowCount*sizeof(double)); if (!pProblem->RowLower || !pProblem->RowUpper) { return 0; } if (!pProblem->RowType) { /* if NO RowType, we treat RHSValues as RowLower and RangeValues as RowUpper */ for (i = 0; i < pProblem->RowCount; i++) { pProblem->RowLower[i] = pProblem->RHSValues ? pProblem->RHSValues[i] : -CoinDblMax; pProblem->RowUpper[i] = pProblem->RangeValues ? pProblem->RangeValues[i] : CoinDblMax; } return 1; } for (i = 0; i < pProblem->RowCount; i++ ){ switch (pProblem->RowType[i]) { case 'L': pProblem->RowLower[i] = -CoinDblMax; pProblem->RowUpper[i] = pProblem->RHSValues ? pProblem->RHSValues[i] : CoinDblMax; break; case 'G': pProblem->RowLower[i] = pProblem->RHSValues ? pProblem->RHSValues[i] : -CoinDblMax; pProblem->RowUpper[i] = CoinDblMax; break; case 'E': pProblem->RowLower[i] = pProblem->RHSValues ? pProblem->RHSValues[i] : 0.0; pProblem->RowUpper[i] = pProblem->RHSValues ? pProblem->RHSValues[i] : 0.0; break; case 'R': RangeValue = pProblem->RangeValues ? pProblem->RangeValues[i] : 0.0; RangeABS = (RangeValue >= 0.0) ? RangeValue : -RangeValue; pProblem->RowLower[i] = (pProblem->RHSValues ? pProblem->RHSValues[i] : -CoinDblMax) - RangeABS; pProblem->RowUpper[i] = pProblem->RHSValues ? pProblem->RHSValues[i] : CoinDblMax; break; case 'N': pProblem->RowLower[i] = -CoinDblMax; pProblem->RowUpper[i] = CoinDblMax; break; default: return 0; } } return 1; } int coinComputeIntVariables(PPROBLEM pProblem) { int i; if (pProblem->ColCount == 0) { return 0; } pProblem->IsInt = (char* )malloc(pProblem->ColCount * sizeof(char)); if (!pProblem->IsInt) { return 0; } for (i = 0; i < pProblem->ColCount; i++ ) { switch (pProblem->ColType[i]) { case 'B': pProblem->BinCount++; pProblem->IsInt[i] = 1; break; case 'I': pProblem->IntCount++; pProblem->IsInt[i] = 1; break; default: pProblem->IsInt[i] = 0; break; } } pProblem->numInts = pProblem->IntCount + pProblem->BinCount; return pProblem->numInts; } int coinGetLenNameBuf(const char* NameBuf, int Count) { int i, len; int lenBuf; const char* pName; lenBuf = 0; pName = &NameBuf[0]; for (i = 0; i < Count; i++) { len = (int)strlen(pName) + 1; lenBuf += len; pName = pName + len; } return lenBuf; } int coinGetLenNameListBuf(char** NameList, int Count) { int i, len; int lenBuf; lenBuf = 0; for (i = 0; i < Count; i++) { len = (int)strlen(NameList[i]) + 1; lenBuf += len; } return lenBuf; } int coinCopyNamesList(char** NamesList, char* NamesBuf, char** argNamesList, int Count) { int i,k,len; if (!NamesList || !argNamesList || !NamesBuf || (Count == 0)) { return 0; } k = 0; for (i = 0; i < Count; i++) { NamesList[i] = &NamesBuf[k]; strcpy(NamesList[i], argNamesList[i]); len = (int)strlen(NamesList[i]) + 1; k += len; } return 1; } int coinSetupNamesList(char** NamesList, const char* NamesBuf, int Count) { int i,k,len; if (!NamesList || !NamesBuf || (Count == 0)) { return 0; } k = 0; for (i = 0; i < Count; i++) { NamesList[i] = (char*)&NamesBuf[k]; /* (char*) cast removes warning, NamesList will not be changed */ len = (int)strlen(NamesList[i]) + 1; k += len; } return 1; } CoinMP-1.8.3/CoinMP/src/CoinMPConfig.h0000644000175000017500000000246311617524426015671 0ustar renerene/* * Include file for the configuration of CoinMP. * * On systems where the code is configured with the configure script * (i.e., compilation is always done with HAVE_CONFIG_H defined), this * header file includes the automatically generated header file, and * undefines macros that might configure with other Config.h files. * * On systems where the code is configured with the configure script * (i.e., compilation is always done with HAVE_CONFIG_H defined), this * header file includes the automatically generated header file, and * undefines macros that might configure with other Config.h files. * * On systems that are compiled in other ways (e.g., with the * Developer Studio), a header files is included to define those * macros that depend on the operating system and the compiler. The * macros that define the configuration of the particular user setting * (e.g., presence of other COIN-OR packages or third party code) are set * by the files config_*default.h. The project maintainer needs to remember * to update these file and choose reasonable defines. * A user can modify the default setting by editing the config_*default.h files. * */ #ifndef __COINMPCONFIG_H__ #ifdef HAVE_CONFIG_H #include "config_coinmp.h" #else #include "config_coinmp_default.h" #endif #endif /*__COINMPCONFIG_H__*/ CoinMP-1.8.3/CoinMP/src/CoinResult.h0000644000175000017500000000136511504277235015503 0ustar renerene /* CoinResult.h */ #ifndef _COINRESULT_H_ #define _COINRESULT_H_ typedef struct { int SolutionStatus; char SolutionText[200]; double ObjectValue; double MipBestBound; int IterCount; int MipNodeCount; double* ColActivity; double* ReducedCost; double* RowActivity; double* SlackValues; double* ShadowPrice; double* ObjLoRange; double* ObjUpRange; double* RhsLoRange; double* RhsUpRange; int* ColStatus; int* RowStatus; } RESULTINFO, *PRESULT; #ifdef __cplusplus extern "C" { #endif PRESULT coinCreateResultObject(void); void coinClearResultObject(PRESULT pResult); #ifdef __cplusplus } #endif #endif /* _COINRESULT_H_ */ CoinMP-1.8.3/CoinMP/src/config_coinmp.h.in0000644000175000017500000000043711617263737016641 0ustar renerene/* src/config_cbc.h.in. */ /* Version number of project */ #undef COINMP_VERSION /* Major Version number of project */ #undef COINMP_VERSION_MAJOR /* Minor Version number of project */ #undef COINMP_VERSION_MINOR /* Release Version number of project */ #undef COINMP_VERSION_RELEASE CoinMP-1.8.3/CoinMP/src/CoinProblem.h0000644000175000017500000000561311654404343015623 0ustar renerene /* CoinProblem.h */ #ifndef _COINPROBLEM_H_ #define _COINPROBLEM_H_ typedef struct { char ProblemName[200]; int ColCount; int RowCount; int NZCount; int RangeCount; int ObjectSense; double ObjectConst; int lenColNamesBuf; int lenRowNamesBuf; int lenObjNameBuf; double* ObjectCoeffs; double* RHSValues; double* RangeValues; char* RowType; int* MatrixBegin; int* MatrixCount; int* MatrixIndex; double* MatrixValues; double* LowerBounds; double* UpperBounds; char* ColNamesBuf; char* RowNamesBuf; char** ColNamesList; char** RowNamesList; char* ObjectName; double* InitValues; double* RowLower; double* RowUpper; char* ColType; int SolveAsMIP; int IntCount; int BinCount; int numInts; char *IsInt; int PriorCount; int* PriorIndex; int* PriorValues; int* PriorBranch; int SosCount; int SosNZCount; int* SosType; int* SosPrior; int* SosBegin; int* SosIndex; double* SosRef; int SemiCount; int* SemiIndex; } PROBLEMINFO, *PPROBLEM; #ifdef __cplusplus extern "C" { #endif PPROBLEM coinCreateProblemObject(void); void coinClearProblemObject(PPROBLEM pProblem); void coinSetProblemName(PPROBLEM pProblem, const char *ProblemName); int coinStoreMatrix(PPROBLEM pProblem, int ColCount, int RowCount, int NZCount, int RangeCount, int ObjectSense, double ObjectConst, double* ObjectCoeffs, double* LowerBounds, double* UpperBounds, const char* RowType, double* RHSValues, double* RangeValues, int* MatrixBegin, int* MatrixCount, int* MatrixIndex, double* MatrixValues); int coinStoreNamesList(PPROBLEM pProblem, char** ColNamesList, char** RowNamesList, const char* OjbectName); int coinStoreNamesBuf(PPROBLEM pProblem, const char* ColNamesBuf, const char* RowNamesBuf, const char* ObjectName); int coinStoreInitValues(PPROBLEM pProblem, double* InitValues); int coinStoreInteger(PPROBLEM pProblem, const char* ColType); int coinStorePriority(PPROBLEM pProblem, int PriorCount, int* PriorIndex, int* PriorValues, int* PriorBranch); int coinStoreSos(PPROBLEM pProblem, int SosCount, int SosNZCount, int* SosType, int* SosPrior, int* SosBegin, int* SosIndex, double* SosRef); int coinStoreSemiCont(PPROBLEM pProblem, int SemiCount, int* SemiIndex); int coinComputeRowLowerUpper(PPROBLEM pProblem, double CoinDblMax); int coinComputeIntVariables(PPROBLEM pProblem); int coinGetLenNameBuf(const char* NameBuf, int Count); int coinGetLenNameListBuf(char** NameList, int Count); int coinCopyNamesList(char** NamesList, char* NamesBuf, char** argNamesList, int Count); int coinSetupNamesList(char** NamesList, const char* NamesBuf, int Count); #ifdef __cplusplus } #endif #endif /* _COINPROBLEM_H_ */ CoinMP-1.8.3/CoinMP/AUTHORS0000644000175000017500000000002511043701366013507 0ustar renereneBjarni Kristjansson CoinMP-1.8.3/missing0000755000175000017500000002540610461157122012721 0ustar renerene#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Data/0000755000175000017500000000000012600453457012173 5ustar renereneCoinMP-1.8.3/Data/Sample/0000755000175000017500000000000012600453457013414 5ustar renereneCoinMP-1.8.3/Data/Sample/exmip1.mps0000644000175000017500000001304610430174061015332 0ustar renerene************************************************************************ * * The data in this file represents the following problem: * * Minimize or maximize Z = x1 + 2x5 - x8 * * Subject to: * * 2.5 <= 3x1 + x2 - 2x4 - x5 - x8 * 2x2 + 1.1x3 <= 2.1 * x3 + x6 = 4.0 * 1.8 <= 2.8x4 -1.2x7 <= 5.0 * 3.0 <= 5.6x1 + x5 + 1.9x8 <= 15.0 * * where: * * 2.5 <= x1 * 0 <= x2 <= 4.1 * 0 <= x3 * 0 <= x4 * 0.5 <= x5 <= 4.0 * 0 <= x6 * 0 <= x7 * 0 <= x8 <= 4.3 * * x3, x4 are 0,1 variables. * ************************************************************************ NAME EXAMPLE ROWS N OBJ G ROW01 L ROW02 E ROW03 G ROW04 L ROW05 COLUMNS COL01 OBJ 1.0 COL01 ROW01 3.0 ROW05 5.6 COL02 ROW01 1.0 ROW02 2.0 * * Mark COL03 and COL04 as integer variables. * INT1 'MARKER' 'INTORG' COL03 ROW02 1.1 ROW03 1.0 COL04 ROW01 -2.0 ROW04 2.8 INT1END 'MARKER' 'INTEND' * COL05 OBJ 2.0 COL05 ROW01 -1.0 ROW05 1.0 COL06 ROW03 1.0 COL07 ROW04 -1.2 COL08 OBJ -1.0 COL08 ROW01 -1.0 ROW05 1.9 RHS RHS1 ROW01 2.5 RHS1 ROW02 2.1 RHS1 ROW03 4.0 RHS1 ROW04 1.8 RHS1 ROW05 15.0 RANGES RNG1 ROW04 3.2 RNG1 ROW05 12.0 BOUNDS LO BND1 COL01 2.5 UP BND1 COL02 4.1 LO BND1 COL05 0.5 UP BND1 COL05 4.0 UP BND1 COL08 4.3 ENDATA CoinMP-1.8.3/Data/Sample/e226.mps0000644000175000017500000026741310662211140014613 0ustar renereneNAME E226 ROWS N ...000 L ...010 E ...011 L ...012 E ...013 E ...014 E ...015 E ...016 L ...017 L ...018 L ...019 L ...020 L ...021 L ...022 L ...023 L ...024 L ...025 E ...026 L ...027 E ...028 L ...029 L ...030 L ...031 E ...032 L ...033 L ...034 L ...035 L ...036 L ...037 L ...038 L ...039 L ...040 L ...041 L ...042 L ...043 L ...044 L ...045 E ...046 L ...047 L ...048 L ...049 L ...050 L ...051 L ...052 L ...053 L ...054 L ...055 L ...056 L ...057 L ...058 L ...059 L ...060 L ...120 L ...133 L ...134 L ...135 L ...136 L ...137 L ...138 L ...139 L ...140 L ...141 L ...142 L ...143 L ...144 L ...145 L ...146 E ...147 L ...148 L ...149 L ...150 L ...151 L ...152 L ...153 L ...154 L ...155 E ...156 E ...157 L ...158 L ...159 L ...160 L ...161 L ...162 L ...163 E ...164 E ...165 E ...166 L ...167 L ...168 L ...169 L ...170 L ...171 L ...172 L ...173 L ...174 L ...175 E ...176 E ...177 E ...178 L ...179 L ...180 E ...181 L ...182 L ...183 E ...184 L ...185 L ...186 E ...187 E ...188 L ...189 L ...190 G ...191 L ...192 L ...193 L ...194 L ...195 L ...196 L ...197 L ...198 L ...199 L ...200 G ...201 L ...202 G ...203 L ...204 L ...205 L ...206 L ...207 L ...208 L ...209 L ...210 L ...211 L ...212 L ...213 L ...214 L ...215 L ...216 L ...217 L ...218 L ...219 L ...220 L ...221 L ...222 L ...223 L ...224 L ...225 L ...226 L ...227 L ...228 L ...229 L ...230 L ...231 L ...232 L ...233 L ...234 L ...235 L ...236 L ...237 L ...238 L ...239 L ...240 L ...241 L ...242 L ...243 L ...244 L ...245 L ...246 L ...247 L ...248 L ...249 L ...250 E ...251 L ...252 L ...253 L ...254 L ...255 L ...256 L ...257 L ...258 L ...259 L ...260 L ...261 E ...262 L ...263 E ...264 L ...265 L ...267 L ...266 L ...268 E ...269 L ...270 L ...271 L ...272 L ...273 L ...274 L ...275 E ...276 E ...277 E ...278 E ...279 L ...280 L ...281 L ...282 L ...283 L ...284 L ...285 L ...286 L ...287 L ...288 E ...289 L ...290 L ...291 G ...292 L ...293 E ...294 L ...295 L ...296 G ...297 L ...298 E ...299 L ...300 L ...301 L ...302 L ...303 COLUMNS .ETHSD ...269 1. ...270 1. .ETHSD ...000 -10.1974 .BUDSD ...271 1. ...293 1. .BUDSD ...000 -29.1163 .HEPTS ...267 1. ...268 1. .HEPTS ...000 -12.8462 .M28IS ...032 1. ...055 1. .TF0SD ...300 1. ...301 .63 .TF0SD ...302 .37 ...000 -4.7113 .RKDIS ...028 1. ...055 1. .ADHD1 ...056 2.857 ...133 .984 .ADHD1 ...140 1. ...000 -3.9824 .PREHT ...289 1. ...290 1. .C4LPG ...169 1. ...173 1. .C4LPG ...174 1. ...000 -2.7214 .M28SL ...033 1. ...049 1. .M28SL ...045 -.4286 ...000 -6.5884 .HEPP0 ...267 1. ...274 -1. .RKSLD ...029 1. ...031 1. .RKSLD ...045 -.2195 ...000 -4.158 .UN010 ...010 -1. .XCAPY ...182 1. .REDBA ...294 .1 ...013 -.04 .TFVIS ...051 .362 ...052 1. .TFVIS ...053 .362 ...054 .829 .TFVIS ...056 2.127 ...000 -4.3557 .T0TMX ...168 1. ...170 -.25 .T0TMX ...171 .12 ...173 1. .T0TMX ...174 1. ...000 -3.103 .EGV0L ...000 -5.9898 ...211 1. .EGV0L ...212 1. .VNNF2 ...193 -.272 ...192 -.272 .VNNF2 ...194 -.272 ...195 -.272 .C5FDP ...181 1. ...183 -1. .C5FDP ...184 -.1614 ...185 1.1614 .C5FDP ...186 1.1614 .TFNS1 ...050 1. ...051 -1. .TFNS1 ...000 .0087 .CFMSU ...261 -2.9155 ...278 1. .VN4PH ...179 1. ...198 -1. .CFMSG ...279 1. ...285 .6526 .ERV0L ...233 1. ...234 1. .ERV0L ...000 -4.4497 .PKDIS ...026 1. ...055 1. .EEV0L ...000 -5.348 ...222 1. .EEV0L ...223 1. .CS1TP ...189 -1. ...191 1. .CS1TP ...190 1. ...000 .0078 .JP5DS ...046 1. ...047 -.5 .JP5DS ...048 1. ...050 1. .JP5DS ...000 -4.0337 .DMD0S ...144 1. ...145 1. .DMD0S ...000 -3.8202 .PKSLD ...027 1.25 ...030 1. .PKSLD ...045 -.25 ...000 -4.3425 .VNSW2 ...051 1. ...189 -1. .VNSW2 ...000 .015 .TGAS1 ...134 1. ...135 1. .TGAS1 ...137 -1.667 .TGAS2 ...137 -1.367 ...134 1. .TGAS2 ...136 1. .LD1EG ...219 5.2638 ...244 7.593 .LD1EG ...000 -1. .LD2EG ...219 15.7829 ...245 18.5185 .LD2EG ...000 -1. .JP1TF ...034 1. ...050 1. .JP1TF ...301 -1. .JP1DS ...034 1. ...035 1. .JP1DS ...036 -.2 ...050 1. .JP1DS ...000 -4.5066 .JP4DS ...038 1. ...041 1. .JP4DS ...050 1. ...000 -2.7704 .VN4DB ...051 1. ...179 1. .VN4DB ...204 2. ...281 1. .VN4DB ...000 -4.3739 .T5JP5 ...037 1. ...046 -1. .T5JP5 ...047 1. ...050 -1. .T5JP5 ...000 -.0087 .J4210 ...041 1. ...042 1.062 .J4210 ...044 .0638 ...050 1. .J4210 ...000 -3.0626 .T5JP1 ...034 -1. ...036 1. .T5JP1 ...037 1. ...050 -1. .T5JP1 ...000 -.0087 .TFCAT ...054 -11.055 ...156 24.476 .TFCAT ...157 1. ...281 -2.5386 .TFCAT ...282 10.0375 .VNSW1 ...050 1. ...189 -1. .VNSW1 ...000 .0087 .ETHRF ...264 -.42 ...269 1. .ETHRF ...000 1.35 .LD1ER ...241 75.9202 ...248 19.7239 .LD1ER ...000 -1. .LD2ER ...000 -1. ...241 151.8405 .LD2ER ...249 12.3305 .LD1EE ...000 -1. ...230 14.5377 .LD1EE ...246 14.1044 .LD2EE ...000 -1. ...230 25.3995 .LD2EE ...247 12.3305 .PC4TF ...264 -.66 ...265 .66 .PC4TF ...273 1. .C5TRF ...183 1. ...264 -.7 .C5TRF ...265 .7 .CCSRF ...156 17.372 ...157 1. .CCSRF ...264 -.9 ...266 1. .CCSRF ...000 -.2 .DGHDS ...137 8.33 ...138 1. .DGHDS ...139 1.483 ...262 -9.648 .DGHDS ...264 -.014 ...265 .014 .DGHDS ...000 -5.9218 .ADHDS ...133 .982 ...137 10. .ADHDS ...140 1. ...262 -9.648 .ADHDS ...000 -3.9942 ...264 -.0126 .ADHDS ...265 .0126 .VN4RF ...179 1. ...264 -.78 .VN4RF ...265 .78 .GWG0S ...142 1. ...143 1. .GWG0S ...000 -4.0195 .DGFDG ...139 -1. ...141 1. .DGFDG ...142 1. .ADFHD ...140 -1. ...142 .7763 .ADFHD ...156 4.401 ...157 .2237 .C4VIS ...173 -1. ...200 1. .CATFI ...147 -1. ...276 -6. .CATFI ...277 -3.3 ...278 -1.6 .CATFI ...279 -.916 ...000 3.2253 .C3LPG ...167 1. ...172 1. .C3LPG ...174 1. ...202 1. .C3LPG ...000 -2.7904 .PETCF ...147 -1. ...148 1. .PETCF ...276 -18.4 ...277 .462 .PETCF ...278 -4.2 ...279 -.966 .C3MIX ...170 1. ...171 -1. .C3MIX ...172 1. ...173 -1. .C3MIX ...202 1. .CB1H1 ...147 -1. ...158 1. .CB1H1 ...276 -5.4 ...277 -3.96 .CB1H1 ...278 -1.68 ...279 -.927 .CB1H3 ...147 -1. ...159 1. .CB1H3 ...276 -7.1 ...277 9.9 .CB1H3 ...278 -1.97 ...279 -.946 .PS1LF ...147 -1. ...149 1. .PS1LF ...276 -2.5 ...277 -20.46 .PS1LF ...278 -1.6 ...279 -.861 .PS1H1 ...147 -1. ...150 1. .PS1H1 ...276 -2.8 ...277 -14.685 .PS1H1 ...278 -2.6 ...279 -.892 .PS1H2 ...147 -1. ...151 1. .PS1H2 ...276 -3.7 ...277 3.135 .PS1H2 ...278 -2.8 ...279 -.915 .PS1H3 ...147 -1. ...152 1. .PS1H3 ...276 -3.4 ...277 9.735 .PS1H3 ...278 -3.1 ...279 -.942 .PS2LF ...147 -1. ...153 1. .PS2LF ...276 -1.1 ...277 -16.5 .PS2LF ...278 -1.74 ...279 -.862 .PS2HF ...147 -1. ...154 1. .PS2HF ...276 -3.9 ...277 -1.65 .PS2HF ...278 -2.71 ...279 -.894 .GTSGB ...175 1. ...260 1. .GTSGB ...000 -2.9662 .MD0CF ...145 1. ...147 -1. .MD0CF ...276 .3 ...277 -23.1 .MD0CF ...278 -1.25 ...279 -.845 .SPSU1 ...260 .00026 ...261 1. .SPSU1 ...263 1. ...000 -.00176 .SPSU2 ...260 .00026 ...262 1. .SPSU2 ...263 1. ...000 -.00176 .C3VRF ...202 1. ...264 -.56 .PS3HF ...147 -1. ...155 1. .PS3HF ...276 -1.1 ...277 -9.9 .PS3HF ...278 -2.15 ...279 -.878 .BF0SD ...164 1. ...165 1. .BF0SD ...000 -2.6143 .C4VRF ...200 1. ...264 -.66 .C4VRF ...265 .66 .CCSF6 ...157 1. ...164 -1. .CCSVF ...156 1. ...166 -1. .FCTEM ...260 -.0029 ...283 -.0007 .FCTEM ...284 .44 ...285 -.0459 .FCTEM ...286 1. ...289 -.78 .FCTEM ...000 -.00049 .VN0ER ...188 1. ...241 -1.125 .GASRF ...260 1. ...264 -1. .G0TCF ...142 1. ...147 -1. .G0TCF ...276 1.2 ...277 -23.1 .G0TCF ...278 -1. ...279 -.832 .PC4TG ...213 64. ...214 -66. .PC4TG ...215 73. ...216 -92. .PC4TG ...217 40. ...218 -50. .PC4TG ...220 317.5 ...221 -613.2 .PC4TG ...219 .24 ...211 -1. .PC4TG ...244 -1. ...245 -1. .PC4TG ...273 1. .P0LYG ...213 1. ...214 -3. .P0LYG ...215 -17. ...216 -2. .P0LYG ...217 -24. ...218 14. .P0LYG ...220 -5.1 ...221 -19.2 .P0LYG ...219 1.29 ...211 -1. .P0LYG ...244 -1. ...245 -1. .P0LYG ...274 1. .P90BG ...256 1. ...213 -9. .P90BG ...214 7. ...215 -52. .P90BG ...216 33. ...217 -70. .P90BG ...218 60. ...220 -81. .P90BG ...221 95.8 ...219 -.7 .P90BG ...211 -1. ...244 -1. .P90BG ...245 -1. ...000 .0023 .P93BG ...213 -9. ...214 7. .P93BG ...215 -52. ...216 33. .P93BG ...217 -69. ...218 59. .P93BG ...220 -80.6 ...221 95.8 .P93BG ...219 -3.23 ...211 -1. .P93BG ...244 -1. ...245 -1. .P93BG ...257 1. ...000 .0023 .P96BG ...213 -9. ...214 7. .P96BG ...215 -52. ...216 33. .P96BG ...217 -68. ...218 58. .P96BG ...220 -80.2 ...221 95.8 .P96BG ...219 -4.94 ...211 -1. .P96BG ...244 -1. ...245 -1. .P96BG ...258 1. ...000 .0023 .P990G ...213 1.1 ...214 -3.1 .P990G ...215 22. ...216 -41. .P990G ...217 49. ...218 -59. .P990G ...220 44. ...221 -59. .P990G ...219 7.48 ...211 -1. .P990G ...244 -1. ...245 -1. .P990G ...255 1. ...000 .0023 .P99BG ...213 -9. ...214 7. .P99BG ...215 -52. ...216 33. .P99BG ...217 -67. ...218 57. .P99BG ...220 -79.8 ...221 95.8 .P99BG ...219 -6.21 ...211 -1. .P99BG ...244 -1. ...245 -1. .P99BG ...259 1. ...000 .0023 .C5TEG ...213 4. ...214 -6. .C5TEG ...215 58. ...216 -77. .C5TEG ...217 40. ...218 -50. .C5TEG ...220 70. ...221 -118.2 .C5TEG ...219 10.99 ...211 -1. .C5TEG ...244 -1. ...245 -1. .C5TEG ...183 1. ...250 1. .C5TEG ...251 -1. .LCN0G ...213 1.5 ...214 -3.5 .LCN0G ...215 40. ...216 -59. .LCN0G ...217 38. ...218 -48. .LCN0G ...220 50.2 ...221 -80.2 .LCN0G ...219 2.98 ...211 -1. .LCN0G ...244 -1. ...245 -1. .LCN0G ...250 1. ...280 1. .LCN0G ...000 .0089 .FCREC ...156 -.7977 ...260 -.0071 .FCREC ...280 -.0059 ...281 -.0039 .FCREC ...282 -.0033 ...283 .0065 .FCREC ...284 -.09 ...285 -.0564 .FCREC ...287 1. ...289 -.925 .FCREC ...000 -.00123 .FCMAR ...260 -.0017 ...276 1. .FCMAR ...280 .0036 ...281 .0024 .FCMAR ...282 .002 ...283 .0011 .FCMAR ...284 .32 ...285 .0696 .FCMBR ...156 .152 ...277 1. .FCMBR ...283 -.0023 ...280 .0006 .FCMBR ...281 .0004 ...282 .00035 .FCMBR ...260 -.0005 ...284 .042 .FCC0N ...260 .0006 ...280 -.00112 .FCC0N ...281 -.00075 ...282 -.00063 .FCC0N ...283 -.039 ...284 1. .FCC0N ...285 .1969 ...288 1. .FCC0N ...289 2.375 ...156 .6075 .FCC0N ...157 .05 ...000 .00058 .VN1ER ...187 1. ...239 1. .VN1ER ...240 -1. ...242 .4 .FCTPT ...147 1. ...156 -7.383 .FCTPT ...157 -.4 ...260 -.04495 .FCTPT ...280 -.19654 ...281 -.13103 .FCTPT ...282 -.10919 ...283 -.22573 .FCTPT ...284 4.569 ...286 -6. .FCTPT ...287 -2. ...288 -2. .FCTPT ...289 1.49 ...290 -1.3 .FCTPT ...291 1. ...292 1. .FCTPT ...000 .0186 .VNRER ...235 1. ...236 -1. .VNRER ...242 4. ...243 -8. .VNRER ...177 1. .VN7ER ...237 1. ...238 -1. .VN7ER ...242 .5 ...243 -1. .VN7ER ...178 1. .C4VEG ...213 53. ...214 -55. .C4VEG ...215 73. ...216 -92. .C4VEG ...217 40. ...218 -50. .C4VEG ...220 273.5 ...221 -525.2 .C4VEG ...219 7.34 ...211 -1. .C4VEG ...244 -1. ...245 -1. .C4VEG ...200 1. .C3VEG ...213 169. ...214 -171. .C3VEG ...215 98. ...216 -117. .C3VEG ...217 70. ...218 -80. .C3VEG ...220 762. ...221 -1478.2 .C3VEG ...219 -2.56 ...211 -1. .C3VEG ...244 -1. ...245 -1. .C3VEG ...202 1. .G0IF6 ...164 -1. ...166 -20.051 .G0IF6 ...000 4.0021 .MD0IF ...164 -1. ...166 -15.911 .MD0IF ...000 3.7167 .CFIF6 ...164 -1. ...166 -5.395 .CFIF6 ...000 3.2253 .F1V0L ...160 1. ...164 1. .F1V0L ...166 7.925 ...000 -3.1011 .F2V0L ...161 1. ...164 1. .F2V0L ...166 3.117 ...000 -2.8049 .F3V0L ...162 1. ...164 1. .F3V0L ...166 1.954 ...000 -2.7235 .F4V0L ...163 1. ...164 1. .F4V0L ...166 -1.117 ...000 -2.8146 .PETF6 ...164 -1. ...148 1. .PETF6 ...166 -6.192 .KEBF6 ...044 1. ...164 -1. .KEBF6 ...166 -27.4598 .WKEF6 ...045 1. ...164 -1. .WKEF6 ...166 -28.869 .CB161 ...158 1. ...164 -1. .CB161 ...166 -6.248 .CB163 ...159 1. ...164 -1. .CB163 ...166 -2.346 .PS1L6 ...149 1. ...164 -1. .PS1L6 ...166 -15.619 .PS161 ...150 1. ...164 -1. .PS161 ...166 -9.972 .PS162 ...151 1. ...164 -1. .PS162 ...166 -5.883 .PS163 ...152 1. ...164 -1. .PS163 ...166 -.923 .PS2L6 ...153 1. ...164 -1. .PS2L6 ...166 -15.292 .PS2H6 ...154 1. ...164 -1. .PS2H6 ...166 -9.503 .MD0F6 ...145 1. ...164 -1. .MD0F6 ...166 -15.911 .PTF0E ...224 -2.5 ...225 .5 .PTF0E ...226 -14.32 ...227 -5.7 .PTF0E ...228 9. ...229 -19. .PTF0E ...231 -4.56 ...232 16.1 .PTF0E ...230 2.01 ...222 -1. .PTF0E ...246 -1. ...247 -1. .PTF0E ...303 1. .SCNTE ...224 -.2 ...225 -1.8 .SCNTE ...226 1.64 ...227 -21.6 .SCNTE ...228 30. ...229 -40. .SCNTE ...231 21.02 ...232 -18.2 .SCNTE ...230 6.61 ...222 -1. .SCNTE ...246 -1. ...247 -1. .SCNTE ...275 1. ...000 .0005 .SCNTR ...235 -.2 ...236 -1.8 .SCNTR ...237 9. ...238 -29. .SCNTR ...239 30. ...240 -40. .SCNTR ...242 24.7 ...243 -25.6 .SCNTR ...241 -2.38 ...233 -1. .SCNTR ...248 -1. ...249 -1. .SCNTR ...275 1. ...000 .0005 .PTF0R ...235 -2.5 ...236 .5 .PTF0R ...237 -12. ...238 -8. .PTF0R ...239 9. ...240 -19. .PTF0R ...242 -3.4 ...243 13.8 .PTF0R ...241 -6.93 ...233 -1. .PTF0R ...248 -1. ...249 -1. .PTF0R ...303 1. .PC4TE ...224 66. ...225 -68. .PC4TE ...226 51.8 ...227 -71.8 .PC4TE ...228 40. ...229 -50. .PC4TE ...231 314.9 ...232 -598. .PC4TE ...230 -3.78 ...222 -1. .PC4TE ...246 -1. ...247 -1. .PC4TE ...273 1. .P0LYE ...224 3. ...225 -5. .P0LYE ...226 -16.6 ...227 -3.4 .P0LYE ...228 -24. ...229 14. .P0LYE ...231 3.1 ...232 -25.6 .P0LYE ...230 -2.69 ...222 -1. .P0LYE ...246 -1. ...247 -1. .P0LYE ...274 1. .PC4TR ...273 1. ...235 66. .PC4TR ...236 -68. ...237 75. .PC4TR ...238 -95. ...239 40. .PC4TR ...240 -50. ...242 326.5 .PC4TR ...243 -621.2 ...241 -12.74 .PC4TR ...233 -1. ...248 -1. .PC4TR ...249 -1. .P0LYR ...235 3. ...236 -5. .P0LYR ...237 -15. ...238 -5. .P0LYR ...239 -24. ...240 14. .P0LYR ...242 3.9 ...243 -27.2 .P0LYR ...241 -6.68 ...233 -1. .P0LYR ...248 -1. ...249 -1. .P0LYR ...274 1. .P900E ...225 -2. ...226 -.64 .P900E ...227 -19.4 ...228 45. .P900E ...229 -55. ...231 26.68 .P900E ...232 -17.6 ...230 5.74 .P900E ...222 -1. ...246 -1. .P900E ...247 -1. ...252 1. .P900E ...000 .0023 .P930E ...224 1. ...225 -3. .P930E ...226 3.16 ...227 -23.2 .P930E ...228 46. ...229 -56. .P930E ...231 32.98 ...232 -29.4 .P930E ...230 5.55 ...222 -1. .P930E ...246 -1. ...247 -1. .P930E ...253 1. ...000 .0023 .P960E ...224 2. ...225 -4. .P960E ...226 6.96 ...227 -27. .P960E ...228 47. ...229 -57. .P960E ...231 39.28 ...232 -41.2 .P960E ...230 5.15 ...222 -1. .P960E ...246 -1. ...247 -1. .P960E ...254 1. ...000 .0023 .P900R ...236 -2. ...237 6. .P900R ...238 -26. ...239 45. .P900R ...240 -55. ...242 30. .P900R ...243 -24.2 ...241 -1.05 .P900R ...233 -1. ...248 -1. .P900R ...249 -1. ...252 1. .P900R ...000 .0023 .P930R ...235 1. ...236 -3. .P930R ...237 11. ...238 -31. .P930R ...239 46. ...240 -56. .P930R ...242 36.9 ...243 -37.2 .P930R ...241 -1.27 ...233 -1. .P930R ...248 -1. ...249 -1. .P930R ...253 1. ...000 .0023 .P960R ...235 2. ...236 -4. .P960R ...237 16. ...238 -36. .P960R ...239 47. ...240 -57. .P960R ...242 43.8 ...243 -50.2 .P960R ...241 -1.71 ...233 -1. .P960R ...248 -1. ...249 -1. .P960R ...254 1. ...000 .0023 .F0RFF ...164 1. ...264 -1. .F0RFF ...000 .3 .P90BE ...224 -7. ...225 5. .P90BE ...226 -43.2 ...227 23.2 .P90BE ...228 -70. ...229 60. .P90BE ...231 -68.6 ...232 81. .P90BE ...230 -3.65 ...222 -1. .P90BE ...246 -1. ...247 -1. .P90BE ...256 1. ...000 .0023 .P93BE ...224 -7. ...225 5. .P93BE ...226 -43.2 ...227 23.2 .P93BE ...228 -69. ...229 59. .P93BE ...231 -68.2 ...232 81. .P93BE ...230 -5.85 ...222 -1. .P93BE ...246 -1. ...247 -1. .P93BE ...257 1. ...000 .0023 .P96BE ...224 -7. ...225 5. .P96BE ...226 -43.2 ...227 23.2 .P96BE ...228 -68. ...229 58. .P96BE ...231 -67.8 ...232 81. .P96BE ...230 -7.63 ...222 -1. .P96BE ...246 -1. ...247 -1. .P96BE ...258 1. ...000 .0023 .P990E ...224 3.5 ...225 -5.5 .P990E ...226 13.04 ...227 -33. .P990E ...228 49. ...229 -59. .P990E ...231 49.12 ...232 -59.2 .P990E ...230 4.43 ...222 -1. .P990E ...246 -1. ...247 -1. .P990E ...255 1. ...000 .0023 .P99BE ...224 -7. ...225 5. .P99BE ...226 -43.2 ...227 23.2 .P99BE ...228 -67. ...229 57. .P99BE ...231 -67.4 ...232 81. .P99BE ...230 -8.38 ...222 -1. .P99BE ...246 -1. ...247 -1. .P99BE ...259 1. ...000 .0023 .P90BR ...235 -7. ...236 5. .P90BR ...237 -50. ...238 30. .P90BR ...239 -70. ...240 60. .P90BR ...242 -72. ...243 87.8 .P90BR ...241 -10.34 ...233 -1. .P90BR ...248 -1. ...249 -1. .P90BR ...256 1. ...000 .0023 .P93BR ...235 -7. ...236 5. .P93BR ...237 -50. ...238 30. .P93BR ...239 -69. ...240 59. .P93BR ...242 -71.6 ...243 87.8 .P93BR ...241 -12.38 ...233 -1. .P93BR ...248 -1. ...249 -1. .P93BR ...257 1. ...000 .0023 .P96BR ...235 -7. ...236 5. .P96BR ...237 -50. ...238 30. .P96BR ...239 -68. ...240 58. .P96BR ...242 -71.2 ...243 87.8 .P96BR ...241 -14.06 ...233 -1. .P96BR ...248 -1. ...249 -1. .P96BR ...258 1. ...000 .0023 .P990R ...235 3.5 ...236 -5.5 .P990R ...237 24. ...238 -44. .P990R ...239 49. ...240 -59. .P990R ...242 54.6 ...243 -70.2 .P990R ...241 -2.38 ...233 -1. .P990R ...248 -1. ...249 -1. .P990R ...255 1. ...000 .0023 .P99BR ...235 -7. ...236 5. .P99BR ...237 -50. ...238 30. .P99BR ...239 -67. ...240 57. .P99BR ...242 -70.8 ...243 87.8 .P99BR ...241 -14.97 ...233 -1. .P99BR ...248 -1. ...249 -1. .P99BR ...259 1. ...000 .0023 .PS3H6 ...155 1. ...164 -1. .PS3H6 ...166 -13.855 .HCNTE ...224 -6.5 ...225 4.5 .HCNTE ...226 -34.08 ...227 14.1 .HCNTE ...228 -50. ...229 40. .HCNTE ...231 -54.04 ...222 -1. .HCNTE ...246 -1. ...232 67.9 .HCNTE ...230 2.44 ...247 -1. .HCNTE ...282 1. .HCNTR ...235 -6.5 ...236 4.5 .HCNTR ...237 -38. ...240 40. .HCNTR ...242 -56. ...243 71.8 .HCNTR ...241 -6.68 ...233 -1. .HCNTR ...248 -1. ...238 18. .HCNTR ...239 -50. ...249 -1. .HCNTR ...282 1. .LCNBE ...224 -8. ...225 6. .LCNBE ...226 -29.52 ...227 21.7 .LCNBE ...228 -56. ...229 46. .LCNBE ...231 -60.16 ...232 87.5 .LCNBE ...230 1.92 ...222 -1. .LCNBE ...246 -1. ...247 -1. .LCNBE ...281 1. ...000 .0103 .LCNBR ...235 -8. ...236 6. .LCNBR ...237 -48. ...238 28. .LCNBR ...239 -56. ...240 46. .LCNBR ...242 -69.4 ...243 93.8 .LCNBR ...241 -7.02 ...233 -1. .LCNBR ...248 -1. ...249 -1. .LCNBR ...281 1. ...000 .0103 .C5TEE ...224 6. ...225 -8. .C5TEE ...226 40.4 ...227 -60.4 .C5TEE ...228 40. ...229 -50. .C5TEE ...231 69.2 ...232 -106.6 .C5TEE ...230 6.96 ...222 -1. .C5TEE ...246 -1. ...247 -1. .C5TEE ...183 1. ...250 1. .C5TEE ...251 .20083 .LCN0E ...224 3.5 ...225 -5.5 .LCN0E ...226 26.72 ...227 -46.7 .LCN0E ...228 38. ...229 -48. .LCN0E ...231 51.56 ...232 -72.9 .LCN0E ...230 -1.19 ...222 -1. .LCN0E ...246 -1. ...247 -1. .LCN0E ...250 1. ...280 1. .LCN0E ...000 .0089 .LCN0R ...235 3.5 ...236 -5.5 .LCN0R ...237 42. ...238 -62. .LCN0R ...239 38. ...240 -48. .LCN0R ...242 59.2 ...243 -88.2 .LCN0R ...241 -10.17 ...233 -1. .LCN0R ...248 -1. ...249 -1. .LCN0R ...250 1. ...280 1. .LCN0R ...000 .0089 .G0TF6 ...142 1. ...146 -1. .G0TF6 ...164 -1. ...166 -20.051 .DACFP ...120 2.63 ...147 -.33 .DACFP ...164 .33 ...166 .49 .DACFP ...276 -2.013 ...277 3.267 .DACFP ...278 -1.0164 ...279 -.3102 .DACFP ...000 .0311 .C4VEE ...200 1. ...224 55. .C4VEE ...225 -57. ...226 51.8 .C4VEE ...227 -71.8 ...228 40. .C4VEE ...229 -50. ...231 270.9 .C4VEE ...232 -510. ...230 3.25 .C4VEE ...222 -1. ...246 -1. .C4VEE ...247 -1. .C3VEE ...202 1. ...224 171. .C3VEE ...225 -173. ...226 70.8 .C3VEE ...227 -90.8 ...228 70. .C3VEE ...229 -80. ...231 756.4 .C3VEE ...232 -1457. ...230 -6.36 .C3VEE ...222 -1. ...246 -1. .C3VEE ...247 -1. .C4VER ...200 1. ...201 1. .C4VER ...235 55. ...236 -57. .C4VER ...237 75. ...238 -95. .C4VER ...239 40. ...240 -50. .C4VER ...242 282.5 ...243 -533.2 .C4VER ...241 -5.81 ...233 -1. .C4VER ...248 -1. ...249 -1. .C3VER ...202 1. ...203 1. .C3VER ...235 171. ...236 -173. .C3VER ...237 100. ...238 -120. .C3VER ...239 70. ...240 -80. .C3VER ...242 771. ...243 -1486.2 .C3VER ...241 -15.15 ...233 -1. .C3VER ...248 -1. ...249 -1. .SCSRT ...164 -.033 ...166 -.007 .SCSRT ...180 1. ...182 1. .SCSRT ...186 1. ...260 -.079 .SCSRT ...269 -.3351 ...271 -.0347 .SCSRT ...275 -.3769 .P0LYF ...164 -.0059 ...166 -.114 .P0LYF ...260 -.0802 ...267 -.0427 .P0LYF ...271 -.0586 ...273 -.1917 .P0LYF ...274 -.4058 ...283 1. .P0LYF ...000 .1273 .VNVER ...176 1. ...189 1. .VNVER ...235 -9. ...236 7. .VNVER ...237 -40. ...238 20. .VNVER ...239 -60. ...240 50. .VNVER ...242 -71. ...243 93.8 .VNVER ...241 65.12 ...233 -1. .VNVER ...248 -1. ...249 -1. .VN2PT ...134 -5.7 ...164 -.01 .VN2PT ...166 -.151 ...196 1. .VN2PT ...199 .4762 ...264 .085 .VN2PT ...260 -.315 ...302 -.198 .VN2PT ...303 -.462 .IMPP0 ...134 -5.05 ...164 -.005 .IMPP0 ...166 -.076 ...199 .4673 .IMPP0 ...252 -.34 ...256 -.413 .IMPP0 ...264 .085 ...260 -.219 .IMPP0 ...000 3.3169 .IMPP3 ...134 -5.38 ...164 -.005 .IMPP3 ...166 -.076 ...199 .4673 .IMPP3 ...253 -.316 ...260 -.259 .IMPP3 ...000 3.3201 ...257 -.401 .IMPP3 ...264 .085 .IMPP6 ...134 -5.7 ...164 -.01 .IMPP6 ...166 -.151 ...199 .657 .IMPP6 ...254 -.288 ...258 -.372 .IMPP6 ...264 .085 ...260 -.315 .IMPP6 ...000 3.3233 .IMPP9 ...134 -5.7 ...164 -.01 .IMPP9 ...166 -.151 ...199 1.2129 .IMPP9 ...255 -.235 ...259 -.349 .IMPP9 ...264 .085 ...260 -.395 .IMPP9 ...000 3.3305 .VN3P0 ...134 -5.47 ...164 -.005 .VN3P0 ...166 -.076 ...197 1. .VN3P0 ...199 .4673 ...252 -.209 .VN3P0 ...256 -.561 ...264 .085 .VN3P0 ...260 -.2 ...000 .0481 .VN3P3 ...134 -6.13 ...164 -.01 .VN3P3 ...166 -.151 ...197 1. .VN3P3 ...199 .4673 ...253 -.212 .VN3P3 ...257 -.521 ...264 .085 .VN3P3 ...260 -.235 ...000 .0513 .VN3P6 ...134 -6.79 ...164 -.01 .VN3P6 ...166 -.151 ...197 1. .VN3P6 ...199 .4932 ...254 -.222 .VN3P6 ...258 -.471 ...264 .085 .VN3P6 ...260 -.282 ...000 .0545 .VN4P0 ...134 -5.8 ...164 -.052 .VN4P0 ...166 -.786 ...198 1. .VN4P0 ...199 .4673 ...252 -.218 .VN4P0 ...256 -.538 ...264 .085 .VN4P0 ...260 -.167 ...000 .0481 .VN4P3 ...134 -6.51 ...164 -.057 .VN4P3 ...166 -.861 ...198 1. .VN4P3 ...199 .4673 ...253 -.231 .VN4P3 ...257 -.502 ...264 .085 .VN4P3 ...260 -.188 ...000 .0513 .VN4P6 ...134 -7.21 ...164 -.081 .VN4P6 ...166 -1.224 ...198 1. .VN4P6 ...199 .5055 ...254 -.231 .VN4P6 ...258 -.442 ...264 .085 .VN4P6 ...260 -.225 ...000 .0545 .VN2P0 ...134 -5.05 ...164 -.005 .VN2P0 ...166 -.076 ...196 1. .VN2P0 ...199 .4673 ...252 -.34 .VN2P0 ...256 -.413 ...264 .085 .VN2P0 ...260 -.219 ...000 .0481 .VN2P3 ...134 -5.38 ...164 -.005 .VN2P3 ...166 -.076 ...196 1. .VN2P3 ...199 .4673 ...253 -.316 .VN2P3 ...257 -.401 ...264 .085 .VN2P3 ...260 -.259 ...000 .0513 .VN2P6 ...134 -5.7 ...164 -.01 .VN2P6 ...166 -.151 ...196 1. .VN2P6 ...199 .657 ...254 -.288 .VN2P6 ...258 -.372 ...264 .085 .VN2P6 ...260 -.315 ...000 .0545 .VN3P9 ...134 -7.45 ...164 -.015 .VN3P9 ...166 -.227 ...197 1. .VN3P9 ...199 1.1306 ...255 -.216 .VN3P9 ...259 -.427 ...264 .085 .VN3P9 ...260 -.331 ...000 .0577 .VN4P9 ...134 -7.92 ...164 -.086 .VN4P9 ...166 -1.299 ...198 1. .VN4P9 ...199 .8789 ...255 -.23 .VN4P9 ...259 -.394 ...264 .085 .VN4P9 ...260 -.279 ...000 .0577 .VN2P9 ...134 -5.7 ...164 -.01 .VN2P9 ...166 -.151 ...196 1. .VN2P9 ...199 1.2129 ...255 -.235 .VN2P9 ...259 -.349 ...264 .085 .VN2P9 ...260 -.395 ...000 .0577 .NIMP1 ...176 -1. ...177 -8.5 .NIMP1 ...178 -62.5 ...187 -100. .NIMP1 ...188 -55.95 ...000 3.4736 .NIMP2 ...000 3.1736 ...176 -1. .NIMP2 ...177 -.9 ...178 16. .NIMP2 ...187 20. ...188 -46.04 .C4FVN ...176 1. ...177 64. .C4FVN ...178 115. ...184 1. .C4FVN ...187 100. ...188 64. .WSDIS ...023 .92 ...024 1. .WSDIS ...025 1. ...176 -.08 .WSDIS ...177 -.856 ...178 -3.72 .WSDIS ...187 -4.656 ...188 -4.4312 .WSDIS ...000 -4.663 .C5TVN ...176 -1. ...177 -15. .C5TVN ...178 -100. ...183 1. .C5TVN ...184 .1614 ...187 -100. .C5TVN ...188 -60.28 .ST13T ...043 1. ...044 -.7 .ST13T ...045 1. ...176 -.3 .ST13T ...178 6.3 ...187 6. .ST13T ...188 -19.314 ...000 .0177 .VN0SC ...176 1. ...177 8.5 .VN0SC ...178 62.5 ...180 -.62 .VN0SC ...181 -.38 ...187 100. .VN0SC ...188 55.95 ...193 .652 .VN0SC ...194 .652 ...000 .0005 .VN4VN ...176 -1. ...177 -.9 .VN4VN ...178 16. ...179 1. .VN4VN ...187 20. ...188 -46.04 .VN2PH ...176 1. ...177 2.2 .VN2PH ...178 -16. ...187 22.4 .VN2PH ...188 49.12 ...194 .43 .VN2PH ...195 .43 ...196 -1. .VN3PH ...176 1. ...177 1.1 .VN3PH ...178 -30. ...187 -7.4 .VN3PH ...188 48.08 ...192 .534 .VN3PH ...195 .534 ...197 -1. .VN1SC ...176 1. ...177 11. .VN1SC ...178 94. ...180 -.419 .VN1SC ...181 -.581 ...187 100. .VN1SC ...188 59. ...192 .742 .VN1SC ...193 .742 ...000 .0005 .C4TS2 ...176 1. ...177 64. .C4TS2 ...178 115. ...187 100. .C4TS2 ...188 64. ...189 1. .C4TS2 ...210 1. ...000 -2.8721 .C5TS2 ...176 1. ...177 15. .C5TS2 ...178 100. ...187 100. .C5TS2 ...188 60.28 ...189 1. .C5TS2 ...210 1. ...000 -2.8721 .VN2S2 ...176 1. ...177 2.2 .VN2S2 ...178 -16. ...187 22.4 .VN2S2 ...188 49.12 ...189 1. .VN2S2 ...210 1. ...000 -2.8721 .VN3S2 ...176 1. ...177 1.1 .VN3S2 ...178 -30. ...187 -7.4 .VN3S2 ...188 48.08 ...189 1. .VN3S2 ...210 1. ...000 -2.8721 .VN4S2 ...176 1. ...177 .9 .VN4S2 ...178 -16. ...187 -20. .VN4S2 ...188 46.04 ...189 1. .VN4S2 ...210 1. ...000 -2.8721 .VN0S2 ...176 1. ...177 8.5 .VN0S2 ...178 62.5 ...187 100. .VN0S2 ...188 55.95 ...189 1. .VN0S2 ...210 1. ...000 -2.8721 .VN1RF ...176 1. ...177 11. .VN1RF ...178 94. ...187 100. .VN1RF ...188 59. ...264 -.71 .VN1RF ...265 .71 .VN2RF ...176 1. ...177 2.2 .VN2RF ...178 -16. ...188 49.12 .VN2RF ...187 22.4 ...264 -.74 .VN2RF ...265 .74 .VN3RF ...176 1. ...177 1.1 .VN3RF ...178 -30. ...187 -7.4 .VN3RF ...188 48.08 ...264 -.75 .VN3RF ...265 .75 .VN0RF ...176 1. ...177 8.5 .VN0RF ...178 62.5 ...187 100. .VN0RF ...188 55.95 ...264 -.72 .VN0RF ...265 .72 .C4TS1 ...176 1. ...272 50.5 .C4TS1 ...177 64. ...178 115. .C4TS1 ...187 100. ...188 64. .C4TS1 ...189 1. ...205 1. .C4TS1 ...206 .096 ...207 -.126 .C4TS1 ...208 55. ...209 -50. .C4TS1 ...000 -2.8721 .C5TS1 ...176 1. ...177 15. .C5TS1 ...272 1.5 ...178 100. .C5TS1 ...187 100. ...188 60.28 .C5TS1 ...189 1. ...205 1. .C5TS1 ...206 .05 ...207 -.08 .C5TS1 ...208 50. ...209 -50. .C5TS1 ...000 -2.8721 .VN1S1 ...176 1. ...177 11. .VN1S1 ...178 94. ...187 100. .VN1S1 ...188 59. ...189 1. .VN1S1 ...205 1. ...206 .03 .VN1S1 ...207 -.06 ...208 47. .VN1S1 ...209 -50. ...272 -2.5 .VN1S1 ...000 -2.8721 .VN2S1 ...176 1. ...177 2.2 .VN2S1 ...178 -16. ...187 22.4 .VN2S1 ...188 49.12 ...189 1. .VN2S1 ...205 1. ...206 -.06 .VN2S1 ...207 .03 ...208 -50. .VN2S1 ...209 14. ...272 -11.3 .VN2S1 ...000 -2.8721 .VN3S1 ...176 1. ...177 1.1 .VN3S1 ...178 -30. ...187 -7.4 .VN3S1 ...188 48.08 ...189 1. .VN3S1 ...205 1. ...206 -.069 .VN3S1 ...207 .039 ...208 -73. .VN3S1 ...209 45. ...272 -12.4 .VN3S1 ...000 -2.8721 .VN4S1 ...176 1. ...177 .9 .VN4S1 ...178 -16. ...187 -20. .VN4S1 ...188 46.04 ...189 1. .VN4S1 ...205 1. ...206 -.083 .VN4S1 ...207 .053 ...208 -68. .VN4S1 ...209 60. ...272 -12.6 .VN4S1 ...000 -2.8721 .VN0S1 ...176 1. ...177 8.5 .VN0S1 ...178 62.5 ...187 100. .VN0S1 ...188 55.95 ...189 1. .VN0S1 ...205 1. ...206 .006 .VN0S1 ...207 -.036 ...208 15. .VN0S1 ...209 -50. ...272 -5. .VN0S1 ...000 -2.8721 .NJP46 ...039 3.6 ...040 -4.4 .NJP46 ...041 -1. ...050 -1. .NJP46 ...176 1. ...177 6. .NJP46 ...178 26. ...187 54. .NJP46 ...188 53.08 ...189 1. .NJP46 ...000 -.0087 .NJP47 ...039 4.6 ...040 -5.4 .NJP47 ...041 -1. ...050 -1. .NJP47 ...176 1. ...177 7. .NJP47 ...178 27.5 ...187 54.8 .NJP47 ...188 53.27 ...189 1. .NJP47 ...000 -.0087 .NJP48 ...039 5.6 ...040 -6.4 .NJP48 ...041 -1. ...050 -1. .NJP48 ...176 1. ...177 8. .NJP48 ...178 29. ...187 55.6 .NJP48 ...188 53.46 ...189 1. .NJP48 ...000 -.0087 .VNFEE ...224 1.7 ...225 -3.7 .VNFEE ...226 -.26 ...227 -19.7 .VNFEE ...228 -1.8 ...229 -8.2 .VNFEE ...231 14.95 ...232 -31.5 .VNFEE ...230 12.86 ...222 -1. .VNFEE ...246 -1. ...247 -1. .VNFEE ...176 1. ...177 10.7 .VNFEE ...178 46.5 ...187 58.2 .VNFEE ...188 55.39 ...189 1. .HNGWR ...014 1. ...021 1. .HNGWR ...142 -.34 ...164 -.366 .HNGWR ...166 -.091 ...176 -.2857 .HNGWR ...177 -1.9999 ...178 -5.3997 .HNGWR ...187 -11.5709 ...188 -15.105 .HNGWR ...200 -.0043 ...202 -.002 .HNGWR ...260 -.00112 ...000 2.8145 .INGNR ...013 1. ...021 1. .INGNR ...142 -.34 ...164 -.366 .INGNR ...166 -.9088 ...176 -.2856 .INGNR ...177 -1.9992 ...178 -5.3978 .INGNR ...187 -11.5382 ...188 -15.105 .INGNR ...200 -.0044 ...202 -.002 .INGNR ...260 -.00112 ...000 2.8317 .B1MW2 ...011 1. ...019 1. .B1MW2 ...034 -.135 ...145 -.266 .B1MW2 ...154 -.152 ...164 -.21 .B1MW2 ...166 1.4839 ...176 -.2018 .B1MW2 ...177 -1.4126 ...178 -3.814 .B1MW2 ...187 -11.7448 ...188 -10.7963 .B1MW2 ...200 -.0172 ...202 -.008 .B1MW2 ...260 -.00504 ...000 2.9089 .TNTWT ...017 .746 ...058 -.29 .TNTWT ...142 -.238 ...145 -.035 .TNTWT ...158 -.242 ...159 -.048 .TNTWT ...164 -.29 ...166 3.69 .TNTWT ...176 -.1292 ...177 -.9044 .TNTWT ...178 -2.1189 ...187 -5.5427 .TNTWT ...188 -7.2107 ...200 -.0058 .TNTWT ...202 -.006 ...260 -.00336 .TNTWT ...000 3.215 .TNBWT ...017 1.111 ...057 -.205 .TNBWT ...142 -.238 ...145 -.035 .TNBWT ...158 -.237 ...159 -.138 .TNBWT ...164 -.205 ...166 2.714 .TNBWT ...176 -.1292 ...177 -.9044 .TNBWT ...178 -2.1189 ...187 -5.5427 .TNBWT ...188 -7.2107 ...200 -.0058 .TNBWT ...202 -.006 ...260 -.00336 .TNBWT ...000 3.215 .KNGWR ...299 1. ...012 -1. .KNGWR ...021 1. ...142 -.28 .KNGWR ...164 -.467 ...166 .601 .KNGWR ...176 -.2321 ...177 -1.6247 .KNGWR ...178 -4.4099 ...187 -8.9823 .KNGWR ...188 -12.0181 ...200 -.0069 .KNGWR ...202 -.005 ...260 -.00504 .KNGWR ...000 2.6929 .KNGWC ...012 -1. ...299 1. .KNGWC ...022 1. ...142 -.28 .KNGWC ...146 .28 ...164 -.467 .KNGWC ...166 .601 ...176 -.2321 .KNGWC ...177 -1.6247 ...178 -4.4099 .KNGWC ...187 -8.9823 ...188 -12.0181 .KNGWC ...200 -.0069 ...202 -.005 .KNGWC ...260 -.00504 ...000 2.6957 .TNLWT ...017 .746 ...059 -.29 .TNLWT ...060 -.03 ...142 -.238 .TNLWT ...145 -.035 ...158 -.26 .TNLWT ...159 -.03 ...164 -.29 .TNLWT ...166 3.69 ...176 -.1292 .TNLWT ...177 -.9044 ...178 -2.1189 .TNLWT ...187 -5.5427 ...188 -7.2107 .TNLWT ...200 -.0058 ...202 -.006 .TNLWT ...260 -.00336 ...000 3.215 .A5MW3 ...010 1. ...020 .111 .A5MW3 ...046 -.126 ...145 -.222 .A5MW3 ...155 -.019 ...164 -.36 .A5MW3 ...166 .3341 ...176 -.2729 .A5MW3 ...177 -1.9103 ...178 -3.8479 .A5MW3 ...187 -8.9328 ...188 -13.9793 .A5MW3 ...200 .0039 ...202 -.001 .A5MW3 ...260 -.0017 ...000 2.8771 .B5MW3 ...011 1. ...020 .111 .B5MW3 ...046 -.116 ...145 -.16 .B5MW3 ...155 -.025 ...164 -.39 .B5MW3 ...166 .0148 ...176 -.2847 .B5MW3 ...177 -1.9929 ...178 -3.8435 .B5MW3 ...187 -10.9325 ...188 -14.8044 .B5MW3 ...200 -.0083 ...202 -.008 .B5MW3 ...260 -.00504 ...000 2.9066 .T5TWT ...017 .746 ...037 -.15 .T5TWT ...058 -.29 ...142 -.088 .T5TWT ...145 -.035 ...158 -.242 .T5TWT ...159 -.048 ...164 -.29 .T5TWT ...166 3.69 ...176 -.1292 .T5TWT ...177 -.9044 ...178 -2.1189 .T5TWT ...187 -5.5427 ...188 -7.2107 .T5TWT ...200 -.0058 ...202 -.006 .T5TWT ...260 -.00336 ...000 3.215 .T5BWT ...017 1.111 ...037 -.15 .T5BWT ...057 -.205 ...142 -.088 .T5BWT ...145 -.035 ...158 -.237 .T5BWT ...159 -.138 ...164 -.205 .T5BWT ...166 2.724 ...176 -.1292 .T5BWT ...177 -.9044 ...178 -2.1189 .T5BWT ...187 -5.5427 ...188 -7.2107 .T5BWT ...200 -.0058 ...202 -.006 .T5BWT ...260 -.00336 ...000 3.215 .T5LWT ...017 .746 ...037 -.15 .T5LWT ...059 -.29 ...060 -.03 .T5LWT ...142 -.088 ...145 -.035 .T5LWT ...158 -.26 ...159 -.03 .T5LWT ...164 -.29 ...166 3.69 .T5LWT ...176 -.1292 ...177 -.9044 .T5LWT ...178 -2.1189 ...187 -5.5427 .T5LWT ...188 -7.2107 ...200 -.0058 .T5LWT ...202 -.006 ...260 -.00336 .T5LWT ...000 3.215 .B1MN3 ...011 1. ...020 .111 .B1MN3 ...034 -.116 ...145 -.306 .B1MN3 ...164 -.342 ...166 .5595 .B1MN3 ...176 -.2018 ...177 -1.4126 .B1MN3 ...178 -3.814 ...187 -11.7448 .B1MN3 ...188 -10.7963 ...200 -.0172 .B1MN3 ...202 -.008 ...260 -.00504 .B1MN3 ...000 2.9061 .QKMW2 ...026 -.1343 ...016 1. .QKMW2 ...019 1. ...027 -.235 .QKMW2 ...145 -.115 ...153 -.062 .QKMW2 ...154 -.146 ...164 -.14 .QKMW2 ...166 .5247 ...176 -.2755 .QKMW2 ...177 -1.9285 ...178 -5.2345 .QKMW2 ...187 -6.9977 ...188 -14.5023 .QKMW2 ...200 -.0125 ...202 -.009 .QKMW2 ...260 -.0028 ...000 2.9969 .IKMW2 ...026 -.1293 ...013 1. .IKMW2 ...019 1. ...027 -.19 .IKMW2 ...145 -.19 ...153 -.037 .IKMW2 ...154 -.193 ...164 -.16 .IKMW2 ...166 1.589 ...176 -.2165 .IKMW2 ...177 -1.5155 ...178 -6.5167 .IKMW2 ...187 -13.8127 ...188 -11.6585 .IKMW2 ...200 -.0095 ...202 -.002 .IKMW2 ...260 -.00112 ...000 2.8409 .JNGW2 ...015 1. ...019 1. .JNGW2 ...142 -.299 ...153 -.05 .JNGW2 ...154 -.175 ...164 -.18 .JNGW2 ...166 1.787 ...176 -.1965 .JNGW2 ...177 -1.3755 ...178 -5.8164 .JNGW2 ...179 -.085 ...187 -12.3599 .JNGW2 ...188 -10.5776 ...200 -.0065 .JNGW2 ...202 -.004 ...260 -.00224 .JNGW2 ...000 2.8236 .AKMW2 ...026 -.1143 ...010 1. .AKMW2 ...019 1. ...027 -.2 .AKMW2 ...145 -.16 ...153 -.052 .AKMW2 ...154 -.2 ...164 -.16 .AKMW2 ...166 1.5197 ...176 -.2232 .AKMW2 ...177 -1.5624 ...178 -6.071 .AKMW2 ...187 -9.7315 ...188 -11.3765 .AKMW2 ...200 -.0008 ...202 -.001 .AKMW2 ...260 -.00168 ...000 2.8796 .KN8W3 ...012 -1. ...020 .132 .KN8W3 ...299 1. ...032 -.7 .KN8W3 ...033 -.196 ...155 -.06 .KN8W3 ...164 -.437 ...166 1.0927 .KN8W3 ...176 -.1429 ...177 -1.0003 .KN8W3 ...178 -4.2156 ...179 -.08 .KN8W3 ...187 -9.7029 ...188 -7.638 .KN8W3 ...200 -.0161 ...202 -.005 .KN8W3 ...260 -.00504 ...000 2.6992 .BKMW2 ...026 -.1086 ...011 1. .BKMW2 ...019 1. ...027 -.19 .BKMW2 ...145 -.14 ...153 -.042 .BKMW2 ...154 -.187 ...164 -.21 .BKMW2 ...166 1.484 ...176 -.1963 .BKMW2 ...177 -1.3741 ...178 -4.829 .BKMW2 ...187 -11.7976 ...188 -10.5256 .BKMW2 ...200 -.0177 ...202 -.008 .BKMW2 ...260 -.00504 ...000 2.9089 .KRMN2 ...299 1. ...028 -.0777 .KRMN2 ...012 -1. ...019 1. .KRMN2 ...029 -.11152 ...145 -.12 .KRMN2 ...153 -.08 ...154 -.182 .KRMN2 ...164 -.255 ...166 2.274 .KRMN2 ...176 -.2015 ...177 -1.4105 .KRMN2 ...178 -3.9091 ...187 -9.1481 .KRMN2 ...188 -10.4982 ...200 -.0115 .KRMN2 ...202 -.005 ...260 -.00504 .KRMN2 ...000 2.7023 .QKMN3 ...016 1. ...020 .118 .QKMN3 ...026 -.1229 ...027 -.215 .QKMN3 ...145 -.155 ...155 -.075 .QKMN3 ...164 -.253 ...166 -.3722 .QKMN3 ...176 -.2755 ...177 -1.9285 .QKMN3 ...178 -5.2345 ...187 -6.9977 .QKMN3 ...188 -14.5023 ...200 -.0125 .QKMN3 ...202 -.009 ...260 -.0028 .QKMN3 ...000 2.9941 .A1GW2 ...010 1. ...019 1. .A1GW2 ...034 -.141 ...142 -.212 .A1GW2 ...153 -.054 ...154 -.2 .A1GW2 ...164 -.16 ...166 1.5197 .A1GW2 ...176 -.2286 ...177 -1.6002 .A1GW2 ...178 -3.7033 ...187 -9.5326 .A1GW2 ...188 -11.8026 ...200 -.0004 .A1GW2 ...202 -.001 ...260 -.00168 .A1GW2 ...000 2.8797 .B1GW2 ...011 1. ...019 1. .B1GW2 ...034 -.135 ...142 -.216 .B1GW2 ...153 -.015 ...154 -.187 .B1GW2 ...164 -.21 ...166 1.4839 .B1GW2 ...176 -.2018 ...177 -1.4126 .B1GW2 ...178 -3.814 ...187 -11.7448 .B1GW2 ...188 -10.7963 ...200 -.0172 .B1GW2 ...202 -.008 ...260 -.00504 .B1GW2 ...000 2.9089 .IRGW3 ...028 -.1086 ...013 1. .IRGW3 ...020 .111 ...029 -.1558 .IRGW3 ...142 -.15 ...155 -.075 .IRGW3 ...164 -.355 ...166 .5765 .IRGW3 ...176 -.2165 ...177 -1.5155 .IRGW3 ...178 -6.6249 ...187 -13.8127 .IRGW3 ...188 -11.6585 ...200 -.0095 .IRGW3 ...202 -.002 ...260 -.00112 .IRGW3 ...000 2.8381 .IKMN3 ...013 1. ...020 .118 .IKMN3 ...026 -.0983 ...027 -.172 .IKMN3 ...145 -.216 ...155 -.035 .IKMN3 ...164 -.323 ...166 .435 .IKMN3 ...176 -.2424 ...177 -1.6968 .IKMN3 ...178 -6.3266 ...187 -13.2108 .IKMN3 ...188 -12.9563 ...200 -.0076 .IKMN3 ...202 -.002 ...260 -.00112 .IKMN3 ...000 2.8383 .IKMN4 ...013 1. ...020 .139 .IKMN4 ...026 -.0983 ...027 -.172 .IKMN4 ...145 -.216 ...155 -.118 .IKMN4 ...164 -.24 ...166 1.6186 .IKMN4 ...176 -.2421 ...177 -1.6947 .IKMN4 ...178 -6.3914 ...187 -13.1702 .IKMN4 ...188 -12.9378 ...200 -.0079 .IKMN4 ...202 -.002 ...260 -.00112 .IKMN4 ...000 2.8383 .AKMW3 ...010 1. ...020 .111 .AKMW3 ...026 -.1143 ...027 -.2 .AKMW3 ...145 -.16 ...155 -.052 .AKMW3 ...164 -.36 ...166 .3341 .AKMW3 ...176 -.2232 ...177 -1.5624 .AKMW3 ...178 -6.071 ...187 -9.7315 .AKMW3 ...188 -11.3765 ...200 -.0008 .AKMW3 ...202 -.001 ...260 -.00168 .AKMW3 ...000 2.8768 .CNGW3 ...294 1. ...020 .114 .CNGW3 ...142 -.252 ...155 -.081 .CNGW3 ...000 2.38 ...164 -.493 .CNGW3 ...166 3.436 ...176 -.1409 .CNGW3 ...177 -.9863 ...178 -2.8462 .CNGW3 ...179 -.026 ...187 -7.045 .CNGW3 ...188 -7.7143 ...200 -.0031 .CNGW3 ...202 -.003 ...260 -.00056 .A5GW3 ...010 1. ...020 .111 .A5GW3 ...046 -.126 ...142 -.164 .A5GW3 ...155 -.077 ...164 -.36 .A5GW3 ...166 .3341 ...176 -.2729 .A5GW3 ...177 -1.9103 ...178 -3.8479 .A5GW3 ...187 -8.9238 ...188 -13.9397 .A5GW3 ...200 .0039 ...202 -.001 .A5GW3 ...260 -.0017 ...000 2.8771 .B5GW3 ...011 1. ...020 .111 .B5GW3 ...046 -.116 ...142 -.11 .B5GW3 ...155 -.075 ...164 -.39 .B5GW3 ...166 .0148 ...176 -.2847 .B5GW3 ...177 -1.9929 ...178 -3.8435 .B5GW3 ...187 -10.9325 ...188 -14.8044 .B5GW3 ...200 -.0083 ...202 -.008 .B5GW3 ...260 -.00504 ...000 2.9066 .INGW3 ...013 1. ...020 .115 .INGW3 ...142 -.306 ...155 -.066 .INGW3 ...164 -.334 ...166 .346 .INGW3 ...176 -.1882 ...177 -1.3174 .INGW3 ...178 -6.7376 ...179 -.09 .INGW3 ...187 -14.2279 ...188 -10.2381 .INGW3 ...200 -.0118 ...202 -.002 .INGW3 ...260 -.00112 ...000 2.8379 .A1GW3 ...010 1. ...020 .111 .A1GW3 ...034 -.141 ...142 -.212 .A1GW3 ...155 -.054 ...164 -.36 .A1GW3 ...166 .3341 ...176 -.2286 .A1GW3 ...177 -1.6002 ...178 -3.7033 .A1GW3 ...187 -9.5326 ...188 -11.8026 .A1GW3 ...200 -.0004 ...202 -.001 .A1GW3 ...260 -.00168 ...000 2.8769 .B1GW3 ...011 1. ...020 .111 .B1GW3 ...034 -.135 ...142 -.216 .B1GW3 ...155 -.022 ...164 -.39 .B1GW3 ...166 .0148 ...176 -.2018 .B1GW3 ...177 -1.4126 ...178 -3.814 .B1GW3 ...187 -11.7448 ...188 -10.7963 .B1GW3 ...200 -.0172 ...202 -.008 .B1GW3 ...260 -.00504 ...000 2.9061 .KTGW1 ...299 1. ...012 -1. .KTGW1 ...018 1. ...053 -.152 .KTGW1 ...142 -.143 ...149 -.046 .KTGW1 ...150 -.105 ...151 -.065 .KTGW1 ...152 -.065 ...164 -.255 .KTGW1 ...166 2.274 ...176 -.1388 .KTGW1 ...177 -.9716 ...178 -4.2334 .KTGW1 ...187 -9.6882 ...188 -7.423 .KTGW1 ...200 -.0162 ...202 -.005 .KTGW1 ...260 -.00504 ...000 2.6988 .KWGW1 ...012 -1. ...299 1. .KWGW1 ...018 1. ...141 -.245 .KWGW1 ...142 -.245 ...150 -.1 .KWGW1 ...151 -.065 ...152 -.065 .KWGW1 ...164 -.255 ...166 2.274 .KWGW1 ...176 -.1938 ...177 -1.3566 .KWGW1 ...178 -3.9148 ...187 -9.1474 .KWGW1 ...188 -10.144 ...200 -.0122 .KWGW1 ...202 -.005 ...025 -.05 .KWGW1 ...260 -.00504 ...000 2.6992 .KKMN1 ...299 1. ...026 -.0777 .KKMN1 ...012 -1. ...018 1. .KKMN1 ...027 -.136 ...145 -.12 .KKMN1 ...149 -.027 ...150 -.105 .KKMN1 ...151 -.065 ...152 -.065 .KKMN1 ...164 -.255 ...166 2.274 .KKMN1 ...176 -.2015 ...177 -1.4105 .KKMN1 ...178 -3.9091 ...187 -9.1481 .KKMN1 ...188 -10.4982 ...200 -.0115 .KKMN1 ...202 -.005 ...260 -.00504 .KKMN1 ...000 2.6992 .K5GW1 ...299 1. ...012 -1. .K5GW1 ...018 1. ...046 -.1 .K5GW1 ...142 -.07 ...149 -.082 .K5GW1 ...150 -.105 ...151 -.065 .K5GW1 ...152 -.065 ...164 -.255 .K5GW1 ...166 2.274 ...176 -.2377 .K5GW1 ...177 -1.6639 ...178 -4.5638 .K5GW1 ...187 -8.9851 ...188 -12.2986 .K5GW1 ...200 -.0063 ...202 -.005 .K5GW1 ...260 -.00504 ...000 2.6994 .QKGW2 ...026 -.1343 ...016 1. .QKGW2 ...019 1. ...027 -.235 .QKGW2 ...142 -.09 ...153 -.087 .QKGW2 ...154 -.146 ...164 -.14 .QKGW2 ...166 .5247 ...176 -.2755 .QKGW2 ...177 -1.9285 ...178 -5.2345 .QKGW2 ...187 -6.9977 ...188 -14.5023 .QKGW2 ...200 -.0125 ...202 -.009 .QKGW2 ...260 -.0028 ...000 2.9969 .K1GW1 ...299 1. ...012 -1. .K1GW1 ...018 1. ...034 -.11 .K1GW1 ...142 -.129 ...149 -.052 .K1GW1 ...150 -.105 ...151 -.065 .K1GW1 ...152 -.065 ...164 -.255 .K1GW1 ...166 2.274 ...176 -.1928 .K1GW1 ...177 -1.3494 ...178 -3.8946 .K1GW1 ...187 -9.1474 ...188 -10.0719 .K1GW1 ...200 -.0122 ...202 -.005 .K1GW1 ...260 -.00504 ...000 2.6992 .IKGW2 ...026 -.1293 ...013 1. .IKGW2 ...019 1. ...027 -.19 .IKGW2 ...142 -.15 ...153 -.077 .IKGW2 ...154 -.193 ...164 -.16 .IKGW2 ...166 1.589 ...176 -.2165 .IKGW2 ...177 -1.5155 ...178 -6.5167 .IKGW2 ...187 -13.8127 ...188 -11.6585 .IKGW2 ...200 -.0095 ...202 -.002 .IKGW2 ...260 -.00112 ...000 2.8409 .KNGW1 ...299 1. ...012 -1. .KNGW1 ...018 1. ...142 -.28 .KNGW1 ...150 -.082 ...151 -.065 .KNGW1 ...152 -.065 ...164 -.255 .KNGW1 ...166 2.274 ...176 -.1429 .KNGW1 ...177 -1.0003 ...178 -4.2156 .KNGW1 ...179 -.08 ...187 -9.7029 .KNGW1 ...188 -7.638 ...200 -.0161 .KNGW1 ...202 -.005 ...260 -.00504 .KNGW1 ...000 2.6989 .A4GW2 ...010 1. ...019 1. .A4GW2 ...039 -.4248 ...040 .2832 .A4GW2 ...041 -.177 ...154 -.2 .A4GW2 ...164 -.16 ...166 1.5197 .A4GW2 ...176 -.1792 ...177 -1.2544 .A4GW2 ...178 -3.7811 ...187 -10.4474 .A4GW2 ...188 -9.3901 ...200 -.0048 .A4GW2 ...202 -.001 ...260 -.00168 .A4GW2 ...000 2.8794 .AKGW2 ...026 -.1143 ...010 1. .AKGW2 ...019 1. ...027 -.2 .AKGW2 ...142 -.104 ...153 -.108 .AKGW2 ...154 -.2 ...164 -.16 .AKGW2 ...166 1.52 ...176 -.2232 .AKGW2 ...177 -1.5624 ...178 -4.955 .AKGW2 ...187 -9.7315 ...188 -11.5484 .AKGW2 ...200 -.0008 ...202 -.001 .AKGW2 ...260 -.00168 ...000 2.8796 .BKGW2 ...026 -.1086 ...011 1. .BKGW2 ...019 1. ...027 -.19 .BKGW2 ...142 -.09 ...153 -.092 .BKGW2 ...154 -.187 ...164 -.21 .BKGW2 ...166 1.4839 ...176 -.1964 .BKGW2 ...177 -1.3748 ...178 -4.8511 .BKGW2 ...187 -11.8036 ...188 -10.531 .BKGW2 ...200 -.0176 ...202 -.008 .BKGW2 ...260 -.00504 ...000 2.9089 .B4GW2 ...011 1. ...019 1. .B4GW2 ...039 -.3984 ...040 .2656 .B4GW2 ...041 -.166 ...142 -.094 .B4GW2 ...153 -.045 ...154 -.283 .B4GW2 ...164 -.21 ...166 1.4839 .B4GW2 ...176 -.146 ...177 -1.022 .B4GW2 ...178 -6.5846 ...187 -12.2932 .B4GW2 ...188 -7.976 ...200 -.021 .B4GW2 ...202 -.008 ...260 -.00504 .B4GW2 ...000 2.9086 .C4GW3 ...294 1. ...020 .114 .C4GW3 ...000 2.38 ...039 -.3504 .C4GW3 ...040 .2336 ...041 -.146 .C4GW3 ...142 -.124 ...155 -.118 .C4GW3 ...164 -.493 ...166 3.436 .C4GW3 ...176 -.1089 ...177 -.7623 .C4GW3 ...178 -2.5918 ...187 -7.2527 .C4GW3 ...188 -6.0178 ...200 -.0061 .C4GW3 ...202 -.003 ...260 -.00056 .QKGW3 ...016 1. ...020 .118 .QKGW3 ...026 -.1343 ...027 -.235 .QKGW3 ...142 -.09 ...155 -.12 .QKGW3 ...164 -.253 ...166 -.28 .QKGW3 ...176 -.2756 ...177 -1.9292 .QKGW3 ...178 -5.264 ...187 -7.0278 .QKGW3 ...188 -14.5076 ...200 -.0124 .QKGW3 ...202 -.009 ...260 -.0028 .QKGW3 ...000 2.9941 .QKGW4 ...016 1. ...020 .139 .QKGW4 ...026 -.1343 ...027 -.235 .QKGW4 ...142 -.09 ...155 -.203 .QKGW4 ...164 -.17 ...166 .3468 .QKGW4 ...176 -.2755 ...177 -1.9285 .QKGW4 ...178 -4.408 ...187 -6.9977 .QKGW4 ...188 -14.5023 ...200 -.0125 .QKGW4 ...202 -.009 ...260 -.0028 .QKGW4 ...000 2.9941 .A4GW3 ...010 1. ...020 .111 .A4GW3 ...039 -.4248 ...040 .2832 .A4GW3 ...041 -.177 ...142 -.23 .A4GW3 ...155 -.045 ...164 -.36 .A4GW3 ...166 .3341 ...176 -.1792 .A4GW3 ...177 -1.2544 ...178 -3.7811 .A4GW3 ...187 -10.4474 ...188 -9.3901 .A4GW3 ...200 -.0048 ...202 -.001 .A4GW3 ...260 -.00168 ...000 2.8766 .BKGW3 ...011 1. ...020 .111 .BKGW3 ...026 -.1086 ...027 -.19 .BKGW3 ...142 -.09 ...155 -.099 .BKGW3 ...164 -.39 ...166 1.5031 .BKGW3 ...176 -.1964 ...177 -1.3748 .BKGW3 ...178 -4.8511 ...187 -11.8036 .BKGW3 ...188 -10.531 ...200 -.0176 .BKGW3 ...202 -.008 ...260 -.00504 .BKGW3 ...000 2.9061 .B4GW3 ...011 1. ...020 .111 .B4GW3 ...039 -.3984 ...040 .2656 .B4GW3 ...041 -.166 ...142 -.094 .B4GW3 ...155 -.148 ...164 -.39 .B4GW3 ...166 1.5031 ...176 -.146 .B4GW3 ...177 -1.022 ...178 -6.5846 .B4GW3 ...187 -12.2932 ...188 -7.976 .B4GW3 ...200 -.021 ...202 -.008 .B4GW3 ...260 -.00504 ...000 2.9058 .KNGW2 ...299 1. ...012 -1. .KNGW2 ...019 1. ...142 -.28 .KNGW2 ...154 -.212 ...164 -.255 .KNGW2 ...166 .2274 ...176 -.1429 .KNGW2 ...177 -1.0003 ...178 -4.2156 .KNGW2 ...179 -.08 ...187 -9.7029 .KNGW2 ...188 -7.638 ...200 -.0161 .KNGW2 ...202 -.005 ...260 -.00504 .KNGW2 ...000 2.702 .K5GW3 ...012 -1. ...020 .114 .K5GW3 ...299 1. ...046 -.1 .K5GW3 ...142 -.07 ...155 -.12 .K5GW3 ...164 -.452 ...166 .786 .K5GW3 ...176 -.2377 ...177 -1.6639 .K5GW3 ...178 -4.5638 ...187 -8.9851 .K5GW3 ...188 -12.2986 ...200 -.0063 .K5GW3 ...202 -.005 ...260 -.00504 .K5GW3 ...000 2.6997 .K5GW4 ...012 -1. ...020 .139 .K5GW4 ...299 1. ...046 -.1 .K5GW4 ...142 -.07 ...155 -.242 .K5GW4 ...164 -.33 ...166 2.897 .K5GW4 ...176 -.2377 ...177 -1.6639 .K5GW4 ...178 -4.5638 ...187 -8.9851 .K5GW4 ...188 -12.2986 ...200 -.0063 .K5GW4 ...202 -.005 ...260 -.00504 .K5GW4 ...000 2.6997 .K1GW3 ...012 -1. ...020 .116 .K1GW3 ...034 -.11 ...142 -.129 .K1GW3 ...155 -.142 ...164 -.4 .K1GW3 ...166 1.249 ...176 -.1928 .K1GW3 ...177 -1.3496 ...178 -3.8946 .K1GW3 ...187 -9.1474 ...188 -10.0719 .K1GW3 ...200 -.0122 ...202 -.005 .K1GW3 ...260 -.00504 ...000 2.6995 .K1GW3 ...299 1. .K1GW4 ...012 -1. ...020 .139 .K1GW4 ...299 1. ...034 -.11 .K1GW4 ...142 -.129 ...155 -.212 .K1GW4 ...164 -.33 ...166 2.897 .K1GW4 ...176 -.1928 ...177 -1.3496 .K1GW4 ...178 -3.8946 ...187 -9.1002 .K1GW4 ...188 -10.0719 ...200 -.0122 .K1GW4 ...202 -.005 ...260 -.00504 .K1GW4 ...000 2.6995 .KNGW3 ...012 -1. ...020 .118 .KNGW3 ...299 1. ...142 -.25 .KNGW3 ...155 -.06 ...164 -.437 .KNGW3 ...166 .955 ...176 -.1429 .KNGW3 ...177 -1.0003 ...178 -4.2156 .KNGW3 ...179 -.08 ...187 -9.7029 .KNGW3 ...188 -7.638 ...200 -.0161 .KNGW3 ...202 -.005 ...260 -.00504 .KNGW3 ...000 2.6992 .KNGW4 ...012 -1. ...020 .139 .KNGW4 ...299 1. ...142 -.25 .KNGW4 ...155 -.167 ...164 -.33 .KNGW4 ...166 2.897 ...176 -.1429 .KNGW4 ...177 -1.0003 ...178 -4.2156 .KNGW4 ...179 -.08 ...187 -9.7029 .KNGW4 ...188 -7.638 ...200 -.0161 .KNGW4 ...202 -.005 ...260 -.00504 .KNGW4 ...000 2.6992 .K4GW1 ...299 1. ...012 -1. .K4GW1 ...018 1. ...039 -.3648 .K4GW1 ...040 .2432 ...041 -.152 .K4GW1 ...142 -.143 ...149 -.046 .K4GW1 ...150 -.105 ...151 -.065 .K4GW1 ...152 -.065 ...164 -.255 .K4GW1 ...166 2.274 ...176 -.1388 .K4GW1 ...177 -.9716 ...178 -4.2334 .K4GW1 ...187 -9.6882 ...188 -7.43 .K4GW1 ...200 -.0162 ...202 -.005 .K4GW1 ...260 -.00504 ...000 2.6988 .K4GW2 ...299 1. ...012 -1. .K4GW2 ...019 1. ...039 -.3648 .K4GW2 ...040 .2432 ...041 -.152 .K4GW2 ...142 -.143 ...153 -.096 .K4GW2 ...154 -.185 ...164 -.255 .K4GW2 ...166 2.274 ...176 -.1388 .K4GW2 ...177 -.9716 ...178 -4.2334 .K4GW2 ...187 -9.6882 ...188 -7.43 .K4GW2 ...200 -.0162 ...202 -.005 .K4GW2 ...260 -.00504 ...000 2.7019 .K4GW3 ...012 -1. ...020 .114 .K4GW3 ...299 1. ...039 -.3648 .K4GW3 ...040 .2432 ...041 -.152 .K4GW3 ...142 -.143 ...155 -.12 .K4GW3 ...164 -.416 ...166 1.192 .K4GW3 ...176 -.1388 ...177 -.9716 .K4GW3 ...178 -4.2334 ...187 -9.6882 .K4GW3 ...188 -7.43 ...200 -.0162 .K4GW3 ...202 -.005 ...260 -.00504 .K4GW3 ...000 2.6991 .KKGN3 ...012 -1. ...020 .118 .KKGN3 ...299 1. ...026 -.0777 .KKGN3 ...027 -.136 ...142 -.117 .KKGN3 ...155 -.11 ...164 -.41 .KKGN3 ...166 1.216 ...176 -.2015 .KKGN3 ...177 -1.4105 ...178 -3.9091 .KKGN3 ...187 -9.1481 ...188 -10.4982 .KKGN3 ...202 -.005 ...200 -.0115 .KKGN3 ...260 -.00504 ...000 2.6995 .K4GW4 ...012 -1. ...020 .139 .K4GW4 ...299 1. ...039 -.3648 .K4GW4 ...040 .2432 ...041 -.152 .K4GW4 ...142 -.143 ...155 -.206 .K4GW4 ...164 -.33 ...166 2.897 .K4GW4 ...176 -.1388 ...177 -.9716 .K4GW4 ...178 -4.2334 ...187 -9.6882 .K4GW4 ...188 -7.43 ...200 -.0162 .K4GW4 ...202 -.005 ...260 -.00504 .K4GW4 ...000 2.6991 .KKGN4 ...012 -1. ...020 .139 .KKGN4 ...299 1. ...026 -.0777 .KKGN4 ...027 -.136 ...142 -.117 .KKGN4 ...155 -.19 ...164 -.33 .KKGN4 ...166 2.897 ...176 -.2015 .KKGN4 ...177 -1.4105 ...178 -3.9091 .KKGN4 ...187 -9.1481 ...188 -10.4982 .KKGN4 ...200 -.0115 ...202 -.005 .KKGN4 ...260 -.00504 ...000 2.6995 .VN3HF ...176 1. ...295 -1. .VN3HF ...177 1.1 ...178 -30. .VN3HF ...187 -7.4 ...188 48.08 .VN3HF ...192 .534 ...195 .534 .VNFHF ...000 .123 ...134 -1.25 .VNFHF ...164 -.03 ...166 -.4092 .VNFHF ...260 -.246 ...295 1. .VNFHF ...296 1. ...297 1. .VNFHF ...298 -.62 RHS ZZZZZZ01 ...000 -7.113 ...010 2.284 ZZZZZZ01 ...011 1.59 ...013 3.99 ZZZZZZ01 ...014 .109 ...015 .69 ZZZZZZ01 ...017 1. ...018 5.216 ZZZZZZ01 ...019 7.233 ...020 1. ZZZZZZ01 ...021 .65 ...023 .1395 ZZZZZZ01 ...024 .1805 ...030 1.3453 ZZZZZZ01 ...035 .4207 ...038 .6665 ZZZZZZ01 ...043 .5 ...048 .1019 ZZZZZZ01 ...050 .935 ...055 .96 ZZZZZZ01 ...057 -.0098 ...059 -.2662 ZZZZZZ01 ...060 -.0104 ...120 .099 ZZZZZZ01 ...133 1.6342 ...134 1.8 ZZZZZZ01 ...135 16.5 ...136 1.5 ZZZZZZ01 ...138 .1938 ...142 -.0637 ZZZZZZ01 ...143 .6344 ...144 .6045 ZZZZZZ01 ...147 .5789 ...148 .347 ZZZZZZ01 ...150 -.0459 ...151 -.1422 ZZZZZZ01 ...152 -.2448 ...156 -12.1938 ZZZZZZ01 ...157 -.6231 ...158 -.2857 ZZZZZZ01 ...159 -.033 ...160 .2314 ZZZZZZ01 ...161 .0675 ...163 4.3845 ZZZZZZ01 ...164 -.3658 ...165 3.8254 ZZZZZZ01 ...166 3.3851 ...167 .0327 ZZZZZZ01 ...168 .0487 ...169 .0775 ZZZZZZ01 ...172 .05 ...174 .205 ZZZZZZ01 ...175 .1375 ...176 .1692 ZZZZZZ01 ...177 1.8446 ...178 9.1385 ZZZZZZ01 ...179 .0495 ...182 .631 ZZZZZZ01 ...185 .5 ...186 1.05 ZZZZZZ01 ...187 10.8308 ...188 9.5531 ZZZZZZ01 ...189 .1692 ...190 2.952 ZZZZZZ01 ...191 1.302 ...192 1. ZZZZZZ01 ...193 1. ...194 1. ZZZZZZ01 ...195 1. ...196 .1181 ZZZZZZ01 ...197 .1181 ...199 1. ZZZZZZ01 ...202 -.0095 ...204 .1107 ZZZZZZ01 ...205 .3953 ...212 .3987 ZZZZZZ01 ...223 2.908 ...234 1.9642 ZZZZZZ01 ...250 1.7 ...261 2.799 ZZZZZZ01 ...263 56.92 ...264 -1.1958 ZZZZZZ01 ...265 .44 ...266 .5 ZZZZZZ01 ...268 .0425 ...270 .1984 ZZZZZZ01 ...276 1.5231 ...277 3.9475 ZZZZZZ01 ...278 1.2884 ...279 .5186 ZZZZZZ01 ...280 -.1901 ...281 .1275 ZZZZZZ01 ...284 42. ...285 3.8 ZZZZZZ01 ...291 4.68 ...292 2.4 ZZZZZZ01 ...293 .1114 ...294 2.264 ZZZZZZ01 ...299 10.57 ...300 .2137 ENDATA CoinMP-1.8.3/Data/Sample/Makefile.in0000644000175000017500000004471512053222044015460 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ DIST_COMMON = $(am__configure_deps) $(srcdir)/BuildTools/Makemain.inc \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/coindatasample-uninstalled.pc.in \ $(srcdir)/coindatasample.pc.in $(top_srcdir)/configure \ config.guess config.sub depcomp install-sh ltmain.sh missing @HAVE_EXTERNALS_TRUE@am__append_1 = Dependencies @HAVE_EXTERNALS_TRUE@am__append_2 = .Dependencies-stamp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = coindatasample.pc coindatasample-uninstalled.pc SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(datacoindir)" \ "$(DESTDIR)$(pkgconfiglibdir)" datacoinDATA_INSTALL = $(INSTALL_DATA) pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) DATA = $(datacoin_DATA) $(pkgconfiglib_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CYGPATH_W = @CYGPATH_W@ DATASAMPLE_SVN_REV = @DATASAMPLE_SVN_REV@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXAMPLE_CLEAN_FILES = @EXAMPLE_CLEAN_FILES@ EXAMPLE_FILES = @EXAMPLE_FILES@ EXAMPLE_UNCOMPRESSED_FILES = @EXAMPLE_UNCOMPRESSED_FILES@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ 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@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_ct_STRIP = @ac_ct_STRIP@ am__leading_dot = @am__leading_dot@ 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@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # List files that should be distributed # ######################################################################## EXTRA_DIST = $(EXAMPLE_FILES) $(am__append_1) DISTCLEANFILES = $(EXAMPLE_CLEAN_FILES) $(am__append_2) \ $(VPATH_DISTCLEANFILES) datacoindir = $(datadir)/coin/Data/Sample datacoin_DATA = $(EXAMPLE_FILES) pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = coindatasample.pc DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) all: all-am .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/BuildTools/Makemain.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) coindatasample.pc: $(top_builddir)/config.status $(srcdir)/coindatasample.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ coindatasample-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/coindatasample-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ uninstall-info-am: install-datacoinDATA: $(datacoin_DATA) @$(NORMAL_INSTALL) test -z "$(datacoindir)" || $(mkdir_p) "$(DESTDIR)$(datacoindir)" @list='$(datacoin_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(datacoinDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(datacoindir)/$$f'"; \ $(datacoinDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(datacoindir)/$$f"; \ done uninstall-datacoinDATA: @$(NORMAL_UNINSTALL) @list='$(datacoin_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(datacoindir)/$$f'"; \ rm -f "$(DESTDIR)$(datacoindir)/$$f"; \ done install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/BuildTools @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(datacoindir)" "$(DESTDIR)$(pkgconfiglibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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 mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-datacoinDATA install-pkgconfiglibDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-datacoinDATA uninstall-info-am \ uninstall-pkgconfiglibDATA .PHONY: all all-am am--refresh check check-am clean clean-generic dist \ dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip \ distcheck distclean distclean-generic distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-datacoinDATA install-exec install-exec-am install-info \ install-info-am install-man install-pkgconfiglibDATA \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-datacoinDATA uninstall-info-am \ uninstall-pkgconfiglibDATA install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## # Make sure acinclude is using most recent coin.m4 @MAINTAINER_MODE_TRUE@$(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 @MAINTAINER_MODE_TRUE@ cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date @MAINTAINER_MODE_TRUE@$(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh @MAINTAINER_MODE_TRUE@ cp $< $@ # Take care of updating externals (if Dependencies file exists) @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@$(top_builddir)/Makefile: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@.Dependencies-stamp: $(srcdir)/Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); BuildTools/set_externals Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ touch .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@update-externals: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); svn update .PHONY: install-doc uninstall-doc update-externals test: @echo "No test available." # 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: CoinMP-1.8.3/Data/Sample/atm_5_10_1.mps0000644000175000017500000032537212136243266015675 0ustar renereneNAME BLANK FREE ROWS N OBJROW L budget(d_DATE0) L budget(d_DATE1) L budget(d_DATE2) L budget(d_DATE3) L budget(d_DATE4) L budget(d_DATE5) L budget(d_DATE6) L budget(d_DATE7) L budget(d_DATE8) L budget(d_DATE9) E demand_def(a_ATM0,d_DATE0) L linkv(a_ATM0,d_DATE0) E demand_def(a_ATM0,d_DATE1) L linkv(a_ATM0,d_DATE1) E demand_def(a_ATM0,d_DATE2) L linkv(a_ATM0,d_DATE2) E demand_def(a_ATM0,d_DATE3) L linkv(a_ATM0,d_DATE3) E demand_def(a_ATM0,d_DATE4) L linkv(a_ATM0,d_DATE4) E demand_def(a_ATM0,d_DATE5) L linkv(a_ATM0,d_DATE5) E demand_def(a_ATM0,d_DATE6) L linkv(a_ATM0,d_DATE6) E demand_def(a_ATM0,d_DATE7) L linkv(a_ATM0,d_DATE7) E demand_def(a_ATM0,d_DATE8) L linkv(a_ATM0,d_DATE8) E demand_def(a_ATM0,d_DATE9) L linkv(a_ATM0,d_DATE9) L pickone_x1(a_ATM0) L count(a_ATM0) L ztox1(a_ATM0,t_1) L ztox2(a_ATM0,t_1) G ztox3(a_ATM0,t_1) L ztox1(a_ATM0,t_2) L ztox2(a_ATM0,t_2) G ztox3(a_ATM0,t_2) L ztox1(a_ATM0,t_3) L ztox2(a_ATM0,t_3) G ztox3(a_ATM0,t_3) L ztox1(a_ATM0,t_4) L ztox2(a_ATM0,t_4) G ztox3(a_ATM0,t_4) L ztox1(a_ATM0,t_5) L ztox2(a_ATM0,t_5) G ztox3(a_ATM0,t_5) L ztox1(a_ATM0,t_6) L ztox2(a_ATM0,t_6) G ztox3(a_ATM0,t_6) L ztox1(a_ATM0,t_7) L ztox2(a_ATM0,t_7) G ztox3(a_ATM0,t_7) L ztox1(a_ATM0,t_8) L ztox2(a_ATM0,t_8) G ztox3(a_ATM0,t_8) L ztox1(a_ATM0,t_9) L ztox2(a_ATM0,t_9) G ztox3(a_ATM0,t_9) L ztox1(a_ATM0,t_10) L ztox2(a_ATM0,t_10) G ztox3(a_ATM0,t_10) E demand_def(a_ATM1,d_DATE0) L linkv(a_ATM1,d_DATE0) E demand_def(a_ATM1,d_DATE1) L linkv(a_ATM1,d_DATE1) E demand_def(a_ATM1,d_DATE2) L linkv(a_ATM1,d_DATE2) E demand_def(a_ATM1,d_DATE3) L linkv(a_ATM1,d_DATE3) E demand_def(a_ATM1,d_DATE4) L linkv(a_ATM1,d_DATE4) E demand_def(a_ATM1,d_DATE5) L linkv(a_ATM1,d_DATE5) E demand_def(a_ATM1,d_DATE6) L linkv(a_ATM1,d_DATE6) E demand_def(a_ATM1,d_DATE7) L linkv(a_ATM1,d_DATE7) E demand_def(a_ATM1,d_DATE8) L linkv(a_ATM1,d_DATE8) E demand_def(a_ATM1,d_DATE9) L linkv(a_ATM1,d_DATE9) L pickone_x1(a_ATM1) L count(a_ATM1) L ztox1(a_ATM1,t_1) L ztox2(a_ATM1,t_1) G ztox3(a_ATM1,t_1) L ztox1(a_ATM1,t_2) L ztox2(a_ATM1,t_2) G ztox3(a_ATM1,t_2) L ztox1(a_ATM1,t_3) L ztox2(a_ATM1,t_3) G ztox3(a_ATM1,t_3) L ztox1(a_ATM1,t_4) L ztox2(a_ATM1,t_4) G ztox3(a_ATM1,t_4) L ztox1(a_ATM1,t_5) L ztox2(a_ATM1,t_5) G ztox3(a_ATM1,t_5) L ztox1(a_ATM1,t_6) L ztox2(a_ATM1,t_6) G ztox3(a_ATM1,t_6) L ztox1(a_ATM1,t_7) L ztox2(a_ATM1,t_7) G ztox3(a_ATM1,t_7) L ztox1(a_ATM1,t_8) L ztox2(a_ATM1,t_8) G ztox3(a_ATM1,t_8) L ztox1(a_ATM1,t_9) L ztox2(a_ATM1,t_9) G ztox3(a_ATM1,t_9) L ztox1(a_ATM1,t_10) L ztox2(a_ATM1,t_10) G ztox3(a_ATM1,t_10) E demand_def(a_ATM2,d_DATE0) L linkv(a_ATM2,d_DATE0) E demand_def(a_ATM2,d_DATE1) L linkv(a_ATM2,d_DATE1) E demand_def(a_ATM2,d_DATE2) L linkv(a_ATM2,d_DATE2) E demand_def(a_ATM2,d_DATE3) L linkv(a_ATM2,d_DATE3) E demand_def(a_ATM2,d_DATE4) L linkv(a_ATM2,d_DATE4) E demand_def(a_ATM2,d_DATE5) L linkv(a_ATM2,d_DATE5) E demand_def(a_ATM2,d_DATE6) L linkv(a_ATM2,d_DATE6) E demand_def(a_ATM2,d_DATE7) L linkv(a_ATM2,d_DATE7) E demand_def(a_ATM2,d_DATE8) L linkv(a_ATM2,d_DATE8) E demand_def(a_ATM2,d_DATE9) L linkv(a_ATM2,d_DATE9) L pickone_x1(a_ATM2) L count(a_ATM2) L ztox1(a_ATM2,t_1) L ztox2(a_ATM2,t_1) G ztox3(a_ATM2,t_1) L ztox1(a_ATM2,t_2) L ztox2(a_ATM2,t_2) G ztox3(a_ATM2,t_2) L ztox1(a_ATM2,t_3) L ztox2(a_ATM2,t_3) G ztox3(a_ATM2,t_3) L ztox1(a_ATM2,t_4) L ztox2(a_ATM2,t_4) G ztox3(a_ATM2,t_4) L ztox1(a_ATM2,t_5) L ztox2(a_ATM2,t_5) G ztox3(a_ATM2,t_5) L ztox1(a_ATM2,t_6) L ztox2(a_ATM2,t_6) G ztox3(a_ATM2,t_6) L ztox1(a_ATM2,t_7) L ztox2(a_ATM2,t_7) G ztox3(a_ATM2,t_7) L ztox1(a_ATM2,t_8) L ztox2(a_ATM2,t_8) G ztox3(a_ATM2,t_8) L ztox1(a_ATM2,t_9) L ztox2(a_ATM2,t_9) G ztox3(a_ATM2,t_9) L ztox1(a_ATM2,t_10) L ztox2(a_ATM2,t_10) G ztox3(a_ATM2,t_10) E demand_def(a_ATM3,d_DATE0) L linkv(a_ATM3,d_DATE0) E demand_def(a_ATM3,d_DATE1) L linkv(a_ATM3,d_DATE1) E demand_def(a_ATM3,d_DATE2) L linkv(a_ATM3,d_DATE2) E demand_def(a_ATM3,d_DATE3) L linkv(a_ATM3,d_DATE3) E demand_def(a_ATM3,d_DATE4) L linkv(a_ATM3,d_DATE4) E demand_def(a_ATM3,d_DATE5) L linkv(a_ATM3,d_DATE5) E demand_def(a_ATM3,d_DATE6) L linkv(a_ATM3,d_DATE6) E demand_def(a_ATM3,d_DATE7) L linkv(a_ATM3,d_DATE7) E demand_def(a_ATM3,d_DATE8) L linkv(a_ATM3,d_DATE8) E demand_def(a_ATM3,d_DATE9) L linkv(a_ATM3,d_DATE9) L pickone_x1(a_ATM3) L count(a_ATM3) L ztox1(a_ATM3,t_1) L ztox2(a_ATM3,t_1) G ztox3(a_ATM3,t_1) L ztox1(a_ATM3,t_2) L ztox2(a_ATM3,t_2) G ztox3(a_ATM3,t_2) L ztox1(a_ATM3,t_3) L ztox2(a_ATM3,t_3) G ztox3(a_ATM3,t_3) L ztox1(a_ATM3,t_4) L ztox2(a_ATM3,t_4) G ztox3(a_ATM3,t_4) L ztox1(a_ATM3,t_5) L ztox2(a_ATM3,t_5) G ztox3(a_ATM3,t_5) L ztox1(a_ATM3,t_6) L ztox2(a_ATM3,t_6) G ztox3(a_ATM3,t_6) L ztox1(a_ATM3,t_7) L ztox2(a_ATM3,t_7) G ztox3(a_ATM3,t_7) L ztox1(a_ATM3,t_8) L ztox2(a_ATM3,t_8) G ztox3(a_ATM3,t_8) L ztox1(a_ATM3,t_9) L ztox2(a_ATM3,t_9) G ztox3(a_ATM3,t_9) L ztox1(a_ATM3,t_10) L ztox2(a_ATM3,t_10) G ztox3(a_ATM3,t_10) E demand_def(a_ATM4,d_DATE0) L linkv(a_ATM4,d_DATE0) E demand_def(a_ATM4,d_DATE1) L linkv(a_ATM4,d_DATE1) E demand_def(a_ATM4,d_DATE2) L linkv(a_ATM4,d_DATE2) E demand_def(a_ATM4,d_DATE3) L linkv(a_ATM4,d_DATE3) E demand_def(a_ATM4,d_DATE4) L linkv(a_ATM4,d_DATE4) E demand_def(a_ATM4,d_DATE5) L linkv(a_ATM4,d_DATE5) E demand_def(a_ATM4,d_DATE6) L linkv(a_ATM4,d_DATE6) E demand_def(a_ATM4,d_DATE7) L linkv(a_ATM4,d_DATE7) E demand_def(a_ATM4,d_DATE8) L linkv(a_ATM4,d_DATE8) E demand_def(a_ATM4,d_DATE9) L linkv(a_ATM4,d_DATE9) L pickone_x1(a_ATM4) L count(a_ATM4) L ztox1(a_ATM4,t_1) L ztox2(a_ATM4,t_1) G ztox3(a_ATM4,t_1) L ztox1(a_ATM4,t_2) L ztox2(a_ATM4,t_2) G ztox3(a_ATM4,t_2) L ztox1(a_ATM4,t_3) L ztox2(a_ATM4,t_3) G ztox3(a_ATM4,t_3) L ztox1(a_ATM4,t_4) L ztox2(a_ATM4,t_4) G ztox3(a_ATM4,t_4) L ztox1(a_ATM4,t_5) L ztox2(a_ATM4,t_5) G ztox3(a_ATM4,t_5) L ztox1(a_ATM4,t_6) L ztox2(a_ATM4,t_6) G ztox3(a_ATM4,t_6) L ztox1(a_ATM4,t_7) L ztox2(a_ATM4,t_7) G ztox3(a_ATM4,t_7) L ztox1(a_ATM4,t_8) L ztox2(a_ATM4,t_8) G ztox3(a_ATM4,t_8) L ztox1(a_ATM4,t_9) L ztox2(a_ATM4,t_9) G ztox3(a_ATM4,t_9) L ztox1(a_ATM4,t_10) L ztox2(a_ATM4,t_10) G ztox3(a_ATM4,t_10) COLUMNS x1(0_ATM0,1) demand_def(a_ATM0,d_DATE0) -282.2 demand_def(a_ATM0,d_DATE1) -133.7 x1(0_ATM0,1) demand_def(a_ATM0,d_DATE2) -268.5 demand_def(a_ATM0,d_DATE3) 59.5 x1(0_ATM0,1) demand_def(a_ATM0,d_DATE4) -304.1 demand_def(a_ATM0,d_DATE5) -72.1 x1(0_ATM0,1) demand_def(a_ATM0,d_DATE6) -357.3 demand_def(a_ATM0,d_DATE7) -39.9 x1(0_ATM0,1) demand_def(a_ATM0,d_DATE8) -164.4 demand_def(a_ATM0,d_DATE9) 116.1 x1(0_ATM0,1) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_1) -1. x1(0_ATM0,1) ztox3(a_ATM0,t_1) -1. x1(1_ATM0,2) demand_def(a_ATM0,d_DATE0) -564.4 demand_def(a_ATM0,d_DATE1) -267.4 x1(1_ATM0,2) demand_def(a_ATM0,d_DATE2) -537. demand_def(a_ATM0,d_DATE3) 119. x1(1_ATM0,2) demand_def(a_ATM0,d_DATE4) -608.2 demand_def(a_ATM0,d_DATE5) -144.2 x1(1_ATM0,2) demand_def(a_ATM0,d_DATE6) -714.6 demand_def(a_ATM0,d_DATE7) -79.8 x1(1_ATM0,2) demand_def(a_ATM0,d_DATE8) -328.8 demand_def(a_ATM0,d_DATE9) 232.2 x1(1_ATM0,2) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_2) -1. x1(1_ATM0,2) ztox3(a_ATM0,t_2) -1. x1(2_ATM0,3) demand_def(a_ATM0,d_DATE0) -846.6 demand_def(a_ATM0,d_DATE1) -401.1 x1(2_ATM0,3) demand_def(a_ATM0,d_DATE2) -805.5 demand_def(a_ATM0,d_DATE3) 178.5 x1(2_ATM0,3) demand_def(a_ATM0,d_DATE4) -912.3 demand_def(a_ATM0,d_DATE5) -216.3 x1(2_ATM0,3) demand_def(a_ATM0,d_DATE6) -1071.9 demand_def(a_ATM0,d_DATE7) -119.7 x1(2_ATM0,3) demand_def(a_ATM0,d_DATE8) -493.2 demand_def(a_ATM0,d_DATE9) 348.3 x1(2_ATM0,3) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_3) -1. x1(2_ATM0,3) ztox3(a_ATM0,t_3) -1. x1(3_ATM0,4) demand_def(a_ATM0,d_DATE0) -1128.8 demand_def(a_ATM0,d_DATE1) -534.8 x1(3_ATM0,4) demand_def(a_ATM0,d_DATE2) -1074. demand_def(a_ATM0,d_DATE3) 238. x1(3_ATM0,4) demand_def(a_ATM0,d_DATE4) -1216.4 demand_def(a_ATM0,d_DATE5) -288.4 x1(3_ATM0,4) demand_def(a_ATM0,d_DATE6) -1429.2 demand_def(a_ATM0,d_DATE7) -159.6 x1(3_ATM0,4) demand_def(a_ATM0,d_DATE8) -657.6 demand_def(a_ATM0,d_DATE9) 464.4 x1(3_ATM0,4) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_4) -1. x1(3_ATM0,4) ztox3(a_ATM0,t_4) -1. x1(4_ATM0,5) demand_def(a_ATM0,d_DATE0) -1411. demand_def(a_ATM0,d_DATE1) -668.5 x1(4_ATM0,5) demand_def(a_ATM0,d_DATE2) -1342.5 demand_def(a_ATM0,d_DATE3) 297.5 x1(4_ATM0,5) demand_def(a_ATM0,d_DATE4) -1520.5 demand_def(a_ATM0,d_DATE5) -360.5 x1(4_ATM0,5) demand_def(a_ATM0,d_DATE6) -1786.5 demand_def(a_ATM0,d_DATE7) -199.5 x1(4_ATM0,5) demand_def(a_ATM0,d_DATE8) -822. demand_def(a_ATM0,d_DATE9) 580.5 x1(4_ATM0,5) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_5) -1. x1(4_ATM0,5) ztox3(a_ATM0,t_5) -1. x1(5_ATM0,6) demand_def(a_ATM0,d_DATE0) -1693.2 demand_def(a_ATM0,d_DATE1) -802.2 x1(5_ATM0,6) demand_def(a_ATM0,d_DATE2) -1611. demand_def(a_ATM0,d_DATE3) 357. x1(5_ATM0,6) demand_def(a_ATM0,d_DATE4) -1824.6 demand_def(a_ATM0,d_DATE5) -432.6 x1(5_ATM0,6) demand_def(a_ATM0,d_DATE6) -2143.8 demand_def(a_ATM0,d_DATE7) -239.4 x1(5_ATM0,6) demand_def(a_ATM0,d_DATE8) -986.4 demand_def(a_ATM0,d_DATE9) 696.6 x1(5_ATM0,6) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_6) -1. x1(5_ATM0,6) ztox3(a_ATM0,t_6) -1. x1(6_ATM0,7) demand_def(a_ATM0,d_DATE0) -1975.4 demand_def(a_ATM0,d_DATE1) -935.9 x1(6_ATM0,7) demand_def(a_ATM0,d_DATE2) -1879.5 demand_def(a_ATM0,d_DATE3) 416.5 x1(6_ATM0,7) demand_def(a_ATM0,d_DATE4) -2128.7 demand_def(a_ATM0,d_DATE5) -504.7 x1(6_ATM0,7) demand_def(a_ATM0,d_DATE6) -2501.1 demand_def(a_ATM0,d_DATE7) -279.3 x1(6_ATM0,7) demand_def(a_ATM0,d_DATE8) -1150.8 demand_def(a_ATM0,d_DATE9) 812.7 x1(6_ATM0,7) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_7) -1. x1(6_ATM0,7) ztox3(a_ATM0,t_7) -1. x1(7_ATM0,8) demand_def(a_ATM0,d_DATE0) -2257.6 demand_def(a_ATM0,d_DATE1) -1069.6 x1(7_ATM0,8) demand_def(a_ATM0,d_DATE2) -2148. demand_def(a_ATM0,d_DATE3) 476. x1(7_ATM0,8) demand_def(a_ATM0,d_DATE4) -2432.8 demand_def(a_ATM0,d_DATE5) -576.8 x1(7_ATM0,8) demand_def(a_ATM0,d_DATE6) -2858.4 demand_def(a_ATM0,d_DATE7) -319.2 x1(7_ATM0,8) demand_def(a_ATM0,d_DATE8) -1315.2 demand_def(a_ATM0,d_DATE9) 928.8 x1(7_ATM0,8) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_8) -1. x1(7_ATM0,8) ztox3(a_ATM0,t_8) -1. x1(8_ATM0,9) demand_def(a_ATM0,d_DATE0) -2539.8 demand_def(a_ATM0,d_DATE1) -1203.3 x1(8_ATM0,9) demand_def(a_ATM0,d_DATE2) -2416.5 demand_def(a_ATM0,d_DATE3) 535.5 x1(8_ATM0,9) demand_def(a_ATM0,d_DATE4) -2736.9 demand_def(a_ATM0,d_DATE5) -648.9 x1(8_ATM0,9) demand_def(a_ATM0,d_DATE6) -3215.7 demand_def(a_ATM0,d_DATE7) -359.1 x1(8_ATM0,9) demand_def(a_ATM0,d_DATE8) -1479.6 demand_def(a_ATM0,d_DATE9) 1044.9 x1(8_ATM0,9) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_9) -1. x1(8_ATM0,9) ztox3(a_ATM0,t_9) -1. x1(9_ATM0,10) demand_def(a_ATM0,d_DATE0) -2822. demand_def(a_ATM0,d_DATE1) -1337. x1(9_ATM0,10) demand_def(a_ATM0,d_DATE2) -2685. demand_def(a_ATM0,d_DATE3) 595. x1(9_ATM0,10) demand_def(a_ATM0,d_DATE4) -3041. demand_def(a_ATM0,d_DATE5) -721. x1(9_ATM0,10) demand_def(a_ATM0,d_DATE6) -3573. demand_def(a_ATM0,d_DATE7) -399. x1(9_ATM0,10) demand_def(a_ATM0,d_DATE8) -1644. demand_def(a_ATM0,d_DATE9) 1161. x1(9_ATM0,10) pickone_x1(a_ATM0) 1. ztox1(a_ATM0,t_10) -1. x1(9_ATM0,10) ztox3(a_ATM0,t_10) -1. x1(10_ATM1,1) demand_def(a_ATM1,d_DATE0) 167.1 demand_def(a_ATM1,d_DATE1) -293.3 x1(10_ATM1,1) demand_def(a_ATM1,d_DATE2) 285. demand_def(a_ATM1,d_DATE3) 247. x1(10_ATM1,1) demand_def(a_ATM1,d_DATE4) 124.8 demand_def(a_ATM1,d_DATE5) -203.1 x1(10_ATM1,1) demand_def(a_ATM1,d_DATE6) -500.2 demand_def(a_ATM1,d_DATE7) -632.8 x1(10_ATM1,1) demand_def(a_ATM1,d_DATE8) -144.3 demand_def(a_ATM1,d_DATE9) 156.1 x1(10_ATM1,1) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_1) -1. x1(10_ATM1,1) ztox3(a_ATM1,t_1) -1. x1(11_ATM1,2) demand_def(a_ATM1,d_DATE0) 334.2 demand_def(a_ATM1,d_DATE1) -586.6 x1(11_ATM1,2) demand_def(a_ATM1,d_DATE2) 570. demand_def(a_ATM1,d_DATE3) 494. x1(11_ATM1,2) demand_def(a_ATM1,d_DATE4) 249.6 demand_def(a_ATM1,d_DATE5) -406.2 x1(11_ATM1,2) demand_def(a_ATM1,d_DATE6) -1000.4 demand_def(a_ATM1,d_DATE7) -1265.6 x1(11_ATM1,2) demand_def(a_ATM1,d_DATE8) -288.6 demand_def(a_ATM1,d_DATE9) 312.2 x1(11_ATM1,2) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_2) -1. x1(11_ATM1,2) ztox3(a_ATM1,t_2) -1. x1(12_ATM1,3) demand_def(a_ATM1,d_DATE0) 501.3 demand_def(a_ATM1,d_DATE1) -879.9 x1(12_ATM1,3) demand_def(a_ATM1,d_DATE2) 855. demand_def(a_ATM1,d_DATE3) 741. x1(12_ATM1,3) demand_def(a_ATM1,d_DATE4) 374.4 demand_def(a_ATM1,d_DATE5) -609.3 x1(12_ATM1,3) demand_def(a_ATM1,d_DATE6) -1500.6 demand_def(a_ATM1,d_DATE7) -1898.4 x1(12_ATM1,3) demand_def(a_ATM1,d_DATE8) -432.9 demand_def(a_ATM1,d_DATE9) 468.3 x1(12_ATM1,3) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_3) -1. x1(12_ATM1,3) ztox3(a_ATM1,t_3) -1. x1(13_ATM1,4) demand_def(a_ATM1,d_DATE0) 668.4 demand_def(a_ATM1,d_DATE1) -1173.2 x1(13_ATM1,4) demand_def(a_ATM1,d_DATE2) 1140. demand_def(a_ATM1,d_DATE3) 988. x1(13_ATM1,4) demand_def(a_ATM1,d_DATE4) 499.2 demand_def(a_ATM1,d_DATE5) -812.4 x1(13_ATM1,4) demand_def(a_ATM1,d_DATE6) -2000.8 demand_def(a_ATM1,d_DATE7) -2531.2 x1(13_ATM1,4) demand_def(a_ATM1,d_DATE8) -577.2 demand_def(a_ATM1,d_DATE9) 624.4 x1(13_ATM1,4) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_4) -1. x1(13_ATM1,4) ztox3(a_ATM1,t_4) -1. x1(14_ATM1,5) demand_def(a_ATM1,d_DATE0) 835.5 demand_def(a_ATM1,d_DATE1) -1466.5 x1(14_ATM1,5) demand_def(a_ATM1,d_DATE2) 1425. demand_def(a_ATM1,d_DATE3) 1235. x1(14_ATM1,5) demand_def(a_ATM1,d_DATE4) 624. demand_def(a_ATM1,d_DATE5) -1015.5 x1(14_ATM1,5) demand_def(a_ATM1,d_DATE6) -2501. demand_def(a_ATM1,d_DATE7) -3164. x1(14_ATM1,5) demand_def(a_ATM1,d_DATE8) -721.5 demand_def(a_ATM1,d_DATE9) 780.5 x1(14_ATM1,5) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_5) -1. x1(14_ATM1,5) ztox3(a_ATM1,t_5) -1. x1(15_ATM1,6) demand_def(a_ATM1,d_DATE0) 1002.6 demand_def(a_ATM1,d_DATE1) -1759.8 x1(15_ATM1,6) demand_def(a_ATM1,d_DATE2) 1710. demand_def(a_ATM1,d_DATE3) 1482. x1(15_ATM1,6) demand_def(a_ATM1,d_DATE4) 748.8 demand_def(a_ATM1,d_DATE5) -1218.6 x1(15_ATM1,6) demand_def(a_ATM1,d_DATE6) -3001.2 demand_def(a_ATM1,d_DATE7) -3796.8 x1(15_ATM1,6) demand_def(a_ATM1,d_DATE8) -865.8 demand_def(a_ATM1,d_DATE9) 936.6 x1(15_ATM1,6) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_6) -1. x1(15_ATM1,6) ztox3(a_ATM1,t_6) -1. x1(16_ATM1,7) demand_def(a_ATM1,d_DATE0) 1169.7 demand_def(a_ATM1,d_DATE1) -2053.1 x1(16_ATM1,7) demand_def(a_ATM1,d_DATE2) 1995. demand_def(a_ATM1,d_DATE3) 1729. x1(16_ATM1,7) demand_def(a_ATM1,d_DATE4) 873.6 demand_def(a_ATM1,d_DATE5) -1421.7 x1(16_ATM1,7) demand_def(a_ATM1,d_DATE6) -3501.4 demand_def(a_ATM1,d_DATE7) -4429.6 x1(16_ATM1,7) demand_def(a_ATM1,d_DATE8) -1010.1 demand_def(a_ATM1,d_DATE9) 1092.7 x1(16_ATM1,7) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_7) -1. x1(16_ATM1,7) ztox3(a_ATM1,t_7) -1. x1(17_ATM1,8) demand_def(a_ATM1,d_DATE0) 1336.8 demand_def(a_ATM1,d_DATE1) -2346.4 x1(17_ATM1,8) demand_def(a_ATM1,d_DATE2) 2280. demand_def(a_ATM1,d_DATE3) 1976. x1(17_ATM1,8) demand_def(a_ATM1,d_DATE4) 998.4 demand_def(a_ATM1,d_DATE5) -1624.8 x1(17_ATM1,8) demand_def(a_ATM1,d_DATE6) -4001.6 demand_def(a_ATM1,d_DATE7) -5062.4 x1(17_ATM1,8) demand_def(a_ATM1,d_DATE8) -1154.4 demand_def(a_ATM1,d_DATE9) 1248.8 x1(17_ATM1,8) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_8) -1. x1(17_ATM1,8) ztox3(a_ATM1,t_8) -1. x1(18_ATM1,9) demand_def(a_ATM1,d_DATE0) 1503.9 demand_def(a_ATM1,d_DATE1) -2639.7 x1(18_ATM1,9) demand_def(a_ATM1,d_DATE2) 2565. demand_def(a_ATM1,d_DATE3) 2223. x1(18_ATM1,9) demand_def(a_ATM1,d_DATE4) 1123.2 demand_def(a_ATM1,d_DATE5) -1827.9 x1(18_ATM1,9) demand_def(a_ATM1,d_DATE6) -4501.8 demand_def(a_ATM1,d_DATE7) -5695.2 x1(18_ATM1,9) demand_def(a_ATM1,d_DATE8) -1298.7 demand_def(a_ATM1,d_DATE9) 1404.9 x1(18_ATM1,9) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_9) -1. x1(18_ATM1,9) ztox3(a_ATM1,t_9) -1. x1(19_ATM1,10) demand_def(a_ATM1,d_DATE0) 1671. demand_def(a_ATM1,d_DATE1) -2933. x1(19_ATM1,10) demand_def(a_ATM1,d_DATE2) 2850. demand_def(a_ATM1,d_DATE3) 2470. x1(19_ATM1,10) demand_def(a_ATM1,d_DATE4) 1248. demand_def(a_ATM1,d_DATE5) -2031. x1(19_ATM1,10) demand_def(a_ATM1,d_DATE6) -5002. demand_def(a_ATM1,d_DATE7) -6328. x1(19_ATM1,10) demand_def(a_ATM1,d_DATE8) -1443. demand_def(a_ATM1,d_DATE9) 1561. x1(19_ATM1,10) pickone_x1(a_ATM1) 1. ztox1(a_ATM1,t_10) -1. x1(19_ATM1,10) ztox3(a_ATM1,t_10) -1. x1(20_ATM2,1) demand_def(a_ATM2,d_DATE0) -58.9 demand_def(a_ATM2,d_DATE1) 106.8 x1(20_ATM2,1) demand_def(a_ATM2,d_DATE2) 18.5 demand_def(a_ATM2,d_DATE3) -41.3 x1(20_ATM2,1) demand_def(a_ATM2,d_DATE4) -117.4 demand_def(a_ATM2,d_DATE5) -156.4 x1(20_ATM2,1) demand_def(a_ATM2,d_DATE6) -22.5 demand_def(a_ATM2,d_DATE7) 134. x1(20_ATM2,1) demand_def(a_ATM2,d_DATE8) -209.7 demand_def(a_ATM2,d_DATE9) -99.6 x1(20_ATM2,1) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_1) -1. x1(20_ATM2,1) ztox3(a_ATM2,t_1) -1. x1(21_ATM2,2) demand_def(a_ATM2,d_DATE0) -117.8 demand_def(a_ATM2,d_DATE1) 213.6 x1(21_ATM2,2) demand_def(a_ATM2,d_DATE2) 37. demand_def(a_ATM2,d_DATE3) -82.6 x1(21_ATM2,2) demand_def(a_ATM2,d_DATE4) -234.8 demand_def(a_ATM2,d_DATE5) -312.8 x1(21_ATM2,2) demand_def(a_ATM2,d_DATE6) -45. demand_def(a_ATM2,d_DATE7) 268. x1(21_ATM2,2) demand_def(a_ATM2,d_DATE8) -419.4 demand_def(a_ATM2,d_DATE9) -199.2 x1(21_ATM2,2) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_2) -1. x1(21_ATM2,2) ztox3(a_ATM2,t_2) -1. x1(22_ATM2,3) demand_def(a_ATM2,d_DATE0) -176.7 demand_def(a_ATM2,d_DATE1) 320.4 x1(22_ATM2,3) demand_def(a_ATM2,d_DATE2) 55.5 demand_def(a_ATM2,d_DATE3) -123.9 x1(22_ATM2,3) demand_def(a_ATM2,d_DATE4) -352.2 demand_def(a_ATM2,d_DATE5) -469.2 x1(22_ATM2,3) demand_def(a_ATM2,d_DATE6) -67.5 demand_def(a_ATM2,d_DATE7) 402. x1(22_ATM2,3) demand_def(a_ATM2,d_DATE8) -629.1 demand_def(a_ATM2,d_DATE9) -298.8 x1(22_ATM2,3) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_3) -1. x1(22_ATM2,3) ztox3(a_ATM2,t_3) -1. x1(23_ATM2,4) demand_def(a_ATM2,d_DATE0) -235.6 demand_def(a_ATM2,d_DATE1) 427.2 x1(23_ATM2,4) demand_def(a_ATM2,d_DATE2) 74. demand_def(a_ATM2,d_DATE3) -165.2 x1(23_ATM2,4) demand_def(a_ATM2,d_DATE4) -469.6 demand_def(a_ATM2,d_DATE5) -625.6 x1(23_ATM2,4) demand_def(a_ATM2,d_DATE6) -90. demand_def(a_ATM2,d_DATE7) 536. x1(23_ATM2,4) demand_def(a_ATM2,d_DATE8) -838.8 demand_def(a_ATM2,d_DATE9) -398.4 x1(23_ATM2,4) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_4) -1. x1(23_ATM2,4) ztox3(a_ATM2,t_4) -1. x1(24_ATM2,5) demand_def(a_ATM2,d_DATE0) -294.5 demand_def(a_ATM2,d_DATE1) 534. x1(24_ATM2,5) demand_def(a_ATM2,d_DATE2) 92.5 demand_def(a_ATM2,d_DATE3) -206.5 x1(24_ATM2,5) demand_def(a_ATM2,d_DATE4) -587. demand_def(a_ATM2,d_DATE5) -782. x1(24_ATM2,5) demand_def(a_ATM2,d_DATE6) -112.5 demand_def(a_ATM2,d_DATE7) 670. x1(24_ATM2,5) demand_def(a_ATM2,d_DATE8) -1048.5 demand_def(a_ATM2,d_DATE9) -498. x1(24_ATM2,5) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_5) -1. x1(24_ATM2,5) ztox3(a_ATM2,t_5) -1. x1(25_ATM2,6) demand_def(a_ATM2,d_DATE0) -353.4 demand_def(a_ATM2,d_DATE1) 640.8 x1(25_ATM2,6) demand_def(a_ATM2,d_DATE2) 111. demand_def(a_ATM2,d_DATE3) -247.8 x1(25_ATM2,6) demand_def(a_ATM2,d_DATE4) -704.4 demand_def(a_ATM2,d_DATE5) -938.4 x1(25_ATM2,6) demand_def(a_ATM2,d_DATE6) -135. demand_def(a_ATM2,d_DATE7) 804. x1(25_ATM2,6) demand_def(a_ATM2,d_DATE8) -1258.2 demand_def(a_ATM2,d_DATE9) -597.6 x1(25_ATM2,6) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_6) -1. x1(25_ATM2,6) ztox3(a_ATM2,t_6) -1. x1(26_ATM2,7) demand_def(a_ATM2,d_DATE0) -412.3 demand_def(a_ATM2,d_DATE1) 747.6 x1(26_ATM2,7) demand_def(a_ATM2,d_DATE2) 129.5 demand_def(a_ATM2,d_DATE3) -289.1 x1(26_ATM2,7) demand_def(a_ATM2,d_DATE4) -821.8 demand_def(a_ATM2,d_DATE5) -1094.8 x1(26_ATM2,7) demand_def(a_ATM2,d_DATE6) -157.5 demand_def(a_ATM2,d_DATE7) 938. x1(26_ATM2,7) demand_def(a_ATM2,d_DATE8) -1467.9 demand_def(a_ATM2,d_DATE9) -697.2 x1(26_ATM2,7) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_7) -1. x1(26_ATM2,7) ztox3(a_ATM2,t_7) -1. x1(27_ATM2,8) demand_def(a_ATM2,d_DATE0) -471.2 demand_def(a_ATM2,d_DATE1) 854.4 x1(27_ATM2,8) demand_def(a_ATM2,d_DATE2) 148. demand_def(a_ATM2,d_DATE3) -330.4 x1(27_ATM2,8) demand_def(a_ATM2,d_DATE4) -939.2 demand_def(a_ATM2,d_DATE5) -1251.2 x1(27_ATM2,8) demand_def(a_ATM2,d_DATE6) -180. demand_def(a_ATM2,d_DATE7) 1072. x1(27_ATM2,8) demand_def(a_ATM2,d_DATE8) -1677.6 demand_def(a_ATM2,d_DATE9) -796.8 x1(27_ATM2,8) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_8) -1. x1(27_ATM2,8) ztox3(a_ATM2,t_8) -1. x1(28_ATM2,9) demand_def(a_ATM2,d_DATE0) -530.1 demand_def(a_ATM2,d_DATE1) 961.2 x1(28_ATM2,9) demand_def(a_ATM2,d_DATE2) 166.5 demand_def(a_ATM2,d_DATE3) -371.7 x1(28_ATM2,9) demand_def(a_ATM2,d_DATE4) -1056.6 demand_def(a_ATM2,d_DATE5) -1407.6 x1(28_ATM2,9) demand_def(a_ATM2,d_DATE6) -202.5 demand_def(a_ATM2,d_DATE7) 1206. x1(28_ATM2,9) demand_def(a_ATM2,d_DATE8) -1887.3 demand_def(a_ATM2,d_DATE9) -896.4 x1(28_ATM2,9) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_9) -1. x1(28_ATM2,9) ztox3(a_ATM2,t_9) -1. x1(29_ATM2,10) demand_def(a_ATM2,d_DATE0) -589. demand_def(a_ATM2,d_DATE1) 1068. x1(29_ATM2,10) demand_def(a_ATM2,d_DATE2) 185. demand_def(a_ATM2,d_DATE3) -413. x1(29_ATM2,10) demand_def(a_ATM2,d_DATE4) -1174. demand_def(a_ATM2,d_DATE5) -1564. x1(29_ATM2,10) demand_def(a_ATM2,d_DATE6) -225. demand_def(a_ATM2,d_DATE7) 1340. x1(29_ATM2,10) demand_def(a_ATM2,d_DATE8) -2097. demand_def(a_ATM2,d_DATE9) -996. x1(29_ATM2,10) pickone_x1(a_ATM2) 1. ztox1(a_ATM2,t_10) -1. x1(29_ATM2,10) ztox3(a_ATM2,t_10) -1. x1(30_ATM3,1) demand_def(a_ATM3,d_DATE0) 48.2 demand_def(a_ATM3,d_DATE1) -403.6 x1(30_ATM3,1) demand_def(a_ATM3,d_DATE2) 116.8 demand_def(a_ATM3,d_DATE3) 95.5 x1(30_ATM3,1) demand_def(a_ATM3,d_DATE4) 112.3 demand_def(a_ATM3,d_DATE5) -62.1 x1(30_ATM3,1) demand_def(a_ATM3,d_DATE6) 95.9 demand_def(a_ATM3,d_DATE7) -503.2 x1(30_ATM3,1) demand_def(a_ATM3,d_DATE8) 35. demand_def(a_ATM3,d_DATE9) 357.9 x1(30_ATM3,1) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_1) -1. x1(30_ATM3,1) ztox3(a_ATM3,t_1) -1. x1(31_ATM3,2) demand_def(a_ATM3,d_DATE0) 96.4 demand_def(a_ATM3,d_DATE1) -807.2 x1(31_ATM3,2) demand_def(a_ATM3,d_DATE2) 233.6 demand_def(a_ATM3,d_DATE3) 191. x1(31_ATM3,2) demand_def(a_ATM3,d_DATE4) 224.6 demand_def(a_ATM3,d_DATE5) -124.2 x1(31_ATM3,2) demand_def(a_ATM3,d_DATE6) 191.8 demand_def(a_ATM3,d_DATE7) -1006.4 x1(31_ATM3,2) demand_def(a_ATM3,d_DATE8) 70. demand_def(a_ATM3,d_DATE9) 715.8 x1(31_ATM3,2) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_2) -1. x1(31_ATM3,2) ztox3(a_ATM3,t_2) -1. x1(32_ATM3,3) demand_def(a_ATM3,d_DATE0) 144.6 demand_def(a_ATM3,d_DATE1) -1210.8 x1(32_ATM3,3) demand_def(a_ATM3,d_DATE2) 350.4 demand_def(a_ATM3,d_DATE3) 286.5 x1(32_ATM3,3) demand_def(a_ATM3,d_DATE4) 336.9 demand_def(a_ATM3,d_DATE5) -186.3 x1(32_ATM3,3) demand_def(a_ATM3,d_DATE6) 287.7 demand_def(a_ATM3,d_DATE7) -1509.6 x1(32_ATM3,3) demand_def(a_ATM3,d_DATE8) 105. demand_def(a_ATM3,d_DATE9) 1073.7 x1(32_ATM3,3) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_3) -1. x1(32_ATM3,3) ztox3(a_ATM3,t_3) -1. x1(33_ATM3,4) demand_def(a_ATM3,d_DATE0) 192.8 demand_def(a_ATM3,d_DATE1) -1614.4 x1(33_ATM3,4) demand_def(a_ATM3,d_DATE2) 467.2 demand_def(a_ATM3,d_DATE3) 382. x1(33_ATM3,4) demand_def(a_ATM3,d_DATE4) 449.2 demand_def(a_ATM3,d_DATE5) -248.4 x1(33_ATM3,4) demand_def(a_ATM3,d_DATE6) 383.6 demand_def(a_ATM3,d_DATE7) -2012.8 x1(33_ATM3,4) demand_def(a_ATM3,d_DATE8) 140. demand_def(a_ATM3,d_DATE9) 1431.6 x1(33_ATM3,4) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_4) -1. x1(33_ATM3,4) ztox3(a_ATM3,t_4) -1. x1(34_ATM3,5) demand_def(a_ATM3,d_DATE0) 241. demand_def(a_ATM3,d_DATE1) -2018. x1(34_ATM3,5) demand_def(a_ATM3,d_DATE2) 584. demand_def(a_ATM3,d_DATE3) 477.5 x1(34_ATM3,5) demand_def(a_ATM3,d_DATE4) 561.5 demand_def(a_ATM3,d_DATE5) -310.5 x1(34_ATM3,5) demand_def(a_ATM3,d_DATE6) 479.5 demand_def(a_ATM3,d_DATE7) -2516. x1(34_ATM3,5) demand_def(a_ATM3,d_DATE8) 175. demand_def(a_ATM3,d_DATE9) 1789.5 x1(34_ATM3,5) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_5) -1. x1(34_ATM3,5) ztox3(a_ATM3,t_5) -1. x1(35_ATM3,6) demand_def(a_ATM3,d_DATE0) 289.2 demand_def(a_ATM3,d_DATE1) -2421.6 x1(35_ATM3,6) demand_def(a_ATM3,d_DATE2) 700.8 demand_def(a_ATM3,d_DATE3) 573. x1(35_ATM3,6) demand_def(a_ATM3,d_DATE4) 673.8 demand_def(a_ATM3,d_DATE5) -372.6 x1(35_ATM3,6) demand_def(a_ATM3,d_DATE6) 575.4 demand_def(a_ATM3,d_DATE7) -3019.2 x1(35_ATM3,6) demand_def(a_ATM3,d_DATE8) 210. demand_def(a_ATM3,d_DATE9) 2147.4 x1(35_ATM3,6) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_6) -1. x1(35_ATM3,6) ztox3(a_ATM3,t_6) -1. x1(36_ATM3,7) demand_def(a_ATM3,d_DATE0) 337.4 demand_def(a_ATM3,d_DATE1) -2825.2 x1(36_ATM3,7) demand_def(a_ATM3,d_DATE2) 817.6 demand_def(a_ATM3,d_DATE3) 668.5 x1(36_ATM3,7) demand_def(a_ATM3,d_DATE4) 786.1 demand_def(a_ATM3,d_DATE5) -434.7 x1(36_ATM3,7) demand_def(a_ATM3,d_DATE6) 671.3 demand_def(a_ATM3,d_DATE7) -3522.4 x1(36_ATM3,7) demand_def(a_ATM3,d_DATE8) 245. demand_def(a_ATM3,d_DATE9) 2505.3 x1(36_ATM3,7) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_7) -1. x1(36_ATM3,7) ztox3(a_ATM3,t_7) -1. x1(37_ATM3,8) demand_def(a_ATM3,d_DATE0) 385.6 demand_def(a_ATM3,d_DATE1) -3228.8 x1(37_ATM3,8) demand_def(a_ATM3,d_DATE2) 934.4 demand_def(a_ATM3,d_DATE3) 764. x1(37_ATM3,8) demand_def(a_ATM3,d_DATE4) 898.4 demand_def(a_ATM3,d_DATE5) -496.8 x1(37_ATM3,8) demand_def(a_ATM3,d_DATE6) 767.2 demand_def(a_ATM3,d_DATE7) -4025.6 x1(37_ATM3,8) demand_def(a_ATM3,d_DATE8) 280. demand_def(a_ATM3,d_DATE9) 2863.2 x1(37_ATM3,8) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_8) -1. x1(37_ATM3,8) ztox3(a_ATM3,t_8) -1. x1(38_ATM3,9) demand_def(a_ATM3,d_DATE0) 433.8 demand_def(a_ATM3,d_DATE1) -3632.4 x1(38_ATM3,9) demand_def(a_ATM3,d_DATE2) 1051.2 demand_def(a_ATM3,d_DATE3) 859.5 x1(38_ATM3,9) demand_def(a_ATM3,d_DATE4) 1010.7 demand_def(a_ATM3,d_DATE5) -558.9 x1(38_ATM3,9) demand_def(a_ATM3,d_DATE6) 863.1 demand_def(a_ATM3,d_DATE7) -4528.8 x1(38_ATM3,9) demand_def(a_ATM3,d_DATE8) 315. demand_def(a_ATM3,d_DATE9) 3221.1 x1(38_ATM3,9) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_9) -1. x1(38_ATM3,9) ztox3(a_ATM3,t_9) -1. x1(39_ATM3,10) demand_def(a_ATM3,d_DATE0) 482. demand_def(a_ATM3,d_DATE1) -4036. x1(39_ATM3,10) demand_def(a_ATM3,d_DATE2) 1168. demand_def(a_ATM3,d_DATE3) 955. x1(39_ATM3,10) demand_def(a_ATM3,d_DATE4) 1123. demand_def(a_ATM3,d_DATE5) -621. x1(39_ATM3,10) demand_def(a_ATM3,d_DATE6) 959. demand_def(a_ATM3,d_DATE7) -5032. x1(39_ATM3,10) demand_def(a_ATM3,d_DATE8) 350. demand_def(a_ATM3,d_DATE9) 3579. x1(39_ATM3,10) pickone_x1(a_ATM3) 1. ztox1(a_ATM3,t_10) -1. x1(39_ATM3,10) ztox3(a_ATM3,t_10) -1. x1(40_ATM4,1) demand_def(a_ATM4,d_DATE0) -233.4 demand_def(a_ATM4,d_DATE1) -149.2 x1(40_ATM4,1) demand_def(a_ATM4,d_DATE2) 335.2 demand_def(a_ATM4,d_DATE3) -94.2 x1(40_ATM4,1) demand_def(a_ATM4,d_DATE4) 135.3 demand_def(a_ATM4,d_DATE5) 16.7 x1(40_ATM4,1) demand_def(a_ATM4,d_DATE6) -90. demand_def(a_ATM4,d_DATE7) -237.8 x1(40_ATM4,1) demand_def(a_ATM4,d_DATE8) -316.7 demand_def(a_ATM4,d_DATE9) 232.4 x1(40_ATM4,1) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_1) -1. x1(40_ATM4,1) ztox3(a_ATM4,t_1) -1. x1(41_ATM4,2) demand_def(a_ATM4,d_DATE0) -466.8 demand_def(a_ATM4,d_DATE1) -298.4 x1(41_ATM4,2) demand_def(a_ATM4,d_DATE2) 670.4 demand_def(a_ATM4,d_DATE3) -188.4 x1(41_ATM4,2) demand_def(a_ATM4,d_DATE4) 270.6 demand_def(a_ATM4,d_DATE5) 33.4 x1(41_ATM4,2) demand_def(a_ATM4,d_DATE6) -180. demand_def(a_ATM4,d_DATE7) -475.6 x1(41_ATM4,2) demand_def(a_ATM4,d_DATE8) -633.4 demand_def(a_ATM4,d_DATE9) 464.8 x1(41_ATM4,2) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_2) -1. x1(41_ATM4,2) ztox3(a_ATM4,t_2) -1. x1(42_ATM4,3) demand_def(a_ATM4,d_DATE0) -700.2 demand_def(a_ATM4,d_DATE1) -447.6 x1(42_ATM4,3) demand_def(a_ATM4,d_DATE2) 1005.6 demand_def(a_ATM4,d_DATE3) -282.6 x1(42_ATM4,3) demand_def(a_ATM4,d_DATE4) 405.9 demand_def(a_ATM4,d_DATE5) 50.1 x1(42_ATM4,3) demand_def(a_ATM4,d_DATE6) -270. demand_def(a_ATM4,d_DATE7) -713.4 x1(42_ATM4,3) demand_def(a_ATM4,d_DATE8) -950.1 demand_def(a_ATM4,d_DATE9) 697.2 x1(42_ATM4,3) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_3) -1. x1(42_ATM4,3) ztox3(a_ATM4,t_3) -1. x1(43_ATM4,4) demand_def(a_ATM4,d_DATE0) -933.6 demand_def(a_ATM4,d_DATE1) -596.8 x1(43_ATM4,4) demand_def(a_ATM4,d_DATE2) 1340.8 demand_def(a_ATM4,d_DATE3) -376.8 x1(43_ATM4,4) demand_def(a_ATM4,d_DATE4) 541.2 demand_def(a_ATM4,d_DATE5) 66.8 x1(43_ATM4,4) demand_def(a_ATM4,d_DATE6) -360. demand_def(a_ATM4,d_DATE7) -951.2 x1(43_ATM4,4) demand_def(a_ATM4,d_DATE8) -1266.8 demand_def(a_ATM4,d_DATE9) 929.6 x1(43_ATM4,4) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_4) -1. x1(43_ATM4,4) ztox3(a_ATM4,t_4) -1. x1(44_ATM4,5) demand_def(a_ATM4,d_DATE0) -1167. demand_def(a_ATM4,d_DATE1) -746. x1(44_ATM4,5) demand_def(a_ATM4,d_DATE2) 1676. demand_def(a_ATM4,d_DATE3) -471. x1(44_ATM4,5) demand_def(a_ATM4,d_DATE4) 676.5 demand_def(a_ATM4,d_DATE5) 83.5 x1(44_ATM4,5) demand_def(a_ATM4,d_DATE6) -450. demand_def(a_ATM4,d_DATE7) -1189. x1(44_ATM4,5) demand_def(a_ATM4,d_DATE8) -1583.5 demand_def(a_ATM4,d_DATE9) 1162. x1(44_ATM4,5) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_5) -1. x1(44_ATM4,5) ztox3(a_ATM4,t_5) -1. x1(45_ATM4,6) demand_def(a_ATM4,d_DATE0) -1400.4 demand_def(a_ATM4,d_DATE1) -895.2 x1(45_ATM4,6) demand_def(a_ATM4,d_DATE2) 2011.2 demand_def(a_ATM4,d_DATE3) -565.2 x1(45_ATM4,6) demand_def(a_ATM4,d_DATE4) 811.8 demand_def(a_ATM4,d_DATE5) 100.2 x1(45_ATM4,6) demand_def(a_ATM4,d_DATE6) -540. demand_def(a_ATM4,d_DATE7) -1426.8 x1(45_ATM4,6) demand_def(a_ATM4,d_DATE8) -1900.2 demand_def(a_ATM4,d_DATE9) 1394.4 x1(45_ATM4,6) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_6) -1. x1(45_ATM4,6) ztox3(a_ATM4,t_6) -1. x1(46_ATM4,7) demand_def(a_ATM4,d_DATE0) -1633.8 demand_def(a_ATM4,d_DATE1) -1044.4 x1(46_ATM4,7) demand_def(a_ATM4,d_DATE2) 2346.4 demand_def(a_ATM4,d_DATE3) -659.4 x1(46_ATM4,7) demand_def(a_ATM4,d_DATE4) 947.1 demand_def(a_ATM4,d_DATE5) 116.9 x1(46_ATM4,7) demand_def(a_ATM4,d_DATE6) -630. demand_def(a_ATM4,d_DATE7) -1664.6 x1(46_ATM4,7) demand_def(a_ATM4,d_DATE8) -2216.9 demand_def(a_ATM4,d_DATE9) 1626.8 x1(46_ATM4,7) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_7) -1. x1(46_ATM4,7) ztox3(a_ATM4,t_7) -1. x1(47_ATM4,8) demand_def(a_ATM4,d_DATE0) -1867.2 demand_def(a_ATM4,d_DATE1) -1193.6 x1(47_ATM4,8) demand_def(a_ATM4,d_DATE2) 2681.6 demand_def(a_ATM4,d_DATE3) -753.6 x1(47_ATM4,8) demand_def(a_ATM4,d_DATE4) 1082.4 demand_def(a_ATM4,d_DATE5) 133.6 x1(47_ATM4,8) demand_def(a_ATM4,d_DATE6) -720. demand_def(a_ATM4,d_DATE7) -1902.4 x1(47_ATM4,8) demand_def(a_ATM4,d_DATE8) -2533.6 demand_def(a_ATM4,d_DATE9) 1859.2 x1(47_ATM4,8) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_8) -1. x1(47_ATM4,8) ztox3(a_ATM4,t_8) -1. x1(48_ATM4,9) demand_def(a_ATM4,d_DATE0) -2100.6 demand_def(a_ATM4,d_DATE1) -1342.8 x1(48_ATM4,9) demand_def(a_ATM4,d_DATE2) 3016.8 demand_def(a_ATM4,d_DATE3) -847.8 x1(48_ATM4,9) demand_def(a_ATM4,d_DATE4) 1217.7 demand_def(a_ATM4,d_DATE5) 150.3 x1(48_ATM4,9) demand_def(a_ATM4,d_DATE6) -810. demand_def(a_ATM4,d_DATE7) -2140.2 x1(48_ATM4,9) demand_def(a_ATM4,d_DATE8) -2850.3 demand_def(a_ATM4,d_DATE9) 2091.6 x1(48_ATM4,9) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_9) -1. x1(48_ATM4,9) ztox3(a_ATM4,t_9) -1. x1(49_ATM4,10) demand_def(a_ATM4,d_DATE0) -2334. demand_def(a_ATM4,d_DATE1) -1492. x1(49_ATM4,10) demand_def(a_ATM4,d_DATE2) 3352. demand_def(a_ATM4,d_DATE3) -942. x1(49_ATM4,10) demand_def(a_ATM4,d_DATE4) 1353. demand_def(a_ATM4,d_DATE5) 167. x1(49_ATM4,10) demand_def(a_ATM4,d_DATE6) -900. demand_def(a_ATM4,d_DATE7) -2378. x1(49_ATM4,10) demand_def(a_ATM4,d_DATE8) -3167. demand_def(a_ATM4,d_DATE9) 2324. x1(49_ATM4,10) pickone_x1(a_ATM4) 1. ztox1(a_ATM4,t_10) -1. x1(49_ATM4,10) ztox3(a_ATM4,t_10) -1. z(50_ATM0,1) demand_def(a_ATM0,d_DATE0) 198.4 demand_def(a_ATM0,d_DATE1) 253. z(50_ATM0,1) demand_def(a_ATM0,d_DATE2) -6.7 demand_def(a_ATM0,d_DATE3) -313.5 z(50_ATM0,1) demand_def(a_ATM0,d_DATE4) -95.1 demand_def(a_ATM0,d_DATE5) 47.9 z(50_ATM0,1) demand_def(a_ATM0,d_DATE6) 318.6 demand_def(a_ATM0,d_DATE7) 34.1 z(50_ATM0,1) demand_def(a_ATM0,d_DATE8) -64.3 demand_def(a_ATM0,d_DATE9) -93.1 z(50_ATM0,1) ztox1(a_ATM0,t_1) 1. ztox2(a_ATM0,t_1) 1. z(50_ATM0,1) ztox3(a_ATM0,t_1) 1. z(51_ATM0,2) demand_def(a_ATM0,d_DATE0) 396.8 demand_def(a_ATM0,d_DATE1) 506. z(51_ATM0,2) demand_def(a_ATM0,d_DATE2) -13.4 demand_def(a_ATM0,d_DATE3) -627. z(51_ATM0,2) demand_def(a_ATM0,d_DATE4) -190.2 demand_def(a_ATM0,d_DATE5) 95.8 z(51_ATM0,2) demand_def(a_ATM0,d_DATE6) 637.2 demand_def(a_ATM0,d_DATE7) 68.2 z(51_ATM0,2) demand_def(a_ATM0,d_DATE8) -128.6 demand_def(a_ATM0,d_DATE9) -186.2 z(51_ATM0,2) ztox1(a_ATM0,t_2) 1. ztox2(a_ATM0,t_2) 1. z(51_ATM0,2) ztox3(a_ATM0,t_2) 1. z(52_ATM0,3) demand_def(a_ATM0,d_DATE0) 595.2 demand_def(a_ATM0,d_DATE1) 759. z(52_ATM0,3) demand_def(a_ATM0,d_DATE2) -20.1 demand_def(a_ATM0,d_DATE3) -940.5 z(52_ATM0,3) demand_def(a_ATM0,d_DATE4) -285.3 demand_def(a_ATM0,d_DATE5) 143.7 z(52_ATM0,3) demand_def(a_ATM0,d_DATE6) 955.8 demand_def(a_ATM0,d_DATE7) 102.3 z(52_ATM0,3) demand_def(a_ATM0,d_DATE8) -192.9 demand_def(a_ATM0,d_DATE9) -279.3 z(52_ATM0,3) ztox1(a_ATM0,t_3) 1. ztox2(a_ATM0,t_3) 1. z(52_ATM0,3) ztox3(a_ATM0,t_3) 1. z(53_ATM0,4) demand_def(a_ATM0,d_DATE0) 793.6 demand_def(a_ATM0,d_DATE1) 1012. z(53_ATM0,4) demand_def(a_ATM0,d_DATE2) -26.8 demand_def(a_ATM0,d_DATE3) -1254. z(53_ATM0,4) demand_def(a_ATM0,d_DATE4) -380.4 demand_def(a_ATM0,d_DATE5) 191.6 z(53_ATM0,4) demand_def(a_ATM0,d_DATE6) 1274.4 demand_def(a_ATM0,d_DATE7) 136.4 z(53_ATM0,4) demand_def(a_ATM0,d_DATE8) -257.2 demand_def(a_ATM0,d_DATE9) -372.4 z(53_ATM0,4) ztox1(a_ATM0,t_4) 1. ztox2(a_ATM0,t_4) 1. z(53_ATM0,4) ztox3(a_ATM0,t_4) 1. z(54_ATM0,5) demand_def(a_ATM0,d_DATE0) 992. demand_def(a_ATM0,d_DATE1) 1265. z(54_ATM0,5) demand_def(a_ATM0,d_DATE2) -33.5 demand_def(a_ATM0,d_DATE3) -1567.5 z(54_ATM0,5) demand_def(a_ATM0,d_DATE4) -475.5 demand_def(a_ATM0,d_DATE5) 239.5 z(54_ATM0,5) demand_def(a_ATM0,d_DATE6) 1593. demand_def(a_ATM0,d_DATE7) 170.5 z(54_ATM0,5) demand_def(a_ATM0,d_DATE8) -321.5 demand_def(a_ATM0,d_DATE9) -465.5 z(54_ATM0,5) ztox1(a_ATM0,t_5) 1. ztox2(a_ATM0,t_5) 1. z(54_ATM0,5) ztox3(a_ATM0,t_5) 1. z(55_ATM0,6) demand_def(a_ATM0,d_DATE0) 1190.4 demand_def(a_ATM0,d_DATE1) 1518. z(55_ATM0,6) demand_def(a_ATM0,d_DATE2) -40.2 demand_def(a_ATM0,d_DATE3) -1881. z(55_ATM0,6) demand_def(a_ATM0,d_DATE4) -570.6 demand_def(a_ATM0,d_DATE5) 287.4 z(55_ATM0,6) demand_def(a_ATM0,d_DATE6) 1911.6 demand_def(a_ATM0,d_DATE7) 204.6 z(55_ATM0,6) demand_def(a_ATM0,d_DATE8) -385.8 demand_def(a_ATM0,d_DATE9) -558.6 z(55_ATM0,6) ztox1(a_ATM0,t_6) 1. ztox2(a_ATM0,t_6) 1. z(55_ATM0,6) ztox3(a_ATM0,t_6) 1. z(56_ATM0,7) demand_def(a_ATM0,d_DATE0) 1388.8 demand_def(a_ATM0,d_DATE1) 1771. z(56_ATM0,7) demand_def(a_ATM0,d_DATE2) -46.9 demand_def(a_ATM0,d_DATE3) -2194.5 z(56_ATM0,7) demand_def(a_ATM0,d_DATE4) -665.7 demand_def(a_ATM0,d_DATE5) 335.3 z(56_ATM0,7) demand_def(a_ATM0,d_DATE6) 2230.2 demand_def(a_ATM0,d_DATE7) 238.7 z(56_ATM0,7) demand_def(a_ATM0,d_DATE8) -450.1 demand_def(a_ATM0,d_DATE9) -651.7 z(56_ATM0,7) ztox1(a_ATM0,t_7) 1. ztox2(a_ATM0,t_7) 1. z(56_ATM0,7) ztox3(a_ATM0,t_7) 1. z(57_ATM0,8) demand_def(a_ATM0,d_DATE0) 1587.2 demand_def(a_ATM0,d_DATE1) 2024. z(57_ATM0,8) demand_def(a_ATM0,d_DATE2) -53.6 demand_def(a_ATM0,d_DATE3) -2508. z(57_ATM0,8) demand_def(a_ATM0,d_DATE4) -760.8 demand_def(a_ATM0,d_DATE5) 383.2 z(57_ATM0,8) demand_def(a_ATM0,d_DATE6) 2548.8 demand_def(a_ATM0,d_DATE7) 272.8 z(57_ATM0,8) demand_def(a_ATM0,d_DATE8) -514.4 demand_def(a_ATM0,d_DATE9) -744.8 z(57_ATM0,8) ztox1(a_ATM0,t_8) 1. ztox2(a_ATM0,t_8) 1. z(57_ATM0,8) ztox3(a_ATM0,t_8) 1. z(58_ATM0,9) demand_def(a_ATM0,d_DATE0) 1785.6 demand_def(a_ATM0,d_DATE1) 2277. z(58_ATM0,9) demand_def(a_ATM0,d_DATE2) -60.3 demand_def(a_ATM0,d_DATE3) -2821.5 z(58_ATM0,9) demand_def(a_ATM0,d_DATE4) -855.9 demand_def(a_ATM0,d_DATE5) 431.1 z(58_ATM0,9) demand_def(a_ATM0,d_DATE6) 2867.4 demand_def(a_ATM0,d_DATE7) 306.9 z(58_ATM0,9) demand_def(a_ATM0,d_DATE8) -578.7 demand_def(a_ATM0,d_DATE9) -837.9 z(58_ATM0,9) ztox1(a_ATM0,t_9) 1. ztox2(a_ATM0,t_9) 1. z(58_ATM0,9) ztox3(a_ATM0,t_9) 1. z(59_ATM0,10) demand_def(a_ATM0,d_DATE0) 1984. demand_def(a_ATM0,d_DATE1) 2530. z(59_ATM0,10) demand_def(a_ATM0,d_DATE2) -67. demand_def(a_ATM0,d_DATE3) -3135. z(59_ATM0,10) demand_def(a_ATM0,d_DATE4) -951. demand_def(a_ATM0,d_DATE5) 479. z(59_ATM0,10) demand_def(a_ATM0,d_DATE6) 3186. demand_def(a_ATM0,d_DATE7) 341. z(59_ATM0,10) demand_def(a_ATM0,d_DATE8) -643. demand_def(a_ATM0,d_DATE9) -931. z(59_ATM0,10) ztox1(a_ATM0,t_10) 1. ztox2(a_ATM0,t_10) 1. z(59_ATM0,10) ztox3(a_ATM0,t_10) 1. z(60_ATM1,1) demand_def(a_ATM1,d_DATE0) 60.1 demand_def(a_ATM1,d_DATE1) 61.8 z(60_ATM1,1) demand_def(a_ATM1,d_DATE2) -61. demand_def(a_ATM1,d_DATE3) -197.7 z(60_ATM1,1) demand_def(a_ATM1,d_DATE4) 156.6 demand_def(a_ATM1,d_DATE5) -148. z(60_ATM1,1) demand_def(a_ATM1,d_DATE6) 67.9 demand_def(a_ATM1,d_DATE7) 137.5 z(60_ATM1,1) demand_def(a_ATM1,d_DATE8) 53.4 demand_def(a_ATM1,d_DATE9) 15.7 z(60_ATM1,1) ztox1(a_ATM1,t_1) 1. ztox2(a_ATM1,t_1) 1. z(60_ATM1,1) ztox3(a_ATM1,t_1) 1. z(61_ATM1,2) demand_def(a_ATM1,d_DATE0) 120.2 demand_def(a_ATM1,d_DATE1) 123.6 z(61_ATM1,2) demand_def(a_ATM1,d_DATE2) -122. demand_def(a_ATM1,d_DATE3) -395.4 z(61_ATM1,2) demand_def(a_ATM1,d_DATE4) 313.2 demand_def(a_ATM1,d_DATE5) -296. z(61_ATM1,2) demand_def(a_ATM1,d_DATE6) 135.8 demand_def(a_ATM1,d_DATE7) 275. z(61_ATM1,2) demand_def(a_ATM1,d_DATE8) 106.8 demand_def(a_ATM1,d_DATE9) 31.4 z(61_ATM1,2) ztox1(a_ATM1,t_2) 1. ztox2(a_ATM1,t_2) 1. z(61_ATM1,2) ztox3(a_ATM1,t_2) 1. z(62_ATM1,3) demand_def(a_ATM1,d_DATE0) 180.3 demand_def(a_ATM1,d_DATE1) 185.4 z(62_ATM1,3) demand_def(a_ATM1,d_DATE2) -183. demand_def(a_ATM1,d_DATE3) -593.1 z(62_ATM1,3) demand_def(a_ATM1,d_DATE4) 469.8 demand_def(a_ATM1,d_DATE5) -444. z(62_ATM1,3) demand_def(a_ATM1,d_DATE6) 203.7 demand_def(a_ATM1,d_DATE7) 412.5 z(62_ATM1,3) demand_def(a_ATM1,d_DATE8) 160.2 demand_def(a_ATM1,d_DATE9) 47.1 z(62_ATM1,3) ztox1(a_ATM1,t_3) 1. ztox2(a_ATM1,t_3) 1. z(62_ATM1,3) ztox3(a_ATM1,t_3) 1. z(63_ATM1,4) demand_def(a_ATM1,d_DATE0) 240.4 demand_def(a_ATM1,d_DATE1) 247.2 z(63_ATM1,4) demand_def(a_ATM1,d_DATE2) -244. demand_def(a_ATM1,d_DATE3) -790.8 z(63_ATM1,4) demand_def(a_ATM1,d_DATE4) 626.4 demand_def(a_ATM1,d_DATE5) -592. z(63_ATM1,4) demand_def(a_ATM1,d_DATE6) 271.6 demand_def(a_ATM1,d_DATE7) 550. z(63_ATM1,4) demand_def(a_ATM1,d_DATE8) 213.6 demand_def(a_ATM1,d_DATE9) 62.8 z(63_ATM1,4) ztox1(a_ATM1,t_4) 1. ztox2(a_ATM1,t_4) 1. z(63_ATM1,4) ztox3(a_ATM1,t_4) 1. z(64_ATM1,5) demand_def(a_ATM1,d_DATE0) 300.5 demand_def(a_ATM1,d_DATE1) 309. z(64_ATM1,5) demand_def(a_ATM1,d_DATE2) -305. demand_def(a_ATM1,d_DATE3) -988.5 z(64_ATM1,5) demand_def(a_ATM1,d_DATE4) 783. demand_def(a_ATM1,d_DATE5) -740. z(64_ATM1,5) demand_def(a_ATM1,d_DATE6) 339.5 demand_def(a_ATM1,d_DATE7) 687.5 z(64_ATM1,5) demand_def(a_ATM1,d_DATE8) 267. demand_def(a_ATM1,d_DATE9) 78.5 z(64_ATM1,5) ztox1(a_ATM1,t_5) 1. ztox2(a_ATM1,t_5) 1. z(64_ATM1,5) ztox3(a_ATM1,t_5) 1. z(65_ATM1,6) demand_def(a_ATM1,d_DATE0) 360.6 demand_def(a_ATM1,d_DATE1) 370.8 z(65_ATM1,6) demand_def(a_ATM1,d_DATE2) -366. demand_def(a_ATM1,d_DATE3) -1186.2 z(65_ATM1,6) demand_def(a_ATM1,d_DATE4) 939.6 demand_def(a_ATM1,d_DATE5) -888. z(65_ATM1,6) demand_def(a_ATM1,d_DATE6) 407.4 demand_def(a_ATM1,d_DATE7) 825. z(65_ATM1,6) demand_def(a_ATM1,d_DATE8) 320.4 demand_def(a_ATM1,d_DATE9) 94.2 z(65_ATM1,6) ztox1(a_ATM1,t_6) 1. ztox2(a_ATM1,t_6) 1. z(65_ATM1,6) ztox3(a_ATM1,t_6) 1. z(66_ATM1,7) demand_def(a_ATM1,d_DATE0) 420.7 demand_def(a_ATM1,d_DATE1) 432.6 z(66_ATM1,7) demand_def(a_ATM1,d_DATE2) -427. demand_def(a_ATM1,d_DATE3) -1383.9 z(66_ATM1,7) demand_def(a_ATM1,d_DATE4) 1096.2 demand_def(a_ATM1,d_DATE5) -1036. z(66_ATM1,7) demand_def(a_ATM1,d_DATE6) 475.3 demand_def(a_ATM1,d_DATE7) 962.5 z(66_ATM1,7) demand_def(a_ATM1,d_DATE8) 373.8 demand_def(a_ATM1,d_DATE9) 109.9 z(66_ATM1,7) ztox1(a_ATM1,t_7) 1. ztox2(a_ATM1,t_7) 1. z(66_ATM1,7) ztox3(a_ATM1,t_7) 1. z(67_ATM1,8) demand_def(a_ATM1,d_DATE0) 480.8 demand_def(a_ATM1,d_DATE1) 494.4 z(67_ATM1,8) demand_def(a_ATM1,d_DATE2) -488. demand_def(a_ATM1,d_DATE3) -1581.6 z(67_ATM1,8) demand_def(a_ATM1,d_DATE4) 1252.8 demand_def(a_ATM1,d_DATE5) -1184. z(67_ATM1,8) demand_def(a_ATM1,d_DATE6) 543.2 demand_def(a_ATM1,d_DATE7) 1100. z(67_ATM1,8) demand_def(a_ATM1,d_DATE8) 427.2 demand_def(a_ATM1,d_DATE9) 125.6 z(67_ATM1,8) ztox1(a_ATM1,t_8) 1. ztox2(a_ATM1,t_8) 1. z(67_ATM1,8) ztox3(a_ATM1,t_8) 1. z(68_ATM1,9) demand_def(a_ATM1,d_DATE0) 540.9 demand_def(a_ATM1,d_DATE1) 556.2 z(68_ATM1,9) demand_def(a_ATM1,d_DATE2) -549. demand_def(a_ATM1,d_DATE3) -1779.3 z(68_ATM1,9) demand_def(a_ATM1,d_DATE4) 1409.4 demand_def(a_ATM1,d_DATE5) -1332. z(68_ATM1,9) demand_def(a_ATM1,d_DATE6) 611.1 demand_def(a_ATM1,d_DATE7) 1237.5 z(68_ATM1,9) demand_def(a_ATM1,d_DATE8) 480.6 demand_def(a_ATM1,d_DATE9) 141.3 z(68_ATM1,9) ztox1(a_ATM1,t_9) 1. ztox2(a_ATM1,t_9) 1. z(68_ATM1,9) ztox3(a_ATM1,t_9) 1. z(69_ATM1,10) demand_def(a_ATM1,d_DATE0) 601. demand_def(a_ATM1,d_DATE1) 618. z(69_ATM1,10) demand_def(a_ATM1,d_DATE2) -610. demand_def(a_ATM1,d_DATE3) -1977. z(69_ATM1,10) demand_def(a_ATM1,d_DATE4) 1566. demand_def(a_ATM1,d_DATE5) -1480. z(69_ATM1,10) demand_def(a_ATM1,d_DATE6) 679. demand_def(a_ATM1,d_DATE7) 1375. z(69_ATM1,10) demand_def(a_ATM1,d_DATE8) 534. demand_def(a_ATM1,d_DATE9) 157. z(69_ATM1,10) ztox1(a_ATM1,t_10) 1. ztox2(a_ATM1,t_10) 1. z(69_ATM1,10) ztox3(a_ATM1,t_10) 1. z(70_ATM2,1) demand_def(a_ATM2,d_DATE0) -69.1 demand_def(a_ATM2,d_DATE1) -200.1 z(70_ATM2,1) demand_def(a_ATM2,d_DATE2) 262.6 demand_def(a_ATM2,d_DATE3) 364.9 z(70_ATM2,1) demand_def(a_ATM2,d_DATE4) -95.1 demand_def(a_ATM2,d_DATE5) -137.6 z(70_ATM2,1) demand_def(a_ATM2,d_DATE6) 206.7 demand_def(a_ATM2,d_DATE7) 104.6 z(70_ATM2,1) demand_def(a_ATM2,d_DATE8) -57.4 demand_def(a_ATM2,d_DATE9) -137.7 z(70_ATM2,1) ztox1(a_ATM2,t_1) 1. ztox2(a_ATM2,t_1) 1. z(70_ATM2,1) ztox3(a_ATM2,t_1) 1. z(71_ATM2,2) demand_def(a_ATM2,d_DATE0) -138.2 demand_def(a_ATM2,d_DATE1) -400.2 z(71_ATM2,2) demand_def(a_ATM2,d_DATE2) 525.2 demand_def(a_ATM2,d_DATE3) 729.8 z(71_ATM2,2) demand_def(a_ATM2,d_DATE4) -190.2 demand_def(a_ATM2,d_DATE5) -275.2 z(71_ATM2,2) demand_def(a_ATM2,d_DATE6) 413.4 demand_def(a_ATM2,d_DATE7) 209.2 z(71_ATM2,2) demand_def(a_ATM2,d_DATE8) -114.8 demand_def(a_ATM2,d_DATE9) -275.4 z(71_ATM2,2) ztox1(a_ATM2,t_2) 1. ztox2(a_ATM2,t_2) 1. z(71_ATM2,2) ztox3(a_ATM2,t_2) 1. z(72_ATM2,3) demand_def(a_ATM2,d_DATE0) -207.3 demand_def(a_ATM2,d_DATE1) -600.3 z(72_ATM2,3) demand_def(a_ATM2,d_DATE2) 787.8 demand_def(a_ATM2,d_DATE3) 1094.7 z(72_ATM2,3) demand_def(a_ATM2,d_DATE4) -285.3 demand_def(a_ATM2,d_DATE5) -412.8 z(72_ATM2,3) demand_def(a_ATM2,d_DATE6) 620.1 demand_def(a_ATM2,d_DATE7) 313.8 z(72_ATM2,3) demand_def(a_ATM2,d_DATE8) -172.2 demand_def(a_ATM2,d_DATE9) -413.1 z(72_ATM2,3) ztox1(a_ATM2,t_3) 1. ztox2(a_ATM2,t_3) 1. z(72_ATM2,3) ztox3(a_ATM2,t_3) 1. z(73_ATM2,4) demand_def(a_ATM2,d_DATE0) -276.4 demand_def(a_ATM2,d_DATE1) -800.4 z(73_ATM2,4) demand_def(a_ATM2,d_DATE2) 1050.4 demand_def(a_ATM2,d_DATE3) 1459.6 z(73_ATM2,4) demand_def(a_ATM2,d_DATE4) -380.4 demand_def(a_ATM2,d_DATE5) -550.4 z(73_ATM2,4) demand_def(a_ATM2,d_DATE6) 826.8 demand_def(a_ATM2,d_DATE7) 418.4 z(73_ATM2,4) demand_def(a_ATM2,d_DATE8) -229.6 demand_def(a_ATM2,d_DATE9) -550.8 z(73_ATM2,4) ztox1(a_ATM2,t_4) 1. ztox2(a_ATM2,t_4) 1. z(73_ATM2,4) ztox3(a_ATM2,t_4) 1. z(74_ATM2,5) demand_def(a_ATM2,d_DATE0) -345.5 demand_def(a_ATM2,d_DATE1) -1000.5 z(74_ATM2,5) demand_def(a_ATM2,d_DATE2) 1313. demand_def(a_ATM2,d_DATE3) 1824.5 z(74_ATM2,5) demand_def(a_ATM2,d_DATE4) -475.5 demand_def(a_ATM2,d_DATE5) -688. z(74_ATM2,5) demand_def(a_ATM2,d_DATE6) 1033.5 demand_def(a_ATM2,d_DATE7) 523. z(74_ATM2,5) demand_def(a_ATM2,d_DATE8) -287. demand_def(a_ATM2,d_DATE9) -688.5 z(74_ATM2,5) ztox1(a_ATM2,t_5) 1. ztox2(a_ATM2,t_5) 1. z(74_ATM2,5) ztox3(a_ATM2,t_5) 1. z(75_ATM2,6) demand_def(a_ATM2,d_DATE0) -414.6 demand_def(a_ATM2,d_DATE1) -1200.6 z(75_ATM2,6) demand_def(a_ATM2,d_DATE2) 1575.6 demand_def(a_ATM2,d_DATE3) 2189.4 z(75_ATM2,6) demand_def(a_ATM2,d_DATE4) -570.6 demand_def(a_ATM2,d_DATE5) -825.6 z(75_ATM2,6) demand_def(a_ATM2,d_DATE6) 1240.2 demand_def(a_ATM2,d_DATE7) 627.6 z(75_ATM2,6) demand_def(a_ATM2,d_DATE8) -344.4 demand_def(a_ATM2,d_DATE9) -826.2 z(75_ATM2,6) ztox1(a_ATM2,t_6) 1. ztox2(a_ATM2,t_6) 1. z(75_ATM2,6) ztox3(a_ATM2,t_6) 1. z(76_ATM2,7) demand_def(a_ATM2,d_DATE0) -483.7 demand_def(a_ATM2,d_DATE1) -1400.7 z(76_ATM2,7) demand_def(a_ATM2,d_DATE2) 1838.2 demand_def(a_ATM2,d_DATE3) 2554.3 z(76_ATM2,7) demand_def(a_ATM2,d_DATE4) -665.7 demand_def(a_ATM2,d_DATE5) -963.2 z(76_ATM2,7) demand_def(a_ATM2,d_DATE6) 1446.9 demand_def(a_ATM2,d_DATE7) 732.2 z(76_ATM2,7) demand_def(a_ATM2,d_DATE8) -401.8 demand_def(a_ATM2,d_DATE9) -963.9 z(76_ATM2,7) ztox1(a_ATM2,t_7) 1. ztox2(a_ATM2,t_7) 1. z(76_ATM2,7) ztox3(a_ATM2,t_7) 1. z(77_ATM2,8) demand_def(a_ATM2,d_DATE0) -552.8 demand_def(a_ATM2,d_DATE1) -1600.8 z(77_ATM2,8) demand_def(a_ATM2,d_DATE2) 2100.8 demand_def(a_ATM2,d_DATE3) 2919.2 z(77_ATM2,8) demand_def(a_ATM2,d_DATE4) -760.8 demand_def(a_ATM2,d_DATE5) -1100.8 z(77_ATM2,8) demand_def(a_ATM2,d_DATE6) 1653.6 demand_def(a_ATM2,d_DATE7) 836.8 z(77_ATM2,8) demand_def(a_ATM2,d_DATE8) -459.2 demand_def(a_ATM2,d_DATE9) -1101.6 z(77_ATM2,8) ztox1(a_ATM2,t_8) 1. ztox2(a_ATM2,t_8) 1. z(77_ATM2,8) ztox3(a_ATM2,t_8) 1. z(78_ATM2,9) demand_def(a_ATM2,d_DATE0) -621.9 demand_def(a_ATM2,d_DATE1) -1800.9 z(78_ATM2,9) demand_def(a_ATM2,d_DATE2) 2363.4 demand_def(a_ATM2,d_DATE3) 3284.1 z(78_ATM2,9) demand_def(a_ATM2,d_DATE4) -855.9 demand_def(a_ATM2,d_DATE5) -1238.4 z(78_ATM2,9) demand_def(a_ATM2,d_DATE6) 1860.3 demand_def(a_ATM2,d_DATE7) 941.4 z(78_ATM2,9) demand_def(a_ATM2,d_DATE8) -516.6 demand_def(a_ATM2,d_DATE9) -1239.3 z(78_ATM2,9) ztox1(a_ATM2,t_9) 1. ztox2(a_ATM2,t_9) 1. z(78_ATM2,9) ztox3(a_ATM2,t_9) 1. z(79_ATM2,10) demand_def(a_ATM2,d_DATE0) -691. demand_def(a_ATM2,d_DATE1) -2001. z(79_ATM2,10) demand_def(a_ATM2,d_DATE2) 2626. demand_def(a_ATM2,d_DATE3) 3649. z(79_ATM2,10) demand_def(a_ATM2,d_DATE4) -951. demand_def(a_ATM2,d_DATE5) -1376. z(79_ATM2,10) demand_def(a_ATM2,d_DATE6) 2067. demand_def(a_ATM2,d_DATE7) 1046. z(79_ATM2,10) demand_def(a_ATM2,d_DATE8) -574. demand_def(a_ATM2,d_DATE9) -1377. z(79_ATM2,10) ztox1(a_ATM2,t_10) 1. ztox2(a_ATM2,t_10) 1. z(79_ATM2,10) ztox3(a_ATM2,t_10) 1. z(80_ATM3,1) demand_def(a_ATM3,d_DATE0) 294.3 demand_def(a_ATM3,d_DATE1) 9.3 z(80_ATM3,1) demand_def(a_ATM3,d_DATE2) -45.1 demand_def(a_ATM3,d_DATE3) -128.2 z(80_ATM3,1) demand_def(a_ATM3,d_DATE4) 125.1 demand_def(a_ATM3,d_DATE5) -114.1 z(80_ATM3,1) demand_def(a_ATM3,d_DATE6) -321.4 demand_def(a_ATM3,d_DATE7) -97.6 z(80_ATM3,1) demand_def(a_ATM3,d_DATE8) -48. demand_def(a_ATM3,d_DATE9) -236.9 z(80_ATM3,1) ztox1(a_ATM3,t_1) 1. ztox2(a_ATM3,t_1) 1. z(80_ATM3,1) ztox3(a_ATM3,t_1) 1. z(81_ATM3,2) demand_def(a_ATM3,d_DATE0) 588.6 demand_def(a_ATM3,d_DATE1) 18.6 z(81_ATM3,2) demand_def(a_ATM3,d_DATE2) -90.2 demand_def(a_ATM3,d_DATE3) -256.4 z(81_ATM3,2) demand_def(a_ATM3,d_DATE4) 250.2 demand_def(a_ATM3,d_DATE5) -228.2 z(81_ATM3,2) demand_def(a_ATM3,d_DATE6) -642.8 demand_def(a_ATM3,d_DATE7) -195.2 z(81_ATM3,2) demand_def(a_ATM3,d_DATE8) -96. demand_def(a_ATM3,d_DATE9) -473.8 z(81_ATM3,2) ztox1(a_ATM3,t_2) 1. ztox2(a_ATM3,t_2) 1. z(81_ATM3,2) ztox3(a_ATM3,t_2) 1. z(82_ATM3,3) demand_def(a_ATM3,d_DATE0) 882.9 demand_def(a_ATM3,d_DATE1) 27.9 z(82_ATM3,3) demand_def(a_ATM3,d_DATE2) -135.3 demand_def(a_ATM3,d_DATE3) -384.6 z(82_ATM3,3) demand_def(a_ATM3,d_DATE4) 375.3 demand_def(a_ATM3,d_DATE5) -342.3 z(82_ATM3,3) demand_def(a_ATM3,d_DATE6) -964.2 demand_def(a_ATM3,d_DATE7) -292.8 z(82_ATM3,3) demand_def(a_ATM3,d_DATE8) -144. demand_def(a_ATM3,d_DATE9) -710.7 z(82_ATM3,3) ztox1(a_ATM3,t_3) 1. ztox2(a_ATM3,t_3) 1. z(82_ATM3,3) ztox3(a_ATM3,t_3) 1. z(83_ATM3,4) demand_def(a_ATM3,d_DATE0) 1177.2 demand_def(a_ATM3,d_DATE1) 37.2 z(83_ATM3,4) demand_def(a_ATM3,d_DATE2) -180.4 demand_def(a_ATM3,d_DATE3) -512.8 z(83_ATM3,4) demand_def(a_ATM3,d_DATE4) 500.4 demand_def(a_ATM3,d_DATE5) -456.4 z(83_ATM3,4) demand_def(a_ATM3,d_DATE6) -1285.6 demand_def(a_ATM3,d_DATE7) -390.4 z(83_ATM3,4) demand_def(a_ATM3,d_DATE8) -192. demand_def(a_ATM3,d_DATE9) -947.6 z(83_ATM3,4) ztox1(a_ATM3,t_4) 1. ztox2(a_ATM3,t_4) 1. z(83_ATM3,4) ztox3(a_ATM3,t_4) 1. z(84_ATM3,5) demand_def(a_ATM3,d_DATE0) 1471.5 demand_def(a_ATM3,d_DATE1) 46.5 z(84_ATM3,5) demand_def(a_ATM3,d_DATE2) -225.5 demand_def(a_ATM3,d_DATE3) -641. z(84_ATM3,5) demand_def(a_ATM3,d_DATE4) 625.5 demand_def(a_ATM3,d_DATE5) -570.5 z(84_ATM3,5) demand_def(a_ATM3,d_DATE6) -1607. demand_def(a_ATM3,d_DATE7) -488. z(84_ATM3,5) demand_def(a_ATM3,d_DATE8) -240. demand_def(a_ATM3,d_DATE9) -1184.5 z(84_ATM3,5) ztox1(a_ATM3,t_5) 1. ztox2(a_ATM3,t_5) 1. z(84_ATM3,5) ztox3(a_ATM3,t_5) 1. z(85_ATM3,6) demand_def(a_ATM3,d_DATE0) 1765.8 demand_def(a_ATM3,d_DATE1) 55.8 z(85_ATM3,6) demand_def(a_ATM3,d_DATE2) -270.6 demand_def(a_ATM3,d_DATE3) -769.2 z(85_ATM3,6) demand_def(a_ATM3,d_DATE4) 750.6 demand_def(a_ATM3,d_DATE5) -684.6 z(85_ATM3,6) demand_def(a_ATM3,d_DATE6) -1928.4 demand_def(a_ATM3,d_DATE7) -585.6 z(85_ATM3,6) demand_def(a_ATM3,d_DATE8) -288. demand_def(a_ATM3,d_DATE9) -1421.4 z(85_ATM3,6) ztox1(a_ATM3,t_6) 1. ztox2(a_ATM3,t_6) 1. z(85_ATM3,6) ztox3(a_ATM3,t_6) 1. z(86_ATM3,7) demand_def(a_ATM3,d_DATE0) 2060.1 demand_def(a_ATM3,d_DATE1) 65.1 z(86_ATM3,7) demand_def(a_ATM3,d_DATE2) -315.7 demand_def(a_ATM3,d_DATE3) -897.4 z(86_ATM3,7) demand_def(a_ATM3,d_DATE4) 875.7 demand_def(a_ATM3,d_DATE5) -798.7 z(86_ATM3,7) demand_def(a_ATM3,d_DATE6) -2249.8 demand_def(a_ATM3,d_DATE7) -683.2 z(86_ATM3,7) demand_def(a_ATM3,d_DATE8) -336. demand_def(a_ATM3,d_DATE9) -1658.3 z(86_ATM3,7) ztox1(a_ATM3,t_7) 1. ztox2(a_ATM3,t_7) 1. z(86_ATM3,7) ztox3(a_ATM3,t_7) 1. z(87_ATM3,8) demand_def(a_ATM3,d_DATE0) 2354.4 demand_def(a_ATM3,d_DATE1) 74.4 z(87_ATM3,8) demand_def(a_ATM3,d_DATE2) -360.8 demand_def(a_ATM3,d_DATE3) -1025.6 z(87_ATM3,8) demand_def(a_ATM3,d_DATE4) 1000.8 demand_def(a_ATM3,d_DATE5) -912.8 z(87_ATM3,8) demand_def(a_ATM3,d_DATE6) -2571.2 demand_def(a_ATM3,d_DATE7) -780.8 z(87_ATM3,8) demand_def(a_ATM3,d_DATE8) -384. demand_def(a_ATM3,d_DATE9) -1895.2 z(87_ATM3,8) ztox1(a_ATM3,t_8) 1. ztox2(a_ATM3,t_8) 1. z(87_ATM3,8) ztox3(a_ATM3,t_8) 1. z(88_ATM3,9) demand_def(a_ATM3,d_DATE0) 2648.7 demand_def(a_ATM3,d_DATE1) 83.7 z(88_ATM3,9) demand_def(a_ATM3,d_DATE2) -405.9 demand_def(a_ATM3,d_DATE3) -1153.8 z(88_ATM3,9) demand_def(a_ATM3,d_DATE4) 1125.9 demand_def(a_ATM3,d_DATE5) -1026.9 z(88_ATM3,9) demand_def(a_ATM3,d_DATE6) -2892.6 demand_def(a_ATM3,d_DATE7) -878.4 z(88_ATM3,9) demand_def(a_ATM3,d_DATE8) -432. demand_def(a_ATM3,d_DATE9) -2132.1 z(88_ATM3,9) ztox1(a_ATM3,t_9) 1. ztox2(a_ATM3,t_9) 1. z(88_ATM3,9) ztox3(a_ATM3,t_9) 1. z(89_ATM3,10) demand_def(a_ATM3,d_DATE0) 2943. demand_def(a_ATM3,d_DATE1) 93. z(89_ATM3,10) demand_def(a_ATM3,d_DATE2) -451. demand_def(a_ATM3,d_DATE3) -1282. z(89_ATM3,10) demand_def(a_ATM3,d_DATE4) 1251. demand_def(a_ATM3,d_DATE5) -1141. z(89_ATM3,10) demand_def(a_ATM3,d_DATE6) -3214. demand_def(a_ATM3,d_DATE7) -976. z(89_ATM3,10) demand_def(a_ATM3,d_DATE8) -480. demand_def(a_ATM3,d_DATE9) -2369. z(89_ATM3,10) ztox1(a_ATM3,t_10) 1. ztox2(a_ATM3,t_10) 1. z(89_ATM3,10) ztox3(a_ATM3,t_10) 1. z(90_ATM4,1) demand_def(a_ATM4,d_DATE0) 15.1 demand_def(a_ATM4,d_DATE1) 81.1 z(90_ATM4,1) demand_def(a_ATM4,d_DATE2) -331. demand_def(a_ATM4,d_DATE3) -104.3 z(90_ATM4,1) demand_def(a_ATM4,d_DATE4) -178.9 demand_def(a_ATM4,d_DATE5) -34.6 z(90_ATM4,1) demand_def(a_ATM4,d_DATE6) -13.6 demand_def(a_ATM4,d_DATE7) -184.9 z(90_ATM4,1) demand_def(a_ATM4,d_DATE8) -44.3 demand_def(a_ATM4,d_DATE9) -95.1 z(90_ATM4,1) ztox1(a_ATM4,t_1) 1. ztox2(a_ATM4,t_1) 1. z(90_ATM4,1) ztox3(a_ATM4,t_1) 1. z(91_ATM4,2) demand_def(a_ATM4,d_DATE0) 30.2 demand_def(a_ATM4,d_DATE1) 162.2 z(91_ATM4,2) demand_def(a_ATM4,d_DATE2) -662. demand_def(a_ATM4,d_DATE3) -208.6 z(91_ATM4,2) demand_def(a_ATM4,d_DATE4) -357.8 demand_def(a_ATM4,d_DATE5) -69.2 z(91_ATM4,2) demand_def(a_ATM4,d_DATE6) -27.2 demand_def(a_ATM4,d_DATE7) -369.8 z(91_ATM4,2) demand_def(a_ATM4,d_DATE8) -88.6 demand_def(a_ATM4,d_DATE9) -190.2 z(91_ATM4,2) ztox1(a_ATM4,t_2) 1. ztox2(a_ATM4,t_2) 1. z(91_ATM4,2) ztox3(a_ATM4,t_2) 1. z(92_ATM4,3) demand_def(a_ATM4,d_DATE0) 45.3 demand_def(a_ATM4,d_DATE1) 243.3 z(92_ATM4,3) demand_def(a_ATM4,d_DATE2) -993. demand_def(a_ATM4,d_DATE3) -312.9 z(92_ATM4,3) demand_def(a_ATM4,d_DATE4) -536.7 demand_def(a_ATM4,d_DATE5) -103.8 z(92_ATM4,3) demand_def(a_ATM4,d_DATE6) -40.8 demand_def(a_ATM4,d_DATE7) -554.7 z(92_ATM4,3) demand_def(a_ATM4,d_DATE8) -132.9 demand_def(a_ATM4,d_DATE9) -285.3 z(92_ATM4,3) ztox1(a_ATM4,t_3) 1. ztox2(a_ATM4,t_3) 1. z(92_ATM4,3) ztox3(a_ATM4,t_3) 1. z(93_ATM4,4) demand_def(a_ATM4,d_DATE0) 60.4 demand_def(a_ATM4,d_DATE1) 324.4 z(93_ATM4,4) demand_def(a_ATM4,d_DATE2) -1324. demand_def(a_ATM4,d_DATE3) -417.2 z(93_ATM4,4) demand_def(a_ATM4,d_DATE4) -715.6 demand_def(a_ATM4,d_DATE5) -138.4 z(93_ATM4,4) demand_def(a_ATM4,d_DATE6) -54.4 demand_def(a_ATM4,d_DATE7) -739.6 z(93_ATM4,4) demand_def(a_ATM4,d_DATE8) -177.2 demand_def(a_ATM4,d_DATE9) -380.4 z(93_ATM4,4) ztox1(a_ATM4,t_4) 1. ztox2(a_ATM4,t_4) 1. z(93_ATM4,4) ztox3(a_ATM4,t_4) 1. z(94_ATM4,5) demand_def(a_ATM4,d_DATE0) 75.5 demand_def(a_ATM4,d_DATE1) 405.5 z(94_ATM4,5) demand_def(a_ATM4,d_DATE2) -1655. demand_def(a_ATM4,d_DATE3) -521.5 z(94_ATM4,5) demand_def(a_ATM4,d_DATE4) -894.5 demand_def(a_ATM4,d_DATE5) -173. z(94_ATM4,5) demand_def(a_ATM4,d_DATE6) -68. demand_def(a_ATM4,d_DATE7) -924.5 z(94_ATM4,5) demand_def(a_ATM4,d_DATE8) -221.5 demand_def(a_ATM4,d_DATE9) -475.5 z(94_ATM4,5) ztox1(a_ATM4,t_5) 1. ztox2(a_ATM4,t_5) 1. z(94_ATM4,5) ztox3(a_ATM4,t_5) 1. z(95_ATM4,6) demand_def(a_ATM4,d_DATE0) 90.6 demand_def(a_ATM4,d_DATE1) 486.6 z(95_ATM4,6) demand_def(a_ATM4,d_DATE2) -1986. demand_def(a_ATM4,d_DATE3) -625.8 z(95_ATM4,6) demand_def(a_ATM4,d_DATE4) -1073.4 demand_def(a_ATM4,d_DATE5) -207.6 z(95_ATM4,6) demand_def(a_ATM4,d_DATE6) -81.6 demand_def(a_ATM4,d_DATE7) -1109.4 z(95_ATM4,6) demand_def(a_ATM4,d_DATE8) -265.8 demand_def(a_ATM4,d_DATE9) -570.6 z(95_ATM4,6) ztox1(a_ATM4,t_6) 1. ztox2(a_ATM4,t_6) 1. z(95_ATM4,6) ztox3(a_ATM4,t_6) 1. z(96_ATM4,7) demand_def(a_ATM4,d_DATE0) 105.7 demand_def(a_ATM4,d_DATE1) 567.7 z(96_ATM4,7) demand_def(a_ATM4,d_DATE2) -2317. demand_def(a_ATM4,d_DATE3) -730.1 z(96_ATM4,7) demand_def(a_ATM4,d_DATE4) -1252.3 demand_def(a_ATM4,d_DATE5) -242.2 z(96_ATM4,7) demand_def(a_ATM4,d_DATE6) -95.2 demand_def(a_ATM4,d_DATE7) -1294.3 z(96_ATM4,7) demand_def(a_ATM4,d_DATE8) -310.1 demand_def(a_ATM4,d_DATE9) -665.7 z(96_ATM4,7) ztox1(a_ATM4,t_7) 1. ztox2(a_ATM4,t_7) 1. z(96_ATM4,7) ztox3(a_ATM4,t_7) 1. z(97_ATM4,8) demand_def(a_ATM4,d_DATE0) 120.8 demand_def(a_ATM4,d_DATE1) 648.8 z(97_ATM4,8) demand_def(a_ATM4,d_DATE2) -2648. demand_def(a_ATM4,d_DATE3) -834.4 z(97_ATM4,8) demand_def(a_ATM4,d_DATE4) -1431.2 demand_def(a_ATM4,d_DATE5) -276.8 z(97_ATM4,8) demand_def(a_ATM4,d_DATE6) -108.8 demand_def(a_ATM4,d_DATE7) -1479.2 z(97_ATM4,8) demand_def(a_ATM4,d_DATE8) -354.4 demand_def(a_ATM4,d_DATE9) -760.8 z(97_ATM4,8) ztox1(a_ATM4,t_8) 1. ztox2(a_ATM4,t_8) 1. z(97_ATM4,8) ztox3(a_ATM4,t_8) 1. z(98_ATM4,9) demand_def(a_ATM4,d_DATE0) 135.9 demand_def(a_ATM4,d_DATE1) 729.9 z(98_ATM4,9) demand_def(a_ATM4,d_DATE2) -2979. demand_def(a_ATM4,d_DATE3) -938.7 z(98_ATM4,9) demand_def(a_ATM4,d_DATE4) -1610.1 demand_def(a_ATM4,d_DATE5) -311.4 z(98_ATM4,9) demand_def(a_ATM4,d_DATE6) -122.4 demand_def(a_ATM4,d_DATE7) -1664.1 z(98_ATM4,9) demand_def(a_ATM4,d_DATE8) -398.7 demand_def(a_ATM4,d_DATE9) -855.9 z(98_ATM4,9) ztox1(a_ATM4,t_9) 1. ztox2(a_ATM4,t_9) 1. z(98_ATM4,9) ztox3(a_ATM4,t_9) 1. z(99_ATM4,10) demand_def(a_ATM4,d_DATE0) 151. demand_def(a_ATM4,d_DATE1) 811. z(99_ATM4,10) demand_def(a_ATM4,d_DATE2) -3310. demand_def(a_ATM4,d_DATE3) -1043. z(99_ATM4,10) demand_def(a_ATM4,d_DATE4) -1789. demand_def(a_ATM4,d_DATE5) -346. z(99_ATM4,10) demand_def(a_ATM4,d_DATE6) -136. demand_def(a_ATM4,d_DATE7) -1849. z(99_ATM4,10) demand_def(a_ATM4,d_DATE8) -443. demand_def(a_ATM4,d_DATE9) -951. z(99_ATM4,10) ztox1(a_ATM4,t_10) 1. ztox2(a_ATM4,t_10) 1. z(99_ATM4,10) ztox3(a_ATM4,t_10) 1. fp(100_ATM0,DATE0) OBJROW 1. budget(d_DATE0) 1. fp(100_ATM0,DATE0) demand_def(a_ATM0,d_DATE0) 1. fp(101_ATM0,DATE1) OBJROW 1. budget(d_DATE1) 1. fp(101_ATM0,DATE1) demand_def(a_ATM0,d_DATE1) 1. fp(102_ATM0,DATE2) OBJROW 1. budget(d_DATE2) 1. fp(102_ATM0,DATE2) demand_def(a_ATM0,d_DATE2) 1. fp(103_ATM0,DATE3) OBJROW 1. budget(d_DATE3) 1. fp(103_ATM0,DATE3) demand_def(a_ATM0,d_DATE3) 1. fp(104_ATM0,DATE4) OBJROW 1. budget(d_DATE4) 1. fp(104_ATM0,DATE4) demand_def(a_ATM0,d_DATE4) 1. fp(105_ATM0,DATE5) OBJROW 1. budget(d_DATE5) 1. fp(105_ATM0,DATE5) demand_def(a_ATM0,d_DATE5) 1. fp(106_ATM0,DATE6) OBJROW 1. budget(d_DATE6) 1. fp(106_ATM0,DATE6) demand_def(a_ATM0,d_DATE6) 1. fp(107_ATM0,DATE7) OBJROW 1. budget(d_DATE7) 1. fp(107_ATM0,DATE7) demand_def(a_ATM0,d_DATE7) 1. fp(108_ATM0,DATE8) OBJROW 1. budget(d_DATE8) 1. fp(108_ATM0,DATE8) demand_def(a_ATM0,d_DATE8) 1. fp(109_ATM0,DATE9) OBJROW 1. budget(d_DATE9) 1. fp(109_ATM0,DATE9) demand_def(a_ATM0,d_DATE9) 1. fp(110_ATM1,DATE0) OBJROW 1. budget(d_DATE0) 1. fp(110_ATM1,DATE0) demand_def(a_ATM1,d_DATE0) 1. fp(111_ATM1,DATE1) OBJROW 1. budget(d_DATE1) 1. fp(111_ATM1,DATE1) demand_def(a_ATM1,d_DATE1) 1. fp(112_ATM1,DATE2) OBJROW 1. budget(d_DATE2) 1. fp(112_ATM1,DATE2) demand_def(a_ATM1,d_DATE2) 1. fp(113_ATM1,DATE3) OBJROW 1. budget(d_DATE3) 1. fp(113_ATM1,DATE3) demand_def(a_ATM1,d_DATE3) 1. fp(114_ATM1,DATE4) OBJROW 1. budget(d_DATE4) 1. fp(114_ATM1,DATE4) demand_def(a_ATM1,d_DATE4) 1. fp(115_ATM1,DATE5) OBJROW 1. budget(d_DATE5) 1. fp(115_ATM1,DATE5) demand_def(a_ATM1,d_DATE5) 1. fp(116_ATM1,DATE6) OBJROW 1. budget(d_DATE6) 1. fp(116_ATM1,DATE6) demand_def(a_ATM1,d_DATE6) 1. fp(117_ATM1,DATE7) OBJROW 1. budget(d_DATE7) 1. fp(117_ATM1,DATE7) demand_def(a_ATM1,d_DATE7) 1. fp(118_ATM1,DATE8) OBJROW 1. budget(d_DATE8) 1. fp(118_ATM1,DATE8) demand_def(a_ATM1,d_DATE8) 1. fp(119_ATM1,DATE9) OBJROW 1. budget(d_DATE9) 1. fp(119_ATM1,DATE9) demand_def(a_ATM1,d_DATE9) 1. fp(120_ATM2,DATE0) OBJROW 1. budget(d_DATE0) 1. fp(120_ATM2,DATE0) demand_def(a_ATM2,d_DATE0) 1. fp(121_ATM2,DATE1) OBJROW 1. budget(d_DATE1) 1. fp(121_ATM2,DATE1) demand_def(a_ATM2,d_DATE1) 1. fp(122_ATM2,DATE2) OBJROW 1. budget(d_DATE2) 1. fp(122_ATM2,DATE2) demand_def(a_ATM2,d_DATE2) 1. fp(123_ATM2,DATE3) OBJROW 1. budget(d_DATE3) 1. fp(123_ATM2,DATE3) demand_def(a_ATM2,d_DATE3) 1. fp(124_ATM2,DATE4) OBJROW 1. budget(d_DATE4) 1. fp(124_ATM2,DATE4) demand_def(a_ATM2,d_DATE4) 1. fp(125_ATM2,DATE5) OBJROW 1. budget(d_DATE5) 1. fp(125_ATM2,DATE5) demand_def(a_ATM2,d_DATE5) 1. fp(126_ATM2,DATE6) OBJROW 1. budget(d_DATE6) 1. fp(126_ATM2,DATE6) demand_def(a_ATM2,d_DATE6) 1. fp(127_ATM2,DATE7) OBJROW 1. budget(d_DATE7) 1. fp(127_ATM2,DATE7) demand_def(a_ATM2,d_DATE7) 1. fp(128_ATM2,DATE8) OBJROW 1. budget(d_DATE8) 1. fp(128_ATM2,DATE8) demand_def(a_ATM2,d_DATE8) 1. fp(129_ATM2,DATE9) OBJROW 1. budget(d_DATE9) 1. fp(129_ATM2,DATE9) demand_def(a_ATM2,d_DATE9) 1. fp(130_ATM3,DATE0) OBJROW 1. budget(d_DATE0) 1. fp(130_ATM3,DATE0) demand_def(a_ATM3,d_DATE0) 1. fp(131_ATM3,DATE1) OBJROW 1. budget(d_DATE1) 1. fp(131_ATM3,DATE1) demand_def(a_ATM3,d_DATE1) 1. fp(132_ATM3,DATE2) OBJROW 1. budget(d_DATE2) 1. fp(132_ATM3,DATE2) demand_def(a_ATM3,d_DATE2) 1. fp(133_ATM3,DATE3) OBJROW 1. budget(d_DATE3) 1. fp(133_ATM3,DATE3) demand_def(a_ATM3,d_DATE3) 1. fp(134_ATM3,DATE4) OBJROW 1. budget(d_DATE4) 1. fp(134_ATM3,DATE4) demand_def(a_ATM3,d_DATE4) 1. fp(135_ATM3,DATE5) OBJROW 1. budget(d_DATE5) 1. fp(135_ATM3,DATE5) demand_def(a_ATM3,d_DATE5) 1. fp(136_ATM3,DATE6) OBJROW 1. budget(d_DATE6) 1. fp(136_ATM3,DATE6) demand_def(a_ATM3,d_DATE6) 1. fp(137_ATM3,DATE7) OBJROW 1. budget(d_DATE7) 1. fp(137_ATM3,DATE7) demand_def(a_ATM3,d_DATE7) 1. fp(138_ATM3,DATE8) OBJROW 1. budget(d_DATE8) 1. fp(138_ATM3,DATE8) demand_def(a_ATM3,d_DATE8) 1. fp(139_ATM3,DATE9) OBJROW 1. budget(d_DATE9) 1. fp(139_ATM3,DATE9) demand_def(a_ATM3,d_DATE9) 1. fp(140_ATM4,DATE0) OBJROW 1. budget(d_DATE0) 1. fp(140_ATM4,DATE0) demand_def(a_ATM4,d_DATE0) 1. fp(141_ATM4,DATE1) OBJROW 1. budget(d_DATE1) 1. fp(141_ATM4,DATE1) demand_def(a_ATM4,d_DATE1) 1. fp(142_ATM4,DATE2) OBJROW 1. budget(d_DATE2) 1. fp(142_ATM4,DATE2) demand_def(a_ATM4,d_DATE2) 1. fp(143_ATM4,DATE3) OBJROW 1. budget(d_DATE3) 1. fp(143_ATM4,DATE3) demand_def(a_ATM4,d_DATE3) 1. fp(144_ATM4,DATE4) OBJROW 1. budget(d_DATE4) 1. fp(144_ATM4,DATE4) demand_def(a_ATM4,d_DATE4) 1. fp(145_ATM4,DATE5) OBJROW 1. budget(d_DATE5) 1. fp(145_ATM4,DATE5) demand_def(a_ATM4,d_DATE5) 1. fp(146_ATM4,DATE6) OBJROW 1. budget(d_DATE6) 1. fp(146_ATM4,DATE6) demand_def(a_ATM4,d_DATE6) 1. fp(147_ATM4,DATE7) OBJROW 1. budget(d_DATE7) 1. fp(147_ATM4,DATE7) demand_def(a_ATM4,d_DATE7) 1. fp(148_ATM4,DATE8) OBJROW 1. budget(d_DATE8) 1. fp(148_ATM4,DATE8) demand_def(a_ATM4,d_DATE8) 1. fp(149_ATM4,DATE9) OBJROW 1. budget(d_DATE9) 1. fp(149_ATM4,DATE9) demand_def(a_ATM4,d_DATE9) 1. fm(150_ATM0,DATE0) OBJROW 1. budget(d_DATE0) -1. fm(150_ATM0,DATE0) demand_def(a_ATM0,d_DATE0) -1. linkv(a_ATM0,d_DATE0) 1. fm(151_ATM0,DATE1) OBJROW 1. budget(d_DATE1) -1. fm(151_ATM0,DATE1) demand_def(a_ATM0,d_DATE1) -1. linkv(a_ATM0,d_DATE1) 1. fm(152_ATM0,DATE2) OBJROW 1. budget(d_DATE2) -1. fm(152_ATM0,DATE2) demand_def(a_ATM0,d_DATE2) -1. linkv(a_ATM0,d_DATE2) 1. fm(153_ATM0,DATE3) OBJROW 1. budget(d_DATE3) -1. fm(153_ATM0,DATE3) demand_def(a_ATM0,d_DATE3) -1. linkv(a_ATM0,d_DATE3) 1. fm(154_ATM0,DATE4) OBJROW 1. budget(d_DATE4) -1. fm(154_ATM0,DATE4) demand_def(a_ATM0,d_DATE4) -1. linkv(a_ATM0,d_DATE4) 1. fm(155_ATM0,DATE5) OBJROW 1. budget(d_DATE5) -1. fm(155_ATM0,DATE5) demand_def(a_ATM0,d_DATE5) -1. linkv(a_ATM0,d_DATE5) 1. fm(156_ATM0,DATE6) OBJROW 1. budget(d_DATE6) -1. fm(156_ATM0,DATE6) demand_def(a_ATM0,d_DATE6) -1. linkv(a_ATM0,d_DATE6) 1. fm(157_ATM0,DATE7) OBJROW 1. budget(d_DATE7) -1. fm(157_ATM0,DATE7) demand_def(a_ATM0,d_DATE7) -1. linkv(a_ATM0,d_DATE7) 1. fm(158_ATM0,DATE8) OBJROW 1. budget(d_DATE8) -1. fm(158_ATM0,DATE8) demand_def(a_ATM0,d_DATE8) -1. linkv(a_ATM0,d_DATE8) 1. fm(159_ATM0,DATE9) OBJROW 1. budget(d_DATE9) -1. fm(159_ATM0,DATE9) demand_def(a_ATM0,d_DATE9) -1. linkv(a_ATM0,d_DATE9) 1. fm(160_ATM1,DATE0) OBJROW 1. budget(d_DATE0) -1. fm(160_ATM1,DATE0) demand_def(a_ATM1,d_DATE0) -1. linkv(a_ATM1,d_DATE0) 1. fm(161_ATM1,DATE1) OBJROW 1. budget(d_DATE1) -1. fm(161_ATM1,DATE1) demand_def(a_ATM1,d_DATE1) -1. linkv(a_ATM1,d_DATE1) 1. fm(162_ATM1,DATE2) OBJROW 1. budget(d_DATE2) -1. fm(162_ATM1,DATE2) demand_def(a_ATM1,d_DATE2) -1. linkv(a_ATM1,d_DATE2) 1. fm(163_ATM1,DATE3) OBJROW 1. budget(d_DATE3) -1. fm(163_ATM1,DATE3) demand_def(a_ATM1,d_DATE3) -1. linkv(a_ATM1,d_DATE3) 1. fm(164_ATM1,DATE4) OBJROW 1. budget(d_DATE4) -1. fm(164_ATM1,DATE4) demand_def(a_ATM1,d_DATE4) -1. linkv(a_ATM1,d_DATE4) 1. fm(165_ATM1,DATE5) OBJROW 1. budget(d_DATE5) -1. fm(165_ATM1,DATE5) demand_def(a_ATM1,d_DATE5) -1. linkv(a_ATM1,d_DATE5) 1. fm(166_ATM1,DATE6) OBJROW 1. budget(d_DATE6) -1. fm(166_ATM1,DATE6) demand_def(a_ATM1,d_DATE6) -1. linkv(a_ATM1,d_DATE6) 1. fm(167_ATM1,DATE7) OBJROW 1. budget(d_DATE7) -1. fm(167_ATM1,DATE7) demand_def(a_ATM1,d_DATE7) -1. linkv(a_ATM1,d_DATE7) 1. fm(168_ATM1,DATE8) OBJROW 1. budget(d_DATE8) -1. fm(168_ATM1,DATE8) demand_def(a_ATM1,d_DATE8) -1. linkv(a_ATM1,d_DATE8) 1. fm(169_ATM1,DATE9) OBJROW 1. budget(d_DATE9) -1. fm(169_ATM1,DATE9) demand_def(a_ATM1,d_DATE9) -1. linkv(a_ATM1,d_DATE9) 1. fm(170_ATM2,DATE0) OBJROW 1. budget(d_DATE0) -1. fm(170_ATM2,DATE0) demand_def(a_ATM2,d_DATE0) -1. linkv(a_ATM2,d_DATE0) 1. fm(171_ATM2,DATE1) OBJROW 1. budget(d_DATE1) -1. fm(171_ATM2,DATE1) demand_def(a_ATM2,d_DATE1) -1. linkv(a_ATM2,d_DATE1) 1. fm(172_ATM2,DATE2) OBJROW 1. budget(d_DATE2) -1. fm(172_ATM2,DATE2) demand_def(a_ATM2,d_DATE2) -1. linkv(a_ATM2,d_DATE2) 1. fm(173_ATM2,DATE3) OBJROW 1. budget(d_DATE3) -1. fm(173_ATM2,DATE3) demand_def(a_ATM2,d_DATE3) -1. linkv(a_ATM2,d_DATE3) 1. fm(174_ATM2,DATE4) OBJROW 1. budget(d_DATE4) -1. fm(174_ATM2,DATE4) demand_def(a_ATM2,d_DATE4) -1. linkv(a_ATM2,d_DATE4) 1. fm(175_ATM2,DATE5) OBJROW 1. budget(d_DATE5) -1. fm(175_ATM2,DATE5) demand_def(a_ATM2,d_DATE5) -1. linkv(a_ATM2,d_DATE5) 1. fm(176_ATM2,DATE6) OBJROW 1. budget(d_DATE6) -1. fm(176_ATM2,DATE6) demand_def(a_ATM2,d_DATE6) -1. linkv(a_ATM2,d_DATE6) 1. fm(177_ATM2,DATE7) OBJROW 1. budget(d_DATE7) -1. fm(177_ATM2,DATE7) demand_def(a_ATM2,d_DATE7) -1. linkv(a_ATM2,d_DATE7) 1. fm(178_ATM2,DATE8) OBJROW 1. budget(d_DATE8) -1. fm(178_ATM2,DATE8) demand_def(a_ATM2,d_DATE8) -1. linkv(a_ATM2,d_DATE8) 1. fm(179_ATM2,DATE9) OBJROW 1. budget(d_DATE9) -1. fm(179_ATM2,DATE9) demand_def(a_ATM2,d_DATE9) -1. linkv(a_ATM2,d_DATE9) 1. fm(180_ATM3,DATE0) OBJROW 1. budget(d_DATE0) -1. fm(180_ATM3,DATE0) demand_def(a_ATM3,d_DATE0) -1. linkv(a_ATM3,d_DATE0) 1. fm(181_ATM3,DATE1) OBJROW 1. budget(d_DATE1) -1. fm(181_ATM3,DATE1) demand_def(a_ATM3,d_DATE1) -1. linkv(a_ATM3,d_DATE1) 1. fm(182_ATM3,DATE2) OBJROW 1. budget(d_DATE2) -1. fm(182_ATM3,DATE2) demand_def(a_ATM3,d_DATE2) -1. linkv(a_ATM3,d_DATE2) 1. fm(183_ATM3,DATE3) OBJROW 1. budget(d_DATE3) -1. fm(183_ATM3,DATE3) demand_def(a_ATM3,d_DATE3) -1. linkv(a_ATM3,d_DATE3) 1. fm(184_ATM3,DATE4) OBJROW 1. budget(d_DATE4) -1. fm(184_ATM3,DATE4) demand_def(a_ATM3,d_DATE4) -1. linkv(a_ATM3,d_DATE4) 1. fm(185_ATM3,DATE5) OBJROW 1. budget(d_DATE5) -1. fm(185_ATM3,DATE5) demand_def(a_ATM3,d_DATE5) -1. linkv(a_ATM3,d_DATE5) 1. fm(186_ATM3,DATE6) OBJROW 1. budget(d_DATE6) -1. fm(186_ATM3,DATE6) demand_def(a_ATM3,d_DATE6) -1. linkv(a_ATM3,d_DATE6) 1. fm(187_ATM3,DATE7) OBJROW 1. budget(d_DATE7) -1. fm(187_ATM3,DATE7) demand_def(a_ATM3,d_DATE7) -1. linkv(a_ATM3,d_DATE7) 1. fm(188_ATM3,DATE8) OBJROW 1. budget(d_DATE8) -1. fm(188_ATM3,DATE8) demand_def(a_ATM3,d_DATE8) -1. linkv(a_ATM3,d_DATE8) 1. fm(189_ATM3,DATE9) OBJROW 1. budget(d_DATE9) -1. fm(189_ATM3,DATE9) demand_def(a_ATM3,d_DATE9) -1. linkv(a_ATM3,d_DATE9) 1. fm(190_ATM4,DATE0) OBJROW 1. budget(d_DATE0) -1. fm(190_ATM4,DATE0) demand_def(a_ATM4,d_DATE0) -1. linkv(a_ATM4,d_DATE0) 1. fm(191_ATM4,DATE1) OBJROW 1. budget(d_DATE1) -1. fm(191_ATM4,DATE1) demand_def(a_ATM4,d_DATE1) -1. linkv(a_ATM4,d_DATE1) 1. fm(192_ATM4,DATE2) OBJROW 1. budget(d_DATE2) -1. fm(192_ATM4,DATE2) demand_def(a_ATM4,d_DATE2) -1. linkv(a_ATM4,d_DATE2) 1. fm(193_ATM4,DATE3) OBJROW 1. budget(d_DATE3) -1. fm(193_ATM4,DATE3) demand_def(a_ATM4,d_DATE3) -1. linkv(a_ATM4,d_DATE3) 1. fm(194_ATM4,DATE4) OBJROW 1. budget(d_DATE4) -1. fm(194_ATM4,DATE4) demand_def(a_ATM4,d_DATE4) -1. linkv(a_ATM4,d_DATE4) 1. fm(195_ATM4,DATE5) OBJROW 1. budget(d_DATE5) -1. fm(195_ATM4,DATE5) demand_def(a_ATM4,d_DATE5) -1. linkv(a_ATM4,d_DATE5) 1. fm(196_ATM4,DATE6) OBJROW 1. budget(d_DATE6) -1. fm(196_ATM4,DATE6) demand_def(a_ATM4,d_DATE6) -1. linkv(a_ATM4,d_DATE6) 1. fm(197_ATM4,DATE7) OBJROW 1. budget(d_DATE7) -1. fm(197_ATM4,DATE7) demand_def(a_ATM4,d_DATE7) -1. linkv(a_ATM4,d_DATE7) 1. fm(198_ATM4,DATE8) OBJROW 1. budget(d_DATE8) -1. fm(198_ATM4,DATE8) demand_def(a_ATM4,d_DATE8) -1. linkv(a_ATM4,d_DATE8) 1. fm(199_ATM4,DATE9) OBJROW 1. budget(d_DATE9) -1. fm(199_ATM4,DATE9) demand_def(a_ATM4,d_DATE9) -1. linkv(a_ATM4,d_DATE9) 1. x2(200_ATM0) demand_def(a_ATM0,d_DATE0) -1984. demand_def(a_ATM0,d_DATE1) -2530. x2(200_ATM0) demand_def(a_ATM0,d_DATE2) 67. demand_def(a_ATM0,d_DATE3) 3135. x2(200_ATM0) demand_def(a_ATM0,d_DATE4) 951. demand_def(a_ATM0,d_DATE5) -479. x2(200_ATM0) demand_def(a_ATM0,d_DATE6) -3186. demand_def(a_ATM0,d_DATE7) -341. x2(200_ATM0) demand_def(a_ATM0,d_DATE8) 643. demand_def(a_ATM0,d_DATE9) 931. x2(200_ATM0) ztox2(a_ATM0,t_1) -1. ztox3(a_ATM0,t_1) -1. x2(200_ATM0) ztox2(a_ATM0,t_2) -1. ztox3(a_ATM0,t_2) -1. x2(200_ATM0) ztox2(a_ATM0,t_3) -1. ztox3(a_ATM0,t_3) -1. x2(200_ATM0) ztox2(a_ATM0,t_4) -1. ztox3(a_ATM0,t_4) -1. x2(200_ATM0) ztox2(a_ATM0,t_5) -1. ztox3(a_ATM0,t_5) -1. x2(200_ATM0) ztox2(a_ATM0,t_6) -1. ztox3(a_ATM0,t_6) -1. x2(200_ATM0) ztox2(a_ATM0,t_7) -1. ztox3(a_ATM0,t_7) -1. x2(200_ATM0) ztox2(a_ATM0,t_8) -1. ztox3(a_ATM0,t_8) -1. x2(200_ATM0) ztox2(a_ATM0,t_9) -1. ztox3(a_ATM0,t_9) -1. x2(200_ATM0) ztox2(a_ATM0,t_10) -1. ztox3(a_ATM0,t_10) -1. x2(201_ATM1) demand_def(a_ATM1,d_DATE0) -601. demand_def(a_ATM1,d_DATE1) -618. x2(201_ATM1) demand_def(a_ATM1,d_DATE2) 610. demand_def(a_ATM1,d_DATE3) 1977. x2(201_ATM1) demand_def(a_ATM1,d_DATE4) -1566. demand_def(a_ATM1,d_DATE5) 1480. x2(201_ATM1) demand_def(a_ATM1,d_DATE6) -679. demand_def(a_ATM1,d_DATE7) -1375. x2(201_ATM1) demand_def(a_ATM1,d_DATE8) -534. demand_def(a_ATM1,d_DATE9) -157. x2(201_ATM1) ztox2(a_ATM1,t_1) -1. ztox3(a_ATM1,t_1) -1. x2(201_ATM1) ztox2(a_ATM1,t_2) -1. ztox3(a_ATM1,t_2) -1. x2(201_ATM1) ztox2(a_ATM1,t_3) -1. ztox3(a_ATM1,t_3) -1. x2(201_ATM1) ztox2(a_ATM1,t_4) -1. ztox3(a_ATM1,t_4) -1. x2(201_ATM1) ztox2(a_ATM1,t_5) -1. ztox3(a_ATM1,t_5) -1. x2(201_ATM1) ztox2(a_ATM1,t_6) -1. ztox3(a_ATM1,t_6) -1. x2(201_ATM1) ztox2(a_ATM1,t_7) -1. ztox3(a_ATM1,t_7) -1. x2(201_ATM1) ztox2(a_ATM1,t_8) -1. ztox3(a_ATM1,t_8) -1. x2(201_ATM1) ztox2(a_ATM1,t_9) -1. ztox3(a_ATM1,t_9) -1. x2(201_ATM1) ztox2(a_ATM1,t_10) -1. ztox3(a_ATM1,t_10) -1. x2(202_ATM2) demand_def(a_ATM2,d_DATE0) 691. demand_def(a_ATM2,d_DATE1) 2001. x2(202_ATM2) demand_def(a_ATM2,d_DATE2) -2626. demand_def(a_ATM2,d_DATE3) -3649. x2(202_ATM2) demand_def(a_ATM2,d_DATE4) 951. demand_def(a_ATM2,d_DATE5) 1376. x2(202_ATM2) demand_def(a_ATM2,d_DATE6) -2067. demand_def(a_ATM2,d_DATE7) -1046. x2(202_ATM2) demand_def(a_ATM2,d_DATE8) 574. demand_def(a_ATM2,d_DATE9) 1377. x2(202_ATM2) ztox2(a_ATM2,t_1) -1. ztox3(a_ATM2,t_1) -1. x2(202_ATM2) ztox2(a_ATM2,t_2) -1. ztox3(a_ATM2,t_2) -1. x2(202_ATM2) ztox2(a_ATM2,t_3) -1. ztox3(a_ATM2,t_3) -1. x2(202_ATM2) ztox2(a_ATM2,t_4) -1. ztox3(a_ATM2,t_4) -1. x2(202_ATM2) ztox2(a_ATM2,t_5) -1. ztox3(a_ATM2,t_5) -1. x2(202_ATM2) ztox2(a_ATM2,t_6) -1. ztox3(a_ATM2,t_6) -1. x2(202_ATM2) ztox2(a_ATM2,t_7) -1. ztox3(a_ATM2,t_7) -1. x2(202_ATM2) ztox2(a_ATM2,t_8) -1. ztox3(a_ATM2,t_8) -1. x2(202_ATM2) ztox2(a_ATM2,t_9) -1. ztox3(a_ATM2,t_9) -1. x2(202_ATM2) ztox2(a_ATM2,t_10) -1. ztox3(a_ATM2,t_10) -1. x2(203_ATM3) demand_def(a_ATM3,d_DATE0) -2943. demand_def(a_ATM3,d_DATE1) -93. x2(203_ATM3) demand_def(a_ATM3,d_DATE2) 451. demand_def(a_ATM3,d_DATE3) 1282. x2(203_ATM3) demand_def(a_ATM3,d_DATE4) -1251. demand_def(a_ATM3,d_DATE5) 1141. x2(203_ATM3) demand_def(a_ATM3,d_DATE6) 3214. demand_def(a_ATM3,d_DATE7) 976. x2(203_ATM3) demand_def(a_ATM3,d_DATE8) 480. demand_def(a_ATM3,d_DATE9) 2369. x2(203_ATM3) ztox2(a_ATM3,t_1) -1. ztox3(a_ATM3,t_1) -1. x2(203_ATM3) ztox2(a_ATM3,t_2) -1. ztox3(a_ATM3,t_2) -1. x2(203_ATM3) ztox2(a_ATM3,t_3) -1. ztox3(a_ATM3,t_3) -1. x2(203_ATM3) ztox2(a_ATM3,t_4) -1. ztox3(a_ATM3,t_4) -1. x2(203_ATM3) ztox2(a_ATM3,t_5) -1. ztox3(a_ATM3,t_5) -1. x2(203_ATM3) ztox2(a_ATM3,t_6) -1. ztox3(a_ATM3,t_6) -1. x2(203_ATM3) ztox2(a_ATM3,t_7) -1. ztox3(a_ATM3,t_7) -1. x2(203_ATM3) ztox2(a_ATM3,t_8) -1. ztox3(a_ATM3,t_8) -1. x2(203_ATM3) ztox2(a_ATM3,t_9) -1. ztox3(a_ATM3,t_9) -1. x2(203_ATM3) ztox2(a_ATM3,t_10) -1. ztox3(a_ATM3,t_10) -1. x2(204_ATM4) demand_def(a_ATM4,d_DATE0) -151. demand_def(a_ATM4,d_DATE1) -811. x2(204_ATM4) demand_def(a_ATM4,d_DATE2) 3310. demand_def(a_ATM4,d_DATE3) 1043. x2(204_ATM4) demand_def(a_ATM4,d_DATE4) 1789. demand_def(a_ATM4,d_DATE5) 346. x2(204_ATM4) demand_def(a_ATM4,d_DATE6) 136. demand_def(a_ATM4,d_DATE7) 1849. x2(204_ATM4) demand_def(a_ATM4,d_DATE8) 443. demand_def(a_ATM4,d_DATE9) 951. x2(204_ATM4) ztox2(a_ATM4,t_1) -1. ztox3(a_ATM4,t_1) -1. x2(204_ATM4) ztox2(a_ATM4,t_2) -1. ztox3(a_ATM4,t_2) -1. x2(204_ATM4) ztox2(a_ATM4,t_3) -1. ztox3(a_ATM4,t_3) -1. x2(204_ATM4) ztox2(a_ATM4,t_4) -1. ztox3(a_ATM4,t_4) -1. x2(204_ATM4) ztox2(a_ATM4,t_5) -1. ztox3(a_ATM4,t_5) -1. x2(204_ATM4) ztox2(a_ATM4,t_6) -1. ztox3(a_ATM4,t_6) -1. x2(204_ATM4) ztox2(a_ATM4,t_7) -1. ztox3(a_ATM4,t_7) -1. x2(204_ATM4) ztox2(a_ATM4,t_8) -1. ztox3(a_ATM4,t_8) -1. x2(204_ATM4) ztox2(a_ATM4,t_9) -1. ztox3(a_ATM4,t_9) -1. x2(204_ATM4) ztox2(a_ATM4,t_10) -1. ztox3(a_ATM4,t_10) -1. x3(205_ATM0) demand_def(a_ATM0,d_DATE0) -1045. demand_def(a_ATM0,d_DATE1) -1510. x3(205_ATM0) demand_def(a_ATM0,d_DATE2) -145. demand_def(a_ATM0,d_DATE3) -581. x3(205_ATM0) demand_def(a_ATM0,d_DATE4) -74. demand_def(a_ATM0,d_DATE5) -1121. x3(205_ATM0) demand_def(a_ATM0,d_DATE6) -757. demand_def(a_ATM0,d_DATE7) -843. x3(205_ATM0) demand_def(a_ATM0,d_DATE8) -915. demand_def(a_ATM0,d_DATE9) -43. x3(206_ATM1) demand_def(a_ATM1,d_DATE0) -1772. demand_def(a_ATM1,d_DATE1) -636. x3(206_ATM1) demand_def(a_ATM1,d_DATE2) -825. demand_def(a_ATM1,d_DATE3) -20. x3(206_ATM1) demand_def(a_ATM1,d_DATE4) -1262. demand_def(a_ATM1,d_DATE5) -976. x3(206_ATM1) demand_def(a_ATM1,d_DATE6) -632. demand_def(a_ATM1,d_DATE7) -586. x3(206_ATM1) demand_def(a_ATM1,d_DATE8) -655. demand_def(a_ATM1,d_DATE9) -859. x3(207_ATM2) demand_def(a_ATM2,d_DATE0) -1229. demand_def(a_ATM2,d_DATE1) -410. x3(207_ATM2) demand_def(a_ATM2,d_DATE2) -454. demand_def(a_ATM2,d_DATE3) -26. x3(207_ATM2) demand_def(a_ATM2,d_DATE4) -958. demand_def(a_ATM2,d_DATE5) -443. x3(207_ATM2) demand_def(a_ATM2,d_DATE6) -800. demand_def(a_ATM2,d_DATE7) -123. x3(207_ATM2) demand_def(a_ATM2,d_DATE8) -396. demand_def(a_ATM2,d_DATE9) -82. x3(208_ATM3) demand_def(a_ATM3,d_DATE0) -1593. demand_def(a_ATM3,d_DATE1) -1387. x3(208_ATM3) demand_def(a_ATM3,d_DATE2) -1785. demand_def(a_ATM3,d_DATE3) -3317. x3(208_ATM3) demand_def(a_ATM3,d_DATE4) -80. demand_def(a_ATM3,d_DATE5) -1642. x3(208_ATM3) demand_def(a_ATM3,d_DATE6) -815. demand_def(a_ATM3,d_DATE7) -99. x3(208_ATM3) demand_def(a_ATM3,d_DATE8) -242. demand_def(a_ATM3,d_DATE9) -1546. x3(209_ATM4) demand_def(a_ATM4,d_DATE0) -92. demand_def(a_ATM4,d_DATE1) -2282. x3(209_ATM4) demand_def(a_ATM4,d_DATE2) -404. demand_def(a_ATM4,d_DATE3) -504. x3(209_ATM4) demand_def(a_ATM4,d_DATE4) -549. demand_def(a_ATM4,d_DATE5) -185. x3(209_ATM4) demand_def(a_ATM4,d_DATE6) -624. demand_def(a_ATM4,d_DATE7) -2004. x3(209_ATM4) demand_def(a_ATM4,d_DATE8) -1659. demand_def(a_ATM4,d_DATE9) -1204. v(210_ATM0,DATE0) linkv(a_ATM0,d_DATE0) -780. count(a_ATM0) 1. v(211_ATM0,DATE1) linkv(a_ATM0,d_DATE1) -2351. count(a_ATM0) 1. v(212_ATM0,DATE2) linkv(a_ATM0,d_DATE2) -2288. count(a_ATM0) 1. v(213_ATM0,DATE3) linkv(a_ATM0,d_DATE3) -1357. count(a_ATM0) 1. v(214_ATM0,DATE4) linkv(a_ATM0,d_DATE4) -3637. count(a_ATM0) 1. v(215_ATM0,DATE5) linkv(a_ATM0,d_DATE5) -1371. count(a_ATM0) 1. v(216_ATM0,DATE6) linkv(a_ATM0,d_DATE6) -2225. count(a_ATM0) 1. v(217_ATM0,DATE7) linkv(a_ATM0,d_DATE7) -1721. count(a_ATM0) 1. v(218_ATM0,DATE8) linkv(a_ATM0,d_DATE8) -2110. count(a_ATM0) 1. v(219_ATM0,DATE9) linkv(a_ATM0,d_DATE9) -3118. count(a_ATM0) 1. v(220_ATM1,DATE0) linkv(a_ATM1,d_DATE0) -2830. count(a_ATM1) 1. v(221_ATM1,DATE1) linkv(a_ATM1,d_DATE1) -184. count(a_ATM1) 1. v(222_ATM1,DATE2) linkv(a_ATM1,d_DATE2) -282. count(a_ATM1) 1. v(223_ATM1,DATE3) linkv(a_ATM1,d_DATE3) -998. count(a_ATM1) 1. v(224_ATM1,DATE4) linkv(a_ATM1,d_DATE4) -3198. count(a_ATM1) 1. v(225_ATM1,DATE5) linkv(a_ATM1,d_DATE5) -3170. count(a_ATM1) 1. v(226_ATM1,DATE6) linkv(a_ATM1,d_DATE6) -2301. count(a_ATM1) 1. v(227_ATM1,DATE7) linkv(a_ATM1,d_DATE7) -719. count(a_ATM1) 1. v(228_ATM1,DATE8) linkv(a_ATM1,d_DATE8) -818. count(a_ATM1) 1. v(229_ATM1,DATE9) linkv(a_ATM1,d_DATE9) -1426. count(a_ATM1) 1. v(230_ATM2,DATE0) linkv(a_ATM2,d_DATE0) -2803. count(a_ATM2) 1. v(231_ATM2,DATE1) linkv(a_ATM2,d_DATE1) -1031. count(a_ATM2) 1. v(232_ATM2,DATE2) linkv(a_ATM2,d_DATE2) -23. count(a_ATM2) 1. v(233_ATM2,DATE3) linkv(a_ATM2,d_DATE3) -376. count(a_ATM2) 1. v(234_ATM2,DATE4) linkv(a_ATM2,d_DATE4) -541. count(a_ATM2) 1. v(235_ATM2,DATE5) linkv(a_ATM2,d_DATE5) -2195. count(a_ATM2) 1. v(236_ATM2,DATE6) linkv(a_ATM2,d_DATE6) -3676. count(a_ATM2) 1. v(237_ATM2,DATE7) linkv(a_ATM2,d_DATE7) -2475. count(a_ATM2) 1. v(238_ATM2,DATE8) linkv(a_ATM2,d_DATE8) -1232. count(a_ATM2) 1. v(239_ATM2,DATE9) linkv(a_ATM2,d_DATE9) -352. count(a_ATM2) 1. v(240_ATM3,DATE0) linkv(a_ATM3,d_DATE0) -853. count(a_ATM3) 1. v(241_ATM3,DATE1) linkv(a_ATM3,d_DATE1) -2310. count(a_ATM3) 1. v(242_ATM3,DATE2) linkv(a_ATM3,d_DATE2) -3542. count(a_ATM3) 1. v(243_ATM3,DATE3) linkv(a_ATM3,d_DATE3) -739. count(a_ATM3) 1. v(244_ATM3,DATE4) linkv(a_ATM3,d_DATE4) -1315. count(a_ATM3) 1. v(245_ATM3,DATE5) linkv(a_ATM3,d_DATE5) -2929. count(a_ATM3) 1. v(246_ATM3,DATE6) linkv(a_ATM3,d_DATE6) -2928. count(a_ATM3) 1. v(247_ATM3,DATE7) linkv(a_ATM3,d_DATE7) -2101. count(a_ATM3) 1. v(248_ATM3,DATE8) linkv(a_ATM3,d_DATE8) -3522. count(a_ATM3) 1. v(249_ATM3,DATE9) linkv(a_ATM3,d_DATE9) -319. count(a_ATM3) 1. v(250_ATM4,DATE0) linkv(a_ATM4,d_DATE0) -1184. count(a_ATM4) 1. v(251_ATM4,DATE1) linkv(a_ATM4,d_DATE1) -181. count(a_ATM4) 1. v(252_ATM4,DATE2) linkv(a_ATM4,d_DATE2) -1096. count(a_ATM4) 1. v(253_ATM4,DATE3) linkv(a_ATM4,d_DATE3) -1568. count(a_ATM4) 1. v(254_ATM4,DATE4) linkv(a_ATM4,d_DATE4) -2710. count(a_ATM4) 1. v(255_ATM4,DATE5) linkv(a_ATM4,d_DATE5) -1096. count(a_ATM4) 1. v(256_ATM4,DATE6) linkv(a_ATM4,d_DATE6) -3834. count(a_ATM4) 1. v(257_ATM4,DATE7) linkv(a_ATM4,d_DATE7) -4214. count(a_ATM4) 1. v(258_ATM4,DATE8) linkv(a_ATM4,d_DATE8) -1902. count(a_ATM4) 1. v(259_ATM4,DATE9) linkv(a_ATM4,d_DATE9) -3280. count(a_ATM4) 1. RHS RHS budget(d_DATE0) 5829. budget(d_DATE1) 9829. RHS budget(d_DATE2) 70. budget(d_DATE3) 841. RHS budget(d_DATE4) 4915. budget(d_DATE5) 1100. RHS budget(d_DATE6) 4915. budget(d_DATE7) 5622. RHS budget(d_DATE8) 6264. budget(d_DATE9) 243. RHS demand_def(a_ATM0,d_DATE0) 593. demand_def(a_ATM0,d_DATE1) -2177. RHS demand_def(a_ATM0,d_DATE2) 532. demand_def(a_ATM0,d_DATE3) 1962. RHS demand_def(a_ATM0,d_DATE4) -1590. demand_def(a_ATM0,d_DATE5) 799. RHS demand_def(a_ATM0,d_DATE6) -324. demand_def(a_ATM0,d_DATE7) -368. RHS demand_def(a_ATM0,d_DATE8) -532. demand_def(a_ATM0,d_DATE9) -1334. RHS pickone_x1(a_ATM0) 1. count(a_ATM0) 4. RHS ztox3(a_ATM0,t_1) -1. ztox3(a_ATM0,t_2) -1. RHS ztox3(a_ATM0,t_3) -1. ztox3(a_ATM0,t_4) -1. RHS ztox3(a_ATM0,t_5) -1. ztox3(a_ATM0,t_6) -1. RHS ztox3(a_ATM0,t_7) -1. ztox3(a_ATM0,t_8) -1. RHS ztox3(a_ATM0,t_9) -1. ztox3(a_ATM0,t_10) -1. RHS demand_def(a_ATM1,d_DATE0) -568. demand_def(a_ATM1,d_DATE1) 891. RHS demand_def(a_ATM1,d_DATE2) 2781. demand_def(a_ATM1,d_DATE3) 1922. RHS demand_def(a_ATM1,d_DATE4) -1703. demand_def(a_ATM1,d_DATE5) -517. RHS demand_def(a_ATM1,d_DATE6) -1402. demand_def(a_ATM1,d_DATE7) 438. RHS demand_def(a_ATM1,d_DATE8) 635. demand_def(a_ATM1,d_DATE9) 355. RHS pickone_x1(a_ATM1) 1. count(a_ATM1) 3. RHS ztox3(a_ATM1,t_1) -1. ztox3(a_ATM1,t_2) -1. RHS ztox3(a_ATM1,t_3) -1. ztox3(a_ATM1,t_4) -1. RHS ztox3(a_ATM1,t_5) -1. ztox3(a_ATM1,t_6) -1. RHS ztox3(a_ATM1,t_7) -1. ztox3(a_ATM1,t_8) -1. RHS ztox3(a_ATM1,t_9) -1. ztox3(a_ATM1,t_10) -1. RHS demand_def(a_ATM2,d_DATE0) -1935. demand_def(a_ATM2,d_DATE1) 1043. RHS demand_def(a_ATM2,d_DATE2) 771. demand_def(a_ATM2,d_DATE3) 480. RHS demand_def(a_ATM2,d_DATE4) 1669. demand_def(a_ATM2,d_DATE5) 29. RHS demand_def(a_ATM2,d_DATE6) -2933. demand_def(a_ATM2,d_DATE7) -627. RHS demand_def(a_ATM2,d_DATE8) 1009. demand_def(a_ATM2,d_DATE9) 2157. RHS pickone_x1(a_ATM2) 1. count(a_ATM2) 3. RHS ztox3(a_ATM2,t_1) -1. ztox3(a_ATM2,t_2) -1. RHS ztox3(a_ATM2,t_3) -1. ztox3(a_ATM2,t_4) -1. RHS ztox3(a_ATM2,t_5) -1. ztox3(a_ATM2,t_6) -1. RHS ztox3(a_ATM2,t_7) -1. ztox3(a_ATM2,t_8) -1. RHS ztox3(a_ATM2,t_9) -1. ztox3(a_ATM2,t_10) -1. RHS demand_def(a_ATM3,d_DATE0) -178. demand_def(a_ATM3,d_DATE1) 286. RHS demand_def(a_ATM3,d_DATE2) -2323. demand_def(a_ATM3,d_DATE3) 940. RHS demand_def(a_ATM3,d_DATE4) -130. demand_def(a_ATM3,d_DATE5) -1206. RHS demand_def(a_ATM3,d_DATE6) 469. demand_def(a_ATM3,d_DATE7) -969. RHS demand_def(a_ATM3,d_DATE8) -2804. demand_def(a_ATM3,d_DATE9) 3330. RHS pickone_x1(a_ATM3) 1. count(a_ATM3) 7. RHS ztox3(a_ATM3,t_1) -1. ztox3(a_ATM3,t_2) -1. RHS ztox3(a_ATM3,t_3) -1. ztox3(a_ATM3,t_4) -1. RHS ztox3(a_ATM3,t_5) -1. ztox3(a_ATM3,t_6) -1. RHS ztox3(a_ATM3,t_7) -1. ztox3(a_ATM3,t_8) -1. RHS ztox3(a_ATM3,t_9) -1. ztox3(a_ATM3,t_10) -1. RHS demand_def(a_ATM4,d_DATE0) -144. demand_def(a_ATM4,d_DATE1) 359. RHS demand_def(a_ATM4,d_DATE2) 2349. demand_def(a_ATM4,d_DATE3) -184. RHS demand_def(a_ATM4,d_DATE4) -55. demand_def(a_ATM4,d_DATE5) -698. RHS demand_def(a_ATM4,d_DATE6) -3187. demand_def(a_ATM4,d_DATE7) -1890. RHS demand_def(a_ATM4,d_DATE8) 1647. demand_def(a_ATM4,d_DATE9) 233. RHS pickone_x1(a_ATM4) 1. count(a_ATM4) 5. RHS ztox3(a_ATM4,t_1) -1. ztox3(a_ATM4,t_2) -1. RHS ztox3(a_ATM4,t_3) -1. ztox3(a_ATM4,t_4) -1. RHS ztox3(a_ATM4,t_5) -1. ztox3(a_ATM4,t_6) -1. RHS ztox3(a_ATM4,t_7) -1. ztox3(a_ATM4,t_8) -1. RHS ztox3(a_ATM4,t_9) -1. ztox3(a_ATM4,t_10) -1. BOUNDS BV BOUND x1(0_ATM0,1) 1. BV BOUND x1(1_ATM0,2) 1. BV BOUND x1(2_ATM0,3) 1. BV BOUND x1(3_ATM0,4) 1. BV BOUND x1(4_ATM0,5) 1. BV BOUND x1(5_ATM0,6) 1. BV BOUND x1(6_ATM0,7) 1. BV BOUND x1(7_ATM0,8) 1. BV BOUND x1(8_ATM0,9) 1. BV BOUND x1(9_ATM0,10) 1. BV BOUND x1(10_ATM1,1) 1. BV BOUND x1(11_ATM1,2) 1. BV BOUND x1(12_ATM1,3) 1. BV BOUND x1(13_ATM1,4) 1. BV BOUND x1(14_ATM1,5) 1. BV BOUND x1(15_ATM1,6) 1. BV BOUND x1(16_ATM1,7) 1. BV BOUND x1(17_ATM1,8) 1. BV BOUND x1(18_ATM1,9) 1. BV BOUND x1(19_ATM1,10) 1. BV BOUND x1(20_ATM2,1) 1. BV BOUND x1(21_ATM2,2) 1. BV BOUND x1(22_ATM2,3) 1. BV BOUND x1(23_ATM2,4) 1. BV BOUND x1(24_ATM2,5) 1. BV BOUND x1(25_ATM2,6) 1. BV BOUND x1(26_ATM2,7) 1. BV BOUND x1(27_ATM2,8) 1. BV BOUND x1(28_ATM2,9) 1. BV BOUND x1(29_ATM2,10) 1. BV BOUND x1(30_ATM3,1) 1. BV BOUND x1(31_ATM3,2) 1. BV BOUND x1(32_ATM3,3) 1. BV BOUND x1(33_ATM3,4) 1. BV BOUND x1(34_ATM3,5) 1. BV BOUND x1(35_ATM3,6) 1. BV BOUND x1(36_ATM3,7) 1. BV BOUND x1(37_ATM3,8) 1. BV BOUND x1(38_ATM3,9) 1. BV BOUND x1(39_ATM3,10) 1. BV BOUND x1(40_ATM4,1) 1. BV BOUND x1(41_ATM4,2) 1. BV BOUND x1(42_ATM4,3) 1. BV BOUND x1(43_ATM4,4) 1. BV BOUND x1(44_ATM4,5) 1. BV BOUND x1(45_ATM4,6) 1. BV BOUND x1(46_ATM4,7) 1. BV BOUND x1(47_ATM4,8) 1. BV BOUND x1(48_ATM4,9) 1. BV BOUND x1(49_ATM4,10) 1. UP BOUND z(50_ATM0,1) 1. UP BOUND z(51_ATM0,2) 1. UP BOUND z(52_ATM0,3) 1. UP BOUND z(53_ATM0,4) 1. UP BOUND z(54_ATM0,5) 1. UP BOUND z(55_ATM0,6) 1. UP BOUND z(56_ATM0,7) 1. UP BOUND z(57_ATM0,8) 1. UP BOUND z(58_ATM0,9) 1. UP BOUND z(59_ATM0,10) 1. UP BOUND z(60_ATM1,1) 1. UP BOUND z(61_ATM1,2) 1. UP BOUND z(62_ATM1,3) 1. UP BOUND z(63_ATM1,4) 1. UP BOUND z(64_ATM1,5) 1. UP BOUND z(65_ATM1,6) 1. UP BOUND z(66_ATM1,7) 1. UP BOUND z(67_ATM1,8) 1. UP BOUND z(68_ATM1,9) 1. UP BOUND z(69_ATM1,10) 1. UP BOUND z(70_ATM2,1) 1. UP BOUND z(71_ATM2,2) 1. UP BOUND z(72_ATM2,3) 1. UP BOUND z(73_ATM2,4) 1. UP BOUND z(74_ATM2,5) 1. UP BOUND z(75_ATM2,6) 1. UP BOUND z(76_ATM2,7) 1. UP BOUND z(77_ATM2,8) 1. UP BOUND z(78_ATM2,9) 1. UP BOUND z(79_ATM2,10) 1. UP BOUND z(80_ATM3,1) 1. UP BOUND z(81_ATM3,2) 1. UP BOUND z(82_ATM3,3) 1. UP BOUND z(83_ATM3,4) 1. UP BOUND z(84_ATM3,5) 1. UP BOUND z(85_ATM3,6) 1. UP BOUND z(86_ATM3,7) 1. UP BOUND z(87_ATM3,8) 1. UP BOUND z(88_ATM3,9) 1. UP BOUND z(89_ATM3,10) 1. UP BOUND z(90_ATM4,1) 1. UP BOUND z(91_ATM4,2) 1. UP BOUND z(92_ATM4,3) 1. UP BOUND z(93_ATM4,4) 1. UP BOUND z(94_ATM4,5) 1. UP BOUND z(95_ATM4,6) 1. UP BOUND z(96_ATM4,7) 1. UP BOUND z(97_ATM4,8) 1. UP BOUND z(98_ATM4,9) 1. UP BOUND z(99_ATM4,10) 1. UP BOUND fm(150_ATM0,DATE0) 780. UP BOUND fm(151_ATM0,DATE1) 2351. UP BOUND fm(152_ATM0,DATE2) 2288. UP BOUND fm(153_ATM0,DATE3) 1357. UP BOUND fm(154_ATM0,DATE4) 3637. UP BOUND fm(155_ATM0,DATE5) 1371. UP BOUND fm(156_ATM0,DATE6) 2225. UP BOUND fm(157_ATM0,DATE7) 1721. UP BOUND fm(158_ATM0,DATE8) 2110. UP BOUND fm(159_ATM0,DATE9) 3118. UP BOUND fm(160_ATM1,DATE0) 2830. UP BOUND fm(161_ATM1,DATE1) 184. UP BOUND fm(162_ATM1,DATE2) 282. UP BOUND fm(163_ATM1,DATE3) 998. UP BOUND fm(164_ATM1,DATE4) 3198. UP BOUND fm(165_ATM1,DATE5) 3170. UP BOUND fm(166_ATM1,DATE6) 2301. UP BOUND fm(167_ATM1,DATE7) 719. UP BOUND fm(168_ATM1,DATE8) 818. UP BOUND fm(169_ATM1,DATE9) 1426. UP BOUND fm(170_ATM2,DATE0) 2803. UP BOUND fm(171_ATM2,DATE1) 1031. UP BOUND fm(172_ATM2,DATE2) 23. UP BOUND fm(173_ATM2,DATE3) 376. UP BOUND fm(174_ATM2,DATE4) 541. UP BOUND fm(175_ATM2,DATE5) 2195. UP BOUND fm(176_ATM2,DATE6) 3676. UP BOUND fm(177_ATM2,DATE7) 2475. UP BOUND fm(178_ATM2,DATE8) 1232. UP BOUND fm(179_ATM2,DATE9) 352. UP BOUND fm(180_ATM3,DATE0) 853. UP BOUND fm(181_ATM3,DATE1) 2310. UP BOUND fm(182_ATM3,DATE2) 3542. UP BOUND fm(183_ATM3,DATE3) 739. UP BOUND fm(184_ATM3,DATE4) 1315. UP BOUND fm(185_ATM3,DATE5) 2929. UP BOUND fm(186_ATM3,DATE6) 2928. UP BOUND fm(187_ATM3,DATE7) 2101. UP BOUND fm(188_ATM3,DATE8) 3522. UP BOUND fm(189_ATM3,DATE9) 319. UP BOUND fm(190_ATM4,DATE0) 1184. UP BOUND fm(191_ATM4,DATE1) 181. UP BOUND fm(192_ATM4,DATE2) 1096. UP BOUND fm(193_ATM4,DATE3) 1568. UP BOUND fm(194_ATM4,DATE4) 2710. UP BOUND fm(195_ATM4,DATE5) 1096. UP BOUND fm(196_ATM4,DATE6) 3834. UP BOUND fm(197_ATM4,DATE7) 4214. UP BOUND fm(198_ATM4,DATE8) 1902. UP BOUND fm(199_ATM4,DATE9) 3280. UP BOUND x2(200_ATM0) 1. UP BOUND x2(201_ATM1) 1. UP BOUND x2(202_ATM2) 1. UP BOUND x2(203_ATM3) 1. UP BOUND x2(204_ATM4) 1. UP BOUND x3(205_ATM0) 1000. UP BOUND x3(206_ATM1) 1000. UP BOUND x3(207_ATM2) 1000. UP BOUND x3(208_ATM3) 1000. UP BOUND x3(209_ATM4) 1000. BV BOUND v(210_ATM0,DATE0) 1. BV BOUND v(211_ATM0,DATE1) 1. BV BOUND v(212_ATM0,DATE2) 1. BV BOUND v(213_ATM0,DATE3) 1. BV BOUND v(214_ATM0,DATE4) 1. BV BOUND v(215_ATM0,DATE5) 1. BV BOUND v(216_ATM0,DATE6) 1. BV BOUND v(217_ATM0,DATE7) 1. BV BOUND v(218_ATM0,DATE8) 1. BV BOUND v(219_ATM0,DATE9) 1. BV BOUND v(220_ATM1,DATE0) 1. BV BOUND v(221_ATM1,DATE1) 1. BV BOUND v(222_ATM1,DATE2) 1. BV BOUND v(223_ATM1,DATE3) 1. BV BOUND v(224_ATM1,DATE4) 1. BV BOUND v(225_ATM1,DATE5) 1. BV BOUND v(226_ATM1,DATE6) 1. BV BOUND v(227_ATM1,DATE7) 1. BV BOUND v(228_ATM1,DATE8) 1. BV BOUND v(229_ATM1,DATE9) 1. BV BOUND v(230_ATM2,DATE0) 1. BV BOUND v(231_ATM2,DATE1) 1. BV BOUND v(232_ATM2,DATE2) 1. BV BOUND v(233_ATM2,DATE3) 1. BV BOUND v(234_ATM2,DATE4) 1. BV BOUND v(235_ATM2,DATE5) 1. BV BOUND v(236_ATM2,DATE6) 1. BV BOUND v(237_ATM2,DATE7) 1. BV BOUND v(238_ATM2,DATE8) 1. BV BOUND v(239_ATM2,DATE9) 1. BV BOUND v(240_ATM3,DATE0) 1. BV BOUND v(241_ATM3,DATE1) 1. BV BOUND v(242_ATM3,DATE2) 1. BV BOUND v(243_ATM3,DATE3) 1. BV BOUND v(244_ATM3,DATE4) 1. BV BOUND v(245_ATM3,DATE5) 1. BV BOUND v(246_ATM3,DATE6) 1. BV BOUND v(247_ATM3,DATE7) 1. BV BOUND v(248_ATM3,DATE8) 1. BV BOUND v(249_ATM3,DATE9) 1. BV BOUND v(250_ATM4,DATE0) 1. BV BOUND v(251_ATM4,DATE1) 1. BV BOUND v(252_ATM4,DATE2) 1. BV BOUND v(253_ATM4,DATE3) 1. BV BOUND v(254_ATM4,DATE4) 1. BV BOUND v(255_ATM4,DATE5) 1. BV BOUND v(256_ATM4,DATE6) 1. BV BOUND v(257_ATM4,DATE7) 1. BV BOUND v(258_ATM4,DATE8) 1. BV BOUND v(259_ATM4,DATE9) 1. ENDATA CoinMP-1.8.3/Data/Sample/Makefile.am0000644000175000017500000000144212053222044015435 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 324 2012-11-21 18:57:40Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # List files that should be distributed # ######################################################################## EXTRA_DIST = $(EXAMPLE_FILES) DISTCLEANFILES = $(EXAMPLE_CLEAN_FILES) datacoindir = $(datadir)/coin/Data/Sample datacoin_DATA = $(EXAMPLE_FILES) pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = coindatasample.pc include BuildTools/Makemain.inc test: @echo "No test available." CoinMP-1.8.3/Data/Sample/p0033.mps0000644000175000017500000001463310430174061014677 0ustar renerene*NAME: p0033 *ROWS: 16 *COLUMNS: 33 *INTEGER: 33 *NONZERO: 98 *BEST SOLN: 3089 (opt) *LP SOLN: 2520.57 *SOURCE: Crowder-Johnson-Padberg test set * * E. Andrew Boyd (Rice University) *APPLICATION: unknown *COMMENTS: pure 0/1 IP * 5 SOS constraints * NAME P0033 ROWS N R100 L R114 L R115 L R116 L R117 L R118 L R119 L R120 L R121 L R122 L R123 L R124 L R125 L R126 L R127 L R128 L ZBESTROW COLUMNS MARK0000 'MARKER' 'INTORG' C157 R100 171 R114 1 C157 R122 -300 R123 -300 C158 R100 171 R114 1 C158 R126 -300 R127 -300 C159 R100 171 R114 1 C159 R119 300 R120 -300 C159 R123 -300 C160 R100 171 R114 1 C160 R119 300 R120 -300 C160 R121 -300 C161 R100 163 R115 1 C161 R119 285 R120 -285 C161 R124 -285 R125 -285 C162 R100 162 R115 1 C162 R119 285 R120 -285 C162 R122 -285 R123 -285 C163 R100 163 R115 1 C163 R128 -285 C164 R100 69 R116 1 C164 R119 265 R120 -265 C164 R124 -265 R125 -265 C165 R100 69 R116 1 C165 R119 265 R120 -265 C165 R122 -265 R123 -265 C166 R100 183 R117 1 C166 R118 -230 C167 R100 183 R117 1 C167 R124 -230 R125 -230 C168 R100 183 R117 1 C168 R119 230 R120 -230 C168 R125 -230 C169 R100 183 R117 1 C169 R119 230 R120 -230 C169 R123 -230 C170 R100 49 R119 190 C170 R120 -190 R122 -190 C170 R123 -190 C171 R100 183 R117 1 C172 R100 258 R118 -200 C173 R100 517 R118 -400 C174 R100 250 R126 -200 C174 R127 -200 C175 R100 500 R126 -400 C175 R127 -400 C176 R100 250 R127 -200 C177 R100 500 R127 -400 C178 R100 159 R119 200 C178 R120 -200 R124 -200 C178 R125 -200 C179 R100 318 R119 400 C179 R120 -400 R124 -400 C179 R125 -400 C180 R100 159 R119 200 C180 R120 -200 R125 -200 C181 R100 318 R119 400 C181 R120 -400 R125 -400 C182 R100 159 R119 200 C182 R120 -200 R122 -200 C182 R123 -200 C183 R100 318 R119 400 C183 R120 -400 R122 -400 C183 R123 -400 C184 R100 159 R119 200 C184 R120 -200 R123 -200 C185 R100 318 R119 400 C185 R120 -400 R123 -400 C186 R100 114 R119 200 C186 R120 -200 R121 -200 C187 R100 228 R119 400 C187 R120 -400 R121 -400 C188 R100 159 R128 -200 C189 R100 318 R128 -400 MARK0001 'MARKER' 'INTEND' RHS RHS R114 1 R115 1 RHS R116 1 R117 1 RHS R118 -5 R119 2700 RHS R120 -2600 R121 -100 RHS R122 -900 R123 -1656 RHS R124 -335 R125 -1026 RHS R126 -5 R127 -500 RHS R128 -270 BOUNDS UP ONE C157 1 UP ONE C158 1 UP ONE C159 1 UP ONE C160 1 UP ONE C161 1 UP ONE C162 1 UP ONE C163 1 UP ONE C164 1 UP ONE C165 1 UP ONE C166 1 UP ONE C167 1 UP ONE C168 1 UP ONE C169 1 UP ONE C170 1 UP ONE C171 1 UP ONE C172 1 UP ONE C173 1 UP ONE C174 1 UP ONE C175 1 UP ONE C176 1 UP ONE C177 1 UP ONE C178 1 UP ONE C179 1 UP ONE C180 1 UP ONE C181 1 UP ONE C182 1 UP ONE C183 1 UP ONE C184 1 UP ONE C185 1 UP ONE C186 1 UP ONE C187 1 UP ONE C188 1 UP ONE C189 1 ENDATA CoinMP-1.8.3/Data/Sample/galenet.mps0000644000175000017500000000211611431323442015543 0ustar renereneNAME galenet ROWS L S1 L S2 L S3 E NODE4 E NODE5 G D6 G D7 G D8 N COST COLUMNS T14 S1 1. NODE4 1. T24 S2 1. NODE4 1. T25 S2 1. NODE5 1. T35 S3 1. NODE5 1. T46 D6 1. NODE4 -1. T47 D7 1. NODE4 -1. T57 D7 1. NODE5 -1. T58 D8 1. NODE5 -1. RHS RHS S1 20. S2 20. RHS S3 20. D6 10. RHS D7 20. D8 30. BOUNDS UP BND T14 30. UP BND T24 20. UP BND T25 10. UP BND T35 10. UP BND T46 10. UP BND T47 2. UP BND T57 20. UP BND T58 30. ENDATA CoinMP-1.8.3/Data/Sample/lseu.mps0000644000175000017500000004211612223473003015077 0ustar renerene*NAME: lseu *ROWS: 28 *COLUMNS: 89 *INTEGER: 89 *NONZERO: 309 *BEST SOLN: 1120 (opt) *LP SOLN: 834.68 *SOURCE: C. E. Lemke and K. Spielberg * Ellis L. Johnson and Uwe H. Suhl * John J. Forrest (IBM) *APPLICATION: unknown *COMMENTS: pure 0/1 IP * * NAME LSEU ROWS N R100 L R101 L R102 L R103 L R104 L R105 L R106 L R107 L R108 L R109 L R110 L R111 L R112 L R113 L R114 L R115 L R116 L R117 L R118 L R119 L R120 L R121 L R122 L R123 L R124 L R125 L R126 L R127 L R128 COLUMNS MARK0000 'MARKER' 'INTORG' C101 R100 7 R119 525 C101 R120 -525 R122 -525 C101 R123 -525 C102 R100 10 R119 500 C102 R120 -500 R122 -500 C102 R123 -500 C103 R100 179 R101 1 C103 R119 475 R120 -475 C103 R124 -475 R125 -475 C104 R100 186 R101 1 C104 R119 475 R120 -475 C104 R122 -475 R123 -475 C105 R100 179 R101 1 C105 R119 475 R120 -475 C105 R122 -190 R123 -190 C105 R124 -285 R125 -285 C106 R102 1 R118 -450 C107 R102 1 R124 -450 C107 R125 -450 C108 R100 6 R102 1 C108 R122 -450 R123 -450 C109 R102 1 R122 -165 C109 R123 -165 R124 -285 C109 R125 -285 C110 R102 1 R124 -150 C110 R125 -150 C111 R100 164 R103 1 C111 R118 -435 C112 R100 164 R103 1 C112 R124 -435 R125 -435 C113 R100 170 R103 1 C113 R119 435 R120 -435 C113 R123 -435 C114 R100 164 R103 1 C114 R119 435 R120 -435 C114 R121 -435 C115 R100 346 R104 1 C115 R124 -435 R125 -435 C116 R100 346 R104 1 C116 R119 435 R120 -435 C116 R125 -435 C117 R100 248 R105 1 C117 R119 435 R120 -435 C117 R124 -435 R125 -435 C118 R100 253 R105 1 C118 R119 435 R120 -435 C118 R122 -435 R123 -435 C119 R100 248 R105 1 C119 R119 435 R120 -435 C119 R122 -300 R123 -300 C119 R124 -135 R125 -135 C120 R100 346 R106 1 C120 R118 -435 C121 R100 346 R106 1 C121 R123 -400 C122 R100 346 R106 1 C122 R121 -400 C123 R100 346 R106 1 C123 R124 -100 R125 -100 C123 R127 -300 C124 R100 160 R107 1 C124 R124 -400 R125 -400 C125 R100 161 R107 1 C125 R122 -400 R123 -400 C126 R100 160 R107 1 C126 R122 -115 R123 -115 C126 R124 -285 R125 -285 C127 R100 160 R107 1 C127 R119 425 R120 -425 C127 R125 -425 C128 R100 161 R107 1 C128 R119 425 R120 -425 C128 R123 -425 C129 R100 160 R107 1 C129 R119 425 R120 -425 C129 R123 -140 R125 -285 C130 R100 160 R107 1 C130 R124 -100 R125 -100 C130 R126 -300 R127 -300 C131 R100 278 R108 1 C131 R118 -350 C132 R100 278 R108 1 C132 R124 -350 R125 -350 C133 R100 278 R108 1 C133 R121 -350 C134 R100 86 R109 1 C134 R122 -330 R123 -330 C135 R100 86 R109 1 C135 R126 -330 R127 -330 C136 R100 86 R109 1 C136 R119 330 R120 -330 C136 R124 -330 R125 -330 C137 R100 86 R109 1 C137 R119 330 R120 -330 C137 R123 -330 C138 R100 86 R109 1 C138 R119 330 R120 -330 C138 R121 -330 C139 R100 86 R119 330 C139 R120 -330 R122 -330 C139 R123 -330 C140 R100 188 R110 1 C140 R122 -330 R123 -330 C141 R100 188 R110 1 C141 R119 330 R120 -330 C141 R124 -330 R125 -330 C142 R100 188 R110 1 C142 R119 330 R120 -330 C142 R121 -330 C143 R100 85 R111 1 C143 R122 -325 R123 -325 C144 R100 85 R111 1 C144 R126 -325 R127 -325 C145 R100 85 R111 1 C145 R119 325 R120 -325 C145 R124 -325 R125 -325 C146 R100 85 R111 1 C146 R119 325 R120 -325 C146 R123 -325 C147 R100 85 R111 1 C147 R119 325 R120 -325 C147 R121 -325 C148 R100 78 R112 1 C148 R122 -300 R123 -300 C149 R100 78 R112 1 C149 R119 300 R120 -300 C149 R124 -300 R125 -300 C150 R100 78 R112 1 C150 R119 300 R120 -300 C150 R121 -300 C151 R100 78 R112 1 C151 R128 -300 C152 R100 78 R113 1 C152 R122 -300 R123 -300 C153 R100 78 R113 1 C153 R126 -300 R127 -300 C154 R100 78 R113 1 C154 R119 300 R120 -300 C154 R124 -300 R125 -300 C155 R100 78 R113 1 C155 R119 300 R120 -300 C155 R123 -300 C156 R100 78 R113 1 C156 R119 300 R120 -300 C156 R121 -300 C157 R100 171 R114 1 C157 R122 -300 R123 -300 C158 R100 171 R114 1 C158 R126 -300 R127 -300 C159 R100 171 R114 1 C159 R119 300 R120 -300 C159 R123 -300 C160 R100 171 R114 1 C160 R119 300 R120 -300 C160 R121 -300 C161 R100 163 R115 1 C161 R119 285 R120 -285 C161 R124 -285 R125 -285 C162 R100 163 R115 1 C162 R119 285 R120 -285 C162 R122 -285 R123 -285 C163 R100 163 R115 1 C163 R128 -285 C164 R100 69 R116 1 C164 R119 265 R120 -265 C164 R124 -265 R125 -265 C165 R100 69 R116 1 C165 R119 265 R120 -265 C165 R122 -265 R123 -265 C166 R100 183 R117 1 C166 R118 -230 C167 R100 183 R117 1 C167 R124 -230 R125 -230 C168 R100 183 R117 1 C168 R119 230 R120 -230 C168 R125 -230 C169 R100 183 R117 1 C169 R119 230 R120 -230 C169 R123 -230 C170 R100 49 R119 190 C170 R120 -190 R122 -190 C170 R123 -190 C171 R100 183 R117 1 C172 R100 258 R118 -200 C173 R100 517 R118 -400 C174 R100 250 R126 -200 C174 R127 -200 C175 R100 500 R126 -400 C175 R127 -400 C176 R100 250 R127 -200 C177 R100 500 R127 -400 C178 R100 159 R119 200 C178 R120 -200 R124 -200 C178 R125 -200 C179 R100 318 R119 400 C179 R120 -400 R124 -400 C179 R125 -400 C180 R100 159 R119 200 C180 R120 -200 R125 -200 C181 R100 318 R119 400 C181 R120 -400 R125 -400 C182 R100 159 R119 200 C182 R120 -200 R122 -200 C182 R123 -200 C183 R100 318 R119 400 C183 R120 -400 R122 -400 C183 R123 -400 C184 R100 159 R119 200 C184 R120 -200 R123 -200 C185 R100 318 R119 400 C185 R120 -400 R123 -400 C186 R100 114 R119 200 C186 R120 -200 R121 -200 C187 R100 228 R119 400 C187 R120 -400 R121 -400 C188 R100 159 R128 -200 C189 R100 318 R128 -400 MARK0001 'MARKER' 'INTEND' RHS RHS R101 1 R102 1 RHS R103 1 R104 1 RHS R105 1 R106 1 RHS R107 1 R108 1 RHS R109 1 R110 1 RHS R111 1 R112 1 RHS R113 1 R114 1 RHS R115 1 R116 1 RHS R117 1 R118 -190 RHS R119 2700 R120 -2600 RHS R121 -630 R122 -900 RHS R123 -1656 R124 -335 RHS R125 -1026 R126 -150 RHS R127 -500 R128 -270 BOUNDS UP ONE C101 1 UP ONE C102 1 UP ONE C103 1 UP ONE C104 1 UP ONE C105 1 UP ONE C106 1 UP ONE C107 1 UP ONE C108 1 UP ONE C109 1 UP ONE C110 1 UP ONE C111 1 UP ONE C112 1 UP ONE C113 1 UP ONE C114 1 UP ONE C115 1 UP ONE C116 1 UP ONE C117 1 UP ONE C118 1 UP ONE C119 1 UP ONE C120 1 UP ONE C121 1 UP ONE C122 1 UP ONE C123 1 UP ONE C124 1 UP ONE C125 1 UP ONE C126 1 UP ONE C127 1 UP ONE C128 1 UP ONE C129 1 UP ONE C130 1 UP ONE C131 1 UP ONE C132 1 UP ONE C133 1 UP ONE C134 1 UP ONE C135 1 UP ONE C136 1 UP ONE C137 1 UP ONE C138 1 UP ONE C139 1 UP ONE C140 1 UP ONE C141 1 UP ONE C142 1 UP ONE C143 1 UP ONE C144 1 UP ONE C145 1 UP ONE C146 1 UP ONE C147 1 UP ONE C148 1 UP ONE C149 1 UP ONE C150 1 UP ONE C151 1 UP ONE C152 1 UP ONE C153 1 UP ONE C154 1 UP ONE C155 1 UP ONE C156 1 UP ONE C157 1 UP ONE C158 1 UP ONE C159 1 UP ONE C160 1 UP ONE C161 1 UP ONE C162 1 UP ONE C163 1 UP ONE C164 1 UP ONE C165 1 UP ONE C166 1 UP ONE C167 1 UP ONE C168 1 UP ONE C169 1 UP ONE C170 1 UP ONE C171 1 UP ONE C172 1 UP ONE C173 1 UP ONE C174 1 UP ONE C175 1 UP ONE C176 1 UP ONE C177 1 UP ONE C178 1 UP ONE C179 1 UP ONE C180 1 UP ONE C181 1 UP ONE C182 1 UP ONE C183 1 UP ONE C184 1 UP ONE C185 1 UP ONE C186 1 UP ONE C187 1 UP ONE C188 1 UP ONE C189 1 ENDATA CoinMP-1.8.3/Data/Sample/depcomp0000755000175000017500000003710011405216230014756 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Data/Sample/app0110.stoch0000755000175000017500000001170711015552002015532 0ustar renereneNAME APP SCENARIOS DISCRETE ADD SC SCEN01 ROOT 0.111 STAGE-2 RHS D00102 -0.667 RHS D00202 -0.667 RHS D00302 -0.667 RHS D00402 -1.333 RHS D00103 0.333 RHS D00203 -1.000 RHS D00303 0.000 RHS D00403 -1.000 RHS D00104 1.333 RHS D00204 -1.667 RHS D00304 1.333 RHS D00404 -0.667 RHS D00105 2.333 RHS D00205 -1.333 RHS D00305 2.667 RHS D00405 -0.333 SC SCEN02 SCEN01 0.111 STAGE-3 RHS D00103 -0.667 RHS D00203 1.000 RHS D00303 0.000 RHS D00403 0.000 RHS D00104 -0.667 RHS D00204 -0.667 RHS D00304 -0.667 RHS D00404 0.333 RHS D00105 -0.667 RHS D00205 -1.333 RHS D00305 -1.333 RHS D00405 0.667 SC SCEN03 SCEN01 0.111 STAGE-3 RHS D00103 0.333 RHS D00203 0.000 RHS D00303 0.000 RHS D00403 1.000 RHS D00104 -0.667 RHS D00204 2.333 RHS D00304 -0.667 RHS D00404 0.333 RHS D00105 -1.667 RHS D00205 2.667 RHS D00305 -1.333 RHS D00405 -0.333 SC SCEN04 ROOT 0.111 STAGE-2 RHS D00102 -0.667 RHS D00202 0.333 RHS D00302 -0.667 RHS D00402 -0.333 RHS D00103 0.333 RHS D00203 -1.000 RHS D00303 0.000 RHS D00403 -1.000 RHS D00104 1.333 RHS D00204 -1.667 RHS D00304 1.333 RHS D00404 -0.667 RHS D00105 2.333 RHS D00205 -1.333 RHS D00305 2.667 RHS D00405 -0.333 SC SCEN05 SCEN04 0.111 STAGE-3 RHS D00103 -0.667 RHS D00203 1.000 RHS D00303 0.000 RHS D00403 0.000 RHS D00104 -0.667 RHS D00204 -0.667 RHS D00304 -0.667 RHS D00404 0.333 RHS D00105 -0.667 RHS D00205 -1.333 RHS D00305 -1.333 RHS D00405 0.667 SC SCEN06 SCEN04 0.111 STAGE-3 RHS D00103 0.333 RHS D00203 0.000 RHS D00303 0.000 RHS D00403 1.000 RHS D00104 -0.667 RHS D00204 2.333 RHS D00304 -0.667 RHS D00404 0.333 RHS D00105 -1.667 RHS D00205 2.667 RHS D00305 -1.333 RHS D00405 -0.333 SC SCEN07 ROOT 0.111 STAGE-2 RHS D00102 1.333 RHS D00202 0.333 RHS D00302 1.333 RHS D00402 1.667 RHS D00103 0.333 RHS D00203 -1.000 RHS D00303 0.000 RHS D00403 -1.000 RHS D00104 1.333 RHS D00204 -1.667 RHS D00304 1.333 RHS D00404 -0.667 RHS D00105 2.333 RHS D00205 -1.333 RHS D00305 2.667 RHS D00405 -0.333 SC SCEN08 SCEN07 0.111 STAGE-3 RHS D00103 -0.667 RHS D00203 1.000 RHS D00303 0.000 RHS D00403 0.000 RHS D00104 -0.667 RHS D00204 -0.667 RHS D00304 -0.667 RHS D00404 0.333 RHS D00105 -0.667 RHS D00205 -1.333 RHS D00305 -1.333 RHS D00405 0.667 SC SCEN09 SCEN07 0.111 STAGE-3 RHS D00103 0.333 RHS D00203 0.000 RHS D00303 0.000 RHS D00403 1.000 RHS D00104 -0.667 RHS D00204 2.333 RHS D00304 -0.667 RHS D00404 0.333 RHS D00105 -1.667 RHS D00205 2.667 RHS D00305 -1.333 RHS D00405 -0.333 ENDATA CoinMP-1.8.3/Data/Sample/tp5.mps0000644000175000017500000000233210430174061014633 0ustar renerene* * small test problem - tp5.mps * * knapsack problem where the greedy cover cut * approach leads to a violated min. cover * NAME tp5 ROWS N obj L knap G r1 G r2 G r3 COLUMNS SET00001 'MARKER' 'INTORG' x1 knap 8.000000 x1 r1 1.000000 x2 knap 7.000000 x2 r2 1.000000 x3 knap 6.000000 x3 r3 1.000000 x4 knap 4.000000 x4 obj -1.000000 x5 knap 6.000000 x5 obj -100.000000 x6 knap 13.500000 x6 obj -10.000000 RHS RHS knap 22.000000 RHS r1 0.900000 RHS r2 0.900000 RHS r3 0.900000 BOUNDS BV ONE x1 1.000000 BV ONE x2 1.000000 BV ONE x3 1.000000 BV ONE x4 1.000000 BV ONE x5 1.000000 BV ONE x6 1.000000 ENDATA CoinMP-1.8.3/Data/Sample/app0110R.stoch0000755000175000017500000001062311015552002015650 0ustar renereneNAME MYSMPS SCENARIOS DISCRETE REPLACE SC SCEN0001 ROOT 0.111 STG00002 RHS R0000010 2 RHS R0000011 1 RHS R0000012 2 RHS R0000013 2 RHS R0000014 3 RHS R0000015 1 RHS R0000017 2 RHS R0000018 4 RHS R0000019 1 RHS R0000020 4 RHS R0000021 2 RHS R0000022 5 RHS R0000023 1 RHS R0000024 5 RHS R0000025 2 SC SCEN0002 SCEN0001 0.111 STG00003 RHS R0000014 2 RHS R0000015 3 RHS R0000018 2 RHS R0000019 2 RHS R0000020 2 RHS R0000021 3 RHS R0000022 2 RHS R0000023 1 RHS R0000024 1 RHS R0000025 3 SC SCEN0003 SCEN0001 0.111 STG00003 RHS R0000014 3 RHS R0000017 4 RHS R0000018 2 RHS R0000019 5 RHS R0000020 2 RHS R0000021 3 RHS R0000022 1 RHS R0000023 5 RHS R0000024 1 RHS R0000025 2 SC SCEN0004 ROOT 0.111 STG00002 RHS R0000010 2 RHS R0000011 2 RHS R0000012 2 RHS R0000013 3 RHS R0000014 3 RHS R0000015 1 RHS R0000017 2 RHS R0000018 4 RHS R0000019 1 RHS R0000020 4 RHS R0000021 2 RHS R0000022 5 RHS R0000023 1 RHS R0000024 5 RHS R0000025 2 SC SCEN0005 SCEN0004 0.111 STG00003 RHS R0000014 2 RHS R0000015 3 RHS R0000018 2 RHS R0000019 2 RHS R0000020 2 RHS R0000021 3 RHS R0000022 2 RHS R0000023 1 RHS R0000024 1 RHS R0000025 3 SC SCEN0006 SCEN0004 0.111 STG00003 RHS R0000014 3 RHS R0000017 4 RHS R0000018 2 RHS R0000019 5 RHS R0000020 2 RHS R0000021 3 RHS R0000022 1 RHS R0000023 5 RHS R0000024 1 RHS R0000025 2 SC SCEN0007 ROOT 0.111 STG00002 RHS R0000010 4 RHS R0000011 2 RHS R0000012 4 RHS R0000013 5 RHS R0000014 3 RHS R0000015 1 RHS R0000017 2 RHS R0000018 4 RHS R0000019 1 RHS R0000020 4 RHS R0000021 2 RHS R0000022 5 RHS R0000023 1 RHS R0000024 5 RHS R0000025 2 SC SCEN0008 SCEN0007 0.111 STG00003 RHS R0000014 2 RHS R0000015 3 RHS R0000018 2 RHS R0000019 2 RHS R0000020 2 RHS R0000021 3 RHS R0000022 2 RHS R0000023 1 RHS R0000024 1 RHS R0000025 3 SC SCEN0009 SCEN0007 0.111 STG00003 RHS R0000014 3 RHS R0000017 4 RHS R0000018 2 RHS R0000019 5 RHS R0000020 2 RHS R0000021 3 RHS R0000022 1 RHS R0000023 5 RHS R0000024 1 RHS R0000025 2 ENDATA CoinMP-1.8.3/Data/Sample/coindatasample-uninstalled.pc.in0000644000175000017500000000023211507632611021642 0ustar renerenedatadir=@ABSBUILDDIR@ Name: Sample Description: Sample models URL: https://projects.coin-or.org/svn/Data/Sample Version: @PACKAGE_VERSION@ Libs: Cflags: CoinMP-1.8.3/Data/Sample/config.sub0000755000175000017500000007772611405216230015406 0ustar renerene#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Data/Sample/conic.mps0000644000175000017500000000334312223473003015221 0ustar renereneNAME ROWS N obj L c1 COLUMNS x0 obj 1 c1 1 INT 'MARKER' 'INTORG' x1 obj -1 c1 10 INT 'MARKER' 'INTEND' * S1 NAME1 'MARKER' 'SOSORG' x2 obj -9 c1 5 x3 obj -6 c1 8 * NAME1 'MARKER' 'SOSEND' x4 obj 1 c1 1 x5 obj -6 c1 8 x6 obj 1 c1 1 x7 obj 1 c1 1 x8 obj -6 c1 8 x9 obj -2 c1 1 x10 obj -3 c1 1 x11 obj -1 c1 -1 x12 obj -2 c1 1 x13 obj -3 c1 1 x14 obj -9 c1 5 RHS rhs c1 10000 RANGES range c1 2000 BOUNDS LI BOUND x1 2 UI BOUND x1 3 SOS S1 set1 x2 x3 S2 set2 x4 20 x5 40 QUADOBJ x6 x6 1 x6 x7 2 x7 x7 7 CSECTION cone1 0.0 QUAD x8 x9 x10 CSECTION cone2 0.0 RQUAD x11 x12 x13 x14 ENDATA CoinMP-1.8.3/Data/Sample/p0201.mps0000644000175000017500000023142210430174061014671 0ustar renerene*NAME: p0201 *ROWS: 133 *COLUMNS: 201 *INTEGER: 201 *NONZERO: 1923 *BEST SOLN: 7615 (opt) *LP SOLN: 6875.0 *SOURCE: Crowder-Johnson-Padberg test set * * E. Andrew Boyd (Rice University) *APPLICATION: unknown *COMMENTS: pure 0/1 IP * 26 SOS constraints * NAME P0201 ROWS N R1001 L R1002 L R1003 L R1004 L R1005 L R1006 L R1007 L R1008 L R1009 L R1010 L R1011 L R1012 L R1013 L R1014 L R1015 L R1016 L R1017 L R1018 L R1019 L R1020 L R1021 L R1022 L R1023 L R1024 L R1025 L R1026 L R1027 L R1028 L R1029 L R1030 L R1031 L R1032 L R1033 L R1034 L R1035 L R1036 L R1037 L R1038 L R1039 L R1040 L R1041 L R1042 L R1043 L R1044 L R1045 L R1046 L R1047 L R1048 L R1049 L R1050 L R1051 L R1052 L R1053 L R1054 L R1055 L R1056 L R1057 L R1058 L R1059 L R1060 L R1061 L R1062 L R1063 L R1064 L R1065 L R1066 L R1067 L R1068 L R1069 L R1070 L R1071 L R1072 L R1073 L R1074 L R1075 L R1076 L R1077 L R1078 L R1079 L R1080 L R1081 L R1082 L R1083 L R1084 L R1085 L R1086 L R1087 L R1088 L R1089 L R1090 L R1091 L R1092 L R1093 L R1094 L R1095 L R1096 L R1097 L R1098 L R1099 L R1100 L R1101 L R1102 L R1103 L R1104 L R1105 L R1106 L R1107 L R1108 L R1109 L R1110 L R1111 L R1112 L R1113 L R1114 L R1115 L R1116 L R1117 L R1118 L R1119 L R1120 L R1121 L R1122 L R1123 L R1124 L R1125 L R1126 L R1127 L R1128 L R1129 L R1130 L R1131 L R1132 L R1133 L R1134 COLUMNS MARK0000 'MARKER' 'INTORG' C1001 R1001 50 R1002 1 C1001 R1045 -1 R1048 -1 C1001 R1051 -1 R1054 -1 C1001 R1057 -1 R1060 -1 C1001 R1063 -1 R1066 -1 C1001 R1069 -1 R1072 -1 C1002 R1001 100 R1002 2 C1002 R1045 -2 R1048 -2 C1002 R1051 -2 R1054 -2 C1002 R1057 -2 R1060 -2 C1002 R1063 -2 R1066 -2 C1002 R1069 -2 R1072 -2 C1003 R1001 200 R1002 4 C1003 R1045 -4 R1048 -4 C1003 R1051 -4 R1054 -4 C1003 R1057 -4 R1060 -4 C1003 R1063 -4 R1066 -4 C1003 R1069 -4 R1072 -4 C1004 R1001 400 R1002 8 C1004 R1045 -8 R1048 -8 C1004 R1051 -8 R1054 -8 C1004 R1057 -8 R1060 -8 C1004 R1063 -8 R1066 -8 C1004 R1069 -8 R1072 -8 C1005 R1001 800 R1002 16 C1005 R1045 -16 R1048 -16 C1005 R1051 -16 R1054 -16 C1005 R1057 -16 R1060 -16 C1005 R1063 -16 R1066 -16 C1005 R1069 -16 R1072 -16 C1006 R1001 1600 R1002 32 C1006 R1045 -32 R1048 -32 C1006 R1051 -32 R1054 -32 C1006 R1057 -32 R1060 -32 C1006 R1063 -32 R1066 -32 C1006 R1069 -32 R1072 -32 C1007 R1001 3200 R1002 64 C1007 R1045 -64 R1048 -64 C1007 R1051 -64 R1054 -64 C1007 R1057 -64 R1060 -64 C1007 R1063 -64 R1066 -64 C1007 R1069 -64 R1072 -64 C1008 R1001 50 R1003 1 C1008 R1046 -1 R1049 -1 C1008 R1052 -1 R1055 -1 C1008 R1058 -1 R1061 -1 C1008 R1064 -1 R1067 -1 C1008 R1070 -1 R1073 -1 C1009 R1001 100 R1003 2 C1009 R1046 -2 R1049 -2 C1009 R1052 -2 R1055 -2 C1009 R1058 -2 R1061 -2 C1009 R1064 -2 R1067 -2 C1009 R1070 -2 R1073 -2 C1010 R1001 200 R1003 4 C1010 R1046 -4 R1049 -4 C1010 R1052 -4 R1055 -4 C1010 R1058 -4 R1061 -4 C1010 R1064 -4 R1067 -4 C1010 R1070 -4 R1073 -4 C1011 R1001 400 R1003 8 C1011 R1046 -8 R1049 -8 C1011 R1052 -8 R1055 -8 C1011 R1058 -8 R1061 -8 C1011 R1064 -8 R1067 -8 C1011 R1070 -8 R1073 -8 C1012 R1001 800 R1003 16 C1012 R1046 -16 R1049 -16 C1012 R1052 -16 R1055 -16 C1012 R1058 -16 R1061 -16 C1012 R1064 -16 R1067 -16 C1012 R1070 -16 R1073 -16 C1013 R1001 1600 R1003 32 C1013 R1046 -32 R1049 -32 C1013 R1052 -32 R1055 -32 C1013 R1058 -32 R1061 -32 C1013 R1064 -32 R1067 -32 C1013 R1070 -32 R1073 -32 C1014 R1001 3200 R1003 64 C1014 R1046 -64 R1049 -64 C1014 R1052 -64 R1055 -64 C1014 R1058 -64 R1061 -64 C1014 R1064 -64 R1067 -64 C1014 R1070 -64 R1073 -64 C1015 R1001 150 R1004 1 C1015 R1047 -1 R1050 -1 C1015 R1053 -1 R1056 -1 C1015 R1059 -1 R1062 -1 C1015 R1065 -1 R1068 -1 C1015 R1071 -1 R1074 -1 C1016 R1001 300 R1004 2 C1016 R1047 -2 R1050 -2 C1016 R1053 -2 R1056 -2 C1016 R1059 -2 R1062 -2 C1016 R1065 -2 R1068 -2 C1016 R1071 -2 R1074 -2 C1017 R1001 600 R1004 4 C1017 R1047 -4 R1050 -4 C1017 R1053 -4 R1056 -4 C1017 R1059 -4 R1062 -4 C1017 R1065 -4 R1068 -4 C1017 R1071 -4 R1074 -4 C1018 R1001 1200 R1004 8 C1018 R1047 -8 R1050 -8 C1018 R1053 -8 R1056 -8 C1018 R1059 -8 R1062 -8 C1018 R1065 -8 R1068 -8 C1018 R1071 -8 R1074 -8 C1019 R1001 2400 R1004 16 C1019 R1047 -16 R1050 -16 C1019 R1053 -16 R1056 -16 C1019 R1059 -16 R1062 -16 C1019 R1065 -16 R1068 -16 C1019 R1071 -16 R1074 -16 C1020 R1001 4800 R1004 32 C1020 R1047 -32 R1050 -32 C1020 R1053 -32 R1056 -32 C1020 R1059 -32 R1062 -32 C1020 R1065 -32 R1068 -32 C1020 R1071 -32 R1074 -32 C1021 R1001 9600 R1004 64 C1021 R1047 -64 R1050 -64 C1021 R1053 -64 R1056 -64 C1021 R1059 -64 R1062 -64 C1021 R1065 -64 R1068 -64 C1021 R1071 -64 R1074 -64 C1022 R1001 500 R1005 1 C1022 R1006 -1 R1045 -10 C1022 R1048 -10 R1051 -10 C1022 R1054 -10 R1057 -10 C1022 R1060 -10 R1063 -10 C1022 R1066 -10 R1069 -10 C1022 R1072 -10 R1075 1 C1022 R1081 -1 C1023 R1001 560 R1005 1 C1023 R1006 -1 R1045 -10 C1023 R1048 -10 R1051 -10 C1023 R1054 -10 R1057 -10 C1023 R1060 -10 R1063 -10 C1023 R1066 -10 R1069 -10 C1023 R1072 -10 R1076 1 C1023 R1081 -1 C1024 R1001 600 R1005 1 C1024 R1006 -1 R1045 -10 C1024 R1048 -10 R1051 -10 C1024 R1054 -10 R1057 -10 C1024 R1060 -10 R1063 -10 C1024 R1066 -10 R1069 -10 C1024 R1072 -10 R1077 1 C1024 R1081 -1 C1025 R1001 560 R1005 1 C1025 R1006 -1 R1046 -10 C1025 R1049 -10 R1052 -10 C1025 R1055 -10 R1058 -10 C1025 R1061 -10 R1064 -10 C1025 R1067 -10 R1070 -10 C1025 R1073 -10 R1075 1 C1025 R1082 -1 C1026 R1001 500 R1005 1 C1026 R1006 -1 R1046 -10 C1026 R1049 -10 R1052 -10 C1026 R1055 -10 R1058 -10 C1026 R1061 -10 R1064 -10 C1026 R1067 -10 R1070 -10 C1026 R1073 -10 R1076 1 C1026 R1082 -1 C1027 R1001 600 R1005 1 C1027 R1006 -1 R1046 -10 C1027 R1049 -10 R1052 -10 C1027 R1055 -10 R1058 -10 C1027 R1061 -10 R1064 -10 C1027 R1067 -10 R1070 -10 C1027 R1073 -10 R1077 1 C1027 R1082 -1 C1028 R1001 850 R1005 1 C1028 R1006 -1 R1047 -5 C1028 R1050 -5 R1053 -5 C1028 R1056 -5 R1059 -5 C1028 R1062 -5 R1065 -5 C1028 R1068 -5 R1071 -5 C1028 R1074 -5 R1075 1 C1028 R1083 -1 C1029 R1001 850 R1005 1 C1029 R1006 -1 R1047 -5 C1029 R1050 -5 R1053 -5 C1029 R1056 -5 R1059 -5 C1029 R1062 -5 R1065 -5 C1029 R1068 -5 R1071 -5 C1029 R1074 -5 R1076 1 C1029 R1083 -1 C1030 R1001 750 R1005 1 C1030 R1006 -1 R1047 -5 C1030 R1050 -5 R1053 -5 C1030 R1056 -5 R1059 -5 C1030 R1062 -5 R1065 -5 C1030 R1068 -5 R1071 -5 C1030 R1074 -5 R1077 1 C1030 R1083 -1 C1031 R1001 500 R1007 1 C1031 R1008 -1 R1045 -10 C1031 R1048 -10 R1051 -10 C1031 R1054 -10 R1057 -10 C1031 R1060 -10 R1063 -10 C1031 R1066 -10 R1069 -10 C1031 R1072 -10 R1078 1 C1031 R1084 -1 C1032 R1001 560 R1007 1 C1032 R1008 -1 R1045 -10 C1032 R1048 -10 R1051 -10 C1032 R1054 -10 R1057 -10 C1032 R1060 -10 R1063 -10 C1032 R1066 -10 R1069 -10 C1032 R1072 -10 R1079 1 C1032 R1084 -1 C1033 R1001 600 R1007 1 C1033 R1008 -1 R1045 -10 C1033 R1048 -10 R1051 -10 C1033 R1054 -10 R1057 -10 C1033 R1060 -10 R1063 -10 C1033 R1066 -10 R1069 -10 C1033 R1072 -10 R1080 1 C1033 R1084 -1 C1034 R1001 560 R1007 1 C1034 R1008 -1 R1046 -10 C1034 R1049 -10 R1052 -10 C1034 R1055 -10 R1058 -10 C1034 R1061 -10 R1064 -10 C1034 R1067 -10 R1070 -10 C1034 R1073 -10 R1078 1 C1034 R1085 -1 C1035 R1001 500 R1007 1 C1035 R1008 -1 R1046 -10 C1035 R1049 -10 R1052 -10 C1035 R1055 -10 R1058 -10 C1035 R1061 -10 R1064 -10 C1035 R1067 -10 R1070 -10 C1035 R1073 -10 R1079 1 C1035 R1085 -1 C1036 R1001 600 R1007 1 C1036 R1008 -1 R1046 -10 C1036 R1049 -10 R1052 -10 C1036 R1055 -10 R1058 -10 C1036 R1061 -10 R1064 -10 C1036 R1067 -10 R1070 -10 C1036 R1073 -10 R1080 1 C1036 R1085 -1 C1037 R1001 850 R1007 1 C1037 R1008 -1 R1047 -5 C1037 R1050 -5 R1053 -5 C1037 R1056 -5 R1059 -5 C1037 R1062 -5 R1065 -5 C1037 R1068 -5 R1071 -5 C1037 R1074 -5 R1078 1 C1037 R1086 -1 C1038 R1001 850 R1007 1 C1038 R1008 -1 R1047 -5 C1038 R1050 -5 R1053 -5 C1038 R1056 -5 R1059 -5 C1038 R1062 -5 R1065 -5 C1038 R1068 -5 R1071 -5 C1038 R1074 -5 R1079 1 C1038 R1086 -1 C1039 R1001 750 R1007 1 C1039 R1008 -1 R1047 -5 C1039 R1050 -5 R1053 -5 C1039 R1056 -5 R1059 -5 C1039 R1062 -5 R1065 -5 C1039 R1068 -5 R1071 -5 C1039 R1074 -5 R1080 1 C1039 R1086 -1 C1040 R1001 450 R1009 1 C1040 R1010 -1 R1048 -10 C1040 R1051 -10 R1054 -10 C1040 R1057 -10 R1060 -10 C1040 R1063 -10 R1066 -10 C1040 R1069 -10 R1072 -10 C1040 R1081 1 R1087 -1 C1041 R1001 510 R1009 1 C1041 R1010 -1 R1048 -10 C1041 R1051 -10 R1054 -10 C1041 R1057 -10 R1060 -10 C1041 R1063 -10 R1066 -10 C1041 R1069 -10 R1072 -10 C1041 R1082 1 R1087 -1 C1042 R1001 550 R1009 1 C1042 R1010 -1 R1048 -10 C1042 R1051 -10 R1054 -10 C1042 R1057 -10 R1060 -10 C1042 R1063 -10 R1066 -10 C1042 R1069 -10 R1072 -10 C1042 R1083 1 R1087 -1 C1043 R1001 510 R1009 1 C1043 R1010 -1 R1049 -10 C1043 R1052 -10 R1055 -10 C1043 R1058 -10 R1061 -10 C1043 R1064 -10 R1067 -10 C1043 R1070 -10 R1073 -10 C1043 R1081 1 R1088 -1 C1044 R1001 450 R1009 1 C1044 R1010 -1 R1049 -10 C1044 R1052 -10 R1055 -10 C1044 R1058 -10 R1061 -10 C1044 R1064 -10 R1067 -10 C1044 R1070 -10 R1073 -10 C1044 R1082 1 R1088 -1 C1045 R1001 550 R1009 1 C1045 R1010 -1 R1049 -10 C1045 R1052 -10 R1055 -10 C1045 R1058 -10 R1061 -10 C1045 R1064 -10 R1067 -10 C1045 R1070 -10 R1073 -10 C1045 R1083 1 R1088 -1 C1046 R1001 775 R1009 1 C1046 R1010 -1 R1050 -5 C1046 R1053 -5 R1056 -5 C1046 R1059 -5 R1062 -5 C1046 R1065 -5 R1068 -5 C1046 R1071 -5 R1074 -5 C1046 R1081 1 R1089 -1 C1047 R1001 775 R1009 1 C1047 R1010 -1 R1050 -5 C1047 R1053 -5 R1056 -5 C1047 R1059 -5 R1062 -5 C1047 R1065 -5 R1068 -5 C1047 R1071 -5 R1074 -5 C1047 R1082 1 R1089 -1 C1048 R1001 675 R1009 1 C1048 R1010 -1 R1050 -5 C1048 R1053 -5 R1056 -5 C1048 R1059 -5 R1062 -5 C1048 R1065 -5 R1068 -5 C1048 R1071 -5 R1074 -5 C1048 R1083 1 R1089 -1 C1049 R1001 450 R1011 1 C1049 R1012 -1 R1048 -10 C1049 R1051 -10 R1054 -10 C1049 R1057 -10 R1060 -10 C1049 R1063 -10 R1066 -10 C1049 R1069 -10 R1072 -10 C1049 R1084 1 R1090 -1 C1050 R1001 510 R1011 1 C1050 R1012 -1 R1048 -10 C1050 R1051 -10 R1054 -10 C1050 R1057 -10 R1060 -10 C1050 R1063 -10 R1066 -10 C1050 R1069 -10 R1072 -10 C1050 R1085 1 R1090 -1 C1051 R1001 550 R1011 1 C1051 R1012 -1 R1048 -10 C1051 R1051 -10 R1054 -10 C1051 R1057 -10 R1060 -10 C1051 R1063 -10 R1066 -10 C1051 R1069 -10 R1072 -10 C1051 R1086 1 R1090 -1 C1052 R1001 510 R1011 1 C1052 R1012 -1 R1049 -10 C1052 R1052 -10 R1055 -10 C1052 R1058 -10 R1061 -10 C1052 R1064 -10 R1067 -10 C1052 R1070 -10 R1073 -10 C1052 R1084 1 R1091 -1 C1053 R1001 450 R1011 1 C1053 R1012 -1 R1049 -10 C1053 R1052 -10 R1055 -10 C1053 R1058 -10 R1061 -10 C1053 R1064 -10 R1067 -10 C1053 R1070 -10 R1073 -10 C1053 R1085 1 R1091 -1 C1054 R1001 550 R1011 1 C1054 R1012 -1 R1049 -10 C1054 R1052 -10 R1055 -10 C1054 R1058 -10 R1061 -10 C1054 R1064 -10 R1067 -10 C1054 R1070 -10 R1073 -10 C1054 R1086 1 R1091 -1 C1055 R1001 775 R1011 1 C1055 R1012 -1 R1050 -5 C1055 R1053 -5 R1056 -5 C1055 R1059 -5 R1062 -5 C1055 R1065 -5 R1068 -5 C1055 R1071 -5 R1074 -5 C1055 R1084 1 R1092 -1 C1056 R1001 775 R1011 1 C1056 R1012 -1 R1050 -5 C1056 R1053 -5 R1056 -5 C1056 R1059 -5 R1062 -5 C1056 R1065 -5 R1068 -5 C1056 R1071 -5 R1074 -5 C1056 R1085 1 R1092 -1 C1057 R1001 675 R1011 1 C1057 R1012 -1 R1050 -5 C1057 R1053 -5 R1056 -5 C1057 R1059 -5 R1062 -5 C1057 R1065 -5 R1068 -5 C1057 R1071 -5 R1074 -5 C1057 R1086 1 R1092 -1 C1058 R1001 400 R1013 1 C1058 R1014 -1 R1051 -10 C1058 R1054 -10 R1057 -10 C1058 R1060 -10 R1063 -10 C1058 R1066 -10 R1069 -10 C1058 R1072 -10 R1087 1 C1058 R1093 -1 C1059 R1001 460 R1013 1 C1059 R1014 -1 R1051 -10 C1059 R1054 -10 R1057 -10 C1059 R1060 -10 R1063 -10 C1059 R1066 -10 R1069 -10 C1059 R1072 -10 R1088 1 C1059 R1093 -1 C1060 R1001 500 R1013 1 C1060 R1014 -1 R1051 -10 C1060 R1054 -10 R1057 -10 C1060 R1060 -10 R1063 -10 C1060 R1066 -10 R1069 -10 C1060 R1072 -10 R1089 1 C1060 R1093 -1 C1061 R1001 460 R1013 1 C1061 R1014 -1 R1052 -10 C1061 R1055 -10 R1058 -10 C1061 R1061 -10 R1064 -10 C1061 R1067 -10 R1070 -10 C1061 R1073 -10 R1087 1 C1061 R1094 -1 C1062 R1001 400 R1013 1 C1062 R1014 -1 R1052 -10 C1062 R1055 -10 R1058 -10 C1062 R1061 -10 R1064 -10 C1062 R1067 -10 R1070 -10 C1062 R1073 -10 R1088 1 C1062 R1094 -1 C1063 R1001 500 R1013 1 C1063 R1014 -1 R1052 -10 C1063 R1055 -10 R1058 -10 C1063 R1061 -10 R1064 -10 C1063 R1067 -10 R1070 -10 C1063 R1073 -10 R1089 1 C1063 R1094 -1 C1064 R1001 700 R1013 1 C1064 R1014 -1 R1053 -5 C1064 R1056 -5 R1059 -5 C1064 R1062 -5 R1065 -5 C1064 R1068 -5 R1071 -5 C1064 R1074 -5 R1087 1 C1064 R1095 -1 C1065 R1001 700 R1013 1 C1065 R1014 -1 R1053 -5 C1065 R1056 -5 R1059 -5 C1065 R1062 -5 R1065 -5 C1065 R1068 -5 R1071 -5 C1065 R1074 -5 R1088 1 C1065 R1095 -1 C1066 R1001 600 R1013 1 C1066 R1014 -1 R1053 -5 C1066 R1056 -5 R1059 -5 C1066 R1062 -5 R1065 -5 C1066 R1068 -5 R1071 -5 C1066 R1074 -5 R1089 1 C1066 R1095 -1 C1067 R1001 400 R1015 1 C1067 R1016 -1 R1051 -10 C1067 R1054 -10 R1057 -10 C1067 R1060 -10 R1063 -10 C1067 R1066 -10 R1069 -10 C1067 R1072 -10 R1090 1 C1067 R1096 -1 C1068 R1001 460 R1015 1 C1068 R1016 -1 R1051 -10 C1068 R1054 -10 R1057 -10 C1068 R1060 -10 R1063 -10 C1068 R1066 -10 R1069 -10 C1068 R1072 -10 R1091 1 C1068 R1096 -1 C1069 R1001 500 R1015 1 C1069 R1016 -1 R1051 -10 C1069 R1054 -10 R1057 -10 C1069 R1060 -10 R1063 -10 C1069 R1066 -10 R1069 -10 C1069 R1072 -10 R1092 1 C1069 R1096 -1 C1070 R1001 460 R1015 1 C1070 R1016 -1 R1052 -10 C1070 R1055 -10 R1058 -10 C1070 R1061 -10 R1064 -10 C1070 R1067 -10 R1070 -10 C1070 R1073 -10 R1090 1 C1070 R1097 -1 C1071 R1001 400 R1015 1 C1071 R1016 -1 R1052 -10 C1071 R1055 -10 R1058 -10 C1071 R1061 -10 R1064 -10 C1071 R1067 -10 R1070 -10 C1071 R1073 -10 R1091 1 C1071 R1097 -1 C1072 R1001 500 R1015 1 C1072 R1016 -1 R1052 -10 C1072 R1055 -10 R1058 -10 C1072 R1061 -10 R1064 -10 C1072 R1067 -10 R1070 -10 C1072 R1073 -10 R1092 1 C1072 R1097 -1 C1073 R1001 700 R1015 1 C1073 R1016 -1 R1053 -5 C1073 R1056 -5 R1059 -5 C1073 R1062 -5 R1065 -5 C1073 R1068 -5 R1071 -5 C1073 R1074 -5 R1090 1 C1073 R1098 -1 C1074 R1001 700 R1015 1 C1074 R1016 -1 R1053 -5 C1074 R1056 -5 R1059 -5 C1074 R1062 -5 R1065 -5 C1074 R1068 -5 R1071 -5 C1074 R1074 -5 R1091 1 C1074 R1098 -1 C1075 R1001 600 R1015 1 C1075 R1016 -1 R1053 -5 C1075 R1056 -5 R1059 -5 C1075 R1062 -5 R1065 -5 C1075 R1068 -5 R1071 -5 C1075 R1074 -5 R1092 1 C1075 R1098 -1 C1076 R1001 350 R1017 1 C1076 R1018 -1 R1054 -10 C1076 R1057 -10 R1060 -10 C1076 R1063 -10 R1066 -10 C1076 R1069 -10 R1072 -10 C1076 R1093 1 R1099 -1 C1077 R1001 410 R1017 1 C1077 R1018 -1 R1054 -10 C1077 R1057 -10 R1060 -10 C1077 R1063 -10 R1066 -10 C1077 R1069 -10 R1072 -10 C1077 R1094 1 R1099 -1 C1078 R1001 450 R1017 1 C1078 R1018 -1 R1054 -10 C1078 R1057 -10 R1060 -10 C1078 R1063 -10 R1066 -10 C1078 R1069 -10 R1072 -10 C1078 R1095 1 R1099 -1 C1079 R1001 410 R1017 1 C1079 R1018 -1 R1055 -10 C1079 R1058 -10 R1061 -10 C1079 R1064 -10 R1067 -10 C1079 R1070 -10 R1073 -10 C1079 R1093 1 R1100 -1 C1080 R1001 350 R1017 1 C1080 R1018 -1 R1055 -10 C1080 R1058 -10 R1061 -10 C1080 R1064 -10 R1067 -10 C1080 R1070 -10 R1073 -10 C1080 R1094 1 R1100 -1 C1081 R1001 450 R1017 1 C1081 R1018 -1 R1055 -10 C1081 R1058 -10 R1061 -10 C1081 R1064 -10 R1067 -10 C1081 R1070 -10 R1073 -10 C1081 R1095 1 R1100 -1 C1082 R1001 625 R1017 1 C1082 R1018 -1 R1056 -5 C1082 R1059 -5 R1062 -5 C1082 R1065 -5 R1068 -5 C1082 R1071 -5 R1074 -5 C1082 R1093 1 R1101 -1 C1083 R1001 625 R1017 1 C1083 R1018 -1 R1056 -5 C1083 R1059 -5 R1062 -5 C1083 R1065 -5 R1068 -5 C1083 R1071 -5 R1074 -5 C1083 R1094 1 R1101 -1 C1084 R1001 525 R1017 1 C1084 R1018 -1 R1056 -5 C1084 R1059 -5 R1062 -5 C1084 R1065 -5 R1068 -5 C1084 R1071 -5 R1074 -5 C1084 R1095 1 R1101 -1 C1085 R1001 350 R1019 1 C1085 R1020 -1 R1054 -10 C1085 R1057 -10 R1060 -10 C1085 R1063 -10 R1066 -10 C1085 R1069 -10 R1072 -10 C1085 R1096 1 R1102 -1 C1086 R1001 410 R1019 1 C1086 R1020 -1 R1054 -10 C1086 R1057 -10 R1060 -10 C1086 R1063 -10 R1066 -10 C1086 R1069 -10 R1072 -10 C1086 R1097 1 R1102 -1 C1087 R1001 450 R1019 1 C1087 R1020 -1 R1054 -10 C1087 R1057 -10 R1060 -10 C1087 R1063 -10 R1066 -10 C1087 R1069 -10 R1072 -10 C1087 R1098 1 R1102 -1 C1088 R1001 410 R1019 1 C1088 R1020 -1 R1055 -10 C1088 R1058 -10 R1061 -10 C1088 R1064 -10 R1067 -10 C1088 R1070 -10 R1073 -10 C1088 R1096 1 R1103 -1 C1089 R1001 350 R1019 1 C1089 R1020 -1 R1055 -10 C1089 R1058 -10 R1061 -10 C1089 R1064 -10 R1067 -10 C1089 R1070 -10 R1073 -10 C1089 R1097 1 R1103 -1 C1090 R1001 450 R1019 1 C1090 R1020 -1 R1055 -10 C1090 R1058 -10 R1061 -10 C1090 R1064 -10 R1067 -10 C1090 R1070 -10 R1073 -10 C1090 R1098 1 R1103 -1 C1091 R1001 625 R1019 1 C1091 R1020 -1 R1056 -5 C1091 R1059 -5 R1062 -5 C1091 R1065 -5 R1068 -5 C1091 R1071 -5 R1074 -5 C1091 R1096 1 R1104 -1 C1092 R1001 625 R1019 1 C1092 R1020 -1 R1056 -5 C1092 R1059 -5 R1062 -5 C1092 R1065 -5 R1068 -5 C1092 R1071 -5 R1074 -5 C1092 R1097 1 R1104 -1 C1093 R1001 525 R1019 1 C1093 R1020 -1 R1056 -5 C1093 R1059 -5 R1062 -5 C1093 R1065 -5 R1068 -5 C1093 R1071 -5 R1074 -5 C1093 R1098 1 R1104 -1 C1094 R1001 300 R1021 1 C1094 R1022 -1 R1057 -10 C1094 R1060 -10 R1063 -10 C1094 R1066 -10 R1069 -10 C1094 R1072 -10 R1099 1 C1094 R1105 -1 C1095 R1001 360 R1021 1 C1095 R1022 -1 R1057 -10 C1095 R1060 -10 R1063 -10 C1095 R1066 -10 R1069 -10 C1095 R1072 -10 R1100 1 C1095 R1105 -1 C1096 R1001 400 R1021 1 C1096 R1022 -1 R1057 -10 C1096 R1060 -10 R1063 -10 C1096 R1066 -10 R1069 -10 C1096 R1072 -10 R1101 1 C1096 R1105 -1 C1097 R1001 360 R1021 1 C1097 R1022 -1 R1058 -10 C1097 R1061 -10 R1064 -10 C1097 R1067 -10 R1070 -10 C1097 R1073 -10 R1099 1 C1097 R1106 -1 C1098 R1001 300 R1021 1 C1098 R1022 -1 R1058 -10 C1098 R1061 -10 R1064 -10 C1098 R1067 -10 R1070 -10 C1098 R1073 -10 R1100 1 C1098 R1106 -1 C1099 R1001 400 R1021 1 C1099 R1022 -1 R1058 -10 C1099 R1061 -10 R1064 -10 C1099 R1067 -10 R1070 -10 C1099 R1073 -10 R1101 1 C1099 R1106 -1 C1100 R1001 550 R1021 1 C1100 R1022 -1 R1059 -5 C1100 R1062 -5 R1065 -5 C1100 R1068 -5 R1071 -5 C1100 R1074 -5 R1099 1 C1100 R1107 -1 C1101 R1001 550 R1021 1 C1101 R1022 -1 R1059 -5 C1101 R1062 -5 R1065 -5 C1101 R1068 -5 R1071 -5 C1101 R1074 -5 R1100 1 C1101 R1107 -1 C1102 R1001 450 R1021 1 C1102 R1022 -1 R1059 -5 C1102 R1062 -5 R1065 -5 C1102 R1068 -5 R1071 -5 C1102 R1074 -5 R1101 1 C1102 R1107 -1 C1103 R1001 300 R1023 1 C1103 R1024 -1 R1057 -10 C1103 R1060 -10 R1063 -10 C1103 R1066 -10 R1069 -10 C1103 R1072 -10 R1102 1 C1103 R1108 -1 C1104 R1001 360 R1023 1 C1104 R1024 -1 R1057 -10 C1104 R1060 -10 R1063 -10 C1104 R1066 -10 R1069 -10 C1104 R1072 -10 R1103 1 C1104 R1108 -1 C1105 R1001 400 R1023 1 C1105 R1024 -1 R1057 -10 C1105 R1060 -10 R1063 -10 C1105 R1066 -10 R1069 -10 C1105 R1072 -10 R1104 1 C1105 R1108 -1 C1106 R1001 360 R1023 1 C1106 R1024 -1 R1058 -10 C1106 R1061 -10 R1064 -10 C1106 R1067 -10 R1070 -10 C1106 R1073 -10 R1102 1 C1106 R1109 -1 C1107 R1001 300 R1023 1 C1107 R1024 -1 R1058 -10 C1107 R1061 -10 R1064 -10 C1107 R1067 -10 R1070 -10 C1107 R1073 -10 R1103 1 C1107 R1109 -1 C1108 R1001 400 R1023 1 C1108 R1024 -1 R1058 -10 C1108 R1061 -10 R1064 -10 C1108 R1067 -10 R1070 -10 C1108 R1073 -10 R1104 1 C1108 R1109 -1 C1109 R1001 550 R1023 1 C1109 R1024 -1 R1059 -5 C1109 R1062 -5 R1065 -5 C1109 R1068 -5 R1071 -5 C1109 R1074 -5 R1102 1 C1109 R1110 -1 C1110 R1001 550 R1023 1 C1110 R1024 -1 R1059 -5 C1110 R1062 -5 R1065 -5 C1110 R1068 -5 R1071 -5 C1110 R1074 -5 R1103 1 C1110 R1110 -1 C1111 R1001 450 R1023 1 C1111 R1024 -1 R1059 -5 C1111 R1062 -5 R1065 -5 C1111 R1068 -5 R1071 -5 C1111 R1074 -5 R1104 1 C1111 R1110 -1 C1112 R1001 250 R1025 1 C1112 R1026 -1 R1060 -10 C1112 R1063 -10 R1066 -10 C1112 R1069 -10 R1072 -10 C1112 R1105 1 R1111 -1 C1113 R1001 310 R1025 1 C1113 R1026 -1 R1060 -10 C1113 R1063 -10 R1066 -10 C1113 R1069 -10 R1072 -10 C1113 R1106 1 R1111 -1 C1114 R1001 350 R1025 1 C1114 R1026 -1 R1060 -10 C1114 R1063 -10 R1066 -10 C1114 R1069 -10 R1072 -10 C1114 R1107 1 R1111 -1 C1115 R1001 310 R1025 1 C1115 R1026 -1 R1061 -10 C1115 R1064 -10 R1067 -10 C1115 R1070 -10 R1073 -10 C1115 R1105 1 R1112 -1 C1116 R1001 250 R1025 1 C1116 R1026 -1 R1061 -10 C1116 R1064 -10 R1067 -10 C1116 R1070 -10 R1073 -10 C1116 R1106 1 R1112 -1 C1117 R1001 350 R1025 1 C1117 R1026 -1 R1061 -10 C1117 R1064 -10 R1067 -10 C1117 R1070 -10 R1073 -10 C1117 R1107 1 R1112 -1 C1118 R1001 475 R1025 1 C1118 R1026 -1 R1062 -5 C1118 R1065 -5 R1068 -5 C1118 R1071 -5 R1074 -5 C1118 R1105 1 R1113 -1 C1119 R1001 475 R1025 1 C1119 R1026 -1 R1062 -5 C1119 R1065 -5 R1068 -5 C1119 R1071 -5 R1074 -5 C1119 R1106 1 R1113 -1 C1120 R1001 375 R1025 1 C1120 R1026 -1 R1062 -5 C1120 R1065 -5 R1068 -5 C1120 R1071 -5 R1074 -5 C1120 R1107 1 R1113 -1 C1121 R1001 250 R1027 1 C1121 R1028 -1 R1060 -10 C1121 R1063 -10 R1066 -10 C1121 R1069 -10 R1072 -10 C1121 R1108 1 R1114 -1 C1122 R1001 310 R1027 1 C1122 R1028 -1 R1060 -10 C1122 R1063 -10 R1066 -10 C1122 R1069 -10 R1072 -10 C1122 R1109 1 R1114 -1 C1123 R1001 350 R1027 1 C1123 R1028 -1 R1060 -10 C1123 R1063 -10 R1066 -10 C1123 R1069 -10 R1072 -10 C1123 R1110 1 R1114 -1 C1124 R1001 310 R1027 1 C1124 R1028 -1 R1061 -10 C1124 R1064 -10 R1067 -10 C1124 R1070 -10 R1073 -10 C1124 R1108 1 R1115 -1 C1125 R1001 250 R1027 1 C1125 R1028 -1 R1061 -10 C1125 R1064 -10 R1067 -10 C1125 R1070 -10 R1073 -10 C1125 R1109 1 R1115 -1 C1126 R1001 350 R1027 1 C1126 R1028 -1 R1061 -10 C1126 R1064 -10 R1067 -10 C1126 R1070 -10 R1073 -10 C1126 R1110 1 R1115 -1 C1127 R1001 475 R1027 1 C1127 R1028 -1 R1062 -5 C1127 R1065 -5 R1068 -5 C1127 R1071 -5 R1074 -5 C1127 R1108 1 R1116 -1 C1128 R1001 475 R1027 1 C1128 R1028 -1 R1062 -5 C1128 R1065 -5 R1068 -5 C1128 R1071 -5 R1074 -5 C1128 R1109 1 R1116 -1 C1129 R1001 375 R1027 1 C1129 R1028 -1 R1062 -5 C1129 R1065 -5 R1068 -5 C1129 R1071 -5 R1074 -5 C1129 R1110 1 R1116 -1 C1130 R1001 200 R1029 1 C1130 R1030 -1 R1063 -10 C1130 R1066 -10 R1069 -10 C1130 R1072 -10 R1111 1 C1130 R1117 -1 C1131 R1001 260 R1029 1 C1131 R1030 -1 R1063 -10 C1131 R1066 -10 R1069 -10 C1131 R1072 -10 R1112 1 C1131 R1117 -1 C1132 R1001 300 R1029 1 C1132 R1030 -1 R1063 -10 C1132 R1066 -10 R1069 -10 C1132 R1072 -10 R1113 1 C1132 R1117 -1 C1133 R1001 260 R1029 1 C1133 R1030 -1 R1064 -10 C1133 R1067 -10 R1070 -10 C1133 R1073 -10 R1111 1 C1133 R1118 -1 C1134 R1001 200 R1029 1 C1134 R1030 -1 R1064 -10 C1134 R1067 -10 R1070 -10 C1134 R1073 -10 R1112 1 C1134 R1118 -1 C1135 R1001 300 R1029 1 C1135 R1030 -1 R1064 -10 C1135 R1067 -10 R1070 -10 C1135 R1073 -10 R1113 1 C1135 R1118 -1 C1136 R1001 400 R1029 1 C1136 R1030 -1 R1065 -5 C1136 R1068 -5 R1071 -5 C1136 R1074 -5 R1111 1 C1136 R1119 -1 C1137 R1001 400 R1029 1 C1137 R1030 -1 R1065 -5 C1137 R1068 -5 R1071 -5 C1137 R1074 -5 R1112 1 C1137 R1119 -1 C1138 R1001 300 R1029 1 C1138 R1030 -1 R1065 -5 C1138 R1068 -5 R1071 -5 C1138 R1074 -5 R1113 1 C1138 R1119 -1 C1139 R1001 200 R1031 1 C1139 R1032 -1 R1063 -10 C1139 R1066 -10 R1069 -10 C1139 R1072 -10 R1114 1 C1139 R1120 -1 C1140 R1001 260 R1031 1 C1140 R1032 -1 R1063 -10 C1140 R1066 -10 R1069 -10 C1140 R1072 -10 R1115 1 C1140 R1120 -1 C1141 R1001 300 R1031 1 C1141 R1032 -1 R1063 -10 C1141 R1066 -10 R1069 -10 C1141 R1072 -10 R1116 1 C1141 R1120 -1 C1142 R1001 260 R1031 1 C1142 R1032 -1 R1064 -10 C1142 R1067 -10 R1070 -10 C1142 R1073 -10 R1114 1 C1142 R1121 -1 C1143 R1001 200 R1031 1 C1143 R1032 -1 R1064 -10 C1143 R1067 -10 R1070 -10 C1143 R1073 -10 R1115 1 C1143 R1121 -1 C1144 R1001 300 R1031 1 C1144 R1032 -1 R1064 -10 C1144 R1067 -10 R1070 -10 C1144 R1073 -10 R1116 1 C1144 R1121 -1 C1145 R1001 400 R1031 1 C1145 R1032 -1 R1065 -5 C1145 R1068 -5 R1071 -5 C1145 R1074 -5 R1114 1 C1145 R1122 -1 C1146 R1001 400 R1031 1 C1146 R1032 -1 R1065 -5 C1146 R1068 -5 R1071 -5 C1146 R1074 -5 R1115 1 C1146 R1122 -1 C1147 R1001 300 R1031 1 C1147 R1032 -1 R1065 -5 C1147 R1068 -5 R1071 -5 C1147 R1074 -5 R1116 1 C1147 R1122 -1 C1148 R1001 150 R1033 1 C1148 R1034 -1 R1066 -10 C1148 R1069 -10 R1072 -10 C1148 R1117 1 R1123 -1 C1149 R1001 210 R1033 1 C1149 R1034 -1 R1066 -10 C1149 R1069 -10 R1072 -10 C1149 R1118 1 R1123 -1 C1150 R1001 250 R1033 1 C1150 R1034 -1 R1066 -10 C1150 R1069 -10 R1072 -10 C1150 R1119 1 R1123 -1 C1151 R1001 210 R1033 1 C1151 R1034 -1 R1067 -10 C1151 R1070 -10 R1073 -10 C1151 R1117 1 R1124 -1 C1152 R1001 150 R1033 1 C1152 R1034 -1 R1067 -10 C1152 R1070 -10 R1073 -10 C1152 R1118 1 R1124 -1 C1153 R1001 250 R1033 1 C1153 R1034 -1 R1067 -10 C1153 R1070 -10 R1073 -10 C1153 R1119 1 R1124 -1 C1154 R1001 325 R1033 1 C1154 R1034 -1 R1068 -5 C1154 R1071 -5 R1074 -5 C1154 R1117 1 R1125 -1 C1155 R1001 325 R1033 1 C1155 R1034 -1 R1068 -5 C1155 R1071 -5 R1074 -5 C1155 R1118 1 R1125 -1 C1156 R1001 225 R1033 1 C1156 R1034 -1 R1068 -5 C1156 R1071 -5 R1074 -5 C1156 R1119 1 R1125 -1 C1157 R1001 150 R1035 1 C1157 R1036 -1 R1066 -10 C1157 R1069 -10 R1072 -10 C1157 R1120 1 R1126 -1 C1158 R1001 210 R1035 1 C1158 R1036 -1 R1066 -10 C1158 R1069 -10 R1072 -10 C1158 R1121 1 R1126 -1 C1159 R1001 250 R1035 1 C1159 R1036 -1 R1066 -10 C1159 R1069 -10 R1072 -10 C1159 R1122 1 R1126 -1 C1160 R1001 210 R1035 1 C1160 R1036 -1 R1067 -10 C1160 R1070 -10 R1073 -10 C1160 R1120 1 R1127 -1 C1161 R1001 150 R1035 1 C1161 R1036 -1 R1067 -10 C1161 R1070 -10 R1073 -10 C1161 R1121 1 R1127 -1 C1162 R1001 250 R1035 1 C1162 R1036 -1 R1067 -10 C1162 R1070 -10 R1073 -10 C1162 R1122 1 R1127 -1 C1163 R1001 325 R1035 1 C1163 R1036 -1 R1068 -5 C1163 R1071 -5 R1074 -5 C1163 R1120 1 R1128 -1 C1164 R1001 325 R1035 1 C1164 R1036 -1 R1068 -5 C1164 R1071 -5 R1074 -5 C1164 R1121 1 R1128 -1 C1165 R1001 225 R1035 1 C1165 R1036 -1 R1068 -5 C1165 R1071 -5 R1074 -5 C1165 R1122 1 R1128 -1 C1166 R1001 100 R1037 1 C1166 R1038 -1 R1069 -10 C1166 R1072 -10 R1123 1 C1166 R1129 -1 C1167 R1001 160 R1037 1 C1167 R1038 -1 R1069 -10 C1167 R1072 -10 R1124 1 C1167 R1129 -1 C1168 R1001 200 R1037 1 C1168 R1038 -1 R1069 -10 C1168 R1072 -10 R1125 1 C1168 R1129 -1 C1169 R1001 160 R1037 1 C1169 R1038 -1 R1070 -10 C1169 R1073 -10 R1123 1 C1169 R1130 -1 C1170 R1001 100 R1037 1 C1170 R1038 -1 R1070 -10 C1170 R1073 -10 R1124 1 C1170 R1130 -1 C1171 R1001 200 R1037 1 C1171 R1038 -1 R1070 -10 C1171 R1073 -10 R1125 1 C1171 R1130 -1 C1172 R1001 250 R1037 1 C1172 R1038 -1 R1071 -5 C1172 R1074 -5 R1123 1 C1172 R1131 -1 C1173 R1001 250 R1037 1 C1173 R1038 -1 R1071 -5 C1173 R1074 -5 R1124 1 C1173 R1131 -1 C1174 R1001 150 R1037 1 C1174 R1038 -1 R1071 -5 C1174 R1074 -5 R1125 1 C1174 R1131 -1 C1175 R1001 100 R1039 1 C1175 R1040 -1 R1069 -10 C1175 R1072 -10 R1126 1 C1175 R1132 -1 C1176 R1001 160 R1039 1 C1176 R1040 -1 R1069 -10 C1176 R1072 -10 R1127 1 C1176 R1132 -1 C1177 R1001 200 R1039 1 C1177 R1040 -1 R1069 -10 C1177 R1072 -10 R1128 1 C1177 R1132 -1 C1178 R1001 160 R1039 1 C1178 R1040 -1 R1070 -10 C1178 R1073 -10 R1126 1 C1178 R1133 -1 C1179 R1001 100 R1039 1 C1179 R1040 -1 R1070 -10 C1179 R1073 -10 R1127 1 C1179 R1133 -1 C1180 R1001 200 R1039 1 C1180 R1040 -1 R1070 -10 C1180 R1073 -10 R1128 1 C1180 R1133 -1 C1181 R1001 250 R1039 1 C1181 R1040 -1 R1071 -5 C1181 R1074 -5 R1126 1 C1181 R1134 -1 C1182 R1001 250 R1039 1 C1182 R1040 -1 R1071 -5 C1182 R1074 -5 R1127 1 C1182 R1134 -1 C1183 R1001 150 R1039 1 C1183 R1040 -1 R1071 -5 C1183 R1074 -5 R1128 1 C1183 R1134 -1 C1184 R1001 50 R1041 1 C1184 R1042 -1 R1072 -10 C1184 R1129 1 C1185 R1001 110 R1041 1 C1185 R1042 -1 R1072 -10 C1185 R1130 1 C1186 R1001 150 R1041 1 C1186 R1042 -1 R1072 -10 C1186 R1131 1 C1187 R1001 110 R1041 1 C1187 R1042 -1 R1073 -10 C1187 R1129 1 C1188 R1001 50 R1041 1 C1188 R1042 -1 R1073 -10 C1188 R1130 1 C1189 R1001 150 R1041 1 C1189 R1042 -1 R1073 -10 C1189 R1131 1 C1190 R1001 175 R1041 1 C1190 R1042 -1 R1074 -5 C1190 R1129 1 C1191 R1001 175 R1041 1 C1191 R1042 -1 R1074 -5 C1191 R1130 1 C1192 R1001 75 R1041 1 C1192 R1042 -1 R1074 -5 C1192 R1131 1 C1193 R1001 50 R1043 1 C1193 R1044 -1 R1072 -10 C1193 R1132 1 C1194 R1001 110 R1043 1 C1194 R1044 -1 R1072 -10 C1194 R1133 1 C1195 R1001 150 R1043 1 C1195 R1044 -1 R1072 -10 C1195 R1134 1 C1196 R1001 110 R1043 1 C1196 R1044 -1 R1073 -10 C1196 R1132 1 C1197 R1001 50 R1043 1 C1197 R1044 -1 R1073 -10 C1197 R1133 1 C1198 R1001 150 R1043 1 C1198 R1044 -1 R1073 -10 C1198 R1134 1 C1199 R1001 175 R1043 1 C1199 R1044 -1 R1074 -5 C1199 R1132 1 C1200 R1001 175 R1043 1 C1200 R1044 -1 R1074 -5 C1200 R1133 1 C1201 R1001 75 R1043 1 C1201 R1044 -1 R1074 -5 C1201 R1134 1 MARK0001 'MARKER' 'INTEND' RHS RHS R1002 25 R1003 25 RHS R1004 25 R1005 1 RHS R1006 -1 R1007 1 RHS R1008 -1 R1009 1 RHS R1010 -1 R1011 1 RHS R1012 -1 R1013 1 RHS R1014 -1 R1015 1 RHS R1016 -1 R1017 1 RHS R1018 -1 R1019 1 RHS R1020 -1 R1021 1 RHS R1022 -1 R1023 1 RHS R1024 -1 R1025 1 RHS R1026 -1 R1027 1 RHS R1028 -1 R1029 1 RHS R1030 -1 R1031 1 RHS R1032 -1 R1033 1 RHS R1034 -1 R1035 1 RHS R1036 -1 R1037 1 RHS R1038 -1 R1039 1 RHS R1040 -1 R1041 1 RHS R1042 -1 R1043 1 RHS R1044 -1 R1045 -5 RHS R1046 -5 R1047 -5 RHS R1048 -10 R1049 -10 RHS R1050 -10 R1051 -15 RHS R1052 -15 R1053 -15 RHS R1054 -20 R1055 -20 RHS R1056 -20 R1057 -25 RHS R1058 -25 R1059 -25 RHS R1060 -30 R1061 -30 RHS R1062 -30 R1063 -35 RHS R1064 -35 R1065 -35 RHS R1066 -40 R1067 -40 RHS R1068 -40 R1069 -45 RHS R1070 -45 R1071 -45 RHS R1072 -50 R1073 -50 RHS R1074 -50 R1075 1 RHS R1076 1 R1077 1 RHS R1078 1 R1079 1 RHS R1080 1 BOUNDS UP ONE C1001 1 UP ONE C1002 1 UP ONE C1003 1 UP ONE C1004 1 UP ONE C1005 1 UP ONE C1006 1 UP ONE C1007 1 UP ONE C1008 1 UP ONE C1009 1 UP ONE C1010 1 UP ONE C1011 1 UP ONE C1012 1 UP ONE C1013 1 UP ONE C1014 1 UP ONE C1015 1 UP ONE C1016 1 UP ONE C1017 1 UP ONE C1018 1 UP ONE C1019 1 UP ONE C1020 1 UP ONE C1021 1 UP ONE C1022 1 UP ONE C1023 1 UP ONE C1024 1 UP ONE C1025 1 UP ONE C1026 1 UP ONE C1027 1 UP ONE C1028 1 UP ONE C1029 1 UP ONE C1030 1 UP ONE C1031 1 UP ONE C1032 1 UP ONE C1033 1 UP ONE C1034 1 UP ONE C1035 1 UP ONE C1036 1 UP ONE C1037 1 UP ONE C1038 1 UP ONE C1039 1 UP ONE C1040 1 UP ONE C1041 1 UP ONE C1042 1 UP ONE C1043 1 UP ONE C1044 1 UP ONE C1045 1 UP ONE C1046 1 UP ONE C1047 1 UP ONE C1048 1 UP ONE C1049 1 UP ONE C1050 1 UP ONE C1051 1 UP ONE C1052 1 UP ONE C1053 1 UP ONE C1054 1 UP ONE C1055 1 UP ONE C1056 1 UP ONE C1057 1 UP ONE C1058 1 UP ONE C1059 1 UP ONE C1060 1 UP ONE C1061 1 UP ONE C1062 1 UP ONE C1063 1 UP ONE C1064 1 UP ONE C1065 1 UP ONE C1066 1 UP ONE C1067 1 UP ONE C1068 1 UP ONE C1069 1 UP ONE C1070 1 UP ONE C1071 1 UP ONE C1072 1 UP ONE C1073 1 UP ONE C1074 1 UP ONE C1075 1 UP ONE C1076 1 UP ONE C1077 1 UP ONE C1078 1 UP ONE C1079 1 UP ONE C1080 1 UP ONE C1081 1 UP ONE C1082 1 UP ONE C1083 1 UP ONE C1084 1 UP ONE C1085 1 UP ONE C1086 1 UP ONE C1087 1 UP ONE C1088 1 UP ONE C1089 1 UP ONE C1090 1 UP ONE C1091 1 UP ONE C1092 1 UP ONE C1093 1 UP ONE C1094 1 UP ONE C1095 1 UP ONE C1096 1 UP ONE C1097 1 UP ONE C1098 1 UP ONE C1099 1 UP ONE C1100 1 UP ONE C1101 1 UP ONE C1102 1 UP ONE C1103 1 UP ONE C1104 1 UP ONE C1105 1 UP ONE C1106 1 UP ONE C1107 1 UP ONE C1108 1 UP ONE C1109 1 UP ONE C1110 1 UP ONE C1111 1 UP ONE C1112 1 UP ONE C1113 1 UP ONE C1114 1 UP ONE C1115 1 UP ONE C1116 1 UP ONE C1117 1 UP ONE C1118 1 UP ONE C1119 1 UP ONE C1120 1 UP ONE C1121 1 UP ONE C1122 1 UP ONE C1123 1 UP ONE C1124 1 UP ONE C1125 1 UP ONE C1126 1 UP ONE C1127 1 UP ONE C1128 1 UP ONE C1129 1 UP ONE C1130 1 UP ONE C1131 1 UP ONE C1132 1 UP ONE C1133 1 UP ONE C1134 1 UP ONE C1135 1 UP ONE C1136 1 UP ONE C1137 1 UP ONE C1138 1 UP ONE C1139 1 UP ONE C1140 1 UP ONE C1141 1 UP ONE C1142 1 UP ONE C1143 1 UP ONE C1144 1 UP ONE C1145 1 UP ONE C1146 1 UP ONE C1147 1 UP ONE C1148 1 UP ONE C1149 1 UP ONE C1150 1 UP ONE C1151 1 UP ONE C1152 1 UP ONE C1153 1 UP ONE C1154 1 UP ONE C1155 1 UP ONE C1156 1 UP ONE C1157 1 UP ONE C1158 1 UP ONE C1159 1 UP ONE C1160 1 UP ONE C1161 1 UP ONE C1162 1 UP ONE C1163 1 UP ONE C1164 1 UP ONE C1165 1 UP ONE C1166 1 UP ONE C1167 1 UP ONE C1168 1 UP ONE C1169 1 UP ONE C1170 1 UP ONE C1171 1 UP ONE C1172 1 UP ONE C1173 1 UP ONE C1174 1 UP ONE C1175 1 UP ONE C1176 1 UP ONE C1177 1 UP ONE C1178 1 UP ONE C1179 1 UP ONE C1180 1 UP ONE C1181 1 UP ONE C1182 1 UP ONE C1183 1 UP ONE C1184 1 UP ONE C1185 1 UP ONE C1186 1 UP ONE C1187 1 UP ONE C1188 1 UP ONE C1189 1 UP ONE C1190 1 UP ONE C1191 1 UP ONE C1192 1 UP ONE C1193 1 UP ONE C1194 1 UP ONE C1195 1 UP ONE C1196 1 UP ONE C1197 1 UP ONE C1198 1 UP ONE C1199 1 UP ONE C1200 1 UP ONE C1201 1 ENDATA CoinMP-1.8.3/Data/Sample/coindatasample.pc.in0000644000175000017500000000026711507632611017332 0ustar renereneprefix=@prefix@ datadir=@datadir@/coin/Data/Sample Name: Sample Description: Sample models URL: https://projects.coin-or.org/svn/Data/Sample Version: @PACKAGE_VERSION@ Libs: Cflags: CoinMP-1.8.3/Data/Sample/galenetbnds.mps0000644000175000017500000000501711431323442016415 0ustar renerene* Modified galenet with equalities converted to a pair of inequalities and * implicit bounds converted to explicit inequalities. All inequalities then * converted to less than. In other words, the classic canonical form for * conversion to dual, so that we can do an algebraic test of getDualRays * for solvers that don't return the column components. NAME galenetbnds ROWS L S1 L S2 L S3 L NODE4U L NODE4L L NODE5U L NODE5L L D6 L D7 L D8 L T14UB L T14LB L T24UB L T24LB L T25UB L T25LB L T35UB L T35LB L T46UB L T46LB L T47UB L T47LB L T57UB L T57LB L T58UB L T58LB N COST COLUMNS T14 S1 1. NODE4U 1. T14 NODE4L -1 T14 T14UB 1. T14LB -1. T24 S2 1. NODE4U 1. T24 NODE4L -1 T24 T24UB 1. T24LB -1. T25 S2 1. NODE5U 1. T25 NODE5L -1. T25 T25UB 1. T25LB -1. T35 S3 1. NODE5U 1. T35 NODE5L -1. T35 T35UB 1. T35LB -1. T46 D6 -1. NODE4U -1. T46 NODE4L 1 T46 T46UB 1. T46LB -1. T47 D7 -1. NODE4U -1. T47 NODE4L 1 T47 T47UB 1. T47LB -1. T57 D7 -1. NODE5U -1. T57 NODE5L 1. T57 T57UB 1. T57LB -1. T58 D8 -1. NODE5U -1. T58 NODE5L 1. T58 T58UB 1. T58LB -1. RHS RHS S1 20. S2 20. RHS S3 20. D6 -10. RHS D7 -20. D8 -30. RHS T14UB 30. RHS T24UB 20. RHS T25UB 10. RHS T35UB 10. RHS T46UB 10. RHS T47UB 2. RHS T57UB 20. RHS T58UB 30. BOUNDS FR BND T14 FR BND T24 FR BND T25 FR BND T35 FR BND T46 FR BND T47 FR BND T57 FR BND T58 ENDATA CoinMP-1.8.3/Data/Sample/exmip1.5.mps0000644000175000017500000001373510430174061015502 0ustar renerene************************************************************************ * * The data in this file represents the following problem: * * Minimize or maximize Z = x1 + 2x5 - x8 * * Subject to: * * 2.5 <= 3x1 + x2 - 2x4 - x5 - x8 * 2x2 + 1.1x3 <= 2.1 * x3 + x6 = 4.0 * 1.8 <= 2.8x4 -1.2x7 <= 5.0 * 3.0 <= 5.6x1 + x5 + 1.9x8 <= 15.0 * 15x3 + 12x4 + x5 <= 6.8 * * where: * * 2.5 <= x1 * 0 <= x2 <= 4.1 * 0 <= x3 * 0 <= x4 * 0.5 <= x5 <= 4.0 * 0 <= x6 * 0 <= x7 <= 2.0 * 0 <= x8 <= 4.3 * * x3, x4 are 0,1 variables. * ************************************************************************ NAME EXAMPLE ROWS N OBJ G ROW01 L ROW02 E ROW03 G ROW04 L ROW05 L ROW06 COLUMNS COL01 OBJ 1.0 COL01 ROW01 3.0 ROW05 5.6 COL02 ROW01 1.0 ROW02 2.0 * * Mark COL03 and COL04 as integer variables. * INT1 'MARKER' 'INTORG' COL03 ROW02 1.1 ROW03 1.0 COL03 ROW06 15.0 COL04 ROW01 -2.0 ROW04 2.8 COL04 ROW06 12.0 INT1END 'MARKER' 'INTEND' * COL05 OBJ 2.0 COL05 ROW01 -1.0 ROW05 1.0 COL05 ROW06 1.0 COL06 ROW03 1.0 COL07 ROW04 -1.2 COL08 OBJ -1.0 COL08 ROW01 -1.0 ROW05 1.9 RHS RHS1 ROW01 2.5 RHS1 ROW02 2.1 RHS1 ROW03 4.0 RHS1 ROW04 1.8 RHS1 ROW05 15.0 RHS1 ROW06 6.8 RANGES RNG1 ROW04 3.2 RNG1 ROW05 12.0 BOUNDS LO BND1 COL01 2.5 UP BND1 COL02 4.1 LO BND1 COL05 0.5 UP BND1 COL05 4.0 UP BND1 COL07 2.0 UP BND1 COL08 4.3 ENDATA CoinMP-1.8.3/Data/Sample/afiro.mps0000644000175000017500000000637710662211140015235 0ustar renereneNAME AFIRO ROWS E R09 E R10 L X05 L X21 E R12 E R13 L X17 L X18 L X19 L X20 E R19 E R20 L X27 L X44 E R22 E R23 L X40 L X41 L X42 L X43 L X45 L X46 L X47 L X48 L X49 L X50 L X51 N COST COLUMNS X01 X48 .301 R09 -1. X01 R10 -1.06 X05 1. X02 X21 -1. R09 1. X02 COST -.4 X03 X46 -1. R09 1. X04 X50 1. R10 1. X06 X49 .301 R12 -1. X06 R13 -1.06 X17 1. X07 X49 .313 R12 -1. X07 R13 -1.06 X18 1. X08 X49 .313 R12 -1. X08 R13 -.96 X19 1. X09 X49 .326 R12 -1. X09 R13 -.86 X20 1. X10 X45 2.364 X17 -1. X11 X45 2.386 X18 -1. X12 X45 2.408 X19 -1. X13 X45 2.429 X20 -1. X14 X21 1.4 R12 1. X14 COST -.32 X15 X47 -1. R12 1. X16 X51 1. R13 1. X22 X46 .109 R19 -1. X22 R20 -.43 X27 1. X23 X44 -1. R19 1. X23 COST -.6 X24 X48 -1. R19 1. X25 X45 -1. R19 1. X26 X50 1. R20 1. X28 X47 .109 R22 -.43 X28 R23 1. X40 1. X29 X47 .108 R22 -.43 X29 R23 1. X41 1. X30 X47 .108 R22 -.39 X30 R23 1. X42 1. X31 X47 .107 R22 -.37 X31 R23 1. X43 1. X32 X45 2.191 X40 -1. X33 X45 2.219 X41 -1. X34 X45 2.249 X42 -1. X35 X45 2.279 X43 -1. X36 X44 1.4 R23 -1. X36 COST -.48 X37 X49 -1. R23 1. X38 X51 1. R22 1. X39 R23 1. COST 10. RHS B X50 310. X51 300. B X05 80. X17 80. B X27 500. R23 44. B X40 500. ENDATA CoinMP-1.8.3/Data/Sample/pack1.mps0000644000175000017500000000312110430174061015117 0ustar renerene************************************************************************ * * The data in this file represents a tiny covering problem: * * Minimize or maximize Z = x1 + x2 + x3 * * Subject to: * * 1.0 <= x1 + x2 * 1.0 <= x2 + x3 * 1.0 <= x1 x3 * * where all variables are binary. * ************************************************************************ NAME EXAMPLE ROWS N OBJ G ROW01 G ROW02 G ROW03 COLUMNS INT1 'MARKER' 'INTORG' COL01 OBJ 1.0 COL01 ROW01 1.0 ROW03 1.0 COL02 OBJ 1.0 COL02 ROW01 1.0 ROW02 1.0 COL03 OBJ 1.0 COL03 ROW02 1.0 ROW03 1.0 INT1END 'MARKER' 'INTEND' RHS RHS1 ROW01 1.0 RHS1 ROW02 1.0 RHS1 ROW03 1.0 ENDATA CoinMP-1.8.3/Data/Sample/exmip1.lp0000755000175000017500000000077012167773507015174 0ustar renerene\ENCODING=ISO-8859-1 \Problem name: exmip1.mps Minimize OBJ: COL01 + 2 COL05 - COL08 Subject To ROW01: 3 COL01 + COL02 - 2 COL04 - COL05 - COL08 >= 2.5 ROW02: 2 COL02 + 1.1 COL03 <= 2.1 ROW03: COL03 + COL06 = 4 ROW04: 2.8 COL04 - 1.2 COL07 - RgROW04 = 1.8 ROW05: 5.6 COL01 + COL05 + 1.9 COL08 - RgROW05 = 15 Bounds COL01 >= 2.5 0 <= COL02 <= 4.1 0 <= COL03 <= 1 0 <= COL04 <= 1 0.5 <= COL05 <= 4 0 <= COL08 <= 4.3 0 <= RgROW04 <= 3.2 -12 <= RgROW05 <= 0 Binaries COL03 COL04 End CoinMP-1.8.3/Data/Sample/configure0000755000175000017500000034547012452373427015343 0ustar renerene#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for DataSample 1.2.10. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # # Copyright 2006 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package Coin which is distributed # under the Eclipse Public License. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='DataSample' PACKAGE_TARNAME='datasample' PACKAGE_VERSION='1.2.10' PACKAGE_STRING='DataSample 1.2.10' PACKAGE_BUGREPORT='https://projects.coin-or.org/BuildTools/' ac_unique_file="configure.ac" ac_default_prefix=`pwd` ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS ALWAYS_FALSE_TRUE ALWAYS_FALSE_FALSE have_svnversion DATASAMPLE_SVN_REV EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOLM4 have_autoconf have_automake have_svn BUILDTOOLSDIR AUX_DIR abs_source_dir abs_lib_dir abs_include_dir abs_bin_dir HAVE_EXTERNALS_TRUE HAVE_EXTERNALS_FALSE build build_cpu build_vendor build_os EXAMPLE_UNCOMPRESSED_FILES EXAMPLE_FILES EXAMPLE_CLEAN_FILES ABSBUILDDIR LIBEXT VPATH_DISTCLEANFILES LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures DataSample 1.2.10 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of DataSample 1.2.10:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-msvc Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF DataSample configure 1.2.10 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by DataSample $as_me 1.2.10, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # List one file in the package so that the configure script can test # whether the package is actually there # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. # As backup, we make sure we don't loose an FLIBS if it has been set # by the user save_FLIBS="$FLIBS" # A useful makefile conditional that is always false if false; then ALWAYS_FALSE_TRUE= ALWAYS_FALSE_FALSE='#' else ALWAYS_FALSE_TRUE='#' ALWAYS_FALSE_FALSE= fi # We set the following variable so that we know later in AC_COIN_FINALIZE # that we are in a project main directory coin_projectdir=yes # Set the project's version numbers cat >>confdefs.h <<_ACEOF #define DATASAMPLE_VERSION "$PACKAGE_VERSION" _ACEOF coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'` coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'` coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'` if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi cat >>confdefs.h <<_ACEOF #define DATASAMPLE_VERSION_MAJOR $coin_majorver _ACEOF cat >>confdefs.h <<_ACEOF #define DATASAMPLE_VERSION_MINOR $coin_minorver _ACEOF cat >>confdefs.h <<_ACEOF #define DATASAMPLE_VERSION_RELEASE $coin_releasever _ACEOF # We use the following variable to have a string with the upper case # version of the project name COIN_PRJCT=DATASAMPLE # Set the project's SVN revision number. The complicated sed expression # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up # as a single number. # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svnversion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svnversion"; then ac_cv_prog_have_svnversion="$have_svnversion" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svnversion="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svnversion" && ac_cv_prog_have_svnversion="no" fi fi have_svnversion=$ac_cv_prog_have_svnversion if test -n "$have_svnversion"; then echo "$as_me:$LINENO: result: $have_svnversion" >&5 echo "${ECHO_T}$have_svnversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$have_svnversion" = xyes; then svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null` if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then DATASAMPLE_SVN_REV=`echo $svn_rev_tmp | sed -n -e 's/^[0-9]*://' -e 's/\([0-9]\)[^0-9]*$/\1/p'` cat >>confdefs.h <<_ACEOF #define DATASAMPLE_SVN_REV $DATASAMPLE_SVN_REV _ACEOF fi fi # Capture libtool library version, if given. coin_libversion=2:10:1 ############################################################################# # We only need automake to generate Makefiles for the distribution # ############################################################################# # Initialize automake echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi am__api_version="1.9" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='datasample' VERSION='1.2.10' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME echo "$as_me:$LINENO: checking whether we are using the correct autotools" >&5 echo $ECHO_N "checking whether we are using the correct autotools... $ECHO_C" >&6 if test "${ac_cv_use_correct_autotools+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_correct_autotools=check fi echo "$as_me:$LINENO: result: $ac_cv_use_correct_autotools" >&5 echo "${ECHO_T}$ac_cv_use_correct_autotools" >&6 if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_autoconf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_autoconf"; then ac_cv_prog_have_autoconf="$have_autoconf" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_autoconf="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_autoconf" && ac_cv_prog_have_autoconf="no" fi fi have_autoconf=$ac_cv_prog_have_autoconf if test -n "$have_autoconf"; then echo "$as_me:$LINENO: result: $have_autoconf" >&5 echo "${ECHO_T}$have_autoconf" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_autoconf = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of autoconf" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of autoconf... $ECHO_C" >&6 autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of autoconf as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of autoconf as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location echo "$as_me:$LINENO: checking whether autoconf is coming from the correct location" >&5 echo $ECHO_N "checking whether autoconf is coming from the correct location... $ECHO_C" >&6 autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if we have automake # Extract the first word of "automake", so it can be a program name with args. set dummy automake; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_automake+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_automake"; then ac_cv_prog_have_automake="$have_automake" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_automake="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_automake" && ac_cv_prog_have_automake="no" fi fi have_automake=$ac_cv_prog_have_automake if test -n "$have_automake"; then echo "$as_me:$LINENO: result: $have_automake" >&5 echo "${ECHO_T}$have_automake" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_automake = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of automake" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of automake... $ECHO_C" >&6 automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of automake as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of automake as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable automake is picked up from the correct location echo "$as_me:$LINENO: checking whether automake is coming from the correct location" >&5 echo $ECHO_N "checking whether automake is coming from the correct location... $ECHO_C" >&6 automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` if test -r $want_dir/libtool/ltmain.sh; then have_ltmain=yes : else have_ltmain=no : fi echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of libtool." >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of libtool.... $ECHO_C" >&6 if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of libtool." >&5 echo "$as_me: error: You don't have the correct version of libtool." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: I cannot find the ltmain.sh file." >&5 echo "$as_me: error: I cannot find the ltmain.sh file." >&2;} { (exit 1); exit 1; }; } fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi if test -r $want_dir/aclocal/libtool.m4; then LIBTOOLM4="$want_dir/aclocal/libtool.m4" : else { { echo "$as_me:$LINENO: error: I cannot find the libtool.m4 file." >&5 echo "$as_me: error: I cannot find the libtool.m4 file." >&2;} { (exit 1); exit 1; }; } : fi # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https # Extract the first word of "svn", so it can be a program name with args. set dummy svn; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svn"; then ac_cv_prog_have_svn="$have_svn" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svn="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svn" && ac_cv_prog_have_svn="no" fi fi have_svn=$ac_cv_prog_have_svn if test -n "$have_svn"; then echo "$as_me:$LINENO: result: $have_svn" >&5 echo "${ECHO_T}$have_svn" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$have_svn = xyes; then echo "$as_me:$LINENO: checking whether svn understands https" >&5 echo $ECHO_N "checking whether svn understands https... $ECHO_C" >&6 if test "${ac_cv_svn_understands_https+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out fi echo "$as_me:$LINENO: result: $ac_cv_svn_understands_https" >&5 echo "${ECHO_T}$ac_cv_svn_understands_https" >&6 fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else { { echo "$as_me:$LINENO: error: Cannot find the BuildTools directory" >&5 echo "$as_me: error: Cannot find the BuildTools directory" >&2;} { (exit better disable maintainer mode.); exit better disable maintainer mode.; }; } fi fi fi # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` abs_lib_dir=$full_prefix/lib abs_include_dir=$full_prefix/include abs_bin_dir=$full_prefix/bin if test $coin_have_externals = yes && test x$have_svn = xyes; then HAVE_EXTERNALS_TRUE= HAVE_EXTERNALS_FALSE='#' else HAVE_EXTERNALS_TRUE='#' HAVE_EXTERNALS_FALSE= fi # AC_MSG_NOTICE([End automake initialisation.]) ############################################################################# #Find out what the data files are and create links if this is a VPATH config# ############################################################################# echo "$as_me:$LINENO: checking whether this is a VPATH configuration" >&5 echo $ECHO_N "checking whether this is a VPATH configuration... $ECHO_C" >&6 if test `cd $srcdir; pwd` != `pwd`; then coin_vpath_config=yes; else coin_vpath_config=no; fi echo "$as_me:$LINENO: result: $coin_vpath_config" >&5 echo "${ECHO_T}$coin_vpath_config" >&6 # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # for backward compatibility # Check whether --enable-doscompile or --disable-doscompile was given. if test "${enable_doscompile+set}" = set; then enableval="$enable_doscompile" enable_doscompile=$enableval else enable_doscompile=no fi; # Check whether --enable-msvc or --disable-msvc was given. if test "${enable_msvc+set}" = set; then enableval="$enable_msvc" enable_msvc=$enableval else enable_msvc=no if test "$enable_doscompile" = msvc ; then enable_msvc=yes elif test "$enable_doscompile" != no ; then { { echo "$as_me:$LINENO: error: --enable-doscompile=$enable_doscompile not supported anymore." >&5 echo "$as_me: error: --enable-doscompile=$enable_doscompile not supported anymore." >&2;} { (exit 1); exit 1; }; } fi fi; if test "$enable_msvc" = MD; then enable_shared=yes enable_msvc=yes fi if test "$enable_msvc" = yes; then case $build in *-cygwin* | *-mingw*) ;; *) { { echo "$as_me:$LINENO: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&5 echo "$as_me: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&2;} { (exit 1); exit 1; }; } ;; esac fi files=`cd $srcdir; ls *.mps` # We need to do the following loop to make sure that are no newlines # in the variable for file in $files; do EXAMPLE_FILES="$EXAMPLE_FILES $file" done if test $coin_vpath_config = yes; then lnkcmd= if test "$enable_msvc" = yes; then lnkcmd=cp fi case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) lnkcmd=cp ;; esac if test "x$lnkcmd" = xcp; then { echo "$as_me:$LINENO: Copying example files (*.mps)" >&5 echo "$as_me: Copying example files (*.mps)" >&6;} else { echo "$as_me:$LINENO: Creating links to the example files (*.mps)" >&5 echo "$as_me: Creating links to the example files (*.mps)" >&6;} lnkcmd="$LN_S" fi for file in $EXAMPLE_FILES; do rm -f $file $lnkcmd $srcdir/$file $file done EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES *.mps" else EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES" fi # In case there are compressed files, we create a variable with the # uncompressed names EXAMPLE_UNCOMPRESSED_FILES= for file in $EXAMPLE_FILES; do case $file in *.gz) EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" ;; esac done files=`cd $srcdir; ls *.lp` # We need to do the following loop to make sure that are no newlines # in the variable for file in $files; do EXAMPLE_FILES="$EXAMPLE_FILES $file" done if test $coin_vpath_config = yes; then lnkcmd= if test "$enable_msvc" = yes; then lnkcmd=cp fi case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) lnkcmd=cp ;; esac if test "x$lnkcmd" = xcp; then { echo "$as_me:$LINENO: Copying example files (*.lp)" >&5 echo "$as_me: Copying example files (*.lp)" >&6;} else { echo "$as_me:$LINENO: Creating links to the example files (*.lp)" >&5 echo "$as_me: Creating links to the example files (*.lp)" >&6;} lnkcmd="$LN_S" fi for file in $EXAMPLE_FILES; do rm -f $file $lnkcmd $srcdir/$file $file done EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES *.lp" else EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES" fi # In case there are compressed files, we create a variable with the # uncompressed names EXAMPLE_UNCOMPRESSED_FILES= for file in $EXAMPLE_FILES; do case $file in *.gz) EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" ;; esac done files=`cd $srcdir; ls *.block` # We need to do the following loop to make sure that are no newlines # in the variable for file in $files; do EXAMPLE_FILES="$EXAMPLE_FILES $file" done if test $coin_vpath_config = yes; then lnkcmd= if test "$enable_msvc" = yes; then lnkcmd=cp fi case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) lnkcmd=cp ;; esac if test "x$lnkcmd" = xcp; then { echo "$as_me:$LINENO: Copying example files (*.block)" >&5 echo "$as_me: Copying example files (*.block)" >&6;} else { echo "$as_me:$LINENO: Creating links to the example files (*.block)" >&5 echo "$as_me: Creating links to the example files (*.block)" >&6;} lnkcmd="$LN_S" fi for file in $EXAMPLE_FILES; do rm -f $file $lnkcmd $srcdir/$file $file done EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES *.block" else EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES" fi # In case there are compressed files, we create a variable with the # uncompressed names EXAMPLE_UNCOMPRESSED_FILES= for file in $EXAMPLE_FILES; do case $file in *.gz) EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" ;; esac done files=`cd $srcdir; ls *.dec` # We need to do the following loop to make sure that are no newlines # in the variable for file in $files; do EXAMPLE_FILES="$EXAMPLE_FILES $file" done if test $coin_vpath_config = yes; then lnkcmd= if test "$enable_msvc" = yes; then lnkcmd=cp fi case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) lnkcmd=cp ;; esac if test "x$lnkcmd" = xcp; then { echo "$as_me:$LINENO: Copying example files (*.dec)" >&5 echo "$as_me: Copying example files (*.dec)" >&6;} else { echo "$as_me:$LINENO: Creating links to the example files (*.dec)" >&5 echo "$as_me: Creating links to the example files (*.dec)" >&6;} lnkcmd="$LN_S" fi for file in $EXAMPLE_FILES; do rm -f $file $lnkcmd $srcdir/$file $file done EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES *.dec" else EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES" fi # In case there are compressed files, we create a variable with the # uncompressed names EXAMPLE_UNCOMPRESSED_FILES= for file in $EXAMPLE_FILES; do case $file in *.gz) EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" ;; esac done files=`cd $srcdir; ls input.130` # We need to do the following loop to make sure that are no newlines # in the variable for file in $files; do EXAMPLE_FILES="$EXAMPLE_FILES $file" done if test $coin_vpath_config = yes; then lnkcmd= if test "$enable_msvc" = yes; then lnkcmd=cp fi case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) lnkcmd=cp ;; esac if test "x$lnkcmd" = xcp; then { echo "$as_me:$LINENO: Copying example files (input.130)" >&5 echo "$as_me: Copying example files (input.130)" >&6;} else { echo "$as_me:$LINENO: Creating links to the example files (input.130)" >&5 echo "$as_me: Creating links to the example files (input.130)" >&6;} lnkcmd="$LN_S" fi for file in $EXAMPLE_FILES; do rm -f $file $lnkcmd $srcdir/$file $file done EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES input.130" else EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES" fi # In case there are compressed files, we create a variable with the # uncompressed names EXAMPLE_UNCOMPRESSED_FILES= for file in $EXAMPLE_FILES; do case $file in *.gz) EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" ;; esac done files=`cd $srcdir; ls app0110.* app0110R.* bug.*` # We need to do the following loop to make sure that are no newlines # in the variable for file in $files; do EXAMPLE_FILES="$EXAMPLE_FILES $file" done if test $coin_vpath_config = yes; then lnkcmd= if test "$enable_msvc" = yes; then lnkcmd=cp fi case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) lnkcmd=cp ;; esac if test "x$lnkcmd" = xcp; then { echo "$as_me:$LINENO: Copying example files (app0110.* app0110R.* bug.*)" >&5 echo "$as_me: Copying example files (app0110.* app0110R.* bug.*)" >&6;} else { echo "$as_me:$LINENO: Creating links to the example files (app0110.* app0110R.* bug.*)" >&5 echo "$as_me: Creating links to the example files (app0110.* app0110R.* bug.*)" >&6;} lnkcmd="$LN_S" fi for file in $EXAMPLE_FILES; do rm -f $file $lnkcmd $srcdir/$file $file done EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES app0110.* app0110R.* bug.*" else EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES" fi # In case there are compressed files, we create a variable with the # uncompressed names EXAMPLE_UNCOMPRESSED_FILES= for file in $EXAMPLE_FILES; do case $file in *.gz) EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" ;; esac done ############################################################################## # Finishing up by writing all the output # ############################################################################## ABSBUILDDIR="`pwd`" # Here list all the files that configure should create (except for the # configuration header file) ac_config_files="$ac_config_files Makefile coindatasample.pc coindatasample-uninstalled.pc" # Finally, we let configure write all the output... echo "$as_me:$LINENO: checking which command should be used to link input files" >&5 echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac echo "$as_me:$LINENO: result: $coin_link_input_cmd" >&5 echo "${ECHO_T}$coin_link_input_cmd" >&6 if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${ALWAYS_FALSE_TRUE}" && test -z "${ALWAYS_FALSE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_EXTERNALS_TRUE}" && test -z "${HAVE_EXTERNALS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by DataSample $as_me 1.2.10, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ DataSample config.status 1.2.10 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "coindatasample.pc" ) CONFIG_FILES="$CONFIG_FILES coindatasample.pc" ;; "coindatasample-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES coindatasample-uninstalled.pc" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@ALWAYS_FALSE_TRUE@,$ALWAYS_FALSE_TRUE,;t t s,@ALWAYS_FALSE_FALSE@,$ALWAYS_FALSE_FALSE,;t t s,@have_svnversion@,$have_svnversion,;t t s,@DATASAMPLE_SVN_REV@,$DATASAMPLE_SVN_REV,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBTOOLM4@,$LIBTOOLM4,;t t s,@have_autoconf@,$have_autoconf,;t t s,@have_automake@,$have_automake,;t t s,@have_svn@,$have_svn,;t t s,@BUILDTOOLSDIR@,$BUILDTOOLSDIR,;t t s,@AUX_DIR@,$AUX_DIR,;t t s,@abs_source_dir@,$abs_source_dir,;t t s,@abs_lib_dir@,$abs_lib_dir,;t t s,@abs_include_dir@,$abs_include_dir,;t t s,@abs_bin_dir@,$abs_bin_dir,;t t s,@HAVE_EXTERNALS_TRUE@,$HAVE_EXTERNALS_TRUE,;t t s,@HAVE_EXTERNALS_FALSE@,$HAVE_EXTERNALS_FALSE,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@EXAMPLE_UNCOMPRESSED_FILES@,$EXAMPLE_UNCOMPRESSED_FILES,;t t s,@EXAMPLE_FILES@,$EXAMPLE_FILES,;t t s,@EXAMPLE_CLEAN_FILES@,$EXAMPLE_CLEAN_FILES,;t t s,@ABSBUILDDIR@,$ABSBUILDDIR,;t t s,@LIBEXT@,$LIBEXT,;t t s,@VPATH_DISTCLEANFILES@,$VPATH_DISTCLEANFILES,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then { echo "$as_me:$LINENO: Copying data files for VPATH configuration" >&5 echo "$as_me: Copying data files for VPATH configuration" >&6;} else { echo "$as_me:$LINENO: Creating VPATH links for data files" >&5 echo "$as_me: Creating VPATH links for data files" >&6;} fi for file in $coin_vpath_link_files; do dir=`(dirname "./$file") 2>/dev/null || $as_expr X"./$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"./$file" : 'X\(//\)[^/]' \| \ X"./$file" : 'X\(//\)$' \| \ X"./$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"./$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test -d $dir; then : ; else { if $as_mkdir_p; then mkdir -p $dir else as_dir=$dir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dir" >&5 echo "$as_me: error: cannot create directory $dir" >&2;} { (exit 1); exit 1; }; }; } fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi { echo "$as_me:$LINENO: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&5 echo "$as_me: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&6;} if test x$coin_projectdir = xyes; then { echo "$as_me:$LINENO: Configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} else { echo "$as_me:$LINENO: Main configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Main configuration of $PACKAGE_NAME successful" >&6;} fi else { echo "$as_me:$LINENO: No configuration of $PACKAGE_NAME necessary" >&5 echo "$as_me: No configuration of $PACKAGE_NAME necessary" >&6;} fi CoinMP-1.8.3/Data/Sample/brandy.mps0000644000175000017500000021631410662211140015406 0ustar renereneNAME BRANDY ROWS N 10000A E 10001A E 10002A E 10003A E 10004A L 10006A L 10007A E 10008A L 10009A L 10010A L 10011A L 10012A L 10013A E 10014A L 10015A L 10016A L 10017A L 10018A L 10019A L 10020A L 10021A L 10022A L 10023A L 10024A E 10025A E 10026A E 10027A E 10028A E 10029A E 10030A E 10031A E 10032A E 10033A E 10034A E 10035A E 10036A E 10037A E 10038A E 10039A L 10040A E 10041A E 10042A E 10043A E 10044A E 10045A E 10046A E 10047A E 10048A E 10049A E 10050A E 10051A E 10052A E 10053A E 10054A E 10055A E 10056A E 10057A E 10058A L 10059A L 10060A E 10061A E 10062A E 10063A E 10064A E 10065A E 10066A E 10067A E 10068A E 10069A E 10070A E 10071A E 10072A E 10073A E 10074A E 10075A E 10076A E 10077A E 10078A E 10079A E 10080A E 10081A E 10082A E 10083A E 10084A E 10085A E 10086A E 10087A E 10088A L 10089A E 10090A E 10091A E 10092A E 10093A E 10094A E 10095A E 10096A E 10097A E 10098A E 10099A E 10100A E 10101A E 10102A E 10103A E 10104A E 10105A E 10106A E 10107A E 10108A E 10109A E 10110A E 10111A E 10112A E 10113A E 10114A E 10115A E 10116A E 10117A E 10118A E 10119A E 10120A E 10121A L 10122A E 10123A E 10124A L 10125A E 10126A L 10127A E 10128A E 10129A L 10130A L 10131A L 10132A E 10133A E 10134A E 10135A L 10136A L 10137A E 10138A L 10139A E 10140A E 10141A E 10142A E 10143A E 10144A E 10145A E 10146A E 10147A E 10148A E 10149A E 10150A E 10151A E 10152A E 10153A E 10154A E 10155A E 10156A E 10157A E 10158A E 10159A L 10160A E 10161A L 10162A L 10163A L 10164A E 10165A E 10166A L 10167A L 10168A L 10169A E 10170A E 10171A E 10172A E 10173A E 10174A E 10175A E 10176A E 10177A L 10178A L 10179A L 10180A L 10181A L 10182A L 10183A L 10184A L 10185A L 10186A L 10187A L 10188A L 10189A L 10190A L 10191A L 10192A L 10193A E 10194A L 10195A E 10196A E 10197A E 10198A E 10199A E 10200A E 10201A E 10202A E 10203A E 10204A E 10205A E 10206A E 10207A E 10208A E 10209A E 10210A E 10211A E 10212A E 10213A E 10214A E 10215A E 10216A E 10217A E 10218A E 10219A E 10220A E 10221A COLUMNS 100001 10000A 1. 10056A -1. 100002 10000A 1. 10025A -1. 100100 10006A 1. 10008A 1. 100100 10025A 7. 10043A .003 100100 10044A .067 10045A .022 100100 10056A .01 10063A .22 100100 10064A .1 10065A .112 100100 10066A .349 10068A .125 100100 10144A .02 100101 10006A 1. 10014A 1. 100101 10025A 7.05 10043A .002 100101 10044A .012 10045A .003 100101 10047A .041 10048A .043 100101 10049A .017 10050A .09 100101 10051A .037 10056A .01 100101 10061A .006 10062A .12 100101 10065A .101 10066A .221 100101 10068A .161 10144A .02 100101 10154A .149 100103 10006A 1. 10014A 1. 100103 10025A 7.05 10043A .002 100103 10044A .012 10045A .003 100103 10047A .041 10048A .043 100103 10049A .017 10050A .09 100103 10051A .062 10056A .01 100103 10061A .007 10063A .173 100103 10064A .063 10065A .107 100103 10066A .221 10068A .161 100103 10144A .02 100109 10094A 1. 10107A 1. 100110 10006A 1. 10025A 7.6 100110 10043A .005 10044A .022 100110 10045A .005 10047A .061 100110 10048A .06 10049A .023 100110 10050A .117 10051A .074 100110 10056A .01 10061A .009 100110 10063A .17 10064A .062 100110 10065A .107 10066A .205 100110 10068A .08 10144A .02 100110 10160A 1. 100112 10006A 1. 10025A 7.24 100112 10043A .003 10044A .015 100112 10045A .005 10047A .037 100112 10048A .048 10049A .045 100112 10050A .127 10051A .052 100112 10056A .01 10061A .005 100112 10063A .164 10064A .081 100112 10065A .102 10066A .252 100112 10068A .062 10144A .02 100112 10162A 1. 100113 10006A 1. 10025A 7.17 100113 10043A .002 10044A .007 100113 10045A .002 10047A .036 100113 10048A .041 10049A .019 100113 10050A .098 10051A .058 100113 10056A .01 10061A .006 100113 10063A .179 10064A .068 100113 10065A .118 10066A .25 100113 10068A .117 10144A .02 100113 10163A 1. 100114 10014A -1. 10164A 1. 100120 10007A 1. 10010A 1. 100120 10025A 6.64 10043A .002 100120 10044A .01 10045A .003 100120 10047A .05 10048A .053 100120 10049A .022 10050A .108 100120 10051A .065 10053A .133 100120 10054A .099 10055A .263 100120 10056A .02 10057A .181 100120 10061A .012 10144A .022 100121 10007A 1. 10009A 1. 100121 10025A 5.9 10043A .001 100121 10044A .003 10045A .001 100121 10047A .021 10048A .022 100121 10049A .01 10050A .052 100121 10051A .042 10053A .122 100121 10054A .115 10055A .33 100121 10056A .02 10057A .276 100121 10061A .008 10144A .022 100122 10007A 1. 10025A 6.5 100122 10043A .001 10044A .004 100122 10045A .001 10047A .026 100122 10048A .028 10049A .013 100122 10050A .072 10051A .054 100122 10053A .158 10054A .155 100122 10055A .326 10056A .02 100122 10057A .154 10061A .011 100122 10144A .022 10167A 1. 100125 10007A 1. 10010A 1. 100125 10025A 6.64 10043A .002 100125 10044A .01 10045A .003 100125 10047A .05 10048A .053 100125 10049A .022 10050A .108 100125 10051A .065 10054A .032 100125 10055A .263 10056A .02 100125 10057A .181 10058A .2 100125 10061A .012 10144A .022 100125 10149A -2.23 10150A -.067 100126 10007A 1. 10009A 1. 100126 10025A 5.9 10043A .001 100126 10044A .003 10045A .001 100126 10047A .021 10048A .022 100126 10049A .01 10050A .052 100126 10051A .042 10054A .04 100126 10055A .33 10056A .02 100126 10057A .276 10058A .197 100126 10061A .008 10144A .022 100126 10149A -2.52 10150A -.112 100130 10007A .67 10012A 1. 100130 10025A 5.5 10044A .75 100130 10045A .25 10056A .03 100130 10144A .027 100131 10007A .67 10025A 7. 100131 10044A .05 10045A .95 100131 10056A .03 10122A 1. 100131 10144A .027 100132 10007A .67 10011A 1. 100132 10025A 7.5 10047A .7 100132 10048A .2 10049A .1 100132 10056A .01 10144A .021 100133 10006A 1. 10025A 4. 100133 10044A .75 10045A .25 100133 10056A .03 10144A .027 100133 10159A 1. 100134 10025A 8.5 10044A .05 100134 10045A .95 100140 10048A -.71 10049A -.29 100140 10151A 1. 100150 10043A -.13 10044A -.06 100150 10045A -.05 10046A -.04 100150 10047A -.04 10048A -.04 100150 10049A -.04 10050A -.14 100150 10051A -.05 10070A -.08 100150 10073A -.03 10080A -.07 100150 10081A -.03 10096A -.02 100150 10097A -.01 10098A -.01 100150 10100A 1. 10104A -.0012 100150 10105A -.0012 10107A -.08 100150 10120A -.06 100200 10017A 1. 10018A .565 100200 10041A .032 10043A .047 100200 10044A .007 10045A .027 100200 10046A .049 10056A .03 100200 10069A 1. 10070A .12 100200 10076A .134 10081A .052 100200 10086A .18 10087A .152 100200 10091A .219 10092A .032 100200 10093A .043 10144A .055 100200 10145A -1. 10146A -29. 100200 10147A -.75 100201 10017A 1.25 10018A .539 100201 10041A .032 10043A .041 100201 10044A .005 10045A .024 100201 10046A .044 10056A .03 100201 10069A 1. 10070A .12 100201 10076A .149 10081A .056 100201 10086A .193 10087A .163 100201 10091A .193 10092A .032 100201 10093A .041 10124A .81 100201 10125A .06 10126A .72 100201 10127A -.0015 10144A .058 100201 10145A -1. 10146A -29. 100201 10147A -.75 10207A .82 100203 10017A 1.5 10018A .526 100203 10041A .032 10043A .037 100203 10044A .005 10045A .02 100203 10046A .041 10056A .04 100203 10069A 1. 10070A .12 100203 10076A .16 10081A .058 100203 10086A .203 10087A .17 100203 10091A .175 10092A .032 100203 10093A .04 10124A 1.88 100203 10125A .11 10126A 1.25 100203 10127A -.0025 10144A .061 100203 10145A -1. 10146A -29. 100203 10147A -.75 10207A 1.88 100204 10017A 1. 10018A .758 100204 10041A .032 10043A .065 100204 10044A .014 10045A .045 100204 10046A .061 10056A .03 100204 10069A 1. 10070A .13 100204 10078A .164 10081A .058 100204 10086A .157 10087A .127 100204 10091A .165 10092A .032 100204 10093A .058 10144A .066 100204 10145A -1. 10146A -29. 100204 10147A -.75 100205 10017A 1.25 10018A .719 100205 10041A .032 10043A .06 100205 10044A .012 10045A .04 100205 10046A .054 10056A .03 100205 10069A 1. 10070A .13 100205 10078A .183 10081A .063 100205 10086A .169 10087A .136 100205 10091A .142 10092A .032 100205 10093A .055 10124A 1.34 100205 10125A .06 10126A .7 100205 10127A -.0008 10144A .068 100205 10145A -1. 10146A -29. 100205 10147A -.75 10207A 1.3 100207 10017A 1.5 10018A .707 100207 10041A .032 10043A .053 100207 10044A .011 10045A .037 100207 10046A .051 10056A .04 100207 10069A 1. 10070A .13 100207 10078A .196 10081A .066 100207 10086A .179 10087A .145 100207 10091A .122 10092A .032 100207 10093A .054 10124A 3.32 100207 10125A .09 10126A .76 100207 10127A -.0017 10144A .072 100207 10145A -1. 10146A -29. 100207 10147A -.75 10207A 3.27 100208 10017A 1. 10018A 1.015 100208 10041A .032 10043A .094 100208 10044A .023 10045A .066 100208 10046A .072 10056A .03 100208 10069A 1. 10070A .14 100208 10080A .177 10081A .06 100208 10086A .134 10087A .102 100208 10091A .112 10092A .032 100208 10093A .078 10144A .078 100208 10145A -1. 10146A -29. 100208 10147A -.75 100209 10017A 1.25 10018A .962 100209 10041A .032 10043A .082 100209 10044A .02 10045A .061 100209 10046A .064 10056A .04 100209 10069A 1. 10070A .14 100209 10080A .204 10081A .066 100209 10086A .146 10087A .112 100209 10091A .088 10092A .032 100209 10093A .074 10124A 1.63 100209 10125A .04 10126A .89 100209 10127A -.0009 10144A .081 100209 10145A -1. 10146A -29. 100209 10147A -.75 10207A 1.7 100212 10017A 1. 10018A .668 100212 10041A .01 10043A .07 100212 10044A .015 10045A .058 100212 10046A .058 10056A .03 100212 10064A -1. 10069A 1. 100212 10070A .094 10072A 6.1 100212 10074A -6.52 10081A .046 100212 10082A .165 10086A .159 100212 10087A .318 10091A .017 100212 10092A .01 10093A .051 100212 10136A -.215 10137A -3.18 100212 10144A .061 10208A 3.13 100213 10017A 1. 10018A .468 100213 10043A .057 10044A .01 100213 10045A .042 10046A .037 100213 10053A -1. 10056A .03 100213 10069A 1. 10070A .081 100213 10072A 3.9 10074A -12.04 100213 10081A .234 10083A .138 100213 10086A .391 10093A .036 100213 10136A -.02 10137A -5.86 100213 10144A .054 10208A 3.44 100214 10017A 1.5 10018A 1.195 100214 10041A .031 10043A .11 100214 10044A .029 10045A .079 100214 10046A .07 10056A .04 100214 10069A 1. 10070A .15 100214 10081A .065 10086A .135 100214 10087A .095 10091A .018 100214 10092A .031 10093A .091 100214 10124A 5.7 10125A -.02 100214 10126A 2. 10127A -.0012 100214 10144A .096 10145A -1. 100214 10146A -29. 10147A -.75 100214 10158A .231 10207A 5.45 100215 10017A 1.5 10018A .924 100215 10041A .032 10043A .073 100215 10044A .02 10045A .057 100215 10046A .061 10056A .04 100215 10069A 1. 10070A .14 100215 10080A .221 10081A .069 100215 10086A .156 10087A .12 100215 10091A .069 10092A .032 100215 10093A .071 10124A 4.46 100215 10125A .06 10126A 1.45 100215 10127A -.0014 10144A .083 100215 10145A -1. 10146A -29. 100215 10147A -.75 10207A 4.24 100216 10017A 1. 10018A 1.323 100216 10041A .031 10043A .137 100216 10044A .033 10045A .089 100216 10046A .083 10056A .04 100216 10069A 1. 10070A .15 100216 10081A .054 10086A .11 100216 10087A .075 10091A .066 100216 10092A .031 10093A .101 100216 10144A .093 10145A -1. 100216 10146A -29. 10147A -.75 100216 10158A .174 100217 10017A 1.25 10018A 1.234 100217 10041A .031 10043A .122 100217 10044A .03 10045A .083 100217 10046A .074 10056A .04 100217 10069A 1. 10070A .15 100217 10081A .061 10086A .124 100217 10087A .086 10091A .039 100217 10092A .031 10093A .094 100217 10124A 2.44 10125A -.02 100217 10126A 1.3 10127A -.0009 100217 10144A .094 10145A -1. 100217 10146A -29. 10147A -.75 100217 10158A .211 10207A 2.39 100218 10017A 1. 10018A .588 100218 10041A .006 10043A .064 100218 10044A .012 10045A .051 100218 10046A .051 10056A .03 100218 10069A 1. 10070A .081 100218 10072A 8. 10074A -8.03 100218 10081A .08 10082A .147 100218 10086A .385 10087A .119 100218 10091A .01 10092A .006 100218 10093A .045 10124A -.01 100218 10125A .06 10126A .26 100218 10127A -.0022 10136A -.247 100218 10137A -.27 10144A .056 100218 10154A -1. 10208A 4.27 100220 10015A 1. 10016A .64 100220 10043A .051 10044A .007 100220 10045A .021 10046A .044 100220 10056A .03 10070A .12 100220 10071A .137 10084A .18 100220 10085A .152 10090A .219 100220 10092A .032 10093A .032 100220 10098A .052 10144A .058 100220 10148A -1. 10149A -26. 100220 10150A -2.1 100221 10015A 1.25 10016A .628 100221 10043A .044 10044A .005 100221 10045A .018 10046A .039 100221 10056A .03 10070A .12 100221 10071A .152 10084A .193 100221 10085A .163 10090A .193 100221 10092A .032 10093A .031 100221 10098A .056 10124A .82 100221 10125A .07 10126A .68 100221 10127A -.0044 10144A .062 100221 10148A -1. 10149A -26. 100221 10150A -2.1 10207A .68 100223 10015A 1.5 10016A 1.099 100223 10043A .087 10044A .018 100223 10045A .046 10046A .052 100223 10056A .04 10070A .14 100223 10075A .21 10084A .156 100223 10085A .12 10090A .069 100223 10092A .032 10093A .054 100223 10098A .069 10124A 4.43 100223 10125A .1 10126A 1.48 100223 10127A -.0055 10144A .09 100223 10148A -1. 10149A -26. 100223 10150A -2.1 10207A 4.39 100224 10015A 1. 10016A .864 100224 10043A .074 10044A .014 100224 10045A .035 10046A .053 100224 10056A .03 10070A .13 100224 10073A .164 10084A .157 100224 10085A .127 10090A .165 100224 10092A .032 10093A .043 100224 10098A .058 10144A .07 100224 10148A -1. 10149A -26. 100224 10150A -2.1 100225 10015A 1.25 10016A .85 100225 10043A .065 10044A .012 100225 10045A .032 10046A .048 100225 10056A .04 10070A .13 100225 10073A .185 10084A .169 100225 10085A .136 10090A .142 100225 10092A .032 10093A .042 100225 10098A .063 10124A 1.24 100225 10125A .07 10126A .75 100225 10127A -.0037 10144A .074 100225 10148A -1. 10149A -26. 100225 10150A -2.1 10207A 1.31 100228 10015A 1. 10016A 1.192 100228 10043A .112 10044A .021 100228 10045A .054 10046A .063 100228 10056A .03 10070A .14 100228 10075A .168 10084A .134 100228 10085A .102 10090A .112 100228 10092A .032 10093A .059 100228 10098A .06 10144A .085 100228 10148A -1. 10149A -26. 100228 10150A -2.1 100229 10015A 1.25 10016A 1.113 100229 10043A .096 10044A .018 100229 10045A .049 10046A .055 100229 10056A .04 10070A .14 100229 10075A .195 10084A .146 100229 10085A .112 10090A .088 100229 10092A .032 10093A .055 100229 10098A .066 10124A 1.62 100229 10125A .07 10126A .95 100229 10127A -.0036 10144A .087 100229 10148A -1. 10149A -26. 100229 10150A -2.1 10207A 1.57 100232 10015A 1. 10016A 1.545 100232 10043A .166 10044A .031 100232 10045A .074 10046A .071 100232 10056A .03 10070A .15 100232 10084A .11 10085A .075 100232 10090A .066 10092A .031 100232 10093A .076 10098A .054 100232 10144A .102 10148A -1. 100232 10149A -26. 10150A -2.1 100232 10156A .151 100233 10015A 1.25 10016A 1.44 100233 10043A .14 10044A .028 100233 10045A .069 10046A .063 100233 10056A .04 10070A .15 100233 10084A .124 10085A .086 100233 10090A .039 10092A .031 100233 10093A .071 10098A .061 100233 10124A 2.53 10125A .04 100233 10126A 1.7 10127A -.0039 100233 10144A .102 10148A -1. 100233 10149A -26. 10150A -2.1 100233 10156A .192 10207A 2.44 100234 10015A 1.5 10016A .616 100234 10043A .039 10044A .005 100234 10045A .015 10046A .036 100234 10056A .04 10070A .12 100234 10071A .162 10084A .203 100234 10085A .17 10090A .175 100234 10092A .032 10093A .03 100234 10098A .058 10124A 2.22 100234 10125A .12 10126A 1.13 100234 10127A -.0069 10144A .065 100234 10148A -1. 10149A -26. 100234 10150A -2.1 10207A 1.98 100235 10015A 1.5 10016A .838 100235 10043A .059 10044A .011 100235 10045A .028 10046A .043 100235 10056A .04 10070A .13 100235 10073A .196 10084A .179 100235 10085A .145 10090A .122 100235 10092A .032 10093A .041 100235 10098A .065 10124A 3.55 100235 10125A .1 10126A 1.14 100235 10127A -.0058 10144A .077 100235 10148A -1. 10149A -26. 100235 10150A -2.1 10207A 3.58 100236 10015A 1.5 10016A 1.4 100236 10043A .131 10044A .027 100236 10045A .065 10046A .058 100236 10056A .04 10070A .15 100236 10084A .135 10085A .095 100236 10090A .018 10092A .031 100236 10093A .069 10098A .065 100236 10124A 5.94 10125A .06 100236 10126A 2.49 10127A -.0059 100236 10144A .104 10148A -1. 100236 10149A -26. 10150A -2.1 100236 10156A .211 10207A 5.8 100240 10017A .15 10065A -1.15 100240 10081A .15 10145A 1. 100240 10146A 32.3 10147A .357 100241 10066A -1. 10145A 1. 100241 10146A 27. 10147A .512 100242 10101A -1. 10145A 1. 100242 10146A 30.6 10147A .78 100243 10054A -1. 10145A 1. 100243 10146A 31.4 10147A 1.57 100245 10102A -1. 10145A 1. 100245 10146A 25.6 10147A 2.6 100250 10054A -1. 10148A 1. 100250 10149A 31.6 10150A 1.54 100251 10015A .05 10055A -1.05 100251 10098A .05 10148A 1. 100251 10149A 22.7 10150A 2.51 100252 10102A -1. 10148A 1. 100252 10149A 25.6 10150A 2.6 100254 10101A -1. 10148A 1. 100254 10149A 30.6 10150A .78 100270 10069A -1. 100280 10018A -.004 10041A -.004 100280 10044A -.003 10045A -.006 100280 10046A -.005 10056A -.001 100280 10070A -.004 10072A -.13 100280 10074A 1.33 10080A -.006 100280 10086A .006 10087A .019 100280 10091A -.003 10092A -.004 100280 10124A -.15 10125A -.07 100280 10126A -.12 10127A .0142 100280 10136A .088 10137A -.23 100280 10139A .025 10140A -.27 100280 10144A -.001 10147A -.32 100280 10207A -.15 10208A -.05 100281 10018A .004 10041A .004 100281 10044A .003 10045A .006 100281 10046A .005 10056A .001 100281 10070A .004 10072A .13 100281 10074A -1.33 10080A .006 100281 10086A -.006 10087A -.019 100281 10091A .003 10092A .004 100281 10124A .15 10125A .07 100281 10126A .12 10127A -.0142 100281 10136A -.088 10137A .23 100281 10139A -.025 10140A .27 100281 10144A .001 10147A .32 100281 10207A .15 10208A .05 100282 10018A -.336 10041A -.021 100282 10043A -.036 10044A -.009 100282 10045A -.007 10046A -.017 100282 10056A -.003 10070A -.03 100282 10072A 2.47 10074A 3.35 100282 10080A -.045 10081A .005 100282 10086A .018 10087A .112 100282 10091A .017 10092A -.021 100282 10093A -.026 10124A -.34 100282 10125A -.1 10126A .15 100282 10127A .0027 10136A .016 100282 10137A -4.65 10139A -.013 100282 10140A -1.18 10144A -.018 100282 10146A -5. 10207A -.34 100282 10208A 1.15 100283 10018A .336 10041A .021 100283 10043A .036 10044A .009 100283 10045A .007 10046A .017 100283 10056A .003 10070A .03 100283 10072A -2.47 10074A -3.35 100283 10080A .045 10081A -.005 100283 10086A -.018 10087A -.112 100283 10091A -.017 10092A .021 100283 10093A .026 10124A .34 100283 10125A .1 10126A -.15 100283 10127A -.0027 10136A -.016 100283 10137A 4.65 10139A .013 100283 10140A 1.18 10144A .018 100283 10146A 5. 10207A .34 100283 10208A -1.15 100290 10016A -.026 10043A -.002 100290 10044A -.003 10045A -.006 100290 10046A -.006 10056A -.001 100290 10070A -.008 10072A -.14 100290 10073A -.011 10074A -2.08 100290 10084A .003 10085A .029 100290 10090A .003 10092A -.006 100290 10093A -.001 10124A -.09 100290 10125A -.05 10126A -.04 100290 10127A .0247 10136A .121 100290 10137A -1.47 10139A .067 100290 10140A -.74 10144A -.002 100290 10150A -.5 10207A -.09 100290 10208A -.08 100291 10016A -.245 10043A -.008 100291 10044A -.008 10045A -.008 100291 10046A -.015 10056A -.003 100291 10070A -.032 10072A 4.52 100291 10073A -.048 10074A -7.83 100291 10084A .019 10085A .17 100291 10090A -.059 10092A -.025 100291 10093A -.012 10098A .001 100291 10124A -.08 10125A -.07 100291 10126A .13 10127A .0128 100291 10136A -.107 10137A -2.77 100291 10139A .015 10140A -1.54 100291 10144A -.014 10149A -5. 100291 10207A -.08 10208A 2.29 100292 10016A .245 10043A .008 100292 10044A .008 10045A .008 100292 10046A .015 10056A .003 100292 10070A .032 10072A -4.52 100292 10073A .048 10074A 7.83 100292 10084A -.019 10085A -.17 100292 10090A .059 10092A .025 100292 10093A .012 10098A -.001 100292 10124A .08 10125A .07 100292 10126A -.13 10127A -.0128 100292 10136A .107 10137A 2.77 100292 10139A -.015 10140A 1.54 100292 10144A .014 10149A 5. 100292 10207A .08 10208A -2.29 100293 10016A .026 10043A .002 100293 10044A .003 10045A .006 100293 10046A .006 10056A .001 100293 10070A .008 10072A .14 100293 10073A .011 10074A 2.08 100293 10084A -.003 10085A -.029 100293 10090A -.003 10092A .006 100293 10093A .001 10124A .09 100293 10125A .05 10126A .04 100293 10127A -.0247 10136A -.121 100293 10137A 1.47 10139A -.067 100293 10140A .74 10144A .002 100293 10150A .5 10207A .09 100293 10208A .08 100400 10043A .098 10044A .033 100400 10045A .022 10052A -1. 100400 10056A .44 10106A .838 100400 10144A .078 10168A 1. 100401 10043A .105 10044A .037 100401 10045A .024 10052A -1. 100401 10056A .44 10107A .821 100401 10144A .08 10168A 1. 100402 10043A .044 10044A -.33 100402 10045A .294 10056A .49 100402 10089A 1. 10144A .031 100402 10168A 2.5 100403 10023A 1. 10043A .098 100403 10044A .033 10045A .022 100403 10052A -1. 10056A .4 100403 10106A .838 10144A .062 100404 10023A 1. 10043A .105 100404 10044A .037 10045A .024 100404 10052A -1. 10056A .4 100404 10107A .821 10144A .063 100405 10023A 1. 10043A .116 100405 10044A .043 10045A .029 100405 10052A -1. 10056A .4 100405 10108A .798 10144A .065 100410 10024A 1. 10043A .098 100410 10044A .033 10045A .022 100410 10052A -1. 10056A .11 100410 10106A .838 10144A .067 100411 10024A 1. 10043A .105 100411 10044A .037 10045A .024 100411 10052A -1. 10056A .11 100411 10107A .821 10144A .068 100412 10024A 1. 10043A .116 100412 10044A .043 10045A .029 100412 10052A -1. 10056A .11 100412 10108A .798 10144A .07 100413 10024A 1. 10043A .1 100413 10044A .033 10045A .022 100413 10049A -.33 10052A -.67 100413 10056A .11 10106A .832 100413 10125A .33 10126A 1.16 100413 10144A .067 100414 10024A 1. 10043A .107 100414 10044A .037 10045A .025 100414 10049A -.33 10052A -.67 100414 10056A .11 10107A .815 100414 10125A .33 10126A 1.06 100414 10144A .068 100415 10024A 1. 10043A .119 100415 10044A .043 10045A .03 100415 10049A -.33 10052A -.67 100415 10056A .11 10108A .793 100415 10125A .24 10126A .63 100415 10144A .07 100440 10050A -1. 10052A 1. 100441 10051A -1. 10052A 1. 100500 10019A 1. 10022A .067 100500 10043A .053 10044A .009 100500 10045A .002 10046A .007 100500 10056A .25 10057A -1. 100500 10095A .039 10097A .148 100500 10102A .523 10105A .067 100500 10144A .058 100502 10019A 1. 10022A .06 100502 10043A .056 10044A .011 100502 10045A .002 10046A .009 100502 10056A .24 10068A -1. 100502 10095A .052 10096A .19 100502 10101A .515 10104A .06 100502 10144A .06 100503 10020A 1. 10021A .06 100503 10043A .056 10044A .011 100503 10045A .002 10046A .009 100503 10056A .19 10068A -1. 100503 10095A .052 10096A .19 100503 10101A .515 10104A .06 100503 10144A .061 100505 10020A 1. 10021A .067 100505 10043A .053 10044A .009 100505 10045A .002 10046A .007 100505 10056A .2 10057A -1. 100505 10095A .039 10097A .148 100505 10102A .523 10105A .067 100505 10144A .059 100506 10019A 1. 10022A .009 100506 10042A 1. 10043A .008 100506 10044A .001 10046A .001 100506 10051A -.053 10053A -.096 100506 10054A -.078 10055A -.061 100506 10056A .07 10057A -.041 100506 10063A -.143 10065A -.164 100506 10066A -.054 10068A -.1 100506 10080A -.21 10095A .007 100506 10096A .195 10097A .093 100506 10101A .648 10102A .021 100506 10104A .006 10105A .003 100506 10144A .047 100600 10045A -1. 10116A 1. 100601 10046A -1. 10117A 1. 100602 10043A .625 10044A -.368 100602 10045A -.562 10046A -.241 100602 10118A .018 10119A .153 100602 10204A 1. 100700 10056A .76 10116A -.663 100700 10117A -.571 10120A 1. 100700 10144A .02 100702 10056A 1.56 10060A 1. 100702 10070A -.606 10116A -.606 100702 10120A 1. 10124A 1.6 100702 10125A -3.6 10126A -12.1 100702 10127A .024 10130A 13.7 100702 10131A 16.1 10132A -.3 100702 10133A -9.9 10144A .02 100702 10207A 1.2 100796 10056A .04 10076A -1. 100796 10123A 1. 10124A 12.9 100796 10125A 3.4 10126A -.5 100796 10127A .185 10128A 1. 100796 10207A 2. 100797 10056A .04 10123A 1. 100797 10124A 8.1 10125A 5.3 100797 10126A 5.4 10127A .019 100797 10128A 1. 10158A -1. 100797 10207A -3.4 100798 10056A .04 10071A -1. 100798 10123A 1. 10124A 20.4 100798 10125A 3.4 10126A -1. 100798 10127A .416 10128A 1. 100798 10207A 6.4 100799 10056A .04 10123A 1. 100799 10124A 10.4 10125A 5.4 100799 10126A 5.3 10127A .057 100799 10128A 1. 10156A -1. 100799 10207A -3.3 100800 10044A -1. 10123A 1. 100800 10124A -4.5 10125A 65. 100800 10126A 125. 10127A .01 100800 10128A 1. 10207A -1.4 100801 10116A -1. 10123A 1. 100801 10124A -22.2 10125A 87. 100801 10126A 125. 10127A .01 100801 10128A 1. 10207A -20.2 100802 10117A -1. 10123A 1. 100802 10124A -6.6 10125A 70. 100802 10126A 125. 10127A .01 100802 10128A 1. 10207A -16.5 100803 10118A -1. 10123A 1. 100803 10124A -22.2 10125A 87. 100803 10126A 125. 10127A .01 100803 10128A 1. 10207A -20.2 100804 10119A -1. 10123A 1. 100804 10124A -6.6 10125A 70. 100804 10126A 125. 10127A .01 100804 10128A 1. 10207A -16.5 100805 10047A -1. 10056A .02 100805 10123A 1. 10124A 49.3 100805 10125A 9.7 10126A 58.3 100805 10127A .051 10128A 1. 100805 10207A 58.6 100806 10056A .03 10070A -1. 100806 10123A 1. 10124A 9. 100806 10125A 12.5 10126A 70. 100806 10127A .05 10128A 1. 100806 10207A -6.5 100807 10056A .03 10095A -1. 100807 10123A 1. 10124A 55.5 100807 10125A 12.5 10126A 70. 100807 10127A .08 10128A 1. 100807 10207A 47.3 100810 10056A .04 10078A -1. 100810 10123A 1. 10124A 12.4 100810 10125A 4. 10126A 1.5 100810 10127A .094 10128A 1. 100810 10207A .7 100812 10056A .04 10080A -1. 100812 10123A 1. 10124A 10.4 100812 10125A 4.7 10126A 3.5 100812 10127A .047 10128A 1. 100812 10207A -1.6 100813 10056A .04 10081A -1. 100813 10123A 1. 10124A 76. 100813 10125A .5 10126A -3.6 100813 10127A .16 10128A 1. 100813 10207A 50.5 100814 10056A .04 10082A -1. 100814 10123A 1. 10124A -9.8 100814 10125A 9.4 10126A 9. 100814 10127A -.008 10128A 1. 100814 10207A -33.4 100815 10056A .04 10083A -1. 100815 10123A 1. 10124A 203.7 100815 10125A 6.8 10126A 26. 100815 10127A .564 10128A 1. 100815 10207A 176. 100818 10056A .04 10073A -1. 100818 10123A 1. 10124A 18.5 100818 10125A 4. 10126A 1.1 100818 10127A .212 10128A 1. 100818 10207A 4.1 100820 10056A .04 10075A -1. 100820 10123A 1. 10124A 14.9 100820 10125A 4.7 10126A 3.1 100820 10127A .111 10128A 1. 100820 10207A .4 100821 10056A .04 10096A -1. 100821 10123A 1. 10124A 129. 100821 10125A 6. 10126A -7.5 100821 10127A .2 10128A 1. 100821 10207A 125. 100822 10056A .04 10097A -1. 100822 10123A 1. 10124A 143. 100822 10125A 6. 10126A -7.5 100822 10127A .9 10128A 1. 100822 10207A 139. 100823 10056A .04 10098A -1. 100823 10123A 1. 10124A 81. 100823 10125A .5 10126A -2.7 100823 10127A .6 10128A 1. 100823 10207A 53. 100825 10106A -1. 10123A 1. 100825 10124A 7.2 10125A 3.1 100825 10126A 3.6 10128A 1. 100826 10107A -1. 10123A 1. 100826 10124A .5 10125A 3.4 100826 10126A 4.8 10128A 1. 100826 10207A -8.5 100827 10108A -1. 10123A 1. 100827 10124A -5.8 10125A 3.8 100827 10126A 6.8 10128A 1. 100827 10207A -18.3 100835 10120A -1. 10123A 1. 100835 10124A -11.1 10125A 2.7 100835 10126A 1.2 10127A .01 100835 10128A 1. 10207A -6.5 100836 10121A -1. 10123A 1. 100836 10124A 26.1 10125A .5 100836 10126A -6. 10127A .02 100836 10128A 1. 10207A 31.5 100838 10048A -1. 10056A .02 100838 10123A 1. 10124A 62.4 100838 10125A 6.4 10126A 36.1 100838 10127A .044 10128A 1. 100838 10207A 70.8 100839 10049A -1. 10056A .02 100839 10123A 1. 10124A 91.2 100839 10125A 1.8 10126A -5.1 100839 10127A .039 10128A 1. 100839 10207A 97.1 100840 10027A 1. 10056A .295 100840 10123A -1. 10124A -20.6 100840 10127A -.115 100841 10027A 1. 10056A .395 100841 10123A -1. 10124A -25.6 100841 10127A -.115 100842 10027A 1. 10056A .495 100842 10123A -1. 10124A -29.8 100842 10127A -.115 100843 10027A 1. 10056A .595 100843 10123A -1. 10124A -33.5 100843 10127A -.115 100845 10125A -11.3 10126A -33.2 100845 10128A -1. 100846 10125A -11.5 10126A -31.2 100846 10128A -1. 100847 10125A -11.7 10126A -27.2 100847 10128A -1. 100848 10025A 50. 10125A -12.85 100848 10126A -35.75 10128A -1. 100849 10025A 50. 10125A -12.85 100849 10126A -22. 10128A -1. 100850 10044A -1. 10129A 1. 100850 10130A 8.6 10131A 13.2 100850 10132A 65. 10133A 125. 100855 10047A -1. 10056A .02 100855 10129A 1. 10130A 78.7 100855 10131A 92.2 10132A 10.2 100855 10133A 54.7 100856 10056A .03 10070A -1. 100856 10129A 1. 10130A 43. 100856 10131A 24. 10132A 12.5 100856 10133A 70. 100857 10056A .02 10129A 1. 100857 10130A 92. 10131A 105.4 100857 10132A 5.1 10133A 24.2 100857 10151A -1. 100875 10106A -1. 10129A 1. 100875 10130A 34. 10131A 31.3 100875 10132A 3.1 10133A 3.6 100876 10107A -1. 10129A 1. 100876 10130A 26.5 10131A 21.5 100876 10132A 3.4 10133A 4.8 100877 10108A -1. 10129A 1. 100877 10130A 18.5 10131A 11.2 100877 10132A 3.8 10133A 6.8 100885 10120A -1. 10129A 1. 100885 10130A .5 10131A 9.2 100885 10132A 2.7 10133A 1.2 100886 10121A -1. 10129A 1. 100886 10130A 39.8 10131A 45.5 100886 10132A .5 10133A -6. 100890 10026A 1. 10056A .323 100890 10129A -1. 10130A -18.6 100890 10131A -21.1 10134A -1. 100891 10026A 1. 10056A .423 100891 10129A -1. 10130A -23.6 100891 10131A -26.1 10134A -1. 100892 10026A 1. 10056A .523 100892 10129A -1. 10130A -27.8 100892 10131A -30.3 10134A -1. 100893 10026A 1. 10056A .623 100893 10129A -1. 10130A -31.5 100893 10131A -34. 10134A -1. 100895 10132A -11.3 10133A -33.2 100895 10134A 1. 100896 10132A -11.5 10133A -31.2 100896 10134A 1. 100897 10132A -11.7 10133A -27.2 100897 10134A 1. 100898 10025A 50. 10132A -12.85 100898 10133A -35.2 10134A 1. 100899 10025A 50. 10132A -12.85 100899 10133A -22. 10134A 1. 100900 10028A 1. 10044A -.05 100900 10056A .89 10110A -.05 100900 10120A -.889 10121A .089 100900 10144A .02 10151A -.1 101000 10056A .03 10062A -.5 101000 10063A -.5 10152A 1. 101012 10029A 1. 10051A -.4 101012 10056A .27 10062A -.25 101012 10151A -.35 101013 10029A 1. 10056A .27 101013 10061A -.4 10062A -.25 101013 10151A -.35 101021 10030A 1. 10051A -.45 101021 10056A .05 10062A -.55 101099 10031A 1. 10051A -1. 101099 10056A .03 101100 10031A 1. 10056A .03 101100 10063A -1. 101101 10031A 1. 10053A -.15 101101 10056A .03 10063A -.85 101102 10032A 1. 10056A .04 101102 10063A -.8 10064A -.2 101103 10032A 1. 10053A -.12 101103 10056A .04 10063A -.68 101103 10064A -.2 101107 10034A 1. 10056A .03 101107 10084A -.67 10086A -.13 101107 10087A -.2 101108 10034A 1. 10056A .03 101108 10084A -.38 10085A -.29 101108 10086A -.17 10087A -.03 101108 10098A -.13 101109 10034A 1. 10056A .03 101109 10086A -.85 10087A -.15 101110 10063A -1. 10072A 54.1 101110 10074A -23.6 10135A 1. 101110 10136A .072 10137A -18. 101110 10208A 42.1 101111 10064A -1. 10072A 60.7 101111 10074A .7 10135A 1. 101111 10136A .217 10137A 61. 101111 10208A 35.7 101112 10053A -1. 10072A 48.9 101112 10074A -31. 10135A 1. 101112 10136A .61 10137A -29. 101112 10208A 40.3 101113 10072A 28.5 10074A -4.2 101113 10084A -1. 10135A 1. 101113 10136A 1.9 10137A -21. 101113 10208A 26.6 101114 10072A 36. 10074A 4.3 101114 10085A -1. 10135A 1. 101114 10136A 1.95 10137A 32. 101114 10208A 22.9 101115 10072A 30. 10074A 4.5 101115 10086A -1. 10135A 1. 101115 10136A .67 10137A -16. 101115 10208A 27.8 101116 10072A 41. 10074A 11. 101116 10087A -1. 10135A 1. 101116 10136A .71 10137A 54. 101116 10208A 25.4 101117 10058A -1. 10072A 50.3 101117 10074A -20.2 10135A 1. 101117 10136A .893 10137A -16. 101117 10208A 37.3 101118 10072A 58.9 10074A -6.2 101118 10135A 1. 10136A .185 101118 10137A 26. 10154A -1. 101118 10208A 37.3 101119 10061A -1. 10072A 50. 101119 10074A -30. 10135A 1. 101119 10136A .11 10137A -39. 101119 10208A 48.2 101120 10072A 31. 10074A -18.2 101120 10081A -1. 10135A 1. 101120 10136A .16 10137A -38. 101120 10208A 36.3 101121 10051A -1. 10072A 50. 101121 10074A -30. 10135A 1. 101121 10136A .11 10137A -40. 101121 10208A 48.7 101122 10072A 28. 10074A -8.7 101122 10084A -.728 10098A -.272 101122 10135A 1. 10136A 1.55 101122 10137A -26. 10208A 28.5 101123 10056A .02 10137A -5. 101123 10211A 1. 101124 10056A .04 10137A -10. 101124 10211A 1. 101125 10033A 1. 10056A .04 101125 10135A -1. 10136A -.65 101125 10137A 10. 10211A -1. 101126 10025A 50. 10033A 1. 101126 10056A .04 10135A -1. 101126 10136A -.65 10137A 13. 101126 10211A -1. 101API 10208A -1. 101201 10035A 1. 10084A -.245 101201 10086A -.272 10141A -.483 101202 10035A 1. 10084A -.154 101202 10085A -.124 10086A -.149 101202 10087A -.114 10141A -.459 101203 10036A 1. 10090A -.13 101203 10091A -.13 10141A -.74 101204 10037A 1. 10194A -1. 101204 10195A -1.05 10196A -60. 101206 10038A 1. 10141A -1. 101207 10035A 1. 10086A -.327 101207 10087A -.25 10141A -.423 101210 10057A -1. 10138A 1. 101210 10139A 4.14 10140A 96.9 101211 10068A -1. 10138A 1. 101211 10139A .939 10140A 89.2 101213 10090A -1. 10138A 1. 101213 10139A 2.3 10140A 8. 101214 10091A -1. 10138A 1. 101214 10139A .82 10140A 8. 101215 10085A -1. 10138A 1. 101215 10139A 1.95 10140A -2.1 101216 10086A -1. 10138A 1. 101216 10139A .71 10140A 4.6 101217 10084A -1. 10138A 1. 101217 10139A 1.9 10140A -10.6 101219 10138A -1. 10139A -2.8 101219 10140A -60. 10141A 1. 101220 10092A -1. 10142A .977 101220 10143A .977 101221 10040A 1. 10068A -1. 101221 10142A .972 10143A .972 101222 10025A 50. 10057A -.7 101222 10090A -.3 10142A .947 101222 10143A .947 101224 10090A -1. 10142A .918 101224 10143A .918 101225 10043A -1. 10142A 1. 101226 10093A -1. 10142A 1. 101227 10025A 6.21 10142A 1. 101227 10169A 1. 101228 10013A 1. 10025A 4.97 101228 10142A 1. 101229 10044A -1. 10142A .636 101230 10141A -1. 10142A .943 101230 10143A .943 101231 10142A .931 10143A .931 101231 10153A -1. 101232 10085A -.5 10090A -.5 101232 10142A .915 10143A .915 101234 10143A -1. 101235 10142A -1. 10144A -1. 101236 10068A -1. 10194A 1. 101236 10195A .939 10196A 89.2 101237 10091A -1. 10194A 1. 101237 10195A .82 10196A 8. 101238 10064A -1. 10194A 1. 101238 10195A .22 10196A -4.9 101239 10041A -1. 10092A -1. 101239 10194A 1. 10195A 1.26 101239 10196A 61.5 101300 10039A 1. 10051A -.016 101300 10056A .18 10062A -.005 101300 10065A -.325 10066A -.755 101300 10084A -.065 10085A -.054 101300 10144A .042 10147A .31 101300 10153A .22 101CET 10072A -1. 101400 10057A .75 10197A 1. 101400 10203A .25 101401 10066A .075 10068A .525 101401 10198A 1. 10203A .4 101402 10057A 1. 10199A 1. 101403 10066A .17 10068A .83 101403 10200A 1. 101404 10057A -.75 10203A -.25 101404 10209A 1. 101405 10066A -.075 10068A -.525 101405 10203A -.4 10210A 1. 101406 10057A -1. 10201A 1. 101407 10066A -.17 10068A -.83 101407 10202A 1. 101408 10051A -.47 10084A -.36 101408 10090A -.17 10203A 1. 101VIS 10074A 1. 101600 10025A -17.86 10105A -1. 101601 10025A -23.21 10104A -1. 101I93 10207A -1. 102000 10001A -1. 10025A 10.5 102000 10027A 1. 102001 10025A 15. 10026A 1. 102002 10025A 50. 10031A 1. 102003 10025A 50. 10033A 1. 102004 10025A 50. 10038A 1. 102006 10025A 20. 10110A 1. 102500 10027A -1. 102502 10031A -1. 102503 10033A -1. 102504 10038A -1. 102I93 10207A 1. 103000 10031A 1. 10170A 1. 103001 10033A 1. 10171A 1. 103002 10038A 1. 10172A 1. 103003 10037A 1. 10173A 1. 103005 10145A 1. 10146A 29. 103005 10147A .75 10175A 1. 103006 10148A 1. 10149A 26. 103006 10150A 2.1 10176A 1. 103007 10044A .25 10116A .3 103007 10117A .45 10177A 1. 104003 10215A 100. 104004 10038A -1. 10183A 1. 104004 10219A 100. 104030 10059A 1. 10090A -1. 104030 10183A 1. 10216A 100. 104120 10084A -1. 10190A 1. 104120 10193A 1. 10217A 100. 104171 10148A -1. 10149A -26. 104171 10150A -2.1 10191A 1. 104171 10192A 1. 10218A 100. 104191 10084A -.6 10085A -.4 104191 10191A 1. 10193A 1. 104191 10220A 100. RHS ZZZZ0001 10006A 132.5 10007A 87.5 ZZZZ0001 10008A 8.1 10009A 55. ZZZZ0001 10010A 45. 10011A 3. ZZZZ0001 10012A 2.6 10013A 2.6 ZZZZ0001 10014A 80. 10015A 52. ZZZZ0001 10016A 30. 10017A 65.6 ZZZZ0001 10018A 45. 10019A 12.5 ZZZZ0001 10020A 15. 10021A .834 ZZZZ0001 10022A .536 10024A 20.2 ZZZZ0001 10026A 21.4 10027A 65.6 ZZZZ0001 10028A 2. 10029A 5.7 ZZZZ0001 10030A 3.3 10031A 10.3 ZZZZ0001 10032A 9. 10033A 33. ZZZZ0001 10034A 3. 10035A 4.35 ZZZZ0001 10036A .65 10037A 4. ZZZZ0001 10038A 13.4 10039A 7.2 ZZZZ0001 10040A 1.5 10042A 4. ZZZZ0001 10043A 3.5 10060A .8 ZZZZ0001 10089A 5. 10094A .2 ZZZZ0001 10100A 2. 10143A 3.5 ZZZZ0001 10144A -6.8 10152A 1.7 ZZZZ0001 10159A .6 10160A 40. ZZZZ0001 10163A 8. 10164A 14. ZZZZ0001 10167A 5. 10168A 10.6 ZZZZ0001 10169A .9 10201A 2.9 ZZZZ0001 10202A 2.5 10204A 1.06 ZZZZ0001 10209A 2.1 10210A .5 ENDATA CoinMP-1.8.3/Data/Sample/retail3.block0000644000175000017500000000266012136243266015776 0ustar renerene0 3 0 53 0 103 0 153 1 4 1 54 1 104 1 154 2 5 2 55 2 105 2 155 3 6 3 56 3 106 3 156 4 7 4 57 4 107 4 157 5 8 5 58 5 108 5 158 6 9 6 59 6 109 6 159 7 10 7 60 7 110 7 160 8 11 8 61 8 111 8 161 9 12 9 62 9 112 9 162 10 13 10 63 10 113 10 163 11 14 11 64 11 114 11 164 12 15 12 65 12 115 12 165 13 16 13 66 13 116 13 166 14 17 14 67 14 117 14 167 15 18 15 68 15 118 15 168 16 19 16 69 16 119 16 169 17 20 17 70 17 120 17 170 18 21 18 71 18 121 18 171 19 22 19 72 19 122 19 172 20 23 20 73 20 123 20 173 21 24 21 74 21 124 21 174 22 25 22 75 22 125 22 175 23 26 23 76 23 126 23 176 24 27 24 77 24 127 24 177 25 28 25 78 25 128 25 178 26 29 26 79 26 129 26 179 27 30 27 80 27 130 27 180 28 31 28 81 28 131 28 181 29 32 29 82 29 132 29 182 30 33 30 83 30 133 30 183 31 34 31 84 31 134 31 184 32 35 32 85 32 135 32 185 33 36 33 86 33 136 33 186 34 37 34 87 34 137 34 187 35 38 35 88 35 138 35 188 36 39 36 89 36 139 36 189 37 40 37 90 37 140 37 190 38 41 38 91 38 141 38 191 39 42 39 92 39 142 39 192 40 43 40 93 40 143 40 193 41 44 41 94 41 144 41 194 42 45 42 95 42 145 42 195 43 46 43 96 43 146 43 196 44 47 44 97 44 147 44 197 45 48 45 98 45 148 45 198 46 49 46 99 46 149 46 199 47 50 47 100 47 150 47 200 48 51 48 101 48 151 48 201 49 52 49 102 49 152 49 202 CoinMP-1.8.3/Data/Sample/app0110.time0000755000175000017500000000075411015552002015350 0ustar renereneTIME APP PERIODS LP X00101 K01 ROOT I00102 D00102 STAGE-2 I00103 D00103 STAGE-3 ENDATA CoinMP-1.8.3/Data/Sample/share2qp.mps0000644000175000017500000006224212550667521015673 0ustar renereneNAME SHARE2B ROWS N 000000 L 000004 L 000005 L 000006 L 000007 L 000008 L 000009 L 000010 L 000011 L 000012 E 000013 L 000014 L 000015 L 000016 L 000017 L 000018 L 000019 L 000020 L 000021 L 000022 E 000023 L 000024 L 000025 L 000026 L 000027 L 000028 L 000029 L 000030 L 000031 L 000032 E 000033 L 000034 L 000035 L 000036 L 000037 L 000038 L 000039 L 000040 L 000041 L 000042 E 000043 L 000044 L 000045 L 000046 L 000047 L 000048 L 000049 L 000050 L 000051 L 000052 E 000053 L 000054 L 000055 L 000056 L 000057 L 000058 L 000059 L 000060 L 000061 L 000062 E 000063 L 000064 L 000065 L 000066 L 000067 L 000068 L 000069 L 000070 L 000071 L 000072 L 000073 L 000074 L 000075 L 000076 L 000077 L 000078 L 000079 L 000080 L 000081 E 000082 E 000083 E 000084 E 000085 E 000086 E 000087 L 000088 L 000089 L 000090 L 000091 L 000092 L 000093 L 000094 L 000095 L 000096 L 000097 L 000098 E 000099 COLUMNS 010101 000004 65. 000005 1. 010101 000006 -1. 000007 -1. 010101 000008 -97.4 000009 -99.9 010101 000010 -83.7 000011 -85. 010101 000013 1. 010102 000004 5.5 000005 .68 010102 000006 -.96 000007 -1. 010102 000008 -84. 000009 -88.1 010102 000010 -79.4 000011 -83.2 010102 000013 1. 000064 1. 010103 000004 .8 000007 -.78 010103 000008 -87.9 000009 -82.9 010103 000010 -74.6 000011 -80.6 010103 000013 1. 000065 1. 010104 000004 4.5 000005 .27 010104 000006 -.97 000007 -1. 010104 000008 -97.9 000009 -100.3 010104 000010 -95. 000011 -98. 010104 000013 1. 000088 1. 010105 000004 1.5 000005 .12 010105 000006 -.36 000007 -.95 010105 000008 -60.6 000009 -76.3 010105 000010 -68.6 000011 -76.8 010105 000013 1. 000066 1. 010106 000000 .03 000004 6. 010106 000005 .19 000006 -.35 010106 000007 -.89 000008 -94.8 010106 000009 -96.6 000010 -83.8 010106 000011 -86.8 000013 1. 010106 000066 1.1 010107 000000 .06 000004 3.3 010107 000005 .07 000006 -.29 010107 000007 -.97 000008 -97.9 010107 000009 -100.3 000010 -95. 010107 000011 -98. 000013 1. 010107 000066 1.2 010108 000004 5.8 000005 .5 010108 000006 -.62 000007 -.98 010108 000008 -96.5 000009 -98.1 010108 000010 -80.8 000011 -81.5 010108 000013 1. 000067 1. 010120 000000 .09 000008 -2.1 010120 000009 -.7 000010 -2.3 010120 000011 -1. 000012 1. 010131 000000 -3.8 000004 -11. 010131 000005 -.5 000006 .5 010131 000007 .9 000008 100. 010131 000009 100. 000010 90. 010131 000011 90. 000012 -3. 010131 000013 -1. 000082 1. 010132 000000 -3.7 000082 -1. 010132 000083 1. 010133 000000 -3.5 000082 -1. 010133 000084 1. 010201 000014 65. 000015 1. 010201 000016 -1. 000017 -1. 010201 000018 -97.4 000019 -99.9 010201 000020 -83.7 000021 -85. 010201 000023 1. 010202 000014 5.5 000015 .57 010202 000016 -1. 000017 -1. 010202 000018 -84. 000019 -88.1 010202 000020 -79.4 000021 -83.2 010202 000023 1. 000064 1. 010203 000014 .8 000016 -.01 010203 000017 -.98 000018 -87.9 010203 000019 -82.9 000020 -74.6 010203 000021 -80.6 000023 1. 010203 000065 1. 010204 000014 1.5 000015 .12 010204 000016 -.36 000017 -.95 010204 000018 -60.6 000019 -76.3 010204 000020 -68.6 000021 -76.8 010204 000023 1. 000066 1. 010205 000000 .1 000014 2.7 010205 000015 .13 000016 -.28 010205 000017 -.79 000018 -77.9 010205 000019 -81.4 000020 -70.6 010205 000021 -74. 000023 1. 010205 000069 1. 010206 000014 5.8 000015 .46 010206 000016 -.67 000017 -1. 010206 000018 -96.5 000019 -98.1 010206 000020 -80.8 000021 -81.5 010206 000023 1. 000067 1. 010220 000000 .09 000018 -3.5 010220 000019 -1.9 000020 -3.4 010220 000021 -1.8 000022 1. 010231 000000 -3. 000014 -11. 010231 000015 -.5 000016 .5 010231 000017 .9 000018 89. 010231 000019 89. 000020 82. 010231 000021 82. 000022 -3. 010231 000023 -1. 000085 1. 010231 000089 -.25 010301 000024 70. 000025 1. 010301 000026 -1. 000027 -1. 010301 000028 -97.8 000029 -102.3 010301 000030 -94.8 000031 -99.8 010301 000033 1. 010302 000024 9.5 000025 .7 010302 000026 -.83 000027 -1. 010302 000028 -89.1 000029 -92. 010302 000030 -77.4 000031 -80.1 010302 000033 1. 000068 1. 010303 000024 2.7 000025 .13 010303 000026 -.28 000027 -.79 010303 000028 -77.9 000029 -81.4 010303 000030 -70.6 000031 -74. 010303 000033 1. 000069 1. 010304 000024 10.8 000025 .97 010304 000026 -1. 000027 -1. 010304 000028 -84.6 000029 -89.7 010304 000030 -83.6 000031 -89.4 010304 000033 1. 000070 1. 010305 000024 1.5 000025 .12 010305 000026 -.36 000027 -.95 010305 000028 -60.6 000029 -76.3 010305 000030 -68.6 000031 -76.8 010305 000033 1. 000071 1. 010306 000000 .06 000024 6.2 010306 000025 .19 000026 -.35 010306 000027 -.89 000028 -95.9 010306 000029 -97.6 000030 -85.4 010306 000031 -87.8 000033 1. 010306 000071 1.2 010307 000000 .03 000024 6. 010307 000025 .19 000026 -.35 010307 000027 -.89 000028 -94.8 010307 000029 -96.6 000030 -83.8 010307 000031 -86.8 000033 1. 010307 000071 1.1 010308 000000 .1 000024 4.5 010308 000025 .27 000026 -.97 010308 000027 -1. 000028 -97.9 010308 000029 -100.3 000030 -95. 010308 000031 -98. 000033 1. 010308 000088 1. 010309 000000 .1 000024 5.5 010309 000025 .68 000026 -.96 010309 000027 -1. 000028 -84. 010309 000029 -88.1 000030 -79.4 010309 000031 -83.2 000033 1. 010309 000064 1. 010310 000000 .1 000024 6.5 010310 000025 .48 000026 -.56 010310 000027 -.97 000028 -96.5 010310 000029 -97.1 000030 -82.2 010310 000031 -83.3 000033 1. 010310 000067 1. 010320 000000 .09 000028 -1.9 010320 000029 -.9 000030 -2.4 010320 000031 -.9 000032 1. 010331 000000 -3.7 000024 -11. 010331 000025 -.5 000026 .5 010331 000027 .9 000028 100. 010331 000029 100. 000030 90. 010331 000031 90. 000033 -1. 010331 000032 -3. 000083 1. 010333 000000 -3.5 000083 -1. 010333 000084 1. 010401 000034 70. 000035 1. 010401 000036 -1. 000037 -1. 010401 000038 -97.8 000039 -102.3 010401 000040 -94.8 000041 -99.8 010401 000043 1. 010402 000034 9.5 000035 .68 010402 000036 -.9 000037 -1. 010402 000038 -89.1 000039 -92. 010402 000040 -77.4 000041 -80.1 010402 000043 1. 000068 1. 010403 000034 2.7 000035 .09 010403 000036 -.37 000037 -.92 010403 000038 -77.9 000039 -81.4 010403 000040 -70.6 000041 -74. 010403 000043 1. 000069 1. 010404 000034 10.8 000035 .93 010404 000036 -1. 000037 -1. 010404 000038 -84.6 000039 -89.7 010404 000040 -83.6 000041 -89.4 010404 000043 1. 000070 1. 010405 000000 .03 000034 6.2 010405 000035 .15 000036 -.45 010405 000037 -.98 000038 -95.9 010405 000039 -97.6 000040 -85.4 010405 000041 -87.8 000043 1. 010405 000071 1.1 010406 000000 .1 000034 6.5 010406 000035 .45 000036 -.63 010406 000037 -1. 000038 -96.5 010406 000039 -97.1 000040 -82.2 010406 000041 -83.3 000043 1. 010406 000067 1. 010407 000034 1.5 000035 .12 010407 000036 -.36 000037 -.95 010407 000038 -60.6 000039 -76.3 010407 000040 -68.6 000041 -76.8 010407 000043 1. 000071 1. 010408 000000 .1 000034 5.5 010408 000035 .68 000036 -.96 010408 000037 -1. 000038 -84. 010408 000039 -88.1 000040 -79.4 010408 000041 -83.2 000043 1. 010408 000064 1. 010420 000000 .09 000038 -3.9 010420 000039 -1.4 000040 -3.5 010420 000041 -1.3 000042 1. 010431 000000 -2.9 000034 -11. 010431 000035 -.5 000036 .5 010431 000037 .9 000038 89. 010431 000039 89. 000040 82. 010431 000041 82. 000042 -3. 010431 000043 -1. 000086 1. 010432 000000 -2.8 000085 1. 010432 000086 -1. 000089 .75 010501 000044 56. 000045 1. 010501 000046 -1. 000047 -1. 010501 000048 -99.4 000049 -103. 010501 000050 -96.7 000051 -101.2 010501 000053 1. 010502 000044 1.8 000047 -1. 010502 000048 -87.9 000049 -91.6 010502 000050 -88.1 000051 -92. 010502 000053 1. 000072 1. 010503 000044 1.4 000047 -.54 010503 000048 -86.2 000049 -90. 010503 000050 -88. 000051 -91.3 010503 000053 1. 000073 1. 010504 000044 10.6 000045 .68 010504 000046 -.87 000047 -1. 010504 000048 -99.9 000049 -100.4 010504 000050 -80.8 000051 -81.7 010504 000053 1. 000074 1. 010505 000044 2.5 000047 -.65 010505 000048 -89.6 000049 -91.7 010505 000050 -79.3 000051 -82.1 010505 000053 1. 000075 1. 010506 000044 11.5 000045 .77 010506 000046 -.93 000047 -1. 010506 000048 -79.5 000049 -85.1 010506 000050 -80.2 000051 -86.2 010506 000053 1. 000076 1. 010507 000044 1.5 000045 .12 010507 000046 -.36 000047 -.95 010507 000048 -60.6 000049 -76.3 010507 000050 -68.6 000051 -76.8 010507 000053 1. 000077 1. 010508 000000 .03 000044 4.2 010508 000045 .08 000046 -.3 010508 000047 -.91 000048 -99.5 010508 000049 -99.9 000050 -87.6 010508 000051 -89. 000053 1. 010508 000077 1.1 010509 000000 .06 000044 4.3 010509 000045 .07 000046 -.27 010509 000047 -.9 000048 -101.4 010509 000049 -101.5 000050 -89. 010509 000051 -90.2 000053 1. 010509 000077 1.2 010520 000000 .09 000048 -1.6 010520 000049 -.8 000050 -2. 010520 000051 -.8 000052 1. 010531 000000 -3.5 000044 -10. 010531 000045 -.5 000046 .5 010531 000047 .9 000048 101. 010531 000049 101. 000050 91. 010531 000051 91. 000052 -3. 010531 000053 -1. 000084 1. 010601 000054 56. 000055 1. 010601 000056 -1. 000057 -1. 010601 000058 -97.7 000059 -100.6 010601 000060 -94.5 000061 -98.5 010601 000063 1. 010602 000054 10.6 000055 .39 010602 000056 -1. 000057 -1. 010602 000058 -98.2 000059 -98. 010602 000060 -78.6 000061 -79. 010602 000063 1. 000074 1. 010603 000054 2.5 000057 -.87 010603 000058 -87.9 000059 -89.3 010603 000060 -77.1 000061 -79.4 010603 000063 1. 000075 1. 010604 000054 3.6 000055 .27 010604 000056 -1. 000057 -1. 010604 000058 -78.8 000059 -82.7 010604 000060 -75.1 000061 -80.5 010604 000063 1. 000078 1. 010605 000054 11.5 000055 .73 010605 000056 -.98 000057 -1. 010605 000058 -78.2 000059 -82.7 010605 000060 -78. 000061 -83.5 010605 000063 1. 000076 1. 010606 000054 2. 000056 -.38 010606 000057 -1. 000058 -66.9 010606 000059 -71.4 000060 -67.6 010606 000061 -73.8 000063 1. 010606 000079 1. 010607 000054 14.6 000055 1. 010607 000056 -1. 000057 -1. 010607 000058 -74.7 000059 -79.8 010607 000060 -77.3 000061 -83. 010607 000063 1. 000080 1. 010608 000054 6.1 000055 .33 010608 000056 -.65 000057 -1. 010608 000058 -70.7 000059 -75.9 010608 000060 -69.6 000061 -75.3 010608 000063 1. 000081 1. 010609 000000 .03 000054 4.2 010609 000055 .04 000056 -.36 010609 000057 -.98 000058 -97.8 010609 000059 -97.5 000060 -85.4 010609 000061 -86.3 000063 1. 010609 000077 1.1 010620 000000 .09 000058 -3.3 010620 000059 -1.6 000060 -4.2 010620 000061 -1.7 000062 1. 010631 000000 -2.7 000054 -11. 010631 000055 -.5 000056 .5 010631 000057 .9 000058 89. 010631 000059 89. 000060 82. 010631 000061 82. 000062 -3. 010631 000063 -1. 000087 1. 010632 000000 -2.7 000085 1. 010632 000087 -1. 000089 .75 010633 000000 -2.7 000086 1. 010633 000087 -1. 010701 000090 56. 000091 1. 010701 000092 -1. 000093 -1. 010701 000094 -97.7 000095 -100.6 010701 000096 -94.5 000097 -98.5 010701 000099 1. 010702 000074 1. 000090 10.6 010702 000091 .39 000092 -1. 010702 000093 -1. 000094 -98.2 010702 000095 -98. 000096 -78.6 010702 000097 -79. 000099 1. 010703 000075 1. 000090 2.5 010703 000093 -.87 000094 -87.9 010703 000095 -89.3 000096 -77.1 010703 000097 -79.4 000099 1. 010704 000078 1. 000090 3.6 010704 000091 .27 000092 -1. 010704 000093 -1. 000094 -78.8 010704 000095 -82.7 000096 -75.1 010704 000097 -80.5 000099 1. 010705 000076 1. 000090 11.5 010705 000091 .73 000092 -.98 010705 000093 -1. 000094 -78.2 010705 000095 -82.7 000096 -78. 010705 000097 -83.5 000099 1. 010706 000079 1. 000090 2. 010706 000092 -.38 000093 -1. 010706 000094 -66.9 000095 -71.4 010706 000096 -67.6 000097 -73.8 010706 000099 1. 010707 000080 1. 000090 14.6 010707 000091 1. 000092 -1. 010707 000093 -1. 000094 -74.7 010707 000095 -79.8 000096 -77.3 010707 000097 -83. 000099 1. 010708 000000 .03 000077 1.1 010708 000090 4.2 000091 .04 010708 000092 -.36 000093 -.98 010708 000094 -97.8 000095 -97.5 010708 000096 -85.4 000097 -86.3 010708 000099 1. 010709 000000 .07 000077 1.2 010709 000090 4.3 000091 .07 010709 000092 -.27 000093 -.9 010709 000094 -101.4 000095 -101.5 010709 000096 -89. 000097 -90.2 010709 000099 1. 010720 000000 .09 000094 -3.3 010720 000095 -1.6 000096 -4.2 010720 000097 -1.7 000098 1. 010731 000000 -2.7 000090 -10. 010731 000091 -.5 000092 .5 010731 000093 .9 000094 90. 010731 000095 90. 000096 83. 010731 000097 83. 000098 -3. 010731 000099 -1. RHS RHS 000064 7. 000065 7. RHS 000066 7. 000067 21. RHS 000068 3. 000069 3. RHS 000070 3. 000071 7. RHS 000072 1.5 000073 1.5 RHS 000074 10. 000075 10. RHS 000076 8.5 000077 13. RHS 000078 1.5 000079 1.5 RHS 000080 1. 000081 1. RHS 000082 15. 000083 15. RHS 000084 20. 000085 20. RHS 000086 15. 000088 1. ENDATA NAME SHARE2B *QSECTION QUADOBJ 010101 010101 0.8849E+01 010101 010105 0.6270E+01 010101 010408 0.5408E+01 010101 010509 0.6205E+01 010105 010101 0.6270E+01 010105 010105 0.2591E+02 010105 010408 0.7510E+01 010105 010509 0.1418E+02 010105 010704 0.5939E+01 010105 010705 0.5249E+01 010408 010101 0.5408E+01 010408 010105 0.7510E+01 010408 010408 0.1270E+02 010408 010509 0.7433E+01 010509 010101 0.6205E+01 010509 010105 0.1418E+02 010509 010408 0.7433E+01 010509 010509 0.2358E+02 010509 010704 0.5230E+01 010509 010705 0.4622E+01 010704 010105 0.5939E+01 010704 010509 0.5230E+01 010704 010704 0.7815E+01 010704 010705 0.4934E+01 010705 010105 0.5249E+01 010705 010509 0.4622E+01 010705 010704 0.4934E+01 010705 010705 0.6105E+01 ENDATA CoinMP-1.8.3/Data/Sample/app0110R.time0000755000175000017500000000030011015552002015455 0ustar renereneNAME MYSMPS PERIODS LP C0000001 R0000001 STG00001 C0000029 R0000010 STG00002 C0000037 R0000014 STG00003 ENDATA CoinMP-1.8.3/Data/Sample/ltmain.sh0000755000175000017500000057753011405216230015244 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/Data/Sample/config.guess0000755000175000017500000012706311405216230015731 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Data/Sample/nw460.mps0000644000175000017500000000324710430174061015007 0ustar renerene* * small test problem from Nemhauser and Wolsey, page 460. * * knapsack problem with violated minimal covers * NAME nwp460 ROWS N obj L knap1 L knap2 COLUMNS SET00001 'MARKER' 'INTORG' x1 obj -77.000000 x1 knap1 774.000000 x1 knap2 67.000000 x2 obj -6.000000 x2 knap1 76.000000 x2 knap2 27.000000 x3 obj -3.000000 x3 knap1 22.000000 x3 knap2 794.000000 x4 obj -6.000000 x4 knap1 42.000000 x4 knap2 53.000000 x5 obj -33.000000 x5 knap1 21.000000 x5 knap2 234.000000 x6 obj -13.000000 x6 knap1 760.000000 x6 knap2 32.000000 x7 obj -110.000000 x7 knap1 818.000000 x7 knap2 797.000000 x8 obj -21.000000 x8 knap1 62.000000 x8 knap2 97.000000 x9 obj -47.000000 x9 knap1 785.000000 x9 knap2 435.000000 RHS RHS knap1 1500.000000 RHS knap2 1500.000000 BOUNDS BV ONE x1 1.000000 BV ONE x2 1.000000 BV ONE x3 1.000000 BV ONE x4 1.000000 BV ONE x5 1.000000 BV ONE x6 1.000000 ENDATA CoinMP-1.8.3/Data/Sample/app0110.cor0000755000175000017500000001210611015552002015167 0ustar renereneNAME APP ROWS N COST L K01 L K02 L K03 L K04 L K05 E D00101 E D00201 E D00301 E D00401 E D00102 E D00202 E D00302 E D00402 E D00103 E D00203 E D00303 E D00403 E D00104 E D00204 E D00304 E D00404 E D00105 E D00205 E D00305 E D00405 COLUMNS X00101 K01 1 D00101 1. X00201 K01 1 D00201 1. X00301 K01 1 D00301 1. X00401 K01 1 D00401 1. X00102 K02 1 D00102 1. X00202 K02 1 D00202 1. X00302 K02 1 D00302 1. X00402 K02 1 D00402 1. X00103 K03 1 D00103 1. X00203 K03 1 D00203 1. X00303 K03 1 D00303 1. X00403 K03 1 D00403 1. X00104 K04 1 D00104 1. X00204 K04 1 D00204 1. X00304 K04 1 D00304 1. X00404 K04 1 D00404 1. X00105 K05 1 D00105 1. X00205 K05 1 D00205 1. X00305 K05 1 D00305 1. X00405 K05 1 D00405 1. I00101 COST 1 D00101 -1. I00101 D00102 1. Y00101 COST 2 D00101 1. I00201 COST 2 D00201 -1. I00201 D00202 1. Y00201 COST 3 D00201 1. I00301 COST 3 D00301 -1. I00301 D00302 1. Y00301 COST 2 D00301 1. I00401 COST 4 D00401 -1. I00401 D00402 1. Y00401 COST 5 D00401 1. INT1 'MARKER' 'INTORG' I00102 COST 1 D00102 -1. I00102 D00103 1. Y00102 COST 2 D00102 1. I00202 COST 2 D00202 -1. I00202 D00203 1. Y00202 COST 3 D00202 1. INT1END 'MARKER' 'INTEND' I00302 COST 3 D00302 -1. I00302 D00303 1. Y00302 COST 2 D00302 1. I00402 COST 4 D00402 -1. I00402 D00403 1. Y00402 COST 5 D00402 1. I00103 COST 1 D00103 -1. I00103 D00104 1. Y00103 COST 2 D00103 1. I00203 COST 2 D00203 -1. I00203 D00204 1. Y00203 COST 3 D00203 1. I00303 COST 3 D00303 -1. I00303 D00304 1. Y00303 COST 2 D00303 1. I00403 COST 4 D00403 -1. I00403 D00404 1. Y00403 COST 5 D00403 1. I00104 COST 1 D00104 -1. I00104 D00105 1. Y00104 COST 2 D00104 1. I00204 COST 2 D00204 -1. I00204 D00205 1. Y00204 COST 3 D00204 1. I00304 COST 3 D00304 -1. I00304 D00305 1. Y00304 COST 2 D00304 1. I00404 COST 4 D00404 -1. I00404 D00405 1. Y00404 COST 5 D00404 1. I00105 COST 1 D00105 -1. Y00105 COST 2 D00105 1. I00205 COST 2 D00205 -1. Y00205 COST 3 D00205 1. I00305 COST 3 D00305 -1. Y00305 COST 2 D00305 1. I00405 COST 4 D00405 -1. Y00405 COST 5 D00405 1. RHS RHS K01 3 RHS K02 6 RHS K03 10 RHS K04 2000 RHS K05 18 RHS D00101 1.000 RHS D00201 1.000 RHS D00301 1.000 RHS D00401 1.000 RHS D00102 2.667 RHS D00202 1.667 RHS D00302 2.667 RHS D00402 3.333 RHS D00103 2.667 RHS D00203 2.000 RHS D00303 3.000 RHS D00403 3.000 RHS D00104 2.667 RHS D00204 2.667 RHS D00304 2.667 RHS D00404 2.667 RHS D00105 2.667 RHS D00205 2.333 RHS D00305 2.333 RHS D00405 2.333 BOUNDS UP BOUND1 I00102 51.000000 UP BOUND1 Y00102 51.000000 UP BOUND1 Y00202 51.000000 UP BOUND1 I00202 51.000000 ENDATA CoinMP-1.8.3/Data/Sample/tp3.mps0000644000175000017500000000162510430174061014635 0ustar renerene* * small test problem derived from P0548 * NAME tp3 ROWS N R1001 L R1006 G ROWA G ROWB COLUMNS SET00001 'MARKER' 'INTORG' C1045 R1001 155.000000 C1045 R1006 161.000000 C1045 ROWA 1.000000 C1047 R1006 -120.000000 C1050 R1006 -68.000000 C1050 ROWB 1.000000 RHS RHS R1006 -5.000000 RHS ROWA 0.627000 RHS ROWB 0.380000 BOUNDS BV ONE C1045 1.000000 BV ONE C1047 1.000000 BV ONE C1050 1.000000 ENDATA CoinMP-1.8.3/Data/Sample/block_milp.dec0000644000175000017500000000035312452373145016205 0ustar renereneNBLOCKS 4 BLOCK 1 C_5.0_1.0 C_6.0_1.0 C_7.0_1.0 BLOCK 2 C_8.0_2.0 C_9.0_2.0 C_10.0_2.0 C_11.0_2.0 C_12.0_2.0 BLOCK 3 C_13.0_3.0 C_14.0_3.0 C_15.0_3.0 C_16.0_3.0 BLOCK 4 C_17.0_4.0 C_18.0_4.0 C_19.0_4.0 C_20.0_4.0 CoinMP-1.8.3/Data/Sample/missing0000755000175000017500000002540611405216230015006 0ustar renerene#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Data/Sample/retail3.mps0000644000175000017500000037277212136243266015521 0ustar renereneNAME kohls3_ld1 ROWS N TotalCost E material_balance[Pack1] E material_balance[Pack2] E material_balance[Pack3] E demand_fit['71',S] E demand_fit['73',S] E demand_fit['86',S] E demand_fit['99',S] E demand_fit['103',S] E demand_fit['126',S] E demand_fit['221',S] E demand_fit['225',S] E demand_fit['251',S] E demand_fit['270',S] E demand_fit['272',S] E demand_fit['275',S] E demand_fit['276',S] E demand_fit['280',S] E demand_fit['282',S] E demand_fit['283',S] E demand_fit['293',S] E demand_fit['298',S] E demand_fit['299',S] E demand_fit['301',S] E demand_fit['309',S] E demand_fit['310',S] E demand_fit['375',S] E demand_fit['378',S] E demand_fit['379',S] E demand_fit['381',S] E demand_fit['383',S] E demand_fit['384',S] E demand_fit['386',S] E demand_fit['388',S] E demand_fit['389',S] E demand_fit['390',S] E demand_fit['397',S] E demand_fit['398',S] E demand_fit['403',S] E demand_fit['418',S] E demand_fit['430',S] E demand_fit['431',S] E demand_fit['479',S] E demand_fit['502',S] E demand_fit['504',S] E demand_fit['512',S] E demand_fit['528',S] E demand_fit['533',S] E demand_fit['538',S] E demand_fit['552',S] E demand_fit['621',S] E demand_fit['639',S] E demand_fit['712',S] E demand_fit['781',S] E demand_fit['71',M] E demand_fit['73',M] E demand_fit['86',M] E demand_fit['99',M] E demand_fit['103',M] E demand_fit['126',M] E demand_fit['221',M] E demand_fit['225',M] E demand_fit['251',M] E demand_fit['270',M] E demand_fit['272',M] E demand_fit['275',M] E demand_fit['276',M] E demand_fit['280',M] E demand_fit['282',M] E demand_fit['283',M] E demand_fit['293',M] E demand_fit['298',M] E demand_fit['299',M] E demand_fit['301',M] E demand_fit['309',M] E demand_fit['310',M] E demand_fit['375',M] E demand_fit['378',M] E demand_fit['379',M] E demand_fit['381',M] E demand_fit['383',M] E demand_fit['384',M] E demand_fit['386',M] E demand_fit['388',M] E demand_fit['389',M] E demand_fit['390',M] E demand_fit['397',M] E demand_fit['398',M] E demand_fit['403',M] E demand_fit['418',M] E demand_fit['430',M] E demand_fit['431',M] E demand_fit['479',M] E demand_fit['502',M] E demand_fit['504',M] E demand_fit['512',M] E demand_fit['528',M] E demand_fit['533',M] E demand_fit['538',M] E demand_fit['552',M] E demand_fit['621',M] E demand_fit['639',M] E demand_fit['712',M] E demand_fit['781',M] E demand_fit['71',L] E demand_fit['73',L] E demand_fit['86',L] E demand_fit['99',L] E demand_fit['103',L] E demand_fit['126',L] E demand_fit['221',L] E demand_fit['225',L] E demand_fit['251',L] E demand_fit['270',L] E demand_fit['272',L] E demand_fit['275',L] E demand_fit['276',L] E demand_fit['280',L] E demand_fit['282',L] E demand_fit['283',L] E demand_fit['293',L] E demand_fit['298',L] E demand_fit['299',L] E demand_fit['301',L] E demand_fit['309',L] E demand_fit['310',L] E demand_fit['375',L] E demand_fit['378',L] E demand_fit['379',L] E demand_fit['381',L] E demand_fit['383',L] E demand_fit['384',L] E demand_fit['386',L] E demand_fit['388',L] E demand_fit['389',L] E demand_fit['390',L] E demand_fit['397',L] E demand_fit['398',L] E demand_fit['403',L] E demand_fit['418',L] E demand_fit['430',L] E demand_fit['431',L] E demand_fit['479',L] E demand_fit['502',L] E demand_fit['504',L] E demand_fit['512',L] E demand_fit['528',L] E demand_fit['533',L] E demand_fit['538',L] E demand_fit['552',L] E demand_fit['621',L] E demand_fit['639',L] E demand_fit['712',L] E demand_fit['781',L] E demand_fit['71',XL] E demand_fit['73',XL] E demand_fit['86',XL] E demand_fit['99',XL] E demand_fit['103',XL] E demand_fit['126',XL] E demand_fit['221',XL] E demand_fit['225',XL] E demand_fit['251',XL] E demand_fit['270',XL] E demand_fit['272',XL] E demand_fit['275',XL] E demand_fit['276',XL] E demand_fit['280',XL] E demand_fit['282',XL] E demand_fit['283',XL] E demand_fit['293',XL] E demand_fit['298',XL] E demand_fit['299',XL] E demand_fit['301',XL] E demand_fit['309',XL] E demand_fit['310',XL] E demand_fit['375',XL] E demand_fit['378',XL] E demand_fit['379',XL] E demand_fit['381',XL] E demand_fit['383',XL] E demand_fit['384',XL] E demand_fit['386',XL] E demand_fit['388',XL] E demand_fit['389',XL] E demand_fit['390',XL] E demand_fit['397',XL] E demand_fit['398',XL] E demand_fit['403',XL] E demand_fit['418',XL] E demand_fit['430',XL] E demand_fit['431',XL] E demand_fit['479',XL] E demand_fit['502',XL] E demand_fit['504',XL] E demand_fit['512',XL] E demand_fit['528',XL] E demand_fit['533',XL] E demand_fit['538',XL] E demand_fit['552',XL] E demand_fit['621',XL] E demand_fit['639',XL] E demand_fit['712',XL] E demand_fit['781',XL] COLUMNS .MRK0000 'MARKER' 'INTORG' NumLooseInners['71',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['71',Pack1] demand_fit['71',S] 1 demand_fit['71',M] 3 NumLooseInners['71',Pack1] demand_fit['71',L] 4 demand_fit['71',XL] 4 NumLooseInners['73',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['73',Pack1] demand_fit['73',S] 1 demand_fit['73',M] 3 NumLooseInners['73',Pack1] demand_fit['73',L] 4 demand_fit['73',XL] 4 NumLooseInners['86',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['86',Pack1] demand_fit['86',S] 1 demand_fit['86',M] 3 NumLooseInners['86',Pack1] demand_fit['86',L] 4 demand_fit['86',XL] 4 NumLooseInners['99',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['99',Pack1] demand_fit['99',S] 1 demand_fit['99',M] 3 NumLooseInners['99',Pack1] demand_fit['99',L] 4 demand_fit['99',XL] 4 NumLooseInners['103',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['103',Pack1] demand_fit['103',S] 1 demand_fit['103',M] 3 NumLooseInners['103',Pack1] demand_fit['103',L] 4 demand_fit['103',XL] 4 NumLooseInners['126',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['126',Pack1] demand_fit['126',S] 1 demand_fit['126',M] 3 NumLooseInners['126',Pack1] demand_fit['126',L] 4 demand_fit['126',XL] 4 NumLooseInners['221',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['221',Pack1] demand_fit['221',S] 1 demand_fit['221',M] 3 NumLooseInners['221',Pack1] demand_fit['221',L] 4 demand_fit['221',XL] 4 NumLooseInners['225',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['225',Pack1] demand_fit['225',S] 1 demand_fit['225',M] 3 NumLooseInners['225',Pack1] demand_fit['225',L] 4 demand_fit['225',XL] 4 NumLooseInners['251',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['251',Pack1] demand_fit['251',S] 1 demand_fit['251',M] 3 NumLooseInners['251',Pack1] demand_fit['251',L] 4 demand_fit['251',XL] 4 NumLooseInners['270',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['270',Pack1] demand_fit['270',S] 1 demand_fit['270',M] 3 NumLooseInners['270',Pack1] demand_fit['270',L] 4 demand_fit['270',XL] 4 NumLooseInners['272',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['272',Pack1] demand_fit['272',S] 1 demand_fit['272',M] 3 NumLooseInners['272',Pack1] demand_fit['272',L] 4 demand_fit['272',XL] 4 NumLooseInners['275',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['275',Pack1] demand_fit['275',S] 1 demand_fit['275',M] 3 NumLooseInners['275',Pack1] demand_fit['275',L] 4 demand_fit['275',XL] 4 NumLooseInners['276',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['276',Pack1] demand_fit['276',S] 1 demand_fit['276',M] 3 NumLooseInners['276',Pack1] demand_fit['276',L] 4 demand_fit['276',XL] 4 NumLooseInners['280',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['280',Pack1] demand_fit['280',S] 1 demand_fit['280',M] 3 NumLooseInners['280',Pack1] demand_fit['280',L] 4 demand_fit['280',XL] 4 NumLooseInners['282',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['282',Pack1] demand_fit['282',S] 1 demand_fit['282',M] 3 NumLooseInners['282',Pack1] demand_fit['282',L] 4 demand_fit['282',XL] 4 NumLooseInners['283',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['283',Pack1] demand_fit['283',S] 1 demand_fit['283',M] 3 NumLooseInners['283',Pack1] demand_fit['283',L] 4 demand_fit['283',XL] 4 NumLooseInners['293',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['293',Pack1] demand_fit['293',S] 1 demand_fit['293',M] 3 NumLooseInners['293',Pack1] demand_fit['293',L] 4 demand_fit['293',XL] 4 NumLooseInners['298',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['298',Pack1] demand_fit['298',S] 1 demand_fit['298',M] 3 NumLooseInners['298',Pack1] demand_fit['298',L] 4 demand_fit['298',XL] 4 NumLooseInners['299',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['299',Pack1] demand_fit['299',S] 1 demand_fit['299',M] 3 NumLooseInners['299',Pack1] demand_fit['299',L] 4 demand_fit['299',XL] 4 NumLooseInners['301',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['301',Pack1] demand_fit['301',S] 1 demand_fit['301',M] 3 NumLooseInners['301',Pack1] demand_fit['301',L] 4 demand_fit['301',XL] 4 NumLooseInners['309',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['309',Pack1] demand_fit['309',S] 1 demand_fit['309',M] 3 NumLooseInners['309',Pack1] demand_fit['309',L] 4 demand_fit['309',XL] 4 NumLooseInners['310',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['310',Pack1] demand_fit['310',S] 1 demand_fit['310',M] 3 NumLooseInners['310',Pack1] demand_fit['310',L] 4 demand_fit['310',XL] 4 NumLooseInners['375',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['375',Pack1] demand_fit['375',S] 1 demand_fit['375',M] 3 NumLooseInners['375',Pack1] demand_fit['375',L] 4 demand_fit['375',XL] 4 NumLooseInners['378',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['378',Pack1] demand_fit['378',S] 1 demand_fit['378',M] 3 NumLooseInners['378',Pack1] demand_fit['378',L] 4 demand_fit['378',XL] 4 NumLooseInners['379',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['379',Pack1] demand_fit['379',S] 1 demand_fit['379',M] 3 NumLooseInners['379',Pack1] demand_fit['379',L] 4 demand_fit['379',XL] 4 NumLooseInners['381',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['381',Pack1] demand_fit['381',S] 1 demand_fit['381',M] 3 NumLooseInners['381',Pack1] demand_fit['381',L] 4 demand_fit['381',XL] 4 NumLooseInners['383',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['383',Pack1] demand_fit['383',S] 1 demand_fit['383',M] 3 NumLooseInners['383',Pack1] demand_fit['383',L] 4 demand_fit['383',XL] 4 NumLooseInners['384',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['384',Pack1] demand_fit['384',S] 1 demand_fit['384',M] 3 NumLooseInners['384',Pack1] demand_fit['384',L] 4 demand_fit['384',XL] 4 NumLooseInners['386',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['386',Pack1] demand_fit['386',S] 1 demand_fit['386',M] 3 NumLooseInners['386',Pack1] demand_fit['386',L] 4 demand_fit['386',XL] 4 NumLooseInners['388',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['388',Pack1] demand_fit['388',S] 1 demand_fit['388',M] 3 NumLooseInners['388',Pack1] demand_fit['388',L] 4 demand_fit['388',XL] 4 NumLooseInners['389',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['389',Pack1] demand_fit['389',S] 1 demand_fit['389',M] 3 NumLooseInners['389',Pack1] demand_fit['389',L] 4 demand_fit['389',XL] 4 NumLooseInners['390',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['390',Pack1] demand_fit['390',S] 1 demand_fit['390',M] 3 NumLooseInners['390',Pack1] demand_fit['390',L] 4 demand_fit['390',XL] 4 NumLooseInners['397',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['397',Pack1] demand_fit['397',S] 1 demand_fit['397',M] 3 NumLooseInners['397',Pack1] demand_fit['397',L] 4 demand_fit['397',XL] 4 NumLooseInners['398',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['398',Pack1] demand_fit['398',S] 1 demand_fit['398',M] 3 NumLooseInners['398',Pack1] demand_fit['398',L] 4 demand_fit['398',XL] 4 NumLooseInners['403',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['403',Pack1] demand_fit['403',S] 1 demand_fit['403',M] 3 NumLooseInners['403',Pack1] demand_fit['403',L] 4 demand_fit['403',XL] 4 NumLooseInners['418',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['418',Pack1] demand_fit['418',S] 1 demand_fit['418',M] 3 NumLooseInners['418',Pack1] demand_fit['418',L] 4 demand_fit['418',XL] 4 NumLooseInners['430',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['430',Pack1] demand_fit['430',S] 1 demand_fit['430',M] 3 NumLooseInners['430',Pack1] demand_fit['430',L] 4 demand_fit['430',XL] 4 NumLooseInners['431',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['431',Pack1] demand_fit['431',S] 1 demand_fit['431',M] 3 NumLooseInners['431',Pack1] demand_fit['431',L] 4 demand_fit['431',XL] 4 NumLooseInners['479',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['479',Pack1] demand_fit['479',S] 1 demand_fit['479',M] 3 NumLooseInners['479',Pack1] demand_fit['479',L] 4 demand_fit['479',XL] 4 NumLooseInners['502',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['502',Pack1] demand_fit['502',S] 1 demand_fit['502',M] 3 NumLooseInners['502',Pack1] demand_fit['502',L] 4 demand_fit['502',XL] 4 NumLooseInners['504',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['504',Pack1] demand_fit['504',S] 1 demand_fit['504',M] 3 NumLooseInners['504',Pack1] demand_fit['504',L] 4 demand_fit['504',XL] 4 NumLooseInners['512',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['512',Pack1] demand_fit['512',S] 1 demand_fit['512',M] 3 NumLooseInners['512',Pack1] demand_fit['512',L] 4 demand_fit['512',XL] 4 NumLooseInners['528',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['528',Pack1] demand_fit['528',S] 1 demand_fit['528',M] 3 NumLooseInners['528',Pack1] demand_fit['528',L] 4 demand_fit['528',XL] 4 NumLooseInners['533',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['533',Pack1] demand_fit['533',S] 1 demand_fit['533',M] 3 NumLooseInners['533',Pack1] demand_fit['533',L] 4 demand_fit['533',XL] 4 NumLooseInners['538',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['538',Pack1] demand_fit['538',S] 1 demand_fit['538',M] 3 NumLooseInners['538',Pack1] demand_fit['538',L] 4 demand_fit['538',XL] 4 NumLooseInners['552',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['552',Pack1] demand_fit['552',S] 1 demand_fit['552',M] 3 NumLooseInners['552',Pack1] demand_fit['552',L] 4 demand_fit['552',XL] 4 NumLooseInners['621',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['621',Pack1] demand_fit['621',S] 1 demand_fit['621',M] 3 NumLooseInners['621',Pack1] demand_fit['621',L] 4 demand_fit['621',XL] 4 NumLooseInners['639',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['639',Pack1] demand_fit['639',S] 1 demand_fit['639',M] 3 NumLooseInners['639',Pack1] demand_fit['639',L] 4 demand_fit['639',XL] 4 NumLooseInners['712',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['712',Pack1] demand_fit['712',S] 1 demand_fit['712',M] 3 NumLooseInners['712',Pack1] demand_fit['712',L] 4 demand_fit['712',XL] 4 NumLooseInners['781',Pack1] TotalCost 1 material_balance[Pack1] 1 NumLooseInners['781',Pack1] demand_fit['781',S] 1 demand_fit['781',M] 3 NumLooseInners['781',Pack1] demand_fit['781',L] 4 demand_fit['781',XL] 4 NumLooseInners['71',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['71',Pack2] demand_fit['71',S] 1 demand_fit['71',M] 2 NumLooseInners['71',Pack2] demand_fit['71',L] 4 demand_fit['71',XL] 5 NumLooseInners['73',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['73',Pack2] demand_fit['73',S] 1 demand_fit['73',M] 2 NumLooseInners['73',Pack2] demand_fit['73',L] 4 demand_fit['73',XL] 5 NumLooseInners['86',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['86',Pack2] demand_fit['86',S] 1 demand_fit['86',M] 2 NumLooseInners['86',Pack2] demand_fit['86',L] 4 demand_fit['86',XL] 5 NumLooseInners['99',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['99',Pack2] demand_fit['99',S] 1 demand_fit['99',M] 2 NumLooseInners['99',Pack2] demand_fit['99',L] 4 demand_fit['99',XL] 5 NumLooseInners['103',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['103',Pack2] demand_fit['103',S] 1 demand_fit['103',M] 2 NumLooseInners['103',Pack2] demand_fit['103',L] 4 demand_fit['103',XL] 5 NumLooseInners['126',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['126',Pack2] demand_fit['126',S] 1 demand_fit['126',M] 2 NumLooseInners['126',Pack2] demand_fit['126',L] 4 demand_fit['126',XL] 5 NumLooseInners['221',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['221',Pack2] demand_fit['221',S] 1 demand_fit['221',M] 2 NumLooseInners['221',Pack2] demand_fit['221',L] 4 demand_fit['221',XL] 5 NumLooseInners['225',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['225',Pack2] demand_fit['225',S] 1 demand_fit['225',M] 2 NumLooseInners['225',Pack2] demand_fit['225',L] 4 demand_fit['225',XL] 5 NumLooseInners['251',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['251',Pack2] demand_fit['251',S] 1 demand_fit['251',M] 2 NumLooseInners['251',Pack2] demand_fit['251',L] 4 demand_fit['251',XL] 5 NumLooseInners['270',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['270',Pack2] demand_fit['270',S] 1 demand_fit['270',M] 2 NumLooseInners['270',Pack2] demand_fit['270',L] 4 demand_fit['270',XL] 5 NumLooseInners['272',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['272',Pack2] demand_fit['272',S] 1 demand_fit['272',M] 2 NumLooseInners['272',Pack2] demand_fit['272',L] 4 demand_fit['272',XL] 5 NumLooseInners['275',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['275',Pack2] demand_fit['275',S] 1 demand_fit['275',M] 2 NumLooseInners['275',Pack2] demand_fit['275',L] 4 demand_fit['275',XL] 5 NumLooseInners['276',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['276',Pack2] demand_fit['276',S] 1 demand_fit['276',M] 2 NumLooseInners['276',Pack2] demand_fit['276',L] 4 demand_fit['276',XL] 5 NumLooseInners['280',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['280',Pack2] demand_fit['280',S] 1 demand_fit['280',M] 2 NumLooseInners['280',Pack2] demand_fit['280',L] 4 demand_fit['280',XL] 5 NumLooseInners['282',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['282',Pack2] demand_fit['282',S] 1 demand_fit['282',M] 2 NumLooseInners['282',Pack2] demand_fit['282',L] 4 demand_fit['282',XL] 5 NumLooseInners['283',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['283',Pack2] demand_fit['283',S] 1 demand_fit['283',M] 2 NumLooseInners['283',Pack2] demand_fit['283',L] 4 demand_fit['283',XL] 5 NumLooseInners['293',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['293',Pack2] demand_fit['293',S] 1 demand_fit['293',M] 2 NumLooseInners['293',Pack2] demand_fit['293',L] 4 demand_fit['293',XL] 5 NumLooseInners['298',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['298',Pack2] demand_fit['298',S] 1 demand_fit['298',M] 2 NumLooseInners['298',Pack2] demand_fit['298',L] 4 demand_fit['298',XL] 5 NumLooseInners['299',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['299',Pack2] demand_fit['299',S] 1 demand_fit['299',M] 2 NumLooseInners['299',Pack2] demand_fit['299',L] 4 demand_fit['299',XL] 5 NumLooseInners['301',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['301',Pack2] demand_fit['301',S] 1 demand_fit['301',M] 2 NumLooseInners['301',Pack2] demand_fit['301',L] 4 demand_fit['301',XL] 5 NumLooseInners['309',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['309',Pack2] demand_fit['309',S] 1 demand_fit['309',M] 2 NumLooseInners['309',Pack2] demand_fit['309',L] 4 demand_fit['309',XL] 5 NumLooseInners['310',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['310',Pack2] demand_fit['310',S] 1 demand_fit['310',M] 2 NumLooseInners['310',Pack2] demand_fit['310',L] 4 demand_fit['310',XL] 5 NumLooseInners['375',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['375',Pack2] demand_fit['375',S] 1 demand_fit['375',M] 2 NumLooseInners['375',Pack2] demand_fit['375',L] 4 demand_fit['375',XL] 5 NumLooseInners['378',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['378',Pack2] demand_fit['378',S] 1 demand_fit['378',M] 2 NumLooseInners['378',Pack2] demand_fit['378',L] 4 demand_fit['378',XL] 5 NumLooseInners['379',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['379',Pack2] demand_fit['379',S] 1 demand_fit['379',M] 2 NumLooseInners['379',Pack2] demand_fit['379',L] 4 demand_fit['379',XL] 5 NumLooseInners['381',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['381',Pack2] demand_fit['381',S] 1 demand_fit['381',M] 2 NumLooseInners['381',Pack2] demand_fit['381',L] 4 demand_fit['381',XL] 5 NumLooseInners['383',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['383',Pack2] demand_fit['383',S] 1 demand_fit['383',M] 2 NumLooseInners['383',Pack2] demand_fit['383',L] 4 demand_fit['383',XL] 5 NumLooseInners['384',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['384',Pack2] demand_fit['384',S] 1 demand_fit['384',M] 2 NumLooseInners['384',Pack2] demand_fit['384',L] 4 demand_fit['384',XL] 5 NumLooseInners['386',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['386',Pack2] demand_fit['386',S] 1 demand_fit['386',M] 2 NumLooseInners['386',Pack2] demand_fit['386',L] 4 demand_fit['386',XL] 5 NumLooseInners['388',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['388',Pack2] demand_fit['388',S] 1 demand_fit['388',M] 2 NumLooseInners['388',Pack2] demand_fit['388',L] 4 demand_fit['388',XL] 5 NumLooseInners['389',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['389',Pack2] demand_fit['389',S] 1 demand_fit['389',M] 2 NumLooseInners['389',Pack2] demand_fit['389',L] 4 demand_fit['389',XL] 5 NumLooseInners['390',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['390',Pack2] demand_fit['390',S] 1 demand_fit['390',M] 2 NumLooseInners['390',Pack2] demand_fit['390',L] 4 demand_fit['390',XL] 5 NumLooseInners['397',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['397',Pack2] demand_fit['397',S] 1 demand_fit['397',M] 2 NumLooseInners['397',Pack2] demand_fit['397',L] 4 demand_fit['397',XL] 5 NumLooseInners['398',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['398',Pack2] demand_fit['398',S] 1 demand_fit['398',M] 2 NumLooseInners['398',Pack2] demand_fit['398',L] 4 demand_fit['398',XL] 5 NumLooseInners['403',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['403',Pack2] demand_fit['403',S] 1 demand_fit['403',M] 2 NumLooseInners['403',Pack2] demand_fit['403',L] 4 demand_fit['403',XL] 5 NumLooseInners['418',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['418',Pack2] demand_fit['418',S] 1 demand_fit['418',M] 2 NumLooseInners['418',Pack2] demand_fit['418',L] 4 demand_fit['418',XL] 5 NumLooseInners['430',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['430',Pack2] demand_fit['430',S] 1 demand_fit['430',M] 2 NumLooseInners['430',Pack2] demand_fit['430',L] 4 demand_fit['430',XL] 5 NumLooseInners['431',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['431',Pack2] demand_fit['431',S] 1 demand_fit['431',M] 2 NumLooseInners['431',Pack2] demand_fit['431',L] 4 demand_fit['431',XL] 5 NumLooseInners['479',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['479',Pack2] demand_fit['479',S] 1 demand_fit['479',M] 2 NumLooseInners['479',Pack2] demand_fit['479',L] 4 demand_fit['479',XL] 5 NumLooseInners['502',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['502',Pack2] demand_fit['502',S] 1 demand_fit['502',M] 2 NumLooseInners['502',Pack2] demand_fit['502',L] 4 demand_fit['502',XL] 5 NumLooseInners['504',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['504',Pack2] demand_fit['504',S] 1 demand_fit['504',M] 2 NumLooseInners['504',Pack2] demand_fit['504',L] 4 demand_fit['504',XL] 5 NumLooseInners['512',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['512',Pack2] demand_fit['512',S] 1 demand_fit['512',M] 2 NumLooseInners['512',Pack2] demand_fit['512',L] 4 demand_fit['512',XL] 5 NumLooseInners['528',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['528',Pack2] demand_fit['528',S] 1 demand_fit['528',M] 2 NumLooseInners['528',Pack2] demand_fit['528',L] 4 demand_fit['528',XL] 5 NumLooseInners['533',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['533',Pack2] demand_fit['533',S] 1 demand_fit['533',M] 2 NumLooseInners['533',Pack2] demand_fit['533',L] 4 demand_fit['533',XL] 5 NumLooseInners['538',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['538',Pack2] demand_fit['538',S] 1 demand_fit['538',M] 2 NumLooseInners['538',Pack2] demand_fit['538',L] 4 demand_fit['538',XL] 5 NumLooseInners['552',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['552',Pack2] demand_fit['552',S] 1 demand_fit['552',M] 2 NumLooseInners['552',Pack2] demand_fit['552',L] 4 demand_fit['552',XL] 5 NumLooseInners['621',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['621',Pack2] demand_fit['621',S] 1 demand_fit['621',M] 2 NumLooseInners['621',Pack2] demand_fit['621',L] 4 demand_fit['621',XL] 5 NumLooseInners['639',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['639',Pack2] demand_fit['639',S] 1 demand_fit['639',M] 2 NumLooseInners['639',Pack2] demand_fit['639',L] 4 demand_fit['639',XL] 5 NumLooseInners['712',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['712',Pack2] demand_fit['712',S] 1 demand_fit['712',M] 2 NumLooseInners['712',Pack2] demand_fit['712',L] 4 demand_fit['712',XL] 5 NumLooseInners['781',Pack2] TotalCost 1.5 material_balance[Pack2] 1 NumLooseInners['781',Pack2] demand_fit['781',S] 1 demand_fit['781',M] 2 NumLooseInners['781',Pack2] demand_fit['781',L] 4 demand_fit['781',XL] 5 NumLooseInners['71',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['71',Pack3] demand_fit['71',S] 2 demand_fit['71',M] 4 NumLooseInners['71',Pack3] demand_fit['71',L] 3 demand_fit['71',XL] 3 NumLooseInners['73',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['73',Pack3] demand_fit['73',S] 2 demand_fit['73',M] 4 NumLooseInners['73',Pack3] demand_fit['73',L] 3 demand_fit['73',XL] 3 NumLooseInners['86',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['86',Pack3] demand_fit['86',S] 2 demand_fit['86',M] 4 NumLooseInners['86',Pack3] demand_fit['86',L] 3 demand_fit['86',XL] 3 NumLooseInners['99',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['99',Pack3] demand_fit['99',S] 2 demand_fit['99',M] 4 NumLooseInners['99',Pack3] demand_fit['99',L] 3 demand_fit['99',XL] 3 NumLooseInners['103',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['103',Pack3] demand_fit['103',S] 2 demand_fit['103',M] 4 NumLooseInners['103',Pack3] demand_fit['103',L] 3 demand_fit['103',XL] 3 NumLooseInners['126',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['126',Pack3] demand_fit['126',S] 2 demand_fit['126',M] 4 NumLooseInners['126',Pack3] demand_fit['126',L] 3 demand_fit['126',XL] 3 NumLooseInners['221',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['221',Pack3] demand_fit['221',S] 2 demand_fit['221',M] 4 NumLooseInners['221',Pack3] demand_fit['221',L] 3 demand_fit['221',XL] 3 NumLooseInners['225',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['225',Pack3] demand_fit['225',S] 2 demand_fit['225',M] 4 NumLooseInners['225',Pack3] demand_fit['225',L] 3 demand_fit['225',XL] 3 NumLooseInners['251',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['251',Pack3] demand_fit['251',S] 2 demand_fit['251',M] 4 NumLooseInners['251',Pack3] demand_fit['251',L] 3 demand_fit['251',XL] 3 NumLooseInners['270',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['270',Pack3] demand_fit['270',S] 2 demand_fit['270',M] 4 NumLooseInners['270',Pack3] demand_fit['270',L] 3 demand_fit['270',XL] 3 NumLooseInners['272',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['272',Pack3] demand_fit['272',S] 2 demand_fit['272',M] 4 NumLooseInners['272',Pack3] demand_fit['272',L] 3 demand_fit['272',XL] 3 NumLooseInners['275',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['275',Pack3] demand_fit['275',S] 2 demand_fit['275',M] 4 NumLooseInners['275',Pack3] demand_fit['275',L] 3 demand_fit['275',XL] 3 NumLooseInners['276',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['276',Pack3] demand_fit['276',S] 2 demand_fit['276',M] 4 NumLooseInners['276',Pack3] demand_fit['276',L] 3 demand_fit['276',XL] 3 NumLooseInners['280',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['280',Pack3] demand_fit['280',S] 2 demand_fit['280',M] 4 NumLooseInners['280',Pack3] demand_fit['280',L] 3 demand_fit['280',XL] 3 NumLooseInners['282',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['282',Pack3] demand_fit['282',S] 2 demand_fit['282',M] 4 NumLooseInners['282',Pack3] demand_fit['282',L] 3 demand_fit['282',XL] 3 NumLooseInners['283',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['283',Pack3] demand_fit['283',S] 2 demand_fit['283',M] 4 NumLooseInners['283',Pack3] demand_fit['283',L] 3 demand_fit['283',XL] 3 NumLooseInners['293',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['293',Pack3] demand_fit['293',S] 2 demand_fit['293',M] 4 NumLooseInners['293',Pack3] demand_fit['293',L] 3 demand_fit['293',XL] 3 NumLooseInners['298',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['298',Pack3] demand_fit['298',S] 2 demand_fit['298',M] 4 NumLooseInners['298',Pack3] demand_fit['298',L] 3 demand_fit['298',XL] 3 NumLooseInners['299',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['299',Pack3] demand_fit['299',S] 2 demand_fit['299',M] 4 NumLooseInners['299',Pack3] demand_fit['299',L] 3 demand_fit['299',XL] 3 NumLooseInners['301',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['301',Pack3] demand_fit['301',S] 2 demand_fit['301',M] 4 NumLooseInners['301',Pack3] demand_fit['301',L] 3 demand_fit['301',XL] 3 NumLooseInners['309',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['309',Pack3] demand_fit['309',S] 2 demand_fit['309',M] 4 NumLooseInners['309',Pack3] demand_fit['309',L] 3 demand_fit['309',XL] 3 NumLooseInners['310',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['310',Pack3] demand_fit['310',S] 2 demand_fit['310',M] 4 NumLooseInners['310',Pack3] demand_fit['310',L] 3 demand_fit['310',XL] 3 NumLooseInners['375',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['375',Pack3] demand_fit['375',S] 2 demand_fit['375',M] 4 NumLooseInners['375',Pack3] demand_fit['375',L] 3 demand_fit['375',XL] 3 NumLooseInners['378',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['378',Pack3] demand_fit['378',S] 2 demand_fit['378',M] 4 NumLooseInners['378',Pack3] demand_fit['378',L] 3 demand_fit['378',XL] 3 NumLooseInners['379',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['379',Pack3] demand_fit['379',S] 2 demand_fit['379',M] 4 NumLooseInners['379',Pack3] demand_fit['379',L] 3 demand_fit['379',XL] 3 NumLooseInners['381',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['381',Pack3] demand_fit['381',S] 2 demand_fit['381',M] 4 NumLooseInners['381',Pack3] demand_fit['381',L] 3 demand_fit['381',XL] 3 NumLooseInners['383',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['383',Pack3] demand_fit['383',S] 2 demand_fit['383',M] 4 NumLooseInners['383',Pack3] demand_fit['383',L] 3 demand_fit['383',XL] 3 NumLooseInners['384',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['384',Pack3] demand_fit['384',S] 2 demand_fit['384',M] 4 NumLooseInners['384',Pack3] demand_fit['384',L] 3 demand_fit['384',XL] 3 NumLooseInners['386',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['386',Pack3] demand_fit['386',S] 2 demand_fit['386',M] 4 NumLooseInners['386',Pack3] demand_fit['386',L] 3 demand_fit['386',XL] 3 NumLooseInners['388',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['388',Pack3] demand_fit['388',S] 2 demand_fit['388',M] 4 NumLooseInners['388',Pack3] demand_fit['388',L] 3 demand_fit['388',XL] 3 NumLooseInners['389',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['389',Pack3] demand_fit['389',S] 2 demand_fit['389',M] 4 NumLooseInners['389',Pack3] demand_fit['389',L] 3 demand_fit['389',XL] 3 NumLooseInners['390',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['390',Pack3] demand_fit['390',S] 2 demand_fit['390',M] 4 NumLooseInners['390',Pack3] demand_fit['390',L] 3 demand_fit['390',XL] 3 NumLooseInners['397',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['397',Pack3] demand_fit['397',S] 2 demand_fit['397',M] 4 NumLooseInners['397',Pack3] demand_fit['397',L] 3 demand_fit['397',XL] 3 NumLooseInners['398',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['398',Pack3] demand_fit['398',S] 2 demand_fit['398',M] 4 NumLooseInners['398',Pack3] demand_fit['398',L] 3 demand_fit['398',XL] 3 NumLooseInners['403',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['403',Pack3] demand_fit['403',S] 2 demand_fit['403',M] 4 NumLooseInners['403',Pack3] demand_fit['403',L] 3 demand_fit['403',XL] 3 NumLooseInners['418',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['418',Pack3] demand_fit['418',S] 2 demand_fit['418',M] 4 NumLooseInners['418',Pack3] demand_fit['418',L] 3 demand_fit['418',XL] 3 NumLooseInners['430',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['430',Pack3] demand_fit['430',S] 2 demand_fit['430',M] 4 NumLooseInners['430',Pack3] demand_fit['430',L] 3 demand_fit['430',XL] 3 NumLooseInners['431',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['431',Pack3] demand_fit['431',S] 2 demand_fit['431',M] 4 NumLooseInners['431',Pack3] demand_fit['431',L] 3 demand_fit['431',XL] 3 NumLooseInners['479',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['479',Pack3] demand_fit['479',S] 2 demand_fit['479',M] 4 NumLooseInners['479',Pack3] demand_fit['479',L] 3 demand_fit['479',XL] 3 NumLooseInners['502',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['502',Pack3] demand_fit['502',S] 2 demand_fit['502',M] 4 NumLooseInners['502',Pack3] demand_fit['502',L] 3 demand_fit['502',XL] 3 NumLooseInners['504',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['504',Pack3] demand_fit['504',S] 2 demand_fit['504',M] 4 NumLooseInners['504',Pack3] demand_fit['504',L] 3 demand_fit['504',XL] 3 NumLooseInners['512',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['512',Pack3] demand_fit['512',S] 2 demand_fit['512',M] 4 NumLooseInners['512',Pack3] demand_fit['512',L] 3 demand_fit['512',XL] 3 NumLooseInners['528',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['528',Pack3] demand_fit['528',S] 2 demand_fit['528',M] 4 NumLooseInners['528',Pack3] demand_fit['528',L] 3 demand_fit['528',XL] 3 NumLooseInners['533',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['533',Pack3] demand_fit['533',S] 2 demand_fit['533',M] 4 NumLooseInners['533',Pack3] demand_fit['533',L] 3 demand_fit['533',XL] 3 NumLooseInners['538',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['538',Pack3] demand_fit['538',S] 2 demand_fit['538',M] 4 NumLooseInners['538',Pack3] demand_fit['538',L] 3 demand_fit['538',XL] 3 NumLooseInners['552',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['552',Pack3] demand_fit['552',S] 2 demand_fit['552',M] 4 NumLooseInners['552',Pack3] demand_fit['552',L] 3 demand_fit['552',XL] 3 NumLooseInners['621',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['621',Pack3] demand_fit['621',S] 2 demand_fit['621',M] 4 NumLooseInners['621',Pack3] demand_fit['621',L] 3 demand_fit['621',XL] 3 NumLooseInners['639',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['639',Pack3] demand_fit['639',S] 2 demand_fit['639',M] 4 NumLooseInners['639',Pack3] demand_fit['639',L] 3 demand_fit['639',XL] 3 NumLooseInners['712',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['712',Pack3] demand_fit['712',S] 2 demand_fit['712',M] 4 NumLooseInners['712',Pack3] demand_fit['712',L] 3 demand_fit['712',XL] 3 NumLooseInners['781',Pack3] TotalCost 0.5 material_balance[Pack3] 1 NumLooseInners['781',Pack3] demand_fit['781',S] 2 demand_fit['781',M] 4 NumLooseInners['781',Pack3] demand_fit['781',L] 3 demand_fit['781',XL] 3 NumUnopenedOuters['71',Pack1] TotalCost 1 demand_fit['71',S] 1 NumUnopenedOuters['71',Pack1] demand_fit['71',M] 3 demand_fit['71',L] 4 NumUnopenedOuters['71',Pack1] demand_fit['71',XL] 4 NumUnopenedOuters['73',Pack1] TotalCost 1 demand_fit['73',S] 1 NumUnopenedOuters['73',Pack1] demand_fit['73',M] 3 demand_fit['73',L] 4 NumUnopenedOuters['73',Pack1] demand_fit['73',XL] 4 NumUnopenedOuters['86',Pack1] TotalCost 1 demand_fit['86',S] 1 NumUnopenedOuters['86',Pack1] demand_fit['86',M] 3 demand_fit['86',L] 4 NumUnopenedOuters['86',Pack1] demand_fit['86',XL] 4 NumUnopenedOuters['99',Pack1] TotalCost 1 demand_fit['99',S] 1 NumUnopenedOuters['99',Pack1] demand_fit['99',M] 3 demand_fit['99',L] 4 NumUnopenedOuters['99',Pack1] demand_fit['99',XL] 4 NumUnopenedOuters['103',Pack1] TotalCost 1 demand_fit['103',S] 1 NumUnopenedOuters['103',Pack1] demand_fit['103',M] 3 demand_fit['103',L] 4 NumUnopenedOuters['103',Pack1] demand_fit['103',XL] 4 NumUnopenedOuters['126',Pack1] TotalCost 1 demand_fit['126',S] 1 NumUnopenedOuters['126',Pack1] demand_fit['126',M] 3 demand_fit['126',L] 4 NumUnopenedOuters['126',Pack1] demand_fit['126',XL] 4 NumUnopenedOuters['221',Pack1] TotalCost 1 demand_fit['221',S] 1 NumUnopenedOuters['221',Pack1] demand_fit['221',M] 3 demand_fit['221',L] 4 NumUnopenedOuters['221',Pack1] demand_fit['221',XL] 4 NumUnopenedOuters['225',Pack1] TotalCost 1 demand_fit['225',S] 1 NumUnopenedOuters['225',Pack1] demand_fit['225',M] 3 demand_fit['225',L] 4 NumUnopenedOuters['225',Pack1] demand_fit['225',XL] 4 NumUnopenedOuters['251',Pack1] TotalCost 1 demand_fit['251',S] 1 NumUnopenedOuters['251',Pack1] demand_fit['251',M] 3 demand_fit['251',L] 4 NumUnopenedOuters['251',Pack1] demand_fit['251',XL] 4 NumUnopenedOuters['270',Pack1] TotalCost 1 demand_fit['270',S] 1 NumUnopenedOuters['270',Pack1] demand_fit['270',M] 3 demand_fit['270',L] 4 NumUnopenedOuters['270',Pack1] demand_fit['270',XL] 4 NumUnopenedOuters['272',Pack1] TotalCost 1 demand_fit['272',S] 1 NumUnopenedOuters['272',Pack1] demand_fit['272',M] 3 demand_fit['272',L] 4 NumUnopenedOuters['272',Pack1] demand_fit['272',XL] 4 NumUnopenedOuters['275',Pack1] TotalCost 1 demand_fit['275',S] 1 NumUnopenedOuters['275',Pack1] demand_fit['275',M] 3 demand_fit['275',L] 4 NumUnopenedOuters['275',Pack1] demand_fit['275',XL] 4 NumUnopenedOuters['276',Pack1] TotalCost 1 demand_fit['276',S] 1 NumUnopenedOuters['276',Pack1] demand_fit['276',M] 3 demand_fit['276',L] 4 NumUnopenedOuters['276',Pack1] demand_fit['276',XL] 4 NumUnopenedOuters['280',Pack1] TotalCost 1 demand_fit['280',S] 1 NumUnopenedOuters['280',Pack1] demand_fit['280',M] 3 demand_fit['280',L] 4 NumUnopenedOuters['280',Pack1] demand_fit['280',XL] 4 NumUnopenedOuters['282',Pack1] TotalCost 1 demand_fit['282',S] 1 NumUnopenedOuters['282',Pack1] demand_fit['282',M] 3 demand_fit['282',L] 4 NumUnopenedOuters['282',Pack1] demand_fit['282',XL] 4 NumUnopenedOuters['283',Pack1] TotalCost 1 demand_fit['283',S] 1 NumUnopenedOuters['283',Pack1] demand_fit['283',M] 3 demand_fit['283',L] 4 NumUnopenedOuters['283',Pack1] demand_fit['283',XL] 4 NumUnopenedOuters['293',Pack1] TotalCost 1 demand_fit['293',S] 1 NumUnopenedOuters['293',Pack1] demand_fit['293',M] 3 demand_fit['293',L] 4 NumUnopenedOuters['293',Pack1] demand_fit['293',XL] 4 NumUnopenedOuters['298',Pack1] TotalCost 1 demand_fit['298',S] 1 NumUnopenedOuters['298',Pack1] demand_fit['298',M] 3 demand_fit['298',L] 4 NumUnopenedOuters['298',Pack1] demand_fit['298',XL] 4 NumUnopenedOuters['299',Pack1] TotalCost 1 demand_fit['299',S] 1 NumUnopenedOuters['299',Pack1] demand_fit['299',M] 3 demand_fit['299',L] 4 NumUnopenedOuters['299',Pack1] demand_fit['299',XL] 4 NumUnopenedOuters['301',Pack1] TotalCost 1 demand_fit['301',S] 1 NumUnopenedOuters['301',Pack1] demand_fit['301',M] 3 demand_fit['301',L] 4 NumUnopenedOuters['301',Pack1] demand_fit['301',XL] 4 NumUnopenedOuters['309',Pack1] TotalCost 1 demand_fit['309',S] 1 NumUnopenedOuters['309',Pack1] demand_fit['309',M] 3 demand_fit['309',L] 4 NumUnopenedOuters['309',Pack1] demand_fit['309',XL] 4 NumUnopenedOuters['310',Pack1] TotalCost 1 demand_fit['310',S] 1 NumUnopenedOuters['310',Pack1] demand_fit['310',M] 3 demand_fit['310',L] 4 NumUnopenedOuters['310',Pack1] demand_fit['310',XL] 4 NumUnopenedOuters['375',Pack1] TotalCost 1 demand_fit['375',S] 1 NumUnopenedOuters['375',Pack1] demand_fit['375',M] 3 demand_fit['375',L] 4 NumUnopenedOuters['375',Pack1] demand_fit['375',XL] 4 NumUnopenedOuters['378',Pack1] TotalCost 1 demand_fit['378',S] 1 NumUnopenedOuters['378',Pack1] demand_fit['378',M] 3 demand_fit['378',L] 4 NumUnopenedOuters['378',Pack1] demand_fit['378',XL] 4 NumUnopenedOuters['379',Pack1] TotalCost 1 demand_fit['379',S] 1 NumUnopenedOuters['379',Pack1] demand_fit['379',M] 3 demand_fit['379',L] 4 NumUnopenedOuters['379',Pack1] demand_fit['379',XL] 4 NumUnopenedOuters['381',Pack1] TotalCost 1 demand_fit['381',S] 1 NumUnopenedOuters['381',Pack1] demand_fit['381',M] 3 demand_fit['381',L] 4 NumUnopenedOuters['381',Pack1] demand_fit['381',XL] 4 NumUnopenedOuters['383',Pack1] TotalCost 1 demand_fit['383',S] 1 NumUnopenedOuters['383',Pack1] demand_fit['383',M] 3 demand_fit['383',L] 4 NumUnopenedOuters['383',Pack1] demand_fit['383',XL] 4 NumUnopenedOuters['384',Pack1] TotalCost 1 demand_fit['384',S] 1 NumUnopenedOuters['384',Pack1] demand_fit['384',M] 3 demand_fit['384',L] 4 NumUnopenedOuters['384',Pack1] demand_fit['384',XL] 4 NumUnopenedOuters['386',Pack1] TotalCost 1 demand_fit['386',S] 1 NumUnopenedOuters['386',Pack1] demand_fit['386',M] 3 demand_fit['386',L] 4 NumUnopenedOuters['386',Pack1] demand_fit['386',XL] 4 NumUnopenedOuters['388',Pack1] TotalCost 1 demand_fit['388',S] 1 NumUnopenedOuters['388',Pack1] demand_fit['388',M] 3 demand_fit['388',L] 4 NumUnopenedOuters['388',Pack1] demand_fit['388',XL] 4 NumUnopenedOuters['389',Pack1] TotalCost 1 demand_fit['389',S] 1 NumUnopenedOuters['389',Pack1] demand_fit['389',M] 3 demand_fit['389',L] 4 NumUnopenedOuters['389',Pack1] demand_fit['389',XL] 4 NumUnopenedOuters['390',Pack1] TotalCost 1 demand_fit['390',S] 1 NumUnopenedOuters['390',Pack1] demand_fit['390',M] 3 demand_fit['390',L] 4 NumUnopenedOuters['390',Pack1] demand_fit['390',XL] 4 NumUnopenedOuters['397',Pack1] TotalCost 1 demand_fit['397',S] 1 NumUnopenedOuters['397',Pack1] demand_fit['397',M] 3 demand_fit['397',L] 4 NumUnopenedOuters['397',Pack1] demand_fit['397',XL] 4 NumUnopenedOuters['398',Pack1] TotalCost 1 demand_fit['398',S] 1 NumUnopenedOuters['398',Pack1] demand_fit['398',M] 3 demand_fit['398',L] 4 NumUnopenedOuters['398',Pack1] demand_fit['398',XL] 4 NumUnopenedOuters['403',Pack1] TotalCost 1 demand_fit['403',S] 1 NumUnopenedOuters['403',Pack1] demand_fit['403',M] 3 demand_fit['403',L] 4 NumUnopenedOuters['403',Pack1] demand_fit['403',XL] 4 NumUnopenedOuters['418',Pack1] TotalCost 1 demand_fit['418',S] 1 NumUnopenedOuters['418',Pack1] demand_fit['418',M] 3 demand_fit['418',L] 4 NumUnopenedOuters['418',Pack1] demand_fit['418',XL] 4 NumUnopenedOuters['430',Pack1] TotalCost 1 demand_fit['430',S] 1 NumUnopenedOuters['430',Pack1] demand_fit['430',M] 3 demand_fit['430',L] 4 NumUnopenedOuters['430',Pack1] demand_fit['430',XL] 4 NumUnopenedOuters['431',Pack1] TotalCost 1 demand_fit['431',S] 1 NumUnopenedOuters['431',Pack1] demand_fit['431',M] 3 demand_fit['431',L] 4 NumUnopenedOuters['431',Pack1] demand_fit['431',XL] 4 NumUnopenedOuters['479',Pack1] TotalCost 1 demand_fit['479',S] 1 NumUnopenedOuters['479',Pack1] demand_fit['479',M] 3 demand_fit['479',L] 4 NumUnopenedOuters['479',Pack1] demand_fit['479',XL] 4 NumUnopenedOuters['502',Pack1] TotalCost 1 demand_fit['502',S] 1 NumUnopenedOuters['502',Pack1] demand_fit['502',M] 3 demand_fit['502',L] 4 NumUnopenedOuters['502',Pack1] demand_fit['502',XL] 4 NumUnopenedOuters['504',Pack1] TotalCost 1 demand_fit['504',S] 1 NumUnopenedOuters['504',Pack1] demand_fit['504',M] 3 demand_fit['504',L] 4 NumUnopenedOuters['504',Pack1] demand_fit['504',XL] 4 NumUnopenedOuters['512',Pack1] TotalCost 1 demand_fit['512',S] 1 NumUnopenedOuters['512',Pack1] demand_fit['512',M] 3 demand_fit['512',L] 4 NumUnopenedOuters['512',Pack1] demand_fit['512',XL] 4 NumUnopenedOuters['528',Pack1] TotalCost 1 demand_fit['528',S] 1 NumUnopenedOuters['528',Pack1] demand_fit['528',M] 3 demand_fit['528',L] 4 NumUnopenedOuters['528',Pack1] demand_fit['528',XL] 4 NumUnopenedOuters['533',Pack1] TotalCost 1 demand_fit['533',S] 1 NumUnopenedOuters['533',Pack1] demand_fit['533',M] 3 demand_fit['533',L] 4 NumUnopenedOuters['533',Pack1] demand_fit['533',XL] 4 NumUnopenedOuters['538',Pack1] TotalCost 1 demand_fit['538',S] 1 NumUnopenedOuters['538',Pack1] demand_fit['538',M] 3 demand_fit['538',L] 4 NumUnopenedOuters['538',Pack1] demand_fit['538',XL] 4 NumUnopenedOuters['552',Pack1] TotalCost 1 demand_fit['552',S] 1 NumUnopenedOuters['552',Pack1] demand_fit['552',M] 3 demand_fit['552',L] 4 NumUnopenedOuters['552',Pack1] demand_fit['552',XL] 4 NumUnopenedOuters['621',Pack1] TotalCost 1 demand_fit['621',S] 1 NumUnopenedOuters['621',Pack1] demand_fit['621',M] 3 demand_fit['621',L] 4 NumUnopenedOuters['621',Pack1] demand_fit['621',XL] 4 NumUnopenedOuters['639',Pack1] TotalCost 1 demand_fit['639',S] 1 NumUnopenedOuters['639',Pack1] demand_fit['639',M] 3 demand_fit['639',L] 4 NumUnopenedOuters['639',Pack1] demand_fit['639',XL] 4 NumUnopenedOuters['712',Pack1] TotalCost 1 demand_fit['712',S] 1 NumUnopenedOuters['712',Pack1] demand_fit['712',M] 3 demand_fit['712',L] 4 NumUnopenedOuters['712',Pack1] demand_fit['712',XL] 4 NumUnopenedOuters['781',Pack1] TotalCost 1 demand_fit['781',S] 1 NumUnopenedOuters['781',Pack1] demand_fit['781',M] 3 demand_fit['781',L] 4 NumUnopenedOuters['781',Pack1] demand_fit['781',XL] 4 NumUnopenedOuters['71',Pack2] TotalCost 1.5 demand_fit['71',S] 1 NumUnopenedOuters['71',Pack2] demand_fit['71',M] 2 demand_fit['71',L] 4 NumUnopenedOuters['71',Pack2] demand_fit['71',XL] 5 NumUnopenedOuters['73',Pack2] TotalCost 1.5 demand_fit['73',S] 1 NumUnopenedOuters['73',Pack2] demand_fit['73',M] 2 demand_fit['73',L] 4 NumUnopenedOuters['73',Pack2] demand_fit['73',XL] 5 NumUnopenedOuters['86',Pack2] TotalCost 1.5 demand_fit['86',S] 1 NumUnopenedOuters['86',Pack2] demand_fit['86',M] 2 demand_fit['86',L] 4 NumUnopenedOuters['86',Pack2] demand_fit['86',XL] 5 NumUnopenedOuters['99',Pack2] TotalCost 1.5 demand_fit['99',S] 1 NumUnopenedOuters['99',Pack2] demand_fit['99',M] 2 demand_fit['99',L] 4 NumUnopenedOuters['99',Pack2] demand_fit['99',XL] 5 NumUnopenedOuters['103',Pack2] TotalCost 1.5 demand_fit['103',S] 1 NumUnopenedOuters['103',Pack2] demand_fit['103',M] 2 demand_fit['103',L] 4 NumUnopenedOuters['103',Pack2] demand_fit['103',XL] 5 NumUnopenedOuters['126',Pack2] TotalCost 1.5 demand_fit['126',S] 1 NumUnopenedOuters['126',Pack2] demand_fit['126',M] 2 demand_fit['126',L] 4 NumUnopenedOuters['126',Pack2] demand_fit['126',XL] 5 NumUnopenedOuters['221',Pack2] TotalCost 1.5 demand_fit['221',S] 1 NumUnopenedOuters['221',Pack2] demand_fit['221',M] 2 demand_fit['221',L] 4 NumUnopenedOuters['221',Pack2] demand_fit['221',XL] 5 NumUnopenedOuters['225',Pack2] TotalCost 1.5 demand_fit['225',S] 1 NumUnopenedOuters['225',Pack2] demand_fit['225',M] 2 demand_fit['225',L] 4 NumUnopenedOuters['225',Pack2] demand_fit['225',XL] 5 NumUnopenedOuters['251',Pack2] TotalCost 1.5 demand_fit['251',S] 1 NumUnopenedOuters['251',Pack2] demand_fit['251',M] 2 demand_fit['251',L] 4 NumUnopenedOuters['251',Pack2] demand_fit['251',XL] 5 NumUnopenedOuters['270',Pack2] TotalCost 1.5 demand_fit['270',S] 1 NumUnopenedOuters['270',Pack2] demand_fit['270',M] 2 demand_fit['270',L] 4 NumUnopenedOuters['270',Pack2] demand_fit['270',XL] 5 NumUnopenedOuters['272',Pack2] TotalCost 1.5 demand_fit['272',S] 1 NumUnopenedOuters['272',Pack2] demand_fit['272',M] 2 demand_fit['272',L] 4 NumUnopenedOuters['272',Pack2] demand_fit['272',XL] 5 NumUnopenedOuters['275',Pack2] TotalCost 1.5 demand_fit['275',S] 1 NumUnopenedOuters['275',Pack2] demand_fit['275',M] 2 demand_fit['275',L] 4 NumUnopenedOuters['275',Pack2] demand_fit['275',XL] 5 NumUnopenedOuters['276',Pack2] TotalCost 1.5 demand_fit['276',S] 1 NumUnopenedOuters['276',Pack2] demand_fit['276',M] 2 demand_fit['276',L] 4 NumUnopenedOuters['276',Pack2] demand_fit['276',XL] 5 NumUnopenedOuters['280',Pack2] TotalCost 1.5 demand_fit['280',S] 1 NumUnopenedOuters['280',Pack2] demand_fit['280',M] 2 demand_fit['280',L] 4 NumUnopenedOuters['280',Pack2] demand_fit['280',XL] 5 NumUnopenedOuters['282',Pack2] TotalCost 1.5 demand_fit['282',S] 1 NumUnopenedOuters['282',Pack2] demand_fit['282',M] 2 demand_fit['282',L] 4 NumUnopenedOuters['282',Pack2] demand_fit['282',XL] 5 NumUnopenedOuters['283',Pack2] TotalCost 1.5 demand_fit['283',S] 1 NumUnopenedOuters['283',Pack2] demand_fit['283',M] 2 demand_fit['283',L] 4 NumUnopenedOuters['283',Pack2] demand_fit['283',XL] 5 NumUnopenedOuters['293',Pack2] TotalCost 1.5 demand_fit['293',S] 1 NumUnopenedOuters['293',Pack2] demand_fit['293',M] 2 demand_fit['293',L] 4 NumUnopenedOuters['293',Pack2] demand_fit['293',XL] 5 NumUnopenedOuters['298',Pack2] TotalCost 1.5 demand_fit['298',S] 1 NumUnopenedOuters['298',Pack2] demand_fit['298',M] 2 demand_fit['298',L] 4 NumUnopenedOuters['298',Pack2] demand_fit['298',XL] 5 NumUnopenedOuters['299',Pack2] TotalCost 1.5 demand_fit['299',S] 1 NumUnopenedOuters['299',Pack2] demand_fit['299',M] 2 demand_fit['299',L] 4 NumUnopenedOuters['299',Pack2] demand_fit['299',XL] 5 NumUnopenedOuters['301',Pack2] TotalCost 1.5 demand_fit['301',S] 1 NumUnopenedOuters['301',Pack2] demand_fit['301',M] 2 demand_fit['301',L] 4 NumUnopenedOuters['301',Pack2] demand_fit['301',XL] 5 NumUnopenedOuters['309',Pack2] TotalCost 1.5 demand_fit['309',S] 1 NumUnopenedOuters['309',Pack2] demand_fit['309',M] 2 demand_fit['309',L] 4 NumUnopenedOuters['309',Pack2] demand_fit['309',XL] 5 NumUnopenedOuters['310',Pack2] TotalCost 1.5 demand_fit['310',S] 1 NumUnopenedOuters['310',Pack2] demand_fit['310',M] 2 demand_fit['310',L] 4 NumUnopenedOuters['310',Pack2] demand_fit['310',XL] 5 NumUnopenedOuters['375',Pack2] TotalCost 1.5 demand_fit['375',S] 1 NumUnopenedOuters['375',Pack2] demand_fit['375',M] 2 demand_fit['375',L] 4 NumUnopenedOuters['375',Pack2] demand_fit['375',XL] 5 NumUnopenedOuters['378',Pack2] TotalCost 1.5 demand_fit['378',S] 1 NumUnopenedOuters['378',Pack2] demand_fit['378',M] 2 demand_fit['378',L] 4 NumUnopenedOuters['378',Pack2] demand_fit['378',XL] 5 NumUnopenedOuters['379',Pack2] TotalCost 1.5 demand_fit['379',S] 1 NumUnopenedOuters['379',Pack2] demand_fit['379',M] 2 demand_fit['379',L] 4 NumUnopenedOuters['379',Pack2] demand_fit['379',XL] 5 NumUnopenedOuters['381',Pack2] TotalCost 1.5 demand_fit['381',S] 1 NumUnopenedOuters['381',Pack2] demand_fit['381',M] 2 demand_fit['381',L] 4 NumUnopenedOuters['381',Pack2] demand_fit['381',XL] 5 NumUnopenedOuters['383',Pack2] TotalCost 1.5 demand_fit['383',S] 1 NumUnopenedOuters['383',Pack2] demand_fit['383',M] 2 demand_fit['383',L] 4 NumUnopenedOuters['383',Pack2] demand_fit['383',XL] 5 NumUnopenedOuters['384',Pack2] TotalCost 1.5 demand_fit['384',S] 1 NumUnopenedOuters['384',Pack2] demand_fit['384',M] 2 demand_fit['384',L] 4 NumUnopenedOuters['384',Pack2] demand_fit['384',XL] 5 NumUnopenedOuters['386',Pack2] TotalCost 1.5 demand_fit['386',S] 1 NumUnopenedOuters['386',Pack2] demand_fit['386',M] 2 demand_fit['386',L] 4 NumUnopenedOuters['386',Pack2] demand_fit['386',XL] 5 NumUnopenedOuters['388',Pack2] TotalCost 1.5 demand_fit['388',S] 1 NumUnopenedOuters['388',Pack2] demand_fit['388',M] 2 demand_fit['388',L] 4 NumUnopenedOuters['388',Pack2] demand_fit['388',XL] 5 NumUnopenedOuters['389',Pack2] TotalCost 1.5 demand_fit['389',S] 1 NumUnopenedOuters['389',Pack2] demand_fit['389',M] 2 demand_fit['389',L] 4 NumUnopenedOuters['389',Pack2] demand_fit['389',XL] 5 NumUnopenedOuters['390',Pack2] TotalCost 1.5 demand_fit['390',S] 1 NumUnopenedOuters['390',Pack2] demand_fit['390',M] 2 demand_fit['390',L] 4 NumUnopenedOuters['390',Pack2] demand_fit['390',XL] 5 NumUnopenedOuters['397',Pack2] TotalCost 1.5 demand_fit['397',S] 1 NumUnopenedOuters['397',Pack2] demand_fit['397',M] 2 demand_fit['397',L] 4 NumUnopenedOuters['397',Pack2] demand_fit['397',XL] 5 NumUnopenedOuters['398',Pack2] TotalCost 1.5 demand_fit['398',S] 1 NumUnopenedOuters['398',Pack2] demand_fit['398',M] 2 demand_fit['398',L] 4 NumUnopenedOuters['398',Pack2] demand_fit['398',XL] 5 NumUnopenedOuters['403',Pack2] TotalCost 1.5 demand_fit['403',S] 1 NumUnopenedOuters['403',Pack2] demand_fit['403',M] 2 demand_fit['403',L] 4 NumUnopenedOuters['403',Pack2] demand_fit['403',XL] 5 NumUnopenedOuters['418',Pack2] TotalCost 1.5 demand_fit['418',S] 1 NumUnopenedOuters['418',Pack2] demand_fit['418',M] 2 demand_fit['418',L] 4 NumUnopenedOuters['418',Pack2] demand_fit['418',XL] 5 NumUnopenedOuters['430',Pack2] TotalCost 1.5 demand_fit['430',S] 1 NumUnopenedOuters['430',Pack2] demand_fit['430',M] 2 demand_fit['430',L] 4 NumUnopenedOuters['430',Pack2] demand_fit['430',XL] 5 NumUnopenedOuters['431',Pack2] TotalCost 1.5 demand_fit['431',S] 1 NumUnopenedOuters['431',Pack2] demand_fit['431',M] 2 demand_fit['431',L] 4 NumUnopenedOuters['431',Pack2] demand_fit['431',XL] 5 NumUnopenedOuters['479',Pack2] TotalCost 1.5 demand_fit['479',S] 1 NumUnopenedOuters['479',Pack2] demand_fit['479',M] 2 demand_fit['479',L] 4 NumUnopenedOuters['479',Pack2] demand_fit['479',XL] 5 NumUnopenedOuters['502',Pack2] TotalCost 1.5 demand_fit['502',S] 1 NumUnopenedOuters['502',Pack2] demand_fit['502',M] 2 demand_fit['502',L] 4 NumUnopenedOuters['502',Pack2] demand_fit['502',XL] 5 NumUnopenedOuters['504',Pack2] TotalCost 1.5 demand_fit['504',S] 1 NumUnopenedOuters['504',Pack2] demand_fit['504',M] 2 demand_fit['504',L] 4 NumUnopenedOuters['504',Pack2] demand_fit['504',XL] 5 NumUnopenedOuters['512',Pack2] TotalCost 1.5 demand_fit['512',S] 1 NumUnopenedOuters['512',Pack2] demand_fit['512',M] 2 demand_fit['512',L] 4 NumUnopenedOuters['512',Pack2] demand_fit['512',XL] 5 NumUnopenedOuters['528',Pack2] TotalCost 1.5 demand_fit['528',S] 1 NumUnopenedOuters['528',Pack2] demand_fit['528',M] 2 demand_fit['528',L] 4 NumUnopenedOuters['528',Pack2] demand_fit['528',XL] 5 NumUnopenedOuters['533',Pack2] TotalCost 1.5 demand_fit['533',S] 1 NumUnopenedOuters['533',Pack2] demand_fit['533',M] 2 demand_fit['533',L] 4 NumUnopenedOuters['533',Pack2] demand_fit['533',XL] 5 NumUnopenedOuters['538',Pack2] TotalCost 1.5 demand_fit['538',S] 1 NumUnopenedOuters['538',Pack2] demand_fit['538',M] 2 demand_fit['538',L] 4 NumUnopenedOuters['538',Pack2] demand_fit['538',XL] 5 NumUnopenedOuters['552',Pack2] TotalCost 1.5 demand_fit['552',S] 1 NumUnopenedOuters['552',Pack2] demand_fit['552',M] 2 demand_fit['552',L] 4 NumUnopenedOuters['552',Pack2] demand_fit['552',XL] 5 NumUnopenedOuters['621',Pack2] TotalCost 1.5 demand_fit['621',S] 1 NumUnopenedOuters['621',Pack2] demand_fit['621',M] 2 demand_fit['621',L] 4 NumUnopenedOuters['621',Pack2] demand_fit['621',XL] 5 NumUnopenedOuters['639',Pack2] TotalCost 1.5 demand_fit['639',S] 1 NumUnopenedOuters['639',Pack2] demand_fit['639',M] 2 demand_fit['639',L] 4 NumUnopenedOuters['639',Pack2] demand_fit['639',XL] 5 NumUnopenedOuters['712',Pack2] TotalCost 1.5 demand_fit['712',S] 1 NumUnopenedOuters['712',Pack2] demand_fit['712',M] 2 demand_fit['712',L] 4 NumUnopenedOuters['712',Pack2] demand_fit['712',XL] 5 NumUnopenedOuters['781',Pack2] TotalCost 1.5 demand_fit['781',S] 1 NumUnopenedOuters['781',Pack2] demand_fit['781',M] 2 demand_fit['781',L] 4 NumUnopenedOuters['781',Pack2] demand_fit['781',XL] 5 NumUnopenedOuters['71',Pack3] TotalCost 0.5 demand_fit['71',S] 2 NumUnopenedOuters['71',Pack3] demand_fit['71',M] 4 demand_fit['71',L] 3 NumUnopenedOuters['71',Pack3] demand_fit['71',XL] 3 NumUnopenedOuters['73',Pack3] TotalCost 0.5 demand_fit['73',S] 2 NumUnopenedOuters['73',Pack3] demand_fit['73',M] 4 demand_fit['73',L] 3 NumUnopenedOuters['73',Pack3] demand_fit['73',XL] 3 NumUnopenedOuters['86',Pack3] TotalCost 0.5 demand_fit['86',S] 2 NumUnopenedOuters['86',Pack3] demand_fit['86',M] 4 demand_fit['86',L] 3 NumUnopenedOuters['86',Pack3] demand_fit['86',XL] 3 NumUnopenedOuters['99',Pack3] TotalCost 0.5 demand_fit['99',S] 2 NumUnopenedOuters['99',Pack3] demand_fit['99',M] 4 demand_fit['99',L] 3 NumUnopenedOuters['99',Pack3] demand_fit['99',XL] 3 NumUnopenedOuters['103',Pack3] TotalCost 0.5 demand_fit['103',S] 2 NumUnopenedOuters['103',Pack3] demand_fit['103',M] 4 demand_fit['103',L] 3 NumUnopenedOuters['103',Pack3] demand_fit['103',XL] 3 NumUnopenedOuters['126',Pack3] TotalCost 0.5 demand_fit['126',S] 2 NumUnopenedOuters['126',Pack3] demand_fit['126',M] 4 demand_fit['126',L] 3 NumUnopenedOuters['126',Pack3] demand_fit['126',XL] 3 NumUnopenedOuters['221',Pack3] TotalCost 0.5 demand_fit['221',S] 2 NumUnopenedOuters['221',Pack3] demand_fit['221',M] 4 demand_fit['221',L] 3 NumUnopenedOuters['221',Pack3] demand_fit['221',XL] 3 NumUnopenedOuters['225',Pack3] TotalCost 0.5 demand_fit['225',S] 2 NumUnopenedOuters['225',Pack3] demand_fit['225',M] 4 demand_fit['225',L] 3 NumUnopenedOuters['225',Pack3] demand_fit['225',XL] 3 NumUnopenedOuters['251',Pack3] TotalCost 0.5 demand_fit['251',S] 2 NumUnopenedOuters['251',Pack3] demand_fit['251',M] 4 demand_fit['251',L] 3 NumUnopenedOuters['251',Pack3] demand_fit['251',XL] 3 NumUnopenedOuters['270',Pack3] TotalCost 0.5 demand_fit['270',S] 2 NumUnopenedOuters['270',Pack3] demand_fit['270',M] 4 demand_fit['270',L] 3 NumUnopenedOuters['270',Pack3] demand_fit['270',XL] 3 NumUnopenedOuters['272',Pack3] TotalCost 0.5 demand_fit['272',S] 2 NumUnopenedOuters['272',Pack3] demand_fit['272',M] 4 demand_fit['272',L] 3 NumUnopenedOuters['272',Pack3] demand_fit['272',XL] 3 NumUnopenedOuters['275',Pack3] TotalCost 0.5 demand_fit['275',S] 2 NumUnopenedOuters['275',Pack3] demand_fit['275',M] 4 demand_fit['275',L] 3 NumUnopenedOuters['275',Pack3] demand_fit['275',XL] 3 NumUnopenedOuters['276',Pack3] TotalCost 0.5 demand_fit['276',S] 2 NumUnopenedOuters['276',Pack3] demand_fit['276',M] 4 demand_fit['276',L] 3 NumUnopenedOuters['276',Pack3] demand_fit['276',XL] 3 NumUnopenedOuters['280',Pack3] TotalCost 0.5 demand_fit['280',S] 2 NumUnopenedOuters['280',Pack3] demand_fit['280',M] 4 demand_fit['280',L] 3 NumUnopenedOuters['280',Pack3] demand_fit['280',XL] 3 NumUnopenedOuters['282',Pack3] TotalCost 0.5 demand_fit['282',S] 2 NumUnopenedOuters['282',Pack3] demand_fit['282',M] 4 demand_fit['282',L] 3 NumUnopenedOuters['282',Pack3] demand_fit['282',XL] 3 NumUnopenedOuters['283',Pack3] TotalCost 0.5 demand_fit['283',S] 2 NumUnopenedOuters['283',Pack3] demand_fit['283',M] 4 demand_fit['283',L] 3 NumUnopenedOuters['283',Pack3] demand_fit['283',XL] 3 NumUnopenedOuters['293',Pack3] TotalCost 0.5 demand_fit['293',S] 2 NumUnopenedOuters['293',Pack3] demand_fit['293',M] 4 demand_fit['293',L] 3 NumUnopenedOuters['293',Pack3] demand_fit['293',XL] 3 NumUnopenedOuters['298',Pack3] TotalCost 0.5 demand_fit['298',S] 2 NumUnopenedOuters['298',Pack3] demand_fit['298',M] 4 demand_fit['298',L] 3 NumUnopenedOuters['298',Pack3] demand_fit['298',XL] 3 NumUnopenedOuters['299',Pack3] TotalCost 0.5 demand_fit['299',S] 2 NumUnopenedOuters['299',Pack3] demand_fit['299',M] 4 demand_fit['299',L] 3 NumUnopenedOuters['299',Pack3] demand_fit['299',XL] 3 NumUnopenedOuters['301',Pack3] TotalCost 0.5 demand_fit['301',S] 2 NumUnopenedOuters['301',Pack3] demand_fit['301',M] 4 demand_fit['301',L] 3 NumUnopenedOuters['301',Pack3] demand_fit['301',XL] 3 NumUnopenedOuters['309',Pack3] TotalCost 0.5 demand_fit['309',S] 2 NumUnopenedOuters['309',Pack3] demand_fit['309',M] 4 demand_fit['309',L] 3 NumUnopenedOuters['309',Pack3] demand_fit['309',XL] 3 NumUnopenedOuters['310',Pack3] TotalCost 0.5 demand_fit['310',S] 2 NumUnopenedOuters['310',Pack3] demand_fit['310',M] 4 demand_fit['310',L] 3 NumUnopenedOuters['310',Pack3] demand_fit['310',XL] 3 NumUnopenedOuters['375',Pack3] TotalCost 0.5 demand_fit['375',S] 2 NumUnopenedOuters['375',Pack3] demand_fit['375',M] 4 demand_fit['375',L] 3 NumUnopenedOuters['375',Pack3] demand_fit['375',XL] 3 NumUnopenedOuters['378',Pack3] TotalCost 0.5 demand_fit['378',S] 2 NumUnopenedOuters['378',Pack3] demand_fit['378',M] 4 demand_fit['378',L] 3 NumUnopenedOuters['378',Pack3] demand_fit['378',XL] 3 NumUnopenedOuters['379',Pack3] TotalCost 0.5 demand_fit['379',S] 2 NumUnopenedOuters['379',Pack3] demand_fit['379',M] 4 demand_fit['379',L] 3 NumUnopenedOuters['379',Pack3] demand_fit['379',XL] 3 NumUnopenedOuters['381',Pack3] TotalCost 0.5 demand_fit['381',S] 2 NumUnopenedOuters['381',Pack3] demand_fit['381',M] 4 demand_fit['381',L] 3 NumUnopenedOuters['381',Pack3] demand_fit['381',XL] 3 NumUnopenedOuters['383',Pack3] TotalCost 0.5 demand_fit['383',S] 2 NumUnopenedOuters['383',Pack3] demand_fit['383',M] 4 demand_fit['383',L] 3 NumUnopenedOuters['383',Pack3] demand_fit['383',XL] 3 NumUnopenedOuters['384',Pack3] TotalCost 0.5 demand_fit['384',S] 2 NumUnopenedOuters['384',Pack3] demand_fit['384',M] 4 demand_fit['384',L] 3 NumUnopenedOuters['384',Pack3] demand_fit['384',XL] 3 NumUnopenedOuters['386',Pack3] TotalCost 0.5 demand_fit['386',S] 2 NumUnopenedOuters['386',Pack3] demand_fit['386',M] 4 demand_fit['386',L] 3 NumUnopenedOuters['386',Pack3] demand_fit['386',XL] 3 NumUnopenedOuters['388',Pack3] TotalCost 0.5 demand_fit['388',S] 2 NumUnopenedOuters['388',Pack3] demand_fit['388',M] 4 demand_fit['388',L] 3 NumUnopenedOuters['388',Pack3] demand_fit['388',XL] 3 NumUnopenedOuters['389',Pack3] TotalCost 0.5 demand_fit['389',S] 2 NumUnopenedOuters['389',Pack3] demand_fit['389',M] 4 demand_fit['389',L] 3 NumUnopenedOuters['389',Pack3] demand_fit['389',XL] 3 NumUnopenedOuters['390',Pack3] TotalCost 0.5 demand_fit['390',S] 2 NumUnopenedOuters['390',Pack3] demand_fit['390',M] 4 demand_fit['390',L] 3 NumUnopenedOuters['390',Pack3] demand_fit['390',XL] 3 NumUnopenedOuters['397',Pack3] TotalCost 0.5 demand_fit['397',S] 2 NumUnopenedOuters['397',Pack3] demand_fit['397',M] 4 demand_fit['397',L] 3 NumUnopenedOuters['397',Pack3] demand_fit['397',XL] 3 NumUnopenedOuters['398',Pack3] TotalCost 0.5 demand_fit['398',S] 2 NumUnopenedOuters['398',Pack3] demand_fit['398',M] 4 demand_fit['398',L] 3 NumUnopenedOuters['398',Pack3] demand_fit['398',XL] 3 NumUnopenedOuters['403',Pack3] TotalCost 0.5 demand_fit['403',S] 2 NumUnopenedOuters['403',Pack3] demand_fit['403',M] 4 demand_fit['403',L] 3 NumUnopenedOuters['403',Pack3] demand_fit['403',XL] 3 NumUnopenedOuters['418',Pack3] TotalCost 0.5 demand_fit['418',S] 2 NumUnopenedOuters['418',Pack3] demand_fit['418',M] 4 demand_fit['418',L] 3 NumUnopenedOuters['418',Pack3] demand_fit['418',XL] 3 NumUnopenedOuters['430',Pack3] TotalCost 0.5 demand_fit['430',S] 2 NumUnopenedOuters['430',Pack3] demand_fit['430',M] 4 demand_fit['430',L] 3 NumUnopenedOuters['430',Pack3] demand_fit['430',XL] 3 NumUnopenedOuters['431',Pack3] TotalCost 0.5 demand_fit['431',S] 2 NumUnopenedOuters['431',Pack3] demand_fit['431',M] 4 demand_fit['431',L] 3 NumUnopenedOuters['431',Pack3] demand_fit['431',XL] 3 NumUnopenedOuters['479',Pack3] TotalCost 0.5 demand_fit['479',S] 2 NumUnopenedOuters['479',Pack3] demand_fit['479',M] 4 demand_fit['479',L] 3 NumUnopenedOuters['479',Pack3] demand_fit['479',XL] 3 NumUnopenedOuters['502',Pack3] TotalCost 0.5 demand_fit['502',S] 2 NumUnopenedOuters['502',Pack3] demand_fit['502',M] 4 demand_fit['502',L] 3 NumUnopenedOuters['502',Pack3] demand_fit['502',XL] 3 NumUnopenedOuters['504',Pack3] TotalCost 0.5 demand_fit['504',S] 2 NumUnopenedOuters['504',Pack3] demand_fit['504',M] 4 demand_fit['504',L] 3 NumUnopenedOuters['504',Pack3] demand_fit['504',XL] 3 NumUnopenedOuters['512',Pack3] TotalCost 0.5 demand_fit['512',S] 2 NumUnopenedOuters['512',Pack3] demand_fit['512',M] 4 demand_fit['512',L] 3 NumUnopenedOuters['512',Pack3] demand_fit['512',XL] 3 NumUnopenedOuters['528',Pack3] TotalCost 0.5 demand_fit['528',S] 2 NumUnopenedOuters['528',Pack3] demand_fit['528',M] 4 demand_fit['528',L] 3 NumUnopenedOuters['528',Pack3] demand_fit['528',XL] 3 NumUnopenedOuters['533',Pack3] TotalCost 0.5 demand_fit['533',S] 2 NumUnopenedOuters['533',Pack3] demand_fit['533',M] 4 demand_fit['533',L] 3 NumUnopenedOuters['533',Pack3] demand_fit['533',XL] 3 NumUnopenedOuters['538',Pack3] TotalCost 0.5 demand_fit['538',S] 2 NumUnopenedOuters['538',Pack3] demand_fit['538',M] 4 demand_fit['538',L] 3 NumUnopenedOuters['538',Pack3] demand_fit['538',XL] 3 NumUnopenedOuters['552',Pack3] TotalCost 0.5 demand_fit['552',S] 2 NumUnopenedOuters['552',Pack3] demand_fit['552',M] 4 demand_fit['552',L] 3 NumUnopenedOuters['552',Pack3] demand_fit['552',XL] 3 NumUnopenedOuters['621',Pack3] TotalCost 0.5 demand_fit['621',S] 2 NumUnopenedOuters['621',Pack3] demand_fit['621',M] 4 demand_fit['621',L] 3 NumUnopenedOuters['621',Pack3] demand_fit['621',XL] 3 NumUnopenedOuters['639',Pack3] TotalCost 0.5 demand_fit['639',S] 2 NumUnopenedOuters['639',Pack3] demand_fit['639',M] 4 demand_fit['639',L] 3 NumUnopenedOuters['639',Pack3] demand_fit['639',XL] 3 NumUnopenedOuters['712',Pack3] TotalCost 0.5 demand_fit['712',S] 2 NumUnopenedOuters['712',Pack3] demand_fit['712',M] 4 demand_fit['712',L] 3 NumUnopenedOuters['712',Pack3] demand_fit['712',XL] 3 NumUnopenedOuters['781',Pack3] TotalCost 0.5 demand_fit['781',S] 2 NumUnopenedOuters['781',Pack3] demand_fit['781',M] 4 demand_fit['781',L] 3 NumUnopenedOuters['781',Pack3] demand_fit['781',XL] 3 NumOpenedOuters[Pack1] TotalCost 1 material_balance[Pack1] -1 NumOpenedOuters[Pack2] TotalCost 1 material_balance[Pack2] -1 NumOpenedOuters[Pack3] TotalCost 1 material_balance[Pack3] -1 .MRK0001 'MARKER' 'INTEND' NumOver['71',S] TotalCost 1 demand_fit['71',S] -1 NumOver['73',S] TotalCost 1 demand_fit['73',S] -1 NumOver['86',S] TotalCost 1 demand_fit['86',S] -1 NumOver['99',S] TotalCost 1 demand_fit['99',S] -1 NumOver['103',S] TotalCost 1 demand_fit['103',S] -1 NumOver['126',S] TotalCost 1 demand_fit['126',S] -1 NumOver['221',S] TotalCost 1 demand_fit['221',S] -1 NumOver['225',S] TotalCost 1 demand_fit['225',S] -1 NumOver['251',S] TotalCost 1 demand_fit['251',S] -1 NumOver['270',S] TotalCost 1 demand_fit['270',S] -1 NumOver['272',S] TotalCost 1 demand_fit['272',S] -1 NumOver['275',S] TotalCost 1 demand_fit['275',S] -1 NumOver['276',S] TotalCost 1 demand_fit['276',S] -1 NumOver['280',S] TotalCost 1 demand_fit['280',S] -1 NumOver['282',S] TotalCost 1 demand_fit['282',S] -1 NumOver['283',S] TotalCost 1 demand_fit['283',S] -1 NumOver['293',S] TotalCost 1 demand_fit['293',S] -1 NumOver['298',S] TotalCost 1 demand_fit['298',S] -1 NumOver['299',S] TotalCost 1 demand_fit['299',S] -1 NumOver['301',S] TotalCost 1 demand_fit['301',S] -1 NumOver['309',S] TotalCost 1 demand_fit['309',S] -1 NumOver['310',S] TotalCost 1 demand_fit['310',S] -1 NumOver['375',S] TotalCost 1 demand_fit['375',S] -1 NumOver['378',S] TotalCost 1 demand_fit['378',S] -1 NumOver['379',S] TotalCost 1 demand_fit['379',S] -1 NumOver['381',S] TotalCost 1 demand_fit['381',S] -1 NumOver['383',S] TotalCost 1 demand_fit['383',S] -1 NumOver['384',S] TotalCost 1 demand_fit['384',S] -1 NumOver['386',S] TotalCost 1 demand_fit['386',S] -1 NumOver['388',S] TotalCost 1 demand_fit['388',S] -1 NumOver['389',S] TotalCost 1 demand_fit['389',S] -1 NumOver['390',S] TotalCost 1 demand_fit['390',S] -1 NumOver['397',S] TotalCost 1 demand_fit['397',S] -1 NumOver['398',S] TotalCost 1 demand_fit['398',S] -1 NumOver['403',S] TotalCost 1 demand_fit['403',S] -1 NumOver['418',S] TotalCost 1 demand_fit['418',S] -1 NumOver['430',S] TotalCost 1 demand_fit['430',S] -1 NumOver['431',S] TotalCost 1 demand_fit['431',S] -1 NumOver['479',S] TotalCost 1 demand_fit['479',S] -1 NumOver['502',S] TotalCost 1 demand_fit['502',S] -1 NumOver['504',S] TotalCost 1 demand_fit['504',S] -1 NumOver['512',S] TotalCost 1 demand_fit['512',S] -1 NumOver['528',S] TotalCost 1 demand_fit['528',S] -1 NumOver['533',S] TotalCost 1 demand_fit['533',S] -1 NumOver['538',S] TotalCost 1 demand_fit['538',S] -1 NumOver['552',S] TotalCost 1 demand_fit['552',S] -1 NumOver['621',S] TotalCost 1 demand_fit['621',S] -1 NumOver['639',S] TotalCost 1 demand_fit['639',S] -1 NumOver['712',S] TotalCost 1 demand_fit['712',S] -1 NumOver['781',S] TotalCost 1 demand_fit['781',S] -1 NumOver['71',M] TotalCost 1 demand_fit['71',M] -1 NumOver['73',M] TotalCost 1 demand_fit['73',M] -1 NumOver['86',M] TotalCost 1 demand_fit['86',M] -1 NumOver['99',M] TotalCost 1 demand_fit['99',M] -1 NumOver['103',M] TotalCost 1 demand_fit['103',M] -1 NumOver['126',M] TotalCost 1 demand_fit['126',M] -1 NumOver['221',M] TotalCost 1 demand_fit['221',M] -1 NumOver['225',M] TotalCost 1 demand_fit['225',M] -1 NumOver['251',M] TotalCost 1 demand_fit['251',M] -1 NumOver['270',M] TotalCost 1 demand_fit['270',M] -1 NumOver['272',M] TotalCost 1 demand_fit['272',M] -1 NumOver['275',M] TotalCost 1 demand_fit['275',M] -1 NumOver['276',M] TotalCost 1 demand_fit['276',M] -1 NumOver['280',M] TotalCost 1 demand_fit['280',M] -1 NumOver['282',M] TotalCost 1 demand_fit['282',M] -1 NumOver['283',M] TotalCost 1 demand_fit['283',M] -1 NumOver['293',M] TotalCost 1 demand_fit['293',M] -1 NumOver['298',M] TotalCost 1 demand_fit['298',M] -1 NumOver['299',M] TotalCost 1 demand_fit['299',M] -1 NumOver['301',M] TotalCost 1 demand_fit['301',M] -1 NumOver['309',M] TotalCost 1 demand_fit['309',M] -1 NumOver['310',M] TotalCost 1 demand_fit['310',M] -1 NumOver['375',M] TotalCost 1 demand_fit['375',M] -1 NumOver['378',M] TotalCost 1 demand_fit['378',M] -1 NumOver['379',M] TotalCost 1 demand_fit['379',M] -1 NumOver['381',M] TotalCost 1 demand_fit['381',M] -1 NumOver['383',M] TotalCost 1 demand_fit['383',M] -1 NumOver['384',M] TotalCost 1 demand_fit['384',M] -1 NumOver['386',M] TotalCost 1 demand_fit['386',M] -1 NumOver['388',M] TotalCost 1 demand_fit['388',M] -1 NumOver['389',M] TotalCost 1 demand_fit['389',M] -1 NumOver['390',M] TotalCost 1 demand_fit['390',M] -1 NumOver['397',M] TotalCost 1 demand_fit['397',M] -1 NumOver['398',M] TotalCost 1 demand_fit['398',M] -1 NumOver['403',M] TotalCost 1 demand_fit['403',M] -1 NumOver['418',M] TotalCost 1 demand_fit['418',M] -1 NumOver['430',M] TotalCost 1 demand_fit['430',M] -1 NumOver['431',M] TotalCost 1 demand_fit['431',M] -1 NumOver['479',M] TotalCost 1 demand_fit['479',M] -1 NumOver['502',M] TotalCost 1 demand_fit['502',M] -1 NumOver['504',M] TotalCost 1 demand_fit['504',M] -1 NumOver['512',M] TotalCost 1 demand_fit['512',M] -1 NumOver['528',M] TotalCost 1 demand_fit['528',M] -1 NumOver['533',M] TotalCost 1 demand_fit['533',M] -1 NumOver['538',M] TotalCost 1 demand_fit['538',M] -1 NumOver['552',M] TotalCost 1 demand_fit['552',M] -1 NumOver['621',M] TotalCost 1 demand_fit['621',M] -1 NumOver['639',M] TotalCost 1 demand_fit['639',M] -1 NumOver['712',M] TotalCost 1 demand_fit['712',M] -1 NumOver['781',M] TotalCost 1 demand_fit['781',M] -1 NumOver['71',L] TotalCost 1 demand_fit['71',L] -1 NumOver['73',L] TotalCost 1 demand_fit['73',L] -1 NumOver['86',L] TotalCost 1 demand_fit['86',L] -1 NumOver['99',L] TotalCost 1 demand_fit['99',L] -1 NumOver['103',L] TotalCost 1 demand_fit['103',L] -1 NumOver['126',L] TotalCost 1 demand_fit['126',L] -1 NumOver['221',L] TotalCost 1 demand_fit['221',L] -1 NumOver['225',L] TotalCost 1 demand_fit['225',L] -1 NumOver['251',L] TotalCost 1 demand_fit['251',L] -1 NumOver['270',L] TotalCost 1 demand_fit['270',L] -1 NumOver['272',L] TotalCost 1 demand_fit['272',L] -1 NumOver['275',L] TotalCost 1 demand_fit['275',L] -1 NumOver['276',L] TotalCost 1 demand_fit['276',L] -1 NumOver['280',L] TotalCost 1 demand_fit['280',L] -1 NumOver['282',L] TotalCost 1 demand_fit['282',L] -1 NumOver['283',L] TotalCost 1 demand_fit['283',L] -1 NumOver['293',L] TotalCost 1 demand_fit['293',L] -1 NumOver['298',L] TotalCost 1 demand_fit['298',L] -1 NumOver['299',L] TotalCost 1 demand_fit['299',L] -1 NumOver['301',L] TotalCost 1 demand_fit['301',L] -1 NumOver['309',L] TotalCost 1 demand_fit['309',L] -1 NumOver['310',L] TotalCost 1 demand_fit['310',L] -1 NumOver['375',L] TotalCost 1 demand_fit['375',L] -1 NumOver['378',L] TotalCost 1 demand_fit['378',L] -1 NumOver['379',L] TotalCost 1 demand_fit['379',L] -1 NumOver['381',L] TotalCost 1 demand_fit['381',L] -1 NumOver['383',L] TotalCost 1 demand_fit['383',L] -1 NumOver['384',L] TotalCost 1 demand_fit['384',L] -1 NumOver['386',L] TotalCost 1 demand_fit['386',L] -1 NumOver['388',L] TotalCost 1 demand_fit['388',L] -1 NumOver['389',L] TotalCost 1 demand_fit['389',L] -1 NumOver['390',L] TotalCost 1 demand_fit['390',L] -1 NumOver['397',L] TotalCost 1 demand_fit['397',L] -1 NumOver['398',L] TotalCost 1 demand_fit['398',L] -1 NumOver['403',L] TotalCost 1 demand_fit['403',L] -1 NumOver['418',L] TotalCost 1 demand_fit['418',L] -1 NumOver['430',L] TotalCost 1 demand_fit['430',L] -1 NumOver['431',L] TotalCost 1 demand_fit['431',L] -1 NumOver['479',L] TotalCost 1 demand_fit['479',L] -1 NumOver['502',L] TotalCost 1 demand_fit['502',L] -1 NumOver['504',L] TotalCost 1 demand_fit['504',L] -1 NumOver['512',L] TotalCost 1 demand_fit['512',L] -1 NumOver['528',L] TotalCost 1 demand_fit['528',L] -1 NumOver['533',L] TotalCost 1 demand_fit['533',L] -1 NumOver['538',L] TotalCost 1 demand_fit['538',L] -1 NumOver['552',L] TotalCost 1 demand_fit['552',L] -1 NumOver['621',L] TotalCost 1 demand_fit['621',L] -1 NumOver['639',L] TotalCost 1 demand_fit['639',L] -1 NumOver['712',L] TotalCost 1 demand_fit['712',L] -1 NumOver['781',L] TotalCost 1 demand_fit['781',L] -1 NumOver['71',XL] TotalCost 1 demand_fit['71',XL] -1 NumOver['73',XL] TotalCost 1 demand_fit['73',XL] -1 NumOver['86',XL] TotalCost 1 demand_fit['86',XL] -1 NumOver['99',XL] TotalCost 1 demand_fit['99',XL] -1 NumOver['103',XL] TotalCost 1 demand_fit['103',XL] -1 NumOver['126',XL] TotalCost 1 demand_fit['126',XL] -1 NumOver['221',XL] TotalCost 1 demand_fit['221',XL] -1 NumOver['225',XL] TotalCost 1 demand_fit['225',XL] -1 NumOver['251',XL] TotalCost 1 demand_fit['251',XL] -1 NumOver['270',XL] TotalCost 1 demand_fit['270',XL] -1 NumOver['272',XL] TotalCost 1 demand_fit['272',XL] -1 NumOver['275',XL] TotalCost 1 demand_fit['275',XL] -1 NumOver['276',XL] TotalCost 1 demand_fit['276',XL] -1 NumOver['280',XL] TotalCost 1 demand_fit['280',XL] -1 NumOver['282',XL] TotalCost 1 demand_fit['282',XL] -1 NumOver['283',XL] TotalCost 1 demand_fit['283',XL] -1 NumOver['293',XL] TotalCost 1 demand_fit['293',XL] -1 NumOver['298',XL] TotalCost 1 demand_fit['298',XL] -1 NumOver['299',XL] TotalCost 1 demand_fit['299',XL] -1 NumOver['301',XL] TotalCost 1 demand_fit['301',XL] -1 NumOver['309',XL] TotalCost 1 demand_fit['309',XL] -1 NumOver['310',XL] TotalCost 1 demand_fit['310',XL] -1 NumOver['375',XL] TotalCost 1 demand_fit['375',XL] -1 NumOver['378',XL] TotalCost 1 demand_fit['378',XL] -1 NumOver['379',XL] TotalCost 1 demand_fit['379',XL] -1 NumOver['381',XL] TotalCost 1 demand_fit['381',XL] -1 NumOver['383',XL] TotalCost 1 demand_fit['383',XL] -1 NumOver['384',XL] TotalCost 1 demand_fit['384',XL] -1 NumOver['386',XL] TotalCost 1 demand_fit['386',XL] -1 NumOver['388',XL] TotalCost 1 demand_fit['388',XL] -1 NumOver['389',XL] TotalCost 1 demand_fit['389',XL] -1 NumOver['390',XL] TotalCost 1 demand_fit['390',XL] -1 NumOver['397',XL] TotalCost 1 demand_fit['397',XL] -1 NumOver['398',XL] TotalCost 1 demand_fit['398',XL] -1 NumOver['403',XL] TotalCost 1 demand_fit['403',XL] -1 NumOver['418',XL] TotalCost 1 demand_fit['418',XL] -1 NumOver['430',XL] TotalCost 1 demand_fit['430',XL] -1 NumOver['431',XL] TotalCost 1 demand_fit['431',XL] -1 NumOver['479',XL] TotalCost 1 demand_fit['479',XL] -1 NumOver['502',XL] TotalCost 1 demand_fit['502',XL] -1 NumOver['504',XL] TotalCost 1 demand_fit['504',XL] -1 NumOver['512',XL] TotalCost 1 demand_fit['512',XL] -1 NumOver['528',XL] TotalCost 1 demand_fit['528',XL] -1 NumOver['533',XL] TotalCost 1 demand_fit['533',XL] -1 NumOver['538',XL] TotalCost 1 demand_fit['538',XL] -1 NumOver['552',XL] TotalCost 1 demand_fit['552',XL] -1 NumOver['621',XL] TotalCost 1 demand_fit['621',XL] -1 NumOver['639',XL] TotalCost 1 demand_fit['639',XL] -1 NumOver['712',XL] TotalCost 1 demand_fit['712',XL] -1 NumOver['781',XL] TotalCost 1 demand_fit['781',XL] -1 NumUnder['71',S] TotalCost 6 demand_fit['71',S] 1 NumUnder['73',S] TotalCost 6 demand_fit['73',S] 1 NumUnder['86',S] TotalCost 6 demand_fit['86',S] 1 NumUnder['99',S] TotalCost 6 demand_fit['99',S] 1 NumUnder['103',S] TotalCost 6 demand_fit['103',S] 1 NumUnder['126',S] TotalCost 6 demand_fit['126',S] 1 NumUnder['221',S] TotalCost 6 demand_fit['221',S] 1 NumUnder['225',S] TotalCost 6 demand_fit['225',S] 1 NumUnder['251',S] TotalCost 6 demand_fit['251',S] 1 NumUnder['270',S] TotalCost 6 demand_fit['270',S] 1 NumUnder['272',S] TotalCost 6 demand_fit['272',S] 1 NumUnder['275',S] TotalCost 6 demand_fit['275',S] 1 NumUnder['276',S] TotalCost 6 demand_fit['276',S] 1 NumUnder['280',S] TotalCost 6 demand_fit['280',S] 1 NumUnder['282',S] TotalCost 6 demand_fit['282',S] 1 NumUnder['283',S] TotalCost 6 demand_fit['283',S] 1 NumUnder['293',S] TotalCost 6 demand_fit['293',S] 1 NumUnder['298',S] TotalCost 6 demand_fit['298',S] 1 NumUnder['299',S] TotalCost 6 demand_fit['299',S] 1 NumUnder['301',S] TotalCost 6 demand_fit['301',S] 1 NumUnder['309',S] TotalCost 6 demand_fit['309',S] 1 NumUnder['310',S] TotalCost 6 demand_fit['310',S] 1 NumUnder['375',S] TotalCost 6 demand_fit['375',S] 1 NumUnder['378',S] TotalCost 6 demand_fit['378',S] 1 NumUnder['379',S] TotalCost 6 demand_fit['379',S] 1 NumUnder['381',S] TotalCost 6 demand_fit['381',S] 1 NumUnder['383',S] TotalCost 6 demand_fit['383',S] 1 NumUnder['384',S] TotalCost 6 demand_fit['384',S] 1 NumUnder['386',S] TotalCost 6 demand_fit['386',S] 1 NumUnder['388',S] TotalCost 6 demand_fit['388',S] 1 NumUnder['389',S] TotalCost 6 demand_fit['389',S] 1 NumUnder['390',S] TotalCost 15 demand_fit['390',S] 1 NumUnder['397',S] TotalCost 6 demand_fit['397',S] 1 NumUnder['398',S] TotalCost 6 demand_fit['398',S] 1 NumUnder['403',S] TotalCost 6 demand_fit['403',S] 1 NumUnder['418',S] TotalCost 6 demand_fit['418',S] 1 NumUnder['430',S] TotalCost 6 demand_fit['430',S] 1 NumUnder['431',S] TotalCost 6 demand_fit['431',S] 1 NumUnder['479',S] TotalCost 6 demand_fit['479',S] 1 NumUnder['502',S] TotalCost 6 demand_fit['502',S] 1 NumUnder['504',S] TotalCost 6 demand_fit['504',S] 1 NumUnder['512',S] TotalCost 6 demand_fit['512',S] 1 NumUnder['528',S] TotalCost 6 demand_fit['528',S] 1 NumUnder['533',S] TotalCost 6 demand_fit['533',S] 1 NumUnder['538',S] TotalCost 6 demand_fit['538',S] 1 NumUnder['552',S] TotalCost 6 demand_fit['552',S] 1 NumUnder['621',S] TotalCost 6 demand_fit['621',S] 1 NumUnder['639',S] TotalCost 6 demand_fit['639',S] 1 NumUnder['712',S] TotalCost 6 demand_fit['712',S] 1 NumUnder['781',S] TotalCost 6 demand_fit['781',S] 1 NumUnder['71',M] TotalCost 6 demand_fit['71',M] 1 NumUnder['73',M] TotalCost 6 demand_fit['73',M] 1 NumUnder['86',M] TotalCost 6 demand_fit['86',M] 1 NumUnder['99',M] TotalCost 6 demand_fit['99',M] 1 NumUnder['103',M] TotalCost 6 demand_fit['103',M] 1 NumUnder['126',M] TotalCost 6 demand_fit['126',M] 1 NumUnder['221',M] TotalCost 6 demand_fit['221',M] 1 NumUnder['225',M] TotalCost 6 demand_fit['225',M] 1 NumUnder['251',M] TotalCost 6 demand_fit['251',M] 1 NumUnder['270',M] TotalCost 6 demand_fit['270',M] 1 NumUnder['272',M] TotalCost 6 demand_fit['272',M] 1 NumUnder['275',M] TotalCost 6 demand_fit['275',M] 1 NumUnder['276',M] TotalCost 6 demand_fit['276',M] 1 NumUnder['280',M] TotalCost 6 demand_fit['280',M] 1 NumUnder['282',M] TotalCost 6 demand_fit['282',M] 1 NumUnder['283',M] TotalCost 6 demand_fit['283',M] 1 NumUnder['293',M] TotalCost 6 demand_fit['293',M] 1 NumUnder['298',M] TotalCost 6 demand_fit['298',M] 1 NumUnder['299',M] TotalCost 6 demand_fit['299',M] 1 NumUnder['301',M] TotalCost 6 demand_fit['301',M] 1 NumUnder['309',M] TotalCost 6 demand_fit['309',M] 1 NumUnder['310',M] TotalCost 6 demand_fit['310',M] 1 NumUnder['375',M] TotalCost 6 demand_fit['375',M] 1 NumUnder['378',M] TotalCost 6 demand_fit['378',M] 1 NumUnder['379',M] TotalCost 6 demand_fit['379',M] 1 NumUnder['381',M] TotalCost 6 demand_fit['381',M] 1 NumUnder['383',M] TotalCost 6 demand_fit['383',M] 1 NumUnder['384',M] TotalCost 6 demand_fit['384',M] 1 NumUnder['386',M] TotalCost 6 demand_fit['386',M] 1 NumUnder['388',M] TotalCost 6 demand_fit['388',M] 1 NumUnder['389',M] TotalCost 6 demand_fit['389',M] 1 NumUnder['390',M] TotalCost 15 demand_fit['390',M] 1 NumUnder['397',M] TotalCost 6 demand_fit['397',M] 1 NumUnder['398',M] TotalCost 6 demand_fit['398',M] 1 NumUnder['403',M] TotalCost 6 demand_fit['403',M] 1 NumUnder['418',M] TotalCost 6 demand_fit['418',M] 1 NumUnder['430',M] TotalCost 6 demand_fit['430',M] 1 NumUnder['431',M] TotalCost 6 demand_fit['431',M] 1 NumUnder['479',M] TotalCost 6 demand_fit['479',M] 1 NumUnder['502',M] TotalCost 6 demand_fit['502',M] 1 NumUnder['504',M] TotalCost 6 demand_fit['504',M] 1 NumUnder['512',M] TotalCost 6 demand_fit['512',M] 1 NumUnder['528',M] TotalCost 6 demand_fit['528',M] 1 NumUnder['533',M] TotalCost 6 demand_fit['533',M] 1 NumUnder['538',M] TotalCost 6 demand_fit['538',M] 1 NumUnder['552',M] TotalCost 6 demand_fit['552',M] 1 NumUnder['621',M] TotalCost 6 demand_fit['621',M] 1 NumUnder['639',M] TotalCost 6 demand_fit['639',M] 1 NumUnder['712',M] TotalCost 6 demand_fit['712',M] 1 NumUnder['781',M] TotalCost 6 demand_fit['781',M] 1 NumUnder['71',L] TotalCost 6 demand_fit['71',L] 1 NumUnder['73',L] TotalCost 6 demand_fit['73',L] 1 NumUnder['86',L] TotalCost 6 demand_fit['86',L] 1 NumUnder['99',L] TotalCost 6 demand_fit['99',L] 1 NumUnder['103',L] TotalCost 6 demand_fit['103',L] 1 NumUnder['126',L] TotalCost 6 demand_fit['126',L] 1 NumUnder['221',L] TotalCost 6 demand_fit['221',L] 1 NumUnder['225',L] TotalCost 6 demand_fit['225',L] 1 NumUnder['251',L] TotalCost 6 demand_fit['251',L] 1 NumUnder['270',L] TotalCost 6 demand_fit['270',L] 1 NumUnder['272',L] TotalCost 6 demand_fit['272',L] 1 NumUnder['275',L] TotalCost 6 demand_fit['275',L] 1 NumUnder['276',L] TotalCost 6 demand_fit['276',L] 1 NumUnder['280',L] TotalCost 6 demand_fit['280',L] 1 NumUnder['282',L] TotalCost 6 demand_fit['282',L] 1 NumUnder['283',L] TotalCost 6 demand_fit['283',L] 1 NumUnder['293',L] TotalCost 6 demand_fit['293',L] 1 NumUnder['298',L] TotalCost 6 demand_fit['298',L] 1 NumUnder['299',L] TotalCost 6 demand_fit['299',L] 1 NumUnder['301',L] TotalCost 6 demand_fit['301',L] 1 NumUnder['309',L] TotalCost 6 demand_fit['309',L] 1 NumUnder['310',L] TotalCost 6 demand_fit['310',L] 1 NumUnder['375',L] TotalCost 6 demand_fit['375',L] 1 NumUnder['378',L] TotalCost 6 demand_fit['378',L] 1 NumUnder['379',L] TotalCost 6 demand_fit['379',L] 1 NumUnder['381',L] TotalCost 6 demand_fit['381',L] 1 NumUnder['383',L] TotalCost 6 demand_fit['383',L] 1 NumUnder['384',L] TotalCost 6 demand_fit['384',L] 1 NumUnder['386',L] TotalCost 6 demand_fit['386',L] 1 NumUnder['388',L] TotalCost 6 demand_fit['388',L] 1 NumUnder['389',L] TotalCost 6 demand_fit['389',L] 1 NumUnder['390',L] TotalCost 6 demand_fit['390',L] 1 NumUnder['397',L] TotalCost 6 demand_fit['397',L] 1 NumUnder['398',L] TotalCost 6 demand_fit['398',L] 1 NumUnder['403',L] TotalCost 6 demand_fit['403',L] 1 NumUnder['418',L] TotalCost 6 demand_fit['418',L] 1 NumUnder['430',L] TotalCost 6 demand_fit['430',L] 1 NumUnder['431',L] TotalCost 6 demand_fit['431',L] 1 NumUnder['479',L] TotalCost 6 demand_fit['479',L] 1 NumUnder['502',L] TotalCost 6 demand_fit['502',L] 1 NumUnder['504',L] TotalCost 6 demand_fit['504',L] 1 NumUnder['512',L] TotalCost 6 demand_fit['512',L] 1 NumUnder['528',L] TotalCost 6 demand_fit['528',L] 1 NumUnder['533',L] TotalCost 6 demand_fit['533',L] 1 NumUnder['538',L] TotalCost 6 demand_fit['538',L] 1 NumUnder['552',L] TotalCost 6 demand_fit['552',L] 1 NumUnder['621',L] TotalCost 6 demand_fit['621',L] 1 NumUnder['639',L] TotalCost 6 demand_fit['639',L] 1 NumUnder['712',L] TotalCost 6 demand_fit['712',L] 1 NumUnder['781',L] TotalCost 6 demand_fit['781',L] 1 NumUnder['71',XL] TotalCost 6 demand_fit['71',XL] 1 NumUnder['73',XL] TotalCost 6 demand_fit['73',XL] 1 NumUnder['86',XL] TotalCost 6 demand_fit['86',XL] 1 NumUnder['99',XL] TotalCost 6 demand_fit['99',XL] 1 NumUnder['103',XL] TotalCost 6 demand_fit['103',XL] 1 NumUnder['126',XL] TotalCost 6 demand_fit['126',XL] 1 NumUnder['221',XL] TotalCost 6 demand_fit['221',XL] 1 NumUnder['225',XL] TotalCost 6 demand_fit['225',XL] 1 NumUnder['251',XL] TotalCost 6 demand_fit['251',XL] 1 NumUnder['270',XL] TotalCost 6 demand_fit['270',XL] 1 NumUnder['272',XL] TotalCost 6 demand_fit['272',XL] 1 NumUnder['275',XL] TotalCost 6 demand_fit['275',XL] 1 NumUnder['276',XL] TotalCost 6 demand_fit['276',XL] 1 NumUnder['280',XL] TotalCost 6 demand_fit['280',XL] 1 NumUnder['282',XL] TotalCost 6 demand_fit['282',XL] 1 NumUnder['283',XL] TotalCost 6 demand_fit['283',XL] 1 NumUnder['293',XL] TotalCost 6 demand_fit['293',XL] 1 NumUnder['298',XL] TotalCost 6 demand_fit['298',XL] 1 NumUnder['299',XL] TotalCost 6 demand_fit['299',XL] 1 NumUnder['301',XL] TotalCost 6 demand_fit['301',XL] 1 NumUnder['309',XL] TotalCost 6 demand_fit['309',XL] 1 NumUnder['310',XL] TotalCost 6 demand_fit['310',XL] 1 NumUnder['375',XL] TotalCost 6 demand_fit['375',XL] 1 NumUnder['378',XL] TotalCost 6 demand_fit['378',XL] 1 NumUnder['379',XL] TotalCost 6 demand_fit['379',XL] 1 NumUnder['381',XL] TotalCost 6 demand_fit['381',XL] 1 NumUnder['383',XL] TotalCost 6 demand_fit['383',XL] 1 NumUnder['384',XL] TotalCost 6 demand_fit['384',XL] 1 NumUnder['386',XL] TotalCost 6 demand_fit['386',XL] 1 NumUnder['388',XL] TotalCost 6 demand_fit['388',XL] 1 NumUnder['389',XL] TotalCost 6 demand_fit['389',XL] 1 NumUnder['390',XL] TotalCost 6 demand_fit['390',XL] 1 NumUnder['397',XL] TotalCost 6 demand_fit['397',XL] 1 NumUnder['398',XL] TotalCost 6 demand_fit['398',XL] 1 NumUnder['403',XL] TotalCost 6 demand_fit['403',XL] 1 NumUnder['418',XL] TotalCost 6 demand_fit['418',XL] 1 NumUnder['430',XL] TotalCost 6 demand_fit['430',XL] 1 NumUnder['431',XL] TotalCost 6 demand_fit['431',XL] 1 NumUnder['479',XL] TotalCost 6 demand_fit['479',XL] 1 NumUnder['502',XL] TotalCost 6 demand_fit['502',XL] 1 NumUnder['504',XL] TotalCost 6 demand_fit['504',XL] 1 NumUnder['512',XL] TotalCost 6 demand_fit['512',XL] 1 NumUnder['528',XL] TotalCost 6 demand_fit['528',XL] 1 NumUnder['533',XL] TotalCost 6 demand_fit['533',XL] 1 NumUnder['538',XL] TotalCost 6 demand_fit['538',XL] 1 NumUnder['552',XL] TotalCost 6 demand_fit['552',XL] 1 NumUnder['621',XL] TotalCost 6 demand_fit['621',XL] 1 NumUnder['639',XL] TotalCost 6 demand_fit['639',XL] 1 NumUnder['712',XL] TotalCost 6 demand_fit['712',XL] 1 NumUnder['781',XL] TotalCost 6 demand_fit['781',XL] 1 RHS .RHS. demand_fit['71',S] 3.64592208 .RHS. demand_fit['73',S] 6.645651 .RHS. demand_fit['86',S] 8.46011328 .RHS. demand_fit['99',S] 5.2875708 .RHS. demand_fit['103',S] 6.38036364 .RHS. demand_fit['126',S] 9.3039114 .RHS. demand_fit['221',S] 8.46011328 .RHS. demand_fit['225',S] 2.11502832 .RHS. demand_fit['251',S] 5.2875708 .RHS. demand_fit['270',S] 2.73444156 .RHS. demand_fit['272',S] 5.2875708 .RHS. demand_fit['275',S] 7.40259912 .RHS. demand_fit['276',S] 6.645651 .RHS. demand_fit['280',S] 3.17254248 .RHS. demand_fit['282',S] 9.3039114 .RHS. demand_fit['283',S] 3.64592208 .RHS. demand_fit['293',S] 2.11502832 .RHS. demand_fit['298',S] 4.23005664 .RHS. demand_fit['299',S] 7.40259912 .RHS. demand_fit['301',S] 5.3165208 .RHS. demand_fit['309',S] 6.645651 .RHS. demand_fit['310',S] 4.5574026 .RHS. demand_fit['375',S] 6.645651 .RHS. demand_fit['378',S] 3.9873906 .RHS. demand_fit['379',S] 6.38036364 .RHS. demand_fit['381',S] 3.9873906 .RHS. demand_fit['383',S] 5.2875708 .RHS. demand_fit['384',S] 9.3039114 .RHS. demand_fit['386',S] 5.3165208 .RHS. demand_fit['388',S] 5.2875708 .RHS. demand_fit['389',S] 8.46011328 .RHS. demand_fit['390',S] 13.291302 .RHS. demand_fit['397',S] 6.645651 .RHS. demand_fit['398',S] 10.6330416 .RHS. demand_fit['403',S] 9.1148052 .RHS. demand_fit['418',S] 5.3165208 .RHS. demand_fit['430',S] 5.3165208 .RHS. demand_fit['431',S] 3.64592208 .RHS. demand_fit['479',S] 3.9873906 .RHS. demand_fit['502',S] 3.17254248 .RHS. demand_fit['504',S] 5.2875708 .RHS. demand_fit['512',S] 4.23005664 .RHS. demand_fit['528',S] 2.11502832 .RHS. demand_fit['533',S] 4.23005664 .RHS. demand_fit['538',S] 5.2875708 .RHS. demand_fit['552',S] 3.64592208 .RHS. demand_fit['621',S] 6.38036364 .RHS. demand_fit['639',S] 2.6582604 .RHS. demand_fit['712',S] 3.9873906 .RHS. demand_fit['781',S] 6.645651 .RHS. demand_fit['71',M] 10.64293584 .RHS. demand_fit['73',M] 15.4621008 .RHS. demand_fit['86',M] 23.24756064 .RHS. demand_fit['99',M] 14.5297254 .RHS. demand_fit['103',M] 18.62513772 .RHS. demand_fit['126',M] 21.64694112 .RHS. demand_fit['221',M] 23.24756064 .RHS. demand_fit['225',M] 5.81189016 .RHS. demand_fit['251',M] 14.5297254 .RHS. demand_fit['270',M] 7.98220188 .RHS. demand_fit['272',M] 14.5297254 .RHS. demand_fit['275',M] 20.34161556 .RHS. demand_fit['276',M] 15.4621008 .RHS. demand_fit['280',M] 8.71783524 .RHS. demand_fit['282',M] 21.64694112 .RHS. demand_fit['283',M] 10.64293584 .RHS. demand_fit['293',M] 5.81189016 .RHS. demand_fit['298',M] 11.62378032 .RHS. demand_fit['299',M] 20.34161556 .RHS. demand_fit['301',M] 12.36968064 .RHS. demand_fit['309',M] 15.4621008 .RHS. demand_fit['310',M] 13.3036698 .RHS. demand_fit['375',M] 15.4621008 .RHS. demand_fit['378',M] 9.27726048 .RHS. demand_fit['379',M] 18.62513772 .RHS. demand_fit['381',M] 9.27726048 .RHS. demand_fit['383',M] 14.5297254 .RHS. demand_fit['384',M] 21.64694112 .RHS. demand_fit['386',M] 12.36968064 .RHS. demand_fit['388',M] 14.5297254 .RHS. demand_fit['389',M] 23.24756064 .RHS. demand_fit['390',M] 30.9242016 .RHS. demand_fit['397',M] 15.4621008 .RHS. demand_fit['398',M] 24.73936128 .RHS. demand_fit['403',M] 26.6073396 .RHS. demand_fit['418',M] 12.36968064 .RHS. demand_fit['430',M] 12.36968064 .RHS. demand_fit['431',M] 10.64293584 .RHS. demand_fit['479',M] 9.27726048 .RHS. demand_fit['502',M] 8.71783524 .RHS. demand_fit['504',M] 14.5297254 .RHS. demand_fit['512',M] 11.62378032 .RHS. demand_fit['528',M] 5.81189016 .RHS. demand_fit['533',M] 11.62378032 .RHS. demand_fit['538',M] 14.5297254 .RHS. demand_fit['552',M] 10.64293584 .RHS. demand_fit['621',M] 18.62513772 .RHS. demand_fit['639',M] 6.18484032 .RHS. demand_fit['712',M] 9.27726048 .RHS. demand_fit['781',M] 15.4621008 .RHS. demand_fit['71',L] 15.62372304 .RHS. demand_fit['73',L] 18.2540478 .RHS. demand_fit['86',L] 31.526496 .RHS. demand_fit['99',L] 19.70406 .RHS. demand_fit['103',L] 27.34151532 .RHS. demand_fit['126',L] 25.55566692 .RHS. demand_fit['221',L] 31.526496 .RHS. demand_fit['225',L] 7.881624 .RHS. demand_fit['251',L] 19.70406 .RHS. demand_fit['270',L] 11.71779228 .RHS. demand_fit['272',L] 19.70406 .RHS. demand_fit['275',L] 27.585684 .RHS. demand_fit['276',L] 18.2540478 .RHS. demand_fit['280',L] 11.822436 .RHS. demand_fit['282',L] 25.55566692 .RHS. demand_fit['283',L] 15.62372304 .RHS. demand_fit['293',L] 7.881624 .RHS. demand_fit['298',L] 15.763248 .RHS. demand_fit['299',L] 27.585684 .RHS. demand_fit['301',L] 14.60323824 .RHS. demand_fit['309',L] 18.2540478 .RHS. demand_fit['310',L] 19.5296538 .RHS. demand_fit['375',L] 18.2540478 .RHS. demand_fit['378',L] 10.95242868 .RHS. demand_fit['379',L] 27.34151532 .RHS. demand_fit['381',L] 10.95242868 .RHS. demand_fit['383',L] 19.70406 .RHS. demand_fit['384',L] 25.55566692 .RHS. demand_fit['386',L] 14.60323824 .RHS. demand_fit['388',L] 19.70406 .RHS. demand_fit['389',L] 31.526496 .RHS. demand_fit['390',L] 36.5080956 .RHS. demand_fit['397',L] 18.2540478 .RHS. demand_fit['398',L] 29.20647648 .RHS. demand_fit['403',L] 39.0593076 .RHS. demand_fit['418',L] 14.60323824 .RHS. demand_fit['430',L] 14.60323824 .RHS. demand_fit['431',L] 15.62372304 .RHS. demand_fit['479',L] 10.95242868 .RHS. demand_fit['502',L] 11.822436 .RHS. demand_fit['504',L] 19.70406 .RHS. demand_fit['512',L] 15.763248 .RHS. demand_fit['528',L] 7.881624 .RHS. demand_fit['533',L] 15.763248 .RHS. demand_fit['538',L] 19.70406 .RHS. demand_fit['552',L] 15.62372304 .RHS. demand_fit['621',L] 27.34151532 .RHS. demand_fit['639',L] 7.30161912 .RHS. demand_fit['712',L] 10.95242868 .RHS. demand_fit['781',L] 18.2540478 .RHS. demand_fit['71',XL] 18.08741904 .RHS. demand_fit['73',XL] 19.6382004 .RHS. demand_fit['86',XL] 32.76582912 .RHS. demand_fit['99',XL] 20.4786432 .RHS. demand_fit['103',XL] 31.65298332 .RHS. demand_fit['126',XL] 27.49348056 .RHS. demand_fit['221',XL] 32.76582912 .RHS. demand_fit['225',XL] 8.19145728 .RHS. demand_fit['251',XL] 20.4786432 .RHS. demand_fit['270',XL] 13.56556428 .RHS. demand_fit['272',XL] 20.4786432 .RHS. demand_fit['275',XL] 28.67010048 .RHS. demand_fit['276',XL] 19.6382004 .RHS. demand_fit['280',XL] 12.28718592 .RHS. demand_fit['282',XL] 27.49348056 .RHS. demand_fit['283',XL] 18.08741904 .RHS. demand_fit['293',XL] 8.19145728 .RHS. demand_fit['298',XL] 16.38291456 .RHS. demand_fit['299',XL] 28.67010048 .RHS. demand_fit['301',XL] 15.71056032 .RHS. demand_fit['309',XL] 19.6382004 .RHS. demand_fit['310',XL] 22.6092738 .RHS. demand_fit['375',XL] 19.6382004 .RHS. demand_fit['378',XL] 11.78292024 .RHS. demand_fit['379',XL] 31.65298332 .RHS. demand_fit['381',XL] 11.78292024 .RHS. demand_fit['383',XL] 20.4786432 .RHS. demand_fit['384',XL] 27.49348056 .RHS. demand_fit['386',XL] 15.71056032 .RHS. demand_fit['388',XL] 20.4786432 .RHS. demand_fit['389',XL] 32.76582912 .RHS. demand_fit['390',XL] 39.2764008 .RHS. demand_fit['397',XL] 19.6382004 .RHS. demand_fit['398',XL] 31.42112064 .RHS. demand_fit['403',XL] 45.2185476 .RHS. demand_fit['418',XL] 15.71056032 .RHS. demand_fit['430',XL] 15.71056032 .RHS. demand_fit['431',XL] 18.08741904 .RHS. demand_fit['479',XL] 11.78292024 .RHS. demand_fit['502',XL] 12.28718592 .RHS. demand_fit['504',XL] 20.4786432 .RHS. demand_fit['512',XL] 16.38291456 .RHS. demand_fit['528',XL] 8.19145728 .RHS. demand_fit['533',XL] 16.38291456 .RHS. demand_fit['538',XL] 20.4786432 .RHS. demand_fit['552',XL] 18.08741904 .RHS. demand_fit['621',XL] 31.65298332 .RHS. demand_fit['639',XL] 7.85528016 .RHS. demand_fit['712',XL] 11.78292024 .RHS. demand_fit['781',XL] 19.6382004 BOUNDS FX .BOUNDS. NumLooseInners['71',Pack1] 0 FX .BOUNDS. NumLooseInners['73',Pack1] 0 FX .BOUNDS. NumLooseInners['86',Pack1] 0 FX .BOUNDS. NumLooseInners['99',Pack1] 0 FX .BOUNDS. NumLooseInners['103',Pack1] 0 FX .BOUNDS. NumLooseInners['126',Pack1] 0 FX .BOUNDS. NumLooseInners['221',Pack1] 0 FX .BOUNDS. NumLooseInners['225',Pack1] 0 FX .BOUNDS. NumLooseInners['251',Pack1] 0 FX .BOUNDS. NumLooseInners['270',Pack1] 0 FX .BOUNDS. NumLooseInners['272',Pack1] 0 FX .BOUNDS. NumLooseInners['275',Pack1] 0 FX .BOUNDS. NumLooseInners['276',Pack1] 0 FX .BOUNDS. NumLooseInners['280',Pack1] 0 FX .BOUNDS. NumLooseInners['282',Pack1] 0 FX .BOUNDS. NumLooseInners['283',Pack1] 0 FX .BOUNDS. NumLooseInners['293',Pack1] 0 FX .BOUNDS. NumLooseInners['298',Pack1] 0 FX .BOUNDS. NumLooseInners['299',Pack1] 0 FX .BOUNDS. NumLooseInners['301',Pack1] 0 FX .BOUNDS. NumLooseInners['309',Pack1] 0 FX .BOUNDS. NumLooseInners['310',Pack1] 0 FX .BOUNDS. NumLooseInners['375',Pack1] 0 FX .BOUNDS. NumLooseInners['378',Pack1] 0 FX .BOUNDS. NumLooseInners['379',Pack1] 0 FX .BOUNDS. NumLooseInners['381',Pack1] 0 FX .BOUNDS. NumLooseInners['383',Pack1] 0 FX .BOUNDS. NumLooseInners['384',Pack1] 0 FX .BOUNDS. NumLooseInners['386',Pack1] 0 FX .BOUNDS. NumLooseInners['388',Pack1] 0 FX .BOUNDS. NumLooseInners['389',Pack1] 0 FX .BOUNDS. NumLooseInners['390',Pack1] 0 FX .BOUNDS. NumLooseInners['397',Pack1] 0 FX .BOUNDS. NumLooseInners['398',Pack1] 0 FX .BOUNDS. NumLooseInners['403',Pack1] 0 FX .BOUNDS. NumLooseInners['418',Pack1] 0 FX .BOUNDS. NumLooseInners['430',Pack1] 0 FX .BOUNDS. NumLooseInners['431',Pack1] 0 FX .BOUNDS. NumLooseInners['479',Pack1] 0 FX .BOUNDS. NumLooseInners['502',Pack1] 0 FX .BOUNDS. NumLooseInners['504',Pack1] 0 FX .BOUNDS. NumLooseInners['512',Pack1] 0 FX .BOUNDS. NumLooseInners['528',Pack1] 0 FX .BOUNDS. NumLooseInners['533',Pack1] 0 FX .BOUNDS. NumLooseInners['538',Pack1] 0 FX .BOUNDS. NumLooseInners['552',Pack1] 0 FX .BOUNDS. NumLooseInners['621',Pack1] 0 FX .BOUNDS. NumLooseInners['639',Pack1] 0 FX .BOUNDS. NumLooseInners['712',Pack1] 0 FX .BOUNDS. NumLooseInners['781',Pack1] 0 FX .BOUNDS. NumLooseInners['71',Pack2] 0 FX .BOUNDS. NumLooseInners['73',Pack2] 0 FX .BOUNDS. NumLooseInners['86',Pack2] 0 FX .BOUNDS. NumLooseInners['99',Pack2] 0 FX .BOUNDS. NumLooseInners['103',Pack2] 0 FX .BOUNDS. NumLooseInners['126',Pack2] 0 FX .BOUNDS. NumLooseInners['221',Pack2] 0 FX .BOUNDS. NumLooseInners['225',Pack2] 0 FX .BOUNDS. NumLooseInners['251',Pack2] 0 FX .BOUNDS. NumLooseInners['270',Pack2] 0 FX .BOUNDS. NumLooseInners['272',Pack2] 0 FX .BOUNDS. NumLooseInners['275',Pack2] 0 FX .BOUNDS. NumLooseInners['276',Pack2] 0 FX .BOUNDS. NumLooseInners['280',Pack2] 0 FX .BOUNDS. NumLooseInners['282',Pack2] 0 FX .BOUNDS. NumLooseInners['283',Pack2] 0 FX .BOUNDS. NumLooseInners['293',Pack2] 0 FX .BOUNDS. NumLooseInners['298',Pack2] 0 FX .BOUNDS. NumLooseInners['299',Pack2] 0 FX .BOUNDS. NumLooseInners['301',Pack2] 0 FX .BOUNDS. NumLooseInners['309',Pack2] 0 FX .BOUNDS. NumLooseInners['310',Pack2] 0 FX .BOUNDS. NumLooseInners['375',Pack2] 0 FX .BOUNDS. NumLooseInners['378',Pack2] 0 FX .BOUNDS. NumLooseInners['379',Pack2] 0 FX .BOUNDS. NumLooseInners['381',Pack2] 0 FX .BOUNDS. NumLooseInners['383',Pack2] 0 FX .BOUNDS. NumLooseInners['384',Pack2] 0 FX .BOUNDS. NumLooseInners['386',Pack2] 0 FX .BOUNDS. NumLooseInners['388',Pack2] 0 FX .BOUNDS. NumLooseInners['389',Pack2] 0 FX .BOUNDS. NumLooseInners['390',Pack2] 0 FX .BOUNDS. NumLooseInners['397',Pack2] 0 FX .BOUNDS. NumLooseInners['398',Pack2] 0 FX .BOUNDS. NumLooseInners['403',Pack2] 0 FX .BOUNDS. NumLooseInners['418',Pack2] 0 FX .BOUNDS. NumLooseInners['430',Pack2] 0 FX .BOUNDS. NumLooseInners['431',Pack2] 0 FX .BOUNDS. NumLooseInners['479',Pack2] 0 FX .BOUNDS. NumLooseInners['502',Pack2] 0 FX .BOUNDS. NumLooseInners['504',Pack2] 0 FX .BOUNDS. NumLooseInners['512',Pack2] 0 FX .BOUNDS. NumLooseInners['528',Pack2] 0 FX .BOUNDS. NumLooseInners['533',Pack2] 0 FX .BOUNDS. NumLooseInners['538',Pack2] 0 FX .BOUNDS. NumLooseInners['552',Pack2] 0 FX .BOUNDS. NumLooseInners['621',Pack2] 0 FX .BOUNDS. NumLooseInners['639',Pack2] 0 FX .BOUNDS. NumLooseInners['712',Pack2] 0 FX .BOUNDS. NumLooseInners['781',Pack2] 0 FX .BOUNDS. NumLooseInners['71',Pack3] 0 FX .BOUNDS. NumLooseInners['73',Pack3] 0 FX .BOUNDS. NumLooseInners['86',Pack3] 0 FX .BOUNDS. NumLooseInners['99',Pack3] 0 FX .BOUNDS. NumLooseInners['103',Pack3] 0 FX .BOUNDS. NumLooseInners['126',Pack3] 0 FX .BOUNDS. NumLooseInners['221',Pack3] 0 FX .BOUNDS. NumLooseInners['225',Pack3] 0 FX .BOUNDS. NumLooseInners['251',Pack3] 0 FX .BOUNDS. NumLooseInners['270',Pack3] 0 FX .BOUNDS. NumLooseInners['272',Pack3] 0 FX .BOUNDS. NumLooseInners['275',Pack3] 0 FX .BOUNDS. NumLooseInners['276',Pack3] 0 FX .BOUNDS. NumLooseInners['280',Pack3] 0 FX .BOUNDS. NumLooseInners['282',Pack3] 0 FX .BOUNDS. NumLooseInners['283',Pack3] 0 FX .BOUNDS. NumLooseInners['293',Pack3] 0 FX .BOUNDS. NumLooseInners['298',Pack3] 0 FX .BOUNDS. NumLooseInners['299',Pack3] 0 FX .BOUNDS. NumLooseInners['301',Pack3] 0 FX .BOUNDS. NumLooseInners['309',Pack3] 0 FX .BOUNDS. NumLooseInners['310',Pack3] 0 FX .BOUNDS. NumLooseInners['375',Pack3] 0 FX .BOUNDS. NumLooseInners['378',Pack3] 0 FX .BOUNDS. NumLooseInners['379',Pack3] 0 FX .BOUNDS. NumLooseInners['381',Pack3] 0 FX .BOUNDS. NumLooseInners['383',Pack3] 0 FX .BOUNDS. NumLooseInners['384',Pack3] 0 FX .BOUNDS. NumLooseInners['386',Pack3] 0 FX .BOUNDS. NumLooseInners['388',Pack3] 0 FX .BOUNDS. NumLooseInners['389',Pack3] 0 FX .BOUNDS. NumLooseInners['390',Pack3] 0 FX .BOUNDS. NumLooseInners['397',Pack3] 0 FX .BOUNDS. NumLooseInners['398',Pack3] 0 FX .BOUNDS. NumLooseInners['403',Pack3] 0 FX .BOUNDS. NumLooseInners['418',Pack3] 0 FX .BOUNDS. NumLooseInners['430',Pack3] 0 FX .BOUNDS. NumLooseInners['431',Pack3] 0 FX .BOUNDS. NumLooseInners['479',Pack3] 0 FX .BOUNDS. NumLooseInners['502',Pack3] 0 FX .BOUNDS. NumLooseInners['504',Pack3] 0 FX .BOUNDS. NumLooseInners['512',Pack3] 0 FX .BOUNDS. NumLooseInners['528',Pack3] 0 FX .BOUNDS. NumLooseInners['533',Pack3] 0 FX .BOUNDS. NumLooseInners['538',Pack3] 0 FX .BOUNDS. NumLooseInners['552',Pack3] 0 FX .BOUNDS. NumLooseInners['621',Pack3] 0 FX .BOUNDS. NumLooseInners['639',Pack3] 0 FX .BOUNDS. NumLooseInners['712',Pack3] 0 FX .BOUNDS. NumLooseInners['781',Pack3] 0 UP .BOUNDS. NumUnopenedOuters['71',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['73',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['86',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['99',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['103',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['126',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['221',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['225',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['251',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['270',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['272',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['275',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['276',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['280',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['282',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['283',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['293',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['298',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['299',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['301',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['309',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['310',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['375',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['378',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['379',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['381',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['383',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['384',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['386',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['388',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['389',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['390',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['397',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['398',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['403',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['418',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['430',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['431',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['479',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['502',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['504',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['512',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['528',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['533',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['538',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['552',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['621',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['639',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['712',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['781',Pack1] 1000 UP .BOUNDS. NumUnopenedOuters['71',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['73',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['86',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['99',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['103',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['126',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['221',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['225',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['251',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['270',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['272',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['275',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['276',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['280',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['282',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['283',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['293',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['298',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['299',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['301',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['309',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['310',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['375',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['378',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['379',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['381',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['383',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['384',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['386',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['388',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['389',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['390',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['397',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['398',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['403',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['418',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['430',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['431',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['479',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['502',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['504',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['512',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['528',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['533',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['538',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['552',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['621',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['639',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['712',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['781',Pack2] 1000 UP .BOUNDS. NumUnopenedOuters['71',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['73',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['86',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['99',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['103',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['126',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['221',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['225',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['251',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['270',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['272',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['275',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['276',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['280',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['282',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['283',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['293',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['298',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['299',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['301',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['309',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['310',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['375',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['378',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['379',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['381',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['383',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['384',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['386',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['388',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['389',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['390',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['397',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['398',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['403',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['418',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['430',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['431',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['479',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['502',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['504',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['512',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['528',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['533',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['538',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['552',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['621',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['639',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['712',Pack3] 1000 UP .BOUNDS. NumUnopenedOuters['781',Pack3] 1000 FX .BOUNDS. NumOpenedOuters[Pack1] 0 FX .BOUNDS. NumOpenedOuters[Pack2] 0 FX .BOUNDS. NumOpenedOuters[Pack3] 0 UP .BOUNDS. NumUnder['71',S] 3.64592208 UP .BOUNDS. NumUnder['73',S] 6.645651 UP .BOUNDS. NumUnder['86',S] 8.46011328 UP .BOUNDS. NumUnder['99',S] 5.2875708 UP .BOUNDS. NumUnder['103',S] 6.38036364 UP .BOUNDS. NumUnder['126',S] 9.3039114 UP .BOUNDS. NumUnder['221',S] 8.46011328 UP .BOUNDS. NumUnder['225',S] 2.11502832 UP .BOUNDS. NumUnder['251',S] 5.2875708 UP .BOUNDS. NumUnder['270',S] 2.73444156 UP .BOUNDS. NumUnder['272',S] 5.2875708 UP .BOUNDS. NumUnder['275',S] 7.40259912 UP .BOUNDS. NumUnder['276',S] 6.645651 UP .BOUNDS. NumUnder['280',S] 3.17254248 UP .BOUNDS. NumUnder['282',S] 9.3039114 UP .BOUNDS. NumUnder['283',S] 3.64592208 UP .BOUNDS. NumUnder['293',S] 2.11502832 UP .BOUNDS. NumUnder['298',S] 4.23005664 UP .BOUNDS. NumUnder['299',S] 7.40259912 UP .BOUNDS. NumUnder['301',S] 5.3165208 UP .BOUNDS. NumUnder['309',S] 6.645651 UP .BOUNDS. NumUnder['310',S] 4.5574026 UP .BOUNDS. NumUnder['375',S] 6.645651 UP .BOUNDS. NumUnder['378',S] 3.9873906 UP .BOUNDS. NumUnder['379',S] 6.38036364 UP .BOUNDS. NumUnder['381',S] 3.9873906 UP .BOUNDS. NumUnder['383',S] 5.2875708 UP .BOUNDS. NumUnder['384',S] 9.3039114 UP .BOUNDS. NumUnder['386',S] 5.3165208 UP .BOUNDS. NumUnder['388',S] 5.2875708 UP .BOUNDS. NumUnder['389',S] 8.46011328 UP .BOUNDS. NumUnder['390',S] 13.291302 UP .BOUNDS. NumUnder['397',S] 6.645651 UP .BOUNDS. NumUnder['398',S] 10.6330416 UP .BOUNDS. NumUnder['403',S] 9.1148052 UP .BOUNDS. NumUnder['418',S] 5.3165208 UP .BOUNDS. NumUnder['430',S] 5.3165208 UP .BOUNDS. NumUnder['431',S] 3.64592208 UP .BOUNDS. NumUnder['479',S] 3.9873906 UP .BOUNDS. NumUnder['502',S] 3.17254248 UP .BOUNDS. NumUnder['504',S] 5.2875708 UP .BOUNDS. NumUnder['512',S] 4.23005664 UP .BOUNDS. NumUnder['528',S] 2.11502832 UP .BOUNDS. NumUnder['533',S] 4.23005664 UP .BOUNDS. NumUnder['538',S] 5.2875708 UP .BOUNDS. NumUnder['552',S] 3.64592208 UP .BOUNDS. NumUnder['621',S] 6.38036364 UP .BOUNDS. NumUnder['639',S] 2.6582604 UP .BOUNDS. NumUnder['712',S] 3.9873906 UP .BOUNDS. NumUnder['781',S] 6.645651 UP .BOUNDS. NumUnder['71',M] 10.64293584 UP .BOUNDS. NumUnder['73',M] 15.4621008 UP .BOUNDS. NumUnder['86',M] 23.24756064 UP .BOUNDS. NumUnder['99',M] 14.5297254 UP .BOUNDS. NumUnder['103',M] 18.62513772 UP .BOUNDS. NumUnder['126',M] 21.64694112 UP .BOUNDS. NumUnder['221',M] 23.24756064 UP .BOUNDS. NumUnder['225',M] 5.81189016 UP .BOUNDS. NumUnder['251',M] 14.5297254 UP .BOUNDS. NumUnder['270',M] 7.98220188 UP .BOUNDS. NumUnder['272',M] 14.5297254 UP .BOUNDS. NumUnder['275',M] 20.34161556 UP .BOUNDS. NumUnder['276',M] 15.4621008 UP .BOUNDS. NumUnder['280',M] 8.71783524 UP .BOUNDS. NumUnder['282',M] 21.64694112 UP .BOUNDS. NumUnder['283',M] 10.64293584 UP .BOUNDS. NumUnder['293',M] 5.81189016 UP .BOUNDS. NumUnder['298',M] 11.62378032 UP .BOUNDS. NumUnder['299',M] 20.34161556 UP .BOUNDS. NumUnder['301',M] 12.36968064 UP .BOUNDS. NumUnder['309',M] 15.4621008 UP .BOUNDS. NumUnder['310',M] 13.3036698 UP .BOUNDS. NumUnder['375',M] 15.4621008 UP .BOUNDS. NumUnder['378',M] 9.27726048 UP .BOUNDS. NumUnder['379',M] 18.62513772 UP .BOUNDS. NumUnder['381',M] 9.27726048 UP .BOUNDS. NumUnder['383',M] 14.5297254 UP .BOUNDS. NumUnder['384',M] 21.64694112 UP .BOUNDS. NumUnder['386',M] 12.36968064 UP .BOUNDS. NumUnder['388',M] 14.5297254 UP .BOUNDS. NumUnder['389',M] 23.24756064 UP .BOUNDS. NumUnder['390',M] 30.9242016 UP .BOUNDS. NumUnder['397',M] 15.4621008 UP .BOUNDS. NumUnder['398',M] 24.73936128 UP .BOUNDS. NumUnder['403',M] 26.6073396 UP .BOUNDS. NumUnder['418',M] 12.36968064 UP .BOUNDS. NumUnder['430',M] 12.36968064 UP .BOUNDS. NumUnder['431',M] 10.64293584 UP .BOUNDS. NumUnder['479',M] 9.27726048 UP .BOUNDS. NumUnder['502',M] 8.71783524 UP .BOUNDS. NumUnder['504',M] 14.5297254 UP .BOUNDS. NumUnder['512',M] 11.62378032 UP .BOUNDS. NumUnder['528',M] 5.81189016 UP .BOUNDS. NumUnder['533',M] 11.62378032 UP .BOUNDS. NumUnder['538',M] 14.5297254 UP .BOUNDS. NumUnder['552',M] 10.64293584 UP .BOUNDS. NumUnder['621',M] 18.62513772 UP .BOUNDS. NumUnder['639',M] 6.18484032 UP .BOUNDS. NumUnder['712',M] 9.27726048 UP .BOUNDS. NumUnder['781',M] 15.4621008 UP .BOUNDS. NumUnder['71',L] 15.62372304 UP .BOUNDS. NumUnder['73',L] 18.2540478 UP .BOUNDS. NumUnder['86',L] 31.526496 UP .BOUNDS. NumUnder['99',L] 19.70406 UP .BOUNDS. NumUnder['103',L] 27.34151532 UP .BOUNDS. NumUnder['126',L] 25.55566692 UP .BOUNDS. NumUnder['221',L] 31.526496 UP .BOUNDS. NumUnder['225',L] 7.881624 UP .BOUNDS. NumUnder['251',L] 19.70406 UP .BOUNDS. NumUnder['270',L] 11.71779228 UP .BOUNDS. NumUnder['272',L] 19.70406 UP .BOUNDS. NumUnder['275',L] 27.585684 UP .BOUNDS. NumUnder['276',L] 18.2540478 UP .BOUNDS. NumUnder['280',L] 11.822436 UP .BOUNDS. NumUnder['282',L] 25.55566692 UP .BOUNDS. NumUnder['283',L] 15.62372304 UP .BOUNDS. NumUnder['293',L] 7.881624 UP .BOUNDS. NumUnder['298',L] 15.763248 UP .BOUNDS. NumUnder['299',L] 27.585684 UP .BOUNDS. NumUnder['301',L] 14.60323824 UP .BOUNDS. NumUnder['309',L] 18.2540478 UP .BOUNDS. NumUnder['310',L] 19.5296538 UP .BOUNDS. NumUnder['375',L] 18.2540478 UP .BOUNDS. NumUnder['378',L] 10.95242868 UP .BOUNDS. NumUnder['379',L] 27.34151532 UP .BOUNDS. NumUnder['381',L] 10.95242868 UP .BOUNDS. NumUnder['383',L] 19.70406 UP .BOUNDS. NumUnder['384',L] 25.55566692 UP .BOUNDS. NumUnder['386',L] 14.60323824 UP .BOUNDS. NumUnder['388',L] 19.70406 UP .BOUNDS. NumUnder['389',L] 31.526496 UP .BOUNDS. NumUnder['390',L] 36.5080956 UP .BOUNDS. NumUnder['397',L] 18.2540478 UP .BOUNDS. NumUnder['398',L] 29.20647648 UP .BOUNDS. NumUnder['403',L] 39.0593076 UP .BOUNDS. NumUnder['418',L] 14.60323824 UP .BOUNDS. NumUnder['430',L] 14.60323824 UP .BOUNDS. NumUnder['431',L] 15.62372304 UP .BOUNDS. NumUnder['479',L] 10.95242868 UP .BOUNDS. NumUnder['502',L] 11.822436 UP .BOUNDS. NumUnder['504',L] 19.70406 UP .BOUNDS. NumUnder['512',L] 15.763248 UP .BOUNDS. NumUnder['528',L] 7.881624 UP .BOUNDS. NumUnder['533',L] 15.763248 UP .BOUNDS. NumUnder['538',L] 19.70406 UP .BOUNDS. NumUnder['552',L] 15.62372304 UP .BOUNDS. NumUnder['621',L] 27.34151532 UP .BOUNDS. NumUnder['639',L] 7.30161912 UP .BOUNDS. NumUnder['712',L] 10.95242868 UP .BOUNDS. NumUnder['781',L] 18.2540478 UP .BOUNDS. NumUnder['71',XL] 18.08741904 UP .BOUNDS. NumUnder['73',XL] 19.6382004 UP .BOUNDS. NumUnder['86',XL] 32.76582912 UP .BOUNDS. NumUnder['99',XL] 20.4786432 UP .BOUNDS. NumUnder['103',XL] 31.65298332 UP .BOUNDS. NumUnder['126',XL] 27.49348056 UP .BOUNDS. NumUnder['221',XL] 32.76582912 UP .BOUNDS. NumUnder['225',XL] 8.19145728 UP .BOUNDS. NumUnder['251',XL] 20.4786432 UP .BOUNDS. NumUnder['270',XL] 13.56556428 UP .BOUNDS. NumUnder['272',XL] 20.4786432 UP .BOUNDS. NumUnder['275',XL] 28.67010048 UP .BOUNDS. NumUnder['276',XL] 19.6382004 UP .BOUNDS. NumUnder['280',XL] 12.28718592 UP .BOUNDS. NumUnder['282',XL] 27.49348056 UP .BOUNDS. NumUnder['283',XL] 18.08741904 UP .BOUNDS. NumUnder['293',XL] 8.19145728 UP .BOUNDS. NumUnder['298',XL] 16.38291456 UP .BOUNDS. NumUnder['299',XL] 28.67010048 UP .BOUNDS. NumUnder['301',XL] 15.71056032 UP .BOUNDS. NumUnder['309',XL] 19.6382004 UP .BOUNDS. NumUnder['310',XL] 22.6092738 UP .BOUNDS. NumUnder['375',XL] 19.6382004 UP .BOUNDS. NumUnder['378',XL] 11.78292024 UP .BOUNDS. NumUnder['379',XL] 31.65298332 UP .BOUNDS. NumUnder['381',XL] 11.78292024 UP .BOUNDS. NumUnder['383',XL] 20.4786432 UP .BOUNDS. NumUnder['384',XL] 27.49348056 UP .BOUNDS. NumUnder['386',XL] 15.71056032 UP .BOUNDS. NumUnder['388',XL] 20.4786432 UP .BOUNDS. NumUnder['389',XL] 32.76582912 UP .BOUNDS. NumUnder['390',XL] 39.2764008 UP .BOUNDS. NumUnder['397',XL] 19.6382004 UP .BOUNDS. NumUnder['398',XL] 31.42112064 UP .BOUNDS. NumUnder['403',XL] 45.2185476 UP .BOUNDS. NumUnder['418',XL] 15.71056032 UP .BOUNDS. NumUnder['430',XL] 15.71056032 UP .BOUNDS. NumUnder['431',XL] 18.08741904 UP .BOUNDS. NumUnder['479',XL] 11.78292024 UP .BOUNDS. NumUnder['502',XL] 12.28718592 UP .BOUNDS. NumUnder['504',XL] 20.4786432 UP .BOUNDS. NumUnder['512',XL] 16.38291456 UP .BOUNDS. NumUnder['528',XL] 8.19145728 UP .BOUNDS. NumUnder['533',XL] 16.38291456 UP .BOUNDS. NumUnder['538',XL] 20.4786432 UP .BOUNDS. NumUnder['552',XL] 18.08741904 UP .BOUNDS. NumUnder['621',XL] 31.65298332 UP .BOUNDS. NumUnder['639',XL] 7.85528016 UP .BOUNDS. NumUnder['712',XL] 11.78292024 UP .BOUNDS. NumUnder['781',XL] 19.6382004 ENDATA CoinMP-1.8.3/Data/Sample/app0110R.cor0000755000175000017500000001462611015552002015322 0ustar renereneNAME MYSMPS ROWS N OBJECTRW L R0000001 L R0000002 L R0000003 L R0000004 L R0000005 E R0000006 E R0000007 E R0000008 E R0000009 E R0000010 E R0000011 E R0000012 E R0000013 E R0000014 E R0000015 E R0000016 E R0000017 E R0000018 E R0000019 E R0000020 E R0000021 E R0000022 E R0000023 E R0000024 E R0000025 COLUMNS C0000001 R0000001 1. R0000006 1. C0000002 R0000001 1. R0000007 1. C0000003 R0000001 1. R0000008 1. C0000004 R0000001 1. R0000009 1. C0000005 R0000002 1. R0000010 1. C0000006 R0000002 1. R0000011 1. C0000007 R0000002 1. R0000012 1. C0000008 R0000002 1. R0000013 1. C0000009 R0000003 1. R0000014 1. C0000010 R0000003 1. R0000015 1. C0000011 R0000003 1. R0000016 1. C0000012 R0000003 1. R0000017 1. C0000013 R0000004 1. R0000018 1. C0000014 R0000004 1. R0000019 1. C0000015 R0000004 1. R0000020 1. C0000016 R0000004 1. R0000021 1. C0000017 R0000005 1. R0000022 1. C0000018 R0000005 1. R0000023 1. C0000019 R0000005 1. R0000024 1. C0000020 R0000005 1. R0000025 1. C0000021 OBJECTRW 1. R0000006 -1. C0000021 R0000010 1. C0000022 OBJECTRW 2. R0000006 1. C0000023 OBJECTRW 2. R0000007 -1. C0000023 R0000011 1. C0000024 OBJECTRW 3. R0000007 1. C0000025 OBJECTRW 3. R0000008 -1. C0000025 R0000012 1. C0000026 OBJECTRW 2. R0000008 1. C0000027 OBJECTRW 4. R0000009 -1. C0000027 R0000013 1. C0000028 OBJECTRW 5. R0000009 1. C0000029 OBJECTRW 1. R0000010 -1. C0000029 R0000014 1. C0000030 OBJECTRW 2. R0000010 1. C0000031 OBJECTRW 2. R0000011 -1. C0000031 R0000015 1. C0000032 OBJECTRW 3. R0000011 1. C0000033 OBJECTRW 3. R0000012 -1. C0000033 R0000016 1. C0000034 OBJECTRW 2. R0000012 1. C0000035 OBJECTRW 4. R0000013 -1. C0000035 R0000017 1. C0000036 OBJECTRW 5. R0000013 1. C0000037 OBJECTRW 1. R0000014 -1. C0000037 R0000018 1. C0000038 OBJECTRW 2. R0000014 1. C0000039 OBJECTRW 2. R0000015 -1. C0000039 R0000019 1. C0000040 OBJECTRW 3. R0000015 1. C0000041 OBJECTRW 3. R0000016 -1. C0000041 R0000020 1. C0000042 OBJECTRW 2. R0000016 1. C0000043 OBJECTRW 4. R0000017 -1. C0000043 R0000021 1. C0000044 OBJECTRW 5. R0000017 1. C0000045 OBJECTRW 1. R0000018 -1. C0000045 R0000022 1. C0000046 OBJECTRW 2. R0000018 1. C0000047 OBJECTRW 2. R0000019 -1. C0000047 R0000023 1. C0000048 OBJECTRW 3. R0000019 1. C0000049 OBJECTRW 3. R0000020 -1. C0000049 R0000024 1. C0000050 OBJECTRW 2. R0000020 1. C0000051 OBJECTRW 4. R0000021 -1. C0000051 R0000025 1. C0000052 OBJECTRW 5. R0000021 1. C0000053 OBJECTRW 1. R0000022 -1. C0000054 OBJECTRW 2. R0000022 1. C0000055 OBJECTRW 2. R0000023 -1. C0000056 OBJECTRW 3. R0000023 1. C0000057 OBJECTRW 3. R0000024 -1. C0000058 OBJECTRW 2. R0000024 1. C0000059 OBJECTRW 4. R0000025 -1. C0000060 OBJECTRW 5. R0000025 1. RHS RHS R0000001 3. R0000002 6. RHS R0000003 10. R0000004 2000. RHS R0000005 18. R0000006 1. RHS R0000007 1. R0000008 1. RHS R0000009 1. R0000010 2.667 RHS R0000011 1.667 R0000012 2.667 RHS R0000013 3.333 R0000014 2.667 RHS R0000015 2. R0000016 3. RHS R0000017 3. R0000018 2.667 RHS R0000019 2.667 R0000020 2.667 RHS R0000021 2.667 R0000022 2.667 RHS R0000023 2.333 R0000024 2.333 RHS R0000025 2.333 BOUNDS UP BOUND C0000029 51. UP BOUND C0000030 51. UP BOUND C0000031 51. UP BOUND C0000032 51. ENDATA CoinMP-1.8.3/Data/Sample/install-sh0000755000175000017500000002202111405216230015401 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Data/Sample/hello.mps0000644000175000017500000003024210662211140015224 0ustar renereneNAME Hello ROWS N OBJROW L R0000000 L R0000001 L R0000002 L R0000003 L R0000004 L R0000005 L R0000006 L R0000007 L R0000008 L R0000009 L R0000010 L R0000011 L R0000012 L R0000013 L R0000014 L R0000015 L R0000016 L R0000017 L R0000018 L R0000019 L R0000020 COLUMNS C0000000 OBJROW 1. R0000000 1. C0000000 R0000001 1. R0000002 1. C0000000 R0000003 1. R0000004 1. C0000000 R0000005 1. R0000006 1. C0000000 R0000007 1. R0000008 1. C0000000 R0000011 1. R0000012 1. C0000000 R0000013 1. R0000014 1. C0000000 R0000015 1. R0000016 1. C0000000 R0000017 1. C0000001 OBJROW 1. R0000004 1. C0000001 R0000018 1. C0000002 OBJROW 1. R0000004 1. C0000002 R0000019 1. C0000003 OBJROW 1. R0000004 1. C0000003 R0000018 1. C0000004 OBJROW 1. R0000004 1. C0000004 R0000017 1. C0000005 OBJROW 1. R0000004 1. C0000005 R0000018 1. C0000006 OBJROW 1. R0000004 1. C0000006 R0000019 1. C0000007 OBJROW 1. R0000004 1. C0000007 R0000018 1. C0000008 OBJROW 1. R0000000 1. C0000008 R0000001 1. R0000002 1. C0000008 R0000003 1. R0000004 1. C0000008 R0000005 1. R0000006 1. C0000008 R0000007 1. R0000008 1. C0000008 R0000011 1. R0000012 1. C0000008 R0000013 1. R0000014 1. C0000008 R0000015 1. R0000016 1. C0000008 R0000017 1. C0000009 OBJROW 1. C0000010 OBJROW 1. C0000011 OBJROW 1. R0000000 1. C0000011 R0000001 1. R0000002 1. C0000011 R0000003 1. R0000004 1. C0000011 R0000005 1. R0000006 1. C0000011 R0000007 1. R0000008 1. C0000011 R0000013 1. R0000014 1. C0000011 R0000015 1. R0000016 1. C0000011 R0000017 1. C0000012 OBJROW 1. R0000000 1. C0000012 R0000004 1. R0000008 1. C0000012 R0000012 1. R0000018 1. C0000013 OBJROW 1. R0000000 1. C0000013 R0000004 1. R0000008 1. C0000013 R0000011 1. R0000019 1. C0000014 OBJROW 1. R0000000 1. C0000014 R0000004 1. R0000008 1. C0000014 R0000011 1. R0000019 1. C0000015 OBJROW 1. R0000000 1. C0000015 R0000004 1. R0000008 1. C0000015 R0000011 1. R0000019 1. C0000016 OBJROW 1. R0000000 1. C0000016 R0000004 1. R0000008 1. C0000016 R0000011 1. R0000019 1. C0000017 OBJROW 1. R0000000 1. C0000017 R0000008 1. R0000011 1. C0000017 R0000019 1. C0000018 OBJROW 1. R0000000 1. C0000018 R0000008 1. R0000012 1. C0000018 R0000018 1. C0000019 OBJROW 1. R0000000 1. C0000019 R0000008 1. R0000013 1. C0000019 R0000014 1. R0000015 1. C0000019 R0000016 1. R0000017 1. C0000020 OBJROW 1. C0000021 OBJROW 1. C0000022 OBJROW 1. R0000000 1. C0000022 R0000001 1. R0000002 1. C0000022 R0000003 1. R0000004 1. C0000022 R0000005 1. R0000006 1. C0000022 R0000007 1. R0000008 1. C0000022 R0000011 1. R0000012 1. C0000022 R0000013 1. R0000014 1. C0000022 R0000015 1. R0000016 1. C0000022 R0000017 1. R0000018 1. C0000022 R0000019 1. C0000023 OBJROW 1. R0000008 1. C0000023 R0000011 1. R0000015 1. C0000024 OBJROW 1. R0000008 1. C0000024 R0000011 1. R0000015 1. C0000025 OBJROW 1. R0000008 1. C0000025 R0000011 1. R0000015 1. C0000025 R0000016 1. C0000026 OBJROW 1. R0000008 1. C0000026 R0000011 1. R0000015 1. C0000026 R0000017 1. C0000027 OBJROW 1. R0000008 1. C0000027 R0000012 1. R0000014 1. C0000027 R0000018 1. C0000028 OBJROW 1. R0000008 1. C0000028 R0000013 1. R0000014 1. C0000028 R0000019 1. C0000029 OBJROW 1. R0000008 1. C0000030 OBJROW 1. R0000008 1. C0000031 OBJROW 1. C0000032 OBJROW 1. C0000033 OBJROW 1. R0000000 1. C0000033 R0000001 1. R0000002 1. C0000033 R0000003 1. R0000004 1. C0000033 R0000005 1. R0000006 1. C0000033 R0000007 1. R0000008 1. C0000033 R0000011 1. R0000012 1. C0000033 R0000013 1. R0000014 1. C0000033 R0000015 1. R0000016 1. C0000033 R0000017 1. R0000018 1. C0000033 R0000019 1. C0000034 OBJROW 1. R0000008 1. C0000034 R0000019 1. C0000035 OBJROW 1. R0000008 1. C0000035 R0000019 1. C0000036 OBJROW 1. R0000008 1. C0000036 R0000019 1. C0000037 OBJROW 1. R0000008 1. C0000037 R0000019 1. C0000038 OBJROW 1. R0000008 1. C0000038 R0000019 1. C0000039 OBJROW 1. R0000008 1. C0000039 R0000019 1. C0000040 OBJROW 1. R0000008 1. C0000040 R0000019 1. C0000041 OBJROW 1. R0000008 1. C0000041 R0000019 1. C0000042 OBJROW 1. C0000043 OBJROW 1. C0000044 OBJROW 1. R0000002 1. C0000044 R0000003 1. R0000004 1. C0000044 R0000005 1. R0000006 1. C0000044 R0000011 1. R0000012 1. C0000044 R0000013 1. R0000014 1. C0000044 R0000015 1. R0000016 1. C0000044 R0000017 1. R0000018 1. C0000044 R0000019 1. C0000045 OBJROW 1. R0000001 1. C0000045 R0000007 1. R0000011 1. C0000045 R0000019 1. C0000046 OBJROW 1. R0000000 1. C0000046 R0000008 1. R0000011 1. C0000046 R0000019 1. C0000047 OBJROW 1. R0000000 1. C0000047 R0000008 1. R0000011 1. C0000047 R0000019 1. C0000048 OBJROW 1. R0000000 1. C0000048 R0000008 1. R0000011 1. C0000048 R0000019 1. C0000049 OBJROW 1. R0000000 1. C0000049 R0000008 1. R0000012 1. C0000049 R0000018 1. C0000050 OBJROW 1. R0000000 1. C0000050 R0000008 1. R0000013 1. C0000050 R0000017 1. C0000051 OBJROW 1. R0000001 1. C0000051 R0000007 1. R0000014 1. C0000051 R0000015 1. R0000016 1. C0000052 OBJROW 1. R0000002 1. C0000052 R0000003 1. R0000004 1. C0000052 R0000005 1. R0000006 1. RHS RHS R0000000 1. R0000001 1. RHS R0000002 1. R0000003 1. RHS R0000004 1. R0000005 1. RHS R0000006 1. R0000007 1. RHS R0000008 1. R0000009 1. RHS R0000010 1. R0000011 1. RHS R0000012 1. R0000013 1. RHS R0000014 1. R0000015 1. RHS R0000016 1. R0000017 1. RHS R0000018 1. R0000019 1. RHS R0000020 1. RANGES RANGE R0000000 1. R0000001 1. RANGE R0000002 1. R0000003 1. RANGE R0000004 1. R0000005 1. RANGE R0000006 1. R0000007 1. RANGE R0000008 1. R0000009 1. RANGE R0000010 1. R0000011 1. RANGE R0000012 1. R0000013 1. RANGE R0000014 1. R0000015 1. RANGE R0000016 1. R0000017 1. RANGE R0000018 1. R0000019 1. RANGE R0000020 1. BOUNDS UP BOUND C0000000 1. UP BOUND C0000001 1. UP BOUND C0000002 1. UP BOUND C0000003 1. UP BOUND C0000004 1. UP BOUND C0000005 1. UP BOUND C0000006 1. UP BOUND C0000007 1. UP BOUND C0000008 1. UP BOUND C0000009 1. UP BOUND C0000010 1. UP BOUND C0000011 1. UP BOUND C0000012 1. UP BOUND C0000013 1. UP BOUND C0000014 1. UP BOUND C0000015 1. UP BOUND C0000016 1. UP BOUND C0000017 1. UP BOUND C0000018 1. UP BOUND C0000019 1. UP BOUND C0000020 1. UP BOUND C0000021 1. UP BOUND C0000022 1. UP BOUND C0000023 1. UP BOUND C0000024 1. UP BOUND C0000025 1. UP BOUND C0000026 1. UP BOUND C0000027 1. UP BOUND C0000028 1. UP BOUND C0000029 1. UP BOUND C0000030 1. UP BOUND C0000031 1. UP BOUND C0000032 1. UP BOUND C0000033 1. UP BOUND C0000034 1. UP BOUND C0000035 1. UP BOUND C0000036 1. UP BOUND C0000037 1. UP BOUND C0000038 1. UP BOUND C0000039 1. UP BOUND C0000040 1. UP BOUND C0000041 1. UP BOUND C0000042 1. UP BOUND C0000043 1. UP BOUND C0000044 1. UP BOUND C0000045 1. UP BOUND C0000046 1. UP BOUND C0000047 1. UP BOUND C0000048 1. UP BOUND C0000049 1. UP BOUND C0000050 1. UP BOUND C0000051 1. UP BOUND C0000052 1. ENDATA CoinMP-1.8.3/Data/Sample/atm_5_10_1.block0000644000175000017500000000172412136243266016160 0ustar renerene0 52 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 1 52 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 2 52 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 3 52 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 4 52 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 CoinMP-1.8.3/Data/Sample/configure.ac0000644000175000017500000000464112452373427015712 0ustar renerene# Copyright (C) 2006 International Business Machines. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: configure.ac 429 2015-01-05 02:29:43Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 ############################################################################# # Names and other basic things # ############################################################################# AC_PREREQ(2.59) AC_INIT([DataSample],[1.2.10],[https://projects.coin-or.org/BuildTools/]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License.]) # List one file in the package so that the configure script can test # whether the package is actually there AC_CONFIG_SRCDIR(configure.ac) # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. AC_PREFIX_DEFAULT([`pwd`]) AC_COIN_PROJECTDIR_INIT(DataSample,2:10:1) ############################################################################# # We only need automake to generate Makefiles for the distribution # ############################################################################# # Initialize automake AC_COIN_INIT_AUTOMAKE ############################################################################# #Find out what the data files are and create links if this is a VPATH config# ############################################################################# AC_COIN_EXAMPLE_FILES([*.mps]) AC_COIN_EXAMPLE_FILES([*.lp]) AC_COIN_EXAMPLE_FILES([*.block]) AC_COIN_EXAMPLE_FILES([*.dec]) AC_COIN_EXAMPLE_FILES([input.130]) AC_COIN_EXAMPLE_FILES([app0110.* app0110R.* bug.*]) ############################################################################## # Finishing up by writing all the output # ############################################################################## ABSBUILDDIR="`pwd`" AC_SUBST(ABSBUILDDIR) # Here list all the files that configure should create (except for the # configuration header file) AC_CONFIG_FILES([Makefile coindatasample.pc coindatasample-uninstalled.pc]) # Finally, we let configure write all the output... AC_COIN_FINALIZE CoinMP-1.8.3/Data/Sample/wedding_16.mps0000644000175000017500000073331512136243266016077 0ustar renerene* ENCODING=ISO-8859-1 NAME wedding_main.lp ROWS N OBJ L Maximum_table_size_0 L Maximum_table_size_1 L Maximum_table_size_2 L Maximum_table_size_3 L Maximum_table_size_4 E Must_seat_A E Must_seat_B E Must_seat_C E Must_seat_D E Must_seat_E E Must_seat_F E Must_seat_G E Must_seat_H E Must_seat_I E Must_seat_J E Must_seat_K E Must_seat_L E Must_seat_M E Must_seat_N E Must_seat_O E Must_seat_P G _C1 G _C10 G _C100 G _C101 G _C102 G _C103 G _C104 G _C105 G _C106 G _C107 G _C108 G _C109 G _C11 G _C110 G _C111 G _C112 G _C113 G _C114 G _C115 G _C116 G _C117 G _C118 G _C119 G _C12 G _C120 G _C121 G _C122 G _C123 G _C124 G _C125 G _C126 G _C127 G _C128 G _C129 G _C13 G _C130 G _C131 G _C132 G _C133 G _C134 G _C135 G _C136 G _C137 G _C138 G _C139 G _C14 G _C140 G _C141 G _C142 G _C143 G _C144 G _C145 G _C146 G _C147 G _C148 G _C149 G _C15 G _C150 G _C151 G _C152 G _C153 G _C154 G _C155 G _C156 G _C157 G _C158 G _C159 G _C16 G _C160 G _C161 G _C162 G _C163 G _C164 G _C165 G _C166 G _C167 G _C168 G _C169 G _C17 G _C170 G _C171 G _C172 G _C173 G _C174 G _C175 G _C176 G _C177 G _C178 G _C179 G _C18 G _C180 G _C181 G _C182 G _C183 G _C184 G _C185 G _C186 G _C187 G _C188 G _C189 G _C19 G _C190 G _C191 G _C192 G _C193 G _C194 G _C195 G _C196 G _C197 G _C198 G _C199 G _C2 G _C20 G _C200 G _C201 G _C202 G _C203 G _C204 G _C205 G _C206 G _C207 G _C208 G _C209 G _C21 G _C210 G _C211 G _C212 G _C213 G _C214 G _C215 G _C216 G _C217 G _C218 G _C219 G _C22 G _C220 G _C221 G _C222 G _C223 G _C224 G _C225 G _C226 G _C227 G _C228 G _C229 G _C23 G _C230 G _C231 G _C232 G _C233 G _C234 G _C235 G _C236 G _C237 G _C238 G _C239 G _C24 G _C240 G _C241 G _C242 G _C243 G _C244 G _C245 G _C246 G _C247 G _C248 G _C249 G _C25 G _C250 G _C251 G _C252 G _C253 G _C254 G _C255 G _C256 G _C257 G _C258 G _C259 G _C26 G _C260 G _C261 G _C262 G _C263 G _C264 G _C265 G _C266 G _C267 G _C268 G _C269 G _C27 G _C270 G _C271 G _C272 G _C273 G _C274 G _C275 G _C276 G _C277 G _C278 G _C279 G _C28 G _C280 G _C281 G _C282 G _C283 G _C284 G _C285 G _C286 G _C287 G _C288 G _C289 G _C29 G _C290 G _C291 G _C292 G _C293 G _C294 G _C295 G _C296 G _C297 G _C298 G _C299 G _C3 G _C30 G _C300 G _C301 G _C302 G _C303 G _C304 G _C305 G _C306 G _C307 G _C308 G _C309 G _C31 G _C310 G _C311 G _C312 G _C313 G _C314 G _C315 G _C316 G _C317 G _C318 G _C319 G _C32 G _C320 G _C321 G _C322 G _C323 G _C324 G _C325 G _C326 G _C327 G _C328 G _C329 G _C33 G _C330 G _C331 G _C332 G _C333 G _C334 G _C335 G _C336 G _C337 G _C338 G _C339 G _C34 G _C340 G _C341 G _C342 G _C343 G _C344 G _C345 G _C346 G _C347 G _C348 G _C349 G _C35 G _C350 G _C351 G _C352 G _C353 G _C354 G _C355 G _C356 G _C357 G _C358 G _C359 G _C36 G _C360 G _C361 G _C362 G _C363 G _C364 G _C365 G _C366 G _C367 G _C368 G _C369 G _C37 G _C370 G _C371 G _C372 G _C373 G _C374 G _C375 G _C376 G _C377 G _C378 G _C379 G _C38 G _C380 G _C381 G _C382 G _C383 G _C384 G _C385 G _C386 G _C387 G _C388 G _C389 G _C39 G _C390 G _C391 G _C392 G _C393 G _C394 G _C395 G _C396 G _C397 G _C398 G _C399 G _C4 G _C40 G _C400 G _C401 G _C402 G _C403 G _C404 G _C405 G _C406 G _C407 G _C408 G _C409 G _C41 G _C410 G _C411 G _C412 G _C413 G _C414 G _C415 G _C416 G _C417 G _C418 G _C419 G _C42 G _C420 G _C421 G _C422 G _C423 G _C424 G _C425 G _C426 G _C427 G _C428 G _C429 G _C43 G _C430 G _C431 G _C432 G _C433 G _C434 G _C435 G _C436 G _C437 G _C438 G _C439 G _C44 G _C440 G _C441 G _C442 G _C443 G _C444 G _C445 G _C446 G _C447 G _C448 G _C449 G _C45 G _C450 G _C451 G _C452 G _C453 G _C454 G _C455 G _C456 G _C457 G _C458 G _C459 G _C46 G _C460 G _C461 G _C462 G _C463 G _C464 G _C465 G _C466 G _C467 G _C468 G _C469 G _C47 G _C470 G _C471 G _C472 G _C473 G _C474 G _C475 G _C476 G _C477 G _C478 G _C479 G _C48 G _C480 G _C481 G _C482 G _C483 G _C484 G _C485 G _C486 G _C487 G _C488 G _C489 G _C49 G _C490 G _C491 G _C492 G _C493 G _C494 G _C495 G _C496 G _C497 G _C498 G _C499 G _C5 G _C50 G _C500 G _C501 G _C502 G _C503 G _C504 G _C505 G _C506 G _C507 G _C508 G _C509 G _C51 G _C510 G _C511 G _C512 G _C513 G _C514 G _C515 G _C516 G _C517 G _C518 G _C519 G _C52 G _C520 G _C521 G _C522 G _C523 G _C524 G _C525 G _C526 G _C527 G _C528 G _C529 G _C53 G _C530 G _C531 G _C532 G _C533 G _C534 G _C535 G _C536 G _C537 G _C538 G _C539 G _C54 G _C540 G _C541 G _C542 G _C543 G _C544 G _C545 G _C546 G _C547 G _C548 G _C549 G _C55 G _C550 G _C551 G _C552 G _C553 G _C554 G _C555 G _C556 G _C557 G _C558 G _C559 G _C56 G _C560 G _C561 G _C562 G _C563 G _C564 G _C565 G _C566 G _C567 G _C568 G _C569 G _C57 G _C570 G _C571 G _C572 G _C573 G _C574 G _C575 G _C576 G _C577 G _C578 G _C579 G _C58 G _C580 G _C581 G _C582 G _C583 G _C584 G _C585 G _C586 G _C587 G _C588 G _C589 G _C59 G _C590 G _C591 G _C592 G _C593 G _C594 G _C595 G _C596 G _C597 G _C598 G _C599 G _C6 G _C60 G _C600 G _C61 G _C62 G _C63 G _C64 G _C65 G _C66 G _C67 G _C68 G _C69 G _C7 G _C70 G _C71 G _C72 G _C73 G _C74 G _C75 G _C76 G _C77 G _C78 G _C79 G _C8 G _C80 G _C81 G _C82 G _C83 G _C84 G _C85 G _C86 G _C87 G _C88 G _C89 G _C9 G _C90 G _C91 G _C92 G _C93 G _C94 G _C95 G _C96 G _C97 G _C98 G _C99 COLUMNS table_happiness_0 OBJ 1 table_happiness_0 _C1 1 table_happiness_0 _C10 1 table_happiness_0 _C100 1 table_happiness_0 _C101 1 table_happiness_0 _C102 1 table_happiness_0 _C103 1 table_happiness_0 _C104 1 table_happiness_0 _C105 1 table_happiness_0 _C106 1 table_happiness_0 _C107 1 table_happiness_0 _C108 1 table_happiness_0 _C109 1 table_happiness_0 _C11 1 table_happiness_0 _C110 1 table_happiness_0 _C111 1 table_happiness_0 _C112 1 table_happiness_0 _C113 1 table_happiness_0 _C114 1 table_happiness_0 _C115 1 table_happiness_0 _C116 1 table_happiness_0 _C117 1 table_happiness_0 _C118 1 table_happiness_0 _C119 1 table_happiness_0 _C12 1 table_happiness_0 _C120 1 table_happiness_0 _C13 1 table_happiness_0 _C14 1 table_happiness_0 _C15 1 table_happiness_0 _C16 1 table_happiness_0 _C17 1 table_happiness_0 _C18 1 table_happiness_0 _C19 1 table_happiness_0 _C2 1 table_happiness_0 _C20 1 table_happiness_0 _C21 1 table_happiness_0 _C22 1 table_happiness_0 _C23 1 table_happiness_0 _C24 1 table_happiness_0 _C25 1 table_happiness_0 _C26 1 table_happiness_0 _C27 1 table_happiness_0 _C28 1 table_happiness_0 _C29 1 table_happiness_0 _C3 1 table_happiness_0 _C30 1 table_happiness_0 _C31 1 table_happiness_0 _C32 1 table_happiness_0 _C33 1 table_happiness_0 _C34 1 table_happiness_0 _C35 1 table_happiness_0 _C36 1 table_happiness_0 _C37 1 table_happiness_0 _C38 1 table_happiness_0 _C39 1 table_happiness_0 _C4 1 table_happiness_0 _C40 1 table_happiness_0 _C41 1 table_happiness_0 _C42 1 table_happiness_0 _C43 1 table_happiness_0 _C44 1 table_happiness_0 _C45 1 table_happiness_0 _C46 1 table_happiness_0 _C47 1 table_happiness_0 _C48 1 table_happiness_0 _C49 1 table_happiness_0 _C5 1 table_happiness_0 _C50 1 table_happiness_0 _C51 1 table_happiness_0 _C52 1 table_happiness_0 _C53 1 table_happiness_0 _C54 1 table_happiness_0 _C55 1 table_happiness_0 _C56 1 table_happiness_0 _C57 1 table_happiness_0 _C58 1 table_happiness_0 _C59 1 table_happiness_0 _C6 1 table_happiness_0 _C60 1 table_happiness_0 _C61 1 table_happiness_0 _C62 1 table_happiness_0 _C63 1 table_happiness_0 _C64 1 table_happiness_0 _C65 1 table_happiness_0 _C66 1 table_happiness_0 _C67 1 table_happiness_0 _C68 1 table_happiness_0 _C69 1 table_happiness_0 _C7 1 table_happiness_0 _C70 1 table_happiness_0 _C71 1 table_happiness_0 _C72 1 table_happiness_0 _C73 1 table_happiness_0 _C74 1 table_happiness_0 _C75 1 table_happiness_0 _C76 1 table_happiness_0 _C77 1 table_happiness_0 _C78 1 table_happiness_0 _C79 1 table_happiness_0 _C8 1 table_happiness_0 _C80 1 table_happiness_0 _C81 1 table_happiness_0 _C82 1 table_happiness_0 _C83 1 table_happiness_0 _C84 1 table_happiness_0 _C85 1 table_happiness_0 _C86 1 table_happiness_0 _C87 1 table_happiness_0 _C88 1 table_happiness_0 _C89 1 table_happiness_0 _C9 1 table_happiness_0 _C90 1 table_happiness_0 _C91 1 table_happiness_0 _C92 1 table_happiness_0 _C93 1 table_happiness_0 _C94 1 table_happiness_0 _C95 1 table_happiness_0 _C96 1 table_happiness_0 _C97 1 table_happiness_0 _C98 1 table_happiness_0 _C99 1 table_happiness_1 OBJ 1 table_happiness_1 _C121 1 table_happiness_1 _C122 1 table_happiness_1 _C123 1 table_happiness_1 _C124 1 table_happiness_1 _C125 1 table_happiness_1 _C126 1 table_happiness_1 _C127 1 table_happiness_1 _C128 1 table_happiness_1 _C129 1 table_happiness_1 _C130 1 table_happiness_1 _C131 1 table_happiness_1 _C132 1 table_happiness_1 _C133 1 table_happiness_1 _C134 1 table_happiness_1 _C135 1 table_happiness_1 _C136 1 table_happiness_1 _C137 1 table_happiness_1 _C138 1 table_happiness_1 _C139 1 table_happiness_1 _C140 1 table_happiness_1 _C141 1 table_happiness_1 _C142 1 table_happiness_1 _C143 1 table_happiness_1 _C144 1 table_happiness_1 _C145 1 table_happiness_1 _C146 1 table_happiness_1 _C147 1 table_happiness_1 _C148 1 table_happiness_1 _C149 1 table_happiness_1 _C150 1 table_happiness_1 _C151 1 table_happiness_1 _C152 1 table_happiness_1 _C153 1 table_happiness_1 _C154 1 table_happiness_1 _C155 1 table_happiness_1 _C156 1 table_happiness_1 _C157 1 table_happiness_1 _C158 1 table_happiness_1 _C159 1 table_happiness_1 _C160 1 table_happiness_1 _C161 1 table_happiness_1 _C162 1 table_happiness_1 _C163 1 table_happiness_1 _C164 1 table_happiness_1 _C165 1 table_happiness_1 _C166 1 table_happiness_1 _C167 1 table_happiness_1 _C168 1 table_happiness_1 _C169 1 table_happiness_1 _C170 1 table_happiness_1 _C171 1 table_happiness_1 _C172 1 table_happiness_1 _C173 1 table_happiness_1 _C174 1 table_happiness_1 _C175 1 table_happiness_1 _C176 1 table_happiness_1 _C177 1 table_happiness_1 _C178 1 table_happiness_1 _C179 1 table_happiness_1 _C180 1 table_happiness_1 _C181 1 table_happiness_1 _C182 1 table_happiness_1 _C183 1 table_happiness_1 _C184 1 table_happiness_1 _C185 1 table_happiness_1 _C186 1 table_happiness_1 _C187 1 table_happiness_1 _C188 1 table_happiness_1 _C189 1 table_happiness_1 _C190 1 table_happiness_1 _C191 1 table_happiness_1 _C192 1 table_happiness_1 _C193 1 table_happiness_1 _C194 1 table_happiness_1 _C195 1 table_happiness_1 _C196 1 table_happiness_1 _C197 1 table_happiness_1 _C198 1 table_happiness_1 _C199 1 table_happiness_1 _C200 1 table_happiness_1 _C201 1 table_happiness_1 _C202 1 table_happiness_1 _C203 1 table_happiness_1 _C204 1 table_happiness_1 _C205 1 table_happiness_1 _C206 1 table_happiness_1 _C207 1 table_happiness_1 _C208 1 table_happiness_1 _C209 1 table_happiness_1 _C210 1 table_happiness_1 _C211 1 table_happiness_1 _C212 1 table_happiness_1 _C213 1 table_happiness_1 _C214 1 table_happiness_1 _C215 1 table_happiness_1 _C216 1 table_happiness_1 _C217 1 table_happiness_1 _C218 1 table_happiness_1 _C219 1 table_happiness_1 _C220 1 table_happiness_1 _C221 1 table_happiness_1 _C222 1 table_happiness_1 _C223 1 table_happiness_1 _C224 1 table_happiness_1 _C225 1 table_happiness_1 _C226 1 table_happiness_1 _C227 1 table_happiness_1 _C228 1 table_happiness_1 _C229 1 table_happiness_1 _C230 1 table_happiness_1 _C231 1 table_happiness_1 _C232 1 table_happiness_1 _C233 1 table_happiness_1 _C234 1 table_happiness_1 _C235 1 table_happiness_1 _C236 1 table_happiness_1 _C237 1 table_happiness_1 _C238 1 table_happiness_1 _C239 1 table_happiness_1 _C240 1 table_happiness_2 OBJ 1 table_happiness_2 _C241 1 table_happiness_2 _C242 1 table_happiness_2 _C243 1 table_happiness_2 _C244 1 table_happiness_2 _C245 1 table_happiness_2 _C246 1 table_happiness_2 _C247 1 table_happiness_2 _C248 1 table_happiness_2 _C249 1 table_happiness_2 _C250 1 table_happiness_2 _C251 1 table_happiness_2 _C252 1 table_happiness_2 _C253 1 table_happiness_2 _C254 1 table_happiness_2 _C255 1 table_happiness_2 _C256 1 table_happiness_2 _C257 1 table_happiness_2 _C258 1 table_happiness_2 _C259 1 table_happiness_2 _C260 1 table_happiness_2 _C261 1 table_happiness_2 _C262 1 table_happiness_2 _C263 1 table_happiness_2 _C264 1 table_happiness_2 _C265 1 table_happiness_2 _C266 1 table_happiness_2 _C267 1 table_happiness_2 _C268 1 table_happiness_2 _C269 1 table_happiness_2 _C270 1 table_happiness_2 _C271 1 table_happiness_2 _C272 1 table_happiness_2 _C273 1 table_happiness_2 _C274 1 table_happiness_2 _C275 1 table_happiness_2 _C276 1 table_happiness_2 _C277 1 table_happiness_2 _C278 1 table_happiness_2 _C279 1 table_happiness_2 _C280 1 table_happiness_2 _C281 1 table_happiness_2 _C282 1 table_happiness_2 _C283 1 table_happiness_2 _C284 1 table_happiness_2 _C285 1 table_happiness_2 _C286 1 table_happiness_2 _C287 1 table_happiness_2 _C288 1 table_happiness_2 _C289 1 table_happiness_2 _C290 1 table_happiness_2 _C291 1 table_happiness_2 _C292 1 table_happiness_2 _C293 1 table_happiness_2 _C294 1 table_happiness_2 _C295 1 table_happiness_2 _C296 1 table_happiness_2 _C297 1 table_happiness_2 _C298 1 table_happiness_2 _C299 1 table_happiness_2 _C300 1 table_happiness_2 _C301 1 table_happiness_2 _C302 1 table_happiness_2 _C303 1 table_happiness_2 _C304 1 table_happiness_2 _C305 1 table_happiness_2 _C306 1 table_happiness_2 _C307 1 table_happiness_2 _C308 1 table_happiness_2 _C309 1 table_happiness_2 _C310 1 table_happiness_2 _C311 1 table_happiness_2 _C312 1 table_happiness_2 _C313 1 table_happiness_2 _C314 1 table_happiness_2 _C315 1 table_happiness_2 _C316 1 table_happiness_2 _C317 1 table_happiness_2 _C318 1 table_happiness_2 _C319 1 table_happiness_2 _C320 1 table_happiness_2 _C321 1 table_happiness_2 _C322 1 table_happiness_2 _C323 1 table_happiness_2 _C324 1 table_happiness_2 _C325 1 table_happiness_2 _C326 1 table_happiness_2 _C327 1 table_happiness_2 _C328 1 table_happiness_2 _C329 1 table_happiness_2 _C330 1 table_happiness_2 _C331 1 table_happiness_2 _C332 1 table_happiness_2 _C333 1 table_happiness_2 _C334 1 table_happiness_2 _C335 1 table_happiness_2 _C336 1 table_happiness_2 _C337 1 table_happiness_2 _C338 1 table_happiness_2 _C339 1 table_happiness_2 _C340 1 table_happiness_2 _C341 1 table_happiness_2 _C342 1 table_happiness_2 _C343 1 table_happiness_2 _C344 1 table_happiness_2 _C345 1 table_happiness_2 _C346 1 table_happiness_2 _C347 1 table_happiness_2 _C348 1 table_happiness_2 _C349 1 table_happiness_2 _C350 1 table_happiness_2 _C351 1 table_happiness_2 _C352 1 table_happiness_2 _C353 1 table_happiness_2 _C354 1 table_happiness_2 _C355 1 table_happiness_2 _C356 1 table_happiness_2 _C357 1 table_happiness_2 _C358 1 table_happiness_2 _C359 1 table_happiness_2 _C360 1 table_happiness_3 OBJ 1 table_happiness_3 _C361 1 table_happiness_3 _C362 1 table_happiness_3 _C363 1 table_happiness_3 _C364 1 table_happiness_3 _C365 1 table_happiness_3 _C366 1 table_happiness_3 _C367 1 table_happiness_3 _C368 1 table_happiness_3 _C369 1 table_happiness_3 _C370 1 table_happiness_3 _C371 1 table_happiness_3 _C372 1 table_happiness_3 _C373 1 table_happiness_3 _C374 1 table_happiness_3 _C375 1 table_happiness_3 _C376 1 table_happiness_3 _C377 1 table_happiness_3 _C378 1 table_happiness_3 _C379 1 table_happiness_3 _C380 1 table_happiness_3 _C381 1 table_happiness_3 _C382 1 table_happiness_3 _C383 1 table_happiness_3 _C384 1 table_happiness_3 _C385 1 table_happiness_3 _C386 1 table_happiness_3 _C387 1 table_happiness_3 _C388 1 table_happiness_3 _C389 1 table_happiness_3 _C390 1 table_happiness_3 _C391 1 table_happiness_3 _C392 1 table_happiness_3 _C393 1 table_happiness_3 _C394 1 table_happiness_3 _C395 1 table_happiness_3 _C396 1 table_happiness_3 _C397 1 table_happiness_3 _C398 1 table_happiness_3 _C399 1 table_happiness_3 _C400 1 table_happiness_3 _C401 1 table_happiness_3 _C402 1 table_happiness_3 _C403 1 table_happiness_3 _C404 1 table_happiness_3 _C405 1 table_happiness_3 _C406 1 table_happiness_3 _C407 1 table_happiness_3 _C408 1 table_happiness_3 _C409 1 table_happiness_3 _C410 1 table_happiness_3 _C411 1 table_happiness_3 _C412 1 table_happiness_3 _C413 1 table_happiness_3 _C414 1 table_happiness_3 _C415 1 table_happiness_3 _C416 1 table_happiness_3 _C417 1 table_happiness_3 _C418 1 table_happiness_3 _C419 1 table_happiness_3 _C420 1 table_happiness_3 _C421 1 table_happiness_3 _C422 1 table_happiness_3 _C423 1 table_happiness_3 _C424 1 table_happiness_3 _C425 1 table_happiness_3 _C426 1 table_happiness_3 _C427 1 table_happiness_3 _C428 1 table_happiness_3 _C429 1 table_happiness_3 _C430 1 table_happiness_3 _C431 1 table_happiness_3 _C432 1 table_happiness_3 _C433 1 table_happiness_3 _C434 1 table_happiness_3 _C435 1 table_happiness_3 _C436 1 table_happiness_3 _C437 1 table_happiness_3 _C438 1 table_happiness_3 _C439 1 table_happiness_3 _C440 1 table_happiness_3 _C441 1 table_happiness_3 _C442 1 table_happiness_3 _C443 1 table_happiness_3 _C444 1 table_happiness_3 _C445 1 table_happiness_3 _C446 1 table_happiness_3 _C447 1 table_happiness_3 _C448 1 table_happiness_3 _C449 1 table_happiness_3 _C450 1 table_happiness_3 _C451 1 table_happiness_3 _C452 1 table_happiness_3 _C453 1 table_happiness_3 _C454 1 table_happiness_3 _C455 1 table_happiness_3 _C456 1 table_happiness_3 _C457 1 table_happiness_3 _C458 1 table_happiness_3 _C459 1 table_happiness_3 _C460 1 table_happiness_3 _C461 1 table_happiness_3 _C462 1 table_happiness_3 _C463 1 table_happiness_3 _C464 1 table_happiness_3 _C465 1 table_happiness_3 _C466 1 table_happiness_3 _C467 1 table_happiness_3 _C468 1 table_happiness_3 _C469 1 table_happiness_3 _C470 1 table_happiness_3 _C471 1 table_happiness_3 _C472 1 table_happiness_3 _C473 1 table_happiness_3 _C474 1 table_happiness_3 _C475 1 table_happiness_3 _C476 1 table_happiness_3 _C477 1 table_happiness_3 _C478 1 table_happiness_3 _C479 1 table_happiness_3 _C480 1 table_happiness_4 OBJ 1 table_happiness_4 _C481 1 table_happiness_4 _C482 1 table_happiness_4 _C483 1 table_happiness_4 _C484 1 table_happiness_4 _C485 1 table_happiness_4 _C486 1 table_happiness_4 _C487 1 table_happiness_4 _C488 1 table_happiness_4 _C489 1 table_happiness_4 _C490 1 table_happiness_4 _C491 1 table_happiness_4 _C492 1 table_happiness_4 _C493 1 table_happiness_4 _C494 1 table_happiness_4 _C495 1 table_happiness_4 _C496 1 table_happiness_4 _C497 1 table_happiness_4 _C498 1 table_happiness_4 _C499 1 table_happiness_4 _C500 1 table_happiness_4 _C501 1 table_happiness_4 _C502 1 table_happiness_4 _C503 1 table_happiness_4 _C504 1 table_happiness_4 _C505 1 table_happiness_4 _C506 1 table_happiness_4 _C507 1 table_happiness_4 _C508 1 table_happiness_4 _C509 1 table_happiness_4 _C510 1 table_happiness_4 _C511 1 table_happiness_4 _C512 1 table_happiness_4 _C513 1 table_happiness_4 _C514 1 table_happiness_4 _C515 1 table_happiness_4 _C516 1 table_happiness_4 _C517 1 table_happiness_4 _C518 1 table_happiness_4 _C519 1 table_happiness_4 _C520 1 table_happiness_4 _C521 1 table_happiness_4 _C522 1 table_happiness_4 _C523 1 table_happiness_4 _C524 1 table_happiness_4 _C525 1 table_happiness_4 _C526 1 table_happiness_4 _C527 1 table_happiness_4 _C528 1 table_happiness_4 _C529 1 table_happiness_4 _C530 1 table_happiness_4 _C531 1 table_happiness_4 _C532 1 table_happiness_4 _C533 1 table_happiness_4 _C534 1 table_happiness_4 _C535 1 table_happiness_4 _C536 1 table_happiness_4 _C537 1 table_happiness_4 _C538 1 table_happiness_4 _C539 1 table_happiness_4 _C540 1 table_happiness_4 _C541 1 table_happiness_4 _C542 1 table_happiness_4 _C543 1 table_happiness_4 _C544 1 table_happiness_4 _C545 1 table_happiness_4 _C546 1 table_happiness_4 _C547 1 table_happiness_4 _C548 1 table_happiness_4 _C549 1 table_happiness_4 _C550 1 table_happiness_4 _C551 1 table_happiness_4 _C552 1 table_happiness_4 _C553 1 table_happiness_4 _C554 1 table_happiness_4 _C555 1 table_happiness_4 _C556 1 table_happiness_4 _C557 1 table_happiness_4 _C558 1 table_happiness_4 _C559 1 table_happiness_4 _C560 1 table_happiness_4 _C561 1 table_happiness_4 _C562 1 table_happiness_4 _C563 1 table_happiness_4 _C564 1 table_happiness_4 _C565 1 table_happiness_4 _C566 1 table_happiness_4 _C567 1 table_happiness_4 _C568 1 table_happiness_4 _C569 1 table_happiness_4 _C570 1 table_happiness_4 _C571 1 table_happiness_4 _C572 1 table_happiness_4 _C573 1 table_happiness_4 _C574 1 table_happiness_4 _C575 1 table_happiness_4 _C576 1 table_happiness_4 _C577 1 table_happiness_4 _C578 1 table_happiness_4 _C579 1 table_happiness_4 _C580 1 table_happiness_4 _C581 1 table_happiness_4 _C582 1 table_happiness_4 _C583 1 table_happiness_4 _C584 1 table_happiness_4 _C585 1 table_happiness_4 _C586 1 table_happiness_4 _C587 1 table_happiness_4 _C588 1 table_happiness_4 _C589 1 table_happiness_4 _C590 1 table_happiness_4 _C591 1 table_happiness_4 _C592 1 table_happiness_4 _C593 1 table_happiness_4 _C594 1 table_happiness_4 _C595 1 table_happiness_4 _C596 1 table_happiness_4 _C597 1 table_happiness_4 _C598 1 table_happiness_4 _C599 1 table_happiness_4 _C600 1 MARK0000 'MARKER' 'INTORG' possible_seatings_('A',_0) Maximum_table_size_0 1 possible_seatings_('A',_0) Must_seat_A 1 possible_seatings_('A',_0) _C1 -1 possible_seatings_('A',_0) _C10 -10 possible_seatings_('A',_0) _C11 -11 possible_seatings_('A',_0) _C12 -12 possible_seatings_('A',_0) _C13 -13 possible_seatings_('A',_0) _C14 -14 possible_seatings_('A',_0) _C15 -15 possible_seatings_('A',_0) _C2 -2 possible_seatings_('A',_0) _C3 -3 possible_seatings_('A',_0) _C4 -4 possible_seatings_('A',_0) _C5 -5 possible_seatings_('A',_0) _C6 -6 possible_seatings_('A',_0) _C7 -7 possible_seatings_('A',_0) _C8 -8 possible_seatings_('A',_0) _C9 -9 possible_seatings_('B',_0) Maximum_table_size_0 1 possible_seatings_('B',_0) Must_seat_B 1 possible_seatings_('B',_0) _C1 -1 possible_seatings_('B',_0) _C16 -1 possible_seatings_('B',_0) _C17 -2 possible_seatings_('B',_0) _C18 -3 possible_seatings_('B',_0) _C19 -4 possible_seatings_('B',_0) _C20 -5 possible_seatings_('B',_0) _C21 -6 possible_seatings_('B',_0) _C22 -7 possible_seatings_('B',_0) _C23 -8 possible_seatings_('B',_0) _C24 -9 possible_seatings_('B',_0) _C25 -10 possible_seatings_('B',_0) _C26 -11 possible_seatings_('B',_0) _C27 -12 possible_seatings_('B',_0) _C28 -13 possible_seatings_('B',_0) _C29 -14 possible_seatings_('C',_0) Maximum_table_size_0 1 possible_seatings_('C',_0) Must_seat_C 1 possible_seatings_('C',_0) _C16 -1 possible_seatings_('C',_0) _C2 -2 possible_seatings_('C',_0) _C30 -1 possible_seatings_('C',_0) _C31 -2 possible_seatings_('C',_0) _C32 -3 possible_seatings_('C',_0) _C33 -4 possible_seatings_('C',_0) _C34 -5 possible_seatings_('C',_0) _C35 -6 possible_seatings_('C',_0) _C36 -7 possible_seatings_('C',_0) _C37 -8 possible_seatings_('C',_0) _C38 -9 possible_seatings_('C',_0) _C39 -10 possible_seatings_('C',_0) _C40 -11 possible_seatings_('C',_0) _C41 -12 possible_seatings_('C',_0) _C42 -13 possible_seatings_('D',_0) Maximum_table_size_0 1 possible_seatings_('D',_0) Must_seat_D 1 possible_seatings_('D',_0) _C17 -2 possible_seatings_('D',_0) _C3 -3 possible_seatings_('D',_0) _C30 -1 possible_seatings_('D',_0) _C43 -1 possible_seatings_('D',_0) _C44 -2 possible_seatings_('D',_0) _C45 -3 possible_seatings_('D',_0) _C46 -4 possible_seatings_('D',_0) _C47 -5 possible_seatings_('D',_0) _C48 -6 possible_seatings_('D',_0) _C49 -7 possible_seatings_('D',_0) _C50 -8 possible_seatings_('D',_0) _C51 -9 possible_seatings_('D',_0) _C52 -10 possible_seatings_('D',_0) _C53 -11 possible_seatings_('D',_0) _C54 -12 possible_seatings_('E',_0) Maximum_table_size_0 1 possible_seatings_('E',_0) Must_seat_E 1 possible_seatings_('E',_0) _C18 -3 possible_seatings_('E',_0) _C31 -2 possible_seatings_('E',_0) _C4 -4 possible_seatings_('E',_0) _C43 -1 possible_seatings_('E',_0) _C55 -1 possible_seatings_('E',_0) _C56 -2 possible_seatings_('E',_0) _C57 -3 possible_seatings_('E',_0) _C58 -4 possible_seatings_('E',_0) _C59 -5 possible_seatings_('E',_0) _C60 -6 possible_seatings_('E',_0) _C61 -7 possible_seatings_('E',_0) _C62 -8 possible_seatings_('E',_0) _C63 -9 possible_seatings_('E',_0) _C64 -10 possible_seatings_('E',_0) _C65 -11 possible_seatings_('F',_0) Maximum_table_size_0 1 possible_seatings_('F',_0) Must_seat_F 1 possible_seatings_('F',_0) _C19 -4 possible_seatings_('F',_0) _C32 -3 possible_seatings_('F',_0) _C44 -2 possible_seatings_('F',_0) _C5 -5 possible_seatings_('F',_0) _C55 -1 possible_seatings_('F',_0) _C66 -1 possible_seatings_('F',_0) _C67 -2 possible_seatings_('F',_0) _C68 -3 possible_seatings_('F',_0) _C69 -4 possible_seatings_('F',_0) _C70 -5 possible_seatings_('F',_0) _C71 -6 possible_seatings_('F',_0) _C72 -7 possible_seatings_('F',_0) _C73 -8 possible_seatings_('F',_0) _C74 -9 possible_seatings_('F',_0) _C75 -10 possible_seatings_('G',_0) Maximum_table_size_0 1 possible_seatings_('G',_0) Must_seat_G 1 possible_seatings_('G',_0) _C20 -5 possible_seatings_('G',_0) _C33 -4 possible_seatings_('G',_0) _C45 -3 possible_seatings_('G',_0) _C56 -2 possible_seatings_('G',_0) _C6 -6 possible_seatings_('G',_0) _C66 -1 possible_seatings_('G',_0) _C76 -1 possible_seatings_('G',_0) _C77 -2 possible_seatings_('G',_0) _C78 -3 possible_seatings_('G',_0) _C79 -4 possible_seatings_('G',_0) _C80 -5 possible_seatings_('G',_0) _C81 -6 possible_seatings_('G',_0) _C82 -7 possible_seatings_('G',_0) _C83 -8 possible_seatings_('G',_0) _C84 -9 possible_seatings_('H',_0) Maximum_table_size_0 1 possible_seatings_('H',_0) Must_seat_H 1 possible_seatings_('H',_0) _C21 -6 possible_seatings_('H',_0) _C34 -5 possible_seatings_('H',_0) _C46 -4 possible_seatings_('H',_0) _C57 -3 possible_seatings_('H',_0) _C67 -2 possible_seatings_('H',_0) _C7 -7 possible_seatings_('H',_0) _C76 -1 possible_seatings_('H',_0) _C85 -1 possible_seatings_('H',_0) _C86 -2 possible_seatings_('H',_0) _C87 -3 possible_seatings_('H',_0) _C88 -4 possible_seatings_('H',_0) _C89 -5 possible_seatings_('H',_0) _C90 -6 possible_seatings_('H',_0) _C91 -7 possible_seatings_('H',_0) _C92 -8 possible_seatings_('I',_0) Maximum_table_size_0 1 possible_seatings_('I',_0) Must_seat_I 1 possible_seatings_('I',_0) _C22 -7 possible_seatings_('I',_0) _C35 -6 possible_seatings_('I',_0) _C47 -5 possible_seatings_('I',_0) _C58 -4 possible_seatings_('I',_0) _C68 -3 possible_seatings_('I',_0) _C77 -2 possible_seatings_('I',_0) _C8 -8 possible_seatings_('I',_0) _C85 -1 possible_seatings_('I',_0) _C93 -1 possible_seatings_('I',_0) _C94 -2 possible_seatings_('I',_0) _C95 -3 possible_seatings_('I',_0) _C96 -4 possible_seatings_('I',_0) _C97 -5 possible_seatings_('I',_0) _C98 -6 possible_seatings_('I',_0) _C99 -7 possible_seatings_('J',_0) Maximum_table_size_0 1 possible_seatings_('J',_0) Must_seat_J 1 possible_seatings_('J',_0) _C100 -1 possible_seatings_('J',_0) _C101 -2 possible_seatings_('J',_0) _C102 -3 possible_seatings_('J',_0) _C103 -4 possible_seatings_('J',_0) _C104 -5 possible_seatings_('J',_0) _C105 -6 possible_seatings_('J',_0) _C23 -8 possible_seatings_('J',_0) _C36 -7 possible_seatings_('J',_0) _C48 -6 possible_seatings_('J',_0) _C59 -5 possible_seatings_('J',_0) _C69 -4 possible_seatings_('J',_0) _C78 -3 possible_seatings_('J',_0) _C86 -2 possible_seatings_('J',_0) _C9 -9 possible_seatings_('J',_0) _C93 -1 possible_seatings_('K',_0) Maximum_table_size_0 1 possible_seatings_('K',_0) Must_seat_K 1 possible_seatings_('K',_0) _C10 -10 possible_seatings_('K',_0) _C100 -1 possible_seatings_('K',_0) _C106 -1 possible_seatings_('K',_0) _C107 -2 possible_seatings_('K',_0) _C108 -3 possible_seatings_('K',_0) _C109 -4 possible_seatings_('K',_0) _C110 -5 possible_seatings_('K',_0) _C24 -9 possible_seatings_('K',_0) _C37 -8 possible_seatings_('K',_0) _C49 -7 possible_seatings_('K',_0) _C60 -6 possible_seatings_('K',_0) _C70 -5 possible_seatings_('K',_0) _C79 -4 possible_seatings_('K',_0) _C87 -3 possible_seatings_('K',_0) _C94 -2 possible_seatings_('L',_0) Maximum_table_size_0 1 possible_seatings_('L',_0) Must_seat_L 1 possible_seatings_('L',_0) _C101 -2 possible_seatings_('L',_0) _C106 -1 possible_seatings_('L',_0) _C11 -11 possible_seatings_('L',_0) _C111 -1 possible_seatings_('L',_0) _C112 -2 possible_seatings_('L',_0) _C113 -3 possible_seatings_('L',_0) _C114 -4 possible_seatings_('L',_0) _C25 -10 possible_seatings_('L',_0) _C38 -9 possible_seatings_('L',_0) _C50 -8 possible_seatings_('L',_0) _C61 -7 possible_seatings_('L',_0) _C71 -6 possible_seatings_('L',_0) _C80 -5 possible_seatings_('L',_0) _C88 -4 possible_seatings_('L',_0) _C95 -3 possible_seatings_('M',_0) Maximum_table_size_0 1 possible_seatings_('M',_0) Must_seat_M 1 possible_seatings_('M',_0) _C102 -3 possible_seatings_('M',_0) _C107 -2 possible_seatings_('M',_0) _C111 -1 possible_seatings_('M',_0) _C115 -1 possible_seatings_('M',_0) _C116 -2 possible_seatings_('M',_0) _C117 -3 possible_seatings_('M',_0) _C12 -12 possible_seatings_('M',_0) _C26 -11 possible_seatings_('M',_0) _C39 -10 possible_seatings_('M',_0) _C51 -9 possible_seatings_('M',_0) _C62 -8 possible_seatings_('M',_0) _C72 -7 possible_seatings_('M',_0) _C81 -6 possible_seatings_('M',_0) _C89 -5 possible_seatings_('M',_0) _C96 -4 possible_seatings_('N',_0) Maximum_table_size_0 1 possible_seatings_('N',_0) Must_seat_N 1 possible_seatings_('N',_0) _C103 -4 possible_seatings_('N',_0) _C108 -3 possible_seatings_('N',_0) _C112 -2 possible_seatings_('N',_0) _C115 -1 possible_seatings_('N',_0) _C118 -1 possible_seatings_('N',_0) _C119 -2 possible_seatings_('N',_0) _C13 -13 possible_seatings_('N',_0) _C27 -12 possible_seatings_('N',_0) _C40 -11 possible_seatings_('N',_0) _C52 -10 possible_seatings_('N',_0) _C63 -9 possible_seatings_('N',_0) _C73 -8 possible_seatings_('N',_0) _C82 -7 possible_seatings_('N',_0) _C90 -6 possible_seatings_('N',_0) _C97 -5 possible_seatings_('O',_0) Maximum_table_size_0 1 possible_seatings_('O',_0) Must_seat_O 1 possible_seatings_('O',_0) _C104 -5 possible_seatings_('O',_0) _C109 -4 possible_seatings_('O',_0) _C113 -3 possible_seatings_('O',_0) _C116 -2 possible_seatings_('O',_0) _C118 -1 possible_seatings_('O',_0) _C120 -1 possible_seatings_('O',_0) _C14 -14 possible_seatings_('O',_0) _C28 -13 possible_seatings_('O',_0) _C41 -12 possible_seatings_('O',_0) _C53 -11 possible_seatings_('O',_0) _C64 -10 possible_seatings_('O',_0) _C74 -9 possible_seatings_('O',_0) _C83 -8 possible_seatings_('O',_0) _C91 -7 possible_seatings_('O',_0) _C98 -6 possible_seatings_('P',_0) Maximum_table_size_0 1 possible_seatings_('P',_0) Must_seat_P 1 possible_seatings_('P',_0) _C105 -6 possible_seatings_('P',_0) _C110 -5 possible_seatings_('P',_0) _C114 -4 possible_seatings_('P',_0) _C117 -3 possible_seatings_('P',_0) _C119 -2 possible_seatings_('P',_0) _C120 -1 possible_seatings_('P',_0) _C15 -15 possible_seatings_('P',_0) _C29 -14 possible_seatings_('P',_0) _C42 -13 possible_seatings_('P',_0) _C54 -12 possible_seatings_('P',_0) _C65 -11 possible_seatings_('P',_0) _C75 -10 possible_seatings_('P',_0) _C84 -9 possible_seatings_('P',_0) _C92 -8 possible_seatings_('P',_0) _C99 -7 possible_seatings_('A',_1) Maximum_table_size_1 1 possible_seatings_('A',_1) Must_seat_A 1 possible_seatings_('A',_1) _C121 -1 possible_seatings_('A',_1) _C122 -2 possible_seatings_('A',_1) _C123 -3 possible_seatings_('A',_1) _C124 -4 possible_seatings_('A',_1) _C125 -5 possible_seatings_('A',_1) _C126 -6 possible_seatings_('A',_1) _C127 -7 possible_seatings_('A',_1) _C128 -8 possible_seatings_('A',_1) _C129 -9 possible_seatings_('A',_1) _C130 -10 possible_seatings_('A',_1) _C131 -11 possible_seatings_('A',_1) _C132 -12 possible_seatings_('A',_1) _C133 -13 possible_seatings_('A',_1) _C134 -14 possible_seatings_('A',_1) _C135 -15 possible_seatings_('B',_1) Maximum_table_size_1 1 possible_seatings_('B',_1) Must_seat_B 1 possible_seatings_('B',_1) _C121 -1 possible_seatings_('B',_1) _C136 -1 possible_seatings_('B',_1) _C137 -2 possible_seatings_('B',_1) _C138 -3 possible_seatings_('B',_1) _C139 -4 possible_seatings_('B',_1) _C140 -5 possible_seatings_('B',_1) _C141 -6 possible_seatings_('B',_1) _C142 -7 possible_seatings_('B',_1) _C143 -8 possible_seatings_('B',_1) _C144 -9 possible_seatings_('B',_1) _C145 -10 possible_seatings_('B',_1) _C146 -11 possible_seatings_('B',_1) _C147 -12 possible_seatings_('B',_1) _C148 -13 possible_seatings_('B',_1) _C149 -14 possible_seatings_('C',_1) Maximum_table_size_1 1 possible_seatings_('C',_1) Must_seat_C 1 possible_seatings_('C',_1) _C122 -2 possible_seatings_('C',_1) _C136 -1 possible_seatings_('C',_1) _C150 -1 possible_seatings_('C',_1) _C151 -2 possible_seatings_('C',_1) _C152 -3 possible_seatings_('C',_1) _C153 -4 possible_seatings_('C',_1) _C154 -5 possible_seatings_('C',_1) _C155 -6 possible_seatings_('C',_1) _C156 -7 possible_seatings_('C',_1) _C157 -8 possible_seatings_('C',_1) _C158 -9 possible_seatings_('C',_1) _C159 -10 possible_seatings_('C',_1) _C160 -11 possible_seatings_('C',_1) _C161 -12 possible_seatings_('C',_1) _C162 -13 possible_seatings_('D',_1) Maximum_table_size_1 1 possible_seatings_('D',_1) Must_seat_D 1 possible_seatings_('D',_1) _C123 -3 possible_seatings_('D',_1) _C137 -2 possible_seatings_('D',_1) _C150 -1 possible_seatings_('D',_1) _C163 -1 possible_seatings_('D',_1) _C164 -2 possible_seatings_('D',_1) _C165 -3 possible_seatings_('D',_1) _C166 -4 possible_seatings_('D',_1) _C167 -5 possible_seatings_('D',_1) _C168 -6 possible_seatings_('D',_1) _C169 -7 possible_seatings_('D',_1) _C170 -8 possible_seatings_('D',_1) _C171 -9 possible_seatings_('D',_1) _C172 -10 possible_seatings_('D',_1) _C173 -11 possible_seatings_('D',_1) _C174 -12 possible_seatings_('E',_1) Maximum_table_size_1 1 possible_seatings_('E',_1) Must_seat_E 1 possible_seatings_('E',_1) _C124 -4 possible_seatings_('E',_1) _C138 -3 possible_seatings_('E',_1) _C151 -2 possible_seatings_('E',_1) _C163 -1 possible_seatings_('E',_1) _C175 -1 possible_seatings_('E',_1) _C176 -2 possible_seatings_('E',_1) _C177 -3 possible_seatings_('E',_1) _C178 -4 possible_seatings_('E',_1) _C179 -5 possible_seatings_('E',_1) _C180 -6 possible_seatings_('E',_1) _C181 -7 possible_seatings_('E',_1) _C182 -8 possible_seatings_('E',_1) _C183 -9 possible_seatings_('E',_1) _C184 -10 possible_seatings_('E',_1) _C185 -11 possible_seatings_('F',_1) Maximum_table_size_1 1 possible_seatings_('F',_1) Must_seat_F 1 possible_seatings_('F',_1) _C125 -5 possible_seatings_('F',_1) _C139 -4 possible_seatings_('F',_1) _C152 -3 possible_seatings_('F',_1) _C164 -2 possible_seatings_('F',_1) _C175 -1 possible_seatings_('F',_1) _C186 -1 possible_seatings_('F',_1) _C187 -2 possible_seatings_('F',_1) _C188 -3 possible_seatings_('F',_1) _C189 -4 possible_seatings_('F',_1) _C190 -5 possible_seatings_('F',_1) _C191 -6 possible_seatings_('F',_1) _C192 -7 possible_seatings_('F',_1) _C193 -8 possible_seatings_('F',_1) _C194 -9 possible_seatings_('F',_1) _C195 -10 possible_seatings_('G',_1) Maximum_table_size_1 1 possible_seatings_('G',_1) Must_seat_G 1 possible_seatings_('G',_1) _C126 -6 possible_seatings_('G',_1) _C140 -5 possible_seatings_('G',_1) _C153 -4 possible_seatings_('G',_1) _C165 -3 possible_seatings_('G',_1) _C176 -2 possible_seatings_('G',_1) _C186 -1 possible_seatings_('G',_1) _C196 -1 possible_seatings_('G',_1) _C197 -2 possible_seatings_('G',_1) _C198 -3 possible_seatings_('G',_1) _C199 -4 possible_seatings_('G',_1) _C200 -5 possible_seatings_('G',_1) _C201 -6 possible_seatings_('G',_1) _C202 -7 possible_seatings_('G',_1) _C203 -8 possible_seatings_('G',_1) _C204 -9 possible_seatings_('H',_1) Maximum_table_size_1 1 possible_seatings_('H',_1) Must_seat_H 1 possible_seatings_('H',_1) _C127 -7 possible_seatings_('H',_1) _C141 -6 possible_seatings_('H',_1) _C154 -5 possible_seatings_('H',_1) _C166 -4 possible_seatings_('H',_1) _C177 -3 possible_seatings_('H',_1) _C187 -2 possible_seatings_('H',_1) _C196 -1 possible_seatings_('H',_1) _C205 -1 possible_seatings_('H',_1) _C206 -2 possible_seatings_('H',_1) _C207 -3 possible_seatings_('H',_1) _C208 -4 possible_seatings_('H',_1) _C209 -5 possible_seatings_('H',_1) _C210 -6 possible_seatings_('H',_1) _C211 -7 possible_seatings_('H',_1) _C212 -8 possible_seatings_('I',_1) Maximum_table_size_1 1 possible_seatings_('I',_1) Must_seat_I 1 possible_seatings_('I',_1) _C128 -8 possible_seatings_('I',_1) _C142 -7 possible_seatings_('I',_1) _C155 -6 possible_seatings_('I',_1) _C167 -5 possible_seatings_('I',_1) _C178 -4 possible_seatings_('I',_1) _C188 -3 possible_seatings_('I',_1) _C197 -2 possible_seatings_('I',_1) _C205 -1 possible_seatings_('I',_1) _C213 -1 possible_seatings_('I',_1) _C214 -2 possible_seatings_('I',_1) _C215 -3 possible_seatings_('I',_1) _C216 -4 possible_seatings_('I',_1) _C217 -5 possible_seatings_('I',_1) _C218 -6 possible_seatings_('I',_1) _C219 -7 possible_seatings_('J',_1) Maximum_table_size_1 1 possible_seatings_('J',_1) Must_seat_J 1 possible_seatings_('J',_1) _C129 -9 possible_seatings_('J',_1) _C143 -8 possible_seatings_('J',_1) _C156 -7 possible_seatings_('J',_1) _C168 -6 possible_seatings_('J',_1) _C179 -5 possible_seatings_('J',_1) _C189 -4 possible_seatings_('J',_1) _C198 -3 possible_seatings_('J',_1) _C206 -2 possible_seatings_('J',_1) _C213 -1 possible_seatings_('J',_1) _C220 -1 possible_seatings_('J',_1) _C221 -2 possible_seatings_('J',_1) _C222 -3 possible_seatings_('J',_1) _C223 -4 possible_seatings_('J',_1) _C224 -5 possible_seatings_('J',_1) _C225 -6 possible_seatings_('K',_1) Maximum_table_size_1 1 possible_seatings_('K',_1) Must_seat_K 1 possible_seatings_('K',_1) _C130 -10 possible_seatings_('K',_1) _C144 -9 possible_seatings_('K',_1) _C157 -8 possible_seatings_('K',_1) _C169 -7 possible_seatings_('K',_1) _C180 -6 possible_seatings_('K',_1) _C190 -5 possible_seatings_('K',_1) _C199 -4 possible_seatings_('K',_1) _C207 -3 possible_seatings_('K',_1) _C214 -2 possible_seatings_('K',_1) _C220 -1 possible_seatings_('K',_1) _C226 -1 possible_seatings_('K',_1) _C227 -2 possible_seatings_('K',_1) _C228 -3 possible_seatings_('K',_1) _C229 -4 possible_seatings_('K',_1) _C230 -5 possible_seatings_('L',_1) Maximum_table_size_1 1 possible_seatings_('L',_1) Must_seat_L 1 possible_seatings_('L',_1) _C131 -11 possible_seatings_('L',_1) _C145 -10 possible_seatings_('L',_1) _C158 -9 possible_seatings_('L',_1) _C170 -8 possible_seatings_('L',_1) _C181 -7 possible_seatings_('L',_1) _C191 -6 possible_seatings_('L',_1) _C200 -5 possible_seatings_('L',_1) _C208 -4 possible_seatings_('L',_1) _C215 -3 possible_seatings_('L',_1) _C221 -2 possible_seatings_('L',_1) _C226 -1 possible_seatings_('L',_1) _C231 -1 possible_seatings_('L',_1) _C232 -2 possible_seatings_('L',_1) _C233 -3 possible_seatings_('L',_1) _C234 -4 possible_seatings_('M',_1) Maximum_table_size_1 1 possible_seatings_('M',_1) Must_seat_M 1 possible_seatings_('M',_1) _C132 -12 possible_seatings_('M',_1) _C146 -11 possible_seatings_('M',_1) _C159 -10 possible_seatings_('M',_1) _C171 -9 possible_seatings_('M',_1) _C182 -8 possible_seatings_('M',_1) _C192 -7 possible_seatings_('M',_1) _C201 -6 possible_seatings_('M',_1) _C209 -5 possible_seatings_('M',_1) _C216 -4 possible_seatings_('M',_1) _C222 -3 possible_seatings_('M',_1) _C227 -2 possible_seatings_('M',_1) _C231 -1 possible_seatings_('M',_1) _C235 -1 possible_seatings_('M',_1) _C236 -2 possible_seatings_('M',_1) _C237 -3 possible_seatings_('N',_1) Maximum_table_size_1 1 possible_seatings_('N',_1) Must_seat_N 1 possible_seatings_('N',_1) _C133 -13 possible_seatings_('N',_1) _C147 -12 possible_seatings_('N',_1) _C160 -11 possible_seatings_('N',_1) _C172 -10 possible_seatings_('N',_1) _C183 -9 possible_seatings_('N',_1) _C193 -8 possible_seatings_('N',_1) _C202 -7 possible_seatings_('N',_1) _C210 -6 possible_seatings_('N',_1) _C217 -5 possible_seatings_('N',_1) _C223 -4 possible_seatings_('N',_1) _C228 -3 possible_seatings_('N',_1) _C232 -2 possible_seatings_('N',_1) _C235 -1 possible_seatings_('N',_1) _C238 -1 possible_seatings_('N',_1) _C239 -2 possible_seatings_('O',_1) Maximum_table_size_1 1 possible_seatings_('O',_1) Must_seat_O 1 possible_seatings_('O',_1) _C134 -14 possible_seatings_('O',_1) _C148 -13 possible_seatings_('O',_1) _C161 -12 possible_seatings_('O',_1) _C173 -11 possible_seatings_('O',_1) _C184 -10 possible_seatings_('O',_1) _C194 -9 possible_seatings_('O',_1) _C203 -8 possible_seatings_('O',_1) _C211 -7 possible_seatings_('O',_1) _C218 -6 possible_seatings_('O',_1) _C224 -5 possible_seatings_('O',_1) _C229 -4 possible_seatings_('O',_1) _C233 -3 possible_seatings_('O',_1) _C236 -2 possible_seatings_('O',_1) _C238 -1 possible_seatings_('O',_1) _C240 -1 possible_seatings_('P',_1) Maximum_table_size_1 1 possible_seatings_('P',_1) Must_seat_P 1 possible_seatings_('P',_1) _C135 -15 possible_seatings_('P',_1) _C149 -14 possible_seatings_('P',_1) _C162 -13 possible_seatings_('P',_1) _C174 -12 possible_seatings_('P',_1) _C185 -11 possible_seatings_('P',_1) _C195 -10 possible_seatings_('P',_1) _C204 -9 possible_seatings_('P',_1) _C212 -8 possible_seatings_('P',_1) _C219 -7 possible_seatings_('P',_1) _C225 -6 possible_seatings_('P',_1) _C230 -5 possible_seatings_('P',_1) _C234 -4 possible_seatings_('P',_1) _C237 -3 possible_seatings_('P',_1) _C239 -2 possible_seatings_('P',_1) _C240 -1 possible_seatings_('A',_2) Maximum_table_size_2 1 possible_seatings_('A',_2) Must_seat_A 1 possible_seatings_('A',_2) _C241 -1 possible_seatings_('A',_2) _C242 -2 possible_seatings_('A',_2) _C243 -3 possible_seatings_('A',_2) _C244 -4 possible_seatings_('A',_2) _C245 -5 possible_seatings_('A',_2) _C246 -6 possible_seatings_('A',_2) _C247 -7 possible_seatings_('A',_2) _C248 -8 possible_seatings_('A',_2) _C249 -9 possible_seatings_('A',_2) _C250 -10 possible_seatings_('A',_2) _C251 -11 possible_seatings_('A',_2) _C252 -12 possible_seatings_('A',_2) _C253 -13 possible_seatings_('A',_2) _C254 -14 possible_seatings_('A',_2) _C255 -15 possible_seatings_('B',_2) Maximum_table_size_2 1 possible_seatings_('B',_2) Must_seat_B 1 possible_seatings_('B',_2) _C241 -1 possible_seatings_('B',_2) _C256 -1 possible_seatings_('B',_2) _C257 -2 possible_seatings_('B',_2) _C258 -3 possible_seatings_('B',_2) _C259 -4 possible_seatings_('B',_2) _C260 -5 possible_seatings_('B',_2) _C261 -6 possible_seatings_('B',_2) _C262 -7 possible_seatings_('B',_2) _C263 -8 possible_seatings_('B',_2) _C264 -9 possible_seatings_('B',_2) _C265 -10 possible_seatings_('B',_2) _C266 -11 possible_seatings_('B',_2) _C267 -12 possible_seatings_('B',_2) _C268 -13 possible_seatings_('B',_2) _C269 -14 possible_seatings_('C',_2) Maximum_table_size_2 1 possible_seatings_('C',_2) Must_seat_C 1 possible_seatings_('C',_2) _C242 -2 possible_seatings_('C',_2) _C256 -1 possible_seatings_('C',_2) _C270 -1 possible_seatings_('C',_2) _C271 -2 possible_seatings_('C',_2) _C272 -3 possible_seatings_('C',_2) _C273 -4 possible_seatings_('C',_2) _C274 -5 possible_seatings_('C',_2) _C275 -6 possible_seatings_('C',_2) _C276 -7 possible_seatings_('C',_2) _C277 -8 possible_seatings_('C',_2) _C278 -9 possible_seatings_('C',_2) _C279 -10 possible_seatings_('C',_2) _C280 -11 possible_seatings_('C',_2) _C281 -12 possible_seatings_('C',_2) _C282 -13 possible_seatings_('D',_2) Maximum_table_size_2 1 possible_seatings_('D',_2) Must_seat_D 1 possible_seatings_('D',_2) _C243 -3 possible_seatings_('D',_2) _C257 -2 possible_seatings_('D',_2) _C270 -1 possible_seatings_('D',_2) _C283 -1 possible_seatings_('D',_2) _C284 -2 possible_seatings_('D',_2) _C285 -3 possible_seatings_('D',_2) _C286 -4 possible_seatings_('D',_2) _C287 -5 possible_seatings_('D',_2) _C288 -6 possible_seatings_('D',_2) _C289 -7 possible_seatings_('D',_2) _C290 -8 possible_seatings_('D',_2) _C291 -9 possible_seatings_('D',_2) _C292 -10 possible_seatings_('D',_2) _C293 -11 possible_seatings_('D',_2) _C294 -12 possible_seatings_('E',_2) Maximum_table_size_2 1 possible_seatings_('E',_2) Must_seat_E 1 possible_seatings_('E',_2) _C244 -4 possible_seatings_('E',_2) _C258 -3 possible_seatings_('E',_2) _C271 -2 possible_seatings_('E',_2) _C283 -1 possible_seatings_('E',_2) _C295 -1 possible_seatings_('E',_2) _C296 -2 possible_seatings_('E',_2) _C297 -3 possible_seatings_('E',_2) _C298 -4 possible_seatings_('E',_2) _C299 -5 possible_seatings_('E',_2) _C300 -6 possible_seatings_('E',_2) _C301 -7 possible_seatings_('E',_2) _C302 -8 possible_seatings_('E',_2) _C303 -9 possible_seatings_('E',_2) _C304 -10 possible_seatings_('E',_2) _C305 -11 possible_seatings_('F',_2) Maximum_table_size_2 1 possible_seatings_('F',_2) Must_seat_F 1 possible_seatings_('F',_2) _C245 -5 possible_seatings_('F',_2) _C259 -4 possible_seatings_('F',_2) _C272 -3 possible_seatings_('F',_2) _C284 -2 possible_seatings_('F',_2) _C295 -1 possible_seatings_('F',_2) _C306 -1 possible_seatings_('F',_2) _C307 -2 possible_seatings_('F',_2) _C308 -3 possible_seatings_('F',_2) _C309 -4 possible_seatings_('F',_2) _C310 -5 possible_seatings_('F',_2) _C311 -6 possible_seatings_('F',_2) _C312 -7 possible_seatings_('F',_2) _C313 -8 possible_seatings_('F',_2) _C314 -9 possible_seatings_('F',_2) _C315 -10 possible_seatings_('G',_2) Maximum_table_size_2 1 possible_seatings_('G',_2) Must_seat_G 1 possible_seatings_('G',_2) _C246 -6 possible_seatings_('G',_2) _C260 -5 possible_seatings_('G',_2) _C273 -4 possible_seatings_('G',_2) _C285 -3 possible_seatings_('G',_2) _C296 -2 possible_seatings_('G',_2) _C306 -1 possible_seatings_('G',_2) _C316 -1 possible_seatings_('G',_2) _C317 -2 possible_seatings_('G',_2) _C318 -3 possible_seatings_('G',_2) _C319 -4 possible_seatings_('G',_2) _C320 -5 possible_seatings_('G',_2) _C321 -6 possible_seatings_('G',_2) _C322 -7 possible_seatings_('G',_2) _C323 -8 possible_seatings_('G',_2) _C324 -9 possible_seatings_('H',_2) Maximum_table_size_2 1 possible_seatings_('H',_2) Must_seat_H 1 possible_seatings_('H',_2) _C247 -7 possible_seatings_('H',_2) _C261 -6 possible_seatings_('H',_2) _C274 -5 possible_seatings_('H',_2) _C286 -4 possible_seatings_('H',_2) _C297 -3 possible_seatings_('H',_2) _C307 -2 possible_seatings_('H',_2) _C316 -1 possible_seatings_('H',_2) _C325 -1 possible_seatings_('H',_2) _C326 -2 possible_seatings_('H',_2) _C327 -3 possible_seatings_('H',_2) _C328 -4 possible_seatings_('H',_2) _C329 -5 possible_seatings_('H',_2) _C330 -6 possible_seatings_('H',_2) _C331 -7 possible_seatings_('H',_2) _C332 -8 possible_seatings_('I',_2) Maximum_table_size_2 1 possible_seatings_('I',_2) Must_seat_I 1 possible_seatings_('I',_2) _C248 -8 possible_seatings_('I',_2) _C262 -7 possible_seatings_('I',_2) _C275 -6 possible_seatings_('I',_2) _C287 -5 possible_seatings_('I',_2) _C298 -4 possible_seatings_('I',_2) _C308 -3 possible_seatings_('I',_2) _C317 -2 possible_seatings_('I',_2) _C325 -1 possible_seatings_('I',_2) _C333 -1 possible_seatings_('I',_2) _C334 -2 possible_seatings_('I',_2) _C335 -3 possible_seatings_('I',_2) _C336 -4 possible_seatings_('I',_2) _C337 -5 possible_seatings_('I',_2) _C338 -6 possible_seatings_('I',_2) _C339 -7 possible_seatings_('J',_2) Maximum_table_size_2 1 possible_seatings_('J',_2) Must_seat_J 1 possible_seatings_('J',_2) _C249 -9 possible_seatings_('J',_2) _C263 -8 possible_seatings_('J',_2) _C276 -7 possible_seatings_('J',_2) _C288 -6 possible_seatings_('J',_2) _C299 -5 possible_seatings_('J',_2) _C309 -4 possible_seatings_('J',_2) _C318 -3 possible_seatings_('J',_2) _C326 -2 possible_seatings_('J',_2) _C333 -1 possible_seatings_('J',_2) _C340 -1 possible_seatings_('J',_2) _C341 -2 possible_seatings_('J',_2) _C342 -3 possible_seatings_('J',_2) _C343 -4 possible_seatings_('J',_2) _C344 -5 possible_seatings_('J',_2) _C345 -6 possible_seatings_('K',_2) Maximum_table_size_2 1 possible_seatings_('K',_2) Must_seat_K 1 possible_seatings_('K',_2) _C250 -10 possible_seatings_('K',_2) _C264 -9 possible_seatings_('K',_2) _C277 -8 possible_seatings_('K',_2) _C289 -7 possible_seatings_('K',_2) _C300 -6 possible_seatings_('K',_2) _C310 -5 possible_seatings_('K',_2) _C319 -4 possible_seatings_('K',_2) _C327 -3 possible_seatings_('K',_2) _C334 -2 possible_seatings_('K',_2) _C340 -1 possible_seatings_('K',_2) _C346 -1 possible_seatings_('K',_2) _C347 -2 possible_seatings_('K',_2) _C348 -3 possible_seatings_('K',_2) _C349 -4 possible_seatings_('K',_2) _C350 -5 possible_seatings_('L',_2) Maximum_table_size_2 1 possible_seatings_('L',_2) Must_seat_L 1 possible_seatings_('L',_2) _C251 -11 possible_seatings_('L',_2) _C265 -10 possible_seatings_('L',_2) _C278 -9 possible_seatings_('L',_2) _C290 -8 possible_seatings_('L',_2) _C301 -7 possible_seatings_('L',_2) _C311 -6 possible_seatings_('L',_2) _C320 -5 possible_seatings_('L',_2) _C328 -4 possible_seatings_('L',_2) _C335 -3 possible_seatings_('L',_2) _C341 -2 possible_seatings_('L',_2) _C346 -1 possible_seatings_('L',_2) _C351 -1 possible_seatings_('L',_2) _C352 -2 possible_seatings_('L',_2) _C353 -3 possible_seatings_('L',_2) _C354 -4 possible_seatings_('M',_2) Maximum_table_size_2 1 possible_seatings_('M',_2) Must_seat_M 1 possible_seatings_('M',_2) _C252 -12 possible_seatings_('M',_2) _C266 -11 possible_seatings_('M',_2) _C279 -10 possible_seatings_('M',_2) _C291 -9 possible_seatings_('M',_2) _C302 -8 possible_seatings_('M',_2) _C312 -7 possible_seatings_('M',_2) _C321 -6 possible_seatings_('M',_2) _C329 -5 possible_seatings_('M',_2) _C336 -4 possible_seatings_('M',_2) _C342 -3 possible_seatings_('M',_2) _C347 -2 possible_seatings_('M',_2) _C351 -1 possible_seatings_('M',_2) _C355 -1 possible_seatings_('M',_2) _C356 -2 possible_seatings_('M',_2) _C357 -3 possible_seatings_('N',_2) Maximum_table_size_2 1 possible_seatings_('N',_2) Must_seat_N 1 possible_seatings_('N',_2) _C253 -13 possible_seatings_('N',_2) _C267 -12 possible_seatings_('N',_2) _C280 -11 possible_seatings_('N',_2) _C292 -10 possible_seatings_('N',_2) _C303 -9 possible_seatings_('N',_2) _C313 -8 possible_seatings_('N',_2) _C322 -7 possible_seatings_('N',_2) _C330 -6 possible_seatings_('N',_2) _C337 -5 possible_seatings_('N',_2) _C343 -4 possible_seatings_('N',_2) _C348 -3 possible_seatings_('N',_2) _C352 -2 possible_seatings_('N',_2) _C355 -1 possible_seatings_('N',_2) _C358 -1 possible_seatings_('N',_2) _C359 -2 possible_seatings_('O',_2) Maximum_table_size_2 1 possible_seatings_('O',_2) Must_seat_O 1 possible_seatings_('O',_2) _C254 -14 possible_seatings_('O',_2) _C268 -13 possible_seatings_('O',_2) _C281 -12 possible_seatings_('O',_2) _C293 -11 possible_seatings_('O',_2) _C304 -10 possible_seatings_('O',_2) _C314 -9 possible_seatings_('O',_2) _C323 -8 possible_seatings_('O',_2) _C331 -7 possible_seatings_('O',_2) _C338 -6 possible_seatings_('O',_2) _C344 -5 possible_seatings_('O',_2) _C349 -4 possible_seatings_('O',_2) _C353 -3 possible_seatings_('O',_2) _C356 -2 possible_seatings_('O',_2) _C358 -1 possible_seatings_('O',_2) _C360 -1 possible_seatings_('P',_2) Maximum_table_size_2 1 possible_seatings_('P',_2) Must_seat_P 1 possible_seatings_('P',_2) _C255 -15 possible_seatings_('P',_2) _C269 -14 possible_seatings_('P',_2) _C282 -13 possible_seatings_('P',_2) _C294 -12 possible_seatings_('P',_2) _C305 -11 possible_seatings_('P',_2) _C315 -10 possible_seatings_('P',_2) _C324 -9 possible_seatings_('P',_2) _C332 -8 possible_seatings_('P',_2) _C339 -7 possible_seatings_('P',_2) _C345 -6 possible_seatings_('P',_2) _C350 -5 possible_seatings_('P',_2) _C354 -4 possible_seatings_('P',_2) _C357 -3 possible_seatings_('P',_2) _C359 -2 possible_seatings_('P',_2) _C360 -1 possible_seatings_('A',_3) Maximum_table_size_3 1 possible_seatings_('A',_3) Must_seat_A 1 possible_seatings_('A',_3) _C361 -1 possible_seatings_('A',_3) _C362 -2 possible_seatings_('A',_3) _C363 -3 possible_seatings_('A',_3) _C364 -4 possible_seatings_('A',_3) _C365 -5 possible_seatings_('A',_3) _C366 -6 possible_seatings_('A',_3) _C367 -7 possible_seatings_('A',_3) _C368 -8 possible_seatings_('A',_3) _C369 -9 possible_seatings_('A',_3) _C370 -10 possible_seatings_('A',_3) _C371 -11 possible_seatings_('A',_3) _C372 -12 possible_seatings_('A',_3) _C373 -13 possible_seatings_('A',_3) _C374 -14 possible_seatings_('A',_3) _C375 -15 possible_seatings_('B',_3) Maximum_table_size_3 1 possible_seatings_('B',_3) Must_seat_B 1 possible_seatings_('B',_3) _C361 -1 possible_seatings_('B',_3) _C376 -1 possible_seatings_('B',_3) _C377 -2 possible_seatings_('B',_3) _C378 -3 possible_seatings_('B',_3) _C379 -4 possible_seatings_('B',_3) _C380 -5 possible_seatings_('B',_3) _C381 -6 possible_seatings_('B',_3) _C382 -7 possible_seatings_('B',_3) _C383 -8 possible_seatings_('B',_3) _C384 -9 possible_seatings_('B',_3) _C385 -10 possible_seatings_('B',_3) _C386 -11 possible_seatings_('B',_3) _C387 -12 possible_seatings_('B',_3) _C388 -13 possible_seatings_('B',_3) _C389 -14 possible_seatings_('C',_3) Maximum_table_size_3 1 possible_seatings_('C',_3) Must_seat_C 1 possible_seatings_('C',_3) _C362 -2 possible_seatings_('C',_3) _C376 -1 possible_seatings_('C',_3) _C390 -1 possible_seatings_('C',_3) _C391 -2 possible_seatings_('C',_3) _C392 -3 possible_seatings_('C',_3) _C393 -4 possible_seatings_('C',_3) _C394 -5 possible_seatings_('C',_3) _C395 -6 possible_seatings_('C',_3) _C396 -7 possible_seatings_('C',_3) _C397 -8 possible_seatings_('C',_3) _C398 -9 possible_seatings_('C',_3) _C399 -10 possible_seatings_('C',_3) _C400 -11 possible_seatings_('C',_3) _C401 -12 possible_seatings_('C',_3) _C402 -13 possible_seatings_('D',_3) Maximum_table_size_3 1 possible_seatings_('D',_3) Must_seat_D 1 possible_seatings_('D',_3) _C363 -3 possible_seatings_('D',_3) _C377 -2 possible_seatings_('D',_3) _C390 -1 possible_seatings_('D',_3) _C403 -1 possible_seatings_('D',_3) _C404 -2 possible_seatings_('D',_3) _C405 -3 possible_seatings_('D',_3) _C406 -4 possible_seatings_('D',_3) _C407 -5 possible_seatings_('D',_3) _C408 -6 possible_seatings_('D',_3) _C409 -7 possible_seatings_('D',_3) _C410 -8 possible_seatings_('D',_3) _C411 -9 possible_seatings_('D',_3) _C412 -10 possible_seatings_('D',_3) _C413 -11 possible_seatings_('D',_3) _C414 -12 possible_seatings_('E',_3) Maximum_table_size_3 1 possible_seatings_('E',_3) Must_seat_E 1 possible_seatings_('E',_3) _C364 -4 possible_seatings_('E',_3) _C378 -3 possible_seatings_('E',_3) _C391 -2 possible_seatings_('E',_3) _C403 -1 possible_seatings_('E',_3) _C415 -1 possible_seatings_('E',_3) _C416 -2 possible_seatings_('E',_3) _C417 -3 possible_seatings_('E',_3) _C418 -4 possible_seatings_('E',_3) _C419 -5 possible_seatings_('E',_3) _C420 -6 possible_seatings_('E',_3) _C421 -7 possible_seatings_('E',_3) _C422 -8 possible_seatings_('E',_3) _C423 -9 possible_seatings_('E',_3) _C424 -10 possible_seatings_('E',_3) _C425 -11 possible_seatings_('F',_3) Maximum_table_size_3 1 possible_seatings_('F',_3) Must_seat_F 1 possible_seatings_('F',_3) _C365 -5 possible_seatings_('F',_3) _C379 -4 possible_seatings_('F',_3) _C392 -3 possible_seatings_('F',_3) _C404 -2 possible_seatings_('F',_3) _C415 -1 possible_seatings_('F',_3) _C426 -1 possible_seatings_('F',_3) _C427 -2 possible_seatings_('F',_3) _C428 -3 possible_seatings_('F',_3) _C429 -4 possible_seatings_('F',_3) _C430 -5 possible_seatings_('F',_3) _C431 -6 possible_seatings_('F',_3) _C432 -7 possible_seatings_('F',_3) _C433 -8 possible_seatings_('F',_3) _C434 -9 possible_seatings_('F',_3) _C435 -10 possible_seatings_('G',_3) Maximum_table_size_3 1 possible_seatings_('G',_3) Must_seat_G 1 possible_seatings_('G',_3) _C366 -6 possible_seatings_('G',_3) _C380 -5 possible_seatings_('G',_3) _C393 -4 possible_seatings_('G',_3) _C405 -3 possible_seatings_('G',_3) _C416 -2 possible_seatings_('G',_3) _C426 -1 possible_seatings_('G',_3) _C436 -1 possible_seatings_('G',_3) _C437 -2 possible_seatings_('G',_3) _C438 -3 possible_seatings_('G',_3) _C439 -4 possible_seatings_('G',_3) _C440 -5 possible_seatings_('G',_3) _C441 -6 possible_seatings_('G',_3) _C442 -7 possible_seatings_('G',_3) _C443 -8 possible_seatings_('G',_3) _C444 -9 possible_seatings_('H',_3) Maximum_table_size_3 1 possible_seatings_('H',_3) Must_seat_H 1 possible_seatings_('H',_3) _C367 -7 possible_seatings_('H',_3) _C381 -6 possible_seatings_('H',_3) _C394 -5 possible_seatings_('H',_3) _C406 -4 possible_seatings_('H',_3) _C417 -3 possible_seatings_('H',_3) _C427 -2 possible_seatings_('H',_3) _C436 -1 possible_seatings_('H',_3) _C445 -1 possible_seatings_('H',_3) _C446 -2 possible_seatings_('H',_3) _C447 -3 possible_seatings_('H',_3) _C448 -4 possible_seatings_('H',_3) _C449 -5 possible_seatings_('H',_3) _C450 -6 possible_seatings_('H',_3) _C451 -7 possible_seatings_('H',_3) _C452 -8 possible_seatings_('I',_3) Maximum_table_size_3 1 possible_seatings_('I',_3) Must_seat_I 1 possible_seatings_('I',_3) _C368 -8 possible_seatings_('I',_3) _C382 -7 possible_seatings_('I',_3) _C395 -6 possible_seatings_('I',_3) _C407 -5 possible_seatings_('I',_3) _C418 -4 possible_seatings_('I',_3) _C428 -3 possible_seatings_('I',_3) _C437 -2 possible_seatings_('I',_3) _C445 -1 possible_seatings_('I',_3) _C453 -1 possible_seatings_('I',_3) _C454 -2 possible_seatings_('I',_3) _C455 -3 possible_seatings_('I',_3) _C456 -4 possible_seatings_('I',_3) _C457 -5 possible_seatings_('I',_3) _C458 -6 possible_seatings_('I',_3) _C459 -7 possible_seatings_('J',_3) Maximum_table_size_3 1 possible_seatings_('J',_3) Must_seat_J 1 possible_seatings_('J',_3) _C369 -9 possible_seatings_('J',_3) _C383 -8 possible_seatings_('J',_3) _C396 -7 possible_seatings_('J',_3) _C408 -6 possible_seatings_('J',_3) _C419 -5 possible_seatings_('J',_3) _C429 -4 possible_seatings_('J',_3) _C438 -3 possible_seatings_('J',_3) _C446 -2 possible_seatings_('J',_3) _C453 -1 possible_seatings_('J',_3) _C460 -1 possible_seatings_('J',_3) _C461 -2 possible_seatings_('J',_3) _C462 -3 possible_seatings_('J',_3) _C463 -4 possible_seatings_('J',_3) _C464 -5 possible_seatings_('J',_3) _C465 -6 possible_seatings_('K',_3) Maximum_table_size_3 1 possible_seatings_('K',_3) Must_seat_K 1 possible_seatings_('K',_3) _C370 -10 possible_seatings_('K',_3) _C384 -9 possible_seatings_('K',_3) _C397 -8 possible_seatings_('K',_3) _C409 -7 possible_seatings_('K',_3) _C420 -6 possible_seatings_('K',_3) _C430 -5 possible_seatings_('K',_3) _C439 -4 possible_seatings_('K',_3) _C447 -3 possible_seatings_('K',_3) _C454 -2 possible_seatings_('K',_3) _C460 -1 possible_seatings_('K',_3) _C466 -1 possible_seatings_('K',_3) _C467 -2 possible_seatings_('K',_3) _C468 -3 possible_seatings_('K',_3) _C469 -4 possible_seatings_('K',_3) _C470 -5 possible_seatings_('L',_3) Maximum_table_size_3 1 possible_seatings_('L',_3) Must_seat_L 1 possible_seatings_('L',_3) _C371 -11 possible_seatings_('L',_3) _C385 -10 possible_seatings_('L',_3) _C398 -9 possible_seatings_('L',_3) _C410 -8 possible_seatings_('L',_3) _C421 -7 possible_seatings_('L',_3) _C431 -6 possible_seatings_('L',_3) _C440 -5 possible_seatings_('L',_3) _C448 -4 possible_seatings_('L',_3) _C455 -3 possible_seatings_('L',_3) _C461 -2 possible_seatings_('L',_3) _C466 -1 possible_seatings_('L',_3) _C471 -1 possible_seatings_('L',_3) _C472 -2 possible_seatings_('L',_3) _C473 -3 possible_seatings_('L',_3) _C474 -4 possible_seatings_('M',_3) Maximum_table_size_3 1 possible_seatings_('M',_3) Must_seat_M 1 possible_seatings_('M',_3) _C372 -12 possible_seatings_('M',_3) _C386 -11 possible_seatings_('M',_3) _C399 -10 possible_seatings_('M',_3) _C411 -9 possible_seatings_('M',_3) _C422 -8 possible_seatings_('M',_3) _C432 -7 possible_seatings_('M',_3) _C441 -6 possible_seatings_('M',_3) _C449 -5 possible_seatings_('M',_3) _C456 -4 possible_seatings_('M',_3) _C462 -3 possible_seatings_('M',_3) _C467 -2 possible_seatings_('M',_3) _C471 -1 possible_seatings_('M',_3) _C475 -1 possible_seatings_('M',_3) _C476 -2 possible_seatings_('M',_3) _C477 -3 possible_seatings_('N',_3) Maximum_table_size_3 1 possible_seatings_('N',_3) Must_seat_N 1 possible_seatings_('N',_3) _C373 -13 possible_seatings_('N',_3) _C387 -12 possible_seatings_('N',_3) _C400 -11 possible_seatings_('N',_3) _C412 -10 possible_seatings_('N',_3) _C423 -9 possible_seatings_('N',_3) _C433 -8 possible_seatings_('N',_3) _C442 -7 possible_seatings_('N',_3) _C450 -6 possible_seatings_('N',_3) _C457 -5 possible_seatings_('N',_3) _C463 -4 possible_seatings_('N',_3) _C468 -3 possible_seatings_('N',_3) _C472 -2 possible_seatings_('N',_3) _C475 -1 possible_seatings_('N',_3) _C478 -1 possible_seatings_('N',_3) _C479 -2 possible_seatings_('O',_3) Maximum_table_size_3 1 possible_seatings_('O',_3) Must_seat_O 1 possible_seatings_('O',_3) _C374 -14 possible_seatings_('O',_3) _C388 -13 possible_seatings_('O',_3) _C401 -12 possible_seatings_('O',_3) _C413 -11 possible_seatings_('O',_3) _C424 -10 possible_seatings_('O',_3) _C434 -9 possible_seatings_('O',_3) _C443 -8 possible_seatings_('O',_3) _C451 -7 possible_seatings_('O',_3) _C458 -6 possible_seatings_('O',_3) _C464 -5 possible_seatings_('O',_3) _C469 -4 possible_seatings_('O',_3) _C473 -3 possible_seatings_('O',_3) _C476 -2 possible_seatings_('O',_3) _C478 -1 possible_seatings_('O',_3) _C480 -1 possible_seatings_('P',_3) Maximum_table_size_3 1 possible_seatings_('P',_3) Must_seat_P 1 possible_seatings_('P',_3) _C375 -15 possible_seatings_('P',_3) _C389 -14 possible_seatings_('P',_3) _C402 -13 possible_seatings_('P',_3) _C414 -12 possible_seatings_('P',_3) _C425 -11 possible_seatings_('P',_3) _C435 -10 possible_seatings_('P',_3) _C444 -9 possible_seatings_('P',_3) _C452 -8 possible_seatings_('P',_3) _C459 -7 possible_seatings_('P',_3) _C465 -6 possible_seatings_('P',_3) _C470 -5 possible_seatings_('P',_3) _C474 -4 possible_seatings_('P',_3) _C477 -3 possible_seatings_('P',_3) _C479 -2 possible_seatings_('P',_3) _C480 -1 possible_seatings_('A',_4) Maximum_table_size_4 1 possible_seatings_('A',_4) Must_seat_A 1 possible_seatings_('A',_4) _C481 -1 possible_seatings_('A',_4) _C482 -2 possible_seatings_('A',_4) _C483 -3 possible_seatings_('A',_4) _C484 -4 possible_seatings_('A',_4) _C485 -5 possible_seatings_('A',_4) _C486 -6 possible_seatings_('A',_4) _C487 -7 possible_seatings_('A',_4) _C488 -8 possible_seatings_('A',_4) _C489 -9 possible_seatings_('A',_4) _C490 -10 possible_seatings_('A',_4) _C491 -11 possible_seatings_('A',_4) _C492 -12 possible_seatings_('A',_4) _C493 -13 possible_seatings_('A',_4) _C494 -14 possible_seatings_('A',_4) _C495 -15 possible_seatings_('B',_4) Maximum_table_size_4 1 possible_seatings_('B',_4) Must_seat_B 1 possible_seatings_('B',_4) _C481 -1 possible_seatings_('B',_4) _C496 -1 possible_seatings_('B',_4) _C497 -2 possible_seatings_('B',_4) _C498 -3 possible_seatings_('B',_4) _C499 -4 possible_seatings_('B',_4) _C500 -5 possible_seatings_('B',_4) _C501 -6 possible_seatings_('B',_4) _C502 -7 possible_seatings_('B',_4) _C503 -8 possible_seatings_('B',_4) _C504 -9 possible_seatings_('B',_4) _C505 -10 possible_seatings_('B',_4) _C506 -11 possible_seatings_('B',_4) _C507 -12 possible_seatings_('B',_4) _C508 -13 possible_seatings_('B',_4) _C509 -14 possible_seatings_('C',_4) Maximum_table_size_4 1 possible_seatings_('C',_4) Must_seat_C 1 possible_seatings_('C',_4) _C482 -2 possible_seatings_('C',_4) _C496 -1 possible_seatings_('C',_4) _C510 -1 possible_seatings_('C',_4) _C511 -2 possible_seatings_('C',_4) _C512 -3 possible_seatings_('C',_4) _C513 -4 possible_seatings_('C',_4) _C514 -5 possible_seatings_('C',_4) _C515 -6 possible_seatings_('C',_4) _C516 -7 possible_seatings_('C',_4) _C517 -8 possible_seatings_('C',_4) _C518 -9 possible_seatings_('C',_4) _C519 -10 possible_seatings_('C',_4) _C520 -11 possible_seatings_('C',_4) _C521 -12 possible_seatings_('C',_4) _C522 -13 possible_seatings_('D',_4) Maximum_table_size_4 1 possible_seatings_('D',_4) Must_seat_D 1 possible_seatings_('D',_4) _C483 -3 possible_seatings_('D',_4) _C497 -2 possible_seatings_('D',_4) _C510 -1 possible_seatings_('D',_4) _C523 -1 possible_seatings_('D',_4) _C524 -2 possible_seatings_('D',_4) _C525 -3 possible_seatings_('D',_4) _C526 -4 possible_seatings_('D',_4) _C527 -5 possible_seatings_('D',_4) _C528 -6 possible_seatings_('D',_4) _C529 -7 possible_seatings_('D',_4) _C530 -8 possible_seatings_('D',_4) _C531 -9 possible_seatings_('D',_4) _C532 -10 possible_seatings_('D',_4) _C533 -11 possible_seatings_('D',_4) _C534 -12 possible_seatings_('E',_4) Maximum_table_size_4 1 possible_seatings_('E',_4) Must_seat_E 1 possible_seatings_('E',_4) _C484 -4 possible_seatings_('E',_4) _C498 -3 possible_seatings_('E',_4) _C511 -2 possible_seatings_('E',_4) _C523 -1 possible_seatings_('E',_4) _C535 -1 possible_seatings_('E',_4) _C536 -2 possible_seatings_('E',_4) _C537 -3 possible_seatings_('E',_4) _C538 -4 possible_seatings_('E',_4) _C539 -5 possible_seatings_('E',_4) _C540 -6 possible_seatings_('E',_4) _C541 -7 possible_seatings_('E',_4) _C542 -8 possible_seatings_('E',_4) _C543 -9 possible_seatings_('E',_4) _C544 -10 possible_seatings_('E',_4) _C545 -11 possible_seatings_('F',_4) Maximum_table_size_4 1 possible_seatings_('F',_4) Must_seat_F 1 possible_seatings_('F',_4) _C485 -5 possible_seatings_('F',_4) _C499 -4 possible_seatings_('F',_4) _C512 -3 possible_seatings_('F',_4) _C524 -2 possible_seatings_('F',_4) _C535 -1 possible_seatings_('F',_4) _C546 -1 possible_seatings_('F',_4) _C547 -2 possible_seatings_('F',_4) _C548 -3 possible_seatings_('F',_4) _C549 -4 possible_seatings_('F',_4) _C550 -5 possible_seatings_('F',_4) _C551 -6 possible_seatings_('F',_4) _C552 -7 possible_seatings_('F',_4) _C553 -8 possible_seatings_('F',_4) _C554 -9 possible_seatings_('F',_4) _C555 -10 possible_seatings_('G',_4) Maximum_table_size_4 1 possible_seatings_('G',_4) Must_seat_G 1 possible_seatings_('G',_4) _C486 -6 possible_seatings_('G',_4) _C500 -5 possible_seatings_('G',_4) _C513 -4 possible_seatings_('G',_4) _C525 -3 possible_seatings_('G',_4) _C536 -2 possible_seatings_('G',_4) _C546 -1 possible_seatings_('G',_4) _C556 -1 possible_seatings_('G',_4) _C557 -2 possible_seatings_('G',_4) _C558 -3 possible_seatings_('G',_4) _C559 -4 possible_seatings_('G',_4) _C560 -5 possible_seatings_('G',_4) _C561 -6 possible_seatings_('G',_4) _C562 -7 possible_seatings_('G',_4) _C563 -8 possible_seatings_('G',_4) _C564 -9 possible_seatings_('H',_4) Maximum_table_size_4 1 possible_seatings_('H',_4) Must_seat_H 1 possible_seatings_('H',_4) _C487 -7 possible_seatings_('H',_4) _C501 -6 possible_seatings_('H',_4) _C514 -5 possible_seatings_('H',_4) _C526 -4 possible_seatings_('H',_4) _C537 -3 possible_seatings_('H',_4) _C547 -2 possible_seatings_('H',_4) _C556 -1 possible_seatings_('H',_4) _C565 -1 possible_seatings_('H',_4) _C566 -2 possible_seatings_('H',_4) _C567 -3 possible_seatings_('H',_4) _C568 -4 possible_seatings_('H',_4) _C569 -5 possible_seatings_('H',_4) _C570 -6 possible_seatings_('H',_4) _C571 -7 possible_seatings_('H',_4) _C572 -8 possible_seatings_('I',_4) Maximum_table_size_4 1 possible_seatings_('I',_4) Must_seat_I 1 possible_seatings_('I',_4) _C488 -8 possible_seatings_('I',_4) _C502 -7 possible_seatings_('I',_4) _C515 -6 possible_seatings_('I',_4) _C527 -5 possible_seatings_('I',_4) _C538 -4 possible_seatings_('I',_4) _C548 -3 possible_seatings_('I',_4) _C557 -2 possible_seatings_('I',_4) _C565 -1 possible_seatings_('I',_4) _C573 -1 possible_seatings_('I',_4) _C574 -2 possible_seatings_('I',_4) _C575 -3 possible_seatings_('I',_4) _C576 -4 possible_seatings_('I',_4) _C577 -5 possible_seatings_('I',_4) _C578 -6 possible_seatings_('I',_4) _C579 -7 possible_seatings_('J',_4) Maximum_table_size_4 1 possible_seatings_('J',_4) Must_seat_J 1 possible_seatings_('J',_4) _C489 -9 possible_seatings_('J',_4) _C503 -8 possible_seatings_('J',_4) _C516 -7 possible_seatings_('J',_4) _C528 -6 possible_seatings_('J',_4) _C539 -5 possible_seatings_('J',_4) _C549 -4 possible_seatings_('J',_4) _C558 -3 possible_seatings_('J',_4) _C566 -2 possible_seatings_('J',_4) _C573 -1 possible_seatings_('J',_4) _C580 -1 possible_seatings_('J',_4) _C581 -2 possible_seatings_('J',_4) _C582 -3 possible_seatings_('J',_4) _C583 -4 possible_seatings_('J',_4) _C584 -5 possible_seatings_('J',_4) _C585 -6 possible_seatings_('K',_4) Maximum_table_size_4 1 possible_seatings_('K',_4) Must_seat_K 1 possible_seatings_('K',_4) _C490 -10 possible_seatings_('K',_4) _C504 -9 possible_seatings_('K',_4) _C517 -8 possible_seatings_('K',_4) _C529 -7 possible_seatings_('K',_4) _C540 -6 possible_seatings_('K',_4) _C550 -5 possible_seatings_('K',_4) _C559 -4 possible_seatings_('K',_4) _C567 -3 possible_seatings_('K',_4) _C574 -2 possible_seatings_('K',_4) _C580 -1 possible_seatings_('K',_4) _C586 -1 possible_seatings_('K',_4) _C587 -2 possible_seatings_('K',_4) _C588 -3 possible_seatings_('K',_4) _C589 -4 possible_seatings_('K',_4) _C590 -5 possible_seatings_('L',_4) Maximum_table_size_4 1 possible_seatings_('L',_4) Must_seat_L 1 possible_seatings_('L',_4) _C491 -11 possible_seatings_('L',_4) _C505 -10 possible_seatings_('L',_4) _C518 -9 possible_seatings_('L',_4) _C530 -8 possible_seatings_('L',_4) _C541 -7 possible_seatings_('L',_4) _C551 -6 possible_seatings_('L',_4) _C560 -5 possible_seatings_('L',_4) _C568 -4 possible_seatings_('L',_4) _C575 -3 possible_seatings_('L',_4) _C581 -2 possible_seatings_('L',_4) _C586 -1 possible_seatings_('L',_4) _C591 -1 possible_seatings_('L',_4) _C592 -2 possible_seatings_('L',_4) _C593 -3 possible_seatings_('L',_4) _C594 -4 possible_seatings_('M',_4) Maximum_table_size_4 1 possible_seatings_('M',_4) Must_seat_M 1 possible_seatings_('M',_4) _C492 -12 possible_seatings_('M',_4) _C506 -11 possible_seatings_('M',_4) _C519 -10 possible_seatings_('M',_4) _C531 -9 possible_seatings_('M',_4) _C542 -8 possible_seatings_('M',_4) _C552 -7 possible_seatings_('M',_4) _C561 -6 possible_seatings_('M',_4) _C569 -5 possible_seatings_('M',_4) _C576 -4 possible_seatings_('M',_4) _C582 -3 possible_seatings_('M',_4) _C587 -2 possible_seatings_('M',_4) _C591 -1 possible_seatings_('M',_4) _C595 -1 possible_seatings_('M',_4) _C596 -2 possible_seatings_('M',_4) _C597 -3 possible_seatings_('N',_4) Maximum_table_size_4 1 possible_seatings_('N',_4) Must_seat_N 1 possible_seatings_('N',_4) _C493 -13 possible_seatings_('N',_4) _C507 -12 possible_seatings_('N',_4) _C520 -11 possible_seatings_('N',_4) _C532 -10 possible_seatings_('N',_4) _C543 -9 possible_seatings_('N',_4) _C553 -8 possible_seatings_('N',_4) _C562 -7 possible_seatings_('N',_4) _C570 -6 possible_seatings_('N',_4) _C577 -5 possible_seatings_('N',_4) _C583 -4 possible_seatings_('N',_4) _C588 -3 possible_seatings_('N',_4) _C592 -2 possible_seatings_('N',_4) _C595 -1 possible_seatings_('N',_4) _C598 -1 possible_seatings_('N',_4) _C599 -2 possible_seatings_('O',_4) Maximum_table_size_4 1 possible_seatings_('O',_4) Must_seat_O 1 possible_seatings_('O',_4) _C494 -14 possible_seatings_('O',_4) _C508 -13 possible_seatings_('O',_4) _C521 -12 possible_seatings_('O',_4) _C533 -11 possible_seatings_('O',_4) _C544 -10 possible_seatings_('O',_4) _C554 -9 possible_seatings_('O',_4) _C563 -8 possible_seatings_('O',_4) _C571 -7 possible_seatings_('O',_4) _C578 -6 possible_seatings_('O',_4) _C584 -5 possible_seatings_('O',_4) _C589 -4 possible_seatings_('O',_4) _C593 -3 possible_seatings_('O',_4) _C596 -2 possible_seatings_('O',_4) _C598 -1 possible_seatings_('O',_4) _C600 -1 possible_seatings_('P',_4) Maximum_table_size_4 1 possible_seatings_('P',_4) Must_seat_P 1 possible_seatings_('P',_4) _C495 -15 possible_seatings_('P',_4) _C509 -14 possible_seatings_('P',_4) _C522 -13 possible_seatings_('P',_4) _C534 -12 possible_seatings_('P',_4) _C545 -11 possible_seatings_('P',_4) _C555 -10 possible_seatings_('P',_4) _C564 -9 possible_seatings_('P',_4) _C572 -8 possible_seatings_('P',_4) _C579 -7 possible_seatings_('P',_4) _C585 -6 possible_seatings_('P',_4) _C590 -5 possible_seatings_('P',_4) _C594 -4 possible_seatings_('P',_4) _C597 -3 possible_seatings_('P',_4) _C599 -2 possible_seatings_('P',_4) _C600 -1 MARK0001 'MARKER' 'INTEND' RHS rhs Maximum_table_size_0 4 rhs Maximum_table_size_1 4 rhs Maximum_table_size_2 4 rhs Maximum_table_size_3 4 rhs Maximum_table_size_4 4 rhs Must_seat_A 1 rhs Must_seat_B 1 rhs Must_seat_C 1 rhs Must_seat_D 1 rhs Must_seat_E 1 rhs Must_seat_F 1 rhs Must_seat_G 1 rhs Must_seat_H 1 rhs Must_seat_I 1 rhs Must_seat_J 1 rhs Must_seat_K 1 rhs Must_seat_L 1 rhs Must_seat_M 1 rhs Must_seat_N 1 rhs Must_seat_O 1 rhs Must_seat_P 1 rhs _C1 -1 rhs _C10 -10 rhs _C100 -1 rhs _C101 -2 rhs _C102 -3 rhs _C103 -4 rhs _C104 -5 rhs _C105 -6 rhs _C106 -1 rhs _C107 -2 rhs _C108 -3 rhs _C109 -4 rhs _C11 -11 rhs _C110 -5 rhs _C111 -1 rhs _C112 -2 rhs _C113 -3 rhs _C114 -4 rhs _C115 -1 rhs _C116 -2 rhs _C117 -3 rhs _C118 -1 rhs _C119 -2 rhs _C12 -12 rhs _C120 -1 rhs _C121 -1 rhs _C122 -2 rhs _C123 -3 rhs _C124 -4 rhs _C125 -5 rhs _C126 -6 rhs _C127 -7 rhs _C128 -8 rhs _C129 -9 rhs _C13 -13 rhs _C130 -10 rhs _C131 -11 rhs _C132 -12 rhs _C133 -13 rhs _C134 -14 rhs _C135 -15 rhs _C136 -1 rhs _C137 -2 rhs _C138 -3 rhs _C139 -4 rhs _C14 -14 rhs _C140 -5 rhs _C141 -6 rhs _C142 -7 rhs _C143 -8 rhs _C144 -9 rhs _C145 -10 rhs _C146 -11 rhs _C147 -12 rhs _C148 -13 rhs _C149 -14 rhs _C15 -15 rhs _C150 -1 rhs _C151 -2 rhs _C152 -3 rhs _C153 -4 rhs _C154 -5 rhs _C155 -6 rhs _C156 -7 rhs _C157 -8 rhs _C158 -9 rhs _C159 -10 rhs _C16 -1 rhs _C160 -11 rhs _C161 -12 rhs _C162 -13 rhs _C163 -1 rhs _C164 -2 rhs _C165 -3 rhs _C166 -4 rhs _C167 -5 rhs _C168 -6 rhs _C169 -7 rhs _C17 -2 rhs _C170 -8 rhs _C171 -9 rhs _C172 -10 rhs _C173 -11 rhs _C174 -12 rhs _C175 -1 rhs _C176 -2 rhs _C177 -3 rhs _C178 -4 rhs _C179 -5 rhs _C18 -3 rhs _C180 -6 rhs _C181 -7 rhs _C182 -8 rhs _C183 -9 rhs _C184 -10 rhs _C185 -11 rhs _C186 -1 rhs _C187 -2 rhs _C188 -3 rhs _C189 -4 rhs _C19 -4 rhs _C190 -5 rhs _C191 -6 rhs _C192 -7 rhs _C193 -8 rhs _C194 -9 rhs _C195 -10 rhs _C196 -1 rhs _C197 -2 rhs _C198 -3 rhs _C199 -4 rhs _C2 -2 rhs _C20 -5 rhs _C200 -5 rhs _C201 -6 rhs _C202 -7 rhs _C203 -8 rhs _C204 -9 rhs _C205 -1 rhs _C206 -2 rhs _C207 -3 rhs _C208 -4 rhs _C209 -5 rhs _C21 -6 rhs _C210 -6 rhs _C211 -7 rhs _C212 -8 rhs _C213 -1 rhs _C214 -2 rhs _C215 -3 rhs _C216 -4 rhs _C217 -5 rhs _C218 -6 rhs _C219 -7 rhs _C22 -7 rhs _C220 -1 rhs _C221 -2 rhs _C222 -3 rhs _C223 -4 rhs _C224 -5 rhs _C225 -6 rhs _C226 -1 rhs _C227 -2 rhs _C228 -3 rhs _C229 -4 rhs _C23 -8 rhs _C230 -5 rhs _C231 -1 rhs _C232 -2 rhs _C233 -3 rhs _C234 -4 rhs _C235 -1 rhs _C236 -2 rhs _C237 -3 rhs _C238 -1 rhs _C239 -2 rhs _C24 -9 rhs _C240 -1 rhs _C241 -1 rhs _C242 -2 rhs _C243 -3 rhs _C244 -4 rhs _C245 -5 rhs _C246 -6 rhs _C247 -7 rhs _C248 -8 rhs _C249 -9 rhs _C25 -10 rhs _C250 -10 rhs _C251 -11 rhs _C252 -12 rhs _C253 -13 rhs _C254 -14 rhs _C255 -15 rhs _C256 -1 rhs _C257 -2 rhs _C258 -3 rhs _C259 -4 rhs _C26 -11 rhs _C260 -5 rhs _C261 -6 rhs _C262 -7 rhs _C263 -8 rhs _C264 -9 rhs _C265 -10 rhs _C266 -11 rhs _C267 -12 rhs _C268 -13 rhs _C269 -14 rhs _C27 -12 rhs _C270 -1 rhs _C271 -2 rhs _C272 -3 rhs _C273 -4 rhs _C274 -5 rhs _C275 -6 rhs _C276 -7 rhs _C277 -8 rhs _C278 -9 rhs _C279 -10 rhs _C28 -13 rhs _C280 -11 rhs _C281 -12 rhs _C282 -13 rhs _C283 -1 rhs _C284 -2 rhs _C285 -3 rhs _C286 -4 rhs _C287 -5 rhs _C288 -6 rhs _C289 -7 rhs _C29 -14 rhs _C290 -8 rhs _C291 -9 rhs _C292 -10 rhs _C293 -11 rhs _C294 -12 rhs _C295 -1 rhs _C296 -2 rhs _C297 -3 rhs _C298 -4 rhs _C299 -5 rhs _C3 -3 rhs _C30 -1 rhs _C300 -6 rhs _C301 -7 rhs _C302 -8 rhs _C303 -9 rhs _C304 -10 rhs _C305 -11 rhs _C306 -1 rhs _C307 -2 rhs _C308 -3 rhs _C309 -4 rhs _C31 -2 rhs _C310 -5 rhs _C311 -6 rhs _C312 -7 rhs _C313 -8 rhs _C314 -9 rhs _C315 -10 rhs _C316 -1 rhs _C317 -2 rhs _C318 -3 rhs _C319 -4 rhs _C32 -3 rhs _C320 -5 rhs _C321 -6 rhs _C322 -7 rhs _C323 -8 rhs _C324 -9 rhs _C325 -1 rhs _C326 -2 rhs _C327 -3 rhs _C328 -4 rhs _C329 -5 rhs _C33 -4 rhs _C330 -6 rhs _C331 -7 rhs _C332 -8 rhs _C333 -1 rhs _C334 -2 rhs _C335 -3 rhs _C336 -4 rhs _C337 -5 rhs _C338 -6 rhs _C339 -7 rhs _C34 -5 rhs _C340 -1 rhs _C341 -2 rhs _C342 -3 rhs _C343 -4 rhs _C344 -5 rhs _C345 -6 rhs _C346 -1 rhs _C347 -2 rhs _C348 -3 rhs _C349 -4 rhs _C35 -6 rhs _C350 -5 rhs _C351 -1 rhs _C352 -2 rhs _C353 -3 rhs _C354 -4 rhs _C355 -1 rhs _C356 -2 rhs _C357 -3 rhs _C358 -1 rhs _C359 -2 rhs _C36 -7 rhs _C360 -1 rhs _C361 -1 rhs _C362 -2 rhs _C363 -3 rhs _C364 -4 rhs _C365 -5 rhs _C366 -6 rhs _C367 -7 rhs _C368 -8 rhs _C369 -9 rhs _C37 -8 rhs _C370 -10 rhs _C371 -11 rhs _C372 -12 rhs _C373 -13 rhs _C374 -14 rhs _C375 -15 rhs _C376 -1 rhs _C377 -2 rhs _C378 -3 rhs _C379 -4 rhs _C38 -9 rhs _C380 -5 rhs _C381 -6 rhs _C382 -7 rhs _C383 -8 rhs _C384 -9 rhs _C385 -10 rhs _C386 -11 rhs _C387 -12 rhs _C388 -13 rhs _C389 -14 rhs _C39 -10 rhs _C390 -1 rhs _C391 -2 rhs _C392 -3 rhs _C393 -4 rhs _C394 -5 rhs _C395 -6 rhs _C396 -7 rhs _C397 -8 rhs _C398 -9 rhs _C399 -10 rhs _C4 -4 rhs _C40 -11 rhs _C400 -11 rhs _C401 -12 rhs _C402 -13 rhs _C403 -1 rhs _C404 -2 rhs _C405 -3 rhs _C406 -4 rhs _C407 -5 rhs _C408 -6 rhs _C409 -7 rhs _C41 -12 rhs _C410 -8 rhs _C411 -9 rhs _C412 -10 rhs _C413 -11 rhs _C414 -12 rhs _C415 -1 rhs _C416 -2 rhs _C417 -3 rhs _C418 -4 rhs _C419 -5 rhs _C42 -13 rhs _C420 -6 rhs _C421 -7 rhs _C422 -8 rhs _C423 -9 rhs _C424 -10 rhs _C425 -11 rhs _C426 -1 rhs _C427 -2 rhs _C428 -3 rhs _C429 -4 rhs _C43 -1 rhs _C430 -5 rhs _C431 -6 rhs _C432 -7 rhs _C433 -8 rhs _C434 -9 rhs _C435 -10 rhs _C436 -1 rhs _C437 -2 rhs _C438 -3 rhs _C439 -4 rhs _C44 -2 rhs _C440 -5 rhs _C441 -6 rhs _C442 -7 rhs _C443 -8 rhs _C444 -9 rhs _C445 -1 rhs _C446 -2 rhs _C447 -3 rhs _C448 -4 rhs _C449 -5 rhs _C45 -3 rhs _C450 -6 rhs _C451 -7 rhs _C452 -8 rhs _C453 -1 rhs _C454 -2 rhs _C455 -3 rhs _C456 -4 rhs _C457 -5 rhs _C458 -6 rhs _C459 -7 rhs _C46 -4 rhs _C460 -1 rhs _C461 -2 rhs _C462 -3 rhs _C463 -4 rhs _C464 -5 rhs _C465 -6 rhs _C466 -1 rhs _C467 -2 rhs _C468 -3 rhs _C469 -4 rhs _C47 -5 rhs _C470 -5 rhs _C471 -1 rhs _C472 -2 rhs _C473 -3 rhs _C474 -4 rhs _C475 -1 rhs _C476 -2 rhs _C477 -3 rhs _C478 -1 rhs _C479 -2 rhs _C48 -6 rhs _C480 -1 rhs _C481 -1 rhs _C482 -2 rhs _C483 -3 rhs _C484 -4 rhs _C485 -5 rhs _C486 -6 rhs _C487 -7 rhs _C488 -8 rhs _C489 -9 rhs _C49 -7 rhs _C490 -10 rhs _C491 -11 rhs _C492 -12 rhs _C493 -13 rhs _C494 -14 rhs _C495 -15 rhs _C496 -1 rhs _C497 -2 rhs _C498 -3 rhs _C499 -4 rhs _C5 -5 rhs _C50 -8 rhs _C500 -5 rhs _C501 -6 rhs _C502 -7 rhs _C503 -8 rhs _C504 -9 rhs _C505 -10 rhs _C506 -11 rhs _C507 -12 rhs _C508 -13 rhs _C509 -14 rhs _C51 -9 rhs _C510 -1 rhs _C511 -2 rhs _C512 -3 rhs _C513 -4 rhs _C514 -5 rhs _C515 -6 rhs _C516 -7 rhs _C517 -8 rhs _C518 -9 rhs _C519 -10 rhs _C52 -10 rhs _C520 -11 rhs _C521 -12 rhs _C522 -13 rhs _C523 -1 rhs _C524 -2 rhs _C525 -3 rhs _C526 -4 rhs _C527 -5 rhs _C528 -6 rhs _C529 -7 rhs _C53 -11 rhs _C530 -8 rhs _C531 -9 rhs _C532 -10 rhs _C533 -11 rhs _C534 -12 rhs _C535 -1 rhs _C536 -2 rhs _C537 -3 rhs _C538 -4 rhs _C539 -5 rhs _C54 -12 rhs _C540 -6 rhs _C541 -7 rhs _C542 -8 rhs _C543 -9 rhs _C544 -10 rhs _C545 -11 rhs _C546 -1 rhs _C547 -2 rhs _C548 -3 rhs _C549 -4 rhs _C55 -1 rhs _C550 -5 rhs _C551 -6 rhs _C552 -7 rhs _C553 -8 rhs _C554 -9 rhs _C555 -10 rhs _C556 -1 rhs _C557 -2 rhs _C558 -3 rhs _C559 -4 rhs _C56 -2 rhs _C560 -5 rhs _C561 -6 rhs _C562 -7 rhs _C563 -8 rhs _C564 -9 rhs _C565 -1 rhs _C566 -2 rhs _C567 -3 rhs _C568 -4 rhs _C569 -5 rhs _C57 -3 rhs _C570 -6 rhs _C571 -7 rhs _C572 -8 rhs _C573 -1 rhs _C574 -2 rhs _C575 -3 rhs _C576 -4 rhs _C577 -5 rhs _C578 -6 rhs _C579 -7 rhs _C58 -4 rhs _C580 -1 rhs _C581 -2 rhs _C582 -3 rhs _C583 -4 rhs _C584 -5 rhs _C585 -6 rhs _C586 -1 rhs _C587 -2 rhs _C588 -3 rhs _C589 -4 rhs _C59 -5 rhs _C590 -5 rhs _C591 -1 rhs _C592 -2 rhs _C593 -3 rhs _C594 -4 rhs _C595 -1 rhs _C596 -2 rhs _C597 -3 rhs _C598 -1 rhs _C599 -2 rhs _C6 -6 rhs _C60 -6 rhs _C600 -1 rhs _C61 -7 rhs _C62 -8 rhs _C63 -9 rhs _C64 -10 rhs _C65 -11 rhs _C66 -1 rhs _C67 -2 rhs _C68 -3 rhs _C69 -4 rhs _C7 -7 rhs _C70 -5 rhs _C71 -6 rhs _C72 -7 rhs _C73 -8 rhs _C74 -9 rhs _C75 -10 rhs _C76 -1 rhs _C77 -2 rhs _C78 -3 rhs _C79 -4 rhs _C8 -8 rhs _C80 -5 rhs _C81 -6 rhs _C82 -7 rhs _C83 -8 rhs _C84 -9 rhs _C85 -1 rhs _C86 -2 rhs _C87 -3 rhs _C88 -4 rhs _C89 -5 rhs _C9 -9 rhs _C90 -6 rhs _C91 -7 rhs _C92 -8 rhs _C93 -1 rhs _C94 -2 rhs _C95 -3 rhs _C96 -4 rhs _C97 -5 rhs _C98 -6 rhs _C99 -7 BOUNDS UP bnd possible_seatings_('A',_0) 1 UP bnd possible_seatings_('B',_0) 1 UP bnd possible_seatings_('C',_0) 1 UP bnd possible_seatings_('D',_0) 1 UP bnd possible_seatings_('E',_0) 1 UP bnd possible_seatings_('F',_0) 1 UP bnd possible_seatings_('G',_0) 1 UP bnd possible_seatings_('H',_0) 1 UP bnd possible_seatings_('I',_0) 1 UP bnd possible_seatings_('J',_0) 1 UP bnd possible_seatings_('K',_0) 1 UP bnd possible_seatings_('L',_0) 1 UP bnd possible_seatings_('M',_0) 1 UP bnd possible_seatings_('N',_0) 1 UP bnd possible_seatings_('O',_0) 1 UP bnd possible_seatings_('P',_0) 1 UP bnd possible_seatings_('A',_1) 1 UP bnd possible_seatings_('B',_1) 1 UP bnd possible_seatings_('C',_1) 1 UP bnd possible_seatings_('D',_1) 1 UP bnd possible_seatings_('E',_1) 1 UP bnd possible_seatings_('F',_1) 1 UP bnd possible_seatings_('G',_1) 1 UP bnd possible_seatings_('H',_1) 1 UP bnd possible_seatings_('I',_1) 1 UP bnd possible_seatings_('J',_1) 1 UP bnd possible_seatings_('K',_1) 1 UP bnd possible_seatings_('L',_1) 1 UP bnd possible_seatings_('M',_1) 1 UP bnd possible_seatings_('N',_1) 1 UP bnd possible_seatings_('O',_1) 1 UP bnd possible_seatings_('P',_1) 1 UP bnd possible_seatings_('A',_2) 1 UP bnd possible_seatings_('B',_2) 1 UP bnd possible_seatings_('C',_2) 1 UP bnd possible_seatings_('D',_2) 1 UP bnd possible_seatings_('E',_2) 1 UP bnd possible_seatings_('F',_2) 1 UP bnd possible_seatings_('G',_2) 1 UP bnd possible_seatings_('H',_2) 1 UP bnd possible_seatings_('I',_2) 1 UP bnd possible_seatings_('J',_2) 1 UP bnd possible_seatings_('K',_2) 1 UP bnd possible_seatings_('L',_2) 1 UP bnd possible_seatings_('M',_2) 1 UP bnd possible_seatings_('N',_2) 1 UP bnd possible_seatings_('O',_2) 1 UP bnd possible_seatings_('P',_2) 1 UP bnd possible_seatings_('A',_3) 1 UP bnd possible_seatings_('B',_3) 1 UP bnd possible_seatings_('C',_3) 1 UP bnd possible_seatings_('D',_3) 1 UP bnd possible_seatings_('E',_3) 1 UP bnd possible_seatings_('F',_3) 1 UP bnd possible_seatings_('G',_3) 1 UP bnd possible_seatings_('H',_3) 1 UP bnd possible_seatings_('I',_3) 1 UP bnd possible_seatings_('J',_3) 1 UP bnd possible_seatings_('K',_3) 1 UP bnd possible_seatings_('L',_3) 1 UP bnd possible_seatings_('M',_3) 1 UP bnd possible_seatings_('N',_3) 1 UP bnd possible_seatings_('O',_3) 1 UP bnd possible_seatings_('P',_3) 1 UP bnd possible_seatings_('A',_4) 1 UP bnd possible_seatings_('B',_4) 1 UP bnd possible_seatings_('C',_4) 1 UP bnd possible_seatings_('D',_4) 1 UP bnd possible_seatings_('E',_4) 1 UP bnd possible_seatings_('F',_4) 1 UP bnd possible_seatings_('G',_4) 1 UP bnd possible_seatings_('H',_4) 1 UP bnd possible_seatings_('I',_4) 1 UP bnd possible_seatings_('J',_4) 1 UP bnd possible_seatings_('K',_4) 1 UP bnd possible_seatings_('L',_4) 1 UP bnd possible_seatings_('M',_4) 1 UP bnd possible_seatings_('N',_4) 1 UP bnd possible_seatings_('O',_4) 1 UP bnd possible_seatings_('P',_4) 1 ENDATA CoinMP-1.8.3/Data/Sample/bug.stoch0000755000175000017500000000060511015552002015220 0ustar renereneNAME BUG SCENARIOS DISCRETE REPLACE SC SCEN01 ROOT 0.500 STG02 RHS C1 1.000 RHS C2 1.000 RHS C3 0.000 SC SCEN02 ROOT 0.500 STG02 RHS C1 0.000 RHS C2 1.000 RHS C3 0.000 ENDATA CoinMP-1.8.3/Data/Sample/tp4.mps0000644000175000017500000000232710430174061014636 0ustar renerene* * small test problem - tp4.mps * * knapsack problem where lifted greedy cover cut * moves lp objective function value * NAME tp4 ROWS N obj L knap G r1 G r2 G r3 COLUMNS SET00001 'MARKER' 'INTORG' x1 knap 8.000000 x1 r1 1.000000 x2 knap 7.000000 x2 r2 1.000000 x3 knap 6.000000 x3 r3 1.000000 x4 knap 4.000000 x4 obj -1.000000 x5 knap 6.000000 x5 obj -100.000000 x6 knap 13.500000 x6 obj -100.000000 RHS RHS knap 22.000000 RHS r1 0.001000 RHS r2 0.001000 RHS r3 0.001000 BOUNDS BV ONE x1 1.000000 BV ONE x2 1.000000 BV ONE x3 1.000000 BV ONE x4 1.000000 BV ONE x5 1.000000 BV ONE x6 1.000000 ENDATA CoinMP-1.8.3/Data/Sample/finnis.mps0000644000175000017500000030727410662211140015423 0ustar renereneNAME FINNIS (PTABLES3) ROWS N PRICER G 1BALHCO G 1BALCOK G 1BALOIK G 1BALOIL G 1BALGSL G 1BALDSL G 1BALDSH G 1BALDSR G 1BALGAK G 1BALGAS G 1BALALC G 1BALHYD G 1BALURN G 1BALUDP G 1BALPLU G 1BALMAG G 1BALAGR G 1BALAGS G 1BALLMF G 1BALLMS G 2BALHCO G 2BALCOK G 2BALOIK G 2BALOIL G 2BALGSL G 2BALDSL G 2BALDSH G 2BALDSR G 2BALGAK G 2BALGAS G 2BALALC G 2BALHYD G 2BALURN G 2BALUDP G 2BALPLU G 2BALMAG G 2BALAGR G 2BALAGS G 2BALLMF G 2BALLMS G 3BALHCO G 3BALCOK G 3BALOIK G 3BALOIL G 3BALGSL G 3BALDSL G 3BALDSH G 3BALDSR G 3BALGAK G 3BALGAS G 3BALALC G 3BALHYD G 3BALURN G 3BALUDP G 3BALPLU G 3BALMAG G 3BALAGR G 3BALAGS G 3BALLMF G 3BALLMS E 1CPTEC3 E 1CPTEP1 E 1CPTE14 E 1CPTE22 E 1CPTE23 E 1CPTE31 E 1CPTE51 E 1CPTS06 E 1CPTS08 E 1CPTS09 E 1CPTS21 E 1CPTS23 E 1CPTS28 E 2CPTEC3 E 2CPTEP1 E 2CPTE14 E 2CPTE22 E 2CPTE23 E 2CPTE31 E 2CPTE35 E 2CPTE51 E 2CPTS06 E 2CPTS08 E 2CPTS09 E 2CPTS21 E 2CPTS23 E 2CPTS28 E 3CPTEC3 E 3CPTEP1 E 3CPTE14 E 3CPTE22 E 3CPTE23 E 3CPTE31 E 3CPTE35 E 3CPTE94 E 3CPTE60 E 3CPTE51 E 3CPTS01 E 3CPTS04 E 3CPTS06 E 3CPTS08 E 3CPTS09 E 3CPTS21 E 3CPTS23 E 3CPTS28 E 3CPTS29 E 3CPTS80 L 1CPTIJ6 L 1CPTIJ7 L 1CPTIJ8 L 1CPTR20 L 1CPTR21 L 1CPTR23 L 1CPTR27 L 1CPTR28 L 1CPTR2D L 1CPTR2L L 1CPTRT0 L 1CPTRT1 L 1CPTRT3 L 1CPTRT7 L 1CPTRT8 L 1CPTR50 L 1CPTR51 L 1CPTR53 L 1CPTR57 L 1CPTR58 L 1CPTR5H L 1CPTR5L L 1CPTR5M L 2CPTIJ6 L 2CPTIJ7 L 2CPTIJ8 L 2CPTR20 L 2CPTR21 L 2CPTR23 L 2CPTR27 L 2CPTR28 L 2CPTR2A L 2CPTR2B L 2CPTR2C L 2CPTR2D L 2CPTR2L L 2CPTRT0 L 2CPTRT1 L 2CPTRT3 L 2CPTRT7 L 2CPTRT8 L 2CPTRTB L 2CPTRTC L 2CPTR50 L 2CPTR51 L 2CPTR53 L 2CPTR57 L 2CPTR58 L 2CPTR5A L 2CPTR5H L 2CPTR5L L 2CPTR5M L 3CPTIJ6 L 3CPTIJ7 L 3CPTIJ8 L 3CPTR20 L 3CPTR21 L 3CPTR23 L 3CPTR27 L 3CPTR28 L 3CPTR2A L 3CPTR2B L 3CPTR2C L 3CPTR2D L 3CPTR2L L 3CPTRT0 L 3CPTRT1 L 3CPTRT3 L 3CPTRT7 L 3CPTRT8 L 3CPTRTB L 3CPTRTC L 3CPTR50 L 3CPTR51 L 3CPTR53 L 3CPTR57 L 3CPTR58 L 3CPTR5A L 3CPTR5C L 3CPTR5H L 3CPTR5L L 3CPTR5M L 3GRCE35 L 2GRCT80 L 3GRCT80 G 1DEMI1 G 1DEMII G 1DEMIJ G 1DEMNY G 1DEMR2 G 1DEMRT G 1DEMR5 G 1DEMRD G 1DEMT8 G 1DEMTX G 2DEMI1 G 2DEMII G 2DEMIJ G 2DEMNY G 2DEMR2 G 2DEMRT G 2DEMR5 G 2DEMRD G 2DEMT8 G 2DEMTX G 3DEMI1 G 3DEMII G 3DEMIJ G 3DEMNY G 3DEMR2 G 3DEMRT G 3DEMR5 G 3DEMRD G 3DEMT8 G 3DEMTX L 1UTLS06 L 1UTLS08 L 1UTLS09 L 1UTLS21 L 1UTLS23 L 1UTLS28 L 2UTLS06 L 2UTLS08 L 2UTLS09 L 2UTLS21 L 2UTLS23 L 2UTLS28 L 3UTLS01 L 3UTLS04 L 3UTLS06 L 3UTLS08 L 3UTLS09 L 3UTLS21 L 3UTLS23 L 3UTLS28 L 3UTLS29 L 3UTLS80 G 1UTLEC1 G 1UTLEC2 G 1UTLEP1 G 1UTLE22 G 1UTLE23 G 2UTLEC1 G 2UTLEC2 G 2UTLEP1 G 2UTLE22 G 2UTLE23 G 3UTLEC1 G 3UTLEC2 G 3UTLEP1 G 3UTLE22 G 3UTLE23 G 1BNDEP1L G 2BNDEP1L G 1BALEWD G 1BALEWN G 1BALEID G 1BALEIN G 1BALESD G 1BALESN G 2BALEWD G 2BALEWN G 2BALEID G 2BALEIN G 2BALESD G 2BALESN G 3BALEWD G 3BALEWN G 3BALEID G 3BALEIN G 3BALESD G 3BALESN G 1EPKWD G 1EPKSD G 2EPKWD G 2EPKSD G 3EPKWD G 3EPKSD L 1EWDEC1 L 1EWDEC2 L 1EWDEC3 L 1EWDEP1 L 1EWDE14 L 1EWDE22 L 1EWDE23 L 1EWDE31 L 1EWDE51 L 1EIDEC1 L 1EIDEC2 L 1EIDEC3 L 1EIDEP1 L 1EIDE14 L 1EIDE22 L 1EIDE23 L 1EIDE31 L 1EIDE51 L 1ESDEC1 L 1ESDEC2 L 1ESDEC3 L 1ESDEP1 L 1ESDE14 L 1ESDE22 L 1ESDE23 L 1ESDE31 L 1ESDE51 L 2EWDEC1 L 2EWDEC2 L 2EWDEC3 L 2EWDEP1 L 2EWDE14 L 2EWDE22 L 2EWDE23 L 2EWDE31 L 2EWDE35 L 2EWDE51 L 2EIDEC1 L 2EIDEC2 L 2EIDEC3 L 2EIDEP1 L 2EIDE14 L 2EIDE22 L 2EIDE23 L 2EIDE31 L 2EIDE35 L 2EIDE51 L 2ESDEC1 L 2ESDEC2 L 2ESDEC3 L 2ESDEP1 L 2ESDE14 L 2ESDE22 L 2ESDE23 L 2ESDE31 L 2ESDE35 L 2ESDE51 L 3EWDEC1 L 3EWDEC2 L 3EWDEC3 L 3EWDEP1 L 3EWDE14 L 3EWDE22 L 3EWDE23 L 3EWDE31 L 3EWDE35 L 3EWDE94 L 3EWDE60 L 3EWDE51 L 3EIDEC1 L 3EIDEC2 L 3EIDEC3 L 3EIDEP1 L 3EIDE14 L 3EIDE22 L 3EIDE23 L 3EIDE31 L 3EIDE35 L 3EIDE94 L 3EIDE60 L 3EIDE51 L 3ESDEC1 L 3ESDEC2 L 3ESDEC3 L 3ESDEP1 L 3ESDE14 L 3ESDE22 L 3ESDE23 L 3ESDE31 L 3ESDE35 L 3ESDE94 L 3ESDE60 L 3ESDE51 L 1EWNEC1 L 1EWNEC2 L 1EWNEC3 L 1EWNEP1 L 1EWNE14 L 1EWNE31 L 1EINEC1 L 1EINEC2 L 1EINEC3 L 1EINEP1 L 1EINE14 L 1EINE31 L 1ESNEC1 L 1ESNEC2 L 1ESNEC3 L 1ESNEP1 L 1ESNE14 L 1ESNE31 L 2EWNEC1 L 2EWNEC2 L 2EWNEC3 L 2EWNEP1 L 2EWNE14 L 2EWNE31 L 2EWNE35 L 2EINEC1 L 2EINEC2 L 2EINEC3 L 2EINEP1 L 2EINE14 L 2EINE31 L 2EINE35 L 2ESNEC1 L 2ESNEC2 L 2ESNEC3 L 2ESNEP1 L 2ESNE14 L 2ESNE31 L 2ESNE35 L 3EWNEC1 L 3EWNEC2 L 3EWNEC3 L 3EWNEP1 L 3EWNE14 L 3EWNE31 L 3EWNE35 L 3EWNE94 L 3EWNE60 L 3EINEC1 L 3EINEC2 L 3EINEC3 L 3EINEP1 L 3EINE14 L 3EINE31 L 3EINE35 L 3EINE94 L 3EINE60 L 3ESNEC1 L 3ESNEC2 L 3ESNEC3 L 3ESNEP1 L 3ESNE14 L 3ESNE31 L 3ESNE35 L 3ESNE94 L 3ESNE60 L 1BASW L 1BASI L 1BASS L 2BASW L 2BASI L 2BASS L 3BASW L 3BASI L 3BASS G 2BALDHW G 2BALDHI G 2BALDHS G 3BALDHW G 3BALDHI G 3BALDHS G 2HPKW G 3HPKW G 1RAT001 G 2RAT001 G 3RAT001 G 1RAT002 G 2RAT002 G 3RAT002 G 1RAT003 G 2RAT003 G 3RAT003 L 1RAT004 L 2RAT004 L 3RAT004 L 1RAT005 L 2RAT005 L 3RAT005 L 1RAT006 L 2RAT006 L 3RAT006 L 1RAT007 L 2RAT007 L 3RAT007 L 2RAT008 L 3RAT008 L 2RAT009 L 3RAT009 L 1RAT010 L 2RAT010 L 3RAT010 L 1RAT011 L 2RAT011 L 3RAT011 L 2RAT012 L 3RAT012 L 1RAT013 L 2RAT013 L 3RAT013 COLUMNS 1MINHCO1 PRICER 10.330608 1BALHCO 1. 1MINHCO1 1BALEWD -.000659 1BALEWN -.000659 1MINHCO1 1BALEID -.000857 1BALEIN -.000461 1MINHCO1 1BALESD -.002834 1BALESN -.00112 1MINHCO1 1EPKWD -.00659 1EPKSD -.00659 2MINHCO1 PRICER 9.170958 2BALHCO 1. 2MINHCO1 2BALEWD -.000659 2BALEWN -.000659 2MINHCO1 2BALEID -.000857 2BALEIN -.000461 2MINHCO1 2BALESD -.002834 2BALESN -.00112 2MINHCO1 2EPKWD -.00659 2EPKSD -.00659 3MINHCO1 PRICER 7.93182 3BALHCO 1. 3MINHCO1 3BALEWD -.000659 3BALEWN -.000659 3MINHCO1 3BALEID -.000857 3BALEIN -.000461 3MINHCO1 3BALESD -.002834 3BALESN -.00112 3MINHCO1 3EPKWD -.00659 3EPKSD -.00659 1IMPHCO1 PRICER 16.167389 1BALHCO 1. 2IMPHCO1 PRICER 13.355014 2BALHCO 1. 3IMPHCO1 PRICER 10.93149 3BALHCO 1. 1EXPHCO1 PRICER -16.167389 1BALHCO -1. 2EXPHCO1 PRICER -13.355014 2BALHCO -1. 3EXPHCO1 PRICER -10.93149 3BALHCO -1. 1IMPOIL1 PRICER 27.995941 1BALOIL 1. 2IMPOIL1 PRICER 22.001038 2BALOIL 1. 3IMPOIL1 PRICER 17.248093 3BALOIL 1. 1EXPOIL1 PRICER -27.995941 1BALOIL -1. 2EXPOIL1 PRICER -22.001038 2BALOIL -1. 3EXPOIL1 PRICER -17.248093 3BALOIL -1. 1STKOIK1 1BALOIK 1. 1RAT011 -1. 2STKOIK1 2BALOIK 1. 1BALOIK -1. 2STKOIK1 2RAT011 -1. 3STKOIK1 3BALOIK 1. 2BALOIK -1. 3STKOIK1 3RAT011 -1. ZSTKOIK1 3BALOIK -1. 1EXPDSH1 1BALDSH -1. 2EXPDSH1 2BALDSH -1. 3EXPDSH1 3BALDSH -1. 1EXPDSL1 1BALDSL -1. 2EXPDSL1 2BALDSL -1. 3EXPDSL1 3BALDSL -1. 1IMPGAS1 PRICER 19.886414 1BALGAS .95 2IMPGAS1 PRICER 18.295593 2BALGAS .95 3IMPGAS1 PRICER 16.238586 3BALGAS .95 1EXPGAS1 PRICER -19.886414 1BALGAS -1. 2EXPGAS1 PRICER -18.295593 2BALGAS -1. 3EXPGAS1 PRICER -16.238586 3BALGAS -1. 1STKGAK1 1BALGAK 1. 1RAT010 -1. 2STKGAK1 2BALGAK 1. 1BALGAK -1. 2STKGAK1 2RAT010 -1. 3STKGAK1 3BALGAK 1. 2BALGAK -1. 3STKGAK1 3RAT010 -1. ZSTKGAK1 3BALGAK -1. 1IMPURN1 PRICER .537191 1BALURN 1. 2IMPURN1 PRICER .401422 2BALURN 1. 3IMPURN1 PRICER .299967 3BALURN 1. 1STKURN1 1BALURN 1. 2STKURN1 2BALURN 1. 1BALURN -1. 3STKURN1 3BALURN 1. 2BALURN -1. ZSTKURN1 3BALURN -1. 1STKUDP1 1BALUDP 1. 2STKUDP1 2BALUDP 1. 1BALUDP -1. 3STKUDP1 3BALUDP 1. 2BALUDP -1. ZSTKUDP1 3BALUDP -1. 1STKPLU1 1BALPLU 1. 2STKPLU1 2BALPLU 1. 1BALPLU -1. 3STKPLU1 3BALPLU 1. 2BALPLU -1. ZSTKPLU1 3BALPLU -1. 1STKAGS1 1BALAGS 1. 2STKAGS1 2BALAGS 1. 1BALAGS -1. 3STKAGS1 3BALAGS 1. 2BALAGS -1. ZSTKAGS1 3BALAGS -1. 1STKLMS1 1BALLMS 1. 2STKLMS1 2BALLMS 1. 1BALLMS -1. 3STKLMS1 3BALLMS 1. 2BALLMS -1. ZSTKLMS1 3BALLMS -1. 1EC3INV PRICER 2240.95752 1CPTEC3 -1. 1EC3INV 2CPTEC3 -1. 3CPTEC3 -1. 2EC3INV PRICER 1269.021484 2CPTEC3 -1. 2EC3INV 3CPTEC3 -1. 3EC3INV PRICER 542.729248 3CPTEC3 -1. 1EP1INV PRICER 2188.71875 1CPTEP1 -1. 1EP1INV 2CPTEP1 -1. 3CPTEP1 -1. 2EP1INV PRICER 1239.439453 2CPTEP1 -1. 2EP1INV 3CPTEP1 -1. 3EP1INV PRICER 530.077637 3CPTEP1 -1. 1E14INV PRICER 1783.052734 1CPTE14 -1. 1E14INV 2CPTE14 -1. 3CPTE14 -1. 2E14INV PRICER 1009.716797 2CPTE14 -1. 2E14INV 3CPTE14 -1. 3E14INV PRICER 431.830811 3CPTE14 -1. 1E22INV PRICER 1260.778809 1CPTE22 -1. 1E22INV 2CPTE22 -1. 3CPTE22 -1. 2E22INV PRICER 713.960449 2CPTE22 -1. 2E22INV 3CPTE22 -1. 3E22INV PRICER 305.343506 3CPTE22 -1. 1E23INV PRICER 4029.3042 1CPTE23 -1. 1E23INV 2CPTE23 -1. 3CPTE23 -1. 2E23INV PRICER 2281.73584 1BALAGR -11.662 2E23INV 2CPTE23 -1. 3CPTE23 -1. 3E23INV PRICER 975.842285 2BALAGR -11.662 3E23INV 3CPTE23 -1. 1E31INV PRICER .00001 1CPTE31 -1. 1E31INV 2CPTE31 -1. 3CPTE31 -1. 2E31INV PRICER .00001 2CPTE31 -1. 2E31INV 3CPTE31 -1. 3E31INV PRICER .00001 3CPTE31 -1. 2E35INV PRICER .00001 2CPTE35 -1. 2E35INV 3CPTE35 -1. 3E35INV PRICER .00001 3CPTE35 -1. 3E94INV PRICER 369.621338 3CPTE94 -1. 3E60INV PRICER 721.590332 3CPTE60 -1. 1E51INV PRICER 814.03125 1CPTE51 -1. 1E51INV 2CPTE51 -1. 3CPTE51 -1. 2E51INV PRICER 460.973877 2CPTE51 -1. 2E51INV 3CPTE51 -1. 3E51INV PRICER 197.147232 3CPTE51 -1. 3S01INV PRICER 2.182532 3CPTS01 -1. 3S04INV PRICER 2.932184 3CPTS04 -1. 1S06INV 1CPTS06 -1. 2CPTS06 -1. 1S06INV 3CPTS06 -1. 2S06INV 2CPTS06 -1. 3CPTS06 -1. 3S06INV 3CPTS06 -1. 1S08INV PRICER 2.611933 1CPTS08 -1. 1S08INV 2CPTS08 -1. 3CPTS08 -1. 2S08INV PRICER 1.4791 2CPTS08 -1. 2S08INV 3CPTS08 -1. 3S08INV PRICER .632575 3CPTS08 -1. 1S09INV PRICER 6.203342 1CPTS09 -1. 1S09INV 2CPTS09 -1. 3CPTS09 -1. 2S09INV PRICER 3.512862 2CPTS09 -1. 2S09INV 3CPTS09 -1. 3S09INV PRICER 1.502365 3CPTS09 -1. 1S21INV PRICER 5.800726 1CPTS21 -1. 1S21INV 2CPTS21 -1. 3CPTS21 -1. 2S21INV PRICER 3.284866 2CPTS21 -1. 2S21INV 3CPTS21 -1. 3S21INV PRICER 1.404856 3CPTS21 -1. 1S23INV PRICER 5.273388 1CPTS23 -1. 1S23INV 2CPTS23 -1. 3CPTS23 -1. 2S23INV PRICER 2.986242 2CPTS23 -1. 2S23INV 3CPTS23 -1. 3S23INV PRICER 1.277142 3CPTS23 -1. 1S28INV PRICER 2.109354 1CPTS28 -1. 1S28INV 2CPTS28 -1. 3CPTS28 -1. 2S28INV PRICER 1.194496 2CPTS28 -1. 2S28INV 3CPTS28 -1. 3S28INV PRICER .510857 3CPTS28 -1. 3S29INV PRICER 1.532571 3CPTS29 -1. 3S80INV PRICER 1.870049 3CPTS80 -1. 1IJ6INV PRICER 1.43445 1CPTIJ6 -1. 1IJ6INV 2CPTIJ6 -1. 3CPTIJ6 -1. 2IJ6INV PRICER .812309 2CPTIJ6 -1. 2IJ6INV 3CPTIJ6 -1. 3IJ6INV PRICER .347404 3CPTIJ6 -1. 1IJ7INV PRICER 1.43445 1CPTIJ7 -1. 1IJ7INV 2CPTIJ7 -1. 3CPTIJ7 -1. 2IJ7INV PRICER .812309 2CPTIJ7 -1. 2IJ7INV 3CPTIJ7 -1. 3IJ7INV PRICER .347404 3CPTIJ7 -1. 1IJ8INV PRICER 4.944228 1CPTIJ8 -1. 1IJ8INV 2CPTIJ8 -1. 3CPTIJ8 -1. 2IJ8INV PRICER 2.799844 2CPTIJ8 -1. 2IJ8INV 3CPTIJ8 -1. 3IJ8INV PRICER 1.197424 3CPTIJ8 -1. 1R20INV PRICER 19.863083 1CPTR20 -1. 1R20INV 2CPTR20 -1. 3CPTR20 -1. 2R20INV PRICER 11.248174 2CPTR20 -1. 2R20INV 3CPTR20 -1. 3R20INV PRICER 4.810567 3CPTR20 -1. 1R21INV PRICER 11.053495 1CPTR21 -1. 1R21INV 2CPTR21 -1. 3CPTR21 -1. 2R21INV PRICER 6.259433 2CPTR21 -1. 2R21INV 3CPTR21 -1. 3R21INV PRICER 2.677005 3CPTR21 -1. 1R23INV PRICER 53.349091 1CPTR23 -1. 1R23INV 2CPTR23 -1. 3CPTR23 -1. 2R23INV PRICER 30.210815 2CPTR23 -1. 2R23INV 3CPTR23 -1. 3R23INV PRICER 12.920424 3CPTR23 -1. 1R27INV PRICER 39.374603 1CPTR27 -1. 1R27INV 2CPTR27 -1. 3CPTR27 -1. 2R27INV PRICER 22.297272 2CPTR27 -1. 2R27INV 3CPTR27 -1. 3R27INV PRICER 9.536002 3CPTR27 -1. 1R28INV PRICER 54.491653 1CPTR28 -1. 1R28INV 2CPTR28 -1. 3CPTR28 -1. 2R28INV PRICER 30.857819 2CPTR28 -1. 2R28INV 3CPTR28 -1. 3R28INV PRICER 13.197139 3CPTR28 -1. 2R2AINV PRICER .00001 2CPTR2A -1. 2R2AINV 3CPTR2A -1. 3R2AINV PRICER .00001 3CPTR2A -1. 2R2BINV PRICER .00001 2CPTR2B -1. 2R2BINV 3CPTR2B -1. 3R2BINV PRICER .00001 3CPTR2B -1. 2R2CINV PRICER 20.4711 2CPTR2C -1. 2R2CINV 3CPTR2C -1. 3R2CINV PRICER 8.755 3CPTR2C -1. 1R2DINV PRICER .00001 1CPTR2D -1. 1R2DINV 2CPTR2D -1. 3CPTR2D -1. 2R2DINV PRICER .00001 2CPTR2D -1. 2R2DINV 3CPTR2D -1. 3R2DINV PRICER .00001 3CPTR2D -1. 1R2LINV PRICER 55.615082 1CPTR2L -1. 1R2LINV 2CPTR2L -1. 3CPTR2L -1. 2R2LINV PRICER 31.494003 2CPTR2L -1. 2R2LINV 3CPTR2L -1. 3R2LINV PRICER 13.469211 3CPTR2L -1. 1RT0INV PRICER 19.863083 1CPTRT0 -1. 1RT0INV 2CPTRT0 -1. 3CPTRT0 -1. 2RT0INV PRICER 11.248174 2CPTRT0 -1. 2RT0INV 3CPTRT0 -1. 3RT0INV PRICER 4.810567 3CPTRT0 -1. 1RT1INV PRICER 11.053495 1CPTRT1 -1. 1RT1INV 2CPTRT1 -1. 3CPTRT1 -1. 2RT1INV PRICER 6.259433 2CPTRT1 -1. 2RT1INV 3CPTRT1 -1. 3RT1INV PRICER 2.677005 3CPTRT1 -1. 1RT3INV PRICER 53.349091 1CPTRT3 -1. 1RT3INV 2CPTRT3 -1. 3CPTRT3 -1. 2RT3INV PRICER 30.210815 2CPTRT3 -1. 2RT3INV 3CPTRT3 -1. 3RT3INV PRICER 12.920424 3CPTRT3 -1. 1RT7INV PRICER 39.374603 1CPTRT7 -1. 1RT7INV 2CPTRT7 -1. 3CPTRT7 -1. 2RT7INV PRICER 22.297272 2CPTRT7 -1. 2RT7INV 3CPTRT7 -1. 3RT7INV PRICER 9.536002 3CPTRT7 -1. 1RT8INV PRICER 54.491653 1CPTRT8 -1. 1RT8INV 2CPTRT8 -1. 3CPTRT8 -1. 2RT8INV PRICER 30.857819 2CPTRT8 -1. 2RT8INV 3CPTRT8 -1. 3RT8INV PRICER 13.197139 3CPTRT8 -1. 2RTBINV PRICER .00001 2CPTRTB -1. 2RTBINV 3CPTRTB -1. 3RTBINV PRICER .00001 3CPTRTB -1. 2RTCINV PRICER 20.4711 2CPTRTC -1. 2RTCINV 3CPTRTC -1. 3RTCINV PRICER 8.755 3CPTRTC -1. 1R50INV PRICER 17.226379 1CPTR50 -1. 1R50INV 2CPTR50 -1. 3CPTR50 -1. 2R50INV PRICER 9.755052 2CPTR50 -1. 2R50INV 3CPTR50 -1. 3R50INV PRICER 4.172 3CPTR50 -1. 1R51INV PRICER 8.560434 1CPTR51 -1. 1R51INV 2CPTR51 -1. 3CPTR51 -1. 2R51INV PRICER 4.847649 2CPTR51 -1. 2R51INV 3CPTR51 -1. 3R51INV PRICER 2.073219 3CPTR51 -1. 1R53INV PRICER 53.349091 1CPTR53 -1. 1R53INV 2CPTR53 -1. 3CPTR53 -1. 2R53INV PRICER 30.210815 2CPTR53 -1. 2R53INV 3CPTR53 -1. 3R53INV PRICER 12.920424 3CPTR53 -1. 1R57INV PRICER 39.374603 1CPTR57 -1. 1R57INV 2CPTR57 -1. 3CPTR57 -1. 2R57INV PRICER 22.297272 2CPTR57 -1. 2R57INV 3CPTR57 -1. 3R57INV PRICER 9.536002 3CPTR57 -1. 1R58INV PRICER 54.491653 1CPTR58 -1. 1R58INV 2CPTR58 -1. 3CPTR58 -1. 2R58INV PRICER 30.857819 2CPTR58 -1. 2R58INV 3CPTR58 -1. 3R58INV PRICER 13.197139 3CPTR58 -1. 2R5AINV PRICER .00001 2CPTR5A -1. 2R5AINV 3CPTR5A -1. 3R5AINV PRICER .00001 3CPTR5A -1. 3R5CINV PRICER 8.755 3CPTR5C -1. 1R5HINV PRICER 101.799759 1CPTR5H -1. 1R5HINV 2CPTR5H -1. 3CPTR5H -1. 2R5HINV PRICER 57.647705 2CPTR5H -1. 2R5HINV 3CPTR5H -1. 3R5HINV PRICER 24.654495 3CPTR5H -1. 1R5LINV PRICER 17.120865 1CPTR5L -1. 1R5LINV 2CPTR5L -1. 3CPTR5L -1. 2R5LINV PRICER 9.695297 2CPTR5L -1. 2R5LINV 3CPTR5L -1. 3R5LINV PRICER 4.146439 3CPTR5L -1. 1R5MINV PRICER 17.120865 1CPTR5M -1. 1R5MINV 2CPTR5M -1. 3CPTR5M -1. 2R5MINV PRICER 9.695297 2CPTR5M -1. 2R5MINV 3CPTR5M -1. 3R5MINV PRICER 4.146439 3CPTR5M -1. 1I1YCAP 1BALHCO -.0135 1BALCOK -.4268 1I1YCAP 1BALDSL -.0323 1BALDSH -.1983 1I1YCAP 1BALGAS -.2186 1DEMI1 1. 1I1YCAP 1BALEWD -.014242 1BALEWN -.01104 1I1YCAP 1BALEID -.016781 1BALEIN -.006182 1I1YCAP 1BALESD -.048907 1BALESN -.013248 1I1YCAP 1EPKWD -.142416 1EPKSD -.113738 2I1YCAP 2BALHCO -.0165 2BALCOK -.5198 2I1YCAP 2BALDSL -.0212 2BALDSH -.1305 2I1YCAP 2BALGAS -.1977 2DEMI1 1. 2I1YCAP 2BALEWD -.014758 2BALEWN -.01144 2I1YCAP 2BALEID -.017389 2BALEIN -.006406 2I1YCAP 2BALESD -.050679 2BALESN -.013728 2I1YCAP 2EPKWD -.147576 2EPKSD -.117859 3I1YCAP 3BALHCO -.0194 3BALCOK -.6166 3I1YCAP 3BALDSL -.0102 3BALDSH -.0628 3I1YCAP 3BALGAS -.1777 3DEMI1 1. 3I1YCAP 3BALEWD -.015261 3BALEWN -.01183 3I1YCAP 3BALEID -.017982 3BALEIN -.006625 3I1YCAP 3BALESD -.052407 3BALESN -.014196 3I1YCAP 3EPKWD -.152607 3EPKSD -.121876 1IIYCAP 1BALHCO -.1313 1BALCOK -.027 1IIYCAP 1BALDSL -.2811 1BALGAS -.2555 1IIYCAP 1DEMII 1. 1BALEWD -.039358 1IIYCAP 1BALEWN -.03051 1BALEID -.046375 1IIYCAP 1BALEIN -.017086 1BALESD -.135159 1IIYCAP 1BALESN -.036612 1EPKWD -.393579 1IIYCAP 1EPKSD -.314324 2IIYCAP 2BALHCO -.1549 2BALCOK -.0318 2IIYCAP 2BALDSL -.2619 2BALGAS -.2453 2IIYCAP 2DEMII 1. 2BALEWD -.039487 2IIYCAP 2BALEWN -.03061 2BALEID -.046527 2IIYCAP 2BALEIN -.017142 2BALESD -.135602 2IIYCAP 2BALESN -.036732 2EPKWD -.394869 2IIYCAP 2EPKSD -.315354 3IIYCAP 3BALHCO -.1852 3BALCOK -.038 3IIYCAP 3BALDSL -.2695 3BALGAS -.2048 3IIYCAP 3DEMII 1. 3BALEWD -.03901 3IIYCAP 3BALEWN -.03024 3BALEID -.045965 3IIYCAP 3BALEIN -.016934 3BALESD -.133963 3IIYCAP 3BALESN -.036288 3EPKWD -.390096 3IIYCAP 3EPKSD -.311542 1IJ6CAP PRICER 15.909122 1BALDSH -1.818181 1IJ6CAP 1CPTIJ6 1. 1DEMIJ 1. 2IJ6CAP PRICER 11.88827 2BALDSH -1.818181 2IJ6CAP 2CPTIJ6 1. 2DEMIJ 1. 3IJ6CAP PRICER 8.88363 3BALDSH -1.818181 3IJ6CAP 3CPTIJ6 1. 3DEMIJ 1. 1IJ7CAP PRICER 39.002 1BALGAS -1.538461 1IJ7CAP 1CPTIJ7 1. 1DEMIJ 1. 2IJ7CAP PRICER 29.144684 2BALGAS -1.538461 2IJ7CAP 2CPTIJ7 1. 2DEMIJ 1. 3IJ7CAP PRICER 21.778656 3BALGAS -1.538461 3IJ7CAP 3CPTIJ7 1. 3DEMIJ 1. 1IJ8CAP PRICER 11.053747 1BALHCO -2. 1IJ8CAP 1CPTIJ8 1. 1DEMIJ 1. 2IJ8CAP PRICER 8.260037 2BALHCO -2. 2IJ8CAP 2CPTIJ8 1. 2DEMIJ 1. 3IJ8CAP PRICER 6.172396 3BALHCO -2. 3IJ8CAP 3CPTIJ8 1. 3DEMIJ 1. 1NYYCAP 1BALGSL -.2795 1BALDSH -.4192 1NYYCAP 1BALGAS -.3013 1DEMNY 1. 2NYYCAP 2BALGSL -.285 2BALDSH -.4275 2NYYCAP 2BALGAS -.2875 2DEMNY 1. 3NYYCAP 3BALGSL -.2915 3BALDSH -.4373 3NYYCAP 3BALGAS -.2712 3DEMNY 1. 1R20CAP PRICER 7.231423 1CPTR20 1. 1R20CAP 1DEMR2 1. 1BALEWN -.482222 1R20CAP 1BALEIN -.345555 1BALESN -.283333 2R20CAP PRICER 5.403763 2CPTR20 1. 2R20CAP 2DEMR2 1. 2BALEWN -.482222 2R20CAP 2BALEIN -.345555 2BALESN -.283333 3R20CAP PRICER 4.038016 3CPTR20 1. 3R20CAP 3DEMR2 1. 3BALEWN -.482222 3R20CAP 3BALEIN -.345555 3BALESN -.283333 1R21CAP PRICER 6.869854 1CPTR21 1. 1R21CAP 1DEMR2 1. 1BALEWD -.385555 1R21CAP 1BALEWN -.096667 1BALEID -.276667 1R21CAP 1BALEIN -.068889 1BALESD -.226667 1R21CAP 1BALESN -.056667 1EPKWD -3.855558 1R21CAP 1EPKSD -.527132 1RAT004 .311 2R21CAP PRICER 5.133575 2CPTR21 1. 2R21CAP 2DEMR2 1. 2BALEWD -.385555 2R21CAP 2BALEWN -.096667 2BALEID -.276667 2R21CAP 2BALEIN -.068889 2BALESD -.226667 2R21CAP 2BALESN -.056667 2EPKWD -3.855558 2R21CAP 2EPKSD -.527132 2RAT004 .314 3R21CAP PRICER 3.836116 3CPTR21 1. 3R21CAP 3DEMR2 1. 3BALEWD -.385555 3R21CAP 3BALEWN -.096667 3BALEID -.276667 3R21CAP 3BALEIN -.068889 3BALESD -.226667 3R21CAP 3BALESN -.056667 3EPKWD -3.855558 3R21CAP 3EPKSD -.527132 3RAT004 .317 1R23CAP PRICER 15.416441 1BALDSL -1.538461 1R23CAP 1CPTR23 1. 1DEMR2 1. 1R23CAP 1RAT005 .311 2R23CAP PRICER 11.520109 2BALDSL -1.538461 2R23CAP 2CPTR23 1. 2DEMR2 1. 2R23CAP 2RAT005 .314 3R23CAP PRICER 8.608518 3BALDSL -1.538461 3R23CAP 3CPTR23 1. 3DEMR2 1. 3R23CAP 3RAT005 .317 1R27CAP PRICER 19.469208 1BALGAS -1.538461 1R27CAP 1CPTR27 1. 1DEMR2 1. 1R27CAP 1RAT006 .311 2R27CAP PRICER 14.548593 2BALGAS -1.538461 2R27CAP 2CPTR27 1. 2DEMR2 1. 2R27CAP 2RAT006 .314 3R27CAP PRICER 10.871583 3BALGAS -1.538461 3R27CAP 3CPTR27 1. 3DEMR2 1. 3R27CAP 3RAT006 .317 1R28CAP PRICER 31.92157 1BALHCO -2. 1R28CAP 1CPTR28 1. 1DEMR2 1. 1R28CAP 1RAT007 .311 2R28CAP PRICER 23.853745 2BALHCO -2. 2R28CAP 2CPTR28 1. 2DEMR2 1. 2R28CAP 2RAT007 .314 3R28CAP PRICER 17.824951 3BALHCO -2. 3R28CAP 3CPTR28 1. 3DEMR2 1. 3R28CAP 3RAT007 .317 2R2ACAP PRICER 6.947694 2CPTR2A 1. 2R2ACAP 2DEMR2 1. 2BALEWD -.144583 2R2ACAP 2BALEWN -.03625 2BALEID -.10375 2R2ACAP 2BALEIN -.025833 2BALESD -.085 2R2ACAP 2BALESN -.02125 2EPKWD -1.445833 2R2ACAP 2EPKSD -.197674 2RAT008 .314 3R2ACAP PRICER 5.191734 3CPTR2A 1. 3R2ACAP 3DEMR2 1. 3BALEWD -.144583 3R2ACAP 3BALEWN -.03625 3BALEID -.10375 3R2ACAP 3BALEIN -.025833 3BALESD -.085 3R2ACAP 3BALESN -.02125 3EPKWD -1.445833 3R2ACAP 3EPKSD -.197674 3RAT008 .317 2R2BCAP PRICER 11.901143 2BALGAS -.833333 2R2BCAP 2CPTR2B 1. 2DEMR2 1. 2R2BCAP 2RAT009 .314 3R2BCAP PRICER 8.862661 3BALGAS -.826447 3R2BCAP 3CPTR2B 1. 3DEMR2 1. 3R2BCAP 3RAT009 .317 2R2CCAP PRICER 9.263595 2CPTR2C 1. 2R2CCAP 2DEMR2 1. 2BALDHW -.563636 2R2CCAP 2BALDHI -.403896 2BALDHS -.331169 2R2CCAP 2HPKW -2.818182 2RAT012 .314 3R2CCAP PRICER 6.922315 3CPTR2C 1. 3R2CCAP 3DEMR2 1. 3BALDHW -.563636 3R2CCAP 3BALDHI -.403896 3BALDHS -.331169 3R2CCAP 3HPKW -2.818182 3RAT012 .317 1R2DCAP 1CPTR2D 1. 1DEMR2 1. 1R2DCAP 1RAT002 -1.8 2R2DCAP 2CPTR2D 1. 2DEMR2 1. 2R2DCAP 2RAT002 -1.8 3R2DCAP 3CPTR2D 1. 3DEMR2 1. 3R2DCAP 3RAT002 -1.8 1R2LCAP PRICER 14.772768 1CPTR2L 1. 1R2LCAP 1DEMR2 1. 1BALEWD -.347 1R2LCAP 1BALEWN -.087 1BALEID -.249 1R2LCAP 1BALEIN -.062 1BALESD -.204 1R2LCAP 1BALESN -.051 1EPKWD -3.47 1R2LCAP 1EPKSD -.474419 1RAT002 1. 2R2LCAP PRICER 11.039117 2CPTR2L 1. 2R2LCAP 2DEMR2 1. 2BALEWD -.347 2R2LCAP 2BALEWN -.087 2BALEID -.249 2R2LCAP 2BALEIN -.062 2BALESD -.204 2R2LCAP 2BALESN -.051 2EPKWD -3.47 2R2LCAP 2EPKSD -.474419 2RAT002 1. 3R2LCAP PRICER 8.249092 3CPTR2L 1. 3R2LCAP 3DEMR2 1. 3BALEWD -.347 3R2LCAP 3BALEWN -.087 3BALEID -.249 3R2LCAP 3BALEIN -.062 3BALESD -.204 3R2LCAP 3BALESN -.051 3EPKWD -3.47 3R2LCAP 3EPKSD -.474419 3RAT002 1. 1R2YCAP 1BALHCO -.923936 1BALDSL -.114623 1R2YCAP 1BALGAS -1.068479 1DEMR2 1. 2R2YCAP 2BALHCO -.54554 2BALDSL -.072151 2R2YCAP 2BALGAS -1.256371 2DEMR2 1. 3R2YCAP 3BALHCO -.418028 3BALDSL -.058718 3R2YCAP 3BALGAS -1.318908 3DEMR2 1. 1RT0CAP PRICER 7.231423 1CPTRT0 1. 1RT0CAP 1DEMRT 1. 1BALEWN -.482222 1RT0CAP 1BALEIN -.345555 1BALESN -.283333 2RT0CAP PRICER 5.403763 2CPTRT0 1. 2RT0CAP 2DEMRT 1. 2BALEWN -.482222 2RT0CAP 2BALEIN -.345555 2BALESN -.283333 3RT0CAP PRICER 4.038016 3CPTRT0 1. 3RT0CAP 3DEMRT 1. 3BALEWN -.482222 3RT0CAP 3BALEIN -.345555 3BALESN -.283333 1RT1CAP PRICER 6.869854 1CPTRT1 1. 1RT1CAP 1DEMRT 1. 1BALEWD -.385555 1RT1CAP 1BALEWN -.096667 1BALEID -.276667 1RT1CAP 1BALEIN -.068889 1BALESD -.226667 1RT1CAP 1BALESN -.056667 1EPKWD -3.855558 1RT1CAP 1EPKSD -.527132 2RT1CAP PRICER 5.133575 2CPTRT1 1. 2RT1CAP 2DEMRT 1. 2BALEWD -.385555 2RT1CAP 2BALEWN -.096667 2BALEID -.276667 2RT1CAP 2BALEIN -.068889 2BALESD -.226667 2RT1CAP 2BALESN -.056667 2EPKWD -3.855558 2RT1CAP 2EPKSD -.527132 3RT1CAP PRICER 3.836116 3CPTRT1 1. 3RT1CAP 3DEMRT 1. 3BALEWD -.385555 3RT1CAP 3BALEWN -.096667 3BALEID -.276667 3RT1CAP 3BALEIN -.068889 3BALESD -.226667 3RT1CAP 3BALESN -.056667 3EPKWD -3.855558 3RT1CAP 3EPKSD -.527132 1RT3CAP PRICER 16.528961 1BALDSL -1.818181 1RT3CAP 1CPTRT3 1. 1DEMRT 1. 2RT3CAP PRICER 12.351457 2BALDSL -1.818181 2RT3CAP 2CPTRT3 1. 2DEMRT 1. 3RT3CAP PRICER 9.229751 3BALDSL -1.818181 3RT3CAP 3CPTRT3 1. 3DEMRT 1. 1RT7CAP PRICER 19.469208 1BALGAS -1.538461 1RT7CAP 1CPTRT7 1. 1DEMRT 1. 2RT7CAP PRICER 14.548593 2BALGAS -1.538461 2RT7CAP 2CPTRT7 1. 2DEMRT 1. 3RT7CAP PRICER 10.871583 3BALGAS -1.538461 3RT7CAP 3CPTRT7 1. 3DEMRT 1. 1RT8CAP PRICER 31.92157 1BALHCO -2. 1RT8CAP 1CPTRT8 1. 1DEMRT 1. 2RT8CAP PRICER 23.853745 2BALHCO -2. 2RT8CAP 2CPTRT8 1. 2DEMRT 1. 3RT8CAP PRICER 17.824951 3BALHCO -2. 3RT8CAP 3CPTRT8 1. 3DEMRT 1. 2RTBCAP PRICER 11.901143 2BALGAS -.833333 2RTBCAP 2CPTRTB 1. 2DEMRT 1. 3RTBCAP PRICER 8.893249 3BALGAS -.833333 3RTBCAP 3CPTRTB 1. 3DEMRT 1. 2RTCCAP PRICER 9.263595 2CPTRTC 1. 2RTCCAP 2DEMRT 1. 2BALDHW -.563636 2RTCCAP 2BALDHI -.403896 2BALDHS -.331169 2RTCCAP 2HPKW -2.818182 3RTCCAP PRICER 6.922315 3CPTRTC 1. 3RTCCAP 3DEMRT 1. 3BALDHW -.563636 3RTCCAP 3BALDHI -.403896 3BALDHS -.331169 3RTCCAP 3HPKW -2.818182 1RTYCAP 1BALHCO -.634921 1BALGAS -.952381 1RTYCAP 1DEMRT 1. 2RTYCAP 2BALHCO -.3125 2BALGAS -1.25 2RTYCAP 2DEMRT 1. 3RTYCAP 3BALGAS -1.538461 3DEMRT 1. 1R50CAP PRICER 1.54959 1CPTR50 1. 1R50CAP 1DEMR5 1. 1BALEWN -.248889 1R50CAP 1BALEIN -.23 1BALESN -.632222 2R50CAP PRICER 1.157948 2CPTR50 1. 2R50CAP 2DEMR5 1. 2BALEWN -.248889 2R50CAP 2BALEIN -.23 2BALESN -.632222 3R50CAP PRICER .865289 3CPTR50 1. 3R50CAP 3DEMR5 1. 3BALEWN -.248889 3R50CAP 3BALEIN -.23 3BALESN -.632222 1R51CAP 1CPTR51 1. 1DEMR5 1. 1R51CAP 1BALEWD -.176667 1BALEWN -.072222 1R51CAP 1BALEID -.212222 1BALEIN -.017778 1R51CAP 1BALESD -.604444 1BALESN -.027778 1R51CAP 1EPKWD -1.766667 1EPKSD -1.405684 1R51CAP 1RAT004 -1. 2R51CAP 2CPTR51 1. 2DEMR5 1. 2R51CAP 2BALEWD -.176667 2BALEWN -.072222 2R51CAP 2BALEID -.212222 2BALEIN -.017778 2R51CAP 2BALESD -.604444 2BALESN -.027778 2R51CAP 2EPKWD -1.766667 2EPKSD -1.405684 2R51CAP 2RAT004 -1. 3R51CAP 3CPTR51 1. 3DEMR5 1. 3R51CAP 3BALEWD -.176667 3BALEWN -.072222 3R51CAP 3BALEID -.212222 3BALEIN -.017778 3R51CAP 3BALESD -.604444 3BALESN -.027778 3R51CAP 3EPKWD -1.766667 3EPKSD -1.405684 3R51CAP 3RAT004 -1. 1R53CAP PRICER 16.528961 1BALDSL -1.818181 1R53CAP 1CPTR53 1. 1DEMR5 1. 1R53CAP 1RAT005 -1. 2R53CAP PRICER 12.351457 2BALDSL -1.818181 2R53CAP 2CPTR53 1. 2DEMR5 1. 2R53CAP 2RAT005 -1. 3R53CAP PRICER 9.229751 3BALDSL -1.818181 3R53CAP 3CPTR53 1. 3DEMR5 1. 3R53CAP 3RAT005 -1. 1R57CAP PRICER 19.469208 1BALGAS -1.538461 1R57CAP 1CPTR57 1. 1DEMR5 1. 1R57CAP 1RAT006 -1. 2R57CAP PRICER 14.548593 2BALGAS -1.538461 2R57CAP 2CPTR57 1. 2DEMR5 1. 2R57CAP 2RAT006 -1. 3R57CAP PRICER 10.871583 3BALGAS -1.538461 3R57CAP 3CPTR57 1. 3DEMR5 1. 3R57CAP 3RAT006 -1. 1R58CAP PRICER 31.92157 1BALHCO -2. 1R58CAP 1CPTR58 1. 1DEMR5 1. 1R58CAP 1RAT007 -1. 2R58CAP PRICER 23.853745 2BALHCO -2. 2R58CAP 2CPTR58 1. 2DEMR5 1. 2R58CAP 2RAT007 -1. 3R58CAP PRICER 17.824951 3BALHCO -2. 3R58CAP 3CPTR58 1. 3DEMR5 1. 3R58CAP 3RAT007 -1. 2R5ACAP PRICER 6.947694 2CPTR5A 1. 2R5ACAP 2DEMR5 1. 2BALEWD -.045429 2R5ACAP 2BALEWN -.018571 2BALEID -.054571 2R5ACAP 2BALEIN -.004571 2BALESD -.155429 2R5ACAP 2BALESN -.007143 2EPKWD -.454286 2R5ACAP 2EPKSD -.361462 2RAT008 -1. 3R5ACAP PRICER 5.191734 3CPTR5A 1. 3R5ACAP 3DEMR5 1. 3BALEWD -.045429 3R5ACAP 3BALEWN -.018571 3BALEID -.054571 3R5ACAP 3BALEIN -.004571 3BALESD -.155429 3R5ACAP 3BALESN -.007143 3EPKWD -.454286 3R5ACAP 3EPKSD -.361462 3RAT008 -1. 3R5CCAP PRICER 6.922315 3CPTR5C 1. 3R5CCAP 3DEMR5 1. 3BALDHW -.329412 3R5CCAP 3BALDHI -.304412 3BALDHS -.836765 3R5CCAP 3HPKW -1.647059 3RAT012 -1. 1R5HCAP PRICER 85.948608 1BALGAS -1.960784 1R5HCAP 1CPTR5H 1. 1DEMR5 1. 1R5HCAP 1RAT001 1. 1RAT003 1. 1R5HCAP 1RAT013 -1. 2R5HCAP PRICER 64.001907 2BALGAS -1.923077 2R5HCAP 2CPTR5H 1. 2DEMR5 1. 2R5HCAP 2RAT001 1. 2RAT003 1. 2R5HCAP 2RAT013 -1. 3R5HCAP PRICER 47.664902 3BALGAS -1.886792 3R5HCAP 3CPTR5H 1. 3DEMR5 1. 3R5HCAP 3RAT001 1. 3RAT003 1. 3R5HCAP 3RAT013 -1. 1R5LCAP 1CPTR5L 1. 1DEMR5 1. 1R5LCAP 1BALEWD -.223944 1BALEWN -.091549 1R5LCAP 1BALEID -.269014 1BALEIN -.022535 1R5LCAP 1BALESD -.766197 1BALESN -.035211 1R5LCAP 1EPKWD -2.239438 1EPKSD -1.781854 1R5LCAP 1RAT001 1. 1RAT013 -1. 2R5LCAP 2CPTR5L 1. 2DEMR5 1. 2R5LCAP 2BALEWD -.220833 2BALEWN -.090278 2R5LCAP 2BALEID -.265278 2BALEIN -.022222 2R5LCAP 2BALESD -.755556 2BALESN -.034722 2R5LCAP 2EPKWD -2.208334 2EPKSD -1.757106 2R5LCAP 2RAT001 1. 2RAT013 -1. 3R5LCAP 3CPTR5L 1. 3DEMR5 1. 3R5LCAP 3BALEWD -.217808 3BALEWN -.089041 3R5LCAP 3BALEID -.261644 3BALEIN -.021918 3R5LCAP 3BALESD -.745205 3BALESN -.034247 3R5LCAP 3EPKWD -2.178082 3EPKSD -1.733036 3R5LCAP 3RAT001 1. 3RAT013 -1. 1R5MCAP 1CPTR5M 1. 1DEMR5 1. 1R5MCAP 1BALEWD -.223944 1BALEWN -.091549 1R5MCAP 1BALEID -.269014 1BALEIN -.022535 1R5MCAP 1BALESD -.766197 1BALESN -.035211 1R5MCAP 1EPKWD -2.239438 1EPKSD -1.781854 1R5MCAP 1RAT003 1. 1RAT013 -1. 2R5MCAP 2CPTR5M 1. 2DEMR5 1. 2R5MCAP 2BALEWD -.220833 2BALEWN -.090278 2R5MCAP 2BALEID -.265278 2BALEIN -.022222 2R5MCAP 2BALESD -.755556 2BALESN -.034722 2R5MCAP 2EPKWD -2.208334 2EPKSD -1.757106 2R5MCAP 2RAT003 1. 2RAT013 -1. 3R5MCAP 3CPTR5M 1. 3DEMR5 1. 3R5MCAP 3BALEWD -.217808 3BALEWN -.089041 3R5MCAP 3BALEID -.261644 3BALEIN -.021918 3R5MCAP 3BALESD -.745205 3BALESN -.034247 3R5MCAP 3EPKWD -2.178082 3EPKSD -1.733036 3R5MCAP 3RAT003 1. 3RAT013 -1. 1RDYCAP 1BALHCO -.034892 1BALCOK -.009677 1RDYCAP 1BALDSL -.332697 1BALGAS -.371269 1RDYCAP 1DEMRD 1. 1BALEWD -.148042 1RDYCAP 1BALEWN -.082314 1BALEID -.119785 1RDYCAP 1BALEIN -.033786 1BALESD -.181214 1RDYCAP 1BALESN -.049143 1EPKWD -1.480425 1RDYCAP 1EPKSD -.421427 2RDYCAP 2BALHCO -.030143 2BALCOK -.007975 2RDYCAP 2BALDSL -.282779 2BALGAS -.410787 2RDYCAP 2DEMRD 1. 2BALEWD -.149428 2RDYCAP 2BALEWN -.083084 2BALEID -.120906 2RDYCAP 2BALEIN -.034102 2BALESD -.182909 2RDYCAP 2BALESN -.049603 2EPKWD -1.494279 2RDYCAP 2EPKSD -.425371 3RDYCAP 3BALHCO -.02846 3BALCOK -.007786 3RDYCAP 3BALDSL -.26084 3BALGAS -.411062 3RDYCAP 3DEMRD 1. 3BALEWD -.152869 3RDYCAP 3BALEWN -.084998 3BALEID -.123691 3RDYCAP 3BALEIN -.034887 3BALESD -.187122 3RDYCAP 3BALESN -.050745 3EPKWD -1.528695 3RDYCAP 3EPKSD -.435168 1T80CAP 2GRCT80 -1.227805 1DEMT8 1. 1T80CAP 1BALEWN -.1 1BALEIN -.1 1T80CAP 1BALESN -.3 2T80CAP 3GRCT80 -1.227805 2GRCT80 1. 2T80CAP 2DEMT8 1. 2BALEWN -.1 2T80CAP 2BALEIN -.1 2BALESN -.3 3T80CAP 3GRCT80 1. 3DEMT8 1. 3T80CAP 3BALEWN -.1 3BALEIN -.1 3T80CAP 3BALESN -.3 1T83CAP PRICER 5.475219 1BALDSL -1. 1T83CAP 1DEMT8 1. 2T83CAP PRICER 4.091419 2BALDSL -1. 2T83CAP 2DEMT8 1. 3T83CAP PRICER 3.057354 3BALDSL -1. 3T83CAP 3DEMT8 1. 1T8FCAP 1BALGSL -1. 1DEMT8 1. 2T8FCAP 2BALGSL -1. 2DEMT8 1. 3T8FCAP 3BALGSL -1. 3DEMT8 1. 1TXYCAP 1BALDSL -.9792 1DEMTX 1. 1TXYCAP 1BALEWD -.00208 1BALEWN -.00208 1TXYCAP 1BALEID -.002704 1BALEIN -.001456 1TXYCAP 1BALESD -.008944 1BALESN -.003536 1TXYCAP 1EPKWD -.0208 1EPKSD -.0208 2TXYCAP 2BALDSL -.9808 2DEMTX 1. 2TXYCAP 2BALEWD -.00192 2BALEWN -.00192 2TXYCAP 2BALEID -.002496 2BALEIN -.001344 2TXYCAP 2BALESD -.008256 2BALESN -.003264 2TXYCAP 2EPKWD -.0192 2EPKSD -.0192 3TXYCAP 3BALDSL -.9981 3DEMTX 1. 3TXYCAP 3BALEWD -.00189 3BALEWN -.00189 3TXYCAP 3BALEID -.002457 3BALEIN -.001323 3TXYCAP 3BALESD -.008127 3BALESN -.003213 3TXYCAP 3EPKWD -.0189 3EPKSD -.0189 3S01CAP PRICER 4.961 3CPTS01 1. 3S01CAP 3UTLS01 -.85 3S04CAP PRICER 5.710909 3CPTS04 1. 3S04CAP 3UTLS04 -.85 1S06CAP 1CPTS06 1. 1UTLS06 -.9 2S06CAP 2CPTS06 1. 2UTLS06 -.9 3S06CAP 3CPTS06 1. 3UTLS06 -.9 1S08CAP 1CPTS08 1. 1UTLS08 -.9 2S08CAP 2CPTS08 1. 2UTLS08 -.9 3S08CAP 3CPTS08 1. 3UTLS08 -.9 1S09CAP 1CPTS09 1. 1UTLS09 -1. 2S09CAP 2CPTS09 1. 2UTLS09 -1. 3S09CAP 3CPTS09 1. 3UTLS09 -1. 1S21CAP 1CPTS21 1. 1UTLS21 -1. 2S21CAP 2CPTS21 1. 2UTLS21 -1. 3S21CAP 3CPTS21 1. 3UTLS21 -1. 1S23CAP 1CPTS23 1. 1UTLS23 -1. 2S23CAP 2CPTS23 1. 2UTLS23 -1. 3S23CAP 3CPTS23 1. 3UTLS23 -1. 1S28CAP 1CPTS28 1. 1UTLS28 -1. 2S28CAP 2CPTS28 1. 2UTLS28 -1. 3S28CAP 3CPTS28 1. 3UTLS28 -1. 3S29CAP 3CPTS29 1. 3UTLS29 -1. 1S44CAP 1BALURN -1.02 1BALMAG .744 1S44CAP 2BALMAG .256 2S44CAP 2BALURN -1.02 2BALMAG .744 2S44CAP 3BALMAG .256 3S44CAP 3BALURN -1.02 3BALMAG .744 1S45CAP PRICER 2.89257 1BALURN -4.4348 1S45CAP 1BALUDP 3.4348 1BALAGR .634 1S45CAP 2BALAGR .366 2S45CAP PRICER 2.161505 2BALURN -4.4348 2S45CAP 2BALUDP 3.4348 2BALAGR .634 2S45CAP 3BALAGR .366 3S45CAP PRICER 1.615207 3BALURN -4.4348 3S45CAP 3BALUDP 3.4348 3BALAGR .634 1S46CAP PRICER .619836 1BALURN -.9841 1S46CAP 1BALPLU -.01591 1BALAGR .734 1S46CAP 2BALAGR .266 2S46CAP PRICER .46318 2BALURN -.9841 2S46CAP 2BALPLU -.01591 2BALAGR .734 2S46CAP 3BALAGR .266 3S46CAP PRICER .346116 3BALURN -.9841 3S46CAP 3BALPLU -.01591 3BALAGR .734 1S47CAP PRICER .619836 1BALUDP -.9796 1S47CAP 1BALPLU -.02045 1BALAGR .734 1S47CAP 2BALAGR .266 2S47CAP PRICER .46318 2BALUDP -.9796 2S47CAP 2BALPLU -.02045 2BALAGR .734 2S47CAP 3BALAGR .266 3S47CAP PRICER .346116 3BALUDP -.9796 3S47CAP 3BALPLU -.02045 3BALAGR .734 1S4ACAP PRICER .619836 1BALUDP -.9476 1S4ACAP 1BALPLU -.05237 1BALLMF .95 1S4ACAP 2BALLMF .05 2S4ACAP PRICER .46318 2BALUDP -.9476 2S4ACAP 2BALPLU -.05237 2BALLMF .95 2S4ACAP 3BALLMF .05 3S4ACAP PRICER .346116 3BALUDP -.9476 3S4ACAP 3BALPLU -.05237 3BALLMF .95 1S54CAP PRICER 4.752079 1BALUDP .9282 1S54CAP 1BALPLU .06318 1BALLMS -1. 2S54CAP PRICER 3.551044 2BALUDP .9282 2S54CAP 2BALPLU .06318 2BALLMS -.9 2S54CAP 1BALLMS -.1 3S54CAP PRICER 2.653554 3BALUDP .9282 3S54CAP 3BALPLU .06318 3BALLMS -.9 3S54CAP 2BALLMS -.1 1S55CAP PRICER 4.752079 1BALURN 1.047 1S55CAP 1BALPLU .004783 1BALAGS -1. 2S55CAP PRICER 3.551044 2BALURN 1.047 2S55CAP 2BALPLU .004783 2BALAGS -.8 2S55CAP 1BALAGS -.2 3S55CAP PRICER 2.653554 3BALURN 1.047 3S55CAP 3BALPLU .004783 3BALAGS -.8 3S55CAP 2BALAGS -.2 1S6HCAP 1BALGAS .95 1BALHYD -1. 2S6HCAP 2BALGAS .95 2BALHYD -1. 3S6HCAP 3BALGAS .95 3BALHYD -1. 1S71CAP 1BALGSL 1. 1BALALC -1. 2S71CAP 2BALGSL 1. 2BALALC -1. 3S71CAP 3BALGSL 1. 3BALALC -1. 1S72CAP 1BALDSH 1. 1BALDSR -1. 2S72CAP 2BALDSH 1. 2BALDSR -1. 3S72CAP 3BALDSH 1. 3BALDSR -1. 1S79CAP 1BALGAK -1. 1BALGAS .95 1S79CAP 1RAT010 2.66 2S79CAP 2BALGAK -1. 2BALGAS .95 2S79CAP 2RAT010 2.66 3S79CAP 3BALGAK -1. 3BALGAS .95 3S79CAP 3RAT010 2.66 1S7ACAP 1BALOIK -1. 1BALOIL 1. 1S7ACAP 1RAT011 2.66 2S7ACAP 2BALOIK -1. 2BALOIL 1. 2S7ACAP 2RAT011 2.66 3S7ACAP 3BALOIK -1. 3BALOIL 1. 3S7ACAP 3RAT011 2.66 3S80CAP PRICER 1.211405 3CPTS80 1. 3S80CAP 3UTLS80 -.9 3S01ACT PRICER 1.817107 3BALHCO -1. 3S01ACT 3BALGAS .665 3UTLS01 1. 3S04ACT PRICER 1.586364 3BALHCO -1. 3S04ACT 3BALALC .3 3UTLS04 1. 1S06ACT PRICER 1.497937 1BALHCO -1. 1S06ACT 1BALCOK .6 1BALGAS .1425 1S06ACT 1UTLS06 1. 2S06ACT PRICER 1.11935 2BALHCO -1. 2S06ACT 2BALCOK .6 2BALGAS .1425 2S06ACT 2UTLS06 1. 3S06ACT PRICER .836446 3BALHCO -1. 3S06ACT 3BALCOK .6 3BALGAS .1425 3S06ACT 3UTLS06 1. 1S08ACT PRICER 1.497937 1BALHCO -1. 1S08ACT 1BALCOK .64 1BALGAS .152 1S08ACT 1UTLS08 1. 2S08ACT PRICER 1.11935 2BALHCO -1. 2S08ACT 2BALCOK .64 2BALGAS .152 2S08ACT 2UTLS08 1. 3S08ACT PRICER .836446 3BALHCO -1. 3S08ACT 3BALCOK .64 3BALGAS .152 3S08ACT 3UTLS08 1. 1S09ACT PRICER 1.497937 1BALHCO -1. 1S09ACT 1BALCOK .64 1BALGAS .152 1S09ACT 1UTLS09 1. 2S09ACT PRICER 1.11935 2BALHCO -1. 2S09ACT 2BALCOK .64 2BALGAS .152 2S09ACT 2UTLS09 1. 3S09ACT PRICER .836446 3BALHCO -1. 3S09ACT 3BALCOK .64 3BALGAS .152 3S09ACT 3UTLS09 1. 1S21ACT 1BALOIL -1. 1BALGSL .16 1S21ACT 1BALDSL .32 1BALDSR .46 1S21ACT 1UTLS21 1. 2S21ACT 2BALOIL -1. 2BALGSL .16 2S21ACT 2BALDSL .32 2BALDSR .46 2S21ACT 2UTLS21 1. 3S21ACT 3BALOIL -1. 3BALGSL .16 3S21ACT 3BALDSL .32 3BALDSR .46 3S21ACT 3UTLS21 1. 1S23ACT 1BALDSL .5 1BALDSH .5 1S23ACT 1BALDSR -1. 1UTLS23 1. 2S23ACT 2BALDSL .5 2BALDSH .5 2S23ACT 2BALDSR -1. 2UTLS23 1. 3S23ACT 3BALDSL .5 3BALDSH .5 3S23ACT 3BALDSR -1. 3UTLS23 1. 1S28ACT 1BALGSL .67 1BALDSL -1. 1S28ACT 1UTLS28 1. 2S28ACT 2BALGSL .67 2BALDSL -1. 2S28ACT 2UTLS28 1. 3S28ACT 3BALGSL .67 3BALDSL -1. 3S28ACT 3UTLS28 1. 3S29ACT 3BALGSL .87 3BALDSL -1. 3S29ACT 3UTLS29 1. 3S80ACT PRICER .365152 3BALHYD .722 3S80ACT 3UTLS80 1. 3BALEWN -.2 3S80ACT 3BALEIN -.2 3BALESN -.6 1EC1WM 1UTLEC1 1. 1EWDEC1 .5 1EC1WM 1EWNEC1 .5 1EC1IM 1UTLEC1 1. 1EIDEC1 .65 1EC1IM 1EINEC1 .35 1EC1SM 1UTLEC1 1. 1ESDEC1 .716667 1EC1SM 1ESNEC1 .283333 2EC1WM 2UTLEC1 1. 2EWDEC1 .5 2EC1WM 2EWNEC1 .5 2EC1IM 2UTLEC1 1. 2EIDEC1 .65 2EC1IM 2EINEC1 .35 2EC1SM 2UTLEC1 1. 2ESDEC1 .716667 2EC1SM 2ESNEC1 .283333 3EC1WM 3UTLEC1 1. 3EWDEC1 .5 3EC1WM 3EWNEC1 .5 3EC1IM 3UTLEC1 1. 3EIDEC1 .65 3EC1IM 3EINEC1 .35 3EC1SM 3UTLEC1 1. 3ESDEC1 .716667 3EC1SM 3ESNEC1 .283333 1EC2WM 1UTLEC2 1. 1EWDEC2 .5 1EC2WM 1EWNEC2 .5 1EC2IM 1UTLEC2 1. 1EIDEC2 .65 1EC2IM 1EINEC2 .35 1EC2SM 1UTLEC2 1. 1ESDEC2 .716667 1EC2SM 1ESNEC2 .283333 2EC2WM 2UTLEC2 1. 2EWDEC2 .5 2EC2WM 2EWNEC2 .5 2EC2IM 2UTLEC2 1. 2EIDEC2 .65 2EC2IM 2EINEC2 .35 2EC2SM 2UTLEC2 1. 2ESDEC2 .716667 2EC2SM 2ESNEC2 .283333 3EC2WM 3UTLEC2 1. 3EWDEC2 .5 3EC2WM 3EWNEC2 .5 3EC2IM 3UTLEC2 1. 3EIDEC2 .65 3EC2IM 3EINEC2 .35 3EC2SM 3UTLEC2 1. 3ESDEC2 .716667 3EC2SM 3ESNEC2 .283333 1EP1WM 1UTLEP1 1. 1EWDEP1 .5 1EP1WM 1EWNEP1 .5 1EP1IM 1UTLEP1 1. 1EIDEP1 .65 1EP1IM 1EINEP1 .35 1EP1SM 1UTLEP1 1. 1ESDEP1 .716667 1EP1SM 1ESNEP1 .283333 2EP1WM 2UTLEP1 1. 2EWDEP1 .5 2EP1WM 2EWNEP1 .5 2EP1IM 2UTLEP1 1. 2EIDEP1 .65 2EP1IM 2EINEP1 .35 2EP1SM 2UTLEP1 1. 2ESDEP1 .716667 2EP1SM 2ESNEP1 .283333 3EP1WM 3UTLEP1 1. 3EWDEP1 .5 3EP1WM 3EWNEP1 .5 3EP1IM 3UTLEP1 1. 3EIDEP1 .65 3EP1IM 3EINEP1 .35 3EP1SM 3UTLEP1 1. 3ESDEP1 .716667 3EP1SM 3ESNEP1 .283333 1E22WM 1UTLE22 1. 1EWDE22 1. 1E22IM 1UTLE22 1. 1EIDE22 1. 1E22SM 1UTLE22 1. 1ESDE22 1. 2E22WM 2UTLE22 1. 2EWDE22 1. 2E22IM 2UTLE22 1. 2EIDE22 1. 2E22SM 2UTLE22 1. 2ESDE22 1. 3E22WM 3UTLE22 1. 3EWDE22 1. 3E22IM 3UTLE22 1. 3EIDE22 1. 3E22SM 3UTLE22 1. 3ESDE22 1. 1E23WM 1UTLE23 1. 1EWDE23 1. 1E23IM 1UTLE23 1. 1EIDE23 1. 1E23SM 1UTLE23 1. 1ESDE23 1. 2E23WM 2UTLE23 1. 2EWDE23 1. 2E23IM 2UTLE23 1. 2EIDE23 1. 2E23SM 2UTLE23 1. 2ESDE23 1. 3E23WM 3UTLE23 1. 3EWDE23 1. 3E23IM 3UTLE23 1. 3EIDE23 1. 3E23SM 3UTLE23 1. 3ESDE23 1. 1EC1CAP PRICER 289.256836 1UTLEC1 -4.4184 1EC1CAP 1EPKWD 24.213669 1EPKSD 24.213669 1EC1CAP 1EWDEC1 -2.714158 1EWNEC1 -2.714158 1EC1CAP 1EIDEC1 -3.528407 1EINEC1 -1.899911 1EC1CAP 1ESDEC1 -11.670885 1ESNEC1 -4.61407 2EC1CAP PRICER 216.150574 2UTLEC1 -4.4184 2EC1CAP 2EPKWD 24.213669 2EPKSD 24.213669 2EC1CAP 2EWDEC1 -2.714158 2EWNEC1 -2.714158 2EC1CAP 2EIDEC1 -3.528407 2EINEC1 -1.899911 2EC1CAP 2ESDEC1 -11.670885 2ESNEC1 -4.61407 3EC1CAP PRICER 161.520706 3UTLEC1 -4.4184 3EC1CAP 3EPKWD 24.213669 3EPKSD 24.213669 3EC1CAP 3EWDEC1 -2.714158 3EWNEC1 -2.714158 3EC1CAP 3EIDEC1 -3.528407 3EINEC1 -1.899911 3EC1CAP 3ESDEC1 -11.670885 3ESNEC1 -4.61407 1EC2CAP PRICER 289.256836 1UTLEC2 -5.049611 1EC2CAP 1EPKWD 24.213669 1EPKSD 24.213669 1EC2CAP 1EWDEC2 -2.777279 1EWNEC2 -2.777279 1EC2CAP 1EIDEC2 -3.610465 1EINEC2 -1.944096 1EC2CAP 1ESDEC2 -11.942307 1ESNEC2 -4.721376 2EC2CAP PRICER 216.150574 2UTLEC2 -5.049611 2EC2CAP 2EPKWD 24.213669 2EPKSD 24.213669 2EC2CAP 2EWDEC2 -2.777279 2EWNEC2 -2.777279 2EC2CAP 2EIDEC2 -3.610465 2EINEC2 -1.944096 2EC2CAP 2ESDEC2 -11.942307 2ESNEC2 -4.721376 3EC2CAP PRICER 161.520706 3UTLEC2 -5.049611 3EC2CAP 3EPKWD 24.213669 3EPKSD 24.213669 3EC2CAP 3EWDEC2 -2.777279 3EWNEC2 -2.777279 3EC2CAP 3EIDEC2 -3.610465 3EINEC2 -1.944096 3EC2CAP 3ESDEC2 -11.942307 3ESNEC2 -4.721376 1EC3CAP PRICER 114.669724 1CPTEC3 1. 1EC3CAP 1EPKWD 24.213669 1EPKSD 24.213669 1EC3CAP 1EWDEC3 -2.114518 1EWNEC3 -2.114518 1EC3CAP 1EIDEC3 -2.748875 1EINEC3 -1.480163 1EC3CAP 1ESDEC3 -9.092433 1ESNEC3 -3.594682 2EC3CAP PRICER 85.688248 2CPTEC3 1. 2EC3CAP 2EPKWD 24.213669 2EPKSD 24.213669 2EC3CAP 2EWDEC3 -2.114518 2EWNEC3 -2.114518 2EC3CAP 2EIDEC3 -2.748875 2EINEC3 -1.480163 2EC3CAP 2ESDEC3 -9.092433 2ESNEC3 -3.594682 3EC3CAP PRICER 64.031403 3CPTEC3 1. 3EC3CAP 3EPKWD 24.213669 3EPKSD 24.213669 3EC3CAP 3EWDEC3 -2.114518 3EWNEC3 -2.114518 3EC3CAP 3EIDEC3 -2.748875 3EINEC3 -1.480163 3EC3CAP 3ESDEC3 -9.092433 3ESNEC3 -3.594682 1EP1CAP PRICER 114.669724 1CPTEP1 1. 1EP1CAP 1UTLEP1 -4.4184 1EPKWD 24.213669 1EP1CAP 1EPKSD 24.213669 1EWDEP1 -2.714158 1EP1CAP 1EWNEP1 -2.714158 1EIDEP1 -3.528407 1EP1CAP 1EINEP1 -1.899911 1ESDEP1 -11.670885 1EP1CAP 1ESNEP1 -4.61407 2EP1CAP PRICER 85.688248 2CPTEP1 1. 2EP1CAP 2UTLEP1 -4.4184 2EPKWD 24.213669 2EP1CAP 2EPKSD 24.213669 2EWDEP1 -2.714158 2EP1CAP 2EWNEP1 -2.714158 2EIDEP1 -3.528407 2EP1CAP 2EINEP1 -1.899911 2ESDEP1 -11.670885 2EP1CAP 2ESNEP1 -4.61407 3EP1CAP PRICER 64.031403 3CPTEP1 1. 3EP1CAP 3UTLEP1 -4.4184 3EPKWD 24.213669 3EP1CAP 3EPKSD 24.213669 3EWDEP1 -2.714158 3EP1CAP 3EWNEP1 -2.714158 3EIDEP1 -3.528407 3EP1CAP 3EINEP1 -1.899911 3ESDEP1 -11.670885 3EP1CAP 3ESNEP1 -4.61407 1E14CAP PRICER 72.83078 1CPTE14 1. 1E14CAP 1EPKWD 24.213669 1EPKSD 24.213669 1E14CAP 1EWDE14 -2.998198 1EWNE14 -2.998198 1E14CAP 1EIDE14 -3.897659 1EINE14 -2.098739 1E14CAP 1ESDE14 -12.892257 1ESNE14 -5.096938 2E14CAP PRICER 54.423615 2CPTE14 1. 2E14CAP 2EPKWD 24.213669 2EPKSD 24.213669 2E14CAP 2EWDE14 -2.998198 2EWNE14 -2.998198 2E14CAP 2EIDE14 -3.897659 2EINE14 -2.098739 2E14CAP 2ESDE14 -12.892257 2ESNE14 -5.096938 3E14CAP PRICER 40.668594 3CPTE14 1. 3E14CAP 3EPKWD 24.213669 3EPKSD 24.213669 3E14CAP 3EWDE14 -2.998198 3EWNE14 -2.998198 3E14CAP 3EIDE14 -3.897659 3EINE14 -2.098739 3E14CAP 3ESDE14 -12.892257 3ESNE14 -5.096938 1E22CAP PRICER 81.611801 1CPTE22 1. 1E22CAP 1UTLE22 -6.311683 1EPKWD 24.213669 1E22CAP 1EPKSD 24.213669 1EWDE22 -5.365133 1E22CAP 1EIDE22 -5.365135 1ESDE22 -16.095398 2E22CAP PRICER 60.985336 2CPTE22 1. 2E22CAP 2UTLE22 -6.311683 2EPKWD 24.213669 2E22CAP 2EPKSD 24.213669 2EWDE22 -5.365133 2E22CAP 2EIDE22 -5.365135 2ESDE22 -16.095398 3E22CAP PRICER 45.5719 3CPTE22 1. 3E22CAP 3UTLE22 -6.311683 3EPKWD 24.213669 3E22CAP 3EPKSD 24.213669 3EWDE22 -5.365133 3E22CAP 3EIDE22 -5.365135 3ESDE22 -16.095398 1E23CAP PRICER 74.380371 1CPTE23 1. 1E23CAP 1UTLE23 -6.311683 1EPKWD 24.213669 1E23CAP 1EPKSD 24.213669 1EWDE23 -5.365133 1E23CAP 1EIDE23 -5.365135 1ESDE23 -16.095398 2E23CAP PRICER 55.581573 2CPTE23 1. 2E23CAP 2UTLE23 -6.311683 2EPKWD 24.213669 2E23CAP 2EPKSD 24.213669 2EWDE23 -5.365133 2E23CAP 2EIDE23 -5.365135 2ESDE23 -16.095398 3E23CAP PRICER 41.53389 3CPTE23 1. 3E23CAP 3UTLE23 -6.311683 3EPKWD 24.213669 3E23CAP 3EPKSD 24.213669 3EWDE23 -5.365133 3E23CAP 3EIDE23 -5.365135 3ESDE23 -16.095398 1E31CAP 1CPTE31 1. 1EPKWD 24.213669 1E31CAP 1EPKSD 24.213669 1EWDE31 -1.199279 1E31CAP 1EWNE31 -1.199279 1EIDE31 -.738504 1E31CAP 1EINE31 -.397656 1ESDE31 -2.442742 1E31CAP 1ESNE31 -.965735 2E31CAP 2CPTE31 1. 2EPKWD 24.213669 2E31CAP 2EPKSD 24.213669 2EWDE31 -1.199279 2E31CAP 2EWNE31 -1.199279 2EIDE31 -.738504 2E31CAP 2EINE31 -.397656 2ESDE31 -2.442742 2E31CAP 2ESNE31 -.965735 3E31CAP 3CPTE31 1. 3EPKWD 24.213669 3E31CAP 3EPKSD 24.213669 3EWDE31 -1.199279 3E31CAP 3EWNE31 -1.199279 3EIDE31 -.738504 3E31CAP 3EINE31 -.397656 3ESDE31 -2.442742 3E31CAP 3ESNE31 -.965735 2E35CAP PRICER 21.229065 2CPTE35 1. 2E35CAP 3GRCE35 -32. 2EWDE35 -.883679 2E35CAP 2EWNE35 -.883679 2EIDE35 -1.148784 2E35CAP 2EINE35 -.618576 2ESDE35 -3.121283 2E35CAP 2ESNE35 -1.234 3E35CAP PRICER 15.863641 3CPTE35 1. 3E35CAP 3GRCE35 1. 3EWDE35 -.883679 3E35CAP 3EWNE35 -.883679 3EIDE35 -1.148784 3E35CAP 3EINE35 -.618576 3ESDE35 -3.121283 3E35CAP 3ESNE35 -1.234 3E94CAP PRICER 61.723953 3CPTE94 1. 3E94CAP 3EPKWD 26.521011 3EPKSD 26.521011 3E94CAP 3EWDE94 -3.156 3EWNE94 -3.156 3E94CAP 3EIDE94 -4.1028 3EINE94 -2.2092 3E94CAP 3ESDE94 -13.570797 3ESNE94 -5.365198 3E60CAP PRICER 74.414856 3CPTE60 1. 3E60CAP 3EPKWD 26.521011 3EPKSD 26.521011 3E60CAP 3EWDE60 -2.114518 3EWNE60 -2.114518 3E60CAP 3EIDE60 -2.748875 3EINE60 -1.480163 3E60CAP 3ESDE60 -9.092433 3ESNE60 -3.594682 3E60CAP 3HPKW 31.56 1E51CAP PRICER 71.281189 1CPTE51 1. 1E51CAP 1EPKWD 24.213669 1EPKSD 24.213669 1E51CAP 1EWDE51 -2.840398 1EIDE51 -3.692519 1E51CAP 1ESDE51 -12.213717 2E51CAP PRICER 53.265671 2CPTE51 1. 2E51CAP 2EPKWD 24.213669 2EPKSD 24.213669 2E51CAP 2EWDE51 -2.840398 2EIDE51 -3.692519 2E51CAP 2ESDE51 -12.213717 3E51CAP PRICER 39.803314 3CPTE51 1. 3E51CAP 3EPKWD 24.213669 3EPKSD 24.213669 3E51CAP 3EWDE51 -2.840398 3EIDE51 -3.692519 3E51CAP 3ESDE51 -12.213717 1EC1WD PRICER 5.448 1BALHCO -3.637 1EC1WD 1BALDSL -.066667 1BALEWD .913 1EC1WD 1EWDEC1 1. 1EC1ID PRICER 5.448 1BALHCO -3.637 1EC1ID 1BALDSL -.066667 1BALEID .913 1EC1ID 1EIDEC1 1. 1EC1SD PRICER 5.448 1BALHCO -3.637 1EC1SD 1BALDSL -.066667 1BALESD .913 1EC1SD 1ESDEC1 1. 1EC1WN PRICER 5.448 1BALHCO -3.637 1EC1WN 1BALDSL -.066667 1BALEWN .913 1EC1WN 1EWNEC1 1. 1BASW -.77605 1EC1IN PRICER 5.448 1BALHCO -3.637 1EC1IN 1BALDSL -.066667 1BALEIN .913 1EC1IN 1EINEC1 1. 1BASI -.77605 1EC1SN PRICER 5.448 1BALHCO -3.637 1EC1SN 1BALDSL -.066667 1BALESN .913 1EC1SN 1ESNEC1 1. 1BASS -.77605 2EC1WD PRICER 4.071078 2BALHCO -3.637 2EC1WD 2BALDSL -.066667 2BALEWD .913 2EC1WD 2EWDEC1 1. 2EC1ID PRICER 4.071078 2BALHCO -3.637 2EC1ID 2BALDSL -.066667 2BALEID .913 2EC1ID 2EIDEC1 1. 2EC1SD PRICER 4.071078 2BALHCO -3.637 2EC1SD 2BALDSL -.066667 2BALESD .913 2EC1SD 2ESDEC1 1. 2EC1WN PRICER 4.071078 2BALHCO -3.637 2EC1WN 2BALDSL -.066667 2BALEWN .913 2EC1WN 2EWNEC1 1. 2BASW -.77605 2EC1IN PRICER 4.071078 2BALHCO -3.637 2EC1IN 2BALDSL -.066667 2BALEIN .913 2EC1IN 2EINEC1 1. 2BASI -.77605 2EC1SN PRICER 4.071078 2BALHCO -3.637 2EC1SN 2BALDSL -.066667 2BALESN .913 2EC1SN 2ESNEC1 1. 2BASS -.77605 3EC1WD PRICER 3.042154 3BALHCO -3.637 3EC1WD 3BALDSL -.066667 3BALEWD .913 3EC1WD 3EWDEC1 1. 3EC1ID PRICER 3.042154 3BALHCO -3.637 3EC1ID 3BALDSL -.066667 3BALEID .913 3EC1ID 3EIDEC1 1. 3EC1SD PRICER 3.042154 3BALHCO -3.637 3EC1SD 3BALDSL -.066667 3BALESD .913 3EC1SD 3ESDEC1 1. 3EC1WN PRICER 3.042154 3BALHCO -3.637 3EC1WN 3BALDSL -.066667 3BALEWN .913 3EC1WN 3EWNEC1 1. 3BASW -.77605 3EC1IN PRICER 3.042154 3BALHCO -3.637 3EC1IN 3BALDSL -.066667 3BALEIN .913 3EC1IN 3EINEC1 1. 3BASI -.77605 3EC1SN PRICER 3.042154 3BALHCO -3.637 3EC1SN 3BALDSL -.066667 3BALESN .913 3EC1SN 3ESNEC1 1. 3BASS -.77605 1EC2WD PRICER 4.457562 1BALHCO -2.9758 1EC2WD 1BALDSL -.054545 1BALEWD .913 1EC2WD 1EWDEC2 1. 1EC2ID PRICER 4.457562 1BALHCO -2.9758 1EC2ID 1BALDSL -.054545 1BALEID .913 1EC2ID 1EIDEC2 1. 1EC2SD PRICER 4.457562 1BALHCO -2.9758 1EC2SD 1BALDSL -.054545 1BALESD .913 1EC2SD 1ESDEC2 1. 1EC2WN PRICER 4.457562 1BALHCO -2.9758 1EC2WN 1BALDSL -.054545 1BALEWN .913 1EC2WN 1EWNEC2 1. 1BASW -.77605 1EC2IN PRICER 4.457562 1BALHCO -2.9758 1EC2IN 1BALDSL -.054545 1BALEIN .913 1EC2IN 1EINEC2 1. 1BASI -.77605 1EC2SN PRICER 4.457562 1BALHCO -2.9758 1EC2SN 1BALDSL -.054545 1BALESN .913 1EC2SN 1ESNEC2 1. 1BASS -.77605 2EC2WD PRICER 3.330964 2BALHCO -2.9758 2EC2WD 2BALDSL -.054545 2BALEWD .913 2EC2WD 2EWDEC2 1. 2EC2ID PRICER 3.330964 2BALHCO -2.9758 2EC2ID 2BALDSL -.054545 2BALEID .913 2EC2ID 2EIDEC2 1. 2EC2SD PRICER 3.330964 2BALHCO -2.9758 2EC2SD 2BALDSL -.054545 2BALESD .913 2EC2SD 2ESDEC2 1. 2EC2WN PRICER 3.330964 2BALHCO -2.9758 2EC2WN 2BALDSL -.054545 2BALEWN .913 2EC2WN 2EWNEC2 1. 2BASW -.77605 2EC2IN PRICER 3.330964 2BALHCO -2.9758 2EC2IN 2BALDSL -.054545 2BALEIN .913 2EC2IN 2EINEC2 1. 2BASI -.77605 2EC2SN PRICER 3.330964 2BALHCO -2.9758 2EC2SN 2BALDSL -.054545 2BALESN .913 2EC2SN 2ESNEC2 1. 2BASS -.77605 3EC2WD PRICER 2.489097 3BALHCO -2.9758 3EC2WD 3BALDSL -.054545 3BALEWD .913 3EC2WD 3EWDEC2 1. 3EC2ID PRICER 2.489097 3BALHCO -2.9758 3EC2ID 3BALDSL -.054545 3BALEID .913 3EC2ID 3EIDEC2 1. 3EC2SD PRICER 2.489097 3BALHCO -2.9758 3EC2SD 3BALDSL -.054545 3BALESD .913 3EC2SD 3ESDEC2 1. 3EC2WN PRICER 2.489097 3BALHCO -2.9758 3EC2WN 3BALDSL -.054545 3BALEWN .913 3EC2WN 3EWNEC2 1. 3BASW -.77605 3EC2IN PRICER 2.489097 3BALHCO -2.9758 3EC2IN 3BALDSL -.054545 3BALEIN .913 3EC2IN 3EINEC2 1. 3BASI -.77605 3EC2SN PRICER 2.489097 3BALHCO -2.9758 3EC2SN 3BALDSL -.054545 3BALESN .913 3EC2SN 3ESNEC2 1. 3BASS -.77605 1EC3WD PRICER 5.635665 1BALHCO -2.7278 1EC3WD 1BALDSL -.05 1BALEWD .913 1EC3WD 1EWDEC3 1. 1EC3ID PRICER 5.635665 1BALHCO -2.7278 1EC3ID 1BALDSL -.05 1BALEID .913 1EC3ID 1EIDEC3 1. 1EC3SD PRICER 5.635665 1BALHCO -2.7278 1EC3SD 1BALDSL -.05 1BALESD .913 1EC3SD 1ESDEC3 1. 1EC3WN PRICER 5.635665 1BALHCO -2.7278 1EC3WN 1BALDSL -.05 1BALEWN .913 1EC3WN 1EWNEC3 1. 1BASW -.77605 1EC3IN PRICER 5.635665 1BALHCO -2.7278 1EC3IN 1BALDSL -.05 1BALEIN .913 1EC3IN 1EINEC3 1. 1BASI -.77605 1EC3SN PRICER 5.635665 1BALHCO -2.7278 1EC3SN 1BALDSL -.05 1BALESN .913 1EC3SN 1ESNEC3 1. 1BASS -.77605 2EC3WD PRICER 4.211314 2BALHCO -2.7278 2EC3WD 2BALDSL -.05 2BALEWD .913 2EC3WD 2EWDEC3 1. 2EC3ID PRICER 4.211314 2BALHCO -2.7278 2EC3ID 2BALDSL -.05 2BALEID .913 2EC3ID 2EIDEC3 1. 2EC3SD PRICER 4.211314 2BALHCO -2.7278 2EC3SD 2BALDSL -.05 2BALESD .913 2EC3SD 2ESDEC3 1. 2EC3WN PRICER 4.211314 2BALHCO -2.7278 2EC3WN 2BALDSL -.05 2BALEWN .913 2EC3WN 2EWNEC3 1. 2BASW -.77605 2EC3IN PRICER 4.211314 2BALHCO -2.7278 2EC3IN 2BALDSL -.05 2BALEIN .913 2EC3IN 2EINEC3 1. 2BASI -.77605 2EC3SN PRICER 4.211314 2BALHCO -2.7278 2EC3SN 2BALDSL -.05 2BALESN .913 2EC3SN 2ESNEC3 1. 2BASS -.77605 3EC3WD PRICER 3.146947 3BALHCO -2.7278 3EC3WD 3BALDSL -.05 3BALEWD .913 3EC3WD 3EWDEC3 1. 3EC3ID PRICER 3.146947 3BALHCO -2.7278 3EC3ID 3BALDSL -.05 3BALEID .913 3EC3ID 3EIDEC3 1. 3EC3SD PRICER 3.146947 3BALHCO -2.7278 3EC3SD 3BALDSL -.05 3BALESD .913 3EC3SD 3ESDEC3 1. 3EC3WN PRICER 3.146947 3BALHCO -2.7278 3EC3WN 3BALDSL -.05 3BALEWN .913 3EC3WN 3EWNEC3 1. 3BASW -.77605 3EC3IN PRICER 3.146947 3BALHCO -2.7278 3EC3IN 3BALDSL -.05 3BALEIN .913 3EC3IN 3EINEC3 1. 3BASI -.77605 3EC3SN PRICER 3.146947 3BALHCO -2.7278 3EC3SN 3BALDSL -.05 3BALESN .913 3EC3SN 3ESNEC3 1. 3BASS -.77605 1EP1WD PRICER 22.382751 1BALDSH -3.3333 1EP1WD 1BNDEP1L 1. 1BALEWD .913 1EP1WD 1EWDEP1 1. 1EP1ID PRICER 22.382751 1BALDSH -3.3333 1EP1ID 1BNDEP1L 1. 1BALEID .913 1EP1ID 1EIDEP1 1. 1EP1SD PRICER 22.382751 1BALDSH -3.3333 1EP1SD 1BNDEP1L 1. 1BALESD .913 1EP1SD 1ESDEP1 1. 1EP1WN PRICER 22.382751 1BALDSH -3.3333 1EP1WN 1BNDEP1L 1. 1BALEWN .913 1EP1WN 1EWNEP1 1. 1BASW -.77605 1EP1IN PRICER 22.382751 1BALDSH -3.3333 1EP1IN 1BNDEP1L 1. 1BALEIN .913 1EP1IN 1EINEP1 1. 1BASI -.77605 1EP1SN PRICER 22.382751 1BALDSH -3.3333 1EP1SN 1BNDEP1L 1. 1BALESN .913 1EP1SN 1ESNEP1 1. 1BASS -.77605 2EP1WD PRICER 16.725754 2BALDSH -3.3333 2EP1WD 2BNDEP1L 1. 2BALEWD .913 2EP1WD 2EWDEP1 1. 2EP1ID PRICER 16.725754 2BALDSH -3.3333 2EP1ID 2BNDEP1L 1. 2BALEID .913 2EP1ID 2EIDEP1 1. 2EP1SD PRICER 16.725754 2BALDSH -3.3333 2EP1SD 2BNDEP1L 1. 2BALESD .913 2EP1SD 2ESDEP1 1. 2EP1WN PRICER 16.725754 2BALDSH -3.3333 2EP1WN 2BNDEP1L 1. 2BALEWN .913 2EP1WN 2EWNEP1 1. 2BASW -.77605 2EP1IN PRICER 16.725754 2BALDSH -3.3333 2EP1IN 2BNDEP1L 1. 2BALEIN .913 2EP1IN 2EINEP1 1. 2BASI -.77605 2EP1SN PRICER 16.725754 2BALDSH -3.3333 2EP1SN 2BNDEP1L 1. 2BALESN .913 2EP1SN 2ESNEP1 1. 2BASS -.77605 3EP1WD PRICER 12.498495 3BALDSH -3.3333 3EP1WD 3BALEWD .913 3EWDEP1 1. 3EP1ID PRICER 12.498495 3BALDSH -3.3333 3EP1ID 3BALEID .913 3EIDEP1 1. 3EP1SD PRICER 12.498495 3BALDSH -3.3333 3EP1SD 3BALESD .913 3ESDEP1 1. 3EP1WN PRICER 12.498495 3BALDSH -3.3333 3EP1WN 3BALEWN .913 3EWNEP1 1. 3EP1WN 3BASW -.77605 3EP1IN PRICER 12.498495 3BALDSH -3.3333 3EP1IN 3BALEIN .913 3EINEP1 1. 3EP1IN 3BASI -.77605 3EP1SN PRICER 12.498495 3BALDSH -3.3333 3EP1SN 3BALESN .913 3ESNEP1 1. 3EP1SN 3BASS -.77605 1E14WD PRICER 4.183896 1BALDSL -3.5971 1E14WD 1BALEWD .913 1EWDE14 1. 1E14ID PRICER 4.183896 1BALDSL -3.5971 1E14ID 1BALEID .913 1EIDE14 1. 1E14SD PRICER 4.183896 1BALDSL -3.5971 1E14SD 1BALESD .913 1ESDE14 1. 1E14WN PRICER 4.183896 1BALDSL -3.5971 1E14WN 1BALEWN .913 1EWNE14 1. 1E14WN 1BASW -.77605 1E14IN PRICER 4.183896 1BALDSL -3.5971 1E14IN 1BALEIN .913 1EINE14 1. 1E14IN 1BASI -.77605 1E14SN PRICER 4.183896 1BALDSL -3.5971 1E14SN 1BALESN .913 1ESNE14 1. 1E14SN 1BASS -.77605 2E14WD PRICER 3.126463 2BALDSL -3.5971 2E14WD 2BALEWD .913 2EWDE14 1. 2E14ID PRICER 3.126463 2BALDSL -3.5971 2E14ID 2BALEID .913 2EIDE14 1. 2E14SD PRICER 3.126463 2BALDSL -3.5971 2E14SD 2BALESD .913 2ESDE14 1. 2E14WN PRICER 3.126463 2BALDSL -3.5971 2E14WN 2BALEWN .913 2EWNE14 1. 2E14WN 2BASW -.77605 2E14IN PRICER 3.126463 2BALDSL -3.5971 2E14IN 2BALEIN .913 2EINE14 1. 2E14IN 2BASI -.77605 2E14SN PRICER 3.126463 2BALDSL -3.5971 2E14SN 2BALESN .913 2ESNE14 1. 2E14SN 2BASS -.77605 3E14WD PRICER 2.336281 3BALDSL -3.5971 3E14WD 3BALEWD .913 3EWDE14 1. 3E14ID PRICER 2.336281 3BALDSL -3.5971 3E14ID 3BALEID .913 3EIDE14 1. 3E14SD PRICER 2.336281 3BALDSL -3.5971 3E14SD 3BALESD .913 3ESDE14 1. 3E14WN PRICER 2.336281 3BALDSL -3.5971 3E14WN 3BALEWN .913 3EWNE14 1. 3E14WN 3BASW -.77605 3E14IN PRICER 2.336281 3BALDSL -3.5971 3E14IN 3BALEIN .913 3EINE14 1. 3E14IN 3BASI -.77605 3E14SN PRICER 2.336281 3BALDSL -3.5971 3E14SN 3BALESN .913 3ESNE14 1. 3E14SN 3BASS -.77605 1E22WD PRICER 1.807856 1BALPLU .016627 1E22WD 1BALMAG -12.6582 2BALPLU .007126 1E22WD 1BALEWD .4565 1BALEWN .4565 1E22WD 1EWDE22 1. 1BASW .068475 1E22ID PRICER 1.807856 1BALPLU .016627 1E22ID 1BALMAG -12.6582 2BALPLU .007126 1E22ID 1BALEID .59345 1BALEIN .31955 1E22ID 1EIDE22 1. 1BASI .047932 1E22SD PRICER 1.807856 1BALPLU .016627 1E22SD 1BALMAG -12.6582 2BALPLU .007126 1E22SD 1BALESD .654317 1BALESN .258683 1E22SD 1ESDE22 1. 1BASS .038802 2E22WD PRICER 1.350941 2BALPLU .016627 2E22WD 2BALMAG -12.6582 3BALPLU .007126 2E22WD 2BALEWD .4565 2BALEWN .4565 2E22WD 2EWDE22 1. 2BASW .068475 2E22ID PRICER 1.350941 2BALPLU .016627 2E22ID 2BALMAG -12.6582 3BALPLU .007126 2E22ID 2BALEID .59345 2BALEIN .31955 2E22ID 2EIDE22 1. 2BASI .047932 2E22SD PRICER 1.350941 2BALPLU .016627 2E22SD 2BALMAG -12.6582 3BALPLU .007126 2E22SD 2BALESD .654317 2BALESN .258683 2E22SD 2ESDE22 1. 2BASS .038802 3E22WD PRICER 1.009503 3BALPLU .016627 3E22WD 3BALMAG -12.6582 3BALEWD .4565 3E22WD 3BALEWN .4565 3EWDE22 1. 3E22WD 3BASW .068475 3E22ID PRICER 1.009503 3BALPLU .016627 3E22ID 3BALMAG -12.6582 3BALEID .59345 3E22ID 3BALEIN .31955 3EIDE22 1. 3E22ID 3BASI .047932 3E22SD PRICER 1.009503 3BALPLU .016627 3E22SD 3BALMAG -12.6582 3BALESD .654317 3E22SD 3BALESN .258683 3ESDE22 1. 3E22SD 3BASS .038802 1E23WD PRICER 1.136366 1BALAGR -1.457729 1E23WD 1BALAGS 1.457729 1BALEWD .4565 1E23WD 1BALEWN .4565 1EWDE23 1. 1E23WD 1BASW .068475 1E23ID PRICER 1.136366 1BALAGR -1.457729 1E23ID 1BALAGS 1.457729 1BALEID .59345 1E23ID 1BALEIN .31955 1EIDE23 1. 1E23ID 1BASI .047932 1E23SD PRICER 1.136366 1BALAGR -1.457729 1E23SD 1BALAGS 1.457729 1BALESD .654317 1E23SD 1BALESN .258683 1ESDE23 1. 1E23SD 1BASS .038802 2E23WD PRICER .849163 2BALAGR -1.457729 2E23WD 2BALAGS 1.457729 2BALEWD .4565 2E23WD 2BALEWN .4565 2EWDE23 1. 2E23WD 2BASW .068475 2E23ID PRICER .849163 2BALAGR -1.457729 2E23ID 2BALAGS 1.457729 2BALEID .59345 2E23ID 2BALEIN .31955 2EIDE23 1. 2E23ID 2BASI .047932 2E23SD PRICER .849163 2BALAGR -1.457729 2E23SD 2BALAGS 1.457729 2BALESD .654317 2E23SD 2BALESN .258683 2ESDE23 1. 2E23SD 2BASS .038802 3E23WD PRICER .634546 3BALAGR -1.457729 3E23WD 3BALAGS 1.457729 3BALEWD .4565 3E23WD 3BALEWN .4565 3EWDE23 1. 3E23WD 3BASW .068475 3E23ID PRICER .634546 3BALAGR -1.457729 3E23ID 3BALAGS 1.457729 3BALEID .59345 3E23ID 3BALEIN .31955 3EIDE23 1. 3E23ID 3BASI .047932 3E23SD PRICER .634546 3BALAGR -1.457729 3E23SD 3BALAGS 1.457729 3BALESD .654317 3E23SD 3BALESN .258683 3ESDE23 1. 3E23SD 3BASS .038802 1E31WD 1BALEWD .913 1EWDE31 1. 1E31ID 1BALEID .913 1EIDE31 1. 1E31SD 1BALESD .913 1ESDE31 1. 1E31WN 1BALEWN .913 1EWNE31 1. 1E31WN 1BASW -.77605 1E31IN 1BALEIN .913 1EINE31 1. 1E31IN 1BASI -.77605 1E31SN 1BALESN .913 1ESNE31 1. 1E31SN 1BASS -.77605 2E31WD 2BALEWD .913 2EWDE31 1. 2E31ID 2BALEID .913 2EIDE31 1. 2E31SD 2BALESD .913 2ESDE31 1. 2E31WN 2BALEWN .913 2EWNE31 1. 2E31WN 2BASW -.77605 2E31IN 2BALEIN .913 2EINE31 1. 2E31IN 2BASI -.77605 2E31SN 2BALESN .913 2ESNE31 1. 2E31SN 2BASS -.77605 3E31WD 3BALEWD .913 3EWDE31 1. 3E31ID 3BALEID .913 3EIDE31 1. 3E31SD 3BALESD .913 3ESDE31 1. 3E31WN 3BALEWN .913 3EWNE31 1. 3E31WN 3BASW -.77605 3E31IN 3BALEIN .913 3EINE31 1. 3E31IN 3BASI -.77605 3E31SN 3BALESN .913 3ESNE31 1. 3E31SN 3BASS -.77605 2E35WD 2BALEWD .913 2EWDE35 1. 2E35ID 2BALEID .913 2EIDE35 1. 2E35SD 2BALESD .913 2ESDE35 1. 2E35WN 2BALEWN .913 2EWNE35 1. 2E35WN 2BASW -.77605 2E35IN 2BALEIN .913 2EINE35 1. 2E35IN 2BASI -.77605 2E35SN 2BALESN .913 2ESNE35 1. 2E35SN 2BASS -.77605 3E35WD 3BALEWD .913 3EWDE35 1. 3E35ID 3BALEID .913 3EIDE35 1. 3E35SD 3BALESD .913 3ESDE35 1. 3E35WN 3BALEWN .913 3EWNE35 1. 3E35WN 3BASW -.77605 3E35IN 3BALEIN .913 3EINE35 1. 3E35IN 3BASI -.77605 3E35SN 3BALESN .913 3ESNE35 1. 3E35SN 3BASS -.77605 3E94WD PRICER 41.750214 3BALGAS -2.5 3E94WD 3BALEWD 1. 3EWDE94 1. 3E94ID PRICER 41.750214 3BALGAS -2.5 3E94ID 3BALEID 1. 3EIDE94 1. 3E94SD PRICER 41.750214 3BALGAS -2.5 3E94SD 3BALESD 1. 3ESDE94 1. 3E94WN PRICER 41.750214 3BALGAS -2.5 3E94WN 3BALEWN 1. 3EWNE94 1. 3E94WN 3BASW -.85 3E94IN PRICER 41.750214 3BALGAS -2.5 3E94IN 3BALEIN 1. 3EINE94 1. 3E94IN 3BASI -.85 3E94SN PRICER 41.750214 3BALGAS -2.5 3E94SN 3BALESN 1. 3ESNE94 1. 3E94SN 3BASS -.85 3E60WD PRICER 3.533263 3BALHCO -2.5 3E60WD 3BALEWD 1. 3EWDE60 1. 3E60WD 3BALDHW 2. 3E60ID PRICER 3.533263 3BALHCO -2.5 3E60ID 3BALEID 1. 3EIDE60 1. 3E60ID 3BALDHI 2. 3E60SD PRICER 3.533263 3BALHCO -2.5 3E60SD 3BALESD 1. 3ESDE60 1. 3E60SD 3BALDHS 2. 3E60WN PRICER 3.533263 3BALHCO -2.5 3E60WN 3BALEWN 1. 3EWNE60 1. 3E60WN 3BASW -.85 3BALDHW 2. 3E60IN PRICER 3.533263 3BALHCO -2.5 3E60IN 3BALEIN 1. 3EINE60 1. 3E60IN 3BASI -.85 3BALDHI 2. 3E60SN PRICER 3.533263 3BALHCO -2.5 3E60SN 3BALESN 1. 3ESNE60 1. 3E60SN 3BASS -.85 3BALDHS 2. 1E51WD 1BALEWD .913 1BALEWN -1.304311 1E51WD 1EWDE51 1. 1E51ID 1BALEID .913 1BALEIN -1.304311 1E51ID 1EIDE51 1. 1E51SD 1BALESD .913 1BALESN -1.304311 1E51SD 1ESDE51 1. 2E51WD 2BALEWD .913 2BALEWN -1.292807 2E51WD 2EWDE51 1. 2E51ID 2BALEID .913 2BALEIN -1.292807 2E51ID 2EIDE51 1. 2E51SD 2BALESD .913 2BALESN -1.292807 2E51SD 2ESDE51 1. 3E51WD 3BALEWD .913 3BALEWN -1.281395 3E51WD 3EWDE51 1. 3E51ID 3BALEID .913 3BALEIN -1.281395 3E51ID 3EIDE51 1. 3E51SD 3BALESD .913 3BALESN -1.281395 3E51SD 3ESDE51 1. RHS REST 1CPTEP1 12.355 1CPTE14 3.487 REST 1CPTE22 3.727 1CPTE23 2. REST 1CPTE31 1.686 1CPTE51 1. REST 1CPTS06 555. 1CPTS21 4088. REST 1CPTS23 728. 1CPTS28 445. REST 1CPTIJ6 248.21 1CPTIJ7 126.78 REST 1CPTIJ8 61.21 1CPTR20 38.95 REST 1CPTR21 24.79 1CPTR23 43.24 REST 1CPTR27 235.17 1CPTR28 52.4 REST 1CPTRT0 30.689987 1CPTRT1 61.37 REST 1CPTRT3 85.93 1CPTRT7 76.63 REST 1CPTRT8 16.63 1CPTR50 4. REST 1CPTR51 65.64 1CPTR53 34.019989 REST 1CPTR57 157.73 1CPTR58 26.34 REST 2CPTEP1 8.303 2CPTE14 2.838 REST 2CPTE22 3.727 2CPTE23 2. REST 2CPTE31 1.686 2CPTE51 1. REST 2CPTS06 229. 2CPTS21 3270. REST 2CPTS23 582. 2CPTS28 356. REST 2CPTIJ6 150. 2CPTIJ7 70. REST 2CPTIJ8 30. 2CPTR20 20. REST 2CPTR21 12. 2CPTR23 22. REST 2CPTR27 118. 2CPTR28 26. REST 2CPTRT0 15. 2CPTRT1 30. REST 2CPTRT3 43. 2CPTRT7 38. REST 2CPTRT8 8. 2CPTR50 2. REST 2CPTR51 32. 2CPTR53 17. REST 2CPTR57 80. 2CPTR58 13. REST 3CPTEP1 7.765 3CPTE14 2.838 REST 3CPTE22 2.906 3CPTE23 2. REST 3CPTE31 1.686 3CPTE51 1. REST 3CPTS06 153. 3CPTS21 2453. REST 3CPTS23 437. 3CPTS28 267. REST 3CPTIJ6 50. 3CPTIJ7 30. REST 3CPTR20 10. 3CPTR21 6. REST 3CPTR23 11. 3CPTR27 59. REST 3CPTR28 13. 3CPTRT0 7.5 REST 3CPTRT1 15. 3CPTRT3 21. REST 3CPTRT7 19. 3CPTRT8 4. REST 3CPTR50 1. 3CPTR51 16. REST 3CPTR53 8.5 3CPTR57 40. REST 3CPTR58 6.5 3GRCE35 .01 REST 1DEMI1 332.829834 1DEMII 826.959961 REST 1DEMIJ 436.189941 1DEMNY 616.079834 REST 1DEMR2 617.72998 1DEMRT 277.599854 REST 1DEMR5 287.72998 1DEMRD 417.99 REST 1DEMT8 1161.799805 1DEMTX 327.7 REST 2DEMI1 328.219971 2DEMII 827.689941 REST 2DEMIJ 397.099854 2DEMNY 626.849854 REST 2DEMR2 606.099854 2DEMRT 268.7 REST 2DEMR5 277.139893 2DEMRD 413.799805 REST 2DEMT8 1200. 2DEMTX 338.5 REST 3DEMI1 291.689941 3DEMII 855.269775 REST 3DEMIJ 376.829834 3DEMNY 634.919922 REST 3DEMR2 576.839844 3DEMRT 264.799805 REST 3DEMR5 264.829834 3DEMRD 418.579834 REST 3DEMT8 1201.599854 3DEMTX 358.9 REST 1BNDEP1L 64.659988 2BNDEP1L 24.25 BOUNDS FX BNDSET1 1MINHCO1 3084.099854 UP BNDSET1 2MINHCO1 3084.099854 UP BNDSET1 3MINHCO1 3039. UP BNDSET1 1STKOIK1 28940. FX BNDSET1 1EXPDSH1 91. FX BNDSET1 2EXPDSH1 61. FX BNDSET1 3EXPDSH1 61. FX BNDSET1 1EXPDSL1 23. FX BNDSET1 2EXPDSL1 17. FX BNDSET1 3EXPDSL1 17. UP BNDSET1 1EXPGAS1 .1 UP BNDSET1 2EXPGAS1 .1 UP BNDSET1 3EXPGAS1 .1 UP BNDSET1 1STKGAK1 12058. UP BNDSET1 1STKURN1 .1 UP BNDSET1 1STKUDP1 .1 UP BNDSET1 1STKPLU1 1.5 UP BNDSET1 1STKAGS1 .0001 UP BNDSET1 1STKLMS1 .0001 UP BNDSET1 2E35INV .0001 UP BNDSET1 3E35INV .0001 UP BNDSET1 3E94INV .0001 UP BNDSET1 3E60INV .0001 UP BNDSET1 3S80INV .001 LO BNDSET1 1IJ6CAP 248.21 LO BNDSET1 2IJ6CAP 150. LO BNDSET1 3IJ6CAP 50. LO BNDSET1 1IJ7CAP 126.78 LO BNDSET1 2IJ7CAP 70. LO BNDSET1 3IJ7CAP 30. LO BNDSET1 1IJ8CAP 61.21 LO BNDSET1 2IJ8CAP 30. LO BNDSET1 1R20CAP 38.95 LO BNDSET1 2R20CAP 20. LO BNDSET1 3R20CAP 10. LO BNDSET1 1R21CAP 24.79 LO BNDSET1 2R21CAP 12. LO BNDSET1 3R21CAP 6. LO BNDSET1 1R23CAP 43.24 LO BNDSET1 2R23CAP 22. LO BNDSET1 3R23CAP 11. LO BNDSET1 1R27CAP 235.17 LO BNDSET1 2R27CAP 118. LO BNDSET1 3R27CAP 59. LO BNDSET1 1R28CAP 52.4 LO BNDSET1 2R28CAP 26. LO BNDSET1 3R28CAP 13. UP BNDSET1 2R2ACAP .29 UP BNDSET1 3R2ACAP .58 FX BNDSET1 1R2YCAP 223.18 FX BNDSET1 2R2YCAP 218.49 FX BNDSET1 3R2YCAP 205.62 FX BNDSET1 1RT0CAP 30.689987 LO BNDSET1 2RT0CAP 15. LO BNDSET1 3RT0CAP 7.5 FX BNDSET1 1RT1CAP 61.37 LO BNDSET1 2RT1CAP 30. LO BNDSET1 3RT1CAP 15. FX BNDSET1 1RT7CAP 76.63 LO BNDSET1 2RT7CAP 38. LO BNDSET1 3RT7CAP 19. FX BNDSET1 1RT8CAP 16.63 LO BNDSET1 2RT8CAP 8. LO BNDSET1 3RT8CAP 4. FX BNDSET1 1RTYCAP 6.3 FX BNDSET1 2RTYCAP 4.9 FX BNDSET1 3RTYCAP 4.2 FX BNDSET1 1R50CAP 4. LO BNDSET1 2R50CAP 2. LO BNDSET1 3R50CAP 1. FX BNDSET1 1R53CAP 34.019989 LO BNDSET1 2R53CAP 17. LO BNDSET1 3R53CAP 8.5 FX BNDSET1 1R57CAP 157.73 LO BNDSET1 2R57CAP 80. LO BNDSET1 3R57CAP 40. FX BNDSET1 1R58CAP 26.34 LO BNDSET1 2R58CAP 13. LO BNDSET1 3R58CAP 6.5 UP BNDSET1 2R5ACAP .09 UP BNDSET1 3R5ACAP .18 FX BNDSET1 1T80CAP 8.32 FX BNDSET1 1T8FCAP 754.629883 FX BNDSET1 2T8FCAP 728.629883 FX BNDSET1 3T8FCAP 702.629883 FX BNDSET1 1S06CAP 555. FX BNDSET1 2S06CAP 229. FX BNDSET1 3S06CAP 153. UP BNDSET1 1S08CAP 115. UP BNDSET1 2S08CAP 384. UP BNDSET1 3S08CAP 458. FX BNDSET1 1S79CAP 1457. UP BNDSET1 2S79CAP 1840. UP BNDSET1 3S79CAP 2060. FX BNDSET1 1S7ACAP 3640. UP BNDSET1 2S7ACAP 4967. UP BNDSET1 3S7ACAP 4290. FX BNDSET1 1EC1CAP 9.536 FX BNDSET1 2EC1CAP 4.392 FX BNDSET1 3EC1CAP .622 FX BNDSET1 1EC2CAP 35.288 FX BNDSET1 2EC2CAP 34.874 FX BNDSET1 3EC2CAP 33.635986 LO BNDSET1 3EC3CAP 1.875 FX BNDSET1 1EP1CAP 12.355 FX BNDSET1 2EP1CAP 14.817 LO BNDSET1 2E14CAP 3.109 FX BNDSET1 1E22CAP 3.727 FX BNDSET1 2E22CAP 3.727 FX BNDSET1 3E22CAP 2.906 FX BNDSET1 1E23CAP 2. FX BNDSET1 2E23CAP 5.112 FX BNDSET1 3E23CAP 7.592 UP BNDSET1 1E31CAP 1.686 UP BNDSET1 2E31CAP 1.686 UP BNDSET1 3E31CAP 1.686 UP BNDSET1 2E35CAP .005 UP BNDSET1 3E35CAP 1. UP BNDSET1 3E60CAP 3. FX BNDSET1 1E51CAP 1.3 UP BNDSET1 2E51CAP 1.301 UP BNDSET1 3E51CAP 1.301 ENDATA CoinMP-1.8.3/Data/Sample/input.1300000644000175000017500000207141510430174061015000 0ustar renereneBEGIN NETGEN PROBLEM 130 5000 NODES AND 12500 ARCS USER: 25440925 500 500 1 100 250000 DATA: 500 500 0 100 1 1000 SUPPLY 1 223 2 220 3 1103 4 75 5 800 6 392 7 132 8 622 9 309 10 145 11 113 12 206 13 427 14 480 15 797 16 963 17 339 18 865 19 826 20 1291 21 117 22 481 23 547 24 837 25 935 26 34 27 354 28 390 29 1016 30 934 31 693 32 411 33 137 34 800 35 48 36 854 37 817 38 756 39 523 40 1074 41 507 42 440 43 256 44 22 45 569 46 341 47 410 48 129 49 1269 50 570 51 456 52 320 53 415 54 105 55 445 56 863 57 104 58 620 59 300 60 286 61 435 62 87 63 97 64 435 65 773 66 137 67 99 68 792 69 544 70 558 71 275 72 467 73 350 74 477 75 1231 76 486 77 773 78 422 79 526 80 402 81 602 82 262 83 321 84 1135 85 459 86 915 87 505 88 193 89 1133 90 500 91 742 92 403 93 442 94 1077 95 552 96 398 97 292 98 1180 99 449 100 618 101 623 102 695 103 312 104 447 105 420 106 758 107 880 108 846 109 694 110 804 111 411 112 299 113 395 114 120 115 702 116 269 117 703 118 619 119 172 120 689 121 341 122 699 123 735 124 4 125 764 126 735 127 271 128 564 129 28 130 32 131 822 132 654 133 561 134 644 135 621 136 392 137 964 138 108 139 394 140 1149 141 284 142 433 143 346 144 168 145 982 146 790 147 469 148 287 149 427 150 763 151 407 152 323 153 776 154 1109 155 896 156 288 157 680 158 1632 159 385 160 364 161 1053 162 382 163 582 164 378 165 217 166 412 167 378 168 371 169 420 170 1017 171 719 172 24 173 476 174 692 175 334 176 426 177 26 178 71 179 45 180 97 181 619 182 803 183 236 184 293 185 571 186 497 187 390 188 451 189 545 190 524 191 27 192 402 193 468 194 721 195 497 196 584 197 630 198 755 199 308 200 853 201 1693 202 1352 203 224 204 247 205 688 206 585 207 334 208 526 209 399 210 270 211 826 212 150 213 472 214 545 215 275 216 732 217 675 218 351 219 897 220 572 221 270 222 68 223 843 224 352 225 395 226 584 227 192 228 379 229 325 230 843 231 105 232 978 233 446 234 102 235 315 236 368 237 293 238 391 239 816 240 456 241 490 242 123 243 146 244 498 245 595 246 229 247 761 248 520 249 1198 250 463 251 497 252 529 253 913 254 543 255 584 256 193 257 614 258 449 259 1 260 612 261 349 262 355 263 511 264 1586 265 383 266 192 267 92 268 842 269 601 270 39 271 276 272 363 273 371 274 53 275 486 276 348 277 407 278 647 279 417 280 1070 281 32 282 887 283 387 284 339 285 882 286 400 287 410 288 534 289 932 290 367 291 747 292 470 293 202 294 680 295 354 296 730 297 451 298 408 299 559 300 1159 301 153 302 260 303 689 304 914 305 83 306 256 307 52 308 194 309 1290 310 473 311 717 312 163 313 728 314 756 315 353 316 294 317 316 318 213 319 698 320 407 321 416 322 385 323 532 324 277 325 593 326 972 327 694 328 289 329 1387 330 296 331 922 332 184 333 535 334 1428 335 384 336 271 337 74 338 427 339 400 340 584 341 411 342 656 343 453 344 327 345 729 346 265 347 663 348 968 349 246 350 250 351 144 352 189 353 713 354 317 355 439 356 404 357 937 358 218 359 803 360 333 361 215 362 217 363 757 364 437 365 888 366 318 367 104 368 358 369 451 370 451 371 135 372 753 373 273 374 22 375 284 376 15 377 1020 378 326 379 436 380 360 381 389 382 949 383 311 384 990 385 75 386 563 387 481 388 546 389 455 390 356 391 496 392 525 393 682 394 215 395 632 396 339 397 91 398 326 399 8 400 413 401 448 402 597 403 854 404 227 405 337 406 326 407 402 408 212 409 265 410 415 411 239 412 659 413 603 414 827 415 28 416 309 417 384 418 115 419 386 420 342 421 523 422 309 423 204 424 264 425 632 426 692 427 930 428 648 429 404 430 264 431 1014 432 298 433 498 434 36 435 141 436 957 437 574 438 507 439 257 440 531 441 1178 442 689 443 445 444 422 445 1222 446 404 447 516 448 298 449 359 450 196 451 394 452 412 453 276 454 484 455 635 456 204 457 826 458 169 459 361 460 906 461 1143 462 484 463 670 464 248 465 94 466 109 467 506 468 718 469 381 470 1110 471 414 472 1002 473 327 474 452 475 379 476 315 477 1012 478 572 479 421 480 653 481 492 482 485 483 91 484 667 485 793 486 192 487 631 488 404 489 635 490 60 491 252 492 739 493 117 494 412 495 804 496 472 497 672 498 833 499 1251 500 638 ARCS 1 1890 47 223 1 1745 90 194 1 2252 68 612 505 3498 71 223 505 4707 94 223 505 2628 71 375 941 3285 33 223 941 649 1 308 941 1930 21 351 1730 2231 5 223 1730 2634 42 263 1730 167 50 156 1890 505 61 223 1890 1204 93 959 2231 4450 90 223 2231 1227 77 670 2231 2893 61 898 3285 1730 90 223 3285 2960 2 572 3285 2496 79 227 3498 941 63 223 3498 570 14 579 3498 3089 5 165 4450 4932 35 223 4450 2364 18 89 4450 1331 34 61 2 3149 96 220 2 4853 6 753 1256 3667 25 220 1256 4279 83 645 1256 3207 53 466 2358 4513 73 220 2358 202 63 151 2770 4472 36 220 2770 2837 91 401 3149 3856 15 220 3149 1948 55 604 3149 2839 94 172 3667 2358 69 220 3667 3172 12 305 3667 3591 70 846 3856 4243 52 220 3856 4684 33 220 3856 3273 39 430 4243 2770 30 220 4243 837 85 347 4243 4038 95 343 4472 1256 78 220 4472 2370 2 984 3 3225 42 1103 3 2531 61 326 3 433 2 3 2280 3684 82 1103 2280 715 53 919 2280 514 41 275 2608 3932 17 1103 2608 2138 64 293 2608 1694 49 504 3225 3734 36 1103 3225 3688 86 893 3365 2280 5 1103 3365 4245 17 654 3684 2608 99 1103 3684 4319 1 377 3684 1271 64 104 3734 3365 72 1103 3734 4578 94 1103 3734 3581 65 175 3734 484 57 539 3932 4774 95 1103 3932 820 31 479 3932 3144 36 30 4 3408 51 75 4 1634 14 68 4 4261 21 402 683 4122 86 75 683 4788 98 75 683 4142 75 57 683 1337 77 506 1857 2877 31 75 1857 2111 22 479 1857 1672 7 908 2160 683 89 75 2160 1842 56 797 2877 4822 46 75 2877 4887 67 45 3408 2160 24 75 3408 2475 7 705 3408 2044 30 727 4122 1857 35 75 4122 1102 23 480 5 2037 20 800 5 3900 58 72 5 4855 99 527 859 4848 37 800 859 2944 29 40 859 3611 46 806 864 859 51 800 864 1514 29 725 864 360 95 421 1516 4074 39 800 1516 878 3 910 1516 890 53 47 1950 864 16 800 1950 4648 80 800 1950 1965 76 897 2037 3311 71 800 2037 2166 99 478 3311 1516 44 800 3311 104 62 576 3311 4481 77 158 3786 1950 38 800 3786 159 38 685 3786 3893 27 47 4074 3786 24 800 4074 2348 71 720 6 1315 57 392 6 3193 78 763 521 2260 90 392 521 3029 27 210 1315 2412 30 392 1315 2691 77 852 1315 3526 24 565 2260 2737 62 392 2260 4233 61 486 2412 4019 99 392 2412 1325 75 322 2412 488 44 558 2641 4464 38 392 2641 4649 45 756 2641 1336 25 238 2737 2641 25 392 2737 3789 14 65 2737 378 43 616 2818 4008 20 392 2818 1081 19 814 2818 280 5 694 4008 521 1 392 4008 3922 48 516 4019 2818 83 392 4019 4776 12 392 4019 1938 65 532 4464 4634 88 392 4464 305 23 632 7 3805 73 132 7 2369 76 718 714 3037 87 132 714 1258 71 90 2715 4016 11 132 2715 4484 79 988 2715 1299 58 621 3037 4663 68 132 3037 3922 34 170 3037 2295 45 980 3733 2715 72 132 3733 1463 6 424 3805 4205 17 132 3805 4730 76 132 3805 3271 56 196 4016 714 24 132 4016 1210 69 380 4016 2371 61 209 4205 3733 90 132 4205 2075 10 677 4205 4365 95 361 8 2573 32 622 8 265 96 567 8 2946 23 597 1265 1299 50 622 1265 1230 18 451 1299 3374 13 622 1299 4280 61 408 1299 459 59 186 1326 4821 7 622 1326 4788 37 622 1326 1052 47 231 1326 1812 100 433 2573 3698 82 622 2573 1276 99 401 3374 1326 52 622 3374 4855 58 489 3698 1265 46 622 3698 653 41 113 9 2743 8 309 9 721 55 372 580 1398 98 309 580 4563 16 33 580 3738 66 973 1226 4640 45 309 1226 4243 80 667 1398 3675 94 309 1398 229 78 249 2203 2594 68 309 2203 4043 16 851 2203 857 37 514 2291 3081 63 309 2291 2627 94 252 2291 3559 89 982 2594 2291 34 309 2594 4656 12 309 2594 745 54 682 2602 2203 55 309 2602 3319 91 771 2743 580 13 309 2743 3750 42 94 3081 1226 65 309 3081 570 53 162 3675 2602 55 309 3675 1871 59 328 10 928 55 145 10 2851 51 732 10 2902 16 315 699 3326 64 145 699 4752 53 10 928 4458 11 145 928 4497 82 450 928 952 66 863 1663 3769 59 145 1663 576 49 256 3326 3817 47 145 3326 4344 69 141 3326 3536 30 702 3550 3867 34 145 3550 3793 41 534 3769 3550 82 145 3769 4795 92 145 3769 2302 9 817 3769 3809 88 349 3817 4596 68 145 3817 1627 100 326 3867 699 20 145 3867 2216 13 13 3867 1415 17 931 4458 1663 79 145 4458 3546 100 624 11 609 79 113 11 3674 75 260 11 4712 21 389 609 3975 63 113 609 2367 41 146 2190 2966 39 113 2190 3788 100 811 2190 4752 39 12 2748 3889 15 113 2748 2441 26 516 2748 3825 74 667 2832 3236 45 113 2832 4130 47 134 2832 447 34 941 2966 3963 54 113 2966 4560 94 189 3236 2748 40 113 3236 2307 22 333 3236 4629 41 916 3889 2190 35 113 3889 4118 48 172 3963 4524 42 113 3963 4739 30 113 3963 1077 38 589 3975 2832 7 113 3975 578 97 293 3975 4418 45 880 12 1959 7 206 12 321 43 854 12 586 28 298 1959 3989 66 206 1959 3783 74 508 2413 4730 1 206 2413 3221 5 206 2413 4688 34 37 2990 2413 32 206 2990 2386 68 56 2990 833 78 110 3039 4107 89 206 3039 4793 57 106 3039 328 60 358 3221 3484 4 206 3221 3605 4 179 3484 3760 86 206 3484 2298 80 497 3484 1964 55 761 3760 4518 38 206 3760 2698 94 508 3760 1927 66 694 3989 3039 30 206 3989 2577 34 305 4107 2990 48 206 4107 1964 22 218 4107 4722 21 276 13 3789 28 427 13 4977 8 84 741 2359 47 427 741 2114 26 351 741 1350 97 675 1090 4651 98 427 1090 2134 7 137 1090 1865 14 820 1551 3036 87 427 1551 1157 80 775 1551 3476 70 230 1885 1551 30 427 1885 4891 34 214 2359 3956 22 427 2359 3563 23 54 2799 741 11 427 2799 1066 32 84 2799 2255 33 447 3036 1090 9 427 3036 4640 52 427 3036 4898 55 884 3789 2799 23 427 3789 4552 85 207 3956 1885 16 427 3956 1336 53 744 3956 2873 20 242 14 2070 1 480 14 4783 56 820 14 2062 84 32 2053 3584 53 480 2053 2633 76 657 2070 3088 57 480 2070 3355 9 217 2070 1278 14 707 2092 4916 60 480 2092 3997 37 842 3088 4181 76 480 3088 2766 60 763 3584 2092 9 480 3584 422 26 69 4181 2053 99 480 4181 4874 11 480 4181 3870 26 759 4181 3938 20 814 15 3785 3 797 15 2265 67 471 15 1304 59 113 587 658 87 797 587 3791 23 185 658 4110 12 797 658 1445 65 69 658 4126 90 724 726 857 9 797 726 1085 60 104 726 4105 95 13 857 587 81 797 857 4974 45 797 857 1412 66 385 857 4441 20 230 1738 4242 8 797 1738 2194 82 647 2454 4965 57 797 2454 8 24 559 3785 726 58 797 3785 3286 34 208 3785 2162 81 681 4110 1738 99 797 4110 3466 16 607 4110 1027 9 4 4242 2454 55 797 4242 2802 81 214 16 2713 68 963 16 2425 2 2 541 4655 82 963 541 2793 33 963 541 1084 57 402 541 1056 35 72 681 3351 36 963 681 4280 82 741 681 2257 100 514 1130 2064 54 963 1130 3856 17 328 1130 2286 1 697 2064 3806 7 963 2064 4586 90 963 2064 2927 44 399 2083 681 81 963 2083 4034 14 781 2083 3692 17 329 2713 541 65 963 2713 2456 16 2 2793 3811 14 963 2793 912 39 559 3331 2083 60 963 3331 3700 95 148 3351 3658 7 963 3351 3122 29 810 3351 133 72 668 3658 4719 51 963 3658 1969 21 307 3658 1951 62 365 3806 4358 21 963 3806 2538 53 955 3811 1130 55 963 3811 1971 12 511 4358 3331 71 963 4358 3762 84 208 4358 2800 67 139 17 3009 71 339 17 2373 26 939 17 629 3 38 559 2633 38 339 559 4107 95 887 1610 3588 63 339 1610 1247 27 480 1610 1184 57 133 1694 2652 43 339 1694 4901 91 766 1694 4972 8 139 1864 4981 18 339 1864 4836 81 339 1864 339 33 138 2633 1694 99 339 2633 889 72 547 2633 315 93 255 2652 4133 24 339 2652 3483 42 711 2652 1340 68 19 2939 1864 81 339 2939 2101 39 359 2939 431 65 368 3009 559 39 339 3009 803 90 67 3588 2939 76 339 3588 2656 97 123 4133 1610 64 339 4133 4576 39 371 18 1662 78 865 18 3741 4 401 1155 4588 18 865 1155 3272 11 356 1662 4901 87 865 1662 4432 57 865 1662 4319 77 186 1676 3847 25 865 1676 3898 33 556 1911 2680 76 865 1911 177 35 495 2680 1676 99 865 2680 832 52 121 3847 4196 77 865 3847 3230 26 559 3847 3187 28 702 4196 1155 95 865 4196 2598 36 191 4196 2774 99 249 4432 1911 40 865 4432 180 58 30 4432 499 29 222 19 3610 77 826 19 3267 7 860 630 1214 86 826 630 4134 58 353 845 3372 59 826 845 2587 22 735 1101 4948 81 826 1101 630 80 826 1101 3243 90 434 1101 1994 98 356 1214 845 6 826 1214 4503 32 965 2693 3346 77 826 2693 2633 66 44 2693 4799 24 88 3346 3482 11 826 3346 2527 98 789 3372 4925 41 826 3372 1536 79 31 3372 2936 32 283 3482 1101 68 826 3482 289 67 875 3610 2693 88 826 3610 3190 94 4 3610 3966 43 734 20 3791 46 1291 20 2288 69 488 633 2383 12 1291 633 209 8 673 1309 1441 43 1291 1309 521 96 478 1441 3428 12 1291 1441 3278 15 224 1937 4987 69 1291 1937 3362 84 1291 1937 1364 33 214 2383 1937 23 1291 2383 702 95 467 3234 633 14 1291 3234 1150 14 269 3362 4651 97 1291 3362 184 1 27 3428 3234 6 1291 3428 1060 62 583 3428 3282 18 76 3791 1309 37 1291 3791 4565 10 757 3791 2018 42 773 21 3582 73 117 21 3167 62 463 990 2685 74 117 990 4158 96 572 1157 3155 69 117 1157 143 64 275 1157 4362 94 767 1473 4815 80 117 1473 105 40 383 1473 3025 98 348 1669 4590 75 117 1669 990 55 117 1669 2942 83 910 1669 4649 90 252 2522 1157 65 117 2522 2383 54 633 2685 4398 10 117 2685 4538 35 736 2685 1740 8 951 3155 1473 31 117 3155 1577 38 923 3155 1991 29 277 3412 2522 61 117 3412 2179 74 811 3582 4305 92 117 3582 2058 42 483 3582 4129 98 816 4305 1669 25 117 4305 303 92 414 4305 221 14 989 4398 3412 41 117 4398 2947 25 871 22 3778 14 481 22 900 48 461 803 4738 52 481 803 4571 53 481 803 2873 28 461 1216 2035 5 481 1216 4115 99 436 1216 4443 79 59 2035 2103 31 481 2035 2779 90 661 2084 4299 100 481 2084 1541 3 810 2103 2084 22 481 2103 3419 73 332 3048 803 64 481 3048 4506 52 655 3048 1767 85 482 3778 1216 41 481 3778 4603 41 897 3778 657 19 61 4299 3048 49 481 4299 1121 28 860 4299 1549 77 724 23 2534 69 547 23 1265 74 141 661 1053 21 547 661 504 47 897 1053 2735 41 547 1053 4992 41 15 1053 4483 100 523 1191 4867 59 547 1191 1193 12 547 1191 2700 13 928 1191 367 28 456 1193 3725 40 547 1193 945 7 373 1193 4005 59 850 1471 1191 2 547 1471 4584 88 595 1471 83 22 739 2534 1471 50 547 2534 3661 12 715 2735 4966 35 547 2735 1322 43 577 3725 661 48 547 3725 390 27 436 24 4457 47 837 24 4668 34 873 24 429 17 101 543 1437 18 837 543 4928 63 837 543 1307 70 824 1437 4866 97 837 1437 1758 36 524 2372 543 9 837 2372 4117 28 703 3264 4046 64 837 3264 873 81 406 3264 1517 55 135 3646 3731 88 837 3646 2221 30 246 3646 4595 20 494 3731 3264 71 837 3731 927 73 792 3731 2397 40 747 4046 2372 72 837 4046 634 36 861 4046 926 7 940 4457 3646 25 837 4457 1426 97 486 25 2894 36 935 25 809 2 584 1206 4932 38 935 1206 3131 1 935 1206 4086 70 875 1236 3393 13 935 1236 1195 72 363 1729 3141 13 935 1729 3841 67 468 1729 189 31 887 1770 1236 95 935 1770 2191 51 43 1770 4043 54 149 2342 3069 57 935 2342 4573 96 184 2342 3366 88 849 2843 4486 66 935 2843 1161 65 622 2894 1206 82 935 2894 4764 73 431 3069 4749 13 935 3069 3236 31 219 3131 1729 96 935 3131 4740 55 935 3131 3230 14 293 3131 143 6 848 3141 2843 13 935 3141 3303 4 85 3141 4616 93 1 3393 2342 55 935 3393 1114 24 672 4486 1770 20 935 4486 512 5 844 4486 2383 84 593 26 3964 23 34 26 88 89 25 26 3771 52 111 766 4431 99 34 766 4076 65 129 2115 2337 3 34 2115 1875 91 939 2115 102 71 353 2337 2765 11 34 2337 313 64 715 2337 1718 82 771 2765 4223 25 34 2765 4771 23 34 2765 1325 89 827 2765 4937 5 9 2789 766 18 34 2789 3674 98 648 3802 2789 29 34 3802 3973 99 625 3964 4203 11 34 3964 4253 67 942 3964 2583 47 275 4203 3802 97 34 4203 3843 16 197 4203 3364 99 239 4223 4916 55 34 4223 3397 62 977 4431 2115 15 34 4431 1414 69 985 27 3355 77 354 27 318 84 121 713 896 84 354 713 585 63 56 896 3314 31 354 896 1767 100 158 896 1772 71 441 1378 713 99 354 1378 4414 48 118 2209 1378 100 354 2209 1751 28 819 2209 4077 32 969 2842 2209 98 354 2842 4558 44 549 3314 4737 74 354 3314 4566 9 354 3314 3610 39 894 3314 4266 5 773 3355 2842 82 354 3355 2738 45 279 28 2340 50 390 28 1982 54 445 560 2334 91 390 560 1510 69 633 560 666 92 437 617 2686 36 390 617 2587 22 779 645 3807 37 390 645 1605 62 503 2122 617 53 390 2122 2762 61 59 2254 3154 17 390 2254 333 92 864 2254 3435 55 473 2316 2122 50 390 2316 2518 23 763 2334 2316 63 390 2334 4267 18 674 2340 2254 3 390 2340 3061 100 179 2340 4507 41 202 2686 645 1 390 2686 2929 79 826 3154 4610 12 390 3154 3538 37 390 3154 4792 92 390 3154 4611 27 271 3538 560 84 390 3538 4853 93 919 3538 1937 27 971 3807 4684 37 390 3807 3971 68 205 29 1844 11 1016 29 3884 99 824 563 3095 57 1016 563 3829 97 843 1453 563 15 1016 1453 3142 87 591 1844 2592 80 1016 1844 2843 6 110 1844 709 70 88 1928 4776 85 1016 1928 2803 69 1 1928 3326 31 604 2364 1928 98 1016 2364 4619 42 1016 2364 2473 71 126 2592 1453 72 1016 2592 4521 40 601 2592 2724 97 701 3095 2364 91 1016 3095 4927 98 568 30 1010 8 934 30 2846 60 424 30 150 26 269 738 1858 73 934 738 3868 12 68 738 4739 86 202 940 2759 71 934 940 1583 11 131 1010 3657 67 934 1010 2971 99 250 1010 2032 3 138 1202 940 18 934 1202 3707 54 977 1354 1202 50 934 1354 4869 46 402 1354 1572 70 15 1858 1884 21 934 1858 4829 60 934 1858 1583 33 228 1884 4777 63 934 1884 3888 38 554 1884 2302 45 475 2759 738 44 934 2759 186 46 16 2759 1726 68 458 3061 1354 69 934 3061 3047 70 388 3657 3061 29 934 3657 428 57 154 31 3585 56 693 31 2769 78 723 31 2254 90 998 1098 2549 46 693 1098 4765 15 654 1098 2717 34 551 1599 3521 54 693 1599 4951 60 351 2549 1599 46 693 2549 2542 49 814 2549 598 87 50 3359 4623 29 693 3359 394 39 846 3521 4389 29 693 3521 4017 20 64 3585 4683 33 693 3585 1098 12 693 3585 4715 12 895 3585 3642 83 718 4389 3359 43 693 4389 627 94 555 4389 4511 6 944 32 2825 46 411 32 2989 91 980 32 1897 68 9 1288 1615 24 411 1288 509 25 468 1288 2936 80 696 1615 3404 97 411 1615 3488 41 115 1615 3306 54 27 2133 1288 99 411 2133 4729 87 411 2133 3863 73 751 2133 4040 71 512 2825 3505 95 411 2825 4473 53 527 2825 3891 46 237 3404 4834 67 411 3404 3830 29 812 3404 2916 24 767 3505 2133 65 411 3505 4669 14 628 33 1176 8 137 33 4361 58 798 721 1294 31 137 721 4754 31 137 721 3277 97 408 1176 2038 82 137 1176 602 47 250 1294 1347 19 137 1294 125 98 413 1347 4647 79 137 1347 16 91 482 1347 2851 87 933 2038 2597 16 137 2038 669 70 798 2038 4531 67 123 2237 721 39 137 2237 123 69 216 2237 4967 81 591 2597 2237 3 137 2597 646 54 553 2597 406 92 542 34 2794 77 800 34 4830 9 908 1621 3767 20 800 1621 3714 67 28 1973 4244 45 800 1973 1898 75 241 2046 1973 9 800 2046 4724 1 863 2046 118 52 537 2227 4662 37 800 2227 4459 22 187 2227 3336 40 341 2794 2046 89 800 2794 2739 90 599 3157 1621 49 800 3157 3494 34 679 3767 2227 16 800 3767 4744 7 800 3767 4758 63 873 3767 108 74 694 4244 3157 30 800 4244 415 73 281 4244 4987 70 88 35 1564 72 48 35 782 20 274 35 4287 64 419 1037 1934 67 48 1037 4996 20 12 1037 1692 64 363 1491 3086 32 48 1491 2746 11 353 1491 3621 57 92 1564 3918 54 48 1564 3481 45 900 1564 4688 74 847 1934 4622 31 48 1934 2244 75 48 1934 3761 73 563 2055 1491 20 48 2055 201 21 38 2244 2055 2 48 2244 3991 51 879 2244 3475 70 551 3086 4611 70 48 3086 2405 47 654 3274 1037 9 48 3274 433 64 259 3918 3274 18 48 3918 2824 7 248 36 1696 4 854 36 2848 31 1 36 290 28 614 1148 2960 84 854 1148 3924 89 820 1496 1602 49 854 1496 3642 4 280 1602 3091 60 854 1602 4234 70 312 1696 1148 93 854 1696 3222 15 496 1696 1215 7 858 2960 1496 96 854 2960 4626 61 854 2960 698 43 688 2960 2782 32 372 3091 4894 91 854 3091 628 71 276 3091 251 86 953 37 2345 91 817 37 3013 51 683 1590 4423 14 817 1590 2464 8 613 1590 1745 7 503 1979 4828 7 817 1979 2257 23 35 1979 4348 83 120 2345 1590 46 817 2345 3215 14 872 2345 1180 76 400 2520 2682 49 817 2520 4436 50 295 2682 2970 93 817 2682 4471 51 731 2682 4480 27 149 2970 1979 57 817 2970 4300 64 61 4423 2520 63 817 4423 4892 68 817 4423 725 59 15 4423 4290 23 799 38 829 79 756 38 3503 67 779 746 2810 28 756 746 4212 67 550 746 54 84 390 829 2542 89 756 829 2095 15 630 829 382 24 86 1394 746 54 756 1394 2185 91 484 1394 3163 33 187 1896 4834 90 756 1896 4926 47 756 1896 428 59 433 1896 2645 95 507 2397 2598 69 756 2397 4720 12 42 2542 1394 19 756 2542 4653 36 898 2542 2690 14 265 2598 2965 34 756 2598 827 96 888 2810 2397 62 756 2810 4491 48 6 2810 1478 99 113 2965 1896 96 756 2965 845 75 851 2965 4859 48 396 39 2567 59 523 39 3648 49 726 39 3825 63 948 1054 3118 44 523 1054 1625 1 467 2567 3818 45 523 2567 2959 89 834 2567 1602 93 144 3118 3873 31 523 3118 4637 28 523 3118 3543 50 330 3118 4222 45 497 3818 1054 76 523 3818 4726 100 727 3818 98 70 6 3873 4970 91 523 3873 2000 95 380 3873 635 45 472 40 4274 99 1074 40 2809 28 357 725 4100 70 1074 725 4451 64 946 1654 2888 92 1074 1654 1221 24 529 1654 2703 58 368 2047 4607 100 1074 2047 3772 63 212 2047 4680 88 842 2888 2047 48 1074 2888 4876 3 623 2888 1160 22 191 3909 725 19 1074 3909 3232 1 840 4100 1654 88 1074 4100 4706 56 1074 4100 203 43 426 4100 1749 25 426 4274 3909 39 1074 4274 2248 63 485 41 3449 56 507 41 397 81 544 41 1861 20 632 1081 1616 4 507 1081 4 39 423 1106 4774 87 507 1106 3689 13 783 1106 1812 71 237 1483 1618 41 507 1483 890 28 476 1483 3393 73 447 1616 1752 9 507 1616 1551 61 983 1618 3105 35 507 1618 4080 7 261 1618 4920 57 111 1625 1982 62 507 1625 4272 65 195 1736 4597 94 507 1736 4516 7 507 1736 1625 52 507 1736 503 80 731 1736 3257 4 361 1752 1483 82 507 1752 3205 51 988 1752 3889 98 222 1982 2524 22 507 1982 4474 87 611 2524 1081 37 507 2524 389 35 262 2524 1375 34 833 3105 1106 81 507 3105 4638 20 238 3105 804 25 188 3449 1736 97 507 3449 2279 80 137 3449 1044 15 141 42 2077 67 440 42 4332 100 141 613 4919 27 440 613 1899 66 519 1681 4160 91 440 1681 3786 56 163 2077 2706 40 440 2077 959 30 200 2077 3667 35 424 2197 613 21 440 2197 4641 64 440 2197 4096 22 518 2706 1681 85 440 2706 2325 81 152 3106 2197 52 440 3106 1384 4 469 3106 2615 19 359 4160 3106 82 440 4160 2284 21 160 43 2021 87 256 43 1635 22 683 43 1329 26 210 823 2089 78 256 823 2676 33 796 1503 4794 79 256 1503 2656 65 256 1503 4115 14 196 1503 2627 64 743 2021 2915 9 256 2021 4760 25 425 2021 4047 75 325 2089 1503 96 256 2089 3708 89 189 2089 2977 15 488 2208 4700 55 256 2208 445 73 623 2208 303 37 855 2656 2208 66 256 2656 3339 96 872 2915 823 55 256 2915 4917 69 269 2915 1994 100 708 44 690 67 22 44 1066 29 199 44 3296 48 687 626 2181 71 22 626 4649 76 22 626 1886 27 838 690 626 82 22 690 3598 71 335 690 3316 1 596 1905 3323 3 22 1905 3004 1 985 1905 1010 23 51 2181 2343 2 22 2181 2100 89 716 2181 3750 62 955 2343 1905 50 22 2343 2871 89 974 2343 2443 38 573 3323 3702 59 22 3323 3031 95 425 3702 4206 93 22 3702 841 45 19 4206 4650 76 22 4206 1552 27 596 4206 2502 71 17 45 1079 52 569 45 922 37 300 592 4803 16 569 592 3624 25 48 592 3722 80 88 706 592 9 569 706 3615 46 729 768 4076 30 569 768 1924 18 215 768 2998 6 202 819 706 95 569 819 3972 72 985 819 4224 52 352 1079 4889 8 569 1079 768 87 569 1079 1151 79 131 1702 819 65 569 1702 3541 7 483 1887 2437 49 569 1887 3033 80 429 2437 1702 10 569 2437 3282 86 449 2437 4751 33 886 4076 1887 5 569 4076 2663 8 711 46 2891 93 341 46 4458 48 81 1022 4972 75 341 1022 1045 49 341 1022 2418 13 953 1045 3912 39 341 1045 1869 58 256 1493 3248 33 341 1493 4138 65 397 1787 1493 66 341 1787 3113 64 654 2891 3467 7 341 2891 1947 32 398 3248 4700 90 341 3248 4937 49 804 3248 4185 15 223 3467 1022 94 341 3467 3537 87 390 3467 536 28 396 3912 1787 55 341 3912 3383 6 358 47 2683 39 410 47 320 49 882 679 3860 94 410 679 1966 27 118 679 3483 57 990 1308 4580 34 410 1308 3612 16 410 1308 1960 24 827 1308 2161 52 838 2683 679 79 410 2683 3492 19 918 3001 1308 2 410 3001 3893 68 788 3612 4286 44 410 3612 4230 45 461 3612 4093 40 20 3674 4979 37 410 3674 896 44 524 3674 1309 41 196 3860 3001 38 410 3860 1443 87 266 3860 2255 66 81 4232 3674 67 410 4232 3687 59 364 4232 1782 10 109 4286 4232 15 410 4286 392 51 959 48 2385 11 129 48 707 31 118 729 3792 77 129 729 2665 82 588 729 4717 23 809 2385 3960 91 129 2385 769 58 905 2385 1296 84 628 2387 4887 70 129 2387 1475 92 175 2869 4168 20 129 2869 1753 77 91 2869 151 16 373 3503 2869 85 129 3503 650 94 423 3503 613 24 725 3792 2387 7 129 3792 2555 42 906 3960 4888 59 129 3960 4322 93 129 3960 4948 81 708 3960 2367 25 551 4036 3503 77 129 4036 2959 34 506 4168 729 95 129 4168 4034 33 89 4168 266 88 723 4322 4036 88 129 4322 3 21 160 4322 4094 48 418 49 831 52 1269 49 4763 79 982 49 112 59 271 518 1259 68 1269 518 617 70 841 518 1359 70 261 831 4098 33 1269 831 1415 41 93 1170 2605 6 1269 1170 3414 3 114 1182 518 28 1269 1182 4911 59 649 1259 1726 31 1269 1259 4868 38 770 1671 4705 51 1269 1671 4843 61 1269 1671 2219 63 741 1671 3913 49 816 1726 1170 83 1269 1726 279 41 235 1726 171 84 55 2605 1671 93 1269 2605 2151 56 170 4098 1182 23 1269 4098 3460 32 877 4098 1990 74 206 50 736 67 570 50 689 49 520 50 4628 87 256 736 1069 61 570 736 866 78 533 1041 4041 81 570 1041 4857 3 575 1041 4917 44 924 1069 1041 75 570 1069 2729 18 666 1983 2773 71 570 1983 4799 34 570 1983 4945 95 261 1983 905 11 965 2773 4754 15 570 2773 3892 38 182 4041 1983 6 570 4041 3488 52 471 4041 4606 45 649 51 4422 85 456 51 3598 3 180 51 4132 86 142 1513 3060 24 456 1513 3803 88 786 1608 4139 2 456 1608 846 37 403 2068 1608 26 456 2068 4811 36 456 2068 3222 9 730 3060 4999 23 456 3060 2524 56 227 3060 4274 33 767 4139 1513 74 456 4139 3143 96 624 4422 2068 74 456 4422 1284 66 479 4422 1505 42 635 52 3133 7 320 52 1910 43 481 52 811 21 836 1000 1865 59 320 1000 195 41 151 1000 1768 68 366 1529 1000 94 320 1529 610 85 990 1865 4715 61 320 1865 1574 38 4 2245 1529 65 320 2245 949 2 327 2769 2245 78 320 2769 814 11 339 2957 4485 10 320 2957 408 93 874 2957 655 40 584 3133 3524 12 320 3133 3451 75 611 3133 4482 57 50 3448 2957 5 320 3448 4934 48 320 3448 4273 29 268 3448 4348 19 797 3524 3448 40 320 3524 4545 42 788 4485 2769 98 320 4485 377 80 435 53 2073 98 415 53 3346 73 301 53 1342 48 348 739 3864 100 415 739 2868 60 828 739 39 58 677 814 4923 80 415 814 2812 4 678 1881 3361 31 415 1881 4213 2 866 2032 739 22 415 2032 3538 23 391 2073 4215 92 415 2073 2024 13 930 2073 712 17 366 2433 814 77 415 2433 1467 8 561 2433 2861 80 395 3361 4026 74 415 3361 4527 18 415 3361 4942 40 113 3361 1488 4 395 3864 2433 89 415 3864 3304 78 632 4026 2032 45 415 4026 2360 60 900 4215 1881 86 415 4215 4976 42 811 4215 4052 82 551 54 3488 82 105 54 3267 82 322 1637 4384 11 105 1637 502 55 571 1637 4616 96 636 1886 2130 48 105 1886 1918 49 536 1977 1637 10 105 1977 1861 20 902 2130 4820 64 105 2130 142 59 874 3488 4593 35 105 3488 1977 15 105 3488 2491 9 984 4384 1886 75 105 4384 3337 67 909 55 1163 96 445 55 1296 46 957 55 4058 17 439 603 2477 43 445 603 2582 98 323 603 2797 7 370 1126 603 15 445 1126 1352 28 458 1126 223 89 748 1163 3640 61 445 1163 739 20 289 1275 1126 64 445 1275 1885 53 343 1275 738 87 438 1283 3442 45 445 1283 2625 98 204 1584 4762 79 445 1584 4701 37 445 1584 1740 58 710 2477 1584 93 445 2477 3216 93 870 3442 1275 9 445 3442 3694 21 575 3489 1283 67 445 3489 4987 41 12 3489 2740 27 196 3640 3489 22 445 3640 1046 59 665 3640 3084 58 498 56 3594 78 863 56 2228 77 437 860 4304 98 863 860 4602 90 863 860 3131 74 416 860 3277 97 610 912 2752 78 863 912 4897 42 445 912 3106 99 23 2752 860 53 863 2752 1607 38 677 3003 4594 57 863 3003 3133 12 205 3003 4846 26 471 3349 912 96 863 3349 3759 54 971 3349 2706 97 660 3594 3349 81 863 3594 4409 40 36 3594 4462 88 261 4304 3003 57 863 4304 2786 24 430 4304 2732 100 468 57 4329 93 104 57 3653 23 686 57 369 55 298 1776 2666 82 104 1776 4366 49 624 1776 1710 8 400 1941 3161 72 104 1941 4800 10 104 1941 287 48 991 1941 1086 11 840 1952 1776 14 104 1952 714 72 62 2666 4734 36 104 2666 4359 3 261 3161 4342 78 104 3161 4778 30 960 3161 1180 21 761 3876 1952 44 104 3876 3034 70 104 3876 2921 92 133 4329 1941 30 104 4329 3528 74 872 4342 3876 11 104 4342 737 3 397 58 4273 55 620 58 66 85 33 58 3027 30 167 2097 3231 6 620 2097 1633 90 546 2097 1925 76 513 2488 2097 100 620 2488 3135 72 819 2488 3412 20 329 3089 3202 27 620 3089 2693 53 370 3089 4454 97 961 3202 3224 94 620 3202 3935 1 466 3224 4569 63 620 3224 1096 34 917 3224 3894 4 791 3231 3451 58 620 3231 4797 56 243 3231 2411 45 177 3451 4343 64 620 3451 4940 62 620 3451 2881 44 225 3451 1564 37 100 4273 2488 25 620 4273 1289 97 902 4343 3089 31 620 4343 1132 74 677 4343 2234 33 142 59 2523 21 300 59 4912 50 128 59 1419 19 300 1205 2110 3 300 1205 102 28 616 1305 2375 15 300 1305 4581 78 674 2110 4505 36 300 2110 1305 21 300 2110 4032 88 487 2375 4829 33 300 2375 1027 26 645 2523 1205 78 300 2523 4168 38 806 60 1061 97 286 60 2677 12 71 1061 3241 46 286 1061 199 19 311 1061 498 23 238 1832 2673 98 286 1832 2189 98 186 1832 4795 10 893 2257 1832 55 286 2257 72 87 587 2673 4720 48 286 2673 2709 75 498 2673 812 9 966 2852 4860 73 286 2852 3175 55 286 2852 1221 9 519 3175 4461 28 286 3175 4032 60 705 3241 2852 69 286 3241 2373 85 517 3241 4544 61 258 4461 2257 93 286 4461 770 90 63 61 1250 83 435 61 3215 52 624 853 1703 49 435 853 4587 76 435 853 4742 52 223 853 2132 7 837 1250 853 51 435 1250 2087 3 773 1642 1876 27 435 1642 476 86 887 1642 3153 81 22 1703 1642 51 435 1703 1191 76 648 1703 49 70 89 1840 4603 85 435 1840 2050 83 521 1876 1840 65 435 1876 2208 77 633 62 3309 9 87 62 1942 79 920 62 3568 53 381 608 2161 23 87 608 4530 50 822 869 1823 74 87 869 3054 90 511 1269 2117 7 87 1269 4954 77 941 1269 4888 12 115 1296 869 54 87 1296 4273 100 677 1823 3005 54 87 1823 1083 75 793 2117 3162 4 87 2117 2757 35 722 2161 4860 55 87 2161 3921 4 832 3005 1269 28 87 3005 4285 20 16 3005 4287 8 593 3162 608 90 87 3162 455 22 967 3162 3909 40 926 3309 1296 49 87 3309 4966 31 87 3309 782 53 985 3309 4448 88 294 63 3454 86 97 63 638 63 630 1403 3243 61 97 1403 1559 6 502 1820 3208 43 97 1820 559 78 466 2419 4796 27 97 2419 4603 61 97 2419 3740 11 470 2419 4129 38 45 3208 3302 77 97 3208 2553 36 354 3208 439 95 431 3243 1820 58 97 3243 3795 9 260 3302 2419 52 97 3302 2706 32 398 3302 4356 90 158 3454 4394 67 97 3454 1459 48 190 3454 565 91 112 4394 1403 1 97 4394 4806 92 587 64 1925 100 435 64 305 62 484 837 4637 99 435 837 4972 90 435 837 1592 25 557 1032 2365 87 435 1032 748 65 242 1032 4487 89 863 1925 3996 98 435 1925 612 63 423 2264 3514 13 435 2264 1353 17 411 2365 837 7 435 2365 2697 14 954 3514 1032 79 435 3514 3878 59 966 3996 2264 35 435 3996 262 31 909 65 2164 93 773 65 1415 53 502 65 2070 16 376 841 4400 1 773 841 1984 37 785 841 3727 28 374 893 3948 48 773 893 3871 37 777 893 4641 76 243 1036 3308 74 773 1036 4033 70 625 1036 4103 53 850 1812 4567 11 773 1812 3367 87 289 2164 841 24 773 2164 1199 86 255 3308 893 75 773 3308 2179 74 774 3308 708 99 202 3948 1812 70 773 3948 4554 41 773 3948 3541 34 928 4400 1036 34 773 4400 4887 93 405 4400 1783 46 65 66 3072 83 137 66 3650 87 350 66 1791 22 190 590 4593 92 137 590 2433 52 64 590 4904 74 151 2615 4126 23 137 2615 4509 55 259 2615 289 75 744 3072 3136 92 137 3072 2589 35 6 3136 3344 61 137 3136 1095 48 726 3344 4875 51 137 3344 3592 74 137 3344 3991 40 431 3592 4010 100 137 3592 2868 87 636 3592 1704 23 941 4010 2615 33 137 4010 2707 63 258 4126 590 6 137 4126 2656 93 897 67 3090 6 99 67 84 17 240 67 3155 62 118 1183 3743 90 99 1183 2073 69 980 2378 2824 79 99 2378 1857 45 773 2378 3229 44 126 2824 3581 70 99 2824 2975 68 257 2824 42 1 695 3090 2378 4 99 3090 92 47 815 3090 4016 26 584 3411 3961 7 99 3411 4708 42 99 3411 439 29 152 3411 587 41 59 3581 3411 45 99 3581 2234 22 470 3743 4733 97 99 3743 1519 2 793 3961 1183 92 99 3961 1054 34 250 68 1111 52 792 68 734 28 318 68 118 36 853 591 4388 20 792 591 2805 54 228 838 3038 57 792 838 97 78 544 861 2054 41 792 861 1963 37 996 861 1123 28 665 1111 3718 1 792 1111 1459 71 689 1111 592 17 290 1978 838 88 792 1978 762 32 884 1978 674 56 781 2054 1978 12 792 2054 1869 14 835 2054 4450 6 708 2314 4527 79 792 2314 3221 67 465 2314 3227 56 185 3038 591 59 792 3038 4955 70 792 3038 777 12 603 3038 2711 2 45 3718 861 8 792 3718 3504 68 528 4388 2314 42 792 4388 2991 26 849 4388 1894 24 105 69 751 81 544 69 3944 47 339 751 1333 24 544 751 22 81 656 751 2806 95 124 1310 3121 83 544 1310 3636 76 556 1333 3732 45 544 1333 4301 56 823 1333 360 35 655 2152 1310 5 544 2152 499 6 103 2152 94 15 174 2538 4520 44 544 2538 2906 81 544 2538 1297 41 185 2906 3209 49 544 2906 3993 60 657 3121 4549 13 544 3121 2815 16 951 3121 3812 7 523 3209 2152 56 544 3209 1089 48 475 3209 4396 23 766 3732 2538 31 544 3732 4575 95 410 3732 4807 54 534 70 3020 92 558 70 2643 28 138 576 3833 82 558 576 4608 94 646 680 4864 94 558 680 1614 6 558 680 2544 60 25 999 1991 45 558 999 4688 73 558 999 3409 96 835 999 324 20 534 1108 999 10 558 1108 1926 8 964 1108 2698 98 160 1189 2583 13 558 1189 1627 78 159 1189 4858 47 797 1588 4625 97 558 1588 438 69 735 1588 706 60 928 1614 576 30 558 1614 4896 65 945 1991 1189 22 558 1991 1443 56 873 2583 4017 86 558 2583 1043 24 678 2583 4064 25 393 3020 1108 13 558 3020 4924 68 646 3833 1588 33 558 3833 1509 10 440 4017 680 45 558 4017 1692 5 779 4017 3333 62 343 71 3590 78 275 71 1512 32 518 71 3566 55 276 971 1350 84 275 971 2908 18 125 1011 2849 4 275 1011 3385 17 722 1268 1011 40 275 1268 583 31 507 1268 1493 63 191 1350 1268 82 275 1350 4975 20 275 1350 4048 32 719 2543 4784 72 275 2543 2018 17 205 2849 2543 43 275 2849 1350 93 924 3240 971 63 275 3240 2980 51 965 3240 2638 59 331 3415 3240 24 275 3415 2088 21 438 3590 4092 64 275 3590 3998 69 935 4092 3415 70 275 4092 4350 88 751 72 1817 36 467 72 1927 31 60 795 4877 6 467 795 3051 97 442 1817 4529 20 467 1817 4247 83 467 1817 653 86 8 1817 4265 64 86 2667 795 22 467 2667 118 88 209 2667 1924 38 119 2911 2976 96 467 2911 218 88 726 2911 6 33 538 2976 2667 63 467 2976 2351 13 372 2976 1188 1 470 3999 2911 31 467 3999 435 5 512 4247 3999 91 467 4247 760 72 391 4247 881 41 911 73 1860 76 350 73 550 69 788 73 957 25 889 578 4355 45 350 578 544 28 866 1068 3881 7 350 1068 3793 5 129 1068 4257 46 192 1860 578 89 350 1860 4833 60 350 1860 2842 37 825 2075 1068 19 350 2075 2035 91 23 2646 4625 92 350 2646 97 11 977 2646 4851 18 499 2838 2075 35 350 2838 2389 61 682 3881 4495 8 350 3881 3367 13 121 4334 2646 88 350 4334 3033 32 691 4334 1914 56 676 4355 2838 63 350 4355 4316 29 331 4495 4334 64 350 4495 444 73 167 74 1293 3 477 74 2001 79 749 74 73 98 410 524 4730 53 477 524 4896 71 366 524 3647 48 716 1293 4350 43 477 1293 4609 7 537 1293 3988 84 852 1432 3030 4 477 1432 4616 86 884 2124 3850 36 477 2124 1651 39 638 2124 2499 75 831 3030 2124 16 477 3030 2488 51 132 3030 4990 59 679 3850 524 23 477 3850 4003 28 500 3850 1910 90 86 4350 1432 57 477 4350 4785 13 477 4350 1306 16 886 4350 4830 59 126 75 3613 48 1231 75 1858 10 886 75 2110 17 162 1153 2657 24 1231 1153 4470 34 591 1153 1279 71 708 1215 4933 28 1231 1215 1572 45 938 1457 1215 64 1231 1457 4897 11 368 1568 1690 82 1231 1568 3105 93 800 1690 1457 34 1231 1690 1454 92 186 2657 1568 32 1231 2657 4954 17 575 2657 2941 29 94 3613 3949 50 1231 3613 1747 53 757 3949 4411 32 1231 3949 4761 47 528 4411 1153 35 1231 4411 4868 81 1231 4411 2760 75 454 4411 1081 53 963 76 1468 11 486 76 650 39 678 791 3902 90 486 791 4226 36 985 791 2773 2 356 972 3556 50 486 972 695 32 173 972 2163 3 235 1369 972 33 486 1369 666 88 597 1396 791 100 486 1396 1051 67 905 1468 1396 80 486 1468 534 71 398 3556 3762 24 486 3556 2610 84 919 3556 4489 5 833 3762 4749 27 486 3762 4516 9 486 3762 2717 97 653 3902 4013 42 486 3902 2667 39 468 4013 1369 30 486 4013 272 67 749 77 3700 69 773 77 2638 66 273 77 3307 4 750 1469 2090 19 773 1469 1544 38 86 1469 965 42 690 1678 2577 3 773 1678 987 80 998 2090 2400 3 773 2090 4557 28 773 2090 3561 100 6 2090 1032 38 575 2400 2758 79 773 2400 2159 98 351 2577 2841 37 773 2577 3387 69 700 2758 3203 42 773 2758 4693 64 723 2758 552 57 811 2841 3637 71 773 2841 4068 59 106 2841 2948 67 830 3203 4587 25 773 3203 2169 97 486 3203 3487 23 856 3637 1469 54 773 3637 169 91 773 3637 4803 5 656 3700 1678 14 773 3700 4894 100 749 3700 3254 5 674 78 4195 37 422 78 2431 96 456 78 1292 25 432 637 3080 91 422 637 361 16 278 2287 4810 89 422 2287 4366 83 881 2287 2684 42 75 2977 2287 9 422 2977 3539 46 913 2977 3959 10 970 3080 4770 49 422 3080 2977 56 422 3080 3993 16 344 3080 3976 98 35 4195 637 73 422 4195 2336 77 837 79 3474 78 526 79 4411 1 145 79 399 97 616 1874 2949 39 526 1874 317 31 257 1874 2915 58 817 2949 4569 12 526 2949 166 35 134 2949 4792 72 924 3474 4057 50 526 3474 4597 20 526 3474 4563 20 94 3474 3032 78 434 3629 3803 56 526 3629 2282 54 710 3803 4289 48 526 3803 1246 87 997 4012 1874 53 526 4012 2941 54 652 4012 3666 39 471 4057 3629 90 526 4057 1023 39 876 4289 4012 42 526 4289 2646 67 205 4289 4670 72 21 80 2921 95 402 80 2138 7 282 1532 2135 73 402 1532 3684 21 760 1891 3908 63 402 1891 259 38 652 1891 1941 3 248 2135 4515 67 402 2135 3691 95 279 2141 3959 14 402 2141 341 28 309 2921 4198 45 402 2921 3242 72 376 3628 4492 9 402 3628 2332 61 715 3908 4011 60 402 3908 2677 85 525 3959 3628 14 402 3959 215 51 625 4011 1532 33 402 4011 3063 93 192 4198 2141 91 402 4198 4839 50 402 4198 1710 94 229 4198 3047 50 553 4492 1891 52 402 4492 2274 69 268 81 2434 6 602 81 4235 63 785 951 3027 53 602 951 3188 58 380 951 708 3 825 1026 2166 78 602 1026 1759 42 779 1822 3316 41 602 1822 451 10 517 2166 4572 35 602 2166 1001 19 234 2434 2636 55 602 2434 2924 58 924 2636 3298 64 602 2636 1171 34 755 2636 714 4 199 3027 4265 74 602 3027 1070 78 93 3298 951 91 602 3298 212 26 911 3298 3070 33 905 3316 4051 2 602 3316 4868 65 296 3316 2303 80 96 4051 1026 73 602 4051 48 32 377 4265 1822 77 602 4265 4840 89 602 4265 333 2 811 82 3207 87 262 82 2016 98 787 82 4323 23 472 2156 3102 41 262 2156 4856 43 262 2156 194 91 342 2156 4406 12 241 2282 2156 87 262 2282 3600 21 878 2282 2105 3 180 2902 4754 8 262 2902 188 2 596 2902 2611 63 49 3102 3922 97 262 3102 4150 64 565 3102 4750 97 446 3207 2282 12 262 3207 3378 88 279 3922 2902 19 262 3922 2040 45 500 83 2167 34 321 83 3772 54 32 554 2414 11 321 554 924 9 413 554 613 83 57 966 4272 91 321 966 4552 33 321 966 4564 56 797 966 4208 47 501 2167 3000 69 321 2167 4888 82 209 2167 3364 6 731 2171 2511 42 321 2171 1086 29 50 2296 2171 44 321 2296 4443 1 861 2296 4169 21 480 2351 2296 66 321 2351 2404 68 775 2351 2335 88 897 2414 966 34 321 2414 3381 71 435 2511 554 80 321 2511 67 17 398 3000 2351 63 321 3000 3369 54 444 3000 822 11 704 4272 4572 65 321 4272 4649 41 936 4272 922 10 679 84 2517 5 1135 84 3461 36 852 1073 2399 56 1135 1073 4178 75 920 1073 2453 84 839 1535 1073 19 1135 1535 3869 58 188 2399 3891 62 1135 2399 4528 98 855 2399 507 60 98 2517 4478 49 1135 2517 1570 85 993 3834 1535 36 1135 3834 1298 55 903 3834 4853 68 572 3891 4717 60 1135 3891 1586 72 318 3891 1121 94 954 4478 3834 28 1135 4478 4875 64 1135 4478 3712 34 959 4478 234 26 160 85 2828 6 459 85 2695 75 62 622 2427 33 459 622 4996 62 897 830 4765 48 459 830 4872 82 921 830 1500 35 109 1763 3735 12 459 1763 4070 78 274 2427 830 36 459 2427 4905 23 459 2427 3147 1 569 2427 421 19 618 2489 3755 83 459 2489 1477 94 293 2489 4960 89 480 2828 2489 14 459 2828 4961 64 644 2828 2108 24 513 3735 622 74 459 3735 4532 36 50 3735 58 65 672 3755 1763 34 459 3755 955 82 247 3755 216 99 975 86 3172 63 915 86 2576 5 971 974 3007 94 915 974 3226 30 773 1178 4784 12 915 1178 4710 94 915 1178 2987 36 508 2059 974 21 915 2059 4526 76 557 3007 1178 64 915 3007 4610 45 967 3172 3315 51 915 3172 1790 8 66 3315 2059 90 915 3315 3801 47 499 3315 2909 98 704 87 1958 92 505 87 2342 15 288 826 1629 34 505 826 2435 93 127 826 508 22 516 1272 1969 66 505 1272 127 96 585 1272 3733 90 796 1629 4035 58 505 1629 827 6 311 1629 2318 79 500 1958 4668 44 505 1958 1272 91 505 1958 4991 24 322 1969 2916 59 505 1969 992 56 723 1969 2053 72 260 2546 4815 11 505 2546 962 34 28 2916 826 37 505 2916 3974 97 202 4035 2546 6 505 4035 4988 15 268 88 957 70 193 88 4453 34 366 88 2187 93 135 957 3275 33 193 957 4735 79 193 957 4367 2 158 1474 2586 78 193 1474 1806 56 318 1474 1342 52 728 1747 2529 55 193 1747 948 13 955 1747 4244 43 745 2529 4468 95 193 2529 3203 98 350 2529 4454 45 919 2586 5000 32 193 2586 1293 79 987 3275 1747 74 193 3275 4297 8 884 3574 1474 46 193 3574 339 77 766 3574 997 41 384 4468 3574 7 193 4468 1611 60 173 4468 2428 46 43 89 3013 85 1133 89 3914 36 527 868 2491 88 1133 868 1531 28 467 868 2073 87 769 1102 1358 79 1133 1102 556 20 37 1102 575 3 956 1358 868 71 1133 1358 4483 83 798 1358 3712 11 50 2162 2350 14 1133 2162 690 11 222 2350 4544 40 1133 2350 4967 68 1133 2350 4682 39 920 2491 2162 68 1133 2491 3853 51 995 2491 2110 59 856 3013 1102 38 1133 3013 3523 71 167 3013 4563 3 313 90 1245 75 500 90 1680 96 485 90 4649 37 725 1121 3880 23 500 1121 1891 25 391 1121 948 78 448 1245 3043 40 500 1245 4679 83 89 1522 3570 99 500 1522 4310 5 416 1522 2656 94 363 2819 1522 62 500 2819 364 54 844 2819 76 55 366 3043 2819 10 500 3043 2593 27 516 3043 1101 13 674 3093 4559 39 500 3093 3399 17 746 3093 2913 56 943 3570 1121 82 500 3570 4712 98 500 3570 1172 76 522 3880 3093 84 500 3880 1111 7 690 91 3168 47 742 91 4704 57 882 781 4696 8 742 781 576 37 512 788 2622 17 742 788 3437 63 272 1772 2993 98 742 1772 2661 16 990 1772 2140 9 737 2622 3350 91 742 2622 3593 6 913 2993 4377 77 742 2993 371 47 668 3168 788 62 742 3168 255 71 602 3350 1772 78 742 3350 4117 63 355 3350 3346 66 779 4239 781 12 742 4239 3199 98 142 4377 4239 63 742 4377 4705 63 742 4377 896 46 419 92 3911 81 403 92 4815 47 696 696 2855 33 403 696 4512 92 403 696 3725 12 387 908 696 37 403 908 2771 45 110 2855 3616 33 403 2855 2413 8 439 2855 1667 63 520 2884 3185 81 403 2884 1845 28 715 2884 142 72 774 3185 908 100 403 3185 2943 72 437 3185 676 41 556 3616 4787 8 403 3616 4802 75 969 3911 2884 81 403 3911 2032 26 148 3911 3155 92 273 93 1285 13 442 93 1256 87 384 1085 4094 36 442 1085 3504 39 934 1285 2258 26 442 1285 3527 79 807 1285 2768 34 598 1442 1485 8 442 1442 915 6 951 1485 2654 64 442 1485 3834 80 555 1485 3994 82 761 1524 1085 67 442 1524 2940 59 917 1524 4380 67 454 2258 2506 49 442 2258 888 40 968 2258 980 67 841 2506 4121 61 442 2506 3016 83 650 2506 3243 39 246 2654 1524 38 442 2654 4535 30 722 2654 988 53 548 4094 4685 12 442 4094 4510 64 442 4094 1033 91 642 4094 4770 80 996 4121 1442 10 442 4121 2192 41 977 4121 4085 72 940 94 2229 77 1077 94 864 62 198 94 2522 67 40 880 1030 94 1077 880 1133 98 242 1030 2196 41 1077 1030 2607 30 569 1030 435 7 884 1064 2095 28 1077 1064 3483 14 555 2095 4002 9 1077 2095 1959 43 780 2095 1025 39 552 2196 1064 24 1077 2196 4604 60 1077 2196 4337 15 88 2196 349 100 413 2229 2555 86 1077 2229 3259 20 993 2555 880 4 1077 2555 1875 31 461 2555 1770 13 923 4002 4553 25 1077 4002 4973 4 739 4002 2160 63 399 95 1105 13 552 95 1626 85 155 95 4780 39 558 1105 2469 94 552 1105 4968 42 897 1105 4017 36 39 1499 4104 9 552 1499 4566 47 818 1656 4810 20 552 1656 1681 15 267 1660 1656 44 552 1660 4967 14 552 1660 4458 23 433 1796 3838 1 552 1796 1269 23 47 1796 2440 84 947 2469 4224 56 552 2469 4494 33 344 2469 1318 46 254 3838 1499 38 552 3838 863 68 932 3838 782 32 273 4104 1660 84 552 4104 2815 49 146 4104 384 12 65 4224 1796 64 552 4224 635 59 561 96 2831 40 398 96 360 76 538 547 4551 17 398 547 1488 19 398 547 4603 31 55 1488 3555 81 398 1488 2938 23 23 2831 3052 95 398 2831 899 82 38 2831 4748 86 300 3052 3437 46 398 3052 1237 7 945 3437 547 12 398 3437 4121 8 414 3555 4805 20 398 3555 3697 82 315 3555 1512 94 36 97 1262 55 292 97 4976 40 928 97 893 79 428 1262 4226 15 292 1262 2843 85 105 1430 2530 25 292 1430 764 7 449 1430 184 27 848 1708 4755 43 292 1708 4704 7 292 1708 4758 48 752 1708 3301 98 375 2034 2518 94 292 2034 1290 40 415 2034 4317 58 149 2328 1430 61 292 2328 660 86 174 2518 1708 29 292 2518 1002 64 215 2518 1546 19 458 2530 2034 78 292 2530 248 11 55 3405 2328 16 292 3405 4212 34 459 4226 3405 58 292 4226 2372 48 85 4226 1179 5 406 98 2206 11 1180 98 3981 19 359 1984 3801 60 1180 1984 4359 19 396 1984 3450 12 763 2206 3327 96 1180 2206 3614 67 34 3252 4910 24 1180 3252 1444 42 463 3252 2544 3 384 3327 4406 84 1180 3327 3531 4 797 3327 1981 6 795 3801 3252 2 1180 3801 4954 42 1180 3801 3455 84 818 3801 2733 58 253 4406 1984 50 1180 4406 1363 99 20 4406 4460 43 221 99 1426 5 449 99 3868 45 417 1033 1707 48 449 1033 4540 34 582 1033 4390 90 537 1426 1033 78 449 1426 1973 39 859 1707 3075 4 449 1707 340 77 364 1707 2656 45 407 1932 3458 38 449 1932 3174 52 401 1932 1745 10 567 3075 3507 61 449 3075 3216 81 904 3458 3826 95 449 3458 2361 3 445 3507 1932 53 449 3507 4667 64 449 3507 3187 15 596 3507 3053 56 624 3826 4596 82 449 3826 4735 85 173 100 2933 66 618 100 3283 61 752 2214 3465 33 618 2214 3105 74 368 2214 926 45 504 2232 2964 45 618 2232 2912 36 528 2232 4912 71 46 2330 2214 78 618 2330 2796 55 197 2330 218 27 27 2933 2232 39 618 2933 4575 75 595 2933 1473 100 380 2964 3977 38 618 2964 4738 66 618 2964 1513 88 211 3465 4825 68 618 3465 4019 41 614 3465 591 47 214 3492 3893 28 618 3492 934 35 584 3492 1613 20 543 3893 2330 20 618 3893 3425 71 204 3893 3098 31 885 3977 3492 8 618 3977 3337 12 273 3977 3129 20 758 101 4093 64 623 101 2346 8 300 101 44 7 833 581 4515 1 623 581 4648 40 623 581 3785 70 671 663 2620 53 623 663 4200 45 426 663 65 57 748 854 663 35 623 854 303 73 904 2620 3539 84 623 2620 3922 50 374 2668 4037 51 623 2668 1316 27 241 2668 3846 14 378 3539 3848 10 623 3539 2802 15 714 3848 2668 27 623 3848 2410 35 272 3848 4371 33 940 4037 581 52 623 4037 576 59 823 4037 1292 35 881 4093 854 82 623 4093 1696 56 733 102 3112 28 695 102 3029 38 598 102 2659 38 981 2175 3605 34 695 2175 2253 93 235 2753 4730 80 695 2753 3869 40 866 2798 2753 99 695 2798 3814 70 302 2798 4260 61 4 3112 4378 66 695 3112 2573 13 60 3112 3788 71 86 3605 4170 12 695 3605 2818 7 272 4170 2798 3 695 4170 871 90 79 4170 1376 9 36 4378 2175 26 695 4378 4797 22 695 4378 1485 9 200 4378 4627 45 690 103 3419 15 312 103 2244 64 796 103 2117 79 659 947 2066 83 312 947 3735 96 965 1948 3017 56 312 1948 2771 57 977 2066 1948 64 312 2066 4188 27 372 2066 4544 28 588 2112 3443 48 312 2112 1716 54 109 2112 4894 22 304 3017 4141 34 312 3017 4301 73 957 3419 947 67 312 3419 4750 34 312 3419 3115 100 96 3443 4657 46 312 3443 942 97 720 4141 2112 95 312 4141 1181 53 447 104 2878 76 447 104 4104 20 324 1954 4886 8 447 1954 4766 88 447 1954 2827 74 192 2294 4148 42 447 2294 1573 49 409 2294 4413 80 13 2391 1954 75 447 2391 1108 87 753 2756 4154 15 447 2756 2520 91 33 2756 2135 93 408 2878 3339 85 447 2878 4528 76 683 3339 2294 58 447 3339 4840 79 699 3339 4820 36 967 4148 4298 63 447 4148 791 1 923 4148 2585 20 422 4154 2391 75 447 4154 2537 20 355 4154 277 45 56 4298 2756 73 447 4298 2377 88 435 4298 4252 51 701 105 1001 71 420 105 2579 88 601 833 2678 76 420 833 1794 18 418 833 3106 63 31 994 4763 79 420 994 4061 63 81 1001 4216 92 420 1001 4109 33 335 1083 4536 60 420 1083 2547 16 420 1083 2002 79 132 1083 3648 77 215 2547 833 40 420 2547 4180 84 654 2678 994 62 420 2678 3643 5 149 2678 1533 37 43 3729 1083 24 420 3729 2255 53 328 4216 3729 45 420 4216 4242 39 204 4216 4976 93 602 106 3301 71 758 106 2686 44 985 106 199 88 235 1169 3067 79 758 1169 3709 96 789 1428 4660 62 758 1428 4888 14 636 1428 1697 39 813 1444 4367 62 758 1444 2320 9 838 1444 3097 7 274 3067 3795 71 758 3067 4295 59 590 3067 4706 29 278 3301 1169 90 758 3301 1202 78 441 3795 1444 99 758 3795 4829 100 758 3795 4709 16 476 3795 3983 67 935 4114 1428 21 758 4114 1864 41 593 4367 4114 40 758 4367 805 3 511 107 2540 86 880 107 2668 22 456 895 1987 75 880 895 2896 6 989 983 2551 67 880 983 4718 3 495 1512 895 53 880 1512 181 60 240 1512 2698 69 965 1570 983 22 880 1570 1900 73 724 1667 4916 85 880 1667 3330 59 880 1667 3571 43 110 1667 2116 81 807 1987 2581 93 880 1987 780 39 157 1987 4944 20 768 2540 1512 39 880 2540 2122 92 42 2551 4790 13 880 2551 2309 52 484 2581 1667 33 880 2581 871 83 442 3330 1570 17 880 3330 3209 88 945 108 3607 73 846 108 1800 86 435 1025 1773 28 846 1025 2608 23 157 1025 2268 47 965 1322 4862 35 846 1322 4583 43 846 1322 3588 96 849 1322 4764 23 146 1773 3946 34 846 1773 322 31 415 3607 1025 41 846 3607 4179 67 886 3607 2565 70 93 3946 1322 37 846 3946 756 32 706 109 1749 60 694 109 3051 11 184 109 2236 22 649 568 2613 61 694 568 255 53 590 568 374 53 803 1239 4856 55 694 1239 3194 100 694 1239 1299 92 291 1239 3546 34 740 1251 4172 42 694 1251 475 16 175 1251 4904 48 902 1544 4583 7 694 1544 4730 36 197 1544 1211 89 358 1620 1251 16 694 1620 4713 50 172 1622 1544 38 694 1622 3232 60 996 1749 1620 19 694 1749 618 1 254 1749 1726 16 968 1789 1239 26 694 1789 4819 63 757 1789 3838 47 153 2613 1622 75 694 2613 4476 1 813 2613 2275 6 969 3194 568 30 694 3194 4056 7 257 3194 1569 78 566 4172 1789 77 694 4172 426 45 737 110 1161 35 804 110 117 69 728 110 1036 10 858 703 4759 4 804 703 3335 76 757 703 4688 45 675 1161 3797 82 804 1161 4874 8 804 1161 3205 24 221 2890 703 12 804 2890 4144 76 835 3371 2890 15 804 3371 227 30 310 3513 3371 92 804 3513 1640 37 248 3513 3683 85 358 3797 3513 40 804 3797 4718 94 93 3797 2972 5 234 111 1888 14 411 111 2668 25 341 111 3079 95 760 1640 2502 26 411 1640 4795 10 662 1640 1519 82 70 1888 3608 70 411 1888 4742 50 411 1888 2482 93 513 2502 4534 58 411 2502 630 5 648 3608 4217 41 411 3608 2222 5 320 3608 4762 45 245 4217 1640 94 411 4217 1433 9 561 112 1346 53 299 112 298 83 310 654 2031 96 299 654 2253 15 433 654 1739 64 472 1222 2494 23 299 1222 4628 63 299 1222 4556 13 349 1346 2432 53 299 1346 1128 67 194 1346 543 9 705 2031 1222 57 299 2031 4374 62 700 2031 2103 14 325 2368 4477 56 299 2368 666 5 721 2432 3220 1 299 2432 2012 6 975 2432 4552 52 555 2494 4945 65 299 2494 2905 57 47 2494 4580 98 129 3220 4038 69 299 3220 4983 2 445 4038 2368 2 299 4038 3190 30 593 4477 654 45 299 4477 2949 61 947 113 754 93 395 113 1813 53 198 113 3854 25 26 515 3335 20 395 515 2833 21 615 515 1637 100 326 754 515 65 395 754 3831 24 626 754 1669 69 783 1057 3491 20 395 1057 897 51 407 1057 2162 96 537 3165 4968 37 395 3165 4577 18 395 3165 1797 99 665 3165 1336 26 534 3335 4059 46 395 3335 3208 40 330 3491 3165 82 395 3491 1163 29 187 3491 1744 94 974 4059 1057 2 395 4059 568 41 729 4059 2388 4 479 114 2310 33 120 114 3611 70 478 114 918 81 456 1223 4788 2 120 1223 1286 98 875 1223 1580 57 657 1899 3692 57 120 1899 2726 72 224 2310 4336 56 120 2310 1041 12 89 2310 2204 29 864 3044 1223 68 120 3044 2074 40 767 3692 4530 40 120 3692 3044 34 120 3692 2483 42 171 4336 1899 41 120 4336 643 98 207 4336 305 2 253 115 1859 32 702 115 3428 21 22 115 2699 93 499 704 2349 72 702 704 2259 49 540 704 3383 66 245 1219 704 57 702 1219 3454 5 850 1373 3500 61 702 1373 342 23 149 1859 1373 11 702 1859 1685 90 424 2349 4525 10 702 2349 4947 19 702 2349 3722 98 304 2349 4928 12 629 2402 1219 80 702 2402 669 69 560 2402 1028 21 286 3500 4347 17 702 3500 1162 92 7 4347 2402 32 702 4347 2493 68 41 4347 3658 77 500 116 3472 94 269 116 3011 21 963 956 4498 9 269 956 4617 74 147 2026 3303 4 269 2026 2098 15 78 3148 956 66 269 3148 552 91 938 3148 3512 35 688 3303 4301 38 269 3303 89 74 854 3303 1872 73 21 3472 2026 47 269 3472 672 87 889 3472 1741 57 527 4138 4649 37 269 4138 4543 7 269 4138 3018 44 628 4301 3148 36 269 4301 2178 25 181 4498 4138 72 269 4498 1577 72 975 4498 4183 5 827 117 4128 78 703 117 264 69 513 1699 4150 42 703 1699 2277 79 706 1794 4883 24 703 1794 1832 64 882 2498 1794 83 703 2498 1294 35 266 2498 2121 2 18 2512 4928 1 703 2512 3284 16 703 2512 1223 69 416 3277 2498 69 703 3277 4795 31 48 3277 1040 27 137 3284 3277 51 703 3284 3449 30 413 4128 1699 23 703 4128 2104 54 85 4150 2512 40 703 4150 1941 18 464 118 1609 88 619 118 4697 41 760 118 826 4 502 535 675 96 619 535 1075 79 479 675 1038 72 619 675 487 18 743 675 4320 33 362 1038 3824 6 619 1038 4386 71 518 1609 1647 89 619 1609 2067 34 627 1647 3466 92 619 1647 4522 57 619 1647 343 9 366 2367 3885 56 619 2367 3625 15 305 3466 2367 79 619 3466 1300 79 325 3466 2507 83 743 3824 4726 97 619 3824 2840 81 405 3824 4816 83 130 3885 535 86 619 3885 201 66 832 3885 2978 18 655 119 4219 12 172 119 1544 35 516 119 3889 43 710 512 1168 68 172 512 298 96 29 946 512 2 172 946 2531 64 33 1168 3651 15 172 1168 4770 28 172 1168 1233 54 295 1168 3464 75 267 1425 1679 88 172 1425 1241 97 379 1425 3227 73 1 1679 4496 92 172 1679 2097 51 872 1679 3031 37 688 1988 4042 55 172 1988 2769 82 381 1988 2698 17 471 2225 946 34 172 2225 2395 76 464 3398 2225 13 172 3398 4601 5 172 3398 4878 46 79 3651 1988 32 172 3651 1517 64 128 3651 4114 16 105 4042 1425 12 172 4042 4466 41 713 4219 3398 35 172 4219 441 13 574 4219 1796 45 690 4496 4810 19 172 4496 3296 39 98 120 4365 19 689 120 1075 25 988 120 2207 27 184 820 2807 35 689 820 2419 39 338 820 4397 96 963 1372 1975 15 689 1372 3149 90 680 1372 3700 73 292 1975 4043 41 689 1975 388 63 788 1975 2044 35 563 2188 2731 16 689 2188 4506 13 885 2188 3230 79 908 2731 4631 68 689 2731 207 2 314 2731 783 58 661 2807 2188 89 689 2807 606 90 393 4043 820 28 689 4043 4608 91 689 4043 1801 66 76 4043 4369 56 871 4365 1372 62 689 4365 1360 20 639 121 2262 5 341 121 3747 54 648 121 18 31 874 558 4135 59 341 558 795 65 37 558 3855 84 43 2094 3281 49 341 2094 559 72 785 2262 3360 16 341 2262 2799 10 419 2262 865 84 478 3281 4706 33 341 3281 3742 35 885 3360 3722 85 341 3360 3222 62 226 3722 4270 33 341 3722 4870 8 965 3722 1500 1 519 4135 2094 52 341 4135 3919 17 875 4270 558 26 341 4270 4602 67 341 4270 2459 98 811 4270 3188 58 73 122 3280 22 699 122 2561 51 773 122 2655 53 102 1351 1687 27 699 1351 1176 37 228 1687 3313 97 699 1687 3242 71 883 1687 2122 64 887 2216 4211 52 699 2216 3888 43 420 2216 644 54 304 3280 1351 43 699 3280 1340 56 864 3313 2216 69 699 3313 4701 100 699 3313 2388 50 175 3313 3213 33 388 4211 4924 19 699 4211 22 24 331 123 2475 78 735 123 2266 9 704 123 1573 74 424 1188 3606 80 735 1188 3915 8 68 1188 4877 69 945 1472 4876 57 735 1472 1916 12 964 1472 2662 37 68 2475 1188 19 735 2475 4078 11 427 2475 3127 20 517 2607 4844 79 735 2607 3433 61 735 2607 199 60 411 3433 1472 27 735 3433 4405 93 585 3606 4255 63 735 3606 4748 78 304 4255 2607 50 735 4255 325 77 991 4255 892 97 292 124 3596 64 4 124 4368 60 49 124 3217 77 289 847 3066 78 4 847 4912 36 430 1298 4667 36 4 1298 3310 99 4 1298 893 31 975 1744 3076 75 4 1744 1192 85 648 1818 1298 14 4 1818 3783 53 137 1818 1529 18 872 2284 3659 68 4 2284 1297 74 108 2783 1818 93 4 2783 4998 94 4 2783 1969 21 18 2783 4629 28 689 3066 1744 77 4 3066 2926 37 772 3066 332 97 136 3076 3223 7 4 3076 4141 97 22 3223 2783 30 4 3223 891 98 884 3223 3195 37 514 3310 4926 61 4 3310 4954 61 422 3596 2284 23 4 3596 1874 63 206 3659 847 76 4 3659 3640 22 32 125 1993 54 764 125 4987 76 870 125 3091 95 293 664 2548 41 764 664 637 13 835 1112 2531 72 764 1112 3485 25 449 1181 4049 65 764 1181 478 37 631 1181 2186 2 806 1993 1181 45 764 1993 2201 77 504 1993 1525 41 197 2531 4271 22 764 2531 1503 76 945 2531 4226 96 172 2548 3751 64 764 2548 489 35 981 3523 4409 55 764 3523 3440 95 732 3523 4523 40 738 3751 4879 11 764 3751 359 57 565 4049 3523 1 764 4049 4660 26 764 4049 4212 67 644 4271 664 53 764 4271 4598 79 155 4271 1712 20 722 4409 1112 24 764 4409 4155 80 476 126 4165 53 735 126 584 21 507 1438 4500 61 735 1438 4798 13 967 3139 1438 3 735 3139 4992 68 735 3139 1051 24 573 3648 4994 40 735 3648 2837 22 721 3648 1622 71 835 4165 4248 54 735 4165 147 71 593 4248 3139 88 735 4248 500 79 485 4248 4940 29 680 4500 3648 90 735 4500 4866 2 159 127 2147 34 271 127 4410 84 207 127 3844 82 943 1675 4806 38 271 1675 3433 52 132 2147 2952 17 271 2147 39 85 421 2147 4785 98 371 2952 4306 4 271 2952 2164 80 69 2952 986 95 186 3476 1675 75 271 3476 2737 16 898 3619 3476 35 271 3619 2258 80 9 4306 3619 47 271 4306 4771 18 271 4306 3907 56 556 128 2837 21 564 128 1928 27 887 598 3924 20 564 598 4518 82 915 2061 3167 61 564 2061 2424 26 941 2061 325 38 880 2651 598 45 564 2651 1699 88 20 2651 389 30 734 2837 2061 47 564 2837 4020 89 956 3113 2651 59 564 3113 2404 47 12 3113 2178 70 722 3167 3113 76 564 3167 4789 33 564 3167 3946 93 328 3167 994 21 841 3924 4853 77 564 3924 4269 86 725 3924 4869 97 877 129 3812 7 28 129 1562 38 294 903 2198 15 28 903 2683 28 412 1149 4897 90 28 1149 4884 48 28 1149 912 80 34 1149 1450 74 565 1582 903 12 28 1582 3299 27 628 1582 2590 36 999 2198 1149 43 28 2198 1144 20 556 2198 4263 96 112 3631 3992 20 28 3631 4895 85 483 3631 3912 37 279 3812 4222 61 28 3812 2515 28 262 3846 1582 51 28 3846 4482 41 499 3846 4056 67 564 3992 3846 31 28 3992 2691 83 408 3992 856 31 57 4222 3631 89 28 4222 2351 8 138 130 1565 64 32 130 3887 50 636 1091 2754 63 32 1091 57 15 30 1091 1758 1 487 1565 2201 89 32 1565 4254 99 150 1565 2314 13 227 2201 4595 37 32 2201 4112 85 32 2201 4874 30 499 2754 3965 55 32 2754 2253 45 309 2754 1120 63 529 2892 3387 37 32 2892 217 44 605 3387 1091 89 32 3387 4465 53 173 3387 1803 81 714 3445 2892 78 32 3445 4357 34 283 3445 169 77 960 3965 4767 84 32 3965 4426 34 600 4112 3445 19 32 4112 4597 3 79 4112 1924 94 58 131 1799 2 822 131 4556 21 673 131 4570 63 595 678 1021 64 822 678 4990 75 194 1021 3945 76 822 1021 4277 96 422 1040 3726 37 822 1040 3321 40 266 1040 4071 2 790 1799 4446 4 822 1799 4923 42 822 1799 2206 8 973 3726 4892 8 822 3726 2050 49 383 3945 4269 89 822 3945 228 85 205 3945 4522 19 388 4269 1040 29 822 4269 144 35 525 4446 678 64 822 4446 2143 53 862 4446 817 34 367 132 2525 51 654 132 1895 70 719 132 1168 18 831 629 4361 35 654 629 2976 76 284 629 359 57 794 1408 1648 10 654 1408 4244 23 285 1408 1535 92 408 1439 1701 67 654 1439 1550 50 471 1648 4556 94 654 1648 3997 100 654 1648 2672 48 568 1701 2868 34 654 1701 3380 20 511 2199 629 45 654 2199 339 19 189 2199 1600 76 691 2525 1408 65 654 2525 2053 2 219 2857 2199 75 654 2857 4895 49 654 2857 4005 72 960 2857 2821 39 448 2868 2908 21 654 2868 2080 18 558 2868 290 7 821 2908 4802 59 654 2908 3721 85 178 3997 2857 34 654 3997 2669 47 849 3997 580 35 590 4361 1439 75 654 4361 1403 86 684 4361 756 95 458 133 2497 100 561 133 1777 51 131 1139 4617 9 561 1139 211 56 613 2497 2956 93 561 2497 2803 17 814 2780 1139 27 561 2780 3344 1 445 2780 2169 83 175 2956 3019 46 561 2956 4965 72 413 3019 4060 37 561 3019 1628 18 115 3019 2506 32 15 3776 4117 45 561 3776 2299 45 517 3776 4820 70 606 4060 3776 11 561 4060 4715 82 561 4060 492 61 872 4060 4546 83 438 4075 2780 38 561 4075 831 33 946 4075 2563 94 837 4117 4075 10 561 4117 135 77 863 4117 63 79 713 134 660 6 644 134 1816 4 489 660 2303 41 644 660 2500 35 92 1459 1953 13 644 1459 1188 39 46 1459 2692 64 582 1834 2436 66 644 1834 1833 7 796 1953 1834 86 644 1953 3624 64 265 1953 251 82 647 1968 2007 26 644 1968 2195 58 730 2007 1459 11 644 2007 1715 32 750 2303 1968 20 644 2303 2988 24 205 2303 4063 39 107 2436 4895 95 644 2436 4746 61 644 2436 4240 18 67 2436 4684 95 715 135 3666 1 621 135 2190 15 452 135 4593 48 459 747 1463 70 621 747 2066 47 365 1463 3377 23 621 1463 1927 76 623 1463 431 51 453 2063 4767 32 621 2063 227 14 166 2411 2755 89 621 2411 4075 45 652 2411 2417 85 132 2755 3627 15 621 2755 4905 53 621 2755 3395 27 291 3377 2411 74 621 3377 1376 29 315 3627 2063 48 621 3627 4233 99 647 3666 747 16 621 3666 436 18 794 136 2134 65 392 136 3839 32 727 136 2365 89 308 783 4022 2 392 783 4956 62 167 783 2609 35 390 866 783 99 392 866 3016 42 306 938 2785 63 392 938 31 95 769 1352 1797 85 392 1352 2098 46 692 1797 866 78 392 1797 303 7 64 1797 1049 70 940 2134 938 37 392 2134 1379 17 3 2785 1352 21 392 2785 2756 24 440 2785 2882 67 86 2796 4893 56 392 2796 1810 10 388 4022 4252 25 392 4022 4600 4 392 4022 4796 86 128 4022 4685 37 214 4252 2796 42 392 4252 291 73 616 137 900 47 964 137 4185 47 824 137 2051 99 811 900 2204 20 964 900 1697 28 221 900 2493 49 451 1405 4069 19 964 1405 4465 89 773 1805 1405 35 964 1805 1453 52 900 1805 2929 3 90 1944 4996 74 964 1944 3144 7 937 2204 1805 77 964 2204 4904 22 964 2204 1203 60 280 2535 1944 78 964 2535 4303 88 810 2535 3415 7 211 4069 2535 83 964 4069 3519 3 206 4069 1305 1 96 138 4081 79 108 138 1075 15 988 138 4232 57 654 1114 2078 67 108 1114 2360 9 357 2078 4399 47 108 2078 4613 61 763 2078 1780 74 484 2527 1114 15 108 2527 1486 70 772 2527 693 83 281 2930 2527 83 108 2930 218 80 134 2930 931 55 838 3018 2930 16 108 3018 446 17 363 3018 2856 20 847 3974 3018 27 108 3974 4316 3 697 4081 3974 97 108 4081 1614 13 874 4399 4821 55 108 4399 4573 54 108 4399 2033 93 197 4399 3687 83 37 139 4335 46 394 139 792 20 410 139 4082 4 965 659 4860 61 394 659 2461 60 72 1525 1743 75 394 1525 138 27 864 1525 2743 4 163 1743 4158 77 394 1743 4046 35 812 1743 4592 97 977 1746 1525 71 394 1746 3023 28 569 2459 3092 2 394 2459 3152 89 788 2459 3837 24 167 3092 659 51 394 3092 1493 35 546 3238 4280 97 394 3238 3582 37 244 4158 2459 38 394 4158 4702 59 394 4158 1764 43 48 4280 1746 7 394 4280 3187 55 503 4280 544 14 130 4335 3238 51 394 4335 3847 2 516 4335 2380 67 335 140 2591 16 1149 140 4714 44 325 140 3703 74 9 982 1996 85 1149 982 3684 73 558 982 4080 20 64 1996 3034 29 1149 1996 4613 86 1149 1996 906 60 247 1996 4963 49 76 2591 4484 32 1149 2591 3792 93 524 3034 4976 98 1149 3034 3777 45 910 4341 982 91 1149 4341 1294 11 543 4484 4341 75 1149 4484 1347 7 996 4484 1123 55 290 141 3033 89 284 141 1191 92 26 552 3545 95 284 552 437 10 936 552 2653 60 705 1412 1824 2 284 1412 3981 9 278 1412 924 71 109 1824 4629 79 284 1824 4811 63 284 1824 4684 36 209 1824 4078 90 946 2467 552 67 284 2467 128 96 789 2467 673 89 398 2834 2467 85 284 2834 375 21 955 3033 2834 93 284 3033 4597 82 408 3033 4499 26 628 3545 4214 52 284 3545 3725 87 900 4214 1412 92 284 4214 2377 25 57 4214 1319 30 573 142 2604 62 433 142 4060 64 690 142 2123 90 783 566 4791 17 433 566 4567 34 737 566 4291 76 481 789 566 65 433 789 2826 61 487 789 6 47 257 1166 3096 43 433 1166 2782 96 645 1166 2808 62 680 2003 4841 7 433 2003 3914 33 433 2003 3193 33 376 2374 1166 42 433 2374 976 36 483 2374 571 9 338 2604 2003 14 433 2604 2912 39 98 3096 789 24 433 3096 682 8 402 3402 4240 20 433 3402 2935 26 43 3554 2374 21 433 3554 1113 97 364 3914 3402 71 433 3914 669 65 731 4240 3554 96 433 4240 1376 6 94 4240 900 66 397 143 844 34 346 143 91 45 771 143 2657 33 456 502 3245 92 346 502 2215 62 138 844 1889 19 346 844 2679 84 535 884 502 11 346 884 1377 23 30 884 4443 14 37 1889 3057 11 346 1889 1097 53 874 2645 4762 69 346 2645 1973 50 840 2645 2630 55 445 3057 4296 52 346 3057 4692 97 128 3245 4764 89 346 3245 4435 3 346 3245 510 99 5 3245 1963 55 928 4296 884 17 346 4296 896 53 294 4435 2645 1 346 4435 4081 62 73 144 2105 2 168 144 525 100 589 144 605 47 287 522 4872 12 168 522 1453 20 233 784 1915 23 168 784 4759 41 136 784 2463 92 518 1915 2423 5 168 1915 464 44 425 1915 2404 17 455 2105 4374 62 168 2105 3321 7 391 2105 1546 49 777 2217 3794 57 168 2217 966 3 621 2217 3056 60 880 2423 522 8 168 2423 4677 87 168 2423 951 24 636 2423 2368 69 610 2972 2217 51 168 2972 3811 50 855 3794 784 70 168 3794 1949 3 704 4374 2972 89 168 4374 2433 18 805 145 4444 66 982 145 3341 69 554 145 897 80 164 583 1174 81 982 583 1128 57 810 770 583 46 982 770 850 83 278 1174 4715 68 982 1174 3271 73 66 1174 2077 44 861 3062 4311 57 982 3062 4993 79 982 3062 4247 88 111 4311 770 82 982 4311 325 76 618 4444 3062 42 982 4444 4434 1 11 146 3260 67 790 146 1511 58 874 1587 3753 25 790 1587 2548 47 317 2074 4903 41 790 2074 4053 70 887 2074 719 100 432 3260 1587 38 790 3260 588 85 928 3260 4761 4 209 3753 4072 62 790 3753 369 50 245 3981 2074 25 790 3981 1852 73 578 3981 1754 28 257 4072 4179 83 790 4072 4601 64 790 4072 1505 2 676 4072 1326 71 403 4179 3981 81 790 4179 4802 5 309 4179 1935 32 694 147 3071 36 469 147 3942 11 241 147 2741 21 509 526 3369 7 469 526 3362 63 64 1260 3942 63 469 1260 4089 2 725 2914 4197 38 469 2914 1871 34 876 3071 2914 61 469 3071 1008 48 767 3258 3968 14 469 3258 4860 27 469 3258 355 98 132 3258 425 73 390 3369 4396 89 469 3369 2158 21 860 3942 526 94 469 3942 2620 51 865 3968 4576 42 469 3968 3473 84 917 4197 1260 54 469 4197 3690 95 623 4396 3258 91 469 4396 4110 50 387 148 865 36 287 148 3154 45 303 865 2948 96 287 865 4598 28 287 865 4387 3 739 865 4447 72 810 1670 2445 91 287 1670 1654 91 1000 1670 3422 16 340 2176 1670 44 287 2176 4864 83 580 2445 2509 10 287 2445 2282 72 329 2509 4931 13 287 2509 243 15 855 2509 3203 97 786 2948 2176 36 287 2948 3331 60 459 149 4364 83 427 149 2765 49 322 762 1727 73 427 762 4078 69 255 888 2111 64 427 888 311 57 42 1421 4118 50 427 1421 4582 14 761 1421 3259 54 416 1727 4101 44 427 1727 4283 9 601 1727 3345 19 193 2111 1421 77 427 2111 1061 64 339 2111 4690 28 27 2471 762 51 427 2471 4605 16 427 2471 1117 95 467 4101 4760 43 427 4101 3619 58 243 4118 2471 78 427 4118 4842 45 31 4364 888 57 427 4364 4082 45 883 150 3184 41 763 150 2928 66 501 589 777 67 763 589 3922 43 445 589 1237 31 632 777 1416 81 763 777 932 41 145 777 1917 53 950 1416 3430 95 763 1416 4977 28 763 1416 4483 28 23 3184 4202 31 763 3184 4900 19 902 3184 2263 19 95 3430 4647 55 763 3430 2094 99 224 3430 2603 31 332 4202 589 87 763 4202 3459 23 459 4202 1031 4 278 151 3389 79 407 151 3457 12 340 612 2040 64 407 612 3191 65 2 612 485 61 73 804 3662 43 407 804 4291 43 23 804 4394 62 35 1227 3497 75 407 1227 4827 76 816 2040 804 26 407 2040 1184 81 140 2805 1227 59 407 2805 2649 69 303 2805 756 44 685 3389 612 97 407 3389 3208 49 672 3497 4692 58 407 3497 4359 85 551 3662 3890 82 407 3662 4883 79 407 3662 2077 24 86 3662 4330 5 881 3890 2805 5 407 3890 3265 15 280 3890 3305 52 1 152 3586 62 323 152 3457 90 763 1552 2896 23 323 1552 3728 91 890 2029 3701 44 323 2029 3505 10 416 2873 2029 42 323 2873 3334 68 254 2896 3283 89 323 2896 1497 8 225 2896 76 87 68 3283 4359 94 323 3283 4637 11 323 3283 2985 98 761 3586 2873 34 323 3586 4702 74 413 3701 3825 27 323 3701 4964 82 295 3825 1552 96 323 3825 3781 23 724 3825 1772 61 276 4359 4829 64 323 4359 4296 58 681 153 4184 51 776 153 529 42 847 1076 4537 96 776 1076 3570 12 82 1076 4410 55 768 1931 1076 20 776 1931 1393 85 784 3796 4676 43 776 3796 1931 50 776 3796 448 52 367 3796 3715 62 314 4184 4393 33 776 4184 513 95 767 4393 3796 87 776 4393 1252 26 977 154 3599 19 1109 154 564 16 6 154 1947 60 285 810 1244 33 1109 810 4957 42 61 810 4467 52 730 1177 3232 78 1109 1177 671 43 469 1177 554 39 921 1244 4893 68 1109 1244 1856 40 362 1244 2133 83 922 2259 810 25 1109 2259 3132 2 40 2259 4765 8 586 3232 2259 97 1109 3232 4640 1 1109 3232 4985 95 927 3232 2464 26 81 3599 1177 63 1109 3599 2220 6 58 3599 2092 81 300 155 501 49 896 155 1905 92 377 501 1841 6 896 501 4621 67 896 501 1402 100 148 501 1863 64 988 827 2687 41 896 827 213 72 810 827 4248 67 647 1841 827 96 896 1841 1484 56 166 2687 3399 66 896 2687 898 28 566 3399 4726 78 896 3399 3934 70 786 3399 4651 3 600 156 1455 2 288 156 428 42 902 525 4583 53 288 525 2203 95 57 525 197 87 456 975 3844 62 288 975 1842 44 554 1118 525 40 288 1118 592 1 672 1118 1612 56 493 1345 3892 11 288 1345 2758 61 984 1345 1963 63 332 1455 4953 45 288 1455 4033 23 288 1455 3167 22 555 1455 3639 10 512 3844 1345 71 288 3844 4147 37 53 3892 1118 47 288 3892 680 56 539 3892 4073 4 591 4033 4354 3 288 4033 663 31 189 4033 201 72 973 4354 975 85 288 4354 2219 39 271 4354 1730 18 182 157 4237 35 680 157 2116 99 342 157 2488 78 412 1760 3744 85 680 1760 2328 64 291 1760 4646 100 50 2128 4417 35 680 2128 379 67 576 2312 4879 50 680 2312 2394 98 69 2728 3063 18 680 2728 708 83 589 2817 2728 23 680 2817 3789 23 145 2817 2960 65 649 3063 1760 1 680 3063 3149 73 591 3063 162 71 714 3744 2128 11 680 3744 3051 73 409 3947 4638 36 680 3947 2312 6 680 3947 2854 97 411 3947 4619 87 582 4237 2817 40 680 4237 2534 9 473 4417 3947 67 680 4417 3364 11 605 158 2428 84 1632 158 4403 51 450 910 3921 11 1632 910 4614 99 524 910 3175 32 220 939 2655 28 1632 939 4145 69 958 939 1357 82 594 1940 2670 99 1632 1940 4710 41 1632 1940 1307 69 260 2065 4660 37 1632 2065 4448 60 150 2428 1940 49 1632 2428 2600 90 127 2655 910 25 1632 2655 2257 84 622 2655 1462 37 407 2670 939 74 1632 2670 1810 65 333 3921 2065 73 1632 3921 1173 28 704 159 3672 75 385 159 3077 72 203 159 1473 26 511 579 3293 11 385 579 1752 78 135 579 4647 39 952 790 4750 13 385 790 681 90 967 1071 1160 41 385 1071 3135 37 535 1160 3366 67 385 1160 3628 34 957 1385 2751 21 385 1385 624 35 485 2751 3677 61 385 2751 4012 24 626 3293 1385 51 385 3293 2496 41 24 3293 467 84 484 3366 579 100 385 3366 2747 92 148 3672 1071 71 385 3672 4976 30 385 3672 3284 50 123 3672 2428 20 208 3677 790 35 385 3677 1577 26 867 160 3589 62 364 160 619 83 667 160 1778 89 801 881 1125 99 364 881 3647 89 342 1039 1856 29 364 1039 708 53 434 1039 3704 83 974 1125 2574 51 364 1125 4960 96 364 1125 4614 22 597 1125 910 1 90 1856 2982 95 364 1856 1195 85 106 1856 2441 40 135 1862 1039 29 364 1862 3931 32 549 2574 1862 86 364 2574 4154 32 936 2574 2115 6 169 2898 881 67 364 2898 815 39 336 2898 2146 87 414 2982 4581 15 364 2982 2350 22 211 2982 788 96 283 3589 2898 73 364 3589 3483 97 178 161 3887 58 1053 161 4993 55 503 673 1527 88 1053 673 837 25 554 822 4143 5 1053 822 4982 20 43 1527 2777 81 1053 1527 501 42 388 2366 4920 51 1053 2366 4828 27 1053 2366 1295 90 617 2777 4020 4 1053 2777 3193 45 97 2777 3024 6 508 2994 673 90 1053 2994 607 73 116 3887 2994 13 1053 3887 4893 19 281 3887 1589 97 244 4020 822 96 1053 4020 4904 91 360 4020 3773 61 861 4143 2366 94 1053 4143 469 86 879 162 2564 15 382 162 2026 70 338 1024 2750 38 382 1024 4735 14 382 1024 3907 84 7 1024 4638 13 426 1451 1024 58 382 1451 3725 99 754 2564 2918 11 382 2564 4072 81 293 2750 4649 99 382 2750 1607 46 645 2750 1888 9 686 2918 1451 34 382 2918 1403 93 762 163 2127 94 582 163 3987 45 308 163 391 57 704 1312 4005 63 582 1312 2082 39 41 1762 3417 1 582 1762 4672 81 582 1762 560 40 224 2127 3919 71 582 2127 4131 100 369 3417 1312 69 582 3417 3561 91 626 3919 1762 13 582 3919 1079 79 543 3919 2970 97 574 4005 4697 75 582 4005 1670 79 582 4005 3172 19 731 164 702 70 378 164 1795 70 625 692 4797 11 378 692 4695 16 378 692 2750 68 879 702 3553 71 378 702 3853 98 104 702 4604 74 207 3098 3257 55 378 3098 2757 17 127 3098 1537 72 828 3257 3682 9 378 3257 3627 56 603 3257 1553 62 450 3304 3098 92 378 3304 4956 48 117 3304 4657 26 198 3553 3304 83 378 3553 4400 2 401 3553 3770 26 400 3682 692 29 378 3682 784 12 192 165 961 49 217 165 1380 48 692 961 2784 74 217 961 2345 2 867 961 1756 55 253 1320 2420 51 217 1320 2368 12 648 1320 1715 55 632 1381 2306 90 217 1381 1271 2 747 1717 4922 25 217 1717 4773 60 973 1717 3259 86 878 2306 4264 85 217 2306 4614 52 294 2420 4667 3 217 2420 2771 20 217 2420 4577 75 330 2420 4412 35 896 2771 4208 46 217 2771 2495 82 293 2784 2882 6 217 2784 4701 52 235 2882 1320 73 217 2882 2780 6 457 4208 1381 14 217 4208 1141 15 811 4264 1717 9 217 4264 1573 100 459 166 3886 28 412 166 3909 77 439 1253 1997 25 412 1253 362 97 14 1997 4797 83 412 1997 1817 44 780 2009 1253 59 412 2009 3142 30 256 2309 2009 18 412 2309 815 82 985 2309 2355 62 464 3475 2309 55 412 3475 4606 26 412 3475 3507 92 66 3475 4006 10 312 3886 3475 43 412 3886 1791 89 136 3886 1869 78 179 167 4260 31 378 167 1040 11 157 167 2308 68 828 607 932 81 378 607 2639 83 513 932 3895 67 378 932 591 33 305 932 3264 33 537 2550 3198 7 378 2550 3578 54 538 2550 1683 72 993 2663 4748 25 378 2663 4895 47 378 2663 478 78 838 3198 2663 91 378 3198 89 48 122 3198 3062 27 370 3823 2550 42 378 3823 3836 83 347 3895 3823 20 378 3895 893 25 549 4260 607 22 378 4260 1714 70 39 4260 1038 19 777 168 2513 56 371 168 1425 90 794 168 253 18 388 562 3562 51 371 562 2570 75 189 562 376 52 318 616 4934 77 371 616 3055 46 371 616 294 41 299 616 1626 41 692 2513 3668 6 371 2513 423 2 621 2513 4207 23 345 2848 3580 54 371 2848 2368 47 885 2848 3362 64 921 3055 3099 76 371 3055 990 36 554 3055 4638 4 339 3099 562 27 371 3099 1711 69 233 3099 387 10 279 3562 3814 9 371 3562 2971 93 527 3562 2047 29 976 3580 3703 46 371 3580 413 74 246 3580 3272 75 443 3668 2848 77 371 3668 2764 67 886 3703 616 53 371 3703 2004 12 665 3814 4585 27 371 3814 1013 51 42 3814 4249 77 224 169 2409 28 420 169 4148 6 931 169 2556 93 512 1100 2069 99 420 1100 4926 71 423 1698 4633 16 420 1698 4590 48 769 1811 2584 75 420 1811 4612 62 356 1811 4810 92 113 2069 4757 83 420 2069 1811 8 420 2069 3603 72 504 2069 4393 69 267 2324 3436 38 420 2324 2885 81 937 2409 2324 45 420 2409 4553 92 513 2409 1120 5 497 2584 1698 49 420 2584 1322 24 785 2584 4061 86 532 3436 1100 36 420 3436 4956 76 114 170 1801 13 1017 170 3196 73 82 170 1505 86 258 665 779 76 1017 665 4306 53 648 779 4405 85 1017 779 4265 4 90 779 2909 89 796 992 665 22 1017 992 1103 16 27 992 1382 55 79 1361 2741 67 1017 1361 4816 74 639 1361 895 67 909 1801 4633 63 1017 1801 3782 47 1017 1801 3096 59 13 1801 2934 27 518 2741 4091 56 1017 2741 3436 3 95 3782 1361 87 1017 3782 4164 67 790 4091 4368 64 1017 4091 1943 59 981 4368 992 3 1017 4368 16 7 708 4368 2046 88 736 4405 4745 62 1017 4405 1958 31 740 4405 3636 2 15 171 2395 72 719 171 4135 8 921 171 4728 41 685 1539 1725 47 719 1539 2128 31 550 1725 2669 33 719 1725 2902 75 316 1725 2209 40 381 2395 2880 85 719 2395 340 80 728 2395 3890 98 842 2669 4856 36 719 2669 3716 99 1000 2880 3079 60 719 2880 1840 91 622 2880 2826 26 440 3079 1539 22 719 3079 4937 3 719 3079 1322 15 801 3079 3186 61 756 172 3420 64 24 172 3232 71 11 734 769 45 24 734 796 50 10 769 4587 57 24 769 4842 25 24 769 1449 39 378 769 2599 42 825 1237 2766 50 24 1237 4270 35 29 1237 2300 81 180 2766 734 77 24 2766 2336 66 702 2992 1237 13 24 2992 1015 80 141 2992 1181 35 165 3420 2992 42 24 3420 4916 53 307 173 3146 3 476 173 1662 76 798 173 1909 66 846 874 2664 39 476 874 310 3 27 1162 874 70 476 1162 3372 78 297 1162 4154 48 309 2576 3135 45 476 2576 1697 49 44 2664 4542 65 476 2664 3597 41 984 3135 4625 37 476 3135 1162 68 476 3135 4061 45 687 3135 448 33 998 3146 4161 44 476 3146 4004 100 869 4161 2576 35 476 4161 3684 68 389 174 3749 37 692 174 648 81 995 1115 4291 58 692 1115 651 93 580 1115 1010 15 590 2362 4390 52 692 2362 4509 24 692 2362 2951 80 384 2362 2630 59 259 3664 4880 68 692 3664 736 32 51 3664 1941 78 792 3749 1115 52 692 3749 3625 28 263 3749 4257 61 52 4291 2362 8 692 4291 4315 98 792 4390 3664 26 692 4390 96 81 366 175 1397 41 334 175 3617 58 252 1397 2585 38 334 1397 3031 92 532 1397 3842 88 45 2281 3473 11 334 2281 1676 8 392 2281 1692 65 60 2585 3986 41 334 2585 4850 68 334 2585 3478 35 115 2744 2281 67 334 2744 1271 47 504 2744 3945 39 205 2937 4604 72 334 2937 3410 77 176 3473 2937 99 334 3473 4767 98 951 3473 2713 37 463 3986 2744 4 334 3986 1060 15 589 176 763 44 426 176 1162 69 174 176 1775 36 536 763 2931 68 426 763 4340 93 254 763 913 66 791 2192 4963 13 426 2192 2310 56 623 2205 2967 4 426 2205 2795 77 389 2775 3542 24 426 2775 1707 98 178 2775 207 58 421 2931 2775 25 426 2931 4955 96 391 2931 658 91 440 2967 2192 97 426 2967 4342 41 273 3542 2205 62 426 3542 4929 61 426 3542 3761 70 771 3542 1640 48 943 177 1645 85 26 177 603 88 814 892 2625 94 26 892 2977 100 844 892 3419 60 435 1645 892 38 26 1645 4589 43 26 1645 3455 97 264 1645 1893 28 360 1956 4360 85 26 1956 1988 64 752 2625 4279 71 26 2625 4149 95 262 2625 470 35 946 2954 4671 13 26 2954 657 45 521 2954 4790 96 560 4279 1956 14 26 4279 4354 37 189 4279 3564 92 148 4360 2954 53 26 4360 2037 22 125 178 3808 67 71 178 1550 50 992 1447 4549 5 71 1447 4703 97 71 1447 4775 44 551 1447 4506 22 303 2472 2851 59 71 2472 232 72 775 2851 4385 14 71 2851 4944 77 94 3808 2472 93 71 3808 4641 79 893 3808 867 2 689 4385 1447 28 71 4385 4824 5 413 4385 1984 72 491 179 3687 6 45 179 3045 60 241 179 1887 87 890 1386 3401 50 45 1386 4981 29 45 1386 4034 98 58 1545 2709 51 45 1545 2715 38 360 1545 3227 7 926 2709 3875 72 45 2709 1212 80 603 2709 1553 97 486 3401 1545 41 45 3401 93 2 494 3401 1233 82 261 3687 1386 78 45 3687 1228 63 777 3875 4976 64 45 3875 4608 52 131 180 4366 16 97 180 778 79 317 978 3213 64 97 978 2071 33 507 978 2680 86 161 1146 4173 12 97 1146 862 40 616 1146 1724 75 36 1750 978 94 97 1750 1427 21 100 1750 3950 65 44 2361 1750 61 97 2361 4611 96 97 2361 3365 71 949 2361 4782 88 499 3201 4916 54 97 3201 4342 15 740 3201 2133 2 318 3213 1146 50 97 3213 1701 13 195 3213 1376 82 531 4173 3201 31 97 4173 4514 60 684 4173 4200 8 225 4366 2361 49 97 4366 416 74 668 4366 4407 50 424 181 1624 100 619 181 4493 3 842 181 3159 43 138 698 1400 49 619 698 37 66 273 698 906 44 583 1400 4791 11 619 1400 1392 29 229 1624 4082 12 619 1624 3987 60 688 2071 4645 83 619 2071 3756 49 619 2071 2811 63 767 2071 3371 58 625 3756 4474 41 619 3756 4684 30 985 3756 3183 14 369 4082 4178 99 619 4082 330 67 349 4178 2071 32 619 4178 4712 98 133 4474 698 39 619 4474 341 66 475 182 1137 74 803 182 1051 33 749 182 4160 10 103 1137 2881 13 803 1137 3651 81 734 1137 4082 58 906 1506 3819 13 803 1506 2014 66 851 1506 2967 18 223 2501 1506 40 803 2501 2538 6 920 2501 4541 82 424 2721 3717 61 803 2721 4305 32 461 2721 402 22 313 2738 4980 95 803 2738 4799 43 396 2738 3115 97 613 2881 2501 87 803 2881 1100 85 702 2973 2721 54 803 2973 4851 58 187 3623 2973 17 803 3623 4549 23 803 3623 3861 95 942 3717 2738 18 803 3717 3553 44 900 3819 3623 90 803 3819 2305 7 798 3819 1700 25 912 183 942 40 236 183 2355 60 227 879 3988 5 236 879 4347 39 953 942 2030 86 236 942 3270 54 729 1204 879 16 236 1204 4906 83 360 1204 2925 4 844 2030 1204 2 236 2030 4694 59 577 2288 2619 61 236 2288 4741 11 236 2288 3085 22 44 2288 1113 82 492 2619 4810 56 236 2619 828 48 925 3988 2288 88 236 3988 778 84 203 3988 633 5 478 184 2639 5 293 184 4235 15 317 184 1643 12 610 1639 4768 22 293 1639 1245 44 635 1639 4439 45 89 1980 3643 88 293 1980 379 88 764 2639 3669 49 293 2639 441 82 528 2639 329 69 484 3643 4386 24 293 3643 1004 96 488 3669 3931 8 293 3669 4260 90 771 3669 4080 30 625 3931 4707 72 293 3931 1980 83 293 3931 1462 40 897 3931 81 58 917 4386 1639 23 293 4386 3052 24 91 185 3085 69 571 185 822 8 423 1540 2320 20 571 1540 3318 64 728 1540 4718 48 284 1636 4608 57 571 1636 4604 13 571 1636 1188 62 169 1742 2804 33 571 1742 925 24 903 1742 1960 63 372 2159 1742 43 571 2159 3213 95 860 2320 1636 15 571 2320 3067 12 549 2390 1540 54 571 2390 3219 86 61 2390 4089 46 602 2804 2390 97 571 2804 1861 64 826 3085 2159 5 571 3085 4476 21 735 186 2448 36 497 186 3572 68 738 1129 1277 28 497 1129 4745 99 118 1277 4880 72 497 1277 2929 95 497 1277 4659 16 253 1633 2184 48 497 1633 4819 10 743 1633 2276 56 763 2184 3649 52 497 2184 823 92 576 2448 1633 65 497 2448 2484 44 522 2448 3462 37 267 2929 3152 63 497 2929 1203 8 387 2929 963 62 984 3152 4578 20 497 3152 888 77 202 3152 2650 11 929 3649 1129 94 497 3649 1169 29 943 3649 3644 97 457 187 2599 68 390 187 446 8 782 187 2558 91 240 935 2346 50 390 935 113 26 881 2285 4328 26 390 2285 2952 74 654 2285 1792 77 301 2346 3758 33 390 2346 4961 95 276 2346 2275 83 478 2599 2285 46 390 2599 160 89 775 3153 4928 3 390 3153 250 93 468 3307 935 61 390 3307 4339 80 931 3307 1942 76 125 3758 3153 30 390 3758 4988 27 390 3758 3486 100 197 3758 4202 83 854 4328 3307 7 390 4328 1555 72 548 4328 44 70 385 188 3559 18 451 188 597 93 255 949 1080 10 451 949 1877 46 211 949 2423 39 250 1080 1739 27 451 1080 49 20 278 1080 780 15 892 1498 3501 100 451 1498 4541 57 451 1498 266 71 16 1498 1136 10 888 1739 1498 91 451 1739 1385 71 747 2017 4798 6 451 2017 3450 53 482 2017 4571 2 920 3490 949 58 451 3490 3951 37 903 3490 3240 88 764 3501 2017 69 451 3501 2400 29 977 3501 3957 52 126 3559 3490 85 451 3559 4500 49 594 189 708 95 545 189 4237 79 784 708 3906 24 545 708 4508 2 545 708 4311 3 854 708 3313 24 733 1974 2123 19 545 1974 3500 21 234 1974 2761 77 854 2123 2446 20 545 2123 4057 13 619 2123 4271 15 199 2426 3966 94 545 2426 3631 25 997 2426 1702 61 890 2446 4822 97 545 2446 3377 1 173 3906 2426 1 545 3906 2461 58 905 3966 1974 15 545 3966 2280 42 282 190 4116 8 524 190 2149 6 569 799 1919 74 524 799 2581 21 131 1591 799 93 524 1591 1192 36 263 1919 3515 76 524 1919 2717 40 511 1919 4008 98 793 2271 4759 88 524 2271 4846 96 524 2271 2784 24 253 2271 3431 80 561 3515 3913 84 524 3515 556 16 860 3913 2271 44 524 3913 4350 100 664 3913 2735 41 586 4116 4404 56 524 4116 205 67 943 4404 1591 70 524 4404 3045 4 607 191 1718 80 27 191 4569 63 388 191 1735 40 299 529 3508 97 27 529 1186 69 4 550 2493 79 27 550 945 35 87 1718 550 52 27 1718 4815 45 116 1740 4949 81 27 1740 203 28 97 1740 3514 74 816 2493 529 1 27 2493 4954 12 27 2493 1971 95 673 3508 1740 6 27 3508 2246 50 977 192 3267 42 402 192 3082 40 585 192 631 37 485 625 4540 94 402 625 4929 49 968 1353 1715 96 402 1353 1289 85 137 1695 4402 22 402 1695 3701 55 769 1715 4892 37 402 1715 2136 5 402 1715 4391 34 497 1715 4013 93 67 2136 1695 52 402 2136 3599 79 278 2136 243 32 885 2907 625 65 402 2907 2107 37 151 2907 3797 60 222 3267 3694 68 402 3267 1568 92 650 3694 1353 54 402 3694 4959 56 311 3694 4443 27 74 4402 2907 55 402 4402 250 50 394 193 730 97 468 193 4684 70 965 599 3532 10 468 599 3962 5 10 730 2570 63 468 730 4633 10 201 730 4033 38 991 1132 1930 58 468 1132 3687 24 525 1209 1132 70 468 1209 3351 57 278 1930 2450 7 468 1930 2914 38 791 1930 3853 41 420 2450 4954 70 468 2450 2052 5 518 2450 3252 92 845 2570 599 28 468 2570 4183 52 25 3532 1209 8 468 3532 4845 37 468 3532 1343 31 636 194 3540 60 721 194 3544 97 123 194 3036 63 566 570 2612 56 721 570 4479 98 16 570 3850 51 843 921 4833 11 721 921 1927 17 721 921 1565 50 441 1246 570 64 721 1246 2014 23 115 1246 1890 19 365 1682 2104 73 721 1682 2920 64 853 1927 4463 63 721 1927 4364 66 578 2104 1246 94 721 2104 4501 95 780 2104 4783 79 849 2612 4745 5 721 2612 167 22 568 2768 921 26 721 2768 450 38 135 2768 4139 40 253 3540 2768 48 721 3540 1320 2 63 3540 3259 5 568 4024 1682 87 721 4024 960 2 541 4463 4024 29 721 4463 1106 23 799 195 2711 36 497 195 3230 87 843 794 2545 25 497 794 295 9 192 1716 3597 84 497 1716 3373 44 812 2218 1716 63 497 2218 4578 8 993 2545 4227 2 497 2545 1233 64 931 2545 959 3 459 2587 2218 77 497 2587 4256 29 335 2711 794 60 497 2711 3525 85 764 3320 4687 33 497 3320 3378 18 497 3320 3381 58 423 3320 1556 10 109 3378 4987 36 497 3378 3623 94 702 3378 4903 2 613 3597 3320 26 497 3597 689 70 946 3597 2743 60 715 4227 2587 47 497 4227 4508 20 429 196 2108 41 584 196 340 61 440 196 179 7 603 1414 2919 93 584 1414 4394 50 863 1477 1414 1 584 1477 1630 32 81 1505 4984 37 584 1505 4694 97 584 1505 1176 37 268 1596 1477 96 584 1596 1394 76 267 1596 1046 55 775 2108 1596 18 584 2108 2935 22 71 2108 1895 40 39 2919 1505 10 584 2919 4841 45 932 2919 1614 55 327 197 3865 30 630 197 2580 77 448 719 4078 2 630 719 4869 43 630 719 3557 77 839 846 3600 45 630 846 4965 47 829 1435 2272 22 630 1435 3803 51 333 1803 1435 38 630 1803 2101 56 632 1803 565 69 632 2272 719 19 630 2272 3553 62 225 3600 4939 80 630 3600 3189 53 642 3865 1803 85 630 3865 2297 5 556 4078 846 11 630 4078 3392 55 136 4078 4389 36 238 198 1775 78 755 198 122 43 937 198 968 64 773 1330 3477 53 755 1330 2669 76 518 1330 4415 93 652 1775 4475 18 755 1775 3869 78 937 2662 3414 14 755 2662 1188 86 17 3414 1330 30 755 3414 2945 21 403 3414 1211 24 259 3477 4309 44 755 3477 4590 19 755 3477 80 25 235 3477 3222 74 669 3609 3630 62 755 3609 523 62 320 3609 2263 58 864 3630 2662 99 755 3630 3389 47 676 4309 4792 93 755 4309 1649 93 583 4309 270 31 386 4475 3609 49 755 4475 47 13 292 199 1295 52 308 199 2003 14 893 199 4091 44 551 1295 3424 9 308 1295 3754 89 668 1722 3357 44 308 1722 1572 3 931 2691 1722 73 308 2691 155 60 613 3357 4535 9 308 3357 3410 29 595 3407 2691 26 308 3407 1558 18 647 3407 463 69 651 3424 3407 92 308 3424 4957 84 308 3424 1850 65 27 3424 3258 43 272 200 4337 27 853 200 3348 82 747 943 4259 58 853 943 1484 98 695 1433 4066 19 853 1433 2212 20 522 2708 3291 3 853 2708 3517 82 868 2708 4620 11 917 3291 4176 45 853 3291 2920 3 486 3300 943 97 853 3300 172 4 899 3300 3999 85 450 3770 1433 57 853 3770 1800 84 918 3770 4044 94 510 4066 4863 96 853 4066 2745 93 593 4176 3770 30 853 4176 2159 38 412 4176 2898 47 669 4259 2708 19 853 4259 4742 16 853 4259 4599 22 676 4337 3300 25 853 4337 2383 51 80 201 3928 96 1693 201 4850 64 110 201 811 33 652 744 2455 38 1693 744 4007 36 753 1006 4516 83 1693 1006 4946 98 1693 1006 716 21 22 1893 4415 21 1693 1893 1070 45 729 2455 1893 15 1693 2455 4568 78 516 2455 4546 53 848 3928 744 47 1693 3928 1142 100 711 3928 944 29 401 4415 1006 88 1693 4415 1909 39 790 202 1955 66 1352 202 3407 45 665 202 2568 31 708 731 3421 26 1352 731 3 66 673 1764 731 97 1352 1764 4988 63 1352 1764 24 97 799 1955 2872 78 1352 1955 2330 50 263 2872 1764 60 1352 2872 4006 81 328 3050 4625 23 1352 3050 3838 73 932 3050 4545 56 794 3421 3951 19 1352 3421 4602 12 84 3951 3050 71 1352 3951 3775 76 125 203 3736 26 224 203 4225 99 405 203 4158 27 165 1806 2963 53 224 1806 1585 31 575 1806 4029 9 571 2800 3845 41 224 2800 854 28 904 2800 1961 2 341 2963 4839 91 224 2963 2800 9 224 2963 4641 81 4 3736 1806 99 224 3736 2942 50 728 3736 3037 50 374 3845 4755 26 224 3845 1338 33 894 3845 4345 46 885 204 2922 36 247 204 170 65 462 856 1992 99 247 856 1724 63 628 856 3776 23 178 871 998 46 247 871 3734 45 442 871 4449 25 557 998 3352 85 247 998 4770 42 148 998 164 19 316 1409 871 84 247 1409 2782 98 993 1547 4938 46 247 1547 4511 44 247 1547 2833 9 149 1986 2384 65 247 1986 3249 53 198 1992 1409 30 247 1992 2270 50 737 2384 1547 44 247 2384 2009 58 799 2922 856 81 247 2922 3810 15 517 2922 4178 86 906 3352 1986 54 247 3352 4995 55 31 3352 1840 31 510 205 1238 2 688 205 3823 58 369 1084 2701 42 688 1084 1645 1 855 1238 1084 70 688 1238 1789 29 371 2236 4659 36 688 2236 3472 95 587 2701 2943 6 688 2701 2551 3 392 2943 3006 49 688 2943 4369 70 996 3006 4445 84 688 3006 4538 55 688 3006 2708 52 192 3006 4497 84 223 4257 2236 20 688 4257 2776 56 248 4445 4257 21 688 4445 2834 90 689 206 3883 22 585 206 2943 10 322 551 2261 61 585 551 1742 34 649 601 2988 71 585 601 4949 66 585 601 1046 71 709 743 4212 62 585 743 934 34 725 2261 2867 7 585 2261 590 87 320 2867 601 42 585 2867 4725 55 997 2867 4892 13 362 2988 4642 73 585 2988 3793 44 80 3883 743 69 585 3883 802 72 370 3883 640 34 337 4212 551 51 585 4212 306 54 262 4212 1788 47 358 207 1327 25 334 207 1665 68 196 207 4224 73 311 1180 4253 32 334 1180 2630 90 327 1180 1749 15 155 1327 3233 33 334 1327 3285 54 811 1807 4531 15 334 1807 4180 38 334 1807 1990 33 347 3233 1180 68 334 3233 1631 26 315 3233 1890 50 861 4180 4672 3 334 4180 4800 6 76 4253 1807 78 334 4253 3433 27 789 4253 227 70 250 208 3041 6 526 208 2741 31 541 948 1399 92 526 948 3297 12 404 1159 3170 80 526 1159 2227 65 562 1159 692 5 340 1399 1159 3 526 1399 645 88 275 1877 4267 58 526 1877 2102 20 65 1877 163 3 274 2224 3907 63 526 2224 4084 2 285 3041 4662 34 526 3041 948 99 526 3041 4624 28 204 3170 1877 25 526 3170 3010 50 638 3170 502 10 271 3907 4914 90 526 3907 671 80 198 4267 2224 38 526 4267 4064 43 399 209 3971 39 399 209 4521 6 462 209 1163 79 548 1196 2812 4 399 1196 1855 2 499 1631 1196 8 399 1631 4274 100 383 1631 147 82 410 2000 4591 6 399 2000 4391 60 528 2812 2000 2 399 2812 4776 36 668 2812 3753 76 204 2833 1631 43 399 2833 4655 28 399 2833 4347 53 594 3971 2833 84 399 3971 1341 88 559 3971 3517 18 264 210 657 62 270 210 4827 16 359 657 3614 57 270 657 3216 95 65 767 4561 33 270 767 526 32 697 767 3044 92 989 1391 2980 11 270 1391 1113 31 62 1391 191 88 921 2980 3031 95 270 2980 4196 77 834 2980 1503 18 969 3031 767 34 270 3031 4934 32 681 3031 2102 71 85 3614 1391 47 270 3614 4734 84 270 3614 1122 18 786 211 3937 30 826 211 1230 12 252 574 2295 60 826 574 2625 84 714 1093 2355 41 826 1093 1048 89 335 1470 3453 46 826 1470 287 99 24 1470 746 83 422 1827 2293 23 826 1827 1541 6 597 2293 574 59 826 2293 1908 53 2 2293 722 9 687 2295 3534 19 826 2295 4355 72 133 2355 1827 34 826 2355 2583 94 775 3453 3622 45 826 3453 4355 58 640 3453 2875 72 205 3534 1470 72 826 3534 655 42 220 3622 3763 98 826 3622 3519 11 886 3763 4858 53 826 3763 4782 12 826 3763 4639 50 826 3763 2261 51 559 3937 1093 41 826 3937 2660 34 399 212 2559 42 150 212 1109 57 697 212 925 25 918 1786 4103 59 150 1786 4648 19 150 1786 3409 86 986 1786 2634 46 809 2157 2301 13 150 2157 4851 54 381 2157 2703 36 606 2301 3510 56 150 2301 3545 39 537 2301 1617 27 597 2559 3836 94 150 2559 2738 21 967 2559 1075 34 313 2776 1786 99 150 2776 3155 67 825 3510 2776 4 150 3510 2494 40 519 3510 4861 74 874 3836 2157 48 150 3836 3720 26 219 3836 1336 21 406 4103 4852 80 150 4103 806 93 360 213 4099 5 472 213 170 28 197 855 2822 45 472 855 1828 52 885 855 3707 5 728 934 3432 55 472 934 1882 20 958 934 1371 57 543 1028 1970 51 472 1028 2403 26 477 1028 143 75 173 1374 1028 13 472 1374 3507 24 711 1374 836 95 291 1970 4629 53 472 1970 2478 43 94 2822 4672 50 472 2822 934 45 472 2822 2410 49 984 2822 4399 37 462 3078 855 96 472 3078 591 97 679 3078 3812 4 702 3432 1374 79 472 3432 4976 10 400 3432 4085 30 973 4027 3078 17 472 4027 3276 39 758 4027 3232 47 341 4099 4027 35 472 4099 719 78 784 214 4034 81 545 214 589 87 380 214 3758 18 932 887 3544 96 545 887 4130 15 773 952 887 29 545 952 303 70 556 952 1367 44 405 1097 1110 35 545 1097 849 1 261 1110 952 58 545 1110 2489 92 389 1110 901 16 298 1829 4807 12 545 1829 3118 81 506 1829 3107 85 98 3544 1829 33 545 3544 4834 61 545 3544 3117 86 942 4034 1097 52 545 4034 1089 23 147 4034 1889 61 347 215 2045 57 275 215 4995 30 86 215 4506 78 342 1487 4896 3 275 1487 4984 3 275 1487 126 64 185 1487 2774 67 918 1578 1487 7 275 1578 1786 5 649 1828 3464 26 275 1828 2898 52 50 1828 898 90 22 2045 1828 99 275 2045 4782 28 170 2045 4018 85 940 3464 4136 92 275 3464 2447 8 322 3464 153 63 518 4136 4459 72 275 4136 829 87 582 4136 1426 44 24 4459 1578 70 275 4459 1762 29 331 4459 4683 57 128 216 2403 42 732 216 3159 72 244 1404 2801 7 732 1404 2272 81 949 1404 4511 64 231 2321 3049 42 732 2321 4547 90 732 2321 825 45 831 2403 2321 77 732 2403 2438 59 506 2561 1404 39 732 2561 1430 48 416 2801 4810 86 732 2801 361 64 481 2801 1073 6 554 3049 3084 48 732 3049 3652 35 509 3084 2561 95 732 3084 2578 40 882 3084 2549 74 152 217 1816 78 675 217 3882 43 533 217 4007 33 252 917 4725 98 675 917 2612 60 906 1500 4433 70 675 1500 2298 16 126 1500 3395 42 166 1689 917 73 675 1689 4090 66 389 1816 3219 41 675 1816 4951 4 618 1816 2436 41 41 3219 1500 45 675 3219 2162 41 66 3329 1689 85 675 3329 2603 47 498 3329 3829 91 424 3635 3329 8 675 3635 4752 88 675 3635 2550 9 917 4433 3635 55 675 4433 1716 24 356 218 1088 25 351 218 3638 76 823 1016 3788 62 351 1016 1467 18 355 1016 972 78 194 1088 3288 71 351 1088 4996 91 351 1088 3287 18 920 2859 2861 91 351 2859 2429 57 418 2861 1016 61 351 2861 2172 85 949 3288 3593 68 351 3288 2625 6 640 3593 2859 35 351 3593 1702 38 610 3593 3730 78 168 3788 4882 21 351 3788 4861 20 144 219 4155 26 897 219 1102 33 424 219 4317 95 782 565 2360 36 897 565 2052 88 122 565 459 55 710 1593 2659 45 897 1593 4030 6 634 1593 4410 50 906 2325 4469 91 897 2325 3794 14 307 2360 4609 54 897 2360 4501 16 664 2360 923 86 249 2462 2325 78 897 2462 148 17 585 2659 565 20 897 2659 4645 19 897 2659 2946 74 983 4155 2462 86 897 4155 3746 30 334 4469 1593 5 897 4469 1841 85 596 4469 1428 12 661 220 3294 60 572 220 1290 17 806 516 929 32 572 516 4103 29 843 516 1995 62 622 724 2163 87 572 724 1676 34 862 839 1116 65 572 839 3193 33 768 929 4910 45 572 929 3531 23 572 929 91 43 982 929 3490 32 48 1012 724 75 572 1012 4315 75 551 1012 2168 49 318 1116 1165 10 572 1116 4030 36 767 1165 1012 20 572 1165 757 24 457 1165 1304 2 259 2163 516 94 572 2163 3775 32 594 3294 839 80 572 3294 4547 38 476 3531 4759 22 572 3531 13 21 67 221 4235 56 270 221 2474 31 10 1627 3306 42 270 1627 3943 17 173 1627 4681 17 152 3306 4714 6 270 3306 1392 93 78 3306 4969 10 560 3328 4070 89 270 3328 3611 14 278 3328 650 5 157 4070 4418 85 270 4070 4983 8 270 4070 1841 82 312 4235 3328 57 270 4235 3358 35 171 4418 1627 48 270 4418 777 2 296 4418 3631 72 207 222 926 76 68 222 3995 35 917 926 4023 41 68 926 339 5 207 1957 4889 6 68 1957 4456 48 68 1957 4433 67 895 1957 3965 87 124 2036 3434 24 68 2036 674 22 444 2036 2825 20 611 3269 1957 20 68 3269 2400 19 548 3269 4469 78 847 3434 4694 7 68 3434 2473 36 312 3990 3269 55 68 3990 714 45 883 4023 3990 76 68 4023 364 29 326 4456 2036 53 68 4456 1976 21 579 223 2684 83 843 223 3028 91 829 648 3373 3 843 648 3209 81 596 648 995 45 563 1198 4958 63 843 1198 439 78 645 1198 775 32 248 1479 3688 45 843 1479 763 70 78 2684 648 40 843 2684 4535 99 940 2684 224 24 399 3045 3815 22 843 3045 4400 41 663 3373 3045 12 843 3373 201 84 981 3688 1198 53 843 3688 4177 66 193 3815 1479 86 843 3815 4694 89 843 3815 224 21 990 224 4319 50 352 224 595 28 950 1027 4958 53 352 1027 2502 15 148 2080 4950 17 352 2080 3341 73 352 2080 1422 35 263 2999 1027 82 352 2999 3991 45 384 3268 4045 44 352 3268 1148 75 342 3341 2999 45 352 3341 3744 92 284 3341 1419 22 999 4045 2080 17 352 4045 3774 44 812 4319 3268 10 352 4319 149 56 764 225 2644 8 395 225 3812 66 308 225 4158 26 410 1650 4685 1 395 1650 147 61 75 1880 1650 99 395 1880 3521 60 810 1880 2599 44 884 2424 3780 97 395 2424 905 49 735 2631 1880 93 395 2631 2462 56 339 2631 4630 65 682 2644 2808 65 395 2644 1033 39 4 2808 2424 96 395 2808 3638 54 1000 2808 556 75 149 3780 2631 100 395 3780 4609 33 395 3780 3862 41 507 226 1902 77 584 226 3564 41 863 745 4834 34 584 745 2704 61 142 817 4348 42 584 817 3488 85 435 873 2464 70 584 873 3897 15 237 873 1995 98 784 1561 817 67 584 1561 4667 88 528 1561 2742 7 74 1902 2588 56 584 1902 3248 99 77 2131 873 76 584 2131 3075 70 433 2464 745 29 584 2464 816 39 843 2464 2792 68 969 2588 1561 16 584 2588 4830 58 584 2588 1558 83 85 2588 3467 11 77 3525 2131 68 584 3525 1326 56 874 4348 3525 14 584 4348 72 10 876 227 3681 74 192 227 869 51 79 227 3365 57 384 2129 3116 94 192 2129 4914 10 192 2129 1700 6 349 2924 4531 66 192 2924 731 49 246 2924 3473 34 379 3116 3263 45 192 3116 2171 92 626 3116 2063 92 314 3263 2924 2 192 3263 3985 47 224 3276 2129 25 192 3276 2599 11 373 3276 4340 27 114 3681 3276 70 192 3681 1911 70 346 228 4230 43 379 228 4758 69 289 980 3193 58 379 980 4941 1 411 1291 1691 94 379 1291 4118 26 567 1691 2440 65 379 1691 4059 28 567 1691 1466 25 912 2276 3639 95 379 2276 2621 6 544 2276 2569 12 675 2440 3840 92 379 2440 4665 84 270 3193 2276 97 379 3193 2846 42 329 3639 1291 23 379 3639 4752 22 379 3639 3099 28 273 3639 2609 34 87 3840 4869 86 379 3840 3047 99 97 4230 980 89 379 4230 2500 82 415 4230 1724 36 97 229 2699 38 325 229 1075 86 358 229 4133 13 241 802 1611 95 325 802 1836 82 795 802 2372 67 499 851 802 6 325 851 465 28 778 851 3706 96 489 976 4869 18 325 976 1176 7 615 1611 976 70 325 1611 3777 31 957 1611 2416 2 153 2699 3456 2 325 2699 4523 16 325 2699 3671 12 541 3456 3463 82 325 3456 1624 47 446 3463 851 12 325 3463 4847 35 790 230 1951 64 843 230 3913 77 339 230 2007 75 435 1141 4009 39 843 1141 3344 17 486 1951 4189 76 843 1951 4667 87 469 1951 1986 7 91 2051 4146 79 843 2051 23 52 847 2621 4591 76 843 2621 3745 42 843 2621 963 10 62 2621 2814 46 330 3745 2051 69 843 3745 792 28 186 4009 2621 11 843 4009 4668 9 504 4146 4516 79 843 4146 4982 33 698 4146 3194 59 857 4186 1141 70 843 4186 3961 62 368 4186 3096 27 203 4189 4186 88 843 4189 109 72 372 4189 29 1 879 231 3218 45 105 231 1169 10 240 800 1935 56 105 800 4842 55 422 969 3784 86 105 969 3984 40 624 969 3992 82 723 1413 969 71 105 1413 4893 30 105 1413 4804 52 900 1935 2624 3 105 1935 3491 58 310 1935 2448 66 135 2624 3899 21 105 2624 3850 75 431 3218 800 80 105 3218 3875 17 609 3218 4677 48 546 3784 4684 93 105 3784 3221 97 654 3899 1413 88 105 3899 820 52 691 3899 4188 32 334 232 584 79 978 232 4487 51 377 232 4489 1 635 584 4294 24 978 584 1737 10 296 584 365 68 681 1140 3511 9 978 1140 420 46 760 1140 4568 53 906 2406 4580 17 978 2406 1350 59 100 2995 3985 51 978 2995 454 96 341 3511 2406 39 978 3511 2303 77 17 3511 2541 99 929 3985 1140 91 978 3985 1181 51 627 4231 4701 62 978 4231 2995 100 978 4231 645 28 383 4294 4231 81 978 4294 617 1 181 233 1049 41 446 233 1268 51 975 233 4940 71 383 968 3140 48 446 968 2661 72 988 1049 968 11 446 1049 1609 71 898 1049 929 83 152 3140 4297 26 446 3140 2279 88 626 3140 1332 31 655 3159 4600 44 446 3159 454 31 676 3159 903 44 82 3765 4164 74 446 3765 1284 38 137 3765 2646 56 354 4164 3159 86 446 4164 4194 50 465 4164 4466 40 967 4297 3765 74 446 4297 4782 77 446 4297 4859 57 499 4297 655 15 548 234 919 67 102 234 1052 46 486 843 3502 52 102 843 2196 75 382 843 3816 28 864 919 3024 19 102 919 4960 75 102 919 4932 69 844 919 2559 48 308 1344 3816 43 102 1344 3427 6 868 1344 3952 86 899 3024 3230 18 102 3024 234 21 10 3230 843 1 102 3230 676 13 158 3502 1344 55 102 3502 4769 47 974 3502 3338 60 390 3816 4755 3 102 3816 488 21 923 3816 3060 68 645 235 967 73 315 235 1606 40 290 967 1926 25 315 967 4187 63 219 1297 2700 10 315 1297 1854 31 692 1926 4085 80 315 1926 4475 57 424 2202 3278 93 315 2202 4149 41 510 2202 2195 12 35 2315 3661 53 315 2315 1941 69 271 2315 102 49 98 2560 4800 10 315 2560 4513 78 932 2560 3963 60 765 2700 2315 62 315 2700 1458 47 718 2700 1693 86 676 3278 2560 79 315 3278 3371 87 814 3278 1175 17 372 3661 2202 22 315 3661 3866 100 866 4085 4709 86 315 4085 4144 26 315 4085 1701 21 391 4085 2212 73 159 4144 1297 5 315 4144 3706 11 412 4144 2030 55 859 236 3740 51 368 236 262 54 438 236 1060 11 657 902 4715 94 368 902 844 22 566 2398 3634 49 368 2398 4129 88 593 2398 4652 53 61 2418 2398 63 368 2418 4581 22 303 2418 3563 69 5 3634 4312 26 368 3634 4753 65 368 3634 1090 41 998 3634 3367 42 43 3740 2418 99 368 3740 1383 72 457 4312 902 72 368 4312 3703 27 877 4312 1296 92 248 237 4000 14 293 237 207 44 707 695 4543 75 293 695 2375 78 712 2647 695 93 293 2647 1338 52 846 3706 4220 25 293 3706 3675 71 715 4000 3706 35 293 4000 1207 94 630 4220 2647 9 293 4220 4596 13 293 4220 4513 52 513 4220 3485 80 503 238 1029 91 391 238 2508 29 331 1029 4062 62 391 1029 1888 23 744 1029 2913 96 728 1424 3296 49 391 1424 2785 1 48 1628 1424 57 391 1628 727 98 739 1628 2940 34 614 1632 1628 42 391 1632 2664 5 765 1632 4902 97 487 1765 1632 13 391 1765 4575 100 391 1765 392 33 23 1765 2822 16 138 3296 4744 71 391 3296 4909 47 229 4062 1765 65 391 4062 3630 14 464 4062 3551 52 979 239 2048 81 816 239 3523 29 323 239 3648 52 672 870 3828 3 816 870 260 63 412 1674 2533 52 816 1674 4656 40 816 1674 2651 72 889 2048 4108 73 816 2048 2066 67 593 2048 884 70 414 2533 4975 86 816 2533 4483 85 815 2533 2116 64 985 3828 1674 24 816 3828 2613 20 823 4108 870 80 816 4108 2387 18 842 4108 458 41 904 240 3888 76 456 240 785 17 496 2185 3761 12 456 2185 3305 38 618 2928 4363 35 456 2928 2584 30 245 2928 4534 88 605 3132 2928 78 456 3132 922 86 105 3292 3132 9 456 3292 3590 32 710 3292 3400 9 615 3761 4838 63 456 3761 447 89 295 3888 4387 66 456 3888 219 95 714 4363 2185 25 456 4363 4045 78 222 4363 4473 100 515 4387 3292 46 456 4387 4930 25 456 4387 588 63 106 4387 671 79 94 241 1821 98 490 241 3717 33 386 241 846 2 129 1521 3345 28 490 1521 1633 29 436 1821 3558 42 490 1821 4863 17 827 1821 569 81 799 2274 1521 2 490 2274 1292 44 612 2274 4498 94 162 2515 2274 28 490 2515 1960 64 998 2515 2100 50 674 3345 3839 54 490 3345 4757 63 490 3345 3654 54 14 3345 1077 54 30 3558 4430 84 490 3558 2860 92 510 3558 1275 35 31 3839 4826 51 490 3839 4845 80 887 4430 2515 8 490 4430 493 39 763 4430 4019 23 825 242 2763 32 123 242 4406 3 318 877 3253 58 123 877 2018 60 918 1156 2088 73 123 1156 690 88 207 1156 4044 69 214 2088 4506 15 123 2088 4980 20 553 2088 2879 97 802 2465 877 72 123 2465 2351 6 454 2763 4083 40 123 2763 134 39 244 2883 1156 63 123 2883 3338 95 971 3253 3261 26 123 3253 4824 23 388 3261 4854 29 123 3261 2883 38 123 3261 1749 57 109 4083 2465 37 123 4083 4978 82 739 243 2220 42 146 243 3109 80 592 1559 1598 61 146 1559 4731 56 146 1559 2661 79 898 1576 4353 42 146 1576 1737 33 725 1576 3522 97 16 1598 1790 32 146 1598 1477 51 912 1598 4910 91 619 1668 2650 8 146 1668 4523 88 619 1790 1576 70 146 1790 1246 48 437 2220 1559 58 146 2220 2181 39 307 2220 3102 25 699 2650 4900 33 146 2650 2016 60 449 4353 1668 86 146 4353 3998 36 407 4353 4196 9 891 244 1641 63 498 244 2800 83 498 1017 1142 7 498 1017 1641 39 673 1142 2871 46 498 1142 1842 43 509 1395 1871 85 498 1395 3358 48 374 1641 1395 51 498 1641 178 86 552 1641 246 94 68 1728 2453 67 498 1728 4600 15 498 1728 1819 92 887 1871 1728 85 498 1871 3504 26 742 1871 980 5 979 2453 2786 97 498 2453 4099 20 987 2786 1017 41 498 2786 3790 86 654 2871 3016 85 498 2871 2740 100 566 2871 4614 78 863 3016 4741 25 498 3016 1142 23 1 3016 1952 88 220 245 883 76 595 245 225 23 134 245 2882 11 774 883 4152 64 595 883 239 85 961 883 3565 68 303 1383 3054 17 595 1383 878 55 231 1867 2143 21 595 1867 1903 22 630 2143 3799 3 595 2143 1249 13 75 3054 1867 100 595 3054 1521 16 341 3054 2723 3 951 3187 4102 30 595 3187 4831 48 595 3187 2597 29 967 3799 3187 88 595 3799 903 92 967 4063 1383 6 595 4063 3342 79 268 4102 4758 41 595 4102 538 24 983 4152 4063 42 595 4152 4943 44 543 246 787 61 229 246 890 65 56 246 105 91 685 787 4802 58 229 787 1768 36 229 787 3448 21 708 787 4336 5 610 1768 3270 72 229 1768 4574 75 371 1768 2262 50 20 1791 3940 58 229 1791 454 12 821 1791 4757 7 891 2228 3471 67 229 2228 3701 59 342 2228 4174 77 661 2327 4938 59 229 2327 449 25 381 2327 2620 58 775 2726 2327 97 229 2726 4333 68 345 2726 1496 88 203 3270 1791 22 229 3270 1048 66 15 3270 4979 76 859 3471 2726 38 229 3471 22 65 757 3940 2228 37 229 3940 1375 2 568 3940 4938 48 712 247 1693 57 761 247 3380 75 857 572 1961 27 761 572 4465 82 591 600 4953 14 761 600 1579 70 85 600 2345 2 664 1510 572 59 761 1510 4960 58 761 1510 582 51 594 1693 4096 24 761 1693 77 80 364 1693 3189 59 678 1961 4369 44 761 1961 2554 15 250 1961 966 11 485 1995 600 81 761 1995 1855 16 555 4096 4371 99 761 4096 1349 33 528 4369 1995 50 761 4369 4193 75 15 4369 1503 89 467 4371 1510 1 761 4371 260 11 275 248 3495 8 520 248 2414 85 388 631 915 29 520 631 3825 15 996 631 581 57 893 915 1848 82 520 915 1432 35 413 915 1939 54 969 1131 2986 9 520 1131 2642 31 246 1825 1936 51 520 1825 3859 49 493 1848 1131 83 520 1848 4183 12 646 1936 4671 83 520 1936 4734 75 520 1936 4903 58 636 2986 3379 20 520 2986 3404 4 514 3379 1825 21 520 3379 2725 5 372 3495 631 65 520 3495 4059 46 287 3495 2822 50 82 249 1179 60 1198 249 3700 41 737 249 546 77 643 931 2863 6 1198 931 4928 57 71 1179 2194 22 1198 1179 4774 41 1198 1179 1580 38 23 1563 4763 32 1198 1563 3557 2 595 2194 4482 11 1198 2194 4564 42 483 2194 150 99 907 2430 1563 66 1198 2430 3450 54 107 2863 2430 95 1198 2863 3873 66 699 4482 931 80 1198 4482 1783 5 784 4482 4806 12 928 250 1462 3 463 250 3952 14 483 1462 2920 60 463 1462 1796 22 350 1462 292 45 159 1504 4440 73 463 1504 1263 43 579 1504 1893 26 504 1813 4538 45 463 1813 1504 12 463 1813 2903 25 804 2118 4788 73 463 2118 2368 23 210 2920 4194 16 463 2920 232 97 843 2920 4620 20 548 3129 1813 49 463 3129 1256 93 524 3129 3955 84 443 3239 3129 30 463 3239 609 23 657 3239 1753 39 769 3438 3239 80 463 3438 4804 45 959 4194 3438 68 463 4194 463 66 719 4194 284 55 478 4440 2118 19 463 4440 4239 79 63 4440 4474 47 149 251 1692 99 497 251 3642 86 285 540 2712 57 497 540 3744 97 474 689 4960 50 497 689 1375 23 363 773 689 26 497 773 2016 94 658 773 2304 74 212 1692 3774 66 497 1692 4795 10 497 1692 2371 82 529 1692 4970 30 217 2339 2593 25 497 2339 2396 15 968 2339 17 90 177 2593 3191 77 497 2593 2271 50 325 2593 3615 19 337 2712 2339 32 497 2712 1823 97 898 2764 773 74 497 2764 581 85 561 2971 540 75 497 2971 1510 54 535 2971 1054 73 322 3070 4657 28 497 3070 2764 26 497 3070 4066 6 957 3070 1915 57 42 3191 3070 31 497 3191 4096 29 237 3774 2971 12 497 3774 3399 44 625 252 988 3 529 252 1350 71 463 252 406 95 663 655 3738 26 529 655 2414 14 496 655 3589 21 462 988 2694 45 529 988 4634 13 52 1249 1603 64 529 1249 4532 78 366 1249 1714 30 349 1603 2019 99 529 1603 3494 5 659 2019 655 35 529 2019 1354 51 486 2694 1249 77 529 2694 4587 69 529 2694 26 61 681 2694 1751 52 441 3738 4690 72 529 3738 4684 99 122 3738 4449 66 160 253 1966 92 913 253 636 33 275 761 3025 68 913 761 2291 11 840 761 3077 73 449 1107 4302 36 913 1107 3975 32 617 1966 4316 57 913 1966 1381 3 876 1966 4255 43 44 3025 4476 3 913 3025 930 89 451 3025 3265 37 87 3591 4509 41 913 3591 1200 49 356 3936 3591 34 913 3936 64 7 370 4302 3936 67 913 4302 1432 69 901 4302 3987 28 642 4316 761 29 913 4316 4314 30 398 4476 1107 82 913 4476 4620 60 913 4476 2452 90 346 4476 4972 15 576 254 3083 62 543 254 1824 56 746 2132 2554 3 543 2132 3771 91 141 2132 1444 12 260 2487 2132 61 543 2487 3435 69 394 2487 1184 59 982 2554 2978 59 543 2554 2412 6 458 2978 4119 17 543 2978 1069 84 593 3083 2487 20 543 3083 4560 62 543 3083 1102 18 821 3246 4709 85 543 3246 3023 99 115 4119 4175 54 543 4119 1879 63 626 4119 4358 80 159 4175 3246 86 543 4175 183 77 40 4175 1021 6 615 255 4420 20 584 255 133 55 598 255 1365 82 50 878 3265 41 584 878 4899 56 897 1086 1464 15 584 1086 4518 69 319 1464 3752 56 584 1464 1404 52 156 3265 3853 54 584 3265 142 60 476 3265 1668 83 745 3752 878 71 584 3752 4515 8 584 3752 1200 45 36 3752 146 25 796 3853 4809 66 584 3853 2247 6 902 3853 430 6 168 4420 1086 99 584 4420 123 61 439 256 735 9 193 256 4601 44 807 667 1075 69 193 667 3097 69 598 735 4127 18 193 735 3254 15 260 818 4928 90 193 818 54 70 905 818 3718 91 49 1046 3615 70 193 1046 2515 19 995 1046 4769 53 562 1075 2969 37 193 1075 80 13 487 1075 2474 84 780 1733 4532 82 193 1733 818 77 193 1733 2435 31 111 1733 237 82 660 2689 1733 6 193 2689 332 100 44 2969 2689 13 193 2969 2169 53 260 3615 667 43 193 3615 4062 32 593 4127 1046 63 193 4127 2696 59 695 257 1078 91 614 257 1771 8 49 624 4606 92 614 624 4894 25 614 624 2384 28 135 624 4024 86 429 984 2876 82 614 984 3626 18 494 1078 3998 29 614 1078 1700 21 298 1144 984 82 614 1144 4826 90 614 1144 3394 49 832 1144 1250 19 45 1555 1851 15 614 1555 2712 58 685 1555 3117 43 52 1851 4193 85 614 1851 3639 28 780 1851 1469 10 86 2001 624 49 614 2001 2669 94 455 2001 1666 37 137 2823 2001 99 614 2823 4343 12 285 2876 1555 68 614 2876 2253 50 42 3097 1144 93 614 3097 4106 24 527 3998 3097 67 614 3998 2264 59 987 4193 2823 27 614 4193 875 31 147 258 2806 1 449 258 3451 70 110 749 4693 61 449 749 170 22 735 1314 3930 28 449 1314 3492 51 622 1338 2846 93 449 1338 1021 54 37 1338 311 50 698 2148 2938 86 449 2148 1924 72 211 2519 749 21 449 2519 4932 75 449 2519 3877 80 487 2519 3260 25 200 2806 1314 17 449 2806 209 78 442 2846 3535 9 449 2846 1194 77 364 2938 1338 86 449 2938 4949 94 978 3186 4149 52 449 3186 2698 95 580 3535 3186 75 449 3535 1498 47 674 3535 2102 78 41 3930 2148 89 449 3930 757 11 714 3930 4396 54 79 4149 2519 20 449 4149 4512 32 449 4149 3468 70 465 259 3124 22 1 259 2540 61 415 1077 1849 2 1 1077 709 21 480 1077 2337 33 43 1774 1077 85 1 1774 4718 42 255 1849 2816 89 1 1849 4822 78 58 1849 2953 79 223 2571 4593 100 1 2571 4944 23 1 2571 247 13 908 2571 3861 95 277 2816 3403 62 1 2816 2348 17 590 3124 4123 81 1 3124 313 47 419 3403 3878 1 1 3403 4162 92 635 3878 2571 93 1 3878 1809 35 494 3878 1816 69 706 4123 1774 98 1 4123 2126 7 251 260 4183 35 612 260 4784 64 218 260 2371 28 247 727 4916 49 612 727 3764 1 612 727 786 74 368 1478 4538 68 612 1478 4134 36 112 1478 4123 95 548 1557 727 49 612 1557 2208 38 137 3764 3855 89 612 3764 1382 22 451 3855 1478 44 612 3855 1992 10 23 4183 4479 8 612 4183 2116 82 567 4183 1494 97 615 4479 1557 67 612 4479 4161 5 998 261 2642 50 349 261 2663 11 763 530 4761 76 349 530 765 79 464 530 435 26 953 1087 2482 88 349 1087 1405 2 128 1185 530 74 349 1185 296 39 530 1723 1087 80 349 1723 1245 72 864 2213 1723 93 349 2213 4786 87 349 2213 3689 10 1000 2213 3766 94 321 2482 1185 70 349 2482 752 18 694 2642 2213 84 349 2642 632 72 210 2642 3593 69 958 262 1704 100 355 262 323 99 206 716 2242 62 355 716 1520 96 809 891 716 20 355 891 1311 42 163 996 4508 56 355 996 3836 17 654 1704 3697 12 355 1704 1133 47 542 1704 1776 38 305 2242 996 96 355 2242 3935 29 489 2242 59 92 647 3697 891 90 355 3697 4868 42 355 3697 2282 19 679 3697 1858 96 197 263 2844 49 511 263 1082 8 162 1560 1754 74 511 1560 3827 44 186 1560 3266 13 498 1735 2661 71 511 1735 3848 12 598 1754 4419 2 511 1754 4564 67 185 1754 3435 72 647 2191 1560 96 511 2191 1388 58 853 2318 4694 18 511 2318 3744 37 848 2661 4163 89 511 2661 1945 63 641 2844 2961 93 511 2844 2987 10 891 2936 2191 53 511 2936 2432 16 92 2961 1735 85 511 2961 2504 95 159 2961 528 4 612 4163 4668 13 511 4163 2936 13 511 4163 4676 19 338 4163 3896 95 605 4419 2318 55 511 4419 4681 57 185 4419 1112 83 232 264 1878 76 1586 264 1256 87 161 264 1483 80 875 793 1407 61 1586 793 2598 64 263 1290 3642 20 1586 1290 1995 44 697 1290 2662 67 691 1407 4654 83 1586 1407 3645 37 1586 1407 906 37 400 1784 3577 40 1586 1784 829 24 858 1784 958 10 235 1878 793 81 1586 1878 3798 7 375 1878 4843 70 981 3145 4307 45 1586 3145 234 9 587 3214 4790 47 1586 3214 1887 55 168 3214 4544 73 389 3217 4849 2 1586 3217 3145 82 1586 3217 1214 21 628 3577 3217 99 1586 3577 4306 6 683 3642 3214 25 1586 3642 2833 82 116 3645 1784 41 1586 3645 4753 3 338 3645 4609 65 882 4307 1290 85 1586 4307 3244 88 977 265 1316 36 383 265 1788 95 887 815 3380 31 383 815 3446 76 463 815 3126 25 467 1060 3130 40 383 1060 4530 7 383 1060 3372 18 16 1316 4483 24 383 1316 3744 48 349 1461 3915 52 383 1461 1512 28 683 1461 2986 80 785 2474 1461 50 383 2474 2110 86 779 2474 1560 8 769 3130 815 74 383 3130 2717 10 304 3130 4319 45 272 3250 1060 35 383 3250 3377 18 465 3380 2474 84 383 3380 3680 16 704 3380 2304 87 812 3915 4847 90 383 3915 2688 77 791 4483 3250 59 383 4483 3692 94 995 266 619 97 192 266 4688 30 661 266 721 88 832 545 3952 21 192 545 1016 11 733 545 3775 19 335 619 3858 31 192 619 19 92 313 641 3775 13 192 641 3947 33 640 641 3571 25 196 682 641 76 192 682 4735 53 192 682 2994 34 176 682 4822 27 743 1466 545 19 192 1466 1039 11 505 3775 4018 36 192 3775 1162 49 977 3775 3955 16 547 3858 682 26 192 3858 3952 74 106 3858 2446 1 179 3952 4602 30 192 3952 3897 12 683 3952 2477 79 340 4018 1466 27 192 4018 2062 46 231 267 2537 73 92 267 2596 56 656 267 995 80 335 671 3541 29 92 671 1002 21 145 671 3792 67 271 707 3548 30 92 707 3516 74 96 2067 3690 5 92 2067 1516 43 95 2067 1421 46 587 2307 4804 20 92 2307 2699 69 314 2537 4330 25 92 2537 380 37 625 3541 2067 76 92 3541 2008 38 392 3548 2307 91 92 3548 1521 95 124 3690 707 11 92 3690 1371 91 874 4330 671 49 92 4330 4993 87 92 4330 18 57 105 4330 3518 23 750 268 2072 21 842 268 3731 35 216 646 4266 34 842 646 1774 99 816 646 2274 99 220 669 4357 91 842 669 1253 5 633 669 4999 72 364 1167 1371 75 842 1167 1584 82 632 1371 669 94 842 1371 1847 41 905 2072 4564 22 842 2072 4317 46 842 2072 2889 41 18 2072 3822 90 241 4030 4826 62 842 4030 2682 93 578 4266 4030 99 842 4266 285 74 182 4266 732 86 335 4317 1167 14 842 4317 3279 70 497 4357 646 32 842 4357 1454 28 286 4357 3239 71 700 269 4134 58 601 269 395 69 300 269 1841 98 555 1173 2243 23 601 1173 4186 45 221 1173 3505 33 375 1657 3576 15 601 1657 2815 80 39 1666 2925 7 601 1666 616 19 890 2243 4453 52 601 2243 3018 92 967 2243 4568 73 946 2925 4771 12 601 2925 4831 92 160 3249 1173 21 601 3249 2724 86 330 3249 3990 82 449 3576 4996 98 601 3576 4229 90 601 3576 3883 23 774 4134 1657 52 601 4134 3816 44 164 4134 4252 21 75 4229 3249 37 601 4229 1951 73 221 4229 2987 100 953 4453 1666 65 601 4453 4690 22 447 270 1661 83 39 270 1388 93 762 511 4748 15 39 511 1970 100 133 511 4921 34 800 717 2575 92 39 717 3205 3 24 1661 4499 55 39 1661 1889 58 432 2052 511 22 39 2052 4838 74 39 2052 4603 6 239 2052 2116 75 841 2575 2052 93 39 2575 4287 33 684 2609 3216 15 39 2609 2314 89 952 2609 1874 65 23 2820 2609 85 39 2820 2553 11 351 3156 2820 100 39 3156 2083 59 563 3156 1384 47 527 3216 717 87 39 3216 41 70 962 3686 3156 38 39 3686 2431 75 856 4499 3686 96 39 4499 3037 7 960 271 3506 40 276 271 592 88 628 670 2425 99 276 670 171 92 362 670 3738 63 984 914 2299 47 276 914 885 2 50 1706 1947 81 276 1706 1710 54 867 1947 2606 89 276 1947 3419 62 227 1947 3746 63 600 2299 1706 50 276 2299 417 76 890 2425 914 27 276 2425 2974 10 793 2425 4166 48 993 2606 3663 99 276 2606 4743 85 276 2606 4239 38 435 3506 670 56 276 3506 3888 24 914 3506 3747 90 120 3663 4898 19 276 3663 1417 31 839 3663 4095 83 79 272 1467 17 363 272 3815 90 140 715 4113 65 363 715 3382 30 978 1467 1943 75 363 1467 3217 46 820 1467 325 14 910 1830 715 9 363 1830 1366 94 388 1943 1830 59 363 1943 3362 67 497 1943 4006 14 657 2893 4372 62 363 2893 641 51 523 4113 4421 76 363 4113 1072 100 556 4113 4457 21 864 4372 4833 27 363 4372 4718 66 363 4372 843 53 742 4372 3161 60 564 4421 2893 45 363 4421 4721 71 695 273 2634 6 371 273 25 16 547 514 2354 98 371 514 4981 57 803 1460 4803 14 371 1460 1476 8 371 1460 2452 77 21 1460 3766 8 902 1476 514 34 371 1476 3936 94 871 2354 3647 33 371 2354 650 15 649 2634 4015 12 371 2634 1643 95 926 3647 4740 24 371 3647 2340 43 155 4015 1460 3 371 4015 406 75 383 4015 1438 22 362 274 4397 86 53 274 401 96 28 274 3190 20 62 1043 4667 42 53 1043 3026 94 53 1043 3080 78 312 1517 3367 26 53 1517 4209 13 469 1845 3695 69 53 1845 1814 88 369 2761 3683 51 53 2761 4437 83 957 2761 2240 83 25 2934 1845 27 53 2934 4659 33 654 2996 1517 37 53 2996 134 19 287 3026 2934 90 53 3026 1757 2 150 3367 2761 1 53 3367 3308 60 650 3683 4974 14 53 3683 2285 40 932 3683 2165 49 76 3695 2996 3 53 3695 1411 64 402 4397 1043 25 53 4397 1426 11 384 275 3676 9 486 275 484 89 844 275 710 16 357 809 1753 98 486 809 2762 81 236 809 2029 60 335 1062 2566 100 486 1062 3092 100 384 1062 542 97 234 1089 2747 85 486 1089 2321 47 730 1533 3984 45 486 1533 4774 34 538 1753 1757 84 486 1753 3312 50 325 1753 2802 58 824 1757 4548 58 486 1757 4922 25 486 1757 1459 70 630 1757 2124 49 142 1923 1062 28 486 1923 4008 50 684 2566 1089 22 486 2566 2391 49 455 2566 3540 69 938 2747 3127 96 486 2747 1894 25 482 3127 809 51 486 3127 947 43 817 3676 4951 41 486 3676 1533 39 486 3676 2354 25 80 3984 1923 12 486 3984 4794 14 979 3984 2573 21 755 276 993 32 348 276 4462 4 844 276 2644 58 738 993 3358 64 348 993 4715 91 348 993 1460 89 650 993 780 12 726 1261 4147 32 348 1261 2399 18 804 1920 4710 58 348 1920 2118 63 346 3358 1261 41 348 3358 998 19 597 3358 176 80 812 4147 4467 63 348 4147 216 53 938 4467 1920 82 348 4467 1807 85 213 277 4300 31 407 277 1245 51 180 277 3369 82 665 555 3679 75 407 555 977 99 918 555 1190 94 643 1008 4835 82 407 1008 3579 57 407 1008 391 49 376 1558 1008 56 407 1558 3784 54 101 1558 837 34 59 1589 2912 17 407 1589 4505 30 407 1589 2636 7 825 2091 1589 33 407 2091 2921 98 717 2091 4397 76 428 2508 2091 73 407 2508 1568 90 225 2508 1330 10 519 2589 1558 20 407 2589 1010 15 289 2589 1746 31 196 2610 4677 1 407 2610 4553 97 768 2912 2589 54 407 2912 3610 38 361 3579 2610 63 407 3579 2131 90 419 3579 4826 71 345 3679 2508 79 407 3679 984 30 590 4300 555 57 407 4300 1485 61 524 278 4278 77 647 278 1401 73 713 653 1534 75 647 653 350 85 251 653 4765 30 724 1337 1793 32 647 1337 4129 11 1000 1337 2035 49 789 1534 4589 90 647 1534 377 51 83 1534 1798 96 160 1709 4086 32 647 1709 4528 83 647 1709 2496 98 656 1709 2431 31 337 1793 4190 22 647 1793 2343 84 506 3337 1337 39 647 3337 4645 78 74 3337 3263 28 811 4086 3337 25 647 4086 3774 11 363 4086 3148 51 510 4190 653 79 647 4190 823 41 326 4190 3186 14 541 4278 1709 15 647 4278 2290 16 609 4278 2734 20 15 279 674 18 417 279 990 60 282 656 2579 62 417 656 4550 79 613 674 2637 83 417 674 4393 32 984 890 1367 10 417 890 4694 13 116 890 180 90 581 1367 4816 94 417 1367 1819 44 643 2579 4471 7 417 2579 1749 81 578 2637 656 2 417 2637 1634 97 6 3318 4958 38 417 3318 890 28 417 3318 4676 52 509 3318 348 93 572 4471 3318 25 417 4471 859 90 258 280 1745 55 1070 280 665 100 143 1511 4351 76 1070 1511 4406 100 416 1713 3188 55 1070 1713 2292 59 503 1745 2681 32 1070 1745 4765 57 134 2096 3205 92 1070 2096 3670 64 405 2096 1232 87 591 2178 1713 16 1070 2178 3477 98 738 2681 2178 40 1070 2681 2772 92 97 2681 1215 2 631 3188 1511 57 1070 3188 4025 57 438 3205 4504 15 1070 3205 4045 82 301 3205 918 12 850 4351 2096 43 1070 4351 4731 10 1070 4351 879 33 704 281 3422 36 32 281 3113 7 995 1128 2638 73 32 1128 2796 57 795 1128 2739 33 441 2297 1128 1 32 2297 1272 9 373 2297 4313 73 677 2638 2998 24 32 2638 4672 97 32 2638 3345 2 741 2998 4826 86 32 2998 4992 28 459 2998 778 54 273 3422 2297 34 32 3422 4316 64 828 282 811 40 887 282 358 42 739 282 4225 91 164 811 2802 87 887 811 4961 10 887 811 1999 39 523 1673 4512 83 887 1673 3797 37 897 1673 3243 31 184 2353 4131 37 887 2353 344 40 477 2802 3656 34 887 2802 1451 77 733 3656 4321 72 887 3656 4241 78 620 3656 1839 72 668 4131 1673 4 887 4131 264 44 371 4131 4514 38 889 4321 2353 62 887 4321 1474 90 181 283 1257 39 387 283 291 79 733 759 3117 36 387 759 2103 8 191 1117 759 34 387 1117 250 98 899 1257 2486 10 387 1257 4978 53 519 1257 2889 36 507 1484 2811 95 387 1484 4598 24 387 1484 536 28 717 1484 2395 50 218 2027 2120 33 387 2027 1754 49 626 2027 4210 39 815 2120 4004 45 387 2120 4693 64 387 2120 4392 14 719 2120 4282 67 50 2486 1484 92 387 2486 2950 44 490 2811 1117 62 387 2811 1695 51 836 2811 4554 100 539 3117 2027 23 387 3117 3690 64 331 3117 4616 69 638 3813 4909 28 387 3813 2823 18 620 3813 400 7 102 4004 4376 98 387 4004 4894 39 53 4004 202 62 436 4376 3813 44 387 4376 1321 7 719 4376 722 49 502 284 3279 66 339 284 1049 76 96 284 4340 21 904 1683 4413 82 339 1683 358 70 940 2404 4657 93 339 2404 4119 84 245 2404 2343 15 55 2710 2404 70 339 2710 1734 99 531 3279 4251 59 339 3279 3648 2 78 3279 4216 71 485 3493 2710 44 339 3493 3180 86 475 3493 231 48 85 3665 4530 91 339 3665 1683 13 339 3665 4543 1 33 4251 3665 98 339 4251 4918 6 77 4251 1117 75 865 4413 3493 24 339 4413 30 90 955 285 1147 54 882 285 3609 59 774 701 1145 15 882 701 723 8 570 701 1408 22 426 1145 1519 43 882 1145 4057 100 194 1145 548 87 825 1147 701 57 882 1147 481 97 740 1147 2138 55 975 1519 2452 79 882 1519 3952 72 904 2174 3251 99 882 2174 4629 8 882 2174 3033 14 435 2174 3371 27 484 2298 2174 93 882 2298 2277 8 287 2452 2792 61 882 2452 44 74 263 2792 3242 11 882 2792 4986 68 73 3242 2298 69 882 3242 575 61 70 3242 1143 95 169 3251 4684 79 882 3251 769 52 530 286 4303 31 400 286 1041 82 678 286 4841 81 931 1201 1389 26 400 1201 4991 38 739 1375 1201 36 400 1375 693 92 427 1375 2942 83 867 1389 2495 41 400 1389 4698 10 244 1389 2191 4 1000 1548 3487 14 400 1548 4643 19 622 1548 1751 53 133 1875 1548 22 400 1875 4619 2 400 1875 3637 36 808 1875 4168 49 298 2140 1375 63 400 2140 4815 73 899 2495 4856 24 400 2495 584 96 559 3376 1875 76 400 3376 4783 7 604 3376 4847 17 308 3487 2140 77 400 3487 4985 27 799 4249 3376 53 400 4249 193 74 471 4249 757 23 752 4303 4249 25 400 4303 246 32 999 4303 615 83 346 287 4029 78 410 287 3554 14 440 287 2555 91 435 556 848 96 410 556 346 16 358 848 2885 2 410 848 2419 54 950 848 4282 58 342 2447 3435 26 410 2447 1635 73 361 2885 4288 95 410 2885 4731 99 410 2885 3122 52 778 2955 3455 58 410 2955 635 61 866 3435 2955 18 410 3435 1436 23 301 3435 2607 66 435 3455 556 12 410 3455 1407 81 560 4029 2447 39 410 4029 1998 21 430 4029 1302 55 378 4288 4770 38 410 4288 4746 82 508 4288 4401 12 994 288 3125 12 534 288 459 76 866 672 4922 15 534 672 1277 81 793 672 4763 89 982 987 2665 86 534 987 1711 10 101 987 342 98 367 1450 2044 87 534 1450 3110 16 875 1450 1876 48 266 1604 672 97 534 1604 2756 53 181 1604 2836 29 823 1839 4891 36 534 1839 1450 5 534 1839 1511 35 437 1839 4487 66 769 1910 3877 9 534 1910 2454 18 6 1910 581 76 856 2044 1910 67 534 2044 1291 69 229 2044 3589 77 988 2356 3370 39 534 2356 4509 37 534 2356 2916 9 577 2356 4430 53 825 2665 2356 63 534 2665 4856 97 884 3125 987 27 534 3125 1727 39 525 3370 1839 68 534 3370 4911 51 323 3877 1604 16 534 3877 4057 99 534 289 3962 17 932 289 813 60 307 289 2110 6 64 963 4375 56 932 963 727 78 746 963 851 48 212 1051 1592 66 932 1051 4800 84 932 1051 1815 60 826 1501 1741 61 932 1501 755 33 1 1592 4766 10 932 1592 4930 26 288 1592 2554 54 313 1741 963 86 932 1741 1637 41 427 2357 1051 99 932 2357 1858 92 147 2357 3210 51 650 3962 1501 36 932 3962 2318 96 368 4375 2357 92 932 4375 2755 98 537 290 3479 55 367 290 3686 85 78 290 789 95 939 2169 2947 2 367 2169 3409 56 37 2169 3126 10 706 2484 3804 49 367 2484 2673 47 847 2484 1874 42 6 2947 3189 13 367 2947 1148 17 93 2947 4748 8 824 3189 4068 8 367 3189 2915 37 553 3418 4947 24 367 3418 662 42 19 3418 4749 71 440 3479 2484 19 367 3479 4560 66 464 3804 2169 73 367 3804 873 91 72 4068 3418 79 367 4068 4932 83 367 4068 3704 39 422 291 4254 25 747 291 2018 97 145 291 3167 28 629 586 4089 28 747 586 2680 80 816 1569 4961 74 747 1569 4627 3 747 1569 3489 57 724 1569 1398 48 640 2180 586 31 747 2180 4085 84 437 4089 4356 65 747 4089 885 36 740 4254 4491 16 747 4254 3763 61 320 4356 1569 71 747 4356 2586 16 481 4356 3751 39 405 4491 2180 88 747 4491 4221 25 381 4491 1200 27 660 292 3820 76 470 292 64 70 101 292 2612 63 413 537 2085 90 470 537 278 8 749 981 4512 49 470 981 752 77 247 1972 2989 34 470 1972 3900 58 331 1972 4315 3 940 2085 1972 71 470 2085 3232 1 12 2085 202 34 668 2989 981 53 470 2989 4135 61 682 3757 537 16 470 3757 4292 67 853 3757 1098 27 551 3820 3757 58 470 3820 4766 11 470 3820 1722 31 810 293 954 95 202 293 491 83 717 293 2886 91 944 954 997 68 202 954 623 45 134 997 1838 29 202 997 4801 51 93 997 4336 49 925 1013 4789 18 202 1013 3096 2 149 1838 2510 86 202 1838 1039 48 570 2510 4345 6 202 2510 1717 59 320 2510 3246 83 36 4345 1013 8 202 4345 4625 19 202 4345 3274 39 589 4345 69 99 36 294 882 91 680 294 3735 25 561 882 1092 67 680 882 1028 35 544 882 3148 70 142 1044 2720 31 680 1044 432 65 667 1092 4151 26 680 1092 1333 76 145 2720 4846 31 680 2720 3200 20 283 2720 715 13 172 2897 3111 43 680 2897 4506 11 680 2897 1800 80 842 2897 683 63 238 3111 1044 79 680 3111 4679 53 633 3111 1748 9 667 4151 2897 72 680 4151 4794 97 683 4151 1461 68 564 295 4275 9 354 295 4475 29 326 295 4538 33 9 548 2772 85 354 548 2749 9 298 652 4490 5 354 652 3291 96 615 652 3333 98 44 1384 4680 67 354 1384 2504 74 143 1653 2717 18 354 1653 2709 32 139 1653 1969 99 295 1879 652 77 354 1879 2538 13 523 2012 1653 42 354 2012 1954 51 799 2012 70 53 686 2717 1384 100 354 2717 3774 76 676 2772 4542 53 354 2772 4182 31 354 2772 494 34 691 4182 2012 32 354 4182 2517 9 86 4182 4318 69 124 4275 1879 58 354 4275 1207 48 124 4275 1335 36 527 4490 548 3 354 4490 1088 93 174 4490 624 53 600 296 3716 18 730 296 1419 75 781 296 3413 29 623 904 3322 2 730 904 3470 7 967 904 4370 29 230 1229 3518 96 730 1229 3507 48 785 1229 2254 61 593 1509 1815 37 730 1509 4130 41 233 1815 4513 65 730 1815 4748 33 730 1815 4417 73 509 1815 4465 68 761 3322 1229 58 730 3322 2661 12 888 3322 3001 25 653 3496 1509 4 730 3496 6 22 296 3496 943 59 981 3518 4047 43 730 3518 4393 61 719 3518 2245 41 223 3716 904 48 730 3716 1043 52 939 3716 890 30 54 4047 3496 61 730 4047 3144 11 832 297 643 94 451 297 446 100 861 297 2259 99 248 643 3011 2 451 643 1181 75 130 1266 3671 31 451 1266 1769 98 928 1843 1266 8 451 1843 3082 51 994 2381 3262 81 451 2381 4741 4 451 2381 266 34 650 2381 3030 40 664 3011 1843 94 451 3011 1445 49 177 3011 4317 68 567 3262 4669 59 451 3262 4403 36 448 3262 4027 17 748 3671 4185 22 451 3671 30 96 243 4185 2381 52 451 4185 739 85 602 298 3809 36 408 298 35 82 975 298 3738 67 242 1573 4705 12 408 1573 2865 43 408 1573 544 80 308 1945 2189 88 408 1945 3996 55 294 2189 4382 2 408 2189 1085 35 131 2865 3827 49 408 2865 3037 96 33 2865 4242 76 389 3572 4106 55 408 3572 1419 97 426 3572 3004 14 214 3809 1945 6 408 3809 4547 47 508 3809 526 38 447 3827 4518 43 408 3827 4034 2 992 3827 948 62 505 4106 1573 7 408 4106 2372 25 20 4382 3572 48 408 4382 803 91 651 4382 2601 99 880 299 757 33 559 299 4995 33 494 299 200 7 839 757 1520 64 559 757 3872 74 781 757 196 70 475 1307 4588 98 559 1307 301 46 410 1307 327 60 919 1520 2745 88 559 1520 2052 53 562 1520 4721 45 578 2371 4442 56 559 2371 1233 5 567 2371 3728 77 977 2745 3022 95 559 2745 4827 6 702 3022 2371 76 559 3022 4986 2 127 3022 3379 40 36 3529 3861 43 559 3529 4797 87 421 3529 2134 72 96 3551 1307 8 559 3551 3286 42 133 3551 1615 15 931 3861 3551 28 559 3861 2594 16 875 4442 3529 60 559 4442 4613 66 559 4442 3985 57 350 300 2049 20 1159 300 3666 8 114 2049 2240 53 1159 2049 1517 75 435 2240 2813 66 1159 2240 4833 6 1159 2240 2994 31 776 2267 3440 46 1159 2267 3048 64 720 2313 3955 32 1159 2313 3271 20 340 2813 2267 97 1159 2813 4977 43 440 2813 3486 18 484 3440 2313 11 1159 3440 3193 21 243 3440 1393 66 28 3955 4427 84 1159 3955 2747 48 832 4427 4968 83 1159 4427 4157 1 881 4427 2341 67 491 301 812 85 153 301 2132 7 363 301 3919 15 486 812 3517 8 153 812 4266 2 888 1325 3993 96 153 1325 391 85 214 1393 4707 8 153 1393 3068 72 153 1393 743 61 766 1393 3361 78 758 1546 4890 57 153 1546 747 66 755 1546 3799 1 634 2081 1546 41 153 2081 4737 85 217 2081 2481 33 180 2974 2081 89 153 2974 1418 20 816 2974 2758 39 456 3068 2974 89 153 3068 1913 51 304 3068 1230 26 32 3517 1325 93 153 3517 4400 6 28 3993 1393 21 153 3993 2215 88 673 3993 1508 89 420 302 3854 58 260 302 3386 51 514 1714 2539 62 260 1714 3765 28 757 1714 4617 40 426 1897 4157 37 260 1897 3497 35 348 2079 1897 77 260 2079 1715 43 317 2079 2759 59 745 2444 3122 71 260 2444 799 49 653 2473 4979 93 260 2473 2444 8 260 2473 1897 43 734 2473 3072 92 741 2539 2079 87 260 2539 3572 50 76 2539 2673 10 208 3122 1714 23 260 3122 2407 88 538 3122 1287 36 790 3854 2473 94 260 3854 1713 59 614 4084 4429 11 260 4084 268 35 476 4157 4084 65 260 4157 371 67 672 4157 1360 7 112 4429 4781 80 260 4429 2761 59 576 4429 149 29 720 303 1918 48 689 303 4081 42 166 875 1113 57 689 875 1763 79 739 875 851 4 80 1113 1712 3 689 1113 1881 88 142 1712 4661 19 689 1712 3316 96 383 1712 4570 26 291 1918 3053 31 689 1918 3398 76 525 1918 2224 47 701 2086 2210 84 689 2086 1090 3 821 2210 3900 67 689 2210 2756 23 483 3053 2086 28 689 3053 535 27 268 3053 2036 38 319 3900 875 17 689 3900 4666 71 689 3900 2354 19 587 3900 4205 41 235 304 3259 69 914 304 3667 62 7 748 2945 52 914 748 4215 99 428 1854 4503 66 914 1854 3830 17 914 1854 1196 20 840 2004 3109 21 914 2004 4102 24 666 2004 707 43 508 2215 2449 42 914 2215 4391 8 61 2215 2673 6 585 2449 4623 42 914 2449 4376 4 845 2945 1854 1 914 2945 223 35 158 2945 3691 48 140 2946 2004 58 914 2946 1158 76 104 3109 2215 81 914 3109 180 47 601 3109 1092 99 866 3259 4381 9 914 3259 3186 93 305 3830 2946 50 914 3830 1838 11 623 3830 3092 56 794 4381 748 10 914 4381 4003 41 552 4381 1142 6 89 305 3604 41 83 305 3154 70 608 305 4420 49 335 977 2716 44 83 977 4317 37 332 977 1751 59 519 1301 2099 6 83 1301 2396 20 237 1301 1038 7 335 1579 977 83 83 1579 3126 76 828 1579 1725 39 615 1600 2595 68 83 1600 2892 6 626 1705 4949 22 83 1705 2695 57 992 2008 1579 77 83 2008 3396 18 381 2099 1600 86 83 2099 4583 73 83 2099 4550 7 360 2116 1705 100 83 2116 4515 68 113 2595 2008 87 83 2595 4942 98 83 2595 1661 81 209 2716 3382 10 83 2716 2135 51 24 2716 3199 88 376 3382 2116 46 83 3382 234 55 682 3382 1952 56 560 3604 1301 28 83 3604 4268 100 86 306 2514 96 256 306 3235 33 909 306 3932 57 807 758 1836 23 256 758 1663 18 563 1440 1863 11 256 1440 851 84 577 1613 1440 42 256 1613 3004 100 909 1836 1613 28 256 1836 1769 34 983 1863 4648 71 256 1863 4994 94 256 1863 3514 81 534 2431 758 96 256 2431 3247 53 486 2431 2667 37 759 2514 2431 25 256 2514 3104 95 216 307 2601 31 52 307 233 26 813 1377 4976 50 52 1377 2233 73 52 1377 99 81 813 1553 4434 15 52 1553 2430 64 214 1553 1069 4 931 1804 1377 44 52 1804 3311 35 109 2233 3520 56 52 2233 3810 90 575 2601 3282 39 52 2601 196 47 19 2601 172 63 728 3282 4489 64 52 3282 3781 44 149 3282 666 54 272 3520 1553 57 52 3520 2624 21 599 4434 4796 71 52 4434 3458 68 821 4489 1804 55 52 4489 302 19 99 308 3598 98 194 308 291 76 609 634 4989 6 194 634 2102 87 194 634 647 62 590 1136 4742 13 194 1136 3880 16 148 2102 1136 38 194 2102 676 66 202 2139 634 70 194 2139 3687 72 835 2139 1756 80 975 3598 3783 15 194 3598 4699 66 929 3598 4647 78 352 3783 2139 93 194 3783 854 82 177 309 4284 96 1290 309 1790 26 78 309 4580 83 456 508 4579 53 1290 508 3170 90 647 508 1557 23 595 1034 508 82 1290 1034 4697 45 217 1034 4837 42 666 1597 2552 78 1290 1597 4016 53 244 1597 3370 10 315 2552 1034 100 1290 2552 418 47 331 2552 2025 65 964 4263 1597 74 1290 4263 4654 54 1290 4263 2169 13 187 4263 3316 11 874 4284 4426 55 1290 4284 2774 57 544 4426 4263 24 1290 4426 1293 29 415 4426 1231 66 85 310 1274 58 473 310 3545 6 767 825 2466 32 473 825 4941 48 265 1274 825 33 473 1274 4763 28 473 1274 2298 44 401 1274 1681 41 524 1883 2879 51 473 1883 635 42 711 1883 1526 69 654 1998 1883 91 473 1998 749 45 538 1998 3760 68 216 2268 1998 55 473 2268 3547 20 277 2466 4025 94 473 2466 4362 72 981 2466 220 96 188 2879 4508 60 473 2879 3287 44 41 4025 2268 9 473 4025 4039 67 250 311 3938 42 717 311 4002 62 283 311 2995 10 540 662 4979 3 717 662 128 9 966 662 1194 15 390 862 3934 57 717 862 4886 60 717 862 4811 8 195 862 2920 44 931 1781 662 5 717 1781 22 74 477 2439 4156 91 717 2439 1332 37 601 3934 2439 62 717 3934 583 4 760 3938 4145 80 717 3938 3536 90 729 4145 862 72 717 4145 1672 33 660 4145 3177 16 650 4156 1781 53 717 4156 4023 21 970 312 2840 34 163 312 3786 53 525 1341 3779 90 163 1341 2288 53 930 1990 2421 13 163 1990 2998 81 514 1990 4607 31 832 2394 1341 87 163 2394 2059 84 6 2421 4087 76 163 2421 4408 62 999 2421 2322 72 504 2840 1990 78 163 2840 2343 98 312 2840 1542 84 861 3779 4742 17 163 3779 4969 64 163 3779 4486 28 659 4087 2394 26 163 4087 4510 80 803 313 2503 6 728 313 3690 20 189 313 1243 92 605 611 2821 59 728 611 3971 27 921 710 4428 55 728 710 3442 38 832 1542 611 70 728 1542 53 20 532 1542 2111 35 975 2279 3462 100 728 2279 1263 50 987 2503 710 33 728 2503 2985 76 116 2503 4920 11 559 2821 4584 71 728 2821 2279 70 728 2821 1743 3 717 2821 989 73 987 3462 4682 75 728 3462 2639 86 749 4428 1542 64 728 4428 4531 98 943 4428 524 83 352 314 3512 17 756 314 3235 31 964 573 3494 96 756 573 174 98 874 573 2010 69 162 916 2249 97 756 916 4741 84 756 916 3010 47 665 1186 916 27 756 1186 1633 22 113 1186 2455 42 901 2249 573 63 756 2249 850 27 984 2249 4565 5 158 3494 4691 73 756 3494 1579 36 602 3512 1186 57 756 3512 1151 59 700 315 2082 46 353 315 551 35 417 513 3567 2 353 513 2390 56 385 513 3148 92 913 1419 2815 65 353 1419 391 3 985 1419 3826 83 59 1536 3058 65 353 1536 2849 11 705 1720 3837 40 353 1720 1864 82 712 1720 3918 29 187 1967 4890 72 353 1967 1720 64 353 1967 2487 100 974 1967 283 18 549 2082 513 25 353 2082 4962 57 353 2082 1971 96 248 2815 4541 61 353 2815 1583 42 790 2815 1217 1 616 3058 3957 98 353 3058 3856 54 525 3058 1256 72 199 3567 4283 80 353 3567 1032 7 89 3567 265 90 24 3837 1536 32 353 3837 390 81 253 3957 1419 43 353 3957 4438 37 821 4109 1967 25 353 4109 1313 100 908 4109 1827 63 364 4283 4109 3 353 4283 2576 67 857 4283 3397 83 26 316 1009 10 294 316 4747 11 372 316 4770 1 521 894 4750 99 294 894 4937 76 294 894 3222 34 986 1009 2909 96 294 1009 950 7 966 1009 3138 43 370 1248 2170 62 294 1248 3302 86 374 2170 894 95 294 2170 912 58 45 2170 2088 8 285 2909 1248 99 294 2909 3557 66 346 2909 4505 73 677 317 2932 2 316 317 4149 14 922 317 1570 29 687 546 4690 65 316 546 3229 76 316 546 1214 76 552 546 3183 18 178 2932 3200 43 316 2932 1767 30 377 2932 2621 3 806 3200 3863 45 316 3200 762 43 90 3229 4040 76 316 3229 1000 77 708 3229 838 14 104 3746 4877 91 316 3746 4554 18 301 3863 546 25 316 3863 2356 54 743 3863 2706 40 849 4040 3746 22 316 4040 1090 100 499 4040 3554 25 519 318 557 8 213 318 38 24 281 318 592 18 956 523 4645 18 213 523 1358 30 199 523 3522 28 656 549 911 35 213 549 1511 12 188 549 392 49 754 557 3388 99 213 557 2800 52 857 557 451 78 514 911 523 39 213 911 3427 63 474 1528 549 48 213 1528 4888 81 213 1528 4545 87 389 1528 4236 35 158 1761 1528 20 213 1761 2539 28 290 1761 673 53 30 2596 1761 24 213 2596 2419 82 245 3388 2596 4 213 3388 1882 47 939 3388 2597 63 229 319 2630 31 698 319 3985 49 852 319 630 24 614 650 3004 73 698 650 2592 7 388 842 2935 26 698 842 1684 92 795 1917 650 87 698 1917 1665 32 331 2005 3741 26 698 2005 1032 58 107 2005 34 85 332 2630 3721 74 698 2630 4926 77 38 2630 2382 33 330 2697 1917 35 698 2697 4537 73 654 2697 3595 99 804 2935 4527 30 698 2935 2697 23 698 2935 3675 59 554 3004 4692 26 698 3004 3735 44 711 3721 2005 98 698 3721 1681 53 98 3721 760 77 855 3741 842 8 698 3741 2342 96 330 3741 1771 35 840 320 506 89 407 320 3938 40 274 506 1537 70 407 506 2372 54 112 1258 4686 78 407 1258 1994 78 713 1258 1362 78 584 1328 3884 82 407 1328 485 28 881 1328 1116 53 368 1537 2643 42 407 1537 2351 80 255 1846 1258 22 407 1846 2945 17 832 1846 4995 42 739 2643 1328 46 407 2643 3989 87 391 2643 664 51 64 3074 3926 47 407 3074 209 22 7 3884 3074 35 407 3884 1684 81 22 3884 1064 91 886 3926 1846 47 407 3926 4755 13 407 3926 2784 32 609 321 897 23 416 321 72 37 180 321 304 75 496 694 2238 44 416 694 3970 75 160 694 513 88 666 897 1697 67 416 897 1198 31 445 1697 2632 23 416 1697 4862 67 416 1697 3054 32 67 2238 2410 26 416 2238 176 60 112 2410 3447 56 416 2410 1269 29 484 2632 694 87 416 2632 196 38 787 2632 881 97 925 3447 4904 92 416 3447 3988 57 62 322 3114 82 385 322 2243 47 600 1074 1685 29 385 1074 2136 42 459 1234 2101 9 385 1234 598 65 4 1242 1074 21 385 1242 502 58 496 1242 4074 6 354 1685 1234 44 385 1685 4738 17 80 2101 4848 77 385 2101 4014 11 245 3114 1242 97 385 3114 4716 12 385 3114 1038 45 934 323 4448 86 532 323 1422 24 805 323 812 93 190 764 1497 35 532 764 4956 97 532 764 4485 68 695 1212 4065 27 532 1212 2622 72 528 1212 3103 46 731 1497 1212 4 532 1497 3735 64 672 2950 764 52 532 2950 1663 83 990 2950 3947 4 781 4065 4614 21 532 4065 1251 67 669 4065 2299 71 239 4448 2950 55 532 4448 1896 59 900 324 2211 67 277 324 2739 81 52 324 3090 88 930 1014 4798 43 277 1014 4599 80 662 1489 2341 86 277 1489 1749 24 774 1489 357 39 312 2211 4315 5 277 2211 4547 70 277 2211 3152 93 287 2317 2326 25 277 2317 1398 17 276 2317 4477 13 115 2326 1014 39 277 2326 4617 43 616 2341 2317 36 277 2341 1154 6 925 2341 3362 43 420 4315 4318 18 277 4315 4312 14 999 4318 1489 1 277 4318 2545 27 569 325 1852 76 593 325 67 36 110 325 3376 24 796 632 3748 67 593 632 1434 82 28 1852 3522 29 593 1852 1785 71 515 1852 623 16 315 2981 4571 87 593 2981 3299 2 446 3522 632 47 593 3522 2607 4 870 3522 733 40 61 3711 4924 13 593 3711 2981 29 593 3711 4334 18 784 3711 2665 62 549 3748 3711 72 593 3748 3847 52 508 326 3499 48 972 326 828 83 444 326 1565 45 633 544 3759 38 972 544 4414 86 819 544 44 2 559 1349 3910 33 972 1349 826 71 672 1349 571 78 533 2393 4140 5 972 2393 1290 10 898 3325 4533 89 972 3325 2393 70 972 3325 1415 62 623 3499 544 64 972 3499 3808 87 162 3759 1349 10 972 3759 4467 16 669 3910 3325 2 972 3910 1411 2 276 3910 3142 36 368 3967 4914 84 972 3967 1466 72 853 4140 3967 53 972 4140 1531 9 374 4140 4187 76 557 327 3624 7 694 327 3428 100 248 327 4988 82 432 1225 3051 10 694 1225 1833 56 103 1225 4619 22 513 2382 4914 21 694 2382 4638 19 919 2382 153 60 938 2405 1225 61 694 2405 3607 29 619 3051 2382 27 694 3051 3850 14 767 3624 4941 20 694 3624 4115 38 694 3624 3527 78 6 4115 2405 65 694 4115 3431 36 331 4115 4640 92 745 328 3059 99 289 328 1350 64 434 328 1797 81 732 732 4137 99 289 732 3099 22 537 899 1187 54 289 899 1694 42 95 1187 1721 66 289 1187 4875 65 289 1187 154 31 200 1721 732 61 289 1721 1890 75 344 2942 899 46 289 2942 2631 80 929 2942 3459 51 51 3059 3206 64 289 3059 108 6 2 3059 3323 16 604 3206 2942 7 289 3206 2439 76 226 3206 587 49 295 4137 4928 10 289 4137 541 6 759 329 577 27 1387 329 4573 56 216 329 3796 76 154 577 3179 84 1387 577 574 71 178 577 2552 81 963 872 4722 79 1387 872 4538 22 211 872 1711 70 293 1318 2767 48 1387 1318 98 9 291 1318 4562 75 778 2376 4031 8 1387 2376 4387 79 476 2376 2672 57 470 2480 1318 77 1387 2480 2223 85 804 2480 33 10 309 2767 872 99 1387 2767 1933 19 786 3179 2376 9 1387 3179 3356 96 679 3179 4931 96 359 4031 2480 3 1387 4031 4709 99 1387 4031 3192 96 340 4031 4681 77 176 330 2458 54 296 330 52 76 175 561 4097 44 296 561 4512 10 291 1538 3446 61 296 1538 3224 7 623 1686 1771 96 296 1686 1524 85 245 1771 3015 42 296 1771 4939 33 282 1771 4602 25 106 2458 1686 86 296 2458 2586 97 749 3015 3983 55 296 3015 2116 42 99 3035 4708 90 296 3035 4551 60 296 3035 2226 43 558 3035 2693 9 380 3446 3035 73 296 3446 662 5 142 3446 2923 2 548 3983 4438 54 296 3983 957 59 935 4097 1538 46 296 4097 2983 16 902 4438 561 71 296 4438 168 22 513 331 2050 2 922 331 526 86 618 782 1566 52 922 782 4934 50 922 782 2977 79 913 1007 1921 84 922 1007 3597 54 2 1007 1882 22 503 1566 3903 13 922 1566 3891 37 393 1566 281 49 282 1921 3944 99 922 1921 4210 94 754 2050 3174 99 922 2050 1556 40 920 3174 1007 15 922 3174 1858 23 496 3903 4528 55 922 3903 808 41 810 3944 782 11 922 3944 1455 88 223 332 3334 32 184 332 2538 76 459 593 4523 85 184 593 2521 58 751 593 3038 19 994 1319 4579 64 184 1319 2719 17 184 1319 2068 66 55 2719 593 81 184 2719 3621 32 477 3334 4346 40 184 3334 3013 34 696 4346 1319 54 184 4346 3885 28 530 333 3356 73 535 333 1613 95 612 333 3147 1 57 636 4258 78 535 636 87 67 240 636 3801 11 838 2983 3573 93 535 2983 4335 16 967 3021 3082 55 535 3021 141 32 314 3021 3181 1 798 3082 636 45 535 3082 99 16 8 3082 1421 99 147 3356 3021 100 535 3356 4977 32 535 3356 2051 97 161 3356 4564 18 209 3573 4787 22 535 3573 4243 67 86 3573 4711 27 236 4073 2983 87 535 4073 2807 62 936 4177 4073 2 535 4177 4478 27 628 4177 1560 55 760 4258 4177 41 535 4258 4224 47 709 334 4245 65 1428 334 1409 17 172 334 3886 20 787 1254 3413 28 1428 1254 4214 42 766 1254 1510 81 578 2173 2905 36 1428 2173 4683 38 1428 2173 3880 15 700 2173 1950 52 553 2723 2173 16 1428 2723 4186 91 519 2723 2895 94 389 2905 1254 86 1428 2905 1232 41 78 3413 4665 84 1428 3413 2056 25 383 4245 2723 59 1428 4245 4979 18 713 4245 980 64 116 335 1894 66 384 335 994 1 620 335 1036 10 46 1042 4625 44 384 1042 43 72 509 1042 2674 94 140 1224 4132 1 384 1224 3426 94 704 1317 2628 95 384 1317 4730 54 384 1317 2514 69 585 1638 1317 31 384 1638 3243 18 241 1894 1224 7 384 1894 1256 19 95 2628 3150 27 384 2628 1951 74 359 2628 4899 78 53 3150 1042 46 384 3150 2027 74 613 4132 1638 42 384 4132 1642 58 242 4132 1842 43 687 336 1780 12 271 336 1340 2 373 336 2455 72 205 588 1486 97 271 588 467 7 689 588 871 42 439 1486 3181 28 271 1486 2066 64 521 1486 2055 87 831 1780 2109 3 271 1780 2933 75 787 1780 4038 33 17 2109 2528 59 271 2109 4483 58 727 2109 4251 71 842 2528 588 86 271 2528 3536 27 734 2528 1360 91 71 3181 4584 33 271 3181 4877 4 271 3181 4349 76 23 337 4218 39 74 337 2481 16 863 2093 3478 34 74 2093 1390 38 774 2392 4313 64 74 2392 4705 77 74 2392 4295 64 603 3375 2093 26 74 3375 4381 36 119 3478 4403 36 74 3478 2687 15 772 3478 1908 35 156 4218 3375 49 74 4218 55 91 325 4313 4924 34 74 4313 57 21 306 4403 2392 58 74 4403 1117 66 944 338 2835 73 427 338 3938 40 145 597 3750 67 427 597 4775 31 295 780 2457 23 427 780 1126 1 394 2457 597 94 427 2457 4727 40 427 2457 1625 95 648 2803 4003 77 427 2803 906 32 725 2835 2803 77 427 2835 4202 50 173 3486 780 53 427 3486 2971 86 923 3486 2496 36 560 3602 4414 59 427 3602 4477 66 540 3602 1126 77 425 3750 3602 54 427 3750 2191 18 606 4003 3486 56 427 4003 2871 75 511 4003 797 36 817 4414 4760 7 427 4414 1343 27 181 4414 4943 71 452 339 1913 81 400 339 4296 70 640 339 2699 80 355 1912 4683 58 400 1912 4204 51 877 1913 2114 62 400 1913 3685 50 500 2114 3450 95 400 2114 505 46 796 2114 943 68 322 2347 4576 94 400 2347 3587 30 400 2347 1270 6 366 2347 134 53 42 3450 2347 79 400 3450 3400 52 860 3587 3894 51 400 3587 1259 96 916 3894 1912 87 400 3894 887 53 554 340 1127 85 584 340 3969 66 139 775 2270 94 584 775 223 49 86 775 50 29 59 1127 1626 96 584 1127 2995 95 549 1127 4541 14 919 1207 3255 70 584 1207 4321 75 984 1207 2065 88 110 1431 2248 39 584 1431 3103 38 552 1431 4573 45 739 1626 1431 94 584 1626 4080 17 320 1626 3420 2 511 1861 2015 7 584 1861 3150 98 355 2015 775 2 584 2015 4682 45 584 2015 737 91 604 2248 1207 45 584 2248 510 28 672 2248 2943 91 29 2270 4776 29 584 2270 2419 85 292 2270 4192 78 467 3255 1861 41 584 3255 2991 6 382 3255 3947 75 467 341 1514 65 411 341 4750 1 753 341 2443 46 500 1514 3237 93 411 1514 4714 73 925 1550 3904 73 411 1550 4991 72 411 1550 4587 79 710 1550 721 59 75 3002 4290 60 411 3002 4409 45 305 3002 3867 2 280 3237 3002 51 411 3237 1915 80 501 3237 2422 67 882 3904 4810 49 411 3904 4510 37 378 4290 1550 91 411 4290 4818 83 666 342 1436 72 656 342 1545 87 221 342 3166 53 130 697 3338 2 656 697 4442 12 978 697 4362 3 13 1436 1855 90 656 1436 3191 76 715 1855 697 28 656 1855 4616 75 656 1855 1040 51 165 1855 1810 96 554 2056 3256 36 656 2056 152 91 769 3256 4765 82 656 3256 4453 6 654 3338 2056 97 656 3338 4626 84 939 343 2623 19 453 343 4213 58 971 343 623 24 867 1164 4052 71 453 1164 1678 61 143 1164 4802 68 194 1809 1164 88 453 1809 1242 88 568 1809 3193 90 453 1929 1809 52 453 1929 4534 97 864 1929 4495 39 543 2623 1929 35 453 2623 4574 65 453 2623 4652 75 525 2623 4789 55 144 3655 4277 20 453 3655 813 79 914 3655 2676 41 446 4052 4201 63 453 4052 1747 5 345 4052 2436 10 992 4201 3655 100 453 4201 2178 22 326 4201 3974 49 987 4277 4614 97 453 4277 1703 82 731 4277 1775 91 733 344 1909 59 327 344 154 60 81 886 4956 56 327 886 4887 88 327 886 4579 2 740 1454 2014 80 327 1454 4180 90 145 1800 1454 15 327 1800 2170 16 400 1800 1536 41 214 1909 4466 87 327 1909 2110 51 634 2014 3950 46 327 2014 3710 95 794 3516 886 81 327 3516 396 55 647 3516 442 13 179 3829 3516 94 327 3829 26 11 392 3829 657 2 243 3950 3829 18 327 3950 2647 33 444 3950 4433 54 640 4466 1800 28 327 4466 4859 85 999 4466 1114 45 111 345 1267 97 729 345 4640 100 944 925 4794 73 729 925 873 76 332 1267 2106 24 729 1267 3276 64 342 1267 29 55 837 1365 2558 16 729 1365 825 30 766 1541 925 29 729 1541 4789 73 729 1541 2175 8 2 1541 1142 85 78 2106 3254 67 729 2106 1665 21 629 2106 2048 5 810 2558 1541 79 729 2558 3766 17 736 2558 4867 67 154 3254 1365 54 729 3254 3099 69 909 346 4326 36 265 346 3471 100 922 1066 4999 8 265 1066 4918 88 683 1942 2724 6 265 1942 926 91 884 2438 3504 97 265 2438 2630 70 265 2438 2604 62 268 2724 2438 35 265 2724 2647 35 315 2856 3859 54 265 2856 4898 29 265 2856 2881 13 422 2856 4721 43 83 3504 2856 22 265 3504 784 12 803 3504 1962 30 348 3859 1066 24 265 3859 2158 45 905 3859 4927 16 661 4326 1942 70 265 4326 4244 8 808 4326 2038 24 858 347 691 54 663 347 2933 24 303 347 4336 81 314 691 1672 34 663 691 1848 68 187 691 154 74 302 760 1562 21 663 760 2586 89 554 1434 3363 49 663 1434 1776 53 712 1434 4747 69 868 1562 4700 56 663 1562 4952 18 663 1562 3625 44 893 1562 4263 48 386 1672 3617 17 663 1672 2691 93 480 1672 1448 45 264 1732 1434 47 663 1732 594 55 835 3363 3537 94 663 3363 551 38 342 3363 183 57 976 3537 760 7 663 3537 12 30 98 3537 1729 80 390 3617 1732 98 663 3617 1764 8 227 348 687 78 968 348 219 95 898 348 712 37 10 687 3709 83 968 687 1827 14 892 687 2231 48 110 959 3235 49 968 959 3231 77 511 959 1684 68 673 962 3429 23 968 962 2368 85 75 1119 1415 37 968 1119 2891 57 38 1119 1208 40 716 1143 959 2 968 1143 3383 98 980 1143 1405 16 163 1415 3995 43 968 1415 4995 97 968 1415 4472 97 184 2042 1119 97 968 2042 4793 21 968 2042 1545 33 33 2042 625 95 873 3235 962 100 968 3235 4404 31 524 3429 4557 29 968 3429 2178 50 534 3429 557 42 69 3709 3822 35 968 3709 3257 49 412 3822 2042 19 968 3822 1842 4 577 3822 3432 62 394 3995 1143 71 968 3995 4684 67 131 3995 1438 98 282 349 3192 93 246 349 36 41 516 2221 2887 39 246 2221 4735 76 89 2221 407 89 118 2703 4626 91 246 2703 4098 32 976 2703 50 2 153 2887 3685 58 246 2887 1954 53 46 2887 528 20 419 3142 2221 57 246 3142 4629 29 246 3142 3790 57 33 3142 3968 11 510 3192 3142 54 246 3192 3793 94 589 3685 2703 7 246 3685 3728 44 477 350 1737 62 250 350 2076 56 883 350 966 24 26 1035 2557 26 250 1035 4554 25 250 1035 1108 2 883 1737 1964 85 250 1737 779 91 833 1737 1841 41 308 1964 3543 62 250 1964 1374 60 311 1964 3415 2 629 2247 2676 42 250 2247 1325 8 144 2247 3232 5 720 2541 3673 78 250 2541 4151 6 181 2557 4963 82 250 2557 4267 36 543 2676 3101 10 250 2676 15 2 160 2676 518 33 386 3101 1035 10 250 3101 512 39 329 3273 2247 78 250 3273 493 5 180 3543 2541 98 250 3543 2081 57 405 3673 3273 29 250 3673 4491 49 643 3673 944 93 15 351 582 76 144 351 4378 70 566 351 4262 3 876 582 2435 31 144 582 1907 81 199 635 1356 87 144 635 3247 60 524 635 1975 61 361 651 3173 25 144 651 3837 63 86 651 4015 99 879 1356 3480 41 144 1356 486 33 72 1356 4674 61 759 2435 651 2 144 2435 369 7 48 2435 3642 15 419 2698 635 45 144 2698 4788 70 144 2698 2327 90 531 2698 101 22 433 3173 2698 30 144 3173 3110 12 267 3173 4298 32 556 3480 4805 10 144 3480 367 31 984 352 2223 94 189 352 2006 27 841 709 4600 33 189 709 2171 47 803 1976 4088 38 189 1976 1574 86 507 1976 1270 92 74 2223 4199 14 189 2223 981 85 768 2223 1609 95 391 2289 4840 27 189 2289 709 35 189 2289 1902 25 711 2289 2273 30 483 4088 2289 65 189 4088 1374 99 919 4088 4691 99 632 4199 1976 92 189 4199 3882 59 591 4199 4969 72 520 353 835 27 713 353 3652 25 882 835 4362 48 713 835 4127 96 355 898 1343 79 713 898 4542 56 685 898 4661 27 236 1343 4401 2 713 1343 2007 2 236 4362 898 6 713 4362 4069 94 174 4401 4601 22 713 4401 4637 11 713 4401 2825 34 995 354 1646 96 317 354 789 37 471 354 2060 48 577 792 1526 67 317 792 3412 31 164 792 1117 84 929 850 792 95 317 850 1153 39 210 1526 4513 9 317 1526 1330 75 146 1526 495 47 591 1646 2600 58 317 1646 255 68 1000 1646 2947 86 399 2600 2866 74 317 2600 1630 27 244 2600 2420 54 978 2866 3898 90 317 2866 4397 13 19 2866 4966 88 133 3898 850 17 317 3898 4570 10 317 3898 3033 50 386 3898 2722 58 893 355 1306 24 439 355 2183 51 909 355 4811 95 813 531 2874 21 439 531 979 65 661 1306 3557 63 439 1306 4318 58 576 1306 535 93 487 1355 2618 92 439 1355 4272 20 479 1355 3155 93 774 2618 4416 57 439 2618 4807 98 439 2618 3151 51 650 2874 1355 75 439 2874 4171 99 810 2874 2002 99 899 3557 531 97 439 3557 4761 66 227 3557 4109 4 285 4416 4542 6 439 4416 3569 64 599 4416 4118 22 94 356 936 9 404 356 1174 64 848 356 358 99 503 936 1850 20 404 936 4609 55 512 936 234 88 914 1390 3713 96 404 1390 3664 4 208 1390 1957 75 354 1850 3042 33 404 1850 1174 77 851 3042 1390 53 404 3042 4214 82 250 3042 590 14 843 3713 3800 73 404 3713 4824 66 404 3713 213 25 740 3800 4848 83 404 3800 2918 42 283 3800 3456 69 761 357 1655 97 937 357 1902 1 81 357 93 86 451 737 836 7 937 737 3022 23 188 836 1630 63 937 836 2642 78 179 836 147 79 291 1281 3754 11 937 1281 4867 27 51 1281 638 79 456 1339 4517 58 937 1339 3140 80 960 1339 1232 19 876 1630 4061 80 937 1630 4978 56 992 1655 1281 69 937 1655 4634 96 937 1655 431 3 729 1802 737 99 937 1802 2842 1 440 3754 1802 51 937 3754 3111 28 89 3754 1084 68 261 4061 1339 25 937 4061 3273 98 639 4061 2800 100 856 358 1417 35 218 358 3667 46 531 358 4882 28 242 1417 4210 84 218 1417 4629 84 218 1417 2373 83 493 3394 3979 55 218 3394 445 87 258 3394 858 100 218 3632 3866 89 218 3632 3505 57 936 3632 3229 79 246 3866 4053 8 218 3866 733 44 916 3866 202 85 209 3979 4597 21 218 3979 903 56 765 3979 98 56 284 4053 3394 17 218 4053 3418 71 632 4053 4065 45 682 4210 4241 15 218 4210 1320 80 792 4210 1040 99 623 4241 3632 70 218 4241 2023 61 280 4241 1910 22 629 359 2797 95 803 359 4335 44 982 359 3080 39 943 1748 4951 4 803 1748 1484 70 437 2041 4494 80 803 2041 4194 12 856 2797 3969 16 803 2797 1085 77 51 2797 1411 60 464 3483 4898 86 803 3483 1748 85 803 3483 163 26 741 3483 3024 49 923 3969 2041 25 803 3969 4263 52 616 4494 3483 14 803 4494 4326 5 348 4494 784 43 767 360 2658 72 333 360 1900 68 122 1103 1594 46 333 1103 3560 52 338 1594 4700 10 333 1594 3387 75 671 1594 4390 98 607 2266 4913 23 333 2266 1103 47 333 2266 761 65 210 2266 3704 58 45 2658 3336 72 333 2658 2459 87 762 3183 2266 76 333 3183 1421 44 18 3183 4819 68 190 3336 3183 26 333 3336 1437 37 351 3336 1855 19 841 361 1231 38 215 361 1161 5 403 361 914 77 715 534 3790 59 215 534 1441 80 982 534 2904 14 450 1231 2212 65 215 1231 4795 67 215 1231 3495 71 907 1231 2986 28 637 1523 534 23 215 1523 2883 25 477 1523 2072 55 582 1605 1523 18 215 1605 2349 27 668 1605 4272 63 150 2212 3571 34 215 2212 673 64 334 3571 1605 40 215 3571 3523 98 947 3790 4855 37 215 3790 4355 14 168 362 4209 13 217 362 2727 71 289 362 4696 41 759 1096 3340 48 217 1096 217 71 959 1096 1382 41 618 1531 4815 58 217 1531 2506 70 298 1531 1856 83 878 1758 1096 79 217 1758 1076 68 36 3340 4221 86 217 3340 2707 45 557 3340 2677 37 947 4209 1758 95 217 4209 2264 43 139 4209 4419 50 357 4221 1531 84 217 4221 4783 49 217 4221 2417 37 5 363 1448 51 757 363 4112 33 623 363 3321 45 463 538 3929 43 757 538 2771 89 878 538 1054 8 50 705 3295 26 757 705 4065 22 176 1448 2408 73 757 1448 214 84 92 1448 2588 24 76 2028 2422 50 757 2028 4978 13 76 2408 3459 2 757 2408 1788 68 923 2408 523 83 865 2422 4882 59 757 2422 2458 47 193 2864 538 3 757 2864 2557 12 713 3295 2864 96 757 3295 1448 22 113 3295 2742 59 596 3459 705 72 757 3459 4961 73 757 3459 859 52 961 3459 4099 91 703 3929 2028 73 757 3929 911 72 806 3929 2667 13 410 364 644 39 437 364 2131 9 511 571 965 64 437 571 3548 38 123 571 1116 46 876 644 1150 100 437 644 1649 9 968 644 4205 6 131 700 4548 14 437 700 1122 68 527 965 4535 95 437 965 1070 5 437 965 4662 37 437 965 2299 44 309 1070 3395 49 437 1070 908 76 863 1070 3670 2 892 1150 1882 21 437 1150 1053 90 551 1150 2291 26 811 1423 3104 39 437 1423 4854 94 54 1423 3225 51 338 1882 1423 96 437 1882 2076 54 585 2854 571 2 437 2854 4848 70 400 2854 362 47 84 2991 4028 84 437 2991 978 13 244 3104 2854 58 437 3104 2588 91 113 3104 2082 38 520 3353 700 26 437 3353 312 92 730 3395 2991 92 437 3395 3342 67 329 4028 3353 22 437 4028 4421 61 147 365 3103 98 888 365 3950 98 890 365 1103 7 508 1481 1495 46 888 1481 1367 76 915 1495 3444 86 888 1495 4025 68 953 3103 3390 82 888 3103 2339 49 21 3390 4324 37 888 3390 4454 45 298 3390 4584 80 487 3444 4886 53 888 3444 432 1 30 3444 3725 6 55 3869 1481 95 888 3869 4965 49 888 3869 1677 10 874 4324 3869 29 888 4324 3583 41 943 4324 4265 47 90 366 2997 75 318 366 1927 56 281 686 1651 51 318 686 4713 47 135 1556 4746 63 318 1556 3180 51 318 1556 299 17 457 1556 2877 30 828 1651 4920 8 318 1651 4019 17 187 1651 4865 61 946 2481 1556 22 318 2481 2225 71 410 2481 4087 1 85 2997 2481 65 318 2997 4506 16 328 3120 4171 55 318 3120 4564 37 383 3120 590 30 97 3180 3871 91 318 3180 2875 55 984 3871 3120 7 318 3871 2367 18 907 3871 2532 80 645 4171 686 75 318 4171 3886 55 866 4171 1118 64 281 367 1826 39 104 367 3744 23 483 776 3773 87 104 776 2619 65 685 776 4924 42 643 1172 2251 28 104 1172 2428 87 980 1172 1267 31 982 1387 776 39 104 1387 1421 34 848 1387 1968 77 464 1826 2018 9 104 1826 2752 57 197 2018 1172 78 104 2018 4940 6 947 2251 3014 80 104 2251 3482 35 265 2269 2456 96 104 2269 1544 47 328 2456 2953 29 104 2456 4721 61 104 2456 2198 24 488 2953 4861 80 104 2953 4838 29 104 2953 1373 26 677 2953 4629 85 330 3014 1387 86 104 3014 1078 76 245 3126 2269 58 104 3126 327 61 788 3126 815 58 920 3773 3126 30 104 3773 4657 2 370 3773 3786 62 996 368 1406 9 358 368 3565 66 772 368 4802 42 875 1406 1586 18 358 1406 3908 49 466 1406 1413 98 463 1586 2565 64 358 1586 482 19 240 1586 498 70 99 1985 4729 68 358 1985 445 46 580 2338 4837 3 358 2338 2582 33 358 2338 3834 73 440 2565 2338 74 358 2565 133 96 590 2582 3396 58 358 2582 2325 82 705 2582 4556 25 722 3396 1985 88 358 3396 4969 82 184 3396 1466 45 768 369 3470 22 451 369 198 40 175 594 4064 99 451 594 1830 10 335 1120 2377 14 451 1120 4833 51 632 1151 2496 83 451 1151 2864 67 385 1151 1037 72 764 1158 1151 29 451 1158 2829 95 653 1158 2619 55 133 1649 2718 73 451 1649 4672 88 451 1649 2267 59 944 2256 1158 62 451 2256 89 27 837 2256 3364 42 853 2377 1649 100 451 2377 3979 36 516 2377 268 78 111 2496 594 66 451 2496 2470 97 879 2496 2086 35 749 2718 2256 38 451 2718 2506 84 740 3222 4797 6 451 3222 1123 10 78 3222 2853 94 233 3470 4940 30 451 3470 1120 77 451 3470 1551 14 70 3470 512 86 703 4064 3222 93 451 4064 3363 66 404 370 840 14 451 370 852 52 705 840 3163 14 451 840 4131 79 369 991 4558 6 451 991 4982 57 451 991 2052 35 416 1783 991 46 451 1783 2864 17 212 2722 1783 81 451 2722 2794 38 154 2722 4072 5 625 3163 3793 95 451 3163 2466 70 314 3793 4379 32 451 3793 1937 84 88 4379 2722 30 451 4379 3459 63 842 371 3457 93 135 371 4349 35 867 371 1497 82 755 1058 2043 76 135 1058 4446 24 720 1058 2513 3 694 1230 1058 69 135 1230 3774 59 24 1230 912 17 496 1420 1465 21 135 1420 4132 41 844 1465 4436 95 135 1465 1444 38 142 2043 2302 23 135 2043 2736 5 348 2043 2263 5 484 2302 4581 41 135 2302 3351 28 403 3457 1420 48 135 3457 4144 3 724 3457 960 47 692 4436 1230 97 135 4436 4851 93 135 4436 42 41 474 4436 3792 15 605 372 3680 2 753 372 1770 68 642 372 580 22 486 778 2154 85 753 778 4587 54 904 2154 2675 92 753 2154 4600 7 906 2675 4380 75 753 2675 4977 29 512 2730 4981 32 753 2730 1120 1 739 3680 778 73 753 3680 4694 7 753 3680 2199 26 813 3972 2730 63 753 3972 3167 15 550 4380 3972 92 753 4380 711 39 934 4380 3980 93 803 373 3691 62 273 373 2713 16 458 373 1781 78 658 1050 4981 75 273 1050 2416 71 273 1050 4132 23 485 1050 503 93 862 1382 4911 30 273 1382 3533 6 312 1382 4485 13 774 1652 3787 90 273 1652 496 31 189 1652 2648 55 470 2013 3595 74 273 2013 4801 32 102 2416 1382 42 273 2416 1183 29 878 2416 333 95 329 3595 4125 76 273 3595 2259 54 631 3595 2764 80 775 3691 4014 61 273 3691 3660 41 346 3787 4349 88 273 3787 603 68 732 3787 4347 94 164 4014 2013 43 273 4014 4877 24 207 4125 1652 35 273 4125 4778 10 426 4349 1050 4 273 4349 394 16 55 374 1782 16 22 374 1534 99 734 374 2856 24 967 532 676 38 22 532 2702 78 957 676 4071 73 22 676 284 40 321 1782 3227 22 22 1782 1049 97 538 1904 4741 47 22 1904 532 63 22 1904 4079 43 604 2137 1904 9 22 2137 3482 36 212 2774 2137 17 22 2774 1186 50 72 2774 84 64 521 3227 3392 8 22 3227 3503 20 685 3227 242 48 593 3392 3708 84 22 3392 4490 28 831 3392 1008 95 344 3708 2774 21 22 3708 4830 39 813 3708 1607 65 468 4071 4987 97 22 4071 232 68 986 4071 842 78 510 375 510 90 284 375 3764 16 245 375 1704 61 616 510 3077 75 284 510 3005 44 606 510 1190 19 953 602 4077 52 284 602 3994 70 719 602 2434 59 451 927 4054 24 284 927 1722 38 849 927 3202 93 730 2060 2507 26 284 2060 4268 75 493 2060 754 37 324 2183 602 68 284 2183 1477 56 656 2183 851 76 298 2507 4733 92 284 2507 4529 30 284 2507 3338 27 946 2507 1004 55 184 3077 4310 98 284 3077 4731 6 175 4054 2060 63 284 4054 3894 90 271 4054 645 18 363 4077 927 53 284 4077 935 71 670 4077 2811 54 694 4310 2183 15 284 4310 3321 98 390 4310 619 45 829 376 2150 71 15 376 4556 24 657 376 4303 100 416 798 1004 73 15 798 640 30 195 824 1340 24 15 824 2399 81 663 1004 2913 62 15 1004 3267 2 303 1004 4201 17 122 1243 824 52 15 1243 255 4 9 1340 798 86 15 1340 760 97 401 1922 2572 86 15 1922 4962 22 15 1922 418 71 247 2150 1243 71 15 2150 3295 11 370 2572 4710 40 15 2572 2710 29 283 2572 863 100 923 2913 1922 38 15 2913 4582 74 833 2913 1635 100 245 377 4320 74 1020 377 4370 81 803 796 4169 9 1020 796 1283 7 797 796 3285 51 552 1065 3385 73 1020 1065 4467 80 927 1443 4983 11 1020 1443 3640 69 22 3385 796 71 1020 3385 3081 59 350 3385 272 25 451 4169 1443 5 1020 4169 2497 52 155 4169 3519 1 717 4320 1065 73 1020 4320 4544 33 1020 4320 574 70 242 4320 1573 41 81 378 1901 43 326 378 379 73 844 378 1798 5 597 924 1724 40 326 924 1445 99 159 924 2550 54 979 1724 3348 57 326 1724 3203 86 263 1724 1593 86 523 1901 3935 47 326 1901 3508 62 703 2010 2460 39 326 2010 4835 59 326 2010 4282 43 272 2460 3354 48 326 2460 3093 37 657 3348 4250 83 326 3348 819 43 875 3348 1573 67 99 3354 924 1 326 3354 1690 37 919 3354 4629 87 918 3935 2010 74 326 3935 3751 87 903 4250 4803 28 326 4250 2248 93 708 379 569 46 436 379 4819 47 463 379 807 67 459 569 2332 10 436 569 1716 54 219 1518 2886 52 436 1518 1011 60 125 1518 3261 1 54 1684 4236 88 436 1684 4964 36 70 2332 4373 9 436 2332 4675 37 436 2332 2709 39 668 2886 3704 17 436 2886 4248 20 305 2886 2146 50 360 3601 1518 33 436 3601 164 49 256 3601 4700 4 706 3704 4653 58 436 3704 2995 94 952 3704 4374 26 368 3714 3601 57 436 3714 2889 50 25 4236 3714 48 436 4236 2590 84 349 4373 1684 7 436 4373 32 57 435 4373 1333 76 814 380 2563 41 360 380 2761 12 159 677 3196 6 360 677 1448 14 906 1192 4120 26 360 1192 730 97 390 1577 677 83 360 1577 29 50 517 1577 4902 50 183 2563 1577 28 360 2563 3743 51 205 2563 3182 19 824 3196 1192 100 360 3196 4693 20 360 3196 4500 75 649 3196 389 86 557 4120 4564 33 360 4120 3762 83 638 4120 3526 20 516 381 4325 82 389 381 3303 1 726 2100 3923 15 389 2100 3153 77 210 2100 959 75 718 3073 2100 61 389 3073 4771 85 389 3073 1952 25 908 3536 4167 12 389 3536 1210 43 689 3603 3073 52 389 3603 330 46 128 3923 4609 83 389 3923 4181 92 5 4167 3603 72 389 4167 1300 80 989 4325 3536 76 389 4325 873 64 22 382 2344 42 949 382 1912 9 996 382 994 88 659 889 4544 2 949 889 4643 94 949 889 3987 39 907 909 2590 34 949 909 4455 23 760 1658 909 13 949 1658 1123 99 702 1658 3303 31 39 1680 1719 12 949 1680 562 55 605 1680 1692 54 181 1719 1778 89 949 1719 2586 39 629 1778 889 4 949 1778 632 6 406 2344 1658 21 949 2344 357 43 557 2344 719 13 451 2590 1680 62 949 2590 326 60 366 2590 3482 55 792 383 2979 74 311 383 625 71 780 383 968 98 679 1005 3137 40 311 1005 903 35 406 1255 4582 62 311 1255 1421 57 450 2352 3939 44 311 2352 2844 98 153 2483 4631 84 311 2483 2352 88 311 2483 584 27 242 2979 3032 79 311 2979 5000 1 649 2979 3402 49 609 3032 3215 10 311 3032 1105 78 387 3032 2354 99 989 3137 1255 19 311 3137 2328 96 917 3137 1037 92 964 3215 2483 39 311 3215 2723 38 435 3939 1005 17 311 3939 3280 45 30 3939 2025 72 89 384 3431 21 990 384 3698 23 489 384 4140 46 248 1278 3832 62 990 1278 1690 82 782 1422 4323 19 990 1422 295 78 266 1422 4784 4 556 3138 4830 52 990 3138 4968 30 990 3138 1076 34 499 3138 603 55 984 3147 3546 98 990 3147 3929 43 441 3147 4561 82 17 3431 3147 57 990 3431 2469 32 430 3431 2935 37 28 3546 3728 91 990 3546 2669 76 143 3728 1278 87 990 3728 4164 1 29 3832 1422 84 990 3832 2405 90 950 3832 1764 97 491 4323 3138 87 990 4323 2087 78 981 385 1279 41 75 385 869 38 962 1279 4333 93 75 1279 1742 10 258 2779 3290 6 75 2779 2393 77 90 2779 4930 98 427 3290 3917 52 75 3290 3154 71 582 3461 4497 96 75 3461 1103 23 462 3461 2757 57 487 3917 4451 26 75 3917 3797 88 584 3917 4912 47 69 4333 2779 14 75 4333 1628 17 850 4451 3461 54 75 4451 4780 71 75 4451 2610 67 223 4451 4718 84 469 4497 4610 5 75 4497 712 26 972 4497 3213 64 901 386 649 73 563 386 734 9 58 649 1711 35 563 649 561 46 39 1003 1492 73 563 1003 2423 68 824 1152 2578 12 563 1152 4780 98 563 1152 3704 71 976 1152 2249 74 261 1492 2526 38 563 1492 207 67 573 1492 3608 33 46 1711 1971 84 563 1711 796 72 404 1971 2959 59 563 1971 1230 17 351 2526 1152 5 563 2526 4873 74 629 2578 4556 46 563 2578 373 80 83 2578 75 66 408 2959 3178 40 563 2959 2915 65 878 3164 1003 100 563 3164 4282 17 857 3178 3164 82 563 3178 2449 88 546 387 2850 33 481 387 264 48 31 711 4510 57 481 711 2174 31 822 711 2141 39 462 1554 711 5 481 1554 898 22 394 1554 2711 91 31 1583 3879 41 481 1583 2385 90 453 2850 4615 62 481 2850 4130 11 481 2850 1588 29 330 2850 2201 45 290 3879 1554 22 481 3879 1228 28 766 3879 1463 82 360 4130 1583 7 481 4130 3235 43 976 388 4056 25 546 388 3304 61 512 807 1688 22 546 807 188 25 897 1235 4443 78 546 1235 731 8 779 1235 1875 3 666 1688 4789 51 546 1688 2391 63 839 1914 1235 63 546 1914 3907 84 31 2039 807 100 546 2039 4454 98 784 2521 1914 40 546 2521 2488 72 389 2521 3175 98 627 4056 4207 12 546 4056 1926 40 323 4207 2521 47 546 4207 3001 62 547 4225 2039 34 546 4225 4527 18 546 4225 3417 25 515 4443 4225 9 546 4443 4150 45 429 4443 3293 33 330 389 885 19 455 389 4326 84 914 885 1357 37 455 885 3657 57 493 1203 4992 57 455 1203 2417 75 220 1203 515 65 655 1357 4603 99 455 1357 4460 93 455 1357 892 53 724 1357 244 74 12 2158 3509 43 455 2158 532 88 947 2158 799 17 194 2853 3882 6 455 2853 3672 29 167 2853 2665 24 989 3509 4067 50 455 3509 1470 46 71 3509 1468 44 44 3882 4292 27 455 3882 3375 47 67 4067 1203 68 455 4067 2910 50 908 4292 2158 75 455 4292 4013 93 74 4460 4462 91 455 4460 2996 9 752 4462 2853 64 455 4462 3824 84 711 4462 1708 39 859 390 4105 59 356 390 2400 22 402 390 3138 5 780 816 2740 100 356 816 2979 4 525 1048 1677 67 356 1048 1261 81 335 1048 2265 17 831 1549 1048 26 356 1549 3993 73 12 1677 2380 84 356 1677 1085 97 58 1677 4156 32 908 2380 3441 74 356 2380 4315 63 193 2740 3730 25 356 2740 4961 60 742 2740 1262 27 726 3441 816 64 356 3441 4713 64 567 3730 4700 89 356 3730 2756 39 585 4105 1549 96 356 4105 4907 100 356 4105 1240 1 591 391 1376 38 496 391 69 38 533 964 4285 78 496 964 2500 5 526 964 2752 41 553 1376 4755 28 496 1376 2729 67 496 1376 535 58 183 1376 988 93 871 1916 2640 76 496 1916 1559 54 588 1916 3804 79 918 2151 4937 59 496 2151 4931 28 872 2500 1916 33 496 2500 2561 18 296 2500 3110 93 896 2640 964 64 496 2640 430 53 556 2640 226 31 800 2729 2500 38 496 2729 4623 55 400 4285 2151 48 496 4285 4598 87 881 4285 802 82 730 392 4268 57 525 392 480 35 16 623 797 23 525 623 1721 67 47 623 375 24 951 797 4261 71 525 797 4128 37 983 1020 4725 1 525 1020 2813 88 893 1020 2555 92 242 1052 623 5 525 1052 2768 94 752 1052 5 16 606 2727 3364 16 525 2727 4855 51 525 2727 4697 10 85 2727 828 35 261 3364 3857 91 525 3364 1071 63 18 3364 2853 73 612 3857 1020 47 525 3857 3695 56 200 4228 1052 100 525 4228 653 70 1 4261 2727 20 525 4261 4466 45 864 4268 4228 38 525 4268 2592 22 337 393 2504 30 682 393 4283 32 652 1280 4864 1 682 1280 2165 85 682 1280 308 10 506 1280 4202 48 230 1289 1280 95 682 1289 4837 75 249 1289 4142 37 796 1452 3439 64 682 1452 3231 91 471 1452 1521 36 617 2165 4191 91 682 2165 31 57 483 2386 3343 29 682 2386 1260 17 808 2504 2386 97 682 2504 1206 50 176 3343 1289 57 682 3343 4919 34 32 3343 4552 61 135 3439 4843 61 682 3439 2604 39 393 3439 3499 23 887 4191 1452 19 682 4191 1979 16 173 394 2331 14 215 394 2618 5 946 394 619 31 819 527 4558 2 215 527 4908 52 215 527 2845 76 235 953 3151 27 215 953 1482 72 949 1220 953 74 215 1220 3665 12 241 1220 2389 8 60 2331 1220 3 215 2331 769 53 239 2331 986 16 404 2441 2616 30 215 2441 315 1 562 2616 3271 65 215 2616 4736 20 468 2616 1441 100 720 3151 2441 42 215 3151 3801 74 622 3151 1241 34 73 3271 527 72 215 3271 4457 8 577 3271 3227 63 681 395 2336 32 632 395 598 62 456 395 2358 15 857 832 1837 35 632 832 4076 38 912 832 3239 16 27 1300 1792 43 632 1300 1846 40 180 1580 3771 69 632 1580 926 36 996 1580 2806 47 458 1792 3849 6 632 1792 1267 65 245 1837 1300 3 632 1837 4352 85 362 1837 1414 14 423 2336 1580 63 632 2336 3085 35 901 3481 832 31 632 3481 189 91 209 3583 3481 94 632 3583 4634 69 771 3583 2969 52 943 3771 3583 98 632 3771 976 90 845 3849 4911 21 632 3849 4697 48 632 3849 1939 34 517 396 1360 75 339 396 1692 87 499 973 4760 33 339 973 379 89 566 1360 3874 16 339 1360 2341 100 405 1360 3201 63 992 1853 2193 38 339 1853 4771 93 550 1853 4865 76 133 2193 4159 94 339 2193 1126 57 32 2193 1054 27 55 2253 4281 91 339 2253 4729 77 155 3874 2253 43 339 3874 4901 58 339 3874 4846 92 790 3874 3486 34 108 4159 973 33 339 4159 4106 48 428 4159 3081 77 265 4281 1853 46 339 4281 1232 36 202 4281 4690 46 919 397 1323 66 91 397 3119 77 45 397 3057 73 161 1323 3798 46 91 1323 4112 60 897 1585 2910 86 91 1585 341 60 539 1585 1105 89 469 2553 3547 47 91 2553 3022 90 963 2829 3468 29 91 2829 4765 78 91 2829 2982 54 583 2910 2829 93 91 2910 1201 66 123 2910 1817 18 243 3468 2553 9 91 3468 1383 2 67 3547 4784 21 91 3547 4507 99 348 3547 449 89 489 3798 1585 25 91 3798 1916 51 739 398 755 55 326 398 3184 88 482 398 4595 78 249 528 3552 27 326 528 386 96 199 755 528 78 326 755 4644 33 326 755 2791 19 354 755 3028 68 348 1379 4007 37 326 1379 1363 99 488 3552 1379 92 326 3552 1088 84 140 4007 4816 12 326 4007 548 60 292 4007 128 82 698 399 2611 38 8 399 832 89 188 399 1731 54 191 1247 2058 41 8 1247 1245 31 602 1247 4282 100 368 1359 1751 46 8 1359 4509 18 8 1359 710 48 840 1751 3400 79 8 1751 348 41 83 1751 4477 54 578 2058 4987 26 8 2058 616 78 879 2058 4516 19 583 2611 1359 46 8 2611 2427 37 56 2611 2678 63 460 3400 1247 28 8 3400 1961 33 39 3400 3807 17 296 400 922 44 413 400 2971 29 483 753 3176 37 413 753 4849 87 341 753 1831 12 52 922 1769 53 413 922 3604 51 471 1769 4338 71 413 1769 4946 42 413 1769 4436 64 721 3176 3696 100 413 3176 1857 35 299 3176 4607 77 123 3324 4761 95 413 3324 1012 30 975 3696 3324 40 413 3696 2864 42 734 3696 1379 65 19 4338 753 47 413 4338 1301 51 174 401 1938 92 448 401 3173 94 849 401 4047 18 566 1869 4649 79 448 1869 1655 96 189 1869 189 32 542 1938 1963 5 448 1938 3299 51 577 1938 3018 37 568 1963 3920 62 448 1963 2496 81 61 2142 4976 11 448 2142 3563 15 448 2142 4255 25 668 2142 3871 77 802 3563 3715 24 448 3563 4554 60 976 3715 1869 56 448 3715 2918 100 950 3920 2142 51 448 3920 1467 86 546 402 3171 38 597 402 2192 84 882 402 3855 69 90 2125 2858 79 597 2125 3193 32 516 2858 4383 46 597 2858 918 40 444 2858 2765 42 495 3171 3868 27 597 3171 4145 78 521 3868 2125 47 597 3868 4675 90 597 3868 4806 32 930 3868 4054 76 777 4383 4956 53 597 4383 4792 41 223 403 2900 42 854 403 546 51 229 403 1431 11 459 750 4545 55 854 750 4841 52 854 750 1007 81 958 1271 4001 97 854 1271 944 99 773 1623 3916 15 854 1623 936 63 32 1623 1364 57 487 1949 1623 8 854 1949 2706 64 431 2627 1949 18 854 2627 3645 34 483 2900 1271 96 854 2900 1270 68 958 3916 750 97 854 3916 3650 93 102 4001 2627 90 854 4001 2494 17 683 404 1962 35 227 404 2090 4 729 404 3234 84 559 1264 4395 71 227 1264 782 68 411 1264 1237 46 120 1962 2451 12 227 1962 4824 59 262 1962 1837 32 323 2076 4480 78 227 2076 3800 1 10 2076 2684 40 464 2451 2562 86 227 2451 4880 84 451 2562 1264 75 227 2562 3105 48 654 2562 1968 43 223 3065 4630 23 227 3065 194 84 423 3065 2165 59 539 3204 2076 65 227 3204 4412 17 594 3204 2492 100 16 4395 3204 65 227 4395 2480 89 581 4480 3065 37 227 4480 4972 16 227 4480 3924 95 606 4480 4499 13 616 405 2987 5 337 405 201 21 391 867 2113 51 337 867 1483 99 141 867 4932 48 330 2113 2707 3 337 2113 4403 72 5 2707 4965 11 337 2707 3591 89 281 2707 2775 71 308 2926 3195 71 337 2926 4510 57 51 2926 521 60 908 2987 2926 13 337 2987 1956 14 528 2987 1534 9 865 3195 867 13 337 3195 4916 3 337 3195 3030 15 319 406 1023 94 326 406 1736 28 13 1023 3028 77 326 1023 4696 39 326 1023 1908 56 200 1023 1821 54 766 2335 3896 5 326 2335 2740 54 946 2335 1191 30 272 3028 2335 59 326 3028 1583 84 22 3028 4744 34 528 3896 4553 84 326 3896 119 83 532 407 668 100 402 407 768 52 659 407 4505 84 935 668 2263 78 402 668 1020 42 607 945 1895 38 402 945 4705 51 172 1895 3087 13 402 1895 2498 38 857 1895 3231 26 68 2263 945 66 402 2263 2304 51 790 3087 3720 72 402 3087 4919 85 402 3087 289 4 891 3087 282 98 840 3720 4834 50 402 3720 2864 58 827 3720 3010 68 351 408 821 40 212 408 393 17 204 408 1466 89 501 740 4584 18 212 740 1541 28 222 740 4921 73 516 821 3660 59 212 821 2543 48 191 821 2493 10 149 1099 2239 23 212 1099 2143 80 459 1099 4072 16 677 2239 740 27 212 2239 2483 94 737 3530 4737 11 212 3530 1099 72 212 3530 4145 67 392 3660 3530 97 212 3660 3123 30 29 409 2839 69 265 409 1422 24 255 409 1368 40 874 536 4797 73 265 536 2819 64 547 728 3158 27 265 728 1432 62 892 728 1485 51 69 979 536 60 265 979 1477 58 148 979 1297 30 199 1055 2704 23 265 1055 1941 90 791 1055 618 5 191 2704 728 93 265 2704 1205 24 396 2839 1055 77 265 2839 4725 78 265 2839 13 83 837 2839 4698 18 495 3158 979 53 265 3158 4392 54 237 3158 2442 7 437 410 3197 54 415 410 2092 88 868 533 4811 77 415 533 805 54 799 533 992 57 221 849 2308 22 415 849 1054 55 335 1313 1456 50 415 1313 4687 56 415 1313 3569 25 298 1313 2378 1 176 1368 1313 51 415 1368 3322 21 48 1456 533 35 415 1456 2696 37 690 1456 519 89 424 2308 3177 93 415 2308 4977 81 708 2308 771 41 36 3177 1368 38 415 3177 4992 9 922 3177 349 75 59 3197 849 34 415 3197 2540 26 390 411 2250 34 239 411 2855 23 732 411 16 52 909 1232 1924 17 239 1232 2643 23 867 1429 1232 38 239 1429 4253 27 297 1429 4628 85 808 1924 2200 17 239 1924 1451 51 688 2168 1429 81 239 2168 635 93 648 2168 2206 27 342 2200 4838 93 239 2200 1889 34 341 2200 1169 93 85 2250 4810 17 239 2250 2749 36 239 2250 4392 94 422 2749 2168 45 239 2749 4741 95 377 2749 4404 75 620 412 1292 60 659 412 1801 77 143 412 2673 98 976 575 2705 38 659 575 2685 52 685 575 4980 89 662 907 4437 55 659 907 3897 34 380 907 1941 66 342 933 1380 33 659 933 3075 70 725 1217 933 50 659 1217 740 14 859 1292 907 69 659 1292 2586 57 101 1364 1217 68 659 1364 2406 78 763 1380 4895 19 659 1380 1798 30 469 1380 2935 19 430 2705 1364 62 659 2705 110 96 55 2705 2533 2 68 4437 575 6 659 4437 4737 24 659 4437 4501 10 922 4437 1983 45 540 413 3347 82 603 413 206 62 508 876 4640 89 603 876 4537 17 603 876 2106 61 550 876 2609 36 69 1635 876 17 603 1635 2738 81 181 1635 2929 76 703 3287 1635 24 603 3287 1694 51 220 3347 3739 15 603 3347 2744 32 508 3386 3287 75 603 3386 1612 96 869 3739 3386 45 603 3739 1869 83 680 3739 1050 32 660 414 3321 78 827 414 412 79 737 723 2006 58 827 723 1890 74 876 723 50 63 217 2006 3941 59 827 2006 209 75 429 2006 533 46 311 2505 4187 91 827 2505 2601 2 671 2505 2275 4 436 2649 723 68 827 2649 2547 74 786 3321 2505 59 827 3321 4869 58 827 3321 2533 65 58 3321 226 14 325 3941 4902 35 827 3941 1221 33 387 3941 656 43 694 4187 2649 8 827 4187 3910 88 688 415 4447 15 28 415 4347 66 705 415 4077 80 532 1363 4690 75 28 1363 4855 36 98 2492 1363 49 28 2492 4589 58 800 3210 3650 11 28 3210 2217 55 88 3210 2897 26 85 3333 2492 3 28 3333 2840 63 882 3650 3333 77 28 3650 4522 73 580 4447 3210 82 28 4447 4697 45 28 4447 1168 48 716 416 1575 33 309 416 3415 100 458 416 4499 89 882 693 4344 59 309 693 3800 79 904 1059 693 4 309 1059 2902 29 988 1575 2788 30 309 1575 1870 76 683 1575 63 50 344 1700 4856 90 309 1700 389 26 11 2788 4295 46 309 2788 706 56 42 2788 1608 80 868 4295 4828 87 309 4295 1059 52 309 4295 1714 38 63 4344 1700 64 309 4344 1288 71 268 417 828 33 384 417 1264 10 421 417 527 55 390 828 4392 4 384 828 3839 14 563 828 1551 63 982 1664 1873 12 384 1664 4746 68 593 1664 2159 9 203 1873 3094 80 384 1873 4611 90 384 1873 509 58 358 1873 2880 39 371 2787 1664 76 384 2787 4427 86 77 2904 4048 99 384 2904 4076 10 666 2904 4995 1 898 3094 2904 25 384 3094 3446 75 725 3772 2787 18 384 3772 1142 69 504 3772 312 30 919 4048 4906 68 384 4048 3177 20 877 4392 3772 94 384 4392 1233 46 485 418 2087 20 115 418 1212 64 356 618 1304 22 115 618 2146 98 633 642 4757 49 115 642 331 6 262 1200 618 42 115 1200 1111 58 764 1211 1900 10 115 1211 3669 60 669 1304 1211 19 115 1304 1377 17 935 1304 1508 93 57 1900 642 60 115 1900 2940 40 259 2087 2968 30 115 2087 4182 75 242 2968 1200 55 115 2968 4719 7 115 2968 3512 58 894 2968 2553 67 636 419 4050 58 386 419 4171 18 29 1194 2516 6 386 1194 1033 20 649 1263 1194 38 386 1263 1564 31 844 1263 1745 82 444 1324 2975 26 386 1324 1628 28 228 1324 3326 75 692 2516 3119 23 386 2516 1529 12 523 2516 3231 3 908 2951 4994 92 386 2951 1263 29 386 2951 313 65 822 2975 2951 34 386 2975 4927 1 982 3119 4619 56 386 3119 2982 57 774 3119 2334 47 827 4050 1324 34 386 4050 3856 57 246 420 805 82 342 420 3945 48 664 805 3991 86 342 805 1198 93 391 805 1093 76 265 1056 2277 70 342 1056 611 24 677 1056 1179 1 503 1366 2011 8 342 1366 3687 81 491 1366 467 10 332 2011 4851 91 342 2011 1056 94 342 2011 1565 56 655 2277 3943 18 342 2277 565 12 314 3943 4753 80 342 3943 2199 53 546 3991 1366 76 342 3991 4172 89 667 3991 4264 28 954 421 1063 74 523 421 4589 73 933 606 1302 96 523 606 3904 98 789 1063 2746 57 523 1063 522 94 274 1302 4570 17 523 1302 1370 16 523 1302 1038 25 324 1370 4408 55 523 1370 1890 2 604 2322 606 64 523 2322 761 53 11 2746 3654 45 523 2746 4433 10 952 2746 2508 24 131 3654 2322 76 523 3654 2504 8 228 4408 4565 21 523 4408 887 89 683 422 2476 68 309 422 318 56 149 1273 4200 12 309 1273 537 43 291 1411 2062 14 309 1411 3918 60 596 1411 4720 72 960 1866 4803 37 309 1866 4141 36 711 1866 3677 86 752 1903 4502 36 309 1903 4166 80 309 1903 308 13 974 1903 3450 67 613 2062 1866 50 309 2062 2119 31 375 2476 1273 22 309 2476 2697 81 125 3299 1903 76 309 3299 19 42 974 3299 4445 85 488 4166 1411 99 309 4166 42 19 618 4166 210 72 561 4200 3299 55 309 4200 196 44 742 4200 1940 97 524 423 1392 45 204 423 2126 67 347 423 2610 48 815 960 3781 65 204 960 4928 49 110 1392 2241 48 204 1392 1061 1 32 2241 3980 12 204 2241 376 84 807 2241 3984 30 552 3047 4546 51 204 3047 4535 90 176 3781 3047 78 204 3781 4796 36 204 3781 3178 41 395 3781 1563 95 617 3980 960 40 204 3980 3379 99 163 424 1908 38 264 424 1245 27 774 666 4535 74 264 666 3489 5 335 666 1423 10 855 1490 4021 29 264 1490 799 13 813 1490 713 27 301 1798 666 28 264 1798 2610 71 774 1908 1490 100 264 1908 1266 14 577 1908 3556 31 854 4021 1798 41 264 4021 4626 15 264 4021 4221 23 778 425 742 79 632 425 283 92 794 610 3427 69 632 610 2266 78 496 610 4716 53 474 742 1898 78 632 742 2133 26 278 742 975 88 640 1303 2901 48 632 1303 185 6 944 1303 902 20 550 1898 4238 43 632 1898 4634 87 632 1898 1825 92 951 2827 2941 87 632 2827 3296 33 57 2901 4953 70 632 2901 4677 49 632 2901 4661 80 995 2901 3433 19 55 2941 1303 82 632 2941 621 36 245 2941 4479 34 673 3427 3976 14 632 3427 1414 5 83 3533 610 40 632 3533 925 100 186 3533 1917 70 800 3976 2827 72 632 3976 4160 81 240 4238 4331 50 632 4238 3282 33 223 4238 4356 45 878 4331 3533 24 632 4331 2401 98 179 4331 184 48 798 426 3933 24 692 426 1951 90 104 426 3461 46 108 604 4909 33 692 604 3853 82 639 604 3610 6 262 2246 4683 52 692 2246 2300 92 692 2246 3774 88 313 2300 604 72 692 2300 2074 82 633 3933 4339 69 692 3933 4004 5 609 3933 1143 8 313 4339 2246 63 692 4339 2946 81 578 427 3526 56 930 427 2645 60 376 2478 4623 35 930 2478 3954 70 930 2478 2649 65 121 2478 896 1 534 3289 4079 8 930 3289 965 9 588 3526 3289 49 930 3526 2068 79 76 3526 757 14 885 3633 3810 35 930 3633 2958 42 333 3633 3627 4 384 3810 4829 21 930 3810 4860 97 746 3954 3633 76 930 3954 2150 76 304 4079 2478 22 930 4079 4414 42 237 428 2461 31 648 428 4556 8 434 428 1608 34 549 2155 4576 71 648 2155 2407 36 648 2155 4521 47 107 2155 1981 11 180 2407 4913 43 648 2407 4557 97 279 2461 4142 32 648 2461 3834 72 311 4142 2155 60 648 4142 297 30 514 4142 3369 22 726 429 2304 61 404 429 1033 16 225 2187 3410 63 404 2187 2531 50 443 2304 3927 12 404 2304 4540 9 404 2304 1716 9 670 2304 899 33 84 2305 2187 60 404 2305 4270 59 607 2305 3425 63 808 2369 2305 27 404 2369 1094 95 23 2369 2972 2 930 2895 2369 5 404 2895 4314 12 795 2895 3988 36 459 3410 4624 89 404 3410 3446 79 498 3410 3536 39 5 3927 4090 23 404 3927 1334 23 888 4090 2895 90 404 4090 868 25 406 4090 1244 20 233 430 3342 21 264 430 933 33 242 621 4439 18 264 621 4852 2 877 621 3474 46 807 3266 4974 54 264 3266 2799 68 775 3266 3876 75 314 3342 3978 47 264 3342 4703 89 988 3342 1512 60 720 3978 4737 57 264 3978 621 10 264 3978 4006 15 317 4439 3266 38 264 4439 2888 38 135 431 1123 63 1014 431 2610 86 52 1082 3897 9 1014 1082 2593 36 704 1082 4390 11 787 1123 1643 49 1014 1123 765 13 105 1123 3548 54 673 1643 4493 38 1014 1643 2835 13 297 1643 2331 94 223 3008 3843 62 1014 3008 1050 87 25 3123 3008 32 1014 3123 3740 51 184 3123 4929 83 469 3843 4845 87 1014 3843 1082 31 1014 3843 4650 1 432 3897 4573 10 1014 3897 4243 81 158 4493 3123 21 1014 4493 680 46 693 432 1731 91 298 432 3089 94 816 432 3482 54 964 1731 3406 71 298 1731 2667 54 715 1767 2725 61 298 1767 2041 12 747 1767 2160 18 812 1933 1767 54 298 1933 4937 71 298 1933 19 3 874 1933 2477 75 123 2696 4757 19 298 2696 4213 92 57 2725 2696 41 298 2725 3001 40 348 3406 1933 1 298 3406 1612 44 329 3406 2186 21 836 433 2958 38 498 433 742 67 917 1606 3852 70 498 1606 4918 4 776 2177 1606 61 498 2177 4430 83 407 2177 1288 66 602 2688 2177 20 498 2688 4510 16 498 2688 1322 75 651 2791 2688 25 498 2791 3957 85 566 2791 1103 75 170 2958 2791 23 498 2958 4833 78 14 2958 4857 60 499 3742 4862 98 498 3742 517 22 974 3742 3183 96 765 3852 3742 5 498 3852 4919 98 344 434 1276 86 36 434 4871 90 531 434 1378 72 399 1072 3128 81 36 1072 4959 73 36 1072 4181 33 116 1072 1532 30 297 1276 1072 93 36 1276 3779 57 103 1276 4545 1 534 1401 4643 64 36 1401 3103 81 825 1892 2144 8 36 1892 1992 94 274 1892 4899 59 619 2144 1401 36 36 2144 1634 19 34 2144 3635 44 660 3128 3416 91 36 3128 2561 20 223 3128 4679 87 756 3416 1892 100 36 3416 3117 75 861 435 585 11 141 435 2795 67 117 435 1996 38 507 585 3611 46 141 585 1921 97 277 585 286 51 527 944 4908 29 141 944 288 91 270 1665 4838 23 141 1665 3012 76 141 1665 869 94 142 1665 4774 44 965 3012 3029 14 141 3012 1802 57 826 3012 250 2 107 3029 944 74 141 3029 1857 86 290 3611 1665 58 141 3611 321 37 269 436 1154 99 957 436 1409 93 395 436 434 17 925 906 1595 5 957 906 4542 39 957 906 164 2 47 906 1126 69 963 1154 1335 15 957 1154 4305 54 456 1184 906 48 957 1184 2088 21 443 1335 4282 20 957 1335 446 74 128 1595 4873 79 957 1595 2784 72 784 1595 1143 97 23 2149 1184 37 957 2149 3905 55 63 2149 710 68 621 4282 2149 89 957 4282 2523 17 959 437 1134 60 574 437 4496 10 304 1018 3272 83 574 1018 2980 96 162 1031 3064 54 574 1031 2816 73 426 1134 1018 30 574 1134 4530 29 574 1134 2018 67 593 1134 2387 96 401 1710 1031 45 574 1710 1988 16 29 1710 3546 1 549 3064 4526 41 574 3064 3919 16 732 3272 1710 90 574 3272 2440 58 446 438 4256 99 507 438 4889 74 409 958 4192 10 507 958 1754 10 883 1287 2532 42 507 1287 1303 24 390 1287 973 64 502 2286 958 55 507 2286 3023 29 298 2532 3618 37 507 2532 253 56 375 2532 1873 17 946 3319 2286 89 507 3319 780 60 60 3319 3704 43 527 3618 4800 5 507 3618 4683 90 507 3618 3879 54 807 3618 4379 55 760 4192 1287 52 507 4256 4332 62 507 4256 4300 73 774 4332 3319 84 507 4332 222 70 19 439 4095 14 257 439 2258 9 709 1480 2311 22 257 1480 4749 82 257 2023 4633 69 257 2023 596 42 242 2311 2870 100 257 2311 1675 57 224 2311 2088 91 113 2648 1480 72 257 2870 2023 55 257 2870 1869 53 768 4095 2648 81 257 4095 3689 80 703 440 1284 37 531 440 686 57 423 440 1740 74 566 627 3768 56 531 722 4640 99 531 722 1111 44 183 985 3561 32 531 985 291 37 594 1284 627 47 531 1284 500 54 11 1284 407 9 21 2025 722 87 531 3286 2025 47 531 3286 837 78 468 3561 3286 5 531 3561 3990 13 447 3561 138 65 515 3768 4327 51 531 3768 4778 45 531 4327 985 28 531 441 509 77 1178 441 2704 41 431 509 2022 31 1178 509 61 51 433 509 2606 51 543 647 3409 44 1178 1572 647 5 1178 1572 2098 90 345 2022 3381 83 1178 2022 4743 3 1178 2219 3485 6 1178 2219 4198 2 234 2415 2219 44 1178 2415 1742 28 284 2671 3107 41 1178 2671 4613 45 292 3107 4781 69 1178 3107 1289 17 273 3381 1572 22 1178 3381 4547 75 909 3381 1073 33 581 3409 3575 91 1178 3409 4733 69 1178 3485 2671 45 1178 3575 2415 19 1178 3575 688 2 855 442 2809 76 689 442 4350 73 576 442 3644 90 721 772 4246 92 689 1218 1311 71 689 1218 4301 99 526 1218 1448 31 497 1311 4487 75 689 1348 1810 49 689 1348 3360 58 333 1810 3644 38 689 1810 1634 61 310 1810 1967 88 275 2569 4830 36 689 2809 772 86 689 2809 4685 33 306 3644 1218 73 689 3644 1504 5 219 3644 2419 46 269 4246 1348 27 689 4487 2569 66 689 4487 4824 70 689 443 2278 90 445 443 738 89 376 443 101 88 290 918 2830 54 445 1135 4910 64 445 1135 2556 32 864 1321 1946 70 445 1321 94 50 682 1612 3747 54 445 1612 1007 4 76 1946 1135 60 445 1946 4129 91 583 1946 4158 80 602 2278 918 11 445 2278 4512 30 445 2544 1321 3 445 2830 1612 73 445 2830 2721 57 98 3747 2544 60 445 3747 4874 17 505 3747 725 84 618 444 1756 55 422 1410 4552 99 422 1410 3226 68 201 1659 1872 88 422 1659 2856 98 478 1659 3267 63 773 1756 1659 50 422 1872 3621 58 422 1872 522 40 693 2348 1410 99 422 2348 4564 75 422 3621 3678 21 422 3621 4337 87 167 3678 4111 36 422 3678 443 79 644 4111 2348 54 422 4111 1892 35 420 445 1755 17 1222 445 3943 13 601 445 2542 79 88 995 4584 85 1222 1329 995 69 1222 1329 2491 88 540 1329 3914 88 257 1755 2923 22 1222 1870 2739 9 1222 1870 1971 64 39 2121 4044 13 1222 2121 21 1 507 2146 2734 36 1222 2146 3343 63 562 2146 3549 21 39 2734 4948 18 1222 2734 1870 53 1222 2739 1329 28 1222 2923 2121 36 1222 2923 2184 30 786 4044 2146 43 1222 4044 381 44 687 446 3737 67 404 446 1920 41 526 446 2117 39 641 1795 4925 89 404 1795 4854 11 404 2172 3905 33 404 3723 1795 43 404 3723 1588 53 584 3737 2172 20 404 3737 3410 84 277 3737 804 26 719 3905 3723 54 404 447 4470 69 516 447 2609 86 728 950 4608 95 516 950 582 83 719 2429 3549 96 516 2429 1407 32 282 2429 3634 54 996 2795 3705 9 516 3549 2795 73 516 3549 3319 50 178 3705 950 81 516 3705 1788 55 860 3705 955 73 438 4470 2429 5 516 4470 4844 97 516 448 2826 45 298 955 1122 47 298 955 3479 32 363 1122 1171 59 298 1122 4643 96 298 1171 3312 12 298 1171 1826 28 767 1171 1545 64 428 1788 4986 27 298 2826 955 37 298 2826 578 46 526 2826 4940 22 287 3312 1788 62 298 449 1336 86 359 449 2178 62 946 628 4986 16 359 628 132 51 224 1210 4985 61 359 1210 1907 59 359 1336 1210 47 359 1336 785 44 447 1907 628 15 359 1907 1879 57 527 450 596 16 196 450 709 40 193 596 2845 55 196 596 3765 30 312 596 3339 74 79 858 3925 38 196 937 1252 50 196 937 4691 9 886 989 937 19 196 989 4990 32 196 1252 858 1 196 1252 372 77 975 2845 989 86 196 2845 4952 16 771 3925 4913 29 196 3925 4068 15 906 451 2536 80 394 451 680 94 499 1819 4823 68 394 1819 1728 4 791 1835 2033 45 394 1835 1863 85 329 1835 2619 33 731 2033 2463 93 394 2388 1835 74 394 2388 892 63 318 2463 1819 14 394 2463 4830 34 394 2536 2690 72 394 2536 657 13 768 2690 2388 8 394 2690 2830 99 924 2690 1269 63 717 452 3638 17 412 638 2222 55 412 638 4801 44 171 1342 1777 21 412 1342 294 12 584 1607 4352 5 412 1607 3073 72 449 1607 2195 45 548 1619 638 7 412 1777 4841 78 412 1777 1906 66 412 1906 2002 1 412 1906 3759 2 38 1906 1997 21 610 2002 4514 58 412 2222 1607 27 412 2222 625 81 3 3368 1619 4 412 3368 3415 25 706 3368 1243 55 315 3452 4645 22 412 3452 1342 27 412 3638 3368 50 412 4352 3452 8 412 4352 4706 16 255 4352 4834 4 734 453 1241 77 276 1241 2329 69 276 1241 3434 57 216 1241 1835 12 16 2329 2379 2 276 2379 3528 31 276 2379 261 65 592 3010 4907 71 276 3010 4066 42 880 3528 3565 20 276 3528 4509 37 276 3565 3010 50 276 3565 3356 53 883 3565 4845 18 491 454 2333 58 484 542 2145 93 484 542 1147 53 410 786 3641 43 484 786 1396 12 603 786 4512 13 819 2016 542 78 484 2145 3578 29 484 2145 3048 7 22 2333 4412 34 484 2333 4518 80 282 2333 4173 23 438 2417 4204 52 484 3578 786 34 484 3578 3466 14 625 3641 4913 3 484 3641 665 68 346 4204 2016 51 484 4204 4542 51 484 4412 2417 35 484 4412 294 28 624 4412 3289 61 230 455 2814 72 635 1785 2273 44 635 1785 2312 20 949 1808 1785 90 635 1808 4525 16 268 1808 2134 22 249 2273 2292 47 635 2292 4410 2 635 2292 1905 60 684 2732 4793 30 635 2732 3900 1 501 2732 1011 69 909 2814 1808 25 635 2984 2732 60 635 2984 1046 22 402 3620 2984 76 635 3620 4676 70 938 3620 3628 52 343 4410 3620 27 635 4410 4962 59 635 456 1508 72 204 1233 2672 45 204 1233 2614 53 411 1482 1233 21 204 1482 505 90 879 1508 2679 27 204 1508 1683 34 51 1508 4526 83 883 1574 4774 26 204 2226 1574 97 204 2226 3461 16 276 2672 2226 24 204 2672 1078 42 600 2672 4104 34 693 2679 1482 34 204 2679 4817 99 204 457 2057 25 826 1047 1960 67 826 1047 4884 76 826 1449 4473 3 826 1449 183 87 454 1960 3190 84 826 1960 1588 29 253 1960 733 83 682 2057 1047 56 826 3190 1449 75 826 3190 1834 25 684 3190 3429 95 857 4473 4554 1 826 458 688 33 169 458 3560 79 587 688 1332 38 169 688 4861 69 169 1332 2790 39 169 1332 2326 79 722 1332 4161 100 253 2790 3226 70 169 3226 4129 66 169 3226 1544 51 811 3226 1015 51 848 4129 4934 58 169 459 2778 19 361 459 1608 22 283 685 3625 72 361 685 3346 32 832 685 1369 28 607 1175 2614 69 361 1515 1530 38 361 1515 785 78 272 1515 4211 34 995 1530 4996 37 361 2614 4039 88 361 2614 4608 2 361 2778 3247 72 361 2778 2811 20 948 3247 685 67 361 3247 1998 2 10 3625 1175 11 361 3625 268 84 16 4039 1515 38 361 4039 1433 65 536 460 4032 61 906 460 1230 54 949 460 3942 76 972 923 2252 56 906 1240 3199 63 906 1240 3890 69 991 1240 4353 60 31 2252 4788 32 906 2252 4685 7 906 2695 4454 71 906 3199 2695 3 906 3199 1789 2 554 3519 923 19 906 3519 3083 31 675 3519 242 59 887 4032 4340 49 906 4340 1240 71 906 4340 3480 56 50 4454 3519 36 906 4454 863 13 97 461 3212 70 1143 461 284 36 253 461 4996 93 135 564 913 96 1143 863 4879 87 1143 863 4981 93 1143 913 2479 43 1143 913 1786 16 992 913 2453 69 42 1494 863 100 1143 2126 4233 43 1143 2126 4272 4 733 2126 3969 67 784 2479 3425 98 1143 3212 2126 46 1143 3212 4687 90 256 3212 2716 10 560 3425 1494 47 1143 4233 564 59 1143 4233 2357 70 201 462 3872 6 484 462 306 57 119 752 1213 29 484 752 633 80 560 852 4488 39 484 852 3620 74 832 852 4280 2 118 920 2195 21 484 1213 852 76 484 1213 2627 19 865 1213 3699 51 35 2098 920 87 484 2195 2674 14 484 2195 4642 42 484 2674 3821 43 484 2674 1082 43 985 2674 1188 87 323 3821 752 66 484 3872 2098 68 484 3872 3065 93 711 4488 4916 63 484 4488 3428 96 536 463 4308 23 670 463 2581 4 130 463 3574 76 36 503 2186 6 670 905 4631 39 670 905 4274 32 574 905 990 23 55 1221 905 67 670 2186 4945 15 670 2186 1221 39 670 4308 503 40 670 4308 806 24 833 464 3391 55 248 464 393 39 694 1507 4789 18 248 1507 1449 86 875 2207 1507 5 248 2207 2070 9 596 2207 570 20 944 2363 3636 66 248 3391 2363 19 248 3391 3834 28 661 3391 221 4 699 3636 2207 100 248 3636 4573 55 248 465 2499 92 94 756 2235 34 94 756 4026 19 753 756 3461 29 976 785 1067 7 94 1067 1133 98 94 1067 4528 88 13 1133 756 86 94 1133 701 7 185 1133 2571 60 911 1734 2875 84 94 2235 4838 22 94 2235 1763 20 810 2499 3831 75 94 2499 2136 1 854 2875 4635 87 94 2875 785 69 94 3831 1734 15 94 3831 1890 69 466 3831 2931 45 215 466 2677 23 109 640 3670 53 109 640 2159 35 920 1362 3169 91 109 1362 3500 25 202 2468 3397 47 109 2468 284 54 819 2677 1362 57 109 2677 3378 83 278 2677 2712 58 521 3169 2468 16 109 3397 3973 18 109 3397 4836 50 235 3670 4728 56 109 3670 4608 68 109 3973 640 50 109 3973 3295 78 137 3973 4064 36 764 467 4153 77 506 774 3305 4 506 774 4988 92 387 774 2008 46 403 1095 1994 41 506 1994 774 38 506 1994 4963 26 908 2138 2626 21 506 2138 836 75 514 2138 938 2 810 2626 4961 18 506 2626 1095 48 506 2860 4293 90 506 3305 2860 31 506 3305 117 21 660 4153 2138 78 506 4153 2631 62 917 4293 4769 4 506 4293 3075 88 838 468 615 42 718 468 2001 61 706 615 3693 16 718 615 3101 27 543 684 4668 3 718 684 3134 91 718 813 4681 47 718 813 731 47 115 2733 684 27 718 2733 3238 52 128 2733 1752 58 809 3134 813 57 718 3460 2733 100 718 3460 3551 2 729 3693 3460 64 718 3693 1545 58 176 3693 4703 30 558 469 1388 44 381 520 1402 85 381 520 3704 94 431 1388 2617 6 381 1388 1347 25 885 1402 4949 78 381 1402 403 83 83 2617 4649 9 381 2617 3707 78 381 2917 4213 16 381 2917 1651 75 703 3160 2917 32 381 3160 3488 17 708 3707 3160 57 381 3707 4925 77 958 3707 4892 85 547 4213 520 36 381 470 1019 29 1110 470 1900 96 388 519 733 73 1110 519 3056 78 105 733 4932 97 1110 733 3137 22 177 733 4724 80 753 1019 2944 96 1110 2568 519 43 1110 2568 1364 30 90 2944 4234 51 1110 2944 4630 91 1110 4124 2568 46 1110 4124 1272 24 671 4124 1291 45 125 4234 4124 18 1110 471 3228 4 414 471 809 23 33 517 4774 98 414 517 3400 76 520 517 881 75 401 1634 517 11 414 1634 4967 11 414 2443 1634 48 414 3228 3564 48 414 3228 1877 38 867 3228 4718 41 479 3564 2443 94 414 472 3182 1 1002 472 4334 61 17 1195 4424 21 1002 1195 644 45 89 3182 3211 61 1002 3182 1228 38 331 3182 2767 83 414 3211 3469 53 1002 3469 1195 59 1002 3469 4626 65 1002 4424 4855 29 1002 4424 4598 45 750 473 801 85 327 473 3783 22 467 801 3108 97 327 801 4465 98 235 801 990 10 255 1109 3297 47 327 2736 1109 7 327 2736 3667 14 728 2736 1953 57 838 3108 4276 2 327 3108 4643 68 327 3297 4287 10 327 4276 2736 41 327 4276 2372 13 232 4276 659 98 203 4287 4511 41 327 474 1759 71 452 474 1202 60 963 474 1947 1 278 1418 3689 29 452 1581 1779 34 452 1581 155 27 674 1581 1757 23 5 1759 2940 17 452 1779 2020 14 452 1779 1126 28 687 2020 1418 78 452 2020 3331 78 461 2940 1581 91 452 2940 3331 33 696 2940 932 89 994 3689 4601 24 452 3689 4656 84 452 475 3835 33 379 3046 4856 71 379 3046 3842 31 379 3244 4914 19 379 3244 2721 15 574 3244 755 89 504 3835 3046 66 379 3842 4391 33 379 3842 397 39 528 3842 4182 90 694 4391 3244 39 379 476 2847 50 315 476 1987 52 512 1766 4735 19 315 1766 3943 75 348 1766 1717 60 682 2119 4795 92 315 2119 1766 62 315 2847 2889 11 315 2889 2119 68 315 2889 645 62 246 477 2234 37 1012 477 3926 94 40 477 4325 96 37 901 4586 63 1012 2234 3699 4 1012 2234 2332 32 190 2603 2702 32 1012 2603 2682 67 578 2702 901 96 1012 2702 1231 45 546 3699 4481 40 1012 3699 2501 39 825 3699 651 76 225 4481 2603 17 1012 4481 4777 74 1012 478 1138 29 572 620 2442 87 572 620 4799 25 572 712 4314 79 572 712 330 13 806 712 1036 94 380 718 4867 79 572 1002 620 56 572 1002 320 79 189 1002 1845 37 413 1138 1002 25 572 1831 3982 61 572 1831 2423 47 660 1831 83 95 457 2442 1831 1 572 3982 712 13 572 3982 4008 60 951 3982 804 28 389 4314 718 70 572 479 3056 99 421 479 1720 48 494 479 2994 87 983 614 3110 28 421 1190 1999 61 421 1190 4183 14 467 1999 2490 46 421 1999 4752 55 421 2490 614 54 421 2490 2830 63 120 2490 509 88 457 3056 1190 39 421 3110 4917 19 421 3110 4719 72 770 480 1197 79 653 480 2349 3 855 567 3560 30 653 567 3864 28 397 1197 2782 80 653 1197 3207 84 798 1197 2835 51 23 2265 2323 5 653 2323 2401 81 653 2323 2111 89 443 2401 4900 35 653 2401 4779 95 712 2580 567 92 653 2580 347 9 911 2580 272 2 574 2782 4452 83 653 3560 4663 7 653 3560 2265 68 653 4452 2580 1 653 4452 109 68 866 481 3653 30 492 481 1158 54 611 481 4867 73 62 970 4807 72 492 970 4674 41 492 2107 4188 5 492 2692 970 67 492 2692 3213 50 988 2692 4241 50 605 2985 2692 23 492 3653 2107 89 492 3653 2628 70 350 3653 532 77 650 4188 2985 96 492 482 3115 32 485 482 2195 58 890 482 451 30 743 2290 3710 74 485 3115 4441 79 485 3115 3739 9 273 3115 148 94 4 3317 4370 97 485 3626 2290 26 485 3626 4861 91 319 3710 4518 95 485 3710 4031 11 58 4370 4449 3 485 4370 4956 4 563 4370 3800 6 925 4441 3317 42 485 4449 3626 63 485 4449 4831 19 485 483 2903 65 91 483 4926 11 69 1617 4630 39 91 1617 1306 2 85 2899 3994 99 91 2899 4943 13 804 2899 1864 23 903 2903 2899 82 91 3568 3958 71 91 3568 4676 80 265 3568 368 89 470 3958 1617 2 91 3994 3568 45 91 3994 4698 67 91 484 930 24 667 484 1368 56 873 504 4557 5 667 504 4526 83 667 930 1228 12 667 930 134 46 698 1208 1965 21 667 1208 3324 36 250 1228 2396 49 667 1228 2148 57 84 1228 4310 100 47 1965 504 77 667 2396 1208 19 667 2396 4818 43 661 2396 2734 39 612 485 2653 69 793 806 3143 80 793 806 2430 84 292 806 4140 98 277 1868 2283 47 793 1981 1868 63 793 1981 334 29 143 2283 4825 39 793 2283 4971 73 793 2653 806 76 793 2653 523 86 727 2653 459 17 92 3143 1981 100 793 486 808 61 192 486 1234 8 729 605 2757 4 192 605 1666 13 180 808 1334 27 192 808 4553 84 192 986 2660 94 192 986 4876 64 635 1334 2389 38 192 1334 992 17 160 1334 2674 87 897 2389 2760 19 192 2660 3851 74 192 2660 1535 44 24 2660 1109 23 732 2757 986 94 192 2760 605 32 192 2760 4233 65 308 2760 1939 32 817 3851 4080 68 192 4080 4670 47 192 4080 2428 50 321 487 3862 93 631 487 2662 87 672 2275 2962 88 631 2275 1263 60 511 2962 3527 90 631 2962 4840 55 568 2962 30 37 313 3527 4892 17 631 3862 4455 86 631 3862 2891 77 680 4055 4955 45 631 4055 2275 18 631 4455 4055 61 631 4455 4452 23 503 488 3724 29 404 488 1273 40 139 488 3989 86 350 553 1989 92 404 1094 4548 54 404 1094 4568 20 404 1989 2370 65 404 1989 1907 65 885 1989 2064 20 235 2370 1094 28 404 3724 553 18 404 3724 2427 49 523 3724 2598 8 273 489 1124 21 635 507 4763 4 635 507 818 46 445 1124 1842 100 635 1124 915 74 515 1124 127 11 220 1842 3901 48 635 2556 4879 61 635 2556 3426 65 635 3426 507 28 635 3426 3730 76 572 3426 3251 23 355 3901 3970 52 635 3970 2556 67 635 3970 522 23 772 3970 3556 63 386 490 1601 85 60 1502 4174 71 60 1502 2646 67 431 1601 1502 4 60 1601 2227 62 652 2153 4407 70 60 2153 2783 47 808 2153 103 24 669 2781 4577 99 60 3766 4058 53 60 3766 158 4 916 4058 2781 81 60 4058 4795 29 60 4174 2153 24 60 4174 604 51 600 4174 3813 26 45 4407 3766 11 60 491 3953 91 252 491 202 28 44 491 2189 90 337 1282 2714 42 252 2714 4425 95 252 2714 4780 47 811 3712 4656 84 252 3712 644 1 753 3841 1282 33 252 3841 4305 5 918 3870 3841 64 252 3870 2399 11 578 3870 1084 72 711 3953 3870 4 252 4425 3712 74 252 4425 4949 43 252 492 1543 5 739 492 4164 96 549 720 4679 96 739 720 2743 81 594 1199 4746 21 739 1199 2230 7 739 1543 2742 66 739 1543 3269 33 508 2230 720 78 739 2230 1507 75 372 2742 1199 11 739 2742 440 28 422 493 539 25 117 493 345 11 946 539 1104 97 117 539 4135 56 631 765 3727 56 117 765 418 51 106 765 4865 82 943 1104 1427 39 117 1270 765 72 117 1270 3572 40 20 1427 2024 64 117 1427 1394 52 839 2024 1270 27 117 2024 3528 97 202 2629 4825 16 117 2629 4642 24 117 3727 2629 57 117 3727 2758 74 902 494 3166 22 412 494 88 34 479 595 4527 82 412 595 2959 69 973 595 292 13 391 771 2927 71 412 771 4571 63 412 834 595 29 412 1567 834 48 412 1567 2405 38 32 1567 2417 27 501 2927 3719 62 412 3040 771 1 412 3040 3488 33 468 3040 372 17 136 3166 3040 35 412 3569 1567 89 412 3569 248 33 103 3569 184 70 422 3719 3569 4 412 495 639 61 804 495 303 11 66 495 3767 42 178 639 1814 32 804 1458 3332 76 804 1458 1653 56 518 1458 99 88 693 1475 4465 60 804 1475 4752 53 804 1814 4162 65 804 2470 1475 65 804 2470 4743 20 939 2470 1129 44 475 2635 1458 32 804 3332 4916 2 804 3332 3363 89 506 3332 2003 4 734 3987 2635 97 804 4162 2470 96 804 4162 1159 51 634 4465 3987 42 804 4465 3464 65 125 496 4006 4 472 496 1569 32 916 496 3329 15 557 1644 4895 12 472 2485 3384 25 472 2485 3921 14 548 2485 4800 78 850 3144 3777 68 472 3384 1644 84 472 3384 3095 24 410 3777 2485 96 472 3777 2263 6 983 4006 3144 70 472 4006 4843 21 472 497 3652 98 672 497 1880 13 988 497 4595 38 640 1286 2373 41 672 1331 1286 46 672 1331 4069 66 114 1445 1833 90 672 1445 1802 66 201 1445 4101 31 77 1833 2862 54 672 2373 3023 51 672 2373 4652 55 672 2862 4634 48 672 2862 1806 93 847 2862 3228 48 18 3023 1445 48 672 3652 1331 25 672 3652 3832 73 64 3652 915 43 261 498 2182 23 833 1571 1847 31 833 1571 3728 39 468 1571 3669 32 943 1847 4657 100 833 2182 2836 97 833 2182 1969 77 153 2319 1571 14 833 2319 2103 83 602 2836 2319 83 833 2836 4958 78 833 499 2255 49 1251 499 2214 85 522 499 1111 8 694 1939 4556 52 1251 2179 3423 44 1251 2179 4580 54 894 2179 4216 11 716 2255 3383 7 1251 3383 4689 69 1251 3383 2179 85 1251 3423 1939 67 1251 3423 3313 38 767 500 1446 59 638 500 1573 90 877 1015 4751 77 638 1015 4618 23 638 1015 4773 27 638 1015 4723 60 638 1015 2762 17 638 1015 4857 26 638 1015 4563 46 638 1015 4997 87 638 1015 4678 29 638 1015 4899 48 638 1015 4921 8 638 1015 4632 64 638 1015 4870 55 638 1015 4859 30 638 1446 3566 64 638 1446 4521 94 638 1446 4812 86 638 1446 4927 59 638 1446 4612 74 638 1446 4818 71 638 1446 4713 28 638 1446 4918 16 638 1446 4592 57 638 1446 4756 79 638 1446 4664 67 638 1446 4871 17 638 2762 4885 22 638 2762 4562 7 638 2762 4912 7 638 2762 4819 53 638 2762 4724 24 638 2762 4964 82 638 2762 4878 87 638 2762 4711 40 638 2762 4775 66 638 2762 4262 68 638 2762 4779 20 638 2762 4814 13 638 2762 4599 86 638 3100 4943 23 638 3100 4936 90 638 3100 4933 82 638 3100 4915 64 638 3100 4501 1 638 3100 4801 45 638 3100 4732 14 638 3100 1015 10 638 3100 4832 86 638 3100 4973 10 638 3100 4813 62 638 3566 4550 61 638 3566 3100 1 638 3566 4865 19 638 3566 4808 38 638 3566 4519 65 638 3566 4772 47 638 3566 4881 1 638 3566 4636 10 638 3566 4646 62 638 3566 4555 71 638 3566 4507 51 638 3566 4673 16 638 3566 4747 87 638 4262 4613 78 638 4262 4736 26 638 4262 4539 16 638 4262 4935 8 638 4262 4699 12 638 4262 4658 50 638 4262 4978 2 638 4262 4827 12 638 4530 1476 21 514 4531 56 19 39 4532 4910 61 239 4532 214 36 426 4533 3283 38 810 4534 1362 64 724 4534 4172 77 766 4535 1271 9 530 4536 4178 2 800 4536 757 98 704 4537 506 59 323 4537 4215 37 284 4538 1386 60 797 4539 3111 15 779 4540 668 61 370 4541 783 78 874 4541 775 12 557 4542 3521 11 457 4543 2472 80 263 4543 3930 7 277 4544 170 23 980 4544 1593 74 93 4545 2985 6 259 4546 3274 64 481 4547 1709 81 666 4548 259 33 229 4548 901 98 731 4549 4598 26 141 4550 2231 59 885 4550 1429 47 367 4551 1291 54 538 4552 4147 79 76 4552 398 35 796 4553 2267 31 739 4553 1604 29 9 4554 3596 3 94 4555 2884 75 209 4556 4588 19 782 4556 4796 76 997 4557 4850 53 545 4558 367 4 458 4558 4656 100 668 4559 196 60 94 4560 3611 98 30 4560 4675 88 261 4561 1494 31 824 4562 710 92 226 4563 481 58 543 4564 984 26 659 4565 4911 44 387 4565 846 38 938 4566 1760 92 868 4567 872 31 790 4568 3739 53 196 4568 301 11 449 4569 4888 47 431 4569 268 14 788 4570 3083 40 138 4570 91 5 712 4571 3271 13 314 4571 362 10 205 4572 845 83 442 4573 793 26 928 4574 3158 67 624 4574 4123 45 540 4575 4727 91 569 4575 2996 59 101 4576 3220 19 2 4576 23 7 824 4577 1186 26 331 4577 4258 99 194 4578 22 15 156 4578 3660 66 367 4579 3687 42 346 4579 403 8 987 4580 757 26 863 4581 4975 31 95 4582 4012 93 157 4583 2694 43 200 4583 3069 58 415 4584 2502 45 867 4584 3416 9 206 4585 566 9 177 4586 2454 48 237 4586 1401 3 121 4587 2844 43 561 4587 1869 52 219 4588 4144 65 51 4589 1703 50 345 4589 778 82 168 4590 512 76 406 4591 3201 15 847 4591 955 1 540 4592 2492 97 567 4592 2478 64 798 4593 2172 81 389 4593 3337 84 257 4594 2263 20 920 4594 1987 5 598 4595 826 39 985 4596 791 9 100 4597 3801 64 604 4597 4330 12 897 4598 4946 31 141 4598 450 57 219 4599 4677 39 668 4600 3861 14 48 4600 3193 70 567 4601 2431 78 878 4602 908 78 885 4602 931 90 807 4603 928 35 687 4603 2346 82 398 4604 1361 77 767 4605 4368 58 341 4606 3018 25 667 4606 4131 4 891 4607 4968 80 853 4607 801 12 693 4608 649 55 100 4608 4917 14 459 4609 2106 60 451 4609 4257 87 530 4610 4221 1 950 4611 1513 10 483 4612 1378 12 387 4612 4696 86 789 4613 3688 90 414 4614 3393 8 853 4614 4289 94 219 4615 3009 71 645 4616 2096 44 157 4617 4446 34 754 4618 4512 85 232 4619 4659 68 690 4619 2747 26 182 4620 3659 52 938 4621 2748 95 484 4622 259 31 883 4623 4010 86 738 4623 1650 29 323 4624 3549 48 652 4624 344 42 922 4625 4212 43 812 4626 1977 55 940 4627 157 68 74 4628 127 21 198 4628 1156 80 184 4629 4639 1 114 4629 1359 34 968 4630 606 37 751 4630 2762 39 57 4631 1303 3 677 4632 3641 20 400 4632 3792 71 66 4633 3868 45 604 4633 3950 81 574 4634 1330 41 898 4634 1770 18 149 4635 2733 96 720 4636 3973 51 800 4636 3685 98 815 4637 3033 45 429 4637 3067 83 37 4638 4278 23 322 4638 2012 25 364 4639 2314 18 851 4639 1303 58 821 4640 158 4 744 4640 1313 94 834 4641 4549 80 232 4641 1553 90 353 4642 1528 16 105 4643 1986 23 206 4644 2525 19 105 4644 4116 10 627 4645 1652 81 881 4646 3973 19 873 4647 3284 18 48 4647 562 98 976 4648 592 17 734 4648 1602 52 76 4649 708 35 394 4650 2174 14 810 4650 661 67 202 4651 875 41 368 4652 4766 92 585 4653 3090 2 840 4653 956 80 765 4654 2022 92 478 4655 4912 64 315 4656 2300 88 93 4656 640 87 167 4657 841 82 826 4657 4027 42 659 4658 2266 47 550 4658 3865 18 254 4659 1332 78 781 4660 1273 6 324 4661 4463 70 610 4662 27 99 201 4663 40 54 314 4663 1533 84 600 4664 2987 44 628 4665 2752 59 163 4665 1445 78 221 4666 2649 93 248 4666 2615 4 187 4667 3098 95 522 4668 768 45 449 4669 943 46 794 4669 450 36 45 4670 3525 40 249 4671 1657 53 357 4672 2496 63 458 4672 4698 51 547 4673 1729 38 169 4673 2717 56 353 4674 555 20 770 4675 4713 50 968 4675 1729 20 182 4676 4229 90 259 4676 3097 56 125 4677 2078 41 409 4677 4510 66 743 4678 62 97 859 4679 1613 40 602 4679 2665 14 471 4680 1197 81 55 4680 1585 17 996 4681 4118 71 419 4682 665 93 696 4683 3367 2 312 4684 4905 78 879 4684 4673 60 822 4685 3405 8 157 4686 2923 46 419 4686 4925 53 484 4687 2673 25 285 4688 4256 59 627 4688 2685 53 501 4689 3476 24 92 4690 1745 90 965 4690 4879 26 795 4691 3785 3 939 4691 4372 32 981 4692 1361 4 867 4693 4351 38 142 4693 4872 5 942 4694 1620 66 846 4695 3514 57 58 4696 4376 72 479 4697 4593 2 912 4697 4013 66 270 4698 4620 87 107 4699 1924 12 818 4699 1293 36 223 4700 3705 58 592 4701 1681 65 856 4702 2754 74 76 4702 1349 4 284 4703 1967 54 853 4703 713 100 532 4704 4571 36 30 4705 3854 58 367 4706 958 9 12 4706 2074 65 640 4707 4186 46 735 4708 2015 64 891 4709 4629 50 857 4709 2016 87 929 4710 3633 45 29 4710 1341 75 764 4711 2264 100 163 4712 2292 3 987 4712 2531 9 576 4713 308 27 864 4714 4363 1 47 4715 3969 5 661 4715 3246 57 513 4716 4027 84 454 4717 3459 69 375 4718 1657 17 473 4719 582 26 625 4720 2502 95 724 4721 1072 33 296 4721 4047 98 718 4722 1161 2 925 4722 2171 80 693 4723 2188 33 899 4723 353 87 211 4724 4661 75 351 4724 149 25 52 4725 4835 98 130 4726 674 99 338 4727 747 70 312 4728 3552 20 732 4728 2710 78 146 4729 4875 52 981 4729 588 73 298 4730 488 87 867 4730 3759 95 760 4731 2213 64 499 4732 3284 79 714 4733 1977 86 728 4734 3027 17 796 4734 241 45 555 4735 3009 25 730 4735 2708 70 545 4736 4062 83 606 4737 170 87 717 4738 2673 72 291 4739 332 48 3 4739 3614 22 719 4740 2019 94 274 4741 4711 68 667 4741 2979 97 561 4742 2610 98 402 4742 3733 81 721 4743 422 89 521 4744 4840 99 191 4745 3995 39 574 4745 4820 52 213 4746 4096 63 92 4747 2232 33 341 4747 1883 91 191 4748 4742 91 354 4748 2422 52 456 4749 359 76 690 4749 2935 40 695 4750 768 34 243 4750 216 46 269 4751 2415 53 877 4752 2603 100 277 4753 444 1 457 4753 4381 54 69 4754 2049 18 806 4755 4020 3 379 4755 4025 2 812 4756 807 1 573 4757 791 29 981 4757 3051 31 335 4758 4435 92 558 4759 2508 58 623 4759 1269 10 784 4760 4458 35 194 4761 1276 1 262 4762 1933 43 865 4763 3027 35 473 4763 3357 57 763 4764 2129 33 426 4764 1779 61 492 4765 1439 69 309 4766 3735 62 481 4767 290 61 87 4768 3468 30 381 4768 4764 71 336 4769 3174 4 894 4770 1548 46 997 4770 1880 6 383 4771 3178 45 292 4771 1391 17 246 4772 1018 88 461 4772 2981 20 287 4773 2308 26 795 4774 1318 56 294 4774 2971 23 329 4775 2779 8 36 4776 4112 70 67 4777 2427 39 798 4777 4820 10 391 4778 1183 43 224 4778 3692 74 919 4779 1397 33 442 4780 1435 21 285 4780 3217 6 171 4781 4538 15 152 4781 4739 62 567 4782 2485 86 628 4782 2650 19 841 4783 4364 47 381 4784 3134 53 749 4784 2008 16 400 4785 1288 22 295 4786 4460 33 789 4786 4068 1 416 4787 4462 38 50 4788 181 3 984 4788 2182 42 137 4789 378 62 786 4790 1337 14 916 4790 3097 11 52 4791 4632 37 949 4791 1446 97 27 4792 2441 77 984 4792 2691 94 796 4793 197 81 683 4794 618 73 534 4795 2931 57 867 4796 51 98 114 4796 289 5 982 4797 4885 40 736 4797 3879 63 308 4798 3205 39 985 4798 3994 80 799 4799 3525 35 226 4799 2566 36 338 4800 116 58 761 4800 2711 88 618 4801 348 10 931 4802 3915 33 266 4803 3149 6 622 4803 2932 74 255 4804 2219 95 354 4805 2768 33 675 4806 4942 81 956 4807 4341 47 509 4808 3147 43 458 4808 421 6 614 4809 90 19 330 4810 2901 11 914 4811 4607 36 817 4811 577 92 656 4812 3498 15 785 4812 4179 24 42 4813 4925 99 249 4814 3168 4 291 4815 2198 60 673 4815 4245 42 476 4816 1425 86 9 4816 1956 98 238 4817 4399 61 937 4818 4143 69 603 4819 1506 4 932 4819 809 63 9 4820 81 84 325 4820 2783 6 812 4821 686 37 704 4821 1006 55 591 4822 3896 30 428 4822 100 25 240 4823 3868 44 964 4824 3158 8 583 4824 3442 71 117 4825 451 91 899 4826 3955 79 584 4827 3181 83 466 4827 4499 87 387 4828 3449 90 158 4829 412 41 932 4830 409 72 829 4831 1715 44 345 4831 804 98 596 4832 2219 49 790 4832 3452 29 727 4833 11 27 43 4833 2348 47 218 4834 1701 70 32 4835 2067 96 554 4836 3940 31 587 4837 3810 6 896 4837 2985 2 508 4838 471 15 118 4838 2535 21 718 4839 2030 47 497 4839 4383 28 734 4840 877 22 520 4840 95 61 522 4841 4608 1 684 4841 1219 17 479 4842 3803 20 16 4843 4026 91 311 4843 778 60 911 4844 2047 27 658 4844 332 52 591 4845 136 87 466 4845 513 92 76 4846 2925 34 333 4846 1576 14 50 4847 1221 96 708 4847 198 1 953 4847 2218 55 70 4848 4738 36 474 4848 2336 93 65 4849 1302 72 977 4849 2039 58 449 4849 1851 35 140 4849 3412 89 798 4850 1737 92 726 4850 3178 46 366 4850 4388 62 796 4851 4048 51 146 4851 4246 7 573 4851 2394 73 228 4852 1136 72 689 4852 2551 30 556 4852 3371 75 844 4852 5 46 569 4853 2347 56 658 4854 3003 31 478 4854 4619 63 621 4854 3456 77 712 4854 3418 55 826 4855 600 82 500 4855 3040 69 543 4855 2470 44 83 4856 1244 13 789 4857 2603 74 549 4857 425 23 938 4857 2308 73 966 4857 2357 77 700 4858 2377 45 310 4858 955 39 507 4858 2854 95 789 4859 2490 42 918 4860 3414 48 810 4860 4042 9 121 4860 4105 82 41 4860 4637 88 753 4861 69 35 447 4862 1121 49 519 4862 2644 57 292 4862 1437 11 816 4862 2328 33 173 4863 4654 87 291 4863 933 26 304 4864 4907 58 443 4864 3143 85 8 4865 2056 48 567 4865 3866 84 80 4865 149 57 29 4865 3558 62 665 4866 1030 100 502 4866 931 68 784 4867 955 96 177 4867 1192 65 240 4867 2857 14 317 4868 1193 26 848 4868 3474 48 852 4868 2661 93 982 4869 4909 50 958 4869 4675 44 179 4869 34 44 597 4869 343 2 128 4870 25 93 419 4870 4605 30 553 4870 3756 1 463 4870 766 45 697 4871 1745 35 595 4871 4354 54 162 4872 571 56 539 4872 1574 15 383 4872 4251 88 112 4872 990 86 229 4873 2630 63 489 4873 690 46 817 4874 3352 26 678 4875 3758 41 153 4875 2338 64 803 4875 2811 67 196 4876 4 51 78 4876 1047 34 657 4877 807 12 42 4878 1808 50 398 4878 99 90 692 4879 2263 37 849 4879 2173 9 417 4879 3324 11 568 4880 2260 59 84 4880 2951 79 557 4880 2574 81 361 4880 2068 68 19 4881 3775 8 524 4881 4055 61 900 4882 2464 29 354 4882 986 61 24 4883 1389 34 991 4883 3138 62 659 4884 1594 27 186 4884 4229 95 483 4885 4544 60 20 4886 4021 37 514 4887 4565 92 77 4887 1490 2 711 4887 4745 2 556 4887 921 62 941 4888 1724 8 672 4888 2455 99 956 4888 4649 15 762 4888 2648 21 354 4889 3691 85 169 4890 238 4 644 4890 4651 61 734 4891 2464 71 461 4892 743 13 110 4892 4523 79 687 4893 83 90 464 4893 4276 89 172 4893 4860 53 63 4893 3447 81 728 4894 4481 33 46 4894 1995 11 472 4894 496 96 240 4894 1155 25 965 4895 1904 14 702 4895 4710 42 198 4895 2039 87 985 4896 1552 100 977 4896 1266 42 340 4897 2566 88 810 4897 474 95 273 4898 2809 48 781 4898 357 40 551 4899 3353 57 595 4899 3298 77 24 4900 3997 35 433 4900 271 80 355 4900 2285 44 821 4901 1509 9 274 4901 57 16 143 4902 577 30 910 4902 3591 85 848 4903 1032 53 2 4903 4016 98 746 4903 1795 45 741 4904 1862 22 759 4905 2646 90 910 4905 4603 92 815 4905 1409 78 570 4905 4914 70 468 4906 3472 82 172 4906 4494 63 20 4906 855 100 561 4906 1629 57 333 4907 2340 14 714 4908 3718 48 58 4908 2080 97 33 4909 1858 78 536 4909 2896 44 775 4910 182 50 127 4910 2602 58 429 4911 4466 68 406 4912 745 83 897 4913 562 19 815 4913 3213 36 965 4913 3535 30 815 4913 27 26 558 4914 2822 31 151 4914 3194 72 65 4914 4473 13 979 4915 1223 32 508 4916 1225 63 722 4916 4223 68 599 4917 1295 70 704 4917 692 41 748 4917 325 45 233 4918 1433 92 515 4918 4309 70 99 4919 4251 86 969 4920 1024 59 608 4920 2922 11 146 4920 411 59 13 4921 85 29 753 4921 889 29 244 4922 4258 50 167 4923 216 56 341 4924 4834 26 515 4924 362 51 372 4925 1249 21 294 4925 3098 73 132 4925 2168 6 90 4926 377 35 347 4927 3231 97 673 4928 2125 74 457 4928 4213 75 84 4929 2515 64 761 4930 4205 21 589 4931 4782 74 946 4931 2280 86 845 4931 1942 33 971 4932 380 73 498 4932 4165 59 346 4933 2839 81 36 4933 3209 4 143 4933 4789 48 142 4934 1171 4 747 4934 4190 73 353 4934 1298 52 163 4934 3297 48 275 4935 2907 7 919 4936 1284 3 138 4936 915 60 2 4936 1454 11 712 4936 690 67 782 4937 3599 39 876 4937 347 83 985 4937 2567 29 617 4937 3596 20 21 4938 2187 66 76 4938 2619 65 787 4939 3259 12 191 4939 3160 92 836 4940 98 31 590 4940 4649 46 625 4940 4570 56 757 4941 4612 51 718 4941 2776 66 665 4942 2294 36 810 4942 831 90 593 4942 1908 83 598 4943 266 80 719 4943 621 87 218 4943 1201 87 187 4943 598 16 245 4943 2074 29 477 4943 1189 46 487 4944 2072 71 98 4944 2204 57 458 4944 328 39 765 4945 509 93 792 4946 2197 16 455 4946 12 33 649 4946 4846 9 631 4946 4762 20 130 4946 4312 14 807 4947 2045 8 508 4947 3558 15 314 4947 4308 46 280 4947 90 6 360 4948 4384 69 456 4949 2198 5 369 4949 4790 60 443 4950 254 34 92 4950 3858 55 120 4950 469 82 606 4950 2233 22 729 4950 1012 26 450 4950 200 86 760 4951 4072 45 606 4951 4852 42 191 4951 1400 50 665 4951 81 21 329 4951 4263 96 94 4951 513 84 769 4952 668 41 914 4952 148 16 48 4952 417 49 59 4952 4483 78 355 4952 2041 48 573 4952 1087 61 781 4953 3711 55 102 4953 289 70 144 4953 4938 1 934 4953 3108 59 889 4954 1348 68 754 4954 2786 18 373 4954 2458 10 259 4954 3579 27 608 4954 4277 64 926 4955 2738 87 16 4955 1487 66 337 4955 888 96 963 4955 3910 16 664 4956 291 11 676 4956 1009 70 574 4957 2057 88 702 4957 4988 46 478 4957 1831 5 313 4957 3137 98 563 4957 3857 1 257 4957 4061 53 642 4958 3582 82 675 4958 862 66 53 4958 490 25 825 4958 776 57 173 4959 512 2 456 4960 4562 32 72 4960 2771 64 256 4960 4093 49 110 4960 809 49 585 4961 2283 38 113 4961 3036 68 435 4961 2222 5 678 4961 3 7 161 4961 305 100 753 4962 237 95 664 4963 2554 37 991 4963 862 65 939 4964 4630 11 211 4964 3311 95 354 4964 3669 22 798 4964 1097 9 294 4964 1872 20 722 4965 49 87 314 4965 3264 5 516 4965 440 85 117 4965 3561 51 200 4965 358 89 720 4965 1622 16 380 4966 1161 52 826 4966 751 31 5 4966 147 35 743 4966 2193 2 107 4966 4596 20 586 4967 1489 27 205 4967 294 99 199 4968 1976 93 889 4968 3284 47 255 4968 3479 31 538 4968 2487 65 233 4968 3998 88 677 4968 3645 12 165 4969 4191 20 832 4969 3700 20 180 4970 1983 74 978 4970 1820 63 841 4970 2301 81 508 4971 356 49 767 4972 2869 97 432 4972 1779 59 440 4972 1863 30 721 4972 478 61 685 4972 2717 19 875 4973 1467 50 43 4974 694 62 123 4974 898 80 262 4974 1660 50 397 4974 2919 81 750 4974 734 28 492 4975 68 42 973 4975 1124 11 439 4975 1985 39 527 4975 3420 33 667 4975 667 38 457 4975 1827 11 189 4976 1358 99 772 4977 4229 62 554 4977 1027 99 839 4977 437 18 265 4977 4104 10 451 4977 4686 92 416 4978 1321 50 471 4979 287 42 449 4979 499 58 29 4979 3565 27 573 4979 2454 27 954 4980 1180 65 415 4980 1399 9 101 4980 2282 37 613 4981 656 71 212 4981 1529 55 440 4982 4862 49 926 4982 3493 70 577 4983 2439 45 194 4983 2931 71 379 4983 4821 15 762 4983 349 13 209 4983 4898 19 453 4984 4473 12 803 4984 2327 96 591 4984 879 11 672 4985 4141 48 942 4985 3061 56 255 4985 1479 23 900 4985 4597 37 122 4985 2493 6 900 4985 702 55 344 4985 59 84 366 4986 1167 13 640 4986 4925 10 682 4986 2740 34 475 4987 27 84 826 4987 2071 20 261 4987 651 65 562 4987 3525 48 370 4988 108 41 222 4988 1414 53 287 4988 2533 8 106 4988 1369 100 880 4989 2128 35 661 4989 2035 50 532 4989 1380 46 553 4989 124 10 647 4990 2668 50 212 4990 4813 93 3 4990 166 73 517 4990 3247 96 207 4990 3672 66 371 4990 3954 81 951 4991 442 79 689 4991 776 88 899 4991 623 31 282 4992 4697 23 803 4992 1679 31 4 4992 3837 20 240 4992 4301 52 666 4992 2450 6 941 4992 2486 31 379 4992 4039 80 902 4992 3099 41 935 4993 2788 32 140 4993 3695 41 659 4993 3818 63 850 4993 2220 29 542 4993 4947 70 422 4993 1138 18 977 4993 4527 23 350 4994 2461 87 32 4994 1994 14 205 4994 3496 51 444 4994 3272 53 103 4994 119 50 608 4994 3680 87 167 4994 1391 45 176 4994 179 80 320 4995 521 71 322 4996 2229 51 221 4997 4620 76 382 4997 2967 75 729 4997 549 28 654 4997 2696 75 399 4997 3519 52 762 4997 3261 4 562 4998 2734 61 88 4998 2788 54 78 4998 1377 33 55 4998 858 45 411 4998 2349 68 165 4998 2497 47 155 4998 3671 33 789 4998 3096 52 971 4999 1557 14 710 4999 3386 15 339 4999 659 46 813 4999 985 72 672 5000 2885 15 816 5000 4900 49 879 5000 3070 83 269 5000 273 99 25 5000 509 48 345 5000 808 90 288 5000 2694 21 249 DEMAND 4501 4 4502 150 4503 668 4504 535 4505 285 4506 740 4507 8 4508 567 4509 1283 4510 961 4511 335 4512 586 4513 1085 4514 25 4515 877 4516 1882 4517 469 4518 661 4519 11 4520 464 4521 5 4522 309 4523 248 4524 87 4525 512 4526 620 4527 1261 4528 1070 4529 211 4530 630 4531 107 4532 96 4533 486 4534 357 4535 316 4536 295 4537 564 4538 750 4539 2 4540 500 4541 375 4542 1809 4543 266 4544 1552 4545 427 4546 136 4547 19 4548 313 4549 509 4550 15 4551 312 4552 269 4553 501 4554 1145 4555 5 4556 680 4557 1303 4558 302 4559 495 4560 213 4561 83 4562 5 4563 7 4564 669 4565 18 4566 286 4567 387 4568 393 4569 451 4570 562 4571 286 4572 411 4573 974 4574 120 4575 181 4576 693 4577 204 4578 1117 4579 376 4580 755 4581 466 4582 156 4583 1187 4584 709 4585 123 4586 1242 4587 704 4588 703 4589 51 4590 319 4591 476 4592 13 4593 72 4594 120 4595 28 4596 505 4597 373 4598 243 4599 1 4600 818 4601 1175 4602 1013 4603 662 4604 1058 4605 275 4606 400 4607 537 4608 926 4609 708 4610 124 4611 372 4612 5 4613 511 4614 595 4615 240 4616 328 4617 187 4618 20 4619 1109 4620 423 4621 210 4622 24 4623 1041 4624 40 4625 1668 4626 1592 4627 373 4628 149 4629 875 4630 760 4631 1163 4632 18 4633 1372 4634 1160 4635 91 4636 13 4637 922 4638 340 4639 504 4640 1460 4641 425 4642 586 4643 690 4644 112 4645 1332 4646 20 4647 268 4648 770 4649 839 4650 11 4651 737 4652 336 4653 66 4654 1849 4655 483 4656 853 4657 1214 4658 1 4659 592 4660 1574 4661 84 4662 806 4663 606 4664 9 4665 1301 4666 605 4667 382 4668 903 4669 295 4670 44 4671 474 4672 729 4673 4 4674 174 4675 632 4676 513 4677 553 4678 27 4679 336 4680 33 4681 143 4682 561 4683 1105 4684 939 4685 441 4686 109 4687 315 4688 187 4689 791 4690 520 4691 378 4692 1028 4693 619 4694 1623 4695 310 4696 625 4697 630 4698 23 4699 10 4700 1020 4701 664 4702 326 4703 43 4704 238 4705 1654 4706 753 4707 393 4708 244 4709 1164 4710 1917 4711 18 4712 5 4713 9 4714 237 4715 1083 4716 268 4717 130 4718 154 4719 416 4720 143 4721 34 4722 694 4723 6 4724 8 4725 669 4726 996 4727 266 4728 53 4729 400 4730 829 4731 798 4732 6 4733 817 4734 298 4735 442 4736 3 4737 861 4738 769 4739 26 4740 792 4741 962 4742 557 4743 539 4744 645 4745 442 4746 795 4747 6 4748 284 4749 667 4750 587 4751 16 4752 1663 4753 296 4754 569 4755 883 4756 3 4757 450 4758 258 4759 416 4760 551 4761 532 4762 568 4763 1450 4764 158 4765 584 4766 1087 4767 84 4768 147 4769 349 4770 456 4771 626 4772 7 4773 8 4774 1255 4775 8 4776 780 4777 710 4778 13 4779 11 4780 406 4781 438 4782 415 4783 52 4784 258 4785 238 4786 201 4787 296 4788 1360 4789 762 4790 936 4791 313 4792 598 4793 576 4794 915 4795 301 4796 135 4797 1025 4798 502 4799 776 4800 897 4801 15 4802 476 4803 759 4804 46 4805 271 4806 163 4807 883 4808 4 4809 292 4810 1850 4811 600 4812 3 4813 9 4814 13 4815 653 4816 423 4817 103 4818 4 4819 8 4820 67 4821 369 4822 205 4823 197 4824 700 4825 764 4826 982 4827 7 4828 1199 4829 1588 4830 1708 4831 579 4832 15 4833 1397 4834 1131 4835 264 4836 133 4837 179 4838 381 4839 340 4840 408 4841 893 4842 6 4843 569 4844 565 4845 223 4846 264 4847 87 4848 549 4849 231 4850 256 4851 247 4852 53 4853 529 4854 276 4855 1039 4856 1348 4857 4 4858 128 4859 10 4860 325 4861 98 4862 594 4863 427 4864 543 4865 6 4866 262 4867 211 4868 995 4869 1268 4870 1 4871 2 4872 108 4873 320 4874 1013 4875 1252 4876 428 4877 510 4878 13 4879 1459 4880 594 4881 20 4882 613 4883 560 4884 251 4885 12 4886 1023 4887 116 4888 186 4889 247 4890 100 4891 98 4892 1012 4893 1292 4894 138 4895 1555 4896 157 4897 13 4898 424 4899 17 4900 157 4901 707 4902 65 4903 364 4904 881 4905 770 4906 47 4907 314 4908 244 4909 706 4910 1571 4911 539 4912 6 4913 1057 4914 1669 4915 6 4916 1703 4917 30 4918 6 4919 406 4920 774 4921 10 4922 394 4923 716 4924 1055 4925 992 4926 380 4927 8 4928 1217 4929 36 4930 251 4931 217 4932 1274 4933 568 4934 958 4935 8 4936 1 4937 538 4938 204 4939 315 4940 713 4941 261 4942 15 4943 10 4944 1 4945 298 4946 875 4947 227 4948 1229 4949 712 4950 176 4951 985 4952 332 4953 484 4954 920 4955 581 4956 881 4957 154 4958 1138 4959 6 4960 789 4961 1528 4962 415 4963 471 4964 2 4965 1008 4966 361 4967 1049 4968 885 4969 151 4970 204 4971 396 4972 477 4973 11 4974 494 4975 514 4976 1155 4977 991 4978 12 4979 576 4980 402 4981 1074 4982 226 4983 543 4984 384 4985 228 4986 299 4987 919 4988 508 4989 129 4990 98 4991 205 4992 434 4993 853 4994 769 4995 314 4996 1138 4997 20 4998 1 4999 465 5000 121 END CoinMP-1.8.3/Data/Sample/scOneInt.mps0000644000175000017500000000210710430174061015645 0ustar renereneNAME scOnInt ROWS N obj G row1 G row2 G row3 G scrow1 G scrow2 G scrow3 COLUMNS INT1 'MARKER' 'INTORG' x1 obj 24.000 scrow1 15.000 x2 obj 12.000 scrow2 20.000 x3 obj 16.000 scrow3 5.000 INT1END 'MARKER' 'INTEND' y1 obj 4.000 row1 1.000 y1 row2 1.000 row3 2.000 y1 scrow1 -1.000 y2 obj 2.000 row1 3.000 y2 row3 2.000 scrow2 -1.000 y3 obj 3.000 row2 2.000 y3 scrow3 -1.000 RHS RHS row1 15.000 RHS row2 10.000 RHS row3 20.000 RHS scrow1 0.000 RHS scrow2 0.000 RHS scrow3 0.000 BOUNDS UP intbnd x3 7.0 ENDATA CoinMP-1.8.3/Data/Sample/block_milp.lp0000644000175000017500000000365212452373145016072 0ustar renerene\* MILP *\ Minimize Objective: - 20 x_1.0 - 7 x_10.0 - 4 x_11.0 - 9 x_12.0 - 8 x_13.0 - 2 x_14.0 - 3 x_15.0 - 8 x_16.0 - 8 x_17.0 - 7 x_18.0 - 2 x_19.0 - 4 x_2.0 - 10 x_20.0 - x_21.0 - 10 x_22.0 - 8 x_23.0 - 6 x_24.0 - 9 x_25.0 - 5 x_26.0 - 3 x_27.0 - 8 x_28.0 - 5 x_29.0 - 3 x_3.0 - 9 x_30.0 - 7 x_31.0 - 2 x_32.0 - 2 x_33.0 - 6 x_34.0 - 10 x_35.0 - 5 x_36.0 - 6 x_37.0 - 3 x_38.0 - 7 x_39.0 - x_4.0 - 6 x_40.0 - 4 x_5.0 - 8 x_6.0 - 2 x_7.0 - 10 x_8.0 - 5 x_9.0 Subject To C_1.0: 2 x_11.0 + 8 x_13.0 + 10 x_20.0 + x_22.0 + 2 x_32.0 + 2 x_33.0 + 2 x_34.0 + 5 x_37.0 + 5 x_7.0 + 7 x_8.0 + 6 x_9.0 <= 10 C_2.0: x_13.0 + 8 x_2.0 + x_28.0 + 10 x_3.0 + 10 x_30.0 + 4 x_36.0 + 3 x_38.0 + 9 x_7.0 <= 9 C_3.0: 7 x_1.0 + 6 x_17.0 + 7 x_19.0 + 3 x_23.0 + 6 x_4.0 <= 7 C_4.0: 3 x_16.0 + 4 x_29.0 + 8 x_3.0 + 10 x_34.0 + 3 x_37.0 + 8 x_40.0 <= 11 C_5.0_1.0: 5 x_32.0 + 2 x_34.0 + 2 x_37.0 <= 4 C_6.0_1.0: 4 x_33.0 + 4 x_38.0 + 3 x_39.0 <= 5 C_7.0_1.0: 4 x_31.0 + 5 x_35.0 + 2 x_36.0 + 3 x_40.0 <= 6 C_8.0_2.0: 5 x_24.0 + 7 x_30.0 <= 5 C_9.0_2.0: 6 x_22.0 + 3 x_23.0 + 6 x_28.0 <= 5 C_10.0_2.0: 10 x_22.0 + 6 x_24.0 + 4 x_26.0 <= 5 C_11.0_2.0: 9 x_23.0 + 4 x_25.0 + 7 x_27.0 <= 4 C_12.0_2.0: 4 x_22.0 + 8 x_24.0 + 2 x_30.0 <= 5 C_13.0_3.0: 3 x_15.0 + x_21.0 <= 5 C_14.0_3.0: 5 x_16.0 + 5 x_19.0 <= 4 C_15.0_3.0: 3 x_17.0 + 4 x_20.0 <= 4 C_16.0_3.0: 7 x_16.0 + 10 x_18.0 <= 5 C_17.0_4.0: 3 x_11.0 + 6 x_14.0 + 2 x_6.0 + 3 x_9.0 <= 5 C_18.0_4.0: 5 x_3.0 + 7 x_5.0 + x_9.0 <= 5 C_19.0_4.0: 5 x_11.0 + 7 x_12.0 + 10 x_14.0 + 7 x_2.0 + 10 x_4.0 + x_8.0 <= 5 C_20.0_4.0: 2 x_10.0 + 5 x_11.0 + 5 x_13.0 + 2 x_7.0 <= 4 Binaries x_1.0 x_10.0 x_11.0 x_12.0 x_13.0 x_14.0 x_15.0 x_16.0 x_17.0 x_18.0 x_19.0 x_2.0 x_20.0 x_21.0 x_22.0 x_23.0 x_24.0 x_25.0 x_26.0 x_27.0 x_28.0 x_29.0 x_3.0 x_30.0 x_31.0 x_32.0 x_33.0 x_34.0 x_35.0 x_36.0 x_37.0 x_38.0 x_39.0 x_4.0 x_40.0 x_5.0 x_6.0 x_7.0 x_8.0 x_9.0 End CoinMP-1.8.3/Data/Sample/spec_sections.mps0000644000175000017500000000405712235603020016767 0ustar renerene*NAME Test *Author H.I. Gassmann *Date 08/Oct/2013 *Purpose This file tests the processing of the * CoinMpsIO subsystem --- it does not make * much sense as an optimization problem * but is useful to illustrate a fully loaded MPS file NAME ROWS N obj L c1 COLUMNS x0 obj 1 c1 1 INT 'MARKER' 'INTORG' x1 obj -1 c1 10 INT 'MARKER' 'INTEND' * S1 NAME1 'MARKER' 'SOSORG' x2 obj -9 c1 5 x3 obj -6 c1 8 * NAME1 'MARKER' 'SOSEND' x4 obj 1 c1 1 x5 obj -6 c1 8 x6 obj 1 c1 1 x7 obj 1 c1 1 x8 obj -6 c1 8 x9 obj -2 c1 1 x10 obj -3 c1 1 x11 obj -1 c1 -1 x12 obj -2 c1 1 x13 obj -3 c1 1 x14 obj -9 c1 5 RHS rhs c1 10000 RANGES range c1 2000 BOUNDS LI BOUND x1 2 UI BOUND x1 3 SOS S1 set1 x2 x3 S2 set2 x4 20 x5 40 QUADOBJ x6 x6 1 x6 x7 2 x7 x7 7 CSECTION cone1 0.0 QUAD x8 x9 x10 CSECTION cone2 0.0 RQUAD x11 x12 x13 x14 *BASIS * XU x6 c1 * BS x7 ENDATA CoinMP-1.8.3/Data/Sample/wedding_16.block0000644000175000017500000000672512136243266016370 0ustar renerene0 0 1 1 2 2 3 3 4 4 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 0 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 1 63 1 64 1 65 0 66 1 67 1 68 1 69 1 70 1 71 1 72 1 73 1 74 1 75 1 76 0 77 1 78 1 79 1 80 1 81 1 82 1 83 1 84 1 85 1 86 1 87 0 88 1 89 1 90 1 91 1 92 1 93 1 94 1 95 1 96 1 97 1 98 0 99 1 100 1 101 1 102 1 103 1 104 1 105 1 106 1 107 1 108 1 109 0 110 1 111 1 112 1 113 1 114 1 115 1 116 1 117 1 118 1 119 1 120 0 121 1 122 1 123 1 124 1 125 1 126 1 127 1 128 1 129 1 130 1 131 0 132 0 133 1 134 1 135 1 136 1 137 1 138 1 139 1 140 1 141 1 142 1 143 0 144 1 145 1 146 1 147 1 148 1 149 1 150 1 151 1 152 1 153 1 154 0 155 1 156 1 157 1 158 1 159 1 160 1 161 1 162 1 163 1 164 1 165 0 166 1 167 1 168 1 169 1 170 1 171 1 172 1 173 1 174 1 175 1 176 0 177 1 178 2 179 2 180 2 181 2 182 2 183 2 184 2 185 2 186 2 187 0 188 2 189 2 190 2 191 2 192 2 193 2 194 2 195 2 196 2 197 2 198 0 199 2 200 2 201 2 202 2 203 2 204 2 205 2 206 2 207 2 208 2 209 0 210 2 211 2 212 2 213 2 214 2 215 2 216 2 217 2 218 2 219 2 220 0 221 2 222 2 223 2 224 2 225 2 226 2 227 2 228 2 229 2 230 2 231 0 232 2 233 2 234 2 235 2 236 2 237 2 238 2 239 2 240 2 241 2 242 0 243 0 244 2 245 2 246 2 247 2 248 2 249 2 250 2 251 2 252 2 253 2 254 0 255 2 256 2 257 2 258 2 259 2 260 2 261 2 262 2 263 2 264 2 265 0 266 2 267 2 268 2 269 2 270 2 271 2 272 2 273 2 274 2 275 2 276 0 277 2 278 2 279 2 280 2 281 2 282 2 283 2 284 2 285 2 286 2 287 0 288 2 289 2 290 2 291 2 292 2 293 2 294 2 295 2 296 2 297 2 298 0 299 2 300 2 301 2 302 2 303 2 304 2 305 2 306 2 307 2 308 2 309 0 310 2 311 3 312 3 313 3 314 3 315 3 316 3 317 3 318 3 319 3 320 0 321 3 322 3 323 3 324 3 325 3 326 3 327 3 328 3 329 3 330 3 331 0 332 3 333 3 334 3 335 3 336 3 337 3 338 3 339 3 340 3 341 3 342 0 343 3 344 3 345 3 346 3 347 3 348 3 349 3 350 3 351 3 352 3 353 0 354 0 355 3 356 3 357 3 358 3 359 3 360 3 361 3 362 3 363 3 364 3 365 0 366 3 367 3 368 3 369 3 370 3 371 3 372 3 373 3 374 3 375 3 376 0 377 3 378 3 379 3 380 3 381 3 382 3 383 3 384 3 385 3 386 3 387 0 388 3 389 3 390 3 391 3 392 3 393 3 394 3 395 3 396 3 397 3 398 0 399 3 400 3 401 3 402 3 403 3 404 3 405 3 406 3 407 3 408 3 409 0 410 3 411 3 412 3 413 3 414 3 415 3 416 3 417 3 418 3 419 3 420 0 421 3 422 3 423 3 424 3 425 3 426 3 427 3 428 3 429 3 430 3 431 0 432 3 433 3 434 3 435 3 436 3 437 3 438 3 439 3 440 3 441 3 442 0 443 3 444 4 445 4 446 4 447 4 448 4 449 4 450 4 451 4 452 4 453 0 454 4 455 4 456 4 457 4 458 4 459 4 460 4 461 4 462 4 463 4 464 0 465 0 466 4 467 4 468 4 469 4 470 4 471 4 472 4 473 4 474 4 475 4 476 0 477 4 478 4 479 4 480 4 481 4 482 4 483 4 484 4 485 4 486 4 487 0 488 4 489 4 490 4 491 4 492 4 493 4 494 4 495 4 496 4 497 4 498 0 499 4 500 4 501 4 502 4 503 4 504 4 505 4 506 4 507 4 508 4 509 0 510 4 511 4 512 4 513 4 514 4 515 4 516 4 517 4 518 4 519 4 520 0 521 4 522 4 523 4 524 4 525 4 526 4 527 4 528 4 529 4 530 4 531 0 532 4 533 4 534 4 535 4 536 4 537 4 538 4 539 4 540 4 541 4 542 0 543 4 544 4 545 4 546 4 547 4 548 4 549 4 550 4 551 4 552 4 553 0 554 4 555 4 556 4 557 4 558 4 559 4 560 4 561 4 562 4 563 4 564 0 565 4 566 4 567 4 568 4 569 4 570 4 571 4 572 4 573 4 574 4 575 0 576 0 577 4 578 0 579 0 580 0 581 0 582 0 583 0 584 0 585 0 586 0 587 0 588 0 589 0 590 0 591 0 592 0 593 0 594 0 595 0 596 0 597 0 598 0 599 0 600 0 601 0 602 0 603 0 604 0 605 0 606 0 607 0 608 0 609 0 610 0 611 0 612 0 613 0 614 0 615 0 616 0 617 0 618 0 619 0 620 CoinMP-1.8.3/Data/Sample/bug.cor0000755000175000017500000000103511015552002014661 0ustar renereneNAME BUG ROWS N obj G C0 G C1 G C2 G C3 COLUMNS x01 obj 1 x01 C3 1 x01 C1 1 x01 C0 1 x02 obj 1 x02 C2 1 x02 C1 1 x02 C0 1 x03 obj 1 x03 C3 1 x03 C2 1 x03 C0 1 x04 obj 0.5 x04 C3 1 x04 C1 1 x05 obj 0.5 x05 C2 1 x05 C1 1 x06 obj 0.5 x06 C3 1 x06 C2 1 RHS RHS C0 0 RHS C1 1 RHS C2 1 RHS C3 1 ENDATACoinMP-1.8.3/Data/Sample/p0548.mps0000644000175000017500000027063410430174061014717 0ustar renerene*NAME: p0548 *ROWS: 176 *COLUMNS: 548 *INTEGER: 548 *NONZERO: 1711 *BEST SOLN: 8691 (opt) *LP SOLN: 315.29 *SOURCE: Crowder-Johnson-Padberg test set * Ellis L. Johnson (IBM) * E. Andrew Boyd (Rice University) *APPLICATION: unknown *COMMENTS: pure 0/1 IP * 82 SOS constraints * NAME P0548 ROWS N R1001 L R1002 L R1003 L R1004 L R1005 L R1006 L R1007 L R1008 L R1009 L R1010 L R1011 L R1012 L R1013 L R1014 L R1015 L R1016 L R1017 L R1018 L R1019 L R1020 L R1021 L R1022 L R1023 L R1024 L R1025 L R1026 L R1027 L R1028 L R1029 L R1030 L R1031 L R1032 L R1033 L R1034 L R1035 L R1036 L R1037 L R1038 L R1039 L R1040 L R1041 L R1042 L R1043 L R1044 L R1045 L R1046 L R1047 L R1048 L R1049 L R1050 L R1051 L R1052 L R1053 L R1054 L R1055 L R1056 L R1057 L R1058 L R1059 L R1060 L R1061 L R1062 L R1063 L R1064 L R1065 L R1066 L R1067 L R1068 L R1069 L R1070 L R1071 L R1072 L R1073 L R1074 L R1075 L R1076 L R1077 L R1078 L R1079 L R1080 L R1081 L R1082 L R1083 L R1084 L R1085 L R1086 L R1087 L R1088 L R1089 L R1090 L R1091 L R1092 L R1093 L R1094 L R1095 L R1096 L R1097 L R1098 L R1099 L R1100 L R1101 L R1102 L R1103 L R1104 L R1105 L R1106 L R1107 L R1108 L R1109 L R1110 L R1111 L R1112 L R1113 L R1114 L R1115 L R1116 L R1117 L R1118 L R1119 L R1120 L R1121 L R1122 L R1123 L R1124 L R1125 L R1126 L R1127 L R1128 L R1129 L R1130 L R1131 L R1132 L R1133 L R1134 L R1135 L R1136 L R1137 L R1138 L R1139 L R1140 L R1141 L R1142 L R1143 L R1144 L R1145 L R1146 L R1147 L R1148 L R1149 L R1150 L R1151 L R1152 L R1153 L R1154 L R1155 L R1156 L R1157 L R1158 L R1159 L R1160 L R1161 L R1162 L R1163 L R1164 L R1165 L R1166 L R1167 L R1168 L R1169 L R1170 L R1171 L R1172 L R1173 L R1174 L R1175 L R1176 L R1177 COLUMNS MARK0000 'MARKER' 'INTORG' C1001 R1001 169 R1002 -59 C1001 R1051 -59 R1101 20 C1002 R1001 10 R1002 -10 C1002 R1051 -10 R1173 1 C1003 R1001 235 R1002 -167 C1003 R1051 -167 R1100 -35 C1003 R1102 20 R1109 1 C1004 R1001 59 R1002 161 C1004 R1051 161 R1100 31 C1004 R1103 -19 R1109 -1 C1005 R1001 39 R1002 -35 C1005 R1051 -35 R1100 -32 C1005 R1104 20 R1109 1 C1006 R1002 -120 R1051 -120 C1006 R1110 1 C1007 R1002 -189 R1051 -189 C1007 R1110 1 C1008 R1001 118 R1002 -68 C1008 R1051 -68 R1174 1 C1009 R1002 -68 R1051 -68 C1009 R1105 20 C1010 R1001 29 R1002 -71 C1010 R1051 -71 R1106 20 C1011 R1001 186 R1003 -106 C1011 R1052 106 R1175 1 C1012 R1001 110 R1003 -59 C1012 R1052 59 R1101 13 C1013 R1001 6 R1003 -10 C1013 R1052 10 R1173 1 C1014 R1001 154 R1003 -167 C1014 R1052 167 R1100 -27 C1014 R1102 13 R1111 1 C1015 R1001 38 R1003 161 C1015 R1052 -161 R1100 24 C1015 R1103 -12 R1111 -1 C1016 R1001 26 R1003 -35 C1016 R1052 35 R1100 -25 C1016 R1104 13 R1111 1 C1017 R1003 -120 R1052 120 C1017 R1112 1 C1018 R1003 -189 R1052 189 C1018 R1112 1 C1019 R1001 77 R1003 -68 C1019 R1052 68 R1174 1 C1020 R1003 -68 R1052 68 C1020 R1105 13 C1021 R1001 19 R1003 -71 C1021 R1052 71 R1106 13 C1022 R1001 128 R1004 -59 C1022 R1053 -59 R1101 15 C1023 R1001 7 R1004 -10 C1023 R1053 -10 R1173 1 C1024 R1001 179 R1004 -167 C1024 R1053 -167 R1100 -26 C1024 R1102 15 R1113 1 C1025 R1001 45 R1004 161 C1025 R1053 161 R1100 23 C1025 R1103 -14 R1113 -1 C1026 R1001 30 R1004 -35 C1026 R1053 -35 R1100 -24 C1026 R1104 15 R1113 1 C1027 R1004 -120 R1053 -120 C1027 R1114 1 C1028 R1004 -189 R1053 -189 C1028 R1114 1 C1029 R1001 89 R1004 -68 C1029 R1053 -68 R1174 1 C1030 R1001 22 R1004 -71 C1030 R1053 -71 R1106 15 C1031 R1001 674 R1005 -59 C1031 R1054 59 R1101 78 C1032 R1001 39 R1005 -10 C1032 R1054 10 R1173 1 C1033 R1001 941 R1005 -167 C1033 R1054 167 R1100 -139 C1033 R1102 78 R1115 1 C1034 R1001 235 R1005 161 C1034 R1054 -161 R1100 127 C1034 R1103 -77 R1115 -1 C1035 R1001 157 R1005 -35 C1035 R1054 35 R1100 -128 C1035 R1104 78 R1115 1 C1036 R1005 -120 R1054 120 C1036 R1116 1 C1037 R1005 -189 R1054 189 C1037 R1116 1 C1038 R1001 470 R1005 -68 C1038 R1054 68 R1174 1 C1039 R1005 -68 R1054 68 C1039 R1105 78 C1040 R1001 118 R1005 -71 C1040 R1054 71 R1106 78 C1041 R1001 755 R1006 -106 C1041 R1055 106 R1175 1 C1042 R1001 445 R1006 -59 C1042 R1055 59 R1101 52 C1043 R1001 26 R1006 -10 C1043 R1055 10 R1173 1 C1044 R1001 622 R1006 -167 C1044 R1055 167 R1100 -109 C1044 R1102 52 R1117 1 C1045 R1001 155 R1006 161 C1045 R1055 -161 R1100 99 C1045 R1103 -51 R1117 -1 C1046 R1001 104 R1006 -35 C1046 R1055 35 R1100 -100 C1046 R1104 52 R1117 1 C1047 R1006 -120 R1055 120 C1047 R1118 1 C1048 R1006 -189 R1055 189 C1048 R1118 1 C1049 R1001 311 R1006 -68 C1049 R1055 68 R1174 1 C1050 R1006 -68 R1055 68 C1050 R1105 52 C1051 R1001 78 R1006 -71 C1051 R1055 71 R1106 52 C1052 R1001 159 R1007 -106 C1052 R1056 106 R1175 1 C1053 R1001 94 R1007 -59 C1053 R1056 59 R1101 11 C1054 R1001 5 R1007 -10 C1054 R1056 10 R1173 1 C1055 R1001 251 R1007 45 C1055 R1056 -45 R1107 -10 C1055 R1108 11 C1056 R1007 -120 R1056 120 C1056 R1119 1 C1057 R1007 -189 R1056 189 C1057 R1119 1 C1058 R1001 65 R1007 -68 C1058 R1056 68 R1174 1 C1059 R1007 -68 R1056 68 C1059 R1105 11 C1060 R1001 16 R1007 -71 C1060 R1056 71 R1106 11 C1061 R1001 6 R1008 -10 C1061 R1057 10 R1173 1 C1062 R1001 37 R1008 161 C1062 R1057 -161 R1100 25 C1062 R1103 -11 R1120 -1 C1063 R1001 25 R1008 -35 C1063 R1057 35 R1100 -26 C1063 R1104 12 R1120 1 C1064 R1001 74 R1008 -68 C1064 R1057 68 R1174 1 C1065 R1008 -68 R1057 68 C1065 R1105 12 C1066 R1001 18 R1008 -71 C1066 R1057 71 R1106 12 C1067 R1001 17 R1009 -10 C1067 R1058 10 R1173 1 C1068 R1001 101 R1009 161 C1068 R1058 -161 R1100 80 C1068 R1103 -33 R1121 -1 C1069 R1001 67 R1009 -35 C1069 R1058 35 R1100 -81 C1069 R1104 34 R1121 1 C1070 R1001 202 R1009 -68 C1070 R1058 68 R1174 1 C1071 R1009 -68 R1058 68 C1071 R1105 34 C1072 R1001 50 R1009 -71 C1072 R1058 71 R1106 34 C1073 R1001 74 R1010 -136 C1073 R1059 136 R1176 1 C1074 R1001 6 R1010 -10 C1074 R1059 10 R1173 1 C1075 R1001 37 R1010 161 C1075 R1059 -161 R1100 15 C1075 R1103 -11 R1122 -1 C1076 R1001 25 R1010 -35 C1076 R1059 35 R1100 -16 C1076 R1104 12 R1122 1 C1077 R1001 74 R1010 -68 C1077 R1059 68 R1174 1 C1078 R1010 -68 R1059 68 C1078 R1105 12 C1079 R1001 18 R1010 -71 C1079 R1059 71 R1106 12 C1080 R1001 265 R1011 -59 C1080 R1060 59 R1101 31 C1081 R1001 15 R1011 -10 C1081 R1060 10 R1173 1 C1082 R1001 370 R1011 -167 C1082 R1060 167 R1100 -58 C1082 R1102 31 R1123 1 C1083 R1001 92 R1011 161 C1083 R1060 -161 R1100 52 C1083 R1103 -30 R1123 -1 C1084 R1001 62 R1011 -35 C1084 R1060 35 R1100 -53 C1084 R1104 31 R1123 1 C1085 R1011 -120 R1060 120 C1085 R1124 1 C1086 R1011 -189 R1060 189 C1086 R1124 1 C1087 R1001 185 R1011 -68 C1087 R1060 68 R1174 1 C1088 R1011 -68 R1060 68 C1088 R1105 31 C1089 R1001 46 R1011 -71 C1089 R1060 71 R1106 31 C1090 R1001 296 R1012 -106 C1090 R1061 106 R1175 1 C1091 R1001 175 R1012 -59 C1091 R1061 59 R1101 20 C1092 R1001 10 R1012 -10 C1092 R1061 10 R1173 1 C1093 R1001 244 R1012 -167 C1093 R1061 167 R1100 -43 C1093 R1102 20 R1125 1 C1094 R1001 61 R1012 161 C1094 R1061 -161 R1100 38 C1094 R1103 -19 R1125 -1 C1095 R1001 41 R1012 -35 C1095 R1061 35 R1100 -39 C1095 R1104 20 R1125 1 C1096 R1012 -120 R1061 120 C1096 R1126 1 C1097 R1012 -189 R1061 189 C1097 R1126 1 C1098 R1001 122 R1012 -68 C1098 R1061 68 R1174 1 C1099 R1012 -68 R1061 68 C1099 R1105 20 C1100 R1001 30 R1012 -71 C1100 R1061 71 R1106 20 C1101 R1001 156 R1013 -59 C1101 R1062 59 R1101 18 C1102 R1001 9 R1013 -10 C1102 R1062 10 R1173 1 C1103 R1001 217 R1013 -167 C1103 R1062 167 R1100 -33 C1103 R1102 18 R1127 1 C1104 R1001 54 R1013 161 C1104 R1062 -161 R1100 30 C1104 R1103 -17 R1127 -1 C1105 R1001 36 R1013 -35 C1105 R1062 35 R1100 -31 C1105 R1104 18 R1127 1 C1106 R1013 -120 R1062 120 C1106 R1128 1 C1107 R1013 -189 R1062 189 C1107 R1128 1 C1108 R1001 109 R1013 -68 C1108 R1062 68 R1174 1 C1109 R1001 27 R1013 -71 C1109 R1062 71 R1106 18 C1110 R1001 819 R1014 -59 C1110 R1063 59 R1101 95 C1111 R1001 48 R1014 -10 C1111 R1063 10 R1173 1 C1112 R1001 1142 R1014 -167 C1112 R1063 167 R1100 -178 C1112 R1102 95 R1129 1 C1113 R1001 286 R1014 161 C1113 R1063 -161 R1100 163 C1113 R1103 -94 R1129 -1 C1114 R1001 190 R1014 -35 C1114 R1063 35 R1100 -164 C1114 R1104 95 R1129 1 C1115 R1014 -120 R1063 120 C1115 R1130 1 C1116 R1014 -189 R1063 189 C1116 R1130 1 C1117 R1001 571 R1014 -68 C1117 R1063 68 R1174 1 C1118 R1014 -68 R1063 68 C1118 R1105 95 C1119 R1001 143 R1014 -71 C1119 R1063 71 R1106 95 C1120 R1001 916 R1015 -106 C1120 R1064 106 R1175 1 C1121 R1001 541 R1015 -59 C1121 R1064 59 R1101 63 C1122 R1001 31 R1015 -10 C1122 R1064 10 R1173 1 C1123 R1001 755 R1015 -167 C1123 R1064 167 R1100 -132 C1123 R1102 63 R1131 1 C1124 R1001 189 R1015 161 C1124 R1064 -161 R1100 121 C1124 R1103 -62 R1131 -1 C1125 R1001 126 R1015 -35 C1125 R1064 35 R1100 -122 C1125 R1104 63 R1131 1 C1126 R1015 -120 R1064 120 C1126 R1132 1 C1127 R1015 -189 R1064 189 C1127 R1132 1 C1128 R1001 377 R1015 -68 C1128 R1064 68 R1174 1 C1129 R1015 -68 R1064 68 C1129 R1105 63 C1130 R1001 94 R1015 -71 C1130 R1064 71 R1106 63 C1131 R1001 194 R1016 -106 C1131 R1065 106 R1175 1 C1132 R1001 114 R1016 -59 C1132 R1065 59 R1101 13 C1133 R1001 7 R1016 -10 C1133 R1065 10 R1173 1 C1134 R1001 306 R1016 45 C1134 R1065 -45 R1107 -12 C1134 R1108 13 C1135 R1016 -120 R1065 120 C1135 R1133 1 C1136 R1016 -189 R1065 189 C1136 R1133 1 C1137 R1001 80 R1016 -68 C1137 R1065 68 R1174 1 C1138 R1016 -68 R1065 68 C1138 R1105 13 C1139 R1001 20 R1016 -71 C1139 R1065 71 R1106 13 C1140 R1001 5 R1017 -10 C1140 R1066 10 R1173 1 C1141 R1001 30 R1017 161 C1141 R1066 -161 R1100 21 C1141 R1103 -9 R1134 -1 C1142 R1001 20 R1017 -35 C1142 R1066 35 R1100 -22 C1142 R1104 10 R1134 1 C1143 R1001 61 R1017 -68 C1143 R1066 68 R1174 1 C1144 R1017 -68 R1066 68 C1144 R1105 10 C1145 R1001 15 R1017 -71 C1145 R1066 71 R1106 10 C1146 R1001 14 R1018 -10 C1146 R1067 10 R1173 1 C1147 R1001 83 R1018 161 C1147 R1067 -161 R1100 69 C1147 R1103 -27 R1135 -1 C1148 R1001 55 R1018 -35 C1148 R1067 35 R1100 -70 C1148 R1104 28 R1135 1 C1149 R1001 165 R1018 -68 C1149 R1067 68 R1174 1 C1150 R1018 -68 R1067 68 C1150 R1105 28 C1151 R1001 41 R1018 -71 C1151 R1067 71 R1106 28 C1152 R1001 60 R1019 -136 C1152 R1068 136 R1176 1 C1153 R1001 5 R1019 -10 C1153 R1068 10 R1173 1 C1154 R1001 30 R1019 161 C1154 R1068 -161 R1100 12 C1154 R1103 -9 R1136 -1 C1155 R1001 20 R1019 -35 C1155 R1068 35 R1100 -13 C1155 R1104 10 R1136 1 C1156 R1001 60 R1019 -68 C1156 R1068 68 R1174 1 C1157 R1019 -68 R1068 68 C1157 R1105 10 C1158 R1001 15 R1019 -71 C1158 R1068 71 R1106 10 C1159 R1001 192 R1020 -81 C1159 R1069 81 R1177 1 C1160 R1001 87 R1020 -59 C1160 R1069 59 R1101 10 C1161 R1001 5 R1020 -10 C1161 R1069 10 R1173 1 C1162 R1001 121 R1020 -167 C1162 R1069 167 R1100 -20 C1162 R1102 10 R1137 1 C1163 R1001 30 R1020 161 C1163 R1069 -161 R1100 17 C1163 R1103 -9 R1137 -1 C1164 R1001 20 R1020 -35 C1164 R1069 35 R1100 -18 C1164 R1104 10 R1137 1 C1165 R1020 -120 R1069 120 C1165 R1138 1 C1166 R1020 -189 R1069 189 C1166 R1138 1 C1167 R1001 61 R1020 -68 C1167 R1069 68 R1174 1 C1168 R1001 455 R1020 -149 C1168 R1069 149 C1169 R1001 69 R1020 -100 C1169 R1069 100 C1170 R1001 55 R1020 -77 C1170 R1069 77 C1171 R1001 15 R1020 -71 C1171 R1069 71 R1106 10 C1172 R1001 209 R1021 -81 C1172 R1070 81 R1177 1 C1173 R1001 95 R1021 -59 C1173 R1070 59 R1101 11 C1174 R1001 6 R1021 -10 C1174 R1070 10 R1173 1 C1175 R1001 33 R1021 161 C1175 R1070 -161 R1100 23 C1175 R1103 -10 R1139 -1 C1176 R1001 22 R1021 -35 C1176 R1070 35 R1100 -24 C1176 R1104 11 R1139 1 C1177 R1021 -120 R1070 120 C1177 R1140 1 C1178 R1021 -189 R1070 189 C1178 R1140 1 C1179 R1001 66 R1021 -68 C1179 R1070 68 R1174 1 C1180 R1001 495 R1021 -149 C1180 R1070 149 C1181 R1001 75 R1021 -100 C1181 R1070 100 C1182 R1001 59 R1021 -77 C1182 R1070 77 C1183 R1001 17 R1021 -71 C1183 R1070 71 R1106 11 C1184 R1001 234 R1022 -81 C1184 R1071 81 R1177 1 C1185 R1001 106 R1022 -59 C1185 R1071 59 R1101 12 C1186 R1001 6 R1022 -10 C1186 R1071 10 R1173 1 C1187 R1001 37 R1022 161 C1187 R1071 -161 R1100 26 C1187 R1103 -11 R1141 -1 C1188 R1001 25 R1022 -35 C1188 R1071 35 R1100 -27 C1188 R1104 12 R1141 1 C1189 R1022 -120 R1071 120 C1189 R1142 1 C1190 R1022 -189 R1071 189 C1190 R1142 1 C1191 R1001 74 R1022 -68 C1191 R1071 68 R1174 1 C1192 R1001 554 R1022 -149 C1192 R1071 149 C1193 R1001 84 R1022 -100 C1193 R1071 100 C1194 R1001 66 R1022 -77 C1194 R1071 77 C1195 R1001 18 R1022 -71 C1195 R1071 71 R1106 12 C1196 R1001 229 R1023 -93 C1196 R1072 -93 R1175 1 C1197 R1001 266 R1023 -81 C1197 R1072 -81 R1177 1 C1198 R1001 120 R1023 -59 C1198 R1072 -59 R1101 14 C1199 R1001 7 R1023 -10 C1199 R1072 -10 R1173 1 C1200 R1001 168 R1023 -167 C1200 R1072 -167 R1100 -32 C1200 R1102 14 R1143 1 C1201 R1001 42 R1023 161 C1201 R1072 161 R1100 29 C1201 R1103 -13 R1143 -1 C1202 R1001 28 R1023 -35 C1202 R1072 -35 R1100 -30 C1202 R1104 14 R1143 1 C1203 R1023 -120 R1072 -120 C1203 R1144 1 C1204 R1023 -189 R1072 -189 C1204 R1144 1 C1205 R1001 84 R1023 -68 C1205 R1072 -68 R1174 1 C1206 R1001 630 R1023 -149 C1206 R1072 -149 C1207 R1001 95 R1023 -100 C1207 R1072 -100 C1208 R1001 76 R1023 -77 C1208 R1072 -77 C1209 R1001 21 R1023 -71 C1209 R1072 -71 R1106 14 C1210 R1001 7 R1024 -10 C1210 R1073 10 R1173 1 C1211 R1001 44 R1024 161 C1211 R1073 -161 R1100 36 C1211 R1103 -14 R1145 -1 C1212 R1001 29 R1024 -35 C1212 R1073 35 R1100 -37 C1212 R1104 15 R1145 1 C1213 R1001 87 R1024 -68 C1213 R1073 68 R1174 1 C1214 R1001 653 R1024 -149 C1214 R1073 149 C1215 R1001 99 R1024 -100 C1215 R1073 100 C1216 R1001 22 R1024 -71 C1216 R1073 71 R1106 15 C1217 R1001 209 R1025 -81 C1217 R1074 81 R1177 1 C1218 R1001 95 R1025 -59 C1218 R1074 59 R1101 11 C1219 R1001 6 R1025 -10 C1219 R1074 10 R1173 1 C1220 R1001 33 R1025 161 C1220 R1074 -161 R1100 23 C1220 R1103 -10 R1146 -1 C1221 R1001 22 R1025 -35 C1221 R1074 35 R1100 -24 C1221 R1104 11 R1146 1 C1222 R1025 -120 R1074 120 C1222 R1147 1 C1223 R1025 -189 R1074 189 C1223 R1147 1 C1224 R1001 66 R1025 -68 C1224 R1074 68 R1174 1 C1225 R1001 495 R1025 -149 C1225 R1074 149 C1226 R1001 75 R1025 -100 C1226 R1074 100 C1227 R1001 59 R1025 -77 C1227 R1074 77 C1228 R1001 17 R1025 -71 C1228 R1074 71 R1106 11 C1229 R1001 494 R1026 -81 C1229 R1075 81 R1177 1 C1230 R1001 224 R1026 -59 C1230 R1075 59 R1101 26 C1231 R1001 13 R1026 -10 C1231 R1075 10 R1173 1 C1232 R1001 78 R1026 161 C1232 R1075 -161 R1100 56 C1232 R1103 -25 R1148 -1 C1233 R1001 52 R1026 -35 C1233 R1075 35 R1100 -57 C1233 R1104 26 R1148 1 C1234 R1026 -120 R1075 120 C1234 R1149 1 C1235 R1026 -189 R1075 189 C1235 R1149 1 C1236 R1001 156 R1026 -68 C1236 R1075 68 R1174 1 C1237 R1001 1170 R1026 -149 C1237 R1075 149 C1238 R1001 177 R1026 -100 C1238 R1075 100 C1239 R1001 140 R1026 -77 C1239 R1075 77 C1240 R1001 39 R1026 -71 C1240 R1075 71 R1106 26 C1241 R1001 208 R1027 -93 C1241 R1076 -93 R1175 1 C1242 R1001 241 R1027 -81 C1242 R1076 -81 R1177 1 C1243 R1001 109 R1027 -59 C1243 R1076 -59 R1101 13 C1244 R1001 76 R1027 -145 C1244 R1076 -145 C1245 R1001 6 R1027 -10 C1245 R1076 -10 R1173 1 C1246 R1001 292 R1027 45 C1246 R1076 45 R1107 -12 C1246 R1108 13 C1247 R1027 -120 R1076 -120 C1247 R1150 1 C1248 R1027 -189 R1076 -189 C1248 R1150 1 C1249 R1001 76 R1027 -68 C1249 R1076 -68 R1174 1 C1250 R1001 571 R1027 -149 C1250 R1076 -149 C1251 R1001 86 R1027 -100 C1251 R1076 -100 C1252 R1001 69 R1027 -77 C1252 R1076 -77 C1253 R1001 19 R1027 -71 C1253 R1076 -71 R1106 13 C1254 R1001 110 R1028 -59 C1254 R1077 59 R1101 13 C1255 R1001 77 R1028 -145 C1255 R1077 145 C1256 R1001 6 R1028 -10 C1256 R1077 10 R1173 1 C1257 R1001 154 R1028 -167 C1257 R1077 167 R1100 -28 C1257 R1102 13 R1151 1 C1258 R1001 38 R1028 161 C1258 R1077 -161 R1100 25 C1258 R1103 -12 R1151 -1 C1259 R1001 26 R1028 -35 C1259 R1077 35 R1100 -26 C1259 R1104 13 R1151 1 C1260 R1028 -120 R1077 120 C1260 R1152 1 C1261 R1028 -189 R1077 189 C1261 R1152 1 C1262 R1001 77 R1028 -68 C1262 R1077 68 R1174 1 C1263 R1001 261 R1028 -189 C1263 R1077 189 C1264 R1001 59 R1028 -104 C1264 R1077 104 C1265 R1001 51 R1028 -110 C1265 R1077 110 C1266 R1001 19 R1028 -71 C1266 R1077 71 R1106 13 C1267 R1001 583 R1029 -93 C1267 R1078 93 R1175 1 C1268 R1001 306 R1029 -59 C1268 R1078 59 R1101 36 C1269 R1001 214 R1029 -145 C1269 R1078 145 C1270 R1001 18 R1029 -10 C1270 R1078 10 R1173 1 C1271 R1001 427 R1029 -167 C1271 R1078 167 R1100 -77 C1271 R1102 36 R1153 1 C1272 R1001 107 R1029 161 C1272 R1078 -161 R1100 70 C1272 R1103 -35 R1153 -1 C1273 R1001 71 R1029 -35 C1273 R1078 35 R1100 -71 C1273 R1104 36 R1153 1 C1274 R1029 -120 R1078 120 C1274 R1154 1 C1275 R1029 -189 R1078 189 C1275 R1154 1 C1276 R1001 214 R1029 -68 C1276 R1078 68 R1174 1 C1277 R1001 725 R1029 -189 C1277 R1078 189 C1278 R1001 164 R1029 -104 C1278 R1078 104 C1279 R1001 142 R1029 -110 C1279 R1078 110 C1280 R1001 53 R1029 -71 C1280 R1078 71 R1106 36 C1281 R1001 144 R1030 -59 C1281 R1079 59 R1101 17 C1282 R1001 42 R1030 -155 C1282 R1079 155 C1283 R1001 8 R1030 -10 C1283 R1079 10 R1173 1 C1284 R1001 202 R1030 -167 C1284 R1079 167 R1100 -34 C1284 R1102 17 R1155 1 C1285 R1001 50 R1030 161 C1285 R1079 -161 R1100 31 C1285 R1103 -16 R1155 -1 C1286 R1001 34 R1030 -35 C1286 R1079 35 R1100 -32 C1286 R1104 17 R1155 1 C1287 R1030 -120 R1079 120 C1287 R1156 1 C1288 R1030 -189 R1079 189 C1288 R1156 1 C1289 R1001 101 R1030 -68 C1289 R1079 68 R1174 1 C1290 R1001 342 R1030 -189 C1290 R1079 189 C1291 R1001 77 R1030 -104 C1291 R1079 104 C1292 R1001 67 R1030 -110 C1292 R1079 110 C1293 R1001 25 R1030 -71 C1293 R1079 71 R1106 17 C1294 R1001 1193 R1031 -93 C1294 R1080 93 R1175 1 C1295 R1001 626 R1031 -59 C1295 R1080 59 R1101 73 C1296 R1001 437 R1031 -145 C1296 R1080 145 C1297 R1001 36 R1031 -10 C1297 R1080 10 R1173 1 C1298 R1001 874 R1031 -167 C1298 R1080 167 R1100 -158 C1298 R1102 73 R1157 1 C1299 R1001 218 R1031 161 C1299 R1080 -161 R1100 144 C1299 R1103 -72 R1157 -1 C1300 R1001 146 R1031 -35 C1300 R1080 35 R1100 -145 C1300 R1104 73 R1157 1 C1301 R1031 -120 R1080 120 C1301 R1158 1 C1302 R1031 -189 R1080 189 C1302 R1158 1 C1303 R1001 437 R1031 -68 C1303 R1080 68 R1174 1 C1304 R1001 1482 R1031 -189 C1304 R1080 189 C1305 R1001 335 R1031 -104 C1305 R1080 104 C1306 R1001 291 R1031 -110 C1306 R1080 110 C1307 R1001 109 R1031 -71 C1307 R1080 71 R1106 73 C1308 R1001 328 R1032 -93 C1308 R1081 93 R1175 1 C1309 R1001 172 R1032 -59 C1309 R1081 59 R1101 20 C1310 R1001 120 R1032 -136 C1310 R1081 136 R1176 1 C1311 R1001 10 R1032 -10 C1311 R1081 10 R1173 1 C1312 R1001 240 R1032 -167 C1312 R1081 167 R1100 -24 C1312 R1102 20 R1159 1 C1313 R1001 60 R1032 161 C1313 R1081 -161 R1100 21 C1313 R1103 -19 R1159 -1 C1314 R1001 40 R1032 -35 C1314 R1081 35 R1100 -22 C1314 R1104 20 R1159 1 C1315 R1032 -138 R1081 138 C1316 R1001 120 R1032 -68 C1316 R1081 68 R1174 1 C1317 R1001 407 R1032 -189 C1317 R1081 189 C1318 R1001 92 R1032 -104 C1318 R1081 104 C1319 R1001 80 R1032 -110 C1319 R1081 110 C1320 R1001 30 R1032 -71 C1320 R1081 71 R1106 20 C1321 R1001 164 R1033 -93 C1321 R1082 93 R1175 1 C1322 R1001 60 R1033 -145 C1322 R1082 145 C1323 R1001 5 R1033 -10 C1323 R1082 10 R1173 1 C1324 R1001 30 R1033 161 C1324 R1082 -161 R1100 22 C1324 R1103 -9 R1160 -1 C1325 R1001 20 R1033 -35 C1325 R1082 35 R1100 -23 C1325 R1104 10 R1160 1 C1326 R1001 60 R1033 -68 C1326 R1082 68 R1174 1 C1327 R1001 204 R1033 -189 C1327 R1082 189 C1328 R1001 46 R1033 -104 C1328 R1082 104 C1329 R1001 15 R1033 -71 C1329 R1082 71 R1106 10 C1330 R1001 220 R1034 -93 C1330 R1083 93 R1175 1 C1331 R1001 80 R1034 -145 C1331 R1083 145 C1332 R1001 7 R1034 -10 C1332 R1083 10 R1173 1 C1333 R1001 27 R1034 -35 C1333 R1083 35 R1100 -33 C1333 R1104 13 R1161 1 C1334 R1001 80 R1034 -68 C1334 R1083 68 R1174 1 C1335 R1001 273 R1034 -189 C1335 R1083 189 C1336 R1001 62 R1034 -104 C1336 R1083 104 C1337 R1001 20 R1034 -71 C1337 R1083 71 R1106 13 C1338 R1001 285 R1035 -93 C1338 R1084 93 R1175 1 C1339 R1001 104 R1035 -145 C1339 R1084 145 C1340 R1001 9 R1035 -10 C1340 R1084 10 R1173 1 C1341 R1035 -189 R1084 189 C1342 R1001 104 R1035 -68 C1342 R1084 68 R1174 1 C1343 R1001 354 R1035 -189 C1343 R1084 189 C1344 R1001 80 R1035 -104 C1344 R1084 104 C1345 R1001 70 R1035 -110 C1345 R1084 110 C1346 R1001 26 R1035 -71 C1346 R1084 71 R1106 17 C1347 R1001 918 R1036 -93 C1347 R1085 93 R1175 1 C1348 R1001 336 R1036 -145 C1348 R1085 145 C1349 R1001 28 R1036 -10 C1349 R1085 10 R1173 1 C1350 R1036 -189 R1085 189 C1351 R1001 336 R1036 -68 C1351 R1085 68 R1174 1 C1352 R1001 1140 R1036 -189 C1352 R1085 189 C1353 R1001 258 R1036 -104 C1353 R1085 104 C1354 R1001 224 R1036 -110 C1354 R1085 110 C1355 R1001 84 R1036 -71 C1355 R1085 71 R1106 56 C1356 R1001 256 R1037 -93 C1356 R1086 -93 R1175 1 C1357 R1001 94 R1037 -136 C1357 R1086 -136 R1176 1 C1358 R1001 8 R1037 -10 C1358 R1086 -10 R1173 1 C1359 R1001 187 R1037 -167 C1359 R1086 -167 R1100 -19 C1359 R1102 16 C1360 R1037 -138 R1086 -138 C1361 R1001 94 R1037 -68 C1361 R1086 -68 R1174 1 C1362 R1001 318 R1037 -189 C1362 R1086 -189 C1363 R1001 72 R1037 -104 C1363 R1086 -104 C1364 R1001 62 R1037 -110 C1364 R1086 -110 C1365 R1001 23 R1037 -71 C1365 R1086 -71 R1106 16 C1366 R1001 166 R1038 -93 C1366 R1087 93 R1175 1 C1367 R1001 87 R1038 -59 C1367 R1087 59 R1101 10 C1368 R1001 5 R1038 -10 C1368 R1087 10 R1173 1 C1369 R1001 121 R1038 -167 C1369 R1087 167 R1100 -23 C1369 R1102 10 R1162 1 C1370 R1001 30 R1038 161 C1370 R1087 -161 R1100 20 C1370 R1103 -9 R1162 -1 C1371 R1001 20 R1038 -35 C1371 R1087 35 R1100 -21 C1371 R1104 10 R1162 1 C1372 R1038 -120 R1087 120 C1372 R1163 1 C1373 R1038 -189 R1087 189 C1373 R1163 1 C1374 R1001 61 R1038 -68 C1374 R1087 68 R1174 1 C1375 R1001 273 R1038 -180 C1375 R1087 180 C1376 R1001 56 R1038 -120 C1376 R1087 120 C1377 R1001 45 R1038 -100 C1377 R1087 100 C1378 R1001 15 R1038 -71 C1378 R1087 71 R1106 10 C1379 R1001 229 R1039 -59 C1379 R1088 59 R1101 27 C1380 R1001 36 R1039 -34 C1380 R1088 34 C1381 R1001 13 R1039 -10 C1381 R1088 10 R1173 1 C1382 R1001 319 R1039 -167 C1382 R1088 167 R1100 -52 C1382 R1102 27 R1164 1 C1383 R1001 80 R1039 161 C1383 R1088 -161 R1100 47 C1383 R1103 -26 R1164 -1 C1384 R1001 53 R1039 -35 C1384 R1088 35 R1100 -48 C1384 R1104 27 R1164 1 C1385 R1039 -120 R1088 120 C1385 R1165 1 C1386 R1039 -189 R1088 189 C1386 R1165 1 C1387 R1001 160 R1039 -68 C1387 R1088 68 R1174 1 C1388 R1001 718 R1039 -180 C1388 R1088 180 C1389 R1001 146 R1039 -120 C1389 R1088 120 C1390 R1001 120 R1039 -100 C1390 R1088 100 C1391 R1001 40 R1039 -71 C1391 R1088 71 R1106 27 C1392 R1001 430 R1040 -59 C1392 R1089 59 R1101 50 C1393 R1001 25 R1040 -10 C1393 R1089 10 R1173 1 C1394 R1001 600 R1040 -167 C1394 R1089 167 R1100 -120 C1394 R1102 50 R1166 1 C1395 R1001 150 R1040 161 C1395 R1089 -161 R1100 109 C1395 R1103 -49 R1166 -1 C1396 R1001 100 R1040 -35 C1396 R1089 35 R1100 -110 C1396 R1104 50 R1166 1 C1397 R1040 -120 R1089 120 C1397 R1167 1 C1398 R1040 -189 R1089 189 C1398 R1167 1 C1399 R1001 300 R1040 -68 C1399 R1089 68 R1174 1 C1400 R1001 1350 R1040 -180 C1400 R1089 180 C1401 R1001 275 R1040 -120 C1401 R1089 120 C1402 R1001 225 R1040 -100 C1402 R1089 100 C1403 R1001 75 R1040 -71 C1403 R1089 71 R1106 50 C1404 R1001 356 R1041 -93 C1404 R1090 93 R1175 1 C1405 R1001 187 R1041 -59 C1405 R1090 59 R1101 22 C1406 R1001 11 R1041 -10 C1406 R1090 10 R1173 1 C1407 R1001 260 R1041 -167 C1407 R1090 167 R1100 -46 C1407 R1102 22 R1168 1 C1408 R1001 65 R1041 161 C1408 R1090 -161 R1100 41 C1408 R1103 -21 R1168 -1 C1409 R1001 43 R1041 -35 C1409 R1090 35 R1100 -42 C1409 R1104 22 R1168 1 C1410 R1041 -120 R1090 120 C1410 R1169 1 C1411 R1041 -189 R1090 189 C1411 R1169 1 C1412 R1001 130 R1041 -68 C1412 R1090 68 R1174 1 C1413 R1001 586 R1041 -180 C1413 R1090 180 C1414 R1001 119 R1041 -120 C1414 R1090 120 C1415 R1001 98 R1041 -100 C1415 R1090 100 C1416 R1001 33 R1041 -71 C1416 R1090 71 R1106 22 C1417 R1001 313 R1042 -93 C1417 R1091 93 R1175 1 C1418 R1001 26 R1042 -34 C1418 R1091 34 C1419 R1001 10 R1042 -10 C1419 R1091 10 R1173 1 C1420 R1001 229 R1042 -167 C1420 R1091 167 R1100 -42 C1420 R1102 19 R1170 1 C1421 R1001 57 R1042 161 C1421 R1091 -161 R1100 38 C1421 R1103 -18 R1170 -1 C1422 R1001 38 R1042 -35 C1422 R1091 35 R1100 -39 C1422 R1104 19 R1170 1 C1423 R1042 -120 R1091 120 C1423 R1171 1 C1424 R1042 -189 R1091 189 C1424 R1171 1 C1425 R1001 115 R1042 -68 C1425 R1091 68 R1174 1 C1426 R1001 516 R1042 -180 C1426 R1091 180 C1427 R1001 105 R1042 -120 C1427 R1091 120 C1428 R1001 86 R1042 -100 C1428 R1091 100 C1429 R1001 29 R1042 -71 C1429 R1091 71 R1106 19 C1430 R1001 6 R1043 -10 C1430 R1092 10 R1173 1 C1431 R1001 24 R1043 -35 C1431 R1092 35 R1100 -33 C1431 R1104 12 R1172 1 C1432 R1001 72 R1043 -68 C1432 R1092 68 R1174 1 C1433 R1001 324 R1043 -180 C1433 R1092 180 C1434 R1001 66 R1043 -120 C1434 R1092 120 C1435 R1001 18 R1043 -71 C1435 R1092 71 R1106 12 C1436 R1001 211 R1044 -93 C1436 R1093 93 R1175 1 C1437 R1001 17 R1044 -34 C1437 R1093 34 C1438 R1001 6 R1044 -10 C1438 R1093 10 R1173 1 C1439 R1001 39 R1044 161 C1439 R1093 -161 R1100 23 C1439 R1103 -12 C1440 R1044 -189 R1093 189 C1441 R1001 77 R1044 -68 C1441 R1093 68 R1174 1 C1442 R1001 348 R1044 -180 C1442 R1093 180 C1443 R1001 71 R1044 -120 C1443 R1093 120 C1444 R1001 58 R1044 -100 C1444 R1093 100 C1445 R1001 19 R1044 -71 C1445 R1093 71 R1106 13 C1446 R1001 285 R1045 -93 C1446 R1094 93 R1175 1 C1447 R1001 9 R1045 -10 C1447 R1094 10 R1173 1 C1448 R1045 -189 R1094 189 C1449 R1001 104 R1045 -68 C1449 R1094 68 R1174 1 C1450 R1001 470 R1045 -180 C1450 R1094 180 C1451 R1001 96 R1045 -120 C1451 R1094 120 C1452 R1001 78 R1045 -100 C1452 R1094 100 C1453 R1001 26 R1045 -71 C1453 R1094 71 R1106 17 C1454 R1001 1454 R1046 -93 C1454 R1095 93 R1175 1 C1455 R1001 44 R1046 -10 C1455 R1095 10 R1173 1 C1456 R1046 -189 R1095 189 C1457 R1001 532 R1046 -68 C1457 R1095 68 R1174 1 C1458 R1001 4435 R1046 -192 C1458 R1095 192 C1459 R1001 488 R1046 -120 C1459 R1095 120 C1460 R1001 399 R1046 -100 C1460 R1095 100 C1461 R1001 133 R1046 -71 C1461 R1095 71 R1106 89 C1462 R1001 295 R1047 -93 C1462 R1096 93 R1175 1 C1463 R1001 9 R1047 -10 C1463 R1096 10 R1173 1 C1464 R1047 -189 R1096 189 C1465 R1001 108 R1047 -68 C1465 R1096 68 R1174 1 C1466 R1001 900 R1047 -192 C1466 R1096 192 C1467 R1001 99 R1047 -120 C1467 R1096 120 C1468 R1001 81 R1047 -100 C1468 R1096 100 C1469 R1001 27 R1047 -71 C1469 R1096 71 R1106 18 C1470 R1001 164 R1048 -93 C1470 R1097 93 R1175 1 C1471 R1001 60 R1048 -136 C1471 R1097 136 R1176 1 C1472 R1001 5 R1048 -10 C1472 R1097 10 R1173 1 C1473 R1048 -138 R1097 138 C1474 R1001 60 R1048 -68 C1474 R1097 68 R1174 1 C1475 R1001 500 R1048 -192 C1475 R1097 192 C1476 R1001 55 R1048 -120 C1476 R1097 120 C1477 R1001 45 R1048 -100 C1477 R1097 100 C1478 R1001 15 R1048 -71 C1478 R1097 71 R1106 10 C1479 R1001 1165 R1049 -93 C1479 R1098 -93 R1175 1 C1480 R1001 36 R1049 -10 C1480 R1098 -10 R1173 1 C1481 R1049 -189 R1098 -189 C1482 R1001 427 R1049 -68 C1482 R1098 -68 R1174 1 C1483 R1001 3555 R1049 -192 C1483 R1098 -192 C1484 R1001 391 R1049 -120 C1484 R1098 -120 C1485 R1001 320 R1049 -100 C1485 R1098 -100 C1486 R1001 107 R1049 -71 C1486 R1098 -71 R1106 71 C1487 R1001 399 R1050 -106 C1487 R1099 106 R1175 1 C1488 R1001 14 R1050 -10 C1488 R1099 10 R1173 1 C1489 R1050 -189 R1099 189 C1490 R1001 164 R1050 -68 C1490 R1099 68 R1174 1 C1491 R1001 1370 R1050 -192 C1491 R1099 192 C1492 R1001 151 R1050 -120 C1492 R1099 120 C1493 R1001 123 R1050 -100 C1493 R1099 100 C1494 R1001 41 R1050 -71 C1494 R1099 71 R1106 27 C1495 R1001 100 R1173 -49 C1496 R1001 1000 R1174 -49 C1497 R1001 11000 R1175 -26 C1498 R1001 2000 R1176 -5 C1499 R1001 2600 R1177 -7 C1500 R1002 9999 R1051 -9999 C1500 R1100 -15 C1501 R1003 9999 R1052 -9999 C1501 R1100 -12 C1502 R1004 9999 R1053 -9999 C1502 R1100 -8 C1503 R1005 9999 R1054 -9999 C1503 R1100 -58 C1504 R1006 9999 R1055 -9999 C1504 R1100 -48 C1505 R1007 9999 R1056 -9999 C1505 R1100 -10 C1506 R1008 9999 R1057 -9999 C1506 R1100 -11 C1507 R1009 9999 R1058 -9999 C1507 R1100 -31 C1508 R1010 9999 R1059 -9999 C1508 R1100 -11 C1509 R1011 9999 R1060 -9999 C1509 R1100 -28 C1510 R1012 9999 R1061 -9999 C1510 R1100 -19 C1511 R1013 9999 R1062 -9999 C1511 R1100 -13 C1512 R1014 9999 R1063 -9999 C1512 R1100 -88 C1513 R1015 9999 R1064 -9999 C1513 R1100 -58 C1514 R1016 9999 R1065 -9999 C1514 R1100 -12 C1515 R1017 9999 R1066 -9999 C1515 R1100 -9 C1516 R1018 9999 R1067 -9999 C1516 R1100 -25 C1517 R1019 9999 R1068 -9999 C1517 R1100 -9 C1518 R1020 9999 R1069 -9999 C1518 R1100 -9 C1519 R1021 9999 R1070 -9999 C1519 R1100 -10 C1520 R1022 9999 R1071 -9999 C1520 R1100 -11 C1521 R1023 9999 R1072 -9999 C1521 R1100 -13 C1522 R1024 9999 R1073 -9999 C1522 R1100 -13 C1523 R1025 9999 R1074 -9999 C1523 R1100 -10 C1524 R1026 9999 R1075 -9999 C1524 R1100 -24 C1525 R1027 9999 R1076 -9999 C1525 R1100 -12 C1526 R1028 9999 R1077 -9999 C1526 R1100 -12 C1527 R1029 9999 R1078 -9999 C1527 R1100 -33 C1528 R1030 9999 R1079 -9999 C1528 R1100 -15 C1529 R1031 9999 R1080 -9999 C1529 R1100 -67 C1530 R1032 9999 R1081 -9999 C1530 R1100 -18 C1531 R1033 9999 R1082 -9999 C1531 R1100 -9 C1532 R1034 9999 R1083 -9999 C1532 R1100 -12 C1533 R1035 9999 R1084 -9999 C1533 R1100 -16 C1534 R1036 9999 R1085 -9999 C1534 R1100 -52 C1535 R1037 9999 R1086 -9999 C1535 R1100 -14 C1536 R1038 9999 R1087 -9999 C1536 R1100 -9 C1537 R1039 9999 R1088 -9999 C1537 R1100 -20 C1538 R1040 9999 R1089 -9999 C1538 R1100 -46 C1539 R1041 9999 R1090 -9999 C1539 R1100 -20 C1540 R1042 9999 R1091 -9999 C1540 R1100 -18 C1541 R1043 9999 R1092 -9999 C1541 R1100 -11 C1542 R1044 9999 R1093 -9999 C1542 R1100 -12 C1543 R1045 9999 R1094 -9999 C1543 R1100 -16 C1544 R1046 9999 R1095 -9999 C1544 R1100 -82 C1545 R1047 9999 R1096 -9999 C1545 R1100 -17 C1546 R1048 9999 R1097 -9999 C1546 R1100 -9 C1547 R1049 9999 R1098 -9999 C1547 R1100 -66 C1548 R1050 9999 R1099 -9999 C1548 R1100 -25 MARK0001 'MARKER' 'INTEND' RHS RHS R1002 9303 R1003 9901 RHS R1004 9509 R1005 9312 RHS R1006 9805 R1007 9330 RHS R1008 9446 R1009 9049 RHS R1010 9485 R1011 10045 RHS R1012 9740 R1013 9932 RHS R1014 10018 R1015 9680 RHS R1016 9240 R1017 9290 RHS R1018 10053 R1019 9365 RHS R1020 9826 R1021 9752 RHS R1022 9544 R1023 9003 RHS R1024 9827 R1025 9726 RHS R1026 9774 R1027 8864 RHS R1028 9910 R1029 9864 RHS R1030 9910 R1031 9665 RHS R1032 9653 R1033 9900 RHS R1034 9559 R1035 9893 RHS R1036 9605 R1037 8796 RHS R1038 9078 R1039 9478 RHS R1040 9647 R1041 10001 RHS R1042 9601 R1043 9557 RHS R1044 9729 R1045 9516 RHS R1046 9179 R1047 9125 RHS R1048 9723 R1049 8782 RHS R1050 9690 R1051 154 RHS R1052 -2 R1053 77 RHS R1054 587 R1055 94 RHS R1056 569 R1057 453 RHS R1058 850 R1059 414 RHS R1060 -146 R1061 159 RHS R1062 -33 R1063 -119 RHS R1064 219 R1065 659 RHS R1066 609 R1067 -154 RHS R1068 534 R1069 73 RHS R1070 147 R1071 355 RHS R1072 138 R1073 72 RHS R1074 173 R1075 125 RHS R1076 -1 R1077 -11 RHS R1078 35 R1079 -11 RHS R1080 234 R1081 246 RHS R1082 -1 R1083 340 RHS R1084 6 R1085 294 RHS R1086 -69 R1087 821 RHS R1088 421 R1089 252 RHS R1090 -102 R1091 298 RHS R1092 342 R1093 170 RHS R1094 383 R1095 720 RHS R1096 774 R1097 176 RHS R1098 -83 R1099 209 RHS R1100 -920 R1101 1200 RHS R1102 350 R1103 -104 RHS R1104 195 R1105 40 RHS R1106 1564 R1107 198 RHS R1110 1 R1112 1 RHS R1114 1 R1116 1 RHS R1118 1 R1119 1 RHS R1124 1 R1126 1 RHS R1128 1 R1130 1 RHS R1132 1 R1133 1 RHS R1138 1 R1140 1 RHS R1142 1 R1144 1 RHS R1147 1 R1149 1 RHS R1150 1 R1152 1 RHS R1154 1 R1156 1 RHS R1158 1 R1161 1 RHS R1163 1 R1165 1 RHS R1167 1 R1169 1 RHS R1171 1 R1172 1 BOUNDS UP ONE C1001 1 UP ONE C1002 1 UP ONE C1003 1 UP ONE C1004 1 UP ONE C1005 1 UP ONE C1006 1 UP ONE C1007 1 UP ONE C1008 1 UP ONE C1009 1 UP ONE C1010 1 UP ONE C1011 1 UP ONE C1012 1 UP ONE C1013 1 UP ONE C1014 1 UP ONE C1015 1 UP ONE C1016 1 UP ONE C1017 1 UP ONE C1018 1 UP ONE C1019 1 UP ONE C1020 1 UP ONE C1021 1 UP ONE C1022 1 UP ONE C1023 1 UP ONE C1024 1 UP ONE C1025 1 UP ONE C1026 1 UP ONE C1027 1 UP ONE C1028 1 UP ONE C1029 1 UP ONE C1030 1 UP ONE C1031 1 UP ONE C1032 1 UP ONE C1033 1 UP ONE C1034 1 UP ONE C1035 1 UP ONE C1036 1 UP ONE C1037 1 UP ONE C1038 1 UP ONE C1039 1 UP ONE C1040 1 UP ONE C1041 1 UP ONE C1042 1 UP ONE C1043 1 UP ONE C1044 1 UP ONE C1045 1 UP ONE C1046 1 UP ONE C1047 1 UP ONE C1048 1 UP ONE C1049 1 UP ONE C1050 1 UP ONE C1051 1 UP ONE C1052 1 UP ONE C1053 1 UP ONE C1054 1 UP ONE C1055 1 UP ONE C1056 1 UP ONE C1057 1 UP ONE C1058 1 UP ONE C1059 1 UP ONE C1060 1 UP ONE C1061 1 UP ONE C1062 1 UP ONE C1063 1 UP ONE C1064 1 UP ONE C1065 1 UP ONE C1066 1 UP ONE C1067 1 UP ONE C1068 1 UP ONE C1069 1 UP ONE C1070 1 UP ONE C1071 1 UP ONE C1072 1 UP ONE C1073 1 UP ONE C1074 1 UP ONE C1075 1 UP ONE C1076 1 UP ONE C1077 1 UP ONE C1078 1 UP ONE C1079 1 UP ONE C1080 1 UP ONE C1081 1 UP ONE C1082 1 UP ONE C1083 1 UP ONE C1084 1 UP ONE C1085 1 UP ONE C1086 1 UP ONE C1087 1 UP ONE C1088 1 UP ONE C1089 1 UP ONE C1090 1 UP ONE C1091 1 UP ONE C1092 1 UP ONE C1093 1 UP ONE C1094 1 UP ONE C1095 1 UP ONE C1096 1 UP ONE C1097 1 UP ONE C1098 1 UP ONE C1099 1 UP ONE C1100 1 UP ONE C1101 1 UP ONE C1102 1 UP ONE C1103 1 UP ONE C1104 1 UP ONE C1105 1 UP ONE C1106 1 UP ONE C1107 1 UP ONE C1108 1 UP ONE C1109 1 UP ONE C1110 1 UP ONE C1111 1 UP ONE C1112 1 UP ONE C1113 1 UP ONE C1114 1 UP ONE C1115 1 UP ONE C1116 1 UP ONE C1117 1 UP ONE C1118 1 UP ONE C1119 1 UP ONE C1120 1 UP ONE C1121 1 UP ONE C1122 1 UP ONE C1123 1 UP ONE C1124 1 UP ONE C1125 1 UP ONE C1126 1 UP ONE C1127 1 UP ONE C1128 1 UP ONE C1129 1 UP ONE C1130 1 UP ONE C1131 1 UP ONE C1132 1 UP ONE C1133 1 UP ONE C1134 1 UP ONE C1135 1 UP ONE C1136 1 UP ONE C1137 1 UP ONE C1138 1 UP ONE C1139 1 UP ONE C1140 1 UP ONE C1141 1 UP ONE C1142 1 UP ONE C1143 1 UP ONE C1144 1 UP ONE C1145 1 UP ONE C1146 1 UP ONE C1147 1 UP ONE C1148 1 UP ONE C1149 1 UP ONE C1150 1 UP ONE C1151 1 UP ONE C1152 1 UP ONE C1153 1 UP ONE C1154 1 UP ONE C1155 1 UP ONE C1156 1 UP ONE C1157 1 UP ONE C1158 1 UP ONE C1159 1 UP ONE C1160 1 UP ONE C1161 1 UP ONE C1162 1 UP ONE C1163 1 UP ONE C1164 1 UP ONE C1165 1 UP ONE C1166 1 UP ONE C1167 1 UP ONE C1168 1 UP ONE C1169 1 UP ONE C1170 1 UP ONE C1171 1 UP ONE C1172 1 UP ONE C1173 1 UP ONE C1174 1 UP ONE C1175 1 UP ONE C1176 1 UP ONE C1177 1 UP ONE C1178 1 UP ONE C1179 1 UP ONE C1180 1 UP ONE C1181 1 UP ONE C1182 1 UP ONE C1183 1 UP ONE C1184 1 UP ONE C1185 1 UP ONE C1186 1 UP ONE C1187 1 UP ONE C1188 1 UP ONE C1189 1 UP ONE C1190 1 UP ONE C1191 1 UP ONE C1192 1 UP ONE C1193 1 UP ONE C1194 1 UP ONE C1195 1 UP ONE C1196 1 UP ONE C1197 1 UP ONE C1198 1 UP ONE C1199 1 UP ONE C1200 1 UP ONE C1201 1 UP ONE C1202 1 UP ONE C1203 1 UP ONE C1204 1 UP ONE C1205 1 UP ONE C1206 1 UP ONE C1207 1 UP ONE C1208 1 UP ONE C1209 1 UP ONE C1210 1 UP ONE C1211 1 UP ONE C1212 1 UP ONE C1213 1 UP ONE C1214 1 UP ONE C1215 1 UP ONE C1216 1 UP ONE C1217 1 UP ONE C1218 1 UP ONE C1219 1 UP ONE C1220 1 UP ONE C1221 1 UP ONE C1222 1 UP ONE C1223 1 UP ONE C1224 1 UP ONE C1225 1 UP ONE C1226 1 UP ONE C1227 1 UP ONE C1228 1 UP ONE C1229 1 UP ONE C1230 1 UP ONE C1231 1 UP ONE C1232 1 UP ONE C1233 1 UP ONE C1234 1 UP ONE C1235 1 UP ONE C1236 1 UP ONE C1237 1 UP ONE C1238 1 UP ONE C1239 1 UP ONE C1240 1 UP ONE C1241 1 UP ONE C1242 1 UP ONE C1243 1 UP ONE C1244 1 UP ONE C1245 1 UP ONE C1246 1 UP ONE C1247 1 UP ONE C1248 1 UP ONE C1249 1 UP ONE C1250 1 UP ONE C1251 1 UP ONE C1252 1 UP ONE C1253 1 UP ONE C1254 1 UP ONE C1255 1 UP ONE C1256 1 UP ONE C1257 1 UP ONE C1258 1 UP ONE C1259 1 UP ONE C1260 1 UP ONE C1261 1 UP ONE C1262 1 UP ONE C1263 1 UP ONE C1264 1 UP ONE C1265 1 UP ONE C1266 1 UP ONE C1267 1 UP ONE C1268 1 UP ONE C1269 1 UP ONE C1270 1 UP ONE C1271 1 UP ONE C1272 1 UP ONE C1273 1 UP ONE C1274 1 UP ONE C1275 1 UP ONE C1276 1 UP ONE C1277 1 UP ONE C1278 1 UP ONE C1279 1 UP ONE C1280 1 UP ONE C1281 1 UP ONE C1282 1 UP ONE C1283 1 UP ONE C1284 1 UP ONE C1285 1 UP ONE C1286 1 UP ONE C1287 1 UP ONE C1288 1 UP ONE C1289 1 UP ONE C1290 1 UP ONE C1291 1 UP ONE C1292 1 UP ONE C1293 1 UP ONE C1294 1 UP ONE C1295 1 UP ONE C1296 1 UP ONE C1297 1 UP ONE C1298 1 UP ONE C1299 1 UP ONE C1300 1 UP ONE C1301 1 UP ONE C1302 1 UP ONE C1303 1 UP ONE C1304 1 UP ONE C1305 1 UP ONE C1306 1 UP ONE C1307 1 UP ONE C1308 1 UP ONE C1309 1 UP ONE C1310 1 UP ONE C1311 1 UP ONE C1312 1 UP ONE C1313 1 UP ONE C1314 1 UP ONE C1315 1 UP ONE C1316 1 UP ONE C1317 1 UP ONE C1318 1 UP ONE C1319 1 UP ONE C1320 1 UP ONE C1321 1 UP ONE C1322 1 UP ONE C1323 1 UP ONE C1324 1 UP ONE C1325 1 UP ONE C1326 1 UP ONE C1327 1 UP ONE C1328 1 UP ONE C1329 1 UP ONE C1330 1 UP ONE C1331 1 UP ONE C1332 1 UP ONE C1333 1 UP ONE C1334 1 UP ONE C1335 1 UP ONE C1336 1 UP ONE C1337 1 UP ONE C1338 1 UP ONE C1339 1 UP ONE C1340 1 UP ONE C1341 1 UP ONE C1342 1 UP ONE C1343 1 UP ONE C1344 1 UP ONE C1345 1 UP ONE C1346 1 UP ONE C1347 1 UP ONE C1348 1 UP ONE C1349 1 UP ONE C1350 1 UP ONE C1351 1 UP ONE C1352 1 UP ONE C1353 1 UP ONE C1354 1 UP ONE C1355 1 UP ONE C1356 1 UP ONE C1357 1 UP ONE C1358 1 UP ONE C1359 1 UP ONE C1360 1 UP ONE C1361 1 UP ONE C1362 1 UP ONE C1363 1 UP ONE C1364 1 UP ONE C1365 1 UP ONE C1366 1 UP ONE C1367 1 UP ONE C1368 1 UP ONE C1369 1 UP ONE C1370 1 UP ONE C1371 1 UP ONE C1372 1 UP ONE C1373 1 UP ONE C1374 1 UP ONE C1375 1 UP ONE C1376 1 UP ONE C1377 1 UP ONE C1378 1 UP ONE C1379 1 UP ONE C1380 1 UP ONE C1381 1 UP ONE C1382 1 UP ONE C1383 1 UP ONE C1384 1 UP ONE C1385 1 UP ONE C1386 1 UP ONE C1387 1 UP ONE C1388 1 UP ONE C1389 1 UP ONE C1390 1 UP ONE C1391 1 UP ONE C1392 1 UP ONE C1393 1 UP ONE C1394 1 UP ONE C1395 1 UP ONE C1396 1 UP ONE C1397 1 UP ONE C1398 1 UP ONE C1399 1 UP ONE C1400 1 UP ONE C1401 1 UP ONE C1402 1 UP ONE C1403 1 UP ONE C1404 1 UP ONE C1405 1 UP ONE C1406 1 UP ONE C1407 1 UP ONE C1408 1 UP ONE C1409 1 UP ONE C1410 1 UP ONE C1411 1 UP ONE C1412 1 UP ONE C1413 1 UP ONE C1414 1 UP ONE C1415 1 UP ONE C1416 1 UP ONE C1417 1 UP ONE C1418 1 UP ONE C1419 1 UP ONE C1420 1 UP ONE C1421 1 UP ONE C1422 1 UP ONE C1423 1 UP ONE C1424 1 UP ONE C1425 1 UP ONE C1426 1 UP ONE C1427 1 UP ONE C1428 1 UP ONE C1429 1 UP ONE C1430 1 UP ONE C1431 1 UP ONE C1432 1 UP ONE C1433 1 UP ONE C1434 1 UP ONE C1435 1 UP ONE C1436 1 UP ONE C1437 1 UP ONE C1438 1 UP ONE C1439 1 UP ONE C1440 1 UP ONE C1441 1 UP ONE C1442 1 UP ONE C1443 1 UP ONE C1444 1 UP ONE C1445 1 UP ONE C1446 1 UP ONE C1447 1 UP ONE C1448 1 UP ONE C1449 1 UP ONE C1450 1 UP ONE C1451 1 UP ONE C1452 1 UP ONE C1453 1 UP ONE C1454 1 UP ONE C1455 1 UP ONE C1456 1 UP ONE C1457 1 UP ONE C1458 1 UP ONE C1459 1 UP ONE C1460 1 UP ONE C1461 1 UP ONE C1462 1 UP ONE C1463 1 UP ONE C1464 1 UP ONE C1465 1 UP ONE C1466 1 UP ONE C1467 1 UP ONE C1468 1 UP ONE C1469 1 UP ONE C1470 1 UP ONE C1471 1 UP ONE C1472 1 UP ONE C1473 1 UP ONE C1474 1 UP ONE C1475 1 UP ONE C1476 1 UP ONE C1477 1 UP ONE C1478 1 UP ONE C1479 1 UP ONE C1480 1 UP ONE C1481 1 UP ONE C1482 1 UP ONE C1483 1 UP ONE C1484 1 UP ONE C1485 1 UP ONE C1486 1 UP ONE C1487 1 UP ONE C1488 1 UP ONE C1489 1 UP ONE C1490 1 UP ONE C1491 1 UP ONE C1492 1 UP ONE C1493 1 UP ONE C1494 1 UP ONE C1495 1 UP ONE C1496 1 UP ONE C1497 1 UP ONE C1498 1 UP ONE C1499 1 UP ONE C1500 1 UP ONE C1501 1 UP ONE C1502 1 UP ONE C1503 1 UP ONE C1504 1 UP ONE C1505 1 UP ONE C1506 1 UP ONE C1507 1 UP ONE C1508 1 UP ONE C1509 1 UP ONE C1510 1 UP ONE C1511 1 UP ONE C1512 1 UP ONE C1513 1 UP ONE C1514 1 UP ONE C1515 1 UP ONE C1516 1 UP ONE C1517 1 UP ONE C1518 1 UP ONE C1519 1 UP ONE C1520 1 UP ONE C1521 1 UP ONE C1522 1 UP ONE C1523 1 UP ONE C1524 1 UP ONE C1525 1 UP ONE C1526 1 UP ONE C1527 1 UP ONE C1528 1 UP ONE C1529 1 UP ONE C1530 1 UP ONE C1531 1 UP ONE C1532 1 UP ONE C1533 1 UP ONE C1534 1 UP ONE C1535 1 UP ONE C1536 1 UP ONE C1537 1 UP ONE C1538 1 UP ONE C1539 1 UP ONE C1540 1 UP ONE C1541 1 UP ONE C1542 1 UP ONE C1543 1 UP ONE C1544 1 UP ONE C1545 1 UP ONE C1546 1 UP ONE C1547 1 UP ONE C1548 1 ENDATA CoinMP-1.8.3/Data/Sample/bug.time0000755000175000017500000000021311015552002015031 0ustar renereneTIME BUG PERIODS LP x01 C0 STG01 x04 C1 STG02 ENDATA CoinMP-1.8.3/install-sh0000755000175000017500000002202110461157122013314 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/configure.ac0000644000175000017500000000444312600330564013606 0ustar renerene# Copyright (C) 2006 International Business Machines. # All Rights Reserved. # This file is distributed under the Common Public License. ## $Id: configure.ac 71 2006-07-14 17:44:04Z jpfasano $ # Author: Andreas Waechter IBM 2006-04-13 ############################################################################# # Names and other basic things # ############################################################################# AC_PREREQ(2.59) AC_INIT([CoinMP],[1.8.3],[coinmp@list.coin-or.org]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package CoinMP which is distributed under the Common Public License.]) AC_REVISION(0.9) # List one file in the package so that the configure script can test # whether the package is actually there AC_CONFIG_SRCDIR(configure.ac) # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. AC_PREFIX_DEFAULT([`pwd`]) ############################################################################# # We only need automake to generate Makefiles for the distribution # ############################################################################# # Initialize automake AC_COIN_INIT_AUTOMAKE ############################################################################# # Check which subprojects are there # ############################################################################# AC_COIN_MAIN_PACKAGEDIR(Sample, Data) AC_COIN_MAIN_PACKAGEDIR(CoinUtils) AC_COIN_MAIN_PACKAGEDIR(Osi) AC_COIN_MAIN_PACKAGEDIR(Clp) AC_COIN_MAIN_PACKAGEDIR(Cgl) AC_COIN_MAIN_PACKAGEDIR(Cbc) AC_COIN_MAIN_PACKAGEDIR(CoinMP) ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) AC_CONFIG_FILES([Makefile]) # Finally, we let configure write all the output... AC_COIN_FINALIZE CoinMP-1.8.3/CoinUtils/0000755000175000017500000000000012600453454013230 5ustar renereneCoinMP-1.8.3/CoinUtils/Makefile.in0000644000175000017500000010173412506047363015306 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball @ALWAYS_FALSE@am__append_1 = test DIST_COMMON = README $(am__configure_deps) \ $(srcdir)/BuildTools/Makemain.inc $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/coinutils-uninstalled.pc.in \ $(srcdir)/coinutils.pc.in $(top_srcdir)/configure \ $(top_srcdir)/doxydoc/doxygen.conf.in AUTHORS INSTALL \ config.guess config.sub depcomp install-sh ltmain.sh missing @HAVE_EXTERNALS_TRUE@am__append_2 = Dependencies @HAVE_EXTERNALS_TRUE@am__append_3 = .Dependencies-stamp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_coinutils.h CONFIG_CLEAN_FILES = coinutils.pc coinutils-uninstalled.pc \ doxydoc/doxygen.conf SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(pkgconfiglibdir)" pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) DATA = $(pkgconfiglib_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = src test DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BLAS_CFLAGS = @BLAS_CFLAGS@ BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ BLAS_DATA = @BLAS_DATA@ BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ BLAS_LIBS = @BLAS_LIBS@ BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILSLIB_CFLAGS = @COINUTILSLIB_CFLAGS@ COINUTILSLIB_CFLAGS_INSTALLED = @COINUTILSLIB_CFLAGS_INSTALLED@ COINUTILSLIB_DEPENDENCIES = @COINUTILSLIB_DEPENDENCIES@ COINUTILSLIB_LIBS = @COINUTILSLIB_LIBS@ COINUTILSLIB_LIBS_INSTALLED = @COINUTILSLIB_LIBS_INSTALLED@ COINUTILSLIB_PCLIBS = @COINUTILSLIB_PCLIBS@ COINUTILSLIB_PCREQUIRES = @COINUTILSLIB_PCREQUIRES@ COINUTILS_SVN_REV = @COINUTILS_SVN_REV@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_LAPACK_FALSE = @COIN_HAS_LAPACK_FALSE@ COIN_HAS_LAPACK_TRUE = @COIN_HAS_LAPACK_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_ZLIB_FALSE = @COIN_HAS_ZLIB_FALSE@ COIN_HAS_ZLIB_TRUE = @COIN_HAS_ZLIB_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FLIBS = @FLIBS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_CFLAGS = @LAPACK_CFLAGS@ LAPACK_CFLAGS_INSTALLED = @LAPACK_CFLAGS_INSTALLED@ LAPACK_DATA = @LAPACK_DATA@ LAPACK_DATA_INSTALLED = @LAPACK_DATA_INSTALLED@ LAPACK_DEPENDENCIES = @LAPACK_DEPENDENCIES@ LAPACK_LIBS = @LAPACK_LIBS@ LAPACK_LIBS_INSTALLED = @LAPACK_LIBS_INSTALLED@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MPIF77 = @MPIF77@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OPT_FFLAGS = @OPT_FFLAGS@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src $(am__append_1) ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = $(am__append_2) ######################################################################## # Installation of the addlibs and .pc file # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = coinutils.pc addlibsdir = $(DESTDIR)$(datadir)/coin/doc/CoinUtils ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = $(am__append_3) $(VPATH_DISTCLEANFILES) DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) COIN_HAS_DOXYGEN = @COIN_HAS_DOXYGEN_TRUE@TRUE COIN_HAS_LATEX = @COIN_HAS_LATEX_TRUE@TRUE all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/BuildTools/Makemain.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) coinutils.pc: $(top_builddir)/config.status $(srcdir)/coinutils.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ coinutils-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/coinutils-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ doxydoc/doxygen.conf: $(top_builddir)/config.status $(top_srcdir)/doxydoc/doxygen.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ 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; } \ END { 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: ctags-recursive $(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; } \ END { 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) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/BuildTools $(distdir)/doxydoc @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfiglibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-exec-am: install-exec-local install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-local \ uninstall-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-local \ clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-libtool distclean-local \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-exec install-exec-am \ install-exec-local install-info install-info-am install-man \ install-pkgconfiglibDATA install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-libtool \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-hook uninstall-info-am \ uninstall-local uninstall-pkgconfiglibDATA ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc install-data-hook: @$(mkdir_p) "$(addlibsdir)" @COIN_HAS_PKGCONFIG_TRUE@ PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ @COIN_HAS_PKGCONFIG_TRUE@ "$(PKG_CONFIG)" --libs coinutils > $(addlibsdir)/coinutils_addlibs.txt @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCoinUtils.lib @COINUTILSLIB_LIBS_INSTALLED@" > $(addlibsdir)/coinutils_addlibs.txt @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lCoinUtils @COINUTILSLIB_LIBS_INSTALLED@ > $(addlibsdir)/coinutils_addlibs.txt uninstall-hook: rm -f $(addlibsdir)/coinutils_addlibs.txt doxygen-docs: if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ doxygen doxydoc/doxygen.conf;\ fi;\ fi pdf-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/latex"; then \ if test "$(COIN_HAS_LATEX)" = TRUE; then \ cd doxydoc/latex;\ $(MAKE) pdf;\ cd -;\ fi;\ fi;\ fi clean-doxygen-docs: if test -d "doxydoc/"; then \ cd doxydoc ;\ rm -rf html latex *.log *.tag;\ fi install-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc"; \ $(INSTALL_DATA) @coin_doxy_tagname@ "$(DESTDIR)$(DocInstallDir)/@coin_doxy_tagname@";\ if test -f "doxydoc/latex/refman.pdf"; then \ $(INSTALL_DATA) doxydoc/latex/refman.pdf "$(DESTDIR)$(DocInstallDir)";\ fi;\ if test -d "doxydoc/html"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/search/" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc/search/"; \ $(INSTALL_DATA) doxydoc/html/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc";\ $(INSTALL_DATA) doxydoc/html/search/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc/search";\ fi;\ fi;\ fi uninstall-doxygen-docs: if test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/"; then \ rm -rf "$(DESTDIR)$(DocInstallDir)/doxydoc/"; \ fi if test -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; then \ rm -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; \ fi all-doxygen-docs: for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) doxygen-docs) \ fi ; \ done ; clean-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) clean-doxygen-docs) \ fi ; \ done ; install-all-doxygen-docs: all-doxygen-docs for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) install-doxygen-docs) \ fi ; \ done ; uninstall-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) uninstall-doxygen-docs) \ fi ; \ done ; install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## # Make sure acinclude is using most recent coin.m4 @MAINTAINER_MODE_TRUE@$(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 @MAINTAINER_MODE_TRUE@ cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date @MAINTAINER_MODE_TRUE@$(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh @MAINTAINER_MODE_TRUE@ cp $< $@ # Take care of updating externals (if Dependencies file exists) @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@$(top_builddir)/Makefile: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@.Dependencies-stamp: $(srcdir)/Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); BuildTools/set_externals Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ touch .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@update-externals: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); svn update .PHONY: install-doc uninstall-doc update-externals # 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: CoinMP-1.8.3/CoinUtils/MSVisualStudio/0000755000175000017500000000000012600453454016123 5ustar renereneCoinMP-1.8.3/CoinUtils/MSVisualStudio/v9/0000755000175000017500000000000012600453454016461 5ustar renereneCoinMP-1.8.3/CoinUtils/MSVisualStudio/v9/libCoinUtils/0000755000175000017500000000000012600453454021061 5ustar renereneCoinMP-1.8.3/CoinUtils/MSVisualStudio/v9/libCoinUtils/libCoinUtils.vcproj0000644000175000017500000020443412456350462024721 0ustar renerene CoinMP-1.8.3/CoinUtils/MSVisualStudio/v9/CoinUtils.sln0000644000175000017500000000423011473056425021113 0ustar renerene Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "libCoinUtils\libCoinUtils.vcproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unitTestCoinUtils", "unitTestCoinUtils\unitTestCoinUtils.vcproj", "{D8879B84-4497-48E6-96A5-49B154FB0422}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {D8879B84-4497-48E6-96A5-49B154FB0422}.Debug|Win32.ActiveCfg = Debug|Win32 {D8879B84-4497-48E6-96A5-49B154FB0422}.Debug|Win32.Build.0 = Debug|Win32 {D8879B84-4497-48E6-96A5-49B154FB0422}.Debug|x64.ActiveCfg = Debug|x64 {D8879B84-4497-48E6-96A5-49B154FB0422}.Debug|x64.Build.0 = Debug|x64 {D8879B84-4497-48E6-96A5-49B154FB0422}.Release|Win32.ActiveCfg = Release|Win32 {D8879B84-4497-48E6-96A5-49B154FB0422}.Release|Win32.Build.0 = Release|Win32 {D8879B84-4497-48E6-96A5-49B154FB0422}.Release|x64.ActiveCfg = Release|x64 {D8879B84-4497-48E6-96A5-49B154FB0422}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/CoinUtils/MSVisualStudio/v9/unitTestCoinUtils/0000755000175000017500000000000012600453454022132 5ustar renereneCoinMP-1.8.3/CoinUtils/MSVisualStudio/v9/unitTestCoinUtils/unitTestCoinUtils.vcproj0000644000175000017500000005117011475605352027041 0ustar renerene CoinMP-1.8.3/CoinUtils/MSVisualStudio/v10/0000755000175000017500000000000012600453454016531 5ustar renereneCoinMP-1.8.3/CoinUtils/MSVisualStudio/v10/libCoinUtils/0000755000175000017500000000000012600453454021131 5ustar renereneCoinMP-1.8.3/CoinUtils/MSVisualStudio/v10/libCoinUtils/libCoinUtils.vcxproj0000644000175000017500000033004512456350462025157 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C} libCoinUtils StaticLibrary StaticLibrary StaticLibrary StaticLibrary <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\..\BuildTools\headers;C:\cygwin\home\ted\SYMPHONY-trunk\CoinUtils\inc;%(AdditionalIncludeDirectories) COINUTILS_BUILD;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS true true Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 true X64 Default ..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) COINUTILS_BUILD;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 true ..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) COINUTILS_BUILD;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _DEBUG;%(PreprocessorDefinitions) 0x0409 true X64 ..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) COINUTILS_BUILD;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS true EnableFastChecks Level3 true ProgramDatabase _DEBUG;%(PreprocessorDefinitions) 0x0409 true Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) CoinMP-1.8.3/CoinUtils/MSVisualStudio/v10/CoinUtils.sln0000644000175000017500000000377711537753401021201 0ustar renerene Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "libCoinUtils\libCoinUtils.vcxproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unitTestCoinUtils", "unitTestCoinUtils\unitTestCoinUtils.vcxproj", "{D8879B84-4497-48E6-96A5-49B154FB0422}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {D8879B84-4497-48E6-96A5-49B154FB0422}.Debug|Win32.ActiveCfg = Debug|Win32 {D8879B84-4497-48E6-96A5-49B154FB0422}.Debug|Win32.Build.0 = Debug|Win32 {D8879B84-4497-48E6-96A5-49B154FB0422}.Debug|x64.ActiveCfg = Debug|x64 {D8879B84-4497-48E6-96A5-49B154FB0422}.Debug|x64.Build.0 = Debug|x64 {D8879B84-4497-48E6-96A5-49B154FB0422}.Release|Win32.ActiveCfg = Release|Win32 {D8879B84-4497-48E6-96A5-49B154FB0422}.Release|Win32.Build.0 = Release|Win32 {D8879B84-4497-48E6-96A5-49B154FB0422}.Release|x64.ActiveCfg = Release|x64 {D8879B84-4497-48E6-96A5-49B154FB0422}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/CoinUtils/MSVisualStudio/v10/unitTestCoinUtils/0000755000175000017500000000000012600453454022202 5ustar renereneCoinMP-1.8.3/CoinUtils/MSVisualStudio/v10/unitTestCoinUtils/unitTestCoinUtils.vcxproj0000644000175000017500000010247512227360442027300 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {D8879B84-4497-48E6-96A5-49B154FB0422} unitTestCoinUtils Application false MultiByte Application false MultiByte Application false MultiByte Application false MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(SolutionDir)$(Platform)-$(PlatformToolset)-$(Configuration)\ $(Platform)-$(PlatformToolset)-$(Configuration)\ false $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset .\Debug/unitTestCoinUtils.tlb Disabled ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) COINUTILS_BUILD;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;COIN_MSVS;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS EnableFastChecks MultiThreadedDebugDLL true .\Debug/unitTestCoinUtils.pch Level3 true EditAndContinue Default _DEBUG;%(PreprocessorDefinitions) 0x0409 NotSet true true $(TargetDir)$(TargetName).pdb Console false MachineX86 libCoinUtils.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) false X64 .\Debug/unitTestCoinUtils.tlb Disabled ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;COIN_MSVS;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS EnableFastChecks MultiThreadedDebugDLL true .\Debug/unitTestCoinUtils.pch Level3 true ProgramDatabase Default _DEBUG;%(PreprocessorDefinitions) 0x0409 true true $(TargetDir)$(TargetName).pdb Console false MachineX64 libCoinUtils.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) false .\Release/unitTestCoinUtils.tlb MaxSpeed OnlyExplicitInline ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) COINUTILS_BUILD;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;COIN_MSVS;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS true MultiThreadedDLL true true .\Release/unitTestCoinUtils.pch Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 true $(TargetDir)$(TargetName).pdb Console false MachineX86 libCoinUtils.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true false X64 .\Release/unitTestCoinUtils.tlb MaxSpeed OnlyExplicitInline ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;COIN_MSVS;%(PreprocessorDefinitions);_SCL_SECURE_NO_WARNINGS true MultiThreadedDLL true true .\Release/unitTestCoinUtils.pch Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 true $(TargetDir)$(TargetName).pdb Console false MachineX64 libCoinUtils.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true false Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) {c4867f15-438d-4ff8-8388-62fbaaa9786c} false CoinMP-1.8.3/CoinUtils/Makefile.am0000644000175000017500000000561512465253002015267 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1792 2015-02-07 00:02:10Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball if ALWAYS_FALSE SUBDIRS += test endif ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc ######################################################################## # Installation of the addlibs and .pc file # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = coinutils.pc addlibsdir = $(DESTDIR)$(datadir)/coin/doc/CoinUtils install-data-hook: @$(mkdir_p) "$(addlibsdir)" if COIN_HAS_PKGCONFIG PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ "$(PKG_CONFIG)" --libs coinutils > $(addlibsdir)/coinutils_addlibs.txt else if COIN_CXX_IS_CL echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCoinUtils.lib @COINUTILSLIB_LIBS_INSTALLED@" > $(addlibsdir)/coinutils_addlibs.txt else echo -L@abs_lib_dir@ -lCoinUtils @COINUTILSLIB_LIBS_INSTALLED@ > $(addlibsdir)/coinutils_addlibs.txt endif endif uninstall-hook: rm -f $(addlibsdir)/coinutils_addlibs.txt ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = include BuildTools/Makemain.inc CoinMP-1.8.3/CoinUtils/depcomp0000755000175000017500000003710011405215457014607 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/CoinUtils/LICENSE0000644000175000017500000002622711507200411014232 0ustar renereneEclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. CoinMP-1.8.3/CoinUtils/README0000644000175000017500000000020112422527716014106 0ustar renereneThis is the CoinUtils project. For information on the purpose o this project please visit https://projects.coin-or.org/CoinUtils CoinMP-1.8.3/CoinUtils/config.sub0000755000175000017500000007772611405215457015237 0ustar renerene#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/CoinUtils/configure0000755000175000017500000465100212574604646015162 0ustar renerene#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for CoinUtils 2.10.10. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # # Copyright 2006 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package Coin which is distributed # under the Eclipse Public License. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='CoinUtils' PACKAGE_TARNAME='coinutils' PACKAGE_VERSION='2.10.10' PACKAGE_STRING='CoinUtils 2.10.10' PACKAGE_BUGREPORT='http://projects.coin-or.org/CoinUtils' ac_unique_file="src/CoinError.cpp" ac_default_prefix=`pwd` # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os ALWAYS_FALSE_TRUE ALWAYS_FALSE_FALSE have_svnversion COINUTILS_SVN_REV CDEFS ADD_CFLAGS DBG_CFLAGS OPT_CFLAGS sol_cc_compiler CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT COIN_CC_IS_CL_TRUE COIN_CC_IS_CL_FALSE MPICC CXXDEFS ADD_CXXFLAGS DBG_CXXFLAGS OPT_CXXFLAGS CXX CXXFLAGS ac_ct_CXX COIN_CXX_IS_CL_TRUE COIN_CXX_IS_CL_FALSE MPICXX ADD_FFLAGS DBG_FFLAGS OPT_FFLAGS F77 ac_ct_F77 FFLAGS MPIF77 FLIBS EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOLM4 have_autoconf have_automake have_svn BUILDTOOLSDIR AUX_DIR abs_source_dir abs_lib_dir abs_include_dir abs_bin_dir HAVE_EXTERNALS_TRUE HAVE_EXTERNALS_FALSE host host_cpu host_vendor host_os ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP LIBTOOL ac_c_preproc_warn_flag ac_cxx_preproc_warn_flag RPATH_FLAGS DEPENDENCY_LINKING_TRUE DEPENDENCY_LINKING_FALSE LT_LDFLAGS PKG_CONFIG ac_ct_PKG_CONFIG COIN_HAS_PKGCONFIG_TRUE COIN_HAS_PKGCONFIG_FALSE COIN_PKG_CONFIG_PATH COIN_PKG_CONFIG_PATH_UNINSTALLED BLAS_LIBS BLAS_CFLAGS BLAS_DATA BLAS_DEPENDENCIES BLAS_LIBS_INSTALLED BLAS_CFLAGS_INSTALLED BLAS_DATA_INSTALLED COINUTILSLIB_CFLAGS COINUTILSLIB_LIBS COINUTILSLIB_PCLIBS COINUTILSLIB_PCREQUIRES COINUTILSLIB_DEPENDENCIES COINUTILSLIB_CFLAGS_INSTALLED COINUTILSLIB_LIBS_INSTALLED COIN_HAS_BLAS_TRUE COIN_HAS_BLAS_FALSE LAPACK_LIBS LAPACK_CFLAGS LAPACK_DATA LAPACK_DEPENDENCIES LAPACK_LIBS_INSTALLED LAPACK_CFLAGS_INSTALLED LAPACK_DATA_INSTALLED COIN_HAS_LAPACK_TRUE COIN_HAS_LAPACK_FALSE GLPK_LIBS GLPK_CFLAGS GLPK_DATA GLPK_DEPENDENCIES GLPK_LIBS_INSTALLED GLPK_CFLAGS_INSTALLED GLPK_DATA_INSTALLED COIN_HAS_GLPK_TRUE COIN_HAS_GLPK_FALSE SAMPLE_LIBS SAMPLE_CFLAGS SAMPLE_DATA SAMPLE_DEPENDENCIES SAMPLE_LIBS_INSTALLED SAMPLE_CFLAGS_INSTALLED SAMPLE_DATA_INSTALLED COIN_HAS_SAMPLE_TRUE COIN_HAS_SAMPLE_FALSE NETLIB_LIBS NETLIB_CFLAGS NETLIB_DATA NETLIB_DEPENDENCIES NETLIB_LIBS_INSTALLED NETLIB_CFLAGS_INSTALLED NETLIB_DATA_INSTALLED COIN_HAS_NETLIB_TRUE COIN_HAS_NETLIB_FALSE COIN_HAS_ZLIB_TRUE COIN_HAS_ZLIB_FALSE coin_have_doxygen coin_have_latex coin_doxy_usedot coin_doxy_tagname coin_doxy_logname COIN_HAS_DOXYGEN_TRUE COIN_HAS_DOXYGEN_FALSE COIN_HAS_LATEX_TRUE COIN_HAS_LATEX_FALSE coin_doxy_tagfiles coin_doxy_excludes LIBEXT VPATH_DISTCLEANFILES ABSBUILDDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CDEFS_set=${CDEFS+set} ac_env_CDEFS_value=$CDEFS ac_cv_env_CDEFS_set=${CDEFS+set} ac_cv_env_CDEFS_value=$CDEFS ac_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_cv_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_cv_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_cv_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_cv_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_cv_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_cv_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_MPICC_set=${MPICC+set} ac_env_MPICC_value=$MPICC ac_cv_env_MPICC_set=${MPICC+set} ac_cv_env_MPICC_value=$MPICC ac_env_CXXDEFS_set=${CXXDEFS+set} ac_env_CXXDEFS_value=$CXXDEFS ac_cv_env_CXXDEFS_set=${CXXDEFS+set} ac_cv_env_CXXDEFS_value=$CXXDEFS ac_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_cv_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_cv_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_cv_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_cv_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_cv_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_cv_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_MPICXX_set=${MPICXX+set} ac_env_MPICXX_value=$MPICXX ac_cv_env_MPICXX_set=${MPICXX+set} ac_cv_env_MPICXX_value=$MPICXX ac_env_ADD_FFLAGS_set=${ADD_FFLAGS+set} ac_env_ADD_FFLAGS_value=$ADD_FFLAGS ac_cv_env_ADD_FFLAGS_set=${ADD_FFLAGS+set} ac_cv_env_ADD_FFLAGS_value=$ADD_FFLAGS ac_env_DBG_FFLAGS_set=${DBG_FFLAGS+set} ac_env_DBG_FFLAGS_value=$DBG_FFLAGS ac_cv_env_DBG_FFLAGS_set=${DBG_FFLAGS+set} ac_cv_env_DBG_FFLAGS_value=$DBG_FFLAGS ac_env_OPT_FFLAGS_set=${OPT_FFLAGS+set} ac_env_OPT_FFLAGS_value=$OPT_FFLAGS ac_cv_env_OPT_FFLAGS_set=${OPT_FFLAGS+set} ac_cv_env_OPT_FFLAGS_value=$OPT_FFLAGS ac_env_F77_set=${F77+set} ac_env_F77_value=$F77 ac_cv_env_F77_set=${F77+set} ac_cv_env_F77_value=$F77 ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS ac_env_MPIF77_set=${MPIF77+set} ac_env_MPIF77_value=$MPIF77 ac_cv_env_MPIF77_set=${MPIF77+set} ac_cv_env_MPIF77_value=$MPIF77 ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_env_PKG_CONFIG_value=$PKG_CONFIG ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures CoinUtils 2.10.10 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of CoinUtils 2.10.10:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug compile all projects with debug options tests (implies --disable-shared) --enable-debug-coinutils compile project CoinUtils with debug compiler flags --enable-msvc Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin. --enable-static[=PKGS] build static libraries [default=no] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-dependency-linking disable linking library dependencies into shared libraries --enable-coinutils-threads enables compilation of thread aware CoinUtils (mempool so far) --enable-coinutils-mempool-override-new enables the CoinUtils mempool to override global new/delete --enable-coinutils-mempool-maxpooled Specify the default maximum memory allocation size that is served by the memory pool. If negative (or 'no') then the memory pool is disabled completely. Otherwise its value can be overridden at runtime using the COINUTILS_MEMPOOL_MAXPOOLED environment variable. --disable-pkg-config disable use of pkg-config (if available) --disable-interpackage-dependencies disables deduction of Makefile dependencies from package linker flags --disable-zlib do not compile with compression library zlib --disable-bzlib do not compile with compression library bzlib --enable-gnu-packages compile with GNU packages (disabled by default) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-coinutils-verbosity specify the debug verbosity level for project CoinUtils --with-coinutils-checklevel specify the sanity check level for project CoinUtils --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-blas specify BLAS library (or BUILD to enforce use of ThirdParty/Blas) --with-coin-instdir prefix of installation directory for precompiled COIN packages --with-blas-lib linker flags for using package Blas --with-blas-incdir directory with header files for using package Blas --with-blas-datadir directory with data files for using package Blas --with-lapack specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack) --with-lapack-lib linker flags for using package Lapack --with-lapack-incdir directory with header files for using package Lapack --with-lapack-datadir directory with data files for using package Lapack --with-glpk-lib linker flags for using package Glpk --with-glpk-incdir directory with header files for using package Glpk --with-glpk-datadir directory with data files for using package Glpk --with-sample-lib linker flags for using package Sample --with-sample-incdir directory with header files for using package Sample --with-sample-datadir directory with data files for using package Sample --with-netlib-lib linker flags for using package Netlib --with-netlib-incdir directory with header files for using package Netlib --with-netlib-datadir directory with data files for using package Netlib --with-dot use dot (from graphviz) when creating documentation with doxygen if available; --without-dot to disable Some influential environment variables: CDEFS Additional -D flags to be used when compiling C code. ADD_CFLAGS Additional C compiler options DBG_CFLAGS Debug C compiler options OPT_CFLAGS Optimize C compiler options CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory MPICC C MPI Compiler CXXDEFS Additional -D flags to be used when compiling C++ code. ADD_CXXFLAGS Additional C++ compiler options DBG_CXXFLAGS Debug C++ compiler options OPT_CXXFLAGS Optimize C++ compiler options CXX C++ compiler command CXXFLAGS C++ compiler flags MPICXX C++ MPI Compiler ADD_FFLAGS Additional Fortran compiler options DBG_FFLAGS Debug Fortran compiler options OPT_FFLAGS Optimize Fortran compiler options F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags MPIF77 Fortran MPI Compiler CPP C preprocessor CXXCPP C++ preprocessor PKG_CONFIG path to pkg-config utility Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF CoinUtils configure 2.10.10 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by CoinUtils $as_me 2.10.10, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # List one file in the package so that the configure script can test # whether the package is actually there # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. # As backup, we make sure we don't loose an FLIBS if it has been set # by the user save_FLIBS="$FLIBS" # A useful makefile conditional that is always false if false; then ALWAYS_FALSE_TRUE= ALWAYS_FALSE_FALSE='#' else ALWAYS_FALSE_TRUE='#' ALWAYS_FALSE_FALSE= fi # We set the following variable so that we know later in AC_COIN_FINALIZE # that we are in a project main directory coin_projectdir=yes # Set the project's version numbers cat >>confdefs.h <<_ACEOF #define COINUTILS_VERSION "$PACKAGE_VERSION" _ACEOF coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'` coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'` coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'` if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi cat >>confdefs.h <<_ACEOF #define COINUTILS_VERSION_MAJOR $coin_majorver _ACEOF cat >>confdefs.h <<_ACEOF #define COINUTILS_VERSION_MINOR $coin_minorver _ACEOF cat >>confdefs.h <<_ACEOF #define COINUTILS_VERSION_RELEASE $coin_releasever _ACEOF # We use the following variable to have a string with the upper case # version of the project name COIN_PRJCT=COINUTILS # Set the project's SVN revision number. The complicated sed expression # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up # as a single number. # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svnversion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svnversion"; then ac_cv_prog_have_svnversion="$have_svnversion" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svnversion="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svnversion" && ac_cv_prog_have_svnversion="no" fi fi have_svnversion=$ac_cv_prog_have_svnversion if test -n "$have_svnversion"; then echo "$as_me:$LINENO: result: $have_svnversion" >&5 echo "${ECHO_T}$have_svnversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$have_svnversion" = xyes; then svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null` if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then COINUTILS_SVN_REV=`echo $svn_rev_tmp | sed -n -e 's/^[0-9]*://' -e 's/\([0-9]\)[^0-9]*$/\1/p'` cat >>confdefs.h <<_ACEOF #define COINUTILS_SVN_REV $COINUTILS_SVN_REV _ACEOF fi fi # Capture libtool library version, if given. coin_libversion=13:10:10 # Check if user wants to produce debugging code echo "$as_me:$LINENO: checking whether we want to compile in debug mode" >&5 echo $ECHO_N "checking whether we want to compile in debug mode... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" case "${enableval}" in yes) coin_debug_compile=true if test "${enable_shared+set}" = set; then :; else enable_shared=no fi ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug" >&2;} { (exit 1); exit 1; }; } ;; esac else coin_debug_compile=false fi; # Check whether --enable-debug-coinutils or --disable-debug-coinutils was given. if test "${enable_debug_coinutils+set}" = set; then enableval="$enable_debug_coinutils" case "${enableval}" in yes) coin_debug_compile=true ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug-coinutils" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug-coinutils" >&2;} { (exit 1); exit 1; }; } ;; esac else : fi; # m4_ifvaln([CoinUtils], if test $coin_debug_compile = true; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Check whether --with-coinutils-verbosity or --without-coinutils-verbosity was given. if test "${with_coinutils_verbosity+set}" = set; then withval="$with_coinutils_verbosity" if test "$withval" = yes; then withval=1 fi coin_coinutils_verbosity=$withval else coin_coinutils_verbosity=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_COINUTILS_VERBOSITY $coin_coinutils_verbosity _ACEOF # Check whether --with-coinutils-checklevel or --without-coinutils-checklevel was given. if test "${with_coinutils_checklevel+set}" = set; then withval="$with_coinutils_checklevel" if test "$withval" = yes; then withval=1 fi coin_coinutils_checklevel=$withval else coin_coinutils_checklevel=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_COINUTILS_CHECKLEVEL $coin_coinutils_checklevel _ACEOF # m4_ifvaln([CoinUtils], # Get the name of the C++ compiler and appropriate compiler options # for backward compatibility # Check whether --enable-doscompile or --disable-doscompile was given. if test "${enable_doscompile+set}" = set; then enableval="$enable_doscompile" enable_doscompile=$enableval else enable_doscompile=no fi; # Check whether --enable-msvc or --disable-msvc was given. if test "${enable_msvc+set}" = set; then enableval="$enable_msvc" enable_msvc=$enableval else enable_msvc=no if test "$enable_doscompile" = msvc ; then enable_msvc=yes elif test "$enable_doscompile" != no ; then { { echo "$as_me:$LINENO: error: --enable-doscompile=$enable_doscompile not supported anymore." >&5 echo "$as_me: error: --enable-doscompile=$enable_doscompile not supported anymore." >&2;} { (exit 1); exit 1; }; } fi fi; if test "$enable_msvc" = MD; then enable_shared=yes enable_msvc=yes fi if test "$enable_msvc" = yes; then case $build in *-cygwin* | *-mingw*) ;; *) { { echo "$as_me:$LINENO: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&5 echo "$as_me: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&2;} { (exit 1); exit 1; }; } ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # For consistency, we set the C compiler to the same value of the C++ # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" { echo "$as_me:$LINENO: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&5 echo "$as_me: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&2;} fi ;; esac fi coin_has_cc=yes save_cflags="$CFLAGS" # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. # Depending on the user's PATH, when Studio/Workshop cc is not present we may # find /usr/ucb/cc, which is almost certainly not a good choice for the C # compiler. In this case, put cc after gcc. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl gcc" else comps="gcc icl cl" fi ;; *-*-solaris*) # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_sol_cc_compiler+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$sol_cc_compiler"; then ac_cv_prog_sol_cc_compiler="$sol_cc_compiler" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_sol_cc_compiler="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_sol_cc_compiler shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set sol_cc_compiler to just the basename; use the full file name. shift ac_cv_prog_sol_cc_compiler="$as_dir/$ac_word${1+' '}$@" fi fi fi fi sol_cc_compiler=$ac_cv_prog_sol_cc_compiler if test -n "$sol_cc_compiler"; then echo "$as_me:$LINENO: result: $sol_cc_compiler" >&5 echo "${ECHO_T}$sol_cc_compiler" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$sol_cc_compiler" = "cc" ; then comps="cc xlc gcc pgcc icc" else comps="xlc gcc pgcc icc cc" fi ;; *-*-darwin*) comps="clang gcc cc" ;; *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;; *-linux-*) comps="xlc gcc cc pgcc icc" ;; *) comps="xlc_r xlc cc gcc pgcc icc" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } # AC_MSG_NOTICE([C compiler candidates: $comps]) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -z "$CC" ; then { { echo "$as_me:$LINENO: error: Failed to find a C compiler!" >&5 echo "$as_me: error: Failed to find a C compiler!" >&2;} { (exit 1); exit 1; }; } fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; esac if test $coin_cc_is_cl = true; then COIN_CC_IS_CL_TRUE= COIN_CC_IS_CL_FALSE='#' else COIN_CC_IS_CL_TRUE='#' COIN_CC_IS_CL_FALSE= fi # Check if a project specific CFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} if test x$coin_tmp = xset; then eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} fi fi if test x"$CFLAGS" = x; then coin_add_cflags= coin_opt_cflags= coin_dbg_cflags= coin_warn_cflags= if test "$GCC" = "yes"; then case "$CC" in icc* | */icc*) ;; *) coin_opt_cflags="-O3" coin_add_cflags="-pipe" coin_dbg_cflags="-g -O0" coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cflags="-pedantic-errors $coin_warn_cflags" ;; esac esac fi if test -z "$coin_opt_cflags"; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' coin_dbg_cflags='-MDd' else coin_opt_cflags='-MT -O2' coin_dbg_cflags='-MTd' fi coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -Ox' coin_dbg_cflags='-MDd -debug' else coin_opt_cflags='-MT -Ox' coin_dbg_cflags='-MTd -debug' fi coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CC" in icc* | */icc*) coin_opt_cflags="-O3 -ip -mp1" coin_add_cflags="" coin_dbg_cflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cflags="-i_dynamic $coin_add_cflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgcc* | */pgcc*) coin_opt_cflags="-fast" coin_add_cflags="-Kieee -pc 64" coin_dbg_cflags="-g" ;; esac ;; *-ibm-*) case "$CC" in xlc* | */xlc* | mpxlc* | */mpxlc*) coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_cflags="-g" ;; esac ;; *-hp-*) coin_opt_cflags="-O" coin_add_cflags="-Ae" coin_dbg_cflags="-g" ;; *-*-solaris*) coin_opt_cflags="-xO4" coin_dbg_cflags="-g" ;; *-sgi-*) coin_opt_cflags="-O -OPT:Olimit=0" coin_dbg_cflags="-g" ;; esac fi if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then coin_dbg_cflags="-g" fi if test -z "$coin_opt_cflags"; then # Try if -O option works if nothing else is set CFLAGS="-O" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cflags" = xyes; then coin_warn_cflags= fi if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" fi DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" if test "$coin_debug_compile" = "true"; then CFLAGS="$DBG_CFLAGS" else CFLAGS="$OPT_CFLAGS" fi else CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$CFLAGS" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$CFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CFLAGS works save_CFLAGS="$CFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&2;} CFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C compiler options are: $CFLAGS" >&5 echo "$as_me: C compiler options are: $CFLAGS" >&6;} if test x"$MPICC" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C compiler $MPICC" >&5 echo "$as_me: Will use MPI C compiler $MPICC" >&6;} CC="$MPICC" fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #Let's try if that overcomes configuration problem with VC++ 6.0 ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_has_cxx=yes save_cxxflags="$CXXFLAGS" # For *-*-solaris*, promote Studio/Workshop compiler to front of list. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl g++" else comps="g++ icl cl" fi ;; *-*-solaris*) comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; *-darwin*) comps="clang++ g++ c++ CC" ;; *-linux-gnu*) comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;; *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } # AC_MSG_NOTICE([C++ compiler candidates: $comps]) ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler #thus, we test here whether $CXX is actually working ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking whether C++ compiler $CXX works" >&5 echo $ECHO_N "checking whether C++ compiler $CXX works... $ECHO_C" >&6; cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&5 echo "$as_me: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_cxx_is_cl=false # It seems that we need to cleanup something here for the Windows case "$CXX" in clang* | */clang*) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh mv confdefs.hh confdefs.h coin_cxx_is_cl=true ;; esac # add automake conditional so we can recognize cl compiler in makefile if test $coin_cxx_is_cl = true; then COIN_CXX_IS_CL_TRUE= COIN_CXX_IS_CL_FALSE='#' else COIN_CXX_IS_CL_TRUE='#' COIN_CXX_IS_CL_FALSE= fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CXXFLAGS="$save_cxxflags" # Check if a project specific CXXFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} if test x$coin_tmp = xset; then eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} fi fi if test x"$CXXFLAGS" = x; then # ToDo decide whether we want -DNDEBUG for optimization coin_add_cxxflags= coin_opt_cxxflags= coin_dbg_cxxflags= coin_warn_cxxflags= if test "$GXX" = "yes"; then case "$CXX" in icpc* | */icpc*) ;; *) # ToDo decide about unroll-loops coin_opt_cxxflags="-O3" coin_add_cxxflags="-pipe" coin_dbg_cxxflags="-g -O0" coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" ;; esac esac fi # Note that we do not need to cover GCC in the following tests. if test -z "$coin_opt_cxxflags"; then case $build in *-cygwin* | *-mingw*) case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -O2' coin_dbg_cxxflags='-MDd' else coin_opt_cxxflags='-MT -O2' coin_dbg_cxxflags='-MTd' fi coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -Ox' coin_dbg_cxxflags='-MDd -debug' else coin_opt_cxxflags='-MT -Ox' coin_dbg_cxxflags='-MTd -debug' fi coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CXX" in icpc* | */icpc*) coin_opt_cxxflags="-O3 -ip -mp1" coin_add_cxxflags="" coin_dbg_cxxflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CXXFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cxxflags="-i_dynamic $coin_add_cxxflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgCC* | */pgCC*) coin_opt_cxxflags="-fast" coin_add_cxxflags="-Kieee -pc 64" coin_dbg_cxxflags="-g" ;; esac ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" coin_dbg_cxxflags="-g" ;; esac ;; *-hp-*) case "$CXX" in aCC* | */aCC* ) coin_opt_cxxflags="-O" coin_add_cxxflags="-AA" coin_dbg_cxxflags="-g" ;; esac ;; *-*-solaris*) coin_opt_cxxflags="-O4" coin_dbg_cxxflags="-g" ;; esac fi # Generic flag settings. If these don't work, add a case above. if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then coin_dbg_cxxflags="-g" fi if test -z "$coin_opt_cxxflags"; then # Try if -O option works if nothing else is set CXXFLAGS=-O cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cxxflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cxxflags" = xyes; then coin_warn_cxxflags= fi # Do final setup of flags based on values determined above. if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" fi DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test "$coin_debug_compile" = "true"; then CXXFLAGS="$DBG_CXXFLAGS" else CXXFLAGS="$OPT_CXXFLAGS" fi # Handle the case where CXXFLAGS was set externally. else CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$CXXFLAGS" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$CXXFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CXXFLAGS works save_CXXFLAGS="$CXXFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&2;} CXXFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C++ compiler options are: $CXXFLAGS" >&5 echo "$as_me: C++ compiler options are: $CXXFLAGS" >&6;} if test x"$MPICXX" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C++ compiler $MPICXX" >&5 echo "$as_me: Will use MPI C++ compiler $MPICXX" >&6;} CXX="$MPICXX" fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Get the name of the Fortran compiler and appropriate compiler options case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then coin_f77_comps="ifort fl32 compile_f2c gfortran g95 g77" else coin_f77_comps="gfortran ifort g95 g77 fl32 compile_f2c" fi ;; *-*-solaris*) coin_f77_comps="f95 f90 g95 f77 xlf_r fort77 gfortran g77 pgf90 pgf77 ifort ifc frt af77" ;; *-linux-gnu*) coin_f77_comps="gfortran ifort g95 fort77 f77 g77 pgf90 pgf77 ifc frt af77 xlf_r" ;; *) coin_f77_comps="xlf_r fort77 gfortran ifort g95 f77 g77 pgf90 pgf77 ifc frt af77" ;; esac ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu coin_has_f77=yes save_fflags="$FFLAGS" # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; } # This is a real belt-and-suspenders approach. AC_COIN_FIND_F77 will use # coin_f77_comps to see if there's a program that matches one of the names. # If there's no such program, F77 = unavailable. If we match the name, # feed AC_PROG_F77 the same search list, just to be sure it's a functioning # compiler. # AC_MSG_NOTICE([Fortran compiler candidates: $coin_f77_comps]) { echo "$as_me:$LINENO: Trying to determine Fortran compiler name" >&5 echo "$as_me: Trying to determine Fortran compiler name" >&6;} if test -n "$ac_tool_prefix"; then for ac_prog in $coin_f77_comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in $coin_f77_comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done test -n "$ac_ct_F77" || ac_ct_F77="unavailable" F77=$ac_ct_F77 fi if test "$F77" != "unavailable" ; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $coin_f77_comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in $coin_f77_comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done F77=$ac_ct_F77 fi # Provide some information about the compiler. echo "$as_me:4332:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu else { echo "$as_me:$LINENO: WARNING: Failed to find a Fortran compiler!" >&5 echo "$as_me: WARNING: Failed to find a Fortran compiler!" >&2;} fi FFLAGS="$save_fflags" # Check if a project specific FFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set} if test x$coin_tmp = xset; then eval FFLAGS=\${${COIN_PRJCT}_FFLAGS} fi fi if test "$F77" != "unavailable" && test x"$FFLAGS" = x ; then coin_add_fflags= coin_opt_fflags= coin_dbg_fflags= coin_warn_fflags= if test "$G77" = "yes"; then coin_opt_fflags="-O3" coin_add_fflags="-pipe" coin_dbg_fflags="-g -O0" else case $build in *-cygwin* | *-mingw*) case $F77 in ifort* | */ifort* | IFORT* | */IFORT* ) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_fflags='-MD -O3' coin_dbg_fflags='-MDd -debug' else coin_opt_fflags='-MT -O3' coin_dbg_fflags='-MTd -debug' fi coin_add_fflags='-fpp -nologo' ;; compile_f2c*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_fflags='-MD -O2' coin_dbg_fflags='-MDd' else coin_opt_fflags='-MT -O2' coin_dbg_fflags='-MTd' fi coin_add_fflags='-nologo -wd4996' ;; esac ;; *-linux-*) case $F77 in ifc* | */ifc* | ifort* | */ifort*) coin_opt_fflags="-O3 -ip" coin_add_fflags="-cm -w90 -w95" coin_dbg_fflags="-g -CA -CB -CS" # Check if -i_dynamic is necessary (for new glibc library) FFLAGS= cat >conftest.$ac_ext <<_ACEOF program main write(*,*) 'Hello world' end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_fflags="-i_dynamic $coin_add_fflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgf77* | */pgf77* | pgf90* | */pgf90*) coin_opt_fflags="-fast" coin_add_fflags="-Kieee -pc 64" coin_dbg_fflags="-g" ;; esac ;; *-ibm-*) case "$F77" in xlf* | */xlf* | mpxlf* | */mpxlf* ) coin_opt_fflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_fflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_fflags="-g -C" ;; esac ;; *-hp-*) coin_opt_fflags="+O3" coin_add_fflags="+U77" coin_dbg_fflags="-C -g" ;; *-*-solaris*) coin_opt_fflags="-O4" coin_dbg_fflags="-g" ;; *-sgi-*) coin_opt_fflags="-O5 -OPT:Olimit=0" coin_dbg_fflags="-g" ;; esac fi if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then coin_dbg_fflags="-g" fi if test -z "$coin_opt_fflags"; then # Try if -O option works if nothing else is set FFLAGS=-O cat >conftest.$ac_ext <<_ACEOF program main integer i end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_fflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_fflags" = xyes; then coin_warn_fflags= fi if test x${DBG_FFLAGS+set} != xset; then DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags" fi if test x${OPT_FFLAGS+set} != xset; then OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags" fi DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS" OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS" if test "$coin_debug_compile" = "true"; then FFLAGS="$DBG_FFLAGS" else FFLAGS="$OPT_FFLAGS" fi else FFLAGS="$FFLAGS $ADD_FFLAGS" if test x${DBG_FFLAGS+set} != xset; then DBG_FFLAGS="$FFLAGS" fi if test x${OPT_FFLAGS+set} != xset; then OPT_FFLAGS="$FFLAGS" fi fi # Try if FFLAGS works if test "$F77" != "unavailable" ; then cat >conftest.$ac_ext <<_ACEOF program main integer i end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 FFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$FFLAGS"; then { echo "$as_me:$LINENO: WARNING: The flags FFLAGS=\"$FFLAGS\" do not work. I will now just try '-O', but you might want to set FFLAGS manually." >&5 echo "$as_me: WARNING: The flags FFLAGS=\"$FFLAGS\" do not work. I will now just try '-O', but you might want to set FFLAGS manually." >&2;} FFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF program main integer i end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 FFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$FFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for FFLAGS does not work. I will continue with empty FFLAGS, but you might want to set FFLAGS manually." >&5 echo "$as_me: WARNING: This value for FFLAGS does not work. I will continue with empty FFLAGS, but you might want to set FFLAGS manually." >&2;} fi fi fi { echo "$as_me:$LINENO: Fortran compiler options are: $FFLAGS" >&5 echo "$as_me: Fortran compiler options are: $FFLAGS" >&6;} if test x"$MPIF77" = x; then :; else { echo "$as_me:$LINENO: Will use MPI Fortran compiler $MPIF77" >&5 echo "$as_me: Will use MPI Fortran compiler $MPIF77" >&6;} F77="$MPIF77" fi # correct the LD variable if we use the intel fortran compiler in windows case $build in *-cygwin* | *-mingw*) case "$F77" in ifort* | */ifort* | IFORT* | */IFORT*) LD=link ;; esac ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find out how to call Fortran from C and determine Fortran runtime libraries if test "x$F77" != xunavailable then # get FLIBS ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu echo "$as_me:$LINENO: checking how to get verbose linking output from $F77" >&5 echo $ECHO_N "checking how to get verbose linking output from $F77... $ECHO_C" >&6 if test "${ac_cv_prog_f77_v+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_v= # Try some options frequently used verbose output for ac_verb in -v -verbose --verbose -V -\#\#\#; do cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF # Compile and link our simple test program by passing a flag (argument # 1 to this macro) to the Fortran compiler in order to get # "verbose" output that we can then parse for the Fortran linker # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" (eval echo $as_me:4848: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS rm -f conftest* # On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where # /foo, /bar, and /baz are search directories for the Fortran linker. # Here, we change these into -L/foo -L/bar -L/baz (and put it first): ac_f77_v_output="`echo $ac_f77_v_output | grep 'LPATH is:' | sed 's,.*LPATH is\(: *[^ ]*\).*,\1,;s,: */, -L/,g'` $ac_f77_v_output" case $ac_f77_v_output in # If we are using xlf then replace all the commas with spaces. *xlfentry*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted # $LIBS confuse us, and the libraries appear later in the output anyway). *mGLOB_options_string*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/\"-mGLOB[^\"]*\"/ /g'` ;; # If we are using Cray Fortran then delete quotes. # Use "\"" instead of '"' for font-lock-mode. # FIXME: a more general fix for quoted arguments with spaces? *cft90*) ac_f77_v_output=`echo $ac_f77_v_output | sed "s/\"//g"` ;; esac # look for -l* and *.a constructs in the output for ac_arg in $ac_f77_v_output; do case $ac_arg in [\\/]*.a | ?:[\\/]*.a | -[lLRu]*) ac_cv_prog_f77_v=$ac_verb break 2 ;; esac done done if test -z "$ac_cv_prog_f77_v"; then { echo "$as_me:$LINENO: WARNING: cannot determine how to obtain linking information from $F77" >&5 echo "$as_me: WARNING: cannot determine how to obtain linking information from $F77" >&2;} fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: WARNING: compilation failed" >&5 echo "$as_me: WARNING: compilation failed" >&2;} fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_v" >&5 echo "${ECHO_T}$ac_cv_prog_f77_v" >&6 echo "$as_me:$LINENO: checking for Fortran libraries of $F77" >&5 echo $ECHO_N "checking for Fortran libraries of $F77... $ECHO_C" >&6 if test "${ac_cv_f77_libs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$FLIBS" != "x"; then ac_cv_f77_libs="$FLIBS" # Let the user override the test. else cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF # Compile and link our simple test program by passing a flag (argument # 1 to this macro) to the Fortran compiler in order to get # "verbose" output that we can then parse for the Fortran linker # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" (eval echo $as_me:4926: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS rm -f conftest* # On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where # /foo, /bar, and /baz are search directories for the Fortran linker. # Here, we change these into -L/foo -L/bar -L/baz (and put it first): ac_f77_v_output="`echo $ac_f77_v_output | grep 'LPATH is:' | sed 's,.*LPATH is\(: *[^ ]*\).*,\1,;s,: */, -L/,g'` $ac_f77_v_output" case $ac_f77_v_output in # If we are using xlf then replace all the commas with spaces. *xlfentry*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted # $LIBS confuse us, and the libraries appear later in the output anyway). *mGLOB_options_string*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/\"-mGLOB[^\"]*\"/ /g'` ;; # If we are using Cray Fortran then delete quotes. # Use "\"" instead of '"' for font-lock-mode. # FIXME: a more general fix for quoted arguments with spaces? *cft90*) ac_f77_v_output=`echo $ac_f77_v_output | sed "s/\"//g"` ;; esac ac_cv_f77_libs= # Save positional arguments (if any) ac_save_positional="$@" set X $ac_f77_v_output while test $# != 1; do shift ac_arg=$1 case $ac_arg in [\\/]*.a | ?:[\\/]*.a) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi ;; -bI:*) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else if test "$ac_compiler_gnu" = yes; then for ac_link_opt in $ac_arg; do ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" done else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi fi ;; # Ignore these flags. -lang* | -lcrt[01].o | -lcrtbegin.o | -lc | -lgcc | -libmil | -LANG:=*) ;; -lkernel32) test x"$CYGWIN" != xyes && ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" ;; -[LRuY]) # These flags, when seen by themselves, take an argument. # We remove the space between option and argument and re-iterate # unless we find an empty arg or a new option (starting with -) case $2 in "" | -*);; *) ac_arg="$ac_arg$2" shift; shift set X $ac_arg "$@" ;; esac ;; -YP,*) for ac_j in `echo $ac_arg | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_j" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_arg="$ac_arg $ac_j" ac_cv_f77_libs="$ac_cv_f77_libs $ac_j" fi done ;; -[lLR]*) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi ;; # Ignore everything else. esac done # restore positional arguments set X $ac_save_positional; shift # We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, # then we insist that the "run path" must be an absolute path (i.e. it # must begin with a "/"). case `(uname -sr) 2>/dev/null` in "SunOS 5"*) ac_ld_run_path=`echo $ac_f77_v_output | sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'` test "x$ac_ld_run_path" != x && if test "$ac_compiler_gnu" = yes; then for ac_link_opt in $ac_ld_run_path; do ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" done else ac_cv_f77_libs="$ac_cv_f77_libs $ac_ld_run_path" fi ;; esac fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x" fi echo "$as_me:$LINENO: result: $ac_cv_f77_libs" >&5 echo "${ECHO_T}$ac_cv_f77_libs" >&6 FLIBS="$ac_cv_f77_libs" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu orig_FLIBS="$FLIBS" # If FLIBS has been set by the user, we just restore its value here if test x"$save_FLIBS" != x; then FLIBS="$save_FLIBS" else # This is to correct a missing exclusion in autoconf 2.59 if test x"$FLIBS" != x; then my_flibs= for flag in $FLIBS; do case $flag in -lcrt*.o) ;; -lcygwin) ;; -lgcc*) ;; *) my_flibs="$my_flibs $flag" ;; esac done FLIBS="$my_flibs" fi case $build in # The following is a fix to define FLIBS for ifort on Windows # In its original version, it linked in libifcorert.lib or libifcorertd.lib on Windows/ifort explicitly. # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables. # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line. # Further, excluding libc.lib from the default libs seemed to be necessary only for VS < 8. # Since the corresponding flag seems to make more trouble than it avoids, it has been removed now. *-cygwin* | *-mingw*) case "$F77" in # ifort* | */ifort* | IFORT* | */IFORT*) # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib" # if "$coin_debug_compile" = true ; then # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib" # else # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib" # fi # ;; compile_f2c*) FLIBS=`$F77 -FLIBS` ;; esac;; *-hp-*) FLIBS="$FLIBS -lm";; *-ibm-*) FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;; *-linux-*) case "$F77" in pgf77* | */pgf77* | pgf90* | */pgf90*) # ask linker to go through the archives multiple times # (the Fortran compiler seems to do that automatically...) FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;; esac esac ac_cv_f77_libs="$FLIBS" fi if test "x$orig_FLIBS" != "x$FLIBS" ; then { echo "$as_me:$LINENO: Corrected Fortran libraries: $FLIBS" >&5 echo "$as_me: Corrected Fortran libraries: $FLIBS" >&6;} fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu echo "$as_me:$LINENO: checking for dummy main to link with Fortran libraries" >&5 echo $ECHO_N "checking for dummy main to link with Fortran libraries... $ECHO_C" >&6 if test "${ac_cv_f77_dummy_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_f77_dm_save_LIBS=$LIBS LIBS="$LIBS $FLIBS" ac_fortran_dm_var=F77_DUMMY_MAIN ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # First, try linking without a dummy main: cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_fortran_dummy_main=none else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_fortran_dummy_main=unknown fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_cv_fortran_dummy_main = unknown; then for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define $ac_fortran_dm_var $ac_func #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_fortran_dummy_main=$ac_func; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_cv_f77_dummy_main=$ac_cv_fortran_dummy_main rm -f conftest* LIBS=$ac_f77_dm_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_f77_dummy_main" >&5 echo "${ECHO_T}$ac_cv_f77_dummy_main" >&6 F77_DUMMY_MAIN=$ac_cv_f77_dummy_main if test "$F77_DUMMY_MAIN" != unknown; then if test $F77_DUMMY_MAIN != none; then cat >>confdefs.h <<_ACEOF #define F77_DUMMY_MAIN $F77_DUMMY_MAIN _ACEOF if test "x$ac_cv_fc_dummy_main" = "x$ac_cv_f77_dummy_main"; then cat >>confdefs.h <<\_ACEOF #define FC_DUMMY_MAIN_EQ_F77 1 _ACEOF fi fi else { { echo "$as_me:$LINENO: error: linking to Fortran libraries from C fails See \`config.log' for more details." >&5 echo "$as_me: error: linking to Fortran libraries from C fails See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu echo "$as_me:$LINENO: checking for Fortran name-mangling scheme" >&5 echo $ECHO_N "checking for Fortran name-mangling scheme... $ECHO_C" >&6 if test "${ac_cv_f77_mangling+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF subroutine foobar() return end subroutine foo_bar() return end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then mv conftest.$ac_objext cfortran_test.$ac_objext ac_save_LIBS=$LIBS LIBS="cfortran_test.$ac_objext $LIBS $FLIBS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success=no for ac_foobar in foobar FOOBAR; do for ac_underscore in "" "_"; do ac_func="$ac_foobar$ac_underscore" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_success=yes; break 2 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done done ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success" = "yes"; then case $ac_foobar in foobar) ac_case=lower ac_foo_bar=foo_bar ;; FOOBAR) ac_case=upper ac_foo_bar=FOO_BAR ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success_extra=no for ac_extra in "" "_"; do ac_func="$ac_foo_bar$ac_underscore$ac_extra" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_success_extra=yes; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success_extra" = "yes"; then ac_cv_f77_mangling="$ac_case case" if test -z "$ac_underscore"; then ac_cv_f77_mangling="$ac_cv_f77_mangling, no underscore" else ac_cv_f77_mangling="$ac_cv_f77_mangling, underscore" fi if test -z "$ac_extra"; then ac_cv_f77_mangling="$ac_cv_f77_mangling, no extra underscore" else ac_cv_f77_mangling="$ac_cv_f77_mangling, extra underscore" fi else ac_cv_f77_mangling="unknown" fi else ac_cv_f77_mangling="unknown" fi LIBS=$ac_save_LIBS rm -f cfortran_test* conftest* else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compile a simple Fortran program See \`config.log' for more details." >&5 echo "$as_me: error: cannot compile a simple Fortran program See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_f77_mangling" >&5 echo "${ECHO_T}$ac_cv_f77_mangling" >&6 ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in "lower case, no underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name _ACEOF ;; "lower case, no underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## _ _ACEOF ;; "lower case, underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## _ _ACEOF ;; "lower case, underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## __ _ACEOF ;; "upper case, no underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME _ACEOF ;; "upper case, no underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## _ _ACEOF ;; "upper case, underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## _ _ACEOF ;; "upper case, underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## __ _ACEOF ;; *) { echo "$as_me:$LINENO: WARNING: unknown Fortran name-mangling scheme" >&5 echo "$as_me: WARNING: unknown Fortran name-mangling scheme" >&2;} ;; esac ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi # Initialize automake and libtool { # START coin_disable_shared=no # Test if force_shared has been set if test "x" = xforce_shared; then if test x$enable_shared = xno; then { { echo "$as_me:$LINENO: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&5 echo "$as_me: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&2;} { (exit 1); exit 1; }; } fi enable_shared=yes; else case $build in *-cygwin* | *-mingw*) coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in clang* ) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Building of DLLs not supported in this configuration." >&5 echo "$as_me: Building of DLLs not supported in this configuration." >&6;} ;; *gcc*) if test x"$enable_dependency_linking" = xyes; then coin_disable_shared=no else { echo "$as_me:$LINENO: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&5 echo "$as_me: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&2;} fi ;; *) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; esac fi ;; *-aix*) coin_disable_shared=yes platform=AIX if test x"$enable_shared" = xyes; then { echo "$as_me:$LINENO: WARNING: Shared objects are not supported." >&5 echo "$as_me: WARNING: Shared objects are not supported." >&2;} fi ;; esac fi if test x"$coin_disable_shared" = xyes; then if test x"$enable_shared" = xyes; then : else # we don't disable shared, because it was not selected anyway coin_disable_shared=no fi enable_shared=no fi # By default, we only want the shared objects to be compiled # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=no fi; # Initialize automake echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='coinutils' VERSION='2.10.10' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi depcc="$CXX" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME echo "$as_me:$LINENO: checking whether we are using the correct autotools" >&5 echo $ECHO_N "checking whether we are using the correct autotools... $ECHO_C" >&6 if test "${ac_cv_use_correct_autotools+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_correct_autotools=check fi echo "$as_me:$LINENO: result: $ac_cv_use_correct_autotools" >&5 echo "${ECHO_T}$ac_cv_use_correct_autotools" >&6 if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_autoconf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_autoconf"; then ac_cv_prog_have_autoconf="$have_autoconf" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_autoconf="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_autoconf" && ac_cv_prog_have_autoconf="no" fi fi have_autoconf=$ac_cv_prog_have_autoconf if test -n "$have_autoconf"; then echo "$as_me:$LINENO: result: $have_autoconf" >&5 echo "${ECHO_T}$have_autoconf" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_autoconf = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of autoconf" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of autoconf... $ECHO_C" >&6 autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of autoconf as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of autoconf as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location echo "$as_me:$LINENO: checking whether autoconf is coming from the correct location" >&5 echo $ECHO_N "checking whether autoconf is coming from the correct location... $ECHO_C" >&6 autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if we have automake # Extract the first word of "automake", so it can be a program name with args. set dummy automake; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_automake+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_automake"; then ac_cv_prog_have_automake="$have_automake" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_automake="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_automake" && ac_cv_prog_have_automake="no" fi fi have_automake=$ac_cv_prog_have_automake if test -n "$have_automake"; then echo "$as_me:$LINENO: result: $have_automake" >&5 echo "${ECHO_T}$have_automake" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_automake = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of automake" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of automake... $ECHO_C" >&6 automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of automake as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of automake as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable automake is picked up from the correct location echo "$as_me:$LINENO: checking whether automake is coming from the correct location" >&5 echo $ECHO_N "checking whether automake is coming from the correct location... $ECHO_C" >&6 automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` if test -r $want_dir/libtool/ltmain.sh; then have_ltmain=yes : else have_ltmain=no : fi echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of libtool." >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of libtool.... $ECHO_C" >&6 if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of libtool." >&5 echo "$as_me: error: You don't have the correct version of libtool." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: I cannot find the ltmain.sh file." >&5 echo "$as_me: error: I cannot find the ltmain.sh file." >&2;} { (exit 1); exit 1; }; } fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi if test -r $want_dir/aclocal/libtool.m4; then LIBTOOLM4="$want_dir/aclocal/libtool.m4" : else { { echo "$as_me:$LINENO: error: I cannot find the libtool.m4 file." >&5 echo "$as_me: error: I cannot find the libtool.m4 file." >&2;} { (exit 1); exit 1; }; } : fi # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https # Extract the first word of "svn", so it can be a program name with args. set dummy svn; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svn"; then ac_cv_prog_have_svn="$have_svn" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svn="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svn" && ac_cv_prog_have_svn="no" fi fi have_svn=$ac_cv_prog_have_svn if test -n "$have_svn"; then echo "$as_me:$LINENO: result: $have_svn" >&5 echo "${ECHO_T}$have_svn" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$have_svn = xyes; then echo "$as_me:$LINENO: checking whether svn understands https" >&5 echo $ECHO_N "checking whether svn understands https... $ECHO_C" >&6 if test "${ac_cv_svn_understands_https+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out fi echo "$as_me:$LINENO: result: $ac_cv_svn_understands_https" >&5 echo "${ECHO_T}$ac_cv_svn_understands_https" >&6 fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else { { echo "$as_me:$LINENO: error: Cannot find the BuildTools directory" >&5 echo "$as_me: error: Cannot find the BuildTools directory" >&2;} { (exit better disable maintainer mode.); exit better disable maintainer mode.; }; } fi fi fi # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` abs_lib_dir=$full_prefix/lib abs_include_dir=$full_prefix/include abs_bin_dir=$full_prefix/bin if test $coin_have_externals = yes && test x$have_svn = xyes; then HAVE_EXTERNALS_TRUE= HAVE_EXTERNALS_FALSE='#' else HAVE_EXTERNALS_TRUE='#' HAVE_EXTERNALS_FALSE= fi # AC_MSG_NOTICE([End automake initialisation.]) LIBTOOL= if test -f ../libtool; then coin_config_dir=.. LIBTOOL='$(SHELL) $(top_builddir)/../libtool' fi if test "x$LIBTOOL" = x; then if test -f ../../libtool; then coin_config_dir=../.. LIBTOOL='$(SHELL) $(top_builddir)/../../libtool' fi fi if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) # Stuff for libtool # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi; echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done fi SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix4* | aix5*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | kfreebsd*-gnu | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 7452 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 else echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux*) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6 else echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 fi echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6 if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6 objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAGIC_CMD=: fi fi fi ;; esac enable_dlopen=no enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default fi; test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:9432: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:9436: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:9700: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:9704: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 if test x"$lt_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works=yes fi else lt_prog_compiler_static_works=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 if test x"$lt_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:9804: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:9808: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix3*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs=no ;; esac fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var" || \ test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which library types will actually be built echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags or --without-tags was given. if test "${with_tags+set}" = set; then withval="$with_tags" tagnames="$withval" fi; if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_CXX=yes else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_CXX=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_CXX='+b $libdir' ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix3*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. We must also pass each convience library through # to the system linker between allextract/defaultextract. # The C++ compiler will combine linker options so we # cannot just pass the convience library names through # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix3*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; solaris*) case $cc_basename in CC*) # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. postdeps_CXX='-lCstd -lCrun' ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14681: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14685: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_CXX=yes fi else lt_prog_compiler_static_works_CXX=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 if test x"$lt_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14785: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:14789: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var_CXX" || \ test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6 if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_CXX" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code=" subroutine t\n return\n end\n" # Code to be used in simple link tests lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16355: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:16359: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_F77=yes fi else lt_prog_compiler_static_works_F77=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 if test x"$lt_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16459: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:16463: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix3*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_F77=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_F77=yes else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_F77=no ;; esac fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var_F77" || \ test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6 if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_F77" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no old_archive_cmds_GCJ=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:18666: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:18670: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_GCJ='-Qoption ld ';; *) lt_prog_compiler_wl_GCJ='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; unicos*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_can_build_shared_GCJ=no ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:18934: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:18938: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_GCJ=yes fi else lt_prog_compiler_static_works_GCJ=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:19038: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:19042: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix3*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_GCJ=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = no; then runpath_var= hardcode_libdir_flag_spec_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_GCJ=yes else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_GCJ=no ;; esac fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6 test "$ld_shlibs_GCJ" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ pic_flag=$lt_prog_compiler_pic_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var_GCJ" || \ test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6 if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_GCJ" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_RC" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion # No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- # AC_REQUIRE([AC_COIN_DLFCN_H]) # NEW: If libtool exists in the directory higher up, we use that one # instead of creating a new one # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED # out in front of this macro body. You'll notice that LIBTOOL is already # defined here. We'll have to count on this macro not being called if libtool # already exists, or at least move the libtool fixes outside the conditional. # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".]) # This test is therefore removed. -- lh, 061214 -- # if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Calling PROG_LIBTOOL.]) # AC_MSG_NOTICE([Finished PROG_LIBTOOL.]) { echo "$as_me:$LINENO: Build is \"$build\"." >&5 echo "$as_me: Build is \"$build\"." >&6;} mydos2unix='| dos2unix' case $build in *-mingw*) CYGPATH_W=echo mydos2unix= ;; esac case $build in # Here we need to check if -m32 is specified. If so, we need to correct # sys_lib_search_path_spec *-cygwin* | *-mingw*) case "$CXX" in clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? { echo "$as_me:$LINENO: Applying patches to libtool for CLANG compiler" >&5 echo "$as_me: Applying patches to libtool for CLANG compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Applying patches to libtool for cl compiler" >&5 echo "$as_me: Applying patches to libtool for cl compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%lib /OUT:%lib -OUT:%' \ -e "s%cygpath -w%$CYGPATH_W%" \ -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$1"'); done%' \ -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$1"') '"$mydos2unix"'%' \ -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ libtool > conftest.bla ;; *) { echo "$as_me:$LINENO: Applying patches to libtool for GNU compiler" >&5 echo "$as_me: Applying patches to libtool for GNU compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; esac mv conftest.bla libtool chmod 755 libtool ;; *x86_64-*) if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then { echo "$as_me:$LINENO: Applying patches to libtool for 32bit compilation" >&5 echo "$as_me: Applying patches to libtool for 32bit compilation" >&6;} sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi ;; *-solaris*) if test "$GCC" = yes && \ (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then hdwisa=`isainfo | sed -e 's/\([^ ]*\) .*$/\1/'` if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then { echo "$as_me:$LINENO: Applying patches to libtool for 64-bit GCC compilation" >&5 echo "$as_me: Applying patches to libtool for 64-bit GCC compilation" >&6;} fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then # AC_MSG_NOTICE(Compensating for broken gcc) for lib in $fixlibtmp ; do if test -d "${lib}${hdwisa}" ; then syslibpath64="$syslibpath64 ${lib}${hdwisa}/" fi done syslibpath64="${syslibpath64} ${fixlibtmp}" else syslibpath64="$fixlibtmp" fi sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi # AC_MSG_NOTICE(Result is ) # $EGREP 'sys_lib_search_path_spec=' libtool fi ;; # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. *-darwin*) { echo "$as_me:$LINENO: Applying patches to libtool for Darwin" >&5 echo "$as_me: Applying patches to libtool for Darwin" >&6;} sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool ;; esac # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of # the macro. -- lh, 061214 -- # fi # AC_MSG_NOTICE([End libtool initialisation.]) # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) # set RPATH_FLAGS to the compiler link flags required to hardcode location # of the shared objects RPATH_FLAGS= if test $enable_shared = yes; then case $build in *-linux-*) if test "$GXX" = "yes"; then RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" done fi ;; *-darwin*) RPATH_FLAGS=nothing ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) RPATH_FLAGS=nothing ;; esac ;; *-hp-*) RPATH_FLAGS=nothing ;; *-mingw32) RPATH_FLAGS=nothing ;; *-*-solaris*) RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -R$dir" done esac if test "$RPATH_FLAGS" = ""; then { echo "$as_me:$LINENO: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&5 echo "$as_me: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&2;} fi if test "$RPATH_FLAGS" = "nothing"; then RPATH_FLAGS= fi fi else { echo "$as_me:$LINENO: Using libtool script in directory $coin_config_dir" >&5 echo "$as_me: Using libtool script in directory $coin_config_dir" >&6;} # get all missing information from the config.log file # output variables and defines as_save_IFS=$IFS IFS=' ' for oneline in `cat $coin_config_dir/config.status`; do case "$oneline" in # First some automake conditionals s,@am__fastdep* | s,@AR@* | s,@CPP@* | s,@CPPFLAGS@* | s,@CXXCPP@* | \ s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \ s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \ s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; s,@DEFS@* ) command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; esac done IFS=$as_save_IFS # And some defines (assuming here that the packages base dir # doesn't have a config.h file for word in $defsline; do # echo word $word case $word in -DHAVE_[A-Z_]*_H=1 | -DSTDC_HEADERS=1 ) i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` # echo dd $i echo $i >>confdefs.h ;; esac done fi # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) # Check whether --enable-dependency-linking or --disable-dependency-linking was given. if test "${enable_dependency_linking+set}" = set; then enableval="$enable_dependency_linking" dependency_linking="$enableval" else dependency_linking=auto fi; if test "$dependency_linking" = auto; then # On Cygwin and AIX, building DLLs doesn't work dependency_linking=no if test x"$coin_disable_shared" = xno; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) dependency_linking=no ;; *gcc*) dependency_linking=yes ;; *) dependency_linking=yes ;; esac ;; *) dependency_linking=yes ;; esac fi fi if test "$dependency_linking" = yes ; then LT_LDFLAGS="-no-undefined" else LT_LDFLAGS= fi if test "$dependency_linking" = yes; then DEPENDENCY_LINKING_TRUE= DEPENDENCY_LINKING_FALSE='#' else DEPENDENCY_LINKING_TRUE='#' DEPENDENCY_LINKING_FALSE= fi # Check if we want to set the library version echo "$as_me:$LINENO: checking if library version is set" >&5 echo $ECHO_N "checking if library version is set... $ECHO_C" >&6 if test x"$coin_libversion" != x; then LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion" echo "$as_me:$LINENO: result: $coin_libversion" >&5 echo "${ECHO_T}$coin_libversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi #END } ############################################################################ # Stuff that we need for finite and isnan # ############################################################################ ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cmath],[],[],[$hdr]) for ac_header in cmath do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cmath" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([math.h],[],[],[$hdr]) for ac_header in math.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cfloat],[],[],[$hdr]) for ac_header in cfloat do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cfloat" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([float.h],[],[],[$hdr]) for ac_header in float.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cieeefp],[],[],[$hdr]) for ac_header in cieeefp do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cieeefp" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([ieeefp.h],[],[],[$hdr]) for ac_header in ieeefp.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu COIN_C_FINITE= echo "$as_me:$LINENO: checking whether isfinite is declared" >&5 echo $ECHO_N "checking whether isfinite is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_isfinite+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { #ifndef isfinite char *p = (char *) isfinite; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_isfinite=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isfinite=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_have_decl_isfinite" >&5 echo "${ECHO_T}$ac_cv_have_decl_isfinite" >&6 if test $ac_cv_have_decl_isfinite = yes; then COIN_C_FINITE=isfinite fi if test -z "$COIN_C_FINITE"; then echo "$as_me:$LINENO: checking whether finite is declared" >&5 echo $ECHO_N "checking whether finite is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_finite+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { #ifndef finite char *p = (char *) finite; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_finite=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_finite=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_have_decl_finite" >&5 echo "${ECHO_T}$ac_cv_have_decl_finite" >&6 if test $ac_cv_have_decl_finite = yes; then COIN_C_FINITE=finite fi if test -z "$COIN_C_FINITE"; then echo "$as_me:$LINENO: checking whether _finite is declared" >&5 echo $ECHO_N "checking whether _finite is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl__finite+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { #ifndef _finite char *p = (char *) _finite; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl__finite=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl__finite=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_have_decl__finite" >&5 echo "${ECHO_T}$ac_cv_have_decl__finite" >&6 if test $ac_cv_have_decl__finite = yes; then COIN_C_FINITE=_finite fi fi fi if test -z "$COIN_C_FINITE"; then { echo "$as_me:$LINENO: WARNING: Cannot find C-function for checking Inf." >&5 echo "$as_me: WARNING: Cannot find C-function for checking Inf." >&2;} else cat >>confdefs.h <<_ACEOF #define COIN_C_FINITE $COIN_C_FINITE _ACEOF fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cmath],[],[],[$hdr]) for ac_header in cmath do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cmath" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([math.h],[],[],[$hdr]) for ac_header in math.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cfloat],[],[],[$hdr]) for ac_header in cfloat do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cfloat" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([float.h],[],[],[$hdr]) for ac_header in float.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cieeefp],[],[],[$hdr]) for ac_header in cieeefp do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cieeefp" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([ieeefp.h],[],[],[$hdr]) for ac_header in ieeefp.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu COIN_C_ISNAN= echo "$as_me:$LINENO: checking whether isnan is declared" >&5 echo $ECHO_N "checking whether isnan is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_isnan+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { #ifndef isnan char *p = (char *) isnan; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_isnan=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isnan=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_have_decl_isnan" >&5 echo "${ECHO_T}$ac_cv_have_decl_isnan" >&6 if test $ac_cv_have_decl_isnan = yes; then COIN_C_ISNAN=isnan fi # It appears that for some systems (e.g., Mac OSX), cmath will provide only # std::isnan, and bare isnan will be unavailable. Typically we need a parameter # in the test to allow C++ to do overload resolution. if test -z "$COIN_C_ISNAN"; then echo "$as_me:$LINENO: checking whether std::isnan(42.42) is declared" >&5 echo $ECHO_N "checking whether std::isnan(42.42) is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_std__isnan_42_42_+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { #ifndef std::isnan(42.42) char *p = (char *) std::isnan(42.42); #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_std__isnan_42_42_=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_std__isnan_42_42_=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_have_decl_std__isnan_42_42_" >&5 echo "${ECHO_T}$ac_cv_have_decl_std__isnan_42_42_" >&6 if test $ac_cv_have_decl_std__isnan_42_42_ = yes; then COIN_C_ISNAN=std::isnan fi fi if test -z "$COIN_C_ISNAN"; then echo "$as_me:$LINENO: checking whether _isnan is declared" >&5 echo $ECHO_N "checking whether _isnan is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl__isnan+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { #ifndef _isnan char *p = (char *) _isnan; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl__isnan=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl__isnan=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_have_decl__isnan" >&5 echo "${ECHO_T}$ac_cv_have_decl__isnan" >&6 if test $ac_cv_have_decl__isnan = yes; then COIN_C_ISNAN=_isnan fi fi if test -z "$COIN_C_ISNAN"; then echo "$as_me:$LINENO: checking whether isnand is declared" >&5 echo $ECHO_N "checking whether isnand is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_isnand+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { #ifndef isnand char *p = (char *) isnand; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_isnand=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isnand=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_have_decl_isnand" >&5 echo "${ECHO_T}$ac_cv_have_decl_isnand" >&6 if test $ac_cv_have_decl_isnand = yes; then COIN_C_ISNAN=isnand fi fi if test -z "$COIN_C_ISNAN"; then { echo "$as_me:$LINENO: WARNING: Cannot find C-function for checking NaN." >&5 echo "$as_me: WARNING: Cannot find C-function for checking NaN." >&2;} else cat >>confdefs.h <<_ACEOF #define COIN_C_ISNAN $COIN_C_ISNAN _ACEOF fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ############################################################################# # Thread configuration # ############################################################################# # Define new options: # --enable-coinutils-threads # --enable-coinutils-mempool-override-new # --enable-coinutils-mempool-maxpooled ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Check whether --enable-coinutils-threads or --disable-coinutils-threads was given. if test "${enable_coinutils_threads+set}" = set; then enableval="$enable_coinutils_threads" fi; if test "$enable_coinutils_threads" = yes; then # Define the preprocessor macro cat >>confdefs.h <<\_ACEOF #define COINUTILS_PTHREADS 1 _ACEOF echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char clock_gettime (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { clock_gettime (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_rt_clock_gettime=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_rt_clock_gettime=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 if test $ac_cv_lib_rt_clock_gettime = yes; then COINUTILSLIB_LIBS="-lrt $COINUTILSLIB_LIBS" COINUTILSLIB_PCLIBS="-lrt $COINUTILSLIB_PCLIBS" else { { echo "$as_me:$LINENO: error: --enable-coinutils-threads selected, but -lrt unavailable" >&5 echo "$as_me: error: --enable-coinutils-threads selected, but -lrt unavailable" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6 if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_create (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { pthread_create (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pthread_pthread_create=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread_pthread_create=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6 if test $ac_cv_lib_pthread_pthread_create = yes; then COINUTILSLIB_LIBS="-lpthread $COINUTILSLIB_LIBS" COINUTILSLIB_PCLIBS="-lpthread $COINUTILSLIB_PCLIBS" else { { echo "$as_me:$LINENO: error: --enable-coinutils-threads selected, but -lpthreads unavailable" >&5 echo "$as_me: error: --enable-coinutils-threads selected, but -lpthreads unavailable" >&2;} { (exit 1); exit 1; }; } fi fi # Check whether --enable-coinutils-mempool-override-new or --disable-coinutils-mempool-override-new was given. if test "${enable_coinutils_mempool_override_new+set}" = set; then enableval="$enable_coinutils_mempool_override_new" fi; if test "$enable_coinutils_mempool_override_new" = yes; then cat >>confdefs.h <<\_ACEOF #define COINUTILS_MEMPOOL_OVERRIDE_NEW 1 _ACEOF fi # Check whether --enable-coinutils-mempool-maxpooled or --disable-coinutils-mempool-maxpooled was given. if test "${enable_coinutils_mempool_maxpooled+set}" = set; then enableval="$enable_coinutils_mempool_maxpooled" fi; if test "$enable_coinutils_mempool_maxpooled" = yes; then cat >>confdefs.h <<\_ACEOF #define COINUTILS_MEMPOOL_MAXPOOLED 4096 _ACEOF elif test "$enable_coinutils_mempool_maxpooled" = no; then cat >>confdefs.h <<\_ACEOF #define COINUTILS_MEMPOOL_MAXPOOLED -1 _ACEOF elif test x"$enable_coinutils_mempool_maxpooled" = x; then cat >>confdefs.h <<\_ACEOF #define COINUTILS_MEMPOOL_MAXPOOLED -1 _ACEOF else cat >>confdefs.h <<_ACEOF #define COINUTILS_MEMPOOL_MAXPOOLED ${enable_coinutils_mempool_maxpooled} _ACEOF fi ############################################################################# # Finding certain integer types # ############################################################################# ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cinttypes],[],[],[$hdr]) for ac_header in cinttypes do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cinttypes" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([inttypes.h],[],[],[$hdr]) for ac_header in inttypes.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cstdint],[],[],[$hdr]) for ac_header in cstdint do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cstdint" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([stdint.h],[],[],[$hdr]) for ac_header in stdint.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ##### 64bit Integer types # The problem here is that you can't extend `int64_t' to `unsigned int64_t'. # So we need distinct CoinInt64 and CoinUInt64. It should be safe to assume # uint64_t, given int64_t. CoinInt64= CoinUInt64= # try int64_t echo "$as_me:$LINENO: checking for int64_t" >&5 echo $ECHO_N "checking for int64_t... $ECHO_C" >&6 if test "${ac_cv_type_int64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CINTTYPES # include #else # ifdef HAVE_INTTYPES_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((int64_t *) 0) return 0; if (sizeof (int64_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int64_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int64_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5 echo "${ECHO_T}$ac_cv_type_int64_t" >&6 if test $ac_cv_type_int64_t = yes; then CoinInt64=int64_t ; CoinUInt64=uint64_t fi # We need to use the C compiler in the AC_CHECK_SIZEOF since otherwise the # MSCV compiler complains about redefinition of "exit". ac_cv_sizeof_ # sometimes adds `^M' to the number, hence the check for `8?'. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # try long long if test x"$CoinInt64" = x; then echo "$as_me:$LINENO: checking for long long" >&5 echo $ECHO_N "checking for long long... $ECHO_C" >&6 if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((long long *) 0) return 0; if (sizeof (long long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 echo "${ECHO_T}$ac_cv_type_long_long" >&6 echo "$as_me:$LINENO: checking size of long long" >&5 echo $ECHO_N "checking size of long long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (long long)); } unsigned long ulongval () { return (long) (sizeof (long long)); } #include #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (long long))) < 0) { long i = longval (); if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long_long=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF case $ac_cv_sizeof_long_long in 8 | 8?) CoinInt64="long long" CoinUInt64="unsigned long long" ;; esac fi #try long if test x"$CoinInt64" = x; then echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6 if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((long *) 0) return 0; if (sizeof (long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6 echo "$as_me:$LINENO: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (long)); } unsigned long ulongval () { return (long) (sizeof (long)); } #include #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (long))) < 0) { long i = longval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF case $ac_cv_sizeof_long in 8 | 8?) CoinInt64="long" CoinUInt64="unsigned long" ;; esac fi #try int if test x"$CoinInt64" = x; then echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6 if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((int *) 0) return 0; if (sizeof (int)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6 echo "$as_me:$LINENO: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6 if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_int" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (int)); } unsigned long ulongval () { return (long) (sizeof (int)); } #include #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (int))) < 0) { long i = longval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_int=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF case $ac_cv_sizeof_int in 8 | 8?) CoinInt64="int" CoinUInt64="unsigned int" ;; esac fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$CoinInt64" = x; then { { echo "$as_me:$LINENO: error: Cannot find integer type with 64 bits" >&5 echo "$as_me: error: Cannot find integer type with 64 bits" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define COIN_INT64_T $CoinInt64 _ACEOF cat >>confdefs.h <<_ACEOF #define COIN_UINT64_T $CoinInt64 _ACEOF ##### Integer type for Pointer CoinIntPtr= # try intptr_t echo "$as_me:$LINENO: checking for intptr_t" >&5 echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6 if test "${ac_cv_type_intptr_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_CINTTYPES # include #else # ifdef HAVE_INTTYPES_H # include # endif #endif #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((intptr_t *) 0) return 0; if (sizeof (intptr_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_intptr_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_intptr_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5 echo "${ECHO_T}$ac_cv_type_intptr_t" >&6 if test $ac_cv_type_intptr_t = yes; then CoinIntPtr=intptr_t fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # try long long if test x"$CoinIntPtr" = x; then echo "$as_me:$LINENO: checking for int *" >&5 echo $ECHO_N "checking for int *... $ECHO_C" >&6 if test "${ac_cv_type_int_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((int * *) 0) return 0; if (sizeof (int *)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int_p=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int_p=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int_p" >&5 echo "${ECHO_T}$ac_cv_type_int_p" >&6 echo "$as_me:$LINENO: checking size of int *" >&5 echo $ECHO_N "checking size of int *... $ECHO_C" >&6 if test "${ac_cv_sizeof_int_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_int_p" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int *))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int *))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int *))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int *))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int *))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int_p=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int *), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int *), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (int *)); } unsigned long ulongval () { return (long) (sizeof (int *)); } #include #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (int *))) < 0) { long i = longval (); if (i != ((long) (sizeof (int *)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (int *)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int_p=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (int *), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int *), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_int_p=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_int_p" >&5 echo "${ECHO_T}$ac_cv_sizeof_int_p" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_INT_P $ac_cv_sizeof_int_p _ACEOF echo "$as_me:$LINENO: checking for long long" >&5 echo $ECHO_N "checking for long long... $ECHO_C" >&6 if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((long long *) 0) return 0; if (sizeof (long long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 echo "${ECHO_T}$ac_cv_type_long_long" >&6 echo "$as_me:$LINENO: checking size of long long" >&5 echo $ECHO_N "checking size of long long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (long long)); } unsigned long ulongval () { return (long) (sizeof (long long)); } #include #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (long long))) < 0) { long i = longval (); if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long_long=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF if test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_int_p"; then CoinIntPtr="long long" fi fi # try long if test x"$CoinIntPtr" = x; then echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6 if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((long *) 0) return 0; if (sizeof (long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6 echo "$as_me:$LINENO: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (long)); } unsigned long ulongval () { return (long) (sizeof (long)); } #include #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (long))) < 0) { long i = longval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF if test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_int_p"; then CoinIntPtr="long" fi fi # try int if test x"$CoinIntPtr" = x; then echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6 if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { if ((int *) 0) return 0; if (sizeof (int)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6 echo "$as_me:$LINENO: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6 if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_int" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (int)); } unsigned long ulongval () { return (long) (sizeof (int)); } #include #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (int))) < 0) { long i = longval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_int=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_int_p"; then CoinIntPtr="int" fi fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$CoinIntPtr" = x; then { { echo "$as_me:$LINENO: error: Cannot find integer type capturing pointer" >&5 echo "$as_me: error: Cannot find integer type capturing pointer" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define COIN_INTPTR_T $CoinIntPtr _ACEOF if test "x$ac_cv_header_stdint_h" = xyes ; then cat >>confdefs.h <<\_ACEOF #define COINUTILS_HAS_STDINT_H 1 _ACEOF fi if test "x$ac_cv_header_cstdint" = xyes ; then cat >>confdefs.h <<\_ACEOF #define COINUTILS_HAS_CSTDINT 1 _ACEOF fi ############################################################################# # Check whether we have windows.h # ############################################################################# for ac_header in windows.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ############################################################################# # Check whether we have endian.h # ############################################################################# for ac_header in endian.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ############################################################################# # COIN-OR components # ############################################################################# if test $coin_cc_is_cl != true ; then COINUTILSLIB_LIBS="-lm $COINUTILSLIB_LIBS" COINUTILSLIB_PCLIBS="-lm $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS_INSTALLED="-lm $COINUTILSLIB_LIBS_INSTALLED" fi # Check whether --enable-pkg-config or --disable-pkg-config was given. if test "${enable_pkg_config+set}" = set; then enableval="$enable_pkg_config" use_pkgconfig="$enableval" else if test x$coin_cc_is_cl = xtrue; then use_pkgconfig=no else use_pkgconfig=yes fi fi; if test $use_pkgconfig = yes ; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PKG_CONFIG=$ac_cv_prog_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_PKG_CONFIG"; then ac_ct_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_PKG_CONFIG"; then ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG if test -n "$ac_ct_PKG_CONFIG"; then echo "$as_me:$LINENO: result: $ac_ct_PKG_CONFIG" >&5 echo "${ECHO_T}$ac_ct_PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi PKG_CONFIG=$ac_ct_PKG_CONFIG else PKG_CONFIG="$ac_cv_prog_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.16.0 echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 PKG_CONFIG="" fi fi # check if pkg-config supports the short-errors flag if test -n "$PKG_CONFIG" && \ $PKG_CONFIG --atleast-pkgconfig-version 0.20; then pkg_short_errors=" --short-errors " else pkg_short_errors="" fi fi if test -n "$PKG_CONFIG"; then COIN_HAS_PKGCONFIG_TRUE= COIN_HAS_PKGCONFIG_FALSE='#' else COIN_HAS_PKGCONFIG_TRUE='#' COIN_HAS_PKGCONFIG_FALSE= fi # assemble pkg-config search path for installed projects COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" # let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there # best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig, # unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}... if test "x${prefix}" = xNONE ; then COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" else COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi # Check whether --with-coin-instdir or --without-coin-instdir was given. if test "${with_coin_instdir+set}" = set; then withval="$with_coin_instdir" if test -d "$withval"; then : ; else { { echo "$as_me:$LINENO: error: argument for --with-coin-instdir not a directory" >&5 echo "$as_me: error: argument for --with-coin-instdir not a directory" >&2;} { (exit 1); exit 1; }; } fi COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi; # assemble additional pkg-config search paths for uninstalled projects if test x$coin_projectdir = xyes ; then # if we are in a project setup, then in a classic setup, we want to find uninstalled projects # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory # unfortunately, if the user set prefix, then we do not know where the project base directory is located # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data) COIN_PKG_CONFIG_PATH_UNINSTALLED= if test -f ../coin_subdirs.txt ; then for i in `cat ../coin_subdirs.txt` ; do if test -d ../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi if test -f ../../coin_subdirs.txt ; then for i in `cat ../../coin_subdirs.txt` ; do if test -d ../../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi fi if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then { echo "$as_me:$LINENO: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&5 echo "$as_me: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&2;} fi # Check whether --with-blas or --without-blas was given. if test "${with_blas+set}" = set; then withval="$with_blas" use_blas="$withval" else use_blas= fi; # if user specified --with-blas-lib, then we should give COIN_CHECK_PACKAGE # preference # Check whether --with-blas-lib or --without-blas-lib was given. if test "${with_blas_lib+set}" = set; then withval="$with_blas_lib" use_blas=BUILD fi; # Check if user supplied option makes sense if test x"$use_blas" != x; then if test "$use_blas" = "BUILD"; then # we come to this later : elif test "$use_blas" != "no"; then echo "$as_me:$LINENO: checking whether user supplied BLASLIB=\"$use_blas\" works" >&5 echo $ECHO_N "checking whether user supplied BLASLIB=\"$use_blas\" works... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="$use_blas $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi fi ;; esac LIBS="$coin_save_LIBS" fi else # Try to autodetect the library for blas based on build system #AC_MSG_CHECKING([default locations for BLAS]) case $build in *-sgi-*) echo "$as_me:$LINENO: checking whether -lcomplib.sgimath has BLAS" >&5 echo $ECHO_N "checking whether -lcomplib.sgimath has BLAS... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lcomplib.sgimath $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" ;; # Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio # cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't # recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims # that CC and cc will understand -library in Studio 13. The main extra # function of -xlic_lib and -library is to arrange for the Fortran run-time # libraries to be linked for C++ and C. We can arrange that explicitly. *-*-solaris*) echo "$as_me:$LINENO: checking for BLAS in libsunperf" >&5 echo $ECHO_N "checking for BLAS in libsunperf... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lsunperf $FLIBS $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" ;; *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_save_LIBS="$LIBS" echo "$as_me:$LINENO: checking for BLAS in MKL (32bit)" >&5 echo $ECHO_N "checking for BLAS in MKL (32bit)... $ECHO_C" >&6 LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" if test "x$use_blas" = x ; then echo "$as_me:$LINENO: checking for BLAS in MKL (64bit)" >&5 echo $ECHO_N "checking for BLAS in MKL (64bit)... $ECHO_C" >&6 LIBS="mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" fi ;; esac ;; *-darwin*) echo "$as_me:$LINENO: checking for BLAS in Veclib" >&5 echo $ECHO_N "checking for BLAS in Veclib... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-framework Accelerate $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" ;; esac if test -z "$use_blas" ; then echo "$as_me:$LINENO: checking whether -lblas has BLAS" >&5 echo $ECHO_N "checking whether -lblas has BLAS... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lblas $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" fi # If we have no other ideas, consider building BLAS. if test -z "$use_blas" ; then use_blas=BUILD fi fi if test "x$use_blas" = xBUILD ; then echo "$as_me:$LINENO: checking for COIN-OR package Blas" >&5 echo $ECHO_N "checking for COIN-OR package Blas... $ECHO_C" >&6 coin_has_blas=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Blas"; then coin_has_blas=skipping fi done fi if test "$coin_has_blas" != skipping; then # Check whether --with-m4_tolower(Blas) or --without-m4_tolower(Blas) was given. if test "${with_blas+set}" = set; then withval="$with_blas" if test "$withval" = no ; then coin_has_blas=skipping fi fi; fi BLAS_LIBS= BLAS_CFLAGS= BLAS_DATA= BLAS_DEPENDENCIES= BLAS_PCLIBS= BLAS_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_blas != skipping; then # Check whether --with-m4_tolower(Blas)-lib or --without-m4_tolower(Blas)-lib was given. if test "${with_blas_lib+set}" = set; then withval="$with_blas_lib" if test "$withval" = no ; then coin_has_blas=skipping else coin_has_blas=yes BLAS_LIBS="$withval" BLAS_PCLIBS="$withval" COINUTILSLIB_PCLIBS="$withval $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS="$withval $COINUTILSLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then BLAS_LIBS_INSTALLED="$withval" COINUTILSLIB_LIBS_INSTALLED="$withval $COINUTILSLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_blas != skipping; then # Check whether --with-m4_tolower(Blas)-incdir or --without-m4_tolower(Blas)-incdir was given. if test "${with_blas_incdir+set}" = set; then withval="$with_blas_incdir" if test "$withval" = no ; then coin_has_blas=skipping else coin_has_blas=yes BLAS_CFLAGS="-I`${CYGPATH_W} $withval`" COINUTILSLIB_CFLAGS="-I`${CYGPATH_W} $withval` $COINUTILSLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then BLAS_CFLAGS_INSTALLED="$BLAS_CFLAGS" COINUTILSLIB_CFLAGS_INSTALLED="$BLAS_CFLAGS $COINUTILSLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_blas != skipping; then # Check whether --with-m4_tolower(Blas)-datadir or --without-m4_tolower(Blas)-datadir was given. if test "${with_blas_datadir+set}" = set; then withval="$with_blas_datadir" if test "$withval" = no ; then coin_has_blas=skipping else coin_has_blas=yes BLAS_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then BLAS_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_blas = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinblas"; then BLAS_VERSIONS=`$PKG_CONFIG --modversion "coinblas" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinblas" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi BLAS_CFLAGS="$cflags" BLAS_LIBS=`$PKG_CONFIG --libs "coinblas" 2>/dev/null` BLAS_DATA=`$PKG_CONFIG --variable=datadir "coinblas" 2>/dev/null` coin_has_blas=yes echo "$as_me:$LINENO: result: yes: $BLAS_VERSIONS" >&5 echo "${ECHO_T}yes: $BLAS_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then BLAS_LIBS=`echo " $BLAS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi BLAS_PCREQUIRES="coinblas" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CoinUtilsLib COINUTILSLIB_PCREQUIRES="coinblas $COINUTILSLIB_PCREQUIRES" COINUTILSLIB_CFLAGS="$BLAS_CFLAGS $COINUTILSLIB_CFLAGS" COINUTILSLIB_LIBS="$BLAS_LIBS $COINUTILSLIB_LIBS" else BLAS_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinblas"` coin_has_blas=notGiven echo "$as_me:$LINENO: result: not given: $BLAS_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $BLAS_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Blas without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Blas without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Blas (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Blas (fallback)... $ECHO_C" >&6 coin_has_blas=notGiven BLAS_LIBS= BLAS_LIBS_INSTALLED= BLAS_CFLAGS= BLAS_CFLAGS_INSTALLED= BLAS_DATA= BLAS_DATA_INSTALLED= BLAS_PCLIBS= BLAS_PCREQUIRES= # initial list of dependencies is "coinblas", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinblas" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$BLAS_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` BLAS_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$BLAS_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi BLAS_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi BLAS_CFLAGS="$projcflags $BLAS_CFLAGS" # set LIBS variable BLAS_LIBS="$projlibs $BLAS_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi BLAS_CFLAGS_INSTALLED="$projcflags $BLAS_CFLAGS_INSTALLED" # set LIBS variable BLAS_LIBS_INSTALLED="$projlibs $BLAS_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_blas=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_BLAS 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then BLAS_LIBS=`echo " $BLAS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` BLAS_LIBS_INSTALLED=`echo " $BLAS_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi BLAS_PCREQUIRES="coinblas" COINUTILSLIB_PCREQUIRES="coinblas $COINUTILSLIB_PCREQUIRES" COINUTILSLIB_CFLAGS="$BLAS_CFLAGS $COINUTILSLIB_CFLAGS" COINUTILSLIB_LIBS="$BLAS_LIBS $COINUTILSLIB_LIBS" COINUTILSLIB_CFLAGS_INSTALLED="$BLAS_CFLAGS_INSTALLED $COINUTILSLIB_CFLAGS_INSTALLED" COINUTILSLIB_LIBS_INSTALLED="$BLAS_LIBS_INSTALLED $COINUTILSLIB_LIBS_INSTALLED" fi if test $coin_has_blas != notGiven && test $coin_has_blas != skipping; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_blas" >&5 echo "${ECHO_T}$coin_has_blas" >&6 fi if test $coin_has_blas != skipping && test $coin_has_blas != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_BLAS 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) BLAS_DEPENDENCIES=`echo " $BLAS_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` COINUTILSLIB_DEPENDENCIES=`echo " $COINUTILSLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$BLAS_CFLAGS" ; then { echo "$as_me:$LINENO: Blas CFLAGS are $BLAS_CFLAGS" >&5 echo "$as_me: Blas CFLAGS are $BLAS_CFLAGS" >&6;} fi if test -n "$BLAS_LIBS" ; then { echo "$as_me:$LINENO: Blas LIBS are $BLAS_LIBS" >&5 echo "$as_me: Blas LIBS are $BLAS_LIBS" >&6;} fi if test -n "$BLAS_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Blas DEPENDENCIES are $BLAS_DEPENDENCIES" >&5 echo "$as_me: Blas DEPENDENCIES are $BLAS_DEPENDENCIES" >&6;} fi if test -n "$BLAS_DATA" ; then { echo "$as_me:$LINENO: Blas DATA is $BLAS_DATA" >&5 echo "$as_me: Blas DATA is $BLAS_DATA" >&6;} fi if test -n "$BLAS_PCLIBS" ; then { echo "$as_me:$LINENO: Blas PCLIBS are $BLAS_PCLIBS" >&5 echo "$as_me: Blas PCLIBS are $BLAS_PCLIBS" >&6;} fi if test -n "$BLAS_PCREQUIRES" ; then { echo "$as_me:$LINENO: Blas PCREQUIRES are $BLAS_PCREQUIRES" >&5 echo "$as_me: Blas PCREQUIRES are $BLAS_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CoinUtilsLib CFLAGS are $COINUTILSLIB_CFLAGS" >&5 echo "$as_me: CoinUtilsLib CFLAGS are $COINUTILSLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CoinUtilsLib LIBS are $COINUTILSLIB_LIBS" >&5 echo "$as_me: CoinUtilsLib LIBS are $COINUTILSLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CoinUtilsLib DEPENDENCIES are $COINUTILSLIB_DEPENDENCIES" >&5 echo "$as_me: CoinUtilsLib DEPENDENCIES are $COINUTILSLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_blas != notGiven && test $coin_has_blas != skipping; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi elif test "x$use_blas" != x && test "$use_blas" != no; then coin_has_blas=yes if test 0 = 0; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi cat >>confdefs.h <<\_ACEOF #define COIN_HAS_BLAS 1 _ACEOF BLAS_LIBS="$use_blas" BLAS_CFLAGS= BLAS_DATA= COINUTILSLIB_PCLIBS="$BLAS_LIBS $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS="$BLAS_LIBS $COINUTILSLIB_LIBS" COINUTILSLIB_LIBS_INSTALLED="$BLAS_LIBS $COINUTILSLIB_LIBS_INSTALLED" else coin_has_blas=no if test 0 = 1; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi fi # Check whether --with-lapack or --without-lapack was given. if test "${with_lapack+set}" = set; then withval="$with_lapack" use_lapack=$withval else use_lapack= fi; #if user specified --with-lapack-lib, then we should give COIN_HAS_PACKAGE preference # Check whether --with-lapack-lib or --without-lapack-lib was given. if test "${with_lapack_lib+set}" = set; then withval="$with_lapack_lib" use_lapack=BUILD fi; # Check if user supplied option makes sense if test x"$use_lapack" != x; then if test "$use_lapack" = "BUILD"; then # we come to this later : elif test "$use_lapack" != no; then echo "$as_me:$LINENO: checking whether user supplied LAPACKLIB=\"$use_lapack\" works" >&5 echo $ECHO_N "checking whether user supplied LAPACKLIB=\"$use_lapack\" works... $ECHO_C" >&6 coin_need_flibs=no use_lapack="$use_lapack $BLAS_LIBS" coin_save_LIBS="$LIBS" LIBS="$use_lapack $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call dsyev ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied LAPACK library \"$use_lapack\" does not work" >&5 echo "$as_me: error: user supplied LAPACK library \"$use_lapack\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied LAPACK library \"$use_lapack\" does not work" >&5 echo "$as_me: error: user supplied LAPACK library \"$use_lapack\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied LAPACK library \"$use_lapack\" does not work" >&5 echo "$as_me: error: user supplied LAPACK library \"$use_lapack\" does not work" >&2;} { (exit 1); exit 1; }; } fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied LAPACK library \"$use_lapack\" does not work" >&5 echo "$as_me: error: user supplied LAPACK library \"$use_lapack\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied LAPACK library \"$use_lapack\" does not work" >&5 echo "$as_me: error: user supplied LAPACK library \"$use_lapack\" does not work" >&2;} { (exit 1); exit 1; }; } fi fi ;; esac LIBS="$coin_save_LIBS" fi else if test x$coin_has_blas = xyes; then # First try to see if LAPACK is already available with BLAS library echo "$as_me:$LINENO: checking whether LAPACK is already available with BLAS library" >&5 echo $ECHO_N "checking whether LAPACK is already available with BLAS library... $ECHO_C" >&6 coin_save_LIBS="$LIBS" coin_need_flibs=no LIBS="$BLAS_LIBS $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call dsyev ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_lapack="$BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_lapack="$BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_lapack="$BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_lapack="$BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_lapack="$BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" fi if test -z "$use_lapack"; then # Try to autodetect the library for lapack based on build system case $build in # TODO: Is this check actually needed here, since -lcomplib.sigmath should have been recognized as Blas library, # and above it is checked whether the Blas library already contains Lapack *-sgi-*) echo "$as_me:$LINENO: checking whether -lcomplib.sgimath has LAPACK" >&5 echo $ECHO_N "checking whether -lcomplib.sgimath has LAPACK... $ECHO_C" >&6 coin_save_LIBS="$LIBS" coin_need_flibs=no LIBS="-lcomplib.sgimath $BLAS_LIBS $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call dsyev ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_lapack="-lcomplib.sgimath $BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_lapack="-lcomplib.sgimath $BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_lapack="-lcomplib.sgimath $BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_lapack="-lcomplib.sgimath $BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_lapack="-lcomplib.sgimath $BLAS_LIBS" if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" ;; # See comments in COIN_CHECK_PACKAGE_BLAS. # TODO: Is this check actually needed here, since -lsunperf should have been recognized as Blas library, # and above it is checked whether the Blas library already contains Lapack *-*-solaris*) echo "$as_me:$LINENO: checking for LAPACK in libsunperf" >&5 echo $ECHO_N "checking for LAPACK in libsunperf... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lsunperf $BLAS_LIBS $FLIBS $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call dsyev ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_lapack='-lsunperf $BLAS_LIBS' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_lapack='-lsunperf $BLAS_LIBS' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_lapack='-lsunperf $BLAS_LIBS' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_lapack='-lsunperf $BLAS_LIBS' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_lapack='-lsunperf $BLAS_LIBS' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" ;; # On cygwin, do this check only if doscompile is disabled. The prebuilt library # will want to link with cygwin, hence won't run standalone in DOS. esac fi if test -z "$use_lapack" ; then echo "$as_me:$LINENO: checking whether -llapack has LAPACK" >&5 echo $ECHO_N "checking whether -llapack has LAPACK... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-llapack $BLAS_LIBS $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call dsyev ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_lapack='-llapack' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_lapack='-llapack' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdsyev(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_lapack='-llapack' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DSYEV" ;; lower*) ac_val="dsyev" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdsyev="$ac_val" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_lapack='-llapack' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdsyev();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdsyev() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_lapack='-llapack' if test $coin_need_flibs = yes ; then use_lapack="$use_lapack $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_lapack" >&5 echo "${ECHO_T}yes: $use_lapack" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" fi # If we have no other ideas, consider building LAPACK. if test -z "$use_lapack" ; then use_lapack=BUILD fi fi if test "x$use_lapack" = xBUILD ; then echo "$as_me:$LINENO: checking for COIN-OR package Lapack" >&5 echo $ECHO_N "checking for COIN-OR package Lapack... $ECHO_C" >&6 coin_has_lapack=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Lapack"; then coin_has_lapack=skipping fi done fi if test "$coin_has_lapack" != skipping; then # Check whether --with-m4_tolower(Lapack) or --without-m4_tolower(Lapack) was given. if test "${with_lapack+set}" = set; then withval="$with_lapack" if test "$withval" = no ; then coin_has_lapack=skipping fi fi; fi LAPACK_LIBS= LAPACK_CFLAGS= LAPACK_DATA= LAPACK_DEPENDENCIES= LAPACK_PCLIBS= LAPACK_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_lapack != skipping; then # Check whether --with-m4_tolower(Lapack)-lib or --without-m4_tolower(Lapack)-lib was given. if test "${with_lapack_lib+set}" = set; then withval="$with_lapack_lib" if test "$withval" = no ; then coin_has_lapack=skipping else coin_has_lapack=yes LAPACK_LIBS="$withval" LAPACK_PCLIBS="$withval" COINUTILSLIB_PCLIBS="$withval $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS="$withval $COINUTILSLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then LAPACK_LIBS_INSTALLED="$withval" COINUTILSLIB_LIBS_INSTALLED="$withval $COINUTILSLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_lapack != skipping; then # Check whether --with-m4_tolower(Lapack)-incdir or --without-m4_tolower(Lapack)-incdir was given. if test "${with_lapack_incdir+set}" = set; then withval="$with_lapack_incdir" if test "$withval" = no ; then coin_has_lapack=skipping else coin_has_lapack=yes LAPACK_CFLAGS="-I`${CYGPATH_W} $withval`" COINUTILSLIB_CFLAGS="-I`${CYGPATH_W} $withval` $COINUTILSLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then LAPACK_CFLAGS_INSTALLED="$LAPACK_CFLAGS" COINUTILSLIB_CFLAGS_INSTALLED="$LAPACK_CFLAGS $COINUTILSLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_lapack != skipping; then # Check whether --with-m4_tolower(Lapack)-datadir or --without-m4_tolower(Lapack)-datadir was given. if test "${with_lapack_datadir+set}" = set; then withval="$with_lapack_datadir" if test "$withval" = no ; then coin_has_lapack=skipping else coin_has_lapack=yes LAPACK_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then LAPACK_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_lapack = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinlapack"; then LAPACK_VERSIONS=`$PKG_CONFIG --modversion "coinlapack" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinlapack" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi LAPACK_CFLAGS="$cflags" LAPACK_LIBS=`$PKG_CONFIG --libs "coinlapack" 2>/dev/null` LAPACK_DATA=`$PKG_CONFIG --variable=datadir "coinlapack" 2>/dev/null` coin_has_lapack=yes echo "$as_me:$LINENO: result: yes: $LAPACK_VERSIONS" >&5 echo "${ECHO_T}yes: $LAPACK_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then LAPACK_LIBS=`echo " $LAPACK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi LAPACK_PCREQUIRES="coinlapack" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CoinUtilsLib COINUTILSLIB_PCREQUIRES="coinlapack $COINUTILSLIB_PCREQUIRES" COINUTILSLIB_CFLAGS="$LAPACK_CFLAGS $COINUTILSLIB_CFLAGS" COINUTILSLIB_LIBS="$LAPACK_LIBS $COINUTILSLIB_LIBS" else LAPACK_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinlapack"` coin_has_lapack=notGiven echo "$as_me:$LINENO: result: not given: $LAPACK_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $LAPACK_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Lapack without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Lapack without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Lapack (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Lapack (fallback)... $ECHO_C" >&6 coin_has_lapack=notGiven LAPACK_LIBS= LAPACK_LIBS_INSTALLED= LAPACK_CFLAGS= LAPACK_CFLAGS_INSTALLED= LAPACK_DATA= LAPACK_DATA_INSTALLED= LAPACK_PCLIBS= LAPACK_PCREQUIRES= # initial list of dependencies is "coinlapack", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinlapack" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$LAPACK_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` LAPACK_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$LAPACK_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi LAPACK_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi LAPACK_CFLAGS="$projcflags $LAPACK_CFLAGS" # set LIBS variable LAPACK_LIBS="$projlibs $LAPACK_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi LAPACK_CFLAGS_INSTALLED="$projcflags $LAPACK_CFLAGS_INSTALLED" # set LIBS variable LAPACK_LIBS_INSTALLED="$projlibs $LAPACK_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_lapack=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_LAPACK 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then LAPACK_LIBS=`echo " $LAPACK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` LAPACK_LIBS_INSTALLED=`echo " $LAPACK_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi LAPACK_PCREQUIRES="coinlapack" COINUTILSLIB_PCREQUIRES="coinlapack $COINUTILSLIB_PCREQUIRES" COINUTILSLIB_CFLAGS="$LAPACK_CFLAGS $COINUTILSLIB_CFLAGS" COINUTILSLIB_LIBS="$LAPACK_LIBS $COINUTILSLIB_LIBS" COINUTILSLIB_CFLAGS_INSTALLED="$LAPACK_CFLAGS_INSTALLED $COINUTILSLIB_CFLAGS_INSTALLED" COINUTILSLIB_LIBS_INSTALLED="$LAPACK_LIBS_INSTALLED $COINUTILSLIB_LIBS_INSTALLED" fi if test $coin_has_lapack != notGiven && test $coin_has_lapack != skipping; then COIN_HAS_LAPACK_TRUE= COIN_HAS_LAPACK_FALSE='#' else COIN_HAS_LAPACK_TRUE='#' COIN_HAS_LAPACK_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_lapack" >&5 echo "${ECHO_T}$coin_has_lapack" >&6 fi if test $coin_has_lapack != skipping && test $coin_has_lapack != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_LAPACK 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) LAPACK_DEPENDENCIES=`echo " $LAPACK_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` COINUTILSLIB_DEPENDENCIES=`echo " $COINUTILSLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$LAPACK_CFLAGS" ; then { echo "$as_me:$LINENO: Lapack CFLAGS are $LAPACK_CFLAGS" >&5 echo "$as_me: Lapack CFLAGS are $LAPACK_CFLAGS" >&6;} fi if test -n "$LAPACK_LIBS" ; then { echo "$as_me:$LINENO: Lapack LIBS are $LAPACK_LIBS" >&5 echo "$as_me: Lapack LIBS are $LAPACK_LIBS" >&6;} fi if test -n "$LAPACK_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Lapack DEPENDENCIES are $LAPACK_DEPENDENCIES" >&5 echo "$as_me: Lapack DEPENDENCIES are $LAPACK_DEPENDENCIES" >&6;} fi if test -n "$LAPACK_DATA" ; then { echo "$as_me:$LINENO: Lapack DATA is $LAPACK_DATA" >&5 echo "$as_me: Lapack DATA is $LAPACK_DATA" >&6;} fi if test -n "$LAPACK_PCLIBS" ; then { echo "$as_me:$LINENO: Lapack PCLIBS are $LAPACK_PCLIBS" >&5 echo "$as_me: Lapack PCLIBS are $LAPACK_PCLIBS" >&6;} fi if test -n "$LAPACK_PCREQUIRES" ; then { echo "$as_me:$LINENO: Lapack PCREQUIRES are $LAPACK_PCREQUIRES" >&5 echo "$as_me: Lapack PCREQUIRES are $LAPACK_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CoinUtilsLib CFLAGS are $COINUTILSLIB_CFLAGS" >&5 echo "$as_me: CoinUtilsLib CFLAGS are $COINUTILSLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CoinUtilsLib LIBS are $COINUTILSLIB_LIBS" >&5 echo "$as_me: CoinUtilsLib LIBS are $COINUTILSLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CoinUtilsLib DEPENDENCIES are $COINUTILSLIB_DEPENDENCIES" >&5 echo "$as_me: CoinUtilsLib DEPENDENCIES are $COINUTILSLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_lapack != notGiven && test $coin_has_lapack != skipping; then COIN_HAS_LAPACK_TRUE= COIN_HAS_LAPACK_FALSE='#' else COIN_HAS_LAPACK_TRUE='#' COIN_HAS_LAPACK_FALSE= fi elif test "x$use_lapack" != x && test "$use_lapack" != no; then coin_has_lapack=yes if test 0 = 0; then COIN_HAS_LAPACK_TRUE= COIN_HAS_LAPACK_FALSE='#' else COIN_HAS_LAPACK_TRUE='#' COIN_HAS_LAPACK_FALSE= fi cat >>confdefs.h <<\_ACEOF #define COIN_HAS_LAPACK 1 _ACEOF LAPACK_LIBS="$use_lapack" LAPACK_CFLAGS= LAPACK_DATA= COINUTILSLIB_PCLIBS="$LAPACK_LIBS $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS="$LAPACK_LIBS $COINUTILSLIB_LIBS" COINUTILSLIB_LIBS_INSTALLED="$LAPACK_LIBS $COINUTILSLIB_LIBS_INSTALLED" else coin_has_lapack=no if test 0 = 1; then COIN_HAS_LAPACK_TRUE= COIN_HAS_LAPACK_FALSE='#' else COIN_HAS_LAPACK_TRUE='#' COIN_HAS_LAPACK_FALSE= fi fi echo "$as_me:$LINENO: checking for COIN-OR package Glpk" >&5 echo $ECHO_N "checking for COIN-OR package Glpk... $ECHO_C" >&6 coin_has_glpk=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Glpk"; then coin_has_glpk=skipping fi done fi if test "$coin_has_glpk" != skipping; then # Check whether --with-m4_tolower(Glpk) or --without-m4_tolower(Glpk) was given. if test "${with_glpk+set}" = set; then withval="$with_glpk" if test "$withval" = no ; then coin_has_glpk=skipping fi fi; fi GLPK_LIBS= GLPK_CFLAGS= GLPK_DATA= GLPK_DEPENDENCIES= GLPK_PCLIBS= GLPK_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-lib or --without-m4_tolower(Glpk)-lib was given. if test "${with_glpk_lib+set}" = set; then withval="$with_glpk_lib" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_LIBS="$withval" GLPK_PCLIBS="$withval" COINUTILSLIB_PCLIBS="$withval $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS="$withval $COINUTILSLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_LIBS_INSTALLED="$withval" COINUTILSLIB_LIBS_INSTALLED="$withval $COINUTILSLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-incdir or --without-m4_tolower(Glpk)-incdir was given. if test "${with_glpk_incdir+set}" = set; then withval="$with_glpk_incdir" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_CFLAGS="-I`${CYGPATH_W} $withval`" COINUTILSLIB_CFLAGS="-I`${CYGPATH_W} $withval` $COINUTILSLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_CFLAGS_INSTALLED="$GLPK_CFLAGS" COINUTILSLIB_CFLAGS_INSTALLED="$GLPK_CFLAGS $COINUTILSLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-datadir or --without-m4_tolower(Glpk)-datadir was given. if test "${with_glpk_datadir+set}" = set; then withval="$with_glpk_datadir" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_glpk = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinglpk"; then GLPK_VERSIONS=`$PKG_CONFIG --modversion "coinglpk" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinglpk" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS="$cflags" GLPK_LIBS=`$PKG_CONFIG --libs "coinglpk" 2>/dev/null` GLPK_DATA=`$PKG_CONFIG --variable=datadir "coinglpk" 2>/dev/null` coin_has_glpk=yes echo "$as_me:$LINENO: result: yes: $GLPK_VERSIONS" >&5 echo "${ECHO_T}yes: $GLPK_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GLPK_LIBS=`echo " $GLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi GLPK_PCREQUIRES="coinglpk" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in CoinUtilsLib COINUTILSLIB_PCREQUIRES="coinglpk $COINUTILSLIB_PCREQUIRES" COINUTILSLIB_CFLAGS="$GLPK_CFLAGS $COINUTILSLIB_CFLAGS" COINUTILSLIB_LIBS="$GLPK_LIBS $COINUTILSLIB_LIBS" else GLPK_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinglpk"` coin_has_glpk=notGiven echo "$as_me:$LINENO: result: not given: $GLPK_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $GLPK_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Glpk without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Glpk without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Glpk (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Glpk (fallback)... $ECHO_C" >&6 coin_has_glpk=notGiven GLPK_LIBS= GLPK_LIBS_INSTALLED= GLPK_CFLAGS= GLPK_CFLAGS_INSTALLED= GLPK_DATA= GLPK_DATA_INSTALLED= GLPK_PCLIBS= GLPK_PCREQUIRES= # initial list of dependencies is "coinglpk", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinglpk" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$GLPK_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` GLPK_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$GLPK_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi GLPK_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS="$projcflags $GLPK_CFLAGS" # set LIBS variable GLPK_LIBS="$projlibs $GLPK_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS_INSTALLED="$projcflags $GLPK_CFLAGS_INSTALLED" # set LIBS variable GLPK_LIBS_INSTALLED="$projlibs $GLPK_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_glpk=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GLPK 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GLPK_LIBS=`echo " $GLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` GLPK_LIBS_INSTALLED=`echo " $GLPK_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi GLPK_PCREQUIRES="coinglpk" COINUTILSLIB_PCREQUIRES="coinglpk $COINUTILSLIB_PCREQUIRES" COINUTILSLIB_CFLAGS="$GLPK_CFLAGS $COINUTILSLIB_CFLAGS" COINUTILSLIB_LIBS="$GLPK_LIBS $COINUTILSLIB_LIBS" COINUTILSLIB_CFLAGS_INSTALLED="$GLPK_CFLAGS_INSTALLED $COINUTILSLIB_CFLAGS_INSTALLED" COINUTILSLIB_LIBS_INSTALLED="$GLPK_LIBS_INSTALLED $COINUTILSLIB_LIBS_INSTALLED" fi if test $coin_has_glpk != notGiven && test $coin_has_glpk != skipping; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_glpk" >&5 echo "${ECHO_T}$coin_has_glpk" >&6 fi if test $coin_has_glpk != skipping && test $coin_has_glpk != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GLPK 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) GLPK_DEPENDENCIES=`echo " $GLPK_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` COINUTILSLIB_DEPENDENCIES=`echo " $COINUTILSLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$GLPK_CFLAGS" ; then { echo "$as_me:$LINENO: Glpk CFLAGS are $GLPK_CFLAGS" >&5 echo "$as_me: Glpk CFLAGS are $GLPK_CFLAGS" >&6;} fi if test -n "$GLPK_LIBS" ; then { echo "$as_me:$LINENO: Glpk LIBS are $GLPK_LIBS" >&5 echo "$as_me: Glpk LIBS are $GLPK_LIBS" >&6;} fi if test -n "$GLPK_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Glpk DEPENDENCIES are $GLPK_DEPENDENCIES" >&5 echo "$as_me: Glpk DEPENDENCIES are $GLPK_DEPENDENCIES" >&6;} fi if test -n "$GLPK_DATA" ; then { echo "$as_me:$LINENO: Glpk DATA is $GLPK_DATA" >&5 echo "$as_me: Glpk DATA is $GLPK_DATA" >&6;} fi if test -n "$GLPK_PCLIBS" ; then { echo "$as_me:$LINENO: Glpk PCLIBS are $GLPK_PCLIBS" >&5 echo "$as_me: Glpk PCLIBS are $GLPK_PCLIBS" >&6;} fi if test -n "$GLPK_PCREQUIRES" ; then { echo "$as_me:$LINENO: Glpk PCREQUIRES are $GLPK_PCREQUIRES" >&5 echo "$as_me: Glpk PCREQUIRES are $GLPK_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: CoinUtilsLib CFLAGS are $COINUTILSLIB_CFLAGS" >&5 echo "$as_me: CoinUtilsLib CFLAGS are $COINUTILSLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: CoinUtilsLib LIBS are $COINUTILSLIB_LIBS" >&5 echo "$as_me: CoinUtilsLib LIBS are $COINUTILSLIB_LIBS" >&6;} { echo "$as_me:$LINENO: CoinUtilsLib DEPENDENCIES are $COINUTILSLIB_DEPENDENCIES" >&5 echo "$as_me: CoinUtilsLib DEPENDENCIES are $COINUTILSLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_glpk != notGiven && test $coin_has_glpk != skipping; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Sample" >&5 echo $ECHO_N "checking for COIN-OR package Sample... $ECHO_C" >&6 coin_has_sample=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Sample"; then coin_has_sample=skipping fi done fi if test "$coin_has_sample" != skipping; then # Check whether --with-m4_tolower(Sample) or --without-m4_tolower(Sample) was given. if test "${with_sample+set}" = set; then withval="$with_sample" if test "$withval" = no ; then coin_has_sample=skipping fi fi; fi SAMPLE_LIBS= SAMPLE_CFLAGS= SAMPLE_DATA= SAMPLE_DEPENDENCIES= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-lib or --without-m4_tolower(Sample)-lib was given. if test "${with_sample_lib+set}" = set; then withval="$with_sample_lib" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_LIBS="$withval" SAMPLE_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-incdir or --without-m4_tolower(Sample)-incdir was given. if test "${with_sample_incdir+set}" = set; then withval="$with_sample_incdir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_CFLAGS_INSTALLED="$SAMPLE_CFLAGS" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-datadir or --without-m4_tolower(Sample)-datadir was given. if test "${with_sample_datadir+set}" = set; then withval="$with_sample_datadir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatasample"; then SAMPLE_VERSIONS=`$PKG_CONFIG --modversion "coindatasample" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatasample" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$cflags" SAMPLE_LIBS=`$PKG_CONFIG --libs "coindatasample" 2>/dev/null` SAMPLE_DATA=`$PKG_CONFIG --variable=datadir "coindatasample" 2>/dev/null` coin_has_sample=yes echo "$as_me:$LINENO: result: yes: $SAMPLE_VERSIONS" >&5 echo "${ECHO_T}yes: $SAMPLE_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi SAMPLE_PCREQUIRES="coindatasample" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else SAMPLE_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatasample"` coin_has_sample=notGiven echo "$as_me:$LINENO: result: not given: $SAMPLE_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $SAMPLE_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Sample without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Sample without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Sample (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Sample (fallback)... $ECHO_C" >&6 coin_has_sample=notGiven SAMPLE_LIBS= SAMPLE_LIBS_INSTALLED= SAMPLE_CFLAGS= SAMPLE_CFLAGS_INSTALLED= SAMPLE_DATA= SAMPLE_DATA_INSTALLED= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= # initial list of dependencies is "coindatasample", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatasample" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$SAMPLE_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` SAMPLE_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$SAMPLE_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi SAMPLE_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$projcflags $SAMPLE_CFLAGS" # set LIBS variable SAMPLE_LIBS="$projlibs $SAMPLE_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS_INSTALLED="$projcflags $SAMPLE_CFLAGS_INSTALLED" # set LIBS variable SAMPLE_LIBS_INSTALLED="$projlibs $SAMPLE_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_sample=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` SAMPLE_LIBS_INSTALLED=`echo " $SAMPLE_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi SAMPLE_PCREQUIRES="coindatasample" fi if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_sample" >&5 echo "${ECHO_T}$coin_has_sample" >&6 fi if test $coin_has_sample != skipping && test $coin_has_sample != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) SAMPLE_DEPENDENCIES=`echo " $SAMPLE_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$SAMPLE_CFLAGS" ; then { echo "$as_me:$LINENO: Sample CFLAGS are $SAMPLE_CFLAGS" >&5 echo "$as_me: Sample CFLAGS are $SAMPLE_CFLAGS" >&6;} fi if test -n "$SAMPLE_LIBS" ; then { echo "$as_me:$LINENO: Sample LIBS are $SAMPLE_LIBS" >&5 echo "$as_me: Sample LIBS are $SAMPLE_LIBS" >&6;} fi if test -n "$SAMPLE_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&5 echo "$as_me: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&6;} fi if test -n "$SAMPLE_DATA" ; then { echo "$as_me:$LINENO: Sample DATA is $SAMPLE_DATA" >&5 echo "$as_me: Sample DATA is $SAMPLE_DATA" >&6;} fi if test -n "$SAMPLE_PCLIBS" ; then { echo "$as_me:$LINENO: Sample PCLIBS are $SAMPLE_PCLIBS" >&5 echo "$as_me: Sample PCLIBS are $SAMPLE_PCLIBS" >&6;} fi if test -n "$SAMPLE_PCREQUIRES" ; then { echo "$as_me:$LINENO: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&5 echo "$as_me: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Netlib" >&5 echo $ECHO_N "checking for COIN-OR package Netlib... $ECHO_C" >&6 coin_has_netlib=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Netlib"; then coin_has_netlib=skipping fi done fi if test "$coin_has_netlib" != skipping; then # Check whether --with-m4_tolower(Netlib) or --without-m4_tolower(Netlib) was given. if test "${with_netlib+set}" = set; then withval="$with_netlib" if test "$withval" = no ; then coin_has_netlib=skipping fi fi; fi NETLIB_LIBS= NETLIB_CFLAGS= NETLIB_DATA= NETLIB_DEPENDENCIES= NETLIB_PCLIBS= NETLIB_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-lib or --without-m4_tolower(Netlib)-lib was given. if test "${with_netlib_lib+set}" = set; then withval="$with_netlib_lib" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_LIBS="$withval" NETLIB_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-incdir or --without-m4_tolower(Netlib)-incdir was given. if test "${with_netlib_incdir+set}" = set; then withval="$with_netlib_incdir" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_CFLAGS_INSTALLED="$NETLIB_CFLAGS" fi fi fi; fi if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-datadir or --without-m4_tolower(Netlib)-datadir was given. if test "${with_netlib_datadir+set}" = set; then withval="$with_netlib_datadir" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_netlib = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatanetlib"; then NETLIB_VERSIONS=`$PKG_CONFIG --modversion "coindatanetlib" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatanetlib" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS="$cflags" NETLIB_LIBS=`$PKG_CONFIG --libs "coindatanetlib" 2>/dev/null` NETLIB_DATA=`$PKG_CONFIG --variable=datadir "coindatanetlib" 2>/dev/null` coin_has_netlib=yes echo "$as_me:$LINENO: result: yes: $NETLIB_VERSIONS" >&5 echo "${ECHO_T}yes: $NETLIB_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then NETLIB_LIBS=`echo " $NETLIB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi NETLIB_PCREQUIRES="coindatanetlib" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else NETLIB_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatanetlib"` coin_has_netlib=notGiven echo "$as_me:$LINENO: result: not given: $NETLIB_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $NETLIB_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Netlib without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Netlib without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Netlib (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Netlib (fallback)... $ECHO_C" >&6 coin_has_netlib=notGiven NETLIB_LIBS= NETLIB_LIBS_INSTALLED= NETLIB_CFLAGS= NETLIB_CFLAGS_INSTALLED= NETLIB_DATA= NETLIB_DATA_INSTALLED= NETLIB_PCLIBS= NETLIB_PCREQUIRES= # initial list of dependencies is "coindatanetlib", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatanetlib" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$NETLIB_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` NETLIB_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$NETLIB_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi NETLIB_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS="$projcflags $NETLIB_CFLAGS" # set LIBS variable NETLIB_LIBS="$projlibs $NETLIB_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS_INSTALLED="$projcflags $NETLIB_CFLAGS_INSTALLED" # set LIBS variable NETLIB_LIBS_INSTALLED="$projlibs $NETLIB_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_netlib=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NETLIB 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then NETLIB_LIBS=`echo " $NETLIB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` NETLIB_LIBS_INSTALLED=`echo " $NETLIB_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi NETLIB_PCREQUIRES="coindatanetlib" fi if test $coin_has_netlib != notGiven && test $coin_has_netlib != skipping; then COIN_HAS_NETLIB_TRUE= COIN_HAS_NETLIB_FALSE='#' else COIN_HAS_NETLIB_TRUE='#' COIN_HAS_NETLIB_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_netlib" >&5 echo "${ECHO_T}$coin_has_netlib" >&6 fi if test $coin_has_netlib != skipping && test $coin_has_netlib != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NETLIB 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) NETLIB_DEPENDENCIES=`echo " $NETLIB_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$NETLIB_CFLAGS" ; then { echo "$as_me:$LINENO: Netlib CFLAGS are $NETLIB_CFLAGS" >&5 echo "$as_me: Netlib CFLAGS are $NETLIB_CFLAGS" >&6;} fi if test -n "$NETLIB_LIBS" ; then { echo "$as_me:$LINENO: Netlib LIBS are $NETLIB_LIBS" >&5 echo "$as_me: Netlib LIBS are $NETLIB_LIBS" >&6;} fi if test -n "$NETLIB_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Netlib DEPENDENCIES are $NETLIB_DEPENDENCIES" >&5 echo "$as_me: Netlib DEPENDENCIES are $NETLIB_DEPENDENCIES" >&6;} fi if test -n "$NETLIB_DATA" ; then { echo "$as_me:$LINENO: Netlib DATA is $NETLIB_DATA" >&5 echo "$as_me: Netlib DATA is $NETLIB_DATA" >&6;} fi if test -n "$NETLIB_PCLIBS" ; then { echo "$as_me:$LINENO: Netlib PCLIBS are $NETLIB_PCLIBS" >&5 echo "$as_me: Netlib PCLIBS are $NETLIB_PCLIBS" >&6;} fi if test -n "$NETLIB_PCREQUIRES" ; then { echo "$as_me:$LINENO: Netlib PCREQUIRES are $NETLIB_PCREQUIRES" >&5 echo "$as_me: Netlib PCREQUIRES are $NETLIB_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_netlib != notGiven && test $coin_has_netlib != skipping; then COIN_HAS_NETLIB_TRUE= COIN_HAS_NETLIB_FALSE='#' else COIN_HAS_NETLIB_TRUE='#' COIN_HAS_NETLIB_FALSE= fi coin_has_zlib=no # Check whether --enable-zlib or --disable-zlib was given. if test "${enable_zlib+set}" = set; then enableval="$enable_zlib" coin_enable_zlib=$enableval else coin_enable_zlib=yes fi; if test $coin_enable_zlib = yes; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([zlib.h],[coin_has_zlib=yes],[],[$hdr]) for ac_header in zlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF coin_has_zlib=yes fi done if test $coin_has_zlib = yes; then echo "$as_me:$LINENO: checking for gzopen in -lz" >&5 echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6 if test "${ac_cv_lib_z_gzopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gzopen (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { gzopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_z_gzopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_gzopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6 if test $ac_cv_lib_z_gzopen = yes; then : else coin_has_zlib=no fi fi if test $coin_has_zlib = yes; then COINUTILSLIB_LIBS="-lz $COINUTILSLIB_LIBS" COINUTILSLIB_PCLIBS="-lz $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS_INSTALLED="-lz $COINUTILSLIB_LIBS_INSTALLED" cat >>confdefs.h <<\_ACEOF #define COIN_HAS_ZLIB 1 _ACEOF fi fi if test x$coin_has_zlib = xyes; then COIN_HAS_ZLIB_TRUE= COIN_HAS_ZLIB_FALSE='#' else COIN_HAS_ZLIB_TRUE='#' COIN_HAS_ZLIB_FALSE= fi # Check whether --enable-bzlib or --disable-bzlib was given. if test "${enable_bzlib+set}" = set; then enableval="$enable_bzlib" coin_enable_bzlib=$enableval else coin_enable_bzlib=yes fi; coin_has_bzlib=no if test $coin_enable_bzlib = yes; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([bzlib.h],[coin_has_bzlib=yes],[],[$hdr]) for ac_header in bzlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------------- ## ## Report this to http://projects.coin-or.org/CoinUtils ## ## ---------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF coin_has_bzlib=yes fi done if test $coin_has_bzlib = yes; then echo "$as_me:$LINENO: checking for BZ2_bzReadOpen in -lbz2" >&5 echo $ECHO_N "checking for BZ2_bzReadOpen in -lbz2... $ECHO_C" >&6 if test "${ac_cv_lib_bz2_BZ2_bzReadOpen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbz2 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char BZ2_bzReadOpen (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { BZ2_bzReadOpen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bz2_BZ2_bzReadOpen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bz2_BZ2_bzReadOpen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bz2_BZ2_bzReadOpen" >&5 echo "${ECHO_T}$ac_cv_lib_bz2_BZ2_bzReadOpen" >&6 if test $ac_cv_lib_bz2_BZ2_bzReadOpen = yes; then : else coin_has_bzlib=no fi fi if test $coin_has_bzlib = yes; then COINUTILSLIB_LIBS="-lbz2 $COINUTILSLIB_LIBS" COINUTILSLIB_PCLIBS="-lbz2 $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS_INSTALLED="-lbz2 $COINUTILSLIB_LIBS_INSTALLED" cat >>confdefs.h <<\_ACEOF #define COIN_HAS_BZLIB 1 _ACEOF fi fi # Check whether --enable-gnu-packages or --disable-gnu-packages was given. if test "${enable_gnu_packages+set}" = set; then enableval="$enable_gnu_packages" coin_enable_gnu=$enableval else coin_enable_gnu=no fi; coin_has_readline=no if test $coin_enable_gnu = yes; then #if test x"#include " = x; then # hdr="#include " #else # hdr="#include " #fi #AC_CHECK_HEADERS([readline/readline.h],[coin_has_readline=yes],[],[$hdr]) for ac_header in readline/readline.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF coin_has_readline=yes fi done coin_save_LIBS="$LIBS" LIBS= # First we check if tputs and friends are available if test $coin_has_readline = yes; then echo "$as_me:$LINENO: checking for library containing tputs" >&5 echo $ECHO_N "checking for library containing tputs... $ECHO_C" >&6 if test "${ac_cv_search_tputs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_tputs=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tputs (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { tputs (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_tputs="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_tputs" = no; then for ac_lib in ncurses termcap curses; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tputs (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { tputs (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_tputs="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_tputs" >&5 echo "${ECHO_T}$ac_cv_search_tputs" >&6 if test "$ac_cv_search_tputs" != no; then test "$ac_cv_search_tputs" = "none required" || LIBS="$ac_cv_search_tputs $LIBS" else coin_has_readline=no fi fi # Now we check for readline if test $coin_has_readline = yes; then echo "$as_me:$LINENO: checking for readline in -lreadline" >&5 echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6 if test "${ac_cv_lib_readline_readline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char readline (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { readline (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_readline_readline=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_readline=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5 echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6 if test $ac_cv_lib_readline_readline = yes; then : else coin_has_readline=no fi fi if test $coin_has_readline = yes; then COINUTILSLIB_LIBS="-lreadline $LIBS $COINUTILSLIB_LIBS" COINUTILSLIB_PCLIBS="-lreadline $LIBS $COINUTILSLIB_PCLIBS" COINUTILSLIB_LIBS_INSTALLED="-lreadline $LIBS $COINUTILSLIB_LIBS_INSTALLED" cat >>confdefs.h <<\_ACEOF #define COIN_HAS_READLINE 1 _ACEOF fi LIBS="$coin_save_LIBS" fi echo "$as_me:$LINENO: checking whether this is a VPATH configuration" >&5 echo $ECHO_N "checking whether this is a VPATH configuration... $ECHO_C" >&6 if test `cd $srcdir; pwd` != `pwd`; then coin_vpath_config=yes; else coin_vpath_config=no; fi echo "$as_me:$LINENO: result: $coin_vpath_config" >&5 echo "${ECHO_T}$coin_vpath_config" >&6 # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="test/plan.mod" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi ############################################################################# # Check for doxygen # ############################################################################# { echo "$as_me:$LINENO: configuring doxygen documentation options" >&5 echo "$as_me: configuring doxygen documentation options" >&6;} # Check to see if doxygen is available. # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_doxygen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_doxygen"; then ac_cv_prog_coin_have_doxygen="$coin_have_doxygen" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_doxygen="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_doxygen" && ac_cv_prog_coin_have_doxygen="no" fi fi coin_have_doxygen=$ac_cv_prog_coin_have_doxygen if test -n "$coin_have_doxygen"; then echo "$as_me:$LINENO: result: $coin_have_doxygen" >&5 echo "${ECHO_T}$coin_have_doxygen" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_latex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_latex"; then ac_cv_prog_coin_have_latex="$coin_have_latex" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_latex="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_latex" && ac_cv_prog_coin_have_latex="no" fi fi coin_have_latex=$ac_cv_prog_coin_have_latex if test -n "$coin_have_latex"; then echo "$as_me:$LINENO: result: $coin_have_latex" >&5 echo "${ECHO_T}$coin_have_latex" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Look for the dot tool from the graphviz package, unless the user has # disabled it. # Check whether --with-dot or --without-dot was given. if test "${with_dot+set}" = set; then withval="$with_dot" else withval=yes fi; if test x"$withval" = xno ; then coin_doxy_usedot=NO echo "$as_me:$LINENO: checking for dot " >&5 echo $ECHO_N "checking for dot ... $ECHO_C" >&6 echo "$as_me:$LINENO: result: disabled" >&5 echo "${ECHO_T}disabled" >&6 else # Extract the first word of "dot", so it can be a program name with args. set dummy dot; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_doxy_usedot+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_doxy_usedot"; then ac_cv_prog_coin_doxy_usedot="$coin_doxy_usedot" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_doxy_usedot="YES" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_doxy_usedot" && ac_cv_prog_coin_doxy_usedot="NO" fi fi coin_doxy_usedot=$ac_cv_prog_coin_doxy_usedot if test -n "$coin_doxy_usedot"; then echo "$as_me:$LINENO: result: $coin_doxy_usedot" >&5 echo "${ECHO_T}$coin_doxy_usedot" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi # Generate a tag file name and a log file name coin_doxy_tagname=doxydoc/${PACKAGE}_doxy.tag coin_doxy_logname=doxydoc/${PACKAGE}_doxy.log if test $coin_have_doxygen = yes; then COIN_HAS_DOXYGEN_TRUE= COIN_HAS_DOXYGEN_FALSE='#' else COIN_HAS_DOXYGEN_TRUE='#' COIN_HAS_DOXYGEN_FALSE= fi if test $coin_have_latex = yes; then COIN_HAS_LATEX_TRUE= COIN_HAS_LATEX_FALSE='#' else COIN_HAS_LATEX_TRUE='#' COIN_HAS_LATEX_FALSE= fi # Process the list of project names and massage them into possible doxygen # doc'n directories. Prefer 1) classic external, source processed using # a project-specific doxygen.conf, we use the tag file; 2) classic # external, source processed using package doxygen.conf; 3) installed # doxydoc. Alternatives 1) and 2) are only possible if the directory will be # configured, which we can't know unless this is the package base configure, # since coin_subdirs is only set there. Hence it's sufficient to check for # membership. If we use a tag file from a classic external, exclude the # source from doxygen processing when doxygen runs in the base directory. coin_doxy_tagfiles= coin_doxy_excludes= tmp="" for proj in $tmp ; do lc_proj=`echo $proj | tr [A-Z] [a-z]` echo "$as_me:$LINENO: checking for doxygen doc'n for $proj " >&5 echo $ECHO_N "checking for doxygen doc'n for $proj ... $ECHO_C" >&6 doxytag=${lc_proj}_doxy.tag doxyfound=no # proj will be configured, hence doxydoc present in build tree doxysrcdir="${srcdir}/../${proj}" # AC_MSG_NOTICE([Considering $doxysrcdir (base)]) if test -d "$doxysrcdir" ; then # with a doxydoc directory? doxydir="$doxysrcdir/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (base)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) if test -d "$doxydir" ; then # use tag file; don't process source doxydir="../${proj}/doxydoc" coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=../../$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 coin_doxy_excludes="$coin_doxy_excludes */${proj}" else # will process the source -- nothing further to be done here echo "$as_me:$LINENO: result: $doxysrcdir (src)" >&5 echo "${ECHO_T}$doxysrcdir (src)" >&6 fi doxyfound=yes fi # Not built, fall back to installed tag file if test $doxyfound = no ; then eval doxydir="${datadir}/coin/doc/${proj}/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (install)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 fi done ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) ac_config_files="$ac_config_files Makefile src/Makefile test/Makefile coinutils.pc coinutils-uninstalled.pc" ac_config_files="$ac_config_files doxydoc/doxygen.conf" # Here put the location and name of the configuration header file ac_config_headers="$ac_config_headers src/config.h src/config_coinutils.h" # Finally, we let configure write all the output... echo "$as_me:$LINENO: checking which command should be used to link input files" >&5 echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac echo "$as_me:$LINENO: result: $coin_link_input_cmd" >&5 echo "${ECHO_T}$coin_link_input_cmd" >&6 if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${ALWAYS_FALSE_TRUE}" && test -z "${ALWAYS_FALSE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CC_IS_CL_TRUE}" && test -z "${COIN_CC_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CXX_IS_CL_TRUE}" && test -z "${COIN_CXX_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_EXTERNALS_TRUE}" && test -z "${HAVE_EXTERNALS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${DEPENDENCY_LINKING_TRUE}" && test -z "${DEPENDENCY_LINKING_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_PKGCONFIG_TRUE}" && test -z "${COIN_HAS_PKGCONFIG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LAPACK_TRUE}" && test -z "${COIN_HAS_LAPACK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LAPACK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LAPACK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LAPACK_TRUE}" && test -z "${COIN_HAS_LAPACK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LAPACK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LAPACK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LAPACK_TRUE}" && test -z "${COIN_HAS_LAPACK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LAPACK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LAPACK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LAPACK_TRUE}" && test -z "${COIN_HAS_LAPACK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LAPACK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LAPACK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NETLIB_TRUE}" && test -z "${COIN_HAS_NETLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NETLIB_TRUE}" && test -z "${COIN_HAS_NETLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_ZLIB_TRUE}" && test -z "${COIN_HAS_ZLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_ZLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_ZLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_DOXYGEN_TRUE}" && test -z "${COIN_HAS_DOXYGEN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LATEX_TRUE}" && test -z "${COIN_HAS_LATEX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by CoinUtils $as_me 2.10.10, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ CoinUtils config.status 2.10.10 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "coinutils.pc" ) CONFIG_FILES="$CONFIG_FILES coinutils.pc" ;; "coinutils-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES coinutils-uninstalled.pc" ;; "doxydoc/doxygen.conf" ) CONFIG_FILES="$CONFIG_FILES doxydoc/doxygen.conf" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "src/config_coinutils.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config_coinutils.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@ALWAYS_FALSE_TRUE@,$ALWAYS_FALSE_TRUE,;t t s,@ALWAYS_FALSE_FALSE@,$ALWAYS_FALSE_FALSE,;t t s,@have_svnversion@,$have_svnversion,;t t s,@COINUTILS_SVN_REV@,$COINUTILS_SVN_REV,;t t s,@CDEFS@,$CDEFS,;t t s,@ADD_CFLAGS@,$ADD_CFLAGS,;t t s,@DBG_CFLAGS@,$DBG_CFLAGS,;t t s,@OPT_CFLAGS@,$OPT_CFLAGS,;t t s,@sol_cc_compiler@,$sol_cc_compiler,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@COIN_CC_IS_CL_TRUE@,$COIN_CC_IS_CL_TRUE,;t t s,@COIN_CC_IS_CL_FALSE@,$COIN_CC_IS_CL_FALSE,;t t s,@MPICC@,$MPICC,;t t s,@CXXDEFS@,$CXXDEFS,;t t s,@ADD_CXXFLAGS@,$ADD_CXXFLAGS,;t t s,@DBG_CXXFLAGS@,$DBG_CXXFLAGS,;t t s,@OPT_CXXFLAGS@,$OPT_CXXFLAGS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@COIN_CXX_IS_CL_TRUE@,$COIN_CXX_IS_CL_TRUE,;t t s,@COIN_CXX_IS_CL_FALSE@,$COIN_CXX_IS_CL_FALSE,;t t s,@MPICXX@,$MPICXX,;t t s,@ADD_FFLAGS@,$ADD_FFLAGS,;t t s,@DBG_FFLAGS@,$DBG_FFLAGS,;t t s,@OPT_FFLAGS@,$OPT_FFLAGS,;t t s,@F77@,$F77,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@MPIF77@,$MPIF77,;t t s,@FLIBS@,$FLIBS,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBTOOLM4@,$LIBTOOLM4,;t t s,@have_autoconf@,$have_autoconf,;t t s,@have_automake@,$have_automake,;t t s,@have_svn@,$have_svn,;t t s,@BUILDTOOLSDIR@,$BUILDTOOLSDIR,;t t s,@AUX_DIR@,$AUX_DIR,;t t s,@abs_source_dir@,$abs_source_dir,;t t s,@abs_lib_dir@,$abs_lib_dir,;t t s,@abs_include_dir@,$abs_include_dir,;t t s,@abs_bin_dir@,$abs_bin_dir,;t t s,@HAVE_EXTERNALS_TRUE@,$HAVE_EXTERNALS_TRUE,;t t s,@HAVE_EXTERNALS_FALSE@,$HAVE_EXTERNALS_FALSE,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@CXXCPP@,$CXXCPP,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@ac_c_preproc_warn_flag@,$ac_c_preproc_warn_flag,;t t s,@ac_cxx_preproc_warn_flag@,$ac_cxx_preproc_warn_flag,;t t s,@RPATH_FLAGS@,$RPATH_FLAGS,;t t s,@DEPENDENCY_LINKING_TRUE@,$DEPENDENCY_LINKING_TRUE,;t t s,@DEPENDENCY_LINKING_FALSE@,$DEPENDENCY_LINKING_FALSE,;t t s,@LT_LDFLAGS@,$LT_LDFLAGS,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@ac_ct_PKG_CONFIG@,$ac_ct_PKG_CONFIG,;t t s,@COIN_HAS_PKGCONFIG_TRUE@,$COIN_HAS_PKGCONFIG_TRUE,;t t s,@COIN_HAS_PKGCONFIG_FALSE@,$COIN_HAS_PKGCONFIG_FALSE,;t t s,@COIN_PKG_CONFIG_PATH@,$COIN_PKG_CONFIG_PATH,;t t s,@COIN_PKG_CONFIG_PATH_UNINSTALLED@,$COIN_PKG_CONFIG_PATH_UNINSTALLED,;t t s,@BLAS_LIBS@,$BLAS_LIBS,;t t s,@BLAS_CFLAGS@,$BLAS_CFLAGS,;t t s,@BLAS_DATA@,$BLAS_DATA,;t t s,@BLAS_DEPENDENCIES@,$BLAS_DEPENDENCIES,;t t s,@BLAS_LIBS_INSTALLED@,$BLAS_LIBS_INSTALLED,;t t s,@BLAS_CFLAGS_INSTALLED@,$BLAS_CFLAGS_INSTALLED,;t t s,@BLAS_DATA_INSTALLED@,$BLAS_DATA_INSTALLED,;t t s,@COINUTILSLIB_CFLAGS@,$COINUTILSLIB_CFLAGS,;t t s,@COINUTILSLIB_LIBS@,$COINUTILSLIB_LIBS,;t t s,@COINUTILSLIB_PCLIBS@,$COINUTILSLIB_PCLIBS,;t t s,@COINUTILSLIB_PCREQUIRES@,$COINUTILSLIB_PCREQUIRES,;t t s,@COINUTILSLIB_DEPENDENCIES@,$COINUTILSLIB_DEPENDENCIES,;t t s,@COINUTILSLIB_CFLAGS_INSTALLED@,$COINUTILSLIB_CFLAGS_INSTALLED,;t t s,@COINUTILSLIB_LIBS_INSTALLED@,$COINUTILSLIB_LIBS_INSTALLED,;t t s,@COIN_HAS_BLAS_TRUE@,$COIN_HAS_BLAS_TRUE,;t t s,@COIN_HAS_BLAS_FALSE@,$COIN_HAS_BLAS_FALSE,;t t s,@LAPACK_LIBS@,$LAPACK_LIBS,;t t s,@LAPACK_CFLAGS@,$LAPACK_CFLAGS,;t t s,@LAPACK_DATA@,$LAPACK_DATA,;t t s,@LAPACK_DEPENDENCIES@,$LAPACK_DEPENDENCIES,;t t s,@LAPACK_LIBS_INSTALLED@,$LAPACK_LIBS_INSTALLED,;t t s,@LAPACK_CFLAGS_INSTALLED@,$LAPACK_CFLAGS_INSTALLED,;t t s,@LAPACK_DATA_INSTALLED@,$LAPACK_DATA_INSTALLED,;t t s,@COIN_HAS_LAPACK_TRUE@,$COIN_HAS_LAPACK_TRUE,;t t s,@COIN_HAS_LAPACK_FALSE@,$COIN_HAS_LAPACK_FALSE,;t t s,@GLPK_LIBS@,$GLPK_LIBS,;t t s,@GLPK_CFLAGS@,$GLPK_CFLAGS,;t t s,@GLPK_DATA@,$GLPK_DATA,;t t s,@GLPK_DEPENDENCIES@,$GLPK_DEPENDENCIES,;t t s,@GLPK_LIBS_INSTALLED@,$GLPK_LIBS_INSTALLED,;t t s,@GLPK_CFLAGS_INSTALLED@,$GLPK_CFLAGS_INSTALLED,;t t s,@GLPK_DATA_INSTALLED@,$GLPK_DATA_INSTALLED,;t t s,@COIN_HAS_GLPK_TRUE@,$COIN_HAS_GLPK_TRUE,;t t s,@COIN_HAS_GLPK_FALSE@,$COIN_HAS_GLPK_FALSE,;t t s,@SAMPLE_LIBS@,$SAMPLE_LIBS,;t t s,@SAMPLE_CFLAGS@,$SAMPLE_CFLAGS,;t t s,@SAMPLE_DATA@,$SAMPLE_DATA,;t t s,@SAMPLE_DEPENDENCIES@,$SAMPLE_DEPENDENCIES,;t t s,@SAMPLE_LIBS_INSTALLED@,$SAMPLE_LIBS_INSTALLED,;t t s,@SAMPLE_CFLAGS_INSTALLED@,$SAMPLE_CFLAGS_INSTALLED,;t t s,@SAMPLE_DATA_INSTALLED@,$SAMPLE_DATA_INSTALLED,;t t s,@COIN_HAS_SAMPLE_TRUE@,$COIN_HAS_SAMPLE_TRUE,;t t s,@COIN_HAS_SAMPLE_FALSE@,$COIN_HAS_SAMPLE_FALSE,;t t s,@NETLIB_LIBS@,$NETLIB_LIBS,;t t s,@NETLIB_CFLAGS@,$NETLIB_CFLAGS,;t t s,@NETLIB_DATA@,$NETLIB_DATA,;t t s,@NETLIB_DEPENDENCIES@,$NETLIB_DEPENDENCIES,;t t s,@NETLIB_LIBS_INSTALLED@,$NETLIB_LIBS_INSTALLED,;t t s,@NETLIB_CFLAGS_INSTALLED@,$NETLIB_CFLAGS_INSTALLED,;t t s,@NETLIB_DATA_INSTALLED@,$NETLIB_DATA_INSTALLED,;t t s,@COIN_HAS_NETLIB_TRUE@,$COIN_HAS_NETLIB_TRUE,;t t s,@COIN_HAS_NETLIB_FALSE@,$COIN_HAS_NETLIB_FALSE,;t t s,@COIN_HAS_ZLIB_TRUE@,$COIN_HAS_ZLIB_TRUE,;t t s,@COIN_HAS_ZLIB_FALSE@,$COIN_HAS_ZLIB_FALSE,;t t s,@coin_have_doxygen@,$coin_have_doxygen,;t t s,@coin_have_latex@,$coin_have_latex,;t t s,@coin_doxy_usedot@,$coin_doxy_usedot,;t t s,@coin_doxy_tagname@,$coin_doxy_tagname,;t t s,@coin_doxy_logname@,$coin_doxy_logname,;t t s,@COIN_HAS_DOXYGEN_TRUE@,$COIN_HAS_DOXYGEN_TRUE,;t t s,@COIN_HAS_DOXYGEN_FALSE@,$COIN_HAS_DOXYGEN_FALSE,;t t s,@COIN_HAS_LATEX_TRUE@,$COIN_HAS_LATEX_TRUE,;t t s,@COIN_HAS_LATEX_FALSE@,$COIN_HAS_LATEX_FALSE,;t t s,@coin_doxy_tagfiles@,$coin_doxy_tagfiles,;t t s,@coin_doxy_excludes@,$coin_doxy_excludes,;t t s,@LIBEXT@,$LIBEXT,;t t s,@VPATH_DISTCLEANFILES@,$VPATH_DISTCLEANFILES,;t t s,@ABSBUILDDIR@,$ABSBUILDDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then { echo "$as_me:$LINENO: Copying data files for VPATH configuration" >&5 echo "$as_me: Copying data files for VPATH configuration" >&6;} else { echo "$as_me:$LINENO: Creating VPATH links for data files" >&5 echo "$as_me: Creating VPATH links for data files" >&6;} fi for file in $coin_vpath_link_files; do dir=`(dirname "./$file") 2>/dev/null || $as_expr X"./$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"./$file" : 'X\(//\)[^/]' \| \ X"./$file" : 'X\(//\)$' \| \ X"./$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"./$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test -d $dir; then : ; else { if $as_mkdir_p; then mkdir -p $dir else as_dir=$dir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dir" >&5 echo "$as_me: error: cannot create directory $dir" >&2;} { (exit 1); exit 1; }; }; } fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi { echo "$as_me:$LINENO: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&5 echo "$as_me: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&6;} if test x$coin_projectdir = xyes; then { echo "$as_me:$LINENO: Configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} else { echo "$as_me:$LINENO: Main configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Main configuration of $PACKAGE_NAME successful" >&6;} fi else { echo "$as_me:$LINENO: No configuration of $PACKAGE_NAME necessary" >&5 echo "$as_me: No configuration of $PACKAGE_NAME necessary" >&6;} fi CoinMP-1.8.3/CoinUtils/INSTALL0000644000175000017500000000031010740302141014240 0ustar renereneThis is the CoinUtils project. For information on how to install the package this project was downloaded with see the INSTALL file in the root of the package (the parent directory of this directory). CoinMP-1.8.3/CoinUtils/ltmain.sh0000755000175000017500000057753011405215457015075 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/CoinUtils/config.guess0000755000175000017500000012706311405215457015562 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/CoinUtils/coinutils.pc.in0000644000175000017500000000047611507663424016206 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: CoinUtils Description: COIN-OR Utilities URL: https://projects.coin-or.org/CoinUtils Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lCoinUtils @COINUTILSLIB_PCLIBS@ Cflags: -I${includedir} Requires: @COINUTILSLIB_PCREQUIRES@ CoinMP-1.8.3/CoinUtils/coinutils-uninstalled.pc.in0000644000175000017500000000045511573155175020525 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src Name: CoinUtils Description: COIN-OR Utilities URL: https://projects.coin-or.org/CoinUtils Version: @PACKAGE_VERSION@ Libs: ${libdir}/libCoinUtils.la @COINUTILSLIB_PCLIBS@ Cflags: -I@abs_source_dir@/src -I@ABSBUILDDIR@/src Requires: @COINUTILSLIB_PCREQUIRES@ CoinMP-1.8.3/CoinUtils/test/0000755000175000017500000000000012600453454014207 5ustar renereneCoinMP-1.8.3/CoinUtils/test/CoinMpsIOTest.cpp0000644000175000017500000004605412237744620017370 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinMpsIO.hpp" #include "CoinFloatEqual.hpp" //############################################################################# //-------------------------------------------------------------------------- // test import methods void CoinMpsIOUnitTest(const std::string & mpsDir) { // Test default constructor { CoinMpsIO m; assert( m.rowsense_==NULL ); assert( m.rhs_==NULL ); assert( m.rowrange_==NULL ); assert( m.matrixByRow_==NULL ); assert( m.matrixByColumn_==NULL ); assert( m.integerType_==NULL); assert( !strcmp( m.getFileName() , "????")); assert( !strcmp( m.getProblemName() , "")); assert( !strcmp( m.objectiveName_ , "")); assert( !strcmp( m.rhsName_ , "")); assert( !strcmp( m.rangeName_ , "")); assert( !strcmp( m.boundName_ , "")); } { CoinRelFltEq eq; CoinMpsIO m; std::string fn = mpsDir+"exmip1"; int numErr = m.readMps(fn.c_str(),"mps"); assert( numErr== 0 ); assert( !strcmp( m.problemName_ , "EXAMPLE")); assert( !strcmp( m.objectiveName_ , "OBJ")); assert( !strcmp( m.rhsName_ , "RHS1")); assert( !strcmp( m.rangeName_ , "RNG1")); assert( !strcmp( m.boundName_ , "BND1")); // Test language and re-use m.newLanguage(CoinMessages::it); m.messageHandler()->setPrefix(false); // This call should return an error indicating that the // end-of-file was reached. // This is because the file remains open to possibly read // a quad. section. numErr = m.readMps(fn.c_str(),"mps"); assert( numErr < 0 ); // Test copy constructor and assignment operator { CoinMpsIO lhs; { CoinMpsIO im(m); CoinMpsIO imC1(im); assert( imC1.getNumCols() == im.getNumCols() ); assert( imC1.getNumRows() == im.getNumRows() ); CoinMpsIO imC2(im); assert( imC2.getNumCols() == im.getNumCols() ); assert( imC2.getNumRows() == im.getNumRows() ); lhs=imC2; } // Test that lhs has correct values even though rhs has gone out of scope assert( lhs.getNumCols() == m.getNumCols() ); assert( lhs.getNumRows() == m.getNumRows() ); } { CoinMpsIO dumSi(m); int nc = dumSi.getNumCols(); int nr = dumSi.getNumRows(); const double * cl = dumSi.getColLower(); const double * cu = dumSi.getColUpper(); const double * rl = dumSi.getRowLower(); const double * ru = dumSi.getRowUpper(); assert( nc == 8 ); assert( nr == 5 ); assert( eq(cl[0],2.5) ); assert( eq(cl[1],0.0) ); assert( eq(cu[1],4.1) ); assert( eq(cu[2],1.0) ); assert( eq(rl[0],2.5) ); assert( eq(rl[4],3.0) ); assert( eq(ru[1],2.1) ); assert( eq(ru[4],15.0) ); assert( !eq(cl[3],1.2345) ); assert( !eq(cu[4],10.2345) ); assert( eq( dumSi.getObjCoefficients()[0], 1.0) ); assert( eq( dumSi.getObjCoefficients()[1], 0.0) ); assert( eq( dumSi.getObjCoefficients()[2], 0.0) ); assert( eq( dumSi.getObjCoefficients()[3], 0.0) ); assert( eq( dumSi.getObjCoefficients()[4], 2.0) ); assert( eq( dumSi.getObjCoefficients()[5], 0.0) ); assert( eq( dumSi.getObjCoefficients()[6], 0.0) ); assert( eq( dumSi.getObjCoefficients()[7], -1.0) ); dumSi.writeMps("CoinMpsIoTest.mps");//,0,0,1); } // Read just written file { CoinMpsIO dumSi; dumSi.readMps("CoinMpsIoTest"); int nc = dumSi.getNumCols(); int nr = dumSi.getNumRows(); const double * cl = dumSi.getColLower(); const double * cu = dumSi.getColUpper(); const double * rl = dumSi.getRowLower(); const double * ru = dumSi.getRowUpper(); assert( nc == 8 ); assert( nr == 5 ); assert( eq(cl[0],2.5) ); assert( eq(cl[1],0.0) ); assert( eq(cu[1],4.1) ); assert( eq(cu[2],1.0) ); assert( eq(rl[0],2.5) ); assert( eq(rl[4],3.0) ); assert( eq(ru[1],2.1) ); assert( eq(ru[4],15.0) ); assert( !eq(cl[3],1.2345) ); assert( !eq(cu[4],10.2345) ); assert( eq( dumSi.getObjCoefficients()[0], 1.0) ); assert( eq( dumSi.getObjCoefficients()[1], 0.0) ); assert( eq( dumSi.getObjCoefficients()[2], 0.0) ); assert( eq( dumSi.getObjCoefficients()[3], 0.0) ); assert( eq( dumSi.getObjCoefficients()[4], 2.0) ); assert( eq( dumSi.getObjCoefficients()[5], 0.0) ); assert( eq( dumSi.getObjCoefficients()[6], 0.0) ); assert( eq( dumSi.getObjCoefficients()[7], -1.0) ); } // Test matrixByRow method { const CoinMpsIO si(m); const CoinPackedMatrix * smP = si.getMatrixByRow(); // LL: const CoinDumPackedMatrix * osmP = dynamic_cast(smP); // LL: assert( osmP!=NULL ); CoinRelFltEq eq; const double * ev = smP->getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 1.0) ); assert( eq(ev[2], -2.0) ); assert( eq(ev[3], -1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[5], 2.0) ); assert( eq(ev[6], 1.1) ); assert( eq(ev[7], 1.0) ); assert( eq(ev[8], 1.0) ); assert( eq(ev[9], 2.8) ); assert( eq(ev[10], -1.2) ); assert( eq(ev[11], 5.6) ); assert( eq(ev[12], 1.0) ); assert( eq(ev[13], 1.9) ); const CoinBigIndex * mi = smP->getVectorStarts(); assert( mi[0]==0 ); assert( mi[1]==5 ); assert( mi[2]==7 ); assert( mi[3]==9 ); assert( mi[4]==11 ); assert( mi[5]==14 ); const int * ei = smP->getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 1 ); assert( ei[2] == 3 ); assert( ei[3] == 4 ); assert( ei[4] == 7 ); assert( ei[5] == 1 ); assert( ei[6] == 2 ); assert( ei[7] == 2 ); assert( ei[8] == 5 ); assert( ei[9] == 3 ); assert( ei[10] == 6 ); assert( ei[11] == 0 ); assert( ei[12] == 4 ); assert( ei[13] == 7 ); assert( smP->getMajorDim() == 5 ); assert( smP->getNumElements() == 14 ); } // Test matrixByCol method { const CoinMpsIO si(m); const CoinPackedMatrix * smP = si.getMatrixByCol(); // LL: const CoinDumPackedMatrix * osmP = dynamic_cast(smP); // LL: assert( osmP!=NULL ); CoinRelFltEq eq; const double * ev = smP->getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 5.6) ); assert( eq(ev[2], 1.0) ); assert( eq(ev[3], 2.0) ); assert( eq(ev[4], 1.1) ); assert( eq(ev[5], 1.0) ); assert( eq(ev[6], -2.0) ); assert( eq(ev[7], 2.8) ); assert( eq(ev[8], -1.0) ); assert( eq(ev[9], 1.0) ); assert( eq(ev[10], 1.0) ); assert( eq(ev[11], -1.2) ); assert( eq(ev[12], -1.0) ); assert( eq(ev[13], 1.9) ); const CoinBigIndex * mi = smP->getVectorStarts(); assert( mi[0]==0 ); assert( mi[1]==2 ); assert( mi[2]==4 ); assert( mi[3]==6 ); assert( mi[4]==8 ); assert( mi[5]==10 ); assert( mi[6]==11 ); assert( mi[7]==12 ); assert( mi[8]==14 ); const int * ei = smP->getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 4 ); assert( ei[2] == 0 ); assert( ei[3] == 1 ); assert( ei[4] == 1 ); assert( ei[5] == 2 ); assert( ei[6] == 0 ); assert( ei[7] == 3 ); assert( ei[8] == 0 ); assert( ei[9] == 4 ); assert( ei[10] == 2 ); assert( ei[11] == 3 ); assert( ei[12] == 0 ); assert( ei[13] == 4 ); assert( smP->getMajorDim() == 8 ); assert( smP->getNumElements() == 14 ); assert( smP->getSizeVectorStarts()==9 ); assert( smP->getMinorDim() == 5 ); } //-------------- // Test rowsense, rhs, rowrange, matrixByRow { CoinMpsIO lhs; { assert( m.rowrange_==NULL ); assert( m.rowsense_==NULL ); assert( m.rhs_==NULL ); assert( m.matrixByRow_==NULL ); CoinMpsIO siC1(m); assert( siC1.rowrange_==NULL ); assert( siC1.rowsense_==NULL ); assert( siC1.rhs_==NULL ); assert( siC1.matrixByRow_==NULL ); const char * siC1rs = siC1.getRowSense(); assert( siC1rs[0]=='G' ); assert( siC1rs[1]=='L' ); assert( siC1rs[2]=='E' ); assert( siC1rs[3]=='R' ); assert( siC1rs[4]=='R' ); const double * siC1rhs = siC1.getRightHandSide(); assert( eq(siC1rhs[0],2.5) ); assert( eq(siC1rhs[1],2.1) ); assert( eq(siC1rhs[2],4.0) ); assert( eq(siC1rhs[3],5.0) ); assert( eq(siC1rhs[4],15.) ); const double * siC1rr = siC1.getRowRange(); assert( eq(siC1rr[0],0.0) ); assert( eq(siC1rr[1],0.0) ); assert( eq(siC1rr[2],0.0) ); assert( eq(siC1rr[3],5.0-1.8) ); assert( eq(siC1rr[4],15.0-3.0) ); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); assert( siC1mbr != NULL ); const double * ev = siC1mbr->getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 1.0) ); assert( eq(ev[2], -2.0) ); assert( eq(ev[3], -1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[5], 2.0) ); assert( eq(ev[6], 1.1) ); assert( eq(ev[7], 1.0) ); assert( eq(ev[8], 1.0) ); assert( eq(ev[9], 2.8) ); assert( eq(ev[10], -1.2) ); assert( eq(ev[11], 5.6) ); assert( eq(ev[12], 1.0) ); assert( eq(ev[13], 1.9) ); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); assert( mi[0]==0 ); assert( mi[1]==5 ); assert( mi[2]==7 ); assert( mi[3]==9 ); assert( mi[4]==11 ); assert( mi[5]==14 ); const int * ei = siC1mbr->getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 1 ); assert( ei[2] == 3 ); assert( ei[3] == 4 ); assert( ei[4] == 7 ); assert( ei[5] == 1 ); assert( ei[6] == 2 ); assert( ei[7] == 2 ); assert( ei[8] == 5 ); assert( ei[9] == 3 ); assert( ei[10] == 6 ); assert( ei[11] == 0 ); assert( ei[12] == 4 ); assert( ei[13] == 7 ); assert( siC1mbr->getMajorDim() == 5 ); assert( siC1mbr->getNumElements() == 14 ); assert( siC1rs == siC1.getRowSense() ); assert( siC1rhs == siC1.getRightHandSide() ); assert( siC1rr == siC1.getRowRange() ); } } //test special sections: SOS, QUADOBJ, CSECTION { CoinMpsIO m_MpsData; std::string fn = mpsDir+"spec_sections"; int nOfSOS; CoinSet ** SOS; int status = m_MpsData.readMps(fn.c_str(),"mps", nOfSOS, SOS); assert (status == 0); assert (nOfSOS == 2); assert (SOS[0]->numberEntries() == 2); assert (SOS[1]->numberEntries() == 2); assert (SOS[0]->setType() == 1); assert (SOS[1]->setType() == 2); { int numberEntries = SOS[0]->numberEntries(); const int * which = SOS[0]->which(); const double * weights = SOS[0]->weights(); assert (which[0] == 2); assert (which[1] == 3); assert (weights[0] == 0); assert (weights[1] == 1); } { int numberEntries = SOS[1]->numberEntries(); const int * which = SOS[1]->which(); const double * weights = SOS[1]->weights(); assert (which[0] == 4); assert (which[1] == 5); assert (weights[0] == 20); assert (weights[1] == 40); } int * columnStart = NULL; int * columnIdx = NULL; double * elements = NULL; status = m_MpsData.readQuadraticMps(NULL, columnStart, columnIdx, elements, 0); assert (status == 0); assert (columnStart[ 0] == 0); assert (columnStart[ 1] == 0); assert (columnStart[ 2] == 0); assert (columnStart[ 3] == 0); assert (columnStart[ 4] == 0); assert (columnStart[ 5] == 0); assert (columnStart[ 6] == 0); assert (columnStart[ 7] == 2); assert (columnStart[ 8] == 3); assert (columnStart[ 9] == 3); assert (columnStart[10] == 3); assert (columnStart[11] == 3); assert (columnStart[12] == 3); assert (columnStart[13] == 3); assert (columnStart[14] == 3); assert (columnStart[15] == 3); assert (columnIdx[0] == 6); assert (columnIdx[1] == 7); assert (columnIdx[2] == 7); assert (elements[0] == 1.0); assert (elements[1] == 2.0); assert (elements[2] == 7.0); int nOfCones; int * coneStart = NULL; int * coneIdx = NULL; int * coneType = NULL; status = m_MpsData.readConicMps(NULL, coneStart, coneIdx, coneType, nOfCones); assert (status == 0); assert (nOfCones == 2); assert (coneType[0] == 1); assert (coneType[1] == 2); assert (coneStart[0] == 0); assert (coneStart[1] == 3); assert (coneStart[2] == 7); assert (coneStart[0] == 0); assert (coneStart[1] == 3); assert (coneStart[2] == 7); assert (coneIdx[0] == 8); assert (coneIdx[1] == 9); assert (coneIdx[2] == 10); assert (coneIdx[3] == 11); assert (coneIdx[4] == 12); assert (coneIdx[5] == 13); assert (coneIdx[6] == 14); } #ifdef COIN_HAS_GLPK // test GMPL reader { CoinMessageHandler msghandler; CoinMpsIO mpsio; mpsio.passInMessageHandler(&msghandler); int ret = mpsio.readGMPL("plan.mod", NULL, true); printf("read plan.mod with return == %d\n", ret); assert(ret == 0); int nc = mpsio.getNumCols(); int nr = mpsio.getNumRows(); const double * cl = mpsio.getColLower(); const double * cu = mpsio.getColUpper(); const double * rl = mpsio.getRowLower(); const double * ru = mpsio.getRowUpper(); const double * obj = mpsio.getObjCoefficients(); assert( nc == 7 ); assert( nr == 8 ); assert( eq(cl[0],0) ); assert( eq(cl[1],0) ); assert( eq(cl[2],400) ); assert( eq(cl[3],100) ); assert( eq(cl[4],0) ); assert( eq(cl[5],0) ); assert( eq(cl[6],0) ); assert( eq(cu[0],200) ); assert( eq(cu[1],2500) ); assert( eq(cu[2],800) ); assert( eq(cu[3],700) ); assert( eq(cu[4],1500) ); assert( eq(cu[5],mpsio.getInfinity()) ); assert( eq(cu[6],mpsio.getInfinity()) ); assert( eq(rl[0],-mpsio.getInfinity()) ); assert( eq(rl[1],2000) ); assert( eq(rl[2],-mpsio.getInfinity()) ); assert( eq(rl[3],-mpsio.getInfinity()) ); assert( eq(rl[4],-mpsio.getInfinity()) ); assert( eq(rl[5],-mpsio.getInfinity()) ); assert( eq(rl[6],1500) ); assert( eq(rl[7],250) ); assert( eq(ru[0],mpsio.getInfinity()) ); assert( eq(ru[1],2000) ); assert( eq(ru[2],60) ); assert( eq(ru[3],100) ); assert( eq(ru[4],40) ); assert( eq(ru[5],30) ); assert( eq(ru[6],mpsio.getInfinity()) ); assert( eq(ru[7],300) ); assert( eq(obj[0],0.03) ); assert( eq(obj[1],0.08) ); assert( eq(obj[2],0.17) ); assert( eq(obj[3],0.12) ); assert( eq(obj[4],0.15) ); assert( eq(obj[5],0.21) ); assert( eq(obj[6],0.38) ); const CoinPackedMatrix * matrix = mpsio.getMatrixByRow(); assert( matrix != NULL ); assert( matrix->getMajorDim() == nr ); int nel = matrix->getNumElements(); assert( nel == 48 ); const double * ev = matrix->getElements(); assert( ev != NULL ); const int * ei = matrix->getIndices(); assert( ei != NULL ); const CoinBigIndex * mi = matrix->getVectorStarts(); assert( mi != NULL ); assert( eq(ev[0],0.03) ); assert( eq(ev[1],0.08) ); assert( eq(ev[2],0.17) ); assert( eq(ev[3],0.12) ); assert( eq(ev[4],0.15) ); assert( eq(ev[5],0.21) ); assert( eq(ev[6],0.38) ); assert( eq(ev[7],1) ); assert( eq(ev[8],1) ); assert( eq(ev[9],1) ); assert( eq(ev[10],1) ); assert( eq(ev[11],1) ); assert( eq(ev[12],1) ); assert( eq(ev[13],1) ); assert( eq(ev[14],0.15) ); assert( eq(ev[15],0.04) ); assert( eq(ev[16],0.02) ); assert( eq(ev[17],0.04) ); assert( eq(ev[18],0.02) ); assert( eq(ev[19],0.01) ); assert( eq(ev[20],0.03) ); assert( eq(ev[21],0.03) ); assert( eq(ev[22],0.05) ); assert( eq(ev[23],0.08) ); assert( eq(ev[24],0.02) ); assert( eq(ev[25],0.06) ); assert( eq(ev[26],0.01) ); assert( eq(ev[27],0.02) ); assert( eq(ev[28],0.04) ); assert( eq(ev[29],0.01) ); assert( eq(ev[30],0.02) ); assert( eq(ev[31],0.02) ); assert( eq(ev[32],0.02) ); assert( eq(ev[33],0.03) ); assert( eq(ev[34],0.01) ); assert( eq(ev[35],0.7) ); assert( eq(ev[36],0.75) ); assert( eq(ev[37],0.8) ); assert( eq(ev[38],0.75) ); assert( eq(ev[39],0.8) ); assert( eq(ev[40],0.97) ); assert( eq(ev[41],0.02) ); assert( eq(ev[42],0.06) ); assert( eq(ev[43],0.08) ); assert( eq(ev[44],0.12) ); assert( eq(ev[45],0.02) ); assert( eq(ev[46],0.01) ); assert( eq(ev[47],0.97) ); assert( ei[0] == 0 ); assert( ei[1] == 1 ); assert( ei[2] == 2 ); assert( ei[3] == 3 ); assert( ei[4] == 4 ); assert( ei[5] == 5 ); assert( ei[6] == 6 ); assert( ei[7] == 0 ); assert( ei[8] == 1 ); assert( ei[9] == 2 ); assert( ei[10] == 3 ); assert( ei[11] == 4 ); assert( ei[12] == 5 ); assert( ei[13] == 6 ); assert( ei[14] == 0 ); assert( ei[15] == 1 ); assert( ei[16] == 2 ); assert( ei[17] == 3 ); assert( ei[18] == 4 ); assert( ei[19] == 5 ); assert( ei[20] == 6 ); assert( ei[21] == 0 ); assert( ei[22] == 1 ); assert( ei[23] == 2 ); assert( ei[24] == 3 ); assert( ei[25] == 4 ); assert( ei[26] == 5 ); assert( ei[27] == 0 ); assert( ei[28] == 1 ); assert( ei[29] == 2 ); assert( ei[30] == 3 ); assert( ei[31] == 4 ); assert( ei[32] == 0 ); assert( ei[33] == 1 ); assert( ei[34] == 4 ); assert( ei[35] == 0 ); assert( ei[36] == 1 ); assert( ei[37] == 2 ); assert( ei[38] == 3 ); assert( ei[39] == 4 ); assert( ei[40] == 5 ); assert( ei[41] == 0 ); assert( ei[42] == 1 ); assert( ei[43] == 2 ); assert( ei[44] == 3 ); assert( ei[45] == 4 ); assert( ei[46] == 5 ); assert( ei[47] == 6 ); assert( mi[0] == 0 ); assert( mi[1] == 7 ); assert( mi[2] == 14 ); assert( mi[3] == 21 ); assert( mi[4] == 27 ); assert( mi[5] == 32 ); assert( mi[6] == 35 ); assert( mi[7] == 41 ); assert( mi[8] == 48 ); } #endif } } CoinMP-1.8.3/CoinUtils/test/Makefile.in0000644000175000017500000004771312506047363016273 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ noinst_PROGRAMS = unitTest$(EXEEXT) @COIN_HAS_SAMPLE_TRUE@am__append_1 = -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` @COIN_HAS_NETLIB_TRUE@am__append_2 = -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testModel=adlittle.mps subdir = test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_coinutils.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) am_unitTest_OBJECTS = CoinLpIOTest.$(OBJEXT) \ CoinDenseVectorTest.$(OBJEXT) CoinErrorTest.$(OBJEXT) \ CoinIndexedVectorTest.$(OBJEXT) \ CoinMessageHandlerTest.$(OBJEXT) CoinModelTest.$(OBJEXT) \ CoinMpsIOTest.$(OBJEXT) CoinPackedMatrixTest.$(OBJEXT) \ CoinPackedVectorTest.$(OBJEXT) \ CoinShallowPackedVectorTest.$(OBJEXT) unitTest.$(OBJEXT) unitTest_OBJECTS = $(am_unitTest_OBJECTS) am__DEPENDENCIES_1 = 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(unitTest_SOURCES) DIST_SOURCES = $(unitTest_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BLAS_CFLAGS = @BLAS_CFLAGS@ BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ BLAS_DATA = @BLAS_DATA@ BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ BLAS_LIBS = @BLAS_LIBS@ BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILSLIB_CFLAGS = @COINUTILSLIB_CFLAGS@ COINUTILSLIB_CFLAGS_INSTALLED = @COINUTILSLIB_CFLAGS_INSTALLED@ COINUTILSLIB_DEPENDENCIES = @COINUTILSLIB_DEPENDENCIES@ COINUTILSLIB_LIBS = @COINUTILSLIB_LIBS@ COINUTILSLIB_LIBS_INSTALLED = @COINUTILSLIB_LIBS_INSTALLED@ COINUTILSLIB_PCLIBS = @COINUTILSLIB_PCLIBS@ COINUTILSLIB_PCREQUIRES = @COINUTILSLIB_PCREQUIRES@ COINUTILS_SVN_REV = @COINUTILS_SVN_REV@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_LAPACK_FALSE = @COIN_HAS_LAPACK_FALSE@ COIN_HAS_LAPACK_TRUE = @COIN_HAS_LAPACK_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_ZLIB_FALSE = @COIN_HAS_ZLIB_FALSE@ COIN_HAS_ZLIB_TRUE = @COIN_HAS_ZLIB_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FLIBS = @FLIBS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_CFLAGS = @LAPACK_CFLAGS@ LAPACK_CFLAGS_INSTALLED = @LAPACK_CFLAGS_INSTALLED@ LAPACK_DATA = @LAPACK_DATA@ LAPACK_DATA_INSTALLED = @LAPACK_DATA_INSTALLED@ LAPACK_DEPENDENCIES = @LAPACK_DEPENDENCIES@ LAPACK_LIBS = @LAPACK_LIBS@ LAPACK_LIBS_INSTALLED = @LAPACK_LIBS_INSTALLED@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MPIF77 = @MPIF77@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OPT_FFLAGS = @OPT_FFLAGS@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign unitTest_SOURCES = \ CoinLpIOTest.cpp \ CoinDenseVectorTest.cpp \ CoinErrorTest.cpp \ CoinIndexedVectorTest.cpp \ CoinMessageHandlerTest.cpp \ CoinModelTest.cpp \ CoinMpsIOTest.cpp \ CoinPackedMatrixTest.cpp \ CoinPackedVectorTest.cpp \ CoinShallowPackedVectorTest.cpp \ unitTest.cpp # List libraries to link into binary unitTest_LDADD = ../src/libCoinUtils.la $(COINUTILSLIB_LIBS) # Dependencies of binaries are mostly the same as given in LDADD, but with -l and -L removed unitTest_DEPENDENCIES = ../src/libCoinUtils.la $(COINUTILSLIB_DEPENDENCIES) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Cygwin AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src unittestflags = $(am__append_1) $(am__append_2) ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = \ byColumn.mps byRow.mps CoinMpsIoTest.mps string.mps all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 test/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign test/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done unitTest$(EXEEXT): $(unitTest_OBJECTS) $(unitTest_DEPENDENCIES) @rm -f unitTest$(EXEEXT) $(CXXLINK) $(unitTest_LDFLAGS) $(unitTest_OBJECTS) $(unitTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinDenseVectorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinErrorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinIndexedVectorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinLpIOTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinMessageHandlerTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinModelTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinMpsIOTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPackedMatrixTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPackedVectorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinShallowPackedVectorTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unitTest.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 $(PROGRAMS) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: 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: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS 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-exec \ install-exec-am install-info install-info-am install-man \ 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 \ uninstall-info-am test: unitTest$(EXEEXT) ./unitTest$(EXEEXT) $(unittestflags) .PHONY: test # 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: CoinMP-1.8.3/CoinUtils/test/Makefile.am0000644000175000017500000000406712167532767016267 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1600 2013-07-11 13:41:11Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # unitTest for CoinUtils # ######################################################################## noinst_PROGRAMS = unitTest unitTest_SOURCES = \ CoinLpIOTest.cpp \ CoinDenseVectorTest.cpp \ CoinErrorTest.cpp \ CoinIndexedVectorTest.cpp \ CoinMessageHandlerTest.cpp \ CoinModelTest.cpp \ CoinMpsIOTest.cpp \ CoinPackedMatrixTest.cpp \ CoinPackedVectorTest.cpp \ CoinShallowPackedVectorTest.cpp \ unitTest.cpp # List libraries to link into binary unitTest_LDADD = ../src/libCoinUtils.la $(COINUTILSLIB_LIBS) # Dependencies of binaries are mostly the same as given in LDADD, but with -l and -L removed unitTest_DEPENDENCIES = ../src/libCoinUtils.la $(COINUTILSLIB_DEPENDENCIES) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Cygwin AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src unittestflags = if COIN_HAS_SAMPLE unittestflags += -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` endif if COIN_HAS_NETLIB unittestflags += -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testModel=adlittle.mps endif test: unitTest$(EXEEXT) ./unitTest$(EXEEXT) $(unittestflags) .PHONY: test ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = \ byColumn.mps byRow.mps CoinMpsIoTest.mps string.mps CoinMP-1.8.3/CoinUtils/test/plan.mod0000644000175000017500000000170511316446223015644 0ustar renerene/* plan.mod (taken from GLPK 4.41 distribution) */ var bin1, >= 0, <= 200; var bin2, >= 0, <= 2500; var bin3, >= 400, <= 800; var bin4, >= 100, <= 700; var bin5, >= 0, <= 1500; var alum, >= 0; var silicon, >= 0; minimize value: .03 * bin1 + .08 * bin2 + .17 * bin3 + .12 * bin4 + .15 * bin5 + .21 * alum + .38 * silicon; subject to yield: bin1 + bin2 + bin3 + bin4 + bin5 + alum + silicon = 2000; fe: .15 * bin1 + .04 * bin2 + .02 * bin3 + .04 * bin4 + .02 * bin5 + .01 * alum + .03 * silicon <= 60; cu: .03 * bin1 + .05 * bin2 + .08 * bin3 + .02 * bin4 + .06 * bin5 + .01 * alum <= 100; mn: .02 * bin1 + .04 * bin2 + .01 * bin3 + .02 * bin4 + .02 * bin5 <= 40; mg: .02 * bin1 + .03 * bin2 + .01 * bin5 <= 30; al: .70 * bin1 + .75 * bin2 + .80 * bin3 + .75 * bin4 + .80 * bin5 + .97 * alum >= 1500; si: 250 <= .02 * bin1 + .06 * bin2 + .08 * bin3 + .12 * bin4 + .02 * bin5 + .01 * alum + .97 * silicon <= 300; end; /* eof */ CoinMP-1.8.3/CoinUtils/test/unitTest.cpp0000644000175000017500000001512112167532767016547 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // Test individual classes or groups of classes #ifdef NDEBUG #undef NDEBUG #endif #include #include #include "CoinPragma.hpp" #include "CoinFinite.hpp" #include "CoinError.hpp" #include "CoinHelperFunctions.hpp" #include "CoinSort.hpp" #include "CoinShallowPackedVector.hpp" #include "CoinPackedVector.hpp" #include "CoinDenseVector.hpp" #include "CoinIndexedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinMpsIO.hpp" #include "CoinLpIO.hpp" #include "CoinMessageHandler.hpp" void CoinModelUnitTest(const std::string & mpsDir, const std::string & netlibDir, const std::string & testModel); // Function Prototypes. Function definitions is in this file. void testingMessage( const char * const msg ); //---------------------------------------------------------------- // unitTest [-mpsDir=V1] [-netlibDir=V2] [-testModel=V3] // // where (unix defaults): // -mpsDir: directory containing mps test files // Default value V1="../../Data/Sample" // -netlibDir: directory containing netlib files // Default value V2="../../Data/Netlib" // -testModel: name of model in netlibdir for testing CoinModel // Default value V3="25fv47.mps" // // All parameters are optional. //---------------------------------------------------------------- int main (int argc, const char *argv[]) { /* Set default location for Data directory, assuming traditional package layout. */ const char dirsep = CoinFindDirSeparator(); std::string dataDir ; if (dirsep == '/') dataDir = "../../Data" ; else dataDir = "..\\..\\Data" ; # ifdef COIN_MSVS // Visual Studio builds are deeper. dataDir = "..\\..\\"+dataDir ; # endif // define valid parameter keywords std::set definedKeyWords; // Really should be sampleDir, but let's not rock the boat. definedKeyWords.insert("-mpsDir"); // Directory for netlib problems. definedKeyWords.insert("-netlibDir"); // Allow for large named model for CoinModel definedKeyWords.insert("-testModel"); /* Set parameter defaults. */ std::string mpsDir = dataDir + dirsep + "Sample" + dirsep ; std::string netlibDir = dataDir + dirsep + "Netlib" + dirsep ; std::string testModel = "p0033.mps" ; /* Process command line parameters. Assume params of the form 'keyword' or 'keyword=value'. */ std::map parms; for (int i = 1 ; i < argc ; i++) { std::string parm(argv[i]); std::string key,value; std::string::size_type eqPos = parm.find('='); if (eqPos == std::string::npos) { key = parm ; value = "" ; } else { key = parm.substr(0,eqPos) ; value = parm.substr(eqPos+1) ; } /* Check for valid keyword. Print help and exit on failure. */ if (definedKeyWords.find(key) == definedKeyWords.end()) { std::cerr << "Undefined parameter \"" << key << "\".\n" << "Correct usage: \n" << " unitTest [-mpsDir=V1] [-netlibDir=V2] [-testModel=V3]\n" << "where:\n" << " -mpsDir: directory containing mps test files\n" << " Default value V1=\"" << mpsDir << "\"\n" << " -netlibDir: directory containing netlib files\n" << " Default value V2=\"" << netlibDir << "\"\n" << " -testModel: name of model testing CoinModel\n" << " Default value V3=\"" << testModel << "\"\n"; return 1 ; } parms[key] = value ; } // Deal with any values given on the command line if (parms.find("-mpsDir") != parms.end()) mpsDir = parms["-mpsDir"] + dirsep; if (parms.find("-netlibDir") != parms.end()) netlibDir = parms["-netlibDir"] + dirsep; if (parms.find("-testModel") != parms.end()) testModel = parms["-testModel"] ; bool allOK = true ; // *FIXME* : these tests should be written... // testingMessage( "Testing CoinHelperFunctions\n" ); // CoinHelperFunctionsUnitTest(); // testingMessage( "Testing CoinSort\n" ); // tripleCompareUnitTest(); /* Check that finite and isnan are working. */ double finiteVal = 1.0 ; double zero = 0.0 ; double checkVal ; testingMessage( "Testing CoinFinite ... " ) ; # ifdef COIN_C_FINITE checkVal = finiteVal/zero ; # else checkVal = COIN_DBL_MAX ; # endif testingMessage( " finite value: " ) ; if (CoinFinite(finiteVal)) { testingMessage( "ok" ) ; } else { allOK = false ; testingMessage( "ERROR" ) ; } testingMessage( "; infinite value: " ) ; if (!CoinFinite(checkVal)) { testingMessage( "ok.\n" ) ; } else { allOK = false ; testingMessage( "ERROR.\n" ) ; } # ifdef COIN_C_ISNAN testingMessage( "Testing CoinIsnan ... " ) ; testingMessage( " finite value: " ) ; if (!CoinIsnan(finiteVal)) { testingMessage( "ok" ) ; } else { allOK = false ; testingMessage( "ERROR" ) ; } testingMessage( "; NaN value: " ) ; checkVal = checkVal/checkVal ; if (CoinIsnan(checkVal)) { testingMessage( "ok.\n" ) ; } else { allOK = false ; testingMessage( "ERROR.\n" ) ; } # else allOK = false ; testingMessage( "ERROR: No functional CoinIsnan.\n" ) ; # endif testingMessage( "Testing CoinModel\n" ); CoinModelUnitTest(mpsDir,netlibDir,testModel); testingMessage( "Testing CoinError\n" ); CoinErrorUnitTest(); testingMessage( "Testing CoinShallowPackedVector\n" ); CoinShallowPackedVectorUnitTest(); testingMessage( "Testing CoinPackedVector\n" ); CoinPackedVectorUnitTest(); testingMessage( "Testing CoinIndexedVector\n" ); CoinIndexedVectorUnitTest(); testingMessage( "Testing CoinPackedMatrix\n" ); CoinPackedMatrixUnitTest(); // At moment CoinDenseVector is not compiling with MS V C++ V6 #if 1 testingMessage( "Testing CoinDenseVector\n" ); //CoinDenseVectorUnitTest(0); CoinDenseVectorUnitTest(0.0); CoinDenseVectorUnitTest(0.0f); #endif testingMessage( "Testing CoinMpsIO\n" ); CoinMpsIOUnitTest(mpsDir); testingMessage( "Testing CoinLpIO\n" ); CoinLpIOUnitTest(mpsDir); testingMessage( "Testing CoinMessageHandler\n" ); if (!CoinMessageHandlerUnitTest()) { allOK = false ; } if (allOK) { testingMessage( "All tests completed successfully.\n" ); return (0) ; } else { testingMessage( "\nERROR: " ) ; testingMessage( "Errors occurred during testing; please check the output.\n\n"); return (1) ; } } // Display message on stdout and stderr void testingMessage( const char * const msg ) { std::cerr < #include "CoinError.hpp" void CoinErrorUnitTest() { // Test default constructor { CoinError r; assert( r.message_=="" ); assert( r.method_=="" ); assert( r.class_=="" ); } // Test alternate constructor and get method CoinError rhs; { CoinError a("msg","me.hpp","cl"); assert( a.message()=="msg" ); assert( a.methodName()=="me.hpp" ); assert( a.className()=="cl" ); // Test copy constructor { CoinError c(a); assert( c.message()=="msg" ); assert( c.methodName()=="me.hpp" ); assert( c.className()=="cl" ); } // Test assignment { CoinError a1("msg1","meth1","cl1"); assert( a1.message()=="msg1" ); assert( a1.methodName()=="meth1" ); assert( a1.className()=="cl1" ); rhs = a1; } } assert( rhs.message()=="msg1" ); assert( rhs.methodName()=="meth1" ); assert( rhs.className()=="cl1" ); } CoinMP-1.8.3/CoinUtils/test/CoinLpIOTest.cpp0000755000175000017500000003253312367240244017201 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinLpIO.hpp" #include "CoinFloatEqual.hpp" #include //############################################################################# //-------------------------------------------------------------------------- // test import methods void CoinLpIOUnitTest(const std::string& lpDir) { // Test default constructor { CoinLpIO m; assert( m.rowsense_ == NULL ); assert( m.rhs_ == NULL ); assert( m.rowrange_ == NULL ); assert( m.matrixByRow_ == NULL ); assert( m.matrixByColumn_ == NULL ); assert( m.integerType_ == NULL); assert( m.fileName_ == NULL ); assert( !strcmp( m.problemName_ , "")); assert( m.objName_[0] == NULL); } { CoinRelFltEq eq; CoinLpIO m; std::string fn = lpDir + "exmip1.lp"; m.readLp(fn.c_str()); assert( !strcmp( m.problemName_ , "")); assert( !strcmp( m.objName_[0] , "OBJ")); // Test language and re-use m.newLanguage(CoinMessages::it); m.messageHandler()->setPrefix(false); m.readLp(fn.c_str()); // Test copy constructor and assignment operator { CoinLpIO lhs; { CoinLpIO im(m); CoinLpIO imC1(im); assert( imC1.getNumCols() == im.getNumCols() ); assert( imC1.getNumRows() == im.getNumRows() ); for (int i = 0; i < im.numberHash_[0]; i++) { // check the row name assert(!strcmp(im.names_[0][i], imC1.names_[0][i])); } for (int i = 0; i < im.numberHash_[1]; i++) { // check the column name assert(!strcmp(im.names_[1][i], imC1.names_[1][i])); } for (int i = 0; i < im.maxHash_[0]; i++) { // check hash value for row name assert(im.hash_[0][i].next == imC1.hash_[0][i].next); assert(im.hash_[0][i].index == imC1.hash_[0][i].index); } for (int i = 0; i < im.maxHash_[1]; i++) { // check hash value for column name assert(im.hash_[1][i].next == imC1.hash_[1][i].next); assert(im.hash_[1][i].index == imC1.hash_[1][i].index); } CoinLpIO imC2(im); assert( imC2.getNumCols() == im.getNumCols() ); assert( imC2.getNumRows() == im.getNumRows() ); lhs = imC2; assert( lhs.getNumCols() == imC2.getNumCols() ); assert( lhs.getNumRows() == imC2.getNumRows() ); for (int i = 0; i < imC2.numberHash_[0]; i++) { // check the row name assert(!strcmp(lhs.names_[0][i], imC2.names_[0][i])); } for (int i = 0; i < imC2.numberHash_[1]; i++) { // check the column name assert(!strcmp(lhs.names_[1][i], imC2.names_[1][i])); } for (int i = 0; i < imC2.maxHash_[0]; i++) { // check hash value for row name assert(lhs.hash_[0][i].next == imC2.hash_[0][i].next); assert(lhs.hash_[0][i].index == imC2.hash_[0][i].index); } for (int i = 0; i < im.maxHash_[1]; i++) { // check hash value for column name assert(lhs.hash_[1][i].next == imC2.hash_[1][i].next); assert(lhs.hash_[1][i].index == imC2.hash_[1][i].index); } } // Test that lhs has correct values even though rhs has gone out of scope assert( lhs.getNumCols() == m.getNumCols() ); assert( lhs.getNumRows() == m.getNumRows() ); } { CoinLpIO dumSi(m); int nc = dumSi.getNumCols(); int nr = dumSi.getNumRows(); const double* cl = dumSi.getColLower(); const double* cu = dumSi.getColUpper(); const double* rl = dumSi.getRowLower(); const double* ru = dumSi.getRowUpper(); assert( nc == 10 ); assert( nr == 5 ); assert( eq(cl[0], 2.5) ); assert( eq(cl[1], 0.5) ); assert( eq(cu[1], 4) ); assert( eq(cu[2], 4.3) ); assert( eq(rl[0], 2.5) ); assert( eq(rl[4], 15.0) ); assert( eq(ru[1], 2.1) ); assert( eq(ru[4], 15.0) ); assert( !eq(cl[3], 1.2345) ); assert( !eq(cu[4], 10.2345) ); assert( eq( dumSi.getObjCoefficients()[0], 1.0) ); assert( eq( dumSi.getObjCoefficients()[1], 2.0) ); assert( eq( dumSi.getObjCoefficients()[2], -1.0) ); assert( eq( dumSi.getObjCoefficients()[3], 0.0) ); assert( eq( dumSi.getObjCoefficients()[4], 0.0) ); assert( eq( dumSi.getObjCoefficients()[5], 0.0) ); assert( eq( dumSi.getObjCoefficients()[6], 0.0) ); assert( eq( dumSi.getObjCoefficients()[7], 0.0) ); assert( eq( dumSi.getObjCoefficients()[8], 0.0) ); assert( eq( dumSi.getObjCoefficients()[9], 0.0) ); dumSi.writeLp("CoinLpIoTest.lp", true); } // Read just written file { CoinLpIO dumSi; dumSi.readLp("CoinLpIoTest.lp"); int nc = dumSi.getNumCols(); int nr = dumSi.getNumRows(); const double* cl = dumSi.getColLower(); const double* cu = dumSi.getColUpper(); const double* rl = dumSi.getRowLower(); const double* ru = dumSi.getRowUpper(); assert( nc == 10 ); assert( nr == 5 ); assert( eq(cl[0], 2.5) ); assert( eq(cl[1], 0.5) ); assert( eq(cu[1], 4) ); assert( eq(cu[2], 4.3) ); assert( eq(rl[0], 2.5) ); assert( eq(rl[4], 15.0) ); assert( eq(ru[1], 2.1) ); assert( eq(ru[4], 15.0) ); assert( !eq(cl[3], 1.2345) ); assert( !eq(cu[4], 10.2345) ); assert( eq( dumSi.getObjCoefficients()[0], 1.0) ); assert( eq( dumSi.getObjCoefficients()[1], 2.0) ); assert( eq( dumSi.getObjCoefficients()[2], -1.0) ); assert( eq( dumSi.getObjCoefficients()[3], 0.0) ); assert( eq( dumSi.getObjCoefficients()[4], 0.0) ); assert( eq( dumSi.getObjCoefficients()[5], 0.0) ); assert( eq( dumSi.getObjCoefficients()[6], 0.0) ); assert( eq( dumSi.getObjCoefficients()[7], 0.0) ); } // Test matrixByRow method { const CoinLpIO si(m); const CoinPackedMatrix* smP = si.getMatrixByRow(); CoinRelFltEq eq; const double* ev = smP->getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 1.0) ); assert( eq(ev[2], -2.0) ); assert( eq(ev[3], -1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[5], 2.0) ); assert( eq(ev[6], 1.1) ); assert( eq(ev[7], 1.0) ); assert( eq(ev[8], 1.0) ); assert( eq(ev[9], 2.8) ); assert( eq(ev[10], -1.2) ); assert( eq(ev[11], -1.0 ) ); assert( eq(ev[12], 5.6) ); assert( eq(ev[13], 1.0) ); assert( eq(ev[14], 1.9) ); assert( eq(ev[15], -1.0) ); const CoinBigIndex* mi = smP->getVectorStarts(); assert( mi[0] == 0 ); assert( mi[1] == 5 ); assert( mi[2] == 7 ); assert( mi[3] == 9 ); assert( mi[4] == 12 ); assert( mi[5] == 16 ); const int* ei = smP->getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 3 ); assert( ei[2] == 4 ); assert( ei[3] == 1 ); assert( ei[4] == 2 ); assert( ei[5] == 3 ); assert( ei[6] == 5 ); assert( ei[7] == 5 ); assert( ei[8] == 6 ); assert( ei[9] == 4 ); assert( ei[10] == 7 ); assert( ei[11] == 8 ); assert( ei[12] == 0 ); assert( ei[13] == 1 ); assert( ei[14] == 2 ); assert( ei[15] == 9 ); assert( smP->getMajorDim() == 5 ); assert( smP->getNumElements() == 16 ); } // Test matrixByCol method { const CoinLpIO si(m); const CoinPackedMatrix* smP = si.getMatrixByCol(); CoinRelFltEq eq; const double* ev = smP->getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 5.6) ); assert( eq(ev[2], -1.0) ); assert( eq(ev[3], 1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[5], 1.9) ); assert( eq(ev[6], 1.0) ); assert( eq(ev[7], 2.0) ); assert( eq(ev[8], -2.0) ); assert( eq(ev[9], 2.8) ); assert( eq(ev[10], 1.1) ); assert( eq(ev[11], 1.0) ); assert( eq(ev[12], 1.0) ); assert( eq(ev[13], -1.2) ); assert( eq(ev[14], -1.0) ); assert( eq(ev[15], -1.0) ); const CoinBigIndex* mi = smP->getVectorStarts(); assert( mi[0] == 0 ); assert( mi[1] == 2 ); assert( mi[2] == 4 ); assert( mi[3] == 6 ); assert( mi[4] == 8 ); assert( mi[5] == 10 ); assert( mi[6] == 12 ); assert( mi[7] == 13 ); assert( mi[8] == 14 ); assert( mi[9] == 15 ); assert( mi[10] == 16 ); const int* ei = smP->getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 4 ); assert( ei[2] == 0 ); assert( ei[3] == 4 ); assert( ei[4] == 0 ); assert( ei[5] == 4 ); assert( ei[6] == 0 ); assert( ei[7] == 1 ); assert( ei[8] == 0 ); assert( ei[9] == 3 ); assert( ei[10] == 1 ); assert( ei[11] == 2 ); assert( ei[12] == 2 ); assert( ei[13] == 3 ); assert( ei[14] == 3 ); assert( ei[15] == 4 ); assert( smP->getMajorDim() == 10 ); assert( smP->getNumElements() == 16 ); assert( smP->getSizeVectorStarts() == 11 ); assert( smP->getMinorDim() == 5 ); } //-------------- // Test rowsense, rhs, rowrange, matrixByRow { CoinLpIO lhs; { assert( lhs.rowrange_ == NULL ); assert( lhs.rowsense_ == NULL ); assert( lhs.rhs_ == NULL ); assert( lhs.matrixByColumn_ == NULL ); CoinLpIO siC1(m); assert( siC1.rowrange_ != NULL ); assert( siC1.rowsense_ != NULL ); assert( siC1.rhs_ != NULL ); assert( siC1.matrixByRow_ != NULL ); const char* siC1rs = siC1.getRowSense(); assert( siC1rs[0] == 'G' ); assert( siC1rs[1] == 'L' ); assert( siC1rs[2] == 'E' ); assert( siC1rs[3] == 'E' ); assert( siC1rs[4] == 'E' ); const double* siC1rhs = siC1.getRightHandSide(); assert( eq(siC1rhs[0], 2.5) ); assert( eq(siC1rhs[1], 2.1) ); assert( eq(siC1rhs[2], 4.0) ); assert( eq(siC1rhs[3], 1.8) ); assert( eq(siC1rhs[4], 15.) ); const double* siC1rr = siC1.getRowRange(); assert( eq(siC1rr[0], 0.0) ); assert( eq(siC1rr[1], 0.0) ); assert( eq(siC1rr[2], 0.0) ); assert( eq(siC1rr[3], 0.0) ); assert( eq(siC1rr[4], 0.0) ); const CoinPackedMatrix* siC1mbr = siC1.getMatrixByRow(); assert( siC1mbr != NULL ); const double* ev = siC1mbr->getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 1.0) ); assert( eq(ev[2], -2.0) ); assert( eq(ev[3], -1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[5], 2.0) ); assert( eq(ev[6], 1.1) ); assert( eq(ev[7], 1.0) ); assert( eq(ev[8], 1.0) ); assert( eq(ev[9], 2.8) ); assert( eq(ev[10], -1.2) ); assert( eq(ev[11], -1.0) ); assert( eq(ev[12], 5.6) ); assert( eq(ev[13], 1.0) ); assert( eq(ev[14], 1.9) ); assert( eq(ev[15], -1.0) ); const CoinBigIndex* mi = siC1mbr->getVectorStarts(); assert( mi[0] == 0 ); assert( mi[1] == 5 ); assert( mi[2] == 7 ); assert( mi[3] == 9 ); assert( mi[4] == 12 ); assert( mi[5] == 16 ); const int* ei = siC1mbr->getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 3 ); assert( ei[2] == 4 ); assert( ei[3] == 1 ); assert( ei[4] == 2 ); assert( ei[5] == 3 ); assert( ei[6] == 5 ); assert( ei[7] == 5 ); assert( ei[8] == 6 ); assert( ei[9] == 4 ); assert( ei[10] == 7 ); assert( ei[11] == 8 ); assert( ei[12] == 0 ); assert( ei[13] == 1 ); assert( ei[14] == 2 ); assert( ei[15] == 9 ); assert( siC1mbr->getMajorDim() == 5 ); assert( siC1mbr->getNumElements() == 16 ); assert( siC1rs == siC1.getRowSense() ); assert( siC1rhs == siC1.getRightHandSide() ); assert( siC1rr == siC1.getRowRange() ); } } } } CoinMP-1.8.3/CoinUtils/test/CoinMessageHandlerTest.cpp0000644000175000017500000002304112130031043021226 0ustar renerene// Copyright (c) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* A brief test of CoinMessageHandler. Tests that we can print basic messages, and checks that we can handle messages with parts. Does a few more subtle tests involving cloning and handlers with no associated messages. Does not attempt to test any of the various enbryonic features. */ #include "CoinPragma.hpp" #include "CoinMessageHandler.hpp" #include namespace { // begin file-local namespace /* Define a set of test messages. */ enum COIN_TestMessage { COIN_TST_NOFIELDS, COIN_TST_INT, COIN_TST_DBL, COIN_TST_DBLFMT, COIN_TST_CHAR, COIN_TST_STRING, COIN_TST_MULTIPART, COIN_TST_NOCODES, COIN_TST_END } ; /* Convenient structure for doing static initialisation. Essentially, we want something that'll allow us to set up an array of structures with the information required by CoinOneMessage. Then we can easily walk the array, create a CoinOneMessage structure for each message, and add each message to a CoinMessages structure. */ typedef struct { COIN_TestMessage internalNumber; int externalNumber; char detail; const char * message; } MsgDefn ; MsgDefn us_tstmsgs[] = { {COIN_TST_NOFIELDS,1,1,"This message has no parts and no fields."}, {COIN_TST_INT,3,1,"This message has an integer field: (%d)"}, {COIN_TST_DBL,4,1,"This message has a double field: (%g)"}, {COIN_TST_DBLFMT,4,1, "This message has an explicit precision .3: (%.3g)"}, {COIN_TST_CHAR,5,1,"This message has a char field: (%c)"}, {COIN_TST_STRING,6,1,"This message has a string field: (%s)"}, {COIN_TST_MULTIPART,7,1, "Prefix%? Part 1%? Part 2 with integer in hex %#.4x%? Part 3%? suffix."}, {COIN_TST_NOCODES,8,1,""}, {COIN_TST_END,7,1,"This is the dummy end marker."} } ; /* Tests that don't use formatted messages. */ void testsWithoutMessages (int &errs) { CoinMessageHandler hdl ; /* format_ must be null in order for on-the-fly message construction to work properly. */ hdl.message() << "This should print if the constructor sets format_ to null." << CoinMessageEol ; /* Log level should have no effect by default, so set it to 0 to prove the point. */ hdl.message() << "By default, the log level has no effect for on-the-fly messages." << CoinMessageEol ; hdl.setLogLevel(0) ; if (hdl.logLevel() != 0) { std::cout << "Cannot set/get log level of 0!" << std::endl ; errs++ ; } hdl.message() << "Log level is now" << hdl.logLevel() << "." << CoinMessageEol ; /* But we can specify a log level and it will be effective. What's more, each message is completely independent, so the default behaviour should return after an explicit log level suppressed printing. */ hdl.message() << "But we can specify a log level and have it take effect." << CoinMessageEol ; hdl.message(1) << "This message should not print!" << CoinMessageEol ; hdl.message() << "If you saw a message that said 'should not print', there's a problem." << CoinMessageEol ; /* This next sequence exposed a subtle bug in cloning. Failure here may well cause a core dump. Here's the scenario: Since we haven't used any messages, rhs.format_ is null and rhs.currentMessage_ is set to the default for CoinOneMessage, which sets the format string to the null string "\0". Cloning assumed that rhs.format_ was a pointer into the format string from currentMessage_, and proceeded to set up format_ in the clone to be a pointer into the cloned currentMessage_, allowing for the fact that we might be somewhere in the middle of the message at the time of cloning. Net result was that format_ was non-null in the clone, but god only knows where it pointed to. When the code tried to write to *format_, the result was a core dump. */ hdl.message() << "A core dump here indicates a cloning failure." << CoinMessageEol ; CoinMessageHandler hdlClone(hdl) ; hdlClone.message() << "This should print if cloning sets format_ to null." << CoinMessageEol ; return ; } /* Basic functionality for printing messages. Check that supported parameter types work, and that we can selectively suppress portions of a message. */ void basicTestsWithMessages (const CoinMessages &testMessages, int &errs) { CoinMessageHandler hdl ; hdl.setLogLevel(1) ; if (hdl.logLevel() != 1) { std::cout << "Cannot set/get log level of 1!" << std::endl ; errs++ ; } /* Simple tests of one piece messages. */ hdl.message(COIN_TST_NOFIELDS,testMessages) << CoinMessageEol ; hdl.message(COIN_TST_INT,testMessages) << 42 << CoinMessageEol ; hdl.message(COIN_TST_DBL,testMessages) << (42.42+1.0/7.0) << CoinMessageEol ; std::cout << "Changing to 10 significant digits." << std::endl ; int savePrecision = hdl.precision() ; hdl.setPrecision(10) ; hdl.message(COIN_TST_DBL,testMessages) << (42.42+1.0/7.0) << CoinMessageEol ; std::cout << "And back to " << savePrecision << " significant digits." << std::endl ; hdl.setPrecision(savePrecision) ; hdl.message(COIN_TST_DBL,testMessages) << (42.42+1.0/7.0) << CoinMessageEol ; hdl.message(COIN_TST_DBLFMT,testMessages) << (42.42+1.0/7.0) << CoinMessageEol ; hdl.message(COIN_TST_CHAR,testMessages) << 'w' << CoinMessageEol ; hdl.message(COIN_TST_STRING,testMessages) << "forty-two" << CoinMessageEol ; /* A multipart message, consisting of prefix, three optional parts, and a suffix. Note that we need four calls to printing() in order to process the four `%?' codes. */ hdl.message(COIN_TST_MULTIPART,testMessages) ; hdl.printing(true) ; hdl.printing(true) << 42 ; hdl.printing(true) ; hdl.printing(true) << CoinMessageEol ; hdl.message(COIN_TST_MULTIPART,testMessages) ; hdl.printing(false) ; hdl.printing(false) << 42 ; hdl.printing(false) ; hdl.printing(true) << CoinMessageEol ; hdl.message(COIN_TST_MULTIPART,testMessages) ; hdl.printing(true) ; hdl.printing(false) << 42 ; hdl.printing(false) ; hdl.printing(true) << CoinMessageEol ; hdl.message(COIN_TST_MULTIPART,testMessages) ; hdl.printing(false) ; hdl.printing(true) << 42 ; hdl.printing(false) ; hdl.printing(true) << CoinMessageEol ; hdl.message(COIN_TST_MULTIPART,testMessages) ; hdl.printing(false) ; hdl.printing(false) << 42 ; hdl.printing(true) ; hdl.printing(true) << CoinMessageEol ; /* Construct a message from scratch given an empty message. Parameters are printed with default format codes. */ hdl.message(COIN_TST_NOCODES,testMessages) ; hdl.message() << "Standardised prefix, free form remainder:" ; hdl.message() << "An int" << 42 << "A double" << 4.2 << "a new line" << CoinMessageNewline << "and done." << CoinMessageEol ; /* Construct a message from scratch given nothing at all. hdl.finish is equivalent to CoinMessageEol (more accurately, processing CoinMessagEol consists of a call to finish). */ hdl.message() << "No standardised prefix, free form reminder: integer (" << 42 << ")." ; hdl.finish() ; /* And the transition mechanism, where we just dump the string we're given. It's not possible to augment this message, as printStatus_ is set to 2, which prevents the various operator<< methods from contributing to the output buffer, with the exception of operator<<(CoinMessageMarker). */ hdl.message(27,"Tran","Transition message.",'I') << CoinMessageEol ; return ; } /* More difficult tests. Clone a handler in mid-message. Why? Because we can. */ void advTestsWithMessages (const CoinMessages &testMessages, int &errs) { CoinMessageHandler hdl ; /* A multipart message, consisting of prefix, three optional parts, and a suffix. Note that we need four calls to printing() in order to process the four `%?' codes. */ hdl.message() << "Trying a clone in mid-message." << CoinMessageEol ; hdl.message(COIN_TST_MULTIPART,testMessages) ; hdl.printing(true) ; hdl.printing(true) ; CoinMessageHandler hdl2 ; hdl2 = hdl ; hdl2.message() << 42 ; hdl2.printing(true) ; hdl2.printing(true) << CoinMessageEol ; hdl.message() << 0x42 ; hdl.printing(false) ; hdl.printing(false) << CoinMessageEol ; hdl.message() << "The second copy should be missing Part 3 and suffix." << CoinMessageEol ; return ; } } // end file-local namespace bool CoinMessageHandlerUnitTest () { int errs = 0 ; /* Create a CoinMessages object to hold our messages. */ CoinMessages testMessages(sizeof(us_tstmsgs)/sizeof(MsgDefn)) ; strcpy(testMessages.source_,"Test") ; /* Load with messages. This involves creating successive messages (CoinOneMessage) and loading them into the array. This is the usual copy operation; client is responsible for disposing of the original message (accomplished here by keeping the CoinOneMessage internal to the loop body). */ MsgDefn *msgDef = us_tstmsgs ; while (msgDef->internalNumber != COIN_TST_END) { CoinOneMessage msg(msgDef->externalNumber,msgDef->detail,msgDef->message) ; testMessages.addMessage(msgDef->internalNumber,msg) ; msgDef++ ; } /* Run some tests on a message handler without messages. */ testsWithoutMessages(errs) ; /* Basic tests with messages. */ basicTestsWithMessages(testMessages,errs) ; /* Advanced tests with messages. */ advTestsWithMessages(testMessages,errs) ; /* Did we make it without error? */ if (errs) { std::cout << "ERROR! CoinMessageHandlerTest reports " << errs << " errors." << std::endl ; } else { std::cout << "CoinMessageHandlerTest completed without error." << std::endl ; } return (errs == 0) ; } CoinMP-1.8.3/CoinUtils/test/CoinIndexedVectorTest.cpp0000644000175000017500000003154712017155726021144 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #ifdef NDEBUG #undef NDEBUG // checkClean and checkClear not define #define NO_CHECK_CL #endif #include #include "CoinFinite.hpp" #include "CoinIndexedVector.hpp" #include "CoinShallowPackedVector.hpp" //-------------------------------------------------------------------------- void CoinIndexedVectorUnitTest() { int i; // Test default constructor { CoinIndexedVector r; assert( r.indices_==NULL ); assert( r.elements_==NULL ); assert( r.getNumElements()==0 ); assert( r.capacity_==0); } // Test set and get methods const int ne = 4; int inx[ne] = { 1, 3, 4, 7 }; double el[ne] = { 1.2, 3.4, 5.6, 7.8 }; { CoinIndexedVector r; assert( r.getNumElements()==0 ); // Test setting/getting elements with int* & float* vectors r.setVector( ne, inx, el ); assert( r.getNumElements()==ne ); for ( i=0; i #include "CoinDenseVector.hpp" #include "CoinFloatEqual.hpp" //-------------------------------------------------------------------------- template void CoinDenseVectorUnitTest(T dummy) { // Test default constructor { CoinDenseVector r; assert( r.getElements() == 0 ); assert( r.getNumElements() == 0 ); } const int ne = 4; T el[ne] = { 10, 40, 1, 50 }; // Create vector and set its value CoinDenseVector r(ne,el); // access each element assert( r.getElements()[0]==10. ); assert( r.getElements()[1]==40. ); assert( r.getElements()[2]== 1. ); assert( r.getElements()[3]==50. ); // Test norms etc assert( r.sum() == 10.+40.+1.+50. ); assert( r.oneNorm() == 101.0); // std namespace removed to compile with Microsoft Visual C++ V6 //assert( r.twoNorm() == /*std::*/sqrt(100.0 + 1600. + 1. + 2500.)); CoinRelFltEq eq; assert( eq(r.twoNorm() , /*std::*/sqrt(100.0 + 1600. + 1. + 2500.))); assert( r.infNorm() == 50.); assert(r[0]+r[1]+r[2]+r[3]==101.); // Test for equality CoinDenseVector r1; r1=r; assert( r1.getElements()[0]==10. ); assert( r1.getElements()[1]==40. ); assert( r1.getElements()[2]== 1. ); assert( r1.getElements()[3]==50. ); // Add dense vectors. CoinDenseVector add = r + r1; assert( add[0] == 10.+10. ); assert( add[1] == 40.+40. ); assert( add[2] == 1.+ 1. ); assert( add[3] == 50.+50. ); // Similarly for copy constructor and subtraction and multiplication CoinDenseVector r2(r); CoinDenseVector diff = r - r2; assert(diff.sum() == 0.0); CoinDenseVector mult = r * r2; assert( mult[0] == 10.*10. ); assert( mult[1] == 40.*40. ); assert( mult[2] == 1.* 1. ); assert( mult[3] == 50.*50. ); // and division. CoinDenseVector div = r / r1; assert(div.sum() == 4.0); } template void CoinDenseVectorUnitTest(float); template void CoinDenseVectorUnitTest(double); //template void CoinDenseVectorUnitTest(int); CoinMP-1.8.3/CoinUtils/test/CoinPackedMatrixTest.cpp0000644000175000017500000005036411665060546020756 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinFloatEqual.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" //############################################################################# void CoinPackedMatrixUnitTest() { CoinRelFltEq eq; { // Test construction on empty matrices CoinPackedMatrix m; CoinPackedMatrix lhs = m; CoinPackedMatrix mCopy(m); assert( eq(m.getExtraGap(),0.0) ); assert( eq(lhs.getExtraGap(),0.0) ); assert( eq(mCopy.getExtraGap(),0.0) ); assert( eq(m.getExtraMajor(),0.0) ); assert( eq(lhs.getExtraMajor(),0.0) ); assert( eq(mCopy.getExtraMajor(),0.0) ); assert( m.isColOrdered() ); assert( lhs.isColOrdered() ); assert( mCopy.isColOrdered() ); assert( m.getNumElements() == 0 ); assert( lhs.getNumElements() == 0 ); assert( mCopy.getNumElements() == 0 ); assert( m.getNumCols() == 0 ); assert( lhs.getNumCols() == 0 ); assert( mCopy.getNumCols() == 0 ); assert( m.getNumRows() == 0 ); assert( lhs.getNumRows() == 0 ); assert( mCopy.getNumRows() == 0 ); assert( m.getElements() == 0 ); assert( lhs.getElements() == 0 ); assert( mCopy.getElements() == 0 ); assert( m.getIndices() == 0 ); assert( lhs.getIndices() == 0 ); assert( mCopy.getIndices() == 0 ); assert( m.getSizeVectorStarts()==0 ); assert( lhs.getSizeVectorStarts()==0 ); assert( mCopy.getSizeVectorStarts()==0 ); assert( m.getSizeVectorLengths()==0 ); assert( lhs.getSizeVectorLengths()==0 ); assert( mCopy.getSizeVectorLengths()==0 ); // out as empty matrix still has one start //assert( m.getVectorStarts()==NULL ); //assert( lhs.getVectorStarts()==NULL ); //assert( mCopy.getVectorStarts()==NULL ); assert( m.getVectorLengths()==NULL ); assert( lhs.getVectorLengths()==NULL ); assert( mCopy.getVectorLengths()==NULL ); assert( m.getMajorDim() == 0 ); assert( lhs.getMajorDim() == 0 ); assert( mCopy.getMajorDim() == 0 ); assert( m.getMinorDim() == 0 ); assert( lhs.getMinorDim() == 0 ); assert( mCopy.getMinorDim() == 0 ); } { CoinPackedMatrix * globalP; { /************************************************************************* * Setup data to represent this matrix by rows * * 3x1 + x2 - 2x4 - x5 - x8 * 2x2 + 1.1x3 * x3 + x6 * 2.8x4 -1.2x7 * 5.6x1 + x5 + 1.9x8 * *************************************************************************/ #if 0 // By columns const int minor=5; const int major=8; const int numels=14; const double elemBase[numels]={3., 5.6, 1., 2., 1.1, 1., -2., 2.8, -1., 1., 1., -1.2, -1., 1.9}; const int indBase[numels]={0,4,0,1,1,2,0,3,0,4,2,3,0,4}; const CoinBigIndex startsBase[major+1]={0,2,4,6,8,10,11,12,14}; const int lenBase[major]={2,2,2,2,2,1,1,2}; #else // By rows const int minor=8; const int major=5; const int numels=14; const double elemBase[numels]={3., 1., -2., -1., -1., 2., 1.1, 1., 1., 2.8, -1.2, 5.6, 1., 1.9 }; const int indBase[numels]={0,1,3,4,7,1,2,2,5,3,6,0,4,7}; const CoinBigIndex startsBase[major+1]={0,5,7,9,11,14}; const int lenBase[major]={5,2,2,2,3}; #endif double * elem = new double[numels]; int * ind = new int[numels]; CoinBigIndex * starts = new CoinBigIndex[major+1]; int * lens = new int[major]; std::copy(elemBase,elemBase+numels,elem); std::copy(indBase,indBase+numels,ind); std::copy(startsBase,startsBase+major+1,starts); std::copy(lenBase,lenBase+major,lens); /* Explicitly request gap on this matrix, so we can see it propagate in subsequent copy & assignment. */ CoinPackedMatrix pm(false,minor,major,numels,elem,ind,starts,lens, .25,.25); assert( elem!=NULL ); assert( ind!=NULL ); assert( starts!=NULL ); assert( lens!=NULL ); delete[] elem; delete[] ind; delete[] starts; delete[] lens; assert( eq(pm.getExtraGap(),.25) ); assert( eq(pm.getExtraMajor(),.25) ); assert( !pm.isColOrdered() ); assert( pm.getNumElements()==numels ); assert( pm.getNumCols()==minor ); assert( pm.getNumRows()==major); assert( pm.getSizeVectorStarts()==major+1 ); assert( pm.getSizeVectorLengths()==major ); const double * ev = pm.getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 1.0) ); assert( eq(ev[2], -2.0) ); assert( eq(ev[3], -1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[7], 2.0) ); assert( eq(ev[8], 1.1) ); assert( eq(ev[10], 1.0) ); assert( eq(ev[11], 1.0) ); assert( eq(ev[13], 2.8) ); assert( eq(ev[14], -1.2) ); assert( eq(ev[16], 5.6) ); assert( eq(ev[17], 1.0) ); assert( eq(ev[18], 1.9) ); const CoinBigIndex * mi = pm.getVectorStarts(); assert( mi[0]==0 ); assert( mi[1]==7 ); assert( mi[2]==10 ); assert( mi[3]==13 ); assert( mi[4]==16 ); assert( mi[5]==20 ); const int * vl = pm.getVectorLengths(); assert( vl[0]==5 ); assert( vl[1]==2 ); assert( vl[2]==2 ); assert( vl[3]==2 ); assert( vl[4]==3 ); const int * ei = pm.getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 1 ); assert( ei[2] == 3 ); assert( ei[3] == 4 ); assert( ei[4] == 7 ); assert( ei[7] == 1 ); assert( ei[8] == 2 ); assert( ei[10] == 2 ); assert( ei[11] == 5 ); assert( ei[13] == 3 ); assert( ei[14] == 6 ); assert( ei[16] == 0 ); assert( ei[17] == 4 ); assert( ei[18] == 7 ); assert( pm.getMajorDim() == 5 ); assert( pm.getMinorDim() == 8 ); assert( pm.getNumElements() == 14 ); assert( pm.getSizeVectorStarts()==6 ); { // Test copy constructor CoinPackedMatrix pmC(pm); assert( eq(pmC.getExtraGap(),.25) ); assert( eq(pmC.getExtraMajor(),.25) ); assert( !pmC.isColOrdered() ); assert( pmC.getNumElements()==numels ); assert( pmC.getNumCols()==minor ); assert( pmC.getNumRows()==major); assert( pmC.getSizeVectorStarts()==major+1 ); assert( pmC.getSizeVectorLengths()==major ); // Test that osm has the correct values assert( pm.getElements() != pmC.getElements() ); const double * ev = pmC.getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 1.0) ); assert( eq(ev[2], -2.0) ); assert( eq(ev[3], -1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[7], 2.0) ); assert( eq(ev[8], 1.1) ); assert( eq(ev[10], 1.0) ); assert( eq(ev[11], 1.0) ); assert( eq(ev[13], 2.8) ); assert( eq(ev[14], -1.2) ); assert( eq(ev[16], 5.6) ); assert( eq(ev[17], 1.0) ); assert( eq(ev[18], 1.9) ); assert( pm.getVectorStarts() != pmC.getVectorStarts() ); const CoinBigIndex * mi = pmC.getVectorStarts(); assert( mi[0]==0 ); assert( mi[1]==7 ); assert( mi[2]==10 ); assert( mi[3]==13 ); assert( mi[4]==16 ); assert( mi[5]==20 ); assert( pm.getVectorLengths() != pmC.getVectorLengths() ); const int * vl = pmC.getVectorLengths(); assert( vl[0]==5 ); assert( vl[1]==2 ); assert( vl[2]==2 ); assert( vl[3]==2 ); assert( vl[4]==3 ); assert( pm.getIndices() != pmC.getIndices() ); const int * ei = pmC.getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 1 ); assert( ei[2] == 3 ); assert( ei[3] == 4 ); assert( ei[4] == 7 ); assert( ei[7] == 1 ); assert( ei[8] == 2 ); assert( ei[10] == 2 ); assert( ei[11] == 5 ); assert( ei[13] == 3 ); assert( ei[14] == 6 ); assert( ei[16] == 0 ); assert( ei[17] == 4 ); assert( ei[18] == 7 ); assert( pmC.isEquivalent(pm) ); // Test assignment { CoinPackedMatrix pmA; // Gap should be 0.0 assert( eq(pmA.getExtraGap(),0.0) ); assert( eq(pmA.getExtraMajor(),0.0) ); pmA = pm; assert( eq(pmA.getExtraGap(),0.25) ); assert( eq(pmA.getExtraMajor(),0.25) ); assert( !pmA.isColOrdered() ); assert( pmA.getNumElements()==numels ); assert( pmA.getNumCols()==minor ); assert( pmA.getNumRows()==major); assert( pmA.getSizeVectorStarts()==major+1 ); assert( pmA.getSizeVectorLengths()==major ); // Test that osm1 has the correct values assert( pm.getElements() != pmA.getElements() ); const double * ev = pmA.getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 1.0) ); assert( eq(ev[2], -2.0) ); assert( eq(ev[3], -1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[7], 2.0) ); assert( eq(ev[8], 1.1) ); assert( eq(ev[10], 1.0) ); assert( eq(ev[11], 1.0) ); assert( eq(ev[13], 2.8) ); assert( eq(ev[14], -1.2) ); assert( eq(ev[16], 5.6) ); assert( eq(ev[17], 1.0) ); assert( eq(ev[18], 1.9) ); // Test modification of a single element pmA.modifyCoefficient(2,5,-7.0); assert( eq(ev[11], -7.0) ); // and back pmA.modifyCoefficient(2,5,1.0); assert( eq(ev[11], 1.0) ); assert( pm.getVectorStarts() != pmA.getVectorStarts() ); const CoinBigIndex * mi = pmA.getVectorStarts(); assert( mi[0]==0 ); assert( mi[1]==7 ); assert( mi[2]==10 ); assert( mi[3]==13 ); assert( mi[4]==16 ); assert( mi[5]==20 ); assert( pm.getVectorLengths() != pmA.getVectorLengths() ); const int * vl = pmC.getVectorLengths(); assert( vl[0]==5 ); assert( vl[1]==2 ); assert( vl[2]==2 ); assert( vl[3]==2 ); assert( vl[4]==3 ); assert( pm.getIndices() != pmA.getIndices() ); const int * ei = pmA.getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 1 ); assert( ei[2] == 3 ); assert( ei[3] == 4 ); assert( ei[4] == 7 ); assert( ei[7] == 1 ); assert( ei[8] == 2 ); assert( ei[10] == 2 ); assert( ei[11] == 5 ); assert( ei[13] == 3 ); assert( ei[14] == 6 ); assert( ei[16] == 0 ); assert( ei[17] == 4 ); assert( ei[18] == 7 ); assert( pmA.isEquivalent(pm) ); assert( pmA.isEquivalent(pmC) ); // Test new to global globalP = new CoinPackedMatrix(pmA); assert( eq(globalP->getElements()[0], 3.0) ); assert( globalP->isEquivalent(pmA) ); } assert( eq(globalP->getElements()[0], 3.0) ); } assert( eq(globalP->getElements()[0], 3.0) ); } // Test that cloned matrix contains correct values const double * ev = globalP->getElements(); assert( eq(ev[0], 3.0) ); assert( eq(ev[1], 1.0) ); assert( eq(ev[2], -2.0) ); assert( eq(ev[3], -1.0) ); assert( eq(ev[4], -1.0) ); assert( eq(ev[7], 2.0) ); assert( eq(ev[8], 1.1) ); assert( eq(ev[10], 1.0) ); assert( eq(ev[11], 1.0) ); assert( eq(ev[13], 2.8) ); assert( eq(ev[14], -1.2) ); assert( eq(ev[16], 5.6) ); assert( eq(ev[17], 1.0) ); assert( eq(ev[18], 1.9) ); // Check printMatrixElement std::cout << "Testing printMatrixElement:" << std::endl ; std::cout << "Expecting 1.1, 0.0, -1.2." << std::endl ; std::cout << "a(1,2) = " ; globalP->printMatrixElement(1,2) ; std::cout << "; a(3,5) = " ; globalP->printMatrixElement(3,5) ; std::cout << "; a(3,6) = " ; globalP->printMatrixElement(3,6) ; std::cout << std::endl ; std::cout << "Expecting bounds error messages." << std::endl ; std::cout << "a(-1,-1) = " ; globalP->printMatrixElement(-1,-1) ; std::cout << "a(0,-1) = " ; globalP->printMatrixElement(0,-1) ; std::cout << "a(4,8) = " ; globalP->printMatrixElement(4,8) ; std::cout << "a(5,8) = " ; globalP->printMatrixElement(5,8) ; # if 0 /* If you want an exhaustive test, enable these loops. */ for (CoinBigIndex rowndx = -1 ; rowndx <= globalP->getMajorDim() ; rowndx++) { for (CoinBigIndex colndx = -1 ; colndx < globalP->getMinorDim() ; colndx++) { std::cout << "a(" << rowndx << "," << colndx << ") = " ; globalP->printMatrixElement(rowndx,colndx) ; std::cout << std::endl ; } } # endif const CoinBigIndex * mi = globalP->getVectorStarts(); assert( mi[0]==0 ); assert( mi[1]==7 ); assert( mi[2]==10 ); assert( mi[3]==13 ); assert( mi[4]==16 ); assert( mi[5]==20 ); const int * ei = globalP->getIndices(); assert( ei[0] == 0 ); assert( ei[1] == 1 ); assert( ei[2] == 3 ); assert( ei[3] == 4 ); assert( ei[4] == 7 ); assert( ei[7] == 1 ); assert( ei[8] == 2 ); assert( ei[10] == 2 ); assert( ei[11] == 5 ); assert( ei[13] == 3 ); assert( ei[14] == 6 ); assert( ei[16] == 0 ); assert( ei[17] == 4 ); assert( ei[18] == 7 ); assert( globalP->getMajorDim() == 5 ); assert( globalP->getMinorDim() == 8 ); assert( globalP->getNumElements() == 14 ); assert( globalP->getSizeVectorStarts()==6 ); // Test method which returns length of vectors assert( globalP->getVectorSize(0)==5 ); assert( globalP->getVectorSize(1)==2 ); assert( globalP->getVectorSize(2)==2 ); assert( globalP->getVectorSize(3)==2 ); assert( globalP->getVectorSize(4)==3 ); // Test getVectorSize exceptions { bool errorThrown = false; try { globalP->getVectorSize(-1); } catch (CoinError& e) { errorThrown = true; } assert( errorThrown ); } { bool errorThrown = false; try { globalP->getVectorSize(5); } catch (CoinError& e) { errorThrown = true; } assert( errorThrown ); } // Test vector method { // 3x1 + x2 - 2x4 - x5 - x8 CoinShallowPackedVector pv = globalP->getVector(0); assert( pv.getNumElements() == 5 ); assert( eq(pv[0], 3.0) ); assert( eq(pv[1], 1.0) ); assert( eq(pv[3],-2.0) ); assert( eq(pv[4],-1.0) ); assert( eq(pv[7],-1.0) ); // 2x2 + 1.1x3 pv = globalP->getVector(1); assert( pv.getNumElements() == 2 ); assert( eq(pv[1], 2.0) ); assert( eq(pv[2], 1.1) ); // x3 + x6 pv = globalP->getVector(2); assert( pv.getNumElements() == 2 ); assert( eq(pv[2], 1.0) ); assert( eq(pv[5], 1.0) ); // 2.8x4 -1.2x7 pv = globalP->getVector(3); assert( pv.getNumElements() == 2 ); assert( eq(pv[3], 2.8) ); assert( eq(pv[6],-1.2) ); // 5.6x1 + x5 + 1.9x8 pv = globalP->getVector(4); assert( pv.getNumElements() == 3 ); assert( eq(pv[0], 5.6) ); assert( eq(pv[4], 1.0) ); assert( eq(pv[7], 1.9) ); } // Test vector method exceptions { bool errorThrown = false; try { CoinShallowPackedVector v = globalP->getVector(-1); } catch (CoinError& e) { errorThrown = true; } assert( errorThrown ); } { bool errorThrown = false; try { CoinShallowPackedVector vs = globalP->getVector(5); } catch (CoinError& e) { errorThrown = true; } assert( errorThrown ); } { CoinPackedMatrix pm(*globalP); assert( pm.getExtraGap() != 0.0 ); assert( pm.getExtraMajor() != 0.0 ); pm.setExtraGap(0.0); pm.setExtraMajor(0.0); assert( pm.getExtraGap() == 0.0 ); assert( pm.getExtraMajor() == 0.0 ); pm.reverseOrdering(); assert( pm.getExtraGap() == 0.0 ); assert( pm.getExtraMajor() == 0.0 ); } // Test ordered triples constructor { /************************************************************************* * Setup data to represent this matrix by rows * * 3x1 + x2 - 2x4 - x5 - x8 * 2x2y+ 1.1x3 * x3 + x6y * 2.8x4 -1.2x7 * 5.6x1 + x5 + 1.9x8 * *************************************************************************/ const int ne=17; int ri[ne]; int ci[ne]; double el[ne]; ri[ 0]=1; ci[ 0]=2; el[ 0]=1.1; ri[ 1]=0; ci[ 1]=3; el[ 1]=-2.0; ri[ 2]=4; ci[ 2]=7; el[ 2]=1.9; ri[ 3]=3; ci[ 3]=6; el[ 3]=-1.2; ri[ 4]=2; ci[ 4]=5; el[ 4]=1.0; ri[ 5]=4; ci[ 5]=0; el[ 5]=5.6; ri[ 6]=0; ci[ 6]=7; el[ 6]=-1.0; ri[ 7]=0; ci[ 7]=0; el[ 7]=3.0; ri[ 8]=0; ci[ 8]=4; el[ 8]=-1.0; ri[ 9]=4; ci[ 9]=4; el[ 9]=1.0; ri[10]=3; ci[10]=3; el[10]=2.0; // (3,3) is a duplicate element ri[11]=1; ci[11]=1; el[11]=2.0; ri[12]=0; ci[12]=1; el[12]=1.0; ri[13]=2; ci[13]=2; el[13]=1.0; ri[14]=3; ci[14]=3; el[14]=0.8; // (3,3) is a duplicate element ri[15]=2; ci[15]=0; el[15]=-3.1415; ri[16]=2; ci[16]=0; el[16]= 3.1415; assert(!globalP->isColOrdered()); // create col ordered matrix from triples CoinPackedMatrix pmtco(true,ri,ci,el,ne); // Test that duplicates got the correct value assert( eq( pmtco.getVector(3)[3] , 2.8 ) ); assert( eq( pmtco.getVector(0)[2] , 0.0 ) ); // Test to make sure there are no gaps in the created matrix assert( pmtco.getVectorStarts()[0]==0 ); assert( pmtco.getVectorStarts()[1]==2 ); assert( pmtco.getVectorStarts()[2]==4 ); assert( pmtco.getVectorStarts()[3]==6 ); assert( pmtco.getVectorStarts()[4]==8 ); assert( pmtco.getVectorStarts()[5]==10 ); assert( pmtco.getVectorStarts()[6]==11 ); assert( pmtco.getVectorStarts()[7]==12 ); assert( pmtco.getVectorStarts()[8]==14 ); // Test the whole matrix CoinPackedMatrix globalco; globalco.reverseOrderedCopyOf(*globalP); assert(pmtco.isEquivalent(globalco)); // create row ordered matrix from triples CoinPackedMatrix pmtro(false,ri,ci,el,ne); assert(!pmtro.isColOrdered()); assert( eq( pmtro.getVector(3)[3] , 2.8 ) ); assert( eq( pmtro.getVector(2)[0] , 0.0 ) ); assert( pmtro.getVectorStarts()[0]==0 ); assert( pmtro.getVectorStarts()[1]==5 ); assert( pmtro.getVectorStarts()[2]==7 ); assert( pmtro.getVectorStarts()[3]==9 ); assert( pmtro.getVectorStarts()[4]==11 ); assert( pmtro.getVectorStarts()[5]==14 ); assert(globalP->isEquivalent(pmtro)); } delete globalP; } #if 0 { // test append CoinPackedMatrix pm; const int ne = 4; int inx[ne] = { 1, -4, 0, 2 }; double el[ne] = { 10., 40., 1., 50. }; CoinPackedVector r(ne,inx,el); pm.appendRow(r); // This line fails } #endif } CoinMP-1.8.3/CoinUtils/test/CoinModelTest.cpp0000644000175000017500000005676011552534611017442 0ustar renerene// Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinMpsIO.hpp" #include "CoinModel.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" //############################################################################# /* Build a model in some interesting way Nine blocks defined by 4 random numbers If next random number <0.4 addRow next possible If <0.8 addColumn if possible Otherwise do by element For each one use random <0.5 to add rim at same time At end fill in rim at random */ void buildRandom(CoinModel & baseModel, double random, double & timeIt, int iPass) { CoinModel model; int numberRows = baseModel.numberRows(); int numberColumns = baseModel.numberColumns(); int numberElements = baseModel.numberElements(); // Row numbers and column numbers int lastRow[4]; int lastColumn[4]; int i; lastRow[0]=0; lastColumn[0]=0; lastRow[3]=numberRows; lastColumn[3]=numberColumns; for ( i=1;i<3;i++) { int size; size = (int) ((0.25*random+0.2)*numberRows); random = CoinDrand48(); lastRow[i]=lastRow[i-1]+size; size = (int) ((0.25*random+0.2)*numberColumns); random = CoinDrand48(); lastColumn[i]=lastColumn[i-1]+size; } // whether block done 0 row first char block[9]={0,0,0,0,0,0,0,0,0}; // whether rowRim done char rowDone[3]={0,0,0}; // whether columnRim done char columnDone[3]={0,0,0}; // Save array for deleting elements CoinModelTriple * dTriple = new CoinModelTriple[numberElements]; numberElements=0; double time1 = CoinCpuTime(); for (int jBlock=0;jBlock<9;jBlock++) { int iType=-1; int iBlock=-1; if (random<0.4) { // trying addRow int j; for (j=0;j<3;j++) { int k; for (k=0;k<3;k++) { if (block[3*j+k]) break; //already taken } if (k==3) { // can do but decide which one iBlock = 3*j + (int) (CoinDrand48()*0.3); iType=0; break; } } } if (iType==-1&&random<0.8) { // trying addRow int j; for (j=0;j<3;j++) { int k; for (k=0;k<3;k++) { if (block[j+3*k]) break; //already taken } if (k==3) { // can do but decide which one iBlock = j + 3*((int) (CoinDrand48()*0.3)); iType=1; break; } } } if (iType==-1) { iType=2; int j; for (j=0;j<9;j++) { if (!block[j]) { iBlock=j; break; } } } random=CoinDrand48(); assert (iBlock>=0&&iBlock<9); assert (iType>=0); assert (!block[iBlock]); block[iBlock]=static_cast(1+iType); int jRow = iBlock/3; int jColumn = iBlock%3; bool doRow = (CoinDrand48()<0.5)&&!rowDone[jRow]; bool doColumn = (CoinDrand48()<0.5&&!columnDone[jColumn]); if (!iType) { // addRow int * column = new int[lastColumn[jColumn+1]-lastColumn[jColumn]]; double * element = new double[lastColumn[jColumn+1]-lastColumn[jColumn]]; for (i=lastRow[jRow];i=0) { if (triple.column()>=lastColumn[jColumn]&&triple.column()=model.numberRows()); if (i>model.numberRows()) { assert (i==lastRow[jRow]); std::cout << "need to fill in rows" << std::endl ; for (int k=0;k=0) { if (triple.row()>=lastRow[jRow]&&triple.row()=model.numberColumns()); if (i>model.numberColumns()) { assert (i==lastColumn[jColumn]); std::cout << "need to fill in columns" << std::endl ; for (int k=0;k=0) { int iColumn = triple.column(); if (iColumn>=lastColumn[jColumn]&&iColumn=0) { int iRow = triple.row(); if (iRow>=lastRow[jRow]&&iRow=0;i--) { int iRow = (int) rowInTriple(elements[i]); int iColumn = elements[i].column; if (iRow>=lastRow[jRow]&&iRow=lastColumn[jColumn]&&iColumn=0) { int iColumn = triple.column(); if (iColumn>=lastColumn[jColumn]&&iColumn=0) { int iRow = triple.row(); if (iRow>=lastRow[jRow]&&iRow=0;i--) { int iRow = (int) rowInTriple(elements[i]); int iColumn = elements[i].column; if (iRow>=lastRow[jRow]&&iRow=lastColumn[jColumn]&&iColumn10) { double random2=CoinDrand48(); double randomDelete = 0.2 + 0.5*random2; // fraction to delete //model.validateLinks(); if (random2<0.2) { // delete some rows for (int j=lastRow[jRow];j=0) { int iColumn = triple.column(); assert (j==triple.row()); setRowInTriple(dTriple[numberElements],j); dTriple[numberElements].column=iColumn; dTriple[numberElements].value = triple.value(); numberElements++; triple=model.next(triple); } model.deleteRow(j); if (rowDone[jRow]) { // put back rim model.setRowLower(j,rowLower); model.setRowUpper(j,rowUpper); model.setRowName(j,rowName); } free(rowName); } } } else if (random2<0.4) { // delete some columns for (int j=lastColumn[jColumn];j=0) { int iRow = triple.row(); assert (j==triple.column()); dTriple[numberElements].column = j; setRowInTriple(dTriple[numberElements],iRow); dTriple[numberElements].value = triple.value(); numberElements++; triple=model.next(triple); } model.deleteColumn(j); if (columnDone[jColumn]) { // put back rim model.setColumnLower(j,columnLower); model.setColumnUpper(j,columnUpper); model.setObjective(j,objective); model.setIsInteger(j,integer); model.setColumnName(j,columnName); } free(columnName); } } } else { // delete some elements //model.validateLinks(); const CoinModelTriple * elements = baseModel.elements(); for (i=0;i=lastRow[jRow]&&iRow=lastColumn[jColumn]&&iColumn=0) numberElements++; } } } } } } // Do rim if necessary for (int k=0;k<3;k++) { if (!rowDone[k]) { for (i=lastRow[k];i=0;i--) temp.setRowLower(i,model.getRowLower(i)); for (i=0;i=0;i--) { temp.setColumnLower(i,model.getColumnLower(i)); temp.setColumnObjective(i,model.getColumnObjective(i)); temp.setColumnIsInteger(i,model.getColumnIsInteger(i)); } for (i=0;i=0) { temp(i,triple.column(),triple.value()); triple=model.next(triple); } } // and by column for (i=numberColumns-1;i>=0;i--) { CoinModelLink triple=model.lastInColumn(i); while (triple.row()>=0) { assert (triple.value()==temp(triple.row(),i)); temp(triple.row(),i,triple.value()); triple=model.previous(triple); } } // check equal model.setLogLevel(1); assert (!model.differentModel(temp,false)); } // Try creating model with strings { CoinModel temp; int i; for (i=numberRows-1;i>=0;i--) { double value = model.getRowLower(i); if (value==-1.0) temp.setRowLower(i,"minusOne"); else if (value==1.0) temp.setRowLower(i,"sqrt(plusOne)"); else if (value==4.0) temp.setRowLower(i,"abs(4*plusOne)"); else temp.setRowLower(i,value); } for (i=0;i=0;i--) { temp.setColumnLower(i,model.getColumnLower(i)); temp.setColumnObjective(i,model.getColumnObjective(i)); temp.setColumnIsInteger(i,model.getColumnIsInteger(i)); } for (i=0;i=0) { double value = triple.value(); if (value==-1.0) temp(i,triple.column(),"minusOne"); else if (value==1.0) temp(i,triple.column(),"plusOne"); else if (value==-2.0) temp(i,triple.column(),"minusOne-1.0"); else if (value==2.0) temp(i,triple.column(),"plusOne+1.0+minusOne+(2.0-plusOne)"); else temp(i,triple.column(),value); triple=model.next(triple); } } temp.associateElement("minusOne",-1.0); temp.associateElement("plusOne",1.0); temp.setProblemName("fromStrings"); temp.writeMps("string.mps"); // check equal model.setLogLevel(1); assert (!model.differentModel(temp,false)); } // Test with various ways of generating { /* Get a model. Try first with netlibDir, fall back to mpsDir (sampleDir) if that fails. */ CoinMpsIO m; std::string fn = netlibDir+testModel; double time1 = CoinCpuTime(); int numErr = m.readMps(fn.c_str(),""); if (numErr != 0) { std::cout << "Could not read " << testModel << " in " << netlibDir << "; falling back to " << mpsDir << "." << std::endl ; fn = mpsDir+testModel ; numErr = m.readMps(fn.c_str(),"") ; if (numErr != 0) { std::cout << "Could not read " << testModel << "; skipping test." << std::endl ; } } if (numErr == 0) { std::cout << "Time for readMps is " << (CoinCpuTime()-time1) << " seconds." << std::endl ; int numberRows = m.getNumRows(); int numberColumns = m.getNumCols(); // Build model CoinModel model; CoinPackedMatrix matrixByRow = * m.getMatrixByRow(); const double * element = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); const double * rowLower = m.getRowLower(); const double * rowUpper = m.getRowUpper(); const double * columnLower = m.getColLower(); const double * columnUpper = m.getColUpper(); const double * objective = m.getObjCoefficients(); int i; for (i=0;i #include "CoinPragma.hpp" #include "CoinFloatEqual.hpp" #include "CoinFinite.hpp" #include "CoinPackedVector.hpp" #include "CoinShallowPackedVector.hpp" //-------------------------------------------------------------------------- void CoinPackedVectorUnitTest() { int i; // Test default constructor { CoinPackedVector r; assert( r.indices_==NULL ); assert( r.origIndices_==NULL ); assert( r.elements_==NULL ); assert( r.getNumElements()==0 ); assert( r.capacity_==0); } // Test set and get methods const int ne = 4; int inx[ne] = { 1, 3, 4, 7 }; double el[ne] = { 1.2, 3.4, 5.6, 7.8 }; { CoinPackedVector r; assert( r.getNumElements()==0 ); // Test setting/getting elements with int* & float* vectors r.setVector( ne, inx, el ); assert( r.getNumElements()==ne ); for ( i=0; ir.getElements()[i] ) incr=false; assert( !incr ); r.sortIncrElement(); incr = true; for ( i=1; ir.getElements()[i] ) incr=false; assert( incr ); } { CoinPackedVector r; const int ne = 3; int inx[ne] = { 1, 2, 3 }; double el[ne] = { 2.2, 4.4, 8.8}; r.setVector(ne,inx,el); int c = r.capacity(); int max = r.getMaxIndex(); int min = r.getMinIndex(); // Test swap function r.swap(0,2); assert( r.getIndices()[0]==3 ); assert( r.getIndices()[1]==2 ); assert( r.getIndices()[2]==1 ); assert( r.getElements()[0]==8.8 ); assert( r.getElements()[1]==4.4 ); assert( r.getElements()[2]==2.2 ); assert( r.getMaxIndex() == max ); assert( r.getMinIndex() == min ); assert( r.capacity() == c ); // Test the append function CoinPackedVector s; const int nes = 4; int inxs[nes] = { 11, 12, 13, 14 }; double els[nes] = { .122, 14.4, 18.8, 19.9}; s.setVector(nes,inxs,els); r.append(s); assert( r.getNumElements()==7 ); assert( r.getIndices()[0]==3 ); assert( r.getIndices()[1]==2 ); assert( r.getIndices()[2]==1 ); assert( r.getIndices()[3]==11 ); assert( r.getIndices()[4]==12 ); assert( r.getIndices()[5]==13 ); assert( r.getIndices()[6]==14 ); assert( r.getElements()[0]==8.8 ); assert( r.getElements()[1]==4.4 ); assert( r.getElements()[2]==2.2 ); assert( r.getElements()[3]==.122 ); assert( r.getElements()[4]==14.4 ); assert( r.getElements()[5]==18.8 ); assert( r.getElements()[6]==19.9 ); assert( r.getMaxIndex() == 14 ); assert( r.getMinIndex() == 1 ); // Test the resize function c = r.capacity(); r.truncate(4); assert( r.getNumElements()==4 ); assert( r.getIndices()[0]==3 ); assert( r.getIndices()[1]==2 ); assert( r.getIndices()[2]==1 ); assert( r.getIndices()[3]==11 ); assert( r.getElements()[0]==8.8 ); assert( r.getElements()[1]==4.4 ); assert( r.getElements()[2]==2.2 ); assert( r.getElements()[3]==.122 ); assert( r.getMaxIndex() == 11 ); assert( r.getMinIndex() == 1 ); assert( r.capacity() == c ); } // Test copy constructor and assignment operator { CoinPackedVector rhs; { CoinPackedVector r; { CoinPackedVector rC1(r); assert( 0==r.getNumElements() ); assert( 0==rC1.getNumElements() ); r.setVector( ne, inx, el ); assert( ne==r.getNumElements() ); assert( 0==rC1.getNumElements() ); } CoinPackedVector rC2(r); assert( ne==r.getNumElements() ); assert( ne==rC2.getNumElements() ); for ( i=0; i, +v1, v1+v2 { const int ne1 = 5; int inx1[ne1] = { 1, 3, 4, 7, 5 }; double el1[ne1] = { 1., 5., 6., 2., 9. }; const int ne2 = 4; int inx2[ne2] = { 7, 4, 2, 1 }; double el2[ne2] = { 7., 4., 2., 1. }; CoinPackedVector v1; CoinPackedVector v2; CoinPackedVector r ; CoinPackedVector rV ; v1.setVector(ne1,inx1,el1); rV.setVector(ne1,inx1,el1) ; r = v1 + v2 ; assert(r.isEquivalent(rV)) ; r = v2 + v1 ; assert(r.isEquivalent(rV)) ; v2.setVector(ne2,inx2,el2); r = v1 + v2 ; const int ner = 6; int inxr[ner] = { 1, 2, 3, 4, 5, 7 }; double elr[ner] = { 1.+1., 0.+2., 5.+0., 6.+4., 9.+0., 2.+7. }; rV.setVector(ner,inxr,elr); assert( r.isEquivalent(rV) ); } // Test subtracting vectors. Note that zeros are not automatically // compressed out of the result. { const int ne1 = 5; int inx1[ne1] = { 1, 3, 4, 7, 5 }; double el1[ne1] = { 1., 5., 6., 2., 9. }; const int ne2 = 4; int inx2[ne2] = { 7, 4, 2, 1 }; double el2[ne2] = { 7., 4., 2., 1. }; CoinPackedVector v1; v1.setVector(ne1,inx1,el1); CoinPackedVector v2; v2.setVector(ne2,inx2,el2); CoinPackedVector r = v1 - v2; const int ner = 6; int inxr[ner] = { 1, 2, 3, 4, 5, 7 }; double elr[ner] = { 1.-1., 0.-2., 5.-0., 6.-4., 9.-0., 2.-7. }; CoinPackedVector rV; rV.setVector(ner,inxr,elr); assert( r.isEquivalent(rV) ); } // Test multiplying vectors. Note that zeros are not automatically // compressed out of the result. { const int ne1 = 5; int inx1[ne1] = { 1, 3, 4, 7, 5 }; double el1[ne1] = { 1., 5., 6., 2., 9. }; const int ne2 = 4; int inx2[ne2] = { 7, 4, 2, 1 }; double el2[ne2] = { 7., 4., 2., 1. }; CoinPackedVector v1; v1.setVector(ne1,inx1,el1); CoinPackedVector v2; v2.setVector(ne2,inx2,el2); CoinPackedVector r = v1 * v2; const int ner = 6; int inxr[ner] = { 1, 2, 3, 4, 5, 7 }; double elr[ner] = { 1.*1., 0.*2., 5.*0., 6.*4., 9.*0., 2.*7. }; CoinPackedVector rV; rV.setVector(ner,inxr,elr); assert( r.isEquivalent(rV) ); } // Test dividing vectors. Note that zeros are not automatically compressed // out of the result. Previously, used HUGE_VAL to get IEEE infinity, but // this triggers a bug in some GCC compilers. -- lh, 061020 -- { const int ne1 = 3; int inx1[ne1] = { 1, 4, 7 }; double el1[ne1] = { 1., 6., 2. }; const int ne2 = 4; int inx2[ne2] = { 7, 4, 2, 1 }; double el2[ne2] = { 7., 4., 2., 1. }; # ifdef COIN_C_FINITE double one = 1.0 ; double zero = 0.0 ; double infty = one/zero ; # else double infty = COIN_DBL_MAX ; # endif CoinPackedVector v1; CoinPackedVector v2; CoinPackedVector r ; CoinPackedVector rV; v1.setVector(ne1,inx1,el1) ; rV.setConstant(ne1,inx1,0) ; r = v2 / v1; assert(r.isEquivalent(rV)) ; rV.setConstant(ne1,inx1,infty) ; r = v1 / v2; assert(r.isEquivalent(rV)) ; r.isEquivalent(rV) ; v2.setVector(ne2,inx2,el2); r = v1 / v2; const int ner = 4; int inxr[ner] = { 1, 2, 4, 7 }; double elr[ner] = { 1./1., 0./2., 6./4., 2./7. }; rV.setVector(ner,inxr,elr); assert( r.isEquivalent(rV) ); } // Test sum { CoinPackedVector s; assert( s.sum() == 0 ); s.insert(25,45.); assert(s.sum()==45.); const int ne1 = 5; int inx1[ne1] = { 10, 3, 4, 7, 5 }; double el1[ne1] = { 1., 5., 6., 2., 9. }; s.setVector(ne1,inx1,el1); assert(s.sum()==1.+5.+6.+2.+9.); } // Just another interesting test { // Create numerator vector const int ne1 = 2; int inx1[ne1] = { 1, 4 }; double el1[ne1] = { 1., 6. }; CoinPackedVector v1(ne1,inx1,el1); // create denominator vector const int ne2 = 3; int inx2[ne2] = { 1, 2, 4 }; double el2[ne2] = { 1., 7., 4.}; CoinPackedVector v2(ne2,inx2,el2); // Compute ratio CoinPackedVector ratio = v1 / v2; // Sort ratios ratio.sortIncrElement(); // Test that the sort really worked assert( ratio.getElements()[0] == 0.0/7.0 ); assert( ratio.getElements()[1] == 1.0/1.0 ); assert( ratio.getElements()[2] == 6.0/4.0 ); // Get numerator of of sorted ratio vector assert( v1[ ratio.getIndices()[0] ] == 0.0 ); assert( v1[ ratio.getIndices()[1] ] == 1.0 ); assert( v1[ ratio.getIndices()[2] ] == 6.0 ); // Get denominator of of sorted ratio vector assert( v2[ ratio.getIndices()[0] ] == 7.0 ); assert( v2[ ratio.getIndices()[1] ] == 1.0 ); assert( v2[ ratio.getIndices()[2] ] == 4.0 ); } // Test copy constructor from ShallowPackedVector { const int ne = 4; int inx[ne] = { 1, 4, 0, 2 }; double el[ne] = { 10., 40., 1., 50. }; CoinPackedVector std(ne,inx,el); CoinShallowPackedVector * spvP = new CoinShallowPackedVector(ne,inx,el); CoinPackedVector pv(*spvP); assert( pv == std ); assert( pv.isEquivalent(std) ); delete spvP; assert( pv == std ); assert( pv.isEquivalent(std) ); pv.sortIncrElement(); assert( pv != std ); assert( pv.isEquivalent(std) ); } // Test assignment from ShallowPackedVector { const int ne = 4; int inx[ne] = { 1, 4, 0, 2 }; double el[ne] = { 10., 40., 1., 50. }; CoinPackedVector std(ne,inx,el); CoinShallowPackedVector * spvP = new CoinShallowPackedVector(ne,inx,el); CoinPackedVector pv; pv = *spvP; assert( pv == std ); assert( pv.isEquivalent(std) ); delete spvP; assert( pv == std ); assert( pv.isEquivalent(std) ); pv.sortIncrElement(); assert( pv != std ); assert( pv.isEquivalent(std) ); } { // Test that sample usage works const int ne = 4; int inx[ne] = { 1, 4, 0, 2 }; double el[ne] = { 10., 40., 1., 50. }; CoinPackedVector r(ne,inx,el); assert( r.getIndices()[0]== 1 ); assert( r.getElements()[0]==10. ); assert( r.getIndices()[1]== 4 ); assert( r.getElements()[1]==40. ); assert( r.getIndices()[2]== 0 ); assert( r.getElements()[2]== 1. ); assert( r.getIndices()[3]== 2 ); assert( r.getElements()[3]==50. ); assert( r.getOriginalPosition()[0]==0 ); assert( r.getOriginalPosition()[1]==1 ); assert( r.getOriginalPosition()[2]==2 ); assert( r.getOriginalPosition()[3]==3 ); assert( r[ 0]==1. ); assert( r[ 1]==10.); assert( r[ 2]==50.); assert( r[ 3]==0. ); assert( r[ 4]==40.); r.sortIncrElement(); assert( r.getIndices()[0]== 0 ); assert( r.getElements()[0]== 1. ); assert( r.getIndices()[1]== 1 ); assert( r.getElements()[1]==10. ); assert( r.getIndices()[2]== 4 ); assert( r.getElements()[2]==40. ); assert( r.getIndices()[3]== 2 ); assert( r.getElements()[3]==50. ); assert( r.getOriginalPosition()[0]==2 ); assert( r.getOriginalPosition()[1]==0 ); assert( r.getOriginalPosition()[2]==1 ); assert( r.getOriginalPosition()[3]==3 ); assert( r[ 0]==1. ); assert( r[ 1]==10.); assert( r[ 2]==50.); assert( r[ 3]==0. ); assert( r[ 4]==40.); r.sortOriginalOrder(); assert( r.getIndices()[0]== 1 ); assert( r.getElements()[0]==10. ); assert( r.getIndices()[1]== 4 ); assert( r.getElements()[1]==40. ); assert( r.getIndices()[2]== 0 ); assert( r.getElements()[2]== 1. ); assert( r.getIndices()[3]== 2 ); assert( r.getElements()[3]==50. ); CoinPackedVector r1; r1=r; assert( r==r1 ); assert( r.isEquivalent(r1) ); r.sortIncrElement(); assert( r!=r1 ); assert( r.isEquivalent(r1) ); CoinPackedVector add = r + r1; assert( add[0] == 1.+ 1. ); assert( add[1] == 10.+10. ); assert( add[2] == 50.+50. ); assert( add[3] == 0.+ 0. ); assert( add[4] == 40.+40. ); assert( r.sum() == 10.+40.+1.+50. ); } { // Test findIndex const int ne = 4; int inx[ne] = { 1, -4, 0, 2 }; double el[ne] = { 10., 40., 1., 50. }; CoinPackedVector r(ne,inx,el); assert( r.findIndex(2) == 3 ); assert( r.findIndex(0) == 2 ); assert( r.findIndex(-4) == 1 ); assert( r.findIndex(1) == 0 ); assert( r.findIndex(3) == -1 ); } #if 0 { // Test construction with testing for duplicates as false const int ne = 4; int inx[ne] = { 1, -4, 0, 2 }; double el[ne] = { 10., 40., 1., 50. }; CoinPackedVector rT(ne,inx,el); CoinPackedVector r(false); assert( !r.isExistingIndex(1) ); r.insert(1,10.); assert( !r.isExistingIndex(-4) ); r.insert(-4,20.); assert( !r.isExistingIndex(0) ); r.insert(0,1.); assert( r.isExistingIndex(-4) ); // This line is failing!! // If r is constructed with true, // then it does not fail int neg4Index = r.findIndex(-4); assert( neg4Index == 1 ); r.setElement(neg4Index, r.getElements()[neg4Index] + 20); assert( !r.isExistingIndex(2) ); r.insert(2,50.); assert( r == rT ); } #endif /* Repeat various tests, using the constructor that takes ownership of the vectors. */ { const int neo = ne; int *inxo = new int[neo]; double *elo = new double[neo]; for (i = 0 ; i < neo ; i++) inxo[i] = inx[i] ; for (i = 0 ; i < neo ; i++) elo[i] = el[i] ; CoinPackedVector r(neo,neo,inxo,elo); assert( inxo == NULL ) ; assert( elo == NULL ) ; // Test getting elements with int* & float* vectors assert( r.getNumElements()==ne ); for ( i=0; ir.getElements()[i] ) incr=false; assert( !incr ); r.sortIncrElement(); incr = true; for ( i=1; ir.getElements()[i] ) incr=false; assert( incr ); } } CoinMP-1.8.3/CoinUtils/test/CoinShallowPackedVectorTest.cpp0000644000175000017500000003167111654260357022306 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef NDEBUG #undef NDEBUG #endif #include #include "CoinPragma.hpp" #include "CoinFinite.hpp" #include "CoinFloatEqual.hpp" #include "CoinShallowPackedVector.hpp" #include "CoinPackedVector.hpp" void CoinShallowPackedVectorUnitTest() { CoinRelFltEq eq; int i; // Test default constructor { CoinShallowPackedVector r; assert( r.indices_==NULL ); assert( r.elements_==NULL ); assert( r.nElements_==0 ); } // Test set and get methods const int ne = 4; int inx[ne] = { 1, 3, 4, 7 }; double el[ne] = { 1.2, 3.4, 5.6, 7.8 }; { CoinShallowPackedVector r; assert( r.getNumElements()==0 ); // Test setting/getting elements with int* & double* vectors r.setVector( ne, inx, el ); assert( r.getNumElements()==ne ); for ( i=0; i, 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/CoinUtils/install-sh0000755000175000017500000002202111405215457015232 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/CoinUtils/configure.ac0000644000175000017500000002414012574604646015532 0ustar renerene# Copyright (C) 2006,2009 International Business Machines. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: configure.ac 1840 2015-09-11 17:04:38Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 ############################################################################# # Names and other basic things # ############################################################################# AC_PREREQ(2.59) AC_INIT([CoinUtils],[2.10.10],[http://projects.coin-or.org/CoinUtils]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License.]) # List one file in the package so that the configure script can test # whether the package is actually there AC_CONFIG_SRCDIR(src/CoinError.cpp) # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. AC_PREFIX_DEFAULT([`pwd`]) ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type AC_CANONICAL_BUILD # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. AC_COIN_PROJECTDIR_INIT(CoinUtils,13:10:10) # Check if user wants to produce debugging code AC_COIN_DEBUG_COMPILE(CoinUtils) # Get the name of the C++ compiler and appropriate compiler options AC_COIN_PROG_CXX # Get the name of the Fortran compiler and appropriate compiler options AC_COIN_PROG_F77 # Find out how to call Fortran from C and determine Fortran runtime libraries if test "x$F77" != xunavailable then AC_COIN_F77_WRAPPERS fi # Initialize automake and libtool AC_COIN_INIT_AUTO_TOOLS ############################################################################ # Stuff that we need for finite and isnan # ############################################################################ AC_COIN_CHECK_ISFINITE AC_COIN_CHECK_ISNAN ############################################################################# # Thread configuration # ############################################################################# # Define new options: # --enable-coinutils-threads # --enable-coinutils-mempool-override-new # --enable-coinutils-mempool-maxpooled AC_LANG_PUSH(C++) AC_ARG_ENABLE([coinutils-threads], [AC_HELP_STRING([--enable-coinutils-threads], [enables compilation of thread aware CoinUtils (mempool so far)])]) if test "$enable_coinutils_threads" = yes; then # Define the preprocessor macro AC_DEFINE([COINUTILS_PTHREADS],[1],[Define to 1 if the thread aware version of CoinUtils should be compiled]) AC_CHECK_LIB([rt],[clock_gettime], [COINUTILSLIB_LIBS="-lrt $COINUTILSLIB_LIBS" COINUTILSLIB_PCLIBS="-lrt $COINUTILSLIB_PCLIBS"], [AC_MSG_ERROR([--enable-coinutils-threads selected, but -lrt unavailable])]) AC_CHECK_LIB([pthread],[pthread_create], [COINUTILSLIB_LIBS="-lpthread $COINUTILSLIB_LIBS" COINUTILSLIB_PCLIBS="-lpthread $COINUTILSLIB_PCLIBS"], [AC_MSG_ERROR([--enable-coinutils-threads selected, but -lpthreads unavailable])]) fi AC_ARG_ENABLE([coinutils-mempool-override-new], [AC_HELP_STRING([--enable-coinutils-mempool-override-new], [enables the CoinUtils mempool to override global new/delete])]) if test "$enable_coinutils_mempool_override_new" = yes; then AC_DEFINE([COINUTILS_MEMPOOL_OVERRIDE_NEW],[1],[Define to 1 CoinUtils should override global new/delete]) fi AC_ARG_ENABLE([coinutils-mempool-maxpooled], [AC_HELP_STRING([--enable-coinutils-mempool-maxpooled], [Specify the default maximum memory allocation size that is served by the memory pool. If negative (or 'no') then the memory pool is disabled completely. Otherwise its value can be overridden at runtime using the COINUTILS_MEMPOOL_MAXPOOLED environment variable.])]) if test "$enable_coinutils_mempool_maxpooled" = yes; then AC_DEFINE([COINUTILS_MEMPOOL_MAXPOOLED],[4096],[Default maximum pooled allocation size]) elif test "$enable_coinutils_mempool_maxpooled" = no; then AC_DEFINE([COINUTILS_MEMPOOL_MAXPOOLED],[-1],[Disable CoinUtils memory pool]) elif test x"$enable_coinutils_mempool_maxpooled" = x; then AC_DEFINE([COINUTILS_MEMPOOL_MAXPOOLED],[-1],[Disable CoinUtils memory pool]) else AC_DEFINE_UNQUOTED([COINUTILS_MEMPOOL_MAXPOOLED],${enable_coinutils_mempool_maxpooled},[Default maximum pooled allocation size]) fi ############################################################################# # Finding certain integer types # ############################################################################# AC_COIN_CHECK_CXX_CHEADER(inttypes) AC_COIN_CHECK_CXX_CHEADER(stdint) ##### 64bit Integer types # The problem here is that you can't extend `int64_t' to `unsigned int64_t'. # So we need distinct CoinInt64 and CoinUInt64. It should be safe to assume # uint64_t, given int64_t. CoinInt64= CoinUInt64= # try int64_t AC_CHECK_TYPE([int64_t],[CoinInt64=int64_t ; CoinUInt64=uint64_t],[],[ #ifdef HAVE_CINTTYPES # include #else # ifdef HAVE_INTTYPES_H # include # endif #endif ]) # We need to use the C compiler in the AC_CHECK_SIZEOF since otherwise the # MSCV compiler complains about redefinition of "exit". ac_cv_sizeof_ # sometimes adds `^M' to the number, hence the check for `8?'. AC_LANG_PUSH(C) # try long long if test x"$CoinInt64" = x; then AC_CHECK_SIZEOF([long long]) case $ac_cv_sizeof_long_long in 8 | 8?) CoinInt64="long long" CoinUInt64="unsigned long long" ;; esac fi #try long if test x"$CoinInt64" = x; then AC_CHECK_SIZEOF([long]) case $ac_cv_sizeof_long in 8 | 8?) CoinInt64="long" CoinUInt64="unsigned long" ;; esac fi #try int if test x"$CoinInt64" = x; then AC_CHECK_SIZEOF([int]) case $ac_cv_sizeof_int in 8 | 8?) CoinInt64="int" CoinUInt64="unsigned int" ;; esac fi AC_LANG_POP(C) if test x"$CoinInt64" = x; then AC_MSG_ERROR([Cannot find integer type with 64 bits]) fi AC_DEFINE_UNQUOTED([COIN_INT64_T],[$CoinInt64],[Define to 64bit integer type]) AC_DEFINE_UNQUOTED([COIN_UINT64_T],[$CoinInt64], [Define to 64bit unsigned integer type]) ##### Integer type for Pointer CoinIntPtr= # try intptr_t AC_CHECK_TYPE([intptr_t],[CoinIntPtr=intptr_t],[],[ #ifdef HAVE_CINTTYPES # include #else # ifdef HAVE_INTTYPES_H # include # endif #endif ]) AC_LANG_PUSH(C) # try long long if test x"$CoinIntPtr" = x; then AC_CHECK_SIZEOF([int *]) AC_CHECK_SIZEOF([long long]) if test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_int_p"; then CoinIntPtr="long long" fi fi # try long if test x"$CoinIntPtr" = x; then AC_CHECK_SIZEOF([long]) if test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_int_p"; then CoinIntPtr="long" fi fi # try int if test x"$CoinIntPtr" = x; then AC_CHECK_SIZEOF([int]) if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_int_p"; then CoinIntPtr="int" fi fi AC_LANG_POP(C) if test x"$CoinIntPtr" = x; then AC_MSG_ERROR([Cannot find integer type capturing pointer]) fi AC_DEFINE_UNQUOTED([COIN_INTPTR_T],[$CoinIntPtr],[Define to integer type capturing pointer]) if test "x$ac_cv_header_stdint_h" = xyes ; then AC_DEFINE([COINUTILS_HAS_STDINT_H], [1], [Define to 1 if stdint.h is available for CoinUtils]) fi if test "x$ac_cv_header_cstdint" = xyes ; then AC_DEFINE([COINUTILS_HAS_CSTDINT], [1], [Define to 1 if cstdint is available for CoinUtils]) fi ############################################################################# # Check whether we have windows.h # ############################################################################# AC_CHECK_HEADERS([windows.h]) ############################################################################# # Check whether we have endian.h # ############################################################################# AC_CHECK_HEADERS([endian.h]) ############################################################################# # COIN-OR components # ############################################################################# AC_COIN_CHECK_LIBM(CoinUtilsLib) AC_COIN_CHECK_PACKAGE_BLAS(CoinUtilsLib) AC_COIN_CHECK_PACKAGE_LAPACK(CoinUtilsLib) AC_COIN_CHECK_PACKAGE(Glpk, [coinglpk], [CoinUtilsLib]) AC_COIN_CHECK_PACKAGE(Sample, [coindatasample]) AC_COIN_CHECK_PACKAGE(Netlib, [coindatanetlib]) AC_COIN_CHECK_GNU_ZLIB(CoinUtilsLib) AC_COIN_CHECK_GNU_BZLIB(CoinUtilsLib) AC_COIN_CHECK_GNU_READLINE(CoinUtilsLib) AC_COIN_VPATH_LINK(test/plan.mod) ############################################################################# # Check for doxygen # ############################################################################# AC_COIN_DOXYGEN() ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) AC_CONFIG_FILES([Makefile src/Makefile test/Makefile coinutils.pc coinutils-uninstalled.pc]) AC_CONFIG_FILES([doxydoc/doxygen.conf]) # Here put the location and name of the configuration header file AC_CONFIG_HEADER([src/config.h src/config_coinutils.h]) # Finally, we let configure write all the output... AC_COIN_FINALIZE CoinMP-1.8.3/CoinUtils/doxydoc/0000755000175000017500000000000012600453454014701 5ustar renereneCoinMP-1.8.3/CoinUtils/doxydoc/doxygen.conf.in0000644000175000017500000017377512231275134017653 0ustar renerene# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doxydoc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = "@abs_top_srcdir@/" # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = @coin_doxy_logname@ #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @abs_top_srcdir@/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.hpp \ *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.svn* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 3 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = YES # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = YES # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = letter # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = @coin_doxy_tagfiles@ # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = @coin_doxy_tagname@ # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = YES # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = NO # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = @coin_doxy_usedot@ # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES CoinMP-1.8.3/CoinUtils/src/0000755000175000017500000000000012600453454014017 5ustar renereneCoinMP-1.8.3/CoinUtils/src/CoinPresolveDupcol.hpp0000644000175000017500000001367312503570460020320 0ustar renerene/* $Id: CoinPresolveDupcol.hpp 1817 2015-03-22 16:43:28Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveDupcol_H #define CoinPresolveDupcol_H #include "CoinPresolveMatrix.hpp" /*! \file */ #define DUPCOL 10 /*! \class dupcol_action \brief Detect and remove duplicate columns The general technique is to sum the coefficients a_(*,j) of each column. Columns with identical sums are duplicates. The obvious problem is that, e.g., [1 0 1 0] and [0 1 0 1] both add to 2. To minimize the chances of false positives, the coefficients of each row are multipled by a random number r_i, so that we sum r_i*a_ij. Candidate columns are checked to confirm they are identical. Where the columns have the same objective coefficient, the two are combined. If the columns have different objective coefficients, complications ensue. In order to remove the duplicate, it must be possible to fix the variable at a bound. */ class dupcol_action : public CoinPresolveAction { dupcol_action(); dupcol_action(const dupcol_action& rhs); dupcol_action& operator=(const dupcol_action& rhs); struct action { double thislo; double thisup; double lastlo; double lastup; int ithis; int ilast; double *colels; int nincol; }; const int nactions_; // actions_ is owned by the class and must be deleted at destruction const action *const actions_; dupcol_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~dupcol_action(); }; /*! \class duprow_action \brief Detect and remove duplicate rows The algorithm to detect duplicate rows is as outlined for dupcol_action. If the feasible interval for one constraint is strictly contained in the other, the tighter (contained) constraint is kept. If the feasible intervals are disjoint, the problem is infeasible. If the feasible intervals overlap, both constraints are kept. duprow_action is definitely a work in progress; #postsolve is unimplemented. This doesn't matter as it uses useless_constraint. */ class duprow_action : public CoinPresolveAction { struct action { int row; double lbound; double ubound; }; const int nactions_; const action *const actions_; duprow_action():CoinPresolveAction(NULL),nactions_(0),actions_(NULL) {} duprow_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; //~duprow_action() { delete[]actions_; } }; class duprow3_action : public CoinPresolveAction { struct action { int row; double lbound; double ubound; }; const int nactions_; const action *const actions_; duprow3_action():CoinPresolveAction(NULL),nactions_(0),actions_(NULL) {} duprow3_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; //~duprow_action() { delete[]actions_; } }; /*! \class gubrow_action \brief Detect and remove entries whose sum is known If we have an equality row where all entries same then For other rows where all entries for that equality row are same then we can delete entries and modify rhs gubrow_action is definitely a work in progress; #postsolve is unimplemented. */ class gubrow_action : public CoinPresolveAction { struct action { int row; double lbound; double ubound; }; const int nactions_; const action *const actions_; gubrow_action():CoinPresolveAction(NULL),nactions_(0),actions_(NULL) {} gubrow_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; //~gubrow_action() { delete[]actions_; } }; /*! \class twoxtwo_action \brief Detect interesting 2 by 2 blocks If a variable has two entries and for each row there are only two entries with same other variable then we can get rid of one constraint and modify costs. This is a work in progress - I need more examples */ class twoxtwo_action : public CoinPresolveAction { struct action { double lbound_row; double ubound_row; double lbound_col; double ubound_col; double cost_col; double cost_othercol; int row; int col; int othercol; }; const int nactions_; const action *const actions_; twoxtwo_action():CoinPresolveAction(NULL),nactions_(0),actions_(NULL) {} twoxtwo_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; ~twoxtwo_action() { delete [] actions_; } }; #endif CoinMP-1.8.3/CoinUtils/src/CoinShallowPackedVector.hpp0000644000175000017500000001150311654260357021253 0ustar renerene/* $Id: CoinShallowPackedVector.hpp 1498 2011-11-02 15:25:35Z mjs $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinShallowPackedVector_H #define CoinShallowPackedVector_H #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinError.hpp" #include "CoinPackedVectorBase.hpp" /** Shallow Sparse Vector This class is for sparse vectors where the indices and elements are stored elsewhere. This class only maintains pointers to the indices and elements. Since this class does not own the index and element data it provides read only access to to the data. An CoinSparsePackedVector must be used when the sparse vector's data will be altered. This class stores pointers to the vectors. It does not actually contain the vectors. Here is a sample usage: @verbatim const int ne = 4; int inx[ne] = { 1, 4, 0, 2 }; double el[ne] = { 10., 40., 1., 50. }; // Create vector and set its value CoinShallowPackedVector r(ne,inx,el); // access each index and element assert( r.indices ()[0]== 1 ); assert( r.elements()[0]==10. ); assert( r.indices ()[1]== 4 ); assert( r.elements()[1]==40. ); assert( r.indices ()[2]== 0 ); assert( r.elements()[2]== 1. ); assert( r.indices ()[3]== 2 ); assert( r.elements()[3]==50. ); // access as a full storage vector assert( r[ 0]==1. ); assert( r[ 1]==10.); assert( r[ 2]==50.); assert( r[ 3]==0. ); assert( r[ 4]==40.); // Tests for equality and equivalence CoinShallowPackedVector r1; r1=r; assert( r==r1 ); r.sort(CoinIncrElementOrdered()); assert( r!=r1 ); // Add packed vectors. // Similarly for subtraction, multiplication, // and division. CoinPackedVector add = r + r1; assert( add[0] == 1.+ 1. ); assert( add[1] == 10.+10. ); assert( add[2] == 50.+50. ); assert( add[3] == 0.+ 0. ); assert( add[4] == 40.+40. ); assert( r.sum() == 10.+40.+1.+50. ); @endverbatim */ class CoinShallowPackedVector : public CoinPackedVectorBase { friend void CoinShallowPackedVectorUnitTest(); public: /**@name Get methods */ //@{ /// Get length of indices and elements vectors virtual int getNumElements() const { return nElements_; } /// Get indices of elements virtual const int * getIndices() const { return indices_; } /// Get element values virtual const double * getElements() const { return elements_; } //@} /**@name Set methods */ //@{ /// Reset the vector (as if were just created an empty vector) void clear(); /** Assignment operator. */ CoinShallowPackedVector& operator=(const CoinShallowPackedVector & x); /** Assignment operator from a CoinPackedVectorBase. */ CoinShallowPackedVector& operator=(const CoinPackedVectorBase & x); /** just like the explicit constructor */ void setVector(int size, const int * indices, const double * elements, bool testForDuplicateIndex = true); //@} /**@name Methods to create, set and destroy */ //@{ /** Default constructor. */ CoinShallowPackedVector(bool testForDuplicateIndex = true); /** Explicit Constructor. Set vector size, indices, and elements. Size is the length of both the indices and elements vectors. The indices and elements vectors are not copied into this class instance. The ShallowPackedVector only maintains the pointers to the indices and elements vectors.
    The last argument specifies whether the creator of the object knows in advance that there are no duplicate indices. */ CoinShallowPackedVector(int size, const int * indices, const double * elements, bool testForDuplicateIndex = true); /** Copy constructor from the base class. */ CoinShallowPackedVector(const CoinPackedVectorBase &); /** Copy constructor. */ CoinShallowPackedVector(const CoinShallowPackedVector &); /** Destructor. */ virtual ~CoinShallowPackedVector() {} /// Print vector information. void print(); //@} private: /**@name Private member data */ //@{ /// Vector indices const int * indices_; ///Vector elements const double * elements_; /// Size of indices and elements vectors int nElements_; //@} }; //############################################################################# /** A function that tests the methods in the CoinShallowPackedVector class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CoinShallowPackedVectorUnitTest(); #endif CoinMP-1.8.3/CoinUtils/src/CoinHelperFunctions.hpp0000644000175000017500000007356212250061461020460 0ustar renerene/* $Id: CoinHelperFunctions.hpp 1679 2013-12-05 11:27:45Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinHelperFunctions_H #define CoinHelperFunctions_H #include "CoinUtilsConfig.h" #if defined(_MSC_VER) # include # include # define getcwd _getcwd # include #else # include #endif //#define USE_MEMCPY #include #include #include #include "CoinTypes.hpp" #include "CoinError.hpp" // Compilers can produce better code if they know about __restrict #ifndef COIN_RESTRICT #ifdef COIN_USE_RESTRICT #define COIN_RESTRICT __restrict #else #define COIN_RESTRICT #endif #endif //############################################################################# /** This helper function copies an array to another location using Duff's device (for a speedup of ~2). The arrays are given by pointers to their first entries and by the size of the source array. Overlapping arrays are handled correctly. */ template inline void CoinCopyN(register const T* from, const int size, register T* to) { if (size == 0 || from == to) return; #ifndef NDEBUG if (size < 0) throw CoinError("trying to copy negative number of entries", "CoinCopyN", ""); #endif register int n = (size + 7) / 8; if (to > from) { register const T* downfrom = from + size; register T* downto = to + size; // Use Duff's device to copy switch (size % 8) { case 0: do{ *--downto = *--downfrom; case 7: *--downto = *--downfrom; case 6: *--downto = *--downfrom; case 5: *--downto = *--downfrom; case 4: *--downto = *--downfrom; case 3: *--downto = *--downfrom; case 2: *--downto = *--downfrom; case 1: *--downto = *--downfrom; }while(--n>0); } } else { // Use Duff's device to copy --from; --to; switch (size % 8) { case 0: do{ *++to = *++from; case 7: *++to = *++from; case 6: *++to = *++from; case 5: *++to = *++from; case 4: *++to = *++from; case 3: *++to = *++from; case 2: *++to = *++from; case 1: *++to = *++from; }while(--n>0); } } } //----------------------------------------------------------------------------- /** This helper function copies an array to another location using Duff's device (for a speedup of ~2). The source array is given by its first and "after last" entry; the target array is given by its first entry. Overlapping arrays are handled correctly. All of the various CoinCopyN variants use an int for size. On 64-bit architectures, the address diff last-first will be a 64-bit quantity. Given that everything else uses an int, I'm going to choose to kick the difference down to int. -- lh, 100823 -- */ template inline void CoinCopy(register const T* first, register const T* last, register T* to) { CoinCopyN(first, static_cast(last-first), to); } //----------------------------------------------------------------------------- /** This helper function copies an array to another location. The two arrays must not overlap (otherwise an exception is thrown). For speed 8 entries are copied at a time. The arrays are given by pointers to their first entries and by the size of the source array. Note JJF - the speed claim seems to be false on IA32 so I have added CoinMemcpyN which can be used for atomic data */ template inline void CoinDisjointCopyN(register const T* from, const int size, register T* to) { #ifndef _MSC_VER if (size == 0 || from == to) return; #ifndef NDEBUG if (size < 0) throw CoinError("trying to copy negative number of entries", "CoinDisjointCopyN", ""); #endif #if 0 /* There is no point to do this test. If to and from are from different blocks then dist is undefined, so this can crash correct code. It's better to trust the user that the arrays are really disjoint. */ const long dist = to - from; if (-size < dist && dist < size) throw CoinError("overlapping arrays", "CoinDisjointCopyN", ""); #endif for (register int n = size / 8; n > 0; --n, from += 8, to += 8) { to[0] = from[0]; to[1] = from[1]; to[2] = from[2]; to[3] = from[3]; to[4] = from[4]; to[5] = from[5]; to[6] = from[6]; to[7] = from[7]; } switch (size % 8) { case 7: to[6] = from[6]; case 6: to[5] = from[5]; case 5: to[4] = from[4]; case 4: to[3] = from[3]; case 3: to[2] = from[2]; case 2: to[1] = from[1]; case 1: to[0] = from[0]; case 0: break; } #else CoinCopyN(from, size, to); #endif } //----------------------------------------------------------------------------- /** This helper function copies an array to another location. The two arrays must not overlap (otherwise an exception is thrown). For speed 8 entries are copied at a time. The source array is given by its first and "after last" entry; the target array is given by its first entry. */ template inline void CoinDisjointCopy(register const T* first, register const T* last, register T* to) { CoinDisjointCopyN(first, static_cast(last - first), to); } //----------------------------------------------------------------------------- /*! \brief Return an array of length \p size filled with input from \p array, or null if \p array is null. */ template inline T* CoinCopyOfArray( const T * array, const int size) { if (array) { T * arrayNew = new T[size]; std::memcpy(arrayNew,array,size*sizeof(T)); return arrayNew; } else { return NULL; } } /*! \brief Return an array of length \p size filled with first copySize from \p array, or null if \p array is null. */ template inline T* CoinCopyOfArrayPartial( const T * array, const int size,const int copySize) { if (array||size) { T * arrayNew = new T[size]; assert (copySize<=size); std::memcpy(arrayNew,array,copySize*sizeof(T)); return arrayNew; } else { return NULL; } } /*! \brief Return an array of length \p size filled with input from \p array, or filled with (scalar) \p value if \p array is null */ template inline T* CoinCopyOfArray( const T * array, const int size, T value) { T * arrayNew = new T[size]; if (array) { std::memcpy(arrayNew,array,size*sizeof(T)); } else { int i; for (i=0;i inline T* CoinCopyOfArrayOrZero( const T * array , const int size) { T * arrayNew = new T[size]; if (array) { std::memcpy(arrayNew,array,size*sizeof(T)); } else { std::memset(arrayNew,0,size*sizeof(T)); } return arrayNew; } //----------------------------------------------------------------------------- /** This helper function copies an array to another location. The two arrays must not overlap (otherwise an exception is thrown). For speed 8 entries are copied at a time. The arrays are given by pointers to their first entries and by the size of the source array. Note JJF - the speed claim seems to be false on IA32 so I have added alternative coding if USE_MEMCPY defined*/ #ifndef COIN_USE_RESTRICT template inline void CoinMemcpyN(register const T* from, const int size, register T* to) { #ifndef _MSC_VER #ifdef USE_MEMCPY // Use memcpy - seems a lot faster on Intel with gcc #ifndef NDEBUG // Some debug so check if (size < 0) throw CoinError("trying to copy negative number of entries", "CoinMemcpyN", ""); #if 0 /* There is no point to do this test. If to and from are from different blocks then dist is undefined, so this can crash correct code. It's better to trust the user that the arrays are really disjoint. */ const long dist = to - from; if (-size < dist && dist < size) throw CoinError("overlapping arrays", "CoinMemcpyN", ""); #endif #endif std::memcpy(to,from,size*sizeof(T)); #else if (size == 0 || from == to) return; #ifndef NDEBUG if (size < 0) throw CoinError("trying to copy negative number of entries", "CoinMemcpyN", ""); #endif #if 0 /* There is no point to do this test. If to and from are from different blocks then dist is undefined, so this can crash correct code. It's better to trust the user that the arrays are really disjoint. */ const long dist = to - from; if (-size < dist && dist < size) throw CoinError("overlapping arrays", "CoinMemcpyN", ""); #endif for (register int n = size / 8; n > 0; --n, from += 8, to += 8) { to[0] = from[0]; to[1] = from[1]; to[2] = from[2]; to[3] = from[3]; to[4] = from[4]; to[5] = from[5]; to[6] = from[6]; to[7] = from[7]; } switch (size % 8) { case 7: to[6] = from[6]; case 6: to[5] = from[5]; case 5: to[4] = from[4]; case 4: to[3] = from[3]; case 3: to[2] = from[2]; case 2: to[1] = from[1]; case 1: to[0] = from[0]; case 0: break; } #endif #else CoinCopyN(from, size, to); #endif } #else template inline void CoinMemcpyN(const T * COIN_RESTRICT from, int size, T* COIN_RESTRICT to) { #ifdef USE_MEMCPY std::memcpy(to,from,size*sizeof(T)); #else T * COIN_RESTRICT put = to; const T * COIN_RESTRICT get = from; for ( ; 0 inline void CoinMemcpy(register const T* first, register const T* last, register T* to) { CoinMemcpyN(first, static_cast(last - first), to); } //############################################################################# /** This helper function fills an array with a given value. For speed 8 entries are filled at a time. The array is given by a pointer to its first entry and its size. Note JJF - the speed claim seems to be false on IA32 so I have added CoinZero to allow for memset. */ template inline void CoinFillN(register T* to, const int size, register const T value) { if (size == 0) return; #ifndef NDEBUG if (size < 0) throw CoinError("trying to fill negative number of entries", "CoinFillN", ""); #endif #if 1 for (register int n = size / 8; n > 0; --n, to += 8) { to[0] = value; to[1] = value; to[2] = value; to[3] = value; to[4] = value; to[5] = value; to[6] = value; to[7] = value; } switch (size % 8) { case 7: to[6] = value; case 6: to[5] = value; case 5: to[4] = value; case 4: to[3] = value; case 3: to[2] = value; case 2: to[1] = value; case 1: to[0] = value; case 0: break; } #else // Use Duff's device to fill register int n = (size + 7) / 8; --to; switch (size % 8) { case 0: do{ *++to = value; case 7: *++to = value; case 6: *++to = value; case 5: *++to = value; case 4: *++to = value; case 3: *++to = value; case 2: *++to = value; case 1: *++to = value; }while(--n>0); } #endif } //----------------------------------------------------------------------------- /** This helper function fills an array with a given value. For speed 8 entries are filled at a time. The array is given by its first and "after last" entry. */ template inline void CoinFill(register T* first, register T* last, const T value) { CoinFillN(first, last - first, value); } //############################################################################# /** This helper function fills an array with zero. For speed 8 entries are filled at a time. The array is given by a pointer to its first entry and its size. Note JJF - the speed claim seems to be false on IA32 so I have allowed for memset as an alternative */ template inline void CoinZeroN(register T* to, const int size) { #ifdef USE_MEMCPY // Use memset - seems faster on Intel with gcc #ifndef NDEBUG // Some debug so check if (size < 0) throw CoinError("trying to fill negative number of entries", "CoinZeroN", ""); #endif memset(to,0,size*sizeof(T)); #else if (size == 0) return; #ifndef NDEBUG if (size < 0) throw CoinError("trying to fill negative number of entries", "CoinZeroN", ""); #endif #if 1 for (register int n = size / 8; n > 0; --n, to += 8) { to[0] = 0; to[1] = 0; to[2] = 0; to[3] = 0; to[4] = 0; to[5] = 0; to[6] = 0; to[7] = 0; } switch (size % 8) { case 7: to[6] = 0; case 6: to[5] = 0; case 5: to[4] = 0; case 4: to[3] = 0; case 3: to[2] = 0; case 2: to[1] = 0; case 1: to[0] = 0; case 0: break; } #else // Use Duff's device to fill register int n = (size + 7) / 8; --to; switch (size % 8) { case 0: do{ *++to = 0; case 7: *++to = 0; case 6: *++to = 0; case 5: *++to = 0; case 4: *++to = 0; case 3: *++to = 0; case 2: *++to = 0; case 1: *++to = 0; }while(--n>0); } #endif #endif } /// This Debug helper function checks an array is all zero inline void CoinCheckDoubleZero(double * to, const int size) { int n=0; for (int j=0;j inline void CoinZero(register T* first, register T* last) { CoinZeroN(first, last - first); } //############################################################################# /** Returns strdup or NULL if original NULL */ inline char * CoinStrdup(const char * name) { char* dup = NULL; if (name) { const int len = static_cast(strlen(name)); dup = static_cast(malloc(len+1)); CoinMemcpyN(name, len, dup); dup[len] = 0; } return dup; } //############################################################################# /** Return the larger (according to operator<() of the arguments. This function was introduced because for some reason compiler tend to handle the max() function differently. */ template inline T CoinMax(register const T x1, register const T x2) { return (x1 > x2) ? x1 : x2; } //----------------------------------------------------------------------------- /** Return the smaller (according to operator<() of the arguments. This function was introduced because for some reason compiler tend to handle the min() function differently. */ template inline T CoinMin(register const T x1, register const T x2) { return (x1 < x2) ? x1 : x2; } //----------------------------------------------------------------------------- /** Return the absolute value of the argument. This function was introduced because for some reason compiler tend to handle the abs() function differently. */ template inline T CoinAbs(const T value) { return value<0 ? -value : value; } //############################################################################# /** This helper function tests whether the entries of an array are sorted according to operator<. The array is given by a pointer to its first entry and by its size. */ template inline bool CoinIsSorted(register const T* first, const int size) { if (size == 0) return true; #ifndef NDEBUG if (size < 0) throw CoinError("negative number of entries", "CoinIsSorted", ""); #endif #if 1 // size1 is the number of comparisons to be made const int size1 = size - 1; for (register int n = size1 / 8; n > 0; --n, first += 8) { if (first[8] < first[7]) return false; if (first[7] < first[6]) return false; if (first[6] < first[5]) return false; if (first[5] < first[4]) return false; if (first[4] < first[3]) return false; if (first[3] < first[2]) return false; if (first[2] < first[1]) return false; if (first[1] < first[0]) return false; } switch (size1 % 8) { case 7: if (first[7] < first[6]) return false; case 6: if (first[6] < first[5]) return false; case 5: if (first[5] < first[4]) return false; case 4: if (first[4] < first[3]) return false; case 3: if (first[3] < first[2]) return false; case 2: if (first[2] < first[1]) return false; case 1: if (first[1] < first[0]) return false; case 0: break; } #else register const T* next = first; register const T* last = first + size; for (++next; next != last; first = next, ++next) if (*next < *first) return false; #endif return true; } //----------------------------------------------------------------------------- /** This helper function tests whether the entries of an array are sorted according to operator<. The array is given by its first and "after last" entry. */ template inline bool CoinIsSorted(register const T* first, register const T* last) { return CoinIsSorted(first, static_cast(last - first)); } //############################################################################# /** This helper function fills an array with the values init, init+1, init+2, etc. For speed 8 entries are filled at a time. The array is given by a pointer to its first entry and its size. */ template inline void CoinIotaN(register T* first, const int size, register T init) { if (size == 0) return; #ifndef NDEBUG if (size < 0) throw CoinError("negative number of entries", "CoinIotaN", ""); #endif #if 1 for (register int n = size / 8; n > 0; --n, first += 8, init += 8) { first[0] = init; first[1] = init + 1; first[2] = init + 2; first[3] = init + 3; first[4] = init + 4; first[5] = init + 5; first[6] = init + 6; first[7] = init + 7; } switch (size % 8) { case 7: first[6] = init + 6; case 6: first[5] = init + 5; case 5: first[4] = init + 4; case 4: first[3] = init + 3; case 3: first[2] = init + 2; case 2: first[1] = init + 1; case 1: first[0] = init; case 0: break; } #else // Use Duff's device to fill register int n = (size + 7) / 8; --first; --init; switch (size % 8) { case 0: do{ *++first = ++init; case 7: *++first = ++init; case 6: *++first = ++init; case 5: *++first = ++init; case 4: *++first = ++init; case 3: *++first = ++init; case 2: *++first = ++init; case 1: *++first = ++init; }while(--n>0); } #endif } //----------------------------------------------------------------------------- /** This helper function fills an array with the values init, init+1, init+2, etc. For speed 8 entries are filled at a time. The array is given by its first and "after last" entry. */ template inline void CoinIota(T* first, const T* last, T init) { CoinIotaN(first, last-first, init); } //############################################################################# /** This helper function deletes certain entries from an array. The array is given by pointers to its first and "after last" entry (first two arguments). The positions of the entries to be deleted are given in the integer array specified by the last two arguments (again, first and "after last" entry). */ template inline T * CoinDeleteEntriesFromArray(register T * arrayFirst, register T * arrayLast, const int * firstDelPos, const int * lastDelPos) { int delNum = static_cast(lastDelPos - firstDelPos); if (delNum == 0) return arrayLast; if (delNum < 0) throw CoinError("trying to delete negative number of entries", "CoinDeleteEntriesFromArray", ""); int * delSortedPos = NULL; if (! (CoinIsSorted(firstDelPos, lastDelPos) && std::adjacent_find(firstDelPos, lastDelPos) == lastDelPos)) { // the positions of the to be deleted is either not sorted or not unique delSortedPos = new int[delNum]; CoinDisjointCopy(firstDelPos, lastDelPos, delSortedPos); std::sort(delSortedPos, delSortedPos + delNum); delNum = static_cast(std::unique(delSortedPos, delSortedPos+delNum) - delSortedPos); } const int * delSorted = delSortedPos ? delSortedPos : firstDelPos; const int last = delNum - 1; int size = delSorted[0]; for (int i = 0; i < last; ++i) { const int copyFirst = delSorted[i] + 1; const int copyLast = delSorted[i+1]; CoinCopy(arrayFirst + copyFirst, arrayFirst + copyLast, arrayFirst + size); size += copyLast - copyFirst; } const int copyFirst = delSorted[last] + 1; const int copyLast = static_cast(arrayLast - arrayFirst); CoinCopy(arrayFirst + copyFirst, arrayFirst + copyLast, arrayFirst + size); size += copyLast - copyFirst; if (delSortedPos) delete[] delSortedPos; return arrayFirst + size; } //############################################################################# #define COIN_OWN_RANDOM_32 #if defined COIN_OWN_RANDOM_32 /* Thanks to Stefano Gliozzi for providing an operating system independent random number generator. */ /*! \brief Return a random number between 0 and 1 A platform-independent linear congruential generator. For a given seed, the generated sequence is always the same regardless of the (32-bit) architecture. This allows to build & test in different environments, getting in most cases the same optimization path. Set \p isSeed to true and supply an integer seed to set the seed (vid. #CoinSeedRandom) \todo Anyone want to volunteer an upgrade for 64-bit architectures? */ inline double CoinDrand48 (bool isSeed = false, unsigned int seed = 1) { static unsigned int last = 123456; if (isSeed) { last = seed; } else { last = 1664525*last+1013904223; return ((static_cast (last))/4294967296.0); } return (0.0); } /// Set the seed for the random number generator inline void CoinSeedRandom(int iseed) { CoinDrand48(true, iseed); } #else // COIN_OWN_RANDOM_32 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN32__) /// Return a random number between 0 and 1 inline double CoinDrand48() { return rand() / (double) RAND_MAX; } /// Set the seed for the random number generator inline void CoinSeedRandom(int iseed) { srand(iseed + 69822); } #else /// Return a random number between 0 and 1 inline double CoinDrand48() { return drand48(); } /// Set the seed for the random number generator inline void CoinSeedRandom(int iseed) { srand48(iseed + 69822); } #endif #endif // COIN_OWN_RANDOM_32 //############################################################################# /** This function figures out whether file names should contain slashes or backslashes as directory separator */ inline char CoinFindDirSeparator() { int size = 1000; char* buf = 0; while (true) { buf = new char[size]; if (getcwd(buf, size)) break; delete[] buf; buf = 0; size = 2*size; } // if first char is '/' then it's unix and the dirsep is '/'. otherwise we // assume it's dos and the dirsep is '\' char dirsep = buf[0] == '/' ? '/' : '\\'; delete[] buf; return dirsep; } //############################################################################# inline int CoinStrNCaseCmp(const char* s0, const char* s1, const size_t len) { for (size_t i = 0; i < len; ++i) { if (s0[i] == 0) { return s1[i] == 0 ? 0 : -1; } if (s1[i] == 0) { return 1; } const int c0 = std::tolower(s0[i]); const int c1 = std::tolower(s1[i]); if (c0 < c1) return -1; if (c0 > c1) return 1; } return 0; } //############################################################################# /// Swap the arguments. template inline void CoinSwap (T &x, T &y) { T t = x; x = y; y = t; } //############################################################################# /** This helper function copies an array to file Returns 0 if OK, 1 if bad write. */ template inline int CoinToFile( const T* array, CoinBigIndex size, FILE * fp) { CoinBigIndex numberWritten; if (array&&size) { numberWritten = static_cast(fwrite(&size,sizeof(int),1,fp)); if (numberWritten!=1) return 1; numberWritten = static_cast(fwrite(array,sizeof(T),size_t(size),fp)); if (numberWritten!=size) return 1; } else { size = 0; numberWritten = static_cast(fwrite(&size,sizeof(int),1,fp)); if (numberWritten!=1) return 1; } return 0; } //############################################################################# /** This helper function copies an array from file and creates with new. Passed in array is ignored i.e. not deleted. But if NULL and size does not match and newSize 0 then leaves as NULL and 0 Returns 0 if OK, 1 if bad read, 2 if size did not match. */ template inline int CoinFromFile( T* &array, CoinBigIndex size, FILE * fp, CoinBigIndex & newSize) { CoinBigIndex numberRead; numberRead = static_cast(fread(&newSize,sizeof(int),1,fp)); if (numberRead!=1) return 1; int returnCode=0; if (size!=newSize&&(newSize||array)) returnCode=2; if (newSize) { array = new T [newSize]; numberRead = static_cast(fread(array,sizeof(T),newSize,fp)); if (numberRead!=newSize) returnCode=1; } else { array = NULL; } return returnCode; } //############################################################################# /// Cube Root #if 0 inline double CoinCbrt(double x) { #if defined(_MSC_VER) return pow(x,(1./3.)); #else return cbrt(x); #endif } #endif //----------------------------------------------------------------------------- /// This helper returns "sizeof" as an int #define CoinSizeofAsInt(type) (static_cast(sizeof(type))) /// This helper returns "strlen" as an int inline int CoinStrlenAsInt(const char * string) { return static_cast(strlen(string)); } /** Class for thread specific random numbers */ #if defined COIN_OWN_RANDOM_32 class CoinThreadRandom { public: /**@name Constructors, destructor */ //@{ /** Default constructor. */ CoinThreadRandom() { seed_=12345678;} /** Constructor wih seed. */ CoinThreadRandom(int seed) { seed_ = seed; } /** Destructor */ ~CoinThreadRandom() {} // Copy CoinThreadRandom(const CoinThreadRandom & rhs) { seed_ = rhs.seed_;} // Assignment CoinThreadRandom& operator=(const CoinThreadRandom & rhs) { if (this != &rhs) { seed_ = rhs.seed_; } return *this; } //@} /**@name Sets/gets */ //@{ /** Set seed. */ inline void setSeed(int seed) { seed_ = seed; } /** Get seed. */ inline unsigned int getSeed() const { return seed_; } /// return a random number inline double randomDouble() const { double retVal; seed_ = 1664525*(seed_)+1013904223; retVal = ((static_cast (seed_))/4294967296.0); return retVal; } /// make more random (i.e. for startup) inline void randomize(int n=0) { if (!n) n=seed_ & 255; for (int i=0;i #include //#define PRESOLVE_DEBUG 1 // Debugging macros/functions //#define PRESOLVE_DETAIL 1 #include "CoinPresolveMatrix.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolveDupcol.hpp" #include "CoinSort.hpp" #include "CoinFinite.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPresolveUseless.hpp" #include "CoinMessage.hpp" #if PRESOLVE_DEBUG || PRESOLVE_CONSISTENCY #include "CoinPresolvePsdebug.hpp" #endif #define DSEED2 2147483647.0 // Can be used from anywhere void coin_init_random_vec(double *work, int n) { double deseed = 12345678.0; for (int i = 0; i < n; ++i) { deseed *= 16807.; int jseed = static_cast (deseed / DSEED2); deseed -= static_cast (jseed) * DSEED2; double random = deseed / DSEED2; work[i]=random; } } namespace { // begin unnamed file-local namespace /* For each candidate major-dimension vector in majcands, calculate the sum over the vector, with each minor dimension weighted by a random amount. (E.g., calculate column sums with each row weighted by a random amount.) The sums are returned in the corresponding entries of majsums. */ void compute_sums (int /*n*/, const int *majlens, const CoinBigIndex *majstrts, int *minndxs, double *elems, const double *minmuls, int *majcands, double *majsums, int nlook) { for (int cndx = 0 ; cndx < nlook ; ++cndx) { int i = majcands[cndx] ; PRESOLVEASSERT(majlens[i] > 0) ; CoinBigIndex kcs = majstrts[i] ; CoinBigIndex kce = kcs + majlens[i] ; double value = 0.0 ; for (CoinBigIndex k = kcs ; k < kce ; k++) { int irow = minndxs[k] ; value += minmuls[irow]*elems[k] ; } majsums[cndx] = value ; } return ; } void create_col (int col, int n, double *els, CoinBigIndex *mcstrt, double *colels, int *hrow, int *link, CoinBigIndex *free_listp) { int *rows = reinterpret_cast(els+n) ; CoinBigIndex free_list = *free_listp; int xstart = NO_LINK; for (int i=0; i= 0) ; free_list = link[free_list]; hrow[k] = rows[i]; colels[k] = els[i]; link[k] = xstart; xstart = k; } mcstrt[col] = xstart; *free_listp = free_list; } } // end unnamed file-local namespace const char *dupcol_action::name () const { return ("dupcol_action"); } /* Original comment: This is just ekkredc5, adapted into the new framework. The datasets scorpion.mps and allgrade.mps have duplicate columns. In case you don't have your OSL manual handy, a somewhat more informative explanation: We're looking for an easy-to-detect special case of linearly dependent columns, where the coefficients of the duplicate columns are exactly equal. The idea for locating such columns is to generate pseudo- random weights for each row and then calculate the weighted sum of coefficients of each column. Columns with equal sums are checked more thoroughly. Analysis of the situation says there are two major cases: * If the columns have equal objective coefficients, we can combine them. * If the columns have unequal objective coefficients, we may be able to fix one at bound. If the required bound doesn't exist, we have dual infeasibility (hence one of primal infeasibility or unboundedness). In the comments below are a few fragments of code from the original routine. I don't think they make sense, but I've left them for the nonce in case someone else recognises the purpose. -- lh, 040909 -- */ const CoinPresolveAction *dupcol_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering dupcol_action::presolve." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int startEmptyRows = 0 ; int startEmptyColumns = 0 ; startEmptyRows = prob->countEmptyRows() ; startEmptyColumns = prob->countEmptyCols() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0; if (prob->tuning_) startTime = CoinCpuTime() ; # endif # endif double maxmin = prob->maxmin_ ; double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; int ncols = prob->ncols_ ; int nrows = prob->nrows_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *sol = prob->sol_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; // If all coefficients positive do more simply bool allPositive=true; double * rhs = prob->usefulRowDouble_; //new double[nrows]; CoinMemcpyN(rup,nrows,rhs); /* Scan the columns for candidates, and write the indices into sort. We're not interested in columns that are empty, prohibited, or integral. Question: Should we exclude singletons, which are useful in other transforms? Question: Why are we excluding integral columns? */ // allow integral columns if asked for bool allowIntegers = ((prob->presolveOptions_&0x01) != 0) ; int *sort = prob->usefulColumnInt_; //new int[ncols] ; int nlook = 0 ; for (int j = 0 ; j < ncols ; j++) { if (hincol[j] == 0) continue ; // sort CoinSort_2(hrow+mcstrt[j],hrow+mcstrt[j]+hincol[j], colels+mcstrt[j]); // check all positive and adjust rhs if (allPositive) { double lower = clo[j]; if (lowercolProhibited2(j)) continue ; //#define PRESOLVE_INTEGER_DUPCOL #ifndef PRESOLVE_INTEGER_DUPCOL if (prob->isInteger(j)&&!allowIntegers) continue ; #endif sort[nlook++] = j ; } if (nlook == 0) { //delete[] sort ; //delete [] rhs; return (next) ; } /* Prep: add the coefficients of each candidate column. To reduce false positives, multiply each row by a `random' multiplier when forming the sums. On return from compute_sums, sort and colsum are loaded with the indices and column sums, respectively, of candidate columns. The pair of arrays are then sorted by sum so that equal sums are adjacent. */ double *colsum = prob->usefulColumnDouble_; //new double[ncols] ; double *rowmul; if (!prob->randomNumber_) { rowmul = new double[nrows] ; coin_init_random_vec(rowmul,nrows) ; } else { rowmul = prob->randomNumber_; } compute_sums(ncols,hincol,mcstrt,hrow,colels,rowmul,sort,colsum,nlook) ; #define USE_LBS 0 #define SWAP_SIGNS 0 #if SWAP_SIGNS int nPiece=0; // array to chain piecewise linear int * piece = new int [ncols]; for (int i=0;iclink_ ; double *rowels = prob->rowels_ ; int *hcol = prob->hcol_ ; const CoinBigIndex *mrstrt = prob->mrstrt_ ; int *hinrow = prob->hinrow_ ; double *dcost = prob->cost_ ; action *actions = new action [nlook] ; int nactions = 0 ; # ifdef ZEROFAULT memset(actions,0,nlook*sizeof(action)) ; # endif int *fixed_down = new int[nlook] ; int nfixed_down = 0 ; int *fixed_up = new int[nlook] ; int nfixed_up = 0 ; #if 0 // Excluded in the original routine. I'm guessing it's excluded because // it's just not cost effective to worry about this. -- lh, 040908 -- // It may be the case that several columns are duplicate. // If not all have the same cost, then we have to make sure // that we set the most expensive one to its minimum // now sort in each class by cost { double dval = colsum[0] ; int first = 0 ; for (int jj = 1; jj < nlook; jj++) { while (colsum[jj]==dval) jj++ ; if (first + 1 < jj) { double buf[jj - first] ; for (int i=first; i 1 && isorted < j1) { CoinSort_2(hrow+mcstrt[j1],hrow+mcstrt[j1]+len1, colels+mcstrt[j1]) ; isorted = j1 ; } if (len2 > 1 && isorted < j2) { CoinSort_2(hrow+kcs,hrow+kcs+len2,colels+kcs) ; isorted = j2 ; } CoinBigIndex k ; for (k = kcs ; k < kce ; k++) { if (hrow[k] != hrow[k+ishift] || colels[k] != colels[k+ishift]) { break ; } } #if SWAP_SIGNS if (k != kce) { if (allPositive) { tgt = jj ; continue ; } else { // try negative for (k = kcs ; k < kce ; k++) { if (hrow[k] != hrow[k+ishift] || colels[k] != -colels[k+ishift]) { break ; } } if (k == kce) { nPiece++; if (piece[j1]<0&&piece[j2]<0) { piece[j1]=j2; piece[j2]=j1; } else if (piece[j1]<0) { int j3=piece[j2]; piece[j2]=j1; piece[j1]=j3; } } tgt = jj ; continue ; } } #else if (k != kce) { tgt = jj ; continue ; } #endif /* These really are duplicate columns. Grab values for convenient reference. Convert the objective coefficients for minimization. */ double clo1 = clo[j1] ; double cup1 = cup[j1] ; double clo2 = clo[j2] ; double cup2 = cup[j2] ; double c1 = dcost[j1]*maxmin ; double c2 = dcost[j2]*maxmin ; PRESOLVEASSERT(!(clo1 == cup1 || clo2 == cup2)) ; // Get reasonable bounds on sum of two variables double lowerBound=-COIN_DBL_MAX; double upperBound=COIN_DBL_MAX; #if USE_LBS == 0 // For now only if lower bounds are zero bool takeColumn= (!clo1&&!clo2); #else bool takeColumn= true; if (clo1||clo2) printf("DUPCOL %d and %d have nonzero lbs %g %g\n", j1,j2,clo1,clo2); #endif if (takeColumn) { // Only need bounds if c1 != c2 if (c1!=c2) { if (!allPositive) { #if 0 for (k=kcs;k 0.0) { if (PRESOLVE_INF <= ub) { posinf = true; if (neginf) break; // pointless } else { maxup += ub * coeff; } if (lb <= -PRESOLVE_INF) { neginf = true; if (posinf) break; // pointless } else { maxdown += lb * coeff; } } else { if (PRESOLVE_INF <= ub) { neginf = true; if (posinf) break; // pointless } else { maxdown += ub * coeff; } if (lb <= -PRESOLVE_INF) { posinf = true; if (neginf) break; // pointless } else { maxup += lb * coeff; } } } if (kk==kre) { assert (value1); if (value1>1.0e-5) { if (!neginf&&rup[iRow]<1.0e10) if (upperBound*value1>rup[iRow]-maxdown) upperBound = (rup[iRow]-maxdown)/value1; if (!posinf&&rlo[iRow]>-1.0e10) if (lowerBound*value1rup[iRow]-maxdown) { #ifndef NDEBUG double x=lowerBound; #endif lowerBound = (rup[iRow]-maxdown)/value1; assert (lowerBound == CoinMax(x,(rup[iRow]-maxdown)/value1)); } if (!posinf&&rlo[iRow]>-1.0e10) if (upperBound*value1recomputeSums(-1); // get min max gotStuff=true; } int positiveInf=0; int negativeInf=0; double lo=0; double up=0.0; if (clo1<-PRESOLVE_INF) negativeInf++; else lo+=clo1; if (clo2<-PRESOLVE_INF) negativeInf++; else lo+=clo2; if (cup1>PRESOLVE_INF) positiveInf++; else up+=cup1; if (cup2>PRESOLVE_INF) positiveInf++; else up+=cup2; for (k=kcs;k0.0) ? positiveInf : negativeInf; int nInf = (value>0.0) ? negativeInf : positiveInf; int posinf = prob->infiniteUp_[iRow]-pInf; int neginf = prob->infiniteDown_[iRow]-nInf; if (posinf>0&&neginf>0) continue; // this row can't bound double maxup = prob->sumUp_[iRow]; double maxdown = prob->sumDown_[iRow]; if (value>0.0) { maxdown -= value*lo; maxup -= value*up; } else { maxdown -= value*up; maxup -= value*lo; } if (value>1.0e-5) { if (!neginf&&rup[iRow]<1.0e10) if (upperBound*value>rup[iRow]-maxdown) upperBound = (rup[iRow]-maxdown)/value; if (!posinf&&rlo[iRow]>-1.0e10) if (lowerBound*valuerup[iRow]-maxdown) { lowerBound = (rup[iRow]-maxdown)/value; } if (!posinf&&rlo[iRow]>-1.0e10) if (upperBound*valuerhs[iRow]) upperBound = rhs[iRow]/value; } } } // relax a bit upperBound -= 1.0e-9; } else { // Not sure what to do so give up continue; } /* There are two main cases: The objective coefficients are equal or unequal. For equal objective coefficients c1 == c2, we can combine the columns by making the substitution x = x' - x. This will eliminate column sort[jj] = j2 and leave the new variable x' in column sort[tgt] = j1. tgt doesn't move. */ if (c1 == c2) { #ifdef PRESOLVE_INTEGER_DUPCOL if (!allowIntegers) { if (prob->isInteger(j1)) { if (!prob->isInteger(j2)) { if (cup2 < upperBound) //if (!prob->colInfinite(j2)) continue; else cup2 = COIN_DBL_MAX; } } else if (prob->isInteger(j2)) { if (cup1 < upperBound) //if (!prob->colInfinite(j1)) continue; else cup1 = COIN_DBL_MAX; } //printf("TakingINTeq\n"); } #endif /* As far as the presolved lp, there's no difference between columns. But we need this relation to hold in order to guarantee that we can split the value of the combined column during postsolve without damaging the basis. (The relevant case is when the combined column is basic --- we need to be able to retain column j1 in the basis and make column j2 nonbasic.) */ if (!(clo2+cup1 <= clo1+cup2)) { CoinSwap(j1,j2) ; CoinSwap(clo1,clo2) ; CoinSwap(cup1,cup2) ; tgt = jj ; } /* Create the postsolve action before we start to modify the columns. */ # if PRESOLVE_DEBUG > 1 PRESOLVE_STMT(printf("DUPCOL: (%d,%d) %d += %d\n",j1,j2,j1,j2)) ; PRESOLVE_DETAIL_PRINT(printf("pre_dupcol %dC %dC E\n",j2,j1)); # endif action *s = &actions[nactions++] ; s->thislo = clo[j2] ; s->thisup = cup[j2] ; s->lastlo = clo[j1] ; s->lastup = cup[j1] ; s->ithis = j2 ; s->ilast = j1 ; s->nincol = hincol[j2] ; s->colels = presolve_dupmajor(colels,hrow,hincol[j2],mcstrt[j2]) ; /* Combine the columns into column j1. Upper and lower bounds and solution simply add, and the coefficients are unchanged. I'm skeptical of pushing a bound to infinity like this, but leave it for now. -- lh, 040908 -- */ clo1 += clo2 ; if (clo1 < -1.0e20) { clo1 = -PRESOLVE_INF ; } clo[j1] = clo1 ; cup1 += cup2 ; if (cup1 > 1.0e20) { cup1 = PRESOLVE_INF ; } cup[j1] = cup1 ; if (sol) { sol[j1] += sol[j2] ; } if (prob->colstat_) { if (prob->getColumnStatus(j1) == CoinPrePostsolveMatrix::basic || prob->getColumnStatus(j2) == CoinPrePostsolveMatrix::basic) { prob->setColumnStatus(j1,CoinPrePostsolveMatrix::basic); } } /* Empty column j2. */ dcost[j2] = 0.0 ; if (sol) { sol[j2] = clo2 ; } CoinBigIndex k2cs = mcstrt[j2] ; CoinBigIndex k2ce = k2cs + hincol[j2] ; for (CoinBigIndex k = k2cs ; k < k2ce ; ++k) { presolve_delete_from_row(hrow[k],j2,mrstrt,hinrow,hcol,rowels) ; } hincol[j2] = 0 ; PRESOLVE_REMOVE_LINK(clink,j2) ; continue ; } /* Unequal reduced costs. In this case, we may be able to fix one of the columns or prove dual infeasibility. Given column a_k, duals y, objective coefficient c_k, the reduced cost cbar_k = c_k - dot(y,a_k). Given a_1 = a_2, substitute for dot(y,a_1) in the relation for cbar_2 to get cbar_2 = (c_2 - c_1) + cbar_1 Independent elements here are variable bounds l_k, u_k, and difference (c_2 - c_1). Infinite bounds for l_k, u_k will constrain the sign of cbar_k. Assume minimization. If you do the case analysis, you find these cases of interest: l_1 u_1 l_2 u_2 cbar_1 c_2-c_1 cbar_2 result A any finite -inf any <= 0 > 0 <= 0 x_1 -> NBUB B -inf any any finite <= 0 < 0 < 0 x_2 -> NBUB C finite any any +inf >= 0 < 0 >= 0 x_1 -> NBLB D any +inf finite any >= 0 > 0 >= 0 x_2 -> NBLB E -inf any any +inf <= 0 < 0 >= 0 dual infeas F any inf -inf any >= 0 > 0 <= 0 dual infeas G any finite finite any > 0 no inference H finite any any finite < 0 no inference The cases labelled dual infeasible are primal unbounded. To keep the code compact, we'll always aim to take x_2 to bound. In the cases where x_1 should go to bound, we'll swap. The implementation is boolean algebra. Define bits for infinite bounds and (c_2 > c_1), then look for the correct patterns. */ else { int minterm = 0 ; #ifdef PRESOLVE_INTEGER_DUPCOL if (!allowIntegers) { if (c2 > c1) { if (cup1 < upperBound/*!prob->colInfinite(j1)*/ && (prob->isInteger(j1)||prob->isInteger(j2))) continue ; } else { if (cup2 < upperBound/*!prob->colInfinite(j2)*/ && (prob->isInteger(j1)||prob->isInteger(j2))) continue ; } //printf("TakingINTne\n"); } #endif bool swapped = false ; #if PRESOLVE_DEBUG > 1 printf("bounds %g %g\n",lowerBound,upperBound); #endif if (c2 > c1) minterm |= 1<<0 ; if (cup2 >= PRESOLVE_INF/*prob->colInfinite(j2)*/) minterm |= 1<<1 ; if (clo2 <= -PRESOLVE_INF) minterm |= 1<<2 ; if (cup1 >= PRESOLVE_INF/*prob->colInfinite(j1)*/) minterm |= 1<<3 ; if (clo1 <= -PRESOLVE_INF) minterm |= 1<<4 ; // for now be careful - just one special case if (!clo1&&!clo2) { if (c2 > c1 && cup1 >= upperBound) minterm |= 1<<3; else if (c2 < c1 && cup2 >= upperBound) minterm |= 1<<1; } /* The most common case in a well-formed system should be no inference. We're looking for x00x1 (case G) and 0xx00 (case H). This is where we have the potential to miss inferences: If there are three or more columns with the same sum, sort[tgt] == j1 will only be compared to the second in the group. */ if ((minterm&0x0d) == 0x1 || (minterm&0x13) == 0) { tgt = jj ; continue ; } /* Next remove the unbounded cases, 1xx10 and x11x1. */ if ((minterm&0x13) == 0x12 || (minterm&0x0d) == 0x0d) { prob->setStatus(2) ; # if PRESOLVE_DEBUG > 1 PRESOLVE_STMT(printf("DUPCOL: (%d,%d) Unbounded\n",j1,j2)) ; # endif break ; } /* With the no inference and unbounded cases removed, all that's left are the cases where we can push a variable to bound. Swap if necessary (x01x1 or 0xx10) so that we're always fixing index j2. This means that column sort[tgt] = j1 will be fixed. Unswapped, we fix column sort[jj] = j2. */ if ((minterm&0x0d) == 0x05 || (minterm&0x13) == 0x02) { CoinSwap(j1, j2) ; CoinSwap(clo1, clo2) ; CoinSwap(cup1, cup2) ; CoinSwap(c1, c2) ; int tmp1 = minterm&0x18 ; int tmp2 = minterm&0x06 ; int tmp3 = minterm&0x01 ; minterm = (tmp1>>2)|(tmp2<<2)|(tmp3^0x01) ; swapped = true ; } /* Force x_2 to upper bound? (Case B, boolean 1X100, where X == don't care.) */ if ((minterm&0x13) == 0x10) { fixed_up[nfixed_up++] = j2 ; # if PRESOLVE_DEBUG > 1 PRESOLVE_STMT(printf("DUPCOL: (%d,%d) %d -> NBUB\n",j1,j2,j2)) ; # endif if (prob->colstat_) { if (prob->getColumnStatus(j1) == CoinPrePostsolveMatrix::basic || prob->getColumnStatus(j2) == CoinPrePostsolveMatrix::basic) { prob->setColumnStatus(j1,CoinPrePostsolveMatrix::basic) ; } prob->setColumnStatus(j2,CoinPrePostsolveMatrix::atUpperBound) ; } if (sol) { double delta2 = cup2-sol[j2] ; sol[j2] = cup2 ; sol[j1] -= delta2 ; } if (swapped) { tgt = jj ; } continue ; } /* Force x_2 to lower bound? (Case C, boolean X1011.) */ if ((minterm&0x0d) == 0x09) { fixed_down[nfixed_down++] = j2 ; # if PRESOLVE_DEBUG > 1 PRESOLVE_STMT(printf("DUPCOL: (%d,%d) %d -> NBLB\n",j1,j2,j2)) ; # endif if (prob->colstat_) { if (prob->getColumnStatus(j1) == CoinPrePostsolveMatrix::basic || prob->getColumnStatus(j2) == CoinPrePostsolveMatrix::basic) { prob->setColumnStatus(j1,CoinPrePostsolveMatrix::basic) ; } prob->setColumnStatus(j2,CoinPrePostsolveMatrix::atLowerBound) ; } if (sol) { double delta2 = clo2-sol[j2] ; sol[j2] = clo2 ; sol[j1] -= delta2 ; } if (swapped) { tgt = jj ; } continue ; } } /* We should never reach this point in the loop --- all cases force a new iteration or loop termination. If we get here, something happened that we didn't anticipate. */ PRESOLVE_STMT(printf("DUPCOL: (%d,%d) UNEXPECTED!\n",j1,j2)) ; } /* What's left? Deallocate vectors, and call make_fixed_action to handle any variables that were fixed to bound. */ if (rowmul != prob->randomNumber_) delete[] rowmul ; #if SWAP_SIGNS if (nPiece) { nPiece=0; int nTotal=0; for (int i=0;i0) { nPiece++; nTotal += number; } } } printf("%d odd duplicates in %d groups\n",nTotal,nPiece); // now build real structures // to test fix and adjust nPiece=0; nTotal=0; for (int i=0;i1.0e50) up=COIN_DBL_MAX; if (lo==-COIN_DBL_MAX&&up==COIN_DBL_MAX) { printf("Help - free variable %d\n",i); } nPiece++; nTotal += number; } } printf("Pass two %d odd duplicates in %d groups\n",nTotal,nPiece); } delete [] piece; #endif //delete[] colsum ; //delete[] sort ; //delete [] rhs; # if PRESOLVE_SUMMARY || PRESOLVE_DEBUG if (nactions+nfixed_down+nfixed_up > 0) { printf("DUPLICATE COLS: %d combined, %d lb, %d ub\n", nactions,nfixed_down,nfixed_up) ; } # endif if (nactions) { next = new dupcol_action(nactions,CoinCopyOfArray(actions,nactions),next) ; // we can't go round again in integer prob->presolveOptions_ |= 0x80000000; } deleteAction(actions,action*) ; if (nfixed_down) { next = make_fixed_action::presolve(prob,fixed_down,nfixed_down,true,next) ; } delete[]fixed_down ; if (nfixed_up) { next = make_fixed_action::presolve(prob,fixed_up,nfixed_up,false,next) ; } delete[]fixed_up ; # if COIN_PRESOLVE_TUNING > 0 double thisTime=0.0; if (prob->tuning_) thisTime = CoinCpuTime() ; # endif # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_sol(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving dupcol_action::presolve, " << droppedRows << " rows, " << droppedColumns << " columns dropped" ; # if COIN_PRESOLVE_TUNING > 0 std::cout << " in " << thisTime-startTime << "s" ; # endif std::cout << "." << std::endl ; # endif return (next) ; } void dupcol_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_; const int nactions = nactions_; double *clo = prob->clo_; double *cup = prob->cup_; double *sol = prob->sol_; double *dcost = prob->cost_; double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; int *link = prob->link_; double *rcosts = prob->rcosts_; double tolerance = prob->ztolzb_; for (const action *f = &actions[nactions-1]; actions<=f; f--) { int icol = f->ithis; // was fixed int icol2 = f->ilast; // was kept dcost[icol] = dcost[icol2]; clo[icol] = f->thislo; cup[icol] = f->thisup; clo[icol2] = f->lastlo; cup[icol2] = f->lastup; create_col(icol,f->nincol,f->colels,mcstrt,colels,hrow,link, &prob->free_list_) ; # if PRESOLVE_CONSISTENCY presolve_check_free_list(prob) ; # endif // hincol[icol] = hincol[icol2]; // right? - no - has to match number in create_col hincol[icol] = f->nincol; double l_j = f->thislo; double u_j = f->thisup; double l_k = f->lastlo; double u_k = f->lastup; double x_k_sol = sol[icol2]; PRESOLVE_DETAIL_PRINT(printf("post icol %d %g %g %g icol2 %d %g %g %g\n", icol,clo[icol],sol[icol],cup[icol], icol2,clo[icol2],sol[icol2],cup[icol2])); if (l_j>-PRESOLVE_INF&& x_k_sol-l_j>=l_k-tolerance&&x_k_sol-l_j<=u_k+tolerance) { // j at lb, leave k prob->setColumnStatus(icol,CoinPrePostsolveMatrix::atLowerBound); sol[icol] = l_j; sol[icol2] = x_k_sol - sol[icol]; } else if (u_j=l_k-tolerance&&x_k_sol-u_j<=u_k+tolerance) { // j at ub, leave k prob->setColumnStatus(icol,CoinPrePostsolveMatrix::atUpperBound); sol[icol] = u_j; sol[icol2] = x_k_sol - sol[icol]; } else if (l_k>-PRESOLVE_INF&& x_k_sol-l_k>=l_j-tolerance&&x_k_sol-l_k<=u_j+tolerance) { // k at lb make j basic prob->setColumnStatus(icol,prob->getColumnStatus(icol2)); sol[icol2] = l_k; sol[icol] = x_k_sol - l_k; prob->setColumnStatus(icol2,CoinPrePostsolveMatrix::atLowerBound); } else if (u_k=l_j-tolerance&&x_k_sol-u_k<=u_j+tolerance) { // k at ub make j basic prob->setColumnStatus(icol,prob->getColumnStatus(icol2)); sol[icol2] = u_k; sol[icol] = x_k_sol - u_k; prob->setColumnStatus(icol2,CoinPrePostsolveMatrix::atUpperBound); } else { // both free! superbasic time sol[icol] = 0.0; // doesn't matter prob->setColumnStatus(icol,CoinPrePostsolveMatrix::isFree); } PRESOLVE_DETAIL_PRINT(printf("post2 icol %d %g icol2 %d %g\n", icol,sol[icol], icol2,sol[icol2])); // row activity doesn't change // dj of both variables is the same rcosts[icol] = rcosts[icol2]; // leave until destructor // deleteAction(f->colels,double *); # if PRESOLVE_DEBUG > 0 const double ztolzb = prob->ztolzb_; if (! (clo[icol] - ztolzb <= sol[icol] && sol[icol] <= cup[icol] + ztolzb)) printf("BAD DUPCOL BOUNDS: %g %g %g\n", clo[icol], sol[icol], cup[icol]); if (! (clo[icol2] - ztolzb <= sol[icol2] && sol[icol2] <= cup[icol2] + ztolzb)) printf("BAD DUPCOL BOUNDS: %g %g %g\n", clo[icol2], sol[icol2], cup[icol2]); # endif } // leave until desctructor // deleteAction(actions_,action *); } dupcol_action::~dupcol_action() { for (int i = nactions_-1; i >= 0; --i) { deleteAction(actions_[i].colels, double *); } deleteAction(actions_, action*); } /* Routines for duplicate rows. This is definitely unfinished --- there's no postsolve action. */ const char *duprow_action::name () const { return ("duprow_action"); } // This is just ekkredc4, adapted into the new framework. /* I've made minimal changes for compatibility with dupcol: An initial scan to accumulate rows of interest in sort. -- lh, 040909 -- */ const CoinPresolveAction *duprow_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { double startTime = 0.0; int startEmptyRows=0; int startEmptyColumns = 0; if (prob->tuning_) { startTime = CoinCpuTime(); startEmptyRows = prob->countEmptyRows(); startEmptyColumns = prob->countEmptyCols(); } double *rowels = prob->rowels_; int *hcol = prob->hcol_; CoinBigIndex *mrstrt = prob->mrstrt_; int *hinrow = prob->hinrow_; int ncols = prob->ncols_; int nrows = prob->nrows_; /* Scan the rows for candidates, and write the indices into sort. We're not interested in rows that are empty or prohibited. Question: Should we exclude singletons, which are useful in other transforms? Question: Why are we excluding integral columns? */ int *sort = new int[nrows] ; int nlook = 0 ; for (int i = 0 ; i < nrows ; i++) { if (hinrow[i] == 0) continue ; if (prob->rowProhibited2(i)) continue ; // sort CoinSort_2(hcol+mrstrt[i],hcol+mrstrt[i]+hinrow[i], rowels+mrstrt[i]); sort[nlook++] = i ; } if (nlook == 0) { delete[] sort ; return (next) ; } double * workrow = new double[nrows+1]; double * workcol; if (!prob->randomNumber_) { workcol = new double[ncols+1]; coin_init_random_vec(workcol, ncols); } else { workcol = prob->randomNumber_; } compute_sums(nrows,hinrow,mrstrt,hcol,rowels,workcol,sort,workrow,nlook); CoinSort_2(workrow,workrow+nlook,sort); double *rlo = prob->rlo_; double *rup = prob->rup_; int nuseless_rows = 0; bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; bool allowIntersection = ((prob->presolveOptions_&0x10) != 0) ; double tolerance = prob->feasibilityTolerance_; if (0) { static int xxxxxx=0; int n=0; double dval = workrow[0]; int ilastX=0; xxxxxx++; for (int jj = 1; jj < nlook; jj++) { if (workrow[jj]!=dval) { n+= jj-ilastX-1; //if (jj>ilastX+2) //printf("%d matches\n",jj-ilastX); ilastX=jj; dval=workrow[jj]; } } printf("may be able to delete %d rows - pass %d\n",n,xxxxxx); } double dval = workrow[0]; for (int jj = 1; jj < nlook; jj++) { if (workrow[jj]==dval) { int ithis=sort[jj]; int ilast=sort[jj-1]; CoinBigIndex krs = mrstrt[ithis]; CoinBigIndex kre = krs + hinrow[ithis]; if (hinrow[ithis] == hinrow[ilast]) { int ishift = mrstrt[ilast] - krs; CoinBigIndex k; for (k=krs;k1.0e-14) { break; } } if (k != kre&&false) { int rows[2]; rows[0]=ithis; rows[1]=ilast; for (int k=0;k<2;k++) { int kRow=rows[k]; CoinBigIndex krs = mrstrt[kRow]; CoinBigIndex kre = krs + hinrow[kRow]; printf("%g <=",rlo[kRow]); for (CoinBigIndex k1=krs;k1status_|= 1; // wrong message - correct if works prob->messageHandler()->message(COIN_PRESOLVE_ROWINFEAS, prob->messages()) <rlo2 if (rup1<=rup2) { /* last is strictly tighter than this */ idelete=ithis; PRESOLVE_DETAIL_PRINT(printf("pre_duprow %dR %dR E\n",ithis,ilast)); // swap so can carry on deleting sort[jj-1]=ithis; sort[jj]=ilast; } else { /* overlapping - could merge */ // rlo1>rlo2 // rup1>rup2 if (rup2status_|= 1; // wrong message - correct if works prob->messageHandler()->message(COIN_PRESOLVE_ROWINFEAS, prob->messages()) <=0) sort[nuseless_rows++]=idelete; } } } dval=workrow[jj]; } delete[]workrow; if(workcol != prob->randomNumber_) delete[]workcol; if (nuseless_rows) { # if PRESOLVE_SUMMARY printf("DUPLICATE ROWS: %d\n", nuseless_rows); # endif next = useless_constraint_action::presolve(prob, sort, nuseless_rows, next); } delete[]sort; if (prob->tuning_) { double thisTime=CoinCpuTime(); int droppedRows = prob->countEmptyRows() - startEmptyRows ; int droppedColumns = prob->countEmptyCols() - startEmptyColumns; printf("CoinPresolveDuprow(256) - %d rows, %d columns dropped in time %g, total %g\n", droppedRows,droppedColumns,thisTime-startTime,thisTime-prob->startTime_); } return (next); } void duprow_action::postsolve(CoinPostsolveMatrix *) const { printf("STILL NO POSTSOLVE FOR DUPROW!\n"); abort(); } #include "CoinFactorization.hpp" const char *duprow3_action::name () const { return ("duprow3_action"); } // This is just ekkredc4, adapted into the new framework. /* I've made minimal changes for compatibility with dupcol: An initial scan to accumulate rows of interest in sort. -- lh, 040909 -- */ const CoinPresolveAction *duprow3_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { double startTime = 0.0; if (prob->tuning_) { startTime = CoinCpuTime(); } //double *rowels = prob->rowels_; //int *hcol = prob->hcol_; //CoinBigIndex *mrstrt = prob->mrstrt_; int *hinrow = prob->hinrow_; double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; double * rowLower = prob->rlo_; double * rowUpper = prob->rup_; double * columnLower = prob->clo_; double * columnUpper = prob->cup_; int ncols = prob->ncols_; int nrows = prob->nrows_; int numberDropped=0; int numberRows = 0; int * columnMap = prob->usefulColumnInt_; //new int[ncols] ; int * columnBack = columnMap+ncols; int * rowMap = new int [2*nrows]; int * rowBack = rowMap+nrows; #define SKIP_RHS int numberRhs=0; for (int i=0;i1) { if (rowLower[i]) { numberRhs++; #ifdef SKIP_RHS rowBack[i]=-1; continue; #endif } rowBack[i]=numberRows; rowMap[numberRows++]=i; } else { rowBack[i]=-1; } } if (numberRows=0) { n++; double value=fabs(colels[j]); minValue[iRow]=CoinMin(minValue[iRow],value); maxValue[iRow]=CoinMax(maxValue[iRow],value); } } if (n) { nElements += n; columnBack[i]=numberColumns; columnMap[numberColumns++]=i; } else { columnBack[i]=-1; } } } //printf("%d columns %d elements\n",numberColumns,nElements); CoinFactorization factorization; factorization.setDenseThreshold(0); CoinPackedMatrix matrix(true,0.0,0.0); matrix.reserve(numberColumns,nElements); int maxDimension = CoinMax(numberRows,numberColumns); matrix.setDimensions(maxDimension,numberColumns); double * element = matrix.getMutableElements(); int * row = matrix.getMutableIndices(); CoinBigIndex * columnStart = matrix.getMutableVectorStarts(); CoinBigIndex * columnLength = matrix.getMutableVectorLengths(); // scale rows for (int i=0;i=0) { row[nElements]=iRow; element[nElements++]=minValue[iRow]*colels[j]; } } columnLength[i]=nElements-columnStart[i]; columnStart[i+1]=nElements; } matrix.setNumElements(nElements); int * rowIsBasic = new int[maxDimension]; int * columnIsBasic = new int[maxDimension]; //int numberBasic=0; for (int i=0;i1.0e-7) { //printf("bad %d %d real row %d rhs %g - computed %g\n", // i,iRow,iRealRow,rowLower[iRealRow],minValue[iRow]); } else { badRow[numberDropped++]=iRealRow; } } } else { for (int i=0;ituning_) { double thisTime=CoinCpuTime(); printf("CoinPresolveDuprow3 - %d rows dropped in time %g, total %g\n", numberDropped,thisTime-startTime,thisTime-prob->startTime_); } #ifdef CLP_INVESTIGATE printf("CoinPresolveDuprow3 - %d rows dropped\n",numberDropped); #endif return (next); } void duprow3_action::postsolve(CoinPostsolveMatrix *) const { printf("STILL NO POSTSOLVE FOR DUPROW3!\n"); abort(); } /* Routines for gub rows. This is definitely unfinished --- there's no postsolve action. This is potentially called from ClpPresolve and OsiPresolve. Unclear that it can be backed out --- there's no postsolve. */ const char *gubrow_action::name () const { return ("gubrow_action"); } const CoinPresolveAction *gubrow_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { double startTime = 0.0; int droppedElements=0; int affectedRows=0; if (prob->tuning_) { startTime = CoinCpuTime(); } double *rowels = prob->rowels_; int *hcol = prob->hcol_; CoinBigIndex *mrstrt = prob->mrstrt_; int *hinrow = prob->hinrow_; double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; int ncols = prob->ncols_; int nrows = prob->nrows_; double *rlo = prob->rlo_; double *rup = prob->rup_; /* Scan the rows. We're not interested in rows that are empty or prohibited. */ int *which = prob->usefulRowInt_; int * number = which + nrows; double * els = prob->usefulRowDouble_; char * markCol = reinterpret_cast (prob->usefulColumnInt_); memset(markCol,0,ncols); CoinZeroN(els,nrows); for (int i = 0 ; i < nrows ; i++) { int nInRow = hinrow[i]; if (nInRow>1 &&!prob->rowProhibited2(i)&&rlo[i]==rup[i]) { CoinBigIndex rStart = mrstrt[i]; CoinBigIndex k = rStart; CoinBigIndex rEnd = rStart+nInRow; double value1=rowels[k]; k++; for (;krlink_,iRow) ; double value =(rlo[i]/value1)*els[iRow]; // correct rhs if (rlo[iRow]>-1.0e20) rlo[iRow] -= value; if (rup[iRow]<1.0e20) rup[iRow] -= value; } els[iRow]=0.0; } for (k=rStart;ktuning_) { double thisTime=CoinCpuTime(); printf("CoinPresolveGubrow(1024) - %d elements dropped (%d rows) in time %g, total %g\n", droppedElements,affectedRows,thisTime-startTime,thisTime-prob->startTime_); } else if (droppedElements) { #ifdef CLP_INVESTIGATE printf("CoinPresolveGubrow(1024) - %d elements dropped (%d rows)\n", droppedElements,affectedRows); #endif } return (next); } void gubrow_action::postsolve(CoinPostsolveMatrix *) const { printf("STILL NO POSTSOLVE FOR GUBROW!\n"); abort(); } /* Routines for two by two blocks. This is definitely unfinished --- there's no postsolve action. */ const char *twoxtwo_action::name () const { return ("twoxtwo_action"); } const CoinPresolveAction *twoxtwo_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { double startTime = 0.0; int startEmptyRows=0; int startEmptyColumns = 0; if (prob->tuning_) { startTime = CoinCpuTime(); startEmptyRows = prob->countEmptyRows(); startEmptyColumns = prob->countEmptyCols(); } // maximum number of records action * boundRecords = new action[(prob->nrows_+1)>>1]; int nactions=0; // column-major representation const int ncols = prob->ncols_ ; const CoinBigIndex *const mcstrt = prob->mcstrt_ ; const int *const hincol = prob->hincol_ ; const int *const hrow = prob->hrow_ ; const double * colels = prob->colels_ ; double * cost = prob->cost_ ; // column type, bounds, solution, and status const unsigned char *const integerType = prob->integerType_ ; double * clo = prob->clo_ ; double * cup = prob->cup_ ; // row-major representation //const int nrows = prob->nrows_ ; const CoinBigIndex *const mrstrt = prob->mrstrt_ ; const int *const hinrow = prob->hinrow_ ; const int *const hcol = prob->hcol_ ; const double * rowels = prob->rowels_ ; // row bounds double * rlo = prob->rlo_ ; double * rup = prob->rup_ ; // tolerances //const double ekkinf2 = PRESOLVE_SMALL_INF ; //const double ekkinf = ekkinf2*1.0e8 ; //const double ztolcbarj = prob->ztoldj_ ; //const CoinRelFltEq relEq(prob->ztolzb_) ; double bound[2]; double alpha[2]={0.0,0.0}; double offset=0.0; for (int icol=0;icol-1.0e30) { if (rup[row0]>1.0e30) { swapSigns0=true; rowUpper0=-rlo[row0]; element0=-element0; } else { // range or equality continue; } } else if (rup[row0]>1.0e30) { // free continue; } #if 0 // skip here for speed // skip if no cost (should be able to get rid of) if (!cost[icol]) { PRESOLVE_DETAIL_PRINT(printf("should be able to get rid of %d with no cost\n",icol)); continue; } // skip if negative cost for now if (cost[icol]<0.0) { PRESOLVE_DETAIL_PRINT(printf("code for negative cost\n")); continue; } #endif double element1 = colels[start+1]; double rowUpper1=rup[row1]; bool swapSigns1=false; if (rlo[row1]>-1.0e30) { if (rup[row1]>1.0e30) { swapSigns1=true; rowUpper1=-rlo[row1]; element1=-element1; } else { // range or equality continue; } } else if (rup[row1]>1.0e30) { // free continue; } double lowerX=clo[icol]; double upperX=cup[icol]; int otherCol=-1; CoinBigIndex startRow=mrstrt[row0]; for (CoinBigIndex j=startRow;j0.0) { if (value<0.0) infLow0 =true; } else if (alpha[0]<0.0) { if (value>0.0) infLow0 =true; } if (alpha[1]>0.0) { if (value<0.0) infLow1 =true; } else if (alpha[1]<0.0) { if (value>0.0) infLow1 =true; } } /* Got sums */ double thisLowest0=-COIN_DBL_MAX; double thisHighest0=COIN_DBL_MAX; if (element0>0.0) { // upper bound unless inf&2 !=0 if (!infLow0) thisHighest0 = (rowUpper0-sum0)/element0; } else { // lower bound unless inf&2 !=0 if (!infLow0) thisLowest0 = (rowUpper0-sum0)/element0; } double thisLowest1=-COIN_DBL_MAX; double thisHighest1=COIN_DBL_MAX; if (element1>0.0) { // upper bound unless inf&2 !=0 if (!infLow1) thisHighest1 = (rowUpper1-sum1)/element1; } else { // lower bound unless inf&2 !=0 if (!infLow1) thisLowest1 = (rowUpper1-sum1)/element1; } if (thisLowest0>thisLowest1+1.0e-12) { if (thisLowest0>lowerX+1.0e-12) binding0|= 1<thisLowest0+1.0e-12) { if (thisLowest1>lowerX+1.0e-12) binding1|= 1<=0.0) { if (highestLowest=lowerX&&highestHighest<1.0e30) { highestHighest=CoinMin(highestHighest,highestLowest); } } if (cost[icol]<=0.0) { if (lowestHighest>lowerX&&lowestHighest<=upperX&&lowestHighest>-1.0e30) { lowestLowest=CoinMax(lowestLowest,lowestHighest); } } #if 1 if (lowestLowest>lowerX+1.0e-8) { PRESOLVE_DETAIL_PRINT(printf("Can increase lower bound on %d from %g to %g\n", icol,lowerX,lowestLowest)); lowerX=lowestLowest; } if (highestHighest0 so will be at lower //double yValueAtBound0=newLower; newUpper=CoinMax(newUpper,CoinMax(yValue0,yValue1)); xValue=bound[1]; yValue0=(rowUpper0-xValue*alpha[0])/element0; yValue1=(rowUpper1-xValue*alpha[1])/element1; PRESOLVE_DETAIL_PRINT(printf("value of %d is %g, value of %d is max(%g,%g) - %g\n", otherCol,xValue,icol,yValue0,yValue1,CoinMax(yValue0,yValue1))); newLower=CoinMin(newLower,CoinMax(yValue0,yValue1)); // cost>0 so will be at lower //double yValueAtBound1=newLower; newUpper=CoinMax(newUpper,CoinMax(yValue0,yValue1)); lowerX=CoinMax(lowerX,newLower-1.0e-12*fabs(newLower)); upperX=CoinMin(upperX,newUpper+1.0e-12*fabs(newUpper)); // Now make duplicate row // keep row 0 so need to adjust costs so same PRESOLVE_DETAIL_PRINT(printf("Costs for x %g,%g,%g are %g,%g,%g\n", xValueEqual-1.0,xValueEqual,xValueEqual+1.0, costEqual-slope[0],costEqual,costEqual+slope[1])); double costOther=cost[otherCol]+slope[1]; double costThis=cost[icol]+slope[1]*(element0/alpha[0]); xValue=xValueEqual; yValue0=CoinMax((rowUpper0-xValue*alpha[0])/element0,lowerX); double thisOffset=costEqual-(costOther*xValue+costThis*yValue0); offset += thisOffset; PRESOLVE_DETAIL_PRINT(printf("new cost at equal %g\n",costOther*xValue+costThis*yValue0+thisOffset)); xValue=xValueEqual-1.0; yValue0=CoinMax((rowUpper0-xValue*alpha[0])/element0,lowerX); PRESOLVE_DETAIL_PRINT(printf("new cost at -1 %g\n",costOther*xValue+costThis*yValue0+thisOffset)); assert(fabs((costOther*xValue+costThis*yValue0+thisOffset)-(costEqual-slope[0]))<1.0e-5); xValue=xValueEqual+1.0; yValue0=CoinMax((rowUpper0-xValue*alpha[0])/element0,lowerX); PRESOLVE_DETAIL_PRINT(printf("new cost at +1 %g\n",costOther*xValue+costThis*yValue0+thisOffset)); assert(fabs((costOther*xValue+costThis*yValue0+thisOffset)-(costEqual+slope[1]))<1.0e-5); action & boundRecord = boundRecords[nactions++] ; boundRecord.row=row1; boundRecord.col=icol; boundRecord.othercol=otherCol; boundRecord.lbound_row=rlo[row1]; boundRecord.ubound_row=rup[row1]; boundRecord.lbound_col=clo[icol]; boundRecord.ubound_col=cup[icol]; boundRecord.cost_col=cost[icol]; boundRecord.cost_othercol=cost[otherCol]; cost[otherCol] = costOther; cost[icol] = costThis; clo[icol]=lowerX; cup[icol]=upperX; // make row useless rlo[row1]=-COIN_DBL_MAX; rup[row1]=COIN_DBL_MAX; } } } } if (nactions) { # if PRESOLVE_SUMMARY printf("Cost offset %g - from %d blocks\n",offset,nactions); printf("TWO by TWO blocks: %d - offset %g\n", nactions,offset); # endif action * actions = new action[nactions]; memcpy(actions,boundRecords,nactions*sizeof(action)); next = new twoxtwo_action(nactions,actions,next); int *sort = prob->usefulColumnInt_; for (int i=0;ichange_bias(offset); } delete [] boundRecords; if (prob->tuning_) { double thisTime=CoinCpuTime(); int droppedRows = prob->countEmptyRows() - startEmptyRows ; int droppedColumns = prob->countEmptyCols() - startEmptyColumns; printf("CoinPresolveTwoxtwo(2048) - %d rows, %d columns dropped in time %g, total %g\n", droppedRows,droppedColumns,thisTime-startTime,thisTime-prob->startTime_); } return (next); } void twoxtwo_action::postsolve(CoinPostsolveMatrix * prob) const { const CoinBigIndex *const mcstrt = prob->mcstrt_ ; const int *const hincol = prob->hincol_ ; const int *const hrow = prob->hrow_ ; const double * colels = prob->colels_ ; int *link = prob->link_; double * cost = prob->cost_ ; // column type, bounds, solution, and status //const unsigned char *const integerType = prob->integerType_ ; double * clo = prob->clo_ ; double * cup = prob->cup_ ; // row bounds double * rlo = prob->rlo_ ; double * rup = prob->rup_ ; double *sol = prob->sol_; double *rcosts = prob->rcosts_; double * rowacts = prob->acts_; double * dual = prob->rowduals_; double tolerance = prob->ztolzb_; const double maxmin = prob->maxmin_; for (int iAction=0;iActionsetRowStatus(row1,CoinPrePostsolveMatrix::basic); // put stuff back rlo[row1]=boundRecord.lbound_row; rup[row1]=boundRecord.ubound_row; clo[icol]=boundRecord.lbound_col; cup[icol]=boundRecord.ubound_col; double oldCost=cost[icol]; //double oldOtherCost=cost[otherCol]; cost[icol]=boundRecord.cost_col; cost[otherCol]=boundRecord.cost_othercol; double els0real[2]; double els1real[2]; els0real[0]=els0[0]; els0real[1]=els0[1]; els1real[0]=els1[0]; els1real[1]=els1[1]; // make <= rows double rowUpper0=rup[row0]; if (rlo[row0]>-1.0e30) { rowUpper0=-rlo[row0]; els0[0]=-els0[0]; els0[1]=-els0[1]; } double rowUpper1=rup[row1]; bool swapSigns1=false; if (rlo[row1]>-1.0e30) { swapSigns1=true; rowUpper1=-rlo[row1]; els1[0]=-els1[0]; els1[1]=-els1[1]; } // compute feasible value for icol double valueOther=sol[otherCol]; double value; // first see if at bound is OK bool lowerBoundPossible = clo[icol]>-1.0e30; value=clo[icol]; if (lowerBoundPossible) { double value0 = els0[0]*valueOther + els0[1]*value; if (value0>rowUpper0+tolerance) lowerBoundPossible=false; double value1 = els1[0]*valueOther + els1[1]*value; if (value1>rowUpper1+tolerance) lowerBoundPossible=false; } bool upperBoundPossible = cup[icol]<1.0e30; value=cup[icol]; if (upperBoundPossible) { double value0 = els0[0]*valueOther + els0[1]*value; if (value0>rowUpper0+tolerance) upperBoundPossible=false; double value1 = els1[0]*valueOther + els1[1]*value; if (value1>rowUpper1+tolerance) upperBoundPossible=false; } if (lowerBoundPossible&&cost[icol]>=0.0) { // set to lower bound prob->setColumnStatus(icol,CoinPrePostsolveMatrix::atLowerBound); sol[icol]=clo[icol]; rcosts[icol]=maxmin*cost[icol]-dual[row0]*els0real[1]; } else if (upperBoundPossible&&cost[icol]<=0.0) { // set to upper bound prob->setColumnStatus(icol,CoinPrePostsolveMatrix::atUpperBound); sol[icol]=cup[icol]; rcosts[icol]=maxmin*cost[icol]-dual[row0]*els0real[1]; } else { // need to make basic // we shouldn't get here (at present) if zero cost assert (cost[icol]); double value0 = (rowUpper0-els0[0]*valueOther)/els0[1]; double value1 = (rowUpper1-els1[0]*valueOther)/els1[1]; //bool binding0=true; double value; if (cost[icol]>0) { if (value0>value1) { value=value0; } else { value=value1; //binding0=false; } } else { if (value0getRowStatus(row0), row1,prob->getRowStatus(row1), otherCol,prob->getColumnStatus(otherCol), icol,prob->getColumnStatus(icol),binding0 ? 'T' : 'F'); #endif if (prob->getColumnStatus(icol)==CoinPrePostsolveMatrix::basic) { //printf("col %d above was basic\n",icol); if (prob->getRowStatus(row0)!=CoinPrePostsolveMatrix::basic) { // adjust dual dual[row0]=maxmin*((cost[icol]-oldCost)/els0real[1]); } continue; } //if (binding0) //printf("Says row0 %d binding?\n",row0); prob->setColumnStatus(icol,CoinPrePostsolveMatrix::basic); rcosts[icol]=0.0; //printf("row1 %d taken out of basis\n",row1); if (!swapSigns1) { prob->setRowStatus(row1,CoinPrePostsolveMatrix::atUpperBound); rowacts[row1]=rup[row1]; } else { prob->setRowStatus(row1,CoinPrePostsolveMatrix::atLowerBound); rowacts[row1]=rlo[row1]; } dual[row1]=maxmin*((cost[icol]-oldCost)/els1real[1]); if (iAction==-1) abort(); } } } CoinMP-1.8.3/CoinUtils/src/CoinPresolveSingleton.cpp0000644000175000017500000007600312122060536021016 0ustar renerene/* $Id: CoinPresolveSingleton.cpp 1580 2013-03-19 13:00:14Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" #include "CoinPresolveEmpty.hpp" // for DROP_COL/DROP_ROW #include "CoinPresolveFixed.hpp" #include "CoinPresolveSingleton.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif #include "CoinMessage.hpp" #include "CoinFinite.hpp" /* * Original comment: * * Transfers singleton row bound information to the corresponding column bounds. * What I refer to as a row singleton would be called a doubleton * in the paper, since my terminology doesn't refer to the slacks. * In terms of the paper, we transfer the bounds of the slack onto * the variable (vii) and then "substitute" the slack out of the problem * (which is a noop). */ /* Given blow(i) <= a(ij)x(j) <= b(i), we can transfer the bounds enforced by the constraint to the column bounds l(j) and u(j) on x(j) and delete the row. You can think of this as a specialised instance of doubleton_action, where the target variable is the logical that transforms an inequality to an equality. Since the system doesn't have logicals at this point, the row is a singleton. At some time in the past, the main loop was written to scan all rows but was limited in the number of rows it could process in one call. The notFinished parameter is the only remaining vestige of this behaviour and should probably be removed. For now, make sure it's forced to false for the benefit of code that looks at the returned value. -- lh, 121015 -- */ const CoinPresolveAction * slack_doubleton_action::presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next, bool ¬Finished) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering slack_doubleton_action::presolve." << std::endl ; # endif # if PRESOLVE_CONSISTENCY > 0 presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int startEmptyRows = prob->countEmptyRows() ; int startEmptyColumns = prob->countEmptyCols() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0 ; if (prob->tuning_) { startTime = CoinCpuTime() ; } # endif # endif notFinished = false ; /* Unpack the problem representation. */ double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *rowels = prob->rowels_ ; const int *hcol = prob->hcol_ ; const CoinBigIndex *mrstrt = prob->mrstrt_ ; int *hinrow = prob->hinrow_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; /* Rowstat is used to decide if the solution is present. */ unsigned char *rowstat = prob->rowstat_ ; double *acts = prob->acts_ ; double *sol = prob->sol_ ; const unsigned char *integerType = prob->integerType_ ; const double ztolzb = prob->ztolzb_ ; int numberLook = prob->numberRowsToDo_ ; int *look = prob->rowsToDo_ ; bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; action *actions = new action[numberLook] ; int nactions = 0 ; int *fixed_cols = prob->usefulColumnInt_ ; int nfixed_cols = 0 ; bool infeas = false ; /* Walk the rows looking for singletons. */ for (int iLook = 0 ; iLook < numberLook ; iLook++) { int i = look[iLook] ; if (hinrow[i] != 1) continue ; int j = hcol[mrstrt[i]] ; double aij = rowels[mrstrt[i]] ; double lo = rlo[i] ; double up = rup[i] ; double abs_aij = fabs(aij) ; /* A tiny value of a(ij) invites numerical error, since the new bound will be (something)/a(ij). Columns that are already fixed are also uninteresting. */ if (abs_aij < ZTOLDP2) continue ; if (fabs(cup[j]-clo[j]) < ztolzb) continue ; PRESOLVE_DETAIL_PRINT(printf("pre_singleton %dC %dR E\n",j,i)) ; /* Get down to work. First create the postsolve action for row i / x(j). */ action *s = &actions[nactions] ; nactions++ ; s->col = j ; s->clo = clo[j] ; s->cup = cup[j] ; s->row = i ; s->rlo = rlo[i] ; s->rup = rup[i] ; s->coeff = aij ; # if PRESOLVE_DEBUG > 1 std::cout << " removing row " << i << ": " << rlo[i] << " <= " << aij << "*x(" << j << ") <= " << rup[i] << std::endl ; # endif /* Do the work of bounds transfer. Starting with blow(i) <= a(ij)x(j) <= b(i), we end up with blow(i)/a(ij) <= x(j) <= b(i)/a(ij) a(ij) > 0 blow(i)/a(ij) >= x(j) >= b(i)/a(ij) a(ij) < 0 The code deals with a(ij) < 0 by swapping and negating the row bounds and calculating with |a(ij)|. Be careful not to convert finite infinity to finite, or vice versa. */ if (aij < 0.0) { CoinSwap(lo,up) ; lo = -lo ; up = -up ; } if (lo <= -PRESOLVE_INF) lo = -PRESOLVE_INF ; else { lo /= abs_aij ; if (lo <= -PRESOLVE_INF) lo = -PRESOLVE_INF ; } if (up > PRESOLVE_INF) up = PRESOLVE_INF ; else { up /= abs_aij ; if (up > PRESOLVE_INF) up = PRESOLVE_INF ; } # if PRESOLVE_DEBUG > 2 std::cout << " l(" << j << ") = " << clo[j] << " ==> " << lo << ", delta " << (lo-clo[j]) << std::endl ; std::cout << " u(" << j << ") = " << cup[j] << " ==> " << up << ", delta " << (cup[j]-up) << std::endl ; # endif /* lo and up are now the new l(j) and u(j), respectively. If they're better than the existing bounds, update. Have a care with integer variables --- don't let numerical inaccuracy pull us off an integral bound. */ if (clo[j] < lo) { // If integer be careful if (integerType[j]) { if (fabs(lo-floor(lo+0.5)) < 0.000001) lo = floor(lo+0.5) ; if (clo[j] < lo) clo[j] = lo ; } else { clo[j] = lo ; } } if (cup[j] > up) { if (integerType[j]) { if (fabs(up-floor(up+0.5)) < 0.000001) up = floor(up+0.5) ; if (cup[j] > up) cup[j] = up ; } else { cup[j] = up ; } } /* Is x(j) now fixed? Remember it for later. */ if (fabs(cup[j] - clo[j]) < ZTOLDP) { fixed_cols[nfixed_cols++] = j ; } /* Is x(j) infeasible? Fix it if we're within the feasibility tolerance, or if the user was so foolish as to request repair of infeasibility. Integer values are preferred, if close enough. If the infeasibility is too large to ignore, mark the problem infeasible and head for the exit. */ if (lo > up) { if (lo <= up+prob->feasibilityTolerance_ || fixInfeasibility) { double nearest = floor(lo+0.5) ; if (fabs(nearest-lo)<2.0*prob->feasibilityTolerance_) { lo = nearest ; up = nearest ; } else { lo = up ; } clo[j] = lo ; cup[j] = up ; } else { prob->status_ |= 1 ; prob->messageHandler()->message(COIN_PRESOLVE_COLINFEAS, prob->messages()) << j << lo << up << CoinMessageEol ; infeas = true ; break ; } } # if PRESOLVE_DEBUG > 1 printf("SINGLETON R-%d C-%d\n", i, j) ; # endif /* Remove the row from the row-major representation. */ hinrow[i] = 0 ; PRESOLVE_REMOVE_LINK(prob->rlink_,i) ; rlo[i] = 0.0 ; rup[i] = 0.0 ; /* Remove the row from this col in the column-major representation. It can happen that this will empty the column, in which case we can delink it. If the column isn't empty, queue it for further processing. */ presolve_delete_from_col(i,j,mcstrt,hincol,hrow,colels) ; if (hincol[j] == 0) { PRESOLVE_REMOVE_LINK(prob->clink_,j) ; } else { prob->addCol(j) ; } /* Update the solution, if it's present. The trick is maintaining the right number of basic variables. We've deleted a row, so we need to reduce the basis by one. There's a corner case that doesn't seem to be covered. What happens if both x(j) and s(i) are nonbasic? The number of basic variables will not be reduced. This is admittedly a pathological situation: It implies that there's an existing bound l(j) or u(j) exactly equal to the bound imposed by this constraint, so that x(j) can be nonbasic at bound and the constraint can be simultaneously tight. -- lh, 121115 -- */ if (rowstat) { int basisChoice = 0 ; int numberBasic = 0 ; double movement = 0 ; if (prob->columnIsBasic(j)) { numberBasic++ ; basisChoice = 2 ; // move to row to keep consistent } if (prob->rowIsBasic(i)) numberBasic++ ; PRESOLVEASSERT(numberBasic > 0) ; if (sol[j] <= clo[j]+ztolzb) { movement = clo[j]-sol[j] ; sol[j] = clo[j] ; prob->setColumnStatus(j,CoinPrePostsolveMatrix::atLowerBound) ; } else if (sol[j] >= cup[j]-ztolzb) { movement = cup[j]-sol[j] ; sol[j] = cup[j] ; prob->setColumnStatus(j,CoinPrePostsolveMatrix::atUpperBound) ; } else { basisChoice = 1 ; } if (numberBasic > 1 || basisChoice == 1) prob->setColumnStatus(j,CoinPrePostsolveMatrix::basic) ; else if (basisChoice==2) prob->setRowStatus(i,CoinPrePostsolveMatrix::basic) ; if (movement) { const CoinBigIndex &kcs = mcstrt[j] ; const CoinBigIndex kce = kcs+hincol[j] ; for (CoinBigIndex kcol = kcs ; kcol < kce ; kcol++) { int k = hrow[kcol] ; PRESOLVEASSERT(hinrow[k] > 0) ; acts[k] += movement*colels[kcol] ; } } } } /* Done with processing. Time to deal with the results. First add the postsolve actions for the singletons to the postsolve list. Then call remove_fixed_action to handle variables that were fixed during the loop. (We've already adjusted the solution, so make_fixed_action is not needed.) */ if (!infeas && nactions) { # if PRESOLVE_SUMMARY std::cout << "SINGLETON ROWS: " << nactions << std::endl ; # endif action *save_actions = new action[nactions] ; CoinMemcpyN(actions, nactions, save_actions) ; next = new slack_doubleton_action(nactions,save_actions,next) ; if (nfixed_cols) next = remove_fixed_action::presolve(prob,fixed_cols,nfixed_cols,next) ; } delete[] actions ; # if COIN_PRESOLVE_TUNING > 0 double thisTime ; if (prob->tuning_) double thisTime = CoinCpuTime() ; # endif # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving slack_doubleton_action::presolve, " << droppedRows << " rows, " << droppedColumns << " columns dropped" ; #if COIN_PRESOLVE_TUNING > 0 std::cout << " in " << (thisTime-startTime) << "s, total " << (thisTime-prob->startTime_) ; # endif std::cout << "." << std::endl ; # endif return (next) ; } void slack_doubleton_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_ ; const int nactions = nactions_ ; double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; int *link = prob->link_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *sol = prob->sol_ ; double *rcosts = prob->rcosts_ ; unsigned char *colstat = prob->colstat_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *acts = prob->acts_ ; double *rowduals = prob->rowduals_ ; # if PRESOLVE_DEBUG char *rdone = prob->rdone_ ; std::cout << "Entering slack_doubleton_action::postsolve, " << nactions << " constraints to process." << std::endl ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif CoinBigIndex &free_list = prob->free_list_ ; const double ztolzb = prob->ztolzb_ ; for (const action *f = &actions[nactions-1] ; actions <= f ; f--) { int irow = f->row ; double lo0 = f->clo ; double up0 = f->cup ; double coeff = f->coeff ; int jcol = f->col ; rlo[irow] = f->rlo ; rup[irow] = f->rup ; clo[jcol] = lo0 ; cup[jcol] = up0 ; acts[irow] = coeff*sol[jcol] ; /* Create the row and restore the single coefficient, linking the new coefficient at the start of the column. */ { CoinBigIndex k = free_list ; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list] ; hrow[k] = irow ; colels[k] = coeff ; link[k] = mcstrt[jcol] ; mcstrt[jcol] = k ; hincol[jcol]++ ; } /* Since we are adding a row, we have to set the row status and dual to satisfy complimentary slackness. We may also have to modify the column status and reduced cost if bounds have been relaxed. */ if (!colstat) { // ???? rowduals[irow] = 0.0 ; } else { if (prob->columnIsBasic(jcol)) { /* The variable is basic, hence the slack must be basic, hence the dual for the row is zero. Relaxing the bounds on a basic variable doesn't change anything. */ prob->setRowStatus(irow,CoinPrePostsolveMatrix::basic) ; rowduals[irow] = 0.0 ; } else if ((fabs(sol[jcol]-lo0) <= ztolzb && rcosts[jcol] >= 0) || (fabs(sol[jcol]-up0) <= ztolzb && rcosts[jcol] <= 0)) { /* The variable is nonbasic and the sign of the reduced cost is correct for the bound. Again, the slack will be basic and the dual zero. */ prob->setRowStatus(irow,CoinPrePostsolveMatrix::basic) ; rowduals[irow] = 0.0 ; } else if (!(fabs(sol[jcol]-lo0) <= ztolzb) && !(fabs(sol[jcol]-up0) <= ztolzb)) { /* The variable was not basic but transferring bounds back to the constraint has relaxed the column bounds. The variable will need to be made basic. The constraint must then be tight and the dual must be set so that the reduced cost of the variable becomes zero. */ prob->setColumnStatus(jcol,CoinPrePostsolveMatrix::basic) ; prob->setRowStatusUsingValue(irow) ; rowduals[irow] = rcosts[jcol]/coeff ; rcosts[jcol] = 0.0 ; } else { /* The variable is at bound, but the reduced cost is wrong. Again set the row dual to bring the reduced cost to zero. This implies that the constraint is tight and the slack will be nonbasic. */ prob->setColumnStatus(jcol,CoinPrePostsolveMatrix::basic) ; prob->setRowStatusUsingValue(irow) ; rowduals[irow] = rcosts[jcol]/coeff ; rcosts[jcol] = 0.0 ; } } # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 rdone[irow] = SLACK_DOUBLETON ; # endif } # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 std::cout << "Leaving slack_doubleton_action::postsolve." << std::endl ; # endif return ; } /* If we have a variable with one entry and no cost then we can transform the row from E to G etc. If there is a row objective region then we may be able to do this even with a cost. */ const CoinPresolveAction * slack_singleton_action::presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next, double * rowObjective) { double startTime = 0.0 ; int startEmptyRows=0 ; int startEmptyColumns = 0 ; if (prob->tuning_) { startTime = CoinCpuTime() ; startEmptyRows = prob->countEmptyRows() ; startEmptyColumns = prob->countEmptyCols() ; } double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; //int ncols = prob->ncols_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *rowels = prob->rowels_ ; int *hcol = prob->hcol_ ; CoinBigIndex *mrstrt = prob->mrstrt_ ; int *hinrow = prob->hinrow_ ; int nrows = prob->nrows_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; // Existence of unsigned char *rowstat = prob->rowstat_ ; double *acts = prob->acts_ ; double * sol = prob->sol_ ; const unsigned char *integerType = prob->integerType_ ; const double ztolzb = prob->ztolzb_ ; double *dcost = prob->cost_ ; //const double maxmin = prob->maxmin_ ; # if PRESOLVE_DEBUG std::cout << "Entering slack_singleton_action::presolve." << std::endl ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif int numberLook = prob->numberColsToDo_ ; int iLook ; int * look = prob->colsToDo_ ; // Make sure we allocate at least one action int maxActions = CoinMin(numberLook,nrows/10)+1 ; action * actions = new action[maxActions] ; int nactions = 0 ; int * fixed_cols = new int [numberLook] ; int nfixed_cols=0 ; int nWithCosts=0 ; double costOffset=0.0 ; for (iLook=0;iLookcolProhibited(iCol)) { double currentLower = rlo[iRow] ; double currentUpper = rup[iRow] ; if (!rowObjective) { if (dcost[iCol]) continue ; } else if ((dcost[iCol]&¤tLower!=currentUpper)||rowObjective[iRow]) { continue ; } double newLower=currentLower ; double newUpper=currentUpper ; if (coeff<0.0) { if (currentUpper>1.0e20||cup[iCol]>1.0e20) { newUpper=COIN_DBL_MAX ; } else { newUpper -= coeff*cup[iCol] ; if (newUpper>1.0e20) newUpper=COIN_DBL_MAX ; } if (currentLower<-1.0e20||clo[iCol]<-1.0e20) { newLower=-COIN_DBL_MAX ; } else { newLower -= coeff*clo[iCol] ; if (newLower<-1.0e20) newLower=-COIN_DBL_MAX ; } } else { if (currentUpper>1.0e20||clo[iCol]<-1.0e20) { newUpper=COIN_DBL_MAX ; } else { newUpper -= coeff*clo[iCol] ; if (newUpper>1.0e20) newUpper=COIN_DBL_MAX ; } if (currentLower<-1.0e20||cup[iCol]>1.0e20) { newLower=-COIN_DBL_MAX ; } else { newLower -= coeff*cup[iCol] ; if (newLower<-1.0e20) newLower=-COIN_DBL_MAX ; } } if (integerType&&integerType[iCol]) { // only possible if everything else integer if (newLower>-1.0e30) { if (newLower!=floor(newLower+0.5)) continue ; } if (newUpper<1.0e30) { if (newUpper!=floor(newUpper+0.5)) continue ; } bool allInt=true ; for (CoinBigIndex j=mrstrt[iRow] ; j=maxActions) { maxActions += CoinMin(numberLook-iLook,maxActions) ; action * temp = new action[maxActions] ; memcpy(temp,actions,nactions*sizeof(action)) ; // changed as 4.6 compiler bug! CoinMemcpyN(actions,nactions,temp) ; delete [] actions ; actions=temp ; } action *s = &actions[nactions] ; nactions++ ; s->col = iCol ; s->clo = clo[iCol] ; s->cup = cup[iCol] ; s->row = iRow ; s->rlo = rlo[iRow] ; s->rup = rup[iRow] ; s->coeff = coeff ; presolve_delete_from_row(iRow,iCol,mrstrt,hinrow,hcol,rowels) ; if (!hinrow[iRow]) PRESOLVE_REMOVE_LINK(prob->rlink_,iRow) ; // put row on stack of things to do next time prob->addRow(iRow) ; #ifdef PRINTCOST if (rowObjective&&dcost[iCol]) { printf("Singleton %d had coeff of %g in row %d - bounds %g %g - cost %g\n", iCol,coeff,iRow,clo[iCol],cup[iCol],dcost[iCol]) ; printf("Row bounds were %g %g now %g %g\n", rlo[iRow],rup[iRow],newLower,newUpper) ; } #endif // Row may be redundant but let someone else do that rlo[iRow]=newLower ; rup[iRow]=newUpper ; if (rowstat&&sol) { // update solution and basis if ((sol[iCol] < cup[iCol]-ztolzb&& sol[iCol] > clo[iCol]+ztolzb)||prob->columnIsBasic(iCol)) prob->setRowStatus(iRow,CoinPrePostsolveMatrix::basic) ; prob->setColumnStatusUsingValue(iCol) ; } // Force column to zero clo[iCol]=0.0 ; cup[iCol]=0.0 ; if (rowObjective&&dcost[iCol]) { rowObjective[iRow]=-dcost[iCol]/coeff ; nWithCosts++ ; // adjust offset costOffset += currentLower*rowObjective[iRow] ; prob->dobias_ -= currentLower*rowObjective[iRow] ; } if (sol) { double movement ; if (fabs(sol[iCol]-clo[iCol])clink_,iCol) ; //clo[iCol] = 0.0 ; //cup[iCol] = 0.0 ; fixed_cols[nfixed_cols++] = iCol ; //presolve_consistent(prob) ; } } } if (nactions) { # if PRESOLVE_SUMMARY printf("SINGLETON COLS: %d\n", nactions) ; # endif #ifdef COIN_DEVELOP printf("%d singletons, %d with costs - offset %g\n",nactions, nWithCosts, costOffset) ; #endif action *save_actions = new action[nactions] ; CoinMemcpyN(actions, nactions, save_actions) ; next = new slack_singleton_action(nactions, save_actions, next) ; if (nfixed_cols) next = make_fixed_action::presolve(prob, fixed_cols, nfixed_cols, true, // arbitrary next) ; } delete [] actions ; delete [] fixed_cols ; if (prob->tuning_) { double thisTime=CoinCpuTime() ; int droppedRows = prob->countEmptyRows() - startEmptyRows ; int droppedColumns = prob->countEmptyCols() - startEmptyColumns ; printf("CoinPresolveSingleton(3) - %d rows, %d columns dropped in time %g, total %g\n", droppedRows,droppedColumns,thisTime-startTime,thisTime-prob->startTime_) ; } # if PRESOLVE_DEBUG presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; std::cout << "Leaving slack_singleton_action::presolve." << std::endl ; # endif return (next) ; } void slack_singleton_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_ ; const int nactions = nactions_ ; double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; int *link = prob->link_ ; // int ncols = prob->ncols_ ; //double *rowels = prob->rowels_ ; //int *hcol = prob->hcol_ ; //CoinBigIndex *mrstrt = prob->mrstrt_ ; //int *hinrow = prob->hinrow_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *sol = prob->sol_ ; double *rcosts = prob->rcosts_ ; double *acts = prob->acts_ ; double *rowduals = prob->rowduals_ ; double *dcost = prob->cost_ ; //const double maxmin = prob->maxmin_ ; unsigned char *colstat = prob->colstat_ ; // unsigned char *rowstat = prob->rowstat_ ; # if PRESOLVE_DEBUG char *rdone = prob->rdone_ ; std::cout << "Entering slack_singleton_action::postsolve." << std::endl ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif CoinBigIndex &free_list = prob->free_list_ ; const double ztolzb = prob->ztolzb_ ; #ifdef CHECK_ONE_ROW { double act=0.0 ; for (int i=0;incols_;i++) { double solV = sol[i] ; assert (solV>=clo[i]-ztolzb&&solV<=cup[i]+ztolzb) ; int j=mcstrt[i] ; for (int k=0;k=rlo[CHECK_ONE_ROW]-ztolzb&&act<=rup[CHECK_ONE_ROW]+ztolzb) ; printf("start %g %g %g %g\n",rlo[CHECK_ONE_ROW],act,acts[CHECK_ONE_ROW],rup[CHECK_ONE_ROW]) ; } #endif for (const action *f = &actions[nactions-1]; actions<=f; f--) { int iRow = f->row ; double lo0 = f->clo ; double up0 = f->cup ; double coeff = f->coeff ; int iCol = f->col ; assert (!hincol[iCol]) ; #ifdef CHECK_ONE_ROW if (iRow==CHECK_ONE_ROW) printf("Col %d coeff %g old bounds %g,%g new %g,%g - new rhs %g,%g - act %g\n", iCol,coeff,clo[iCol],cup[iCol],lo0,up0,f->rlo,f->rup,acts[CHECK_ONE_ROW]) ; #endif rlo[iRow] = f->rlo ; rup[iRow] = f->rup ; clo[iCol] = lo0 ; cup[iCol] = up0 ; double movement=0.0 ; // acts was without coefficient - adjust acts[iRow] += coeff*sol[iCol] ; if (acts[iRow]rup[iRow]+ztolzb) movement = rup[iRow]-acts[iRow] ; double cMove = movement/coeff ; sol[iCol] += cMove ; acts[iRow] += movement ; if (!dcost[iCol]) { // and to get column feasible cMove=0.0 ; if (sol[iCol]>cup[iCol]+ztolzb) cMove = cup[iCol]-sol[iCol] ; else if (sol[iCol]columnIsBasic(iCol)) numberBasic++ ; if (prob->rowIsBasic(iRow)) numberBasic++ ; #ifdef COIN_DEVELOP if (numberBasic>1) printf("odd in singleton\n") ; #endif if (sol[iCol]>clo[iCol]+ztolzb&&sol[iCol]setColumnStatus(iCol,CoinPrePostsolveMatrix::basic) ; prob->setRowStatusUsingValue(iRow) ; } else if (acts[iRow]>rlo[iRow]+ztolzb&&acts[iRow]setRowStatus(iRow,CoinPrePostsolveMatrix::basic) ; prob->setColumnStatusUsingValue(iCol) ; } else if (numberBasic) { prob->setRowStatus(iRow,CoinPrePostsolveMatrix::basic) ; prob->setColumnStatusUsingValue(iCol) ; } else { prob->setRowStatusUsingValue(iRow) ; prob->setColumnStatusUsingValue(iCol) ; } } # if PRESOLVE_DEBUG > 1 printf("SLKSING: %d = %g restored %d lb = %g ub = %g.\n", iCol,sol[iCol],prob->getColumnStatus(iCol),clo[iCol],cup[iCol]) ; # endif } else { // must have been equality row assert (rlo[iRow]==rup[iRow]) ; double cost = rcosts[iCol] ; // adjust for coefficient cost -= rowduals[iRow]*coeff ; bool basic=true ; if (fabs(sol[iCol]-cup[iCol])1.0e-6) basic=false ; //printf("Singleton %d had coeff of %g in row %d (dual %g) - bounds %g %g - cost %g, (dj %g)\n", // iCol,coeff,iRow,rowduals[iRow],clo[iCol],cup[iCol],dcost[iCol],rcosts[iCol]) ; //if (prob->columnIsBasic(iCol)) //printf("column basic! ") ; //if (prob->rowIsBasic(iRow)) //printf("row basic ") ; //printf("- make column basic %s\n",basic ? "yes" : "no") ; if (basic&&!prob->rowIsBasic(iRow)) { #ifdef PRINTCOST printf("Singleton %d had coeff of %g in row %d (dual %g) - bounds %g %g - cost %g, (dj %g - new %g)\n", iCol,coeff,iRow,rowduals[iRow],clo[iCol],cup[iCol],dcost[iCol],rcosts[iCol],cost) ; #endif #ifdef COIN_DEVELOP if (prob->columnIsBasic(iCol)) printf("column basic!\n") ; #endif basic=false ; } if (fabs(rowduals[iRow])>1.0e-6&&prob->rowIsBasic(iRow)) basic=true ; if (basic) { // Make basic have zero reduced cost rowduals[iRow] = rcosts[iCol] / coeff ; rcosts[iCol] = 0.0 ; } else { rcosts[iCol]=cost ; //rowduals[iRow]=0.0 ; } if (colstat) { if (basic) { if (!prob->rowIsBasic(iRow)) { #if 0 // find column in row int jCol=-1 ; //for (CoinBigIndex j=mrstrt[iRow];jncols0_;k++) { CoinBigIndex j=mcstrt[k] ; for (int i=0;isetColumnStatus(iCol,CoinPrePostsolveMatrix::basic) ; } prob->setRowStatusUsingValue(iRow) ; } else { //prob->setRowStatus(iRow,CoinPrePostsolveMatrix::basic) ; prob->setColumnStatusUsingValue(iCol) ; } } } #if 0 int nb=0 ; int kk ; for (kk=0;kknrows_;kk++) if (prob->rowIsBasic(kk)) nb++ ; for (kk=0;kkncols_;kk++) if (prob->columnIsBasic(kk)) nb++ ; assert (nb==prob->nrows_) ; #endif // add new element { CoinBigIndex k = free_list ; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list] ; hrow[k] = iRow ; colels[k] = coeff ; link[k] = mcstrt[iCol] ; mcstrt[iCol] = k ; } hincol[iCol]++; // right? #ifdef CHECK_ONE_ROW { double act=0.0 ; for (int i=0;incols_;i++) { double solV = sol[i] ; assert (solV>=clo[i]-ztolzb&&solV<=cup[i]+ztolzb) ; int j=mcstrt[i] ; for (int k=0;k=rlo[CHECK_ONE_ROW]-ztolzb&&act<=rup[CHECK_ONE_ROW]+ztolzb) ; printf("rhs now %g %g %g %g\n",rlo[CHECK_ONE_ROW],act,acts[CHECK_ONE_ROW],rup[CHECK_ONE_ROW]) ; } #endif # if PRESOLVE_DEBUG rdone[iRow] = SLACK_SINGLETON ; # endif } # if PRESOLVE_DEBUG presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; std::cout << "Leaving slack_singleton_action::postsolve." << std::endl ; # endif return ; } CoinMP-1.8.3/CoinUtils/src/CoinSimpFactorization.hpp0000644000175000017500000003254611552534611021020 0ustar renerene/* $Id: CoinSimpFactorization.hpp 1416 2011-04-17 09:57:29Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* This is a simple factorization of the LP Basis */ #ifndef CoinSimpFactorization_H #define CoinSimpFactorization_H #include #include #include #include "CoinTypes.hpp" #include "CoinIndexedVector.hpp" #include "CoinDenseFactorization.hpp" class CoinPackedMatrix; /// pointers used during factorization class FactorPointers{ public: double *rowMax; int *firstRowKnonzeros; int *prevRow; int *nextRow; int *firstColKnonzeros; int *prevColumn; int *nextColumn; int *newCols; //constructor FactorPointers( int numRows, int numCols, int *UrowLengths_, int *UcolLengths_ ); // destructor ~ FactorPointers(); }; class CoinSimpFactorization : public CoinOtherFactorization { friend void CoinSimpFactorizationUnitTest( const std::string & mpsDir ); public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor CoinSimpFactorization ( ); /// Copy constructor CoinSimpFactorization ( const CoinSimpFactorization &other); /// Destructor virtual ~CoinSimpFactorization ( ); /// = copy CoinSimpFactorization & operator = ( const CoinSimpFactorization & other ); /// Clone virtual CoinOtherFactorization * clone() const ; //@} /**@name Do factorization - public */ //@{ /// Gets space for a factorization virtual void getAreas ( int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ); /// PreProcesses column ordered copy of basis virtual void preProcess ( ); /** Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use numberGoodColumns and redo */ virtual int factor ( ); /// Does post processing on valid factorization - putting variables on correct rows virtual void postProcess(const int * sequence, int * pivotVariable); /// Makes a non-singular basis by replacing variables virtual void makeNonSingular(int * sequence, int numberColumns); //@} /**@name general stuff such as status */ //@{ /// Total number of elements in factorization virtual inline int numberElements ( ) const { return numberRows_*(numberColumns_+numberPivots_); } /// Returns maximum absolute value in factorization double maximumCoefficient() const; //@} /**@name rank one updates which do exist */ //@{ /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U */ virtual int replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow, double pivotCheck , bool checkBeforeModifying=false, double acceptablePivot=1.0e-8); //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output */ virtual int updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false); /** This version has same effect as above with FTUpdate==false so number returned is always >=0 */ virtual int updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false) const; /// does FTRAN on two columns virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermute=false); /// does updatecolumn if save==true keeps column for replace column int upColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false, bool save=false) const; /** Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output */ virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; /// does updateColumnTranspose, the other is a wrapper int upColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; //@} /// *** Below this user may not want to know about /**@name various uses of factorization which user may not want to know about (left over from my LP code) */ //@{ /// Get rid of all memory inline void clearArrays() { gutsOfDestructor();} /// Returns array to put basis indices in inline int * indices() const { return reinterpret_cast (elements_+numberRows_*numberRows_);} /// Returns permute in virtual inline int * permute() const { return pivotRow_;} //@} /// The real work of destructor void gutsOfDestructor(); /// The real work of constructor void gutsOfInitialize(); /// The real work of copy void gutsOfCopy(const CoinSimpFactorization &other); /// calls factorization void factorize(int numberOfRows, int numberOfColumns, const int colStarts[], const int indicesRow[], const double elements[]); /// main loop of factorization int mainLoopFactor (FactorPointers &pointers ); /// copies L by rows void copyLbyRows(); /// copies U by columns void copyUbyColumns(); /// finds a pivot element using Markowitz count int findPivot(FactorPointers &pointers, int &r, int &s, bool &ifSlack); /// finds a pivot in a shortest column int findPivotShCol(FactorPointers &pointers, int &r, int &s); /// finds a pivot in the first column available int findPivotSimp(FactorPointers &pointers, int &r, int &s); /// does Gauss elimination void GaussEliminate(FactorPointers &pointers, int &r, int &s); /// finds short row that intersects a given column int findShortRow(const int column, const int length, int &minRow, int &minRowLength, FactorPointers &pointers); /// finds short column that intersects a given row int findShortColumn(const int row, const int length, int &minCol, int &minColLength, FactorPointers &pointers); /// finds maximum absolute value in a row double findMaxInRrow(const int row, FactorPointers &pointers); /// does pivoting void pivoting(const int pivotRow, const int pivotColumn, const double invPivot, FactorPointers &pointers); /// part of pivoting void updateCurrentRow(const int pivotRow, const int row, const double multiplier, FactorPointers &pointers, int &newNonZeros); /// allocates more space for L void increaseLsize(); /// allocates more space for a row of U void increaseRowSize(const int row, const int newSize); /// allocates more space for a column of U void increaseColSize(const int column, const int newSize, const bool b); /// allocates more space for rows of U void enlargeUrow(const int numNewElements); /// allocates more space for columns of U void enlargeUcol(const int numNewElements, const bool b); /// finds a given row in a column int findInRow(const int row, const int column); /// finds a given column in a row int findInColumn(const int column, const int row); /// declares a row inactive void removeRowFromActSet(const int row, FactorPointers &pointers); /// declares a column inactive void removeColumnFromActSet(const int column, FactorPointers &pointers); /// allocates space for U void allocateSpaceForU(); /// allocates several working arrays void allocateSomeArrays(); /// initializes some numbers void initialSomeNumbers(); /// solves L x = b void Lxeqb(double *b) const; /// same as above but with two rhs void Lxeqb2(double *b1, double *b2) const; /// solves U x = b void Uxeqb(double *b, double *sol) const; /// same as above but with two rhs void Uxeqb2(double *b1, double *sol1, double *sol2, double *b2) const; /// solves x L = b void xLeqb(double *b) const; /// solves x U = b void xUeqb(double *b, double *sol) const; /// updates factorization after a Simplex iteration int LUupdate(int newBasicCol); /// creates a new eta vector void newEta(int row, int numNewElements); /// makes a copy of row permutations void copyRowPermutations(); /// solves H x = b, where H is a product of eta matrices void Hxeqb(double *b) const; /// same as above but with two rhs void Hxeqb2(double *b1, double *b2) const; /// solves x H = b void xHeqb(double *b) const; /// does FTRAN void ftran(double *b, double *sol, bool save) const; /// same as above but with two columns void ftran2(double *b1, double *sol1, double *b2, double *sol2) const; /// does BTRAN void btran(double *b, double *sol) const; ///--------------------------------------- //@} protected: /** Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular */ int checkPivot(double saveFromU, double oldPivot) const; ////////////////// data ////////////////// protected: /**@name data */ //@{ /// work array (should be initialized to zero) double *denseVector_; /// work array double *workArea2_; /// work array double *workArea3_; /// array of labels (should be initialized to zero) int *vecLabels_; /// array of indices int *indVector_; /// auxiliary vector double *auxVector_; /// auxiliary vector int *auxInd_; /// vector to keep for LUupdate double *vecKeep_; /// indices of this vector int *indKeep_; /// number of nonzeros mutable int keepSize_; /// Starts of the rows of L int *LrowStarts_; /// Lengths of the rows of L int *LrowLengths_; /// L by rows double *Lrows_; /// indices in the rows of L int *LrowInd_; /// Size of Lrows_; int LrowSize_; /// Capacity of Lrows_ int LrowCap_; /// Starts of the columns of L int *LcolStarts_; /// Lengths of the columns of L int *LcolLengths_; /// L by columns double *Lcolumns_; /// indices in the columns of L int *LcolInd_; /// numbers of elements in L int LcolSize_; /// maximum capacity of L int LcolCap_; /// Starts of the rows of U int *UrowStarts_; /// Lengths of the rows of U int *UrowLengths_; #ifdef COIN_SIMP_CAPACITY /// Capacities of the rows of U int *UrowCapacities_; #endif /// U by rows double *Urows_; /// Indices in the rows of U int *UrowInd_; /// maximum capacity of Urows int UrowMaxCap_; /// number of used places in Urows int UrowEnd_; /// first row in U int firstRowInU_; /// last row in U int lastRowInU_; /// previous row in U int *prevRowInU_; /// next row in U int *nextRowInU_; /// Starts of the columns of U int *UcolStarts_; /// Lengths of the columns of U int *UcolLengths_; #ifdef COIN_SIMP_CAPACITY /// Capacities of the columns of U int *UcolCapacities_; #endif /// U by columns double *Ucolumns_; /// Indices in the columns of U int *UcolInd_; /// previous column in U int *prevColInU_; /// next column in U int *nextColInU_; /// first column in U int firstColInU_; /// last column in U int lastColInU_; /// maximum capacity of Ucolumns_ int UcolMaxCap_; /// last used position in Ucolumns_ int UcolEnd_; /// indicator of slack variables int *colSlack_; /// inverse values of the elements of diagonal of U double *invOfPivots_; /// permutation of columns int *colOfU_; /// position of column after permutation int *colPosition_; /// permutations of rows int *rowOfU_; /// position of row after permutation int *rowPosition_; /// permutations of rows during LUupdate int *secRowOfU_; /// position of row after permutation during LUupdate int *secRowPosition_; /// position of Eta vector int *EtaPosition_; /// Starts of eta vectors int *EtaStarts_; /// Lengths of eta vectors int *EtaLengths_; /// columns of eta vectors int *EtaInd_; /// elements of eta vectors double *Eta_; /// number of elements in Eta_ int EtaSize_; /// last eta row int lastEtaRow_; /// maximum number of eta vectors int maxEtaRows_; /// Capacity of Eta_ int EtaMaxCap_; /// minimum storage increase int minIncrease_; /// maximum size for the diagonal of U after update double updateTol_; /// do Shul heuristic bool doSuhlHeuristic_; /// maximum of U double maxU_; /// bound on the growth rate double maxGrowth_; /// maximum of A double maxA_; /// maximum number of candidates for pivot int pivotCandLimit_; /// number of slacks in basis int numberSlacks_; /// number of slacks in irst basis int firstNumberSlacks_; //@} }; #endif CoinMP-1.8.3/CoinUtils/src/Makefile.in0000644000175000017500000010073412506047363016074 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/config_coinutils.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h config_coinutils.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libCoinUtils_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) am_libCoinUtils_la_OBJECTS = CoinAlloc.lo CoinBuild.lo \ CoinDenseVector.lo CoinError.lo CoinFactorization1.lo \ CoinFactorization2.lo CoinFactorization3.lo \ CoinFactorization4.lo CoinSimpFactorization.lo \ CoinDenseFactorization.lo CoinOslFactorization.lo \ CoinOslFactorization2.lo CoinOslFactorization3.lo \ CoinFileIO.lo CoinFinite.lo CoinIndexedVector.lo CoinLpIO.lo \ CoinMessage.lo CoinMessageHandler.lo CoinModel.lo \ CoinStructuredModel.lo CoinModelUseful.lo CoinModelUseful2.lo \ CoinMpsIO.lo CoinPackedMatrix.lo CoinPackedVector.lo \ CoinPackedVectorBase.lo CoinParam.lo CoinParamUtils.lo \ CoinPostsolveMatrix.lo CoinPrePostsolveMatrix.lo \ CoinPresolveDoubleton.lo CoinPresolveDual.lo \ CoinPresolveDupcol.lo CoinPresolveEmpty.lo \ CoinPresolveFixed.lo CoinPresolveForcing.lo \ CoinPresolveHelperFunctions.lo CoinPresolveImpliedFree.lo \ CoinPresolveIsolated.lo CoinPresolveMatrix.lo \ CoinPresolvePsdebug.lo CoinPresolveMonitor.lo \ CoinPresolveSingleton.lo CoinPresolveSubst.lo \ CoinPresolveTighten.lo CoinPresolveTripleton.lo \ CoinPresolveUseless.lo CoinPresolveZeros.lo CoinRational.lo \ CoinSearchTree.lo CoinShallowPackedVector.lo CoinSnapshot.lo \ CoinWarmStartBasis.lo CoinWarmStartVector.lo \ CoinWarmStartDual.lo CoinWarmStartPrimalDual.lo libCoinUtils_la_OBJECTS = $(am_libCoinUtils_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libCoinUtils_la_SOURCES) DIST_SOURCES = $(libCoinUtils_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BLAS_CFLAGS = @BLAS_CFLAGS@ BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ BLAS_DATA = @BLAS_DATA@ BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ BLAS_LIBS = @BLAS_LIBS@ BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ COINUTILSLIB_CFLAGS = @COINUTILSLIB_CFLAGS@ COINUTILSLIB_CFLAGS_INSTALLED = @COINUTILSLIB_CFLAGS_INSTALLED@ COINUTILSLIB_DEPENDENCIES = @COINUTILSLIB_DEPENDENCIES@ COINUTILSLIB_LIBS = @COINUTILSLIB_LIBS@ COINUTILSLIB_LIBS_INSTALLED = @COINUTILSLIB_LIBS_INSTALLED@ COINUTILSLIB_PCLIBS = @COINUTILSLIB_PCLIBS@ COINUTILSLIB_PCREQUIRES = @COINUTILSLIB_PCREQUIRES@ COINUTILS_SVN_REV = @COINUTILS_SVN_REV@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_LAPACK_FALSE = @COIN_HAS_LAPACK_FALSE@ COIN_HAS_LAPACK_TRUE = @COIN_HAS_LAPACK_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_ZLIB_FALSE = @COIN_HAS_ZLIB_FALSE@ COIN_HAS_ZLIB_TRUE = @COIN_HAS_ZLIB_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FLIBS = @FLIBS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAPACK_CFLAGS = @LAPACK_CFLAGS@ LAPACK_CFLAGS_INSTALLED = @LAPACK_CFLAGS_INSTALLED@ LAPACK_DATA = @LAPACK_DATA@ LAPACK_DATA_INSTALLED = @LAPACK_DATA_INSTALLED@ LAPACK_DEPENDENCIES = @LAPACK_DEPENDENCIES@ LAPACK_LIBS = @LAPACK_LIBS@ LAPACK_LIBS_INSTALLED = @LAPACK_LIBS_INSTALLED@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MPIF77 = @MPIF77@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OPT_FFLAGS = @OPT_FFLAGS@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libCoinUtils # ######################################################################## # Name of the library compiled in this directory. # We want it to be installed in the $libdir directory lib_LTLIBRARIES = libCoinUtils.la # List all source files for this library, including headers libCoinUtils_la_SOURCES = \ config_coinutils.h \ CoinUtilsConfig.h \ Coin_C_defines.h \ CoinAlloc.cpp CoinAlloc.hpp \ CoinBuild.cpp CoinBuild.hpp \ CoinDenseVector.cpp CoinDenseVector.hpp \ CoinDistance.hpp \ CoinError.cpp CoinError.hpp \ CoinFactorization.hpp \ CoinFactorization1.cpp \ CoinFactorization2.cpp \ CoinFactorization3.cpp \ CoinFactorization4.cpp \ CoinSimpFactorization.hpp \ CoinSimpFactorization.cpp \ CoinDenseFactorization.hpp \ CoinDenseFactorization.cpp \ CoinOslFactorization.hpp \ CoinOslFactorization.cpp \ CoinOslFactorization2.cpp \ CoinOslFactorization3.cpp \ CoinOslC.h \ CoinFileIO.cpp CoinFileIO.hpp \ CoinFinite.cpp CoinFinite.hpp \ CoinFloatEqual.hpp \ CoinHelperFunctions.hpp \ CoinIndexedVector.cpp CoinIndexedVector.hpp \ CoinLpIO.cpp CoinLpIO.hpp \ CoinMessage.cpp CoinMessage.hpp \ CoinMessageHandler.cpp CoinMessageHandler.hpp \ CoinModel.cpp CoinModel.hpp \ CoinStructuredModel.cpp CoinStructuredModel.hpp \ CoinModelUseful.cpp CoinModelUseful.hpp \ CoinModelUseful2.cpp \ CoinMpsIO.cpp CoinMpsIO.hpp \ CoinPackedMatrix.cpp CoinPackedMatrix.hpp \ CoinPackedVector.cpp CoinPackedVector.hpp \ CoinPackedVectorBase.cpp CoinPackedVectorBase.hpp \ CoinParam.cpp CoinParamUtils.cpp CoinParam.hpp \ CoinPostsolveMatrix.cpp \ CoinPragma.hpp \ CoinPrePostsolveMatrix.cpp \ CoinPresolveDoubleton.cpp CoinPresolveDoubleton.hpp \ CoinPresolveDual.cpp CoinPresolveDual.hpp \ CoinPresolveDupcol.cpp CoinPresolveDupcol.hpp \ CoinPresolveEmpty.cpp CoinPresolveEmpty.hpp \ CoinPresolveFixed.cpp CoinPresolveFixed.hpp \ CoinPresolveForcing.cpp CoinPresolveForcing.hpp \ CoinPresolveHelperFunctions.cpp \ CoinPresolveImpliedFree.cpp CoinPresolveImpliedFree.hpp \ CoinPresolveIsolated.cpp CoinPresolveIsolated.hpp \ CoinPresolveMatrix.cpp CoinPresolveMatrix.hpp \ CoinPresolvePsdebug.cpp CoinPresolvePsdebug.hpp \ CoinPresolveMonitor.cpp CoinPresolveMonitor.hpp \ CoinPresolveSingleton.cpp CoinPresolveSingleton.hpp \ CoinPresolveSubst.cpp CoinPresolveSubst.hpp \ CoinPresolveTighten.cpp CoinPresolveTighten.hpp \ CoinPresolveTripleton.cpp CoinPresolveTripleton.hpp \ CoinPresolveUseless.cpp CoinPresolveUseless.hpp \ CoinPresolveZeros.cpp CoinPresolveZeros.hpp \ CoinRational.cpp CoinRational.hpp \ CoinSearchTree.cpp CoinSearchTree.hpp \ CoinShallowPackedVector.cpp CoinShallowPackedVector.hpp \ CoinSignal.hpp \ CoinSmartPtr.hpp \ CoinSnapshot.cpp CoinSnapshot.hpp \ CoinSort.hpp \ CoinTime.hpp \ CoinTypes.hpp \ CoinUtility.hpp \ CoinWarmStart.hpp \ CoinWarmStartBasis.cpp CoinWarmStartBasis.hpp \ CoinWarmStartVector.cpp CoinWarmStartVector.hpp \ CoinWarmStartDual.cpp CoinWarmStartDual.hpp \ CoinWarmStartPrimalDual.cpp CoinWarmStartPrimalDual.hpp # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libCoinUtils_la_LIBADD = $(COINUTILSLIB_LIBS) # This is for libtool libCoinUtils_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = $(GLPK_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'install/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ Coin_C_defines.h \ CoinAlloc.hpp \ CoinBuild.hpp \ CoinDenseVector.hpp \ CoinDistance.hpp \ CoinError.hpp \ CoinFactorization.hpp \ CoinSimpFactorization.hpp \ CoinDenseFactorization.hpp \ CoinOslFactorization.hpp \ CoinFileIO.hpp \ CoinFinite.hpp \ CoinFloatEqual.hpp \ CoinHelperFunctions.hpp \ CoinIndexedVector.hpp \ CoinLpIO.hpp \ CoinMessage.hpp \ CoinMessageHandler.hpp \ CoinModel.hpp \ CoinStructuredModel.hpp \ CoinModelUseful.hpp \ CoinMpsIO.hpp \ CoinPackedMatrix.hpp \ CoinPackedVector.hpp \ CoinPackedVectorBase.hpp \ CoinParam.hpp \ CoinPragma.hpp \ CoinPresolveDoubleton.hpp \ CoinPresolveDual.hpp \ CoinPresolveDupcol.hpp \ CoinPresolveEmpty.hpp \ CoinPresolveFixed.hpp \ CoinPresolveForcing.hpp \ CoinPresolveImpliedFree.hpp \ CoinPresolveIsolated.hpp \ CoinPresolveMatrix.hpp \ CoinPresolveMonitor.hpp \ CoinPresolvePsdebug.hpp \ CoinPresolveSingleton.hpp \ CoinPresolveSubst.hpp \ CoinPresolveTighten.hpp \ CoinPresolveTripleton.hpp \ CoinPresolveUseless.hpp \ CoinPresolveZeros.hpp \ CoinRational.hpp \ CoinSearchTree.hpp \ CoinShallowPackedVector.hpp \ CoinSignal.hpp \ CoinSmartPtr.hpp \ CoinSnapshot.hpp \ CoinSort.hpp \ CoinTime.hpp \ CoinTypes.hpp \ CoinUtility.hpp \ CoinWarmStart.hpp \ CoinWarmStartBasis.hpp \ CoinWarmStartVector.hpp \ CoinWarmStartDual.hpp \ CoinWarmStartPrimalDual.hpp all: config.h config_coinutils.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ config_coinutils.h: stamp-h2 @if test ! -f $@; then \ rm -f stamp-h2; \ $(MAKE) stamp-h2; \ else :; fi stamp-h2: $(srcdir)/config_coinutils.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status src/config_coinutils.h distclean-hdr: -rm -f config.h stamp-h1 config_coinutils.h stamp-h2 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libCoinUtils.la: $(libCoinUtils_la_OBJECTS) $(libCoinUtils_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libCoinUtils_la_LDFLAGS) $(libCoinUtils_la_OBJECTS) $(libCoinUtils_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAlloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinBuild.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinDenseFactorization.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinDenseVector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinError.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinFactorization1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinFactorization2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinFactorization3.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinFactorization4.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinFileIO.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinFinite.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinIndexedVector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinLpIO.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinMessage.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinMessageHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinModel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinModelUseful.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinModelUseful2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinMpsIO.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinOslFactorization.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinOslFactorization2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinOslFactorization3.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPackedMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPackedVector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPackedVectorBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinParam.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinParamUtils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPostsolveMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPrePostsolveMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveDoubleton.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveDual.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveDupcol.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveEmpty.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveFixed.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveForcing.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveHelperFunctions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveImpliedFree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveIsolated.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveMonitor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolvePsdebug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveSingleton.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveSubst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveTighten.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveTripleton.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveUseless.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinPresolveZeros.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinRational.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinSearchTree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinShallowPackedVector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinSimpFactorization.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinSnapshot.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinStructuredModel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinWarmStartBasis.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinWarmStartDual.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinWarmStartPrimalDual.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinWarmStartVector.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in config_coinutils.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_coinutils.h.in $(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; } \ END { 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) config.h.in config_coinutils.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_coinutils.h.in $(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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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) config.h config_coinutils.h installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-exec-local install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am \ install-exec-local install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local ####################################################################### # Create the Config.h file that has all public defines and install it # ####################################################################### install-exec-local: $(install_sh_DATA) config_coinutils.h $(DESTDIR)$(includecoindir)/CoinUtilsConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/CoinUtilsConfig.h # 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: CoinMP-1.8.3/CoinUtils/src/CoinOslFactorization.cpp0000644000175000017500000012467612130031043020626 0ustar renerene/* $Id: CoinOslFactorization.cpp 1582 2013-04-06 14:33:07Z stefan $ */ // Copyright (C) 1987, 2009, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinUtilsConfig.h" #include #include "CoinPragma.hpp" #include "CoinOslFactorization.hpp" #include "CoinOslC.h" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinTypes.hpp" #include "CoinFinite.hpp" #include static void c_ekksmem(EKKfactinfo *fact,int numberRows,int maximumPivots); static void c_ekksmem_copy(EKKfactinfo *fact,const EKKfactinfo * rhsFact); static void c_ekksmem_delete(EKKfactinfo *fact); //:class CoinOslFactorization. Deals with Factorization and Updates // CoinOslFactorization. Constructor CoinOslFactorization::CoinOslFactorization ( ) : CoinOtherFactorization() { gutsOfInitialize(); } /// Copy constructor CoinOslFactorization::CoinOslFactorization ( const CoinOslFactorization &other) : CoinOtherFactorization(other) { gutsOfInitialize(); gutsOfCopy(other); } // Clone CoinOtherFactorization * CoinOslFactorization::clone() const { return new CoinOslFactorization(*this); } /// The real work of constructors etc void CoinOslFactorization::gutsOfDestructor(bool clearFact) { delete [] elements_; delete [] pivotRow_; delete [] workArea_; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; numberRows_ = 0; numberColumns_ = 0; numberGoodU_ = 0; status_ = -1; maximumRows_=0; maximumSpace_=0; solveMode_=0; if (clearFact) c_ekksmem_delete(&factInfo_); } void CoinOslFactorization::gutsOfInitialize(bool zapFact) { pivotTolerance_ = 1.0e-1; zeroTolerance_ = 1.0e-13; #ifndef COIN_FAST_CODE slackValue_ = -1.0; #endif maximumPivots_=200; relaxCheck_=1.0; numberRows_ = 0; numberColumns_ = 0; numberGoodU_ = 0; status_ = -1; numberPivots_ = 0; maximumRows_=0; maximumSpace_=0; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; solveMode_=0; if (zapFact) { memset(&factInfo_,0,sizeof(factInfo_)); factInfo_.maxinv=100; factInfo_.drtpiv=1.0e-10; factInfo_.zeroTolerance=1.0e-12; factInfo_.zpivlu=0.1; factInfo_.areaFactor=1.0; factInfo_.nbfinv=100; } } // ~CoinOslFactorization. Destructor CoinOslFactorization::~CoinOslFactorization ( ) { gutsOfDestructor(); } // = CoinOslFactorization & CoinOslFactorization::operator = ( const CoinOslFactorization & other ) { if (this != &other) { bool noGood = factInfo_.nrowmx!=other.factInfo_.nrowmx&& factInfo_.eta_size!=other.factInfo_.eta_size; gutsOfDestructor(noGood); gutsOfInitialize(noGood); gutsOfCopy(other); } return *this; } #define WORK_MULT 2 void CoinOslFactorization::gutsOfCopy(const CoinOslFactorization &other) { pivotTolerance_ = other.pivotTolerance_; zeroTolerance_ = other.zeroTolerance_; #ifndef COIN_FAST_CODE slackValue_ = other.slackValue_; #endif relaxCheck_ = other.relaxCheck_; numberRows_ = other.numberRows_; numberColumns_ = other.numberColumns_; maximumRows_ = other.maximumRows_; maximumSpace_ = other.maximumSpace_; solveMode_ = other.solveMode_; numberGoodU_ = other.numberGoodU_; maximumPivots_ = other.maximumPivots_; numberPivots_ = other.numberPivots_; factorElements_ = other.factorElements_; status_ = other.status_; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; c_ekksmem_copy(&factInfo_,&other.factInfo_); } // getAreas. Gets space for a factorization //called by constructors void CoinOslFactorization::getAreas ( int numberOfRows, int numberOfColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ) { numberRows_ = numberOfRows; numberColumns_ = numberOfColumns; CoinBigIndex size = static_cast(factInfo_.areaFactor* (maximumL+maximumU)); factInfo_.zeroTolerance=zeroTolerance_; // If wildly out redo if (maximumRows_>numberRows_+1000) { maximumRows_=0; maximumSpace_=0; factInfo_.last_eta_size=0; } if (size>maximumSpace_) { //delete [] elements_; //elements_ = new CoinFactorizationDouble [size]; maximumSpace_ = size; } factInfo_.lastEtaCount = factInfo_.nnentu+factInfo_.nnentl; int oldnnetas=factInfo_.last_eta_size; // If we are going to increase then be on safe side if (size>oldnnetas) size = static_cast(1.1*size); factInfo_.eta_size=CoinMax(size,oldnnetas); //printf("clp size %d, old %d now %d - iteration %d - last count %d - rows %d,%d,%d\n", // size,oldnnetas,factInfo_.eta_size,factInfo_.iterno,factInfo_.lastEtaCount, //numberRows_,factInfo_.nrowmx,factInfo_.nrow); //if (!factInfo_.iterno) { //printf("here\n"); //} /** Get solve mode e.g. 0 C++ code, 1 Lapack, 2 choose If 4 set then values pass if 8 set then has iterated */ solveMode_ &= 4+8; // clear bottom bits factInfo_.ifvsol= ((solveMode_&4)!=0) ? 1 : 0; if ((solveMode_&8)!=0) { factInfo_.ifvsol=0; factInfo_.invok=1; } else { factInfo_.iter0=factInfo_.iterno; factInfo_.invok=-1; factInfo_.if_sparse_update=0; } #if 0 if (!factInfo_.if_sparse_update && factInfo_.iterno>factInfo_.iter0 && numberRows_>=C_EKK_GO_SPARSE) { printf("count %d rows %d etasize %d\n", factInfo_.lastEtaCount,factInfo_.nrow,factInfo_.eta_size); } #endif if (!factInfo_.if_sparse_update && factInfo_.iterno>factInfo_.iter0 && numberRows_>=C_EKK_GO_SPARSE && (factInfo_.lastEtaCount>>2)maximumRows_) { maximumRows_ = numberRows_; //delete [] pivotRow_; //delete [] workArea_; //pivotRow_ = new int [2*maximumRows_+maximumPivots_]; //workArea_ = new CoinFactorizationDouble [maximumRows_*WORK_MULT]; } } // preProcess. void CoinOslFactorization::preProcess () { factInfo_.zpivlu=pivotTolerance_; // Go to Fortran int * hcoli=factInfo_.xecadr+1; int * indexRowU = factInfo_.xeradr+1; CoinBigIndex * startColumnU=factInfo_.xcsadr+1; for (int i=0;i0); } //Does factorization int CoinOslFactorization::factor ( ) { /* Uwe's factorization (sort of) */ int irtcod = c_ekklfct(&factInfo_); /* Check return code */ /* 0 - Fine , 1 - Backtrack, 2 - Singularities on initial, 3-Fatal */ /* now 5-Need more memory */ status_= 0; if (factInfo_.eta_size>factInfo_.last_eta_size) { factInfo_.areaFactor *= factInfo_.eta_size; factInfo_.areaFactor /= factInfo_.last_eta_size; #ifdef CLP_INVESTIGATE printf("areaFactor increased to %g\n",factInfo_.areaFactor); #endif } if (irtcod==5) { status_=-99; assert (factInfo_.eta_size>factInfo_.last_eta_size) ; #ifdef CLP_INVESTIGATE printf("need more memory\n"); #endif } else if (irtcod) { status_=-1; //printf("singular %d\n",irtcod); } return status_; } // Makes a non-singular basis by replacing variables void CoinOslFactorization::makeNonSingular(int * sequence, int numberColumns) { const EKKHlink *rlink = factInfo_.kp1adr; const EKKHlink *clink = factInfo_.kp2adr; int nextRow=0; //int * mark = reinterpret_cast(factInfo_.kw1adr); //int nr=0; //int nc=0; #if 0 for (int i=0;i=0||rlink[i].pre==-(numberRows_+1)) { nr++; printf("%d rl %d cl %d\n",i,rlink[i].pre,clink[i].pre); } if (clink[i].pre>=0||clink[i].pre==-(numberRows_+1)) { nc++; printf("%d rl %d cl %d\n",i,rlink[i].pre,clink[i].pre); } } #endif //printf("nr %d nc %d\n",nr,nc); #ifndef NDEBUG bool goodPass=true; #endif int numberDone=0; for (int i=0;i (factInfo_.kadrpm+numberRows_+1)); // this is ridiculous - must be better way int * permute2 = reinterpret_cast(factInfo_.kw1adr); const int * permute = reinterpret_cast(factInfo_.kp2adr); for (int i=0;igetIndices ( ); double *region = regionSparse->denseVector ( ); int orig_nincol=0; double saveTolerance = factInfo_.drtpiv; factInfo_.drtpiv=acceptablePivot; int returnCode=c_ekketsj(&factInfo_,region-1, regionIndex, pivotCheck,orig_nincol, numberPivots_,&factInfo_.nuspike, pivotRow+1, reinterpret_cast(factInfo_.kw1adr)); factInfo_.drtpiv=saveTolerance; if (returnCode!=2) numberPivots_++; #ifndef NDEBUG { int lstart=numberRows_+factInfo_.maxinv+5; int ndo = factInfo_.xnetal-lstart; double * dluval=factInfo_.xeeadr; int * mcstrt = factInfo_.xcsadr+lstart; if (ndo) assert (dluval[mcstrt[ndo]+1]<1.0e50); } #endif return returnCode; } /* This version has same effect as above with FTUpdate==false so number returned is always >=0 */ int CoinOslFactorization::updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool /*noPermute*/) const { #ifndef NDEBUG { int lstart=numberRows_+factInfo_.maxinv+5; int ndo = factInfo_.xnetal-lstart; double * dluval=factInfo_.xeeadr; int * mcstrt = factInfo_.xcsadr+lstart; if (ndo) assert (dluval[mcstrt[ndo]+1]<1.0e50); } #endif assert (numberRows_==numberColumns_); double *region2 = regionSparse2->denseVector ( ); int *regionIndex2 = regionSparse2->getIndices ( ); int numberNonZero = regionSparse2->getNumElements ( ); double *region = regionSparse->denseVector ( ); //const int * permuteIn = factInfo_.mpermu+1; // Stuff is put one up so won't get illegal read assert (!region[numberRows_]); assert (!regionSparse2->packedMode()); #if 0 int first=numberRows_; for (int j=0;jsetNumElements(numberNonZero); return 0; } /* Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output */ int CoinOslFactorization::updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool /*noPermute*/) { assert (numberRows_==numberColumns_); double *region2 = regionSparse2->denseVector ( ); int *regionIndex2 = regionSparse2->getIndices ( ); int numberNonZero = regionSparse2->getNumElements ( ); assert (regionSparse2->packedMode()); // packed mode //int numberNonInOriginal=numberNonZero; //double *dpermu = factInfo_.kadrpm; // Use region instead of dpermu double * save =factInfo_.kadrpm; factInfo_.kadrpm=regionSparse->denseVector()-1; int nuspike=c_ekkftrn_ft(&factInfo_, region2,regionIndex2, &numberNonZero); factInfo_.kadrpm=save; regionSparse2->setNumElements(numberNonZero); //regionSparse2->print(); factInfo_.nuspike=nuspike; return nuspike; } int CoinOslFactorization::updateTwoColumnsFT(CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool /*noPermute*/) { #if 1 // probably best to merge on a LU part by part // but can try full merge double *region2 = regionSparse2->denseVector ( ); int *regionIndex2 = regionSparse2->getIndices ( ); int numberNonZero2 = regionSparse2->getNumElements ( ); assert (regionSparse2->packedMode()); assert (numberRows_==numberColumns_); double *region3 = regionSparse3->denseVector ( ); int *regionIndex3 = regionSparse3->getIndices ( ); int numberNonZero3 = regionSparse3->getNumElements ( ); double *region = regionSparse1->denseVector ( ); // Stuff is put one up so won't get illegal read assert (!region[numberRows_]); assert (!regionSparse3->packedMode()); // packed mode //double *dpermu = factInfo_.kadrpm; #if 0 factInfo_.nuspike=c_ekkftrn_ft(&factInfo_, region2,regionIndex2, &numberNonZero2); numberNonZero3=c_ekkftrn(&factInfo_, region3-1,region,regionIndex3,numberNonZero3); #else c_ekkftrn2(&factInfo_,region3-1,region,regionIndex3,&numberNonZero3, region2,regionIndex2,&numberNonZero2); #endif regionSparse2->setNumElements(numberNonZero2); regionSparse3->setNumElements(numberNonZero3); return factInfo_.nuspike; #else // probably best to merge on a LU part by part // but can try full merge int returnCode= updateColumnFT(regionSparse1, regionSparse2); updateColumn(regionSparse1, regionSparse3, noPermute); return returnCode; #endif } /* Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output */ int CoinOslFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { assert (numberRows_==numberColumns_); double *region2 = regionSparse2->denseVector ( ); int *regionIndex2 = regionSparse2->getIndices ( ); int numberNonZero = regionSparse2->getNumElements ( ); //double *region = regionSparse->denseVector ( ); /*int *regionIndex = regionSparse->getIndices ( );*/ const int * permuteIn = factInfo_.mpermu+1; factInfo_.packedMode = regionSparse2->packedMode() ? 1 : 0; // Use region instead of dpermu double * save =factInfo_.kadrpm; factInfo_.kadrpm=regionSparse->denseVector()-1; // use internal one for now (address is one off) double * region = factInfo_.kadrpm; if (numberNonZero<2) { if (numberNonZero) { int ipivrw=regionIndex2[0]; if (factInfo_.packedMode) { double value=region2[0]; region2[0]=0.0; region2[ipivrw]=value; } numberNonZero=c_ekkbtrn_ipivrw(&factInfo_, region2-1, regionIndex2-1,ipivrw+1, reinterpret_cast(factInfo_.kp1adr)); } } else { #ifndef NDEBUG { int *mcstrt = factInfo_.xcsadr; int * hpivco_new=factInfo_.kcpadr+1; int nrow=factInfo_.nrow; int i; int ipiv = hpivco_new[0]; int last = mcstrt[ipiv]; for (i=0;ilast); last=mcstrt[ipiv]; } } #endif int iSmallest = COIN_INT_MAX; int iPiv=0; const int *mcstrt = factInfo_.xcsadr; // permute and save where nonzeros are if (!factInfo_.packedMode) { if ((numberRows_<200||(numberNonZero<<4)>numberRows_)) { for (int j=0;j=0); numberNonZero=c_ekkbtrn(&factInfo_, region2-1,regionIndex2-1,iPiv); } factInfo_.kadrpm=save; factInfo_.packedMode=0; regionSparse2->setNumElements(numberNonZero); return 0; } // Number of entries in each row int * CoinOslFactorization::numberInRow() const { return reinterpret_cast (factInfo_.xrnadr+1);} // Number of entries in each column int * CoinOslFactorization::numberInColumn() const { return reinterpret_cast (factInfo_.xcnadr+1);} // Returns array to put basis starts in CoinBigIndex * CoinOslFactorization::starts() const { return reinterpret_cast (factInfo_.xcsadr+1);} // Returns array to put basis elements in CoinFactorizationDouble * CoinOslFactorization::elements() const { return factInfo_.xeeadr+1;} // Returns pivot row int * CoinOslFactorization::pivotRow() const { return factInfo_.krpadr+1;} // Returns work area CoinFactorizationDouble * CoinOslFactorization::workArea() const { return factInfo_.kw1adr;} // Returns int work area int * CoinOslFactorization::intWorkArea() const { return reinterpret_cast (factInfo_.kw1adr);} // Returns permute back int * CoinOslFactorization::permuteBack() const { return factInfo_.kcpadr+1;} // Returns array to put basis indices in int * CoinOslFactorization::indices() const { return factInfo_.xeradr+1;} // Returns true if wants tableauColumn in replaceColumn bool CoinOslFactorization::wantsTableauColumn() const { return false;} /* Useful information for factorization 0 - iteration number whereFrom is 0 for factorize and 1 for replaceColumn */ #ifdef CLP_REUSE_ETAS void CoinOslFactorization::setUsefulInformation(const int * info,int whereFrom) { factInfo_.iterno=info[0]; if (whereFrom) { factInfo_.reintro=-1; if( factInfo_.first_dense>=factInfo_.last_dense) { int * putSeq = factInfo_.xrsadr+2*factInfo_.nrowmx+2; int * position = putSeq+factInfo_.maxinv; //int * putStart = position+factInfo_.maxinv; int iSequence=info[1]; if (whereFrom==1) { putSeq[factInfo_.npivots]=iSequence; } else { int i; for (i=factInfo_.npivots-1;i>=0;i--) { if (putSeq[i]==iSequence) break; } if (i>=0) { factInfo_.reintro=position[i]; } else { factInfo_.reintro=-1; } factInfo_.nnentu=factInfo_.save_nnentu; } } } } #else void CoinOslFactorization::setUsefulInformation(const int * info,int /*whereFrom*/) { factInfo_.iterno=info[0]; } #endif // Get rid of all memory void CoinOslFactorization::clearArrays() { factInfo_.nR_etas=0; factInfo_.nnentu=0; factInfo_.nnentl=0; maximumRows_=0; maximumSpace_=0; factInfo_.last_eta_size=0; gutsOfDestructor(false); } void CoinOslFactorization::maximumPivots ( int value ) { maximumPivots_ = value; } #define CLP_FILL 15 /*#undef NDEBUG*/ //#define CLP_DEBUG_MALLOC 1000000 #if CLP_DEBUG_MALLOC static int malloc_number=0; static int malloc_check=-1; static int malloc_counts_on=0; struct malloc_struct { void * previous; void * next; int size; int when; int type; }; static double malloc_times=0.0; static double malloc_total=0.0; static double malloc_current=0.0; static double malloc_max=0.0; static int malloc_amount[]={0,32,128,256,1024,4096,16384,65536,262144, 2000000000}; static int malloc_n=10; double malloc_counts[10]={0,0,0,0,0,0,0,0,0,0}; typedef struct malloc_struct malloc_struct; static malloc_struct startM = {0,0,0,0}; static malloc_struct endM = {0,0,0,0}; static int extra=4; void clp_memory(int type) { if (type==0) { /* switch on */ malloc_counts_on=1; startM.next=&endM; endM.previous=&startM; } else { /* summary */ double average = malloc_total/malloc_times; int i; malloc_struct * previous = (malloc_struct *) endM.previous; printf("count %g bytes %g - average %g\n",malloc_times,malloc_total,average); printf("current bytes %g - maximum %g\n",malloc_current,malloc_max); for ( i=0;iprevious!=&startM) { int n=0; printf("Allocated blocks\n"); while (previous->previous!=&startM) { printf("(%d at %d) ",previous->size,previous->when); n++; if ((n%5)==0) printf("\n"); previous = (malloc_struct *) previous->previous; } printf("\n - total %d\n",n); } } malloc_number=0; malloc_times=0.0; malloc_total=0.0; malloc_current=0.0; malloc_max=0.0; memset(malloc_counts,0,sizeof(malloc_counts)); } static void clp_adjust(void * temp,int size,int type) { malloc_struct * itemp = (malloc_struct *) temp; malloc_struct * first = (malloc_struct *) startM.next; int i; startM.next=temp; first->previous=temp; itemp->previous=&startM; itemp->next=first; malloc_number++; if (malloc_number==malloc_check) { printf("Allocation of %d bytes at %d (type %d) not freed\n", size,malloc_number,type); } itemp->when=malloc_number; itemp->size=size; itemp->type=type; malloc_times ++; malloc_total += size; malloc_current += size; malloc_max=CoinMax(malloc_max,malloc_current); for (i=0;i( malloc(number_entries*sizeof(double))); #else double * temp = reinterpret_cast( malloc((number_entries+extra)*sizeof(double))); clp_adjust(temp,number_entries*sizeof(double),1); #if CLP_DEBUG_MALLOC>1 if (number_entries*sizeof(double)>=CLP_DEBUG_MALLOC) printf("WWW %x malloced by double %d - size %d\n", temp+extra,malloc_number,number_entries); #endif return temp+extra; #endif } int * clp_int(int number_entries) { #if CLP_DEBUG_MALLOC==0 return reinterpret_cast( malloc(number_entries*sizeof(int))); #else double * temp = reinterpret_cast( malloc(((number_entries+1)/2+extra)*sizeof(double))); clp_adjust(temp,number_entries*sizeof(int),2); #if CLP_DEBUG_MALLOC>1 if (number_entries*sizeof(int)>=CLP_DEBUG_MALLOC) printf("WWW %x malloced by int %d - size %d\n", temp+extra,malloc_number,number_entries); #endif return reinterpret_cast( (temp+extra)); #endif } void * clp_malloc(int number_entries) { #if CLP_DEBUG_MALLOC==0 return malloc(number_entries); #else double * temp = reinterpret_cast( malloc(number_entries+extra*sizeof(double))); clp_adjust(temp,number_entries,0); #if CLP_DEBUG_MALLOC>1 if (number_entries>=CLP_DEBUG_MALLOC) printf("WWW %x malloced by void %d - size %d\n", temp+extra,malloc_number,number_entries); #endif return (void *) (temp+extra); #endif } void clp_free(void * oldArray) { #if CLP_DEBUG_MALLOC==0 free(oldArray); #else if (oldArray) { double * temp = (reinterpret_cast( oldArray)-extra); malloc_struct * itemp = (malloc_struct *) temp; malloc_struct * next = (malloc_struct *) itemp->next; malloc_struct * previous = (malloc_struct *) itemp->previous; previous->next=next; next->previous=previous; malloc_current -= itemp->size; #if CLP_DEBUG_MALLOC>1 if (itemp->size>=CLP_DEBUG_MALLOC) printf("WWW %x freed by free %d - old length %d - type %d\n", oldArray,itemp->when,itemp->size,itemp->type); #endif free(temp); } #endif } /*#define FIX_ADD 4*nrowmx+5 #define FIX_ADD2 4*nrowmx+5*/ #define FIX_ADD 1*nrowmx+5 #define FIX_ADD2 1*nrowmx+5 #define ALIGNMENT 32 static void * clp_align (void * memory) { if (sizeof(int)==sizeof(void *)&&ALIGNMENT) { CoinInt64 k = reinterpret_cast (memory); if ((k&(ALIGNMENT-1))!=0) { k &= ~(ALIGNMENT-1); k += ALIGNMENT; memory = reinterpret_cast (k); } return memory; } else { return memory; } } void clp_setup_pointers(EKKfactinfo * fact) { /* do extra stuff */ int nrow=fact->nrow; int nrowmx=fact->nrowmx; int maxinv=fact->maxinv; fact->lstart = nrow + maxinv + 5; /* this is the number of L transforms */ fact->xnetalval = fact->xnetal - fact->lstart; fact->mpermu = (reinterpret_cast (fact->kadrpm+nrow))+1; fact->bitArray = fact->krpadr + ( nrowmx+2); fact->back = fact->kcpadr+2*nrow + maxinv + 4; fact->hpivcoR = fact->kcpadr+nrow+3; fact->nonzero = (reinterpret_cast( &fact->mpermu[nrow+1]))-1; } #ifndef NDEBUG int ets_count=0; int ets_check=-1; //static int adjust_count=0; //static int adjust_check=-1; #endif static void clp_adjust_pointers(EKKfactinfo * fact, int adjust) { #if 0 //ndef NDEBUG adjust_count++; if (adjust_check>=0&&adjust_count>=adjust_check) { printf("trouble\n"); } #endif if (fact->trueStart) { fact->kadrpm += adjust; fact->krpadr += adjust; fact->kcpadr += adjust; fact->xrsadr += adjust; fact->xcsadr += adjust; fact->xrnadr += adjust; fact->xcnadr += adjust; } if (fact->xeradr) { fact->xeradr += adjust; fact->xecadr += adjust; fact->xeeadr += adjust; } } /* deals with memory for complicated array 0 just do addresses 1 just get memory */ static double * clp_alloc_memory(EKKfactinfo * fact,int type, int * length) { int nDouble=0; int nInt=0; int nrowmxp; int ntot1; int ntot2; int ntot3; int nrowmx; int * tempI; double * tempD; nrowmx=fact->nrowmx; nrowmxp = nrowmx + 2; ntot1 = nrowmxp; ntot2 = 3*nrowmx+5; /* space for three lists */ ntot3 = 2*nrowmx; if ((ntot1<<1)>1; } ntot3=CoinMax(ntot3,ntot1); /* Row work regions */ /* must be contiguous so allocate as one chunk */ /* may only need 2.5 */ /* now doing all at once - far too much - reduce later */ tempD=fact->kw1adr; tempD+=nrowmxp; tempD = reinterpret_cast( clp_align(tempD)); fact->kw2adr=tempD; tempD+=nrowmxp; tempD = reinterpret_cast( clp_align(tempD)); fact->kw3adr=tempD-1; tempD+=nrowmxp; tempD = reinterpret_cast( clp_align(tempD)); fact->kp1adr=reinterpret_cast(tempD); tempD+=nrowmxp; tempD = reinterpret_cast( clp_align(tempD)); fact->kp2adr=reinterpret_cast(tempD); //tempD+=ntot3; tempD+=nrowmxp; tempD = reinterpret_cast( clp_align(tempD)); /*printf("zz %x %x\n",tempD,fact->kadrpm);*/ fact->kadrpm = tempD; /* seems a lot */ tempD += ((6*nrowmx +8)*(sizeof(int))/sizeof(double)); /* integer arrays */ tempI = reinterpret_cast( tempD); tempI = reinterpret_cast( clp_align(tempI)); fact->xrsadr = tempI; #ifdef CLP_REUSE_ETAS tempI +=( 3*(nrowmx+fact->maxinv+1)); #else tempI +=( (nrowmx<<1)+fact->maxinv+1); #endif tempI = reinterpret_cast( clp_align(tempI)); fact->xcsadr = tempI; #if 1 //def CLP_REUSE_ETAS tempI += ( 2*nrowmx+8+2*fact->maxinv); #else tempI += ( 2*nrowmx+8+fact->maxinv); #endif tempI += FIX_ADD+FIX_ADD2; tempI = reinterpret_cast( clp_align(tempI)); fact->xrnadr = tempI; tempI += nrowmx; tempI = reinterpret_cast( clp_align(tempI)); fact->xcnadr = tempI; tempI += nrowmx; tempI = reinterpret_cast( clp_align(tempI)); fact->krpadr = tempI; tempI += ( nrowmx+1) +((nrowmx+33)>>5); /*printf("zzz %x %x\n",tempI,fact->kcpadr);*/ tempI = reinterpret_cast( clp_align(tempI)); fact->kcpadr = tempI; tempI += 3*nrowmx+8+fact->maxinv; fact->R_etas_start = fact->xcsadr+nrowmx+fact->maxinv+4; fact->R_etas_start += FIX_ADD; nInt = static_cast(tempI-(reinterpret_cast( fact->trueStart))); nDouble = static_cast(sizeof(int)*(nInt+1)/sizeof(double)); *length = nDouble; /*printf("nDouble %d - type %d\n",nDouble,type);*/ nDouble += static_cast((2*ALIGNMENT)/sizeof(double)); if (type) { /*printf("%d allocated\n",nDouble);*/ tempD = reinterpret_cast( clp_double(nDouble)); #ifndef NDEBUG memset(tempD,CLP_FILL,nDouble*sizeof(double)); #endif } return tempD; } static void c_ekksmem(EKKfactinfo *fact,int nrow,int maximumPivots) { /* space for invert */ int nnetas=fact->eta_size; fact->nrow=nrow; if (!(nnetas>fact->last_eta_size||(!fact->xe2adr&&fact->if_sparse_update)|| nrow>fact->nrowmx||maximumPivots>fact->maxinv)) return; clp_adjust_pointers(fact, +1); if (nrow>fact->nrowmx||maximumPivots>fact->maxinv) { int length; fact->nrowmx=CoinMax(nrow,fact->nrowmx); fact->maxinv=CoinMax(maximumPivots,fact->maxinv); clp_free(fact->trueStart); fact->trueStart=0; fact->kw1adr=0; fact->trueStart=clp_alloc_memory(fact,1,&length); fact->kw1adr=reinterpret_cast( clp_align(fact->trueStart)); clp_alloc_memory(fact,0,&length); } /*if (!fact->iterno) fact->eta_size+=1000000;*//* TEMP*/ if (nnetas>fact->last_eta_size||(!fact->xe2adr&&fact->if_sparse_update)) { fact->last_eta_size = nnetas; clp_free(reinterpret_cast(fact->xe2adr)); /* if malloc fails - we have lost memory - start again */ if (!fact->ndenuc &&fact->if_sparse_update) { /* allow second copy of elements */ fact->xe2adr = clp_double(nnetas); #ifndef NDEBUG memset(fact->xe2adr,CLP_FILL,nnetas*sizeof(double)); #endif if (!fact->xe2adr) { fact->maxNNetas=fact->last_eta_size; /* dont allow any increase */ nnetas=fact->last_eta_size; fact->eta_size=nnetas; #ifdef PRINT_DEBUG if (fact->if_sparse_update) { printf("*** Sparse update off due to memory\n"); } #endif fact->if_sparse_update=0; fact->switch_off_sparse_update=1; } } else { fact->xe2adr = 0; fact->if_sparse_update=0; } clp_free(fact->xeradr); fact->xeradr= clp_int( nnetas); #ifndef NDEBUG memset(fact->xeradr,CLP_FILL,nnetas*sizeof(int)); #endif if (!fact->xeradr) { nnetas=0; } if (nnetas) { clp_free(fact->xecadr); fact->xecadr= clp_int( nnetas); #ifndef NDEBUG memset(fact->xecadr,CLP_FILL,nnetas*sizeof(int)); #endif if (!fact->xecadr) { nnetas=0; } } if (nnetas) { clp_free(fact->xeeadr); fact->xeeadr= clp_double(nnetas); #ifndef NDEBUG memset(fact->xeeadr,CLP_FILL,nnetas*sizeof(double)); #endif if (!fact->xeeadr) { nnetas=0; } } } if (!nnetas) { char msg[100]; sprintf(msg,"Unable to allocate factorization memory for %d elements", nnetas); throw(msg); } /*c_ekklplp->nnetas=nnetas;*/ fact->nnetas=nnetas; clp_adjust_pointers(fact, -1); } static void c_ekksmem_copy(EKKfactinfo *fact,const EKKfactinfo * rhsFact) { /* space for invert */ int nrowmx=rhsFact->nrowmx,nnetas=rhsFact->nnetas; int canReuseEtas= (fact->eta_size==rhsFact->eta_size) ? 1 : 0; int canReuseArrays = (fact->nrowmx==rhsFact->nrowmx) ? 1 : 0; clp_adjust_pointers(fact, +1); clp_adjust_pointers(const_cast(rhsFact), +1); /*memset(fact,0,sizeof(EKKfactinfo));*/ /* copy scalars */ memcpy(&fact->drtpiv,&rhsFact->drtpiv,5*sizeof(double)); memcpy(&fact->nrow,&rhsFact->nrow,((&fact->maxNNetas-&fact->nrow)+1)* sizeof(int)); if (nrowmx) { int length; int kCopyEnd,nCopyEnd,nCopyStart; if (!canReuseEtas) { clp_free(fact->xeradr); clp_free(fact->xecadr); clp_free(fact->xeeadr); clp_free(fact->xe2adr); fact->xeradr = 0; fact->xecadr = 0; fact->xeeadr = 0; fact->xe2adr = 0; } if (!canReuseArrays) { clp_free(fact->trueStart); fact->trueStart=0; fact->kw1adr=0; fact->trueStart=clp_alloc_memory(fact,1,&length); fact->kw1adr=reinterpret_cast( clp_align(fact->trueStart)); } clp_alloc_memory(fact,0,&length); nnetas=fact->eta_size; assert (nnetas); { int n2 = rhsFact->nR_etas; int n3 = n2 ? rhsFact->R_etas_start[1+n2]: 0; int * startR = rhsFact->R_etas_index+n3; nCopyEnd=static_cast((rhsFact->xeradr+nnetas)-startR); nCopyStart=rhsFact->nnentu; nCopyEnd = CoinMin(nCopyEnd+20,nnetas); kCopyEnd = nnetas-nCopyEnd; nCopyStart = CoinMin(nCopyStart+20,nnetas); if (!n2&&!rhsFact->nnentu&&!rhsFact->nnentl) { nCopyStart=nCopyEnd=0; } } /* copy */ if(nCopyStart||nCopyEnd||true) { #if 1 memcpy(fact->kw1adr,rhsFact->kw1adr,length*sizeof(double)); #else c_ekkscpy((length*sizeof(double))/sizeof(int), reinterpret_cast( rhsFact->kw1adr,reinterpret_cast( fact->kw1adr)); #endif } /* if malloc fails - we have lost memory - start again */ if (!fact->ndenuc &&fact->if_sparse_update) { /* allow second copy of elements */ if (!canReuseEtas) fact->xe2adr = clp_double(nnetas); if (!fact->xe2adr) { fact->maxNNetas=nnetas; /* dont allow any increase */ #ifdef PRINT_DEBUG if (fact->if_sparse_update) { printf("*** Sparse update off due to memory\n"); } #endif fact->if_sparse_update=0; } else { #ifndef NDEBUG memset(fact->xe2adr,CLP_FILL,nnetas*sizeof(double)); #endif } } else { clp_free(fact->xe2adr); fact->xe2adr = 0; fact->if_sparse_update=0; } if (!canReuseEtas) fact->xeradr= clp_int(nnetas); if (!fact->xeradr) { nnetas=0; } else { #ifndef NDEBUG memset(fact->xeradr,CLP_FILL,nnetas*sizeof(int)); #endif /* copy */ if(nCopyStart||nCopyEnd) { #if 0 memcpy(fact->xeradr,rhsFact->xeradr,nCopyStart*sizeof(int)); memcpy(fact->xeradr+kCopyEnd,rhsFact->xeradr+kCopyEnd,nCopyEnd*sizeof(int)); #else c_ekkscpy(nCopyStart,rhsFact->xeradr,fact->xeradr); c_ekkscpy(nCopyEnd,rhsFact->xeradr+kCopyEnd,fact->xeradr+kCopyEnd); #endif } } if (nnetas) { if (!canReuseEtas) fact->xecadr= clp_int(nnetas); if (!fact->xecadr) { nnetas=0; } else { #ifndef NDEBUG memset(fact->xecadr,CLP_FILL,nnetas*sizeof(int)); #endif /* copy */ if (fact->rows_ok&&(nCopyStart||nCopyEnd)) { int i; int * hcoliR=rhsFact->xecadr-1; int * hcoli=fact->xecadr-1; int * mrstrt=fact->xrsadr; int * hinrow=fact->xrnadr; #if 0 memcpy(fact->xecadr+kCopyEnd,rhsFact->xecadr+kCopyEnd, nCopyEnd*sizeof(int)); #else c_ekkscpy(nCopyEnd,rhsFact->xecadr+kCopyEnd,fact->xecadr+kCopyEnd); #endif if (!fact->xe2adr) { for (i=0;inrow;i++) { int istart = mrstrt[i]; assert (istart>0&&istart<=nnetas); assert (hinrow[i]>=0&&hinrow[i]<=fact->nrow); memcpy(hcoli+istart,hcoliR+istart,hinrow[i]*sizeof(int)); } } else { double * de2valR=rhsFact->xe2adr-1; double * de2val=fact->xe2adr-1; #if 0 memcpy(fact->xe2adr+kCopyEnd,rhsFact->xe2adr+kCopyEnd, nCopyEnd*sizeof(double)); #else c_ekkdcpy(nCopyEnd,rhsFact->xe2adr+kCopyEnd ,fact->xe2adr+kCopyEnd); #endif for (i=0;inrow;i++) { int istart = mrstrt[i]; assert (istart>0&&istart<=nnetas); assert (hinrow[i]>=0&&hinrow[i]<=fact->nrow); memcpy(hcoli+istart,hcoliR+istart,hinrow[i]*sizeof(int)); memcpy(de2val+istart,de2valR+istart,hinrow[i]*sizeof(double)); #ifndef NDEBUG { int j; for (j=istart;jxeeadr= clp_double(nnetas); if (!fact->xeeadr) { nnetas=0; } else { #ifndef NDEBUG memset(fact->xeeadr,CLP_FILL,nnetas*sizeof(double)); #endif /* copy */ if(nCopyStart||nCopyEnd) { #if 0 memcpy(fact->xeeadr,rhsFact->xeeadr,nCopyStart*sizeof(double)); memcpy(fact->xeeadr+kCopyEnd,rhsFact->xeeadr+kCopyEnd,nCopyEnd*sizeof(double)); #else c_ekkdcpy(nCopyStart, rhsFact->xeeadr,fact->xeeadr); c_ekkdcpy(nCopyEnd, rhsFact->xeeadr+kCopyEnd, fact->xeeadr+kCopyEnd); #endif } /*fact->R_etas_index = &XERADR1()[kdnspt - 1]; fact->R_etas_element = &XEEADR1()[kdnspt - 1];*/ fact->R_etas_start = fact->xcsadr+ (rhsFact->R_etas_start-rhsFact->xcsadr); fact->R_etas_index = fact->xeradr+ (rhsFact->R_etas_index-rhsFact->xeradr); fact->R_etas_element = fact->xeeadr+ (rhsFact->R_etas_element-rhsFact->xeeadr); } } } assert (nnetas||!nrowmx); fact->nnetas=nnetas; clp_adjust_pointers(fact, -1); clp_setup_pointers(fact); clp_adjust_pointers(const_cast(rhsFact), -1); } static void c_ekksmem_delete(EKKfactinfo *fact) { clp_adjust_pointers(fact, +1); clp_free(fact->trueStart); clp_free(fact->xe2adr); clp_free(fact->xecadr); clp_free(fact->xeradr); clp_free(fact->xeeadr); fact->eta_size=0; fact->xrsadr = 0; fact->xcsadr = 0; fact->xrnadr = 0; fact->xcnadr = 0; fact->krpadr = 0; fact->kcpadr = 0; fact->xeradr = 0; fact->xecadr = 0; fact->xeeadr = 0; fact->xe2adr = 0; fact->trueStart = 0; fact->kw2adr = 0; fact->kw3adr = 0; fact->kp1adr = 0; fact->kp2adr = 0; fact->kadrpm = 0; fact->kw1adr = 0; } int c_ekk_IsSet(const int * array,int bit); void c_ekk_Set(int * array,int bit); void c_ekk_Unset(int * array,int bit); int c_ekk_IsSet(const int * array,int bit) { int iWord = bit>>5; int iBit = bit&31; int word = array[iWord]; return (word&(1<>5; int iBit = bit&31; array[iWord] |= (1<>5; int iBit = bit&31; array[iWord] &= ~(1<=0) pivotTemp[numberRowBasic++]=i; } numberBasic = numberRowBasic; for (i=0;i=0) { pivotTemp[numberBasic++]=i; numberElements += columnLength[i]; } } if ( numberBasic > numberRows ) { return -2; // say too many in basis } numberElements = 3 * numberRows + 3 * numberElements + 20000; setUsefulInformation(&numberRows,0); getAreas ( numberRows, numberRows, numberElements, 2 * numberElements ); //fill numberBasic=0; numberElements=0; // Fill in counts so we can skip part of preProcess double * elementU=elements(); int * indexRowU=indices(); int * startColumnU=starts(); int * numberInRow=this->numberInRow(); int * numberInColumn=this->numberInColumn(); CoinZeroN ( numberInRow, numberRows ); CoinZeroN ( numberInColumn, numberRows ); for (i=0;i=0) { CoinBigIndex j; for (j=columnStart[i];j=0); columnIsBasic[iPivot]=i; } else { iPivot-=numberColumns; assert (rowIsBasic[iPivot]>=0); rowIsBasic[iPivot]=i; } } delete [] pivotVariable; } delete [] pivotTemp; return status_; } // Condition number - product of pivots after factorization double CoinOslFactorization::conditionNumber() const { double condition = 1.0; const double *dluval = factInfo_.xeeadr+1-1; // stored before const int *mcstrt = factInfo_.xcsadr+1; for (int i=0;i #include #include #include namespace Coin { //######################################################################### /** ReferencedObject class. * This is part of the implementation of an intrusive smart pointer * design. This class stores the reference count of all the smart * pointers that currently reference it. See the documentation for * the SmartPtr class for more details. * * A SmartPtr behaves much like a raw pointer, but manages the lifetime * of an object, deleting the object automatically. This class implements * a reference-counting, intrusive smart pointer design, where all * objects pointed to must inherit off of ReferencedObject, which * stores the reference count. Although this is intrusive (native types * and externally authored classes require wrappers to be referenced * by smart pointers), it is a safer design. A more detailed discussion of * these issues follows after the usage information. * * Usage Example: * Note: to use the SmartPtr, all objects to which you point MUST * inherit off of ReferencedObject. * * \verbatim * * In MyClass.hpp... * * #include "CoinSmartPtr.hpp" * * class MyClass : public Coin::ReferencedObject // must derive from ReferencedObject * { * ... * } * * In my_usage.cpp... * * #include "CoinSmartPtr.hpp" * #include "MyClass.hpp" * * void func(AnyObject& obj) * { * Coin::SmartPtr ptr_to_myclass = new MyClass(...); * // ptr_to_myclass now points to a new MyClass, * // and the reference count is 1 * * ... * * obj.SetMyClass(ptr_to_myclass); * // Here, let's assume that AnyObject uses a * // SmartPtr internally here. * // Now, both ptr_to_myclass and the internal * // SmartPtr in obj point to the same MyClass object * // and its reference count is 2. * * ... * * // No need to delete ptr_to_myclass, this * // will be done automatically when the * // reference count drops to zero. * * } * * \endverbatim * * Other Notes: * The SmartPtr implements both dereference operators -> & *. * The SmartPtr does NOT implement a conversion operator to * the raw pointer. Use the GetRawPtr() method when this * is necessary. Make sure that the raw pointer is NOT * deleted. * The SmartPtr implements the comparison operators == & != * for a variety of types. Use these instead of * \verbatim * if (GetRawPtr(smrt_ptr) == ptr) // Don't use this * \endverbatim * SmartPtr's, as currently implemented, do NOT handle circular references. * For example: consider a higher level object using SmartPtrs to point * to A and B, but A and B also point to each other (i.e. A has a * SmartPtr to B and B has a SmartPtr to A). In this scenario, when the * higher level object is finished with A and B, their reference counts * will never drop to zero (since they reference each other) and they * will not be deleted. This can be detected by memory leak tools like * valgrind. If the circular reference is necessary, the problem can be * overcome by a number of techniques: * * 1) A and B can have a method that "releases" each other, that is * they set their internal SmartPtrs to NULL. * \verbatim * void AClass::ReleaseCircularReferences() * { * smart_ptr_to_B = NULL; * } * \endverbatim * Then, the higher level class can call these methods before * it is done using A & B. * * 2) Raw pointers can be used in A and B to reference each other. * Here, an implicit assumption is made that the lifetime is * controlled by the higher level object and that A and B will * both exist in a controlled manner. Although this seems * dangerous, in many situations, this type of referencing * is very controlled and this is reasonably safe. * * 3) This SmartPtr class could be redesigned with the Weak/Strong * design concept. Here, the SmartPtr is identified as being * Strong (controls lifetime of the object) or Weak (merely * referencing the object). The Strong SmartPtr increments * (and decrements) the reference count in ReferencedObject * but the Weak SmartPtr does not. In the example above, * the higher level object would have Strong SmartPtrs to * A and B, but A and B would have Weak SmartPtrs to each * other. Then, when the higher level object was done with * A and B, they would be deleted. The Weak SmartPtrs in A * and B would not decrement the reference count and would, * of course, not delete the object. This idea is very similar * to item (2), where it is implied that the sequence of events * is controlled such that A and B will not call anything using * their pointers following the higher level delete (i.e. in * their destructors!). This is somehow safer, however, because * code can be written (however expensive) to perform run-time * detection of this situation. For example, the ReferencedObject * could store pointers to all Weak SmartPtrs that are referencing * it and, in its destructor, tell these pointers that it is * dying. They could then set themselves to NULL, or set an * internal flag to detect usage past this point. * * Comments on Non-Intrusive Design: * In a non-intrusive design, the reference count is stored somewhere other * than the object being referenced. This means, unless the reference * counting pointer is the first referencer, it must get a pointer to the * referenced object from another smart pointer (so it has access to the * reference count location). In this non-intrusive design, if we are * pointing to an object with a smart pointer (or a number of smart * pointers), and we then give another smart pointer the address through * a RAW pointer, we will have two independent, AND INCORRECT, reference * counts. To avoid this pitfall, we use an intrusive reference counting * technique where the reference count is stored in the object being * referenced. */ class ReferencedObject { public: ReferencedObject() : reference_count_(0) {} virtual ~ReferencedObject() { assert(reference_count_ == 0); } inline int ReferenceCount() const { return reference_count_; } inline void AddRef() const { ++reference_count_; } inline void ReleaseRef() const { --reference_count_; } private: mutable int reference_count_; }; //######################################################################### //#define IP_DEBUG_SMARTPTR #if COIN_IPOPT_CHECKLEVEL > 2 # define IP_DEBUG_SMARTPTR #endif #ifdef IP_DEBUG_SMARTPTR # include "IpDebug.hpp" #endif /** Template class for Smart Pointers. * A SmartPtr behaves much like a raw pointer, but manages the lifetime * of an object, deleting the object automatically. This class implements * a reference-counting, intrusive smart pointer design, where all * objects pointed to must inherit off of ReferencedObject, which * stores the reference count. Although this is intrusive (native types * and externally authored classes require wrappers to be referenced * by smart pointers), it is a safer design. A more detailed discussion of * these issues follows after the usage information. * * Usage Example: * Note: to use the SmartPtr, all objects to which you point MUST * inherit off of ReferencedObject. * * \verbatim * * In MyClass.hpp... * * #include "CoinSmartPtr.hpp" * * class MyClass : public Coin::ReferencedObject // must derive from ReferencedObject * { * ... * } * * In my_usage.cpp... * * #include "CoinSmartPtr.hpp" * #include "MyClass.hpp" * * void func(AnyObject& obj) * { * SmartPtr ptr_to_myclass = new MyClass(...); * // ptr_to_myclass now points to a new MyClass, * // and the reference count is 1 * * ... * * obj.SetMyClass(ptr_to_myclass); * // Here, let's assume that AnyObject uses a * // SmartPtr internally here. * // Now, both ptr_to_myclass and the internal * // SmartPtr in obj point to the same MyClass object * // and its reference count is 2. * * ... * * // No need to delete ptr_to_myclass, this * // will be done automatically when the * // reference count drops to zero. * * } * * \endverbatim * * It is not necessary to use SmartPtr's in all cases where an * object is used that has been allocated "into" a SmartPtr. It is * possible to just pass objects by reference or regular pointers, * even if lower down in the stack a SmartPtr is to be held on to. * Everything should work fine as long as a pointer created by "new" * is immediately passed into a SmartPtr, and if SmartPtr's are used * to hold on to objects. * * Other Notes: * The SmartPtr implements both dereference operators -> & *. * The SmartPtr does NOT implement a conversion operator to * the raw pointer. Use the GetRawPtr() method when this * is necessary. Make sure that the raw pointer is NOT * deleted. * The SmartPtr implements the comparison operators == & != * for a variety of types. Use these instead of * \verbatim * if (GetRawPtr(smrt_ptr) == ptr) // Don't use this * \endverbatim * SmartPtr's, as currently implemented, do NOT handle circular references. * For example: consider a higher level object using SmartPtrs to point to * A and B, but A and B also point to each other (i.e. A has a SmartPtr * to B and B has a SmartPtr to A). In this scenario, when the higher * level object is finished with A and B, their reference counts will * never drop to zero (since they reference each other) and they * will not be deleted. This can be detected by memory leak tools like * valgrind. If the circular reference is necessary, the problem can be * overcome by a number of techniques: * * 1) A and B can have a method that "releases" each other, that is * they set their internal SmartPtrs to NULL. * \verbatim * void AClass::ReleaseCircularReferences() * { * smart_ptr_to_B = NULL; * } * \endverbatim * Then, the higher level class can call these methods before * it is done using A & B. * * 2) Raw pointers can be used in A and B to reference each other. * Here, an implicit assumption is made that the lifetime is * controlled by the higher level object and that A and B will * both exist in a controlled manner. Although this seems * dangerous, in many situations, this type of referencing * is very controlled and this is reasonably safe. * * 3) This SmartPtr class could be redesigned with the Weak/Strong * design concept. Here, the SmartPtr is identified as being * Strong (controls lifetime of the object) or Weak (merely * referencing the object). The Strong SmartPtr increments * (and decrements) the reference count in ReferencedObject * but the Weak SmartPtr does not. In the example above, * the higher level object would have Strong SmartPtrs to * A and B, but A and B would have Weak SmartPtrs to each * other. Then, when the higher level object was done with * A and B, they would be deleted. The Weak SmartPtrs in A * and B would not decrement the reference count and would, * of course, not delete the object. This idea is very similar * to item (2), where it is implied that the sequence of events * is controlled such that A and B will not call anything using * their pointers following the higher level delete (i.e. in * their destructors!). This is somehow safer, however, because * code can be written (however expensive) to perform run-time * detection of this situation. For example, the ReferencedObject * could store pointers to all Weak SmartPtrs that are referencing * it and, in its destructor, tell these pointers that it is * dying. They could then set themselves to NULL, or set an * internal flag to detect usage past this point. * * Comments on Non-Intrusive Design: * In a non-intrusive design, the reference count is stored somewhere other * than the object being referenced. This means, unless the reference * counting pointer is the first referencer, it must get a pointer to the * referenced object from another smart pointer (so it has access to the * reference count location). In this non-intrusive design, if we are * pointing to an object with a smart pointer (or a number of smart * pointers), and we then give another smart pointer the address through * a RAW pointer, we will have two independent, AND INCORRECT, reference * counts. To avoid this pitfall, we use an intrusive reference counting * technique where the reference count is stored in the object being * referenced. */ template class SmartPtr { public: /** Returns the raw pointer contained. Use to get the value of the * raw ptr (i.e. to pass to other methods/functions, etc.) Note: This * method does NOT copy, therefore, modifications using this value * modify the underlying object contained by the SmartPtr, NEVER * delete this returned value. */ T* GetRawPtr() const { return ptr_; } /** Returns true if the SmartPtr is NOT NULL. * Use this to check if the SmartPtr is not null * This is preferred to if(GetRawPtr(sp) != NULL) */ bool IsValid() const { return ptr_ != NULL; } /** Returns true if the SmartPtr is NULL. * Use this to check if the SmartPtr IsNull. * This is preferred to if(GetRawPtr(sp) == NULL) */ bool IsNull() const { return ptr_ == NULL; } private: /**@name Private Data/Methods */ //@{ /** Actual raw pointer to the object. */ T* ptr_; /** Release the currently referenced object. */ void ReleasePointer_() { if (ptr_) { ptr_->ReleaseRef(); if (ptr_->ReferenceCount() == 0) { delete ptr_; } ptr_ = NULL; } } /** Set the value of the internal raw pointer from another raw * pointer, releasing the previously referenced object if necessary. */ SmartPtr& SetFromRawPtr_(T* rhs){ ReleasePointer_(); // Release any old pointer if (rhs != NULL) { rhs->AddRef(); ptr_ = rhs; } return *this; } /** Set the value of the internal raw pointer from a SmartPtr, * releasing the previously referenced object if necessary. */ inline SmartPtr& SetFromSmartPtr_(const SmartPtr& rhs) { SetFromRawPtr_(rhs.GetRawPtr()); return (*this); } //@} public: #define dbg_smartptr_verbosity 0 /**@name Constructors/Destructors */ //@{ /** Default constructor, initialized to NULL */ SmartPtr() : ptr_(NULL) {} /** Copy constructor, initialized from copy */ SmartPtr(const SmartPtr& copy) : ptr_(NULL) { (void) SetFromSmartPtr_(copy); } /** Constructor, initialized from T* ptr */ SmartPtr(T* ptr) : ptr_(NULL) { (void) SetFromRawPtr_(ptr); } /** Destructor, automatically decrements the reference count, deletes * the object if necessary.*/ ~SmartPtr() { ReleasePointer_(); } //@} /**@name Overloaded operators. */ //@{ /** Overloaded arrow operator, allows the user to call * methods using the contained pointer. */ T* operator->() const { #if COIN_COINUTILS_CHECKLEVEL > 0 assert(ptr_); #endif return ptr_; } /** Overloaded dereference operator, allows the user * to dereference the contained pointer. */ T& operator*() const { #if COIN_IPOPT_CHECKLEVEL > 0 assert(ptr_); #endif return *ptr_; } /** Overloaded equals operator, allows the user to * set the value of the SmartPtr from a raw pointer */ SmartPtr& operator=(T* rhs) { return SetFromRawPtr_(rhs); } /** Overloaded equals operator, allows the user to * set the value of the SmartPtr from another * SmartPtr */ SmartPtr& operator=(const SmartPtr& rhs) { return SetFromSmartPtr_(rhs); } /** Overloaded equality comparison operator, allows the * user to compare the value of two SmartPtrs */ template friend bool operator==(const SmartPtr& lhs, const SmartPtr& rhs); /** Overloaded equality comparison operator, allows the * user to compare the value of a SmartPtr with a raw pointer. */ template friend bool operator==(const SmartPtr& lhs, U2* raw_rhs); /** Overloaded equality comparison operator, allows the * user to compare the value of a raw pointer with a SmartPtr. */ template friend bool operator==(U1* lhs, const SmartPtr& raw_rhs); /** Overloaded in-equality comparison operator, allows the * user to compare the value of two SmartPtrs */ template friend bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs); /** Overloaded in-equality comparison operator, allows the * user to compare the value of a SmartPtr with a raw pointer. */ template friend bool operator!=(const SmartPtr& lhs, U2* raw_rhs); /** Overloaded in-equality comparison operator, allows the * user to compare the value of a SmartPtr with a raw pointer. */ template friend bool operator!=(U1* lhs, const SmartPtr& raw_rhs); //@} }; template bool ComparePointers(const U1* lhs, const U2* rhs) { if (lhs == rhs) { return true; } // If lhs and rhs point to the same object with different interfaces // U1 and U2, we cannot guarantee that the value of the pointers will // be equivalent. We can guarantee this if we convert to void*. return static_cast(lhs) == static_cast(rhs); } } // namespace Coin //############################################################################# /**@name SmartPtr friends that are overloaded operators, so they are not in the Coin namespace. */ //@{ template bool operator==(const Coin::SmartPtr& lhs, const Coin::SmartPtr& rhs) { return Coin::ComparePointers(lhs.GetRawPtr(), rhs.GetRawPtr()); } template bool operator==(const Coin::SmartPtr& lhs, U2* raw_rhs) { return Coin::ComparePointers(lhs.GetRawPtr(), raw_rhs); } template bool operator==(U1* raw_lhs, const Coin::SmartPtr& rhs) { return Coin::ComparePointers(raw_lhs, rhs.GetRawPtr()); } template bool operator!=(const Coin::SmartPtr& lhs, const Coin::SmartPtr& rhs) { return ! operator==(lhs, rhs); } template bool operator!=(const Coin::SmartPtr& lhs, U2* raw_rhs) { return ! operator==(lhs, raw_rhs); } template bool operator!=(U1* raw_lhs, const Coin::SmartPtr& rhs) { return ! operator==(raw_lhs, rhs); } //@} #define CoinReferencedObject Coin::ReferencedObject #define CoinSmartPtr Coin::SmartPtr #define CoinComparePointers Coin::ComparePointers #endif CoinMP-1.8.3/CoinUtils/src/CoinDistance.hpp0000644000175000017500000000224711510456064017077 0ustar renerene/* $Id: CoinDistance.hpp 1372 2011-01-03 23:31:00Z lou $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinDistance_H #define CoinDistance_H #include //------------------------------------------------------------------- // // Attempt to provide an std::distance function // that will work on multiple platforms // //------------------------------------------------------------------- /** CoinDistance This is the Coin implementation of the std::function that is designed to work on multiple platforms. */ template void coinDistance(ForwardIterator first, ForwardIterator last, Distance& n) { #if defined(__SUNPRO_CC) n = 0; std::distance(first,last,n); #else n = std::distance(first,last); #endif } template size_t coinDistance(ForwardIterator first, ForwardIterator last) { size_t retVal; #if defined(__SUNPRO_CC) retVal = 0; std::distance(first,last,retVal); #else retVal = std::distance(first,last); #endif return retVal; } #endif CoinMP-1.8.3/CoinUtils/src/CoinModelUseful.hpp0000644000175000017500000002571411552534611017576 0ustar renerene/* $Id: CoinModelUseful.hpp 1416 2011-04-17 09:57:29Z stefan $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinModelUseful_H #define CoinModelUseful_H #include #include #include #include #include #include #include #include "CoinPragma.hpp" /** This is for various structures/classes needed by CoinModel. CoinModelLink CoinModelLinkedList CoinModelHash */ /// for going through row or column class CoinModelLink { public: /**@name Constructors, destructor */ //@{ /** Default constructor. */ CoinModelLink(); /** Destructor */ ~CoinModelLink(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ CoinModelLink(const CoinModelLink&); /// = CoinModelLink& operator=(const CoinModelLink&); //@} /**@name Sets and gets method */ //@{ /// Get row inline int row() const { return row_;} /// Get column inline int column() const { return column_;} /// Get value inline double value() const { return value_;} /// Get value inline double element() const { return value_;} /// Get position inline int position() const { return position_;} /// Get onRow inline bool onRow() const { return onRow_;} /// Set row inline void setRow(int row) { row_=row;} /// Set column inline void setColumn(int column) { column_=column;} /// Set value inline void setValue(double value) { value_=value;} /// Set value inline void setElement(double value) { value_=value;} /// Set position inline void setPosition(int position) { position_=position;} /// Set onRow inline void setOnRow(bool onRow) { onRow_=onRow;} //@} private: /**@name Data members */ //@{ /// Row int row_; /// Column int column_; /// Value as double double value_; /// Position in data int position_; /// If on row chain bool onRow_; //@} }; /// for linked lists // for specifying triple typedef struct { // top bit is nonzero if string // rest is row unsigned int row; //CoinModelRowIndex row; int column; double value; // If string then index into strings } CoinModelTriple; inline int rowInTriple(const CoinModelTriple & triple) { return triple.row&0x7fffffff;} inline void setRowInTriple(CoinModelTriple & triple,int iRow) { triple.row = iRow|(triple.row&0x80000000);} inline bool stringInTriple(const CoinModelTriple & triple) { return (triple.row&0x80000000)!=0;} inline void setStringInTriple(CoinModelTriple & triple,bool string) { triple.row = (string ? 0x80000000 : 0)|(triple.row&0x7fffffff);} inline void setRowAndStringInTriple(CoinModelTriple & triple, int iRow,bool string) { triple.row = (string ? 0x80000000 : 0)|iRow;} /// for names and hashing // for hashing typedef struct { int index, next; } CoinModelHashLink; /* Function type. */ typedef double (*func_t) (double); /// For string evaluation /* Data type for links in the chain of symbols. */ struct symrec { char *name; /* name of symbol */ int type; /* type of symbol: either VAR or FNCT */ union { double var; /* value of a VAR */ func_t fnctptr; /* value of a FNCT */ } value; struct symrec *next; /* link field */ }; typedef struct symrec symrec; class CoinYacc { private: CoinYacc(const CoinYacc& rhs); CoinYacc& operator=(const CoinYacc& rhs); public: CoinYacc() : symtable(NULL), symbuf(NULL), length(0), unsetValue(0) {} ~CoinYacc() { if (length) { free(symbuf); symbuf = NULL; } symrec* s = symtable; while (s) { free(s->name); symtable = s; s = s->next; free(symtable); } } public: symrec * symtable; char * symbuf; int length; double unsetValue; }; class CoinModelHash { public: /**@name Constructors, destructor */ //@{ /** Default constructor. */ CoinModelHash(); /** Destructor */ ~CoinModelHash(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ CoinModelHash(const CoinModelHash&); /// = CoinModelHash& operator=(const CoinModelHash&); //@} /**@name sizing (just increases) */ //@{ /// Resize hash (also re-hashs) void resize(int maxItems,bool forceReHash=false); /// Number of items i.e. rows if just row names inline int numberItems() const { return numberItems_;} /// Set number of items void setNumberItems(int number); /// Maximum number of items inline int maximumItems() const { return maximumItems_;} /// Names inline const char *const * names() const { return names_;} //@} /**@name hashing */ //@{ /// Returns index or -1 int hash(const char * name) const; /// Adds to hash void addHash(int index, const char * name); /// Deletes from hash void deleteHash(int index); /// Returns name at position (or NULL) const char * name(int which) const; /// Returns non const name at position (or NULL) char * getName(int which) const; /// Sets name at position (does not create) void setName(int which,char * name ) ; /// Validates void validateHash() const; private: /// Returns a hash value int hashValue(const char * name) const; public: //@} private: /**@name Data members */ //@{ /// Names char ** names_; /// hash CoinModelHashLink * hash_; /// Number of items int numberItems_; /// Maximum number of items int maximumItems_; /// Last slot looked at int lastSlot_; //@} }; /// For int,int hashing class CoinModelHash2 { public: /**@name Constructors, destructor */ //@{ /** Default constructor. */ CoinModelHash2(); /** Destructor */ ~CoinModelHash2(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ CoinModelHash2(const CoinModelHash2&); /// = CoinModelHash2& operator=(const CoinModelHash2&); //@} /**@name sizing (just increases) */ //@{ /// Resize hash (also re-hashs) void resize(int maxItems, const CoinModelTriple * triples,bool forceReHash=false); /// Number of items inline int numberItems() const { return numberItems_;} /// Set number of items void setNumberItems(int number); /// Maximum number of items inline int maximumItems() const { return maximumItems_;} //@} /**@name hashing */ //@{ /// Returns index or -1 int hash(int row, int column, const CoinModelTriple * triples) const; /// Adds to hash void addHash(int index, int row, int column, const CoinModelTriple * triples); /// Deletes from hash void deleteHash(int index, int row, int column); private: /// Returns a hash value int hashValue(int row, int column) const; public: //@} private: /**@name Data members */ //@{ /// hash CoinModelHashLink * hash_; /// Number of items int numberItems_; /// Maximum number of items int maximumItems_; /// Last slot looked at int lastSlot_; //@} }; class CoinModelLinkedList { public: /**@name Constructors, destructor */ //@{ /** Default constructor. */ CoinModelLinkedList(); /** Destructor */ ~CoinModelLinkedList(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ CoinModelLinkedList(const CoinModelLinkedList&); /// = CoinModelLinkedList& operator=(const CoinModelLinkedList&); //@} /**@name sizing (just increases) */ //@{ /** Resize list - for row list maxMajor is maximum rows. */ void resize(int maxMajor,int maxElements); /** Create list - for row list maxMajor is maximum rows. type 0 row list, 1 column list */ void create(int maxMajor,int maxElements, int numberMajor, int numberMinor, int type, int numberElements, const CoinModelTriple * triples); /// Number of major items i.e. rows if just row links inline int numberMajor() const { return numberMajor_;} /// Maximum number of major items i.e. rows if just row links inline int maximumMajor() const { return maximumMajor_;} /// Number of elements inline int numberElements() const { return numberElements_;} /// Maximum number of elements inline int maximumElements() const { return maximumElements_;} /// First on free chain inline int firstFree() const { return first_[maximumMajor_];} /// Last on free chain inline int lastFree() const { return last_[maximumMajor_];} /// First on chain inline int first(int which) const { return first_[which];} /// Last on chain inline int last(int which) const { return last_[which];} /// Next array inline const int * next() const { return next_;} /// Previous array inline const int * previous() const { return previous_;} //@} /**@name does work */ //@{ /** Adds to list - easy case i.e. add row to row list Returns where chain starts */ int addEasy(int majorIndex, int numberOfElements, const int * indices, const double * elements, CoinModelTriple * triples, CoinModelHash2 & hash); /** Adds to list - hard case i.e. add row to column list */ void addHard(int minorIndex, int numberOfElements, const int * indices, const double * elements, CoinModelTriple * triples, CoinModelHash2 & hash); /** Adds to list - hard case i.e. add row to column list This is when elements have been added to other copy */ void addHard(int first, const CoinModelTriple * triples, int firstFree, int lastFree,const int * nextOther); /** Deletes from list - same case i.e. delete row from row list */ void deleteSame(int which, CoinModelTriple * triples, CoinModelHash2 & hash, bool zapTriples); /** Deletes from list - other case i.e. delete row from column list This is when elements have been deleted from other copy */ void updateDeleted(int which, CoinModelTriple * triples, CoinModelLinkedList & otherList); /** Deletes one element from Row list */ void deleteRowOne(int position, CoinModelTriple * triples, CoinModelHash2 & hash); /** Update column list for one element when one element deleted from row copy */ void updateDeletedOne(int position, const CoinModelTriple * triples); /// Fills first,last with -1 void fill(int first,int last); /** Puts in free list from other list */ void synchronize(CoinModelLinkedList & other); /// Checks that links are consistent void validateLinks(const CoinModelTriple * triples) const; //@} private: /**@name Data members */ //@{ /// Previous - maximumElements long int * previous_; /// Next - maximumElements long int * next_; /// First - maximumMajor+1 long (last free element chain) int * first_; /// Last - maximumMajor+1 long (last free element chain) int * last_; /// Number of major items i.e. rows if just row links int numberMajor_; /// Maximum number of major items i.e. rows if just row links int maximumMajor_; /// Number of elements int numberElements_; /// Maximum number of elements int maximumElements_; /// 0 row list, 1 column list int type_; //@} }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPackedMatrix.cpp0000644000175000017500000033232112312310414017700 0ustar renerene/* $Id: CoinPackedMatrix.cpp 1691 2014-03-19 12:43:56Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinUtilsConfig.h" #include #include #include #include #include #include #include "CoinPragma.hpp" #include "CoinSort.hpp" #include "CoinHelperFunctions.hpp" #ifndef CLP_NO_VECTOR #include "CoinPackedVectorBase.hpp" #endif #include "CoinFloatEqual.hpp" #include "CoinPackedMatrix.hpp" #if !defined(COIN_COINUTILS_CHECKLEVEL) #define COIN_COINUTILS_CHECKLEVEL 0 #endif //############################################################################# // T must be an integral type (int, CoinBigIndex, etc.) template static inline T CoinLengthWithExtra(T len, double extraGap) { return static_cast(ceil(len * (1 + extraGap))); } //############################################################################# static inline void CoinTestSortedIndexSet(const int num, const int * sorted, const int maxEntry, const char * testingMethod) { if (sorted[0] < 0 || sorted[num-1] >= maxEntry) throw CoinError("bad index", testingMethod, "CoinPackedMatrix"); if (std::adjacent_find(sorted, sorted + num) != sorted + num) throw CoinError("duplicate index", testingMethod, "CoinPackedMatrix"); } //----------------------------------------------------------------------------- static inline int * CoinTestIndexSet(const int numDel, const int * indDel, const int maxEntry, const char * testingMethod) { if (! CoinIsSorted(indDel, indDel + numDel)) { // if not sorted then sort it, test for consistency and return a pointer // to the sorted array int * sorted = new int[numDel]; CoinMemcpyN(indDel, numDel, sorted); std::sort(sorted, sorted + numDel); CoinTestSortedIndexSet(numDel, sorted, maxEntry, testingMethod); return sorted; } // Otherwise it's already sorted, so just test for consistency and return a // 0 pointer. CoinTestSortedIndexSet(numDel, indDel, maxEntry, testingMethod); return 0; } //############################################################################# void CoinPackedMatrix::reserve(const int newMaxMajorDim, const CoinBigIndex newMaxSize, bool create) { if (newMaxMajorDim > maxMajorDim_) { maxMajorDim_ = newMaxMajorDim; int * oldlength = length_; CoinBigIndex * oldstart = start_; length_ = new int[newMaxMajorDim]; start_ = new CoinBigIndex[newMaxMajorDim+1]; start_[0]=0; if (majorDim_ > 0) { CoinMemcpyN(oldlength, majorDim_, length_); CoinMemcpyN(oldstart, majorDim_ + 1, start_); } if (create) { // create empty vectors CoinFillN(length_+majorDim_,maxMajorDim_-majorDim_,0); CoinFillN(start_+majorDim_+1,maxMajorDim_-majorDim_,0); majorDim_=maxMajorDim_; } delete[] oldlength; delete[] oldstart; } if (newMaxSize > maxSize_) { maxSize_ = newMaxSize; int * oldind = index_; double * oldelem = element_; index_ = new int[newMaxSize]; element_ = new double[newMaxSize]; for (int i = majorDim_ - 1; i >= 0; --i) { CoinMemcpyN(oldind+start_[i], length_[i], index_+start_[i]); CoinMemcpyN(oldelem+start_[i], length_[i], element_+start_[i]); } delete[] oldind; delete[] oldelem; } } //----------------------------------------------------------------------------- void CoinPackedMatrix::clear() { majorDim_ = 0; minorDim_ = 0; size_ = 0; } //############################################################################# //############################################################################# void CoinPackedMatrix::setDimensions(int newnumrows, int newnumcols) { const int numrows = getNumRows(); if (newnumrows < 0) newnumrows = numrows; if (newnumrows < numrows) throw CoinError("Bad new rownum (less than current)", "setDimensions", "CoinPackedMatrix"); const int numcols = getNumCols(); if (newnumcols < 0) newnumcols = numcols; if (newnumcols < numcols) throw CoinError("Bad new colnum (less than current)", "setDimensions", "CoinPackedMatrix"); int numplus = 0; if (isColOrdered()) { minorDim_ = newnumrows; numplus = newnumcols - numcols; } else { minorDim_ = newnumcols; numplus = newnumrows - numrows; } if (numplus > 0) { int* lengths = new int[numplus]; CoinZeroN(lengths, numplus); resizeForAddingMajorVectors(numplus, lengths); delete[] lengths; majorDim_ += numplus; //forgot to change majorDim_ } } //----------------------------------------------------------------------------- void CoinPackedMatrix::setExtraGap(const double newGap) { if (newGap < 0) throw CoinError("negative new extra gap", "setExtraGap", "CoinPackedMatrix"); extraGap_ = newGap; } //----------------------------------------------------------------------------- void CoinPackedMatrix::setExtraMajor(const double newMajor) { if (newMajor < 0) throw CoinError("negative new extra major", "setExtraMajor", "CoinPackedMatrix"); extraMajor_ = newMajor; } //############################################################################# #ifndef CLP_NO_VECTOR void CoinPackedMatrix::appendCol(const CoinPackedVectorBase& vec) { if (colOrdered_) appendMajorVector(vec); else appendMinorVector(vec); } #endif //----------------------------------------------------------------------------- void CoinPackedMatrix::appendCol(const int vecsize, const int *vecind, const double *vecelem) { if (colOrdered_) appendMajorVector(vecsize, vecind, vecelem); else appendMinorVector(vecsize, vecind, vecelem); } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::appendCols(const int numcols, const CoinPackedVectorBase * const * cols) { if (colOrdered_) appendMajorVectors(numcols, cols); else appendMinorVectors(numcols, cols); } #endif //----------------------------------------------------------------------------- int CoinPackedMatrix::appendCols(const int numcols, const CoinBigIndex * columnStarts, const int * row, const double * element, int numberRows) { int numberErrors; if (colOrdered_) { numberErrors=appendMajor(numcols, columnStarts, row, element, numberRows); } else { numberErrors=appendMinor(numcols, columnStarts, row, element, numberRows); } return numberErrors; } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::appendRow(const CoinPackedVectorBase& vec) { if (colOrdered_) appendMinorVector(vec); else appendMajorVector(vec); } #endif //----------------------------------------------------------------------------- void CoinPackedMatrix::appendRow(const int vecsize, const int *vecind, const double *vecelem) { if (colOrdered_) appendMinorVector(vecsize, vecind, vecelem); else appendMajorVector(vecsize, vecind, vecelem); } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::appendRows(const int numrows, const CoinPackedVectorBase * const * rows) { if (colOrdered_) { // make sure enough columns if (numrows == 0) return; int i; int maxDim=-1; for (i = numrows - 1; i >= 0; --i) { const int vecsize = rows[i]->getNumElements(); const int* vecind = rows[i]->getIndices(); for (int j = vecsize - 1; j >= 0; --j) maxDim = CoinMax(maxDim,vecind[j]); } maxDim++; if (maxDim>majorDim_) { setDimensions(minorDim_,maxDim); //int nAdd=maxDim-majorDim_; //int * length = new int[nAdd]; //memset(length,0,nAdd*sizeof(int)); //resizeForAddingMajorVectors(nAdd,length); //delete [] length; } appendMinorVectors(numrows, rows); } else { appendMajorVectors(numrows, rows); } } #endif //----------------------------------------------------------------------------- int CoinPackedMatrix::appendRows(const int numrows, const CoinBigIndex * rowStarts, const int * column, const double * element, int numberColumns) { int numberErrors; if (colOrdered_) { numberErrors=appendMinor(numrows, rowStarts, column, element, numberColumns); } else { numberErrors=appendMajor(numrows, rowStarts, column, element, numberColumns); } return numberErrors; } //############################################################################# void CoinPackedMatrix::rightAppendPackedMatrix(const CoinPackedMatrix& matrix) { if (colOrdered_) { if (matrix.colOrdered_) { majorAppendSameOrdered(matrix); } else { majorAppendOrthoOrdered(matrix); } } else { if (matrix.colOrdered_) { minorAppendOrthoOrdered(matrix); } else { minorAppendSameOrdered(matrix); } } } //----------------------------------------------------------------------------- void CoinPackedMatrix::bottomAppendPackedMatrix(const CoinPackedMatrix& matrix) { if (colOrdered_) { if (matrix.colOrdered_) { minorAppendSameOrdered(matrix); } else { minorAppendOrthoOrdered(matrix); } } else { if (matrix.colOrdered_) { majorAppendOrthoOrdered(matrix); } else { majorAppendSameOrdered(matrix); } } } //############################################################################# void CoinPackedMatrix::deleteCols(const int numDel, const int * indDel) { if (numDel) { if (colOrdered_) deleteMajorVectors(numDel, indDel); else deleteMinorVectors(numDel, indDel); } } //----------------------------------------------------------------------------- void CoinPackedMatrix::deleteRows(const int numDel, const int * indDel) { if (numDel) { if (colOrdered_) deleteMinorVectors(numDel, indDel); else deleteMajorVectors(numDel, indDel); } } //############################################################################# /* Replace the elements of a vector. The indices remain the same. At most the number specified will be replaced. The index is between 0 and major dimension of matrix */ void CoinPackedMatrix::replaceVector(const int index, const int numReplace, const double * newElements) { if (index >= 0 && index < majorDim_) { int length = (length_[index] < numReplace) ? length_[index] : numReplace; CoinMemcpyN(newElements, length, element_ + start_[index]); } else { #ifdef COIN_DEBUG throw CoinError("bad index", "replaceVector", "CoinPackedMatrix"); #endif } } /* Modify one element of packed matrix. An element may be added. If the new element is zero it will be deleted unless keepZero true */ void CoinPackedMatrix::modifyCoefficient(int row, int column, double newElement, bool keepZero) { int minorIndex,majorIndex; if (colOrdered_) { majorIndex=column; minorIndex=row; } else { minorIndex=column; majorIndex=row; } if (majorIndex >= 0 && majorIndex < majorDim_) { if (minorIndex >= 0 && minorIndex < minorDim_) { CoinBigIndex j; CoinBigIndex end=start_[majorIndex]+length_[majorIndex];; for (j=start_[majorIndex];j=start_[majorIndex+1]) { int * addedEntries = new int[majorDim_]; memset(addedEntries, 0, majorDim_ * sizeof(int)); addedEntries[majorIndex] = 1; resizeForAddingMinorVectors(addedEntries); delete[] addedEntries; } // So where to insert? We're just going to assume that the entries // in the major vector are in increasing order, so we'll insert the // new entry to the last place we can const CoinBigIndex start = start_[majorIndex]; end = start_[majorIndex]+length_[majorIndex]; // recalculate end for (j = end - 1; j >= start; --j) { if (index_[j] < minorIndex) break; index_[j+1] = index_[j]; element_[j+1] = element_[j]; } ++j; index_[j] = minorIndex; element_[j] = newElement; size_++; length_[majorIndex]++; } } else { #ifdef COIN_DEBUG throw CoinError("bad minor index", "modifyCoefficient", "CoinPackedMatrix"); #endif } } else { #ifdef COIN_DEBUG throw CoinError("bad major index", "modifyCoefficient", "CoinPackedMatrix"); #endif } } /* Return one element of packed matrix. This works for either ordering If it is not present will return 0.0 */ double CoinPackedMatrix::getCoefficient(int row, int column) const { int minorIndex,majorIndex; if (colOrdered_) { majorIndex=column; minorIndex=row; } else { minorIndex=column; majorIndex=row; } double value=0.0; if (majorIndex >= 0 && majorIndex < majorDim_) { if (minorIndex >= 0 && minorIndex < minorDim_) { CoinBigIndex j; CoinBigIndex end=start_[majorIndex]+length_[majorIndex];; for (j=start_[majorIndex];j=threshold) { element_[k]=element_[j]; index_[k++]=index_[j]; } else { eliminatedElement[kbad]=element_[j]; eliminatedIndex[kbad++]=index_[j]; } } if (kbad) { numberEliminated += kbad; length_[i] = k-start_[i]; memcpy(index_+k,eliminatedIndex,kbad*sizeof(int)); memcpy(element_+k,eliminatedElement,kbad*sizeof(double)); } } size_ -= numberEliminated; delete [] eliminatedIndex; delete [] eliminatedElement; return numberEliminated; } //############################################################################# /* Eliminate all elements in matrix whose absolute value is less than threshold.ALSO removes duplicates The column starts are not affected. Returns number of elements eliminated. */ int CoinPackedMatrix::eliminateDuplicates(double threshold) { CoinBigIndex numberEliminated =0; // space for eliminated int * mark = new int [minorDim_]; int i; for (i=0;i=threshold) { element_[k]=element_[j]; index_[k++]=index_[j]; } } numberEliminated += end-k; length_[i] = k-start_[i]; } size_ -= numberEliminated; delete [] mark; return numberEliminated; } //############################################################################# void CoinPackedMatrix::removeGaps(double removeValue) { if (removeValue<0.0) { if (size_size) break; } for (; i < majorDim_; ++i) { const CoinBigIndex si = start_[i]; const int li = length_[i]; start_[i] = size; for (CoinBigIndex j=si;jremoveValue) { index_[put]=index_[j]; element_[put++]=value; } } length_[i]=put-start_[i]; start_[i+1] = put; } size_ = put; } } //############################################################################# /* Really clean up matrix. a) eliminate all duplicate AND small elements in matrix b) remove all gaps and set extraGap_ and extraMajor_ to 0.0 c) reallocate arrays and make max lengths equal to lengths d) orders elements returns number of elements eliminated */ int CoinPackedMatrix::cleanMatrix(double threshold) { if (!majorDim_) { extraGap_=0.0; extraMajor_=0.0; return 0; } CoinBigIndex numberEliminated =0; // space for eliminated int * mark = new int [minorDim_]; int i; for (i=0;i=threshold) { element_[n]=element_[j]; index_[n++]=index_[j]; k++; } } numberEliminated += end-k; length_[i] = n-start_[i]; // sort CoinSort_2(index_+start_[i],index_+n,element_+start_[i]); } start_[majorDim_]=n; size_ -= numberEliminated; assert (n==size_); delete [] mark; extraGap_=0.0; extraMajor_=0.0; maxMajorDim_=majorDim_; maxSize_=size_; // Now reallocate - do smallest ones first int * temp = CoinCopyOfArray(length_,majorDim_); delete [] length_; length_ = temp; CoinBigIndex * temp2 = CoinCopyOfArray(start_,majorDim_+1); delete [] start_; start_ = temp2; temp = CoinCopyOfArray(index_,size_); delete [] index_; index_ = temp; double * temp3 = CoinCopyOfArray(element_,size_); delete [] element_; element_ = temp3; return numberEliminated; } //############################################################################# void CoinPackedMatrix::submatrixOf(const CoinPackedMatrix& matrix, const int numMajor, const int * indMajor) { int i; int* sortedIndPtr = CoinTestIndexSet(numMajor, indMajor, matrix.majorDim_, "submatrixOf"); const int * sortedInd = sortedIndPtr == 0 ? indMajor : sortedIndPtr; gutsOfDestructor(); // Count how many nonzeros there'll be CoinBigIndex nzcnt = 0; const int* length = matrix.getVectorLengths(); for (i = 0; i < numMajor; ++i) { nzcnt += length[sortedInd[i]]; } colOrdered_ = matrix.colOrdered_; maxMajorDim_ = int(numMajor * (1+extraMajor_) + 1); maxSize_ = static_cast (nzcnt * (1+extraMajor_) * (1+extraGap_) + 100); length_ = new int[maxMajorDim_]; start_ = new CoinBigIndex[maxMajorDim_+1]; start_[0]=0; index_ = new int[maxSize_]; element_ = new double[maxSize_]; majorDim_ = 0; minorDim_ = matrix.minorDim_; size_ = 0; #ifdef CLP_NO_VECTOR for (i = 0; i < numMajor; ++i) { int j = sortedInd[i]; CoinBigIndex start = matrix.start_[j]; appendMajorVector(matrix.length_[j],matrix.index_+start,matrix.element_+start); } #else for (i = 0; i < numMajor; ++i) { const CoinShallowPackedVector reqdBySunCC = matrix.getVector(sortedInd[i]) ; appendMajorVector(reqdBySunCC); } #endif delete[] sortedIndPtr; } //############################################################################# void CoinPackedMatrix::submatrixOfWithDuplicates(const CoinPackedMatrix& matrix, const int numMajor, const int * indMajor) { int i; // we allow duplicates - can be useful #ifndef NDEBUG for (i=0; i=matrix.majorDim_) throw CoinError("bad index", "submatrixOfWithDuplicates", "CoinPackedMatrix"); } #endif gutsOfDestructor(); // Get rid of gaps extraMajor_ = 0; extraGap_ = 0; colOrdered_ = matrix.colOrdered_; maxMajorDim_ = numMajor ; const int* length = matrix.getVectorLengths(); length_ = new int[maxMajorDim_]; start_ = new CoinBigIndex[maxMajorDim_+1]; // Count how many nonzeros there'll be CoinBigIndex nzcnt = 0; for (i = 0; i < maxMajorDim_; ++i) { start_[i]=nzcnt; int thisLength = length[indMajor[i]]; nzcnt += thisLength; length_[i]=thisLength; } start_[maxMajorDim_]=nzcnt; maxSize_ = nzcnt ; index_ = new int[maxSize_]; element_ = new double[maxSize_]; majorDim_ = maxMajorDim_; minorDim_ = matrix.minorDim_; size_ = 0; const CoinBigIndex * startOld = matrix.start_; const double * elementOld = matrix.element_; const int * indexOld = matrix.index_; for (i = 0; i < maxMajorDim_; ++i) { int j = indMajor[i]; CoinBigIndex start = startOld[j]; int thisLength = length_[i]; const double * element = elementOld+start; const int * index = indexOld+start; for (int j=0;j=rhs.majorDim_&&maxSize_>=rhs.size_) { majorDim_ = rhs.majorDim_; minorDim_ = rhs.minorDim_; size_ = rhs.size_; extraGap_ = rhs.extraGap_; extraMajor_ = rhs.extraMajor_; CoinMemcpyN(rhs.length_, majorDim_,length_); CoinMemcpyN(rhs.start_, majorDim_+1,start_); if (size_==start_[majorDim_]) { CoinMemcpyN(rhs.index_ , size_, index_); CoinMemcpyN(rhs.element_ , size_, element_); } else { // we can't just simply memcpy these content over, because that can // upset memory debuggers like purify if there were gaps and those gaps // were uninitialized memory blocks for (int i = majorDim_ - 1; i >= 0; --i) { CoinMemcpyN(rhs.index_ + start_[i], length_[i], index_ + start_[i]); CoinMemcpyN(rhs.element_ + start_[i], length_[i], element_ + start_[i]); } } } else { copyOf(rhs); } } //############################################################################# // This method is essentially the same as minorAppendOrthoOrdered(). However, // since we start from an empty matrix, lots of fluff can be avoided. void CoinPackedMatrix::reverseOrderedCopyOf(const CoinPackedMatrix& rhs) { if (this == &rhs) { reverseOrdering(); return; } int i; colOrdered_ = !rhs.colOrdered_; majorDim_ = rhs.minorDim_; minorDim_ = rhs.majorDim_; size_ = rhs.size_; if (size_ == 0) { // we still need to allocate starts and lengths maxMajorDim_=majorDim_; delete[] start_; delete[] length_; delete[] index_; delete[] element_; start_ = new CoinBigIndex[maxMajorDim_ + 1]; length_ = new int[maxMajorDim_]; for (i = 0; i < majorDim_; ++i) { start_[i] = 0; length_[i]=0; } start_[majorDim_]=0; index_ = new int[maxSize_]; element_ = new double[maxSize_]; return; } // Allocate sufficient space (resizeForAddingMinorVectors()) const int newMaxMajorDim_ = CoinMax(maxMajorDim_, CoinLengthWithExtra(majorDim_, extraMajor_)); if (newMaxMajorDim_ > maxMajorDim_) { maxMajorDim_ = newMaxMajorDim_; delete[] start_; delete[] length_; start_ = new CoinBigIndex[maxMajorDim_ + 1]; length_ = new int[maxMajorDim_]; } // first compute how long each major-dimension vector will be int * COIN_RESTRICT orthoLength = length_; rhs.countOrthoLength(orthoLength); start_[0] = 0; if (extraGap_ == 0) { for (i = 0; i < majorDim_; ++i) start_[i+1] = start_[i] + orthoLength[i]; } else { const double eg = extraGap_; for (i = 0; i < majorDim_; ++i) start_[i+1] = start_[i] + CoinLengthWithExtra(orthoLength[i], eg); } const CoinBigIndex newMaxSize = CoinMax(maxSize_, CoinLengthWithExtra(getLastStart(), extraMajor_)); if (newMaxSize > maxSize_) { maxSize_ = newMaxSize; delete[] index_; delete[] element_; index_ = new int[maxSize_]; element_ = new double[maxSize_]; # ifdef ZEROFAULT memset(index_,0,(maxSize_*sizeof(int))) ; memset(element_,0,(maxSize_*sizeof(double))) ; # endif } // now insert the entries of matrix minorDim_ = rhs.majorDim_; const CoinBigIndex * COIN_RESTRICT start = rhs.start_; const int * COIN_RESTRICT index = rhs.index_; const int * COIN_RESTRICT length = rhs.length_; const double * COIN_RESTRICT element = rhs.element_; assert (start[0]==0); CoinBigIndex first = 0; for (i = 0; i < minorDim_; ++i) { CoinBigIndex last = first + length[i]; CoinBigIndex j = first; first = start[i+1]; #if 0 if (((last-j)&1)!=0) { const int ind = index[j]; CoinBigIndex put = start_[ind]; start_[ind] = put +1; element_[put] = element[j]; index_[put] = i; j++; } for (; j != last; j+=2) { const int ind0 = index[j]; CoinBigIndex put0 = start_[ind0]; double value0=element[j]; const int ind1 = index[j+1]; CoinBigIndex put1 = start_[ind1]; double value1=element[j+1]; start_[ind0] = put0 +1; start_[ind1] = put1 +1; element_[put0] = value0; index_[put0] = i; element_[put1] = value1; index_[put1] = i; } #else for (; j != last; ++j) { const int ind = index[j]; CoinBigIndex put = start_[ind]; start_[ind] = put +1; element_[put] = element[j]; index_[put] = i; } #endif } // and re-adjust start_ for (i = 0; i < majorDim_; ++i) { start_[i] -= length_[i]; } } //############################################################################# void CoinPackedMatrix::assignMatrix(const bool colordered, const int minor, const int major, const CoinBigIndex numels, double *& elem, int *& ind, CoinBigIndex *& start, int *& len, const int maxmajor, const CoinBigIndex maxsize) { gutsOfDestructor(); colOrdered_ = colordered; element_ = elem; index_ = ind; start_ = start; majorDim_ = major; minorDim_ = minor; size_ = numels; maxMajorDim_ = maxmajor != -1 ? maxmajor : major; maxSize_ = maxsize != -1 ? maxsize : numels; if (len == NULL) { delete [] length_; length_ = new int[maxMajorDim_]; std::adjacent_difference(start + 1, start + (major + 1), length_); length_[0] -= start[0]; } else { length_ = len; } elem = NULL; ind = NULL; start = NULL; len = NULL; } //############################################################################# CoinPackedMatrix & CoinPackedMatrix::operator=(const CoinPackedMatrix& rhs) { if (this != &rhs) { gutsOfDestructor(); extraGap_=rhs.extraGap_; extraMajor_=rhs.extraMajor_; gutsOfOpEqual(rhs.colOrdered_, rhs.minorDim_, rhs.majorDim_, rhs.size_, rhs.element_, rhs.index_, rhs.start_, rhs.length_); } return *this; } //############################################################################# void CoinPackedMatrix::reverseOrdering() { CoinPackedMatrix m; m.extraGap_ = extraMajor_; m.extraMajor_ = extraGap_; m.reverseOrderedCopyOf(*this); swap(m); } //----------------------------------------------------------------------------- void CoinPackedMatrix::transpose() { colOrdered_ = ! colOrdered_; } //----------------------------------------------------------------------------- void CoinPackedMatrix::swap(CoinPackedMatrix& m) { std::swap(colOrdered_, m.colOrdered_); std::swap(extraGap_, m.extraGap_); std::swap(extraMajor_, m.extraMajor_); std::swap(element_, m.element_); std::swap(index_, m.index_); std::swap(start_, m.start_); std::swap(length_, m.length_); std::swap(majorDim_, m.majorDim_); std::swap(minorDim_, m.minorDim_); std::swap(size_, m.size_); std::swap(maxMajorDim_, m.maxMajorDim_); std::swap(maxSize_, m.maxSize_); } //############################################################################# //############################################################################# void CoinPackedMatrix::times(const double * x, double * y) const { if (colOrdered_) timesMajor(x, y); else timesMinor(x, y); } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::times(const CoinPackedVectorBase& x, double * y) const { if (colOrdered_) timesMajor(x, y); else timesMinor(x, y); } #endif //----------------------------------------------------------------------------- void CoinPackedMatrix::transposeTimes(const double * x, double * y) const { if (colOrdered_) timesMinor(x, y); else timesMajor(x, y); } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::transposeTimes(const CoinPackedVectorBase& x, double * y) const { if (colOrdered_) timesMinor(x, y); else timesMajor(x, y); } #endif //############################################################################# //############################################################################# /* Count the number of entries in every minor-dimension vector and fill in an array containing these lengths. */ void CoinPackedMatrix::countOrthoLength(int * orthoLength) const { CoinZeroN(orthoLength, minorDim_); if (size_!=start_[majorDim_]) { // has gaps for (int i = 0; i =0); ++orthoLength[index_[j]]; } } } else { // no gaps const CoinBigIndex last = start_[majorDim_]; for (CoinBigIndex j = 0; j < last; ++j) { assert( index_[j] < minorDim_ && index_[j]>=0); ++orthoLength[index_[j]]; } } } int * CoinPackedMatrix::countOrthoLength() const { int * orthoLength = new int[minorDim_]; countOrthoLength(orthoLength); return orthoLength; } //############################################################################# /* Returns an array containing major indices. The array is getNumElements long and if getVectorStarts() is 0,2,5 then the array would start 0,0,1,1,1,2... This method is provided to go back from a packed format to a triple format. The returned array is allocated with new int[], free it with delete[]. */ int * CoinPackedMatrix::getMajorIndices() const { // Check valid if (!majorDim_||start_[majorDim_]!=size_) return NULL; int * array = new int [size_]; for (int i=0;i(), bind2nd(less(), 0), bind2nd(greater_equal(), minorDim_))) != vecind + vecsize) throw CoinError("out of range index", "appendMajorVector", "CoinPackedMatrix"); #endif #endif if (majorDim_ == maxMajorDim_ || vecsize > maxSize_ - getLastStart()) { resizeForAddingMajorVectors(1, &vecsize); } // got to get this again since it might change! const CoinBigIndex last = getLastStart(); // OK, now just append the major-dimension vector to the end length_[majorDim_] = vecsize; CoinMemcpyN(vecind, vecsize, index_ + last); CoinMemcpyN(vecelem, vecsize, element_ + last); if (majorDim_ == 0) start_[0] = 0; start_[majorDim_ + 1] = CoinMin(last + CoinLengthWithExtra(vecsize, extraGap_), maxSize_ ); // LL: Do we want to allow appending a vector that has more entries than // the current size? if (vecsize > 0) { minorDim_ = CoinMax(minorDim_, (*std::max_element(vecind, vecind+vecsize)) + 1); } ++majorDim_; size_ += vecsize; } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::appendMajorVector(const CoinPackedVectorBase& vec) { appendMajorVector(vec.getNumElements(), vec.getIndices(), vec.getElements()); } //----------------------------------------------------------------------------- void CoinPackedMatrix::appendMajorVectors(const int numvecs, const CoinPackedVectorBase * const * vecs) { int i; CoinBigIndex nz = 0; for (i = 0; i < numvecs; ++i) nz += CoinLengthWithExtra(vecs[i]->getNumElements(), extraGap_); reserve(majorDim_ + numvecs, getLastStart() + nz); for (i = 0; i < numvecs; ++i) appendMajorVector(*vecs[i]); } #endif //############################################################################# void CoinPackedMatrix::appendMinorVector(const int vecsize, const int *vecind, const double *vecelem) { if (vecsize == 0) { ++minorDim_; // empty row/column - still need to increase return; } int i; #if COIN_COINUTILS_CHECKLEVEL > 3 // Test if any of the indices are out of range for (i = 0; i < vecsize; ++i) { if (vecind[i] < 0 || vecind[i] >= majorDim_) throw CoinError("out of range index", "appendMinorVector", "CoinPackedMatrix"); } // Test if there are duplicate indices int* sortedind = CoinCopyOfArray(vecind, vecsize); std::sort(sortedind, sortedind+vecsize); if (std::adjacent_find(sortedind, sortedind+vecsize) != sortedind+vecsize) { throw CoinError("identical indices", "appendMinorVector", "CoinPackedMatrix"); } #endif // test that there's a gap at the end of every major-dimension vector where // we want to add a new entry for (i = vecsize - 1; i >= 0; --i) { const int j = vecind[i]; if (start_[j] + length_[j] == start_[j+1]) break; } if (i >= 0) { int * addedEntries = new int[majorDim_]; memset(addedEntries, 0, majorDim_ * sizeof(int)); for (i = vecsize - 1; i >= 0; --i) addedEntries[vecind[i]] = 1; resizeForAddingMinorVectors(addedEntries); delete[] addedEntries; } // OK, now insert the entries of the minor-dimension vector for (i = vecsize - 1; i >= 0; --i) { const int j = vecind[i]; const CoinBigIndex posj = start_[j] + (length_[j]++); index_[posj] = minorDim_; element_[posj] = vecelem[i]; } ++minorDim_; size_ += vecsize; } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::appendMinorVector(const CoinPackedVectorBase& vec) { appendMinorVector(vec.getNumElements(), vec.getIndices(), vec.getElements()); } //----------------------------------------------------------------------------- void CoinPackedMatrix::appendMinorVectors(const int numvecs, const CoinPackedVectorBase * const * vecs) { if (numvecs == 0) return; int i; int * addedEntries = new int[majorDim_]; CoinZeroN(addedEntries, majorDim_); for (i = numvecs - 1; i >= 0; --i) { const int vecsize = vecs[i]->getNumElements(); const int* vecind = vecs[i]->getIndices(); for (int j = vecsize - 1; j >= 0; --j) { #ifdef COIN_DEBUG if (vecind[j] < 0 || vecind[j] >= majorDim_) throw CoinError("out of range index", "appendMinorVectors", "CoinPackedMatrix"); #endif ++addedEntries[vecind[j]]; } } for (i = majorDim_ - 1; i >= 0; --i) { if (start_[i] + length_[i] + addedEntries[i] > start_[i+1]) break; } if (i >= 0) resizeForAddingMinorVectors(addedEntries); delete[] addedEntries; // now insert the entries of the vectors for (i = 0; i < numvecs; ++i) { const int vecsize = vecs[i]->getNumElements(); const int* vecind = vecs[i]->getIndices(); const double* vecelem = vecs[i]->getElements(); for (int j = vecsize - 1; j >= 0; --j) { const int ind = vecind[j]; element_[start_[ind] + length_[ind]] = vecelem[j]; index_[start_[ind] + (length_[ind]++)] = minorDim_; } ++minorDim_; size_ += vecsize; } } #endif //############################################################################# //############################################################################# void CoinPackedMatrix::majorAppendSameOrdered(const CoinPackedMatrix& matrix) { if (minorDim_ != matrix.minorDim_) { throw CoinError("dimension mismatch", "rightAppendSameOrdered", "CoinPackedMatrix"); } if (matrix.majorDim_ == 0) return; int i; if (majorDim_ + matrix.majorDim_ > maxMajorDim_ || getLastStart() + matrix.getLastStart() > maxSize_) { // we got to resize before we add. note that the resizing method // properly fills out start_ and length_ for the major-dimension // vectors to be added! resizeForAddingMajorVectors(matrix.majorDim_, matrix.length_); start_ += majorDim_; for (i = 0; i < matrix.majorDim_; ++i) { const int l = matrix.length_[i]; CoinMemcpyN(matrix.index_ + matrix.start_[i], l, index_ + start_[i]); CoinMemcpyN(matrix.element_ + matrix.start_[i], l, element_ + start_[i]); } start_ -= majorDim_; } else { start_ += majorDim_; length_ += majorDim_; for (i = 0; i < matrix.majorDim_; ++i) { const int l = matrix.length_[i]; CoinMemcpyN(matrix.index_ + matrix.start_[i], l, index_ + start_[i]); CoinMemcpyN(matrix.element_ + matrix.start_[i], l, element_ + start_[i]); start_[i+1] = start_[i] + matrix.start_[i+1] - matrix.start_[i]; length_[i] = l; } start_ -= majorDim_; length_ -= majorDim_; } majorDim_ += matrix.majorDim_; size_ += matrix.size_; } //----------------------------------------------------------------------------- void CoinPackedMatrix::minorAppendSameOrdered(const CoinPackedMatrix& matrix) { if (majorDim_ != matrix.majorDim_) { throw CoinError("dimension mismatch", "bottomAppendSameOrdered", "CoinPackedMatrix"); } if (matrix.minorDim_ == 0) return; int i; for (i = majorDim_ - 1; i >= 0; --i) { if (start_[i] + length_[i] + matrix.length_[i] > start_[i+1]) break; } if (i >= 0) resizeForAddingMinorVectors(matrix.length_); // now insert the entries of matrix for (i = majorDim_ - 1; i >= 0; --i) { const int l = matrix.length_[i]; std::transform(matrix.index_ + matrix.start_[i], matrix.index_ + (matrix.start_[i] + l), index_ + (start_[i] + length_[i]), std::bind2nd(std::plus(), minorDim_)); CoinMemcpyN(matrix.element_ + matrix.start_[i], l, element_ + (start_[i] + length_[i])); length_[i] += l; } minorDim_ += matrix.minorDim_; size_ += matrix.size_; } //----------------------------------------------------------------------------- void CoinPackedMatrix::majorAppendOrthoOrdered(const CoinPackedMatrix& matrix) { if (minorDim_ != matrix.majorDim_) { throw CoinError("dimension mismatch", "majorAppendOrthoOrdered", "CoinPackedMatrix"); } if (matrix.majorDim_ == 0) return; int i; CoinBigIndex j; // this trickery is needed because MSVC++ is not willing to delete[] a // 'const int *' int * orthoLengthPtr = matrix.countOrthoLength(); const int * orthoLength = orthoLengthPtr; if (majorDim_ + matrix.minorDim_ > maxMajorDim_) { resizeForAddingMajorVectors(matrix.minorDim_, orthoLength); } else { const double extra_gap = extraGap_; start_ += majorDim_; for (i = 0; i < matrix.minorDim_ ; ++i) { start_[i+1] = start_[i] + CoinLengthWithExtra(orthoLength[i], extra_gap); } start_ -= majorDim_; if (start_[majorDim_ + matrix.minorDim_] > maxSize_) { resizeForAddingMajorVectors(matrix.minorDim_, orthoLength); } } // At this point everything is big enough to accommodate the new entries. // Also, start_ is set to the correct starting points for all the new // major-dimension vectors. The length of the new major-dimension vectors // may or may not be correctly set. Hence we just zero them out and they'll // be set when the entries are actually added below. start_ += majorDim_; length_ += majorDim_; CoinZeroN(length_, matrix.minorDim_); for (i = 0; i < matrix.majorDim_; ++i) { const CoinBigIndex last = matrix.getVectorLast(i); for (j = matrix.getVectorFirst(i); j < last; ++j) { const int ind = matrix.index_[j]; element_[start_[ind] + length_[ind]] = matrix.element_[j]; index_[start_[ind] + (length_[ind]++)] = i; } } length_ -= majorDim_; start_ -= majorDim_; // We need to update majorDim_ and size_. We can just add in from matrix majorDim_ += matrix.minorDim_; size_ += matrix.size_; delete[] orthoLengthPtr; } //----------------------------------------------------------------------------- void CoinPackedMatrix::minorAppendOrthoOrdered(const CoinPackedMatrix& matrix) { if (majorDim_ != matrix.minorDim_) { throw CoinError("dimension mismatch", "bottomAppendOrthoOrdered", "CoinPackedMatrix"); } if (matrix.majorDim_ == 0) return; int i; // first compute how many entries will be added to each major-dimension // vector, and if needed, resize the matrix to accommodate all // this trickery is needed because MSVC++ is not willing to delete[] a // 'const int *' int * addedEntriesPtr = matrix.countOrthoLength(); const int * addedEntries = addedEntriesPtr; for (i = majorDim_ - 1; i >= 0; --i) { if (start_[i] + length_[i] + addedEntries[i] > start_[i+1]) break; } if (i >= 0) resizeForAddingMinorVectors(addedEntries); delete[] addedEntriesPtr; // now insert the entries of matrix for (i = 0; i < matrix.majorDim_; ++i) { const CoinBigIndex last = matrix.getVectorLast(i); for (CoinBigIndex j = matrix.getVectorFirst(i); j != last; ++j) { const int ind = matrix.index_[j]; element_[start_[ind] + length_[ind]] = matrix.element_[j]; index_[start_[ind] + (length_[ind]++)] = minorDim_; } ++minorDim_; } size_ += matrix.size_; } //############################################################################# //############################################################################# void CoinPackedMatrix::deleteMajorVectors(const int numDel, const int * indDel) { if (numDel == majorDim_) { // everything is deleted majorDim_ = 0; minorDim_ = 0; size_ = 0; // Get rid of memory as well maxMajorDim_ = 0; delete [] length_; length_ = NULL; delete [] start_; start_ = new CoinBigIndex[1]; start_[0]=0;; delete [] element_; element_=NULL; delete [] index_; index_=NULL; maxSize_ = 0; return; } if (!extraGap_&&!extraMajor_&&false) { // See if this is faster char * keep = new char[majorDim_]; memset(keep,1,majorDim_); for (int i=0;i=0&&k 1) { CoinCopy(start_ + (ind + 1), start_ + ind1, start_ + (ind - i)); CoinCopy(length_ + (ind + 1), length_ + ind1, length_ + (ind - i)); } } // copy the last block of length_ and start_ const int ind = sortedDel[last]; deleted += length_[ind]; if (sortedDel[last] != majorDim_ - 1) { const int ind1 = majorDim_; CoinCopy(start_ + (ind + 1), start_ + ind1, start_ + (ind - last)); CoinCopy(length_ + (ind + 1), length_ + ind1, length_ + (ind - last)); } majorDim_ -= numDel; const int lastlength = CoinLengthWithExtra(length_[majorDim_-1], extraGap_); start_[majorDim_] = CoinMin(start_[majorDim_-1] + lastlength, maxSize_); size_ -= deleted; // if the very first major vector was deleted then copy the new first major // vector to the beginning to make certain that start_[0] is 0. This may // not be necessary, but better safe than sorry... if (sortedDel[0] == 0) { CoinCopyN(index_ + start_[0], length_[0], index_); CoinCopyN(element_ + start_[0], length_[0], element_); start_[0] = 0; } delete[] sortedDelPtr; } } //############################################################################# void CoinPackedMatrix::deleteMinorVectors(const int numDel, const int * indDel) { if (numDel == minorDim_) { // everything is deleted minorDim_ = 0; size_ = 0; // Get rid of as much memory as possible memset(length_,0,majorDim_*sizeof(int)); memset(start_,0,(majorDim_+1)*sizeof(CoinBigIndex )); delete [] element_; element_=NULL; delete [] index_; index_=NULL; maxSize_ = 0; return; } int i, j, k; // first compute the new index of every row int* newindexPtr = new int[minorDim_]; CoinZeroN(newindexPtr, minorDim_); for (j = 0; j < numDel; ++j) { const int ind = indDel[j]; #ifdef COIN_DEBUG if (ind < 0 || ind >= minorDim_) throw CoinError("out of range index", "deleteMinorVectors", "CoinPackedMatrix"); if (newindexPtr[ind] == -1) throw CoinError("duplicate index", "deleteMinorVectors", "CoinPackedMatrix"); #endif newindexPtr[ind] = -1; } for (i = 0, k = 0; i < minorDim_; ++i) { if (newindexPtr[i] != -1) { newindexPtr[i] = k++; } } // Now crawl through the matrix const int * newindex = newindexPtr; #ifdef TAKEOUT int mcount[400]; memset(mcount,0,400*sizeof(int)); for (i = 0; i < majorDim_; ++i) { int * index = index_ + start_[i]; double * elem = element_ + start_[i]; const int length_i = length_[i]; for (j = 0, k = 0; j < length_i; ++j) { mcount[index[j]]++; } } for (i=0;i=0) printf("Keeping original row %d (new %d) with count of %d\n", i,newindex[i],mcount[i]); else printf("deleting row %d with count of %d\n", i,mcount[i]); } } #endif if (!extraGap_) { // pack down size_=0; for (i = 0; i < majorDim_; ++i) { int * index = index_ + start_[i]; double * elem = element_ + start_[i]; start_[i]=size_; const int length_i = length_[i]; for (j = 0; j < length_i; ++j) { const int ind = newindex[index[j]]; if (ind >= 0) { index_[size_] = ind; element_[size_++] = elem[j]; } } length_[i] = size_-start_[i]; } start_[majorDim_]=size_; } else { int deleted = 0; for (i = 0; i < majorDim_; ++i) { int * index = index_ + start_[i]; double * elem = element_ + start_[i]; const int length_i = length_[i]; for (j = 0, k = 0; j < length_i; ++j) { const int ind = newindex[index[j]]; if (ind != -1) { index[k] = ind; elem[k++] = elem[j]; } } deleted += length_i - k; length_[i] = k; } size_ -= deleted; } delete[] newindexPtr; minorDim_ -= numDel; } //############################################################################# //############################################################################# void CoinPackedMatrix::timesMajor(const double * x, double * y) const { memset(y, 0, minorDim_ * sizeof(double)); for (int i = majorDim_ - 1; i >= 0; --i) { const double x_i = x[i]; if (x_i != 0.0) { const CoinBigIndex last = getVectorLast(i); for (CoinBigIndex j = getVectorFirst(i); j < last; ++j) y[index_[j]] += x_i * element_[j]; } } } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::timesMajor(const CoinPackedVectorBase& x, double * y) const { memset(y, 0, minorDim_ * sizeof(double)); for (CoinBigIndex i = x.getNumElements() - 1; i >= 0; --i) { const double x_i = x.getElements()[i]; if (x_i != 0.0) { const int ind = x.getIndices()[i]; const CoinBigIndex last = getVectorLast(ind); for (CoinBigIndex j = getVectorFirst(ind); j < last; ++j) y[index_[j]] += x_i * element_[j]; } } } #endif //----------------------------------------------------------------------------- void CoinPackedMatrix::timesMinor(const double * x, double * y) const { memset(y, 0, majorDim_ * sizeof(double)); for (int i = majorDim_ - 1; i >= 0; --i) { double y_i = 0; const CoinBigIndex last = getVectorLast(i); for (CoinBigIndex j = getVectorFirst(i); j < last; ++j) y_i += x[index_[j]] * element_[j]; y[i] = y_i; } } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR void CoinPackedMatrix::timesMinor(const CoinPackedVectorBase& x, double * y) const { memset(y, 0, majorDim_ * sizeof(double)); for (int i = majorDim_ - 1; i >= 0; --i) { double y_i = 0; const CoinBigIndex last = getVectorLast(i); for (CoinBigIndex j = getVectorFirst(i); j < last; ++j) y_i += x[index_[j]] * element_[j]; y[i] = y_i; } } #endif //############################################################################# //############################################################################# CoinPackedMatrix::CoinPackedMatrix() : colOrdered_(true), extraGap_(0.0), extraMajor_(0.0), element_(0), index_(0), length_(0), majorDim_(0), minorDim_(0), size_(0), maxMajorDim_(0), maxSize_(0) { start_ = new CoinBigIndex[1]; start_[0] = 0; } //----------------------------------------------------------------------------- CoinPackedMatrix::CoinPackedMatrix(const bool colordered, const double extraMajor, const double extraGap) : colOrdered_(colordered), extraGap_(extraGap), extraMajor_(extraMajor), element_(0), index_(0), length_(0), majorDim_(0), minorDim_(0), size_(0), maxMajorDim_(0), maxSize_(0) { start_ = new CoinBigIndex[1]; start_[0] = 0; } //----------------------------------------------------------------------------- CoinPackedMatrix::CoinPackedMatrix(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len, const double extraMajor, const double extraGap) : colOrdered_(colordered), extraGap_(extraGap), extraMajor_(extraMajor), element_(NULL), index_(NULL), start_(NULL), length_(NULL), majorDim_(0), minorDim_(0), size_(0), maxMajorDim_(0), maxSize_(0) { gutsOfOpEqual(colordered, minor, major, numels, elem, ind, start, len); } //----------------------------------------------------------------------------- CoinPackedMatrix::CoinPackedMatrix(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len) : colOrdered_(colordered), extraGap_(0.0), extraMajor_(0.0), element_(NULL), index_(NULL), start_(NULL), length_(NULL), majorDim_(0), minorDim_(0), size_(0), maxMajorDim_(0), maxSize_(0) { gutsOfOpEqual(colordered, minor, major, numels, elem, ind, start, len); } //----------------------------------------------------------------------------- // makes column ordered from triplets and takes out duplicates // will be sorted // // This is an interesting in-place sorting algorithm; // We have triples, and want to sort them so that triples with the same column // are adjacent. // We begin by computing how many entries there are for each column (columnCount) // and using that to compute where each set of column entries will *end* (startColumn). // As we drop entries into place, startColumn is decremented until it contains // the position where the column entries *start*. // The invalid column index -2 means there's a "hole" in that position; // the invalid column index -1 means the entry in that spot is "where it wants to go". // Initially, no one is where they want to go. // Going back to front, // if that entry is where it wants to go // then leave it there // otherwise pick it up (which leaves a hole), and // for as long as you have an entry in your right hand, // - pick up the entry (with your left hand) in the position where the one in // your right hand wants to go; // - pass the entry in your left hand to your right hand; // - was that entry really just the "hole"? If so, stop. // It could be that all the entries get shuffled in the first loop iteration // and all the rest just confirm that everyone is happy where they are. // We never move an entry that is where it wants to go, so entries are moved at // most once. They may not change position if they happen to initially be // where they want to go when the for loop gets to them. // It depends on how many subpermutations the triples initially defined. // Each while loop takes care of one permutation. // The while loop has to stop, because each time around we mark one entry as happy. // We can't run into a happy entry, because we are decrementing the startColumn // all the time, so we must be running into new entries. // Once we've processed all the slots for a column, it cannot be the case that // there are any others that want to go there. // This all means that we eventually must run into the hole. CoinPackedMatrix::CoinPackedMatrix( const bool colordered, const int * indexRow , const int * indexColumn, const double * element, CoinBigIndex numberElements ) : colOrdered_(colordered), extraGap_(0.0), extraMajor_(0.0), element_(NULL), index_(NULL), start_(NULL), length_(NULL), majorDim_(0), minorDim_(0), size_(0), maxMajorDim_(0), maxSize_(0) { CoinAbsFltEq eq; int * colIndices = new int[numberElements]; int * rowIndices = new int[numberElements]; double * elements = new double[numberElements]; CoinCopyN(element,numberElements,elements); if ( colordered ) { CoinCopyN(indexColumn,numberElements,colIndices); CoinCopyN(indexRow,numberElements,rowIndices); } else { CoinCopyN(indexColumn,numberElements,rowIndices); CoinCopyN(indexRow,numberElements,colIndices); } int numberRows; int numberColumns; if (numberElements ) { numberRows = *std::max_element(rowIndices,rowIndices+numberElements)+1; numberColumns = *std::max_element(colIndices,colIndices+numberElements)+1; } else { numberRows = 0; numberColumns = 0; } int * rowCount = new int[numberRows]; int * columnCount = new int[numberColumns]; CoinBigIndex * startColumn = new CoinBigIndex[numberColumns+1]; int * lengths = new int[numberColumns+1]; int iColumn,i; CoinBigIndex k; for (i=0;i=0;k--) { iColumn=colIndices[k]; if (iColumn>=0) { /* pick up the entry with your right hand */ double value = elements[k]; int iRow=rowIndices[k]; colIndices[k]=-2; /* the hole */ while (1) { /* pick this up with your left */ CoinBigIndex iLook=startColumn[iColumn]-1; double valueSave=elements[iLook]; int iColumnSave=colIndices[iLook]; int iRowSave=rowIndices[iLook]; /* put the right-hand entry where it wanted to go */ startColumn[iColumn]=iLook; elements[iLook]=value; rowIndices[iLook]=iRow; colIndices[iLook]=-1; /* mark it as being where it wants to be */ /* there was something there */ if (iColumnSave>=0) { iColumn=iColumnSave; value=valueSave; iRow=iRowSave; } else if (iColumnSave == -2) { /* that was the hole */ break; } else { assert(1==0); /* should never happen */ } /* endif */ } /* endwhile */ } /* endif */ } /* endfor */ /* now pack the elements and combine entries with the same row and column */ /* also, drop entries with "small" coefficients */ numberElements=0; for (iColumn=0;iColumnstart) { int lastRow; double lastValue; // sorts on indices dragging elements with CoinSort_2(rowIndices+start,rowIndices+end,elements+start,CoinFirstLess_2()); lastRow=rowIndices[start]; lastValue=elements[start]; for (i=start+1;ilastRow) { //if(fabs(lastValue)>tolerance) { if(!eq(lastValue,0.0)) { rowIndices[numberElements]=lastRow; elements[numberElements]=lastValue; numberElements++; lengths[iColumn]++; } lastRow=iRow; lastValue=value; } else { lastValue+=value; } /* endif */ } /* endfor */ //if(fabs(lastValue)>tolerance) { if(!eq(lastValue,0.0)) { rowIndices[numberElements]=lastRow; elements[numberElements]=lastValue; numberElements++; lengths[iColumn]++; } } } /* endfor */ startColumn[numberColumns]=numberElements; #if 0 gutsOfOpEqual(colordered,numberRows,numberColumns,numberElements,elements,rowIndices,startColumn,lengths); delete [] rowCount; delete [] columnCount; delete [] startColumn; delete [] lengths; delete [] colIndices; delete [] rowIndices; delete [] elements; #else assignMatrix(colordered,numberRows,numberColumns,numberElements, elements,rowIndices,startColumn,lengths); delete [] rowCount; delete [] columnCount; delete [] lengths; delete [] colIndices; #endif } //----------------------------------------------------------------------------- CoinPackedMatrix::CoinPackedMatrix (const CoinPackedMatrix & rhs) : colOrdered_(true), extraGap_(0.0), extraMajor_(0.0), element_(0), index_(0), start_(0), length_(0), majorDim_(0), minorDim_(0), size_(0), maxMajorDim_(0), maxSize_(0) { bool hasGaps = rhs.size_=0) { maxMajorDim_ = majorDim_+ extraForMajor; maxSize_ = size_ + extraElements; assert (maxMajorDim_>0); assert (maxSize_>0); length_ = new int[maxMajorDim_]; CoinMemcpyN(rhs.length_, majorDim_, length_); start_ = new CoinBigIndex[maxMajorDim_+1]; element_ = new double[maxSize_]; index_ = new int[maxSize_]; bool hasGaps = rhs.size_0) { length_ = new int[maxMajorDim_]; start_ = new CoinBigIndex[maxMajorDim_+1]; if (maxSize_>0) { element_ = new double[maxSize_]; index_ = new int[maxSize_]; } CoinBigIndex size=0; const double * oldElement = rhs.element_; const CoinBigIndex * oldStart = rhs.start_; const int * oldIndex = rhs.index_; const int * oldLength = rhs.length_; CoinBigIndex tooSmallCount=0; for (int i = 0 ; i < majorDim_ ; i++) { start_[i]=size; for (CoinBigIndex j=oldStart[i]; j1.0e-21) { element_[size]=value; index_[size++]=oldIndex[j]; } else { tooSmallCount++; } } length_[i]=size-start_[i]; } start_[majorDim_]=size; assert (size_==size+tooSmallCount); size_ = size; } else { start_ = new CoinBigIndex[1]; start_[0]=0; } } } else { // more complicated colOrdered_ = ! colOrdered_; minorDim_ = rhs.majorDim_; majorDim_ = rhs.minorDim_; maxMajorDim_ = majorDim_ + extraForMajor; maxSize_ = CoinMax(size_ + extraElements,1); assert (maxMajorDim_>0); length_ = new int[maxMajorDim_]; start_ = new CoinBigIndex[maxMajorDim_+1]; element_ = new double[maxSize_]; index_ = new int[maxSize_]; bool hasGaps = rhs.size_=0); ++length_[rhs.index_[j]]; } } } else { // no gaps const CoinBigIndex last = rhs.start_[rhs.majorDim_]; for (CoinBigIndex j = 0; j < last; ++j) { assert( rhs.index_[j] < rhs.minorDim_ && rhs.index_[j]>=0); ++length_[rhs.index_[j]]; } } // Now do starts CoinBigIndex size=0; for (i = 0; i =0 && kRow < rhs.minorDim_) { if (newRow[kRow]<0) { // first time newRow[kRow]=iRow; } else { // duplicate numberDuplicate++; int lastRow = newRow[kRow]; newRow[kRow]=iRow; duplicateRow[iRow] = lastRow; } } else { // bad row numberBad++; } } if (numberBad) throw CoinError("bad minor entries", "subset constructor", "CoinPackedMatrix"); // now get size and check columns size_ = 0; int iColumn; numberBad=0; if (!numberDuplicate) { // No duplicates so can do faster // If not much smaller then use original size if (3*majorDim_>2*rhs.majorDim_&& 3*minorDim_>2*rhs.minorDim_) { // now create arrays maxSize_=CoinMax(static_cast (1),rhs.size_); start_ = new CoinBigIndex [numberColumns+1]; length_ = new int [numberColumns]; index_ = new int[maxSize_]; element_ = new double [maxSize_]; // and fill them size_ = 0; start_[0]=0; for (iColumn=0;iColumn=0 && kColumn =0) { index_[size_] = kRow; element_[size_++] = value; } } } else { // bad column numberBad++; } start_[iColumn+1] = size_; length_[iColumn] = size_ - start_[iColumn]; } if (numberBad) throw CoinError("bad major entries", "subset constructor", "CoinPackedMatrix"); } else { for (iColumn=0;iColumn=0 && kColumn =0) size_++; } } else { // bad column numberBad++; } } if (numberBad) throw CoinError("bad major entries", "subset constructor", "CoinPackedMatrix"); // now create arrays maxSize_=CoinMax(static_cast (1),size_); start_ = new CoinBigIndex [numberColumns+1]; length_ = new int [numberColumns]; index_ = new int[maxSize_]; element_ = new double [maxSize_]; // and fill them size_ = 0; start_[0]=0; for (iColumn=0;iColumn=0) { index_[size_] = kRow; element_[size_++] = value; } } start_[iColumn+1] = size_; length_[iColumn] = size_ - start_[iColumn]; } } } else { for (iColumn=0;iColumn=0 && kColumn =0) { size_++; kRow = duplicateRow[kRow]; } } } else { // bad column numberBad++; } } if (numberBad) throw CoinError("bad major entries", "subset constructor", "CoinPackedMatrix"); // now create arrays maxSize_=CoinMax(static_cast (1),size_); start_ = new CoinBigIndex [numberColumns+1]; length_ = new int [numberColumns]; index_ = new int[maxSize_]; element_ = new double [maxSize_]; // and fill them size_ = 0; start_[0]=0; for (iColumn=0;iColumn=0) { index_[size_] = kRow; element_[size_++] = value; kRow = duplicateRow[kRow]; } } start_[iColumn+1] = size_; length_[iColumn] = size_ - start_[iColumn]; } } delete [] newRow; delete [] duplicateRow; } } //----------------------------------------------------------------------------- CoinPackedMatrix::~CoinPackedMatrix () { gutsOfDestructor(); } //############################################################################# //############################################################################# //############################################################################# void CoinPackedMatrix::gutsOfDestructor() { delete[] length_; delete[] start_; delete[] index_; delete[] element_; length_ = 0; start_ = 0; index_ = 0; element_ = 0; } //############################################################################# void CoinPackedMatrix::gutsOfCopyOf(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len, const double extraMajor, const double extraGap) { colOrdered_ = colordered; majorDim_ = major; minorDim_ = minor; size_ = numels; extraGap_ = extraGap; extraMajor_ = extraMajor; maxMajorDim_ = CoinLengthWithExtra(majorDim_, extraMajor_); if (maxMajorDim_ > 0) { delete [] length_; length_ = new int[maxMajorDim_]; if (len == 0) { std::adjacent_difference(start + 1, start + (major + 1), length_); length_[0] -= start[0]; } else { CoinMemcpyN(len, major, length_); } delete [] start_; start_ = new CoinBigIndex[maxMajorDim_+1]; start_[0]=0; CoinMemcpyN(start, major+1, start_); } else { // empty but be safe delete [] length_; length_ = NULL; delete [] start_; start_ = new CoinBigIndex[1]; start_[0]=0; } maxSize_ = maxMajorDim_ > 0 ? start_[major] : 0; maxSize_ = CoinLengthWithExtra(maxSize_, extraMajor_); if (maxSize_ > 0) { delete [] element_; delete []index_; element_ = new double[maxSize_]; index_ = new int[maxSize_]; // we can't just simply memcpy these content over, because that can // upset memory debuggers like purify if there were gaps and those gaps // were uninitialized memory blocks for (int i = majorDim_ - 1; i >= 0; --i) { CoinMemcpyN(ind + start[i], length_[i], index_ + start_[i]); CoinMemcpyN(elem + start[i], length_[i], element_ + start_[i]); } } } //############################################################################# void CoinPackedMatrix::gutsOfCopyOfNoGaps(const bool colordered, const int minor, const int major, const double * elem, const int * ind, const CoinBigIndex * start) { colOrdered_ = colordered; majorDim_ = major; minorDim_ = minor; size_ = start[majorDim_]; extraGap_ = 0; extraMajor_ = 0; maxMajorDim_ = majorDim_; // delete all arrays delete [] length_; delete [] start_; delete [] element_; delete [] index_; if (maxMajorDim_ > 0) { length_ = new int[maxMajorDim_]; assert (!start[0]); start_ = new CoinBigIndex[maxMajorDim_+1]; start_[0]=0; CoinBigIndex last = 0; for (int i=0;i 0) { element_ = new double[maxSize_]; index_ = new int[maxSize_]; CoinMemcpyN(ind , maxSize_, index_); CoinMemcpyN(elem , maxSize_, element_); } else { element_ = NULL; index_ = NULL; } } //############################################################################# void CoinPackedMatrix::gutsOfOpEqual(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len) { colOrdered_ = colordered; majorDim_ = major; minorDim_ = minor; size_ = numels; if (!len && numels > 0 && numels==start[major] && start[0]==0) { // No gaps - do faster if (major>maxMajorDim_||!start_) { maxMajorDim_ = major; delete [] length_; length_ = new int[maxMajorDim_]; delete [] start_; start_ = new CoinBigIndex[maxMajorDim_+1]; } CoinMemcpyN(start,major+1,start_); std::adjacent_difference(start + 1, start + (major + 1), length_); if (numels>maxSize_||!element_) { maxSize_=numels; delete [] element_; delete [] index_; element_ = new double[maxSize_]; index_ = new int[maxSize_]; } CoinMemcpyN(ind,numels,index_); CoinMemcpyN(elem,numels,element_); } else { maxMajorDim_ = CoinLengthWithExtra(majorDim_, extraMajor_); int i; if (maxMajorDim_ > 0) { delete [] length_; length_ = new int[maxMajorDim_]; if (len == 0) { std::adjacent_difference(start + 1, start + (major + 1), length_); length_[0] -= start[0]; } else { CoinMemcpyN(len, major, length_); } delete [] start_; start_ = new CoinBigIndex[maxMajorDim_+1]; start_[0] = 0; if (extraGap_ == 0) { for (i = 0; i < major; ++i) start_[i+1] = start_[i] + length_[i]; } else { const double extra_gap = extraGap_; for (i = 0; i < major; ++i) start_[i+1] = start_[i] + CoinLengthWithExtra(length_[i], extra_gap); } } else { // empty matrix delete [] start_; start_ = new CoinBigIndex[1]; start_[0] = 0; } maxSize_ = maxMajorDim_ > 0 ? start_[major] : 0; maxSize_ = CoinLengthWithExtra(maxSize_, extraMajor_); if (maxSize_ > 0) { delete [] element_; delete [] index_; element_ = new double[maxSize_]; index_ = new int[maxSize_]; assert (maxSize_>=start_[majorDim_-1]+length_[majorDim_-1]); // we can't just simply memcpy these content over, because that can // upset memory debuggers like purify if there were gaps and those gaps // were uninitialized memory blocks for (i = majorDim_ - 1; i >= 0; --i) { CoinMemcpyN(ind + start[i], length_[i], index_ + start_[i]); CoinMemcpyN(elem + start[i], length_[i], element_ + start_[i]); } } } #ifndef NDEBUG for (int i = majorDim_ - 1; i >= 0; --i) { const CoinBigIndex last = getVectorLast(i); for (CoinBigIndex j = getVectorFirst(i); j < last; ++j) { int index = index_[j]; assert (index>=0&&index= 0; --i) { CoinMemcpyN(index_ + start_[i], length_[i], newIndex + newStart[i]); CoinMemcpyN(element_ + start_[i], length_[i], newElem + newStart[i]); } gutsOfDestructor(); start_ = newStart; length_ = newLength; index_ = newIndex; element_ = newElem; } //############################################################################# void CoinPackedMatrix::resizeForAddingMinorVectors(const int * addedEntries) { int i; maxMajorDim_ = CoinMax(CoinLengthWithExtra(majorDim_, extraMajor_), maxMajorDim_); CoinBigIndex * newStart = new CoinBigIndex[maxMajorDim_ + 1]; int * newLength = new int[maxMajorDim_]; // increase the lengths temporarily so that the correct new start positions // can be easily computed (it's faster to modify the lengths and reset them // than do a test for every entry when the start positions are computed. for (i = majorDim_ - 1; i >= 0; --i) newLength[i] = length_[i] + addedEntries[i]; newStart[0] = 0; if (extraGap_ == 0) { for (i = 0; i < majorDim_; ++i) newStart[i+1] = newStart[i] + newLength[i]; } else { const double eg = extraGap_; for (i = 0; i < majorDim_; ++i) newStart[i+1] = newStart[i] + CoinLengthWithExtra(newLength[i], eg); } // reset the lengths for (i = majorDim_ - 1; i >= 0; --i) newLength[i] -= addedEntries[i]; maxSize_ = CoinMax(maxSize_, CoinLengthWithExtra(newStart[majorDim_], extraMajor_)); int * newIndex = new int[maxSize_]; double * newElem = new double[maxSize_]; for (i = majorDim_ - 1; i >= 0; --i) { CoinMemcpyN(index_ + start_[i], length_[i], newIndex + newStart[i]); CoinMemcpyN(element_ + start_[i], length_[i], newElem + newStart[i]); } gutsOfDestructor(); start_ = newStart; length_ = newLength; index_ = newIndex; element_ = newElem; } //############################################################################# //############################################################################# void CoinPackedMatrix::dumpMatrix(const char* fname) const { if (! fname) { printf("Dumping matrix...\n\n"); printf("colordered: %i\n", isColOrdered() ? 1 : 0); const int major = getMajorDim(); const int minor = getMinorDim(); printf("major: %i minor: %i\n", major, minor); for (int i = 0; i < major; ++i) { printf("vec %i has length %i with entries:\n", i, length_[i]); for (CoinBigIndex j = start_[i]; j < start_[i] + length_[i]; ++j) { printf(" %15i %40.25f\n", index_[j], element_[j]); } } printf("\nFinished dumping matrix\n"); } else { FILE* out = fopen(fname, "w"); fprintf(out, "Dumping matrix...\n\n"); fprintf(out, "colordered: %i\n", isColOrdered() ? 1 : 0); const int major = getMajorDim(); const int minor = getMinorDim(); fprintf(out, "major: %i minor: %i\n", major, minor); for (int i = 0; i < major; ++i) { fprintf(out, "vec %i has length %i with entries:\n", i, length_[i]); for (CoinBigIndex j = start_[i]; j < start_[i] + length_[i]; ++j) { fprintf(out, " %15i %40.25f\n", index_[j], element_[j]); } } fprintf(out, "\nFinished dumping matrix\n"); fclose(out); } } void CoinPackedMatrix::printMatrixElement (const int row_val, const int col_val) const { int major_index, minor_index; if (isColOrdered()) { major_index = col_val; minor_index = row_val; } else { major_index = row_val; minor_index = col_val; } if (major_index < 0 || major_index > getMajorDim()-1) { std::cout << "Major index " << major_index << " not in range 0.." << getMajorDim()-1 << std::endl ; } else if (minor_index < 0 || minor_index > getMinorDim()-1) { std::cout << "Minor index " << minor_index << " not in range 0.." << getMinorDim()-1 << std::endl ; } else { CoinBigIndex curr_point = start_[major_index]; const CoinBigIndex stop_point = curr_point+length_[major_index]; double aij = 0.0 ; for ( ; curr_point < stop_point ; curr_point++) { if (index_[curr_point] == minor_index) { aij = element_[curr_point]; break; } } std::cout << aij ; } } #ifndef CLP_NO_VECTOR bool CoinPackedMatrix::isEquivalent2(const CoinPackedMatrix& rhs) const { CoinRelFltEq eq; // Both must be column order or both row ordered and must be of same size if (isColOrdered() ^ rhs.isColOrdered()) { std::cerr<<"Ordering "<= 0; --i) { CoinShallowPackedVector pv = getVector(i); CoinShallowPackedVector rhsPv = rhs.getVector(i); if ( !pv.isEquivalent(rhsPv,eq) ) { std::cerr<<"vector # "< (elems+j); printf("%x %x",xx[0],xx[1]); xx = reinterpret_cast (elems2+j); printf(" %x %x\n",xx[0],xx[1]); } } //return false; } } return true; } #else /* Equivalence. Two matrices are equivalent if they are both by rows or both by columns, they have the same dimensions, and each vector is equivalent. In this method the FloatEqual function operator can be specified. */ bool CoinPackedMatrix::isEquivalent(const CoinPackedMatrix& rhs, const CoinRelFltEq& eq) const { // Both must be column order or both row ordered and must be of same size if ((isColOrdered() ^ rhs.isColOrdered()) || (getNumCols() != rhs.getNumCols()) || (getNumRows() != rhs.getNumRows()) || (getNumElements() != rhs.getNumElements())) return false; const int major = getMajorDim(); const int minor = getMinorDim(); double * values = new double[minor]; memset(values,0,minor*sizeof(double)); bool same=true; for (int i = 0; i < major; ++i) { int length = length_[i]; if (length!=rhs.length_[i]) { same=false; break; } else { CoinBigIndex j; for ( j = start_[i]; j < start_[i] + length; ++j) { int index = index_[j]; values[index]=element_[j]; } for ( j = rhs.start_[i]; j < rhs.start_[i] + length; ++j) { int index = index_[j]; double oldValue = values[index]; values[index]=0.0; if (!eq(oldValue,rhs.element_[j])) { same=false; break; } } if (!same) break; } } delete [] values; return same; } #endif bool CoinPackedMatrix::isEquivalent(const CoinPackedMatrix& rhs) const { return isEquivalent(rhs,CoinRelFltEq()); } /* Sort all columns so indices are increasing.in each column */ void CoinPackedMatrix::orderMatrix() { for (int i=0;i0) or duplicates This version is easy one i.e. adding columns to column ordered */ int CoinPackedMatrix::appendMajor(const int number, const CoinBigIndex * starts, const int * index, const double * element, int numberOther) { int i; int numberErrors=0; CoinBigIndex numberElements = starts[number]; if (majorDim_ + number > maxMajorDim_ || getLastStart() + numberElements > maxSize_) { // we got to resize before we add. note that the resizing method // properly fills out start_ and length_ for the major-dimension // vectors to be added! if (!extraGap_&&!extraMajor_&&numberOther<=0&&!hasGaps()) { // can do faster if (majorDim_+number>maxMajorDim_) { maxMajorDim_ = majorDim_+number; int * newLength = new int[maxMajorDim_]; CoinMemcpyN(length_, majorDim_, newLength); delete [] length_; length_ = newLength; CoinBigIndex * newStart = new CoinBigIndex[maxMajorDim_ + 1]; CoinMemcpyN(start_, majorDim_+1, newStart); delete [] start_; start_ = newStart; } if (size_+numberElements>maxSize_) { maxSize_ = size_+numberElements; double * newElem = new double[maxSize_]; CoinMemcpyN(element_,size_,newElem); delete [] element_; element_ = newElem; int * newIndex = new int[maxSize_]; CoinMemcpyN(index_,size_,newIndex); delete [] index_; index_ = newIndex; } CoinMemcpyN(index,numberElements,index_+size_); // Do minor dimension int lastMinor=-1; for (CoinBigIndex j=0;j0) { char * which = new char[numberOther]; memset(which,0,numberOther); for (i = 0; i < number; i++) { CoinBigIndex put = start_[majorDim_+i]; CoinBigIndex j; for ( j=starts[i];j=0&&iIndex=0&&iIndex0) { char * which = new char[numberOther]; memset(which,0,numberOther); for (i = 0; i < number; i++) { CoinBigIndex put = start_[majorDim_+i]; CoinBigIndex j; for ( j=starts[i];j=0&&iIndex=0&&iIndex0) or duplicates This version is harder one i.e. adding columns to row ordered */ int CoinPackedMatrix::appendMinor(const int number, const CoinBigIndex * starts, const int * index, const double * element, int numberOther) { int i; int numberErrors=0; // first compute how many entries will be added to each major-dimension // vector, and if needed, resize the matrix to accommodate all int * addedEntries = NULL; if (numberOther>0) { addedEntries = new int[majorDim_]; CoinZeroN(addedEntries,majorDim_); numberOther=majorDim_; char * which = new char[numberOther]; memset(which,0,numberOther); for (i = 0; i < number; i++) { CoinBigIndex j; for ( j=starts[i];j=0&&iIndex=0&&iIndexmajorDim_) { if (isColOrdered()) setDimensions(-1,largest+1); else setDimensions(largest+1,-1); } addedEntries = new int[majorDim_]; CoinZeroN(addedEntries,majorDim_); // no checking for (i = 0; i < number; i++) { CoinBigIndex j; for ( j=starts[i];j= 0; i--) { if (start_[i] + length_[i] + addedEntries[i] > start_[i+1]) break; } if (i >= 0) resizeForAddingMinorVectors(addedEntries); delete[] addedEntries; // now insert the entries of matrix for (i = 0; i < number; i++) { CoinBigIndex j; for ( j=starts[i];j= 0; i--) { CoinBigIndex start = start_[i]; if (start + length_[i] + newStart[i] <= nextStart) { nextStart=start; } else { packType=-1; #ifdef ADD_ROW_ANALYZE nBad++; #else break; #endif } } } else { // Need more space packType=1; } #ifdef ADD_ROW_ANALYZE if (!hasGaps()) xxxxxx[9]++; if (packType==-1&&nBad<6) packType=nBad+1; xxxxxx[packType+2]++; if ((xxxxxx[0]%100)==0) { printf("Append "); for (int i=0;i<10;i++) printf("%d ",xxxxxx[i]); printf("\n"); } #endif if (hasGaps()&&packType) packType=1; CoinBigIndex n = 0; if (packType) { double slack = (static_cast (maxSize_-size_-numberAdded))/ static_cast (majorDim_); slack = CoinMax(0.0,slack-0.01); if (!slack) { for (int i = 0; i < majorDim_; ++i) { int thisCount = newStart[i]; newStart[i]=n; n += length_[i] + thisCount; } } else { double added=0.0; for (int i = 0; i < majorDim_; ++i) { int thisCount = newStart[i]; newStart[i]=n; added += slack; double extra=0; if (added>=1.0) { extra = floor(added); added -= extra; } n += length_[i] + thisCount+ static_cast (extra); } } newStart[majorDim_]=n; } if (packType) { maxSize_ = CoinMax(maxSize_, n); int * newIndex = new int[maxSize_]; double * newElem = new double[maxSize_]; for (int i = majorDim_ - 1; i >= 0; --i) { CoinBigIndex start = start_[i]; #ifdef USE_MEMCPY int length = length_[i]; CoinBigIndex put = newStart[i]; CoinMemcpyN(index_+start,length,newIndex+put); CoinMemcpyN(element_+start,length,newElem+put); #else CoinBigIndex end = start+length_[i]; CoinBigIndex put = newStart[i]; for (CoinBigIndex j=start;j= n); for (int i = majorDim_ - 1; i >= 0; --i) { CoinBigIndex start = start_[i]; int length = length_[i]; CoinBigIndex end = start+length; CoinBigIndex put = newStart[i]; //if (put==start) //break; put += length; for (CoinBigIndex j=end-1;j>=start;j--) { index_[--put]=index_[j]; element_[put]=element_[j]; } } delete [] start_; start_ = newStart; } else { delete[] newStart; } // now insert the entries of matrix for (int i = 0; i < number; i++) { CoinBigIndex j; for ( j=starts[i];j= 3) { std::cout << " Matrix is " << ((colOrdered_)?"column":"row") << "-major, " << m << " rows X " << n << " cols; " << size_ << " coeffs." << std::endl ; std::cout << " Bulk store " << maxSize_ << " coeffs, last coeff at " << start_[majDim]-1 << ", ex maj " << extraMajor_ << ", ex gap " << extraGap_ ; if (gaps) std::cout << "; matrix has gaps" ; std::cout << "." << std::endl ; } const CoinBigIndex *const majStarts = start_ ; const int *const majLens = length_ ; const int *const minInds = index_ ; const double *const coeffs = element_ ; /* Set up arrays to track use of bulk store entries. */ int errs = 0 ; int zeroes = 0 ; int *refCnt = new int[maxSize_] ; CoinZeroN(refCnt,maxSize_) ; bool *inGap = new bool[maxSize_] ; CoinZeroN(inGap,maxSize_) ; for (int majndx = 0 ; majndx < majDim ; majndx++) { /* Check that the range of indices for the major vector falls within the bulk store. If any of these checks fail, it's pointless (and possibly unsafe) to do more with this vector. Subtle point: Normally, majStarts[majDim] = maxIndex+1 (one past the end of the bulk store), and majStarts[k], k < majDim, should be a valid index. But ... if the last major vector (k = majDim-1) has length 0, then majStarts[k] = maxIndex. This will propagate back through multiple major vectors of length 0. Hence the check for length = 0. */ CoinBigIndex majStart = majStarts[majndx] ; int majLen = majLens[majndx] ; if (majStart < 0 || (majStart == (maxIndex+1) && majLen != 0) || majStart > maxIndex+1) { if (verbosity >= 1) { std::cout << " " << majName << " " << majndx << ": start " << majStart << " should be between 0 and " << maxIndex << "." << std::endl ; } errs++ ; if (majStart >= maxSize_) { std::cout << " " << "index exceeds bulk store limit " << maxSize_ << "!" << std::endl ; } continue ; } if (majLen < 0 || majLen > minDim) { if (verbosity >= 1) { std::cout << " " << majName << " " << majndx << ": vector length " << majLen << " should be between 0 and " << minDim << std::endl ; } errs++ ; continue ; } CoinBigIndex majEnd = majStart+majLen ; if (majEnd < 0 || majEnd > maxIndex+1) { if (verbosity >= 1) { std::cout << " " << majName << " " << majndx << ": end " << majEnd << " should be between 0 and " << maxIndex << "." << std::endl ; } errs++ ; if (majEnd >= maxSize_) { std::cout << " " << "index exceeds bulk store limit " << maxSize_ << "!" << std::endl ; } continue ; } /* Check that the major vector length is consistent with the distance between majStart[majndx] and majStart[majndx+1]. If the matrix is gap-free, they should be equal. We've already confirmed that majStart+majLen is within the bulk store, so we can continue even if these checks fail. Recall that the final entry in the major vector start array is one past the end of the bulk store. The previous tests will check more carefully if majndx+1 is not the final entry. */ CoinBigIndex majStartp1 = majStarts[majndx+1] ; CoinBigIndex startDist = majStartp1-majStart ; if (majStartp1 < 0 || majStartp1 > maxIndex+1) { if (verbosity >= 1) { std::cout << " " << majName << " " << majndx << ": start of next " << majName << " " << majStartp1 << " should be between 0 and " << maxIndex+1 << "." << std::endl ; } errs++ ; if (majStartp1 >= maxSize_) { std::cout << " " << "index exceeds bulk store limit " << maxSize_ << "!" << std::endl ; } } else if ((startDist < 0) || ((startDist > minDim) && !gaps)) { if (verbosity >= 1) { std::cout << " " << majName << " " << majndx << ": distance between " << majName << " starts " << startDist << " should be between 0 and " << minDim << "." << std::endl ; } errs++ ; } else if (majLen > startDist) { if (verbosity >= 1) { std::cout << " " << majName << " " << majndx << ": vector length " << majLen << " should not be greater than distance between " << majName << " starts " << startDist << std::endl ; } errs++ ; } else if (majLen != startDist && !gaps) { if (verbosity >= 1) { std::cout << " " << majName << " " << majndx << ": " << majName << " length " << majLen << " should equal distance " << startDist << " between " << majName << " starts in gap-free matrix." << std::endl ; } errs++ ; } /* Scan the major dimension vector, checking for obviously bogus minor indices and coefficients. Generate reference counts for each bulk store entry. */ for (CoinBigIndex ii = majStart ; ii < majEnd ; ii++) { refCnt[ii]++ ; int minndx = minInds[ii] ; if (minndx < 0 || minndx >= minDim) { if (verbosity >= 1) { std::cout << " " << majName << " " << majndx << ": " << minName << " index " << ii << " is " << minndx << ", should be between 0 and " << minDim-1 << "." << std::endl ; } errs++ ; } double aij = coeffs[ii] ; if (CoinIsnan(aij) || CoinAbs(aij) > largeCoeff) { if (verbosity >= 1) { std::cout << " (" << ii << ") a<" << majndx << "," << minndx << "> = " << aij << " appears bogus." << std::endl ; } errs++ ; } if (CoinAbs(aij) < smallCoeff) { if (verbosity >= 4 || zeroesAreError) { std::cout << " (" << ii << ") a<" << majndx << "," << minndx << "> = " << aij << " appears bogus." << std::endl ; } zeroes++ ; } } /* And mark the gaps, if any. */ if (gaps) { for (CoinBigIndex ii = majEnd ; ii < majStartp1 ; ii++) inGap[ii] = true ; } } /* Check the reference counts. They should all be 1 unless the entry is in a gap, in which case it should be zero. Anything else is a problem. Allow that the matrix may not use the full size of the bulk store. */ for (CoinBigIndex ii = 0 ; ii <= maxIndex ; ii++) { if (!((refCnt[ii] == 1 && inGap[ii] == false) || (refCnt[ii] == 0 && inGap[ii] == true))) { if (verbosity >= 1) { std::cout << " Bulk store entry " << ii << " has reference count " << refCnt[ii] << "; should be " << ((inGap[ii])?0:1) << "." << std::endl ; } errs++ ; } } delete[] refCnt ; /* Report the result. */ if (zeroesAreError) errs += zeroes ; if (errs > 0) { if (verbosity >= 1) { std::cout << " Detected " << errs << " errors in matrix" ; if (zeroes) std::cout << " (includes " << zeroes << " zeroes)" ; std::cout << "." << std::endl ; } } else { if (verbosity >= 2) { std::cout << " Matrix verified" ; if (zeroes) std::cout << " (" << zeroes << " zeroes)" ; std::cout << "." << std::endl ; } } return (errs) ; } CoinMP-1.8.3/CoinUtils/src/CoinModelUseful.cpp0000644000175000017500000011402112130033462017546 0ustar renerene/* $Id: CoinModelUseful.cpp 1583 2013-04-06 14:54:42Z stefan $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include #include #include #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinModelUseful.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CoinModelLink::CoinModelLink () : row_(-1), column_(-1), value_(0.0), position_(-1), onRow_(true) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinModelLink::CoinModelLink (const CoinModelLink & rhs) : row_(rhs.row_), column_(rhs.column_), value_(rhs.value_), position_(rhs.position_), onRow_(rhs.onRow_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CoinModelLink::~CoinModelLink () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CoinModelLink & CoinModelLink::operator=(const CoinModelLink& rhs) { if (this != &rhs) { row_ = rhs.row_; column_ = rhs.column_; value_ = rhs.value_; position_ = rhs.position_; onRow_ = rhs.onRow_; } return *this; } namespace { const int mmult[] = { 262139, 259459, 256889, 254291, 251701, 249133, 246709, 244247, 241667, 239179, 236609, 233983, 231289, 228859, 226357, 223829, 221281, 218849, 216319, 213721, 211093, 208673, 206263, 203773, 201233, 198637, 196159, 193603, 191161, 188701, 186149, 183761, 181303, 178873, 176389, 173897, 171469, 169049, 166471, 163871, 161387, 158941, 156437, 153949, 151531, 149159, 146749, 144299, 141709, 139369, 136889, 134591, 132169, 129641, 127343, 124853, 122477, 120163, 117757, 115361, 112979, 110567, 108179, 105727, 103387, 101021, 98639, 96179, 93911, 91583, 89317, 86939, 84521, 82183, 79939, 77587, 75307, 72959, 70793, 68447, 66103 }; const int lengthMult = static_cast (sizeof(mmult) / sizeof(int)); } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CoinModelHash::CoinModelHash () : names_(NULL), hash_(NULL), numberItems_(0), maximumItems_(0), lastSlot_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinModelHash::CoinModelHash (const CoinModelHash & rhs) : names_(NULL), hash_(NULL), numberItems_(rhs.numberItems_), maximumItems_(rhs.maximumItems_), lastSlot_(rhs.lastSlot_) { if (maximumItems_) { names_ = new char * [maximumItems_]; for (int i=0;i=0&&number<=numberItems_); numberItems_=number; } // Resize hash (also re-hashs) void CoinModelHash::resize(int maxItems,bool forceReHash) { assert (numberItems_<=maximumItems_); if (maxItems<=maximumItems_&&!forceReHash) return; int n=maximumItems_; maximumItems_=maxItems; char ** names = new char * [maximumItems_]; int i; for ( i=0;i numberItems_ ) { printf ( "** too many names\n" ); abort(); break; } if ( hash_[lastSlot_].index == -1 ) { break; } } hash_[ipos].next = lastSlot_; hash_[lastSlot_].index = i; break; } else { ipos = k; /* nothing worked - try it again */ } } } } } } // validate void CoinModelHash::validateHash() const { for (int i = 0; i < numberItems_; ++i ) { if (names_[i]) { assert (hash( names_[i])>=0); } } } // Returns index or -1 int CoinModelHash::hash(const char * name) const { int found = -1; int ipos; /* default if we don't find anything */ if ( !numberItems_ ) return -1; ipos = hashValue ( name ); while ( true ) { int j1 = hash_[ipos].index; if ( j1 >= 0 ) { char *thisName2 = names_[j1]; if ( strcmp ( name, thisName2 ) != 0 ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } } return found; } // Adds to hash void CoinModelHash::addHash(int index, const char * name) { // resize if necessary if (numberItems_>=maximumItems_) resize(1000+3*numberItems_/2); assert (!names_[index]); names_[index]=CoinStrdup(name); int ipos = hashValue ( name); numberItems_ = CoinMax(numberItems_,index+1); if ( hash_[ipos].index <0 ) { hash_[ipos].index = index; } else { while ( true ) { int j1 = hash_[ipos].index; if ( j1 == index ) break; // duplicate? else { if (j1>=0) { char *thisName2 = names_[j1]; if ( strcmp ( name, thisName2 ) == 0 ) { printf ( "** duplicate name %s\n", names_[index] ); abort(); break; } else { int k = hash_[ipos].next; if ( k == -1 ) { while ( true ) { ++lastSlot_; if ( lastSlot_ > numberItems_ ) { printf ( "** too many names\n" ); abort(); break; } if ( hash_[lastSlot_].index <0 && hash_[lastSlot_].next<0) { break; } } hash_[ipos].next = lastSlot_; hash_[lastSlot_].index = index; hash_[lastSlot_].next=-1; break; } else { ipos = k; } } } else { //slot available hash_[ipos].index = index; } } } } } // Deletes from hash void CoinModelHash::deleteHash(int index) { if (index=0 ) { int j1 = hash_[ipos].index; if ( j1!=index) { ipos = hash_[ipos].next; } else { hash_[ipos].index=-1; // available break; } } assert (ipos>=0); free(names_[index]); names_[index]=NULL; } } // Returns name at position (or NULL) const char * CoinModelHash::name(int which) const { if (which (strlen(name)); // may get better spread with unsigned const unsigned char * name2 = reinterpret_cast (name); while (length) { int length2 = CoinMin( length,lengthMult); for ( j = 0; j < length2; ++j ) { n += mmult[j] * name2[j]; } name+=length2; length-=length2; } int maxHash = 4 * maximumItems_; return ( abs ( n ) % maxHash ); /* integer abs */ } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CoinModelHash2::CoinModelHash2 () : hash_(NULL), numberItems_(0), maximumItems_(0), lastSlot_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinModelHash2::CoinModelHash2 (const CoinModelHash2 & rhs) : hash_(NULL), numberItems_(rhs.numberItems_), maximumItems_(rhs.maximumItems_), lastSlot_(rhs.lastSlot_) { if (maximumItems_) { hash_ = CoinCopyOfArray(rhs.hash_,4*maximumItems_); } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CoinModelHash2::~CoinModelHash2 () { delete [] hash_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CoinModelHash2 & CoinModelHash2::operator=(const CoinModelHash2& rhs) { if (this != &rhs) { delete [] hash_; numberItems_ = rhs.numberItems_; maximumItems_ = rhs.maximumItems_; lastSlot_ = rhs.lastSlot_; if (maximumItems_) { hash_ = CoinCopyOfArray(rhs.hash_,4*maximumItems_); } else { hash_ = NULL; } } return *this; } // Set number of items void CoinModelHash2::setNumberItems(int number) { assert (number>=0&&(number<=numberItems_||!numberItems_)); numberItems_=number; } // Resize hash (also re-hashs) void CoinModelHash2::resize(int maxItems, const CoinModelTriple * triples,bool forceReHash) { assert (numberItems_<=maximumItems_||!maximumItems_); if (maxItems<=maximumItems_&&!forceReHash) return; if (maxItems>maximumItems_) { maximumItems_=maxItems; delete [] hash_; hash_ = new CoinModelHashLink [4*maximumItems_]; } int maxHash = 4 * maximumItems_; int ipos; int i; for ( i = 0; i < maxHash; i++ ) { hash_[i].index = -1; hash_[i].next = -1; } /* * Initialize the hash table. Only the index of the first name that * hashes to a value is entered in the table; subsequent names that * collide with it are not entered. */ for ( i = 0; i < numberItems_; ++i ) { int row = static_cast (rowInTriple(triples[i])); int column = triples[i].column; if (column>=0) { ipos = hashValue ( row, column); if ( hash_[ipos].index == -1 ) { hash_[ipos].index = i; } } } /* * Now take care of the entries that collided in the preceding loop, * by finding some other entry in the table for them. * Since there are as many entries in the table as there are entries, * there must be room for them. */ lastSlot_ = -1; for ( i = 0; i < numberItems_; ++i ) { int row = static_cast (rowInTriple(triples[i])); int column = triples[i].column; if (column>=0) { ipos = hashValue ( row, column); while ( true ) { int j1 = hash_[ipos].index; if ( j1 == i ) break; else { int row2 = static_cast (rowInTriple(triples[j1])); int column2 = triples[j1].column; if ( row==row2&&column==column2 ) { printf ( "** duplicate entry %d %d\n", row,column ); abort(); break; } else { int k = hash_[ipos].next; if ( k == -1 ) { while ( true ) { ++lastSlot_; if ( lastSlot_ > numberItems_ ) { printf ( "** too many entries\n" ); abort(); break; } if ( hash_[lastSlot_].index == -1 ) { break; } } hash_[ipos].next = lastSlot_; hash_[lastSlot_].index = i; break; } else { ipos = k; } } } } } } } // Returns index or -1 int CoinModelHash2::hash(int row, int column, const CoinModelTriple * triples) const { int found = -1; int ipos; /* default if we don't find anything */ if ( !numberItems_ ) return -1; ipos = hashValue ( row, column ); while ( true ) { int j1 = hash_[ipos].index; if ( j1 >= 0 ) { int row2 = static_cast (rowInTriple(triples[j1])); int column2 = triples[j1].column; if ( row!=row2||column!=column2 ) { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { int k = hash_[ipos].next; if ( k != -1 ) ipos = k; else break; } } return found; } // Adds to hash void CoinModelHash2::addHash(int index, int row, int column, const CoinModelTriple * triples) { // resize if necessary if (numberItems_>=maximumItems_||index+1>=maximumItems_) resize(CoinMax(1000+3*numberItems_/2,index+1), triples); int ipos = hashValue ( row, column); numberItems_ = CoinMax(numberItems_,index+1); assert (numberItems_<=maximumItems_); if ( hash_[ipos].index <0 ) { hash_[ipos].index = index; } else { while ( true ) { int j1 = hash_[ipos].index; if ( j1 == index ) { break; // duplicate?? } else { if (j1 >=0 ) { int row2 = static_cast (rowInTriple(triples[j1])); int column2 = triples[j1].column; if ( row==row2&&column==column2 ) { printf ( "** duplicate entry %d %d\n", row, column ); abort(); break; } else { int k = hash_[ipos].next; if ( k ==-1 ) { while ( true ) { ++lastSlot_; if ( lastSlot_ > numberItems_ ) { printf ( "** too many entrys\n" ); abort(); break; } if ( hash_[lastSlot_].index <0 ) { break; } } hash_[ipos].next = lastSlot_; hash_[lastSlot_].index = index; hash_[lastSlot_].next=-1; break; } else { ipos = k; } } } else { // slot available hash_[ipos].index = index; } } } } } // Deletes from hash void CoinModelHash2::deleteHash(int index,int row, int column) { if (index=0 ) { int j1 = hash_[ipos].index; if ( j1!=index) { ipos = hash_[ipos].next; } else { hash_[ipos].index=-1; // available break; } } } } namespace { const int mmult2[] = { 262139, 259459, 256889, 254291, 251701, 249133, 246709, 244247, 241667, 239179, 236609, 233983, 231289, 228859, 226357, 223829 }; } // Returns a hash value int CoinModelHash2::hashValue(int row, int column) const { // Optimizer should take out one side of if if (sizeof(int)==4*sizeof(char)) { unsigned char tempChar[4]; unsigned int n = 0; int * temp = reinterpret_cast (tempChar); *temp=row; n += mmult2[0] * tempChar[0]; n += mmult2[1] * tempChar[1]; n += mmult2[2] * tempChar[2]; n += mmult[3] * tempChar[3]; *temp=column; n += mmult2[0+8] * tempChar[0]; n += mmult2[1+8] * tempChar[1]; n += mmult2[2+8] * tempChar[2]; n += mmult2[3+8] * tempChar[3]; return n % (maximumItems_<<1); } else { // ints are 8 unsigned char tempChar[8]; int n = 0; unsigned int j; int * temp = reinterpret_cast (tempChar); *temp=row; for ( j = 0; j < sizeof(int); ++j ) { int itemp = tempChar[j]; n += mmult2[j] * itemp; } *temp=column; for ( j = 0; j < sizeof(int); ++j ) { int itemp = tempChar[j]; n += mmult2[j+8] * itemp; } int maxHash = 4 * maximumItems_; int absN = abs(n); int returnValue = absN % maxHash; return returnValue; } } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CoinModelLinkedList::CoinModelLinkedList () : previous_(NULL), next_(NULL), first_(NULL), last_(NULL), numberMajor_(0), maximumMajor_(0), numberElements_(0), maximumElements_(0), type_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinModelLinkedList::CoinModelLinkedList (const CoinModelLinkedList & rhs) : numberMajor_(rhs.numberMajor_), maximumMajor_(rhs.maximumMajor_), numberElements_(rhs.numberElements_), maximumElements_(rhs.maximumElements_), type_(rhs.type_) { if (maximumMajor_) { previous_ = CoinCopyOfArray(rhs.previous_,maximumElements_); next_ = CoinCopyOfArray(rhs.next_,maximumElements_); first_ = CoinCopyOfArray(rhs.first_,maximumMajor_+1); last_ = CoinCopyOfArray(rhs.last_,maximumMajor_+1); } else { previous_ = NULL; next_ = NULL; first_ = NULL; last_ = NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CoinModelLinkedList::~CoinModelLinkedList () { delete [] previous_; delete [] next_; delete [] first_; delete [] last_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CoinModelLinkedList & CoinModelLinkedList::operator=(const CoinModelLinkedList& rhs) { if (this != &rhs) { delete [] previous_; delete [] next_; delete [] first_; delete [] last_; numberMajor_ = rhs.numberMajor_; maximumMajor_ = rhs.maximumMajor_; numberElements_ = rhs.numberElements_; maximumElements_ = rhs.maximumElements_; type_ = rhs.type_; if (maximumMajor_) { previous_ = CoinCopyOfArray(rhs.previous_,maximumElements_); next_ = CoinCopyOfArray(rhs.next_,maximumElements_); first_ = CoinCopyOfArray(rhs.first_,maximumMajor_+1); last_ = CoinCopyOfArray(rhs.last_,maximumMajor_+1); } else { previous_ = NULL; next_ = NULL; first_ = NULL; last_ = NULL; } } return *this; } // Resize list - for row list maxMajor is maximum rows void CoinModelLinkedList::resize(int maxMajor,int maxElements) { maxMajor=CoinMax(maxMajor,maximumMajor_); maxElements=CoinMax(maxElements,maximumElements_); if (maxMajor>maximumMajor_) { int * first = new int [maxMajor+1]; int free; if (maximumMajor_) { CoinMemcpyN(first_,maximumMajor_,first); # ifdef ZEROFAULT memset(first+maximumMajor_,0,(maxMajor-maximumMajor_)*sizeof(int)) ; # endif free = first_[maximumMajor_]; first[maximumMajor_]=-1; } else { free=-1; } first[maxMajor]=free; delete [] first_; first_=first; int * last = new int [maxMajor+1]; if (maximumMajor_) { CoinMemcpyN(last_,maximumMajor_,last); # ifdef ZEROFAULT memset(last+maximumMajor_,0,(maxMajor-maximumMajor_)*sizeof(int)) ; # endif free = last_[maximumMajor_]; last[maximumMajor_]=-1; } else { free=-1; } last[maxMajor]=free; delete [] last_; last_=last; maximumMajor_ = maxMajor; } if ( maxElements>maximumElements_) { int * previous = new int [maxElements]; CoinMemcpyN(previous_,numberElements_,previous); # ifdef ZEROFAULT memset(previous+numberElements_,0, (maxElements-numberElements_)*sizeof(int)) ; # endif delete [] previous_; previous_=previous; int * next = new int [maxElements]; CoinMemcpyN(next_,numberElements_,next); # ifdef ZEROFAULT memset(next+numberElements_,0,(maxElements-numberElements_)*sizeof(int)) ; # endif delete [] next_; next_=next; maximumElements_=maxElements; } } // Create list - for row list maxMajor is maximum rows void CoinModelLinkedList::create(int maxMajor,int maxElements, int numberMajor,int /*numberMinor*/, int type, int numberElements, const CoinModelTriple * triples) { maxMajor=CoinMax(maxMajor,maximumMajor_); maxMajor=CoinMax(maxMajor,numberMajor); maxElements=CoinMax(maxElements,maximumElements_); maxElements=CoinMax(maxElements,numberElements); type_=type; assert (!previous_); previous_ = new int [maxElements]; next_ = new int [maxElements]; maximumElements_=maxElements; assert (maxElements>=numberElements); assert (maxMajor>0&&!maximumMajor_); first_ = new int[maxMajor+1]; last_ = new int[maxMajor+1]; # ifdef ZEROFAULT memset(previous_,0,maxElements*sizeof(int)) ; memset(next_,0,maxElements*sizeof(int)) ; memset(first_,0,(maxMajor+1)*sizeof(int)) ; memset(last_,0,(maxMajor+1)*sizeof(int)) ; # endif assert (numberElements>=0); numberElements_=numberElements; maximumMajor_ = maxMajor; // do lists int i; for (i=0;i=0) { int iMajor; if (!type_) { // for rows iMajor=static_cast (rowInTriple(triples[i])); } else { iMajor=triples[i].column; } assert (iMajor=0) { // not first int j=last_[iMajor]; next_[j]=i; previous_[i]=j; } else { // first first_[iMajor]=i; previous_[i]=-1; } last_[iMajor]=i; } else { // on deleted list if (freeChain>=0) { next_[freeChain]=i; previous_[i]=freeChain; } else { first_[maximumMajor_]=i; previous_[i]=-1; } freeChain=i; } } // Now clean up if (freeChain>=0) { next_[freeChain]=-1; last_[maximumMajor_]=freeChain; } for (i=0;i=0) { next_[k]=-1; last_[i]=k; } } numberMajor_=numberMajor; } /* Adds to list - easy case i.e. add row to row list Returns where chain starts */ int CoinModelLinkedList::addEasy(int majorIndex, int numberOfElements, const int * indices, const double * elements, CoinModelTriple * triples, CoinModelHash2 & hash) { assert (majorIndexmaximumElements_) { resize(maximumMajor_,(3*(numberElements_+numberOfElements))/2+1000); } int first=-1; if (majorIndex>=numberMajor_) { for (int i=numberMajor_;i<=majorIndex;i++) { first_[i]=-1; last_[i]=-1; } } if (numberOfElements) { bool doHash = hash.maximumItems()!=0; int lastFree=last_[maximumMajor_]; int last=last_[majorIndex]; for (int i=0;i=0) { put=lastFree; lastFree=previous_[lastFree]; } else { put=numberElements_; assert (put (rowInTriple(triples[put])),triples[put].column,triples); if (last>=0) { next_[last]=put; } else { first_[majorIndex]=put; } previous_[put]=last; last=put; } next_[last]=-1; if (last_[majorIndex]<0) { // first in row first = first_[majorIndex]; } else { first = next_[last_[majorIndex]]; } last_[majorIndex]=last; if (lastFree>=0) { next_[lastFree]=-1; last_[maximumMajor_]=lastFree; } else { first_[maximumMajor_]=-1; last_[maximumMajor_]=-1; } } numberMajor_=CoinMax(numberMajor_,majorIndex+1); return first; } /* Adds to list - hard case i.e. add row to column list */ void CoinModelLinkedList::addHard(int minorIndex, int numberOfElements, const int * indices, const double * elements, CoinModelTriple * triples, CoinModelHash2 & hash) { int lastFree=last_[maximumMajor_]; bool doHash = hash.maximumItems()!=0; for (int i=0;i=0) { put=lastFree; lastFree=previous_[lastFree]; } else { put=numberElements_; assert (put (rowInTriple(triples[put])),triples[put].column,triples); if (other>=numberMajor_) { // Need to fill in null values fill(numberMajor_,other+1); numberMajor_=other+1; } int last=last_[other]; if (last>=0) { next_[last]=put; } else { first_[other]=put; } previous_[put]=last; next_[put]=-1; last_[other]=put; } if (lastFree>=0) { next_[lastFree]=-1; last_[maximumMajor_]=lastFree; } else { first_[maximumMajor_]=-1; last_[maximumMajor_]=-1; } } /* Adds to list - hard case i.e. add row to column list This is when elements have been added to other copy */ void CoinModelLinkedList::addHard(int first, const CoinModelTriple * triples, int firstFree, int lastFree,const int * next) { first_[maximumMajor_]=firstFree; last_[maximumMajor_]=lastFree; int put=first; int minorIndex=-1; while (put>=0) { assert (put=0) assert(triples[put].column==minorIndex); else minorIndex=triples[put].column; } else { // column other=triples[put].column; if (minorIndex>=0) assert(static_cast (rowInTriple(triples[put]))==minorIndex); else minorIndex=rowInTriple(triples[put]); } assert (other=numberMajor_) { // Need to fill in null values fill (numberMajor_,other+1); numberMajor_=other+1; } int last=last_[other]; if (last>=0) { next_[last]=put; } else { first_[other]=put; } previous_[put]=last; next_[put]=-1; last_[other]=put; put = next[put]; } } /* Deletes from list - same case i.e. delete row from row list */ void CoinModelLinkedList::deleteSame(int which, CoinModelTriple * triples, CoinModelHash2 & hash, bool zapTriples) { assert (which>=0); if (which=0) { if (hash.numberItems()) { // take out of hash hash.deleteHash(put, static_cast (rowInTriple(triples[put])),triples[put].column); } if (zapTriples) { triples[put].column=-1; triples[put].value=0.0; } if (lastFree>=0) { next_[lastFree]=put; } else { first_[maximumMajor_]=put; } previous_[put]=lastFree; lastFree=put; put=next_[put]; } if (lastFree>=0) { next_[lastFree]=-1; last_[maximumMajor_]=lastFree; } else { assert (last_[maximumMajor_]==-1); } last_[which]=-1; } } /* Deletes from list - other case i.e. delete row from column list This is when elements have been deleted from other copy */ void CoinModelLinkedList::updateDeleted(int /*which*/, CoinModelTriple * triples, CoinModelLinkedList & otherList) { int firstFree = otherList.firstFree(); int lastFree = otherList.lastFree(); const int * previousOther = otherList.previous(); assert (maximumMajor_); if (lastFree>=0) { // First free should be same if (first_[maximumMajor_]>=0) assert (firstFree==first_[maximumMajor_]); int last = last_[maximumMajor_]; first_[maximumMajor_]=firstFree; // Maybe nothing to do if (last_[maximumMajor_]==lastFree) return; last_[maximumMajor_]=lastFree; int iMajor; if (!type_) { // for rows iMajor=static_cast (rowInTriple(triples[lastFree])); } else { iMajor=triples[lastFree].column; } if (first_[iMajor]>=0) { // take out int previousThis = previous_[lastFree]; int nextThis = next_[lastFree]; if (previousThis>=0&&previousThis!=last) { next_[previousThis]=nextThis; #ifndef NDEBUG int iTest; if (!type_) { // for rows iTest=static_cast (rowInTriple(triples[previousThis])); } else { iTest=triples[previousThis].column; } assert (triples[previousThis].column>=0); assert (iTest==iMajor); #endif } else { first_[iMajor]=nextThis; } if (nextThis>=0) { previous_[nextThis]=previousThis; #ifndef NDEBUG int iTest; if (!type_) { // for rows iTest=static_cast (rowInTriple(triples[nextThis])); } else { iTest=triples[nextThis].column; } assert (triples[nextThis].column>=0); assert (iTest==iMajor); #endif } else { last_[iMajor]=previousThis; } } triples[lastFree].column=-1; triples[lastFree].value=0.0; // Do first (by which I mean last) next_[lastFree]=-1; int previous = previousOther[lastFree]; while (previous!=last) { if (previous>=0) { if (!type_) { // for rows iMajor=static_cast (rowInTriple(triples[previous])); } else { iMajor=triples[previous].column; } if (first_[iMajor]>=0) { // take out int previousThis = previous_[previous]; int nextThis = next_[previous]; if (previousThis>=0&&previousThis!=last) { next_[previousThis]=nextThis; #ifndef NDEBUG int iTest; if (!type_) { // for rows iTest=static_cast (rowInTriple(triples[previousThis])); } else { iTest=triples[previousThis].column; } assert (triples[previousThis].column>=0); assert (iTest==iMajor); #endif } else { first_[iMajor]=nextThis; } if (nextThis>=0) { previous_[nextThis]=previousThis; #ifndef NDEBUG int iTest; if (!type_) { // for rows iTest=static_cast (rowInTriple(triples[nextThis])); } else { iTest=triples[nextThis].column; } assert (triples[nextThis].column>=0); assert (iTest==iMajor); #endif } else { last_[iMajor]=previousThis; } } triples[previous].column=-1; triples[previous].value=0.0; next_[previous]=lastFree; } else { assert (lastFree==firstFree); } previous_[lastFree]=previous; lastFree=previous; previous = previousOther[lastFree]; } if (last>=0) { next_[previous]=lastFree; } else { assert (firstFree==lastFree); } previous_[lastFree]=previous; } } /* Deletes one element from Row list */ void CoinModelLinkedList::deleteRowOne(int position, CoinModelTriple * triples, CoinModelHash2 & hash) { int row=rowInTriple(triples[position]); assert (row (rowInTriple(triples[position])),triples[position].column); } int previous = previous_[position]; int next = next_[position]; // put on free list int lastFree=last_[maximumMajor_]; if (lastFree>=0) { next_[lastFree]=position; } else { first_[maximumMajor_]=position; assert (last_[maximumMajor_]==-1); } last_[maximumMajor_]=position; previous_[position]=lastFree; next_[position]=-1; // Now take out of row if (previous>=0) { next_[previous]=next; } else { first_[row]=next; } if (next>=0) { previous_[next]=previous; } else { last_[row]=previous; } } /* Update column list for one element when one element deleted from row copy */ void CoinModelLinkedList::updateDeletedOne(int position, const CoinModelTriple * triples) { assert (maximumMajor_); int column=triples[position].column; assert (column>=0&&column=0) { next_[lastFree]=position; } else { first_[maximumMajor_]=position; assert (last_[maximumMajor_]==-1); } last_[maximumMajor_]=position; previous_[position]=lastFree; next_[position]=-1; // Now take out of column if (previous>=0) { next_[previous]=next; } else { first_[column]=next; } if (next>=0) { previous_[next]=previous; } else { last_[column]=previous; } } // Fills first,last with -1 void CoinModelLinkedList::fill(int first,int last) { for (int i=first;i=0) { previous_[put]=other.previous_[put]; next_[put]=other.next_[put]; put = next_[put]; } } // Checks that links are consistent void CoinModelLinkedList::validateLinks(const CoinModelTriple * triples) const { char * mark = new char[maximumElements_]; memset(mark,0,maximumElements_); int lastElement=-1; int i; for ( i=0;i=0) { assert (position==first_[i] || next_[previous_[position]]==position); assert (type_ || i == static_cast (rowInTriple(triples[position]))); // i == iMajor for rows assert (!type_ || i == triples[position].column); // i == iMajor assert (triples[position].column>=0); mark[position]=1; lastElement = CoinMax(lastElement,position); #ifndef NDEBUG lastPosition=position; #endif position = next_[position]; } assert (lastPosition==last_[i]); } for (i=0;i<=lastElement;i++) { if (!mark[i]) assert(triples[i].column==-1); } delete [] mark; } CoinMP-1.8.3/CoinUtils/src/CoinFactorization3.cpp0000644000175000017500000021075512452502475020250 0ustar renerene/* $Id: CoinFactorization3.cpp 1767 2015-01-05 12:36:13Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinUtilsConfig.h" #include #include #include "CoinFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include #include #if COIN_FACTORIZATION_DENSE_CODE==1 // using simple lapack interface extern "C" { /** LAPACK Fortran subroutine DGETRS. */ void F77_FUNC(dgetrs,DGETRS)(char *trans, cipfint *n, cipfint *nrhs, const double *A, cipfint *ldA, cipfint * ipiv, double *B, cipfint *ldB, ipfint *info, int trans_len); } #elif COIN_FACTORIZATION_DENSE_CODE==2 // C interface enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112}; extern "C" { int clapack_dgetrs ( const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans, const int N, const int NRHS, const double *A, const int lda, const int *ipiv, double *B, const int ldb ); } #endif // For semi-sparse #define BITS_PER_CHECK 8 #define CHECK_SHIFT 3 typedef unsigned char CoinCheckZero; #ifdef CLP_FACTORIZATION_INSTRUMENT extern double externalTimeStart; extern double timeInFactorize; extern double timeInUpdate; extern double timeInFactorizeFake; extern double timeInUpdateFake1; extern double timeInUpdateFake2; extern double timeInUpdateTranspose; extern double timeInUpdateFT; extern double timeInUpdateTwoFT; extern double timeInReplace; extern int numberUpdate; extern int numberUpdateTranspose; extern int numberUpdateFT; extern int numberUpdateTwoFT; extern int numberReplace; extern int currentLengthR; extern int currentLengthU; extern int currentTakeoutU; extern double averageLengthR; extern double averageLengthL; extern double averageLengthU; extern double scaledLengthDense; extern double scaledLengthDenseSquared; extern double scaledLengthL; extern double scaledLengthR; extern double scaledLengthU; extern int startLengthU; extern int endLengthU; #endif //:class CoinFactorization. Deals with Factorization and Updates /* Updates one column (FTRAN) from region2 and permutes. region1 starts as zero Note - if regionSparse2 packed on input - will be packed on output - returns un-permuted result in region2 and region1 is zero */ int CoinFactorization::updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute) const { #ifdef CLP_FACTORIZATION_INSTRUMENT double startTimeX=CoinCpuTime(); #endif //permute and move indices into index array int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int numberNonZero; const int *permute = permute_.array(); double * COIN_RESTRICT region = regionSparse->denseVector(); #ifndef CLP_FACTORIZATION if (!noPermute) { #endif numberNonZero = regionSparse2->getNumElements(); int * COIN_RESTRICT index = regionSparse2->getIndices(); double * COIN_RESTRICT array = regionSparse2->denseVector(); #ifndef CLP_FACTORIZATION bool packed = regionSparse2->packedMode(); if (packed) { for (int j = 0; j < numberNonZero; j ++ ) { int iRow = index[j]; double value = array[j]; array[j]=0.0; iRow = permute[iRow]; region[iRow] = value; regionIndex[j] = iRow; } } else { #else assert (!regionSparse2->packedMode()); #endif for (int j = 0; j < numberNonZero; j ++ ) { int iRow = index[j]; double value = array[iRow]; array[iRow]=0.0; iRow = permute[iRow]; region[iRow] = value; regionIndex[j] = iRow; } #ifndef CLP_FACTORIZATION } #endif regionSparse->setNumElements ( numberNonZero ); #ifndef CLP_FACTORIZATION } else { numberNonZero = regionSparse->getNumElements(); } #endif if (collectStatistics_) { numberFtranCounts_++; ftranCountInput_ += numberNonZero; } // ******* L updateColumnL ( regionSparse, regionIndex ); if (collectStatistics_) ftranCountAfterL_ += regionSparse->getNumElements(); //permute extra //row bits here updateColumnR ( regionSparse ); if (collectStatistics_) ftranCountAfterR_ += regionSparse->getNumElements(); //update counts // ******* U updateColumnU ( regionSparse, regionIndex); if (!doForrestTomlin_) { // Do PFI after everything else updateColumnPFI(regionSparse); } #ifdef CLP_FACTORIZATION_INSTRUMENT numberUpdate++; timeInUpdate += CoinCpuTime()-startTimeX; averageLengthR += lengthR_; averageLengthU += lengthU_; averageLengthL += lengthL_; #endif if (!noPermute) { permuteBack(regionSparse,regionSparse2); return regionSparse2->getNumElements ( ); } else { return regionSparse->getNumElements ( ); } } // Permutes back at end of updateColumn void CoinFactorization::permuteBack ( CoinIndexedVector * regionSparse, CoinIndexedVector * outVector) const { // permute back int oldNumber = regionSparse->getNumElements(); const int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); double * COIN_RESTRICT region = regionSparse->denseVector(); int * COIN_RESTRICT outIndex = outVector->getIndices ( ); double * COIN_RESTRICT out = outVector->denseVector(); const int * COIN_RESTRICT permuteBack = pivotColumnBack(); int number=0; if (outVector->packedMode()) { for (int j = 0; j < oldNumber; j ++ ) { int iRow = regionIndex[j]; double value = region[iRow]; region[iRow]=0.0; if (fabs(value)>zeroTolerance_) { iRow = permuteBack[iRow]; outIndex[number]=iRow; out[number++] = value; } } } else { int j=0; if ((oldNumber&1)!=0) { int iRow = regionIndex[0]; j++; double value = region[iRow]; region[iRow]=0.0; if (fabs(value)>zeroTolerance_) { iRow = permuteBack[iRow]; outIndex[number++]=iRow; out[iRow] = value; } } for (; j < oldNumber; j +=2 ) { int iRow0 = regionIndex[j]; int iRow1 = regionIndex[j+1]; double value0 = region[iRow0]; bool good0 = fabs(value0)>zeroTolerance_; double value1 = region[iRow1]; bool good1 = fabs(value1)>zeroTolerance_; region[iRow0]=0.0; region[iRow1]=0.0; if (good0) { iRow0 = permuteBack[iRow0]; outIndex[number++]=iRow0; out[iRow0] = value0; } if (good1) { iRow1 = permuteBack[iRow1]; outIndex[number++]=iRow1; out[iRow1] = value1; } } } outVector->setNumElements(number); regionSparse->setNumElements(0); } // updateColumnL. Updates part of column (FTRANL) void CoinFactorization::updateColumnL ( CoinIndexedVector * regionSparse, int * COIN_RESTRICT regionIndex) const { if (numberL_) { int number = regionSparse->getNumElements ( ); int goSparse; // Guess at number at end if (sparseThreshold_>0) { if (ftranAverageAfterL_) { int newNumber = static_cast (number*ftranAverageAfterL_); if (newNumber< sparseThreshold_&&(numberL_<<2)>newNumber) goSparse = 2; else if (newNumber< sparseThreshold2_&&(numberL_<<1)>newNumber) goSparse = 1; else goSparse = 0; } else { if (numbernumber) goSparse = 2; else goSparse = 0; } } else { goSparse=0; } switch (goSparse) { case 0: // densish updateColumnLDensish(regionSparse,regionIndex); break; case 1: // middling updateColumnLSparsish(regionSparse,regionIndex); break; case 2: // sparse updateColumnLSparse(regionSparse,regionIndex); break; } } #ifdef COIN_FACTORIZATION_DENSE_CODE if (numberDense_) { //take off list int lastSparse = numberRows_-numberDense_; int number = regionSparse->getNumElements(); double * COIN_RESTRICT region = regionSparse->denseVector ( ); int i=0; bool doDense=false; while (i=lastSparse) { doDense=true; regionIndex[i] = regionIndex[--number]; } else { i++; } } if (doDense) { #if COIN_FACTORIZATION_DENSE_CODE==1 char trans = 'N'; int ione=1; int info; F77_FUNC(dgetrs,DGETRS)(&trans,&numberDense_,&ione,denseAreaAddress_,&numberDense_, densePermute_,region+lastSparse,&numberDense_,&info,1); #elif COIN_FACTORIZATION_DENSE_CODE==2 clapack_dgetrs ( CblasColMajor,CblasNoTrans,numberDense_,1, denseAreaAddress_,numberDense_,densePermute_, region+lastSparse,numberDense_); #endif for (int i=lastSparse;i=1.0e-15) regionIndex[number++] = i; else region[i]=0.0; } } regionSparse->setNumElements(number); } } #endif } // Updates part of column (FTRANL) when densish void CoinFactorization::updateColumnLDensish ( CoinIndexedVector * regionSparse , int * COIN_RESTRICT regionIndex) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int number = regionSparse->getNumElements ( ); int numberNonZero; double tolerance = zeroTolerance_; numberNonZero = 0; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnL_.array(); const int * COIN_RESTRICT indexRow = indexRowL_.array(); const CoinFactorizationDouble * COIN_RESTRICT element = elementL_.array(); int last = numberRows_; assert ( last == baseL_ + numberL_); #if COIN_FACTORIZATION_DENSE_CODE //can take out last bit of sparse L as empty last -= numberDense_; #endif int smallestIndex = numberRowsExtra_; // do easy ones for (int k=0;k=baseL_) smallestIndex = CoinMin(iPivot,smallestIndex); else regionIndex[numberNonZero++]=iPivot; } // now others for (int i = smallestIndex; i < last; i++ ) { CoinFactorizationDouble pivotValue = region[i]; if ( fabs(pivotValue) > tolerance ) { CoinBigIndex start = startColumn[i]; CoinBigIndex end = startColumn[i + 1]; for (CoinBigIndex j = start; j < end; j ++ ) { int iRow = indexRow[j]; CoinFactorizationDouble result = region[iRow]; CoinFactorizationDouble value = element[j]; region[iRow] = result - value * pivotValue; } regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } // and dense for (int i=last ; i < numberRows_; i++ ) { CoinFactorizationDouble pivotValue = region[i]; if ( fabs(pivotValue) > tolerance ) { regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } regionSparse->setNumElements ( numberNonZero ); } // Updates part of column (FTRANL) when sparsish void CoinFactorization::updateColumnLSparsish ( CoinIndexedVector * regionSparse, int * COIN_RESTRICT regionIndex) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int number = regionSparse->getNumElements ( ); int numberNonZero; double tolerance = zeroTolerance_; numberNonZero = 0; const CoinBigIndex *startColumn = startColumnL_.array(); const int *indexRow = indexRowL_.array(); const CoinFactorizationDouble *element = elementL_.array(); int last = numberRows_; assert ( last == baseL_ + numberL_); #if COIN_FACTORIZATION_DENSE_CODE //can take out last bit of sparse L as empty last -= numberDense_; #endif // mark known to be zero int nInBig = sizeof(CoinBigIndex)/sizeof(int); CoinCheckZero * COIN_RESTRICT mark = reinterpret_cast (sparse_.array()+(2+nInBig)*maximumRowsExtra_); int smallestIndex = numberRowsExtra_; // do easy ones for (int k=0;k>CHECK_SHIFT; int iBit = iPivot-(iWord<(mark[iWord] | (1<(1<>CHECK_SHIFT; jLast = CoinMin((jLast< tolerance ) { for (CoinBigIndex j = start; j < end; j ++ ) { int iRow = indexRow[j]; CoinFactorizationDouble result = region[iRow]; CoinFactorizationDouble value = element[j]; region[iRow] = result - value * pivotValue; int iWord = iRow>>CHECK_SHIFT; int iBit = iRow-(iWord<(mark[iWord] | (1<(1<>CHECK_SHIFT; if (jLast>CHECK_SHIFT);k tolerance ) { CoinBigIndex j; for ( j = start; j < end; j ++ ) { int iRow = indexRow[j]; CoinFactorizationDouble result = region[iRow]; CoinFactorizationDouble value = element[j]; region[iRow] = result - value * pivotValue; int iWord = iRow>>CHECK_SHIFT; int iBit = iRow-(iWord<(mark[iWord] | (1<(1< tolerance ) { for (CoinBigIndex j = start; j < end; j ++ ) { int iRow = indexRow[j]; CoinFactorizationDouble result = region[iRow]; CoinFactorizationDouble value = element[j]; region[iRow] = result - value * pivotValue; } regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } // Now dense part for ( ; i < numberRows_; i++ ) { double pivotValue = region[i]; if ( fabs(pivotValue) > tolerance ) { regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } // zero out ones that might have been skipped mark[smallestIndex>>CHECK_SHIFT]=0; int kkLast = (numberRows_+BITS_PER_CHECK-1)>>CHECK_SHIFT; CoinZeroN(mark+kLast,kkLast-kLast); regionSparse->setNumElements ( numberNonZero ); } // Updates part of column (FTRANL) when sparse void CoinFactorization::updateColumnLSparse ( CoinIndexedVector * regionSparse , int * COIN_RESTRICT regionIndex) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int number = regionSparse->getNumElements ( ); int numberNonZero; double tolerance = zeroTolerance_; numberNonZero = 0; const CoinBigIndex *startColumn = startColumnL_.array(); const int *indexRow = indexRowL_.array(); const CoinFactorizationDouble *element = elementL_.array(); // use sparse_ as temporary area // mark known to be zero int * COIN_RESTRICT stack = sparse_.array(); /* pivot */ int * COIN_RESTRICT list = stack + maximumRowsExtra_; /* final list */ CoinBigIndex * COIN_RESTRICT next = reinterpret_cast (list + maximumRowsExtra_); /* jnext */ char * COIN_RESTRICT mark = reinterpret_cast (next + maximumRowsExtra_); int nList; #ifdef COIN_DEBUG for (int i=0;i=baseL_) { assert (kPivot=numberRowsExtra_) abort(); if(!mark[kPivot]) { stack[0]=kPivot; CoinBigIndex j=startColumn[kPivot+1]-1; int nStack=0; while (nStack>=0) { /* take off stack */ if (j>=startColumn[kPivot]) { int jPivot=indexRow[j--]; assert (jPivot>=baseL_&&jPivot=numberRowsExtra_) abort(); /* put back on stack */ next[nStack] =j; if (!mark[jPivot]) { /* and new one */ kPivot=jPivot; j = startColumn[kPivot+1]-1; stack[++nStack]=kPivot; assert (kPivot=numberRowsExtra_) abort(); mark[kPivot]=1; next[nStack]=j; } } else { /* finished so mark */ list[nList++]=kPivot; mark[kPivot]=1; --nStack; if (nStack>=0) { kPivot=stack[nStack]; assert (kPivot=0;i--) { int iPivot = list[i]; mark[iPivot]=0; CoinFactorizationDouble pivotValue = region[iPivot]; if ( fabs ( pivotValue ) > tolerance ) { regionIndex[numberNonZero++]=iPivot; for (CoinBigIndex j = startColumn[iPivot]; j < startColumn[iPivot+1]; j ++ ) { int iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; region[iRow] -= value * pivotValue; } } else { region[iPivot]=0.0; } } regionSparse->setNumElements ( numberNonZero ); } /* Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room. Also updates region3 region1 starts as zero and is zero at end */ int CoinFactorization::updateTwoColumnsFT ( CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermuteRegion3) { #ifdef CLP_FACTORIZATION_INSTRUMENT double startTimeX=CoinCpuTime(); #endif #if 1 //#ifdef NDEBUG //#undef NDEBUG //#endif //#define COIN_DEBUG #ifdef COIN_DEBUG regionSparse1->checkClean(); CoinIndexedVector save2(*regionSparse2); CoinIndexedVector save3(*regionSparse3); #endif CoinIndexedVector * regionFT ; CoinIndexedVector * regionUpdate ; int * COIN_RESTRICT regionIndex ; int numberNonZero ; const int *permute = permute_.array(); int * COIN_RESTRICT index ; double * COIN_RESTRICT region ; if (!noPermuteRegion3) { regionFT = regionSparse3; regionUpdate = regionSparse1; //permute and move indices into index array regionIndex = regionUpdate->getIndices ( ); //int numberNonZero; region = regionUpdate->denseVector(); numberNonZero = regionSparse3->getNumElements(); int * COIN_RESTRICT index = regionSparse3->getIndices(); double * COIN_RESTRICT array = regionSparse3->denseVector(); assert (!regionSparse3->packedMode()); for (int j = 0; j < numberNonZero; j ++ ) { int iRow = index[j]; double value = array[iRow]; array[iRow]=0.0; iRow = permute[iRow]; region[iRow] = value; regionIndex[j] = iRow; } regionUpdate->setNumElements ( numberNonZero ); } else { regionFT = regionSparse1; regionUpdate = regionSparse3; } //permute and move indices into index array (in U) regionIndex = regionFT->getIndices ( ); numberNonZero = regionSparse2->getNumElements(); index = regionSparse2->getIndices(); region = regionFT->denseVector(); double * COIN_RESTRICT array = regionSparse2->denseVector(); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); CoinBigIndex start = startColumnU[maximumColumnsExtra_]; startColumnU[numberColumnsExtra_] = start; regionIndex = indexRowU_.array() + start; #ifndef ABC_USE_COIN_FACTORIZATION assert(regionSparse2->packedMode()); #else if(regionSparse2->packedMode()) { #endif for (int j = 0; j < numberNonZero; j ++ ) { int iRow = index[j]; double value = array[j]; array[j]=0.0; iRow = permute[iRow]; region[iRow] = value; regionIndex[j] = iRow; } #ifdef ABC_USE_COIN_FACTORIZATION } else { // not packed for (int j = 0; j < numberNonZero; j ++ ) { int iRow = index[j]; double value = array[iRow]; array[iRow]=0.0; iRow = permute[iRow]; region[iRow] = value; regionIndex[j] = iRow; } } #endif regionFT->setNumElements ( numberNonZero ); if (collectStatistics_) { numberFtranCounts_+=2; ftranCountInput_ += regionFT->getNumElements()+ regionUpdate->getNumElements(); } // ******* L updateColumnL ( regionFT, regionIndex ); updateColumnL ( regionUpdate, regionUpdate->getIndices() ); if (collectStatistics_) ftranCountAfterL_ += regionFT->getNumElements()+ regionUpdate->getNumElements(); //permute extra //row bits here updateColumnRFT ( regionFT, regionIndex ); updateColumnR ( regionUpdate ); if (collectStatistics_) ftranCountAfterR_ += regionFT->getNumElements()+ regionUpdate->getNumElements(); // ******* U - see if densish // Guess at number at end int goSparse=0; if (sparseThreshold_>0) { int numberNonZero = (regionUpdate->getNumElements ( )+ regionFT->getNumElements())>>1; if (ftranAverageAfterR_) { int newNumber = static_cast (numberNonZero*ftranAverageAfterU_); if (newNumber< sparseThreshold_) goSparse = 2; else if (newNumber< sparseThreshold2_) goSparse = 1; } else { if (numberNonZerodenseVector ( ); int * COIN_RESTRICT indexFT = regionFT->getIndices(); int numberNonZeroFT; double * COIN_RESTRICT arrayUpdate = regionUpdate->denseVector ( ); int * COIN_RESTRICT indexUpdate = regionUpdate->getIndices(); int numberNonZeroUpdate; updateTwoColumnsUDensish(numberNonZeroFT,arrayFT,indexFT, numberNonZeroUpdate,arrayUpdate,indexUpdate); regionFT->setNumElements ( numberNonZeroFT ); regionUpdate->setNumElements ( numberNonZeroUpdate ); if (collectStatistics_) { ftranCountAfterU_ += numberNonZeroFT + numberNonZeroUpdate; #ifdef CLP_FACTORIZATION_INSTRUMENT scaledLengthDense += numberDense_*numberNonZeroFT; scaledLengthDenseSquared += numberDense_*numberDense_*numberNonZeroFT; scaledLengthL += lengthL_*numberNonZeroFT; scaledLengthR += lengthR_*numberNonZeroFT; scaledLengthU += lengthU_*numberNonZeroFT; scaledLengthDense += numberDense_*numberNonZeroUpdate; scaledLengthDenseSquared += numberDense_*numberDense_*numberNonZeroUpdate; scaledLengthL += lengthL_*numberNonZeroUpdate; scaledLengthR += lengthR_*numberNonZeroUpdate; scaledLengthU += lengthU_*numberNonZeroUpdate; #endif } } else { // sparse updateColumnU ( regionFT, regionIndex); updateColumnU ( regionUpdate, regionUpdate->getIndices()); } permuteBack(regionFT,regionSparse2); if (!noPermuteRegion3) { permuteBack(regionUpdate,regionSparse3); } #ifdef COIN_DEBUG int n2=regionSparse2->getNumElements(); regionSparse1->checkClean(); int n2a= updateColumnFT(regionSparse1,&save2); assert(n2==n2a); { int j; double * regionA = save2.denseVector(); int * indexA = save2.getIndices(); double * regionB = regionSparse2->denseVector(); int * indexB = regionSparse2->getIndices(); for (j=0;jgetNumElements(); assert (n3==save3.getNumElements()); { int j; double * regionA = save3.denseVector(); int * indexA = save3.getIndices(); double * regionB = regionSparse3->denseVector(); int * indexB = regionSparse3->getIndices(); for (j=0;jgetNumElements()); regionSparse2->print(); printf("REGION3 %d els\n",regionSparse3->getNumElements()); regionSparse3->print(); #endif return regionSparse2->getNumElements(); #else int returnCode= updateColumnFT(regionSparse1, regionSparse2); assert (noPermuteRegion3); updateColumn(regionSparse3, regionSparse3, noPermuteRegion3); #ifdef CLP_FACTORIZATION_INSTRUMENT numberUpdateTwoFT++; timeInUpdateTwoFT += CoinCpuTime()-startTimeX; averageLengthR += 2*lengthR_; averageLengthU += 2*lengthU_; averageLengthL += 2*lengthL_; #endif //printf("REGION2 %d els\n",regionSparse2->getNumElements()); //regionSparse2->print(); //printf("REGION3 %d els\n",regionSparse3->getNumElements()); //regionSparse3->print(); return returnCode; #endif } // Updates part of 2 columns (FTRANU) real work void CoinFactorization::updateTwoColumnsUDensish ( int & numberNonZero1, double * COIN_RESTRICT region1, int * COIN_RESTRICT index1, int & numberNonZero2, double * COIN_RESTRICT region2, int * COIN_RESTRICT index2) const { double tolerance = zeroTolerance_; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnU_.array(); const int * COIN_RESTRICT indexRow = indexRowU_.array(); const CoinFactorizationDouble * COIN_RESTRICT element = elementU_.array(); int numberNonZeroA = 0; int numberNonZeroB = 0; const int *numberInColumn = numberInColumn_.array(); const CoinFactorizationDouble *pivotRegion = pivotRegion_.array(); for (int i = numberU_-1 ; i >= numberSlacks_; i-- ) { CoinFactorizationDouble pivotValue2 = region2[i]; region2[i] = 0.0; CoinFactorizationDouble pivotValue1 = region1[i]; region1[i] = 0.0; if ( fabs ( pivotValue2 ) > tolerance ) { CoinBigIndex start = startColumn[i]; const CoinFactorizationDouble * COIN_RESTRICT thisElement = element+start; const int * COIN_RESTRICT thisIndex = indexRow+start; if ( fabs ( pivotValue1 ) <= tolerance ) { // just region 2 for (CoinBigIndex j=numberInColumn[i]-1 ; j >=0; j-- ) { int iRow = thisIndex[j]; CoinFactorizationDouble value = thisElement[j]; #ifdef NO_LOAD region2[iRow] -= value * pivotValue2; #else CoinFactorizationDouble regionValue2 = region2[iRow]; region2[iRow] = regionValue2 - value * pivotValue2; #endif } pivotValue2 *= pivotRegion[i]; region2[i]=pivotValue2; index2[numberNonZeroB++]=i; } else { // both for (CoinBigIndex j=numberInColumn[i]-1 ; j >=0; j-- ) { int iRow = thisIndex[j]; CoinFactorizationDouble value = thisElement[j]; #ifdef NO_LOAD region1[iRow] -= value * pivotValue1; region2[iRow] -= value * pivotValue2; #else CoinFactorizationDouble regionValue1 = region1[iRow]; CoinFactorizationDouble regionValue2 = region2[iRow]; region1[iRow] = regionValue1 - value * pivotValue1; region2[iRow] = regionValue2 - value * pivotValue2; #endif } pivotValue1 *= pivotRegion[i]; pivotValue2 *= pivotRegion[i]; region1[i]=pivotValue1; index1[numberNonZeroA++]=i; region2[i]=pivotValue2; index2[numberNonZeroB++]=i; } } else if ( fabs ( pivotValue1 ) > tolerance ) { CoinBigIndex start = startColumn[i]; const CoinFactorizationDouble * COIN_RESTRICT thisElement = element+start; const int * COIN_RESTRICT thisIndex = indexRow+start; // just region 1 for (CoinBigIndex j=numberInColumn[i]-1 ; j >=0; j-- ) { int iRow = thisIndex[j]; CoinFactorizationDouble value = thisElement[j]; #ifdef NO_LOAD region1[iRow] -= value * pivotValue1; #else CoinFactorizationDouble regionValue1 = region1[iRow]; region1[iRow] = regionValue1 - value * pivotValue1; #endif } pivotValue1 *= pivotRegion[i]; region1[i]=pivotValue1; index1[numberNonZeroA++]=i; } } // Slacks for (int i = numberSlacks_-1; i>=0;i--) { double value2 = region2[i]; double value1 = region1[i]; bool value1NonZero = (value1!=0.0); if ( fabs(value2) > tolerance ) { region2[i]=-value2; index2[numberNonZeroB++]=i; } else { region2[i]=0.0; } if ( value1NonZero ) { index1[numberNonZeroA]=i; if ( fabs(value1) > tolerance ) { region1[i]=-value1; numberNonZeroA++; } else { region1[i]=0.0; } } } numberNonZero1=numberNonZeroA; numberNonZero2=numberNonZeroB; } #ifdef COIN_FACTORIZATION_DIAGNOSE static int numberTimesX=0; static int numberSparseX=0; double sumNumberSparseX=0.0; static int numberSparsishX=0; double sumNumberSparsishX=0.0; static int numberDensishX=0; double sumNumberDensishX=0.0; #endif // updateColumnU. Updates part of column (FTRANU) void CoinFactorization::updateColumnU ( CoinIndexedVector * regionSparse, int * indexIn) const { int numberNonZero = regionSparse->getNumElements ( ); int goSparse; // Guess at number at end if (sparseThreshold_>0) { if (ftranAverageAfterR_) { int newNumber = static_cast (numberNonZero*ftranAverageAfterU_); if (newNumber< sparseThreshold_) goSparse = 2; else if (newNumber< sparseThreshold2_) goSparse = 1; else goSparse = 0; } else { if (numberNonZerodenseVector ( ); int * regionIndex = regionSparse->getIndices(); int numberNonZero=updateColumnUDensish(region,regionIndex); regionSparse->setNumElements ( numberNonZero ); } break; case 1: // middling updateColumnUSparsish(regionSparse,indexIn); break; case 2: // sparse updateColumnUSparse(regionSparse,indexIn); break; } if (collectStatistics_) { ftranCountAfterU_ += regionSparse->getNumElements ( ); #ifdef CLP_FACTORIZATION_INSTRUMENT int numberNonZero=regionSparse->getNumElements(); scaledLengthDense += numberDense_*numberNonZero; scaledLengthDenseSquared += numberDense_*numberDense_*numberNonZero; scaledLengthL += lengthL_*numberNonZero; scaledLengthR += lengthR_*numberNonZero; scaledLengthU += lengthU_*numberNonZero; #endif } } #ifdef COIN_DEVELOP double ncall_DZ=0.0; double nrow_DZ=0.0; double nslack_DZ=0.0; double nU_DZ=0.0; double nnz_DZ=0.0; double nDone_DZ=0.0; #endif // Updates part of column (FTRANU) real work int CoinFactorization::updateColumnUDensish ( double * COIN_RESTRICT region, int * COIN_RESTRICT regionIndex) const { double tolerance = zeroTolerance_; const CoinBigIndex *startColumn = startColumnU_.array(); const int *indexRow = indexRowU_.array(); const CoinFactorizationDouble *element = elementU_.array(); int numberNonZero = 0; const int *numberInColumn = numberInColumn_.array(); const CoinFactorizationDouble *pivotRegion = pivotRegion_.array(); #ifdef COIN_DEVELOP ncall_DZ++; nrow_DZ += numberRows_; nslack_DZ += numberSlacks_; nU_DZ += numberU_; #endif for (int i = numberU_-1 ; i >= numberSlacks_; i-- ) { CoinFactorizationDouble pivotValue = region[i]; if (pivotValue) { #ifdef COIN_DEVELOP nnz_DZ++; #endif region[i] = 0.0; if ( fabs ( pivotValue ) > tolerance ) { CoinBigIndex start = startColumn[i]; const CoinFactorizationDouble * thisElement = element+start; const int * thisIndex = indexRow+start; #ifdef COIN_DEVELOP nDone_DZ += numberInColumn[i]; #endif for (CoinBigIndex j=numberInColumn[i]-1 ; j >=0; j-- ) { int iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; region[iRow] = regionValue - value * pivotValue; } pivotValue *= pivotRegion[i]; region[i]=pivotValue; regionIndex[numberNonZero++]=i; } } } // now do slacks #ifndef COIN_FAST_CODE if (slackValue_==-1.0) { #endif #if 0 // Could skew loop to pick up next one earlier // might improve pipelining for (int i = numberSlacks_-1; i>2;i-=2) { double value0 = region[i]; double absValue0 = fabs ( value0 ); double value1 = region[i-1]; double absValue1 = fabs ( value1 ); if ( value0 ) { if ( absValue0 > tolerance ) { region[i]=-value0; regionIndex[numberNonZero++]=i; } else { region[i]=0.0; } } if ( value1 ) { if ( absValue1 > tolerance ) { region[i-1]=-value1; regionIndex[numberNonZero++]=i-1; } else { region[i-1]=0.0; } } } for ( ; i>=0;i--) { double value = region[i]; double absValue = fabs ( value ); if ( value ) { if ( absValue > tolerance ) { region[i]=-value; regionIndex[numberNonZero++]=i; } else { region[i]=0.0; } } } #else for (int i = numberSlacks_-1; i>=0;i--) { double value = region[i]; if ( value ) { region[i]=-value; regionIndex[numberNonZero]=i; if ( fabs(value) > tolerance ) numberNonZero++; else region[i]=0.0; } } #endif #ifndef COIN_FAST_CODE } else { assert (slackValue_==1.0); for (int i = numberSlacks_-1; i>=0;i--) { double value = region[i]; double absValue = fabs ( value ); if ( value ) { region[i]=0.0; if ( absValue > tolerance ) { region[i]=value; regionIndex[numberNonZero++]=i; } } } } #endif return numberNonZero; } // updateColumnU. Updates part of column (FTRANU) /* Since everything is in order I should be able to do a better job of marking stuff - think. Also as L is static maybe I can do something better there (I know I could if I marked the depth of every element but that would lead to other inefficiencies. */ void CoinFactorization::updateColumnUSparse ( CoinIndexedVector * regionSparse, int * COIN_RESTRICT indexIn) const { int numberNonZero = regionSparse->getNumElements ( ); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); double * COIN_RESTRICT region = regionSparse->denseVector ( ); double tolerance = zeroTolerance_; const CoinBigIndex *startColumn = startColumnU_.array(); const int *indexRow = indexRowU_.array(); const CoinFactorizationDouble *element = elementU_.array(); const CoinFactorizationDouble *pivotRegion = pivotRegion_.array(); // use sparse_ as temporary area // mark known to be zero int * COIN_RESTRICT stack = sparse_.array(); /* pivot */ int * COIN_RESTRICT list = stack + maximumRowsExtra_; /* final list */ CoinBigIndex * COIN_RESTRICT next = reinterpret_cast (list + maximumRowsExtra_); /* jnext */ char * COIN_RESTRICT mark = reinterpret_cast (next + maximumRowsExtra_); #ifdef COIN_DEBUG for (int i=0;i=startColumn[kPivot]) { kPivot=indexRow[j--]; /* put back on stack */ next[nStack++] =j; if (!mark[kPivot]) { /* and new one */ int numberIn = numberInColumn[kPivot]; if (numberIn) { j = startColumn[kPivot]+numberIn-1; stack[nStack]=kPivot; mark[kPivot]=2; next[nStack++]=j; } else { // can do immediately /* finished so mark */ mark[kPivot]=1; if (kPivot>=numberSlacks_) { list[nList++]=kPivot; } else { // slack - put at end --put; *put=kPivot; } } } } else { /* finished so mark */ mark[kPivot]=1; if (kPivot>=numberSlacks_) { list[nList++]=kPivot; } else { // slack - put at end assert (!numberInColumn[kPivot]); --put; *put=kPivot; } } } } } #if 0 { std::sort(list,list+nList); int i; int last; last =-1; for (i=0;ilast); last=k; } std::sort(put,putLast); int n = putLast-put; last =-1; for (i=0;ilast); last=k; } } #endif numberNonZero=0; for (int i=nList-1;i>=0;i--) { int iPivot = list[i]; mark[iPivot]=0; CoinFactorizationDouble pivotValue = region[iPivot]; region[iPivot]=0.0; if ( fabs ( pivotValue ) > tolerance ) { CoinBigIndex start = startColumn[iPivot]; int number = numberInColumn[iPivot]; CoinBigIndex j; for ( j = start; j < start+number; j++ ) { CoinFactorizationDouble value = element[j]; int iRow = indexRow[j]; region[iRow] -= value * pivotValue; } pivotValue *= pivotRegion[iPivot]; region[iPivot]=pivotValue; regionIndex[numberNonZero++]=iPivot; } } // slacks #ifndef COIN_FAST_CODE if (slackValue_==1.0) { for (;put tolerance ) { region[iPivot]=pivotValue; regionIndex[numberNonZero++]=iPivot; } } } else { #endif for (;put tolerance ) { region[iPivot]=-pivotValue; regionIndex[numberNonZero++]=iPivot; } } #ifndef COIN_FAST_CODE } #endif regionSparse->setNumElements ( numberNonZero ); } // updateColumnU. Updates part of column (FTRANU) /* Since everything is in order I should be able to do a better job of marking stuff - think. Also as L is static maybe I can do something better there (I know I could if I marked the depth of every element but that would lead to other inefficiencies. */ #ifdef COIN_DEVELOP double ncall_SZ=0.0; double nrow_SZ=0.0; double nslack_SZ=0.0; double nU_SZ=0.0; double nnz_SZ=0.0; double nDone_SZ=0.0; #endif void CoinFactorization::updateColumnUSparsish ( CoinIndexedVector * regionSparse, int * COIN_RESTRICT indexIn) const { int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); // mark known to be zero int * COIN_RESTRICT stack = sparse_.array(); /* pivot */ int * COIN_RESTRICT list = stack + maximumRowsExtra_; /* final list */ CoinBigIndex * COIN_RESTRICT next = reinterpret_cast (list + maximumRowsExtra_); /* jnext */ CoinCheckZero * COIN_RESTRICT mark = reinterpret_cast (next + maximumRowsExtra_); const int *numberInColumn = numberInColumn_.array(); #ifdef COIN_DEBUG for (int i=0;igetNumElements ( ); double * COIN_RESTRICT region = regionSparse->denseVector ( ); double tolerance = zeroTolerance_; const CoinBigIndex *startColumn = startColumnU_.array(); const int *indexRow = indexRowU_.array(); const CoinFactorizationDouble *element = elementU_.array(); const CoinFactorizationDouble *pivotRegion = pivotRegion_.array(); #ifdef COIN_DEVELOP ncall_SZ++; nrow_SZ += numberRows_; nslack_SZ += numberSlacks_; nU_SZ += numberU_; #endif for (int ii=0;ii>CHECK_SHIFT; int iBit = iPivot-(iWord<(mark[iWord] | (1<(1<>CHECK_SHIFT; jLast = CoinMax((jLast< (numberSlacks_)); int i; for ( i = numberU_-1 ; i >= jLast; i-- ) { CoinFactorizationDouble pivotValue = region[i]; region[i] = 0.0; if ( fabs ( pivotValue ) > tolerance ) { #ifdef COIN_DEVELOP nnz_SZ ++; #endif CoinBigIndex start = startColumn[i]; const CoinFactorizationDouble * thisElement = element+start; const int * thisIndex = indexRow+start; #ifdef COIN_DEVELOP nDone_SZ += numberInColumn[i]; #endif for (int j=numberInColumn[i]-1 ; j >=0; j-- ) { int iRow0 = thisIndex[j]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble value0 = thisElement[j]; int iWord = iRow0>>CHECK_SHIFT; int iBit = iRow0-(iWord<(mark[iWord] | (1<(1<>CHECK_SHIFT; if (jLast>numberSlacks_) { // now do in chunks for (int k=(jLast>>CHECK_SHIFT)-1;k>=kLast;k--) { unsigned int iMark = mark[k]; if (iMark) { // something in chunk - do all (as imark may change) int iLast = k<= iLast; i-- ) { CoinFactorizationDouble pivotValue = region[i]; if (pivotValue) { #ifdef COIN_DEVELOP nnz_SZ ++; #endif region[i] = 0.0; if ( fabs ( pivotValue ) > tolerance ) { CoinBigIndex start = startColumn[i]; const CoinFactorizationDouble * thisElement = element+start; const int * thisIndex = indexRow+start; #ifdef COIN_DEVELOP nDone_SZ += numberInColumn[i]; #endif for (int j=numberInColumn[i]-1 ; j >=0; j-- ) { int iRow0 = thisIndex[j]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble value0 = thisElement[j]; int iWord = iRow0>>CHECK_SHIFT; int iBit = iRow0-(iWord<(mark[iWord] | (1<(1<= numberSlacks_; i-- ) { CoinFactorizationDouble pivotValue = region[i]; region[i] = 0.0; if ( fabs ( pivotValue ) > tolerance ) { #ifdef COIN_DEVELOP nnz_SZ ++; #endif CoinBigIndex start = startColumn[i]; const CoinFactorizationDouble * thisElement = element+start; const int * thisIndex = indexRow+start; #ifdef COIN_DEVELOP nDone_SZ += numberInColumn[i]; #endif for (int j=numberInColumn[i]-1 ; j >=0; j-- ) { int iRow0 = thisIndex[j]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble value0 = thisElement[j]; int iWord = iRow0>>CHECK_SHIFT; int iBit = iRow0-(iWord<(mark[iWord] | (1<(1<>CHECK_SHIFT; jLast = jLast<=jLast;i--) { double value = region[i]; double absValue = fabs ( value ); if ( value ) { region[i]=0.0; if ( absValue > tolerance ) { region[i]=value; regionIndex[numberNonZero++]=i; } } } mark[jLast]=0; // now do in chunks for (int k=(jLast>>CHECK_SHIFT)-1;k>=0;k--) { unsigned int iMark = mark[k]; if (iMark) { // something in chunk - do all (as imark may change) int iLast = k<= iLast; i-- ) { double value = region[i]; double absValue = fabs ( value ); if ( value ) { region[i]=0.0; if ( absValue > tolerance ) { region[i]=value; regionIndex[numberNonZero++]=i; } } } mark[k]=0; } } } else { assert (factor==-1.0); #endif // First do down to convenient power of 2 CoinBigIndex jLast = (numberSlacks_-1)>>CHECK_SHIFT; jLast = jLast<=jLast;i--) { double value = region[i]; double absValue = fabs ( value ); if ( value ) { region[i]=0.0; if ( absValue > tolerance ) { region[i]=-value; regionIndex[numberNonZero++]=i; } } } mark[jLast]=0; // now do in chunks for (int k=(jLast>>CHECK_SHIFT)-1;k>=0;k--) { unsigned int iMark = mark[k]; if (iMark) { // something in chunk - do all (as imark may change) int iLast = k<= iLast; i-- ) { double value = region[i]; double absValue = fabs ( value ); if ( value ) { region[i]=0.0; if ( absValue > tolerance ) { region[i]=-value; regionIndex[numberNonZero++]=i; } } } mark[k]=0; } } #ifndef COIN_FAST_CODE } #endif } regionSparse->setNumElements ( numberNonZero ); mark[(numberU_-1)>>CHECK_SHIFT]=0; mark[numberSlacks_>>CHECK_SHIFT]=0; if (numberSlacks_) mark[(numberSlacks_-1)>>CHECK_SHIFT]=0; #ifdef COIN_DEBUG for (i=0;idenseVector ( ); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse->getNumElements ( ); if ( !numberR_ ) return; //return if nothing to do double tolerance = zeroTolerance_; const CoinBigIndex * startColumn = startColumnR_.array()-numberRows_; const int * indexRow = indexRowR_; const CoinFactorizationDouble * element = elementR_; const int * permute = permute_.array(); // Work out very dubious idea of what would be fastest int method=-1; // Size of R double sizeR=startColumnR_.array()[numberR_]; // Average double averageR = sizeR/(static_cast (numberRowsExtra_)); // weights (relative to actual work) double setMark = 0.1; // setting mark double test1= 1.0; // starting ftran (without testPivot) double testPivot = 2.0; // Seeing if zero etc double startDot=2.0; // For starting dot product version // For final scan double final = numberNonZero*1.0; double methodTime[3]; // For second type methodTime[1] = numberPivots_ * (testPivot + ((static_cast (numberNonZero))/(static_cast (numberRows_)) * averageR)); methodTime[1] += numberNonZero *(test1 + averageR); // For first type methodTime[0] = methodTime[1] + (numberNonZero+numberPivots_)*setMark; methodTime[1] += numberNonZero*final; // third methodTime[2] = sizeR + numberPivots_*startDot + numberNonZero*final; // switch off if necessary if (!numberInColumnPlus_.array()) { methodTime[0]=1.0e100; methodTime[1]=1.0e100; } else if (!sparse_.array()) { methodTime[0]=1.0e100; } double best=1.0e100; for (int i=0;i<3;i++) { if (methodTime[i]=0); const int * numberInColumnPlus = numberInColumnPlus_.array(); //if (method==1) //printf(" methods %g %g %g - chosen %d\n",methodTime[0],methodTime[1],methodTime[2],method); switch (method) { case 0: #ifdef STACK { // use sparse_ as temporary area // mark known to be zero int * COIN_RESTRICT stack = sparse_.array(); /* pivot */ int * COIN_RESTRICT list = stack + maximumRowsExtra_; /* final list */ CoinBigIndex * COIN_RESTRICT next = (CoinBigIndex *) (list + maximumRowsExtra_); /* jnext */ char * COIN_RESTRICT mark = (char *) (next + maximumRowsExtra_); // we have another copy of R in R const CoinFactorizationDouble * elementR = elementR_ + lengthAreaR_; const int * indexRowR = indexRowR_ + lengthAreaR_; const CoinBigIndex * startR = startColumnR_.array()+maximumPivots_+1; int nList=0; const int * permuteBack = permuteBack_.array(); for (int k=0;k=0) { /* take off stack */ if (j>=startR[kPivot]) { int jPivot=indexRowR[j--]; /* put back on stack */ next[nStack] =j; if (!mark[jPivot]) { /* and new one */ kPivot=jPivot; j=-10; stack[++nStack]=kPivot; mark[kPivot]=1; next[nStack]=j; } } else if (j==-10) { // before first - see if followon int jPivot = permuteBack[kPivot]; if (jPivot=0) { kPivot=stack[nStack]; j=next[nStack]; } } } } } numberNonZero=0; for (int i=nList-1;i>=0;i--) { int iPivot = list[i]; mark[iPivot]=0; CoinFactorizationDouble pivotValue; if (iPivot tolerance ) { region[iPivot] = pivotValue; CoinBigIndex start = startR[iPivot]; int number = numberInColumnPlus[iPivot]; CoinBigIndex end = start + number; CoinBigIndex j; for (j=start ; j < end; j ++ ) { int iRow = indexRowR[j]; CoinFactorizationDouble value = elementR[j]; region[iRow] -= value * pivotValue; } regionIndex[numberNonZero++] = iPivot; } else { region[iPivot] = 0.0; } } } #else { // use sparse_ as temporary area // mark known to be zero int * COIN_RESTRICT stack = sparse_.array(); /* pivot */ int * COIN_RESTRICT list = stack + maximumRowsExtra_; /* final list */ CoinBigIndex * COIN_RESTRICT next = reinterpret_cast (list + maximumRowsExtra_); /* jnext */ char * COIN_RESTRICT mark = reinterpret_cast (next + maximumRowsExtra_); // mark all rows which will be permuted for (int i = numberRows_; i < numberRowsExtra_; i++ ) { int iRow = permute[i]; mark[iRow]=1; } // we have another copy of R in R const CoinFactorizationDouble * elementR = elementR_ + lengthAreaR_; const int * indexRowR = indexRowR_ + lengthAreaR_; const CoinBigIndex * startR = startColumnR_.array()+maximumPivots_+1; // For current list order does not matter as // only affects end int newNumber=0; for (int i = 0; i < numberNonZero; i++ ) { int iRow = regionIndex[i]; assert (region[iRow]); if (!mark[iRow]) regionIndex[newNumber++]=iRow; int number = numberInColumnPlus[iRow]; if (number) { CoinFactorizationDouble pivotValue = region[iRow]; CoinBigIndex start=startR[iRow]; CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; int jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } } } numberNonZero = newNumber; for (int i = numberRows_; i < numberRowsExtra_; i++ ) { //move using permute_ (stored in inverse fashion) int iRow = permute[i]; CoinFactorizationDouble pivotValue = region[iRow]+region[i]; //zero out pre-permuted region[iRow] = 0.0; if ( fabs ( pivotValue ) > tolerance ) { region[i] = pivotValue; if (!mark[i]) regionIndex[numberNonZero++] = i; int number = numberInColumnPlus[i]; CoinBigIndex start=startR[i]; CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; int jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } } else { region[i] = 0.0; } mark[iRow]=0; } } #endif break; case 1: { // no sparse region // we have another copy of R in R const CoinFactorizationDouble * elementR = elementR_ + lengthAreaR_; const int * indexRowR = indexRowR_ + lengthAreaR_; const CoinBigIndex * startR = startColumnR_.array()+maximumPivots_+1; // For current list order does not matter as // only affects end for (int i = 0; i < numberNonZero; i++ ) { int iRow = regionIndex[i]; assert (region[iRow]); int number = numberInColumnPlus[iRow]; if (number) { CoinFactorizationDouble pivotValue = region[iRow]; CoinBigIndex start=startR[iRow]; CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; int jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } } } for (int i = numberRows_; i < numberRowsExtra_; i++ ) { //move using permute_ (stored in inverse fashion) int iRow = permute[i]; CoinFactorizationDouble pivotValue = region[iRow]+region[i]; //zero out pre-permuted region[iRow] = 0.0; if ( fabs ( pivotValue ) > tolerance ) { region[i] = pivotValue; regionIndex[numberNonZero++] = i; int number = numberInColumnPlus[i]; CoinBigIndex start=startR[i]; CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; int jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } } else { region[i] = 0.0; } } } break; case 2: { CoinBigIndex start = startColumn[numberRows_]; for (int i = numberRows_; i < numberRowsExtra_; i++ ) { //move using permute_ (stored in inverse fashion) CoinBigIndex end = startColumn[i+1]; int iRow = permute[i]; CoinFactorizationDouble pivotValue = region[iRow]; //zero out pre-permuted region[iRow] = 0.0; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = element[j]; int jRow = indexRow[j]; value *= region[jRow]; pivotValue -= value; } start=end; if ( fabs ( pivotValue ) > tolerance ) { region[i] = pivotValue; regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } } break; } if (method) { // pack down int n=numberNonZero; numberNonZero=0; for (int i=0;isetNumElements ( numberNonZero ); } // updateColumnR. Updates part of column (FTRANR) void CoinFactorization::updateColumnRFT ( CoinIndexedVector * regionSparse, int * COIN_RESTRICT regionIndex) { double * COIN_RESTRICT region = regionSparse->denseVector ( ); //int *regionIndex = regionSparse->getIndices ( ); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); int numberNonZero = regionSparse->getNumElements ( ); if ( numberR_ ) { double tolerance = zeroTolerance_; const CoinBigIndex * startColumn = startColumnR_.array()-numberRows_; const int * indexRow = indexRowR_; const CoinFactorizationDouble * element = elementR_; const int * permute = permute_.array(); // Work out very dubious idea of what would be fastest int method=-1; // Size of R double sizeR=startColumnR_.array()[numberR_]; // Average double averageR = sizeR/(static_cast (numberRowsExtra_)); // weights (relative to actual work) double setMark = 0.1; // setting mark double test1= 1.0; // starting ftran (without testPivot) double testPivot = 2.0; // Seeing if zero etc double startDot=2.0; // For starting dot product version // For final scan double final = numberNonZero*1.0; double methodTime[3]; // For second type methodTime[1] = numberPivots_ * (testPivot + ((static_cast (numberNonZero))/(static_cast (numberRows_)) * averageR)); methodTime[1] += numberNonZero *(test1 + averageR); // For first type methodTime[0] = methodTime[1] + (numberNonZero+numberPivots_)*setMark; methodTime[1] += numberNonZero*final; // third methodTime[2] = sizeR + numberPivots_*startDot + numberNonZero*final; // switch off if necessary if (!numberInColumnPlus_.array()) { methodTime[0]=1.0e100; methodTime[1]=1.0e100; } else if (!sparse_.array()) { methodTime[0]=1.0e100; } const int * numberInColumnPlus = numberInColumnPlus_.array(); int * numberInColumn = numberInColumn_.array(); // adjust for final scan methodTime[1] += final; double best=1.0e100; for (int i=0;i<3;i++) { if (methodTime[i]=0); switch (method) { case 0: { // use sparse_ as temporary area // mark known to be zero int * COIN_RESTRICT stack = sparse_.array(); /* pivot */ int * COIN_RESTRICT list = stack + maximumRowsExtra_; /* final list */ CoinBigIndex * COIN_RESTRICT next = reinterpret_cast (list + maximumRowsExtra_); /* jnext */ char * COIN_RESTRICT mark = reinterpret_cast (next + maximumRowsExtra_); // mark all rows which will be permuted for (int i = numberRows_; i < numberRowsExtra_; i++ ) { int iRow = permute[i]; mark[iRow]=1; } // we have another copy of R in R const CoinFactorizationDouble * elementR = elementR_ + lengthAreaR_; const int * indexRowR = indexRowR_ + lengthAreaR_; const CoinBigIndex * startR = startColumnR_.array()+maximumPivots_+1; //save in U //in at end int iColumn = numberColumnsExtra_; startColumnU[iColumn] = startColumnU[maximumColumnsExtra_]; CoinBigIndex start = startColumnU[iColumn]; //int * putIndex = indexRowU_ + start; CoinFactorizationDouble * COIN_RESTRICT putElement = elementU_.array() + start; // For current list order does not matter as // only affects end int newNumber=0; for (int i = 0; i < numberNonZero; i++ ) { int iRow = regionIndex[i]; CoinFactorizationDouble pivotValue = region[iRow]; assert (region[iRow]); if (!mark[iRow]) { //putIndex[newNumber]=iRow; putElement[newNumber]=pivotValue;; regionIndex[newNumber++]=iRow; } int number = numberInColumnPlus[iRow]; if (number) { CoinBigIndex start=startR[iRow]; CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; int jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } } } numberNonZero = newNumber; for (int i = numberRows_; i < numberRowsExtra_; i++ ) { //move using permute_ (stored in inverse fashion) int iRow = permute[i]; CoinFactorizationDouble pivotValue = region[iRow]+region[i]; //zero out pre-permuted region[iRow] = 0.0; if ( fabs ( pivotValue ) > tolerance ) { region[i] = pivotValue; if (!mark[i]) { //putIndex[numberNonZero]=i; putElement[numberNonZero]=pivotValue;; regionIndex[numberNonZero++]=i; } int number = numberInColumnPlus[i]; CoinBigIndex start=startR[i]; CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; int jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } } else { region[i] = 0.0; } mark[iRow]=0; } numberInColumn[iColumn] = numberNonZero; startColumnU[maximumColumnsExtra_] = start + numberNonZero; } break; case 1: { // no sparse region // we have another copy of R in R const CoinFactorizationDouble * elementR = elementR_ + lengthAreaR_; const int * indexRowR = indexRowR_ + lengthAreaR_; const CoinBigIndex * startR = startColumnR_.array()+maximumPivots_+1; // For current list order does not matter as // only affects end for (int i = 0; i < numberNonZero; i++ ) { int iRow = regionIndex[i]; assert (region[iRow]); int number = numberInColumnPlus[iRow]; if (number) { CoinFactorizationDouble pivotValue = region[iRow]; CoinBigIndex start=startR[iRow]; CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; int jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } } } for (int i = numberRows_; i < numberRowsExtra_; i++ ) { //move using permute_ (stored in inverse fashion) int iRow = permute[i]; CoinFactorizationDouble pivotValue = region[iRow]+region[i]; //zero out pre-permuted region[iRow] = 0.0; if ( fabs ( pivotValue ) > tolerance ) { region[i] = pivotValue; regionIndex[numberNonZero++] = i; int number = numberInColumnPlus[i]; CoinBigIndex start=startR[i]; CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; int jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } } else { region[i] = 0.0; } } } break; case 2: { CoinBigIndex start = startColumn[numberRows_]; for (int i = numberRows_; i < numberRowsExtra_; i++ ) { //move using permute_ (stored in inverse fashion) CoinBigIndex end = startColumn[i+1]; int iRow = permute[i]; CoinFactorizationDouble pivotValue = region[iRow]; //zero out pre-permuted region[iRow] = 0.0; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = element[j]; int jRow = indexRow[j]; value *= region[jRow]; pivotValue -= value; } start=end; if ( fabs ( pivotValue ) > tolerance ) { region[i] = pivotValue; regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } } break; } if (method) { // pack down int n=numberNonZero; numberNonZero=0; //save in U //in at end int iColumn = numberColumnsExtra_; assert(startColumnU[iColumn] == startColumnU[maximumColumnsExtra_]); CoinBigIndex start = startColumnU[iColumn]; int * COIN_RESTRICT putIndex = indexRowU_.array() + start; CoinFactorizationDouble * COIN_RESTRICT putElement = elementU_.array() + start; for (int i=0;isetNumElements ( numberNonZero ); } else { // No R but we still need to save column //save in U //in at end int * COIN_RESTRICT numberInColumn = numberInColumn_.array(); numberNonZero = regionSparse->getNumElements ( ); int iColumn = numberColumnsExtra_; assert(startColumnU[iColumn] == startColumnU[maximumColumnsExtra_]); CoinBigIndex start = startColumnU[iColumn]; numberInColumn[iColumn] = numberNonZero; startColumnU[maximumColumnsExtra_] = start + numberNonZero; int * COIN_RESTRICT putIndex = indexRowU_.array() + start; CoinFactorizationDouble * COIN_RESTRICT putElement = elementU_.array() + start; for (int i=0;igetIndices ( ); int numberNonZero = regionSparse2->getNumElements(); const int *permute = permute_.array(); int * COIN_RESTRICT index = regionSparse2->getIndices(); double * COIN_RESTRICT region = regionSparse->denseVector(); double * COIN_RESTRICT array = regionSparse2->denseVector(); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); bool doFT=doForrestTomlin_; // see if room if (doFT) { int iColumn = numberColumnsExtra_; startColumnU[iColumn] = startColumnU[maximumColumnsExtra_]; CoinBigIndex start = startColumnU[iColumn]; CoinBigIndex space = lengthAreaU_ - ( start + numberRowsExtra_ ); doFT = space>=0; if (doFT) { regionIndex = indexRowU_.array() + start; } else { startColumnU[maximumColumnsExtra_] = lengthAreaU_+1; } } #ifndef CLP_FACTORIZATION bool packed = regionSparse2->packedMode(); if (packed) { #else assert (regionSparse2->packedMode()); #endif for (int j = 0; j < numberNonZero; j ++ ) { int iRow = index[j]; double value = array[j]; array[j]=0.0; iRow = permute[iRow]; region[iRow] = value; regionIndex[j] = iRow; } #ifndef CLP_FACTORIZATION } else { for (int j = 0; j < numberNonZero; j ++ ) { int iRow = index[j]; double value = array[iRow]; array[iRow]=0.0; iRow = permute[iRow]; region[iRow] = value; regionIndex[j] = iRow; } } #endif regionSparse->setNumElements ( numberNonZero ); if (collectStatistics_) { numberFtranCounts_++; ftranCountInput_ += numberNonZero; } // ******* L #if 0 { double *region = regionSparse->denseVector ( ); //int *regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse->getNumElements ( ); for (int i=0;idenseVector ( ); //int *regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse->getNumElements ( ); for (int i=0;igetNumElements(); //permute extra //row bits here if ( doFT ) updateColumnRFT ( regionSparse, regionIndex ); else updateColumnR ( regionSparse ); if (collectStatistics_) ftranCountAfterR_ += regionSparse->getNumElements(); // ******* U updateColumnU ( regionSparse, regionIndex); if (!doForrestTomlin_) { // Do PFI after everything else updateColumnPFI(regionSparse); } permuteBack(regionSparse,regionSparse2); #ifdef CLP_FACTORIZATION_INSTRUMENT numberUpdateFT++; timeInUpdateFT += CoinCpuTime()-startTimeX; averageLengthR += lengthR_; averageLengthU += lengthU_; averageLengthL += lengthL_; #endif // will be negative if no room if ( doFT ) return regionSparse2->getNumElements(); else return -regionSparse2->getNumElements(); } CoinMP-1.8.3/CoinUtils/src/Makefile.am0000644000175000017500000001373112465773334016073 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1800 2015-02-08 23:53:00Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libCoinUtils # ######################################################################## # Name of the library compiled in this directory. # We want it to be installed in the $libdir directory lib_LTLIBRARIES = libCoinUtils.la # List all source files for this library, including headers libCoinUtils_la_SOURCES = \ config_coinutils.h \ CoinUtilsConfig.h \ Coin_C_defines.h \ CoinAlloc.cpp CoinAlloc.hpp \ CoinBuild.cpp CoinBuild.hpp \ CoinDenseVector.cpp CoinDenseVector.hpp \ CoinDistance.hpp \ CoinError.cpp CoinError.hpp \ CoinFactorization.hpp \ CoinFactorization1.cpp \ CoinFactorization2.cpp \ CoinFactorization3.cpp \ CoinFactorization4.cpp \ CoinSimpFactorization.hpp \ CoinSimpFactorization.cpp \ CoinDenseFactorization.hpp \ CoinDenseFactorization.cpp \ CoinOslFactorization.hpp \ CoinOslFactorization.cpp \ CoinOslFactorization2.cpp \ CoinOslFactorization3.cpp \ CoinOslC.h \ CoinFileIO.cpp CoinFileIO.hpp \ CoinFinite.cpp CoinFinite.hpp \ CoinFloatEqual.hpp \ CoinHelperFunctions.hpp \ CoinIndexedVector.cpp CoinIndexedVector.hpp \ CoinLpIO.cpp CoinLpIO.hpp \ CoinMessage.cpp CoinMessage.hpp \ CoinMessageHandler.cpp CoinMessageHandler.hpp \ CoinModel.cpp CoinModel.hpp \ CoinStructuredModel.cpp CoinStructuredModel.hpp \ CoinModelUseful.cpp CoinModelUseful.hpp \ CoinModelUseful2.cpp \ CoinMpsIO.cpp CoinMpsIO.hpp \ CoinPackedMatrix.cpp CoinPackedMatrix.hpp \ CoinPackedVector.cpp CoinPackedVector.hpp \ CoinPackedVectorBase.cpp CoinPackedVectorBase.hpp \ CoinParam.cpp CoinParamUtils.cpp CoinParam.hpp \ CoinPostsolveMatrix.cpp \ CoinPragma.hpp \ CoinPrePostsolveMatrix.cpp \ CoinPresolveDoubleton.cpp CoinPresolveDoubleton.hpp \ CoinPresolveDual.cpp CoinPresolveDual.hpp \ CoinPresolveDupcol.cpp CoinPresolveDupcol.hpp \ CoinPresolveEmpty.cpp CoinPresolveEmpty.hpp \ CoinPresolveFixed.cpp CoinPresolveFixed.hpp \ CoinPresolveForcing.cpp CoinPresolveForcing.hpp \ CoinPresolveHelperFunctions.cpp \ CoinPresolveImpliedFree.cpp CoinPresolveImpliedFree.hpp \ CoinPresolveIsolated.cpp CoinPresolveIsolated.hpp \ CoinPresolveMatrix.cpp CoinPresolveMatrix.hpp \ CoinPresolvePsdebug.cpp CoinPresolvePsdebug.hpp \ CoinPresolveMonitor.cpp CoinPresolveMonitor.hpp \ CoinPresolveSingleton.cpp CoinPresolveSingleton.hpp \ CoinPresolveSubst.cpp CoinPresolveSubst.hpp \ CoinPresolveTighten.cpp CoinPresolveTighten.hpp \ CoinPresolveTripleton.cpp CoinPresolveTripleton.hpp \ CoinPresolveUseless.cpp CoinPresolveUseless.hpp \ CoinPresolveZeros.cpp CoinPresolveZeros.hpp \ CoinRational.cpp CoinRational.hpp \ CoinSearchTree.cpp CoinSearchTree.hpp \ CoinShallowPackedVector.cpp CoinShallowPackedVector.hpp \ CoinSignal.hpp \ CoinSmartPtr.hpp \ CoinSnapshot.cpp CoinSnapshot.hpp \ CoinSort.hpp \ CoinTime.hpp \ CoinTypes.hpp \ CoinUtility.hpp \ CoinWarmStart.hpp \ CoinWarmStartBasis.cpp CoinWarmStartBasis.hpp \ CoinWarmStartVector.cpp CoinWarmStartVector.hpp \ CoinWarmStartDual.cpp CoinWarmStartDual.hpp \ CoinWarmStartPrimalDual.cpp CoinWarmStartPrimalDual.hpp # List all additionally required libraries if DEPENDENCY_LINKING libCoinUtils_la_LIBADD = $(COINUTILSLIB_LIBS) endif # This is for libtool libCoinUtils_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows AM_CPPFLAGS = $(GLPK_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'install/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ Coin_C_defines.h \ CoinAlloc.hpp \ CoinBuild.hpp \ CoinDenseVector.hpp \ CoinDistance.hpp \ CoinError.hpp \ CoinFactorization.hpp \ CoinSimpFactorization.hpp \ CoinDenseFactorization.hpp \ CoinOslFactorization.hpp \ CoinFileIO.hpp \ CoinFinite.hpp \ CoinFloatEqual.hpp \ CoinHelperFunctions.hpp \ CoinIndexedVector.hpp \ CoinLpIO.hpp \ CoinMessage.hpp \ CoinMessageHandler.hpp \ CoinModel.hpp \ CoinStructuredModel.hpp \ CoinModelUseful.hpp \ CoinMpsIO.hpp \ CoinPackedMatrix.hpp \ CoinPackedVector.hpp \ CoinPackedVectorBase.hpp \ CoinParam.hpp \ CoinPragma.hpp \ CoinPresolveDoubleton.hpp \ CoinPresolveDual.hpp \ CoinPresolveDupcol.hpp \ CoinPresolveEmpty.hpp \ CoinPresolveFixed.hpp \ CoinPresolveForcing.hpp \ CoinPresolveImpliedFree.hpp \ CoinPresolveIsolated.hpp \ CoinPresolveMatrix.hpp \ CoinPresolveMonitor.hpp \ CoinPresolvePsdebug.hpp \ CoinPresolveSingleton.hpp \ CoinPresolveSubst.hpp \ CoinPresolveTighten.hpp \ CoinPresolveTripleton.hpp \ CoinPresolveUseless.hpp \ CoinPresolveZeros.hpp \ CoinRational.hpp \ CoinSearchTree.hpp \ CoinShallowPackedVector.hpp \ CoinSignal.hpp \ CoinSmartPtr.hpp \ CoinSnapshot.hpp \ CoinSort.hpp \ CoinTime.hpp \ CoinTypes.hpp \ CoinUtility.hpp \ CoinWarmStart.hpp \ CoinWarmStartBasis.hpp \ CoinWarmStartVector.hpp \ CoinWarmStartDual.hpp \ CoinWarmStartPrimalDual.hpp ####################################################################### # Create the Config.h file that has all public defines and install it # ####################################################################### install-exec-local: $(install_sh_DATA) config_coinutils.h $(DESTDIR)$(includecoindir)/CoinUtilsConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/CoinUtilsConfig.h CoinMP-1.8.3/CoinUtils/src/CoinOslFactorization3.cpp0000644000175000017500000023703112130031043020677 0ustar renerene/* $Id: CoinOslFactorization3.cpp 1582 2013-04-06 14:33:07Z stefan $ */ /* Copyright (C) 1987, 2009, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #include "CoinOslFactorization.hpp" #include "CoinOslC.h" #include "CoinFinite.hpp" #define GO_DENSE 70 #define GO_DENSE_RATIO 1.8 int c_ekkclco(const EKKfactinfo *fact,int *hcoli, int *mrstrt, int *hinrow, int xnewro); void c_ekkclcp(const int *hcol, const double *dels, const int * mrstrt, int *hrow, double *dels2, int *mcstrt, int *hincol, int itype, int nnrow, int nncol, int ninbas); int c_ekkcmfc(EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, EKKHlink *mwork, void *maction_void, int nnetas, int *nsingp, int *xrejctp, int *xnewrop, int xnewco, int *ncompactionsp); int c_ekkcmfy(EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, EKKHlink *mwork, void *maction_void, int nnetas, int *nsingp, int *xrejctp, int *xnewrop, int xnewco, int *ncompactionsp); int c_ekkcmfd(EKKfactinfo *fact, int *mcol, EKKHlink *rlink, EKKHlink *clink, int *maction, int nnetas, int *nnentlp, int *nnentup, int *nsingp); int c_ekkford(const EKKfactinfo *fact,const int *hinrow, const int *hincol, int *hpivro, int *hpivco, EKKHlink *rlink, EKKHlink *clink); void c_ekkrowq(int *hrow, int *hcol, double *dels, int *mrstrt, const int *hinrow, int nnrow, int ninbas); int c_ekkrwco(const EKKfactinfo *fact,double *dluval, int *hcoli, int * mrstrt, int *hinrow, int xnewro); int c_ekkrwcs(const EKKfactinfo *fact,double *dluval, int *hcoli, int *mrstrt, const int *hinrow, const EKKHlink *mwork, int nfirst); void c_ekkrwct(const EKKfactinfo *fact,double *dluval, int *hcoli, int *mrstrt, const int *hinrow, const EKKHlink *mwork, const EKKHlink *rlink, const short *msort, double *dsort, int nlast, int xnewro); int c_ekkshff(EKKfactinfo *fact, EKKHlink *clink, EKKHlink *rlink, int xnewro); void c_ekkshfv(EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, int xnewro); int c_ekktria(EKKfactinfo *fact, EKKHlink * rlink, EKKHlink * clink, int *nsingp, int *xnewcop, int *xnewrop, int *nlrowtp, const int ninbas); #if 0 static void c_ekkafpv(int *hentry, int *hcoli, double *dluval, int *mrstrt, int *hinrow, int nentry) { int j; int nel, krs; int koff; int irow; int ientry; int * index; for (ientry = 0; ientry < nentry; ++ientry) { #ifdef INTEL int * els_long,maxaij_long; #endif double * els; irow = UNSHIFT_INDEX(hentry[ientry]); nel = hinrow[irow]; krs = mrstrt[irow]; index=&hcoli[krs]; els=&dluval[krs]; #ifdef INTEL els_long=reinterpret_cast (els); maxaij_long=0; #else double maxaij = 0.f; #endif koff = 0; j=0; if ((nel&1)!=0) { #ifdef INTEL maxaij_long = els_long[1] & 0x7fffffff; #else maxaij=fabs(els[0]); #endif j=1; } while (jxecadr; double *dluval = fact->xeeadr; //double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif const int nrow = fact->nrow; const double drtpiv = fact->drtpiv; int j, k, kc, kce, kcs, nzj; double pivot; int kipis, kipie; int jpivot; #ifndef NDEBUG int kpivot=-1; #else int kpivot=-1; #endif bool small_pivot = false; /* next singleton column. * Note that when the pivot column itself was removed from the * list, the column in the list after it (if any) moves to the * head of the list. * Also, if any column from the pivot row was reduced to length 1, * then it will have been added to the list and now be in front. */ for (jpivot = hpivco[1]; jpivot > 0; jpivot = hpivco[1]) { const int ipivot = hrowi[mcstrt[jpivot]]; /* (2) */ assert(ipivot); /* The pivot row is being eliminated (3) */ C_EKK_REMOVE_LINK(hpivro, hinrow, rlink, ipivot); /* Loop over nonzeros in pivot row: */ kipis = mrstrt[ipivot]; kipie = kipis + hinrow[ipivot] - 1; for (k = kipis; k <= kipie; ++k) { j = hcoli[k]; /* * We're eliminating column jpivot, * so we're eliminating the row it occurs in, * so every column in this row is becoming one shorter. * * I don't know why we don't do the same for rejected columns. * * if xrejct is false, then no column has ever been rejected * and this test wouldn't have to be made. * However, that means this whole loop would have to be copied. */ if (! (clink[j].pre > nrow)) { C_EKK_REMOVE_LINK(hpivco, hincol, clink, j); /* (3) */ } --hincol[j]; kcs = mcstrt[j]; kce = kcs + hincol[j]; for (kc = kcs; kc <= kce; ++kc) { if (ipivot == hrowi[kc]) { break; } } /* ASSERT !(kc>kce) */ /* (2) */ hrowi[kc] = hrowi[kce]; hrowi[kce] = 0; if (j == jpivot) { /* remember the slot corresponding to the pivot column */ kpivot = k; } else { /* * We just reduced the length of the column. * If we haven't eliminated all of its elements completely, * then we have to put it back in its new length list. * * If the column was rejected, we only put it back in a length * list when it has been reduced to a singleton column, * because it would just be rejected again. */ nzj = hincol[j]; if (! (nzj <= 0) && ! (clink[j].pre > nrow && nzj != 1)) { C_EKK_ADD_LINK(hpivco, nzj, clink, j); /* (3) */ } } } assert (kpivot>0); /* store pivot sequence number */ ++fact->npivots; rlink[ipivot].pre = -fact->npivots; clink[jpivot].pre = -fact->npivots; /* compute how much room we'll need later */ fact->nuspike += hinrow[ipivot]; /* check the pivot */ pivot = dluval[kpivot]; if (fabs(pivot) < drtpiv) { /* pivot element too small */ small_pivot = true; rlink[ipivot].pre = -nrow - 1; clink[jpivot].pre = -nrow - 1; ++(*nsingp); } /* swap the pivoted column entry with the first entry in the row */ dluval[kpivot] = dluval[kipis]; dluval[kipis] = pivot; hcoli[kpivot] = hcoli[kipis]; hcoli[kipis] = jpivot; } return (small_pivot); } /* c_ekkcsin */ /* Uwe H. Suhl, March 1987 */ /* This routine processes row singletons during the computation of */ /* an LU-decomposition for the nucleus. */ /* Return codes (checked version 1.16): */ /* -5: not enough space in row file */ /* -6: not enough space in column file */ /* 7: pivot element too small */ /* -52: system error at label 220 (ipivot not found) */ /* -53: system error at label 400 (jpivot not found) */ int c_ekkrsin(EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, EKKHlink *mwork, int nfirst, int *nsingp, int *xnewcop, int *xnewrop, int *nnentup, int *kmxetap, int *ncompactionsp, int *nnentlp) { #if 1 int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; //double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif const int nrow = fact->nrow; const double drtpiv = fact->drtpiv; int xnewro = *xnewrop; int xnewco = *xnewcop; int kmxeta = *kmxetap; int nnentu = *nnentup; int ncompactions = *ncompactionsp; int nnentl = *nnentlp; int i, j, k, kc, kr, npr, nzi; double pivot; int kjpis, kjpie, knprs, knpre; double elemnt, maxaij; int ipivot, epivco, lstart; #ifndef NDEBUG int kpivot=-1; #else int kpivot=-1; #endif int irtcod = 0; const int nnetas = fact->nnetas; lstart = nnetas - nnentl + 1; for (ipivot = hpivro[1]; ipivot > 0; ipivot = hpivro[1]) { const int jpivot = hcoli[mrstrt[ipivot]]; kjpis = mcstrt[jpivot]; kjpie = kjpis + hincol[jpivot] ; for (k = kjpis; k < kjpie; ++k) { i = hrowi[k]; /* * We're eliminating row ipivot, * so we're eliminating the column it occurs in, * so every row in this column is becoming one shorter. * * No exception is made for rejected rows. */ C_EKK_REMOVE_LINK(hpivro, hinrow, rlink, i); } /* The pivot column is being eliminated */ /* I don't know why there is an exception for rejected columns */ if (! (clink[jpivot].pre > nrow)) { C_EKK_REMOVE_LINK(hpivco, hincol, clink, jpivot); } epivco = hincol[jpivot] - 1; kjpie = kjpis + epivco; for (kc = kjpis; kc <= kjpie; ++kc) { if (ipivot == hrowi[kc]) { break; } } /* ASSERT !(kc>kjpie) */ /* move the last column entry into this deleted one to keep */ /* the entries compact */ hrowi[kc] = hrowi[kjpie]; hrowi[kjpie] = 0; /* store pivot sequence number */ ++fact->npivots; rlink[ipivot].pre = -fact->npivots; clink[jpivot].pre = -fact->npivots; /* Check if row or column files have to be compressed */ if (! (xnewro + epivco < lstart)) { if (! (nnentu + epivco < lstart)) { return (-5); } { int iput = c_ekkrwcs(fact,dluval, hcoli, mrstrt, hinrow, mwork, nfirst); kmxeta += xnewro - iput ; xnewro = iput - 1; ++ncompactions; } } if (! (xnewco + epivco < lstart)) { if (! (nnentu + epivco < lstart)) { return (-5); } xnewco = c_ekkclco(fact,hrowi, mcstrt, hincol, xnewco); ++ncompactions; } /* This column has no more entries in it */ hincol[jpivot] = 0; /* Perform numerical part of elimination. */ pivot = dluval[mrstrt[ipivot]]; if (fabs(pivot) < drtpiv) { irtcod = 7; rlink[ipivot].pre = -nrow - 1; clink[jpivot].pre = -nrow - 1; ++(*nsingp); } /* If epivco is 0, then we can treat this like a singleton column (?)*/ if (! (epivco <= 0)) { ++fact->xnetal; mcstrt[fact->xnetal] = lstart - 1; hpivco[fact->xnetal] = ipivot; /* Loop over nonzeros in pivot column. */ kjpis = mcstrt[jpivot]; kjpie = kjpis + epivco ; nnentl+=epivco; nnentu-=epivco; for (kc = kjpis; kc < kjpie; ++kc) { npr = hrowi[kc]; /* zero out the row entries as we go along */ hrowi[kc] = 0; /* each row in the column is getting shorter */ --hinrow[npr]; /* find the entry in this row for the pivot column */ knprs = mrstrt[npr]; knpre = knprs + hinrow[npr]; for (kr = knprs; kr <= knpre; ++kr) { if (jpivot == hcoli[kr]) break; } /* ASSERT !(kr>knpre) */ elemnt = dluval[kr]; /* move the last pivot column entry into this one */ /* to keep entries compact */ dluval[kr] = dluval[knpre]; hcoli[kr] = hcoli[knpre]; /* * c_ekkmltf put the largest entries in front, and * we want to maintain that property. * There is only a problem if we just pivoted out the first * entry, and there is more than one entry in the list. */ if (! (kr != knprs || hinrow[npr] <= 1)) { maxaij = 0.f; for (k = knprs; k <= knpre; ++k) { if (! (fabs(dluval[k]) <= maxaij)) { maxaij = fabs(dluval[k]); kpivot = k; } } assert (kpivot>0); maxaij = dluval[kpivot]; dluval[kpivot] = dluval[knprs]; dluval[knprs] = maxaij; j = hcoli[kpivot]; hcoli[kpivot] = hcoli[knprs]; hcoli[knprs] = j; } /* store elementary row transformation */ --lstart; dluval[lstart] = -elemnt / pivot; hrowi[lstart] = SHIFT_INDEX(npr); /* Only add the row back in a length list if it isn't empty */ nzi = hinrow[npr]; if (! (nzi <= 0)) { C_EKK_ADD_LINK(hpivro, nzi, rlink, npr); } } ++fact->nuspike; } } *xnewrop = xnewro; *xnewcop = xnewco; *kmxetap = kmxeta; *nnentup = nnentu; *ncompactionsp = ncompactions; *nnentlp = nnentl; return (irtcod); } /* c_ekkrsin */ int c_ekkfpvt(const EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, int *nsingp, int *xrejctp, int *xipivtp, int *xjpivtp) { double zpivlu = fact->zpivlu; #if 1 int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; //double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif int i, j, k, ke, kk, ks, nz, nz1, kce, kcs, kre, krs; double minsze; int marcst, mincst, mincnt, trials, nentri; int jpivot=-1; bool rjectd; int ipivot; const int nrow = fact->nrow; int irtcod = 0; /* this used to be initialized in c_ekklfct */ const int xtrial = 1; trials = 0; ipivot = 0; mincst = COIN_INT_MAX; mincnt = COIN_INT_MAX; for (nz = 2; nz <= nrow; ++nz) { nz1 = nz - 1; if (mincnt <= nz) { goto L900; } /* Search rows for a pivot */ for (i = hpivro[nz]; ! (i <= 0); i = rlink[i].suc) { ks = mrstrt[i]; ke = ks + nz - 1; /* Determine magnitude of minimal acceptable element */ minsze = fabs(dluval[ks]) * zpivlu; for (k = ks; k <= ke; ++k) { /* Consider a column only if it passes the stability test */ if (! (fabs(dluval[k]) < minsze)) { j = hcoli[k]; marcst = nz1 * hincol[j]; if (! (marcst >= mincst)) { mincst = marcst; mincnt = hincol[j]; ipivot = i; jpivot = j; if (mincnt <= nz + 1) { goto L900; } } } } ++trials; if (trials >= xtrial) { goto L900; } } /* Search columns for a pivot */ j = hpivco[nz]; while (! (j <= 0)) { /* XSEARD = XSEARD + 1 */ rjectd = false; kcs = mcstrt[j]; kce = kcs + nz - 1; for (k = kcs; k <= kce; ++k) { i = hrowi[k]; nentri = hinrow[i]; marcst = nz1 * nentri; if (! (marcst >= mincst)) { /* Determine magnitude of minimal acceptable element */ minsze = fabs(dluval[mrstrt[i]]) * zpivlu; krs = mrstrt[i]; kre = krs + nentri - 1; for (kk = krs; kk <= kre; ++kk) { if (hcoli[kk] == j) break; } /* ASSERT (kk <= kre) */ /* perform stability test */ if (! (fabs(dluval[kk]) < minsze)) { mincst = marcst; mincnt = nentri; ipivot = i; jpivot = j; rjectd = false; if (mincnt <= nz) { goto L900; } } else { if (ipivot == 0) { rjectd = true; } } } } ++trials; if (trials >= xtrial && ipivot > 0) { goto L900; } if (rjectd) { int jsuc = clink[j].suc; ++(*xrejctp); C_EKK_REMOVE_LINK(hpivco, hincol, clink, j); clink[j].pre = nrow + 1; j = jsuc; } else { j = clink[j].suc; } } } /* FLAG REJECTED ROWS (should this be columns ?) */ for (j = 1; j <= nrow; ++j) { if (hinrow[j] == 0) { rlink[j].pre = -nrow - 1; ++(*nsingp); } } irtcod = 10; L900: *xipivtp = ipivot; *xjpivtp = jpivot; return (irtcod); } /* c_ekkfpvt */ void c_ekkprpv(EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, int xrejct, int ipivot, int jpivot) { #if 1 int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; //double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif int i, k; int kc; double pivot; int kipis = mrstrt[ipivot]; int kipie = kipis + hinrow[ipivot] - 1; #ifndef NDEBUG int kpivot=-1; #else int kpivot=-1; #endif const int nrow = fact->nrow; /* Update data structures */ { int kjpis = mcstrt[jpivot]; int kjpie = kjpis + hincol[jpivot] ; for (k = kjpis; k < kjpie; ++k) { i = hrowi[k]; C_EKK_REMOVE_LINK(hpivro, hinrow, rlink, i); } } for (k = kipis; k <= kipie; ++k) { int j = hcoli[k]; if ((xrejct == 0) || ! (clink[j].pre > nrow)) { C_EKK_REMOVE_LINK(hpivco, hincol, clink, j); } --hincol[j]; int kcs = mcstrt[j]; int kce = kcs + hincol[j]; for (kc = kcs; kc < kce ; kc ++) { if (hrowi[kc] == ipivot) break; } assert (kc0); /* Store the pivot sequence number */ ++fact->npivots; rlink[ipivot].pre = -fact->npivots; clink[jpivot].pre = -fact->npivots; pivot = dluval[kpivot]; dluval[kpivot] = dluval[kipis]; dluval[kipis] = pivot; hcoli[kpivot] = hcoli[kipis]; hcoli[kipis] = jpivot; } /* c_ekkprpv */ /* * c_ekkclco is almost exactly like c_ekkrwco. */ int c_ekkclco(const EKKfactinfo *fact,int *hcoli, int *mrstrt, int *hinrow, int xnewro) { #if 0 int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif int i, k, nz, kold; int kstart; const int nrow = fact->nrow; for (i = 1; i <= nrow; ++i) { nz = hinrow[i]; if (0 < nz) { /* save the last column entry of row i in hinrow */ /* and replace that entry with -i */ k = mrstrt[i] + nz - 1; hinrow[i] = hcoli[k]; hcoli[k] = -i; } } kstart = 0; kold = 0; for (k = 1; k <= xnewro; ++k) { if (hcoli[k] != 0) { ++kstart; /* if this is the last entry for the row... */ if (hcoli[k] < 0) { /* restore the entry */ i = -hcoli[k]; hcoli[k] = hinrow[i]; /* update mrstart and hinrow */ mrstrt[i] = kold + 1; hinrow[i] = kstart - kold; kold = kstart; } hcoli[kstart] = hcoli[k]; } } /* INSERTED INCASE CALLED FROM YTRIAN JJHF */ mrstrt[nrow + 1] = kstart + 1; return (kstart); } /* c_ekkclco */ #undef MACTION_T #define COIN_OSL_CMFC #define MACTION_T short int int c_ekkcmfc(EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, EKKHlink *mwork, void *maction_void, int nnetas, int *nsingp, int *xrejctp, int *xnewrop, int xnewco, int *ncompactionsp) #include "CoinOslC.h" #undef COIN_OSL_CMFC #undef MACTION_T static int c_ekkidmx(int n, const double *dx) { int ret_val; int i; double dmax; --dx; /* Function Body */ if (n < 1) { return (0); } if (n == 1) { return (1); } ret_val = 1; dmax = fabs(dx[1]); for (i = 2; i <= n; ++i) { if (fabs(dx[i]) > dmax) { ret_val = i; dmax = fabs(dx[i]); } } return ret_val; } /* c_ekkidmx */ /* Return codes in IRTCOD/IRTCOD are */ /* 4: numerical problems */ /* 5: not enough space in row file */ /* 6: not enough space in column file */ int c_ekkcmfd(EKKfactinfo *fact, int *mcol, EKKHlink *rlink, EKKHlink *clink, int *maction, int nnetas, int *nnentlp, int *nnentup, int *nsingp) { int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; int nnentl = *nnentlp; int nnentu = *nnentup; int storeZero = fact->ndenuc; int mkrs[8]; double dpivyy[8]; /* Local variables */ int i, j; double d0, dx; int nz, ndo, krs; int kend, jcol; int irow, iput, jrow, krxs; int mjcol[8]; double pivot; int count; int ilast, isort; double dpivx, dsave; double dpivxx[8]; double multip; int lstart, ndense, krlast, kcount, idense, ipivot, jdense, kchunk, jpivot; const int nrow = fact->nrow; int irtcod = 0; lstart = nnetas - nnentl + 1; /* put list of columns in last HROWI */ /* fix row order once for all */ ndense = nrow - fact->npivots; iput = ndense + 1; for (i = 1; i <= nrow; ++i) { if (hpivro[i] > 0) { irow = hpivro[i]; for (j = 1; j <= nrow; ++j) { --iput; maction[iput] = irow; irow = rlink[irow].suc; if (irow == 0) { break; } } } } if (iput != 1) { ++(*nsingp); } else { /* Use HCOLI just for last row */ ilast = maction[1]; krlast = mrstrt[ilast]; /* put list of columns in last HCOLI */ iput = 0; for (i = 1; i <= nrow; ++i) { if (clink[i].pre >= 0) { hcoli[krlast + iput] = i; ++iput; } } if (iput != ndense) { ++(*nsingp); } else { ndo = ndense / 8; /* do most */ for (kcount = 1; kcount <= ndo; ++kcount) { idense = ndense; isort = 8; for (count = ndense; count >= ndense - 7; --count) { ipivot = maction[count]; krs = mrstrt[ipivot]; --isort; mkrs[isort] = krs; } isort = 8; for (count = ndense; count >= ndense - 7; --count) { /* Find a pivot element */ --isort; ipivot = maction[count]; krs = mkrs[isort]; jcol = c_ekkidmx(idense, &dluval[krs]) - 1; pivot = dluval[krs + jcol]; --idense; mcol[count] = jcol; mjcol[isort] = mcol[count]; dluval[krs + jcol] = dluval[krs + idense]; if (fabs(pivot) < fact->zeroTolerance) { pivot = 0.; dpivx = 0.; } else { dpivx = 1. / pivot; } dluval[krs + idense] = pivot; dpivxx[isort] = dpivx; for (j = isort - 1; j >= 0; --j) { krxs = mkrs[j]; multip = -dluval[krxs + jcol] * dpivx; dluval[krxs + jcol] = dluval[krxs + idense]; /* for moment skip if zero */ if (fabs(multip) > fact->zeroTolerance) { for (i = 0; i < idense; ++i) { dluval[krxs + i] += multip * dluval[krs + i]; } } else { multip = 0.; } dluval[krxs + idense] = multip; } } /* sort all U in rows already done */ for (i = 7; i >= 0; --i) { /* **** this is important bit */ krs = mkrs[i]; for (j = i - 1; j >= 0; --j) { jcol = mjcol[j]; dsave = dluval[krs + jcol]; dluval[krs + jcol] = dluval[krs + idense + j]; dluval[krs + idense + j] = dsave; } } /* leave IDENSE as it is */ if (ndense <= 400) { for (jrow = ndense - 8; jrow >= 1; --jrow) { irow = maction[jrow]; krxs = mrstrt[irow]; for (j = 7; j >= 0; --j) { jcol = mjcol[j]; dsave = dluval[krxs + jcol]; dluval[krxs + jcol] = dluval[krxs + idense + j]; dluval[krxs + idense + j] = dsave; } for (j = 7; j >= 0; --j) { krs = mkrs[j]; jdense = idense + j; dpivx = dpivxx[j]; multip = -dluval[krxs + jdense] * dpivx; if (fabs(multip) <= fact->zeroTolerance) { multip = 0.; } dpivyy[j] = multip; dluval[krxs + jdense] = multip; for (i = idense; i < jdense; ++i) { dluval[krxs + i] += multip * dluval[krs + i]; } } for (i = 0; i < idense; ++i) { dx = dluval[krxs + i]; d0 = dpivyy[0] * dluval[mkrs[0] + i]; dx += dpivyy[1] * dluval[mkrs[1] + i]; d0 += dpivyy[2] * dluval[mkrs[2] + i]; dx += dpivyy[3] * dluval[mkrs[3] + i]; d0 += dpivyy[4] * dluval[mkrs[4] + i]; dx += dpivyy[5] * dluval[mkrs[5] + i]; d0 += dpivyy[6] * dluval[mkrs[6] + i]; dx += dpivyy[7] * dluval[mkrs[7] + i]; dluval[krxs + i] = d0 + dx; } } } else { for (jrow = ndense - 8; jrow >= 1; --jrow) { irow = maction[jrow]; krxs = mrstrt[irow]; for (j = 7; j >= 0; --j) { jcol = mjcol[j]; dsave = dluval[krxs + jcol]; dluval[krxs + jcol] = dluval[krxs + idense + j]; dluval[krxs + idense + j] = dsave; } for (j = 7; j >= 0; --j) { krs = mkrs[j]; jdense = idense + j; dpivx = dpivxx[j]; multip = -dluval[krxs + jdense] * dpivx; if (fabs(multip) <= fact->zeroTolerance) { multip = 0.; } dluval[krxs + jdense] = multip; for (i = idense; i < jdense; ++i) { dluval[krxs + i] += multip * dluval[krs + i]; } } } for (kchunk = 0; kchunk < idense; kchunk += 400) { kend = CoinMin(idense - 1, kchunk + 399); for (jrow = ndense - 8; jrow >= 1; --jrow) { irow = maction[jrow]; krxs = mrstrt[irow]; for (j = 7; j >= 0; --j) { dpivyy[j] = dluval[krxs + idense + j]; } for (i = kchunk; i <= kend; ++i) { dx = dluval[krxs + i]; d0 = dpivyy[0] * dluval[mkrs[0] + i]; dx += dpivyy[1] * dluval[mkrs[1] + i]; d0 += dpivyy[2] * dluval[mkrs[2] + i]; dx += dpivyy[3] * dluval[mkrs[3] + i]; d0 += dpivyy[4] * dluval[mkrs[4] + i]; dx += dpivyy[5] * dluval[mkrs[5] + i]; d0 += dpivyy[6] * dluval[mkrs[6] + i]; dx += dpivyy[7] * dluval[mkrs[7] + i]; dluval[krxs + i] = d0 + dx; } } } } /* resort all U in rows already done */ for (i = 7; i >= 0; --i) { krs = mkrs[i]; for (j = 0; j < i; ++j) { jcol = mjcol[j]; dsave = dluval[krs + jcol]; dluval[krs + jcol] = dluval[krs + idense + j]; dluval[krs + idense + j] = dsave; } } ndense += -8; } idense = ndense; /* do remainder */ for (count = ndense; count >= 1; --count) { /* Find a pivot element */ ipivot = maction[count]; krs = mrstrt[ipivot]; jcol = c_ekkidmx(idense, &dluval[krs]) - 1; pivot = dluval[krs + jcol]; --idense; mcol[count] = jcol; dluval[krs + jcol] = dluval[krs + idense]; if (fabs(pivot) < fact->zeroTolerance) { dluval[krs + idense] = 0.; } else { dpivx = 1. / pivot; dluval[krs + idense] = pivot; for (jrow = idense; jrow >= 1; --jrow) { irow = maction[jrow]; krxs = mrstrt[irow]; multip = -dluval[krxs + jcol] * dpivx; dluval[krxs + jcol] = dluval[krxs + idense]; /* for moment skip if zero */ if (fabs(multip) > fact->zeroTolerance) { dluval[krxs + idense] = multip; for (i = 0; i < idense; ++i) { dluval[krxs + i] += multip * dluval[krs + i]; } } else { dluval[krxs + idense] = 0.; } } } } /* now create in form for OSL */ ndense = nrow - fact->npivots; idense = ndense; for (count = ndense; count >= 1; --count) { /* Find a pivot element */ ipivot = maction[count]; krs = mrstrt[ipivot]; --idense; jcol = mcol[count]; jpivot = hcoli[krlast + jcol]; ++fact->npivots; pivot = dluval[krs + idense]; if (pivot == 0.) { hinrow[ipivot] = 0; rlink[ipivot].pre = -nrow - 1; ++(*nsingp); irtcod = 10; } else { rlink[ipivot].pre = -fact->npivots; clink[jpivot].pre = -fact->npivots; hincol[jpivot] = 0; ++fact->xnetal; mcstrt[fact->xnetal] = lstart - 1; hpivco[fact->xnetal] = ipivot; for (jrow = idense; jrow >= 1; --jrow) { irow = maction[jrow]; krxs = mrstrt[irow]; multip = dluval[krxs + idense]; /* for moment skip if zero */ if (multip != 0.||storeZero) { /* Store elementary row transformation */ ++nnentl; --nnentu; --lstart; dluval[lstart] = multip; hrowi[lstart] = SHIFT_INDEX(irow); } } hcoli[krlast + jcol] = hcoli[krlast + idense]; /* update pivot row and last row HCOLI */ dluval[krs + idense] = dluval[krs]; hcoli[krlast + idense] = hcoli[krlast]; nz = 1; dluval[krs] = pivot; hcoli[krs] = jpivot; if (!storeZero) { for (i = 1; i <= idense; ++i) { if (fabs(dluval[krs + i]) > fact->zeroTolerance) { ++nz; hcoli[krs + nz - 1] = hcoli[krlast + i]; dluval[krs + nz - 1] = dluval[krs + i]; } } hinrow[ipivot] = nz; } else { for (i = 1; i <= idense; ++i) { ++nz; hcoli[krs + nz - 1] = hcoli[krlast + i]; dluval[krs + nz - 1] = dluval[krs + i]; } hinrow[ipivot] = nz; } } } } } *nnentlp = nnentl; *nnentup = nnentu; return (irtcod); } /* c_ekkcmfd */ /* ***C_EKKCMFC */ /* * Generate a variant of c_ekkcmfc that uses an maction array of type * int rather than short. */ #undef MACTION_T #define C_EKKCMFY #define COIN_OSL_CMFC #define MACTION_T int int c_ekkcmfy(EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, EKKHlink *mwork, void *maction_void, int nnetas, int *nsingp, int *xrejctp, int *xnewrop, int xnewco, int *ncompactionsp) #include "CoinOslC.h" #undef COIN_OSL_CMFC #undef C_EKKCMFY #undef MACTION_T int c_ekkford(const EKKfactinfo *fact,const int *hinrow, const int *hincol, int *hpivro, int *hpivco, EKKHlink *rlink, EKKHlink *clink) { int i, iri, nzi; const int nrow = fact->nrow; int nsing = 0; /* Uwe H. Suhl, August 1986 */ /* Builds linked lists of rows and cols of nucleus for efficient */ /* pivot searching. */ memset(hpivro+1,0,nrow*sizeof(int)); memset(hpivco+1,0,nrow*sizeof(int)); for (i = 1; i <= nrow; ++i) { //hpivro[i] = 0; //hpivco[i] = 0; assert(rlink[i].suc == 0); assert(clink[i].suc == 0); } /* Generate double linked list of rows having equal numbers of */ /* nonzeros in each row. Skip pivotal rows. */ for (i = 1; i <= nrow; ++i) { if (! (rlink[i].pre < 0)) { nzi = hinrow[i]; if (nzi <= 0) { ++nsing; rlink[i].pre = -nrow - 1; } else { iri = hpivro[nzi]; hpivro[nzi] = i; rlink[i].suc = iri; rlink[i].pre = 0; if (iri != 0) { rlink[iri].pre = i; } } } } /* Generate double linked list of cols having equal numbers of */ /* nonzeros in each col. Skip pivotal cols. */ for (i = 1; i <= nrow; ++i) { if (! (clink[i].pre < 0)) { nzi = hincol[i]; if (nzi <= 0) { ++nsing; clink[i].pre = -nrow - 1; } else { iri = hpivco[nzi]; hpivco[nzi] = i; clink[i].suc = iri; clink[i].pre = 0; if (iri != 0) { clink[iri].pre = i; } } } } return (nsing); } /* c_ekkford */ /* c version of OSL from 36100 */ /* Assumes that a basis exists in correct form */ /* Calls Uwe's routines (approximately) */ /* Then if OK shuffles U into column order */ /* Return codes: */ /* 0: everything ok */ /* 1: everything ok but performance would be better if more space */ /* would be make available */ /* 4: growth rate of element in U too big */ /* 5: not enough space in row file */ /* 6: not enough space in column file */ /* 7: pivot too small - col sing */ /* 8: pivot too small - row sing */ /* 10: matrix is singular */ /* I suspect c_ekklfct never returns 1 */ /* * layout of data * * dluval/hcoli: (L^-1)B - hole - L factors * * The L factors are written from high to low, starting from nnetas. * There are nnentl factors in L. lstart the next entry to use for the * L factors. Eventually, (L^-1)B turns into U. * The ninbas coefficients of matrix B are originally in the start of * dluval/hcoli. As L transforms it, rows may have to be expanded. * If there is room, they are copied to the start of the hole, * otherwise the first part of this area is compacted, and hopefully * there is then room. * There are nnentu coefficients in (L^-1)B. * nnentu + nnentl >= ninbas. * nnentu + nnentl == ninbas if there has been no fill-in. * nnentu is decreased when the pivot eliminates elements * (in which case there is a corresponding increase in nnentl), * and if pivoting happens to cancel out factors (in which case * there is no corresponding increase in L). * nnentu is increased if there is fill-in (no decrease in L). * If nnentu + nnentl >= nnetas, then we've run out of room. * It is not the case that the elements of (L^-1)B are all in the * first nnentu positions of dluval/hcoli, but that is of course * the lower bound on the number of positions needed to store it. * nuspik is roughly the sum of the row lengths of the rows that were pivoted * out. singleton rows in c_ekktria do not change nuspik, but * c_ekkrsin does increment it for each singleton row. * That is, there are nuspik elements that in the upper part of (L^-1)B, * and (nnentu - nuspik) elements left in B. */ /* * As part of factorization, we test candidate pivots for numerical * stability; if the largest element in a row/col is much larger than * the smallest, this generally causes problems. To easily determine * what the largest element is, we ensure that it is always in front. * This establishes this property; later on we take steps to preserve it. */ static void c_ekkmltf(const EKKfactinfo *fact,double *dluval, int *hcoli, const int *mrstrt, const int *hinrow, const EKKHlink *rlink) { #if 0 int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif int i, j, k; int koff=-1; const int nrow = fact->nrow; for (i = 1; i <= nrow; ++i) { /* ignore rows that have already been pivoted */ /* if it is a singleton row, the property trivially holds */ if (! (rlink[i].pre < 0 || hinrow[i] <= 1)) { const int krs = mrstrt[i]; const int kre = krs + hinrow[i] - 1; double maxaij = 0.f; /* this assumes that at least one of the dluvals is non-zero. */ for (k = krs; k <= kre; ++k) { if (! (fabs(dluval[k]) <= maxaij)) { maxaij = fabs(dluval[k]); koff = k; } } assert (koff>0); maxaij = dluval[koff]; j = hcoli[koff]; dluval[koff] = dluval[krs]; hcoli[koff] = hcoli[krs]; dluval[krs] = maxaij; hcoli[krs] = j; } } } /* c_ekkmltf */ int c_ekklfct( register EKKfactinfo *fact) { const int nrow = fact->nrow; int ninbas = fact->xcsadr[nrow+1]-1; int ifvsol = fact->ifvsol; int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; EKKHlink *rlink = fact->kp1adr; EKKHlink *clink = fact->kp2adr; EKKHlink *mwork = (reinterpret_cast(fact->kw1adr))-1; int nsing, kdnspt, xnewro, xnewco; int i; int xrejct; int irtcod; const int nnetas = fact->nnetas; int ncompactions; double save_drtpiv = fact->drtpiv; double save_zpivlu = fact->zpivlu; if (ifvsol > 0 && fact->invok < 0) { fact->zpivlu = CoinMin(0.9, fact->zpivlu * 10.); fact->drtpiv=1.0e-8; } rlink --; clink --; /* Function Body */ hcoli[nnetas] = 1; hrowi[nnetas] = 1; dluval[nnetas] = 0.0; /* set amount of work */ xrejct = 0; nsing = 0; kdnspt = nnetas + 1; fact->ndenuc = 0; /* Triangularize */ irtcod = c_ekktria(fact,rlink,clink, &nsing, &xnewco, &xnewro, &ncompactions, ninbas); fact->nnentl = ninbas - fact->nnentu; if (irtcod < 0) { /* no space or system error */ goto L8000; } if (irtcod != 0 && fact->invok >= 0) { goto L8500; /* 7 or 8 - pivot too small */ } #if 0 /* is this necessary ? */ lstart = nnetas - fact->nnentl + 1; for (i = lstart; i <= nnetas; ++i) { hrowi[i] = (hcoli[i] << 3); } #endif /* See if finished */ if (! (fact->npivots >= nrow)) { int nsing1; /* No - do nucleus */ nsing1 = c_ekkford(fact,hinrow, hincol, hpivro, hpivco, rlink, clink); nsing+= nsing1; if (nsing1 != 0 && fact->invok >= 0) { irtcod=7; goto L8500; } c_ekkmltf(fact,dluval, hcoli, mrstrt, hinrow, rlink); { bool callcmfy = false; if (nrow > 32767) { int count = 0; for (i = 1; i <= nrow; ++i) { count = CoinMax(count,hinrow[i]); } if (count + nrow - fact->npivots > 32767) { /* will have to use I*4 version of CMFC */ /* no changes to pointer params */ callcmfy = true; } } irtcod = (callcmfy ? c_ekkcmfy : c_ekkcmfc) (fact, rlink, clink, mwork, &mwork[nrow + 1], nnetas, &nsing, &xrejct, &xnewro, xnewco, &ncompactions); /* irtcod one of 0,-5,7,10 */ } if (irtcod < 0) { goto L8000; } kdnspt = nnetas - fact->nnentl; } /* return if error */ if (nsing > 0 || irtcod == 10) { irtcod = 99; } /* irtcod one of 0,7,99 */ if (irtcod != 0) { goto L8500; } ++fact->xnetal; mcstrt[fact->xnetal] = nnetas - fact->nnentl; /* give message if tight on memory */ if (ncompactions > 2 ) { if (1) { int etasize =CoinMax(4*fact->nnentu+(nnetas-fact->nnentl)+1000,fact->eta_size); fact->eta_size=CoinMin(static_cast(1.2*fact->eta_size),etasize); if (fact->maxNNetas>0&&fact->eta_size> fact->maxNNetas) { fact->eta_size=fact->maxNNetas; } } /* endif */ } /* Shuffle U and multiply L by 8 (if assembler) */ { int jrtcod = c_ekkshff(fact, clink, rlink, xnewro); /* nR_etas is the number of R transforms; * it is incremented only in c_ekketsj. */ fact->nR_etas = 0; /*fact->R_etas_start = mcstrt+nrow+fact->nnentl+3;*/ fact->R_etas_start[1] = /*kdnspt - 1*/0; /* magic */ fact->R_etas_index = &fact->xeradr[kdnspt - 1]; fact->R_etas_element = &fact->xeeadr[kdnspt - 1]; if (jrtcod != 0) { irtcod = jrtcod; /* irtcod == 2 */ } } goto L8500; /* Fatal error */ L8000: if (1) { if (fact->maxNNetas != fact->eta_size && nnetas) { /* return and get more space */ /* double eta_size, unless that exceeds max (if there is one) */ fact->eta_size = fact->eta_size<<1; if (fact->maxNNetas > 0 && fact->eta_size > fact->maxNNetas) { fact->eta_size = fact->maxNNetas; } return (5); } } /*c_ekkmesg_no_i1(121, -irtcod);*/ irtcod = 3; L8500: /* restore pivot tolerance */ fact->drtpiv=save_drtpiv; fact->zpivlu=save_zpivlu; #ifndef NDEBUG if (fact->rows_ok) { int * hinrow=fact->xrnadr; if (!fact->xe2adr) { for (int i=1;i<=fact->nrow;i++) { assert (hinrow[i]>=0&&hinrow[i]<=fact->nrow); } } } #endif return (irtcod); } /* c_ekklfct */ /* summary of return codes c_ekktria: 7 small pivot -5 no memory c_ekkcsin: returns true if small pivot c_ekkrsin: -5 no memory 7 small pivot c_ekkfpvt: 10: no pivots found (singular) c_ekkcmfd: 10: zero pivot (not just small) c_ekkcmfc: -5: no memory any non-zero code from c_ekkcsin, c_ekkrsin, c_ekkfpvt, c_ekkprpv, c_ekkcmfd c_ekkshff: 2: singular c_ekklfct: any positive code from c_ekktria, c_ekkcmfc, c_ekkshff (2,7,10) *except* 10, which is changed to 99. all negative return codes are changed to 5 or 3 (5 == ran out of memory but could get more, 3 == ran out of memory, no luck) so: 2,3,5,7,99 c_ekklfct1: 1: c_ekksmem_invert failed 2: c_ekkslcf/c_ekkslct ran out of room any return code from c_ekklfct, except 2 and 5 */ void c_ekkrowq(int *hrow, int *hcol, double *dels, int *mrstrt, const int *hinrow, int nnrow, int ninbas) { int i, k, iak, jak; double daik; int iloc; double dsave; int isave, jsave; /* Order matrix rowwise using MRSTRT, DELS, HCOL */ k = 1; /* POSITION AFTER END OF ROW */ for (i = 1; i <= nnrow; ++i) { k += hinrow[i]; mrstrt[i] = k; } for (k = ninbas; k >= 1; --k) { iak = hrow[k]; if (iak != 0) { daik = dels[k]; jak = hcol[k]; hrow[k] = 0; while (1) { --mrstrt[iak]; iloc = mrstrt[iak]; dsave = dels[iloc]; isave = hrow[iloc]; jsave = hcol[iloc]; dels[iloc] = daik; hrow[iloc] = 0; hcol[iloc] = jak; if (isave == 0) break; daik = dsave; iak = isave; jak = jsave; } } } } /* c_ekkrowq */ int c_ekkrwco(const EKKfactinfo *fact,double *dluval, int *hcoli, int *mrstrt, int *hinrow, int xnewro) { int i, k, nz, kold; int kstart; const int nrow = fact->nrow; for (i = 1; i <= nrow; ++i) { nz = hinrow[i]; if (0 < nz) { /* save the last column entry of row i in hinrow */ /* and replace that entry with -i */ k = mrstrt[i] + nz - 1; hinrow[i] = hcoli[k]; hcoli[k] = -i; } } kstart = 0; kold = 0; for (k = 1; k <= xnewro; ++k) { if (hcoli[k] != 0) { ++kstart; /* if this is the last entry for the row... */ if (hcoli[k] < 0) { /* restore the entry */ i = -hcoli[k]; hcoli[k] = hinrow[i]; /* update mrstart and hinrow */ /* ACTUALLY, hinrow should already be accurate */ mrstrt[i] = kold + 1; hinrow[i] = kstart - kold; kold = kstart; } /* move the entry */ dluval[kstart] = dluval[k]; hcoli[kstart] = hcoli[k]; } } return (kstart); } /* c_ekkrwco */ int c_ekkrwcs(const EKKfactinfo *fact,double *dluval, int *hcoli, int *mrstrt, const int *hinrow, const EKKHlink *mwork, int nfirst) { #if 0 int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif int i, k, k1, k2, nz; int irow, iput; const int nrow = fact->nrow; /* Compress row file */ iput = 1; irow = nfirst; for (i = 1; i <= nrow; ++i) { nz = hinrow[irow]; k1 = mrstrt[irow]; if (k1 != iput) { mrstrt[irow] = iput; k2 = k1 + nz - 1; for (k = k1; k <= k2; ++k) { dluval[iput] = dluval[k]; hcoli[iput] = hcoli[k]; ++iput; } } else { iput += nz; } irow = mwork[irow].suc; } return (iput); } /* c_ekkrwcs */ void c_ekkrwct(const EKKfactinfo *fact,double *dluval, int *hcoli, int *mrstrt, const int *hinrow, const EKKHlink *mwork, const EKKHlink *rlink, const short *msort, double *dsort, int nlast, int xnewro) { #if 0 int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif int i, k, k1, nz, icol; int kmax; int irow, iput; int ilook; const int nrow = fact->nrow; iput = xnewro; irow = nlast; kmax = nrow - fact->npivots; for (i = 1; i <= nrow; ++i) { nz = hinrow[irow]; k1 = mrstrt[irow] - 1; if (rlink[irow].pre < 0) { /* pivoted on already */ iput -= nz; if (k1 != iput) { mrstrt[irow] = iput + 1; for (k = nz; k >= 1; --k) { dluval[iput + k] = dluval[k1 + k]; hcoli[iput + k] = hcoli[k1 + k]; } } } else { /* not pivoted - going dense */ iput -= kmax; mrstrt[irow] = iput + 1; c_ekkdzero( kmax, &dsort[1]); for (k = 1; k <= nz; ++k) { icol = hcoli[k1 + k]; ilook = msort[icol]; dsort[ilook] = dluval[k1 + k]; } c_ekkdcpy(kmax, (dsort+1), (dluval+iput + 1)); } irow = mwork[irow].pre; } } /* c_ekkrwct */ /* takes Uwe's modern structures and puts them back 20 years */ int c_ekkshff(EKKfactinfo *fact, EKKHlink *clink, EKKHlink *rlink, int xnewro) { int *hpivro = fact->krpadr; int i, j; int nbas, icol; int ipiv; const int nrow = fact->nrow; int nsing; for (i = 1; i <= nrow; ++i) { j = -rlink[i].pre; rlink[i].pre = j; if (j > 0 && j <= nrow) { hpivro[j] = i; } j = -clink[i].pre; clink[i].pre = j; } /* hpivro[j] is now (hopefully) the row that was pivoted on step j */ /* rlink[i].pre is the step in which row i was pivoted */ nbas = 0; nsing = 0; /* Decide if permutation wanted */ fact->first_dense=nrow-fact->ndenuc+1+1; fact->last_dense=nrow; /* rlink[].suc is dead at this point */ /* * replace the the basis index * with the pivot (or permuted) index generated by factorization. * This eventually goes into mpermu. */ for (icol = 1; icol <= nrow; ++icol) { int ibasis = icol; ipiv = clink[ibasis].pre; if (0 < ipiv && ipiv <= nrow) { rlink[ibasis].suc = ipiv; ++nbas; } } nsing = nrow - nbas; if (nsing > 0) { abort(); } /* if we reach here, then rlink[1..nrow].suc == clink[1..nrow].pre */ /* switch off sparse update if any dense section */ { const int notMuchRoom = (fact->nnentu + xnewro + 10 > fact->nnetas - fact->nnentl); /* must be same as in c_ekkshfv */ if (fact->ndenuc || notMuchRoom||nrowif_sparse_update) { printf("**** Switching off sparse update - dense - c_ekkshff\n"); } #endif fact->if_sparse_update=0; } } /* hpivro[1..nrow] is not read by c_ekkshfv */ c_ekkshfv(fact, rlink, clink, xnewro); return (0); } /* c_ekkshff */ /* sorts on indices dragging elements with */ static void c_ekk_sort2(int * key , double * array2,int number) { int minsize=10; int n = number; int sp; int *v = key; int *m, t; int * ls[32] , * rs[32]; int *l , *r , c; double it; int j; /*check already sorted */ #ifndef LONG_MAX #define LONG_MAX 0x7fffffff; #endif int last=-LONG_MAX; for (j=0;j=last) { last=key[j]; } else { break; } /* endif */ } /* endfor */ if (j==number) { return; } /* endif */ sp = 0 ; ls[sp] = v ; rs[sp] = v + (n-1) ; while( sp >= 0 ) { if ( rs[sp] - ls[sp] > minsize ) { l = ls[sp] ; r = rs[sp] ; m = l + (r-l)/2 ; if ( *l > *m ) { t = *l ; *l = *m ; *m = t ; it = array2[l-v] ; array2[l-v] = array2[m-v] ; array2[m-v] = it ; } if ( *m > *r ) { t = *m ; *m = *r ; *r = t ; it = array2[m-v] ; array2[m-v] = array2[r-v] ; array2[r-v] = it ; if ( *l > *m ) { t = *l ; *l = *m ; *m = t ; it = array2[l-v] ; array2[l-v] = array2[m-v] ; array2[m-v] = it ; } } c = *m ; while ( r - l > 1 ) { while ( *(++l) < c ) ; while ( *(--r) > c ) ; t = *l ; *l = *r ; *r = t ; it = array2[l-v] ; array2[l-v] = array2[r-v] ; array2[r-v] = it ; } l = r - 1 ; if ( l < m ) { ls[sp+1] = ls[sp] ; rs[sp+1] = l ; ls[sp ] = r ; } else { ls[sp+1] = r ; rs[sp+1] = rs[sp] ; rs[sp ] = l ; } sp++ ; } else sp-- ; } for ( l = v , m = v + (n-1) ; l < m ; l++ ) { if ( *l > *(l+1) ) { c = *(l+1) ; it = array2[(l-v)+1] ; for ( r = l ; r >= v && *r > c ; r-- ) { *(r+1) = *r ; array2[(r-v)+1] = array2[(r-v)] ; } *(r+1) = c ; array2[(r-v)+1] = it ; } } } /* For each row compute reciprocal of pivot element and take out of */ /* Also use HLINK(1 to permute column numbers */ /* and HPIVRO to permute row numbers */ /* Sort into column order as was stored by row */ /* If Assembler then shift row numbers in L by 3 */ /* Put column numbers in U for L-U update */ /* and multiply U elements by - reciprocal of pivot element */ /* and set up backward pointers for pivot rows */ void c_ekkshfv(EKKfactinfo *fact, EKKHlink *rlink, EKKHlink *clink, int xnewro) { int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; double *dpermu = fact->kadrpm; double * de2val = fact->xe2adr ? fact->xe2adr-1: 0; int nnentu = fact->nnentu; int xnetal = fact->xnetal; int numberSlacks; /* numberSlacks not read */ int i, j, k, kk, nel; int nroom; bool need_more_space; int ndenuc=fact->ndenuc; int if_sparse_update=fact->if_sparse_update; int nnentl = fact->nnentl; int nnetas = fact->nnetas; int *ihlink = (reinterpret_cast (clink))+1; /* can't use rlink for simple loop below */ const int nrow = fact->nrow; const int maxinv = fact->maxinv; /* this is not just a temporary - c_ekkbtrn etc use this */ int *mpermu = (reinterpret_cast (dpermu+nrow))+1; int * temp = ihlink+nrow; int * temp2 = temp+nrow; const int notMuchRoom = (nnentu + xnewro + 10 > nnetas - nnentl); /* compress hlink and make simpler */ for (i = 1; i <= nrow; ++i) { mpermu[i] = rlink[i].pre; ihlink[i] = rlink[i].suc; } /* mpermu[i] == the step in which row i was pivoted */ /* ihlink[i] == the step in which col i was pivoted */ /* must be same as in c_ekkshff */ if (fact->ndenuc||notMuchRoom||nroweta_size=static_cast(1.05*fact->eta_size); /* eta_size can be no larger than maxNNetas */ if (fact->maxNNetas > 0 && fact->eta_size > fact->maxNNetas) { fact->eta_size=fact->maxNNetas; } } /* endif */ /* For each row compute reciprocal of pivot element and take out of U */ /* Also use ihlink to permute column numbers */ /* the rows are not stored compactly or in order, * so we have to find out where the last one is stored */ ninbas=0; for (i = 1; i <= nrow; ++i) { int jpiv=mpermu[i]; int nin=hinrow[i]; int krs = mrstrt[i]; int kre = krs + nin; temp[jpiv]=krs; temp2[jpiv]=nin; ninbas = CoinMax(kre, ninbas); /* c_ekktria etc ensure that the first row entry is the pivot */ dvalpv[jpiv] = 1. / dluval[krs]; hcoli[krs] = 0; /* probably needed for c_ekkrowq */ /* room for the pivot has already been allocated, so hincol ok */ for (kk = krs + 1; kk < kre; ++kk) { int j = ihlink[hcoli[kk]]; hcoli[kk] = j; /* permute the col index */ hrowi[kk] = jpiv; /* permute the row index */ ++hincol[j]; } } /* temp [mpermu[i]] == mrstrt[i] */ /* temp2[mpermu[i]] == hinrow[i] */ ninbas--; /* ???? */ c_ekkscpy(nrow, &temp[1], &mrstrt[1]); c_ekkscpy(nrow, &temp2[1], &hinrow[1]); /* now mrstrt, hinrow, hcoli and hrowi have been permuted */ /* Sort into column order as was stored by row */ /* There will be an empty entry in front of each each column, * because we initialized hincol to 1s, and c_ekkrowq fills in * entries from the back */ c_ekkrowq(hcoli, hrowi, dluval, mcstrt, hincol, nrow, ninbas); /* The shuffle zeroed out column pointers */ /* Put them back for L-U update */ /* Also multiply U elements by - reciprocal of pivot element */ /* Also decrement mcstrt/hincol to give "real" sizes */ for (i = 1; i <= nrow; ++i) { int kx = --mcstrt[i]; nel = --hincol[i]; hrowi[kx] = nel; dluval[kx] = dvalpv[i]; #ifndef NO_SHIFT for (int j=kx+1;j<=kx+nel;j++) hrowi[j] = SHIFT_INDEX(hrowi[j]); #endif } /* sort dense part */ for (i=nrow-ndenuc+1; i<=nrow; i++) { int kx = mcstrt[i]+1; /* "real" entries start after pivot */ int nel = hincol[i]; c_ekk_sort2(&hrowi[kx],&dluval[kx],nel); } /* Recompute number in U */ nnentu = mcstrt[nrow] + hincol[nrow]; mcstrt[nrow + 4] = nnentu + 1; /* magic - AND DEAD */ /* as not much room switch off fast etas */ mrstrt[1] = 0; /* magic */ fact->rows_ok = false; i = nrow + maxinv + 5; /* DEAD */ } else { /* *************************************** */ /* enough memory to do a bit faster */ /* For each row compute reciprocal of pivot element and */ /* take out of U */ /* Also use HLINK(1 to permute column numbers */ int ninbas=0; int ilast; /* last available entry */ int spareSpace; double * dluval2; /*int * hlink2 = ihlink+nrow; int * mrstrt2 = hlink2+nrow;*/ /* mwork has order of row copy */ EKKHlink *mwork = (reinterpret_cast(fact->kw1adr))-1; fact->rows_ok = true; if (if_sparse_update) { ilast=nnetas-nnentl; } else { /* missing out nnentl stuff */ ilast=nnetas; } spareSpace=ilast-nnentu; need_more_space=false; /* save clean row copy if enough room */ nroom = (spareSpace) / nrow; if (nrow<10000) { if (nroom < 10) { need_more_space=true; } } else { if (nroom < 5&&!if_sparse_update) { need_more_space=true; } } if (nroom > CoinMin(50,maxinv)) { need_more_space=false; } if (need_more_space) { if (if_sparse_update) { int i1=fact->eta_size+10*nrow; fact->eta_size=static_cast(1.2*fact->eta_size); if (i1>fact->eta_size) { fact->eta_size=i1; } } else { fact->eta_size=static_cast(1.05*fact->eta_size); } } else { if (nroom<11) { if (if_sparse_update) { int i1=fact->eta_size+(11-nroom)*nrow; fact->eta_size=static_cast(1.2*fact->eta_size); if (i1>fact->eta_size) { fact->eta_size=i1; } } } } if (fact->maxNNetas>0&&fact->eta_size> fact->maxNNetas) { fact->eta_size=fact->maxNNetas; } { /* we can swap de2val and dluval to save copying */ int * eta_last=mpermu+nrow*2+3; int * eta_next=eta_last+nrow+2; int last=0; eta_last[0]=-1; if (nnentl) { /* went into c_ekkcmfc - if not then in order */ int next; /*next=mwork[((nrow+1)<<1)+1];*/ next=mwork[nrow+1].pre; #ifdef DEBUG j=mrstrt[next]; #endif for (i = 1; i <= nrow; ++i) { int iperm=mpermu[next]; eta_next[last]=iperm; eta_last[iperm]=last; temp[iperm] = mrstrt[next]; temp2[iperm] = hinrow[next]; #ifdef DEBUG if (mrstrt[next]!=j) abort(); j=mrstrt[next]+hinrow[next]; #endif /*next= mwork[(next<<1)+2];*/ next= mwork[next].suc; last=iperm; } } else { #ifdef DEBUG j=0; #endif for (i = 1; i <= nrow; ++i) { int iperm=mpermu[i]; eta_next[last]=iperm; eta_last[iperm]=last; temp[iperm] = mrstrt[i]; temp2[iperm] = hinrow[i]; last=iperm; #ifdef DEBUG if (mrstrt[i]<=j) abort(); if (i>1&&mrstrt[i]!=j+hinrow[i-1]) abort(); j=mrstrt[i]; #endif } } eta_next[last]=nrow+1; eta_last[nrow+1]=last; eta_next[nrow+1]=nrow+2; c_ekkscpy(nrow, &temp[1], &mrstrt[1]); c_ekkscpy(nrow, &temp2[1], &hinrow[1]); i=eta_last[nrow+1]; ninbas=mrstrt[i]+hinrow[i]-1; #ifdef DEBUG if (spareSpace0; i--) { int krs = mrstrt[i]; int jpiv = hcoli[krs]; if (ihlink[jpiv]!=i) abort(); } #endif for (i = 1; i <= ninbas; ++i) { k = hcoli[i]; k = ihlink[k]; #ifdef DEBUG if (k<=0||k>nrow) abort(); #endif hcoli[i]=k; hincol[k]++; } #ifdef DEBUG for (i=nrow; i>0; i--) { int krs = mrstrt[i]; int jpiv = hcoli[krs]; if (jpiv!=i) abort(); if (krs>ninbas) abort(); } #endif /* Sort into column order as was stored by row */ k = 1; /* Position */ for (kk = 1; kk <= nrow; ++kk) { nel=hincol[kk]; mcstrt[kk] = k; hrowi[k]=nel-1; k += hincol[kk]; hincol[kk]=0; } if (de2val) { dluval2=de2val; } else { dluval2=dluval+ninbas; } nnentu = k-1; mcstrt[nrow + 4] = nnentu + 1; /* create column copy */ for (i=nrow; i>0; i--) { int krs = mrstrt[i]; int kre = krs + hinrow[i]; hinrow[i]--; mrstrt[i]++; { int kx = mcstrt[i]; /*nel = hincol[i]; if (hrowi[kx]!=nel) abort(); hrowi[kx] = nel-1;*/ dluval2[kx] = 1.0 /dluval[krs]; /*hincol[i]=0;*/ for (kk = krs + 1; kk < kre; ++kk) { int j = hcoli[kk]; int iput = hincol[j]+1; hincol[j]=iput; iput+= mcstrt[j]; hrowi[iput] = SHIFT_INDEX(i); dluval2[iput] = dluval[kk]; } } } if (de2val) { double * a=dluval; double * address; /* move first down */ i=eta_next[0]; { int krs=mrstrt[i]; nel=hinrow[i]; for (j=1;j<=nel;j++) { hcoli[j]=hcoli[j+krs-1]; dluval[j]=dluval[j+krs-1]; } } mrstrt[i]=1; /****** swap dluval and de2val !!!! ******/ /* should work even for dspace */ /* move L part across */ address=fact->xeeadr+1; fact->xeeadr=fact->xe2adr-1; fact->xe2adr=address; if (nnentl) { int n=xnetal-nrow-maxinv-5; int j1,j2; int * mcstrt2=mcstrt+nrow+maxinv+4; j2 = mcstrt2[1]; j1 = mcstrt2[n+1]+1; #if 0 memcpy(de2val+j1,dluval+j1,(j2-j1+1)*sizeof(double)); #else c_ekkdcpy(j2-j1+1, (dluval+j1),(de2val+j1)); #endif } dluval = de2val; de2val = a; } else { /* copy down dluval */ #if 0 memcpy(&dluval[1],&dluval2[1],ninbas*sizeof(double)); #else c_ekkdcpy(ninbas, (dluval2+1),(dluval+1)); #endif } /* sort dense part */ for (i=nrow-ndenuc+1;i<=nrow;i++) { int kx = mcstrt[i]+1; int nel = hincol[i]; c_ekk_sort2(&hrowi[kx],&dluval[kx],nel); } } mrstrt[nrow + 1] = ilast + 1; } /* Find first non slack */ for (i = 1; i <= nrow; ++i) { int kcs = mcstrt[i]; if (hincol[i] != 0 || dluval[kcs] != SLACK_VALUE) { break; } } numberSlacks = i - 1; { /* set slacks to 1 */ int * array = fact->krpadr + ( fact->nrowmx+2); int nSet = (numberSlacks)>>5; int n2 = (fact->nrowmx+32)>>5; int i; memset(array,0xff,nSet*sizeof(int)); memset(array+nSet,0,(n2-nSet)*sizeof(int)); for (i=nSet<<5;i<=numberSlacks;i++) c_ekk_Set(array,i); c_ekk_Unset(array,fact->nrow+1); /* make sure off end not slack */ #ifndef NDEBUG for (i=1;i<=numberSlacks;i++) assert (c_ekk_IsSet(array,i)); for (;i<=fact->nrow;i++) assert (!c_ekk_IsSet(array,i)); #endif } /* and set up backward pointers */ /* clean up HPIVCO for fancy assembler stuff */ /* xnetal was initialized to nrow + maxinv + 4 in c_ekktria, and grows */ c_ekkscpy_0_1(maxinv + 1, 1, &hpivco[nrow+4]); /* magic */ hpivco[xnetal] = 1; /* shuffle down for gaps so can get rid of hpivco for L */ { const int lstart = nrow + maxinv + 5; int n=xnetal-lstart ; /* number of L entries */ int add,iel; int * hpivco_L = &hpivco[lstart]; int * mcstrt_L = &mcstrt[lstart]; if (nnentl) { /* elements of L were stored in descending order in dluval/hcoli */ int kle = mcstrt_L[0]; int kls = mcstrt_L[n]+1; if(if_sparse_update) { int i2,iel; int * mrstrt2 = &mrstrt[nrow]; /* need row copy of L */ /* hpivro is spare for counts; just used as a temp buffer */ c_ekkizero( nrow, &hpivro[1]); /* permute L indices; count L row lengths */ for (iel = kls; iel <= kle; ++iel) { int jrow = mpermu[UNSHIFT_INDEX(hrowi[iel])]; hpivro[jrow]++; hrowi[iel] = SHIFT_INDEX(jrow); } { int ibase=nnetas-nnentl+1; int firstDoRow=0; for (i=1;i<=nrow;i++) { mrstrt2[i]=ibase; if (hpivro[i]&&!firstDoRow) { firstDoRow=i; } ibase+=hpivro[i]; hpivro[i]=mrstrt2[i]; } if (!firstDoRow) { firstDoRow=nrow+1; } mrstrt2[i]=ibase; fact->firstDoRow = firstDoRow; } i2=mcstrt_L[n]; for (i = n-1; i >= 0; --i) { int i1 = mcstrt_L[i]; int ipiv=hpivco_L[i]; ipiv=mpermu[ipiv]; hpivco_L[i]=ipiv; for (iel=i2 ; iel < i1; iel++) { int irow = UNSHIFT_INDEX(hrowi[iel+1]); int iput=hpivro[irow]; hpivro[irow]=iput+1; hcoli[iput]=ipiv; de2val[iput]=dluval[iel+1]; } i2=i1; } } else { /* just permute row numbers */ for (j = 0; j < n; ++j) { hpivco_L[j] = mpermu[hpivco_L[j]]; } for (iel = kls; iel <= kle; ++iel) { int jrow = mpermu[UNSHIFT_INDEX(hrowi[iel])]; hrowi[iel] = SHIFT_INDEX(jrow); } } add=hpivco_L[n-1]-hpivco_L[0]-n+1; if (add) { int i; int last = hpivco_L[n-1]; int laststart = mcstrt_L[n]; int base=hpivco_L[0]-1; /* adjust so numbers match */ mcstrt_L-=base; hpivco_L-=base; mcstrt_L[last]=laststart; for (i=n-1;i>=0;i--) { int ipiv=hpivco_L[i+base]; while (ipivlstart; //const int * COIN_RESTRICT hpivco = fact->kcpadr; fact->firstLRow = hpivco[lstart]; } fact->nnentu = nnentu; fact->xnetal = xnetal; /* now we have xnetal * we can set up pointers */ clp_setup_pointers(fact); /* this is the array used in c_ekkbtrn; it is passed to c_ekkbtju as hpivco. * this gets modified by F-T as we pivot columns in and out. */ { /* do new hpivco */ int * hpivco_new = fact->kcpadr+1; int * back = &fact->kcpadr[2*nrow+maxinv+4]; /* set zeroth to stop illegal read */ back[0]=1; hpivco_new[nrow+1]=nrow+1; /* deliberate loop for dense tests */ hpivco_new[0]=1; for (i=1;i<=nrow;i++) { hpivco_new[i]=i+1; back[i+1]=i; } back[1]=0; fact->first_dense = CoinMax(fact->first_dense,4); fact->numberSlacks=numberSlacks; fact->lastSlack=numberSlacks; fact->firstNonSlack=hpivco_new[numberSlacks]; } /* also zero out permute region and nonzero */ c_ekkdzero( nrow, (dpermu+1)); if (if_sparse_update) { char * nonzero = reinterpret_cast (&mpermu[nrow+1]); /* used in c_ekkbtrn */ /*c_ekkizero(nrow,(int *)nonzero);*/ c_ekkczero(nrow,nonzero); /*memset(nonzero,0,nrow*sizeof(int));*/ /* for faster method */ } for (i = 1; i <= nrow; ++i) { hpivro[mpermu[i]] = i; } } /* c_ekkshfv */ static void c_ekkclcp1(const int *hcol, const int * mrstrt, int *hrow, int *mcstrt, int *hincol, int nnrow, int nncol, int ninbas) { int i, j, kc, kr, kre, krs, icol; int iput; /* Create columnwise storage of row indices */ kc = 1; for (j = 1; j <= nncol; ++j) { mcstrt[j] = kc; kc += hincol[j]; hincol[j] = 0; } mcstrt[nncol + 1] = ninbas + 1; for (i = 1; i <= nnrow; ++i) { krs = mrstrt[i]; kre = mrstrt[i + 1] - 1; for (kr = krs; kr <= kre; ++kr) { icol = hcol[kr]; iput = hincol[icol]; hincol[icol] = iput + 1; iput += mcstrt[icol]; hrow[iput] = i; } } } /* c_ekkclcp */ inline void c_ekkclcp2(const int *hcol, const double *dels, const int * mrstrt, int *hrow, double *dels2, int *mcstrt, int *hincol, int nnrow, int nncol, int ninbas) { int i, j, kc, kr, kre, krs, icol; int iput; /* Create columnwise storage of row indices */ kc = 1; for (j = 1; j <= nncol; ++j) { mcstrt[j] = kc; kc += hincol[j]; hincol[j] = 0; } mcstrt[nncol + 1] = ninbas + 1; for (i = 1; i <= nnrow; ++i) { krs = mrstrt[i]; kre = mrstrt[i + 1] - 1; for (kr = krs; kr <= kre; ++kr) { icol = hcol[kr]; iput = hincol[icol]; hincol[icol] = iput + 1; iput += mcstrt[icol]; hrow[iput] = i; dels2[iput] = dels[kr]; } } } /* c_ekkclcp */ int c_ekkslcf( register const EKKfactinfo *fact) { int * hrow = fact->xeradr; int * hcol = fact->xecadr; double * dels = fact->xeeadr; int * hinrow = fact->xrnadr; int * hincol = fact->xcnadr; int * mrstrt = fact->xrsadr; int * mcstrt = fact->xcsadr; const int nrow = fact->nrow; int ninbas; /* space for etas */ const int nnetas = fact->nnetas; ninbas=mcstrt[nrow+1]-1; /* Now sort */ if (ninbas << 1 > nnetas) { /* Put it in row order */ int i,k; c_ekkrowq(hrow, hcol, dels, mrstrt, hinrow, nrow, ninbas); k = 1; for (i = 1; i <= nrow; ++i) { mrstrt[i] = k; k += hinrow[i]; } mrstrt[nrow + 1] = k; /* make a column copy without the extra values */ c_ekkclcp1(hcol, mrstrt, hrow, mcstrt, hincol, nrow, nrow, ninbas); } else { /* Move elements up memory */ c_ekkdcpy(ninbas, (dels+1), (dels+ninbas + 1)); /* make a row copy with the extra values */ c_ekkclcp2(hrow, &dels[ninbas], mcstrt, hcol, dels, mrstrt, hinrow, nrow, nrow, ninbas); } return (ninbas); } /* c_ekkslcf */ /* Uwe H. Suhl, September 1986 */ /* Removes lower and upper triangular factors from the matrix. */ /* Code for routine: 102 */ /* Return codes: */ /* 0: ok */ /* -5: not enough space in row file */ /* 7: pivot too small - col sing */ /* * This selects singleton columns and rows for the LU factorization. * Singleton columns require no * * (1) Note that columns are processed using a queue, not a stack; * this produces better pivots. * * (2) At most nrows elements are ever entered into the queue. * * (3) When pivoting singleton columns, every column that is part of * the pivot row is shortened by one, including the singleton column * itself; the hincol entries are updated appropriately. * Thus, pivoting on a singleton column may create other singleton columns * (but not singleton rows). * The dual property is true for rows. * * (4) Row entries (hrowi) are not changed when pivoting singleton columns. * Singleton columns that are created as a result of pivoting the * rows of other singleton columns will therefore have row entries * corresponding to those pivoted rows. Since we need to find the * row entry for the row being pivoted, we have to * search its row entries for the one whose hlink entry indicates * that it has not yet been pivoted. * * (9) As a result of pivoting columns, sections in hrowi corresponding to * pivoted columns are no longer needed, and entries in sections * for non-pivoted columns may have entries corresponding to pivoted rows. * This is why hrowi needs to be compacted. * * (5) When the row_pre and col_pre fields of the hlink struct contain * negative values, they indicate that the row has been pivoted, and * the negative of that value is the pivot order. * That is the only use for these fields in this routine. * * (6) This routine assumes that hlink is initialized to zeroes. * Under this assumption, the following is an invariant in this routine: * * (clink[i].pre < 0) ==> (hincol[i]==0) * * The converse is not true; see (15). * * The dual is also true, but only while pivoting singletong rows, * since we don't update hinrow while pivoting columns; * THESE VALUES ARE USED LATER, BUT I DON'T UNDERSTAND HOW YET. * * (7) hpivco is used for two purposes. The low end is used to implement the * queue when pivoting columns; the high end is used to hold eta-matrix * entries. * * (8) As a result of pivoting columns, for all i:1<=i<=nrow, either * hinrow[i] has not changed * or * hinrow[i] = 0 * This is another way of saying that pivoting singleton columns cannot * create singleton rows. * The dual holds for hincol after pivoting rows. * * (10) In constrast to (4), while pivoting rows we * do not let the hcoli get out-of-date. That is because as part of * the process of numerical pivoting we have to find the row entries * for all the rows in the pivot column, so we may as well keep the * entries up to date. This is done by moving the last column entry * for each row into the entry that was used for the pivot column. * * (11) When pivoting a column, we must find the pivot row entry in * its row table. Sometimes we search for other things at the same time. * The same is true for pivoting columns. This search should never * fail. * * (12) Information concerning the eta matrices is stored in the high * ends of arrays that are also used to store information concerning * the basis; these arrays are: hpivco, mcstrt, dluval and hcoli. * Information is only stored in these arrays as a part of pivoting * singleton rows, since the only thing that needs to be saved as * a part of pivoting singleton columns is which rows and columns were chosen, * and this is stored in hlink. * Since they have to share the same array, the eta information grows * downward instead of upward. Eventually, eta information may grow * down to the top of the basis information. As pivoting proceeds, * more and more of this information is no longer needed, so when this * happens we can try compacting the arrays to see if we can recover * enough space. lstart points at the bottom entry in the arrays, * xnewro/xnewco at the top of the basis information, and each time we * pivot a singleton row we know that we will need exactly as many new * entries as there are rows in the pivot column, so we can easily * determine if we need more room. The variable maxinv may be used * to reserve extra room when inversion starts. * * (13) Eta information is stored in a fashion that is similar to how * matrices are stored. There is one entry in hpivco and mcstrt for * each eta (other than the initial ones for singleton columns and * for singleton rows that turn out to be singleton columns), * in the order they were chosen. hpivco records the pivot row, * and mcstrt points at the first entry in the other two arrays * for this row. dluval contains the actual eta values for the column, * and hcoli the rows these values were in. * These entries in mcstrt and hpivco grow upward; they start above * the entries used to store basis information. * (Actually, I don't see why they need to start maxinv+4 entries past the top). * * (14) c_ekkrwco assumes that invalidated hrowi/hcoli entries contain 0. * * (15) When pivoting singleton columns, it may possibly happen * that a row with all singleton column entries is created. * In this case, all of the columns will be enqueued, and pivoting * on any of them eliminates the rest, without their being chosen * as pivots. The dual holds for singleton rows. * DOES THIS INDICATE A SINGULARITY? * * (15) There are some aspects of the implementation that I find odd. * hrowi is not set to 0 for pivot rows while pivoting singleton columns, * which would make sense to me. Things don't work if this isn't done, * so the information is used somehow later on. Also, the information * for the pivot column is shifted to the front of the pivot row * when pivoting singleton columns; this is also necessary for reasons * I don't understand. */ int c_ekktria(EKKfactinfo *fact, EKKHlink * rlink, EKKHlink * clink, int *nsingp, int *xnewcop, int *xnewrop, int *ncompactionsp, const int ninbas) { const int nrow = fact->nrow; const int maxinv = fact->maxinv; int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *stack = fact->krpadr; /* normally hpivro */ int *hpivco = fact->kcpadr; const double drtpiv = fact->drtpiv; CoinZeroN(reinterpret_cast(rlink+1),static_cast(nrow*(sizeof(EKKHlink)/sizeof(int)))); CoinZeroN(reinterpret_cast(clink+1),static_cast(nrow*(sizeof(EKKHlink)/sizeof(int)))); fact->npivots = 0; /* Use NUSPIK to keep sum of deactivated row counts */ fact->nuspike = 0; int xnetal = nrow + maxinv + 4; int xnewro = mrstrt[nrow] + hinrow[nrow] - 1; int xnewco = xnewro; int kmxeta = ninbas; int ncompactions = 0; int i, j, k, kc, kce, kcs, npr; double pivot; int kipis, kipie, kjpis, kjpie, knprs, knpre; int ipivot, jpivot, stackc, stackr; #ifndef NDEBUG int kpivot=-1; #else int kpivot=-1; #endif int epivco, kstart, maxstk; int irtcod = 0; int lastSlack=0; int lstart = fact->nnetas + 1; /*int nnentu = ninbas; */ int lstart_minus_nnentu=lstart-ninbas; /* do initial column singletons - as can do faster */ for (jpivot = 1; jpivot <= nrow; ++jpivot) { if (hincol[jpivot] == 1) { ipivot = hrowi[mcstrt[jpivot]]; if (ipivot>lastSlack) { lastSlack=ipivot; } else { /* so we can't put a structural over a slack */ break; } kipis = mrstrt[ipivot]; #if 1 assert (hcoli[kipis]==jpivot); #else if (hcoli[kipis]!=jpivot) { kpivot=kipis+1; while(hcoli[kpivot]!=jpivot) kpivot++; #ifdef DEBUG kipie = kipis + hinrow[ipivot] ; if (kpivot>=kipie) { abort(); } #endif pivot=dluval[kpivot]; dluval[kpivot] = dluval[kipis]; dluval[kipis] = pivot; hcoli[kpivot] = hcoli[kipis]; hcoli[kipis] = jpivot; } #endif if (dluval[kipis]==SLACK_VALUE) { /* record the new pivot row and column */ ++fact->npivots; rlink[ipivot].pre = -fact->npivots; clink[jpivot].pre = -fact->npivots; hincol[jpivot]=0; fact->nuspike += hinrow[ipivot]; } else { break; } } else { break; } } /* Fill queue with other column singletons and clean up */ maxstk = 0; for (j = 1; j <= nrow; ++j) { if (hincol[j]) { int n=0; kcs = mcstrt[j]; kce = mcstrt[j + 1]; for (k = kcs; k < kce; ++k) { if (! (rlink[hrowi[k]].pre < 0)) { n++; } } hincol[j] = n; if (n == 1) { /* we just created a new singleton column - enqueue it */ ++maxstk; stack[maxstk] = j; } } } stackc = 0; /* (1) */ while (! (stackc >= maxstk)) { /* (1) */ /* dequeue the next entry */ ++stackc; jpivot = stack[stackc]; /* (15) */ if (hincol[jpivot] != 0) { for (k = mcstrt[jpivot]; rlink[hrowi[k]].pre < 0; k++) { /* (4) */ } ipivot = hrowi[k]; /* All the columns in this row are being shortened. */ kipis = mrstrt[ipivot]; kipie = kipis + hinrow[ipivot] ; for (k = kipis; k < kipie; ++k) { j = hcoli[k]; --hincol[j]; /* (3) (6) */ if (j == jpivot) { kpivot = k; /* (11) */ } else if (hincol[j] == 1) { /* we just created a new singleton column - enqueue it */ ++maxstk; stack[maxstk] = j; } } /* record the new pivot row and column */ ++fact->npivots; rlink[ipivot].pre = -fact->npivots; clink[jpivot].pre = -fact->npivots; fact->nuspike += hinrow[ipivot]; /* check the pivot */ assert (kpivot>0); pivot = dluval[kpivot]; if (fabs(pivot) < drtpiv) { irtcod = 7; ++(*nsingp); rlink[ipivot].pre = -nrow - 1; clink[jpivot].pre = -nrow - 1; } /* swap the pivot column entry with the first one. */ /* I don't know why. */ dluval[kpivot] = dluval[kipis]; dluval[kipis] = pivot; hcoli[kpivot] = hcoli[kipis]; hcoli[kipis] = jpivot; } } /* (8) */ /* The entire basis may already be triangular */ if (fact->npivots < nrow) { /* (9) */ kstart = 0; for (j = 1; j <= nrow; ++j) { if (! (clink[j].pre < 0)) { kcs = mcstrt[j]; kce = mcstrt[j + 1]; mcstrt[j] = kstart + 1; for (k = kcs; k < kce; ++k) { if (! (rlink[hrowi[k]].pre < 0)) { ++kstart; hrowi[kstart] = hrowi[k]; } } hincol[j] = kstart - mcstrt[j] + 1; } } xnewco = kstart; /* Fill stack with initial row singletons that haven't been pivoted away */ stackr = 0; for (i = 1; i <= nrow; ++i) { if (! (rlink[i].pre < 0) && (hinrow[i] == 1)) { ++stackr; stack[stackr] = i; } } while (! (stackr <= 0)) { ipivot = stack[stackr]; assert (ipivot); --stackr; #if 1 assert (rlink[ipivot].pre>=0); #else /* This test is probably unnecessary: rlink[i].pre < 0 ==> hinrow[i]==0 */ if (rlink[ipivot].pre < 0) { continue; } #endif /* (15) */ if (hinrow[ipivot] != 0) { /* This is a singleton row, which means it has exactly one column */ jpivot = hcoli[mrstrt[ipivot]]; kjpis = mcstrt[jpivot]; epivco = hincol[jpivot] - 1; hincol[jpivot] = 0; /* this column is being pivoted away */ /* (11) */ kjpie = kjpis + epivco; for (k = kjpis; k <= kjpie; ++k) { if (ipivot == hrowi[k]) break; } /* ASSERT (k <= kjpie) */ /* move the last row entry for the pivot column into the pivot row's entry */ /* I don't know why */ hrowi[k] = hrowi[kjpie]; /* invalidate the (old) last row entry of the pivot column */ /* I don't know why */ hrowi[kjpie] = 0; /* (12) */ if (! (xnewro + epivco < lstart)) { int kstart; if (! (epivco < lstart_minus_nnentu)) { irtcod = -5; break; } kstart = c_ekkrwco(fact,dluval, hcoli, mrstrt, hinrow, xnewro); ++ncompactions; kmxeta += (xnewro - kstart) << 1; xnewro = kstart; } if (! (xnewco + epivco < lstart)) { if (! (epivco < lstart_minus_nnentu)) { irtcod = -5; break; } xnewco = c_ekkclco(fact,hrowi, mcstrt, hincol, xnewco); ++ncompactions; /* HINCOL MAY HAVE CHANGED ??? (JJHF) */ epivco = hincol[jpivot]; } /* record the new pivot row and column */ ++fact->npivots; rlink[ipivot].pre = -fact->npivots; clink[jpivot].pre = -fact->npivots; /* no update for nuspik */ /* check the pivot */ pivot = dluval[mrstrt[ipivot]]; if (fabs(pivot) < drtpiv) { /* If the pivot is too small, reject it, but keep going */ irtcod = 7; rlink[ipivot].pre = -nrow - 1; clink[jpivot].pre = -nrow - 1; } /* Perform numerical part of elimination. */ if (! (epivco <= 0)) { ++xnetal; mcstrt[xnetal] = lstart - 1; hpivco[xnetal] = ipivot; pivot = -1.f / pivot; kcs = mcstrt[jpivot]; kce = kcs + epivco - 1; hincol[jpivot] = 0; for (kc = kcs; kc <= kce; ++kc) { npr = hrowi[kc]; /* why bother? */ hrowi[kc] = 0; --hinrow[npr]; /* (3) */ if (hinrow[npr] == 1) { /* this may create new singleton rows */ ++stackr; stack[stackr] = npr; } /* (11) */ knprs = mrstrt[npr]; knpre = knprs + hinrow[npr]; for (k = knprs; k <= knpre; ++k) { if (jpivot == hcoli[k]) { kpivot = k; break; } } /* ASSERT (kpivot <= knpre) */ { /* (10) */ double elemnt = dluval[kpivot]; dluval[kpivot] = dluval[knpre]; hcoli[kpivot] = hcoli[knpre]; hcoli[knpre] = 0; /* (14) */ /* store elementary row transformation */ --lstart; dluval[lstart] = elemnt * pivot; hcoli[lstart] = npr; } } } } } } /* (8) */ *xnewcop = xnewco; *xnewrop = xnewro; fact->xnetal = xnetal; fact->nnentu = lstart - lstart_minus_nnentu; fact->kmxeta = kmxeta; *ncompactionsp = ncompactions; return (irtcod); } /* c_ekktria */ CoinMP-1.8.3/CoinUtils/src/CoinPackedMatrix.hpp0000644000175000017500000011515212054012315017710 0ustar renerene/* $Id: CoinPackedMatrix.hpp 1560 2012-11-24 00:29:01Z lou $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPackedMatrix_H #define CoinPackedMatrix_H #include "CoinError.hpp" #include "CoinTypes.hpp" #ifndef CLP_NO_VECTOR #include "CoinPackedVectorBase.hpp" #include "CoinShallowPackedVector.hpp" #else class CoinRelFltEq; #endif /** Sparse Matrix Base Class This class is intended to represent sparse matrices using row-major or column-major ordering. The representation is very efficient for adding, deleting, or retrieving major-dimension vectors. Adding a minor-dimension vector is less efficient, but can be helped by providing "extra" space as described in the next paragraph. Deleting a minor-dimension vector requires inspecting all coefficients in the matrix. Retrieving a minor-dimension vector would incur the same cost and is not supported (except in the sense that you can write a loop to retrieve all coefficients one at a time). Consider physically transposing the matrix, or keeping a second copy with the other major-vector ordering. The sparse represention can be completely compact or it can have "extra" space available at the end of each major vector. Incorporating extra space into the sparse matrix representation can improve performance in cases where new data needs to be inserted into the packed matrix against the major-vector orientation (e.g, inserting a row into a matrix stored in column-major order). For example if the matrix: @verbatim 3 1 0 -2 -1 0 0 -1 0 2 1.1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 2.8 0 0 -1.2 0 5.6 0 0 0 1 0 0 1.9 was stored by rows (with no extra space) in CoinPackedMatrix r then: r.getElements() returns a vector containing: 3 1 -2 -1 -1 2 1.1 1 1 2.8 -1.2 5.6 1 1.9 r.getIndices() returns a vector containing: 0 1 3 4 7 1 2 2 5 3 6 0 4 7 r.getVectorStarts() returns a vector containing: 0 5 7 9 11 14 r.getNumElements() returns 14. r.getMajorDim() returns 5. r.getVectorSize(0) returns 5. r.getVectorSize(1) returns 2. r.getVectorSize(2) returns 2. r.getVectorSize(3) returns 2. r.getVectorSize(4) returns 3. If stored by columns (with no extra space) then: c.getElements() returns a vector containing: 3 5.6 1 2 1.1 1 -2 2.8 -1 1 1 -1.2 -1 1.9 c.getIndices() returns a vector containing: 0 4 0 1 1 2 0 3 0 4 2 3 0 4 c.getVectorStarts() returns a vector containing: 0 2 4 6 8 10 11 12 14 c.getNumElements() returns 14. c.getMajorDim() returns 8. @endverbatim Compiling this class with CLP_NO_VECTOR defined will excise all methods which use CoinPackedVectorBase, CoinPackedVector, or CoinShallowPackedVector as parameters or return types. Compiling this class with COIN_FAST_CODE defined removes index range checks. */ class CoinPackedMatrix { friend void CoinPackedMatrixUnitTest(); public: //--------------------------------------------------------------------------- /**@name Query members */ //@{ /** Return the current setting of the extra gap. */ inline double getExtraGap() const { return extraGap_; } /** Return the current setting of the extra major. */ inline double getExtraMajor() const { return extraMajor_; } /** Reserve sufficient space for appending major-ordered vectors. If create is true, empty columns are created (for column generation) */ void reserve(const int newMaxMajorDim, const CoinBigIndex newMaxSize, bool create=false); /** Clear the data, but do not free any arrays */ void clear(); /** Whether the packed matrix is column major ordered or not. */ inline bool isColOrdered() const { return colOrdered_; } /** Whether the packed matrix has gaps or not. */ inline bool hasGaps() const { return (size_vectorStarts array See #start_. */ inline int getSizeVectorStarts() const { return ((majorDim_ > 0)?(majorDim_+1):(0)) ; } /*! \brief The size of the vectorLengths array See #length_. */ inline int getSizeVectorLengths() const { return majorDim_; } /*! \brief The positions where the major-dimension vectors start in elements and indices. See #start_. */ inline const CoinBigIndex * getVectorStarts() const { return start_; } /*! \brief The lengths of the major-dimension vectors. See #length_. */ inline const int * getVectorLengths() const { return length_; } /** The position of the first element in the i'th major-dimension vector. */ CoinBigIndex getVectorFirst(const int i) const { #ifndef COIN_FAST_CODE if (i < 0 || i >= majorDim_) throw CoinError("bad index", "vectorFirst", "CoinPackedMatrix"); #endif return start_[i]; } /** The position of the last element (well, one entry past the last) in the i'th major-dimension vector. */ CoinBigIndex getVectorLast(const int i) const { #ifndef COIN_FAST_CODE if (i < 0 || i >= majorDim_) throw CoinError("bad index", "vectorLast", "CoinPackedMatrix"); #endif return start_[i] + length_[i]; } /** The length of i'th vector. */ inline int getVectorSize(const int i) const { #ifndef COIN_FAST_CODE if (i < 0 || i >= majorDim_) throw CoinError("bad index", "vectorSize", "CoinPackedMatrix"); #endif return length_[i]; } #ifndef CLP_NO_VECTOR /** Return the i'th vector in matrix. */ const CoinShallowPackedVector getVector(int i) const { #ifndef COIN_FAST_CODE if (i < 0 || i >= majorDim_) throw CoinError("bad index", "vector", "CoinPackedMatrix"); #endif return CoinShallowPackedVector(length_[i], index_ + start_[i], element_ + start_[i], false); } #endif /** Returns an array containing major indices. The array is getNumElements long and if getVectorStarts() is 0,2,5 then the array would start 0,0,1,1,1,2... This method is provided to go back from a packed format to a triple format. It returns NULL if there are gaps in matrix so user should use removeGaps() if there are any gaps. It does this as this array has to match getElements() and getIndices() and because it makes no sense otherwise. The returned array is allocated with new int[], free it with delete[]. */ int * getMajorIndices() const; //@} //--------------------------------------------------------------------------- /**@name Modifying members */ //@{ /*! \brief Set the dimensions of the matrix. The method name is deceptive; the effect is to append empty columns and/or rows to the matrix to reach the specified dimensions. A negative number for either dimension means that that dimension doesn't change. An exception will be thrown if the specified dimensions are smaller than the current dimensions. */ void setDimensions(int numrows, int numcols); /** Set the extra gap to be allocated to the specified value. */ void setExtraGap(const double newGap); /** Set the extra major to be allocated to the specified value. */ void setExtraMajor(const double newMajor); #ifndef CLP_NO_VECTOR /*! Append a column to the end of the matrix. When compiled with COIN_DEBUG defined this method throws an exception if the column vector specifies a nonexistent row index. Otherwise the method assumes that every index fits into the matrix. */ void appendCol(const CoinPackedVectorBase& vec); #endif /*! Append a column to the end of the matrix. When compiled with COIN_DEBUG defined this method throws an exception if the column vector specifies a nonexistent row index. Otherwise the method assumes that every index fits into the matrix. */ void appendCol(const int vecsize, const int *vecind, const double *vecelem); #ifndef CLP_NO_VECTOR /*! Append a set of columns to the end of the matrix. When compiled with COIN_DEBUG defined this method throws an exception if any of the column vectors specify a nonexistent row index. Otherwise the method assumes that every index fits into the matrix. */ void appendCols(const int numcols, const CoinPackedVectorBase * const * cols); #endif /*! Append a set of columns to the end of the matrix. Returns the number of errors (nonexistent or duplicate row index). No error checking is performed if \p numberRows < 0. */ int appendCols(const int numcols, const CoinBigIndex * columnStarts, const int * row, const double * element, int numberRows=-1); #ifndef CLP_NO_VECTOR /*! Append a row to the end of the matrix. When compiled with COIN_DEBUG defined this method throws an exception if the row vector specifies a nonexistent column index. Otherwise the method assumes that every index fits into the matrix. */ void appendRow(const CoinPackedVectorBase& vec); #endif /*! Append a row to the end of the matrix. When compiled with COIN_DEBUG defined this method throws an exception if the row vector specifies a nonexistent column index. Otherwise the method assumes that every index fits into the matrix. */ void appendRow(const int vecsize, const int *vecind, const double *vecelem); #ifndef CLP_NO_VECTOR /*! Append a set of rows to the end of the matrix. When compiled with COIN_DEBUG defined this method throws an exception if any of the row vectors specify a nonexistent column index. Otherwise the method assumes that every index fits into the matrix. */ void appendRows(const int numrows, const CoinPackedVectorBase * const * rows); #endif /*! Append a set of rows to the end of the matrix. Returns the number of errors (nonexistent or duplicate column index). No error checking is performed if \p numberColumns < 0. */ int appendRows(const int numrows, const CoinBigIndex * rowStarts, const int * column, const double * element, int numberColumns=-1); /** Append the argument to the "right" of the current matrix. Imagine this as adding new columns (don't worry about how the matrices are ordered, that is taken care of). An exception is thrown if the number of rows is different in the matrices. */ void rightAppendPackedMatrix(const CoinPackedMatrix& matrix); /** Append the argument to the "bottom" of the current matrix. Imagine this as adding new rows (don't worry about how the matrices are ordered, that is taken care of). An exception is thrown if the number of columns is different in the matrices. */ void bottomAppendPackedMatrix(const CoinPackedMatrix& matrix); /** Delete the columns whose indices are listed in indDel. */ void deleteCols(const int numDel, const int * indDel); /** Delete the rows whose indices are listed in indDel. */ void deleteRows(const int numDel, const int * indDel); /** Replace the elements of a vector. The indices remain the same. At most the number specified will be replaced. The index is between 0 and major dimension of matrix */ void replaceVector(const int index, const int numReplace, const double * newElements); /** Modify one element of packed matrix. An element may be added. This works for either ordering If the new element is zero it will be deleted unless keepZero true */ void modifyCoefficient(int row, int column, double newElement, bool keepZero=false); /** Return one element of packed matrix. This works for either ordering If it is not present will return 0.0 */ double getCoefficient(int row, int column) const; /** Eliminate all elements in matrix whose absolute value is less than threshold. The column starts are not affected. Returns number of elements eliminated. Elements eliminated are at end of each vector */ int compress(double threshold); /** Eliminate all duplicate AND small elements in matrix The column starts are not affected. Returns number of elements eliminated. */ int eliminateDuplicates(double threshold); /** Sort all columns so indices are increasing.in each column */ void orderMatrix(); /** Really clean up matrix. a) eliminate all duplicate AND small elements in matrix b) remove all gaps and set extraGap_ and extraMajor_ to 0.0 c) reallocate arrays and make max lengths equal to lengths d) orders elements returns number of elements eliminated */ int cleanMatrix(double threshold=1.0e-20); //@} //--------------------------------------------------------------------------- /**@name Methods that reorganize the whole matrix */ //@{ /** Remove the gaps from the matrix if there were any Can also remove small elements fabs() <= removeValue*/ void removeGaps(double removeValue=-1.0); /** Extract a submatrix from matrix. Those major-dimension vectors of the matrix comprise the submatrix whose indices are given in the arguments. Does not allow duplicates. */ void submatrixOf(const CoinPackedMatrix& matrix, const int numMajor, const int * indMajor); /** Extract a submatrix from matrix. Those major-dimension vectors of the matrix comprise the submatrix whose indices are given in the arguments. Allows duplicates and keeps order. */ void submatrixOfWithDuplicates(const CoinPackedMatrix& matrix, const int numMajor, const int * indMajor); #if 0 /** Extract a submatrix from matrix. Those major/minor-dimension vectors of the matrix comprise the submatrix whose indices are given in the arguments. */ void submatrixOf(const CoinPackedMatrix& matrix, const int numMajor, const int * indMajor, const int numMinor, const int * indMinor); #endif /** Copy method. This method makes an exact replica of the argument, including the extra space parameters. */ void copyOf(const CoinPackedMatrix& rhs); /** Copy the arguments to the matrix. If len is a NULL pointer then the matrix is assumed to have no gaps in it and len will be created accordingly. */ void copyOf(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len, const double extraMajor=0.0, const double extraGap=0.0); /** Copy method. This method makes an exact replica of the argument, including the extra space parameters. If there is room it will re-use arrays */ void copyReuseArrays(const CoinPackedMatrix& rhs); /*! \brief Make a reverse-ordered copy. This method makes an exact replica of the argument with the major vector orientation changed from row (column) to column (row). The extra space parameters are also copied and reversed. (Cf. #reverseOrdering, which does the same thing in place.) */ void reverseOrderedCopyOf(const CoinPackedMatrix& rhs); /** Assign the arguments to the matrix. If len is a NULL pointer then the matrix is assumed to have no gaps in it and len will be created accordingly.
    NOTE 1: After this method returns the pointers passed to the method will be NULL pointers!
    NOTE 2: When the matrix is eventually destructed the arrays will be deleted by delete[]. Hence one should use this method ONLY if all array swere allocated by new[]! */ void assignMatrix(const bool colordered, const int minor, const int major, const CoinBigIndex numels, double *& elem, int *& ind, CoinBigIndex *& start, int *& len, const int maxmajor = -1, const CoinBigIndex maxsize = -1); /** Assignment operator. This copies out the data, but uses the current matrix's extra space parameters. */ CoinPackedMatrix & operator=(const CoinPackedMatrix& rhs); /*! \brief Reverse the ordering of the packed matrix. Change the major vector orientation of the matrix data structures from row (column) to column (row). (Cf. #reverseOrderedCopyOf, which does the same thing but produces a new matrix.) */ void reverseOrdering(); /*! \brief Transpose the matrix. \note If you start with a column-ordered matrix and invoke transpose, you will have a row-ordered transposed matrix. To change the major vector orientation (e.g., to transform a column-ordered matrix to a column-ordered transposed matrix), invoke transpose() followed by #reverseOrdering(). */ void transpose(); /*! \brief Swap the content of two packed matrices. */ void swap(CoinPackedMatrix& matrix); //@} //--------------------------------------------------------------------------- /**@name Matrix times vector methods */ //@{ /** Return A * x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ void times(const double * x, double * y) const; #ifndef CLP_NO_VECTOR /** Return A * x in y. Same as the previous method, just x is given in the form of a packed vector. */ void times(const CoinPackedVectorBase& x, double * y) const; #endif /** Return x * A in y. @pre x must be of size numRows() @pre y must be of size numColumns() */ void transposeTimes(const double * x, double * y) const; #ifndef CLP_NO_VECTOR /** Return x * A in y. Same as the previous method, just x is given in the form of a packed vector. */ void transposeTimes(const CoinPackedVectorBase& x, double * y) const; #endif //@} //--------------------------------------------------------------------------- /**@name Helper functions used internally, but maybe useful externally. These methods do not worry about testing whether the packed matrix is row or column major ordered; they operate under the assumption that the correct version is invoked. In fact, a number of other methods simply just call one of these after testing the ordering of the matrix. */ //@{ //------------------------------------------------------------------------- /**@name Queries */ //@{ /** Count the number of entries in every minor-dimension vector and return an array containing these lengths. The returned array is allocated with new int[], free it with delete[]. */ int * countOrthoLength() const; /** Count the number of entries in every minor-dimension vector and fill in an array containing these lengths. */ void countOrthoLength(int * counts) const; /** Major dimension. For row ordered matrix this would be the number of rows. */ inline int getMajorDim() const { return majorDim_; } /** Set major dimension. For row ordered matrix this would be the number of rows. Use with great care.*/ inline void setMajorDim(int value) { majorDim_ = value; } /** Minor dimension. For row ordered matrix this would be the number of columns. */ inline int getMinorDim() const { return minorDim_; } /** Set minor dimension. For row ordered matrix this would be the number of columns. Use with great care.*/ inline void setMinorDim(int value) { minorDim_ = value; } /** Current maximum for major dimension. For row ordered matrix this many rows can be added without reallocating the vector related to the major dimension (start_ and length_). */ inline int getMaxMajorDim() const { return maxMajorDim_; } /** Dump the matrix on stdout. When in dire straits this method can help. */ void dumpMatrix(const char* fname = NULL) const; /// Print a single matrix element. void printMatrixElement(const int row_val, const int col_val) const; //@} //------------------------------------------------------------------------- /*! @name Append vectors \details When compiled with COIN_DEBUG defined these methods throw an exception if the major (minor) vector contains an index that's invalid for the minor (major) dimension. Otherwise the methods assume that every index fits into the matrix. */ //@{ #ifndef CLP_NO_VECTOR /** Append a major-dimension vector to the end of the matrix. */ void appendMajorVector(const CoinPackedVectorBase& vec); #endif /** Append a major-dimension vector to the end of the matrix. */ void appendMajorVector(const int vecsize, const int *vecind, const double *vecelem); #ifndef CLP_NO_VECTOR /** Append several major-dimensonvectors to the end of the matrix */ void appendMajorVectors(const int numvecs, const CoinPackedVectorBase * const * vecs); /** Append a minor-dimension vector to the end of the matrix. */ void appendMinorVector(const CoinPackedVectorBase& vec); #endif /** Append a minor-dimension vector to the end of the matrix. */ void appendMinorVector(const int vecsize, const int *vecind, const double *vecelem); #ifndef CLP_NO_VECTOR /** Append several minor-dimension vectors to the end of the matrix */ void appendMinorVectors(const int numvecs, const CoinPackedVectorBase * const * vecs); #endif /*! \brief Append a set of rows (columns) to the end of a column (row) ordered matrix. This case is when we know there are no gaps and majorDim_ will not change. \todo This method really belongs in the group of protected methods with #appendMinor; there are no safeties here even with COIN_DEBUG. Apparently this method was needed in ClpPackedMatrix and giving it proper visibility was too much trouble. Should be moved. */ void appendMinorFast(const int number, const CoinBigIndex * starts, const int * index, const double * element); //@} //------------------------------------------------------------------------- /*! \name Append matrices \details We'll document these methods assuming that the current matrix is column major ordered (Hence in the ...SameOrdered() methods the argument is column ordered, in the OrthoOrdered() methods the argument is row ordered.) */ //@{ /** Append the columns of the argument to the right end of this matrix. @pre minorDim_ == matrix.minorDim_
    This method throws an exception if the minor dimensions are not the same. */ void majorAppendSameOrdered(const CoinPackedMatrix& matrix); /** Append the columns of the argument to the bottom end of this matrix. @pre majorDim_ == matrix.majorDim_
    This method throws an exception if the major dimensions are not the same. */ void minorAppendSameOrdered(const CoinPackedMatrix& matrix); /** Append the rows of the argument to the right end of this matrix. @pre minorDim_ == matrix.majorDim_
    This method throws an exception if the minor dimension of the current matrix is not the same as the major dimension of the argument matrix. */ void majorAppendOrthoOrdered(const CoinPackedMatrix& matrix); /** Append the rows of the argument to the bottom end of this matrix. @pre majorDim_ == matrix.minorDim_
    This method throws an exception if the major dimension of the current matrix is not the same as the minor dimension of the argument matrix. */ void minorAppendOrthoOrdered(const CoinPackedMatrix& matrix); //@} //----------------------------------------------------------------------- /**@name Delete vectors */ //@{ /** Delete the major-dimension vectors whose indices are listed in indDel. */ void deleteMajorVectors(const int numDel, const int * indDel); /** Delete the minor-dimension vectors whose indices are listed in indDel. */ void deleteMinorVectors(const int numDel, const int * indDel); //@} //----------------------------------------------------------------------- /**@name Various dot products. */ //@{ /** Return A * x (multiplied from the "right" direction) in y. @pre x must be of size majorDim() @pre y must be of size minorDim() */ void timesMajor(const double * x, double * y) const; #ifndef CLP_NO_VECTOR /** Return A * x (multiplied from the "right" direction) in y. Same as the previous method, just x is given in the form of a packed vector. */ void timesMajor(const CoinPackedVectorBase& x, double * y) const; #endif /** Return A * x (multiplied from the "right" direction) in y. @pre x must be of size minorDim() @pre y must be of size majorDim() */ void timesMinor(const double * x, double * y) const; #ifndef CLP_NO_VECTOR /** Return A * x (multiplied from the "right" direction) in y. Same as the previous method, just x is given in the form of a packed vector. */ void timesMinor(const CoinPackedVectorBase& x, double * y) const; #endif //@} //@} //-------------------------------------------------------------------------- /**@name Logical Operations. */ //@{ #ifndef CLP_NO_VECTOR /*! \brief Test for equivalence. Two matrices are equivalent if they are both row- or column-ordered, they have the same dimensions, and each (major) vector is equivalent. The operator used to test for equality can be specified using the \p FloatEqual template parameter. */ template bool isEquivalent(const CoinPackedMatrix& rhs, const FloatEqual& eq) const { // Both must be column order or both row ordered and must be of same size if ((isColOrdered() ^ rhs.isColOrdered()) || (getNumCols() != rhs.getNumCols()) || (getNumRows() != rhs.getNumRows()) || (getNumElements() != rhs.getNumElements())) return false; for (int i=getMajorDim()-1; i >= 0; --i) { CoinShallowPackedVector pv = getVector(i); CoinShallowPackedVector rhsPv = rhs.getVector(i); if ( !pv.isEquivalent(rhsPv,eq) ) return false; } return true; } /*! \brief Test for equivalence and report differences Equivalence is defined as for #isEquivalent. In addition, this method will print differences to std::cerr. Intended for use in unit tests and for debugging. */ bool isEquivalent2(const CoinPackedMatrix& rhs) const; #else /*! \brief Test for equivalence. Two matrices are equivalent if they are both row- or column-ordered, they have the same dimensions, and each (major) vector is equivalent. This method is optimised for speed. CoinPackedVector#isEquivalent is replaced with more efficient code for repeated comparison of equal-length vectors. The CoinRelFltEq operator is used. */ bool isEquivalent(const CoinPackedMatrix& rhs, const CoinRelFltEq & eq) const; #endif /*! \brief Test for equivalence. The test for element equality is the default CoinRelFltEq operator. */ bool isEquivalent(const CoinPackedMatrix& rhs) const; //@} //-------------------------------------------------------------------------- /*! \name Non-const methods These are to be used with great care when doing column generation, etc. */ //@{ /** A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with #start_ and #length_. */ inline double * getMutableElements() const { return element_; } /** A vector containing the minor indices of the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with #start_ and #length_. */ inline int * getMutableIndices() const { return index_; } /** The positions where the major-dimension vectors start in #element_ and #index_. */ inline CoinBigIndex * getMutableVectorStarts() const { return start_; } /** The lengths of the major-dimension vectors. */ inline int * getMutableVectorLengths() const { return length_; } /// Change the size of the bulk store after modifying - be careful inline void setNumElements(CoinBigIndex value) { size_ = value;} /*! NULLify element array Used when space is very tight. Does not free the space! */ inline void nullElementArray() {element_=NULL;} /*! NULLify start array Used when space is very tight. Does not free the space! */ inline void nullStartArray() {start_=NULL;} /*! NULLify length array Used when space is very tight. Does not free the space! */ inline void nullLengthArray() {length_=NULL;} /*! NULLify index array Used when space is very tight. Does not free the space! */ inline void nullIndexArray() {index_=NULL;} //@} //-------------------------------------------------------------------------- /*! \name Constructors and destructors */ //@{ /// Default Constructor creates an empty column ordered packed matrix CoinPackedMatrix(); /// A constructor where the ordering and the gaps are specified CoinPackedMatrix(const bool colordered, const double extraMajor, const double extraGap); CoinPackedMatrix(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len, const double extraMajor, const double extraGap); CoinPackedMatrix(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len); /** Create packed matrix from triples. If colordered is true then the created matrix will be column ordered. Duplicate matrix elements are allowed. The created matrix will have the sum of the duplicates.
    For example if:
    rowIndices[0]=2; colIndices[0]=5; elements[0]=2.0
    rowIndices[1]=2; colIndices[1]=5; elements[1]=0.5
    then the created matrix will contain a value of 2.5 in row 2 and column 5.
    The matrix is created without gaps. */ CoinPackedMatrix(const bool colordered, const int * rowIndices, const int * colIndices, const double * elements, CoinBigIndex numels ); /// Copy constructor CoinPackedMatrix(const CoinPackedMatrix& m); /*! \brief Copy constructor with fine tuning This constructor allows for the specification of an exact amount of extra space and/or reverse ordering. \p extraForMajor is the exact number of spare major vector slots after any possible reverse ordering. If \p extraForMajor < 0, all gaps and small elements will be removed from the copy, otherwise gaps and small elements are preserved. \p extraElements is the exact number of spare element entries. The usual multipliers, #extraMajor_ and #extraGap_, are set to zero. */ CoinPackedMatrix(const CoinPackedMatrix &m, int extraForMajor, int extraElements, bool reverseOrdering = false) ; /** Subset constructor (without gaps). Duplicates are allowed and order is as given */ CoinPackedMatrix (const CoinPackedMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); /// Destructor virtual ~CoinPackedMatrix(); //@} /*! \name Debug Utilities */ //@{ /*! \brief Scan the matrix for anomalies. Returns the number of anomalies. Scans the structure for gaps, obviously bogus indices and coefficients, and inconsistencies. Gaps are not an error unless #hasGaps() says the matrix should be gap-free. Zeroes are not an error unless \p zeroesAreError is set to true. Values for verbosity are: - 0: No messages, just the return value - 1: Messages about errors - 2: If there are no errors, a message indicating the matrix was checked is printed (positive confirmation). - 3: Adds a bit more information about the matrix. - 4: Prints warnings about zeroes even if they're not considered errors. Obviously bogus coefficients are coefficients that are NaN or have absolute value greater than 1e50. Zeros have absolute value less than 1e-50. */ int verifyMtx(int verbosity = 1, bool zeroesAreError = false) const ; //@} //-------------------------------------------------------------------------- protected: void gutsOfDestructor(); void gutsOfCopyOf(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len, const double extraMajor=0.0, const double extraGap=0.0); /// When no gaps we can do faster void gutsOfCopyOfNoGaps(const bool colordered, const int minor, const int major, const double * elem, const int * ind, const CoinBigIndex * start); void gutsOfOpEqual(const bool colordered, const int minor, const int major, const CoinBigIndex numels, const double * elem, const int * ind, const CoinBigIndex * start, const int * len); void resizeForAddingMajorVectors(const int numVec, const int * lengthVec); void resizeForAddingMinorVectors(const int * addedEntries); /*! \brief Append a set of rows (columns) to the end of a row (colum) ordered matrix. If \p numberOther > 0 the method will check if any of the new rows (columns) contain duplicate indices or invalid indices and return the number of errors. A valid minor index must satisfy \code 0 <= k < numberOther \endcode If \p numberOther < 0 no checking is performed. */ int appendMajor(const int number, const CoinBigIndex * starts, const int * index, const double * element, int numberOther=-1); /*! \brief Append a set of rows (columns) to the end of a column (row) ordered matrix. If \p numberOther > 0 the method will check if any of the new rows (columns) contain duplicate indices or indices outside the current range for the major dimension and return the number of violations. If \p numberOther <= 0 the major dimension will be expanded as necessary and there are no checks for duplicate indices. */ int appendMinor(const int number, const CoinBigIndex * starts, const int * index, const double * element, int numberOther=-1); private: inline CoinBigIndex getLastStart() const { return majorDim_ == 0 ? 0 : start_[majorDim_]; } //-------------------------------------------------------------------------- protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /** A flag indicating whether the matrix is column or row major ordered. */ bool colOrdered_; /** This much times more space should be allocated for each major-dimension vector (with respect to the number of entries in the vector) when the matrix is resized. The purpose of these gaps is to allow fast insertion of new minor-dimension vectors. */ double extraGap_; /** his much times more space should be allocated for major-dimension vectors when the matrix is resized. The purpose of these gaps is to allow fast addition of new major-dimension vectors. */ double extraMajor_; /** List of nonzero element values. The entries in the gaps between major-dimension vectors are undefined. */ double *element_; /** List of nonzero element minor-dimension indices. The entries in the gaps between major-dimension vectors are undefined. */ int *index_; /** Starting positions of major-dimension vectors. */ CoinBigIndex *start_; /** Lengths of major-dimension vectors. */ int *length_; /// number of vectors in matrix int majorDim_; /// size of other dimension int minorDim_; /// the number of nonzero entries CoinBigIndex size_; /// max space allocated for major-dimension int maxMajorDim_; /// max space allocated for entries CoinBigIndex maxSize_; //@} }; //############################################################################# /*! \brief Test the methods in the CoinPackedMatrix class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CoinPackedMatrixUnitTest(); #endif CoinMP-1.8.3/CoinUtils/src/CoinDenseVector.cpp0000644000175000017500000001272711510461170017557 0ustar renerene/* $Id: CoinDenseVector.cpp 1373 2011-01-03 23:57:44Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Resized. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include "CoinDenseVector.hpp" #include "CoinHelperFunctions.hpp" //############################################################################# template void CoinDenseVector::clear() { memset(elements_, 0, nElements_*sizeof(T)); } //############################################################################# template CoinDenseVector & CoinDenseVector::operator=(const CoinDenseVector & rhs) { if (this != &rhs) { setVector(rhs.getNumElements(), rhs.getElements()); } return *this; } //############################################################################# template void CoinDenseVector::setVector(int size, const T * elems) { resize(size); CoinMemcpyN( elems,size,elements_); } //############################################################################# template void CoinDenseVector::setConstant(int size, T value) { resize(size); for(int i=0; i void CoinDenseVector::resize(int newsize, T value) { if (newsize != nElements_){ assert(newsize > 0); T *newarray = new T[newsize]; int cpysize = CoinMin(newsize, nElements_); CoinMemcpyN( elements_,cpysize,newarray); delete[] elements_; elements_ = newarray; nElements_ = newsize; for(int i=cpysize; i void CoinDenseVector::setElement(int index, T element) { assert(index >= 0 && index < nElements_); elements_[index] = element; } //############################################################################# template void CoinDenseVector::append(const CoinDenseVector & caboose) { const int s = nElements_; const int cs = caboose.getNumElements(); int newsize = s + cs; resize(newsize); const T * celem = caboose.getElements(); CoinDisjointCopyN(celem, cs, elements_ + s); } //############################################################################# template void CoinDenseVector::operator+=(T value) { for(int i=0; i void CoinDenseVector::operator-=(T value) { for(int i=0; i void CoinDenseVector::operator*=(T value) { for(int i=0; i void CoinDenseVector::operator/=(T value) { for(int i=0; i CoinDenseVector::CoinDenseVector(): nElements_(0), elements_(NULL) {} //############################################################################# template CoinDenseVector::CoinDenseVector(int size, const T * elems): nElements_(0), elements_(NULL) { gutsOfSetVector(size, elems); } //----------------------------------------------------------------------------- template CoinDenseVector::CoinDenseVector(int size, T value): nElements_(0), elements_(NULL) { gutsOfSetConstant(size, value); } //----------------------------------------------------------------------------- template CoinDenseVector::CoinDenseVector(const CoinDenseVector & rhs): nElements_(0), elements_(NULL) { setVector(rhs.getNumElements(), rhs.getElements()); } //----------------------------------------------------------------------------- template CoinDenseVector::~CoinDenseVector () { delete [] elements_; } //############################################################################# template void CoinDenseVector::gutsOfSetVector(int size, const T * elems) { if ( size != 0 ) { resize(size); nElements_ = size; CoinDisjointCopyN(elems, size, elements_); } } //----------------------------------------------------------------------------- template void CoinDenseVector::gutsOfSetConstant(int size, T value) { if ( size != 0 ) { resize(size); nElements_ = size; CoinFillN(elements_, size, value); } } //############################################################################# /** Access the i'th element of the dense vector. */ template T & CoinDenseVector::operator[](int index) const { assert(index >= 0 && index < nElements_); T *where = elements_ + index; return *where; } //############################################################################# // template class CoinDenseVector; This works but causes warning messages template class CoinDenseVector; template class CoinDenseVector; CoinMP-1.8.3/CoinUtils/src/CoinPresolveMatrix.cpp0000644000175000017500000004147611670247221020333 0ustar renerene/* $Id: CoinPresolveMatrix.cpp 1510 2011-12-08 23:56:01Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" #include "CoinTime.hpp" /*! \file This file contains methods for CoinPresolveMatrix, the object used during presolve transformations. */ /* Constructor and destructor for CoinPresolveMatrix. */ /* CoinPresolveMatrix constructor The constructor does very little, for much the same reasons that the CoinPrePostsolveMatrix constructor does little. Might as well wait until we load a matrix. In general, for presolve the allocated size can be equal to the size of the constraint matrix before presolve transforms are applied. (Presolve transforms are assumed to reduce the size of the constraint system.) But we need to keep the *_alloc parameters for compatibility with CoinPrePostsolveMatrix. */ CoinPresolveMatrix::CoinPresolveMatrix (int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc) : CoinPrePostsolveMatrix(ncols_alloc,nrows_alloc,nelems_alloc), clink_(0), rlink_(0), dobias_(0.0), mrstrt_(0), hinrow_(0), rowels_(0), hcol_(0), integerType_(0), anyInteger_(false), tuning_(false), startTime_(0.0), feasibilityTolerance_(0.0), status_(-1), pass_(0), maxSubstLevel_(3), colChanged_(0), colsToDo_(0), numberColsToDo_(0), nextColsToDo_(0), numberNextColsToDo_(0), rowChanged_(0), rowsToDo_(0), numberRowsToDo_(0), nextRowsToDo_(0), numberNextRowsToDo_(0), presolveOptions_(0), anyProhibited_(false), usefulRowInt_(NULL), usefulRowDouble_(NULL), usefulColumnInt_(NULL), usefulColumnDouble_(NULL), randomNumber_(NULL), infiniteUp_(NULL), sumUp_(NULL), infiniteDown_(NULL), sumDown_(NULL) { /* nothing to do here */ return ; } /* CoinPresolveMatrix destructor. */ CoinPresolveMatrix::~CoinPresolveMatrix() { delete[] clink_ ; delete[] rlink_ ; delete[] mrstrt_ ; delete[] hinrow_ ; delete[] rowels_ ; delete[] hcol_ ; delete[] integerType_ ; delete[] rowChanged_ ; delete[] rowsToDo_ ; delete[] nextRowsToDo_ ; delete[] colChanged_ ; delete[] colsToDo_ ; delete[] nextColsToDo_ ; delete[] usefulRowInt_; delete[] usefulRowDouble_; delete[] usefulColumnInt_; delete[] usefulColumnDouble_; delete[] randomNumber_; delete[] infiniteUp_; delete[] sumUp_; delete[] infiniteDown_; delete[] sumDown_; return ; } /* This routine loads a CoinPackedMatrix and proceeds to do the bulk of the initialisation for the PrePostsolve and Presolve objects. In the CoinPrePostsolveMatrix portion of the object, it initialises the column-major packed matrix representation and the arrays that track the motion of original columns and rows. In the CoinPresolveMatrix portion of the object, it initialises the row-major packed matrix representation, the arrays that assist in matrix storage management, and the arrays that track the rows and columns to be processed. Arrays are allocated to the requested size (ncols0_, nrow0_, nelems0_). The source matrix must be column ordered; it does not need to be gap-free. Bulk storage in the column-major (hrow_, colels_) and row-major (hcol_, rowels_) matrices is allocated at twice the required size so that we can expand columns and rows as needed. This is almost certainly grossly oversize, but (1) it's efficient, and (2) the utility routines which compact the bulk storage areas have no provision to reallocate. */ void CoinPresolveMatrix::setMatrix (const CoinPackedMatrix *mtx) { /* Check to make sure the matrix will fit and is column ordered. */ if (mtx->isColOrdered() == false) { throw CoinError("source matrix must be column ordered", "setMatrix","CoinPrePostsolveMatrix") ; } int numCols = mtx->getNumCols() ; if (numCols > ncols0_) { throw CoinError("source matrix exceeds allocated capacity", "setMatrix","CoinPrePostsolveMatrix") ; } /* Acquire the actual size, but allocate the matrix storage to the requested capacity. The column-major rep is part of the PrePostsolve object, the row-major rep belongs to the Presolve object. */ ncols_ = numCols ; nrows_ = mtx->getNumRows() ; nelems_ = mtx->getNumElements() ; bulk0_ = static_cast (bulkRatio_*nelems0_) ; if (mcstrt_ == 0) mcstrt_ = new CoinBigIndex [ncols0_+1] ; if (hincol_ == 0) hincol_ = new int [ncols0_+1] ; if (hrow_ == 0) hrow_ = new int [bulk0_] ; if (colels_ == 0) colels_ = new double [bulk0_] ; if (mrstrt_ == 0) mrstrt_ = new CoinBigIndex [nrows0_+1] ; if (hinrow_ == 0) hinrow_ = new int [nrows0_+1] ; if (hcol_ == 0) hcol_ = new int [bulk0_] ; if (rowels_ == 0) rowels_ = new double [bulk0_] ; /* Grab the corresponding vectors from the source matrix. */ const CoinBigIndex *src_mcstrt = mtx->getVectorStarts() ; const int *src_hincol = mtx->getVectorLengths() ; const double *src_colels = mtx->getElements() ; const int *src_hrow = mtx->getIndices() ; /* Bulk copy the column starts and lengths. */ CoinMemcpyN(src_mcstrt,mtx->getSizeVectorStarts(),mcstrt_) ; CoinMemcpyN(src_hincol,mtx->getSizeVectorLengths(),hincol_) ; /* Copy the coefficients column by column in case there are gaps between the columns in the bulk storage area. The assert is just in case the gaps are *really* big. */ assert(src_mcstrt[ncols_] <= bulk0_) ; int j; for ( j = 0 ; j < numCols ; j++) { int lenj = src_hincol[j] ; CoinBigIndex offset = mcstrt_[j] ; CoinMemcpyN(src_colels+offset,lenj,colels_+offset) ; CoinMemcpyN(src_hrow+offset,lenj,hrow_+offset) ; } /* Now make a row-major copy. Start by counting the number of coefficients in each row; we can do this directly in hinrow. Given the number of coefficients in a row, we know how to lay out the bulk storage area. */ CoinZeroN(hinrow_,nrows0_+1) ; for ( j = 0 ; j < ncols_ ; j++) { int *rowIndices = hrow_+mcstrt_[j] ; int lenj = hincol_[j] ; for (int k = 0 ; k < lenj ; k++) { int i = rowIndices[k] ; hinrow_[i]++ ; } } /* Initialize mrstrt[i] to the start of row i+1. As we drop each coefficient and column index into the bulk storage arrays, we'll decrement and store. When we're done, mrstrt[i] will point to the start of row i, as it should. */ int totalCoeffs = 0 ; int i; for ( i = 0 ; i < nrows_ ; i++) { totalCoeffs += hinrow_[i] ; mrstrt_[i] = totalCoeffs ; } mrstrt_[nrows_] = totalCoeffs ; for ( j = ncols_-1 ; j >= 0 ; j--) { int lenj = hincol_[j] ; double *colCoeffs = colels_+mcstrt_[j] ; int *rowIndices = hrow_+mcstrt_[j] ; for (int k = 0 ; k < lenj ; k++) { int ri; ri = rowIndices[k] ; double aij = colCoeffs[k] ; CoinBigIndex l = --mrstrt_[ri] ; rowels_[l] = aij ; hcol_[l] = j ; } } /* Now the support structures. The entry for original column j should start out as j; similarly for row i. originalColumn_ and originalRow_ belong to the PrePostsolve object. */ if (originalColumn_ == 0) originalColumn_ = new int [ncols0_] ; if (originalRow_ == 0) originalRow_ = new int [nrows0_] ; for ( j = 0 ; j < ncols0_ ; j++) originalColumn_[j] = j ; for ( i = 0 ; i < nrows0_ ; i++) originalRow_[i] = i ; /* We have help to set up the clink_ and rlink_ vectors (aids for matrix bulk storage management). clink_ and rlink_ belong to the Presolve object. Once this is done, it's safe to set mrstrt_[nrows_] and mcstrt_[ncols_] to the full size of the bulk storage area. */ if (clink_ == 0) clink_ = new presolvehlink [ncols0_+1] ; if (rlink_ == 0) rlink_ = new presolvehlink [nrows0_+1] ; presolve_make_memlists(/*mcstrt_,*/hincol_,clink_,ncols_) ; presolve_make_memlists(/*mrstrt_,*/hinrow_,rlink_,nrows_) ; mcstrt_[ncols_] = bulk0_ ; mrstrt_[nrows_] = bulk0_ ; /* No rows or columns have been changed just yet. colChanged_ and rowChanged_ belong to the Presolve object. */ if (colChanged_ == 0) colChanged_ = new unsigned char [ncols0_] ; CoinZeroN(colChanged_,ncols0_) ; if (rowChanged_ == 0) rowChanged_ = new unsigned char [nrows0_] ; CoinZeroN(rowChanged_,nrows0_) ; /* Finally, allocate the various *ToDo arrays. These are used to track the rows and columns which should be processed in a given round of presolve transforms. These belong to the Presolve object. Setting number*ToDo to 0 is all the initialization that's required here. */ rowsToDo_ = new int [nrows0_] ; numberRowsToDo_ = 0 ; nextRowsToDo_ = new int [nrows0_] ; numberNextRowsToDo_ = 0 ; colsToDo_ = new int [ncols0_] ; numberColsToDo_ = 0 ; nextColsToDo_ = new int [ncols0_] ; numberNextColsToDo_ = 0 ; initializeStuff(); return ; } /* Recompute ups and downs for a row (nonzero if infeasible). If oneRow == -1 then do all rows. */ int CoinPresolveMatrix::recomputeSums (int oneRow) { const int &numberRows = nrows_ ; const int &numberColumns = ncols_ ; const double *const columnLower = clo_ ; const double *const columnUpper = cup_ ; double *const rowLower = rlo_ ; double *const rowUpper = rup_ ; const double *element = rowels_ ; const int *column = hcol_ ; const CoinBigIndex *rowStart = mrstrt_ ; const int *rowLength = hinrow_ ; const double large = PRESOLVE_SMALL_INF ; const double &tolerance = feasibilityTolerance_ ; const int iFirst = ((oneRow >= 0)?oneRow:0) ; const int iLast = ((oneRow >= 0)?oneRow:numberRows) ; /* Open a loop to process rows of interest. */ int infeasible = 0 ; for (int iRow = iFirst ; iRow < iLast ; iRow++) { infiniteUp_[iRow] = 0 ; sumUp_[iRow] = 0.0 ; infiniteDown_[iRow] = 0 ; sumDown_[iRow] = 0.0 ; /* Compute finite and infinite contributions to row lhs upper and lower bounds for nonempty rows with at least one reasonable bound. */ if ((rowLower[iRow] > -large || rowUpper[iRow] < large) && rowLength[iRow] > 0) { int infiniteUpper = 0 ; int infiniteLower = 0 ; double maximumUp = 0.0 ; double maximumDown = 0.0 ; const CoinBigIndex &rStart = rowStart[iRow] ; const CoinBigIndex rEnd = rStart+rowLength[iRow] ; for (CoinBigIndex j = rStart ; j < rEnd ; ++j) { const double &value = element[j] ; const int &iColumn = column[j] ; const double &lj = columnLower[iColumn] ; const double &uj = columnUpper[iColumn] ; if (value > 0.0) { if (uj < large) maximumUp += uj*value ; else ++infiniteUpper ; if (lj > -large) maximumDown += lj*value ; else ++infiniteLower ; } else if (value < 0.0) { if (uj < large) maximumDown += uj*value ; else ++infiniteLower ; if (lj > -large) maximumUp += lj*value ; else ++infiniteUpper ; } } infiniteUp_[iRow] = infiniteUpper ; sumUp_[iRow] = maximumUp ; infiniteDown_[iRow] = infiniteLower ; sumDown_[iRow] = maximumDown ; double maxUp = maximumUp+infiniteUpper*large ; double maxDown = maximumDown-infiniteLower*large ; /* Check for redundant or infeasible row. */ if (maxUp <= rowUpper[iRow]+tolerance && maxDown >= rowLower[iRow]-tolerance) { infiniteUp_[iRow] = numberColumns+1 ; infiniteDown_[iRow] = numberColumns+1 ; } else if (maxUp < rowLower[iRow]-tolerance) { infeasible++ ; } else if (maxDown > rowUpper[iRow]+tolerance) { infeasible++ ; } } else if (rowLength[iRow] > 0) { /* A row where both rhs bounds are very large. Mark as redundant. */ assert(rowLower[iRow] <= -large && rowUpper[iRow] >= large) ; infiniteUp_[iRow] = numberColumns+1 ; infiniteDown_[iRow] = numberColumns+1 ; } else { /* Row with length zero. Check the the rhs bounds include zero and force `near-to-zero' to exactly zero. */ assert(rowLength[iRow] == 0) ; if (rowLower[iRow] > 0.0 || rowUpper[iRow] < 0.0) { double tolerance2 = 10.0*tolerance ; if (rowLower[iRow] > 0.0 && rowLower[iRow] < tolerance2) rowLower[iRow] = 0.0 ; else infeasible++ ; if (rowUpper[iRow] < 0.0 && rowUpper[iRow] > -tolerance2) rowUpper[iRow] = 0.0 ; else infeasible++ ; } } } return (infeasible) ; } /* Preallocate scratch work arrays, arrays to hold row lhs bound information, and an array of random numbers. */ void CoinPresolveMatrix::initializeStuff () { usefulRowInt_ = new int [3*nrows_] ; usefulRowDouble_ = new double [2*nrows_] ; usefulColumnInt_ = new int [2*ncols_] ; usefulColumnDouble_ = new double[ncols_] ; int k = CoinMax(ncols_+1,nrows_+1) ; randomNumber_ = new double [k] ; coin_init_random_vec(randomNumber_,k) ; infiniteUp_ = new int [nrows_] ; sumUp_ = new double [nrows_] ; infiniteDown_ = new int [nrows_] ; sumDown_ = new double [nrows_] ; return ; } /* Free arrays allocated in initializeStuff. */ void CoinPresolveMatrix::deleteStuff() { delete[] usefulRowInt_; delete[] usefulRowDouble_; delete[] usefulColumnInt_; delete[] usefulColumnDouble_; delete[] randomNumber_; delete[] infiniteUp_; delete[] sumUp_; delete[] infiniteDown_; delete[] sumDown_; usefulRowInt_ = NULL; usefulRowDouble_ = NULL; usefulColumnInt_ = NULL; usefulColumnDouble_ = NULL; randomNumber_ = NULL; infiniteUp_ = NULL; sumUp_ = NULL; infiniteDown_ = NULL; sumDown_ = NULL; } /* These functions set integer type information. The first expects an array with an entry for each variable. The second sets all variables to integer or continuous type. */ void CoinPresolveMatrix::setVariableType (const unsigned char *variableType, int lenParam) { int len ; if (lenParam < 0) { len = ncols_ ; } else if (lenParam > ncols0_) { throw CoinError("length exceeds allocated size", "setIntegerType","CoinPresolveMatrix") ; } else { len = lenParam ; } if (integerType_ == 0) integerType_ = new unsigned char [ncols0_] ; CoinCopyN(variableType,len,integerType_) ; return ; } void CoinPresolveMatrix::setVariableType (bool allIntegers, int lenParam) { int len ; if (lenParam < 0) { len = ncols_ ; } else if (lenParam > ncols0_) { throw CoinError("length exceeds allocated size", "setIntegerType","CoinPresolveMatrix") ; } else { len = lenParam ; } if (integerType_ == 0) integerType_ = new unsigned char [ncols0_] ; const unsigned char value = 1 ; if (allIntegers == true) { CoinFillN(integerType_,len,value) ; } else { CoinZeroN(integerType_,len) ; } return ; } /* The next pair of routines initialises the [row,col]ToDo lists in preparation for a major pass. All except rows/columns marked as prohibited are added to the lists. */ void CoinPresolveMatrix::initColsToDo () /* Initialize the ToDo lists in preparation for a major iteration of preprocessing. First, cut back the ToDo and NextToDo lists to zero entries. Then place all columns not marked prohibited on the ToDo list. */ { int j ; numberNextColsToDo_ = 0 ; if (anyProhibited_ == false) { for (j = 0 ; j < ncols_ ; j++) { colsToDo_[j] = j ; } numberColsToDo_ = ncols_ ; } else { numberColsToDo_ = 0 ; for (j = 0 ; j < ncols_ ; j++) if (colProhibited(j) == false) { colsToDo_[numberColsToDo_++] = j ; } } return ; } void CoinPresolveMatrix::initRowsToDo () /* Initialize the ToDo lists in preparation for a major iteration of preprocessing. First, cut back the ToDo and NextToDo lists to zero entries. Then place all rows not marked prohibited on the ToDo list. */ { int i ; numberNextRowsToDo_ = 0 ; if (anyProhibited_ == false) { for (i = 0 ; i < nrows_ ; i++) { rowsToDo_[i] = i ; } numberRowsToDo_ = nrows_ ; } else { numberRowsToDo_ = 0 ; for (i = 0 ; i < nrows_ ; i++) if (rowProhibited(i) == false) { rowsToDo_[numberRowsToDo_++] = i ; } } return ; } int CoinPresolveMatrix::stepColsToDo () /* This routine transfers the contents of NextToDo to ToDo, simultaneously resetting the Changed indicator. It returns the number of columns transfered. */ { int k ; for (k = 0 ; k < numberNextColsToDo_ ; k++) { int j = nextColsToDo_[k] ; unsetColChanged(j) ; colsToDo_[k] = j ; } numberColsToDo_ = numberNextColsToDo_ ; numberNextColsToDo_ = 0 ; return (numberColsToDo_) ; } int CoinPresolveMatrix::stepRowsToDo () /* This routine transfers the contents of NextToDo to ToDo, simultaneously resetting the Changed indicator. It returns the number of columns transfered. */ { int k ; for (k = 0 ; k < numberNextRowsToDo_ ; k++) { int i = nextRowsToDo_[k] ; unsetRowChanged(i) ; rowsToDo_[k] = i ; } numberRowsToDo_ = numberNextRowsToDo_ ; numberNextRowsToDo_ = 0 ; return (numberRowsToDo_) ; } // Say we want statistics - also set time void CoinPresolveMatrix::statistics() { tuning_=true; startTime_ = CoinCpuTime(); } #ifdef PRESOLVE_DEBUG #include "CoinPresolvePsdebug.cpp" #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolvePsdebug.cpp0000644000175000017500000010725112054012315020441 0ustar renerene/* $Id: CoinPresolvePsdebug.cpp 1560 2012-11-24 00:29:01Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include "CoinPresolveMatrix.hpp" #include "CoinHelperFunctions.hpp" /* \file This file contains a number of routines that are useful when doing serious debugging but unneeded otherwise. It also contains the methods that implement the CoinPresolveMonitor class. Presumably if you're deep enough into presolve to need these, you're willing to scan the file to see what can be done. See also the Presolve Debug Functions module in the doxygen doc'n and CoinPresolvePsdebug.hpp. The general approach for the matrix consistency routines is that the routines return void and abort when they find a problem. The routines that check the basis and solution complain loudly but do not abort. NOTE: The definitions for PRESOLVE_CONSISTENCY and PRESOLVE_DEBUG MUST BE CONSISTENT across all CoinPresolve source files AND OsiPresolve AND ClpPresolve AND OsiDylpPresolve (assuming any of the latter are relevant to your code). Otherwise, at best you'll get garbage output. More likely, you'll get a core dump. Resist the temptation to define these constants in individual files. In particular, cdone and rdone will NOT be consistently maintained during postsolve. Hack away as your needs dictate. */ /* Integrity checking routines for the (loosely) packed matrices of a CoinPresolveMatrix object. Some routines work on column-major and row-major reps separately, others do cross-checking. */ namespace { // begin unnamed file-local namespace #if PRESOLVE_DEBUG || PRESOLVE_CONSISTENCY /* Check for duplicate entries in a major vector by walking the vector. For each coefficient, use presolve_find_minor1 to search the remainder of the major vector for an entry with the same minor index. We don't want to find anything. */ void no_majvec_dups (const char *majdones, const CoinBigIndex *majstrts, const int *minndxs, const int *majlens, int nmaj) { for (int maj = 0 ; maj < nmaj ; maj++) { if ((!majdones || majdones[maj]) && majlens[maj] > 0) { CoinBigIndex ks = majstrts[maj] ; CoinBigIndex ke = ks+majlens[maj] ; for (CoinBigIndex k = ks ; k < ke ; k++) { /* Assert we fell off the end of the major vector without finding the entry. */ PRESOLVEASSERT(presolve_find_minor1(minndxs[k],k+1, ke,minndxs) == ke) ; } } } return ; } /* As the name implies: scan for explicit zeros. */ void check_majvec_nozeros (const CoinBigIndex *majstrts, const double *majels, const int *majlens, int nmaj) { for (int maj = 0 ; maj < nmaj ; maj++) { if (majlens[maj] > 0) { CoinBigIndex ks = majstrts[maj] ; CoinBigIndex ke = ks+majlens[maj] ; for (CoinBigIndex k = ks ; k < ke ; k++) { PRESOLVEASSERT(fabs(majels[k]) > ZTOLDP) ; } } } return ; } /* Integrity checks for the linked lists that indicate major vector ordering in the bulk storage area (minor index and coefficient arrays). */ void links_ok (presolvehlink *majlink, int *majstrts, int *majlens, int nmaj) { int maj ; /* Confirm link integrity. Vectors of length 0 should not be part of the chain. */ for (maj = 0 ; maj < nmaj ; maj++) { int pre = majlink[maj].pre ; int suc = majlink[maj].suc ; if (majlens[maj] == 0) { PRESOLVEASSERT(pre == NO_LINK && suc == NO_LINK) ; } if (pre != NO_LINK) { PRESOLVEASSERT(0 <= pre && pre <= nmaj) ; PRESOLVEASSERT(majlink[pre].suc == maj) ; } if (suc != NO_LINK) { PRESOLVEASSERT(0 <= suc && suc <= nmaj) ; PRESOLVEASSERT(majlink[suc].pre == maj) ; } } /* There must be a first vector. */ for (maj = 0 ; maj < nmaj ; maj++) { if (majlink[maj].pre == NO_LINK) break ; } PRESOLVEASSERT(nmaj == 0 || maj < nmaj) ; /* The order of the linked list should match the ordering indicated by the major vector start & length arrays. */ while (maj != NO_LINK) { if (majlink[maj].suc != NO_LINK) { PRESOLVEASSERT(majstrts[maj]+majlens[maj] <= majstrts[majlink[maj].suc]) ; } maj = majlink[maj].suc ; } return ; } /* matrix_consistent checks that an entry is in the column-major representation if it is in the row-major representation. If testvals is non-zero, it also checks that their values are the same. By doing the appropriate swaps of column- and row-major data structures in the parameter list, we can check that an entry is in the row-major representation if it's in the column-major representation. I can't see any nice way to rename the parameters (majmajstrt? minmajstrt?). Original comment: ``Note that there may be entries in a row that correspond to empty columns and vice-versa.'' To which a previous browser had commented ``HUH???''. And I agree. -- lh, 040907 -- */ void matrix_consistent (const CoinBigIndex *mrstrt, const int *hinrow, const int *hcol, const double *rowels, const CoinBigIndex *mcstrt, const int *hincol, const int *hrow, const double *colels, int nrows, int testvals, const char *ROW, const char *COL) { for (int irow = 0 ; irow < nrows ; irow++) { if (hinrow[irow] > 0) { const CoinBigIndex krs = mrstrt[irow] ; const CoinBigIndex kre = krs+hinrow[irow] ; for (CoinBigIndex k = krs ; k < kre ; k++) { int jcol = hcol[k] ; const CoinBigIndex kcs = mcstrt[jcol] ; const CoinBigIndex kce = kcs+hincol[jcol] ; CoinBigIndex kk = presolve_find_row1(irow,kcs,kce,hrow) ; if (kk == kce) { std::cout << "MATRIX INCONSISTENT: can't find " << ROW << " " << irow << " in " << COL << " " << jcol << std::endl ; fflush(stdout) ; abort() ; } if (testvals && colels[kk] != rowels[k]) { std::cout << "MATRIX INCONSISTENT: values differ for " << ROW << " " << irow << " and " << COL << " " << jcol << std::endl ; fflush(stdout) ; abort() ; } } } } } #endif } // end unnamed file-local namespace /* Utilizes matrix_consistent to check for equivalence of the column- and row-major representations. Checks for presence of coefficients in the column-major matrix, given presence in the row-major matrix, then checks for presence in the row-major matrix given presence in the column-major matrix. If testvals == true (default), the check also tests that the coefficients have equal value. See further comments with matrix_consistent. */ # if PRESOLVE_CONSISTENCY void presolve_consistent(const CoinPresolveMatrix *preObj, bool testvals) { matrix_consistent(preObj->mrstrt_,preObj->hinrow_,preObj->hcol_, preObj->rowels_, preObj->mcstrt_,preObj->hincol_,preObj->hrow_, preObj->colels_, preObj->nrows_,testvals,"row","col") ; matrix_consistent(preObj->mcstrt_,preObj->hincol_,preObj->hrow_, preObj->colels_, preObj->mrstrt_,preObj->hinrow_,preObj->hcol_, preObj->rowels_, preObj->ncols_,testvals,"col","row") ; } /* Check the column- and/or row-major matrices for duplicates. By default, both will be checked. */ void presolve_no_dups (const CoinPresolveMatrix *preObj, bool doCol, bool doRow) { if (doCol) { no_majvec_dups(0,preObj->mcstrt_,preObj->hrow_, preObj->hincol_,preObj->ncols_) ; } if (doRow) { no_majvec_dups(0,preObj->mrstrt_,preObj->hcol_, preObj->hinrow_,preObj->nrows_) ; } return ; } /* As the name implies: scan for explicit zeros. By default, both matrices are scanned. */ void presolve_no_zeros (const CoinPresolveMatrix *preObj, bool doCol, bool doRow) { if (doCol) { check_majvec_nozeros(preObj->mcstrt_,preObj->colels_,preObj->hincol_, preObj->ncols_) ; } if (doRow) { check_majvec_nozeros(preObj->mrstrt_,preObj->rowels_,preObj->hinrow_, preObj->nrows_) ; } return ; } /* Lazy check on column lengths. Scan the row index array for the column. If the relevant row length in the row-major rep is non-zero, assume we're ok. Not advertised in CoinPresolvePsdebug.hpp. */ void presolve_hincol_ok(const int *mcstrt, const int *hincol, const int *hinrow, const int *hrow, int ncols) { int jcol; for (jcol=0; jcol 0) { int kcs = mcstrt[jcol]; int kce = kcs + hincol[jcol]; int n=0; int k; for (k=kcs; k 0) n++; } if (n != hincol[jcol]) abort(); } } /* Integrity checks for the linked lists that indicate major vector ordering in the bulk storage area (minor index and coefficient arrays). */ void presolve_links_ok (const CoinPresolveMatrix *preObj, bool doCol, bool doRow) { if (doCol) { links_ok(preObj->clink_,preObj->mcstrt_, preObj->hincol_,preObj->ncols_) ; } if (doRow) { links_ok(preObj->rlink_,preObj->mrstrt_, preObj->hinrow_,preObj->nrows_) ; } return ; } /* Routines to check a threaded matrix from a CoinPostsolve object. */ /* Check that the column length agrees with the column thread. There must be the correct number of coefficients, and the thread must end with the NO_LINK marker. */ void presolve_check_threads (const CoinPostsolveMatrix *obj) { CoinBigIndex *mcstrt = obj->mcstrt_ ; int *hincol = obj->hincol_ ; CoinBigIndex *link = obj->link_ ; char *cdone = obj->cdone_ ; int n = obj->ncols0_ ; /* Scan the columns, checking only the ones that have been processed into the constraint matrix. */ for (int j = 0 ; j < n ; j++) { if (!cdone[j]) continue ; int lenj = hincol[j] ; int k ; for (k = mcstrt[j] ; k != NO_LINK && lenj > 0 ; k = link[k]) { assert(k >= 0 && k < obj->maxlink_) ; lenj-- ; } assert(k == NO_LINK && lenj == 0) ; } return ; } /* Check the free list. We're looking for gross corruption here. The notion is that the free list plus elements in the matrix should add up to the capacity of the bulk store. */ void presolve_check_free_list (const CoinPostsolveMatrix *obj, bool chkElemCnt) { CoinBigIndex k = obj->free_list_ ; CoinBigIndex freeCnt = 0 ; CoinBigIndex maxlink = obj->maxlink_ ; CoinBigIndex *link = obj->link_ ; /* Redundancy in the data structure. These should always be equal. */ assert(maxlink == obj->bulk0_) ; /* Walk the free list portion of link. We should never point outside the bulk store. If we ever come across an entry that's less than 0, it had better be NO_LINK, the end marker. */ while (k >= 0) { assert(k < maxlink) ; freeCnt++ ; k = link[k] ; } assert(k == NO_LINK) ; /* And a final test: elements in the matrix plus free space should equal the size of the bulk area. A good thought, but less than practical. Currently postsolve doesn't track the number of elements in the matrix. But you might find it useful if you're checking a newly constructed postsolve matrix. Even then, you need to make sure nelems_ is correct. In the normal scheme of things, this requires that somewhere there's a count of elements. Right now, drop_empty_cols_action::presolve does this count, and you can get an accurate value from the presolve object. assignPresolveToPostsolve will transfer this value. Otherwise you're on your own --- your constructor must somehow find this count. Using a standard CoinPackedMatrix is another way to get a count. */ if (chkElemCnt) { assert(obj->nelems_+freeCnt == maxlink) ; } return ; } #endif /* Routines to check solution and basis composition. */ /* CoinPostsolveMatrix This routine performs two checks on reduced costs held in rcosts_: * The value held in rcosts_ is checked against the status of the variable. Errors reported as "Bad rcost" * The reduced cost is calculated from scratch and compared to the value held in rcosts_. Errors reported as "Inacc rcost" Remember that postsolve has a schizophrenic attitude about maximisation. All transforms assume minimisation, and that's reflected in the reduced costs we see here. And you must load duals and reduced costs with the correct sign for minimisation. But, as a small courtesy (and a big inconsistency), postsolve will negate objective coefficients for you. Hence the rather odd use of maxmin. The routine is specific to CoinPostsolveMatrix because the reduced cost calculation requires traversal of (threaded) matrix columns. NOTE: This routine holds static variables. It will detect when the problem size changes and reinitialise. If you use presolve debugging over multiple problems and you want to be dead sure of reinitialisation, use the call presolve_check_reduced_costs(0), which will reinitialise and return. */ # if PRESOLVE_DEBUG void presolve_check_reduced_costs (const CoinPostsolveMatrix *postObj) { static bool warned = false ; static double *warned_rcosts = 0 ; static int allocSize = 0 ; static const CoinPostsolveMatrix *lastObj = 0 ; /* Is the client asking for reinitialisation only? */ if (postObj == 0) { warned = false ; if (warned_rcosts != 0) { delete[] warned_rcosts ; warned_rcosts = 0 ; } allocSize = 0 ; lastObj = 0 ; return ; } /* *Should* the client have asked for reinitialisation? */ int ncols0 = postObj->ncols0_ ; if (allocSize < ncols0 || postObj != lastObj) { warned = false ; delete[] warned_rcosts ; warned_rcosts = 0 ; allocSize = 0 ; lastObj = postObj ; } double *rcosts = postObj->rcosts_ ; /* By tracking values in warned_rcosts, we can produce a single message the first time a value is determined to be incorrect. */ if (!warned) { warned = true ; std::cout << "reduced cost" << std::endl ; warned_rcosts = new double[ncols0] ; CoinZeroN(warned_rcosts,ncols0) ; } double *colels = postObj->colels_ ; int *hrow = postObj->hrow_ ; int *mcstrt = postObj->mcstrt_ ; int *hincol = postObj->hincol_ ; CoinBigIndex *link = postObj->link_ ; double *clo = postObj->clo_ ; double *cup = postObj->cup_ ; double *dcost = postObj->cost_ ; double *sol = postObj->sol_ ; char *cdone = postObj->cdone_ ; char *rdone = postObj->rdone_ ; const double ztoldj = postObj->ztoldj_ ; const double ztolzb = postObj->ztolzb_ ; double *rowduals = postObj->rowduals_ ; double maxmin = postObj->maxmin_ ; std::string strMaxmin((maxmin < 0)?"max":"min") ; int checkCol = -1 ; /* Scan all columns, but only check the ones that are marked as having been postprocessed. */ for (int j = 0 ; j < ncols0 ; j++) { if (cdone[j] == 0) continue ; const char *statjstr = postObj->columnStatusString(j) ; /* Check the stored reduced cost for accuracy. See note above w.r.t. maxmin. */ double dj = rcosts[j] ; double wrndj = warned_rcosts[j] ; { int ndx ; CoinBigIndex k = mcstrt[j] ; int len = hincol[j] ; double chkdj = maxmin*dcost[j] ; if (j == checkCol) std::cout << "dj for " << j << " is " << dj << " - cost is " << chkdj << std::endl ; for (ndx = 0 ; ndx < len ; ndx++) { int row = hrow[k] ; PRESOLVEASSERT(rdone[row] != 0) ; chkdj -= rowduals[row]*colels[k] ; if (j == checkCol) std::cout << "row " << row << " coeff " << colels[k] << " dual " << rowduals[row] << " => dj " << chkdj << std::endl ; k = link[k] ; } if (fabs(dj-chkdj) > ztoldj && wrndj != dj) { std::cout << "Inacc rcost: " << j << " " << statjstr << " " << strMaxmin << " have " << dj << " should be " << chkdj << " err " << fabs(dj-chkdj) << std::endl ; } } /* Check the stored reduced cost for consistency with the variable's status. The cases are * basic: (reduced cost) == 0 * at upper bound and not at lower bound: (reduced cost)*(maxmin) <= 0 * at lower bound and not at upper bound: (reduced cost)*(maxmin) >= 0 * not at either bound: any sign is correct (the variable can move either way) but superbasic status is sufficiently exotic that it always deserves a message. (There should be no superbasic variables at the completion of postsolve.) As a courtesy, show the reduced cost with the proper sign. */ { double xj = sol[j] ; double lj = clo[j] ; double uj = cup[j] ; if (postObj->columnIsBasic(j)) { if (fabs(dj) > ztoldj && wrndj != dj) { std::cout << "Bad rcost: " << j << " " << maxmin*dj << " " << statjstr << " " << strMaxmin << std::endl ; } } else if (fabs(xj-uj) < ztolzb && fabs(xj-lj) > ztolzb) { if (dj >= ztoldj && wrndj != dj) { std::cout << "Bad rcost: " << j << " " << maxmin*dj << " " << statjstr << " " << strMaxmin << std::endl ; } } else if (fabs(xj-lj) < ztolzb && fabs(xj-uj) > ztolzb) { if (dj <= -ztoldj && wrndj != dj) { std::cout << "Bad rcost: " << j << " " << maxmin*dj << " " << statjstr << " " << strMaxmin << std::endl ; } } else if (fabs(xj-lj) > ztolzb && fabs(xj-uj) > ztolzb) { if (fabs(dj) > ztoldj && wrndj != dj) { std::cout << "Superbasic rcost: " << j << " " << maxmin*dj << " " << statjstr << " " << strMaxmin << " lb "<< lj << " val " << xj << " ub "<< uj << std::endl ; } } } warned_rcosts[j] = rcosts[j] ; } } /* CoinPostsolveMatrix This routine checks the value and status of the dual variables. It checks that the value and status of the dual agree with the row activity. Errors are reported as "Bad dual" See presolve_check_reduced_costs for an explanation of the use of maxmin. Specific to CoinPostsolveMatrix due to the use of rdone. This could be fixed, but probably better to clone the function and specialise it for CoinPresolveMatrix. */ void presolve_check_duals (const CoinPostsolveMatrix *postObj) { int nrows0 = postObj->nrows0_ ; double *rowduals = postObj->rowduals_ ; double *acts = postObj->acts_ ; double *rup = postObj->rup_ ; double *rlo = postObj->rlo_ ; char *rdone = postObj->rdone_ ; const double ztoldj = postObj->ztoldj_ ; const double ztolzb = postObj->ztolzb_ ; double maxmin = postObj->maxmin_ ; std::string strMaxmin((maxmin < 0)?"max":"min") ; /* Scan all processed rows. The rules are as for normal reduced costs, but we need to remember the various flips and inversions. In summary, the correct situation at optimality (minimisation) is: * acts[i] == rup[i] ==> artificial NBLB ==> dual[i] < 0 * acts[i] == rlo[i] ==> artificial NBUB ==> dual[i] > 0 We can't say much about the dual for an equality. It can go either way. As a courtesy, show the dual with the proper sign. */ for (int i = 0 ; i < nrows0 ; i++) { if (rdone[i] == 0) continue ; double ui = rup[i] ; double li = rlo[i] ; if (ui-li < 1.0e-6) continue ; double yi = rowduals[i] ; double lhsi = acts[i] ; const char *statistr = postObj->rowStatusString(i) ; if (fabs(lhsi-li) < ztolzb) { if (yi < -ztoldj) { std::cout << "Bad dual: " << i << " " << maxmin*yi << " " << statistr << " " << strMaxmin << std::endl ; } } else if (fabs(lhsi-ui) < ztolzb) { if (yi > ztoldj) { std::cout << "Bad dual: " << i << " " << maxmin*yi << " " << statistr << " " << strMaxmin << std::endl ; } } else if (li < lhsi && lhsi < ui) { if (fabs(yi) > ztoldj) { std::cout << "Bad dual: " << i << " " << maxmin*yi << " " << statistr << " " << strMaxmin << std::endl ; } } } return ; } /* CoinPresolveMatrix This routine will check the primal (column) solution for feasibility and status. If there's no column solution (sol_), the routine bails out. If the column solution is present, all else is assumed to be present. chkColSol: check colum solution (primal variables) 0 - checks off 1 - check for NaN/Inf *2 - check for above/below column bounds chkRowAct: check row solution (evaluate constraint lhs) 0 - checks off *1 - check for NaN/Inf 2 - check for inaccuracy, above/below row bounds chkStatus: check for valid status of variables 0 - checks off *1 - check status of architecturals, if colstat_ exists 2 - check status rows, if rowstat_ exists In order to check row status we need accurate row activity. Setting chkStatus to 2 forces chkRowAct to 2. CoinPrePostsolveMatrix plays games with colstat_ and rowstat_, allocating them as a single vector, so if colstat_ exists, rowstat_ really should exist. Check it anyway; this is a debug method, be robust. In general, the presolve transforms are not prepared to properly adjust the row activity (reported as `Inacc RSOL'). Postsolve transforms do better. On the bright side, the code seems to work just fine without maintaining row activity. You probably don't want to use the level 2 checks for the row solution, particularly in presolve. With a bit of thought, the various checks could be more cleanly separated to require only the minimum information for each check. */ void presolve_check_sol (const CoinPresolveMatrix *preObj, int chkColSol, int chkRowAct, int chkStatus) { double *colels = preObj->colels_ ; int *hrow = preObj->hrow_ ; int *mcstrt = preObj->mcstrt_ ; int *hincol = preObj->hincol_ ; int *hinrow = preObj->hinrow_ ; int n = preObj->ncols_ ; int m = preObj->nrows_ ; /* If there's no column solution, bail out now. */ if (preObj->sol_ == 0) return ; double *csol = preObj->sol_ ; double *acts = preObj->acts_ ; double *clo = preObj->clo_ ; double *cup = preObj->cup_ ; double *rlo = preObj->rlo_ ; double *rup = preObj->rup_ ; double tol = preObj->ztolzb_ ; if (chkStatus >= 2) chkRowAct = 2 ; double *rsol = 0 ; if (chkRowAct) { rsol = new double[m] ; memset(rsol,0,m*sizeof(double)) ; } /* Open a loop to scan each column. For each column, do the following: * Update the row solution (lhs value) by adding the contribution from this column. * Check for bogus values (NaN, infinity) * Check for feasibility (value within column bounds) * Check that the status of the variable agrees with the value and with the lower and upper bounds. Free should have no bounds, superbasic should have at least one. */ for (int j = 0 ; j < n ; ++j) { CoinBigIndex v = mcstrt[j] ; int colLen = hincol[j] ; double xj = csol[j] ; double lj = clo[j] ; double uj = cup[j] ; if (chkRowAct >= 1) { for (int u = 0 ; u < colLen ; ++u) { int i = hrow[v] ; double aij = colels[v] ; v++ ; rsol[i] += aij*xj ; } } if (chkColSol > 0) { if (CoinIsnan(xj)) { printf("NaN CSOL: %d : lb = %g x = %g ub = %g\n",j,lj,xj,uj) ; } if (xj <= -PRESOLVE_INF || xj >= PRESOLVE_INF) { printf("Inf CSOL: %d : lb = %g x = %g ub = %g\n",j,lj,xj,uj) ; } if (chkColSol > 1) { if (xj < lj-tol) { printf("low CSOL: %d : lb = %g x = %g ub = %g\n",j,lj,xj,uj) ; } else if (xj > uj+tol) { printf("high CSOL: %d : lb = %g x = %g ub = %g\n", j,lj,xj,uj) ; } } } if (chkStatus && preObj->colstat_) { CoinPrePostsolveMatrix::Status statj = preObj->getColumnStatus(j) ; switch (statj) { case CoinPrePostsolveMatrix::atUpperBound: { if (uj >= PRESOLVE_INF || fabs(xj-uj) > tol) { printf("Bad status CSOL: %d : status atUpperBound : ",j) ; printf("lb = %g x = %g ub = %g\n",lj,xj,uj) ; } break ; } case CoinPrePostsolveMatrix::atLowerBound: { if (lj <= -PRESOLVE_INF || fabs(xj-lj) > tol) { printf("Bad status CSOL: %d : status atLowerBound : ",j) ; printf("lb = %g x = %g ub = %g\n",lj,xj,uj) ; } break ; } case CoinPrePostsolveMatrix::isFree: { if (lj > -PRESOLVE_INF || uj < PRESOLVE_INF) { printf("Bad status CSOL: %d : status isFree : ",j) ; printf("lb = %g x = %g ub = %g\n",lj,xj,uj) ; } break ; } case CoinPrePostsolveMatrix::superBasic: { if (!(lj > -PRESOLVE_INF || uj < PRESOLVE_INF)) { printf("Bad status CSOL: %d : status superBasic : ",j) ; printf("lb = %g x = %g ub = %g\n",lj,xj,uj) ; } break ; } case CoinPrePostsolveMatrix::basic: { /* Nothing to do here. */ break ; } default: { printf("Bad status CSOL: %d : status unrecognized : ",j) ; break ; } } } } /* Now check the row solution. acts[i] is what presolve thinks we have, rsol[i] is what we've just calculated while scanning the columns. We need only check nontrivial rows (i.e., rows with length > 0). For each row, * Check for bogus values (NaN, infinity) * Check for accuracy (acts == rsol) * Check for feasibility (rsol within row bounds) */ tol *=1.0e3; if (chkRowAct >= 1) { for (int i = 0 ; i < m ; ++i) { if (hinrow[i]) { double lhsi = acts[i] ; double evali = rsol[i] ; double li = rlo[i] ; double ui = rup[i] ; if (CoinIsnan(evali) || CoinIsnan(lhsi)) { printf("NaN RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } if (evali <= -PRESOLVE_INF || evali >= PRESOLVE_INF || lhsi <= -PRESOLVE_INF || lhsi >= PRESOLVE_INF) { printf("Inf RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } if (chkRowAct >= 2) { if (fabs(evali-lhsi) > tol) { printf("Inacc RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } if (evali < li-tol || lhsi < li-tol) { printf("low RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } else if (evali > ui+tol || lhsi > ui+tol) { printf("high RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } } if (chkStatus >= 2 && preObj->rowstat_) { CoinPrePostsolveMatrix::Status stati = preObj->getRowStatus(i) ; switch (stati) { case CoinPrePostsolveMatrix::atUpperBound: { if (li <= -PRESOLVE_INF || fabs(lhsi-li) > tol) { printf("Bad status RSOL: %d : status atUpperBound : ",i) ; printf("LB = %g lhs = %g UB = %g\n",li,lhsi,ui) ; } break ; } case CoinPrePostsolveMatrix::atLowerBound: { if (ui >= PRESOLVE_INF || fabs(lhsi-ui) > tol) { printf("Bad status RSOL: %d : status atLowerBound : ",i) ; printf("LB = %g lhs = %g UB = %g\n",li,lhsi,ui) ; } break ; } case CoinPrePostsolveMatrix::isFree: { if (li > -PRESOLVE_INF || ui < PRESOLVE_INF) { printf("Bad status RSOL: %d : status isFree : ",i) ; printf("LB = %g lhs = %g UB = %g\n",li,lhsi,ui) ; } break ; } case CoinPrePostsolveMatrix::superBasic: { printf("Bad status RSOL: %d : status superBasic : ",i) ; printf("LB = %g lhs = %g UB = %g\n",li,lhsi,ui) ; break ; } case CoinPrePostsolveMatrix::basic: { /* Nothing to do here. */ break ; } default: { printf("Bad status RSOL: %d : status unrecognized : ",i) ; break ; } } } } } delete [] rsol ; } return ; } /* CoinPostsolveMatrix check_sol overload for CoinPostsolveMatrix. Parameters and functionality identical to check_sol immediately above, but we have to remember we're working with a threaded column-major representation. */ void presolve_check_sol (const CoinPostsolveMatrix *postObj, int chkColSol, int chkRowAct, int chkStatus) { double *colels = postObj->colels_ ; int *hrow = postObj->hrow_ ; int *mcstrt = postObj->mcstrt_ ; int *hincol = postObj->hincol_ ; int *link = postObj->link_ ; int n = postObj->ncols_ ; int m = postObj->nrows_ ; double *csol = postObj->sol_ ; double *acts = postObj->acts_ ; double *clo = postObj->clo_ ; double *cup = postObj->cup_ ; double *rlo = postObj->rlo_ ; double *rup = postObj->rup_ ; double tol = postObj->ztolzb_ ; if (chkStatus >= 2) chkRowAct = 2 ; double *rsol = 0 ; if (chkRowAct >= 1) { rsol = new double[m] ; memset(rsol,0,m*sizeof(double)) ; } /* Open a loop to scan each column. For each column, do the following: * Update the row solution (lhs value) by adding the contribution from this column. * Check for bogus values (NaN, infinity) * check that the status of the variable agrees with the value and with the lower and upper bounds. Free should have no bounds, superbasic should have at least one. */ for (int j = 0 ; j < n ; ++j) { CoinBigIndex v = mcstrt[j] ; int colLen = hincol[j] ; double xj = csol[j] ; double lj = clo[j] ; double uj = cup[j] ; if (chkRowAct >= 1) { for (int u = 0 ; u < colLen ; ++u) { int i = hrow[v] ; double aij = colels[v] ; v = link[v] ; rsol[i] += aij*xj ; } } if (chkColSol >= 1) { if (CoinIsnan(xj)) { printf("NaN CSOL: %d : lb = %g x = %g ub = %g\n",j,lj,xj,uj) ; } if (xj <= -PRESOLVE_INF || xj >= PRESOLVE_INF) { printf("Inf CSOL: %d : lb = %g x = %g ub = %g\n",j,lj,xj,uj) ; } if (chkColSol >= 2) { if (xj < lj-tol) { printf("low CSOL: %d : lb = %g x = %g ub = %g\n",j,lj,xj,uj) ; } else if (xj > uj+tol) { printf("high CSOL: %d : lb = %g x = %g ub = %g\n", j,lj,xj,uj) ; } } } if (chkStatus >= 1 && postObj->colstat_) { CoinPrePostsolveMatrix::Status statj = postObj->getColumnStatus(j) ; switch (statj) { case CoinPrePostsolveMatrix::atUpperBound: { if (uj >= PRESOLVE_INF || fabs(xj-uj) > tol) { printf("Bad status CSOL: %d : status atUpperBound : ",j) ; printf("lb = %g x = %g ub = %g\n",lj,xj,uj) ; } break ; } case CoinPrePostsolveMatrix::atLowerBound: { if (lj <= -PRESOLVE_INF || fabs(xj-lj) > tol) { printf("Bad status CSOL: %d : status atLowerBound : ",j) ; printf("lb = %g x = %g ub = %g\n",lj,xj,uj) ; } break ; } case CoinPrePostsolveMatrix::isFree: { if (lj > -PRESOLVE_INF || uj < PRESOLVE_INF) { printf("Bad status CSOL: %d : status isFree : ",j) ; printf("lb = %g x = %g ub = %g\n",lj,xj,uj) ; } break ; } case CoinPrePostsolveMatrix::superBasic: { if (!(lj > -PRESOLVE_INF || uj < PRESOLVE_INF)) { printf("Bad status CSOL: %d : status superBasic : ",j) ; printf("lb = %g x = %g ub = %g\n",lj,xj,uj) ; } break ; } case CoinPrePostsolveMatrix::basic: { /* Nothing to do here. */ break ; } default: { printf("Bad status CSOL: %d : status unrecognized : ",j) ; break ; } } } } /* Now check the row solution. acts[i] is what presolve thinks we have, rsol[i] is what we've just calculated while scanning the columns. CoinPostsolveMatrix does not contain hinrow_, so we can't check for trivial rows (cf. check_sol for CoinPresolveMatrix). For each row, * Check for bogus values (NaN, infinity) */ tol *= 1.0e4; if (chkRowAct >= 1) { for (int i = 0 ; i < m ; ++i) { double lhsi = acts[i] ; double evali = rsol[i] ; double li = rlo[i] ; double ui = rup[i] ; if (CoinIsnan(evali) || CoinIsnan(lhsi)) { printf("NaN RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } if (evali <= -PRESOLVE_INF || evali >= PRESOLVE_INF || lhsi <= -PRESOLVE_INF || lhsi >= PRESOLVE_INF) { printf("Inf RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } if (chkRowAct >= 2) { if (fabs(evali-lhsi) > tol) { printf("Inacc RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } if (evali < li-tol || lhsi < li-tol) { printf("low RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } else if (evali > ui+tol || lhsi > ui+tol) { printf("high RSOL: %d : lb = %g eval = %g (expected %g) ub = %g\n", i,li,evali,lhsi,ui) ; } } if (chkStatus >= 2 && postObj->rowstat_) { CoinPrePostsolveMatrix::Status stati = postObj->getRowStatus(i) ; switch (stati) { case CoinPrePostsolveMatrix::atUpperBound: { if (li <= -PRESOLVE_INF || fabs(lhsi-li) > tol) { printf("Bad status RSOL: %d : status atUpperBound : ",i) ; printf("LB = %g lhs = %g UB = %g\n",li,lhsi,ui) ; } break ; } case CoinPrePostsolveMatrix::atLowerBound: { if (ui >= PRESOLVE_INF || fabs(lhsi-ui) > tol) { printf("Bad status RSOL: %d : status atLowerBound : ",i) ; printf("LB = %g lhs = %g UB = %g\n",li,lhsi,ui) ; } break ; } case CoinPrePostsolveMatrix::isFree: { if (li > -PRESOLVE_INF || ui < PRESOLVE_INF) { printf("Bad status RSOL: %d : status isFree : ",i) ; printf("LB = %g lhs = %g UB = %g\n",li,lhsi,ui) ; } break ; } case CoinPrePostsolveMatrix::superBasic: { printf("Bad status RSOL: %d : status superBasic : ",i) ; printf("LB = %g lhs = %g UB = %g\n",li,lhsi,ui) ; break ; } case CoinPrePostsolveMatrix::basic: { /* Nothing to do here. */ break ; } default: { printf("Bad status RSOL: %d : status unrecognized : ",i) ; break ; } } } } delete [] rsol ; } return ; } /* CoinPostsolveMatrix Make sure that the number of basic variables is correct. */ void presolve_check_nbasic (const CoinPostsolveMatrix *postObj) { int ncols0 = postObj->ncols0_ ; int nrows0 = postObj->nrows0_ ; char *cdone = postObj->cdone_ ; char *rdone = postObj->rdone_ ; int nbasic = 0 ; int ncdone = 0; int nrdone = 0; int ncb = 0; int nrb = 0; for (int j = 0 ; j < ncols0 ; j++) { if (cdone[j] != 0 && postObj->columnIsBasic(j)) { nbasic++ ; ncb++ ; } if (cdone[j]) ncdone++ ; } for (int i = 0 ; i < nrows0 ; i++) { if (rdone[i] && postObj->rowIsBasic(i)) { nbasic++ ; nrb++ ; } if (rdone[i]) nrdone++ ; } if (nbasic != postObj->nrows_) { printf("NBASIC (ERROR): %d basic variables, should be %d; ", nbasic,postObj->nrows_) ; printf("cdone %d, col basic %d, rdone %d, row basic %d.\n", ncdone,ncb,nrdone,nrb) ; fflush(stdout) ; } # if PRESOLVE_DEBUG > 1 else { std::cout << "NBASIC: " << nbasic << " basic variables; cdone " << ncdone << ", col basic " << ncb << ", rdone " << nrdone << ", row basic " << nrb << std::endl ; std::cout << std::flush ; } # endif return ; } /* CoinPresolveMatrix Overload of presolve_check_nbasic for a CoinPresolveMatrix. There may not be a solution, eh? */ void presolve_check_nbasic (const CoinPresolveMatrix *preObj) { if (preObj->sol_ == 0) return ; int ncols = preObj->ncols_ ; int nrows = preObj->nrows_ ; int nbasic = 0 ; int ncb = 0; int nrb = 0; for (int j = 0 ; j < ncols ; j++) { if (preObj->columnIsBasic(j)) { nbasic++ ; ncb++ ; } } for (int i = 0 ; i < nrows ; i++) { if (preObj->rowIsBasic(i)) { nbasic++ ; nrb++ ; } } if (nbasic != nrows) { printf("WRONG NUMBER NBASIC: is: %d should be: %d;", nbasic,nrows) ; printf(" cb %d, rb %d.\n",ncb,nrb); fflush(stdout) ; } return ; } #endif /* Original comment: I've forgotton what this is all about Looks to me like it's confirming that the columns flagged as basic indeed have enough coefficients between them to cover the basis. It'd be serious work to get this going again. Waaaaaay out of date. -- lh, 040831 -- */ # if 0 void check_pivots (const int *mrstrt, const int *hinrow, const int *hcol, int nrows, const unsigned char *colstat, const unsigned char *rowstat, int ncols) { int i ; int nbasic = 0 ; int gotone = 1 ; int stillmore ; return ; int *bcol = new int[nrows] ; memset(bcol, -1, nrows*sizeof(int)) ; char *coldone = new char[ncols] ; memset(coldone, 0, ncols) ; while (gotone) { gotone = 0 ; stillmore = 0 ; for (i=0; irowIsBasic(i)) { int krs = mrstrt[i] ; int kre = mrstrt[i] + hinrow[i] ; int nb = 0 ; int kk ; for (int k=krs; kcolumnIsBasic(hcol[k]) && !coldone[hcol[k]]) { nb++ ; kk = k ; if (nb > 1) break ; } if (nb == 1) { PRESOLVEASSERT(bcol[i] == -1) ; bcol[i] = hcol[kk] ; coldone[hcol[kk]] = 1 ; nbasic++ ; gotone = 1 ; } else stillmore = 1 ; } } PRESOLVEASSERT(!stillmore) ; for (i=0; irowIsBasic(i)) { int krs = mrstrt[i] ; int kre = mrstrt[i] + hinrow[i] ; for (int k=krs; kcolumnIsBasic(hcol[k]) || coldone[hcol[k]]) ; nbasic++ ; } PRESOLVEASSERT(nbasic == nrows) ; } # endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveTighten.cpp0000644000175000017500000003426611670767350020502 0ustar renerene/* $Id: CoinPresolveTighten.cpp 1518 2011-12-10 23:44:40Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPresolveMatrix.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolveTighten.hpp" #include "CoinPresolveUseless.hpp" #include "CoinHelperFunctions.hpp" #include "CoinFinite.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif const char *do_tighten_action::name() const { return ("do_tighten_action"); } /* This is ekkredc2. This fairly simple transformation is not mentioned in the paper. Say there is a costless variable x such that all the constraints it's entangled with (i.e., a != 0) would be satisfied as it approaches plus or minus infinity, because all its constraints have only one bound, and increasing/decreasing the variable makes the row activity grow away from the bound (in the right direction). If x is unbounded in that direction, it can always be made large enough to satisfy the constraints, so we can just drop the variable and the entangled constraints from the problem. If x *is* bounded in that direction, there is no reason not to set it to that bound. This effectively weakens the constraints, which in fact may be subsequently presolved away. Note that none of the constraints may be bounded both above and below, since then we don't know which way to move the variable in order to satisfy the constraint. To drop constraints, we just make them useless and let other transformations take care of the rest. Note that more than one such costless unbounded variable may be part of a given constraint. In that case, the first one processed will make the constraint useless, and the second will ignore it. In postsolve, the first will be responsible for satisfying the constraint. Note that if the constraints are dropped (as in the first case), then we just make them useless. It will subsequently be discovered the the variable does not appear in any constraints, and since it has no cost it is just set to some value (either zero or a bound) and removed (by remove_empty_cols). Oddly, pilots and baxter do *worse* when this transform is applied. It's informative to compare this transform to the very similar transform implemented in remove_dual_action. Surely they could be merged. */ const CoinPresolveAction *do_tighten_action::presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next) { double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; int ncols = prob->ncols_; double *clo = prob->clo_; double *cup = prob->cup_; double *rlo = prob->rlo_; double *rup = prob->rup_; double *dcost = prob->cost_; const unsigned char *integerType = prob->integerType_; int *fix_cols = prob->usefulColumnInt_; int nfixup_cols = 0; int nfixdown_cols = ncols; int *useless_rows = prob->usefulRowInt_; int nuseless_rows = 0; action *actions = new action [ncols]; int nactions = 0; int numberLook = prob->numberColsToDo_; int iLook; int * look = prob->colsToDo_; bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering do_tighten_action::presolve; considering " << numberLook << " rows." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int startEmptyRows = 0 ; int startEmptyColumns = 0 ; startEmptyRows = prob->countEmptyRows() ; startEmptyColumns = prob->countEmptyCols() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0; if (prob->tuning_) startTime = CoinCpuTime() ; # endif # endif // singleton columns are especially likely to be caught here for (iLook=0;iLookcup[j]&&!fixInfeasibility) { // infeasible prob->status_|= 1; prob->messageHandler()->message(COIN_PRESOLVE_COLINFEAS, prob->messages()) < ZTOLDP); // see what this particular row says // jflag == 1 ==> up is towards feasibility int jflag = (coeff > 0.0 ? (rub > 1.0e28 ? 1 : -1) : (rlb < -1.0e28 ? 1 : -1)); if (iflag) { // check that it agrees with iflag. if (iflag!=jflag) { iflag=0; break; } } else { // first row -- initialize iflag iflag=jflag; } } // done checking constraints if (!nonFree) iflag=0; // all free anyway if (iflag) { if (iflag==1 && cup[j]<1.0e10) { #if PRESOLVE_DEBUG > 1 printf("TIGHTEN UP: %d\n", j); #endif fix_cols[nfixup_cols++] = j; } else if (iflag==-1&&clo[j]>-1.0e10) { // symmetric case //mpre[j] = PRESOLVE_XUP; #if PRESOLVE_DEBUG > 1 printf("TIGHTEN DOWN: %d\n", j); #endif fix_cols[--nfixdown_cols] = j; } else { #if 0 static int limit; static int which = atoi(getenv("WZ")); if (which == -1) ; else if (limit != which) { limit++; continue; } else limit++; printf("TIGHTEN STATS %d %g %g %d: \n", j, clo[j], cup[j], integerType[j]); double *rowels = prob->rowels_; int *hcol = prob->hcol_; int *mrstrt = prob->mrstrt_; int *hinrow = prob->hinrow_; for (CoinBigIndex k=kcs; kcol = j; PRESOLVE_DETAIL_PRINT(printf("pre_tighten %dC E\n",j)); if (integerType[j]) { assert (iflag==-1||iflag==1); iflag *= 2; // say integer } s->direction = iflag; s->rows = new int[hincol[j]]; s->lbound = new double[hincol[j]]; s->ubound = new double[hincol[j]]; #if PRESOLVE_DEBUG > 1 printf("TIGHTEN FREE: %d ", j); #endif int nr = 0; prob->addCol(j); for (CoinBigIndex k=kcs; kaddRow(irow); s->rows [nr] = irow; s->lbound[nr] = rlo[irow]; s->ubound[nr] = rup[irow]; nr++; useless_rows[nuseless_rows++] = irow; rlo[irow] = -PRESOLVE_INF; rup[irow] = PRESOLVE_INF; #if PRESOLVE_DEBUG > 1 printf("%d ", irow); #endif } } s->nrows = nr; #if PRESOLVE_DEBUG > 1 printf("\n"); #endif } } } } } #if PRESOLVE_SUMMARY > 0 if (nfixdown_cols 0 if (prob->tuning_) double thisTime = CoinCpuTime() ; # endif # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_sol(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving do_tighten_action::presolve, " << droppedRows << " rows, " << droppedColumns << " columns dropped" ; # if COIN_PRESOLVE_TUNING > 0 std::cout << " in " << thisTime-startTime << "s" ; # endif std::cout << "." << std::endl ; # endif return (next); } void do_tighten_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_; const int nactions = nactions_; double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; int *link = prob->link_; double *clo = prob->clo_; double *cup = prob->cup_; double *rlo = prob->rlo_; double *rup = prob->rup_; double *sol = prob->sol_; double *acts = prob->acts_; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 char *cdone = prob->cdone_; char *rdone = prob->rdone_; presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Entering do_tighten_action::postsolve." << std::endl ; # endif # endif for (const action *f = &actions[nactions-1]; actions<=f; f--) { int jcol = f->col; int iflag = f->direction; int nr = f->nrows; const int *rows = f->rows; const double *lbound = f->lbound; const double *ubound = f->ubound; PRESOLVEASSERT(prob->getColumnStatus(jcol)!=CoinPrePostsolveMatrix::basic); int i; for (i=0;igetRowStatus(irow)==CoinPrePostsolveMatrix::basic); } // We have just tightened the row bounds. // That means we'll have to compute a new value // for this variable that will satisfy everybody. // We are supposed to be in a position where this // is always possible. // Each constraint has exactly one bound. // The correction should only ever be forced to move in one direction. // double orig_sol = sol[jcol]; double correction = 0.0; int last_corrected = -1; CoinBigIndex k = mcstrt[jcol]; int nk = hincol[jcol]; for (i=0; i newrup) ); last_corrected = irow; // adjust to just meet newrlo (solve for correction) double new_correction = (newrlo - activity) / coeff; //adjust if integer if (iflag==-2||iflag==2) { new_correction += sol[jcol]; if (fabs(floor(new_correction+0.5)-new_correction)>1.0e-4) { new_correction = ceil(new_correction)-sol[jcol]; #ifdef COIN_DEVELOP printf("integer postsolve changing correction from %g to %g - flag %d\n", (newrlo-activity)/coeff,new_correction,iflag); #endif } } correction = new_correction; } else if (activity + correction * coeff > newrup) { last_corrected = irow; double new_correction = (newrup - activity) / coeff; //adjust if integer if (iflag==-2||iflag==2) { new_correction += sol[jcol]; if (fabs(floor(new_correction+0.5)-new_correction)>1.0e-4) { new_correction = ceil(new_correction)-sol[jcol]; #ifdef COIN_DEVELOP printf("integer postsolve changing correction from %g to %g - flag %d\n", (newrup-activity)/coeff,new_correction,iflag); #endif } } correction = new_correction; } } if (last_corrected>=0) { sol[jcol] += correction; // by construction, the last row corrected (if there was one) // must be at its bound, so it can be non-basic. // All other rows may not be at a bound (but may if the difference // is very small, causing a new correction by a tiny amount). // now adjust the activities k = mcstrt[jcol]; for (i=0; i ZTOLDP && fabs(sol[jcol]-cup[jcol]) > ZTOLDP) { prob->setColumnStatus(jcol,CoinPrePostsolveMatrix::basic); if (acts[last_corrected]-rlo[last_corrected] < rup[last_corrected]-acts[last_corrected]) prob->setRowStatus(last_corrected, CoinPrePostsolveMatrix::atUpperBound); else prob->setRowStatus(last_corrected, CoinPrePostsolveMatrix::atLowerBound); } } } # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving do_tighten_action::postsolve." << std::endl ; # endif # endif } do_tighten_action::~do_tighten_action() { if (nactions_ > 0) { for (int i = nactions_ - 1; i >= 0; --i) { delete[] actions_[i].rows; delete[] actions_[i].lbound; delete[] actions_[i].ubound; } deleteAction(actions_, action*); } } CoinMP-1.8.3/CoinUtils/src/CoinMessage.hpp0000644000175000017500000000433312312310414016714 0ustar renerene/* $Id: CoinMessage.hpp 1691 2014-03-19 12:43:56Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinMessage_H #define CoinMessage_H #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif /*! \file This file contains the enum for the standard set of Coin messages and a class definition whose sole purpose is to supply a constructor. The text ot the messages is defined in CoinMessage.cpp, CoinMessageHandler.hpp contains the generic facilities for message handling. */ #include "CoinMessageHandler.hpp" /*! \brief Symbolic names for the standard set of COIN messages */ enum COIN_Message { COIN_MPS_LINE=0, COIN_MPS_STATS, COIN_MPS_ILLEGAL, COIN_MPS_BADIMAGE, COIN_MPS_DUPOBJ, COIN_MPS_DUPROW, COIN_MPS_NOMATCHROW, COIN_MPS_NOMATCHCOL, COIN_MPS_FILE, COIN_MPS_BADFILE1, COIN_MPS_BADFILE2, COIN_MPS_EOF, COIN_MPS_RETURNING, COIN_MPS_CHANGED, COIN_SOLVER_MPS, COIN_PRESOLVE_COLINFEAS, COIN_PRESOLVE_ROWINFEAS, COIN_PRESOLVE_COLUMNBOUNDA, COIN_PRESOLVE_COLUMNBOUNDB, COIN_PRESOLVE_NONOPTIMAL, COIN_PRESOLVE_STATS, COIN_PRESOLVE_INFEAS, COIN_PRESOLVE_UNBOUND, COIN_PRESOLVE_INFEASUNBOUND, COIN_PRESOLVE_INTEGERMODS, COIN_PRESOLVE_POSTSOLVE, COIN_PRESOLVE_NEEDS_CLEANING, COIN_PRESOLVE_PASS, # if PRESOLVE_DEBUG COIN_PRESOLDBG_FIRSTCHECK, COIN_PRESOLDBG_RCOSTACC, COIN_PRESOLDBG_RCOSTSTAT, COIN_PRESOLDBG_STATSB, COIN_PRESOLDBG_DUALSTAT, # endif COIN_GENERAL_INFO, COIN_GENERAL_INFO2, COIN_GENERAL_WARNING, COIN_DUMMY_END }; /*! \class CoinMessage \brief The standard set of Coin messages This class provides convenient access to the standard set of Coin messages. In a nutshell, it's a CoinMessages object with a constructor that preloads the standard Coin messages. */ class CoinMessage : public CoinMessages { public: /**@name Constructors etc */ //@{ /*! \brief Constructor Build a CoinMessages object and load it with the standard set of Coin messages. */ CoinMessage(Language language=us_en); //@} }; #endif CoinMP-1.8.3/CoinUtils/src/CoinIndexedVector.hpp0000644000175000017500000011550712452502475020120 0ustar renerene/* $Id: CoinIndexedVector.hpp 1767 2015-01-05 12:36:13Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinIndexedVector_H #define CoinIndexedVector_H #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include "CoinFinite.hpp" #ifndef CLP_NO_VECTOR #include "CoinPackedVectorBase.hpp" #endif #include "CoinSort.hpp" #include "CoinHelperFunctions.hpp" #include #ifndef COIN_FLOAT #define COIN_INDEXED_TINY_ELEMENT 1.0e-50 #define COIN_INDEXED_REALLY_TINY_ELEMENT 1.0e-100 #else #define COIN_INDEXED_TINY_ELEMENT 1.0e-35 #define COIN_INDEXED_REALLY_TINY_ELEMENT 1.0e-39 #endif /** Indexed Vector This stores values unpacked but apart from that is a bit like CoinPackedVector. It is designed to be lightweight in normal use. It now has a "packed" mode when it is even more like CoinPackedVector Indices array has capacity_ extra chars which are zeroed and can be used for any purpose - but must be re-zeroed Stores vector of indices and associated element values. Supports sorting of indices. Does not support negative indices. Does NOT support testing for duplicates *** getElements is no longer supported Here is a sample usage: @verbatim const int ne = 4; int inx[ne] = { 1, 4, 0, 2 } double el[ne] = { 10., 40., 1., 50. } // Create vector and set its valuex1 CoinIndexedVector r(ne,inx,el); // access as a full storage vector assert( r[ 0]==1. ); assert( r[ 1]==10.); assert( r[ 2]==50.); assert( r[ 3]==0. ); assert( r[ 4]==40.); // sort Elements in increasing order r.sortIncrElement(); // access each index and element assert( r.getIndices ()[0]== 0 ); assert( r.getIndices ()[1]== 1 ); assert( r.getIndices ()[2]== 4 ); assert( r.getIndices ()[3]== 2 ); // access as a full storage vector assert( r[ 0]==1. ); assert( r[ 1]==10.); assert( r[ 2]==50.); assert( r[ 3]==0. ); assert( r[ 4]==40.); // Tests for equality and equivalence CoinIndexedVector r1; r1=r; assert( r==r1 ); assert( r.equivalent(r1) ); r.sortIncrElement(); assert( r!=r1 ); assert( r.equivalent(r1) ); // Add indexed vectors. // Similarly for subtraction, multiplication, // and division. CoinIndexedVector add = r + r1; assert( add[0] == 1.+ 1. ); assert( add[1] == 10.+10. ); assert( add[2] == 50.+50. ); assert( add[3] == 0.+ 0. ); assert( add[4] == 40.+40. ); assert( r.sum() == 10.+40.+1.+50. ); @endverbatim */ class CoinIndexedVector { friend void CoinIndexedVectorUnitTest(); public: /**@name Get methods. */ //@{ /// Get the size inline int getNumElements() const { return nElements_; } /// Get indices of elements inline const int * getIndices() const { return indices_; } /// Get element values // ** No longer supported virtual const double * getElements() const ; /// Get indices of elements inline int * getIndices() { return indices_; } /** Get the vector as a dense vector. This is normal storage method. The user should not not delete [] this. */ inline double * denseVector() const { return elements_; } /// For very temporary use when user needs to borrow a dense vector inline void setDenseVector(double * array) { elements_ = array;} /// For very temporary use when user needs to borrow an index vector inline void setIndexVector(int * array) { indices_ = array;} /** Access the i'th element of the full storage vector. */ double & operator[](int i) const; //@} //------------------------------------------------------------------- // Set indices and elements //------------------------------------------------------------------- /**@name Set methods */ //@{ /// Set the size inline void setNumElements(int value) { nElements_ = value; if (!nElements_) packedMode_=false;} /// Reset the vector (as if were just created an empty vector). This leaves arrays! void clear(); /// Reset the vector (as if were just created an empty vector) void empty(); /** Assignment operator. */ CoinIndexedVector & operator=(const CoinIndexedVector &); #ifndef CLP_NO_VECTOR /** Assignment operator from a CoinPackedVectorBase.
    NOTE: This assumes no duplicates */ CoinIndexedVector & operator=(const CoinPackedVectorBase & rhs); #endif /** Copy the contents of one vector into another. If multiplier is 1 It is the equivalent of = but if vectors are same size does not re-allocate memory just clears and copies */ void copy(const CoinIndexedVector & rhs, double multiplier=1.0); /** Borrow ownership of the arguments to this vector. Size is the length of the unpacked elements vector. */ void borrowVector(int size, int numberIndices, int* inds, double* elems); /** Return ownership of the arguments to this vector. State after is empty . */ void returnVector(); /** Set vector numberIndices, indices, and elements. NumberIndices is the length of both the indices and elements vectors. The indices and elements vectors are copied into this class instance's member data. Assumed to have no duplicates */ void setVector(int numberIndices, const int * inds, const double * elems); /** Set vector size, indices, and elements. Size is the length of the unpacked elements vector. The indices and elements vectors are copied into this class instance's member data. We do not check for duplicate indices */ void setVector(int size, int numberIndices, const int * inds, const double * elems); /** Elements set to have the same scalar value */ void setConstant(int size, const int * inds, double elems); /** Indices are not specified and are taken to be 0,1,...,size-1 */ void setFull(int size, const double * elems); /** Set an existing element in the indexed vector The first argument is the "index" into the elements() array */ void setElement(int index, double element); /// Insert an element into the vector void insert(int index, double element); /// Insert a nonzero element into the vector inline void quickInsert(int index, double element) { assert (!elements_[index]); indices_[nElements_++] = index; assert (nElements_<=capacity_); elements_[index] = element; } /** Insert or if exists add an element into the vector Any resulting zero elements will be made tiny */ void add(int index, double element); /** Insert or if exists add an element into the vector Any resulting zero elements will be made tiny. This version does no checking */ inline void quickAdd(int index, double element) { if (elements_[index]) { element += elements_[index]; if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) { elements_[index] = element; } else { elements_[index] = 1.0e-100; } } else if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) { indices_[nElements_++] = index; assert (nElements_<=capacity_); elements_[index] = element; } } /** Insert or if exists add an element into the vector Any resulting zero elements will be made tiny. This knows element is nonzero This version does no checking */ inline void quickAddNonZero(int index, double element) { assert (element); if (elements_[index]) { element += elements_[index]; if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) { elements_[index] = element; } else { elements_[index] = COIN_DBL_MIN; } } else { indices_[nElements_++] = index; assert (nElements_<=capacity_); elements_[index] = element; } } /** Makes nonzero tiny. This version does no checking */ inline void zero(int index) { if (elements_[index]) elements_[index] = COIN_DBL_MIN; } /** set all small values to zero and return number remaining - < tolerance => 0.0 */ int clean(double tolerance); /// Same but packs down int cleanAndPack(double tolerance); /// Same but packs down and is safe (i.e. if order is odd) int cleanAndPackSafe(double tolerance); /// Mark as packed inline void setPacked() { packedMode_ = true;} #ifndef NDEBUG /// For debug check vector is clear i.e. no elements void checkClear(); /// For debug check vector is clean i.e. elements match indices void checkClean(); #else inline void checkClear() {}; inline void checkClean() {}; #endif /// Scan dense region and set up indices (returns number found) int scan(); /** Scan dense region from start to < end and set up indices returns number found */ int scan(int start, int end); /** Scan dense region and set up indices (returns number found). Only ones >= tolerance */ int scan(double tolerance); /** Scan dense region from start to < end and set up indices returns number found. Only >= tolerance */ int scan(int start, int end, double tolerance); /// These are same but pack down int scanAndPack(); int scanAndPack(int start, int end); int scanAndPack(double tolerance); int scanAndPack(int start, int end, double tolerance); /// Create packed array void createPacked(int number, const int * indices, const double * elements); /// Create unpacked array void createUnpacked(int number, const int * indices, const double * elements); /// Create unpacked singleton void createOneUnpackedElement(int index, double element); /// This is mainly for testing - goes from packed to indexed void expand(); #ifndef CLP_NO_VECTOR /// Append a CoinPackedVector to the end void append(const CoinPackedVectorBase & caboose); #endif /// Append a CoinIndexedVector to the end (with extra space) void append(const CoinIndexedVector & caboose); /// Append a CoinIndexedVector to the end and modify indices void append(CoinIndexedVector & other,int adjustIndex,bool zapElements=false); /// Swap values in positions i and j of indices and elements void swap(int i, int j); /// Throw away all entries in rows >= newSize void truncate(int newSize); /// Print out void print() const; //@} /**@name Arithmetic operators. */ //@{ /// add value to every entry void operator+=(double value); /// subtract value from every entry void operator-=(double value); /// multiply every entry by value void operator*=(double value); /// divide every entry by value (** 0 vanishes) void operator/=(double value); //@} /**@name Comparison operators on two indexed vectors */ //@{ #ifndef CLP_NO_VECTOR /** Equal. Returns true if vectors have same length and corresponding element of each vector is equal. */ bool operator==(const CoinPackedVectorBase & rhs) const; /// Not equal bool operator!=(const CoinPackedVectorBase & rhs) const; #endif /** Equal. Returns true if vectors have same length and corresponding element of each vector is equal. */ bool operator==(const CoinIndexedVector & rhs) const; /// Not equal bool operator!=(const CoinIndexedVector & rhs) const; /// Equal with a tolerance (returns -1 or position of inequality). int isApproximatelyEqual(const CoinIndexedVector & rhs, double tolerance=1.0e-8) const; //@} /**@name Index methods */ //@{ /// Get value of maximum index int getMaxIndex() const; /// Get value of minimum index int getMinIndex() const; //@} /**@name Sorting */ //@{ /** Sort the indexed storage vector (increasing indices). */ void sort() { std::sort(indices_,indices_+nElements_); } void sortIncrIndex() { std::sort(indices_,indices_+nElements_); } void sortDecrIndex(); void sortIncrElement(); void sortDecrElement(); void sortPacked(); //@} //############################################################################# /**@name Arithmetic operators on packed vectors. NOTE: These methods operate on those positions where at least one of the arguments has a value listed. At those positions the appropriate operation is executed, Otherwise the result of the operation is considered 0.
    NOTE 2: Because these methods return an object (they can't return a reference, though they could return a pointer...) they are very inefficient... */ //@{ /// Return the sum of two indexed vectors CoinIndexedVector operator+( const CoinIndexedVector& op2); /// Return the difference of two indexed vectors CoinIndexedVector operator-( const CoinIndexedVector& op2); /// Return the element-wise product of two indexed vectors CoinIndexedVector operator*( const CoinIndexedVector& op2); /// Return the element-wise ratio of two indexed vectors (0.0/0.0 => 0.0) (0 vanishes) CoinIndexedVector operator/( const CoinIndexedVector& op2); /// The sum of two indexed vectors void operator+=(const CoinIndexedVector& op2); /// The difference of two indexed vectors void operator-=( const CoinIndexedVector& op2); /// The element-wise product of two indexed vectors void operator*=(const CoinIndexedVector& op2); /// The element-wise ratio of two indexed vectors (0.0/0.0 => 0.0) (0 vanishes) void operator/=(const CoinIndexedVector& op2); //@} /**@name Memory usage */ //@{ /** Reserve space. If one knows the eventual size of the indexed vector, then it may be more efficient to reserve the space. */ void reserve(int n); /** capacity returns the size which could be accomodated without having to reallocate storage. */ inline int capacity() const { return capacity_; } inline void setCapacity(int value) { capacity_ = value; } /// Sets packed mode inline void setPackedMode(bool yesNo) { packedMode_=yesNo;} /// Gets packed mode inline bool packedMode() const { return packedMode_;} //@} /**@name Constructors and destructors */ //@{ /** Default constructor */ CoinIndexedVector(); /** Alternate Constructors - set elements to vector of doubles */ CoinIndexedVector(int size, const int * inds, const double * elems); /** Alternate Constructors - set elements to same scalar value */ CoinIndexedVector(int size, const int * inds, double element); /** Alternate Constructors - construct full storage with indices 0 through size-1. */ CoinIndexedVector(int size, const double * elements); /** Alternate Constructors - just size */ CoinIndexedVector(int size); /** Copy constructor. */ CoinIndexedVector(const CoinIndexedVector &); /** Copy constructor.2 */ CoinIndexedVector(const CoinIndexedVector *); #ifndef CLP_NO_VECTOR /** Copy constructor from a PackedVectorBase. */ CoinIndexedVector(const CoinPackedVectorBase & rhs); #endif /** Destructor */ ~CoinIndexedVector (); //@} private: /**@name Private methods */ //@{ /// Copy internal data void gutsOfSetVector(int size, const int * inds, const double * elems); void gutsOfSetVector(int size, int numberIndices, const int * inds, const double * elems); void gutsOfSetPackedVector(int size, int numberIndices, const int * inds, const double * elems); /// void gutsOfSetConstant(int size, const int * inds, double value); //@} protected: /**@name Private member data */ //@{ /// Vector indices int * indices_; ///Vector elements double * elements_; /// Size of indices and packed elements vectors int nElements_; /// Amount of memory allocated for indices_, and elements_. int capacity_; /// Offset to get where new allocated array int offset_; /// If true then is operating in packed mode bool packedMode_; //@} }; //############################################################################# /** A function that tests the methods in the CoinIndexedVector class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CoinIndexedVectorUnitTest(); /** Pointer with length in bytes This has a pointer to an array and the number of bytes in array. If number of bytes==-1 then CoinConditionalNew deletes existing pointer and returns new pointer of correct size (and number bytes still -1). CoinConditionalDelete deletes existing pointer and NULLs it. So behavior is as normal (apart from New deleting pointer which will have no effect with good coding practices. If number of bytes >=0 then CoinConditionalNew just returns existing pointer if array big enough otherwise deletes existing pointer, allocates array with spare 1%+64 bytes and updates number of bytes CoinConditionalDelete sets number of bytes = -size-2 and then array returns NULL */ class CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_; } /// Get the size inline int rawSize() const { return size_; } /// See if persistence already on inline bool switchedOn() const { return size_!=-1; } /// Get the capacity (just read it) inline int capacity() const { return (size_>-2) ? size_ : (-size_)-2; } /// Set the capacity to >=0 if <=-2 inline void setCapacity() { if (size_<=-2) size_ = (-size_)-2; } /// Get Array inline const char * array() const { return (size_>-2) ? array_ : NULL; } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value; } /// Set the size to -1 inline void switchOff() { size_ = -1; } /// Set the size to -2 and alignment inline void switchOn(int alignment=3) { size_ = -2; alignment_=alignment;} /// Does what is needed to set persistence void setPersistence(int flag,int currentLength); /// Zero out array void clear(); /// Swaps memory between two members void swap(CoinArrayWithLength & other); /// Extend a persistent array keeping data (size in bytes) void extend(int newSize); //@} /**@name Condition methods */ //@{ /// Conditionally gets new array char * conditionalNew(long sizeWanted); /// Conditionally deletes void conditionalDelete(); //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinArrayWithLength() : array_(NULL),size_(-1),offset_(0),alignment_(0) { } /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinArrayWithLength(int size) : size_(-1),offset_(0),alignment_(0) { array_=new char [size];} /** Alternate Constructor - length in bytes mode - 0 size_ set to size mode>0 size_ set to size and zeroed if size<=0 just does alignment If abs(mode) >2 then align on that as power of 2 */ CoinArrayWithLength(int size, int mode); /** Copy constructor. */ CoinArrayWithLength(const CoinArrayWithLength & rhs); /** Copy constructor.2 */ CoinArrayWithLength(const CoinArrayWithLength * rhs); /** Assignment operator. */ CoinArrayWithLength& operator=(const CoinArrayWithLength & rhs); /** Assignment with length (if -1 use internal length) */ void copy(const CoinArrayWithLength & rhs, int numberBytes=-1); /** Assignment with length - does not copy */ void allocate(const CoinArrayWithLength & rhs, int numberBytes); /** Destructor */ ~CoinArrayWithLength (); /// Get array with alignment void getArray(int size); /// Really get rid of array with alignment void reallyFreeArray(); /// Get enough space (if more needed then do at least needed) void getCapacity(int numberBytes,int numberIfNeeded=-1); //@} protected: /**@name Private member data */ //@{ /// Array char * array_; /// Size of array in bytes CoinBigIndex size_; /// Offset of array int offset_; /// Alignment wanted (power of 2) int alignment_; //@} }; /// double * version class CoinDoubleArrayWithLength : public CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_/CoinSizeofAsInt(double); } /// Get Array inline double * array() const { return reinterpret_cast ((size_>-2) ? array_ : NULL); } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value*CoinSizeofAsInt(double); } //@} /**@name Condition methods */ //@{ /// Conditionally gets new array inline double * conditionalNew(int sizeWanted) { return reinterpret_cast ( CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast ((sizeWanted)*CoinSizeofAsInt(double)) : -1)); } //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinDoubleArrayWithLength() { array_=NULL; size_=-1;} /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinDoubleArrayWithLength(int size) { array_=new char [size*CoinSizeofAsInt(double)]; size_=-1;} /** Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed */ inline CoinDoubleArrayWithLength(int size, int mode) : CoinArrayWithLength(size*CoinSizeofAsInt(double),mode) {} /** Copy constructor. */ inline CoinDoubleArrayWithLength(const CoinDoubleArrayWithLength & rhs) : CoinArrayWithLength(rhs) {} /** Copy constructor.2 */ inline CoinDoubleArrayWithLength(const CoinDoubleArrayWithLength * rhs) : CoinArrayWithLength(rhs) {} /** Assignment operator. */ inline CoinDoubleArrayWithLength& operator=(const CoinDoubleArrayWithLength & rhs) { CoinArrayWithLength::operator=(rhs); return *this;} //@} }; /// CoinFactorizationDouble * version class CoinFactorizationDoubleArrayWithLength : public CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_/CoinSizeofAsInt(CoinFactorizationDouble); } /// Get Array inline CoinFactorizationDouble * array() const { return reinterpret_cast ((size_>-2) ? array_ : NULL); } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value*CoinSizeofAsInt(CoinFactorizationDouble); } //@} /**@name Condition methods */ //@{ /// Conditionally gets new array inline CoinFactorizationDouble * conditionalNew(int sizeWanted) { return reinterpret_cast (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast (( sizeWanted)*CoinSizeofAsInt(CoinFactorizationDouble)) : -1)); } //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinFactorizationDoubleArrayWithLength() { array_=NULL; size_=-1;} /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinFactorizationDoubleArrayWithLength(int size) { array_=new char [size*CoinSizeofAsInt(CoinFactorizationDouble)]; size_=-1;} /** Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed */ inline CoinFactorizationDoubleArrayWithLength(int size, int mode) : CoinArrayWithLength(size*CoinSizeofAsInt(CoinFactorizationDouble),mode) {} /** Copy constructor. */ inline CoinFactorizationDoubleArrayWithLength(const CoinFactorizationDoubleArrayWithLength & rhs) : CoinArrayWithLength(rhs) {} /** Copy constructor.2 */ inline CoinFactorizationDoubleArrayWithLength(const CoinFactorizationDoubleArrayWithLength * rhs) : CoinArrayWithLength(rhs) {} /** Assignment operator. */ inline CoinFactorizationDoubleArrayWithLength& operator=(const CoinFactorizationDoubleArrayWithLength & rhs) { CoinArrayWithLength::operator=(rhs); return *this;} //@} }; /// CoinFactorizationLongDouble * version class CoinFactorizationLongDoubleArrayWithLength : public CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_/CoinSizeofAsInt(long double); } /// Get Array inline long double * array() const { return reinterpret_cast ((size_>-2) ? array_ : NULL); } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value*CoinSizeofAsInt(long double); } //@} /**@name Condition methods */ //@{ /// Conditionally gets new array inline long double * conditionalNew(int sizeWanted) { return reinterpret_cast (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast (( sizeWanted)*CoinSizeofAsInt(long double)) : -1)); } //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinFactorizationLongDoubleArrayWithLength() { array_=NULL; size_=-1;} /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinFactorizationLongDoubleArrayWithLength(int size) { array_=new char [size*CoinSizeofAsInt(long double)]; size_=-1;} /** Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed */ inline CoinFactorizationLongDoubleArrayWithLength(int size, int mode) : CoinArrayWithLength(size*CoinSizeofAsInt(long double),mode) {} /** Copy constructor. */ inline CoinFactorizationLongDoubleArrayWithLength(const CoinFactorizationLongDoubleArrayWithLength & rhs) : CoinArrayWithLength(rhs) {} /** Copy constructor.2 */ inline CoinFactorizationLongDoubleArrayWithLength(const CoinFactorizationLongDoubleArrayWithLength * rhs) : CoinArrayWithLength(rhs) {} /** Assignment operator. */ inline CoinFactorizationLongDoubleArrayWithLength& operator=(const CoinFactorizationLongDoubleArrayWithLength & rhs) { CoinArrayWithLength::operator=(rhs); return *this;} //@} }; /// int * version class CoinIntArrayWithLength : public CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_/CoinSizeofAsInt(int); } /// Get Array inline int * array() const { return reinterpret_cast ((size_>-2) ? array_ : NULL); } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value*CoinSizeofAsInt(int); } //@} /**@name Condition methods */ //@{ /// Conditionally gets new array inline int * conditionalNew(int sizeWanted) { return reinterpret_cast (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast (( sizeWanted)*CoinSizeofAsInt(int)) : -1)); } //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinIntArrayWithLength() { array_=NULL; size_=-1;} /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinIntArrayWithLength(int size) { array_=new char [size*CoinSizeofAsInt(int)]; size_=-1;} /** Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed */ inline CoinIntArrayWithLength(int size, int mode) : CoinArrayWithLength(size*CoinSizeofAsInt(int),mode) {} /** Copy constructor. */ inline CoinIntArrayWithLength(const CoinIntArrayWithLength & rhs) : CoinArrayWithLength(rhs) {} /** Copy constructor.2 */ inline CoinIntArrayWithLength(const CoinIntArrayWithLength * rhs) : CoinArrayWithLength(rhs) {} /** Assignment operator. */ inline CoinIntArrayWithLength& operator=(const CoinIntArrayWithLength & rhs) { CoinArrayWithLength::operator=(rhs); return *this;} //@} }; /// CoinBigIndex * version class CoinBigIndexArrayWithLength : public CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_/CoinSizeofAsInt(CoinBigIndex); } /// Get Array inline CoinBigIndex * array() const { return reinterpret_cast ((size_>-2) ? array_ : NULL); } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value*CoinSizeofAsInt(CoinBigIndex); } //@} /**@name Condition methods */ //@{ /// Conditionally gets new array inline CoinBigIndex * conditionalNew(int sizeWanted) { return reinterpret_cast (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast (( sizeWanted)*CoinSizeofAsInt(CoinBigIndex)) : -1)); } //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinBigIndexArrayWithLength() { array_=NULL; size_=-1;} /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinBigIndexArrayWithLength(int size) { array_=new char [size*CoinSizeofAsInt(CoinBigIndex)]; size_=-1;} /** Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed */ inline CoinBigIndexArrayWithLength(int size, int mode) : CoinArrayWithLength(size*CoinSizeofAsInt(CoinBigIndex),mode) {} /** Copy constructor. */ inline CoinBigIndexArrayWithLength(const CoinBigIndexArrayWithLength & rhs) : CoinArrayWithLength(rhs) {} /** Copy constructor.2 */ inline CoinBigIndexArrayWithLength(const CoinBigIndexArrayWithLength * rhs) : CoinArrayWithLength(rhs) {} /** Assignment operator. */ inline CoinBigIndexArrayWithLength& operator=(const CoinBigIndexArrayWithLength & rhs) { CoinArrayWithLength::operator=(rhs); return *this;} //@} }; /// unsigned int * version class CoinUnsignedIntArrayWithLength : public CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_/CoinSizeofAsInt(unsigned int); } /// Get Array inline unsigned int * array() const { return reinterpret_cast ((size_>-2) ? array_ : NULL); } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value*CoinSizeofAsInt(unsigned int); } //@} /**@name Condition methods */ //@{ /// Conditionally gets new array inline unsigned int * conditionalNew(int sizeWanted) { return reinterpret_cast (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast (( sizeWanted)*CoinSizeofAsInt(unsigned int)) : -1)); } //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinUnsignedIntArrayWithLength() { array_=NULL; size_=-1;} /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinUnsignedIntArrayWithLength(int size) { array_=new char [size*CoinSizeofAsInt(unsigned int)]; size_=-1;} /** Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed */ inline CoinUnsignedIntArrayWithLength(int size, int mode) : CoinArrayWithLength(size*CoinSizeofAsInt(unsigned int),mode) {} /** Copy constructor. */ inline CoinUnsignedIntArrayWithLength(const CoinUnsignedIntArrayWithLength & rhs) : CoinArrayWithLength(rhs) {} /** Copy constructor.2 */ inline CoinUnsignedIntArrayWithLength(const CoinUnsignedIntArrayWithLength * rhs) : CoinArrayWithLength(rhs) {} /** Assignment operator. */ inline CoinUnsignedIntArrayWithLength& operator=(const CoinUnsignedIntArrayWithLength & rhs) { CoinArrayWithLength::operator=(rhs); return *this;} //@} }; /// void * version class CoinVoidStarArrayWithLength : public CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_/CoinSizeofAsInt(void *); } /// Get Array inline void ** array() const { return reinterpret_cast ((size_>-2) ? array_ : NULL); } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value*CoinSizeofAsInt(void *); } //@} /**@name Condition methods */ //@{ /// Conditionally gets new array inline void ** conditionalNew(int sizeWanted) { return reinterpret_cast ( CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast ((sizeWanted)*CoinSizeofAsInt(void *)) : -1)); } //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinVoidStarArrayWithLength() { array_=NULL; size_=-1;} /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinVoidStarArrayWithLength(int size) { array_=new char [size*CoinSizeofAsInt(void *)]; size_=-1;} /** Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed */ inline CoinVoidStarArrayWithLength(int size, int mode) : CoinArrayWithLength(size*CoinSizeofAsInt(void *),mode) {} /** Copy constructor. */ inline CoinVoidStarArrayWithLength(const CoinVoidStarArrayWithLength & rhs) : CoinArrayWithLength(rhs) {} /** Copy constructor.2 */ inline CoinVoidStarArrayWithLength(const CoinVoidStarArrayWithLength * rhs) : CoinArrayWithLength(rhs) {} /** Assignment operator. */ inline CoinVoidStarArrayWithLength& operator=(const CoinVoidStarArrayWithLength & rhs) { CoinArrayWithLength::operator=(rhs); return *this;} //@} }; /// arbitrary version class CoinArbitraryArrayWithLength : public CoinArrayWithLength { public: /**@name Get methods. */ //@{ /// Get the size inline int getSize() const { return size_/lengthInBytes_; } /// Get Array inline void ** array() const { return reinterpret_cast ((size_>-2) ? array_ : NULL); } //@} /**@name Set methods */ //@{ /// Set the size inline void setSize(int value) { size_ = value*lengthInBytes_; } //@} /**@name Condition methods */ //@{ /// Conditionally gets new array inline char * conditionalNew(int length, int sizeWanted) { lengthInBytes_=length;return reinterpret_cast ( CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast ((sizeWanted)*lengthInBytes_) : -1)); } //@} /**@name Constructors and destructors */ //@{ /** Default constructor - NULL*/ inline CoinArbitraryArrayWithLength(int length=1) { array_=NULL; size_=-1;lengthInBytes_=length;} /** Alternate Constructor - length in bytes - size_ -1 */ inline CoinArbitraryArrayWithLength(int length, int size) { array_=new char [size*length]; size_=-1; lengthInBytes_=length;} /** Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed */ inline CoinArbitraryArrayWithLength(int length, int size, int mode) : CoinArrayWithLength(size*length,mode) {lengthInBytes_=length;} /** Copy constructor. */ inline CoinArbitraryArrayWithLength(const CoinArbitraryArrayWithLength & rhs) : CoinArrayWithLength(rhs) {} /** Copy constructor.2 */ inline CoinArbitraryArrayWithLength(const CoinArbitraryArrayWithLength * rhs) : CoinArrayWithLength(rhs) {} /** Assignment operator. */ inline CoinArbitraryArrayWithLength& operator=(const CoinArbitraryArrayWithLength & rhs) { CoinArrayWithLength::operator=(rhs); return *this;} //@} protected: /**@name Private member data */ //@{ /// Length in bytes int lengthInBytes_; //@} }; class CoinPartitionedVector : public CoinIndexedVector { public: #ifndef COIN_PARTITIONS #define COIN_PARTITIONS 8 #endif /**@name Get methods. */ //@{ /// Get the size of a partition inline int getNumElements(int partition) const { assert (partition #include #include #include /** \file CoinMessageHandler.hpp \brief This is a first attempt at a message handler. The COIN Project is in favo(u)r of multi-language support. This implementation of a message handler tries to make it as lightweight as possible in the sense that only a subset of messages need to be defined --- the rest default to US English. The default handler at present just prints to stdout or to a FILE pointer \todo This needs to be worked over for correct operation with ISO character codes. */ /* I (jjf) am strongly in favo(u)r of language support for an open source project, but I have tried to make it as lightweight as possible in the sense that only a subset of messages need to be defined - the rest default to US English. There will be different sets of messages for each component - so at present there is a Clp component and a Coin component. Because messages are only used in a controlled environment and have no impact on code and are tested by other tests I have included tests such as language and derivation in other unit tests. */ /* Where there are derived classes I (jjf) have started message numbers at 1001. */ /** \brief Class for one massaged message. A message consists of a text string with formatting codes (#message_), an integer identifier (#externalNumber_) which also determines the severity level (#severity_) of the message, and a detail (logging) level (#detail_). CoinOneMessage is just a container to hold this information. The interpretation is set by CoinMessageHandler, which see. */ class CoinOneMessage { public: /**@name Constructors etc */ //@{ /** Default constructor. */ CoinOneMessage(); /** Normal constructor */ CoinOneMessage(int externalNumber, char detail, const char * message); /** Destructor */ ~CoinOneMessage(); /** The copy constructor */ CoinOneMessage(const CoinOneMessage&); /** assignment operator. */ CoinOneMessage& operator=(const CoinOneMessage&); //@} /**@name Useful stuff */ //@{ /// Replace message text (e.g., text in a different language) void replaceMessage(const char * message); //@} /**@name Get and set methods */ //@{ /** Get message ID number */ inline int externalNumber() const {return externalNumber_;} /** \brief Set message ID number In the default CoinMessageHandler, this number is printed in the message prefix and is used to determine the message severity level. */ inline void setExternalNumber(int number) {externalNumber_=number;} /// Severity inline char severity() const {return severity_;} /// Set detail level inline void setDetail(int level) {detail_=static_cast (level);} /// Get detail level inline int detail() const {return detail_;} /// Return the message text inline char * message() const {return message_;} //@} /**@name member data */ //@{ /// number to print out (also determines severity) int externalNumber_; /// Will only print if detail matches char detail_; /// Severity char severity_; /// Messages (in correct language) (not all 400 may exist) mutable char message_[400]; //@} }; /** \brief Class to hold and manipulate an array of massaged messages. Note that the message index used to reference a message in the array of messages is completely distinct from the external ID number stored with the message. */ class CoinMessages { public: /** \brief Supported languages These are the languages that are supported. At present only us_en is serious and the rest are for testing. */ enum Language { us_en = 0, uk_en, it }; /**@name Constructors etc */ //@{ /** Constructor with number of messages. */ CoinMessages(int numberMessages=0); /** Destructor */ ~CoinMessages(); /** The copy constructor */ CoinMessages(const CoinMessages&); /** assignment operator. */ CoinMessages& operator=(const CoinMessages&); //@} /**@name Useful stuff */ //@{ /*! \brief Installs a new message in the specified index position Any existing message is replaced, and a copy of the specified message is installed. */ void addMessage(int messageNumber, const CoinOneMessage & message); /*! \brief Replaces the text of the specified message Any existing text is deleted and the specified text is copied into the specified message. */ void replaceMessage(int messageNumber, const char * message); /** Language. Need to think about iso codes */ inline Language language() const {return language_;} /** Set language */ void setLanguage(Language newlanguage) {language_ = newlanguage;} /// Change detail level for one message void setDetailMessage(int newLevel, int messageNumber); /** \brief Change detail level for several messages messageNumbers is expected to contain the indices of the messages to be changed. If numberMessages >= 10000 or messageNumbers is NULL, the detail level is changed on all messages. */ void setDetailMessages(int newLevel, int numberMessages, int * messageNumbers); /** Change detail level for all messages with low <= ID number < high */ void setDetailMessages(int newLevel, int low, int high); /// Returns class inline int getClass() const { return class_;} /// Moves to compact format void toCompact(); /// Moves from compact format void fromCompact(); //@} /**@name member data */ //@{ /// Number of messages int numberMessages_; /// Language Language language_; /// Source (null-terminated string, maximum 4 characters). char source_[5]; /// Class - see later on before CoinMessageHandler int class_; /** Length of fake CoinOneMessage array. First you get numberMessages_ pointers which point to stuff */ int lengthMessages_; /// Messages CoinOneMessage ** message_; //@} }; // for convenience eol enum CoinMessageMarker { CoinMessageEol = 0, CoinMessageNewline = 1 }; /** Base class for message handling The default behavior is described here: messages are printed, and (if the severity is sufficiently high) execution will be aborted. Inherit and redefine the methods #print and #checkSeverity to augment the behaviour. Messages can be printed with or without a prefix; the prefix will consist of a source string, the external ID number, and a letter code, e.g., Clp6024W. A prefix makes the messages look less nimble but is very useful for "grep" etc.

    Usage

    The general approach to using the COIN messaging facility is as follows:
    • Define your messages. For each message, you must supply an external ID number, a log (detail) level, and a format string. Typically, you define a convenience structure for this, something that's easy to use to create an array of initialised message definitions at compile time.
    • Create a CoinMessages object, sized to accommodate the number of messages you've defined. (Incremental growth will happen if necessary as messages are loaded, but it's inefficient.)
    • Load the messages into the CoinMessages object. Typically this entails creating a CoinOneMessage object for each message and passing it as a parameter to CoinMessages::addMessage(). You specify the message's internal ID as the other parameter to addMessage.
    • Create and use a CoinMessageHandler object to print messages.
    See, for example, CoinMessage.hpp and CoinMessage.cpp for an example of the first three steps. `Format codes' below has a simple example of printing a message.

    External ID numbers and severity

    CoinMessageHandler assumes the following relationship between the external ID number of a message and the severity of the message: \li <3000 are informational ('I') \li <6000 warnings ('W') \li <9000 non-fatal errors ('E') \li >=9000 aborts the program (after printing the message) ('S')

    Log (detail) levels

    The default behaviour is that a message will print if its detail level is less than or equal to the handler's log level. If all you want to do is set a single log level for the handler, use #setLogLevel(int). If you want to get fancy, here's how it really works: There's an array, #logLevels_, which you can manipulate with #setLogLevel(int,int). Each entry logLevels_[i] specifies the log level for messages of class i (see CoinMessages::class_). If logLevels_[0] is set to the magic number -1000 you get the simple behaviour described above, whatever the class of the messages. If logLevels_[0] is set to a valid log level (>= 0), then logLevels_[i] really is the log level for messages of class i.

    Format codes

    CoinMessageHandler can print integers (normal, long, and long long), doubles, characters, and strings. See the descriptions of the various << operators. When processing a standard message with a format string, the formatting codes specified in the format string will be passed to the sprintf function, along with the argument. When generating a message with no format string, each << operator uses a simple format code appropriate for its argument. Consult the documentation for the standard printf facility for further information on format codes. The special format code `%?' provides a hook to enable or disable printing. For each `%?' code, there must be a corresponding call to printing(bool). This provides a way to define optional parts in messages, delineated by the code `%?' in the format string. Printing can be suppressed for these optional parts, but any operands must still be supplied. For example, given the message string \verbatim "A message with%? an optional integer %d and%? a double %g." \endverbatim installed in CoinMessages \c exampleMsgs with index 5, and \c CoinMessageHandler \c hdl, the code \code hdl.message(5,exampleMsgs) ; hdl.printing(true) << 42 ; hdl.printing(true) << 53.5 << CoinMessageEol ; \endcode will print \verbatim A message with an optional integer 42 and a double 53.5. \endverbatim while \code hdl.message(5,exampleMsgs) ; hdl.printing(false) << 42 ; hdl.printing(true) << 53.5 << CoinMessageEol ; \endcode will print \verbatim A message with a double 53.5. \endverbatim For additional examples of usage, see CoinMessageHandlerUnitTest in CoinMessageHandlerTest.cpp. */ class CoinMessageHandler { friend bool CoinMessageHandlerUnitTest () ; public: /**@name Virtual methods that the derived classes may provide */ //@{ /** Print message, return 0 normally. */ virtual int print() ; /** Check message severity - if too bad then abort */ virtual void checkSeverity() ; //@} /**@name Constructors etc */ //@{ /// Constructor CoinMessageHandler(); /// Constructor to put to file pointer (won't be closed) CoinMessageHandler(FILE *fp); /** Destructor */ virtual ~CoinMessageHandler(); /** The copy constructor */ CoinMessageHandler(const CoinMessageHandler&); /** Assignment operator. */ CoinMessageHandler& operator=(const CoinMessageHandler&); /// Clone virtual CoinMessageHandler * clone() const; //@} /**@name Get and set methods */ //@{ /// Get detail level of a message. inline int detail(int messageNumber, const CoinMessages &normalMessage) const { return normalMessage.message_[messageNumber]->detail();} /** Get current log (detail) level. */ inline int logLevel() const { return logLevel_;} /** \brief Set current log (detail) level. If the log level is equal or greater than the detail level of a message, the message will be printed. A rough convention for the amount of output expected is - 0 - none - 1 - minimal - 2 - normal low - 3 - normal high - 4 - verbose Please assign log levels to messages accordingly. Log levels of 8 and above (8,16,32, etc.) are intended for selective debugging. The logical AND of the log level specified in the message and the current log level is used to determine if the message is printed. (In other words, you're using individual bits to determine which messages are printed.) */ void setLogLevel(int value); /** Get alternative log level. */ inline int logLevel(int which) const { return logLevels_[which];} /*! \brief Set alternative log level value. Can be used to store alternative log level information within the handler. */ void setLogLevel(int which, int value); /// Set the number of significant digits for printing floating point numbers void setPrecision(unsigned int new_precision); /// Current number of significant digits for printing floating point numbers inline int precision() { return (g_precision_) ; } /// Switch message prefix on or off. void setPrefix(bool yesNo); /// Current setting for printing message prefix. bool prefix() const; /*! \brief Values of double fields already processed. As the parameter for a double field is processed, the value is saved and can be retrieved using this function. */ inline double doubleValue(int position) const { return doubleValue_[position];} /*! \brief Number of double fields already processed. Incremented each time a field of type double is processed. */ inline int numberDoubleFields() const {return static_cast(doubleValue_.size());} /*! \brief Values of integer fields already processed. As the parameter for a integer field is processed, the value is saved and can be retrieved using this function. */ inline int intValue(int position) const { return longValue_[position];} /*! \brief Number of integer fields already processed. Incremented each time a field of type integer is processed. */ inline int numberIntFields() const {return static_cast(longValue_.size());} /*! \brief Values of char fields already processed. As the parameter for a char field is processed, the value is saved and can be retrieved using this function. */ inline char charValue(int position) const { return charValue_[position];} /*! \brief Number of char fields already processed. Incremented each time a field of type char is processed. */ inline int numberCharFields() const {return static_cast(charValue_.size());} /*! \brief Values of string fields already processed. As the parameter for a string field is processed, the value is saved and can be retrieved using this function. */ inline std::string stringValue(int position) const { return stringValue_[position];} /*! \brief Number of string fields already processed. Incremented each time a field of type string is processed. */ inline int numberStringFields() const {return static_cast(stringValue_.size());} /// Current message inline CoinOneMessage currentMessage() const {return currentMessage_;} /// Source of current message inline std::string currentSource() const {return source_;} /// Output buffer inline const char * messageBuffer() const {return messageBuffer_;} /// Highest message number (indicates any errors) inline int highestNumber() const {return highestNumber_;} /// Get current file pointer inline FILE * filePointer() const { return fp_;} /// Set new file pointer inline void setFilePointer(FILE * fp) { fp_ = fp;} //@} /**@name Actions to create a message */ //@{ /*! \brief Start a message Look up the specified message. A prefix will be generated if enabled. The message will be printed if the current log level is equal or greater than the log level of the message. */ CoinMessageHandler &message(int messageNumber, const CoinMessages &messages) ; /*! \brief Start or continue a message With detail = -1 (default), does nothing except return a reference to the handler. (I.e., msghandler.message() << "foo" is precisely equivalent to msghandler << "foo".) If \p msgDetail is >= 0, is will be used as the detail level to determine whether the message should print (assuming class 0). This can be used with any of the << operators. One use is to start a message which will be constructed entirely from scratch. Another use is continuation of a message after code that interrupts the usual sequence of << operators. */ CoinMessageHandler & message(int detail = -1) ; /*! \brief Print a complete message Generate a standard prefix and append \c msg `as is'. This is intended as a transition mechanism. The standard prefix is generated (if enabled), and \c msg is appended. The message must be ended with a CoinMessageEol marker. Attempts to add content with << will have no effect. The default value of \p detail will not change printing status. If \p detail is >= 0, it will be used as the detail level to determine whether the message should print (assuming class 0). */ CoinMessageHandler &message(int externalNumber, const char *source, const char *msg, char severity, int detail = -1) ; /*! \brief Process an integer parameter value. The default format code is `%d'. */ CoinMessageHandler & operator<< (int intvalue); #if COIN_BIG_INDEX==1 /*! \brief Process a long integer parameter value. The default format code is `%ld'. */ CoinMessageHandler & operator<< (long longvalue); #endif #if COIN_BIG_INDEX==2 /*! \brief Process a long long integer parameter value. The default format code is `%ld'. */ CoinMessageHandler & operator<< (long long longvalue); #endif /*! \brief Process a double parameter value. The default format code is `%d'. */ CoinMessageHandler & operator<< (double doublevalue); /*! \brief Process a STL string parameter value. The default format code is `%g'. */ CoinMessageHandler & operator<< (const std::string& stringvalue); /*! \brief Process a char parameter value. The default format code is `%s'. */ CoinMessageHandler & operator<< (char charvalue); /*! \brief Process a C-style string parameter value. The default format code is `%c'. */ CoinMessageHandler & operator<< (const char *stringvalue); /*! \brief Process a marker. The default format code is `%s'. */ CoinMessageHandler & operator<< (CoinMessageMarker); /** Finish (and print) the message. Equivalent to using the CoinMessageEol marker. */ int finish(); /*! \brief Enable or disable printing of an optional portion of a message. Optional portions of a message are delimited by `%?' markers, and printing processes one %? marker. If \c onOff is true, the subsequent portion of the message (to the next %? marker or the end of the format string) will be printed. If \c onOff is false, printing is suppressed. Parameters must still be supplied, whether printing is suppressed or not. See the class documentation for an example. */ CoinMessageHandler & printing(bool onOff); //@} /** Log levels will be by type and will then use type given in CoinMessage::class_ - 0 - Branch and bound code or similar - 1 - Solver - 2 - Stuff in Coin directory - 3 - Cut generators */ #define COIN_NUM_LOG 4 /// Maximum length of constructed message (characters) #define COIN_MESSAGE_HANDLER_MAX_BUFFER_SIZE 1000 protected: /**@name Protected member data */ //@{ /// values in message std::vector doubleValue_; std::vector longValue_; std::vector charValue_; std::vector stringValue_; /// Log level int logLevel_; /// Log levels int logLevels_[COIN_NUM_LOG]; /// Whether we want prefix (may get more subtle so is int) int prefix_; /// Current message CoinOneMessage currentMessage_; /// Internal number for use with enums int internalNumber_; /// Format string for message (remainder) char * format_; /// Output buffer char messageBuffer_[COIN_MESSAGE_HANDLER_MAX_BUFFER_SIZE]; /// Position in output buffer char * messageOut_; /// Current source of message std::string source_; /** 0 - Normal. 1 - Put in values, move along format, but don't print. 2 - A complete message was provided; nothing more to do but print when CoinMessageEol is processed. Any << operators are treated as noops. 3 - do nothing except look for CoinMessageEol (i.e., the message detail level was not sufficient to cause it to print). */ int printStatus_; /// Highest message number (indicates any errors) int highestNumber_; /// File pointer FILE * fp_; /// Current format for floating point numbers char g_format_[8]; /// Current number of significant digits for floating point numbers int g_precision_ ; //@} private: /** The body of the copy constructor and the assignment operator */ void gutsOfCopy(const CoinMessageHandler &rhs) ; /*! \brief Internal function to locate next format code. Intended for internal use. Side effects modify the format string. */ char *nextPerCent(char *start, const bool initial = false) ; /*! \brief Internal printing function. Makes it easier to split up print into clean, print and check severity */ int internalPrint() ; /// Decide if this message should print. void calcPrintStatus(int msglvl, int msgclass) ; }; //############################################################################# /** A function that tests the methods in the CoinMessageHandler class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ bool CoinMessageHandlerUnitTest(); #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveMonitor.hpp0000644000175000017500000000662312101104050020474 0ustar renerene #ifndef CoinPresolveMonitor_H #define CoinPresolveMonitor_H /*! \brief Monitor a row or column for modification The purpose of this class is to monitor a row or column for modifications during presolve and postsolve. Each object can monitor one row or column. The initial copy of the row or column is loaded by the constructor. Each subsequent call to checkAndTell() compares the current state of the row or column with the stored state and reports any modifications. Internally the row or column is held as a CoinPackedVector so that it's possible to follow a row or column through presolve (CoinPresolveMatrix) and postsolve (CoinPostsolveMatrix). Do not underestimate the amount of work required here. Extracting a row from the CoinPostsolve matrix requires a scan of every element in the matrix. That's one scan by the constructor and one scan with every call to modify. But that's precisely why it's virtually impossible to debug presolve without aids. Parameter overloads for CoinPresolveMatrix and CoinPostsolveMatrix are a little clumsy, but not a problem in use. The alternative is to add methods to the CoinPresolveMatrix and CoinPostsolveMatrix classes that will only be used for debugging. That's not too attractive either. */ class CoinPresolveMonitor { public: /*! \brief Default constructor Creates an empty monitor. */ CoinPresolveMonitor() ; /*! \brief Initialise from a CoinPresolveMatrix Load the initial row or column from a CoinPresolveMatrix. Set \p isRow true for a row, false for a column. */ CoinPresolveMonitor(const CoinPresolveMatrix *mtx, bool isRow, int k) ; /*! \brief Initialise from a CoinPostsolveMatrix Load the initial row or column from a CoinPostsolveMatrix. Set \p isRow true for a row, false for a column. */ CoinPresolveMonitor(const CoinPostsolveMatrix *mtx, bool isRow, int k) ; /*! \brief Compare the present row or column against the stored copy and report differences. Load the current row or column from a CoinPresolveMatrix and compare. Differences are printed to std::cout. */ void checkAndTell(const CoinPresolveMatrix *mtx) ; /*! \brief Compare the present row or column against the stored copy and report differences. Load the current row or column from a CoinPostsolveMatrix and compare. Differences are printed to std::cout. */ void checkAndTell(const CoinPostsolveMatrix *mtx) ; private: /// Extract a row from a CoinPresolveMatrix CoinPackedVector *extractRow(int i, const CoinPresolveMatrix *mtx) const ; /// Extract a column from a CoinPresolveMatrix CoinPackedVector *extractCol(int j, const CoinPresolveMatrix *mtx) const ; /// Extract a row from a CoinPostsolveMatrix CoinPackedVector *extractRow(int i, const CoinPostsolveMatrix *mtx) const ; /// Extract a column from a CoinPostsolveMatrix CoinPackedVector *extractCol(int j, const CoinPostsolveMatrix *mtx) const ; /// Worker method underlying the public checkAndTell methods. void checkAndTell(CoinPackedVector *curVec, double lb, double ub) ; /// True to monitor a row, false to monitor a column bool isRow_ ; /// Row or column index int ndx_ ; /*! The original row or column Sorted in increasing order of indices. */ CoinPackedVector *origVec_ ; /// Original row or column lower bound double lb_ ; /// Original row or column upper bound double ub_ ; } ; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveDual.hpp0000644000175000017500000000543611670247221017755 0ustar renerene/* $Id: CoinPresolveDual.hpp 1510 2011-12-08 23:56:01Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveDual_H #define CoinPresolveDual_H /*! \class remove_dual_action \brief Attempt to fix variables by bounding reduced costs The reduced cost of x_j is d_j = c_j - y*a_j (1). Assume minimization, so that at optimality d_j >= 0 for x_j nonbasic at lower bound, and d_j <= 0 for x_j nonbasic at upper bound. For a slack variable s_i, c_(n+i) = 0 and a_(n+i) is a unit vector, hence d_(n+i) = -y_i. If s_i has a finite lower bound and no upper bound, we must have y_i <= 0 at optimality. Similarly, if s_i has no lower bound and a finite upper bound, we must have y_i >= 0. For a singleton variable x_j, d_j = c_j - y_i*a_ij. Given x_j with a single finite bound, we can bound d_j greater or less than 0 at optimality, and that allows us to calculate an upper or lower bound on y_i (depending on the bound on d_j and the sign of a_ij). Now we have bounds on some subset of the y_i, and we can use these to calculate upper and lower bounds on the d_j, using bound propagation on (1). If we can manage to bound some d_j as strictly positive or strictly negative, then at optimality the corresponding variable must be nonbasic at its lower or upper bound, respectively. If the required bound is lacking, the problem is unbounded. */ class remove_dual_action : public CoinPresolveAction { public: /// Destructor ~remove_dual_action () ; /// Name inline const char *name () const { return ("remove_dual_action") ; } /*! \brief Attempt to fix variables by bounding reduced costs Always scans all variables. Propagates bounds on reduced costs until there's no change or until some set of variables can be fixed. */ static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next) ; /*! \brief Postsolve In addition to fixing variables (handled by make_fixed_action), we may need use our own postsolve to restore constraint bounds. */ void postsolve (CoinPostsolveMatrix *prob) const ; private: /// Postsolve (bound restore) instruction struct action { double rlo_ ; ///< restored row lower bound double rup_ ; ///< restored row upper bound int ndx_ ; ///< row index } ; /// Constructor with postsolve actions. remove_dual_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} /// Count of bound restore entries const int nactions_ ; /// Bound restore entries const action *actions_ ; } ; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveFixed.cpp0000644000175000017500000006224012055734076020125 0ustar renerene/* $Id: CoinPresolveFixed.cpp 1565 2012-11-29 19:32:14Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPresolveMatrix.hpp" #include "CoinPresolveFixed.hpp" #include "CoinHelperFunctions.hpp" #include "CoinFinite.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif /* Begin routines associated with remove_fixed_action */ const char *remove_fixed_action::name() const { return ("remove_fixed_action"); } /* * Original comment: * * invariant: both reps are loosely packed. * coefficients of both reps remain consistent. * * Note that this concerns variables whose column bounds determine that * they are slack; this does NOT concern singleton row constraints that * determine that the relevant variable is slack. * * Invariant: col and row rep are consistent */ /* This routine empties the columns for the list of fixed variables passed in (fcols, nfcols). As each coefficient a is set to 0, rlo and rup are adjusted accordingly. Note, however, that c is not considered to be removed from the objective until column j is physically removed from the matrix (drop_empty_cols_action), so the correction to the objective is adjusted there. If a column solution is available, row activity (acts_) is adjusted. remove_fixed_action implicitly assumes that the value of the variable has already been forced within bounds. If this isn't true, the correction to acts_ will be wrong. See make_fixed_action if you need to force the value within bounds first. */ const remove_fixed_action* remove_fixed_action::presolve (CoinPresolveMatrix *prob, int *fcols, int nfcols, const CoinPresolveAction *next) { double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; double *rowels = prob->rowels_; int *hcol = prob->hcol_; CoinBigIndex *mrstrt = prob->mrstrt_; int *hinrow = prob->hinrow_; double *clo = prob->clo_; double *rlo = prob->rlo_; double *rup = prob->rup_; double *sol = prob->sol_; double *acts = prob->acts_; presolvehlink *clink = prob->clink_; presolvehlink *rlink = prob->rlink_; action *actions = new action[nfcols+1]; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering remove_fixed_action::presolve; processing " << nfcols << " fixed columns." << std::endl ; # endif presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif /* Scan columns to be removed and total up the number of coefficients. */ int estsize=0; int ckc; for (ckc = 0 ; ckc < nfcols ; ckc++) { int j = fcols[ckc]; estsize += hincol[j]; } // Allocate arrays to hold coefficients and associated row indices double * els_action = new double[estsize]; int * rows_action = new int[estsize]; int actsize=0; // faster to do all deletes in row copy at once int nrows = prob->nrows_; CoinBigIndex * rstrt = new int[nrows+1]; CoinZeroN(rstrt,nrows); /* Open a loop to excise each column a. The first thing to do is load the action entry with the index j, the value of x, and the number of entries in a. After we walk the column and tweak the row-major representation, we'll simply claim this column is empty by setting hincol[j] = 0. */ for (ckc = 0 ; ckc < nfcols ; ckc++) { int j = fcols[ckc]; double solj = clo[j]; CoinBigIndex kcs = mcstrt[j]; CoinBigIndex kce = kcs + hincol[j]; CoinBigIndex k; { action &f = actions[ckc]; f.col = j; f.sol = solj; f.start = actsize; } /* Now walk a. For each row i with a coefficient a != 0: * save the coefficient and row index, * substitute the value of x, adjusting the row bounds and lhs value accordingly, then * delete a from the row-major representation. * Finally: mark the row as changed and add it to the list of rows to be processed next. Then, for each remaining column in the row, put it on the list of columns to be processed. */ for (k = kcs ; k < kce ; k++) { int row = hrow[k]; double coeff = colels[k]; els_action[actsize]=coeff; rstrt[row]++; // increase counts rows_action[actsize++]=row; // Avoid reducing finite infinity. if (-PRESOLVE_INF < rlo[row]) rlo[row] -= solj*coeff; if (rup[row] < PRESOLVE_INF) rup[row] -= solj*coeff; if (sol) { acts[row] -= solj*coeff; } #define TRY2 #ifndef TRY2 presolve_delete_from_row(row,j,mrstrt,hinrow,hcol,rowels); if (hinrow[row] == 0) { PRESOLVE_REMOVE_LINK(rlink,row) ; } // mark unless already marked if (!prob->rowChanged(row)) { prob->addRow(row); CoinBigIndex krs = mrstrt[row]; CoinBigIndex kre = krs + hinrow[row]; for (CoinBigIndex k=krs; kaddCol(jcol); } } #endif } /* Remove the column's link from the linked list of columns, and declare it empty in the column-major representation. Link removal must execute even if the column is already of length 0 when it arrives. */ PRESOLVE_REMOVE_LINK(clink, j); hincol[j] = 0; } /* Set the actual end of the coefficient and row index arrays. */ actions[nfcols].start=actsize; # if PRESOLVE_SUMMARY printf("NFIXED: %d", nfcols); if (estsize-actsize > 0) { printf(", overalloc %d",estsize-actsize) ; } printf("\n") ; # endif // Now get columns by row int * column = new int[actsize]; int nel=0; int iRow; for (iRow=0;iRowncols_; char * mark = new char[ncols]; memset(mark,0,ncols); // rstrts are now one out i.e. rstrt[0] is end of row 0 nel=0; #ifdef TRY2 for (iRow=0;iRow 0 for (k = nel ; k < rstrt[iRow] ; k++) { assert(mark[column[k]] == 0) ; } #endif if (hinrow[iRow] == 0) { PRESOLVE_REMOVE_LINK(rlink,iRow) ; } // mark unless already marked if (!prob->rowChanged(iRow)) { prob->addRow(iRow); CoinBigIndex krs = mrstrt[iRow]; CoinBigIndex kre = krs + hinrow[iRow]; for (CoinBigIndex k=krs; kaddCol(jcol); } } nel=rstrt[iRow]; } #endif delete [] mark; delete [] column; delete [] rstrt; /* Create the postsolve object, link it at the head of the list of postsolve objects, and return a pointer. */ const remove_fixed_action *fixedActions = new remove_fixed_action(nfcols,actions,els_action,rows_action,next) ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_sol(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving remove_fixed_action::presolve." << std::endl ; # endif # endif return (fixedActions) ; } remove_fixed_action::remove_fixed_action(int nactions, action *actions, double * els_action, int * rows_action, const CoinPresolveAction *next) : CoinPresolveAction(next), colrows_(rows_action), colels_(els_action), nactions_(nactions), actions_(actions) { } remove_fixed_action::~remove_fixed_action() { deleteAction(actions_,action*); delete [] colels_; delete [] colrows_; } /* * Say we determined that cup - clo <= ztolzb, so we fixed sol at clo. * This involved subtracting clo*coeff from ub/lb for each row the * variable occurred in. * Now when we put the variable back in, by construction the variable * is within tolerance, the non-slacks are unchanged, and the * distances of the affected slacks from their bounds should remain * unchanged (ignoring roundoff errors). * It may be that by adding the term back in, the affected constraints * now aren't as accurate due to round-off errors; this could happen * if only one summand and the slack in the original formulation were large * (and naturally had opposite signs), and the new term in the constraint * is about the size of the old slack, so the new slack becomes about 0. * It may be that there is catastrophic cancellation in the summation, * so it might not compute to 0. */ void remove_fixed_action::postsolve(CoinPostsolveMatrix *prob) const { action * actions = actions_; const int nactions = nactions_; double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; int *link = prob->link_; CoinBigIndex &free_list = prob->free_list_; double *clo = prob->clo_; double *cup = prob->cup_; double *rlo = prob->rlo_; double *rup = prob->rup_; double *sol = prob->sol_; double *dcost = prob->cost_; double *rcosts = prob->rcosts_; double *acts = prob->acts_; double *rowduals = prob->rowduals_; unsigned char *colstat = prob->colstat_; const double maxmin = prob->maxmin_; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 char *cdone = prob->cdone_; # if PRESOLVE_DEBUG > 0 std::cout << "Entering remove_fixed_action::postsolve, repopulating " << nactions << " columns." << std::endl ; # endif presolve_check_threads(prob) ; presolve_check_free_list(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif double * els_action = colels_; int * rows_action = colrows_; int end = actions[nactions].start; /* At one point, it turned out that forcing_constraint_action was putting duplicates in the column list it passed to remove_fixed_action. This is now fixed, but ... it looks to me like we could be in trouble here if we reinstate a column multiple times. Hence the assert. */ for (const action *f = &actions[nactions-1]; actions<=f; f--) { int icol = f->col; const double thesol = f->sol; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 if (cdone[icol] == FIXED_VARIABLE) { std::cout << "RFA::postsolve: column " << icol << " already unfixed!" << std::endl ; assert(cdone[icol] != FIXED_VARIABLE) ; } cdone[icol] = FIXED_VARIABLE ; # endif sol[icol] = thesol; clo[icol] = thesol; cup[icol] = thesol; int cs = NO_LINK ; int start = f->start; double dj = maxmin * dcost[icol]; for (int i=start; i= 0 && k < prob->bulk0_) ; free_list = link[free_list]; // restore hrow[k] = row; colels[k] = coeff; link[k] = cs; cs = k; if (-PRESOLVE_INF < rlo[row]) rlo[row] += coeff * thesol; if (rup[row] < PRESOLVE_INF) rup[row] += coeff * thesol; acts[row] += coeff * thesol; dj -= rowduals[row] * coeff; } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif mcstrt[icol] = cs; rcosts[icol] = dj; hincol[icol] = end-start; end=start; /* Original comment: * the bounds in the reduced problem were tightened. * that means that this variable may not have been basic * because it didn't have to be, * but now it may have to. * no - the bounds aren't changed by this operation */ /* We've reintroduced the variable, but it's still fixed (equal bounds). Pick the nonbasic status that agrees with the reduced cost. Later, if postsolve unfixes the variable, we'll need to confirm that this status is still viable. We live in a minimisation world here. */ if (colstat) { if (dj < 0) prob->setColumnStatus(icol,CoinPrePostsolveMatrix::atUpperBound); else prob->setColumnStatus(icol,CoinPrePostsolveMatrix::atLowerBound); } } # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving remove_fixed_action::postsolve." << std::endl ; # endif # endif return ; } /* Scan the problem for variables that are already fixed, and remove them. There's an implicit assumption that the value of the variable is already within bounds. If you want to protect against this possibility, you want to use make_fixed. */ const CoinPresolveAction *remove_fixed (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { int ncols = prob->ncols_; int *fcols = new int[ncols]; int nfcols = 0; int *hincol = prob->hincol_; double *clo = prob->clo_; double *cup = prob->cup_; for (int i = 0 ; i < ncols ; i++) if (hincol[i] > 0 && clo[i] == cup[i]&&!prob->colProhibited2(i)) fcols[nfcols++] = i; if (nfcols > 0) { next = remove_fixed_action::presolve(prob, fcols, nfcols, next) ; } delete[]fcols; return (next); } /* End routines associated with remove_fixed_action */ /* Begin routines associated with make_fixed_action */ const char *make_fixed_action::name() const { return ("make_fixed_action"); } /* This routine does the actual job of fixing one or more variables. The set of indices to be fixed is specified by nfcols and fcols. fix_to_lower specifies the bound where the variable(s) should be fixed. The other bound is preserved as part of the action and the bounds are set equal. Note that you don't get to specify the bound on a per-variable basis. If a primal solution is available, make_fixed_action will adjust the the row activity to compensate for forcing the variable within bounds. If the bounds are already equal, and the variable is within bounds, you should consider remove_fixed_action. */ const CoinPresolveAction* make_fixed_action::presolve (CoinPresolveMatrix *prob, int *fcols, int nfcols, bool fix_to_lower, const CoinPresolveAction *next) { double *clo = prob->clo_; double *cup = prob->cup_; double *csol = prob->sol_; double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; double *acts = prob->acts_; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering make_fixed_action::presolve, fixed = " << nfcols << "." << std::endl ; # endif presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif /* Shouldn't happen, but ... */ if (nfcols <= 0) { # if PRESOLVE_DEBUG > 0 std::cout << "make_fixed_action::presolve: useless call, " << nfcols << " to fix." << std::endl ; # endif return (next) ; } action *actions = new action[nfcols] ; /* Scan the set of indices specifying variables to be fixed. For each variable, stash the unused bound in the action and set the bounds equal. If the client has passed in a primal solution, update it if the value of the variable changes. */ for (int ckc = 0 ; ckc < nfcols ; ckc++) { int j = fcols[ckc] ; double movement = 0 ; action &f = actions[ckc] ; f.col = j ; if (fix_to_lower) { f.bound = cup[j]; cup[j] = clo[j]; if (csol) { movement = clo[j]-csol[j] ; csol[j] = clo[j] ; } } else { f.bound = clo[j]; clo[j] = cup[j]; if (csol) { movement = cup[j]-csol[j]; csol[j] = cup[j]; } } if (movement) { CoinBigIndex k; for (k = mcstrt[j] ; k < mcstrt[j]+hincol[j] ; k++) { int row = hrow[k]; acts[row] += movement*colels[k]; } } } /* Original comment: This is unusual in that the make_fixed_action transform contains within it a remove_fixed_action transform. Bad idea? Explanatory comment: Now that we've adjusted the bounds, time to create the postsolve action that will restore the original bounds. But wait! We're not done. By calling remove_fixed_action::presolve, we will (virtually) remove these variables from the model by substituting for the variable where it occurs and emptying the column. Cache the postsolve transform that will repopulate the column inside the postsolve transform for fixing the bounds. */ if (nfcols > 0) { next = new make_fixed_action(nfcols,actions,fix_to_lower, remove_fixed_action::presolve(prob,fcols,nfcols,0), next) ; } # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving make_fixed_action::presolve." << std::endl ; # endif # endif return (next) ; } /* Recall that in presolve, make_fixed_action forced a bound to fix a variable, then called remove_fixed_action to empty the column. removed_fixed_action left a postsolve object hanging off faction_, and our first act here is to call r_f_a::postsolve to repopulate the columns. The m_f_a postsolve activity consists of relaxing one of the bounds and making sure that the status is still viable (we can potentially eliminate the bound here). */ void make_fixed_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_; const int nactions = nactions_; const bool fix_to_lower = fix_to_lower_; double *clo = prob->clo_; double *cup = prob->cup_; double *sol = prob->sol_ ; unsigned char *colstat = prob->colstat_; # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering make_fixed_action::postsolve." << std::endl ; # endif presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif /* Repopulate the columns. */ assert(nactions == faction_->nactions_) ; faction_->postsolve(prob); /* Walk the actions: restore each bound and check that the status is still appropriate. Given that we're unfixing a fixed variable, it's safe to assume that the unaffected bound is finite. */ for (int cnt = nactions-1 ; cnt >= 0 ; cnt--) { const action *f = &actions[cnt]; int icol = f->col; double xj = sol[icol] ; assert(faction_->actions_[cnt].col == icol) ; if (fix_to_lower) { double ub = f->bound ; cup[icol] = ub ; if (colstat) { if (ub >= PRESOLVE_INF || xj != ub) { prob->setColumnStatus(icol, CoinPrePostsolveMatrix::atLowerBound) ; } } } else { double lb = f->bound ; clo[icol] = lb ; if (colstat) { if (lb <= -PRESOLVE_INF || xj != lb) { prob->setColumnStatus(icol, CoinPrePostsolveMatrix::atUpperBound) ; } } } } # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; std::cout << "Leaving make_fixed_action::postsolve." << std::endl ; # endif return ; } /* Scan the columns and collect indices of columns that have upper and lower bounds within the zero tolerance of one another. Hand this list to make_fixed_action::presolve() to do the heavy lifting. make_fixed_action will compensate for variables which are infeasible, forcing them to feasibility and correcting the row activity, before invoking remove_fixed_action to remove the variable from the problem. If you're confident of feasibility, consider remove_fixed. */ const CoinPresolveAction *make_fixed (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering make_fixed, checking " << prob->ncols_ << " columns." << std::endl ; # endif presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif int ncols = prob->ncols_ ; int *fcols = prob->usefulColumnInt_ ; int nfcols = 0 ; int *hincol = prob->hincol_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; for (int i = 0 ; i < ncols ; i++) { if (hincol[i] > 0 && fabs(cup[i]-clo[i]) < ZTOLDP && !prob->colProhibited2(i)) { fcols[nfcols++] = i ; } } /* Call m_f_a::presolve to do the heavy lifting. This will create a new CoinPresolveAction, which will become the head of the list of CoinPresolveAction's currently pointed to by next. No point in going through the effort of a call if there are no fixed variables. */ if (nfcols > 0) next = make_fixed_action::presolve(prob,fcols,nfcols,true,next) ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving make_fixed, fixed " << nfcols << " columns." << std::endl ; # endif # endif return (next) ; } /* Transfer the cost coefficient of a column singleton in an equality to the cost coefficients of the remaining variables. Suppose x is the singleton and x is some other variable. For movement delta, there must be compensating change delta = -(a/a)delta. Substituting in the objective, cdelta + cdelta becomes c(-a/a)delta + cdelta (c - c(a/a))delta This is transform (A) below. */ void transferCosts (CoinPresolveMatrix *prob) { double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; double *rowels = prob->rowels_ ; int *hcol = prob->hcol_ ; CoinBigIndex *mrstrt = prob->mrstrt_ ; int *hinrow = prob->hinrow_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; int ncols = prob->ncols_ ; double *cost = prob->cost_ ; unsigned char *integerType = prob->integerType_ ; double bias = prob->dobias_ ; # if PRESOLVE_DEBUG > 0 std::cout << "Entering transferCosts." << std::endl ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif int numberIntegers = 0 ; for (int icol = 0 ; icol < ncols ; icol++) { if (integerType[icol]) numberIntegers++ ; } /* For unfixed column singletons in equalities, calculate and install transform (A) described in the comments at the head of the method. */ int nchanged = 0 ; for (int js = 0 ; js < ncols ; js++) { if (cost[js] && hincol[js] == 1 && cup[js] > clo[js]) { const CoinBigIndex &jsstrt = mcstrt[js] ; const int &i = hrow[jsstrt]; if (rlo[i] == rup[i]) { const double ratio = cost[js]/colels[jsstrt]; bias += rlo[i]*ratio ; const CoinBigIndex &istrt = mrstrt[i] ; const CoinBigIndex iend = istrt+hinrow[i] ; for (CoinBigIndex jj = istrt ; jj < iend ; jj++) { int j = hcol[jj] ; double aij = rowels[jj] ; cost[j] -= ratio*aij ; } cost[js] = 0.0 ; nchanged++ ; } } } # if PRESOLVE_DEBUG > 0 if (nchanged) std::cout << " transferred costs for " << nchanged << " singleton columns." << std::endl ; int nPasses = 0 ; # endif /* We don't really need a singleton column to do this trick, just an equality. But if the column's not a singleton, it's only worth doing if we can move costs onto integer variables that start with costs of zero. Try and find some unfixed variable with a nonzero cost, that's involved in an equality where there are integer variables with costs of zero. If there's a net gain in the number of integer variables with costs (nThen > nNow), do the transform. One per column, please. */ if (numberIntegers) { int changed = -1 ; while (changed) { changed = 0 ; for (int js = 0 ; js < ncols ; js++) { if (cost[js] && cup[js] > clo[js]) { const CoinBigIndex &jsstrt = mcstrt[js] ; const CoinBigIndex jsend = jsstrt+hincol[js] ; for (CoinBigIndex ii = jsstrt ; ii < jsend ; ii++) { const int &i = hrow[ii] ; if (rlo[i] == rup[i]) { int nNow = ((integerType[js])?1:0) ; int nThen = 0 ; const CoinBigIndex &istrt = mrstrt[i] ; const CoinBigIndex iend = istrt+hinrow[i] ; for (CoinBigIndex jj = istrt ; jj < iend ; jj++) { int j = hcol[jj] ; if (!cost[j] && integerType[j]) nThen++ ; } if (nThen > nNow) { const double ratio = cost[js]/colels[jsstrt] ; bias += rlo[i]*ratio ; for (CoinBigIndex jj = istrt ; jj < iend ; jj++) { int j = hcol[jj] ; double aij = rowels[jj] ; cost[j] -= ratio*aij ; } cost[js] = 0.0 ; changed++ ; break ; } } } } } if (changed) { nchanged += changed ; # if PRESOLVE_DEBUG > 0 std::cout << " pass " << nPasses++ << " transferred costs to " << changed << " integer variables." << std::endl ; # endif } } } # if PRESOLVE_DEBUG > 0 if (bias != prob->dobias_) std::cout << " new bias " << bias << "." << std::endl ; # endif prob->dobias_ = bias; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving transferCosts." << std::endl ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif } CoinMP-1.8.3/CoinUtils/src/CoinSearchTree.cpp0000644000175000017500000000472412131061540017356 0ustar renerene/* $Id: CoinSearchTree.cpp 1589 2013-04-09 18:52:16Z stefan $ */ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinSearchTree.hpp" BitVector128::BitVector128() { bits_[0] = 0; bits_[1] = 0; bits_[2] = 0; bits_[3] = 0; } BitVector128::BitVector128(unsigned int bits[4]) { set(bits); } void BitVector128::set(unsigned int bits[4]) { bits_[0] = bits[0]; bits_[1] = bits[1]; bits_[2] = bits[2]; bits_[3] = bits[3]; } void BitVector128::setBit(int i) { int byte = i >> 5; int bit = i & 31; bits_[byte] |= (1 << bit); } void BitVector128::clearBit(int i) { int byte = i >> 5; int bit = i & 31; bits_[byte] &= ~(1 << bit); } std::string BitVector128::str() const { char output[33]; output[32] = 0; sprintf(output, "%08X%08X%08X%08X", bits_[3], bits_[2], bits_[1], bits_[0]); return output; } bool operator<(const BitVector128& b0, const BitVector128& b1) { if (b0.bits_[3] < b1.bits_[3]) return true; if (b0.bits_[3] > b1.bits_[3]) return false; if (b0.bits_[2] < b1.bits_[2]) return true; if (b0.bits_[2] > b1.bits_[2]) return false; if (b0.bits_[1] < b1.bits_[1]) return true; if (b0.bits_[1] > b1.bits_[1]) return false; return (b0.bits_[0] < b1.bits_[0]); } void CoinSearchTreeManager::newSolution(double solValue) { ++numSolution; hasUB_ = true; CoinTreeNode* top = candidates_->top(); const double q = top ? top->getQuality() : solValue; const bool switchToDFS = fabs(q) < 1e-3 ? (fabs(solValue) < 0.005) : ((solValue-q)/fabs(q) < 0.005); if (switchToDFS && dynamic_cast*>(candidates_) == NULL) { CoinSearchTree* cands = new CoinSearchTree(*candidates_); delete candidates_; candidates_ = cands; } } void CoinSearchTreeManager::reevaluateSearchStrategy() { const int n = candidates_->numInserted() % 1000; /* the tests below ensure that even if this method is not invoked after every push(), the search strategy will be reevaluated when n is ~500 */ if (recentlyReevaluatedSearchStrategy_) { if (n > 250 && n <= 500) { recentlyReevaluatedSearchStrategy_ = false; } } else { if (n > 500) { recentlyReevaluatedSearchStrategy_ = true; /* we can reevaluate things... */ } } } CoinMP-1.8.3/CoinUtils/src/CoinStructuredModel.cpp0000644000175000017500000017661012312310414020460 0ustar renerene/* $Id: CoinStructuredModel.cpp 1691 2014-03-19 12:43:56Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinUtilsConfig.h" #include "CoinHelperFunctions.hpp" #include "CoinStructuredModel.hpp" #include "CoinSort.hpp" #include "CoinMpsIO.hpp" #include "CoinMessage.hpp" #include "CoinFloatEqual.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CoinStructuredModel::CoinStructuredModel () : CoinBaseModel(), numberRowBlocks_(0), numberColumnBlocks_(0), numberElementBlocks_(0), maximumElementBlocks_(0), blocks_(NULL), coinModelBlocks_(NULL), blockType_(NULL) { } /* Read a problem in MPS or GAMS format from the given filename. */ CoinStructuredModel::CoinStructuredModel(const char *fileName, int decomposeType, int maxBlocks) : CoinBaseModel(), numberRowBlocks_(0), numberColumnBlocks_(0), numberElementBlocks_(0), maximumElementBlocks_(0), blocks_(NULL), coinModelBlocks_(NULL), blockType_(NULL) { CoinModel coinModel(fileName,false); if (coinModel.numberRows()) { problemName_ = coinModel.getProblemName(); optimizationDirection_ = coinModel.optimizationDirection(); objectiveOffset_ = coinModel.objectiveOffset(); if (!decomposeType) { addBlock("row_master","column_master",coinModel); } else { const CoinPackedMatrix * matrix = coinModel.packedMatrix(); if (!matrix) coinModel.convertMatrix(); decompose(coinModel,decomposeType,maxBlocks); //addBlock("row_master","column_master",coinModel); } } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinStructuredModel::CoinStructuredModel (const CoinStructuredModel & rhs) : CoinBaseModel(rhs), numberRowBlocks_(rhs.numberRowBlocks_), numberColumnBlocks_(rhs.numberColumnBlocks_), numberElementBlocks_(rhs.numberElementBlocks_), maximumElementBlocks_(rhs.maximumElementBlocks_) { if (maximumElementBlocks_) { blocks_ = CoinCopyOfArray(rhs.blocks_,maximumElementBlocks_); for (int i=0;iclone(); blockType_ = CoinCopyOfArray(rhs.blockType_,maximumElementBlocks_); if (rhs.coinModelBlocks_) { coinModelBlocks_ = CoinCopyOfArray(rhs.coinModelBlocks_, maximumElementBlocks_); for (int i=0;iclone(); blockType_ = CoinCopyOfArray(rhs.blockType_,maximumElementBlocks_); if (rhs.coinModelBlocks_) { coinModelBlocks_ = CoinCopyOfArray(rhs.coinModelBlocks_, maximumElementBlocks_); for (int i=0;inumberRows(); for ( i=0;igetRowName(i); const char * bName = b->getRowName(i); bool good=true; if (aName) { if (!bName||strcmp(aName,bName)) good=false; } else if (bName) { good=false; } if (!good) break; } } else { n = a->numberColumns(); for ( i=0;igetColumnName(i); const char * bName = b->getColumnName(i); bool good=true; if (aName) { if (!bName||strcmp(aName,bName)) good=false; } else if (bName) { good=false; } if (!good) break; } } return (i==n); } // Add a row block name and number of rows int CoinStructuredModel::addRowBlock(int numberRows,const std::string &name) { int iRowBlock; for (iRowBlock=0;iRowBlocknumberElements(); } return numberElements; } // Return i'th block as CoinModel (or NULL) CoinModel * CoinStructuredModel::coinBlock(int i) const { CoinModel * block = dynamic_cast(blocks_[i]); if (block) return block; else if (coinModelBlocks_) return coinModelBlocks_[i]; else return NULL; } /* Return block as a CoinModel block and fill in info structure and update counts */ CoinModel * CoinStructuredModel::coinModelBlock(CoinModelBlockInfo & info) { // CoinStructuredModel int numberRows=this->numberRows(); int numberColumns =this-> numberColumns(); int numberRowBlocks=this->numberRowBlocks(); int numberColumnBlocks =this-> numberColumnBlocks(); int numberElementBlocks =this-> numberElementBlocks(); CoinBigIndex numberElements=this->numberElements(); // See what is needed double * rowLower = NULL; double * rowUpper = NULL; double * columnLower = NULL; double * columnUpper = NULL; double * objective = NULL; int * integerType = NULL; info = CoinModelBlockInfo(); CoinModel ** blocks = new CoinModel * [numberElementBlocks]; for (int iBlock=0;iBlock(blocks_[iBlock]); CoinModel * thisBlock; if (subModel) { thisBlock = subModel->coinModelBlock(thisInfo); fillInfo(thisInfo,subModel); setCoinModel(thisBlock,iBlock); } else { thisBlock = dynamic_cast(blocks_[iBlock]); assert (thisBlock); fillInfo(thisInfo,thisBlock); } blocks[iBlock]=thisBlock; if (thisInfo.rhs&&!info.rhs) { info.rhs=1; rowLower = new double [numberRows]; rowUpper = new double [numberRows]; CoinFillN(rowLower,numberRows,-COIN_DBL_MAX); CoinFillN(rowUpper,numberRows,COIN_DBL_MAX); } if (thisInfo.bounds&&!info.bounds) { info.bounds=1; columnLower = new double [numberColumns]; columnUpper = new double [numberColumns]; objective = new double [numberColumns]; CoinFillN(columnLower,numberColumns,0.0); CoinFillN(columnUpper,numberColumns,COIN_DBL_MAX); CoinFillN(objective,numberColumns,0.0); } if (thisInfo.integer&&!info.integer) { info.integer=1; integerType = new int [numberColumns]; CoinFillN(integerType,numberColumns,0); } if (thisInfo.rowName&&!info.rowName) { info.rowName=1; } if (thisInfo.columnName&&!info.columnName) { info.columnName=1; } } // Space for elements int * row = new int[numberElements]; int * column = new int[numberElements]; double * element = new double[numberElements]; numberElements=0; // Bases for blocks int * rowBase = new int[numberRowBlocks]; CoinFillN(rowBase,numberRowBlocks,-1); CoinModelBlockInfo * rowBlockInfo = new CoinModelBlockInfo [numberRowBlocks]; int * columnBase = new int[numberColumnBlocks]; CoinFillN(columnBase,numberColumnBlocks,-1); CoinModelBlockInfo * columnBlockInfo = new CoinModelBlockInfo [numberColumnBlocks]; for (int iBlock=0;iBlockgetRowBlock()); assert (iRowBlock>=0&&iRowBlocknumberRows(); else assert (rowBase[iRowBlock]==blocks[iBlock]->numberRows()); int iColumnBlock = columnBlock(blocks[iBlock]->getColumnBlock()); assert (iColumnBlock>=0&&iColumnBlocknumberColumns(); else assert (columnBase[iColumnBlock]==blocks[iBlock]->numberColumns()); } int n=0; for (int iBlock=0;iBlock=0); n+=k; } assert (n==numberRows); n=0; for (int iBlock=0;iBlock=0); n+=k; } assert (n==numberColumns); for (int iBlock=0;iBlockgetRowBlock()); int iRowBase = rowBase[iRowBlock]; int nRows = thisBlock->numberRows(); // could check if identical before error if (thisInfo.rhs) { assert (!rowBlockInfo[iRowBlock].rhs); rowBlockInfo[iRowBlock].rhs=1; memcpy(rowLower+iRowBase,thisBlock->rowLowerArray(), nRows*sizeof(double)); memcpy(rowUpper+iRowBase,thisBlock->rowUpperArray(), nRows*sizeof(double)); } int iColumnBlock = columnBlock(blocks[iBlock]->getColumnBlock()); int iColumnBase = columnBase[iColumnBlock]; int nColumns = thisBlock->numberColumns(); if (thisInfo.bounds) { assert (!columnBlockInfo[iColumnBlock].bounds); columnBlockInfo[iColumnBlock].bounds=1; memcpy(columnLower+iColumnBase,thisBlock->columnLowerArray(), nColumns*sizeof(double)); memcpy(columnUpper+iColumnBase,thisBlock->columnUpperArray(), nColumns*sizeof(double)); memcpy(objective+iColumnBase,thisBlock->objectiveArray(), nColumns*sizeof(double)); } if (thisInfo.integer) { assert (!columnBlockInfo[iColumnBlock].integer); columnBlockInfo[iColumnBlock].integer=1; memcpy(integerType+iColumnBase,thisBlock->integerTypeArray(), nColumns*sizeof(int)); } const CoinPackedMatrix * elementBlock = thisBlock->packedMatrix(); // get matrix data pointers const int * row2 = elementBlock->getIndices(); const CoinBigIndex * columnStart = elementBlock->getVectorStarts(); const double * elementByColumn = elementBlock->getElements(); const int * columnLength = elementBlock->getVectorLengths(); int n = elementBlock->getNumCols(); assert (elementBlock->isColOrdered()); for (int iColumn=0;iColumnsetColumnIsInteger(iColumn,integerType[iColumn]!=0); } } delete [] integerType; block->setObjectiveOffset(objectiveOffset()); if (info.rowName||info.columnName) { for (int iBlock=0;iBlockgetRowBlock()); int iRowBase = rowBase[iRowBlock]; if (thisInfo.rowName) { int numberItems = thisBlock->rowNames()->numberItems(); assert( thisBlock->numberRows()>=numberItems); if (numberItems) { const char *const * rowNames=thisBlock->rowNames()->names(); for (int i=0;isetRowName(i+iRowBase,name.c_str()); } } } int iColumnBlock = columnBlock(thisBlock->getColumnBlock()); int iColumnBase = columnBase[iColumnBlock]; if (thisInfo.columnName) { int numberItems = thisBlock->columnNames()->numberItems(); assert( thisBlock->numberColumns()>=numberItems); if (numberItems) { const char *const * columnNames=thisBlock->columnNames()->names(); for (int i=0;isetColumnName(i+iColumnBase,name.c_str()); } } } } } delete [] rowBase; delete [] columnBase; for (int iBlock=0;iBlock (blocks[iBlock])!= static_cast (blocks_[iBlock])) delete blocks[iBlock]; } delete [] blocks; return block; } // Sets given block into coinModelBlocks_ void CoinStructuredModel::setCoinModel(CoinModel * block, int iBlock) { if (!coinModelBlocks_) { coinModelBlocks_ = new CoinModel * [maximumElementBlocks_]; CoinZeroN(coinModelBlocks_,maximumElementBlocks_); } delete coinModelBlocks_[iBlock]; coinModelBlocks_[iBlock]=block; } // Refresh info in blockType_ void CoinStructuredModel::refresh(int iBlock) { fillInfo(blockType_[iBlock],coinBlock(iBlock)); } /* Fill in info structure and update counts Returns number of inconsistencies on border */ int CoinStructuredModel::fillInfo(CoinModelBlockInfo & info, const CoinModel * block) { int whatsSet = block->whatIsSet(); info.matrix = static_cast(((whatsSet&1)!=0) ? 1 : 0); info.rhs = static_cast(((whatsSet&2)!=0) ? 1 : 0); info.rowName = static_cast(((whatsSet&4)!=0) ? 1 : 0); info.integer = static_cast(((whatsSet&32)!=0) ? 1 : 0); info.bounds = static_cast(((whatsSet&8)!=0) ? 1 : 0); info.columnName = static_cast(((whatsSet&16)!=0) ? 1 : 0); int numberRows = block->numberRows(); int numberColumns = block->numberColumns(); // Which block int iRowBlock=addRowBlock(numberRows,block->getRowBlock()); info.rowBlock=iRowBlock; int iColumnBlock=addColumnBlock(numberColumns,block->getColumnBlock()); info.columnBlock=iColumnBlock; int numberErrors=0; CoinModelBlockInfo sumInfo=blockType_[numberElementBlocks_-1]; int iRhs=(sumInfo.rhs) ? numberElementBlocks_-1 : -1; int iRowName=(sumInfo.rowName) ? numberElementBlocks_-1 : -1; int iBounds=(sumInfo.bounds) ? numberElementBlocks_-1 : -1; int iColumnName=(sumInfo.columnName) ? numberElementBlocks_-1 : -1; int iInteger=(sumInfo.integer) ? numberElementBlocks_-1 : -1; for (int i=0;inumberRows()) numberErrors+=1000; if (blockType_[i].rhs) { if (iRhs<0) { iRhs=i; } else { // check const double * a = static_cast(blocks_[iRhs])->rowLowerArray(); const double * b = static_cast(blocks_[i])->rowLowerArray(); if (!sameValues(a,b,numberRows)) numberErrors++; a = static_cast(blocks_[iRhs])->rowUpperArray(); b = static_cast(blocks_[i])->rowUpperArray(); if (!sameValues(a,b,numberRows)) numberErrors++; } } if (blockType_[i].rowName) { if (iRowName<0) { iRowName=i; } else { // check if (!sameValues(static_cast(blocks_[iRowName]), static_cast(blocks_[i]),true)) numberErrors++; } } } if (iColumnBlock==blockType_[i].columnBlock) { if (numberColumns!=blocks_[i]->numberColumns()) numberErrors+=1000; if (blockType_[i].bounds) { if (iBounds<0) { iBounds=i; } else { // check const double * a = static_cast(blocks_[iBounds])->columnLowerArray(); const double * b = static_cast(blocks_[i])->columnLowerArray(); if (!sameValues(a,b,numberColumns)) numberErrors++; a = static_cast(blocks_[iBounds])->columnUpperArray(); b = static_cast(blocks_[i])->columnUpperArray(); if (!sameValues(a,b,numberColumns)) numberErrors++; a = static_cast(blocks_[iBounds])->objectiveArray(); b = static_cast(blocks_[i])->objectiveArray(); if (!sameValues(a,b,numberColumns)) numberErrors++; } } if (blockType_[i].columnName) { if (iColumnName<0) { iColumnName=i; } else { // check if (!sameValues(static_cast(blocks_[iColumnName]), static_cast(blocks_[i]),false)) numberErrors++; } } if (blockType_[i].integer) { if (iInteger<0) { iInteger=i; } else { // check const int * a = static_cast(blocks_[iInteger])->integerTypeArray(); const int * b = static_cast(blocks_[i])->integerTypeArray(); if (!sameValues(a,b,numberColumns)) numberErrors++; } } } } return numberErrors; } /* Fill in info structure and update counts */ void CoinStructuredModel::fillInfo(CoinModelBlockInfo & info, const CoinStructuredModel * block) { int numberRows = block->numberRows(); int numberColumns = block->numberColumns(); // Which block int iRowBlock=addRowBlock(numberRows,block->rowBlockName_); info.rowBlock=iRowBlock; int iColumnBlock=addColumnBlock(numberColumns,block->columnBlockName_); info.columnBlock=iColumnBlock; } /* add a block from a CoinModel without names*/ int CoinStructuredModel::addBlock(const std::string & rowBlock, const std::string & columnBlock, const CoinBaseModel & block) { CoinBaseModel * block2 = block.clone(); return addBlock(rowBlock,columnBlock,block2); } /* add a block using names */ int CoinStructuredModel::addBlock(const std::string & rowBlock, const std::string & columnBlock, const CoinPackedMatrix & matrix, const double * rowLower, const double * rowUpper, const double * columnLower, const double * columnUpper, const double * objective) { CoinModel * block = new CoinModel(); block->loadBlock(matrix,columnLower,columnUpper,objective, rowLower,rowUpper); return addBlock(rowBlock,columnBlock,block); } /* add a block from a CoinModel without names*/ int CoinStructuredModel::addBlock(const std::string & rowBlock, const std::string & columnBlock, CoinBaseModel * block) { if (numberElementBlocks_==maximumElementBlocks_) { maximumElementBlocks_ = 3*(maximumElementBlocks_+10)/2; CoinBaseModel ** temp = new CoinBaseModel * [maximumElementBlocks_]; memcpy(temp,blocks_,numberElementBlocks_*sizeof(CoinBaseModel *)); delete [] blocks_; blocks_ = temp; CoinModelBlockInfo * temp2 = new CoinModelBlockInfo [maximumElementBlocks_]; memcpy(temp2,blockType_,numberElementBlocks_*sizeof(CoinModelBlockInfo)); delete [] blockType_; blockType_ = temp2; if (coinModelBlocks_) { CoinModel ** temp = new CoinModel * [maximumElementBlocks_]; CoinZeroN(temp,maximumElementBlocks_); memcpy(temp,coinModelBlocks_,numberElementBlocks_*sizeof(CoinModel *)); delete [] coinModelBlocks_; coinModelBlocks_ = temp; } } blocks_[numberElementBlocks_++]=block; block->setRowBlock(rowBlock); block->setColumnBlock(columnBlock); int numberErrors=0; CoinModel * coinBlock = dynamic_cast(block); if (coinBlock) { // Convert matrix if (coinBlock->type()!=3) coinBlock->convertMatrix(); numberErrors=fillInfo(blockType_[numberElementBlocks_-1],coinBlock); } else { CoinStructuredModel * subModel = dynamic_cast(block); assert (subModel); CoinModel * blockX = subModel->coinModelBlock(blockType_[numberElementBlocks_-1]); fillInfo(blockType_[numberElementBlocks_-1],subModel); setCoinModel(blockX,numberElementBlocks_-1); } return numberErrors; } /* add a block from a CoinModel with names*/ int CoinStructuredModel::addBlock(const CoinBaseModel & block) { //inline const std::string & getRowBlock() const //abort(); return addBlock(block.getRowBlock(),block.getColumnBlock(), block); } /* Decompose a model specified as arrays + CoinPackedMatrix 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure */ int CoinStructuredModel::decompose(const CoinPackedMatrix & matrix, const double * rowLower, const double * rowUpper, const double * columnLower, const double * columnUpper, const double * objective, int type,int maxBlocks, int * starts,double objectiveOffset) { setObjectiveOffset(objectiveOffset); int numberBlocks=0; char generalPrint[200]; bool wantDecomposition=type>2; type %= 10; if (type==1) { // Try master at top and bottom bool goodDW=true; // get row copy CoinPackedMatrix rowCopy = matrix; rowCopy.reverseOrdering(); const int * row = matrix.getIndices(); const int * columnLength = matrix.getVectorLengths(); const CoinBigIndex * columnStart = matrix.getVectorStarts(); //const double * elementByColumn = matrix.getElements(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); //const double * elementByRow = rowCopy.getElements(); int numberRows = matrix.getNumRows(); int * rowBlock = new int[numberRows+1]; int iRow; // Row counts (maybe look at long rows for master) CoinZeroN(rowBlock,numberRows+1); for (iRow=0;iRowmessage(COIN_GENERAL_INFO2,messages_)<< generalPrint << CoinMessageEol; } } } bool newWay=true; // to say if column looked at int numberColumns = matrix.getNumCols(); int * columnBlock = new int[numberColumns]; int iColumn; int * whichRow = new int [numberRows]; int * whichColumn = new int [numberColumns]; int * stack = new int [numberRows]; if (newWay && !starts) { //double best2[3]={COIN_DBL_MAX,COIN_DBL_MAX,COIN_DBL_MAX}; double best2[3]={0.0,0.0,0.0}; int row2[3]={-1,-1,-1}; // try forward and backward and sorted for (int iWay=0;iWay<3;iWay++) { if (iWay==0) { // forwards for (int i=0;i=0) { // already marked if (iBlock<0) { iBlock = columnBlock[iColumn]; } else if (iBlock != columnBlock[iColumn]) { // join two blocks int jBlock = columnBlock[iColumn]; numberGoodBlocks--; // Increase count of iBlock rowBlock[iBlock] += rowBlock[jBlock]; rowBlock[jBlock]=0; // First column of block jBlock int jColumn = whichRow[jBlock]; while (jColumn>=0) { columnBlock[jColumn]=iBlock; iColumn = jColumn; jColumn = whichColumn[jColumn]; } whichColumn[iColumn] = whichRow[iBlock]; whichRow[iBlock] = whichRow[jBlock]; whichRow[jBlock]=-1; } } } int n=end-start; // If not in block - then start one if (iBlock<0) { // unless null row if (n) { iBlock = numberBlocks; numberBlocks++; numberGoodBlocks++; int jColumn = column[start]; columnBlock[jColumn]=iBlock; whichRow[iBlock]=jColumn; numberMarkedColumns += n; rowBlock[iBlock] = n; for (CoinBigIndex j=start+1;j=0) { nn++; assert (iBlock=0) { n++; jColumn = whichColumn[jColumn]; } assert (n==temp[i]); } delete [] temp; } #endif rowsDone++; if (iBlock>=0) maximumInBlock = CoinMax(maximumInBlock,rowBlock[iBlock]); if (rowsDone>=checkAfterRows) { assert (numberGoodBlocks>0); double averageSize = static_cast(numberMarkedColumns)/ static_cast(numberGoodBlocks); #ifndef OSL_WAY double notionalBlocks = static_cast(numberMarkedColumns)/ averageSize; if (maximumInBlock<3*averageSize&&numberGoodBlocks>2) { if(best*(numberRows-rowsDone) < notionalBlocks) { best = notionalBlocks/ static_cast (numberRows-rowsDone); bestRow = kRow; } } #else if (maximumInBlock*101) { double test = maximumInBlock + 0.0*averageSize; if(best*static_cast(rowsDone) > test) { best = test/static_cast (rowsDone); bestRow = kRow; bestRowsDone=rowsDone; } } #endif } } #ifndef OSL_WAY best2[iWay]=best; #else if (bestRowsDonebest2[1]) { // Bottom rows in master iRow1=row2[0]+1; iRow2=numberRows; } else { // Top rows in master iRow1=0; iRow2=numberRows-row2[1]; } nMaster = iRow2-iRow1; CoinFillN(rowBlock+iRow1,nMaster,-1); } else { // sorted // Bottom rows in master (in order) int iRow1=row2[2]+1; nMaster = numberRows-iRow1; for (int i=iRow1;inumberRows) { goodDW=false; sprintf(generalPrint,"%d rows out of %d would be in master - no good", nMaster,numberRows); handler_->message(COIN_GENERAL_WARNING,messages_)<< generalPrint << CoinMessageEol; delete [] rowBlock; delete [] columnBlock; delete [] whichRow; delete [] whichColumn; delete [] stack; CoinModel model(numberRows,numberColumns,&matrix, rowLower, rowUpper, columnLower,columnUpper,objective); model.setObjectiveOffset(objectiveOffset); addBlock("row_master","column_master",model); return 0; } } else { for (iRow=0;iRowmessage(COIN_GENERAL_INFO,messages_)<< generalPrint << CoinMessageEol; if (numberBlocks) { if (numberBlocks>maxBlocks) { int iBlock; for (iRow=0;iRow=0) rowBlock[iRow] = iBlock%maxBlocks; } for (iColumn=0;iColumn=0) columnBlock[iColumn] = iBlock%maxBlocks; } numberBlocks=maxBlocks; } } // make up problems // Create all sub problems // Space for creating double * obj = new double [numberColumns]; double * columnLo = new double [numberColumns]; double * columnUp = new double [numberColumns]; double * rowLo = new double [numberRows]; double * rowUp = new double [numberRows]; // Counts int * rowCount = reinterpret_cast(rowLo); CoinZeroN(rowCount,numberBlocks); for (int i=0;i=0) rowCount[iBlock]++; } // allocate empty rows for (int i=0;i(rowUp); CoinZeroN(columnCount,numberBlocks); for (int i=0;i=0) columnCount[iBlock]++; } int maximumSize=0; for (int i=0;imessage(COIN_GENERAL_INFO2,messages_)<< generalPrint << CoinMessageEol; int k=2*rowCount[i]+columnCount[i]; maximumSize = CoinMax(maximumSize,k); } if (maximumSize*10>4*(2*numberRows+numberColumns)&&!wantDecomposition) { // No good sprintf(generalPrint,"Doesn't look good"); handler_->message(COIN_GENERAL_WARNING,messages_)<< generalPrint << CoinMessageEol; delete [] rowBlock; delete [] columnBlock; delete [] whichRow; delete [] whichColumn; delete [] obj ; delete [] columnLo ; delete [] columnUp ; delete [] rowLo ; delete [] rowUp ; CoinModel model(numberRows,numberColumns,&matrix, rowLower, rowUpper, columnLower,columnUpper,objective); model.setObjectiveOffset(objectiveOffset); addBlock("row_master","column_master",model); return 0; } // Name for master so at top addRowBlock(numberMasterRows,"row_master"); // Arrays // get full matrix CoinPackedMatrix fullMatrix = matrix; int numberRow2,numberColumn2; int iBlock; for (iBlock=0;iBlocksetOriginalIndices(whichRow,whichColumn); addBlock(rowName,columnName,block); // takes ownership // and top block numberRow2=0; // get top matrix for (iRow=0;iRowsetOriginalIndices(whichRow,whichColumn); addBlock("row_master",columnName,block); // takes ownership } // and master numberRow2=0; numberColumn2=0; for (iRow=0;iRowsetOriginalIndices(whichRow,whichColumn); addBlock("row_master","column_master",block); // takes ownership delete [] whichRow; delete [] whichColumn; delete [] obj ; delete [] columnLo ; delete [] columnUp ; delete [] rowLo ; delete [] rowUp ; } else if (type==2) { // Try master at beginning and end bool goodBenders=true; // get row copy CoinPackedMatrix rowCopy = matrix; rowCopy.reverseOrdering(); const int * row = matrix.getIndices(); const int * columnLength = matrix.getVectorLengths(); const CoinBigIndex * columnStart = matrix.getVectorStarts(); //const double * elementByColumn = matrix.getElements(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); //const double * elementByRow = rowCopy.getElements(); int numberColumns = matrix.getNumCols(); int * columnBlock = new int[numberColumns+1]; int iColumn; // Column counts (maybe look at long columns for master) CoinZeroN(columnBlock,numberColumns+1); for (iColumn=0;iColumnmessage(COIN_GENERAL_INFO2,messages_)<< generalPrint << CoinMessageEol; } } } bool newWay=true; if (maxBlocks>1000000) { newWay=false; maxBlocks -= 1000000; } // to say if row looked at int numberRows = matrix.getNumRows(); int * rowBlock = new int[numberRows]; int iRow; int * whichRow = new int [numberRows]; int * whichColumn = new int [numberColumns]; int * stack = new int [numberColumns]; if (newWay) { //double best2[3]={COIN_DBL_MAX,COIN_DBL_MAX,COIN_DBL_MAX}; double best2[3]={0.0,0.0,0.0}; int column2[3]={-1,-1,-1}; // try forward and backward and sorted for (int iWay=0;iWay<3;iWay++) { if (iWay==0) { // forwards for (int i=0;i=0) { // already marked if (iBlock<0) { iBlock = rowBlock[iRow]; } else if (iBlock != rowBlock[iRow]) { // join two blocks int jBlock = rowBlock[iRow]; numberGoodBlocks--; // Increase count of iBlock columnBlock[iBlock] += columnBlock[jBlock]; columnBlock[jBlock]=0; // First row of block jBlock int jRow = whichColumn[jBlock]; while (jRow>=0) { rowBlock[jRow]=iBlock; iRow = jRow; jRow = whichRow[jRow]; } whichRow[iRow] = whichColumn[iBlock]; whichColumn[iBlock] = whichColumn[jBlock]; whichColumn[jBlock]=-1; } } } int n=end-start; // If not in block - then start one if (iBlock<0) { // unless null column if (n) { iBlock = numberBlocks; numberBlocks++; numberGoodBlocks++; int jRow = row[start]; rowBlock[jRow]=iBlock; whichColumn[iBlock]=jRow; numberMarkedRows += n; columnBlock[iBlock] = n; for (CoinBigIndex j=start+1;j=0) maximumInBlock = CoinMax(maximumInBlock,columnBlock[iBlock]); if (columnsDone>=checkAfterColumns) { assert (numberGoodBlocks>0); double averageSize = static_cast(numberMarkedRows)/ static_cast(numberGoodBlocks); #ifndef OSL_WAY double notionalBlocks = static_cast(numberMarkedRows)/ averageSize; if (maximumInBlock<3*averageSize&&numberGoodBlocks>2) { if(best*(numberColumns-columnsDone) < notionalBlocks) { best = notionalBlocks/ static_cast (numberColumns-columnsDone); bestColumn = kColumn; } } #else if (maximumInBlock*101) { double test = maximumInBlock + 0.0*averageSize; if(best*static_cast(columnsDone) > test) { best = test/static_cast (columnsDone); bestColumn = kColumn; bestColumnsDone=columnsDone; } } #endif } } #ifndef OSL_WAY best2[iWay]=best; #else if (bestColumnsDonebest2[1]) { // End columns in master iColumn1=column2[0]+1; iColumn2=numberColumns; } else { // Beginning columns in master iColumn1=0; iColumn2=numberColumns-column2[1]; } nMaster = iColumn2-iColumn1; CoinFillN(columnBlock+iColumn1,nMaster,-1); } else { // sorted // End columns in master (in order) int iColumn1=column2[2]+1; nMaster = numberColumns-iColumn1; for (int i=iColumn1;inumberColumns) { goodBenders=false; sprintf(generalPrint,"%d columns out of %d would be in master - no good", nMaster,numberColumns); handler_->message(COIN_GENERAL_WARNING,messages_)<< generalPrint << CoinMessageEol; delete [] rowBlock; delete [] columnBlock; delete [] whichRow; delete [] whichColumn; delete [] stack; CoinModel model(numberRows,numberColumns,&matrix, rowLower, rowUpper, columnLower,columnUpper,objective); model.setObjectiveOffset(objectiveOffset); addBlock("row_master","column_master",model); return 0; } } else { for (iColumn=0;iColumnmessage(COIN_GENERAL_INFO,messages_)<< generalPrint << CoinMessageEol; if (numberBlocks) { if (numberBlocks>maxBlocks) { int iBlock; for (iColumn=0;iColumn=0) columnBlock[iColumn] = iBlock%maxBlocks; } for (iRow=0;iRow=0) rowBlock[iRow] = iBlock%maxBlocks; } numberBlocks=maxBlocks; } } // make up problems // Create all sub problems // Space for creating double * obj = new double [numberColumns]; double * rowLo = new double [numberRows]; double * rowUp = new double [numberRows]; double * columnLo = new double [numberColumns]; double * columnUp = new double [numberColumns]; // Counts int * columnCount = reinterpret_cast(columnLo); CoinZeroN(columnCount,numberBlocks); for (int i=0;i=0) columnCount[iBlock]++; } // allocate empty columns for (int i=0;i(columnUp); CoinZeroN(rowCount,numberBlocks); for (int i=0;i=0) rowCount[iBlock]++; } int maximumSize=0; for (int i=0;imessage(COIN_GENERAL_INFO2,messages_)<< generalPrint << CoinMessageEol; int k=2*columnCount[i]+rowCount[i]; maximumSize = CoinMax(maximumSize,k); } if ((maximumSize*10>4*(2*numberColumns+numberRows)|| numberMasterRows*10>numberRows)&&!wantDecomposition) { // No good sprintf(generalPrint,"Doesn't look good"); handler_->message(COIN_GENERAL_WARNING,messages_)<< generalPrint << CoinMessageEol; delete [] rowBlock; delete [] columnBlock; delete [] whichRow; delete [] whichColumn; delete [] obj ; delete [] columnLo ; delete [] columnUp ; delete [] rowLo ; delete [] rowUp ; #if 0 CoinModel model(numberRows,numberColumns,&matrix, rowLower, rowUpper, columnLower,columnUpper,objective); model.setObjectiveOffset(objectiveOffset); addBlock("row_master","column_master",model); #endif return 0; } // Name for master so at beginning addColumnBlock(numberMasterColumns,"column_master"); // Arrays // get full matrix CoinPackedMatrix fullMatrix = matrix; int numberRow2,numberColumn2; int iBlock; for (iBlock=0;iBlocksetOriginalIndices(whichRow,whichColumn); addBlock(rowName,columnName,block); // takes ownership // and beginning block numberColumn2=0; // get beginning matrix for (iColumn=0;iColumnsetOriginalIndices(whichRow,whichColumn); addBlock(rowName,"column_master",block); // takes ownership } // and master numberRow2=0; numberColumn2=0; for (iColumn=0;iColumnsetOriginalIndices(whichRow,whichColumn); addBlock("row_master","column_master",block); // takes ownership delete [] whichRow; delete [] whichColumn; delete [] obj ; delete [] columnLo ; delete [] columnUp ; delete [] rowLo ; delete [] rowUp ; } else { abort(); } return numberBlocks; } /* Decompose a CoinModel 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure */ int CoinStructuredModel::decompose(const CoinModel & coinModel, int type, int maxBlocks, const char ** starts) { const CoinPackedMatrix * matrix = coinModel.packedMatrix(); assert (matrix!=NULL); // Arrays const double * objective = coinModel.objectiveArray(); const double * columnLower = coinModel.columnLowerArray(); const double * columnUpper = coinModel.columnUpperArray(); const double * rowLower = coinModel.rowLowerArray(); const double * rowUpper = coinModel.rowUpperArray(); int * blockStarts=NULL; char generalPrint[200]; bool wantDecomposition=maxBlocks>1; // flag to say we really want it decomposed int numberTotal = coinModel.numberColumns()+coinModel.numberRows(); if (maxBlocks<2||2*maxBlocks>numberTotal) { // allow at least 400 per problem maxBlocks = (numberTotal+399)/400; // but gate at 8 and 1000 maxBlocks=CoinMax(8,CoinMin(maxBlocks,1000)); sprintf(generalPrint,"Trying for %d blocks",maxBlocks); handler_->message(COIN_GENERAL_INFO,messages_)<< generalPrint << CoinMessageEol; } if (starts) { assert (type<3); // maxBlocks is number of blocks // first two are master - then starts // master at beginning or end blockStarts = new int[maxBlocks+3]; if (type==2) { // column names int numberColumns = coinModel.numberColumns(); // Do master block int iColumn; for (iColumn=0;iColumnmessage(COIN_GENERAL_WARNING,messages_)<< generalPrint << CoinMessageEol; delete [] blockStarts; return 0; } if (iColumn==0) { blockStarts[0]=0; blockStarts[1]=-1; } else { blockStarts[0]=iColumn; blockStarts[1]=numberColumns; } int nBlocks=2; for (int iBlock=1;iBlockmessage(COIN_GENERAL_WARNING,messages_)<< generalPrint << CoinMessageEol; delete [] blockStarts; return 0; } if (nBlocks==2&&blockStarts[1]==-1) blockStarts[1]=iColumn-1; blockStarts[nBlocks++]=iColumn; } if (blockStarts[1]==numberColumns) blockStarts[nBlocks++]=blockStarts[0]; else blockStarts[nBlocks++]=numberColumns; } else { // row names int numberRows = coinModel.numberRows(); // Do master block int iRow; for (iRow=0;iRowmessage(COIN_GENERAL_WARNING,messages_)<< generalPrint << CoinMessageEol; delete [] blockStarts; return 0; } if (iRow==0) { blockStarts[0]=0; blockStarts[1]=-1; } else { blockStarts[0]=iRow; blockStarts[1]=numberRows; } int nBlocks=2; for (int iBlock=1;iBlockmessage(COIN_GENERAL_WARNING,messages_)<< generalPrint << CoinMessageEol; delete [] blockStarts; return 0; } if (nBlocks==2&&blockStarts[1]==-1) blockStarts[1]=iRow-1; blockStarts[nBlocks++]=iRow; } if (blockStarts[1]==numberRows) blockStarts[nBlocks++]=blockStarts[0]; else blockStarts[nBlocks++]=numberRows; } } if(wantDecomposition) type +=10; int nBlocks = decompose(*matrix, rowLower, rowUpper, columnLower, columnUpper, objective, type,maxBlocks,blockStarts, coinModel.objectiveOffset()); delete [] blockStarts; return nBlocks; } // Read SMPS model int CoinStructuredModel::readSmps(const char *filename, bool keepNames, bool ignoreErrors) { abort(); return 0; } // Return block corresponding to row and column const CoinBaseModel * CoinStructuredModel::block(int row,int column) const { const CoinBaseModel * block = NULL; if (blockType_) { for (int iBlock=0;iBlock(blocks_[iBlock]); assert (block); break; } } } return block; } /* Fill pointers corresponding to row and column. False if any missing */ CoinModelBlockInfo CoinStructuredModel::block(int row,int column, const double * & rowLower, const double * & rowUpper, const double * & columnLower, const double * & columnUpper, const double * & objective) const { CoinModelBlockInfo info; //memset(&info,0,sizeof(info)); rowLower=NULL; rowUpper=NULL; columnLower=NULL; columnUpper=NULL; objective=NULL; if (blockType_) { for (int iBlock=0;iBlockrowLowerArray(); rowUpper = thisBlock->rowUpperArray(); } } if (blockType_[iBlock].columnBlock==column) { if (blockType_[iBlock].bounds) { info.bounds=1; columnLower = thisBlock->columnLowerArray(); columnUpper = thisBlock->columnUpperArray(); objective = thisBlock->objectiveArray(); } } } } return info; } // Return block number corresponding to row and column int CoinStructuredModel::blockIndex(int row,int column) const { int block=-1; if (blockType_) { for (int iBlock=0;iBlock #include #include #include #include #include #include "CoinError.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinLpIO.hpp" #include "CoinMpsIO.hpp" #include "CoinFinite.hpp" #include "CoinSort.hpp" using namespace std; //#define LPIO_DEBUG /************************************************************************/ CoinLpIO::CoinLpIO() : problemName_(CoinStrdup("")), defaultHandler_(true), numberRows_(0), numberColumns_(0), numberElements_(0), matrixByColumn_(NULL), matrixByRow_(NULL), rowlower_(NULL), rowupper_(NULL), collower_(NULL), colupper_(NULL), rhs_(NULL), rowrange_(NULL), rowsense_(NULL), num_objectives_(0), integerType_(NULL), set_(NULL), numberSets_(0), fileName_(NULL), infinity_(COIN_DBL_MAX), epsilon_(1e-5), numberAcross_(10), decimals_(5) { for (int j = 0; j < MAX_OBJECTIVES; j++){ objective_[j] = NULL; objName_[j] = NULL; objectiveOffset_[j] = 0; } card_previous_names_[0] = 0; card_previous_names_[1] = 0; previous_names_[0] = NULL; previous_names_[1] = NULL; maxHash_[0]=0; numberHash_[0]=0; hash_[0] = NULL; names_[0] = NULL; maxHash_[1] = 0; numberHash_[1] = 0; hash_[1] = NULL; names_[1] = NULL; handler_ = new CoinMessageHandler(); messages_ = CoinMessage(); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinLpIO::CoinLpIO(const CoinLpIO& rhs) : problemName_(CoinStrdup("")), defaultHandler_(true), numberRows_(0), numberColumns_(0), numberElements_(0), matrixByColumn_(NULL), matrixByRow_(NULL), rowlower_(NULL), rowupper_(NULL), collower_(NULL), colupper_(NULL), rhs_(NULL), rowrange_(NULL), rowsense_(NULL), integerType_(NULL), set_(NULL), numberSets_(0), fileName_(CoinStrdup("")), infinity_(COIN_DBL_MAX), epsilon_(1e-5), numberAcross_(10) { num_objectives_ = rhs.num_objectives_; for (int j = 0; j < MAX_OBJECTIVES; j++){ objective_[j] = NULL; if (j < num_objectives_){ objName_[j] = CoinStrdup(rhs.objName_[j]); }else{ objName_[j] = NULL; } objectiveOffset_[j] = 0; } card_previous_names_[0] = 0; card_previous_names_[1] = 0; previous_names_[0] = NULL; previous_names_[1] = NULL; maxHash_[0] = 0; numberHash_[0] = 0; hash_[0] = NULL; names_[0] = NULL; maxHash_[1] = 0; numberHash_[1] = 0; hash_[1] = NULL; names_[1] = NULL; if ( rhs.rowlower_ != NULL || rhs.collower_ != NULL) { gutsOfCopy(rhs); } defaultHandler_ = rhs.defaultHandler_; if (defaultHandler_) { handler_ = new CoinMessageHandler(*rhs.handler_); } else { handler_ = rhs.handler_; } messages_ = CoinMessage(); } void CoinLpIO::gutsOfCopy(const CoinLpIO& rhs) { defaultHandler_ = rhs.defaultHandler_; if (rhs.matrixByRow_) { matrixByRow_ = new CoinPackedMatrix(*(rhs.matrixByRow_)); } numberElements_ = rhs.numberElements_; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; decimals_ = rhs.decimals_; if (rhs.rowlower_) { rowlower_ = reinterpret_cast (malloc(numberRows_ * sizeof(double))); rowupper_ = reinterpret_cast (malloc(numberRows_ * sizeof(double))); memcpy(rowlower_, rhs.rowlower_, numberRows_ * sizeof(double)); memcpy(rowupper_, rhs.rowupper_, numberRows_ * sizeof(double)); rowrange_ = reinterpret_cast (malloc(numberRows_*sizeof(double))); rowsense_ = reinterpret_cast (malloc(numberRows_*sizeof(char))); rhs_ = reinterpret_cast (malloc(numberRows_*sizeof(double))); memcpy(rowrange_,rhs.getRowRange(),numberRows_*sizeof(double)); memcpy(rowsense_,rhs.getRowSense(),numberRows_*sizeof(char)); memcpy(rhs_,rhs.getRightHandSide(),numberRows_*sizeof(double)); } if (rhs.collower_) { collower_ = reinterpret_cast (malloc(numberColumns_ * sizeof(double))); colupper_ = reinterpret_cast (malloc(numberColumns_ * sizeof(double))); memcpy(collower_, rhs.collower_, numberColumns_ * sizeof(double)); memcpy(colupper_, rhs.colupper_, numberColumns_ * sizeof(double)); for (int j = 0; j < num_objectives_; j++){ objective_[j] = reinterpret_cast (malloc(numberColumns_ * sizeof(double))); memcpy(objective_[j], rhs.objective_[j], numberColumns_ * sizeof(double)); } } if (rhs.integerType_) { integerType_ = reinterpret_cast (malloc (numberColumns_ * sizeof(char))); memcpy(integerType_, rhs.integerType_, numberColumns_ * sizeof(char)); } numberSets_=rhs.numberSets_; if (numberSets_) { set_ = new CoinSet * [numberSets_]; for (int j=0;j (malloc(maxHash_[section] * sizeof(char*))); char** names = names_[section]; int i; for (i = 0; i < numberHash_[section]; i++) { names[i] = CoinStrdup(names2[i]); } hash_[section] = new CoinHashLink[maxHash_[section]]; std::memcpy(hash_[section], rhs.hash_[section], maxHash_[section]*sizeof(CoinHashLink)); } } } CoinLpIO & CoinLpIO::operator=(const CoinLpIO& rhs) { if (this != &rhs) { gutsOfDestructor(); if ( rhs.rowlower_ != NULL || rhs.collower_ != NULL) { gutsOfCopy(rhs); } defaultHandler_ = rhs.defaultHandler_; if (defaultHandler_) { handler_ = new CoinMessageHandler(*rhs.handler_); } else { handler_ = rhs.handler_; } messages_ = CoinMessage(); } return *this; } void CoinLpIO::gutsOfDestructor() { freeAll(); if (defaultHandler_) { delete handler_; handler_ = NULL; } } /************************************************************************/ CoinLpIO::~CoinLpIO() { stopHash(0); stopHash(1); freeAll(); if (defaultHandler_) { delete handler_; handler_ = NULL; } } /************************************************************************/ void CoinLpIO::freePreviousNames(const int section) { int j; if(previous_names_[section] != NULL) { for(j=0; j -infinity_) { if (upper < infinity_) { right = upper; if (upper==lower) { sense = 'E'; } else { sense = 'R'; range = upper - lower; } } else { sense = 'G'; right = lower; } } else { if (upper < infinity_) { sense = 'L'; right = upper; } else { sense = 'N'; right = 0.0; } } } /*************************************************************************/ const char * CoinLpIO::getRowSense() const { if(rowsense_ == NULL) { int nr=numberRows_; rowsense_ = reinterpret_cast (malloc(nr*sizeof(char))); double dum1,dum2; int i; for(i=0; i (malloc(nr*sizeof(double))); char dum1; double dum2; int i; for (i=0; i (malloc(nr*sizeof(double))); std::fill(rowrange_,rowrange_+nr,0.0); char dum1; double dum2; int i; for (i=0; ireverseOrdering(); } return matrixByColumn_; } /*************************************************************************/ const char * CoinLpIO::getObjName() const { return objName_[0]; } /*************************************************************************/ const char * CoinLpIO::getObjName(int j) const { return objName_[j]; } /*************************************************************************/ void CoinLpIO::checkRowNames() { int i, nrow = getNumRows(); if(numberHash_[0] != nrow+1) { setDefaultRowNames(); handler_->message(COIN_GENERAL_WARNING,messages_)<< "### CoinLpIO::checkRowNames(): non distinct or missing row names or objective function name.\nNow using default row names." <message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)<< "### CoinLpIO::checkColNames(): non distinct or missing column names.\nNow using default column names." <= 0) && (index < numberRows_+1)) { return names_[0][index]; } else { return NULL; } } /*************************************************************************/ const char * CoinLpIO::columnName(int index) const { if((names_[1] != NULL) && (index >= 0) && (index < numberColumns_)) { return names_[1][index]; } else { return NULL; } } /*************************************************************************/ int CoinLpIO::rowIndex(const char * name) const { if (!hash_[0]) { return -1; } return findHash(name , 0); } /*************************************************************************/ int CoinLpIO::columnIndex(const char * name) const { if (!hash_[1]) { return -1; } return findHash(name , 1); } /************************************************************************/ double CoinLpIO::getInfinity() const { return infinity_; } /************************************************************************/ void CoinLpIO::setInfinity(const double value) { if (value >= 1.0e20) { infinity_ = value; } else { char str[8192]; sprintf(str,"### ERROR: value: %f\n", value); throw CoinError(str, "setInfinity", "CoinLpIO", __FILE__, __LINE__); } } /************************************************************************/ double CoinLpIO::getEpsilon() const { return epsilon_; } /************************************************************************/ void CoinLpIO::setEpsilon(const double value) { if (value < 0.1) { epsilon_ = value; } else { char str[8192]; sprintf(str,"### ERROR: value: %f\n", value); throw CoinError(str, "setEpsilon", "CoinLpIO", __FILE__, __LINE__); } } /************************************************************************/ int CoinLpIO::getNumberAcross() const { return numberAcross_; } /************************************************************************/ void CoinLpIO::setNumberAcross(const int value) { if (value > 0) { numberAcross_ = value; } else { char str[8192]; sprintf(str,"### ERROR: value: %d\n", value); throw CoinError(str, "setNumberAcross", "CoinLpIO", __FILE__, __LINE__); } } /************************************************************************/ int CoinLpIO::getDecimals() const { return decimals_; } /************************************************************************/ void CoinLpIO::setDecimals(const int value) { if (value > 0) { decimals_ = value; } else { char str[8192]; sprintf(str,"### ERROR: value: %d\n", value); throw CoinError(str, "setDecimals", "CoinLpIO", __FILE__, __LINE__); } } /************************************************************************/ double CoinLpIO::objectiveOffset() const { return objectiveOffset_[0]; } /************************************************************************/ double CoinLpIO::objectiveOffset(int j) const { return objectiveOffset_[j]; } /************************************************************************/ bool CoinLpIO::isInteger(int columnNumber) const { const char * intType = integerType_; if (intType == NULL) return false; assert (columnNumber >= 0 && columnNumber < numberColumns_); if (intType[columnNumber] != 0) return true; return false; } /************************************************************************/ const char * CoinLpIO::integerColumns() const { return integerType_; } /************************************************************************/ void CoinLpIO::setLpDataWithoutRowAndColNames( const CoinPackedMatrix& m, const double *collb, const double *colub, const double *obj_coeff, const char *is_integer, const double *rowlb, const double *rowub) { setLpDataWithoutRowAndColNames(m, collb, colub, &obj_coeff, 1, is_integer, rowlb, rowub); } /************************************************************************/ void CoinLpIO::setLpDataWithoutRowAndColNames( const CoinPackedMatrix& m, const double *collb, const double *colub, const double *obj_coeff[MAX_OBJECTIVES], int num_objectives, const char *is_integer, const double *rowlb, const double *rowub) { freeAll(); problemName_ = CoinStrdup(""); if (m.isColOrdered()) { matrixByRow_ = new CoinPackedMatrix(); matrixByRow_->reverseOrderedCopyOf(m); } else { matrixByRow_ = new CoinPackedMatrix(m); } numberColumns_ = matrixByRow_->getNumCols(); numberRows_ = matrixByRow_->getNumRows(); rowlower_ = reinterpret_cast (malloc (numberRows_ * sizeof(double))); rowupper_ = reinterpret_cast (malloc (numberRows_ * sizeof(double))); collower_ = reinterpret_cast (malloc (numberColumns_ * sizeof(double))); colupper_ = reinterpret_cast (malloc (numberColumns_ * sizeof(double))); std::copy(rowlb, rowlb + numberRows_, rowlower_); std::copy(rowub, rowub + numberRows_, rowupper_); std::copy(collb, collb + numberColumns_, collower_); std::copy(colub, colub + numberColumns_, colupper_); num_objectives_ = num_objectives; for (int j = 0; j < num_objectives; j++){ objective_[j] = reinterpret_cast (malloc (numberColumns_ * sizeof(double))); std::copy(obj_coeff[j], obj_coeff[j] + numberColumns_, objective_[j]); } if (is_integer) { integerType_ = reinterpret_cast (malloc (numberColumns_ * sizeof(char))); std::copy(is_integer, is_integer + numberColumns_, integerType_); } else { integerType_ = 0; } if((numberHash_[0] > 0) && (numberHash_[0] != numberRows_+1)) { stopHash(0); } if((numberHash_[1] > 0) && (numberHash_[1] != numberColumns_)) { stopHash(1); } } /* SetLpDataWithoutRowAndColNames */ /*************************************************************************/ void CoinLpIO::setDefaultRowNames() { int i, nrow = getNumRows(); char **defaultRowNames = reinterpret_cast (malloc ((nrow+1) * sizeof(char *))); char buff[1024]; for(i=0; i (malloc (ncol * sizeof(char *))); char buff[256]; for(j=0; jmessage(COIN_GENERAL_WARNING,messages_)<< "### CoinLpIO::setLpDataRowAndColNames(): Invalid row names\nUse getPreviousNames() to get the old row names.\nNow using default row names." <message(COIN_GENERAL_WARNING,messages_)<< "### CoinLpIO::setLpDataRowAndColNames(): Invalid column names\nNow using default row names." < 1 - lp_eps) { fprintf(fp, " %.0f", floor(v+0.5)); } else { int decimals = getDecimals(); char form[15]; sprintf(form, " %%.%df", decimals); fprintf(fp, form, v); } } } /* out_coeff */ /************************************************************************/ int CoinLpIO::writeLp(const char *filename, const double epsilon, const int numberAcross, const int decimals, const bool useRowNames) { FILE *fp = NULL; fp = fopen(filename,"w"); if (!fp) { char str[8192]; sprintf(str,"### ERROR: unable to open file %s\n", filename); throw CoinError(str, "writeLP", "CoinLpIO", __FILE__, __LINE__); } int nerr = writeLp(fp, epsilon, numberAcross, decimals, useRowNames); fclose(fp); return(nerr); } /************************************************************************/ int CoinLpIO::writeLp(FILE *fp, const double epsilon, const int numberAcross, const int decimals, const bool useRowNames) { setEpsilon(epsilon); setNumberAcross(numberAcross); setDecimals(decimals); return writeLp(fp, useRowNames); } /************************************************************************/ int CoinLpIO::writeLp(const char *filename, const bool useRowNames) { FILE *fp = NULL; fp = fopen(filename,"w"); if (!fp) { char str[8192]; sprintf(str,"### ERROR: unable to open file %s\n", filename); throw CoinError(str, "writeLP", "CoinLpIO", __FILE__, __LINE__); } int nerr = writeLp(fp, useRowNames); fclose(fp); return(nerr); } /************************************************************************/ int CoinLpIO::writeLp(FILE *fp, const bool useRowNames) { double lp_eps = getEpsilon(); double lp_inf = getInfinity(); int numberAcross = getNumberAcross(); int i, j, cnt_print, loc_row_names = 0, loc_col_names = 0; char **prowNames = NULL, **pcolNames = NULL; const int *indices = matrixByRow_->getIndices(); const double *elements = matrixByRow_->getElements(); int ncol = getNumCols(); int nrow = getNumRows(); const double *collow = getColLower(); const double *colup = getColUpper(); const double *rowlow = getRowLower(); const double *rowup = getRowUpper(); const char *integerType = integerColumns(); char const * const * rowNames = getRowNames(); char const * const * colNames = getColNames(); char buff[256]; if(rowNames == NULL) { loc_row_names = 1; prowNames = reinterpret_cast (malloc ((nrow+1) * sizeof(char *))); for (j=0; j (malloc (ncol * sizeof(char *))); for (j=0; j 0) && (objective_[k][j] > lp_eps)) { fprintf(fp, " +"); } if(fabs(objective_[k][j]) > lp_eps) { out_coeff(fp, objective_[k][j], 0); fprintf(fp, " %s", colNames[j]); cnt_print++; if(cnt_print % numberAcross == 0) { fprintf(fp, "\n"); } } } if((cnt_print > 0) && (objectiveOffset_[k] > lp_eps)) { fprintf(fp, " +"); } if(fabs(objectiveOffset_[k]) > lp_eps) { out_coeff(fp, objectiveOffset_[k], 1); cnt_print++; } if((cnt_print == 0) || (cnt_print % numberAcross != 0)) { fprintf(fp, "\n"); } } fprintf(fp, "Subject To\n"); int cnt_out_rows = 0; for(i=0; igetVectorFirst(i); jgetVectorLast(i); j++) { if((cnt_print > 0) && (elements[j] > lp_eps)) { fprintf(fp, " +"); } if(fabs(elements[j]) > lp_eps) { out_coeff(fp, elements[j], 0); fprintf(fp, " %s", colNames[indices[j]]); cnt_print++; if(cnt_print % numberAcross == 0) { fprintf(fp, "\n"); } } } if(rowup[i] - rowlow[i] < lp_eps) { fprintf(fp, " ="); out_coeff(fp, rowlow[i], 1); fprintf(fp, "\n"); } else { if(rowup[i] < lp_inf) { fprintf(fp, " <="); out_coeff(fp, rowup[i], 1); fprintf(fp, "\n"); if(rowlower_[i] > -lp_inf) { cnt_print = 0; if(useRowNames) { fprintf(fp, "%s_low:", rowNames[i]); } cnt_out_rows++; for(j=matrixByRow_->getVectorFirst(i); jgetVectorLast(i); j++) { if((cnt_print>0) && (elements[j] > lp_eps)) { fprintf(fp, " +"); } if(fabs(elements[j]) > lp_eps) { out_coeff(fp, elements[j], 0); fprintf(fp, " %s", colNames[indices[j]]); cnt_print++; if(cnt_print % numberAcross == 0) { fprintf(fp, "\n"); } } } fprintf(fp, " >="); out_coeff(fp, rowlow[i], 1); fprintf(fp, "\n"); } } else { fprintf(fp, " >="); out_coeff(fp, rowlow[i], 1); fprintf(fp, "\n"); } } } #ifdef LPIO_DEBUG printf("CoinLpIO::writeLp(): Done with constraints\n"); #endif fprintf(fp, "Bounds\n"); for(j=0; j -lp_inf) && (colup[j] < lp_inf)) { out_coeff(fp, collow[j], 1); fprintf(fp, " <= %s <=", colNames[j]); out_coeff(fp, colup[j], 1); fprintf(fp, "\n"); } if((collow[j] == -lp_inf) && (colup[j] < lp_inf)) { fprintf(fp, "%s <=", colNames[j]); out_coeff(fp, colup[j], 1); fprintf(fp, "\n"); } if((collow[j] > -lp_inf) && (colup[j] == lp_inf)) { if(fabs(collow[j]) > lp_eps) { out_coeff(fp, collow[j], 1); fprintf(fp, " <= %s\n", colNames[j]); } } if(collow[j] == -lp_inf) { fprintf(fp, " %s Free\n", colNames[j]); } } #ifdef LPIO_DEBUG printf("CoinLpIO::writeLp(): Done with bounds\n"); #endif if(integerType != NULL) { int first_int = 1; cnt_print = 0; for(j=0; jsetType()); const int * which = set->which(); const double * weights = set->weights(); int numberEntries = set->numberEntries(); for(j=0; j 1 - lp_eps) { fprintf(fp, "%.0f", floor(v+0.5)); } else { fprintf(fp, form, v); } } cnt_print++; if(cnt_print % numberAcross == 0) { fprintf(fp, "\n"); } } if(cnt_print % numberAcross != 0) { fprintf(fp, "\n"); } } } #ifdef LPIO_DEBUG printf("CoinLpIO::writeLp(): Done with SOS\n"); #endif fprintf(fp, "End\n"); if(loc_row_names) { for(j=0; j=") == 0) { return(2); } printf("### ERROR: CoinLpIO: is_sense(): string: %s \n", buff); } return(-1); } /* is_sense */ /*************************************************************************/ int CoinLpIO::is_free(const char *buff) const { size_t lbuff = strlen(buff); if((lbuff == 4) && (CoinStrNCaseCmp(buff, "free", 4) == 0)) { return(1); } return(0); } /* is_free */ /*************************************************************************/ int CoinLpIO::is_inf(const char *buff) const { size_t lbuff = strlen(buff); if((lbuff == 3) && (CoinStrNCaseCmp(buff, "inf", 3) == 0)) { return(1); } return(0); } /* is_inf */ /*************************************************************************/ int CoinLpIO::is_comment(const char *buff) const { if((buff[0] == '/') || (buff[0] == '\\')) { return(1); } return(0); } /* is_comment */ /*************************************************************************/ void CoinLpIO::skip_comment(char *buff, FILE *fp) const { while(strcspn(buff, "\n") == strlen(buff)) { // end of line not read yet if(feof(fp)) { char str[8192]; sprintf(str,"### ERROR: end of file reached while skipping comment\n"); throw CoinError(str, "skip_comment", "CoinLpIO", __FILE__, __LINE__); } if(ferror(fp)) { char str[8192]; sprintf(str,"### ERROR: error while skipping comment\n"); throw CoinError(str, "skip_comment", "CoinLpIO", __FILE__, __LINE__); } char * x=fgets(buff, sizeof(buff), fp); if (!x) throw("bad fgets"); } } /* skip_comment */ /*************************************************************************/ void CoinLpIO::scan_next(char *buff, FILE *fp) const { int x=fscanf(fp, "%s", buff); if (x<=0) throw("bad fscanf"); while(is_comment(buff)) { skip_comment(buff, fp); x=fscanf(fp, "%s", buff); if (x<=0) throw("bad fscanf"); } #ifdef LPIO_DEBUG printf("CoinLpIO::scan_next: (%s)\n", buff); #endif } /* scan_next */ /*************************************************************************/ int CoinLpIO::is_invalid_name(const char *name, const bool ranged) const { size_t pos, lname, valid_lname = 100; char str_valid[] = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"!#$%&(),.;?@_'`{}~"; if(ranged) { valid_lname -= 4; // will add "_low" when writing the Lp file } if(name == NULL) { lname = 0; } else { lname = strlen(name); } if(lname < 1) { handler_->message(COIN_GENERAL_WARNING,messages_)<< "### CoinLpIO::is_invalid_name(): Name is empty" < valid_lname) { char printBuffer[512]; sprintf(printBuffer,"### CoinLpIO::is_invalid_name(): Name %s is too long", name); handler_->message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)< 0) { return(read_st); } start = buff; mult = 1; if(buff[0] == '+') { mult = 1; if(strlen(buff) == 1) { scan_next(buff, fp); start = buff; } else { start = &(buff[1]); } } if(buff[0] == '-') { mult = -1; if(strlen(buff) == 1) { scan_next(buff, fp); start = buff; } else { start = &(buff[1]); } } if(first_is_number(start)) { coeff[*cnt] = atof(start); sprintf(loc_name, "aa"); scan_next(loc_name, fp); } else { coeff[*cnt] = 1; strcpy(loc_name, start); } read_st = is_subject_to(loc_name); #ifdef LPIO_DEBUG printf("read_monom_obj: second buff: (%s)\n", buff); #endif if(read_st > 0) { setObjectiveOffset(mult * coeff[*cnt]); #ifdef LPIO_DEBUG printf("read_monom_obj: objectiveOffset: %f\n", objectiveOffset_); #endif return(read_st); } coeff[*cnt] *= mult; name[*cnt] = CoinStrdup(loc_name); #ifdef LPIO_DEBUG printf("read_monom_obj: (%f) (%s)\n", coeff[*cnt], name[*cnt]); #endif (*cnt)++; return(read_st); } /* read_monom_obj */ /*************************************************************************/ int CoinLpIO::read_monom_row(FILE *fp, char *start_str, double *coeff, char **name, int cnt_coeff) const { double mult; char buff[1024], loc_name[1024], *start; int read_sense = -1; sprintf(buff, "%s", start_str); read_sense = is_sense(buff); if(read_sense > -1) { return(read_sense); } start = buff; mult = 1; if(buff[0] == '+') { mult = 1; if(strlen(buff) == 1) { scan_next(buff, fp); start = buff; } else { start = &(buff[1]); } } if(buff[0] == '-') { mult = -1; if(strlen(buff) == 1) { scan_next(buff, fp); start = buff; } else { start = &(buff[1]); } } if(first_is_number(start)) { coeff[cnt_coeff] = atof(start); scan_next(loc_name, fp); } else { coeff[cnt_coeff] = 1; strcpy(loc_name, start); } coeff[cnt_coeff] *= mult; #ifdef KILL_ZERO_READLP if (fabs(coeff[cnt_coeff])>epsilon_) name[cnt_coeff] = CoinStrdup(loc_name); else read_sense=-2; // effectively zero #else name[cnt_coeff] = CoinStrdup(loc_name); #endif #ifdef LPIO_DEBUG printf("CoinLpIO: read_monom_row: (%f) (%s)\n", coeff[cnt_coeff], name[cnt_coeff]); #endif return(read_sense); } /* read_monom_row */ /*************************************************************************/ void CoinLpIO::realloc_coeff(double **coeff, char ***colNames, int *maxcoeff) const { *maxcoeff *= 5; *colNames = reinterpret_cast (realloc ((*colNames), (*maxcoeff+1) * sizeof(char *))); *coeff = reinterpret_cast (realloc ((*coeff), (*maxcoeff+1) * sizeof(double))); } /* realloc_coeff */ /*************************************************************************/ void CoinLpIO::realloc_row(char ***rowNames, int **start, double **rhs, double **rowlow, double **rowup, int *maxrow) const { *maxrow *= 5; *rowNames = reinterpret_cast (realloc ((*rowNames), (*maxrow+1) * sizeof(char *))); *start = reinterpret_cast (realloc ((*start), (*maxrow+1) * sizeof(int))); *rhs = reinterpret_cast (realloc ((*rhs), (*maxrow+1) * sizeof(double))); *rowlow = reinterpret_cast (realloc ((*rowlow), (*maxrow+1) * sizeof(double))); *rowup = reinterpret_cast (realloc ((*rowup), (*maxrow+1) * sizeof(double))); } /* realloc_row */ /*************************************************************************/ void CoinLpIO::realloc_col(double **collow, double **colup, char **is_int, int *maxcol) const { *maxcol += 100; *collow = reinterpret_cast (realloc ((*collow), (*maxcol+1) * sizeof(double))); *colup = reinterpret_cast (realloc ((*colup), (*maxcol+1) * sizeof(double))); *is_int = reinterpret_cast (realloc ((*is_int), (*maxcol+1) * sizeof(char))); // clean values double lp_inf = getInfinity(); for (int i=(*maxcol)-100; i<*maxcol; i++) { (*collow)[i] = 0; (*colup)[i] = lp_inf; (*is_int)[i] = 0; } } /* realloc_col */ /*************************************************************************/ void CoinLpIO::read_row(FILE *fp, char *buff, double **pcoeff, char ***pcolNames, int *cnt_coeff, int *maxcoeff, double *rhs, double *rowlow, double *rowup, int *cnt_row, double inf) const { int read_sense = -1; char start_str[1024]; sprintf(start_str, "%s", buff); while(read_sense < 0) { if((*cnt_coeff) == (*maxcoeff)) { realloc_coeff(pcoeff, pcolNames, maxcoeff); } read_sense = read_monom_row(fp, start_str, *pcoeff, *pcolNames, *cnt_coeff); #ifdef KILL_ZERO_READLP if (read_sense!=-2) // see if zero #endif (*cnt_coeff)++; scan_next(start_str, fp); if(feof(fp)) { char str[8192]; sprintf(str,"### ERROR: Unable to read row monomial\n"); throw CoinError(str, "read_monom_row", "CoinLpIO", __FILE__, __LINE__); } } (*cnt_coeff)--; rhs[*cnt_row] = atof(start_str); switch(read_sense) { case 0: rowlow[*cnt_row] = -inf; rowup[*cnt_row] = rhs[*cnt_row]; break; case 1: rowlow[*cnt_row] = rhs[*cnt_row]; rowup[*cnt_row] = rhs[*cnt_row]; break; case 2: rowlow[*cnt_row] = rhs[*cnt_row]; rowup[*cnt_row] = inf; break; default: break; } (*cnt_row)++; } /* read_row */ /*************************************************************************/ int CoinLpIO::is_keyword(const char *buff) const { size_t lbuff = strlen(buff); if(((lbuff == 5) && (CoinStrNCaseCmp(buff, "bound", 5) == 0)) || ((lbuff == 6) && (CoinStrNCaseCmp(buff, "bounds", 6) == 0))) { return(1); } if(((lbuff == 7) && (CoinStrNCaseCmp(buff, "integer", 7) == 0)) || ((lbuff == 8) && (CoinStrNCaseCmp(buff, "integers", 8) == 0))) { return(2); } if(((lbuff == 7) && (CoinStrNCaseCmp(buff, "general", 7) == 0)) || ((lbuff == 8) && (CoinStrNCaseCmp(buff, "generals", 8) == 0))) { return(2); } if(((lbuff == 6) && (CoinStrNCaseCmp(buff, "binary", 6) == 0)) || ((lbuff == 8) && (CoinStrNCaseCmp(buff, "binaries", 8) == 0))) { return(3); } if(((lbuff == 15) && (CoinStrNCaseCmp(buff, "semi-continuous", 15) == 0)) || ((lbuff == 4) && (CoinStrNCaseCmp(buff, "semi", 4) == 0)) || ((lbuff == 5) && (CoinStrNCaseCmp(buff, "semis", 5) == 0))) { return(4); } if((lbuff == 3) && (CoinStrNCaseCmp(buff, "sos", 3) == 0)) { return(5); } if((lbuff == 3) && (CoinStrNCaseCmp(buff, "end", 3) == 0)) { return(6); } return(0); } /* is_keyword */ /*************************************************************************/ void CoinLpIO::readLp(const char *filename, const double epsilon) { setEpsilon(epsilon); readLp(filename); } /*************************************************************************/ void CoinLpIO::readLp(const char *filename) { FILE *fp = fopen(filename, "r"); if(!fp) { char str[8192]; sprintf(str,"### ERROR: Unable to open file %s for reading\n", filename); throw CoinError(str, "readLp", "CoinLpIO", __FILE__, __LINE__); } readLp(fp); fclose(fp); } /*************************************************************************/ void CoinLpIO::readLp(FILE* fp, const double epsilon) { setEpsilon(epsilon); readLp(fp); } /*************************************************************************/ void CoinLpIO::readLp(FILE* fp) { int maxrow = 1000; int maxcoeff = 40000; double lp_eps = getEpsilon(); double lp_inf = getInfinity(); char buff[1024]; int objsense, cnt_coeff = 0, cnt_row = 0, cnt_obj = 0; int num_objectives = 0; char *objName[MAX_OBJECTIVES] = {NULL, NULL}; int obj_starts[MAX_OBJECTIVES+1]; char **colNames = reinterpret_cast (malloc ((maxcoeff+1) * sizeof(char *))); double *coeff = reinterpret_cast (malloc ((maxcoeff+1) * sizeof(double))); char **rowNames = reinterpret_cast (malloc ((maxrow+MAX_OBJECTIVES) * sizeof(char *))); int *start = reinterpret_cast (malloc ((maxrow+MAX_OBJECTIVES) * sizeof(int))); double *rhs = reinterpret_cast (malloc ((maxrow+1) * sizeof(double))); double *rowlow = reinterpret_cast (malloc ((maxrow+1) * sizeof(double))); double *rowup = reinterpret_cast (malloc ((maxrow+1) * sizeof(double))); int i; objsense = find_obj(fp); int read_st = 0; while(!read_st) { read_st = read_monom_obj(fp, coeff, colNames, &cnt_obj, objName, &num_objectives, obj_starts); if(cnt_obj == maxcoeff) { realloc_coeff(&coeff, &colNames, &maxcoeff); } } obj_starts[num_objectives] = cnt_obj; start[0] = cnt_obj; cnt_coeff = cnt_obj; if(read_st == 2) { int x=fscanf(fp, "%s", buff); if (x<=0) throw("bad fscanf"); size_t lbuff = strlen(buff); if((lbuff != 2) || (CoinStrNCaseCmp(buff, "to", 2) != 0)) { char str[8192]; sprintf(str,"### ERROR: Can not locate keyword 'Subject To'\n"); throw CoinError(str, "readLp", "CoinLpIO", __FILE__, __LINE__); } } scan_next(buff, fp); while(!is_keyword(buff)) { if(buff[strlen(buff)-1] == ':') { buff[strlen(buff)-1] = '\0'; #ifdef LPIO_DEBUG printf("CoinLpIO::readLp(): rowName[%d]: %s\n", cnt_row, buff); #endif rowNames[cnt_row] = CoinStrdup(buff); scan_next(buff, fp); } else { char rname[15]; sprintf(rname, "cons%d", cnt_row); rowNames[cnt_row] = CoinStrdup(rname); } read_row(fp, buff, &coeff, &colNames, &cnt_coeff, &maxcoeff, rhs, rowlow, rowup, &cnt_row, lp_inf); scan_next(buff, fp); start[cnt_row] = cnt_coeff; if(cnt_row == maxrow) { realloc_row(&rowNames, &start, &rhs, &rowlow, &rowup, &maxrow); } } numberRows_ = cnt_row; stopHash(1); startHash(colNames, cnt_coeff, 1); COINColumnIndex icol; int read_sense1, read_sense2; double bnd1 = 0, bnd2 = 0; int maxcol = numberHash_[1] + 100; double *collow = reinterpret_cast (malloc ((maxcol+1) * sizeof(double))); double *colup = reinterpret_cast (malloc ((maxcol+1) * sizeof(double))); char *is_int = reinterpret_cast (malloc ((maxcol+1) * sizeof(char))); int has_int = 0; for (i=0; imessage(COIN_GENERAL_WARNING,messages_)< -1) { scan_next(buff, fp); mult = 1; start_str = buff; if(buff[0] == '-'||buff[0] == '+') { mult = (buff[0] == '-') ? -1 : +1; if(strlen(buff) == 1) { scan_next(buff, fp); start_str = buff; } else { start_str = &(buff[1]); } } if(first_is_number(start_str)) { bnd2 = mult * atof(start_str); scan_next(buff, fp); } else { if(is_inf(start_str)) { bnd2 = mult * lp_inf; scan_next(buff, fp); } else { char str[8192]; sprintf(str,"### ERROR: Bounds; expect a number, get: %s\n", buff); throw CoinError(str, "readLp", "CoinLpIO", __FILE__, __LINE__); } } } if((read_sense1 > -1) && (read_sense2 > -1)) { if(read_sense1 != read_sense2) { char str[8192]; sprintf(str,"### ERROR: Bounds; variable: %s read_sense1: %d read_sense2: %d\n", buff, read_sense1, read_sense2); throw CoinError(str, "readLp", "CoinLpIO", __FILE__, __LINE__); } else { if(read_sense1 == 1) { if(fabs(bnd1 - bnd2) > lp_eps) { char str[8192]; sprintf(str,"### ERROR: Bounds; variable: %s read_sense1: %d read_sense2: %d bnd1: %f bnd2: %f\n", buff, read_sense1, read_sense2, bnd1, bnd2); throw CoinError(str, "readLp", "CoinLpIO", __FILE__, __LINE__); } collow[icol] = bnd1; colup[icol] = bnd1; } if(read_sense1 == 0) { collow[icol] = bnd1; colup[icol] = bnd2; } if(read_sense1 == 2) { colup[icol] = bnd1; collow[icol] = bnd2; } } } else { if(read_sense1 > -1) { switch(read_sense1) { case 0: collow[icol] = bnd1; break; case 1: collow[icol] = bnd1; colup[icol] = bnd1; break; case 2: colup[icol] = bnd1; break; } } if(read_sense2 > -1) { switch(read_sense2) { case 0: colup[icol] = bnd2; break; case 1: collow[icol] = bnd2; colup[icol] = bnd2; break; case 2: collow[icol] = bnd2; break; } } } } } break; case 2: /* Integers/Generals section */ scan_next(buff, fp); while(is_keyword(buff) == 0) { icol = findHash(buff, 1); #ifdef LPIO_DEBUG printf("CoinLpIO::readLp(): Integer: colname: (%s) icol: %d\n", buff, icol); #endif if(icol < 0) { char printBuffer[512]; sprintf(printBuffer,"### CoinLpIO::readLp(): Integer variable %s does not appear in objective function or constraints", buff); handler_->message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)< 1) { colup[icol] = 1; } scan_next(buff, fp); } break; case 5: /* sos section */ { numberSets_ = 0; int maxSets = 10; CoinSet **set = new CoinSet * [maxSets]; int maxEntries = 100; double * weights = new double [maxEntries]; int * which = new int [maxEntries]; char printBuffer[512]; int numberBad=0; scan_next(buff, fp); while (true) { int numberEntries=0; int setType = -1; int goodLine=2; bool endLine=false; bool gotStart=false; while (!endLine) { if(is_keyword(buff) == 0) { // see if :: char * next = strstr(buff,"::"); if (!gotStart) { if (!next) { // OK first time - may be name of set if (goodLine==2) { int length=strlen(buff); if (buff[length-1]==':') { goodLine=1; scan_next(buff,fp); // try again continue; } else { goodLine=0; } } else { goodLine=0; } } else { // check nothing or set name if (strchr(buff,':')=buff&&(!strncmp(next,"S1::",4)||!strncmp(next,"S2::",4))) { setType = next[1]-'0'; gotStart=true; } else { // error goodLine=0; } } else { goodLine=0; } } } else if (next) { // end of set endLine=true; } } else { endLine=true; } if (!goodLine) { endLine=true; } while (!endLine) { scan_next(buff, fp); if(is_keyword(buff) == 0 && !strstr(buff,"::")) { // expect pair char * start_str=buff; char * next = strchr(start_str,':'); if (!next) { endLine=true; goodLine=0; } else { *next='\0'; int iColumn = columnIndex(start_str); *next=':'; if (iColumn>=0) { int length=strlen(next+1); if (!length) { // assume user put in spaces scan_next(buff, fp); if(is_keyword(buff) != 0 || strstr(buff,"::")) { goodLine=0; } else { next=buff-1; } } double value = atof(next+1); if (numberEntries==maxEntries) { maxEntries = 2*maxEntries; double * tempD = new double[maxEntries]; int * tempI = new int[maxEntries]; memcpy(tempD,weights,numberEntries*sizeof(double)); memcpy(tempI,which,numberEntries*sizeof(int)); delete [] weights; weights = tempD; delete [] which; which = tempI; } weights[numberEntries]=value; which[numberEntries++]=iColumn; } else { // no match - assume start of next set if (!numberBad) { sprintf(printBuffer,"### CoinLpIO::readLp(): Variable %s not found or no weight", buff); handler_->message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)<message(COIN_GENERAL_WARNING,messages_)< (malloc ((maxcoeff+1) * sizeof(int))); for(i=0; i (malloc (numberColumns_ * sizeof(double))); memset(obj[j], 0, numberColumns_ * sizeof(double)); for(i=obj_starts[j]; imessage(COIN_GENERAL_INFO,messages_)<< " CoinLpIO::readLp(): Maximization problem reformulated as minimization" <dumpMatrix(); #endif // save sets CoinSet ** saveSet = set_; int saveNumberSets = numberSets_; set_ = NULL; numberSets_ = 0; setLpDataWithoutRowAndColNames(*matrix, collow, colup, const_cast(obj), num_objectives, has_int ? is_int : 0, rowlow, rowup); set_ = saveSet; numberSets_ = saveNumberSets; for (int j = 0; j < num_objectives; j++){ if(objName[j] == NULL) { rowNames[cnt_row+j] = CoinStrdup("obj"); } else { rowNames[cnt_row+j] = CoinStrdup(objName[j]); } } // Hash tables for column names are already set up setLpDataRowAndColNames(rowNames, NULL); if(are_invalid_names(names_[1], numberHash_[1], false)) { setDefaultColNames(); handler_->message(COIN_GENERAL_WARNING,messages_)<< "### CoinLpIO::readLp(): Invalid column names\nNow using default column names." <dumpMatrix(); int i; printf("rowlower_:\n"); for(i=0; i (malloc(maxhash * sizeof(char *))); hash_[section] = new CoinHashLink[maxhash]; CoinHashLink * hashThis = hash_[section]; char **hashNames = names_[section]; for ( i = 0; i < maxhash; i++ ) { hashThis[i].index = -1; hashThis[i].next = -1; } /* * Initialize the hash table. Only the index of the first name that * hashes to a value is entered in the table; subsequent names that * collide with it are not entered. */ for (i=0; i i) { char str[8192]; sprintf(str,"### ERROR: Hash table: j1: %d i: %d\n", j1, i); throw CoinError(str, "startHash", "CoinLpIO", __FILE__, __LINE__); } #endif if (strcmp(thisName, hashNames[j1]) == 0) { // thisName already entered break; } else { // Collision; check if thisName already entered COINColumnIndex k = hashThis[ipos].next; if (k == -1) { // thisName not found; enter it while (1) { ++iput; if (iput > maxhash) { char str[8192]; sprintf(str,"### ERROR: Hash table: too many names\n"); throw CoinError(str, "startHash", "CoinLpIO", __FILE__, __LINE__); break; } if (hashThis[iput].index == -1) { break; } } hashThis[ipos].next = iput; hashThis[iput].index = cnt_distinct; hashNames[cnt_distinct] = CoinStrdup(thisName); cnt_distinct++; break; } else { ipos = k; // continue the check with names in collision } } } } } numberHash_[section] = cnt_distinct; } /* startHash */ /**************************************************************************/ // stopHash. Deletes hash storage void CoinLpIO::stopHash(int section) { freePreviousNames(section); previous_names_[section] = names_[section]; card_previous_names_[section] = numberHash_[section]; delete[] hash_[section]; hash_[section] = NULL; maxHash_[section] = 0; numberHash_[section] = 0; if(section == 0) { for (int j = 0; j < num_objectives_; j++){ if (objName_[j] != NULL){ free(objName_[j]); objName_[j] = NULL; } } } } /* stopHash */ /**********************************************************************/ // findHash. -1 not found COINColumnIndex CoinLpIO::findHash(const char *name, int section) const { COINColumnIndex found = -1; char ** names = names_[section]; CoinHashLink * hashThis = hash_[section]; COINColumnIndex maxhash = maxHash_[section]; COINColumnIndex ipos; /* default if we don't find anything */ if (!maxhash) return -1; int length = CoinStrlenAsInt(name); ipos = compute_hash(name, maxhash, length); while (1) { COINColumnIndex j1 = hashThis[ipos].index; if (j1 >= 0) { char *thisName2 = names[j1]; if (strcmp (name, thisName2) != 0) { COINColumnIndex k = hashThis[ipos].next; if (k != -1) ipos = k; else break; } else { found = j1; break; } } else { found = -1; break; } } return found; } /* findHash */ /*********************************************************************/ void CoinLpIO::insertHash(const char *thisName, int section) { int number = numberHash_[section]; int maxhash = maxHash_[section]; CoinHashLink * hashThis = hash_[section]; char **hashNames = names_[section]; int iput = -1; int length = CoinStrlenAsInt(thisName); int ipos = compute_hash(thisName, maxhash, length); while (1) { COINColumnIndex j1 = hashThis[ipos].index; if (j1 == -1) { hashThis[ipos].index = number; break; } else { char *thisName2 = hashNames[j1]; if ( strcmp (thisName, thisName2) != 0 ) { COINColumnIndex k = hashThis[ipos].next; if (k == -1) { while (1) { ++iput; if (iput == maxhash) { char str[8192]; sprintf(str,"### ERROR: Hash table: too many names\n"); throw CoinError(str, "insertHash", "CoinLpIO", __FILE__, __LINE__); break; } if (hashThis[iput].index == -1) { break; } } hashThis[ipos].next = iput; hashThis[iput].index = number; break; } else { ipos = k; /* nothing worked - try it again */ } } } } hashNames[number] = CoinStrdup(thisName); (numberHash_[section])++; } // Pass in Message handler (not deleted at end) void CoinLpIO::passInMessageHandler(CoinMessageHandler * handler) { if (defaultHandler_) delete handler_; defaultHandler_=false; handler_=handler; } // Set language void CoinLpIO::newLanguage(CoinMessages::Language language) { messages_ = CoinMessage(language); } CoinMP-1.8.3/CoinUtils/src/CoinFactorization1.cpp0000644000175000017500000022463512454772177020262 0ustar renerene/* $Id: CoinFactorization1.cpp 1772 2015-01-12 16:21:19Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinUtilsConfig.h" #include #include "CoinFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" #include "CoinTime.hpp" #include /* Somehow with some BLAS we get multithreaded by default For 99.99% of problems this is not a good idea. The openblas_set_num_threads(1) seems to work even with other blas */ #if CLP_USE_OPENBLAS static int blas_initialized=0; extern "C" { void openblas_set_num_threads(int num_threads); } #endif //:class CoinFactorization. Deals with Factorization and Updates // CoinFactorization. Constructor CoinFactorization::CoinFactorization ( ) { persistenceFlag_=0; gutsOfInitialize(7); } /// Copy constructor CoinFactorization::CoinFactorization ( const CoinFactorization &other) { persistenceFlag_=0; gutsOfInitialize(3); persistenceFlag_=other.persistenceFlag_; gutsOfCopy(other); } /// The real work of constructors etc /// Really really delete if type 2 void CoinFactorization::gutsOfDestructor(int type) { delete [] denseArea_; delete [] densePermute_; if (type==2) { elementU_.switchOff(); startRowU_.switchOff(); convertRowToColumnU_.switchOff(); indexRowU_.switchOff(); indexColumnU_.switchOff(); startColumnU_.switchOff(); elementL_.switchOff(); indexRowL_.switchOff(); startColumnL_.switchOff(); startColumnR_.switchOff(); numberInRow_.switchOff(); numberInColumn_.switchOff(); numberInColumnPlus_.switchOff(); pivotColumn_.switchOff(); pivotColumnBack_.switchOff(); firstCount_.switchOff(); nextCount_.switchOff(); lastCount_.switchOff(); permute_.switchOff(); permuteBack_.switchOff(); nextColumn_.switchOff(); lastColumn_.switchOff(); nextRow_.switchOff(); lastRow_.switchOff(); saveColumn_.switchOff(); markRow_.switchOff(); pivotRowL_.switchOff(); pivotRegion_.switchOff(); elementByRowL_.switchOff(); startRowL_.switchOff(); indexColumnL_.switchOff(); sparse_.switchOff(); workArea_.switchOff(); workArea2_.switchOff(); } elementU_.conditionalDelete(); startRowU_.conditionalDelete(); convertRowToColumnU_.conditionalDelete(); indexRowU_.conditionalDelete(); indexColumnU_.conditionalDelete(); startColumnU_.conditionalDelete(); elementL_.conditionalDelete(); indexRowL_.conditionalDelete(); startColumnL_.conditionalDelete(); startColumnR_.conditionalDelete(); numberInRow_.conditionalDelete(); numberInColumn_.conditionalDelete(); numberInColumnPlus_.conditionalDelete(); pivotColumn_.conditionalDelete(); pivotColumnBack_.conditionalDelete(); firstCount_.conditionalDelete(); nextCount_.conditionalDelete(); lastCount_.conditionalDelete(); permute_.conditionalDelete(); permuteBack_.conditionalDelete(); nextColumn_.conditionalDelete(); lastColumn_.conditionalDelete(); nextRow_.conditionalDelete(); lastRow_.conditionalDelete(); saveColumn_.conditionalDelete(); markRow_.conditionalDelete(); pivotRowL_.conditionalDelete(); pivotRegion_.conditionalDelete(); elementByRowL_.conditionalDelete(); startRowL_.conditionalDelete(); indexColumnL_.conditionalDelete(); sparse_.conditionalDelete(); workArea_.conditionalDelete(); workArea2_.conditionalDelete(); numberCompressions_ = 0; biggerDimension_ = 0; numberRows_ = 0; numberRowsExtra_ = 0; maximumRowsExtra_ = 0; numberColumns_ = 0; numberColumnsExtra_ = 0; maximumColumnsExtra_ = 0; numberGoodU_ = 0; numberGoodL_ = 0; totalElements_ = 0; factorElements_ = 0; status_ = -1; numberSlacks_ = 0; numberU_ = 0; maximumU_=0; lengthU_ = 0; lengthAreaU_ = 0; numberL_ = 0; baseL_ = 0; lengthL_ = 0; lengthAreaL_ = 0; numberR_ = 0; lengthR_ = 0; lengthAreaR_ = 0; denseArea_=NULL; densePermute_=NULL; // next two offsets but this makes cleaner elementR_=NULL; indexRowR_=NULL; numberDense_=0; //persistenceFlag_=0; ////denseThreshold_=0; } // type - 1 bit tolerances etc, 2 rest void CoinFactorization::gutsOfInitialize(int type) { #if CLP_USE_OPENBLAS if (!blas_initialized) { blas_initialized=1; openblas_set_num_threads(CLP_USE_OPENBLAS); } #endif if ((type&2)!=0) { numberCompressions_ = 0; biggerDimension_ = 0; numberRows_ = 0; numberRowsExtra_ = 0; maximumRowsExtra_ = 0; numberColumns_ = 0; numberColumnsExtra_ = 0; maximumColumnsExtra_ = 0; numberGoodU_ = 0; numberGoodL_ = 0; totalElements_ = 0; factorElements_ = 0; status_ = -1; numberPivots_ = 0; numberSlacks_ = 0; numberU_ = 0; maximumU_=0; lengthU_ = 0; lengthAreaU_ = 0; numberL_ = 0; baseL_ = 0; lengthL_ = 0; lengthAreaL_ = 0; numberR_ = 0; lengthR_ = 0; lengthAreaR_ = 0; elementR_ = NULL; indexRowR_ = NULL; // always switch off sparse sparseThreshold_=0; sparseThreshold2_= 0; denseArea_ = NULL; densePermute_=NULL; numberDense_=0; if (!persistenceFlag_) { workArea_=CoinFactorizationDoubleArrayWithLength(); workArea2_=CoinUnsignedIntArrayWithLength(); pivotColumn_=CoinIntArrayWithLength(); } } // after 2 because of persistenceFlag_ if ((type&1)!=0) { areaFactor_ = 0.0; pivotTolerance_ = 1.0e-1; zeroTolerance_ = 1.0e-13; #ifndef COIN_FAST_CODE slackValue_ = -1.0; #endif messageLevel_=0; maximumPivots_=200; numberTrials_ = 4; relaxCheck_=1.0; #if COIN_FACTORIZATION_DENSE_CODE denseThreshold_=31; denseThreshold_=71; #else denseThreshold_=0; #endif biasLU_=2; doForrestTomlin_=true; persistenceFlag_=0; } if ((type&4)!=0) { // we need to get 1 element arrays for any with length n+1 !! startColumnL_.conditionalNew (1); startColumnR_.conditionalNew( 1 ); startRowU_.conditionalNew(1); numberInRow_.conditionalNew(1); nextRow_.conditionalNew(1); lastRow_.conditionalNew( 1 ); pivotRegion_.conditionalNew(1); permuteBack_.conditionalNew(1); permute_.conditionalNew(1); pivotColumnBack_.conditionalNew(1); startColumnU_.conditionalNew( 1 ); numberInColumn_.conditionalNew(1); numberInColumnPlus_.conditionalNew(1); pivotColumn_.conditionalNew(1); nextColumn_.conditionalNew(1); lastColumn_.conditionalNew(1); #if 0 collectStatistics_=false; #endif // Below are all to collect ftranCountInput_=0.0; ftranCountAfterL_=0.0; ftranCountAfterR_=0.0; ftranCountAfterU_=0.0; btranCountInput_=0.0; btranCountAfterU_=0.0; btranCountAfterR_=0.0; btranCountAfterL_=0.0; // We can roll over factorizations numberFtranCounts_=0; numberBtranCounts_=0; // While these are averages collected over last ftranAverageAfterL_=0; ftranAverageAfterR_=0; ftranAverageAfterU_=0; btranAverageAfterU_=0; btranAverageAfterR_=0; btranAverageAfterL_=0; #ifdef ZEROFAULT startColumnL_.array()[0] = 0; startColumnR_.array()[0] = 0; startRowU_.array()[0] = 0; numberInRow_.array()[0] = 0; nextRow_.array()[0] = 0; lastRow_.array()[0] = 0; pivotRegion_.array()[0] = 0.0; permuteBack_.array()[0] = 0; permute_.array()[0] = 0; pivotColumnBack_.array()[0] = 0; startColumnU_.array()[0] = 0; numberInColumn_.array()[0] = 0; numberInColumnPlus_.array()[0] = 0; pivotColumn_.array()[0] = 0; nextColumn_.array()[0] = 0; lastColumn_.array()[0] = 0; #endif } } //Part of LP int CoinFactorization::factorize ( const CoinPackedMatrix & matrix, int rowIsBasic[], int columnIsBasic[], double areaFactor ) { // maybe for speed will be better to leave as many regions as possible gutsOfDestructor(); gutsOfInitialize(2); // ? is this correct //if (biasLU_==2) //biasLU_=3; if (areaFactor) areaFactor_ = areaFactor; const int * row = matrix.getIndices(); const CoinBigIndex * columnStart = matrix.getVectorStarts(); const int * columnLength = matrix.getVectorLengths(); const double * element = matrix.getElements(); int numberRows=matrix.getNumRows(); if (!numberRows) return 0; int numberColumns=matrix.getNumCols(); int numberBasic = 0; CoinBigIndex numberElements=0; int numberRowBasic=0; // compute how much in basis int i; for (i=0;i=0) numberRowBasic++; } numberBasic = numberRowBasic; for (i=0;i=0) { numberBasic++; numberElements += columnLength[i]; } } if ( numberBasic > numberRows ) { return -2; // say too many in basis } numberElements = 3 * numberBasic + 3 * numberElements + 20000; getAreas ( numberRows, numberBasic, numberElements, 2 * numberElements ); //fill //copy numberBasic=0; numberElements=0; int * indexColumnU = indexColumnU_.array(); int * indexRowU = indexRowU_.array(); CoinFactorizationDouble * elementU = elementU_.array(); for (i=0;i=0) { indexRowU[numberElements]=i; indexColumnU[numberElements]=numberBasic; elementU[numberElements++]=slackValue_; numberBasic++; } } for (i=0;i=0) { CoinBigIndex j; for (j=columnStart[i];j=0) { rowIsBasic[i]=permuteBack[back[numberBasic++]]; } } for (i=0;i=0) { columnIsBasic[i]=permuteBack[back[numberBasic++]]; } } // Set up permutation vector // these arrays start off as copies of permute // (and we could use permute_ instead of pivotColumn (not back though)) CoinMemcpyN ( permute_.array(), numberRows_ , pivotColumn_.array() ); CoinMemcpyN ( permuteBack_.array(), numberRows_ , pivotColumnBack() ); } else if (status_ == -1) { const int * pivotColumn = pivotColumn_.array(); // mark as basic or non basic for (i=0;i=0) { if (pivotColumn[numberBasic]>=0) rowIsBasic[i]=pivotColumn[numberBasic]; else rowIsBasic[i]=-1; numberBasic++; } } for (i=0;i=0) { if (pivotColumn[numberBasic]>=0) columnIsBasic[i]=pivotColumn[numberBasic]; else columnIsBasic[i]=-1; numberBasic++; } } } return status_; } //Given as triplets int CoinFactorization::factorize ( int numberOfRows, int numberOfColumns, CoinBigIndex numberOfElements, CoinBigIndex maximumL, CoinBigIndex maximumU, const int indicesRow[], const int indicesColumn[], const double elements[] , int permutation[], double areaFactor) { gutsOfDestructor(); gutsOfInitialize(2); if (areaFactor) areaFactor_ = areaFactor; getAreas ( numberOfRows, numberOfColumns, maximumL, maximumU ); //copy CoinMemcpyN ( indicesRow, numberOfElements, indexRowU_.array() ); CoinMemcpyN ( indicesColumn, numberOfElements, indexColumnU_.array() ); int i; CoinFactorizationDouble * elementU = elementU_.array(); for (i=0;i=0) { permutation[i]=pivotColumn[i]; } else { permutation[i]=-1; } } } return status_; } /* Two part version for flexibility This part creates arrays for user to fill. maximumL is guessed maximum size of L part of final factorization, maximumU of U part. These are multiplied by areaFactor which can be computed by user or internally. returns 0 -okay, -99 memory */ int CoinFactorization::factorizePart1 ( int numberOfRows, int , CoinBigIndex numberOfElements, int * indicesRow[], int * indicesColumn[], CoinFactorizationDouble * elements[], double areaFactor) { // maybe for speed will be better to leave as many regions as possible gutsOfDestructor(); gutsOfInitialize(2); if (areaFactor) areaFactor_ = areaFactor; CoinBigIndex numberElements = 3 * numberOfRows + 3 * numberOfElements + 20000; getAreas ( numberOfRows, numberOfRows, numberElements, 2 * numberElements ); // need to trap memory for -99 code *indicesRow = indexRowU_.array() ; *indicesColumn = indexColumnU_.array() ; *elements = elementU_.array() ; lengthU_ = numberOfElements; maximumU_ = numberElements; return 0; } /* This is part two of factorization Arrays belong to factorization and were returned by part 1 If status okay, permutation has pivot rows. If status is singular, then basic variables have +1 and ones thrown out have -COIN_INT_MAX to say thrown out. returns 0 -okay, -1 singular, -99 memory */ int CoinFactorization::factorizePart2 (int permutation[],int exactNumberElements) { lengthU_ = exactNumberElements; preProcess ( 0 ); factor ( ); //say which column is pivoting on which row int i; int * permuteBack = permuteBack_.array(); int * back = pivotColumnBack(); // permute so slacks on own rows etc for (i=0;i=0) { permutation[i]=pivotColumn[i]; } else { permutation[i]=-1; } } } return status_; } // ~CoinFactorization. Destructor CoinFactorization::~CoinFactorization ( ) { gutsOfDestructor(2); } // show_self. Debug show object void CoinFactorization::show_self ( ) const { int i; const int * pivotColumn = pivotColumn_.array(); for ( i = 0; i < numberRows_; i++ ) { std::cout << "r " << i << " " << pivotColumn[i]; if (pivotColumnBack()) std::cout<< " " << pivotColumnBack()[i]; std::cout<< " " << permute_.array()[i]; if (permuteBack_.array()) std::cout<< " " << permuteBack_.array()[i]; std::cout<< " " << pivotRegion_.array()[i]; std::cout << std::endl; } for ( i = 0; i < numberRows_; i++ ) { std::cout << "u " << i << " " << numberInColumn_.array()[i] << std::endl; int j; CoinSort_2(indexRowU_.array()+startColumnU_.array()[i], indexRowU_.array()+startColumnU_.array()[i]+numberInColumn_.array()[i], elementU_.array()+startColumnU_.array()[i]); for ( j = startColumnU_.array()[i]; j < startColumnU_.array()[i] + numberInColumn_.array()[i]; j++ ) { assert (indexRowU_.array()[j]>=0&&indexRowU_.array()[j]-1.0e50&&elementU_.array()[j]<1.0e50); std::cout << indexRowU_.array()[j] << " " << elementU_.array()[j] << std::endl; } } for ( i = 0; i < numberRows_; i++ ) { std::cout << "l " << i << " " << startColumnL_.array()[i + 1] - startColumnL_.array()[i] << std::endl; CoinSort_2(indexRowL_.array()+startColumnL_.array()[i], indexRowL_.array()+startColumnL_.array()[i+1], elementL_.array()+startColumnL_.array()[i]); int j; for ( j = startColumnL_.array()[i]; j < startColumnL_.array()[i + 1]; j++ ) { std::cout << indexRowL_.array()[j] << " " << elementL_.array()[j] << std::endl; } } } // sort so can compare void CoinFactorization::sort ( ) const { int i; for ( i = 0; i < numberRows_; i++ ) { CoinSort_2(indexRowU_.array()+startColumnU_.array()[i], indexRowU_.array()+startColumnU_.array()[i]+numberInColumn_.array()[i], elementU_.array()+startColumnU_.array()[i]); } for ( i = 0; i < numberRows_; i++ ) { CoinSort_2(indexRowL_.array()+startColumnL_.array()[i], indexRowL_.array()+startColumnL_.array()[i+1], elementL_.array()+startColumnL_.array()[i]); } } // getAreas. Gets space for a factorization //called by constructors void CoinFactorization::getAreas ( int numberOfRows, int numberOfColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ) { numberRows_ = numberOfRows; numberColumns_ = numberOfColumns; maximumRowsExtra_ = numberRows_ + maximumPivots_; numberRowsExtra_ = numberRows_; maximumColumnsExtra_ = numberColumns_ + maximumPivots_; numberColumnsExtra_ = numberColumns_; lengthAreaU_ = maximumU; lengthAreaL_ = maximumL; if ( !areaFactor_ ) { areaFactor_ = 1.0; } if ( areaFactor_ != 1.0 ) { if ((messageLevel_&16)!=0) printf("Increasing factorization areas by %g\n",areaFactor_); lengthAreaU_ = static_cast (areaFactor_*lengthAreaU_); lengthAreaL_ = static_cast (areaFactor_*lengthAreaL_); } elementU_.conditionalNew( lengthAreaU_ ); indexRowU_.conditionalNew( lengthAreaU_ ); indexColumnU_.conditionalNew( lengthAreaU_ ); elementL_.conditionalNew( lengthAreaL_ ); indexRowL_.conditionalNew( lengthAreaL_ ); if (persistenceFlag_) { // But we can use all we have if bigger int length; length = CoinMin(elementU_.getSize(),indexRowU_.getSize()); if (length>lengthAreaU_) { lengthAreaU_=length; assert (indexColumnU_.getSize()==indexRowU_.getSize()); } length = CoinMin(elementL_.getSize(),indexRowL_.getSize()); if (length>lengthAreaL_) { lengthAreaL_=length; } } startColumnL_.conditionalNew( numberRows_ + 1 ); startColumnL_.array()[0] = 0; startRowU_.conditionalNew( maximumRowsExtra_ + 1); // make sure this is valid startRowU_.array()[maximumRowsExtra_]=0; numberInRow_.conditionalNew( maximumRowsExtra_ + 1 ); markRow_.conditionalNew( numberRows_ ); pivotRowL_.conditionalNew( numberRows_ + 1 ); nextRow_.conditionalNew( maximumRowsExtra_ + 1 ); lastRow_.conditionalNew( maximumRowsExtra_ + 1 ); permute_.conditionalNew( maximumRowsExtra_ + 1 ); pivotRegion_.conditionalNew( maximumRowsExtra_ + 1 ); #ifdef ZEROFAULT memset(elementU_.array(),'a',lengthAreaU_*sizeof(CoinFactorizationDouble)); memset(indexRowU_.array(),'b',lengthAreaU_*sizeof(int)); memset(indexColumnU_.array(),'c',lengthAreaU_*sizeof(int)); memset(elementL_.array(),'d',lengthAreaL_*sizeof(CoinFactorizationDouble)); memset(indexRowL_.array(),'e',lengthAreaL_*sizeof(int)); memset(startColumnL_.array()+1,'f',numberRows_*sizeof(CoinBigIndex)); memset(startRowU_.array(),'g',maximumRowsExtra_*sizeof(CoinBigIndex)); memset(numberInRow_.array(),'h',(maximumRowsExtra_+1)*sizeof(int)); memset(markRow_.array(),'i',numberRows_*sizeof(int)); memset(pivotRowL_.array(),'j',(numberRows_+1)*sizeof(int)); memset(nextRow_.array(),'k',(maximumRowsExtra_+1)*sizeof(int)); memset(lastRow_.array(),'l',(maximumRowsExtra_+1)*sizeof(int)); memset(permute_.array(),'l',(maximumRowsExtra_+1)*sizeof(int)); memset(pivotRegion_.array(),'m',(maximumRowsExtra_+1)*sizeof(CoinFactorizationDouble)); #endif startColumnU_.conditionalNew( maximumColumnsExtra_ + 1 ); numberInColumn_.conditionalNew( maximumColumnsExtra_ + 1 ); numberInColumnPlus_.conditionalNew( maximumColumnsExtra_ + 1 ); pivotColumn_.conditionalNew( maximumColumnsExtra_ + 1 ); nextColumn_.conditionalNew( maximumColumnsExtra_ + 1 ); lastColumn_.conditionalNew( maximumColumnsExtra_ + 1 ); saveColumn_.conditionalNew( numberColumns_); #ifdef ZEROFAULT memset(startColumnU_.array(),'a',(maximumColumnsExtra_+1)*sizeof(CoinBigIndex)); memset(numberInColumn_.array(),'b',(maximumColumnsExtra_+1)*sizeof(int)); memset(numberInColumnPlus_.array(),'c',(maximumColumnsExtra_+1)*sizeof(int)); memset(pivotColumn_.array(),'d',(maximumColumnsExtra_+1)*sizeof(int)); memset(nextColumn_.array(),'e',(maximumColumnsExtra_+1)*sizeof(int)); memset(lastColumn_.array(),'f',(maximumColumnsExtra_+1)*sizeof(int)); #endif if ( numberRows_ + numberColumns_ ) { if ( numberRows_ > numberColumns_ ) { biggerDimension_ = numberRows_; } else { biggerDimension_ = numberColumns_; } firstCount_.conditionalNew( CoinMax(biggerDimension_ + 2, maximumRowsExtra_+1) ); nextCount_.conditionalNew( numberRows_ + numberColumns_ ); lastCount_.conditionalNew( numberRows_ + numberColumns_ ); #ifdef ZEROFAULT memset(firstCount_.array(),'g',(biggerDimension_ + 2 )*sizeof(int)); memset(nextCount_.array(),'h',(numberRows_+numberColumns_)*sizeof(int)); memset(lastCount_.array(),'i',(numberRows_+numberColumns_)*sizeof(int)); #endif } else { firstCount_.conditionalNew( 2 ); nextCount_.conditionalNew( 0 ); lastCount_.conditionalNew( 0 ); #ifdef ZEROFAULT memset(firstCount_.array(),'g', 2 *sizeof(int)); #endif biggerDimension_ = 0; } } // preProcess. PreProcesses raw triplet data //state is 0 - triplets, 1 - some counts etc , 2 - .. void CoinFactorization::preProcess ( int state, int ) { int *indexRow = indexRowU_.array(); int *indexColumn = indexColumnU_.array(); CoinFactorizationDouble *element = elementU_.array(); CoinBigIndex numberElements = lengthU_; int *numberInRow = numberInRow_.array(); int *numberInColumn = numberInColumn_.array(); int *numberInColumnPlus = numberInColumnPlus_.array(); CoinBigIndex *startRow = startRowU_.array(); CoinBigIndex *startColumn = startColumnU_.array(); int numberRows = numberRows_; int numberColumns = numberColumns_; if (state<4) totalElements_ = numberElements; //state falls through to next state switch ( state ) { case 0: //counts { CoinZeroN ( numberInRow, numberRows + 1 ); CoinZeroN ( numberInColumn, maximumColumnsExtra_ + 1 ); CoinBigIndex i; for ( i = 0; i < numberElements; i++ ) { int iRow = indexRow[i]; int iColumn = indexColumn[i]; numberInRow[iRow]++; numberInColumn[iColumn]++; } } case -1: //sort case 1: //sort { CoinBigIndex i, k; i = 0; int iColumn; for ( iColumn = 0; iColumn < numberColumns; iColumn++ ) { //position after end of Column i += numberInColumn[iColumn]; startColumn[iColumn] = i; } for ( k = numberElements - 1; k >= 0; k-- ) { int iColumn = indexColumn[k]; if ( iColumn >= 0 ) { CoinFactorizationDouble value = element[k]; int iRow = indexRow[k]; indexColumn[k] = -1; while ( true ) { CoinBigIndex iLook = startColumn[iColumn] - 1; startColumn[iColumn] = iLook; CoinFactorizationDouble valueSave = element[iLook]; int iColumnSave = indexColumn[iLook]; int iRowSave = indexRow[iLook]; element[iLook] = value; indexRow[iLook] = iRow; indexColumn[iLook] = -1; if ( iColumnSave >= 0 ) { iColumn = iColumnSave; value = valueSave; iRow = iRowSave; } else { break; } } /* endwhile */ } } } case 2: //move largest in column to beginning //and do row part { CoinBigIndex i, k; i = 0; int iRow; for ( iRow = 0; iRow < numberRows; iRow++ ) { startRow[iRow] = i; i += numberInRow[iRow]; } CoinZeroN ( numberInRow, numberRows ); int iColumn; for ( iColumn = 0; iColumn < numberColumns; iColumn++ ) { int number = numberInColumn[iColumn]; if ( number ) { CoinBigIndex first = startColumn[iColumn]; CoinBigIndex largest = first; int iRowSave = indexRow[first]; CoinFactorizationDouble valueSave = element[first]; double valueLargest = fabs ( valueSave ); int iLook = numberInRow[iRowSave]; numberInRow[iRowSave] = iLook + 1; indexColumn[startRow[iRowSave] + iLook] = iColumn; for ( k = first + 1; k < first + number; k++ ) { int iRow = indexRow[k]; int iLook = numberInRow[iRow]; numberInRow[iRow] = iLook + 1; indexColumn[startRow[iRow] + iLook] = iColumn; CoinFactorizationDouble value = element[k]; double valueAbs = fabs ( value ); if ( valueAbs > valueLargest ) { valueLargest = valueAbs; largest = k; } } indexRow[first] = indexRow[largest]; element[first] = element[largest]; indexRow[largest] = iRowSave; element[largest] = valueSave; } } } case 3: //links and initialize pivots { int *lastRow = lastRow_.array(); int *nextRow = nextRow_.array(); int *lastColumn = lastColumn_.array(); int *nextColumn = nextColumn_.array(); CoinFillN ( firstCount_.array(), biggerDimension_ + 2, -1 ); CoinFillN ( pivotColumn_.array(), numberColumns_, -1 ); CoinZeroN ( numberInColumnPlus, maximumColumnsExtra_ + 1 ); int iRow; for ( iRow = 0; iRow < numberRows; iRow++ ) { lastRow[iRow] = iRow - 1; nextRow[iRow] = iRow + 1; int number = numberInRow[iRow]; addLink ( iRow, number ); } lastRow[maximumRowsExtra_] = numberRows - 1; nextRow[maximumRowsExtra_] = 0; lastRow[0] = maximumRowsExtra_; nextRow[numberRows - 1] = maximumRowsExtra_; startRow[maximumRowsExtra_] = numberElements; int iColumn; for ( iColumn = 0; iColumn < numberColumns; iColumn++ ) { lastColumn[iColumn] = iColumn - 1; nextColumn[iColumn] = iColumn + 1; int number = numberInColumn[iColumn]; addLink ( iColumn + numberRows, number ); } lastColumn[maximumColumnsExtra_] = numberColumns - 1; nextColumn[maximumColumnsExtra_] = 0; lastColumn[0] = maximumColumnsExtra_; if (numberColumns) nextColumn[numberColumns - 1] = maximumColumnsExtra_; startColumn[maximumColumnsExtra_] = numberElements; } break; case 4: //move largest in column to beginning { CoinBigIndex i, k; CoinFactorizationDouble * pivotRegion = pivotRegion_.array(); int iColumn; int iRow; for ( iRow = 0; iRow < numberRows; iRow++ ) { if( numberInRow[iRow]>=0) { // zero count numberInRow[iRow]=0; } else { // empty //numberInRow[iRow]=-1; already that } } //CoinZeroN ( numberInColumnPlus, maximumColumnsExtra_ + 1 ); for ( iColumn = 0; iColumn < numberColumns; iColumn++ ) { int number = numberInColumn[iColumn]; if ( number ) { // use pivotRegion and startRow for remaining elements CoinBigIndex first = startColumn[iColumn]; CoinBigIndex largest = -1; double valueLargest = -1.0; int nOther=0; k = first; CoinBigIndex end = first+number; for ( ; k < end; k++ ) { int iRow = indexRow[k]; assert (iRow=0) { numberInRow[iRow]++; double valueAbs = fabs ( value ); if ( valueAbs > valueLargest ) { valueLargest = valueAbs; largest = nOther; } startRow[nOther]=iRow; pivotRegion[nOther++]=value; } else { indexRow[first] = iRow; element[first++] = value; } } numberInColumnPlus[iColumn]=first-startColumn[iColumn]; startColumn[iColumn]=first; //largest if (largest>=0) { indexRow[first] = startRow[largest]; element[first++] = pivotRegion[largest]; } for (k=0;k0) { numberInRow[iRow]=0; i += n; } } for ( iColumn = 0; iColumn < numberColumns; iColumn++ ) { int number = numberInColumn[iColumn]; if ( number ) { CoinBigIndex first = startColumn[iColumn]; for ( k = first; k < first + number; k++ ) { int iRow = indexRow[k]; int iLook = numberInRow[iRow]; numberInRow[iRow] = iLook + 1; indexColumn[startRow[iRow] + iLook] = iColumn; } } } } // modified 3 { //set markRow so no rows updated //CoinFillN ( markRow_.array(), numberRows_, -1 ); int *lastColumn = lastColumn_.array(); int *nextColumn = nextColumn_.array(); CoinFactorizationDouble * pivotRegion = pivotRegion_.array(); int iRow; int numberGood=0; startColumnL_.array()[0] = 0; //for luck for ( iRow = 0; iRow < numberRows; iRow++ ) { int number = numberInRow[iRow]; if (number<0) { numberInRow[iRow]=0; pivotRegion[numberGood++]=slackValue_; } } int iColumn; for ( iColumn = 0 ; iColumn < numberColumns_; iColumn++ ) { lastColumn[iColumn] = iColumn - 1; nextColumn[iColumn] = iColumn + 1; int number = numberInColumn[iColumn]; deleteLink(iColumn+numberRows); addLink ( iColumn + numberRows, number ); } lastColumn[maximumColumnsExtra_] = numberColumns - 1; nextColumn[maximumColumnsExtra_] = 0; lastColumn[0] = maximumColumnsExtra_; if (numberColumns) nextColumn[numberColumns - 1] = maximumColumnsExtra_; startColumn[maximumColumnsExtra_] = numberElements; } } /* endswitch */ } #ifdef CLP_FACTORIZATION_INSTRUMENT double externalTimeStart=0.0; double timeInFactorize=0.0; double timeInUpdate=0.0; double timeInFactorizeFake=0.0; double timeInUpdateFake1=0.0; double timeInUpdateFake2=0.0; double timeInUpdateTranspose=0.0; double timeInUpdateFT=0.0; double timeInUpdateTwoFT=0.0; double timeInReplace=0.0; double averageLengthR=0.0; double averageLengthL=0.0; double averageLengthU=0.0; double scaledLengthDense=0.0; double scaledLengthDenseSquared=0.0; double scaledLengthL=0.0; double scaledLengthR=0.0; double scaledLengthU=0.0; int numberUpdate=1; int numberUpdateTranspose=0; int numberUpdateFT=0; int numberUpdateTwoFT=0; int numberReplace=0; int numberAdded=0; int currentLengthR=0; int currentLengthU=0; int currentTakeoutU=0; int startLengthU=0; int endLengthU=0; int endLengthU2=0; #endif //Does most of factorization int CoinFactorization::factor ( ) { #ifdef CLP_FACTORIZATION_INSTRUMENT int nUse=numberUpdate+numberUpdateTranspose+numberUpdateFT+ 2*numberUpdateTwoFT+numberReplace; double dUse=timeInUpdate+timeInUpdateTranspose+timeInUpdateFT+ timeInUpdateTwoFT+timeInReplace; printf("%.18g time in factorization, using %.18g (%d) -average %.18g\n", timeInFactorize,dUse,nUse,dUse/static_cast(nUse)); //collectStatistics_=true; int * startColumnU = startColumnU_.array(); int numberSlacksX=0; for (int i=0;i=0) { int iRow = k; k=nextRow[k]; //nSing++; nextRow[iRow]=-1; } //assert (nSing); //printf("%d singularities - good %d rows %d\n",nSing, // numberGoodU_,numberRows_); // Now nextRow has -1 or sequence into numberGoodU_; int * permuteA = permute_.array(); for ( i = 0; i < numberRows_; i++ ) { int iGood= nextRow[i]; if (iGood>=0) permuteA[iGood]=i; } // swap arrays permute_.swap(nextRow_); int * permute = permute_.array(); for ( i = 0; i < numberRows_; i++ ) { lastRow[i] = -1; } for ( i = 0; i < numberColumns_; i++ ) { lastColumn[i] = -1; } for ( i = 0; i < numberGoodU_; i++ ) { int goodRow = permuteA[i]; //valid pivot row int goodColumn = pivotColumn[i]; lastRow[goodRow] = goodColumn; //will now have -1 or column sequence lastColumn[goodColumn] = goodRow; //will now have -1 or row sequence } nextRow_.conditionalDelete(); k = 0; //copy back and count for ( i = 0; i < numberRows_; i++ ) { permute[i] = lastRow[i]; if ( permute[i] < 0 ) { //std::cout << i << " " < 10 ) { areaFactor_ *= 1.1; } numberCompressions_=0; cleanup ( ); } #ifdef CLP_FACTORIZATION_INSTRUMENT timeInFactorize = CoinCpuTime()-timeStart; printf("%d slacks, startU %d, endL %d, endU %d + %d dense (squared)\n", numberSlacksX,numberInUX,lengthL_,lengthU_, numberDense_*numberDense_); currentLengthR=0; // remember pivots not included in counts endLengthU = totalElements_ - numberDense_*numberDense_-lengthL_; endLengthU2=lengthU_; currentLengthU=lengthU_; currentTakeoutU=0; #endif return status_; } // pivotRowSingleton. Does one pivot on Row Singleton in factorization bool CoinFactorization::pivotRowSingleton ( int pivotRow, int pivotColumn ) { //store pivot columns (so can easily compress) CoinBigIndex * startColumnU = startColumnU_.array(); CoinBigIndex startColumn = startColumnU[pivotColumn]; int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); int numberDoColumn = numberInColumn[pivotColumn] - 1; CoinBigIndex endColumn = startColumn + numberDoColumn + 1; CoinBigIndex pivotRowPosition = startColumn; int * indexRowU = indexRowU_.array(); int iRow = indexRowU[pivotRowPosition]; CoinBigIndex * startRowU = startRowU_.array(); int * nextRow = nextRow_.array(); int * lastRow = lastRow_.array(); while ( iRow != pivotRow ) { pivotRowPosition++; iRow = indexRowU[pivotRowPosition]; } /* endwhile */ assert ( pivotRowPosition < endColumn ); //store column in L, compress in U and take column out CoinBigIndex l = lengthL_; if ( l + numberDoColumn > lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) std::cout << "more memory needed in middle of invert" << std::endl; return false; } CoinBigIndex * startColumnL = startColumnL_.array(); CoinFactorizationDouble * elementL = elementL_.array(); int * indexRowL = indexRowL_.array(); startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l + numberDoColumn; lengthL_ += numberDoColumn; CoinFactorizationDouble *elementU = elementU_.array(); CoinFactorizationDouble pivotElement = elementU[pivotRowPosition]; CoinFactorizationDouble pivotMultiplier = 1.0 / pivotElement; pivotRegion_.array()[numberGoodU_] = pivotMultiplier; CoinBigIndex i; int * indexColumnU = indexColumnU_.array(); for ( i = startColumn; i < pivotRowPosition; i++ ) { int iRow = indexRowU[i]; indexRowL[l] = iRow; elementL[l] = elementU[i] * pivotMultiplier; l++; //take out of row list CoinBigIndex start = startRowU[iRow]; int iNumberInRow = numberInRow[iRow]; CoinBigIndex end = start + iNumberInRow; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ assert ( where < end ); indexColumnU[where] = indexColumnU[end - 1]; iNumberInRow--; numberInRow[iRow] = iNumberInRow; deleteLink ( iRow ); addLink ( iRow, iNumberInRow ); } for ( i = pivotRowPosition + 1; i < endColumn; i++ ) { int iRow = indexRowU[i]; indexRowL[l] = iRow; elementL[l] = elementU[i] * pivotMultiplier; l++; //take out of row list CoinBigIndex start = startRowU[iRow]; int iNumberInRow = numberInRow[iRow]; CoinBigIndex end = start + iNumberInRow; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ assert ( where < end ); indexColumnU[where] = indexColumnU[end - 1]; iNumberInRow--; numberInRow[iRow] = iNumberInRow; deleteLink ( iRow ); addLink ( iRow, iNumberInRow ); } numberInColumn[pivotColumn] = 0; //modify linked list for pivots numberInRow[pivotRow] = 0; deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); //take out this bit of indexColumnU int next = nextRow[pivotRow]; int last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; lastRow[pivotRow] =-2; nextRow[pivotRow] = numberGoodU_; //use for permute return true; } // pivotColumnSingleton. Does one pivot on Column Singleton in factorization bool CoinFactorization::pivotColumnSingleton ( int pivotRow, int pivotColumn ) { int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); int * numberInColumnPlus = numberInColumnPlus_.array(); //store pivot columns (so can easily compress) int numberDoRow = numberInRow[pivotRow] - 1; CoinBigIndex * startColumnU = startColumnU_.array(); CoinBigIndex startColumn = startColumnU[pivotColumn]; int put = 0; CoinBigIndex * startRowU = startRowU_.array(); CoinBigIndex startRow = startRowU[pivotRow]; CoinBigIndex endRow = startRow + numberDoRow + 1; int * indexColumnU = indexColumnU_.array(); int * indexRowU = indexRowU_.array(); int * saveColumn = saveColumn_.array(); CoinBigIndex i; for ( i = startRow; i < endRow; i++ ) { int iColumn = indexColumnU[i]; if ( iColumn != pivotColumn ) { saveColumn[put++] = iColumn; } } int * nextRow = nextRow_.array(); int * lastRow = lastRow_.array(); //take out this bit of indexColumnU int next = nextRow[pivotRow]; int last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; nextRow[pivotRow] = numberGoodU_; //use for permute lastRow[pivotRow] =-2; //mark //clean up counts CoinFactorizationDouble *elementU = elementU_.array(); CoinFactorizationDouble pivotElement = elementU[startColumn]; pivotRegion_.array()[numberGoodU_] = 1.0 / pivotElement; numberInColumn[pivotColumn] = 0; //totalElements_ --; //numberInColumnPlus[pivotColumn]++; //move pivot row in other columns to safe zone for ( i = 0; i < numberDoRow; i++ ) { int iColumn = saveColumn[i]; if ( numberInColumn[iColumn] ) { int number = numberInColumn[iColumn] - 1; //modify linked list deleteLink ( iColumn + numberRows_ ); addLink ( iColumn + numberRows_, number ); //move pivot row element if ( number ) { CoinBigIndex start = startColumnU[iColumn]; CoinBigIndex pivot = start; int iRow = indexRowU[pivot]; while ( iRow != pivotRow ) { pivot++; iRow = indexRowU[pivot]; } assert (pivot < startColumnU[iColumn] + numberInColumn[iColumn]); if ( pivot != start ) { //move largest one up CoinFactorizationDouble value = elementU[start]; iRow = indexRowU[start]; elementU[start] = elementU[pivot]; indexRowU[start] = indexRowU[pivot]; elementU[pivot] = elementU[start + 1]; indexRowU[pivot] = indexRowU[start + 1]; elementU[start + 1] = value; indexRowU[start + 1] = iRow; } else { //find new largest element int iRowSave = indexRowU[start + 1]; CoinFactorizationDouble valueSave = elementU[start + 1]; double valueLargest = fabs ( valueSave ); CoinBigIndex end = start + numberInColumn[iColumn]; CoinBigIndex largest = start + 1; CoinBigIndex k; for ( k = start + 2; k < end; k++ ) { CoinFactorizationDouble value = elementU[k]; double valueAbs = fabs ( value ); if ( valueAbs > valueLargest ) { valueLargest = valueAbs; largest = k; } } indexRowU[start + 1] = indexRowU[largest]; elementU[start + 1] = elementU[largest]; indexRowU[largest] = iRowSave; elementU[largest] = valueSave; } } //clean up counts numberInColumn[iColumn]--; numberInColumnPlus[iColumn]++; startColumnU[iColumn]++; //totalElements_--; } } //modify linked list for pivots deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); numberInRow[pivotRow] = 0; //put in dummy pivot in L CoinBigIndex l = lengthL_; CoinBigIndex * startColumnL = startColumnL_.array(); startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l; return true; } // getColumnSpace. Gets space for one Column with given length //may have to do compression (returns true) //also moves existing vector bool CoinFactorization::getColumnSpace ( int iColumn, int extraNeeded ) { int * numberInColumn = numberInColumn_.array(); int * numberInColumnPlus = numberInColumnPlus_.array(); int * nextColumn = nextColumn_.array(); int * lastColumn = lastColumn_.array(); int number = numberInColumnPlus[iColumn] + numberInColumn[iColumn]; CoinBigIndex * startColumnU = startColumnU_.array(); CoinBigIndex space = lengthAreaU_ - startColumnU[maximumColumnsExtra_]; CoinFactorizationDouble *elementU = elementU_.array(); int * indexRowU = indexRowU_.array(); if ( space < extraNeeded + number + 4 ) { //compression int iColumn = nextColumn[maximumColumnsExtra_]; CoinBigIndex put = 0; while ( iColumn != maximumColumnsExtra_ ) { //move CoinBigIndex get; CoinBigIndex getEnd; if ( startColumnU[iColumn] >= 0 ) { get = startColumnU[iColumn] - numberInColumnPlus[iColumn]; getEnd = startColumnU[iColumn] + numberInColumn[iColumn]; startColumnU[iColumn] = put + numberInColumnPlus[iColumn]; } else { get = -startColumnU[iColumn]; getEnd = get + numberInColumn[iColumn]; startColumnU[iColumn] = -put; } CoinBigIndex i; for ( i = get; i < getEnd; i++ ) { indexRowU[put] = indexRowU[i]; elementU[put] = elementU[i]; put++; } iColumn = nextColumn[iColumn]; } /* endwhile */ numberCompressions_++; startColumnU[maximumColumnsExtra_] = put; space = lengthAreaU_ - put; if ( extraNeeded == COIN_INT_MAX >> 1 ) { return true; } if ( space < extraNeeded + number + 2 ) { //need more space //if we can allocate bigger then do so and copy //if not then return so code can start again status_ = -99; return false; } } CoinBigIndex put = startColumnU[maximumColumnsExtra_]; int next = nextColumn[iColumn]; int last = lastColumn[iColumn]; if ( extraNeeded || next != maximumColumnsExtra_ ) { //out nextColumn[last] = next; lastColumn[next] = last; //in at end last = lastColumn[maximumColumnsExtra_]; nextColumn[last] = iColumn; lastColumn[maximumColumnsExtra_] = iColumn; lastColumn[iColumn] = last; nextColumn[iColumn] = maximumColumnsExtra_; //move CoinBigIndex get = startColumnU[iColumn] - numberInColumnPlus[iColumn]; startColumnU[iColumn] = put + numberInColumnPlus[iColumn]; if ( number < 50 ) { int *indexRow = indexRowU; CoinFactorizationDouble *element = elementU; int i = 0; if ( ( number & 1 ) != 0 ) { element[put] = element[get]; indexRow[put] = indexRow[get]; i = 1; } for ( ; i < number; i += 2 ) { CoinFactorizationDouble value0 = element[get + i]; CoinFactorizationDouble value1 = element[get + i + 1]; int index0 = indexRow[get + i]; int index1 = indexRow[get + i + 1]; element[put + i] = value0; element[put + i + 1] = value1; indexRow[put + i] = index0; indexRow[put + i + 1] = index1; } } else { CoinMemcpyN ( &indexRowU[get], number, &indexRowU[put] ); CoinMemcpyN ( &elementU[get], number, &elementU[put] ); } put += number; get += number; //add 2 for luck startColumnU[maximumColumnsExtra_] = put + extraNeeded + 2; if (startColumnU[maximumColumnsExtra_]>lengthAreaU_) { // get more memory #ifdef CLP_DEVELOP printf("put %d, needed %d, start %d, length %d\n", put,extraNeeded,startColumnU[maximumColumnsExtra_], lengthAreaU_); #endif return false; } } else { //take off space startColumnU[maximumColumnsExtra_] = startColumnU[last] + numberInColumn[last]; } return true; } // getRowSpace. Gets space for one Row with given length //may have to do compression (returns true) //also moves existing vector bool CoinFactorization::getRowSpace ( int iRow, int extraNeeded ) { int * numberInRow = numberInRow_.array(); int number = numberInRow[iRow]; CoinBigIndex * startRowU = startRowU_.array(); CoinBigIndex space = lengthAreaU_ - startRowU[maximumRowsExtra_]; int * nextRow = nextRow_.array(); int * lastRow = lastRow_.array(); int * indexColumnU = indexColumnU_.array(); if ( space < extraNeeded + number + 2 ) { //compression int iRow = nextRow[maximumRowsExtra_]; CoinBigIndex put = 0; while ( iRow != maximumRowsExtra_ ) { //move CoinBigIndex get = startRowU[iRow]; CoinBigIndex getEnd = startRowU[iRow] + numberInRow[iRow]; startRowU[iRow] = put; CoinBigIndex i; for ( i = get; i < getEnd; i++ ) { indexColumnU[put] = indexColumnU[i]; put++; } iRow = nextRow[iRow]; } /* endwhile */ numberCompressions_++; startRowU[maximumRowsExtra_] = put; space = lengthAreaU_ - put; if ( space < extraNeeded + number + 2 ) { //need more space //if we can allocate bigger then do so and copy //if not then return so code can start again status_ = -99; return false;; } } CoinBigIndex put = startRowU[maximumRowsExtra_]; int next = nextRow[iRow]; int last = lastRow[iRow]; //out nextRow[last] = next; lastRow[next] = last; //in at end last = lastRow[maximumRowsExtra_]; nextRow[last] = iRow; lastRow[maximumRowsExtra_] = iRow; lastRow[iRow] = last; nextRow[iRow] = maximumRowsExtra_; //move CoinBigIndex get = startRowU[iRow]; startRowU[iRow] = put; while ( number ) { number--; indexColumnU[put] = indexColumnU[get]; put++; get++; } /* endwhile */ //add 4 for luck startRowU[maximumRowsExtra_] = put + extraNeeded + 4; return true; } #if COIN_ONE_ETA_COPY /* Reorders U so contiguous and in order (if there is space) Returns true if it could */ bool CoinFactorization::reorderU() { #if 1 return false; #else if (numberRows_!=numberColumns_) return false; CoinBigIndex * startColumnU = startColumnU_.array(); int * numberInColumn = numberInColumn_.array(); int * numberInColumnPlus = numberInColumnPlus_.array(); int iColumn; CoinBigIndex put = 0; for (iColumn =0;iColumn> 1 ); //compress // swap arrays numberInColumn_.swap(numberInColumnPlus_); } #else getColumnSpace ( 0, COIN_INT_MAX >> 1 ); //compress // swap arrays numberInColumn_.swap(numberInColumnPlus_); #endif CoinBigIndex * startColumnU = startColumnU_.array(); CoinBigIndex lastU = startColumnU[maximumColumnsExtra_]; //free some memory here saveColumn_.conditionalDelete(); markRow_.conditionalDelete() ; //firstCount_.conditionalDelete() ; nextCount_.conditionalDelete() ; lastCount_.conditionalDelete() ; int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); int * numberInColumnPlus = numberInColumnPlus_.array(); //make column starts OK //for best cache behavior get in order (last pivot at bottom of space) //that will need thinking about //use nextRow for permutation (as that is what it is) int i; #ifndef NDEBUG { if (numberGoodU_=numberRows_) printf("Bad a %d %d\n",i,k); assert(k>=0&&k=0&&permute[i]=0&&permuteBack[i]= 0 ) { //wanted if ( numberU != iColumn ) { numberInColumnPlus[iColumn] = numberU; } else { numberInColumnPlus[iColumn] = -1; //already in correct place } numberU++; } } for ( i = 0; i < numberColumns_; i++ ) { int number = numberInColumn[i]; //always 0? int where = numberInColumnPlus[i]; numberInColumnPlus[i] = -1; CoinBigIndex start = startColumnU[i]; while ( where >= 0 ) { //put where it should be int numberNext = numberInColumn[where]; //always 0? int whereNext = numberInColumnPlus[where]; CoinBigIndex startNext = startColumnU[where]; numberInColumn[where] = number; numberInColumnPlus[where] = -1; startColumnU[where] = start; number = numberNext; where = whereNext; start = startNext; } /* endwhile */ } //sort - using indexColumn CoinFillN ( indexColumnU_.array(), lastU, -1 ); CoinBigIndex k = 0; for ( i = numberSlacks_; i < numberRows_; i++ ) { CoinBigIndex start = startColumn[i]; CoinBigIndex end = start + numberInColumn[i]; CoinBigIndex j; for ( j = start; j < end; j++ ) { indexColumnU[j] = k++; } } for ( i = numberSlacks_; i < numberRows_; i++ ) { CoinBigIndex start = startColumn[i]; CoinBigIndex end = start + numberInColumn[i]; CoinBigIndex j; for ( j = start; j < end; j++ ) { CoinBigIndex k = indexColumnU[j]; int iRow = indexRowU[j]; CoinFactorizationDouble element = elementU[j]; while ( k != -1 ) { CoinBigIndex kNext = indexColumnU[k]; int iRowNext = indexRowU[k]; CoinFactorizationDouble elementNext = elementU[k]; indexColumnU[k] = -1; indexRowU[k] = iRow; elementU[k] = element; k = kNext; iRow = iRowNext; element = elementNext; } /* endwhile */ } } CoinZeroN ( startColumnU, numberSlacks_ ); k = 0; for ( i = numberSlacks_; i < numberRows_; i++ ) { startColumnU[i] = k; k += numberInColumn[i]; } maximumU_=k; #if COIN_ONE_ETA_COPY } else { // U already OK for ( i = 0; i < numberColumns_; i++ ) { int iColumn = pivotColumn[i]; pivotColumnB[iColumn] = i; } maximumU_=startColumnU[numberRows_-1]+ numberInColumn[numberRows_-1]; numberU=numberRows_; } #endif if ( (messageLevel_ & 8)) { std::cout<<" length of U "<10*numberRows_||numberRows_<200) { // NO numberInColumnPlus_.conditionalDelete() ; } else { #endif for ( i = 0; i < numberColumns_; i++ ) { lastColumn[i] = i - 1; nextColumn[i] = i + 1; numberInColumnPlus[i]=0; } nextColumn[numberColumns_ - 1] = maximumColumnsExtra_; lastColumn[maximumColumnsExtra_] = numberColumns_ - 1; nextColumn[maximumColumnsExtra_] = 0; lastColumn[0] = maximumColumnsExtra_; #ifndef ABC_USE_COIN_FACTORIZATION } #endif numberU_ = numberU; numberGoodU_ = numberU; numberL_ = numberGoodL_; #if COIN_DEBUG for ( i = 0; i < numberRows_; i++ ) { if ( permute[i] < 0 ) { std::cout << i << std::endl; abort ( ); } } #endif CoinFactorizationDouble * pivotRegion = pivotRegion_.array(); for ( i = numberSlacks_; i < numberU; i++ ) { CoinBigIndex start = startColumnU[i]; CoinBigIndex end = start + numberInColumn[i]; totalElements_ += numberInColumn[i]; CoinBigIndex j; for ( j = start; j < end; j++ ) { int iRow = indexRowU[j]; iRow = permute[iRow]; indexRowU[j] = iRow; numberInRow[iRow]++; } } #if COIN_ONE_ETA_COPY if (numberRows_>=COIN_ONE_ETA_COPY) { #endif //space for cross reference convertRowToColumnU_.conditionalNew( lengthAreaU_ ); CoinBigIndex *convertRowToColumn = convertRowToColumnU_.array(); CoinBigIndex j = 0; CoinBigIndex *startRow = startRowU_.array(); int iRow; for ( iRow = 0; iRow < numberRows_; iRow++ ) { startRow[iRow] = j; j += numberInRow[iRow]; } CoinBigIndex numberInU = j; CoinZeroN ( numberInRow_.array(), numberRows_ ); for ( i = numberSlacks_; i < numberRows_; i++ ) { CoinBigIndex start = startColumnU[i]; CoinBigIndex end = start + numberInColumn[i]; CoinFactorizationDouble pivotValue = pivotRegion[i]; CoinBigIndex j; for ( j = start; j < end; j++ ) { int iRow = indexRowU[j]; int iLook = numberInRow[iRow]; numberInRow[iRow] = iLook + 1; CoinBigIndex k = startRow[iRow] + iLook; indexColumnU[k] = i; convertRowToColumn[k] = j; //multiply by pivot elementU[j] *= pivotValue; } } int * nextRow = nextRow_.array(); int * lastRow = lastRow_.array(); for ( j = 0; j < numberRows_; j++ ) { lastRow[j] = j - 1; nextRow[j] = j + 1; } nextRow[numberRows_ - 1] = maximumRowsExtra_; lastRow[maximumRowsExtra_] = numberRows_ - 1; nextRow[maximumRowsExtra_] = 0; lastRow[0] = maximumRowsExtra_; startRow[maximumRowsExtra_] = numberInU; #if COIN_ONE_ETA_COPY } else { // no row copy for ( i = numberSlacks_; i < numberU; i++ ) { CoinBigIndex start = startColumnU[i]; CoinBigIndex end = start + numberInColumn[i]; CoinBigIndex j; CoinFactorizationDouble pivotValue = pivotRegion[i]; for ( j = start; j < end; j++ ) { //multiply by pivot elementU[j] *= pivotValue; } } } #endif int firstReal = numberRows_; CoinBigIndex * startColumnL = startColumnL_.array(); int * indexRowL = indexRowL_.array(); for ( i = numberRows_ - 1; i >= 0; i-- ) { CoinBigIndex start = startColumnL[i]; CoinBigIndex end = startColumnL[i + 1]; totalElements_ += end - start; if ( end > start ) { firstReal = i; CoinBigIndex j; for ( j = start; j < end; j++ ) { int iRow = indexRowL[j]; iRow = permute[iRow]; assert (iRow>firstReal); indexRowL[j] = iRow; } } } baseL_ = firstReal; numberL_ -= firstReal; factorElements_ = totalElements_; //can delete pivotRowL_ as not used pivotRowL_.conditionalDelete() ; //use L for R if room CoinBigIndex space = lengthAreaL_ - lengthL_; CoinBigIndex spaceUsed = lengthL_ + lengthU_; int needed = ( spaceUsed + numberRows_ - 1 ) / numberRows_; needed = needed * 2 * maximumPivots_; if ( needed < 2 * numberRows_ ) { needed = 2 * numberRows_; } if (numberInColumnPlus_.array()) { // Need double the space for R space = space/2; startColumnR_.conditionalNew( maximumPivots_ + 1 + maximumColumnsExtra_ + 1 ); CoinBigIndex * startR = startColumnR_.array() + maximumPivots_+1; CoinZeroN (startR,(maximumColumnsExtra_+1)); } else { startColumnR_.conditionalNew(maximumPivots_ + 1 ); } #ifdef ZEROFAULT memset(startColumnR_.array(),'z',(maximumPivots_ + 1)*sizeof(CoinBigIndex)); #endif if ( space >= needed ) { lengthR_ = 0; lengthAreaR_ = space; elementR_ = elementL_.array() + lengthL_; indexRowR_ = indexRowL_.array() + lengthL_; } else { lengthR_ = 0; lengthAreaR_ = space; elementR_ = elementL_.array() + lengthL_; indexRowR_ = indexRowL_.array() + lengthL_; if ((messageLevel_&4)) std::cout<<"Factorization may need some increasing area space" <1.0) { double dense = numberDense_; dense *= dense; double withoutDense = totalElements_ - dense +1.0; factor *= 1.0 +dense/withoutDense; } return factor; } // checkConsistency. Checks that row and column copies look OK void CoinFactorization::checkConsistency ( ) { bool bad = false; int iRow; CoinBigIndex * startRowU = startRowU_.array(); int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); int * indexColumnU = indexColumnU_.array(); int * indexRowU = indexRowU_.array(); CoinBigIndex * startColumnU = startColumnU_.array(); for ( iRow = 0; iRow < numberRows_; iRow++ ) { if ( numberInRow[iRow] ) { CoinBigIndex startRow = startRowU[iRow]; CoinBigIndex endRow = startRow + numberInRow[iRow]; CoinBigIndex j; for ( j = startRow; j < endRow; j++ ) { int iColumn = indexColumnU[j]; CoinBigIndex startColumn = startColumnU[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumn[iColumn]; bool found = false; CoinBigIndex k; for ( k = startColumn; k < endColumn; k++ ) { if ( indexRowU[k] == iRow ) { found = true; break; } } if ( !found ) { bad = true; std::cout << "row " << iRow << " column " << iColumn << " Rows" << std::endl; } } } } int iColumn; for ( iColumn = 0; iColumn < numberColumns_; iColumn++ ) { if ( numberInColumn[iColumn] ) { CoinBigIndex startColumn = startColumnU[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumn[iColumn]; CoinBigIndex j; for ( j = startColumn; j < endColumn; j++ ) { int iRow = indexRowU[j]; CoinBigIndex startRow = startRowU[iRow]; CoinBigIndex endRow = startRow + numberInRow[iRow]; bool found = false; CoinBigIndex k; for ( k = startRow; k < endRow; k++ ) { if ( indexColumnU[k] == iColumn ) { found = true; break; } } if ( !found ) { bad = true; std::cout << "row " << iRow << " column " << iColumn << " Columns" << std::endl; } } } } if ( bad ) { abort ( ); } } // pivotOneOtherRow. When just one other row so faster bool CoinFactorization::pivotOneOtherRow ( int pivotRow, int pivotColumn ) { int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); int * numberInColumnPlus = numberInColumnPlus_.array(); int numberInPivotRow = numberInRow[pivotRow] - 1; CoinBigIndex * startRowU = startRowU_.array(); CoinBigIndex * startColumnU = startColumnU_.array(); CoinBigIndex startColumn = startColumnU[pivotColumn]; CoinBigIndex startRow = startRowU[pivotRow]; CoinBigIndex endRow = startRow + numberInPivotRow + 1; //take out this bit of indexColumnU int * nextRow = nextRow_.array(); int * lastRow = lastRow_.array(); int next = nextRow[pivotRow]; int last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; nextRow[pivotRow] = numberGoodU_; //use for permute lastRow[pivotRow] = -2; numberInRow[pivotRow] = 0; //store column in L, compress in U and take column out CoinBigIndex l = lengthL_; if ( l + 1 > lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) std::cout << "more memory needed in middle of invert" << std::endl; return false; } //l+=currentAreaL_->elementByColumn-elementL_; //CoinBigIndex lSave=l; CoinBigIndex * startColumnL = startColumnL_.array(); CoinFactorizationDouble * elementL = elementL_.array(); int * indexRowL = indexRowL_.array(); startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l + 1; lengthL_++; CoinFactorizationDouble pivotElement; CoinFactorizationDouble otherMultiplier; int otherRow; int * saveColumn = saveColumn_.array(); CoinFactorizationDouble *elementU = elementU_.array(); int * indexRowU = indexRowU_.array(); if ( indexRowU[startColumn] == pivotRow ) { pivotElement = elementU[startColumn]; otherMultiplier = elementU[startColumn + 1]; otherRow = indexRowU[startColumn + 1]; } else { pivotElement = elementU[startColumn + 1]; otherMultiplier = elementU[startColumn]; otherRow = indexRowU[startColumn]; } int numberSave = numberInRow[otherRow]; CoinFactorizationDouble pivotMultiplier = 1.0 / pivotElement; CoinFactorizationDouble * pivotRegion = pivotRegion_.array(); pivotRegion[numberGoodU_] = pivotMultiplier; numberInColumn[pivotColumn] = 0; otherMultiplier = otherMultiplier * pivotMultiplier; indexRowL[l] = otherRow; elementL[l] = otherMultiplier; //take out of row list CoinBigIndex start = startRowU[otherRow]; CoinBigIndex end = start + numberSave; CoinBigIndex where = start; int * indexColumnU = indexColumnU_.array(); while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ assert ( where < end ); end--; indexColumnU[where] = indexColumnU[end]; int numberAdded = 0; int numberDeleted = 0; //pack down and move to work int j; const int * nextCount = nextCount_.array(); int * nextColumn = nextColumn_.array(); for ( j = startRow; j < endRow; j++ ) { int iColumn = indexColumnU[j]; if ( iColumn != pivotColumn ) { CoinBigIndex startColumn = startColumnU[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumn[iColumn]; int iRow = indexRowU[startColumn]; CoinFactorizationDouble value = elementU[startColumn]; double largest; bool foundOther = false; //leave room for pivot CoinBigIndex put = startColumn + 1; CoinBigIndex positionLargest = -1; CoinFactorizationDouble thisPivotValue = 0.0; CoinFactorizationDouble otherElement = 0.0; CoinFactorizationDouble nextValue = elementU[put];; int nextIRow = indexRowU[put]; //compress column and find largest not updated if ( iRow != pivotRow ) { if ( iRow != otherRow ) { largest = fabs ( value ); elementU[put] = value; indexRowU[put] = iRow; positionLargest = put; put++; CoinBigIndex i; for ( i = startColumn + 1; i < endColumn; i++ ) { iRow = nextIRow; value = nextValue; #ifdef ZEROFAULT // doesn't matter reading uninitialized but annoys checking if ( i + 1 < endColumn ) { #endif nextIRow = indexRowU[i + 1]; nextValue = elementU[i + 1]; #ifdef ZEROFAULT } #endif if ( iRow != pivotRow ) { if ( iRow != otherRow ) { //keep indexRowU[put] = iRow; elementU[put] = value;; put++; } else { otherElement = value; foundOther = true; } } else { thisPivotValue = value; } } } else { otherElement = value; foundOther = true; //need to find largest largest = 0.0; CoinBigIndex i; for ( i = startColumn + 1; i < endColumn; i++ ) { iRow = nextIRow; value = nextValue; #ifdef ZEROFAULT // doesn't matter reading uninitialized but annoys checking if ( i + 1 < endColumn ) { #endif nextIRow = indexRowU[i + 1]; nextValue = elementU[i + 1]; #ifdef ZEROFAULT } #endif if ( iRow != pivotRow ) { //keep indexRowU[put] = iRow; elementU[put] = value;; double absValue = fabs ( value ); if ( absValue > largest ) { largest = absValue; positionLargest = put; } put++; } else { thisPivotValue = value; } } } } else { //need to find largest largest = 0.0; thisPivotValue = value; CoinBigIndex i; for ( i = startColumn + 1; i < endColumn; i++ ) { iRow = nextIRow; value = nextValue; #ifdef ZEROFAULT // doesn't matter reading uninitialized but annoys checking if ( i + 1 < endColumn ) { #endif nextIRow = indexRowU[i + 1]; nextValue = elementU[i + 1]; #ifdef ZEROFAULT } #endif if ( iRow != otherRow ) { //keep indexRowU[put] = iRow; elementU[put] = value;; double absValue = fabs ( value ); if ( absValue > largest ) { largest = absValue; positionLargest = put; } put++; } else { otherElement = value; foundOther = true; } } } //slot in pivot elementU[startColumn] = thisPivotValue; indexRowU[startColumn] = pivotRow; //clean up counts startColumn++; numberInColumn[iColumn] = put - startColumn; numberInColumnPlus[iColumn]++; startColumnU[iColumn]++; otherElement = otherElement - thisPivotValue * otherMultiplier; double absValue = fabs ( otherElement ); if ( absValue > zeroTolerance_ ) { if ( !foundOther ) { //have we space saveColumn[numberAdded++] = iColumn; int next = nextColumn[iColumn]; CoinBigIndex space; space = startColumnU[next] - put - numberInColumnPlus[next]; if ( space <= 0 ) { //getColumnSpace also moves fixed part int number = numberInColumn[iColumn]; if ( !getColumnSpace ( iColumn, number + 1 ) ) { return false; } //redo starts positionLargest = positionLargest + startColumnU[iColumn] - startColumn; startColumn = startColumnU[iColumn]; put = startColumn + number; } } elementU[put] = otherElement; indexRowU[put] = otherRow; if ( absValue > largest ) { largest = absValue; positionLargest = put; } put++; } else { if ( foundOther ) { numberDeleted++; //take out of row list CoinBigIndex where = start; while ( indexColumnU[where] != iColumn ) { where++; } /* endwhile */ assert ( where < end ); end--; indexColumnU[where] = indexColumnU[end]; } } numberInColumn[iColumn] = put - startColumn; //move largest if ( positionLargest >= 0 ) { value = elementU[positionLargest]; iRow = indexRowU[positionLargest]; elementU[positionLargest] = elementU[startColumn]; indexRowU[positionLargest] = indexRowU[startColumn]; elementU[startColumn] = value; indexRowU[startColumn] = iRow; } //linked list for column if ( nextCount[iColumn + numberRows_] != -2 ) { //modify linked list deleteLink ( iColumn + numberRows_ ); addLink ( iColumn + numberRows_, numberInColumn[iColumn] ); } } } //get space for row list next = nextRow[otherRow]; CoinBigIndex space; space = startRowU[next] - end; totalElements_ += numberAdded - numberDeleted; int number = numberAdded + ( end - start ); if ( space < numberAdded ) { numberInRow[otherRow] = end - start; if ( !getRowSpace ( otherRow, number ) ) { return false; } end = startRowU[otherRow] + end - start; } // do linked lists and update counts numberInRow[otherRow] = number; if ( number != numberSave ) { deleteLink ( otherRow ); addLink ( otherRow, number ); } for ( j = 0; j < numberAdded; j++ ) { indexColumnU[end++] = saveColumn[j]; } //modify linked list for pivots deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); return true; } void CoinFactorization::setPersistenceFlag(int flag) { persistenceFlag_=flag; workArea_.setPersistence(flag,maximumRowsExtra_+1); workArea2_.setPersistence(flag,maximumRowsExtra_+1); pivotColumn_.setPersistence(flag,maximumColumnsExtra_+1); permute_.setPersistence(flag,maximumRowsExtra_+1); pivotColumnBack_.setPersistence(flag,maximumRowsExtra_+1); permuteBack_.setPersistence(flag,maximumRowsExtra_+1); nextRow_.setPersistence(flag,maximumRowsExtra_+1); startRowU_.setPersistence(flag,maximumRowsExtra_+1); numberInRow_.setPersistence(flag,maximumRowsExtra_+1); numberInColumn_.setPersistence(flag,maximumColumnsExtra_+1); numberInColumnPlus_.setPersistence(flag,maximumColumnsExtra_+1); firstCount_.setPersistence(flag,CoinMax(biggerDimension_+2,maximumRowsExtra_+1)); nextCount_.setPersistence(flag,numberRows_+numberColumns_); lastCount_.setPersistence(flag,numberRows_+numberColumns_); nextColumn_.setPersistence(flag,maximumColumnsExtra_+1); lastColumn_.setPersistence(flag,maximumColumnsExtra_+1); lastRow_.setPersistence(flag,maximumRowsExtra_+1); markRow_.setPersistence(flag,numberRows_); saveColumn_.setPersistence(flag,numberColumns_); indexColumnU_.setPersistence(flag,lengthAreaU_); pivotRowL_.setPersistence(flag,numberRows_+1); pivotRegion_.setPersistence(flag,maximumRowsExtra_+1); elementU_.setPersistence(flag,lengthAreaU_); indexRowU_.setPersistence(flag,lengthAreaU_); startColumnU_.setPersistence(flag,maximumColumnsExtra_+1); convertRowToColumnU_.setPersistence( flag, lengthAreaU_ ); elementL_.setPersistence( flag, lengthAreaL_ ); indexRowL_.setPersistence( flag, lengthAreaL_ ); startColumnL_.setPersistence( flag, numberRows_ + 1 ); startColumnR_.setPersistence( flag, maximumPivots_ + 1 + maximumColumnsExtra_ + 1 ); startRowL_.setPersistence( flag,0 ); indexColumnL_.setPersistence( flag, 0 ); elementByRowL_.setPersistence( flag, 0 ); sparse_.setPersistence( flag, 0 ); } // Delete all stuff void CoinFactorization::almostDestructor() { gutsOfDestructor(2); } CoinMP-1.8.3/CoinUtils/src/CoinPresolveForcing.cpp0000644000175000017500000005622012431423745020452 0ustar renerene/* $Id: CoinPresolveForcing.cpp 1758 2014-11-14 16:03:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPresolveMatrix.hpp" #include "CoinPresolveEmpty.hpp" // for DROP_COL/DROP_ROW #include "CoinPresolveFixed.hpp" #include "CoinPresolveSubst.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPresolveUseless.hpp" #include "CoinPresolveForcing.hpp" #include "CoinMessage.hpp" #include "CoinFinite.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif namespace { /* Calculate the minimum and maximum row activity (also referred to as lhs bounds, from the common form ax <= b) for the row specified by the range krs, kre in els and hcol. Return the result in maxupp, maxdnp. */ void implied_row_bounds (const double *els, const double *clo, const double *cup, const int *hcol, CoinBigIndex krs, CoinBigIndex kre, double &maxupp, double &maxdnp) { bool posinf = false ; bool neginf = false ; double maxup = 0.0 ; double maxdown = 0.0 ; /* Walk the row and add up the upper and lower bounds on the variables. Once both maxup and maxdown have an infinity contribution the row cannot be shown to be useless or forcing, so break as soon as that's detected. */ for (CoinBigIndex kk = krs ; kk < kre ; kk++) { const int col = hcol[kk] ; const double coeff = els[kk] ; const double lb = clo[col] ; const double ub = cup[col] ; if (coeff > 0.0) { if (PRESOLVE_INF <= ub) { posinf = true ; if (neginf) break ; } else { maxup += ub*coeff ; } if (lb <= -PRESOLVE_INF) { neginf = true ; if (posinf) break ; } else { maxdown += lb*coeff ; } } else { if (PRESOLVE_INF <= ub) { neginf = true ; if (posinf) break ; } else { maxdown += ub*coeff ; } if (lb <= -PRESOLVE_INF) { posinf = true ; if (neginf) break ; } else { maxup += lb*coeff ; } } } maxupp = (posinf)?PRESOLVE_INF:maxup ; maxdnp = (neginf)?-PRESOLVE_INF:maxdown ; } } // end file-local namespace const char *forcing_constraint_action::name() const { return ("forcing_constraint_action") ; } /* It may be the case that the bounds on the variables in a constraint are such that no matter what feasible value the variables take, the constraint cannot be violated. In this case we can drop the constraint as useless. On the other hand, it may be that the only way to satisfy a constraint is to jam all the variables in the constraint to one of their bounds, fixing the variables. This is a forcing constraint, the primary target of this transform. Detection of both useless and forcing constraints requires calculation of bounds on the row activity (often referred to as lhs bounds, from the common form ax <= b). This routine will remember useless constraints as it finds them and invoke useless_constraint_action to deal with them. The transform applied here simply tightens the bounds on the variables. Other transforms will remove the fixed variables, leaving an empty row which is ultimately dropped. A reasonable question to ask is ``If a variable is already fixed, why do we need a record in the postsolve object?'' The answer is that in postsolve we'll be dealing with a column-major representation and we may need to scan the row (see postsolve comments). So it's useful to record all variables in the constraint. On the other hand, it's definitely harmful to ask remove_fixed_action to process a variable more than once (causes problems in remove_fixed_action::postsolve). Original comments: It looks like these checks could be performed in parallel, that is, the tests could be carried out for all rows in parallel, and then the rows deleted and columns tightened afterward. Obviously, this is true for useless rows. By doing it in parallel rather than sequentially, we may miss transformations due to variables that were fixed by forcing constraints, though. Note that both of these operations will cause problems if the variables in question really need to exceed their bounds in order to make the problem feasible. */ const CoinPresolveAction* forcing_constraint_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING int startEmptyRows = 0 ; int startEmptyColumns = 0 ; startEmptyRows = prob->countEmptyRows() ; startEmptyColumns = prob->countEmptyCols() ; # endif # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering forcing_constraint_action::presolve, considering " << prob->numberRowsToDo_ << " rows." << std::endl ; # endif presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if COIN_PRESOLVE_TUNING double startTime = 0.0 ; if (prob->tuning_) { startTime = CoinCpuTime() ; } # endif // Column solution and bounds double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *csol = prob->sol_ ; // Row-major representation const CoinBigIndex *mrstrt = prob->mrstrt_ ; const double *rowels = prob->rowels_ ; const int *hcol = prob->hcol_ ; const int *hinrow = prob->hinrow_ ; const int nrows = prob->nrows_ ; const double *rlo = prob->rlo_ ; const double *rup = prob->rup_ ; const double tol = ZTOLDP ; const double inftol = prob->feasibilityTolerance_ ; // for redundant rows be safe const double inftol2 = 0.01*prob->feasibilityTolerance_ ; const int ncols = prob->ncols_ ; int *fixed_cols = new int[ncols] ; int nfixed_cols = 0 ; action *actions = new action [nrows] ; int nactions = 0 ; int *useless_rows = new int[nrows] ; int nuseless_rows = 0 ; const int numberLook = prob->numberRowsToDo_ ; int *look = prob->rowsToDo_ ; bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; /* Open a loop to scan the constraints of interest. There must be variables left in the row. */ for (int iLook = 0 ; iLook < numberLook ; iLook++) { int irow = look[iLook] ; if (hinrow[irow] <= 0) continue ; const CoinBigIndex krs = mrstrt[irow] ; const CoinBigIndex kre = krs+hinrow[irow] ; /* Calculate upper and lower bounds on the row activity based on upper and lower bounds on the variables. If these are finite and incompatible with the given row bounds, we have infeasibility. */ double maxup, maxdown ; implied_row_bounds(rowels,clo,cup,hcol,krs,kre,maxup,maxdown) ; # if PRESOLVE_DEBUG > 2 std::cout << " considering row " << irow << ", rlo " << rlo[irow] << " LB " << maxdown << " UB " << maxup << " rup " << rup[irow] ; # endif /* If the maximum lhs value is less than L(i) or the minimum lhs value is greater than U(i), we're infeasible. */ if (maxup < PRESOLVE_INF && maxup+inftol < rlo[irow] && !fixInfeasibility) { CoinMessageHandler *hdlr = prob->messageHandler() ; prob->status_|= 1 ; hdlr->message(COIN_PRESOLVE_ROWINFEAS,prob->messages()) << irow << rlo[irow] << rup[irow] << CoinMessageEol ; # if PRESOLVE_DEBUG > 2 std::cout << "; infeasible." << std::endl ; # endif break ; } if (-PRESOLVE_INF < maxdown && rup[irow] < maxdown-inftol && !fixInfeasibility) { CoinMessageHandler *hdlr = prob->messageHandler() ; prob->status_|= 1 ; hdlr->message(COIN_PRESOLVE_ROWINFEAS,prob->messages()) << irow << rlo[irow] << rup[irow] << CoinMessageEol ; # if PRESOLVE_DEBUG > 2 std::cout << "; infeasible." << std::endl ; # endif break ; } /* We've dealt with prima facie infeasibility. Now check if the constraint is trivially satisfied. If so, add it to the list of useless rows and move on. The reason we require maxdown and maxup to be finite if the row bound is finite is to guard against some subsequent transform changing a column bound from infinite to finite. Once finite, bounds continue to tighten, so we're safe. */ /* Test changed to use +small tolerance rather than -tolerance as test fails often */ if (((rlo[irow] <= -PRESOLVE_INF) || (-PRESOLVE_INF < maxdown && rlo[irow] <= maxdown+inftol2)) && ((rup[irow] >= PRESOLVE_INF) || (maxup < PRESOLVE_INF && rup[irow] >= maxup-inftol2))) { // check none prohibited if (prob->anyProhibited_) { bool anyProhibited=false; for (int k=krs; kcolProhibited(jcol)) { anyProhibited=true; break; } } if (anyProhibited) continue; // skip row } useless_rows[nuseless_rows++] = irow ; # if PRESOLVE_DEBUG > 2 std::cout << "; useless." << std::endl ; # endif continue ; } /* Is it the case that we can just barely attain L(i) or U(i)? If so, we have a forcing constraint. As explained above, we need maxup and maxdown to be finite in order for the test to be valid. */ const bool tightAtLower = ((maxup < PRESOLVE_INF) && (fabs(rlo[irow]-maxup) < tol)) ; const bool tightAtUpper = ((-PRESOLVE_INF < maxdown) && (fabs(rup[irow]-maxdown) < tol)) ; # if PRESOLVE_DEBUG > 2 if (tightAtLower || tightAtUpper) std::cout << "; forcing." ; std::cout << std::endl ; # endif if (!(tightAtLower || tightAtUpper)) continue ; // check none prohibited if (prob->anyProhibited_) { bool anyProhibited=false; for (int k=krs; kcolProhibited(jcol)) { anyProhibited=true; break; } } if (anyProhibited) continue; // skip row } /* We have a forcing constraint. Get down to the business of fixing the variables at the appropriate bound. We need to remember the original value of the bound we're tightening. Allocate a pair of arrays the size of the row. Load variables fixed at l from the start, variables fixed at u from the end. Add the column to the list of columns to be processed further. */ double *bounds = new double[hinrow[irow]] ; int *rowcols = new int[hinrow[irow]] ; CoinBigIndex lk = krs ; CoinBigIndex uk = kre ; for (CoinBigIndex k = krs ; k < kre ; k++) { const int j = hcol[k] ; const double lj = clo[j] ; const double uj = cup[j] ; const double coeff = rowels[k] ; PRESOLVEASSERT(fabs(coeff) > ZTOLDP) ; /* If maxup is tight at L(i), then we want to force variables x to the bound that produced maxup: u if a > 0, l if a < 0. If maxdown is tight at U(i), it'll be just the opposite. */ if (tightAtLower == (coeff > 0.0)) { --uk ; bounds[uk-krs] = lj ; rowcols[uk-krs] = j ; if (csol != 0) { csol[j] = uj ; } clo[j] = uj ; } else { bounds[lk-krs] = uj ; rowcols[lk-krs] = j ; ++lk ; if (csol != 0) { csol[j] = lj ; } cup[j] = lj ; } /* Only add a column to the list of fixed columns the first time it's fixed. */ if (lj != uj) { fixed_cols[nfixed_cols++] = j ; prob->addCol(j) ; } } PRESOLVEASSERT(uk == lk) ; PRESOLVE_DETAIL_PRINT(printf("pre_forcing %dR E\n",irow)) ; # if PRESOLVE_DEBUG > 1 std::cout << "FORCING: row(" << irow << "), " << (kre-krs) << " variables." << std::endl ; # endif /* Done with this row. Remember the changes in a postsolve action. */ action *f = &actions[nactions] ; nactions++ ; f->row = irow ; f->nlo = lk-krs ; f->nup = kre-uk ; f->rowcols = rowcols ; f->bounds = bounds ; } /* Done processing the rows of interest. No sense doing any additional work unless we're feasible. */ if (prob->status_ == 0) { # if PRESOLVE_DEBUG > 0 std::cout << "FORCING: " << nactions << " forcing, " << nuseless_rows << " useless." << std::endl ; # endif /* Trim the actions array to size and create a postsolve object. */ if (nactions) { next = new forcing_constraint_action(nactions, CoinCopyOfArray(actions,nactions),next) ; } /* Hand off the job of dealing with the useless rows to a specialist. */ if (nuseless_rows) { next = useless_constraint_action::presolve(prob, useless_rows,nuseless_rows,next) ; } /* Hand off the job of dealing with the fixed columns to a specialist. Note that there *cannot* be duplicates in this list or we'll get in trouble `unfixing' a column multiple times. The code above now adds a variable to fixed_cols only if it's not already fixed. If that ever changes, the disabled code (sort, unique) will need to be reenabled. */ if (nfixed_cols) { if (false && nfixed_cols > 1) { std::sort(fixed_cols,fixed_cols+nfixed_cols) ; int *end = std::unique(fixed_cols,fixed_cols+nfixed_cols) ; nfixed_cols = static_cast(end-fixed_cols) ; } next = remove_fixed_action::presolve(prob,fixed_cols,nfixed_cols,next) ; } } else { // delete arrays for (int i=0;ituning_) double thisTime = CoinCpuTime() ; # endif # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving forcing_constraint_action::presolve: removed " << droppedRows << " rows, " << droppedColumns << " columns" ; # if COIN_PRESOLVE_TUNING > 0 if (prob->tuning_) std::cout << " in " << (thisTime-prob->startTime_) << "s" ; # endif std::cout << "." << std::endl ; # endif return (next) ; } /* We're here to undo the bound changes that were put in place for forcing constraints. This is a bit trickier than it appears. Assume we are working with constraint r. The situation on arrival is that constraint r exists and is fully populated with fixed variables, all of which are nonbasic. Even though the constraint is tight, the logical s(r) is basic and the dual y(r) is zero. We may need to change that if a bound is relaxed to infinity on some variable x(t), making x(t)'s current nonbasic status untenable. We'll need to make s(r) nonbasic so that y(r) can be nonzero. Then we can make x(t) basic and use y(r) to force cbar(t) to zero. The code below will choose the variable x(t) whose reduced cost cbar(t) is most wrong and adjust y(r) to drive cbar(t) to zero using cbar(t) = c(t) - SUM{i\r} y(i) a(it) - y(r)a(rt) cbar(t) = cbar(t\r) - y(r)a(rt) Setting cbar(t) to zero, y(r) = cbar(t\r)/a(rt) We will need to scan row r, correcting cbar(j) for all x(j) entangled with the row. We may need to change the nonbasic status of x(j) if the adjustment causes cbar(j) to change sign. */ void forcing_constraint_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_ ; const int nactions = nactions_ ; const double *colels = prob->colels_ ; const int *hrow = prob->hrow_ ; const CoinBigIndex *mcstrt = prob->mcstrt_ ; const int *hincol = prob->hincol_ ; const int *link = prob->link_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *rcosts = prob->rcosts_ ; double *acts = prob->acts_ ; double *rowduals = prob->rowduals_ ; const double ztoldj = prob->ztoldj_ ; const double ztolzb = prob->ztolzb_ ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 const double *sol = prob->sol_ ; # if PRESOLVE_DEBUG > 0 std::cout << "Entering forcing_constraint_action::postsolve, " << nactions << " constraints to process." << std::endl ; # endif presolve_check_threads(prob) ; presolve_check_free_list(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif /* Open a loop to process the actions. One action per constraint. */ for (const action *f = &actions[nactions-1] ; actions <= f ; f--) { const int irow = f->row ; const int nlo = f->nlo ; const int nup = f->nup ; const int ninrow = nlo+nup ; const int *rowcols = f->rowcols ; const double *bounds = f->bounds ; # if PRESOLVE_DEBUG > 1 std::cout << " Restoring constraint " << irow << ", " << ninrow << " variables." << std::endl ; # endif PRESOLVEASSERT(prob->getRowStatus(irow) == CoinPrePostsolveMatrix::basic) ; PRESOLVEASSERT(rowduals[irow] == 0.0) ; /* Process variables where the upper bound is relaxed. * If the variable is basic, we should leave the status unchanged. Relaxing the bound cannot make nonbasic status feasible. * The bound change may be a noop, in which nothing needs to be done. * Otherwise, the status should be set to NBLB. */ bool dualfeas = true ; for (int k = 0 ; k < nlo ; k++) { const int jcol = rowcols[k] ; PRESOLVEASSERT(fabs(sol[jcol]-clo[jcol]) <= ztolzb) ; const double cbarj = rcosts[jcol] ; const double olduj = cup[jcol] ; const double newuj = bounds[k] ; const bool change = (fabs(newuj-olduj) > ztolzb) ; # if PRESOLVE_DEBUG > 2 std::cout << " x(" << jcol << ") " << prob->columnStatusString(jcol) << " cbar = " << cbarj << ", lb = " << clo[jcol] << ", ub = " << olduj << " -> " << newuj ; # endif if (change && prob->getColumnStatus(jcol) != CoinPrePostsolveMatrix::basic) { prob->setColumnStatus(jcol,CoinPrePostsolveMatrix::atLowerBound) ; if (cbarj < -ztoldj || clo[jcol] <= -COIN_DBL_MAX) dualfeas = false ; } cup[jcol] = bounds[k] ; # if PRESOLVE_DEBUG > 2 std::cout << " -> " << prob->columnStatusString(jcol) << "." << std::endl ; # endif } /* Process variables where the lower bound is relaxed. The comments above apply. */ for (int k = nlo ; k < ninrow ; k++) { const int jcol = rowcols[k] ; PRESOLVEASSERT(fabs(sol[jcol]-cup[jcol]) <= ztolzb) ; const double cbarj = rcosts[jcol] ; const double oldlj = clo[jcol] ; const double newlj = bounds[k] ; const bool change = (fabs(newlj-oldlj) > ztolzb) ; # if PRESOLVE_DEBUG > 2 std::cout << " x(" << jcol << ") " << prob->columnStatusString(jcol) << " cbar = " << cbarj << ", ub = " << cup[jcol] << ", lb = " << oldlj << " -> " << newlj ; # endif if (change && prob->getColumnStatus(jcol) != CoinPrePostsolveMatrix::basic) { prob->setColumnStatus(jcol,CoinPrePostsolveMatrix::atUpperBound) ; if (cbarj > ztoldj || cup[jcol] >= COIN_DBL_MAX) dualfeas = false ; } clo[jcol] = bounds[k] ; # if PRESOLVE_DEBUG > 2 std::cout << " -> " << prob->columnStatusString(jcol) << "." << std::endl ; # endif } /* The reduced costs and status for the columns may or may not be ok for the relaxed column bounds. If not, find the variable x most out-of-whack with respect to reduced cost and calculate the value of y required to reduce cbar to zero. */ if (dualfeas == false) { int joow = -1 ; double yi = 0.0 ; for (int k = 0 ; k < ninrow ; k++) { int jcol = rowcols[k] ; CoinBigIndex kk = presolve_find_row2(irow,mcstrt[jcol], hincol[jcol],hrow,link) ; const double &cbarj = rcosts[jcol] ; const CoinPrePostsolveMatrix::Status statj = prob->getColumnStatus(jcol) ; if ((cbarj < -ztoldj && statj != CoinPrePostsolveMatrix::atUpperBound) || (cbarj > ztoldj && statj != CoinPrePostsolveMatrix::atLowerBound)) { double yi_j = cbarj/colels[kk] ; if (fabs(yi_j) > fabs(yi)) { joow = jcol ; yi = yi_j ; } # if PRESOLVE_DEBUG > 3 std::cout << " oow: x(" << jcol << ") " << prob->columnStatusString(jcol) << " cbar " << cbarj << " aij " << colels[kk] << " corr " << yi_j << "." << std::endl ; # endif } } assert(joow != -1) ; /* Make x basic and set the row status according to whether we're tight at the lower or upper bound. Keep in mind the convention that a <= constraint has a slack 0 <= s <= infty, while a >= constraint has a surplus -infty <= s <= 0. */ # if PRESOLVE_DEBUG > 1 std::cout << " Adjusting row dual; x(" << joow << ") " << prob->columnStatusString(joow) << " -> " << statusName(CoinPrePostsolveMatrix::basic) << ", y = 0.0 -> " << yi << "." << std::endl ; # endif prob->setColumnStatus(joow,CoinPrePostsolveMatrix::basic) ; if (acts[irow]-rlo[irow] < rup[irow]-acts[irow]) prob->setRowStatus(irow,CoinPrePostsolveMatrix::atUpperBound) ; else prob->setRowStatus(irow,CoinPrePostsolveMatrix::atLowerBound) ; rowduals[irow] = yi ; # if PRESOLVE_DEBUG > 1 std::cout << " Row status " << prob->rowStatusString(irow) << ", lb = " << rlo[irow] << ", ax = " << acts[irow] << ", ub = " << rup[irow] << "." << std::endl ; # endif /* Now correct the reduced costs for other variables in the row. This may cause a reduced cost to change sign, in which case we need to change status. The code implicitly assumes that if it's necessary to change the status of a variable because the reduced cost has changed sign, then it will be possible to do it. I'm not sure I could prove that, however. -- lh, 121108 -- */ for (int k = 0 ; k < ninrow ; k++) { int jcol = rowcols[k] ; CoinBigIndex kk = presolve_find_row2(irow,mcstrt[jcol], hincol[jcol],hrow,link) ; const double old_cbarj = rcosts[jcol] ; rcosts[jcol] -= yi*colels[kk] ; const double new_cbarj = rcosts[jcol] ; if ((old_cbarj < 0) != (new_cbarj < 0)) { if (new_cbarj < -ztoldj && cup[jcol] < COIN_DBL_MAX) prob->setColumnStatus(jcol,CoinPrePostsolveMatrix::atUpperBound) ; else if (new_cbarj > ztoldj && clo[jcol] > -COIN_DBL_MAX) prob->setColumnStatus(jcol,CoinPrePostsolveMatrix::atLowerBound) ; } # if PRESOLVE_DEBUG > 3 const CoinPrePostsolveMatrix::Status statj = prob->getColumnStatus(jcol) ; std::cout << " corr: x(" << jcol << ") " << prob->columnStatusString(jcol) << " cbar " << new_cbarj ; if ((new_cbarj < -ztoldj && statj != CoinPrePostsolveMatrix::atUpperBound) || (new_cbarj > ztoldj && statj != CoinPrePostsolveMatrix::atLowerBound) || (statj == CoinPrePostsolveMatrix::basic && fabs(new_cbarj) > ztoldj)) std::cout << " error!" << std::endl ; else std::cout << "." << std::endl ; # endif } } # if PRESOLVE_DEBUG > 0 presolve_check_nbasic(prob) ; # endif } # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving forcing_constraint_action::postsolve." << std::endl ; # endif # endif } forcing_constraint_action::~forcing_constraint_action() { int i ; for (i=0;i
  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient */ void CoinSnapshot::loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, bool makeRowCopy) { // Keep scalars (apart from objective value etc) gutsOfDestructor(3+8); numRows_ = matrix.getNumRows(); numCols_ = matrix.getNumCols(); numElements_ = matrix.getNumElements(); owned_.matrixByCol = 1; matrixByCol_ = new CoinPackedMatrix(matrix); if (makeRowCopy) { owned_.matrixByRow = 1; CoinPackedMatrix * matrixByRow = new CoinPackedMatrix(matrix); matrixByRow->reverseOrdering(); matrixByRow_ = matrixByRow; } colLower_ = CoinCopyOfArray(collb,numCols_,0.0); colUpper_ = CoinCopyOfArray(colub,numCols_,infinity_); objCoefficients_ = CoinCopyOfArray(obj,numCols_,0.0); rowLower_ = CoinCopyOfArray(rowlb,numRows_,-infinity_); rowUpper_ = CoinCopyOfArray(rowub,numRows_,infinity_); // do rhs as well createRightHandSide(); } // Set pointer to array[getNumCols()] of column lower bounds void CoinSnapshot::setColLower(const double * array, bool copyIn) { if (owned_.colLower) delete [] colLower_; if (copyIn) { owned_.colLower=1; colLower_ = CoinCopyOfArray(array,numCols_); } else { owned_.colLower=0; colLower_ = array; } } // Set pointer to array[getNumCols()] of column upper bounds void CoinSnapshot::setColUpper(const double * array, bool copyIn) { if (owned_.colUpper) delete [] colUpper_; if (copyIn) { owned_.colUpper=1; colUpper_ = CoinCopyOfArray(array,numCols_); } else { owned_.colUpper=0; colUpper_ = array; } } // Set pointer to array[getNumRows()] of row lower bounds void CoinSnapshot::setRowLower(const double * array, bool copyIn) { if (owned_.rowLower) delete [] rowLower_; if (copyIn) { owned_.rowLower=1; rowLower_ = CoinCopyOfArray(array,numRows_); } else { owned_.rowLower=0; rowLower_ = array; } } // Set pointer to array[getNumRows()] of row upper bounds void CoinSnapshot::setRowUpper(const double * array, bool copyIn) { if (owned_.rowUpper) delete [] rowUpper_; if (copyIn) { owned_.rowUpper=1; rowUpper_ = CoinCopyOfArray(array,numRows_); } else { owned_.rowUpper=0; rowUpper_ = array; } } /* Set pointer to array[getNumRows()] of rhs side values This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i] */ void CoinSnapshot::setRightHandSide(const double * array, bool copyIn) { if (owned_.rightHandSide) delete [] rightHandSide_; if (copyIn) { owned_.rightHandSide=1; rightHandSide_ = CoinCopyOfArray(array,numRows_); } else { owned_.rightHandSide=0; rightHandSide_ = array; } } /* Create array[getNumRows()] of rhs side values This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i] */ void CoinSnapshot::createRightHandSide() { if (owned_.rightHandSide) delete [] rightHandSide_; owned_.rightHandSide=1; assert (rowUpper_); assert (rowLower_); double * rightHandSide = CoinCopyOfArray(rowUpper_,numRows_); for (int i=0;igetNumCols()==numCols_); assert (matrixByRow_->getNumRows()==numRows_); } // Create row-wise copy from MatrixByCol void CoinSnapshot::createMatrixByRow() { if (owned_.matrixByRow) delete matrixByRow_; assert (matrixByCol_); owned_.matrixByRow = 1; CoinPackedMatrix * matrixByRow = new CoinPackedMatrix(*matrixByCol_); matrixByRow->reverseOrdering(); matrixByRow_ = matrixByRow; } // Set pointer to column-wise copy of current matrix void CoinSnapshot::setMatrixByCol(const CoinPackedMatrix * matrix, bool copyIn) { if (owned_.matrixByCol) delete matrixByCol_; if (copyIn) { owned_.matrixByCol=1; matrixByCol_ = new CoinPackedMatrix(*matrix); } else { owned_.matrixByCol=0; matrixByCol_ = matrix; } assert (matrixByCol_->getNumCols()==numCols_); assert (matrixByCol_->getNumRows()==numRows_); } // Set pointer to row-wise copy of "original" matrix void CoinSnapshot::setOriginalMatrixByRow(const CoinPackedMatrix * matrix, bool copyIn) { if (owned_.originalMatrixByRow) delete originalMatrixByRow_; if (copyIn) { owned_.originalMatrixByRow=1; originalMatrixByRow_ = new CoinPackedMatrix(*matrix); } else { owned_.originalMatrixByRow=0; originalMatrixByRow_ = matrix; } assert (matrixByRow_->getNumCols()==numCols_); } // Set pointer to column-wise copy of "original" matrix void CoinSnapshot::setOriginalMatrixByCol(const CoinPackedMatrix * matrix, bool copyIn) { if (owned_.originalMatrixByCol) delete originalMatrixByCol_; if (copyIn) { owned_.originalMatrixByCol=1; originalMatrixByCol_ = new CoinPackedMatrix(*matrix); } else { owned_.originalMatrixByCol=0; originalMatrixByCol_ = matrix; } assert (matrixByCol_->getNumCols()==numCols_); } // Set pointer to array[getNumCols()] of primal variable values void CoinSnapshot::setColSolution(const double * array, bool copyIn) { if (owned_.colSolution) delete [] colSolution_; if (copyIn) { owned_.colSolution=1; colSolution_ = CoinCopyOfArray(array,numCols_); } else { owned_.colSolution=0; colSolution_ = array; } } // Set pointer to array[getNumRows()] of dual variable values void CoinSnapshot::setRowPrice(const double * array, bool copyIn) { if (owned_.rowPrice) delete [] rowPrice_; if (copyIn) { owned_.rowPrice=1; rowPrice_ = CoinCopyOfArray(array,numRows_); } else { owned_.rowPrice=0; rowPrice_ = array; } } // Set a pointer to array[getNumCols()] of reduced costs void CoinSnapshot::setReducedCost(const double * array, bool copyIn) { if (owned_.reducedCost) delete [] reducedCost_; if (copyIn) { owned_.reducedCost=1; reducedCost_ = CoinCopyOfArray(array,numCols_); } else { owned_.reducedCost=0; reducedCost_ = array; } } // Set pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector). void CoinSnapshot::setRowActivity(const double * array, bool copyIn) { if (owned_.rowActivity) delete [] rowActivity_; if (copyIn) { owned_.rowActivity=1; rowActivity_ = CoinCopyOfArray(array,numRows_); } else { owned_.rowActivity=0; rowActivity_ = array; } } // Set pointer to array[getNumCols()] of primal variable values which should not be separated (for debug) void CoinSnapshot::setDoNotSeparateThis(const double * array, bool copyIn) { if (owned_.doNotSeparateThis) delete [] doNotSeparateThis_; if (copyIn) { owned_.doNotSeparateThis=1; doNotSeparateThis_ = CoinCopyOfArray(array,numCols_); } else { owned_.doNotSeparateThis=0; doNotSeparateThis_ = array; } } CoinMP-1.8.3/CoinUtils/src/CoinStructuredModel.hpp0000644000175000017500000002067712312310414020466 0ustar renerene/* $Id: CoinStructuredModel.hpp 1691 2014-03-19 12:43:56Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinStructuredModel_H #define CoinStructuredModel_H #include "CoinModel.hpp" #include /** This is a model which is made up of Coin(Structured)Model blocks. */ typedef struct CoinModelInfo2 { int rowBlock; // Which row block int columnBlock; // Which column block char matrix; // nonzero if matrix exists char rhs; // nonzero if non default rhs exists char rowName; // nonzero if row names exists char integer; // nonzero if integer information exists char bounds; // nonzero if non default bounds/objective exists char columnName; // nonzero if column names exists CoinModelInfo2() : rowBlock(0), columnBlock(0), matrix(0), rhs(0), rowName(0), integer(0), bounds(0), columnName(0) {} } CoinModelBlockInfo; class CoinStructuredModel : public CoinBaseModel { public: /**@name Useful methods for building model */ //@{ /** add a block from a CoinModel using names given as parameters returns number of errors (e.g. both have objectives but not same) */ int addBlock(const std::string & rowBlock, const std::string & columnBlock, const CoinBaseModel & block); /** add a block from a CoinModel with names in model returns number of errors (e.g. both have objectives but not same) */ int addBlock(const CoinBaseModel & block); /** add a block from a CoinModel using names given as parameters returns number of errors (e.g. both have objectives but not same) This passes in block - structured model takes ownership */ int addBlock(const std::string & rowBlock, const std::string & columnBlock, CoinBaseModel * block); /** add a block using names */ int addBlock(const std::string & rowBlock, const std::string & columnBlock, const CoinPackedMatrix & matrix, const double * rowLower, const double * rowUpper, const double * columnLower, const double * columnUpper, const double * objective); /** Write the problem in MPS format to a file with the given filename. \param compression can be set to three values to indicate what kind of file should be written
    • 0: plain text (default)
    • 1: gzip compressed (.gz is appended to \c filename)
    • 2: bzip2 compressed (.bz2 is appended to \c filename) (TODO)
    If the library was not compiled with the requested compression then writeMps falls back to writing a plain text file. \param formatType specifies the precision to used for values in the MPS file
    • 0: normal precision (default)
    • 1: extra accuracy
    • 2: IEEE hex
    \param numberAcross specifies whether 1 or 2 (default) values should be specified on every data line in the MPS file. not const as may change model e.g. fill in default bounds */ int writeMps(const char *filename, int compression = 0, int formatType = 0, int numberAcross = 2, bool keepStrings=false) ; /// Read SMPS model int readSmps(const char *filename, bool keepNames = false, bool ignoreErrors = false); /** Decompose a CoinModel 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure */ int decompose(const CoinModel &model,int type, int maxBlocks=50, const char ** starts=NULL); /** Decompose a model specified as arrays + CoinPackedMatrix 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure */ int decompose(const CoinPackedMatrix & matrix, const double * rowLower, const double * rowUpper, const double * columnLower, const double * columnUpper, const double * objective, int type,int maxBlocks=50, int * starts=NULL, double objectiveOffset=0.0); //@} /**@name For getting information */ //@{ /// Return number of row blocks inline int numberRowBlocks() const { return numberRowBlocks_;} /// Return number of column blocks inline int numberColumnBlocks() const { return numberColumnBlocks_;} /// Return number of elementBlocks inline CoinBigIndex numberElementBlocks() const { return numberElementBlocks_;} /// Return number of elements CoinBigIndex numberElements() const; /// Return the i'th row block name inline const std::string & getRowBlock(int i) const { return rowBlockNames_[i];} /// Set i'th row block name inline void setRowBlock(int i,const std::string &name) { rowBlockNames_[i] = name;} /// Add or check a row block name and number of rows int addRowBlock(int numberRows,const std::string &name) ; /// Return a row block index given a row block name int rowBlock(const std::string &name) const; /// Return i'th the column block name inline const std::string & getColumnBlock(int i) const { return columnBlockNames_[i];} /// Set i'th column block name inline void setColumnBlock(int i,const std::string &name) { columnBlockNames_[i] = name;} /// Add or check a column block name and number of columns int addColumnBlock(int numberColumns,const std::string &name) ; /// Return a column block index given a column block name int columnBlock(const std::string &name) const; /// Return i'th block type inline const CoinModelBlockInfo & blockType(int i) const { return blockType_[i];} /// Return i'th block inline CoinBaseModel * block(int i) const { return blocks_[i];} /// Return block corresponding to row and column const CoinBaseModel * block(int row,int column) const; /// Return i'th block as CoinModel (or NULL) CoinModel * coinBlock(int i) const; /// Return block corresponding to row and column as CoinModel const CoinBaseModel * coinBlock(int row,int column) const; /// Return block number corresponding to row and column int blockIndex(int row,int column) const; /** Return model as a CoinModel block and fill in info structure and update counts */ CoinModel * coinModelBlock(CoinModelBlockInfo & info) ; /// Sets given block into coinModelBlocks_ void setCoinModel(CoinModel * block, int iBlock); /// Refresh info in blockType_ void refresh(int iBlock); /** Fill pointers corresponding to row and column */ CoinModelBlockInfo block(int row,int column, const double * & rowLower, const double * & rowUpper, const double * & columnLower, const double * & columnUpper, const double * & objective) const; /// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore inline double optimizationDirection() const { return optimizationDirection_; } /// Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore inline void setOptimizationDirection(double value) { optimizationDirection_=value;} //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ CoinStructuredModel(); /** Read a problem in MPS format from the given filename. May try and decompose */ CoinStructuredModel(const char *fileName,int decompose=0, int maxBlocks=50); /** Destructor */ virtual ~CoinStructuredModel(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ CoinStructuredModel(const CoinStructuredModel&); /// = CoinStructuredModel& operator=(const CoinStructuredModel&); /// Clone virtual CoinBaseModel * clone() const; //@} private: /** Fill in info structure and update counts Returns number of inconsistencies on border */ int fillInfo(CoinModelBlockInfo & info,const CoinModel * block); /** Fill in info structure and update counts */ void fillInfo(CoinModelBlockInfo & info,const CoinStructuredModel * block); /**@name Data members */ //@{ /// Current number of row blocks int numberRowBlocks_; /// Current number of column blocks int numberColumnBlocks_; /// Current number of element blocks int numberElementBlocks_; /// Maximum number of element blocks int maximumElementBlocks_; /// Rowblock name std::vector rowBlockNames_; /// Columnblock name std::vector columnBlockNames_; /// Blocks CoinBaseModel ** blocks_; /// CoinModel copies of blocks or NULL if original CoinModel CoinModel ** coinModelBlocks_; /// Which parts of model are set in block CoinModelBlockInfo * blockType_; //@} }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveSubst.cpp0000644000175000017500000010607512442012653020161 0ustar renerene/* $Id: CoinPresolveSubst.cpp 1761 2014-12-10 09:43:07Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPresolveMatrix.hpp" #include "CoinPresolveEmpty.hpp" // for DROP_COL/DROP_ROW #include "CoinPresolvePsdebug.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolveZeros.hpp" #include "CoinPresolveSubst.hpp" #include "CoinMessage.hpp" #include "CoinHelperFunctions.hpp" #include "CoinSort.hpp" #include "CoinError.hpp" #include "CoinFinite.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif namespace { // begin unnamed file-local namespace #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 /* Special-purpose debug utility to look for coefficient a(i,j) in column j. Intended to be inserted as needed and removed when debugging is complete. */ void dbg_find_elem (const CoinPostsolveMatrix *postMtx, int i, int j) { const CoinBigIndex kcs = postMtx->mcstrt_[j] ; const CoinBigIndex lenj = postMtx->hincol_[j] ; CoinBigIndex krow = presolve_find_row3(i,kcs,lenj,postMtx->hrow_,postMtx->link_) ; if (krow >= 0) { std::cout << " row " << i << " present in column " << j << ", a(" << i << "," << j << ") = " << postMtx->colels_[krow] << std::endl ; } else { std::cout << " row " << i << " not present in column " << j << std::endl ; } } #endif /* Add coeff_factor*rowy to rowx, for coefficients and row bounds. In the terminology used in ::presolve, rowy is the target row, and rowx is an entangled row (entangled with the target column). If a coefficient is < kill_ratio * coeff_factor then kill it Column indices in irowx and iroy must be sorted in increasing order. Normally one might do that here, but this routine is only called from subst_constraint_action::presolve and rowy will be the same over several calls. More efficient to sort in sca::presolve. Given we're called from sca::presolve, rowx will be an equality, with finite rlo[rowx] = rup[rowx] = rhsy. Fill-in in rowx has the potential to trigger compaction of the row-major bulk store. *All* indices into the bulk store are *not* constant if this happens. Returns false if the addition completes without error, true if there's a problem. */ static bool add_row (CoinBigIndex *mrstrt, double *rlo, double *acts, double *rup, double *rowels, int *hcol, int *hinrow, presolvehlink *rlink, int nrows, double coeff_factor, double kill_ratio, int irowx, int irowy, int *x_to_y) { CoinBigIndex krsy = mrstrt[irowy] ; CoinBigIndex krey = krsy+hinrow[irowy] ; CoinBigIndex krsx = mrstrt[irowx] ; CoinBigIndex krex = krsx+hinrow[irowx] ; # if PRESOLVE_DEBUG > 3 std::cout << " ADD_ROW: adding (" << coeff_factor << ")*(row " << irowy << ") to row " << irowx << "; len y = " << hinrow[irowy] << ", len x = " << hinrow[irowx] << "." << std::endl ; # endif /* Do the simple part first: adjust the row lower and upper bounds, but only if they're finite. */ const double rhsy = rlo[irowy] ; const double rhscorr = rhsy*coeff_factor ; const double tolerance = kill_ratio*coeff_factor; if (-PRESOLVE_INF < rlo[irowx]) { const double newrlo = rlo[irowx]+rhscorr ; # if PRESOLVE_DEBUG > 3 if (rhscorr) std::cout << " rlo(" << irowx << ") " << rlo[irowx] << " -> " << newrlo << "." << std::endl ; # endif rlo[irowx] = newrlo ; } if (rup[irowx] < PRESOLVE_INF) { const double newrup = rup[irowx]+rhscorr ; # if PRESOLVE_DEBUG > 3 if (rhscorr) std::cout << " rup(" << irowx << ") " << rup[irowx] << " -> " << newrup << "." << std::endl ; # endif rup[irowx] = newrup ; } if (acts) { acts[irowx] += rhscorr ; } /* On to the main show. Open a loop to walk row y. krowx is keeping track of where we're at in row x. To find column j in row x, start from the current position and search forward, but no further than the last original coefficient of row x (fill will be added after this element). */ CoinBigIndex krowx = krsx ; CoinBigIndex krex0 = krex ; int x_to_y_i = 0 ; # if PRESOLVE_DEBUG > 3 std::cout << " ycols:" ; # endif for (CoinBigIndex krowy = krsy ; krowy < krey ; krowy++) { int j = hcol[krowy] ; PRESOLVEASSERT(krex == krsx+hinrow[irowx]) ; while (krowx < krex0 && hcol[krowx] < j) krowx++ ; # if PRESOLVE_DEBUG > 3 std::cout << " a(" << irowx << "," << j << ") " ; # endif /* The easy case: coeff a(xj) already exists and all we need to is modify it. */ if (krowx < krex0 && hcol[krowx] == j) { double newcoeff = rowels[krowx]+rowels[krowy]*coeff_factor ; # if PRESOLVE_DEBUG > 3 std::cout << rowels[krowx] << " -> " << newcoeff << ";" ; # endif // kill small if (fabs(newcoeff) 3 std::cout << rowels[krex-1] << ";" ; # endif } } # if PRESOLVE_DEBUG > 3 std::cout << std::endl ; # endif return (false) ; } } // end unnamed file-local namespace const char *subst_constraint_action::name() const { return ("subst_constraint_action"); } /* This transform is called only from implied_free_action. See the comments at the head of CoinPresolveImpledFree.cpp for background. In addition to natural implied free singletons, implied_free_action will identify implied free variables that are not (yet) column singletons. This transform will process them. Suppose we have a variable x(t) and an equality r which satisfy the implied free condition (i.e., r imposes bounds on x(t) which are equal or better than the original column bounds). Then we can solve r for x(t) to get a substitution formula for x(t). We can use the substitution formula to eliminate x(t) from all other constraints where it is entangled. x(t) is now an implied free column singleton with equality r and we can remove x(t) and equality r from the constraint system. The paired parameter vectors implied_free and whichFree specify the indices for equality r and variable t, respectively. NOTE that these vectors are held in the first two blocks of usefulColumnInt_. Don't reuse them! Fill-in can cause a major vector to be moved to free space at the end of the bulk store. If there's not enough free space, this can trigger compaction of the entire bulk store. The upshot is that *all* major vector starts and ends are *not* constant over calls that could expand a major vector. Deletion, on the other hand, will never move a major vector (but it will move the end element into the hole left by the deleted element). */ const CoinPresolveAction *subst_constraint_action::presolve ( CoinPresolveMatrix *prob, const int *implied_free, const int *whichFree, int numberFree, const CoinPresolveAction *next, int maxLook) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering subst_constraint_action::presolve, fill level " << maxLook << ", " << numberFree << " candidates." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int startEmptyRows = 0 ; int startEmptyColumns = 0 ; startEmptyRows = prob->countEmptyRows() ; startEmptyColumns = prob->countEmptyCols() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0 ; if (prob->tuning_) startTime = CoinCpuTime() ; # endif # endif /* Unpack the row- and column-major representations. */ const int ncols = prob->ncols_ ; const int nrows = prob->nrows_ ; CoinBigIndex *rowStarts = prob->mrstrt_ ; int *rowLengths = prob->hinrow_ ; double *rowCoeffs = prob->rowels_ ; int *colIndices = prob->hcol_ ; presolvehlink *rlink = prob->rlink_ ; CoinBigIndex *colStarts = prob->mcstrt_ ; int *colLengths = prob->hincol_ ; double *colCoeffs = prob->colels_ ; int *rowIndices = prob->hrow_ ; presolvehlink *clink = prob->clink_ ; /* Row bounds and activity, objective. */ double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *acts = prob->acts_ ; double *cost = prob->cost_ ; const double tol = prob->feasibilityTolerance_ ; action *actions = new action [ncols] ; # ifdef ZEROFAULT CoinZeroN(reinterpret_cast(actions),ncols*sizeof(action)) ; # endif int nactions = 0 ; /* This array is used to hold the indices of columns involved in substitutions, where we have the potential for cancellation. At the end they'll be checked to eliminate any actual zeros that may result. At the end of processing of each target row, the column indices of the target row are copied into zerocols. NOTE that usefulColumnInt_ is already in use for parameters implied_free and whichFree when this routine is called from implied_free. */ int *zerocols = new int[ncols] ; int nzerocols = 0 ; int *x_to_y = new int[ncols] ; int *rowsUsed = &prob->usefulRowInt_[0] ; int nRowsUsed = 0 ; /* Open a loop to process the (equality r, implied free variable t) pairs in whichFree and implied_free. It can happen that removal of (row, natural singleton) pairs back in implied_free will reduce the length of column t. It can also happen that previous processing here has resulted in fillin or cancellation. So check again for column length and exclude natural singletons and overly dense columns. */ for (int iLook = 0 ; iLook < numberFree ; iLook++) { const int tgtcol = whichFree[iLook] ; const int tgtcol_len = colLengths[tgtcol] ; const int tgtrow = implied_free[iLook] ; const int tgtrow_len = rowLengths[tgtrow] ; assert(fabs(rlo[tgtrow]-rup[tgtrow]) < tol) ; if (colLengths[tgtcol] < 2 || colLengths[tgtcol] > maxLook) { # if PRESOLVE_DEBUG > 3 std::cout << " skipping eqn " << tgtrow << " x(" << tgtcol << "); length now " << colLengths[tgtcol] << "." << std::endl ; # endif continue ; } CoinBigIndex tgtcs = colStarts[tgtcol] ; CoinBigIndex tgtce = tgtcs+colLengths[tgtcol] ; /* A few checks to make sure that the candidate pair is still suitable. Processing candidates earlier in the list can eliminate coefficients. * Don't use this pair if any involved row i has become a row singleton or empty. * Don't use this pair if any involved row has been modified as part of the processing for a previous candidate pair on this call. * Don't use this pair if a(i,tgtcol) has become zero. The checks on a(i,tgtcol) seem superfluous but it's possible that implied_free identified two candidate pairs to eliminate the same column. If we've already processed one of them, we could be in trouble. */ double tgtcoeff = 0.0 ; bool dealBreaker = false ; for (CoinBigIndex kcol = tgtcs ; kcol < tgtce ; ++kcol) { const int i = rowIndices[kcol] ; if (rowLengths[i] < 2 || prob->rowUsed(i)) { dealBreaker = true ; break ; } const double aij = colCoeffs[kcol] ; if (fabs(aij) <= ZTOLDP2) { dealBreaker = true ; break ; } if (i == tgtrow) tgtcoeff = aij ; } if (dealBreaker == true) { # if PRESOLVE_DEBUG > 3 std::cout << " skipping eqn " << tgtrow << " x(" << tgtcol << "); deal breaker (1)." << std::endl ; # endif continue ; } /* Check for numerical stability.A large coeff_factor will inflate the coefficients in the substitution formula. */ dealBreaker = false ; for (CoinBigIndex kcol = tgtcs ; kcol < tgtce ; ++kcol) { const double coeff_factor = fabs(colCoeffs[kcol]/tgtcoeff) ; if (coeff_factor > 10.0) dealBreaker = true ; } /* Given enough target rows with sufficient overlap, there's an outside chance we could overflow zerocols. Unlikely to ever happen. */ if (!dealBreaker && nzerocols+rowLengths[tgtrow] >= ncols) dealBreaker = true ; if (dealBreaker == true) { # if PRESOLVE_DEBUG > 3 std::cout << " skipping eqn " << tgtrow << " x(" << tgtcol << "); deal breaker (2)." << std::endl ; # endif continue ; } /* If c(t) != 0, we will need to modify the objective coefficients and remember the original objective. */ const bool nonzero_cost = (fabs(cost[tgtcol]) > tol) ; double *costsx = (nonzero_cost?new double[rowLengths[tgtrow]]:0) ; # if PRESOLVE_DEBUG > 1 std::cout << " Eliminating row " << tgtrow << ", col " << tgtcol ; if (nonzero_cost) std::cout << ", cost " << cost[tgtcol] ; std::cout << "." << std::endl ; # endif /* Count up the total number of coefficients in entangled rows and mark them as contaminated. */ int ntotels = 0 ; for (CoinBigIndex kcol = tgtcs ; kcol < tgtce ; ++kcol) { const int i = rowIndices[kcol] ; ntotels += rowLengths[i] ; PRESOLVEASSERT(!prob->rowUsed(i)) ; prob->setRowUsed(i) ; rowsUsed[nRowsUsed++] = i ; } /* Create the postsolve object. Copy in all the affected rows. Take the opportunity to mark the entangled rows as changed and put them on the list of rows to process in the next round. coeffxs in particular holds the coefficients of the target column. */ action *ap = &actions[nactions++] ; ap->col = tgtcol ; ap->rowy = tgtrow ; PRESOLVE_DETAIL_PRINT(printf("pre_subst %dC %dR E\n",tgtcol,tgtrow)) ; ap->nincol = tgtcol_len ; ap->rows = new int[tgtcol_len] ; ap->rlos = new double[tgtcol_len] ; ap->rups = new double[tgtcol_len] ; ap->costsx = costsx ; ap->coeffxs = new double[tgtcol_len] ; ap->ninrowxs = new int[tgtcol_len] ; ap->rowcolsxs = new int[ntotels] ; ap->rowelsxs = new double[ntotels] ; ntotels = 0 ; for (CoinBigIndex kcol = tgtcs ; kcol < tgtce ; ++kcol) { const int ndx = kcol-tgtcs ; const int i = rowIndices[kcol] ; const CoinBigIndex krs = rowStarts[i] ; prob->addRow(i) ; ap->rows[ndx] = i ; ap->ninrowxs[ndx] = rowLengths[i] ; ap->rlos[ndx] = rlo[i] ; ap->rups[ndx] = rup[i] ; ap->coeffxs[ndx] = colCoeffs[kcol] ; CoinMemcpyN(&colIndices[krs],rowLengths[i],&ap->rowcolsxs[ntotels]) ; CoinMemcpyN(&rowCoeffs[krs],rowLengths[i],&ap->rowelsxs[ntotels]) ; ntotels += rowLengths[i] ; } CoinBigIndex tgtrs = rowStarts[tgtrow] ; CoinBigIndex tgtre = tgtrs+rowLengths[tgtrow] ; /* Adjust the objective coefficients based on the substitution formula c'(j) = c(j) - a(rj)c(t)/a(rt) */ if (nonzero_cost) { const double tgtcost = cost[tgtcol] ; for (CoinBigIndex krow = tgtrs ; krow < tgtre ; krow ++) { const int j = colIndices[krow] ; prob->addCol(j) ; costsx[krow-tgtrs] = cost[j] ; double coeff = rowCoeffs[krow] ; cost[j] -= (tgtcost*coeff)/tgtcoeff ; } prob->change_bias(tgtcost*rlo[tgtrow]/tgtcoeff) ; cost[tgtcol] = 0.0 ; } # if PRESOLVE_DEBUG > 1 std::cout << " tgt (" << tgtrow << ") (" << tgtrow_len << "): " ; for (CoinBigIndex krow = tgtrs ; krow < tgtre ; ++krow) { const int j = colIndices[krow] ; const double arj = rowCoeffs[krow] ; std::cout << "x(" << j << ") = " << arj << " (" << colLengths[j] << ") " ; } std::cout << std::endl ; # endif // kill small if wanted int relax= (prob->presolveOptions()&0x60000)>>17; double tolerance = 1.0e-12; for (int i=0;irows[colndx] ; if (i == tgtrow) continue ; double ait = ap->coeffxs[colndx] ; double coeff_factor = -ait/tgtcoeff ; CoinBigIndex krs = rowStarts[i] ; CoinBigIndex kre = krs+rowLengths[i] ; # if PRESOLVE_DEBUG > 1 std::cout << " subst pre (" << i << ") (" << rowLengths[i] << "): " ; for (CoinBigIndex krow = krs ; krow < kre ; ++krow) { const int j = colIndices[krow] ; const double aij = rowCoeffs[krow] ; std::cout << "x(" << j << ") = " << aij << " (" << colLengths[j] << ") " ; } std::cout << std::endl ; # endif /* Sort the row for efficiency and call add_row to do the actual business of changing coefficients due to substitution. This has the potential to trigger compaction of the row-major bulk store, so update bulk store indices. */ CoinSort_2(colIndices+krs,colIndices+kre,rowCoeffs+krs) ; bool outOfSpace = add_row(rowStarts,rlo,acts,rup,rowCoeffs,colIndices, rowLengths,rlink,nrows,coeff_factor,tolerance,i,tgtrow, x_to_y) ; if (outOfSpace) throwCoinError("out of memory","CoinImpliedFree::presolve") ; krs = rowStarts[i] ; kre = krs+rowLengths[i] ; tgtrs = rowStarts[tgtrow] ; tgtre = tgtrs+rowLengths[tgtrow] ; # if PRESOLVE_DEBUG > 1 std::cout << " subst aft (" << i << ") (" << rowLengths[i] << "): " ; for (CoinBigIndex krow = krs ; krow < kre ; ++krow) { const int j = colIndices[krow] ; const double aij = rowCoeffs[krow] ; std::cout << "x(" << j << ") = " << aij << " (" << colLengths[j] << ") " ; } std::cout << std::endl ; # endif /* Now update the column-major representation from the row-major representation. This is easy if the coefficient already exists, but painful if there's fillin. presolve_find_row1 will return the index of the row in the column vector, or one past the end if it's missing. If the coefficient is fill, presolve_expand_col will make sure that there's room in the column for one more coefficient. This may require that the column be moved in the bulk store, so we need to update kcs and kce. Once we're done, a(it) = 0 (i.e., we've eliminated x(t) from row i). Physically remove the explicit zero from the row-major representation with presolve_delete_from_row. */ for (CoinBigIndex rowndx = 0 ; rowndx < tgtrow_len ; ++rowndx) { const CoinBigIndex ktgt = tgtrs+rowndx ; const int j = colIndices[ktgt] ; CoinBigIndex kcs = colStarts[j] ; CoinBigIndex kce = kcs+colLengths[j] ; assert(colIndices[krs+x_to_y[rowndx]] == j) ; const double coeff = rowCoeffs[krs+x_to_y[rowndx]] ; CoinBigIndex kcol = presolve_find_row1(i,kcs,kce,rowIndices) ; if (kcol < kce) { colCoeffs[kcol] = coeff ; } else { outOfSpace = presolve_expand_col(colStarts,colCoeffs,rowIndices, colLengths,clink,ncols,j) ; if (outOfSpace) throwCoinError("out of memory","CoinImpliedFree::presolve") ; kcs = colStarts[j] ; kce = kcs+colLengths[j] ; rowIndices[kce] = i ; colCoeffs[kce] = coeff ; colLengths[j]++ ; } } presolve_delete_from_row(i,tgtcol, rowStarts,rowLengths,colIndices,rowCoeffs) ; # if PRESOLVE_DEBUG > 1 kre-- ; std::cout << " subst fin (" << i << ") (" << rowLengths[i] << "): " ; for (CoinBigIndex krow = krs ; krow < kre ; ++krow) { const int j = colIndices[krow] ; const double aij = rowCoeffs[krow] ; std::cout << "x(" << j << ") = " << aij << " (" << colLengths[j] << ") " ; } std::cout << std::endl ; # endif } /* End of the substitution loop. Record the column indices of the target row so we can groom these columns later to remove possible explicit zeros. */ CoinMemcpyN(&colIndices[rowStarts[tgtrow]],rowLengths[tgtrow], &zerocols[nzerocols]) ; nzerocols += rowLengths[tgtrow] ; /* Remove the target equality from the column- and row-major representations Somewhat painful in the colum-major representation. We have to walk the target row in the row-major representation and look up each coefficient in the column-major representation. */ for (CoinBigIndex krow = tgtrs ; krow < tgtre ; ++krow) { const int j = colIndices[krow] ; # if PRESOLVE_DEBUG > 1 std::cout << " removing row " << tgtrow << " from col " << j << std::endl ; # endif presolve_delete_from_col(tgtrow,j, colStarts,colLengths,rowIndices,colCoeffs) ; if (colLengths[j] == 0) { PRESOLVE_REMOVE_LINK(clink,j) ; } } /* Finally, physically remove the column from the column-major representation and the row from the row-major representation. */ PRESOLVE_REMOVE_LINK(clink, tgtcol) ; colLengths[tgtcol] = 0 ; PRESOLVE_REMOVE_LINK(rlink, tgtrow) ; rowLengths[tgtrow] = 0 ; rlo[tgtrow] = 0.0 ; rup[tgtrow] = 0.0 ; # if PRESOLVE_CONSISTENCY > 0 presolve_links_ok(prob) ; presolve_consistent(prob) ; # endif } /* That's it, we've processed all the candidate pairs. Clear the row used flags. */ for (int i = 0 ; i < nRowsUsed ; i++) prob->unsetRowUsed(rowsUsed[i]) ; /* Trim the array of substitution transforms and queue up objects for postsolve. Also groom the problem representation to remove explicit zeros. */ if (nactions) { # if PRESOLVE_SUMMARY > 0 std::cout << "NSUBSTS: " << nactions << std::endl ; # endif next = new subst_constraint_action(nactions, CoinCopyOfArray(actions,nactions),next) ; next = drop_zero_coefficients_action::presolve(prob,zerocols, nzerocols, next) ; # if PRESOLVE_CONSISTENCY > 0 presolve_links_ok(prob) ; presolve_consistent(prob) ; # endif } deleteAction(actions,action*) ; delete [] x_to_y ; delete [] zerocols ; # if COIN_PRESOLVE_TUNING > 0 if (prob->tuning_) double thisTime = CoinCpuTime() ; # endif # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_sol(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving subst_constraint_action::presolve, " << droppedRows << " rows, " << droppedColumns << " columns dropped" ; # if COIN_PRESOLVE_TUNING > 0 std::cout << " in " << thisTime-startTime << "s" ; # endif std::cout << "." << std::endl ; # endif return (next) ; } /* Undo the substitutions from presolve and reintroduce the target constraint and column. */ void subst_constraint_action::postsolve(CoinPostsolveMatrix *prob) const { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering subst_constraint_action::postsolve, " << nactions_ << " constraints to process." << std::endl ; # endif int ncols = prob->ncols_ ; char *cdone = prob->cdone_ ; char *rdone = prob->rdone_ ; const double ztolzb = prob->ztolzb_ ; presolve_check_threads(prob) ; presolve_check_free_list(prob) ; presolve_check_reduced_costs(prob) ; presolve_check_duals(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif /* Unpack the column-major representation. */ CoinBigIndex *colStarts = prob->mcstrt_ ; int *colLengths = prob->hincol_ ; int *rowIndices = prob->hrow_ ; double *colCoeffs = prob->colels_ ; /* Rim vectors, solution, reduced costs, duals, row activity. */ double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *cost = prob->cost_ ; double *sol = prob->sol_ ; double *rcosts = prob->rcosts_ ; double *acts = prob->acts_ ; double *rowduals = prob->rowduals_ ; CoinBigIndex *link = prob->link_ ; CoinBigIndex &free_list = prob->free_list_ ; const double maxmin = prob->maxmin_ ; const action *const actions = actions_ ; const int nactions = nactions_ ; /* Open the main loop to step through the postsolve objects. First activity is to unpack the postsolve object. We have the target column and row indices, the full target column, and complete copies of all entangled rows (column indices, coefficients, lower and upper bounds). There may be a vector of objective coefficients which we'll get to later. */ for (const action *f = &actions[nactions-1] ; actions <= f ; f--) { const int tgtcol = f->col ; const int tgtrow = f->rowy ; const int tgtcol_len = f->nincol ; const double *tgtcol_coeffs = f->coeffxs ; const int *entngld_rows = f->rows ; const int *entngld_lens = f->ninrowxs ; const int *entngld_colndxs = f->rowcolsxs ; const double *entngld_colcoeffs = f->rowelsxs ; const double *entngld_rlos = f->rlos ; const double *entngld_rups = f->rups ; const double *costs = f->costsx ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 1 std::cout << " reintroducing column x(" << tgtcol << ") and row " << tgtrow ; if (costs) std::cout << ", nonzero costs" ; std::cout << "." << std::endl ; # endif /* We're about to reintroduce the target row and column; empty stubs should be present. All other rows should already be present. */ PRESOLVEASSERT(cdone[tgtcol] == DROP_COL) ; PRESOLVEASSERT(colLengths[tgtcol] == 0) ; PRESOLVEASSERT(rdone[tgtrow] == DROP_ROW) ; for (int cndx = 0 ; cndx < tgtcol_len ; ++cndx) { if (entngld_rows[cndx] != tgtrow) PRESOLVEASSERT(rdone[entngld_rows[cndx]]) ; } /* In a postsolve matrix, we can't just check that the length of the row is zero. We need to look at all columns and confirm its absence. */ for (int j = 0 ; j < ncols ; ++j) { if (colLengths[j] > 0 && cdone[j]) { const CoinBigIndex kcs = colStarts[j] ; const int lenj = colLengths[j] ; CoinBigIndex krow = presolve_find_row3(tgtrow,kcs,lenj,rowIndices,link) ; if (krow >= 0) { std::cout << " BAD COEFF! row " << tgtrow << " present in column " << j << " before reintroduction; a(" << tgtrow << "," << j << ") = " << colCoeffs[krow] << "; x(" << j << ") = " << sol[j] << "; cdone " << static_cast(cdone[j]) << "." << std::endl ; } } } # endif /* Find the copy of the target row. Restore the upper and lower bounds of entangled rows while we're looking. Recall that the target row is an equality. */ int tgtrow_len = -1 ; const int *tgtrow_colndxs = NULL ; const double *tgtrow_coeffs = NULL ; double tgtcoeff = 0.0 ; double tgtrhs = 1.0e50 ; int nel = 0 ; for (int cndx = 0 ; cndx < tgtcol_len ; ++cndx) { int i = entngld_rows[cndx] ; rlo[i] = entngld_rlos[cndx] ; rup[i] = entngld_rups[cndx] ; if (i == tgtrow) { tgtrow_len = entngld_lens[cndx] ; tgtrow_colndxs = &entngld_colndxs[nel] ; tgtrow_coeffs = &entngld_colcoeffs[nel] ; tgtcoeff = tgtcol_coeffs[cndx] ; tgtrhs = rlo[i] ; } nel += entngld_lens[cndx] ; } /* Solve the target equality to find the solution for the eliminated col. tgtcol is present in tgtrow_colndxs, so initialise sol[tgtcol] to zero to make sure it doesn't contribute. If we're debugging, check that the result is within bounds. */ double tgtexp = tgtrhs ; sol[tgtcol] = 0.0 ; for (int ndx = 0 ; ndx < tgtrow_len ; ++ndx) { int j = tgtrow_colndxs[ndx] ; double coeffj = tgtrow_coeffs[ndx] ; tgtexp -= coeffj*sol[j] ; } sol[tgtcol] = tgtexp/tgtcoeff ; # if PRESOLVE_DEBUG > 0 double *clo = prob->clo_ ; double *cup = prob->cup_ ; if (!(sol[tgtcol] > (clo[tgtcol]-ztolzb) && (cup[tgtcol]+ztolzb) > sol[tgtcol])) { std::cout << "BAD SOL: x(" << tgtcol << ") " << sol[tgtcol] << "; lb " << clo[tgtcol] << "; ub " << cup[tgtcol] << "." << std::endl ; } # endif /* Now restore the original entangled rows. We first delete any columns present in tgtrow. This will remove any fillin, but may also remove columns that were originally present in both the entangled row and the target row. Note that even cancellations (explicit zeros) are present at this point --- in presolve, they were removed after the substition transform completed, hence they're already restored. What isn't present is the target column, which is deleted as part of the transform. */ { # if PRESOLVE_DEBUG > 2 std::cout << " removing coefficients:" ; # endif for (int rndx = 0 ; rndx < tgtrow_len ; ++rndx) { int j = tgtrow_colndxs[rndx] ; if (j != tgtcol) for (int cndx = 0 ; cndx < tgtcol_len ; ++cndx) { if (entngld_rows[cndx] != tgtrow) { # if PRESOLVE_DEBUG > 2 std::cout << " a(" << entngld_rows[cndx] << "," << j << ")" ; # endif presolve_delete_from_col2(entngld_rows[cndx],j,colStarts, colLengths,rowIndices,link,&free_list) ; } } } # if PRESOLVE_DEBUG > 2 std::cout << std::endl ; # endif # if PRESOLVE_CONSISTENCY > 0 presolve_check_threads(prob) ; presolve_check_free_list(prob) ; # endif /* Next we restore the original coefficients. The outer loop walks tgtcol; cols_i and coeffs_i are advanced as we go to point to each entangled row. The inner loop walks the entangled row and restores the row's coefficients. Tgtcol is handled as any other column. Skip tgtrow, we'll do it below. Since we don't have a row-major representation, we have to look for a(i,j) from entangled row i in the existing column j. If we find a(i,j), simply update it (and a(tgtrow,j) should not exist). If we don't find a(i,j), introduce it (and a(tgtrow,j) should exist). Recalculate the row activity while we're at it. */ # if PRESOLVE_DEBUG > 2 std::cout << " restoring coefficients:" ; # endif colLengths[tgtcol] = 0 ; const int *cols_i = entngld_colndxs ; const double *coeffs_i = entngld_colcoeffs ; for (int cndx = 0 ; cndx < tgtcol_len ; ++cndx) { const int leni = entngld_lens[cndx] ; const int i = entngld_rows[cndx] ; if (i != tgtrow) { double acti = 0.0 ; for (int rndx = 0 ; rndx < leni ; ++rndx) { const int j = cols_i[rndx] ; CoinBigIndex kcoli = presolve_find_row3(i,colStarts[j], colLengths[j],rowIndices,link) ; if (kcoli != -1) { # if PRESOLVE_DEBUG > 2 std::cout << " u a(" << i << "," << j << ")" ; PRESOLVEASSERT(presolve_find_col1(j,0,tgtrow_len, tgtrow_colndxs) == tgtrow_len) ; # endif colCoeffs[kcoli] = coeffs_i[rndx] ; } else { # if PRESOLVE_DEBUG > 2 std::cout << " f a(" << i << "," << j << ")" ; PRESOLVEASSERT(presolve_find_col1(j,0,tgtrow_len, tgtrow_colndxs) < tgtrow_len) ; # endif CoinBigIndex kk = free_list ; assert(kk >= 0 && kk < prob->bulk0_) ; free_list = link[free_list] ; link[kk] = colStarts[j] ; colStarts[j] = kk ; colCoeffs[kk] = coeffs_i[rndx] ; rowIndices[kk] = i ; ++colLengths[j] ; } acti += coeffs_i[rndx]*sol[j] ; } acts[i] = acti ; } cols_i += leni ; coeffs_i += leni ; } # if PRESOLVE_DEBUG > 2 std::cout << std::endl ; # endif # if PRESOLVE_CONSISTENCY > 0 presolve_check_threads(prob) ; presolve_check_free_list(prob) ; # endif /* Restore tgtrow. Arguably we could to this in the previous loop, but we'd do a lot of unnecessary work. By construction, the target row is tight. */ # if PRESOLVE_DEBUG > 2 std::cout << " restoring row " << tgtrow << ":" ; # endif for (int rndx = 0 ; rndx < tgtrow_len ; ++rndx) { int j = tgtrow_colndxs[rndx] ; # if PRESOLVE_DEBUG > 2 std::cout << " a(" << tgtrow << "," << j << ")" ; # endif CoinBigIndex kk = free_list ; assert(kk >= 0 && kk < prob->bulk0_) ; free_list = link[free_list] ; link[kk] = colStarts[j] ; colStarts[j] = kk ; colCoeffs[kk] = tgtrow_coeffs[rndx] ; rowIndices[kk] = tgtrow ; ++colLengths[j] ; } acts[tgtrow] = tgtrhs ; # if PRESOLVE_DEBUG > 2 std::cout << std::endl ; # endif # if PRESOLVE_CONSISTENCY > 0 presolve_check_threads(prob) ; presolve_check_free_list(prob) ; # endif } /* Restore original cost coefficients, if necessary. */ if (costs) { for (int ndx = 0 ; ndx < tgtrow_len ; ++ndx) { cost[tgtrow_colndxs[ndx]] = costs[ndx] ; } } /* Calculate the reduced cost for the column absent any contribution from tgtrow, then set the dual for tgtrow so that the reduced cost of tgtcol is zero. */ double dj = maxmin*cost[tgtcol] ; rowduals[tgtrow] = 0.0 ; for (int cndx = 0 ; cndx < tgtcol_len ; ++cndx) { int i = entngld_rows[cndx] ; double coeff = tgtcol_coeffs[cndx] ; dj -= rowduals[i]*coeff ; } rowduals[tgtrow] = dj/tgtcoeff ; rcosts[tgtcol] = 0.0 ; if (rowduals[tgtrow] > 0) prob->setRowStatus(tgtrow,CoinPrePostsolveMatrix::atUpperBound) ; else prob->setRowStatus(tgtrow,CoinPrePostsolveMatrix::atLowerBound) ; prob->setColumnStatus(tgtcol,CoinPrePostsolveMatrix::basic) ; # if PRESOLVE_DEBUG > 2 std::cout << " row " << tgtrow << " " << prob->rowStatusString(prob->getRowStatus(tgtrow)) << " dual " << rowduals[tgtrow] << std::endl ; std::cout << " col " << tgtcol << " " << prob->columnStatusString(prob->getColumnStatus(tgtcol)) << " dj " << dj << std::endl ; # endif # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 cdone[tgtcol] = SUBST_ROW ; rdone[tgtrow] = SUBST_ROW ; # endif } # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_threads(prob) ; presolve_check_free_list(prob) ; presolve_check_reduced_costs(prob) ; presolve_check_duals(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving subst_constraint_action::postsolve." << std::endl ; # endif # endif return ; } /* Next time someone builds this code on Windows, check to see if deleteAction is still necessary. -- lh, 121114 -- */ subst_constraint_action::~subst_constraint_action() { const action *actions = actions_ ; for (int i = 0 ; i < nactions_ ; ++i) { delete [] actions[i].rows ; delete [] actions[i].rlos ; delete [] actions[i].rups ; delete [] actions[i].coeffxs ; delete [] actions[i].ninrowxs ; delete [] actions[i].rowcolsxs ; delete [] actions[i].rowelsxs ; //delete [](double*)actions[i].costsx ; deleteAction(actions[i].costsx,double*) ; } // Must add cast to placate MS compiler //delete [] (subst_constraint_action::action*)actions_ ; deleteAction(actions_,subst_constraint_action::action*) ; } CoinMP-1.8.3/CoinUtils/src/CoinDenseFactorization.cpp0000644000175000017500000006734312432624153021143 0ustar renerene/* $Id: CoinDenseFactorization.cpp 1759 2014-11-18 11:07:23Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinUtilsConfig.h" #include "CoinPragma.hpp" #include #include #include "CoinDenseFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" #if COIN_BIG_DOUBLE==1 #undef COIN_FACTORIZATION_DENSE_CODE #endif #ifdef COIN_FACTORIZATION_DENSE_CODE // using simple lapack interface extern "C" { /** LAPACK Fortran subroutine DGETRF. */ void F77_FUNC(dgetrf,DGETRF)(ipfint * m, ipfint *n, double *A, ipfint *ldA, ipfint * ipiv, ipfint *info); /** LAPACK Fortran subroutine DGETRS. */ void F77_FUNC(dgetrs,DGETRS)(char *trans, cipfint *n, cipfint *nrhs, const double *A, cipfint *ldA, cipfint * ipiv, double *B, cipfint *ldB, ipfint *info, int trans_len); } #endif //:class CoinDenseFactorization. Deals with Factorization and Updates // CoinDenseFactorization. Constructor CoinDenseFactorization::CoinDenseFactorization ( ) : CoinOtherFactorization() { gutsOfInitialize(); } /// Copy constructor CoinDenseFactorization::CoinDenseFactorization ( const CoinDenseFactorization &other) : CoinOtherFactorization(other) { gutsOfInitialize(); gutsOfCopy(other); } // Clone CoinOtherFactorization * CoinDenseFactorization::clone() const { return new CoinDenseFactorization(*this); } /// The real work of constructors etc void CoinDenseFactorization::gutsOfDestructor() { delete [] elements_; delete [] pivotRow_; delete [] workArea_; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; numberRows_ = 0; numberColumns_ = 0; numberGoodU_ = 0; status_ = -1; maximumRows_=0; maximumSpace_=0; solveMode_=0; } void CoinDenseFactorization::gutsOfInitialize() { pivotTolerance_ = 1.0e-1; zeroTolerance_ = 1.0e-13; #ifndef COIN_FAST_CODE slackValue_ = -1.0; #endif maximumPivots_=200; relaxCheck_=1.0; numberRows_ = 0; numberColumns_ = 0; numberGoodU_ = 0; status_ = -1; numberPivots_ = 0; maximumRows_=0; maximumSpace_=0; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; solveMode_=0; } // ~CoinDenseFactorization. Destructor CoinDenseFactorization::~CoinDenseFactorization ( ) { gutsOfDestructor(); } // = CoinDenseFactorization & CoinDenseFactorization::operator = ( const CoinDenseFactorization & other ) { if (this != &other) { gutsOfDestructor(); gutsOfInitialize(); gutsOfCopy(other); } return *this; } #ifdef COIN_FACTORIZATION_DENSE_CODE #define WORK_MULT 2 #else #define WORK_MULT 2 #endif void CoinDenseFactorization::gutsOfCopy(const CoinDenseFactorization &other) { pivotTolerance_ = other.pivotTolerance_; zeroTolerance_ = other.zeroTolerance_; #ifndef COIN_FAST_CODE slackValue_ = other.slackValue_; #endif relaxCheck_ = other.relaxCheck_; numberRows_ = other.numberRows_; numberColumns_ = other.numberColumns_; maximumRows_ = other.maximumRows_; maximumSpace_ = other.maximumSpace_; solveMode_ = other.solveMode_; numberGoodU_ = other.numberGoodU_; maximumPivots_ = other.maximumPivots_; numberPivots_ = other.numberPivots_; factorElements_ = other.factorElements_; status_ = other.status_; if (other.pivotRow_) { pivotRow_ = new int [2*maximumRows_+maximumPivots_]; CoinMemcpyN(other.pivotRow_,(2*maximumRows_+numberPivots_),pivotRow_); elements_ = new CoinFactorizationDouble [maximumSpace_]; CoinMemcpyN(other.elements_,(maximumRows_+numberPivots_)*maximumRows_,elements_); workArea_ = new CoinFactorizationDouble [maximumRows_*WORK_MULT]; CoinZeroN(workArea_,maximumRows_*WORK_MULT); } else { elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; } } // getAreas. Gets space for a factorization //called by constructors void CoinDenseFactorization::getAreas ( int numberOfRows, int numberOfColumns, CoinBigIndex , CoinBigIndex ) { numberRows_ = numberOfRows; numberColumns_ = numberOfColumns; CoinBigIndex size = numberRows_*(numberRows_+CoinMax(maximumPivots_,(numberRows_+1)>>1)); if (size>maximumSpace_) { delete [] elements_; elements_ = new CoinFactorizationDouble [size]; maximumSpace_ = size; } if (numberRows_>maximumRows_) { maximumRows_ = numberRows_; delete [] pivotRow_; delete [] workArea_; pivotRow_ = new int [2*maximumRows_+maximumPivots_]; workArea_ = new CoinFactorizationDouble [maximumRows_*WORK_MULT]; } } // preProcess. void CoinDenseFactorization::preProcess () { // could do better than this but this only a demo CoinBigIndex put = numberRows_*numberRows_; int *indexRow = reinterpret_cast (elements_+put); CoinBigIndex * starts = reinterpret_cast (pivotRow_); put = numberRows_*numberColumns_; for (int i=numberColumns_-1;i>=0;i--) { put -= numberRows_; memset(workArea_,0,numberRows_*sizeof(CoinFactorizationDouble)); assert (starts[i]<=put); for (CoinBigIndex j=starts[i];jlargest) { largest=value; iRow=j; } } if (iRow>=0) { if (iRow!=i) { // swap assert (iRow>i); CoinFactorizationDouble * elementsA = elements_; for (int k=0;k<=i;k++) { // swap CoinFactorizationDouble value = elementsA[i]; elementsA[i]=elementsA[iRow]; elementsA[iRow]=value; elementsA += numberRows_; } int iPivot = pivotRow_[i+numberRows_]; pivotRow_[i+numberRows_]=pivotRow_[iRow+numberRows_]; pivotRow_[iRow+numberRows_]=iPivot; } CoinFactorizationDouble pivotValue = 1.0/elements[i]; elements[i]=pivotValue; for (int j=i+1;j (workArea_); int i; for ( i=0;i=0); for ( i=numberGoodU_;idenseVector ( ); int *regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse->getNumElements ( ); int i; memset(elements,0,numberRows_*sizeof(CoinFactorizationDouble)); CoinFactorizationDouble pivotValue = pivotCheck; if (fabs(pivotValue)packedMode()) { for (i=0;ipackedMode()) { for (i=0;i=0 */ int CoinDenseFactorization::updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute) const { assert (numberRows_==numberColumns_); double *region2 = regionSparse2->denseVector ( ); int *regionIndex = regionSparse2->getIndices ( ); int numberNonZero = regionSparse2->getNumElements ( ); double *region = regionSparse->denseVector ( ); #ifdef COIN_FACTORIZATION_DENSE_CODE if ((solveMode_%10)==0) { #endif if (!regionSparse2->packedMode()) { if (!noPermute) { for (int j=0;jdenseVector ( ); } } else { // packed mode assert (!noPermute); for (int j=0;jpackedMode()) { if (!noPermute) { for (int j=0;jdenseVector ( ); } } else { // packed mode assert (!noPermute); for (int j=0;j=0;i--) { elements -= numberRows_; CoinFactorizationDouble value = region[i]*elements[i]; region[i] = value; for (int j=0;jpackedMode()) { for (int j=0;jzeroTolerance_) { region2[j] = value; regionIndex[numberNonZero++]=j; } } } else { // packed mode for (int j=0;jzeroTolerance_) { region2[numberNonZero] = value; regionIndex[numberNonZero++]=j; } } } } else { for (int j=0;jzeroTolerance_) { regionIndex[numberNonZero++]=j; } else { region[j]=0.0; } } } #ifdef COIN_FACTORIZATION_DENSE_CODE } else { // lapack if (!noPermute) { if (!regionSparse2->packedMode()) { for (int j=0;jzeroTolerance_) { region2[j] = value; regionIndex[numberNonZero++]=j; } } } else { // packed mode for (int j=0;jzeroTolerance_) { region2[numberNonZero] = value; regionIndex[numberNonZero++]=j; } } } } else { for (int j=0;jzeroTolerance_) { regionIndex[numberNonZero++]=j; } else { region[j]=0.0; } } } } #endif regionSparse2->setNumElements(numberNonZero); return 0; } int CoinDenseFactorization::updateTwoColumnsFT(CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool /*noPermute*/) { #ifdef COIN_FACTORIZATION_DENSE_CODE #if 0 CoinIndexedVector s2(*regionSparse2); CoinIndexedVector s3(*regionSparse3); updateColumn(regionSparse1,&s2); updateColumn(regionSparse1,&s3); #endif if ((solveMode_%10)==0) { #endif updateColumn(regionSparse1,regionSparse2); updateColumn(regionSparse1,regionSparse3); #ifdef COIN_FACTORIZATION_DENSE_CODE } else { // lapack assert (numberRows_==numberColumns_); double *region2 = regionSparse2->denseVector ( ); int *regionIndex2 = regionSparse2->getIndices ( ); int numberNonZero2 = regionSparse2->getNumElements ( ); CoinFactorizationDouble * regionW2 = workArea_; if (!regionSparse2->packedMode()) { for (int j=0;jdenseVector ( ); int *regionIndex3 = regionSparse3->getIndices ( ); int numberNonZero3 = regionSparse3->getNumElements ( ); CoinFactorizationDouble *regionW3 = workArea_+numberRows_; if (!regionSparse3->packedMode()) { for (int j=0;jpackedMode()) { for (int j=0;jzeroTolerance_) { region2[j] = value; regionIndex2[numberNonZero2++]=j; } } } else { // packed mode for (int j=0;jzeroTolerance_) { region2[numberNonZero2] = value; regionIndex2[numberNonZero2++]=j; } } } regionSparse2->setNumElements(numberNonZero2); numberNonZero3=0; if (!regionSparse3->packedMode()) { for (int j=0;jzeroTolerance_) { region3[j] = value; regionIndex3[numberNonZero3++]=j; } } } else { // packed mode for (int j=0;jzeroTolerance_) { region3[numberNonZero3] = value; regionIndex3[numberNonZero3++]=j; } } } regionSparse3->setNumElements(numberNonZero3); #if 0 printf("Good2==\n"); s2.print(); printf("Bad2==\n"); regionSparse2->print(); printf("======\n"); printf("Good3==\n"); s3.print(); printf("Bad3==\n"); regionSparse3->print(); printf("======\n"); #endif } #endif return 0; } /* Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output */ int CoinDenseFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { assert (numberRows_==numberColumns_); double *region2 = regionSparse2->denseVector ( ); int *regionIndex = regionSparse2->getIndices ( ); int numberNonZero = regionSparse2->getNumElements ( ); double *region = regionSparse->denseVector ( ); #ifdef COIN_FACTORIZATION_DENSE_CODE if ((solveMode_%10)==0) { #endif if (!regionSparse2->packedMode()) { for (int j=0;jpackedMode()) { for (int j=0;j=0;i--) { elements -= numberRows_; int iPivot = pivotRow_[i+2*numberRows_]; CoinFactorizationDouble value = region[iPivot]; //*elements[iPivot]; for (int j=0;j=0;i--) { elements -= numberRows_; CoinFactorizationDouble value = region[i]; for (int j=i+1;jpackedMode()) { for (int j=0;jzeroTolerance_) { region2[iRow] = value; regionIndex[numberNonZero++]=iRow; } } } else { for (int j=0;jzeroTolerance_) { region2[numberNonZero] = value; regionIndex[numberNonZero++]=iRow; } } } #ifdef COIN_FACTORIZATION_DENSE_CODE } else { // lapack if (!regionSparse2->packedMode()) { for (int j=0;jzeroTolerance_) { region2[j] = value; regionIndex[numberNonZero++]=j; } } } else { for (int j=0;jzeroTolerance_) { region2[numberNonZero] = value; regionIndex[numberNonZero++]=j; } } } } #endif regionSparse2->setNumElements(numberNonZero); return 0; } // Default constructor CoinOtherFactorization::CoinOtherFactorization ( ) : pivotTolerance_(1.0e-1), zeroTolerance_(1.0e-13), #ifndef COIN_FAST_CODE slackValue_(-1.0), #endif relaxCheck_(1.0), factorElements_(0), numberRows_(0), numberColumns_(0), numberGoodU_(0), maximumPivots_(200), numberPivots_(0), status_(-1), solveMode_(0) { } // Copy constructor CoinOtherFactorization::CoinOtherFactorization ( const CoinOtherFactorization &other) : pivotTolerance_(other.pivotTolerance_), zeroTolerance_(other.zeroTolerance_), #ifndef COIN_FAST_CODE slackValue_(other.slackValue_), #endif relaxCheck_(other.relaxCheck_), factorElements_(other.factorElements_), numberRows_(other.numberRows_), numberColumns_(other.numberColumns_), numberGoodU_(other.numberGoodU_), maximumPivots_(other.maximumPivots_), numberPivots_(other.numberPivots_), status_(other.status_), solveMode_(other.solveMode_) { } // Destructor CoinOtherFactorization::~CoinOtherFactorization ( ) { } // = copy CoinOtherFactorization & CoinOtherFactorization::operator = ( const CoinOtherFactorization & other ) { if (this != &other) { pivotTolerance_ = other.pivotTolerance_; zeroTolerance_ = other.zeroTolerance_; #ifndef COIN_FAST_CODE slackValue_ = other.slackValue_; #endif relaxCheck_ = other.relaxCheck_; factorElements_ = other.factorElements_; numberRows_ = other.numberRows_; numberColumns_ = other.numberColumns_; numberGoodU_ = other.numberGoodU_; maximumPivots_ = other.maximumPivots_; numberPivots_ = other.numberPivots_; status_ = other.status_; solveMode_ = other.solveMode_; } return *this; } void CoinOtherFactorization::pivotTolerance ( double value ) { if (value>0.0&&value<=1.0) { pivotTolerance_=value; } } void CoinOtherFactorization::zeroTolerance ( double value ) { if (value>0.0&&value<1.0) { zeroTolerance_=value; } } #ifndef COIN_FAST_CODE void CoinOtherFactorization::slackValue ( double value ) { if (value>=0.0) { slackValue_=1.0; } else { slackValue_=-1.0; } } #endif void CoinOtherFactorization::maximumPivots ( int value ) { if (value>maximumPivots_) { delete [] pivotRow_; pivotRow_ = new int[2*maximumRows_+value]; } maximumPivots_ = value; } // Number of entries in each row int * CoinOtherFactorization::numberInRow() const { return reinterpret_cast (workArea_);} // Number of entries in each column int * CoinOtherFactorization::numberInColumn() const { return (reinterpret_cast (workArea_))+numberRows_;} // Returns array to put basis starts in CoinBigIndex * CoinOtherFactorization::starts() const { return reinterpret_cast (pivotRow_);} // Returns array to put basis elements in CoinFactorizationDouble * CoinOtherFactorization::elements() const { return elements_;} // Returns pivot row int * CoinOtherFactorization::pivotRow() const { return pivotRow_;} // Returns work area CoinFactorizationDouble * CoinOtherFactorization::workArea() const { return workArea_;} // Returns int work area int * CoinOtherFactorization::intWorkArea() const { return reinterpret_cast (workArea_);} // Returns permute back int * CoinOtherFactorization::permuteBack() const { return pivotRow_+numberRows_;} // Returns true if wants tableauColumn in replaceColumn bool CoinOtherFactorization::wantsTableauColumn() const { return true;} /* Useful information for factorization 0 - iteration number whereFrom is 0 for factorize and 1 for replaceColumn */ void CoinOtherFactorization::setUsefulInformation(const int * ,int ) { } CoinMP-1.8.3/CoinUtils/src/CoinPresolveFixed.hpp0000644000175000017500000001356611670247221020132 0ustar renerene/* $Id: CoinPresolveFixed.hpp 1510 2011-12-08 23:56:01Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveFixed_H #define CoinPresolveFixed_H #define FIXED_VARIABLE 1 /*! \class remove_fixed_action \brief Excise fixed variables from the model. Implements the action of virtually removing one or more fixed variables x_j from the model by substituting the value sol_j in each constraint. Specifically, for each constraint i where a_ij != 0, rlo_i and rup_i are adjusted by -a_ij*sol_j and a_ij is set to 0. There is an implicit assumption that the variable already has the correct value. If this isn't true, corrections to row activity may be incorrect. If you want to guard against this possibility, consider make_fixed_action. Actual removal of the empty column from the matrix is handled by drop_empty_cols_action. Correction of the objective function is done there. */ class remove_fixed_action : public CoinPresolveAction { public: /*! \brief Structure to hold information necessary to reintroduce a column into the problem representation. */ struct action { int col; ///< column index of variable int start; ///< start of coefficients in #colels_ and #colrows_ double sol; ///< value of variable }; /// Array of row indices for coefficients of excised columns int *colrows_; /// Array of coefficients of excised columns double *colels_; /// Number of entries in #actions_ int nactions_; /// Vector specifying variable(s) affected by this object action *actions_; private: /*! \brief Constructor */ remove_fixed_action(int nactions, action *actions, double * colels, int * colrows, const CoinPresolveAction *next); public: /// Returns string "remove_fixed_action". const char *name() const; /*! \brief Excise the specified columns. Remove the specified columns (\p nfcols, \p fcols) from the problem representation (\p prob), leaving the appropriate postsolve object linked as the head of the list of postsolve objects (currently headed by \p next). */ static const remove_fixed_action *presolve(CoinPresolveMatrix *prob, int *fcols, int nfcols, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; /// Destructor virtual ~remove_fixed_action(); }; /*! \relates remove_fixed_action \brief Scan the problem for fixed columns and remove them. A front end to collect a list of columns with equal bounds and hand them to remove_fixed_action::presolve() for processing. */ const CoinPresolveAction *remove_fixed(CoinPresolveMatrix *prob, const CoinPresolveAction *next); /*! \class make_fixed_action \brief Fix a variable at a specified bound. Implements the action of fixing a variable by forcing both bounds to the same value and forcing the value of the variable to match. If the bounds are already equal, and the value of the variable is already correct, consider remove_fixed_action. */ class make_fixed_action : public CoinPresolveAction { /// Structure to preserve the bound overwritten when fixing a variable struct action { double bound; ///< Value of bound overwritten to fix variable. int col ; ///< column index of variable }; /// Number of preserved bounds int nactions_; /// Vector of preserved bounds, one for each variable fixed in this object const action *actions_; /*! \brief True to fix at lower bound, false to fix at upper bound. Note that this applies to all variables fixed in this object. */ const bool fix_to_lower_; /*! \brief The postsolve object with the information required to repopulate the fixed columns. */ const remove_fixed_action *faction_; /*! \brief Constructor */ make_fixed_action(int nactions, const action *actions, bool fix_to_lower, const remove_fixed_action *faction, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions), fix_to_lower_(fix_to_lower), faction_(faction) {} public: /// Returns string "make_fixed_action". const char *name() const; /*! \brief Perform actions to fix variables and return postsolve object For each specified variable (\p nfcols, \p fcols), fix the variable to the specified bound (\p fix_to_lower) by setting the variable's bounds to be equal in \p prob. Create a postsolve object, link it at the head of the list of postsolve objects (\p next), and return the object. */ static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, int *fcols, int nfcols, bool fix_to_lower, const CoinPresolveAction *next); /*! \brief Postsolve (unfix variables) Back out the variables fixed by the presolve side of this object. */ void postsolve(CoinPostsolveMatrix *prob) const; /// Destructor virtual ~make_fixed_action() { deleteAction(actions_,action*); delete faction_; } }; /*! \relates make_fixed_action \brief Scan variables and fix any with equal bounds A front end to collect a list of columns with equal bounds and hand them to make_fixed_action::presolve() for processing. */ const CoinPresolveAction *make_fixed(CoinPresolveMatrix *prob, const CoinPresolveAction *next) ; /*! \brief Transfer costs from singleton variables \relates make_fixed_action Transfers costs from singleton variables in equalities onto the other variables. Will also transfer costs from one integer variable to other integer variables with zero cost if there's a net gain in integer variables with non-zero cost. The relation to make_fixed_action is tenuous, but this transform should be attempted before the initial round of variable fixing. */ void transferCosts(CoinPresolveMatrix * prob); #endif CoinMP-1.8.3/CoinUtils/src/CoinPackedVectorBase.hpp0000644000175000017500000002247011552534611020513 0ustar renerene/* $Id: CoinPackedVectorBase.hpp 1416 2011-04-17 09:57:29Z stefan $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPackedVectorBase_H #define CoinPackedVectorBase_H #include #include #include "CoinPragma.hpp" #include "CoinError.hpp" class CoinPackedVector; /** Abstract base class for various sparse vectors. Since this class is abstract, no object of this type can be created. The sole purpose of this class is to provide access to a constant packed vector. All members of this class are const methods, they can't change the object. */ class CoinPackedVectorBase { public: /**@name Virtual methods that the derived classes must provide */ //@{ /// Get length of indices and elements vectors virtual int getNumElements() const = 0; /// Get indices of elements virtual const int * getIndices() const = 0; /// Get element values virtual const double * getElements() const = 0; //@} /**@name Methods related to whether duplicate-index checking is performed. If the checking for duplicate indices is turned off, then some CoinPackedVector methods may not work correctly if there are duplicate indices. Turning off the checking for duplicate indices may result in better run time performance. */ //@{ /** \brief Set to the argument value whether to test for duplicate indices in the vector whenever they can occur. Calling this method with \p test set to true will trigger an immediate check for duplicate indices. */ void setTestForDuplicateIndex(bool test) const; /** \brief Set to the argument value whether to test for duplicate indices in the vector whenever they can occur BUT we know that right now the vector has no duplicate indices. Calling this method with \p test set to true will not trigger an immediate check for duplicate indices; instead, it's assumed that the result of the test will be true. */ void setTestForDuplicateIndexWhenTrue(bool test) const; /** Returns true if the vector should be tested for duplicate indices when they can occur. */ bool testForDuplicateIndex() const { return testForDuplicateIndex_; } /// Just sets test stuff false without a try etc inline void setTestsOff() const { testForDuplicateIndex_=false; testedDuplicateIndex_=false;} //@} /**@name Methods for getting info on the packed vector as a full vector */ //@{ /** Get the vector as a dense vector. The argument specifies how long this dense vector is.
    NOTE: The user needs to delete[] this pointer after it's not needed anymore. */ double * denseVector(int denseSize) const; /** Access the i'th element of the full storage vector. If the i'th is not stored, then zero is returned. The initial use of this method has some computational and storage overhead associated with it.
    NOTE: This is very expensive. It is probably much better to use denseVector(). */ double operator[](int i) const; //@} /**@name Index methods */ //@{ /// Get value of maximum index int getMaxIndex() const; /// Get value of minimum index int getMinIndex() const; /// Throw an exception if there are duplicate indices void duplicateIndex(const char* methodName = NULL, const char * className = NULL) const; /** Return true if the i'th element of the full storage vector exists in the packed storage vector.*/ bool isExistingIndex(int i) const; /** Return the position of the i'th element of the full storage vector. If index does not exist then -1 is returned */ int findIndex(int i) const; //@} /**@name Comparison operators on two packed vectors */ //@{ /** Equal. Returns true if vectors have same length and corresponding element of each vector is equal. */ bool operator==(const CoinPackedVectorBase & rhs) const; /// Not equal bool operator!=(const CoinPackedVectorBase & rhs) const; #if 0 // LL: This should be implemented eventually. It is useful to have. /** Lexicographic comparisons of two packed vectors. Returns negative/0/positive depending on whether \c this is smaller/equal.greater than \c rhs */ int lexCompare(const CoinPackedVectorBase& rhs); #endif /** This method establishes an ordering on packed vectors. It is complete ordering, but not the same as lexicographic ordering. However, it is quick and dirty to compute and thus it is useful to keep packed vectors in a heap when all we care is to quickly check whether a particular vector is already in the heap or not. Returns negative/0/positive depending on whether \c this is smaller/equal.greater than \c rhs. */ int compare(const CoinPackedVectorBase& rhs) const; /** equivalent - If shallow packed vector A & B are equivalent, then they are still equivalent no matter how they are sorted. In this method the FloatEqual function operator can be specified. The default equivalence test is that the entries are relatively equal.
    NOTE: This is a relatively expensive method as it sorts the two shallow packed vectors. */ template bool isEquivalent(const CoinPackedVectorBase& rhs, const FloatEqual& eq) const { if (getNumElements() != rhs.getNumElements()) return false; duplicateIndex("equivalent", "CoinPackedVector"); rhs.duplicateIndex("equivalent", "CoinPackedVector"); std::map mv; const int * inds = getIndices(); const double * elems = getElements(); int i; for ( i = getNumElements() - 1; i >= 0; --i) { mv.insert(std::make_pair(inds[i], elems[i])); } std::map mvRhs; inds = rhs.getIndices(); elems = rhs.getElements(); for ( i = getNumElements() - 1; i >= 0; --i) { mvRhs.insert(std::make_pair(inds[i], elems[i])); } std::map::const_iterator mvI = mv.begin(); std::map::const_iterator mvIlast = mv.end(); std::map::const_iterator mvIrhs = mvRhs.begin(); while (mvI != mvIlast) { if (mvI->first != mvIrhs->first || ! eq(mvI->second, mvIrhs->second)) return false; ++mvI; ++mvIrhs; } return true; } bool isEquivalent(const CoinPackedVectorBase& rhs) const; //@} /**@name Arithmetic operators. */ //@{ /// Create the dot product with a full vector double dotProduct(const double* dense) const; /// Return the 1-norm of the vector double oneNorm() const; /// Return the square of the 2-norm of the vector double normSquare() const; /// Return the 2-norm of the vector double twoNorm() const; /// Return the infinity-norm of the vector double infNorm() const; /// Sum elements of vector. double sum() const; //@} protected: /**@name Constructors, destructor NOTE: All constructors are protected. There's no need to expose them, after all, this is an abstract class. */ //@{ /** Default constructor. */ CoinPackedVectorBase(); public: /** Destructor */ virtual ~CoinPackedVectorBase(); //@} private: /**@name Disabled methods */ //@{ /** The copy constructor.
    This must be at least protected, but we make it private. The reason is that when, say, a shallow packed vector is created, first the underlying class, it this one is constructed. However, at that point we don't know how much of the data members of this class we need to copy over. Therefore the copy constructor is not used. */ CoinPackedVectorBase(const CoinPackedVectorBase&); /** This class provides const access to packed vectors, so there's no need to provide an assignment operator. */ CoinPackedVectorBase& operator=(const CoinPackedVectorBase&); //@} protected: /**@name Protected methods */ //@{ /// Find Maximum and Minimum Indices void findMaxMinIndices() const; /// Return indexSetPtr_ (create it if necessary). std::set * indexSet(const char* methodName = NULL, const char * className = NULL) const; /// Delete the indexSet void clearIndexSet() const; void clearBase() const; void copyMaxMinIndex(const CoinPackedVectorBase & x) const { maxIndex_ = x.maxIndex_; minIndex_ = x.minIndex_; } //@} private: /**@name Protected member data */ //@{ /// Contains max index value or -infinity mutable int maxIndex_; /// Contains minimum index value or infinity mutable int minIndex_; /** Store the indices in a set. This set is only created if it is needed. Its primary use is testing for duplicate indices. */ mutable std::set * indexSetPtr_; /** True if the vector should be tested for duplicate indices when they can occur. */ mutable bool testForDuplicateIndex_; /** True if the vector has already been tested for duplicate indices. Most of the operations in CoinPackedVector preserves this flag. */ mutable bool testedDuplicateIndex_; //@} }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveDual.cpp0000644000175000017500000014755612547436754020001 0ustar renerene/* $Id: CoinPresolveDual.cpp 1834 2015-07-09 09:25:00Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPresolveMatrix.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolveDual.hpp" #include "CoinMessage.hpp" #include "CoinHelperFunctions.hpp" #include "CoinFloatEqual.hpp" /* Define PRESOLVE_DEBUG and PRESOLVE_CONSISTENCY as compile flags! If not uniformly on across all uses of presolve code you'll get something between garbage and a core dump. See comments in CoinPresolvePsdebug.hpp */ #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif /* Set to > 0 to enable bound propagation on dual variables? This has been disabled for a good while. See notes in code. #define PRESOLVE_TIGHTEN_DUALS 1 */ /* Guards incorrect code that attempts to adjust a column solution. See comments with the code. Could possibly be fixed, which is why it hasn't been chopped out. #define REMOVE_DUAL_ACTION_REPAIR_SOLN 1 */ /* In this transform we're looking to prove bounds on the duals y and reduced costs cbar. We can use this in two ways. First, if we can prove a bound on the reduced cost cbar with strict inequality, * cbar > 0 ==> x NBLB at optimality * cbar < 0 ==> x NBUB at optimality If the required bound is not finite, the problem is unbounded. Andersen & Andersen call this a dominated column. Second, suppose we can show that cbar = -y is strictly nonzero for the logical s associated with some inequality i. (There must be exactly one finite row bound, so that the logical has exactly one finite bound which is 0). If cbar demands the logical be nonbasic at bound, it's zero, and we can convert the inequality to an equality. Not based on duals and reduced costs, but in the same vein, if we can identify an architectural x that'll accomplish the same goal (bring one constraint tight when moved in a favourable direction), we can make that constraint an equality. The conditions are different, however: * Moving x in the favourable direction tightens exactly one constraint. * The bound (l or u) in the favourable direction is infinite. * If x is entangled in any other constraints, moving x in the favourable direction loosens those constraints. A bit of thought and linear algebra is required to convince yourself that in the circumstances, cbar = c, hence we need only look at c to determine the favourable direction. To get from bounds on the duals to bounds on the reduced costs, note that cbar = c - (SUM{P}ay + SUM{M}ay) for P = {a > 0} and M = {a < 0}. Then cbarmin = c - (SUM{P}aymax + SUM{M}aymin) cbarmax = c - (SUM{P}aymin + SUM{M}aymax) As A&A note, the reverse implication also holds: * if l = -infty, cbar <= 0 at optimality * if u = infty, cbar >= 0 at optimality We can use this to run bound propagation on the duals in an attempt to tighten bounds and force more reduced costs to strict inequality. Suppose u = infty. Then cbar >= 0. It must be possible to achieve this, so cbarmax >= 0: 0 <= c - (SUM{P}aymin + SUM{M}aymax) Solve for y, a > 0: y <= 1/a[c - (SUM{P\t}aymin + SUM{M}aymax)] If a < 0, y >= 1/a[c - (SUM{P}aymin + SUM{M\t}aymax)] For l = -infty, cbar <= 0, hence cbarmin <= 0: 0 >= c - (SUM{P}aymax + SUM{M}aymin) Solve for y, a > 0: y >= 1/a[c - (SUM{P\t}aymax + SUM{M}aymin)] If a < 0, y <= 1/a[c - (SUM{P}aymax + SUM{M\t}aymin)] We can get initial bounds on ymin and ymax from column singletons x, where cbar = c - ay If u = infty, then at optimality 0 <= cbar = c - ay For a > 0 we have y <= c/a and for a < 0 we have y >= c/a We can do a similar calculation for l = -infty, so that 0 >= cbar = c - ay For a > 0 we have y >= c/a and for a < 0 we have y <= c/a A logical is a column singleton with c = 0.0 and |a| = 1.0. One or both bounds can be finite, depending on constraint representation. This code is hardwired for minimisation. Extensive rework of the second part of the routine Fall 2011 to add a postsolve transform to fix bug #67, incorrect status for logicals. -- lh, 111208 -- */ /* Original comments from 040916: This routine looks to be something of a work in progress. Down in the bound propagation loop, why do we only work with variables with u_j = infty? The corresponding section of code for l_j = -infty is ifdef'd away. l = -infty is uncommon; perhaps it's not worth the effort? Why exclude the code protected by PRESOLVE_TIGHTEN_DUALS? Why are we using ekkinf instead of PRESOLVE_INF? */ const CoinPresolveAction *remove_dual_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 std::cout << "Entering remove_dual_action::presolve, " << prob->nrows_ << "x" << prob->ncols_ << "." << std::endl ; # endif # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_sol(prob,2,1,1) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int startEmptyRows = 0 ; int startEmptyColumns = 0 ; startEmptyRows = prob->countEmptyRows() ; startEmptyColumns = prob->countEmptyCols() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0 ; if (prob->tuning_) startTime = CoinCpuTime() ; # endif # endif // column-major representation const int ncols = prob->ncols_ ; const CoinBigIndex *const mcstrt = prob->mcstrt_ ; const int *const hincol = prob->hincol_ ; const int *const hrow = prob->hrow_ ; const double *const colels = prob->colels_ ; const double *const cost = prob->cost_ ; // column type, bounds, solution, and status const unsigned char *const integerType = prob->integerType_ ; const double *const clo = prob->clo_ ; const double *const cup = prob->cup_ ; double *const csol = prob->sol_ ; unsigned char *&colstat = prob->colstat_ ; // row-major representation const int nrows = prob->nrows_ ; const CoinBigIndex *const mrstrt = prob->mrstrt_ ; const int *const hinrow = prob->hinrow_ ; const int *const hcol = prob->hcol_ ; # if 1 //REMOVE_DUAL_ACTION_REPAIR_SOLN > 0 const double *const rowels = prob->rowels_ ; # endif // row bounds double *const rlo = prob->rlo_ ; double *const rup = prob->rup_ ; // tolerances const double ekkinf2 = PRESOLVE_SMALL_INF ; const double ekkinf = ekkinf2*1.0e8 ; const double ztolcbarj = prob->ztoldj_ ; const CoinRelFltEq relEq(prob->ztolzb_) ; /* Grab one of the preallocated scratch arrays to hold min and max values of row duals. */ double *ymin = prob->usefulRowDouble_ ; double *ymax = ymin+nrows ; /* use arrays to say which bound active 1 - lower 2 - upper 4 - fixed 8 - don't touch */ char * active = reinterpret_cast(prob->usefulColumnInt_); int nOneBound=0; for (int j = 0 ; j < ncols ; j++) { char type; if (cup[j] >= ekkinf) { if(clo[j] <= -ekkinf) type=0; else type=1; } else { if(clo[j] <= -ekkinf) type=2; else if(clo[j] < cup[j]) type=3; else type=4; } if (type==1||type==2) nOneBound++; active[j]=type; } int nFreed=0; #define USE_ACTIVE 1 //#define PRESOLVE_DEBUG 2 for (int i = 0; i < nrows; i++) { const CoinBigIndex krs = mrstrt[i] ; const CoinBigIndex kre = krs + hinrow[i] ; int positive = 0 ; int negative = 0 ; int onlyPositive = -1 ; int onlyNegative = -1 ; for (CoinBigIndex k = krs ; k < kre ; k++) { const double coeff = rowels[k] ; const int icol = hcol[k] ; char type = active[icol]; const double lb = clo[icol] ; const double ub = cup[icol] ; if (type==0 || (type&8) != 0) { // free or already used positive=2; negative=2; break; } else if (type==1) { // lower bound active if (coeff > 0.0) { positive ++ ; } else { negative ++ ; } } else if (type==2) { // upper bound active if (coeff < 0.0) { positive ++ ; } else { negative ++ ; } } else if (type==3) { // both bounds active if (coeff > 0.0) { onlyPositive=k; positive ++ ; } else { onlyNegative=k; negative ++ ; } } else { // fixed } } bool doneSomething=false; if (onlyPositive>=0&&positive==1) { const double coeff = rowels[onlyPositive] ; const int icol = hcol[onlyPositive] ; const double lb = clo[icol] ; const double ub = cup[icol] ; // Get possible without icol double maxUp = 0.0 ; double maxDown = 0.0; #if USE_ACTIVE>2 printf("%d pos coeff %g bounds %g,%g rhs %g,%g - %d negative", icol,coeff,lb,ub,rlo[i],rup[i],negative); printf(", row is %g <= ",rlo[i]); #endif for (CoinBigIndex k = krs ; k < kre ; k++) { const int icol2 = hcol[k] ; #if USE_ACTIVE>2 printf("(%d,%g - bounds %g,%g) ",icol2,rowels[k], clo[icol2],cup[icol2]); #endif if (icol2==icol) continue; const double coeff2 = rowels[k] ; const double lb2 = clo[icol2] ; const double ub2 = cup[icol2] ; if (coeff2 > 0.0) { if (ub2>1.0e30) maxUp = COIN_DBL_MAX; else maxUp += coeff2*ub2; if (lb2<-1.0e30) maxDown = -COIN_DBL_MAX; else maxDown += coeff2*lb2; } else { if (lb2<-1.0e30) maxUp = COIN_DBL_MAX; else maxUp += coeff2*lb2; if (ub2>1.0e30) maxDown = -COIN_DBL_MAX; else maxDown += coeff2*ub2; } } double impliedLower = (rlo[i]-maxUp)/coeff; double impliedUpper = (rup[i]-maxDown)/coeff; #if USE_ACTIVE>2 printf("<= %g - implied l,u %g,%g\n",rup[i],impliedLower,impliedUpper); #endif if (impliedLower>lb-1.0e-7) { #if USE_ACTIVE==2 printf("%d pos coeff %g bounds %g,%g maxDown %g rhs %g,%g - %d negative\n", icol,coeff,lb,ub,maxDown,rlo[i],rup[i],negative); #endif #if USE_ACTIVE>1 printf("can take off lb as implied lower %g > %g\n",impliedLower,lb); #endif doneSomething=true; active[icol]=2+8; nFreed++; #define TRY_UPPER 3 #if TRY_UPPER > 1 } else if (impliedUpper 2 doneSomething=true; active[icol]=1+8; nFreed++; #endif #endif } else { #if 0 printf("cant take off lb as implied lower %g - ",impliedLower); printf("row is %g <= ",rlo[i]); for (CoinBigIndex k = krs ; k < kre ; k++) { const double coeff = rowels[k] ; const int icol = hcol[k] ; printf("(%d,%g) ",icol,coeff); } printf("<= %g\n",rup[i]); #endif } } if (onlyNegative>=0&&negative==1&&!doneSomething) { const double coeff = rowels[onlyNegative] ; const int icol = hcol[onlyNegative] ; const double lb = clo[icol] ; const double ub = cup[icol] ; // Get possible without icol double maxUp = 0.0 ; double maxDown = 0.0 ; #if USE_ACTIVE>2 printf("%d neg coeff %g bounds %g,%g rhs %g,%g - %d positive", icol,coeff,lb,ub,rlo[i],rup[i],positive); printf(", row is %g <= ",rlo[i]); #endif for (CoinBigIndex k = krs ; k < kre ; k++) { const int icol2 = hcol[k] ; #if USE_ACTIVE>2 printf("(%d,%g - bounds %g,%g) ",icol2,rowels[k], clo[icol2],cup[icol2]); #endif if (icol2==icol) continue; const double coeff2 = rowels[k] ; const double lb2 = clo[icol2] ; const double ub2 = cup[icol2] ; if (coeff2 > 0.0) { if (ub2>1.0e30) maxUp = COIN_DBL_MAX; else maxUp += coeff2*ub2; if (lb2<-1.0e30) maxDown = -COIN_DBL_MAX; else maxDown += coeff2*lb2; } else { if (lb2<-1.0e30) maxUp = COIN_DBL_MAX; else maxUp += coeff2*lb2; if (ub2>1.0e30) maxDown = -COIN_DBL_MAX; else maxDown += coeff2*ub2; } } double impliedLower = (rup[i]-maxDown)/coeff; double impliedUpper = (rlo[i]-maxUp)/coeff; #if USE_ACTIVE>2 printf("<= %g - implied l,u %g,%g\n",rup[i],impliedLower,impliedUpper); #endif int nOne=0; for (CoinBigIndex k = krs ; k < kre ; k++) { const double coeff = rowels[k] ; const int icol = hcol[k] ; if (hincol[icol]==1 && coeff>0.0) nOne++; } if (nOne>=hinrow[i]-1) { for (CoinBigIndex k = krs ; k < kre ; k++) { const int icol = hcol[k] ; const double coeff = rowels[k] ; if (hincol[icol]==1 && coeff>0.0) { #if USE_ACTIVE>2 printf("(%d has one entry) ",icol); #endif if (active[icol]==3 || clo[icol]<-1.0e30) nOne=0; // no good } } #if USE_ACTIVE>2 printf("\n"); #endif } if (impliedLower>lb-1.0e-7 /*&& nOne*/) { #if USE_ACTIVE>1 printf("second type can take off lb of %g on column %d as implied lower %g - effective upper %g, coeff %g on row %d\n",lb,icol,impliedLower,maxUp,coeff,i); #endif active[icol]=2+8; nFreed++; #if 0 //TRY_UPPER } else if (impliedLower>lb-1.0e-7 ) { printf("second type can't take off lb of %g on column %d as implied lower %g - effective upper %g, coeff %g on row %d\n",lb,icol,impliedLower,maxUp,coeff,i); #endif #if TRY_UPPER>1 } else if (impliedUpper 2 doneSomething=true; active[icol]=1+8; nFreed++; #endif #endif } } else if (!positive&&false) { printf("all negative %g <= ",rlo[i]); for (CoinBigIndex k = krs ; k < kre ; k++) { const double coeff = rowels[k] ; const int icol = hcol[k] ; printf("(%d,%g) ",icol,coeff); } printf("<= %g\n",rup[i]); } else if (!negative&&false) { printf("all positive %g <= ",rlo[i]); for (CoinBigIndex k = krs ; k < kre ; k++) { const double coeff = rowels[k] ; const int icol = hcol[k] ; printf("(%d,%g) ",icol,coeff); } printf("<= %g\n",rup[i]); } } //printf("%d had only one bound - %d added\n",nOneBound,nFreed); /* Initialise row dual min/max. The defaults are +/- infty, but if we know that the logical has no upper (lower) bound, it can only be nonbasic at the other bound. Given minimisation, we can conclude: * <= constraint ==> [0,infty] ==> NBLB ==> cbar > 0 ==> y < 0 * >= constraint ==> [-infty,0] ==> NBUB ==> cbar < 0 ==> y > 0 Range constraints are not helpful here, the dual can be either sign. There's no calculation because we assume the objective coefficient c = 0 and the coefficient a = 1.0, hence cbar = -y. */ for (int i = 0; i < nrows; i++) { const bool no_lb = (rup[i] >= ekkinf) ; const bool no_ub = (rlo[i] <= -ekkinf) ; ymin[i] = ((no_lb && !no_ub)?0.0:(-PRESOLVE_INF)) ; ymax[i] = ((no_ub && !no_lb)?0.0:PRESOLVE_INF) ; } /* We can do a similar calculation with singleton columns where the variable has only one finite bound, but we have to work a bit harder, as the cost coefficient c is not necessarily 0.0 and a is not necessarily 1.0. cbar = c - ya, hence y = c/a at cbar = 0. The question is whether this is an upper or lower bound on y. * x NBLB ==> cbar >= 0 a > 0 ==> increasing y decreases cbar ==> upper bound a < 0 ==> increasing y increases cbar ==> lower bound * x NBUB ==> cbar <= 0 a > 0 ==> increasing y decreases cbar ==> lower bound a < 0 ==> increasing y increases cbar ==> upper bound The condition below (simple test for equality to choose the bound) looks a bit odd, but a bit of boolean algebra should convince you it's correct. We have a bound; the only question is whether it's upper or lower. Skip integer variables; it's far too likely that we'll tighten infinite bounds elsewhere in presolve. NOTE: If bound propagation is applied to continuous variables, the same hazard will apply. -- lh, 110611 -- */ for (int j = 0 ; j < ncols ; j++) { if (integerType[j]) continue ; if (hincol[j] != 1) continue ; #ifndef USE_ACTIVE const bool no_ub = (cup[j] >= ekkinf) ; const bool no_lb = (clo[j] <= -ekkinf) ; #else const bool no_ub = (active[j]&6)==0 ; const bool no_lb = (active[j]&5)==0 ; #endif if (no_ub != no_lb) { const int &i = hrow[mcstrt[j]] ; double aij = colels[mcstrt[j]] ; PRESOLVEASSERT(fabs(aij) > ZTOLDP) ; const double yzero = cost[j]/aij ; if ((aij > 0.0) == no_ub) { if (ymax[i] > yzero) ymax[i] = yzero ; } else { if (ymin[i] < yzero) ymin[i] = yzero ; } } } int nfixup_cols = 0 ; int nfixdown_cols = ncols ; // Grab another work array, sized to ncols_ int *fix_cols = prob->usefulColumnInt_ ; # if PRESOLVE_TIGHTEN_DUALS > 0 double *cbarmin = new double[ncols] ; double *cbarmax = new double[ncols] ; # endif /* Now we have (admittedly weak) bounds on the dual for each row. We can use these to calculate upper and lower bounds on cbar. Open loops to take multiple passes over all columns. */ int nPass = 0 ; while (nPass++ < 100) { int tightened = 0 ; for (int j = 0 ; j < ncols ; j++) { if (hincol[j] <= 0) continue ; /* Calculate min cbar and max cbar for the column by calculating the contribution to c-ya using ymin and ymax from above. */ const CoinBigIndex &kcs = mcstrt[j] ; const CoinBigIndex kce = kcs + hincol[j] ; // Number of infinite rows int nflagu = 0 ; int nflagl = 0 ; // Number of ordinary rows int nordu = 0 ; int nordl = 0 ; double cbarjmin = cost[j] ; double cbarjmax = cbarjmin ; for (CoinBigIndex k = kcs ; k < kce ; k++) { const int &i = hrow[k] ; const double &aij = colels[k] ; const double mindelta = aij*ymin[i] ; const double maxdelta = aij*ymax[i] ; if (aij > 0.0) { if (ymin[i] >= -ekkinf2) { cbarjmax -= mindelta ; nordu++ ; } else { nflagu++ ; } if (ymax[i] <= ekkinf2) { cbarjmin -= maxdelta ; nordl++ ; } else { nflagl++ ; } } else { if (ymax[i] <= ekkinf2) { cbarjmax -= maxdelta ; nordu++ ; } else { nflagu++ ; } if (ymin[i] >= -ekkinf2) { cbarjmin -= mindelta ; nordl++ ; } else { nflagl++ ; } } } /* See if we can tighten bounds on a dual y. See the comments at the head of the file for the linear algebra. At this point, I don't understand the restrictions on propagation. Neither are necessary. The net effect is to severely restrict the circumstances where we'll propagate. Requiring nflagu == 1 excludes the case where all duals have finite bounds (unlikely?). And why cbarjmax < -ztolcbarj? In any event, we're looking for the row that's contributing the infinity. If a > 0, the contribution is due to ymin and we tighten ymax; a < 0, ymax and ymin, respectively. The requirement cbarjmax < (ymax[i]*aij-ztolcbarj) ensures we don't propagate tiny changes. If we make a change, it will affect cbarjmin. Make the adjustment immediately. Continuous variables only. */ if (!integerType[j]) { #ifndef USE_ACTIVE const bool no_cub = (cup[j] >= ekkinf) ; const bool no_clb = (clo[j] <= -ekkinf) ; #else const bool no_cub = (active[j]&6)==0 ; const bool no_clb = (active[j]&5)==0 ; #endif if (no_cub) { if (nflagu == 1 && cbarjmax < -ztolcbarj) { for (CoinBigIndex k = kcs ; k < kce; k++) { const int i = hrow[k] ; const double aij = colels[k] ; if (aij > 0.0 && ymin[i] < -ekkinf2) { if (cbarjmax < (ymax[i]*aij-ztolcbarj)) { const double newValue = cbarjmax/aij ; if (ymax[i] > ekkinf2 && newValue <= ekkinf2) { nflagl-- ; cbarjmin -= aij*newValue ; } else if (ymax[i] <= ekkinf2) { cbarjmin -= aij*(newValue-ymax[i]) ; } # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(infu/inf): u(" << j << ") = " << cup[j] << ": max y(" << i << ") was " << ymax[i] << " now " << newValue << "." << std::endl ; # endif ymax[i] = newValue ; tightened++ ; } } else if (aij < 0.0 && ymax[i] > ekkinf2) { if (cbarjmax < (ymin[i]*aij-ztolcbarj)) { const double newValue = cbarjmax/aij ; if (ymin[i] < -ekkinf2 && newValue >= -ekkinf2) { nflagl-- ; cbarjmin -= aij*newValue ; } else if (ymin[i] >= -ekkinf2) { cbarjmin -= aij*(newValue-ymin[i]) ; } # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(infu/inf): u(" << j << ") = " << cup[j] << ": min y(" << i << ") was " << ymin[i] << " now " << newValue << "." << std::endl ; # endif ymin[i] = newValue ; tightened++ ; // Huh? asymmetric // cbarjmin = 0.0 ; } } } } else if (nflagl == 0 && nordl == 1 && cbarjmin < -ztolcbarj) { /* This is a column singleton. Why are we doing this? It's not like changes to other y will affect this. */ for (CoinBigIndex k = kcs; k < kce; k++) { const int i = hrow[k] ; const double aij = colels[k] ; if (aij > 0.0) { # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(infu/sing): u(" << j << ") = " << cup[j] << ": max y(" << i << ") was " << ymax[i] << " now " << ymax[i]+cbarjmin/aij << "." << std::endl ; # endif ymax[i] += cbarjmin/aij ; cbarjmin = 0.0 ; tightened++ ; } else if (aij < 0.0 ) { # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(infu/sing): u(" << j << ") = " << cup[j] << ": min y(" << i << ") was " << ymin[i] << " now " << ymin[i]+cbarjmin/aij << "." << std::endl ; # endif ymin[i] += cbarjmin/aij ; cbarjmin = 0.0 ; tightened++ ; } } } } // end u = infty # if PROCESS_INFINITE_LB /* Unclear why this section is commented out, except for the possibility that bounds of -infty < x < something are rare and it likely suffered fromm the same errors. Consider the likelihood that this whole block needs to be edited to sway min/max, & similar. */ if (no_clb) { // cbarj can not be positive if (cbarjmin > ztolcbarj&&nflagl == 1) { // We can make bound finite one way for (CoinBigIndex k = kcs; k < kce; k++) { const int i = hrow[k] ; const double coeff = colels[k] ; if (coeff < 0.0&&ymin[i] < -ekkinf2) { // ymax[i] has upper bound if (cbarjmin>ymax[i]*coeff+ztolcbarj) { const double newValue = cbarjmin/coeff ; // re-compute hi if (ymax[i] > ekkinf2 && newValue <= ekkinf2) { nflagu-- ; cbarjmax -= coeff * newValue ; } else if (ymax[i] <= ekkinf2) { cbarjmax -= coeff * (newValue-ymax[i]) ; } ymax[i] = newValue ; tightened++ ; # if PRESOLVE_DEBUG > 1 printf("Col %d, row %d max pi now %g\n",j,i,ymax[i]) ; # endif } } else if (coeff > 0.0 && ymax[i] > ekkinf2) { // ymin[i] has lower bound if (cbarjmin>ymin[i]*coeff+ztolcbarj) { const double newValue = cbarjmin/coeff ; // re-compute lo if (ymin[i] < -ekkinf2 && newValue >= -ekkinf2) { nflagu-- ; cbarjmax -= coeff * newValue ; } else if (ymin[i] >= -ekkinf2) { cbarjmax -= coeff*(newValue-ymin[i]) ; } ymin[i] = newValue ; tightened++ ; # if PRESOLVE_DEBUG > 1 printf("Col %d, row %d min pi now %g\n",j,i,ymin[i]) ; # endif } } } } else if (nflagu == 0 && nordu == 1 && cbarjmax > ztolcbarj) { // We may be able to tighten for (CoinBigIndex k = kcs; k < kce; k++) { const int i = hrow[k] ; const double coeff = colels[k] ; if (coeff < 0.0) { ymax[i] += cbarjmax/coeff ; cbarjmax =0.0 ; tightened++ ; # if PRESOLVE_DEBUG > 1 printf("Col %d, row %d max pi now %g\n",j,i,ymax[i]) ; # endif } else if (coeff > 0.0 ) { ymin[i] += cbarjmax/coeff ; cbarjmax =0.0 ; tightened++ ; # if PRESOLVE_DEBUG > 1 printf("Col %d, row %d min pi now %g\n",j,i,ymin[i]) ; # endif } } } } // end l < -infty # endif // PROCESS_INFINITE_LB } /* That's the end of propagation of bounds for dual variables. */ # if PRESOLVE_TIGHTEN_DUALS > 0 cbarmin[j] = (nflagl?(-PRESOLVE_INF):cbarjmin) ; cbarmax[j] = (nflagu?PRESOLVE_INF:cbarjmax) ; # endif /* If cbarmin > 0 (strict inequality) then x NBLB at optimality. If l is -infinity, notify the user and set the status to unbounded. */ if (cbarjmin > ztolcbarj && nflagl == 0 && !prob->colProhibited2(j)) { if (clo[j] <= -ekkinf) { CoinMessageHandler *msghdlr = prob->messageHandler() ; msghdlr->message(COIN_PRESOLVE_COLUMNBOUNDB,prob->messages()) << j << CoinMessageEol ; prob->status_ |= 2 ; break ; } else { fix_cols[--nfixdown_cols] = j ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(fix l): fix x(" << j << ")" ; if (csol) std::cout << " = " << csol[j] ; std::cout << " at l(" << j << ") = " << clo[j] << "; cbar(" << j << ") > " << cbarjmin << "." << std::endl ; # endif if (csol) { # if REMOVE_DUAL_ACTION_REPAIR_SOLN > 0 /* Original comment: User may have given us feasible solution - move if simple Except it's not simple. The net result is that we end up with an excess of basic variables. Mark x NBLB and let the client recalculate the solution after establishing the basis. */ if (csol[j]-clo[j] > 1.0e-7 && hincol[j] == 1) { double value_j = colels[mcstrt[j]] ; double distance_j = csol[j]-clo[j] ; int row = hrow[mcstrt[j]] ; // See if another column can take value for (CoinBigIndex kk = mrstrt[row] ; kk < mrstrt[row]+hinrow[row] ; kk++) { const int k = hcol[kk] ; if (colstat[k] == CoinPrePostsolveMatrix::superBasic) continue ; if (hincol[k] == 1 && k != j) { const double value_k = rowels[kk] ; double movement ; if (value_k*value_j>0.0) { // k needs to increase double distance_k = cup[k]-csol[k] ; movement = CoinMin((distance_j*value_j)/value_k,distance_k) ; } else { // k needs to decrease double distance_k = clo[k]-csol[k] ; movement = CoinMax((distance_j*value_j)/value_k,distance_k) ; } if (relEq(movement,0)) continue ; csol[k] += movement ; if (relEq(csol[k],clo[k])) { colstat[k] = CoinPrePostsolveMatrix::atLowerBound ; } else if (relEq(csol[k],cup[k])) { colstat[k] = CoinPrePostsolveMatrix::atUpperBound ; } else if (colstat[k] != CoinPrePostsolveMatrix::isFree) { colstat[k] = CoinPrePostsolveMatrix::basic ; } printf("NDUAL: x<%d> moved %g to %g; ", k,movement,csol[k]) ; printf("lb = %g, ub = %g, status now %s.\n", clo[k],cup[k],columnStatusString(k)) ; distance_j -= (movement*value_k)/value_j ; csol[j] -= (movement*value_k)/value_j ; if (distance_j<1.0e-7) break ; } } } # endif // repair solution. csol[j] = clo[j] ; colstat[j] = CoinPrePostsolveMatrix::atLowerBound ; } } } else if (cbarjmax < -ztolcbarj && nflagu == 0 && !prob->colProhibited2(j)) { /* If cbarmax < 0 (strict inequality) then x NBUB at optimality. If u is infinity, notify the user and set the status to unbounded. */ if (cup[j] >= ekkinf) { CoinMessageHandler *msghdlr = prob->messageHandler() ; msghdlr->message(COIN_PRESOLVE_COLUMNBOUNDA,prob->messages()) << j << CoinMessageEol ; prob->status_ |= 2 ; break ; } else { fix_cols[nfixup_cols++] = j ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(fix u): fix x(" << j << ")" ; if (csol) std::cout << " = " << csol[j] ; std::cout << " at u(" << j << ") = " << cup[j] << "; cbar(" << j << ") < " << cbarjmax << "." << std::endl ; # endif if (csol) { # if 0 // See comments above for 'fix at lb'. if (cup[j]-csol[j] > 1.0e-7 && hincol[j] == 1) { double value_j = colels[mcstrt[j]] ; double distance_j = csol[j]-cup[j] ; int row = hrow[mcstrt[j]] ; // See if another column can take value for (CoinBigIndex kk = mrstrt[row] ; kk < mrstrt[row]+hinrow[row] ; kk++) { const int k = hcol[kk] ; if (colstat[k] == CoinPrePostsolveMatrix::superBasic) continue ; if (hincol[k] == 1 && k != j) { const double value_k = rowels[kk] ; double movement ; if (value_k*value_j<0.0) { // k needs to increase double distance_k = cup[k]-csol[k] ; movement = CoinMin((distance_j*value_j)/value_k,distance_k) ; } else { // k needs to decrease double distance_k = clo[k]-csol[k] ; movement = CoinMax((distance_j*value_j)/value_k,distance_k) ; } if (relEq(movement,0)) continue ; csol[k] += movement ; if (relEq(csol[k],clo[k])) { colstat[k] = CoinPrePostsolveMatrix::atLowerBound ; } else if (relEq(csol[k],cup[k])) { colstat[k] = CoinPrePostsolveMatrix::atUpperBound ; } else if (colstat[k] != CoinPrePostsolveMatrix::isFree) { colstat[k] = CoinPrePostsolveMatrix::basic ; } printf("NDUAL: x<%d> moved %g to %g; ", k,movement,csol[k]) ; printf("lb = %g, ub = %g, status now %s.\n", clo[k],cup[k],columnStatusString(k)) ; distance_j -= (movement*value_k)/value_j ; csol[j] -= (movement*value_k)/value_j ; if (distance_j>-1.0e-7) break ; } } } # endif csol[j] = cup[j] ; colstat[j] = CoinPrePostsolveMatrix::atUpperBound ; } } } // end cbar < 0 } /* That's the end of this walk through the columns. */ // I don't know why I stopped doing this. # if PRESOLVE_TIGHTEN_DUALS > 0 const double *rowels = prob->rowels_ ; const int *hcol = prob->hcol_ ; const CoinBigIndex *mrstrt = prob->mrstrt_ ; int *hinrow = prob->hinrow_ ; // tighten row dual bounds, as described on p. 229 for (int i = 0; i < nrows; i++) { const bool no_ub = (rup[i] >= ekkinf) ; const bool no_lb = (rlo[i] <= -ekkinf) ; if ((no_ub ^ no_lb) == true) { const CoinBigIndex krs = mrstrt[i] ; const CoinBigIndex kre = krs + hinrow[i] ; const double rmax = ymax[i] ; const double rmin = ymin[i] ; // all row columns are non-empty for (CoinBigIndex k = krs ; k < kre ; k++) { const double coeff = rowels[k] ; const int icol = hcol[k] ; const double cbarmax0 = cbarmax[icol] ; const double cbarmin0 = cbarmin[icol] ; if (no_ub) { // cbarj must not be negative if (coeff > ZTOLDP2 && cbarjmax0 < PRESOLVE_INF && cup[icol] >= ekkinf) { const double bnd = cbarjmax0 / coeff ; if (rmax > bnd) { # if PRESOLVE_DEBUG > 1 printf("MAX TIGHT[%d,%d]: %g --> %g\n",i,hrow[k],ymax[i],bnd) ; # endif ymax[i] = rmax = bnd ; tightened ++; ; } } else if (coeff < -ZTOLDP2 && cbarjmax0 = ekkinf) { const double bnd = cbarjmax0 / coeff ; if (rmin < bnd) { # if PRESOLVE_DEBUG > 1 printf("MIN TIGHT[%d,%d]: %g --> %g\n",i,hrow[k],ymin[i],bnd) ; # endif ymin[i] = rmin = bnd ; tightened ++; ; } } } else { // no_lb // cbarj must not be positive if (coeff > ZTOLDP2 && cbarmin0 > -PRESOLVE_INF && clo[icol] <= -ekkinf) { const double bnd = cbarmin0 / coeff ; if (rmin < bnd) { # if PRESOLVE_DEBUG > 1 printf("MIN1 TIGHT[%d,%d]: %g --> %g\n",i,hrow[k],ymin[i],bnd) ; # endif ymin[i] = rmin = bnd ; tightened ++; ; } } else if (coeff < -ZTOLDP2 && cbarmin0 > -PRESOLVE_INF && clo[icol] <= -ekkinf) { const double bnd = cbarmin0 / coeff ; if (rmax > bnd) { # if PRESOLVE_DEBUG > 1 printf("MAX TIGHT1[%d,%d]: %g --> %g\n",i,hrow[k],ymax[i],bnd) ; # endif ymax[i] = rmax = bnd ; tightened ++; ; } } } } } } # endif // PRESOLVE_TIGHTEN_DUALS /* Is it productive to continue with another pass? Essentially, we need lots of tightening but no fixing. If we fixed any variables, break and process them. */ # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL: pass " << nPass << ": fixed " << (ncols-nfixdown_cols) << " down, " << nfixup_cols << " up, tightened " << tightened << " duals." << std::endl ; # endif if (tightened < 100 || nfixdown_cols < ncols || nfixup_cols) break ; } assert (nfixup_cols <= nfixdown_cols) ; /* Process columns fixed at upper bound. */ if (nfixup_cols) { # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(upper):" ; for (int k = 0 ; k < nfixup_cols ; k++) std::cout << " " << fix_cols[k] ; std::cout << "." << std::endl ; # endif next = make_fixed_action::presolve(prob,fix_cols,nfixup_cols,false,next) ; } /* Process columns fixed at lower bound. */ if (nfixdown_cols < ncols) { int *fixdown_cols = fix_cols+nfixdown_cols ; nfixdown_cols = ncols-nfixdown_cols ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(lower):" ; for (int k = 0 ; k < nfixdown_cols ; k++) std::cout << " " << fixdown_cols[k] ; std::cout << "." << std::endl ; # endif next = make_fixed_action::presolve(prob,fixdown_cols, nfixdown_cols,true,next) ; } /* Now look for variables that, when moved in the favourable direction according to reduced cost, will naturally tighten an inequality to an equality. We can convert that inequality to an equality. See the comments at the head of the routine. Start with logicals. Open a loop and look for suitable rows. At the end of this loop, rows marked with +/-1 will be forced to equality by their logical. Rows marked with +/-2 are inequalities that (perhaps) can be forced to equality using architecturals. Rows marked with 0 are not suitable (range or nonbinding). Note that usefulRowInt_ is 3*nrows_; we'll use the second partition below. */ int *canFix = prob->usefulRowInt_ ; for (int i = 0 ; i < nrows ; i++) { const bool no_rlb = (rlo[i] <= -ekkinf) ; const bool no_rub = (rup[i] >= ekkinf) ; canFix[i] = 0 ; if (no_rub && !no_rlb ) { if (ymin[i] > 0.0) canFix[i] = -1 ; else canFix[i] = -2 ; } else if (no_rlb && !no_rub ) { if (ymax[i] < 0.0) canFix[i] = 1 ; else canFix[i] = 2 ; } # if PRESOLVE_DEBUG > 1 if (abs(canFix[i]) == 1) { std::cout << "NDUAL(eq): candidate row (" << i << ") (" << rlo[i] << "," << rup[i] << "), logical must be " << ((canFix[i] == -1)?"NBUB":"NBLB") << "." << std::endl ; } # endif } /* Can we do a similar trick with architectural variables? Here, we're looking for x such that (1) Exactly one of l or u is infinite. (2) Moving x towards the infinite bound can tighten exactly one constraint i to equality. If x is entangled with other constraints, moving x towards the infinite bound will loosen those constraints. (3) Moving x towards the infinite bound is a good idea according to the cost c (note we don't have to consider reduced cost here). If we can find a suitable x, constraint i can become an equality. This is yet another instance of bound propagation, but we're looking for a very specific pattern: A variable that can be increased arbitrarily in all rows it's entangled with, except for one, which bounds it. And we're going to push the variable so as to make that row an equality. But note what we're *not* doing: No actual comparison of finite bound values to the amount necessary to force an equality. So no worries about accuracy, the bane of bound propagation. Open a loop to scan columns. bindingUp and bindingDown indicate the result of the analysis; -1 says `possible', -2 is ruled out. Test first for condition (1). Column singletons are presumably handled elsewhere. Integer variables need not apply. If both bounds are finite, no need to look further. */ for (int j = 0 ; j < ncols ; j++) { if (hincol[j] <= 1) continue ; if (integerType[j]) continue ; int bindingUp = -1 ; int bindingDown = -1 ; if (cup[j] < ekkinf) bindingUp = -2 ; if (clo[j] > -ekkinf) bindingDown = -2 ; if (bindingUp == -2 && bindingDown == -2) continue ; /* Open a loop to walk the column and check for condition (2). The test for |canFix[i]| != 2 is a non-interference check. We don't want to mess with constraints where we've already decided to use the logical to force equality. Nor do we want to deal with range or nonbinding constraints. */ const CoinBigIndex &kcs = mcstrt[j] ; const CoinBigIndex kce = kcs+hincol[j] ; for (CoinBigIndex k = kcs; k < kce; k++) { const int &i = hrow[k] ; if (abs(canFix[i]) != 2) { bindingUp = -2 ; bindingDown = -2 ; break ; } double aij = colels[k] ; /* For a > 0 in a <= constraint (canFix = 2), the up direction is binding. For a >= constraint, it'll be the down direction. If the relevant binding code is still -1, set it to the index of the row. Similarly for a < 0. If this is the second or subsequent binding constraint in that direction, set binding[Up,Down] to -2 (we don't want to get into the business of calculating which constraint is actually binding). */ if (aij > 0.0) { if (canFix[i] == 2) { if (bindingUp == -1) bindingUp = i ; else bindingUp = -2 ; } else { if (bindingDown == -1) bindingDown = i ; else bindingDown = -2 ; } } else { if (canFix[i] == 2) { if (bindingDown == -1) bindingDown = i ; else bindingDown = -2 ; } else { if (bindingUp == -1) bindingUp = i ; else bindingUp = -2 ; } } } if (bindingUp == -2 && bindingDown == -2) continue ; /* If bindingUp > -2, then either no constraint provided a bound (-1) or there's a single constraint (0 <= i < m) that bounds x. If we have just one binding constraint, check that the reduced cost is favourable (c <= 0 for x NBUB at optimum for minimisation). If so, declare that we will force the row to equality (canFix[i] = +/-1). Note that we don't adjust the primal solution value for x. If no constraint provided a bound, we might be headed for unboundedness, but leave that for some other code to determine. */ double cj = cost[j] ; if (bindingUp > -2 && cj <= 0.0) { if (bindingUp >= 0) { canFix[bindingUp] /= 2 ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(eq): candidate row (" << bindingUp << ") (" << rlo[bindingUp] << "," << rup[bindingUp] << "), " << " increasing x(" << j << "), cbar = " << cj << "." << std::endl ; } else { std::cout << "NDUAL(eq): no binding upper bound for x(" << j << "), cbar = " << cj << "." << std::endl ; # endif } } else if (bindingDown > -2 && cj >= 0.0) { if (bindingDown >= 0) { canFix[bindingDown] /= 2 ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(eq): candidate row (" << bindingDown << ") (" << rlo[bindingDown] << "," << rup[bindingDown] << "), " << " decreasing x(" << j << "), cbar = " << cj << "." << std::endl ; } else { std::cout << "NDUAL(eq): no binding lower bound for x(" << j << "), cbar = " << cj << "." << std::endl ; # endif } } } /* We have candidate rows. We've avoided scanning full rows until now, but there's one remaining hazard: if the row contains unfixed integer variables then we don't want to just pin the row to a fixed rhs; that might prevent us from achieving integrality. Scan canFix, count and record suitable rows (use the second partition of usefulRowInt_). */ // get min max stuff - we can re-use ymin/ymax int * infCount = prob->usefulRowInt_+2*nrows; { // copied from CglProbing int i, j, k, kre; int krs; int iflagu, iflagl; double dmaxup, dmaxdown; for (i = 0; i < nrows; ++i) { if (rlo[i]==rup[i]) { infCount[i]=10|(10<<16); } else if (rlo[i]>-1.0e20||rup[i]<1.0e20) { iflagu = 0; iflagl = 0; dmaxup = 0.0; dmaxdown = 0.0; krs = mrstrt[i]; kre = mrstrt[i]+hinrow[i]; /* ------------------------------------------------------------*/ /* Compute L(i) and U(i) */ /* ------------------------------------------------------------*/ for (k = krs; k < kre; ++k) { double value=rowels[k]; j = hcol[k]; if (value > 0.0) { if (cup[j] < 1.0e12) dmaxup += cup[j] * value; else ++iflagu; if (clo[j] > -1.0e12) dmaxdown += clo[j] * value; else ++iflagl; } else if (value<0.0) { if (cup[j] < 1.0e12) dmaxdown += cup[j] * value; else ++iflagl; if (clo[j] > -1.0e12) dmaxup += clo[j] * value; else ++iflagu; } } iflagl = CoinMin(iflagl,2); iflagu = CoinMin(iflagu,2); infCount[i]=iflagl|(iflagu<<16); ymax[i]=dmaxup; ymin[i]=dmaxdown; } else { infCount[i]=10|(10<<16); } } } for (int j = 0 ; j < ncols ; j++) { if (hincol[j] == 1 && cost[j]>-1.0e10 ) { // can we make equality row double coeff = colels[mcstrt[j]]; int irow=hrow[mcstrt[j]]; int iflagl = infCount[irow]&63; int iflagu = infCount[irow]>>16; if (iflagu>1&&iflagl>1) continue; double dmaxdown = ymin[irow]; double dmaxup = ymax[irow]; #if USE_ACTIVE>1 printf("singleton col %d has %g on row %d - rhs %g,%g infs %d,%d maxes %g,%g\n", j,coeff,irow,rlo[irow],rup[irow], iflagl,iflagu, dmaxdown,dmaxup); #endif if (coeff>0.0) { if (clo[j]>-1.0e12) { dmaxdown -= coeff*clo[j]; if (iflagl) dmaxdown=-1.0e60; } else if (iflagl>1) { dmaxdown = -1.0e60; } if (cup[j]<1.0e12) { dmaxup -= coeff*cup[j]; if (iflagu) dmaxup=1.0e60; } else if (iflagu>1) { dmaxup = 1.0e60; } } else { } double rhs; if (cost[j]>0.0) { // we want as small as possible if (coeff>0) { if (rlo[irow]>-1.0e12) rhs = rlo[irow]/coeff; else rhs=-COIN_DBL_MAX; } else { if (rup[irow]<1.0e12) rhs = -rup[irow]/coeff; else rhs=COIN_DBL_MAX; } } else { // we want as large as possible if (coeff>0) { if (rup[irow]<1.0e12) { rhs = rup[irow]; if (cup[j]*coeff+dmaxdown>rhs-1.0e-7&& clo[j]*coeff+dmaxup1.0e30) { //printf("unbounded?\n"); } } } else { if (rlo[irow]>-1.0e12) { rhs = rlo[irow]; if (cup[j]*coeff+dmaxdownrhs-1.0e-7) { #if USE_ACTIVE>1 printf("singleton col %d has %g on row %d - rhs %g,%g infs %d,%d maxes %g,%g\n", j,coeff,irow,rlo[irow],rup[irow], iflagl,iflagu, dmaxdown,dmaxup); printf("making rlo equality\n"); #endif canFix[irow]=-11; infCount[irow]=10|(10<<16); } rhs /= coeff; } else { if (cup[j]*coeff+dmaxdown>1.0e30) { //printf("unbounded?\n"); } } } } #if USE_ACTIVE>1 printf("adjusted maxes %g,%g - rhs %g\n",dmaxdown,dmaxup,rhs); #endif } } # if 1 // PRESOLVE_DEBUG > 0 int makeEqCandCnt = 0 ; for (int i = 0 ; i < nrows ; i++) { if (abs(canFix[i]) == 1) makeEqCandCnt++ ; } # endif int makeEqCnt = nrows ; for (int i = 0 ; i < nrows ; i++) { if (abs(canFix[i]) == 1 && hinrow[i] >1 ) { const CoinBigIndex krs = mrstrt[i] ; const CoinBigIndex kre = krs+hinrow[i] ; int nBinary=0; int nOther=0; int nSameCoeff=0; double rhs = canFix[i]==1 ? rup[i] : rlo[i]; double firstCoeff=0.0; int j=-1; for (CoinBigIndex k = krs ; k < kre ; k++) { j = hcol[k] ; double coeff = rowels[k]; if (cup[j] > clo[j] ) { if (!firstCoeff) { firstCoeff=coeff; nSameCoeff=1; } else { if (coeff==firstCoeff) nSameCoeff++; else if (coeff!=-firstCoeff) nOther=1; } if(prob->colProhibited2(j)) { nBinary=1; nOther=1; break; } else if (integerType[j]) { if (clo[j]==0.0&&cup[j]==1.0) { nBinary++; } else { nBinary=1; nOther=1; break; } } else { nOther++; } } else { rhs -= coeff*clo[j]; } } bool canFixThis=true; if (nBinary) { if (nOther) { canFixThis = false ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(eq): cannot convert row " << i << " to equality; " << "unfixed integer variable x(" << j << ")." << std::endl ; # endif } else { // may be able to if all easy integer if (!rhs) { // for now just two of opposite sign if (nSameCoeff==1&&nBinary==2) { // ok # if PRESOLVE_DEBUG > 1 printf("int eq row is %g <= ",rlo[i]); for (CoinBigIndex k = krs ; k < kre ; k++) { const double coeff = rowels[k] ; const int icol = hcol[k] ; printf("(%d,%g - bounds %g,%g) ",icol,coeff,clo[icol],cup[icol]); } printf("<= %g\n",rup[i]); #endif } else { canFixThis = false ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(eq2): cannot convert row " << i << " to equality; " << "unfixed integer variable x(" << j << ")." << std::endl ; # endif } } else if (rhs==1.0 && canFix[i]==1 && nSameCoeff==nBinary && firstCoeff==1.0) { // ok # if PRESOLVE_DEBUG > 1 printf("int2 eq row is %g <= ",rlo[i]); for (CoinBigIndex k = krs ; k < kre ; k++) { const double coeff = rowels[k] ; const int icol = hcol[k] ; printf("(%d,%g - bounds %g,%g) ",icol,coeff,clo[icol],cup[icol]); } printf("<= %g\n",rup[i]); #endif } else { canFixThis = false ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(eq3): cannot convert row " << i << " to equality; " << "unfixed integer variable x(" << j << ")." << std::endl ; # endif } } } if (canFixThis) canFix[makeEqCnt++] = i ; } } makeEqCnt -= nrows ; # if PRESOLVE_DEBUG > 0 if ((makeEqCandCnt-makeEqCnt) > 0) { std::cout << "NDUAL(eq): rejected " << (makeEqCandCnt-makeEqCnt) << " rows due to unfixed integer variables." << std::endl ; } # endif /* If we've identified inequalities to convert, do the conversion, record the information needed to restore bounds in postsolve, and finally create the postsolve object. */ if (makeEqCnt > 0) { action *bndRecords = new action[makeEqCnt] ; for (int k = 0 ; k < makeEqCnt ; k++) { const int i = canFix[k+nrows] ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(eq): forcing row " << i << " to equality;" ; if (canFix[i] == -1) std::cout << " dropping b = " << rup[i] << " to " << rlo[i] ; else std::cout << " raising blow = " << rlo[i] << " to " << rup[i] ; std::cout << "." << std::endl ; # endif action &bndRec = bndRecords[(k)] ; bndRec.rlo_ = rlo[i] ; bndRec.rup_ = rup[i] ; bndRec.ndx_ = i ; if (canFix[i] == 1) { rlo[i] = rup[i] ; prob->addRow(i) ; } else if (canFix[i] == -1) { rup[i] = rlo[i] ; prob->addRow(i) ; } } next = new remove_dual_action(makeEqCnt,bndRecords,next) ; } # if PRESOLVE_TIGHTEN_DUALS > 0 delete[] cbarmin ; delete[] cbarmax ; # endif #undef PRESOLVE_DEBUG # if COIN_PRESOLVE_TUNING > 0 double thisTime = 0.0 ; if (prob->tuning_) thisTime = CoinCpuTime() ; # endif # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_sol(prob,2,1,1) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving remove_dual_action::presolve, dropped " << droppedRows << " rows, " << droppedColumns << " columns, forced " << makeEqCnt << " equalities" ; # if COIN_PRESOLVE_TUNING > 0 if (prob->tuning_) std::cout << " in " << (thisTime-prob->startTime_) << "s" ; # endif std::cout << "." << std::endl ; # endif return (next) ; } /* Postsolve: replace the original row bounds. The catch here is that each constraint was an equality in the presolved problem, with a logical s that had l = u = 0. We're about to convert the equality back to an inequality. One row bound will go to infinity, as will one of the bounds of the logical. We may need to patch the basis. The logical for a <= constraint cannot be NBUB, and the logical for a >= constraint cannot be NBLB. */ void remove_dual_action::postsolve (CoinPostsolveMatrix *prob) const { const action *const &bndRecords = actions_ ; const int &numRecs = nactions_ ; double *&rlo = prob->rlo_ ; double *&rup = prob->rup_ ; unsigned char *&rowstat = prob->rowstat_ ; # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering remove_dual_action::postsolve, " << numRecs << " bounds to restore." << std::endl ; # endif presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif /* For each record, restore the row bounds. If we have status arrays, check the status of the logical and adjust if necessary. In spite of the fact that the status array is an unsigned char array, we still need to use getRowStatus to make sure we're only looking at the bottom three bits. Why is this an issue? Because the status array isn't necessarily cleared to zeros, and setRowStatus carefully changes only the bottom three bits! */ for (int k = 0 ; k < numRecs ; k++) { const action &bndRec = bndRecords[k] ; const int &i = bndRec.ndx_ ; const double &rloi = bndRec.rlo_ ; const double &rupi = bndRec.rup_ ; # if PRESOLVE_DEBUG > 1 std::cout << "NDUAL(eq): row(" << i << ")" ; if (rlo[i] != rloi) std::cout << " LB " << rlo[i] << " -> " << rloi ; if (rup[i] != rupi) std::cout << " UB " << rup[i] << " -> " << rupi ; # endif rlo[i] = rloi ; rup[i] = rupi ; if (rowstat) { unsigned char stati = prob->getRowStatus(i) ; if (stati == CoinPresolveMatrix::atUpperBound) { if (rloi <= -PRESOLVE_INF) { rowstat[i] = CoinPresolveMatrix::atLowerBound ; # if PRESOLVE_DEBUG > 1 std::cout << ", status forced to " << statusName(static_cast(rowstat[i])) ; # endif } } else if (stati == CoinPresolveMatrix::atLowerBound) { if (rupi >= PRESOLVE_INF) { rowstat[i] = CoinPresolveMatrix::atUpperBound ; # if PRESOLVE_DEBUG > 1 std::cout << ", status forced to " << statusName(static_cast(rowstat[i])) ; # endif } } # if PRESOLVE_DEBUG > 2 else if (stati == CoinPresolveMatrix::basic) { std::cout << ", status is basic." ; } else if (stati == CoinPresolveMatrix::isFree) { std::cout << ", status is free?!" ; } else { unsigned int tmp = static_cast(stati) ; std::cout << ", status is invalid (" << tmp << ")!" ; } # endif } # if PRESOLVE_DEBUG > 1 std::cout << "." << std::endl ; # endif } # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving remove_dual_action::postsolve." << std::endl ; # endif # endif return ; } /* Destructor */ remove_dual_action::~remove_dual_action () { deleteAction(actions_,action*) ; } CoinMP-1.8.3/CoinUtils/src/CoinPresolveDoubleton.cpp0000644000175000017500000013100112122060536020775 0ustar renerene/* $Id: CoinPresolveDoubleton.cpp 1580 2013-03-19 13:00:14Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinFinite.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" #include "CoinPresolveEmpty.hpp" // for DROP_COL/DROP_ROW #include "CoinPresolveZeros.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolveDoubleton.hpp" #include "CoinPresolvePsdebug.hpp" #include "CoinMessage.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif namespace { /* begin unnamed local namespace */ #if PRESOLVE_DEBUG > 0 #define DBGPARAM(zz_param_zz) zz_param_zz #else #define DBGPARAM(zz_param_zz) #endif /* This routine does the grunt work needed to substitute x for y in all rows i where coeff[i,y] != 0. Given ax + by = c, we have y = (c - a*x)/b = c/b + (-a/b)*x Suppose we're fixing row i. We need to adjust the row bounds by -coeff[i,y]*(c/b) and coeff[i,x] by coeff[i,y]*(-a/b). The value c/b is passed as the bounds_factor, and -a/b as the coeff_factor. row0 is the doubleton row. It is assumed that coeff[row0,y] has been removed from the column major representation before this routine is called. (Otherwise, we'd have to check for it to avoid a useless row update.) Both the row and col representations are updated. There are two cases: * coeff[i,x] != 0: in the column rep, modify coeff[i,x] ; in the row rep, modify coeff[i,x] and drop coeff[i,y]. * coeff[i,x] == 0 (i.e., non-existent): in the column rep, add coeff[i,x]; mcstrt is modified if the column must be moved ; in the row rep, convert coeff[i,y] to coeff[i,x]. The row and column reps are inconsistent during the routine and at completion. In the row rep, column x and y are updated except for the doubleton row, and in the column rep only column x is updated except for coeff[row0,x]. On return, column y and row row0 will be deleted and consistency will be restored. */ bool elim_doubleton (const char *DBGPARAM(msg), CoinBigIndex *mcstrt, double *rlo, double *rup, double *colels, int *hrow, int *hcol, int *hinrow, int *hincol, presolvehlink *clink, int ncols, CoinBigIndex *mrstrt, double *rowels, double coeff_factor, double bounds_factor, int DBGPARAM(row0), int icolx, int icoly) { CoinBigIndex kcsx = mcstrt[icolx] ; CoinBigIndex kcex = kcsx + hincol[icolx] ; # if PRESOLVE_DEBUG > 1 printf("%s %d x=%d y=%d cf=%g bf=%g nx=%d yrows=(", msg, row0, icolx, icoly, coeff_factor, bounds_factor, hincol[icolx]) ; # endif /* Open a loop to scan column y. For each nonzero coefficient (row,y), update column x and the row bounds for the row. The initial assert checks that we're properly updating column x. */ CoinBigIndex base = mcstrt[icoly] ; int numberInY = hincol[icoly] ; for (int kwhere = 0 ; kwhere < numberInY ; kwhere++) { PRESOLVEASSERT(kcex == kcsx+hincol[icolx]) ; const CoinBigIndex kcoly = base+kwhere ; const int row = hrow[kcoly] ; const double coeffy = colels[kcoly] ; double delta = coeffy*coeff_factor ; /* Look for coeff[row,x], then update accordingly. */ CoinBigIndex kcolx = presolve_find_row1(row,kcsx,kcex,hrow) ; # if PRESOLVE_DEBUG > 1 printf("%d%s ",row,(kcolx < kcex)?"+":"") ; # endif /* Case 1: coeff[i,x] != 0: update it in column and row reps; drop coeff[i,y] from row rep. */ if (kcolx < kcex) { colels[kcolx] += delta ; const CoinBigIndex kmi = presolve_find_col(icolx,mrstrt[row],mrstrt[row]+hinrow[row],hcol) ; rowels[kmi] = colels[kcolx] ; presolve_delete_from_row(row,icoly,mrstrt,hinrow,hcol,rowels) ; /* Case 2: coeff[i,x] == 0: add it in the column rep; convert coeff[i,y] in the row rep. presolve_expand_col ensures an empty entry exists at the end of the column. The location of column x may change with expansion. */ } else { const bool no_mem = presolve_expand_col(mcstrt,colels,hrow,hincol, clink,ncols,icolx) ; if (no_mem) return (true) ; kcsx = mcstrt[icolx] ; kcex = kcsx+hincol[icolx] ; // recompute y as well base = mcstrt[icoly] ; hrow[kcex] = row ; colels[kcex] = delta ; hincol[icolx]++ ; kcex++ ; CoinBigIndex k2 = presolve_find_col(icoly,mrstrt[row],mrstrt[row]+hinrow[row],hcol) ; hcol[k2] = icolx ; rowels[k2] = delta ; } /* Update the row bounds, if necessary. Avoid updating finite infinity. */ if (bounds_factor != 0.0) { delta = coeffy*bounds_factor ; if (-PRESOLVE_INF < rlo[row]) rlo[row] -= delta ; if (rup[row] < PRESOLVE_INF) rup[row] -= delta ; } } # if PRESOLVE_DEBUG > 1 printf(")\n") ; # endif return (false) ; } #if PRESOLVE_DEBUG > 0 /* Debug helpers */ double *doubleton_mult ; int *doubleton_id ; void check_doubletons (const CoinPresolveAction *paction) { const CoinPresolveAction * paction0 = paction ; if (paction) { check_doubletons(paction->next) ; if (strcmp(paction0->name(),"doubleton_action") == 0) { const doubleton_action *daction = dynamic_cast(paction0) ; for (int i = daction->nactions_-1 ; i >= 0 ; --i) { int icolx = daction->actions_[i].icolx ; int icoly = daction->actions_[i].icoly ; double coeffx = daction->actions_[i].coeffx ; double coeffy = daction->actions_[i].coeffy ; doubleton_mult[icoly] = -coeffx/coeffy ; doubleton_id[icoly] = icolx ; } } } } void check_doubletons1(const CoinPresolveAction * paction, int ncols) { doubleton_mult = new double[ncols] ; doubleton_id = new int[ncols] ; int i ; for ( i=0; i fabs(mult)) { minmult = fabs(mult) ; minid = i ; } } } if (minid != -1) printf("MIN MULT: %d %g\n", minid, minmult) ; } #endif // PRESOLVE_DEBUG } /* end unnamed local namespace */ /* It is always the case that one of the variables of a doubleton is, or can be made, implied free, but neither will necessarily be a singleton. Since in the case of a doubleton the number of non-zero entries will never increase if one is eliminated, it makes sense to always eliminate them. The col rep and row rep must be consistent. */ const CoinPresolveAction *doubleton_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering doubleton_action::presolve; considering " << prob->numberRowsToDo_ << " rows." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int startEmptyRows = 0 ; int startEmptyColumns = 0 ; startEmptyRows = prob->countEmptyRows() ; startEmptyColumns = prob->countEmptyCols() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0 ; if (prob->tuning_) startTime = CoinCpuTime() ; # endif # endif const int n = prob->ncols_ ; const int m = prob->nrows_ ; /* Unpack column-major and row-major representations, along with rim vectors. */ CoinBigIndex *colStarts = prob->mcstrt_ ; int *colLengths = prob->hincol_ ; double *colCoeffs = prob->colels_ ; int *rowIndices = prob->hrow_ ; presolvehlink *clink = prob->clink_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; CoinBigIndex *rowStarts = prob->mrstrt_ ; int *rowLengths = prob->hinrow_ ; double *rowCoeffs = prob->rowels_ ; int *colIndices = prob->hcol_ ; presolvehlink *rlink = prob->rlink_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; const unsigned char *integerType = prob->integerType_ ; double *cost = prob->cost_ ; int numberLook = prob->numberRowsToDo_ ; int *look = prob->rowsToDo_ ; const double ztolzb = prob->ztolzb_ ; const double ztolzero = 1.0e-12 ; action *actions = new action [m] ; int nactions = 0 ; /* zeros will hold columns that should be groomed to remove explicit zeros when we're finished. fixed will hold columns that have ended up as fixed variables. */ int *zeros = prob->usefulColumnInt_ ; int nzeros = 0 ; int *fixed = zeros+n ; int nfixed = 0 ; unsigned char *rowstat = prob->rowstat_ ; double *acts = prob->acts_ ; double *sol = prob->sol_ ; /* More like `ignore infeasibility'. */ bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; /* Open the main loop to scan for doubleton candidates. */ for (int iLook = 0 ; iLook < numberLook ; iLook++) { const int tgtrow = look[iLook] ; /* We need an equality with two coefficients. Avoid isolated constraints, lest both variables vanish. Failure of the assert indicates that the row- and column-major representations are out of sync. */ if ((rowLengths[tgtrow] != 2) || (fabs(rup[tgtrow]-rlo[tgtrow]) > ZTOLDP)) continue ; const CoinBigIndex krs = rowStarts[tgtrow] ; int tgtcolx = colIndices[krs] ; int tgtcoly = colIndices[krs+1] ; PRESOLVEASSERT(colLengths[tgtcolx] > 0 || colLengths[tgtcoly] > 0) ; if (colLengths[tgtcolx] == 1 && colLengths[tgtcoly] == 1) continue ; /* Avoid prohibited columns and fixed columns. Make sure the coefficients are nonzero. JJF - test should allow one to be prohibited as long as you leave that one. I modified earlier code but hope I have got this right. */ if (prob->colProhibited(tgtcolx) && prob->colProhibited(tgtcoly)) continue ; if (fabs(rowCoeffs[krs]) < ZTOLDP2 || fabs(rowCoeffs[krs+1]) < ZTOLDP2) continue ; if ((fabs(cup[tgtcolx]-clo[tgtcolx]) < ZTOLDP) || (fabs(cup[tgtcoly]-clo[tgtcoly]) < ZTOLDP)) continue ; # if PRESOLVE_DEBUG > 2 std::cout << " row " << tgtrow << " colx " << tgtcolx << " coly " << tgtcoly << " passes preliminary eval." << std::endl ; # endif /* Find this row in each column. The indices are not const because we may flip them below, once we decide which column will be eliminated. */ CoinBigIndex krowx = presolve_find_row(tgtrow,colStarts[tgtcolx], colStarts[tgtcolx]+colLengths[tgtcolx],rowIndices) ; double coeffx = colCoeffs[krowx] ; CoinBigIndex krowy = presolve_find_row(tgtrow,colStarts[tgtcoly], colStarts[tgtcoly]+colLengths[tgtcoly],rowIndices) ; double coeffy = colCoeffs[krowy] ; const double rhs = rlo[tgtrow] ; /* Avoid obscuring a requirement for integrality. If only one variable is integer, keep it and substitute for the continuous variable. If both are integer, substitute only for the forms x = k*y (k integral and non-empty intersection on bounds on x) or x = 1-y, where both x and y are binary. flag bits for integerStatus: 0x01: x integer; 0x02: y integer This bit of code works because 0 is continuous, 1 is integer. Make sure that's true. */ assert((integerType[tgtcolx] == 0) || (integerType[tgtcolx] == 1)) ; assert((integerType[tgtcoly] == 0) || (integerType[tgtcoly] == 1)) ; int integerX = integerType[tgtcolx]; int integerY = integerType[tgtcoly]; /* if one prohibited then treat that as integer. This may be pessimistic - but will catch SOS etc */ if (prob->colProhibited2(tgtcolx)) integerX=1; if (prob->colProhibited2(tgtcoly)) integerY=1; int integerStatus = (integerY<<1)|integerX ; if (integerStatus == 3) { int good = 0 ; double rhs2 = rhs ; if (coeffx < 0.0) { coeffx = -coeffx ; rhs2 += 1 ; } if ((cup[tgtcolx] == 1.0) && (clo[tgtcolx] == 0.0) && (fabs(coeffx-1.0) < 1.0e-7) && !prob->colProhibited2(tgtcoly)) good = 1 ; if (coeffy < 0.0) { coeffy = -coeffy ; rhs2 += 1 ; } if ((cup[tgtcoly] == 1.0) && (clo[tgtcoly] == 0.0) && (fabs(coeffy-1.0) < 1.0e-7) && !prob->colProhibited2(tgtcolx)) good |= 2 ; if (!(good == 3 && fabs(rhs2-1.0) < 1.0e-7)) integerStatus = -1 ; /* Not x+y = 1. Try for ax+by = 0 */ if (integerStatus < 0 && rhs == 0.0) { coeffx = colCoeffs[krowx] ; coeffy = colCoeffs[krowy] ; double ratio ; bool swap = false ; if (fabs(coeffx) > fabs(coeffy)) { ratio = coeffx/coeffy ; } else { ratio = coeffy/coeffx ; swap = true ; } ratio = fabs(ratio) ; if (fabs(ratio-floor(ratio+0.5)) < ztolzero) { integerStatus = swap ? 2 : 1 ; } } /* One last try --- just require an integral substitution formula. But ax+by = 0 above is a subset of ax+by = c below and should pass the test below. For that matter, so will x+y = 1. Why separate special cases above? -- lh, 121106 -- */ if (integerStatus < 0) { bool canDo = false ; coeffx = colCoeffs[krowx] ; coeffy = colCoeffs[krowy] ; double ratio ; bool swap = false ; double rhsRatio ; if (fabs(coeffx) > fabs(coeffy)) { ratio = coeffx/coeffy ; rhsRatio = rhs/coeffx ; } else { ratio = coeffy/coeffx ; rhsRatio = rhs/coeffy ; swap = true ; } ratio = fabs(ratio) ; if (fabs(ratio-floor(ratio+0.5)) < ztolzero) { // possible integerStatus = swap ? 2 : 1 ; // but check rhs if (rhsRatio==floor(rhsRatio+0.5)) canDo=true ; } # ifdef COIN_DEVELOP2 if (canDo) printf("Good CoinPresolveDoubleton tgtcolx %d (%g and bounds %g %g) tgtcoly %d (%g and bound %g %g) - rhs %g\n", tgtcolx,colCoeffs[krowx],clo[tgtcolx],cup[tgtcolx], tgtcoly,colCoeffs[krowy],clo[tgtcoly],cup[tgtcoly],rhs) ; else printf("Bad CoinPresolveDoubleton tgtcolx %d (%g) tgtcoly %d (%g) - rhs %g\n", tgtcolx,colCoeffs[krowx],tgtcoly,colCoeffs[krowy],rhs) ; # endif if (!canDo) continue ; } } /* We've resolved integrality concerns. If we concluded that we need to switch the roles of x and y because of integrality, do that now. If both variables are continuous, we may still want to swap for numeric stability. Eliminate the variable with the larger coefficient. */ if (integerStatus == 2) { CoinSwap(tgtcoly,tgtcolx) ; CoinSwap(krowy,krowx) ; } else if (integerStatus == 0) { if (fabs(colCoeffs[krowy]) < fabs(colCoeffs[krowx])) { CoinSwap(tgtcoly,tgtcolx) ; CoinSwap(krowy,krowx) ; } } /* Don't eliminate y just yet if it's entangled in a singleton row (we want to capture that explicit bound in a column bound). */ const CoinBigIndex kcsy = colStarts[tgtcoly] ; const CoinBigIndex kcey = kcsy+colLengths[tgtcoly] ; bool singletonRow = false ; for (CoinBigIndex kcol = kcsy ; kcol < kcey ; kcol++) { if (rowLengths[rowIndices[kcol]] == 1) { singletonRow = true ; break ; } } // skip if y prohibited if (singletonRow || prob->colProhibited2(tgtcoly)) continue ; coeffx = colCoeffs[krowx] ; coeffy = colCoeffs[krowy] ; # if PRESOLVE_DEBUG > 2 std::cout << " doubleton row " << tgtrow << ", keep x(" << tgtcolx << ") elim x(" << tgtcoly << ")." << std::endl ; # endif PRESOLVE_DETAIL_PRINT(printf("pre_doubleton %dC %dC %dR E\n", tgtcoly,tgtcolx,tgtrow)) ; /* Capture the existing columns and other information before we start to modify the constraint system. Save the shorter column. */ action *s = &actions[nactions] ; nactions++ ; s->row = tgtrow ; s->icolx = tgtcolx ; s->clox = clo[tgtcolx] ; s->cupx = cup[tgtcolx] ; s->costx = cost[tgtcolx] ; s->icoly = tgtcoly ; s->costy = cost[tgtcoly] ; s->rlo = rlo[tgtrow] ; s->coeffx = coeffx ; s->coeffy = coeffy ; s->ncolx = colLengths[tgtcolx] ; s->ncoly = colLengths[tgtcoly] ; if (s->ncoly < s->ncolx) { s->colel = presolve_dupmajor(colCoeffs,rowIndices,colLengths[tgtcoly], colStarts[tgtcoly],tgtrow) ; s->ncolx = 0 ; } else { s->colel = presolve_dupmajor(colCoeffs,rowIndices,colLengths[tgtcolx], colStarts[tgtcolx],tgtrow) ; s->ncoly = 0 ; } /* Move finite bound information from y to x, so that y is implied free. a x + b y = c l1 <= x <= u1 l2 <= y <= u2 l2 <= (c - a x) / b <= u2 b/-a > 0 ==> (b l2 - c) / -a <= x <= (b u2 - c) / -a b/-a < 0 ==> (b u2 - c) / -a <= x <= (b l2 - c) / -a */ { double lo1 = -PRESOLVE_INF ; double up1 = PRESOLVE_INF ; if (-PRESOLVE_INF < clo[tgtcoly]) { if (coeffx*coeffy < 0) lo1 = (coeffy*clo[tgtcoly]-rhs)/-coeffx ; else up1 = (coeffy*clo[tgtcoly]-rhs)/-coeffx ; } if (cup[tgtcoly] < PRESOLVE_INF) { if (coeffx*coeffy < 0) up1 = (coeffy*cup[tgtcoly]-rhs)/-coeffx ; else lo1 = (coeffy*cup[tgtcoly]-rhs)/-coeffx ; } /* Don't forget the objective coefficient. costy y = costy ((c - a x) / b) = (costy c)/b + x (costy -a)/b */ cost[tgtcolx] += (cost[tgtcoly]*-coeffx)/coeffy ; prob->change_bias((cost[tgtcoly]*rhs)/coeffy) ; /* The transfer of bounds could make x infeasible. Patch it up if the problem is minor or if the user was so incautious as to instruct us to ignore it. Prefer an integer value if there's one nearby. If there's nothing to be done, break out of the main loop. */ { double lo2 = CoinMax(clo[tgtcolx],lo1) ; double up2 = CoinMin(cup[tgtcolx],up1) ; if (lo2 > up2) { if (lo2 <= up2+prob->feasibilityTolerance_ || fixInfeasibility) { double nearest = floor(lo2+0.5) ; if (fabs(nearest-lo2) < 2.0*prob->feasibilityTolerance_) { lo2 = nearest ; up2 = nearest ; } else { lo2 = up2 ; } } else { prob->status_ |= 1 ; prob->messageHandler()->message(COIN_PRESOLVE_COLINFEAS, prob->messages()) << tgtcolx << lo2 << up2 << CoinMessageEol ; break ; } } # if PRESOLVE_DEBUG > 2 std::cout << " x(" << tgtcolx << ") lb " << clo[tgtcolx] << " --> " << lo2 << ", ub " << cup[tgtcolx] << " --> " << up2 << std::endl ; # endif clo[tgtcolx] = lo2 ; cup[tgtcolx] = up2 ; /* Do we have a solution to maintain? If so, take a stab at it. If x ends up at bound, prefer to set it nonbasic, but if we're short of basic variables after eliminating y and the logical for the row, make it basic. This code will snap the value of x to bound if it's within the primal feasibility tolerance. */ if (rowstat && sol) { int numberBasic = 0 ; double movement = 0 ; if (prob->columnIsBasic(tgtcolx)) numberBasic++ ; if (prob->columnIsBasic(tgtcoly)) numberBasic++ ; if (prob->rowIsBasic(tgtrow)) numberBasic++ ; if (sol[tgtcolx] <= lo2+ztolzb) { movement = lo2-sol[tgtcolx] ; sol[tgtcolx] = lo2 ; prob->setColumnStatus(tgtcolx, CoinPrePostsolveMatrix::atLowerBound) ; } else if (sol[tgtcolx] >= up2-ztolzb) { movement = up2-sol[tgtcolx] ; sol[tgtcolx] = up2 ; prob->setColumnStatus(tgtcolx, CoinPrePostsolveMatrix::atUpperBound) ; } if (numberBasic > 1) prob->setColumnStatus(tgtcolx,CoinPrePostsolveMatrix::basic) ; /* We need to compensate if x was forced to move. Beyond that, even if x didn't move, we've forced y = (c-ax)/b, and that might not have been true before. So even if x didn't move, y may have moved. Note that the constant term c/b is subtracted out as the constraints are modified, so we don't include it when calculating movement for y. */ if (movement) { const CoinBigIndex kkcsx = colStarts[tgtcolx] ; const CoinBigIndex kkcex = kkcsx+colLengths[tgtcolx] ; for (CoinBigIndex kcol = kkcsx ; kcol < kkcex ; kcol++) { int row = rowIndices[kcol] ; if (rowLengths[row]) acts[row] += movement*colCoeffs[kcol] ; } } movement = ((-coeffx*sol[tgtcolx])/coeffy)-sol[tgtcoly] ; if (movement) { const CoinBigIndex kkcsy = colStarts[tgtcoly] ; const CoinBigIndex kkcey = kkcsy+colLengths[tgtcoly] ; for (CoinBigIndex kcol = kkcsy ; kcol < kkcey ; kcol++) { int row = rowIndices[kcol] ; if (rowLengths[row]) acts[row] += movement*colCoeffs[kcol] ; } } } if (lo2 == up2) fixed[nfixed++] = tgtcolx ; } } /* We're done transferring bounds from y to x, and we've patched up the solution if one existed to patch. One last thing to do before we eliminate column y and the doubleton row: put column x and the entangled rows on the lists of columns and rows to look at in the next round of transforms. */ { prob->addCol(tgtcolx) ; const CoinBigIndex kkcsy = colStarts[tgtcoly] ; const CoinBigIndex kkcey = kkcsy+colLengths[tgtcoly] ; for (CoinBigIndex kcol = kkcsy ; kcol < kkcey ; kcol++) { int row = rowIndices[kcol] ; prob->addRow(row) ; } const CoinBigIndex kkcsx = colStarts[tgtcolx] ; const CoinBigIndex kkcex = kkcsx+colLengths[tgtcolx] ; for (CoinBigIndex kcol = kkcsx ; kcol < kkcex ; kcol++) { int row = rowIndices[kcol] ; prob->addRow(row) ; } } /* Empty tgtrow in the column-major matrix. Deleting the coefficient for (tgtrow,tgtcoly) is a bit costly (given that we're about to drop the whole column), but saves the trouble of checking for it in elim_doubleton. */ presolve_delete_from_col(tgtrow,tgtcolx, colStarts,colLengths,rowIndices,colCoeffs) ; presolve_delete_from_col(tgtrow,tgtcoly, colStarts,colLengths,rowIndices,colCoeffs) ; /* Drop tgtrow in the row-major representation: set the length to 0 and reclaim the major vector space in bulk storage. */ rowLengths[tgtrow] = 0 ; PRESOLVE_REMOVE_LINK(rlink,tgtrow) ; /* Transfer the colx factors to coly. This modifies coefficients in column x as it removes coefficients in column y. */ bool no_mem = elim_doubleton("ELIMD", colStarts,rlo,rup,colCoeffs, rowIndices,colIndices,rowLengths,colLengths, clink,n, rowStarts,rowCoeffs, -coeffx/coeffy, rhs/coeffy, tgtrow,tgtcolx,tgtcoly) ; if (no_mem) throwCoinError("out of memory","doubleton_action::presolve") ; /* Eliminate coly entirely from the col rep. We'll want to groom colx to remove explicit zeros. */ colLengths[tgtcoly] = 0 ; PRESOLVE_REMOVE_LINK(clink, tgtcoly) ; cost[tgtcoly] = 0.0 ; rlo[tgtrow] = 0.0 ; rup[tgtrow] = 0.0 ; zeros[nzeros++] = tgtcolx ; # if PRESOLVE_CONSISTENCY > 0 presolve_consistent(prob) ; presolve_links_ok(prob) ; # endif } /* Tidy up the collected actions and clean up explicit zeros and fixed variables. Don't bother unless we're feasible (status of 0). */ if (nactions && !prob->status_) { # if PRESOLVE_SUMMARY > 0 printf("NDOUBLETONS: %d\n", nactions) ; # endif action *actions1 = new action[nactions] ; CoinMemcpyN(actions, nactions, actions1) ; next = new doubleton_action(nactions, actions1, next) ; if (nzeros) next = drop_zero_coefficients_action::presolve(prob, zeros, nzeros, next) ; if (nfixed) next = remove_fixed_action::presolve(prob, fixed, nfixed, next) ; } deleteAction(actions,action*) ; # if COIN_PRESOLVE_TUNING > 0 if (prob->tuning_) double thisTime = CoinCpuTime() ; # endif # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_sol(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving doubleton_action::presolve, " << droppedRows << " rows, " << droppedColumns << " columns dropped" ; # if COIN_PRESOLVE_TUNING > 0 std::cout << " in " << thisTime-startTime << "s" ; # endif std::cout << "." << std::endl ; # endif return (next) ; } /* Reintroduce the column (y) and doubleton row (irow) removed in presolve. Correct the other column (x) involved in the doubleton, update the solution, etc. A fair amount of complication arises because the presolve transform saves the shorter of x or y. Postsolve thus includes portions to restore either. */ void doubleton_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_ ; const int nactions = nactions_ ; double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; int *link = prob->link_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *dcost = prob->cost_ ; double *sol = prob->sol_ ; double *acts = prob->acts_ ; double *rowduals = prob->rowduals_ ; double *rcosts = prob->rcosts_ ; unsigned char *colstat = prob->colstat_ ; unsigned char *rowstat = prob->rowstat_ ; const double maxmin = prob->maxmin_ ; CoinBigIndex &free_list = prob->free_list_ ; const double ztolzb = prob->ztolzb_ ; const double ztoldj = prob->ztoldj_ ; const double ztolzero = 1.0e-12 ; int nrows = prob->nrows_ ; // Arrays to rebuild the unsaved column. int *index1 = new int[nrows] ; double *element1 = new double[nrows] ; CoinZeroN(element1,nrows) ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 char *cdone = prob->cdone_ ; char *rdone = prob->rdone_ ; presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; presolve_check_reduced_costs(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Entering doubleton_action::postsolve, " << nactions << " transforms to undo." << std::endl ; # endif # endif /* The outer loop: step through the doubletons in this array of actions. The first activity is to unpack the doubleton. */ for (const action *f = &actions[nactions-1] ; actions <= f ; f--) { const int irow = f->row ; const double lo0 = f->clox ; const double up0 = f->cupx ; const double coeffx = f->coeffx ; const double coeffy = f->coeffy ; const int jcolx = f->icolx ; const int jcoly = f->icoly ; const double rhs = f->rlo ; # if PRESOLVE_DEBUG > 2 std::cout << std::endl << " restoring doubleton " << irow << ", elim x(" << jcoly << "), kept x(" << jcolx << "); stored col " ; if (f->ncoly) std::cout << jcoly ; else std::cout << jcolx ; std::cout << "." << std::endl ; std::cout << " x(" << jcolx << ") " << prob->columnStatusString(jcolx) << " " << clo[jcolx] << " <= " << sol[jcolx] << " <= " << cup[jcolx] << "; cj " << f->costx << " dj " << rcosts[jcolx] << "." << std::endl ; # endif /* jcolx is in the problem (for whatever reason), and the doubleton row (irow) and column (jcoly) have only been processed by empty row/column postsolve (i.e., reintroduced with length 0). */ PRESOLVEASSERT(cdone[jcolx] && rdone[irow] == DROP_ROW) ; PRESOLVEASSERT(cdone[jcoly] == DROP_COL) ; /* Restore bounds for doubleton row, bounds and objective coefficient for x, objective for y. Original comment: restoration of rlo and rup likely isn't necessary. */ rlo[irow] = f->rlo ; rup[irow] = f->rlo ; clo[jcolx] = lo0 ; cup[jcolx] = up0 ; dcost[jcolx] = f->costx ; dcost[jcoly] = f->costy ; /* Set primal solution for y (including status) and row activity for the doubleton row. The motivation (up in presolve) for wanting coeffx < coeffy is to avoid inflation into sol[y]. Since this is a (satisfied) equality, activity is the rhs value and the logical is nonbasic. */ const double diffy = rhs-coeffx*sol[jcolx] ; if (fabs(diffy) < ztolzero) sol[jcoly] = 0 ; else sol[jcoly] = diffy/coeffy ; acts[irow] = rhs ; if (rowstat) prob->setRowStatus(irow,CoinPrePostsolveMatrix::atLowerBound) ; # if PRESOLVE_DEBUG > 2 /* Original comment: I've forgotten what this is about We have sol[y] = (rhs - coeffx*sol[x])/coeffy. As best I can figure, the original check here tested for the possibility of loss of significant digits through cancellation, followed by inflation if coeffy is small. The hazard is clear enough, but the test was puzzling. Overly complicated and it generated false warnings for the common case of sol[y] a clean zero. Replaced with something that I hope is more useful. The tolerances are, sad to say, completely arbitrary. -- lh, 121106 -- */ if ((fabs(diffy) < 1.0e-6) && (fabs(diffy) >= ztolzero) && (fabs(coeffy) < 1.0e-3)) std::cout << " loss of significance? rhs " << rhs << " (coeffx*sol[jcolx])" << (coeffx*sol[jcolx]) << " diff " << diffy << "." << std::endl ; # endif /* Time to get into the correction/restoration of coefficients for columns x and y, with attendant correction of row bounds and activities. Accumulate partial reduced costs (missing the contribution from the doubleton row) so that we can eventually calculate a dual for the doubleton row. */ double djy = maxmin*dcost[jcoly] ; double djx = maxmin*dcost[jcolx] ; /* We saved column y in the action, so we'll use it to reconstruct column x. There are two aspects: correction of existing x coefficients, and fill in. Given coeffx'[k] = coeffx[k]+coeffy[k]*coeff_factor we have coeffx[k] = coeffx'[k]-coeffy[k]*coeff_factor where coeff_factor = -coeffx[dblton]/coeffy[dblton]. Keep in mind that the major vector stored in the action does not include the coefficient from the doubleton row --- the doubleton coefficients are held in coeffx and coeffy. */ if (f->ncoly) { int ncoly = f->ncoly-1 ; int *indy = reinterpret_cast(f->colel+ncoly) ; /* Rebuild a threaded column y, starting with the end of the thread and working back to the beginning. In the process, accumulate corrections to column x in element1 and index1. Fix row bounds and activity as we go (add back the constant correction removed in presolve), and accumulate contributions to the reduced cost for y. Don't tweak finite infinity. The PRESOLVEASSERT says this row should already be present. */ int ystart = NO_LINK ; int nX = 0 ; for (int kcol = 0 ; kcol < ncoly ; ++kcol) { const int i = indy[kcol] ; PRESOLVEASSERT(rdone[i]) ; double yValue = f->colel[kcol] ; if (-PRESOLVE_INF < rlo[i]) rlo[i] += (yValue*rhs)/coeffy ; if (rup[i] < PRESOLVE_INF) rup[i] += (yValue*rhs)/coeffy ; acts[i] += (yValue*rhs)/coeffy ; djy -= rowduals[i]*yValue ; /* Link the coefficient into column y: Acquire the first free slot in the bulk arrays and store the row index and coefficient. Then link the slot in front of coefficients we've already processed. */ const CoinBigIndex kfree = free_list ; assert(kfree >= 0 && kfree < prob->bulk0_) ; free_list = link[free_list] ; hrow[kfree] = i ; colels[kfree] = yValue ; link[kfree] = ystart ; ystart = kfree ; # if PRESOLVE_DEBUG > 4 std::cout << " link y " << kfree << " row " << i << " coeff " << yValue << " dual " << rowduals[i] << std::endl ; # endif /* Calculate and store the correction to the x coefficient. */ yValue = (yValue*coeffx)/coeffy ; element1[i] = yValue ; index1[nX++] = i ; } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif /* Handle the coefficients of the doubleton row. Insert coeffy, coeffx. */ const CoinBigIndex kfree = free_list ; assert(kfree >= 0 && kfree < prob->bulk0_) ; free_list = link[free_list] ; hrow[kfree] = irow ; colels[kfree] = coeffy ; link[kfree] = ystart ; ystart = kfree ; # if PRESOLVE_DEBUG > 4 std::cout << " link y " << kfree << " row " << irow << " coeff " << coeffy << " dual n/a" << std::endl ; # endif element1[irow] = coeffx ; index1[nX++] = irow ; /* Attach the threaded column y to mcstrt and record the length. */ mcstrt[jcoly] = ystart ; hincol[jcoly] = f->ncoly ; /* Now integrate the corrections to column x. Scan the column and correct the existing entries. The correction could cancel the existing coefficient and we don't want to leave an explicit zero. In this case, relink the column around it. The freed slot is linked at the beginning of the free list. */ CoinBigIndex kcs = mcstrt[jcolx] ; CoinBigIndex last_nonzero = NO_LINK ; int numberInColumn = hincol[jcolx] ; const int numberToDo = numberInColumn ; for (int kcol = 0 ; kcol < numberToDo ; ++kcol) { const int i = hrow[kcs] ; assert(i >= 0 && i < nrows && i != irow) ; double value = colels[kcs]+element1[i] ; element1[i] = 0.0 ; if (fabs(value) >= 1.0e-15) { colels[kcs] = value ; last_nonzero = kcs ; kcs = link[kcs] ; djx -= rowduals[i]*value ; # if PRESOLVE_DEBUG > 4 std::cout << " link x " << last_nonzero << " row " << i << " coeff " << value << " dual " << rowduals[i] << std::endl ; # endif } else { # if PRESOLVE_DEBUG > 4 std::cout << " link x skipped row " << i << " dual " << rowduals[i] << std::endl ; # endif numberInColumn-- ; // add to free list int nextk = link[kcs] ; assert(free_list >= 0) ; link[kcs] = free_list ; free_list = kcs ; assert(kcs >= 0) ; kcs = nextk ; if (last_nonzero != NO_LINK) link[last_nonzero] = kcs ; else mcstrt[jcolx] = kcs ; } } if (last_nonzero != NO_LINK) link[last_nonzero] = NO_LINK ; /* We've dealt with the existing nonzeros in column x. Any remaining nonzeros in element1 will be fill in, which we insert at the beginning of the column. */ for (int kcol = 0 ; kcol < nX ; kcol++) { const int i = index1[kcol] ; double xValue = element1[i] ; element1[i] = 0.0 ; if (fabs(xValue) >= 1.0e-15) { if (i != irow) djx -= rowduals[i]*xValue ; numberInColumn++ ; CoinBigIndex kfree = free_list ; assert(kfree >= 0 && kfree < prob->bulk0_) ; free_list = link[free_list] ; hrow[kfree] = i ; PRESOLVEASSERT(rdone[hrow[kfree]] || (hrow[kfree] == irow)) ; colels[kfree] = xValue ; link[kfree] = mcstrt[jcolx] ; mcstrt[jcolx] = kfree ; # if PRESOLVE_DEBUG > 4 std::cout << " link x " << kfree << " row " << i << " coeff " << xValue << " dual " ; if (i != irow) std::cout << rowduals[i] ; else std::cout << "n/a" ; std::cout << std::endl ; # endif } } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif /* Whew! Set the column length and we're done. */ assert(numberInColumn) ; hincol[jcolx] = numberInColumn ; } else { /* Of course, we could have saved column x in the action. Now we need to regenerate coefficients of column y. Given coeffx'[k] = coeffx[k]+coeffy[k]*coeff_factor we have coeffy[k] = (coeffx'[k]-coeffx[k])*(1/coeff_factor) where coeff_factor = -coeffx[dblton]/coeffy[dblton]. */ const int ncolx = f->ncolx-1 ; int *indx = reinterpret_cast (f->colel+ncolx) ; /* Scan existing column x to find the end. While we're at it, accumulate part of the new y coefficients in index1 and element1. */ CoinBigIndex kcs = mcstrt[jcolx] ; int nX = 0 ; for (int kcol = 0 ; kcol < hincol[jcolx]-1 ; ++kcol) { if (colels[kcs]) { const int i = hrow[kcs] ; index1[nX++] = i ; element1[i] = -(colels[kcs]*coeffy)/coeffx ; } kcs = link[kcs] ; } if (colels[kcs]) { const int i = hrow[kcs] ; index1[nX++] = i ; element1[i] = -(colels[kcs]*coeffy)/coeffx ; } /* Replace column x with the the original column x held in the doubleton action (recall that this column does not include coeffx). We first move column x to the free list, then thread a column with the original coefficients, back to front. While we're at it, add the second part of the y coefficients to index1 and element1. */ link[kcs] = free_list ; free_list = mcstrt[jcolx] ; int xstart = NO_LINK ; for (int kcol = 0 ; kcol < ncolx ; ++kcol) { const int i = indx[kcol] ; PRESOLVEASSERT(rdone[i] && i != irow) ; double xValue = f->colel[kcol] ; CoinBigIndex k = free_list ; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list] ; hrow[k] = i ; colels[k] = xValue ; link[k] = xstart ; xstart = k ; djx -= rowduals[i]*xValue ; xValue = (xValue*coeffy)/coeffx ; if (!element1[i]) { element1[i] = xValue ; index1[nX++] = i ; } else { element1[i] += xValue ; } } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif /* The same, for the doubleton row. */ { double xValue = coeffx ; CoinBigIndex k = free_list ; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list] ; hrow[k] = irow ; colels[k] = xValue ; link[k] = xstart ; xstart = k ; element1[irow] = coeffy ; index1[nX++] = irow ; } /* Link the new column x to mcstrt and set the length. */ mcstrt[jcolx] = xstart ; hincol[jcolx] = f->ncolx ; /* Now get to work building a threaded column y from the nonzeros in element1. As before, build the thread in reverse. */ int ystart = NO_LINK ; int leny = 0 ; for (int kcol = 0 ; kcol < nX ; kcol++) { const int i = index1[kcol] ; PRESOLVEASSERT(rdone[i] || i == irow) ; double yValue = element1[i] ; element1[i] = 0.0 ; if (fabs(yValue) >= ztolzero) { leny++ ; CoinBigIndex k = free_list ; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list] ; hrow[k] = i ; colels[k] = yValue ; link[k] = ystart ; ystart = k ; } } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif /* Tidy up --- link the new column into mcstrt and set the length. */ mcstrt[jcoly] = ystart ; assert(leny) ; hincol[jcoly] = leny ; /* Now that we have the original y, we can scan it and do the corrections to the row bounds and activity, and get a start on a reduced cost for y. */ kcs = mcstrt[jcoly] ; const int ny = hincol[jcoly] ; for (int kcol = 0 ; kcol < ny ; ++kcol) { const int row = hrow[kcs] ; const double coeff = colels[kcs] ; kcs = link[kcs] ; if (row != irow) { // undo elim_doubleton(1) if (-PRESOLVE_INF < rlo[row]) rlo[row] += (coeff*rhs)/coeffy ; // undo elim_doubleton(2) if (rup[row] < PRESOLVE_INF) rup[row] += (coeff*rhs)/coeffy ; acts[row] += (coeff*rhs)/coeffy ; djy -= rowduals[row]*coeff ; } } } # if PRESOLVE_DEBUG > 2 /* Sanity checks. The doubleton coefficients should be linked in the first position of the each column (for no good reason except that it makes it much easier to write these checks). */ # if PRESOLVE_DEBUG > 4 std::cout << " kept: saved " << jcolx << " " << coeffx << ", reconstructed " << hrow[mcstrt[jcolx]] << " " << colels[mcstrt[jcolx]] << "." << std::endl ; std::cout << " elim: saved " << jcoly << " " << coeffy << ", reconstructed " << hrow[mcstrt[jcoly]] << " " << colels[mcstrt[jcoly]] << "." << std::endl ; # endif assert((coeffx == colels[mcstrt[jcolx]]) && (coeffy == colels[mcstrt[jcoly]])) ; # endif /* Time to calculate a dual for the doubleton row, and settle the status of x and y. Ideally, we'll leave x at whatever nonbasic status it currently has and make y basic. There's a potential problem, however: Remember that we transferred bounds from y to x when we eliminated y. If those bounds were tighter than x's original bounds, we may not be able to maintain x at its present status, or even as nonbasic. We'll make two claims here: * If the dual value for the doubleton row is chosen to keep the reduced cost djx of col x at its prior value, then the reduced cost djy of col y will be 0. (Crank through the linear algebra to convince yourself.) * If the bounds on x have loosened, then it must be possible to make y nonbasic, because we've transferred the tight bound back to y. (Yeah, I'm waving my hands. But it sounds good. -- lh, 040907 --) So ... if we can maintain x nonbasic, then we need to set y basic, which means we should calculate rowduals[dblton] so that rcost[jcoly] == 0. We may need to change the status of x (an artifact of loosening a bound when x was previously a fixed variable). If we need to push x into the basis, then we calculate rowduals[dblton] so that rcost[jcolx] == 0 and make y nonbasic. */ # if PRESOLVE_DEBUG > 2 std::cout << " pre status: x(" << jcolx << ") " << prob->columnStatusString(jcolx) << " " << clo[jcolx] << " <= " << sol[jcolx] << " <= " << cup[jcolx] << ", cj " << dcost[jcolx] << ", dj " << djx << "." << std::endl ; std::cout << " pre status: x(" << jcoly << ") " << clo[jcoly] << " <= " << sol[jcoly] << " <= " << cup[jcoly] << ", cj " << dcost[jcoly] << ", dj " << djy << "." << std::endl ; # endif if (colstat) { bool basicx = prob->columnIsBasic(jcolx) ; bool nblbxok = (fabs(lo0 - sol[jcolx]) < ztolzb) && (rcosts[jcolx] >= -ztoldj) ; bool nbubxok = (fabs(up0 - sol[jcolx]) < ztolzb) && (rcosts[jcolx] <= ztoldj) ; if (basicx || nblbxok || nbubxok) { if (!basicx) { if (nblbxok) { prob->setColumnStatus(jcolx, CoinPrePostsolveMatrix::atLowerBound) ; } else if (nbubxok) { prob->setColumnStatus(jcolx, CoinPrePostsolveMatrix::atUpperBound) ; } } prob->setColumnStatus(jcoly,CoinPrePostsolveMatrix::basic) ; rowduals[irow] = djy/coeffy ; rcosts[jcolx] = djx-rowduals[irow]*coeffx ; rcosts[jcoly] = 0.0 ; } else { prob->setColumnStatus(jcolx,CoinPrePostsolveMatrix::basic) ; prob->setColumnStatusUsingValue(jcoly) ; rowduals[irow] = djx/coeffx ; rcosts[jcoly] = djy-rowduals[irow]*coeffy ; rcosts[jcolx] = 0.0 ; } # if PRESOLVE_DEBUG > 2 std::cout << " post status: " << irow << " dual " << rowduals[irow] << " rhs " << rlo[irow] << std::endl ; std::cout << " post status: x(" << jcolx << ") " << prob->columnStatusString(jcolx) << " " << clo[jcolx] << " <= " << sol[jcolx] << " <= " << cup[jcolx] << ", cj " << dcost[jcolx] << ", dj = " << rcosts[jcolx] << "." << std::endl ; std::cout << " post status: x(" << jcoly << ") " << prob->columnStatusString(jcoly) << " " << clo[jcoly] << " <= " << sol[jcoly] << " <= " << cup[jcoly] << ", cj " << dcost[jcoly] << ", dj " << rcosts[jcoly] << "." << std::endl ; /* These asserts are valid but need a scaled tolerance to work well over a range of problems. Occasionally useful for a hard stop while debugging. assert(!prob->columnIsBasic(jcolx) || (fabs(rcosts[jcolx]) < 1.0e-5)) ; assert(!prob->columnIsBasic(jcoly) || (fabs(rcosts[jcoly]) < 1.0e-5)) ; */ # endif } else { // No status array // this is the coefficient we need to force col y's reduced cost to 0.0 ; // for example, this is obviously true if y is a singleton column rowduals[irow] = djy/coeffy ; rcosts[jcoly] = 0.0 ; } # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 /* Mark the column and row as processed by doubleton action. Then check integrity of the threaded matrix. */ cdone[jcoly] = DOUBLETON ; rdone[irow] = DOUBLETON ; presolve_check_threads(prob) ; # endif # if PRESOLVE_DEBUG > 0 /* Confirm accuracy of reduced cost for columns x and y. */ { CoinBigIndex k = mcstrt[jcolx] ; const int nx = hincol[jcolx] ; double dj = maxmin*dcost[jcolx] ; for (int kcol = 0 ; kcol < nx ; ++kcol) { const int row = hrow[k] ; const double coeff = colels[k] ; k = link[k] ; dj -= rowduals[row]*coeff ; } if (!(fabs(rcosts[jcolx]-dj) < 100*ZTOLDP)) printf("BAD DOUBLE X DJ: %d %d %g %g\n", irow,jcolx,rcosts[jcolx],dj) ; rcosts[jcolx] = dj ; } { CoinBigIndex k = mcstrt[jcoly] ; const int ny = hincol[jcoly] ; double dj = maxmin*dcost[jcoly] ; for (int kcol = 0 ; kcol < ny ; ++kcol) { const int row = hrow[k] ; const double coeff = colels[k] ; k = link[k] ; dj -= rowduals[row]*coeff ; } if (!(fabs(rcosts[jcoly]-dj) < 100*ZTOLDP)) printf("BAD DOUBLE Y DJ: %d %d %g %g\n", irow,jcoly,rcosts[jcoly],dj) ; rcosts[jcoly] = dj ; } # endif } /* Done at last. Delete the scratch arrays. */ delete [] index1 ; delete [] element1 ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; presolve_check_reduced_costs(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving doubleton_action::postsolve." << std::endl ; # endif # endif } doubleton_action::~doubleton_action() { for (int i=nactions_-1; i>=0; i--) { delete[]actions_[i].colel ; } deleteAction(actions_,action*) ; } CoinMP-1.8.3/CoinUtils/src/CoinOslC.h0000644000175000017500000005364212130031043015633 0ustar renerene/* $Id: CoinOslC.h 1582 2013-04-06 14:33:07Z stefan $ */ #ifndef COIN_OSL_C_INCLUDE /* Copyright (C) 1987, 2009, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #define COIN_OSL_C_INCLUDE #ifndef CLP_OSL #define CLP_OSL 0 #endif #define C_EKK_GO_SPARSE 200 #ifdef HAVE_ENDIAN_H #include #if __BYTE_ORDER == __LITTLE_ENDIAN #define INTEL #endif #endif #include #include #include #include #define SPARSE_UPDATE #define NO_SHIFT #include "CoinHelperFunctions.hpp" #include #ifdef __cplusplus extern "C"{ #endif int c_ekkbtrn( register const EKKfactinfo *fact, double *dwork1, int * mpt,int first_nonzero); int c_ekkbtrn_ipivrw( register const EKKfactinfo *fact, double *dwork1, int * mpt, int ipivrw,int * spare); int c_ekketsj( register /*const*/ EKKfactinfo *fact, double *dwork1, int *mpt2, double dalpha, int orig_nincol, int npivot, int *nuspikp, const int ipivrw, int * spare); int c_ekkftrn( register const EKKfactinfo *fact, double *dwork1, double * dpermu,int * mpt, int numberNonZero); int c_ekkftrn_ft( register EKKfactinfo *fact, double *dwork1, int *mpt, int *nincolp); void c_ekkftrn2( register EKKfactinfo *fact, double *dwork1, double * dpermu1,int * mpt1, int *nincolp, double *dwork1_ft, int *mpt_ft, int *nincolp_ft); int c_ekklfct( register EKKfactinfo *fact); int c_ekkslcf( register const EKKfactinfo *fact); inline void c_ekkscpy(int n, const int *marr1,int *marr2) { CoinMemcpyN(marr1,n,marr2);} inline void c_ekkdcpy(int n, const double *marr1,double *marr2) { CoinMemcpyN(marr1,n,marr2);} int c_ekk_IsSet(const int * array,int bit); void c_ekk_Set(int * array,int bit); void c_ekk_Unset(int * array,int bit); void c_ekkzero(int length, int n, void * array); inline void c_ekkdzero(int n, double *marray) {CoinZeroN(marray,n);} inline void c_ekkizero(int n, int *marray) {CoinZeroN(marray,n);} inline void c_ekkczero(int n, char *marray) {CoinZeroN(marray,n);} #ifdef __cplusplus } #endif #define c_ekkscpy_0_1(s,ival,array) CoinFillN(array,s,ival) #define c_ekks1cpy( n,marr1,marr2) CoinMemcpyN(marr1,n, marr2) void clp_setup_pointers(EKKfactinfo * fact); void clp_memory(int type); double * clp_double(int number_entries); int * clp_int(int number_entries); void * clp_malloc(int number_entries); void clp_free(void * oldArray); #define SLACK_VALUE -1.0 #define C_EKK_REMOVE_LINK(hpiv,hin,link,ipivot) \ { \ int ipre = link[ipivot].pre; \ int isuc = link[ipivot].suc; \ if (ipre > 0) { \ link[ipre].suc = isuc; \ } \ if (ipre <= 0) { \ hpiv[hin[ipivot]] = isuc; \ } \ if (isuc > 0) { \ link[isuc].pre = ipre; \ } \ } #define C_EKK_ADD_LINK(hpiv,nzi,link, npr) \ { \ int ifiri = hpiv[nzi]; \ hpiv[nzi] = npr; \ link[npr].suc = ifiri; \ link[npr].pre = 0; \ if (ifiri != 0) { \ link[ifiri].pre = npr; \ } \ } #include #ifdef NO_SHIFT #define SHIFT_INDEX(limit) (limit) #define UNSHIFT_INDEX(limit) (limit) #define SHIFT_REF(arr,ind) (arr)[ind] #else #define SHIFT_INDEX(limit) ((limit)<<3) #define UNSHIFT_INDEX(limit) ((unsigned int)(limit)>>3) #define SHIFT_REF(arr,ind) (*(double*)((char*)(arr) + (ind))) #endif #ifdef INTEL #define NOT_ZERO(x) (((*((reinterpret_cast(&x))+7)) & 0x7F) != 0) #else #define NOT_ZERO(x) ((x) != 0.0) #endif #define SWAP(type,_x,_y) { type _tmp = (_x); (_x) = (_y); (_y) = _tmp;} #define UNROLL_LOOP_BODY1(code) \ {{code}} #define UNROLL_LOOP_BODY2(code) \ {{code} {code}} #define UNROLL_LOOP_BODY4(code) \ {{code} {code} {code} {code}} #endif #ifdef COIN_OSL_CMFC /* Return codes in IRTCOD/IRTCOD are */ /* 4: numerical problems */ /* 5: not enough space in row file */ /* 6: not enough space in column file */ /* 23: system error at label 320 */ { #if 1 int *hcoli = fact->xecadr; double *dluval = fact->xeeadr; double *dvalpv = fact->kw3adr; int *mrstrt = fact->xrsadr; int *hrowi = fact->xeradr; int *mcstrt = fact->xcsadr; int *hinrow = fact->xrnadr; int *hincol = fact->xcnadr; int *hpivro = fact->krpadr; int *hpivco = fact->kcpadr; #endif int nnentl = fact->nnentl; int nnentu = fact->nnentu; int kmxeta = fact->kmxeta; int xnewro = *xnewrop; int ncompactions = *ncompactionsp; MACTION_T *maction = reinterpret_cast(maction_void); int i, j, k; double d1; int j1, j2; int jj, kk, kr, nz, jj1, jj2, kce, kcs, kqq, npr; int fill, naft; int enpr; int nres, npre; int knpr, irow, iadd32, ibase; double pivot; int count, nznpr; int nlast, epivr1; int kipis; double dpivx; int kipie, kcpiv, knprs, knpre; bool cancel; double multip, elemnt; int ipivot, jpivot, epivro, epivco, lstart, nfirst; int nzpivj, kfill, kstart; int nmove, ileft; #ifndef C_EKKCMFY int iput, nspare; int noRoomForDense=0; int if_sparse_update=fact->if_sparse_update; int ifdens = 0; #endif int irtcod = 0; const int nrow = fact->nrow; /* Parameter adjustments */ --maction; /* Function Body */ lstart = nnetas - nnentl + 1; for (i = lstart; i <= nnetas; ++i) { hrowi[i] = SHIFT_INDEX(hcoli[i]); } for (i = 1; i <= nrow; ++i) { maction[i] = 0; mwork[i].pre = i - 1; mwork[i].suc = i + 1; } iadd32 = 0; nlast = nrow; nfirst = 1; mwork[1].pre = nrow; mwork[nrow].suc = 1; for (count = 1; count <= nrow; ++count) { /* Pick column singletons */ if (! (hpivco[1] <= 0)) { int small_pivot = c_ekkcsin(fact, rlink, clink, nsingp); if (small_pivot) { irtcod = 7; /* pivot too small */ if (fact->invok >= 0) { goto L1050; } } if (fact->npivots >= nrow) { goto L1050; } } /* Pick row singletons */ if (! (hpivro[1] <= 0)) { irtcod = c_ekkrsin(fact, rlink, clink, mwork,nfirst, nsingp, &xnewco, &xnewro, &nnentu, &kmxeta, &ncompactions, &nnentl); if (irtcod != 0) { if (irtcod < 0 || fact->invok >= 0) { /* -5 */ goto L1050; } /* ASSERT: irtcod == 7 - pivot too small */ /* why don't we return with an error? */ } if (fact->npivots >= nrow) { goto L1050; } lstart = nnetas - nnentl + 1; } /* Find a pivot element */ irtcod = c_ekkfpvt(fact, rlink, clink, nsingp, xrejctp, &ipivot, &jpivot); if (irtcod != 0) { /* irtcod == 10 */ goto L1050; } /* Update list structures and prepare for numerical phase */ c_ekkprpv(fact, rlink, clink, *xrejctp, ipivot, jpivot); epivco = hincol[jpivot]; ++fact->xnetal; mcstrt[fact->xnetal] = lstart - 1; hpivco[fact->xnetal] = ipivot; epivro = hinrow[ipivot]; epivr1 = epivro - 1; kipis = mrstrt[ipivot]; pivot = dluval[kipis]; dpivx = 1. / pivot; kipie = kipis + epivr1; ++kipis; #ifndef C_EKKCMFY { double size = nrow - fact->npivots; if (size > GO_DENSE && (nnentu - fact->nuspike) * GO_DENSE_RATIO > size * size) { /* say going to dense coding */ if (*nsingp == 0) { ifdens = 1; } } } #endif /* copy the pivot row entries into dvalpv */ /* the maction array tells us the index into dvalpv for a given row */ /* the alternative would be using a large array of doubles */ for (k = kipis; k <= kipie; ++k) { irow = hcoli[k]; dvalpv[k - kipis + 1] = dluval[k]; maction[irow] = static_cast(k - kipis + 1); } /* Loop over nonzeros in pivot column */ kcpiv = mcstrt[jpivot] - 1; for (nzpivj = 1; nzpivj <= epivco; ++nzpivj) { ++kcpiv; npr = hrowi[kcpiv]; hrowi[kcpiv] = 0; /* zero out for possible compaction later on */ --hincol[jpivot]; ++mcstrt[jpivot]; /* loop invariant: kcpiv == mcstrt[jpivot] - 1 */ --hinrow[npr]; enpr = hinrow[npr]; knprs = mrstrt[npr]; knpre = knprs + enpr; /* Search for element to be eliminated */ knpr = knprs; while (1) { UNROLL_LOOP_BODY4({ if (jpivot == hcoli[knpr]) { break; } knpr++; }); } multip = -dluval[knpr] * dpivx; /* swap last entry with pivot */ dluval[knpr] = dluval[knpre]; hcoli[knpr] = hcoli[knpre]; --knpre; #if 1 /* MONSTER_UNROLLED_CODE - see below */ kfill = epivr1 - (knpre - knprs + 1); nres = ((knpre - knprs + 1) & 1) + knprs; cancel = false; d1 = 1e33; j1 = hcoli[nres]; if (nres != knprs) { j = hcoli[knprs]; if (maction[j] == 0) { ++kfill; } else { jj = maction[j]; maction[j] = static_cast(-maction[j]); dluval[knprs] += multip * dvalpv[jj]; d1 = fabs(dluval[knprs]); } } j2 = hcoli[nres + 1]; jj1 = maction[j1]; for (kr = nres; kr < knpre; kr += 2) { jj2 = maction[j2]; if ( (jj1 == 0)) { ++kfill; } else { maction[j1] = static_cast(-maction[j1]); dluval[kr] += multip * dvalpv[jj1]; cancel = cancel || ! (fact->zeroTolerance < d1); d1 = fabs(dluval[kr]); } j1 = hcoli[kr + 2]; if ( (jj2 == 0)) { ++kfill; } else { maction[j2] = static_cast(-maction[j2]); dluval[kr + 1] += multip * dvalpv[jj2]; cancel = cancel || ! (fact->zeroTolerance < d1); d1 = fabs(dluval[kr + 1]); } jj1 = maction[j1]; j2 = hcoli[kr + 3]; } cancel = cancel || ! (fact->zeroTolerance < d1); #else /* * This is apparently what the above code does. * In addition to being unrolled, the assignments to j[12] and jj[12] * are shifted so that the result of dereferencing maction doesn't * have to be used immediately afterwards for the branch test. * This would would cause a pipeline delay. (The apparent dereference * of hcoli will be removed by the compiler using strength reduction). * * loop through the entries in the row being processed, * flipping the sign of the maction entries as we go along. * Afterwards, we look for positive entries to see what pivot * row entries will cause fill-in. We count the number of fill-ins, too. * "cancel" says if the result of combining the pivot row with this one * causes an entry to get too small; if so, we discard those entries. */ kfill = epivr1 - (knpre - knprs + 1); cancel = false; for (kr = knprs; kr <= knpre; kr++) { j1 = hcoli[kr]; jj1 = maction[j1]; if ( (jj1 == 0)) { /* no entry - this pivot column entry will have to be added */ ++kfill; } else { /* there is an entry for this column in the pivot row */ maction[j1] = -maction[j1]; dluval[kr] += multip * dvalpv[jj1]; d1 = fabs(dluval[kr]); cancel = cancel || ! (fact->zeroTolerance < d1); } } #endif kstart = knpre; fill = kfill; if (cancel) { /* KSTART is used as a stack pointer for nonzeros in factored row */ kstart = knprs - 1; for (kr = knprs; kr <= knpre; ++kr) { j = hcoli[kr]; if (fabs(dluval[kr]) > fact->zeroTolerance) { ++kstart; dluval[kstart] = dluval[kr]; hcoli[kstart] = j; } else { /* Remove element from column file */ --nnentu; --hincol[j]; --enpr; kcs = mcstrt[j]; kce = kcs + hincol[j]; for (kk = kcs; kk <= kce; ++kk) { if (hrowi[kk] == npr) { hrowi[kk] = hrowi[kce]; hrowi[kce] = 0; break; } } /* ASSERT !(kk>kce) */ } } knpre = kstart; } /* Fill contains an upper bound on the amount of fill-in */ if (fill == 0) { for (k = kipis; k <= kipie; ++k) { maction[hcoli[k]] = static_cast(-maction[hcoli[k]]); } } else { naft = mwork[npr].suc; kqq = mrstrt[naft] - knpre - 1; if (fill > kqq) { /* Fill-in exceeds space left. Check if there is enough */ /* space in row file for the new row. */ nznpr = enpr + fill; if (! (xnewro + nznpr + 1 < lstart)) { if (! (nnentu + nznpr + 1 < lstart)) { irtcod = -5; goto L1050; } /* idea 1 is to compress every time xnewro increases by x thousand */ /* idea 2 is to copy nucleus rows with a reasonable gap */ /* then copy each row down when used */ /* compressions would just be 1 remainder which eventually will */ /* fit in cache */ { int iput = c_ekkrwcs(fact,dluval, hcoli, mrstrt, hinrow, mwork, nfirst); kmxeta += xnewro - iput ; xnewro = iput - 1; ++ncompactions; } kipis = mrstrt[ipivot] + 1; kipie = kipis + epivr1 - 1; knprs = mrstrt[npr]; } /* I think this assignment should be inside the previous if-stmt */ /* otherwise, it does nothing */ /*assert(knpre == knprs + enpr - 1);*/ knpre = knprs + enpr - 1; /* * copy this row to the end of the row file and adjust its links. * The links keep track of the order of rows in memory. * Rows are only moved from the middle all the way to the end. */ if (npr != nlast) { npre = mwork[npr].pre; if (npr == nfirst) { nfirst = naft; } /* take out of chain */ mwork[naft].pre = npre; mwork[npre].suc = naft; /* and put in at end */ mwork[nfirst].pre = npr; mwork[nlast].suc = npr; mwork[npr].pre = nlast; mwork[npr].suc = nfirst; nlast = npr; kstart = xnewro; mrstrt[npr] = kstart + 1; nmove = knpre - knprs + 1; ibase = kstart + 1 - knprs; for (kr = knprs; kr <= knpre; ++kr) { dluval[ibase + kr] = dluval[kr]; hcoli[ibase + kr] = hcoli[kr]; } kstart += nmove; } else { kstart = knpre; } /* extra space ? */ /* * The mystery of iadd32. * This code assigns to xnewro, possibly using iadd32. * However, in that case xnewro is assigned to just after * the for-loop below, and there is no intervening reference. * Therefore, I believe that this code can be entirely eliminated; * it is the leftover of an interrupted or dropped experiment. * Presumably, this was trying to implement the ideas about * padding expressed above. */ if (iadd32 != 0) { xnewro += iadd32; } else { if (kstart + (nrow << 1) + 100 < lstart) { ileft = ((nrow - fact->npivots + 32) & -32); if (kstart + ileft * ileft + 32 < lstart) { iadd32 = ileft; xnewro = CoinMax(kstart,xnewro); xnewro = (xnewro & -32) + ileft; } else { xnewro = ((kstart + 31) & -32); } } else { xnewro = kstart; } } hinrow[npr] = enpr; } else if (! (nnentu + kqq + 2 < lstart)) { irtcod = -5; goto L1050; } /* Scan pivot row again to generate fill in. */ for (kr = kipis; kr <= kipie; ++kr) { j = hcoli[kr]; jj = maction[j]; if (jj >0) { elemnt = multip * dvalpv[jj]; if (fabs(elemnt) > fact->zeroTolerance) { ++kstart; dluval[kstart] = elemnt; //printf("pivot %d at %d col %d el %g\n", // npr,kstart,j,elemnt); hcoli[kstart] = j; ++nnentu; nz = hincol[j]; kcs = mcstrt[j]; kce = kcs + nz - 1; if (kce == xnewco) { if (xnewco + 1 >= lstart) { if (xnewco + nz + 1 >= lstart) { /* Compress column file */ if (nnentu + nz + 1 < lstart) { xnewco = c_ekkclco(fact,hrowi, mcstrt, hincol, xnewco); ++ncompactions; kcpiv = mcstrt[jpivot] - 1; kcs = mcstrt[j]; /* HINCOL MAY HAVE CHANGED? (JJHF) ??? */ nz = hincol[j]; kce = kcs + nz - 1; } else { irtcod = -5; goto L1050; } } /* Copy column */ mcstrt[j] = xnewco + 1; ibase = mcstrt[j] - kcs; for (kk = kcs; kk <= kce; ++kk) { hrowi[ibase + kk] = hrowi[kk]; hrowi[kk] = 0; } kce = xnewco + kce - kcs + 1; xnewco = kce + 1; } else { ++xnewco; } } else if (hrowi[kce + 1] != 0) { /* here we use the fact that hrowi entries not "in use" are zeroed */ if (xnewco + nz + 1 >= lstart) { /* Compress column file */ if (nnentu + nz + 1 < lstart) { xnewco = c_ekkclco(fact,hrowi, mcstrt, hincol, xnewco); ++ncompactions; kcpiv = mcstrt[jpivot] - 1; kcs = mcstrt[j]; /* HINCOL MAY HAVE CHANGED? (JJHF) ??? */ nz = hincol[j]; kce = kcs + nz - 1; } else { irtcod = -5; goto L1050; } } /* move the column to the end of the column file */ mcstrt[j] = xnewco + 1; ibase = mcstrt[j] - kcs; for (kk = kcs; kk <= kce; ++kk) { hrowi[ibase + kk] = hrowi[kk]; hrowi[kk] = 0; } kce = xnewco + kce - kcs + 1; xnewco = kce + 1; } /* store element */ hrowi[kce + 1] = npr; hincol[j] = nz + 1; } } else { maction[j] = static_cast(-maction[j]); } } if (fill > kqq) { xnewro = kstart; } } hinrow[npr] = kstart - mrstrt[npr] + 1; /* Check if row or column file needs compression */ if (! (xnewco + 1 < lstart)) { xnewco = c_ekkclco(fact,hrowi, mcstrt, hincol, xnewco); ++ncompactions; kcpiv = mcstrt[jpivot] - 1; } if (! (xnewro + 1 < lstart)) { int iput = c_ekkrwcs(fact,dluval, hcoli, mrstrt, hinrow, mwork, nfirst); kmxeta += xnewro - iput ; xnewro = iput - 1; ++ncompactions; kipis = mrstrt[ipivot] + 1; kipie = kipis + epivr1 - 1; } /* Store elementary row transformation */ ++nnentl; --nnentu; --lstart; dluval[lstart] = multip; hrowi[lstart] = SHIFT_INDEX(npr); #define INLINE_AFPV 3 /* We could do this while computing values but it makes it much more complex. At least we should get reasonable cache behavior by doing it each row */ #if INLINE_AFPV { int j; int nel, krs; int koff; int * index; double * els; nel = hinrow[npr]; krs = mrstrt[npr]; index=&hcoli[krs]; els=&dluval[krs]; #if INLINE_AFPV<3 #if INLINE_AFPV==1 double maxaij = 0.0; koff = 0; j=0; while (j 0) { C_EKK_ADD_LINK(hpivro, nzi, rlink, npr); } } } /* after pivot move biggest to first in each row */ #if INLINE_AFPV==0 int nn = mcstrt[fact->xnetal] - lstart + 1; c_ekkafpv(hrowi+lstart, hcoli, dluval, mrstrt, hinrow, nn); #endif /* Restore work array */ for (k = kipis; k <= kipie; ++k) { maction[hcoli[k]] = 0; } if (*xrejctp > 0) { for (k = kipis; k <= kipie; ++k) { int j = hcoli[k]; int nzj = hincol[j]; if (! (nzj <= 0) && ! ((clink[j].pre > nrow && nzj != 1))) { C_EKK_ADD_LINK(hpivco, nzj, clink, j); } } } else { for (k = kipis; k <= kipie; ++k) { int j = hcoli[k]; int nzj = hincol[j]; if (! (nzj <= 0)) { C_EKK_ADD_LINK(hpivco, nzj, clink, j); } } } fact->nuspike += hinrow[ipivot]; /* Go to dense coding if appropriate */ #ifndef C_EKKCMFY if (ifdens != 0) { int ndense = nrow - fact->npivots; if (! (xnewro + ndense * ndense >= lstart)) { /* set up sort order in MACTION */ c_ekkizero( nrow, reinterpret_cast (maction+1)); iput = 0; for (i = 1; i <= nrow; ++i) { if (clink[i].pre >= 0) { ++iput; maction[i] = static_cast(iput); } } /* and get number spare needed */ nspare = 0; for (i = 1; i <= nrow; ++i) { if (rlink[i].pre >= 0) { nspare = nspare + ndense - hinrow[i]; } } if (iput != nrow - fact->npivots) { /* must be singular */ c_ekkizero( nrow, reinterpret_cast (maction+1)); } else { /* pack down then back up */ int iput = c_ekkrwcs(fact,dluval, hcoli, mrstrt, hinrow, mwork, nfirst); kmxeta += xnewro - iput ; xnewro = iput - 1; ++ncompactions; --ncompactions; if (xnewro + nspare + ndense * ndense >= lstart) { c_ekkizero( nrow, reinterpret_cast (maction+1)); } else { xnewro += nspare; c_ekkrwct(fact,dluval, hcoli, mrstrt, hinrow, mwork, rlink, maction, dvalpv, nlast, xnewro); kmxeta += xnewro ; if (nnentu + nnentl > nrow * 5 && (ndense*ndense)>(nnentu+nnentl)>>2 && !if_sparse_update) { fact->ndenuc = ndense; } irtcod = c_ekkcmfd(fact, (reinterpret_cast(dvalpv)+1), rlink, clink, (reinterpret_cast(maction+1))+1, nnetas, &nnentl, &nnentu, nsingp); /* irtcod == 0 || irtcod == 10 */ /* 10 == found 0.0 pivot */ goto L1050; } } } else { /* say not enough room */ /*printf("no room %d\n",ndense);*/ if (1) { /* return and increase size of etas if possible */ if (!noRoomForDense) { int etasize =CoinMax(4*fact->nnentu+(nnetas-fact->nnentl)+1000,fact->eta_size); noRoomForDense=ndense; fact->eta_size=CoinMin(static_cast(1.2*fact->eta_size),etasize); if (fact->maxNNetas>0&&fact->eta_size> fact->maxNNetas) { fact->eta_size=fact->maxNNetas; } } } } } #endif /* C_EKKCMFY */ } L1050: { int iput = c_ekkrwcs(fact,dluval, hcoli, mrstrt, hinrow, mwork, nfirst); kmxeta += xnewro - iput; xnewro = iput - 1; ++ncompactions; } nnentu = xnewro; /* save order of row copy for c_ekkshfv */ mwork[nrow+1].pre = nfirst; mwork[nrow+1].suc = nlast; fact->nnentl = nnentl; fact->nnentu = nnentu; fact->kmxeta = kmxeta; *xnewrop = xnewro; *ncompactionsp = ncompactions; return (irtcod); } /* c_ekkcmfc */ #endif CoinMP-1.8.3/CoinUtils/src/CoinModel.cpp0000644000175000017500000035170312312310414016371 0ustar renerene/* $Id: CoinModel.cpp 1691 2014-03-19 12:43:56Z forrest $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinUtilsConfig.h" #include "CoinHelperFunctions.hpp" #include "CoinModel.hpp" #include "CoinMessage.hpp" #include "CoinSort.hpp" #include "CoinMpsIO.hpp" #include "CoinFloatEqual.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CoinBaseModel::CoinBaseModel () : numberRows_(0), numberColumns_(0), optimizationDirection_(1.0), objectiveOffset_(0.0), handler_(NULL), logLevel_(0) { messages_ = CoinMessage(); problemName_ = ""; rowBlockName_ = "row_master"; columnBlockName_ = "column_master"; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinBaseModel::CoinBaseModel (const CoinBaseModel & rhs) : numberRows_(rhs.numberRows_), numberColumns_(rhs.numberColumns_), optimizationDirection_(rhs.optimizationDirection_), objectiveOffset_(rhs.objectiveOffset_), handler_(rhs.handler_), logLevel_(rhs.logLevel_) { problemName_ = rhs.problemName_; rowBlockName_ = rhs.rowBlockName_; columnBlockName_ = rhs.columnBlockName_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CoinBaseModel::~CoinBaseModel () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CoinBaseModel & CoinBaseModel::operator=(const CoinBaseModel& rhs) { if (this != &rhs) { problemName_ = rhs.problemName_; rowBlockName_ = rhs.rowBlockName_; columnBlockName_ = rhs.columnBlockName_; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; optimizationDirection_ = rhs.optimizationDirection_; objectiveOffset_ = rhs.objectiveOffset_; handler_ = rhs.handler_; logLevel_ = rhs.logLevel_; } return *this; } void CoinBaseModel::setLogLevel(int value) { if (value>=0&&value<3) logLevel_=value; } void CoinBaseModel::setProblemName (const char *name) { if (name) problemName_ = name ; else problemName_ = ""; } // Pass in message handler void CoinBaseModel::setMessageHandler(CoinMessageHandler * handler) { handler_=handler; if (handler) logLevel_=-1; else logLevel_=CoinMax(0,logLevel_); } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CoinModel::CoinModel () : CoinBaseModel(), maximumRows_(0), maximumColumns_(0), numberElements_(0), maximumElements_(0), numberQuadraticElements_(0), maximumQuadraticElements_(0), rowLower_(NULL), rowUpper_(NULL), rowType_(NULL), objective_(NULL), columnLower_(NULL), columnUpper_(NULL), integerType_(NULL), columnType_(NULL), start_(NULL), elements_(NULL), packedMatrix_(NULL), quadraticElements_(NULL), sortIndices_(NULL), sortElements_(NULL), sortSize_(0), sizeAssociated_(0), associated_(NULL), numberSOS_(0), startSOS_(NULL), memberSOS_(NULL), typeSOS_(NULL), prioritySOS_(NULL), referenceSOS_(NULL), priority_(NULL), cut_(NULL), moreInfo_(NULL), type_(-1), noNames_(false), links_(0) { } /* Constructor with sizes. */ CoinModel::CoinModel(int firstRows, int firstColumns, int firstElements,bool noNames) : CoinBaseModel(), maximumRows_(0), maximumColumns_(0), numberElements_(0), maximumElements_(0), numberQuadraticElements_(0), maximumQuadraticElements_(0), rowLower_(NULL), rowUpper_(NULL), rowType_(NULL), objective_(NULL), columnLower_(NULL), columnUpper_(NULL), integerType_(NULL), columnType_(NULL), start_(NULL), elements_(NULL), packedMatrix_(NULL), quadraticElements_(NULL), sortIndices_(NULL), sortElements_(NULL), sortSize_(0), sizeAssociated_(0), associated_(NULL), numberSOS_(0), startSOS_(NULL), memberSOS_(NULL), typeSOS_(NULL), prioritySOS_(NULL), referenceSOS_(NULL), priority_(NULL), cut_(NULL), moreInfo_(NULL), type_(-1), noNames_(noNames), links_(0) { if (!firstRows) { if (firstColumns) { type_=1; resize(0,firstColumns,firstElements); } } else { type_=0; resize(firstRows,0,firstElements); if (firstColumns) { // mixed - do linked lists for columns //createList(2); } } } /* Read a problem in MPS or GAMS format from the given filename. */ CoinModel::CoinModel(const char *fileName, int allowStrings) : CoinBaseModel(), maximumRows_(0), maximumColumns_(0), numberElements_(0), maximumElements_(0), numberQuadraticElements_(0), maximumQuadraticElements_(0), rowLower_(NULL), rowUpper_(NULL), rowType_(NULL), objective_(NULL), columnLower_(NULL), columnUpper_(NULL), integerType_(NULL), columnType_(NULL), start_(NULL), elements_(NULL), packedMatrix_(NULL), quadraticElements_(NULL), sortIndices_(NULL), sortElements_(NULL), sortSize_(0), sizeAssociated_(0), associated_(NULL), numberSOS_(0), startSOS_(NULL), memberSOS_(NULL), typeSOS_(NULL), prioritySOS_(NULL), referenceSOS_(NULL), priority_(NULL), cut_(NULL), moreInfo_(NULL), type_(-1), noNames_(false), links_(0) { rowBlockName_ = "row_master"; columnBlockName_ = "column_master"; int status=0; if (!strcmp(fileName,"-")||!strcmp(fileName,"stdin")) { // stdin } else { std::string name=fileName; bool readable = fileCoinReadable(name); if (!readable) { std::cerr<<"Unable to open file " <whichSection ( ) == COIN_QUAD_SECTION ; // do names int iRow; for (iRow=0;iRow=0&&iRow<=numberRows_+2); assert (iColumn>=0&&iColumn<=numberColumns_); const char * pos = strchr(line,','); assert (pos); pos = strchr(pos+1,','); assert (pos); pos++; if (iRowwhichSection ( ) == COIN_QUAD_SECTION ) { int * start=NULL; int * column = NULL; double * element = NULL; status=m.readQuadraticMps(NULL,start,column,element,2); if (!status) { // If strings allowed 13 then just for Hans convert to constraint int objRow=-1; if (allowStrings==13) { int objColumn=numberColumns_; objRow=numberRows_; // leave linear part in objective addColumn(0,NULL,NULL,-COIN_DBL_MAX,COIN_DBL_MAX,1.0,"obj"); double minusOne=-1.0; addRow(1,&objColumn,&minusOne,-COIN_DBL_MAX,0.0,"objrow"); } if (!ifStrings&&!numberIntegers) { // no strings - add to quadratic (not done yet) for (int iColumn=0;iColumniColumn) { printf("above diag %d %d %g\n",iColumn,jColumn,value); } else if (jColumniColumn) { //printf("above diag %d %d %g\n",iColumn,jColumn,value); } else if (jColumngetNumElements()), maximumElements_(matrix->getNumElements()), numberQuadraticElements_(0), maximumQuadraticElements_(0), rowType_(NULL), integerType_(NULL), columnType_(NULL), start_(NULL), elements_(NULL), packedMatrix_(NULL), quadraticElements_(NULL), sortIndices_(NULL), sortElements_(NULL), sortSize_(0), sizeAssociated_(0), associated_(NULL), numberSOS_(0), startSOS_(NULL), memberSOS_(NULL), typeSOS_(NULL), prioritySOS_(NULL), referenceSOS_(NULL), priority_(NULL), cut_(NULL), moreInfo_(NULL), type_(-1), noNames_(false), links_(0) { numberRows_ = numberRows; numberColumns_ = numberColumns; assert (numberRows_>=matrix->getNumRows()); assert (numberColumns_>=matrix->getNumCols()); type_ = 3; packedMatrix_ = new CoinPackedMatrix(*matrix); rowLower_ = CoinCopyOfArray(rowLower,numberRows_); rowUpper_ = CoinCopyOfArray(rowUpper,numberRows_); objective_ = CoinCopyOfArray(objective,numberColumns_); columnLower_ = CoinCopyOfArray(columnLower,numberColumns_); columnUpper_ = CoinCopyOfArray(columnUpper,numberColumns_); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinModel::CoinModel (const CoinModel & rhs) : CoinBaseModel(rhs), maximumRows_(rhs.maximumRows_), maximumColumns_(rhs.maximumColumns_), numberElements_(rhs.numberElements_), maximumElements_(rhs.maximumElements_), numberQuadraticElements_(rhs.numberQuadraticElements_), maximumQuadraticElements_(rhs.maximumQuadraticElements_), rowName_(rhs.rowName_), columnName_(rhs.columnName_), string_(rhs.string_), hashElements_(rhs.hashElements_), rowList_(rhs.rowList_), columnList_(rhs.columnList_), hashQuadraticElements_(rhs.hashQuadraticElements_), sortSize_(rhs.sortSize_), quadraticRowList_(rhs.quadraticRowList_), quadraticColumnList_(rhs.quadraticColumnList_), sizeAssociated_(rhs.sizeAssociated_), numberSOS_(rhs.numberSOS_), type_(rhs.type_), noNames_(rhs.noNames_), links_(rhs.links_) { rowLower_ = CoinCopyOfArray(rhs.rowLower_,maximumRows_); rowUpper_ = CoinCopyOfArray(rhs.rowUpper_,maximumRows_); rowType_ = CoinCopyOfArray(rhs.rowType_,maximumRows_); objective_ = CoinCopyOfArray(rhs.objective_,maximumColumns_); columnLower_ = CoinCopyOfArray(rhs.columnLower_,maximumColumns_); columnUpper_ = CoinCopyOfArray(rhs.columnUpper_,maximumColumns_); integerType_ = CoinCopyOfArray(rhs.integerType_,maximumColumns_); columnType_ = CoinCopyOfArray(rhs.columnType_,maximumColumns_); sortIndices_ = CoinCopyOfArray(rhs.sortIndices_,sortSize_); sortElements_ = CoinCopyOfArray(rhs.sortElements_,sortSize_); associated_ = CoinCopyOfArray(rhs.associated_,sizeAssociated_); priority_ = CoinCopyOfArray(rhs.priority_,maximumColumns_); cut_ = CoinCopyOfArray(rhs.cut_,maximumRows_); moreInfo_ = rhs.moreInfo_; if (rhs.packedMatrix_) packedMatrix_ = new CoinPackedMatrix(*rhs.packedMatrix_); else packedMatrix_ = NULL; if (numberSOS_) { startSOS_ = CoinCopyOfArray(rhs.startSOS_,numberSOS_+1); int numberMembers = startSOS_[numberSOS_]; memberSOS_ = CoinCopyOfArray(rhs.memberSOS_,numberMembers); typeSOS_ = CoinCopyOfArray(rhs.typeSOS_,numberSOS_); prioritySOS_ = CoinCopyOfArray(rhs.prioritySOS_,numberSOS_); referenceSOS_ = CoinCopyOfArray(rhs.referenceSOS_,numberMembers); } else { startSOS_ = NULL; memberSOS_ = NULL; typeSOS_ = NULL; prioritySOS_ = NULL; referenceSOS_ = NULL; } if (type_==0) { start_ = CoinCopyOfArray(rhs.start_,maximumRows_+1); } else if (type_==1) { start_ = CoinCopyOfArray(rhs.start_,maximumColumns_+1); } else { start_=NULL; } elements_ = CoinCopyOfArray(rhs.elements_,maximumElements_); quadraticElements_ = CoinCopyOfArray(rhs.quadraticElements_,maximumQuadraticElements_); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CoinModel::~CoinModel () { delete [] rowLower_; delete [] rowUpper_; delete [] rowType_; delete [] objective_; delete [] columnLower_; delete [] columnUpper_; delete [] integerType_; delete [] columnType_; delete [] start_; delete [] elements_; delete [] quadraticElements_; delete [] sortIndices_; delete [] sortElements_; delete [] associated_; delete [] startSOS_; delete [] memberSOS_; delete [] typeSOS_; delete [] prioritySOS_; delete [] referenceSOS_; delete [] priority_; delete [] cut_; delete packedMatrix_; } // Clone CoinBaseModel * CoinModel::clone() const { return new CoinModel(*this); } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CoinModel & CoinModel::operator=(const CoinModel& rhs) { if (this != &rhs) { CoinBaseModel::operator=(rhs); delete [] rowLower_; delete [] rowUpper_; delete [] rowType_; delete [] objective_; delete [] columnLower_; delete [] columnUpper_; delete [] integerType_; delete [] columnType_; delete [] start_; delete [] elements_; delete [] quadraticElements_; delete [] sortIndices_; delete [] sortElements_; delete [] associated_; delete [] startSOS_; delete [] memberSOS_; delete [] typeSOS_; delete [] prioritySOS_; delete [] referenceSOS_; delete [] priority_; delete [] cut_; delete packedMatrix_; maximumRows_ = rhs.maximumRows_; maximumColumns_ = rhs.maximumColumns_; numberElements_ = rhs.numberElements_; maximumElements_ = rhs.maximumElements_; numberQuadraticElements_ = rhs.numberQuadraticElements_; maximumQuadraticElements_ = rhs.maximumQuadraticElements_; sortSize_ = rhs.sortSize_; rowName_ = rhs.rowName_; columnName_ = rhs.columnName_; string_ = rhs.string_; hashElements_=rhs.hashElements_; hashQuadraticElements_=rhs.hashQuadraticElements_; rowList_ = rhs.rowList_; quadraticColumnList_ = rhs.quadraticColumnList_; quadraticRowList_ = rhs.quadraticRowList_; columnList_ = rhs.columnList_; sizeAssociated_= rhs.sizeAssociated_; numberSOS_ = rhs.numberSOS_; type_ = rhs.type_; noNames_ = rhs.noNames_; links_ = rhs.links_; rowLower_ = CoinCopyOfArray(rhs.rowLower_,maximumRows_); rowUpper_ = CoinCopyOfArray(rhs.rowUpper_,maximumRows_); rowType_ = CoinCopyOfArray(rhs.rowType_,maximumRows_); objective_ = CoinCopyOfArray(rhs.objective_,maximumColumns_); columnLower_ = CoinCopyOfArray(rhs.columnLower_,maximumColumns_); columnUpper_ = CoinCopyOfArray(rhs.columnUpper_,maximumColumns_); integerType_ = CoinCopyOfArray(rhs.integerType_,maximumColumns_); columnType_ = CoinCopyOfArray(rhs.columnType_,maximumColumns_); priority_ = CoinCopyOfArray(rhs.priority_,maximumColumns_); cut_ = CoinCopyOfArray(rhs.cut_,maximumRows_); moreInfo_ = rhs.moreInfo_; if (rhs.packedMatrix_) packedMatrix_ = new CoinPackedMatrix(*rhs.packedMatrix_); else packedMatrix_ = NULL; if (numberSOS_) { startSOS_ = CoinCopyOfArray(rhs.startSOS_,numberSOS_+1); int numberMembers = startSOS_[numberSOS_]; memberSOS_ = CoinCopyOfArray(rhs.memberSOS_,numberMembers); typeSOS_ = CoinCopyOfArray(rhs.typeSOS_,numberSOS_); prioritySOS_ = CoinCopyOfArray(rhs.prioritySOS_,numberSOS_); referenceSOS_ = CoinCopyOfArray(rhs.referenceSOS_,numberMembers); } else { startSOS_ = NULL; memberSOS_ = NULL; typeSOS_ = NULL; prioritySOS_ = NULL; referenceSOS_ = NULL; } if (type_==0) { start_ = CoinCopyOfArray(rhs.start_,maximumRows_+1); } else if (type_==1) { start_ = CoinCopyOfArray(rhs.start_,maximumColumns_+1); } else { start_=NULL; } elements_ = CoinCopyOfArray(rhs.elements_,maximumElements_); quadraticElements_ = CoinCopyOfArray(rhs.quadraticElements_,maximumQuadraticElements_); sortIndices_ = CoinCopyOfArray(rhs.sortIndices_,sortSize_); sortElements_ = CoinCopyOfArray(rhs.sortElements_,sortSize_); associated_ = CoinCopyOfArray(rhs.associated_,sizeAssociated_); } return *this; } /* add a row - numberInRow may be zero */ void CoinModel::addRow(int numberInRow, const int * columns, const double * elements, double rowLower, double rowUpper, const char * name) { if (type_==-1) { // initial type_=0; resize(100,0,1000); } else if (type_==1) { // mixed - do linked lists for rows createList(1); } else if (type_==3) { badType(); } int newColumn=-1; if (numberInRow>0) { // Move and sort if (numberInRow>sortSize_) { delete [] sortIndices_; delete [] sortElements_; sortSize_ = numberInRow+100; sortIndices_ = new int [sortSize_]; sortElements_ = new double [sortSize_]; } bool sorted = true; int last=-1; int i; for (i=0;imaximumElements_) { newElement = (3*(numberElements_+numberInRow)/2) + 1000; if (numberRows_*10>maximumRows_*9) newRow = (maximumRows_*3)/2+100; } if (numberRows_==maximumRows_) newRow = (maximumRows_*3)/2+100; if (newRow||newColumn>=maximumColumns_||newElement) { if (newColumn(numberRows_); //elements_[put].string=0; elements_[put].column=sortIndices_[i]; elements_[put].value=sortElements_[i]; if (doHash) hashElements_.addHash(put,numberRows_,sortIndices_[i],elements_); put++; } start_[numberRows_+1]=put; numberElements_+=numberInRow; } else { if (numberInRow) { // must update at least one link assert (links_); if (links_==1||links_==3) { int first = rowList_.addEasy(numberRows_,numberInRow,sortIndices_,sortElements_,elements_, hashElements_); if (links_==3) columnList_.addHard(first,elements_,rowList_.firstFree(),rowList_.lastFree(), rowList_.next()); numberElements_=CoinMax(numberElements_,rowList_.numberElements()); if (links_==3) assert (columnList_.numberElements()==rowList_.numberElements()); } else if (links_==2) { columnList_.addHard(numberRows_,numberInRow,sortIndices_,sortElements_,elements_, hashElements_); numberElements_=CoinMax(numberElements_,columnList_.numberElements()); } } numberElements_=CoinMax(numberElements_,hashElements_.numberItems()); } numberRows_++; } // add a column - numberInColumn may be zero */ void CoinModel::addColumn(int numberInColumn, const int * rows, const double * elements, double columnLower, double columnUpper, double objectiveValue, const char * name, bool isInteger) { if (type_==-1) { // initial type_=1; resize(0,100,1000); } else if (type_==0) { // mixed - do linked lists for columns createList(2); } else if (type_==3) { badType(); } int newRow=-1; if (numberInColumn>0) { // Move and sort if (numberInColumn>sortSize_) { delete [] sortIndices_; delete [] sortElements_; sortSize_ = numberInColumn+100; sortIndices_ = new int [sortSize_]; sortElements_ = new double [sortSize_]; } bool sorted = true; int last=-1; int i; for (i=0;imaximumElements_) { newElement = (3*(numberElements_+numberInColumn)/2) + 1000; if (numberColumns_*10>maximumColumns_*9) newColumn = (maximumColumns_*3)/2+100; } if (numberColumns_==maximumColumns_) newColumn = (maximumColumns_*3)/2+100; if (newColumn||newRow>=maximumRows_||newElement) { if (newRow(sortIndices_[i]); elements_[put].value=sortElements_[i]; if (doHash) hashElements_.addHash(put,sortIndices_[i],numberColumns_,elements_); put++; } start_[numberColumns_+1]=put; numberElements_+=numberInColumn; } else { if (numberInColumn) { // must update at least one link assert (links_); if (links_==2||links_==3) { int first = columnList_.addEasy(numberColumns_,numberInColumn,sortIndices_,sortElements_,elements_, hashElements_); if (links_==3) rowList_.addHard(first,elements_,columnList_.firstFree(),columnList_.lastFree(), columnList_.next()); numberElements_=CoinMax(numberElements_,columnList_.numberElements()); if (links_==3) assert (columnList_.numberElements()==rowList_.numberElements()); } else if (links_==1) { rowList_.addHard(numberColumns_,numberInColumn,sortIndices_,sortElements_,elements_, hashElements_); numberElements_=CoinMax(numberElements_,rowList_.numberElements()); } } } numberColumns_++; } // Sets value for row i and column j void CoinModel::setElement(int i,int j,double value) { if (type_==-1) { // initial type_=0; resize(100,100,1000); createList(2); } else if (type_==3) { badType(); } else if (!links_) { if (type_==0||type_==2) { createList(1); } else if(type_==1) { createList(2); } } if (!hashElements_.maximumItems()) { hashElements_.resize(maximumElements_,elements_); } int position = hashElements_.hash(i,j,elements_); if (position>=0) { elements_[position].value=value; setStringInTriple(elements_[position],false); } else { int newColumn=0; if (j>=maximumColumns_) { newColumn = j+1; } int newRow=0; if (i>=maximumRows_) { newRow = i+1; } int newElement=0; if (numberElements_==maximumElements_) { newElement = (3*numberElements_/2) + 1000; } if (newRow||newColumn||newElement) { if (newColumn) newColumn = (3*newColumn)/2+100; if (newRow) newRow = (3*newRow)/2+100; resize(newRow,newColumn,newElement); } // If columns extended - take care of that fillColumns(j,false); // If rows extended - take care of that fillRows(i,false); // treat as addRow unless only columnList_ exists if ((links_&1)!=0) { int first = rowList_.addEasy(i,1,&j,&value,elements_,hashElements_); if (links_==3) columnList_.addHard(first,elements_,rowList_.firstFree(),rowList_.lastFree(), rowList_.next()); numberElements_=CoinMax(numberElements_,rowList_.numberElements()); if (links_==3) assert (columnList_.numberElements()==rowList_.numberElements()); } else if (links_==2) { columnList_.addHard(i,1,&j,&value,elements_,hashElements_); numberElements_=CoinMax(numberElements_,columnList_.numberElements()); } numberRows_=CoinMax(numberRows_,i+1);; numberColumns_=CoinMax(numberColumns_,j+1);; } } // Sets quadratic value for column i and j void CoinModel::setQuadraticElement(int ,int ,double ) { printf("not written yet\n"); abort(); return; } // Sets value for row i and column j as string void CoinModel::setElement(int i,int j,const char * value) { double dummyValue=1.0; if (type_==-1) { // initial type_=0; resize(100,100,1000); createList(2); } else if (type_==3) { badType(); } else if (!links_) { if (type_==0||type_==2) { createList(1); } else if(type_==1) { createList(2); } } if (!hashElements_.maximumItems()) { // set up number of items hashElements_.setNumberItems(numberElements_); hashElements_.resize(maximumElements_,elements_); } int position = hashElements_.hash(i,j,elements_); if (position>=0) { int iValue = addString(value); elements_[position].value=iValue; setStringInTriple(elements_[position],true); } else { int newColumn=0; if (j>=maximumColumns_) { newColumn = j+1; } int newRow=0; if (i>=maximumRows_) { newRow = i+1; } int newElement=0; if (numberElements_==maximumElements_) { newElement = (3*numberElements_/2) + 1000; } if (newRow||newColumn||newElement) { if (newColumn) newColumn = (3*newColumn)/2+100; if (newRow) newRow = (3*newRow)/2+100; resize(newRow,newColumn,newElement); } // If columns extended - take care of that fillColumns(j,false); // If rows extended - take care of that fillRows(i,false); // treat as addRow unless only columnList_ exists if ((links_&1)!=0) { int first = rowList_.addEasy(i,1,&j,&dummyValue,elements_,hashElements_); if (links_==3) columnList_.addHard(first,elements_,rowList_.firstFree(),rowList_.lastFree(), rowList_.next()); numberElements_=CoinMax(numberElements_,rowList_.numberElements()); if (links_==3) assert (columnList_.numberElements()==rowList_.numberElements()); } else if (links_==2) { columnList_.addHard(i,1,&j,&dummyValue,elements_,hashElements_); numberElements_=CoinMax(numberElements_,columnList_.numberElements()); } numberRows_=CoinMax(numberRows_,i+1);; numberColumns_=CoinMax(numberColumns_,j+1);; int position = hashElements_.hash(i,j,elements_); assert (position>=0); int iValue = addString(value); elements_[position].value=iValue; setStringInTriple(elements_[position],true); } } // Associates a string with a value. Returns string id (or -1 if does not exist) int CoinModel::associateElement(const char * stringValue, double value) { int position = string_.hash(stringValue); if (position<0) { // not there -add position = addString(stringValue); assert (position==string_.numberItems()-1); } if (sizeAssociated_<=position) { int newSize = (3*position)/2+100; double * temp = new double[newSize]; CoinMemcpyN(associated_,sizeAssociated_,temp); CoinFillN(temp+sizeAssociated_,newSize-sizeAssociated_,unsetValue()); delete [] associated_; associated_ = temp; sizeAssociated_=newSize; } associated_[position]=value; return position; } /* Sets rowLower (if row does not exist then all rows up to this are defined with default values and no elements) */ void CoinModel::setRowLower(int whichRow,double rowLower) { assert (whichRow>=0); // make sure enough room and fill fillRows(whichRow,true); rowLower_[whichRow]=rowLower; rowType_[whichRow] &= ~1; } /* Sets rowUpper (if row does not exist then all rows up to this are defined with default values and no elements) */ void CoinModel::setRowUpper(int whichRow,double rowUpper) { assert (whichRow>=0); // make sure enough room and fill fillRows(whichRow,true); rowUpper_[whichRow]=rowUpper; rowType_[whichRow] &= ~2; } /* Sets rowLower and rowUpper (if row does not exist then all rows up to this are defined with default values and no elements) */ void CoinModel::setRowBounds(int whichRow,double rowLower,double rowUpper) { assert (whichRow>=0); // make sure enough room and fill fillRows(whichRow,true); rowLower_[whichRow]=rowLower; rowUpper_[whichRow]=rowUpper; rowType_[whichRow] &= ~3; } /* Sets name (if row does not exist then all rows up to this are defined with default values and no elements) */ void CoinModel::setRowName(int whichRow,const char * rowName) { assert (whichRow>=0); // make sure enough room and fill fillRows(whichRow,true); assert (!noNames_) ; const char * oldName = rowName_.name(whichRow); if (oldName) rowName_.deleteHash(whichRow); if (rowName) rowName_.addHash(whichRow,rowName); } /* Sets columnLower (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnLower(int whichColumn,double columnLower) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); columnLower_[whichColumn]=columnLower; columnType_[whichColumn] &= ~1; } /* Sets columnUpper (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnUpper(int whichColumn,double columnUpper) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); columnUpper_[whichColumn]=columnUpper; columnType_[whichColumn] &= ~2; } /* Sets columnLower and columnUpper (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnBounds(int whichColumn,double columnLower,double columnUpper) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); columnLower_[whichColumn]=columnLower; columnUpper_[whichColumn]=columnUpper; columnType_[whichColumn] &= ~3; } /* Sets columnObjective (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnObjective(int whichColumn,double columnObjective) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); objective_[whichColumn]=columnObjective; columnType_[whichColumn] &= ~4; } /* Sets name (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnName(int whichColumn,const char * columnName) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); const char * oldName = columnName_.name(whichColumn); assert (!noNames_) ; if (oldName) columnName_.deleteHash(whichColumn); if (columnName) columnName_.addHash(whichColumn,columnName); } /* Sets integer (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnIsInteger(int whichColumn,bool columnIsInteger) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); integerType_[whichColumn]=(columnIsInteger) ? 1 : 0; columnType_[whichColumn] &= ~8; } // Adds one string, returns index int CoinModel::addString(const char * string) { int position = string_.hash(string); if (position<0) { position = string_.numberItems(); string_.addHash(position,string); } return position; } /* Sets rowLower (if row does not exist then all rows up to this are defined with default values and no elements) */ void CoinModel::setRowLower(int whichRow,const char * rowLower) { assert (whichRow>=0); // make sure enough room and fill fillRows(whichRow,true); if (rowLower) { int value = addString(rowLower); rowLower_[whichRow]=value; rowType_[whichRow] |= 1; } else { rowLower_[whichRow]=-COIN_DBL_MAX; } } /* Sets rowUpper (if row does not exist then all rows up to this are defined with default values and no elements) */ void CoinModel::setRowUpper(int whichRow,const char * rowUpper) { assert (whichRow>=0); // make sure enough room and fill fillRows(whichRow,true); if (rowUpper) { int value = addString(rowUpper); rowUpper_[whichRow]=value; rowType_[whichRow] |= 2; } else { rowUpper_[whichRow]=COIN_DBL_MAX; } } /* Sets columnLower (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnLower(int whichColumn,const char * columnLower) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); if (columnLower) { int value = addString(columnLower); columnLower_[whichColumn]=value; columnType_[whichColumn] |= 1; } else { columnLower_[whichColumn]=0.0; } } /* Sets columnUpper (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnUpper(int whichColumn,const char * columnUpper) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); if (columnUpper) { int value = addString(columnUpper); columnUpper_[whichColumn]=value; columnType_[whichColumn] |= 2; } else { columnUpper_[whichColumn]=COIN_DBL_MAX; } } /* Sets columnObjective (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnObjective(int whichColumn,const char * columnObjective) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); if (columnObjective) { int value = addString(columnObjective); objective_[whichColumn]=value; columnType_[whichColumn] |= 4; } else { objective_[whichColumn]=0.0; } } /* Sets integer (if column does not exist then all columns up to this are defined with default values and no elements) */ void CoinModel::setColumnIsInteger(int whichColumn,const char * columnIsInteger) { assert (whichColumn>=0); // make sure enough room and fill fillColumns(whichColumn,true); if (columnIsInteger) { int value = addString(columnIsInteger); integerType_[whichColumn]=value; columnType_[whichColumn] |= 8; } else { integerType_[whichColumn]=0; } } //static const char * minusInfinity="-infinity"; //static const char * plusInfinity="+infinity"; //static const char * zero="0.0"; static const char * numeric="Numeric"; /* Gets rowLower (if row does not exist then -COIN_DBL_MAX) */ const char * CoinModel::getRowLowerAsString(int whichRow) const { assert (whichRow>=0); if (whichRow (rowLower_[whichRow]); return string_.name(position); } else { return numeric; } } else { return numeric; } } /* Gets rowUpper (if row does not exist then +COIN_DBL_MAX) */ const char * CoinModel::getRowUpperAsString(int whichRow) const { assert (whichRow>=0); if (whichRow (rowUpper_[whichRow]); return string_.name(position); } else { return numeric; } } else { return numeric; } } /* Gets columnLower (if column does not exist then 0.0) */ const char * CoinModel::getColumnLowerAsString(int whichColumn) const { assert (whichColumn>=0); if (whichColumn (columnLower_[whichColumn]); return string_.name(position); } else { return numeric; } } else { return numeric; } } /* Gets columnUpper (if column does not exist then COIN_DBL_MAX) */ const char * CoinModel::getColumnUpperAsString(int whichColumn) const { assert (whichColumn>=0); if (whichColumn (columnUpper_[whichColumn]); return string_.name(position); } else { return numeric; } } else { return numeric; } } /* Gets columnObjective (if column does not exist then 0.0) */ const char * CoinModel::getColumnObjectiveAsString(int whichColumn) const { assert (whichColumn>=0); if (whichColumn (objective_[whichColumn]); return string_.name(position); } else { return numeric; } } else { return numeric; } } /* Gets if integer (if column does not exist then false) */ const char * CoinModel::getColumnIsIntegerAsString(int whichColumn) const { assert (whichColumn>=0); if (whichColumn=0); if (whichRow=0); if (whichColumn=0) deleteThisElement(row,column,iPos); return iPos; } // Takes element out of matrix when position known void #ifndef NDEBUG CoinModel::deleteThisElement(int row, int column,int position) #else CoinModel::deleteThisElement(int , int ,int position) #endif { assert (row(elements_[position].column)); if ((links_&1)==0) { createList(1); } assert (links_); // row links guaranteed to exist rowList_.deleteRowOne(position,elements_,hashElements_); // Just need to set first and last and take out if (links_==3) columnList_.updateDeletedOne(position,elements_); elements_[position].column=-1; elements_[position].value=0.0; } /* Packs down all rows i.e. removes empty rows permanently. Empty rows have no elements and feasible bounds. returns number of rows deleted. */ int CoinModel::packRows() { if (type_==3) badType(); int * newRow = new int[numberRows_]; memset(newRow,0,numberRows_*sizeof(int)); int iRow; int n=0; for (iRow=0;iRow=0) { iRow = rowInTriple(elements_[i]); assert (iRow>=0&&iRow=0) { elements_[n]=elements_[i]; setRowInTriple(elements_[n],newRow[rowInTriple(elements_[i])]); n++; } } numberElements_=n; // now redo if (doRowNames) { rowName_.setNumberItems(numberRows_); rowName_.resize(rowName_.maximumItems(),true); } if (hashElements_.numberItems()) { hashElements_.setNumberItems(numberElements_); hashElements_.resize(hashElements_.maximumItems(),elements_,true); } if (start_) { int last=-1; if (type_==0) { for (i=0;i=last); if (now>last) { start_[last+1]=numberElements_; for (int j=last+1;j=last); if (now>last) { start_[last+1]=numberElements_; for (int j=last+1;j=0) { iColumn = static_cast (elements_[i].column); assert (iColumn>=0&&iColumn=0) { elements_[n]=elements_[i]; elements_[n].column = newColumn[elements_[i].column]; n++; } } numberElements_=n; // now redo if (doColumnNames) { columnName_.setNumberItems(numberColumns_); columnName_.resize(columnName_.maximumItems(),true); } if (hashElements_.numberItems()) { hashElements_.setNumberItems(numberElements_); hashElements_.resize(hashElements_.maximumItems(),elements_,true); } if (start_) { int last=-1; if (type_==0) { for (i=0;i=last); if (now>last) { start_[last+1]=numberElements_; for (int j=last+1;j=last); if (now>last) { start_[last+1]=numberElements_; for (int j=last+1;j=0) { length[column]++; numberElements++; } } int numberErrors=0; CoinBigIndex * start = new int[numberColumns_+1]; int * row = new int[numberElements]; double * element = new double[numberElements]; start[0]=0; for (i=0;i=0) { double value = elements_[i].value; if (stringInTriple(elements_[i])) { int position = static_cast (value); assert (position=0) { double value = elements_[i].value; if (stringInTriple(elements_[i])) { int position = static_cast (value); assert (position=0) startPositive[numberColumns_]=numberElements; return numberErrors; } /* Creates +-1 matrix given startPositive and startNegative counts for +-1 matrix. */ void CoinModel::createPlusMinusOne(CoinBigIndex * startPositive, CoinBigIndex * startNegative, int * indices, const double * associated) { if (type_==3) badType(); CoinBigIndex size=0; int iColumn; for (iColumn=0;iColumn=0) { double value = elements_[i].value; if (stringInTriple(elements_[i])) { int position = static_cast (value); assert (position=0;iColumn--) { startPositive[iColumn+1]=startNegative[iColumn]; startNegative[iColumn]=startPositive[iColumn]; } startPositive[0]=0; for (iColumn=0;iColumn (rowLower[iRow]); assert (position (rowUpper[iRow]); assert (position (columnLower[iColumn]); assert (position (columnUpper[iColumn]); assert (position (objective[iColumn]); assert (position (value); } } } return numberErrors; } /* Write the problem in MPS format to a file with the given filename. */ int CoinModel::writeMps(const char *filename, int compression, int formatType , int numberAcross , bool keepStrings) { int numberErrors = 0; // Set arrays for normal use double * rowLower = rowLower_; double * rowUpper = rowUpper_; double * columnLower = columnLower_; double * columnUpper = columnUpper_; double * objective = objective_; int * integerType = integerType_; double * associated = associated_; // If strings then do copies if (string_.numberItems()) { numberErrors = createArrays(rowLower, rowUpper, columnLower, columnUpper, objective, integerType,associated); } CoinPackedMatrix matrix; if (type_!=3) { createPackedMatrix(matrix,associated); } else { matrix = *packedMatrix_; } char* integrality = new char[numberColumns_]; bool hasInteger = false; for (int i = 0; i < numberColumns_; i++) { if (integerType[i]) { integrality[i] = 1; hasInteger = true; } else { integrality[i] = 0; } } CoinMpsIO writer; writer.setInfinity(COIN_DBL_MAX); const char *const * rowNames=NULL; if (rowName_.numberItems()) rowNames=rowName_.names(); const char * const * columnNames=NULL; if (columnName_.numberItems()) columnNames=columnName_.names(); writer.setMpsData(matrix, COIN_DBL_MAX, columnLower, columnUpper, objective, hasInteger ? integrality : 0, rowLower, rowUpper, columnNames,rowNames); delete[] integrality; if (rowLower!=rowLower_) { delete [] rowLower; delete [] rowUpper; delete [] columnLower; delete [] columnUpper; delete [] objective; delete [] integerType; delete [] associated; if (numberErrors&&logLevel_>0&&!keepStrings) printf("%d string elements had no values associated with them\n",numberErrors); } writer.setObjectiveOffset(objectiveOffset_); writer.setProblemName(problemName_.c_str()); if (keepStrings&&string_.numberItems()) { // load up strings - sorted by column and row writer.copyStringElements(this); } return writer.writeMps(filename, compression, formatType, numberAcross); } /* Check two models against each other. Return nonzero if different. Ignore names if that set. May modify both models by cleaning up */ int CoinModel::differentModel(CoinModel & other, bool ignoreNames) { int numberErrors = 0; int numberErrors2 = 0; int returnCode=0; if (numberRows_!=other.numberRows_||numberColumns_!=other.numberColumns_) { if (logLevel_>0) printf("** Mismatch on size, this has %d rows, %d columns - other has %d rows, %d columns\n", numberRows_,numberColumns_,other.numberRows_,other.numberColumns_); returnCode=1000; } // Set arrays for normal use double * rowLower = rowLower_; double * rowUpper = rowUpper_; double * columnLower = columnLower_; double * columnUpper = columnUpper_; double * objective = objective_; int * integerType = integerType_; double * associated = associated_; // If strings then do copies if (string_.numberItems()) { numberErrors += createArrays(rowLower, rowUpper, columnLower, columnUpper, objective, integerType,associated); } // Set arrays for normal use double * rowLower2 = other.rowLower_; double * rowUpper2 = other.rowUpper_; double * columnLower2 = other.columnLower_; double * columnUpper2 = other.columnUpper_; double * objective2 = other.objective_; int * integerType2 = other.integerType_; double * associated2 = other.associated_; // If strings then do copies if (other.string_.numberItems()) { numberErrors2 += other.createArrays(rowLower2, rowUpper2, columnLower2, columnUpper2, objective2, integerType2,associated2); } CoinPackedMatrix matrix; createPackedMatrix(matrix,associated); CoinPackedMatrix matrix2; other.createPackedMatrix(matrix2,associated2); if (numberErrors||numberErrors2) if (logLevel_>0) printf("** Errors when converting strings, %d on this, %d on other\n", numberErrors,numberErrors2); CoinRelFltEq tolerance; if (numberRows_==other.numberRows_) { bool checkNames = !ignoreNames; if (!rowName_.numberItems()|| !other.rowName_.numberItems()) checkNames=false; int numberDifferentL = 0; int numberDifferentU = 0; int numberDifferentN = 0; for (int i=0;i0) printf("Row differences , %d lower, %d upper and %d names\n", numberDifferentL,numberDifferentU,numberDifferentN); } if (numberColumns_==other.numberColumns_) { int numberDifferentL = 0; int numberDifferentU = 0; int numberDifferentN = 0; int numberDifferentO = 0; int numberDifferentI = 0; bool checkNames = !ignoreNames; if (!columnName_.numberItems()|| !other.columnName_.numberItems()) checkNames=false; for (int i=0;i0) printf("Column differences , %d lower, %d upper, %d objective, %d integer and %d names\n", numberDifferentL,numberDifferentU,numberDifferentO, numberDifferentI,numberDifferentN); } if (numberRows_==other.numberRows_&& numberColumns_==other.numberColumns_&& numberElements_==other.numberElements_) { if (!matrix.isEquivalent(matrix2,tolerance)) { returnCode+=100; if (returnCode&&logLevel_>0) printf("Two matrices are not same\n"); } } if (rowLower!=rowLower_) { delete [] rowLower; delete [] rowUpper; delete [] columnLower; delete [] columnUpper; delete [] objective; delete [] integerType; delete [] associated; } if (rowLower2!=other.rowLower_) { delete [] rowLower2; delete [] rowUpper2; delete [] columnLower2; delete [] columnUpper2; delete [] objective2; delete [] integerType2; delete [] associated2; } return returnCode; } // Returns value for row i and column j double CoinModel::getElement(int i,int j) const { if (!hashElements_.numberItems()) { hashElements_.setNumberItems(numberElements_); hashElements_.resize(maximumElements_,elements_); } int position = hashElements_.hash(i,j,elements_); if (position>=0) { return elements_[position].value; } else { return 0.0; } } // Returns value for row rowName and column columnName double CoinModel::getElement(const char * rowName,const char * columnName) const { if (!hashElements_.numberItems()) { hashElements_.setNumberItems(numberElements_); hashElements_.resize(maximumElements_,elements_); } assert (!noNames_); int i=rowName_.hash(rowName); int j=columnName_.hash(columnName); int position; if (i>=0&&j>=0) position = hashElements_.hash(i,j,elements_); else position=-1; if (position>=0) { return elements_[position].value; } else { return 0.0; } } // Returns quadratic value for columns i and j double CoinModel::getQuadraticElement(int ,int ) const { printf("not written yet\n"); abort(); return 0.0; } // Returns value for row i and column j as string const char * CoinModel::getElementAsString(int i,int j) const { if (!hashElements_.numberItems()) { hashElements_.setNumberItems(numberElements_); hashElements_.resize(maximumElements_,elements_); } int position = hashElements_.hash(i,j,elements_); if (position>=0) { if (stringInTriple(elements_[position])) { int iString = static_cast (elements_[position].value); assert (iString>=0&&iString=0) { return &(elements_[position].value); } else { return NULL; } } /* Returns first element in given row - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink CoinModel::firstInRow(int whichRow) const { CoinModelLink link; if (whichRow>=0&&whichRow=0) { link.setRow(whichRow); link.setPosition(position); link.setColumn(elements_[position].column); assert (whichRow==rowInTriple(elements_[position])); link.setValue(elements_[position].value); } } } return link; } /* Returns last element in given row - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink CoinModel::lastInRow(int whichRow) const { CoinModelLink link; if (whichRow>=0&&whichRow=start_[whichRow]) { link.setRow(whichRow); link.setPosition(position); link.setColumn(elements_[position].column); assert (whichRow==rowInTriple(elements_[position])); link.setValue(elements_[position].value); } } else { fillList(whichRow,rowList_,1); int position = rowList_.last(whichRow); if (position>=0) { link.setRow(whichRow); link.setPosition(position); link.setColumn(elements_[position].column); assert (whichRow==rowInTriple(elements_[position])); link.setValue(elements_[position].value); } } } return link; } /* Returns first element in given column - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink CoinModel::firstInColumn(int whichColumn) const { CoinModelLink link; if (whichColumn>=0&&whichColumn (elements_[position].column)); link.setValue(elements_[position].value); } } else { fillList(whichColumn,columnList_,2); if ((links_&2)==0) { // Create list assert (!columnList_.numberMajor()); createList(2); } int position = columnList_.first(whichColumn); if (position>=0) { link.setColumn(whichColumn); link.setPosition(position); link.setRow(rowInTriple(elements_[position])); assert (whichColumn==static_cast (elements_[position].column)); link.setValue(elements_[position].value); } } } return link; } /* Returns last element in given column - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink CoinModel::lastInColumn(int whichColumn) const { CoinModelLink link; if (whichColumn>=0&&whichColumn=start_[whichColumn]) { link.setColumn(whichColumn); link.setPosition(position); link.setRow(rowInTriple(elements_[position])); assert (whichColumn==static_cast (elements_[position].column)); link.setValue(elements_[position].value); } } else { fillList(whichColumn,columnList_,2); int position = columnList_.last(whichColumn); if (position>=0) { link.setColumn(whichColumn); link.setPosition(position); link.setRow(rowInTriple(elements_[position])); assert (whichColumn==static_cast (elements_[position].column)); link.setValue(elements_[position].value); } } } return link; } /* Returns next element in current row or column - index is -1 if none. Index is given by .index and value by .value. User could also tell because input.next would be NULL */ CoinModelLink CoinModel::next(CoinModelLink & current) const { CoinModelLink link=current; int position = current.position(); if (position>=0) { if (current.onRow()) { // Doing by row int whichRow = current.row(); if (type_==0) { assert (start_); position++; if (position=0) { link.setPosition(position); link.setColumn(elements_[position].column); assert (whichRow==rowInTriple(elements_[position])); link.setValue(elements_[position].value); } else { // signal end link.setPosition(-1); link.setColumn(-1); link.setRow(-1); link.setValue(0.0); } } } else { // Doing by column int whichColumn = current.column(); if (type_==1) { assert (start_); position++; if (position (elements_[position].column)); link.setValue(elements_[position].value); } else { // signal end link.setPosition(-1); link.setColumn(-1); link.setRow(-1); link.setValue(0.0); } } else { assert ((links_&2)!=0); position = columnList_.next()[position]; if (position>=0) { link.setPosition(position); link.setRow(rowInTriple(elements_[position])); assert (whichColumn==static_cast (elements_[position].column)); link.setValue(elements_[position].value); } else { // signal end link.setPosition(-1); link.setColumn(-1); link.setRow(-1); link.setValue(0.0); } } } } return link; } /* Returns previous element in current row or column - index is -1 if none. Index is given by .index and value by .value. User could also tell because input.previous would be NULL */ CoinModelLink CoinModel::previous(CoinModelLink & current) const { CoinModelLink link=current; int position = current.position(); if (position>=0) { if (current.onRow()) { // Doing by row int whichRow = current.row(); if (type_==0) { assert (start_); position--; if (position>=start_[whichRow]) { link.setPosition(position); link.setColumn(elements_[position].column); assert (whichRow==rowInTriple(elements_[position])); link.setValue(elements_[position].value); } else { // signal end link.setPosition(-1); link.setColumn(-1); link.setRow(-1); link.setValue(0.0); } } else { assert ((links_&1)!=0); position = rowList_.previous()[position]; if (position>=0) { link.setPosition(position); link.setColumn(elements_[position].column); assert (whichRow==rowInTriple(elements_[position])); link.setValue(elements_[position].value); } else { // signal end link.setPosition(-1); link.setColumn(-1); link.setRow(-1); link.setValue(0.0); } } } else { // Doing by column int whichColumn = current.column(); if (type_==1) { assert (start_); position--; if (position>=start_[whichColumn]) { link.setPosition(position); link.setRow(rowInTriple(elements_[position])); assert (whichColumn==static_cast (elements_[position].column)); link.setValue(elements_[position].value); } else { // signal end link.setPosition(-1); link.setColumn(-1); link.setRow(-1); link.setValue(0.0); } } else { assert ((links_&2)!=0); position = columnList_.previous()[position]; if (position>=0) { link.setPosition(position); link.setRow(rowInTriple(elements_[position])); assert (whichColumn==static_cast (elements_[position].column)); link.setValue(elements_[position].value); } else { // signal end link.setPosition(-1); link.setColumn(-1); link.setRow(-1); link.setValue(0.0); } } } } return link; } /* Returns first element in given quadratic column - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink CoinModel::firstInQuadraticColumn(int ) const { printf("not written yet\n"); abort(); CoinModelLink x; return x; } /* Returns last element in given quadratic column - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink CoinModel::lastInQuadraticColumn(int) const { printf("not written yet\n"); abort(); CoinModelLink x; return x; } /* Gets rowLower (if row does not exist then -COIN_DBL_MAX) */ double CoinModel::getRowLower(int whichRow) const { assert (whichRow>=0); if (whichRow=0); if (whichRow=0); if (whichRow=0); if (whichColumn=0); if (whichColumn=0); if (whichColumn=0); if (whichColumn=0); if (whichColumnmaximumRows_) { bool needFill = rowLower_==NULL; double * tempArray; tempArray = new double[maximumRows]; CoinMemcpyN(rowLower_,numberRows_,tempArray); # ifdef ZEROFAULT memset(tempArray+numberRows_,0,(maximumRows-numberRows_)*sizeof(double)) ; # endif delete [] rowLower_; rowLower_=tempArray; tempArray = new double[maximumRows]; CoinMemcpyN(rowUpper_,numberRows_,tempArray); # ifdef ZEROFAULT memset(tempArray+numberRows_,0,(maximumRows-numberRows_)*sizeof(double)) ; # endif delete [] rowUpper_; rowUpper_=tempArray; int * tempArray2; tempArray2 = new int[maximumRows]; CoinMemcpyN(rowType_,numberRows_,tempArray2); # ifdef ZEROFAULT memset(tempArray2+numberRows_,0,(maximumRows-numberRows_)*sizeof(int)) ; # endif delete [] rowType_; rowType_=tempArray2; // resize hash if (!noNames_) rowName_.resize(maximumRows); // If we have links we need to resize if ((links_&1)!=0) { rowList_.resize(maximumRows,maximumElements); } // If we have start then we need to resize that if (type_==0) { int * tempArray2; tempArray2 = new int[maximumRows+1]; # ifdef ZEROFAULT memset(tempArray2,0,(maximumRows+1)*sizeof(int)) ; # endif if (start_) { CoinMemcpyN(start_,(numberRows_+1),tempArray2); delete [] start_; } else { tempArray2[0]=0; } start_=tempArray2; } maximumRows_=maximumRows; // Fill if (needFill) { int save=numberRows_-1; numberRows_=0; fillRows(save,true); } } } else if (type_==3) { badType(); } if (type_==1||type_==2) { // need to redo column stuff maximumColumns = CoinMax(maximumColumns,numberColumns_); if (maximumColumns>maximumColumns_) { bool needFill = columnLower_==NULL; double * tempArray; tempArray = new double[maximumColumns]; CoinMemcpyN(columnLower_,numberColumns_,tempArray); # ifdef ZEROFAULT memset(tempArray+numberColumns_,0, (maximumColumns-numberColumns_)*sizeof(double)) ; # endif delete [] columnLower_; columnLower_=tempArray; tempArray = new double[maximumColumns]; CoinMemcpyN(columnUpper_,numberColumns_,tempArray); # ifdef ZEROFAULT memset(tempArray+numberColumns_,0, (maximumColumns-numberColumns_)*sizeof(double)) ; # endif delete [] columnUpper_; columnUpper_=tempArray; tempArray = new double[maximumColumns]; CoinMemcpyN(objective_,numberColumns_,tempArray); # ifdef ZEROFAULT memset(tempArray+numberColumns_,0, (maximumColumns-numberColumns_)*sizeof(double)) ; # endif delete [] objective_; objective_=tempArray; int * tempArray2; tempArray2 = new int[maximumColumns]; CoinMemcpyN(columnType_,numberColumns_,tempArray2); # ifdef ZEROFAULT memset(tempArray2+numberColumns_,0, (maximumColumns-numberColumns_)*sizeof(int)) ; # endif delete [] columnType_; columnType_=tempArray2; tempArray2 = new int[maximumColumns]; CoinMemcpyN(integerType_,numberColumns_,tempArray2); # ifdef ZEROFAULT memset(tempArray2+numberColumns_,0, (maximumColumns-numberColumns_)*sizeof(int)) ; # endif delete [] integerType_; integerType_=tempArray2; // resize hash if (!noNames_) columnName_.resize(maximumColumns); // If we have links we need to resize if ((links_&2)!=0) { columnList_.resize(maximumColumns,maximumElements); } // If we have start then we need to resize that if (type_==1) { int * tempArray2; tempArray2 = new int[maximumColumns+1]; # ifdef ZEROFAULT memset(tempArray2,0,(maximumColumns+1)*sizeof(int)) ; # endif if (start_) { CoinMemcpyN(start_,(numberColumns_+1),tempArray2); delete [] start_; } else { tempArray2[0]=0; } start_=tempArray2; } maximumColumns_=maximumColumns; // Fill if (needFill) { int save=numberColumns_-1; numberColumns_=0; fillColumns(save,true); } } } if (type_==3) badType(); if (maximumElements>maximumElements_) { CoinModelTriple * tempArray = new CoinModelTriple[maximumElements]; CoinMemcpyN(elements_,numberElements_,tempArray); # ifdef ZEROFAULT memset(tempArray+numberElements_,0, (maximumElements-numberElements_)*sizeof(CoinModelTriple)) ; # endif delete [] elements_; elements_=tempArray; if (hashElements_.numberItems()) hashElements_.resize(maximumElements,elements_); maximumElements_=maximumElements; // If we have links we need to resize if ((links_&1)!=0) { rowList_.resize(maximumRows_,maximumElements_); } if ((links_&2)!=0) { columnList_.resize(maximumColumns_,maximumElements_); } } } void CoinModel::fillRows(int whichRow, bool forceCreation,bool fromAddRow) { if (forceCreation||fromAddRow) { if (type_==-1) { // initial type_=0; resize(CoinMax(100,whichRow+1),0,1000); } else if (type_==1) { type_=2; } if (!rowLower_) { // need to set all whichRow = numberRows_-1; numberRows_=0; if (type_!=3) resize(CoinMax(100,whichRow+1),0,0); else resize(CoinMax(1,whichRow+1),0,0); } if (whichRow>=maximumRows_) { if (type_!=3) resize(CoinMax((3*maximumRows_)/2,whichRow+1),0,0); else resize(CoinMax(1,whichRow+1),0,0); } } if (whichRow>=numberRows_&&rowLower_) { // Need to fill int i; for ( i=numberRows_;i<=whichRow;i++) { rowLower_[i]=-COIN_DBL_MAX; rowUpper_[i]=COIN_DBL_MAX; rowType_[i]=0; } } if ( !fromAddRow) { numberRows_=CoinMax(whichRow+1,numberRows_); // If simple minded then delete start if (start_) { delete [] start_; start_ = NULL; assert (!links_); // mixed - do linked lists for rows createList(1); } } } void CoinModel::fillColumns(int whichColumn,bool forceCreation,bool fromAddColumn) { if (forceCreation||fromAddColumn) { if (type_==-1) { // initial type_=1; resize(0,CoinMax(100,whichColumn+1),1000); } else if (type_==0) { type_=2; } if (!objective_) { // need to set all whichColumn = numberColumns_-1; numberColumns_=0; if (type_!=3) resize(0,CoinMax(100,whichColumn+1),0); else resize(0,CoinMax(1,whichColumn+1),0); } if (whichColumn>=maximumColumns_) { if (type_!=3) resize(0,CoinMax((3*maximumColumns_)/2,whichColumn+1),0); else resize(0,CoinMax(1,whichColumn+1),0); } } if (whichColumn>=numberColumns_&&objective_) { // Need to fill int i; for ( i=numberColumns_;i<=whichColumn;i++) { columnLower_[i]=0.0; columnUpper_[i]=COIN_DBL_MAX; objective_[i]=0.0; integerType_[i]=0; columnType_[i]=0; } } if ( !fromAddColumn) { numberColumns_=CoinMax(whichColumn+1,numberColumns_); // If simple minded then delete start if (start_) { delete [] start_; start_ = NULL; assert (!links_); // mixed - do linked lists for columns createList(2); } } } // Fill in default linked list information void CoinModel::fillList(int which, CoinModelLinkedList & list, int type) const { if ((links_&type)==0) { // Create list assert (!list.numberMajor()); if (type==1) { list.create(maximumRows_,maximumElements_,numberRows_,numberColumns_,0, numberElements_,elements_); } else { list.create(maximumColumns_,maximumElements_,numberColumns_,numberRows_,1, numberElements_,elements_); } if (links_==1 && type== 2) { columnList_.synchronize(rowList_); } else if (links_==2 && type==1) { rowList_.synchronize(columnList_); } links_ |= type; } int number = list.numberMajor(); if (which>=number) { // may still need to extend list or fill it in if (which>=list.maximumMajor()) { list.resize((which*3)/2+100,list.maximumElements()); } list.fill(number,which+1); } } /* Gets sorted row - user must provide enough space (easiest is allocate number of columns). Returns number of elements */ int CoinModel::getRow(int whichRow, int * column, double * element) { if (!hashElements_.maximumItems()) { // set up number of items hashElements_.setNumberItems(numberElements_); hashElements_.resize(maximumElements_,elements_); } assert (whichRow>=0); int n=0; if (whichRow=0) { int iColumn = triple.column(); assert (whichRow==triple.row()); if (iColumn=0); int n=0; if (whichColumn=0) { int iRow = triple.row(); assert (whichColumn==triple.column()); if (iRow='0'&&x<='9')||x=='.'||x=='+'||x=='-'||x=='e'); } char saved = *pos2; *pos2='\0'; value = atof(pos); *pos2=saved; // and down to next pos2++; pos=pos2; while (*pos2) { if (*pos2=='-'||*pos2=='+') break; pos2++; } } char saved = *pos2; *pos2='\0'; // now name // might have + or - if (*pos=='+') { pos++; } else if (*pos=='-') { pos++; assert (value==1.0); value = - value; } int jColumn = column(pos); // must be column unless first when may be linear term if (jColumn<0) { if (ifFirst) { char * pos3 = pos; while (pos3!=pos2) { #ifndef NDEBUG char x = *pos3; #endif pos3++; assert ((x>='0'&&x<='9')||x=='.'||x=='+'||x=='-'||x=='e'); } assert(*pos2=='\0'); // keep possible - value = value * atof(pos); jColumn=-2; } else { // bad *pos2=saved; printf("bad nonlinear term %s\n",phrase); // maybe return -1 abort(); } } *pos2=saved; pos=pos2; coefficient=value; nextPhrase = pos; return jColumn; } /* Gets correct form for a quadratic row - user to delete If row is not quadratic then returns which other variables are involved with tiny elements and count of total number of variables which could not be put in quadratic form */ CoinPackedMatrix * CoinModel::quadraticRow(int rowNumber,double * linearRow, int & numberBad) const { numberBad=0; CoinZeroN(linearRow,numberColumns_); int numberElements=0; assert (rowNumber>=-1&&rowNumber=0) { int iColumn = triple.column(); const char * expr = getElementAsString(rowNumber,iColumn); if (strcmp(expr,"Numeric")) { // try and see which columns assert (strlen(expr)<20000); char temp[20000]; strcpy(temp,expr); char * pos = temp; bool ifFirst=true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst); // must be column unless first when may be linear term if (jColumn>=0) { numberElements++; } else if (jColumn==-2) { linearRow[iColumn]=value; } else if (jColumn==-1) { // nonlinear term - we will just be marking numberElements++; } else { printf("bad nonlinear term %s\n",temp); abort(); } ifFirst=false; } } else { linearRow[iColumn]=getElement(rowNumber,iColumn); } triple=next(triple); } if (!numberElements) { return NULL; } else { int * column = new int[numberElements]; int * column2 = new int[numberElements]; double * element = new double[numberElements]; numberElements=0; CoinModelLink triple=firstInRow(rowNumber); while (triple.column()>=0) { int iColumn = triple.column(); const char * expr = getElementAsString(rowNumber,iColumn); if (strcmp(expr,"Numeric")) { // try and see which columns assert (strlen(expr)<20000); char temp[20000]; strcpy(temp,expr); char * pos = temp; bool ifFirst=true; while (*pos) { double value; int jColumn = decodeBit(pos, pos, value, ifFirst); // must be column unless first when may be linear term if (jColumn>=0) { column[numberElements]=iColumn; column2[numberElements]=jColumn; element[numberElements++]=value; } else if (jColumn==-1) { // nonlinear term - we will just be marking assert (jColumn>=0); column[numberElements]=iColumn; column2[numberElements]=jColumn; element[numberElements++]=1.0e-100; numberBad++; } else if (jColumn!=-2) { printf("bad nonlinear term %s\n",temp); abort(); } ifFirst=false; } } triple=next(triple); } CoinPackedMatrix * newMatrix = new CoinPackedMatrix(true,column2,column,element,numberElements); delete [] column; delete [] column2; delete [] element; return newMatrix; } } else { // objective int iColumn; for (iColumn=0;iColumn=0) { numberElements++; } else if (jColumn==-2) { linearRow[iColumn]=value; } else if (jColumn==-1) { // nonlinear term - we will just be marking numberElements++; } else { printf("bad nonlinear term %s\n",temp); abort(); } ifFirst=false; } } else { linearRow[iColumn]=getElement(rowNumber,iColumn); } } if (!numberElements) { return NULL; } else { int * column = new int[numberElements]; int * column2 = new int[numberElements]; double * element = new double[numberElements]; numberElements=0; for (iColumn=0;iColumn=0) { column[numberElements]=iColumn; column2[numberElements]=jColumn; element[numberElements++]=value; } else if (jColumn==-1) { // nonlinear term - we will just be marking assert (jColumn>=0); column[numberElements]=iColumn; column2[numberElements]=jColumn; element[numberElements++]=1.0e-100; numberBad++; } else if (jColumn!=-2) { printf("bad nonlinear term %s\n",temp); abort(); } ifFirst=false; } } } return new CoinPackedMatrix(true,column2,column,element,numberElements); } } } // Replaces a quadratic row void CoinModel::replaceQuadraticRow(int rowNumber,const double * linearRow, const CoinPackedMatrix * quadraticPart) { assert (rowNumber>=-1&&rowNumber=0) { CoinModelLink triple=firstInRow(rowNumber); while (triple.column()>=0) { int iColumn = triple.column(); deleteElement(rowNumber,iColumn); // triple stale - so start over triple=firstInRow(rowNumber); } const double * element = quadraticPart->getElements(); const int * column = quadraticPart->getIndices(); const CoinBigIndex * columnStart = quadraticPart->getVectorStarts(); const int * columnLength = quadraticPart->getVectorLengths(); int numberLook = quadraticPart->getNumCols(); int i; for (i=0;i(strlen(temp)); } for (int j=columnStart[i];j(strlen(temp2)); assert (nextPut<10000); strcpy(temp+put,temp2); put = nextPut; } setElement(rowNumber,i,temp); } } // rest of linear for (;igetElements(); const int * column = quadraticPart->getIndices(); const CoinBigIndex * columnStart = quadraticPart->getVectorStarts(); const int * columnLength = quadraticPart->getVectorLengths(); int numberLook = quadraticPart->getNumCols(); int i; for (i=0;i(strlen(temp)); } for (int j=columnStart[i];j(strlen(temp2)); assert (nextPut<10000); strcpy(temp+put,temp2); put = nextPut; } setColumnObjective(i,temp); } } // rest of linear for (;igetElements(); const int * column = row->getIndices(); const CoinBigIndex * columnStart = row->getVectorStarts(); const int * columnLength = row->getVectorLengths(); int numberLook = row->getNumCols(); for (int i=0;igetElements(); const int * columnLow = row->getIndices(); const CoinBigIndex * columnHigh = row->getVectorStarts(); const int * columnLength = row->getVectorLengths(); int numberLook = row->getNumCols(); int canSwap=0; for (int i=0;i0) { // rewrite row /* get triples then swap ones needed then create packedmatrix then replace row */ int numberElements=columnHigh[numberLook]; int * columnHigh2 = new int [numberElements]; int * columnLow2 = new int [numberElements]; double * element2 = new double [numberElements]; for (int i=0;ireplaceQuadraticRow(iRow,linear,row); delete row; } else { delete row; delete newModel; newModel=NULL; printf("Unable to use priority - row %d\n",iRow); break; } } } } delete [] highPriority; delete [] linear; return newModel; } // Sets cut marker array void CoinModel::setCutMarker(int size,const int * marker) { delete [] cut_; cut_ = new int [maximumRows_]; CoinZeroN(cut_,maximumRows_); CoinMemcpyN(marker,size,cut_); } // Sets priority array void CoinModel::setPriorities(int size,const int * priorities) { delete [] priority_; priority_ = new int [maximumColumns_]; CoinZeroN(priority_,maximumColumns_); CoinMemcpyN(priorities,size,priority_); } /* Sets columnObjective array */ void CoinModel::setObjective(int numberColumns,const double * objective) { fillColumns(numberColumns,true,true); for (int i=0;i -inf) { if (upper < inf) { right = upper; if (upper==lower) { sense = 'E'; } else { sense = 'R'; range = upper - lower; } } else { sense = 'G'; right = lower; } } else { if (upper < inf) { sense = 'L'; right = upper; } else { sense = 'N'; right = 0.0; } } } //----------------------------------------------------------------------------- /** A function to convert from the sense/rhs/range style of constraint definition to the lb/ub style */ void convertSenseToBound(const char sense, const double right, const double range, double& lower, double& upper) { double inf=COIN_DBL_MAX; switch (sense) { case 'E': lower = upper = right; break; case 'L': lower = -inf; upper = right; break; case 'G': lower = right; upper = inf; break; case 'R': lower = right - range; upper = right; break; case 'N': lower = -inf; upper = inf; break; } } void CoinModel::loadBlock(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { passInMatrix(matrix); int numberRows=matrix.getNumRows(); int numberColumns=matrix.getNumCols(); setObjective(numberColumns,obj); setRowLower(numberRows,rowlb); setRowUpper(numberRows,rowub); setColumnLower(numberColumns,collb); setColumnUpper(numberColumns,colub); } //----------------------------------------------------------------------------- void CoinModel::loadBlock(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) { // If any of Rhs NULLs then create arrays int numrows = matrix.getNumRows(); const char * rowsenUse = rowsen; if (!rowsen) { char * rowsen = new char [numrows]; for (int i=0;i= 0; --i) { convertSenseToBound(rowsenUse[i],rowrhsUse[i],rowrngUse[i],rowlb[i],rowub[i]); } if (rowsen!=rowsenUse) delete [] rowsenUse; if (rowrhs!=rowrhsUse) delete [] rowrhsUse; if (rowrng!=rowrngUse) delete [] rowrngUse; loadBlock(matrix, collb, colub, obj, rowlb, rowub); delete [] rowlb; delete [] rowub; } //----------------------------------------------------------------------------- void CoinModel::loadBlock(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { int numberElements = start[numcols]; int * length = new int [numcols]; for (int i=0;i= 0; --i) { convertSenseToBound(rowsenUse[i],rowrhsUse[i],rowrngUse[i],rowlb[i],rowub[i]); } if (rowsen!=rowsenUse) delete [] rowsenUse; if (rowrhs!=rowrhsUse) delete [] rowrhsUse; if (rowrng!=rowrngUse) delete [] rowrngUse; int numberElements = start[numcols]; int * length = new int [numcols]; for (int i=0;i //Small class for rational numbers class CoinRational { public : long getDenominator() { return denominator_; } long getNumerator() { return numerator_; } CoinRational(): numerator_(0), denominator_(1) {}; CoinRational(long n, long d): numerator_(n), denominator_(d) {}; CoinRational(double val, double maxdelta, long maxdnom) { if (!nearestRational_(val, maxdelta, maxdnom)){ numerator_ = 0; denominator_ = 1; } }; private : long numerator_; long denominator_; bool nearestRational_(double val, double maxdelta, long maxdnom); }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveForcing.hpp0000644000175000017500000000330411654260357020456 0ustar renerene/* $Id: CoinPresolveForcing.hpp 1498 2011-11-02 15:25:35Z mjs $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveForcing_H #define CoinPresolveForcing_H #include "CoinPresolveMatrix.hpp" /*! \file */ #define IMPLIED_BOUND 7 /*! \class forcing_constraint_action \brief Detect and process forcing constraints and useless constraints A constraint is useless if the bounds on the variables prevent the constraint from ever being violated. A constraint is a forcing constraint if the bounds on the constraint force the value of an involved variable to one of its bounds. A constraint can force more than one variable. */ class forcing_constraint_action : public CoinPresolveAction { forcing_constraint_action(); forcing_constraint_action(const forcing_constraint_action& rhs); forcing_constraint_action& operator=(const forcing_constraint_action& rhs); public: struct action { const int *rowcols; const double *bounds; int row; int nlo; int nup; }; private: const int nactions_; // actions_ is owned by the class and must be deleted at destruction const action *const actions_; public: forcing_constraint_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix * prob, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~forcing_constraint_action(); }; #endif CoinMP-1.8.3/CoinUtils/src/CoinMpsIO.hpp0000644000175000017500000007644712227360442016351 0ustar renerene/* $Id: CoinMpsIO.hpp 1642 2013-10-16 00:43:14Z tkr $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinMpsIO_H #define CoinMpsIO_H #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinUtilsConfig.h" #include "CoinPackedMatrix.hpp" #include "CoinMessageHandler.hpp" #include "CoinFileIO.hpp" class CoinModel; /// The following lengths are in decreasing order (for 64 bit etc) /// Large enough to contain element index /// This is already defined as CoinBigIndex /// Large enough to contain column index typedef int COINColumnIndex; /// Large enough to contain row index (or basis) typedef int COINRowIndex; // We are allowing free format - but there is a limit! // User can override by using CXXFLAGS += -DCOIN_MAX_FIELD_LENGTH=nnn #ifndef COIN_MAX_FIELD_LENGTH #define COIN_MAX_FIELD_LENGTH 160 #endif #define MAX_CARD_LENGTH 5*COIN_MAX_FIELD_LENGTH+80 enum COINSectionType { COIN_NO_SECTION, COIN_NAME_SECTION, COIN_ROW_SECTION, COIN_COLUMN_SECTION, COIN_RHS_SECTION, COIN_RANGES_SECTION, COIN_BOUNDS_SECTION, COIN_ENDATA_SECTION, COIN_EOF_SECTION, COIN_QUADRATIC_SECTION, COIN_CONIC_SECTION,COIN_QUAD_SECTION,COIN_SOS_SECTION, COIN_BASIS_SECTION,COIN_UNKNOWN_SECTION }; enum COINMpsType { COIN_N_ROW, COIN_E_ROW, COIN_L_ROW, COIN_G_ROW, COIN_BLANK_COLUMN, COIN_S1_COLUMN, COIN_S2_COLUMN, COIN_S3_COLUMN, COIN_INTORG, COIN_INTEND, COIN_SOSEND, COIN_UNSET_BOUND, COIN_UP_BOUND, COIN_FX_BOUND, COIN_LO_BOUND, COIN_FR_BOUND, COIN_MI_BOUND, COIN_PL_BOUND, COIN_BV_BOUND, COIN_UI_BOUND, COIN_LI_BOUND, COIN_BOTH_BOUNDS_SET, COIN_SC_BOUND, COIN_S1_BOUND, COIN_S2_BOUND, COIN_BS_BASIS, COIN_XL_BASIS, COIN_XU_BASIS, COIN_LL_BASIS, COIN_UL_BASIS, COIN_UNKNOWN_MPS_TYPE }; class CoinMpsIO; /// Very simple code for reading MPS data class CoinMpsCardReader { public: /**@name Constructor and destructor */ //@{ /// Constructor expects file to be open /// This one takes gzFile if fp null CoinMpsCardReader ( CoinFileInput *input, CoinMpsIO * reader ); /// Destructor ~CoinMpsCardReader ( ); //@} /**@name card stuff */ //@{ /// Read to next section COINSectionType readToNextSection ( ); /// Gets next field and returns section type e.g. COIN_COLUMN_SECTION COINSectionType nextField ( ); /** Gets next field for .gms file and returns type. -1 - EOF 0 - what we expected (and processed so pointer moves past) 1 - not what we expected leading blanks always ignored input types 0 - anything - stops on non blank card 1 - name (in columnname) 2 - value 3 - value name pair 4 - equation type 5 - ; */ int nextGmsField ( int expectedType ); /// Returns current section type inline COINSectionType whichSection ( ) const { return section_; } /// Sets current section type inline void setWhichSection(COINSectionType section ) { section_=section; } /// Sees if free format. inline bool freeFormat() const { return freeFormat_;} /// Sets whether free format. Mainly for blank RHS etc inline void setFreeFormat(bool yesNo) { freeFormat_=yesNo;} /// Only for first field on card otherwise BLANK_COLUMN /// e.g. COIN_E_ROW inline COINMpsType mpsType ( ) const { return mpsType_; } /// Reads and cleans card - taking out trailing blanks - return 1 if EOF int cleanCard(); /// Returns row name of current field inline const char *rowName ( ) const { return rowName_; } /// Returns column name of current field inline const char *columnName ( ) const { return columnName_; } /// Returns value in current field inline double value ( ) const { return value_; } /// Returns value as string in current field inline const char *valueString ( ) const { return valueString_; } /// Whole card (for printing) inline const char *card ( ) const { return card_; } /// Whole card - so we look at it (not const so nextBlankOr will work for gms reader) inline char *mutableCard ( ) { return card_; } /// set position (again so gms reader will work) inline void setPosition(char * position) { position_=position;} /// get position (again so gms reader will work) inline char * getPosition() const { return position_;} /// Returns card number inline CoinBigIndex cardNumber ( ) const { return cardNumber_; } /// Returns file input inline CoinFileInput * fileInput ( ) const { return input_; } /// Sets whether strings allowed inline void setStringsAllowed() { stringsAllowed_=true;} //@} ////////////////// data ////////////////// protected: /**@name data */ //@{ /// Current value double value_; /// Current card image char card_[MAX_CARD_LENGTH]; /// Current position within card image char *position_; /// End of card char *eol_; /// Current COINMpsType COINMpsType mpsType_; /// Current row name char rowName_[COIN_MAX_FIELD_LENGTH]; /// Current column name char columnName_[COIN_MAX_FIELD_LENGTH]; /// File input CoinFileInput *input_; /// Which section we think we are in COINSectionType section_; /// Card number CoinBigIndex cardNumber_; /// Whether free format. Just for blank RHS etc bool freeFormat_; /// Whether IEEE - 0 no, 1 INTEL, 2 not INTEL int ieeeFormat_; /// If all names <= 8 characters then allow embedded blanks bool eightChar_; /// MpsIO CoinMpsIO * reader_; /// Message handler CoinMessageHandler * handler_; /// Messages CoinMessages messages_; /// Current element as characters (only if strings allowed) char valueString_[COIN_MAX_FIELD_LENGTH]; /// Whether strings allowed bool stringsAllowed_; //@} public: /**@name methods */ //@{ /// type - 0 normal, 1 INTEL IEEE, 2 other IEEE double osi_strtod(char * ptr, char ** output, int type); /// remove blanks static void strcpyAndCompress ( char *to, const char *from ); /// static char * nextBlankOr ( char *image ); /// For strings double osi_strtod(char * ptr, char ** output); //@} }; //############################################################################# #ifdef USE_SBB class SbbObject; class SbbModel; #endif /// Very simple class for containing data on set class CoinSet { public: /**@name Constructor and destructor */ //@{ /// Default constructor CoinSet ( ); /// Constructor CoinSet ( int numberEntries, const int * which); /// Copy constructor CoinSet (const CoinSet &); /// Assignment operator CoinSet & operator=(const CoinSet& rhs); /// Destructor virtual ~CoinSet ( ); //@} /**@name gets */ //@{ /// Returns number of entries inline int numberEntries ( ) const { return numberEntries_; } /// Returns type of set - 1 =SOS1, 2 =SOS2 inline int setType ( ) const { return setType_; } /// Returns list of variables inline const int * which ( ) const { return which_; } /// Returns weights inline const double * weights ( ) const { return weights_; } //@} #ifdef USE_SBB /**@name Use in sbb */ //@{ /// returns an object of type SbbObject virtual SbbObject * sbbObject(SbbModel * model) const { return NULL;} //@} #endif ////////////////// data ////////////////// protected: /**@name data */ //@{ /// Number of entries int numberEntries_; /// type of set int setType_; /// Which variables are in set int * which_; /// Weights double * weights_; //@} }; //############################################################################# /// Very simple class for containing SOS set class CoinSosSet : public CoinSet{ public: /**@name Constructor and destructor */ //@{ /// Constructor CoinSosSet ( int numberEntries, const int * which, const double * weights, int type); /// Destructor virtual ~CoinSosSet ( ); //@} #ifdef USE_SBB /**@name Use in sbb */ //@{ /// returns an object of type SbbObject virtual SbbObject * sbbObject(SbbModel * model) const ; //@} #endif ////////////////// data ////////////////// protected: /**@name data */ //@{ //@} }; //############################################################################# /** MPS IO Interface This class can be used to read in mps files without a solver. After reading the file, the CoinMpsIO object contains all relevant data, which may be more than a particular OsiSolverInterface allows for. Items may be deleted to allow for flexibility of data storage. The implementation makes the CoinMpsIO object look very like a dummy solver, as the same conventions are used. */ class CoinMpsIO { friend void CoinMpsIOUnitTest(const std::string & mpsDir); public: /** @name Methods to retrieve problem information These methods return information about the problem held by the CoinMpsIO object. Querying an object that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are always valid */ //@{ /// Get number of columns int getNumCols() const; /// Get number of rows int getNumRows() const; /// Get number of nonzero elements int getNumElements() const; /// Get pointer to array[getNumCols()] of column lower bounds const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds const double * getColUpper() const; /** Get pointer to array[getNumRows()] of constraint senses.
    • 'L': <= constraint
    • 'E': = constraint
    • 'G': >= constraint
    • 'R': ranged constraint
    • 'N': free constraint
    */ const char * getRowSense() const; /** Get pointer to array[getNumRows()] of constraint right-hand sides. Given constraints with upper (rowupper) and/or lower (rowlower) bounds, the constraint right-hand side (rhs) is set as
    • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
    • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'N' then rhs()[i] == 0.0
    */ const double * getRightHandSide() const; /** Get pointer to array[getNumRows()] of row ranges. Given constraints with upper (rowupper) and/or lower (rowlower) bounds, the constraint range (rowrange) is set as
    • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
    • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
    Put another way, only range constraints have a nontrivial value for rowrange. */ const double * getRowRange() const; /// Get pointer to array[getNumRows()] of row lower bounds const double * getRowLower() const; /// Get pointer to array[getNumRows()] of row upper bounds const double * getRowUpper() const; /// Get pointer to array[getNumCols()] of objective function coefficients const double * getObjCoefficients() const; /// Get pointer to row-wise copy of the coefficient matrix const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of the coefficient matrix const CoinPackedMatrix * getMatrixByCol() const; /// Return true if column is a continuous variable bool isContinuous(int colNumber) const; /** Return true if a column is an integer variable Note: This function returns true if the the column is a binary or general integer variable. */ bool isInteger(int columnNumber) const; /** Returns array[getNumCols()] specifying if a variable is integer. At present, simply coded as zero (continuous) and non-zero (integer) May be extended at a later date. */ const char * integerColumns() const; /** Returns the row name for the specified index. Returns 0 if the index is out of range. */ const char * rowName(int index) const; /** Returns the column name for the specified index. Returns 0 if the index is out of range. */ const char * columnName(int index) const; /** Returns the index for the specified row name Returns -1 if the name is not found. Returns numberRows for the objective row and > numberRows for dropped free rows. */ int rowIndex(const char * name) const; /** Returns the index for the specified column name Returns -1 if the name is not found. */ int columnIndex(const char * name) const; /** Returns the (constant) objective offset This is the RHS entry for the objective row */ double objectiveOffset() const; /// Set objective offset inline void setObjectiveOffset(double value) { objectiveOffset_=value;} /// Return the problem name const char * getProblemName() const; /// Return the objective name const char * getObjectiveName() const; /// Return the RHS vector name const char * getRhsName() const; /// Return the range vector name const char * getRangeName() const; /// Return the bound vector name const char * getBoundName() const; /// Number of string elements inline int numberStringElements() const { return numberStringElements_;} /// String element inline const char * stringElement(int i) const { return stringElements_[i];} //@} /** @name Methods to set problem information Methods to load a problem into the CoinMpsIO object. */ //@{ /// Set the problem data void setMpsData(const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const double* rowlb, const double* rowub, char const * const * const colnames, char const * const * const rownames); void setMpsData(const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const double* rowlb, const double* rowub, const std::vector & colnames, const std::vector & rownames); void setMpsData(const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const char* rowsen, const double* rowrhs, const double* rowrng, char const * const * const colnames, char const * const * const rownames); void setMpsData(const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const char* rowsen, const double* rowrhs, const double* rowrng, const std::vector & colnames, const std::vector & rownames); /** Pass in an array[getNumCols()] specifying if a variable is integer. At present, simply coded as zero (continuous) and non-zero (integer) May be extended at a later date. */ void copyInIntegerInformation(const char * integerInformation); /// Set problem name void setProblemName(const char *name) ; /// Set objective name void setObjectiveName(const char *name) ; //@} /** @name Parameter set/get methods Methods to set and retrieve MPS IO parameters. */ //@{ /// Set infinity void setInfinity(double value); /// Get infinity double getInfinity() const; /// Set default upper bound for integer variables void setDefaultBound(int value); /// Get default upper bound for integer variables int getDefaultBound() const; /// Whether to allow string elements inline int allowStringElements() const { return allowStringElements_;} /// Whether to allow string elements (0 no, 1 yes, 2 yes and try flip) inline void setAllowStringElements(int yesNo) { allowStringElements_ = yesNo;} /** Small element value - elements less than this set to zero on input default is 1.0e-14 */ inline double getSmallElementValue() const { return smallElement_;} inline void setSmallElementValue(double value) { smallElement_=value;} //@} /** @name Methods for problem input and output Methods to read and write MPS format problem files. The read and write methods return the number of errors that occurred during the IO operation, or -1 if no file is opened. \note If the CoinMpsIO class was compiled with support for libz then readMps will automatically try to append .gz to the file name and open it as a compressed file if the specified file name cannot be opened. (Automatic append of the .bz2 suffix when libbz is used is on the TODO list.) \todo Allow for file pointers and positioning */ //@{ /// Set the current file name for the CoinMpsIO object void setFileName(const char * name); /// Get the current file name for the CoinMpsIO object const char * getFileName() const; /** Read a problem in MPS format from the given filename. Use "stdin" or "-" to read from stdin. */ int readMps(const char *filename, const char *extension = "mps"); /** Read a problem in MPS format from the given filename. Use "stdin" or "-" to read from stdin. But do sets as well */ int readMps(const char *filename, const char *extension , int & numberSets, CoinSet **& sets); /** Read a problem in MPS format from a previously opened file More precisely, read a problem using a CoinMpsCardReader object already associated with this CoinMpsIO object. \todo Provide an interface that will allow a client to associate a CoinMpsCardReader object with a CoinMpsIO object by setting the cardReader_ field. */ int readMps(); /// and int readMps(int & numberSets, CoinSet **& sets); /** Read a basis in MPS format from the given filename. If VALUES on NAME card and solution not NULL fills in solution status values as for CoinWarmStartBasis (but one per char) -1 file error, 0 normal, 1 has solution values Use "stdin" or "-" to read from stdin. If sizes of names incorrect - read without names */ int readBasis(const char *filename, const char *extension , double * solution, unsigned char *rowStatus, unsigned char *columnStatus, const std::vector & colnames,int numberColumns, const std::vector & rownames, int numberRows); /** Read a problem in GAMS format from the given filename. Use "stdin" or "-" to read from stdin. if convertObjective then massages objective column */ int readGms(const char *filename, const char *extension = "gms",bool convertObjective=false); /** Read a problem in GAMS format from the given filename. Use "stdin" or "-" to read from stdin. But do sets as well */ int readGms(const char *filename, const char *extension , int & numberSets, CoinSet **& sets); /** Read a problem in GAMS format from a previously opened file More precisely, read a problem using a CoinMpsCardReader object already associated with this CoinMpsIO object. */ // Not for now int readGms(); /// and int readGms(int & numberSets, CoinSet **& sets); /** Read a problem in GMPL (subset of AMPL) format from the given filenames. */ int readGMPL(const char *modelName, const char * dataName=NULL, bool keepNames=false); /** Write the problem in MPS format to a file with the given filename. \param compression can be set to three values to indicate what kind of file should be written
    • 0: plain text (default)
    • 1: gzip compressed (.gz is appended to \c filename)
    • 2: bzip2 compressed (.bz2 is appended to \c filename) (TODO)
    If the library was not compiled with the requested compression then writeMps falls back to writing a plain text file. \param formatType specifies the precision to used for values in the MPS file
    • 0: normal precision (default)
    • 1: extra accuracy
    • 2: IEEE hex
    \param numberAcross specifies whether 1 or 2 (default) values should be specified on every data line in the MPS file. \param quadratic specifies quadratic objective to be output */ int writeMps(const char *filename, int compression = 0, int formatType = 0, int numberAcross = 2, CoinPackedMatrix * quadratic = NULL, int numberSOS=0,const CoinSet * setInfo=NULL) const; /// Return card reader object so can see what last card was e.g. QUADOBJ inline const CoinMpsCardReader * reader() const { return cardReader_;} /** Read in a quadratic objective from the given filename. If filename is NULL (or the same as the currently open file) then reading continues from the current file. If not, the file is closed and the specified file is opened. Code should be added to general MPS reader to read this if QSECTION Data is assumed to be Q and objective is c + 1/2 xT Q x No assumption is made for symmetry, positive definite, etc. No check is made for duplicates or non-triangular if checkSymmetry==0. If 1 checks lower triangular (so off diagonal should be 2*Q) if 2 makes lower triangular and assumes full Q (but adds off diagonals) Arrays should be deleted by delete [] Returns number of errors:
    • -1: bad file
    • -2: no Quadratic section
    • -3: an empty section
    • +n: then matching errors etc (symmetry forced)
    • -4: no matching errors but fails triangular test (triangularity forced)
    columnStart is numberColumns+1 long, others numberNonZeros */ int readQuadraticMps(const char * filename, int * &columnStart, int * &column, double * &elements, int checkSymmetry); /** Read in a list of cones from the given filename. If filename is NULL (or the same as the currently open file) then reading continues from the current file. If not, the file is closed and the specified file is opened. Code should be added to general MPS reader to read this if CSECTION No checking is done that in unique cone Arrays should be deleted by delete [] Returns number of errors, -1 bad file, -2 no conic section, -3 empty section columnStart is numberCones+1 long, other number of columns in matrix coneType is 1 for QUAD, 2 for RQUAD (numberCones long) */ int readConicMps(const char * filename, int * &columnStart, int * &column, int * &coneType, int & numberCones); /// Set whether to move objective from matrix inline void setConvertObjective(bool trueFalse) { convertObjective_=trueFalse;} /// copies in strings from a CoinModel - returns number int copyStringElements(const CoinModel * model); //@} /** @name Constructors and destructors */ //@{ /// Default Constructor CoinMpsIO(); /// Copy constructor CoinMpsIO (const CoinMpsIO &); /// Assignment operator CoinMpsIO & operator=(const CoinMpsIO& rhs); /// Destructor ~CoinMpsIO (); //@} /**@name Message handling */ //@{ /** Pass in Message handler Supply a custom message handler. It will not be destroyed when the CoinMpsIO object is destroyed. */ void passInMessageHandler(CoinMessageHandler * handler); /// Set the language for messages. void newLanguage(CoinMessages::Language language); /// Set the language for messages. inline void setLanguage(CoinMessages::Language language) {newLanguage(language);} /// Return the message handler inline CoinMessageHandler * messageHandler() const {return handler_;} /// Return the messages inline CoinMessages messages() {return messages_;} /// Return the messages pointer inline CoinMessages * messagesPointer() {return & messages_;} //@} /**@name Methods to release storage These methods allow the client to reduce the storage used by the CoinMpsIO object be selectively releasing unneeded problem information. */ //@{ /** Release all information which can be re-calculated. E.g., row sense, copies of rows, hash tables for names. */ void releaseRedundantInformation(); /// Release all row information (lower, upper) void releaseRowInformation(); /// Release all column information (lower, upper, objective) void releaseColumnInformation(); /// Release integer information void releaseIntegerInformation(); /// Release row names void releaseRowNames(); /// Release column names void releaseColumnNames(); /// Release matrix information void releaseMatrixInformation(); //@} protected: /**@name Miscellaneous helper functions */ //@{ /// Utility method used several times to implement public methods void setMpsDataWithoutRowAndColNames( const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const double* rowlb, const double* rowub); void setMpsDataColAndRowNames( const std::vector & colnames, const std::vector & rownames); void setMpsDataColAndRowNames( char const * const * const colnames, char const * const * const rownames); /// Does the heavy lifting for destruct and assignment. void gutsOfDestructor(); /// Does the heavy lifting for copy and assignment. void gutsOfCopy(const CoinMpsIO &); /// Clears problem data from the CoinMpsIO object. void freeAll(); /** A quick inlined function to convert from lb/ub style constraint definition to sense/rhs/range style */ inline void convertBoundToSense(const double lower, const double upper, char& sense, double& right, double& range) const; /** A quick inlined function to convert from sense/rhs/range stryle constraint definition to lb/ub style */ inline void convertSenseToBound(const char sense, const double right, const double range, double& lower, double& upper) const; /** Deal with a filename As the name says. Returns +1 if the file name is new, 0 if it's the same as before (i.e., matches fileName_), and -1 if there's an error and the file can't be opened. Handles automatic append of .gz suffix when compiled with libz. \todo Add automatic append of .bz2 suffix when compiled with libbz. */ int dealWithFileName(const char * filename, const char * extension, CoinFileInput * &input); /** Add string to list iRow==numberRows is objective, nr+1 is lo, nr+2 is up iColumn==nc is rhs (can't cope with ranges at present) */ void addString(int iRow,int iColumn, const char * value); /// Decode string void decodeString(int iString, int & iRow, int & iColumn, const char * & value) const; //@} // for hashing typedef struct { int index, next; } CoinHashLink; /**@name Hash table methods */ //@{ /// Creates hash list for names (section = 0 for rows, 1 columns) void startHash ( char **names, const int number , int section ); /// This one does it when names are already in void startHash ( int section ) const; /// Deletes hash storage void stopHash ( int section ); /// Finds match using hash, -1 not found int findHash ( const char *name , int section ) const; //@} /**@name Cached problem information */ //@{ /// Problem name char * problemName_; /// Objective row name char * objectiveName_; /// Right-hand side vector name char * rhsName_; /// Range vector name char * rangeName_; /// Bounds vector name char * boundName_; /// Number of rows int numberRows_; /// Number of columns int numberColumns_; /// Number of coefficients CoinBigIndex numberElements_; /// Pointer to dense vector of row sense indicators mutable char *rowsense_; /// Pointer to dense vector of row right-hand side values mutable double *rhs_; /** Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range rows) */ mutable double *rowrange_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByRow_; /// Pointer to column-wise copy of problem matrix coefficients. CoinPackedMatrix *matrixByColumn_; /// Pointer to dense vector of row lower bounds double * rowlower_; /// Pointer to dense vector of row upper bounds double * rowupper_; /// Pointer to dense vector of column lower bounds double * collower_; /// Pointer to dense vector of column upper bounds double * colupper_; /// Pointer to dense vector of objective coefficients double * objective_; /// Constant offset for objective value (i.e., RHS value for OBJ row) double objectiveOffset_; /** Pointer to dense vector specifying if a variable is continuous (0) or integer (1). */ char * integerType_; /** Row and column names Linked to hash table sections (0 - row names, 1 column names) */ char **names_[2]; //@} /** @name Hash tables */ //@{ /// Current file name char * fileName_; /// Number of entries in a hash table section int numberHash_[2]; /// Hash tables (two sections, 0 - row names, 1 - column names) mutable CoinHashLink *hash_[2]; //@} /** @name CoinMpsIO object parameters */ //@{ /// Upper bound when no bounds for integers int defaultBound_; /// Value to use for infinity double infinity_; /// Small element value double smallElement_; /// Message handler CoinMessageHandler * handler_; /** Flag to say if the message handler is the default handler. If true, the handler will be destroyed when the CoinMpsIO object is destroyed; if false, it will not be destroyed. */ bool defaultHandler_; /// Messages CoinMessages messages_; /// Card reader CoinMpsCardReader * cardReader_; /// If .gms file should it be massaged to move objective bool convertObjective_; /// Whether to allow string elements int allowStringElements_; /// Maximum number of string elements int maximumStringElements_; /// Number of string elements int numberStringElements_; /// String elements char ** stringElements_; //@} }; //############################################################################# /** A function that tests the methods in the CoinMpsIO class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. Also, if this method is compiled with optimization, the compilation takes 10-15 minutes and the machine pages (has 256M core memory!)... */ void CoinMpsIOUnitTest(const std::string & mpsDir); // Function to return number in most efficient way // section is 0 for columns, 1 for rhs,ranges and 2 for bounds /* formatType is 0 - normal and 8 character names 1 - extra accuracy 2 - IEEE hex - INTEL 3 - IEEE hex - not INTEL */ void CoinConvertDouble(int section, int formatType, double value, char outputValue[24]); #endif CoinMP-1.8.3/CoinUtils/src/CoinFinite.cpp0000644000175000017500000000154411556577334016573 0ustar renerene/* $Id: CoinFinite.cpp 1420 2011-04-29 18:09:32Z stefan $ */ // Copyright (C) 2011, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinFinite.hpp" #include "CoinUtilsConfig.h" #ifdef HAVE_CFLOAT # include #else # ifdef HAVE_FLOAT_H # include # endif #endif #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # endif #endif #ifdef HAVE_CIEEEFP # include #else # ifdef HAVE_IEEEFP_H # include # endif #endif bool CoinFinite(double val) { #ifdef COIN_C_FINITE return COIN_C_FINITE(val)!=0; #else return val != DBL_MAX && val != -DBL_MAX; #endif } bool CoinIsnan(double val) { #ifdef COIN_C_ISNAN return COIN_C_ISNAN(val)!=0; #else return false; #endif } CoinMP-1.8.3/CoinUtils/src/CoinFactorization2.cpp0000644000175000017500000013750612503570460020245 0ustar renerene/* $Id: CoinFactorization2.cpp 1817 2015-03-22 16:43:28Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinUtilsConfig.h" #include #include #include #include "CoinFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinFinite.hpp" #if COIN_FACTORIZATION_DENSE_CODE==1 // using simple lapack interface extern "C" { /** LAPACK Fortran subroutine DGETRF. */ void F77_FUNC(dgetrf,DGETRF)(ipfint * m, ipfint *n, double *A, ipfint *ldA, ipfint * ipiv, ipfint *info); } #elif COIN_FACTORIZATION_DENSE_CODE==2 // C interface enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; extern "C" { int clapack_dgetrf ( const enum CBLAS_ORDER Order, const int M, const int N, double *A, const int lda, int *ipiv ); } #endif #ifndef NDEBUG static int counter1=0; #endif // factorSparse. Does sparse phase of factorization //return code is <0 error, 0= finished int CoinFactorization::factorSparse ( ) { int larger; if ( numberRows_ < numberColumns_ ) { larger = numberColumns_; } else { larger = numberRows_; } int returnCode; #define LARGELIMIT 65530 #define SMALL_SET 65531 #define SMALL_UNSET (SMALL_SET+1) #define LARGE_SET COIN_INT_MAX-10 #define LARGE_UNSET (LARGE_SET+1) if ( larger < LARGELIMIT ) returnCode = factorSparseSmall(); else returnCode = factorSparseLarge(); return returnCode; } // factorSparse. Does sparse phase of factorization //return code is <0 error, 0= finished int CoinFactorization::factorSparseSmall ( ) { int *indexRow = indexRowU_.array(); int *indexColumn = indexColumnU_.array(); CoinFactorizationDouble *element = elementU_.array(); int count = 1; workArea_.conditionalNew(numberRows_); CoinFactorizationDouble * workArea = workArea_.array(); #ifndef NDEBUG counter1++; #endif // when to go dense int denseThreshold=abs(denseThreshold_); CoinZeroN ( workArea, numberRows_ ); //get space for bit work area CoinBigIndex workSize = 1000; workArea2_.conditionalNew(workSize); unsigned int * workArea2 = workArea2_.array(); //set markRow so no rows updated unsigned short * markRow = reinterpret_cast (markRow_.array()); CoinFillN ( markRow, numberRows_, static_cast (SMALL_UNSET)); int status = 0; //do slacks first int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); int * numberInColumnPlus = numberInColumnPlus_.array(); CoinBigIndex * startColumnU = startColumnU_.array(); CoinBigIndex * startColumnL = startColumnL_.array(); if (biasLU_<3&&numberColumns_==numberRows_) { int iPivotColumn; int * pivotColumn = pivotColumn_.array(); int * nextRow = nextRow_.array(); int * lastRow = lastRow_.array(); for ( iPivotColumn = 0; iPivotColumn < numberColumns_; iPivotColumn++ ) { if ( numberInColumn[iPivotColumn] == 1 ) { CoinBigIndex start = startColumnU[iPivotColumn]; CoinFactorizationDouble value = element[start]; if ( value == slackValue_ && numberInColumnPlus[iPivotColumn] == 0 ) { // treat as slack int iRow = indexRow[start]; // but only if row not marked if (numberInRow[iRow]>0) { totalElements_ -= numberInRow[iRow]; //take out this bit of indexColumnU int next = nextRow[iRow]; int last = lastRow[iRow]; nextRow[last] = next; lastRow[next] = last; nextRow[iRow] = numberGoodU_; //use for permute lastRow[iRow] = -2; //mark //modify linked list for pivots deleteLink ( iRow ); numberInRow[iRow]=-1; numberInColumn[iPivotColumn]=0; numberGoodL_++; startColumnL[numberGoodL_] = 0; pivotColumn[numberGoodU_] = iPivotColumn; numberGoodU_++; } } } } // redo preProcess(4); CoinFillN ( markRow, numberRows_, static_cast (SMALL_UNSET)); } numberSlacks_ = numberGoodU_; int *nextCount = nextCount_.array(); int *firstCount = firstCount_.array(); CoinBigIndex *startRow = startRowU_.array(); CoinBigIndex *startColumn = startColumnU; //#define UGLY_COIN_FACTOR_CODING #ifdef UGLY_COIN_FACTOR_CODING CoinFactorizationDouble *elementL = elementL_.array(); int *indexRowL = indexRowL_.array(); int *saveColumn = saveColumn_.array(); int *nextRow = nextRow_.array(); int *lastRow = lastRow_.array() ; #endif double pivotTolerance = pivotTolerance_; int numberTrials = numberTrials_; int numberRows = numberRows_; // Put column singletons first - (if false) separateLinks(1,(biasLU_>1)); #ifndef NDEBUG int counter2=0; #endif while ( count <= biggerDimension_ ) { #ifndef NDEBUG counter2++; int badRow=-1; if (counter1==-1&&counter2>=0) { // check counts consistent for (int iCount=1;iCount= 0 ) { if ( look < numberRows_ ) { int iRow = look; if (iRow==badRow) printf("row count for row %d is %d\n",iCount,iRow); if ( numberInRow[iRow] != iCount ) { printf("failed debug on %d entry to factorSparse and %d try\n", counter1,counter2); printf("row %d - count %d number %d\n",iRow,iCount,numberInRow[iRow]); abort(); } look = nextCount[look]; } else { int iColumn = look - numberRows; if ( numberInColumn[iColumn] != iCount ) { printf("failed debug on %d entry to factorSparse and %d try\n", counter1,counter2); printf("column %d - count %d number %d\n",iColumn,iCount,numberInColumn[iColumn]); abort(); } look = nextCount[look]; } } } } #endif CoinBigIndex minimumCount = COIN_INT_MAX; double minimumCost = COIN_DBL_MAX; int iPivotRow = -1; int iPivotColumn = -1; int pivotRowPosition = -1; int pivotColumnPosition = -1; int look = firstCount[count]; int trials = 0; int * pivotColumn = pivotColumn_.array(); if ( count == 1 && firstCount[1] >= 0 &&!biasLU_) { //do column singletons first to put more in U while ( look >= 0 ) { if ( look < numberRows_ ) { look = nextCount[look]; } else { int iColumn = look - numberRows_; assert ( numberInColumn[iColumn] == count ); CoinBigIndex start = startColumnU[iColumn]; int iRow = indexRow[start]; iPivotRow = iRow; pivotRowPosition = start; iPivotColumn = iColumn; assert (iPivotRow>=0&&iPivotColumn>=0); pivotColumnPosition = -1; look = -1; break; } } /* endwhile */ if ( iPivotRow < 0 ) { //back to singletons look = firstCount[1]; } } while ( look >= 0 ) { if ( look < numberRows_ ) { int iRow = look; #ifndef NDEBUG if ( numberInRow[iRow] != count ) { printf("failed on %d entry to factorSparse and %d try\n", counter1,counter2); printf("row %d - count %d number %d\n",iRow,count,numberInRow[iRow]); abort(); } #endif look = nextCount[look]; bool rejected = false; CoinBigIndex start = startRow[iRow]; CoinBigIndex end = start + count; CoinBigIndex i; for ( i = start; i < end; i++ ) { int iColumn = indexColumn[i]; assert (numberInColumn[iColumn]>0); double cost = ( count - 1 ) * numberInColumn[iColumn]; if ( cost < minimumCost ) { CoinBigIndex where = startColumn[iColumn]; double minimumValue = element[where]; minimumValue = fabs ( minimumValue ) * pivotTolerance; while ( indexRow[where] != iRow ) { where++; } /* endwhile */ assert ( where < startColumn[iColumn] + numberInColumn[iColumn]); CoinFactorizationDouble value = element[where]; value = fabs ( value ); if ( value >= minimumValue ) { minimumCost = cost; minimumCount = numberInColumn[iColumn]; iPivotRow = iRow; pivotRowPosition = -1; iPivotColumn = iColumn; assert (iPivotRow>=0&&iPivotColumn>=0); pivotColumnPosition = i; rejected=false; if ( minimumCount < count ) { look = -1; break; } } else if ( iPivotRow == -1 ) { rejected = true; } } } trials++; if ( trials >= numberTrials && iPivotRow >= 0 ) { look = -1; break; } if ( rejected ) { //take out for moment //eligible when row changes deleteLink ( iRow ); addLink ( iRow, biggerDimension_ + 1 ); } } else { int iColumn = look - numberRows; assert ( numberInColumn[iColumn] == count ); look = nextCount[look]; CoinBigIndex start = startColumn[iColumn]; CoinBigIndex end = start + numberInColumn[iColumn]; CoinFactorizationDouble minimumValue = element[start]; minimumValue = fabs ( minimumValue ) * pivotTolerance; CoinBigIndex i; for ( i = start; i < end; i++ ) { CoinFactorizationDouble value = element[i]; value = fabs ( value ); if ( value >= minimumValue ) { int iRow = indexRow[i]; int nInRow = numberInRow[iRow]; assert (nInRow>0); double cost = ( count - 1 ) * nInRow; if ( cost < minimumCost ) { minimumCost = cost; minimumCount = nInRow; iPivotRow = iRow; pivotRowPosition = i; iPivotColumn = iColumn; assert (iPivotRow>=0&&iPivotColumn>=0); pivotColumnPosition = -1; if ( minimumCount <= count + 1 ) { look = -1; break; } } } } trials++; if ( trials >= numberTrials && iPivotRow >= 0 ) { look = -1; break; } } } /* endwhile */ if (iPivotRow>=0) { assert (iPivotRow 0 ) { if ( numberDoRow > 0 ) { if ( numberDoColumn > 1 ) { // if (1) { //need to adjust more for cache and SMP //allow at least 4 extra int increment = numberDoColumn + 1 + 4; if ( increment & 15 ) { increment = increment & ( ~15 ); increment += 16; } int increment2 = ( increment + COINFACTORIZATION_BITS_PER_INT - 1 ) >> COINFACTORIZATION_SHIFT_PER_INT; CoinBigIndex size = increment2 * numberDoRow; if ( size > workSize ) { workSize = size; workArea2_.conditionalNew(workSize); workArea2 = workArea2_.array(); } bool goodPivot; #ifndef UGLY_COIN_FACTOR_CODING //branch out to best pivot routine goodPivot = pivot ( iPivotRow, iPivotColumn, pivotRowPosition, pivotColumnPosition, workArea, workArea2, increment2, markRow , SMALL_SET); #else #define FAC_SET SMALL_SET #include "CoinFactorization.hpp" #undef FAC_SET #undef UGLY_COIN_FACTOR_CODING #endif if ( !goodPivot ) { status = -99; count=biggerDimension_+1; break; } } else { if ( !pivotOneOtherRow ( iPivotRow, iPivotColumn ) ) { status = -99; count=biggerDimension_+1; break; } } } else { assert (!numberDoRow); if ( !pivotRowSingleton ( iPivotRow, iPivotColumn ) ) { status = -99; count=biggerDimension_+1; break; } } } else { assert (!numberDoColumn); if ( !pivotColumnSingleton ( iPivotRow, iPivotColumn ) ) { status = -99; count=biggerDimension_+1; break; } } assert (nextRow_.array()[iPivotRow]==numberGoodU_); pivotColumn[numberGoodU_] = iPivotColumn; numberGoodU_++; // This should not need to be trapped here - but be safe if (numberGoodU_==numberRows_) count=biggerDimension_+1; #if COIN_DEBUG==2 checkConsistency ( ); #endif #if 0 // Even if no dense code may be better to use naive dense if (!denseThreshold_&&totalElements_>1000) { int leftRows=numberRows_-numberGoodU_; double full = leftRows; full *= full; assert (full>=0.0); double leftElements = totalElements_; double ratio; if (leftRows>2000) ratio=4.0; else ratio=3.0; if (ratio*leftElements>full) denseThreshold=1; } #endif if (denseThreshold) { // see whether to go dense int leftRows=numberRows_-numberGoodU_; double full = leftRows; full *= full; assert (full>=0.0); double leftElements = totalElements_; //if (leftRows==100) //printf("at 100 %d elements\n",totalElements_); double ratio; #define COIN_DENSE_MULTIPLIER 1 if (leftRows>2000) { ratio=4.0; #if COIN_DENSE_MULTIPLIER == 1 ratio =3.5; #endif } else if (leftRows>800) { ratio=3.0; #if COIN_DENSE_MULTIPLIER == 1 ratio =2.75; #endif } else if (leftRows>256) { ratio=2.0; } else { ratio=1.5; } #if COIN_DENSE_MULTIPLIER>10 ratio=10000; #endif if ((ratio*leftElements>full&&leftRows>denseThreshold)) { #define COIN_ALIGN_DENSE 2 #if COIN_ALIGN_DENSE == 2 if ((leftRows&7)==0) { #endif //return to do dense if (status!=0) break; int check=0; for (int iColumn=0;iColumn=2<<15) { abort(); } CoinBigIndex full; if (denseThreshold_>0||true) full = numberDense_*numberDense_; else full = - denseThreshold_*numberDense_; totalElements_=full; #ifdef COIN_ALIGN_DENSE CoinBigIndex newSize=full+8*numberDense_; newSize += (numberDense_+1)/(sizeof(CoinFactorizationDouble)/sizeof(int)); newSize += 2*((numberDense_+3)/(sizeof(CoinFactorizationDouble)/sizeof(short))); newSize += ((numberRows_+3)/(sizeof(CoinFactorizationDouble)/sizeof(short))); // so we can align on 256 byte newSize+=32; denseArea_ = new double[newSize]; denseAreaAddress_=denseArea_; CoinInt64 xx = reinterpret_cast(denseAreaAddress_); int iBottom = static_cast(xx & 63); int offset = (256-iBottom)>>3; denseAreaAddress_ += offset; CoinZeroN(denseArea_,newSize); #else denseArea_= new double [full]; denseAreaAddress_ = denseArea_; CoinZeroN(denseArea_,full); #endif densePermute_= new int [numberDense_]; int * indexRowU = indexRowU_.array(); //mark row lookup using lastRow int i; int * nextRow = nextRow_.array(); int * lastRow = lastRow_.array(); int * numberInColumn = numberInColumn_.array(); int * numberInColumnPlus = numberInColumnPlus_.array(); for (i=0;i=0) lastRow[i]=0; } int * indexRow = indexRowU_.array(); CoinFactorizationDouble * element = elementU_.array(); int which=0; for (i=0;i=0&&iRow0*/) { assert(numberGoodU_==numberRows_); numberGoodL_=numberRows_; //now factorize //dgef(denseAreaAddress_,&numberDense_,&numberDense_,densePermute_); #if COIN_FACTORIZATION_DENSE_CODE==1 int info; F77_FUNC(dgetrf,DGETRF)(&numberDense_,&numberDense_,denseAreaAddress_,&numberDense_,densePermute_, &info); // need to check size of pivots if(info) { //printf("Dense singular\n"); status = -1; } #elif COIN_FACTORIZATION_DENSE_CODE==2 status=clapack_dgetrf ( CblasColMajor, numberDense_,numberDense_, denseAreaAddress_,numberDense_, densePermute_ ); #endif return status; } #endif //abort(); numberGoodU_ = numberRows_-numberDense_; int base = numberGoodU_; int iDense; int numberToDo=-denseThreshold_; denseThreshold_=0; double tolerance = zeroTolerance_; tolerance = 1.0e-30; int * nextColumn = nextColumn_.array(); const int * pivotColumnConst = pivotColumn_.array(); // make sure we have enough space in L and U for (iDense=0;iDense space ) { //getColumnSpace also moves fixed part if ( !getColumnSpace ( iColumn, numberInPivotColumn ) ) { return -99; } } // set so further moves will work numberInColumn[iColumn]=numberInPivotColumn; } // Fill in ? for (iColumn=numberGoodU_+numberToDo;iColumn lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) std::cout << "more memory needed in middle of invert" << std::endl; return -99; } CoinFactorizationDouble *elementU = elementU_.array(); for (iDense=0;iDenselargest) { largest = fabs(element[iRow]); pivotRow = iRow; } } if ( pivotRow >= 0 ) { iColumn = pivotColumnConst[base+iDense]; CoinFactorizationDouble pivotElement=element[pivotRow]; // get original row int originalRow = densePermute_[pivotRow]; // do nextRow nextRow[originalRow] = numberGoodU_; lastRow[originalRow] = -2; //mark // swap densePermute_[pivotRow]=densePermute_[iDense]; densePermute_[iDense] = originalRow; for (jDense=iDense;jDensetolerance) { indexRowL[l] = densePermute_[iRow]; elementL[l++] = value; } } numberGoodL_++; lengthL_ = l; startColumnL[numberGoodL_] = l; // update U column CoinBigIndex start = startColumnU[iColumn]; for (iRow=0;iRowtolerance) { indexRowU[start] = densePermute_[iRow]; elementU[start++] = element[iRow]; } } numberInColumn[iColumn]=0; numberInColumnPlus[iColumn] += start-startColumnU[iColumn]; startColumnU[iColumn]=start; // update other columns double * element2 = element+numberDense_; for (jDense=iDense+1;jDense=0) { int next2=nextCount[next]; if (next>=numberRows_) { nextCount[next]=-1; // Column if (firstColumn>=0) { lastCount[next]=lastColumn; nextCount[lastColumn]=next; } else { lastCount[next]= -2 - count; firstColumn=next; } lastColumn=next; } else { // Row if (firstRow>=0) { lastCount[next]=lastRow; nextCount[lastRow]=next; } else { lastCount[next]= -2 - count; firstRow=next; } lastRow=next; } next=next2; } if (rowsFirst&&firstRow>=0) { firstCount[count]=firstRow; nextCount[lastRow]=firstColumn; if (firstColumn>=0) lastCount[firstColumn]=lastRow; } else if (firstRow<0) { firstCount[count]=firstColumn; } else if (firstColumn>=0) { firstCount[count]=firstColumn; nextCount[lastColumn]=firstRow; if (firstRow>=0) lastCount[firstRow]=lastColumn; } } // Debug - save on file int CoinFactorization::saveFactorization (const char * file ) const { FILE * fp = fopen(file,"wb"); if (fp) { // Save so we can pick up scalars const char * first = reinterpret_cast ( &pivotTolerance_); const char * last = reinterpret_cast ( &biasLU_); // increment last += sizeof(int); if (fwrite(first,last-first,1,fp)!=1) return 1; // Now arrays if (CoinToFile(elementU_.array(),lengthAreaU_ , fp )) return 1; if (CoinToFile(indexRowU_.array(),lengthAreaU_ , fp )) return 1; if (CoinToFile(indexColumnU_.array(),lengthAreaU_ , fp )) return 1; if (CoinToFile(convertRowToColumnU_.array(),lengthAreaU_ , fp )) return 1; if (CoinToFile(elementByRowL_.array(),lengthAreaL_ , fp )) return 1; if (CoinToFile(indexColumnL_.array(),lengthAreaL_ , fp )) return 1; if (CoinToFile(startRowL_.array() , numberRows_+1, fp )) return 1; if (CoinToFile(elementL_.array(),lengthAreaL_ , fp )) return 1; if (CoinToFile(indexRowL_.array(),lengthAreaL_ , fp )) return 1; if (CoinToFile(startColumnL_.array(),numberRows_ + 1 , fp )) return 1; if (CoinToFile(markRow_.array(),numberRows_ , fp)) return 1; if (CoinToFile(saveColumn_.array(),numberColumns_ , fp)) return 1; if (CoinToFile(startColumnR_.array() , maximumPivots_ + 1 , fp )) return 1; if (CoinToFile(startRowU_.array(),maximumRowsExtra_ + 1 , fp )) return 1; if (CoinToFile(numberInRow_.array(),maximumRowsExtra_ + 1 , fp )) return 1; if (CoinToFile(nextRow_.array(),maximumRowsExtra_ + 1 , fp )) return 1; if (CoinToFile(lastRow_.array(),maximumRowsExtra_ + 1 , fp )) return 1; if (CoinToFile(pivotRegion_.array(),maximumRowsExtra_ + 1 , fp )) return 1; if (CoinToFile(permuteBack_.array(),maximumRowsExtra_ + 1 , fp )) return 1; if (CoinToFile(permute_.array(),maximumRowsExtra_ + 1 , fp )) return 1; if (CoinToFile(pivotColumnBack_.array(),maximumRowsExtra_ + 1 , fp )) return 1; if (CoinToFile(startColumnU_.array(),maximumColumnsExtra_ + 1 , fp )) return 1; if (CoinToFile(numberInColumn_.array(),maximumColumnsExtra_ + 1 , fp )) return 1; if (CoinToFile(numberInColumnPlus_.array(),maximumColumnsExtra_ + 1 , fp )) return 1; if (CoinToFile(firstCount_.array(),biggerDimension_ + 2 , fp )) return 1; if (CoinToFile(nextCount_.array(),numberRows_ + numberColumns_ , fp )) return 1; if (CoinToFile(lastCount_.array(),numberRows_ + numberColumns_ , fp )) return 1; if (CoinToFile(pivotRowL_.array(),numberRows_ + 1 , fp )) return 1; if (CoinToFile(pivotColumn_.array(),maximumColumnsExtra_ + 1 , fp )) return 1; if (CoinToFile(nextColumn_.array(),maximumColumnsExtra_ + 1 , fp )) return 1; if (CoinToFile(lastColumn_.array(),maximumColumnsExtra_ + 1 , fp )) return 1; if (CoinToFile(denseAreaAddress_ , numberDense_*numberDense_, fp )) return 1; if (CoinToFile(densePermute_ , numberDense_, fp )) return 1; fclose(fp); } return 0; } // Debug - restore from file int CoinFactorization::restoreFactorization (const char * file , bool factorIt ) { FILE * fp = fopen(file,"rb"); if (fp) { // Get rid of current gutsOfDestructor(); CoinBigIndex newSize=0; // for checking - should be same // Restore so we can pick up scalars char * first = reinterpret_cast ( &pivotTolerance_); char * last = reinterpret_cast ( &biasLU_); // increment last += sizeof(int); if (fread(first,last-first,1,fp)!=1) return 1; CoinBigIndex space = lengthAreaL_ - lengthL_; // Now arrays CoinFactorizationDouble *elementU = elementU_.array(); if (CoinFromFile(elementU,lengthAreaU_ , fp, newSize )==1) return 1; assert (newSize==lengthAreaU_); int * indexRowU = indexRowU_.array(); if (CoinFromFile(indexRowU,lengthAreaU_ , fp, newSize )==1) return 1; assert (newSize==lengthAreaU_); int * indexColumnU = indexColumnU_.array(); if (CoinFromFile(indexColumnU,lengthAreaU_ , fp, newSize )==1) return 1; assert (newSize==lengthAreaU_); CoinBigIndex *convertRowToColumnU = convertRowToColumnU_.array(); if (CoinFromFile(convertRowToColumnU,lengthAreaU_ , fp, newSize )==1) return 1; assert (newSize==lengthAreaU_||(newSize==0&&!convertRowToColumnU_.array())); CoinFactorizationDouble * elementByRowL = elementByRowL_.array(); if (CoinFromFile(elementByRowL,lengthAreaL_ , fp, newSize )==1) return 1; assert (newSize==lengthAreaL_||(newSize==0&&!elementByRowL_.array())); int * indexColumnL = indexColumnL_.array(); if (CoinFromFile(indexColumnL,lengthAreaL_ , fp, newSize )==1) return 1; assert (newSize==lengthAreaL_||(newSize==0&&!indexColumnL_.array())); CoinBigIndex * startRowL = startRowL_.array(); if (CoinFromFile(startRowL , numberRows_+1, fp, newSize )==1) return 1; assert (newSize==numberRows_+1||(newSize==0&&!startRowL_.array())); CoinFactorizationDouble * elementL = elementL_.array(); if (CoinFromFile(elementL,lengthAreaL_ , fp, newSize )==1) return 1; assert (newSize==lengthAreaL_); int * indexRowL = indexRowL_.array(); if (CoinFromFile(indexRowL,lengthAreaL_ , fp, newSize )==1) return 1; assert (newSize==lengthAreaL_); CoinBigIndex * startColumnL = startColumnL_.array(); if (CoinFromFile(startColumnL,numberRows_ + 1 , fp, newSize )==1) return 1; assert (newSize==numberRows_+1); int * markRow = markRow_.array(); if (CoinFromFile(markRow,numberRows_ , fp, newSize )==1) return 1; assert (newSize==numberRows_); int * saveColumn = saveColumn_.array(); if (CoinFromFile(saveColumn,numberColumns_ , fp, newSize )==1) return 1; assert (newSize==numberColumns_); CoinBigIndex * startColumnR = startColumnR_.array(); if (CoinFromFile(startColumnR , maximumPivots_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumPivots_+1||(newSize==0&&!startColumnR_.array())); CoinBigIndex * startRowU = startRowU_.array(); if (CoinFromFile(startRowU,maximumRowsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumRowsExtra_+1||(newSize==0&&!startRowU_.array())); int * numberInRow = numberInRow_.array(); if (CoinFromFile(numberInRow,maximumRowsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumRowsExtra_+1); int * nextRow = nextRow_.array(); if (CoinFromFile(nextRow,maximumRowsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumRowsExtra_+1); int * lastRow = lastRow_.array(); if (CoinFromFile(lastRow,maximumRowsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumRowsExtra_+1); CoinFactorizationDouble * pivotRegion = pivotRegion_.array(); if (CoinFromFile(pivotRegion,maximumRowsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumRowsExtra_+1); int * permuteBack = permuteBack_.array(); if (CoinFromFile(permuteBack,maximumRowsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumRowsExtra_+1||(newSize==0&&!permuteBack_.array())); int * permute = permute_.array(); if (CoinFromFile(permute,maximumRowsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumRowsExtra_+1||(newSize==0&&!permute_.array())); int * pivotColumnBack = pivotColumnBack_.array(); if (CoinFromFile(pivotColumnBack,maximumRowsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumRowsExtra_+1||(newSize==0&&!pivotColumnBack_.array())); CoinBigIndex * startColumnU = startColumnU_.array(); if (CoinFromFile(startColumnU,maximumColumnsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumColumnsExtra_+1); int * numberInColumn = numberInColumn_.array(); if (CoinFromFile(numberInColumn,maximumColumnsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumColumnsExtra_+1); int * numberInColumnPlus = numberInColumnPlus_.array(); if (CoinFromFile(numberInColumnPlus,maximumColumnsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumColumnsExtra_+1); int *firstCount = firstCount_.array(); if (CoinFromFile(firstCount,biggerDimension_ + 2 , fp, newSize )==1) return 1; assert (newSize==biggerDimension_+2); int *nextCount = nextCount_.array(); if (CoinFromFile(nextCount,numberRows_ + numberColumns_ , fp, newSize )==1) return 1; assert (newSize==numberRows_+numberColumns_); int *lastCount = lastCount_.array(); if (CoinFromFile(lastCount,numberRows_ + numberColumns_ , fp, newSize )==1) return 1; assert (newSize==numberRows_+numberColumns_); int * pivotRowL = pivotRowL_.array(); if (CoinFromFile(pivotRowL,numberRows_ + 1 , fp, newSize )==1) return 1; assert (newSize==numberRows_+1); int * pivotColumn = pivotColumn_.array(); if (CoinFromFile(pivotColumn,maximumColumnsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumColumnsExtra_+1); int * nextColumn = nextColumn_.array(); if (CoinFromFile(nextColumn,maximumColumnsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumColumnsExtra_+1); int * lastColumn = lastColumn_.array(); if (CoinFromFile(lastColumn,maximumColumnsExtra_ + 1 , fp, newSize )==1) return 1; assert (newSize==maximumColumnsExtra_+1); if (CoinFromFile(denseAreaAddress_ , numberDense_*numberDense_, fp, newSize )==1) return 1; assert (newSize==numberDense_*numberDense_); if (CoinFromFile(densePermute_ , numberDense_, fp, newSize )==1) return 1; assert (newSize==numberDense_); lengthAreaR_ = space; elementR_ = elementL_.array() + lengthL_; indexRowR_ = indexRowL_.array() + lengthL_; fclose(fp); if (factorIt) { if (biasLU_>=3||numberRows_!=numberColumns_) preProcess ( 2 ); else preProcess ( 3 ); // no row copy factor ( ); } } return 0; } // factorSparse. Does sparse phase of factorization //return code is <0 error, 0= finished int CoinFactorization::factorSparseLarge ( ) { int *indexRow = indexRowU_.array(); int *indexColumn = indexColumnU_.array(); CoinFactorizationDouble *element = elementU_.array(); int count = 1; workArea_.conditionalNew(numberRows_); CoinFactorizationDouble * workArea = workArea_.array(); #ifndef NDEBUG counter1++; #endif // when to go dense int denseThreshold=abs(denseThreshold_); CoinZeroN ( workArea, numberRows_ ); //get space for bit work area CoinBigIndex workSize = 1000; workArea2_.conditionalNew(workSize); unsigned int * workArea2 = workArea2_.array(); //set markRow so no rows updated int * markRow = markRow_.array(); CoinFillN ( markRow, numberRows_, COIN_INT_MAX-10+1); int status = 0; //do slacks first int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); int * numberInColumnPlus = numberInColumnPlus_.array(); CoinBigIndex * startColumnU = startColumnU_.array(); CoinBigIndex * startColumnL = startColumnL_.array(); if (biasLU_<3&&numberColumns_==numberRows_) { int iPivotColumn; int * pivotColumn = pivotColumn_.array(); int * nextRow = nextRow_.array(); int * lastRow = lastRow_.array(); for ( iPivotColumn = 0; iPivotColumn < numberColumns_; iPivotColumn++ ) { if ( numberInColumn[iPivotColumn] == 1 ) { CoinBigIndex start = startColumnU[iPivotColumn]; CoinFactorizationDouble value = element[start]; if ( value == slackValue_ && numberInColumnPlus[iPivotColumn] == 0 ) { // treat as slack int iRow = indexRow[start]; // but only if row not marked if (numberInRow[iRow]>0) { totalElements_ -= numberInRow[iRow]; //take out this bit of indexColumnU int next = nextRow[iRow]; int last = lastRow[iRow]; nextRow[last] = next; lastRow[next] = last; nextRow[iRow] = numberGoodU_; //use for permute lastRow[iRow] = -2; //mark //modify linked list for pivots deleteLink ( iRow ); numberInRow[iRow]=-1; numberInColumn[iPivotColumn]=0; numberGoodL_++; startColumnL[numberGoodL_] = 0; pivotColumn[numberGoodU_] = iPivotColumn; numberGoodU_++; } } } } // redo preProcess(4); CoinFillN ( markRow, numberRows_, COIN_INT_MAX-10+1); } numberSlacks_ = numberGoodU_; int *nextCount = nextCount_.array(); int *firstCount = firstCount_.array(); CoinBigIndex *startRow = startRowU_.array(); CoinBigIndex *startColumn = startColumnU; //double *elementL = elementL_.array(); //int *indexRowL = indexRowL_.array(); //int *saveColumn = saveColumn_.array(); //int *nextRow = nextRow_.array(); //int *lastRow = lastRow_.array() ; double pivotTolerance = pivotTolerance_; int numberTrials = numberTrials_; int numberRows = numberRows_; // Put column singletons first - (if false) separateLinks(1,(biasLU_>1)); #ifndef NDEBUG int counter2=0; #endif while ( count <= biggerDimension_ ) { #ifndef NDEBUG counter2++; int badRow=-1; if (counter1==-1&&counter2>=0) { // check counts consistent for (int iCount=1;iCount= 0 ) { if ( look < numberRows_ ) { int iRow = look; if (iRow==badRow) printf("row count for row %d is %d\n",iCount,iRow); if ( numberInRow[iRow] != iCount ) { printf("failed debug on %d entry to factorSparse and %d try\n", counter1,counter2); printf("row %d - count %d number %d\n",iRow,iCount,numberInRow[iRow]); abort(); } look = nextCount[look]; } else { int iColumn = look - numberRows; if ( numberInColumn[iColumn] != iCount ) { printf("failed debug on %d entry to factorSparse and %d try\n", counter1,counter2); printf("column %d - count %d number %d\n",iColumn,iCount,numberInColumn[iColumn]); abort(); } look = nextCount[look]; } } } } #endif CoinBigIndex minimumCount = COIN_INT_MAX; double minimumCost = COIN_DBL_MAX; int iPivotRow = -1; int iPivotColumn = -1; int pivotRowPosition = -1; int pivotColumnPosition = -1; int look = firstCount[count]; int trials = 0; int * pivotColumn = pivotColumn_.array(); if ( count == 1 && firstCount[1] >= 0 &&!biasLU_) { //do column singletons first to put more in U while ( look >= 0 ) { if ( look < numberRows_ ) { look = nextCount[look]; } else { int iColumn = look - numberRows_; assert ( numberInColumn[iColumn] == count ); CoinBigIndex start = startColumnU[iColumn]; int iRow = indexRow[start]; iPivotRow = iRow; pivotRowPosition = start; iPivotColumn = iColumn; assert (iPivotRow>=0&&iPivotColumn>=0); pivotColumnPosition = -1; look = -1; break; } } /* endwhile */ if ( iPivotRow < 0 ) { //back to singletons look = firstCount[1]; } } while ( look >= 0 ) { if ( look < numberRows_ ) { int iRow = look; #ifndef NDEBUG if ( numberInRow[iRow] != count ) { printf("failed on %d entry to factorSparse and %d try\n", counter1,counter2); printf("row %d - count %d number %d\n",iRow,count,numberInRow[iRow]); abort(); } #endif look = nextCount[look]; bool rejected = false; CoinBigIndex start = startRow[iRow]; CoinBigIndex end = start + count; CoinBigIndex i; for ( i = start; i < end; i++ ) { int iColumn = indexColumn[i]; assert (numberInColumn[iColumn]>0); double cost = ( count - 1 ) * numberInColumn[iColumn]; if ( cost < minimumCost ) { CoinBigIndex where = startColumn[iColumn]; CoinFactorizationDouble minimumValue = element[where]; minimumValue = fabs ( minimumValue ) * pivotTolerance; while ( indexRow[where] != iRow ) { where++; } /* endwhile */ assert ( where < startColumn[iColumn] + numberInColumn[iColumn]); CoinFactorizationDouble value = element[where]; value = fabs ( value ); if ( value >= minimumValue ) { minimumCost = cost; minimumCount = numberInColumn[iColumn]; iPivotRow = iRow; pivotRowPosition = -1; iPivotColumn = iColumn; assert (iPivotRow>=0&&iPivotColumn>=0); pivotColumnPosition = i; rejected=false; if ( minimumCount < count ) { look = -1; break; } } else if ( iPivotRow == -1 ) { rejected = true; } } } trials++; if ( trials >= numberTrials && iPivotRow >= 0 ) { look = -1; break; } if ( rejected ) { //take out for moment //eligible when row changes deleteLink ( iRow ); addLink ( iRow, biggerDimension_ + 1 ); } } else { int iColumn = look - numberRows; assert ( numberInColumn[iColumn] == count ); look = nextCount[look]; CoinBigIndex start = startColumn[iColumn]; CoinBigIndex end = start + numberInColumn[iColumn]; CoinFactorizationDouble minimumValue = element[start]; minimumValue = fabs ( minimumValue ) * pivotTolerance; CoinBigIndex i; for ( i = start; i < end; i++ ) { CoinFactorizationDouble value = element[i]; value = fabs ( value ); if ( value >= minimumValue ) { int iRow = indexRow[i]; int nInRow = numberInRow[iRow]; assert (nInRow>0); double cost = ( count - 1 ) * nInRow; if ( cost < minimumCost ) { minimumCost = cost; minimumCount = nInRow; iPivotRow = iRow; pivotRowPosition = i; iPivotColumn = iColumn; assert (iPivotRow>=0&&iPivotColumn>=0); pivotColumnPosition = -1; if ( minimumCount <= count + 1 ) { look = -1; break; } } } } trials++; if ( trials >= numberTrials && iPivotRow >= 0 ) { look = -1; break; } } } /* endwhile */ if (iPivotRow>=0) { if ( iPivotRow >= 0 ) { int numberDoRow = numberInRow[iPivotRow] - 1; int numberDoColumn = numberInColumn[iPivotColumn] - 1; totalElements_ -= ( numberDoRow + numberDoColumn + 1 ); if ( numberDoColumn > 0 ) { if ( numberDoRow > 0 ) { if ( numberDoColumn > 1 ) { // if (1) { //need to adjust more for cache and SMP //allow at least 4 extra int increment = numberDoColumn + 1 + 4; if ( increment & 15 ) { increment = increment & ( ~15 ); increment += 16; } int increment2 = ( increment + COINFACTORIZATION_BITS_PER_INT - 1 ) >> COINFACTORIZATION_SHIFT_PER_INT; CoinBigIndex size = increment2 * numberDoRow; if ( size > workSize ) { workSize = size; workArea2_.conditionalNew(workSize); workArea2 = workArea2_.array(); } bool goodPivot; //might be able to do better by permuting #ifndef UGLY_COIN_FACTOR_CODING //branch out to best pivot routine goodPivot = pivot ( iPivotRow, iPivotColumn, pivotRowPosition, pivotColumnPosition, workArea, workArea2, increment2, markRow , LARGE_SET); #else #define FAC_SET LARGE_SET #include "CoinFactorization.hpp" #undef FAC_SET #endif if ( !goodPivot ) { status = -99; count=biggerDimension_+1; break; } } else { if ( !pivotOneOtherRow ( iPivotRow, iPivotColumn ) ) { status = -99; count=biggerDimension_+1; break; } } } else { assert (!numberDoRow); if ( !pivotRowSingleton ( iPivotRow, iPivotColumn ) ) { status = -99; count=biggerDimension_+1; break; } } } else { assert (!numberDoColumn); if ( !pivotColumnSingleton ( iPivotRow, iPivotColumn ) ) { status = -99; count=biggerDimension_+1; break; } } assert (nextRow_.array()[iPivotRow]==numberGoodU_); pivotColumn[numberGoodU_] = iPivotColumn; numberGoodU_++; // This should not need to be trapped here - but be safe if (numberGoodU_==numberRows_) count=biggerDimension_+1; } #if COIN_DEBUG==2 checkConsistency ( ); #endif #if 0 // Even if no dense code may be better to use naive dense if (!denseThreshold_&&totalElements_>1000) { int leftRows=numberRows_-numberGoodU_; double full = leftRows; full *= full; assert (full>=0.0); double leftElements = totalElements_; double ratio; if (leftRows>2000) ratio=4.0; else ratio=3.0; if (ratio*leftElements>full) denseThreshold=1; } #endif if (denseThreshold) { // see whether to go dense int leftRows=numberRows_-numberGoodU_; double full = leftRows; full *= full; assert (full>=0.0); double leftElements = totalElements_; //if (leftRows==100) //printf("at 100 %d elements\n",totalElements_); double ratio; if (leftRows>2000) { ratio=4.0; #if COIN_DENSE_MULTIPLIER == 1 ratio =3.5; #endif } else if (leftRows>800) { ratio=3.0; #if COIN_DENSE_MULTIPLIER == 1 ratio =2.75; #endif } else if (leftRows>256) { ratio=2.0; } else { ratio=1.5; } #if COIN_DENSE_MULTIPLIER>10 ratio=10000; #endif if ((ratio*leftElements>full&&leftRows>denseThreshold)) { #if COIN_ALIGN_DENSE == 2 if ((leftRows&7)==0) { #endif //return to do dense if (status!=0) break; int check=0; for (int iColumn=0;iColumni.e.
    , PRESOLVE_DEBUG=1). In a few places, higher values will get you a bit more output. ******** Define the symbols PRESOLVE_DEBUG and PRESOLVE_CONSISTENCY on the configure command line (use ADD_CXXFLAGS), in a Makefile, or similar and do a full rebuild (including any presolve driver code). If the symbols are not consistently nonzero across *all* presolve code, you'll get something between garbage and a core dump! Debugging adds messages to CoinMessage and allocates and maintains arrays that hold debug information. That said, given that you've configured and built with PRESOLVE_DEBUG and PRESOLVE_CONSISTENCY nonzero everywhere, it's safe to adjust PRESOLVE_DEBUG to values in the range 1..n in individual files to increase or decrease the amount of output. The suggested approach for PRESOLVE_DEBUG is to define it to 1 in the build and then increase it in individual presolve code files to get more detail. ******** */ //@{ /*! \relates CoinPresolveMatrix \brief Check column-major and/or row-major matrices for duplicate entries in the major vectors. By default, scans both the column- and row-major matrices. Set doCol (doRow) to false to suppress the column (row) scan. */ void presolve_no_dups(const CoinPresolveMatrix *preObj, bool doCol = true, bool doRow = true) ; /*! \relates CoinPresolveMatrix \brief Check the links which track storage order for major vectors in the bulk storage area. By default, scans both the column- and row-major matrix. Set doCol = false to suppress the column-major scan. Set doRow = false to suppres the row-major scan. */ void presolve_links_ok(const CoinPresolveMatrix *preObj, bool doCol = true, bool doRow = true) ; /*! \relates CoinPresolveMatrix \brief Check for explicit zeros in the column- and/or row-major matrices. By default, scans both the column- and row-major matrices. Set doCol (doRow) to false to suppress the column (row) scan. */ void presolve_no_zeros(const CoinPresolveMatrix *preObj, bool doCol = true, bool doRow = true) ; /*! \relates CoinPresolveMatrix \brief Checks for equivalence of the column- and row-major matrices. Normally the routine will test for coefficient presence and value. Set \p chkvals to false to suppress the check for equal value. */ void presolve_consistent(const CoinPresolveMatrix *preObj, bool chkvals = true) ; /*! \relates CoinPostsolveMatrix \brief Checks that column threads agree with column lengths */ void presolve_check_threads(const CoinPostsolveMatrix *obj) ; /*! \relates CoinPostsolveMatrix \brief Checks the free list Scans the thread of free locations in the bulk store and checks that all entries are reasonable (0 <= index < bulk0_). If chkElemCnt is true, it also checks that the total number of entries in the matrix plus the locations on the free list total to the size of the bulk store. Postsolve routines do not maintain an accurate element count, but this is useful for checking a newly constructed postsolve matrix. */ void presolve_check_free_list(const CoinPostsolveMatrix *obj, bool chkElemCnt = false) ; /*! \relates CoinPostsolveMatrix \brief Check stored reduced costs for accuracy and consistency with variable status. The routine will check the value of the reduced costs for architectural variables (CoinPrePostsolveMatrix::rcosts_). It performs an accuracy check by recalculating the reduced cost from scratch. It will also check the value for consistency with the status information in CoinPrePostsolveMatrix::colstat_. */ void presolve_check_reduced_costs(const CoinPostsolveMatrix *obj) ; /*! \relates CoinPostsolveMatrix \brief Check the dual variables for consistency with row activity. The routine checks that the value of the dual variable is consistent with the state of the constraint (loose, tight at lower bound, or tight at upper bound). */ void presolve_check_duals(const CoinPostsolveMatrix *postObj) ; /*! \relates CoinPresolveMatrix \brief Check primal solution and architectural variable status. The architectural variables can be checked for bogus values, feasibility, and valid status. The row activity is checked for bogus values, accuracy, and feasibility. By default, row activity is not checked (presolve is sloppy about maintaining it). See the definitions in CoinPresolvePsdebug.cpp for more information. */ void presolve_check_sol(const CoinPresolveMatrix *preObj, int chkColSol = 2, int chkRowAct = 1, int chkStatus = 1) ; /*! \relates CoinPostsolveMatrix \brief Check primal solution and architectural variable status. The architectural variables can be checked for bogus values, feasibility, and valid status. The row activity is checked for bogus values, accuracy, and feasibility. See the definitions in CoinPresolvePsdebug.cpp for more information. */ void presolve_check_sol(const CoinPostsolveMatrix *postObj, int chkColSol = 2, int chkRowAct = 2, int chkStatus = 1) ; /*! \relates CoinPresolveMatrix \brief Check for the proper number of basic variables. */ void presolve_check_nbasic(const CoinPresolveMatrix *preObj) ; /*! \relates CoinPostsolveMatrix \brief Check for the proper number of basic variables. */ void presolve_check_nbasic(const CoinPostsolveMatrix *postObj) ; //@} #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveImpliedFree.hpp0000644000175000017500000000342312327604643021254 0ustar renerene/* $Id: CoinPresolveImpliedFree.hpp 1694 2014-04-29 02:08:35Z tkr $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveImpliedFree_H #define CoinPresolveImpliedFree_H /*! \file */ #define IMPLIED_FREE 9 /*! \class implied_free_action \brief Detect and process implied free variables Consider a singleton variable x (i.e., a variable involved in only one constraint). Suppose that the bounds on that constraint, combined with the bounds on the other variables involved in the constraint, are such that even the worst case values of the other variables still imply bounds for x which are tighter than the variable's original bounds. Since x can never reach its upper or lower bounds, it is an implied free variable. Both x and the constraint can be deleted from the problem. A similar transform for the case where the variable is not a natural column singleton is handled by #subst_constraint_action. */ class implied_free_action : public CoinPresolveAction { struct action { int row, col; double clo, cup; double rlo, rup; const double *rowels; const double *costs; int ninrow; }; const int nactions_; const action *const actions_; implied_free_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix * prob, const CoinPresolveAction *next, int & fillLevel); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~implied_free_action(); }; #endif CoinMP-1.8.3/CoinUtils/src/config.h.in0000644000175000017500000001202112450335570016037 0ustar renerene/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if cstdint is available for CoinUtils */ #undef COINUTILS_HAS_CSTDINT /* Define to 1 if stdint.h is available for CoinUtils */ #undef COINUTILS_HAS_STDINT_H /* Default maximum pooled allocation size */ #undef COINUTILS_MEMPOOL_MAXPOOLED /* Define to 1 CoinUtils should override global new/delete */ #undef COINUTILS_MEMPOOL_OVERRIDE_NEW /* Define to 1 if the thread aware version of CoinUtils should be compiled */ #undef COINUTILS_PTHREADS /* SVN revision number of project */ #undef COINUTILS_SVN_REV /* Version number of project */ #undef COINUTILS_VERSION /* Major Version number of project */ #undef COINUTILS_VERSION_MAJOR /* Minor Version number of project */ #undef COINUTILS_VERSION_MINOR /* Release Version number of project */ #undef COINUTILS_VERSION_RELEASE /* Define to the debug sanity check level (0 is no test) */ #undef COIN_COINUTILS_CHECKLEVEL /* Define to the debug verbosity level (0 is no output) */ #undef COIN_COINUTILS_VERBOSITY /* Define to be the name of C-function for Inf check */ #undef COIN_C_FINITE /* Define to be the name of C-function for NaN check */ #undef COIN_C_ISNAN /* If defined, the BLAS Library is available. */ #undef COIN_HAS_BLAS /* Define to 1 if bzlib is available */ #undef COIN_HAS_BZLIB /* Define to 1 if the Glpk package is available */ #undef COIN_HAS_GLPK /* If defined, the LAPACK Library is available. */ #undef COIN_HAS_LAPACK /* Define to 1 if the Netlib package is available */ #undef COIN_HAS_NETLIB /* Define to 1 if readline is available */ #undef COIN_HAS_READLINE /* Define to 1 if the Sample package is available */ #undef COIN_HAS_SAMPLE /* Define to 1 if zlib is available */ #undef COIN_HAS_ZLIB /* Define to 64bit integer type */ #undef COIN_INT64_T /* Define to integer type capturing pointer */ #undef COIN_INTPTR_T /* Define to 64bit unsigned integer type */ #undef COIN_UINT64_T /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ #undef F77_DUMMY_MAIN /* Define to a macro mangling the given C identifier (in lower and upper case), which must not contain underscores, for linking with Fortran. */ #undef F77_FUNC /* As F77_FUNC, but for C identifiers containing underscores. */ #undef F77_FUNC_ /* Define if F77 and FC dummy `main' functions are identical. */ #undef FC_DUMMY_MAIN_EQ_F77 /* Define to 1 if you have the header file. */ #undef HAVE_BZLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_CFLOAT /* Define to 1 if you have the header file. */ #undef HAVE_CIEEEFP /* Define to 1 if you have the header file. */ #undef HAVE_CINTTYPES /* Define to 1 if you have the header file. */ #undef HAVE_CMATH /* Define to 1 if you have the header file. */ #undef HAVE_CSTDINT /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_ENDIAN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the header file. */ #undef HAVE_IEEEFP_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_READLINE_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_WINDOWS_H /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of a `int *', as computed by sizeof. */ #undef SIZEOF_INT_P /* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of a `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION CoinMP-1.8.3/CoinUtils/src/CoinFactorization4.cpp0000644000175000017500000032556012454732774020263 0ustar renerene/* $Id: CoinFactorization4.cpp 1770 2015-01-12 11:54:36Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinUtilsConfig.h" #include #include #include "CoinFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include #include #if COIN_FACTORIZATION_DENSE_CODE==1 // using simple lapack interface extern "C" { /** LAPACK Fortran subroutine DGETRS. */ void F77_FUNC(dgetrs,DGETRS)(char *trans, cipfint *n, cipfint *nrhs, const double *A, cipfint *ldA, cipfint * ipiv, double *B, cipfint *ldB, ipfint *info, int trans_len); } #elif COIN_FACTORIZATION_DENSE_CODE==2 // C interface enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112}; extern "C" { int clapack_dgetrs ( const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans, const int N, const int NRHS, const double *A, const int lda, const int *ipiv, double *B, const int ldb); } #endif // For semi-sparse #define BITS_PER_CHECK 8 #define CHECK_SHIFT 3 typedef unsigned char CoinCheckZero; //:class CoinFactorization. Deals with Factorization and Updates // getRowSpaceIterate. Gets space for one Row with given length //may have to do compression (returns true) //also moves existing vector bool CoinFactorization::getRowSpaceIterate ( int iRow, int extraNeeded ) { const int * numberInRow = numberInRow_.array(); int number = numberInRow[iRow]; CoinBigIndex * COIN_RESTRICT startRow = startRowU_.array(); int * COIN_RESTRICT indexColumn = indexColumnU_.array(); CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnU_.array(); CoinBigIndex space = lengthAreaU_ - startRow[maximumRowsExtra_]; int * COIN_RESTRICT nextRow = nextRow_.array(); int * COIN_RESTRICT lastRow = lastRow_.array(); if ( space < extraNeeded + number + 2 ) { //compression int iRow = nextRow[maximumRowsExtra_]; CoinBigIndex put = 0; while ( iRow != maximumRowsExtra_ ) { //move CoinBigIndex get = startRow[iRow]; CoinBigIndex getEnd = startRow[iRow] + numberInRow[iRow]; startRow[iRow] = put; CoinBigIndex i; for ( i = get; i < getEnd; i++ ) { indexColumn[put] = indexColumn[i]; convertRowToColumn[put] = convertRowToColumn[i]; put++; } iRow = nextRow[iRow]; } /* endwhile */ numberCompressions_++; startRow[maximumRowsExtra_] = put; space = lengthAreaU_ - put; if ( space < extraNeeded + number + 2 ) { //need more space //if we can allocate bigger then do so and copy //if not then return so code can start again status_ = -99; return false; } } CoinBigIndex put = startRow[maximumRowsExtra_]; int next = nextRow[iRow]; int last = lastRow[iRow]; //out nextRow[last] = next; lastRow[next] = last; //in at end last = lastRow[maximumRowsExtra_]; nextRow[last] = iRow; lastRow[maximumRowsExtra_] = iRow; lastRow[iRow] = last; nextRow[iRow] = maximumRowsExtra_; //move CoinBigIndex get = startRow[iRow]; int * indexColumnU = indexColumnU_.array(); startRow[iRow] = put; while ( number ) { number--; indexColumnU[put] = indexColumnU[get]; convertRowToColumn[put] = convertRowToColumn[get]; put++; get++; } /* endwhile */ //add four for luck startRow[maximumRowsExtra_] = put + extraNeeded + 4; return true; } // getColumnSpaceIterateR. Gets space for one extra R element in Column //may have to do compression (returns true) //also moves existing vector bool CoinFactorization::getColumnSpaceIterateR ( int iColumn, double value, int iRow) { CoinFactorizationDouble * COIN_RESTRICT elementR = elementR_ + lengthAreaR_; int * COIN_RESTRICT indexRowR = indexRowR_ + lengthAreaR_; CoinBigIndex * COIN_RESTRICT startR = startColumnR_.array()+maximumPivots_+1; int * COIN_RESTRICT numberInColumnPlus = numberInColumnPlus_.array(); int number = numberInColumnPlus[iColumn]; //*** modify so sees if can go in //see if it can go in at end int * COIN_RESTRICT nextColumn = nextColumn_.array(); int * COIN_RESTRICT lastColumn = lastColumn_.array(); if (lengthAreaR_-startR[maximumColumnsExtra_] (put + 4) ,lengthAreaR_); return true; } int CoinFactorization::checkPivot(double saveFromU, double oldPivot) const { int status; #define ALLOW_SMALL_PIVOTS #ifdef ALLOW_SMALL_PIVOTS #define SMALL_PIVOT 1.0e-9 #else #define SMALL_PIVOT 1.0e-8 #endif if ( fabs ( saveFromU ) > SMALL_PIVOT ) { double checkTolerance; if ( numberRowsExtra_ < numberRows_ + 2 ) { checkTolerance = 1.0e-5; } else if ( numberRowsExtra_ < numberRows_ + 10 ) { checkTolerance = 1.0e-6; } else if ( numberRowsExtra_ < numberRows_ + 50 ) { checkTolerance = 1.0e-8; } else { checkTolerance = 1.0e-10; } checkTolerance *= relaxCheck_; if ( fabs ( 1.0 - fabs ( saveFromU / oldPivot ) ) < checkTolerance ) { status = 0; } else { #if COIN_DEBUG std::cout <<"inaccurate pivot "<< oldPivot << " " << saveFromU << std::endl; #endif if ( fabs ( fabs ( oldPivot ) - fabs ( saveFromU ) ) < 1.0e-12 || fabs ( 1.0 - fabs ( saveFromU / oldPivot ) ) < 1.0e-8 ) { status = 1; } else { status = 2; } } } else { //error if ( fabs ( 1.0 - fabs ( saveFromU / oldPivot ) ) < 1.0e-10 ) { status = 0; } else { status = 2; #if COIN_DEBUG std::cout <<"inaccurate pivot "<< saveFromU / oldPivot << " " << saveFromU << std::endl; #endif } } //if (status==2) //printf("status %d\n",status); return status; } #ifdef CLP_FACTORIZATION_INSTRUMENT extern double externalTimeStart; extern double timeInFactorize; extern double timeInUpdate; extern double timeInFactorizeFake; extern double timeInUpdateFake1; extern double timeInUpdateFake2; extern double timeInUpdateTranspose; extern double timeInUpdateFT; extern double timeInUpdateTwoFT; extern double timeInReplace; extern int numberUpdate; extern int numberUpdateTranspose; extern int numberUpdateFT; extern int numberUpdateTwoFT; extern int numberReplace; extern int currentLengthR; extern int currentLengthU; extern int currentTakeoutU; extern double averageLengthR; extern double averageLengthL; extern double averageLengthU; extern double scaledLengthDense; extern double scaledLengthDenseSquared; extern double scaledLengthL; extern double scaledLengthR; extern double scaledLengthU; extern int startLengthU; extern int endLengthU; #endif // replaceColumn. Replaces one Column to basis // returns 0=OK, 1=Probably OK, 2=singular, 3=no room //partial update already in U int CoinFactorization::replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow, double pivotCheck , bool checkBeforeModifying, double ) { #ifdef CLP_FACTORIZATION_INSTRUMENT double startTimeX=CoinCpuTime(); #endif assert (numberU_<=numberRowsExtra_); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); CoinBigIndex * COIN_RESTRICT startColumn; int * COIN_RESTRICT indexRow; CoinFactorizationDouble * COIN_RESTRICT element; //return at once if too many iterations if ( numberColumnsExtra_ >= maximumColumnsExtra_ ) { return 5; } if ( lengthAreaU_ < startColumnU[maximumColumnsExtra_] ) { return 3; } int * COIN_RESTRICT numberInRow = numberInRow_.array(); int * COIN_RESTRICT numberInColumn = numberInColumn_.array(); int * COIN_RESTRICT numberInColumnPlus = numberInColumnPlus_.array(); int realPivotRow; realPivotRow = pivotColumn_.array()[pivotRow]; //zeroed out region double * COIN_RESTRICT region = regionSparse->denseVector ( ); element = elementU_.array(); //take out old pivot column // If we have done no pivots then always check before modification if (!numberPivots_) checkBeforeModifying=true; totalElements_ -= numberInColumn[realPivotRow]; CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegion_.array(); CoinFactorizationDouble oldPivot = pivotRegion[realPivotRow]; // for accuracy check pivotCheck = pivotCheck / oldPivot; #if COIN_DEBUG>1 int checkNumber=1000000; //if (numberL_) checkNumber=-1; if (numberR_>=checkNumber) { printf("pivot row %d, check %g - alpha region:\n", realPivotRow,pivotCheck); /*int i; for (i=0;igetIndices ( ); CoinBigIndex * COIN_RESTRICT startRow = startRowU_.array(); CoinBigIndex start=0; CoinBigIndex end=0; #if COIN_DEBUG>1 if (numberR_>=checkNumber) printf("Before btranu\n"); #endif #if COIN_ONE_ETA_COPY if (convertRowToColumn) { #endif start = startRow[realPivotRow]; end = start + numberInRow[realPivotRow]; int smallestIndex=numberRowsExtra_; if (!checkBeforeModifying) { for (CoinBigIndex i = start; i < end ; i ++ ) { int iColumn = indexColumn[i]; assert (iColumn1 if (numberR_>=checkNumber) printf("%d %g\n",iColumn,region[iColumn]); #endif element[j] = 0.0; regionIndex[numberNonZero++] = iColumn; } } else { for (CoinBigIndex i = start; i < end ; i ++ ) { int iColumn = indexColumn[i]; smallestIndex = CoinMin(smallestIndex,iColumn); CoinBigIndex j = convertRowToColumn[i]; region[iColumn] = element[j]; #if COIN_DEBUG>1 if (numberR_>=checkNumber) printf("%d %g\n",iColumn,region[iColumn]); #endif regionIndex[numberNonZero++] = iColumn; } } //do BTRAN - finding first one to use regionSparse->setNumElements ( numberNonZero ); updateColumnTransposeU ( regionSparse, smallestIndex ); #if COIN_ONE_ETA_COPY } else { // use R to save where elements are CoinBigIndex * saveWhere = NULL; if (checkBeforeModifying) { if ( lengthR_ + maximumRowsExtra_ +1>= lengthAreaR_ ) { //not enough room return 3; } saveWhere = indexRowR_+lengthR_; } replaceColumnU(regionSparse,saveWhere, realPivotRow); } #endif numberNonZero = regionSparse->getNumElements ( ); CoinFactorizationDouble saveFromU = 0.0; CoinBigIndex startU = startColumnU[numberColumnsExtra_]; int * COIN_RESTRICT indexU = &indexRowU_.array()[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU = &elementU_.array()[startU]; // Do accuracy test here if caller is paranoid if (checkBeforeModifying) { double tolerance = zeroTolerance_; int number = numberInColumn[numberColumnsExtra_]; for (CoinBigIndex i = 0; i < number; i++ ) { int iRow = indexU[i]; //if (numberCompressions_==99&&lengthU_==278) //printf("row %d saveFromU %g element %g region %g\n", // iRow,saveFromU,elementU[i],region[iRow]); if ( fabs ( elementU[i] ) > tolerance ) { if ( iRow != realPivotRow ) { saveFromU -= elementU[i] * region[iRow]; } else { saveFromU += elementU[i]; } } } //check accuracy int status = checkPivot(saveFromU,pivotCheck); if (status) { // restore some things pivotRegion[realPivotRow] = oldPivot; number = saveEnd-startColumnU[realPivotRow]; totalElements_ += number; numberInColumn[realPivotRow]=number; regionSparse->clear(); return status; #if COIN_ONE_ETA_COPY } else if (convertRowToColumn) { #else } else { #endif // do what we would have done by now for (CoinBigIndex i = start; i < end ; i ++ ) { CoinBigIndex j = convertRowToColumn[i]; element[j] = 0.0; } #if COIN_ONE_ETA_COPY } else { // delete elements // used R to save where elements are CoinBigIndex * saveWhere = indexRowR_+lengthR_; CoinFactorizationDouble *element = elementU_.array(); int n = saveWhere[0]; for (int i=0;i= lengthAreaR_ ) { //not enough room regionSparse->clear(); return 3; } #if COIN_DEBUG>1 if (numberR_>=checkNumber) printf("After btranu\n"); #endif for (CoinBigIndex i = 0; i < numberNonZero; i++ ) { int iRow = regionIndex[i]; #if COIN_DEBUG>1 if (numberR_>=checkNumber) printf("%d %g\n",iRow,region[iRow]); #endif indexRow[l] = iRow; element[l] = region[iRow]; l++; } int * nextRow; int * lastRow; int next; int last; #if COIN_ONE_ETA_COPY if (convertRowToColumn) { #endif //take out row nextRow = nextRow_.array(); lastRow = lastRow_.array(); next = nextRow[realPivotRow]; last = lastRow[realPivotRow]; nextRow[last] = next; lastRow[next] = last; numberInRow[realPivotRow]=0; #if COIN_DEBUG nextRow[realPivotRow] = 777777; lastRow[realPivotRow] = 777777; #endif #if COIN_ONE_ETA_COPY } #endif //do permute permute_.array()[numberRowsExtra_] = realPivotRow; // and other way permuteBack_.array()[realPivotRow] = numberRowsExtra_; permuteBack_.array()[numberRowsExtra_] = -1;; //and for safety permute_.array()[numberRowsExtra_ + 1] = 0; pivotColumn_.array()[pivotRow] = numberRowsExtra_; pivotColumnBack()[numberRowsExtra_] = pivotRow; startColumn = startColumnU; indexRow = indexRowU_.array(); element = elementU_.array(); numberU_++; number = numberInColumn[numberColumnsExtra_]; totalElements_ += number; lengthU_ += number; if ( lengthU_ >= lengthAreaU_ ) { //not enough room regionSparse->clear(); return 3; } saveFromU = 0.0; //put in pivot //add row counts #if COIN_DEBUG>1 if (numberR_>=checkNumber) printf("On U\n"); #endif #if COIN_ONE_ETA_COPY if (convertRowToColumn) { #endif for (CoinBigIndex i = 0; i < number; i++ ) { int iRow = indexU[i]; #if COIN_DEBUG>1 if (numberR_>=checkNumber) printf("%d %g\n",iRow,elementU[i]); #endif //assert ( fabs ( elementU[i] ) > zeroTolerance_ ); if ( iRow != realPivotRow ) { int next = nextRow[iRow]; int iNumberInRow = numberInRow[iRow]; CoinBigIndex space; CoinBigIndex put = startRow[iRow] + iNumberInRow; space = startRow[next] - put; if ( space <= 0 ) { getRowSpaceIterate ( iRow, iNumberInRow + 4 ); put = startRow[iRow] + iNumberInRow; } indexColumn[put] = numberColumnsExtra_; convertRowToColumn[put] = i + startU; numberInRow[iRow] = iNumberInRow + 1; saveFromU = saveFromU - elementU[i] * region[iRow]; } else { //zero out and save saveFromU += elementU[i]; elementU[i] = 0.0; } } //in at end last = lastRow[maximumRowsExtra_]; nextRow[last] = numberRowsExtra_; lastRow[maximumRowsExtra_] = numberRowsExtra_; lastRow[numberRowsExtra_] = last; nextRow[numberRowsExtra_] = maximumRowsExtra_; startRow[numberRowsExtra_] = startRow[maximumRowsExtra_]; numberInRow[numberRowsExtra_] = 0; #if COIN_ONE_ETA_COPY } else { //abort(); for (CoinBigIndex i = 0; i < number; i++ ) { int iRow = indexU[i]; #if COIN_DEBUG>1 if (numberR_>=checkNumber) printf("%d %g\n",iRow,elementU[i]); #endif if ( fabs ( elementU[i] ) > tolerance ) { if ( iRow != realPivotRow ) { saveFromU = saveFromU - elementU[i] * region[iRow]; } else { //zero out and save saveFromU += elementU[i]; elementU[i] = 0.0; } } else { elementU[i] = 0.0; } } } #endif //column in at beginning (as empty) int * COIN_RESTRICT nextColumn = nextColumn_.array(); int * COIN_RESTRICT lastColumn = lastColumn_.array(); next = nextColumn[maximumColumnsExtra_]; lastColumn[next] = numberColumnsExtra_; nextColumn[maximumColumnsExtra_] = numberColumnsExtra_; nextColumn[numberColumnsExtra_] = next; lastColumn[numberColumnsExtra_] = maximumColumnsExtra_; //check accuracy - but not if already checked (optimization problem) int status = (checkBeforeModifying) ? 0 : checkPivot(saveFromU,pivotCheck); if (status!=2) { CoinFactorizationDouble pivotValue = 1.0 / saveFromU; pivotRegion[numberRowsExtra_] = pivotValue; //modify by pivot for (CoinBigIndex i = 0; i < number; i++ ) { elementU[i] *= pivotValue; } maximumU_ = CoinMax(maximumU_,startU+number); numberRowsExtra_++; numberColumnsExtra_++; numberGoodU_++; numberPivots_++; } if ( numberRowsExtra_ > numberRows_ + 50 ) { CoinBigIndex extra = factorElements_ >> 1; if ( numberRowsExtra_ > numberRows_ + 100 + numberRows_ / 500 ) { if ( extra < 2 * numberRows_ ) { extra = 2 * numberRows_; } } else { if ( extra < 5 * numberRows_ ) { extra = 5 * numberRows_; } } CoinBigIndex added = totalElements_ - factorElements_; if ( added > extra && added > ( factorElements_ ) << 1 && !status && 3*totalElements_ > 2*(lengthAreaU_+lengthAreaL_)) { status = 3; if ( messageLevel_ & 4 ) { std::cout << "Factorization has "<< totalElements_ << ", basis had " << factorElements_ <iRow); next = nextColumn[iRow]; CoinBigIndex space; if (next!=maximumColumnsExtra_) space = startR[next]-startR[iRow]; else space = lengthAreaR_-startR[iRow]; int numberInR = numberInColumnPlus[iRow]; if (space>numberInR) { // there is space CoinBigIndex put=startR[iRow]+numberInR; numberInColumnPlus[iRow]=numberInR+1; indexRowR[put]=pivotRow; elementR[put]=region[iRow]; //add 4 for luck if (next==maximumColumnsExtra_) startR[maximumColumnsExtra_] = CoinMin(static_cast (put + 4) ,lengthAreaR_); } else { // no space - do we shuffle? if (!getColumnSpaceIterateR(iRow,region[iRow],pivotRow)) { // printf("Need more space for R\n"); numberInColumnPlus_.conditionalDelete(); regionSparse->clear(); break; } } region[iRow]=0.0; } regionSparse->setNumElements(0); } else { regionSparse->clear(); } #ifdef CLP_FACTORIZATION_INSTRUMENT numberReplace++; timeInReplace += CoinCpuTime()-startTimeX; currentLengthR=lengthR_; currentLengthU=lengthU_; #endif return status; } // updateColumnTranspose. Updates one column transpose (BTRAN) int CoinFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2 ) const { #ifdef CLP_FACTORIZATION_INSTRUMENT double startTimeX=CoinCpuTime(); #endif //zero region regionSparse->clear ( ); double * COIN_RESTRICT region = regionSparse->denseVector ( ); double * COIN_RESTRICT vector = regionSparse2->denseVector(); int * COIN_RESTRICT index = regionSparse2->getIndices(); int numberNonZero = regionSparse2->getNumElements(); const int * pivotColumn = pivotColumn_.array(); //move indices into index array int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); bool packed = regionSparse2->packedMode(); if (packed) { for (int i = 0; i < numberNonZero; i ++ ) { int iRow = index[i]; double value = vector[i]; iRow=pivotColumn[iRow]; vector[i]=0.0; region[iRow] = value; regionIndex[i] = iRow; } } else { for (int i = 0; i < numberNonZero; i ++ ) { int iRow = index[i]; double value = vector[iRow]; vector[iRow]=0.0; iRow=pivotColumn[iRow]; region[iRow] = value; regionIndex[i] = iRow; } } regionSparse->setNumElements ( numberNonZero ); if (collectStatistics_) { numberBtranCounts_++; btranCountInput_ += static_cast (numberNonZero); } if (!doForrestTomlin_) { // Do PFI before everything else updateColumnTransposePFI(regionSparse); numberNonZero = regionSparse->getNumElements(); } // ******* U // Apply pivot region - could be combined for speed CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegion_.array(); int smallestIndex=numberRowsExtra_; for (int j = 0; j < numberNonZero; j++ ) { int iRow = regionIndex[j]; smallestIndex = CoinMin(smallestIndex,iRow); region[iRow] *= pivotRegion[iRow]; } updateColumnTransposeU ( regionSparse,smallestIndex ); if (collectStatistics_) btranCountAfterU_ += static_cast (regionSparse->getNumElements()); //permute extra //row bits here updateColumnTransposeR ( regionSparse ); // ******* L updateColumnTransposeL ( regionSparse ); numberNonZero = regionSparse->getNumElements ( ); if (collectStatistics_) { btranCountAfterL_ += static_cast (numberNonZero); #ifdef CLP_FACTORIZATION_INSTRUMENT scaledLengthDense += numberDense_*numberNonZero; scaledLengthDenseSquared += numberDense_*numberDense_*numberNonZero; scaledLengthL += lengthL_*numberNonZero; scaledLengthR += lengthR_*numberNonZero; scaledLengthU += lengthU_*numberNonZero; #endif } const int * permuteBack = pivotColumnBack(); int number=0; if (packed) { for (int i=0;izeroTolerance_) { iRow=permuteBack[iRow]; vector[number]=value; index[number++]=iRow; //} } } else { for (int i=0;izeroTolerance_) { iRow=permuteBack[iRow]; vector[iRow]=value; index[number++]=iRow; //} } } regionSparse->setNumElements(0); regionSparse2->setNumElements(number); #ifdef COIN_DEBUG for (i=0;idenseVector ( ); int numberNonZero = regionSparse->getNumElements ( ); double tolerance = zeroTolerance_; int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); const CoinBigIndex *startRow = startRowU_.array(); const CoinBigIndex *convertRowToColumn = convertRowToColumnU_.array(); const int *indexColumn = indexColumnU_.array(); const CoinFactorizationDouble * element = elementU_.array(); int last = numberU_; const int *numberInRow = numberInRow_.array(); numberNonZero = 0; for (int i=smallestIndex ; i < last; i++ ) { CoinFactorizationDouble pivotValue = region[i]; if ( fabs ( pivotValue ) > tolerance ) { CoinBigIndex start = startRow[i]; int numberIn = numberInRow[i]; CoinBigIndex end = start + (numberIn&(~1)); for (CoinBigIndex j = start ; j < end; j += 2 ) { int iRow0 = indexColumn[j]; int iRow1 = indexColumn[j+1]; CoinBigIndex getElement0 = convertRowToColumn[j]; CoinBigIndex getElement1 = convertRowToColumn[j+1]; CoinFactorizationDouble value0 = element[getElement0]; CoinFactorizationDouble value1 = element[getElement1]; region[iRow0] -= value0 * pivotValue; region[iRow1] -= value1 * pivotValue; } if ((numberIn&1)!=0) { int iRow = indexColumn[end]; CoinBigIndex getElement = convertRowToColumn[end]; CoinFactorizationDouble value = element[getElement]; region[iRow] -= value * pivotValue; } regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } //set counts regionSparse->setNumElements ( numberNonZero ); } /* Updates part of column transpose (BTRANU) when sparsish, assumes index is sorted i.e. region is correct */ void CoinFactorization::updateColumnTransposeUSparsish ( CoinIndexedVector * regionSparse, int smallestIndex) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int numberNonZero = regionSparse->getNumElements ( ); double tolerance = zeroTolerance_; int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); const CoinBigIndex *startRow = startRowU_.array(); const CoinBigIndex *convertRowToColumn = convertRowToColumnU_.array(); const int *indexColumn = indexColumnU_.array(); const CoinFactorizationDouble * element = elementU_.array(); int last = numberU_; const int *numberInRow = numberInRow_.array(); // mark known to be zero int nInBig = sizeof(CoinBigIndex)/sizeof(int); CoinCheckZero * COIN_RESTRICT mark = reinterpret_cast (sparse_.array()+(2+nInBig)*maximumRowsExtra_); for (int i=0;i>CHECK_SHIFT; int iBit = iPivot-(iWord<(mark[iWord] | (1<(1<> CHECK_SHIFT; int kLast = last>>CHECK_SHIFT; // do in chunks for (int k=smallestIndex;k tolerance ) { CoinBigIndex start = startRow[i]; int numberIn = numberInRow[i]; CoinBigIndex end = start + numberIn; for (CoinBigIndex j = start ; j < end; j ++ ) { int iRow = indexColumn[j]; CoinBigIndex getElement = convertRowToColumn[j]; CoinFactorizationDouble value = element[getElement]; int iWord = iRow>>CHECK_SHIFT; int iBit = iRow-(iWord<(mark[iWord] | (1<(1< tolerance ) { CoinBigIndex start = startRow[i]; int numberIn = numberInRow[i]; CoinBigIndex end = start + numberIn; for (CoinBigIndex j = start ; j < end; j ++ ) { int iRow = indexColumn[j]; CoinBigIndex getElement = convertRowToColumn[j]; CoinFactorizationDouble value = element[getElement]; region[iRow] -= value * pivotValue; } regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } #ifdef COIN_DEBUG for (int i=0;isetNumElements ( numberNonZero ); } /* Updates part of column transpose (BTRANU) when sparse, assumes index is sorted i.e. region is correct */ void CoinFactorization::updateColumnTransposeUSparse ( CoinIndexedVector * regionSparse) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int numberNonZero = regionSparse->getNumElements ( ); double tolerance = zeroTolerance_; int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); const CoinBigIndex *startRow = startRowU_.array(); const CoinBigIndex *convertRowToColumn = convertRowToColumnU_.array(); const int *indexColumn = indexColumnU_.array(); const CoinFactorizationDouble * element = elementU_.array(); const int *numberInRow = numberInRow_.array(); // use sparse_ as temporary area // mark known to be zero int * COIN_RESTRICT stack = sparse_.array(); /* pivot */ int * COIN_RESTRICT list = stack + maximumRowsExtra_; /* final list */ CoinBigIndex * COIN_RESTRICT next = reinterpret_cast (list + maximumRowsExtra_); /* jnext */ char * COIN_RESTRICT mark = reinterpret_cast (next + maximumRowsExtra_); int nList; #ifdef COIN_DEBUG for (int i=0;ii); } } #endif nList=0; for (int k=0;k=startRow[kPivot]) { kPivot=indexColumn[j--]; /* put back on stack */ next[nStack++] =j; if (!mark[kPivot]) { /* and new one */ j=startRow[kPivot]+numberInRow[kPivot]-1; stack[nStack]=kPivot; mark[kPivot]=2; next[nStack++]=j; } } else { // finished list[nList++]=kPivot; mark[kPivot]=1; } } } } numberNonZero=0; for (int i=nList-1;i>=0;i--) { int iPivot = list[i]; mark[iPivot]=0; CoinFactorizationDouble pivotValue = region[iPivot]; if ( fabs ( pivotValue ) > tolerance ) { CoinBigIndex start = startRow[iPivot]; int numberIn = numberInRow[iPivot]; CoinBigIndex end = start + numberIn; for (CoinBigIndex j=start ; j < end; j ++ ) { int iRow = indexColumn[j]; CoinBigIndex getElement = convertRowToColumn[j]; CoinFactorizationDouble value = element[getElement]; region[iRow] -= value * pivotValue; } regionIndex[numberNonZero++] = iPivot; } else { region[iPivot] = 0.0; } } //set counts regionSparse->setNumElements ( numberNonZero ); } // updateColumnTransposeU. Updates part of column transpose (BTRANU) //assumes index is sorted i.e. region is correct //does not sort by sign void CoinFactorization::updateColumnTransposeU ( CoinIndexedVector * regionSparse, int smallestIndex) const { #if COIN_ONE_ETA_COPY CoinBigIndex *convertRowToColumn = convertRowToColumnU_.array(); if (!convertRowToColumn) { //abort(); updateColumnTransposeUByColumn(regionSparse,smallestIndex); return; } #endif int number = regionSparse->getNumElements ( ); int goSparse; // Guess at number at end if (sparseThreshold_>0) { if (btranAverageAfterU_) { int newNumber = static_cast (number*btranAverageAfterU_); if (newNumber< sparseThreshold_) goSparse = 2; else if (newNumber< sparseThreshold2_) goSparse = 1; else goSparse = 0; } else { if (numberdenseVector ( ); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int numberNonZero; double tolerance = zeroTolerance_; int base; int first = -1; numberNonZero=0; //scan for (first=numberRows_-1;first>=0;first--) { if (region[first]) break; } if ( first >= 0 ) { base = baseL_; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnL_.array(); const int * COIN_RESTRICT indexRow = indexRowL_.array(); const CoinFactorizationDouble * COIN_RESTRICT element = elementL_.array(); int last = baseL_ + numberL_; if ( first >= last ) { first = last - 1; } for (int i = first ; i >= base; i-- ) { CoinBigIndex j; CoinFactorizationDouble pivotValue = region[i]; for ( j= startColumn[i] ; j < startColumn[i+1]; j++ ) { int iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; pivotValue -= value * region[iRow]; } if ( fabs ( pivotValue ) > tolerance ) { region[i] = pivotValue; regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } //may have stopped early if ( first < base ) { base = first + 1; } if (base > 5) { int i=base-1; CoinFactorizationDouble pivotValue=region[i]; bool store = fabs(pivotValue) > tolerance; for (; i > 0; i-- ) { bool oldStore = store; CoinFactorizationDouble oldValue = pivotValue; pivotValue = region[i-1]; store = fabs ( pivotValue ) > tolerance ; if (!oldStore) { region[i] = 0.0; } else { region[i] = oldValue; regionIndex[numberNonZero++] = i; } } if (store) { region[0] = pivotValue; regionIndex[numberNonZero++] = 0; } else { region[0] = 0.0; } } else { for (int i = base -1 ; i >= 0; i-- ) { CoinFactorizationDouble pivotValue = region[i]; if ( fabs ( pivotValue ) > tolerance ) { region[i] = pivotValue; regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } } } //set counts regionSparse->setNumElements ( numberNonZero ); } /* updateColumnTransposeLByRow. Updates part of column transpose (BTRANL) densish but by row */ void CoinFactorization::updateColumnTransposeLByRow ( CoinIndexedVector * regionSparse ) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int numberNonZero; double tolerance = zeroTolerance_; int first = -1; // use row copy of L const CoinFactorizationDouble * element = elementByRowL_.array(); const CoinBigIndex * startRow = startRowL_.array(); const int * column = indexColumnL_.array(); for (first=numberRows_-1;first>=0;first--) { if (region[first]) break; } numberNonZero=0; for (int i=first;i>=0;i--) { CoinFactorizationDouble pivotValue = region[i]; if ( fabs ( pivotValue ) > tolerance ) { regionIndex[numberNonZero++] = i; CoinBigIndex j; for (j = startRow[i + 1]-1;j >= startRow[i]; j--) { int iRow = column[j]; CoinFactorizationDouble value = element[j]; region[iRow] -= pivotValue*value; } } else { region[i] = 0.0; } } //set counts regionSparse->setNumElements ( numberNonZero ); } // Updates part of column transpose (BTRANL) when sparsish by row void CoinFactorization::updateColumnTransposeLSparsish ( CoinIndexedVector * regionSparse ) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse->getNumElements(); double tolerance = zeroTolerance_; // use row copy of L const CoinFactorizationDouble * element = elementByRowL_.array(); const CoinBigIndex * startRow = startRowL_.array(); const int * column = indexColumnL_.array(); // mark known to be zero int nInBig = sizeof(CoinBigIndex)/sizeof(int); CoinCheckZero * COIN_RESTRICT mark = reinterpret_cast (sparse_.array()+(2+nInBig)*maximumRowsExtra_); for (int i=0;i>CHECK_SHIFT; int iBit = iPivot-(iWord<(mark[iWord] | (1<(1<>CHECK_SHIFT; jLast = (jLast<=jLast;i--) { CoinFactorizationDouble pivotValue = region[i]; if ( fabs ( pivotValue ) > tolerance ) { regionIndex[numberNonZero++] = i; CoinBigIndex j; for (j = startRow[i + 1]-1;j >= startRow[i]; j--) { int iRow = column[j]; CoinFactorizationDouble value = element[j]; int iWord = iRow>>CHECK_SHIFT; int iBit = iRow-(iWord<(mark[iWord] | (1<(1<>CHECK_SHIFT; mark[jLast]=0; for (int k=jLast-1;k>=0;k--) { unsigned int iMark = mark[k]; if (iMark) { // something in chunk - do all (as imark may change) int iLast = k<= iLast; i-- ) { CoinFactorizationDouble pivotValue = region[i]; if ( fabs ( pivotValue ) > tolerance ) { regionIndex[numberNonZero++] = i; CoinBigIndex j; for (j = startRow[i + 1]-1;j >= startRow[i]; j--) { int iRow = column[j]; CoinFactorizationDouble value = element[j]; int iWord = iRow>>CHECK_SHIFT; int iBit = iRow-(iWord<(mark[iWord] | (1<(1<setNumElements ( numberNonZero ); } /* updateColumnTransposeLSparse. Updates part of column transpose (BTRANL) sparse */ void CoinFactorization::updateColumnTransposeLSparse ( CoinIndexedVector * regionSparse ) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse->getNumElements ( ); double tolerance = zeroTolerance_; // use row copy of L const CoinFactorizationDouble * element = elementByRowL_.array(); const CoinBigIndex * startRow = startRowL_.array(); const int * column = indexColumnL_.array(); // use sparse_ as temporary area // mark known to be zero int * COIN_RESTRICT stack = sparse_.array(); /* pivot */ int * COIN_RESTRICT list = stack + maximumRowsExtra_; /* final list */ CoinBigIndex * COIN_RESTRICT next = reinterpret_cast (list + maximumRowsExtra_); /* jnext */ char * COIN_RESTRICT mark = reinterpret_cast (next + maximumRowsExtra_); int nList; int number = numberNonZero; #ifdef COIN_DEBUG for (i=0;i=0) { /* take off stack */ if (j>=startRow[kPivot]) { int jPivot=column[j--]; /* put back on stack */ next[nStack] =j; if (!mark[jPivot]) { /* and new one */ kPivot=jPivot; j = startRow[kPivot+1]-1; stack[++nStack]=kPivot; mark[kPivot]=1; next[nStack]=j; } } else { /* finished so mark */ list[nList++]=kPivot; mark[kPivot]=1; --nStack; if (nStack>=0) { kPivot=stack[nStack]; j=next[nStack]; } } } } } numberNonZero=0; for (int i=nList-1;i>=0;i--) { int iPivot = list[i]; mark[iPivot]=0; CoinFactorizationDouble pivotValue = region[iPivot]; if ( fabs ( pivotValue ) > tolerance ) { regionIndex[numberNonZero++] = iPivot; CoinBigIndex j; for ( j = startRow[iPivot]; j < startRow[iPivot+1]; j ++ ) { int iRow = column[j]; CoinFactorizationDouble value = element[j]; region[iRow] -= value * pivotValue; } } else { region[iPivot]=0.0; } } //set counts regionSparse->setNumElements ( numberNonZero ); } // updateColumnTransposeL. Updates part of column transpose (BTRANL) void CoinFactorization::updateColumnTransposeL ( CoinIndexedVector * regionSparse ) const { int number = regionSparse->getNumElements ( ); if (!numberL_&&!numberDense_) { if (sparse_.array()||number0) { if (btranAverageAfterL_) { int newNumber = static_cast (number*btranAverageAfterL_); if (newNumber< sparseThreshold_) goSparse = 2; else if (newNumber< sparseThreshold2_) goSparse = 1; else goSparse = 0; } else { if (numbergetNumElements(); double * COIN_RESTRICT region = regionSparse->denseVector ( ); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int i=0; bool doDense=false; if (number<=numberRows_) { while (i=lastSparse) { doDense=true; regionIndex[i] = regionIndex[--number]; } else { i++; } } } else { for (i=numberRows_-1;i>=lastSparse;i--) { if (region[i]) { doDense=true; // numbers are all wrong - do a scan regionSparse->setNumElements(0); regionSparse->scan(0,lastSparse,zeroTolerance_); number=regionSparse->getNumElements(); break; } } if (sparseThreshold_) goSparse=0; else goSparse=-1; } if (doDense) { regionSparse->setNumElements(number); #if COIN_FACTORIZATION_DENSE_CODE==1 char trans = 'T'; int ione=1; int info; F77_FUNC(dgetrs,DGETRS)(&trans,&numberDense_,&ione,denseAreaAddress_,&numberDense_, densePermute_,region+lastSparse,&numberDense_,&info,1); #elif COIN_FACTORIZATION_DENSE_CODE==2 clapack_dgetrs ( CblasColMajor,CblasTrans,numberDense_,1, denseAreaAddress_,numberDense_,densePermute_, region+lastSparse,numberDense_); #endif //and scan again if (goSparse>0||!numberL_) regionSparse->scan(lastSparse,numberRows_,zeroTolerance_); } if (!numberL_) { // could be odd combination of sparse/dense if (number>numberRows_) { regionSparse->setNumElements(0); regionSparse->scan(0,numberRows_,zeroTolerance_); } return; } } #endif if (goSparse>0&®ionSparse->getNumElements()>numberRows_) goSparse=0; switch (goSparse) { case -1: // No row copy updateColumnTransposeLDensish(regionSparse); break; case 0: // densish but by row updateColumnTransposeLByRow(regionSparse); break; case 1: // middling(and by row) updateColumnTransposeLSparsish(regionSparse); break; case 2: // sparse updateColumnTransposeLSparse(regionSparse); break; } } #if COIN_ONE_ETA_COPY /* Combines BtranU and delete elements If deleted is NULL then delete elements otherwise store where elements are */ void CoinFactorization::replaceColumnU ( CoinIndexedVector * regionSparse, CoinBigIndex * deleted, int internalPivotRow) { double * COIN_RESTRICT region = regionSparse->denseVector(); int * COIN_RESTRICT regionIndex = regionSparse->getIndices(); double tolerance = zeroTolerance_; const CoinBigIndex *startColumn = startColumnU_.array(); const int *indexRow = indexRowU_.array(); CoinFactorizationDouble *element = elementU_.array(); int numberNonZero = 0; const int *numberInColumn = numberInColumn_.array(); //const CoinFactorizationDouble *pivotRegion = pivotRegion_.array(); bool deleteNow=true; if (deleted) { deleteNow = false; deleted ++; } int nPut=0; for (int i = CoinMax(numberSlacks_,internalPivotRow) ; i < numberU_; i++ ) { assert (!region[i]); CoinFactorizationDouble pivotValue = 0.0; //region[i]*pivotRegion[i]; //printf("Epv %g reg %g pr %g\n", // pivotValue,region[i],pivotRegion[i]); //pivotValue = region[i]; for (CoinBigIndex j= startColumn[i] ; j < startColumn[i]+numberInColumn[i]; j++ ) { int iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; if (iRow!=internalPivotRow) { pivotValue -= value * region[iRow]; } else { assert (!region[iRow]); pivotValue += value; if (deleteNow) element[j]=0.0; else deleted[nPut++]=j; } } if ( fabs ( pivotValue ) > tolerance ) { regionIndex[numberNonZero++] = i; region[i] = pivotValue; } else { region[i] = 0; } } if (!deleteNow) { deleted--; deleted[0]=nPut; } regionSparse->setNumElements(numberNonZero); } /* Updates part of column transpose (BTRANU) by column assumes index is sorted i.e. region is correct */ void CoinFactorization::updateColumnTransposeUByColumn ( CoinIndexedVector * regionSparse, int smallestIndex) const { //CoinIndexedVector temp = *regionSparse; //updateColumnTransposeUDensish(&temp,smallestIndex); double * COIN_RESTRICT region = regionSparse->denseVector(); int * COIN_RESTRICT regionIndex = regionSparse->getIndices(); double tolerance = zeroTolerance_; const CoinBigIndex *startColumn = startColumnU_.array(); const int *indexRow = indexRowU_.array(); const CoinFactorizationDouble *element = elementU_.array(); int numberNonZero = 0; const int *numberInColumn = numberInColumn_.array(); const CoinFactorizationDouble *pivotRegion = pivotRegion_.array(); for (int i = smallestIndex;i tolerance ) numberNonZero++; else region[i]=0.0; } } for (int i = CoinMax(numberSlacks_,smallestIndex) ; i < numberU_; i++ ) { CoinFactorizationDouble pivotValue = region[i]*pivotRegion[i]; //printf("pv %g reg %g pr %g\n", // pivotValue,region[i],pivotRegion[i]); pivotValue = region[i]; for (CoinBigIndex j= startColumn[i] ; j < startColumn[i]+numberInColumn[i]; j++ ) { int iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; pivotValue -= value * region[iRow]; } if ( fabs ( pivotValue ) > tolerance ) { regionIndex[numberNonZero++] = i; region[i] = pivotValue; } else { region[i] = 0; } } regionSparse->setNumElements(numberNonZero); //double * region2 = temp.denseVector(); //for (i=0;idenseVector ( ); #ifdef COIN_DEBUG regionSparse->checkClean(); #endif int last = numberRowsExtra_-1; const int *indexRow = indexRowR_; const CoinFactorizationDouble *element = elementR_; const CoinBigIndex * startColumn = startColumnR_.array()-numberRows_; //move using permute_ (stored in inverse fashion) const int * permute = permute_.array(); for (int i = last ; i >= numberRows_; i-- ) { int putRow = permute[i]; CoinFactorizationDouble pivotValue = region[i]; //zero out old permuted region[i] = 0.0; if ( pivotValue ) { for (CoinBigIndex j = startColumn[i]; j < startColumn[i+1]; j++ ) { CoinFactorizationDouble value = element[j]; int iRow = indexRow[j]; region[iRow] -= value * pivotValue; } region[putRow] = pivotValue; //putRow must have been zero before so put on list ?? //but can't catch up so will have to do L from end //unless we update lookBtran in replaceColumn - yes } } } // Updates part of column transpose (BTRANR) when sparse void CoinFactorization::updateColumnTransposeRSparse ( CoinIndexedVector * regionSparse ) const { double * COIN_RESTRICT region = regionSparse->denseVector ( ); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse->getNumElements ( ); double tolerance = zeroTolerance_; #ifdef COIN_DEBUG regionSparse->checkClean(); #endif int last = numberRowsExtra_-1; const int *indexRow = indexRowR_; const CoinFactorizationDouble *element = elementR_; const CoinBigIndex * startColumn = startColumnR_.array()-numberRows_; //move using permute_ (stored in inverse fashion) const int * permute = permute_.array(); // we can use sparse_ as temporary array int * COIN_RESTRICT spare = sparse_.array(); for (int i=0;i= numberRows_; i-- ) { int putRow = permute[i]; assert (putRow<=i); CoinFactorizationDouble pivotValue = region[i]; //zero out old permuted region[i] = 0.0; if ( pivotValue ) { for (CoinBigIndex j = startColumn[i]; j < startColumn[i+1]; j++ ) { CoinFactorizationDouble value = element[j]; int iRow = indexRow[j]; CoinFactorizationDouble oldValue = region[iRow]; CoinFactorizationDouble newValue = oldValue - value * pivotValue; if (oldValue) { if (newValue) region[iRow]=newValue; else region[iRow]=COIN_INDEXED_REALLY_TINY_ELEMENT; } else if (fabs(newValue)>tolerance) { region[iRow] = newValue; spare[iRow]=numberNonZero; regionIndex[numberNonZero++]=iRow; } } region[putRow] = pivotValue; // modify list int position=spare[i]; regionIndex[position]=putRow; spare[putRow]=position; } } regionSparse->setNumElements(numberNonZero); } // updateColumnTransposeR. Updates part of column (FTRANR) void CoinFactorization::updateColumnTransposeR ( CoinIndexedVector * regionSparse ) const { if (numberRowsExtra_==numberRows_) return; int numberNonZero = regionSparse->getNumElements ( ); if (numberNonZero) { if (numberNonZero < (sparseThreshold_<<2)||(!numberL_&&sparse_.array())) { updateColumnTransposeRSparse ( regionSparse ); if (collectStatistics_) btranCountAfterR_ += regionSparse->getNumElements(); } else { updateColumnTransposeRDensish ( regionSparse ); // we have lost indices // make sure won't try and go sparse again if (collectStatistics_) btranCountAfterR_ += CoinMin((numberNonZero<<1),numberRows_); regionSparse->setNumElements (numberRows_+1); } } } // makes a row copy of L void CoinFactorization::goSparse ( ) { if (!sparseThreshold_) { if (numberRows_>300) { if (numberRows_<10000) { sparseThreshold_=CoinMin(numberRows_/6,500); sparseThreshold2_=numberRows_>>2; //sparseThreshold2_=sparseThreshold_; } else { sparseThreshold_=1000; sparseThreshold2_=numberRows_>>2; sparseThreshold_=500; sparseThreshold2_=CoinMax(sparseThreshold_,numberRows_>>3); //sparseThreshold2_=sparseThreshold_; } //printf("sparseThreshold %d threshold2 %d - numberDense %d\n", // sparseThreshold_,sparseThreshold2_,numberDense_); } else { sparseThreshold_=0; sparseThreshold2_=0; } } else { if (!sparseThreshold_&&numberRows_>400) { sparseThreshold_=CoinMin((numberRows_-300)/9,1000); } sparseThreshold2_=sparseThreshold_; } if (!sparseThreshold_) return; // allow for stack, list, next and char map of mark int nRowIndex = (maximumRowsExtra_+CoinSizeofAsInt(int)-1)/ CoinSizeofAsInt(char); int nInBig = static_cast(sizeof(CoinBigIndex)/sizeof(int)); assert (nInBig>=1); sparse_.conditionalNew( (2+nInBig)*maximumRowsExtra_ + nRowIndex ); // zero out mark memset(sparse_.array()+(2+nInBig)*maximumRowsExtra_, 0,maximumRowsExtra_*sizeof(char)); elementByRowL_.conditionalDelete(); indexColumnL_.conditionalDelete(); startRowL_.conditionalNew(numberRows_+1); if (lengthAreaL_) { elementByRowL_.conditionalNew(lengthAreaL_); indexColumnL_.conditionalNew(lengthAreaL_); } // counts CoinBigIndex * COIN_RESTRICT startRowL = startRowL_.array(); CoinZeroN(startRowL,numberRows_); const CoinBigIndex * startColumnL = startColumnL_.array(); CoinFactorizationDouble * COIN_RESTRICT elementL = elementL_.array(); const int * indexRowL = indexRowL_.array(); for (int i=baseL_;i=baseL_;i--) { for (CoinBigIndex j=startColumnL[i];j0&&sparseThreshold_) { sparseThreshold_=value; sparseThreshold2_= sparseThreshold_; } else if (!value&&sparseThreshold_) { // delete copy sparseThreshold_=0; sparseThreshold2_= 0; elementByRowL_.conditionalDelete(); startRowL_.conditionalDelete(); indexColumnL_.conditionalDelete(); sparse_.conditionalDelete(); } else if (value>0&&!sparseThreshold_) { if (value>1) sparseThreshold_=value; else sparseThreshold_=0; sparseThreshold2_= sparseThreshold_; goSparse(); } } void CoinFactorization::maximumPivots ( int value ) { if (value>0) { maximumPivots_=value; } } void CoinFactorization::messageLevel ( int value ) { if (value>0&&value<16) { messageLevel_=value; } } void CoinFactorization::pivotTolerance ( double value ) { if (value>0.0&&value<=1.0) { //if (value0.0&&value<1.0) { zeroTolerance_=value; } } #ifndef COIN_FAST_CODE void CoinFactorization::slackValue ( double value ) { if (value>=0.0) { slackValue_=1.0; } else { slackValue_=-1.0; } } #endif // Reset all sparsity etc statistics void CoinFactorization::resetStatistics() { #if 0 collectStatistics_=false; #endif /// Below are all to collect ftranCountInput_=0.0; ftranCountAfterL_=0.0; ftranCountAfterR_=0.0; ftranCountAfterU_=0.0; btranCountInput_=0.0; btranCountAfterU_=0.0; btranCountAfterR_=0.0; btranCountAfterL_=0.0; /// We can roll over factorizations numberFtranCounts_=0; numberBtranCounts_=0; /// While these are averages collected over last ftranAverageAfterL_=0.0; ftranAverageAfterR_=0.0; ftranAverageAfterU_=0.0; btranAverageAfterU_=0.0; btranAverageAfterR_=0.0; btranAverageAfterL_=0.0; } /* getColumnSpaceIterate. Gets space for one extra U element in Column may have to do compression (returns true) also moves existing vector. Returns -1 if no memory or where element was put Used by replaceRow (turns off R version) */ CoinBigIndex CoinFactorization::getColumnSpaceIterate ( int iColumn, double value, int iRow) { if (numberInColumnPlus_.array()) { numberInColumnPlus_.conditionalDelete(); } int * COIN_RESTRICT numberInRow = numberInRow_.array(); int * COIN_RESTRICT numberInColumn = numberInColumn_.array(); int * COIN_RESTRICT nextColumn = nextColumn_.array(); int * COIN_RESTRICT lastColumn = lastColumn_.array(); int number = numberInColumn[iColumn]; int iNext=nextColumn[iColumn]; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); CoinBigIndex * COIN_RESTRICT startRowU = startRowU_.array(); CoinBigIndex space = startColumnU[iNext]-startColumnU[iColumn]; CoinBigIndex put; CoinBigIndex * COIN_RESTRICT convertRowToColumnU = convertRowToColumnU_.array(); int * COIN_RESTRICT indexColumnU = indexColumnU_.array(); CoinFactorizationDouble * COIN_RESTRICT elementU = elementU_.array(); int * COIN_RESTRICT indexRowU = indexRowU_.array(); if ( space < number + 1 ) { //see if it can go in at end if (lengthAreaU_-startColumnU[maximumColumnsExtra_]=number+1) { int next = nextColumn[iColumn]; int last = lastColumn[iColumn]; //out nextColumn[last] = next; lastColumn[next] = last; put = startColumnU[maximumColumnsExtra_]; //in at end last = lastColumn[maximumColumnsExtra_]; nextColumn[last] = iColumn; lastColumn[maximumColumnsExtra_] = iColumn; lastColumn[iColumn] = last; nextColumn[iColumn] = maximumColumnsExtra_; //move CoinBigIndex get = startColumnU[iColumn]; startColumnU[iColumn] = put; int i = 0; for (i=0 ; i < number; i ++ ) { CoinFactorizationDouble value = elementU[get]; int iRow=indexRowU[get++]; if (value) { elementU[put]= value; int n=numberInRow[iRow]; CoinBigIndex start = startRowU[iRow]; CoinBigIndex j; for (j=start;j (put + 4) ,lengthAreaU_); } else { // no room put=-1; } } else { // just slot in put=startColumnU[iColumn]+numberInColumn[iColumn]; int n=numberInRow[iRow]; CoinBigIndex start = startRowU[iRow]; CoinBigIndex j; for (j=start;j1.0e-3) printf("column %d, old value %g new %g (el %g, piv %g)\n",jColumn,oldValue, newValue,elements[i],pivotRegion[jColumn]); } } for (i=0;i=0) printf("current column %d not in new\n",ind[i]); } assert (numberNow==iNumberInRow); } assert (numberInColumn[whichRow]==0); assert (pivotRegion[whichRow]==1.0); CoinBigIndex space; int returnCode=0; space = startRowU[next] - (start+iNumberInRow); if ( space < 0 ) { if (!getRowSpaceIterate ( whichRow, iNumberInRow)) returnCode=3; } //return 0; if (!returnCode) { int * indexColumnU = indexColumnU_.array(); numberInRow[whichRow]=iNumberInRow; start = startRowU[whichRow]; int i; for (i=0;iwhichRow); CoinFactorizationDouble value = elements[i]*pivotRegion[iColumn]; #if 0 int k; bool found=false; for (k=startColumnU[iColumn];k=0) { convertRowToColumnU[start+i] = iWhere; } else { returnCode=3; break; } #if 0 } else { convertRowToColumnU[start+i] = k; } #endif } } return returnCode; } // Takes out all entries for given rows void CoinFactorization::emptyRows(int numberToEmpty, const int which[]) { int i; int * delRow = new int [maximumRowsExtra_]; int * indexRowU = indexRowU_.array(); #ifndef NDEBUG CoinFactorizationDouble * pivotRegion = pivotRegion_.array(); #endif for (i=0;idenseVector ( ); int * regionIndex = regionSparse->getIndices(); double tolerance = zeroTolerance_; const CoinBigIndex *startColumn = startColumnU_.array()+numberRows_; const int *indexRow = indexRowU_.array(); const CoinFactorizationDouble *element = elementU_.array(); int numberNonZero = regionSparse->getNumElements(); int i; #ifdef COIN_DEBUG for (i=0;i=0&&iRow tolerance ) { for (CoinBigIndex j= startColumn[i] ; j < startColumn[i+1]; j++ ) { int iRow = indexRow[j]; CoinFactorizationDouble oldValue = region[iRow]; CoinFactorizationDouble value = oldValue - pivotValue*element[j]; if (!oldValue) { if (fabs(value)>tolerance) { region[iRow]=value; regionIndex[numberNonZero++]=iRow; } } else { if (fabs(value)>tolerance) { region[iRow]=value; } else { region[iRow]=COIN_INDEXED_REALLY_TINY_ELEMENT; } } } pivotValue *= pivotRegion[i]; region[pivotRow]=pivotValue; } else if (pivotValue) { region[pivotRow]=COIN_INDEXED_REALLY_TINY_ELEMENT; } } } regionSparse->setNumElements ( numberNonZero ); } // Updates part of column transpose PFI (BTRAN), void CoinFactorization::updateColumnTransposePFI ( CoinIndexedVector * regionSparse) const { double *region = regionSparse->denseVector ( ); int numberNonZero = regionSparse->getNumElements(); int *index = regionSparse->getIndices ( ); int i; #ifdef COIN_DEBUG for (i=0;i=0&&iRow=0; i-- ) { int pivotRow = pivotColumn[i]; CoinFactorizationDouble pivotValue = region[pivotRow]*pivotRegion[i]; for (CoinBigIndex j= startColumn[i] ; j < startColumn[i+1]; j++ ) { int iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; pivotValue -= value * region[iRow]; } //pivotValue *= pivotRegion[i]; if ( fabs ( pivotValue ) > tolerance ) { if (!region[pivotRow]) index[numberNonZero++] = pivotRow; region[pivotRow] = pivotValue; } else { if (region[pivotRow]) region[pivotRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } //set counts regionSparse->setNumElements ( numberNonZero ); } /* Replaces one Column to basis for PFI returns 0=OK, 1=Probably OK, 2=singular, 3=no room Not sure what checkBeforeModifying means for PFI. */ int CoinFactorization::replaceColumnPFI ( CoinIndexedVector * regionSparse, int pivotRow, double alpha) { CoinBigIndex *startColumn=startColumnU_.array()+numberRows_; int *indexRow=indexRowU_.array(); CoinFactorizationDouble *element=elementU_.array(); CoinFactorizationDouble * pivotRegion = pivotRegion_.array()+numberRows_; // This has incoming column const double *region = regionSparse->denseVector ( ); const int * index = regionSparse->getIndices(); int numberNonZero = regionSparse->getNumElements(); int iColumn = numberPivots_; if (!iColumn) startColumn[0]=startColumn[maximumColumnsExtra_]; CoinBigIndex start = startColumn[iColumn]; //return at once if too many iterations if ( numberPivots_ >= maximumPivots_ ) { return 5; } if ( lengthAreaU_ - ( start + numberNonZero ) < 0) { return 3; } int i; if (numberPivots_) { if (fabs(alpha)<1.0e-5) { if (fabs(alpha)<1.0e-7) return 2; else return 1; } } else { if (fabs(alpha)<1.0e-8) return 2; } CoinFactorizationDouble pivotValue = 1.0/alpha; pivotRegion[iColumn]=pivotValue; double tolerance = zeroTolerance_; const int * pivotColumn = pivotColumn_.array(); // Operations done before permute back if (regionSparse->packedMode()) { for ( i = 0; i < numberNonZero; i++ ) { int iRow = index[i]; if (iRow!=pivotRow) { if ( fabs ( region[i] ) > tolerance ) { indexRow[start]=pivotColumn[iRow]; element[start++]=region[i]*pivotValue; } } } } else { for ( i = 0; i < numberNonZero; i++ ) { int iRow = index[i]; if (iRow!=pivotRow) { if ( fabs ( region[iRow] ) > tolerance ) { indexRow[start]=pivotColumn[iRow]; element[start++]=region[iRow]*pivotValue; } } } } numberPivots_++; numberNonZero=start-startColumn[iColumn]; startColumn[numberPivots_]=start; totalElements_ += numberNonZero; int * pivotColumn2 = pivotColumn_.array()+numberRows_; pivotColumn2[iColumn]=pivotColumn[pivotRow]; return 0; } // = CoinFactorization & CoinFactorization::operator = ( const CoinFactorization & other ) { if (this != &other) { gutsOfDestructor(2); gutsOfInitialize(3); persistenceFlag_=other.persistenceFlag_; gutsOfCopy(other); } return *this; } void CoinFactorization::gutsOfCopy(const CoinFactorization &other) { elementU_.allocate(other.elementU_, other.lengthAreaU_ *CoinSizeofAsInt(CoinFactorizationDouble)); indexRowU_.allocate(other.indexRowU_, other.lengthAreaU_*CoinSizeofAsInt(int) ); elementL_.allocate(other.elementL_, other.lengthAreaL_*CoinSizeofAsInt(CoinFactorizationDouble) ); indexRowL_.allocate(other.indexRowL_, other.lengthAreaL_*CoinSizeofAsInt(int) ); startColumnL_.allocate(other.startColumnL_,(other.numberRows_ + 1)*CoinSizeofAsInt(CoinBigIndex) ); int extraSpace; if (other.numberInColumnPlus_.array()) { extraSpace = other.maximumPivots_ + 1 + other.maximumColumnsExtra_ + 1; } else { extraSpace = other.maximumPivots_ + 1 ; } startColumnR_.allocate(other.startColumnR_,extraSpace*CoinSizeofAsInt(CoinBigIndex)); pivotRegion_.allocate(other.pivotRegion_, (other.maximumRowsExtra_ + 1 )*CoinSizeofAsInt(CoinFactorizationDouble)); permuteBack_.allocate(other.permuteBack_,(other.maximumRowsExtra_ + 1)*CoinSizeofAsInt(int)); permute_.allocate(other.permute_,(other.maximumRowsExtra_ + 1)*CoinSizeofAsInt(int)); pivotColumnBack_.allocate(other.pivotColumnBack_,(other.maximumRowsExtra_ + 1)*CoinSizeofAsInt(int)); firstCount_.allocate(other.firstCount_,(other.maximumRowsExtra_ + 1)*CoinSizeofAsInt(int)); startColumnU_.allocate(other.startColumnU_, (other.maximumColumnsExtra_ + 1 )*CoinSizeofAsInt(CoinBigIndex)); numberInColumn_.allocate(other.numberInColumn_, (other.maximumColumnsExtra_ + 1 )*CoinSizeofAsInt(int)); pivotColumn_.allocate(other.pivotColumn_,(other.maximumColumnsExtra_ + 1)*CoinSizeofAsInt(int)); nextColumn_.allocate(other.nextColumn_, (other.maximumColumnsExtra_ + 1 )*CoinSizeofAsInt(int)); lastColumn_.allocate(other.lastColumn_, (other.maximumColumnsExtra_ + 1 )*CoinSizeofAsInt(int)); indexColumnU_.allocate(other.indexColumnU_, other.lengthAreaU_*CoinSizeofAsInt(int) ); nextRow_.allocate(other.nextRow_,(other.maximumRowsExtra_ + 1)*CoinSizeofAsInt(int)); lastRow_.allocate( other.lastRow_,(other.maximumRowsExtra_ + 1 )*CoinSizeofAsInt(int)); const CoinBigIndex * convertUOther = other.convertRowToColumnU_.array(); #if COIN_ONE_ETA_COPY if (convertUOther) { #endif convertRowToColumnU_.allocate(other.convertRowToColumnU_, other.lengthAreaU_*CoinSizeofAsInt(CoinBigIndex) ); startRowU_.allocate(other.startRowU_,(other.maximumRowsExtra_ + 1)*CoinSizeofAsInt(CoinBigIndex)); numberInRow_.allocate(other.numberInRow_, (other.maximumRowsExtra_ + 1 )*CoinSizeofAsInt(int)); #if COIN_ONE_ETA_COPY } #endif if (other.sparseThreshold_) { elementByRowL_.allocate(other.elementByRowL_, other.lengthAreaL_ ); indexColumnL_.allocate(other.indexColumnL_, other.lengthAreaL_ ); startRowL_.allocate(other.startRowL_,other.numberRows_+1); } numberTrials_ = other.numberTrials_; biggerDimension_ = other.biggerDimension_; relaxCheck_ = other.relaxCheck_; numberSlacks_ = other.numberSlacks_; numberU_ = other.numberU_; maximumU_=other.maximumU_; lengthU_ = other.lengthU_; lengthAreaU_ = other.lengthAreaU_; numberL_ = other.numberL_; baseL_ = other.baseL_; lengthL_ = other.lengthL_; lengthAreaL_ = other.lengthAreaL_; numberR_ = other.numberR_; lengthR_ = other.lengthR_; lengthAreaR_ = other.lengthAreaR_; pivotTolerance_ = other.pivotTolerance_; zeroTolerance_ = other.zeroTolerance_; #ifndef COIN_FAST_CODE slackValue_ = other.slackValue_; #endif areaFactor_ = other.areaFactor_; numberRows_ = other.numberRows_; numberRowsExtra_ = other.numberRowsExtra_; maximumRowsExtra_ = other.maximumRowsExtra_; numberColumns_ = other.numberColumns_; numberColumnsExtra_ = other.numberColumnsExtra_; maximumColumnsExtra_ = other.maximumColumnsExtra_; maximumPivots_=other.maximumPivots_; numberGoodU_ = other.numberGoodU_; numberGoodL_ = other.numberGoodL_; numberPivots_ = other.numberPivots_; messageLevel_ = other.messageLevel_; totalElements_ = other.totalElements_; factorElements_ = other.factorElements_; status_ = other.status_; doForrestTomlin_ = other.doForrestTomlin_; #if 0 collectStatistics_=other.collectStatistics_; #endif ftranCountInput_=other.ftranCountInput_; ftranCountAfterL_=other.ftranCountAfterL_; ftranCountAfterR_=other.ftranCountAfterR_; ftranCountAfterU_=other.ftranCountAfterU_; btranCountInput_=other.btranCountInput_; btranCountAfterU_=other.btranCountAfterU_; btranCountAfterR_=other.btranCountAfterR_; btranCountAfterL_=other.btranCountAfterL_; numberFtranCounts_=other.numberFtranCounts_; numberBtranCounts_=other.numberBtranCounts_; ftranAverageAfterL_=other.ftranAverageAfterL_; ftranAverageAfterR_=other.ftranAverageAfterR_; ftranAverageAfterU_=other.ftranAverageAfterU_; btranAverageAfterU_=other.btranAverageAfterU_; btranAverageAfterR_=other.btranAverageAfterR_; btranAverageAfterL_=other.btranAverageAfterL_; biasLU_=other.biasLU_; sparseThreshold_=other.sparseThreshold_; sparseThreshold2_=other.sparseThreshold2_; CoinBigIndex space = lengthAreaL_ - lengthL_; numberDense_ = other.numberDense_; denseThreshold_=other.denseThreshold_; if (numberDense_) { denseArea_ = new double [numberDense_*numberDense_]; denseAreaAddress_ = denseArea_; CoinMemcpyN(other.denseAreaAddress_, numberDense_*numberDense_,denseAreaAddress_); densePermute_ = new int [numberDense_]; CoinMemcpyN(other.densePermute_, numberDense_,densePermute_); } lengthAreaR_ = space; elementR_ = elementL_.array() + lengthL_; indexRowR_ = indexRowL_.array() + lengthL_; workArea_ = other.workArea_; workArea2_ = other.workArea2_; //now copy everything //assuming numberRowsExtra==numberColumnsExtra if (numberRowsExtra_) { if (convertUOther) { CoinMemcpyN ( other.startRowU_.array(), numberRowsExtra_ + 1, startRowU_.array() ); CoinMemcpyN ( other.numberInRow_.array(), numberRowsExtra_ + 1, numberInRow_.array() ); startRowU_.array()[maximumRowsExtra_] = other.startRowU_.array()[maximumRowsExtra_]; } CoinMemcpyN ( other.pivotRegion_.array(), numberRowsExtra_ , pivotRegion_.array() ); CoinMemcpyN ( other.permuteBack_.array(), numberRowsExtra_ + 1, permuteBack_.array() ); CoinMemcpyN ( other.permute_.array(), numberRowsExtra_ + 1, permute_.array() ); CoinMemcpyN ( other.pivotColumnBack_.array(), numberRowsExtra_ + 1, pivotColumnBack_.array() ); CoinMemcpyN ( other.firstCount_.array(), numberRowsExtra_ + 1, firstCount_.array() ); CoinMemcpyN ( other.startColumnU_.array(), numberRowsExtra_ + 1, startColumnU_.array() ); CoinMemcpyN ( other.numberInColumn_.array(), numberRowsExtra_ + 1, numberInColumn_.array() ); CoinMemcpyN ( other.pivotColumn_.array(), numberRowsExtra_ + 1, pivotColumn_.array() ); CoinMemcpyN ( other.nextColumn_.array(), numberRowsExtra_ + 1, nextColumn_.array() ); CoinMemcpyN ( other.lastColumn_.array(), numberRowsExtra_ + 1, lastColumn_.array() ); CoinMemcpyN ( other.startColumnR_.array() , numberRowsExtra_ - numberColumns_ + 1, startColumnR_.array() ); //extra one at end startColumnU_.array()[maximumColumnsExtra_] = other.startColumnU_.array()[maximumColumnsExtra_]; nextColumn_.array()[maximumColumnsExtra_] = other.nextColumn_.array()[maximumColumnsExtra_]; lastColumn_.array()[maximumColumnsExtra_] = other.lastColumn_.array()[maximumColumnsExtra_]; CoinMemcpyN ( other.nextRow_.array(), numberRowsExtra_ + 1, nextRow_.array() ); CoinMemcpyN ( other.lastRow_.array(), numberRowsExtra_ + 1, lastRow_.array() ); nextRow_.array()[maximumRowsExtra_] = other.nextRow_.array()[maximumRowsExtra_]; lastRow_.array()[maximumRowsExtra_] = other.lastRow_.array()[maximumRowsExtra_]; } CoinMemcpyN ( other.elementR_, lengthR_, elementR_ ); CoinMemcpyN ( other.indexRowR_, lengthR_, indexRowR_ ); //row and column copies of U /* as elements of U may have been zeroed but column counts zero copy all elements */ const CoinBigIndex * startColumnU = startColumnU_.array(); const int * numberInColumn = numberInColumn_.array(); #ifndef NDEBUG int maxU=0; for (int iRow = 0; iRow < numberRowsExtra_; iRow++ ) { CoinBigIndex start = startColumnU[iRow]; int numberIn = numberInColumn[iRow]; maxU = CoinMax(maxU,start+numberIn); } assert (maximumU_>=maxU); #endif CoinMemcpyN ( other.elementU_.array() , maximumU_, elementU_.array() ); #if COIN_ONE_ETA_COPY if (convertUOther) { #endif const int * indexColumnUOther = other.indexColumnU_.array(); CoinBigIndex * convertU = convertRowToColumnU_.array(); int * indexColumnU = indexColumnU_.array(); const CoinBigIndex * startRowU = startRowU_.array(); const int * numberInRow = numberInRow_.array(); for (int iRow = 0; iRow < numberRowsExtra_; iRow++ ) { //row CoinBigIndex start = startRowU[iRow]; int numberIn = numberInRow[iRow]; CoinMemcpyN ( indexColumnUOther + start, numberIn, indexColumnU + start ); CoinMemcpyN (convertUOther + start , numberIn, convertU + start ); } #if COIN_ONE_ETA_COPY } #endif const int * indexRowUOther = other.indexRowU_.array(); int * indexRowU = indexRowU_.array(); for (int iRow = 0; iRow < numberRowsExtra_; iRow++ ) { //column CoinBigIndex start = startColumnU[iRow]; int numberIn = numberInColumn[iRow]; CoinMemcpyN ( indexRowUOther + start, numberIn, indexRowU + start ); } // L is contiguous if (numberRows_) CoinMemcpyN ( other.startColumnL_.array(), numberRows_ + 1, startColumnL_.array() ); CoinMemcpyN ( other.elementL_.array(), lengthL_, elementL_.array() ); CoinMemcpyN ( other.indexRowL_.array(), lengthL_, indexRowL_.array() ); if (other.sparseThreshold_) { goSparse(); } } // See if worth going sparse void CoinFactorization::checkSparse() { // See if worth going sparse and when if (numberFtranCounts_>100) { ftranCountInput_= CoinMax(ftranCountInput_,1.0); ftranAverageAfterL_ = CoinMax(ftranCountAfterL_/ftranCountInput_,1.0); ftranAverageAfterR_ = CoinMax(ftranCountAfterR_/ftranCountAfterL_,1.0); ftranAverageAfterU_ = CoinMax(ftranCountAfterU_/ftranCountAfterR_,1.0); if (btranCountInput_&&btranCountAfterU_&&btranCountAfterR_) { btranAverageAfterU_ = CoinMax(btranCountAfterU_/btranCountInput_,1.0); btranAverageAfterR_ = CoinMax(btranCountAfterR_/btranCountAfterU_,1.0); btranAverageAfterL_ = CoinMax(btranCountAfterL_/btranCountAfterR_,1.0); } else { // we have not done any useful btrans (values pass?) btranAverageAfterU_ = 1.0; btranAverageAfterR_ = 1.0; btranAverageAfterL_ = 1.0; } } // scale back ftranCountInput_ *= 0.8; ftranCountAfterL_ *= 0.8; ftranCountAfterR_ *= 0.8; ftranCountAfterU_ *= 0.8; btranCountInput_ *= 0.8; btranCountAfterU_ *= 0.8; btranCountAfterR_ *= 0.8; btranCountAfterL_ *= 0.8; } // Condition number - product of pivots after factorization double CoinFactorization::conditionNumber() const { double condition = 1.0; const CoinFactorizationDouble * pivotRegion = pivotRegion_.array(); for (int i=0;idenseVector ( ); element = elementU_.array(); //get entries in row (pivot not stored) int numberNonZero = 0; int * COIN_RESTRICT indexColumn = indexColumnU_.array(); CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnU_.array(); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinBigIndex * COIN_RESTRICT startRow = startRowU_.array(); CoinBigIndex start=0; CoinBigIndex end=0; assert (convertRowToColumn); start = startRow[realPivotRow]; end = start + numberInRow[realPivotRow]; int smallestIndex=numberRowsExtra_; for (CoinBigIndex i = start; i < end ; i ++ ) { int iColumn = indexColumn[i]; smallestIndex = CoinMin(smallestIndex,iColumn); CoinBigIndex j = convertRowToColumn[i]; region[iColumn] = element[j]; regionIndex[numberNonZero++] = iColumn; } //do BTRAN - finding first one to use regionSparse->setNumElements ( numberNonZero ); updateColumnTransposeU ( regionSparse, smallestIndex ); numberNonZero = regionSparse->getNumElements ( ); CoinFactorizationDouble saveFromU = 0.0; CoinBigIndex startU = startColumnU[numberColumnsExtra_]; int * COIN_RESTRICT indexU = &indexRowU_.array()[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU = &elementU_.array()[startU]; double tolerance = zeroTolerance_; int number = numberInColumn[numberColumnsExtra_]; for (CoinBigIndex i = 0; i < number; i++ ) { int iRow = indexU[i]; if ( fabs ( elementU[i] ) > tolerance ) { if ( iRow != realPivotRow ) { saveFromU -= elementU[i] * region[iRow]; } else { saveFromU += elementU[i]; } } } return saveFromU; } /* Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update in vector */ double CoinFactorization::checkReplacePart1 ( CoinIndexedVector * regionSparse, CoinIndexedVector * partialUpdate, int pivotRow) { CoinFactorizationDouble * COIN_RESTRICT element; int * COIN_RESTRICT numberInRow = numberInRow_.array(); int realPivotRow; realPivotRow = pivotColumn_.array()[pivotRow]; //zeroed out region double * COIN_RESTRICT region = regionSparse->denseVector ( ); element = elementU_.array(); //get entries in row (pivot not stored) int numberNonZero = 0; int * COIN_RESTRICT indexColumn = indexColumnU_.array(); CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnU_.array(); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinBigIndex * COIN_RESTRICT startRow = startRowU_.array(); CoinBigIndex start=0; CoinBigIndex end=0; assert (convertRowToColumn); start = startRow[realPivotRow]; end = start + numberInRow[realPivotRow]; int smallestIndex=numberRowsExtra_; for (CoinBigIndex i = start; i < end ; i ++ ) { int iColumn = indexColumn[i]; smallestIndex = CoinMin(smallestIndex,iColumn); CoinBigIndex j = convertRowToColumn[i]; region[iColumn] = element[j]; regionIndex[numberNonZero++] = iColumn; } //do BTRAN - finding first one to use regionSparse->setNumElements ( numberNonZero ); updateColumnTransposeU ( regionSparse, smallestIndex ); numberNonZero = regionSparse->getNumElements ( ); CoinFactorizationDouble saveFromU = 0.0; double tolerance = zeroTolerance_; int * COIN_RESTRICT indexU2 = partialUpdate->getIndices(); CoinFactorizationDouble * COIN_RESTRICT elementU2 = partialUpdate->denseVector(); int numberInColumnU2 = partialUpdate->getNumElements(); for (CoinBigIndex i = 0; i < numberInColumnU2; i++ ) { int iRow = indexU2[i]; if ( fabs ( elementU2[i] ) > tolerance ) { if ( iRow != realPivotRow ) { saveFromU -= elementU2[i] * region[iRow]; } else { saveFromU += elementU2[i]; } } } if ( lengthU_ + numberInColumnU2 >= lengthAreaU_ ) { //not enough room saveFromU=0.0; } if ( lengthR_+numberNonZero >= lengthAreaR_ ) { //not enough room saveFromU=0.0; } return saveFromU; } /* Checks if can replace one Column in basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */ int CoinFactorization::checkReplacePart2 ( int pivotRow, double btranAlpha, double ftranAlpha, double ftAlpha, double acceptablePivot) { //return at once if too many iterations if ( numberColumnsExtra_ >= maximumColumnsExtra_ ) { return 5; } if ( lengthR_+numberRows_ >= lengthAreaR_ ) { //not enough room return 3; } pivotRow=pivotColumn_.array()[pivotRow]; const CoinFactorizationDouble *pivotRegion = pivotRegion_.array(); CoinFactorizationDouble oldPivot = pivotRegion[pivotRow]; // for accuracy check CoinFactorizationDouble pivotCheck = ftranAlpha / oldPivot; //check accuracy int status = checkPivot(ftAlpha,pivotCheck); if (status==1&&!numberPivots_) { printf("check status not ok\n"); status=2; } return status; } /* Replaces one Column to basis, partial update already in U */ void CoinFactorization::replaceColumnPart3 ( CoinIndexedVector * regionSparse, int pivotRow, double alpha ) { assert (numberU_<=numberRowsExtra_); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); CoinBigIndex * COIN_RESTRICT startColumn; int * COIN_RESTRICT indexRow; CoinFactorizationDouble * COIN_RESTRICT element; int * COIN_RESTRICT numberInRow = numberInRow_.array(); int * COIN_RESTRICT numberInColumn = numberInColumn_.array(); int * COIN_RESTRICT numberInColumnPlus = numberInColumnPlus_.array(); int realPivotRow; realPivotRow = pivotColumn_.array()[pivotRow]; //Filled in region double * COIN_RESTRICT region = regionSparse->denseVector ( ); element = elementU_.array(); //take out old pivot column totalElements_ -= numberInColumn[realPivotRow]; CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegion_.array(); pivotRegion[realPivotRow] = 0.0; CoinBigIndex saveEnd = startColumnU[realPivotRow] + numberInColumn[realPivotRow]; #ifdef CLP_FACTORIZATION_INSTRUMENT currentTakeoutU += numberInColumn[realPivotRow]; currentTakeoutU += numberInRow[realPivotRow]; #endif // not necessary at present - but take no chances for future numberInColumn[realPivotRow] = 0; //get entries in row (pivot not stored) int numberNonZero = 0; int * COIN_RESTRICT indexColumn = indexColumnU_.array(); CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnU_.array(); int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinBigIndex * COIN_RESTRICT startRow = startRowU_.array(); CoinBigIndex start=0; CoinBigIndex end=0; start = startRow[realPivotRow]; end = start + numberInRow[realPivotRow]; for (CoinBigIndex i = start; i < end ; i ++ ) { CoinBigIndex j = convertRowToColumn[i]; element[j] = 0.0; } numberNonZero = regionSparse->getNumElements ( ); CoinBigIndex startU = startColumnU[numberColumnsExtra_]; int * COIN_RESTRICT indexU = &indexRowU_.array()[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU = &elementU_.array()[startU]; // Now zero out column of U //take out old pivot column for (CoinBigIndex i = startColumnU[realPivotRow]; i < saveEnd ; i ++ ) { element[i] = 0.0; } //zero out pivot Row (before or after?) //add to R startColumn = startColumnR_.array(); indexRow = indexRowR_; element = elementR_; CoinBigIndex l = lengthR_; int number = numberR_; startColumn[number] = l; //for luck and first time number++; startColumn[number] = l + numberNonZero; numberR_ = number; lengthR_ = l + numberNonZero; totalElements_ += numberNonZero; assert ( lengthR_ < lengthAreaR_ ); for (CoinBigIndex i = 0; i < numberNonZero; i++ ) { int iRow = regionIndex[i]; indexRow[l] = iRow; element[l] = region[iRow]; l++; } int * nextRow; int * lastRow; int next; int last; //take out row nextRow = nextRow_.array(); lastRow = lastRow_.array(); next = nextRow[realPivotRow]; last = lastRow[realPivotRow]; nextRow[last] = next; lastRow[next] = last; numberInRow[realPivotRow]=0; //do permute permute_.array()[numberRowsExtra_] = realPivotRow; // and other way permuteBack_.array()[realPivotRow] = numberRowsExtra_; permuteBack_.array()[numberRowsExtra_] = -1;; //and for safety permute_.array()[numberRowsExtra_ + 1] = 0; pivotColumn_.array()[pivotRow] = numberRowsExtra_; pivotColumnBack()[numberRowsExtra_] = pivotRow; startColumn = startColumnU; indexRow = indexRowU_.array(); element = elementU_.array(); numberU_++; number = numberInColumn[numberColumnsExtra_]; totalElements_ += number; lengthU_ += number; double saveFromU = 0.0; //put in pivot //add row counts for (CoinBigIndex i = 0; i < number; i++ ) { int iRow = indexU[i]; if ( iRow != realPivotRow ) { int next = nextRow[iRow]; int iNumberInRow = numberInRow[iRow]; CoinBigIndex space; CoinBigIndex put = startRow[iRow] + iNumberInRow; space = startRow[next] - put; if ( space <= 0 ) { getRowSpaceIterate ( iRow, iNumberInRow + 4 ); put = startRow[iRow] + iNumberInRow; } indexColumn[put] = numberColumnsExtra_; convertRowToColumn[put] = i + startU; numberInRow[iRow] = iNumberInRow + 1; saveFromU = saveFromU - elementU[i] * region[iRow]; } else { //zero out and save saveFromU += elementU[i]; elementU[i] = 0.0; } } //in at end last = lastRow[maximumRowsExtra_]; nextRow[last] = numberRowsExtra_; lastRow[maximumRowsExtra_] = numberRowsExtra_; lastRow[numberRowsExtra_] = last; nextRow[numberRowsExtra_] = maximumRowsExtra_; startRow[numberRowsExtra_] = startRow[maximumRowsExtra_]; numberInRow[numberRowsExtra_] = 0; //column in at beginning (as empty) int * COIN_RESTRICT nextColumn = nextColumn_.array(); int * COIN_RESTRICT lastColumn = lastColumn_.array(); next = nextColumn[maximumColumnsExtra_]; lastColumn[next] = numberColumnsExtra_; nextColumn[maximumColumnsExtra_] = numberColumnsExtra_; nextColumn[numberColumnsExtra_] = next; lastColumn[numberColumnsExtra_] = maximumColumnsExtra_; CoinFactorizationDouble pivotValue = 1.0 / saveFromU; pivotRegion[numberRowsExtra_] = pivotValue; //modify by pivot for (CoinBigIndex i = 0; i < number; i++ ) { elementU[i] *= pivotValue; } maximumU_ = CoinMax(maximumU_,startU+number); numberRowsExtra_++; numberColumnsExtra_++; numberGoodU_++; numberPivots_++; if ( numberRowsExtra_ > numberRows_ + 50 ) { CoinBigIndex extra = factorElements_ >> 1; if ( numberRowsExtra_ > numberRows_ + 100 + numberRows_ / 500 ) { if ( extra < 2 * numberRows_ ) { extra = 2 * numberRows_; } } else { if ( extra < 5 * numberRows_ ) { extra = 5 * numberRows_; } } CoinBigIndex added = totalElements_ - factorElements_; if ( added > extra && added > ( factorElements_ ) << 1 && 3*totalElements_ > 2*(lengthAreaU_+lengthAreaL_)) { //status = 3; //if ( messageLevel_ & 4 ) { std::cout << "Factorization has "<< totalElements_ << ", basis had " << factorElements_ <iRow); next = nextColumn[iRow]; CoinBigIndex space; if (next!=maximumColumnsExtra_) space = startR[next]-startR[iRow]; else space = lengthAreaR_-startR[iRow]; int numberInR = numberInColumnPlus[iRow]; if (space>numberInR) { // there is space CoinBigIndex put=startR[iRow]+numberInR; numberInColumnPlus[iRow]=numberInR+1; indexRowR[put]=pivotRowNew; elementR[put]=region[iRow]; //add 4 for luck if (next==maximumColumnsExtra_) startR[maximumColumnsExtra_] = CoinMin(static_cast (put + 4) ,lengthAreaR_); } else { // no space - do we shuffle? if (!getColumnSpaceIterateR(iRow,region[iRow],pivotRowNew)) { // printf("Need more space for R\n"); numberInColumnPlus_.conditionalDelete(); regionSparse->clear(); break; } } region[iRow]=0.0; } regionSparse->setNumElements(0); } /* Replaces one Column to basis, partial update in vector */ void CoinFactorization::replaceColumnPart3 ( CoinIndexedVector * regionSparse, CoinIndexedVector * partialUpdate, int pivotRow, double alpha ) { abort(); } // Makes a non-singular basis by replacing variables void CoinFactorization::makeNonSingular(int * COIN_RESTRICT sequence) { // Replace bad ones by correct slack int * COIN_RESTRICT workArea = new int [numberRows_]; for (int i=0;i=0); workArea[iOriginal]=i; } int iRow=0; for (int i=0;i=0) iRow++; assert (iRowcapacity(); CoinIndexedVector * newVector = new CoinIndexedVector(); int n=(numberRows_+3)&~3; newVector->setCapacity(oldCapacity-n); vector->setCapacity(n); newVector->setDenseVector(vector->denseVector()+n); newVector->setIndexVector(vector->getIndices()+ n+((n+3)>>2)); // take this out when calmer - and think of best way memset(vector->getIndices()+vector->capacity(),0,vector->capacity()); //vector->checkClean(); //newVector->checkClear(); return newVector; } void CoinFactorization::deleteFakeVector(CoinIndexedVector * vector, CoinIndexedVector * fakeVector) const { int n=fakeVector->capacity()+vector->capacity(); //fakeVector->checkClear(); fakeVector->setCapacity(0); fakeVector->setDenseVector(NULL); fakeVector->setIndexVector(NULL); delete fakeVector; vector->setCapacity(n); //vector->checkClean(); } /* Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output long regions */ int CoinFactorization::updateColumnFT ( CoinIndexedVector & regionSparse) { CoinIndexedVector * newVector = fakeVector(®ionSparse); int returnCode=updateColumnFT(newVector,®ionSparse); deleteFakeVector(®ionSparse,newVector); return returnCode; } int CoinFactorization::updateColumnFTPart1 ( CoinIndexedVector & regionSparse2X) { CoinIndexedVector * regionSparse = fakeVector(®ionSparse2X); CoinIndexedVector * regionSparse2 = ®ionSparse2X; //permute and move indices into index array int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse2->getNumElements(); const int *permute = permute_.array(); int * COIN_RESTRICT index = regionSparse2->getIndices(); double * COIN_RESTRICT region = regionSparse->denseVector(); double * COIN_RESTRICT array = regionSparse2->denseVector(); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); // see if room int iColumn = numberColumnsExtra_; startColumnU[iColumn] = startColumnU[maximumColumnsExtra_]; CoinBigIndex start = startColumnU[iColumn]; CoinBigIndex space = lengthAreaU_ - ( start + numberRowsExtra_ ); bool doFT = space>=0; if (doFT) { regionIndex = indexRowU_.array() + start; } else { startColumnU[maximumColumnsExtra_] = lengthAreaU_+1; } assert (!regionSparse2->packedMode()); for (int j = 0; j < numberNonZero; j ++ ) { int iRow = index[j]; double value = array[iRow]; array[iRow]=0.0; iRow = permute[iRow]; region[iRow] = value; regionIndex[j] = iRow; } regionSparse->setNumElements ( numberNonZero ); if (collectStatistics_) { numberFtranCounts_++; ftranCountInput_ += numberNonZero; } // ******* L updateColumnL ( regionSparse, regionIndex ); if (collectStatistics_) ftranCountAfterL_ += regionSparse->getNumElements(); //permute extra //row bits here if ( doFT ) updateColumnRFT ( regionSparse, regionIndex ); else updateColumnR ( regionSparse ); if (collectStatistics_) ftranCountAfterR_ += regionSparse->getNumElements(); deleteFakeVector(®ionSparse2X,regionSparse); // will be negative if no room if ( doFT ) return 1; else return -1; } void CoinFactorization::updateColumnFTPart2 ( CoinIndexedVector & regionSparse2X) { CoinIndexedVector * regionSparse = fakeVector(®ionSparse2X); CoinIndexedVector * regionSparse2 = ®ionSparse2X; // ******* U int * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); updateColumnU ( regionSparse, regionIndex); permuteBack(regionSparse,regionSparse2); deleteFakeVector(®ionSparse2X,regionSparse); } /* Updates one column (FTRAN) - long region Tries to do FT update puts partial update in vector */ void CoinFactorization::updateColumnFT ( CoinIndexedVector & regionSparseFT, CoinIndexedVector & partialUpdate, int which) { abort(); } /* Updates one column (FTRAN) long region */ int CoinFactorization::updateColumn ( CoinIndexedVector & regionSparse) const { CoinIndexedVector * newVector = fakeVector(®ionSparse); updateColumn(newVector,®ionSparse); deleteFakeVector(®ionSparse,newVector); return regionSparse.getNumElements(); } /* Updates one column (FTRAN) from regionFT Tries to do FT update number returned is negative if no room. Also updates regionOther - long region*/ int CoinFactorization::updateTwoColumnsFT ( CoinIndexedVector & regionSparseFT, CoinIndexedVector & regionSparseOther) { CoinIndexedVector * newVector = fakeVector(®ionSparseFT); int returnCode=updateTwoColumnsFT(newVector, ®ionSparseFT,®ionSparseOther); deleteFakeVector(®ionSparseFT,newVector); return returnCode; } /* Updates one column (BTRAN) - long region*/ int CoinFactorization::updateColumnTranspose ( CoinIndexedVector & regionSparse) const { CoinIndexedVector * newVector = fakeVector(®ionSparse); updateColumnTranspose(newVector,®ionSparse); deleteFakeVector(®ionSparse,newVector); return regionSparse.getNumElements(); } /* Updates one column (FTRAN) - long region */ void CoinFactorization::updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const { abort(); } /* Updates one column (BTRAN) - long region */ void CoinFactorization::updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const { abort(); } /* Updates one full column (FTRAN) - long region */ void CoinFactorization::updateFullColumn ( CoinIndexedVector & regionSparse) const { if (!regionSparse.getNumElements()) regionSparse.scan(0,numberRows_); CoinIndexedVector * newVector = fakeVector(®ionSparse); updateColumn(newVector,®ionSparse); deleteFakeVector(®ionSparse,newVector); } /* Updates one full column (BTRAN) - long region */ void CoinFactorization::updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const { if (!regionSparse.getNumElements()) regionSparse.scan(0,numberRows_); CoinIndexedVector * newVector = fakeVector(®ionSparse); updateColumnTranspose(newVector,®ionSparse); deleteFakeVector(®ionSparse,newVector); } /* Updates one column for dual steepest edge weights (FTRAN) - long region */ void CoinFactorization::updateWeights ( CoinIndexedVector & regionSparse) const { abort(); } // Update partial Ftran by R update void CoinFactorization::updatePartialUpdate(CoinIndexedVector & partialUpdate) { abort(); } #endif #ifdef COIN_DEVELOP extern double ncall_DZ; extern double nrow_DZ; extern double nslack_DZ; extern double nU_DZ; extern double nnz_DZ; extern double nDone_DZ; extern double ncall_SZ; extern double nrow_SZ; extern double nslack_SZ; extern double nU_SZ; extern double nnz_SZ; extern double nDone_SZ; void print_fac_stats() { double mult = ncall_DZ ? 1.0/ncall_DZ : 1.0; printf("UDen called %g times, average rows %g, average slacks %g, average (U-S) %g average nnz in %g average ops %g\n", ncall_DZ,mult*nrow_DZ,mult*nslack_DZ,mult*(nU_DZ-nslack_DZ),mult*nnz_DZ,mult*nDone_DZ); ncall_DZ=0.0; nrow_DZ=0.0; nslack_DZ=0.0; nU_DZ=0.0; nnz_DZ=0.0; nDone_DZ=0.0; mult = ncall_SZ ? 1.0/ncall_SZ : 1.0; printf("USpars called %g times, average rows %g, average slacks %g, average (U-S) %g average nnz in %g average ops %g\n", ncall_SZ,mult*nrow_SZ,mult*nslack_SZ,mult*(nU_SZ-nslack_SZ),mult*nnz_SZ,mult*nDone_SZ); ncall_SZ=0.0; nrow_SZ=0.0; nslack_SZ=0.0; nU_SZ=0.0; nnz_SZ=0.0; nDone_SZ=0.0; } #endif CoinMP-1.8.3/CoinUtils/src/CoinSimpFactorization.cpp0000644000175000017500000021472311552534611021012 0ustar renerene/* $Id: CoinSimpFactorization.cpp 1416 2011-04-17 09:57:29Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinUtilsConfig.h" #include #include "CoinPragma.hpp" #include "CoinSimpFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" #include #define ARRAY 0 FactorPointers::FactorPointers( int numRows, int numColumns, int *UrowLengths_, int *UcolLengths_ ){ rowMax = new double[numRows]; double *current=rowMax; const double *end=current+numRows; for ( ; current!=end; ++current ) *current=-1.0; firstRowKnonzeros = new int[numRows+1]; CoinFillN(firstRowKnonzeros, numRows+1, -1 ); prevRow = new int[numRows]; nextRow = new int[numRows]; firstColKnonzeros = new int[numRows+1]; memset(firstColKnonzeros, -1, (numRows+1)*sizeof(int) ); prevColumn = new int[numColumns]; nextColumn = new int[numColumns]; newCols = new int[numRows]; for ( int i=numRows-1; i>=0; --i ){ int length=UrowLengths_[i]; prevRow[i]=-1; nextRow[i]=firstRowKnonzeros[length]; if ( nextRow[i]!=-1 ) prevRow[nextRow[i]]=i; firstRowKnonzeros[length]=i; } for ( int i=numColumns-1; i>=0; --i ){ int length=UcolLengths_[i]; prevColumn[i]=-1; nextColumn[i]=firstColKnonzeros[length]; if ( nextColumn[i]!=-1 ) prevColumn[nextColumn[i]]=i; firstColKnonzeros[length]=i; } } FactorPointers::~ FactorPointers(){ delete [] rowMax; delete [] firstRowKnonzeros; delete [] prevRow; delete [] nextRow; delete [] firstColKnonzeros; delete [] prevColumn; delete [] nextColumn; delete [] newCols; } //:class CoinSimpFactorization. Deals with Factorization and Updates // CoinSimpFactorization. Constructor CoinSimpFactorization::CoinSimpFactorization ( ) : CoinOtherFactorization() { gutsOfInitialize(); } /// Copy constructor CoinSimpFactorization::CoinSimpFactorization ( const CoinSimpFactorization &other) : CoinOtherFactorization(other) { gutsOfInitialize(); gutsOfCopy(other); } // Clone CoinOtherFactorization * CoinSimpFactorization::clone() const { return new CoinSimpFactorization(*this); } /// The real work of constructors etc void CoinSimpFactorization::gutsOfDestructor() { delete [] elements_; delete [] pivotRow_; delete [] workArea_; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; numberRows_ = 0; numberColumns_ = 0; numberGoodU_ = 0; status_ = -1; maximumRows_=0; maximumSpace_=0; numberSlacks_=0; firstNumberSlacks_=0; // delete [] denseVector_; delete [] workArea2_; delete [] workArea3_; delete [] vecLabels_; delete [] indVector_; delete [] auxVector_; delete [] auxInd_; delete [] vecKeep_; delete [] indKeep_; delete [] LrowStarts_; delete [] LrowLengths_; delete [] Lrows_; delete [] LrowInd_; delete [] LcolStarts_; delete [] LcolLengths_; delete [] Lcolumns_; delete [] LcolInd_; delete [] UrowStarts_; delete [] UrowLengths_; #ifdef COIN_SIMP_CAPACITY delete [] UrowCapacities_; #endif delete [] Urows_; delete [] UrowInd_; delete [] prevRowInU_; delete [] nextRowInU_; delete [] UcolStarts_; delete [] UcolLengths_; #ifdef COIN_SIMP_CAPACITY delete [] UcolCapacities_; #endif delete [] Ucolumns_; delete [] UcolInd_; delete [] prevColInU_; delete [] nextColInU_; delete [] colSlack_; delete [] invOfPivots_; delete [] colOfU_; delete [] colPosition_; delete [] rowOfU_; delete [] rowPosition_; delete [] secRowOfU_; delete [] secRowPosition_; delete [] EtaPosition_; delete [] EtaStarts_; delete [] EtaLengths_; delete [] EtaInd_; delete [] Eta_; denseVector_=NULL; workArea2_=NULL; workArea3_=NULL; vecLabels_=NULL; indVector_=NULL; auxVector_=NULL; auxInd_=NULL; vecKeep_=NULL; indKeep_=NULL; LrowStarts_=NULL; LrowLengths_=NULL; Lrows_=NULL; LrowInd_=NULL; LcolStarts_=NULL; LcolLengths_=NULL; Lcolumns_=NULL; LcolInd_=NULL; UrowStarts_=NULL; UrowLengths_=NULL; #ifdef COIN_SIMP_CAPACITY UrowCapacities_=NULL; #endif Urows_=NULL; UrowInd_=NULL; prevRowInU_=NULL; nextRowInU_=NULL; UcolStarts_=NULL; UcolLengths_=NULL; #ifdef COIN_SIMP_CAPACITY UcolCapacities_=NULL; #endif Ucolumns_=NULL; UcolInd_=NULL; prevColInU_=NULL; nextColInU_=NULL; colSlack_=NULL; invOfPivots_=NULL; colOfU_=NULL; colPosition_=NULL; rowOfU_=NULL; rowPosition_=NULL; secRowOfU_=NULL; secRowPosition_=NULL; EtaPosition_=NULL; EtaStarts_=NULL; EtaLengths_=NULL; EtaInd_=NULL; Eta_=NULL; } void CoinSimpFactorization::gutsOfInitialize() { pivotTolerance_ = 1.0e-1; zeroTolerance_ = 1.0e-13; #ifndef COIN_FAST_CODE slackValue_ = -1.0; #endif maximumPivots_=200; relaxCheck_=1.0; numberRows_ = 0; numberColumns_ = 0; numberGoodU_ = 0; status_ = -1; numberPivots_ = 0; maximumRows_=0; maximumSpace_=0; numberSlacks_=0; firstNumberSlacks_=0; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; denseVector_=NULL; workArea2_=NULL; workArea3_=NULL; vecLabels_=NULL; indVector_=NULL; auxVector_=NULL; auxInd_=NULL; vecKeep_=NULL; indKeep_=NULL; LrowStarts_=NULL; LrowLengths_=NULL; Lrows_=NULL; LrowInd_=NULL; LcolStarts_=NULL; LcolLengths_=NULL; Lcolumns_=NULL; LcolInd_=NULL; UrowStarts_=NULL; UrowLengths_=NULL; #ifdef COIN_SIMP_CAPACITY UrowCapacities_=NULL; #endif Urows_=NULL; UrowInd_=NULL; prevRowInU_=NULL; nextRowInU_=NULL; UcolStarts_=NULL; UcolLengths_=NULL; #ifdef COIN_SIMP_CAPACITY UcolCapacities_=NULL; #endif Ucolumns_=NULL; UcolInd_=NULL; prevColInU_=NULL; nextColInU_=NULL; colSlack_=NULL; invOfPivots_=NULL; colOfU_=NULL; colPosition_=NULL; rowOfU_=NULL; rowPosition_=NULL; secRowOfU_=NULL; secRowPosition_=NULL; EtaPosition_=NULL; EtaStarts_=NULL; EtaLengths_=NULL; EtaInd_=NULL; Eta_=NULL; } void CoinSimpFactorization::initialSomeNumbers(){ keepSize_=-1; LrowSize_=-1; // LrowCap_ in allocateSomeArrays LcolSize_=-1; // LcolCap_ in allocateSomeArrays // UrowMaxCap_ in allocateSomeArrays UrowEnd_=-1; firstRowInU_=-1; lastRowInU_=-1; firstColInU_=-1; lastColInU_=-1; //UcolMaxCap_ in allocateSomeArrays UcolEnd_=-1; EtaSize_=0; lastEtaRow_=-1; //maxEtaRows_ in allocateSomeArrays //EtaMaxCap_ in allocateSomeArrays // minIncrease_ in allocateSomeArrays updateTol_=1.0e12; doSuhlHeuristic_=true; maxU_=-1.0; maxGrowth_=1.e12; maxA_=-1.0; pivotCandLimit_=4; minIncrease_=10; } // ~CoinSimpFactorization. Destructor CoinSimpFactorization::~CoinSimpFactorization ( ) { gutsOfDestructor(); } // = CoinSimpFactorization & CoinSimpFactorization::operator = ( const CoinSimpFactorization & other ) { if (this != &other) { gutsOfDestructor(); gutsOfInitialize(); gutsOfCopy(other); } return *this; } void CoinSimpFactorization::gutsOfCopy(const CoinSimpFactorization &other) { pivotTolerance_ = other.pivotTolerance_; zeroTolerance_ = other.zeroTolerance_; #ifndef COIN_FAST_CODE slackValue_ = other.slackValue_; #endif relaxCheck_ = other.relaxCheck_; numberRows_ = other.numberRows_; numberColumns_ = other.numberColumns_; maximumRows_ = other.maximumRows_; maximumSpace_ = other.maximumSpace_; numberGoodU_ = other.numberGoodU_; maximumPivots_ = other.maximumPivots_; numberPivots_ = other.numberPivots_; factorElements_ = other.factorElements_; status_ = other.status_; numberSlacks_ = other.numberSlacks_; firstNumberSlacks_ = other.firstNumberSlacks_; if (other.pivotRow_) { pivotRow_ = new int [2*maximumRows_+maximumPivots_]; memcpy(pivotRow_,other.pivotRow_,(2*maximumRows_+numberPivots_)*sizeof(int)); elements_ = new CoinFactorizationDouble [maximumSpace_]; memcpy(elements_,other.elements_,(maximumRows_+numberPivots_)*maximumRows_*sizeof(CoinFactorizationDouble)); workArea_ = new CoinFactorizationDouble [maximumRows_]; } else { elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; } keepSize_ = other.keepSize_; LrowSize_ = other.LrowSize_; LrowCap_ = other.LrowCap_; LcolSize_ = other.LcolSize_; LcolCap_ = other.LcolCap_; UrowMaxCap_ = other.UrowMaxCap_; UrowEnd_ = other.UrowEnd_; firstRowInU_ = other.firstRowInU_; lastRowInU_ = other.lastRowInU_; firstColInU_ = other.firstColInU_; lastColInU_ = other.lastColInU_; UcolMaxCap_ = other.UcolMaxCap_; UcolEnd_ = other.UcolEnd_; EtaSize_ = other.EtaSize_; lastEtaRow_ = other.lastEtaRow_; maxEtaRows_ = other.maxEtaRows_; EtaMaxCap_ = other.EtaMaxCap_; minIncrease_ = other.minIncrease_; updateTol_ = other.updateTol_; if (other.denseVector_) { denseVector_ = new double[maximumRows_]; memcpy(denseVector_,other.denseVector_,maximumRows_*sizeof(double)); } else denseVector_=NULL; if (other.workArea2_) { workArea2_ = new double[maximumRows_]; memcpy(workArea2_,other.workArea2_,maximumRows_*sizeof(double)); } else workArea2_=NULL; if (other.workArea3_) { workArea3_ = new double[maximumRows_]; memcpy(workArea3_,other.workArea3_,maximumRows_*sizeof(double)); } else workArea3_=NULL; if (other.vecLabels_) { vecLabels_ = new int[maximumRows_]; memcpy(vecLabels_,other.vecLabels_,maximumRows_*sizeof(int)); } else vecLabels_=NULL; if (other.indVector_) { indVector_ = new int[maximumRows_]; memcpy(indVector_ ,other.indVector_ , maximumRows_ *sizeof(int )); } else indVector_=NULL; if (other.auxVector_) { auxVector_ = new double[maximumRows_]; memcpy(auxVector_ ,other.auxVector_ , maximumRows_ *sizeof(double )); } else auxVector_=NULL; if (other.auxInd_) { auxInd_ = new int[maximumRows_]; memcpy(auxInd_ , other.auxInd_, maximumRows_ *sizeof(int)); } else auxInd_=NULL; if (other.vecKeep_) { vecKeep_ = new double[maximumRows_]; memcpy(vecKeep_ ,other.vecKeep_ , maximumRows_ *sizeof(double)); } else vecKeep_=NULL; if (other.indKeep_) { indKeep_ = new int[maximumRows_]; memcpy(indKeep_ , other.indKeep_, maximumRows_ *sizeof(int)); } else indKeep_=NULL; if (other.LrowStarts_) { LrowStarts_ = new int[maximumRows_]; memcpy(LrowStarts_ , other.LrowStarts_, maximumRows_ *sizeof(int)); } else LrowStarts_=NULL; if (other.LrowLengths_) { LrowLengths_ = new int[maximumRows_]; memcpy(LrowLengths_ , other.LrowLengths_ , maximumRows_ *sizeof(int)); } else LrowLengths_=NULL; if (other.Lrows_) { Lrows_ = new double[other.LrowCap_]; memcpy(Lrows_ , other.Lrows_, other.LrowCap_*sizeof(double)); } else Lrows_=NULL; if (other.LrowInd_) { LrowInd_ = new int[other.LrowCap_]; memcpy(LrowInd_, other.LrowInd_, other.LrowCap_*sizeof(int)); } else LrowInd_=NULL; if (other.LcolStarts_) { LcolStarts_ = new int[maximumRows_]; memcpy(LcolStarts_ ,other.LcolStarts_ , maximumRows_*sizeof(int)); } else LcolStarts_=NULL; if (other.LcolLengths_) { LcolLengths_ = new int[maximumRows_]; memcpy(LcolLengths_ , other.LcolLengths_ , maximumRows_ *sizeof(int)); } else LcolLengths_=NULL; if (other.Lcolumns_) { Lcolumns_ = new double[other.LcolCap_]; memcpy(Lcolumns_ ,other.Lcolumns_ , other.LcolCap_ *sizeof(double)); } else Lcolumns_=NULL; if (other.LcolInd_) { LcolInd_ = new int[other.LcolCap_]; memcpy(LcolInd_ , other.LcolInd_, other.LcolCap_*sizeof(int)); } else LcolInd_=NULL; if (other.UrowStarts_) { UrowStarts_ = new int[maximumRows_]; memcpy(UrowStarts_ ,other.UrowStarts_ , maximumRows_ *sizeof(int)); } else UrowStarts_=NULL; if (other.UrowLengths_) { UrowLengths_ = new int[maximumRows_]; memcpy(UrowLengths_ ,other.UrowLengths_ , maximumRows_ *sizeof(int)); } else UrowLengths_=NULL; #ifdef COIN_SIMP_CAPACITY if (other.UrowCapacities_) { UrowCapacities_ = new int[maximumRows_]; memcpy(UrowCapacities_ ,other.UrowCapacities_ , maximumRows_ *sizeof(int)); } else UrowCapacities_=NULL; #endif if (other.Urows_) { Urows_ = new double[other.UrowMaxCap_]; memcpy(Urows_ ,other.Urows_ , other.UrowMaxCap_ *sizeof(double)); } else Urows_=NULL; if (other.UrowInd_) { UrowInd_ = new int[other.UrowMaxCap_]; memcpy(UrowInd_,other.UrowInd_, other.UrowMaxCap_*sizeof(int)); } else UrowInd_=NULL; if (other.prevRowInU_) { prevRowInU_ = new int[maximumRows_]; memcpy(prevRowInU_ , other.prevRowInU_, maximumRows_*sizeof(int)); } else prevRowInU_=NULL; if (other.nextRowInU_) { nextRowInU_ = new int[maximumRows_]; memcpy(nextRowInU_, other.nextRowInU_, maximumRows_*sizeof(int)); } else nextRowInU_=NULL; if (other.UcolStarts_) { UcolStarts_ = new int[maximumRows_]; memcpy(UcolStarts_ , other.UcolStarts_, maximumRows_*sizeof(int)); } else UcolStarts_=NULL; if (other.UcolLengths_) { UcolLengths_ = new int[maximumRows_]; memcpy(UcolLengths_ , other.UcolLengths_, maximumRows_*sizeof(int)); } else UcolLengths_=NULL; #ifdef COIN_SIMP_CAPACITY if (other.UcolCapacities_) { UcolCapacities_ = new int[maximumRows_]; memcpy(UcolCapacities_ ,other.UcolCapacities_ , maximumRows_*sizeof(int)); } else UcolCapacities_=NULL; #endif if (other.Ucolumns_) { Ucolumns_ = new double[other.UcolMaxCap_]; memcpy(Ucolumns_ ,other.Ucolumns_ , other.UcolMaxCap_*sizeof(double)); } else Ucolumns_=NULL; if (other.UcolInd_) { UcolInd_ = new int[other.UcolMaxCap_]; memcpy(UcolInd_ , other.UcolInd_ , other.UcolMaxCap_*sizeof(int)); } else UcolInd_=NULL; if (other.prevColInU_) { prevColInU_ = new int[maximumRows_]; memcpy(prevColInU_ , other.prevColInU_ , maximumRows_*sizeof(int)); } else prevColInU_=NULL; if (other.nextColInU_) { nextColInU_ = new int[maximumRows_]; memcpy(nextColInU_ ,other.nextColInU_ , maximumRows_*sizeof(int)); } else nextColInU_=NULL; if (other.colSlack_) { colSlack_ = new int[maximumRows_]; memcpy(colSlack_, other.colSlack_, maximumRows_*sizeof(int)); } if (other.invOfPivots_) { invOfPivots_ = new double[maximumRows_]; memcpy(invOfPivots_ , other.invOfPivots_, maximumRows_*sizeof(double)); } else invOfPivots_=NULL; if (other.colOfU_) { colOfU_ = new int[maximumRows_]; memcpy(colOfU_ , other.colOfU_, maximumRows_*sizeof(int)); } else colOfU_=NULL; if (other.colPosition_) { colPosition_ = new int[maximumRows_]; memcpy(colPosition_, other.colPosition_, maximumRows_*sizeof(int)); } else colPosition_=NULL; if (other.rowOfU_) { rowOfU_ = new int[maximumRows_]; memcpy(rowOfU_ , other.rowOfU_, maximumRows_*sizeof(int)); } else rowOfU_=NULL; if (other.rowPosition_) { rowPosition_ = new int[maximumRows_]; memcpy(rowPosition_ , other.rowPosition_, maximumRows_*sizeof(int)); } else rowPosition_=NULL; if (other.secRowOfU_) { secRowOfU_ = new int[maximumRows_]; memcpy(secRowOfU_ , other.secRowOfU_, maximumRows_*sizeof(int)); } else secRowOfU_=NULL; if (other.secRowPosition_) { secRowPosition_ = new int[maximumRows_]; memcpy(secRowPosition_ , other.secRowPosition_, maximumRows_*sizeof(int)); } else secRowPosition_=NULL; if (other.EtaPosition_) { EtaPosition_ = new int[other.maxEtaRows_]; memcpy(EtaPosition_ ,other.EtaPosition_ , other.maxEtaRows_ *sizeof(int)); } else EtaPosition_=NULL; if (other.EtaStarts_) { EtaStarts_ = new int[other.maxEtaRows_]; memcpy(EtaStarts_, other.EtaStarts_, other.maxEtaRows_*sizeof(int)); } else EtaStarts_=NULL; if (other.EtaLengths_) { EtaLengths_ = new int[other.maxEtaRows_]; memcpy(EtaLengths_, other.EtaLengths_, other.maxEtaRows_*sizeof(int)); } else EtaLengths_=NULL; if (other.EtaInd_) { EtaInd_ = new int[other.EtaMaxCap_]; memcpy(EtaInd_, other.EtaInd_, other.EtaMaxCap_*sizeof(int)); } else EtaInd_=NULL; if (other.Eta_) { Eta_ = new double[other.EtaMaxCap_]; memcpy(Eta_ , other.Eta_, other.EtaMaxCap_*sizeof(double)); } else Eta_=NULL; doSuhlHeuristic_ = other.doSuhlHeuristic_; maxU_ = other.maxU_; maxGrowth_ = other.maxGrowth_; maxA_ = other.maxA_; pivotCandLimit_ = other.pivotCandLimit_; } // getAreas. Gets space for a factorization //called by constructors void CoinSimpFactorization::getAreas ( int numberOfRows, int numberOfColumns, CoinBigIndex , CoinBigIndex ) { numberRows_ = numberOfRows; numberColumns_ = numberOfColumns; CoinBigIndex size = numberRows_*(numberRows_+CoinMax(maximumPivots_,(numberRows_+1)>>1)); if (size>maximumSpace_) { delete [] elements_; elements_ = new CoinFactorizationDouble [size]; maximumSpace_ = size; } if (numberRows_>maximumRows_) { maximumRows_ = numberRows_; delete [] pivotRow_; delete [] workArea_; pivotRow_ = new int [2*maximumRows_+maximumPivots_]; workArea_ = new CoinFactorizationDouble [maximumRows_]; allocateSomeArrays(); } } // preProcess. void CoinSimpFactorization::preProcess () { CoinBigIndex put = numberRows_*numberRows_; int *indexRow = reinterpret_cast (elements_+put); CoinBigIndex * starts = reinterpret_cast (pivotRow_); initialSomeNumbers(); // compute sizes for Urows_ and Ucolumns_ //for ( int row=0; row < numberRows_; ++row ) //UrowLengths_[row]=0; int k=0; for ( int column=0; column < numberColumns_; ++column ){ UcolStarts_[column]=k; //for (CoinBigIndex j=starts[column];j (elements_+put); CoinBigIndex * starts = reinterpret_cast (pivotRow_); for ( int column=0; column <= numberColumns_; ++column ){ starts[column]=colStarts[column]; } const int limit=colStarts[numberColumns_]; for ( int i=0; i (workArea_); int i; for ( i=0;i=0); for ( i=numberGoodU_;idenseVector ( ); int *regionIndex = regionSparse2->getIndices ( ); int numberNonZero = regionSparse2->getNumElements ( ); double *region=regionSparse->denseVector ( ); if (!regionSparse2->packedMode()) { region=regionSparse2->denseVector ( ); } else { // packed mode for (int j=0;jpackedMode()) { for (int i=0;i zeroTolerance_ ){ region[i]=value; regionIndex[numberNonZero++]=i; } else region[i]=0.0; } } else { // packed mode memset(region,0,numberRows_*sizeof(double)); for (int i=0;i zeroTolerance_ ){ region2[numberNonZero] = value; regionIndex[numberNonZero++]=i; } } } regionSparse2->setNumElements(numberNonZero); return 0; } int CoinSimpFactorization::updateTwoColumnsFT(CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool ) { assert (numberRows_==numberColumns_); double *region2 = regionSparse2->denseVector ( ); int *regionIndex2 = regionSparse2->getIndices ( ); int numberNonZero2 = regionSparse2->getNumElements ( ); double *vec1=regionSparse1->denseVector ( ); if (!regionSparse2->packedMode()) { vec1=regionSparse2->denseVector ( ); } else { // packed mode for (int j=0;jdenseVector ( ); int *regionIndex3 = regionSparse3->getIndices ( ); int numberNonZero3 = regionSparse3->getNumElements ( ); double *vec2=auxVector_; if (!regionSparse3->packedMode()) { vec2=regionSparse3->denseVector ( ); } else { // packed mode memset(vec2,0,numberRows_*sizeof(double)); for (int j=0;jpackedMode()) { double value; for (int i=0;i zeroTolerance_ ){ vec1[i]=value; regionIndex2[numberNonZero2++]=i; } else vec1[i]=0.0; } } else { // packed mode double value; for (int i=0;i zeroTolerance_ ){ region2[numberNonZero2] = value; regionIndex2[numberNonZero2++]=i; } } } regionSparse2->setNumElements(numberNonZero2); // numberNonZero3=0; if (!regionSparse3->packedMode()) { double value; for (int i=0;i zeroTolerance_ ){ vec2[i]=value; regionIndex3[numberNonZero3++]=i; } else vec2[i]=0.0; } } else { // packed mode double value; for (int i=0;i zeroTolerance_ ){ region3[numberNonZero3] = value; regionIndex3[numberNonZero3++]=i; } } } regionSparse3->setNumElements(numberNonZero3); return 0; } int CoinSimpFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { upColumnTranspose(regionSparse, regionSparse2); return 0; } int CoinSimpFactorization::upColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { assert (numberRows_==numberColumns_); double *region2 = regionSparse2->denseVector ( ); int *regionIndex = regionSparse2->getIndices ( ); int numberNonZero = regionSparse2->getNumElements ( ); double *region = regionSparse->denseVector ( ); if (!regionSparse2->packedMode()) { region=regionSparse2->denseVector ( ); } else { // packed for (int j=0;jpackedMode()) { double value; for (int i=0;i zeroTolerance_ ){ region[i]=value; regionIndex[numberNonZero++]=i; } else region[i]=0.0; } } else { // packed mode memset(region,0,numberRows_*sizeof(double)); for (int i=0;i zeroTolerance_ ){ region2[numberNonZero] = value; regionIndex[numberNonZero++]=i; } } } regionSparse2->setNumElements(numberNonZero); return 0; } int CoinSimpFactorization::mainLoopFactor (FactorPointers &pointers ) { numberGoodU_=0; numberSlacks_=0; bool ifSlack=true; for ( int i=0; i maxGrowth_ * maxA_ ){ // return -3; //} ++numberGoodU_; } return 0; } /// find a pivot in the active part of U int CoinSimpFactorization::findPivot(FactorPointers &pointers, int &r, int &s, bool &ifSlack){ int *firstRowKnonzeros=pointers.firstRowKnonzeros; int *nextRow=pointers.nextRow; int *firstColKnonzeros=pointers.firstColKnonzeros; int *prevColumn=pointers.prevColumn; int *nextColumn=pointers.nextColumn; r=s=-1; int numCandidates=0; double bestMarkowitzCount=COIN_DBL_MAX; // if there is a column with one element choose it as pivot int column=firstColKnonzeros[1]; if ( column!=-1 ){ assert( UcolLengths_[column] == 1 ); r=UcolInd_[UcolStarts_[column]]; s=column; if ( !colSlack_[column] ) ifSlack=false; return 0; } // from now on no more slacks ifSlack=false; // if there is a row with one element choose it int row=firstRowKnonzeros[1]; if ( row!=-1 ){ assert( UrowLengths_[row] == 1 ); s=UrowInd_[UrowStarts_[row]]; r=row; return 0; } // consider other rows and columns for ( int length=2; length <=numberRows_; ++length){ int nextCol=-1; for ( column=firstColKnonzeros[length]; column!=-1; column=nextCol ){ nextCol=nextColumn[column]; int minRow, minRowLength; int rc=findShortRow(column, length, minRow, minRowLength, pointers); if ( rc== 0 ){ r=minRow; s=column; return 0; } if ( minRow != -1 ){ ++numCandidates; double MarkowitzCount=static_cast(minRowLength-1)*(length-1); if ( MarkowitzCount < bestMarkowitzCount ){ r=minRow; s=column; bestMarkowitzCount=MarkowitzCount; } if ( numCandidates == pivotCandLimit_ ) return 0; } else { if ( doSuhlHeuristic_ ){ // this column did not give a candidate, it will be // removed until it becomes a singleton removeColumnFromActSet(column, pointers); prevColumn[column]=nextColumn[column]=column; } } } // end for ( column= .... // now rows for ( row=firstRowKnonzeros[length]; row!=-1; row=nextRow[row] ){ int minCol, minColLength; int rc=findShortColumn(row, length, minCol, minColLength, pointers); if ( rc==0 ){ r=row; s=minCol; return 0; } if ( minCol != -1 ){ ++numCandidates; double MarkowitzCount=static_cast(minColLength-1)*(length-1); if ( MarkowitzCount < bestMarkowitzCount ){ r=row; s=minCol; bestMarkowitzCount=MarkowitzCount; } if ( numCandidates == pivotCandLimit_ ) return 0; } //else abort(); }// end for ( row= ... }// end for ( int length= ... if ( r== -1 || s==-1 ) return 1; else return 0; } // int CoinSimpFactorization::findPivotShCol(FactorPointers &pointers, int &r, int &s) { int *firstColKnonzeros=pointers.firstColKnonzeros; r=s=-1; // if there is a column with one element choose it as pivot int column=firstColKnonzeros[1]; if ( column!=-1 ){ assert( UcolLengths_[column] == 1 ); r=UcolInd_[UcolStarts_[column]]; s=column; return 0; } // consider other columns for ( int length=2; length <=numberRows_; ++length){ column=firstColKnonzeros[length]; if ( column != -1 ) break; } if ( column == -1 ) return 1; // find largest element const int colBeg=UcolStarts_[column]; const int colEnd=colBeg+UcolLengths_[column]; double largest=0.0; int rowLargest=-1; for ( int j=colBeg; j= minRowLength ) continue; double largestInRow=findMaxInRrow(row,pointers); // find column in row int columnIndx=findInRow(row,column); assert(columnIndx!=-1); double coeff=Urows_[columnIndx]; if ( fabs(coeff) < pivotTolerance_ * largestInRow ) continue; minRow=row; minRowLength=UrowLengths_[row]; if ( UrowLengths_[row] <= length ) return 0; } return 1; } int CoinSimpFactorization::findShortColumn(const int row, const int length, int &minCol, int &minColLength, FactorPointers &pointers) { const int rowBeg=UrowStarts_[row]; const int rowEnd=rowBeg+UrowLengths_[row]; minCol=-1; minColLength=COIN_INT_MAX; double largestInRow=findMaxInRrow(row,pointers); for ( int i=rowBeg; i= minColLength ) continue; double coeff=Urows_[i]; if ( fabs(coeff) < pivotTolerance_ * largestInRow ) continue; minCol=column; minColLength=UcolLengths_[column]; if ( minColLength <= length ) return 0; } return 1; } // Gaussian elimination void CoinSimpFactorization::GaussEliminate(FactorPointers &pointers, int &pivotRow, int &pivotCol) { assert( pivotRow >= 0 && pivotRow < numberRows_ ); assert( pivotCol >= 0 && pivotCol < numberRows_ ); int *firstColKnonzeros=pointers.firstColKnonzeros; int *prevColumn=pointers.prevColumn; int *nextColumn=pointers.nextColumn; int *colLabels=vecLabels_; double *denseRow=denseVector_; removeRowFromActSet(pivotRow, pointers); removeColumnFromActSet(pivotCol, pointers); // find column s int indxColS=findInRow(pivotRow, pivotCol); assert( indxColS >= 0 ); // store the inverse of the pivot and remove it from row double invPivot=1.0/Urows_[indxColS]; invOfPivots_[pivotRow]=invPivot; int rowBeg=UrowStarts_[pivotRow]; int rowEnd=rowBeg+UrowLengths_[pivotRow]; Urows_[indxColS]=Urows_[rowEnd-1]; UrowInd_[indxColS]=UrowInd_[rowEnd-1]; --UrowLengths_[pivotRow]; --rowEnd; // now remove pivot from column int indxRowR=findInColumn(pivotCol,pivotRow); assert( indxRowR >= 0 ); const int pivColEnd=UcolStarts_[pivotCol]+UcolLengths_[pivotCol]; UcolInd_[indxRowR]=UcolInd_[pivColEnd-1]; --UcolLengths_[pivotCol]; // go through pivot row for ( int i=rowBeg; i=0 ); const int colEnd=UcolStarts_[column]+UcolLengths_[column]; UcolInd_[indxRow]=UcolInd_[colEnd-1]; --UcolLengths_[column]; } // pivoting(pivotRow, pivotCol, invPivot, pointers); // rowBeg=UrowStarts_[pivotRow]; rowEnd=rowBeg+UrowLengths_[pivotRow]; for ( int i=rowBeg; i= 0); const double multiplier=Urows_[pivotColInRow]*invPivot; // remove element (row,pivotColumn) from row const int currentRowEnd=UrowStarts_[row]+UrowLengths_[row]; Urows_[pivotColInRow]=Urows_[currentRowEnd-1]; UrowInd_[pivotColInRow]=UrowInd_[currentRowEnd-1]; --UrowLengths_[row]; int newNonZeros=UrowLengths_[pivotRow]; updateCurrentRow(pivotRow, row, multiplier, pointers, newNonZeros); // store multiplier if ( LcolSize_ == LcolCap_ ) increaseLsize(); Lcolumns_[LcolSize_]=multiplier; LcolInd_[LcolSize_++]=row; ++LcolLengths_[pivotRow]; } // remove elements of pivot column UcolLengths_[pivotColumn]=0; // remove pivot column from Ucol_ if ( prevColInU_[pivotColumn]==-1 ) firstColInU_=nextColInU_[pivotColumn]; else{ nextColInU_[prevColInU_[pivotColumn]]=nextColInU_[pivotColumn]; #ifdef COIN_SIMP_CAPACITY UcolCapacities_[prevColInU_[pivotColumn]]+=UcolCapacities_[pivotColumn]; UcolCapacities_[pivotColumn]=0; #endif } if ( nextColInU_[pivotColumn] == -1 ) lastColInU_=prevColInU_[pivotColumn]; else prevColInU_[nextColInU_[pivotColumn]]=prevColInU_[pivotColumn]; } void CoinSimpFactorization::updateCurrentRow(const int pivotRow, const int row, const double multiplier, FactorPointers &pointers, int &newNonZeros) { double *rowMax=pointers.rowMax; int *firstRowKnonzeros=pointers.firstRowKnonzeros; int *prevRow=pointers.prevRow; int *nextRow=pointers.nextRow; int *colLabels=vecLabels_; double *denseRow=denseVector_; const int rowBeg=UrowStarts_[row]; int rowEnd=rowBeg+UrowLengths_[row]; // treat old nonzeros for ( int i=rowBeg; i= 0 ); const int colEnd=UcolStarts_[column]+UcolLengths_[column]; UcolInd_[indxRow]=UcolInd_[colEnd-1]; --UcolLengths_[column]; } else { if ( maxU_ < absNewCoeff ) maxU_=absNewCoeff; } } } // now add the new nonzeros to the row #ifdef COIN_SIMP_CAPACITY if ( UrowLengths_[row] + newNonZeros > UrowCapacities_[row] ) increaseRowSize(row, UrowLengths_[row] + newNonZeros); #endif const int pivotRowBeg=UrowStarts_[pivotRow]; const int pivotRowEnd=pivotRowBeg+UrowLengths_[pivotRow]; int numNew=0; int *newCols=pointers.newCols; for ( int i=pivotRowBeg; i= zeroTolerance_ ){ const int newInd=UrowStarts_[row]+UrowLengths_[row]; Urows_[newInd]=value; UrowInd_[newInd]=column; ++UrowLengths_[row]; newCols[numNew++]=column; if ( maxU_ < absNewCoeff ) maxU_=absNewCoeff; } } else colLabels[column]=1; } // add the new nonzeros to the columns for ( int i=0; i UcolCapacities_[column] ){ increaseColSize(column, UcolLengths_[column] + 1, false); } #endif const int newInd=UcolStarts_[column]+UcolLengths_[column]; UcolInd_[newInd]=row; ++UcolLengths_[column]; } // the row goes to a new bucket prevRow[row]=-1; nextRow[row]=firstRowKnonzeros[UrowLengths_[row]]; if ( nextRow[row]!=-1 ) prevRow[nextRow[row]]=row; firstRowKnonzeros[UrowLengths_[row]]=row; // rowMax[row]=-1.0; } #ifdef COIN_SIMP_CAPACITY void CoinSimpFactorization::increaseRowSize(const int row, const int newSize) { assert( newSize > UrowCapacities_[row] ); const int newNumElements=newSize + minIncrease_; if ( UrowMaxCap_ < UrowEnd_ + newNumElements ){ enlargeUrow( UrowEnd_ + newNumElements - UrowMaxCap_ ); } int currentCapacity=UrowCapacities_[row]; memcpy(&Urows_[UrowEnd_],&Urows_[UrowStarts_[row]], UrowLengths_[row] * sizeof(double)); memcpy(&UrowInd_[UrowEnd_],&UrowInd_[UrowStarts_[row]], UrowLengths_[row] * sizeof(int)); UrowStarts_[row]=UrowEnd_; UrowCapacities_[row]=newNumElements; UrowEnd_+=UrowCapacities_[row]; if ( firstRowInU_==lastRowInU_ ) return; // only one element // remove row from list if( prevRowInU_[row]== -1) firstRowInU_=nextRowInU_[row]; else { nextRowInU_[prevRowInU_[row]]=nextRowInU_[row]; UrowCapacities_[prevRowInU_[row]]+=currentCapacity; } if ( nextRowInU_[row]==-1 ) lastRowInU_=prevRowInU_[row]; else prevRowInU_[nextRowInU_[row]]=prevRowInU_[row]; // add row at the end of list nextRowInU_[lastRowInU_]=row; nextRowInU_[row]=-1; prevRowInU_[row]=lastRowInU_; lastRowInU_=row; } #endif #ifdef COIN_SIMP_CAPACITY void CoinSimpFactorization::increaseColSize(const int column, const int newSize, const bool ifElements) { assert( newSize > UcolCapacities_[column] ); const int newNumElements=newSize+minIncrease_; if ( UcolMaxCap_ < UcolEnd_ + newNumElements ){ enlargeUcol(UcolEnd_ + newNumElements - UcolMaxCap_, ifElements); } int currentCapacity=UcolCapacities_[column]; memcpy(&UcolInd_[UcolEnd_], &UcolInd_[UcolStarts_[column]], UcolLengths_[column] * sizeof(int)); if ( ifElements ){ memcpy(&Ucolumns_[UcolEnd_], &Ucolumns_[UcolStarts_[column]], UcolLengths_[column] * sizeof(double) ); } UcolStarts_[column]=UcolEnd_; UcolCapacities_[column]=newNumElements; UcolEnd_+=UcolCapacities_[column]; if ( firstColInU_==lastColInU_ ) return; // only one column // remove from list if ( prevColInU_[column]==-1 ) firstColInU_=nextColInU_[column]; else { nextColInU_[prevColInU_[column]]=nextColInU_[column]; UcolCapacities_[prevColInU_[column]]+=currentCapacity; } if ( nextColInU_[column]==-1 ) lastColInU_=prevColInU_[column]; else prevColInU_[nextColInU_[column]]=prevColInU_[column]; // add column at the end nextColInU_[lastColInU_]=column; nextColInU_[column]=-1; prevColInU_[column]=lastColInU_; lastColInU_=column; } #endif double CoinSimpFactorization::findMaxInRrow(const int row, FactorPointers &pointers) { double *rowMax=pointers.rowMax; double largest=rowMax[row]; if ( largest >= 0.0 ) return largest; const int rowBeg=UrowStarts_[row]; const int rowEnd=rowBeg+UrowLengths_[row]; for ( int i=rowBeg; i largest ) largest=absValue; } rowMax[row]=largest; return largest; } void CoinSimpFactorization::increaseLsize() { int newcap= LcolCap_ + minIncrease_; double *aux=new double[newcap]; memcpy(aux, Lcolumns_, LcolCap_ * sizeof(double)); delete [] Lcolumns_; Lcolumns_=aux; int *iaux=new int[newcap]; memcpy(iaux, LcolInd_, LcolCap_ * sizeof(int)); delete [] LcolInd_; LcolInd_=iaux; LcolCap_=newcap; } void CoinSimpFactorization::enlargeUcol(const int numNewElements, const bool ifElements) { int *iaux=new int[UcolMaxCap_+numNewElements]; memcpy(iaux, UcolInd_, UcolMaxCap_*sizeof(int) ); delete [] UcolInd_; UcolInd_=iaux; if ( ifElements ){ double *aux=new double[UcolMaxCap_+numNewElements]; memcpy(aux, Ucolumns_, UcolMaxCap_*sizeof(double) ); delete [] Ucolumns_; Ucolumns_=aux; } UcolMaxCap_+=numNewElements; } void CoinSimpFactorization::enlargeUrow(const int numNewElements) { int *iaux=new int[UrowMaxCap_+numNewElements]; memcpy(iaux, UrowInd_, UrowMaxCap_*sizeof(int) ); delete [] UrowInd_; UrowInd_=iaux; double *aux=new double[UrowMaxCap_+numNewElements]; memcpy(aux, Urows_, UrowMaxCap_*sizeof(double) ); delete [] Urows_; Urows_=aux; UrowMaxCap_+=numNewElements; } void CoinSimpFactorization::copyUbyColumns() { memset(UcolLengths_,0,numberColumns_*sizeof(int)); for ( int column=0; columnzeroTolerance_ ) { colBeg=LcolStarts_[k]; ind=LcolInd_+colBeg; indEnd=ind+LcolLengths_[k]; Lcol=Lcolumns_+colBeg; for ( ; ind!=indEnd; ++ind ){ rhs[ *ind ]-= (*Lcol) * xk; ++Lcol; } } } } void CoinSimpFactorization::Lxeqb2(double *b1, double *b2) const { double *rhs1=b1; double *rhs2=b2; double x1, x2, *Lcol; int k, colBeg, *ind, *indEnd, j; // now solve for ( j=firstNumberSlacks_; j=numberSlacks_; --k ){ row=secRowOfU_[k]; x=rhs[row]; column=colOfU_[k]; if ( x!=0.0 ) { //if ( fabs(x) > zeroTolerance_ ) { x*=invOfPivots_[row]; colBeg=UcolStarts_[column]; ind=UcolInd_+colBeg; indEnd=ind+UcolLengths_[column]; uCol=Ucolumns_+colBeg; for ( ; ind!=indEnd; ++ind ){ #if 0 rhs[ *ind ]-= (*uCol) * x; #else double value=rhs[ *ind ]; rhs[ *ind ] = value - (*uCol) * x; #endif ++uCol; } sol[column]=x; } else sol[column]=0.0; } for ( k=numberSlacks_-1; k>=0; --k ){ row=secRowOfU_[k]; column=colOfU_[k]; sol[column]=-rhs[row]; } } void CoinSimpFactorization::Uxeqb2(double *b1, double *sol1, double *b2, double *sol2) const { double *rhs1=b1; double *rhs2=b2; int row, column, colBeg, *ind, *indEnd; double x1, x2, *uCol; // now solve for ( int k=numberRows_-1; k>=numberSlacks_; --k ){ row=secRowOfU_[k]; x1=rhs1[row]; x2=rhs2[row]; column=colOfU_[k]; if (x1 == 0.0) { if (x2 == 0.0) { sol1[column]=0.0; sol2[column]=0.0; } else { x2*=invOfPivots_[row]; colBeg=UcolStarts_[column]; ind=UcolInd_+colBeg; indEnd=ind+UcolLengths_[column]; uCol=Ucolumns_+colBeg; for ( ; ind!=indEnd; ++ind ){ #if 0 rhs2[ *ind ]-= (*uCol) * x2; #else double value=rhs2[ *ind ]; rhs2[ *ind ]= value - (*uCol) * x2; #endif ++uCol; } sol1[column]=0.0; sol2[column]=x2; } } else { if (x2 == 0.0) { x1*=invOfPivots_[row]; colBeg=UcolStarts_[column]; ind=UcolInd_+colBeg; indEnd=ind+UcolLengths_[column]; uCol=Ucolumns_+colBeg; for ( ; ind!=indEnd; ++ind ){ #if 0 rhs1[ *ind ]-= (*uCol) * x1; #else double value=rhs1[ *ind ]; rhs1[ *ind ] = value - (*uCol) * x1; #endif ++uCol; } sol1[column]=x1; sol2[column]=0.0; } else { x1*=invOfPivots_[row]; x2*=invOfPivots_[row]; colBeg=UcolStarts_[column]; ind=UcolInd_+colBeg; indEnd=ind+UcolLengths_[column]; uCol=Ucolumns_+colBeg; for ( ; ind!=indEnd; ++ind ){ #if 0 rhs1[ *ind ]-= (*uCol) * x1; rhs2[ *ind ]-= (*uCol) * x2; #else double value1=rhs1[ *ind ]; rhs1[ *ind ] = value1 - (*uCol) * x1; double value2=rhs2[ *ind ]; rhs2[ *ind ] = value2 - (*uCol) * x2; #endif ++uCol; } sol1[column]=x1; sol2[column]=x2; } } } for ( int k=numberSlacks_-1; k>=0; --k ){ row=secRowOfU_[k]; column=colOfU_[k]; sol1[column]=-rhs1[row]; sol2[column]=-rhs2[row]; } } void CoinSimpFactorization::xLeqb(double *b) const { double *rhs=b; int k, *ind, *indEnd, j; int colBeg; double x, *Lcol; // find last nonzero int last; for ( last=numberColumns_-1; last >= 0; --last ){ if ( rhs[ rowOfU_[last] ] ) break; } // this seems to be faster if ( last >= 0 ){ for ( j=last; j >=firstNumberSlacks_ ; --j ){ k=rowOfU_[j]; x=rhs[k]; colBeg=LcolStarts_[k]; ind=LcolInd_+colBeg; indEnd=ind+LcolLengths_[k]; Lcol=Lcolumns_+colBeg; for ( ; ind!=indEnd; ++ind ){ x -= (*Lcol) * rhs[ *ind ]; ++Lcol; } rhs[k]=x; } } // if ( last >= 0 ){ } void CoinSimpFactorization::xUeqb(double *b, double *sol) const { double *rhs=b; int row, col, *ind, *indEnd, k; double xr; // now solve #if 1 int rowBeg; double * uRow; for ( k=0; k zeroTolerance_ ) { xr=-xr; rowBeg=UrowStarts_[row]; ind=UrowInd_+rowBeg; indEnd=ind+UrowLengths_[row]; uRow=Urows_+rowBeg; for ( ; ind!=indEnd; ++ind ){ rhs[ *ind ]-= (*uRow) * xr; ++uRow; } sol[row]=xr; } else sol[row]=0.0; } for ( k=numberSlacks_; k zeroTolerance_ ) { xr*=invOfPivots_[row]; rowBeg=UrowStarts_[row]; ind=UrowInd_+rowBeg; indEnd=ind+UrowLengths_[row]; uRow=Urows_+rowBeg; for ( ; ind!=indEnd; ++ind ){ rhs[ *ind ]-= (*uRow) * xr; ++uRow; } sol[row]=xr; } else sol[row]=0.0; } #else for ( k=0; k= 0); // remove from row const int rowEnd=UrowStarts_[row]+UrowLengths_[row]; Urows_[colInRow]=Urows_[rowEnd-1]; UrowInd_[colInRow]=UrowInd_[rowEnd-1]; --UrowLengths_[row]; } UcolLengths_[newBasicCol]=0; // now add new column to U int lastRowInU=-1; for ( int i=0; i < sizeNewColumn; ++i ){ //if ( fabs(newColumn[i]) < zeroTolerance_ ) continue; const int row=indNewColumn[i]; // add to row #ifdef COIN_SIMP_CAPACITY if ( UrowLengths_[row] + 1 > UrowCapacities_[row] ) increaseRowSize(row, UrowLengths_[row] + 1); #endif const int rowEnd=UrowStarts_[row]+UrowLengths_[row]; UrowInd_[rowEnd]=newBasicCol; Urows_[rowEnd]=newColumn[i]; ++UrowLengths_[row]; if ( lastRowInU < secRowPosition_[row] ) lastRowInU=secRowPosition_[row]; } // add to Ucolumns #ifdef COIN_SIMP_CAPACITY if ( sizeNewColumn > UcolCapacities_[newBasicCol] ) increaseColSize(newBasicCol, sizeNewColumn , true); #endif memcpy(&Ucolumns_[ UcolStarts_[newBasicCol] ], &newColumn[0], sizeNewColumn * sizeof(double) ); memcpy(&UcolInd_[ UcolStarts_[newBasicCol] ], &indNewColumn[0], sizeNewColumn * sizeof(int) ); UcolLengths_[newBasicCol]=sizeNewColumn; const int posNewCol=colPosition_[newBasicCol]; if ( lastRowInU < posNewCol ){ // matrix is singular return 1; } // permutations const int rowInU=secRowOfU_[posNewCol]; const int colInU=colOfU_[posNewCol]; for ( int i=posNewCol; i= numberSlacks_ ) --numberSlacks_; else numberSlacks_= lastRowInU; } // rowInU will be transformed // denseVector_ is assumed to be initialized to zero const int rowBeg=UrowStarts_[rowInU]; const int rowEnd=rowBeg+UrowLengths_[rowInU]; for ( int i=rowBeg; i= 0 ); const int colEnd=UcolStarts_[column]+UcolLengths_[column]; UcolInd_[indxRow]=UcolInd_[colEnd-1]; Ucolumns_[indxRow]=Ucolumns_[colEnd-1]; --UcolLengths_[column]; } UrowLengths_[rowInU]=0; // rowInU is empty // increase Eta by (lastRowInU-posNewCol) elements newEta(rowInU, lastRowInU-posNewCol ); assert(!EtaLengths_[lastEtaRow_]); int saveSize = EtaSize_;; for ( int i=posNewCol; i UcolCapacities_[column] ){ increaseColSize(column, UcolLengths_[column] + 1, true); } #endif const int newInd=UcolStarts_[column]+UcolLengths_[column]; UcolInd_[newInd]=rowInU; Ucolumns_[newInd]=coeff; ++UcolLengths_[column]; workArea2_[newEls]=coeff; indVector_[newEls++]=column; } #ifdef COIN_SIMP_CAPACITY if ( UrowCapacities_[rowInU] < newEls ) increaseRowSize(rowInU, newEls); #endif const int startRow=UrowStarts_[rowInU]; memcpy(&Urows_[startRow],&workArea2_[0], newEls*sizeof(double) ); memcpy(&UrowInd_[startRow],&indVector_[0], newEls*sizeof(int) ); UrowLengths_[rowInU]=newEls; // if ( fabs( invOfPivots_[rowInU] ) > updateTol_ ) return 2; return 0; } void CoinSimpFactorization::newEta(int row, int numNewElements){ if ( lastEtaRow_ == maxEtaRows_-1 ){ int *iaux=new int[maxEtaRows_ + minIncrease_]; memcpy(iaux, EtaPosition_, maxEtaRows_ * sizeof(int)); delete [] EtaPosition_; EtaPosition_=iaux; int *jaux=new int[maxEtaRows_ + minIncrease_]; memcpy(jaux, EtaStarts_, maxEtaRows_ * sizeof(int)); delete [] EtaStarts_; EtaStarts_=jaux; int *kaux=new int[maxEtaRows_ + minIncrease_]; memcpy(kaux, EtaLengths_, maxEtaRows_ * sizeof(int)); delete [] EtaLengths_; EtaLengths_=kaux; maxEtaRows_+=minIncrease_; } if ( EtaSize_ + numNewElements > EtaMaxCap_ ){ int number= CoinMax(EtaSize_ + numNewElements - EtaMaxCap_, minIncrease_); int *iaux=new int[EtaMaxCap_ + number]; memcpy(iaux, EtaInd_, EtaSize_ * sizeof(int)); delete [] EtaInd_; EtaInd_=iaux; double *aux=new double[EtaMaxCap_ + number]; memcpy(aux, Eta_, EtaSize_ * sizeof(double)); delete [] Eta_; Eta_=aux; EtaMaxCap_+=number; } EtaPosition_[++lastEtaRow_]=row; EtaStarts_[lastEtaRow_]=EtaSize_; EtaLengths_[lastEtaRow_]=0; } void CoinSimpFactorization::copyRowPermutations() { memcpy(&secRowOfU_[0], &rowOfU_[0], numberRows_ * sizeof(int) ); memcpy(&secRowPosition_[0], &rowPosition_[0], numberRows_ * sizeof(int) ); } void CoinSimpFactorization::Hxeqb(double *b) const { double *rhs=b; int row, rowBeg, *ind, *indEnd; double xr, *eta; // now solve for ( int k=0; k <= lastEtaRow_; ++k ){ row=EtaPosition_[k]; rowBeg=EtaStarts_[k]; xr=0.0; ind=EtaInd_+rowBeg; indEnd=ind+EtaLengths_[k]; eta=Eta_+rowBeg; for ( ; ind!=indEnd; ++ind ){ xr += rhs[ *ind ] * (*eta); ++eta; } rhs[row]-=xr; } } void CoinSimpFactorization::Hxeqb2(double *b1, double *b2) const { double *rhs1=b1; double *rhs2=b2; int row, rowBeg, *ind, *indEnd; double x1, x2, *eta; // now solve for ( int k=0; k <= lastEtaRow_; ++k ){ row=EtaPosition_[k]; rowBeg=EtaStarts_[k]; x1=0.0; x2=0.0; ind=EtaInd_+rowBeg; indEnd=ind+EtaLengths_[k]; eta=Eta_+rowBeg; for ( ; ind!=indEnd; ++ind ){ x1 += rhs1[ *ind ] * (*eta); x2 += rhs2[ *ind ] * (*eta); ++eta; } rhs1[row]-=x1; rhs2[row]-=x2; } } void CoinSimpFactorization::xHeqb(double *b) const { double *rhs=b; int row, rowBeg, *ind, *indEnd; double xr, *eta; // now solve for ( int k=lastEtaRow_; k >= 0; --k ){ row=EtaPosition_[k]; xr=rhs[row]; if ( xr==0.0 ) continue; //if ( fabs(xr) <= zeroTolerance_ ) continue; rowBeg=EtaStarts_[k]; ind=EtaInd_+rowBeg; indEnd=ind+EtaLengths_[k]; eta=Eta_+rowBeg; for ( ; ind!=indEnd; ++ind ){ rhs[ *ind ]-= xr * (*eta); ++eta; } } } void CoinSimpFactorization::ftran(double *b, double *sol, bool save) const { Lxeqb(b); Hxeqb(b); if ( save ){ // keep vector keepSize_=0; for ( int i=0; i #include #include #include "CoinPragma.hpp" #include "CoinParam.hpp" /* Constructors and destructors There's a generic constructor and one for integer, double, keyword, string, and action parameters. */ /* Default constructor. */ CoinParam::CoinParam () : type_(coinParamInvalid), name_(), lengthName_(0), lengthMatch_(0), lowerDblValue_(0.0), upperDblValue_(0.0), dblValue_(0.0), lowerIntValue_(0), upperIntValue_(0), intValue_(0), strValue_(), definedKwds_(), currentKwd_(-1), pushFunc_(0), pullFunc_(0), shortHelp_(), longHelp_(), display_(false) { /* Nothing to be done here */ } /* Constructor for double parameter */ CoinParam::CoinParam (std::string name, std::string help, double lower, double upper, double dflt, bool display) : type_(coinParamDbl), name_(name), lengthName_(0), lengthMatch_(0), lowerDblValue_(lower), upperDblValue_(upper), dblValue_(dflt), lowerIntValue_(0), upperIntValue_(0), intValue_(0), strValue_(), definedKwds_(), currentKwd_(-1), pushFunc_(0), pullFunc_(0), shortHelp_(help), longHelp_(), display_(display) { processName() ; } /* Constructor for integer parameter */ CoinParam::CoinParam (std::string name, std::string help, int lower, int upper, int dflt, bool display) : type_(coinParamInt), name_(name), lengthName_(0), lengthMatch_(0), lowerDblValue_(0.0), upperDblValue_(0.0), dblValue_(0.0), lowerIntValue_(lower), upperIntValue_(upper), intValue_(dflt), strValue_(), definedKwds_(), currentKwd_(-1), pushFunc_(0), pullFunc_(0), shortHelp_(help), longHelp_(), display_(display) { processName() ; } /* Constructor for keyword parameter. */ CoinParam::CoinParam (std::string name, std::string help, std::string firstValue, int dflt, bool display) : type_(coinParamKwd), name_(name), lengthName_(0), lengthMatch_(0), lowerDblValue_(0.0), upperDblValue_(0.0), dblValue_(0.0), lowerIntValue_(0), upperIntValue_(0), intValue_(0), strValue_(), definedKwds_(), currentKwd_(dflt), pushFunc_(0), pullFunc_(0), shortHelp_(help), longHelp_(), display_(display) { processName() ; definedKwds_.push_back(firstValue) ; } /* Constructor for string parameter. */ CoinParam::CoinParam (std::string name, std::string help, std::string dflt, bool display) : type_(coinParamStr), name_(name), lengthName_(0), lengthMatch_(0), lowerDblValue_(0.0), upperDblValue_(0.0), dblValue_(0.0), lowerIntValue_(0), upperIntValue_(0), intValue_(0), strValue_(dflt), definedKwds_(), currentKwd_(0), pushFunc_(0), pullFunc_(0), shortHelp_(help), longHelp_(), display_(display) { processName() ; } /* Constructor for action parameter. */ CoinParam::CoinParam (std::string name, std::string help, bool display) : type_(coinParamAct), name_(name), lengthName_(0), lengthMatch_(0), lowerDblValue_(0.0), upperDblValue_(0.0), dblValue_(0.0), lowerIntValue_(0), upperIntValue_(0), intValue_(0), strValue_(), definedKwds_(), currentKwd_(0), pushFunc_(0), pullFunc_(0), shortHelp_(help), longHelp_(), display_(display) { processName() ; } /* Copy constructor. */ CoinParam::CoinParam (const CoinParam &orig) : type_(orig.type_), lengthName_(orig.lengthName_), lengthMatch_(orig.lengthMatch_), lowerDblValue_(orig.lowerDblValue_), upperDblValue_(orig.upperDblValue_), dblValue_(orig.dblValue_), lowerIntValue_(orig.lowerIntValue_), upperIntValue_(orig.upperIntValue_), intValue_(orig.intValue_), currentKwd_(orig.currentKwd_), pushFunc_(orig.pushFunc_), pullFunc_(orig.pullFunc_), display_(orig.display_) { name_ = orig.name_ ; strValue_ = orig.strValue_ ; definedKwds_ = orig.definedKwds_ ; shortHelp_ = orig.shortHelp_ ; longHelp_ = orig.longHelp_ ; } /* Clone */ CoinParam *CoinParam::clone () { return (new CoinParam(*this)) ; } CoinParam &CoinParam::operator= (const CoinParam &rhs) { if (this != &rhs) { type_ = rhs.type_ ; name_ = rhs.name_ ; lengthName_ = rhs.lengthName_ ; lengthMatch_ = rhs.lengthMatch_ ; lowerDblValue_ = rhs.lowerDblValue_ ; upperDblValue_ = rhs.upperDblValue_ ; dblValue_ = rhs.dblValue_ ; lowerIntValue_ = rhs.lowerIntValue_ ; upperIntValue_ = rhs.upperIntValue_ ; intValue_ = rhs.intValue_ ; strValue_ = rhs.strValue_ ; definedKwds_ = rhs.definedKwds_ ; currentKwd_ = rhs.currentKwd_ ; pushFunc_ = rhs.pushFunc_ ; pullFunc_ = rhs.pullFunc_ ; shortHelp_ = rhs.shortHelp_ ; longHelp_ = rhs.longHelp_ ; display_ = rhs.display_ ; } return *this ; } /* Destructor */ CoinParam::~CoinParam () { /* Nothing more to do */ } /* Methods to manipulate a CoinParam object. */ /* Process the parameter name. Process the name for efficient matching: determine if an `!' is present. If so, locate and record the position and remove the `!'. */ void CoinParam::processName() { std::string::size_type shriekPos = name_.find('!') ; lengthName_ = name_.length() ; if (shriekPos == std::string::npos) { lengthMatch_ = lengthName_ ; } else { lengthMatch_ = shriekPos ; name_ = name_.substr(0,shriekPos)+name_.substr(shriekPos+1) ; lengthName_-- ; } return ; } /* Check an input string to see if it matches the parameter name. The whole input string must match, and the length of the match must exceed the minimum match length. A match is impossible if the string is longer than the name. Returns: 0 for no match, 1 for a successful match, 2 if the match is short */ int CoinParam::matches (std::string input) const { size_t inputLen = input.length() ; if (inputLen <= lengthName_) { size_t i ; for (i = 0 ; i < inputLen ; i++) { if (tolower(name_[i]) != tolower(input[i])) break ; } if (i < inputLen) { return (0) ; } else if (i >= lengthMatch_) { return (1) ; } else { return (2) ; } } return (0) ; } /* Return the parameter name, formatted to indicate how it'll be matched. E.g., some!Name will come back as some(Name). */ std::string CoinParam::matchName () const { if (lengthMatch_ == lengthName_) { return name_ ; } else { return name_.substr(0,lengthMatch_)+"("+name_.substr(lengthMatch_)+")" ; } } /* Print the long help message and a message about appropriate values. */ void CoinParam::printLongHelp() const { if (longHelp_ != "") { CoinParamUtils::printIt(longHelp_.c_str()) ; } else if (shortHelp_ != "") { CoinParamUtils::printIt(shortHelp_.c_str()) ; } else { CoinParamUtils::printIt("No help provided.") ; } switch (type_) { case coinParamDbl: { std::cout << "" << std::endl ; assert (upperDblValue_>lowerDblValue_) ; break ; } case coinParamInt: { std::cout << "" << std::endl ; assert (upperIntValue_>lowerIntValue_) ; break ; } case coinParamKwd: { printKwds() ; break ; } case coinParamStr: { std::cout << "" ; } else { std::cout << "`" << strValue_ << "'>" ; } std::cout << std::endl ; break ; } case coinParamAct: { break ; } default: { std::cout << "!! invalid parameter type !!" << std::endl ; assert (false) ; } } } /* Methods to manipulate the value of a parameter. */ /* Methods to manipulate the values associated with a keyword parameter. */ /* Add a keyword to the list for a keyword parameter. */ void CoinParam::appendKwd (std::string kwd) { assert (type_ == coinParamKwd) ; definedKwds_.push_back(kwd) ; } /* Scan the keywords of a keyword parameter and return the integer index of the keyword matching the input, or -1 for no match. */ int CoinParam::kwdIndex (std::string input) const { assert (type_ == coinParamKwd) ; int whichItem = -1 ; size_t numberItems = definedKwds_.size() ; if (numberItems > 0) { size_t inputLen = input.length() ; size_t it ; /* Open a loop to check each keyword against the input string. We don't record the match length for keywords, so we need to check each one for an `!' and do the necessary preprocessing (record position and elide `!') before checking for a match of the required length. */ for (it = 0 ; it < numberItems ; it++) { std::string kwd = definedKwds_[it] ; std::string::size_type shriekPos = kwd.find('!') ; size_t kwdLen = kwd.length() ; size_t matchLen = kwdLen ; if (shriekPos != std::string::npos) { matchLen = shriekPos ; kwd = kwd.substr(0,shriekPos)+kwd.substr(shriekPos+1) ; kwdLen = kwd.length() ; } /* Match is possible only if input is shorter than the keyword. The entire input must match and the match must exceed the minimum length. */ if (inputLen <= kwdLen) { unsigned int i ; for (i = 0 ; i < inputLen ; i++) { if (tolower(kwd[i]) != tolower(input[i])) break ; } if (i >= inputLen && i >= matchLen) { whichItem = static_cast(it) ; break ; } } } } return (whichItem) ; } /* Set current value for a keyword parameter using a string. */ void CoinParam::setKwdVal (const std::string value) { assert (type_ == coinParamKwd) ; int action = kwdIndex(value) ; if (action >= 0) { currentKwd_ = action ; } } /* Set current value for keyword parameter using an integer. Echo the new value to cout if requested. */ void CoinParam::setKwdVal (int value, bool printIt) { assert (type_ == coinParamKwd) ; assert (value >= 0 && unsigned(value) < definedKwds_.size()) ; if (printIt && value != currentKwd_) { std::cout << "Option for " << name_ << " changed from " << definedKwds_[currentKwd_] << " to " << definedKwds_[value] << std::endl ; } currentKwd_ = value ; } /* Return the string corresponding to the current value. */ std::string CoinParam::kwdVal() const { assert (type_ == coinParamKwd) ; return (definedKwds_[currentKwd_]) ; } /* Print the keywords for a keyword parameter, formatted to indicate how they'll be matched. (E.g., some!Name prints as some(Name).). Follow with current value. */ void CoinParam::printKwds () const { assert (type_ == coinParamKwd) ; std::cout << "Possible options for " << name_ << " are:" ; unsigned int it ; int maxAcross = 5 ; for (it = 0 ; it < definedKwds_.size() ; it++) { std::string kwd = definedKwds_[it] ; std::string::size_type shriekPos = kwd.find('!') ; if (shriekPos != std::string::npos) { kwd = kwd.substr(0,shriekPos)+"("+kwd.substr(shriekPos+1)+")" ; } if (it%maxAcross == 0) { std::cout << std::endl ; } std::cout << " " << kwd ; } std::cout << std::endl ; assert (currentKwd_ >= 0 && unsigned(currentKwd_) < definedKwds_.size()) ; std::string current = definedKwds_[currentKwd_] ; std::string::size_type shriekPos = current.find('!') ; if (shriekPos != std::string::npos) { current = current.substr(0,shriekPos)+ "("+current.substr(shriekPos+1)+")" ; } std::cout << " " << std::endl ; } /* Methods to manipulate the value of a string parameter. */ void CoinParam::setStrVal (std::string value) { assert (type_ == coinParamStr) ; strValue_ = value ; } std::string CoinParam::strVal () const { assert (type_ == coinParamStr) ; return (strValue_) ; } /* Methods to manipulate the value of a double parameter. */ void CoinParam::setDblVal (double value) { assert (type_ == coinParamDbl) ; dblValue_ = value ; } double CoinParam::dblVal () const { assert (type_ == coinParamDbl) ; return (dblValue_) ; } /* Methods to manipulate the value of an integer parameter. */ void CoinParam::setIntVal (int value) { assert (type_ == coinParamInt) ; intValue_ = value ; } int CoinParam::intVal () const { assert (type_ == coinParamInt) ; return (intValue_) ; } /* A print function (friend of the class) */ std::ostream &operator<< (std::ostream &s, const CoinParam ¶m) { switch (param.type()) { case CoinParam::coinParamDbl: { return (s << param.dblVal()) ; } case CoinParam::coinParamInt: { return (s << param.intVal()) ; } case CoinParam::coinParamKwd: { return (s << param.kwdVal()) ; } case CoinParam::coinParamStr: { return (s << param.strVal()) ; } case CoinParam::coinParamAct: { return (s << "") ; } default: { return (s << "!! invalid parameter type !!") ; } } } CoinMP-1.8.3/CoinUtils/src/CoinOslFactorization.hpp0000644000175000017500000002036011552534611020634 0ustar renerene/* $Id: CoinOslFactorization.hpp 1416 2011-04-17 09:57:29Z stefan $ */ // Copyright (C) 1987, 2009, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef CoinOslFactorization_H #define CoinOslFactorization_H #include #include #include #include "CoinTypes.hpp" #include "CoinIndexedVector.hpp" #include "CoinDenseFactorization.hpp" class CoinPackedMatrix; /** This deals with Factorization and Updates This is ripped off from OSL!!!!!!!!! I am assuming that 32 bits is enough for number of rows or columns, but CoinBigIndex may be redefined to get 64 bits. */ typedef struct {int suc, pre;} EKKHlink; typedef struct _EKKfactinfo { double drtpiv; double demark; double zpivlu; double zeroTolerance; double areaFactor; int *xrsadr; int *xcsadr; int *xrnadr; int *xcnadr; int *krpadr; int *kcpadr; int *mpermu; int *bitArray; int * back; char * nonzero; double * trueStart; mutable double *kadrpm; int *R_etas_index; int *R_etas_start; double *R_etas_element; int *xecadr; int *xeradr; double *xeeadr; double *xe2adr; EKKHlink * kp1adr; EKKHlink * kp2adr; double * kw1adr; double * kw2adr; double * kw3adr; int * hpivcoR; int nrow; int nrowmx; int firstDoRow; int firstLRow; int maxinv; int nnetas; int iterin; int iter0; int invok; int nbfinv; int num_resets; int nnentl; int nnentu; #ifdef CLP_REUSE_ETAS int save_nnentu; #endif int ndenuc; int npivots; /* use as xpivsq in factorization */ int kmxeta; int xnetal; int first_dense; int last_dense; int iterno; int numberSlacks; int lastSlack; int firstNonSlack; int xnetalval; int lstart; int if_sparse_update; mutable int packedMode; int switch_off_sparse_update; int nuspike; bool rows_ok; /* replaces test using mrstrt[1] */ #ifdef CLP_REUSE_ETAS mutable int reintro; #endif int nR_etas; int sortedEta; /* if vector for F-T is sorted */ int lastEtaCount; int ifvsol; int eta_size; int last_eta_size; int maxNNetas; } EKKfactinfo; class CoinOslFactorization : public CoinOtherFactorization { friend void CoinOslFactorizationUnitTest( const std::string & mpsDir ); public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor CoinOslFactorization ( ); /// Copy constructor CoinOslFactorization ( const CoinOslFactorization &other); /// Destructor virtual ~CoinOslFactorization ( ); /// = copy CoinOslFactorization & operator = ( const CoinOslFactorization & other ); /// Clone virtual CoinOtherFactorization * clone() const ; //@} /**@name Do factorization - public */ //@{ /// Gets space for a factorization virtual void getAreas ( int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ); /// PreProcesses column ordered copy of basis virtual void preProcess ( ); /** Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use numberGoodColumns and redo */ virtual int factor ( ); /// Does post processing on valid factorization - putting variables on correct rows virtual void postProcess(const int * sequence, int * pivotVariable); /// Makes a non-singular basis by replacing variables virtual void makeNonSingular(int * sequence, int numberColumns); /** When part of LP - given by basic variables. Actually does factorization. Arrays passed in have non negative value to say basic. If status is okay, basic variables have pivot row - this is only needed If status is singular, then basic variables have pivot row and ones thrown out have -1 returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */ int factorize ( const CoinPackedMatrix & matrix, int rowIsBasic[], int columnIsBasic[] , double areaFactor = 0.0 ); //@} /**@name general stuff such as number of elements */ //@{ /// Total number of elements in factorization virtual inline int numberElements ( ) const { return numberRows_*(numberColumns_+numberPivots_); } /// Returns array to put basis elements in virtual CoinFactorizationDouble * elements() const; /// Returns pivot row virtual int * pivotRow() const; /// Returns work area virtual CoinFactorizationDouble * workArea() const; /// Returns int work area virtual int * intWorkArea() const; /// Number of entries in each row virtual int * numberInRow() const; /// Number of entries in each column virtual int * numberInColumn() const; /// Returns array to put basis starts in virtual CoinBigIndex * starts() const; /// Returns permute back virtual int * permuteBack() const; /// Returns true if wants tableauColumn in replaceColumn virtual bool wantsTableauColumn() const; /** Useful information for factorization 0 - iteration number whereFrom is 0 for factorize and 1 for replaceColumn */ virtual void setUsefulInformation(const int * info,int whereFrom); /// Set maximum pivots virtual void maximumPivots ( int value ); /// Returns maximum absolute value in factorization double maximumCoefficient() const; /// Condition number - product of pivots after factorization double conditionNumber() const; /// Get rid of all memory virtual void clearArrays(); //@} /**@name rank one updates which do exist */ //@{ /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U */ virtual int replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow, double pivotCheck , bool checkBeforeModifying=false, double acceptablePivot=1.0e-8); //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output */ virtual int updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false); /** This version has same effect as above with FTUpdate==false so number returned is always >=0 */ virtual int updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false) const; /// does FTRAN on two columns virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermute=false); /** Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output */ virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; //@} /// *** Below this user may not want to know about /**@name various uses of factorization which user may not want to know about (left over from my LP code) */ //@{ /// Get rid of all memory //inline void clearArrays() //{ gutsOfDestructor();} /// Returns array to put basis indices in virtual int * indices() const; /// Returns permute in virtual inline int * permute() const { return NULL;/*pivotRow_*/;} //@} /// The real work of desstructor void gutsOfDestructor(bool clearFact=true); /// The real work of constructor void gutsOfInitialize(bool zapFact=true); /// The real work of copy void gutsOfCopy(const CoinOslFactorization &other); //@} protected: /** Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular */ int checkPivot(double saveFromU, double oldPivot) const; ////////////////// data ////////////////// protected: /**@name data */ //@{ /// Osl factorization data EKKfactinfo factInfo_; //@} }; #endif CoinMP-1.8.3/CoinUtils/src/CoinRational.cpp0000644000175000017500000000305012457613543017112 0ustar renerene// Authors: Matthew Saltzman and Ted Ralphs // Copyright 2015, Matthew Saltzman and Ted Ralphs // Licensed under the Eclipse Public License 1.0 #include #include #ifdef __clang__ //labs() is in cstdlib with clang #include #endif #include "CoinRational.hpp" // Based on Python code from // http://www.johndcook.com/blog/2010/10/20/best-rational-approximation/ // (with permission). // // Returns closest (or almost, anyway) rational to val with denominator less // than or equal to maxdnom. Return value is true if within tolerance, false // otherwise. bool CoinRational::nearestRational_(double val, double maxdelta, long maxdnom) { double intpart; double fracpart = fabs(modf(val, &intpart)); // Consider using remainder() instead? long a = 0, b = 1, c = 1, d = 1; while ( b <= maxdnom && d <= maxdnom) { double mediant = (a + c)/(double(b + d)); if ( fracpart == mediant ) { if ( b + d <= maxdnom ) { numerator_ = a + c; denominator_ = b + d; } else if ( d > b ) { numerator_ = c; denominator_ = d; } else { numerator_ = a; denominator_ = b; } } else if ( val > mediant ) { a = a + c; b = b + d; } else { c = a + c; d = b + d; } if ( b > maxdnom ) { numerator_ = c; denominator_ = d; } else { numerator_ = a; denominator_ = b; } } numerator_ += labs(intpart) * denominator_; if ( val < 0 ) numerator_ *= -1; return fabs(val - numerator_/double(denominator_)) <= maxdelta; } CoinMP-1.8.3/CoinUtils/src/CoinOslFactorization2.cpp0000644000175000017500000032702212130031043020676 0ustar renerene/* $Id: CoinOslFactorization2.cpp 1582 2013-04-06 14:33:07Z stefan $ */ /* Copyright (C) 1987, 2009, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ /* CLP_OSL - if defined use osl 0 - don't unroll 2 and 3 - don't use in Gomory 1 - don't unroll - do use in Gomory 2 - unroll - don't use in Gomory 3 - unroll and use in Gomory */ #include "CoinOslFactorization.hpp" #include "CoinOslC.h" #include "CoinFinite.hpp" #ifndef NDEBUG extern int ets_count; extern int ets_check; #endif #define COIN_REGISTER register #define COIN_REGISTER2 #define COIN_REGISTER3 register #ifdef COIN_USE_RESTRICT # define COIN_RESTRICT2 __restrict #else # define COIN_RESTRICT2 #endif static int c_ekkshfpo_scan2zero(COIN_REGISTER const EKKfactinfo * COIN_RESTRICT2 fact,const int * COIN_RESTRICT mpermu, double *COIN_RESTRICT worki, double *COIN_RESTRICT worko, int * COIN_RESTRICT mptr) { /* Local variables */ int irow; double tolerance = fact->zeroTolerance; int nin=fact->nrow; int * COIN_RESTRICT mptrX=mptr; if ((nin&1)!=0) { irow=1; if (fact->packedMode) { int irow0= *mpermu; double dval; assert (irow0>=1&&irow0<=nin); mpermu++; dval=worki[irow0]; if (NOT_ZERO(dval)) { worki[irow0]=0.0; if (fabs(dval) >= tolerance) { *(worko++)=dval; *(mptrX++) = 0; } } } else { int irow0= *mpermu; double dval; assert (irow0>=1&&irow0<=nin); mpermu++; dval=worki[irow0]; if (NOT_ZERO(dval)) { worki[irow0]=0.0; if (fabs(dval) >= tolerance) { *worko=dval; *(mptrX++) = 0; } } worko++; } } else { irow=0; } if (fact->packedMode) { for (; irow < nin; irow+=2) { int irow0,irow1; double dval0,dval1; irow0=mpermu[0]; irow1=mpermu[1]; assert (irow0>=1&&irow0<=nin); assert (irow1>=1&&irow1<=nin); dval0=worki[irow0]; dval1=worki[irow1]; if (NOT_ZERO(dval0)) { worki[irow0]=0.0; if (fabs(dval0) >= tolerance) { *(worko++)=dval0; *(mptrX++) = irow+0; } } if (NOT_ZERO(dval1)) { worki[irow1]=0.0; if (fabs(dval1) >= tolerance) { *(worko++)=dval1; *(mptrX++) = irow+1; } } mpermu+=2; } } else { for (; irow < nin; irow+=2) { int irow0,irow1; double dval0,dval1; irow0=mpermu[0]; irow1=mpermu[1]; assert (irow0>=1&&irow0<=nin); assert (irow1>=1&&irow1<=nin); dval0=worki[irow0]; dval1=worki[irow1]; if (NOT_ZERO(dval0)) { worki[irow0]=0.0; if (fabs(dval0) >= tolerance) { worko[0]=dval0; *(mptrX++) = irow+0; } } if (NOT_ZERO(dval1)) { worki[irow1]=0.0; if (fabs(dval1) >= tolerance) { worko[1]=dval1; *(mptrX++) = irow+1; } } mpermu+=2; worko+=2; } } return static_cast(mptrX-mptr); } /* * c_ekkshfpi_list executes the following loop: * * for (k=nincol, i=1; k; k--, i++) { * int ipt = mptr[i]; * int irow = mpermu[ipt]; * worko[mpermu[irow]] = worki[i]; * worki[i] = 0.0; * } */ static int c_ekkshfpi_list(const int *COIN_RESTRICT mpermu, double *COIN_RESTRICT worki, double *COIN_RESTRICT worko, const int * COIN_RESTRICT mptr, int nincol, int * lastNonZero) { int i,k,irow0,irow1; int first=COIN_INT_MAX; int last=0; /* worko was zeroed out outside */ k = nincol; i = 0; if ((k&1)!=0) { int ipt=mptr[i]; irow0=mpermu[ipt]; first = CoinMin(irow0,first); last = CoinMax(irow0,last); i++; worko[irow0]=*worki; *worki++=0.0; } k=k>>1; for (; k; k--) { int ipt0 = mptr[i]; int ipt1 = mptr[i+1]; irow0 = mpermu[ipt0]; irow1 = mpermu[ipt1]; i+=2; first = CoinMin(irow0,first); last = CoinMax(irow0,last); first = CoinMin(irow1,first); last = CoinMax(irow1,last); worko[irow0] = worki[0]; worko[irow1] = worki[1]; worki[0]=0.0; worki[1]=0.0; worki+=2; } *lastNonZero=last; return first; } /* * c_ekkshfpi_list2 executes the following loop: * * for (k=nincol, i=1; k; k--, i++) { * int ipt = mptr[i]; * int irow = mpermu[ipt]; * worko[mpermu[irow]] = worki[ipt]; * worki[ipt] = 0.0; * } */ static int c_ekkshfpi_list2(const int *COIN_RESTRICT mpermu, double *COIN_RESTRICT worki, double *COIN_RESTRICT worko, const int * COIN_RESTRICT mptr, int nincol, int * lastNonZero) { #if 1 int i,k,irow0,irow1; int first=COIN_INT_MAX; int last=0; /* worko was zeroed out outside */ k = nincol; i = 0; if ((k&1)!=0) { int ipt=mptr[i]; irow0=mpermu[ipt]; first = CoinMin(irow0,first); last = CoinMax(irow0,last); i++; worko[irow0]=worki[ipt]; worki[ipt]=0.0; } k=k>>1; for (; k; k--) { int ipt0 = mptr[i]; int ipt1 = mptr[i+1]; irow0 = mpermu[ipt0]; irow1 = mpermu[ipt1]; i+=2; first = CoinMin(irow0,first); last = CoinMax(irow0,last); first = CoinMin(irow1,first); last = CoinMax(irow1,last); worko[irow0] = worki[ipt0]; worko[irow1] = worki[ipt1]; worki[ipt0]=0.0; worki[ipt1]=0.0; } #else int first=COIN_INT_MAX; int last=0; /* worko was zeroed out outside */ for (int i=0; i>1; for (; k; k--) { int ipt0 = mptr[i]; int ipt1 = mptr[i+1]; irow0 = mpermu[ipt0]; irow1 = mpermu[ipt1]; mptr[i] = irow0; mptr[i+1] = irow1; i+=2; worko[irow0] = worki[0]; worko[irow1] = worki[1]; worki[0]=0.0; worki[1]=0.0; worki+=2; } } static int c_ekkscmv(COIN_REGISTER const EKKfactinfo * COIN_RESTRICT2 fact,int n, double *COIN_RESTRICT dwork, int *COIN_RESTRICT mptr, double *COIN_RESTRICT dwork2) { double tolerance = fact->zeroTolerance; int irow; const int * COIN_RESTRICT mptrsave = mptr; double * COIN_RESTRICT dwhere = dwork+1; if ((n&1)!=0) { if (NOT_ZERO(*dwhere)) { if (fabs(*dwhere) >= tolerance) { *++dwork2 = *dwhere; *++mptr = SHIFT_INDEX(1); } else { *dwhere = 0.0; } } dwhere++; irow=2; } else { irow=1; } for (n=n>>1;n;n--) { int second = NOT_ZERO(*(dwhere+1)); if (NOT_ZERO(*dwhere)) { if (fabs(*dwhere) >= tolerance) { *++dwork2 = *dwhere; *++mptr = SHIFT_INDEX(irow); } else { *dwhere = 0.0; } } if (second) { if (fabs(*(dwhere+1)) >= tolerance) { *++dwork2 = *(dwhere+1); *++mptr = SHIFT_INDEX(irow+1); } else { *(dwhere+1) = 0.0; } } dwhere+=2; irow+=2; } return static_cast(mptr-mptrsave); } /* c_ekkscmv */ double c_ekkputl(const EKKfactinfo * COIN_RESTRICT2 fact, const int *COIN_RESTRICT mpt2, double *COIN_RESTRICT dwork1, double del3, int nincol, int nuspik) { double * COIN_RESTRICT dwork3 = fact->xeeadr+fact->nnentu; int * COIN_RESTRICT hrowi = fact->xeradr+fact->nnentu; int offset = fact->R_etas_start[fact->nR_etas+1]; int *COIN_RESTRICT hrowiR = fact->R_etas_index+offset; double *COIN_RESTRICT dluval = fact->R_etas_element+offset; int i, j; /* dwork1 is r', the new R transform * dwork3 is the updated incoming column, alpha_p * del3 apparently has the pivot of the incoming column (???). * Here, we compute the p'th element of R^-1 alpha_p * (as described on p. 273), which is just a dot product. * I don't know why we subtract. */ for (i = 1; i <= nuspik; ++i) { j = UNSHIFT_INDEX(hrowi[ i]); del3 -= dwork3[i] * dwork1[j]; } /* here we finally copy the r' to where we want it, the end */ /* also take into account that the p'th row of R^-1 is -(p'th row of R). */ /* also zero out dwork1 as we go */ for (i = 0; i < nincol; ++i) { j = mpt2[i]; hrowiR[ - i ] = SHIFT_INDEX(j); dluval[ - i ] = -dwork1[j]; dwork1[j] = 0.; } return del3; } /* c_ekkputl */ /* making this static seems to slow code down! may be being inlined */ int c_ekkputl2( const EKKfactinfo * COIN_RESTRICT2 fact, double *COIN_RESTRICT dwork1, double *del3p, int nuspik) { double * COIN_RESTRICT dwork3 = fact->xeeadr+fact->nnentu; int * COIN_RESTRICT hrowi = fact->xeradr+fact->nnentu; int offset = fact->R_etas_start[fact->nR_etas+1]; int *COIN_RESTRICT hrowiR = fact->R_etas_index+offset; double *COIN_RESTRICT dluval = fact->R_etas_element+offset; int i, j; #if 0 int nincol=c_ekksczr(fact,fact->nrow,dwork1,hrowiR); #else int nrow=fact->nrow; const double tolerance = fact->zeroTolerance; int * COIN_RESTRICT mptrX=hrowiR; for (i = 1; i <= nrow; ++i) { if (dwork1[i] != 0.) { if (fabs(dwork1[i]) >= tolerance) { *(mptrX--) = SHIFT_INDEX(i); } else { dwork1[i] = 0.0; } } } int nincol=static_cast(hrowiR-mptrX); #endif double del3 = *del3p; /* dwork1 is r', the new R transform * dwork3 is the updated incoming column, alpha_p * del3 apparently has the pivot of the incoming column (???). * Here, we compute the p'th element of R^-1 alpha_p * (as described on p. 273), which is just a dot product. * I don't know why we subtract. */ for (i = 1; i <= nuspik; ++i) { j = UNSHIFT_INDEX(hrowi[ i]); del3 -= dwork3[i] * dwork1[j]; } /* here we finally copy the r' to where we want it, the end */ /* also take into account that the p'th row of R^-1 is -(p'th row of R). */ /* also zero out dwork1 as we go */ for (i = 0; i < nincol; ++i) { j = UNSHIFT_INDEX(hrowiR[-i]); dluval[ - i ] = -dwork1[j]; dwork1[j] = 0.; } *del3p = del3; return nincol; } /* c_ekkputl */ static void c_ekkbtj4p_no_dense(const int nrow,const double * COIN_RESTRICT dluval, const int * COIN_RESTRICT hrowi, const int * COIN_RESTRICT mcstrt, double * COIN_RESTRICT dwork1, int ndo,int jpiv) { int i; double dv1; int iel; int irow; int i1,i2; /* count down to first nonzero */ for (i=nrow;i >=1;i--) { if (dwork1[i]) { break; } } i--; /* as pivot is just 1.0 */ if (i>ndo+jpiv) { i=ndo+jpiv; } mcstrt -= jpiv; i2=mcstrt[i+1]; for (; i > jpiv; --i) { double dv1b=0.0; int nel; i1 = mcstrt[i]; nel= i1-i2; dv1 = dwork1[i]; iel=i2; if ((nel&1)!=0) { irow = hrowi[iel]; dv1b = SHIFT_REF(dwork1, irow) * dluval[iel]; iel++; } for ( ; iel < i1; iel+=2) { int irow = hrowi[iel]; int irowb = hrowi[iel+1]; dv1 += SHIFT_REF(dwork1, irow) * dluval[iel]; dv1b += SHIFT_REF(dwork1, irowb) * dluval[iel+1]; } i2=i1; dwork1[i] = dv1+dv1b; } } /* c_ekkbtj4 */ static int c_ekkbtj4p_dense(const int nrow,const double * COIN_RESTRICT dluval, const int * COIN_RESTRICT hrowi, const int * COIN_RESTRICT mcstrt, double * COIN_RESTRICT dwork1, int ndenuc, int ndo,int jpiv) { int i; int i2; int last=ndo-ndenuc+1; double * COIN_RESTRICT densew = &dwork1[nrow-1]; int nincol=0; const double * COIN_RESTRICT dlu1; dluval--; hrowi--; /* count down to first nonzero */ for (i=nrow;i >=1;i--) { if (dwork1[i]) { break; } } if (ilast; i-=2) { int k; double dv1,dv2; const double * COIN_RESTRICT dlu2; dv1=densew[1]; dlu2=dlu1+nincol; dv2=densew[0]; for (k=0;k jpiv+1; i-=2) { int i1 = mcstrt[i]; double dv1 = dwork1[i]; double dv2; for (; iel < i1; iel++) { int irow = hrowi[iel]; dv1 += SHIFT_REF(dwork1, irow) * dluval[iel]; } i1 = mcstrt[i-1]; dv2 = dwork1[i-1]; dwork1[i] = dv1; for (; iel < i1; iel++) { int irow = hrowi[iel]; dv2 += SHIFT_REF(dwork1, irow) * dluval[iel]; } dwork1[i-1] = dv2; } if (i>jpiv) { int i1 = mcstrt[i]; double dv1 = dwork1[i]; for (; iel < i1; iel++) { int irow = hrowi[iel]; dv1 += SHIFT_REF(dwork1, irow) * dluval[iel]; } dwork1[i] = dv1; } } static void c_ekkbtj4p(COIN_REGISTER const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1) { int lstart=fact->lstart; const int * COIN_RESTRICT hpivco = fact->kcpadr; const double * COIN_RESTRICT dluval = fact->xeeadr+1; const int * COIN_RESTRICT hrowi = fact->xeradr+1; const int * COIN_RESTRICT mcstrt = fact->xcsadr+lstart-1; int jpiv=hpivco[lstart]-1; int ndo=fact->xnetalval; /* see if dense enough to unroll */ if (fact->ndenuc<5) { c_ekkbtj4p_no_dense(fact->nrow,dluval,hrowi,mcstrt,dwork1,ndo,jpiv); } else { int i = c_ekkbtj4p_dense(fact->nrow,dluval,hrowi,mcstrt,dwork1, fact->ndenuc, ndo,jpiv); c_ekkbtj4p_after_dense(dluval,hrowi,mcstrt,dwork1,i,jpiv); } } /* c_ekkbtj4p */ static int c_ekkbtj4_sparse(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, /* C style */ double * COIN_RESTRICT dworko, int nincol, int * COIN_RESTRICT spare) { const int nrow = fact->nrow; const int * COIN_RESTRICT hcoli = fact->xecadr; const int * COIN_RESTRICT mrstrt = fact->xrsadr+nrow; char * COIN_RESTRICT nonzero = fact->nonzero; const int * COIN_RESTRICT hpivro = fact->krpadr; const double * COIN_RESTRICT de2val = fact->xe2adr-1; double tolerance = fact->zeroTolerance; double dv; int iel; int k,nStack,kx; int nList=0; int * COIN_RESTRICT list = spare; int * COIN_RESTRICT stack = spare+nrow; int * COIN_RESTRICT next = stack+nrow; int iPivot,kPivot; int iput,nput=0,kput=nrow; int j; int firstDoRow=fact->firstDoRow; for (k=0;k=firstDoRow) { stack[0]=iPivot; next[0]=mrstrt[iPivot]; while (nStack) { /* take off stack */ kPivot=stack[--nStack]; if (nonzero[kPivot]!=1&&kPivot>=firstDoRow) { j=next[nStack]; if (j==mrstrt[kPivot+1]) { /* finished so mark */ list[nList++]=kPivot; nonzero[kPivot]=1; } else { kPivot=hcoli[j]; /* put back on stack */ next[nStack++] ++; if (!nonzero[kPivot]) { /* and new one */ stack[nStack]=kPivot; nonzero[kPivot]=2; next[nStack++]=mrstrt[kPivot]; } } } else if (kPivotpackedMode) { dworko++; for (k=nList-1;k>=0;k--) { double dv; iPivot = list[k]; dv = dwork1[iPivot]; dwork1[iPivot]=0.0; nonzero[iPivot]=0; if (fabs(dv) > tolerance) { iput=hpivro[iPivot]; kx=mrstrt[iPivot]; dworko[nput]=dv; for (iel = kx; iel < mrstrt[iPivot+1]; iel++) { double dval; int irow = hcoli[iel]; dval=de2val[iel]; dwork1[irow] += dv*dval; } mpt[nput++]=iput-1; } else { dwork1[iPivot]=0.0; /* force to zero, not just near zero */ } } /* check remainder */ for (k=kput;k tolerance) { dworko[nput]=dv; mpt[nput++]=iput-1; } } } else { /* not packed */ for (k=nList-1;k>=0;k--) { double dv; iPivot = list[k]; dv = dwork1[iPivot]; dwork1[iPivot]=0.0; nonzero[iPivot]=0; if (fabs(dv) > tolerance) { iput=hpivro[iPivot]; kx=mrstrt[iPivot]; dworko[iput]=dv; for (iel = kx; iel < mrstrt[iPivot+1]; iel++) { double dval; int irow = hcoli[iel]; dval=de2val[iel]; dwork1[irow] += dv*dval; } mpt[nput++]=iput-1; } else { dwork1[iPivot]=0.0; /* force to zero, not just near zero */ } } /* check remainder */ for (k=kput;k tolerance) { dworko[iput]=dv; mpt[nput++]=iput-1; } } } return (nput); } /* c_ekkbtj4 */ static void c_ekkbtjl(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1) { int i, j, k, k1; int l1; const double * COIN_RESTRICT dluval = fact->R_etas_element; const int * COIN_RESTRICT hrowi = fact->R_etas_index; const int * COIN_RESTRICT mcstrt = fact->R_etas_start; const int * COIN_RESTRICT hpivco = fact->hpivcoR; int ndo=fact->nR_etas; #ifndef UNROLL1 #define UNROLL1 4 #endif #if UNROLL1>2 int l2; #endif int kn; double dv; int iel; int ipiv; int knext; knext = mcstrt[ndo + 1]; #if UNROLL1>2 for (i = ndo; i > 0; --i) { k1 = knext; knext = mcstrt[i]; ipiv = hpivco[i]; dv = dwork1[ipiv]; /* fast floating */ k = knext - k1; kn = k >> 2; iel = k1 + 1; if (dv != 0.) { l1 = (k & 1) != 0; l2 = (k & 2) != 0; for (j = 1; j <= kn; j++) { int irow0 = hrowi[iel + 0]; int irow1 = hrowi[iel + 1]; int irow2 = hrowi[iel + 2]; int irow3 = hrowi[iel + 3]; double dval0 = dv * dluval[iel + 0] + SHIFT_REF(dwork1, irow0); double dval1 = dv * dluval[iel + 1] + SHIFT_REF(dwork1, irow1); double dval2 = dv * dluval[iel + 2] + SHIFT_REF(dwork1, irow2); double dval3 = dv * dluval[iel + 3] + SHIFT_REF(dwork1, irow3); SHIFT_REF(dwork1, irow0) = dval0; SHIFT_REF(dwork1, irow1) = dval1; SHIFT_REF(dwork1, irow2) = dval2; SHIFT_REF(dwork1, irow3) = dval3; iel+=4; } if (l1) { int irow0 = hrowi[iel]; SHIFT_REF(dwork1, irow0) += dv* dluval[iel]; ++iel; } if (l2) { int irow0 = hrowi[iel + 0]; int irow1 = hrowi[iel + 1]; SHIFT_REF(dwork1, irow0) += dv* dluval[iel]; SHIFT_REF(dwork1, irow1) += dv* dluval[iel+1]; } } } #else for (i = ndo; i > 0; --i) { k1 = knext; knext = mcstrt[i]; ipiv = hpivco[i]; dv = dwork1[ipiv]; k = knext - k1; kn = k >> 1; iel = k1 + 1; if (dv != 0.) { l1 = (k & 1) != 0; for (j = 1; j <= kn; j++) { int irow0 = hrowi[iel + 0]; int irow1 = hrowi[iel + 1]; double dval0 = dv * dluval[iel + 0] + SHIFT_REF(dwork1, irow0); double dval1 = dv * dluval[iel + 1] + SHIFT_REF(dwork1, irow1); SHIFT_REF(dwork1, irow0) = dval0; SHIFT_REF(dwork1, irow1) = dval1; iel+=2; } if (l1) { int irow0 = hrowi[iel]; SHIFT_REF(dwork1, irow0) += dv* dluval[iel]; ++iel; } } } #endif } /* c_ekkbtjl */ static int c_ekkbtjl_sparse(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt , int nincol) { const double * COIN_RESTRICT dluval = fact->R_etas_element; const int * COIN_RESTRICT hrowi = fact->R_etas_index; const int * COIN_RESTRICT mcstrt = fact->R_etas_start; const int * COIN_RESTRICT hpivco = fact->hpivcoR; char * COIN_RESTRICT nonzero = fact->nonzero; int ndo=fact->nR_etas; int i, j, k1; double dv; int ipiv; int irow0, irow1; int knext; int number=nincol; /* ------------------------------------------- */ /* adjust back */ hrowi++; dluval++; /* DO ANY ROW TRANSFORMATIONS */ /* Function Body */ knext = mcstrt[ndo + 1]; for (i = ndo; i > 0; --i) { k1 = knext; knext = mcstrt[i]; ipiv = hpivco[i]; dv = dwork1[ipiv]; if (dv) { for (j = k1; j 1 const int * hrowi2=hrowi+kx; const int * hrowi2end=hrowi2+nel; const double * dluval2=dluval+kx; #else int iel; #endif const double dpiv = dluval[kx-1]; /* inverse of pivot */ /* subtract terms whose unknowns have been solved for */ /* a significant proportion of these loops may not modify dv at all. * However, it seems to be just as expensive to check if the loop * would modify dv as it is to just do it. * The only difference would be that dluval wouldn't be referenced * for those loops, would might save some cache paging, * but unfortunately the code generated to search for zeros (on AIX) * is *worse* than code that just multiplies by dval. */ #if UNROLL2<2 for (iel = kx; iel < kxe; ++iel) { const int irow = hrowi[iel]; const double dval=dluval[iel]; dv -= SHIFT_REF(dwork1, irow) * dval; } dwork1[ipiv] = dv * dpiv; /* divide by the pivot */ #else if ((nel&1)!=0) { int irow = *hrowi2; double dval=*dluval2; dv -= SHIFT_REF(dwork1, irow) * dval; hrowi2++; dluval2++; } for (; hrowi2 < hrowi2end; hrowi2 +=2,dluval2 +=2) { int irow0 = hrowi2[0]; int irow1 = hrowi2[1]; double dval0=dluval2[0]; double dval1=dluval2[1]; double d0=SHIFT_REF(dwork1, irow0); double d1=SHIFT_REF(dwork1, irow1); dv -= d0 * dval0; dv -= d1 * dval1; } dwork1[ipiv] = dv * dpiv; /* divide by the pivot */ #endif ipiv=hpivco[ipiv]; } return (ipiv); } /* * We are given the upper diagonal matrix U from the LU factorization * and a rhs dwork1. * This solves the system U x = dwork1 * by back substitution, overwriting dwork1 with the solution x. * * It does this in textbook style by solving the equations "bottom" up, * so for each equation one new unknown is solved for by subtracting * from the rhs the sum of the terms whose unknowns have been solved for, * then dividing by the coefficient of the new unknown. * * Since we update the U matrix using F-T, the order of the columns * changes slightly each iteration. Initially, hpivco[i] == i+1, * and each iteration (generally) introduces one element where this * is no longer true. However, because we periodically refactorize, * it is much more common for hpivco[i] == i+1 than not. * * The one quirk is that value referred to as the pivot is actually * the reciprocal of the pivot, to avoid a division. * * Solving in this fashion is inappropriate if there are frequently * cases where all unknowns in an equation have value zero. * This seems to happen frequently if the sparsity of the rhs is, say, 10%. */ static void c_ekkbtju(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int ipiv) { const int nrow = fact->nrow; double * COIN_RESTRICT dluval = fact->xeeadr; int * COIN_RESTRICT hrowi = fact->xeradr; int * COIN_RESTRICT mcstrt = fact->xcsadr; int * COIN_RESTRICT hpivco_new = fact->kcpadr+1; int ndenuc=fact->ndenuc; int first_dense = fact->first_dense; int last_dense = fact->last_dense; const int has_dense = (first_densek1;j--) { int irow=UNSHIFT_INDEX(hrowi[j]); if (irow (hpivco_new), dwork1,&ipiv,last_dense, n - first_dense, densew); } (void) c_ekkbtju_aux(dluval, hrowi, mcstrt, hpivco_new, dwork1, ipiv, nrow); } /* c_ekkbtju */ /* * mpt / *nincolp contain the indices of nonzeros in dwork1. * nonzero contains the same information as a byte-mask. * * currently, erase_nonzero is true iff this is called from c_ekketsj. */ static int c_ekkbtju_sparse(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, int nincol, int * COIN_RESTRICT spare) { const double * COIN_RESTRICT dluval = fact->xeeadr+1; const int * COIN_RESTRICT mcstrt = fact->xcsadr; char * COIN_RESTRICT nonzero = fact->nonzero; const int * COIN_RESTRICT hcoli = fact->xecadr; const int * COIN_RESTRICT mrstrt = fact->xrsadr; const int * COIN_RESTRICT hinrow = fact->xrnadr; const double * COIN_RESTRICT de2val = fact->xe2adr-1; int i; int iPivot; int nList=0; int nStack,k,kx; const int nrow=fact->nrow; const double tolerance = fact->zeroTolerance; int * COIN_RESTRICT list = spare; int * COIN_RESTRICT stack = spare+nrow; int * COIN_RESTRICT next = stack+nrow; /* * Examine all nonzero elements and determine which elements may be * nonzero in the result. * Any row in U that contains terms that may have nonzero variable values * may produce a nonzero value. */ for (k=0;k=0;i--) { double dpiv; double dv; iPivot = list[i]; kx = mcstrt[iPivot]; dpiv = dluval[kx-1]; dv = dpiv * dwork1[iPivot]; nonzero[iPivot] = 0; if (fabs(dv)>=tolerance) { int iel; int krx = mrstrt[iPivot]; int krxe = krx+hinrow[iPivot]; dwork1[iPivot]=dv; mpt[nList++]=iPivot; for (iel = krx; iel < krxe; iel++) { int irow0 = hcoli[iel]; double dval=de2val[iel]; dwork1[irow0] -= dv*dval; } } else { dwork1[iPivot]=0.0; } } return (nList); } /* c_ekkbtjuRow */ /* * dpermu is supposed to be zeroed on entry to this routine. * It is used as a working buffer. * The input vector dwork1 is permuted into dpermu, operated on, * and the answer is permuted back into dwork1, zeroing dpermu in * the process. */ /* * nincol > 0 ==> mpt contains indices of non-zeros in dpermu * * first_nonzero contains index of first (last??)nonzero; * only used if nincol==0. * * dpermu contains permuted input; dwork1 is now zero */ int c_ekkbtrn(COIN_REGISTER3 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, int first_nonzero) { double * COIN_RESTRICT dpermu = fact->kadrpm; const int * COIN_RESTRICT mpermu=fact->mpermu; const int * COIN_RESTRICT hpivco_new= fact->kcpadr+1; const int nrow = fact->nrow; int i; int nincol; /* find the first non-zero input */ int ipiv; if (first_nonzero) { ipiv = first_nonzero; #if 1 if (c_ekk_IsSet(fact->bitArray,ipiv)) { /* slack */ int lastSlack = fact->lastSlack; int firstDo=hpivco_new[lastSlack]; assert (dpermu[ipiv]); while (ipiv!=firstDo) { assert (c_ekk_IsSet(fact->bitArray,ipiv)); if (dpermu[ipiv]) dpermu[ipiv]=-dpermu[ipiv]; ipiv=hpivco_new[ipiv]; } } #endif } else { int lastSlack = fact->numberSlacks; ipiv=hpivco_new[0]; for (i=0;ibitArray,ipiv)); if (dpermu[ipiv]) { break; } else { ipiv=next_piv; } } /* usually, there is a non-zero slack entry... */ if (i==lastSlack) { /* but if there isn't... */ for (;ibitArray,ipiv)); if (dpermu[ipiv]) dpermu[ipiv]=-dpermu[ipiv]; ipiv=hpivco_new[ipiv]; } assert (!c_ekk_IsSet(fact->bitArray,ipiv)||ipiv>fact->nrow); /* this is presumably the first non-zero non slack */ /*ipiv=firstDo;*/ } } if (ipiv<=fact->nrow) { /* skipBtju is always (?) 0 first the first call, * ipiv tends to be >nrow for the second */ /* DO U */ c_ekkbtju(fact,dpermu, ipiv); } /* DO ROW ETAS IN L */ c_ekkbtjl(fact, dpermu); c_ekkbtj4p(fact,dpermu); /* dwork1[mpermu] = dpermu; dpermu = 0; mpt = indices of non-zeros */ nincol = c_ekkshfpo_scan2zero(fact,&mpermu[1],dpermu,&dwork1[1],&mpt[1]); /* dpermu should be zero now */ #ifdef DEBUG for (i=1;i<=nrow ;i++ ) { if (dpermu[i]) { abort(); } /* endif */ } /* endfor */ #endif return (nincol); } /* c_ekkbtrn */ static int c_ekkbtrn0_new(COIN_REGISTER3 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, int nincol, int * COIN_RESTRICT spare) { double * COIN_RESTRICT dpermu = fact->kadrpm; const int * COIN_RESTRICT mpermu=fact->mpermu; const int * COIN_RESTRICT hpivro = fact->krpadr; const int nrow = fact->nrow; int i; char * nonzero=fact->nonzero; int doSparse=1; /* so: dpermu must contain room for: * nrow doubles, followed by * nrow ints (mpermu), followed by * nrow ints (the inverse permutation), followed by * an unused area (?) of nrow ints, followed by * nrow chars (this non-zero array). * * and apparently the first nrow elements of nonzero are expected * to already be zero. */ #ifdef DEBUG for (i=1;i<=nrow ;i++ ) { if (nonzero[i]) { abort(); } /* endif */ } /* endfor */ #endif /* now nonzero[i]==1 iff there is an entry for i in mpt */ nincol=c_ekkbtju_sparse(fact, dpermu, &mpt[1], nincol, spare); /* the vector may have more nonzero elements now */ /* DO ROW ETAS IN L */ #define DENSE_THRESHOLD (nincol*10+100) if (DENSE_THRESHOLD>nrow) { doSparse=0; c_ekkbtjl(fact, dpermu); } else { /* set nonzero */ for(i=0;inrow) { doSparse=0; #ifdef DEBUG for (i=1;i<=nrow;i++) { if (nonzero[i]) { abort(); } } #endif } } if (!doSparse) { c_ekkbtj4p(fact,dpermu); /* dwork1[mpermu] = dpermu; dpermu = 0; mpt = indices of non-zeros */ nincol = c_ekkshfpo_scan2zero(fact,&mpermu[1],dpermu,&dwork1[1],&mpt[1]); /* dpermu should be zero now */ #ifdef DEBUG for (i=1;i<=nrow ;i++ ) { if (dpermu[i]) { abort(); } /* endif */ } /* endfor */ #endif } else { /* still sparse */ if (fact->nnentl) { nincol = c_ekkbtj4_sparse(fact, dpermu, &mpt[1], dwork1, nincol,spare); } else { double tolerance=fact->zeroTolerance; int irow; int nput=0; if (fact->packedMode) { for (i = 0; i = tolerance) { irow0= hpivro[irow]; dwork1[1+nput]=dval; mpt[1 + nput++]=irow0-1; } dpermu[irow]=0.0; } } } else { for (i = 0; i = tolerance) { irow0= hpivro[irow]; dwork1[irow0]=dval; mpt[1 + nput++]=irow0-1; } dpermu[irow]=0.0; } } } nincol=nput; } } return (nincol); } /* c_ekkbtrn */ /* returns c_ekkbtrn(fact, dwork1, mpt) * * but since mpt[1..nincol] contains the indices of non-zeros in dwork1, * we can do faster. */ static int c_ekkbtrn_mpt(COIN_REGISTER3 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, int nincol,int * COIN_RESTRICT spare) { double * COIN_RESTRICT dpermu = fact->kadrpm; const int nrow = fact->nrow; const int * COIN_RESTRICT mpermu=fact->mpermu; /*const int *mrstrt = fact->xrsadr;*/ #ifdef DEBUG int i; memset(spare,'A',3*nrow*sizeof(int)); { for (i=1;i<=nrow;i++) { if (dpermu[i]) { abort(); } } } #endif int i; #ifdef DEBUG for (i=1;i<=nrow;i++) { if (fact->nonzero[i]||dpermu[i]) { abort(); } } #endif assert (fact->if_sparse_update>0&&mpt&&fact->rows_ok) ; /* read the input vector from mpt/dwork1; * permute it into dpermu; * construct a nonzero mask in nonzero; * overwrite mpt with the permuted indices; * clear the dwork1 vector. */ for (i=0;iif_sparse_update>0) { for (i=1;i<=nrow;i++) { if (fact->nonzero[i]) { abort(); } } } } #endif return nincol; } /* returns c_ekkbtrn(fact, dwork1, mpt) * * but since (dwork1[i]!=0) == (i==ipivrw), * we can do faster. */ int c_ekkbtrn_ipivrw(COIN_REGISTER3 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, int ipivrw,int * COIN_RESTRICT spare) { double * COIN_RESTRICT dpermu = fact->kadrpm; const int nrow = fact->nrow; const int * COIN_RESTRICT mpermu=fact->mpermu; const double * COIN_RESTRICT dluval = fact->xeeadr; const int * COIN_RESTRICT mrstrt = fact->xrsadr; const int * COIN_RESTRICT hinrow = fact->xrnadr; const int * COIN_RESTRICT hcoli = fact->xecadr; const int * COIN_RESTRICT mcstrt = fact->xcsadr; int nincol; #ifdef DEBUG int i; for (i=1;i<=nrow ;i++ ) { if (dpermu[i]) { abort(); } /* endif */ } /* endfor */ #endif if (fact->if_sparse_update>0&&mpt&& fact->rows_ok) { mpt[1] = ipivrw; nincol = c_ekkbtrn_mpt(fact, dwork1, mpt, 1,spare); } else { int ipiv; int kpivrw = mpermu[ipivrw]; dpermu[kpivrw]=dwork1[ipivrw]; dwork1[ipivrw]=0.0; if (fact->rows_ok) { /* !fact->if_sparse_update * but we still have rowwise info, * so we may as well use it to do the slack row */ int iipivrw=nrow+1; int itest = fact->nnentu+1; int k=mrstrt[kpivrw]; int lastInRow= k+hinrow[kpivrw]; double dpiv,dv; for (;knrow) { if (c_ekk_IsSet(fact->bitArray,ipiv)) { const int * hpivco_new= fact->kcpadr+1; int lastSlack = fact->lastSlack; int firstDo=hpivco_new[lastSlack]; /* slack */ /* need pivot row of first nonslack */ dpermu[ipiv]=-dpermu[ipiv]; #ifndef NDEBUG while (1) { assert (c_ekk_IsSet(fact->bitArray,ipiv)); ipiv=hpivco_new[ipiv]; if (ipiv>fact->nrow||ipiv==firstDo) break; } assert (!c_ekk_IsSet(fact->bitArray,ipiv)||ipiv>fact->nrow); assert (ipiv==firstDo); #endif ipiv=firstDo; } } nincol = c_ekkbtrn(fact, dwork1, mpt, ipiv); } return nincol; } /* * Does work associated with eq. 3.7: * r' = u' U^-1 * * where u' (can't write the overbar) is the p'th row of U, without * the entry for column p. (here, jpivrw is p). * We solve this as for btju. We know * r' U = u' * * so we solve from low index to hi, determining the next value u_i' * by doing the dot-product of r' and the i'th column of U (excluding * element i itself), subtracting that from u'_i, and dividing by * U_ii (we store the reciprocal, so here we multiply). * * Now, in principle dwork1 should be initialized to the p'th row of U. * Instead, it is initially zeroed and filled in as we go along. * Of the entries in u' that we reference during a dot product with * a column of U, either * the entry is 0 by definition, since it is < p, or * it has already been set by a previous iteration, or * it is p. * * Because of this, we know that all elements < p will be zero; * that's why we start with p (kpivrw). * While we do this product, we also zero out the p'th row. */ static void c_ekketju_aux(COIN_REGISTER2 EKKfactinfo * COIN_RESTRICT2 fact,int sparse, double * COIN_RESTRICT dluval, int * COIN_RESTRICT hrowi, const int * COIN_RESTRICT mcstrt, const int * COIN_RESTRICT hpivco, double * COIN_RESTRICT dwork1, int *ipivp, int jpivrw, int stop_col) { int ipiv = *ipivp; if (1&&ipivbitArray,ipiv)) { /* slack */ int lastSlack = fact->lastSlack; int firstDo=hpivco[lastSlack]; while (1) { assert (c_ekk_IsSet(fact->bitArray,ipiv)); dwork1[ipiv] = -dwork1[ipiv]; ipiv=hpivco[ipiv]; /* next column - generally ipiv+1 */ if (ipiv==firstDo||ipiv>=stop_col) break; } } while(ipivnrow; if (first_dense < last_dense && mcstrt[ipiv] <= mcstrt[last_dense]) { /* There are dense columns, and * some dense columns precede the pivot column */ /* first do any sparse columns "on the left" */ c_ekketju_aux(fact, true, dluval, hrowi, mcstrt, hpivco, dwork1, &ipiv, jpivrw, first_dense); /* then do dense columns */ c_ekketju_aux(fact, false, dluval, hrowi, mcstrt, hpivco, dwork1, &ipiv, jpivrw, last_dense+1); /* final sparse columns "on the right" ...*/ } /* ...are the same as sparse columns if there are no dense */ c_ekketju_aux(fact, true, dluval, hrowi, mcstrt, hpivco, dwork1, &ipiv, jpivrw, nrow+1); } /* c_ekketju */ /*#define PRINT_DEBUG*/ /* dwork1 is assumed to be zeroed on entry */ int c_ekketsj(COIN_REGISTER2 /*const*/ EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt2, double dalpha, int orig_nincol, int npivot, int *nuspikp, const int ipivrw,int * spare) { int nuspik = *nuspikp; int * COIN_RESTRICT mpermu=fact->mpermu; int * COIN_RESTRICT hcoli = fact->xecadr; double * COIN_RESTRICT dluval = fact->xeeadr; int * COIN_RESTRICT mrstrt = fact->xrsadr; int * COIN_RESTRICT hrowi = fact->xeradr; int * COIN_RESTRICT mcstrt = fact->xcsadr; int * COIN_RESTRICT hinrow = fact->xrnadr; /*int *hincol = fact->xcnadr; int *hpivro = fact->krpadr;*/ int * COIN_RESTRICT hpivco = fact->kcpadr; double * COIN_RESTRICT de2val = fact->xe2adr; const int nrow = fact->nrow; const int ifRowCopy = fact->rows_ok; int i, j=-1, k, i1, i2, k1; int kc, iel; double del3; int nroom; bool ifrows= (mrstrt[1] != 0); int kpivrw, jpivrw; int first_dense_mcstrt,last_dense_mcstrt; int nnentl; /* includes row stuff */ int doSparse=(fact->if_sparse_update>0); #ifdef MORE_DEBUG { const int * COIN_RESTRICT hrowi = fact->R_etas_index; const int * COIN_RESTRICT mcstrt = fact->R_etas_start; int ndo=fact->nR_etas; int knext; knext = mcstrt[ndo + 1]; for (int i = ndo; i > 0; --i) { int k1 = knext; knext = mcstrt[i]; for (int j = k1+1; j < knext; j++) { assert (hrowi[j]>0&&hrowi[j]<100000); } } } #endif int mcstrt_piv; int nincol=0; int * COIN_RESTRICT hpivco_new=fact->kcpadr+1; int * COIN_RESTRICT back=fact->back; int irtcod = 0; /* Parameter adjustments */ de2val--; /* Function Body */ if (!ifRowCopy) { doSparse=0; fact->if_sparse_update=-abs(fact->if_sparse_update); } if (npivot==1) { fact->num_resets=0; } kpivrw = mpermu[ipivrw]; #if 0 //ndef NDEBUG ets_count++; if (ets_check>=0&&ets_count>=ets_check) { printf("trouble\n"); } #endif mcstrt_piv=mcstrt[kpivrw]; /* ndenuc - top has number deleted */ if (fact->ndenuc) { first_dense_mcstrt = mcstrt[fact->first_dense]; last_dense_mcstrt = mcstrt[fact->last_dense]; } else { first_dense_mcstrt=0; last_dense_mcstrt=0; } { int kdnspt = fact->nnetas - fact->nnentl; i1 = ((kdnspt - 1) + fact->R_etas_start[fact->nR_etas + 1]); /*i1 = -99999999;*/ /* fact->R_etas_start[fact->nR_etas + 1] is -(the number of els in R) */ nnentl = fact->nnetas - ((kdnspt - 1) + fact->R_etas_start[fact->nR_etas + 1]); } fact->demark=fact->nnentu+nnentl; jpivrw = SHIFT_INDEX(kpivrw); #ifdef CLP_REUSE_ETAS double del3Orig=0.0; #endif if (nuspik < 0) { goto L7000; } else if (nuspik == 0) { del3 = 0.; } else { del3 = 0.; i1 = fact->nnentu + 1; i2 = fact->nnentu + nuspik; if (fact->sortedEta) { /* binary search */ if (hrowi[i2] == jpivrw) { /* sitting right on the end - easy */ del3 = dluval[i2]; --nuspik; } else { bool foundit = true; /* binary search - sort of implies hrowi is sorted */ i = i1; if (hrowi[i] != jpivrw) { while (1) { i = (i1 + i2) >>1; if (i == i1) { foundit = false; break; } if (hrowi[i] < jpivrw) { i1 = i; } else if (hrowi[i] > jpivrw) { i2 = i; } else break; } } /* ??? what if we didn't find it? */ if (foundit) { del3 = dluval[i]; --nuspik; /* remove it and move the last element into its place */ hrowi[i] = hrowi[nuspik + fact->nnentu+1]; dluval[i] = dluval[nuspik + fact->nnentu+1]; } } } else { /* search */ for (i=i1;i<=i2;i++) { if (hrowi[i] == jpivrw) { del3 = dluval[i]; --nuspik; /* remove it and move the last element into its place */ hrowi[i] = hrowi[i2]; dluval[i] = dluval[i2]; break; } } } } #ifdef CLP_REUSE_ETAS del3Orig=del3; #endif /* OLD COLUMN POINTERS */ /* **************************************************************** */ if (!ifRowCopy) { /* old method */ /* DO U */ c_ekketju(fact,dluval, hrowi, mcstrt, hpivco_new, dwork1, kpivrw,fact->first_dense, fact->last_dense); } else { /* could take out of old column but lets try being crude */ /* try taking out */ if (fact->xe2adr != 0&&doSparse) { /* * There is both a column and row representation of U. * For each row in the kpivrw'th column of the col U rep, * find its position in the U row rep and remove it * by overwriting it with the last element. */ int k1x = mcstrt[kpivrw]; int nel = hrowi[k1x]; /* yes, this is the nel, for the pivot */ int k2x = k1x + nel; for (k = k1x + 1; k <= k2x; ++k) { int irow = UNSHIFT_INDEX(hrowi[k]); int kx = mrstrt[irow]; int nel = hinrow[irow]-1; hinrow[irow]=nel; int jlast = kx + nel; for (int iel=kx;ielnnentu + 1; i2 = fact->nnentu + nuspik; int * COIN_RESTRICT eta_last=mpermu+nrow*2+3; int * COIN_RESTRICT eta_next=eta_last+nrow+2; if (fact->xe2adr == 0||!doSparse) { /* we have column indices by row, but not the actual values */ for (iel = i1; iel <= i2; ++iel) { int irow = UNSHIFT_INDEX(hrowi[iel]); int iput = hinrow[irow]; int kput = mrstrt[irow]; int nextRow=eta_next[irow]; assert (kput>0); kput += iput; if (kput < mrstrt[nextRow]) { /* there is room - append the pivot column; * this corresponds making alpha_p the rightmost column of U (p. 268)*/ hinrow[irow] = iput + 1; hcoli[kput] = kpivrw; } else { /* no room - switch off */ doSparse=0; /* possible kpivrw 1 */ k1 = mrstrt[kpivrw]; mrstrt[1]=-1; fact->rows_ok = false; goto L1226; } } } else { if (! doSparse) { /* we have both column indices and values by row */ /* just like loop above, but with extra assign to de2val */ for (iel = i1; iel <= i2; ++iel) { int irow = UNSHIFT_INDEX(hrowi[iel]); int iput = hinrow[irow]; int kput = mrstrt[irow]; int nextRow=eta_next[irow]; assert (kput>0); kput += iput; if (kput < mrstrt[nextRow]) { hinrow[irow] = iput + 1; hcoli[kput] = kpivrw; de2val[kput] = dluval[iel]; } else { /* no room - switch off */ doSparse=0; /* possible kpivrw 1 */ k1 = mrstrt[kpivrw]; mrstrt[1]=-1; fact->rows_ok = false; goto L1226; } } } else { for (iel = i1; iel <= i2; ++iel) { int j,k; int irow = UNSHIFT_INDEX(hrowi[iel]); int iput = hinrow[irow]; k=mrstrt[irow]+iput; j=eta_next[irow]; if (k >= mrstrt[j]) { /* no room - can we make some? */ int klast=eta_last[nrow+1]; int jput=mrstrt[klast]+hinrow[klast]+2; int distance=mrstrt[nrow+1]-jput; if (iput+1nnetas-fact->nnentu-fact->nnentl-3); if (spare>nrow<<1) { /* presumbly, this compacts the rows */ int jrow,jput; if (1) { if (fact->num_resets<1000000) { int etasize =CoinMax(4*fact->nnentu+ (fact->nnetas-fact->nnentl)+1000,fact->eta_size); if (ifrows) { fact->num_resets++; if (npivot>40&&fact->num_resets<<4>npivot) { fact->eta_size=static_cast(1.05*fact->eta_size); fact->num_resets=1000000; } } else { fact->eta_size=static_cast(1.1*fact->eta_size); fact->num_resets=1000000; } fact->eta_size=CoinMin(fact->eta_size,etasize); if (fact->maxNNetas>0&&fact->eta_size> fact->maxNNetas) { fact->eta_size=fact->maxNNetas; } } } jrow=eta_next[0]; jput=1; for (j=0;jnrow<<3) { spare=3; } else if (spare>nrow<<2) { spare=1; } else { spare=0; } jput+=nrow*spare;; jrow=eta_last[nrow+1]; for (j=0;jrows_ok = false; goto L1226; } } } /* now we have room - append the new value */ hinrow[irow] = iput + 1; hcoli[k] = kpivrw; de2val[k] = dluval[iel]; } } } /* TAKE OUT ALL ELEMENTS IN PIVOT ROW */ k1 = mrstrt[kpivrw]; L1226: { int k2 = k1 + hinrow[kpivrw] - 1; /* "delete" the row */ hinrow[kpivrw] = 0; j = 0; if (doSparse) { /* remove pivot row entries from the corresponding columns */ for (k = k1; k <= k2; ++k) { int icol = hcoli[k]; int kx = mcstrt[icol]; int nel = hrowi[kx]; for (iel = kx + 1; iel <= kx+nel; iel ++) { if (hrowi[iel] == jpivrw) { break; } } if (iel <= kx+nel) { /* this has to happen, right?? */ /* copy the element into a temporary */ dwork1[icol] = dluval[iel]; mpt2[nincol++]=icol; /*nonzero[icol-1]=1;*/ hrowi[kx]=nel-1; /* column is shorter by one */ j=1; hrowi[iel]=hrowi[kx+nel]; dluval[iel]=dluval[kx+nel]; #ifdef CLP_REUSE_ETAS hrowi[kx+nel]=jpivrw; dluval[kx+nel]=dwork1[icol]; #endif } } if (j != 0) { /* now compute r', the new R transform */ orig_nincol=c_ekkbtju_sparse(fact, dwork1, mpt2, nincol, spare); dwork1[kpivrw]=0.0; } } else { /* row version isn't ok (?) */ for (k = k1; k <= k2; ++k) { int icol = hcoli[k]; int kx = mcstrt[icol]; int nel = hrowi[kx]; j = kx+nel; int iel; for (iel=kx+1;iel<=j;iel++) { if (hrowi[iel]==jpivrw) break; } dwork1[icol] = dluval[iel]; if (kxlast_dense_mcstrt) { hrowi[kx] = nel - 1; /* shorten column */ /* not packing - presumably column isn't sorted */ hrowi[iel] = hrowi[j]; dluval[iel] = dluval[j]; #ifdef CLP_REUSE_ETAS hrowi[j]=jpivrw; dluval[j]=dwork1[icol]; #endif } else { /* dense element - just zero it */ dluval[iel]=0.0; } } if (j != 0) { /* Find first nonzero */ int ipiv = hpivco_new[kpivrw]; while(ipiv<=nrow) { if (!dwork1[ipiv]) { ipiv=hpivco_new[ipiv]; } else { break; } } if (ipiv<=nrow) { /* DO U */ /* now compute r', the new R transform */ c_ekkbtju(fact, dwork1, ipiv); } } } } } if (kpivrw==fact->first_dense) { /* increase until valid pivot */ fact->first_dense=hpivco_new[fact->first_dense]; } else if (kpivrw==fact->last_dense) { fact->last_dense=back[fact->last_dense]; } if (fact->first_dense==fact->last_dense) { fact->ndenuc=0; fact->first_dense=0; fact->last_dense=-1; } if (! (ifRowCopy && j==0)) { /* increase amount of work on Etas */ /* **************************************************************** */ /* DO ROW ETAS IN L */ { if (!doSparse) { dwork1[kpivrw] = 0.; #if 0 orig_nincol=c_ekksczr(fact,nrow, dwork1, mpt2); del3=c_ekkputl(fact, mpt2, dwork1, del3, orig_nincol, nuspik); #else orig_nincol=c_ekkputl2(fact, dwork1, &del3, nuspik); #endif } else { del3=c_ekkputl(fact, mpt2, dwork1, del3, orig_nincol, nuspik); } } if (orig_nincol != 0) { /* STORE AS A ROW VECTOR */ int n = fact->nR_etas+1; int i1 = fact->R_etas_start[n]; fact->nR_etas=n; fact->R_etas_start[n + 1] = i1 - orig_nincol; hpivco[fact->nR_etas + nrow+3] = kpivrw; } } /* CHECK DEL3 AGAINST DALPHA/DOUT */ { int kx = mcstrt[kpivrw]; double dout = dluval[kx]; double dcheck = fabs(dalpha / dout); double difference=0.0; if (fabs(del3) > CoinMin(1.0e-8,fact->drtpiv*0.99999)) { double checkTolerance; if ( fact->npivots < 2 ) { checkTolerance = 1.0e-5; } else if ( fact->npivots < 10 ) { checkTolerance = 1.0e-6; } else if ( fact->npivots < 50 ) { checkTolerance = 1.0e-8; } else { checkTolerance = 1.0e-9; } difference = fabs(1.0-fabs(del3)/dcheck); if (difference > 0.1*checkTolerance) { if (difference < checkTolerance|| (difference<1.0e-7&&fact->npivots>=50)) { irtcod=1; #ifdef PRINT_DEBUG printf("mildly bad %g after %d pivots, etsj %g ftncheck %g ftnalpha %g\n", difference,fact->npivots,del3,dcheck,dalpha); #endif } else { irtcod=2; #ifdef PRINT_DEBUG printf("bad %g after %d pivots, etsj %g ftncheck %g ftnalpha %g\n", difference,fact->npivots,del3,dcheck,dalpha); #endif } } } else { irtcod=2; #ifdef PRINT_DEBUG printf("bad small %g after %d pivots, etsj %g ftncheck %g ftnalpha %g\n", difference,fact->npivots,del3,dcheck,dalpha); #endif } if (irtcod>1) goto L8000; fact->npivots++; } mcstrt[kpivrw] = fact->nnentu; #ifdef CLP_REUSE_ETAS { int * putSeq = fact->xrsadr+2*fact->nrowmx+2; int * position = putSeq+fact->maxinv; int * putStart = position+fact->maxinv; putStart[fact->nrow+fact->npivots-1]=fact->nnentu; } #endif dluval[fact->nnentu] = 1. / del3; /* new pivot */ hrowi[fact->nnentu] = nuspik; /* new nelems */ #ifndef NDEBUG { int lastSlack = fact->lastSlack; int firstDo=hpivco_new[lastSlack]; int ipiv=hpivco_new[0]; int now = fact->numberSlacks; if (now) { while (1) { if (ipiv>fact->nrow||ipiv==firstDo) break; assert (c_ekk_IsSet(fact->bitArray,ipiv)); ipiv=hpivco_new[ipiv]; } if (ipiv<=fact->nrow) { while (1) { if (ipiv>fact->nrow) break; assert (!c_ekk_IsSet(fact->bitArray,ipiv)); ipiv=hpivco_new[ipiv]; } } } } #endif { /* do new hpivco */ int inext=hpivco_new[kpivrw]; int iback=back[kpivrw]; if (inext!=nrow+1) { int ilast=back[nrow+1]; hpivco_new[iback]=inext; back[inext]=iback; assert (hpivco_new[ilast]==nrow+1); hpivco_new[ilast]=kpivrw; back[kpivrw]=ilast; hpivco_new[kpivrw]=nrow+1; back[nrow+1]=kpivrw; } } { int lastSlack = fact->lastSlack; int now = fact->numberSlacks; if (now&&mcstrt_piv<=mcstrt[lastSlack]) { if (c_ekk_IsSet(fact->bitArray,kpivrw)) { /*printf("piv %d lastSlack %d\n",mcstrt_piv,lastSlack);*/ fact->numberSlacks--; now--; /* one less slack */ c_ekk_Unset(fact->bitArray,kpivrw); if (now&&kpivrw==lastSlack) { int i; int ipiv; ipiv=hpivco_new[0]; for (i=0;ibitArray,ipiv)); assert (!c_ekk_IsSet(fact->bitArray,hpivco_new[ipiv])||hpivco_new[ipiv]>fact->nrow); fact->lastSlack = lastSlack; } else if (!now) { fact->lastSlack=0; } } } fact->firstNonSlack=hpivco_new[lastSlack]; #ifndef NDEBUG { int lastSlack = fact->lastSlack; int firstDo=hpivco_new[lastSlack]; int ipiv=hpivco_new[0]; int now = fact->numberSlacks; if (now) { while (1) { if (ipiv>fact->nrow||ipiv==firstDo) break; assert (c_ekk_IsSet(fact->bitArray,ipiv)); ipiv=hpivco_new[ipiv]; } if (ipiv<=fact->nrow) { while (1) { if (ipiv>fact->nrow) break; assert (!c_ekk_IsSet(fact->bitArray,ipiv)); ipiv=hpivco_new[ipiv]; } } } } #endif } fact->nnentu += nuspik; #ifdef CLP_REUSE_ETAS if (fact->first_dense>=fact->last_dense) { // save fact->nnentu++; dluval[fact->nnentu]=del3Orig; hrowi[fact->nnentu]=kpivrw; int * putSeq = fact->xrsadr+2*fact->nrowmx+2; int * position = putSeq+fact->maxinv; int * putStart = position+fact->maxinv; int nnentu_at_factor=putStart[fact->nrow]&0x7fffffff; //putStart[fact->nrow+fact->npivots]=fact->nnentu+1; int where; if (mcstrt_pivnrow; for (where=fact->npivots-1;where>=0;where--) { if (mcstrt_piv==(look[where]&0x7fffffff)) break; } assert (where>=0); where += fact->nrow; } position[fact->npivots-1]=where; if (orig_nincol == 0) { // flag putStart[fact->nrow+fact->npivots-1] |= 0x80000000; } } #endif { int kdnspt = fact->nnetas - fact->nnentl; /* fact->R_etas_start[fact->nR_etas + 1] is -(the number of els in R) */ nnentl = fact->nnetas - ((kdnspt - 1) + fact->R_etas_start[fact->nR_etas + 1]); } fact->demark = (fact->nnentu + nnentl) - fact->demark; /* if need to redo row version */ if (! fact->rows_ok&&fact->first_dense>=fact->last_dense) { int extraSpace=10000; int spareSpace; if (fact->if_sparse_update>0) { spareSpace=(fact->nnetas-fact->nnentu-fact->nnentl); } else { /* missing out nnentl stuff */ spareSpace=fact->nnetas-fact->nnentu; } /* save clean row copy if enough room */ nroom = spareSpace / nrow; if ((fact->nnentu<<3)>150*fact->maxinv) { extraSpace=150*fact->maxinv; } else { extraSpace=fact->nnentu<<3; } ifrows = false; if (fact->nnetas>fact->nnentu+fact->nnentl+extraSpace) { ifrows = true; } if (nroom < 5) { ifrows = false; } if (nroom > CoinMin(50, fact->maxinv - (fact->iterno - fact->iterin))) { ifrows = true; } #ifdef PRINT_DEBUGx printf(" redoing row copy %d %d %d\n",ifrows,nroom,spareSpace); #endif if (1) { if (fact->num_resets<1000000) { if (ifrows) { fact->num_resets++; if (npivot>40&&fact->num_resets<<4>npivot) { fact->eta_size=static_cast(1.05*fact->eta_size); fact->num_resets=1000000; } } else { fact->eta_size=static_cast(1.1*fact->eta_size); fact->num_resets=1000000; } if (fact->maxNNetas>0&&fact->eta_size> fact->maxNNetas) { fact->eta_size=fact->maxNNetas; } } } fact->rows_ok = ifrows; if (ifrows) { int ibase = 1; c_ekkizero(nrow,&hinrow[1]); for (i = 1; i <= nrow; ++i) { int kx = mcstrt[i]; int nel = hrowi[kx]; int kcs = kx + 1; int kce = kx + nel; for (kc = kcs; kc <= kce; ++kc) { int irow = UNSHIFT_INDEX(hrowi[kc]); if (dluval[kc]) { hinrow[irow]++; } } } int * eta_last=mpermu+nrow*2+3; int * eta_next=eta_last+nrow+2; eta_next[0]=1; for (i = 1; i <= nrow; ++i) { eta_next[i]=i+1; eta_last[i]=i-1; mrstrt[i] = ibase; ibase = ibase + hinrow[i] + nroom; hinrow[i] = 0; } eta_last[nrow+1]=nrow; //eta_next[nrow+1]=nrow+2; mrstrt[nrow+1]=ibase; if (fact->xe2adr == 0) { for (i = 1; i <= nrow; ++i) { int kx = mcstrt[i]; int nel = hrowi[kx]; int kcs = kx + 1; int kce = kx + nel; for (kc = kcs; kc <= kce; ++kc) { if (dluval[kc]) { int irow = UNSHIFT_INDEX(hrowi[kc]); int iput = hinrow[irow]; assert (irow); hcoli[mrstrt[irow] + iput] = i; hinrow[irow] = iput + 1; } } } } else { for (i = 1; i <= nrow; ++i) { int kx = mcstrt[i]; int nel = hrowi[kx]; int kcs = kx + 1; int kce = kx + nel; for (kc = kcs; kc <= kce; ++kc) { int irow = UNSHIFT_INDEX(hrowi[kc]); int iput = hinrow[irow]; hcoli[mrstrt[irow] + iput] = i; de2val[mrstrt[irow] + iput] = dluval[kc]; hinrow[irow] = iput + 1; } } } } else { mrstrt[1] = 0; if (fact->if_sparse_update>0&&fact->iterno-fact->iterin>100) { goto L7000; } } } goto L8000; /* OUT OF SPACE - COULD PACK DOWN */ L7000: irtcod = 1; #ifdef PRINT_DEBUG printf(" out of space\n"); #endif if (1) { if ((npivot<<3)nbfinv) { /* low on space */ if (npivot<10) { fact->eta_size=fact->eta_size<<1; } else { double ratio=fact->nbfinv; double ratio2=npivot<<3; ratio=ratio/ratio2; if (ratio>2.0) { ratio=2.0; } /* endif */ fact->eta_size=static_cast(ratio*fact->eta_size); } /* endif */ } else { fact->eta_size=static_cast(1.05*fact->eta_size); } /* endif */ if (fact->maxNNetas>0&&fact->eta_size> fact->maxNNetas) { fact->eta_size=fact->maxNNetas; } } /* ================= IF ERROR SHOULD WE GET RID OF LAST ITERATION??? */ L8000: *nuspikp = nuspik; #ifdef MORE_DEBUG for (int i=1;i<=fact->nrow;i++) { int kx=mcstrt[i]; int nel=hrowi[kx]; for (int j=0;jsave_nnentu=fact->nnentu; #endif return (irtcod); } /* c_ekketsj */ static void c_ekkftj4p(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int firstNonZero) { /* this is where the L factors start, because this is the place * where c_ekktria starts laying them down (see initialization of xnetal). */ int lstart=fact->lstart; const int * COIN_RESTRICT hpivco = fact->kcpadr; int firstLRow = hpivco[lstart]; if (firstNonZero>firstLRow) { lstart += firstNonZero-firstLRow; } assert (firstLRow==fact->firstLRow); int jpiv=hpivco[lstart]; const double * COIN_RESTRICT dluval = fact->xeeadr; const int * COIN_RESTRICT hrowi = fact->xeradr; const int * COIN_RESTRICT mcstrt = fact->xcsadr+lstart; int ndo=fact->xnetal-lstart; int i, iel; /* find first non-zero */ for (i=0;i kce1; --iel) { int irow0 = hrowi[iel]; SHIFT_REF(dwork1, irow0) += dv * dluval[iel]; } } } } /* c_ekkftj4p */ /* * This version is more efficient for input columns that are sparse. * It is instructive to consider the case of an especially sparse column, * which is a slack. The slack for row r has exactly one non-zero element, * in row r, which is +-1.0. Let pr = mpermu[r]. * In this case, nincol==1 and mpt[0] == pr on entry. * if mpt[0] == pr <= jpiv * then this slack is completely unaffected by L; * this is reflected by the fact that save_where = last * after the first loop, so none of the remaining loops * ever execute, * else if mpt[0] == pr > jpiv, but pr-jpiv > ndo * then the slack is also unaffected by L, this time because * its row is "after" L. During factorization, it may * be the case that the first part of the basis is upper * triangular (c_ekktria), but it may also be the case that the * last part of the basis is upper triangular (in which case the * L triangle gets "chopped off" on the right). In both cases, * no L entries are required. Since in this case the tests * (i<=ndo) will fail (and dwork1[ipiv]==1.0), the code will * do nothing. * else if mpt[0] == pr > jpiv and pr-jpiv <= ndo * then the slack *is* affected by L. * the for-loop inside the second while-loop will discover * that none of the factors for the corresponding column of L * are non-zero in the slack column, so last will not be incremented. * We multiply the eta-vector, and the last loop does nothing. */ static int c_ekkftj4_sparse(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, int nincol,int * COIN_RESTRICT spare) { const int nrow = fact->nrow; /* this is where the L factors start, because this is the place * where c_ekktria starts laying them down (see initialization of xnetal). */ int lstart=fact->lstart; const int * COIN_RESTRICT hpivco = fact->kcpadr; const double * COIN_RESTRICT dluval = fact->xeeadr; const int * COIN_RESTRICT hrowi = fact->xeradr; const int * COIN_RESTRICT mcstrt = fact->xcsadr+lstart-1; double tolerance = fact->zeroTolerance; int jpiv=hpivco[lstart]-1; char * COIN_RESTRICT nonzero=fact->nonzero; int ndo=fact->xnetalval; int k,nStack; int nList=0; int iPivot; int * COIN_RESTRICT list = spare; int * COIN_RESTRICT stack = spare+nrow; int * COIN_RESTRICT next = stack+nrow; double dv; int iel; int nput=0,kput=nrow; int check=jpiv+ndo+1; const int * COIN_RESTRICT mcstrt2 = mcstrt-jpiv; for (k=0;kjpiv&&iPivotjpiv&&kPivotmcstrt2[kPivot]) { /* finished so mark */ list[nList++]=kPivot; nonzero[kPivot]=1; } else { kPivot=UNSHIFT_INDEX(hrowi[j]); /* put back on stack */ next[nStack++] ++; if (!nonzero[kPivot]) { /* and new one */ stack[nStack]=kPivot; nonzero[kPivot]=2; next[nStack++]=mcstrt2[kPivot+1]+1; } } } else if (kPivot>=check) { list[--kput]=kPivot; nonzero[kPivot]=1; } } } else if (nonzero[iPivot]!=1) { /* nothing to do (except check size at end) */ list[--kput]=iPivot; nonzero[iPivot]=1; } } for (k=nList-1;k>=0;k--) { double dv; iPivot = list[k]; dv = dwork1[iPivot]; nonzero[iPivot]=0; if (fabs(dv) > tolerance) { /* the same code as in c_ekkftj4p */ int kce1 = mcstrt2[iPivot + 1]; for (iel = mcstrt2[iPivot]; iel > kce1; --iel) { int irow0 = hrowi[iel]; SHIFT_REF(dwork1, irow0) += dv * dluval[iel]; } mpt[nput++]=iPivot; } else { dwork1[iPivot]=0.0; /* force to zero, not just near zero */ } } /* check remainder */ for (k=kput;k tolerance) { mpt[nput++]=iPivot; } else { dwork1[iPivot]=0.0; /* force to zero, not just near zero */ } } return (nput); } /* c_ekkftj4 */ /* * This applies the R transformations of the F-T LU update procedure, * equation 3.11 on p. 270 in the 1972 Math Programming paper. * Note that since the non-zero off-diagonal elements are in a row, * multiplying an R by a column is a reduction, not like applying * L or U. * * Note that this may introduce new non-zeros in dwork1, * since an hpivco entry may correspond to a zero element, * and that some non-zeros in dwork1 may be cancelled. */ static int c_ekkftjl_sparse3(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, int * COIN_RESTRICT hput, double * COIN_RESTRICT dluput , int nincol) { int i; int knext; int ipiv; double dv; const double * COIN_RESTRICT dluval = fact->R_etas_element+1; const int * COIN_RESTRICT hrowi = fact->R_etas_index+1; const int * COIN_RESTRICT mcstrt = fact->R_etas_start; int ndo=fact->nR_etas; double tolerance = fact->zeroTolerance; const int * COIN_RESTRICT hpivco = fact->hpivcoR; /* and make cleaner */ hput++; dluput++; /* DO ANY ROW TRANSFORMATIONS */ /* Function Body */ /* mpt has correct list of nonzeros */ if (ndo != 0) { knext = mcstrt[1]; for (i = 1; i <= ndo; ++i) { int k1 = knext; /* == mcstrt[i] */ int iel; ipiv = hpivco[i]; dv = dwork1[ipiv]; bool onList = (dv!=0.0); knext = mcstrt[i + 1]; for (iel = knext ; iel < k1; ++iel) { int irow = hrowi[iel]; dv += SHIFT_REF(dwork1, irow) * dluval[iel]; } /* (1) if dwork[ipiv] == 0.0, then this may add a non-zero. * (2) if dwork[ipiv] != 0.0, then this may cancel out a non-zero. */ if (onList) { if (fabs(dv) > tolerance) { dwork1[ipiv]=dv; } else { dwork1[ipiv] = 1.0e-128; } } else { if (fabs(dv) > tolerance) { /* put on list if not there */ mpt[nincol++]=ipiv; dwork1[ipiv]=dv; } } } } knext=0; for (i=0; i tolerance) { hput[knext]=SHIFT_INDEX(ipiv); dluput[knext]=dv; mpt[knext++]=ipiv; } else { dwork1[ipiv]=0.0; } } return knext; } /* c_ekkftjl */ static int c_ekkftjl_sparse2(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int * COIN_RESTRICT mpt, int nincol) { double tolerance = fact->zeroTolerance; const double * COIN_RESTRICT dluval = fact->R_etas_element+1; const int * COIN_RESTRICT hrowi = fact->R_etas_index+1; const int * COIN_RESTRICT mcstrt = fact->R_etas_start; int ndo=fact->nR_etas; const int * COIN_RESTRICT hpivco = fact->hpivcoR; int i; int knext; int ipiv; double dv; /* DO ANY ROW TRANSFORMATIONS */ /* Function Body */ /* mpt has correct list of nonzeros */ if (ndo != 0) { knext = mcstrt[1]; for (i = 1; i <= ndo; ++i) { int k1 = knext; /* == mcstrt[i] */ int iel; ipiv = hpivco[i]; dv = dwork1[ipiv]; bool onList = (dv!=0.0); knext = mcstrt[i + 1]; for (iel = knext ; iel < k1; ++iel) { int irow = hrowi[iel]; dv += SHIFT_REF(dwork1, irow) * dluval[iel]; } /* (1) if dwork[ipiv] == 0.0, then this may add a non-zero. * (2) if dwork[ipiv] != 0.0, then this may cancel out a non-zero. */ if (onList) { if (fabs(dv) > tolerance) { dwork1[ipiv]=dv; } else { dwork1[ipiv] = 1.0e-128; } } else { if (fabs(dv) > tolerance) { /* put on list if not there */ mpt[nincol++]=ipiv; dwork1[ipiv]=dv; } } } } knext=0; for (i=0; i tolerance) { mpt[knext++]=ipiv; } else { dwork1[ipiv]=0.0; } } return knext; } /* c_ekkftjl */ static void c_ekkftjl(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1) { double tolerance = fact->zeroTolerance; const double * COIN_RESTRICT dluval = fact->R_etas_element+1; const int * COIN_RESTRICT hrowi = fact->R_etas_index+1; const int * COIN_RESTRICT mcstrt = fact->R_etas_start; int ndo=fact->nR_etas; const int * COIN_RESTRICT hpivco = fact->hpivcoR; int i; int knext; /* DO ANY ROW TRANSFORMATIONS */ /* Function Body */ if (ndo != 0) { /* * The following three lines are here just to ensure that this * new formulation of the loop has exactly the same effect * as the original. */ { int ipiv = hpivco[1]; double dv = dwork1[ipiv]; dwork1[ipiv] = (fabs(dv) > tolerance) ? dv : 0.0; } knext = mcstrt[1]; for (i = 1; i <= ndo; ++i) { int k1 = knext; /* == mcstrt[i] */ int ipiv = hpivco[i]; double dv = dwork1[ipiv]; int iel; //#define UNROLL3 2 #ifndef UNROLL3 #if CLP_OSL==2||CLP_OSL==3 #define UNROLL3 2 #else #define UNROLL3 1 #endif #endif knext = mcstrt[i + 1]; #if UNROLL3<2 for (iel = knext ; iel < k1; ++iel) { int irow = hrowi[iel]; dv += SHIFT_REF(dwork1, irow) * dluval[iel]; } #else iel = knext; if (((k1-knext)&1)!=0) { int irow = hrowi[iel]; dv += SHIFT_REF(dwork1, irow) * dluval[iel]; iel++; } for ( ; iel < k1; iel+=2) { int irow0 = hrowi[iel]; double dval0 = dluval[iel]; int irow1 = hrowi[iel+1]; double dval1 = dluval[iel+1]; dv += SHIFT_REF(dwork1, irow0) * dval0; dv += SHIFT_REF(dwork1, irow1) * dval1; } #endif /* (1) if dwork[ipiv] == 0.0, then this may add a non-zero. * (2) if dwork[ipiv] != 0.0, then this may cancel out a non-zero. */ dwork1[ipiv] = (fabs(dv) > tolerance) ? dv : 0.0; } } } /* c_ekkftjl */ /* this assumes it is ok to reference back[loop_limit] */ /* another 3 seconds from a ~570 second run can be trimmed * by using two routines, one with scan==true and the other false, * since that eliminates the branch instructions involving them * entirely. This was how the code was originally written. * However, I'm still hoping that eventually we can use * C++ templates to do that for us automatically. */ static void c_ekkftjup_scan_aux(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, double * COIN_RESTRICT dworko , int loop_limit, int *ip, int ** mptp) { const double * COIN_RESTRICT dluval = fact->xeeadr+1; const int * COIN_RESTRICT hrowi = fact->xeradr+1; const int * COIN_RESTRICT mcstrt = fact->xcsadr; const int * COIN_RESTRICT hpivro = fact->krpadr; const int * COIN_RESTRICT back=fact->back; double tolerance = fact->zeroTolerance; int ipiv = *ip; double dv = dwork1[ipiv]; int * mptX = *mptp; assert (mptX); while (ipiv != loop_limit) { int next_ipiv = back[ipiv]; dwork1[ipiv] = 0.0; #ifndef UNROLL4 #define UNROLL4 2 #endif /* invariant: dv == dwork1[ipiv] */ /* in the case of world.mps with dual, this condition is true * only 20-60% of the time. */ if (fabs(dv) > tolerance) { const int kx = mcstrt[ipiv]; const int nel = hrowi[kx-1]; const double dpiv = dluval[kx-1]; #if UNROLL4>1 const int * hrowi2=hrowi+kx; const int * hrowi2end=hrowi2+nel; const double * dluval2=dluval+kx; #else int iel; #endif dv*=dpiv; /* * The following loop is the unrolled version of this: * * for (iel = kx+1; iel <= kx + nel; iel++) { * SHIFT_REF(dwork1, hrowi[iel]) -= dv * dluval[iel]; * } */ #if UNROLL4<2 iel = kx; if (nel&1) { int irow = hrowi[iel]; double dval=dluval[iel]; SHIFT_REF(dwork1, irow) -= dv*dval; iel++; } for (; iel < kx + nel; iel+=2) { int irow0 = hrowi[iel]; int irow1 = hrowi[iel+1]; double dval0=dluval[iel]; double dval1=dluval[iel+1]; double d0=SHIFT_REF(dwork1, irow0); double d1=SHIFT_REF(dwork1, irow1); d0-=dv*dval0; d1-=dv*dval1; SHIFT_REF(dwork1, irow0)=d0; SHIFT_REF(dwork1, irow1)=d1; } /* end loop */ #else if ((nel&1)!=0) { int irow = *hrowi2; double dval=*dluval2; SHIFT_REF(dwork1, irow) -= dv*dval; hrowi2++; dluval2++; } for (; hrowi2 < hrowi2end; hrowi2 +=2,dluval2 +=2) { int irow0 = hrowi2[0]; int irow1 = hrowi2[1]; double dval0=dluval2[0]; double dval1=dluval2[1]; double d0=SHIFT_REF(dwork1, irow0); double d1=SHIFT_REF(dwork1, irow1); d0-=dv*dval0; d1-=dv*dval1; SHIFT_REF(dwork1, irow0)=d0; SHIFT_REF(dwork1, irow1)=d1; } #endif /* put this down here so that dv is less likely to cause a stall */ if (fabs(dv) >= tolerance) { int iput=hpivro[ipiv]; dworko[iput]=dv; *mptX++=iput-1; } } dv = dwork1[next_ipiv]; ipiv=next_ipiv; } /* endwhile */ *mptp = mptX; *ip = ipiv; } static void c_ekkftjup_aux3(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, double * COIN_RESTRICT dworko, const int * COIN_RESTRICT back, const int * COIN_RESTRICT hpivro, int *ipivp, int loop_limit, int **mptXp) { double tolerance = fact->zeroTolerance; int ipiv = *ipivp; if (ipiv!=loop_limit) { int *mptX = *mptXp; double dv = dwork1[ipiv]; do { int next_ipiv = back[ipiv]; double next_dv=dwork1[next_ipiv]; dwork1[ipiv]=0.0; if (fabs(dv)>=tolerance) { int iput=hpivro[ipiv]; dworko[iput]=dv; *mptX++=iput-1; } ipiv = next_ipiv; dv = next_dv; } while (ipiv!=loop_limit); *mptXp = mptX; *ipivp = ipiv; } } static void c_ekkftju_dense(const double *dluval, const int * COIN_RESTRICT hrowi, const int * COIN_RESTRICT mcstrt, const int * COIN_RESTRICT back, double * COIN_RESTRICT dwork1, int * start, int last, int offset , double *densew) { int ipiv=*start; while (ipiv>last ) { const int ipiv1=ipiv; double dv1=dwork1[ipiv1]; ipiv=back[ipiv]; if (fabs(dv1) > 1.0e-14) { const int kx1 = mcstrt[ipiv1]; const int nel1 = hrowi[kx1-1]; const double dpiv1 = dluval[kx1-1]; int iel,k; const int n1=offset+ipiv1; /* number in dense part */ const int nsparse1=nel1-n1; const int k1=kx1+nsparse1; const double *dlu1=&dluval[k1]; int ipiv2=back[ipiv1]; const int nskip=ipiv1-ipiv2; dv1*=dpiv1; dwork1[ipiv1]=dv1; for (k = n1 - (nskip-1) -1; k >=0 ; k--) { const double dval = dv1*dlu1[k]; double dv2=densew[k]-dval; ipiv=back[ipiv]; if (fabs(dv2) > 1.0e-14) { const int kx2 = mcstrt[ipiv2]; const int nel2 = hrowi[kx2-1]; const double dpiv2 = dluval[kx2-1]; /* number in dense part is k */ const int nsparse2=nel2-k; const int k2=kx2+nsparse2; const double *dlu2=&dluval[k2]; dv2*=dpiv2; densew[k]=dv2; /* was dwork1[ipiv2]=dv2; */ k--; /* * The following loop is the unrolled version of: * * for (; k >= 0; k--) { * densew[k]-=dv1*dlu1[k]+dv2*dlu2[k]; * } */ if ((k&1)==0) { densew[k]-=dv1*dlu1[k]+dv2*dlu2[k]; k--; } for (; k >=0 ; k-=2) { double da,db; da=densew[k]; db=densew[k-1]; da-=dv1*dlu1[k]; db-=dv1*dlu1[k-1]; da-=dv2*dlu2[k]; db-=dv2*dlu2[k-1]; densew[k]=da; densew[k-1]=db; } /* end loop */ /* * The following loop is the unrolled version of: * * for (iel=kx2+nsparse2-1; iel >= kx2; iel--) { * SHIFT_REF(dwork1, hrowi[iel]) -= dv2*dluval[iel]; * } */ iel=kx2+nsparse2-1; if ((nsparse2&1)!=0) { int irow0 = hrowi[iel]; double dval=dluval[iel]; SHIFT_REF(dwork1,irow0) -= dv2*dval; iel--; } for (; iel >=kx2 ; iel-=2) { double dval0 = dluval[iel]; double dval1 = dluval[iel-1]; int irow0 = hrowi[iel]; int irow1 = hrowi[iel-1]; double d0 = SHIFT_REF(dwork1, irow0); double d1 = SHIFT_REF(dwork1, irow1); d0-=dv2*dval0; d1-=dv2*dval1; SHIFT_REF(dwork1, irow0) = d0; SHIFT_REF(dwork1, irow1) = d1; } /* end loop */ } else { densew[k]=0.0; /* skip if next deleted */ k-=ipiv2-ipiv-1; ipiv2=ipiv; if (ipiv=0 ; k--) { double dval; dval=dv1*dlu1[k]; densew[k]=densew[k]-dval; } } } } /* * The following loop is the unrolled version of: * * for (iel=kx1+nsparse1-1; iel >= kx1; iel--) { * SHIFT_REF(dwork1, hrowi[iel]) -= dv1*dluval[iel]; * } */ iel=kx1+nsparse1-1; if ((nsparse1&1)!=0) { int irow0 = hrowi[iel]; double dval=dluval[iel]; SHIFT_REF(dwork1, irow0) -= dv1*dval; iel--; } for (; iel >=kx1 ; iel-=2) { double dval0=dluval[iel]; double dval1=dluval[iel-1]; int irow0 = hrowi[iel]; int irow1 = hrowi[iel-1]; double d0=SHIFT_REF(dwork1, irow0); double d1=SHIFT_REF(dwork1, irow1); d0-=dv1*dval0; d1-=dv1*dval1; SHIFT_REF(dwork1, irow0) = d0; SHIFT_REF(dwork1, irow1) = d1; } /* end loop */ } else { dwork1[ipiv1]=0.0; } /* endif */ } /* endwhile */ *start=ipiv; } /* do not use return value if mpt==0 */ /* using dual, this is usually called via c_ekkftrn_ft, from c_ekksdul * (so mpt is non-null). * it is generally called every iteration, but sometimes several iterations * are skipped (null moves?). * * generally, back[i] == i-1 (initialized in c_ekkshfv towards the end). */ static int c_ekkftjup(COIN_REGISTER3 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int last, double * COIN_RESTRICT dworko , int * COIN_RESTRICT mpt) { const double * COIN_RESTRICT dluval = fact->xeeadr; const int * COIN_RESTRICT hrowi = fact->xeradr; const int * COIN_RESTRICT mcstrt = fact->xcsadr; const int * COIN_RESTRICT hpivro = fact->krpadr; double tolerance = fact->zeroTolerance; int ndenuc=fact->ndenuc; const int first_dense=fact->first_dense; const int last_dense=fact->last_dense; int i; int * mptX = mpt; const int nrow = fact->nrow; const int * COIN_RESTRICT back=fact->back; int ipiv=back[nrow+1]; if (last_dense>first_dense&&mcstrt[ipiv]>=mcstrt[last_dense]) { c_ekkftjup_scan_aux(fact, dwork1, dworko, last_dense, &ipiv, &mptX); { int j; int n=0; const int firstDense = nrow- ndenuc+1; double *densew = &dwork1[firstDense]; int offset; /* check first dense to see where in triangle it is */ int last=first_dense; const int k1=mcstrt[last]; const int k2=k1+hrowi[k1]; for (j=k2; j>k1; j--) { int irow = UNSHIFT_INDEX(hrowi[j]); if (irow=tolerance) { int iput=hpivro[ipiv]; dworko[iput]=-dv; *mptX++=iput-1; } ipiv = next_ipiv; dv = next_dv; } while (ipiv!=0); } return static_cast(mptX-mpt); } /* this assumes it is ok to reference back[loop_limit] */ /* another 3 seconds from a ~570 second run can be trimmed * by using two routines, one with scan==true and the other false, * since that eliminates the branch instructions involving them * entirely. This was how the code was originally written. * However, I'm still hoping that eventually we can use * C++ templates to do that for us automatically. */ static void c_ekkftjup_scan_aux_pack(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, double * COIN_RESTRICT dworko , int loop_limit, int *ip, int ** mptp) { double tolerance = fact->zeroTolerance; const double *dluval = fact->xeeadr+1; const int *hrowi = fact->xeradr+1; const int *mcstrt = fact->xcsadr; const int *hpivro = fact->krpadr; const int * back=fact->back; int ipiv = *ip; double dv = dwork1[ipiv]; int * mptX = *mptp; #if 0 int inSlacks=0; int lastSlack; if (fact->numberSlacks!=0) lastSlack=fact->lastSlack; else lastSlack=0; if (c_ekk_IsSet(fact->bitArray,ipiv)) { printf("already in slacks - ipiv %d\n",ipiv); inSlacks=1; return; } #endif assert (mptX); while (ipiv != loop_limit) { int next_ipiv = back[ipiv]; #if 0 if (ipiv==lastSlack) { printf("now in slacks - ipiv %d\n",ipiv); inSlacks=1; break; } if (inSlacks) { assert (c_ekk_IsSet(fact->bitArray,ipiv)); assert (dluval[mcstrt[ipiv]-1]==-1.0); assert (hrowi[mcstrt[ipiv]-1]==0); } #endif dwork1[ipiv] = 0.0; /* invariant: dv == dwork1[ipiv] */ /* in the case of world.mps with dual, this condition is true * only 20-60% of the time. */ if (fabs(dv) > tolerance) { const int kx = mcstrt[ipiv]; const int nel = hrowi[kx-1]; const double dpiv = dluval[kx-1]; #ifndef UNROLL5 #define UNROLL5 2 #endif #if UNROLL5>1 const int * hrowi2=hrowi+kx; const int * hrowi2end=hrowi2+nel; const double * dluval2=dluval+kx; #else int iel; #endif dv*=dpiv; /* * The following loop is the unrolled version of this: * * for (iel = kx+1; iel <= kx + nel; iel++) { * SHIFT_REF(dwork1, hrowi[iel]) -= dv * dluval[iel]; * } */ #if UNROLL5<2 iel = kx; if (nel&1) { int irow = hrowi[iel]; double dval=dluval[iel]; SHIFT_REF(dwork1, irow) -= dv*dval; iel++; } for (; iel < kx + nel; iel+=2) { int irow0 = hrowi[iel]; int irow1 = hrowi[iel+1]; double dval0=dluval[iel]; double dval1=dluval[iel+1]; double d0=SHIFT_REF(dwork1, irow0); double d1=SHIFT_REF(dwork1, irow1); d0-=dv*dval0; d1-=dv*dval1; SHIFT_REF(dwork1, irow0)=d0; SHIFT_REF(dwork1, irow1)=d1; } /* end loop */ #else if ((nel&1)!=0) { int irow = *hrowi2; double dval=*dluval2; SHIFT_REF(dwork1, irow) -= dv*dval; hrowi2++; dluval2++; } for (; hrowi2 < hrowi2end; hrowi2 +=2,dluval2 +=2) { int irow0 = hrowi2[0]; int irow1 = hrowi2[1]; double dval0=dluval2[0]; double dval1=dluval2[1]; double d0=SHIFT_REF(dwork1, irow0); double d1=SHIFT_REF(dwork1, irow1); d0-=dv*dval0; d1-=dv*dval1; SHIFT_REF(dwork1, irow0)=d0; SHIFT_REF(dwork1, irow1)=d1; } #endif /* put this down here so that dv is less likely to cause a stall */ if (fabs(dv) >= tolerance) { int iput=hpivro[ipiv]; *dworko++=dv; *mptX++=iput-1; } } dv = dwork1[next_ipiv]; ipiv=next_ipiv; } /* endwhile */ *mptp = mptX; *ip = ipiv; } static void c_ekkftjup_aux3_pack(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, double * COIN_RESTRICT dworko, const int * COIN_RESTRICT back, const int * COIN_RESTRICT hpivro, int *ipivp, int loop_limit, int **mptXp) { double tolerance = fact->zeroTolerance; int ipiv = *ipivp; if (ipiv!=loop_limit) { int *mptX = *mptXp; double dv = dwork1[ipiv]; do { int next_ipiv = back[ipiv]; double next_dv=dwork1[next_ipiv]; dwork1[ipiv]=0.0; if (fabs(dv)>=tolerance) { int iput=hpivro[ipiv]; *dworko++=dv; *mptX++=iput-1; } ipiv = next_ipiv; dv = next_dv; } while (ipiv!=loop_limit); *mptXp = mptX; *ipivp = ipiv; } } /* do not use return value if mpt==0 */ /* using dual, this is usually called via c_ekkftrn_ft, from c_ekksdul * (so mpt is non-null). * it is generally called every iteration, but sometimes several iterations * are skipped (null moves?). * * generally, back[i] == i-1 (initialized in c_ekkshfv towards the end). */ static int c_ekkftjup_pack(COIN_REGISTER3 const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, int last, double * COIN_RESTRICT dworko , int * COIN_RESTRICT mpt) { const double * COIN_RESTRICT dluval = fact->xeeadr; const int * COIN_RESTRICT hrowi = fact->xeradr; const int * COIN_RESTRICT mcstrt = fact->xcsadr; const int * COIN_RESTRICT hpivro = fact->krpadr; double tolerance = fact->zeroTolerance; int ndenuc=fact->ndenuc; const int first_dense=fact->first_dense; const int last_dense=fact->last_dense; int * mptX = mpt; int * mptY = mpt; const int nrow = fact->nrow; const int * COIN_RESTRICT back=fact->back; int ipiv=back[nrow+1]; assert (mpt); if (last_dense>first_dense&&mcstrt[ipiv]>=mcstrt[last_dense]) { c_ekkftjup_scan_aux_pack(fact, dwork1, dworko, last_dense, &ipiv, &mptX ); /* adjust */ dworko+= (mptX-mpt); mpt=mptX; { int j; int n=0; const int firstDense = nrow- ndenuc+1; double *densew = &dwork1[firstDense]; int offset; /* check first dense to see where in triangle it is */ int last=first_dense; const int k1=mcstrt[last]; const int k2=k1+hrowi[k1]; for (j=k2; j>k1; j--) { int irow = UNSHIFT_INDEX(hrowi[j]); if (irow=tolerance) { int iput=hpivro[ipiv]; *dworko++=-dv; *mptX++=iput-1; } ipiv = next_ipiv; } return static_cast(mptX-mptY); } static int c_ekkftju_sparse_a(COIN_REGISTER2 const EKKfactinfo * COIN_RESTRICT2 fact, int * COIN_RESTRICT mpt, int nincol,int * COIN_RESTRICT spare) { const int * COIN_RESTRICT hrowi = fact->xeradr+1; const int * COIN_RESTRICT mcstrt = fact->xcsadr; const int nrow = fact->nrow; char * COIN_RESTRICT nonzero=fact->nonzero; int k,nStack,kx,nel; int nList=0; int iPivot; /*int kkk=nincol;*/ int * COIN_RESTRICT list = spare; int * COIN_RESTRICT stack = spare+nrow; int * COIN_RESTRICT next = stack+nrow; for (k=0;kxeeadr+1; const int * COIN_RESTRICT hrowi = fact->xeradr+1; const int * COIN_RESTRICT mcstrt = fact->xcsadr; const int * COIN_RESTRICT hpivro = fact->krpadr; double tolerance = fact->zeroTolerance; char * COIN_RESTRICT nonzero=fact->nonzero; int i,k,kx,nel; int iPivot; /*int kkk=nincol;*/ int * COIN_RESTRICT list = spare; i=nList-1; nList=0; for (;i>=0;i--) { double dpiv; double dv; iPivot = list[i]; /*printf("pivot %d %d\n",i,iPivot);*/ dv=dwork1[iPivot]; kx = mcstrt[iPivot]; nel = hrowi[kx-1]; dwork1[iPivot]=0.0; dpiv = dluval[kx-1]; dv*=dpiv; nonzero[iPivot]=0; iPivot=hpivro[iPivot]; if (fabs(dv)>=tolerance) { *dworko++=dv; mpt[nList++]=iPivot-1; for (k = kx; k < kx+nel; k++) { double dval; double dd; int irow = hrowi[k]; dval=dluval[k]; dd=dwork1[irow]; dd-=dv*dval; dwork1[irow]=dd; } } } return (nList); } /* dwork1 = (B^-1)dwork1; * I think dpermu[1..nrow+1] is zeroed on exit (?) * I don't think it is expected to have any particular value on entry (?) */ int c_ekkftrn(COIN_REGISTER const EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, double * COIN_RESTRICT dpermu, int * COIN_RESTRICT mpt,int numberNonZero) { const int * COIN_RESTRICT mpermu = fact->mpermu; int lastNonZero; int firstNonZero = c_ekkshfpi_list2(mpermu+1, dwork1+1, dpermu, mpt, numberNonZero,&lastNonZero); if (fact->nnentl&&lastNonZero>=fact->firstLRow) { /* dpermu = (L^-1)dpermu */ c_ekkftj4p(fact, dpermu, firstNonZero); } int lastSlack; /* dpermu = (R^-1) dpermu */ c_ekkftjl(fact, dpermu); assert (fact->numberSlacks!=0||!fact->lastSlack); lastSlack=fact->lastSlack; /* dwork1 = (U^-1)dpermu; dpermu zeroed (?) */ return c_ekkftjup(fact, dpermu, lastSlack, dwork1, mpt); } /* c_ekkftrn */ int c_ekkftrn_ft(COIN_REGISTER EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1_ft, int * COIN_RESTRICT mpt_ft, int *nincolp_ft) { double * COIN_RESTRICT dpermu_ft = fact->kadrpm; int * COIN_RESTRICT spare = reinterpret_cast(fact->kp1adr); int nincol = *nincolp_ft; int nuspik; double * COIN_RESTRICT dluvalPut = fact->xeeadr+fact->nnentu+1; int * COIN_RESTRICT hrowiPut = fact->xeradr+fact->nnentu+1; const int nrow = fact->nrow; /* mpermu contains the permutation */ const int * COIN_RESTRICT mpermu=fact->mpermu; int lastSlack; int kdnspt = fact->nnetas - fact->nnentl; bool isRoom = (fact->nnentu + (nrow << 1) < (kdnspt - 2) + fact->R_etas_start[fact->nR_etas + 1]); /* say F-T will be sorted */ fact->sortedEta=1; assert (fact->numberSlacks!=0||!fact->lastSlack); lastSlack=fact->lastSlack; #ifdef CLP_REUSE_ETAS bool skipStuff = (fact->reintro>=0); int save_nR_etas=fact->nR_etas; int * save_hpivcoR=fact->hpivcoR; int * save_R_etas_start=fact->R_etas_start; if (skipStuff) { // just move int * putSeq = fact->xrsadr+2*fact->nrowmx+2; int * position = putSeq+fact->maxinv; int * putStart = position+fact->maxinv; memset(dwork1_ft,0,nincol*sizeof(double)); int iPiv=fact->reintro; int start=putStart[iPiv]&0x7fffffff; int end=putStart[iPiv+1]&0x7fffffff; double * COIN_RESTRICT dluval = fact->xeeadr; int * COIN_RESTRICT hrowi = fact->xeradr; double dValue; if (fact->reintronrow) { iPiv++; dValue=1.0/dluval[start++]; } else { iPiv=hrowi[--end]; dValue=dluval[end]; start++; int ndoSkip=0; for (int i=fact->nrow;ireintro;i++) { if ((putStart[i]&0x80000000)==0) ndoSkip++; } fact->nR_etas-=ndoSkip; fact->hpivcoR+=ndoSkip; fact->R_etas_start+=ndoSkip; } dpermu_ft[iPiv]=dValue; if (fact->if_sparse_update>0 && DENSE_THRESHOLDif_sparse_update>0 && DENSE_THRESHOLDnnentl) { nincol = c_ekkftj4_sparse(fact, dpermu_ft, mpt_ft, nincol,spare); } } /* DO ROW ETAS IN L */ if (isRoom) { ++fact->nnentu; nincol= c_ekkftjl_sparse3(fact, dpermu_ft, mpt_ft, hrowiPut, dluvalPut,nincol); nuspik = nincol; /* temporary */ /* say not sorted */ fact->sortedEta=0; } else { /* no room */ nuspik=-3; nincol= c_ekkftjl_sparse2(fact, dpermu_ft, mpt_ft, nincol); } /* DO U */ if (DENSE_THRESHOLD>nrow-fact->numberSlacks) { nincol = c_ekkftjup_pack(fact, dpermu_ft,lastSlack, dwork1_ft, mpt_ft); } else { nincol= c_ekkftju_sparse_a(fact, mpt_ft, nincol, spare); nincol = c_ekkftju_sparse_b(fact, dpermu_ft, dwork1_ft , mpt_ft, nincol, spare); } } else { if (!skipStuff) { int lastNonZero; int firstNonZero = c_ekkshfpi_list(mpermu+1, dwork1_ft, dpermu_ft, mpt_ft, nincol,&lastNonZero); if (fact->nnentl&&lastNonZero>=fact->firstLRow) { /* dpermu_ft = (L^-1)dpermu_ft */ c_ekkftj4p(fact, dpermu_ft, firstNonZero); } } /* dpermu_ft = (R^-1) dpermu_ft */ c_ekkftjl(fact, dpermu_ft); if (isRoom) { /* fake start to allow room for pivot */ /* dluval[fact->nnentu...] = non-zeros of dpermu_ft; * hrowi[fact->nnentu..] = indices of these non-zeros; * near-zeros in dluval flattened */ ++fact->nnentu; nincol= c_ekkscmv(fact,fact->nrow, dpermu_ft, hrowiPut, dluvalPut); /* * note that this is not the value of nincol determined by c_ekkftjup. * For Forrest-Tomlin update we want vector before U * this vector will replace one in U */ nuspik = nincol; } else { /* no room */ nuspik = -3; } /* dwork1_ft = (U^-1)dpermu_ft; dpermu_ft zeroed (?) */ nincol = c_ekkftjup_pack(fact, dpermu_ft, lastSlack, dwork1_ft, mpt_ft); } #ifdef CLP_REUSE_ETAS fact->nR_etas=save_nR_etas; fact->hpivcoR=save_hpivcoR; fact->R_etas_start=save_R_etas_start; #endif *nincolp_ft = nincol; return (nuspik); } /* c_ekkftrn */ void c_ekkftrn2(COIN_REGISTER EKKfactinfo * COIN_RESTRICT2 fact, double * COIN_RESTRICT dwork1, double * COIN_RESTRICT dpermu1,int * COIN_RESTRICT mpt1, int *nincolp, double * COIN_RESTRICT dwork1_ft, int * COIN_RESTRICT mpt_ft, int *nincolp_ft) { double * COIN_RESTRICT dluvalPut = fact->xeeadr+fact->nnentu+1; int * COIN_RESTRICT hrowiPut = fact->xeradr+fact->nnentu+1; const int nrow = fact->nrow; /* mpermu contains the permutation */ const int * COIN_RESTRICT mpermu=fact->mpermu; int lastSlack; assert (fact->numberSlacks!=0||!fact->lastSlack); lastSlack=fact->lastSlack; int nincol = *nincolp_ft; /* using dwork1 instead double *dpermu_ft = fact->kadrpm; */ int * spare = reinterpret_cast(fact->kp1adr); int kdnspt = fact->nnetas - fact->nnentl; bool isRoom = (fact->nnentu + (nrow << 1) < (kdnspt - 2) + fact->R_etas_start[fact->nR_etas + 1]); /* say F-T will be sorted */ fact->sortedEta=1; int lastNonZero; int firstNonZero = c_ekkshfpi_list2(mpermu+1, dwork1+1, dpermu1, mpt1, *nincolp,&lastNonZero); if (fact->nnentl&&lastNonZero>=fact->firstLRow) { /* dpermu1 = (L^-1)dpermu1 */ c_ekkftj4p(fact, dpermu1, firstNonZero); } #ifdef CLP_REUSE_ETAS bool skipStuff = (fact->reintro>=0); int save_nR_etas=fact->nR_etas; int * save_hpivcoR=fact->hpivcoR; int * save_R_etas_start=fact->R_etas_start; if (skipStuff) { // just move int * putSeq = fact->xrsadr+2*fact->nrowmx+2; int * position = putSeq+fact->maxinv; int * putStart = position+fact->maxinv; memset(dwork1_ft,0,nincol*sizeof(double)); int iPiv=fact->reintro; int start=putStart[iPiv]&0x7fffffff; int end=putStart[iPiv+1]&0x7fffffff; double * COIN_RESTRICT dluval = fact->xeeadr; int * COIN_RESTRICT hrowi = fact->xeradr; double dValue; if (fact->reintronrow) { iPiv++; dValue=1.0/dluval[start++]; } else { iPiv=hrowi[--end]; dValue=dluval[end]; start++; int ndoSkip=0; for (int i=fact->nrow;ireintro;i++) { if ((putStart[i]&0x80000000)==0) ndoSkip++; } fact->nR_etas-=ndoSkip; fact->hpivcoR+=ndoSkip; fact->R_etas_start+=ndoSkip; } dwork1[iPiv]=dValue; if (fact->if_sparse_update>0 && DENSE_THRESHOLDif_sparse_update>0 && DENSE_THRESHOLDnnentl) { nincol = c_ekkftj4_sparse(fact, dwork1, mpt_ft, nincol,spare); } } /* DO ROW ETAS IN L */ if (isRoom) { ++fact->nnentu; nincol= c_ekkftjl_sparse3(fact, dwork1, mpt_ft, hrowiPut, dluvalPut, nincol); fact->nuspike = nincol; /* say not sorted */ fact->sortedEta=0; } else { /* no room */ fact->nuspike=-3; nincol= c_ekkftjl_sparse2(fact, dwork1, mpt_ft, nincol); } } else { if (!skipStuff) { int lastNonZero; int firstNonZero = c_ekkshfpi_list(mpermu+1, dwork1_ft, dwork1, mpt_ft, nincol,&lastNonZero); if (fact->nnentl&&lastNonZero>=fact->firstLRow) { /* dpermu_ft = (L^-1)dpermu_ft */ c_ekkftj4p(fact, dwork1, firstNonZero); } } c_ekkftjl(fact, dwork1); if (isRoom) { /* fake start to allow room for pivot */ /* dluval[fact->nnentu...] = non-zeros of dpermu_ft; * hrowi[fact->nnentu..] = indices of these non-zeros; * near-zeros in dluval flattened */ ++fact->nnentu; nincol= c_ekkscmv(fact,fact->nrow, dwork1, hrowiPut, dluvalPut); /* * note that this is not the value of nincol determined by c_ekkftjup. * For Forrest-Tomlin update we want vector before U * this vector will replace one in U */ fact->nuspike = nincol; } else { /* no room */ fact->nuspike = -3; } } #ifdef CLP_REUSE_ETAS fact->nR_etas=save_nR_etas; fact->hpivcoR=save_hpivcoR; fact->R_etas_start=save_R_etas_start; #endif /* dpermu1 = (R^-1) dpermu1 */ c_ekkftjl(fact, dpermu1); /* DO U */ if (fact->if_sparse_update<=0 || DENSE_THRESHOLD>nrow-fact->numberSlacks) { nincol = c_ekkftjup_pack(fact, dwork1,lastSlack, dwork1_ft, mpt_ft); } else { nincol= c_ekkftju_sparse_a(fact, mpt_ft, nincol, spare); nincol = c_ekkftju_sparse_b(fact, dwork1, dwork1_ft , mpt_ft, nincol, spare); } *nincolp_ft = nincol; /* dwork1 = (U^-1)dpermu1; dpermu1 zeroed (?) */ *nincolp = c_ekkftjup(fact, dpermu1,lastSlack, dwork1, mpt1); } CoinMP-1.8.3/CoinUtils/src/CoinDenseVector.hpp0000644000175000017500000002704511510456064017571 0ustar renerene/* $Id: CoinDenseVector.hpp 1372 2011-01-03 23:31:00Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinDenseVector_H #define CoinDenseVector_H #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include #include "CoinHelperFunctions.hpp" //############################################################################# /** A function that tests the methods in the CoinDenseVector class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ template void CoinDenseVectorUnitTest(T dummy); //############################################################################# /** Dense Vector Stores a dense (or expanded) vector of floating point values. Type of vector elements is controlled by templating. (Some working quantities such as accumulated sums are explicitly declared of type double). This allows the components of the vector integer, single or double precision. Here is a sample usage: @verbatim const int ne = 4; double el[ne] = { 10., 40., 1., 50. } // Create vector and set its value CoinDenseVector r(ne,el); // access each element assert( r.getElements()[0]==10. ); assert( r.getElements()[1]==40. ); assert( r.getElements()[2]== 1. ); assert( r.getElements()[3]==50. ); // Test for equality CoinDenseVector r1; r1=r; // Add dense vectors. // Similarly for subtraction, multiplication, // and division. CoinDenseVector add = r + r1; assert( add[0] == 10.+10. ); assert( add[1] == 40.+40. ); assert( add[2] == 1.+ 1. ); assert( add[3] == 50.+50. ); assert( r.sum() == 10.+40.+1.+50. ); @endverbatim */ template class CoinDenseVector { private: /**@name Private member data */ //@{ /// Size of element vector int nElements_; ///Vector elements T * elements_; //@} public: /**@name Get methods. */ //@{ /// Get the size inline int getNumElements() const { return nElements_; } inline int size() const { return nElements_; } /// Get element values inline const T * getElements() const { return elements_; } /// Get element values inline T * getElements() { return elements_; } //@} //------------------------------------------------------------------- // Set indices and elements //------------------------------------------------------------------- /**@name Set methods */ //@{ /// Reset the vector (i.e. set all elemenets to zero) void clear(); /** Assignment operator */ CoinDenseVector & operator=(const CoinDenseVector &); /** Member of array operator */ T & operator[](int index) const; /** Set vector size, and elements. Size is the length of the elements vector. The element vector is copied into this class instance's member data. */ void setVector(int size, const T * elems); /** Elements set to have the same scalar value */ void setConstant(int size, T elems); /** Set an existing element in the dense vector The first argument is the "index" into the elements() array */ void setElement(int index, T element); /** Resize the dense vector to be the first newSize elements. If length is decreased, vector is truncated. If increased new entries, set to new default element */ void resize(int newSize, T fill=T()); /** Append a dense vector to this dense vector */ void append(const CoinDenseVector &); //@} /**@name norms, sum and scale */ //@{ /// 1-norm of vector inline T oneNorm() const { T norm = 0; for (int i=0; ivalue to every entry void operator+=(T value); /// subtract value from every entry void operator-=(T value); /// multiply every entry by value void operator*=(T value); /// divide every entry by value void operator/=(T value); //@} /**@name Constructors and destructors */ //@{ /** Default constructor */ CoinDenseVector(); /** Alternate Constructors - set elements to vector of Ts */ CoinDenseVector(int size, const T * elems); /** Alternate Constructors - set elements to same scalar value */ CoinDenseVector(int size, T element=T()); /** Copy constructors */ CoinDenseVector(const CoinDenseVector &); /** Destructor */ ~CoinDenseVector (); //@} private: /**@name Private methods */ //@{ /// Copy internal data void gutsOfSetVector(int size, const T * elems); /// Set all elements to a given value void gutsOfSetConstant(int size, T value); //@} }; //############################################################################# /**@name Arithmetic operators on dense vectors. NOTE: Because these methods return an object (they can't return a reference, though they could return a pointer...) they are very inefficient... */ //@{ /// Return the sum of two dense vectors template inline CoinDenseVector operator+(const CoinDenseVector& op1, const CoinDenseVector& op2){ assert(op1.size() == op2.size()); int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); const T *elements2 = op2.getElements(); T *elements3 = op3.getElements(); for(int i=0; i inline CoinDenseVector operator-(const CoinDenseVector& op1, const CoinDenseVector& op2){ assert(op1.size() == op2.size()); int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); const T *elements2 = op2.getElements(); T *elements3 = op3.getElements(); for(int i=0; i inline CoinDenseVector operator*(const CoinDenseVector& op1, const CoinDenseVector& op2){ assert(op1.size() == op2.size()); int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); const T *elements2 = op2.getElements(); T *elements3 = op3.getElements(); for(int i=0; i inline CoinDenseVector operator/(const CoinDenseVector& op1, const CoinDenseVector& op2){ assert(op1.size() == op2.size()); int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); const T *elements2 = op2.getElements(); T *elements3 = op3.getElements(); for(int i=0; iop1 and the specified operation is done entry-wise with the given value. */ //@{ /// Return the sum of a dense vector and a constant template inline CoinDenseVector operator+(const CoinDenseVector& op1, T value){ int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); T *elements3 = op3.getElements(); double dvalue = value; for(int i=0; i inline CoinDenseVector operator-(const CoinDenseVector& op1, T value){ int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); T *elements3 = op3.getElements(); double dvalue = value; for(int i=0; i inline CoinDenseVector operator*(const CoinDenseVector& op1, T value){ int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); T *elements3 = op3.getElements(); double dvalue = value; for(int i=0; i inline CoinDenseVector operator/(const CoinDenseVector& op1, T value){ int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); T *elements3 = op3.getElements(); double dvalue = value; for(int i=0; i inline CoinDenseVector operator+(T value, const CoinDenseVector& op1){ int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); T *elements3 = op3.getElements(); double dvalue = value; for(int i=0; i inline CoinDenseVector operator-(T value, const CoinDenseVector& op1){ int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); T *elements3 = op3.getElements(); double dvalue = value; for(int i=0; i inline CoinDenseVector operator*(T value, const CoinDenseVector& op1){ int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); T *elements3 = op3.getElements(); double dvalue = value; for(int i=0; i inline CoinDenseVector operator/(T value, const CoinDenseVector& op1){ int size = op1.size(); CoinDenseVector op3(size); const T *elements1 = op1.getElements(); T *elements3 = op3.getElements(); double dvalue = value; for(int i=0; i #include #include #include #include "CoinUtilsConfig.h" #include "CoinPragma.hpp" /** A function to block the popup windows that windows creates when the code crashes */ void WindowsErrorPopupBlocker(); //------------------------------------------------------------------- // // Error class used to throw exceptions // // Errors contain: // //------------------------------------------------------------------- /** Error Class thrown by an exception This class is used when exceptions are thrown. It contains:
    • message text
    • name of method throwing exception
    • name of class throwing exception or hint
    • name of file if assert
    • line number
    For asserts class=> optional hint */ class CoinError { friend void CoinErrorUnitTest(); private: CoinError() : message_(), method_(), class_(), file_(), lineNumber_() { // nothing to do here } public: //------------------------------------------------------------------- // Get methods //------------------------------------------------------------------- /**@name Get error attributes */ //@{ /// get message text inline const std::string & message() const { return message_; } /// get name of method instantiating error inline const std::string & methodName() const { return method_; } /// get name of class instantiating error (or hint for assert) inline const std::string & className() const { return class_; } /// get name of file for assert inline const std::string & fileName() const { return file_; } /// get line number of assert (-1 if not assert) inline int lineNumber() const { return lineNumber_; } /// Just print (for asserts) inline void print(bool doPrint = true) const { if (! doPrint) return; if (lineNumber_<0) { std::cout< #include #include #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" /*! \defgroup PMMDVX Packed Matrix Major Dimension Vector Expansion \brief Functions to help with major-dimension vector expansion in a packed matrix structure. This next block of functions handles the problems associated with expanding a column in a column-major representation or a row in a row-major representation. We need to be able to answer the questions: * Is there room to expand a major vector in place? * Is there sufficient free space at the end of the element and minor index storage areas (bulk storage) to hold the major vector? When the answer to the first question is `no', we need to be able to move the major vector to the free space at the end of bulk storage. When the answer to the second question is `no', we need to be able to compact the major vectors in the bulk storage area in order to regain a block of useable space at the end. presolve_make_memlists initialises a linked list that tracks the position of major vectors in the bulk storage area. It's used to locate physically adjacent vectors. presolve_expand deals with adding a coefficient to a major vector, either in-place or by moving it to free space at the end of the storage areas. There are two inline wrappers, presolve_expand_col and presolve_expand_row, defined in CoinPresolveMatrix.hpp. compact_rep compacts the major vectors in the storage areas to leave a single block of free space at the end. */ //@{ /* This first function doesn't need to be known outside of this file. */ namespace { /* compact_rep This routine compacts the major vectors in the bulk storage area, leaving a single block of free space at the end. The vectors are not reordered, just shifted down to remove gaps. */ void compact_rep (double *elems, int *indices, CoinBigIndex *starts, const int *lengths, int n, const presolvehlink *link) { # if PRESOLVE_SUMMARY printf("****COMPACTING****\n") ; # endif // for now, just look for the first element of the list int i = n ; while (link[i].pre != NO_LINK) i = link[i].pre ; CoinBigIndex j = 0 ; for (; i != n; i = link[i].suc) { CoinBigIndex s = starts[i] ; CoinBigIndex e = starts[i] + lengths[i] ; // because of the way link is organized, j <= s starts[i] = j ; for (CoinBigIndex k = s; k < e; k++) { elems[j] = elems[k] ; indices[j] = indices[k] ; j++ ; } } } } /* end unnamed namespace */ /* \brief Initialise linked list for major vector order in bulk storage Initialise the linked list that will track the order of major vectors in the element and row index bulk storage arrays. When finished, link[j].pre contains the index of the previous non-empty vector in the storage arrays and link[j].suc contains the index of the next non-empty vector. For an empty vector j, link[j].pre = link[j].suc = NO_LINK. If n is the number of major-dimension vectors, link[n] is valid; link[n].pre is the index of the last non-empty vector, and link[n].suc = NO_LINK. This routine makes the implicit assumption that the order of vectors in the storage areas matches the order in starts. (I.e., there's no check that starts[j] > starts[i] for j < i.) */ void presolve_make_memlists (/*CoinBigIndex *starts,*/ int *lengths, presolvehlink *link, int n) { int i ; int pre = NO_LINK ; for (i=0; i= bulkCap) { return (true) ; } } /* The most complicated case --- we need to move k from its current location to empty space at the end of the bulk storage. And we may need to make that! Compaction is identical to the above case. */ else { int lastcol = majlinks[nmaj].pre ; int newkcsx = majstrts[lastcol]+majlens[lastcol] ; int newkcex = newkcsx+majlens[k] ; if (newkcex+1 >= bulkCap) { compact_rep(els,minndxs,majstrts,majlens,nmaj,majlinks) ; kcsx = majstrts[k] ; kcex = kcsx + majlens[k] ; newkcsx = majstrts[lastcol]+majlens[lastcol] ; newkcex = newkcsx+majlens[k] ; if (newkcex+1 >= bulkCap) { return (true) ; } } /* Moving the vector requires three actions. First we move the data, then update the packed matrix vector start, then relink the storage order list, */ memcpy(reinterpret_cast(&minndxs[newkcsx]), reinterpret_cast(&minndxs[kcsx]),majlens[k]*sizeof(int)) ; memcpy(reinterpret_cast(&els[newkcsx]), reinterpret_cast(&els[kcsx]),majlens[k]*sizeof(double)) ; majstrts[k] = newkcsx ; PRESOLVE_REMOVE_LINK(majlinks,k) ; PRESOLVE_INSERT_LINK(majlinks,k,lastcol) ; } /* Success --- the vector has room for one more coefficient. */ return (false) ; } //@} /* Helper function to duplicate a major-dimension vector. */ /* A major-dimension vector is composed of paired element and minor index arrays. We want to duplicate length entries from both arrays, starting at offset. If tgt > 0, we'll run a more complicated copy loop which will elide the entry with minor index == tgt. In this case, we want to reduce the size of the allocated array by 1. Pigs will fly before sizeof(int) > sizeof(double), but if it ever happens this code will fail. */ double *presolve_dupmajor (const double *elems, const int *indices, int length, CoinBigIndex offset, int tgt) { int n ; if (tgt >= 0) length-- ; if (2*sizeof(int) <= sizeof(double)) n = (3*length+1)>>1 ; else n = 2*length ; double *dArray = new double [n] ; int *iArray = reinterpret_cast(dArray+length) ; if (tgt < 0) { memcpy(dArray,elems+offset,length*sizeof(double)) ; memcpy(iArray,indices+offset,length*sizeof(int)) ; } else { int korig ; int kcopy = 0 ; indices += offset ; elems += offset ; for (korig = 0 ; korig <= length ; korig++) { int i = indices[korig] ; if (i != tgt) { dArray[kcopy] = elems[korig] ; iArray[kcopy++] = indices[korig] ; } } } return (dArray) ; } /* Routines to find the position of the entry for a given minor index in a major vector. Inline wrappers with column-major and row-major parameter names are defined in CoinPresolveMatrix.hpp. The threaded matrix used in postsolve exists only as a column-major form, so only one wrapper is defined. */ /* presolve_find_minor Find the position (k) of the entry for a given minor index (tgt) within the range of entries for a major vector (ks, ke). Print a tag and abort (DIE) if there's no entry for tgt. */ #if 0 CoinBigIndex presolve_find_minor (int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs) { CoinBigIndex k ; for (k = ks ; k < ke ; k++) { if (minndxs[k] == tgt) return (k) ; } DIE("FIND_MINOR") ; abort () ; return -1; } #endif /* As presolve_find_minor, but return a position one past the end of the major vector when the entry is not already present. */ CoinBigIndex presolve_find_minor1 (int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs) { CoinBigIndex k ; for (k = ks ; k < ke ; k++) { if (minndxs[k] == tgt) return (k) ; } return (k) ; } /* In a threaded matrix, the major vector does not occupy a contiguous block in the bulk storage area. For example, in a threaded column-major matrix, if a is in pos'n kp of hrow, the next coefficient a will be in pos'n kq = link[kp]. Abort if we don't find it. */ CoinBigIndex presolve_find_minor2 (int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks) { for (int i = 0 ; i < majlen ; ++i) { if (minndxs[ks] == tgt) return (ks) ; ks = majlinks[ks] ; } DIE("FIND_MINOR2") ; abort () ; return -1; } /* As presolve_find_minor2, but return -1 if the entry is missing */ CoinBigIndex presolve_find_minor3 (int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks) { for (int i = 0 ; i < majlen ; ++i) { if (minndxs[ks] == tgt) return (ks) ; ks = majlinks[ks] ; } return (-1) ; } /* Delete the entry for a minor index from a major vector. The last entry in the major vector is moved into the hole left by the deleted entry. This leaves some space between the end of this major vector and the start of the next in the bulk storage areas (this is termed loosely packed). Inline wrappers with column-major and row-major parameter names are defined in CoinPresolveMatrix.hpp. The threaded matrix used in postsolve exists only as a column-major form, so only one wrapper is defined. */ #if 0 void presolve_delete_from_major (int majndx, int minndx, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els) { CoinBigIndex ks = majstrts[majndx] ; CoinBigIndex ke = ks + majlens[majndx] ; CoinBigIndex kmi = presolve_find_minor(minndx,ks,ke,minndxs) ; minndxs[kmi] = minndxs[ke-1] ; els[kmi] = els[ke-1] ; majlens[majndx]-- ; return ; } // Delete all marked and zero marked void presolve_delete_many_from_major (int majndx, char * marked, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els) { CoinBigIndex ks = majstrts[majndx] ; CoinBigIndex ke = ks + majlens[majndx] ; CoinBigIndex put=ks; for (CoinBigIndex k=ks;k= 0) ; return ; } CoinMP-1.8.3/CoinUtils/src/CoinUtility.hpp0000644000175000017500000000112211510456064016777 0ustar renerene/* $Id: CoinUtility.hpp 1372 2011-01-03 23:31:00Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinUtility_h_ #define CoinUtility_h_ #include "CoinSort.hpp" template CoinPair CoinMakePair(const S& s, const T& t) { return CoinPair(s, t); } template CoinTriple CoinMakeTriple(const S& s, const T& t, const U& u) { return CoinTriple(s, t, u); } #endif CoinMP-1.8.3/CoinUtils/src/CoinModel.hpp0000644000175000017500000012217212312310414016372 0ustar renerene/* $Id: CoinModel.hpp 1691 2014-03-19 12:43:56Z forrest $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinModel_H #define CoinModel_H #include "CoinModelUseful.hpp" #include "CoinMessageHandler.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" class CoinBaseModel { public: /**@name Constructors, destructor */ //@{ /// Default Constructor CoinBaseModel (); /// Copy constructor CoinBaseModel ( const CoinBaseModel &rhs); /// Assignment operator CoinBaseModel & operator=( const CoinBaseModel& rhs); /// Clone virtual CoinBaseModel * clone() const=0; /// Destructor virtual ~CoinBaseModel () ; //@} /**@name For getting information */ //@{ /// Return number of rows inline int numberRows() const { return numberRows_;} /// Return number of columns inline int numberColumns() const { return numberColumns_;} /// Return number of elements virtual CoinBigIndex numberElements() const = 0; /** Returns the (constant) objective offset This is the RHS entry for the objective row */ inline double objectiveOffset() const { return objectiveOffset_;} /// Set objective offset inline void setObjectiveOffset(double value) { objectiveOffset_=value;} /// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore inline double optimizationDirection() const { return optimizationDirection_; } /// Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore inline void setOptimizationDirection(double value) { optimizationDirection_=value;} /// Get print level 0 - off, 1 - errors, 2 - more inline int logLevel() const { return logLevel_;} /// Set print level 0 - off, 1 - errors, 2 - more void setLogLevel(int value); /// Return the problem name inline const char * getProblemName() const { return problemName_.c_str();} /// Set problem name void setProblemName(const char *name) ; /// Set problem name void setProblemName(const std::string &name) ; /// Return the row block name inline const std::string & getRowBlock() const { return rowBlockName_;} /// Set row block name inline void setRowBlock(const std::string &name) { rowBlockName_ = name;} /// Return the column block name inline const std::string & getColumnBlock() const { return columnBlockName_;} /// Set column block name inline void setColumnBlock(const std::string &name) { columnBlockName_ = name;} /// Pass in message handler void setMessageHandler(CoinMessageHandler * handler); //@} protected: /**@name Data members */ //@{ /// Current number of rows int numberRows_; /// Current number of columns int numberColumns_; /// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore double optimizationDirection_; /// Objective offset to be passed on double objectiveOffset_; /// Problem name std::string problemName_; /// Rowblock name std::string rowBlockName_; /// Columnblock name std::string columnBlockName_; /// Message handler (Passed in) CoinMessageHandler * handler_; /// Messages CoinMessages messages_; /** Print level. I could have gone for full message handling but this should normally be silent and lightweight. -1 - use passed in message handler 0 - no output 1 - on errors 2 - more detailed */ int logLevel_; //@} /// data }; /** This is a simple minded model which is stored in a format which makes it easier to construct and modify but not efficient for algorithms. It has to be passed across to ClpModel or OsiSolverInterface by addRows, addCol(umn)s or loadProblem. It may have up to four parts - 1) A matrix of doubles (or strings - see note A) 2) Column information including integer information and names 3) Row information including names 4) Quadratic objective (not implemented - but see A) This class is meant to make it more efficient to build a model. It is at its most efficient when all additions are done as addRow or as addCol but not mixed. If only 1 and 2 exist then solver.addColumns may be used to pass to solver, if only 1 and 3 exist then solver.addRows may be used. Otherwise solver.loadProblem must be used. If addRows and addColumns are mixed or if individual elements are set then the speed will drop to some extent and more memory will be used. It is also possible to iterate over existing elements and to access columns and rows by name. Again each of these use memory and cpu time. However memory is unlikely to be critical as most algorithms will use much more. Notes: A) Although this could be used to pass nonlinear information around the only use at present is to have named values e.g. value1 which can then be set to a value after model is created. I have no idea whether that could be useful but I thought it might be fun. Quadratic terms are allowed in strings! A solver could try and use this if so - the convention is that 0.5* quadratic is stored B) This class could be useful for modeling. */ class CoinModel : public CoinBaseModel { public: /**@name Useful methods for building model */ //@{ /** add a row - numberInRow may be zero */ void addRow(int numberInRow, const int * columns, const double * elements, double rowLower=-COIN_DBL_MAX, double rowUpper=COIN_DBL_MAX, const char * name=NULL); /// add a column - numberInColumn may be zero */ void addColumn(int numberInColumn, const int * rows, const double * elements, double columnLower=0.0, double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0, const char * name=NULL, bool isInteger=false); /// add a column - numberInColumn may be zero */ inline void addCol(int numberInColumn, const int * rows, const double * elements, double columnLower=0.0, double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0, const char * name=NULL, bool isInteger=false) { addColumn(numberInColumn, rows, elements, columnLower, columnUpper, objectiveValue, name,isInteger);} /// Sets value for row i and column j inline void operator() (int i,int j,double value) { setElement(i,j,value);} /// Sets value for row i and column j void setElement(int i,int j,double value) ; /** Gets sorted row - user must provide enough space (easiest is allocate number of columns). If column or element NULL then just returns number Returns number of elements */ int getRow(int whichRow, int * column, double * element); /** Gets sorted column - user must provide enough space (easiest is allocate number of rows). If row or element NULL then just returns number Returns number of elements */ int getColumn(int whichColumn, int * column, double * element); /// Sets quadratic value for column i and j void setQuadraticElement(int i,int j,double value) ; /// Sets value for row i and column j as string inline void operator() (int i,int j,const char * value) { setElement(i,j,value);} /// Sets value for row i and column j as string void setElement(int i,int j,const char * value) ; /// Associates a string with a value. Returns string id (or -1 if does not exist) int associateElement(const char * stringValue, double value); /** Sets rowLower (if row does not exist then all rows up to this are defined with default values and no elements) */ void setRowLower(int whichRow,double rowLower); /** Sets rowUpper (if row does not exist then all rows up to this are defined with default values and no elements) */ void setRowUpper(int whichRow,double rowUpper); /** Sets rowLower and rowUpper (if row does not exist then all rows up to this are defined with default values and no elements) */ void setRowBounds(int whichRow,double rowLower,double rowUpper); /** Sets name (if row does not exist then all rows up to this are defined with default values and no elements) */ void setRowName(int whichRow,const char * rowName); /** Sets columnLower (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnLower(int whichColumn,double columnLower); /** Sets columnUpper (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnUpper(int whichColumn,double columnUpper); /** Sets columnLower and columnUpper (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnBounds(int whichColumn,double columnLower,double columnUpper); /** Sets columnObjective (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnObjective(int whichColumn,double columnObjective); /** Sets name (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnName(int whichColumn,const char * columnName); /** Sets integer state (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnIsInteger(int whichColumn,bool columnIsInteger); /** Sets columnObjective (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setObjective(int whichColumn,double columnObjective) { setColumnObjective( whichColumn, columnObjective);} /** Sets integer state (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setIsInteger(int whichColumn,bool columnIsInteger) { setColumnIsInteger( whichColumn, columnIsInteger);} /** Sets integer (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setInteger(int whichColumn) { setColumnIsInteger( whichColumn, true);} /** Sets continuous (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setContinuous(int whichColumn) { setColumnIsInteger( whichColumn, false);} /** Sets columnLower (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setColLower(int whichColumn,double columnLower) { setColumnLower( whichColumn, columnLower);} /** Sets columnUpper (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setColUpper(int whichColumn,double columnUpper) { setColumnUpper( whichColumn, columnUpper);} /** Sets columnLower and columnUpper (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setColBounds(int whichColumn,double columnLower,double columnUpper) { setColumnBounds( whichColumn, columnLower, columnUpper);} /** Sets columnObjective (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setColObjective(int whichColumn,double columnObjective) { setColumnObjective( whichColumn, columnObjective);} /** Sets name (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setColName(int whichColumn,const char * columnName) { setColumnName( whichColumn, columnName);} /** Sets integer (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setColIsInteger(int whichColumn,bool columnIsInteger) { setColumnIsInteger( whichColumn, columnIsInteger);} /** Sets rowLower (if row does not exist then all rows up to this are defined with default values and no elements) */ void setRowLower(int whichRow,const char * rowLower); /** Sets rowUpper (if row does not exist then all rows up to this are defined with default values and no elements) */ void setRowUpper(int whichRow,const char * rowUpper); /** Sets columnLower (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnLower(int whichColumn,const char * columnLower); /** Sets columnUpper (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnUpper(int whichColumn,const char * columnUpper); /** Sets columnObjective (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnObjective(int whichColumn,const char * columnObjective); /** Sets integer (if column does not exist then all columns up to this are defined with default values and no elements) */ void setColumnIsInteger(int whichColumn,const char * columnIsInteger); /** Sets columnObjective (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setObjective(int whichColumn,const char * columnObjective) { setColumnObjective( whichColumn, columnObjective);} /** Sets integer (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setIsInteger(int whichColumn,const char * columnIsInteger) { setColumnIsInteger( whichColumn, columnIsInteger);} /** Deletes all entries in row and bounds. Will be ignored by writeMps etc and will be packed down if asked for. */ void deleteRow(int whichRow); /** Deletes all entries in column and bounds and objective. Will be ignored by writeMps etc and will be packed down if asked for. */ void deleteColumn(int whichColumn); /** Deletes all entries in column and bounds. If last column the number of columns will be decremented and true returned. */ inline void deleteCol(int whichColumn) { deleteColumn(whichColumn);} /// Takes element out of matrix - returning position (<0 if not there); int deleteElement(int row, int column); /// Takes element out of matrix when position known void deleteThisElement(int row, int column,int position); /** Packs down all rows i.e. removes empty rows permanently. Empty rows have no elements and feasible bounds. returns number of rows deleted. */ int packRows(); /** Packs down all columns i.e. removes empty columns permanently. Empty columns have no elements and no objective. returns number of columns deleted. */ int packColumns(); /** Packs down all columns i.e. removes empty columns permanently. Empty columns have no elements and no objective. returns number of columns deleted. */ inline int packCols() { return packColumns();} /** Packs down all rows and columns. i.e. removes empty rows and columns permanently. Empty rows have no elements and feasible bounds. Empty columns have no elements and no objective. returns number of rows+columns deleted. */ int pack(); /** Sets columnObjective array */ void setObjective(int numberColumns,const double * objective) ; /** Sets columnLower array */ void setColumnLower(int numberColumns,const double * columnLower); /** Sets columnLower array */ inline void setColLower(int numberColumns,const double * columnLower) { setColumnLower( numberColumns, columnLower);} /** Sets columnUpper array */ void setColumnUpper(int numberColumns,const double * columnUpper); /** Sets columnUpper array */ inline void setColUpper(int numberColumns,const double * columnUpper) { setColumnUpper( numberColumns, columnUpper);} /** Sets rowLower array */ void setRowLower(int numberRows,const double * rowLower); /** Sets rowUpper array */ void setRowUpper(int numberRows,const double * rowUpper); /** Write the problem in MPS format to a file with the given filename. \param compression can be set to three values to indicate what kind of file should be written
    • 0: plain text (default)
    • 1: gzip compressed (.gz is appended to \c filename)
    • 2: bzip2 compressed (.bz2 is appended to \c filename) (TODO)
    If the library was not compiled with the requested compression then writeMps falls back to writing a plain text file. \param formatType specifies the precision to used for values in the MPS file
    • 0: normal precision (default)
    • 1: extra accuracy
    • 2: IEEE hex
    \param numberAcross specifies whether 1 or 2 (default) values should be specified on every data line in the MPS file. not const as may change model e.g. fill in default bounds */ int writeMps(const char *filename, int compression = 0, int formatType = 0, int numberAcross = 2, bool keepStrings=false) ; /** Check two models against each other. Return nonzero if different. Ignore names if that set. May modify both models by cleaning up */ int differentModel(CoinModel & other, bool ignoreNames); //@} /**@name For structured models */ //@{ /// Pass in CoinPackedMatrix (and switch off element updates) void passInMatrix(const CoinPackedMatrix & matrix); /** Convert elements to CoinPackedMatrix (and switch off element updates). Returns number of errors */ int convertMatrix(); /// Return a pointer to CoinPackedMatrix (or NULL) inline const CoinPackedMatrix * packedMatrix() const { return packedMatrix_;} /// Return pointers to original rows (for decomposition) inline const int * originalRows() const { return rowType_;} /// Return pointers to original columns (for decomposition) inline const int * originalColumns() const { return columnType_;} //@} /**@name For getting information */ //@{ /// Return number of elements inline CoinBigIndex numberElements() const { return numberElements_;} /// Return elements as triples inline const CoinModelTriple * elements() const { return elements_;} /// Returns value for row i and column j inline double operator() (int i,int j) const { return getElement(i,j);} /// Returns value for row i and column j double getElement(int i,int j) const; /// Returns value for row rowName and column columnName inline double operator() (const char * rowName,const char * columnName) const { return getElement(rowName,columnName);} /// Returns value for row rowName and column columnName double getElement(const char * rowName,const char * columnName) const; /// Returns quadratic value for columns i and j double getQuadraticElement(int i,int j) const; /** Returns value for row i and column j as string. Returns NULL if does not exist. Returns "Numeric" if not a string */ const char * getElementAsString(int i,int j) const; /** Returns pointer to element for row i column j. Only valid until next modification. NULL if element does not exist */ double * pointer (int i,int j) const; /** Returns position in elements for row i column j. Only valid until next modification. -1 if element does not exist */ int position (int i,int j) const; /** Returns first element in given row - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink firstInRow(int whichRow) const ; /** Returns last element in given row - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink lastInRow(int whichRow) const ; /** Returns first element in given column - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink firstInColumn(int whichColumn) const ; /** Returns last element in given column - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink lastInColumn(int whichColumn) const ; /** Returns next element in current row or column - index is -1 if none. Index is given by .index and value by .value. User could also tell because input.next would be NULL */ CoinModelLink next(CoinModelLink & current) const ; /** Returns previous element in current row or column - index is -1 if none. Index is given by .index and value by .value. User could also tell because input.previous would be NULL May not be correct if matrix updated. */ CoinModelLink previous(CoinModelLink & current) const ; /** Returns first element in given quadratic column - index is -1 if none. Index is given by .index and value by .value May not be correct if matrix updated. */ CoinModelLink firstInQuadraticColumn(int whichColumn) const ; /** Returns last element in given quadratic column - index is -1 if none. Index is given by .index and value by .value */ CoinModelLink lastInQuadraticColumn(int whichColumn) const ; /** Gets rowLower (if row does not exist then -COIN_DBL_MAX) */ double getRowLower(int whichRow) const ; /** Gets rowUpper (if row does not exist then +COIN_DBL_MAX) */ double getRowUpper(int whichRow) const ; /** Gets name (if row does not exist then NULL) */ const char * getRowName(int whichRow) const ; inline double rowLower(int whichRow) const { return getRowLower(whichRow);} /** Gets rowUpper (if row does not exist then COIN_DBL_MAX) */ inline double rowUpper(int whichRow) const { return getRowUpper(whichRow) ;} /** Gets name (if row does not exist then NULL) */ inline const char * rowName(int whichRow) const { return getRowName(whichRow);} /** Gets columnLower (if column does not exist then 0.0) */ double getColumnLower(int whichColumn) const ; /** Gets columnUpper (if column does not exist then COIN_DBL_MAX) */ double getColumnUpper(int whichColumn) const ; /** Gets columnObjective (if column does not exist then 0.0) */ double getColumnObjective(int whichColumn) const ; /** Gets name (if column does not exist then NULL) */ const char * getColumnName(int whichColumn) const ; /** Gets if integer (if column does not exist then false) */ bool getColumnIsInteger(int whichColumn) const ; /** Gets columnLower (if column does not exist then 0.0) */ inline double columnLower(int whichColumn) const { return getColumnLower(whichColumn);} /** Gets columnUpper (if column does not exist then COIN_DBL_MAX) */ inline double columnUpper(int whichColumn) const { return getColumnUpper(whichColumn) ;} /** Gets columnObjective (if column does not exist then 0.0) */ inline double columnObjective(int whichColumn) const { return getColumnObjective(whichColumn);} /** Gets columnObjective (if column does not exist then 0.0) */ inline double objective(int whichColumn) const { return getColumnObjective(whichColumn);} /** Gets name (if column does not exist then NULL) */ inline const char * columnName(int whichColumn) const { return getColumnName(whichColumn);} /** Gets if integer (if column does not exist then false) */ inline bool columnIsInteger(int whichColumn) const { return getColumnIsInteger(whichColumn);} /** Gets if integer (if column does not exist then false) */ inline bool isInteger(int whichColumn) const { return getColumnIsInteger(whichColumn);} /** Gets columnLower (if column does not exist then 0.0) */ inline double getColLower(int whichColumn) const { return getColumnLower(whichColumn);} /** Gets columnUpper (if column does not exist then COIN_DBL_MAX) */ inline double getColUpper(int whichColumn) const { return getColumnUpper(whichColumn) ;} /** Gets columnObjective (if column does not exist then 0.0) */ inline double getColObjective(int whichColumn) const { return getColumnObjective(whichColumn);} /** Gets name (if column does not exist then NULL) */ inline const char * getColName(int whichColumn) const { return getColumnName(whichColumn);} /** Gets if integer (if column does not exist then false) */ inline bool getColIsInteger(int whichColumn) const { return getColumnIsInteger(whichColumn);} /** Gets rowLower (if row does not exist then -COIN_DBL_MAX) */ const char * getRowLowerAsString(int whichRow) const ; /** Gets rowUpper (if row does not exist then +COIN_DBL_MAX) */ const char * getRowUpperAsString(int whichRow) const ; inline const char * rowLowerAsString(int whichRow) const { return getRowLowerAsString(whichRow);} /** Gets rowUpper (if row does not exist then COIN_DBL_MAX) */ inline const char * rowUpperAsString(int whichRow) const { return getRowUpperAsString(whichRow) ;} /** Gets columnLower (if column does not exist then 0.0) */ const char * getColumnLowerAsString(int whichColumn) const ; /** Gets columnUpper (if column does not exist then COIN_DBL_MAX) */ const char * getColumnUpperAsString(int whichColumn) const ; /** Gets columnObjective (if column does not exist then 0.0) */ const char * getColumnObjectiveAsString(int whichColumn) const ; /** Gets if integer (if column does not exist then false) */ const char * getColumnIsIntegerAsString(int whichColumn) const ; /** Gets columnLower (if column does not exist then 0.0) */ inline const char * columnLowerAsString(int whichColumn) const { return getColumnLowerAsString(whichColumn);} /** Gets columnUpper (if column does not exist then COIN_DBL_MAX) */ inline const char * columnUpperAsString(int whichColumn) const { return getColumnUpperAsString(whichColumn) ;} /** Gets columnObjective (if column does not exist then 0.0) */ inline const char * columnObjectiveAsString(int whichColumn) const { return getColumnObjectiveAsString(whichColumn);} /** Gets columnObjective (if column does not exist then 0.0) */ inline const char * objectiveAsString(int whichColumn) const { return getColumnObjectiveAsString(whichColumn);} /** Gets if integer (if column does not exist then false) */ inline const char * columnIsIntegerAsString(int whichColumn) const { return getColumnIsIntegerAsString(whichColumn);} /** Gets if integer (if column does not exist then false) */ inline const char * isIntegerAsString(int whichColumn) const { return getColumnIsIntegerAsString(whichColumn);} /// Row index from row name (-1 if no names or no match) int row(const char * rowName) const; /// Column index from column name (-1 if no names or no match) int column(const char * columnName) const; /// Returns type inline int type() const { return type_;} /// returns unset value inline double unsetValue() const { return -1.23456787654321e-97;} /// Creates a packed matrix - return number of errors int createPackedMatrix(CoinPackedMatrix & matrix, const double * associated); /** Fills in startPositive and startNegative with counts for +-1 matrix. If not +-1 then startPositive[0]==-1 otherwise counts and startPositive[numberColumns]== size - return number of errors */ int countPlusMinusOne(CoinBigIndex * startPositive, CoinBigIndex * startNegative, const double * associated); /** Creates +-1 matrix given startPositive and startNegative counts for +-1 matrix. */ void createPlusMinusOne(CoinBigIndex * startPositive, CoinBigIndex * startNegative, int * indices, const double * associated); /// Creates copies of various arrays - return number of errors int createArrays(double * & rowLower, double * & rowUpper, double * & columnLower, double * & columnUpper, double * & objective, int * & integerType, double * & associated); /// Says if strings exist inline bool stringsExist() const { return string_.numberItems()!=0;} /// Return string array inline const CoinModelHash * stringArray() const { return &string_;} /// Returns associated array inline double * associatedArray() const { return associated_;} /// Return rowLower array inline double * rowLowerArray() const { return rowLower_;} /// Return rowUpper array inline double * rowUpperArray() const { return rowUpper_;} /// Return columnLower array inline double * columnLowerArray() const { return columnLower_;} /// Return columnUpper array inline double * columnUpperArray() const { return columnUpper_;} /// Return objective array inline double * objectiveArray() const { return objective_;} /// Return integerType array inline int * integerTypeArray() const { return integerType_;} /// Return row names array inline const CoinModelHash * rowNames() const { return &rowName_;} /// Return column names array inline const CoinModelHash * columnNames() const { return &columnName_;} /// Reset row names inline void zapRowNames() { rowName_=CoinModelHash();} /// Reset column names inline void zapColumnNames() { columnName_=CoinModelHash();} /// Returns array of 0 or nonzero if can be a cut (or returns NULL) inline const int * cutMarker() const { return cut_;} /// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore inline double optimizationDirection() const { return optimizationDirection_; } /// Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore inline void setOptimizationDirection(double value) { optimizationDirection_=value;} /// Return pointer to more information inline void * moreInfo() const { return moreInfo_;} /// Set pointer to more information inline void setMoreInfo(void * info) { moreInfo_ = info;} /** Returns which parts of model are set 1 - matrix 2 - rhs 4 - row names 8 - column bounds and/or objective 16 - column names 32 - integer types */ int whatIsSet() const; //@} /**@name for block models - matrix will be CoinPackedMatrix */ //@{ /*! \brief Load in a problem by copying the arguments. The constraints on the rows are given by lower and upper bounds. If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    Note that the default values for rowub and rowlb produce the constraint -infty <= ax <= infty. This is probably not what you want. */ void loadBlock (const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) ; /*! \brief Load in a problem by copying the arguments. The constraints on the rows are given by sense/rhs/range triplets. If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • obj: all variables have 0 objective coefficient
    • rowsen: all rows are >=
    • rowrhs: all right hand sides are 0
    • rowrng: 0 for the ranged rows
    Note that the default values for rowsen, rowrhs, and rowrng produce the constraint ax >= 0. */ void loadBlock (const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) ; /*! \brief Load in a problem by copying the arguments. The constraint matrix is is specified with standard column-major column starts / row indices / coefficients vectors. The constraints on the rows are given by lower and upper bounds. The matrix vectors must be gap-free. Note that start must have numcols+1 entries so that the length of the last column can be calculated as start[numcols]-start[numcols-1]. See the previous loadBlock method using rowlb and rowub for default argument values. */ void loadBlock (const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) ; /*! \brief Load in a problem by copying the arguments. The constraint matrix is is specified with standard column-major column starts / row indices / coefficients vectors. The constraints on the rows are given by sense/rhs/range triplets. The matrix vectors must be gap-free. Note that start must have numcols+1 entries so that the length of the last column can be calculated as start[numcols]-start[numcols-1]. See the previous loadBlock method using sense/rhs/range for default argument values. */ void loadBlock (const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) ; //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ CoinModel(); /** Constructor with sizes. */ CoinModel(int firstRows, int firstColumns, int firstElements,bool noNames=false); /** Read a problem in MPS or GAMS format from the given filename. */ CoinModel(const char *fileName, int allowStrings=0); /** Read a problem from AMPL nl file NOTE - as I can't work out configure etc the source code is in Cbc_ampl.cpp! */ CoinModel( int nonLinear, const char * fileName,const void * info); /// From arrays CoinModel(int numberRows, int numberColumns, const CoinPackedMatrix * matrix, const double * rowLower, const double * rowUpper, const double * columnLower, const double * columnUpper, const double * objective); /// Clone virtual CoinBaseModel * clone() const; /** Destructor */ virtual ~CoinModel(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ CoinModel(const CoinModel&); /// = CoinModel& operator=(const CoinModel&); //@} /**@name For debug */ //@{ /// Checks that links are consistent void validateLinks() const; //@} private: /// Resize void resize(int maximumRows, int maximumColumns, int maximumElements); /// Fill in default row information void fillRows(int which,bool forceCreation,bool fromAddRow=false); /// Fill in default column information void fillColumns(int which,bool forceCreation,bool fromAddColumn=false); /** Fill in default linked list information (1= row, 2 = column) Marked as const as list is mutable */ void fillList(int which, CoinModelLinkedList & list,int type) const ; /** Create a linked list and synchronize free type 1 for row 2 for column Marked as const as list is mutable */ void createList(int type) const; /// Adds one string, returns index int addString(const char * string); /** Gets a double from a string possibly containing named strings, returns unset if not found */ double getDoubleFromString(CoinYacc & info, const char * string); /// Frees value memory void freeStringMemory(CoinYacc & info); public: /// Fills in all associated - returning number of errors int computeAssociated(double * associated); /** Gets correct form for a quadratic row - user to delete If row is not quadratic then returns which other variables are involved with tiny (1.0e-100) elements and count of total number of variables which could not be put in quadratic form */ CoinPackedMatrix * quadraticRow(int rowNumber,double * linear, int & numberBad) const; /// Replaces a quadratic row void replaceQuadraticRow(int rowNumber,const double * linear, const CoinPackedMatrix * quadraticPart); /** If possible return a model where if all variables marked nonzero are fixed the problem will be linear. At present may only work if quadratic. Returns NULL if not possible */ CoinModel * reorder(const char * mark) const; /** Expands out all possible combinations for a knapsack If buildObj NULL then just computes space needed - returns number elements On entry numberOutput is maximum allowed, on exit it is number needed or -1 (as will be number elements) if maximum exceeded. numberOutput will have at least space to return values which reconstruct input. Rows returned will be original rows but no entries will be returned for any rows all of whose entries are in knapsack. So up to user to allow for this. If reConstruct >=0 then returns number of entrie which make up item "reConstruct" in expanded knapsack. Values in buildRow and buildElement; */ int expandKnapsack(int knapsackRow, int & numberOutput,double * buildObj, CoinBigIndex * buildStart, int * buildRow, double * buildElement,int reConstruct=-1) const; /// Sets cut marker array void setCutMarker(int size,const int * marker); /// Sets priority array void setPriorities(int size,const int * priorities); /// priorities (given for all columns (-1 if not integer) inline const int * priorities() const { return priority_;} /// For decomposition set original row and column indices void setOriginalIndices(const int * row, const int * column); private: /** Read a problem from AMPL nl file so not constructor so gdb will work */ void gdb( int nonLinear, const char * fileName, const void * info); /// returns jColumn (-2 if linear term, -1 if unknown) and coefficient int decodeBit(char * phrase, char * & nextPhrase, double & coefficient, bool ifFirst) const; /// Aborts with message about packedMatrix void badType() const; /**@name Data members */ //@{ /// Maximum number of rows int maximumRows_; /// Maximum number of columns int maximumColumns_; /// Current number of elements int numberElements_; /// Maximum number of elements int maximumElements_; /// Current number of quadratic elements int numberQuadraticElements_; /// Maximum number of quadratic elements int maximumQuadraticElements_; /// Row lower double * rowLower_; /// Row upper double * rowUpper_; /// Row names CoinModelHash rowName_; /** Row types. Has information - at present bit 0 - rowLower is a string bit 1 - rowUpper is a string NOTE - if converted to CoinPackedMatrix - may be indices of original rows (i.e. when decomposed) */ int * rowType_; /// Objective double * objective_; /// Column Lower double * columnLower_; /// Column Upper double * columnUpper_; /// Column names CoinModelHash columnName_; /// Integer information int * integerType_; /// Strings CoinModelHash string_; /** Column types. Has information - at present bit 0 - columnLower is a string bit 1 - columnUpper is a string bit 2 - objective is a string bit 3 - integer setting is a string NOTE - if converted to CoinPackedMatrix - may be indices of original columns (i.e. when decomposed) */ int * columnType_; /// If simple then start of each row/column int * start_; /// Actual elements CoinModelTriple * elements_; /// Actual elements as CoinPackedMatrix CoinPackedMatrix * packedMatrix_; /// Hash for elements mutable CoinModelHash2 hashElements_; /// Linked list for rows mutable CoinModelLinkedList rowList_; /// Linked list for columns mutable CoinModelLinkedList columnList_; /// Actual quadratic elements (always linked lists) CoinModelTriple * quadraticElements_; /// Hash for quadratic elements mutable CoinModelHash2 hashQuadraticElements_; /// Array for sorting indices int * sortIndices_; /// Array for sorting elements double * sortElements_; /// Size of sort arrays int sortSize_; /// Linked list for quadratic rows mutable CoinModelLinkedList quadraticRowList_; /// Linked list for quadratic columns mutable CoinModelLinkedList quadraticColumnList_; /// Size of associated values int sizeAssociated_; /// Associated values double * associated_; /// Number of SOS - all these are done in one go e.g. from ampl int numberSOS_; /// SOS starts int * startSOS_; /// SOS members int * memberSOS_; /// SOS type int * typeSOS_; /// SOS priority int * prioritySOS_; /// SOS reference double * referenceSOS_; /// priorities (given for all columns (-1 if not integer) int * priority_; /// Nonzero if row is cut - done in one go e.g. from ampl int * cut_; /// Pointer to more information void * moreInfo_; /** Type of build - -1 unset, 0 for row, 1 for column, 2 linked. 3 matrix is CoinPackedMatrix (and at present can't be modified); */ mutable int type_; /// True if no names EVER being used (for users who know what they are doing) bool noNames_; /** Links present (could be tested by sizes of objects) 0 - none, 1 - row links, 2 - column links, 3 - both */ mutable int links_; //@} }; /// Just function of single variable x double getFunctionValueFromString(const char * string, const char * x, double xValue); /// faster version double getDoubleFromString(CoinYacc & info, const char * string, const char * x, double xValue); #endif CoinMP-1.8.3/CoinUtils/src/CoinAlloc.hpp0000644000175000017500000001175611574206564016414 0ustar renerene/* $Id: CoinAlloc.hpp 1438 2011-06-09 18:14:12Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinAlloc_hpp #define CoinAlloc_hpp #include "CoinUtilsConfig.h" #include #if !defined(COINUTILS_MEMPOOL_MAXPOOLED) # define COINUTILS_MEMPOOL_MAXPOOLED -1 #endif #if (COINUTILS_MEMPOOL_MAXPOOLED >= 0) #ifndef COINUTILS_MEMPOOL_ALIGNMENT #define COINUTILS_MEMPOOL_ALIGNMENT 16 #endif /* Note: This memory pool implementation assumes that sizeof(size_t) and sizeof(void*) are both <= COINUTILS_MEMPOOL_ALIGNMENT. Choosing an alignment of 4 will cause segfault on 64-bit platforms and may lead to bad performance on 32-bit platforms. So 8 is a mnimum recommended alignment. Probably 16 does not waste too much space either and may be even better for performance. One must play with it. */ //############################################################################# #if (COINUTILS_MEMPOOL_ALIGNMENT == 16) static const std::size_t CoinAllocPtrShift = 4; static const std::size_t CoinAllocRoundMask = ~((std::size_t)15); #elif (COINUTILS_MEMPOOL_ALIGNMENT == 8) static const std::size_t CoinAllocPtrShift = 3; static const std::size_t CoinAllocRoundMask = ~((std::size_t)7); #else #error "COINUTILS_MEMPOOL_ALIGNMENT must be defined as 8 or 16 (or this code needs to be changed :-)" #endif //############################################################################# #ifndef COIN_MEMPOOL_SAVE_BLOCKHEADS # define COIN_MEMPOOL_SAVE_BLOCKHEADS 0 #endif //############################################################################# class CoinMempool { private: #if (COIN_MEMPOOL_SAVE_BLOCKHEADS == 1) char** block_heads; std::size_t block_num; std::size_t max_block_num; #endif #if defined(COINUTILS_PTHREADS) && (COINUTILS_PTHREAD == 1) pthread_mutex_t mutex_; #endif int last_block_size_; char* first_free_; const std::size_t entry_size_; private: CoinMempool(const CoinMempool&); CoinMempool& operator=(const CoinMempool&); private: char* allocate_new_block(); inline void lock_mutex() { #if defined(COINUTILS_PTHREADS) && (COINUTILS_PTHREAD == 1) pthread_mutex_lock(&mutex_); #endif } inline void unlock_mutex() { #if defined(COINUTILS_PTHREADS) && (COINUTILS_PTHREAD == 1) pthread_mutex_unlock(&mutex_); #endif } public: CoinMempool(std::size_t size = 0); ~CoinMempool(); char* alloc(); inline void dealloc(char *p) { char** pp = (char**)p; lock_mutex(); *pp = first_free_; first_free_ = p; unlock_mutex(); } }; //############################################################################# /** A memory pool allocator. If a request arrives for allocating \c n bytes then it is first rounded up to the nearest multiple of \c sizeof(void*) (this is \c n_roundup), then one more \c sizeof(void*) is added to this number. If the result is no more than maxpooled_ then the appropriate pool is used to get a chunk of memory, if not, then malloc is used. In either case, the size of the allocated chunk is written into the first \c sizeof(void*) bytes and a pointer pointing afterwards is returned. */ class CoinAlloc { private: CoinMempool* pool_; int maxpooled_; public: CoinAlloc(); ~CoinAlloc() {} inline void* alloc(const std::size_t n) { if (maxpooled_ <= 0) { return std::malloc(n); } char *p = NULL; const std::size_t to_alloc = ((n+COINUTILS_MEMPOOL_ALIGNMENT-1) & CoinAllocRoundMask) + COINUTILS_MEMPOOL_ALIGNMENT; CoinMempool* pool = NULL; if (maxpooled_ > 0 && to_alloc >= (size_t)maxpooled_) { p = static_cast(std::malloc(to_alloc)); if (p == NULL) throw std::bad_alloc(); } else { pool = pool_ + (to_alloc >> CoinAllocPtrShift); p = pool->alloc(); } *((CoinMempool**)p) = pool; return static_cast(p+COINUTILS_MEMPOOL_ALIGNMENT); } inline void dealloc(void* p) { if (maxpooled_ <= 0) { std::free(p); return; } if (p) { char* base = static_cast(p)-COINUTILS_MEMPOOL_ALIGNMENT; CoinMempool* pool = *((CoinMempool**)base); if (!pool) { std::free(base); } else { pool->dealloc(base); } } } }; extern CoinAlloc CoinAllocator; //############################################################################# #if defined(COINUTILS_MEMPOOL_OVERRIDE_NEW) && (COINUTILS_MEMPOOL_OVERRIDE_NEW == 1) void* operator new(std::size_t size) throw (std::bad_alloc); void* operator new[](std::size_t) throw (std::bad_alloc); void operator delete(void*) throw(); void operator delete[](void*) throw(); void* operator new(std::size_t, const std::nothrow_t&) throw(); void* operator new[](std::size_t, const std::nothrow_t&) throw(); void operator delete(void*, const std::nothrow_t&) throw(); void operator delete[](void*, const std::nothrow_t&) throw(); #endif #endif /*(COINUTILS_MEMPOOL_MAXPOOLED >= 0)*/ #endif CoinMP-1.8.3/CoinUtils/src/CoinPackedVector.cpp0000644000175000017500000003425211667146070017721 0ustar renerene/* $Id: CoinPackedVector.cpp 1509 2011-12-05 13:50:48Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" //############################################################################# void CoinPackedVector::clear() { nElements_ = 0; clearBase(); } //############################################################################# CoinPackedVector & CoinPackedVector::operator=(const CoinPackedVector & rhs) { if (this != &rhs) { clear(); gutsOfSetVector(rhs.getVectorNumElements(), rhs.getVectorIndices(), rhs.getVectorElements(), CoinPackedVectorBase::testForDuplicateIndex(), "operator="); } return *this; } //############################################################################# CoinPackedVector & CoinPackedVector::operator=(const CoinPackedVectorBase & rhs) { if (this != &rhs) { clear(); gutsOfSetVector(rhs.getNumElements(), rhs.getIndices(), rhs.getElements(), CoinPackedVectorBase::testForDuplicateIndex(), "operator= from base"); } return *this; } //############################################################################# #if 0 void CoinPackedVector::assignVector(int size, int*& inds, double*& elems, bool testForDuplicateIndex) { clear(); // Allocate storage if ( size != 0 ) { reserve(size); nElements_ = size; indices_ = inds; inds = NULL; elements_ = elems; elems = NULL; CoinIotaN(origIndices_, size, 0); } try { CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex); } catch (CoinError& e) { throw CoinError("duplicate index", "assignVector", "CoinPackedVector"); } } #else void CoinPackedVector::assignVector(int size, int*& inds, double*& elems, bool testForDuplicateIndex) { clear(); // Allocate storage if ( size != 0 ) { //reserve(size); //This is a BUG!!! nElements_ = size; if (indices_ != NULL) delete[] indices_; indices_ = inds; inds = NULL; if (elements_ != NULL) delete[] elements_; elements_ = elems; elems = NULL; if (origIndices_ != NULL) delete[] origIndices_; origIndices_ = new int[size]; CoinIotaN(origIndices_, size, 0); capacity_ = size; } if (testForDuplicateIndex) { try { CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex); } catch (CoinError& e) { throw CoinError("duplicate index", "assignVector", "CoinPackedVector"); } } else { setTestsOff(); } } #endif //############################################################################# void CoinPackedVector::setVector(int size, const int * inds, const double * elems, bool testForDuplicateIndex) { clear(); gutsOfSetVector(size, inds, elems, testForDuplicateIndex, "setVector"); } //############################################################################# void CoinPackedVector::setConstant(int size, const int * inds, double value, bool testForDuplicateIndex) { clear(); gutsOfSetConstant(size, inds, value, testForDuplicateIndex, "setConstant"); } //############################################################################# void CoinPackedVector::setFull(int size, const double * elems, bool testForDuplicateIndex) { // Clear out any values presently stored clear(); // Allocate storage if ( size!=0 ) { reserve(size); nElements_ = size; CoinIotaN(origIndices_, size, 0); CoinIotaN(indices_, size, 0); CoinDisjointCopyN(elems, size, elements_); } // Full array can not have duplicates CoinPackedVectorBase::setTestForDuplicateIndexWhenTrue(testForDuplicateIndex); } //############################################################################# /* Indices are not specified and are taken to be 0,1,...,size-1, but only where non zero*/ void CoinPackedVector::setFullNonZero(int size, const double * elems, bool testForDuplicateIndex) { // Clear out any values presently stored clear(); // For now waste space // Allocate storage if ( size!=0 ) { reserve(size); nElements_ = 0; int i; for (i=0;i= nElements_ ) throw CoinError("index >= size()", "setElement", "CoinPackedVector"); if ( index < 0 ) throw CoinError("index < 0" , "setElement", "CoinPackedVector"); #endif elements_[index] = element; } //############################################################################# void CoinPackedVector::insert( int index, double element ) { const int s = nElements_; if (testForDuplicateIndex()) { std::set& is = *indexSet("insert", "CoinPackedVector"); if (! is.insert(index).second) throw CoinError("Index already exists", "insert", "CoinPackedVector"); } if( capacity_ <= s ) { reserve( CoinMax(5, 2*capacity_) ); assert( capacity_ > s ); } indices_[s] = index; elements_[s] = element; origIndices_[s] = s; ++nElements_; } //############################################################################# void CoinPackedVector::append(const CoinPackedVectorBase & caboose) { const int cs = caboose.getNumElements(); if (cs == 0) { return; } if (testForDuplicateIndex()) { // Just to initialize the index heap indexSet("append (1st call)", "CoinPackedVector"); } const int s = nElements_; // Make sure there is enough room for the caboose if ( capacity_ < s + cs) reserve(CoinMax(s + cs, 2 * capacity_)); const int * cind = caboose.getIndices(); const double * celem = caboose.getElements(); CoinDisjointCopyN(cind, cs, indices_ + s); CoinDisjointCopyN(celem, cs, elements_ + s); CoinIotaN(origIndices_ + s, cs, s); nElements_ += cs; if (testForDuplicateIndex()) { std::set& is = *indexSet("append (2nd call)", "CoinPackedVector"); for (int i = 0; i < cs; ++i) { if (!is.insert(cind[i]).second) throw CoinError("duplicate index", "append", "CoinPackedVector"); } } } //############################################################################# void CoinPackedVector::swap(int i, int j) { if ( i >= nElements_ ) throw CoinError("index i >= size()","swap","CoinPackedVector"); if ( i < 0 ) throw CoinError("index i < 0" ,"swap","CoinPackedVector"); if ( i >= nElements_ ) throw CoinError("index j >= size()","swap","CoinPackedVector"); if ( i < 0 ) throw CoinError("index j < 0" ,"swap","CoinPackedVector"); // Swap positions i and j of the // indices and elements arrays std::swap(indices_[i], indices_[j]); std::swap(elements_[i], elements_[j]); } //############################################################################# void CoinPackedVector::truncate( int n ) { if ( n > nElements_ ) throw CoinError("n > size()","truncate","CoinPackedVector"); if ( n < 0 ) throw CoinError("n < 0","truncate","CoinPackedVector"); nElements_ = n; clearBase(); } //############################################################################# void CoinPackedVector::operator+=(double value) { std::transform(elements_, elements_ + nElements_, elements_, std::bind2nd(std::plus(), value) ); } //----------------------------------------------------------------------------- void CoinPackedVector::operator-=(double value) { std::transform(elements_, elements_ + nElements_, elements_, std::bind2nd(std::minus(), value) ); } //----------------------------------------------------------------------------- void CoinPackedVector::operator*=(double value) { std::transform(elements_, elements_ + nElements_, elements_, std::bind2nd(std::multiplies(), value) ); } //----------------------------------------------------------------------------- void CoinPackedVector::operator/=(double value) { std::transform(elements_, elements_ + nElements_, elements_, std::bind2nd(std::divides(), value) ); } //############################################################################# void CoinPackedVector::sortOriginalOrder() { CoinSort_3(origIndices_, origIndices_ + nElements_, indices_, elements_); } //############################################################################# void CoinPackedVector::reserve(int n) { // don't make allocated space smaller if ( n <= capacity_ ) return; capacity_ = n; // save pointers to existing data int * tempIndices = indices_; int * tempOrigIndices = origIndices_; double * tempElements = elements_; // allocate new space indices_ = new int [capacity_]; origIndices_ = new int [capacity_]; elements_ = new double [capacity_]; // copy data to new space if (nElements_ > 0) { CoinDisjointCopyN(tempIndices, nElements_, indices_); CoinDisjointCopyN(tempOrigIndices, nElements_, origIndices_); CoinDisjointCopyN(tempElements, nElements_, elements_); } // free old data delete [] tempElements; delete [] tempOrigIndices; delete [] tempIndices; } //############################################################################# CoinPackedVector::CoinPackedVector (bool testForDuplicateIndex) : CoinPackedVectorBase(), indices_(NULL), elements_(NULL), nElements_(0), origIndices_(NULL), capacity_(0) { // This won't fail, the packed vector is empty. There can't be duplicate // indices. CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex); } //----------------------------------------------------------------------------- CoinPackedVector::CoinPackedVector(int size, const int * inds, const double * elems, bool testForDuplicateIndex) : CoinPackedVectorBase(), indices_(NULL), elements_(NULL), nElements_(0), origIndices_(NULL), capacity_(0) { gutsOfSetVector(size, inds, elems, testForDuplicateIndex, "constructor for array value"); } //----------------------------------------------------------------------------- CoinPackedVector::CoinPackedVector(int size, const int * inds, double value, bool testForDuplicateIndex) : CoinPackedVectorBase(), indices_(NULL), elements_(NULL), nElements_(0), origIndices_(NULL), capacity_(0) { gutsOfSetConstant(size, inds, value, testForDuplicateIndex, "constructor for constant value"); } //----------------------------------------------------------------------------- CoinPackedVector::CoinPackedVector(int capacity, int size, int *&inds, double *&elems, bool /*testForDuplicateIndex*/) : CoinPackedVectorBase(), indices_(inds), elements_(elems), nElements_(size), origIndices_(NULL), capacity_(capacity) { assert( size <= capacity ); inds = NULL; elems = NULL; origIndices_ = new int[capacity_]; CoinIotaN(origIndices_, size, 0); } //----------------------------------------------------------------------------- CoinPackedVector::CoinPackedVector(int size, const double * element, bool testForDuplicateIndex) : CoinPackedVectorBase(), indices_(NULL), elements_(NULL), nElements_(0), origIndices_(NULL), capacity_(0) { setFull(size, element, testForDuplicateIndex); } //----------------------------------------------------------------------------- CoinPackedVector::CoinPackedVector(const CoinPackedVectorBase & rhs) : CoinPackedVectorBase(), indices_(NULL), elements_(NULL), nElements_(0), origIndices_(NULL), capacity_(0) { gutsOfSetVector(rhs.getNumElements(), rhs.getIndices(), rhs.getElements(), rhs.testForDuplicateIndex(), "copy constructor from base"); } //----------------------------------------------------------------------------- CoinPackedVector::CoinPackedVector(const CoinPackedVector & rhs) : CoinPackedVectorBase(), indices_(NULL), elements_(NULL), nElements_(0), origIndices_(NULL), capacity_(0) { gutsOfSetVector(rhs.getVectorNumElements(), rhs.getVectorIndices(), rhs.getVectorElements(), rhs.testForDuplicateIndex(), "copy constructor"); } //----------------------------------------------------------------------------- CoinPackedVector::~CoinPackedVector () { delete [] indices_; delete [] origIndices_; delete [] elements_; } //############################################################################# void CoinPackedVector::gutsOfSetVector(int size, const int * inds, const double * elems, bool testForDuplicateIndex, const char * method) { if ( size != 0 ) { reserve(size); nElements_ = size; CoinDisjointCopyN(inds, size, indices_); CoinDisjointCopyN(elems, size, elements_); CoinIotaN(origIndices_, size, 0); } if (testForDuplicateIndex) { try { CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex); } catch (CoinError& e) { throw CoinError("duplicate index", method, "CoinPackedVector"); } } else { setTestsOff(); } } //----------------------------------------------------------------------------- void CoinPackedVector::gutsOfSetConstant(int size, const int * inds, double value, bool testForDuplicateIndex, const char * method) { if ( size != 0 ) { reserve(size); nElements_ = size; CoinDisjointCopyN(inds, size, indices_); CoinFillN(elements_, size, value); CoinIotaN(origIndices_, size, 0); } try { CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex); } catch (CoinError& e) { throw CoinError("duplicate index", method, "CoinPackedVector"); } } //############################################################################# CoinMP-1.8.3/CoinUtils/src/CoinShallowPackedVector.cpp0000644000175000017500000001217311654260357021252 0ustar renerene/* $Id: CoinShallowPackedVector.cpp 1498 2011-11-02 15:25:35Z mjs $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinHelperFunctions.hpp" #include "CoinShallowPackedVector.hpp" //############################################################################# void CoinShallowPackedVector::clear() { clearBase(); indices_ = NULL; elements_ = NULL; nElements_ = 0; } //############################################################################# CoinShallowPackedVector& CoinShallowPackedVector::operator=(const CoinPackedVectorBase & x) { if (&x != this) { indices_ = x.getIndices(); elements_ = x.getElements(); nElements_ = x.getNumElements(); CoinPackedVectorBase::clearBase(); CoinPackedVectorBase::copyMaxMinIndex(x); try { CoinPackedVectorBase::duplicateIndex(); } catch (CoinError& e) { throw CoinError("duplicate index", "operator= from base", "CoinShallowPackedVector"); } } return *this; } //############################################################################# CoinShallowPackedVector& CoinShallowPackedVector::operator=(const CoinShallowPackedVector & x) { if (&x != this) { indices_ = x.indices_; elements_ = x.elements_; nElements_ = x.nElements_; CoinPackedVectorBase::clearBase(); CoinPackedVectorBase::copyMaxMinIndex(x); try { CoinPackedVectorBase::duplicateIndex(); } catch (CoinError& e) { throw CoinError("duplicate index", "operator=", "CoinShallowPackedVector"); } } return *this; } //############################################################################# void CoinShallowPackedVector::setVector(int size, const int * inds, const double * elems, bool testForDuplicateIndex) { indices_ = inds; elements_ = elems; nElements_ = size; CoinPackedVectorBase::clearBase(); try { CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex); } catch (CoinError& e) { throw CoinError("duplicate index", "setVector", "CoinShallowPackedVector"); } } //############################################################################# //------------------------------------------------------------------- // Default //------------------------------------------------------------------- CoinShallowPackedVector::CoinShallowPackedVector(bool testForDuplicateIndex) : CoinPackedVectorBase(), indices_(NULL), elements_(NULL), nElements_(0) { try { CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex); } catch (CoinError& e) { throw CoinError("duplicate index", "default constructor", "CoinShallowPackedVector"); } } //------------------------------------------------------------------- // Explicit //------------------------------------------------------------------- CoinShallowPackedVector::CoinShallowPackedVector(int size, const int * inds, const double * elems, bool testForDuplicateIndex) : CoinPackedVectorBase(), indices_(inds), elements_(elems), nElements_(size) { try { CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex); } catch (CoinError& e) { throw CoinError("duplicate index", "explicit constructor", "CoinShallowPackedVector"); } } //------------------------------------------------------------------- // Copy //------------------------------------------------------------------- CoinShallowPackedVector::CoinShallowPackedVector(const CoinPackedVectorBase& x) : CoinPackedVectorBase(), indices_(x.getIndices()), elements_(x.getElements()), nElements_(x.getNumElements()) { CoinPackedVectorBase::copyMaxMinIndex(x); try { CoinPackedVectorBase::setTestForDuplicateIndex(x.testForDuplicateIndex()); } catch (CoinError& e) { throw CoinError("duplicate index", "copy constructor from base", "CoinShallowPackedVector"); } } //------------------------------------------------------------------- // Copy //------------------------------------------------------------------- CoinShallowPackedVector::CoinShallowPackedVector(const CoinShallowPackedVector& x) : CoinPackedVectorBase(), indices_(x.getIndices()), elements_(x.getElements()), nElements_(x.getNumElements()) { CoinPackedVectorBase::copyMaxMinIndex(x); try { CoinPackedVectorBase::setTestForDuplicateIndex(x.testForDuplicateIndex()); } catch (CoinError& e) { throw CoinError("duplicate index", "copy constructor", "CoinShallowPackedVector"); } } //------------------------------------------------------------------- // Print //------------------------------------------------------------------- void CoinShallowPackedVector::print() { for (int i=0; i < nElements_; i++) { std::cout << indices_[i] << ":" << elements_[i]; if (i < nElements_-1) std::cout << ", "; } std::cout << std::endl; } CoinMP-1.8.3/CoinUtils/src/CoinTypes.hpp0000644000175000017500000000312712450335570016451 0ustar renerene/* $Id: CoinTypes.hpp 1762 2014-12-29 20:37:12Z tkr $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef _CoinTypes_hpp #define _CoinTypes_hpp #include "CoinUtilsConfig.h" /* On some systems, we require stdint.h to have the 64bit integer type defined. */ #ifdef COINUTILS_HAS_STDINT_H #include #endif #ifdef COINUTILS_HAS_CSTDINT #include #endif #define CoinInt64 COIN_INT64_T #define CoinUInt64 COIN_UINT64_T #define CoinIntPtr COIN_INTPTR_T //============================================================================= #ifndef COIN_BIG_INDEX #define COIN_BIG_INDEX 0 #endif #if COIN_BIG_INDEX==0 typedef int CoinBigIndex; #elif COIN_BIG_INDEX==1 typedef long CoinBigIndex; #else typedef long long CoinBigIndex; #endif //============================================================================= #ifndef COIN_BIG_DOUBLE #define COIN_BIG_DOUBLE 0 #endif // See if we want the ability to have long double work arrays #if COIN_BIG_DOUBLE==2 #undef COIN_BIG_DOUBLE #define COIN_BIG_DOUBLE 0 #define COIN_LONG_WORK 1 typedef long double CoinWorkDouble; #elif COIN_BIG_DOUBLE==3 #undef COIN_BIG_DOUBLE #define COIN_BIG_DOUBLE 1 #define COIN_LONG_WORK 1 typedef long double CoinWorkDouble; #else #define COIN_LONG_WORK 0 typedef double CoinWorkDouble; #endif #if COIN_BIG_DOUBLE==0 typedef double CoinFactorizationDouble; #elif COIN_BIG_DOUBLE==1 typedef long double CoinFactorizationDouble; #else typedef double CoinFactorizationDouble; #endif #endif CoinMP-1.8.3/CoinUtils/src/CoinError.cpp0000644000175000017500000000111411510461170016413 0ustar renerene/* $Id: CoinError.cpp 1373 2011-01-03 23:57:44Z lou $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinError.hpp" bool CoinError::printErrors_ = false; /** A function to block the popup windows that windows creates when the code crashes */ #ifdef HAVE_WINDOWS_H #include void WindowsErrorPopupBlocker() { SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); } #else void WindowsErrorPopupBlocker() {} #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveSingleton.hpp0000644000175000017500000000547711654260357021046 0ustar renerene/* $Id: CoinPresolveSingleton.hpp 1498 2011-11-02 15:25:35Z mjs $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveSingleton_H #define CoinPresolveSingleton_H #define SLACK_DOUBLETON 2 #define SLACK_SINGLETON 8 /*! \file */ //const int MAX_SLACK_DOUBLETONS = 1000; /*! \class slack_doubleton_action \brief Convert an explicit bound constraint to a column bound This transform looks for explicit bound constraints for a variable and transfers the bound to the appropriate column bound array. The constraint is removed from the constraint system. */ class slack_doubleton_action : public CoinPresolveAction { struct action { double clo; double cup; double rlo; double rup; double coeff; int col; int row; }; const int nactions_; const action *const actions_; slack_doubleton_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const { return ("slack_doubleton_action"); } /*! \brief Convert explicit bound constraints to column bounds. Not now There is a hard limit (#MAX_SLACK_DOUBLETONS) on the number of constraints processed in a given call. \p notFinished is set to true if candidates remain. */ static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next, bool ¬Finished); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~slack_doubleton_action() { deleteAction(actions_,action*); } }; /*! \class slack_singleton_action \brief For variables with one entry If we have a variable with one entry and no cost then we can transform the row from E to G etc. If there is a row objective region then we may be able to do this even with a cost. */ class slack_singleton_action : public CoinPresolveAction { struct action { double clo; double cup; double rlo; double rup; double coeff; int col; int row; }; const int nactions_; const action *const actions_; slack_singleton_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const { return ("slack_singleton_action"); } static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next, double * rowObjective); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~slack_singleton_action() { deleteAction(actions_,action*); } }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveDoubleton.hpp0000644000175000017500000000311211654260357021017 0ustar renerene/* $Id: CoinPresolveDoubleton.hpp 1498 2011-11-02 15:25:35Z mjs $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveDoubleton_H #define CoinPresolveDoubleton_H #define DOUBLETON 5 /*! \class doubleton_action \brief Solve ax+by=c for y and substitute y out of the problem. This moves the bounds information for y onto x, making y free and allowing us to substitute it away. \verbatim a x + b y = c l1 <= x <= u1 l2 <= y <= u2 ==> l2 <= (c - a x) / b <= u2 b/-a > 0 ==> (b l2 - c) / -a <= x <= (b u2 - c) / -a b/-a < 0 ==> (b u2 - c) / -a <= x <= (b l2 - c) / -a \endverbatim */ class doubleton_action : public CoinPresolveAction { public: struct action { double clox; double cupx; double costx; double costy; double rlo; double coeffx; double coeffy; double *colel; int icolx; int icoly; int row; int ncolx; int ncoly; }; const int nactions_; const action *const actions_; private: doubleton_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const { return ("doubleton_action"); } static const CoinPresolveAction *presolve(CoinPresolveMatrix *, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~doubleton_action(); }; #endif CoinMP-1.8.3/CoinUtils/src/CoinDenseFactorization.hpp0000644000175000017500000003250712432624153021142 0ustar renerene/* $Id: CoinDenseFactorization.hpp 1759 2014-11-18 11:07:23Z forrest $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef CoinDenseFactorization_H #define CoinDenseFactorization_H #include #include #include #include "CoinTypes.hpp" #include "CoinIndexedVector.hpp" #include "CoinFactorization.hpp" #if COIN_FACTORIZATION_DENSE_CODE == 2 #undef COIN_FACTORIZATION_DENSE_CODE #endif class CoinPackedMatrix; /// Abstract base class which also has some scalars so can be used from Dense or Simp class CoinOtherFactorization { public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor CoinOtherFactorization ( ); /// Copy constructor CoinOtherFactorization ( const CoinOtherFactorization &other); /// Destructor virtual ~CoinOtherFactorization ( ); /// = copy CoinOtherFactorization & operator = ( const CoinOtherFactorization & other ); /// Clone virtual CoinOtherFactorization * clone() const = 0; //@} /**@name general stuff such as status */ //@{ /// Returns status inline int status ( ) const { return status_; } /// Sets status inline void setStatus ( int value) { status_=value; } /// Returns number of pivots since factorization inline int pivots ( ) const { return numberPivots_; } /// Sets number of pivots since factorization inline void setPivots ( int value ) { numberPivots_=value; } /// Set number of Rows after factorization inline void setNumberRows(int value) { numberRows_ = value; } /// Number of Rows after factorization inline int numberRows ( ) const { return numberRows_; } /// Total number of columns in factorization inline int numberColumns ( ) const { return numberColumns_; } /// Number of good columns in factorization inline int numberGoodColumns ( ) const { return numberGoodU_; } /// Allows change of pivot accuracy check 1.0 == none >1.0 relaxed inline void relaxAccuracyCheck(double value) { relaxCheck_ = value;} inline double getAccuracyCheck() const { return relaxCheck_;} /// Maximum number of pivots between factorizations inline int maximumPivots ( ) const { return maximumPivots_ ; } /// Set maximum pivots virtual void maximumPivots ( int value ); /// Pivot tolerance inline double pivotTolerance ( ) const { return pivotTolerance_ ; } void pivotTolerance ( double value ); /// Zero tolerance inline double zeroTolerance ( ) const { return zeroTolerance_ ; } void zeroTolerance ( double value ); #ifndef COIN_FAST_CODE /// Whether slack value is +1 or -1 inline double slackValue ( ) const { return slackValue_ ; } void slackValue ( double value ); #endif /// Returns array to put basis elements in virtual CoinFactorizationDouble * elements() const; /// Returns pivot row virtual int * pivotRow() const; /// Returns work area virtual CoinFactorizationDouble * workArea() const; /// Returns int work area virtual int * intWorkArea() const; /// Number of entries in each row virtual int * numberInRow() const; /// Number of entries in each column virtual int * numberInColumn() const; /// Returns array to put basis starts in virtual CoinBigIndex * starts() const; /// Returns permute back virtual int * permuteBack() const; /** Get solve mode e.g. 0 C++ code, 1 Lapack, 2 choose If 4 set then values pass if 8 set then has iterated */ inline int solveMode() const { return solveMode_ ;} /** Set solve mode e.g. 0 C++ code, 1 Lapack, 2 choose If 4 set then values pass if 8 set then has iterated */ inline void setSolveMode(int value) { solveMode_ = value;} /// Returns true if wants tableauColumn in replaceColumn virtual bool wantsTableauColumn() const; /** Useful information for factorization 0 - iteration number whereFrom is 0 for factorize and 1 for replaceColumn */ virtual void setUsefulInformation(const int * info,int whereFrom); /// Get rid of all memory virtual void clearArrays() {} //@} /**@name virtual general stuff such as permutation */ //@{ /// Returns array to put basis indices in virtual int * indices() const = 0; /// Returns permute in virtual int * permute() const = 0; /// Total number of elements in factorization virtual int numberElements ( ) const = 0; //@} /**@name Do factorization - public */ //@{ /// Gets space for a factorization virtual void getAreas ( int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ) = 0; /// PreProcesses column ordered copy of basis virtual void preProcess ( ) = 0; /** Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use numberGoodColumns and redo */ virtual int factor ( ) = 0; /// Does post processing on valid factorization - putting variables on correct rows virtual void postProcess(const int * sequence, int * pivotVariable) = 0; /// Makes a non-singular basis by replacing variables virtual void makeNonSingular(int * sequence, int numberColumns) = 0; //@} /**@name rank one updates which do exist */ //@{ /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U */ virtual int replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow, double pivotCheck , bool checkBeforeModifying=false, double acceptablePivot=1.0e-8)=0; //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output */ virtual int updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false) = 0; /** This version has same effect as above with FTUpdate==false so number returned is always >=0 */ virtual int updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false) const = 0; /// does FTRAN on two columns virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermute=false) = 0; /** Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output */ virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const = 0; //@} ////////////////// data ////////////////// protected: /**@name data */ //@{ /// Pivot tolerance double pivotTolerance_; /// Zero tolerance double zeroTolerance_; #ifndef COIN_FAST_CODE /// Whether slack value is +1 or -1 double slackValue_; #else #ifndef slackValue_ #define slackValue_ -1.0 #endif #endif /// Relax check on accuracy in replaceColumn double relaxCheck_; /// Number of elements after factorization CoinBigIndex factorElements_; /// Number of Rows in factorization int numberRows_; /// Number of Columns in factorization int numberColumns_; /// Number factorized in U (not row singletons) int numberGoodU_; /// Maximum number of pivots before factorization int maximumPivots_; /// Number pivots since last factorization int numberPivots_; /// Status of factorization int status_; /// Maximum rows ever (i.e. use to copy arrays etc) int maximumRows_; /// Maximum length of iterating area CoinBigIndex maximumSpace_; /// Pivot row int * pivotRow_; /** Elements of factorization and updates length is maxR*maxR+maxSpace will always be long enough so can have nR*nR ints in maxSpace */ CoinFactorizationDouble * elements_; /// Work area of numberRows_ CoinFactorizationDouble * workArea_; /** Solve mode e.g. 0 C++ code, 1 Lapack, 2 choose If 4 set then values pass if 8 set then has iterated */ int solveMode_; //@} }; /** This deals with Factorization and Updates This is a simple dense version so other people can write a better one I am assuming that 32 bits is enough for number of rows or columns, but CoinBigIndex may be redefined to get 64 bits. */ class CoinDenseFactorization : public CoinOtherFactorization { friend void CoinDenseFactorizationUnitTest( const std::string & mpsDir ); public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor CoinDenseFactorization ( ); /// Copy constructor CoinDenseFactorization ( const CoinDenseFactorization &other); /// Destructor virtual ~CoinDenseFactorization ( ); /// = copy CoinDenseFactorization & operator = ( const CoinDenseFactorization & other ); /// Clone virtual CoinOtherFactorization * clone() const ; //@} /**@name Do factorization - public */ //@{ /// Gets space for a factorization virtual void getAreas ( int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ); /// PreProcesses column ordered copy of basis virtual void preProcess ( ); /** Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use numberGoodColumns and redo */ virtual int factor ( ); /// Does post processing on valid factorization - putting variables on correct rows virtual void postProcess(const int * sequence, int * pivotVariable); /// Makes a non-singular basis by replacing variables virtual void makeNonSingular(int * sequence, int numberColumns); //@} /**@name general stuff such as number of elements */ //@{ /// Total number of elements in factorization virtual inline int numberElements ( ) const { return numberRows_*(numberColumns_+numberPivots_); } /// Returns maximum absolute value in factorization double maximumCoefficient() const; //@} /**@name rank one updates which do exist */ //@{ /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U */ virtual int replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow, double pivotCheck , bool checkBeforeModifying=false, double acceptablePivot=1.0e-8); //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output */ virtual inline int updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool = false) { return updateColumn(regionSparse,regionSparse2);} /** This version has same effect as above with FTUpdate==false so number returned is always >=0 */ virtual int updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false) const; /// does FTRAN on two columns virtual int updateTwoColumnsFT(CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermute=false); /** Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output */ virtual int updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; //@} /// *** Below this user may not want to know about /**@name various uses of factorization which user may not want to know about (left over from my LP code) */ //@{ /// Get rid of all memory inline void clearArrays() { gutsOfDestructor();} /// Returns array to put basis indices in virtual inline int * indices() const { return reinterpret_cast (elements_+numberRows_*numberRows_);} /// Returns permute in virtual inline int * permute() const { return NULL;/*pivotRow_*/;} //@} /// The real work of desstructor void gutsOfDestructor(); /// The real work of constructor void gutsOfInitialize(); /// The real work of copy void gutsOfCopy(const CoinDenseFactorization &other); //@} protected: /** Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular */ int checkPivot(double saveFromU, double oldPivot) const; ////////////////// data ////////////////// protected: /**@name data */ //@{ //@} }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPackedVectorBase.cpp0000644000175000017500000002161511552534611020506 0ustar renerene/* $Id: CoinPackedVectorBase.cpp 1416 2011-04-17 09:57:29Z stefan $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPackedVectorBase.hpp" #include "CoinTypes.hpp" #include "CoinHelperFunctions.hpp" #include "CoinFloatEqual.hpp" //############################################################################# double * CoinPackedVectorBase::denseVector(int denseSize) const { if (getMaxIndex() >= denseSize) throw CoinError("Dense vector size is less than max index", "denseVector", "CoinPackedVectorBase"); double * dv = new double[denseSize]; CoinFillN(dv, denseSize, 0.0); const int s = getNumElements(); const int * inds = getIndices(); const double * elems = getElements(); for (int i = 0; i < s; ++i) dv[inds[i]] = elems[i]; return dv; } //----------------------------------------------------------------------------- double CoinPackedVectorBase::operator[](int i) const { if (! testedDuplicateIndex_) duplicateIndex("operator[]", "CoinPackedVectorBase"); // Get a reference to a map of full storage indices to // packed storage location. const std::set & sv = *indexSet("operator[]", "CoinPackedVectorBase"); #if 1 if (sv.find(i) == sv.end()) return 0.0; return getElements()[findIndex(i)]; #else // LL: suggested change, somthing is wrong with this const size_t ind = std::distance(sv.begin(), sv.find(i)); return (ind == sv.size()) ? 0.0 : getElements()[ind]; #endif } //############################################################################# void CoinPackedVectorBase::setTestForDuplicateIndex(bool test) const { if (test == true) { testForDuplicateIndex_ = true; duplicateIndex("setTestForDuplicateIndex", "CoinPackedVectorBase"); } else { testForDuplicateIndex_ = false; testedDuplicateIndex_ = false; } } //############################################################################# void CoinPackedVectorBase::setTestForDuplicateIndexWhenTrue(bool test) const { // We know everything is okay so let's not test (e.g. full array) testForDuplicateIndex_ = test; testedDuplicateIndex_ = test; } //############################################################################# int CoinPackedVectorBase::getMaxIndex() const { findMaxMinIndices(); return maxIndex_; } //----------------------------------------------------------------------------- int CoinPackedVectorBase::getMinIndex() const { findMaxMinIndices(); return minIndex_; } //----------------------------------------------------------------------------- void CoinPackedVectorBase::duplicateIndex(const char* methodName, const char * className) const { if (testForDuplicateIndex()) indexSet(methodName, className); testedDuplicateIndex_ = true; } //----------------------------------------------------------------------------- bool CoinPackedVectorBase::isExistingIndex(int i) const { if (! testedDuplicateIndex_) duplicateIndex("indexExists", "CoinPackedVectorBase"); const std::set & sv = *indexSet("indexExists", "CoinPackedVectorBase"); return sv.find(i) != sv.end(); } int CoinPackedVectorBase::findIndex(int i) const { const int * inds = getIndices(); int retVal = static_cast(std::find(inds, inds + getNumElements(), i) - inds); if (retVal == getNumElements() ) retVal = -1; return retVal; } //############################################################################# bool CoinPackedVectorBase::operator==(const CoinPackedVectorBase& rhs) const { if (getNumElements() == 0 || rhs.getNumElements() == 0) { if (getNumElements() == 0 && rhs.getNumElements() == 0) return (true) ; else return (false) ; } else { return (getNumElements()==rhs.getNumElements() && std::equal(getIndices(),getIndices()+getNumElements(), rhs.getIndices()) && std::equal(getElements(),getElements()+getNumElements(), rhs.getElements())) ; } } //----------------------------------------------------------------------------- bool CoinPackedVectorBase::operator!=(const CoinPackedVectorBase& rhs) const { return !( (*this)==rhs ); } //----------------------------------------------------------------------------- int CoinPackedVectorBase::compare(const CoinPackedVectorBase& rhs) const { const int size = getNumElements(); int itmp = size - rhs.getNumElements(); if (itmp != 0) { return itmp; } itmp = memcmp(getIndices(), rhs.getIndices(), size * sizeof(int)); if (itmp != 0) { return itmp; } return memcmp(getElements(), rhs.getElements(), size * sizeof(double)); } bool CoinPackedVectorBase::isEquivalent(const CoinPackedVectorBase& rhs) const { return isEquivalent(rhs, CoinRelFltEq()); } //############################################################################# double CoinPackedVectorBase::dotProduct(const double* dense) const { const double * elems = getElements(); const int * inds = getIndices(); double dp = 0.0; for (int i = getNumElements() - 1; i >= 0; --i) dp += elems[i] * dense[inds[i]]; return dp; } //----------------------------------------------------------------------------- double CoinPackedVectorBase::oneNorm() const { register double norm = 0.0; register const double* elements = getElements(); for (int i = getNumElements() - 1; i >= 0; --i) { norm += fabs(elements[i]); } return norm; } //----------------------------------------------------------------------------- double CoinPackedVectorBase::normSquare() const { return std::inner_product(getElements(), getElements() + getNumElements(), getElements(), 0.0); } //----------------------------------------------------------------------------- double CoinPackedVectorBase::twoNorm() const { return sqrt(normSquare()); } //----------------------------------------------------------------------------- double CoinPackedVectorBase::infNorm() const { register double norm = 0.0; register const double* elements = getElements(); for (int i = getNumElements() - 1; i >= 0; --i) { norm = CoinMax(norm, fabs(elements[i])); } return norm; } //----------------------------------------------------------------------------- double CoinPackedVectorBase::sum() const { return std::accumulate(getElements(), getElements() + getNumElements(), 0.0); } //############################################################################# CoinPackedVectorBase::CoinPackedVectorBase() : maxIndex_(-COIN_INT_MAX/*0*/), minIndex_(COIN_INT_MAX/*0*/), indexSetPtr_(NULL), testForDuplicateIndex_(true), testedDuplicateIndex_(false) {} //----------------------------------------------------------------------------- CoinPackedVectorBase::~CoinPackedVectorBase() { delete indexSetPtr_; } //############################################################################# //############################################################################# void CoinPackedVectorBase::findMaxMinIndices() const { if ( getNumElements()==0 ) return; // if indexSet exists then grab begin and rend to get min & max indices else if ( indexSetPtr_ != NULL ) { maxIndex_ = *indexSetPtr_->rbegin(); minIndex_ = *indexSetPtr_-> begin(); } else { // Have to scan through vector to find min and max. maxIndex_ = *(std::max_element(getIndices(), getIndices() + getNumElements())); minIndex_ = *(std::min_element(getIndices(), getIndices() + getNumElements())); } } //------------------------------------------------------------------- std::set * CoinPackedVectorBase::indexSet(const char* methodName, const char * className) const { testedDuplicateIndex_ = true; if ( indexSetPtr_ == NULL ) { // create a set of the indices indexSetPtr_ = new std::set; const int s = getNumElements(); const int * inds = getIndices(); for (int j=0; j < s; ++j) { if (!indexSetPtr_->insert(inds[j]).second) { testedDuplicateIndex_ = false; delete indexSetPtr_; indexSetPtr_ = NULL; if (methodName != NULL) { throw CoinError("Duplicate index found", methodName, className); } else { throw CoinError("Duplicate index found", "indexSet", "CoinPackedVectorBase"); } } } } return indexSetPtr_; } //----------------------------------------------------------------------------- void CoinPackedVectorBase::clearIndexSet() const { delete indexSetPtr_; indexSetPtr_ = NULL; } //----------------------------------------------------------------------------- void CoinPackedVectorBase::clearBase() const { clearIndexSet(); maxIndex_ = -COIN_INT_MAX/*0*/; minIndex_ = COIN_INT_MAX/*0*/; testedDuplicateIndex_ = false; } //############################################################################# CoinMP-1.8.3/CoinUtils/src/CoinLpIO.hpp0000644000175000017500000007047412422527716016165 0ustar renerene/* $Id: CoinLpIO.hpp 1749 2014-10-24 20:00:14Z tkr $ */ // Last edit: 11/5/08 // // Name: CoinLpIO.hpp; Support for Lp files // Author: Francois Margot // Tepper School of Business // Carnegie Mellon University, Pittsburgh, PA 15213 // email: fmargot@andrew.cmu.edu // Date: 12/28/03 //----------------------------------------------------------------------------- // Copyright (C) 2003, Francois Margot, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinLpIO_H #define CoinLpIO_H #include #include "CoinPackedMatrix.hpp" #include "CoinMessage.hpp" class CoinSet; const int MAX_OBJECTIVES = 2; typedef int COINColumnIndex; /** Class to read and write Lp files Lp file format: / this is a comment
    \ this too
    Min
    obj: x0 + x1 + 3 x2 - 4.5 xyr + 1
    s.t.
    cons1: x0 - x2 - 2.3 x4 <= 4.2 / this is another comment
    c2: x1 + x2 >= 1
    cc: x1 + x2 + xyr = 2
    Bounds
    0 <= x1 <= 3
    1 >= x2
    x3 = 1
    -2 <= x4 <= Inf
    xyr free
    Integers
    x0
    Generals
    x1 xyr
    Binaries
    x2
    End Notes:
    • Keywords are: Min, Max, Minimize, Maximize, s.t., Subject To, Bounds, Integers, Generals, Binaries, End, Free, Inf.
    • Keywords are not case sensitive and may be in plural or singular form. They should not be used as objective, row or column names.
    • Bounds, Integers, Generals, Binaries sections are optional.
    • Generals and Integers are synonymous.
    • Bounds section (if any) must come before Integers, Generals, and Binaries sections.
    • Row names must be followed by ':' without blank space. Row names are optional. If row names are present, they must be distinct (if the k-th constraint has no given name, its name is set automatically to "consk" for k=0,...,). For valid row names, see the method is_invalid_name().
    • Column names must be followed by a blank space. They must be distinct. For valid column names, see the method is_invalid_name().
    • Multiple objectives may be specified, but when there are multiple objectives, they must have names (to indicate where each one starts).
    • The objective function names must be followed by ':' without blank space. If there is a single objective, the objective function name is optional. If no name is given, the name is set to "obj" by default. For valid objective function names, see the method is_invalid_name().
    • Ranged constraints are written as two constraints. If a name is given for a ranged constraint, the upper bound constraint has that name and the lower bound constraint has that name with "_low" as suffix. This should be kept in mind when assigning names to ranged constraint, as the resulting name must be distinct from all the other names and be considered valid by the method is_invalid_name().
    • At most one term related to any single variable may appear in the objective function; if more than one term are present, only the last one is taken into account. At most one constant term may appear in the objective function; if present, it must appear last.
    • Default bounds are 0 for lower bound and +infinity for upper bound.
    • Free variables get default lower bound -infinity and default upper bound +infinity. Writing "x0 Free" in an LP file means "set lower bound on x0 to -infinity".
    • If more than one upper (resp. lower) bound on a variable appears in the Bounds section, the last one is the one taken into account. The bounds for a binary variable are set to 0/1 only if this bound is stronger than the bound obtained from the Bounds section.
    • Numbers larger than DBL_MAX (or larger than 1e+400) in the input file might crash the code.
    • A comment must start with '\' or '/'. That symbol must either be the first character of a line or be preceded by a blank space. The comment ends at the end of the line. Comments are skipped while reading an Lp file and they may be inserted anywhere.
    */ class CoinLpIO { friend void CoinLpIOUnitTest(const std::string & lpDir); public: /**@name Constructor and Destructor */ //@{ /// Default Constructor CoinLpIO(); /// Does the heavy lifting for destruct and assignment. void gutsOfDestructor(); /// Does the heavy lifting for copy and assignment void gutsOfCopy(const CoinLpIO &); /// assignment operator CoinLpIO & operator = (const CoinLpIO& rhs) ; /// Copy constructor CoinLpIO (const CoinLpIO &); /// Destructor ~CoinLpIO(); /** Free the vector previous_names_[section] and set card_previous_names_[section] to 0. section = 0 for row names, section = 1 for column names. */ void freePreviousNames(const int section); /// Free all memory (except memory related to hash tables and objName_). void freeAll(); //@} /** A quick inlined function to convert from lb/ub style constraint definition to sense/rhs/range style */ inline void convertBoundToSense(const double lower, const double upper, char& sense, double& right, double& range) const; /**@name Queries */ //@{ /// Get the problem name const char * getProblemName() const; /// Set problem name void setProblemName(const char *name); /// Get number of columns int getNumCols() const; /// Get number of rows int getNumRows() const; /// Get number of nonzero elements int getNumElements() const; /// Get pointer to array[getNumCols()] of column lower bounds const double * getColLower() const; /// Get pointer to array[getNumCols()] of column upper bounds const double * getColUpper() const; /// Get pointer to array[getNumRows()] of row lower bounds const double * getRowLower() const; /// Get pointer to array[getNumRows()] of row upper bounds const double * getRowUpper() const; /** Get pointer to array[getNumRows()] of constraint senses.
    • 'L': <= constraint
    • 'E': = constraint
    • 'G': >= constraint
    • 'R': ranged constraint
    • 'N': free constraint
    */ const char * getRowSense() const; /** Get pointer to array[getNumRows()] of constraint right-hand sides. Given constraints with upper (rowupper) and/or lower (rowlower) bounds, the constraint right-hand side (rhs) is set as
    • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
    • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'N' then rhs()[i] == 0.0
    */ const double * getRightHandSide() const; /** Get pointer to array[getNumRows()] of row ranges. Given constraints with upper (rowupper) and/or lower (rowlower) bounds, the constraint range (rowrange) is set as
    • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
    • if rowsense()[i] != 'R' then rowrange()[i] is 0.0
    Put another way, only ranged constraints have a nontrivial value for rowrange. */ const double * getRowRange() const; /// Get pointer to array[getNumCols()] of objective function coefficients const int getNumObjectives() const; /// Get pointer to array[getNumCols()] of objective function coefficients const double * getObjCoefficients() const; /// Get pointer to array[getNumCols()] of objective function coefficients for objective j const double * getObjCoefficients(int j) const; /// Get pointer to row-wise copy of the coefficient matrix const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of the coefficient matrix const CoinPackedMatrix * getMatrixByCol() const; /// Get objective function name const char * getObjName() const; /// Get objective function name for objective j const char * getObjName(int j) const; /// Get pointer to array[*card_prev] of previous row names. /// The value of *card_prev might be different than getNumRows()+1 if /// non distinct /// row names were present or if no previous names were saved or if /// the object was holding a different problem before. void getPreviousRowNames(char const * const * prev, int *card_prev) const; /// Get pointer to array[*card_prev] of previous column names. /// The value of *card_prev might be different than getNumCols() if non /// distinct column names were present of if no previous names were saved, /// or if the object was holding a different problem before. void getPreviousColNames(char const * const * prev, int *card_prev) const; /// Get pointer to array[getNumRows()+1] of row names, including /// objective function name as last entry. char const * const * getRowNames() const; /// Get pointer to array[getNumCols()] of column names char const * const *getColNames() const; /// Return the row name for the specified index. /// Return the objective function name if index = getNumRows(). /// Return 0 if the index is out of range or if row names are not defined. const char * rowName(int index) const; /// Return the column name for the specified index. /// Return 0 if the index is out of range or if column names are not /// defined. const char * columnName(int index) const; /// Return the index for the specified row name. /// Return getNumRows() for the objective function name. /// Return -1 if the name is not found. int rowIndex(const char * name) const; /// Return the index for the specified column name. /// Return -1 if the name is not found. int columnIndex(const char * name) const; ///Returns the (constant) objective offset double objectiveOffset() const; ///Returns the (constant) objective offset for objective j double objectiveOffset(int j) const; /// Set objective offset inline void setObjectiveOffset(double value) { objectiveOffset_[0] = value;} /// Set objective offset inline void setObjectiveOffset(double value, int j) { objectiveOffset_[j] = value;} /// Return true if a column is an integer (binary or general /// integer) variable bool isInteger(int columnNumber) const; /// Get characteristic vector of integer variables const char * integerColumns() const; //@} /**@name Parameters */ //@{ /// Get infinity double getInfinity() const; /// Set infinity. Any number larger is considered infinity. /// Default: DBL_MAX void setInfinity(const double); /// Get epsilon double getEpsilon() const; /// Set epsilon. /// Default: 1e-5. void setEpsilon(const double); /// Get numberAcross, the number of monomials to be printed per line int getNumberAcross() const; /// Set numberAcross. /// Default: 10. void setNumberAcross(const int); /// Get decimals, the number of digits to write after the decimal point int getDecimals() const; /// Set decimals. /// Default: 5 void setDecimals(const int); //@} /**@name Public methods */ //@{ /** Set the data of the object. Set it from the coefficient matrix m, the lower bounds collb, the upper bounds colub, objective function obj_coeff, integrality vector integrality, lower/upper bounds on the constraints. The sense of optimization of the objective function is assumed to be a minimization. Numbers larger than DBL_MAX (or larger than 1e+400) might crash the code. There are two version. The second one is for setting multiple objectives. */ void setLpDataWithoutRowAndColNames( const CoinPackedMatrix& m, const double* collb, const double* colub, const double* obj_coeff, const char* integrality, const double* rowlb, const double* rowub); void setLpDataWithoutRowAndColNames( const CoinPackedMatrix& m, const double* collb, const double* colub, const double* obj_coeff[MAX_OBJECTIVES], int num_objectives, const char* integrality, const double* rowlb, const double* rowub); /** Return 0 if buff is a valid name for a row, a column or objective function, return a positive number otherwise. If parameter ranged = true, the name is intended for a ranged constraint.
    Return 1 if the name has more than 100 characters (96 characters for a ranged constraint name, as "_low" will be added to the name).
    Return 2 if the name starts with a number.
    Return 3 if the name is not built with the letters a to z, A to Z, the numbers 0 to 9 or the characters " ! # $ % & ( ) . ; ? @ _ ' ` { } ~
    Return 4 if the name is a keyword.
    Return 5 if the name is empty or NULL. */ int is_invalid_name(const char *buff, const bool ranged) const; /** Return 0 if each of the card_vnames entries of vnames is a valid name, return a positive number otherwise. The return value, if not 0, is the return value of is_invalid_name() for the last invalid name in vnames. If check_ranged = true, the names are row names and names for ranged constaints must be checked for additional restrictions since "_low" will be added to the name if an Lp file is written. When check_ranged = true, card_vnames must have getNumRows()+1 entries, with entry vnames[getNumRows()] being the name of the objective function. For a description of valid names and return values, see the method is_invalid_name(). This method must not be called with check_ranged = true before setLpDataWithoutRowAndColNames() has been called, since access to the indices of all the ranged constraints is required. */ int are_invalid_names(char const * const *vnames, const int card_vnames, const bool check_ranged) const; /// Set objective function name to the default "obj" and row /// names to the default "cons0", "cons1", ... void setDefaultRowNames(); /// Set column names to the default "x0", "x1", ... void setDefaultColNames(); /** Set the row and column names. The array rownames must either be NULL or have exactly getNumRows()+1 distinct entries, each of them being a valid name (see is_invalid_name()) and the last entry being the intended name for the objective function. If rownames is NULL, existing row names and objective function name are not changed. If rownames is deemed invalid, default row names and objective function name are used (see setDefaultRowNames()). The memory location of array rownames (or its entries) should not be related to the memory location of the array (or entries) obtained from getRowNames() or getPreviousRowNames(), as the call to setLpDataRowAndColNames() modifies the corresponding arrays. Unpredictable results are obtained if this requirement is ignored. Similar remarks apply to the array colnames, which must either be NULL or have exactly getNumCols() entries. */ void setLpDataRowAndColNames(char const * const * const rownames, char const * const * const colnames); /** Write the data in Lp format in the file with name filename. Coefficients with value less than epsilon away from an integer value are written as integers. Write at most numberAcross monomials on a line. Write non integer numbers with decimals digits after the decimal point. Write objective function name and row names if useRowNames = true. Ranged constraints are written as two constraints. If row names are used, the upper bound constraint has the name of the original ranged constraint and the lower bound constraint has for name the original name with "_low" as suffix. If doing so creates two identical row names, default row names are used (see setDefaultRowNames()). */ int writeLp(const char *filename, const double epsilon, const int numberAcross, const int decimals, const bool useRowNames = true); /** Write the data in Lp format in the file pointed to by the paramater fp. Coefficients with value less than epsilon away from an integer value are written as integers. Write at most numberAcross monomials on a line. Write non integer numbers with decimals digits after the decimal point. Write objective function name and row names if useRowNames = true. Ranged constraints are written as two constraints. If row names are used, the upper bound constraint has the name of the original ranged constraint and the lower bound constraint has for name the original name with "_low" as suffix. If doing so creates two identical row names, default row names are used (see setDefaultRowNames()). */ int writeLp(FILE *fp, const double epsilon, const int numberAcross, const int decimals, const bool useRowNames = true); /// Write the data in Lp format in the file with name filename. /// Write objective function name and row names if useRowNames = true. int writeLp(const char *filename, const bool useRowNames = true); /// Write the data in Lp format in the file pointed to by the parameter fp. /// Write objective function name and row names if useRowNames = true. int writeLp(FILE *fp, const bool useRowNames = true); /// Read the data in Lp format from the file with name filename, using /// the given value for epsilon. If the original problem is /// a maximization problem, the objective function is immediadtly /// flipped to get a minimization problem. void readLp(const char *filename, const double epsilon); /// Read the data in Lp format from the file with name filename. /// If the original problem is /// a maximization problem, the objective function is immediadtly /// flipped to get a minimization problem. void readLp(const char *filename); /// Read the data in Lp format from the file stream, using /// the given value for epsilon. /// If the original problem is /// a maximization problem, the objective function is immediadtly /// flipped to get a minimization problem. void readLp(FILE *fp, const double epsilon); /// Read the data in Lp format from the file stream. /// If the original problem is /// a maximization problem, the objective function is immediadtly /// flipped to get a minimization problem. void readLp(FILE *fp); /// Dump the data. Low level method for debugging. void print() const; /// Load in SOS stuff void loadSOS(int numberSets,const CoinSet * sets); /// Load in SOS stuff void loadSOS(int numberSets,const CoinSet ** sets); /// Number of SOS sets inline int numberSets() const { return numberSets_;} /// Set information inline CoinSet ** setInformation() const { return set_;} //@} /**@name Message handling */ //@{ /** Pass in Message handler Supply a custom message handler. It will not be destroyed when the CoinMpsIO object is destroyed. */ void passInMessageHandler(CoinMessageHandler * handler); /// Set the language for messages. void newLanguage(CoinMessages::Language language); /// Set the language for messages. inline void setLanguage(CoinMessages::Language language) {newLanguage(language);} /// Return the message handler inline CoinMessageHandler * messageHandler() const {return handler_;} /// Return the messages inline CoinMessages messages() {return messages_;} /// Return the messages pointer inline CoinMessages * messagesPointer() {return & messages_;} //@} protected: /// Problem name char * problemName_; /// Message handler CoinMessageHandler * handler_; /** Flag to say if the message handler is the default handler. If true, the handler will be destroyed when the CoinMpsIO object is destroyed; if false, it will not be destroyed. */ bool defaultHandler_; /// Messages CoinMessages messages_; /// Number of rows int numberRows_; /// Number of columns int numberColumns_; /// Number of elements int numberElements_; /// Pointer to column-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByColumn_; /// Pointer to row-wise copy of problem matrix coefficients. CoinPackedMatrix *matrixByRow_; /// Pointer to dense vector of row lower bounds double * rowlower_; /// Pointer to dense vector of row upper bounds double * rowupper_; /// Pointer to dense vector of column lower bounds double * collower_; /// Pointer to dense vector of column upper bounds double * colupper_; /// Pointer to dense vector of row rhs mutable double * rhs_; /** Pointer to dense vector of slack variable upper bounds for ranged constraints (undefined for non-ranged constraints) */ mutable double *rowrange_; /// Pointer to dense vector of row senses mutable char * rowsense_; /// Pointer to dense vector of objective coefficients double * objective_[MAX_OBJECTIVES]; /// Number of objectives int num_objectives_; /// Constant offset for objective value double objectiveOffset_[MAX_OBJECTIVES]; /// Pointer to dense vector specifying if a variable is continuous /// (0) or integer (1). char * integerType_; /// Pointer to sets CoinSet ** set_; /// Number of sets int numberSets_; /// Current file name char * fileName_; /// Value to use for infinity double infinity_; /// Value to use for epsilon double epsilon_; /// Number of monomials printed in a row int numberAcross_; /// Number of decimals printed for coefficients int decimals_; /// Objective function name char *objName_[MAX_OBJECTIVES]; /** Row names (including objective function name) and column names when stopHash() for the corresponding section was last called or for initial names (deemed invalid) read from a file.
    section = 0 for row names, section = 1 for column names. */ char **previous_names_[2]; /// card_previous_names_[section] holds the number of entries in the vector /// previous_names_[section]. /// section = 0 for row names, /// section = 1 for column names. int card_previous_names_[2]; /// Row names (including objective function name) /// and column names (linked to Hash tables). /// section = 0 for row names, /// section = 1 for column names. char **names_[2]; typedef struct { int index, next; } CoinHashLink; /// Maximum number of entries in a hash table section. /// section = 0 for row names, /// section = 1 for column names. int maxHash_[2]; /// Number of entries in a hash table section. /// section = 0 for row names, /// section = 1 for column names. int numberHash_[2]; /// Hash tables with two sections. /// section = 0 for row names (including objective function name), /// section = 1 for column names. mutable CoinHashLink *hash_[2]; /// Build the hash table for the given names. The parameter number is /// the cardinality of parameter names. Remove duplicate names. /// /// section = 0 for row names, /// section = 1 for column names. void startHash(char const * const * const names, const COINColumnIndex number, int section); /// Delete hash storage. If section = 0, it also frees objName_. /// section = 0 for row names, /// section = 1 for column names. void stopHash(int section); /// Return the index of the given name, return -1 if the name is not found. /// Return getNumRows() for the objective function name. /// section = 0 for row names (including objective function name), /// section = 1 for column names. COINColumnIndex findHash(const char *name, int section) const; /// Insert thisName in the hash table if not present yet; does nothing /// if the name is already in. /// section = 0 for row names, /// section = 1 for column names. void insertHash(const char *thisName, int section); /// Write a coefficient. /// print_1 = 0 : do not print the value 1. void out_coeff(FILE *fp, double v, int print_1) const; /// Locate the objective function. /// Return 1 if found the keyword "Minimize" or one of its variants, /// -1 if found keyword "Maximize" or one of its variants. int find_obj(FILE *fp) const; /// Return an integer indicating if the keyword "subject to" or one /// of its variants has been read. /// Return 1 if buff is the keyword "s.t" or one of its variants. /// Return 2 if buff is the keyword "subject" or one of its variants. /// Return 0 otherwise. int is_subject_to(const char *buff) const; /// Return 1 if the first character of buff is a number. /// Return 0 otherwise. int first_is_number(const char *buff) const; /// Return 1 if the first character of buff is '/' or '\'. /// Return 0 otherwise. int is_comment(const char *buff) const; /// Read the file fp until buff contains an end of line void skip_comment(char *buff, FILE *fp) const; /// Put in buff the next string that is not part of a comment void scan_next(char *buff, FILE *fp) const; /// Return 1 if buff is the keyword "free" or one of its variants. /// Return 0 otherwise. int is_free(const char *buff) const; /// Return 1 if buff is the keyword "inf" or one of its variants. /// Return 0 otherwise. int is_inf(const char *buff) const; /// Return an integer indicating the inequality sense read. /// Return 0 if buff is '<='. /// Return 1 if buff is '='. /// Return 2 if buff is '>='. /// Return -1 otherwise. int is_sense(const char *buff) const; /// Return an integer indicating if one of the keywords "Bounds", "Integers", /// "Generals", "Binaries", "Semi-continuous", "Sos", "End", or one /// of their variants has been read. (note Semi-continuous not coded) /// Return 1 if buff is the keyword "Bounds" or one of its variants. /// Return 2 if buff is the keyword "Integers" or "Generals" or one of their /// variants. /// Return 3 if buff is the keyword "Binaries" or one of its variants. /// Return 4 if buff is the keyword "Semi-continuous" or one of its variants. /// Return 5 if buff is the keyword "Sos" or one of its variants. /// Return 6 if buff is the keyword "End" or one of its variants. /// Return 0 otherwise. int is_keyword(const char *buff) const; /// Read a monomial of the objective function. /// Return 1 if "subject to" or one of its variants has been read. int read_monom_obj(FILE *fp, double *coeff, char **name, int *cnt, char **obj_name, int *num_objectives, int *obj_starts); /// Read a monomial of a constraint. /// Return a positive number if the sense of the inequality has been /// read (see method is_sense() for the return code). /// Return -1 otherwise. int read_monom_row(FILE *fp, char *start_str, double *coeff, char **name, int cnt_coeff) const; /// Reallocate vectors related to number of coefficients. void realloc_coeff(double **coeff, char ***colNames, int *maxcoeff) const; /// Reallocate vectors related to rows. void realloc_row(char ***rowNames, int **start, double **rhs, double **rowlow, double **rowup, int *maxrow) const; /// Reallocate vectors related to columns. void realloc_col(double **collow, double **colup, char **is_int, int *maxcol) const; /// Read a constraint. void read_row(FILE *fp, char *buff, double **pcoeff, char ***pcolNames, int *cnt_coeff, int *maxcoeff, double *rhs, double *rowlow, double *rowup, int *cnt_row, double inf) const; /** Check that current objective name and all row names are distinct including row names obtained by adding "_low" for ranged constraints. If there is a conflict in the names, they are replaced by default row names (see setDefaultRowNames()). This method must not be called before setLpDataWithoutRowAndColNames() has been called, since access to the indices of all the ranged constraints is required. This method must not be called before setLpDataRowAndColNames() has been called, since access to all the row names is required. */ void checkRowNames(); /** Check that current column names are distinct. If not, they are replaced by default column names (see setDefaultColNames()). This method must not be called before setLpDataRowAndColNames() has been called, since access to all the column names is required. */ void checkColNames(); }; void CoinLpIOUnitTest(const std::string& lpDir); #endif CoinMP-1.8.3/CoinUtils/src/CoinWarmStartBasis.cpp0000644000175000017500000005713311670766534020267 0ustar renerene/* $Id: CoinWarmStartBasis.cpp 1515 2011-12-10 23:38:04Z lou $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinUtilsConfig.h" #include #include "CoinWarmStartBasis.hpp" #include "CoinHelperFunctions.hpp" #include #include //############################################################################# void CoinWarmStartBasis::setSize(int ns, int na) { // Round all so arrays multiple of 4 int nintS = (ns+15) >> 4; int nintA = (na+15) >> 4; int size = nintS+nintA; if (size) { if (size>maxSize_) { delete[] structuralStatus_; maxSize_ = size+10; structuralStatus_ = new char[4*maxSize_]; } memset (structuralStatus_, 0, (4*nintS) * sizeof(char)); artificialStatus_ = structuralStatus_+4*nintS; memset (artificialStatus_, 0, (4*nintA) * sizeof(char)); } else { artificialStatus_ = NULL; } numArtificial_ = na; numStructural_ = ns; } void CoinWarmStartBasis::assignBasisStatus(int ns, int na, char*& sStat, char*& aStat) { // Round all so arrays multiple of 4 int nintS = (ns+15) >> 4; int nintA = (na+15) >> 4; int size = nintS+nintA; if (size) { if (size>maxSize_) { delete[] structuralStatus_; maxSize_ = size+10; structuralStatus_ = new char[4*maxSize_]; } CoinMemcpyN( sStat,(4*nintS), structuralStatus_); artificialStatus_ = structuralStatus_+4*nintS; CoinMemcpyN( aStat,(4*nintA), artificialStatus_); } else { artificialStatus_ = NULL; } numStructural_ = ns; numArtificial_ = na; delete [] sStat; delete [] aStat; sStat = NULL; aStat = NULL; } CoinWarmStartBasis::CoinWarmStartBasis(int ns, int na, const char* sStat, const char* aStat) : numStructural_(ns), numArtificial_(na), structuralStatus_(NULL), artificialStatus_(NULL) { // Round all so arrays multiple of 4 int nintS = ((ns+15) >> 4); int nintA = ((na+15) >> 4); maxSize_ = nintS+nintA; if (maxSize_ > 0) { structuralStatus_ = new char[4*maxSize_]; if (nintS>0) { structuralStatus_[4*nintS-3]=0; structuralStatus_[4*nintS-2]=0; structuralStatus_[4*nintS-1]=0; CoinMemcpyN( sStat,((ns+3)/4), structuralStatus_); } artificialStatus_ = structuralStatus_+4*nintS; if (nintA > 0) { artificialStatus_[4*nintA-3]=0; artificialStatus_[4*nintA-2]=0; artificialStatus_[4*nintA-1]=0; CoinMemcpyN( aStat,((na+3)/4), artificialStatus_); } } } CoinWarmStartBasis::CoinWarmStartBasis(const CoinWarmStartBasis& ws) : numStructural_(ws.numStructural_), numArtificial_(ws.numArtificial_), structuralStatus_(NULL), artificialStatus_(NULL) { // Round all so arrays multiple of 4 int nintS = (numStructural_+15) >> 4; int nintA = (numArtificial_+15) >> 4; maxSize_ = nintS+nintA; if (maxSize_ > 0) { structuralStatus_ = new char[4*maxSize_]; CoinMemcpyN( ws.structuralStatus_, (4*nintS), structuralStatus_); artificialStatus_ = structuralStatus_+4*nintS; CoinMemcpyN( ws.artificialStatus_, (4*nintA), artificialStatus_); } } CoinWarmStartBasis& CoinWarmStartBasis::operator=(const CoinWarmStartBasis& rhs) { if (this != &rhs) { numStructural_=rhs.numStructural_; numArtificial_=rhs.numArtificial_; // Round all so arrays multiple of 4 int nintS = (numStructural_+15) >> 4; int nintA = (numArtificial_+15) >> 4; int size = nintS+nintA; if (size>maxSize_) { delete[] structuralStatus_; maxSize_ = size+10; structuralStatus_ = new char[4*maxSize_]; } if (size > 0) { CoinMemcpyN( rhs.structuralStatus_, (4*nintS), structuralStatus_); artificialStatus_ = structuralStatus_+4*nintS; CoinMemcpyN( rhs.artificialStatus_, (4*nintA), artificialStatus_); } else { artificialStatus_ = NULL; } } return *this; } // Resizes void CoinWarmStartBasis::resize (int newNumberRows, int newNumberColumns) { int i , nCharNewS, nCharOldS, nCharNewA, nCharOldA; if (newNumberRows!=numArtificial_||newNumberColumns!=numStructural_) { nCharOldS = 4*((numStructural_+15)>>4); int nIntS = (newNumberColumns+15)>>4; nCharNewS = 4*nIntS; nCharOldA = 4*((numArtificial_+15)>>4); int nIntA = (newNumberRows+15)>>4; nCharNewA = 4*nIntA; int size = nIntS+nIntA; // Do slowly if number of columns increases or need new array if (newNumberColumns>numStructural_|| size>maxSize_) { if (size>maxSize_) maxSize_ = size+10; char * array = new char[4*maxSize_]; // zap all for clarity and zerofault etc memset(array,0,4*maxSize_*sizeof(char)); CoinMemcpyN(structuralStatus_,(nCharOldS>nCharNewS)?nCharNewS:nCharOldS,array); CoinMemcpyN(artificialStatus_, (nCharOldA>nCharNewA)?nCharNewA:nCharOldA, array+nCharNewS); delete [] structuralStatus_; structuralStatus_ = array; artificialStatus_ = array+nCharNewS; for (i=numStructural_;inCharNewA)?nCharNewA:nCharOldA); artificialStatus_ = structuralStatus_+4*nIntS; } for (i=numArtificial_;i= 0 && tgts[t] >= numArtificial_ ; t--) ; // temporary trap to make sure that scan from top is correct choice. // if ((t+1) < tgtCnt/2) // { printf("CWSB: tgtCnt %d, t %d; BAD CASE",tgtCnt,t+1) ; } if (t < 0) return ; tgtCnt = t+1 ; Status stati ; # ifdef COIN_DEBUG /* If we're debugging, scan to see if we're deleting nonbasic artificials. (In other words, are we deleting tight constraints?) Easiest to just do this up front as opposed to integrating it with the loops below. */ int nbCnt = 0 ; for (t = 0 ; t < tgtCnt ; t++) { i = tgts[t] ; stati = getStatus(artificialStatus_,i) ; if (stati != CoinWarmStartBasis::basic) { nbCnt++ ; } } if (nbCnt > 0) { std::cout << nbCnt << " nonbasic artificials deleted." << std::endl ; } # endif /* Preserve all entries before the first target. Skip across consecutive target indices to establish the start of the first block to be retained. */ keep = tgts[0] ; for (t = 0 ; t < tgtCnt-1 && tgts[t]+1 == tgts[t+1] ; t++) ; blkStart = tgts[t]+1 ; /* Outer loop works through the indices to be deleted. Inner loop copies runs of indices to keep. */ while (t < tgtCnt-1) { blkEnd = tgts[t+1]-1 ; for (i = blkStart ; i <= blkEnd ; i++) { stati = getStatus(artificialStatus_,i) ; setStatus(artificialStatus_,keep++,stati) ; } for (t++ ; t < tgtCnt-1 && tgts[t]+1 == tgts[t+1] ; t++) ; blkStart = tgts[t]+1 ; } /* Finish off by copying from last deleted index to end of status array. */ for (i = blkStart ; i < numArtificial_ ; i++) { stati = getStatus(artificialStatus_,i) ; setStatus(artificialStatus_,keep++,stati) ; } numArtificial_ -= tgtCnt ; return ; } /* deleteRows takes an unordered list of target indices with duplicates and removes them from the basis. The strategy is to preprocesses the list into an ascending list without duplicates, suitable for compressRows. */ void CoinWarmStartBasis::deleteRows (int rawTgtCnt, const int *rawTgts) { if (rawTgtCnt <= 0) return ; int i; int last=-1; bool ordered=true; for (i=0;ilast) { last=iRow; } else { ordered=false; break; } } if (ordered) { compressRows(rawTgtCnt,rawTgts) ; } else { int * tgts = new int[rawTgtCnt] ; CoinMemcpyN(rawTgts,rawTgtCnt,tgts); int *first = &tgts[0] ; int *last = &tgts[rawTgtCnt] ; int *endUnique ; std::sort(first,last) ; endUnique = std::unique(first,last) ; int tgtCnt = static_cast(endUnique-first) ; compressRows(tgtCnt,tgts) ; delete [] tgts ; } return ; } // Deletes columns void CoinWarmStartBasis::deleteColumns(int number, const int * which) { int i ; char * deleted = new char[numStructural_]; int numberDeleted=0; memset(deleted,0,numStructural_*sizeof(char)); for (i=0;i=0&&j>4); int nCharNewA = 4*((numArtificial_+15)>>4); char * array = new char[4*maxSize_]; # ifdef ZEROFAULT memset(array,0,(4*maxSize_*sizeof(char))) ; # endif CoinMemcpyN(artificialStatus_,nCharNewA,array+nCharNewS); int put=0; # ifdef COIN_DEBUG int numberBasic=0; # endif for (i=0;igetNumStructural() ; int srcRows = src->getNumArtificial() ; /* Merge the structural variable status. */ if (srcCols > 0 && xferCols != NULL) { XferVec::const_iterator xferSpec = xferCols->begin() ; XferVec::const_iterator xferEnd = xferCols->end() ; for ( ; xferSpec != xferEnd ; xferSpec++) { int srcNdx = (*xferSpec).first ; int tgtNdx = (*xferSpec).second ; int runLen = (*xferSpec).third ; assert(srcNdx >= 0 && srcNdx+runLen <= srcCols) ; assert(tgtNdx >= 0 && tgtNdx+runLen <= getNumStructural()) ; for (int i = 0 ; i < runLen ; i++) { CoinWarmStartBasis::Status stat = src->getStructStatus(srcNdx+i) ; setStructStatus(tgtNdx+i,stat) ; } } } /* Merge the row (artificial variable) status. */ if (srcRows > 0 && xferRows != NULL) { XferVec::const_iterator xferSpec = xferRows->begin() ; XferVec::const_iterator xferEnd = xferRows->end() ; for ( ; xferSpec != xferEnd ; xferSpec++) { int srcNdx = (*xferSpec).first ; int tgtNdx = (*xferSpec).second ; int runLen = (*xferSpec).third ; assert(srcNdx >= 0 && srcNdx+runLen <= srcRows) ; assert(tgtNdx >= 0 && tgtNdx+runLen <= getNumArtificial()) ; for (int i = 0 ; i < runLen ; i++) { CoinWarmStartBasis::Status stat = src->getArtifStatus(srcNdx+i) ; setArtifStatus(tgtNdx+i,stat) ; } } } return ; } // Prints in readable format (for debug) void CoinWarmStartBasis::print() const { int i ; int numberBasic=0; for (i=0;inumArtificial_) { for (i=0;i(oldCWS) ; #ifndef NDEBUG if (!oldBasis) { throw CoinError("Old basis not derived from CoinWarmStartBasis.", "generateDiff","CoinWarmStartBasis") ; } #endif const CoinWarmStartBasis *newBasis = this ; /* Make sure newBasis is equal or bigger than oldBasis. Calculate the worst case number of diffs and allocate vectors to hold them. */ const int oldArtifCnt = oldBasis->getNumArtificial() ; const int oldStructCnt = oldBasis->getNumStructural() ; const int newArtifCnt = newBasis->getNumArtificial() ; const int newStructCnt = newBasis->getNumStructural() ; assert(newArtifCnt >= oldArtifCnt) ; assert(newStructCnt >= oldStructCnt) ; int sizeOldArtif = (oldArtifCnt+15)>>4 ; int sizeNewArtif = (newArtifCnt+15)>>4 ; int sizeOldStruct = (oldStructCnt+15)>>4 ; int sizeNewStruct = (newStructCnt+15)>>4 ; int maxBasisLength = sizeNewArtif+sizeNewStruct ; unsigned int *diffNdx = new unsigned int [2*maxBasisLength]; unsigned int *diffVal = diffNdx + maxBasisLength; /* Ok, setup's over. Now scan the logicals (aka artificials, standing in for constraints). For the portion of the status arrays which overlap, create diffs. Then add any additional status from newBasis. I removed the following bit of code & comment: if (sizeNew == sizeOld) sizeOld--; // make sure all taken I assume this is meant to trap cases where oldBasis does not occupy all of the final int, but I can't see where it's necessary. */ const unsigned int *oldStatus = reinterpret_cast(oldBasis->getArtificialStatus()) ; const unsigned int *newStatus = reinterpret_cast(newBasis->getArtificialStatus()) ; int numberChanged = 0 ; int i ; for (i = 0 ; i < sizeOldArtif ; i++) { if (oldStatus[i] != newStatus[i]) { diffNdx[numberChanged] = i|0x80000000 ; diffVal[numberChanged++] = newStatus[i] ; } } for ( ; i < sizeNewArtif ; i++) { diffNdx[numberChanged] = i|0x80000000 ; diffVal[numberChanged++] = newStatus[i] ; } /* Repeat for structural variables. */ oldStatus = reinterpret_cast(oldBasis->getStructuralStatus()) ; newStatus = reinterpret_cast(newBasis->getStructuralStatus()) ; for (i = 0 ; i < sizeOldStruct ; i++) { if (oldStatus[i] != newStatus[i]) { diffNdx[numberChanged] = i ; diffVal[numberChanged++] = newStatus[i] ; } } for ( ; i < sizeNewStruct ; i++) { diffNdx[numberChanged] = i ; diffVal[numberChanged++] = newStatus[i] ; } /* Create the object of our desire. */ CoinWarmStartBasisDiff *diff; if ((numberChanged*2(diff)) ; } /* Apply a diff to the basis pointed to by this. It's assumed that the allocated capacity of the basis is sufficiently large. */ void CoinWarmStartBasis::applyDiff (const CoinWarmStartDiff *const cwsdDiff) { /* Make sure we have a CoinWarmStartBasisDiff */ const CoinWarmStartBasisDiff *diff = dynamic_cast(cwsdDiff) ; #ifndef NDEBUG if (!diff) { throw CoinError("Diff not derived from CoinWarmStartBasisDiff.", "applyDiff","CoinWarmStartBasis") ; } #endif /* Application is by straighforward replacement of words in the status arrays. Index entries for logicals (aka artificials) are tagged with 0x80000000. */ const int numberChanges = diff->sze_ ; unsigned int *structStatus = reinterpret_cast(this->getStructuralStatus()) ; unsigned int *artifStatus = reinterpret_cast(this->getArtificialStatus()) ; if (numberChanges>=0) { const unsigned int *diffNdxs = diff->difference_ ; const unsigned int *diffVals = diffNdxs+numberChanges ; for (int i = 0 ; i < numberChanges ; i++) { unsigned int diffNdx = diffNdxs[i] ; unsigned int diffVal = diffVals[i] ; if ((diffNdx&0x80000000) == 0) { structStatus[diffNdx] = diffVal ; } else { artifStatus[diffNdx&0x7fffffff] = diffVal ; } } } else { // just replace const unsigned int * diffA = diff->difference_ -1; const int artifCnt = static_cast (diffA[0]); const int structCnt = -numberChanges; int sizeArtif = (artifCnt+15)>>4 ; int sizeStruct = (structCnt+15)>>4 ; CoinMemcpyN(diffA+1,sizeStruct,structStatus); CoinMemcpyN(diffA+1+sizeStruct,sizeArtif,artifStatus); } return ; } const char *statusName (CoinWarmStartBasis::Status status) { switch (status) { case CoinWarmStartBasis::isFree: { return ("NBFR") ; } case CoinWarmStartBasis::basic: { return ("B") ; } case CoinWarmStartBasis::atUpperBound: { return ("NBUB") ; } case CoinWarmStartBasis::atLowerBound: { return ("NBLB") ; } default: { return ("INVALID!") ; } } } /* Routines for CoinWarmStartBasisDiff */ /* Constructor given diff data. */ CoinWarmStartBasisDiff::CoinWarmStartBasisDiff (int sze, const unsigned int *const diffNdxs, const unsigned int *const diffVals) : sze_(sze), difference_(NULL) { if (sze > 0) { difference_ = new unsigned int[2*sze] ; CoinMemcpyN(diffNdxs,sze,difference_); CoinMemcpyN(diffVals,sze,difference_+sze_); } return ; } /* Constructor when full is smaller than diff! */ CoinWarmStartBasisDiff::CoinWarmStartBasisDiff (const CoinWarmStartBasis * rhs) : sze_(0), difference_(0) { const int artifCnt = rhs->getNumArtificial() ; const int structCnt = rhs->getNumStructural() ; int sizeArtif = (artifCnt+15)>>4 ; int sizeStruct = (structCnt+15)>>4 ; int maxBasisLength = sizeArtif+sizeStruct ; assert (maxBasisLength&&structCnt); sze_ = - structCnt; difference_ = new unsigned int [maxBasisLength+1]; difference_[0]=artifCnt; difference_++; CoinMemcpyN(reinterpret_cast (rhs->getStructuralStatus()),sizeStruct, difference_); CoinMemcpyN(reinterpret_cast (rhs->getArtificialStatus()),sizeArtif, difference_+sizeStruct); } /* Copy constructor. */ CoinWarmStartBasisDiff::CoinWarmStartBasisDiff (const CoinWarmStartBasisDiff &rhs) : sze_(rhs.sze_), difference_(0) { if (sze_ >0) { difference_ = CoinCopyOfArray(rhs.difference_,2*sze_); } else if (sze_<0) { const unsigned int * diff = rhs.difference_ -1; const int artifCnt = static_cast (diff[0]); const int structCnt = -sze_; int sizeArtif = (artifCnt+15)>>4 ; int sizeStruct = (structCnt+15)>>4 ; int maxBasisLength = sizeArtif+sizeStruct ; difference_ = CoinCopyOfArray(diff,maxBasisLength+1); difference_++; } return ; } /* Assignment --- for convenience when assigning objects containing CoinWarmStartBasisDiff objects. */ CoinWarmStartBasisDiff& CoinWarmStartBasisDiff::operator= (const CoinWarmStartBasisDiff &rhs) { if (this != &rhs) { if (sze_>0 ) { delete[] difference_ ; } else if (sze_<0) { unsigned int * diff = difference_ -1; delete [] diff; } sze_ = rhs.sze_ ; if (sze_ > 0) { difference_ = CoinCopyOfArray(rhs.difference_,2*sze_); } else if (sze_<0) { const unsigned int * diff = rhs.difference_ -1; const int artifCnt = static_cast (diff[0]); const int structCnt = -sze_; int sizeArtif = (artifCnt+15)>>4 ; int sizeStruct = (structCnt+15)>>4 ; int maxBasisLength = sizeArtif+sizeStruct ; difference_ = CoinCopyOfArray(diff,maxBasisLength+1); difference_++; } else { difference_ = 0 ; } } return (*this) ; } /*brief Destructor */ CoinWarmStartBasisDiff::~CoinWarmStartBasisDiff() { if (sze_>0 ) { delete[] difference_ ; } else if (sze_<0) { unsigned int * diff = difference_ -1; delete [] diff; } } CoinMP-1.8.3/CoinUtils/src/CoinSort.hpp0000644000175000017500000004721512134252634016300 0ustar renerene/* $Id: CoinSort.hpp 1594 2013-04-19 14:33:00Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinSort_H #define CoinSort_H #include #include #include #include "CoinDistance.hpp" // Uncomment the next three lines to get thorough initialisation of memory. // #ifndef ZEROFAULT // #define ZEROFAULT // #endif #ifdef COIN_FAST_CODE #ifndef COIN_USE_EKK_SORT #define COIN_USE_EKK_SORT #endif #endif //############################################################################# /** An ordered pair. It's the same as std::pair, just this way it'll have the same look as the triple sorting. */ template struct CoinPair { public: /// First member of pair S first; /// Second member of pair T second; public: /// Construct from ordered pair CoinPair(const S& s, const T& t) : first(s), second(t) {} }; //############################################################################# /**@name Comparisons on first element of two ordered pairs */ //@{ /** Function operator. Returns true if t1.first < t2.first (i.e., increasing). */ template < class S, class T> class CoinFirstLess_2 { public: /// Compare function inline bool operator()(const CoinPair& t1, const CoinPair& t2) const { return t1.first < t2.first; } }; //----------------------------------------------------------------------------- /** Function operator. Returns true if t1.first > t2.first (i.e, decreasing). */ template < class S, class T> class CoinFirstGreater_2 { public: /// Compare function inline bool operator()(const CoinPair& t1, const CoinPair& t2) const { return t1.first > t2.first; } }; //----------------------------------------------------------------------------- /** Function operator. Returns true if abs(t1.first) < abs(t2.first) (i.e., increasing). */ template < class S, class T> class CoinFirstAbsLess_2 { public: /// Compare function inline bool operator()(const CoinPair& t1, const CoinPair& t2) const { const T t1Abs = t1.first < static_cast(0) ? -t1.first : t1.first; const T t2Abs = t2.first < static_cast(0) ? -t2.first : t2.first; return t1Abs < t2Abs; } }; //----------------------------------------------------------------------------- /** Function operator. Returns true if abs(t1.first) > abs(t2.first) (i.e., decreasing). */ template < class S, class T> class CoinFirstAbsGreater_2 { public: /// Compare function inline bool operator()(CoinPair t1, CoinPair t2) const { const T t1Abs = t1.first < static_cast(0) ? -t1.first : t1.first; const T t2Abs = t2.first < static_cast(0) ? -t2.first : t2.first; return t1Abs > t2Abs; } }; //----------------------------------------------------------------------------- /** Function operator. Compare based on the entries of an external vector, i.e., returns true if vec[t1.first < vec[t2.first] (i.e., increasing wrt. vec). Note that to use this comparison operator .first must be a data type automatically convertible to int. */ template < class S, class T, class V> class CoinExternalVectorFirstLess_2 { private: CoinExternalVectorFirstLess_2(); private: const V* vec_; public: inline bool operator()(const CoinPair& t1, const CoinPair& t2) const { return vec_[t1.first] < vec_[t2.first]; } CoinExternalVectorFirstLess_2(const V* v) : vec_(v) {} }; //----------------------------------------------------------------------------- /** Function operator. Compare based on the entries of an external vector, i.e., returns true if vec[t1.first > vec[t2.first] (i.e., decreasing wrt. vec). Note that to use this comparison operator .first must be a data type automatically convertible to int. */ template < class S, class T, class V> class CoinExternalVectorFirstGreater_2 { private: CoinExternalVectorFirstGreater_2(); private: const V* vec_; public: inline bool operator()(const CoinPair& t1, const CoinPair& t2) const { return vec_[t1.first] > vec_[t2.first]; } CoinExternalVectorFirstGreater_2(const V* v) : vec_(v) {} }; //@} //############################################################################# /** Sort a pair of containers.
    Iter_S - iterator for first container
    Iter_T - iterator for 2nd container
    CoinCompare2 - class comparing CoinPairs
    */ #ifdef COIN_SORT_ARBITRARY_CONTAINERS template void CoinSort_2(Iter_S sfirst, Iter_S slast, Iter_T tfirst, const CoinCompare2& pc) { typedef typename std::iterator_traits::value_type S; typedef typename std::iterator_traits::value_type T; const size_t len = coinDistance(sfirst, slast); if (len <= 1) return; typedef CoinPair ST_pair; ST_pair* x = static_cast(::operator new(len * sizeof(ST_pair))); # ifdef ZEROFAULT memset(x,0,(len*sizeof(ST_pair))) ; # endif int i = 0; Iter_S scurrent = sfirst; Iter_T tcurrent = tfirst; while (scurrent != slast) { new (x+i++) ST_pair(*scurrent++, *tcurrent++); } std::sort(x.begin(), x.end(), pc); scurrent = sfirst; tcurrent = tfirst; for (i = 0; i < len; ++i) { *scurrent++ = x[i].first; *tcurrent++ = x[i].second; } ::operator delete(x); } //----------------------------------------------------------------------------- template void CoinSort_2(Iter_S sfirst, Iter_S slast, Iter_T tfirst) { typedef typename std::iterator_traits::value_type S; typedef typename std::iterator_traits::value_type T; CoinSort_2(sfirst, slast, tfirst, CoinFirstLess_2()); } #else //======================================================================= template void CoinSort_2(S* sfirst, S* slast, T* tfirst, const CoinCompare2& pc) { const size_t len = coinDistance(sfirst, slast); if (len <= 1) return; typedef CoinPair ST_pair; ST_pair* x = static_cast(::operator new(len * sizeof(ST_pair))); # ifdef ZEROFAULT // Can show RUI errors on some systems due to copy of ST_pair with gaps. // E.g., has 4 byte alignment gap on Solaris/SUNWspro. memset(x,0,(len*sizeof(ST_pair))) ; # endif size_t i = 0; S* scurrent = sfirst; T* tcurrent = tfirst; while (scurrent != slast) { new (x+i++) ST_pair(*scurrent++, *tcurrent++); } std::sort(x, x + len, pc); scurrent = sfirst; tcurrent = tfirst; for (i = 0; i < len; ++i) { *scurrent++ = x[i].first; *tcurrent++ = x[i].second; } ::operator delete(x); } template void // This Always uses std::sort CoinSort_2Std(S* sfirst, S* slast, T* tfirst) { CoinSort_2(sfirst, slast, tfirst, CoinFirstLess_2()); } #ifndef COIN_USE_EKK_SORT //----------------------------------------------------------------------------- template void CoinSort_2(S* sfirst, S* slast, T* tfirst) { CoinSort_2(sfirst, slast, tfirst, CoinFirstLess_2()); } #else //----------------------------------------------------------------------------- extern int boundary_sort; extern int boundary_sort2; extern int boundary_sort3; /// Sort without new and delete template void CoinSort_2(S* key, S* lastKey, T* array2) { const size_t number = coinDistance(key, lastKey); if (number <= 1) { return; } else if (number>10000) { CoinSort_2Std(key, lastKey, array2); return; } #if 0 if (number==boundary_sort3) { printf("before sort %d entries\n",number); for (int j=0;j(number); int sp; S *v = key; S *m, t; S * ls[32] , * rs[32]; S *l , *r , c; T it; int j; /*check already sorted */ S last=key[0]; for (j=1;j=last) { last=key[j]; } else { break; } /* endif */ } /* endfor */ if (j==n) { return; } /* endif */ sp = 0 ; ls[sp] = v ; rs[sp] = v + (n-1) ; while( sp >= 0 ) { if ( rs[sp] - ls[sp] > minsize ) { l = ls[sp] ; r = rs[sp] ; m = l + (r-l)/2 ; if ( *l > *m ) { t = *l ; *l = *m ; *m = t ; it = array2[l-v] ; array2[l-v] = array2[m-v] ; array2[m-v] = it ; } if ( *m > *r ) { t = *m ; *m = *r ; *r = t ; it = array2[m-v] ; array2[m-v] = array2[r-v] ; array2[r-v] = it ; if ( *l > *m ) { t = *l ; *l = *m ; *m = t ; it = array2[l-v] ; array2[l-v] = array2[m-v] ; array2[m-v] = it ; } } c = *m ; while ( r - l > 1 ) { while ( *(++l) < c ) ; while ( *(--r) > c ) ; t = *l ; *l = *r ; *r = t ; it = array2[l-v] ; array2[l-v] = array2[r-v] ; array2[r-v] = it ; } l = r - 1 ; if ( l < m ) { ls[sp+1] = ls[sp] ; rs[sp+1] = l ; ls[sp ] = r ; } else { ls[sp+1] = r ; rs[sp+1] = rs[sp] ; rs[sp ] = l ; } sp++ ; } else sp-- ; } for ( l = v , m = v + (n-1) ; l < m ; l++ ) { if ( *l > *(l+1) ) { c = *(l+1) ; it = array2[(l-v)+1] ; for ( r = l ; r >= v && *r > c ; r-- ) { *(r+1) = *r ; array2[(r-v)+1] = array2[(r-v)] ; } *(r+1) = c ; array2[(r-v)+1] = it ; } } #if 0 if (number==boundary_sort3) { printf("after sort %d entries\n",number); for (int j=0;j void CoinShortSort_2(S* key, S* lastKey, T* array2) { const size_t number = coinDistance(key, lastKey); if (number <= 2) { if (number == 2 && key[0] > key[1]) { S tempS = key[0]; T tempT = array2[0]; key[0] = key[1]; array2[0] = array2[1]; key[1] = tempS; array2[1] = tempT; } return; } else if (number>10000) { CoinSort_2Std(key, lastKey, array2); return; } int minsize=10; size_t n = number; int sp; S *v = key; S *m, t; S * ls[32] , * rs[32]; S *l , *r , c; T it; size_t j; /*check already sorted */ S last=key[0]; for (j=1;j=last) { last=key[j]; } else { break; } /* endif */ } /* endfor */ if (j==n) { return; } /* endif */ sp = 0 ; ls[sp] = v ; rs[sp] = v + (n-1) ; while( sp >= 0 ) { if ( rs[sp] - ls[sp] > minsize ) { l = ls[sp] ; r = rs[sp] ; m = l + (r-l)/2 ; if ( *l > *m ) { t = *l ; *l = *m ; *m = t ; it = array2[l-v] ; array2[l-v] = array2[m-v] ; array2[m-v] = it ; } if ( *m > *r ) { t = *m ; *m = *r ; *r = t ; it = array2[m-v] ; array2[m-v] = array2[r-v] ; array2[r-v] = it ; if ( *l > *m ) { t = *l ; *l = *m ; *m = t ; it = array2[l-v] ; array2[l-v] = array2[m-v] ; array2[m-v] = it ; } } c = *m ; while ( r - l > 1 ) { while ( *(++l) < c ) ; while ( *(--r) > c ) ; t = *l ; *l = *r ; *r = t ; it = array2[l-v] ; array2[l-v] = array2[r-v] ; array2[r-v] = it ; } l = r - 1 ; if ( l < m ) { ls[sp+1] = ls[sp] ; rs[sp+1] = l ; ls[sp ] = r ; } else { ls[sp+1] = r ; rs[sp+1] = rs[sp] ; rs[sp ] = l ; } sp++ ; } else sp-- ; } for ( l = v , m = v + (n-1) ; l < m ; l++ ) { if ( *l > *(l+1) ) { c = *(l+1) ; it = array2[(l-v)+1] ; for ( r = l ; r >= v && *r > c ; r-- ) { *(r+1) = *r ; array2[(r-v)+1] = array2[(r-v)] ; } *(r+1) = c ; array2[(r-v)+1] = it ; } } } //############################################################################# //############################################################################# /**@name Ordered Triple Struct */ template class CoinTriple { public: /// First member of triple S first; /// Second member of triple T second; /// Third member of triple U third; public: /// Construct from ordered triple CoinTriple(const S& s, const T& t, const U& u):first(s),second(t),third(u) {} }; //############################################################################# /**@name Comparisons on first element of two ordered triples */ //@{ /** Function operator. Returns true if t1.first < t2.first (i.e., increasing). */ template < class S, class T, class U > class CoinFirstLess_3 { public: /// Compare function inline bool operator()(const CoinTriple& t1, const CoinTriple& t2) const { return t1.first < t2.first; } }; //----------------------------------------------------------------------------- /** Function operator. Returns true if t1.first > t2.first (i.e, decreasing). */ template < class S, class T, class U > class CoinFirstGreater_3 { public: /// Compare function inline bool operator()(const CoinTriple& t1, const CoinTriple& t2) const { return t1.first>t2.first; } }; //----------------------------------------------------------------------------- /** Function operator. Returns true if abs(t1.first) < abs(t2.first) (i.e., increasing). */ template < class S, class T, class U > class CoinFirstAbsLess_3 { public: /// Compare function inline bool operator()(const CoinTriple& t1, const CoinTriple& t2) const { const T t1Abs = t1.first < static_cast(0) ? -t1.first : t1.first; const T t2Abs = t2.first < static_cast(0) ? -t2.first : t2.first; return t1Abs < t2Abs; } }; //----------------------------------------------------------------------------- /** Function operator. Returns true if abs(t1.first) > abs(t2.first) (i.e., decreasing). */ template < class S, class T, class U > class CoinFirstAbsGreater_3 { public: /// Compare function inline bool operator()(const CoinTriple& t1, const CoinTriple& t2) const { const T t1Abs = t1.first < static_cast(0) ? -t1.first : t1.first; const T t2Abs = t2.first < static_cast(0) ? -t2.first : t2.first; return t1Abs > t2Abs; } }; //----------------------------------------------------------------------------- /** Function operator. Compare based on the entries of an external vector, i.e., returns true if vec[t1.first < vec[t2.first] (i.e., increasing wrt. vec). Note that to use this comparison operator .first must be a data type automatically convertible to int. */ template < class S, class T, class U, class V> class CoinExternalVectorFirstLess_3 { private: CoinExternalVectorFirstLess_3(); private: const V* vec_; public: inline bool operator()(const CoinTriple& t1, const CoinTriple& t2) const { return vec_[t1.first] < vec_[t2.first]; } CoinExternalVectorFirstLess_3(const V* v) : vec_(v) {} }; //----------------------------------------------------------------------------- /** Function operator. Compare based on the entries of an external vector, i.e., returns true if vec[t1.first > vec[t2.first] (i.e., decreasing wrt. vec). Note that to use this comparison operator .first must be a data type automatically convertible to int. */ template < class S, class T, class U, class V> class CoinExternalVectorFirstGreater_3 { private: CoinExternalVectorFirstGreater_3(); private: const V* vec_; public: inline bool operator()(const CoinTriple& t1, const CoinTriple& t2) const { return vec_[t1.first] > vec_[t2.first]; } CoinExternalVectorFirstGreater_3(const V* v) : vec_(v) {} }; //@} //############################################################################# /**@name Typedefs for sorting the entries of a packed vector based on an external vector. */ //@{ /// Sort packed vector in increasing order of the external vector typedef CoinExternalVectorFirstLess_3 CoinIncrSolutionOrdered; /// Sort packed vector in decreasing order of the external vector typedef CoinExternalVectorFirstGreater_3 CoinDecrSolutionOrdered; //@} //############################################################################# /** Sort a triple of containers.
    Iter_S - iterator for first container
    Iter_T - iterator for 2nd container
    Iter_U - iterator for 3rd container
    CoinCompare3 - class comparing CoinTriples
    */ #ifdef COIN_SORT_ARBITRARY_CONTAINERS template void CoinSort_3(Iter_S sfirst, Iter_S slast, Iter_T tfirst, Iter_U, ufirst, const CoinCompare3& tc) { typedef typename std::iterator_traits::value_type S; typedef typename std::iterator_traits::value_type T; typedef typename std::iterator_traits::value_type U; const size_t len = coinDistance(sfirst, slast); if (len <= 1) return; typedef CoinTriple STU_triple; STU_triple* x = static_cast(::operator new(len * sizeof(STU_triple))); int i = 0; Iter_S scurrent = sfirst; Iter_T tcurrent = tfirst; Iter_U ucurrent = ufirst; while (scurrent != slast) { new (x+i++) STU_triple(*scurrent++, *tcurrent++, *ucurrent++); } std::sort(x, x+len, tc); scurrent = sfirst; tcurrent = tfirst; ucurrent = ufirst; for (i = 0; i < len; ++i) { *scurrent++ = x[i].first; *tcurrent++ = x[i].second; *ucurrent++ = x[i].third; } ::operator delete(x); } //----------------------------------------------------------------------------- template void CoinSort_3(Iter_S sfirst, Iter_S slast, Iter_T tfirst, Iter_U, ufirst) { typedef typename std::iterator_traits::value_type S; typedef typename std::iterator_traits::value_type T; typedef typename std::iterator_traits::value_type U; CoinSort_3(sfirts, slast, tfirst, ufirst, CoinFirstLess_3()); } #else //======================================================================= template void CoinSort_3(S* sfirst, S* slast, T* tfirst, U* ufirst, const CoinCompare3& tc) { const size_t len = coinDistance(sfirst,slast); if (len <= 1) return; typedef CoinTriple STU_triple; STU_triple* x = static_cast(::operator new(len * sizeof(STU_triple))); size_t i = 0; S* scurrent = sfirst; T* tcurrent = tfirst; U* ucurrent = ufirst; while (scurrent != slast) { new (x+i++) STU_triple(*scurrent++, *tcurrent++, *ucurrent++); } std::sort(x, x+len, tc); scurrent = sfirst; tcurrent = tfirst; ucurrent = ufirst; for (i = 0; i < len; ++i) { *scurrent++ = x[i].first; *tcurrent++ = x[i].second; *ucurrent++ = x[i].third; } ::operator delete(x); } //----------------------------------------------------------------------------- template void CoinSort_3(S* sfirst, S* slast, T* tfirst, U* ufirst) { CoinSort_3(sfirst, slast, tfirst, ufirst, CoinFirstLess_3()); } #endif //############################################################################# #endif CoinMP-1.8.3/CoinUtils/src/CoinPrePostsolveMatrix.cpp0000644000175000017500000003146311670766767021221 0ustar renerene/* $Id: CoinPrePostsolveMatrix.cpp 1516 2011-12-10 23:40:39Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" #ifndef SLIM_CLP #include "CoinWarmStartBasis.hpp" #endif /*! \file This file contains methods for CoinPrePostsolveMatrix, the foundation class for CoinPresolveMatrix and CoinPostsolveMatrix. */ /* Constructor and destructor for CoinPrePostsolveMatrix. */ /* CoinPrePostsolveMatrix constructor This constructor does next to nothing, because there's no sensible middle ground between next to nothing and a constructor with twenty parameters that all need to be extracted from the constraint system held by an OSI. The alternative, creating a constructor which takes some flavour of OSI as a parameter, seems to me (lh) to be wrong. That knowledge does not belong in the generic COIN support library. The philosophy here is to create an empty CoinPrePostsolveMatrix object and then load in the constraint matrix, vectors, and miscellaneous parameters. Some of this will be done from CoinPresolveMatrix or CoinPostsolveMatrix constructors, but in the end most of it should be pushed back to an OSI-specific method. Then the knowledge of how to access the required data in an OSI is pushed back to the individual OSI classes where it belongs. Thus, all vector allocation is postponed until load time. */ CoinPrePostsolveMatrix::CoinPrePostsolveMatrix (int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc) : ncols_(0), nrows_(0), nelems_(0), ncols0_(ncols_alloc), nrows0_(nrows_alloc), nelems0_(nelems_alloc), bulkRatio_(2.0), mcstrt_(0), hincol_(0), hrow_(0), colels_(0), cost_(0), originalOffset_(0), clo_(0), cup_(0), rlo_(0), rup_(0), originalColumn_(0), originalRow_(0), ztolzb_(0.0), ztoldj_(0.0), maxmin_(0), sol_(0), rowduals_(0), acts_(0), rcosts_(0), colstat_(0), rowstat_(0), handler_(0), defaultHandler_(false), messages_() { handler_ = new CoinMessageHandler() ; defaultHandler_ = true ; bulk0_ = static_cast (bulkRatio_*nelems_alloc); return ; } /* CoinPrePostsolveMatrix destructor */ CoinPrePostsolveMatrix::~CoinPrePostsolveMatrix() { delete[] sol_ ; delete[] rowduals_ ; delete[] acts_ ; delete[] rcosts_ ; /* Note that we do NOT delete rowstat_. This is to maintain compatibility with ClpPresolve and OsiPresolve, which allocate a single vector and split it between column and row status. */ delete[] colstat_ ; delete[] cost_ ; delete[] clo_ ; delete[] cup_ ; delete[] rlo_ ; delete[] rup_ ; delete[] mcstrt_ ; delete[] hrow_ ; delete[] colels_ ; delete[] hincol_ ; delete[] originalColumn_ ; delete[] originalRow_ ; if (defaultHandler_ == true) delete handler_ ; } #ifndef SLIM_CLP /* Methods to set the miscellaneous parameters: max/min, objective offset, and tolerances. */ void CoinPrePostsolveMatrix::setObjOffset (double offset) { originalOffset_ = offset ; } void CoinPrePostsolveMatrix::setObjSense (double objSense) { maxmin_ = objSense ; } void CoinPrePostsolveMatrix::setPrimalTolerance (double primTol) { ztolzb_ = primTol ; } void CoinPrePostsolveMatrix::setDualTolerance (double dualTol) { ztoldj_ = dualTol ; } /* Methods to set the various vectors. For all methods, lenParam can be omitted and will default to -1. In that case, the default action is to copy ncols_ or nrows_ entries, as appropriate. It is *not* considered an error to specify lenParam = 0! This allows for allocation of vectors in an intially empty system. Note that ncols_ and nrows_ will be 0 before a constraint system is loaded. Be careful what you ask for. The vector allocated in the CoinPrePostsolveMatrix will be of size ncols0_ or nrows0_, as appropriate. */ void CoinPrePostsolveMatrix::setColLower (const double *colLower, int lenParam) { int len ; if (lenParam < 0) { len = ncols_ ; } else if (lenParam > ncols0_) { throw CoinError("length exceeds allocated size", "setColLower","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (clo_ == 0) clo_ = new double[ncols0_] ; CoinMemcpyN(colLower,len,clo_) ; return ; } void CoinPrePostsolveMatrix::setColUpper (const double *colUpper, int lenParam) { int len ; if (lenParam < 0) { len = ncols_ ; } else if (lenParam > ncols0_) { throw CoinError("length exceeds allocated size", "setColUpper","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (cup_ == 0) cup_ = new double[ncols0_] ; CoinMemcpyN(colUpper,len,cup_) ; return ; } void CoinPrePostsolveMatrix::setColSolution (const double *colSol, int lenParam) { int len ; if (lenParam < 0) { len = ncols_ ; } else if (lenParam > ncols0_) { throw CoinError("length exceeds allocated size", "setColSolution","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (sol_ == 0) sol_ = new double[ncols0_] ; CoinMemcpyN(colSol,len,sol_) ; return ; } void CoinPrePostsolveMatrix::setCost (const double *cost, int lenParam) { int len ; if (lenParam < 0) { len = ncols_ ; } else if (lenParam > ncols0_) { throw CoinError("length exceeds allocated size", "setCost","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (cost_ == 0) cost_ = new double[ncols0_] ; CoinMemcpyN(cost,len,cost_) ; return ; } void CoinPrePostsolveMatrix::setReducedCost (const double *redCost, int lenParam) { int len ; if (lenParam < 0) { len = ncols_ ; } else if (lenParam > ncols0_) { throw CoinError("length exceeds allocated size", "setReducedCost","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (rcosts_ == 0) rcosts_ = new double[ncols0_] ; CoinMemcpyN(redCost,len,rcosts_) ; return ; } void CoinPrePostsolveMatrix::setRowLower (const double *rowLower, int lenParam) { int len ; if (lenParam < 0) { len = nrows_ ; } else if (lenParam > nrows0_) { throw CoinError("length exceeds allocated size", "setRowLower","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (rlo_ == 0) rlo_ = new double[nrows0_] ; CoinMemcpyN(rowLower,len,rlo_) ; return ; } void CoinPrePostsolveMatrix::setRowUpper (const double *rowUpper, int lenParam) { int len ; if (lenParam < 0) { len = nrows_ ; } else if (lenParam > nrows0_) { throw CoinError("length exceeds allocated size", "setRowUpper","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (rup_ == 0) rup_ = new double[nrows0_] ; CoinMemcpyN(rowUpper,len,rup_) ; return ; } void CoinPrePostsolveMatrix::setRowPrice (const double *rowSol, int lenParam) { int len ; if (lenParam < 0) { len = nrows_ ; } else if (lenParam > nrows0_) { throw CoinError("length exceeds allocated size", "setRowPrice","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (rowduals_ == 0) rowduals_ = new double[nrows0_] ; CoinMemcpyN(rowSol,len,rowduals_) ; return ; } void CoinPrePostsolveMatrix::setRowActivity (const double *rowAct, int lenParam) { int len ; if (lenParam < 0) { len = nrows_ ; } else if (lenParam > nrows0_) { throw CoinError("length exceeds allocated size", "setRowActivity","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (acts_ == 0) acts_ = new double[nrows0_] ; CoinMemcpyN(rowAct,len,acts_) ; return ; } /* Methods to set the status vectors for a basis. Note that we need to allocate colstat_ and rowstat_ as a single vector, to maintain compatibility with OsiPresolve and ClpPresolve. The `using ::getStatus' declaration is required to get the compiler to consider the getStatus helper function defined in CoinWarmStartBasis.hpp. */ void CoinPrePostsolveMatrix::setStructuralStatus (const char *strucStatus, int lenParam) { int len ; using ::getStatus ; if (lenParam < 0) { len = ncols_ ; } else if (lenParam > ncols0_) { throw CoinError("length exceeds allocated size", "setStructuralStatus","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (colstat_ == 0) { colstat_ = new unsigned char[ncols0_+nrows0_] ; # ifdef ZEROFAULT CoinZeroN(colstat_,ncols0_+nrows0_) ; # endif rowstat_ = colstat_+ncols0_ ; } for (int j = 0 ; j < len ; j++) { Status statj = Status(getStatus(strucStatus,j)) ; setColumnStatus(j,statj) ; } return ; } void CoinPrePostsolveMatrix::setArtificialStatus (const char *artifStatus, int lenParam) { int len ; using ::getStatus ; if (lenParam < 0) { len = nrows_ ; } else if (lenParam > nrows0_) { throw CoinError("length exceeds allocated size", "setArtificialStatus","CoinPrePostsolveMatrix") ; } else { len = lenParam ; } if (colstat_ == 0) { colstat_ = new unsigned char[ncols0_+nrows0_] ; # ifdef ZEROFAULT CoinZeroN(colstat_,ncols0_+nrows0_) ; # endif rowstat_ = colstat_+ncols0_ ; } for (int i = 0 ; i < len ; i++) { Status stati = Status(getStatus(artifStatus,i)) ; setRowStatus(i,stati) ; } return ; } /* This routine initialises structural and artificial status given a CoinWarmStartBasis as the parameter. */ void CoinPrePostsolveMatrix::setStatus (const CoinWarmStartBasis *basis) { setStructuralStatus(basis->getStructuralStatus(), basis->getNumStructural()) ; setArtificialStatus(basis->getArtificialStatus(), basis->getNumArtificial()) ; return ; } /* This routine returns structural and artificial status in the form of a CoinWarmStartBasis object. What to do when CoinPrePostsolveMatrix::Status == superBasic? There's no analog in CoinWarmStartBasis::Status. */ CoinWarmStartBasis *CoinPrePostsolveMatrix::getStatus () { int n = ncols_ ; int m = nrows_ ; CoinWarmStartBasis *wsb = new CoinWarmStartBasis() ; wsb->setSize(n,m) ; for (int j = 0 ; j < n ; j++) { CoinWarmStartBasis::Status statj = CoinWarmStartBasis::Status(getColumnStatus(j)) ; wsb->setStructStatus(j,statj) ; } for (int i = 0 ; i < m ; i++) { CoinWarmStartBasis::Status stati = CoinWarmStartBasis::Status(getRowStatus(i)) ; wsb->setArtifStatus(i,stati) ; } return (wsb) ; } #endif /* Set the status of a non-basic artificial variable based on the variable's value and bounds. */ void CoinPrePostsolveMatrix::setRowStatusUsingValue (int iRow) { double value = acts_[iRow] ; double lower = rlo_[iRow] ; double upper = rup_[iRow] ; if (lower < -1.0e20 && upper > 1.0e20) { setRowStatus(iRow,isFree) ; } else if (fabs(lower-value) <= ztolzb_) { setRowStatus(iRow,atUpperBound) ; } else if (fabs(upper-value) <= ztolzb_) { setRowStatus(iRow,atLowerBound) ; } else { setRowStatus(iRow,superBasic) ; } } /* Set the status of a non-basic structural variable based on the variable's value and bounds. */ void CoinPrePostsolveMatrix::setColumnStatusUsingValue(int iColumn) { double value = sol_[iColumn]; double lower = clo_[iColumn]; double upper = cup_[iColumn]; if (lower<-1.0e20&&upper>1.0e20) { setColumnStatus(iColumn,isFree); } else if (fabs(lower-value)<=ztolzb_) { setColumnStatus(iColumn,atLowerBound); } else if (fabs(upper-value)<=ztolzb_) { setColumnStatus(iColumn,atUpperBound); } else { setColumnStatus(iColumn,superBasic); } } #ifndef SLIM_CLP /* Simple routines to return a constant character string for the status value. Separate row and column routines for convenience, and one that just takes the status code. */ const char *CoinPrePostsolveMatrix::columnStatusString (int j) const { Status statj = getColumnStatus(j) ; switch (statj) { case isFree: { return ("NBFR") ; } case basic: { return ("B") ; } case atUpperBound: { return ("NBUB") ; } case atLowerBound: { return ("NBLB") ; } case superBasic: { return ("SB") ; } default: { return ("INVALID!") ; } } } const char *CoinPrePostsolveMatrix::rowStatusString (int j) const { Status statj = getRowStatus(j) ; switch (statj) { case isFree: { return ("NBFR") ; } case basic: { return ("B") ; } case atUpperBound: { return ("NBUB") ; } case atLowerBound: { return ("NBLB") ; } case superBasic: { return ("SB") ; } default: { return ("INVALID!") ; } } } const char *statusName (CoinPrePostsolveMatrix::Status status) { switch (status) { case CoinPrePostsolveMatrix::isFree: { return ("NBFR") ; } case CoinPrePostsolveMatrix::basic: { return ("B") ; } case CoinPrePostsolveMatrix::atUpperBound: { return ("NBUB") ; } case CoinPrePostsolveMatrix::atLowerBound: { return ("NBLB") ; } case CoinPrePostsolveMatrix::superBasic: { return ("SB") ; } default: { return ("INVALID!") ; } } } #endif CoinMP-1.8.3/CoinUtils/src/CoinFactorization.hpp0000644000175000017500000017453712452502475020201 0ustar renerene/* $Id: CoinFactorization.hpp 1767 2015-01-05 12:36:13Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef CoinFactorization_H #define CoinFactorization_H //#define COIN_ONE_ETA_COPY 100 #include #include #include #include #include #include "CoinTypes.hpp" #include "CoinIndexedVector.hpp" class CoinPackedMatrix; /** This deals with Factorization and Updates This class started with a parallel simplex code I was writing in the mid 90's. The need for parallelism led to many complications and I have simplified as much as I could to get back to this. I was aiming at problems where I might get speed-up so I was looking at dense problems or ones with structure. This led to permuting input and output vectors and to increasing the number of rows each rank-one update. This is still in as a minor overhead. I have also put in handling for hyper-sparsity. I have taken out all outer loop unrolling, dense matrix handling and most of the book-keeping for slacks. Also I always use FTRAN approach to updating even if factorization fairly dense. All these could improve performance. I blame some of the coding peculiarities on the history of the code but mostly it is just because I can't do elegant code (or useful comments). I am assuming that 32 bits is enough for number of rows or columns, but CoinBigIndex may be redefined to get 64 bits. */ class CoinFactorization { friend void CoinFactorizationUnitTest( const std::string & mpsDir ); public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor CoinFactorization ( ); /// Copy constructor CoinFactorization ( const CoinFactorization &other); /// Destructor ~CoinFactorization ( ); /// Delete all stuff (leaves as after CoinFactorization()) void almostDestructor(); /// Debug show object (shows one representation) void show_self ( ) const; /// Debug - save on file - 0 if no error int saveFactorization (const char * file ) const; /** Debug - restore from file - 0 if no error on file. If factor true then factorizes as if called from ClpFactorization */ int restoreFactorization (const char * file , bool factor=false) ; /// Debug - sort so can compare void sort ( ) const; /// = copy CoinFactorization & operator = ( const CoinFactorization & other ); //@} /**@name Do factorization */ //@{ /** When part of LP - given by basic variables. Actually does factorization. Arrays passed in have non negative value to say basic. If status is okay, basic variables have pivot row - this is only needed If status is singular, then basic variables have pivot row and ones thrown out have -1 returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */ int factorize ( const CoinPackedMatrix & matrix, int rowIsBasic[], int columnIsBasic[] , double areaFactor = 0.0 ); /** When given as triplets. Actually does factorization. maximumL is guessed maximum size of L part of final factorization, maximumU of U part. These are multiplied by areaFactor which can be computed by user or internally. Arrays are copied in. I could add flag to delete arrays to save a bit of memory. If status okay, permutation has pivot rows - this is only needed If status is singular, then basic variables have pivot row and ones thrown out have -1 returns 0 -okay, -1 singular, -99 memory */ int factorize ( int numberRows, int numberColumns, CoinBigIndex numberElements, CoinBigIndex maximumL, CoinBigIndex maximumU, const int indicesRow[], const int indicesColumn[], const double elements[] , int permutation[], double areaFactor = 0.0); /** Two part version for maximum flexibility This part creates arrays for user to fill. estimateNumberElements is safe estimate of number returns 0 -okay, -99 memory */ int factorizePart1 ( int numberRows, int numberColumns, CoinBigIndex estimateNumberElements, int * indicesRow[], int * indicesColumn[], CoinFactorizationDouble * elements[], double areaFactor = 0.0); /** This is part two of factorization Arrays belong to factorization and were returned by part 1 If status okay, permutation has pivot rows - this is only needed If status is singular, then basic variables have pivot row and ones thrown out have -1 returns 0 -okay, -1 singular, -99 memory */ int factorizePart2 (int permutation[],int exactNumberElements); /// Condition number - product of pivots after factorization double conditionNumber() const; //@} /**@name general stuff such as permutation or status */ //@{ /// Returns status inline int status ( ) const { return status_; } /// Sets status inline void setStatus ( int value) { status_=value; } /// Returns number of pivots since factorization inline int pivots ( ) const { return numberPivots_; } /// Sets number of pivots since factorization inline void setPivots ( int value ) { numberPivots_=value; } /// Returns address of permute region inline int *permute ( ) const { return permute_.array(); } /// Returns address of pivotColumn region (also used for permuting) inline int *pivotColumn ( ) const { return pivotColumn_.array(); } /// Returns address of pivot region inline CoinFactorizationDouble *pivotRegion ( ) const { return pivotRegion_.array(); } /// Returns address of permuteBack region inline int *permuteBack ( ) const { return permuteBack_.array(); } /// Returns address of lastRow region inline int *lastRow ( ) const { return lastRow_.array(); } /** Returns address of pivotColumnBack region (also used for permuting) Now uses firstCount to save memory allocation */ inline int *pivotColumnBack ( ) const { //return firstCount_.array(); return pivotColumnBack_.array(); } /// Start of each row in L inline CoinBigIndex * startRowL() const { return startRowL_.array();} /// Start of each column in L inline CoinBigIndex * startColumnL() const { return startColumnL_.array();} /// Index of column in row for L inline int * indexColumnL() const { return indexColumnL_.array();} /// Row indices of L inline int * indexRowL() const { return indexRowL_.array();} /// Elements in L (row copy) inline CoinFactorizationDouble * elementByRowL() const { return elementByRowL_.array();} /// Number of Rows after iterating inline int numberRowsExtra ( ) const { return numberRowsExtra_; } /// Set number of Rows after factorization inline void setNumberRows(int value) { numberRows_ = value; } /// Number of Rows after factorization inline int numberRows ( ) const { return numberRows_; } /// Number in L inline CoinBigIndex numberL() const { return numberL_;} /// Base of L inline CoinBigIndex baseL() const { return baseL_;} /// Maximum of Rows after iterating inline int maximumRowsExtra ( ) const { return maximumRowsExtra_; } /// Total number of columns in factorization inline int numberColumns ( ) const { return numberColumns_; } /// Total number of elements in factorization inline int numberElements ( ) const { return totalElements_; } /// Length of FT vector inline int numberForrestTomlin ( ) const { return numberInColumn_.array()[numberColumnsExtra_]; } /// Number of good columns in factorization inline int numberGoodColumns ( ) const { return numberGoodU_; } /// Whether larger areas needed inline double areaFactor ( ) const { return areaFactor_; } inline void areaFactor ( double value ) { areaFactor_=value; } /// Returns areaFactor but adjusted for dense double adjustedAreaFactor() const; /// Allows change of pivot accuracy check 1.0 == none >1.0 relaxed inline void relaxAccuracyCheck(double value) { relaxCheck_ = value;} inline double getAccuracyCheck() const { return relaxCheck_;} /// Level of detail of messages inline int messageLevel ( ) const { return messageLevel_ ; } void messageLevel ( int value ); /// Maximum number of pivots between factorizations inline int maximumPivots ( ) const { return maximumPivots_ ; } void maximumPivots ( int value ); /// Gets dense threshold inline int denseThreshold() const { return denseThreshold_;} /// Sets dense threshold inline void setDenseThreshold(int value) { denseThreshold_ = value;} /// Pivot tolerance inline double pivotTolerance ( ) const { return pivotTolerance_ ; } void pivotTolerance ( double value ); /// Zero tolerance inline double zeroTolerance ( ) const { return zeroTolerance_ ; } void zeroTolerance ( double value ); #ifndef COIN_FAST_CODE /// Whether slack value is +1 or -1 inline double slackValue ( ) const { return slackValue_ ; } void slackValue ( double value ); #endif /// Returns maximum absolute value in factorization double maximumCoefficient() const; /// true if Forrest Tomlin update, false if PFI inline bool forrestTomlin() const { return doForrestTomlin_;} inline void setForrestTomlin(bool value) { doForrestTomlin_=value;} /// True if FT update and space inline bool spaceForForrestTomlin() const { CoinBigIndex start = startColumnU_.array()[maximumColumnsExtra_]; CoinBigIndex space = lengthAreaU_ - ( start + numberRowsExtra_ ); return (space>=0)&&doForrestTomlin_; } //@} /**@name some simple stuff */ //@{ /// Returns number of dense rows inline int numberDense() const { return numberDense_;} /// Returns number in U area inline CoinBigIndex numberElementsU ( ) const { return lengthU_; } /// Setss number in U area inline void setNumberElementsU(CoinBigIndex value) { lengthU_ = value; } /// Returns length of U area inline CoinBigIndex lengthAreaU ( ) const { return lengthAreaU_; } /// Returns number in L area inline CoinBigIndex numberElementsL ( ) const { return lengthL_; } /// Returns length of L area inline CoinBigIndex lengthAreaL ( ) const { return lengthAreaL_; } /// Returns number in R area inline CoinBigIndex numberElementsR ( ) const { return lengthR_; } /// Number of compressions done inline CoinBigIndex numberCompressions() const { return numberCompressions_;} /// Number of entries in each row inline int * numberInRow() const { return numberInRow_.array();} /// Number of entries in each column inline int * numberInColumn() const { return numberInColumn_.array();} /// Elements of U inline CoinFactorizationDouble * elementU() const { return elementU_.array();} /// Row indices of U inline int * indexRowU() const { return indexRowU_.array();} /// Start of each column in U inline CoinBigIndex * startColumnU() const { return startColumnU_.array();} /// Maximum number of Columns after iterating inline int maximumColumnsExtra() { return maximumColumnsExtra_;} /** L to U bias 0 - U bias, 1 - some U bias, 2 some L bias, 3 L bias */ inline int biasLU() const { return biasLU_;} inline void setBiasLU(int value) { biasLU_=value;} /** Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 but give a bit extra if bigger needed */ inline int persistenceFlag() const { return persistenceFlag_;} void setPersistenceFlag(int value); //@} /**@name rank one updates which do exist */ //@{ /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U */ int replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow, double pivotCheck , bool checkBeforeModifying=false, double acceptablePivot=1.0e-8); /** Combines BtranU and delete elements If deleted is NULL then delete elements otherwise store where elements are */ void replaceColumnU ( CoinIndexedVector * regionSparse, CoinBigIndex * deleted, int internalPivotRow); #ifdef ABC_USE_COIN_FACTORIZATION /** returns empty fake vector carved out of existing later - maybe use associated arrays */ CoinIndexedVector * fakeVector(CoinIndexedVector * vector, int already=0) const; void deleteFakeVector(CoinIndexedVector * vector, CoinIndexedVector * fakeVector) const; /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update already in U */ double checkReplacePart1 ( CoinIndexedVector * regionSparse, int pivotRow); /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update in vector */ double checkReplacePart1 ( CoinIndexedVector * regionSparse, CoinIndexedVector * partialUpdate, int pivotRow); /** Checks if can replace one Column in basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */ int checkReplacePart2 ( int pivotRow, double btranAlpha, double ftranAlpha, double ftAlpha, double acceptablePivot = 1.0e-8); /** Replaces one Column to basis, partial update already in U */ void replaceColumnPart3 ( CoinIndexedVector * regionSparse, int pivotRow, double alpha ); /** Replaces one Column to basis, partial update in vector */ void replaceColumnPart3 ( CoinIndexedVector * regionSparse, CoinIndexedVector * partialUpdate, int pivotRow, double alpha ); /** Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output long regions */ int updateColumnFT ( CoinIndexedVector & regionSparse); int updateColumnFTPart1 ( CoinIndexedVector & regionSparse) ; void updateColumnFTPart2 ( CoinIndexedVector & regionSparse) ; /** Updates one column (FTRAN) - long region Tries to do FT update puts partial update in vector */ void updateColumnFT ( CoinIndexedVector & regionSparseFT, CoinIndexedVector & partialUpdate, int which); /** Updates one column (FTRAN) long region */ int updateColumn ( CoinIndexedVector & regionSparse) const; /** Updates one column (FTRAN) from regionFT Tries to do FT update number returned is negative if no room. Also updates regionOther - long region*/ int updateTwoColumnsFT ( CoinIndexedVector & regionSparseFT, CoinIndexedVector & regionSparseOther); /** Updates one column (BTRAN) - long region*/ int updateColumnTranspose ( CoinIndexedVector & regionSparse) const; /** Updates one column (FTRAN) - long region */ void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const; /** Updates one column (BTRAN) - long region */ void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const; /** Updates one full column (FTRAN) - long region */ void updateFullColumn ( CoinIndexedVector & regionSparse) const; /** Updates one full column (BTRAN) - long region */ void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const; /** Updates one column for dual steepest edge weights (FTRAN) - long region */ void updateWeights ( CoinIndexedVector & regionSparse) const; /// Returns true if wants tableauColumn in replaceColumn inline bool wantsTableauColumn() const {return false;} /// Pivot tolerance inline double minimumPivotTolerance ( ) const { return pivotTolerance_ ; } inline void minimumPivotTolerance ( double value ) { pivotTolerance(value);} /// Says parallel inline void setParallelMode(int value) { parallelMode_=value;} /// Sets solve mode inline void setSolveMode(int value) { parallelMode_ &= 3;parallelMode_ |= (value<<2);} /// Sets solve mode inline int solveMode() const { return parallelMode_ >> 2;} /// Update partial Ftran by R update void updatePartialUpdate(CoinIndexedVector & partialUpdate); /// Makes a non-singular basis by replacing variables void makeNonSingular(int * COIN_RESTRICT sequence); #endif //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output */ int updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2); /** This version has same effect as above with FTUpdate==false so number returned is always >=0 */ int updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute=false) const; /** Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room. Also updates region3 region1 starts as zero and is zero at end */ int updateTwoColumnsFT ( CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermuteRegion3=false) ; /** Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output */ int updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; /** makes a row copy of L for speed and to allow very sparse problems */ void goSparse(); /** get sparse threshold */ inline int sparseThreshold ( ) const { return sparseThreshold_;} /** set sparse threshold */ void sparseThreshold ( int value ); //@} /// *** Below this user may not want to know about /**@name various uses of factorization (return code number elements) which user may not want to know about (left over from my LP code) */ //@{ /// Get rid of all memory inline void clearArrays() { gutsOfDestructor();} //@} /**@name various updates - none of which have been written! */ //@{ /** Adds given elements to Basis and updates factorization, can increase size of basis. Returns rank */ int add ( CoinBigIndex numberElements, int indicesRow[], int indicesColumn[], double elements[] ); /** Adds one Column to basis, can increase size of basis. Returns rank */ int addColumn ( CoinBigIndex numberElements, int indicesRow[], double elements[] ); /** Adds one Row to basis, can increase size of basis. Returns rank */ int addRow ( CoinBigIndex numberElements, int indicesColumn[], double elements[] ); /// Deletes one Column from basis, returns rank int deleteColumn ( int Row ); /// Deletes one Row from basis, returns rank int deleteRow ( int Row ); /** Replaces one Row in basis, At present assumes just a singleton on row is in basis returns 0=OK, 1=Probably OK, 2=singular, 3 no space */ int replaceRow ( int whichRow, int numberElements, const int indicesColumn[], const double elements[] ); /// Takes out all entries for given rows void emptyRows(int numberToEmpty, const int which[]); //@} /**@name used by ClpFactorization */ /// See if worth going sparse void checkSparse(); /// For statistics #if 0 //def CLP_FACTORIZATION_INSTRUMENT inline bool collectStatistics() const { return collectStatistics_;} /// For statistics inline void setCollectStatistics(bool onOff) const { collectStatistics_ = onOff;} #else inline bool collectStatistics() const { return true;} /// For statistics inline void setCollectStatistics(bool onOff) const { } #endif /// The real work of constructors etc 0 just scalars, 1 bit normal void gutsOfDestructor(int type=1); /// 1 bit - tolerances etc, 2 more, 4 dummy arrays void gutsOfInitialize(int type); void gutsOfCopy(const CoinFactorization &other); /// Reset all sparsity etc statistics void resetStatistics(); //@} /**@name used by factorization */ /// Gets space for a factorization, called by constructors void getAreas ( int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ); /** PreProcesses raw triplet data. state is 0 - triplets, 1 - some counts etc , 2 - .. */ void preProcess ( int state, int possibleDuplicates = -1 ); /// Does most of factorization int factor ( ); protected: /** Does sparse phase of factorization return code is <0 error, 0= finished */ int factorSparse ( ); /** Does sparse phase of factorization (for smaller problems) return code is <0 error, 0= finished */ int factorSparseSmall ( ); /** Does sparse phase of factorization (for larger problems) return code is <0 error, 0= finished */ int factorSparseLarge ( ); /** Does dense phase of factorization return code is <0 error, 0= finished */ int factorDense ( ); /// Pivots when just one other row so faster? bool pivotOneOtherRow ( int pivotRow, int pivotColumn ); /// Does one pivot on Row Singleton in factorization bool pivotRowSingleton ( int pivotRow, int pivotColumn ); /// Does one pivot on Column Singleton in factorization bool pivotColumnSingleton ( int pivotRow, int pivotColumn ); /** Gets space for one Column with given length, may have to do compression (returns True if successful), also moves existing vector, extraNeeded is over and above present */ bool getColumnSpace ( int iColumn, int extraNeeded ); /** Reorders U so contiguous and in order (if there is space) Returns true if it could */ bool reorderU(); /** getColumnSpaceIterateR. Gets space for one extra R element in Column may have to do compression (returns true) also moves existing vector */ bool getColumnSpaceIterateR ( int iColumn, double value, int iRow); /** getColumnSpaceIterate. Gets space for one extra U element in Column may have to do compression (returns true) also moves existing vector. Returns -1 if no memory or where element was put Used by replaceRow (turns off R version) */ CoinBigIndex getColumnSpaceIterate ( int iColumn, double value, int iRow); /** Gets space for one Row with given length, may have to do compression (returns True if successful), also moves existing vector */ bool getRowSpace ( int iRow, int extraNeeded ); /** Gets space for one Row with given length while iterating, may have to do compression (returns True if successful), also moves existing vector */ bool getRowSpaceIterate ( int iRow, int extraNeeded ); /// Checks that row and column copies look OK void checkConsistency ( ); /// Adds a link in chain of equal counts inline void addLink ( int index, int count ) { int *nextCount = nextCount_.array(); int *firstCount = firstCount_.array(); int *lastCount = lastCount_.array(); int next = firstCount[count]; lastCount[index] = -2 - count; if ( next < 0 ) { //first with that count firstCount[count] = index; nextCount[index] = -1; } else { firstCount[count] = index; nextCount[index] = next; lastCount[next] = index; }} /// Deletes a link in chain of equal counts inline void deleteLink ( int index ) { int *nextCount = nextCount_.array(); int *firstCount = firstCount_.array(); int *lastCount = lastCount_.array(); int next = nextCount[index]; int last = lastCount[index]; if ( last >= 0 ) { nextCount[last] = next; } else { int count = -last - 2; firstCount[count] = next; } if ( next >= 0 ) { lastCount[next] = last; } nextCount[index] = -2; lastCount[index] = -2; return; } /// Separate out links with same row/column count void separateLinks(int count,bool rowsFirst); /// Cleans up at end of factorization void cleanup ( ); /// Updates part of column (FTRANL) void updateColumnL ( CoinIndexedVector * region, int * indexIn ) const; /// Updates part of column (FTRANL) when densish void updateColumnLDensish ( CoinIndexedVector * region, int * indexIn ) const; /// Updates part of column (FTRANL) when sparse void updateColumnLSparse ( CoinIndexedVector * region, int * indexIn ) const; /// Updates part of column (FTRANL) when sparsish void updateColumnLSparsish ( CoinIndexedVector * region, int * indexIn ) const; /// Updates part of column (FTRANR) without FT update void updateColumnR ( CoinIndexedVector * region ) const; /** Updates part of column (FTRANR) with FT update. Also stores update after L and R */ void updateColumnRFT ( CoinIndexedVector * region, int * indexIn ); /// Updates part of column (FTRANU) void updateColumnU ( CoinIndexedVector * region, int * indexIn) const; /// Updates part of column (FTRANU) when sparse void updateColumnUSparse ( CoinIndexedVector * regionSparse, int * indexIn) const; /// Updates part of column (FTRANU) when sparsish void updateColumnUSparsish ( CoinIndexedVector * regionSparse, int * indexIn) const; /// Updates part of column (FTRANU) int updateColumnUDensish ( double * COIN_RESTRICT region, int * COIN_RESTRICT regionIndex) const; /// Updates part of 2 columns (FTRANU) real work void updateTwoColumnsUDensish ( int & numberNonZero1, double * COIN_RESTRICT region1, int * COIN_RESTRICT index1, int & numberNonZero2, double * COIN_RESTRICT region2, int * COIN_RESTRICT index2) const; /// Updates part of column PFI (FTRAN) (after rest) void updateColumnPFI ( CoinIndexedVector * regionSparse) const; /// Permutes back at end of updateColumn void permuteBack ( CoinIndexedVector * regionSparse, CoinIndexedVector * outVector) const; /// Updates part of column transpose PFI (BTRAN) (before rest) void updateColumnTransposePFI ( CoinIndexedVector * region) const; /** Updates part of column transpose (BTRANU), assumes index is sorted i.e. region is correct */ void updateColumnTransposeU ( CoinIndexedVector * region, int smallestIndex) const; /** Updates part of column transpose (BTRANU) when sparsish, assumes index is sorted i.e. region is correct */ void updateColumnTransposeUSparsish ( CoinIndexedVector * region, int smallestIndex) const; /** Updates part of column transpose (BTRANU) when densish, assumes index is sorted i.e. region is correct */ void updateColumnTransposeUDensish ( CoinIndexedVector * region, int smallestIndex) const; /** Updates part of column transpose (BTRANU) when sparse, assumes index is sorted i.e. region is correct */ void updateColumnTransposeUSparse ( CoinIndexedVector * region) const; /** Updates part of column transpose (BTRANU) by column assumes index is sorted i.e. region is correct */ void updateColumnTransposeUByColumn ( CoinIndexedVector * region, int smallestIndex) const; /// Updates part of column transpose (BTRANR) void updateColumnTransposeR ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANR) when dense void updateColumnTransposeRDensish ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANR) when sparse void updateColumnTransposeRSparse ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANL) void updateColumnTransposeL ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANL) when densish by column void updateColumnTransposeLDensish ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANL) when densish by row void updateColumnTransposeLByRow ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANL) when sparsish by row void updateColumnTransposeLSparsish ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANL) when sparse (by Row) void updateColumnTransposeLSparse ( CoinIndexedVector * region ) const; public: /** Replaces one Column to basis for PFI returns 0=OK, 1=Probably OK, 2=singular, 3=no room. In this case region is not empty - it is incoming variable (updated) */ int replaceColumnPFI ( CoinIndexedVector * regionSparse, int pivotRow, double alpha); protected: /** Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular */ int checkPivot(double saveFromU, double oldPivot) const; /********************************* START LARGE TEMPLATE ********/ #ifdef INT_IS_8 #define COINFACTORIZATION_BITS_PER_INT 64 #define COINFACTORIZATION_SHIFT_PER_INT 6 #define COINFACTORIZATION_MASK_PER_INT 0x3f #else #define COINFACTORIZATION_BITS_PER_INT 32 #define COINFACTORIZATION_SHIFT_PER_INT 5 #define COINFACTORIZATION_MASK_PER_INT 0x1f #endif template inline bool pivot ( int pivotRow, int pivotColumn, CoinBigIndex pivotRowPosition, CoinBigIndex pivotColumnPosition, CoinFactorizationDouble work[], unsigned int workArea2[], int increment2, T markRow[] , int largeInteger) { int *indexColumnU = indexColumnU_.array(); CoinBigIndex *startColumnU = startColumnU_.array(); int *numberInColumn = numberInColumn_.array(); CoinFactorizationDouble *elementU = elementU_.array(); int *indexRowU = indexRowU_.array(); CoinBigIndex *startRowU = startRowU_.array(); int *numberInRow = numberInRow_.array(); CoinFactorizationDouble *elementL = elementL_.array(); int *indexRowL = indexRowL_.array(); int *saveColumn = saveColumn_.array(); int *nextRow = nextRow_.array(); int *lastRow = lastRow_.array() ; //store pivot columns (so can easily compress) int numberInPivotRow = numberInRow[pivotRow] - 1; CoinBigIndex startColumn = startColumnU[pivotColumn]; int numberInPivotColumn = numberInColumn[pivotColumn] - 1; CoinBigIndex endColumn = startColumn + numberInPivotColumn + 1; int put = 0; CoinBigIndex startRow = startRowU[pivotRow]; CoinBigIndex endRow = startRow + numberInPivotRow + 1; if ( pivotColumnPosition < 0 ) { for ( pivotColumnPosition = startRow; pivotColumnPosition < endRow; pivotColumnPosition++ ) { int iColumn = indexColumnU[pivotColumnPosition]; if ( iColumn != pivotColumn ) { saveColumn[put++] = iColumn; } else { break; } } } else { for (CoinBigIndex i = startRow ; i < pivotColumnPosition ; i++ ) { saveColumn[put++] = indexColumnU[i]; } } assert (pivotColumnPosition lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) printf("more memory needed in middle of invert\n"); return false; } //l+=currentAreaL_->elementByColumn-elementL; CoinBigIndex lSave = l; CoinBigIndex * startColumnL = startColumnL_.array(); startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l + numberInPivotColumn; lengthL_ += numberInPivotColumn; if ( pivotRowPosition < 0 ) { for ( pivotRowPosition = startColumn; pivotRowPosition < endColumn; pivotRowPosition++ ) { int iRow = indexRowU[pivotRowPosition]; if ( iRow != pivotRow ) { indexRowL[l] = iRow; elementL[l] = elementU[pivotRowPosition]; markRow[iRow] = static_cast(l - lSave); l++; //take out of row list CoinBigIndex start = startRowU[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif indexColumnU[where] = indexColumnU[end - 1]; numberInRow[iRow]--; } else { break; } } } else { CoinBigIndex i; for ( i = startColumn; i < pivotRowPosition; i++ ) { int iRow = indexRowU[i]; markRow[iRow] = static_cast(l - lSave); indexRowL[l] = iRow; elementL[l] = elementU[i]; l++; //take out of row list CoinBigIndex start = startRowU[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif indexColumnU[where] = indexColumnU[end - 1]; numberInRow[iRow]--; assert (numberInRow[iRow]>=0); } } assert (pivotRowPosition(l - lSave); indexRowL[l] = iRow; elementL[l] = elementU[pivotRowPosition]; l++; //take out of row list CoinBigIndex start = startRowU[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif indexColumnU[where] = indexColumnU[end - 1]; numberInRow[iRow]--; assert (numberInRow[iRow]>=0); } markRow[pivotRow] = static_cast(largeInteger); //compress pivot column (move pivot to front including saved) numberInColumn[pivotColumn] = 0; //use end of L for temporary space int *indexL = &indexRowL[lSave]; CoinFactorizationDouble *multipliersL = &elementL[lSave]; //adjust int j; for ( j = 0; j < numberInPivotColumn; j++ ) { multipliersL[j] *= pivotMultiplier; } //zero out fill CoinBigIndex iErase; for ( iErase = 0; iErase < increment2 * numberInPivotRow; iErase++ ) { workArea2[iErase] = 0; } CoinBigIndex added = numberInPivotRow * numberInPivotColumn; unsigned int *temp2 = workArea2; int * nextColumn = nextColumn_.array(); //pack down and move to work int jColumn; for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { int iColumn = saveColumn[jColumn]; CoinBigIndex startColumn = startColumnU[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumn[iColumn]; int iRow = indexRowU[startColumn]; CoinFactorizationDouble value = elementU[startColumn]; double largest; CoinBigIndex put = startColumn; CoinBigIndex positionLargest = -1; CoinFactorizationDouble thisPivotValue = 0.0; //compress column and find largest not updated bool checkLargest; int mark = markRow[iRow]; if ( mark == largeInteger+1 ) { largest = fabs ( value ); positionLargest = put; put++; checkLargest = false; } else { //need to find largest largest = 0.0; checkLargest = true; if ( mark != largeInteger ) { //will be updated work[mark] = value; int word = mark >> COINFACTORIZATION_SHIFT_PER_INT; int bit = mark & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts added--; } else { thisPivotValue = value; } } CoinBigIndex i; for ( i = startColumn + 1; i < endColumn; i++ ) { iRow = indexRowU[i]; value = elementU[i]; int mark = markRow[iRow]; if ( mark == largeInteger+1 ) { //keep indexRowU[put] = iRow; elementU[put] = value; if ( checkLargest ) { double absValue = fabs ( value ); if ( absValue > largest ) { largest = absValue; positionLargest = put; } } put++; } else if ( mark != largeInteger ) { //will be updated work[mark] = value; int word = mark >> COINFACTORIZATION_SHIFT_PER_INT; int bit = mark & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts added--; } else { thisPivotValue = value; } } //slot in pivot elementU[put] = elementU[startColumn]; indexRowU[put] = indexRowU[startColumn]; if ( positionLargest == startColumn ) { positionLargest = put; //follow if was largest } put++; elementU[startColumn] = thisPivotValue; indexRowU[startColumn] = pivotRow; //clean up counts startColumn++; numberInColumn[iColumn] = put - startColumn; int * numberInColumnPlus = numberInColumnPlus_.array(); numberInColumnPlus[iColumn]++; startColumnU[iColumn]++; //how much space have we got int next = nextColumn[iColumn]; CoinBigIndex space; space = startColumnU[next] - put - numberInColumnPlus[next]; //assume no zero elements if ( numberInPivotColumn > space ) { //getColumnSpace also moves fixed part if ( !getColumnSpace ( iColumn, numberInPivotColumn ) ) { return false; } //redo starts if (positionLargest >= 0) positionLargest = positionLargest + startColumnU[iColumn] - startColumn; startColumn = startColumnU[iColumn]; put = startColumn + numberInColumn[iColumn]; } double tolerance = zeroTolerance_; int *nextCount = nextCount_.array(); for ( j = 0; j < numberInPivotColumn; j++ ) { value = work[j] - thisPivotValue * multipliersL[j]; double absValue = fabs ( value ); if ( absValue > tolerance ) { work[j] = 0.0; assert (put largest ) { largest = absValue; positionLargest = put; } put++; } else { work[j] = 0.0; added--; int word = j >> COINFACTORIZATION_SHIFT_PER_INT; int bit = j & COINFACTORIZATION_MASK_PER_INT; if ( temp2[word] & ( 1 << bit ) ) { //take out of row list iRow = indexL[j]; CoinBigIndex start = startRowU[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumnU[where] != iColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif indexColumnU[where] = indexColumnU[end - 1]; numberInRow[iRow]--; } else { //make sure won't be added int word = j >> COINFACTORIZATION_SHIFT_PER_INT; int bit = j & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts } } } numberInColumn[iColumn] = put - startColumn; //move largest if ( positionLargest >= 0 ) { value = elementU[positionLargest]; iRow = indexRowU[positionLargest]; elementU[positionLargest] = elementU[startColumn]; indexRowU[positionLargest] = indexRowU[startColumn]; elementU[startColumn] = value; indexRowU[startColumn] = iRow; } //linked list for column if ( nextCount[iColumn + numberRows_] != -2 ) { //modify linked list deleteLink ( iColumn + numberRows_ ); addLink ( iColumn + numberRows_, numberInColumn[iColumn] ); } temp2 += increment2; } //get space for row list unsigned int *putBase = workArea2; int bigLoops = numberInPivotColumn >> COINFACTORIZATION_SHIFT_PER_INT; int i = 0; // do linked lists and update counts while ( bigLoops ) { bigLoops--; int bit; for ( bit = 0; bit < COINFACTORIZATION_BITS_PER_INT; i++, bit++ ) { unsigned int *putThis = putBase; int iRow = indexL[i]; //get space int number = 0; int jColumn; for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { unsigned int test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); number += test; } int next = nextRow[iRow]; CoinBigIndex space; space = startRowU[next] - startRowU[iRow]; number += numberInRow[iRow]; if ( space < number ) { if ( !getRowSpace ( iRow, number ) ) { return false; } } // now do putThis = putBase; next = nextRow[iRow]; number = numberInRow[iRow]; CoinBigIndex end = startRowU[iRow] + number; int saveIndex = indexColumnU[startRowU[next]]; //add in for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { unsigned int test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); indexColumnU[end] = saveColumn[jColumn]; end += test; } //put back next one in case zapped indexColumnU[startRowU[next]] = saveIndex; markRow[iRow] = static_cast(largeInteger+1); number = end - startRowU[iRow]; numberInRow[iRow] = number; deleteLink ( iRow ); addLink ( iRow, number ); } putBase++; } /* endwhile */ int bit; for ( bit = 0; i < numberInPivotColumn; i++, bit++ ) { unsigned int *putThis = putBase; int iRow = indexL[i]; //get space int number = 0; int jColumn; for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { unsigned int test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); number += test; } int next = nextRow[iRow]; CoinBigIndex space; space = startRowU[next] - startRowU[iRow]; number += numberInRow[iRow]; if ( space < number ) { if ( !getRowSpace ( iRow, number ) ) { return false; } } // now do putThis = putBase; next = nextRow[iRow]; number = numberInRow[iRow]; CoinBigIndex end = startRowU[iRow] + number; int saveIndex; saveIndex = indexColumnU[startRowU[next]]; //add in for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { unsigned int test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); indexColumnU[end] = saveColumn[jColumn]; end += test; } indexColumnU[startRowU[next]] = saveIndex; markRow[iRow] = static_cast(largeInteger+1); number = end - startRowU[iRow]; numberInRow[iRow] = number; deleteLink ( iRow ); addLink ( iRow, number ); } markRow[pivotRow] = static_cast(largeInteger+1); //modify linked list for pivots deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); totalElements_ += added; return true; } /********************************* END LARGE TEMPLATE ********/ //@} ////////////////// data ////////////////// protected: /**@name data */ //@{ /// Pivot tolerance double pivotTolerance_; /// Zero tolerance double zeroTolerance_; #ifndef COIN_FAST_CODE /// Whether slack value is +1 or -1 double slackValue_; #else #ifndef slackValue_ #define slackValue_ -1.0 #endif #endif /// How much to multiply areas by double areaFactor_; /// Relax check on accuracy in replaceColumn double relaxCheck_; /// Number of Rows in factorization int numberRows_; /// Number of Rows after iterating int numberRowsExtra_; /// Maximum number of Rows after iterating int maximumRowsExtra_; /// Number of Columns in factorization int numberColumns_; /// Number of Columns after iterating int numberColumnsExtra_; /// Maximum number of Columns after iterating int maximumColumnsExtra_; /// Number factorized in U (not row singletons) int numberGoodU_; /// Number factorized in L int numberGoodL_; /// Maximum number of pivots before factorization int maximumPivots_; /// Number pivots since last factorization int numberPivots_; /// Number of elements in U (to go) /// or while iterating total overall CoinBigIndex totalElements_; /// Number of elements after factorization CoinBigIndex factorElements_; /// Pivot order for each Column CoinIntArrayWithLength pivotColumn_; /// Permutation vector for pivot row order CoinIntArrayWithLength permute_; /// DePermutation vector for pivot row order CoinIntArrayWithLength permuteBack_; /// Inverse Pivot order for each Column CoinIntArrayWithLength pivotColumnBack_; /// Status of factorization int status_; /** 0 - no increasing rows - no permutations, 1 - no increasing rows but permutations 2 - increasing rows - taken out as always 2 */ //int increasingRows_; /// Number of trials before rejection int numberTrials_; /// Start of each Row as pointer CoinBigIndexArrayWithLength startRowU_; /// Number in each Row CoinIntArrayWithLength numberInRow_; /// Number in each Column CoinIntArrayWithLength numberInColumn_; /// Number in each Column including pivoted CoinIntArrayWithLength numberInColumnPlus_; /** First Row/Column with count of k, can tell which by offset - Rows then Columns */ CoinIntArrayWithLength firstCount_; /// Next Row/Column with count CoinIntArrayWithLength nextCount_; /// Previous Row/Column with count CoinIntArrayWithLength lastCount_; /// Next Column in memory order CoinIntArrayWithLength nextColumn_; /// Previous Column in memory order CoinIntArrayWithLength lastColumn_; /// Next Row in memory order CoinIntArrayWithLength nextRow_; /// Previous Row in memory order CoinIntArrayWithLength lastRow_; /// Columns left to do in a single pivot CoinIntArrayWithLength saveColumn_; /// Marks rows to be updated CoinIntArrayWithLength markRow_; /// Detail in messages int messageLevel_; /// Larger of row and column size int biggerDimension_; /// Base address for U (may change) CoinIntArrayWithLength indexColumnU_; /// Pivots for L CoinIntArrayWithLength pivotRowL_; /// Inverses of pivot values CoinFactorizationDoubleArrayWithLength pivotRegion_; /// Number of slacks at beginning of U int numberSlacks_; /// Number in U int numberU_; /// Maximum space used in U CoinBigIndex maximumU_; /// Base of U is always 0 //int baseU_; /// Length of U CoinBigIndex lengthU_; /// Length of area reserved for U CoinBigIndex lengthAreaU_; /// Elements of U CoinFactorizationDoubleArrayWithLength elementU_; /// Row indices of U CoinIntArrayWithLength indexRowU_; /// Start of each column in U CoinBigIndexArrayWithLength startColumnU_; /// Converts rows to columns in U CoinBigIndexArrayWithLength convertRowToColumnU_; /// Number in L CoinBigIndex numberL_; /// Base of L CoinBigIndex baseL_; /// Length of L CoinBigIndex lengthL_; /// Length of area reserved for L CoinBigIndex lengthAreaL_; /// Elements of L CoinFactorizationDoubleArrayWithLength elementL_; /// Row indices of L CoinIntArrayWithLength indexRowL_; /// Start of each column in L CoinBigIndexArrayWithLength startColumnL_; /// true if Forrest Tomlin update, false if PFI bool doForrestTomlin_; /// Number in R int numberR_; /// Length of R stuff CoinBigIndex lengthR_; /// length of area reserved for R CoinBigIndex lengthAreaR_; /// Elements of R CoinFactorizationDouble *elementR_; /// Row indices for R int *indexRowR_; /// Start of columns for R CoinBigIndexArrayWithLength startColumnR_; /// Dense area double * denseArea_; /// Dense area - actually used (for alignment etc) double * denseAreaAddress_; /// Dense permutation int * densePermute_; /// Number of dense rows int numberDense_; /// Dense threshold int denseThreshold_; /// First work area CoinFactorizationDoubleArrayWithLength workArea_; /// Second work area CoinUnsignedIntArrayWithLength workArea2_; /// Number of compressions done CoinBigIndex numberCompressions_; public: /// Below are all to collect mutable double ftranCountInput_; mutable double ftranCountAfterL_; mutable double ftranCountAfterR_; mutable double ftranCountAfterU_; mutable double btranCountInput_; mutable double btranCountAfterU_; mutable double btranCountAfterR_; mutable double btranCountAfterL_; /// We can roll over factorizations mutable int numberFtranCounts_; mutable int numberBtranCounts_; /// While these are average ratios collected over last period double ftranAverageAfterL_; double ftranAverageAfterR_; double ftranAverageAfterU_; double btranAverageAfterU_; double btranAverageAfterR_; double btranAverageAfterL_; protected: /// For statistics #if 0 mutable bool collectStatistics_; #else #define collectStatistics_ 1 #endif /// Below this use sparse technology - if 0 then no L row copy int sparseThreshold_; /// And one for "sparsish" int sparseThreshold2_; /// Start of each row in L CoinBigIndexArrayWithLength startRowL_; /// Index of column in row for L CoinIntArrayWithLength indexColumnL_; /// Elements in L (row copy) CoinFactorizationDoubleArrayWithLength elementByRowL_; /// Sparse regions mutable CoinIntArrayWithLength sparse_; /** L to U bias 0 - U bias, 1 - some U bias, 2 some L bias, 3 L bias */ int biasLU_; /** Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 but give a bit extra if bigger needed */ int persistenceFlag_; #ifdef ABC_USE_COIN_FACTORIZATION /// Says if parallel int parallelMode_; #endif //@} }; // Dense coding #ifdef COIN_HAS_LAPACK #ifndef COIN_FACTORIZATION_DENSE_CODE #define COIN_FACTORIZATION_DENSE_CODE 1 #endif #endif #ifdef COIN_FACTORIZATION_DENSE_CODE /* Type of Fortran integer translated into C */ #ifndef ipfint //typedef ipfint FORTRAN_INTEGER_TYPE ; typedef int ipfint; typedef const int cipfint; #endif #endif #endif // Extra for ugly include #ifdef UGLY_COIN_FACTOR_CODING #define FAC_UNSET (FAC_SET+1) { goodPivot=false; //store pivot columns (so can easily compress) CoinBigIndex startColumnThis = startColumn[iPivotColumn]; CoinBigIndex endColumn = startColumnThis + numberDoColumn + 1; int put = 0; CoinBigIndex startRowThis = startRow[iPivotRow]; CoinBigIndex endRow = startRowThis + numberDoRow + 1; if ( pivotColumnPosition < 0 ) { for ( pivotColumnPosition = startRowThis; pivotColumnPosition < endRow; pivotColumnPosition++ ) { int iColumn = indexColumn[pivotColumnPosition]; if ( iColumn != iPivotColumn ) { saveColumn[put++] = iColumn; } else { break; } } } else { for (CoinBigIndex i = startRowThis ; i < pivotColumnPosition ; i++ ) { saveColumn[put++] = indexColumn[i]; } } assert (pivotColumnPosition lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) printf("more memory needed in middle of invert\n"); goto BAD_PIVOT; } //l+=currentAreaL_->elementByColumn-elementL; CoinBigIndex lSave = l; CoinBigIndex * startColumnL = startColumnL_.array(); startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l + numberDoColumn; lengthL_ += numberDoColumn; if ( pivotRowPosition < 0 ) { for ( pivotRowPosition = startColumnThis; pivotRowPosition < endColumn; pivotRowPosition++ ) { int iRow = indexRow[pivotRowPosition]; if ( iRow != iPivotRow ) { indexRowL[l] = iRow; elementL[l] = element[pivotRowPosition]; markRow[iRow] = l - lSave; l++; //take out of row list CoinBigIndex start = startRow[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumn[where] != iPivotColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif indexColumn[where] = indexColumn[end - 1]; numberInRow[iRow]--; } else { break; } } } else { CoinBigIndex i; for ( i = startColumnThis; i < pivotRowPosition; i++ ) { int iRow = indexRow[i]; markRow[iRow] = l - lSave; indexRowL[l] = iRow; elementL[l] = element[i]; l++; //take out of row list CoinBigIndex start = startRow[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumn[where] != iPivotColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif indexColumn[where] = indexColumn[end - 1]; numberInRow[iRow]--; assert (numberInRow[iRow]>=0); } } assert (pivotRowPosition= end ) { abort ( ); } #endif indexColumn[where] = indexColumn[end - 1]; numberInRow[iRow]--; assert (numberInRow[iRow]>=0); } markRow[iPivotRow] = FAC_SET; //compress pivot column (move pivot to front including saved) numberInColumn[iPivotColumn] = 0; //use end of L for temporary space int *indexL = &indexRowL[lSave]; CoinFactorizationDouble *multipliersL = &elementL[lSave]; //adjust int j; for ( j = 0; j < numberDoColumn; j++ ) { multipliersL[j] *= pivotMultiplier; } //zero out fill CoinBigIndex iErase; for ( iErase = 0; iErase < increment2 * numberDoRow; iErase++ ) { workArea2[iErase] = 0; } CoinBigIndex added = numberDoRow * numberDoColumn; unsigned int *temp2 = workArea2; int * nextColumn = nextColumn_.array(); //pack down and move to work int jColumn; for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) { int iColumn = saveColumn[jColumn]; CoinBigIndex startColumnThis = startColumn[iColumn]; CoinBigIndex endColumn = startColumnThis + numberInColumn[iColumn]; int iRow = indexRow[startColumnThis]; CoinFactorizationDouble value = element[startColumnThis]; double largest; CoinBigIndex put = startColumnThis; CoinBigIndex positionLargest = -1; CoinFactorizationDouble thisPivotValue = 0.0; //compress column and find largest not updated bool checkLargest; int mark = markRow[iRow]; if ( mark == FAC_UNSET ) { largest = fabs ( value ); positionLargest = put; put++; checkLargest = false; } else { //need to find largest largest = 0.0; checkLargest = true; if ( mark != FAC_SET ) { //will be updated workArea[mark] = value; int word = mark >> COINFACTORIZATION_SHIFT_PER_INT; int bit = mark & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts added--; } else { thisPivotValue = value; } } CoinBigIndex i; for ( i = startColumnThis + 1; i < endColumn; i++ ) { iRow = indexRow[i]; value = element[i]; int mark = markRow[iRow]; if ( mark == FAC_UNSET ) { //keep indexRow[put] = iRow; element[put] = value; if ( checkLargest ) { double absValue = fabs ( value ); if ( absValue > largest ) { largest = absValue; positionLargest = put; } } put++; } else if ( mark != FAC_SET ) { //will be updated workArea[mark] = value; int word = mark >> COINFACTORIZATION_SHIFT_PER_INT; int bit = mark & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts added--; } else { thisPivotValue = value; } } //slot in pivot element[put] = element[startColumnThis]; indexRow[put] = indexRow[startColumnThis]; if ( positionLargest == startColumnThis ) { positionLargest = put; //follow if was largest } put++; element[startColumnThis] = thisPivotValue; indexRow[startColumnThis] = iPivotRow; //clean up counts startColumnThis++; numberInColumn[iColumn] = put - startColumnThis; int * numberInColumnPlus = numberInColumnPlus_.array(); numberInColumnPlus[iColumn]++; startColumn[iColumn]++; //how much space have we got int next = nextColumn[iColumn]; CoinBigIndex space; space = startColumn[next] - put - numberInColumnPlus[next]; //assume no zero elements if ( numberDoColumn > space ) { //getColumnSpace also moves fixed part if ( !getColumnSpace ( iColumn, numberDoColumn ) ) { goto BAD_PIVOT; } //redo starts positionLargest = positionLargest + startColumn[iColumn] - startColumnThis; startColumnThis = startColumn[iColumn]; put = startColumnThis + numberInColumn[iColumn]; } double tolerance = zeroTolerance_; int *nextCount = nextCount_.array(); for ( j = 0; j < numberDoColumn; j++ ) { value = workArea[j] - thisPivotValue * multipliersL[j]; double absValue = fabs ( value ); if ( absValue > tolerance ) { workArea[j] = 0.0; element[put] = value; indexRow[put] = indexL[j]; if ( absValue > largest ) { largest = absValue; positionLargest = put; } put++; } else { workArea[j] = 0.0; added--; int word = j >> COINFACTORIZATION_SHIFT_PER_INT; int bit = j & COINFACTORIZATION_MASK_PER_INT; if ( temp2[word] & ( 1 << bit ) ) { //take out of row list iRow = indexL[j]; CoinBigIndex start = startRow[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumn[where] != iColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif indexColumn[where] = indexColumn[end - 1]; numberInRow[iRow]--; } else { //make sure won't be added int word = j >> COINFACTORIZATION_SHIFT_PER_INT; int bit = j & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts } } } numberInColumn[iColumn] = put - startColumnThis; //move largest if ( positionLargest >= 0 ) { value = element[positionLargest]; iRow = indexRow[positionLargest]; element[positionLargest] = element[startColumnThis]; indexRow[positionLargest] = indexRow[startColumnThis]; element[startColumnThis] = value; indexRow[startColumnThis] = iRow; } //linked list for column if ( nextCount[iColumn + numberRows_] != -2 ) { //modify linked list deleteLink ( iColumn + numberRows_ ); addLink ( iColumn + numberRows_, numberInColumn[iColumn] ); } temp2 += increment2; } //get space for row list unsigned int *putBase = workArea2; int bigLoops = numberDoColumn >> COINFACTORIZATION_SHIFT_PER_INT; int i = 0; // do linked lists and update counts while ( bigLoops ) { bigLoops--; int bit; for ( bit = 0; bit < COINFACTORIZATION_BITS_PER_INT; i++, bit++ ) { unsigned int *putThis = putBase; int iRow = indexL[i]; //get space int number = 0; int jColumn; for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) { unsigned int test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); number += test; } int next = nextRow[iRow]; CoinBigIndex space; space = startRow[next] - startRow[iRow]; number += numberInRow[iRow]; if ( space < number ) { if ( !getRowSpace ( iRow, number ) ) { goto BAD_PIVOT; } } // now do putThis = putBase; next = nextRow[iRow]; number = numberInRow[iRow]; CoinBigIndex end = startRow[iRow] + number; int saveIndex = indexColumn[startRow[next]]; //add in for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) { unsigned int test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); indexColumn[end] = saveColumn[jColumn]; end += test; } //put back next one in case zapped indexColumn[startRow[next]] = saveIndex; markRow[iRow] = FAC_UNSET; number = end - startRow[iRow]; numberInRow[iRow] = number; deleteLink ( iRow ); addLink ( iRow, number ); } putBase++; } /* endwhile */ int bit; for ( bit = 0; i < numberDoColumn; i++, bit++ ) { unsigned int *putThis = putBase; int iRow = indexL[i]; //get space int number = 0; int jColumn; for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) { unsigned int test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); number += test; } int next = nextRow[iRow]; CoinBigIndex space; space = startRow[next] - startRow[iRow]; number += numberInRow[iRow]; if ( space < number ) { if ( !getRowSpace ( iRow, number ) ) { goto BAD_PIVOT; } } // now do putThis = putBase; next = nextRow[iRow]; number = numberInRow[iRow]; CoinBigIndex end = startRow[iRow] + number; int saveIndex; saveIndex = indexColumn[startRow[next]]; //add in for ( jColumn = 0; jColumn < numberDoRow; jColumn++ ) { unsigned int test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); indexColumn[end] = saveColumn[jColumn]; end += test; } indexColumn[startRow[next]] = saveIndex; markRow[iRow] = FAC_UNSET; number = end - startRow[iRow]; numberInRow[iRow] = number; deleteLink ( iRow ); addLink ( iRow, number ); } markRow[iPivotRow] = FAC_UNSET; //modify linked list for pivots deleteLink ( iPivotRow ); deleteLink ( iPivotColumn + numberRows_ ); totalElements_ += added; goodPivot= true; // **** UGLY UGLY UGLY } BAD_PIVOT: ; } #undef FAC_UNSET #endif CoinMP-1.8.3/CoinUtils/src/CoinModelUseful2.cpp0000644000175000017500000012244612355004401017642 0ustar renerene/* $Id: CoinModelUseful2.cpp 1717 2014-07-02 13:28:33Z forrest $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. /* A Bison parser, made by GNU Bison 1.875c. */ // License sounds scary but see special exception so has no problems /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* Written by Richard Stallman by simplifying the original so called ``semantic'' parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NUM = 258, VAR = 259, FNCT = 260, NEG = 261 }; #endif #define NUM 258 #define VAR 259 #define FNCT 260 #define NEG 261 #include #include "CoinModel.hpp" #include "CoinHelperFunctions.hpp" /* Copy the first part of user declarations. */ #include /* For math functions, cos(), sin(), etc. */ #include #include #include #include static void yyerror (char const *); /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) typedef union YYSTYPE { double val; /* For returning numbers. */ symrec *tptr; /* For returning symbol-table pointers. */ } YYSTYPE; /* Line 191 of yacc.c. */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 214 of yacc.c. */ #if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # endif # else # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif # define YYSTACK_ALLOC malloc # define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else typedef short yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 64 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 16 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 4 /* YYNRULES -- Number of rules. */ #define YYNRULES 17 /* YYNRULES -- Number of states. */ #define YYNSTATES 32 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 261 #define YYTRANSLATE(YYX) \ (static_cast ((YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 14, 15, 9, 8, 2, 7, 2, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 11 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const unsigned char yyprhs[] = { 0, 0, 3, 4, 7, 9, 12, 15, 17, 19, 23, 28, 32, 36, 40, 44, 47, 51 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { 17, 0, -1, -1, 17, 18, -1, 13, -1, 19, 13, -1, 1, 13, -1, 3, -1, 4, -1, 4, 6, 19, -1, 5, 14, 19, 15, -1, 19, 8, 19, -1, 19, 7, 19, -1, 19, 9, 19, -1, 19, 10, 19, -1, 7, 19, -1, 19, 12, 19, -1, 14, 19, 15, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned char yyrline[] = { 0, 23, 23, 24, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }; #endif #if YYDEBUG || YYERROR_VERBOSE /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "NUM", "VAR", "FNCT", "'='", "'-'", "'+'", "'*'", "'/'", "NEG", "'^'", "'\\n'", "'('", "')'", "$accept", "input", "line", "exp", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const unsigned short yytoknum[] = { 0, 256, 257, 258, 259, 260, 61, 45, 43, 42, 47, 261, 94, 10, 40, 41 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { 0, 16, 17, 17, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const unsigned char yyr2[] = { 0, 2, 0, 2, 1, 2, 2, 1, 1, 3, 4, 3, 3, 3, 3, 2, 3, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const unsigned char yydefact[] = { 2, 0, 1, 0, 7, 8, 0, 0, 4, 0, 3, 0, 6, 0, 0, 15, 0, 0, 0, 0, 0, 0, 5, 9, 0, 17, 12, 11, 13, 14, 16, 10 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yysigned_char yydefgoto[] = { -1, 1, 10, 11 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -13 static const yysigned_char yypact[] = { -13, 15, -13, -12, -13, -3, -10, 20, -13, 20, -13, 41, -13, 20, 20, -4, 23, 20, 20, 20, 20, 20, -13, 48, 32, -13, 52, 52, -4, -4, -4, -13 }; /* YYPGOTO[NTERM-NUM]. */ static const yysigned_char yypgoto[] = { -13, -13, -13, -7 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const unsigned char yytable[] = { 15, 12, 16, 13, 14, 0, 23, 24, 21, 0, 26, 27, 28, 29, 30, 2, 3, 0, 4, 5, 6, 0, 7, 4, 5, 6, 0, 7, 8, 9, 17, 18, 19, 20, 9, 21, 0, 0, 25, 17, 18, 19, 20, 0, 21, 0, 0, 31, 17, 18, 19, 20, 0, 21, 22, 17, 18, 19, 20, 0, 21, 19, 20, 0, 21 }; static const yysigned_char yycheck[] = { 7, 13, 9, 6, 14, -1, 13, 14, 12, -1, 17, 18, 19, 20, 21, 0, 1, -1, 3, 4, 5, -1, 7, 3, 4, 5, -1, 7, 13, 14, 7, 8, 9, 10, 14, 12, -1, -1, 15, 7, 8, 9, 10, -1, 12, -1, -1, 15, 7, 8, 9, 10, -1, 12, 13, 7, 8, 9, 10, -1, 12, 9, 10, -1, 12 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { 0, 17, 0, 1, 3, 4, 5, 7, 13, 14, 18, 19, 13, 6, 14, 19, 19, 7, 8, 9, 10, 12, 13, 19, 19, 15, 19, 19, 19, 19, 19, 15 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up",error);\ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ ((Current).first_line = (Rhs)[1].first_line, \ (Current).first_column = (Rhs)[1].first_column, \ (Current).last_line = (Rhs)[N].last_line, \ (Current).last_column = (Rhs)[N].last_column) #endif /* YYLEX -- calling `yylex' with the right arguments. */ /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) # define YYDSYMPRINT(Args) \ do { \ if (yydebug) \ yysymprint Args; \ } while (0) # define YYDSYMPRINTF(Title, Token, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yysymprint (stderr, \ Token, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yy_stack_print (short *bottom, short *top) #else static void yy_stack_print (bottom, top) short *bottom; short *top; #endif { YYFPRINTF (stderr, "Stack now"); for (/* Nothing. */; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yy_reduce_print (int yyrule) #else static void yy_reduce_print (yyrule) int yyrule; #endif { int yyi; unsigned int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ static int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YYDSYMPRINT(Args) # define YYDSYMPRINTF(Title, Token, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { register const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # endif # endif # ifndef yystpcpy # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { register char *yyd = yydest; register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif #endif /* !YYERROR_VERBOSE */ #if YYDEBUG /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) #else static void yysymprint (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; if (yytype < YYNTOKENS) { YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); # ifdef YYPRINT YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif } else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); switch (yytype) { default: break; } YYFPRINTF (yyoutput, ")"); } #endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yydestruct (int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yytype, yyvaluep) int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; switch (yytype) { default: break; } } static symrec * putsym ( symrec * & symtable, char const *sym_name, int sym_type) { symrec *ptr; ptr = reinterpret_cast (malloc (sizeof (symrec))); ptr->name = reinterpret_cast (malloc (strlen (sym_name) + 1)); strcpy (ptr->name,sym_name); ptr->type = sym_type; ptr->value.var = 0; /* Set value to 0 even if fctn. */ ptr->next = reinterpret_cast(symtable); symtable = ptr; return ptr; } static symrec * getsym ( symrec *symtable,char const *sym_name) { symrec *ptr; for (ptr = symtable; ptr != NULL; ptr = reinterpret_cast(ptr->next)) if (strcmp (ptr->name,sym_name) == 0) return ptr; return 0; } static void freesym ( symrec *symtable) { symrec *ptr; for (ptr = symtable; ptr != NULL;) { free (ptr->name); symrec * ptrNext = reinterpret_cast (ptr->next) ; free (ptr); ptr=ptrNext; } } /* Called by yyparse on error. */ static void yyerror (char const * /*s*/) { // Put back if needed //printf ("%s\n", s); } struct init { char const *fname; double (*fnct) (double); }; inline double sin_wrapper (double x) { return sin(x) ; } inline double cos_wrapper (double x) { return cos(x) ; } inline double atan_wrapper (double x) { return atan(x) ; } inline double log_wrapper (double x) { return log(x) ; } inline double exp_wrapper (double x) { return exp(x) ; } inline double sqrt_wrapper (double x) { return sqrt(x) ; } inline double fabs_wrapper (double x) { return fabs(x) ; } inline double floor_wrapper (double x) { return floor(x) ; } inline double ceil_wrapper (double x) { return ceil(x) ; } struct init const arith_fncts[] = { {"sin", sin_wrapper}, {"cos", cos_wrapper}, {"atan", atan_wrapper}, {"ln", log_wrapper}, {"exp", exp_wrapper}, {"sqrt", sqrt_wrapper}, {"fabs", fabs_wrapper}, {"abs", fabs_wrapper}, {"floor", floor_wrapper}, {"ceil", ceil_wrapper}, {NULL, 0} }; /* The symbol table: a chain of `struct symrec'. */ /* Put arithmetic functions in table. */ static void init_table ( symrec * &symtable) { int i; symrec *ptr; for (i = 0; arith_fncts[i].fname != NULL; i++) { ptr = putsym ( symtable,arith_fncts[i].fname, FNCT); ptr->value.fnctptr = arith_fncts[i].fnct; } } static int yylex ( symrec *&symtable, const char * line, int * position, char * & symbuf, int & length, const double * associated, const CoinModelHash & string, int & error, double unsetValue, YYSTYPE &yylval) { int c; int ipos=*position; /* Ignore white space, get first nonwhite character. */ while ((c = line[ipos]) == ' ' || c == '\t') ipos++; if (c == EOF) return 0; /* Char starts a number => parse the number. */ if (c == '.' || isdigit (c)) { sscanf (line+ipos,"%lf", &yylval.val); /* Get first white or other character. */ int nE=0; int nDot=0; if (c=='.') nDot=1; ipos++; // skip possible sign while (true) { c=line[ipos]; if (isdigit(c)) { } else if (!nDot&&c=='.') { nDot=1; } else if (c=='e'&&!nE) { nE=1; if (line[ipos+1]=='+'||line[ipos+1]=='-') ipos++; } else { break; } ipos++; } *position = ipos; return NUM; } /* Char starts an identifier => read the name. */ if (isalpha (c)) { symrec *s; int i; /* Initially make the buffer long enough for a 40-character symbol name. */ if (length == 0) length = 40, symbuf = reinterpret_cast(malloc (length + 1)); i = 0; do { /* If buffer is full, make it bigger. */ if (i == length) { length *= 2; symbuf = reinterpret_cast (realloc (symbuf, length + 1)); } /* Add this character to the buffer. */ symbuf[i++] = static_cast(c); /* Get another character. */ ipos++; c = line[ipos]; } while (isalnum (c)); symbuf[i] = '\0'; s = getsym ( symtable, symbuf); if (s == 0) { // Find in strings int find = string.hash(symbuf); double value; if (find>=0) { value = associated[find]; //printf("symbol %s found with value of %g\n",symbuf,value); if (value==unsetValue) error=CoinMax(error,1); } else { //printf("unknown symbol %s\n",symbuf); value=unsetValue; error=3; } s = putsym (symtable, symbuf, VAR); s->value.var=value; } yylval.tptr = s; *position = ipos; return s->type; } /* Any other character is a token by itself. */ if (c) { *position = ipos+1; return c; } else { *position = ipos; return 10; } } /*----------. | yyparse. | `----------*/ static double yyparse ( symrec *& symtable, const char * line, char * & symbuf, int & length, const double * associated, const CoinModelHash & string, int & error, double unsetValue, int & yychar, YYSTYPE &yylval, int & yynerrs) { int position=0; int nEof=0; // Number of time send of string register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #define YYPOPSTACK (yyvsp--, yyssp--) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = static_cast(yystate); if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyoverflowlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = reinterpret_cast (YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize))); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex( symtable, line,&position,symbuf,length, associated,string,error,unsetValue,yylval); if (yychar==10) { if (nEof) yychar=0; nEof++; } } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = static_cast(YYTRANSLATE (yychar)); YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 5: { //printf ("\t%.10g\n", yyvsp[-1].val); return yyvsp[-1].val;} break; case 6: { yyerrok; ;} break; case 7: { yyval.val = yyvsp[0].val; ;} break; case 8: { yyval.val = yyvsp[0].tptr->value.var; ;} break; case 9: { yyval.val = yyvsp[0].val; yyvsp[-2].tptr->value.var = yyvsp[0].val; ;} break; case 10: { yyval.val = (*(yyvsp[-3].tptr->value.fnctptr))(yyvsp[-1].val); ;} break; case 11: { yyval.val = yyvsp[-2].val + yyvsp[0].val; ;} break; case 12: { yyval.val = yyvsp[-2].val - yyvsp[0].val; ;} break; case 13: { yyval.val = yyvsp[-2].val * yyvsp[0].val; ;} break; case 14: { yyval.val = yyvsp[-2].val / yyvsp[0].val; ;} break; case 15: { yyval.val = -yyvsp[0].val; ;} break; case 16: { yyval.val = pow (yyvsp[-2].val, yyvsp[0].val); ;} break; case 17: { yyval.val = yyvsp[-1].val; ;} break; } /* Line 993 of yacc.c. */ yyvsp -= yylen; yyssp -= yylen; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { error = CoinMax(error,2); ++yynerrs; #if YYERROR_VERBOSE yyn = yypact[yystate]; if (YYPACT_NINF < yyn && yyn < YYLAST) { YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); const char* yyprefix; char *yymsg; int yyx; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 0; yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); yycount += 1; if (yycount == 5) { yysize = 0; break; } } yysize += (sizeof ("syntax error, unexpected ") + yystrlen (yytname[yytype])); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); yyp = yystpcpy (yyp, yytname[yytype]); if (yycount < 5) { yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { yyp = yystpcpy (yyp, yyprefix); yyp = yystpcpy (yyp, yytname[yyx]); yyprefix = " or "; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("syntax error; also virtual memory exhausted"); } else #endif /* YYERROR_VERBOSE */ yyerror ("syntax error"); } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* If at end of input, pop the error token, then the rest of the stack, then return failure. */ if (yychar == YYEOF) for (;;) { YYPOPSTACK; if (yyssp == yyss) YYABORT; YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[*yyssp], yyvsp); } } else { YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); yydestruct (yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: #ifdef __GNUC__ /* Pacify GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) goto yyerrorlab; #endif yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[yystate], yyvsp); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*----------------------------------------------. | yyoverflowlab -- parser overflow comes here. | `----------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ #endif yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } double CoinModel::getDoubleFromString(CoinYacc & info,const char * string) { if (!info.length) { info.symtable=NULL; info.symbuf=NULL; init_table ( info.symtable); info.unsetValue=unsetValue(); } int error=0; // Here to make thread safe /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; double value = yyparse ( info.symtable, string,info.symbuf,info.length, associated_,string_,error,info.unsetValue, yychar, yylval, yynerrs); if (error){ // 1 means strings found but unset value // 2 syntax error // 3 string not found if (logLevel_>=1) printf("string %s returns value %g and error-code %d\n", string,value,error); value = info.unsetValue; } else if (logLevel_>=2) { printf("%s computes as %g\n",string,value); } return value; } // Frees value memory void CoinModel::freeStringMemory(CoinYacc & info) { freesym( info.symtable); free(info.symbuf); info.length=0; } // Adds one string, returns index static int addString(CoinModelHash & stringX, const char * string) { int position = stringX.hash(string); if (position<0) { position = stringX.numberItems(); stringX.addHash(position,string); } return position; } double getFunctionValueFromString(const char * string, const char * x, double xValue) { CoinYacc info; double unset = -1.23456787654321e-97; info.length=0; info.symtable=NULL; info.symbuf=NULL; init_table ( info.symtable); info.unsetValue=unset; int error=0; double associated[2]; associated[0]=xValue; associated[1]=unset; CoinModelHash stringX; addString(stringX,x); addString(stringX,string); // Here to make thread safe /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; double value = yyparse ( info.symtable, string,info.symbuf,info.length, associated,stringX,error,info.unsetValue, yychar, yylval, yynerrs); int logLevel_=2; if (error){ // 1 means strings found but unset value // 2 syntax error // 3 string not found if (logLevel_>=1) printf("string %s returns value %g and error-code %d\n", string,value,error); value = unset; } else if (logLevel_>=2) { printf("%s computes as %g\n",string,value); } freesym( info.symtable); return value; } CoinMP-1.8.3/CoinUtils/src/CoinFloatEqual.hpp0000644000175000017500000000723411552534611017404 0ustar renerene/* $Id: CoinFloatEqual.hpp 1416 2011-04-17 09:57:29Z stefan $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinFloatEqual_H #define CoinFloatEqual_H #include #include #include "CoinFinite.hpp" /*! \file CoinFloatEqual.hpp \brief Function objects for testing equality of real numbers. Two objects are provided; one tests for equality to an absolute tolerance, one to a scaled tolerance. The tests will handle IEEE floating point, but note that infinity == infinity. Mathematicians are rolling in their graves, but this matches the behaviour for the common practice of using DBL_MAX (numeric_limits::max(), or similar large finite number) as infinity.

    Example usage: @verbatim double d1 = 3.14159 ; double d2 = d1 ; double d3 = d1+.0001 ; CoinAbsFltEq eq1 ; CoinAbsFltEq eq2(.001) ; assert( eq1(d1,d2) ) ; assert( !eq1(d1,d3) ) ; assert( eq2(d1,d3) ) ; @endverbatim CoinRelFltEq follows the same pattern. */ /*! \brief Equality to an absolute tolerance Operands are considered equal if their difference is within an epsilon ; the test does not consider the relative magnitude of the operands. */ class CoinAbsFltEq { public: //! Compare function inline bool operator() (const double f1, const double f2) const { if (CoinIsnan(f1) || CoinIsnan(f2)) return false ; if (f1 == f2) return true ; return (fabs(f1-f2) < epsilon_) ; } /*! \name Constructors and destructors */ //@{ /*! \brief Default constructor Default tolerance is 1.0e-10. */ CoinAbsFltEq () : epsilon_(1.e-10) {} //! Alternate constructor with epsilon as a parameter CoinAbsFltEq (const double epsilon) : epsilon_(epsilon) {} //! Destructor virtual ~CoinAbsFltEq () {} //! Copy constructor CoinAbsFltEq (const CoinAbsFltEq& src) : epsilon_(src.epsilon_) {} //! Assignment CoinAbsFltEq& operator= (const CoinAbsFltEq& rhs) { if (this != &rhs) epsilon_ = rhs.epsilon_ ; return (*this) ; } //@} private: /*! \name Private member data */ //@{ //! Equality tolerance. double epsilon_ ; //@} } ; /*! \brief Equality to a scaled tolerance Operands are considered equal if their difference is within a scaled epsilon calculated as epsilon_*(1+CoinMax(|f1|,|f2|)). */ class CoinRelFltEq { public: //! Compare function inline bool operator() (const double f1, const double f2) const { if (CoinIsnan(f1) || CoinIsnan(f2)) return false ; if (f1 == f2) return true ; if (!CoinFinite(f1) || !CoinFinite(f2)) return false ; double tol = (fabs(f1)>fabs(f2))?fabs(f1):fabs(f2) ; return (fabs(f1-f2) <= epsilon_*(1+tol)) ; } /*! \name Constructors and destructors */ //@{ #ifndef COIN_FLOAT /*! Default constructor Default tolerance is 1.0e-10. */ CoinRelFltEq () : epsilon_(1.e-10) {} #else /*! Default constructor Default tolerance is 1.0e-6. */ CoinRelFltEq () : epsilon_(1.e-6) {} ; // as float #endif //! Alternate constructor with epsilon as a parameter CoinRelFltEq (const double epsilon) : epsilon_(epsilon) {} //! Destructor virtual ~CoinRelFltEq () {} //! Copy constructor CoinRelFltEq (const CoinRelFltEq & src) : epsilon_(src.epsilon_) {} //! Assignment CoinRelFltEq& operator= (const CoinRelFltEq& rhs) { if (this != &rhs) epsilon_ = rhs.epsilon_ ; return (*this) ; } //@} private: /*! \name Private member data */ //@{ //! Base equality tolerance double epsilon_ ; //@} } ; #endif CoinMP-1.8.3/CoinUtils/src/CoinWarmStartBasis.hpp0000644000175000017500000003532711670766534020275 0ustar renerene/* $Id: CoinWarmStartBasis.hpp 1515 2011-12-10 23:38:04Z lou $ */ /*! \legal Copyright (C) 2000 -- 2003, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ /*! \file CoinWarmStart.hpp \brief Declaration of the generic simplex (basis-oriented) warm start class. Also contains a basis diff class. */ #ifndef CoinWarmStartBasis_H #define CoinWarmStartBasis_H #include #include "CoinSort.hpp" #include "CoinHelperFunctions.hpp" #include "CoinWarmStart.hpp" //############################################################################# /*! \class CoinWarmStartBasis \brief The default COIN simplex (basis-oriented) warm start class CoinWarmStartBasis provides for a warm start object which contains the status of each variable (structural and artificial). \todo Modify this class so that the number of status entries per byte and bytes per status vector allocation unit are not hardcoded. At the least, collect this into a couple of macros. \todo Consider separate fields for allocated capacity and actual basis size. We could avoid some reallocation, at the price of retaining more space than we need. Perhaps more important, we could do much better sanity checks. */ class CoinWarmStartBasis : public virtual CoinWarmStart { public: /*! \brief Enum for status of variables Matches CoinPrePostsolveMatrix::Status, without superBasic. Most code that converts between CoinPrePostsolveMatrix::Status and CoinWarmStartBasis::Status will break if this correspondence is broken. The status vectors are currently packed using two bits per status code, four codes per byte. The location of the status information for variable \c i is in byte i>>2 and occupies bits 0:1 if i\%4 == 0, bits 2:3 if i\%4 == 1, etc. The non-member functions getStatus(const char*,int) and setStatus(char*,int,CoinWarmStartBasis::Status) are provided to hide details of the packing. */ enum Status { isFree = 0x00, ///< Nonbasic free variable basic = 0x01, ///< Basic variable atUpperBound = 0x02, ///< Nonbasic at upper bound atLowerBound = 0x03 ///< Nonbasic at lower bound }; /** \brief Transfer vector entry for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*) */ typedef CoinTriple XferEntry ; /** \brief Transfer vector for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*) */ typedef std::vector XferVec ; public: /*! \name Methods to get and set basis information. The status of variables is kept in a pair of arrays, one for structural variables, and one for artificials (aka logicals and slacks). The status is coded using the values of the Status enum. \sa CoinWarmStartBasis::Status for a description of the packing used in the status arrays. */ //@{ /// Return the number of structural variables inline int getNumStructural() const { return numStructural_; } /// Return the number of artificial variables inline int getNumArtificial() const { return numArtificial_; } /** Return the number of basic structurals A fast test for an all-slack basis. */ int numberBasicStructurals() const ; /// Return the status of the specified structural variable. inline Status getStructStatus(int i) const { const int st = (structuralStatus_[i>>2] >> ((i&3)<<1)) & 3; return static_cast(st); } /// Set the status of the specified structural variable. inline void setStructStatus(int i, Status st) { char& st_byte = structuralStatus_[i>>2]; st_byte = static_cast(st_byte & ~(3 << ((i&3)<<1))) ; st_byte = static_cast(st_byte | (st << ((i&3)<<1))) ; } /** Return the status array for the structural variables The status information is stored using the codes defined in the Status enum, 2 bits per variable, packed 4 variables per byte. */ inline char * getStructuralStatus() { return structuralStatus_; } /** \c const overload for \link CoinWarmStartBasis::getStructuralStatus() getStructuralStatus() \endlink */ inline const char * getStructuralStatus() const { return structuralStatus_; } /** As for \link getStructuralStatus() getStructuralStatus \endlink, but returns the status array for the artificial variables. */ inline char * getArtificialStatus() { return artificialStatus_; } /// Return the status of the specified artificial variable. inline Status getArtifStatus(int i) const { const int st = (artificialStatus_[i>>2] >> ((i&3)<<1)) & 3; return static_cast(st); } /// Set the status of the specified artificial variable. inline void setArtifStatus(int i, Status st) { char& st_byte = artificialStatus_[i>>2]; st_byte = static_cast(st_byte & ~(3 << ((i&3)<<1))) ; st_byte = static_cast(st_byte | (st << ((i&3)<<1))) ; } /** \c const overload for \link CoinWarmStartBasis::getArtificialStatus() getArtificialStatus() \endlink */ inline const char * getArtificialStatus() const { return artificialStatus_; } //@} /*! \name Basis `diff' methods */ //@{ /*! \brief Generate a `diff' that can convert the warm start basis passed as a parameter to the warm start basis specified by \c this. The capabilities are limited: the basis passed as a parameter can be no larger than the basis pointed to by \c this. */ virtual CoinWarmStartDiff* generateDiff (const CoinWarmStart *const oldCWS) const ; /*! \brief Apply \p diff to this basis Update this basis by applying \p diff. It's assumed that the allocated capacity of the basis is sufficiently large. */ virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ; //@} /*! \name Methods to modify the warm start object */ //@{ /*! \brief Set basis capacity; existing basis is discarded. After execution of this routine, the warm start object does not describe a valid basis: all structural and artificial variables have status isFree. */ virtual void setSize(int ns, int na) ; /*! \brief Set basis capacity; existing basis is maintained. After execution of this routine, the warm start object describes a valid basis: the status of new structural variables (added columns) is set to nonbasic at lower bound, and the status of new artificial variables (added rows) is set to basic. (The basis can be invalid if new structural variables do not have a finite lower bound.) */ virtual void resize (int newNumberRows, int newNumberColumns); /** \brief Delete a set of rows from the basis \warning This routine assumes that the set of indices to be deleted is sorted in ascending order and contains no duplicates. Use deleteRows() if this is not the case. \warning The resulting basis is guaranteed valid only if all deleted constraints are slack (hence the associated logicals are basic). Removal of a tight constraint with a nonbasic logical implies that some basic variable must be made nonbasic. This correction is left to the client. */ virtual void compressRows (int tgtCnt, const int *tgts) ; /** \brief Delete a set of rows from the basis \warning The resulting basis is guaranteed valid only if all deleted constraints are slack (hence the associated logicals are basic). Removal of a tight constraint with a nonbasic logical implies that some basic variable must be made nonbasic. This correction is left to the client. */ virtual void deleteRows(int rawTgtCnt, const int *rawTgts) ; /** \brief Delete a set of columns from the basis \warning The resulting basis is guaranteed valid only if all deleted variables are nonbasic. Removal of a basic variable implies that some nonbasic variable must be made basic. This correction is left to the client. */ virtual void deleteColumns(int number, const int * which); /** \brief Merge entries from a source basis into this basis. \warning It's the client's responsibility to ensure validity of the merged basis, if that's important to the application. The vector xferCols (xferRows) specifies runs of entries to be taken from the source basis and placed in this basis. Each entry is a CoinTriple, with first specifying the starting source index of a run, second specifying the starting destination index, and third specifying the run length. */ virtual void mergeBasis(const CoinWarmStartBasis *src, const XferVec *xferRows, const XferVec *xferCols) ; //@} /*! \name Constructors, destructors, and related functions */ //@{ /** Default constructor Creates a warm start object representing an empty basis (0 rows, 0 columns). */ CoinWarmStartBasis(); /** Constructs a warm start object with the specified status vectors. The parameters are copied. Consider assignBasisStatus(int,int,char*&,char*&) if the object should assume ownership. \sa CoinWarmStartBasis::Status for a description of the packing used in the status arrays. */ CoinWarmStartBasis(int ns, int na, const char* sStat, const char* aStat) ; /** Copy constructor */ CoinWarmStartBasis(const CoinWarmStartBasis& ws) ; /** `Virtual constructor' */ virtual CoinWarmStart *clone() const { return new CoinWarmStartBasis(*this); } /** Destructor */ virtual ~CoinWarmStartBasis(); /** Assignment */ virtual CoinWarmStartBasis& operator=(const CoinWarmStartBasis& rhs) ; /** Assign the status vectors to be the warm start information. In this method the CoinWarmStartBasis object assumes ownership of the pointers and upon return the argument pointers will be NULL. If copying is desirable, use the \link CoinWarmStartBasis(int,int,const char*,const char*) array constructor \endlink or the \link operator=(const CoinWarmStartBasis&) assignment operator \endlink. \note The pointers passed to this method will be freed using delete[], so they must be created using new[]. */ virtual void assignBasisStatus(int ns, int na, char*& sStat, char*& aStat) ; //@} /*! \name Miscellaneous methods */ //@{ /// Prints in readable format (for debug) virtual void print() const; /// Returns true if full basis (for debug) bool fullBasis() const; /// Returns true if full basis and fixes up (for debug) bool fixFullBasis(); //@} protected: /** \name Protected data members \sa CoinWarmStartBasis::Status for a description of the packing used in the status arrays. */ //@{ /// The number of structural variables int numStructural_; /// The number of artificial variables int numArtificial_; /// The maximum sise (in ints - actually 4*char) (so resize does not need to do new) int maxSize_; /** The status of the structural variables. */ char * structuralStatus_; /** The status of the artificial variables. */ char * artificialStatus_; //@} }; /*! \relates CoinWarmStartBasis \brief Get the status of the specified variable in the given status array. */ inline CoinWarmStartBasis::Status getStatus(const char *array, int i) { const int st = (array[i>>2] >> ((i&3)<<1)) & 3; return static_cast(st); } /*! \relates CoinWarmStartBasis \brief Set the status of the specified variable in the given status array. */ inline void setStatus(char * array, int i, CoinWarmStartBasis::Status st) { char& st_byte = array[i>>2]; st_byte = static_cast(st_byte & ~(3 << ((i&3)<<1))) ; st_byte = static_cast(st_byte | (st << ((i&3)<<1))) ; } /*! \relates CoinWarmStartBasis \brief Generate a print string for a status code */ const char *statusName(CoinWarmStartBasis::Status status) ; /*! \class CoinWarmStartBasisDiff \brief A `diff' between two CoinWarmStartBasis objects This class exists in order to hide from the world the details of calculating and representing a `diff' between two CoinWarmStartBasis objects. For convenience, assignment, cloning, and deletion are visible to the world, and default and copy constructors are made available to derived classes. Knowledge of the rest of this structure, and of generating and applying diffs, is restricted to the friend functions CoinWarmStartBasis::generateDiff() and CoinWarmStartBasis::applyDiff(). The actual data structure is an unsigned int vector, #difference_ which starts with indices of changed and then has values starting after #sze_ \todo This is a pretty generic structure, and vector diff is a pretty generic activity. We should be able to convert this to a template. \todo Using unsigned int as the data type for the diff vectors might help to contain the damage when this code is inevitably compiled for 64 bit architectures. But the notion of int as 4 bytes is hardwired into CoinWarmStartBasis, so changes are definitely required. */ class CoinWarmStartBasisDiff : public virtual CoinWarmStartDiff { public: /*! \brief `Virtual constructor' */ virtual CoinWarmStartDiff *clone() const { CoinWarmStartBasisDiff *cwsbd = new CoinWarmStartBasisDiff(*this) ; return (dynamic_cast(cwsbd)) ; } /*! \brief Assignment */ virtual CoinWarmStartBasisDiff &operator= (const CoinWarmStartBasisDiff &rhs) ; /*! \brief Destructor */ virtual ~CoinWarmStartBasisDiff(); protected: /*! \brief Default constructor This is protected (rather than private) so that derived classes can see it when they make their default constructor protected or private. */ CoinWarmStartBasisDiff () : sze_(0), difference_(0) { } /*! \brief Copy constructor For convenience when copying objects containing CoinWarmStartBasisDiff objects. But consider whether you should be using #clone() to retain polymorphism. This is protected (rather than private) so that derived classes can see it when they make their copy constructor protected or private. */ CoinWarmStartBasisDiff (const CoinWarmStartBasisDiff &cwsbd) ; /*! \brief Standard constructor */ CoinWarmStartBasisDiff (int sze, const unsigned int *const diffNdxs, const unsigned int *const diffVals) ; /*! \brief Constructor when full is smaller than diff!*/ CoinWarmStartBasisDiff (const CoinWarmStartBasis * rhs); private: friend CoinWarmStartDiff* CoinWarmStartBasis::generateDiff(const CoinWarmStart *const oldCWS) const ; friend void CoinWarmStartBasis::applyDiff(const CoinWarmStartDiff *const diff) ; /*! \brief Number of entries (and allocated capacity), in units of \c int. */ int sze_ ; /*! \brief Array of diff indices and diff values */ unsigned int *difference_ ; } ; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveUseless.hpp0000644000175000017500000000353112055734244020511 0ustar renerene/* $Id: CoinPresolveUseless.hpp 1566 2012-11-29 19:33:56Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveUseless_H #define CoinPresolveUseless_H #define USELESS 20 class useless_constraint_action : public CoinPresolveAction { struct action { double rlo; double rup; const int *rowcols; const double *rowels; int row; int ninrow; }; const int nactions_; const action *const actions_; useless_constraint_action(int nactions, const action *actions, const CoinPresolveAction *next); public: const char *name() const; // These rows are asserted to be useless, // that is, given a solution the row activity // must be in range. static const CoinPresolveAction *presolve(CoinPresolveMatrix * prob, const int *useless_rows, int nuseless_rows, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~useless_constraint_action(); }; /*! \relates useless_constraint_action \brief Scan constraints looking for useless constraints A front end to identify useless constraints and hand them to useless_constraint_action::presolve() for processing. In a bit more detail, the routine implements a greedy algorithm that identifies a set of necessary constraints. A constraint is necessary if it implies a tighter bound on a variable than the original column bound. These tighter column bounds are then used to calculate row activity and identify constraints that are useless given the presence of the necessary constraints. */ const CoinPresolveAction *testRedundant(CoinPresolveMatrix *prob, const CoinPresolveAction *next) ; #endif CoinMP-1.8.3/CoinUtils/src/CoinWarmStartVector.hpp0000644000175000017500000003157211654260357020466 0ustar renerene/* $Id: CoinWarmStartVector.hpp 1498 2011-11-02 15:25:35Z mjs $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinWarmStartVector_H #define CoinWarmStartVector_H #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinHelperFunctions.hpp" #include "CoinWarmStart.hpp" //############################################################################# /** WarmStart information that is only a vector */ template class CoinWarmStartVector : public virtual CoinWarmStart { protected: inline void gutsOfDestructor() { delete[] values_; } inline void gutsOfCopy(const CoinWarmStartVector& rhs) { size_ = rhs.size_; values_ = new T[size_]; CoinDisjointCopyN(rhs.values_, size_, values_); } public: /// return the size of the vector int size() const { return size_; } /// return a pointer to the array of vectors const T* values() const { return values_; } /** Assign the vector to be the warmstart information. In this method the object assumes ownership of the pointer and upon return #vector will be a NULL pointer. If copying is desirable use the constructor. */ void assignVector(int size, T*& vec) { size_ = size; delete[] values_; values_ = vec; vec = NULL; } CoinWarmStartVector() : size_(0), values_(NULL) {} CoinWarmStartVector(int size, const T* vec) : size_(size), values_(new T[size]) { CoinDisjointCopyN(vec, size, values_); } CoinWarmStartVector(const CoinWarmStartVector& rhs) { gutsOfCopy(rhs); } CoinWarmStartVector& operator=(const CoinWarmStartVector& rhs) { if (this != &rhs) { gutsOfDestructor(); gutsOfCopy(rhs); } return *this; } inline void swap(CoinWarmStartVector& rhs) { if (this != &rhs) { std::swap(size_, rhs.size_); std::swap(values_, rhs.values_); } } /** `Virtual constructor' */ virtual CoinWarmStart *clone() const { return new CoinWarmStartVector(*this); } virtual ~CoinWarmStartVector() { gutsOfDestructor(); } /*! \brief Clear the data Make it appear as if the warmstart was just created using the default constructor. */ inline void clear() { size_ = 0; delete[] values_; values_ = NULL; } /*! \name Vector warm start `diff' methods */ //@{ /*! \brief Generate a `diff' that can convert the warm start passed as a parameter to the warm start specified by \c this. The capabilities are limited: the basis passed as a parameter can be no larger than the basis pointed to by \c this. */ virtual CoinWarmStartDiff* generateDiff (const CoinWarmStart *const oldCWS) const ; /*! \brief Apply \p diff to this warm start. Update this warm start by applying \p diff. It's assumed that the allocated capacity of the warm start is sufficiently large. */ virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ; //@} private: ///@name Private data members //@{ /// the size of the vector int size_; /// the vector itself T* values_; //@} }; //============================================================================= /*! \class CoinWarmStartVectorDiff \brief A `diff' between two CoinWarmStartVector objects This class exists in order to hide from the world the details of calculating and representing a `diff' between two CoinWarmStartVector objects. For convenience, assignment, cloning, and deletion are visible to the world, and default and copy constructors are made available to derived classes. Knowledge of the rest of this structure, and of generating and applying diffs, is restricted to the friend functions CoinWarmStartVector::generateDiff() and CoinWarmStartVector::applyDiff(). The actual data structure is a pair of vectors, #diffNdxs_ and #diffVals_. */ template class CoinWarmStartVectorDiff : public virtual CoinWarmStartDiff { friend CoinWarmStartDiff* CoinWarmStartVector::generateDiff(const CoinWarmStart *const oldCWS) const; friend void CoinWarmStartVector::applyDiff(const CoinWarmStartDiff *const diff) ; public: /*! \brief `Virtual constructor' */ virtual CoinWarmStartDiff * clone() const { return new CoinWarmStartVectorDiff(*this) ; } /*! \brief Assignment */ virtual CoinWarmStartVectorDiff & operator= (const CoinWarmStartVectorDiff& rhs) ; /*! \brief Destructor */ virtual ~CoinWarmStartVectorDiff() { delete[] diffNdxs_ ; delete[] diffVals_ ; } inline void swap(CoinWarmStartVectorDiff& rhs) { if (this != &rhs) { std::swap(sze_, rhs.sze_); std::swap(diffNdxs_, rhs.diffNdxs_); std::swap(diffVals_, rhs.diffVals_); } } /*! \brief Default constructor */ CoinWarmStartVectorDiff () : sze_(0), diffNdxs_(0), diffVals_(NULL) {} /*! \brief Copy constructor For convenience when copying objects containing CoinWarmStartVectorDiff objects. But consider whether you should be using #clone() to retain polymorphism. */ CoinWarmStartVectorDiff(const CoinWarmStartVectorDiff& rhs) ; /*! \brief Standard constructor */ CoinWarmStartVectorDiff(int sze, const unsigned int* const diffNdxs, const T* const diffVals) ; /*! \brief Clear the data Make it appear as if the diff was just created using the default constructor. */ inline void clear() { sze_ = 0; delete[] diffNdxs_; diffNdxs_ = NULL; delete[] diffVals_; diffVals_ = NULL; } private: /*! \brief Number of entries (and allocated capacity), in units of \c T. */ int sze_ ; /*! \brief Array of diff indices */ unsigned int* diffNdxs_ ; /*! \brief Array of diff values */ T* diffVals_ ; }; //############################################################################## template class CoinWarmStartVectorPair : public virtual CoinWarmStart { private: CoinWarmStartVector t_; CoinWarmStartVector u_; public: inline int size0() const { return t_.size(); } inline int size1() const { return u_.size(); } inline const T* values0() const { return t_.values(); } inline const U* values1() const { return u_.values(); } inline void assignVector0(int size, T*& vec) { t_.assignVector(size, vec); } inline void assignVector1(int size, U*& vec) { u_.assignVector(size, vec); } CoinWarmStartVectorPair() {} CoinWarmStartVectorPair(int s0, const T* v0, int s1, const U* v1) : t_(s0, v0), u_(s1, v1) {} CoinWarmStartVectorPair(const CoinWarmStartVectorPair& rhs) : t_(rhs.t_), u_(rhs.u_) {} CoinWarmStartVectorPair& operator=(const CoinWarmStartVectorPair& rhs) { if (this != &rhs) { t_ = rhs.t_; u_ = rhs.u_; } return *this; } inline void swap(CoinWarmStartVectorPair& rhs) { t_.swap(rhs.t_); u_.swap(rhs.u_); } virtual CoinWarmStart *clone() const { return new CoinWarmStartVectorPair(*this); } virtual ~CoinWarmStartVectorPair() {} inline void clear() { t_.clear(); u_.clear(); } virtual CoinWarmStartDiff* generateDiff (const CoinWarmStart *const oldCWS) const ; virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ; }; //============================================================================= template class CoinWarmStartVectorPairDiff : public virtual CoinWarmStartDiff { friend CoinWarmStartDiff* CoinWarmStartVectorPair::generateDiff(const CoinWarmStart *const oldCWS) const; friend void CoinWarmStartVectorPair::applyDiff(const CoinWarmStartDiff *const diff) ; private: CoinWarmStartVectorDiff tdiff_; CoinWarmStartVectorDiff udiff_; public: CoinWarmStartVectorPairDiff() {} CoinWarmStartVectorPairDiff(const CoinWarmStartVectorPairDiff& rhs) : tdiff_(rhs.tdiff_), udiff_(rhs.udiff_) {} virtual ~CoinWarmStartVectorPairDiff() {} virtual CoinWarmStartVectorPairDiff& operator=(const CoinWarmStartVectorPairDiff& rhs) { if (this != &rhs) { tdiff_ = rhs.tdiff_; udiff_ = rhs.udiff_; } return *this; } virtual CoinWarmStartDiff * clone() const { return new CoinWarmStartVectorPairDiff(*this) ; } inline void swap(CoinWarmStartVectorPairDiff& rhs) { tdiff_.swap(rhs.tdiff_); udiff_.swap(rhs.udiff_); } inline void clear() { tdiff_.clear(); udiff_.clear(); } }; //############################################################################## //############################################################################# /* Generate a `diff' that can convert the warm start passed as a parameter to the warm start specified by this. The capabilities are limited: the basis passed as a parameter can be no larger than the basis pointed to by this. */ template CoinWarmStartDiff* CoinWarmStartVector::generateDiff(const CoinWarmStart *const oldCWS) const { /* Make sure the parameter is CoinWarmStartVector or derived class. */ const CoinWarmStartVector* oldVector = dynamic_cast*>(oldCWS); if (!oldVector) { throw CoinError("Old warm start not derived from CoinWarmStartVector.", "generateDiff","CoinWarmStartVector") ; } const CoinWarmStartVector* newVector = this ; /* Make sure newVector is equal or bigger than oldVector. Calculate the worst case number of diffs and allocate vectors to hold them. */ const int oldCnt = oldVector->size() ; const int newCnt = newVector->size() ; assert(newCnt >= oldCnt) ; unsigned int *diffNdx = new unsigned int [newCnt]; T* diffVal = new T[newCnt]; /* Scan the vector vectors. For the portion of the vectors which overlap, create diffs. Then add any additional entries from newVector. */ const T*oldVal = oldVector->values() ; const T*newVal = newVector->values() ; int numberChanged = 0 ; int i ; for (i = 0 ; i < oldCnt ; i++) { if (oldVal[i] != newVal[i]) { diffNdx[numberChanged] = i ; diffVal[numberChanged++] = newVal[i] ; } } for ( ; i < newCnt ; i++) { diffNdx[numberChanged] = i ; diffVal[numberChanged++] = newVal[i] ; } /* Create the object of our desire. */ CoinWarmStartVectorDiff *diff = new CoinWarmStartVectorDiff(numberChanged,diffNdx,diffVal) ; /* Clean up and return. */ delete[] diffNdx ; delete[] diffVal ; return diff; // return (dynamic_cast*>(diff)) ; } /* Apply diff to this warm start. Update this warm start by applying diff. It's assumed that the allocated capacity of the warm start is sufficiently large. */ template void CoinWarmStartVector::applyDiff (const CoinWarmStartDiff *const cwsdDiff) { /* Make sure we have a CoinWarmStartVectorDiff */ const CoinWarmStartVectorDiff* diff = dynamic_cast*>(cwsdDiff) ; if (!diff) { throw CoinError("Diff not derived from CoinWarmStartVectorDiff.", "applyDiff","CoinWarmStartVector") ; } /* Application is by straighforward replacement of words in the vector vector. */ const int numberChanges = diff->sze_ ; const unsigned int *diffNdxs = diff->diffNdxs_ ; const T* diffVals = diff->diffVals_ ; T* vals = this->values_ ; for (int i = 0 ; i < numberChanges ; i++) { unsigned int diffNdx = diffNdxs[i] ; T diffVal = diffVals[i] ; vals[diffNdx] = diffVal ; } } //############################################################################# // Assignment template CoinWarmStartVectorDiff& CoinWarmStartVectorDiff::operator=(const CoinWarmStartVectorDiff &rhs) { if (this != &rhs) { if (sze_ > 0) { delete[] diffNdxs_ ; delete[] diffVals_ ; } sze_ = rhs.sze_ ; if (sze_ > 0) { diffNdxs_ = new unsigned int[sze_] ; memcpy(diffNdxs_,rhs.diffNdxs_,sze_*sizeof(unsigned int)) ; diffVals_ = new T[sze_] ; memcpy(diffVals_,rhs.diffVals_,sze_*sizeof(T)) ; } else { diffNdxs_ = 0 ; diffVals_ = 0 ; } } return (*this) ; } // Copy constructor template CoinWarmStartVectorDiff::CoinWarmStartVectorDiff(const CoinWarmStartVectorDiff &rhs) : sze_(rhs.sze_), diffNdxs_(0), diffVals_(0) { if (sze_ > 0) { diffNdxs_ = new unsigned int[sze_] ; memcpy(diffNdxs_,rhs.diffNdxs_,sze_*sizeof(unsigned int)) ; diffVals_ = new T[sze_] ; memcpy(diffVals_,rhs.diffVals_,sze_*sizeof(T)) ; } } /// Standard constructor template CoinWarmStartVectorDiff::CoinWarmStartVectorDiff (int sze, const unsigned int *const diffNdxs, const T *const diffVals) : sze_(sze), diffNdxs_(0), diffVals_(0) { if (sze > 0) { diffNdxs_ = new unsigned int[sze] ; memcpy(diffNdxs_,diffNdxs,sze*sizeof(unsigned int)) ; diffVals_ = new T[sze] ; memcpy(diffVals_,diffVals,sze*sizeof(T)) ; } } #endif CoinMP-1.8.3/CoinUtils/src/CoinWarmStartPrimalDual.cpp0000644000175000017500000000441411510461170021227 0ustar renerene/* $Id: CoinWarmStartPrimalDual.cpp 1373 2011-01-03 23:57:44Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include "CoinWarmStartPrimalDual.hpp" #include //############################################################################# /* Generate a `diff' that can convert the warm start passed as a parameter to the warm start specified by this. The capabilities are limited: the basis passed as a parameter can be no larger than the basis pointed to by this. */ CoinWarmStartDiff* CoinWarmStartPrimalDual::generateDiff (const CoinWarmStart *const oldCWS) const { /* Make sure the parameter is CoinWarmStartPrimalDual or derived class. */ const CoinWarmStartPrimalDual *old = dynamic_cast(oldCWS) ; if (!old) { throw CoinError("Old warm start not derived from CoinWarmStartPrimalDual.", "generateDiff","CoinWarmStartPrimalDual") ; } CoinWarmStartPrimalDualDiff* diff = new CoinWarmStartPrimalDualDiff; CoinWarmStartDiff* vecdiff; vecdiff = primal_.generateDiff(&old->primal_); diff->primalDiff_.swap(*dynamic_cast*>(vecdiff)); delete vecdiff; vecdiff = dual_.generateDiff(&old->dual_); diff->dualDiff_.swap(*dynamic_cast*>(vecdiff)); delete vecdiff; return diff; } //############################################################################# /* Apply diff to this warm start. Update this warm start by applying diff. It's assumed that the allocated capacity of the warm start is sufficiently large. */ void CoinWarmStartPrimalDual::applyDiff (const CoinWarmStartDiff *const cwsdDiff) { /* Make sure we have a CoinWarmStartPrimalDualDiff */ const CoinWarmStartPrimalDualDiff *diff = dynamic_cast(cwsdDiff) ; if (!diff) { throw CoinError("Diff not derived from CoinWarmStartPrimalDualDiff.", "applyDiff","CoinWarmStartPrimalDual") ; } primal_.applyDiff(&diff->primalDiff_); dual_.applyDiff(&diff->dualDiff_); } CoinMP-1.8.3/CoinUtils/src/CoinWarmStartDual.hpp0000644000175000017500000001152411510456064020075 0ustar renerene/* $Id: CoinWarmStartDual.hpp 1372 2011-01-03 23:31:00Z lou $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinWarmStartDual_H #define CoinWarmStartDual_H #include "CoinHelperFunctions.hpp" #include "CoinWarmStart.hpp" #include "CoinWarmStartVector.hpp" //############################################################################# /** WarmStart information that is only a dual vector */ class CoinWarmStartDual : public virtual CoinWarmStart { public: /// return the size of the dual vector inline int size() const { return dual_.size(); } /// return a pointer to the array of duals inline const double * dual() const { return dual_.values(); } /** Assign the dual vector to be the warmstart information. In this method the object assumes ownership of the pointer and upon return "dual" will be a NULL pointer. If copying is desirable use the constructor. */ inline void assignDual(int size, double *& dual) { dual_.assignVector(size, dual); } CoinWarmStartDual() {} CoinWarmStartDual(int size, const double * dual) : dual_(size, dual) {} CoinWarmStartDual(const CoinWarmStartDual& rhs) : dual_(rhs.dual_) {} CoinWarmStartDual& operator=(const CoinWarmStartDual& rhs) { if (this != &rhs) { dual_ = rhs.dual_; } return *this; } /** `Virtual constructor' */ virtual CoinWarmStart *clone() const { return new CoinWarmStartDual(*this); } virtual ~CoinWarmStartDual() {} /*! \name Dual warm start `diff' methods */ //@{ /*! \brief Generate a `diff' that can convert the warm start passed as a parameter to the warm start specified by \c this. The capabilities are limited: the basis passed as a parameter can be no larger than the basis pointed to by \c this. */ virtual CoinWarmStartDiff* generateDiff (const CoinWarmStart *const oldCWS) const ; /*! \brief Apply \p diff to this warm start. Update this warm start by applying \p diff. It's assumed that the allocated capacity of the warm start is sufficiently large. */ virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ; #if 0 protected: inline const CoinWarmStartVector& warmStartVector() const { return dual_; } #endif //@} private: ///@name Private data members CoinWarmStartVector dual_; }; //############################################################################# /*! \class CoinWarmStartDualDiff \brief A `diff' between two CoinWarmStartDual objects This class exists in order to hide from the world the details of calculating and representing a `diff' between two CoinWarmStartDual objects. For convenience, assignment, cloning, and deletion are visible to the world, and default and copy constructors are made available to derived classes. Knowledge of the rest of this structure, and of generating and applying diffs, is restricted to the friend functions CoinWarmStartDual::generateDiff() and CoinWarmStartDual::applyDiff(). The actual data structure is a pair of vectors, #diffNdxs_ and #diffVals_. */ class CoinWarmStartDualDiff : public virtual CoinWarmStartDiff { public: /*! \brief `Virtual constructor' */ virtual CoinWarmStartDiff *clone() const { return new CoinWarmStartDualDiff(*this) ; } /*! \brief Assignment */ virtual CoinWarmStartDualDiff &operator= (const CoinWarmStartDualDiff &rhs) { if (this != &rhs) { diff_ = rhs.diff_; } return *this; } /*! \brief Destructor */ virtual ~CoinWarmStartDualDiff() {} protected: /*! \brief Default constructor This is protected (rather than private) so that derived classes can see it when they make their default constructor protected or private. */ CoinWarmStartDualDiff () : diff_() {} /*! \brief Copy constructor For convenience when copying objects containing CoinWarmStartDualDiff objects. But consider whether you should be using #clone() to retain polymorphism. This is protected (rather than private) so that derived classes can see it when the make their copy constructor protected or private. */ CoinWarmStartDualDiff (const CoinWarmStartDualDiff &rhs) : diff_(rhs.diff_) {} private: friend CoinWarmStartDiff* CoinWarmStartDual::generateDiff(const CoinWarmStart *const oldCWS) const ; friend void CoinWarmStartDual::applyDiff(const CoinWarmStartDiff *const diff) ; /*! \brief Standard constructor */ CoinWarmStartDualDiff (int sze, const unsigned int *const diffNdxs, const double *const diffVals) : diff_(sze, diffNdxs, diffVals) {} /*! \brief The difference in the dual vector is simply the difference in a vector. */ CoinWarmStartVectorDiff diff_; }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveIsolated.hpp0000644000175000017500000000264311654260357020640 0ustar renerene/* $Id: CoinPresolveIsolated.hpp 1498 2011-11-02 15:25:35Z mjs $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveIsolated_H #define CoinPresolveIsolated_H #include "CoinPresolveMatrix.hpp" class isolated_constraint_action : public CoinPresolveAction { isolated_constraint_action(); isolated_constraint_action(const isolated_constraint_action& rhs); isolated_constraint_action& operator=(const isolated_constraint_action& rhs); double rlo_; double rup_; int row_; int ninrow_; // the arrays are owned by the class and must be deleted at destruction const int *rowcols_; const double *rowels_; const double *costs_; isolated_constraint_action(double rlo, double rup, int row, int ninrow, const int *rowcols, const double *rowels, const double *costs, const CoinPresolveAction *next) : CoinPresolveAction(next), rlo_(rlo), rup_(rup), row_(row), ninrow_(ninrow), rowcols_(rowcols), rowels_(rowels), costs_(costs) {} public: const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix * prob, int row, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~isolated_constraint_action(); }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveIsolated.cpp0000644000175000017500000001157211510461170020617 0ustar renerene/* $Id: CoinPresolveIsolated.cpp 1373 2011-01-03 23:57:44Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPresolveMatrix.hpp" #include "CoinPresolveIsolated.hpp" #include "CoinHelperFunctions.hpp" #if PRESOLVE_DEBUG || PRESOLVE_CONSISTENCY #include "CoinPresolvePsdebug.hpp" #endif // Rarely, there may a constraint whose variables only // occur in that constraint. // In this case it is a completely independent problem. // We should be able to solve it right now. // Since that is actually not trivial, I'm just going to ignore // them and stick them back in at postsolve. const CoinPresolveAction *isolated_constraint_action::presolve(CoinPresolveMatrix *prob, int irow, const CoinPresolveAction *next) { int *hincol = prob->hincol_; const CoinBigIndex *mcstrt = prob->mcstrt_; int *hrow = prob->hrow_; double *colels = prob->colels_; double *clo = prob->clo_; double *cup = prob->cup_; const double *rowels = prob->rowels_; const int *hcol = prob->hcol_; const CoinBigIndex *mrstrt = prob->mrstrt_; // may be written by useless constraint int *hinrow = prob->hinrow_; double *rlo = prob->rlo_; double *rup = prob->rup_; CoinBigIndex krs = mrstrt[irow]; CoinBigIndex kre = krs + hinrow[irow]; double *dcost = prob->cost_; const double maxmin = prob->maxmin_; # if PRESOLVE_DEBUG { printf("ISOLATED: %d - ", irow); CoinBigIndex k; for ( k = krs; k 0.0 && clo[jcol] != 0.0) || (maxmin*dcost[jcol] < 0.0 && cup[jcol] != 0.0) ){ # if PRESOLVE_DEBUG printf("can't handle non-trivial isolated constraints for now\n"); # endif return NULL; } } int nc = hinrow[irow]; #if 0 double tableau = new double[nc]; double sol = new double[nc]; double clo = new double[nc]; double cup = new double[nc]; for (int i=0; iclo[krs+i]; cup[i] = prob->cup[krs+i]; sol[i] = clo[i]; } #endif // HACK - set costs to 0.0 so empty.cpp doesn't complain double *costs = new double[nc]; for (k = krs; kclink_,hcol[k]) ; } } hinrow[irow] = 0 ; PRESOLVE_REMOVE_LINK(prob->rlink_,irow) ; // just to make things squeeky rlo[irow] = 0.0; rup[irow] = 0.0; # if CHECK_CONSISTENCY presolve_links_ok(prob) ; presolve_consistent(prob); # endif return (next); } const char *isolated_constraint_action::name() const { return ("isolated_constraint_action"); } void isolated_constraint_action::postsolve(CoinPostsolveMatrix *prob) const { double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *link = prob->link_; int *hincol = prob->hincol_; double *rowduals = prob->rowduals_; double *rowacts = prob->acts_; double *sol = prob->sol_; CoinBigIndex &free_list = prob->free_list_; // hides fields double *rlo = prob->rlo_; double *rup = prob->rup_; double rowact = 0.0; int irow = this->row_; rup[irow] = this->rup_; rlo[irow] = this->rlo_; int k; for (k=0; kninrow_; k++) { int jcol = this->rowcols_[k]; sol[jcol] = 0.0; // ONLY ACCEPTED SUCH CONSTRAINTS CoinBigIndex kk = free_list; assert(kk >= 0 && kk < prob->bulk0_) ; free_list = link[free_list]; mcstrt[jcol] = kk; //rowact += rowels[k] * sol[jcol]; colels[kk] = this->rowels_[k]; hrow[kk] = irow; link[kk] = NO_LINK ; hincol[jcol] = 1; } # if PRESOLVE_CONSISTENCY presolve_check_free_list(prob) ; # endif // ??? prob->setRowStatus(irow,CoinPrePostsolveMatrix::basic); rowduals[irow] = 0.0; rowacts[irow] = rowact; // leave until desctructor // deleteAction(rowcols_,int *); // deleteAction(rowels_,double *); // deleteAction(costs_,double *); } isolated_constraint_action::~isolated_constraint_action() { deleteAction(rowcols_,int *); deleteAction(rowels_,double *); deleteAction(costs_,double *); } CoinMP-1.8.3/CoinUtils/src/CoinPresolveUseless.cpp0000644000175000017500000005756312055734244020522 0ustar renerene/* $Id: CoinPresolveUseless.cpp 1566 2012-11-29 19:33:56Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinPresolveMatrix.hpp" #include "CoinPresolveUseless.hpp" #include "CoinPresolveFixed.hpp" #include "CoinHelperFunctions.hpp" #include "CoinFinite.hpp" #if PRESOLVE_DEBUG || PRESOLVE_CONSISTENCY #include "CoinPresolvePsdebug.hpp" #endif /* This routine implements a greedy algorithm to find a set of necessary constraints which imply tighter bounds for some subset of the variables. It then uses the tighter column bounds to identify constraints that are useless as long as the necessary set is present. The algorithm is as follows: * Initially mark all constraints as in play. * For each in play constraint, calculate row activity bounds L(i) and U(i). Use these bounds in an attempt to tighten column bounds for all variables entangled with the row. * If some column bound is tightened, the row is necessary. Mark it as such, taking it out of play. Eventually the rows are divided into two sets, necessary and unnecessary. Go through the unnecessary rows and check L(i) and U(i) using the tightened column bounds. Remove any useless rows where row activity cannot exceed the row bounds. For efficiency, rows are marked as processed when L(i) and U(i) are first calculated and these values are not recalculated unless a column bound changes. */ const CoinPresolveAction *testRedundant (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering testRedundant, considering " << prob->nrows_ << " rows." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 const int startEmptyRows = prob->countEmptyRows() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0 ; if (prob->tuning_) startTime = CoinCpuTime() ; # endif # endif const int m = prob->nrows_ ; const int n = prob->ncols_ ; /* Unpack the row- and column-major representations. */ const CoinBigIndex *rowStarts = prob->mrstrt_ ; const int *rowLengths = prob->hinrow_ ; const double *rowCoeffs = prob->rowels_ ; const int *colIndices = prob->hcol_ ; const CoinBigIndex *colStarts = prob->mcstrt_ ; const int *rowIndices = prob->hrow_ ; const int *colLengths = prob->hincol_ ; /* Rim vectors. We need copies of the column bounds to modify as we do bound propagation. */ const double *rlo = prob->rlo_ ; const double *rup = prob->rup_ ; double *columnLower = new double[n] ; double *columnUpper = new double[n] ; CoinMemcpyN(prob->clo_,n,columnLower) ; CoinMemcpyN(prob->cup_,n,columnUpper) ; /* And we'll need somewhere to record the unnecessary rows. */ int *useless_rows = prob->usefulRowInt_+m ; int nuseless_rows = 0 ; /* The usual finite infinity. */ # define USE_SMALL_LARGE # ifdef USE_SMALL_LARGE const double large = 1.0e15 ; # else const double large = 1.0e20 ; # endif # ifndef NDEBUG const double large2 = 1.0e10*large ; # endif double feasTol = prob->feasibilityTolerance_ ; double relaxedTol = 100.0*feasTol ; /* More like `ignore infeasibility.' */ bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; /* Scan the rows and do an initial classification. MarkIgnore is used for constraints that are not in play in bound propagation for whatever reason, either because they're not interesting, or, later, because they're necessary. Interesting rows are nonempty with at least one finite row bound. The rest we can ignore during propagation. Nonempty rows with no finite row bounds are useless; record them for later. */ const char markIgnore = 1 ; const char markInPlay = -1 ; const char markActOK = -2 ; char *markRow = reinterpret_cast(prob->usefulRowInt_) ; for (int i = 0 ; i < m ; i++) { if ((rlo[i] > -large || rup[i] < large) && rowLengths[i] > 0) { markRow[i] = markInPlay ; } else { markRow[i] = markIgnore ; if (rowLengths[i] > 0) { useless_rows[nuseless_rows++] = i ; prob->addRow(i) ; } } } /* Open the main loop. We'll keep trying to tighten bounds until we get to diminishing returns. numberCheck is set at the end of the loop based on how well we did in the first pass. numberChanged tracks how well we do on the current pass. */ int numberInfeasible = 0 ; int numberChanged = 0 ; int totalTightened = 0 ; int numberCheck = -1 ; const int MAXPASS = 10 ; int iPass = -1 ; while (iPass < MAXPASS && numberChanged > numberCheck) { iPass++ ; numberChanged = 0 ; /* Open a loop to work through the rows computing upper and lower bounds on row activity. Each bound is calculated as a finite component and an infinite component. The state transitions for a row i go like this: * Row i starts out marked with markInPlay. * When row i is processed by the loop, L(i) and U(i) are calculated and we try to tighten the column bounds of entangled columns. If nothing happens, row i is marked with markActOK. It's still in play but won't be processed again unless the mark changes back to markInPlay. * If a column bound is tightened when we process row i, it's necessary. Mark row i with markIgnore and do not process it again. Other rows k entangled with the column and marked with markActOK are remarked to markInPlay and L(k) and U(k) will be recalculated on the next major pass. If the row is not marked as markInPlay, either we're ignoring the row or L(i) and U(i) have not changed since the last time the row was processed. There's nothing to gain by processing it again. */ for (int i = 0 ; i < m ; i++) { if (markRow[i] != markInPlay) continue ; int infUpi = 0 ; int infLoi = 0 ; double finUpi = 0.0 ; double finDowni = 0.0 ; const CoinBigIndex krs = rowStarts[i] ; const CoinBigIndex kre = krs+rowLengths[i] ; /* Open a loop to walk the row and calculate upper (U) and lower (L) bounds on row activity. Expand the finite component just a wee bit to make sure the bounds are conservative, then add in a whopping big value to account for the infinite component. */ for (CoinBigIndex kcol = krs ; kcol < kre ; ++kcol) { const double value = rowCoeffs[kcol] ; const int j = colIndices[kcol] ; if (value > 0.0) { if (columnUpper[j] < large) finUpi += columnUpper[j]*value ; else ++infUpi ; if (columnLower[j] > -large) finDowni += columnLower[j]*value ; else ++infLoi ; } else if (value<0.0) { if (columnUpper[j] < large) finDowni += columnUpper[j]*value ; else ++infLoi ; if (columnLower[j] > -large) finUpi += columnLower[j]*value ; else ++infUpi ; } } markRow[i] = markActOK ; finUpi += 1.0e-8*fabs(finUpi) ; finDowni -= 1.0e-8*fabs(finDowni) ; const double maxUpi = finUpi+infUpi*1.0e31 ; const double maxDowni = finDowni-infLoi*1.0e31 ; /* If LB(i) > rup(i) or UB(i) < rlo(i), we're infeasible. Break for the exit, unless the user has been so foolish as to tell us to ignore infeasibility, in which case just move on to the next row. */ if (maxUpi < rlo[i]-relaxedTol || maxDowni > rup[i]+relaxedTol) { if (!fixInfeasibility) { numberInfeasible++ ; prob->messageHandler()->message(COIN_PRESOLVE_ROWINFEAS, prob->messages()) << i << rlo[i] << rup[i] << CoinMessageEol ; break ; } else { continue ; } } /* Remember why we're here --- this is presolve. If the constraint satisfies this condition, it already qualifies as useless and it's highly unlikely to produce tightened column bounds. But don't record it as useless just yet; leave that for phase 2. LOU: Well, why not mark it as useless? A possible optimisation. */ if (maxUpi <= rup[i]+feasTol && maxDowni >= rlo[i]-feasTol) continue ; /* We're not infeasible and one of U(i) or L(i) is not inside the row bounds. If we have something that looks like a forcing constraint but is just over the line, force the bound to exact equality to ensure conservative column bounds. */ const double rloi = rlo[i] ; const double rupi = rup[i] ; if (finUpi < rloi && finUpi > rloi-relaxedTol) finUpi = rloi ; if (finDowni > rupi && finDowni < rupi+relaxedTol) finDowni = rupi ; /* Open a loop to walk the row and try to tighten column bounds. */ for (CoinBigIndex kcol = krs ; kcol < kre ; ++kcol) { const double ait = rowCoeffs[kcol] ; const int t = colIndices[kcol] ; double lt = columnLower[t] ; double ut = columnUpper[t] ; double newlt = COIN_DBL_MAX ; double newut = -COIN_DBL_MAX ; /* For a target variable x(t) with a(it) > 0, we have new l(t) = (rlo(i)-(U(i)-a(it)u(t)))/a(it) = u(t) + (rlo(i)-U(i))/a(it) new u(t) = (rup(i)-(L(i)-a(it)l(t)))/a(it) = l(t) + (rup(i)-L(i))/a(it) Notice that if there's a single infinite contribution to L(i) or U(i) and it comes from x(t), then the finite portion finDowni or finUpi is correct and finite. Start by calculating new l(t) against rlo(i) and U(i). If the change is large, put some slack in the bound. */ if (ait > 0.0) { if (rloi > -large) { if (!infUpi) { assert(ut < large2) ; newlt = ut+(rloi-finUpi)/ait ; if (fabs(finUpi) > 1.0e8) newlt -= 1.0e-12*fabs(finUpi) ; } else if (infUpi == 1 && ut >= large) { newlt = (rloi-finUpi)/ ait ; if (fabs(finUpi) > 1.0e8) newlt -= 1.0e-12*fabs(finUpi) ; } else { newlt = -COIN_DBL_MAX ; } /* Did we improve the bound? If we're infeasible, head for the exit. If we're still feasible, walk the column and reset the marks on the entangled rows so that the activity bounds will be recalculated. Mark this constraint so we don't use it again, and correct L(i). */ if (newlt > lt+1.0e-12 && newlt > -large) { if (ut-newlt < -relaxedTol) { numberInfeasible++ ; break ; } columnLower[t] = newlt ; markRow[i] = markIgnore ; numberChanged++ ; const CoinBigIndex kcs = colStarts[t] ; const CoinBigIndex kce = kcs+colLengths[t] ; for (CoinBigIndex kcol = kcs ; kcol < kce ; ++kcol) { const int k = rowIndices[kcol] ; if (markRow[k] == markActOK) { markRow[k] = markInPlay ; } } if (lt <= -large) { finDowni += newlt*ait ; infLoi-- ; } else { finDowni += (newlt-lt)*ait ; } lt = newlt ; } } /* Perform the same actions, for new u(t) against rup(i) and L(i). */ if (rupi < large) { if (!infLoi) { assert(lt >- large2) ; newut = lt+(rupi-finDowni)/ait ; if (fabs(finDowni) > 1.0e8) newut += 1.0e-12*fabs(finDowni) ; } else if (infLoi == 1 && lt <= -large) { newut = (rupi-finDowni)/ait ; if (fabs(finDowni) > 1.0e8) newut += 1.0e-12*fabs(finDowni) ; } else { newut = COIN_DBL_MAX ; } if (newut < ut-1.0e-12 && newut < large) { columnUpper[t] = newut ; if (newut-lt < -relaxedTol) { numberInfeasible++ ; break ; } markRow[i] = markIgnore ; numberChanged++ ; const CoinBigIndex kcs = colStarts[t] ; const CoinBigIndex kce = kcs+colLengths[t] ; for (CoinBigIndex kcol = kcs ; kcol < kce ; ++kcol) { const int k = rowIndices[kcol] ; if (markRow[k] == markActOK) { markRow[k] = markInPlay ; } } if (ut >= large) { finUpi += newut*ait ; infUpi-- ; } else { finUpi += (newut-ut)*ait ; } ut = newut ; } } } else { /* And repeat both sets with the appropriate flips for a(it) < 0. */ if (rloi > -large) { if (!infUpi) { assert(lt < large2) ; newut = lt+(rloi-finUpi)/ait ; if (fabs(finUpi) > 1.0e8) newut += 1.0e-12*fabs(finUpi) ; } else if (infUpi == 1 && lt <= -large) { newut = (rloi-finUpi)/ait ; if (fabs(finUpi) > 1.0e8) newut += 1.0e-12*fabs(finUpi) ; } else { newut = COIN_DBL_MAX ; } if (newut < ut-1.0e-12 && newut < large) { columnUpper[t] = newut ; if (newut-lt < -relaxedTol) { numberInfeasible++ ; break ; } markRow[i] = markIgnore ; numberChanged++ ; const CoinBigIndex kcs = colStarts[t] ; const CoinBigIndex kce = kcs+colLengths[t] ; for (CoinBigIndex kcol = kcs ; kcol < kce ; ++kcol) { const int k = rowIndices[kcol] ; if (markRow[k] == markActOK) { markRow[k] = markInPlay ; } } if (ut >= large) { finDowni += newut*ait ; infLoi-- ; } else { finDowni += (newut-ut)*ait ; } ut = newut ; } } if (rupi < large) { if (!infLoi) { assert(ut < large2) ; newlt = ut+(rupi-finDowni)/ait ; if (fabs(finDowni) > 1.0e8) newlt -= 1.0e-12*fabs(finDowni) ; } else if (infLoi == 1 && ut >= large) { newlt = (rupi-finDowni)/ait ; if (fabs(finDowni) > 1.0e8) newlt -= 1.0e-12*fabs(finDowni) ; } else { newlt = -COIN_DBL_MAX ; } if (newlt > lt+1.0e-12 && newlt > -large) { columnLower[t] = newlt ; if (ut-newlt < -relaxedTol) { numberInfeasible++ ; break ; } markRow[i] = markIgnore ; numberChanged++ ; const CoinBigIndex kcs = colStarts[t] ; const CoinBigIndex kce = kcs+colLengths[t] ; for (CoinBigIndex kcol = kcs ; kcol < kce ; ++kcol) { const int k = rowIndices[kcol] ; if (markRow[k] == markActOK) { markRow[k] = markInPlay ; } } if (lt <= -large) { finUpi += newlt*ait ; infUpi-- ; } else { finUpi += (newlt-lt)*ait ; } lt = newlt ; } } } } } totalTightened += numberChanged ; if (iPass == 1) numberCheck = CoinMax(10,numberChanged>>5) ; if (numberInfeasible) { prob->status_ = 1 ; break ; } } /* At this point, we have rows marked with markIgnore, markInPlay, and markActOK. Rows marked with markIgnore may have been used to tighten the column bound on some variable, hence they are necessary. (Or they may have been marked in the initial scan, in which case they're already on the useless list or empty.) Rows marked with markInPlay or markActOK are candidates for forcing or useless constraints. */ if (!numberInfeasible) { /* Open a loop to scan the rows again looking for useless constraints. */ for (int i = 0 ; i < m ; i++) { if (markRow[i] == markIgnore) continue ; /* Recalculate L(i) and U(i). LOU: Arguably this would not be necessary if we saved L(i) and U(i). */ int infUpi = 0 ; int infLoi = 0 ; double finUpi = 0.0 ; double finDowni = 0.0 ; const CoinBigIndex krs = rowStarts[i] ; const CoinBigIndex kre = krs+rowLengths[i] ; for (CoinBigIndex krow = krs; krow < kre; ++krow) { const double value = rowCoeffs[krow] ; const int j = colIndices[krow] ; if (value > 0.0) { if (columnUpper[j] < large) finUpi += columnUpper[j] * value ; else ++infUpi ; if (columnLower[j] > -large) finDowni += columnLower[j] * value ; else ++infLoi ; } else if (value<0.0) { if (columnUpper[j] < large) finDowni += columnUpper[j] * value ; else ++infLoi ; if (columnLower[j] > -large) finUpi += columnLower[j] * value ; else ++infUpi ; } } finUpi += 1.0e-8*fabs(finUpi) ; finDowni -= 1.0e-8*fabs(finDowni) ; const double maxUpi = finUpi+infUpi*1.0e31 ; const double maxDowni = finDowni-infLoi*1.0e31 ; /* If we have L(i) and U(i) at or inside the row bounds, we have a useless constraint. You would think we could detect forcing constraints here but that's a bit of a problem, because the tightened column bounds we're working with will not escape this routine. */ if (maxUpi <= rup[i]+feasTol && maxDowni >= rlo[i]-feasTol) { useless_rows[nuseless_rows++] = i ; } } if (nuseless_rows) { next = useless_constraint_action::presolve(prob, useless_rows,nuseless_rows, next) ; } /* See if we can transfer tightened bounds from the work above. This is problematic. When we loosen these bounds in postsolve it's entirely possible that the variable will end up superbasic. Original comment: may not unroll */ if (prob->presolveOptions_&0x10) { const unsigned char *integerType = prob->integerType_ ; double *csol = prob->sol_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; int *fixed = prob->usefulColumnInt_ ; int nFixed = 0 ; int nChanged = 0 ; for (int j = 0 ; j < n ; j++) { if (clo[j] == cup[j]) continue ; double lower = columnLower[j] ; double upper = columnUpper[j] ; if (integerType[j]) { upper = floor(upper+1.0e-4) ; lower = ceil(lower-1.0e-4) ; } if (upper-lower < 1.0e-8) { if (upper-lower < -feasTol) numberInfeasible++ ; if (CoinMin(fabs(upper),fabs(lower)) <= 1.0e-7) upper = 0.0 ; fixed[nFixed++] = j ; prob->addCol(j) ; cup[j] = upper ; clo[j] = upper ; if (csol != 0) csol[j] = upper ; } else { if (integerType[j]) { if (upper < cup[j]) { cup[j] = upper ; nChanged++ ; prob->addCol(j) ; } if (lower > clo[j]) { clo[j] = lower ; nChanged++ ; prob->addCol(j) ; } } } } # ifdef CLP_INVESTIGATE if (nFixed||nChanged) printf("%d fixed in impliedfree, %d changed\n",nFixed,nChanged) ; # endif if (nFixed) next = remove_fixed_action::presolve(prob,fixed,nFixed,next) ; } } delete [] columnLower ; delete [] columnUpper ; # if COIN_PRESOLVE_TUNING > 0 double thisTime ; if (prob->tuning_) thisTime = CoinCpuTime() ; # endif # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; std::cout << "Leaving testRedundant, " << droppedRows << " rows dropped" ; # if COIN_PRESOLVE_TUNING > 0 std::cout << " in " << thisTime-startTime << "s" ; # endif std::cout << "." << std::endl ; # endif return (next) ; } // WHAT HAPPENS IF COLS ARE DROPPED AS A RESULT?? // should be like do_tighten. // not really - one could fix costed variables to appropriate bound. // ok, don't bother about it. If it is costed, it will be checked // when it is eliminated as an empty col; if it is costed in the // wrong direction, the problem is unbounded, otherwise it is pegged // at its bound. no special action need be taken here. const CoinPresolveAction *useless_constraint_action::presolve(CoinPresolveMatrix * prob, const int *useless_rows, int nuseless_rows, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering useless_constraint_action::presolve, " << nuseless_rows << " rows." << std::endl ; # endif presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif // may be modified by useless constraint double *colels = prob->colels_; // may be modified by useless constraint int *hrow = prob->hrow_; const CoinBigIndex *mcstrt = prob->mcstrt_; // may be modified by useless constraint int *hincol = prob->hincol_; // double *clo = prob->clo_; // double *cup = prob->cup_; const double *rowels = prob->rowels_; const int *hcol = prob->hcol_; const CoinBigIndex *mrstrt = prob->mrstrt_; // may be written by useless constraint int *hinrow = prob->hinrow_; // const int nrows = prob->nrows_; double *rlo = prob->rlo_; double *rup = prob->rup_; action *actions = new action [nuseless_rows]; for (int i=0; i 2 std::cout << " removing row " << irow << std::endl ; # endif CoinBigIndex krs = mrstrt[irow]; CoinBigIndex kre = krs + hinrow[irow]; PRESOLVE_DETAIL_PRINT(printf("pre_useless %dR E\n",irow)); action *f = &actions[i]; f->row = irow; f->ninrow = hinrow[irow]; f->rlo = rlo[irow]; f->rup = rup[irow]; f->rowcols = CoinCopyOfArray(&hcol[krs], hinrow[irow]); f->rowels = CoinCopyOfArray(&rowels[krs], hinrow[irow]); for (CoinBigIndex k=krs; kclink_,hcol[k]) ; } } hinrow[irow] = 0; PRESOLVE_REMOVE_LINK(prob->rlink_,irow) ; // just to make things squeeky rlo[irow] = 0.0; rup[irow] = 0.0; } next = new useless_constraint_action(nuseless_rows,actions,next) ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving useless_constraint_action::presolve." << std::endl ; # endif # endif return (next) ; } // Put constructors here useless_constraint_action::useless_constraint_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} useless_constraint_action::~useless_constraint_action() { for (int i=0;i 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering useless_constraint_action::postsolve, " << nactions << " rows." << std::endl ; # endif presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *link = prob->link_; int *hincol = prob->hincol_; // double *rowduals = prob->rowduals_; double *rowacts = prob->acts_; const double *sol = prob->sol_; CoinBigIndex &free_list = prob->free_list_; double *rlo = prob->rlo_; double *rup = prob->rup_; for (const action *f = &actions[nactions-1]; actions<=f; f--) { int irow = f->row; int ninrow = f->ninrow; const int *rowcols = f->rowcols; const double *rowels = f->rowels; double rowact = 0.0; rup[irow] = f->rup; rlo[irow] = f->rlo; for (CoinBigIndex k=0; k= 0 && kk < prob->bulk0_) ; free_list = link[free_list]; hrow[kk] = irow; colels[kk] = rowels[k]; link[kk] = mcstrt[jcol]; mcstrt[jcol] = kk; } rowact += rowels[k] * sol[jcol]; hincol[jcol]++; } # if PRESOLVE_CONSISTENCY presolve_check_free_list(prob) ; # endif // I don't know if this is always true PRESOLVEASSERT(prob->getRowStatus(irow)==CoinPrePostsolveMatrix::basic); // rcosts are unaffected since rowdual is 0 rowacts[irow] = rowact; // leave until desctructor //deleteAction(rowcols,int *); //deleteAction(rowels,double *); } //deleteAction(actions_,action *); # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_threads(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving useless_constraint_action::postsolve." << std::endl ; # endif # endif } CoinMP-1.8.3/CoinUtils/src/Coin_C_defines.h0000644000175000017500000000621512310367261017021 0ustar renerene/* $Id: Coin_C_defines.h 1690 2014-03-13 17:45:21Z mlubin $ */ /* Copyright (C) 2002, 2003 International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #ifndef CoinCDefine_H #define CoinCDefine_H /** This has #defines etc for the "C" interface to Coin. If COIN_EXTERN_C defined then an extra extern C */ #if defined (CLP_EXTERN_C) #define COIN_EXTERN_C #define COIN_NO_SBB #define COIN_NO_CBC #endif #if defined (SBB_EXTERN_C) #define COIN_EXTERN_C #define COIN_NO_CLP #endif #if defined (CBC_EXTERN_C) #define COIN_EXTERN_C #define COIN_NO_CLP #endif /* We need to allow for Microsoft */ #ifndef COINLIBAPI #if defined(CBCCINTERFACEDLL_EXPORTS) || defined(CLPMSDLL) #if defined (COIN_EXTERN_C) # define COINLIBAPI __declspec(dllexport) #else # define COINLIBAPI __declspec(dllexport) #endif # define COINLINKAGE __stdcall # define COINLINKAGE_CB __cdecl #else #if defined (COIN_EXTERN_C) # define COINLIBAPI extern "C" #else # define COINLIBAPI #endif # define COINLINKAGE # define COINLINKAGE_CB #endif #endif /** User does not need to see structure of model but C++ code does */ #if defined (CLP_EXTERN_C) /* Real typedef for structure */ class CMessageHandler; typedef struct { ClpSimplex * model_; CMessageHandler * handler_; } Clp_Simplex; #else typedef void Clp_Simplex; #endif #ifndef COIN_NO_CLP /** typedef for user call back. The cvec are constructed so don't need to be const*/ typedef void (COINLINKAGE_CB *clp_callback) (Clp_Simplex * model,int msgno, int ndouble, const double * dvec, int nint, const int * ivec, int nchar, char ** cvec); #endif /** User does not need to see structure of model but C++ code does */ #if defined (SBB_EXTERN_C) /* Real typedef for structure */ class Sbb_MessageHandler; typedef struct { OsiClpSolverInterface * solver_; SbbModel * model_; Sbb_MessageHandler * handler_; char * information_; } Sbb_Model; #else typedef void Sbb_Model; #endif #if defined (CBC_EXTERN_C) /* Real typedef for structure */ class Cbc_MessageHandler; typedef struct { OsiClpSolverInterface * solver_; CbcModel * model_; Cbc_MessageHandler * handler_; std::vector cmdargs_; } Cbc_Model; #else typedef void Cbc_Model; #endif #ifndef COIN_NO_SBB /** typedef for user call back. The cvec are constructed so don't need to be const*/ typedef void (COINLINKAGE_CB *sbb_callback) (Sbb_Model * model,int msgno, int ndouble, const double * dvec, int nint, const int * ivec, int nchar, char ** cvec); typedef void (COINLINKAGE_CB *cbc_callback) (Cbc_Model * model,int msgno, int ndouble, const double * dvec, int nint, const int * ivec, int nchar, char ** cvec); #endif #if COIN_BIG_INDEX==0 typedef int CoinBigIndex; #elif COIN_BIG_INDEX==1 typedef long CoinBigIndex; #else typedef long long CoinBigIndex; #endif /* just in case used somewhere */ #undef COIN_NO_CLP #undef COIN_NO_SBB #undef COIN_NO_CBC #endif CoinMP-1.8.3/CoinUtils/src/CoinWarmStartDual.cpp0000644000175000017500000000374411510461170020067 0ustar renerene/* $Id: CoinWarmStartDual.cpp 1373 2011-01-03 23:57:44Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include "CoinWarmStartDual.hpp" #include //############################################################################# /* Generate a `diff' that can convert the warm start passed as a parameter to the warm start specified by this. The capabilities are limited: the basis passed as a parameter can be no larger than the basis pointed to by this. */ CoinWarmStartDiff* CoinWarmStartDual::generateDiff (const CoinWarmStart *const oldCWS) const { /* Make sure the parameter is CoinWarmStartDual or derived class. */ const CoinWarmStartDual *oldDual = dynamic_cast(oldCWS) ; if (!oldDual) { throw CoinError("Old warm start not derived from CoinWarmStartDual.", "generateDiff","CoinWarmStartDual") ; } CoinWarmStartDualDiff* diff = new CoinWarmStartDualDiff; CoinWarmStartDiff* vecdiff = dual_.generateDiff(&oldDual->dual_); diff->diff_.swap(*dynamic_cast*>(vecdiff)); delete vecdiff; return diff; } //============================================================================= /* Apply diff to this warm start. Update this warm start by applying diff. It's assumed that the allocated capacity of the warm start is sufficiently large. */ void CoinWarmStartDual::applyDiff (const CoinWarmStartDiff *const cwsdDiff) { /* Make sure we have a CoinWarmStartDualDiff */ const CoinWarmStartDualDiff *diff = dynamic_cast(cwsdDiff) ; if (!diff) { throw CoinError("Diff not derived from CoinWarmStartDualDiff.", "applyDiff","CoinWarmStartDual") ; } dual_.applyDiff(&diff->diff_); } CoinMP-1.8.3/CoinUtils/src/CoinFileIO.hpp0000644000175000017500000001400511575435531016456 0ustar renerene/* $Id: CoinFileIO.hpp 1439 2011-06-13 16:31:21Z stefan $ */ // Copyright (C) 2005, COIN-OR. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinFileIO_H #define CoinFileIO_H #include /// Base class for FileIO classes. class CoinFileIOBase { public: /// Constructor. /// @param fileName The name of the file used by this object. CoinFileIOBase (const std::string &fileName); /// Destructor. ~CoinFileIOBase (); /// Return the name of the file used by this object. const char *getFileName () const; /// Return the method of reading being used inline std::string getReadType () const { return readType_.c_str();} protected: std::string readType_; private: CoinFileIOBase (); CoinFileIOBase (const CoinFileIOBase &); std::string fileName_; }; /// Abstract base class for file input classes. class CoinFileInput: public CoinFileIOBase { public: /// indicates whether CoinFileInput supports gzip'ed files static bool haveGzipSupport(); /// indicates whether CoinFileInput supports bzip2'ed files static bool haveBzip2Support(); /// Factory method, that creates a CoinFileInput (more precisely /// a subclass of it) for the file specified. This method reads the /// first few bytes of the file and determines if this is a compressed /// or a plain file and returns the correct subclass to handle it. /// If the file does not exist or uses a compression not compiled in /// an exception is thrown. /// @param fileName The file that should be read. static CoinFileInput *create (const std::string &fileName); /// Constructor (don't use this, use the create method instead). /// @param fileName The name of the file used by this object. CoinFileInput (const std::string &fileName); /// Destructor. virtual ~CoinFileInput (); /// Read a block of data from the file, similar to fread. /// @param buffer Address of a buffer to store the data into. /// @param size Number of bytes to read (buffer should be large enough). /// @return Number of bytes read. virtual int read (void *buffer, int size) = 0; /// Reads up to (size-1) characters an stores them into the buffer, /// similar to fgets. /// Reading ends, when EOF or a newline occurs or (size-1) characters have /// been read. The resulting string is terminated with '\0'. If reading /// ends due to an encoutered newline, the '\n' is put into the buffer, /// before the '\0' is appended. /// @param buffer The buffer to put the string into. /// @param size The size of the buffer in characters. /// @return buffer on success, or 0 if no characters have been read. virtual char *gets (char *buffer, int size) = 0; }; /// Abstract base class for file output classes. class CoinFileOutput: public CoinFileIOBase { public: /// The compression method. enum Compression { COMPRESS_NONE = 0, ///< No compression. COMPRESS_GZIP = 1, ///< gzip compression. COMPRESS_BZIP2 = 2 ///< bzip2 compression. }; /// Returns whether the specified compression method is supported /// (i.e. was compiled into COIN). static bool compressionSupported (Compression compression); /// Factory method, that creates a CoinFileOutput (more precisely /// a subclass of it) for the file specified. If the compression method /// is not supported an exception is thrown (so use compressionSupported /// first, if this is a problem). The reason for not providing direct /// access to the subclasses (and using such a method instead) is that /// depending on the build configuration some of the classes are not /// available (or functional). This way we can handle all required ifdefs /// here instead of polluting other files. /// @param fileName The file that should be read. /// @param compression Compression method used. static CoinFileOutput *create (const std::string &fileName, Compression compression); /// Constructor (don't use this, use the create method instead). /// @param fileName The name of the file used by this object. CoinFileOutput (const std::string &fileName); /// Destructor. virtual ~CoinFileOutput (); /// Write a block of data to the file, similar to fwrite. /// @param buffer Address of a buffer containing the data to be written. /// @param size Number of bytes to write. /// @return Number of bytes written. virtual int write (const void * buffer, int size) = 0; /// Write a string to the file (like fputs). /// Just as with fputs no trailing newline is inserted! /// The terminating '\0' is not written to the file. /// The default implementation determines the length of the string /// and calls write on it. /// @param s The zero terminated string to be written. /// @return true on success, false on error. virtual bool puts (const char *s); /// Convenience method: just a 'puts(s.c_str())'. inline bool puts (const std::string &s) { return puts (s.c_str ()); } }; /*! \relates CoinFileInput \brief Test if the given string looks like an absolute file path The criteria are: - unix: string begins with `/' - windows: string begins with `\' or with `drv:' (drive specifier) */ bool fileAbsPath (const std::string &path) ; /*! \relates CoinFileInput \brief Test if the file is readable, using likely versions of the file name, and return the name that worked. The file name is constructed from \p name using the following rules:

    • An absolute path is not modified.
    • If the name begins with `~', an attempt is made to replace `~' with the value of the environment variable HOME.
    • If a default prefix (\p dfltPrefix) is provided, it is prepended to the name.
    If the constructed file name cannot be opened, and CoinUtils was built with support for compressed files, fileCoinReadable will try any standard extensions for supported compressed files. The value returned in \p name is the file name that actually worked. */ bool fileCoinReadable(std::string &name, const std::string &dfltPrefix = std::string("")); #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveTripleton.hpp0000644000175000017500000000270711654260357021055 0ustar renerene/* $Id: CoinPresolveTripleton.hpp 1498 2011-11-02 15:25:35Z mjs $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveTripleton_H #define CoinPresolveTripleton_H #define TRIPLETON 11 /** We are only going to do this if it does not increase number of elements?. It could be generalized to more than three but it seems unlikely it would help. As it is adapted from doubleton icoly is one dropped. */ class tripleton_action : public CoinPresolveAction { public: struct action { int icolx; int icolz; int row; int icoly; double cloy; double cupy; double costy; double clox; double cupx; double costx; double rlo; double rup; double coeffx; double coeffy; double coeffz; double *colel; int ncolx; int ncoly; }; const int nactions_; const action *const actions_; private: tripleton_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const { return ("tripleton_action"); } static const CoinPresolveAction *presolve(CoinPresolveMatrix *, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~tripleton_action(); }; #endif CoinMP-1.8.3/CoinUtils/src/config_default.h0000644000175000017500000000177512101104050017130 0ustar renerene /* include the COIN-OR-wide system specific configure header */ #include "configall_system.h" /* include the public project specific macros */ #include "config_coinutils_default.h" /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Define to the debug sanity check level (0 is no test) */ #define COIN_COINUTILS_CHECKLEVEL 0 /* Define to the debug verbosity level (0 is no output) */ #define COIN_COINUTILS_VERBOSITY 0 /* Define to 1 if bzlib is available */ /* #define COIN_HAS_BZLIB */ /* Define to 1 if zlib is available */ /* #define COIN_HAS_ZLIB */ #ifdef _MSC_VER /* Define to be the name of C-function for Inf check */ #define COIN_C_FINITE _finite /* Define to be the name of C-function for NaN check */ #define COIN_C_ISNAN _isnan #endif CoinMP-1.8.3/CoinUtils/src/CoinParamUtils.cpp0000644000175000017500000005432511630460621017422 0ustar renerene/* $Id: CoinParamUtils.cpp 1468 2011-09-03 17:19:13Z stefan $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include "CoinUtilsConfig.h" #include "CoinParam.hpp" #include #include #include #ifdef COIN_HAS_READLINE #include #include #endif /* Unnamed local namespace */ namespace { /* cmdField: The index of the current command line field. Forced to -1 when accepting commands from stdin (interactive) or a command file. readSrc: Current input source. pendingVal: When the form param=value is encountered, both keyword and value form one command line field. We need to return `param' as the field and somehow keep the value around for the upcoming call that'll request it. That's the purpose of pendingVal. */ int cmdField = 1 ; FILE *readSrc = stdin ; std::string pendingVal = "" ; /* Get next command or field in command. When in interactive mode, prompt the user and read the resulting line of input. */ std::string nextField (const char *prompt) { static char line[1000] ; static char *where = NULL ; std::string field ; const char *dflt_prompt = "Eh? " ; if (prompt == 0) { prompt = dflt_prompt ; } /* Do we have a line at the moment? If not, acquire one. When we're done, line holds the input line and where points to the start of the line. If we're using the readline library, add non-empty lines to the history list. */ if (!where) { #ifdef COIN_HAS_READLINE if (readSrc == stdin) { where = readline(prompt) ; if (where) { if (*where) add_history (where) ; strcpy(line,where) ; free(where) ; where = line ; } } else { where = fgets(line,1000,readSrc) ; } #else if (readSrc == stdin) { fprintf(stdout,"%s",prompt) ; fflush(stdout) ; } where = fgets(line,1000,readSrc) ; #endif /* If where is NULL, we have EOF. Return a null string. */ if (!where) return field ; /* Clean the image. Trailing junk first. The line will be cut off at the last non-whitespace character, but we need to scan until we find the end of the string or some other non-printing character to make sure we don't miss a printing character after whitespace. */ char *lastNonBlank = line-1 ; for (where = line ; *where != '\0' ; where++) { if (*where != '\t' && *where < ' ') { break ; } if (*where != '\t' && *where != ' ') { lastNonBlank = where ; } } *(lastNonBlank+1) = '\0' ; where = line ; } /* Munch through leading white space. */ while (*where == ' ' || *where == '\t') where++ ; /* See if we can separate a field; if so, copy it over into field for return. If we're out of line, return the string "EOL". */ char *saveWhere = where ; while (*where != ' ' && *where != '\t' && *where!='\0') where++ ; if (where != saveWhere) { char save = *where ; *where = '\0' ; field = saveWhere ; *where = save ; } else { where = NULL ; field = "EOL" ; } return (field) ; } } /* Visible functions */ namespace CoinParamUtils { /* As mentioned above, cmdField set to -1 is the indication that we're reading from stdin or a file. */ void setInputSrc (FILE *src) { if (src != 0) { cmdField = -1 ; readSrc = src ; } } /* A utility to allow clients to determine if we're processing parameters from the comand line or otherwise. */ bool isCommandLine () { assert(cmdField != 0) ; if (cmdField > 0) { return (true) ; } else { return (false) ; } } /* A utility to allow clients to determine if we're accepting parameters interactively. */ bool isInteractive () { assert(cmdField != 0) ; if (cmdField < 0 && readSrc == stdin) { return (true) ; } else { return (false) ; } } /* Utility functions for acquiring input. */ /* Return the next field (word) from the current command line. Generally, this is expected to be of the form `-param' or `--param', with special cases as set out below. If we're in interactive mode (cmdField == -1), nextField does all the work to prompt the user and return the next field from the resulting input. It is assumed that the user knows not to use `-' or `--' prefixes in interactive mode. If we're in command line mode (cmdField > 0), cmdField indicates the current command line word. The order of processing goes like this: * A stand-alone `-' is converted to `stdin' * A stand-alone '--' is returned as a word; interpretation is up to the client. * A prefix of '-' or '--' is stripped from the field. If the result is `stdin', it's assumed we're switching to interactive mode and the user is prompted for another command. Whatever results from the above sequence is returned to the client as the next field. An empty string indicates end of input. Prompt will be used by nextField if it's necessary to prompt the user for a command (only when reading from stdin). If provided, pfx is set to the prefix ("-", "--", or "") stripped from the field. Lack of prefix is not necessarily an error because of the following scenario: To read a file, the verbose command might be "foo -import myfile". But we might want to allow a short form, "foo myfile". And we'd like "foo import" to be interpreted as "foo -import import" (i.e., import the file named `import'). */ std::string getCommand (int argc, const char *argv[], const std::string prompt, std::string *pfx) { std::string field = "EOL" ; pendingVal = "" ; int pfxlen ; if (pfx != 0) { (*pfx) = "" ; } /* Acquire the next field, and convert as outlined above if we're processing command line parameters. */ while (field == "EOL") { pfxlen = 0 ; if (cmdField > 0) { if (cmdField < argc) { field = argv[cmdField++] ; if (field == "-") { field = "stdin" ; } else if (field == "--") { /* Prevent `--' from being eaten by next case. */ } else { if (field[0] == '-') { pfxlen = 1 ; if (field[1] == '-') pfxlen = 2 ; if (pfx != 0) (*pfx) = field.substr(0,pfxlen) ; field = field.substr(pfxlen) ; } } } else { field = "" ; } } else { field = nextField(prompt.c_str()) ; } if (field == "stdin") { std::cout << "Switching to line mode" << std::endl ; cmdField = -1 ; field = nextField(prompt.c_str()) ; } } /* Are we left with something of the form param=value? If so, separate the pieces, returning `param' and saving `value' for later use as per comments at the head of the file. */ std::string::size_type found = field.find('='); if (found != std::string::npos) { pendingVal = field.substr(found+1) ; field = field.substr(0,found) ; } return (field) ; } /* Function to look up a parameter keyword (name) in the parameter vector and deal with the result. The keyword may end in one or more `?' characters; this is a query for information about matching parameters. If we have a single match satisfying the minimal match requirements, and there's no query, we simply return the index of the matching parameter in the parameter vector. If there are no matches, and no query, the return value will be -3. No matches on a query returns -1. A single short match, or a single match of any length with a query, will result in a short help message If present, these values are set as follows: * matchCntp is set to the number of parameters that matched. * shortCntp is set to the number of matches that failed to meet the minimum match requirement. * queryCntp is set to the number of trailing `?' characters at the end of name. Return values: >0: index of the single unique match for the name -1: query present -2: no query, one or more short matches -3: no query, no match -4: multiple full matches (indicates configuration error) The final three parameters (matchCnt, shortCnt, queryCnt) are optional and default to null. Use them if you want more detail on the match. */ int lookupParam (std::string name, CoinParamVec ¶mVec, int *matchCntp, int *shortCntp, int *queryCntp) { int retval = -3 ; if (matchCntp != 0) { *matchCntp = 0 ; } if (shortCntp != 0) { *shortCntp = 0 ; } if (queryCntp != 0) { *queryCntp = 0 ; } /* Is there anything here at all? */ if (name.length() == 0) { return (retval) ; } /* Scan the parameter name to see if it ends in one or more `?' characters. If so, take it as a request to return a list of parameters that match name up to the first `?'. The strings '?' and '???' are considered to be valid parameter names (short and long help, respectively) and are handled as special cases: If the whole string is `?'s, one and three are commands as is, while 2 and 4 or more are queries about `?' or `???'. */ int numQuery = 0 ; { int length = static_cast(name.length()) ; int i ; for (i = length-1 ; i >= 0 && name[i] == '?' ; i--) { numQuery++ ; } if (numQuery == length) { switch (length) { case 1: case 3: { numQuery = 0 ; break ; } case 2: { numQuery -= 1 ; break ; } default: { numQuery -= 3 ; break ; } } } name = name.substr(0,length-numQuery) ; if (queryCntp != 0) { *queryCntp = numQuery ; } } /* See if we can match the parameter name. On return, matchNdx is set to the last match satisfying the minimal match criteria, or -1 if there's no match. matchCnt is the number of matches satisfying the minimum match length, and shortCnt is possible matches that were short of the minimum match length, */ int matchNdx = -1 ; int shortCnt = 0 ; int matchCnt = CoinParamUtils::matchParam(paramVec,name,matchNdx,shortCnt) ; /* Set up return values before we get into further processing. */ if (matchCntp != 0) { *matchCntp = matchCnt ; } if (shortCntp != 0) { *shortCntp = shortCnt ; } if (numQuery > 0) { retval = -1 ; } else { if (matchCnt+shortCnt == 0) { retval = -3 ; } else if (matchCnt > 1) { retval = -4 ; } else { retval = -2 ; } } /* No matches? Nothing more to be done here. */ if (matchCnt+shortCnt == 0) { return (retval) ; } /* A unique match and no `?' in the name says we have our parameter. Return the result. */ if (matchCnt == 1 && shortCnt == 0 && numQuery == 0) { assert (matchNdx >= 0 && matchNdx < static_cast(paramVec.size())) ; return (matchNdx) ; } /* A single match? There are two possibilities: * The string specified is shorter than the match length requested by the parameter. (Useful for avoiding inadvertent execution of commands that the client might regret.) * The string specified contained a `?', in which case we print the help. The match may or may not be short. */ if (matchCnt+shortCnt == 1) { CoinParamUtils::shortOrHelpOne(paramVec,matchNdx,name,numQuery) ; return (retval) ; } /* The final case: multiple matches. Most commonly this will be multiple short matches. If we have multiple matches satisfying the minimal length criteria, we have a configuration problem. The other question is whether the user wanted help information. Two question marks gets short help. */ if (matchCnt > 1) { std::cout << "Configuration error! `" << name <<"' was fully matched " << matchCnt << " times!" << std::endl ; } std::cout << "Multiple matches for `" << name << "'; possible completions:" << std::endl ; CoinParamUtils::shortOrHelpMany(paramVec,name,numQuery) ; return (retval) ; } /* Utility functions to acquire parameter values from the command line. For all of these, a pendingVal is consumed if it exists. */ /* Read a string and return a pointer to the string. Set valid to indicate the result of parsing: 0: okay, 1: , 2: not present. */ std::string getStringField (int argc, const char *argv[], int *valid) { std::string field ; if (pendingVal != "") { field = pendingVal ; pendingVal = "" ; } else { field = "EOL" ; if (cmdField > 0) { if (cmdField < argc) { field = argv[cmdField++] ; } } else { field = nextField(0) ; } } if (valid != 0) { if (field != "EOL") { *valid = 0 ; } else { *valid = 2 ; } } return (field) ; } /* Read an int and return the value. Set valid to indicate the result of parsing: 0: okay, 1: parse error, 2: not present. */ int getIntField (int argc, const char *argv[], int *valid) { std::string field ; if (pendingVal != "") { field = pendingVal ; pendingVal = "" ; } else { field = "EOL" ; if (cmdField > 0) { if (cmdField < argc) { field = argv[cmdField++] ; } } else { field = nextField(0) ; } } /* The only way to check for parse error here is to set the system variable errno to 0 and then see if it's nonzero after we try to convert the string to integer. */ int value = 0 ; errno = 0 ; if (field != "EOL") { value = atoi(field.c_str()) ; } if (valid != 0) { if (field != "EOL") { if (errno == 0) { *valid = 0 ; } else { *valid = 1 ; } } else { *valid = 2 ; } } return (value) ; } /* Read a double and return the value. Set valid to indicate the result of parsing: 0: okay, 1: bad parse, 2: not present. But we'll never return valid == 1 because atof gives us no way to tell.) */ double getDoubleField (int argc, const char *argv[], int *valid) { std::string field ; if (pendingVal != "") { field = pendingVal ; pendingVal = "" ; } else { field = "EOL" ; if (cmdField > 0) { if (cmdField < argc) { field = argv[cmdField++] ; } } else { field = nextField(0) ; } } /* The only way to check for parse error here is to set the system variable errno to 0 and then see if it's nonzero after we try to convert the string to integer. */ double value = 0.0 ; errno = 0 ; if (field != "EOL") { value = atof(field.c_str()) ; } if (valid != 0) { if (field != "EOL") { if (errno == 0) { *valid = 0 ; } else { *valid = 1 ; } } else { *valid = 2 ; } } return (value) ; } /* Utility function to scan a parameter vector for matches. Sets matchNdx to the index of the last parameter that meets the minimal match criteria (but note there should be at most one such parameter if the parameter vector is properly configured). Sets shortCnt to the number of short matches (should be zero in a properly configured vector if a minimal match is found). Returns the number of matches satisfying the minimal match requirement (should be 0 or 1 in a properly configured vector). The routine allows for the possibility of null entries in the parameter vector. In order to handle `?' and `???', there's nothing to it but to force a unique match if we match `?' exactly. (This is another quirk of clp/cbc parameter parsing, which we need to match for historical reasons.) */ int matchParam (const CoinParamVec ¶mVec, std::string name, int &matchNdx, int &shortCnt) { int vecLen = static_cast(paramVec.size()) ; int matchCnt = 0 ; matchNdx = -1 ; shortCnt = 0 ; for (int i = 0 ; i < vecLen ; i++) { CoinParam *param = paramVec[i] ; if (param == 0) continue ; int match = paramVec[i]->matches(name) ; if (match == 1) { matchNdx = i ; matchCnt++ ; if (name == "?") { matchCnt = 1 ; break ; } } else { shortCnt += match>>1 ; } } return (matchCnt) ; } /* Now a bunch of routines that are useful in the context of generating help messages. */ /* Simple formatting routine for long messages. Used to print long help for parameters. Lines are broken at the first white space after 65 characters, or when an explicit return (`\n') character is scanned. Leading spaces are suppressed. */ void printIt (const char *msg) { int length = static_cast(strlen(msg)) ; char temp[101] ; int i ; int n = 0 ; for (i = 0 ; i < length ; i++) { if (msg[i] == '\n' || (n >= 65 && (msg[i] == ' ' || msg[i] == '\t'))) { temp[n] = '\0' ; std::cout << temp << std::endl ; n = 0 ; } else if (n || msg[i] != ' ') { temp[n++] = msg[i] ; } } if (n > 0) { temp[n] = '\0' ; std::cout << temp << std::endl ; } return ; } /* Utility function for the case where a name matches a single parameter, but either it's short, or the user wanted help, or both. The routine allows for the possibility that there are null entries in the parameter vector, but matchNdx should point to a valid entry if it's >= 0. */ void shortOrHelpOne (CoinParamVec ¶mVec, int matchNdx, std::string name, int numQuery) { int i ; int numParams = static_cast(paramVec.size()) ; int lclNdx = -1 ; /* For a short match, we need to look up the parameter again. This should find a short match, given the conditions where this routine is called. But be prepared to find a full match. If matchNdx >= 0, just use the index we're handed. */ if (matchNdx < 0) { int match = 0 ; for (i = 0 ; i < numParams ; i++) { CoinParam *param = paramVec[i] ; if (param == 0) continue ; int match = param->matches(name) ; if (match != 0) { lclNdx = i ; break ; } } assert (lclNdx >= 0) ; if (match == 1) { std::cout << "Match for '" << name << "': " << paramVec[matchNdx]->matchName() << "." ; } else { std::cout << "Short match for '" << name << "'; possible completion: " << paramVec[lclNdx]->matchName() << "." ; } } else { assert(matchNdx >= 0 && matchNdx < static_cast(paramVec.size())) ; std::cout << "Match for `" << name << "': " << paramVec[matchNdx]->matchName() ; lclNdx = matchNdx ; } /* Print some help, if there was a `?' in the name. `??' gets the long help. */ if (numQuery > 0) { std::cout << std::endl ; if (numQuery == 1) { std::cout << paramVec[lclNdx]->shortHelp() ; } else { paramVec[lclNdx]->printLongHelp() ; } } std::cout << std::endl ; return ; } /* Utility function for the case where a name matches multiple parameters. Zero or one `?' gets just the matching names, while `??' gets short help with each match. The routine allows for the possibility that there are null entries in the parameter vector. */ void shortOrHelpMany (CoinParamVec ¶mVec, std::string name, int numQuery) { int numParams = static_cast(paramVec.size()) ; /* Scan the parameter list. For each match, print just the name, or the name and short help. */ int lineLen = 0 ; bool printed = false ; for (int i = 0 ; i < numParams ; i++) { CoinParam *param = paramVec[i] ; if (param == 0) continue ; int match = param->matches(name) ; if (match > 0) { std::string nme = param->matchName() ; int len = static_cast(nme.length()) ; if (numQuery >= 2) { std::cout << nme << " : " << param->shortHelp() ; std::cout << std::endl ; } else { lineLen += 2+len ; if (lineLen > 80) { std::cout << std::endl ; lineLen = 2+len ; } std::cout << " " << nme ; printed = true ; } } } if (printed) { std::cout << std::endl ; } return ; } /* A generic help message that explains the basic operation of parameter parsing. */ void printGenericHelp () { std::cout << std::endl ; std::cout << "For command line arguments, keywords have a leading `-' or '--'; " << std::endl ; std::cout << "-stdin or just - switches to stdin with a prompt." << std::endl ; std::cout << "When prompted, one command per line, without the leading `-'." << std::endl ; std::cout << "abcd value sets abcd to value." << std::endl ; std::cout << "abcd without a value (where one is expected) gives the current value." << std::endl ; std::cout << "abcd? gives a list of possible matches; if there's only one, a short" << std::endl ; std::cout << "help message is printed." << std::endl ; std::cout << "abcd?? prints the short help for all matches; if there's only one" << std::endl ; std::cout << "match, a longer help message and current value are printed." << std::endl ; return ; } /* Utility function for various levels of `help' command. The entries between paramVec[firstParam] and paramVec[lastParam], inclusive, will be printed. If shortHelp is true, the short help message will be printed for each parameter. If longHelp is true, the long help message will be printed for each parameter. If hidden is true, even parameters with display = false will be printed. Each line is prefaced with the specified prefix. The routine allows for the possibility that there are null entries in the parameter vector. */ void printHelp (CoinParamVec ¶mVec, int firstParam, int lastParam, std::string prefix, bool shortHelp, bool longHelp, bool hidden) { bool noHelp = !(shortHelp || longHelp) ; int i ; int pfxLen = static_cast(prefix.length()) ; bool printed = false ; if (noHelp) { int lineLen = 0 ; for (i = firstParam ; i <= lastParam ; i++) { CoinParam *param = paramVec[i] ; if (param == 0) continue ; if (param->display() || hidden) { std::string nme = param->matchName() ; int len = static_cast(nme.length()) ; if (!printed) { std::cout << std::endl << prefix ; lineLen += pfxLen ; printed = true ; } lineLen += 2+len ; if (lineLen > 80) { std::cout << std::endl << prefix ; lineLen = pfxLen+2+len ; } std::cout << " " << nme ; } } if (printed) { std::cout << std::endl ; } } else if (shortHelp) { for (i = firstParam ; i <= lastParam ; i++) { CoinParam *param = paramVec[i] ; if (param == 0) continue ; if (param->display() || hidden) { std::cout << std::endl << prefix ; std::cout << param->matchName() ; std::cout << ": " ; std::cout << param->shortHelp() ; } } std::cout << std::endl ; } else if (longHelp) { for (i = firstParam ; i <= lastParam ; i++) { CoinParam *param = paramVec[i] ; if (param == 0) continue ; if (param->display() || hidden) { std::cout << std::endl << prefix ; std::cout << "Command: " << param->matchName() ; std::cout << std::endl << prefix ; std::cout << "---- description" << std::endl ; printIt(param->longHelp().c_str()) ; std::cout << prefix << "----" << std::endl ; } } } std::cout << std::endl ; return ; } } // end namespace CoinParamUtils CoinMP-1.8.3/CoinUtils/src/CoinAlloc.cpp0000644000175000017500000001065411510461170016365 0ustar renerene/* $Id: CoinAlloc.cpp 1373 2011-01-03 23:57:44Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include "CoinAlloc.hpp" #if (COINUTILS_MEMPOOL_MAXPOOLED >= 0) //============================================================================= CoinMempool::CoinMempool(size_t entry) : #if (COIN_MEMPOOL_SAVE_BLOCKHEADS==1) block_heads_(NULL), block_num_(0), max_block_num_(0), #endif last_block_size_(0), first_free_(NULL), entry_size_(entry) { #if defined(COINUTILS_PTHREADS) && (COINUTILS_PTHREAD == 1) pthread_mutex_init(&mutex_, NULL); #endif assert((entry_size_/COINUTILS_MEMPOOL_ALIGNMENT)*COINUTILS_MEMPOOL_ALIGNMENT == entry_size_); } //============================================================================= CoinMempool::~CoinMempool() { #if (COIN_MEMPOOL_SAVE_BLOCKHEADS==1) for (size_t i = 0; i < block_num_; ++i) { free(block_heads_[i]); } #endif #if defined(COINUTILS_PTHREADS) && (COINUTILS_PTHREAD == 1) pthread_mutex_destroy(&mutex_); #endif } //============================================================================== char* CoinMempool::alloc() { lock_mutex(); if (first_free_ == NULL) { unlock_mutex(); char* block = allocate_new_block(); lock_mutex(); #if (COIN_MEMPOOL_SAVE_BLOCKHEADS==1) // see if we can record another block head. If not, then resize // block_heads if (max_block_num_ == block_num_) { max_block_num_ = 2 * block_num_ + 10; char** old_block_heads = block_heads_; block_heads_ = (char**)malloc(max_block_num_ * sizeof(char*)); CoinMemcpyN( old_block_heads,block_num_,block_heads_); free(old_block_heads); } // save the new block block_heads_[block_num_++] = block; #endif // link in the new block *(char**)(block+((last_block_size_-1)*entry_size_)) = first_free_; first_free_ = block; } char* p = first_free_; first_free_ = *(char**)p; unlock_mutex(); return p; } //============================================================================= char* CoinMempool::allocate_new_block() { last_block_size_ = static_cast(1.5 * last_block_size_ + 32); char* block = static_cast(std::malloc(last_block_size_*entry_size_)); // link the entries in the new block together for (int i = last_block_size_-2; i >= 0; --i) { *(char**)(block+(i*entry_size_)) = block+((i+1)*entry_size_); } // terminate the linked list with a null pointer *(char**)(block+((last_block_size_-1)*entry_size_)) = NULL; return block; } //############################################################################# CoinAlloc CoinAllocator; CoinAlloc::CoinAlloc() : pool_(NULL), maxpooled_(COINUTILS_MEMPOOL_MAXPOOLED) { const char* maxpooled = std::getenv("COINUTILS_MEMPOOL_MAXPOOLED"); if (maxpooled) { maxpooled_ = std::atoi(maxpooled); } const size_t poolnum = maxpooled_ / COINUTILS_MEMPOOL_ALIGNMENT; maxpooled_ = poolnum * COINUTILS_MEMPOOL_ALIGNMENT; if (maxpooled_ > 0) { pool_ = (CoinMempool*)malloc(sizeof(CoinMempool)*poolnum); for (int i = poolnum-1; i >= 0; --i) { new (&pool_[i]) CoinMempool(i*COINUTILS_MEMPOOL_ALIGNMENT); } } } //############################################################################# #if defined(COINUTILS_MEMPOOL_OVERRIDE_NEW) && (COINUTILS_MEMPOOL_OVERRIDE_NEW == 1) void* operator new(std::size_t sz) throw (std::bad_alloc) { return CoinAllocator.alloc(sz); } void* operator new[](std::size_t sz) throw (std::bad_alloc) { return CoinAllocator.alloc(sz); } void operator delete(void* p) throw() { CoinAllocator.dealloc(p); } void operator delete[](void* p) throw() { CoinAllocator.dealloc(p); } void* operator new(std::size_t sz, const std::nothrow_t&) throw() { void *p = NULL; try { p = CoinAllocator.alloc(sz); } catch (std::bad_alloc &ba) { return NULL; } return p; } void* operator new[](std::size_t sz, const std::nothrow_t&) throw() { void *p = NULL; try { p = CoinAllocator.alloc(sz); } catch (std::bad_alloc &ba) { return NULL; } return p; } void operator delete(void* p, const std::nothrow_t&) throw() { CoinAllocator.dealloc(p); } void operator delete[](void* p, const std::nothrow_t&) throw() { CoinAllocator.dealloc(p); } #endif #endif /*(COINUTILS_MEMPOOL_MAXPOOLED >= 0)*/ CoinMP-1.8.3/CoinUtils/src/CoinPresolveMatrix.hpp0000644000175000017500000017127112442012653020332 0ustar renerene/* $Id: CoinPresolveMatrix.hpp 1761 2014-12-10 09:43:07Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveMatrix_H #define CoinPresolveMatrix_H #include "CoinPragma.hpp" #include "CoinPackedMatrix.hpp" #include "CoinMessage.hpp" #include "CoinTime.hpp" #include #include #include #include #include #if PRESOLVE_DEBUG > 0 #include "CoinFinite.hpp" #endif /*! \file Declarations for CoinPresolveMatrix and CoinPostsolveMatrix and their common base class CoinPrePostsolveMatrix. Also declarations for CoinPresolveAction and a number of non-member utility functions. */ #if defined(_MSC_VER) // Avoid MS Compiler problem in recognizing type to delete // by casting to type. // Is this still necessary? -- lh, 111202 -- #define deleteAction(array,type) delete [] ((type) array) #else #define deleteAction(array,type) delete [] array #endif /* Define PRESOLVE_DEBUG and PRESOLVE_CONSISTENCY on the configure command line or in a Makefile! See comments in CoinPresolvePsdebug.hpp. */ #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #define PRESOLVE_STMT(s) s #define PRESOLVEASSERT(x) \ ((x) ? 1 : ((std::cerr << "FAILED ASSERTION at line " \ << __LINE__ << ": " #x "\n"), abort(), 0)) inline void DIE(const char *s) { std::cout << s ; abort() ; } /*! \brief Indicate column or row present at start of postsolve This code is used during postsolve in [cr]done to indicate columns and rows that are present in the presolved system (i.e., present at the start of postsolve processing). \todo There are a bunch of these code definitions, scattered through presolve files. They should be collected in one place. */ #define PRESENT_IN_REDUCED '\377' #else #define PRESOLVEASSERT(x) {} #define PRESOLVE_STMT(s) {} inline void DIE(const char *) {} #endif /* Unclear why these are separate from standard debug. */ #ifndef PRESOLVE_DETAIL #define PRESOLVE_DETAIL_PRINT(s) {} #else #define PRESOLVE_DETAIL_PRINT(s) s #endif /*! \brief Zero tolerance OSL had a fixed zero tolerance; we still use that here. */ const double ZTOLDP = 1e-12 ; /*! \brief Alternate zero tolerance Use a different one if we are doing doubletons, etc. */ const double ZTOLDP2 = 1e-10 ; /// The usual finite infinity #define PRESOLVE_INF COIN_DBL_MAX /// And a small infinity #define PRESOLVE_SMALL_INF 1.0e20 /// Check for infinity using finite infinity #define PRESOLVEFINITE(n) (-PRESOLVE_INF < (n) && (n) < PRESOLVE_INF) class CoinPostsolveMatrix ; /*! \class CoinPresolveAction \brief Abstract base class of all presolve routines. The details will make more sense after a quick overview of the grand plan: A presolve object is handed a problem object, which it is expected to modify in some useful way. Assuming that it succeeds, the presolve object should create a postsolve object, i.e., an object that contains instructions for backing out the presolve transform to recover the original problem. These postsolve objects are accumulated in a linked list, with each successive presolve action adding its postsolve action to the head of the list. The end result of all this is a presolved problem object, and a list of postsolve objects. The presolved problem object is then handed to a solver for optimization, and the problem object augmented with the results. The list of postsolve objects is then traversed. Each of them (un)modifies the problem object, with the end result being the original problem, augmented with solution information. The problem object representation is CoinPrePostsolveMatrix and subclasses. Check there for details. The \c CoinPresolveAction class and subclasses represent the presolve and postsolve objects. In spite of the name, the only information held in a \c CoinPresolveAction object is the information needed to postsolve (i.e., the information needed to back out the presolve transformation). This information is not expected to change, so the fields are all \c const. A subclass of \c CoinPresolveAction, implementing a specific pre/postsolve action, is expected to declare a static function that attempts to perform a presolve transformation. This function will be handed a CoinPresolveMatrix to transform, and a pointer to the head of the list of postsolve objects. If the transform is successful, the function will create a new \c CoinPresolveAction object, link it at the head of the list of postsolve objects, and return a pointer to the postsolve object it has just created. Otherwise, it should return 0. It is expected that these static functions will be the only things that can create new \c CoinPresolveAction objects; this is expressed by making each subclass' constructor(s) private. Every subclass must also define a \c postsolve method. This function will be handed a CoinPostsolveMatrix to transform. It is the client's responsibility to implement presolve and postsolve driver routines. See OsiPresolve for examples. \note Since the only fields in a \c CoinPresolveAction are \c const, anything one can do with a variable declared \c CoinPresolveAction* can also be done with a variable declared \c const \c CoinPresolveAction* It is expected that all derived subclasses of \c CoinPresolveAction also have this property. */ class CoinPresolveAction { public: /*! \brief Stub routine to throw exceptions. Exceptions are inefficient, particularly with g++. Even with xlC, the use of exceptions adds a long prologue to a routine. Therefore, rather than use throw directly in the routine, I use it in a stub routine. */ static void throwCoinError(const char *error, const char *ps_routine) { throw CoinError(error, ps_routine, "CoinPresolve"); } /*! \brief The next presolve transformation Set at object construction. */ const CoinPresolveAction *next; /*! \brief Construct a postsolve object and add it to the transformation list. This is an `add to head' operation. This object will point to the one passed as the parameter. */ CoinPresolveAction(const CoinPresolveAction *next) : next(next) {} /// modify next (when building rather than passing) inline void setNext(const CoinPresolveAction *nextAction) { next = nextAction;} /*! \brief A name for debug printing. It is expected that the name is not stored in the transform itself. */ virtual const char *name() const = 0; /*! \brief Apply the postsolve transformation for this particular presolve action. */ virtual void postsolve(CoinPostsolveMatrix *prob) const = 0; /*! \brief Virtual destructor. */ virtual ~CoinPresolveAction() {} }; /* These are needed for OSI-aware constructors associated with CoinPrePostsolveMatrix, CoinPresolveMatrix, and CoinPostsolveMatrix. */ class ClpSimplex; class OsiSolverInterface; /* CoinWarmStartBasis is required for methods in CoinPrePostsolveMatrix that accept/return a CoinWarmStartBasis object. */ class CoinWarmStartBasis ; /*! \class CoinPrePostsolveMatrix \brief Collects all the information about the problem that is needed in both presolve and postsolve. In a bit more detail, a column-major representation of the constraint matrix and upper and lower bounds on variables and constraints, plus row and column solutions, reduced costs, and status. There's also a set of arrays holding the original row and column numbers. As presolve and postsolve transform the matrix, it will occasionally be necessary to expand the number of entries in a column. There are two aspects:
    • During postsolve, the constraint system is expected to grow as the smaller presolved system is transformed back to the original system.
    • During both pre- and postsolve, transforms can increase the number of coefficients in a row or column. (See the variable substitution, doubleton, and tripleton transforms.)
    The first is addressed by the members #ncols0_, #nrows0_, and #nelems0_. These should be set (via constructor parameters) to values large enough for the largest size taken on by the constraint system. Typically, this will be the size of the original constraint system. The second is addressed by a generous allocation of extra (empty) space for the arrays used to hold coefficients and row indices. When columns must be expanded, they are moved into the empty space. When it is used up, the arrays are compacted. When compaction fails to produce sufficient space, presolve/postsolve will fail. CoinPrePostsolveMatrix isn't really intended to be used `bare' --- the expectation is that it'll be used through CoinPresolveMatrix or CoinPostsolveMatrix. Some of the functions needed to load a problem are defined in the derived classes. When CoinPresolve is applied when reoptimising, we need to be prepared to accept a basis and modify it in step with the presolve actions (otherwise we throw away all the advantages of warm start for reoptimization). But other solution components (#acts_, #rowduals_, #sol_, and #rcosts_) are needed only for postsolve, where they're used in places to determine the proper action(s) when restoring rows or columns. If presolve is provided with a solution, it will modify it in step with the presolve actions. Moving the solution components from CoinPrePostsolveMatrix to CoinPostsolveMatrix would break a lot of code. It's not clear that it's worth it, and it would preclude upgrades to the presolve side that might make use of any of these. -- lh, 080501 -- The constructors that take an OSI or ClpSimplex as a parameter really should not be here, but for historical reasons they will likely remain for the forseeable future. -- lh, 111202 -- */ class CoinPrePostsolveMatrix { public: /*! \name Constructors & Destructors */ //@{ /*! \brief `Native' constructor This constructor creates an empty object which must then be loaded. On the other hand, it doesn't assume that the client is an OsiSolverInterface. */ CoinPrePostsolveMatrix(int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc) ; /*! \brief Generic OSI constructor See OSI code for the definition. */ CoinPrePostsolveMatrix(const OsiSolverInterface * si, int ncols_, int nrows_, CoinBigIndex nelems_); /*! ClpOsi constructor See Clp code for the definition. */ CoinPrePostsolveMatrix(const ClpSimplex * si, int ncols_, int nrows_, CoinBigIndex nelems_, double bulkRatio); /// Destructor ~CoinPrePostsolveMatrix(); //@} /*! \brief Enum for status of various sorts Matches CoinWarmStartBasis::Status and adds superBasic. Most code that converts between CoinPrePostsolveMatrix::Status and CoinWarmStartBasis::Status will break if this correspondence is broken. superBasic is an unresolved problem: there's no analogue in CoinWarmStartBasis::Status. */ enum Status { isFree = 0x00, basic = 0x01, atUpperBound = 0x02, atLowerBound = 0x03, superBasic = 0x04 }; /*! \name Functions to work with variable status Functions to work with the CoinPrePostsolveMatrix::Status enum and related vectors. \todo Why are we futzing around with three bit status? A holdover from the packed arrays of CoinWarmStartBasis? Big swaths of the presolve code manipulates colstat_ and rowstat_ as unsigned char arrays using simple assignment to set values. */ //@{ /// Set row status (i.e., status of artificial for this row) inline void setRowStatus(int sequence, Status status) { unsigned char & st_byte = rowstat_[sequence]; st_byte = static_cast(st_byte & (~7)) ; st_byte = static_cast(st_byte | status) ; } /// Get row status inline Status getRowStatus(int sequence) const {return static_cast (rowstat_[sequence]&7);} /// Check if artificial for this row is basic inline bool rowIsBasic(int sequence) const {return (static_cast (rowstat_[sequence]&7)==basic);} /// Set column status (i.e., status of primal variable) inline void setColumnStatus(int sequence, Status status) { unsigned char & st_byte = colstat_[sequence]; st_byte = static_cast(st_byte & (~7)) ; st_byte = static_cast(st_byte | status) ; # ifdef PRESOLVE_DEBUG switch (status) { case isFree: { if (clo_[sequence] > -PRESOLVE_INF || cup_[sequence] < PRESOLVE_INF) { std::cout << "Bad status: Var " << sequence << " isFree, lb = " << clo_[sequence] << ", ub = " << cup_[sequence] << std::endl ; } break ; } case basic: { break ; } case atUpperBound: { if (cup_[sequence] >= PRESOLVE_INF) { std::cout << "Bad status: Var " << sequence << " atUpperBound, lb = " << clo_[sequence] << ", ub = " << cup_[sequence] << std::endl ; } break ; } case atLowerBound: { if (clo_[sequence] <= -PRESOLVE_INF) { std::cout << "Bad status: Var " << sequence << " atLowerBound, lb = " << clo_[sequence] << ", ub = " << cup_[sequence] << std::endl ; } break ; } case superBasic: { if (clo_[sequence] <= -PRESOLVE_INF && cup_[sequence] >= PRESOLVE_INF) { std::cout << "Bad status: Var " << sequence << " superBasic, lb = " << clo_[sequence] << ", ub = " << cup_[sequence] << std::endl ; } break ; } default: { assert(false) ; break ; } } # endif } /// Get column (structural variable) status inline Status getColumnStatus(int sequence) const {return static_cast (colstat_[sequence]&7);} /// Check if column (structural variable) is basic inline bool columnIsBasic(int sequence) const {return (static_cast (colstat_[sequence]&7)==basic);} /*! \brief Set status of row (artificial variable) to the correct nonbasic status given bounds and current value */ void setRowStatusUsingValue(int iRow); /*! \brief Set status of column (structural variable) to the correct nonbasic status given bounds and current value */ void setColumnStatusUsingValue(int iColumn); /*! \brief Set column (structural variable) status vector */ void setStructuralStatus(const char *strucStatus, int lenParam) ; /*! \brief Set row (artificial variable) status vector */ void setArtificialStatus(const char *artifStatus, int lenParam) ; /*! \brief Set the status of all variables from a basis */ void setStatus(const CoinWarmStartBasis *basis) ; /*! \brief Get status in the form of a CoinWarmStartBasis */ CoinWarmStartBasis *getStatus() ; /*! \brief Return a print string for status of a column (structural variable) */ const char *columnStatusString(int j) const ; /*! \brief Return a print string for status of a row (artificial variable) */ const char *rowStatusString(int i) const ; //@} /*! \name Functions to load problem and solution information These functions can be used to load portions of the problem definition and solution. See also the CoinPresolveMatrix and CoinPostsolveMatrix classes. */ //@{ /// Set the objective function offset for the original system. void setObjOffset(double offset) ; /*! \brief Set the objective sense (max/min) Coded as 1.0 for min, -1.0 for max. Yes, there's a method, and a matching attribute. No, you really don't want to set this to maximise. */ void setObjSense(double objSense) ; /// Set the primal feasibility tolerance void setPrimalTolerance(double primTol) ; /// Set the dual feasibility tolerance void setDualTolerance(double dualTol) ; /// Set column lower bounds void setColLower(const double *colLower, int lenParam) ; /// Set column upper bounds void setColUpper(const double *colUpper, int lenParam) ; /// Set column solution void setColSolution(const double *colSol, int lenParam) ; /// Set objective coefficients void setCost(const double *cost, int lenParam) ; /// Set reduced costs void setReducedCost(const double *redCost, int lenParam) ; /// Set row lower bounds void setRowLower(const double *rowLower, int lenParam) ; /// Set row upper bounds void setRowUpper(const double *rowUpper, int lenParam) ; /// Set row solution void setRowPrice(const double *rowSol, int lenParam) ; /// Set row activity void setRowActivity(const double *rowAct, int lenParam) ; //@} /*! \name Functions to retrieve problem and solution information */ //@{ /// Get current number of columns inline int getNumCols() const { return (ncols_) ; } /// Get current number of rows inline int getNumRows() const { return (nrows_) ; } /// Get current number of non-zero coefficients inline int getNumElems() const { return (nelems_) ; } /// Get column start vector for column-major packed matrix inline const CoinBigIndex *getColStarts() const { return (mcstrt_) ; } /// Get column length vector for column-major packed matrix inline const int *getColLengths() const { return (hincol_) ; } /// Get vector of row indices for column-major packed matrix inline const int *getRowIndicesByCol() const { return (hrow_) ; } /// Get vector of elements for column-major packed matrix inline const double *getElementsByCol() const { return (colels_) ; } /// Get column lower bounds inline const double *getColLower() const { return (clo_) ; } /// Get column upper bounds inline const double *getColUpper() const { return (cup_) ; } /// Get objective coefficients inline const double *getCost() const { return (cost_) ; } /// Get row lower bounds inline const double *getRowLower() const { return (rlo_) ; } /// Get row upper bounds inline const double *getRowUpper() const { return (rup_) ; } /// Get column solution (primal variable values) inline const double *getColSolution() const { return (sol_) ; } /// Get row activity (constraint lhs values) inline const double *getRowActivity() const { return (acts_) ; } /// Get row solution (dual variables) inline const double *getRowPrice() const { return (rowduals_) ; } /// Get reduced costs inline const double *getReducedCost() const { return (rcosts_) ; } /// Count empty columns inline int countEmptyCols() { int empty = 0 ; for (int i = 0 ; i < ncols_ ; i++) if (hincol_[i] == 0) empty++ ; return (empty) ; } //@} /*! \name Message handling */ //@{ /// Return message handler inline CoinMessageHandler *messageHandler() const { return handler_; } /*! \brief Set message handler The client retains responsibility for the handler --- it will not be destroyed with the \c CoinPrePostsolveMatrix object. */ inline void setMessageHandler(CoinMessageHandler *handler) { if (defaultHandler_ == true) { delete handler_ ; defaultHandler_ = false ; } handler_ = handler ; } /// Return messages inline CoinMessages messages() const { return messages_; } //@} /*! \name Current and Allocated Size During pre- and postsolve, the matrix will change in size. During presolve it will shrink; during postsolve it will grow. Hence there are two sets of size variables, one for the current size and one for the allocated size. (See the general comments for the CoinPrePostsolveMatrix class for more information.) */ //@{ /// current number of columns int ncols_; /// current number of rows int nrows_; /// current number of coefficients CoinBigIndex nelems_; /// Allocated number of columns int ncols0_; /// Allocated number of rows int nrows0_ ; /// Allocated number of coefficients CoinBigIndex nelems0_ ; /*! \brief Allocated size of bulk storage for row indices and coefficients This is the space allocated for hrow_ and colels_. This must be large enough to allow columns to be copied into empty space when they need to be expanded. For efficiency (to minimize the number of times the representation must be compressed) it's recommended that this be at least 2*nelems0_. */ CoinBigIndex bulk0_ ; /// Ratio of bulk0_ to nelems0_; default is 2. double bulkRatio_; //@} /*! \name Problem representation The matrix is the common column-major format: A pair of vectors with positional correspondence to hold coefficients and row indices, and a second pair of vectors giving the starting position and length of each column in the first pair. */ //@{ /// Vector of column start positions in #hrow_, #colels_ CoinBigIndex *mcstrt_; /// Vector of column lengths int *hincol_; /// Row indices (positional correspondence with #colels_) int *hrow_; /// Coefficients (positional correspondence with #hrow_) double *colels_; /// Objective coefficients double *cost_; /// Original objective offset double originalOffset_; /// Column (primal variable) lower bounds double *clo_; /// Column (primal variable) upper bounds double *cup_; /// Row (constraint) lower bounds double *rlo_; /// Row (constraint) upper bounds double *rup_; /*! \brief Original column numbers Over the current range of column numbers in the presolved problem, the entry for column j will contain the index of the corresponding column in the original problem. */ int * originalColumn_; /*! \brief Original row numbers Over the current range of row numbers in the presolved problem, the entry for row i will contain the index of the corresponding row in the original problem. */ int * originalRow_; /// Primal feasibility tolerance double ztolzb_; /// Dual feasibility tolerance double ztoldj_; /*! \brief Maximization/minimization Yes, there's a variable here. No, you really don't want to set this to maximise. See the main notes for CoinPresolveMatrix. */ double maxmin_; //@} /*! \name Problem solution information The presolve phase will work without any solution information (appropriate for initial optimisation) or with solution information (appropriate for reoptimisation). When solution information is supplied, presolve will maintain it to the best of its ability. #colstat_ is checked to determine the presence/absence of status information. #sol_ is checked for primal solution information, and #rowduals_ for dual solution information. The postsolve phase requires the complete solution information from the presolved problem (status, primal and dual solutions). It will be transformed into a correct solution for the original problem. */ //@{ /*! \brief Vector of primal variable values If #sol_ exists, it is assumed that primal solution information should be updated and that #acts_ also exists. */ double *sol_; /*! \brief Vector of dual variable values If #rowduals_ exists, it is assumed that dual solution information should be updated and that #rcosts_ also exists. */ double *rowduals_; /*! \brief Vector of constraint left-hand-side values (row activity) Produced by evaluating constraints according to #sol_. Updated iff #sol_ exists. */ double *acts_; /*! \brief Vector of reduced costs Produced by evaluating dual constraints according to #rowduals_. Updated iff #rowduals_ exists. */ double *rcosts_; /*! \brief Status of primal variables Coded with CoinPrePostSolveMatrix::Status, one code per char. colstat_ and #rowstat_ MUST be allocated as a single vector. This is to maintain compatibility with ClpPresolve and OsiPresolve, which do it this way. */ unsigned char *colstat_; /*! \brief Status of constraints More accurately, the status of the logical variable associated with the constraint. Coded with CoinPrePostSolveMatrix::Status, one code per char. Note that this must be allocated as a single vector with #colstat_. */ unsigned char *rowstat_; //@} /*! \name Message handling Uses the standard COIN approach: a default handler is installed, and the CoinPrePostsolveMatrix object takes responsibility for it. If the client replaces the handler with one of their own, it becomes their responsibility. */ //@{ /// Message handler CoinMessageHandler *handler_; /// Indicates if the current #handler_ is default (true) or not (false). bool defaultHandler_; /// Standard COIN messages CoinMessage messages_; //@} }; /*! \relates CoinPrePostsolveMatrix \brief Generate a print string for a status code. */ const char *statusName (CoinPrePostsolveMatrix::Status status) ; /*! \class presolvehlink \brief Links to aid in packed matrix modification Currently, the matrices held by the CoinPrePostsolveMatrix and CoinPresolveMatrix objects are represented in the same way as a CoinPackedMatrix. In the course of presolve and postsolve transforms, it will happen that a major-dimension vector needs to increase in size. In order to check whether there is enough room to add another coefficient in place, it helps to know the next vector (in memory order) in the bulk storage area. To do that, a linked list of major-dimension vectors is maintained; the "pre" and "suc" fields give the previous and next vector, in memory order (that is, the vector whose mcstrt_ or mrstrt_ entry is next smaller or larger). Consider a column-major matrix with ncols columns. By definition, presolvehlink[ncols].pre points to the column in the last occupied position of the bulk storage arrays. There is no easy way to find the column which occupies the first position (there is no presolvehlink[-1] to consult). If the column that initially occupies the first position is moved for expansion, there is no way to reclaim the space until the bulk storage is compacted. The same holds for the last and first rows of a row-major matrix, of course. */ class presolvehlink { public: int pre, suc; } ; #define NO_LINK -66666666 /*! \relates presolvehlink \brief unlink vector i Remove vector i from the ordering. */ inline void PRESOLVE_REMOVE_LINK(presolvehlink *link, int i) { int ipre = link[i].pre; int isuc = link[i].suc; if (ipre >= 0) { link[ipre].suc = isuc; } if (isuc >= 0) { link[isuc].pre = ipre; } link[i].pre = NO_LINK, link[i].suc = NO_LINK; } /*! \relates presolvehlink \brief insert vector i after vector j Insert vector i between j and j.suc. */ inline void PRESOLVE_INSERT_LINK(presolvehlink *link, int i, int j) { int isuc = link[j].suc; link[j].suc = i; link[i].pre = j; if (isuc >= 0) { link[isuc].pre = i; } link[i].suc = isuc; } /*! \relates presolvehlink \brief relink vector j in place of vector i Replace vector i in the ordering with vector j. This is equivalent to
         int pre = link[i].pre;
         PRESOLVE_REMOVE_LINK(link,i);
         PRESOLVE_INSERT_LINK(link,j,pre);
       
    But, this routine will work even if i happens to be first in the order. */ inline void PRESOLVE_MOVE_LINK(presolvehlink *link, int i, int j) { int ipre = link[i].pre; int isuc = link[i].suc; if (ipre >= 0) { link[ipre].suc = j; } if (isuc >= 0) { link[isuc].pre = j; } link[i].pre = NO_LINK, link[i].suc = NO_LINK; } /*! \class CoinPresolveMatrix \brief Augments CoinPrePostsolveMatrix with information about the problem that is only needed during presolve. For problem manipulation, this class adds a row-major matrix representation, linked lists that allow for easy manipulation of the matrix when applying presolve transforms, and vectors to track row and column processing status (changed, needs further processing, change prohibited) For problem representation, this class adds information about variable type (integer or continuous), an objective offset, and a feasibility tolerance. NOTE that the #anyInteger_ and #anyProhibited_ flags are independent of the vectors used to track this information for individual variables (#integerType_ and #rowChanged_ and #colChanged_, respectively). NOTE also that at the end of presolve the column-major and row-major matrix representations are loosely packed (i.e., there may be gaps between columns in the bulk storage arrays). NOTE that while you might think that CoinPresolve is prepared to handle minimisation or maximisation, it's unlikely that this still works. This is a good thing: better to convert objective coefficients and duals once, before starting presolve, rather than doing it over and over in each transform that considers dual variables. The constructors that take an OSI or ClpSimplex as a parameter really should not be here, but for historical reasons they will likely remain for the forseeable future. -- lh, 111202 -- */ class CoinPresolveMatrix : public CoinPrePostsolveMatrix { public: /*! \brief `Native' constructor This constructor creates an empty object which must then be loaded. On the other hand, it doesn't assume that the client is an OsiSolverInterface. */ CoinPresolveMatrix(int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc) ; /*! \brief Clp OSI constructor See Clp code for the definition. */ CoinPresolveMatrix(int ncols0, double maxmin, // end prepost members ClpSimplex * si, // rowrep int nrows, CoinBigIndex nelems, bool doStatus, double nonLinearVariable, double bulkRatio); /*! \brief Update the model held by a Clp OSI */ void update_model(ClpSimplex * si, int nrows0, int ncols0, CoinBigIndex nelems0); /*! \brief Generic OSI constructor See OSI code for the definition. */ CoinPresolveMatrix(int ncols0, double maxmin, // end prepost members OsiSolverInterface * si, // rowrep int nrows, CoinBigIndex nelems, bool doStatus, double nonLinearVariable, const char * prohibited, const char * rowProhibited=NULL); /*! \brief Update the model held by a generic OSI */ void update_model(OsiSolverInterface * si, int nrows0, int ncols0, CoinBigIndex nelems0); /// Destructor ~CoinPresolveMatrix(); /*! \brief Initialize a CoinPostsolveMatrix object, destroying the CoinPresolveMatrix object. See CoinPostsolveMatrix::assignPresolveToPostsolve. */ friend void assignPresolveToPostsolve (CoinPresolveMatrix *&preObj) ; /*! \name Functions to load the problem representation */ //@{ /*! \brief Load the cofficient matrix. Load the coefficient matrix before loading the other vectors (bounds, objective, variable type) required to define the problem. */ void setMatrix(const CoinPackedMatrix *mtx) ; /// Count number of empty rows inline int countEmptyRows() { int empty = 0 ; for (int i = 0 ; i < nrows_ ; i++) if (hinrow_[i] == 0) empty++ ; return (empty) ; } /*! \brief Set variable type information for a single variable Set \p variableType to 0 for continous, 1 for integer. Does not manipulate the #anyInteger_ flag. */ inline void setVariableType(int i, int variableType) { if (integerType_ == 0) integerType_ = new unsigned char [ncols0_] ; integerType_[i] = static_cast(variableType) ; } /*! \brief Set variable type information for all variables Set \p variableType[i] to 0 for continuous, 1 for integer. Does not manipulate the #anyInteger_ flag. */ void setVariableType(const unsigned char *variableType, int lenParam) ; /*! \brief Set the type of all variables allIntegers should be true to set the type to integer, false to set the type to continuous. */ void setVariableType (bool allIntegers, int lenParam) ; /// Set a flag for presence (true) or absence (false) of integer variables inline void setAnyInteger (bool anyInteger = true) { anyInteger_ = anyInteger ; } //@} /*! \name Functions to retrieve problem information */ //@{ /// Get row start vector for row-major packed matrix inline const CoinBigIndex *getRowStarts() const { return (mrstrt_) ; } /// Get vector of column indices for row-major packed matrix inline const int *getColIndicesByRow() const { return (hcol_) ; } /// Get vector of elements for row-major packed matrix inline const double *getElementsByRow() const { return (rowels_) ; } /*! \brief Check for integrality of the specified variable. Consults the #integerType_ vector if present; fallback is the #anyInteger_ flag. */ inline bool isInteger (int i) const { if (integerType_ == 0) { return (anyInteger_) ; } else if (integerType_[i] == 1) { return (true) ; } else { return (false) ; } } /*! \brief Check if there are any integer variables Consults the #anyInteger_ flag */ inline bool anyInteger () const { return (anyInteger_) ; } /// Picks up any special options inline int presolveOptions() const { return presolveOptions_;} /// Sets any special options (see #presolveOptions_) inline void setPresolveOptions(int value) { presolveOptions_=value;} //@} /*! \name Matrix storage management links Linked lists, modelled after the linked lists used in OSL factorization. They are used for management of the bulk coefficient and minor index storage areas. */ //@{ /// Linked list for the column-major representation. presolvehlink *clink_; /// Linked list for the row-major representation. presolvehlink *rlink_; //@} /// Objective function offset introduced during presolve double dobias_ ; /// Adjust objective function constant offset inline void change_bias(double change_amount) { dobias_ += change_amount ; # if PRESOLVE_DEBUG > 2 assert(fabs(change_amount)<1.0e50) ; if (change_amount) PRESOLVE_STMT(printf("changing bias by %g to %g\n", change_amount, dobias_)) ; # endif } /*! \name Row-major representation Common row-major format: A pair of vectors with positional correspondence to hold coefficients and column indices, and a second pair of vectors giving the starting position and length of each row in the first pair. */ //@{ /// Vector of row start positions in #hcol, #rowels_ CoinBigIndex *mrstrt_; /// Vector of row lengths int *hinrow_; /// Coefficients (positional correspondence with #hcol_) double *rowels_; /// Column indices (positional correspondence with #rowels_) int *hcol_; //@} /// Tracks integrality of columns (1 for integer, 0 for continuous) unsigned char *integerType_; /*! \brief Flag to say if any variables are integer Note that this flag is not manipulated by the various \c setVariableType routines. */ bool anyInteger_ ; /// Print statistics for tuning bool tuning_; /// Say we want statistics - also set time void statistics(); /// Start time of presolve double startTime_; /// Bounds can be moved by this to retain feasibility double feasibilityTolerance_; /// Return feasibility tolerance inline double feasibilityTolerance() { return (feasibilityTolerance_) ; } /// Set feasibility tolerance inline void setFeasibilityTolerance (double val) { feasibilityTolerance_ = val ; } /*! \brief Output status: 0 = feasible, 1 = infeasible, 2 = unbounded Actually implemented as single bit flags: 1^0 = infeasible, 1^1 = unbounded. */ int status_; /// Returns problem status (0 = feasible, 1 = infeasible, 2 = unbounded) inline int status() { return (status_) ; } /// Set problem status inline void setStatus(int status) { status_ = (status&0x3) ; } /*! \brief Presolve pass number Should be incremented externally by the method controlling application of presolve transforms. Used to control the execution of testRedundant (evoked by the implied_free transform). */ int pass_; /// Set pass number inline void setPass (int pass = 0) { pass_ = pass ; } /*! \brief Maximum substitution level Used to control the execution of subst from implied_free */ int maxSubstLevel_; /// Set Maximum substitution level (normally 3) inline void setMaximumSubstitutionLevel (int level) { maxSubstLevel_ = level ; } /*! \name Row and column processing status Information used to determine if rows or columns can be changed and if they require further processing due to changes. There are four major lists: the [row,col]ToDo list, and the [row,col]NextToDo list. In general, a transform processes entries from the ToDo list and adds entries to the NextToDo list. There are two vectors, [row,col]Changed, which track the status of individual rows and columns. */ //@{ /*! \brief Column change status information Coded using the following bits:
    • 0x01: Column has changed
    • 0x02: preprocessing prohibited
    • 0x04: Column has been used
    • 0x08: Column originally had infinite ub
    */ unsigned char * colChanged_; /// Input list of columns to process int * colsToDo_; /// Length of #colsToDo_ int numberColsToDo_; /// Output list of columns to process next int * nextColsToDo_; /// Length of #nextColsToDo_ int numberNextColsToDo_; /*! \brief Row change status information Coded using the following bits:
    • 0x01: Row has changed
    • 0x02: preprocessing prohibited
    • 0x04: Row has been used
    */ unsigned char * rowChanged_; /// Input list of rows to process int * rowsToDo_; /// Length of #rowsToDo_ int numberRowsToDo_; /// Output list of rows to process next int * nextRowsToDo_; /// Length of #nextRowsToDo_ int numberNextRowsToDo_; /*! \brief Fine control over presolve actions Set/clear the following bits to allow or suppress actions: - 0x01 allow duplicate column tests for integer variables - 0x02 not used - 0x04 set to inhibit x+y+z=1 mods - 0x08 not used - 0x10 set to allow stuff which won't unroll easily (overlapping duplicate rows; opportunistic fixing of variables from bound propagation). - 0x04000 allow presolve transforms to arbitrarily ignore infeasibility and set arbitrary feasible bounds. - 0x10000 instructs implied_free_action to be `more lightweight'; will return without doing anything after 15 presolve passes. - 0x(2,4,6)0000 instructs implied_free_action to remove small created elements - 0x80000000 set by presolve to say dupcol_action compressed columns */ int presolveOptions_; /*! Flag to say if any rows or columns are marked as prohibited Note that this flag is not manipulated by any of the various \c set*Prohibited routines. */ bool anyProhibited_; //@} /*! \name Scratch work arrays Preallocated work arrays are useful to avoid having to allocate and free work arrays in individual presolve methods. All are allocated from #setMatrix by #initializeStuff, freed from #~CoinPresolveMatrix. You can use #deleteStuff followed by #initializeStuff to remove and recreate them. */ //@{ /// Preallocated scratch work array, 3*nrows_ int *usefulRowInt_ ; /// Preallocated scratch work array, 2*nrows_ double *usefulRowDouble_ ; /// Preallocated scratch work array, 2*ncols_ int *usefulColumnInt_ ; /// Preallocated scratch work array, ncols_ double *usefulColumnDouble_ ; /// Array of random numbers (max row,column) double *randomNumber_ ; /// Work array for count of infinite contributions to row lhs upper bound int *infiniteUp_ ; /// Work array for sum of finite contributions to row lhs upper bound double *sumUp_ ; /// Work array for count of infinite contributions to row lhs lower bound int *infiniteDown_ ; /// Work array for sum of finite contributions to row lhs lower bound double *sumDown_ ; //@} /*! \brief Recompute row lhs bounds Calculate finite contributions to row lhs upper and lower bounds and count infinite contributions. Returns the number of rows found to be infeasible. If \p whichRow < 0, bounds are recomputed for all rows. As of 110611, this seems to be a work in progress in the sense that it's barely used by the existing presolve code. */ int recomputeSums(int whichRow) ; /// Allocate scratch arrays void initializeStuff() ; /// Free scratch arrays void deleteStuff() ; /*! \name Functions to manipulate row and column processing status */ //@{ /*! \brief Initialise the column ToDo lists Places all columns in the #colsToDo_ list except for columns marked as prohibited (viz. #colChanged_). */ void initColsToDo () ; /*! \brief Step column ToDo lists Moves columns on the #nextColsToDo_ list to the #colsToDo_ list, emptying #nextColsToDo_. Returns the number of columns transferred. */ int stepColsToDo () ; /// Return the number of columns on the #colsToDo_ list inline int numberColsToDo() { return (numberColsToDo_) ; } /// Has column been changed? inline bool colChanged(int i) const { return (colChanged_[i]&1)!=0; } /// Mark column as not changed inline void unsetColChanged(int i) { colChanged_[i] = static_cast(colChanged_[i] & (~1)) ; } /// Mark column as changed. inline void setColChanged(int i) { colChanged_[i] = static_cast(colChanged_[i] | (1)) ; } /// Mark column as changed and add to list of columns to process next inline void addCol(int i) { if ((colChanged_[i]&1)==0) { colChanged_[i] = static_cast(colChanged_[i] | (1)) ; nextColsToDo_[numberNextColsToDo_++] = i; } } /// Test if column is eligible for preprocessing inline bool colProhibited(int i) const { return (colChanged_[i]&2)!=0; } /*! \brief Test if column is eligible for preprocessing The difference between this method and #colProhibited() is that this method first tests #anyProhibited_ before examining the specific entry for the specified column. */ inline bool colProhibited2(int i) const { if (!anyProhibited_) return false; else return (colChanged_[i]&2)!=0; } /// Mark column as ineligible for preprocessing inline void setColProhibited(int i) { colChanged_[i] = static_cast(colChanged_[i] | (2)) ; } /*! \brief Test if column is marked as used This is for doing faster lookups to see where two columns have entries in common. */ inline bool colUsed(int i) const { return (colChanged_[i]&4)!=0; } /// Mark column as used inline void setColUsed(int i) { colChanged_[i] = static_cast(colChanged_[i] | (4)) ; } /// Mark column as unused inline void unsetColUsed(int i) { colChanged_[i] = static_cast(colChanged_[i] & (~4)) ; } /// Has column infinite ub (originally) inline bool colInfinite(int i) const { return (colChanged_[i]&8)!=0; } /// Mark column as not infinite ub (originally) inline void unsetColInfinite(int i) { colChanged_[i] = static_cast(colChanged_[i] & (~8)) ; } /// Mark column as infinite ub (originally) inline void setColInfinite(int i) { colChanged_[i] = static_cast(colChanged_[i] | (8)) ; } /*! \brief Initialise the row ToDo lists Places all rows in the #rowsToDo_ list except for rows marked as prohibited (viz. #rowChanged_). */ void initRowsToDo () ; /*! \brief Step row ToDo lists Moves rows on the #nextRowsToDo_ list to the #rowsToDo_ list, emptying #nextRowsToDo_. Returns the number of rows transferred. */ int stepRowsToDo () ; /// Return the number of rows on the #rowsToDo_ list inline int numberRowsToDo() { return (numberRowsToDo_) ; } /// Has row been changed? inline bool rowChanged(int i) const { return (rowChanged_[i]&1)!=0; } /// Mark row as not changed inline void unsetRowChanged(int i) { rowChanged_[i] = static_cast(rowChanged_[i] & (~1)) ; } /// Mark row as changed inline void setRowChanged(int i) { rowChanged_[i] = static_cast(rowChanged_[i] | (1)) ; } /// Mark row as changed and add to list of rows to process next inline void addRow(int i) { if ((rowChanged_[i]&1)==0) { rowChanged_[i] = static_cast(rowChanged_[i] | (1)) ; nextRowsToDo_[numberNextRowsToDo_++] = i; } } /// Test if row is eligible for preprocessing inline bool rowProhibited(int i) const { return (rowChanged_[i]&2)!=0; } /*! \brief Test if row is eligible for preprocessing The difference between this method and #rowProhibited() is that this method first tests #anyProhibited_ before examining the specific entry for the specified row. */ inline bool rowProhibited2(int i) const { if (!anyProhibited_) return false; else return (rowChanged_[i]&2)!=0; } /// Mark row as ineligible for preprocessing inline void setRowProhibited(int i) { rowChanged_[i] = static_cast(rowChanged_[i] | (2)) ; } /*! \brief Test if row is marked as used This is for doing faster lookups to see where two rows have entries in common. It can be used anywhere as long as it ends up zeroed out. */ inline bool rowUsed(int i) const { return (rowChanged_[i]&4)!=0; } /// Mark row as used inline void setRowUsed(int i) { rowChanged_[i] = static_cast(rowChanged_[i] | (4)) ; } /// Mark row as unused inline void unsetRowUsed(int i) { rowChanged_[i] = static_cast(rowChanged_[i] & (~4)) ; } /// Check if there are any prohibited rows or columns inline bool anyProhibited() const { return anyProhibited_;} /// Set a flag for presence of prohibited rows or columns inline void setAnyProhibited(bool val = true) { anyProhibited_ = val ; } //@} }; /*! \class CoinPostsolveMatrix \brief Augments CoinPrePostsolveMatrix with information about the problem that is only needed during postsolve. The notable point is that the matrix representation is threaded. The representation is column-major and starts with the standard two pairs of arrays: one pair to hold the row indices and coefficients, the second pair to hold the column starting positions and lengths. But the row indices and coefficients for a column do not necessarily occupy a contiguous block in their respective arrays. Instead, a link array gives the position of the next (row index,coefficient) pair. If the row index and value of a coefficient a occupy position kp in their arrays, then the position of the next coefficient a is found as kq = link[kp]. This threaded representation allows for efficient expansion of columns as rows are reintroduced during postsolve transformations. The basic packed structures are allocated to the expected size of the postsolved matrix, and as new coefficients are added, their location is simply added to the thread for the column. There is no provision to convert the threaded representation to a packed representation. In the context of postsolve, it's not required. (You did keep a copy of the original matrix, eh?) The constructors that take an OSI or ClpSimplex as a parameter really should not be here, but for historical reasons they will likely remain for the forseeable future. -- lh, 111202 -- */ class CoinPostsolveMatrix : public CoinPrePostsolveMatrix { public: /*! \brief `Native' constructor This constructor creates an empty object which must then be loaded. On the other hand, it doesn't assume that the client is an OsiSolverInterface. */ CoinPostsolveMatrix(int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc) ; /*! \brief Clp OSI constructor See Clp code for the definition. */ CoinPostsolveMatrix(ClpSimplex * si, int ncols0, int nrows0, CoinBigIndex nelems0, double maxmin_, // end prepost members double *sol, double *acts, unsigned char *colstat, unsigned char *rowstat); /*! \brief Generic OSI constructor See OSI code for the definition. */ CoinPostsolveMatrix(OsiSolverInterface * si, int ncols0, int nrows0, CoinBigIndex nelems0, double maxmin_, // end prepost members double *sol, double *acts, unsigned char *colstat, unsigned char *rowstat); /*! \brief Load an empty CoinPostsolveMatrix from a CoinPresolveMatrix This routine transfers the contents of the CoinPrePostsolveMatrix object from the CoinPresolveMatrix object to the CoinPostsolveMatrix object and completes initialisation of the CoinPostsolveMatrix object. The empty shell of the CoinPresolveMatrix object is destroyed. The routine expects an empty CoinPostsolveMatrix object. If handed a loaded object, a lot of memory will leak. */ void assignPresolveToPostsolve (CoinPresolveMatrix *&preObj) ; /// Destructor ~CoinPostsolveMatrix(); /*! \name Column thread structures As mentioned in the class documentation, the entries for a given column do not necessarily occupy a contiguous block of space. The #link_ array is used to maintain the threading. There is one thread for each column, and a single thread for all free entries in #hrow_ and #colels_. The allocated size of #link_ must be at least as large as the allocated size of #hrow_ and #colels_. */ //@{ /*! \brief First entry in free entries thread */ CoinBigIndex free_list_; /// Allocated size of #link_ int maxlink_; /*! \brief Thread array Within a thread, link_[k] points to the next entry in the thread. */ CoinBigIndex *link_; //@} /*! \name Debugging aids These arrays are allocated only when CoinPresolve is compiled with PRESOLVE_DEBUG defined. They hold codes which track the reason that a column or row is added to the problem during postsolve. */ //@{ char *cdone_; char *rdone_; //@} /// debug void check_nbasic(); }; /*! \defgroup MtxManip Presolve Matrix Manipulation Functions Functions to work with the loosely packed and threaded packed matrix structures used during presolve and postsolve. */ //@{ /*! \relates CoinPrePostsolveMatrix \brief Initialise linked list for major vector order in bulk storage */ void presolve_make_memlists(/*CoinBigIndex *starts,*/ int *lengths, presolvehlink *link, int n); /*! \relates CoinPrePostsolveMatrix \brief Make sure a major-dimension vector k has room for one more coefficient. You can use this directly, or use the inline wrappers presolve_expand_col and presolve_expand_row */ bool presolve_expand_major(CoinBigIndex *majstrts, double *majels, int *minndxs, int *majlens, presolvehlink *majlinks, int nmaj, int k) ; /*! \relates CoinPrePostsolveMatrix \brief Make sure a column (colx) in a column-major matrix has room for one more coefficient */ inline bool presolve_expand_col(CoinBigIndex *mcstrt, double *colels, int *hrow, int *hincol, presolvehlink *clink, int ncols, int colx) { return presolve_expand_major(mcstrt,colels, hrow,hincol,clink,ncols,colx) ; } /*! \relates CoinPrePostsolveMatrix \brief Make sure a row (rowx) in a row-major matrix has room for one more coefficient */ inline bool presolve_expand_row(CoinBigIndex *mrstrt, double *rowels, int *hcol, int *hinrow, presolvehlink *rlink, int nrows, int rowx) { return presolve_expand_major(mrstrt,rowels, hcol,hinrow,rlink,nrows,rowx) ; } /*! \relates CoinPrePostsolveMatrix \brief Find position of a minor index in a major vector. The routine returns the position \c k in \p minndxs for the specified minor index \p tgt. It will abort if the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row and presolve_find_col. */ inline CoinBigIndex presolve_find_minor(int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs) { CoinBigIndex k ; for (k = ks ; k < ke ; k++) #ifndef NDEBUG { if (minndxs[k] == tgt) return (k) ; } DIE("FIND_MINOR") ; abort () ; return -1; #else { if (minndxs[k] == tgt) break ; } return (k) ; #endif } /*! \relates CoinPrePostsolveMatrix \brief Find position of a row in a column in a column-major matrix. The routine returns the position \c k in \p hrow for the specified \p row. It will abort if the entry does not exist. */ inline CoinBigIndex presolve_find_row(int row, CoinBigIndex kcs, CoinBigIndex kce, const int *hrow) { return presolve_find_minor(row,kcs,kce,hrow) ; } /*! \relates CoinPostsolveMatrix \brief Find position of a column in a row in a row-major matrix. The routine returns the position \c k in \p hcol for the specified \p col. It will abort if the entry does not exist. */ inline CoinBigIndex presolve_find_col(int col, CoinBigIndex krs, CoinBigIndex kre, const int *hcol) { return presolve_find_minor(col,krs,kre,hcol) ; } /*! \relates CoinPrePostsolveMatrix \brief Find position of a minor index in a major vector. The routine returns the position \c k in \p minndxs for the specified minor index \p tgt. A return value of \p ke means the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row1 and presolve_find_col1. */ CoinBigIndex presolve_find_minor1(int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs); /*! \relates CoinPrePostsolveMatrix \brief Find position of a row in a column in a column-major matrix. The routine returns the position \c k in \p hrow for the specified \p row. A return value of \p kce means the entry does not exist. */ inline CoinBigIndex presolve_find_row1(int row, CoinBigIndex kcs, CoinBigIndex kce, const int *hrow) { return presolve_find_minor1(row,kcs,kce,hrow) ; } /*! \relates CoinPrePostsolveMatrix \brief Find position of a column in a row in a row-major matrix. The routine returns the position \c k in \p hcol for the specified \p col. A return value of \p kre means the entry does not exist. */ inline CoinBigIndex presolve_find_col1(int col, CoinBigIndex krs, CoinBigIndex kre, const int *hcol) { return presolve_find_minor1(col,krs,kre,hcol) ; } /*! \relates CoinPostsolveMatrix \brief Find position of a minor index in a major vector in a threaded matrix. The routine returns the position \c k in \p minndxs for the specified minor index \p tgt. It will abort if the entry does not exist. Can be used directly or via the inline wrapper presolve_find_row2. */ CoinBigIndex presolve_find_minor2(int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks) ; /*! \relates CoinPostsolveMatrix \brief Find position of a row in a column in a column-major threaded matrix. The routine returns the position \c k in \p hrow for the specified \p row. It will abort if the entry does not exist. */ inline CoinBigIndex presolve_find_row2(int row, CoinBigIndex kcs, int collen, const int *hrow, const CoinBigIndex *clinks) { return presolve_find_minor2(row,kcs,collen,hrow,clinks) ; } /*! \relates CoinPostsolveMatrix \brief Find position of a minor index in a major vector in a threaded matrix. The routine returns the position \c k in \p minndxs for the specified minor index \p tgt. It will return -1 if the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row3. */ CoinBigIndex presolve_find_minor3(int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks) ; /*! \relates CoinPostsolveMatrix \brief Find position of a row in a column in a column-major threaded matrix. The routine returns the position \c k in \p hrow for the specified \p row. It will return -1 if the entry does not exist. */ inline CoinBigIndex presolve_find_row3(int row, CoinBigIndex kcs, int collen, const int *hrow, const CoinBigIndex *clinks) { return presolve_find_minor3(row,kcs,collen,hrow,clinks) ; } /*! \relates CoinPrePostsolveMatrix \brief Delete the entry for a minor index from a major vector. Deletes the entry for \p minndx from the major vector \p majndx. Specifically, the relevant entries are removed from the minor index (\p minndxs) and coefficient (\p els) arrays and the vector length (\p majlens) is decremented. Loose packing is maintained by swapping the last entry in the row into the position occupied by the deleted entry. */ inline void presolve_delete_from_major(int majndx, int minndx, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els) { const CoinBigIndex ks = majstrts[majndx] ; const CoinBigIndex ke = ks+majlens[majndx] ; const CoinBigIndex kmi = presolve_find_minor(minndx,ks,ke,minndxs) ; minndxs[kmi] = minndxs[ke-1] ; els[kmi] = els[ke-1] ; majlens[majndx]-- ; return ; } /*! \relates CoinPrePostsolveMatrix \brief Delete marked entries Removes the entries specified in \p marked, compressing the major vector to maintain loose packing. \p marked is cleared in the process. */ inline void presolve_delete_many_from_major(int majndx, char *marked, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els) { const CoinBigIndex ks = majstrts[majndx] ; const CoinBigIndex ke = ks+majlens[majndx] ; CoinBigIndex put = ks ; for (CoinBigIndex k = ks ; k < ke ; k++) { int iMinor = minndxs[k] ; if (!marked[iMinor]) { minndxs[put] = iMinor ; els[put++] = els[k] ; } else { marked[iMinor] = 0 ; } } majlens[majndx] = put-ks ; return ; } /*! \relates CoinPrePostsolveMatrix \brief Delete the entry for row \p row from column \p col in a column-major matrix Deletes the entry for \p row from the major vector for \p col. Specifically, the relevant entries are removed from the row index (\p hrow) and coefficient (\p colels) arrays and the vector length (\p hincol) is decremented. Loose packing is maintained by swapping the last entry in the row into the position occupied by the deleted entry. */ inline void presolve_delete_from_col(int row, int col, const CoinBigIndex *mcstrt, int *hincol, int *hrow, double *colels) { presolve_delete_from_major(col,row,mcstrt,hincol,hrow,colels) ; } /*! \relates CoinPrePostsolveMatrix \brief Delete the entry for column \p col from row \p row in a row-major matrix Deletes the entry for \p col from the major vector for \p row. Specifically, the relevant entries are removed from the column index (\p hcol) and coefficient (\p rowels) arrays and the vector length (\p hinrow) is decremented. Loose packing is maintained by swapping the last entry in the column into the position occupied by the deleted entry. */ inline void presolve_delete_from_row(int row, int col, const CoinBigIndex *mrstrt, int *hinrow, int *hcol, double *rowels) { presolve_delete_from_major(row,col,mrstrt,hinrow,hcol,rowels) ; } /*! \relates CoinPostsolveMatrix \brief Delete the entry for a minor index from a major vector in a threaded matrix. Deletes the entry for \p minndx from the major vector \p majndx. Specifically, the relevant entries are removed from the minor index (\p minndxs) and coefficient (\p els) arrays and the vector length (\p majlens) is decremented. The thread for the major vector is relinked around the deleted entry and the space is returned to the free list. */ void presolve_delete_from_major2 (int majndx, int minndx, CoinBigIndex *majstrts, int *majlens, int *minndxs, int *majlinks, CoinBigIndex *free_listp) ; /*! \relates CoinPostsolveMatrix \brief Delete the entry for row \p row from column \p col in a column-major threaded matrix Deletes the entry for \p row from the major vector for \p col. Specifically, the relevant entries are removed from the row index (\p hrow) and coefficient (\p colels) arrays and the vector length (\p hincol) is decremented. The thread for the major vector is relinked around the deleted entry and the space is returned to the free list. */ inline void presolve_delete_from_col2(int row, int col, CoinBigIndex *mcstrt, int *hincol, int *hrow, int *clinks, CoinBigIndex *free_listp) { presolve_delete_from_major2(col,row,mcstrt,hincol,hrow,clinks,free_listp) ; } //@} /*! \defgroup PresolveUtilities Presolve Utility Functions Utilities used by multiple presolve transform objects. */ //@{ /*! \brief Duplicate a major-dimension vector; optionally omit the entry with minor index \p tgt. Designed to copy a major-dimension vector from the paired coefficient (\p elems) and minor index (\p indices) arrays used in the standard packed matrix representation. Copies \p length entries starting at \p offset. If \p tgt is specified, the entry with minor index == \p tgt is omitted from the copy. */ double *presolve_dupmajor(const double *elems, const int *indices, int length, CoinBigIndex offset, int tgt = -1); /// Initialize a vector with random numbers void coin_init_random_vec(double *work, int n); //@} #endif CoinMP-1.8.3/CoinUtils/src/CoinUtilsConfig.h0000644000175000017500000000262511573155175017243 0ustar renerene/* Copyright (C) 2011 * All Rights Reserved. * This code is published under the Eclipse Public License. * * $Id: CoinUtilsConfig.h 1434 2011-06-06 13:47:41Z stefan $ * * Include file for the configuration of CoinUtils. * * On systems where the code is configured with the configure script * (i.e., compilation is always done with HAVE_CONFIG_H defined), this * header file includes the automatically generated header file, and * undefines macros that might configure with other Config.h files. * * On systems that are compiled in other ways (e.g., with the * Developer Studio), a header files is included to define those * macros that depend on the operating system and the compiler. The * macros that define the configuration of the particular user setting * (e.g., presence of other COIN-OR packages or third party code) are set * by the files config_*default.h. The project maintainer needs to remember * to update these file and choose reasonable defines. * A user can modify the default setting by editing the config_*default.h files. * */ #ifndef __COINUTILSCONFIG_H__ #define __COINUTILSCONFIG_H__ #ifdef HAVE_CONFIG_H #ifdef COINUTILS_BUILD #include "config.h" #else #include "config_coinutils.h" #endif #else /* HAVE_CONFIG_H */ #ifdef COINUTILS_BUILD #include "config_default.h" #else #include "config_coinutils_default.h" #endif #endif /* HAVE_CONFIG_H */ #endif /*__COINUTILSCONFIG_H__*/ CoinMP-1.8.3/CoinUtils/src/CoinMessage.cpp0000644000175000017500000001055212313004660016713 0ustar renerene/* $Id: CoinMessage.cpp 1693 2014-03-21 09:43:12Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinPragma.hpp" #include "CoinMessage.hpp" #include "CoinError.hpp" typedef struct { COIN_Message internalNumber; int externalNumber; // or continuation char detail; const char * message; } Coin_message; static Coin_message us_english[]= { {COIN_MPS_LINE,1,1,"At line %d %s"}, {COIN_MPS_STATS,2,1,"Problem %s has %d rows, %d columns and %d elements"}, {COIN_MPS_ILLEGAL,3001,0,"Illegal value for %s of %g"}, {COIN_MPS_BADIMAGE,3002,0,"Bad image at line %d < %s >"}, {COIN_MPS_DUPOBJ,3003,0,"Duplicate objective at line %d < %s >"}, {COIN_MPS_DUPROW,3004,0,"Duplicate row %s at line %d < %s >"}, {COIN_MPS_NOMATCHROW,3005,0,"No match for row %s at line %d < %s >"}, {COIN_MPS_NOMATCHCOL,3006,0,"No match for column %s at line %d < %s >"}, {COIN_MPS_FILE,6001,0,"Unable to open mps input file %s"}, {COIN_MPS_BADFILE1,6002,0,"Unknown image %s at line %d of file %s"}, {COIN_MPS_BADFILE2,6003,0,"Consider the possibility of a compressed file\ which %s is unable to read"}, {COIN_MPS_EOF,6004,0,"EOF on file %s"}, {COIN_MPS_RETURNING,6005,0,"Returning as too many errors"}, {COIN_MPS_CHANGED,3008,1,"Generated %s names had duplicates - %d changed"}, {COIN_SOLVER_MPS,8,1,"%s read with %d errors"}, {COIN_PRESOLVE_COLINFEAS,501,2,"Problem is infeasible due to column %d, %.16g %.16g"}, {COIN_PRESOLVE_ROWINFEAS,502,2,"Problem is infeasible due to row %d, %.16g %.16g"}, {COIN_PRESOLVE_COLUMNBOUNDA,503,2,"Problem looks unbounded above due to column %d, %g %g"}, {COIN_PRESOLVE_COLUMNBOUNDB,504,2,"Problem looks unbounded below due to column %d, %g %g"}, {COIN_PRESOLVE_NONOPTIMAL,505,1,"Presolved problem not optimal, resolve after postsolve"}, {COIN_PRESOLVE_STATS,506,1,"Presolve %d (%d) rows, %d (%d) columns and %d (%d) elements"}, {COIN_PRESOLVE_INFEAS,507,1,"Presolve determined that the problem was infeasible with tolerance of %g"}, {COIN_PRESOLVE_UNBOUND,508,1,"Presolve thinks problem is unbounded"}, {COIN_PRESOLVE_INFEASUNBOUND,509,1,"Presolve thinks problem is infeasible AND unbounded???"}, {COIN_PRESOLVE_INTEGERMODS,510,1,"Presolve is modifying %d integer bounds and re-presolving"}, {COIN_PRESOLVE_POSTSOLVE,511,1,"After Postsolve, objective %g, infeasibilities - dual %g (%d), primal %g (%d)"}, {COIN_PRESOLVE_NEEDS_CLEANING,512,1,"Presolved model was optimal, full model needs cleaning up"}, {COIN_PRESOLVE_PASS,513,3,"%d rows dropped after presolve pass %d"}, # if PRESOLVE_DEBUG { COIN_PRESOLDBG_FIRSTCHECK,514,3,"First occurrence of %s checks." }, { COIN_PRESOLDBG_RCOSTACC,515,3, "rcost[%d] = %g should be %g |diff| = %g." }, { COIN_PRESOLDBG_RCOSTSTAT,516,3, "rcost[%d] = %g inconsistent with status %s (%s)." }, { COIN_PRESOLDBG_STATSB,517,3, "status[%d] = %s rcost = %g lb = %g val = %g ub = %g." }, { COIN_PRESOLDBG_DUALSTAT,518,3, "dual[%d] = %g inconsistent with status %s (%s)." }, # endif {COIN_GENERAL_INFO,9,1,"%s"}, {COIN_GENERAL_INFO2,10,2,"%s"}, {COIN_GENERAL_WARNING,3007,1,"%s"}, {COIN_DUMMY_END,999999,0,""} }; // **** aiutami! static Coin_message italian[]= { {COIN_MPS_LINE,1,1,"al numero %d %s"}, {COIN_MPS_STATS,2,1,"matrice %s ha %d file, %d colonne and %d elementi (diverso da zero)"}, {COIN_DUMMY_END,999999,0,""} }; /* Constructor */ CoinMessage::CoinMessage(Language language) : CoinMessages(sizeof(us_english)/sizeof(Coin_message)) { language_=language; strcpy(source_,"Coin"); class_= 2; // Coin Coin_message * message = us_english; while (message->internalNumber!=COIN_DUMMY_END) { CoinOneMessage oneMessage(message->externalNumber,message->detail, message->message); addMessage(message->internalNumber,oneMessage); message ++; } // Put into compact form toCompact(); // now override any language ones switch (language) { case it: message = italian; break; default: message=NULL; break; } // replace if any found if (message) { while (message->internalNumber!=COIN_DUMMY_END) { replaceMessage(message->internalNumber,message->message); message ++; } } } CoinMP-1.8.3/CoinUtils/src/CoinPresolveEmpty.hpp0000644000175000017500000000645712054012620020160 0ustar renerene/* $Id: CoinPresolveEmpty.hpp 1561 2012-11-24 00:32:16Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveEmpty_H #define CoinPresolveEmpty_H /*! \file Drop/reinsert empty rows/columns. */ const int DROP_ROW = 3; const int DROP_COL = 4; /*! \class drop_empty_cols_action \brief Physically removes empty columns in presolve, and reinserts empty columns in postsolve. Physical removal of rows and columns should be the last activities performed during presolve. Do them exactly once. The row-major matrix is not maintained by this transform. To physically drop the columns, CoinPrePostsolveMatrix::mcstrt_ and CoinPrePostsolveMatrix::hincol_ are compressed, along with column bounds, objective, and (if present) the column portions of the solution. This renumbers the columns. drop_empty_cols_action::presolve will reconstruct CoinPresolveMatrix::clink_. \todo Confirm correct behaviour with solution in presolve. */ class drop_empty_cols_action : public CoinPresolveAction { private: const int nactions_; struct action { double clo; double cup; double cost; double sol; int jcol; }; const action *const actions_; drop_empty_cols_action(int nactions, const action *const actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const { return ("drop_empty_cols_action"); } static const CoinPresolveAction *presolve(CoinPresolveMatrix *, const int *ecols, int necols, const CoinPresolveAction*); static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~drop_empty_cols_action() { deleteAction(actions_,action*); } }; /*! \class drop_empty_rows_action \brief Physically removes empty rows in presolve, and reinserts empty rows in postsolve. Physical removal of rows and columns should be the last activities performed during presolve. Do them exactly once. The row-major matrix is not maintained by this transform. To physically drop the rows, the rows are renumbered, excluding empty rows. This involves rewriting CoinPrePostsolveMatrix::hrow_ and compressing the row bounds and (if present) the row portions of the solution. \todo Confirm behaviour when a solution is present in presolve. */ class drop_empty_rows_action : public CoinPresolveAction { private: struct action { double rlo; double rup; int row; int fill_row; // which row was moved into position row to fill it }; const int nactions_; const action *const actions_; drop_empty_rows_action(int nactions, const action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const { return ("drop_empty_rows_action"); } static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~drop_empty_rows_action() { deleteAction(actions_,action*); } }; #endif CoinMP-1.8.3/CoinUtils/src/CoinBuild.cpp0000644000175000017500000002737112017155726016410 0ustar renerene/* $Id: CoinBuild.cpp 1550 2012-08-28 14:55:18Z forrest $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include #include "CoinBuild.hpp" #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" /* Format of each item is a bit sleazy. First we have pointer to next item Then we have two ints giving item number and number of elements Then we have three double for objective lower and upper Then we have elements Then indices */ struct buildFormat { buildFormat * next; int itemNumber; int numberElements; double objective; double lower; double upper; double restDouble[1]; int restInt[1]; // just to make correct size } ; //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CoinBuild::CoinBuild () : numberItems_(0), numberOther_(0), numberElements_(0), currentItem_(NULL), firstItem_(NULL), lastItem_(NULL), type_(-1) { } //------------------------------------------------------------------- // Constructor with type //------------------------------------------------------------------- CoinBuild::CoinBuild (int type) : numberItems_(0), numberOther_(0), numberElements_(0), currentItem_(NULL), firstItem_(NULL), lastItem_(NULL), type_(type) { if (type<0||type>1) type_=-1; // unset } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CoinBuild::CoinBuild (const CoinBuild & rhs) : numberItems_(rhs.numberItems_), numberOther_(rhs.numberOther_), numberElements_(rhs.numberElements_), type_(rhs.type_) { if (numberItems_) { firstItem_=NULL; buildFormat * lastItem = NULL; buildFormat * currentItem = reinterpret_cast ( rhs.firstItem_); for (int iItem=0;iItemnumberElements; int length = ( CoinSizeofAsInt(buildFormat) + (numberElements-1) * (CoinSizeofAsInt(double)+CoinSizeofAsInt(int)) ); int doubles = (length + CoinSizeofAsInt(double)-1)/CoinSizeofAsInt(double); double * copyOfItem = new double [doubles]; memcpy(copyOfItem,item,length); if (!firstItem_) { firstItem_ = copyOfItem; } else { // update pointer lastItem->next = reinterpret_cast ( copyOfItem); } currentItem = currentItem->next; // on to next lastItem = reinterpret_cast ( copyOfItem); } currentItem_=firstItem_; lastItem_=reinterpret_cast ( lastItem); } else { currentItem_=NULL; firstItem_=NULL; lastItem_=NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CoinBuild::~CoinBuild () { buildFormat * item = reinterpret_cast ( firstItem_); for (int iItem=0;iItem ( item); item = item->next; delete [] array; } } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CoinBuild & CoinBuild::operator=(const CoinBuild& rhs) { if (this != &rhs) { buildFormat * item = reinterpret_cast ( firstItem_); for (int iItem=0;iItem ( item); item = item->next; delete [] array; } numberItems_=rhs.numberItems_; numberOther_=rhs.numberOther_; numberElements_=rhs.numberElements_; type_=rhs.type_; if (numberItems_) { firstItem_=NULL; buildFormat * lastItem = NULL; buildFormat * currentItem = reinterpret_cast ( rhs.firstItem_); for (int iItem=0;iItemnumberElements; int length = CoinSizeofAsInt(buildFormat)+(numberElements-1)*(CoinSizeofAsInt(double)+CoinSizeofAsInt(int)); int doubles = (length + CoinSizeofAsInt(double)-1)/CoinSizeofAsInt(double); double * copyOfItem = new double [doubles]; memcpy(copyOfItem,item,length); if (!firstItem_) { firstItem_ = copyOfItem; } else { // update pointer lastItem->next = reinterpret_cast ( copyOfItem); } currentItem = currentItem->next; // on to next lastItem = reinterpret_cast ( copyOfItem); } currentItem_=firstItem_; lastItem_=reinterpret_cast ( lastItem); } else { currentItem_=NULL; firstItem_=NULL; lastItem_=NULL; } } return *this; } // add a row void CoinBuild::addRow(int numberInRow, const int * columns, const double * elements, double rowLower, double rowUpper) { if (type_<0) { type_=0; } else if (type_==1) { printf("CoinBuild:: unable to add a row in column mode\n"); abort(); } if (numberInRow<0) printf("bad number %d\n",numberInRow); // to stop compiler error addItem(numberInRow, columns, elements, rowLower,rowUpper,0.0); if (numberInRow<0) printf("bad number %d\n",numberInRow); // to stop compiler error } /* Returns number of elements in a row and information in row */ int CoinBuild::row(int whichRow, double & rowLower, double & rowUpper, const int * & indices, const double * & elements) const { assert (type_==0); setMutableCurrent(whichRow); double dummyObjective; return currentItem(rowLower,rowUpper,dummyObjective,indices,elements); } /* Returns number of elements in current row and information in row Used as rows may be stored in a chain */ int CoinBuild::currentRow(double & rowLower, double & rowUpper, const int * & indices, const double * & elements) const { assert (type_==0); double dummyObjective; return currentItem(rowLower,rowUpper,dummyObjective,indices,elements); } // Set current row void CoinBuild::setCurrentRow(int whichRow) { assert (type_==0); setMutableCurrent(whichRow); } // Returns current row number int CoinBuild::currentRow() const { assert (type_==0); return currentItem(); } // add a column void CoinBuild::addColumn(int numberInColumn, const int * rows, const double * elements, double columnLower, double columnUpper, double objectiveValue) { if (type_<0) { type_=1; } else if (type_==0) { printf("CoinBuild:: unable to add a column in row mode\n"); abort(); } addItem(numberInColumn, rows, elements, columnLower,columnUpper, objectiveValue); } /* Returns number of elements in a column and information in column */ int CoinBuild::column(int whichColumn, double & columnLower, double & columnUpper, double & objectiveValue, const int * & indices, const double * & elements) const { assert (type_==1); setMutableCurrent(whichColumn); return currentItem(columnLower,columnUpper,objectiveValue,indices,elements); } /* Returns number of elements in current column and information in column Used as columns may be stored in a chain */ int CoinBuild::currentColumn( double & columnLower, double & columnUpper, double & objectiveValue, const int * & indices, const double * & elements) const { assert (type_==1); return currentItem(columnLower,columnUpper,objectiveValue,indices,elements); } // Set current column void CoinBuild::setCurrentColumn(int whichColumn) { assert (type_==1); setMutableCurrent(whichColumn); } // Returns current column number int CoinBuild::currentColumn() const { assert (type_==1); return currentItem(); } // add a item void CoinBuild::addItem(int numberInItem, const int * indices, const double * elements, double itemLower, double itemUpper, double objectiveValue) { buildFormat * lastItem = reinterpret_cast ( lastItem_); int length = CoinSizeofAsInt(buildFormat)+(numberInItem-1)*(CoinSizeofAsInt(double)+CoinSizeofAsInt(int)); int doubles = (length + CoinSizeofAsInt(double)-1)/CoinSizeofAsInt(double); double * newItem = new double [doubles]; if (!firstItem_) { firstItem_ = newItem; } else { // update pointer lastItem->next = reinterpret_cast ( newItem); } lastItem_=newItem; currentItem_=newItem; // now fill in buildFormat * item = reinterpret_cast ( newItem); double * els = &item->restDouble[0]; int * cols = reinterpret_cast (els+numberInItem); item->next=NULL; item->itemNumber=numberItems_; numberItems_++; item->numberElements=numberInItem; numberElements_ += numberInItem; item->objective=objectiveValue; item->lower=itemLower; item->upper=itemUpper; for (int k=0;k=0); if (iColumn<0) { printf("bad col %d\n",iColumn); // to stop compiler error abort(); } if (iColumn>=numberOther_) numberOther_ = iColumn+1; els[k]=elements[k]; cols[k]=iColumn; } return; } /* Returns number of elements in a item and information in item */ int CoinBuild::item(int whichItem, double & itemLower, double & itemUpper, double & objectiveValue, const int * & indices, const double * & elements) const { setMutableCurrent(whichItem); return currentItem(itemLower,itemUpper,objectiveValue,indices,elements); } /* Returns number of elements in current item and information in item Used as items may be stored in a chain */ int CoinBuild::currentItem(double & itemLower, double & itemUpper, double & objectiveValue, const int * & indices, const double * & elements) const { buildFormat * item = reinterpret_cast ( currentItem_); if (item) { int numberElements = item->numberElements; elements = &item->restDouble[0]; indices = reinterpret_cast (elements+numberElements); objectiveValue=item->objective; itemLower = item->lower; itemUpper=item->upper; return numberElements; } else { return -1; } } // Set current item void CoinBuild::setCurrentItem(int whichItem) { setMutableCurrent(whichItem); } // Set current item void CoinBuild::setMutableCurrent(int whichItem) const { if (whichItem>=0&&whichItem ( firstItem_); // if further on then we can start from where we are buildFormat * current = reinterpret_cast ( currentItem_); if (current->itemNumber<=whichItem) { item=current; nSkip = whichItem-current->itemNumber; } for (int iItem=0;iItemnext; } assert (whichItem==item->itemNumber); currentItem_ = reinterpret_cast ( item); } } // Returns current item number int CoinBuild::currentItem() const { buildFormat * item = reinterpret_cast ( currentItem_); if (item) return item->itemNumber; else return -1; } CoinMP-1.8.3/CoinUtils/src/CoinSearchTree.hpp0000644000175000017500000003360612510010360017357 0ustar renerene/* $Id: CoinSearchTree.hpp 1824 2015-04-04 16:27:28Z tkr $ */ // Copyright (C) 2006, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinSearchTree_H #define CoinSearchTree_H #include #include #include #include #include "CoinFinite.hpp" #include "CoinHelperFunctions.hpp" // #define DEBUG_PRINT //############################################################################# class BitVector128 { friend bool operator<(const BitVector128& b0, const BitVector128& b1); private: unsigned int bits_[4]; public: BitVector128(); BitVector128(unsigned int bits[4]); ~BitVector128() {} void set(unsigned int bits[4]); void setBit(int i); void clearBit(int i); std::string str() const; }; bool operator<(const BitVector128& b0, const BitVector128& b1); //############################################################################# /** A class from which the real tree nodes should be derived from. Some of the data that undoubtedly exist in the real tree node is replicated here for fast access. This class is used in the various comparison functions. */ class CoinTreeNode { protected: CoinTreeNode() : depth_(-1), fractionality_(-1), quality_(-COIN_DBL_MAX), true_lower_bound_(-COIN_DBL_MAX), preferred_() {} CoinTreeNode(int d, int f = -1, double q = -COIN_DBL_MAX, double tlb = -COIN_DBL_MAX, BitVector128 p = BitVector128()) : depth_(d), fractionality_(f), quality_(q), true_lower_bound_(tlb), preferred_(p) {} CoinTreeNode(const CoinTreeNode& x) : depth_(x.depth_), fractionality_(x.fractionality_), quality_(x.quality_), true_lower_bound_(x.true_lower_bound_), preferred_(x.preferred_) {} CoinTreeNode& operator=(const CoinTreeNode& x) { if (this != &x) { depth_ = x.depth_; fractionality_ = x.fractionality_; quality_ = x.quality_; true_lower_bound_ = x.true_lower_bound_; preferred_ = x.preferred_; } return *this; } private: /// The depth of the node in the tree int depth_; /** A measure of fractionality, e.g., the number of unsatisfied integrality requirements */ int fractionality_; /** Some quality for the node. For normal branch-and-cut problems the LP relaxation value will do just fine. It is probably an OK approximation even if column generation is done. */ double quality_; /** A true lower bound on the node. May be -infinity. For normal branch-and-cut problems the LP relaxation value is OK. It is different when column generation is done. */ double true_lower_bound_; /** */ BitVector128 preferred_; public: virtual ~CoinTreeNode() {} inline int getDepth() const { return depth_; } inline int getFractionality() const { return fractionality_; } inline double getQuality() const { return quality_; } inline double getTrueLB() const { return true_lower_bound_; } inline BitVector128 getPreferred() const { return preferred_; } inline void setDepth(int d) { depth_ = d; } inline void setFractionality(int f) { fractionality_ = f; } inline void setQuality(double q) { quality_ = q; } inline void setTrueLB(double tlb) { true_lower_bound_ = tlb; } inline void setPreferred(BitVector128 p) { preferred_ = p; } }; //============================================================================== class CoinTreeSiblings { private: CoinTreeSiblings(); CoinTreeSiblings& operator=(const CoinTreeSiblings&); private: int current_; int numSiblings_; CoinTreeNode** siblings_; public: CoinTreeSiblings(const int n, CoinTreeNode** nodes) : current_(0), numSiblings_(n), siblings_(new CoinTreeNode*[n]) { CoinDisjointCopyN(nodes, n, siblings_); } CoinTreeSiblings(const CoinTreeSiblings& s) : current_(s.current_), numSiblings_(s.numSiblings_), siblings_(new CoinTreeNode*[s.numSiblings_]) { CoinDisjointCopyN(s.siblings_, s.numSiblings_, siblings_); } ~CoinTreeSiblings() { delete[] siblings_; } inline CoinTreeNode* currentNode() const { return siblings_[current_]; } /** returns false if cannot be advanced */ inline bool advanceNode() { return ++current_ != numSiblings_; } inline int toProcess() const { return numSiblings_ - current_; } inline int size() const { return numSiblings_; } inline void printPref() const { for (int i = 0; i < numSiblings_; ++i) { std::string pref = siblings_[i]->getPreferred().str(); printf("prefs of sibligs: sibling[%i]: %s\n", i, pref.c_str()); } } }; //############################################################################# /** Function objects to compare search tree nodes. The comparison function must return true if the first argument is "better" than the second one, i.e., it should be processed first. */ /*@{*/ /** Depth First Search. */ struct CoinSearchTreeComparePreferred { static inline const char* name() { return "CoinSearchTreeComparePreferred"; } inline bool operator()(const CoinTreeSiblings* x, const CoinTreeSiblings* y) const { register const CoinTreeNode* xNode = x->currentNode(); register const CoinTreeNode* yNode = y->currentNode(); const BitVector128 xPref = xNode->getPreferred(); const BitVector128 yPref = yNode->getPreferred(); bool retval = true; if (xPref < yPref) { retval = true; } else if (yPref < xPref) { retval = false; } else { retval = xNode->getQuality() < yNode->getQuality(); } #ifdef DEBUG_PRINT printf("Comparing xpref (%s) and ypref (%s) : %s\n", xpref.str().c_str(), ypref.str().c_str(), retval ? "T" : "F"); #endif return retval; } }; //----------------------------------------------------------------------------- /** Depth First Search. */ struct CoinSearchTreeCompareDepth { static inline const char* name() { return "CoinSearchTreeCompareDepth"; } inline bool operator()(const CoinTreeSiblings* x, const CoinTreeSiblings* y) const { #if 1 return x->currentNode()->getDepth() >= y->currentNode()->getDepth(); #else if(x->currentNode()->getDepth() > y->currentNode()->getDepth()) return 1; if(x->currentNode()->getDepth() == y->currentNode()->getDepth() && x->currentNode()->getQuality() <= y->currentNode()->getQuality()) return 1; return 0; #endif } }; //----------------------------------------------------------------------------- /* Breadth First Search */ struct CoinSearchTreeCompareBreadth { static inline const char* name() { return "CoinSearchTreeCompareBreadth"; } inline bool operator()(const CoinTreeSiblings* x, const CoinTreeSiblings* y) const { return x->currentNode()->getDepth() < y->currentNode()->getDepth(); } }; //----------------------------------------------------------------------------- /** Best first search */ struct CoinSearchTreeCompareBest { static inline const char* name() { return "CoinSearchTreeCompareBest"; } inline bool operator()(const CoinTreeSiblings* x, const CoinTreeSiblings* y) const { return x->currentNode()->getQuality() < y->currentNode()->getQuality(); } }; //############################################################################# class CoinSearchTreeBase { private: CoinSearchTreeBase(const CoinSearchTreeBase&); CoinSearchTreeBase& operator=(const CoinSearchTreeBase&); protected: std::vector candidateList_; int numInserted_; int size_; protected: CoinSearchTreeBase() : candidateList_(), numInserted_(0), size_(0) {} virtual void realpop() = 0; virtual void realpush(CoinTreeSiblings* s) = 0; virtual void fixTop() = 0; public: virtual ~CoinSearchTreeBase() {} virtual const char* compName() const = 0; inline const std::vector& getCandidates() const { return candidateList_; } inline bool empty() const { return candidateList_.empty(); } inline int size() const { return size_; } inline int numInserted() const { return numInserted_; } inline CoinTreeNode* top() const { if (size_ == 0 || candidateList_.size() == 0) return NULL; #ifdef DEBUG_PRINT char output[44]; output[43] = 0; candidateList_.front()->currentNode()->getPreferred().print(output); printf("top's pref: %s\n", output); #endif return candidateList_.front()->currentNode(); } /** pop will advance the \c next pointer among the siblings on the top and then moves the top to its correct position. #realpop is the method that actually removes the element from the heap */ inline void pop() { CoinTreeSiblings* s = candidateList_.front(); if (!s->advanceNode()) { realpop(); delete s; } else { fixTop(); } --size_; } inline void push(int numNodes, CoinTreeNode** nodes, const bool incrInserted = true) { CoinTreeSiblings* s = new CoinTreeSiblings(numNodes, nodes); realpush(s); if (incrInserted) { numInserted_ += numNodes; } size_ += numNodes; } inline void push(const CoinTreeSiblings& sib, const bool incrInserted = true) { CoinTreeSiblings* s = new CoinTreeSiblings(sib); #ifdef DEBUG_PRINT s->printPref(); #endif realpush(s); if (incrInserted) { numInserted_ += sib.toProcess(); } size_ += sib.toProcess(); } }; //############################################################################# // #define CAN_TRUST_STL_HEAP #ifdef CAN_TRUST_STL_HEAP template class CoinSearchTree : public CoinSearchTreeBase { private: Comp comp_; protected: virtual void realpop() { candidateList_.pop_back(); } virtual void fixTop() { CoinTreeSiblings* s = top(); realpop(); push(s, false); } virtual void realpush(CoinTreeSiblings* s) { nodes_.push_back(s); std::push_heap(candidateList_.begin(), candidateList_.end(), comp_); } public: CoinSearchTree() : CoinSearchTreeBase(), comp_() {} CoinSearchTree(const CoinSearchTreeBase& t) : CoinSearchTreeBase(), comp_() { candidateList_ = t.getCandidates(); std::make_heap(candidateList_.begin(), candidateList_.end(), comp_); numInserted_ = t.numInserted_; size_ = t.size_; } ~CoinSearchTree() {} const char* compName() const { return Comp::name(); } }; #else template class CoinSearchTree : public CoinSearchTreeBase { private: Comp comp_; protected: virtual void realpop() { candidateList_[0] = candidateList_.back(); candidateList_.pop_back(); fixTop(); } /** After changing data in the top node, fix the heap */ virtual void fixTop() { const size_t size = candidateList_.size(); if (size > 1) { CoinTreeSiblings** candidates = &candidateList_[0]; CoinTreeSiblings* s = candidates[0]; --candidates; size_t pos = 1; size_t ch; for (ch = 2; ch < size; pos = ch, ch *= 2) { if (comp_(candidates[ch+1], candidates[ch])) ++ch; if (comp_(s, candidates[ch])) break; candidates[pos] = candidates[ch]; } if (ch == size) { if (comp_(candidates[ch], s)) { candidates[pos] = candidates[ch]; pos = ch; } } candidates[pos] = s; } } virtual void realpush(CoinTreeSiblings* s) { candidateList_.push_back(s); CoinTreeSiblings** candidates = &candidateList_[0]; --candidates; size_t pos = candidateList_.size(); size_t ch; for (ch = pos/2; ch != 0; pos = ch, ch /= 2) { if (comp_(candidates[ch], s)) break; candidates[pos] = candidates[ch]; } candidates[pos] = s; } public: CoinSearchTree() : CoinSearchTreeBase(), comp_() {} CoinSearchTree(const CoinSearchTreeBase& t) : CoinSearchTreeBase(), comp_() { candidateList_ = t.getCandidates(); std::sort(candidateList_.begin(), candidateList_.end(), comp_); numInserted_ = t.numInserted(); size_ = t.size(); } virtual ~CoinSearchTree() {} const char* compName() const { return Comp::name(); } }; #endif //############################################################################# enum CoinNodeAction { CoinAddNodeToCandidates, CoinTestNodeForDiving, CoinDiveIntoNode }; class CoinSearchTreeManager { private: CoinSearchTreeManager(const CoinSearchTreeManager&); CoinSearchTreeManager& operator=(const CoinSearchTreeManager&); private: CoinSearchTreeBase* candidates_; int numSolution; /** Whether there is an upper bound or not. The upper bound may have come as input, not necessarily from a solution */ bool hasUB_; /** variable used to test whether we need to reevaluate search strategy */ bool recentlyReevaluatedSearchStrategy_; public: CoinSearchTreeManager() : candidates_(NULL), numSolution(0), recentlyReevaluatedSearchStrategy_(true) {} virtual ~CoinSearchTreeManager() { delete candidates_; } inline void setTree(CoinSearchTreeBase* t) { delete candidates_; candidates_ = t; } inline CoinSearchTreeBase* getTree() const { return candidates_; } inline bool empty() const { return candidates_->empty(); } inline size_t size() const { return candidates_->size(); } inline size_t numInserted() const { return candidates_->numInserted(); } inline CoinTreeNode* top() const { return candidates_->top(); } inline void pop() { candidates_->pop(); } inline void push(CoinTreeNode* node, const bool incrInserted = true) { candidates_->push(1, &node, incrInserted); } inline void push(const CoinTreeSiblings& s, const bool incrInserted=true) { candidates_->push(s, incrInserted); } inline void push(const int n, CoinTreeNode** nodes, const bool incrInserted = true) { candidates_->push(n, nodes, incrInserted); } inline CoinTreeNode* bestQualityCandidate() const { return candidates_->top(); } inline double bestQuality() const { return candidates_->top()->getQuality(); } void newSolution(double solValue); void reevaluateSearchStrategy(); }; //############################################################################# #endif CoinMP-1.8.3/CoinUtils/src/CoinIndexedVector.cpp0000644000175000017500000016221112431423745020104 0ustar renerene/* $Id: CoinIndexedVector.cpp 1758 2014-11-14 16:03:49Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include #include "CoinTypes.hpp" #include "CoinFloatEqual.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "CoinTypes.hpp" //############################################################################# #define WARN_USELESS 0 void CoinIndexedVector::clear() { #if WARN_USELESS int nNonZero=0; for (int i=0;i1 if (nNonZero!=nElements_) printf("Vector said it had %d nonzeros - only had %d\n", nElements_,nNonZero); #endif if (!nNonZero&&nElements_) printf("Vector said it had %d nonzeros - but is already empty\n", nElements_); #endif if (!packedMode_) { if (3*nElements_=COIN_INDEXED_TINY_ELEMENT) { elements_[indexValue]=elems[i]; indices_[nElements_++]=indexValue; } } } //############################################################################# /** Access the i'th element of the full storage vector. */ double & CoinIndexedVector::operator[](int index) const { assert (!packedMode_); #ifndef COIN_FAST_CODE if ( index >= capacity_ ) throw CoinError("index >= capacity()", "[]", "CoinIndexedVector"); if ( index < 0 ) throw CoinError("index < 0" , "[]", "CoinIndexedVector"); #endif double * where = elements_ + index; return *where; } //############################################################################# void CoinIndexedVector::setElement(int index, double element) { #ifndef COIN_FAST_CODE if ( index >= nElements_ ) throw CoinError("index >= size()", "setElement", "CoinIndexedVector"); if ( index < 0 ) throw CoinError("index < 0" , "setElement", "CoinIndexedVector"); #endif elements_[indices_[index]] = element; } //############################################################################# void CoinIndexedVector::insert( int index, double element ) { #ifndef COIN_FAST_CODE if ( index < 0 ) throw CoinError("index < 0" , "setElement", "CoinIndexedVector"); #endif if (index >= capacity_) reserve(index+1); #ifndef COIN_FAST_CODE if (elements_[index]) throw CoinError("Index already exists", "insert", "CoinIndexedVector"); #endif indices_[nElements_++] = index; elements_[index] = element; } //############################################################################# void CoinIndexedVector::add( int index, double element ) { #ifndef COIN_FAST_CODE if ( index < 0 ) throw CoinError("index < 0" , "setElement", "CoinIndexedVector"); #endif if (index >= capacity_) reserve(index+1); if (elements_[index]) { element += elements_[index]; if (fabs(element)>= COIN_INDEXED_TINY_ELEMENT) { elements_[index] = element; } else { elements_[index] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } else if (fabs(element)>= COIN_INDEXED_TINY_ELEMENT) { indices_[nElements_++] = index; assert (nElements_<=capacity_); elements_[index] = element; } } //############################################################################# int CoinIndexedVector::clean( double tolerance ) { int number = nElements_; int i; nElements_=0; assert(!packedMode_); for (i=0;i=tolerance) { indices_[nElements_++]=indexValue; } else { elements_[indexValue]=0.0; } } return nElements_; } #ifndef NDEBUG //############################################################################# // For debug check vector is clear i.e. no elements void CoinIndexedVector::checkClear() { #ifndef NDEBUG //printf("checkClear %p\n",this); assert(!nElements_); //assert(!packedMode_); int i; for (i=0;i (indices_+capacity_); for (i=0;i (indices_+capacity_); for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { elements_[indexValue]=celem[i]; indices_[nElements_++]=indexValue; } } } if (needClean) { // go through again int size=nElements_; nElements_=0; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { indices_[nElements_++]=indexValue; } else { elements_[indexValue]=0.0; } } } if (numberDuplicates) throw CoinError("duplicate index", "append", "CoinIndexedVector"); } #endif //############################################################################# void CoinIndexedVector::swap(int i, int j) { if ( i >= nElements_ ) throw CoinError("index i >= size()","swap","CoinIndexedVector"); if ( i < 0 ) throw CoinError("index i < 0" ,"swap","CoinIndexedVector"); if ( j >= nElements_ ) throw CoinError("index j >= size()","swap","CoinIndexedVector"); if ( j < 0 ) throw CoinError("index j < 0" ,"swap","CoinIndexedVector"); // Swap positions i and j of the // indices array int isave = indices_[i]; indices_[i] = indices_[j]; indices_[j] = isave; } //############################################################################# void CoinIndexedVector::truncate( int n ) { reserve(n); } //############################################################################# void CoinIndexedVector::operator+=(double value) { assert (!packedMode_); int i,indexValue; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) elements_[indexValue] = newValue; else elements_[indexValue] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } //----------------------------------------------------------------------------- void CoinIndexedVector::operator-=(double value) { assert (!packedMode_); int i,indexValue; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) elements_[indexValue] = newValue; else elements_[indexValue] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } //----------------------------------------------------------------------------- void CoinIndexedVector::operator*=(double value) { assert (!packedMode_); int i,indexValue; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) elements_[indexValue] = newValue; else elements_[indexValue] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } //----------------------------------------------------------------------------- void CoinIndexedVector::operator/=(double value) { assert (!packedMode_); int i,indexValue; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) elements_[indexValue] = newValue; else elements_[indexValue] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } //############################################################################# void CoinIndexedVector::reserve(int n) { int i; // don't make allocated space smaller but do take off values if ( n < capacity_ ) { #ifndef COIN_FAST_CODE if (n<0) throw CoinError("negative capacity", "reserve", "CoinIndexedVector"); #endif int nNew=0; for (i=0;icapacity_) { // save pointers to existing data int * tempIndices = indices_; double * tempElements = elements_; double * delTemp = elements_-offset_; // allocate new space int nPlus; if (sizeof(int)==4*sizeof(char)) nPlus=(n+3)>>2; else nPlus=(n+7)>>4; indices_ = new int [n+nPlus]; CoinZeroN(indices_+n,nPlus); // align on 64 byte boundary double * temp = new double [n+9]; offset_ = 0; CoinInt64 xx = reinterpret_cast(temp); int iBottom = static_cast(xx & 63); //if (iBottom) offset_ = (64-iBottom)>>3; elements_ = temp + offset_;; // copy data to new space // and zero out part of array if (nElements_ > 0) { CoinMemcpyN(tempIndices, nElements_, indices_); CoinMemcpyN(tempElements, capacity_, elements_); CoinZeroN(elements_+capacity_,n-capacity_); } else { CoinZeroN(elements_,n); } capacity_ = n; // free old data if (tempElements) delete [] delTemp; delete [] tempIndices; } } //############################################################################# CoinIndexedVector::CoinIndexedVector () : indices_(NULL), elements_(NULL), nElements_(0), capacity_(0), offset_(0), packedMode_(false) { } CoinIndexedVector::CoinIndexedVector (int size) : indices_(NULL), elements_(NULL), nElements_(0), capacity_(0), offset_(0), packedMode_(false) { // Get space reserve(size); } //----------------------------------------------------------------------------- CoinIndexedVector::CoinIndexedVector(int size, const int * inds, const double * elems) : indices_(NULL), elements_(NULL), nElements_(0), capacity_(0), offset_(0), packedMode_(false) { gutsOfSetVector(size, inds, elems); } //----------------------------------------------------------------------------- CoinIndexedVector::CoinIndexedVector(int size, const int * inds, double value) : indices_(NULL), elements_(NULL), nElements_(0), capacity_(0), offset_(0), packedMode_(false) { gutsOfSetConstant(size, inds, value); } //----------------------------------------------------------------------------- CoinIndexedVector::CoinIndexedVector(int size, const double * element) : indices_(NULL), elements_(NULL), nElements_(0), capacity_(0), offset_(0), packedMode_(false) { setFull(size, element); } //----------------------------------------------------------------------------- #ifndef CLP_NO_VECTOR CoinIndexedVector::CoinIndexedVector(const CoinPackedVectorBase & rhs) : indices_(NULL), elements_(NULL), nElements_(0), capacity_(0), offset_(0), packedMode_(false) { gutsOfSetVector(rhs.getNumElements(), rhs.getIndices(), rhs.getElements()); } #endif //----------------------------------------------------------------------------- CoinIndexedVector::CoinIndexedVector(const CoinIndexedVector & rhs) : indices_(NULL), elements_(NULL), nElements_(0), capacity_(0), offset_(0), packedMode_(false) { if (!rhs.packedMode_) gutsOfSetVector(rhs.capacity_,rhs.nElements_, rhs.indices_, rhs.elements_); else gutsOfSetPackedVector(rhs.capacity_,rhs.nElements_, rhs.indices_, rhs.elements_); } //----------------------------------------------------------------------------- CoinIndexedVector::CoinIndexedVector(const CoinIndexedVector * rhs) : indices_(NULL), elements_(NULL), nElements_(0), capacity_(0), offset_(0), packedMode_(false) { if (!rhs->packedMode_) gutsOfSetVector(rhs->capacity_,rhs->nElements_, rhs->indices_, rhs->elements_); else gutsOfSetPackedVector(rhs->capacity_,rhs->nElements_, rhs->indices_, rhs->elements_); } //----------------------------------------------------------------------------- CoinIndexedVector::~CoinIndexedVector () { delete [] indices_; if (elements_) delete [] (elements_-offset_); } //############################################################################# //############################################################################# /// Return the sum of two indexed vectors CoinIndexedVector CoinIndexedVector::operator+( const CoinIndexedVector& op2) { assert (!packedMode_); int i; int nElements=nElements_; int capacity = CoinMax(capacity_,op2.capacity_); CoinIndexedVector newOne(*this); newOne.reserve(capacity); bool needClean=false; // new one now can hold everything so just modify old and add new for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { newOne.elements_[indexValue]=value; newOne.indices_[nElements++]=indexValue; } } else { value += oldValue; newOne.elements_[indexValue]=value; if (fabs(value)=COIN_INDEXED_TINY_ELEMENT) { newOne.indices_[newOne.nElements_++]=indexValue; } else { newOne.elements_[indexValue]=0.0; } } } return newOne; } /// Return the difference of two indexed vectors CoinIndexedVector CoinIndexedVector::operator-( const CoinIndexedVector& op2) { assert (!packedMode_); int i; int nElements=nElements_; int capacity = CoinMax(capacity_,op2.capacity_); CoinIndexedVector newOne(*this); newOne.reserve(capacity); bool needClean=false; // new one now can hold everything so just modify old and add new for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { newOne.elements_[indexValue]=-value; newOne.indices_[nElements++]=indexValue; } } else { value = oldValue-value; newOne.elements_[indexValue]=value; if (fabs(value)=COIN_INDEXED_TINY_ELEMENT) { newOne.indices_[newOne.nElements_++]=indexValue; } else { newOne.elements_[indexValue]=0.0; } } } return newOne; } /// Return the element-wise product of two indexed vectors CoinIndexedVector CoinIndexedVector::operator*( const CoinIndexedVector& op2) { assert (!packedMode_); int i; int nElements=nElements_; int capacity = CoinMax(capacity_,op2.capacity_); CoinIndexedVector newOne(*this); newOne.reserve(capacity); bool needClean=false; // new one now can hold everything so just modify old and add new for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { newOne.indices_[newOne.nElements_++]=indexValue; } else { newOne.elements_[indexValue]=0.0; } } } return newOne; } /// Return the element-wise ratio of two indexed vectors CoinIndexedVector CoinIndexedVector::operator/ (const CoinIndexedVector& op2) { assert (!packedMode_); // I am treating 0.0/0.0 as 0.0 int i; int nElements=nElements_; int capacity = CoinMax(capacity_,op2.capacity_); CoinIndexedVector newOne(*this); newOne.reserve(capacity); bool needClean=false; // new one now can hold everything so just modify old and add new for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { newOne.indices_[newOne.nElements_++]=indexValue; } else { newOne.elements_[indexValue]=0.0; } } } return newOne; } // The sum of two indexed vectors void CoinIndexedVector::operator+=(const CoinIndexedVector& op2) { // do slowly at first *this = *this + op2; } // The difference of two indexed vectors void CoinIndexedVector::operator-=( const CoinIndexedVector& op2) { // do slowly at first *this = *this - op2; } // The element-wise product of two indexed vectors void CoinIndexedVector::operator*=(const CoinIndexedVector& op2) { // do slowly at first *this = *this * op2; } // The element-wise ratio of two indexed vectors (0.0/0.0 => 0.0) (0 vanishes) void CoinIndexedVector::operator/=(const CoinIndexedVector& op2) { // do slowly at first *this = *this / op2; } //############################################################################# void CoinIndexedVector::sortDecrIndex() { // Should replace with std sort double * elements = new double [nElements_]; CoinZeroN (elements,nElements_); CoinSort_2(indices_, indices_ + nElements_, elements, CoinFirstGreater_2()); delete [] elements; } void CoinIndexedVector::sortPacked() { assert(packedMode_); CoinSort_2(indices_, indices_ + nElements_, elements_); } void CoinIndexedVector::sortIncrElement() { double * elements = new double [nElements_]; int i; for (i=0;i()); delete [] elements; } void CoinIndexedVector::sortDecrElement() { double * elements = new double [nElements_]; int i; for (i=0;i()); delete [] elements; } //############################################################################# void CoinIndexedVector::gutsOfSetVector(int size, const int * inds, const double * elems) { #ifndef COIN_FAST_CODE if (size<0) throw CoinError("negative number of indices", "setVector", "CoinIndexedVector"); #endif assert(!packedMode_); // find largest int i; int maxIndex=-1; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { indices_[nElements_++]=indexValue; elements_[indexValue]=elems[i]; } } else { numberDuplicates++; elements_[indexValue] += elems[i] ; if (fabs(elements_[indexValue])=COIN_INDEXED_TINY_ELEMENT) { indices_[nElements_++]=indexValue; } else { elements_[indexValue]=0.0; } } } if (numberDuplicates) throw CoinError("duplicate index", "setVector", "CoinIndexedVector"); } //############################################################################# void CoinIndexedVector::gutsOfSetVector(int size, int numberIndices, const int * inds, const double * elems) { assert(!packedMode_); int i; reserve(size); #ifndef COIN_FAST_CODE if (numberIndices<0) throw CoinError("negative number of indices", "setVector", "CoinIndexedVector"); #endif nElements_ = 0; // elements_ array is all zero bool needClean=false; int numberDuplicates=0; for (i=0;i=size) throw CoinError("too large an index", "setVector", "CoinIndexedVector"); #endif if (elements_[indexValue]) { numberDuplicates++; elements_[indexValue] += elems[indexValue] ; if (fabs(elements_[indexValue])=COIN_INDEXED_TINY_ELEMENT) { #endif elements_[indexValue]=elems[indexValue]; indices_[nElements_++]=indexValue; #ifndef COIN_FAC_NEW } #endif } } if (needClean) { // go through again size=nElements_; nElements_=0; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { indices_[nElements_++]=indexValue; } else { elements_[indexValue]=0.0; } } } if (numberDuplicates) throw CoinError("duplicate index", "setVector", "CoinIndexedVector"); } //----------------------------------------------------------------------------- void CoinIndexedVector::gutsOfSetPackedVector(int size, int numberIndices, const int * inds, const double * elems) { packedMode_=true; int i; reserve(size); #ifndef COIN_FAST_CODE if (numberIndices<0) throw CoinError("negative number of indices", "setVector", "CoinIndexedVector"); #endif nElements_ = 0; // elements_ array is all zero // Does not check for duplicates for (i=0;i=size) //throw CoinError("too large an index", "setVector", "CoinIndexedVector"); #endif if (fabs(elems[i])>=COIN_INDEXED_TINY_ELEMENT) { elements_[nElements_]=elems[i]; indices_[nElements_++]=indexValue; } } } //----------------------------------------------------------------------------- void CoinIndexedVector::gutsOfSetConstant(int size, const int * inds, double value) { assert(!packedMode_); #ifndef COIN_FAST_CODE if (size<0) throw CoinError("negative number of indices", "setConstant", "CoinIndexedVector"); #endif // find largest int i; int maxIndex=-1; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { elements_[indexValue] += value; indices_[nElements_++]=indexValue; } } else { numberDuplicates++; elements_[indexValue] += value ; if (fabs(elements_[indexValue])=COIN_INDEXED_TINY_ELEMENT) { indices_[nElements_++]=indexValue; } else { elements_[indexValue]=0.0; } } } if (numberDuplicates) throw CoinError("duplicate index", "setConstant", "CoinIndexedVector"); } //############################################################################# // Append a CoinIndexedVector to the end void CoinIndexedVector::append(const CoinIndexedVector & caboose) { const int cs = caboose.getNumElements(); const int * cind = caboose.getIndices(); const double * celem = caboose.denseVector(); int maxIndex=-1; int i; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { elements_[indexValue]=celem[indexValue]; indices_[nElements_++]=indexValue; } } } if (needClean) { // go through again int size=nElements_; nElements_=0; for (i=0;i=COIN_INDEXED_TINY_ELEMENT) { indices_[nElements_++]=indexValue; } else { elements_[indexValue]=0.0; } } } if (numberDuplicates) throw CoinError("duplicate index", "append", "CoinIndexedVector"); } // Append a CoinIndexedVector to the end and modify indices void CoinIndexedVector::append(CoinIndexedVector & other,int adjustIndex, bool zapElements/*,double multiplier*/) { const int cs = other.nElements_; const int * cind = other.indices_; double * celem = other.elements_; int * newInd = indices_+nElements_; if (packedMode_) { double * newEls = elements_+nElements_; if (zapElements) { if (other.packedMode_) { for (int i=0;itolerance) { bad=i; break; } } } for (int i=0;itolerance) { bad=i; break; } } } } return bad; } /* Equal. Returns true if vectors have same length and corresponding element of each vector is equal. */ bool CoinIndexedVector::operator==(const CoinIndexedVector & rhs) const { const int cs = rhs.nElements_; const int * cind = rhs.indices_; const double * celem = rhs.elements_; if (nElements_!=cs) return false; bool okay=true; CoinRelFltEq eq(1.0e-8); if (!packedMode_&&!rhs.packedMode_) { for (int i=0;i=tolerance) indices[number++] = i; else elements_[i]=0.0; } } nElements_ += number; return number; } // These pack down int CoinIndexedVector::cleanAndPack( double tolerance ) { if (!packedMode_) { int number = nElements_; int i; nElements_=0; for (i=0;i=tolerance) { elements_[nElements_]=value; indices_[nElements_++]=indexValue; } } packedMode_=true; } return nElements_; } // These pack down int CoinIndexedVector::cleanAndPackSafe( double tolerance ) { int number = nElements_; if (number) { int i; nElements_=0; assert(!packedMode_); double * temp=NULL; bool gotMemory; if (number*3 (indices_+number); CoinInt64 xx = reinterpret_cast(tempC); CoinInt64 iBottom = xx & 7; if (iBottom) tempC += 8-iBottom; temp = reinterpret_cast (tempC); xx = reinterpret_cast(temp); iBottom = xx & 7; assert(!iBottom); } else { // might be better to do complete scan gotMemory=true; temp = new double[number]; } for (i=0;i=tolerance) { temp[nElements_]=value; indices_[nElements_++]=indexValue; } } CoinMemcpyN(temp,nElements_,elements_); if (gotMemory) delete [] temp; packedMode_=true; } return nElements_; } // Scan dense region and set up indices int CoinIndexedVector::scanAndPack() { nElements_=0; return scanAndPack(0,capacity_); } // Scan dense region from start to < end and set up indices int CoinIndexedVector::scanAndPack(int start, int end) { assert(!packedMode_); end = CoinMin(end,capacity_); start = CoinMax(start,0); int i; int number = 0; int * indices = indices_+nElements_; for (i=start;i=tolerance) { elements_[number]=value; indices[number++] = i; } } nElements_ += number; packedMode_=true; return number; } // This is mainly for testing - goes from packed to indexed void CoinIndexedVector::expand() { if (nElements_&&packedMode_) { double * temp = new double[capacity_]; int i; for (i=0;i0&&array_)||!array_); memset (array_,0,size_); } // Get array with alignment void CoinArrayWithLength::getArray(int size) { if (size>0) { if(alignment_>2) { offset_ = 1<0); char * array = new char [size+offset_]; if (offset_) { // need offset CoinInt64 xx = reinterpret_cast(array); int iBottom = static_cast(xx & ((offset_-1))); if (iBottom) offset_ = offset_-iBottom; else offset_ = 0; array_ = array + offset_;; } else { array_=array; } if (size_!=-1) size_=size; } else { array_= NULL; } } // Get rid of array with alignment void CoinArrayWithLength::conditionalDelete() { if (size_==-1) { char * charArray = reinterpret_cast (array_); if (charArray) delete [] (charArray-offset_); array_=NULL; } else if (size_>=0) { size_ = -size_-2; } } // Really get rid of array with alignment void CoinArrayWithLength::reallyFreeArray() { char * charArray = reinterpret_cast (array_); if (charArray) delete [] (charArray-offset_); array_=NULL; size_=-1; } // Get enough space void CoinArrayWithLength::getCapacity(int numberBytes,int numberNeeded) { int k=capacity(); if (k0 size_ set to size and zeroed if size<=0 just does alignment If abs(mode) >2 then align on that as power of 2 */ CoinArrayWithLength::CoinArrayWithLength(int size, int mode) { alignment_=abs(mode); getArray(size); if (mode>0&&array_) memset(array_,0,size); size_=size; } CoinArrayWithLength::~CoinArrayWithLength () { if (array_) delete [] (array_-offset_); } // Conditionally gets new array char * CoinArrayWithLength::conditionalNew(long sizeWanted) { if (size_==-1) { getCapacity(static_cast(sizeWanted)); } else { int newSize = static_cast (sizeWanted*101/100)+64; // round to multiple of 16 newSize -= newSize&15; getCapacity(static_cast(sizeWanted),newSize); } return array_; } /* Copy constructor. */ CoinArrayWithLength::CoinArrayWithLength(const CoinArrayWithLength & rhs) { assert (capacity()>=0); getArray(rhs.capacity()); if (size_>0) CoinMemcpyN(rhs.array_,size_,array_); } /* Copy constructor.2 */ CoinArrayWithLength::CoinArrayWithLength(const CoinArrayWithLength * rhs) { assert (rhs->capacity()>=0); size_=rhs->size_; getArray(rhs->capacity()); if (size_>0) CoinMemcpyN(rhs->array_,size_,array_); } /* Assignment operator. */ CoinArrayWithLength & CoinArrayWithLength::operator=(const CoinArrayWithLength & rhs) { if (this != &rhs) { assert (rhs.size_!=-1||!rhs.array_); if (rhs.size_==-1) { reallyFreeArray(); } else { getCapacity(rhs.size_); if (size_>0) CoinMemcpyN(rhs.array_,size_,array_); } } return *this; } /* Assignment with length (if -1 use internal length) */ void CoinArrayWithLength::copy(const CoinArrayWithLength & rhs, int numberBytes) { if (numberBytes==-1||numberBytes<=rhs.capacity()) { CoinArrayWithLength::operator=(rhs); } else { assert (numberBytes>=0); getCapacity(numberBytes); if (rhs.array_) CoinMemcpyN(rhs.array_,numberBytes,array_); } } /* Assignment with length - does not copy */ void CoinArrayWithLength::allocate(const CoinArrayWithLength & rhs, int numberBytes) { if (numberBytes==-1||numberBytes<=rhs.capacity()) { assert (rhs.size_!=-1||!rhs.array_); if (rhs.size_==-1) { reallyFreeArray(); } else { getCapacity(rhs.size_); } } else { assert (numberBytes>=0); if (size_==-1) { delete [] array_; array_=NULL; } else { size_=-1; } if (rhs.size_>=0) size_ = numberBytes; assert (numberBytes>=0); assert (!array_); if (numberBytes) array_ = new char[numberBytes]; } } // Does what is needed to set persistence void CoinArrayWithLength::setPersistence(int flag,int currentLength) { if (flag) { if (size_==-1) { if (currentLength&&array_) { size_=currentLength; } else { conditionalDelete(); size_=0; array_=NULL; } } } else { size_=-1; } } // Swaps memory between two members void CoinArrayWithLength::swap(CoinArrayWithLength & other) { #ifdef COIN_DEVELOP if (!(size_==other.size_||size_==-1||other.size_==-1)) printf("Two arrays have sizes - %d and %d\n",size_,other.size_); #endif assert (alignment_==other.alignment_); char * swapArray = other.array_; other.array_=array_; array_=swapArray; int swapSize = other.size_; other.size_=size_; size_=swapSize; int swapOffset = other.offset_; other.offset_=offset_; offset_=swapOffset; } // Extend a persistent array keeping data (size in bytes) void CoinArrayWithLength::extend(int newSize) { //assert (newSize>=capacity()&&capacity()>=0); assert (size_>=0); // not much point otherwise if (newSize>size_) { char * temp = array_; getArray(newSize); if (temp) { CoinMemcpyN(array_,size_,temp); delete [] (temp-offset_); } size_=newSize; } } /* Default constructor */ CoinPartitionedVector::CoinPartitionedVector() : CoinIndexedVector() { memset(startPartition_,0,((&numberPartitions_-startPartition_)+1)*sizeof(int)); } /* Copy constructor. */ CoinPartitionedVector::CoinPartitionedVector(const CoinPartitionedVector & rhs) : CoinIndexedVector(rhs) { memcpy(startPartition_,rhs.startPartition_,((&numberPartitions_-startPartition_)+1)*sizeof(int)); } /* Copy constructor.2 */ CoinPartitionedVector::CoinPartitionedVector(const CoinPartitionedVector * rhs) : CoinIndexedVector(rhs) { memcpy(startPartition_,rhs->startPartition_,((&numberPartitions_-startPartition_)+1)*sizeof(int)); } /* Assignment operator. */ CoinPartitionedVector & CoinPartitionedVector::operator=(const CoinPartitionedVector & rhs) { if (this != &rhs) { CoinIndexedVector::operator=(rhs); memcpy(startPartition_,rhs.startPartition_,((&numberPartitions_-startPartition_)+1)*sizeof(int)); } return *this; } /* Destructor */ CoinPartitionedVector::~CoinPartitionedVector () { } // Add up number of elements in partitions void CoinPartitionedVector::computeNumberElements() { if (numberPartitions_) { assert (packedMode_); int n=0; for (int i=0;i=last); assert (numberElementsPartition_[i]==0); last=startPartition_[i]; } assert (startPartition_[numberPartitions_]>=last&& startPartition_[numberPartitions_]<=capacity_); #endif } else { clearAndReset(); } } // Reset the vector (as if were just created an empty vector). Gets rid of partitions void CoinPartitionedVector::clearAndReset() { if (numberPartitions_) { assert (packedMode_||!nElements_); for (int i=0;i (indices_+capacity_); for (i=0;itolerance) { elements[n]=value; indices[n++]=i+start; } } } } numberElementsPartition_[partition]=n; return n; } // Print out void CoinPartitionedVector::print() const { printf("Vector has %d elements (%d partitions)\n",nElements_,numberPartitions_); if (!numberPartitions_) { CoinIndexedVector::print(); return; } double * tempElements=CoinCopyOfArray(elements_,capacity_); int * tempIndices=CoinCopyOfArray(indices_,capacity_); for (int partition=0;partitioncolLower_[colIndex];} /// Get colType array ('B', 'I', or 'C' for Binary, Integer and Continuous) inline const char * getColType() const { return colType_;} /// Get pointer to row-wise copy of current matrix inline const CoinPackedMatrix * getMatrixByRow() const { return matrixByRow_;} /// Get pointer to column-wise copy of current matrix inline const CoinPackedMatrix * getMatrixByCol() const { return matrixByCol_;} /// Get pointer to row-wise copy of "original" matrix inline const CoinPackedMatrix * getOriginalMatrixByRow() const { return originalMatrixByRow_;} /// Get pointer to column-wise copy of "original" matrix inline const CoinPackedMatrix * getOriginalMatrixByCol() const { return originalMatrixByCol_;} //@} /**@name Solution query methods */ //@{ /// Get pointer to array[getNumCols()] of primal variable values inline const double * getColSolution() const { return colSolution_;} /// Get pointer to array[getNumRows()] of dual variable values inline const double * getRowPrice() const { return rowPrice_;} /// Get a pointer to array[getNumCols()] of reduced costs inline const double * getReducedCost() const { return reducedCost_;} /// Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector). inline const double * getRowActivity() const { return rowActivity_;} /// Get pointer to array[getNumCols()] of primal variable values which should not be separated (for debug) inline const double * getDoNotSeparateThis() const { return doNotSeparateThis_;} //@} /**@name Other scalar get methods */ //@{ /// Get solver's value for infinity inline double getInfinity() const { return infinity_;} /** Get objective function value - includinbg any offset i.e. sum c sub j * x subj - objValue = objOffset */ inline double getObjValue() const { return objValue_;} /// Get objective offset i.e. sum c sub j * x subj -objValue = objOffset inline double getObjOffset() const { return objOffset_;} /// Get dual tolerance inline double getDualTolerance() const { return dualTolerance_;} /// Get primal tolerance inline double getPrimalTolerance() const { return primalTolerance_;} /// Get integer tolerance inline double getIntegerTolerance() const { return integerTolerance_;} /// Get integer upper bound i.e. best solution * getObjSense inline double getIntegerUpperBound() const { return integerUpperBound_;} /// Get integer lower bound i.e. best possible solution * getObjSense inline double getIntegerLowerBound() const { return integerLowerBound_;} //@} //--------------------------------------------------------------------------- /**@name Method to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is NULL then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    All solution type arrays will be deleted */ void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, bool makeRowCopy=false); //@} //--------------------------------------------------------------------------- /**@name Methods to set data */ //@{ /// Set number of columns inline void setNumCols(int value) { numCols_ = value;} /// Set number of rows inline void setNumRows(int value) { numRows_ = value;} /// Set number of nonzero elements inline void setNumElements(int value) { numElements_ = value;} /// Set number of integer variables inline void setNumIntegers(int value) { numIntegers_ = value;} /// Set pointer to array[getNumCols()] of column lower bounds void setColLower(const double * array, bool copyIn=true); /// Set pointer to array[getNumCols()] of column upper bounds void setColUpper(const double * array, bool copyIn=true); /// Set pointer to array[getNumRows()] of row lower bounds void setRowLower(const double * array, bool copyIn=true); /// Set pointer to array[getNumRows()] of row upper bounds void setRowUpper(const double * array, bool copyIn=true); /** Set pointer to array[getNumRows()] of row right-hand sides This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i] */ void setRightHandSide(const double * array, bool copyIn=true); /** Create array[getNumRows()] of row right-hand sides using existing information This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i] */ void createRightHandSide(); /// Set pointer to array[getNumCols()] of objective function coefficients void setObjCoefficients(const double * array, bool copyIn=true); /// Set objective function sense (1 for min (default), -1 for max) inline void setObjSense(double value) { objSense_ = value;} /// Set colType array ('B', 'I', or 'C' for Binary, Integer and Continuous) void setColType(const char *array, bool copyIn=true); /// Set pointer to row-wise copy of current matrix void setMatrixByRow(const CoinPackedMatrix * matrix, bool copyIn=true); /// Create row-wise copy from MatrixByCol void createMatrixByRow(); /// Set pointer to column-wise copy of current matrix void setMatrixByCol(const CoinPackedMatrix * matrix, bool copyIn=true); /// Set pointer to row-wise copy of "original" matrix void setOriginalMatrixByRow(const CoinPackedMatrix * matrix, bool copyIn=true); /// Set pointer to column-wise copy of "original" matrix void setOriginalMatrixByCol(const CoinPackedMatrix * matrix, bool copyIn=true); /// Set pointer to array[getNumCols()] of primal variable values void setColSolution(const double * array, bool copyIn=true); /// Set pointer to array[getNumRows()] of dual variable values void setRowPrice(const double * array, bool copyIn=true); /// Set a pointer to array[getNumCols()] of reduced costs void setReducedCost(const double * array, bool copyIn=true); /// Set pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector). void setRowActivity(const double * array, bool copyIn=true); /// Set pointer to array[getNumCols()] of primal variable values which should not be separated (for debug) void setDoNotSeparateThis(const double * array, bool copyIn=true); /// Set solver's value for infinity inline void setInfinity(double value) { infinity_ = value;} /// Set objective function value (including any rhs offset) inline void setObjValue(double value) { objValue_ = value;} /// Set objective offset i.e. sum c sub j * x subj -objValue = objOffset inline void setObjOffset(double value) { objOffset_ = value;} /// Set dual tolerance inline void setDualTolerance(double value) { dualTolerance_ = value;} /// Set primal tolerance inline void setPrimalTolerance(double value) { primalTolerance_ = value;} /// Set integer tolerance inline void setIntegerTolerance(double value) { integerTolerance_ = value;} /// Set integer upper bound i.e. best solution * getObjSense inline void setIntegerUpperBound(double value) { integerUpperBound_ = value;} /// Set integer lower bound i.e. best possible solution * getObjSense inline void setIntegerLowerBound(double value) { integerLowerBound_ = value;} //@} //--------------------------------------------------------------------------- ///@name Constructors and destructors //@{ /// Default Constructor CoinSnapshot(); /// Copy constructor CoinSnapshot(const CoinSnapshot &); /// Assignment operator CoinSnapshot & operator=(const CoinSnapshot& rhs); /// Destructor virtual ~CoinSnapshot (); //@} private: ///@name private functions //@{ /** Does main work of destructor - type (or'ed) 1 - NULLify pointers 2 - delete pointers 4 - initialize scalars (tolerances etc) 8 - initialize scalars (objValue etc0 */ void gutsOfDestructor(int type); /// Does main work of copy void gutsOfCopy(const CoinSnapshot & rhs); //@} ///@name Private member data /// objective function sense (1 for min (default), -1 for max) double objSense_; /// solver's value for infinity double infinity_; /// objective function value (including any rhs offset) double objValue_; /// objective offset i.e. sum c sub j * x subj -objValue = objOffset double objOffset_; /// dual tolerance double dualTolerance_; /// primal tolerance double primalTolerance_; /// integer tolerance double integerTolerance_; /// integer upper bound i.e. best solution * getObjSense double integerUpperBound_; /// integer lower bound i.e. best possible solution * getObjSense double integerLowerBound_; /// pointer to array[getNumCols()] of column lower bounds const double * colLower_; /// pointer to array[getNumCols()] of column upper bounds const double * colUpper_; /// pointer to array[getNumRows()] of row lower bounds const double * rowLower_; /// pointer to array[getNumRows()] of row upper bounds const double * rowUpper_; /// pointer to array[getNumRows()] of rhs side values const double * rightHandSide_; /// pointer to array[getNumCols()] of objective function coefficients const double * objCoefficients_; /// colType array ('B', 'I', or 'C' for Binary, Integer and Continuous) const char * colType_; /// pointer to row-wise copy of current matrix const CoinPackedMatrix * matrixByRow_; /// pointer to column-wise copy of current matrix const CoinPackedMatrix * matrixByCol_; /// pointer to row-wise copy of "original" matrix const CoinPackedMatrix * originalMatrixByRow_; /// pointer to column-wise copy of "original" matrix const CoinPackedMatrix * originalMatrixByCol_; /// pointer to array[getNumCols()] of primal variable values const double * colSolution_; /// pointer to array[getNumRows()] of dual variable values const double * rowPrice_; /// a pointer to array[getNumCols()] of reduced costs const double * reducedCost_; /// pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector). const double * rowActivity_; /// pointer to array[getNumCols()] of primal variable values which should not be separated (for debug) const double * doNotSeparateThis_; /// number of columns int numCols_; /// number of rows int numRows_; /// number of nonzero elements int numElements_; /// number of integer variables int numIntegers_; /// To say whether arrays etc are owned by CoinSnapshot typedef struct { unsigned int colLower:1; unsigned int colUpper:1; unsigned int rowLower:1; unsigned int rowUpper:1; unsigned int rightHandSide:1; unsigned int objCoefficients:1; unsigned int colType:1; unsigned int matrixByRow:1; unsigned int matrixByCol:1; unsigned int originalMatrixByRow:1; unsigned int originalMatrixByCol:1; unsigned int colSolution:1; unsigned int rowPrice:1; unsigned int reducedCost:1; unsigned int rowActivity:1; unsigned int doNotSeparateThis:1; } coinOwned; coinOwned owned_; //@} }; #endif CoinMP-1.8.3/CoinUtils/src/CoinMessageHandler.cpp0000644000175000017500000006235311670766165020243 0ustar renerene/* $Id: CoinMessageHandler.cpp 1513 2011-12-10 23:34:13Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinMessageHandler.hpp" #include "CoinHelperFunctions.hpp" #include #include #include #include /* Default constructor. */ CoinOneMessage::CoinOneMessage() { externalNumber_=-1; message_[0]='\0'; severity_='I'; detail_=0; } /* Destructor */ CoinOneMessage::~CoinOneMessage() { } /* The copy constructor */ CoinOneMessage::CoinOneMessage(const CoinOneMessage & rhs) { externalNumber_=rhs.externalNumber_; strcpy(message_,rhs.message_); severity_=rhs.severity_; detail_=rhs.detail_; } /* assignment operator. */ CoinOneMessage& CoinOneMessage::operator=(const CoinOneMessage & rhs) { if (this != &rhs) { externalNumber_=rhs.externalNumber_; strcpy(message_,rhs.message_); severity_=rhs.severity_; detail_=rhs.detail_; } return *this; } /* Normal constructor */ CoinOneMessage::CoinOneMessage(int externalNumber, char detail, const char * message) { externalNumber_=externalNumber; strcpy(message_,message); if (externalNumber<3000) severity_='I'; else if (externalNumber<6000) severity_='W'; else if (externalNumber<9000) severity_='E'; else severity_='S'; detail_=detail; } // Replaces messages (i.e. a different language) void CoinOneMessage::replaceMessage( const char * message) { strcpy(message_,message); } /* Constructor with number of messages. */ CoinMessages::CoinMessages(int numberMessages) { numberMessages_=numberMessages; language_=us_en; strcpy(source_,"Unk"); class_=1; lengthMessages_=-1; if (numberMessages_) { message_ = new CoinOneMessage * [numberMessages_]; int i; for (i=0;i (rhs.message_),lengthMessages_); message_ = reinterpret_cast (temp); std::ptrdiff_t offset = temp - reinterpret_cast (rhs.message_); int i; //printf("new address %x(%x), rhs %x - length %d\n",message_,temp,rhs.message_,lengthMessages_); for (i=0;i (message_[i])) + offset; assert (newAddress-temp (newAddress); //printf("message %d at %x is %s\n",i,message_[i],message_[i]->message()); //printf("message %d at %x wass %s\n",i,rhs.message_[i],rhs.message_[i]->message()); } } } } /* assignment operator. */ CoinMessages& CoinMessages::operator=(const CoinMessages & rhs) { if (this != &rhs) { language_=rhs.language_; strcpy(source_,rhs.source_); class_=rhs.class_; if (lengthMessages_<0) { int i; for (i=0;i (rhs.message_),lengthMessages_); message_ = reinterpret_cast (temp); std::ptrdiff_t offset = temp - reinterpret_cast (rhs.message_); int i; //printf("new address %x(%x), rhs %x - length %d\n",message_,temp,rhs.message_,lengthMessages_); for (i=0;i (message_[i])) + offset; assert (newAddress-temp (newAddress); //printf("message %d at %x is %s\n",i,message_[i],message_[i]->message()); //printf("message %d at %x wass %s\n",i,rhs.message_[i],rhs.message_[i]->message()); } } } } return *this; } // Puts message in correct place void CoinMessages::addMessage(int messageNumber, const CoinOneMessage & message) { if (messageNumber>=numberMessages_) { // should not happen but allow for it CoinOneMessage ** temp = new CoinOneMessage * [messageNumber+1]; int i; for (i=0;i=0) fromCompact(); delete message_[messageNumber]; message_[messageNumber]=new CoinOneMessage(message); } // Replaces messages (i.e. a different language) void CoinMessages::replaceMessage(int messageNumber, const char * message) { if (lengthMessages_>=0) fromCompact(); assert(messageNumberreplaceMessage(message); } // Changes detail level for one message void CoinMessages::setDetailMessage(int newLevel, int messageNumber) { int i; // Last message is null (corresponds to DUMMY) for (i=0;iexternalNumber()==messageNumber) { message_[i]->setDetail(newLevel); break; } } } // Changes detail level for several messages void CoinMessages::setDetailMessages(int newLevel, int numberMessages, int * messageNumbers) { int i; if (numberMessages<3&&messageNumbers) { // do one by one int j; for (j=0;jexternalNumber()==messageNumber) { message_[i]->setDetail(newLevel); break; } } } } else if (numberMessages<10000&&messageNumbers) { // do backward mapping int backward[10000]; for (i=0;i<10000;i++) backward[i]=-1; for (i=0;iexternalNumber()]=i; for (i=0;i=0) message_[iback]->setDetail(newLevel); } } else { // do all (except for dummy end) for (i=0;isetDetail(newLevel); } } } // Changes detail level for all messages >= low and < high void CoinMessages::setDetailMessages(int newLevel, int low, int high) { // do all (except for dummy end) if in range for (int i=0;iexternalNumber(); if (iNumber>=low&&iNumbersetDetail(newLevel); } } /* Moves to compact format Compact format is an initial array of CoinOneMessage pointers, followed by a bulk store that holds compressed CoinOneMessage objects, where the message_ array is truncated to be just as large as necessary. */ void CoinMessages::toCompact() { if (numberMessages_&&lengthMessages_<0) { lengthMessages_=numberMessages_*CoinSizeofAsInt(CoinOneMessage *); int i; for (i=0;i(strlen(message_[i]->message())); length = static_cast((message_[i]->message()+length+1)- reinterpret_cast (message_[i])); assert (length (temp); temp += numberMessages_*CoinSizeofAsInt(CoinOneMessage *); CoinOneMessage message; //printf("new address %x(%x) - length %d\n",newMessage,temp,lengthMessages_); lengthMessages_=numberMessages_*CoinSizeofAsInt(CoinOneMessage *); for (i=0;i(strlen(message.message())); length = static_cast((message.message()+length+1)- reinterpret_cast (&message)); assert (length (temp); //printf("message %d at %x is %s\n",i,newMessage[i],newMessage[i]->message()); if (leftOver) length += 8-leftOver; temp += length; lengthMessages_+=length; } else { // null message newMessage[i]=NULL; } } for (i=0;i=0) { CoinOneMessage ** temp = new CoinOneMessage * [numberMessages_]; int i; for (i=0;imessageBuffer_) { *messageOut_=0; //take off trailing spaces and commas messageOut_--; while (messageOut_>=messageBuffer_) { if (*messageOut_==' '||*messageOut_==',') { *messageOut_=0; messageOut_--; } else { break; } } // Now do print which can be overridden returnCode=print(); // See what to do on error checkSeverity(); } return returnCode; } // Print message, return 0 normally int CoinMessageHandler::print() { fprintf(fp_,"%s\n",messageBuffer_); return 0; } // Check severity void CoinMessageHandler::checkSeverity() { if (currentMessage_.severity_=='S') { fprintf(fp_,"Stopping due to previous errors.\n"); //Should do walkback abort(); } } /* Amount of print out: 0 - none 1 - minimal 2 - normal low 3 - normal high 4 - verbose above that 8,16,32 etc just for selective debug and are for printf messages in code */ void CoinMessageHandler::setLogLevel (int value) { if (value >= -1) logLevel_ = value ; } void CoinMessageHandler::setLogLevel (int which, int value) { if (which >= 0 && which < COIN_NUM_LOG) { if (value >= -1) logLevels_[which] = value ; } } void CoinMessageHandler::setPrecision(unsigned int new_precision) { char new_string[8] = {'%','.','8','f','\0','\0','\0','\0'}; //we assume that the precision is smaller than one thousand new_precision = std::min(999,new_precision); if (new_precision == 0) new_precision = 1; g_precision_ = new_precision ; int idx = 2; int base = 100; bool print = false; while (base > 0) { char c = static_cast(new_precision / base); new_precision = new_precision % base; if (c != 0) print = true; if (print) { new_string[idx] = static_cast(c + '0'); idx++; } base /= 10; } new_string[idx] = 'g'; strcpy(g_format_,new_string); } void CoinMessageHandler::setPrefix(bool value) { if (value) prefix_ = 255; else prefix_ =0; } bool CoinMessageHandler::prefix() const { return (prefix_!=0); } // Constructor CoinMessageHandler::CoinMessageHandler() : logLevel_(1), prefix_(255), currentMessage_(), internalNumber_(0), format_(NULL), printStatus_(0), highestNumber_(-1), fp_(stdout) { const char* g_default = "%.8g"; strcpy(g_format_,g_default); g_precision_ = 8 ; for (int i=0;i= 8 && logLevel_ >= 0) { if ((msglvl&logLevel_) == 0) printStatus_ = 3 ; } else if (logLevel_ < msglvl) { printStatus_ = 3 ; } } else if (logLevels_[msgclass] < msglvl) { printStatus_ = 3; } } /* Start a message using a standard CoinOneMessage. */ CoinMessageHandler & CoinMessageHandler::message (int messageNumber, const CoinMessages &normalMessages) { // Deal with the previous message, if there is one. if (messageOut_ != messageBuffer_) { internalPrint() ; } // Acquire the new message internalNumber_ = messageNumber ; currentMessage_ = *(normalMessages.message_[messageNumber]) ; source_ = normalMessages.source_ ; format_ = currentMessage_.message_ ; highestNumber_ = CoinMax(highestNumber_,currentMessage_.externalNumber_); // Initialise the message construction buffer messageBuffer_[0] = '\0' ; messageOut_ = messageBuffer_ ; // Decide whether or not to print (sets printStatus_) calcPrintStatus(currentMessage_.detail_,normalMessages.class_) ; // If we're printing, initialise the message if (!printStatus_) { if (prefix_) { sprintf(messageOut_,"%s%4.4d%c ",source_.c_str(), currentMessage_.externalNumber_, currentMessage_.severity_) ; messageOut_ += strlen(messageOut_) ; } format_ = nextPerCent(format_,true) ; } return (*this) ; } /* Start a message, providing the full message, information to generate a prefix, a severity code, and an optional log level. Intended as an aid to help existing codes interface. */ CoinMessageHandler & CoinMessageHandler::message (int externalNumber, const char *source, const char *msg, char severity, int loglvl) { // Deal with the previous message, if there is one. if (messageOut_ != messageBuffer_) { internalPrint() ; } // Set up a dummy message. internalNumber_ = externalNumber ; char detail = ((loglvl >= 0)?(static_cast(loglvl)):'\000') ; currentMessage_= CoinOneMessage(externalNumber,detail,msg) ; source_ = source ; highestNumber_ = CoinMax(highestNumber_,externalNumber); // Initialise the message construction buffer messageBuffer_[0] = '\0' ; messageOut_ = messageBuffer_ ; /* Decide whether or not to print. The normal value of printStatus_ here is 2 (complete message provided). loglvl defaults to -1 for backwards compatibility (previously there was no provision for a log level). */ if (loglvl >= 0) calcPrintStatus(loglvl,0) ; if (!printStatus_) { printStatus_ = 2 ; if (prefix_) { sprintf(messageOut_,"%s%4.4d%c ",source_.c_str(), externalNumber,severity) ; } strcat(messageBuffer_,msg) ; messageOut_ = messageBuffer_+strlen(messageBuffer_) ; } return (*this) ; } /* Decides whether or not to print and returns a reference to the handler. */ CoinMessageHandler & CoinMessageHandler::message(int loglvl) { // Adjust print status? if (loglvl >= 0) calcPrintStatus(loglvl,0) ; return (*this) ; } /* Allows for skipping printing of part of message, but putting in data */ CoinMessageHandler & CoinMessageHandler::printing(bool onOff) { // has no effect if skipping or whole message in if (printStatus_ < 2) { assert(format_[1]=='?'); *format_ = '%' ; if (onOff) printStatus_=0; else printStatus_=1; format_ = nextPerCent(format_+2,true); } return *this; } /* Stop (and print) Unless printing is currently suppressed. We need to do the finishing actions in any event. */ int CoinMessageHandler::finish() { // Deal with the collected message if (printStatus_ < 3 && messageOut_ != messageBuffer_) { internalPrint(); } // Clean up for the next message. internalNumber_ = -1 ; format_ = NULL ; messageBuffer_[0] = '\0' ; messageOut_ = messageBuffer_ ; printStatus_ = 0 ; doubleValue_.clear() ; longValue_.clear() ; charValue_.clear() ; stringValue_.clear() ; return (0) ; } /* Gets position of next field in format If we're scanning the initial portion of the string (prior to the first `%' code) the prefix will be copied to the output buffer. Normally, the text from the current position up to and including a % code is is processed by the relevant operator<< method. */ char * CoinMessageHandler::nextPerCent(char * start , const bool initial) { if (start) { bool foundNext=false; while (!foundNext) { char * nextPerCent = strchr(start,'%'); if (nextPerCent) { if (initial&&!printStatus_) { int numberToCopy=static_cast(nextPerCent-start); strncpy(messageOut_,start,numberToCopy); messageOut_+=numberToCopy; } // %? is skipped over as it is just a separator if (nextPerCent[1]!='?') { start=nextPerCent; if (start[1]!='%') { foundNext=true; if (!initial) *start='\0'; //zap } else { start+=2; if (initial) { *messageOut_='%'; messageOut_++; } } } else { foundNext=true; // skip to % and zap start=nextPerCent; *start='\0'; } } else { if (initial&&!printStatus_) { strcpy(messageOut_,start); messageOut_+=strlen(messageOut_); } start=0; foundNext=true; } } } return start; } // Adds into message CoinMessageHandler & CoinMessageHandler::operator<< (int intvalue) { if (printStatus_==3) return *this; // not doing this message longValue_.push_back(intvalue); if (printStatus_<2) { if (format_) { //format is at % (but may be changed to null) *format_='%'; char * next = nextPerCent(format_+1); // could check if (!printStatus_) { sprintf(messageOut_,format_,intvalue); messageOut_+=strlen(messageOut_); } format_=next; } else { sprintf(messageOut_," %d",intvalue); messageOut_+=strlen(messageOut_); } } return *this; } CoinMessageHandler & CoinMessageHandler::operator<< (double doublevalue) { if (printStatus_==3) return *this; // not doing this message doubleValue_.push_back(doublevalue); if (printStatus_<2) { if (format_) { //format is at \0 (but changed to %) *format_='%'; char * next = nextPerCent(format_+1); // could check if (!printStatus_) { if (format_[1] == '.' && format_[2] >= '0' && format_[2] <= '9') { // an explicitly specified precision currently overrides the // precision of the message handler sprintf(messageOut_,format_,doublevalue); } else { sprintf(messageOut_,g_format_,doublevalue); if (next != format_+2) { messageOut_+=strlen(messageOut_); sprintf(messageOut_,format_+2); } } messageOut_+=strlen(messageOut_); } format_=next; } else { sprintf(messageOut_," "); messageOut_ += 1; sprintf(messageOut_,g_format_,doublevalue); messageOut_+=strlen(messageOut_); } } return *this; } #if COIN_BIG_INDEX==1 CoinMessageHandler & CoinMessageHandler::operator<< (long longvalue) { if (printStatus_==3) return *this; // not doing this message longValue_.push_back(longvalue); if (printStatus_<2) { if (format_) { //format is at % (but may be changed to null) *format_='%'; char * next = nextPerCent(format_+1); // could check if (!printStatus_) { sprintf(messageOut_,format_,longvalue); messageOut_+=strlen(messageOut_); } format_=next; } else { sprintf(messageOut_," %ld",longvalue); messageOut_+=strlen(messageOut_); } } return *this; } #endif #if COIN_BIG_INDEX==2 CoinMessageHandler & CoinMessageHandler::operator<< (long long longvalue) { if (printStatus_==3) return *this; // not doing this message longValue_.push_back(longvalue); if (printStatus_<2) { if (format_) { //format is at % (but may be changed to null) *format_='%'; char * next = nextPerCent(format_+1); // could check if (!printStatus_) { sprintf(messageOut_,format_,longvalue); messageOut_+=strlen(messageOut_); } format_=next; } else { sprintf(messageOut_," %ld",longvalue); messageOut_+=strlen(messageOut_); } } return *this; } #endif CoinMessageHandler & CoinMessageHandler::operator<< (const std::string& stringvalue) { if (printStatus_==3) return *this; // not doing this message stringValue_.push_back(stringvalue); if (printStatus_<2) { if (format_) { //format is at % (but changed to 0) *format_='%'; char * next = nextPerCent(format_+1); // could check if (!printStatus_) { sprintf(messageOut_,format_,stringvalue.c_str()); messageOut_+=strlen(messageOut_); } format_=next; } else { sprintf(messageOut_," %s",stringvalue.c_str()); messageOut_+=strlen(messageOut_); } } return *this; } CoinMessageHandler & CoinMessageHandler::operator<< (char charvalue) { if (printStatus_==3) return *this; // not doing this message charValue_.push_back(charvalue); if (printStatus_<2) { if (format_) { //format is at % (but changed to 0) *format_='%'; char * next = nextPerCent(format_+1); // could check if (!printStatus_) { sprintf(messageOut_,format_,charvalue); messageOut_+=strlen(messageOut_); } format_=next; } else { sprintf(messageOut_," %c",charvalue); messageOut_+=strlen(messageOut_); } } return *this; } CoinMessageHandler & CoinMessageHandler::operator<< (const char *stringvalue) { if (printStatus_==3) return *this; // not doing this message stringValue_.push_back(stringvalue); if (printStatus_<2) { if (format_) { //format is at % (but changed to 0) *format_='%'; char * next = nextPerCent(format_+1); // could check if (!printStatus_) { sprintf(messageOut_,format_,stringvalue); messageOut_+=strlen(messageOut_); } format_=next; } else { sprintf(messageOut_," %s",stringvalue); messageOut_+=strlen(messageOut_); } } return *this; } /* Handle markers. Even when printing is suppressed (printStatus_ == 3) we need to execute finish() to reset for the next message. */ CoinMessageHandler & CoinMessageHandler::operator<< (CoinMessageMarker marker) { switch (marker) { case CoinMessageEol: { finish() ; break ; } case CoinMessageNewline: { if (printStatus_ != 3) { strcat(messageOut_,"\n") ; messageOut_++ ; } break ; } } return (*this) ; } CoinMP-1.8.3/CoinUtils/src/CoinFinite.hpp0000644000175000017500000000234712450335570016566 0ustar renerene/* $Id: CoinFinite.hpp 1762 2014-12-29 20:37:12Z tkr $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Defines COIN_DBL_MAX and relatives and provides CoinFinite and CoinIsnan. */ #ifndef CoinFinite_H #define CoinFinite_H #include //============================================================================= // Smallest positive double value and Plus infinity (double and int) #if 1 const double COIN_DBL_MIN = (std::numeric_limits::min)(); const double COIN_DBL_MAX = (std::numeric_limits::max)(); const int COIN_INT_MAX = (std::numeric_limits::max)(); const double COIN_INT_MAX_AS_DOUBLE = (std::numeric_limits::max)(); #else #define COIN_DBL_MIN (std::numeric_limits::min()) #define COIN_DBL_MAX (std::numeric_limits::max()) #define COIN_INT_MAX (std::numeric_limits::max()) #define COIN_INT_MAX_AS_DOUBLE (std::numeric_limits::max()) #endif /** checks if a double value is finite (not infinity and not NaN) */ extern bool CoinFinite(double val); /** checks if a double value is not a number */ extern bool CoinIsnan(double val); #endif CoinMP-1.8.3/CoinUtils/src/CoinSignal.hpp0000644000175000017500000000642112500642642016557 0ustar renerene/* $Id: CoinSignal.hpp 1810 2015-03-13 20:16:34Z tkr $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef _CoinSignal_hpp #define _CoinSignal_hpp // This file is fully docified. // There's nothing to docify... //############################################################################# #include //############################################################################# #if defined(_MSC_VER) typedef void (__cdecl *CoinSighandler_t) (int); # define CoinSighandler_t_defined #endif //----------------------------------------------------------------------------- #if (defined(__GNUC__) && defined(__linux__)) typedef sighandler_t CoinSighandler_t; # define CoinSighandler_t_defined #endif //----------------------------------------------------------------------------- #if defined(__CYGWIN__) && defined(__GNUC__) typedef __decltype(SIG_DFL) CoinSighandler_t; # define CoinSighandler_t_defined #endif //----------------------------------------------------------------------------- #if defined(__MINGW32__) && defined(__GNUC__) typedef __decltype(SIG_DFL) CoinSighandler_t; # define CoinSighandler_t_defined #endif //----------------------------------------------------------------------------- #if defined(__FreeBSD__) && defined(__GNUC__) typedef __decltype(SIG_DFL) CoinSighandler_t; # define CoinSighandler_t_defined #endif //----------------------------------------------------------------------------- #if defined(__NetBSD__) && defined(__GNUC__) typedef __decltype(SIG_DFL) CoinSighandler_t; # define CoinSighandler_t_defined #endif //----------------------------------------------------------------------------- #if defined(_AIX) # if defined(__GNUC__) typedef __decltype(SIG_DFL) CoinSighandler_t; # define CoinSighandler_t_defined # endif #endif //----------------------------------------------------------------------------- #if defined (__hpux) # define CoinSighandler_t_defined # if defined(__GNUC__) typedef __decltype(SIG_DFL) CoinSighandler_t; # else extern "C" { typedef void (*CoinSighandler_t) (int); } # endif #endif //----------------------------------------------------------------------------- #if defined(__sun) # if defined(__SUNPRO_CC) # include extern "C" { typedef void (*CoinSighandler_t) (int); } # define CoinSighandler_t_defined # endif # if defined(__GNUC__) typedef __decltype(SIG_DFL) CoinSighandler_t; # define CoinSighandler_t_defined # endif #endif //----------------------------------------------------------------------------- #if defined(__MACH__) && defined(__GNUC__) typedef __decltype(SIG_DFL) CoinSighandler_t; # define CoinSighandler_t_defined #endif //############################################################################# #ifndef CoinSighandler_t_defined # warning("OS and/or compiler is not recognized. Defaulting to:"); # warning("extern 'C' {") # warning(" typedef void (*CoinSighandler_t) (int);") # warning("}") extern "C" { typedef void (*CoinSighandler_t) (int); } #endif //############################################################################# #endif CoinMP-1.8.3/CoinUtils/src/CoinMpsIO.cpp0000644000175000017500000052035112331124721016322 0ustar renerene/* $Id: CoinMpsIO.cpp 1697 2014-05-03 08:33:21Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinUtilsConfig.h" #include #include #include #include #include #include #include #include "CoinMpsIO.hpp" #include "CoinMessage.hpp" #include "CoinHelperFunctions.hpp" #include "CoinModel.hpp" #include "CoinSort.hpp" //############################################################################# // type - 0 normal, 1 INTEL IEEE, 2 other IEEE namespace { const double fraction[]= {1.0,1.0e-1,1.0e-2,1.0e-3,1.0e-4,1.0e-5,1.0e-6,1.0e-7,1.0e-8, 1.0e-9,1.0e-10,1.0e-11,1.0e-12,1.0e-13,1.0e-14,1.0e-15,1.0e-16, 1.0e-17,1.0e-18,1.0e-19,1.0e-20,1.0e-21,1.0e-22,1.0e-23}; const double exponent[]= {1.0e-9,1.0e-8,1.0e-7,1.0e-6,1.0e-5,1.0e-4,1.0e-3,1.0e-2,1.0e-1, 1.0,1.0e1,1.0e2,1.0e3,1.0e4,1.0e5,1.0e6,1.0e7,1.0e8,1.0e9}; } // end file-local namespace double CoinMpsCardReader::osi_strtod(char * ptr, char ** output, int type) { double value = 0.0; char * save = ptr; // take off leading white space while (*ptr==' '||*ptr=='\t') ptr++; if (!type) { double sign1=1.0; // do + or - if (*ptr=='-') { sign1=-1.0; ptr++; } else if (*ptr=='+') { ptr++; } // more white space while (*ptr==' '||*ptr=='\t') ptr++; char thisChar=0; while (value<1.0e30) { thisChar = *ptr; ptr++; if (thisChar>='0'&&thisChar<='9') value = value*10.0+thisChar-'0'; else break; } if (value<1.0e30) { if (thisChar=='.') { // do fraction double value2 = 0.0; int nfrac=0; while (nfrac<24) { thisChar = *ptr; ptr++; if (thisChar>='0'&&thisChar<='9') { value2 = value2*10.0+thisChar-'0'; nfrac++; } else { break; } } if (nfrac<24) { value += value2*fraction[nfrac]; } else { thisChar='x'; // force error } } if (thisChar=='e'||thisChar=='E') { // exponent int sign2=1; // do + or - if (*ptr=='-') { sign2=-1; ptr++; } else if (*ptr=='+') { ptr++; } int value3 = 0; while (value3<1000) { thisChar = *ptr; ptr++; if (thisChar>='0'&&thisChar<='9') { value3 = value3*10+thisChar-'0'; } else { break; } } if (value3<300) { value3 *= sign2; // power of 10 if (abs(value3)<10) { // do most common by lookup (for accuracy?) value *= exponent[value3+9]; } else { value *= pow(10.0,value3); } } else if (sign2<0.0) { value = 0.0; // force zero } else { value = COIN_DBL_MAX; } } if (thisChar==0||thisChar=='\t'||thisChar==' ') { // okay *output=ptr; } else { value = osi_strtod(save,output); sign1=1.0; } } else { // bad value value = osi_strtod(save,output); sign1=1.0; } value *= sign1; } else { // ieee - 3 bytes go to 2 assert (sizeof(double)==8*sizeof(char)); assert (sizeof(unsigned short) == 2*sizeof(char)); unsigned short shortValue[4]; *output = ptr+12; // say okay if (type==1) { // INTEL for (int i=3;i>=0;i--) { int integerValue=0; char * three = reinterpret_cast (&integerValue); three[1]=ptr[0]; three[2]=ptr[1]; three[3]=ptr[2]; unsigned short thisValue=0; // decode 6 bits at a time for (int j=2;j>=0;j--) { thisValue = static_cast(thisValue<<6); char thisChar = ptr[j]; if (thisChar >= '0' && thisChar <= '0' + 9) { thisValue = static_cast(thisValue | (thisChar - '0')); } else if (thisChar >= 'a' && thisChar <= 'a' + 25) { thisValue = static_cast(thisValue | (thisChar - 'a' + 10)); } else if (thisChar >= 'A' && thisChar <= 'A' + 25) { thisValue = static_cast(thisValue | (thisChar - 'A' + 36)); } else if (thisChar >= '*' && thisChar <= '*' + 1) { thisValue = static_cast(thisValue | (thisChar - '*' + 62)); } else { // error *output=save; } } ptr+=3; shortValue[i]=thisValue; } } else { // not INTEL for (int i=0;i<4;i++) { int integerValue=0; char * three = reinterpret_cast (&integerValue); three[1]=ptr[0]; three[2]=ptr[1]; three[3]=ptr[2]; unsigned short thisValue=0; // decode 6 bits at a time for (int j=2;j>=0;j--) { thisValue = static_cast(thisValue<<6); char thisChar = ptr[j]; if (thisChar >= '0' && thisChar <= '0' + 9) { thisValue = static_cast(thisValue | (thisChar - '0')); } else if (thisChar >= 'a' && thisChar <= 'a' + 25) { thisValue = static_cast(thisValue | (thisChar - 'a' + 10)); } else if (thisChar >= 'A' && thisChar <= 'A' + 25) { thisValue = static_cast(thisValue | (thisChar - 'A' + 36)); } else if (thisChar >= '*' && thisChar <= '*' + 1) { thisValue = static_cast(thisValue | (thisChar - '*' + 62)); } else { // error *output=save; } } ptr+=3; shortValue[i]=thisValue; } } memcpy(&value,shortValue,sizeof(double)); } return value; } // for strings double CoinMpsCardReader::osi_strtod(char * ptr, char ** output) { char * save = ptr; double value=-1.0e100; if (!stringsAllowed_) { *output=save; } else { // take off leading white space while (*ptr==' '||*ptr=='\t') ptr++; if (*ptr=='=') { strcpy(valueString_,ptr); #define STRING_VALUE -1.234567e-101 value = STRING_VALUE; *output=ptr+strlen(ptr); } else { *output=save; } } return value; } //############################################################################# // sections const static char *section[] = { "", "NAME", "ROW", "COLUMN", "RHS", "RANGES", "BOUNDS", "ENDATA", " ","QSECTION", "CSECTION", "QUADOBJ" , "SOS", "BASIS", " " }; // what is allowed in each section - must line up with COINSectionType const static COINMpsType startType[] = { COIN_UNKNOWN_MPS_TYPE, COIN_UNKNOWN_MPS_TYPE, COIN_N_ROW, COIN_BLANK_COLUMN, COIN_BLANK_COLUMN, COIN_BLANK_COLUMN, COIN_UP_BOUND, COIN_UNKNOWN_MPS_TYPE, COIN_UNKNOWN_MPS_TYPE, COIN_BLANK_COLUMN, COIN_BLANK_COLUMN, COIN_BLANK_COLUMN, COIN_S1_BOUND, COIN_BS_BASIS, COIN_UNKNOWN_MPS_TYPE }; const static COINMpsType endType[] = { COIN_UNKNOWN_MPS_TYPE, COIN_UNKNOWN_MPS_TYPE, COIN_BLANK_COLUMN, COIN_UNSET_BOUND, COIN_S1_COLUMN, COIN_S1_COLUMN, COIN_UNKNOWN_MPS_TYPE, COIN_UNKNOWN_MPS_TYPE, COIN_UNKNOWN_MPS_TYPE, COIN_BLANK_COLUMN, COIN_BLANK_COLUMN, COIN_BLANK_COLUMN, COIN_BS_BASIS, COIN_UNKNOWN_MPS_TYPE, COIN_UNKNOWN_MPS_TYPE }; const static int allowedLength[] = { 0, 0, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0 }; // names of types const static char *mpsTypes[] = { "N", "E", "L", "G", " ", "S1", "S2", "S3", " ", " ", " ", " ", "UP", "FX", "LO", "FR", "MI", "PL", "BV", "UI", "LI", "XX", "SC", "X1", "X2", "BS", "XL", "XU", "LL", "UL", " " }; int CoinMpsCardReader::cleanCard() { char * getit; getit = input_->gets ( card_, MAX_CARD_LENGTH); if ( getit ) { cardNumber_++; unsigned char * lastNonBlank = reinterpret_cast (card_-1); unsigned char * image = reinterpret_cast (card_); bool tabs=false; while ( *image != '\0' ) { if ( *image != '\t' && *image < ' ' ) { break; } else if ( *image != '\t' && *image != ' ') { lastNonBlank = image; } else if (*image == '\t') { tabs=true; } image++; } *(lastNonBlank+1)='\0'; if (tabs&§ion_ == COIN_BOUNDS_SECTION&&!freeFormat_&&eightChar_) { int length = static_cast(lastNonBlank+1- reinterpret_cast(card_)); assert (length<81); memcpy(card_+82,card_,length); int pos[]={1,4,14,24,1000}; int put=0; int tab=0; for (int i=0;imessage(COIN_MPS_LINE,messages_)<message(COIN_MPS_LINE,messages_)< (i); break; } } return section_; } CoinMpsCardReader::CoinMpsCardReader ( CoinFileInput *input, CoinMpsIO * reader) { memset ( card_, 0, MAX_CARD_LENGTH ); position_ = card_; eol_ = card_; mpsType_ = COIN_UNKNOWN_MPS_TYPE; memset ( rowName_, 0, COIN_MAX_FIELD_LENGTH ); memset ( columnName_, 0, COIN_MAX_FIELD_LENGTH ); value_ = 0.0; input_ = input; section_ = COIN_EOF_SECTION; cardNumber_ = 0; freeFormat_ = false; ieeeFormat_ = 0; eightChar_ = true; reader_ = reader; handler_ = reader_->messageHandler(); messages_ = reader_->messages(); memset ( valueString_, 0, COIN_MAX_FIELD_LENGTH ); stringsAllowed_=false; } // ~CoinMpsCardReader. Destructor CoinMpsCardReader::~CoinMpsCardReader ( ) { delete input_; } void CoinMpsCardReader::strcpyAndCompress ( char *to, const char *from ) { int n = static_cast(strlen(from)); int i; int nto = 0; for ( i = 0; i < n; i++ ) { if ( from[i] != ' ' ) { to[nto++] = from[i]; } } if ( !nto ) to[nto++] = ' '; to[nto] = '\0'; } // nextField COINSectionType CoinMpsCardReader::nextField ( ) { mpsType_ = COIN_BLANK_COLUMN; // find next non blank character char *next = position_; while ( next != eol_ ) { if ( *next == ' ' || *next == '\t' ) { next++; } else { break; } } bool gotCard; if ( next == eol_ ) { gotCard = false; } else { gotCard = true; } while ( !gotCard ) { // need new image if ( cleanCard() ) { return COIN_EOF_SECTION; } if ( card_[0] == ' ' || card_[0] == '\0') { // not a section or comment position_ = card_; eol_ = card_ + strlen ( card_ ); // get mps type and column name // scan to first non blank next = card_; while ( next != eol_ ) { if ( *next == ' ' || *next == '\t' ) { next++; } else { break; } } if ( next != eol_ ) { char *nextBlank = nextBlankOr ( next ); int nchar; if ( nextBlank ) { nchar = static_cast(nextBlank - next); } else { nchar = -1; } mpsType_ = COIN_BLANK_COLUMN; // special coding if RHS or RANGES, not free format and blanks if ( ( section_ != COIN_RHS_SECTION && section_ != COIN_RANGES_SECTION ) || freeFormat_ || strncmp ( card_ + 4, " ", 8 ) ) { // if columns section only look for first field if MARKER if ( section_ == COIN_COLUMN_SECTION && !strstr ( next, "'MARKER'" ) ) nchar = -1; if (section_ == COIN_SOS_SECTION) { if (!strncmp(card_," S1",3)) { mpsType_ = COIN_S1_BOUND; break; } else if (!strncmp(card_," S2",3)) { mpsType_ = COIN_S2_BOUND; break; } } if ( nchar == allowedLength[section_] ) { //could be a type int i; for ( i = startType[section_]; i < endType[section_]; i++ ) { if ( !strncmp ( next, mpsTypes[i], nchar ) ) { mpsType_ = static_cast (i); break; } } if ( mpsType_ != COIN_BLANK_COLUMN ) { //we know all we need so we can skip over next = nextBlank; while ( next != eol_ ) { if ( *next == ' ' || *next == '\t' ) { next++; } else { break; } } if ( next == eol_ ) { // error position_ = eol_; mpsType_ = COIN_UNKNOWN_MPS_TYPE; } else { nextBlank = nextBlankOr ( next ); } } else if (section_ == COIN_BOUNDS_SECTION) { // should have been something - but just fix LI problem // set to something illegal if (card_[0]==' '&&card_[3]==' '&&(card_[1]!=' '||card_[2]!=' ')) { mpsType_ = COIN_S3_COLUMN; //we know all we need so we can skip over next = nextBlank; while ( next != eol_ ) { if ( *next == ' ' || *next == '\t' ) { next++; } else { break; } } if ( next == eol_ ) { // error position_ = eol_; mpsType_ = COIN_UNKNOWN_MPS_TYPE; } else { nextBlank = nextBlankOr ( next ); } } } } if ( mpsType_ != COIN_UNKNOWN_MPS_TYPE ) { // special coding if BOUND, not free format and blanks if ( section_ != COIN_BOUNDS_SECTION || freeFormat_ || strncmp ( card_ + 4, " ", 8 ) ) { char save = '?'; if ( !freeFormat_ && eightChar_ && next == card_ + 4 ) { if ( eol_ - next >= 8 ) { if ( *( next + 8 ) != ' ' && *( next + 8 ) != '\0' ) { eightChar_ = false; } else { nextBlank = next + 8; } if (nextBlank) { save = *nextBlank; *nextBlank = '\0'; } } else { nextBlank = NULL; } } else { if ( nextBlank ) { save = *nextBlank; *nextBlank = '\0'; } } strcpyAndCompress ( columnName_, next ); if ( nextBlank ) { *nextBlank = save; // on to next next = nextBlank; } else { next = eol_; } } else { // blank bounds name strcpy ( columnName_, " " ); } while ( next != eol_ ) { if ( *next == ' ' || *next == '\t' ) { next++; } else { break; } } if ( next == eol_ ) { // error unless row section or conic section position_ = eol_; value_ = -1.0e100; if ( section_ != COIN_ROW_SECTION && section_!= COIN_CONIC_SECTION) mpsType_ = COIN_UNKNOWN_MPS_TYPE; else return section_; } else { nextBlank = nextBlankOr ( next ); //if (section_==COIN_CONIC_SECTION) } if ( section_ != COIN_ROW_SECTION ) { char save = '?'; if ( !freeFormat_ && eightChar_ && next == card_ + 14 ) { if ( eol_ - next >= 8 ) { if ( *( next + 8 ) != ' ' && *( next + 8 ) != '\0' ) { eightChar_ = false; } else { nextBlank = next + 8; } save = *nextBlank; *nextBlank = '\0'; } else { nextBlank = NULL; } } else { if ( nextBlank ) { save = *nextBlank; *nextBlank = '\0'; } } strcpyAndCompress ( rowName_, next ); if ( nextBlank ) { *nextBlank = save; // on to next next = nextBlank; } else { next = eol_; } while ( next != eol_ ) { if ( *next == ' ' || *next == '\t' ) { next++; } else { break; } } // special coding for markers if ( section_ == COIN_COLUMN_SECTION && !strncmp ( rowName_, "'MARKER'", 8 ) && next != eol_ ) { if ( !strncmp ( next, "'INTORG'", 8 ) ) { mpsType_ = COIN_INTORG; } else if ( !strncmp ( next, "'INTEND'", 8 ) ) { mpsType_ = COIN_INTEND; } else if ( !strncmp ( next, "'SOSORG'", 8 ) ) { if ( mpsType_ == COIN_BLANK_COLUMN ) mpsType_ = COIN_S1_COLUMN; } else if ( !strncmp ( next, "'SOSEND'", 8 ) ) { mpsType_ = COIN_SOSEND; } else { mpsType_ = COIN_UNKNOWN_MPS_TYPE; } position_ = eol_; return section_; } if ( next == eol_ ) { // error unless bounds or basis position_ = eol_; if ( section_ != COIN_BOUNDS_SECTION ) { if ( section_ != COIN_BASIS_SECTION ) mpsType_ = COIN_UNKNOWN_MPS_TYPE; value_ = -1.0e100; } else { value_ = 0.0; } } else { nextBlank = nextBlankOr ( next ); if ( nextBlank ) { save = *nextBlank; *nextBlank = '\0'; } char * after; value_ = osi_strtod(next,&after,ieeeFormat_); // see if error if (after>next) { if ( nextBlank ) { *nextBlank = save; position_ = nextBlank; } else { position_ = eol_; } } else { // error position_ = eol_; mpsType_ = COIN_UNKNOWN_MPS_TYPE; value_ = -1.0e100; } } } } } else { //blank name in RHS or RANGES strcpy ( columnName_, " " ); char save = '?'; if ( !freeFormat_ && eightChar_ && next == card_ + 14 ) { if ( eol_ - next >= 8 ) { if ( *( next + 8 ) != ' ' && *( next + 8 ) != '\0' ) { eightChar_ = false; } else { nextBlank = next + 8; } save = *nextBlank; *nextBlank = '\0'; } else { nextBlank = NULL; } } else { if ( nextBlank ) { save = *nextBlank; *nextBlank = '\0'; } } strcpyAndCompress ( rowName_, next ); if ( nextBlank ) { *nextBlank = save; // on to next next = nextBlank; } else { next = eol_; } while ( next != eol_ ) { if ( *next == ' ' || *next == '\t' ) { next++; } else { break; } } if ( next == eol_ ) { // error position_ = eol_; value_ = -1.0e100; mpsType_ = COIN_UNKNOWN_MPS_TYPE; } else { nextBlank = nextBlankOr ( next ); value_ = -1.0e100; if ( nextBlank ) { save = *nextBlank; *nextBlank = '\0'; } char * after; value_ = osi_strtod(next,&after,ieeeFormat_); // see if error if (after>next) { if ( nextBlank ) { *nextBlank = save; position_ = nextBlank; } else { position_ = eol_; } } else { // error position_ = eol_; mpsType_ = COIN_UNKNOWN_MPS_TYPE; value_ = -1.0e100; } } } } else { // blank continue; } return section_; } else if ( card_[0] != '*' ) { // not a comment int i; handler_->message(COIN_MPS_LINE,messages_)< (i); return section_; } else { // comment } } // we only get here for second field (we could even allow more???) { char save = '?'; char *nextBlank = nextBlankOr ( next ); if ( !freeFormat_ && eightChar_ && next == card_ + 39 ) { if ( eol_ - next >= 8 ) { if ( *( next + 8 ) != ' ' && *( next + 8 ) != '\0' ) { eightChar_ = false; } else { nextBlank = next + 8; } save = *nextBlank; *nextBlank = '\0'; } else { nextBlank = NULL; } } else { if ( nextBlank ) { save = *nextBlank; *nextBlank = '\0'; } } strcpyAndCompress ( rowName_, next ); // on to next if ( nextBlank ) { *nextBlank = save; next = nextBlank; } else { next = eol_; } while ( next != eol_ ) { if ( *next == ' ' || *next == '\t' ) { next++; } else { break; } } if ( next == eol_ && section_ != COIN_SOS_SECTION) { // error position_ = eol_; mpsType_ = COIN_UNKNOWN_MPS_TYPE; } else { nextBlank = nextBlankOr ( next ); } if ( nextBlank ) { save = *nextBlank; *nextBlank = '\0'; } //value_ = -1.0e100; char * after; value_ = osi_strtod(next,&after,ieeeFormat_); // see if error if (after>next) { if ( nextBlank ) { *nextBlank = save; position_ = nextBlank; } else { position_ = eol_; } } else { // error position_ = eol_; if (mpsType_!=COIN_S1_BOUND&&mpsType_!=COIN_S2_BOUND) mpsType_ = COIN_UNKNOWN_MPS_TYPE; value_ = -1.0e100; } } return section_; } static char * nextNonBlank ( char *image ) { while ( 1 ) { if ( *image != ' ' && *image != '\t' ) break; else image++; } if ( *image == '\0' ) image=NULL; return image; } /** Gets next field for .gms file and returns type. -1 - EOF 0 - what we expected (and processed so pointer moves past) 1 - not what we expected 2 - equation type when expecting value name pair leading blanks always ignored input types 0 - anything - stops on non blank card 1 - name (in columnname) 2 - value 3 - value name pair 4 - equation type 5 - ; */ int CoinMpsCardReader::nextGmsField ( int expectedType ) { int returnCode=-1; bool good=false; switch(expectedType) { case 0: // 0 - May get * in first column or anything if ( cleanCard()) return -1; while(!strlen(card_)) { if ( cleanCard()) return -1; } eol_ = card_+strlen(card_); position_=card_; returnCode=0; break; case 1: // 1 - expect name while (!good) { position_ = nextNonBlank(position_); if (position_==NULL) { if ( cleanCard()) return -1; eol_ = card_+strlen(card_); position_=card_; } else { good=true; char nextChar =*position_; if ((nextChar>='a'&&nextChar<='z')|| (nextChar>='A'&&nextChar<='Z')) { returnCode=0; char * next=position_; while (*next!=','&&*next!=';'&&*next!='='&&*next!=' ' &&*next!='\t'&&*next!='-'&&*next!='+'&&*next>=32) next++; if (next) { int length = static_cast(next-position_); strncpy(columnName_,position_,length); columnName_[length]='\0'; } else { strcpy(columnName_,position_); next=eol_; } position_=next; } else { returnCode=1; } } } break; case 2: // 2 - expect value while (!good) { position_ = nextNonBlank(position_); if (position_==NULL) { if ( cleanCard()) return -1; eol_ = card_+strlen(card_); position_=card_; } else { good=true; char nextChar =*position_; if ((nextChar>='0'&&nextChar<='9')||nextChar=='+'||nextChar=='-') { returnCode=0; char * next=position_; while (*next!=','&&*next!=';'&&*next!='='&&*next!=' ' &&*next!='\t'&&*next>=32) next++; if (next) { int length = static_cast(next-position_); strncpy(rowName_,position_,length); rowName_[length]='\0'; } else { strcpy(rowName_,position_); next=eol_; } value_=-1.0e100; sscanf(rowName_,"%lg",&value_); position_=next; } else { returnCode=1; } } } break; case 3: // 3 - expect value name pair while (!good) { position_ = nextNonBlank(position_); char * savePosition = position_; if (position_==NULL) { if ( cleanCard()) return -1; eol_ = card_+strlen(card_); position_=card_; savePosition = position_; } else { good=true; value_=1.0; char nextChar =*position_; returnCode=0; if ((nextChar>='0'&&nextChar<='9')||nextChar=='+'||nextChar=='-') { char * next; int put=0; if (nextChar=='+'||nextChar=='-') { rowName_[0]=nextChar; put=1; next=position_+1; while (*next==' '||*next=='\t') next++; if ((*next>='a'&&*next<='z')|| (*next>='A'&&*next<='Z')) { // name - set value if (nextChar=='+') value_=1.0; else value_=-1.0; position_=next; } else if ((*next>='0'&&*next<='9')||*next=='+'||*next=='-') { rowName_[put++]=*next; next++; while (*next!=' '&&*next!='\t'&&*next!='*') { rowName_[put++]=*next; next++; } assert (*next=='*'); next ++; rowName_[put]='\0'; value_=-1.0e100; sscanf(rowName_,"%lg",&value_); position_=next; } else { returnCode=1; } } else { // number char * next = nextBlankOr(position_); // but could be * char * next2 = strchr(position_,'*'); if (next2&&next2-position_(next-position_); strncpy(rowName_,position_,length); rowName_[length]='\0'; value_=-1.0e100; sscanf(rowName_,"%lg",&value_); position_=next; } } else if ((nextChar>='a'&&nextChar<='z')|| (nextChar>='A'&&nextChar<='Z')) { // name so take value as 1.0 } else if (nextChar=='=') { returnCode=2; position_=savePosition; } else { returnCode=1; position_=savePosition; } if ((*position_)=='*') position_++; position_= nextNonBlank(position_); if (!returnCode) { char nextChar =*position_; if ((nextChar>='a'&&nextChar<='z')|| (nextChar>='A'&&nextChar<='Z')) { char * next = nextBlankOr(position_); if (next) { int length = static_cast(next-position_); strncpy(columnName_,position_,length); columnName_[length]='\0'; } else { strcpy(columnName_,position_); next=eol_; } position_=next; } else { returnCode=1; position_=savePosition; } } } } break; case 4: // 4 - expect equation type while (!good) { position_ = nextNonBlank(position_); if (position_==NULL) { if ( cleanCard()) return -1; eol_ = card_+strlen(card_); position_=card_; } else { good=true; char nextChar =*position_; if (nextChar=='=') { returnCode=0; char * next = nextBlankOr(position_); int length = static_cast(next-position_); strncpy(rowName_,position_,length); rowName_[length]='\0'; position_=next; } else { returnCode=1; } } } break; case 5: // 5 - ; expected while (!good) { position_ = nextNonBlank(position_); if (position_==NULL) { if ( cleanCard()) return -1; eol_ = card_+strlen(card_); position_=card_; } else { good=true; char nextChar =*position_; if (nextChar==';') { returnCode=0; char * next = nextBlankOr(position_); if (!next) next=eol_; position_=next; } else { returnCode=1; } } } break; } return returnCode; } //############################################################################# namespace { const int mmult[] = { 262139, 259459, 256889, 254291, 251701, 249133, 246709, 244247, 241667, 239179, 236609, 233983, 231289, 228859, 226357, 223829, 221281, 218849, 216319, 213721, 211093, 208673, 206263, 203773, 201233, 198637, 196159, 193603, 191161, 188701, 186149, 183761, 181303, 178873, 176389, 173897, 171469, 169049, 166471, 163871, 161387, 158941, 156437, 153949, 151531, 149159, 146749, 144299, 141709, 139369, 136889, 134591, 132169, 129641, 127343, 124853, 122477, 120163, 117757, 115361, 112979, 110567, 108179, 105727, 103387, 101021, 98639, 96179, 93911, 91583, 89317, 86939, 84521, 82183, 79939, 77587, 75307, 72959, 70793, 68447, 66103 }; int hash ( const char *name, int maxsiz, int length ) { int n = 0; int j; for ( j = 0; j < length; ++j ) { int iname = name[j]; n += mmult[j] * iname; } return ( abs ( n ) % maxsiz ); /* integer abs */ } } // end file-local namespace // Define below if you are reading a Cnnnnnn file // Will not do row names (for electricfence) //#define NONAMES #ifndef NONAMES // startHash. Creates hash list for names void CoinMpsIO::startHash ( char **names, const COINColumnIndex number , int section ) { names_[section] = names; numberHash_[section] = number; startHash(section); } void CoinMpsIO::startHash ( int section ) const { char ** names = names_[section]; COINColumnIndex number = numberHash_[section]; COINColumnIndex i; COINColumnIndex maxhash = 4 * number; COINColumnIndex ipos, iput; //hash_=(CoinHashLink *) malloc(maxhash*sizeof(CoinHashLink)); hash_[section] = new CoinHashLink[maxhash]; CoinHashLink * hashThis = hash_[section]; for ( i = 0; i < maxhash; i++ ) { hashThis[i].index = -1; hashThis[i].next = -1; } /* * Initialize the hash table. Only the index of the first name that * hashes to a value is entered in the table; subsequent names that * collide with it are not entered. */ for ( i = 0; i < number; ++i ) { char *thisName = names[i]; int length = static_cast(strlen(thisName)); ipos = hash ( thisName, maxhash, length ); if ( hashThis[ipos].index == -1 ) { hashThis[ipos].index = i; } } /* * Now take care of the names that collided in the preceding loop, * by finding some other entry in the table for them. * Since there are as many entries in the table as there are names, * there must be room for them. */ iput = -1; for ( i = 0; i < number; ++i ) { char *thisName = names[i]; int length = static_cast(strlen(thisName)); ipos = hash ( thisName, maxhash, length ); while ( 1 ) { COINColumnIndex j1 = hashThis[ipos].index; if ( j1 == i ) break; else { char *thisName2 = names[j1]; if ( strcmp ( thisName, thisName2 ) == 0 ) { printf ( "** duplicate name %s\n", names[i] ); break; } else { COINColumnIndex k = hashThis[ipos].next; if ( k == -1 ) { while ( 1 ) { ++iput; if ( iput > number ) { printf ( "** too many names\n" ); break; } if ( hashThis[iput].index == -1 ) { break; } } hashThis[ipos].next = iput; hashThis[iput].index = i; break; } else { ipos = k; /* nothing worked - try it again */ } } } } } } // stopHash. Deletes hash storage void CoinMpsIO::stopHash ( int section ) { delete [] hash_[section]; hash_[section] = NULL; } // findHash. -1 not found COINColumnIndex CoinMpsIO::findHash ( const char *name , int section ) const { COINColumnIndex found = -1; char ** names = names_[section]; CoinHashLink * hashThis = hash_[section]; COINColumnIndex maxhash = 4 * numberHash_[section]; COINColumnIndex ipos; /* default if we don't find anything */ if ( !maxhash ) return -1; int length = static_cast(strlen(name)); ipos = hash ( name, maxhash, length ); while ( 1 ) { COINColumnIndex j1 = hashThis[ipos].index; if ( j1 >= 0 ) { char *thisName2 = names[j1]; if ( strcmp ( name, thisName2 ) != 0 ) { COINColumnIndex k = hashThis[ipos].next; if ( k != -1 ) ipos = k; else break; } else { found = j1; break; } } else { found = -1; break; } } return found; } #else // Version when we know images are C/Rnnnnnn // startHash. Creates hash list for names void CoinMpsIO::startHash ( char **names, const COINColumnIndex number , int section ) { numberHash_[section] = number; names_[section] = names; } void CoinMpsIO::startHash ( int section ) const { } // stopHash. Deletes hash storage void CoinMpsIO::stopHash ( int section ) { } // findHash. -1 not found COINColumnIndex CoinMpsIO::findHash ( const char *name , int section ) const { COINColumnIndex found = atoi(name+1); if (!strcmp(name,"OBJROW")) found = numberHash_[section]-1; return found; } #endif //------------------------------------------------------------------ // Get value for infinity //------------------------------------------------------------------ double CoinMpsIO::getInfinity() const { return infinity_; } //------------------------------------------------------------------ // Set value for infinity //------------------------------------------------------------------ void CoinMpsIO::setInfinity(double value) { if ( value >= 1.020 ) { infinity_ = value; } else { handler_->message(COIN_MPS_ILLEGAL,messages_)<<"infinity" <message(COIN_MPS_FILE,messages_)<<"NULL" <(strlen(filename))-1; strcpy(newName,filename); bool foundDot=false; for (;i>=0;i--) { char character = filename[i]; if (character=='/'||character=='\\') { break; } else if (character=='.') { foundDot=true; break; } } if (!foundDot) { strcat(newName,"."); strcat(newName,extension); } } else { // no extension strcpy(newName,filename); } } else { strcpy(newName,"stdin"); } // See if new name if (fileName_&&!strcmp(newName,fileName_)) { // old name return 0; } else { // new file free(fileName_); fileName_=CoinStrdup(newName); if (strcmp(fileName_,"stdin")) { // be clever with extensions here std::string fname = fileName_; bool readable = fileCoinReadable(fname); if (!readable) goodFile = -1; else { input = CoinFileInput::create (fname); goodFile = 1; } } else { // only plain file at present input = CoinFileInput::create ("stdin"); goodFile = 1; } } } else { // same as before // reset section ? goodFile=0; } if (goodFile<0) handler_->message(COIN_MPS_FILE,messages_)<= 1 && value <=MAX_INTEGER ) { defaultBound_ = value; } else { handler_->message(COIN_MPS_ILLEGAL,messages_)<<"default integer bound" <0) { delete cardReader_; cardReader_ = new CoinMpsCardReader ( input, this); } if (!extension||(strcmp(extension,"gms")&&!strstr(filename,".gms"))) { return readMps(); } else { int numberSets=0; CoinSet ** sets=NULL; int returnCode = readGms(numberSets,sets); for (int i=0;i0) { delete cardReader_; cardReader_ = new CoinMpsCardReader ( input, this); } return readMps(numberSets,sets); } int CoinMpsIO::readMps() { int numberSets=0; CoinSet ** sets=NULL; int returnCode = readMps(numberSets,sets); for (int i=0;ireadToNextSection(); if ( cardReader_->whichSection ( ) == COIN_NAME_SECTION ) { ifmps = true; // save name of section free(problemName_); problemName_=CoinStrdup(cardReader_->columnName()); } else if ( cardReader_->whichSection ( ) == COIN_UNKNOWN_SECTION ) { handler_->message(COIN_MPS_BADFILE1,messages_)<card() <<1 <fileInput()->getReadType()!="plain") handler_->message(COIN_MPS_BADFILE2,messages_) <fileInput()->getReadType() <whichSection ( ) != COIN_EOF_SECTION ) { // save name of section free(problemName_); problemName_=CoinStrdup(cardReader_->card()); ifmps = false; } else { handler_->message(COIN_MPS_EOF,messages_)<setStringsAllowed(); //get ROWS cardReader_->nextField ( ) ; // Fudge for what ever code has OBJSENSE if (!strncmp(cardReader_->card(),"OBJSENSE",8)) { cardReader_->nextField(); int i; const char * thisCard = cardReader_->card(); int direction = 0; for (i=0;i<20;i++) { if (thisCard[i]!=' ') { if (!strncmp(thisCard+i,"MAX",3)) direction=-1; else if (!strncmp(thisCard+i,"MIN",3)) direction=1; break; } } if (!direction) printf("No MAX/MIN found after OBJSENSE\n"); else printf("%s found after OBJSENSE - Coin ignores\n", (direction>0 ? "MIN" : "MAX")); cardReader_->nextField(); } if ( cardReader_->whichSection ( ) != COIN_ROW_SECTION ) { handler_->message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() <message(COIN_MPS_RETURNING,messages_)< (malloc ( maxRows * sizeof ( COINMpsType ))); char **rowName = reinterpret_cast (malloc ( maxRows * sizeof ( char * ))); // for discarded free rows COINRowIndex maxFreeRows = 100; COINRowIndex numberOtherFreeRows = 0; char **freeRowName = reinterpret_cast (malloc ( maxFreeRows * sizeof ( char * ))); while ( cardReader_->nextField ( ) == COIN_ROW_SECTION ) { switch ( cardReader_->mpsType ( ) ) { case COIN_N_ROW: if ( !gotNrow ) { gotNrow = true; // save name of section free(objectiveName_); objectiveName_=CoinStrdup(cardReader_->columnName()); } else { // add to discard list if ( numberOtherFreeRows == maxFreeRows ) { maxFreeRows = ( 3 * maxFreeRows ) / 2 + 100; freeRowName = reinterpret_cast (realloc ( freeRowName, maxFreeRows * sizeof ( char * ))); } freeRowName[numberOtherFreeRows] = CoinStrdup ( cardReader_->columnName ( ) ); numberOtherFreeRows++; } break; case COIN_E_ROW: case COIN_L_ROW: case COIN_G_ROW: if ( numberRows_ == maxRows ) { maxRows = ( 3 * maxRows ) / 2 + 1000; rowType = reinterpret_cast (realloc ( rowType, maxRows * sizeof ( COINMpsType ))); rowName = reinterpret_cast (realloc ( rowName, maxRows * sizeof ( char * ))); } rowType[numberRows_] = cardReader_->mpsType ( ); #ifndef NONAMES rowName[numberRows_] = CoinStrdup ( cardReader_->columnName ( ) ); #endif numberRows_++; break; default: numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<whichSection ( ) != COIN_COLUMN_SECTION ) { handler_->message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() <message(COIN_MPS_RETURNING,messages_)< (realloc ( rowType, numberRows_ * sizeof ( COINMpsType ))); else rowType = reinterpret_cast (realloc ( rowType,sizeof ( COINMpsType ))); // put objective and other free rows at end rowName = reinterpret_cast (realloc ( rowName, ( numberRows_ + 1 + numberOtherFreeRows ) * sizeof ( char * ))); #ifndef NONAMES rowName[numberRows_] = CoinStrdup(objectiveName_); memcpy ( rowName + numberRows_ + 1, freeRowName, numberOtherFreeRows * sizeof ( char * ) ); // now we can get rid of this array free(freeRowName); #else memset(rowName,0,(numberRows_+1)*sizeof(char **)); #endif startHash ( rowName, numberRows_ + 1 + numberOtherFreeRows , 0 ); COINColumnIndex maxColumns = 1000 + numberRows_ / 5; CoinBigIndex maxElements = 5000 + numberRows_ / 2; COINMpsType *columnType = reinterpret_cast (malloc ( maxColumns * sizeof ( COINMpsType ))); char **columnName = reinterpret_cast (malloc ( maxColumns * sizeof ( char * ))); objective_ = reinterpret_cast (malloc ( maxColumns * sizeof ( double ))); start = reinterpret_cast (malloc ( ( maxColumns + 1 ) * sizeof ( CoinBigIndex ))); row = reinterpret_cast (malloc ( maxElements * sizeof ( COINRowIndex ))); element = reinterpret_cast (malloc ( maxElements * sizeof ( double ))); // for duplicates CoinBigIndex *rowUsed = new CoinBigIndex[numberRows_]; for (i=0;inextField ( ) == COIN_COLUMN_SECTION ) { switch ( cardReader_->mpsType ( ) ) { case COIN_BLANK_COLUMN: if ( strcmp ( lastColumn, cardReader_->columnName ( ) ) ) { // new column // reset old column and take out tiny if ( numberColumns_ ) { objUsed = false; CoinBigIndex i; CoinBigIndex k = start[column]; for ( i = k; i < numberElements_; i++ ) { COINRowIndex irow = row[i]; #if 0 if ( fabs ( element[i] ) > smallElement_ ) { element[k++] = element[i]; } #endif rowUsed[irow] = -1; } //numberElements_ = k; } column = numberColumns_; if ( numberColumns_ == maxColumns ) { maxColumns = ( 3 * maxColumns ) / 2 + 1000; columnType = reinterpret_cast (realloc ( columnType, maxColumns * sizeof ( COINMpsType ))); columnName = reinterpret_cast (realloc ( columnName, maxColumns * sizeof ( char * ))); objective_ = reinterpret_cast (realloc ( objective_, maxColumns * sizeof ( double ))); start = reinterpret_cast (realloc ( start, ( maxColumns + 1 ) * sizeof ( CoinBigIndex ))); } if ( !inIntegerSet ) { columnType[column] = COIN_UNSET_BOUND; } else { columnType[column] = COIN_INTORG; numberIntegers++; } #ifndef NONAMES columnName[column] = CoinStrdup ( cardReader_->columnName ( ) ); #else columnName[column]=NULL; #endif strcpy ( lastColumn, cardReader_->columnName ( ) ); objective_[column] = 0.0; start[column] = numberElements_; numberColumns_++; } if ( fabs ( cardReader_->value ( ) ) > smallElement_ ) { if ( numberElements_ == maxElements ) { maxElements = ( 3 * maxElements ) / 2 + 1000; row = reinterpret_cast (realloc ( row, maxElements * sizeof ( COINRowIndex ))); element = reinterpret_cast (realloc ( element, maxElements * sizeof ( double ))); } // get row number COINRowIndex irow = findHash ( cardReader_->rowName ( ) , 0 ); if ( irow >= 0 ) { double value = cardReader_->value ( ); // check for duplicates if ( irow == numberRows_ ) { // objective if ( objUsed ) { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_DUPOBJ,messages_) <cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_) <= 0 ) { element[rowUsed[irow]] += value; numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_DUPROW,messages_) <rowName()<cardNumber() <card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_) <message(COIN_MPS_NOMATCHROW,messages_) <rowName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<value () == STRING_VALUE ) { // tiny element - string const char * s = cardReader_->valueString(); assert (*s=='='); // get row number COINRowIndex irow = findHash ( cardReader_->rowName ( ) , 0 ); if ( irow >= 0 ) { addString(irow,column,s+1); } else { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_NOMATCHROW,messages_) <rowName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<whichSection ( ) != COIN_RHS_SECTION ) { handler_->message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() <message(COIN_MPS_RETURNING,messages_)< (realloc ( columnType, numberColumns_ * sizeof ( COINMpsType ))); columnName = reinterpret_cast (realloc ( columnName, numberColumns_ * sizeof ( char * ))); objective_ = reinterpret_cast (realloc ( objective_, numberColumns_ * sizeof ( double ))); } else { columnType = reinterpret_cast (realloc ( columnType, sizeof ( COINMpsType ))); columnName = reinterpret_cast (realloc ( columnName, sizeof ( char * ))); objective_ = reinterpret_cast (realloc ( objective_, sizeof ( double ))); } start = reinterpret_cast (realloc ( start, ( numberColumns_ + 1 ) * sizeof ( CoinBigIndex ))); if (numberElements_) { row = reinterpret_cast (realloc ( row, numberElements_ * sizeof ( COINRowIndex ))); element = reinterpret_cast (realloc ( element, numberElements_ * sizeof ( double ))); } else { row = reinterpret_cast (realloc ( row, sizeof ( COINRowIndex ))); element = reinterpret_cast (realloc ( element, sizeof ( double ))); } if (numberRows_) { rowlower_ = reinterpret_cast (malloc ( numberRows_ * sizeof ( double ))); rowupper_ = reinterpret_cast (malloc ( numberRows_ * sizeof ( double ))); } else { rowlower_ = reinterpret_cast (malloc ( sizeof ( double ))); rowupper_ = reinterpret_cast (malloc ( sizeof ( double ))); } for (i=0;inextField ( ) == COIN_RHS_SECTION ) { COINRowIndex irow; switch ( cardReader_->mpsType ( ) ) { case COIN_BLANK_COLUMN: if ( strcmp ( lastColumn, cardReader_->columnName ( ) ) ) { // skip rest if got a rhs if ( gotRhs ) { while ( cardReader_->nextField ( ) == COIN_RHS_SECTION ) { } break; } else { gotRhs = true; strcpy ( lastColumn, cardReader_->columnName ( ) ); // save name of section free(rhsName_); rhsName_=CoinStrdup(cardReader_->columnName()); } } // get row number irow = findHash ( cardReader_->rowName ( ) , 0 ); if ( irow >= 0 ) { double value = cardReader_->value ( ); // check for duplicates if ( irow == numberRows_ ) { // objective if ( objUsed ) { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_DUPOBJ,messages_) <cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<valueString(); assert (*s=='='); addString(irow,numberColumns_,s+1); } objectiveOffset_ += value; } else if ( irow < numberRows_ ) { if ( rowlower_[irow] != -infinity_ ) { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_DUPROW,messages_) <rowName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<valueString(); assert (*s=='='); addString(irow,numberColumns_,s+1); } rowlower_[irow] = value; } } } else { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_NOMATCHROW,messages_) <rowName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<whichSection ( ) == COIN_RANGES_SECTION ) { memset ( lastColumn, '\0', 200 ); bool gotRange = false; COINRowIndex irow; // need coding for blank range while ( cardReader_->nextField ( ) == COIN_RANGES_SECTION ) { switch ( cardReader_->mpsType ( ) ) { case COIN_BLANK_COLUMN: if ( strcmp ( lastColumn, cardReader_->columnName ( ) ) ) { // skip rest if got a range if ( gotRange ) { while ( cardReader_->nextField ( ) == COIN_RANGES_SECTION ) { } break; } else { gotRange = true; strcpy ( lastColumn, cardReader_->columnName ( ) ); // save name of section free(rangeName_); rangeName_=CoinStrdup(cardReader_->columnName()); } } // get row number irow = findHash ( cardReader_->rowName ( ) , 0 ); if ( irow >= 0 ) { double value = cardReader_->value ( ); // check for duplicates if ( irow == numberRows_ ) { // objective numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_DUPOBJ,messages_) <cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<message(COIN_MPS_DUPROW,messages_) <rowName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_) <message(COIN_MPS_NOMATCHROW,messages_) <rowName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)< 0.0 ) { up += lo; } else { up = lo; lo += up2; } break; case COIN_L_ROW: if ( lo == -infinity_ ) { up = 0.0; } else { up = lo; lo = -infinity_; } if ( up2 != infinity_ ) { lo = up - fabs ( up2 ); } break; case COIN_G_ROW: if ( lo == -infinity_ ) { lo = 0.0; up = infinity_; } else { up = infinity_; } if ( up2 != infinity_ ) { up = lo + fabs ( up2 ); } break; default: abort(); } rowlower_[irow] = lo; rowupper_[irow] = up; } } free ( rowType ); // default bounds if (numberColumns_) { collower_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); colupper_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); } else { collower_ = reinterpret_cast (malloc ( sizeof ( double ))); colupper_ = reinterpret_cast (malloc ( sizeof ( double ))); } for (i=0;i (malloc (numberColumns_*sizeof(char))); else integerType_ = reinterpret_cast (malloc (sizeof(char))); for ( column = 0; column < numberColumns_; column++ ) { if ( columnType[column] == COIN_INTORG ) { columnType[column] = COIN_UNSET_BOUND; integerType_[column] = 1; } else { integerType_[column] = 0; } } // start hash even if no bound section - to make sure names survive startHash ( columnName, numberColumns_ , 1 ); if ( cardReader_->whichSection ( ) == COIN_BOUNDS_SECTION ) { memset ( lastColumn, '\0', 200 ); bool gotBound = false; while ( cardReader_->nextField ( ) == COIN_BOUNDS_SECTION ) { if ( strcmp ( lastColumn, cardReader_->columnName ( ) ) ) { // skip rest if got a bound if ( gotBound ) { while ( cardReader_->nextField ( ) == COIN_BOUNDS_SECTION ) { } break; } else { gotBound = true;; strcpy ( lastColumn, cardReader_->columnName ( ) ); // save name of section free(boundName_); boundName_=CoinStrdup(cardReader_->columnName()); } } // get column number COINColumnIndex icolumn = findHash ( cardReader_->rowName ( ) , 1 ); if ( icolumn >= 0 ) { double value = cardReader_->value ( ); bool ifError = false; switch ( cardReader_->mpsType ( ) ) { case COIN_UP_BOUND: if ( value == -1.0e100 ) ifError = true; if (value==STRING_VALUE) { value=1.0e10; // tiny element - string const char * s = cardReader_->valueString(); assert (*s=='='); addString(numberRows_+2,icolumn,s+1); } if ( columnType[icolumn] == COIN_UNSET_BOUND ) { if ( value < 0.0 ) { collower_[icolumn] = -infinity_; } } else if ( columnType[icolumn] == COIN_LO_BOUND || columnType[icolumn] == COIN_LI_BOUND) { if ( value < collower_[icolumn] ) { ifError = true; } else if ( value < collower_[icolumn] + smallElement_ ) { value = collower_[icolumn]; } } else if ( columnType[icolumn] == COIN_MI_BOUND ) { } else { ifError = true; } if (value>1.0e25) value=infinity_; colupper_[icolumn] = value; if ( columnType[icolumn] == COIN_UNSET_BOUND ) { columnType[icolumn] = COIN_UP_BOUND; } else { columnType[icolumn] = COIN_BOTH_BOUNDS_SET; } break; case COIN_LO_BOUND: if ( value == -1.0e100 ) ifError = true; if (value==STRING_VALUE) { value=-1.0e10; // tiny element - string const char * s = cardReader_->valueString(); assert (*s=='='); addString(numberRows_+1,icolumn,s+1); } if ( columnType[icolumn] == COIN_UNSET_BOUND ) { } else if ( columnType[icolumn] == COIN_UP_BOUND || columnType[icolumn] == COIN_UI_BOUND ) { if ( value > colupper_[icolumn] ) { ifError = true; } else if ( value > colupper_[icolumn] - smallElement_ ) { value = colupper_[icolumn]; } } else if ( columnType[icolumn] == COIN_PL_BOUND ) { } else { ifError = true; } if (value<-1.0e25) value=-infinity_; collower_[icolumn] = value; if ( columnType[icolumn] == COIN_UNSET_BOUND ) { columnType[icolumn] = COIN_LO_BOUND; } else { columnType[icolumn] = COIN_BOTH_BOUNDS_SET; } break; case COIN_FX_BOUND: if ( value == -1.0e100 ) ifError = true; if (value==STRING_VALUE) { value=0.0; // tiny element - string const char * s = cardReader_->valueString(); assert (*s=='='); addString(numberRows_+1,icolumn,s+1); addString(numberRows_+2,icolumn,s+1); } if ( columnType[icolumn] == COIN_UNSET_BOUND ) { } else if (columnType[icolumn] == COIN_FX_BOUND ) { ifError=true; } else if (integerType_[icolumn] ) { // Allow so people can easily put FX's at end double value2 = floor(value); if (fabs(value2-value)>1.0e-12|| value2colupper_[icolumn]) { ifError=true; } else { // take off integer list numberIntegers--; integerType_[icolumn] = 0; } } else { ifError = true; } collower_[icolumn] = value; colupper_[icolumn] = value; columnType[icolumn] = COIN_FX_BOUND; break; case COIN_FR_BOUND: if ( columnType[icolumn] == COIN_UNSET_BOUND ) { } else { ifError = true; } collower_[icolumn] = -infinity_; colupper_[icolumn] = infinity_; columnType[icolumn] = COIN_FR_BOUND; break; case COIN_MI_BOUND: if ( columnType[icolumn] == COIN_UNSET_BOUND ) { colupper_[icolumn] = COIN_DBL_MAX; } else if ( columnType[icolumn] == COIN_UP_BOUND || columnType[icolumn] == COIN_UI_BOUND ) { } else { ifError = true; } collower_[icolumn] = -infinity_; if ( columnType[icolumn] == COIN_UNSET_BOUND ) { columnType[icolumn] = COIN_MI_BOUND; } else { columnType[icolumn] = COIN_BOTH_BOUNDS_SET; } break; case COIN_PL_BOUND: // change to allow if no upper bound set //if ( columnType[icolumn] == COIN_UNSET_BOUND ) { if (colupper_[icolumn]==infinity_) { } else { ifError = true; } if ( columnType[icolumn] == COIN_UNSET_BOUND ) { columnType[icolumn] = COIN_PL_BOUND; } else { columnType[icolumn] = COIN_BOTH_BOUNDS_SET; } break; case COIN_UI_BOUND: if (value==STRING_VALUE) { value=1.0e20; // tiny element - string const char * s = cardReader_->valueString(); assert (*s=='='); addString(numberRows_+2,icolumn,s+1); } #if 0 if ( value == -1.0e100 ) ifError = true; if ( columnType[icolumn] == COIN_UNSET_BOUND ) { } else if ( columnType[icolumn] == COIN_LO_BOUND || columnType[icolumn] == COIN_LI_BOUND) { if ( value < collower_[icolumn] ) { ifError = true; } else if ( value < collower_[icolumn] + smallElement_ ) { value = collower_[icolumn]; } } else if ( columnType[icolumn] == COIN_MI_BOUND ) { } else { ifError = true; } #else if ( value == -1.0e100 ) { value = infinity_; if (columnType[icolumn] != COIN_UNSET_BOUND && columnType[icolumn] != COIN_LO_BOUND && columnType[icolumn] != COIN_LI_BOUND && columnType[icolumn] != COIN_MI_BOUND) { ifError = true; } } else { if ( columnType[icolumn] == COIN_UNSET_BOUND ) { } else if ( columnType[icolumn] == COIN_LO_BOUND || columnType[icolumn] == COIN_LI_BOUND || columnType[icolumn] == COIN_MI_BOUND ) { if ( value < collower_[icolumn] ) { ifError = true; } else if ( value < collower_[icolumn] + smallElement_ ) { value = collower_[icolumn]; } } else { ifError = true; } } #endif if (value>1.0e25) value=infinity_; colupper_[icolumn] = value; if ( columnType[icolumn] == COIN_UNSET_BOUND ) { columnType[icolumn] = COIN_UI_BOUND; } else { columnType[icolumn] = COIN_BOTH_BOUNDS_SET; } if ( !integerType_[icolumn] ) { numberIntegers++; integerType_[icolumn] = 1; } break; case COIN_LI_BOUND: if ( value == -1.0e100 ) ifError = true; if (value==STRING_VALUE) { value=-1.0e20; // tiny element - string const char * s = cardReader_->valueString(); assert (*s=='='); addString(numberRows_+1,icolumn,s+1); } if ( columnType[icolumn] == COIN_UNSET_BOUND ) { } else if ( columnType[icolumn] == COIN_UP_BOUND || columnType[icolumn] == COIN_UI_BOUND ) { if ( value > colupper_[icolumn] ) { ifError = true; } else if ( value > colupper_[icolumn] - smallElement_ ) { value = colupper_[icolumn]; } } else if ( columnType[icolumn] == COIN_PL_BOUND ) { } else { ifError = true; } if (value<-1.0e25) value=-infinity_; collower_[icolumn] = value; if ( columnType[icolumn] == COIN_UNSET_BOUND ) { columnType[icolumn] = COIN_LI_BOUND; } else { columnType[icolumn] = COIN_BOTH_BOUNDS_SET; } if ( !integerType_[icolumn] ) { numberIntegers++; integerType_[icolumn] = 1; } break; case COIN_BV_BOUND: if ( columnType[icolumn] == COIN_UNSET_BOUND ) { } else { ifError = true; } collower_[icolumn] = 0.0; colupper_[icolumn] = 1.0; columnType[icolumn] = COIN_BV_BOUND; if ( !integerType_[icolumn] ) { numberIntegers++; integerType_[icolumn] = 1; } break; default: ifError = true; break; } if ( ifError ) { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_BADIMAGE,messages_) <cardNumber() <card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<message(COIN_MPS_NOMATCHCOL,messages_) <rowName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<whichSection ( ) == COIN_SOS_SECTION ) { // Go to free format cardReader_->setFreeFormat(true); int numberInSet=0; int iType=-1; int * which = new int[numberColumns_]; double * weights = new double[numberColumns_]; CoinSet ** setsA = new CoinSet * [numberColumns_]; while ( cardReader_->nextField ( ) == COIN_SOS_SECTION ) { if (cardReader_->mpsType()==COIN_S1_BOUND|| cardReader_->mpsType()==COIN_S2_BOUND) { if (numberInSet) { CoinSosSet * newSet = new CoinSosSet(numberInSet,which,weights,iType); setsA[numberSets++]=newSet; } numberInSet=0; iType = cardReader_->mpsType()== COIN_S1_BOUND ? 1 : 2; // skip continue; } // get column number COINColumnIndex icolumn = findHash ( cardReader_->columnName ( ) , 1 ); if ( icolumn >= 0 ) { //integerType_[icolumn]=2; double value = cardReader_->value ( ); if (value==-1.0e100) value = atof(cardReader_->rowName()); // try from row name which[numberInSet]=icolumn; weights[numberInSet++]=value; } else { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_NOMATCHCOL,messages_) <columnName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)< MAX_INTEGER ) colupper_[icolumn] = MAX_INTEGER; // clean up to allow for bad reads on 1.0e2 etc if (colupper_[icolumn]<1.0e10) { double value = colupper_[icolumn]; double value2 = floor(value+0.5); if (value!=value2) { if (fabs(value-value2)<1.0e-5) colupper_[icolumn]=value2; } } if (collower_[icolumn]>-1.0e10) { double value = collower_[icolumn]; double value2 = floor(value+0.5); if (value!=value2) { if (fabs(value-value2)<1.0e-5) collower_[icolumn]=value2; } } } } } free ( columnType ); if ( cardReader_->whichSection ( ) != COIN_ENDATA_SECTION && cardReader_->whichSection ( ) != COIN_QUAD_SECTION && cardReader_->whichSection ( ) != COIN_CONIC_SECTION ) { handler_->message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() <message(COIN_MPS_RETURNING,messages_)<filePointer(); fscanf ( fp, "%d %d %d\n", &numberRows_, &numberColumns_, &i); */ // new: char buffer[1000]; cardReader_->fileInput ()->gets (buffer, 1000); sscanf (buffer, "%d %d %d\n", &numberRows_, &numberColumns_, &i); numberElements_ = i; // done this way in case numberElements_ long rowlower_ = reinterpret_cast (malloc ( numberRows_ * sizeof ( double ))); rowupper_ = reinterpret_cast (malloc ( numberRows_ * sizeof ( double ))); for ( i = 0; i < numberRows_; i++ ) { int j; // old: fscanf ( fp, "%d %lg %lg\n", &j, &rowlower_[i], &rowupper_[i] ); // new: cardReader_->fileInput ()->gets (buffer, 1000); sscanf (buffer, "%d %lg %lg\n", &j, &rowlower_[i], &rowupper_[i] ); assert ( i == j ); } collower_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); colupper_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); objective_= reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); start = reinterpret_cast (malloc ((numberColumns_ + 1) * sizeof (CoinBigIndex))); row = reinterpret_cast (malloc (numberElements_ * sizeof (COINRowIndex))); element = reinterpret_cast (malloc (numberElements_ * sizeof (double))); start[0] = 0; numberElements_ = 0; for ( i = 0; i < numberColumns_; i++ ) { int j; int n; /* old: fscanf ( fp, "%d %d %lg %lg %lg\n", &j, &n, &collower_[i], &colupper_[i], &objective_[i] ); */ // new: cardReader_->fileInput ()->gets (buffer, 1000); sscanf (buffer, "%d %d %lg %lg %lg\n", &j, &n, &collower_[i], &colupper_[i], &objective_[i] ); assert ( i == j ); for ( j = 0; j < n; j++ ) { /* old: fscanf ( fp, " %d %lg\n", &row[numberElements_], &element[numberElements_] ); */ // new: cardReader_->fileInput ()->gets (buffer, 1000); sscanf (buffer, " %d %lg\n", &row[numberElements_], &element[numberElements_] ); numberElements_++; } start[i + 1] = numberElements_; } } // construct packed matrix matrixByColumn_ = new CoinPackedMatrix(true, numberRows_,numberColumns_,numberElements_, element,row,start,NULL); free ( row ); free ( start ); free ( element ); handler_->message(COIN_MPS_STATS,messages_)< (malloc ( numberRows_ * sizeof ( double ))); rowupper_ = reinterpret_cast (malloc ( numberRows_ * sizeof ( double ))); // and objective objective_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); problemName_= CoinStrdup(glp_get_prob_name(cbc_glp_prob)); int kRow=0; start[0]=0; numberElements_=0; // spare space for checking double * el = new double[numberColumns_]; int * ind = new int[numberColumns_]; char ** names = NULL; if (keepNames) { names = reinterpret_cast (malloc(numberRows_*sizeof(char *))); names_[0] = names; numberHash_[0] = numberRows_; } for (iRow=0; iRowmessage(COIN_GENERAL_INFO,messages_)<< " CoinMpsIO::readGMPL(): Maximization problem reformulated as minimization" <reverseOrdering(); delete [] element; delete [] start; delete [] index; // Now do columns collower_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); colupper_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); integerType_ = reinterpret_cast (malloc (numberColumns_*sizeof(char))); if (keepNames) { names = reinterpret_cast (malloc(numberColumns_*sizeof(char *))); names_[1] = names; numberHash_[1] = numberColumns_; } int numberIntegers=0; for (iColumn=0; iColumn= -MAX_INTEGER ); if ( collower_[iColumn] < -MAX_INTEGER ) collower_[iColumn] = -MAX_INTEGER; if ( colupper_[iColumn] > MAX_INTEGER ) colupper_[iColumn] = MAX_INTEGER; } else if (columnType==GLP_BV) { numberIntegers++; integerType_[iColumn]=1; collower_[iColumn]=0.0; colupper_[iColumn]=1.0; } else { integerType_[iColumn]=0; } if (keepNames) { strcpy(name,glp_get_col_name(cbc_glp_prob,iColumn+1)); // could look at name? names[iColumn]=CoinStrdup(name); } } // leave in case report needed //glp_free(cbc_glp_prob); //glp_mpl_free_wksp(cbc_glp_tran); //glp_free_env(); if ( !numberIntegers ) { free(integerType_); integerType_ = NULL; } if(handler_) handler_->message(COIN_MPS_STATS,messages_)<0) { delete cardReader_; cardReader_ = new CoinMpsCardReader ( input, this); } int numberSets=0; CoinSet ** sets=NULL; returnCode = readGms(numberSets,sets); for (int i=0;i0) { delete cardReader_; cardReader_ = new CoinMpsCardReader ( input, this); } return readGms(numberSets,sets); } int CoinMpsIO::readGms(int & /*numberSets*/,CoinSet ** &/*sets*/) { // First version expects comments giving size numberRows_ = 0; numberColumns_ = 0; numberElements_ = 0; bool gotName=false; bool minimize=false; char objName[COIN_MAX_FIELD_LENGTH]; int decodeType=-1; while(!gotName) { if (cardReader_->nextGmsField(0)<0) { handler_->message(COIN_MPS_EOF,messages_)<mutableCard(); if (card[0]!='*') { // finished preamble without finding name printf("bad gms file\n"); return -1; } else { // skip * and find next char * next = nextNonBlank(card+1); if (!next) continue; if (decodeType>=0) { // in middle of getting a total if (!strncmp(next,"Total",5)) { // next line wanted decodeType+=100; } else if (decodeType>=100) { decodeType -= 100; int number = atoi(next); assert (number>0); if (decodeType==0) numberRows_=number; else if (decodeType==1) numberColumns_=number; else numberElements_=number; decodeType=-1; } } else if (!strncmp(next,"Equation",8)) { decodeType=0; } else if (!strncmp(next,"Variable",8)) { decodeType=1; } else if (!strncmp(next,"Nonzero",7)) { decodeType=2; } else if (!strncmp(next,"Solve",5)) { decodeType=-1; gotName=true; assert (numberRows_>0&&numberColumns_>0&&numberElements_>0); next = cardReader_->nextBlankOr(next+5); char name[100]; char * put=name; next= nextNonBlank(next); while(*next!=' '&&*next!='\t') { *put = *next; put++; next++; } *put='\0'; assert (put-name<100); free(problemName_); problemName_=CoinStrdup(name); next = strchr(next,';'); assert (next); // backup while(*next!=' '&&*next!='\t') { next--; } cardReader_->setPosition(next); #ifdef NDEBUG cardReader_->nextGmsField(1); #else int returnCode = cardReader_->nextGmsField(1); assert (!returnCode); #endif next = strchr(next,';'); cardReader_->setPosition(next+1); strcpy(objName,cardReader_->columnName()); char * semi = strchr(objName,';'); if (semi) *semi='\0'; if (strstr(card,"minim")) { minimize=true; } else { assert (strstr(card,"maxim")); minimize=false; } } else { decodeType=-1; } } } } objectiveOffset_ = 0.0; rowlower_ = reinterpret_cast (malloc ( numberRows_ * sizeof ( double ))); rowupper_ = reinterpret_cast (malloc ( numberRows_ * sizeof ( double ))); collower_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); colupper_ = reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); objective_= reinterpret_cast (malloc ( numberColumns_ * sizeof ( double ))); CoinBigIndex *start = reinterpret_cast (malloc ((numberRows_ + 1) * sizeof (CoinBigIndex))); COINColumnIndex * column = reinterpret_cast (malloc (numberElements_ * sizeof (COINRowIndex))); double *element = reinterpret_cast (malloc (numberElements_ * sizeof (double))); COINMpsType *rowType = reinterpret_cast (malloc ( numberRows_ * sizeof ( COINMpsType ))); char **rowName = reinterpret_cast (malloc ( numberRows_ * sizeof ( char * ))); COINMpsType *columnType = reinterpret_cast (malloc ( numberColumns_ * sizeof ( COINMpsType ))); char **columnName = reinterpret_cast (malloc ( numberColumns_ * sizeof ( char * ))); start[0] = 0; numberElements_ = 0; int numberErrors = 0; int i; COINColumnIndex numberIntegers = 0; // expect Variables int returnCode; returnCode = cardReader_->nextGmsField(1); assert (!returnCode&&!strcmp(cardReader_->columnName(),"Variables")); for (i=0;inextGmsField(1); assert (!returnCode); char * next = cardReader_->getPosition(); if (*next=='\0') { // eol - expect , at beginning of next line returnCode = cardReader_->nextGmsField(0); assert (!returnCode); next = strchr(cardReader_->mutableCard(),','); assert (next); } assert (*next==','||*next==';'); cardReader_->setPosition(next+1); columnName[i]=CoinStrdup(cardReader_->columnName()); // Default is free? collower_[i]=-COIN_DBL_MAX; // Surely not - check collower_[i]=0.0; colupper_[i]=COIN_DBL_MAX; objective_[i]=0.0; columnType[i]=COIN_UNSET_BOUND; } startHash ( columnName, numberColumns_ , 1 ); integerType_ = reinterpret_cast (malloc (numberColumns_*sizeof(char))); memset(integerType_,0,numberColumns_); // Lists come in various flavors - I don't know many now // 0 - Positive // 1 - Binary // -1 end int listType=10; while (listType>=0) { returnCode=cardReader_->nextGmsField(1); assert (!returnCode); listType=-1; if (!strcmp(cardReader_->columnName(),"Positive")) { listType=0; } else if (!strcmp(cardReader_->columnName(),"Binary")) { listType=1; } else if (!strcmp(cardReader_->columnName(),"Integer")) { listType=2; } else { break; } // skip Variables returnCode=cardReader_->nextGmsField(1); assert (!returnCode); assert (!strcmp(cardReader_->columnName(),"Variables")); // Go through lists bool inList=true; while (inList) { returnCode=cardReader_->nextGmsField(1); assert (!returnCode); char * next = cardReader_->getPosition(); if (*next=='\0') { // eol - expect , at beginning of next line returnCode = cardReader_->nextGmsField(0); assert (!returnCode); next = strchr(cardReader_->mutableCard(),','); assert (next); } assert (*next==','||*next==';'); cardReader_->setPosition(next+1); inList=(*next==','); int iColumn = findHash(cardReader_->columnName(),1); assert (iColumn>=0); if (listType==0) { collower_[iColumn]=0.0; } else if (listType==1) { collower_[iColumn]=0.0; colupper_[iColumn]=1.0; columnType[iColumn]=COIN_BV_BOUND; integerType_[iColumn] = 1; numberIntegers++; } else if (listType==2) { collower_[iColumn]=0.0; columnType[iColumn]=COIN_UI_BOUND; integerType_[iColumn] = 1; numberIntegers++; } } } // should be equations assert (!strcmp(cardReader_->columnName(),"Equations")); for (i=0;inextGmsField(1); assert (!returnCode); char * next = cardReader_->getPosition(); if (*next=='\0') { // eol - expect , at beginning of next line returnCode = cardReader_->nextGmsField(0); assert (!returnCode); next = strchr(cardReader_->mutableCard(),','); assert (next); } assert (*next==','||*next==';'); cardReader_->setPosition(next+1); rowName[i]=CoinStrdup(cardReader_->columnName()); // Default is free? rowlower_[i]=-COIN_DBL_MAX; rowupper_[i]=COIN_DBL_MAX; rowType[i]=COIN_N_ROW; } startHash ( rowName, numberRows_ , 0 ); const double largeElement = 1.0e14; int numberTiny=0; int numberLarge=0; // For now expect just equations so do loop for (i=0;inextGmsField(1); assert (!returnCode); char * next = cardReader_->getPosition(); assert (*next==' '); char rowName[COIN_MAX_FIELD_LENGTH]; strcpy(rowName,cardReader_->columnName()); char * dot = strchr(rowName,'.'); assert (dot); *dot='\0'; assert (*(dot+1)=='.'); #ifndef NDEBUG int iRow = findHash(rowName,0); assert (i==iRow); #endif returnCode=0; while(!returnCode) { returnCode = cardReader_->nextGmsField(3); assert (returnCode==0||returnCode==2); if (returnCode==2) break; int iColumn = findHash(cardReader_->columnName(),1); if (iColumn>=0) { column[numberElements_]=iColumn; double value = cardReader_->value(); if (fabs(value)largeElement) numberLarge++; element[numberElements_++]=value; } else { // may be string char temp[100]; strcpy(temp,cardReader_->columnName()); char * ast = strchr(temp,'*'); if (!ast) { assert (iColumn>=0); } else { assert (allowStringElements_); *ast='\0'; if (allowStringElements_==1) iColumn = findHash(temp,1); else iColumn = findHash(ast+1,1); assert (iColumn>=0); char temp2[100]; temp2[0]='\0'; double value = cardReader_->value(); if (value&&value!=1.0) sprintf(temp2,"%g*",value); if (allowStringElements_==1) strcat(temp2,ast+1); else strcat(temp2,temp); addString(i,iColumn,temp2); } } } start[i+1]=numberElements_; next=cardReader_->getPosition(); // what about ranges? COINMpsType type=COIN_N_ROW; if (!strncmp(next,"=E=",3)) type=COIN_E_ROW; else if (!strncmp(next,"=G=",3)) type=COIN_G_ROW; else if (!strncmp(next,"=L=",3)) type=COIN_L_ROW; assert (type!=COIN_N_ROW); cardReader_->setPosition(next+3); returnCode = cardReader_->nextGmsField(2); assert (!returnCode); if (type==COIN_E_ROW) { rowlower_[i]=cardReader_->value(); rowupper_[i]=cardReader_->value(); } else if (type==COIN_G_ROW) { rowlower_[i]=cardReader_->value(); } else if (type==COIN_L_ROW) { rowupper_[i]=cardReader_->value(); } rowType[i]=type; // and skip ; #ifdef NDEBUG cardReader_->nextGmsField(5); #else returnCode = cardReader_->nextGmsField(5); assert (!returnCode); #endif } // Now non default bounds while (true) { returnCode=cardReader_->nextGmsField(0); if (returnCode<0) break; // if there is a . see if valid name char * card = cardReader_->mutableCard(); char * dot = strchr(card,'.'); if (dot) { *dot='\0'; int iColumn = findHash(card,1); if (iColumn>=0) { // bound char * next = strchr(dot+1,'='); assert (next); double value =atof(next+1); if (!strncmp(dot+1,"fx",2)) { collower_[iColumn]=value; colupper_[iColumn]=value; } else if (!strncmp(dot+1,"up",2)) { colupper_[iColumn]=value; } else if (!strncmp(dot+1,"lo",2)) { collower_[iColumn]=value; } } // may be two per card char * semi = strchr(dot+1,';'); dot = NULL; if (semi) dot = strchr(semi+1,'.'); if (dot) { char * next= nextNonBlank(semi+1); dot = strchr(next,'.'); assert (dot); *dot='\0'; assert (iColumn==findHash(next,1)); // bound next = strchr(dot+1,'='); assert (next); double value =atof(next+1); if (!strncmp(dot+1,"fx",2)) { collower_[iColumn]=value; abort(); colupper_[iColumn]=value; } else if (!strncmp(dot+1,"up",2)) { colupper_[iColumn]=value; } else if (!strncmp(dot+1,"lo",2)) { collower_[iColumn]=value; } // may be two per card semi = strchr(dot+1,';'); assert (semi); } } } // Objective int iObjCol = findHash(objName,1); int iObjRow=-1; assert (iObjCol>=0); if (!convertObjective_) { objective_[iObjCol]=minimize ? 1.0 : -1.0; } else { // move column stuff COINColumnIndex iColumn; free(names_[1][iObjCol]); for ( iColumn = iObjCol+1; iColumn < numberColumns_; iColumn++ ) { integerType_[iColumn-1]=integerType_[iColumn]; collower_[iColumn-1]=collower_[iColumn]; colupper_[iColumn-1]=colupper_[iColumn]; names_[1][iColumn-1]=names_[1][iColumn]; } numberHash_[1]--; numberColumns_--; double multiplier = minimize ? 1.0 : -1.0; // but swap multiplier *= -1.0; int iRow; CoinBigIndex nel=0; CoinBigIndex last=0; int kRow=0; for (iRow=0;iRowiObjCol) iColumn --; objective_[iColumn]=multiplier * element[j]; } } nel=start[kRow]; last=start[iRow+1]; } } numberRows_=kRow; assert (iObjRow>=0); numberHash_[0]--; } stopHash(0); stopHash(1); // clean up integers if ( !numberIntegers ) { free(integerType_); integerType_ = NULL; } else { COINColumnIndex iColumn; for ( iColumn = 0; iColumn < numberColumns_; iColumn++ ) { if ( integerType_[iColumn] ) { //assert ( collower_[iColumn] >= -MAX_INTEGER ); if ( collower_[iColumn] < -MAX_INTEGER ) collower_[iColumn] = -MAX_INTEGER; if ( colupper_[iColumn] > MAX_INTEGER ) colupper_[iColumn] = MAX_INTEGER; } } } free ( columnType ); free ( rowType ); if (numberStringElements()&&convertObjective_) { int numberElements = numberStringElements(); for (int i=0;iiObjRow) { modify=true; iRow--; } if (iColumn>iObjCol) { modify=true; iColumn--; } if (modify) { char temp[500]; const char * pos = strchr(line,','); assert (pos); pos = strchr(pos+1,','); assert (pos); pos++; sprintf(temp,"%d,%d,%s",iRow,iColumn,pos); free(line); stringElements_[i]=CoinStrdup(temp); } } } // construct packed matrix and convert to column format CoinPackedMatrix matrixByRow(false, numberColumns_,numberRows_,numberElements_, element,column,start,NULL); free ( column ); free ( start ); free ( element ); matrixByColumn_= new CoinPackedMatrix(); matrixByColumn_->setExtraGap(0.0); matrixByColumn_->setExtraMajor(0.0); matrixByColumn_->reverseOrderedCopyOf(matrixByRow); if (!convertObjective_) assert (matrixByColumn_->getVectorLengths()[iObjCol]==1); handler_->message(COIN_MPS_STATS,messages_)<logLevel()>3) printf("There were %d coefficients < %g and %d > %g\n", numberTiny,smallElement_,numberLarge,largeElement); return numberErrors; } /* Read a basis in MPS format from the given filename. If VALUES on NAME card and solution not NULL fills in solution status values as for CoinWarmStartBasis (but one per char) Use "stdin" or "-" to read from stdin. */ int CoinMpsIO::readBasis(const char *filename, const char *extension , double * solution, unsigned char * rowStatus, unsigned char * columnStatus, const std::vector & colnames,int numberColumns, const std::vector & rownames, int numberRows) { // Deal with filename - +1 if new, 0 if same as before, -1 if error CoinFileInput *input = 0; int returnCode = dealWithFileName(filename,extension,input); if (returnCode<0) { return -1; } else if (returnCode>0) { delete cardReader_; cardReader_ = new CoinMpsCardReader ( input, this); } cardReader_->readToNextSection(); if ( cardReader_->whichSection ( ) == COIN_NAME_SECTION ) { // Get whether to use values (passed back by freeFormat) if (!cardReader_->freeFormat()) solution = NULL; } else if ( cardReader_->whichSection ( ) == COIN_UNKNOWN_SECTION ) { handler_->message(COIN_MPS_BADFILE1,messages_)<card() <<1 <fileInput()->getReadType()!="plain") handler_->message(COIN_MPS_BADFILE2,messages_) <fileInput()->getReadType() <whichSection ( ) != COIN_EOF_SECTION ) { return -4; } else { handler_->message(COIN_MPS_EOF,messages_)< (numberRows_)|| colnames.size()!=static_cast (numberColumns_)) { gotNames = false; } else { gotNames=true; numberHash_[0]=numberRows_; numberHash_[1]=numberColumns_; names_[0] = reinterpret_cast (malloc(numberRows_ * sizeof(char *))); names_[1] = reinterpret_cast (malloc (numberColumns_ * sizeof(char *))); const char** rowNames = const_cast(names_[0]); const char** columnNames = const_cast(names_[1]); int i; for (i = 0; i < numberRows_; ++i) { rowNames[i] = rownames[i].c_str(); } for (i = 0; i < numberColumns_; ++i) { columnNames[i] = colnames[i].c_str(); } startHash ( const_cast(rowNames), numberRows , 0 ); startHash ( const_cast(columnNames), numberColumns , 1 ); } cardReader_->setWhichSection(COIN_BASIS_SECTION); cardReader_->setFreeFormat(true); // below matches CoinWarmStartBasis, const unsigned char basic = 0x01; const unsigned char atLowerBound = 0x03; const unsigned char atUpperBound = 0x02; while ( cardReader_->nextField ( ) == COIN_BASIS_SECTION ) { // Get type and column number int iColumn; if (gotNames) { iColumn = findHash (cardReader_->columnName(),1); } else { // few checks char check; sscanf(cardReader_->columnName(),"%c%d",&check,&iColumn); assert (check=='C'&&iColumn>=0); if (iColumn>=numberColumns_) iColumn=-1; } if (iColumn>=0) { double value = cardReader_->value ( ); if (solution && value>-1.0e50) solution[iColumn]=value; int iRow=-1; switch ( cardReader_->mpsType ( ) ) { case COIN_BS_BASIS: columnStatus[iColumn]= basic; break; case COIN_XL_BASIS: columnStatus[iColumn]= basic; // get row number if (gotNames) { iRow = findHash (cardReader_->rowName(),0); } else { // few checks char check; sscanf(cardReader_->rowName(),"%c%d",&check,&iRow); assert (check=='R'&&iRow>=0); if (iRow>=numberRows_) iRow=-1; } if ( iRow >= 0 ) { rowStatus[iRow] = atLowerBound; } break; case COIN_XU_BASIS: columnStatus[iColumn]= basic; // get row number if (gotNames) { iRow = findHash (cardReader_->rowName(),0); } else { // few checks char check; sscanf(cardReader_->rowName(),"%c%d",&check,&iRow); assert (check=='R'&&iRow>=0); if (iRow>=numberRows_) iRow=-1; } if ( iRow >= 0 ) { rowStatus[iRow] = atUpperBound; } break; case COIN_LL_BASIS: columnStatus[iColumn]= atLowerBound; break; case COIN_UL_BASIS: columnStatus[iColumn]= atUpperBound; break; default: break; } } } if (gotNames) { stopHash ( 0 ); stopHash ( 1 ); free(names_[0]); names_[0]=NULL; numberHash_[0]=0; free(names_[1]); names_[1]=NULL; numberHash_[1]=0; delete[] hash_[0]; delete[] hash_[1]; hash_[0]=0; hash_[1]=0; } if ( cardReader_->whichSection ( ) != COIN_ENDATA_SECTION) { handler_->message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() <message(COIN_MPS_RETURNING,messages_)<1&&formatType<8) { int i; // pad out to 8 for (i=0;i<8;i++) { if (outputRow[i]=='\0') break; } for (;i<8;i++) outputRow[i]=' '; outputRow[8]='\0'; } } // Function to return number in most efficient way // Also creates row name field /* formatType is 0 - normal and 8 character names 1 - extra accuracy 2 - IEEE hex - INTEL 3 - IEEE hex - not INTEL */ static void convertDouble(int section,int formatType, double value, char outputValue[24], const char * name, char outputRow[100]) { convertRowName(formatType,name,outputRow); CoinConvertDouble(section,formatType&3,value,outputValue); } // Function to return number in most efficient way /* formatType is 0 - normal and 8 character names 1 - extra accuracy 2 - IEEE hex - INTEL 3 - IEEE hex - not INTEL */ void CoinConvertDouble(int section, int formatType, double value, char outputValue[24]) { if (formatType==0) { bool stripZeros=true; if (fabs(value)<1.0e40) { int power10, decimal; if (value>=0.0) { power10 =static_cast (log10(value)); if (power10<9&&power10>-4) { decimal = CoinMin(10,10-power10); char format[8]; sprintf(format,"%%12.%df",decimal); sprintf(outputValue,format,value); } else { sprintf(outputValue,"%13.7g",value); stripZeros=false; } } else { power10 =static_cast (log10(-value))+1; if (power10<8&&power10>-3) { decimal = CoinMin(9,9-power10); char format[8]; sprintf(format,"%%12.%df",decimal); sprintf(outputValue,format,value); } else { sprintf(outputValue,"%13.6g",value); stripZeros=false; } } if (stripZeros) { // take off trailing 0 int j; for (j=11;j>=0;j--) { if (outputValue[j]=='0') outputValue[j]=' '; else break; } } else { // still need to make sure fits in 12 characters char * e = strchr(outputValue,'e'); if (!e) { // no e but better make sure fits in 12 if (outputValue[12]!=' '&&outputValue[12]!='\0') { assert (outputValue[0]==' '); int j; for (j=0;j<12;j++) outputValue[j]=outputValue[j+1]; } outputValue[12]='\0'; } else { // e take out 0s int j = static_cast((e-outputValue))+1; int put = j+1; assert(outputValue[j]=='-'||outputValue[j]=='+'); for ( j = put ; j < 14 ; j++) { if (outputValue[j]!='0') break; } if (j == put) { // we need to lose something // try taking out blanks if (outputValue[0]==' ') { // skip blank j=1; put=0; } else { // rounding will be wrong but .... put -= 3; // points to one before e j -= 2; // points to e } } // copy rest for ( ; j < 14 ; j++) { outputValue[put++] = outputValue[j]; } } } // overwrite if very very small if (fabs(value)<1.0e-20) strcpy(outputValue,"0.0"); } else { if (section==2) { outputValue[0]= '\0'; // needs no value } else { // probably error ... but .... sprintf(outputValue,"%12.6g",value); } } int i; // pad out to 12 for (i=0;i<12;i++) { if (outputValue[i]=='\0') break; } for (;i<12;i++) outputValue[i]=' '; outputValue[12]='\0'; } else if (formatType==1) { if (fabs(value)<1.0e40) { memset(outputValue,' ',24); sprintf(outputValue,"%.16g",value); // take out blanks int i=0; int j; for (j=0;j<23;j++) { if (outputValue[j]!=' ') outputValue[i++]=outputValue[j]; } outputValue[i]='\0'; } else { if (section==2) { outputValue[0]= '\0'; // needs no value } else { // probably error ... but .... sprintf(outputValue,"%12.6g",value); } } } else { // IEEE // ieee - 3 bytes go to 2 assert (sizeof(double)==8*sizeof(char)); assert (sizeof(unsigned short) == 2*sizeof(char)); unsigned short shortValue[4]; memcpy(shortValue,&value,sizeof(double)); outputValue[12]='\0'; if (formatType==2) { // INTEL char * thisChar = outputValue; for (int i=3;i>=0;i--) { unsigned short thisValue=shortValue[i]; // encode 6 bits at a time for (int j=0;j<3;j++) { unsigned short thisPart = static_cast(thisValue & 63); thisValue = static_cast(thisValue>>6); if (thisPart < 10) { *thisChar = static_cast(thisPart+'0'); } else if (thisPart < 36) { *thisChar = static_cast(thisPart-10+'a'); } else if (thisPart < 62) { *thisChar = static_cast(thisPart-36+'A'); } else { *thisChar = static_cast(thisPart-62+'*'); } thisChar++; } } } else { // not INTEL char * thisChar = outputValue; for (int i=0;i<4;i++) { unsigned short thisValue=shortValue[i]; // encode 6 bits at a time for (int j=0;j<3;j++) { unsigned short thisPart = static_cast(thisValue & 63); thisValue = static_cast(thisValue>>6); if (thisPart < 10) { *thisChar = static_cast(thisPart+'0'); } else if (thisPart < 36) { *thisChar = static_cast(thisPart-10+'a'); } else if (thisPart < 62) { *thisChar = static_cast(thisPart-36+'A'); } else { *thisChar = static_cast(thisPart-62+'*'); } thisChar++; } } } } } static void writeString(CoinFileOutput *output, const char* str) { if (output != 0) { output->puts (str); } } // Put out card image static void outputCard(int formatType,int numberFields, CoinFileOutput *output, std::string head, const char * name, const char outputValue[2][24], const char outputRow[2][100]) { // fprintf(fp,"%s",head.c_str()); std::string line = head; int i; if (formatType==0||(formatType>=2&&formatType<8)) { char outputColumn[9]; strcpy(outputColumn,name); for (i=0;i<8;i++) { if (outputColumn[i]=='\0') break; } for (;i<8;i++) outputColumn[i]=' '; outputColumn[8]='\0'; // fprintf(fp,"%s ",outputColumn); line += outputColumn; line += " "; for (i=0;i='0'&&num<='9') { n *= 10; n += num-'0'; } else { n=-1; break; } } if (n>=0) largest = CoinMax(largest,n); } } largest ++; if (largest>0) { // check char * used = new char[largest]; memset(used,0,largest); int nDup=0; for (i=0;i='0'&&num<='9') { n *= 10; n += num-'0'; } else { n=-1; break; } } if (n>=0) { if (!used[n]) { used[n]=1; } else { // duplicate nDup++; free(names[i]); char newName[9]; sprintf(newName,"%c%7.7d",first,largest); names[i] = CoinStrdup(newName); largest++; } } } } delete []used; return nDup; } else { return 0; } } static void strcpyeq(char * output, const char * input) { output[0]='='; strcpy(output+1,input); } int CoinMpsIO::writeMps(const char *filename, int compression, int formatType, int numberAcross, CoinPackedMatrix * quadratic, int numberSOS, const CoinSet * setInfo) const { // Clean up format and numberacross numberAcross=CoinMax(1,numberAcross); numberAcross=CoinMin(2,numberAcross); formatType=CoinMax(0,formatType); formatType=CoinMin(2,formatType); int possibleCompression=0; #ifdef COIN_HAS_ZLIB possibleCompression =1; #endif #ifdef COIN_HAS_BZLIB possibleCompression += 2; #endif if ((compression&possibleCompression)==0) { // switch to other if possible if (compression&&possibleCompression) compression = 3-compression; else compression=0; } std::string line = filename; CoinFileOutput *output = 0; switch (compression) { case 1: if (strcmp(line.c_str() +(line.size()-3), ".gz") != 0) { line += ".gz"; } output = CoinFileOutput::create (line, CoinFileOutput::COMPRESS_GZIP); break; case 2: if (strcmp(line.c_str() +(line.size()-4), ".bz2") != 0) { line += ".bz2"; } output = CoinFileOutput::create (line, CoinFileOutput::COMPRESS_BZIP2); break; case 0: default: output = CoinFileOutput::create (line, CoinFileOutput::COMPRESS_NONE); break; } const char * const * const rowNames = names_[0]; const char * const * const columnNames = names_[1]; int i; unsigned int length = 8; bool freeFormat = (formatType==1); // Check names for uniqueness if default int nChanged; nChanged=makeUniqueNames(names_[0],numberRows_,'R'); if (nChanged) handler_->message(COIN_MPS_CHANGED,messages_)<<"row"<message(COIN_MPS_CHANGED,messages_)<<"column"< length) { length = static_cast(strlen(rowNames[i])); break; } } if (length <= 8) { for (i = 0 ; i < numberColumns_; ++i) { if (strlen(columnNames[i]) > length) { length = static_cast(strlen(columnNames[i])); break; } } } if (length > 8 && freeFormat!=1) { freeFormat = true; formatType += 8; } if (numberStringElements_) { freeFormat=true; numberAcross=1; } // NAME card line = "NAME "; if (strcmp(problemName_,"")==0) { line.append("BLANK "); } else { if (strlen(problemName_) >= 8) { line.append(problemName_, 8); } else { line.append(problemName_); line.append(8-strlen(problemName_), ' '); } } if (freeFormat&&(formatType&7)!=2) line.append(" FREE"); else if (freeFormat) line.append(" FREEIEEE"); else if ((formatType&7)==2) line.append(" IEEE"); // See if INTEL if IEEE if ((formatType&7)==2) { // test intel here and add 1 if not intel double value=1.0; char x[8]; memcpy(x,&value,8); if (x[0]==63) { formatType ++; // not intel } else { assert (x[0]==0); } } // finish off name and do ROWS card and objective char* objrow = CoinStrdup(strcmp(objectiveName_,"")==0 ? "OBJROW" : objectiveName_); line.append("\nROWS\n N "); line.append(objrow); line.append("\n"); writeString(output, line.c_str()); // Rows section // Sense array // But massage if looks odd char * sense = new char [numberRows_]; memcpy( sense , getRowSense(), numberRows_); const double * rowLower = getRowLower(); const double * rowUpper = getRowUpper(); for (i=0;i-1.0e30) { if(rowUpper[i]<1.0e30) { line.append("L"); } else { sense[i]='G'; line.append(1,sense[i]); } } else { sense[i]='L'; line.append(1,sense[i]); } } line.append(" "); line.append(rowNames[i]); line.append("\n"); writeString(output, line.c_str()); } // COLUMNS card writeString(output, "COLUMNS\n"); bool ifBounds=false; double largeValue = infinity_; largeValue = 1.0e30; // safer const double * columnLower = getColLower(); const double * columnUpper = getColUpper(); const double * objective = getObjCoefficients(); const CoinPackedMatrix * matrix = getMatrixByCol(); const double * elements = matrix->getElements(); const int * rows = matrix->getIndices(); const CoinBigIndex * starts = matrix->getVectorStarts(); const int * lengths = matrix->getVectorLengths(); char outputValue[2][24]; char outputRow[2][100]; // strings int nextRowString=numberRows_+10; int nextColumnString=numberColumns_+10; int whichString=0; const char * nextString=NULL; // mark string rows char * stringRow = new char[numberRows_+1]; memset(stringRow,0,numberRows_+1); if (numberStringElements_) { decodeString(whichString,nextRowString,nextColumnString,nextString); } // Arrays so we can put out rows in order int * tempRow = new int [numberRows_]; double * tempValue = new double [numberRows_]; // Through columns (only put out if elements or objective value) for (i=0;i=numberColumns_) { strcpyeq(outputValue[0],nextString); decodeString(++whichString,nextRowString,nextColumnString,nextString); } numberFields++; if (numberFields==numberAcross) { // put out card outputCard(formatType, numberFields, output, " ", "RHS", outputValue, outputRow); numberFields=0; } } } if (numberFields) { // put out card outputCard(formatType, numberFields, output, " ", "RHS", outputValue, outputRow); } if (ifRange) { // RANGES writeString(output, "RANGES\n"); numberFields = 0; for (i=0;i=largeValue&&!isInteger(i)) { header[0]=" FR "; value[0] = largeValue; } else { header[0]=" MI "; value[0] = -largeValue; if (!isInteger(i)) header[1]=" UP "; else header[1]=" UI "; if (upperValuegetIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); const double * quadraticElement = quadratic->getElements(); for (int iColumn=0;iColumn -infinity_) { if (upper < infinity_) { right = upper; if (upper==lower) { sense = 'E'; } else { sense = 'R'; range = upper - lower; } } else { sense = 'G'; right = lower; } } else { if (upper < infinity_) { sense = 'L'; right = upper; } else { sense = 'N'; right = 0.0; } } } //----------------------------------------------------------------------------- /** A quick inlined function to convert from sense/rhs/range stryle constraint definition to lb/ub style */ inline void CoinMpsIO::convertSenseToBound(const char sense, const double right, const double range, double& lower, double& upper) const { switch (sense) { case 'E': lower = upper = right; break; case 'L': lower = -infinity_; upper = right; break; case 'G': lower = right; upper = infinity_; break; case 'R': lower = right - range; upper = right; break; case 'N': lower = -infinity_; upper = infinity_; break; } } //------------------------------------------------------------------ // Get sense of row constraints. //------------------------------------------------------------------ const char * CoinMpsIO::getRowSense() const { if ( rowsense_==NULL ) { int nr=numberRows_; rowsense_ = reinterpret_cast (malloc(nr*sizeof(char))); double dum1,dum2; int i; for ( i=0; i (malloc(nr*sizeof(double))); char dum1; double dum2; int i; for ( i=0; i (malloc(nr*sizeof(double))); std::fill(rowrange_,rowrange_+nr,0.0); char dum1; double dum2; int i; for ( i=0; ireverseOrdering(); } return matrixByRow_; } //------------------------------------------------------------------ // Create a column copy of the matrix ... //------------------------------------------------------------------ const CoinPackedMatrix * CoinMpsIO::getMatrixByCol() const { return matrixByColumn_; } //------------------------------------------------------------------ // Save the data ... //------------------------------------------------------------------ void CoinMpsIO::setMpsDataWithoutRowAndColNames( const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const double* rowlb, const double* rowub) { freeAll(); if (m.isColOrdered()) { matrixByColumn_ = new CoinPackedMatrix(m); } else { matrixByColumn_ = new CoinPackedMatrix; matrixByColumn_->reverseOrderedCopyOf(m); } numberColumns_ = matrixByColumn_->getNumCols(); numberRows_ = matrixByColumn_->getNumRows(); numberElements_ = matrixByColumn_->getNumElements(); defaultBound_ = 1; infinity_ = infinity; objectiveOffset_ = 0; rowlower_ = reinterpret_cast (malloc (numberRows_ * sizeof(double))); rowupper_ = reinterpret_cast (malloc (numberRows_ * sizeof(double))); collower_ = reinterpret_cast (malloc (numberColumns_ * sizeof(double))); colupper_ = reinterpret_cast (malloc (numberColumns_ * sizeof(double))); objective_ = reinterpret_cast (malloc (numberColumns_ * sizeof(double))); std::copy(rowlb, rowlb + numberRows_, rowlower_); std::copy(rowub, rowub + numberRows_, rowupper_); std::copy(collb, collb + numberColumns_, collower_); std::copy(colub, colub + numberColumns_, colupper_); std::copy(obj, obj + numberColumns_, objective_); if (integrality) { integerType_ = reinterpret_cast (malloc (numberColumns_ * sizeof(char))); std::copy(integrality, integrality + numberColumns_, integerType_); } else { integerType_ = NULL; } problemName_ = CoinStrdup(""); objectiveName_ = CoinStrdup(""); rhsName_ = CoinStrdup(""); rangeName_ = CoinStrdup(""); boundName_ = CoinStrdup(""); } void CoinMpsIO::setMpsDataColAndRowNames( char const * const * const colnames, char const * const * const rownames) { releaseRowNames(); releaseColumnNames(); // If long names free format names_[0] = reinterpret_cast (malloc(numberRows_ * sizeof(char *))); names_[1] = reinterpret_cast (malloc (numberColumns_ * sizeof(char *))); numberHash_[0]=numberRows_; numberHash_[1]=numberColumns_; char** rowNames = names_[0]; char** columnNames = names_[1]; int i; if (rownames) { for (i = 0 ; i < numberRows_; ++i) { if (rownames[i]) { rowNames[i] = CoinStrdup(rownames[i]); } else { rowNames[i] = reinterpret_cast (malloc (9 * sizeof(char))); sprintf(rowNames[i],"R%7.7d",i); } } } else { for (i = 0; i < numberRows_; ++i) { rowNames[i] = reinterpret_cast (malloc (9 * sizeof(char))); sprintf(rowNames[i],"R%7.7d",i); } } #ifndef NONAMES if (colnames) { for (i = 0 ; i < numberColumns_; ++i) { if (colnames[i]) { columnNames[i] = CoinStrdup(colnames[i]); } else { columnNames[i] = reinterpret_cast (malloc (9 * sizeof(char))); sprintf(columnNames[i],"C%7.7d",i); } } } else { for (i = 0; i < numberColumns_; ++i) { columnNames[i] = reinterpret_cast (malloc (9 * sizeof(char))); sprintf(columnNames[i],"C%7.7d",i); } } #else const double * objective = getObjCoefficients(); const CoinPackedMatrix * matrix = getMatrixByCol(); const int * lengths = matrix->getVectorLengths(); int k=0; for (i = 0 ; i < numberColumns_; ++i) { columnNames[i] = reinterpret_cast (malloc (9 * sizeof(char))); sprintf(columnNames[i],"C%7.7d",k); if (objective[i]||lengths[i]) k++; } #endif } void CoinMpsIO::setMpsDataColAndRowNames( const std::vector & colnames, const std::vector & rownames) { // If long names free format names_[0] = reinterpret_cast (malloc(numberRows_ * sizeof(char *))); names_[1] = reinterpret_cast (malloc (numberColumns_ * sizeof(char *))); char** rowNames = names_[0]; char** columnNames = names_[1]; int i; if (rownames.size()!=0) { for (i = 0 ; i < numberRows_; ++i) { rowNames[i] = CoinStrdup(rownames[i].c_str()); } } else { for (i = 0; i < numberRows_; ++i) { rowNames[i] = reinterpret_cast (malloc (9 * sizeof(char))); sprintf(rowNames[i],"R%7.7d",i); } } if (colnames.size()!=0) { for (i = 0 ; i < numberColumns_; ++i) { columnNames[i] = CoinStrdup(colnames[i].c_str()); } } else { for (i = 0; i < numberColumns_; ++i) { columnNames[i] = reinterpret_cast (malloc (9 * sizeof(char))); sprintf(columnNames[i],"C%7.7d",i); } } } void CoinMpsIO::setMpsData(const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const double* rowlb, const double* rowub, char const * const * const colnames, char const * const * const rownames) { setMpsDataWithoutRowAndColNames(m,infinity,collb,colub,obj,integrality,rowlb,rowub); setMpsDataColAndRowNames(colnames,rownames); } void CoinMpsIO::setMpsData(const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const double* rowlb, const double* rowub, const std::vector & colnames, const std::vector & rownames) { setMpsDataWithoutRowAndColNames(m,infinity,collb,colub,obj,integrality,rowlb,rowub); setMpsDataColAndRowNames(colnames,rownames); } void CoinMpsIO::setMpsData(const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const char* rowsen, const double* rowrhs, const double* rowrng, char const * const * const colnames, char const * const * const rownames) { const int numrows = m.getNumRows(); double * rlb = numrows ? new double[numrows] : 0; double * rub = numrows ? new double[numrows] : 0; for (int i = 0; i < numrows; ++i) { convertSenseToBound(rowsen[i], rowrhs[i], rowrng[i], rlb[i], rub[i]); } setMpsData(m, infinity, collb, colub, obj, integrality, rlb, rub, colnames, rownames); delete [] rlb; delete [] rub; } void CoinMpsIO::setMpsData(const CoinPackedMatrix& m, const double infinity, const double* collb, const double* colub, const double* obj, const char* integrality, const char* rowsen, const double* rowrhs, const double* rowrng, const std::vector & colnames, const std::vector & rownames) { const int numrows = m.getNumRows(); double * rlb = numrows ? new double[numrows] : 0; double * rub = numrows ? new double[numrows] : 0; for (int i = 0; i < numrows; ++i) { convertSenseToBound(rowsen[i], rowrhs[i], rowrng[i], rlb[i], rub[i]); } setMpsData(m, infinity, collb, colub, obj, integrality, rlb, rub, colnames, rownames); delete [] rlb; delete [] rub; } void CoinMpsIO::setProblemName (const char *name) { free(problemName_) ; problemName_ = CoinStrdup(name) ; } void CoinMpsIO::setObjectiveName (const char *name) { free(objectiveName_) ; objectiveName_ = CoinStrdup(name) ; } //------------------------------------------------------------------ // Return true if column is a continuous, binary, ... //------------------------------------------------------------------ bool CoinMpsIO::isContinuous(int columnNumber) const { const char * intType = integerType_; if ( intType==NULL ) return true; assert (columnNumber>=0 && columnNumber < numberColumns_); if ( intType[columnNumber]==0 ) return true; return false; } /* Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ bool CoinMpsIO::isInteger(int columnNumber) const { const char * intType = integerType_; if ( intType==NULL ) return false; assert (columnNumber>=0 && columnNumber < numberColumns_); if ( intType[columnNumber]!=0 ) return true; return false; } // if integer const char * CoinMpsIO::integerColumns() const { return integerType_; } // Pass in array saying if each variable integer void CoinMpsIO::copyInIntegerInformation(const char * integerType) { if (integerType) { if (!integerType_) integerType_ = reinterpret_cast (malloc (numberColumns_ * sizeof(char))); memcpy(integerType_,integerType,numberColumns_); } else { free(integerType_); integerType_=NULL; } } // names - returns NULL if out of range const char * CoinMpsIO::rowName(int index) const { if (index>=0&&index=0&&index (malloc(numberRows_*sizeof(double))); rowupper_ = reinterpret_cast (malloc(numberRows_*sizeof(double))); memcpy(rowlower_,rhs.rowlower_,numberRows_*sizeof(double)); memcpy(rowupper_,rhs.rowupper_,numberRows_*sizeof(double)); } if (rhs.collower_) { collower_ = reinterpret_cast (malloc(numberColumns_*sizeof(double))); colupper_ = reinterpret_cast (malloc(numberColumns_*sizeof(double))); objective_ = reinterpret_cast (malloc(numberColumns_*sizeof(double))); memcpy(collower_,rhs.collower_,numberColumns_*sizeof(double)); memcpy(colupper_,rhs.colupper_,numberColumns_*sizeof(double)); memcpy(objective_,rhs.objective_,numberColumns_*sizeof(double)); } if (rhs.integerType_) { integerType_ = reinterpret_cast (malloc (numberColumns_*sizeof(char))); memcpy(integerType_,rhs.integerType_,numberColumns_*sizeof(char)); } free(fileName_); free(problemName_); free(objectiveName_); free(rhsName_); free(rangeName_); free(boundName_); fileName_ = CoinStrdup(rhs.fileName_); problemName_ = CoinStrdup(rhs.problemName_); objectiveName_ = CoinStrdup(rhs.objectiveName_); rhsName_ = CoinStrdup(rhs.rhsName_); rangeName_ = CoinStrdup(rhs.rangeName_); boundName_ = CoinStrdup(rhs.boundName_); numberHash_[0]=rhs.numberHash_[0]; numberHash_[1]=rhs.numberHash_[1]; defaultBound_=rhs.defaultBound_; infinity_=rhs.infinity_; smallElement_ = rhs.smallElement_; objectiveOffset_=rhs.objectiveOffset_; int section; for (section=0;section<2;section++) { if (numberHash_[section]) { char ** names2 = rhs.names_[section]; names_[section] = reinterpret_cast (malloc(numberHash_[section]* sizeof(char *))); char ** names = names_[section]; int i; for (i=0;i0) { delete cardReader_; cardReader_ = new CoinMpsCardReader ( input, this); } // See if QUADOBJ just found if (!filename&&cardReader_->whichSection ( ) == COIN_QUAD_SECTION ) { cardReader_->setWhichSection(COIN_QUAD_SECTION); } else if (cardReader_->whichSection ( ) == COIN_CONIC_SECTION ) { return -3; } else { cardReader_->readToNextSection(); // Skip NAME if ( cardReader_->whichSection ( ) == COIN_NAME_SECTION ) cardReader_->readToNextSection(); if ( cardReader_->whichSection ( ) == COIN_QUAD_SECTION ) { // save name of section free(problemName_); problemName_=CoinStrdup(cardReader_->columnName()); } else if ( cardReader_->whichSection ( ) == COIN_EOF_SECTION ) { handler_->message(COIN_MPS_EOF,messages_)<message(COIN_MPS_BADFILE1,messages_)<card() <cardNumber() < (malloc(maximumNonZeros*sizeof(int))); int * column2Temp = reinterpret_cast (malloc(maximumNonZeros*sizeof(int))); double * elementTemp = reinterpret_cast (malloc(maximumNonZeros*sizeof(double))); startHash(1); int numberElements=0; while ( cardReader_->nextField ( ) == COIN_QUAD_SECTION ) { switch ( cardReader_->mpsType ( ) ) { case COIN_BLANK_COLUMN: if ( fabs ( cardReader_->value ( ) ) > smallElement_ ) { if ( numberElements == maximumNonZeros ) { maximumNonZeros = ( 3 * maximumNonZeros ) / 2 + 1000; column = reinterpret_cast (realloc ( column, maximumNonZeros * sizeof ( COINColumnIndex ))); column2Temp = reinterpret_cast (realloc ( column2Temp, maximumNonZeros * sizeof ( COINColumnIndex ))); elementTemp = reinterpret_cast (realloc ( elementTemp, maximumNonZeros * sizeof ( double ))); } // get indices COINColumnIndex iColumn1 = findHash ( cardReader_->columnName ( ) , 1 ); COINColumnIndex iColumn2 = findHash ( cardReader_->rowName ( ) , 1 ); if ( iColumn1 >= 0 ) { if (iColumn2 >=0) { double value = cardReader_->value ( ); column[numberElements]=iColumn1; column2Temp[numberElements]=iColumn2; elementTemp[numberElements++]=value; } else { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_NOMATCHROW,messages_) <rowName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<message(COIN_MPS_NOMATCHCOL,messages_) <columnName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<whichSection ( ) != COIN_ENDATA_SECTION && cardReader_->whichSection ( ) != COIN_CONIC_SECTION ) { handler_->message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() <message(COIN_MPS_RETURNING,messages_)<0) { delete cardReader_; cardReader_ = new CoinMpsCardReader ( input, this); } // See if CSECTION just found if (!filename&&cardReader_->whichSection ( ) == COIN_CONIC_SECTION ) { cardReader_->setWhichSection(COIN_CONIC_SECTION); } else { cardReader_->readToNextSection(); // Skip NAME if ( cardReader_->whichSection ( ) == COIN_NAME_SECTION ) cardReader_->readToNextSection(); if ( cardReader_->whichSection ( ) == COIN_CONIC_SECTION ) { // looks good } else if ( cardReader_->whichSection ( ) == COIN_EOF_SECTION ) { handler_->message(COIN_MPS_EOF,messages_)<message(COIN_MPS_BADFILE1,messages_)<card() <cardNumber() <card()+strlen(cardReader_->card())-4; // Should be QUAD but if not don't complain int type=1; if (!strcmp(quad,"QUAD")) { if (*(quad-1)=='R') type=2; } coneType[0] = type; int numberErrors = 0; columnStart[0]=0; int numberElements=0; startHash(1); while ( cardReader_->nextField ( ) == COIN_CONIC_SECTION ) { const char * card = cardReader_->card(); if (!strncmp(card,"CSECTION",8)) { // check QUAD or RQUAD (by hand) - card has had end stripped const char * quad = card+strlen(card)-4; // Should be QUAD but if not don't complain int type=1; if (!strcmp(quad,"QUAD")) { if (*(quad-1)=='R') type=2; } if (numberElements==columnStart[numberCones]) { printf("Cone must have at least one column\n"); abort(); } columnStart[++numberCones]=numberElements; coneType[numberCones] = type; continue; } COINColumnIndex iColumn1; switch ( cardReader_->mpsType ( ) ) { case COIN_BLANK_COLUMN: // get index iColumn1 = findHash ( cardReader_->columnName ( ) , 1 ); if ( iColumn1 >= 0 ) { column[numberElements++]=iColumn1; } else { numberErrors++; if ( numberErrors < 100 ) { handler_->message(COIN_MPS_NOMATCHCOL,messages_) <columnName()<cardNumber()<card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<message(COIN_MPS_BADIMAGE,messages_)<cardNumber() <card() < 100000) { handler_->message(COIN_MPS_RETURNING,messages_)<whichSection ( ) == COIN_ENDATA_SECTION ) { // Error if no cones if (!numberElements) { handler_->message(COIN_MPS_EOF,messages_)<message(COIN_MPS_BADFILE1,messages_)<card() <cardNumber() <(strlen(id)+strlen(value)); if (numberStringElements_==maximumStringElements_) { maximumStringElements_ = 2*maximumStringElements_+100; char ** temp = new char * [maximumStringElements_]; for (int i=0;i (malloc(n+1)); stringElements_[numberStringElements_++]=line; strcpy(line,id); strcat(line,value); } // Decode string void CoinMpsIO::decodeString(int iString, int & iRow, int & iColumn, const char * & value) const { iRow=-1; iColumn=-1; value=NULL; if (iString>=0&&iStringstringsExist()) return 0; // no strings assert (!numberStringElements_); /* First columns (including objective==numberRows) then RHS(==numberColumns (+1)) (with rowLower and rowUpper marked) then bounds LO==numberRows+1, UP==numberRows+2 */ int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); int iColumn; for (iColumn=0;iColumngetColumnObjectiveAsString(iColumn); if (strcmp(expr,"Numeric")) { addString(numberRows,iColumn,expr); } CoinModelLink triple=model->firstInColumn(iColumn); while (triple.row()>=0) { int iRow = triple.row(); const char * expr = model->getElementAsString(iRow,iColumn); if (strcmp(expr,"Numeric")) { addString(iRow,iColumn,expr); } triple=model->next(triple); } } int iRow; for (iRow=0;iRowgetRowLowerAsString(iRow); const char * expr2 = model->getRowUpperAsString(iRow); if (strcmp(expr1,"Numeric")) { if (rowupper_[iRow]>1.0e20&&!strcmp(expr2,"Numeric")) { // G row addString(iRow,numberColumns,expr1); rowlower_[iRow]=STRING_VALUE; } else if (!strcmp(expr1,expr2)) { // E row addString(iRow,numberColumns,expr1); rowlower_[iRow]=STRING_VALUE; addString(iRow,numberColumns+1,expr1); rowupper_[iRow]=STRING_VALUE; } else if (rowlower_[iRow]<-1.0e20&&!strcmp(expr1,"Numeric")) { // L row addString(iRow,numberColumns+1,expr2); rowupper_[iRow]=STRING_VALUE; } else { // Range printf("Unaable to handle string ranges row %d %s %s\n", iRow,expr1,expr2); abort(); } } } // Bounds for (iColumn=0;iColumngetColumnLowerAsString(iColumn); if (strcmp(expr,"Numeric")) { addString(numberRows+1,iColumn,expr); collower_[iColumn]=STRING_VALUE; } expr = model->getColumnUpperAsString(iColumn); if (strcmp(expr,"Numeric")) { addString(numberRows+2,iColumn,expr); colupper_[iColumn]=STRING_VALUE; } } return numberStringElements_; } // Constructor CoinSet::CoinSet ( int numberEntries, const int * which) { numberEntries_ = numberEntries; which_ = new int [numberEntries_]; weights_ = NULL; memcpy(which_,which,numberEntries_*sizeof(int)); setType_=1; } // Default constructor CoinSet::CoinSet () { numberEntries_ = 0; which_ = NULL; weights_ = NULL; setType_=1; } // Copy constructor CoinSet::CoinSet (const CoinSet & rhs) { numberEntries_ = rhs.numberEntries_; setType_=rhs.setType_; which_ = CoinCopyOfArray(rhs.which_,numberEntries_); weights_ = CoinCopyOfArray(rhs.weights_,numberEntries_); } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CoinSet & CoinSet::operator=(const CoinSet& rhs) { if (this != &rhs) { delete [] which_; delete [] weights_; numberEntries_ = rhs.numberEntries_; setType_=rhs.setType_; which_ = CoinCopyOfArray(rhs.which_,numberEntries_); weights_ = CoinCopyOfArray(rhs.weights_,numberEntries_); } return *this; } // Destructor CoinSet::~CoinSet ( ) { delete [] which_; delete [] weights_; } // Constructor CoinSosSet::CoinSosSet ( int numberEntries, const int * which, const double * weights, int type) : CoinSet(numberEntries,which) { weights_= new double [numberEntries_]; memcpy(weights_,weights,numberEntries_*sizeof(double)); setType_ = type; double last = weights_[0]; int i; bool allSame=true; for (i=1;i #include #include "CoinPresolveMatrix.hpp" #include "CoinPresolveSubst.hpp" #include "CoinPresolveIsolated.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolveImpliedFree.hpp" #include "CoinPresolveUseless.hpp" #include "CoinPresolveForcing.hpp" #include "CoinMessage.hpp" #include "CoinHelperFunctions.hpp" #include "CoinSort.hpp" #include "CoinFinite.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif static int numberBadElements=0; int check_row (CoinBigIndex *mrstrt, double *rowels, int *hcol, int *hinrow, double coeff_factor, double kill_ratio, int irowx, int irowy) { const double tolerance = kill_ratio*coeff_factor; CoinBigIndex krsy = mrstrt[irowy] ; CoinBigIndex krey = krsy+hinrow[irowy] ; CoinBigIndex krsx = mrstrt[irowx] ; CoinBigIndex krex = krsx+hinrow[irowx] ; CoinBigIndex krowx = krsx ; int nFill=0; for (CoinBigIndex krowy = krsy ; krowy < krey ; krowy++) { int j = hcol[krowy] ; while (krowx < krex && hcol[krowx] < j) krowx++ ; double newcoeff; if (krowx < krex && hcol[krowx] == j) { newcoeff = rowels[krowx]+rowels[krowy]*coeff_factor ; } else { newcoeff = rowels[krowy]*coeff_factor ; nFill++; } // kill small if (fabs(newcoeff) 0.1*tolerance) numberBadElements++; nFill--; } krowx++ ; } return nFill; } /* Implied Free and Subst Transforms If there is a constraint i entangled with a singleton column x(t) such that for any feasible (with respect to column bounds) values of the other variables in the constraint we can calculate a feasible value for x(t), then we can drop x(t) and constraint i, since we can compute the value of x(t) from the values of the other variables during postsolve. To put this into practice, calculate bounds L(i\t) and U(i\t) on row activity and use those bounds to calculate implied lower and upper bounds l'(t) and u'(t) on x(t). If the implied bounds are tighter than the original column bounds l(t) and u(t) (the implied free condition), we can drop constraint i and x(t). If x(t) is not a natural singleton, we can still do something similar. Let constraint i be an equality constraint that satisfies the implied free condition. In that case, we use constraint i to generate a substitution formula and substitute away x(t) in any other constraints where it appears. This introduces new coefficients, but the total number of coefficients never increases if x(t) is entangled with only two constraints (coefficients added during substitution are cancelled by dropping constraint i). The total may not increase much even if there are more. Both situations are detected in implied_free_action::presolve. Natural singletons are processed by implied_free_action::presolve. The rest are passed to subst_constraint_action (which see). It is possible for two singleton columns to be in the same row. In that case, the other one will become empty. If its bounds and costs aren't just right, this signals an unbounded problem. We don't need to check that specially here. There is a superficial (and misleading) similarity to a useless constraint. A useless constraint cannot be made tight for *any* feasible values of its variables. Here, it's possible we could pick some feasible value of x(t) that *would* violate the constraint. */ /* Scan for candidates for the implied free and subst transforms (see comments at head of file and in CoinPresolveSubst.cpp). Process natural singletons. Pass more complicated cases to subst_constraint_action. fill_level limits the allowable number of coefficients in a column under consideration as the implied free variable. There's a feedback loop between implied_free_action and the presolve driver. The feedback loop operates as follows: If we're not finding enough transforms and fill_level < maxSubstLevel_, increase it by one and pass it back out negated. The presolve driver can act on this, if it chooses, or simply pass it back in on the next call to implied_free_action. If implied_free_action sees a negative value, it will look at all columns, instead of just those in colsToDo_. */ const CoinPresolveAction *implied_free_action::presolve ( CoinPresolveMatrix *prob, const CoinPresolveAction *next, int &fill_level) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering implied_free_action::presolve, fill level " << fill_level << "." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 const int startEmptyRows = prob->countEmptyRows() ; const int startEmptyColumns = prob->countEmptyCols() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0 ; if (prob->tuning_) startTime = CoinCpuTime() ; # endif # endif /* Unpack the row- and column-major representations. */ const int m = prob->nrows_ ; const int n = prob->ncols_ ; const CoinBigIndex *rowStarts = prob->mrstrt_ ; int *rowLengths = prob->hinrow_ ; const int *colIndices = prob->hcol_ ; const double *rowCoeffs = prob->rowels_ ; presolvehlink *rlink = prob->rlink_ ; CoinBigIndex *colStarts = prob->mcstrt_ ; int *colLengths = prob->hincol_ ; int *rowIndices = prob->hrow_ ; double *colCoeffs = prob->colels_ ; presolvehlink *clink = prob->clink_ ; /* Column bounds, row bounds, cost, integrality. */ double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *cost = prob->cost_ ; const unsigned char *integerType = prob->integerType_ ; /* Documented as `inhibit x+y+z = 1 mods'. From the code below, it's clear that this is intended to avoid removing SOS equalities with length >= 5 (hardcoded). */ const bool stopSomeStuff = ((prob->presolveOptions()&0x04) != 0) ; /* Ignore infeasibility. `Fix' is overly optimistic. */ const bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; /* Defaults to 0.0. */ const double feasTol = prob->feasibilityTolerance_ ; # if 0 /* Tentatively moved to be a front-end function for useless_constraint_action, much as make_fixed is a front-end for make_fixed_action. This bit of code left for possible tuning. -- lh, 121127 -- Original comment: This needs to be made faster. */ # ifdef COIN_LIGHTWEIGHT_PRESOLVE if (prob->pass_ == 1) { #else if (prob->presolveOptions_&0x10) { # endif next = testRedundant(prob,next) ; if (prob->status_&0x01 != 0) { if ((prob->presolveOptions_&0x4000) != 0) prob->status_ &= !0x01 ; else return (next) ; } # if 1 //def COIN_LIGHTWEIGHT_PRESOLVE } # endif # endif /* implied_free and subst take a fair bit of effort to scan for candidates. This is a hook to allow a presolve driver to avoid that work. */ if (prob->pass_ > 15 && (prob->presolveOptions_&0x10000) != 0) { fill_level = 2 ; return (next) ; } /* Set up to collect implied_free actions. */ action *actions = new action [n] ; # ifdef ZEROFAULT CoinZeroN(reinterpret_cast(actions),n*sizeof(action)) ; # endif int nactions = 0 ; int *implied_free = prob->usefulColumnInt_ ; int *whichFree = implied_free+n ; int numberFree = 0 ; /* Arrays to hold row activity (row lhs) min and max values. Each row lhs bound is held as two components: a sum of finite column bounds and a count of infinite column bounds. */ int *infiniteDown = new int[m] ; int *infiniteUp = new int[m] ; double *maxDown = new double[m] ; double *maxUp = new double[m] ; /* Overload infiniteUp with row status codes: -1: L(i)/U(i) not yet computed, -2: do not use (empty or useless row), -3: give up (infeasible) -4: chosen as implied free row */ for (int i = 0 ; i < m ; i++) { if (rowLengths[i] > 1) infiniteUp[i] = -1 ; else infiniteUp[i] = -2 ; } // Get rid of rows with prohibited columns if (prob->anyProhibited_) { for (int i = 0 ; i < m ; i++) { CoinBigIndex rStart = rowStarts[i]; CoinBigIndex rEnd = rStart+rowLengths[i]; bool badRow=false; for (CoinBigIndex j = rStart; j < rEnd; ++j) { if (prob->colProhibited(colIndices[j])) { badRow=true; break; } } if (badRow) infiniteUp[i] = -2 ; } } // Can't go on without a suitable finite infinity, can we? #ifdef USE_SMALL_LARGE const double large = 1.0e10 ; #else const double large = 1.0e20 ; #endif /* Decide which columns we're going to look at. There are columns already queued in colsToDo_, but sometimes we want to look at all of them. Don't suck in prohibited columns. See comments at the head of the routine for fill_level. NOTE the overload on usefulColumnInt_. It was assigned above to whichFree (indices of interesting columns). We'll be ok because columns are consumed out of look at one per main loop iteration, but not all columns are interesting. Original comment: if gone from 2 to 3 look at all */ int numberLook = prob->numberColsToDo_ ; int iLook ; int *look = prob->colsToDo_ ; if (fill_level < 0) { look = prob->usefulColumnInt_+n ; if (!prob->anyProhibited()) { CoinIotaN(look,n,0) ; numberLook = n ; } else { numberLook = 0 ; for (iLook = 0 ; iLook < n ; iLook++) if (!prob->colProhibited(iLook)) look[numberLook++] = iLook ; } } /* Step through the columns of interest looking for suitable x(tgt). Interesting columns are limited by number of nonzeros to minimise fill-in during substitution. */ bool infeas = false ; const int maxLook = abs(fill_level) ; for (iLook = 0 ; iLook < numberLook ; iLook++) { const int tgtcol = look[iLook] ; const int tgtcol_len = colLengths[tgtcol] ; if (tgtcol_len <= 0 || tgtcol_len > maxLook) continue ; /* Set up to reconnoiter the column. The initial value for ait_max is chosen to make sure that anything that satisfies the stability check is big enough to use (though we'd clearly like something better). */ const CoinBigIndex kcs = colStarts[tgtcol] ; const CoinBigIndex kce = kcs+tgtcol_len ; const bool singletonCol = (tgtcol_len == 1) ; bool possibleRow = false ; bool singletonRow = false ; double ait_max = 20*ZTOLDP2 ; /* If this is a singleton column, the only concern is that the row is not a singleton row (that has its own, simpler, transform: slack_doubleton). But make sure we're not dealing with some tiny a(it). Note that there's no point in marking a singleton row. By definition, we won't encounter it again. */ if (singletonCol) { const int i = rowIndices[kcs] ; singletonRow = (rowLengths[i] == 1) ; possibleRow = (fabs(colCoeffs[kcs]) > ZTOLDP2) ; } else { /* If the column is not a singleton, we'll need a numerically stable substitution formula. Check that this is possible. One of the entangled rows must be an equality with a numerically stable coefficient, at least .1*MAX{i}a(it). */ for (CoinBigIndex kcol = kcs ; kcol < kce ; ++kcol) { const int i = rowIndices[kcol] ; if (rowLengths[i] == 1) { singletonRow = true ; break ; } const double abs_ait = fabs(colCoeffs[kcol]) ; ait_max = CoinMax(ait_max,abs_ait) ; if (fabs(rlo[i]-rup[i]) < feasTol && abs_ait > .1*ait_max) { possibleRow = true ; } } } if (singletonRow || !possibleRow) continue ; /* The column has possibilities. Walk the column, calculate row activity bounds L(i) and U(i) for suitable entangled rows, then calculate the improvement (if any) on the column bounds for l(j) and u(j). The goal is to satisfy the implied free condition over all entangled rows and find at least one row suitable for a substitution formula (if the column is not a natural singleton). Suitable: If this is a natural singleton, we need to look at the single entangled constraint. If we're attempting to create a singleton by substitution, only look at equalities with stable coefficients. If x(t) is integral, make sure the scaled rhs will be integral. */ # if PRESOLVE_DEBUG > 2 std::cout << " Checking x(" << tgtcol << "), " << tgtcol_len << " nonzeros" << ", l(" << tgtcol << ") " << clo[tgtcol] << ", u(" << tgtcol << ") " << cup[tgtcol] << ", c(" << tgtcol << ") " << cost[tgtcol] << "." << std::endl ; # endif const double lt = clo[tgtcol] ; const double ut = cup[tgtcol] ; double impliedLow = -COIN_DBL_MAX ; double impliedHigh = COIN_DBL_MAX ; int subst_ndx = -1 ; int subst_len = n ; for (CoinBigIndex kcol = kcs ; kcol < kce ; ++kcol) { const int i = rowIndices[kcol] ; assert(infiniteUp[i] != -3) ; if (infiniteUp[i] <= -2) continue ; const double ait = colCoeffs[kcol] ; const int leni = rowLengths[i] ; const double rloi = rlo[i] ; const double rupi = rup[i] ; /* A suitable row for substitution must * be an equality; * the entangled coefficient must be large enough to be numerically stable; * if x(t) is integer, the constant term in the substitution formula must be integer. */ bool rowiOK = (fabs(rloi-rupi) < feasTol) && (fabs(ait) > .1*ait_max) ; rowiOK = rowiOK && ((integerType[tgtcol] == 0) || (fabs((rloi/ait)-floor((rloi/ait)+0.5)) < feasTol)) ; /* If we don't already have L(i) and U(i), calculate now. Check for useless and infeasible constraints when that's done. */ int infUi = 0 ; int infLi = 0 ; double maxUi = 0.0 ; double maxLi = 0.0 ; const CoinBigIndex krs = rowStarts[i] ; const CoinBigIndex kre = krs+leni ; if (infiniteUp[i] == -1) { for (CoinBigIndex krow = krs ; krow < kre ; ++krow) { const double aik = rowCoeffs[krow] ; const int k = colIndices[krow] ; const double lk = clo[k] ; const double uk = cup[k] ; if (aik > 0.0) { if (uk < large) maxUi += uk*aik ; else ++infUi ; if (lk > -large) maxLi += lk*aik ; else ++infLi ; } else if (aik < 0.0) { if (uk < large) maxLi += uk*aik ; else ++infLi ; if (lk > -large) maxUi += lk*aik ; else ++infUi ; } } const double maxUinf = maxUi+infUi*1.0e31 ; const double maxLinf = maxLi-infLi*1.0e31 ; if (maxUinf <= rupi+feasTol && maxLinf >= rloi-feasTol) { infiniteUp[i] = -2 ; } else if (maxUinf < rloi-feasTol && !fixInfeasibility) { prob->status_|= 1 ; infeas = true ; prob->messageHandler()->message(COIN_PRESOLVE_ROWINFEAS, prob->messages()) << i << rloi << rupi << CoinMessageEol ; infiniteUp[i] = -3 ; } else if (maxLinf > rupi+feasTol && !fixInfeasibility) { prob->status_|= 1 ; infeas = true ; prob->messageHandler()->message(COIN_PRESOLVE_ROWINFEAS, prob->messages()) << i << rloi << rupi << CoinMessageEol ; infiniteUp[i] = -3 ; } else { infiniteUp[i] = infUi ; infiniteDown[i] = infLi ; maxUp[i] = maxUi ; maxDown[i] = maxLi ; } } else { infUi = infiniteUp[i] ; infLi = infiniteDown[i] ; maxUi = maxUp[i] ; maxLi = maxDown[i] ; } # if PRESOLVE_DEBUG > 2 std::cout << " row(" << i << ") " << leni << " nonzeros, blow " << rloi << ", L (" << infLi << "," << maxLi << "), U (" << infUi << "," << maxUi << "), b " << rupi ; if (infeas) std::cout << " infeas" ; if (infiniteUp[i] == -2) std::cout << " useless" ; std::cout << "." << std::endl ; # endif /* If we're infeasible, no sense checking further; escape the implied bound loop. The other possibility is that we've just discovered the constraint is useless, in which case we just move on to the next one in the column. */ if (infeas) break ; if (infiniteUp[i] == -2) continue ; assert(infiniteUp[i] >= 0 && infiniteUp[i] <= leni) ; /* At this point we have L(i) and U(i), expressed as finite and infinite components, and constraint i is neither useless or infeasible. Calculate the implied bounds l'(t) and u'(t) on x(t). The calculation (for a(it) > 0) is u'(t) <= (b(i) - (L(i)-a(it)l(t)))/a(it) = l(t)+(b(i)-L(i))/a(it) l'(t) >= (blow(i) - (U(i)-a(it)u(t)))/a(it) = u(t)+(blow(i)-U(i))/a(it) Insert the appropriate flips for a(it) < 0. Notice that if there's exactly one infinite contribution to L(i) or U(i) and x(t) is responsible, then the finite portion of L(i) or U(i) is already correct. Cut some slack for possible numerical inaccuracy if the finite portion of L(i) or U(i) is very large. If the new bound is very large, force it to infinity. */ double ltprime = -COIN_DBL_MAX ; double utprime = COIN_DBL_MAX ; if (ait > 0.0) { if (rloi > -large) { if (!infUi) { assert(ut < large) ; ltprime = ut+(rloi-maxUi)/ait ; if (fabs(maxUi) > 1.0e8 && !singletonCol) ltprime -= 1.0e-12*fabs(maxUi) ; } else if (infUi == 1 && ut > large) { ltprime = (rloi-maxUi)/ait ; if (fabs(maxUi) > 1.0e8 && !singletonCol) ltprime -= 1.0e-12*fabs(maxUi) ; } else { ltprime = -COIN_DBL_MAX ; } impliedLow = CoinMax(impliedLow,ltprime) ; } if (rupi < large) { if (!infLi) { assert(lt > -large) ; utprime = lt+(rupi-maxLi)/ait ; if (fabs(maxLi) > 1.0e8 && !singletonCol) utprime += 1.0e-12*fabs(maxLi) ; } else if (infLi == 1 && lt < -large) { utprime = (rupi-maxLi)/ait ; if (fabs(maxLi) > 1.0e8 && !singletonCol) utprime += 1.0e-12*fabs(maxLi) ; } else { utprime = COIN_DBL_MAX ; } impliedHigh = CoinMin(impliedHigh,utprime) ; } } else { if (rloi > -large) { if (!infUi) { assert(lt > -large) ; utprime = lt+(rloi-maxUi)/ait ; if (fabs(maxUi) > 1.0e8 && !singletonCol) utprime += 1.0e-12*fabs(maxUi) ; } else if (infUi == 1 && lt < -large) { utprime = (rloi-maxUi)/ait ; if (fabs(maxUi) > 1.0e8 && !singletonCol) utprime += 1.0e-12*fabs(maxUi) ; } else { utprime = COIN_DBL_MAX ; } impliedHigh = CoinMin(impliedHigh,utprime) ; } if (rupi < large) { if (!infLi) { assert(ut < large) ; ltprime = ut+(rupi-maxLi)/ait ; if (fabs(maxLi) > 1.0e8 && !singletonCol) ltprime -= 1.0e-12*fabs(maxLi) ; } else if (infLi == 1 && ut > large) { ltprime = (rupi-maxLi)/ait ; if (fabs(maxLi) > 1.0e8 && !singletonCol) ltprime -= 1.0e-12*fabs(maxLi) ; } else { ltprime = -COIN_DBL_MAX ; } impliedLow = CoinMax(impliedLow,ltprime) ; } } # if PRESOLVE_DEBUG > 2 std::cout << " row(" << i << ") l'(" << tgtcol << ") " << ltprime << ", u'(" << tgtcol << ") " << utprime ; if (lt <= impliedLow && impliedHigh <= ut) std::cout << "; implied free satisfied" ; std::cout << "." << std::endl ; # endif /* For x(t) integral, see if a substitution formula based on row i will preserve integrality. The final check in this clause aims to preserve SOS equalities (i.e., don't eliminate a non-trivial SOS equality from the system using this transform). Note that this can't be folded into the L(i)/U(i) loop because the answer changes with x(t). Original comment: can only accept if good looking row */ if (integerType[tgtcol]) { possibleRow = true ; bool allOnes = true ; for (CoinBigIndex krow = krs ; krow < kre ; ++krow) { const int j = colIndices[krow] ; const double scaled_aij = rowCoeffs[krow]/ait ; if (fabs(scaled_aij) != 1.0) allOnes = false ; if (!integerType[j] || fabs(scaled_aij-floor(scaled_aij+0.5)) > feasTol) { possibleRow = false ; break ; } } if (rloi == 1.0 && leni >= 5 && stopSomeStuff && allOnes) possibleRow = false ; rowiOK = rowiOK && possibleRow ; } /* Do we have a winner? If we have an incumbent, prefer the one with fewer coefficients. */ if (rowiOK) { if (subst_ndx < 0 || (leni < subst_len)) { # if PRESOLVE_DEBUG > 2 std::cout << " row(" << i << ") now candidate for x(" << tgtcol << ")." << std::endl ; # endif subst_ndx = i ; subst_len = leni ; } } } if (infeas) break ; /* Can we do the transform? If so, subst_ndx will have a valid row. Record the implied free variable and the equality we'll use to substitute it out. Take the row out of the running --- we can't use the same row for two substitutions. */ if (lt <= impliedLow && impliedHigh <= ut && (subst_ndx >= 0 || singletonRow)) { implied_free[numberFree] = subst_ndx ; infiniteUp[subst_ndx] = -4 ; whichFree[numberFree++] = tgtcol ; # if PRESOLVE_DEBUG > 1 std::cout << " x(" << tgtcol << ") implied free by row " << subst_ndx << std::endl ; # endif } } delete[] infiniteDown ; delete[] infiniteUp ; delete[] maxDown ; delete[] maxUp ; /* If we're infeasible, there's nothing more to be done. */ if (infeas) { # if PRESOLVE_SUMMARY > 0 || PRESOLVE_DEBUG > 0 std::cout << " IMPLIED_FREE: infeasible." << std::endl ; # endif return (next) ; } /* We have a list of implied free variables, each with a row that can be used to substitute the variable to singleton status if the variable is not a natural singleton. The loop here will only process natural singletons. We'll hand the remainder to subst_constraint_action below, if there is a remainder. The natural singletons processed here are compressed out of whichFree and implied_free. */ int unprocessed = 0 ; for (iLook = 0 ; iLook < numberFree ; iLook++) { const int tgtcol = whichFree[iLook] ; if (colLengths[tgtcol] != 1) { whichFree[unprocessed] = whichFree[iLook] ; implied_free[unprocessed] = implied_free[iLook] ; unprocessed++ ; continue ; } const int tgtrow = implied_free[iLook] ; const int tgtrow_len = rowLengths[tgtrow] ; const CoinBigIndex kcs = colStarts[tgtcol] ; const double tgtcol_coeff = colCoeffs[kcs] ; const double tgtcol_cost = cost[tgtcol] ; const CoinBigIndex krs = rowStarts[tgtrow] ; const CoinBigIndex kre = krs+tgtrow_len ; if (tgtcol_cost != 0.0) { // Check costs don't make unstable //double minOldCost=COIN_DBL_MAX; double maxOldCost=0.0; //double minNewCost=COIN_DBL_MAX; double maxNewCost=0.0; for (CoinBigIndex krow = krs ; krow < kre ; krow++) { const int j = colIndices[krow] ; if (j != tgtcol) { double oldCost = cost[j] ; double newCost = oldCost - (tgtcol_cost*rowCoeffs[krow])/tgtcol_coeff ; oldCost = fabs(oldCost); newCost = fabs(newCost); //minOldCost=CoinMin(minOldCost,oldCost); maxOldCost=CoinMax(maxOldCost,oldCost); //minNewCost=CoinMin(minNewCost,newCost); maxNewCost=CoinMax(maxNewCost,newCost); } } if (maxNewCost>1000.0*(maxOldCost+1.0) && maxOldCost) { //printf("too big %d tgtcost %g maxOld %g maxNew %g\n", // tgtcol,tgtcol_cost,maxOldCost,maxNewCost); continue; } } /* Initialise the postsolve action. We need to remember the row and column. */ action *s = &actions[nactions++] ; s->row = tgtrow ; s->col = tgtcol ; s->clo = clo[tgtcol] ; s->cup = cup[tgtcol] ; s->rlo = rlo[tgtrow] ; s->rup = rup[tgtrow] ; s->ninrow = tgtrow_len ; s->rowels = presolve_dupmajor(rowCoeffs,colIndices,tgtrow_len,krs) ; s->costs = NULL ; /* We're processing a singleton, hence no substitutions in the matrix, but we do need to fix up the cost vector. The substitution formula is x(t) = (rhs(i) - SUM{j\t}a(ik)x(k))/a(it) hence c'(k) = c(k)-c(t)a(ik)/a(it) and there's a constant offset c(t)rhs(i)/a(it). where rhs(i) is one of blow(i) or b(i). For general constraints where blow(i) != b(i), we need to take a bit of care. If only one of blow(i) or b(i) is finite, that's the one to use. Where we have two finite but unequal bounds, choose the bound that will result in the most favourable value for x(t). For minimisation, if c(t) < 0 we want to maximise x(t), so choose b(i) if a(it) > 0, blow(i) if a(it) < 0. A bit of case analysis says choose b(i) when c(t)a(it) < 0, blow(i) when c(t)a(it) > 0. We shouldn't be here if both row bounds are infinite. Fortunately, the objective coefficients are not affected by this. */ if (tgtcol_cost != 0.0) { double tgtrow_rhs = rup[tgtrow] ; if (fabs(rlo[tgtrow]-rup[tgtrow]) > feasTol) { const double rlot = rlo[tgtrow] ; const double rupt = rup[tgtrow] ; if (rlot > -COIN_DBL_MAX && rupt < COIN_DBL_MAX) { if ((tgtcol_cost*tgtcol_coeff) > 0) tgtrow_rhs = rlot ; else tgtrow_rhs = rupt ; } else if (rupt >= COIN_DBL_MAX) { tgtrow_rhs = rlot ; } } assert(fabs(tgtrow_rhs) <= large) ; double *save_costs = new double[tgtrow_len] ; for (CoinBigIndex krow = krs ; krow < kre ; krow++) { const int j = colIndices[krow] ; save_costs[krow-krs] = cost[j] ; cost[j] -= (tgtcol_cost*rowCoeffs[krow])/tgtcol_coeff ; } prob->change_bias((tgtcol_cost*tgtrow_rhs)/tgtcol_coeff) ; cost[tgtcol] = 0.0 ; s->costs = save_costs ; } /* Remove the row from the column-major representation, queuing up each column for reconsideration. Then remove the row from the row-major representation. */ for (CoinBigIndex krow = krs ; krow < kre ; krow++) { const int j = colIndices[krow] ; presolve_delete_from_col(tgtrow,j,colStarts,colLengths,rowIndices, colCoeffs) ; if (colLengths[j] == 0) { PRESOLVE_REMOVE_LINK(prob->clink_,j) ; } else { prob->addCol(j) ; } } PRESOLVE_REMOVE_LINK(clink,tgtcol) ; colLengths[tgtcol] = 0 ; PRESOLVE_REMOVE_LINK(rlink,tgtrow) ; rowLengths[tgtrow] = 0 ; rlo[tgtrow] = 0.0 ; rup[tgtrow] = 0.0 ; } /* We're done with the natural singletons. Trim actions to length and create the postsolve object. */ if (nactions) { # if PRESOLVE_SUMMARY > 0 || PRESOLVE_DEBUG > 0 printf("NIMPLIED FREE: %d\n", nactions) ; # endif action *actions1 = new action[nactions] ; CoinMemcpyN(actions, nactions, actions1) ; next = new implied_free_action(nactions,actions1,next) ; } delete [] actions ; # if PRESOLVE_DEBUG > 0 std::cout << " IMPLIED_FREE: identified " << numberFree << " implied free transforms, processed " << numberFree-unprocessed << " natural singletons." << std::endl ; # endif /* Now take a stab at the columns that aren't natural singletons, if there are any left. */ if (unprocessed != 0) { // if not integer - don't allow much fill if (!prob->anyInteger()) { int numberFree=unprocessed; int nBad=0; unprocessed=0; // Take out ones that make much denser or might lead to instability /* Unpack the row- and column-major representations. */ CoinBigIndex *rowStarts = prob->mrstrt_ ; int *rowLengths = prob->hinrow_ ; double *rowCoeffs = prob->rowels_ ; int *colIndices = prob->hcol_ ; CoinBigIndex *colStarts = prob->mcstrt_ ; int *colLengths = prob->hincol_ ; double *colCoeffs = prob->colels_ ; int *rowIndices = prob->hrow_ ; /* This array is used to hold the indices of columns involved in substitutions, where we have the potential for cancellation. At the end they'll be checked to eliminate any actual zeros that may result. NOTE that usefulColumnInt_ is already in use for parameters implied_free and whichFree when this routine is called from implied_free. */ int *rowsUsed = &prob->usefulRowInt_[0] ; int nRowsUsed = 0 ; /* Open a loop to process the (equality r, implied free variable t) pairs in whichFree and implied_free. It can happen that removal of (row, natural singleton) pairs back in implied_free will reduce the length of column t. It can also happen that previous processing here has resulted in fillin or cancellation. So check again for column length and exclude natural singletons and overly dense columns. */ for (int iLook = 0 ; iLook < numberFree ; iLook++) { const int tgtcol = whichFree[iLook] ; const int tgtrow = implied_free[iLook] ; if (colLengths[tgtcol] < 2 || colLengths[tgtcol] > maxLook) { # if PRESOLVE_DEBUG > 3 std::cout << " skipping eqn " << tgtrow << " x(" << tgtcol << "); length now " << colLengths[tgtcol] << "." << std::endl ; # endif continue ; } CoinBigIndex tgtcs = colStarts[tgtcol] ; CoinBigIndex tgtce = tgtcs+colLengths[tgtcol] ; /* A few checks to make sure that the candidate pair is still suitable. Processing candidates earlier in the list can eliminate coefficients. * Don't use this pair if any involved row i has become a row singleton or empty. * Don't use this pair if any involved row has been modified as part of the processing for a previous candidate pair on this call. * Don't use this pair if a(i,tgtcol) has become zero. The checks on a(i,tgtcol) seem superfluous but it's possible that implied_free identified two candidate pairs to eliminate the same column. If we've already processed one of them, we could be in trouble. */ double tgtcoeff = 0.0 ; bool dealBreaker = false ; for (CoinBigIndex kcol = tgtcs ; kcol < tgtce ; ++kcol) { const int i = rowIndices[kcol] ; if (rowLengths[i] < 2 || prob->rowUsed(i)) { dealBreaker = true ; break ; } const double aij = colCoeffs[kcol] ; if (fabs(aij) <= ZTOLDP2) { dealBreaker = true ; break ; } if (i == tgtrow) tgtcoeff = aij ; } if (dealBreaker == true) { # if PRESOLVE_DEBUG > 3 std::cout << " skipping eqn " << tgtrow << " x(" << tgtcol << "); deal breaker (1)." << std::endl ; # endif continue ; } /* Check for numerical stability.A large coeff_factor will inflate the coefficients in the substitution formula. */ dealBreaker = false ; for (CoinBigIndex kcol = tgtcs ; kcol < tgtce ; ++kcol) { const double coeff_factor = fabs(colCoeffs[kcol]/tgtcoeff) ; if (coeff_factor > 10.0) dealBreaker = true ; } if (dealBreaker == true) { # if PRESOLVE_DEBUG > 3 std::cout << " skipping eqn " << tgtrow << " x(" << tgtcol << "); deal breaker (2)." << std::endl ; # endif continue ; } /* Count up the total number of coefficients in entangled rows and mark them as contaminated. */ int ntotels = 0 ; for (CoinBigIndex kcol = tgtcs ; kcol < tgtce ; ++kcol) { const int i = rowIndices[kcol] ; ntotels += rowLengths[i] ; PRESOLVEASSERT(!prob->rowUsed(i)) ; prob->setRowUsed(i) ; rowsUsed[nRowsUsed++] = i ; } CoinBigIndex tgtrs = rowStarts[tgtrow] ; CoinBigIndex tgtre = tgtrs+rowLengths[tgtrow] ; // kill small if wanted int relax= (prob->presolveOptions()&0x60000)>>17; double tolerance = 1.0e-12; for (int i=0;i2*(colLengths[tgtcol]+rowLengths[tgtrow])) { //printf("Bad subst col %d row %d - %d small elements, fill %d\n", // tgtcol,tgtrow,numberBadElements,numberFill); if (numberBadElements) nBad++; } else { whichFree[unprocessed]=tgtcol; implied_free[unprocessed++]=tgtrow; //printf("Good subst col %d row %d - fill %d\n", // tgtcol,tgtrow,numberFill); } } /* That's it, we've processed all the candidate pairs. Clear the row used flags. */ for (int i = 0 ; i < nRowsUsed ; i++) prob->unsetRowUsed(rowsUsed[i]) ; #if CLP_USEFUL_PRINTOUT printf("%d allowed through out of %d - %d on coefficient\n", unprocessed,numberFree,nBad); #endif } next = subst_constraint_action::presolve(prob,implied_free,whichFree, unprocessed,next,maxLook) ; } /* Give some feedback to the presolve driver. If we aren't finding enough candidates and haven't reached the limit, bump fill_level and return a negated value. The presolve driver can tweak this value or simply return it on the next call. See the top of the routine for a full explanation. */ if (numberFree < 30 && maxLook < prob->maxSubstLevel_) { fill_level = -(maxLook+1) ; } else { fill_level = maxLook ; } # if COIN_PRESOLVE_TUNING > 0 double thisTime ; if (prob->tuning_) thisTime = CoinCpuTime() ; # endif # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving implied_free_action::presolve, fill level " << fill_level << ", " << droppedRows << " rows, " << droppedColumns << " columns dropped" ; # if COIN_PRESOLVE_TUNING > 0 std::cout << " in " << thisTime-startTime << "s" ; # endif std::cout << "." << std::endl ; # endif return (next) ; } const char *implied_free_action::name() const { return ("implied_free_action") ; } /* Restore the target constraint and target column x(t) eliminated by the implied free presolve action. We'll solve the target constraint to get a value for x(t), so by construction the constraint is tight. For range constraints, we need to consider both the upper and lower row bounds when calculating a value for x(t). x(t) can end up at one of its column bounds or strictly between bounds. Then there's the matter of patching up the basis and solution. The natural thing to do is to make the logical nonbasic and x(t) basic. No corrections to duals or reduced costs are required because we built that correction into the problem when we modified the objective. Work the linear algebra; it's very neat. It will frequently happen that the implied bounds on x(t) are simply equal to the existing column bounds and the value we calculate here will be at one of the original column bounds. This leaves x(t) degenerate basic. The original version of this routine looked for this and attempted to make x(t) nonbasic and use the logical as the basic variable. The linear algebra for this is ugly. To calculate the proper correction for the dual variables requires the basis inverse (terms do not conveniently cancel). The original code made no attempt to fix the duals and applied a correction to the reduced costs that was valid only for the nonbasic partition. It accepted the result if it was dual feasible. In general this would leave slack dual constraints. It's really not possible to predict the effect going forward on subsequent postsolve transforms. Nor is it clear to me that a degenerate basic architectural is inherently worse than a degenerate basic logical. This version of the code always makes x(t) basic. */ void implied_free_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_ ; const int nactions = nactions_ ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 char *cdone = prob->cdone_ ; char *rdone = prob->rdone_ ; # if PRESOLVE_DEBUG > 0 std::cout << "Entering implied_free_action::postsolve, " << nactions << " transforms to undo." << std::endl ; # endif presolve_check_threads(prob) ; presolve_check_free_list(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif /* Unpack the column-major representation. */ CoinBigIndex *colStarts = prob->mcstrt_ ; int *colLengths = prob->hincol_ ; int *rowIndices = prob->hrow_ ; double *colCoeffs = prob->colels_ ; CoinBigIndex *link = prob->link_ ; CoinBigIndex &free_list = prob->free_list_ ; /* Column bounds, row bounds, and cost. */ double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; double *cost = prob->cost_ ; /* Solution, reduced costs, duals, row activity. */ double *sol = prob->sol_ ; double *rcosts = prob->rcosts_ ; double *acts = prob->acts_ ; double *rowduals = prob->rowduals_ ; /* In your dreams ... hardwired to minimisation. */ const double maxmin = 1.0 ; /* And a suitably small infinity. */ const double large = 1.0e20 ; /* Open a loop to restore the row and column for each action. Start by unpacking the action. There won't be saved costs if the original cost c(t) was zero. */ for (const action *f = &actions[nactions-1] ; actions <= f ; f--) { const int tgtrow = f->row ; const int tgtcol = f->col ; const int tgtrow_len = f->ninrow ; const double *tgtrow_coeffs = f->rowels ; const int *tgtrow_cols = reinterpret_cast(tgtrow_coeffs+tgtrow_len) ; const double *saved_costs = f->costs ; # if PRESOLVE_DEBUG > 2 std::cout << " restoring col " << tgtcol << " row " << tgtrow ; if (saved_costs != 0) std::cout << ", modified costs" ; std::cout << "." << std::endl ; # endif /* Restore the target row and column and the original cost coefficients. We need to initialise the target column; for others, just bump the coefficient count. While we're restoring the row, pick off the coefficient for x(t) and calculate the row activity. */ double tgt_coeff = 0.0 ; double tgtrow_act = 0.0 ; for (int krow = 0 ; krow < tgtrow_len ; krow++) { const int j = tgtrow_cols[krow] ; const double atj = tgtrow_coeffs[krow] ; assert(free_list >= 0 && free_list < prob->bulk0_) ; CoinBigIndex kk = free_list ; free_list = link[free_list] ; link[kk] = colStarts[j] ; colStarts[j] = kk ; colCoeffs[kk] = atj ; rowIndices[kk] = tgtrow ; if (saved_costs) cost[j] = saved_costs[krow] ; if (j == tgtcol) { colLengths[j] = 1 ; clo[tgtcol] = f->clo ; cup[tgtcol] = f->cup ; rcosts[j] = -cost[tgtcol]/atj ; tgt_coeff = atj ; } else { colLengths[j]++ ; tgtrow_act += atj*sol[j] ; } } rlo[tgtrow] = f->rlo ; rup[tgtrow] = f->rup ; PRESOLVEASSERT(fabs(tgt_coeff) > ZTOLDP) ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 cdone[tgtcol] = IMPLIED_FREE ; rdone[tgtrow] = IMPLIED_FREE ; # endif # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif /* Calculate a value for x(t). We have two possible values for x(t), calculated against the upper and lower bound of the constraint. x(t) could end up at one of its original bounds or it could end up strictly within bounds. In either event, the constraint will be tight. The code simply forces the calculated value for x(t) to be within bounds. Arguably it should complain more loudly as this likely indicates algorithmic error or numerical inaccuracy. You'll get a warning if debugging is enabled. */ double xt_lo,xt_up ; if (tgt_coeff > 0) { xt_lo = (rlo[tgtrow]-tgtrow_act)/tgt_coeff ; xt_up = (rup[tgtrow]-tgtrow_act)/tgt_coeff ; } else { xt_lo = (rup[tgtrow]-tgtrow_act)/tgt_coeff ; xt_up = (rlo[tgtrow]-tgtrow_act)/tgt_coeff ; } const double lt = clo[tgtcol] ; const double ut = cup[tgtcol] ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 bool chklo = true ; bool chkup = true ; if (tgt_coeff > 0) { if (rlo[tgtrow] < -large) chklo = false ; if (rup[tgtrow] > large) chkup = false ; } else { if (rup[tgtrow] > large) chklo = false ; if (rlo[tgtrow] < -large) chkup = false ; } if (chklo && (xt_lo < lt-prob->ztolzb_)) { std::cout << " LOW CSOL (implied_free): x(" << tgtcol << ") lb " << lt << ", sol = " << xt_lo << ", err " << (lt-xt_lo) << "." << std::endl ; } if (chkup && (xt_up > ut+prob->ztolzb_)) { std::cout << " HIGH CSOL (implied_free): x(" << tgtcol << ") ub " << ut << ", sol = " << xt_up << ", err " << (xt_up-ut) << "." << std::endl ; } # if PRESOLVE_DEBUG > 2 std::cout << " x(" << tgtcol << ") lb " << lt << " lo " << xt_lo << ", up " << xt_up << " ub " << ut << "." << std::endl ; # endif # endif xt_lo = CoinMax(xt_lo,lt) ; xt_up = CoinMin(xt_up,ut) ; /* Time to make x(t) basic and the logical nonbasic. The sign of the dual determines the tight row bound, which in turn determines the value of x(t). Because the row is tight, activity is by definition equal to the bound. Coin convention is that a <= constraint puts a lower bound on the slack and a >= constraint puts an upper bound on the slack. Case analysis (minimisation) says: dual >= 0 ==> reduced cost <= 0 ==> NBUB ==> finite rlo dual <= 0 ==> reduced cost >= 0 ==> NBLB ==> finite rup */ const double ct = maxmin*cost[tgtcol] ; double possibleDual = ct/tgt_coeff ; rowduals[tgtrow] = possibleDual ; if (possibleDual >= 0 && rlo[tgtrow] > -large) { sol[tgtcol] = (rlo[tgtrow]-tgtrow_act)/tgt_coeff ; acts[tgtrow] = rlo[tgtrow] ; prob->setRowStatus(tgtrow,CoinPrePostsolveMatrix::atUpperBound) ; } else if (possibleDual <= 0 && rup[tgtrow] < large) { sol[tgtcol] = (rup[tgtrow]-tgtrow_act)/tgt_coeff ; acts[tgtrow] = rup[tgtrow] ; prob->setRowStatus(tgtrow,CoinPrePostsolveMatrix::atLowerBound) ; } else { assert(rup[tgtrow] < large || rlo[tgtrow] > -large) ; if (rup[tgtrow] < large) { sol[tgtcol] = (rup[tgtrow]-tgtrow_act)/tgt_coeff ; acts[tgtrow] = rup[tgtrow] ; prob->setRowStatus(tgtrow,CoinPrePostsolveMatrix::atLowerBound) ; } else { sol[tgtcol] = (rlo[tgtrow]-tgtrow_act)/tgt_coeff ; acts[tgtrow] = rlo[tgtrow] ; prob->setRowStatus(tgtrow,CoinPrePostsolveMatrix::atUpperBound) ; } # if PRESOLVE_DEBUG > 0 std::cout << "BAD ROW STATUS row " << tgtrow << ": dual " << rowduals[tgtrow] << " but row " << ((rowduals[tgtrow] > 0)?"upper":"lower") << " bound is not finite; forcing status " << prob->rowStatusString(tgtrow) << "." << std::endl ; # endif } prob->setColumnStatus(tgtcol,CoinPrePostsolveMatrix::basic) ; rcosts[tgtcol] = 0.0 ; # if PRESOLVE_DEBUG > 2 std::cout << " x(" << tgtcol << ") B dj " << rcosts[tgtcol] << "." << std::endl ; std::cout << " row " << tgtrow << " dual " << rowduals[tgtrow] << "." << std::endl ; # endif PRESOLVEASSERT(acts[tgtrow] >= rlo[tgtrow]-1.0e-5 && acts[tgtrow] <= rup[tgtrow]+1.0e-5) ; # if PRESOLVE_DEBUG > 2 /* Debug code to compare the reduced costs against a calculation from scratch as c(j)-ya(j). */ for (int krow = 0 ; krow < tgtrow_len ; krow++) { const int j = tgtrow_cols[krow] ; const int lenj = colLengths[j] ; double dj = cost[j] ; CoinBigIndex kcol = colStarts[j] ; for (int cntj = 0 ; cntj < lenj ; ++cntj) { const int i = rowIndices[kcol] ; const double aij = colCoeffs[kcol] ; dj -= rowduals[i]*aij ; kcol = link[kcol] ; } if (fabs(dj-rcosts[j]) > 1.0e-3) { std::cout << " cbar(" << j << ") update " << rcosts[j] << " expected " << dj << " err " << fabs(dj-rcosts[j]) << "." << std::endl ; } } # endif } # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving implied_free_action::postsolve." << std::endl ; # endif # endif return ; } implied_free_action::~implied_free_action() { int i ; for (i=0;i #include #include "CoinFinite.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" #include "CoinPresolveEmpty.hpp" // for DROP_COL/DROP_ROW #include "CoinPresolveZeros.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolveTripleton.hpp" #include "CoinPresolvePsdebug.hpp" #include "CoinMessage.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif /* * Substituting y away: * * y = (c - a x - d z) / b * * so adjust bounds by: c/b * and x by: -a/b * and z by: -d/b * * This affects both the row and col representations. * * mcstrt only modified if the column must be moved. * * for every row in icoly * if icolx is also has an entry for row * modify the icolx entry for row * drop the icoly entry from row and modify the icolx entry * else * add a new entry to icolx column * create a new icolx entry * (this may require moving the column in memory) * replace icoly entry from row and replace with icolx entry * * same for icolz * The row and column reps are inconsistent during the routine, * because icolx in the column rep is updated, and the entries corresponding * to icolx in the row rep are updated, but nothing concerning icoly * in the col rep is changed. icoly entries in the row rep are deleted, * and icolx entries in both reps are consistent. * At the end, we set the length of icoly to be zero, so the reps would * be consistent if the row were deleted from the row rep. * Both the row and icoly must be removed from both reps. * In the col rep, icoly will be eliminated entirely, at the end of the routine; * irow occurs in just two columns, one of which (icoly) is eliminated * entirely, the other is icolx, which is not deleted here. * In the row rep, irow will be eliminated entirely, but not here; * icoly is removed from the rows it occurs in. */ static bool elim_tripleton(const char * #if PRESOLVE_DEBUG > 1 msg #endif , CoinBigIndex *mcstrt, double *rlo, double * acts, double *rup, double *colels, int *hrow, int *hcol, int *hinrow, int *hincol, presolvehlink *clink, int ncols, presolvehlink *rlink, int nrows, CoinBigIndex *mrstrt, double *rowels, //double a, double b, double c, double coeff_factorx,double coeff_factorz, double bounds_factor, int row0, int icolx, int icoly, int icolz) { CoinBigIndex kcs = mcstrt[icoly]; CoinBigIndex kce = kcs + hincol[icoly]; CoinBigIndex kcsx = mcstrt[icolx]; CoinBigIndex kcex = kcsx + hincol[icolx]; CoinBigIndex kcsz = mcstrt[icolz]; CoinBigIndex kcez = kcsz + hincol[icolz]; # if PRESOLVE_DEBUG > 1 printf("%s %d x=%d y=%d z=%d cfx=%g cfz=%g nx=%d yrows=(", msg, row0,icolx,icoly,icolz,coeff_factorx,coeff_factorz,hincol[icolx]) ; # endif for (CoinBigIndex kcoly=kcs; kcoly 0*/) { if (bounds_factor != 0.0) { // (1) if (-PRESOLVE_INF < rlo[row]) rlo[row] -= colels[kcoly] * bounds_factor; // (2) if (rup[row] < PRESOLVE_INF) rup[row] -= colels[kcoly] * bounds_factor; // and solution if (acts) { acts[row] -= colels[kcoly] * bounds_factor; } } // see if row appears in colx CoinBigIndex kcolx = presolve_find_row1(row, kcsx, kcex, hrow); # if PRESOLVE_DEBUG > 1 printf("%d%s ",row,(kcolx 1 printf("%d%s ",row,(kcolz=kcex&&kcolz 1 printf(")\n") ; # endif // delete the whole column hincol[icoly] = 0; return (false); } /* * * The col rep and row rep must be consistent. */ const CoinPresolveAction *tripleton_action::presolve(CoinPresolveMatrix *prob, const CoinPresolveAction *next) { double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; int ncols = prob->ncols_; double *clo = prob->clo_; double *cup = prob->cup_; double *rowels = prob->rowels_; int *hcol = prob->hcol_; CoinBigIndex *mrstrt = prob->mrstrt_; int *hinrow = prob->hinrow_; int nrows = prob->nrows_; double *rlo = prob->rlo_; double *rup = prob->rup_; presolvehlink *clink = prob->clink_; presolvehlink *rlink = prob->rlink_; const unsigned char *integerType = prob->integerType_; double *cost = prob->cost_; int numberLook = prob->numberRowsToDo_; int iLook; int * look = prob->rowsToDo_; const double ztolzb = prob->ztolzb_; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering tripleton_action::presolve; considering " << numberLook << " rows." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int startEmptyRows = 0 ; int startEmptyColumns = 0 ; startEmptyRows = prob->countEmptyRows() ; startEmptyColumns = prob->countEmptyCols() ; # if COIN_PRESOLVE_TUNING > 0 double startTime = 0.0; if (prob->tuning_) startTime = CoinCpuTime() ; # endif # endif action * actions = new action [nrows]; # ifdef ZEROFAULT // initialise alignment padding bytes memset(actions,0,nrows*sizeof(action)) ; # endif int nactions = 0; int *zeros = prob->usefulColumnInt_; //new int[ncols]; char * mark = reinterpret_cast(zeros+ncols); memset(mark,0,ncols); int nzeros = 0; // If rowstat exists then all do unsigned char *rowstat = prob->rowstat_; double *acts = prob->acts_; // unsigned char * colstat = prob->colstat_; # if PRESOLVE_CONSISTENCY > 0 presolve_links_ok(prob) ; # endif // wasfor (int irow=0; irow 0) { break; } } PRESOLVEASSERT(k 0) { break; } } PRESOLVEASSERT(k 0) { break; } } PRESOLVEASSERT(k0.0) { if(coeffx*coeffy>0.0) continue; } else if (coeffx*coeffy>0.0) { int iTemp = icoly; icoly=icolz; icolz=iTemp; double dTemp = coeffy; coeffy=coeffz; coeffz=dTemp; } else { int iTemp = icoly; icoly=icolx; icolx=iTemp; double dTemp = coeffy; coeffy=coeffx; coeffx=dTemp; } // Not all same sign and y is odd one out // don't bother with fixed variables if (!(fabs(cup[icolx] - clo[icolx]) < ZTOLDP) && !(fabs(cup[icoly] - clo[icolx]) < ZTOLDP) && !(fabs(cup[icolz] - clo[icoly]) < ZTOLDP)) { assert (coeffx*coeffz>0.0&&coeffx*coeffy<0.0); // Only do if does not give implicit bounds on x and z double cx = - coeffx/coeffy; double cz = - coeffz/coeffy; /* don't do if y integer for now */ if (integerType[icoly]) { #define PRESOLVE_DANGEROUS #ifndef PRESOLVE_DANGEROUS continue; #else if (!integerType[icolx]||!integerType[icolz]) continue; if (cx!=floor(cx+0.5)||cz!=floor(cz+0.5)) continue; #endif } double rhsRatio = rhs/coeffy; if (clo[icoly]>-1.0e30) { if (clo[icolx]<-1.0e30||clo[icolz]<-1.0e30) continue; if (cx*clo[icolx]+cz*clo[icolz]+rhsRatio1.0e30||cup[icolz]>1.0e30) continue; if (cx*cup[icolx]+cz*cup[icolz]+rhsRatio>cup[icoly]+ztolzb) continue; } /* find this row in each of the columns and do counts */ bool singleton=false; for (k=mcstrt[icoly]; ksetRowUsed(jrow); } int nDuplicate=0; for (k=mcstrt[icolx]; krowUsed(jrow)) nDuplicate++;; } for (k=mcstrt[icolz]; krowUsed(jrow)) nDuplicate++;; } int nAdded=hincol[icoly]-3-nDuplicate; for (k=mcstrt[icoly]; kunsetRowUsed(jrow); } // let singleton rows be taken care of first if (singleton) continue; //if (nAdded<=1) //printf("%d elements added, hincol %d , dups %d\n",nAdded,hincol[icoly],nDuplicate); if (nAdded>2) continue; // it is possible that both x/z and y are singleton columns // that can cause problems if ((hincol[icolx] == 1 ||hincol[icolz] == 1) && hincol[icoly] == 1) continue; // common equations are of the form ax + by = 0, or x + y >= lo { action *s = &actions[nactions]; nactions++; PRESOLVE_DETAIL_PRINT(printf("pre_tripleton %dR %dC %dC %dC E\n", irow,icoly,icolx,icolz)); s->row = irow; s->icolx = icolx; s->icolz = icolz; s->icoly = icoly; s->cloy = clo[icoly]; s->cupy = cup[icoly]; s->costy = cost[icoly]; s->rlo = rlo[irow]; s->rup = rup[irow]; s->coeffx = coeffx; s->coeffy = coeffy; s->coeffz = coeffz; s->ncoly = hincol[icoly]; s->colel = presolve_dupmajor(colels, hrow, hincol[icoly], mcstrt[icoly]); } // costs // the effect of maxmin cancels out cost[icolx] += cost[icoly] * cx; cost[icolz] += cost[icoly] * cz; prob->change_bias(cost[icoly] * rhs / coeffy); //if (cost[icoly]*rhs) //printf("change %g col %d cost %g rhs %g coeff %g\n",cost[icoly]*rhs/coeffy, // icoly,cost[icoly],rhs,coeffy); if (rowstat) { // update solution and basis int numberBasic=0; if (prob->columnIsBasic(icoly)) numberBasic++; if (prob->rowIsBasic(irow)) numberBasic++; if (numberBasic>1) { if (!prob->columnIsBasic(icolx)) prob->setColumnStatus(icolx,CoinPrePostsolveMatrix::basic); else prob->setColumnStatus(icolz,CoinPrePostsolveMatrix::basic); } } // Update next set of actions { prob->addCol(icolx); int i,kcs,kce; kcs = mcstrt[icoly]; kce = kcs + hincol[icoly]; for (i=kcs;iaddRow(row); } kcs = mcstrt[icolx]; kce = kcs + hincol[icolx]; for (i=kcs;iaddRow(row); } prob->addCol(icolz); kcs = mcstrt[icolz]; kce = kcs + hincol[icolz]; for (i=kcs;iaddRow(row); } } /* transfer the colx factors to coly */ bool no_mem = elim_tripleton("ELIMT", mcstrt, rlo, acts, rup, colels, hrow, hcol, hinrow, hincol, clink, ncols, rlink, nrows, mrstrt, rowels, cx, cz, rhs / coeffy, irow, icolx, icoly,icolz); if (no_mem) throwCoinError("out of memory", "tripleton_action::presolve"); // now remove irow from icolx and icolz in the col rep // better if this were first. presolve_delete_from_col(irow,icolx,mcstrt,hincol,hrow,colels) ; presolve_delete_from_col(irow,icolz,mcstrt,hincol,hrow,colels) ; // eliminate irow entirely from the row rep hinrow[irow] = 0; // eliminate irow entirely from the row rep PRESOLVE_REMOVE_LINK(rlink, irow); // eliminate coly entirely from the col rep PRESOLVE_REMOVE_LINK(clink, icoly); cost[icoly] = 0.0; rlo[irow] = 0.0; rup[irow] = 0.0; if (!mark[icolx]) { mark[icolx]=1; zeros[nzeros++]=icolx; } if (!mark[icolz]) { mark[icolz]=1; zeros[nzeros++]=icolz; } } # if PRESOLVE_CONSISTENCY > 0 presolve_links_ok(prob) ; presolve_consistent(prob); # endif } } if (nactions) { # if PRESOLVE_SUMMARY > 0 printf("NTRIPLETONS: %d\n", nactions); # endif action *actions1 = new action[nactions]; CoinMemcpyN(actions, nactions, actions1); next = new tripleton_action(nactions, actions1, next); if (nzeros) { next = drop_zero_coefficients_action::presolve(prob, zeros, nzeros, next); } } //delete[]zeros; deleteAction(actions,action*); # if COIN_PRESOLVE_TUNING > 0 if (prob->tuning_) double thisTime = CoinCpuTime() ; # endif # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_sol(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 int droppedRows = prob->countEmptyRows()-startEmptyRows ; int droppedColumns = prob->countEmptyCols()-startEmptyColumns ; std::cout << "Leaving tripleton_action::presolve, " << droppedRows << " rows, " << droppedColumns << " columns dropped" ; # if COIN_PRESOLVE_TUNING > 0 std::cout << " in " << thisTime-startTime << "s" ; # endif std::cout << "." << std::endl ; # endif return (next); } void tripleton_action::postsolve(CoinPostsolveMatrix *prob) const { const action *const actions = actions_; const int nactions = nactions_; double *colels = prob->colels_; int *hrow = prob->hrow_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; int *link = prob->link_; double *clo = prob->clo_; double *cup = prob->cup_; double *rlo = prob->rlo_; double *rup = prob->rup_; double *dcost = prob->cost_; double *sol = prob->sol_; double *rcosts = prob->rcosts_; double *acts = prob->acts_; double *rowduals = prob->rowduals_; unsigned char *colstat = prob->colstat_; unsigned char *rowstat = prob->rowstat_; const double maxmin = prob->maxmin_; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 char *cdone = prob->cdone_; char *rdone = prob->rdone_; presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Entering tripleton_action::postsolve." << std::endl ; # endif # endif CoinBigIndex &free_list = prob->free_list_; const double ztolzb = prob->ztolzb_; const double ztoldj = prob->ztoldj_; // Space for accumulating two columns int nrows = prob->nrows_; int * index1 = new int[nrows]; double * element1 = new double[nrows]; memset(element1,0,nrows*sizeof(double)); int * index2 = new int[nrows]; double * element2 = new double[nrows]; memset(element2,0,nrows*sizeof(double)); for (const action *f = &actions[nactions-1]; actions<=f; f--) { int irow = f->row; // probably don't need this double ylo0 = f->cloy; double yup0 = f->cupy; double coeffx = f->coeffx; double coeffy = f->coeffy; double coeffz = f->coeffz; int jcolx = f->icolx; int jcoly = f->icoly; int jcolz = f->icolz; // needed? double rhs = f->rlo; /* the column was in the reduced problem */ PRESOLVEASSERT(cdone[jcolx] && rdone[irow]==DROP_ROW&&cdone[jcolz]); PRESOLVEASSERT(cdone[jcoly]==DROP_COL); // probably don't need this rlo[irow] = f->rlo; rup[irow] = f->rup; // probably don't need this clo[jcoly] = ylo0; cup[jcoly] = yup0; dcost[jcoly] = f->costy; dcost[jcolx] += f->costy*coeffx/coeffy; dcost[jcolz] += f->costy*coeffz/coeffy; // this is why we want coeffx < coeffy (55) sol[jcoly] = (rhs - coeffx * sol[jcolx] - coeffz * sol[jcolz]) / coeffy; // since this row is fixed acts[irow] = rhs; // acts[irow] always ok, since slack is fixed if (rowstat) prob->setRowStatus(irow,CoinPrePostsolveMatrix::atLowerBound); // CLAIM: // if the new pi value is chosen to keep the reduced cost // of col x at its prior value, then the reduced cost of // col y will be 0. // also have to update row activities and bounds for rows affected by jcoly // // sol[jcolx] was found for coeffx that // was += colels[kcoly] * coeff_factor; // where coeff_factor == -coeffx / coeffy // // its contribution to activity was // (colels[kcolx] + colels[kcoly] * coeff_factor) * sol[jcolx] (1) // // After adjustment, the two columns contribute: // colels[kcoly] * sol[jcoly] + colels[kcolx] * sol[jcolx] // == colels[kcoly] * ((rhs - coeffx * sol[jcolx]) / coeffy) + colels[kcolx] * sol[jcolx] // == colels[kcoly] * rhs/coeffy + colels[kcoly] * coeff_factor * sol[jcolx] + colels[kcolx] * sol[jcolx] // colels[kcoly] * rhs/coeffy + the expression (1) // // therefore, we must increase the row bounds by colels[kcoly] * rhs/coeffy, // which is similar to the bias double djy = maxmin * dcost[jcoly]; double djx = maxmin * dcost[jcolx]; double djz = maxmin * dcost[jcolz]; double bounds_factor = rhs/coeffy; // need to reconstruct x and z double multiplier1 = coeffx/coeffy; double multiplier2 = coeffz/coeffy; int * indy = reinterpret_cast(f->colel+f->ncoly); int ystart = NO_LINK; int nX=0,nZ=0; int i,iRow; for (i=0; incoly; ++i) { int iRow = indy[i]; double yValue = f->colel[i]; CoinBigIndex k = free_list; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list]; if (iRow != irow) { // are these tests always true??? // undo elim_tripleton(1) if (-PRESOLVE_INF < rlo[iRow]) rlo[iRow] += yValue * bounds_factor; // undo elim_tripleton(2) if (rup[iRow] < PRESOLVE_INF) rup[iRow] += yValue * bounds_factor; acts[iRow] += yValue * bounds_factor; djy -= rowduals[iRow] * yValue; } hrow[k] = iRow; PRESOLVEASSERT(rdone[hrow[k]] || hrow[k] == irow); colels[k] = yValue; link[k] = ystart; ystart = k; element1[iRow]=yValue*multiplier1; index1[nX++]=iRow; element2[iRow]=yValue*multiplier2; index2[nZ++]=iRow; } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif mcstrt[jcoly] = ystart; hincol[jcoly] = f->ncoly; // find the tail CoinBigIndex k=mcstrt[jcolx]; CoinBigIndex last = NO_LINK; int numberInColumn = hincol[jcolx]; int numberToDo=numberInColumn; for (i=0; i=0&&iRow=1.0e-15) { colels[k]=value; last=k; k = link[k]; if (iRow != irow) djx -= rowduals[iRow] * value; } else { numberInColumn--; // add to free list int nextk = link[k]; link[k]=free_list; free_list=k; assert (k>=0); k=nextk; if (last!=NO_LINK) link[last]=k; else mcstrt[jcolx]=k; } } for (i=0;i=1.0e-15) { if (iRow != irow) djx -= rowduals[iRow] * xValue; numberInColumn++; CoinBigIndex k = free_list; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list]; hrow[k] = iRow; PRESOLVEASSERT(rdone[hrow[k]] || hrow[k] == irow); colels[k] = xValue; if (last!=NO_LINK) link[last]=k; else mcstrt[jcolx]=k; last = k; } } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif link[last]=NO_LINK; assert(numberInColumn); hincol[jcolx] = numberInColumn; // find the tail k=mcstrt[jcolz]; last = NO_LINK; numberInColumn = hincol[jcolz]; numberToDo=numberInColumn; for (i=0; i=0&&iRow=1.0e-15) { colels[k]=value; last=k; k = link[k]; if (iRow != irow) djz -= rowduals[iRow] * value; } else { numberInColumn--; // add to free list int nextk = link[k]; assert(free_list>=0); link[k]=free_list; free_list=k; assert (k>=0); k=nextk; if (last!=NO_LINK) link[last]=k; else mcstrt[jcolz]=k; } } for (i=0;i=1.0e-15) { if (iRow != irow) djz -= rowduals[iRow] * zValue; numberInColumn++; CoinBigIndex k = free_list; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list]; hrow[k] = iRow; PRESOLVEASSERT(rdone[hrow[k]] || hrow[k] == irow); colels[k] = zValue; if (last!=NO_LINK) link[last]=k; else mcstrt[jcolz]=k; last = k; } } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif link[last]=NO_LINK; assert(numberInColumn); hincol[jcolz] = numberInColumn; // The only problem with keeping the reduced costs the way they were // was that the variable's bound may have moved, requiring it // to become basic. //printf("djs x - %g (%g), y - %g (%g)\n",djx,coeffx,djy,coeffy); if (colstat) { if (prob->columnIsBasic(jcolx) || (fabs(clo[jcolx] - sol[jcolx]) < ztolzb && rcosts[jcolx] >= -ztoldj) || (fabs(cup[jcolx] - sol[jcolx]) < ztolzb && rcosts[jcolx] <= ztoldj) || (prob->getColumnStatus(jcolx) ==CoinPrePostsolveMatrix::isFree&& fabs(rcosts[jcolx]) <= ztoldj)) { // colx or y is fine as it is - make coly basic prob->setColumnStatus(jcoly,CoinPrePostsolveMatrix::basic); // this is the coefficient we need to force col y's reduced cost to 0.0; // for example, this is obviously true if y is a singleton column rowduals[irow] = djy / coeffy; rcosts[jcolx] = djx - rowduals[irow] * coeffx; # if PRESOLVE_DEBUG > 0 if (prob->columnIsBasic(jcolx)&&fabs(rcosts[jcolx])>1.0e-5) printf("bad dj %d %g\n",jcolx,rcosts[jcolx]); # endif rcosts[jcolz] = djz - rowduals[irow] * coeffz; //if (prob->columnIsBasic(jcolz)) //assert (fabs(rcosts[jcolz])<1.0e-5); rcosts[jcoly] = 0.0; } else { prob->setColumnStatus(jcolx,CoinPrePostsolveMatrix::basic); prob->setColumnStatusUsingValue(jcoly); // change rowduals[jcolx] enough to cancel out rcosts[jcolx] rowduals[irow] = djx / coeffx; rcosts[jcolx] = 0.0; // change rowduals[jcolx] enough to cancel out rcosts[jcolx] //rowduals[irow] = djz / coeffz; //rcosts[jcolz] = 0.0; rcosts[jcolz] = djz - rowduals[irow] * coeffz; rcosts[jcoly] = djy - rowduals[irow] * coeffy; } } else { // No status array // this is the coefficient we need to force col y's reduced cost to 0.0; // for example, this is obviously true if y is a singleton column rowduals[irow] = djy / coeffy; rcosts[jcoly] = 0.0; } // DEBUG CHECK # if PRESOLVE_DEBUG > 0 { CoinBigIndex k = mcstrt[jcolx]; int nx = hincol[jcolx]; double dj = maxmin * dcost[jcolx]; for (int i=0; i 0 || PRESOLVE_CONSISTENCY > 0 cdone[jcoly] = TRIPLETON; rdone[irow] = TRIPLETON; # endif } delete [] index1; delete [] element1; delete [] index2; delete [] element2; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving tripleton_action::postsolve." << std::endl ; # endif # endif } tripleton_action::~tripleton_action() { for (int i=nactions_-1; i>=0; i--) { delete[]actions_[i].colel; } deleteAction(actions_,action*); } static double *tripleton_mult; static int *tripleton_id; void check_tripletons(const CoinPresolveAction * paction) { const CoinPresolveAction * paction0 = paction; if (paction) { check_tripletons(paction->next); if (strcmp(paction0->name(), "tripleton_action") == 0) { const tripleton_action *daction = reinterpret_cast(paction0); for (int i=daction->nactions_-1; i>=0; --i) { int icolx = daction->actions_[i].icolx; int icoly = daction->actions_[i].icoly; double coeffx = daction->actions_[i].coeffx; double coeffy = daction->actions_[i].coeffy; tripleton_mult[icoly] = -coeffx/coeffy; tripleton_id[icoly] = icolx; } } } } CoinMP-1.8.3/CoinUtils/src/CoinPackedVector.hpp0000644000175000017500000005126411667146070017730 0ustar renerene/* $Id: CoinPackedVector.hpp 1509 2011-12-05 13:50:48Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPackedVector_H #define CoinPackedVector_H #include #include "CoinPragma.hpp" #include "CoinPackedVectorBase.hpp" #include "CoinSort.hpp" #ifdef COIN_FAST_CODE #ifndef COIN_NOTEST_DUPLICATE #define COIN_NOTEST_DUPLICATE #endif #endif #ifndef COIN_NOTEST_DUPLICATE #define COIN_DEFAULT_VALUE_FOR_DUPLICATE true #else #define COIN_DEFAULT_VALUE_FOR_DUPLICATE false #endif /** Sparse Vector Stores vector of indices and associated element values. Supports sorting of vector while maintaining the original indices. Here is a sample usage: @verbatim const int ne = 4; int inx[ne] = { 1, 4, 0, 2 } double el[ne] = { 10., 40., 1., 50. } // Create vector and set its value CoinPackedVector r(ne,inx,el); // access each index and element assert( r.indices ()[0]== 1 ); assert( r.elements()[0]==10. ); assert( r.indices ()[1]== 4 ); assert( r.elements()[1]==40. ); assert( r.indices ()[2]== 0 ); assert( r.elements()[2]== 1. ); assert( r.indices ()[3]== 2 ); assert( r.elements()[3]==50. ); // access original position of index assert( r.originalPosition()[0]==0 ); assert( r.originalPosition()[1]==1 ); assert( r.originalPosition()[2]==2 ); assert( r.originalPosition()[3]==3 ); // access as a full storage vector assert( r[ 0]==1. ); assert( r[ 1]==10.); assert( r[ 2]==50.); assert( r[ 3]==0. ); assert( r[ 4]==40.); // sort Elements in increasing order r.sortIncrElement(); // access each index and element assert( r.indices ()[0]== 0 ); assert( r.elements()[0]== 1. ); assert( r.indices ()[1]== 1 ); assert( r.elements()[1]==10. ); assert( r.indices ()[2]== 4 ); assert( r.elements()[2]==40. ); assert( r.indices ()[3]== 2 ); assert( r.elements()[3]==50. ); // access original position of index assert( r.originalPosition()[0]==2 ); assert( r.originalPosition()[1]==0 ); assert( r.originalPosition()[2]==1 ); assert( r.originalPosition()[3]==3 ); // access as a full storage vector assert( r[ 0]==1. ); assert( r[ 1]==10.); assert( r[ 2]==50.); assert( r[ 3]==0. ); assert( r[ 4]==40.); // Restore orignal sort order r.sortOriginalOrder(); assert( r.indices ()[0]== 1 ); assert( r.elements()[0]==10. ); assert( r.indices ()[1]== 4 ); assert( r.elements()[1]==40. ); assert( r.indices ()[2]== 0 ); assert( r.elements()[2]== 1. ); assert( r.indices ()[3]== 2 ); assert( r.elements()[3]==50. ); // Tests for equality and equivalence CoinPackedVector r1; r1=r; assert( r==r1 ); assert( r.equivalent(r1) ); r.sortIncrElement(); assert( r!=r1 ); assert( r.equivalent(r1) ); // Add packed vectors. // Similarly for subtraction, multiplication, // and division. CoinPackedVector add = r + r1; assert( add[0] == 1.+ 1. ); assert( add[1] == 10.+10. ); assert( add[2] == 50.+50. ); assert( add[3] == 0.+ 0. ); assert( add[4] == 40.+40. ); assert( r.sum() == 10.+40.+1.+50. ); @endverbatim */ class CoinPackedVector : public CoinPackedVectorBase { friend void CoinPackedVectorUnitTest(); public: /**@name Get methods. */ //@{ /// Get the size virtual int getNumElements() const { return nElements_; } /// Get indices of elements virtual const int * getIndices() const { return indices_; } /// Get element values virtual const double * getElements() const { return elements_; } /// Get indices of elements int * getIndices() { return indices_; } /// Get the size inline int getVectorNumElements() const { return nElements_; } /// Get indices of elements inline const int * getVectorIndices() const { return indices_; } /// Get element values inline const double * getVectorElements() const { return elements_; } /// Get element values double * getElements() { return elements_; } /** Get pointer to int * vector of original postions. If the packed vector has not been sorted then this function returns the vector: 0, 1, 2, ..., size()-1. */ const int * getOriginalPosition() const { return origIndices_; } //@} //------------------------------------------------------------------- // Set indices and elements //------------------------------------------------------------------- /**@name Set methods */ //@{ /// Reset the vector (as if were just created an empty vector) void clear(); /** Assignment operator.
    NOTE: This operator keeps the current testForDuplicateIndex setting, and affter copying the data it acts accordingly. */ CoinPackedVector & operator=(const CoinPackedVector &); /** Assignment operator from a CoinPackedVectorBase.
    NOTE: This operator keeps the current testForDuplicateIndex setting, and affter copying the data it acts accordingly. */ CoinPackedVector & operator=(const CoinPackedVectorBase & rhs); /** Assign the ownership of the arguments to this vector. Size is the length of both the indices and elements vectors. The indices and elements vectors are copied into this class instance's member data. The last argument indicates whether this vector will have to be tested for duplicate indices. */ void assignVector(int size, int*& inds, double*& elems, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** Set vector size, indices, and elements. Size is the length of both the indices and elements vectors. The indices and elements vectors are copied into this class instance's member data. The last argument specifies whether this vector will have to be checked for duplicate indices whenever that can happen. */ void setVector(int size, const int * inds, const double * elems, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** Elements set to have the same scalar value */ void setConstant(int size, const int * inds, double elems, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** Indices are not specified and are taken to be 0,1,...,size-1 */ void setFull(int size, const double * elems, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** Indices are not specified and are taken to be 0,1,...,size-1, but only where non zero*/ void setFullNonZero(int size, const double * elems, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** Set an existing element in the packed vector The first argument is the "index" into the elements() array */ void setElement(int index, double element); /// Insert an element into the vector void insert(int index, double element); /// Append a CoinPackedVector to the end void append(const CoinPackedVectorBase & caboose); /// Swap values in positions i and j of indices and elements void swap(int i, int j); /** Resize the packed vector to be the first newSize elements. Problem with truncate: what happens with origIndices_ ??? */ void truncate(int newSize); //@} /**@name Arithmetic operators. */ //@{ /// add value to every entry void operator+=(double value); /// subtract value from every entry void operator-=(double value); /// multiply every entry by value void operator*=(double value); /// divide every entry by value void operator/=(double value); //@} /**@name Sorting */ //@{ /** Sort the packed storage vector. Typcical usages:
     
           packedVector.sort(CoinIncrIndexOrdered());   //increasing indices
           packedVector.sort(CoinIncrElementOrdered()); // increasing elements
           
    */ template void sort(const CoinCompare3 & tc) { CoinSort_3(indices_, indices_ + nElements_, origIndices_, elements_, tc); } void sortIncrIndex() { CoinSort_3(indices_, indices_ + nElements_, origIndices_, elements_, CoinFirstLess_3()); } void sortDecrIndex() { CoinSort_3(indices_, indices_ + nElements_, origIndices_, elements_, CoinFirstGreater_3()); } void sortIncrElement() { CoinSort_3(elements_, elements_ + nElements_, origIndices_, indices_, CoinFirstLess_3()); } void sortDecrElement() { CoinSort_3(elements_, elements_ + nElements_, origIndices_, indices_, CoinFirstGreater_3()); } /** Sort in original order. If the vector has been sorted, then this method restores to its orignal sort order. */ void sortOriginalOrder(); //@} /**@name Memory usage */ //@{ /** Reserve space. If one knows the eventual size of the packed vector, then it may be more efficient to reserve the space. */ void reserve(int n); /** capacity returns the size which could be accomodated without having to reallocate storage. */ int capacity() const { return capacity_; } //@} /**@name Constructors and destructors */ //@{ /** Default constructor */ CoinPackedVector(bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** \brief Alternate Constructors - set elements to vector of doubles This constructor copies the vectors provided as parameters. */ CoinPackedVector(int size, const int * inds, const double * elems, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** \brief Alternate Constructors - set elements to vector of doubles This constructor takes ownership of the vectors passed as parameters. \p inds and \p elems will be NULL on return. */ CoinPackedVector(int capacity, int size, int *&inds, double *&elems, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** Alternate Constructors - set elements to same scalar value */ CoinPackedVector(int size, const int * inds, double element, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** Alternate Constructors - construct full storage with indices 0 through size-1. */ CoinPackedVector(int size, const double * elements, bool testForDuplicateIndex = COIN_DEFAULT_VALUE_FOR_DUPLICATE); /** Copy constructor. */ CoinPackedVector(const CoinPackedVector &); /** Copy constructor from a PackedVectorBase. */ CoinPackedVector(const CoinPackedVectorBase & rhs); /** Destructor */ virtual ~CoinPackedVector (); //@} private: /**@name Private methods */ //@{ /// Copy internal date void gutsOfSetVector(int size, const int * inds, const double * elems, bool testForDuplicateIndex, const char * method); /// void gutsOfSetConstant(int size, const int * inds, double value, bool testForDuplicateIndex, const char * method); //@} private: /**@name Private member data */ //@{ /// Vector indices int * indices_; ///Vector elements double * elements_; /// Size of indices and elements vectors int nElements_; /// original unsorted indices int * origIndices_; /// Amount of memory allocated for indices_, origIndices_, and elements_. int capacity_; //@} }; //############################################################################# /**@name Arithmetic operators on packed vectors. NOTE: These methods operate on those positions where at least one of the arguments has a value listed. At those positions the appropriate operation is executed, Otherwise the result of the operation is considered 0.
    NOTE 2: There are two kind of operators here. One is used like "c = binaryOp(a, b)", the other is used like "binaryOp(c, a, b)", but they are really the same. The first is much more natural to use, but it involves the creation of a temporary object (the function *must* return an object), while the second form puts the result directly into the argument "c". Therefore, depending on the circumstances, the second form can be significantly faster. */ //@{ template void binaryOp(CoinPackedVector& retVal, const CoinPackedVectorBase& op1, double value, BinaryFunction bf) { retVal.clear(); const int s = op1.getNumElements(); if (s > 0) { retVal.reserve(s); const int * inds = op1.getIndices(); const double * elems = op1.getElements(); for (int i=0; i inline void binaryOp(CoinPackedVector& retVal, double value, const CoinPackedVectorBase& op2, BinaryFunction bf) { binaryOp(retVal, op2, value, bf); } template void binaryOp(CoinPackedVector& retVal, const CoinPackedVectorBase& op1, const CoinPackedVectorBase& op2, BinaryFunction bf) { retVal.clear(); const int s1 = op1.getNumElements(); const int s2 = op2.getNumElements(); /* Replaced || with &&, in response to complaint from Sven deVries, who rightly points out || is not appropriate for additive operations. && should be ok as long as binaryOp is understood not to create something from nothing. -- lh, 04.06.11 */ if (s1 == 0 && s2 == 0) return; retVal.reserve(s1+s2); const int * inds1 = op1.getIndices(); const double * elems1 = op1.getElements(); const int * inds2 = op2.getIndices(); const double * elems2 = op2.getElements(); int i; // loop once for each element in op1 for ( i=0; i CoinPackedVector binaryOp(const CoinPackedVectorBase& op1, double value, BinaryFunction bf) { CoinPackedVector retVal; retVal.setTestForDuplicateIndex(true); binaryOp(retVal, op1, value, bf); return retVal; } template CoinPackedVector binaryOp(double value, const CoinPackedVectorBase& op2, BinaryFunction bf) { CoinPackedVector retVal; retVal.setTestForDuplicateIndex(true); binaryOp(retVal, op2, value, bf); return retVal; } template CoinPackedVector binaryOp(const CoinPackedVectorBase& op1, const CoinPackedVectorBase& op2, BinaryFunction bf) { CoinPackedVector retVal; retVal.setTestForDuplicateIndex(true); binaryOp(retVal, op1, op2, bf); return retVal; } //----------------------------------------------------------------------------- /// Return the sum of two packed vectors inline CoinPackedVector operator+(const CoinPackedVectorBase& op1, const CoinPackedVectorBase& op2) { CoinPackedVector retVal; retVal.setTestForDuplicateIndex(true); binaryOp(retVal, op1, op2, std::plus()); return retVal; } /// Return the difference of two packed vectors inline CoinPackedVector operator-(const CoinPackedVectorBase& op1, const CoinPackedVectorBase& op2) { CoinPackedVector retVal; retVal.setTestForDuplicateIndex(true); binaryOp(retVal, op1, op2, std::minus()); return retVal; } /// Return the element-wise product of two packed vectors inline CoinPackedVector operator*(const CoinPackedVectorBase& op1, const CoinPackedVectorBase& op2) { CoinPackedVector retVal; retVal.setTestForDuplicateIndex(true); binaryOp(retVal, op1, op2, std::multiplies()); return retVal; } /// Return the element-wise ratio of two packed vectors inline CoinPackedVector operator/(const CoinPackedVectorBase& op1, const CoinPackedVectorBase& op2) { CoinPackedVector retVal; retVal.setTestForDuplicateIndex(true); binaryOp(retVal, op1, op2, std::divides()); return retVal; } //@} /// Returns the dot product of two CoinPackedVector objects whose elements are /// doubles. Use this version if the vectors are *not* guaranteed to be sorted. inline double sparseDotProduct(const CoinPackedVectorBase& op1, const CoinPackedVectorBase& op2){ int len, i; double acc = 0.0; CoinPackedVector retVal; CoinPackedVector retval = op1*op2; len = retval.getNumElements(); double * CParray = retval.getElements(); for(i = 0; i < len; i++){ acc += CParray[i]; } return acc; } /// Returns the dot product of two sorted CoinPackedVector objects. /// The vectors should be sorted in ascending order of indices. inline double sortedSparseDotProduct(const CoinPackedVectorBase& op1, const CoinPackedVectorBase& op2){ int i, j, len1, len2; double acc = 0.0; const double* v1val = op1.getElements(); const double* v2val = op2.getElements(); const int* v1ind = op1.getIndices(); const int* v2ind = op2.getIndices(); len1 = op1.getNumElements(); len2 = op2.getNumElements(); i = 0; j = 0; while(i < len1 && j < len2){ if(v1ind[i] == v2ind[j]){ acc += v1val[i] * v2val[j]; i++; j++; } else if(v2ind[j] < v1ind[i]){ j++; } else{ i++; } // end if-else-elseif } // end while return acc; } //----------------------------------------------------------------------------- /**@name Arithmetic operators on packed vector and a constant.
    These functions create a packed vector as a result. That packed vector will have the same indices as op1 and the specified operation is done entry-wise with the given value. */ //@{ /// Return the sum of a packed vector and a constant inline CoinPackedVector operator+(const CoinPackedVectorBase& op1, double value) { CoinPackedVector retVal(op1); retVal += value; return retVal; } /// Return the difference of a packed vector and a constant inline CoinPackedVector operator-(const CoinPackedVectorBase& op1, double value) { CoinPackedVector retVal(op1); retVal -= value; return retVal; } /// Return the element-wise product of a packed vector and a constant inline CoinPackedVector operator*(const CoinPackedVectorBase& op1, double value) { CoinPackedVector retVal(op1); retVal *= value; return retVal; } /// Return the element-wise ratio of a packed vector and a constant inline CoinPackedVector operator/(const CoinPackedVectorBase& op1, double value) { CoinPackedVector retVal(op1); retVal /= value; return retVal; } //----------------------------------------------------------------------------- /// Return the sum of a constant and a packed vector inline CoinPackedVector operator+(double value, const CoinPackedVectorBase& op1) { CoinPackedVector retVal(op1); retVal += value; return retVal; } /// Return the difference of a constant and a packed vector inline CoinPackedVector operator-(double value, const CoinPackedVectorBase& op1) { CoinPackedVector retVal(op1); const int size = retVal.getNumElements(); double* elems = retVal.getElements(); for (int i = 0; i < size; ++i) { elems[i] = value - elems[i]; } return retVal; } /// Return the element-wise product of a constant and a packed vector inline CoinPackedVector operator*(double value, const CoinPackedVectorBase& op1) { CoinPackedVector retVal(op1); retVal *= value; return retVal; } /// Return the element-wise ratio of a a constant and packed vector inline CoinPackedVector operator/(double value, const CoinPackedVectorBase& op1) { CoinPackedVector retVal(op1); const int size = retVal.getNumElements(); double* elems = retVal.getElements(); for (int i = 0; i < size; ++i) { elems[i] = value / elems[i]; } return retVal; } //@} //############################################################################# /** A function that tests the methods in the CoinPackedVector class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. */ void CoinPackedVectorUnitTest(); #endif CoinMP-1.8.3/CoinUtils/src/CoinWarmStartPrimalDual.hpp0000644000175000017500000001433611510456064021246 0ustar renerene/* $Id: CoinWarmStartPrimalDual.hpp 1372 2011-01-03 23:31:00Z lou $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinWarmStartPrimalDual_H #define CoinWarmStartPrimalDual_H #include "CoinHelperFunctions.hpp" #include "CoinWarmStart.hpp" #include "CoinWarmStartVector.hpp" //############################################################################# /** WarmStart information that is only a dual vector */ class CoinWarmStartPrimalDual : public virtual CoinWarmStart { public: /// return the size of the dual vector inline int dualSize() const { return dual_.size(); } /// return a pointer to the array of duals inline const double * dual() const { return dual_.values(); } /// return the size of the primal vector inline int primalSize() const { return primal_.size(); } /// return a pointer to the array of primals inline const double * primal() const { return primal_.values(); } /** Assign the primal/dual vectors to be the warmstart information. In this method the object assumes ownership of the pointers and upon return \c primal and \c dual will be a NULL pointers. If copying is desirable use the constructor. NOTE: \c primal and \c dual must have been allocated by new double[], because they will be freed by delete[] upon the desructtion of this object... */ void assign(int primalSize, int dualSize, double*& primal, double *& dual) { primal_.assignVector(primalSize, primal); dual_.assignVector(dualSize, dual); } CoinWarmStartPrimalDual() : primal_(), dual_() {} CoinWarmStartPrimalDual(int primalSize, int dualSize, const double* primal, const double * dual) : primal_(primalSize, primal), dual_(dualSize, dual) {} CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual& rhs) : primal_(rhs.primal_), dual_(rhs.dual_) {} CoinWarmStartPrimalDual& operator=(const CoinWarmStartPrimalDual& rhs) { if (this != &rhs) { primal_ = rhs.primal_; dual_ = rhs.dual_; } return *this; } /*! \brief Clear the data Make it appear as if the warmstart was just created using the default constructor. */ inline void clear() { primal_.clear(); dual_.clear(); } inline void swap(CoinWarmStartPrimalDual& rhs) { if (this != &rhs) { primal_.swap(rhs.primal_); dual_.swap(rhs.dual_); } } /** `Virtual constructor' */ virtual CoinWarmStart *clone() const { return new CoinWarmStartPrimalDual(*this); } virtual ~CoinWarmStartPrimalDual() {} /*! \name PrimalDual warm start `diff' methods */ //@{ /*! \brief Generate a `diff' that can convert the warm start passed as a parameter to the warm start specified by \c this. The capabilities are limited: the basis passed as a parameter can be no larger than the basis pointed to by \c this. */ virtual CoinWarmStartDiff* generateDiff (const CoinWarmStart *const oldCWS) const ; /*! \brief Apply \p diff to this warm start. Update this warm start by applying \p diff. It's assumed that the allocated capacity of the warm start is sufficiently large. */ virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ; //@} #if 0 protected: inline const CoinWarmStartVector& primalWarmStartVector() const { return primal_; } inline const CoinWarmStartVector& dualWarmStartVector() const { return dual_; } #endif private: ///@name Private data members //@{ CoinWarmStartVector primal_; CoinWarmStartVector dual_; //@} }; //############################################################################# /*! \class CoinWarmStartPrimalDualDiff \brief A `diff' between two CoinWarmStartPrimalDual objects This class exists in order to hide from the world the details of calculating and representing a `diff' between two CoinWarmStartPrimalDual objects. For convenience, assignment, cloning, and deletion are visible to the world, and default and copy constructors are made available to derived classes. Knowledge of the rest of this structure, and of generating and applying diffs, is restricted to the friend functions CoinWarmStartPrimalDual::generateDiff() and CoinWarmStartPrimalDual::applyDiff(). The actual data structure is a pair of vectors, #diffNdxs_ and #diffVals_. */ class CoinWarmStartPrimalDualDiff : public virtual CoinWarmStartDiff { friend CoinWarmStartDiff* CoinWarmStartPrimalDual::generateDiff(const CoinWarmStart *const oldCWS) const; friend void CoinWarmStartPrimalDual::applyDiff(const CoinWarmStartDiff *const diff) ; public: /*! \brief `Virtual constructor'. To be used when retaining polymorphism is important */ virtual CoinWarmStartDiff *clone() const { return new CoinWarmStartPrimalDualDiff(*this); } /*! \brief Destructor */ virtual ~CoinWarmStartPrimalDualDiff() {} protected: /*! \brief Default constructor This is protected (rather than private) so that derived classes can see it when they make their default constructor protected or private. */ CoinWarmStartPrimalDualDiff () : primalDiff_(), dualDiff_() {} /*! \brief Copy constructor For convenience when copying objects containing CoinWarmStartPrimalDualDiff objects. But consider whether you should be using #clone() to retain polymorphism. This is protected (rather than private) so that derived classes can see it when the make their copy constructor protected or private. */ CoinWarmStartPrimalDualDiff (const CoinWarmStartPrimalDualDiff &rhs) : primalDiff_(rhs.primalDiff_), dualDiff_(rhs.dualDiff_) {} /*! \brief Clear the data Make it appear as if the diff was just created using the default constructor. */ inline void clear() { primalDiff_.clear(); dualDiff_.clear(); } inline void swap(CoinWarmStartPrimalDualDiff& rhs) { if (this != &rhs) { primalDiff_.swap(rhs.primalDiff_); dualDiff_.swap(rhs.dualDiff_); } } private: /*! \brief These two differences describe the differences in the primal and in the dual vector. */ CoinWarmStartVectorDiff primalDiff_; CoinWarmStartVectorDiff dualDiff_; } ; #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveMonitor.cpp0000644000175000017500000002113212130031043020462 0ustar renerene/* $Id: CoinPresolveMonitor.cpp 1582 2013-04-06 14:33:07Z stefan $ */ // Copyright (C) 2011 Lou Hafer // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "CoinPresolveMatrix.hpp" #include "CoinPresolveMonitor.hpp" /*! \file This file contains methods for CoinPresolveMonitor, used to monitor changes to a row or column during presolve and postsolve */ /* Constructors */ /* Default constructor */ CoinPresolveMonitor::CoinPresolveMonitor () { } /* Constructor to initialise from a CoinPresolveMatrix (not threaded) */ CoinPresolveMonitor::CoinPresolveMonitor (const CoinPresolveMatrix *mtx, bool isRow, int k) { ndx_ = k ; isRow_ = isRow ; if (isRow) { origVec_ = extractRow(k,mtx) ; const double *blow = mtx->getRowLower() ; lb_ = blow[k] ; const double *b = mtx->getRowUpper() ; ub_ = b[k] ; } else { origVec_ = extractCol(k,mtx) ; const double *lb = mtx->getColLower() ; lb_ = lb[k] ; const double *ub = mtx->getColUpper() ; ub_ = ub[k] ; } origVec_->sortIncrIndex() ; } /* Constructor to initialise from a CoinPostsolveMatrix */ CoinPresolveMonitor::CoinPresolveMonitor (const CoinPostsolveMatrix *mtx, bool isRow, int k) { ndx_ = k ; isRow_ = isRow ; if (isRow) { origVec_ = extractRow(k,mtx) ; const double *blow = mtx->getRowLower() ; lb_ = blow[k] ; const double *b = mtx->getRowUpper() ; ub_ = b[k] ; } else { origVec_ = extractCol(k,mtx) ; const double *lb = mtx->getColLower() ; lb_ = lb[k] ; const double *ub = mtx->getColUpper() ; ub_ = ub[k] ; } origVec_->sortIncrIndex() ; } /* Extract a row from a CoinPresolveMatrix. Since a CoinPresolveMatrix contains both row-ordered and column-ordered copies, this is relatively efficient. */ CoinPackedVector *CoinPresolveMonitor::extractRow (int i, const CoinPresolveMatrix *mtx) const { const CoinBigIndex *rowStarts = mtx->getRowStarts() ; const int *colIndices = mtx->getColIndicesByRow() ; const double *coeffs = mtx->getElementsByRow() ; const int rowLen = mtx->hinrow_[i] ; const CoinBigIndex &ii = rowStarts[i] ; return (new CoinPackedVector(rowLen,&colIndices[ii],&coeffs[ii])) ; } /* Extract a column from a CoinPresolveMatrix. Since a CoinPresolveMatrix contains both row-ordered and column-ordered copies, this is relatively efficient. */ CoinPackedVector *CoinPresolveMonitor::extractCol (int j, const CoinPresolveMatrix *mtx) const { const CoinBigIndex *colStarts = mtx->getColStarts() ; const int *colLens = mtx->getColLengths() ; const int *rowIndices = mtx->getRowIndicesByCol() ; const double *coeffs = mtx->getElementsByCol() ; const CoinBigIndex &jj = colStarts[j] ; return (new CoinPackedVector(colLens[j],&rowIndices[jj],&coeffs[jj])) ; } /* Extract a row from a CoinPostsolveMatrix. This is very painful, because the matrix is threaded column-ordered only. We have to scan every entry in the matrix, looking for entries that match the requested row index. */ CoinPackedVector *CoinPresolveMonitor::extractRow (int i, const CoinPostsolveMatrix *mtx) const { const CoinBigIndex *colStarts = mtx->getColStarts() ; const int *colLens = mtx->getColLengths() ; const double *coeffs = mtx->getElementsByCol() ; const int *rowIndices = mtx->getRowIndicesByCol() ; const CoinBigIndex *colLinks = mtx->link_ ; int n = mtx->getNumCols() ; CoinPackedVector *pkvec = new CoinPackedVector() ; for (int j = 0 ; j < n ; j++) { const CoinBigIndex ii = presolve_find_row3(i,colStarts[j],colLens[j],rowIndices,colLinks) ; if (ii >= 0) pkvec->insert(j,coeffs[ii]) ; } return (pkvec) ; } /* Extract a column from a CoinPostsolveMatrix. At least here we only need to walk one threaded column. */ CoinPackedVector *CoinPresolveMonitor::extractCol (int j, const CoinPostsolveMatrix *mtx) const { const CoinBigIndex *colStarts = mtx->getColStarts() ; const int *colLens = mtx->getColLengths() ; const double *coeffs = mtx->getElementsByCol() ; const int *rowIndices = mtx->getRowIndicesByCol() ; const CoinBigIndex *colLinks = mtx->link_ ; CoinPackedVector *pkvec = new CoinPackedVector() ; CoinBigIndex jj = colStarts[j] ; const int &lenj = colLens[j] ; for (int k = 0 ; k < lenj ; k++) { pkvec->insert(rowIndices[jj],coeffs[jj]) ; jj = colLinks[jj] ; } return (pkvec) ; } /* Extract the current version of the row or column from the CoinPresolveMatrix into a CoinPackedVector, sort it, and compare it to the stored CoinPackedVector. Differences are reported to std::cout. */ void CoinPresolveMonitor::checkAndTell (const CoinPresolveMatrix *mtx) { CoinPackedVector *curVec = 0 ; const double *lbs = 0 ; const double *ubs = 0 ; if (isRow_) { lbs = mtx->getRowLower() ; ubs = mtx->getRowUpper() ; curVec = extractRow(ndx_,mtx) ; } else { curVec = extractCol(ndx_,mtx) ; lbs = mtx->getColLower() ; ubs = mtx->getColUpper() ; } checkAndTell(curVec,lbs[ndx_],ubs[ndx_]) ; } /* Extract the current version of the row or column from the CoinPostsolveMatrix into a CoinPackedVector, sort it, and compare it to the stored CoinPackedVector. Differences are reported to std::cout. */ void CoinPresolveMonitor::checkAndTell (const CoinPostsolveMatrix *mtx) { CoinPackedVector *curVec = 0 ; const double *lbs = 0 ; const double *ubs = 0 ; if (isRow_) { lbs = mtx->getRowLower() ; ubs = mtx->getRowUpper() ; curVec = extractRow(ndx_,mtx) ; } else { curVec = extractCol(ndx_,mtx) ; lbs = mtx->getColLower() ; ubs = mtx->getColUpper() ; } checkAndTell(curVec,lbs[ndx_],ubs[ndx_]) ; } /* And the worker method, which does the actual diff of the vectors and also checks the bounds. If the vector fails a quick check with ==, extract the indices, merge them, and then walk the indices checking for presence in each vector. Where both elements are present, check the coefficient. Report any differences. Not the most efficient implementation, but it leverages existing capabilities. */ void CoinPresolveMonitor::checkAndTell (CoinPackedVector *curVec, double lb, double ub) { curVec->sortIncrIndex() ; std::cout << "checking " << ((isRow_)?"row ":"column ") << ndx_ << " ..." ; int diffcnt = 0 ; if (lb_ != lb) { diffcnt++ ; std::cout << std::endl << " " << ((isRow_)?"blow":"lb") << " = " << lb_ << " in original, " << lb << " in current." ; } if (ub_ != ub) { diffcnt++ ; std::cout << std::endl << " " << ((isRow_)?"b":"ub") << " = " << ub_ << " in original, " << ub << " in current." ; } bool vecDiff = ((*origVec_) == (*curVec)) ; /* Dispense with the easy outcomes. */ if (diffcnt == 0 && !vecDiff) { std::cout << " equal." << std::endl ; return ; } else if (!vecDiff) { std::cout << std::endl << " coefficients equal." << std::endl ; return ; } /* We have to compare the coefficients. Merge the index sets. */ int origLen = origVec_->getNumElements() ; int curLen = curVec->getNumElements() ; int mergedLen = origLen+curLen ; int *mergedIndices = new int [mergedLen] ; CoinCopyN(origVec_->getIndices(),origLen,mergedIndices) ; CoinCopyN(curVec->getIndices(),curLen,mergedIndices+origLen) ; std::inplace_merge(mergedIndices,mergedIndices+origLen, mergedIndices+mergedLen) ; int *uniqEnd = std::unique(mergedIndices,mergedIndices+mergedLen) ; int uniqLen = static_cast(uniqEnd-mergedIndices) ; for (int k = 0 ; k < uniqLen ; k++) { int j = mergedIndices[k] ; double aij_orig = 0.0 ; double aij_cur = 0.0 ; bool inOrig = false ; bool inCur = false ; if (origVec_->findIndex(j) >= 0) { inOrig = true ; aij_orig = (*origVec_)[j] ; } if (curVec->findIndex(j) >= 0) { inCur = true ; aij_cur = (*curVec)[j] ; } if (inOrig == false || inCur == false || aij_orig != aij_cur) { diffcnt++ ; std::cout << std::endl << " " ; if (isRow_) std::cout << "coeff a(" << ndx_ << "," << j << ") " ; else std::cout << "coeff a(" << j << "," << ndx_ << ") " ; if (inOrig == false) std::cout << "= " << aij_cur << " not present in original." ; else if (inCur == false) std::cout << "= " << aij_orig << " not present in current." ; else std::cout << " = " << aij_orig << " in original, " << aij_cur << " in current." ; } } std::cout << std::endl << " " << diffcnt << " changes." << std::endl ; delete[] mergedIndices ; } CoinMP-1.8.3/CoinUtils/src/config_coinutils_default.h0000644000175000017500000000262012574604646021245 0ustar renerene /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC PUBLIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Version number of project */ #define COINUTILS_VERSION "2.10.10" /* Major Version number of project */ #define COINUTILS_VERSION_MAJOR 2 /* Minor Version number of project */ #define COINUTILS_VERSION_MINOR 10 /* Release Version number of project */ #define COINUTILS_VERSION_RELEASE 10 /* Define to 64bit integer types. Note that MS does not provide __uint64. Microsoft defines types in BaseTsd.h, part of the Windows SDK. Given that this file only gets used in the Visual Studio environment, it seems to me we'll be better off simply including it and using the types MS defines. But since I have no idea of history here, I'll leave all of this inside the guard for MSC_VER >= 1200. If you're reading this and have been developing in MSVS long enough to know, fix it. -- lh, 100915 -- */ #if _MSC_VER >= 1200 # include # define COIN_INT64_T INT64 # define COIN_UINT64_T UINT64 /* Define to integer type capturing pointer */ # define COIN_INTPTR_T ULONG_PTR #else # define COIN_INT64_T long long # define COIN_UINT64_T unsigned long long # define COIN_INTPTR_T int* #endif CoinMP-1.8.3/CoinUtils/src/CoinTime.hpp0000644000175000017500000002141211510456064016236 0ustar renerene/* $Id: CoinTime.hpp 1372 2011-01-03 23:31:00Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef _CoinTime_hpp #define _CoinTime_hpp // Uncomment the next three lines for thorough memory initialisation. // #ifndef ZEROFAULT // # define ZEROFAULT // #endif //############################################################################# #include #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #else // MacOS-X and FreeBSD needs sys/time.h #if defined(__MACH__) || defined (__FreeBSD__) #include #endif #if !defined(__MSVCRT__) #include #endif #endif //############################################################################# #if defined(_MSC_VER) #if 0 // change this to 1 if want to use the win32 API #include #ifdef small /* for some unfathomable reason (to me) rpcndr.h (pulled in by windows.h) does a '#define small char' */ #undef small #endif #define TWO_TO_THE_THIRTYTWO 4294967296.0 #define DELTA_EPOCH_IN_SECS 11644473600.0 inline double CoinGetTimeOfDay() { FILETIME ft; GetSystemTimeAsFileTime(&ft); double t = ft.dwHighDateTime * TWO_TO_THE_THIRTYTWO + ft.dwLowDateTime; t = t/10000000.0 - DELTA_EPOCH_IN_SECS; return t; } #else #include #include inline double CoinGetTimeOfDay() { struct _timeb timebuffer; #pragma warning(disable:4996) _ftime( &timebuffer ); // C4996 #pragma warning(default:4996) return timebuffer.time + timebuffer.millitm/1000.0; } #endif #else #include inline double CoinGetTimeOfDay() { struct timeval tv; gettimeofday(&tv, NULL); return static_cast(tv.tv_sec) + static_cast(tv.tv_usec)/1000000.0; } #endif // _MSC_VER /** Query the elapsed wallclock time since the first call to this function. If a positive argument is passed to the function then the time of the first call is set to that value (this kind of argument is allowed only at the first call!). If a negative argument is passed to the function then it returns the time when it was set. */ inline double CoinWallclockTime(double callType = 0) { double callTime = CoinGetTimeOfDay(); static const double firstCall = callType > 0 ? callType : callTime; return callType < 0 ? firstCall : callTime - firstCall; } //############################################################################# //#define HAVE_SDK // if SDK under Win32 is installed, for CPU instead of elapsed time under Win #ifdef HAVE_SDK #include #ifdef small /* for some unfathomable reason (to me) rpcndr.h (pulled in by windows.h) does a '#define small char' */ #undef small #endif #define TWO_TO_THE_THIRTYTWO 4294967296.0 #endif static inline double CoinCpuTime() { double cpu_temp; #if defined(_MSC_VER) || defined(__MSVCRT__) #ifdef HAVE_SDK FILETIME creation; FILETIME exit; FILETIME kernel; FILETIME user; GetProcessTimes(GetCurrentProcess(), &creation, &exit, &kernel, &user); double t = user.dwHighDateTime * TWO_TO_THE_THIRTYTWO + user.dwLowDateTime; return t/10000000.0; #else unsigned int ticksnow; /* clock_t is same as int */ ticksnow = (unsigned int)clock(); cpu_temp = (double)((double)ticksnow/CLOCKS_PER_SEC); #endif #else struct rusage usage; # ifdef ZEROFAULT usage.ru_utime.tv_sec = 0 ; usage.ru_utime.tv_usec = 0 ; # endif getrusage(RUSAGE_SELF,&usage); cpu_temp = static_cast(usage.ru_utime.tv_sec); cpu_temp += 1.0e-6*(static_cast (usage.ru_utime.tv_usec)); #endif return cpu_temp; } //############################################################################# static inline double CoinSysTime() { double sys_temp; #if defined(_MSC_VER) || defined(__MSVCRT__) sys_temp = 0.0; #else struct rusage usage; # ifdef ZEROFAULT usage.ru_utime.tv_sec = 0 ; usage.ru_utime.tv_usec = 0 ; # endif getrusage(RUSAGE_SELF,&usage); sys_temp = static_cast(usage.ru_stime.tv_sec); sys_temp += 1.0e-6*(static_cast (usage.ru_stime.tv_usec)); #endif return sys_temp; } //############################################################################# // On most systems SELF seems to include children threads, This is for when it doesn't static inline double CoinCpuTimeJustChildren() { double cpu_temp; #if defined(_MSC_VER) || defined(__MSVCRT__) cpu_temp = 0.0; #else struct rusage usage; # ifdef ZEROFAULT usage.ru_utime.tv_sec = 0 ; usage.ru_utime.tv_usec = 0 ; # endif getrusage(RUSAGE_CHILDREN,&usage); cpu_temp = static_cast(usage.ru_utime.tv_sec); cpu_temp += 1.0e-6*(static_cast (usage.ru_utime.tv_usec)); #endif return cpu_temp; } //############################################################################# #include /** This class implements a timer that also implements a tracing functionality. The timer stores the start time of the timer, for how much time it was set to and when does it expire (start + limit = end). Queries can be made that tell whether the timer is expired, is past an absolute time, is past a percentage of the length of the timer. All times are given in seconds, but as double numbers, so there can be fractional values. The timer can also be initialized with a stream and a specification whether to write to or read from the stream. In the former case the result of every query is written into the stream, in the latter case timing is not tested at all, rather the supposed result is read out from the stream. This makes it possible to exactly retrace time sensitive program execution. */ class CoinTimer { private: /// When the timer was initialized/reset/restarted double start; /// double limit; double end; #ifdef COIN_COMPILE_WITH_TRACING std::fstream* stream; bool write_stream; #endif private: #ifdef COIN_COMPILE_WITH_TRACING inline bool evaluate(bool b_tmp) const { int i_tmp = b_tmp; if (stream) { if (write_stream) (*stream) << i_tmp << "\n"; else (*stream) >> i_tmp; } return i_tmp; } inline double evaluate(double d_tmp) const { if (stream) { if (write_stream) (*stream) << d_tmp << "\n"; else (*stream) >> d_tmp; } return d_tmp; } #else inline bool evaluate(const bool b_tmp) const { return b_tmp; } inline double evaluate(const double d_tmp) const { return d_tmp; } #endif public: /// Default constructor creates a timer with no time limit and no tracing CoinTimer() : start(0), limit(1e100), end(1e100) #ifdef COIN_COMPILE_WITH_TRACING , stream(0), write_stream(true) #endif {} /// Create a timer with the given time limit and with no tracing CoinTimer(double lim) : start(CoinCpuTime()), limit(lim), end(start+lim) #ifdef COIN_COMPILE_WITH_TRACING , stream(0), write_stream(true) #endif {} #ifdef COIN_COMPILE_WITH_TRACING /** Create a timer with no time limit and with writing/reading the trace to/from the given stream, depending on the argument \c write. */ CoinTimer(std::fstream* s, bool write) : start(0), limit(1e100), end(1e100), stream(s), write_stream(write) {} /** Create a timer with the given time limit and with writing/reading the trace to/from the given stream, depending on the argument \c write. */ CoinTimer(double lim, std::fstream* s, bool w) : start(CoinCpuTime()), limit(lim), end(start+lim), stream(s), write_stream(w) {} #endif /// Restart the timer (keeping the same time limit) inline void restart() { start=CoinCpuTime(); end=start+limit; } /// An alternate name for \c restart() inline void reset() { restart(); } /// Reset (and restart) the timer and change its time limit inline void reset(double lim) { limit=lim; restart(); } /** Return whether the given percentage of the time limit has elapsed since the timer was started */ inline bool isPastPercent(double pct) const { return evaluate(start + limit * pct < CoinCpuTime()); } /** Return whether the given amount of time has elapsed since the timer was started */ inline bool isPast(double lim) const { return evaluate(start + lim < CoinCpuTime()); } /** Return whether the originally specified time limit has passed since the timer was started */ inline bool isExpired() const { return evaluate(end < CoinCpuTime()); } /** Return how much time is left on the timer */ inline double timeLeft() const { return evaluate(end - CoinCpuTime()); } /** Return how much time has elapsed */ inline double timeElapsed() const { return evaluate(CoinCpuTime() - start); } inline void setLimit(double l) { limit = l; return; } }; #endif CoinMP-1.8.3/CoinUtils/src/CoinPragma.hpp0000644000175000017500000000152611510456064016553 0ustar renerene/* $Id: CoinPragma.hpp 1372 2011-01-03 23:31:00Z lou $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPragma_H #define CoinPragma_H //------------------------------------------------------------------- // // This is a file which can contain Pragma's that are // generally applicable to any source file. // //------------------------------------------------------------------- #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) // Turn off compiler warning: // "empty controlled statement found; is this the intent?" # pragma warning(disable:4390) // Turn off compiler warning about deprecated functions # pragma warning(disable:4996) #endif #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveEmpty.cpp0000644000175000017500000004200212170760637020156 0ustar renerene/* $Id: CoinPresolveEmpty.cpp 1606 2013-07-15 11:48:47Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinFinite.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" #include "CoinPresolveEmpty.hpp" #include "CoinMessage.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif /* \file Routines to remove/reinsert empty columns and rows. */ /* Physically remove empty columns, compressing mcstrt and hincol. The major side effect is that columns are renumbered, thus clink_ is no longer valid and must be rebuilt. And we're totally inconsistent with the row-major representation. It's necessary to rebuild clink_ in order to do direct conversion of a CoinPresolveMatrix to a CoinPostsolveMatrix by transferring the data arrays. Without clink_, it's impractical to build link_ to match the transferred bulk storage. */ const CoinPresolveAction *drop_empty_cols_action::presolve (CoinPresolveMatrix *prob, const int *ecols, int necols, const CoinPresolveAction *next) { # if PRESOLVE_CONSISTENCY > 0 presolve_links_ok(prob) ; presolve_consistent(prob) ; # endif const int n_orig = prob->ncols_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; presolvehlink *clink = prob->clink_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *cost = prob->cost_ ; const double ztoldj = prob->ztoldj_ ; unsigned char *integerType = prob->integerType_ ; int *originalColumn = prob->originalColumn_ ; const double maxmin = prob->maxmin_ ; double *sol = prob->sol_ ; unsigned char *colstat = prob->colstat_ ; action *actions = new action[necols] ; int *colmapping = new int [n_orig+1] ; CoinZeroN(colmapping,n_orig) ; // More like `ignore infeasibility' bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; /* Open a loop to walk the list of empty columns. Mark them as empty in colmapping. */ for (int ndx = necols-1 ; ndx >= 0 ; ndx--) { const int j = ecols[ndx] ; colmapping[j] = -1 ; /* Groom bounds on integral variables. Check for previously undetected infeasibility unless the user wants to ignore it. If we find it, quit. */ double &lj = clo[j] ; double &uj = cup[j] ; if (integerType[j]) { lj = ceil(lj-1.0e-9) ; uj = floor(uj+1.0e-9) ; if (lj > uj && !fixInfeasibility) { prob->status_ |= 1 ; prob->messageHandler()->message(COIN_PRESOLVE_COLINFEAS, prob->messages()) << j << lj << uj << CoinMessageEol ; break ; } } /* Load up the postsolve action with the index and rim vector components. */ action &e = actions[ndx] ; e.jcol = j ; e.clo = lj ; e.cup = uj ; e.cost = cost[j] ; /* There are no more constraints on this variable so we had better be able to compute the answer now. Try to make it nonbasic at bound. If we're unbounded, say so and quit. */ if (fabs(cost[j]) < ztoldj) cost[j] = 0.0 ; if (cost[j] == 0.0) { if (-PRESOLVE_INF < lj) e.sol = lj ; else if (uj < PRESOLVE_INF) e.sol = uj ; else e.sol = 0.0 ; } else if (cost[j]*maxmin > 0.0) { if (-PRESOLVE_INF < lj) e.sol = lj ; else { prob->messageHandler()->message(COIN_PRESOLVE_COLUMNBOUNDB, prob->messages()) << j << CoinMessageEol ; prob->status_ |= 2 ; break ; } } else { if (uj < PRESOLVE_INF) e.sol = uj ; else { prob->messageHandler()->message(COIN_PRESOLVE_COLUMNBOUNDA, prob->messages()) << j << CoinMessageEol ; prob->status_ |= 2 ; break ; } } # if PRESOLVE_DEBUG > 2 if (e.sol*cost[j]) { std::cout << " non-zero cost " << cost[j] << " for empty col " << j << "." << std::endl ; } # endif prob->change_bias(e.sol*cost[j]) ; } /* No sense doing the actual work of compression unless we're still feasible and bounded. If we are, start out by compressing out the entries associated with empty columns. Empty columns are nonzero in colmapping. */ if (prob->status_ == 0) { int n_compressed = 0 ; for (int ndx = 0 ; ndx < n_orig ; ndx++) { if (!colmapping[ndx]) { mcstrt[n_compressed] = mcstrt[ndx] ; hincol[n_compressed] = hincol[ndx] ; clo[n_compressed] = clo[ndx] ; cup[n_compressed] = cup[ndx] ; cost[n_compressed] = cost[ndx] ; if (sol) { sol[n_compressed] = sol[ndx] ; colstat[n_compressed] = colstat[ndx] ; } integerType[n_compressed] = integerType[ndx] ; originalColumn[n_compressed] = originalColumn[ndx] ; colmapping[ndx] = n_compressed++ ; } } mcstrt[n_compressed] = mcstrt[n_orig] ; colmapping[n_orig] = n_compressed ; /* Rebuild clink_. At this point, all empty columns are linked out, so the only columns left are columns that are to be saved, hence available in colmapping. All we need to do is walk clink_ and write the new entries into a new array. */ presolvehlink *newclink = new presolvehlink [n_compressed+1] ; for (int oldj = n_orig ; oldj >= 0 ; oldj = clink[oldj].pre) { presolvehlink &oldlnk = clink[oldj] ; int newj = colmapping[oldj] ; assert(newj >= 0 && newj <= n_compressed) ; presolvehlink &newlnk = newclink[newj] ; if (oldlnk.suc >= 0) { newlnk.suc = colmapping[oldlnk.suc] ; } else { newlnk.suc = NO_LINK ; } if (oldlnk.pre >= 0) { newlnk.pre = colmapping[oldlnk.pre] ; } else { newlnk.pre = NO_LINK ; } } delete [] clink ; prob->clink_ = newclink ; prob->ncols_ = n_compressed ; } delete [] colmapping ; # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_links_ok(prob,true,false) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif return (new drop_empty_cols_action(necols,actions,next)) ; } /* The top-level method scans the matrix for empty columns and calls a worker routine to do the heavy lifting. NOTE: At the end of this routine, the column- and row-major representations are not consistent. Empty columns have been compressed out, effectively renumbering the columns. */ const CoinPresolveAction *drop_empty_cols_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering drop_empty_cols_action::presolve." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif const int *hincol = prob->hincol_ ; int ncols = prob->ncols_ ; int nempty = 0 ; int *empty = new int [ncols] ; CoinBigIndex nelems2 = 0 ; // count empty cols for (int i = 0 ; i < ncols ; i++) { nelems2 += hincol[i] ; if (hincol[i] == 0&&!prob->colProhibited2(i)) { # if PRESOLVE_DEBUG > 1 if (nempty == 0) std::cout << "UNUSED COLS:" ; else if (i < 100 && nempty%25 == 0) std::cout << std::endl ; else if (i >= 100 && i < 1000 && nempty%19 == 0) std::cout << std::endl ; else if (i >= 1000 && nempty%15 == 0) std::cout << std::endl ; std::cout << " " << i ; # endif empty[nempty++] = i; } } prob->nelems_ = nelems2 ; if (nempty) next = drop_empty_cols_action::presolve(prob,empty,nempty,next) ; delete [] empty ; # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 std::cout << "Leaving drop_empty_cols_action::presolve" ; if (nempty) std::cout << ", dropped " << nempty << " columns" ; std::cout << "." << std::endl ; # endif return (next); } /* Reintroduce empty columns dropped at the end of presolve. */ void drop_empty_cols_action::postsolve(CoinPostsolveMatrix *prob) const { const int nactions = nactions_ ; const action *const actions = actions_ ; int ncols = prob->ncols_ ; # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering drop_empty_cols_action::postsolve, initial system " << prob->nrows_ << "x" << ncols << ", " << nactions << " columns to restore." << std::endl ; # endif char *cdone = prob->cdone_ ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif CoinBigIndex *colStarts = prob->mcstrt_ ; int *colLengths = prob->hincol_ ; double *clo = prob->clo_ ; double *cup = prob->cup_ ; double *sol = prob->sol_ ; double *cost = prob->cost_ ; double *rcosts = prob->rcosts_ ; unsigned char *colstat = prob->colstat_ ; const double maxmin = prob->maxmin_ ; /* Set up a mapping vector, coded 0 for existing columns, -1 for columns we're about to reintroduce. */ int ncols2 = ncols+nactions ; int *colmapping = new int [ncols2] ; CoinZeroN(colmapping,ncols2) ; for (int ndx = 0 ; ndx < nactions ; ndx++) { const action *e = &actions[ndx] ; int j = e->jcol ; colmapping[j] = -1 ; } /* Working back from the highest index, expand the existing ncols columns over the full range ncols2, leaving holes for the columns we want to reintroduce. */ for (int j = ncols2-1 ; j >= 0 ; j--) { if (!colmapping[j]) { ncols-- ; colStarts[j] = colStarts[ncols] ; colLengths[j] = colLengths[ncols] ; clo[j] = clo[ncols] ; cup[j] = cup[ncols] ; cost[j] = cost[ncols] ; if (sol) sol[j] = sol[ncols] ; if (rcosts) rcosts[j] = rcosts[ncols] ; if (colstat) colstat[j] = colstat[ncols] ; # if PRESOLVE_DEBUG > 0 cdone[j] = cdone[ncols] ; # endif } } assert (!ncols) ; delete [] colmapping ; /* Reintroduce the dropped columns. */ for (int ndx = 0 ; ndx < nactions ; ndx++) { const action *e = &actions[ndx] ; int j = e->jcol ; colLengths[j] = 0 ; colStarts[j] = NO_LINK ; clo[j] = e->clo ; cup[j] = e->cup ; cost[j] = e->cost ; if (sol) sol[j] = e->sol ; if (rcosts) rcosts[j] = maxmin*cost[j] ; if (colstat) prob->setColumnStatusUsingValue(j) ; # if PRESOLVE_DEBUG > 0 cdone[j] = DROP_COL ; # if PRESOLVE_DEBUG > 1 std::cout << " restoring col " << j << ", lb = " << clo[j] << ", ub = " << cup[j] << std::endl ; # endif # endif } prob->ncols_ += nactions ; # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving drop_empty_cols_action::postsolve, system " << prob->nrows_ << "x" << prob->ncols_ << "." << std::endl ; # endif # endif } const CoinPresolveAction *drop_empty_rows_action::presolve (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { # if PRESOLVE_DEBUG > 0 std::cout << "Entering drop_empty_rows_action::presolve." << std::endl ; # endif int ncols = prob->ncols_; CoinBigIndex *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; int *hrow = prob->hrow_; int nrows = prob->nrows_; // This is done after row copy needed //int *mrstrt = prob->mrstrt_; int *hinrow = prob->hinrow_; //int *hcol = prob->hcol_; double *rlo = prob->rlo_; double *rup = prob->rup_; unsigned char *rowstat = prob->rowstat_; double *acts = prob->acts_; int * originalRow = prob->originalRow_; //presolvehlink *rlink = prob->rlink_; bool fixInfeasibility = ((prob->presolveOptions_&0x4000) != 0) ; // Relax tolerance double tolerance = 10.0*prob->feasibilityTolerance_; int i; int nactions = 0; for (i=0; i 0 std::cout << "Leaving drop_empty_rows_action::presolve." << std::endl ; # endif return (next) ; } /* Work to do. */ action *actions = new action[nactions]; int * rowmapping = new int [nrows]; nactions = 0; int nrows2=0; for (i=0; i 1 if (nactions == 0) std::cout << "UNUSED ROWS:" ; else if (i < 100 && nactions%25 == 0) std::cout << std::endl ; else if (i >= 100 && i < 1000 && nactions%19 == 0) std::cout << std::endl ; else if (i >= 1000 && nactions%15 == 0) std::cout << std::endl ; std::cout << " " << i ; # endif nactions++; if (rlo[i] > 0.0 || rup[i] < 0.0) { if ((rlo[i]<=tolerance && rup[i]>=-tolerance)||fixInfeasibility) { rlo[i]=0.0; rup[i]=0.0; } else { prob->status_|= 1; prob->messageHandler()->message(COIN_PRESOLVE_ROWINFEAS, prob->messages()) < 1 std::cout << std::endl ; # endif // remap matrix for (i=0;inrows_ = nrows2; next = new drop_empty_rows_action(nactions,actions,next) ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving drop_empty_rows_action::presolve" ; if (nactions) std::cout << ", dropped " << nactions << " rows" ; std::cout << "." << std::endl ; # endif # endif return (next) ; } void drop_empty_rows_action::postsolve(CoinPostsolveMatrix *prob) const { const int nactions = nactions_ ; const action *const actions = actions_ ; int ncols = prob->ncols_ ; int nrows0 = prob->nrows0_ ; int nrows = prob->nrows_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; int *hrow = prob->hrow_ ; double *rlo = prob->rlo_ ; double *rup = prob->rup_ ; unsigned char *rowstat = prob->rowstat_ ; double *rowduals = prob->rowduals_ ; double *acts = prob->acts_ ; # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering drop_empty_rows_action::postsolve, initial system " << nrows << "x" << ncols << ", " << nactions << " rows to restore." << std::endl ; # endif char *rdone = prob->rdone_ ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # endif /* Process the array of actions and mark rowmapping[i] if constraint i was eliminated in presolve. */ int *rowmapping = new int [nrows0] ; CoinZeroN(rowmapping,nrows0) ; for (int k = 0 ; k < nactions ; k++) { const action *e = &actions[k] ; int i = e->row ; rowmapping[i] = -1 ; } /* Now walk the vectors for row bounds, activity, duals, and status. Expand the existing entries in 0..(nrows-1) to occupy 0..(nrows0-1), leaving holes for the rows we're about to reintroduce. */ for (int i = nrows0-1 ; i >= 0 ; i--) { if (!rowmapping[i]) { nrows-- ; rlo[i] = rlo[nrows] ; rup[i] = rup[nrows] ; acts[i] = acts[nrows] ; rowduals[i] = rowduals[nrows] ; if (rowstat) rowstat[i] = rowstat[nrows] ; # if PRESOLVE_DEBUG > 0 rdone[i] = rdone[nrows] ; # endif } } assert (!nrows) ; /* Rewrite rowmapping so that it maps presolved row indices to row indices in the restored matrix. */ for (int i = 0 ; i < nrows0 ; i++) { if (!rowmapping[i]) rowmapping[nrows++] = i ; } /* Now walk the row index array for each column, rewriting the row indices so they are correct for the restored matrix. */ for (int j = 0 ; j < ncols ; j++) { const CoinBigIndex &start = mcstrt[j] ; const CoinBigIndex &end = start+hincol[j] ; for (CoinBigIndex k = start ; k < end ; k++) { hrow[k] = rowmapping[hrow[k]] ; } } delete [] rowmapping; /* And reintroduce the (still empty) rows that were removed in presolve. The assumption is that an empty row cannot be tight, hence the logical is basic and the dual is zero. */ for (int k = 0 ; k < nactions ; k++) { const action *e = &actions[k] ; int i = e->row ; rlo[i] = e->rlo ; rup[i] = e->rup ; acts[i] = 0.0 ; if (rowstat) prob->setRowStatus(i,CoinPrePostsolveMatrix::basic) ; rowduals[i] = 0.0 ; # if PRESOLVE_DEBUG > 0 rdone[i] = DROP_ROW; # if PRESOLVE_DEBUG > 1 std::cout << " restoring row " << i << ", LB = " << rlo[i] << ", UB = " << rup[i] << std::endl ; # endif # endif } prob->nrows_ += nactions ; assert(prob->nrows_ == prob->nrows0_) ; # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_check_threads(prob) ; presolve_check_sol(prob,2,2,2) ; presolve_check_nbasic(prob) ; # if PRESOLVE_DEBUG > 0 std::cout << "Leaving drop_empty_rows_action::postsolve, system " << prob->nrows_ << "x" << prob->ncols_ << "." << std::endl ; # endif # endif } CoinMP-1.8.3/CoinUtils/src/CoinParam.hpp0000644000175000017500000005275011654022247016412 0ustar renerene/* $Id: CoinParam.hpp 1493 2011-11-01 16:56:07Z tkr $ */ #ifndef CoinParam_H #define CoinParam_H /* Copyright (C) 2002, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ /*! \file CoinParam.hpp \brief Declaration of a class for command line parameters. */ #include #include #include /*! \class CoinParam \brief A base class for `keyword value' command line parameters. The underlying paradigm is that a parameter specifies an action to be performed on a target object. The base class provides two function pointers, a `push' function and a `pull' function. By convention, a push function will set some value in the target object or perform some action using the target object. A `pull' function will retrieve some value from the target object. This is only a convention, however; CoinParam and associated utilities make no use of these functions and have no hardcoded notion of how they should be used. The action to be performed, and the target object, will be specific to a particular application. It is expected that users will derive application-specific parameter classes from this base class. A derived class will typically add fields and methods to set/get a code for the action to be performed (often, an enum class) and the target object (often, a pointer or reference). Facilities provided by the base class and associated utility routines include:
    • Support for common parameter types with numeric, string, or keyword values.
    • Support for short and long help messages.
    • Pointers to `push' and `pull' functions as described above.
    • Command line parsing and keyword matching.
    All utility routines are declared in the #CoinParamUtils namespace. The base class recognises five types of parameters: actions (which require no value); numeric parameters with integer or real (double) values; keyword parameters, where the value is one of a defined set of value-keywords; and string parameters (where the value is a string). The base class supports the definition of a valid range, a default value, and short and long help messages for a parameter. As defined by the #CoinParamFunc typedef, push and pull functions should take a single parameter, a pointer to a CoinParam. Typically this object will actually be a derived class as described above, and the implementation function will have access to all capabilities of CoinParam and of the derived class. When specified as command line parameters, the expected syntax is `-keyword value' or `-keyword=value'. You can also use the Gnu double-dash style, `--keyword'. Spaces around the `=' will \e not work. The keyword (name) for a parameter can be defined with an `!' to mark the minimal match point. For example, allow!ableGap will be considered matched by the strings `allow', `allowa', `allowab', \e etc. Similarly, the value-keyword strings for keyword parameters can be defined with `!' to mark the minimal match point. Matching of keywords and value-keywords is \e not case sensitive. */ class CoinParam { public: /*! \name Subtypes */ //@{ /*! \brief Enumeration for the types of parameters supported by CoinParam CoinParam provides support for several types of parameters:
    • Action parameters, which require no value.
    • Integer and double numeric parameters, with upper and lower bounds.
    • String parameters that take an arbitrary string value.
    • Keyword parameters that take a defined set of string (value-keyword) values. Value-keywords are associated with integers in the order in which they are added, starting from zero.
    */ typedef enum { coinParamInvalid = 0, coinParamAct, coinParamInt, coinParamDbl, coinParamStr, coinParamKwd } CoinParamType ; /*! \brief Type declaration for push and pull functions. By convention, a return code of 0 indicates execution without error, >0 indicates nonfatal error, and <0 indicates fatal error. This is only convention, however; the base class makes no use of the push and pull functions and has no hardcoded interpretation of the return code. */ typedef int (*CoinParamFunc)(CoinParam *param) ; //@} /*! \name Constructors and Destructors Be careful how you specify parameters for the constructors! Some compilers are entirely too willing to convert almost anything to bool. */ //@{ /*! \brief Default constructor */ CoinParam() ; /*! \brief Constructor for a parameter with a double value The default value is 0.0. Be careful to clearly indicate that \p lower and \p upper are real (double) values to distinguish this constructor from the constructor for an integer parameter. */ CoinParam(std::string name, std::string help, double lower, double upper, double dflt = 0.0, bool display = true) ; /*! \brief Constructor for a parameter with an integer value The default value is 0. */ CoinParam(std::string name, std::string help, int lower, int upper, int dflt = 0, bool display = true) ; /*! \brief Constructor for a parameter with keyword values The string supplied as \p firstValue becomes the first value-keyword. Additional value-keywords can be added using appendKwd(). It's necessary to specify both the first value-keyword (\p firstValue) and the default value-keyword index (\p dflt) in order to distinguish this constructor from the constructors for string and action parameters. Value-keywords are associated with an integer, starting with zero and increasing as each keyword is added. The value-keyword given as \p firstValue will be associated with the integer zero. The integer supplied for \p dflt can be any value, as long as it will be valid once all value-keywords have been added. */ CoinParam(std::string name, std::string help, std::string firstValue, int dflt, bool display = true) ; /*! \brief Constructor for a string parameter For some compilers, the default value (\p dflt) must be specified explicitly with type std::string to distinguish the constructor for a string parameter from the constructor for an action parameter. For example, use std::string("default") instead of simply "default", or use a variable of type std::string. */ CoinParam(std::string name, std::string help, std::string dflt, bool display = true) ; /*! \brief Constructor for an action parameter */ CoinParam(std::string name, std::string help, bool display = true) ; /*! \brief Copy constructor */ CoinParam(const CoinParam &orig) ; /*! \brief Clone */ virtual CoinParam *clone() ; /*! \brief Assignment */ CoinParam &operator=(const CoinParam &rhs) ; /*! \brief Destructor */ virtual ~CoinParam() ; //@} /*! \name Methods to query and manipulate the value(s) of a parameter */ //@{ /*! \brief Add an additional value-keyword to a keyword parameter */ void appendKwd(std::string kwd) ; /*! \brief Return the integer associated with the specified value-keyword Returns -1 if no value-keywords match the specified string. */ int kwdIndex(std::string kwd) const ; /*! \brief Return the value-keyword that is the current value of the keyword parameter */ std::string kwdVal() const ; /*! \brief Set the value of the keyword parameter using the integer associated with a value-keyword. If \p printIt is true, the corresponding value-keyword string will be echoed to std::cout. */ void setKwdVal(int value, bool printIt = false) ; /*! \brief Set the value of the keyword parameter using a value-keyword string. The given string will be tested against the set of value-keywords for the parameter using the shortest match rules. */ void setKwdVal(const std::string value ) ; /*! \brief Prints the set of value-keywords defined for this keyword parameter */ void printKwds() const ; /*! \brief Set the value of a string parameter */ void setStrVal(std::string value) ; /*! \brief Get the value of a string parameter */ std::string strVal() const ; /*! \brief Set the value of a double parameter */ void setDblVal(double value) ; /*! \brief Get the value of a double parameter */ double dblVal() const ; /*! \brief Set the value of a integer parameter */ void setIntVal(int value) ; /*! \brief Get the value of a integer parameter */ int intVal() const ; /*! \brief Add a short help string to a parameter */ inline void setShortHelp(const std::string help) { shortHelp_ = help ; } /*! \brief Retrieve the short help string */ inline std::string shortHelp() const { return (shortHelp_) ; } /*! \brief Add a long help message to a parameter See printLongHelp() for a description of how messages are broken into lines. */ inline void setLongHelp(const std::string help) { longHelp_ = help ; } /*! \brief Retrieve the long help message */ inline std::string longHelp() const { return (longHelp_) ; } /*! \brief Print long help Prints the long help string, plus the valid range and/or keywords if appropriate. The routine makes a best effort to break the message into lines appropriate for an 80-character line. Explicit line breaks in the message will be observed. The short help string will be used if long help is not available. */ void printLongHelp() const ; //@} /*! \name Methods to query and manipulate a parameter object */ //@{ /*! \brief Return the type of the parameter */ inline CoinParamType type() const { return (type_) ; } /*! \brief Set the type of the parameter */ inline void setType(CoinParamType type) { type_ = type ; } /*! \brief Return the parameter keyword (name) string */ inline std::string name() const { return (name_) ; } /*! \brief Set the parameter keyword (name) string */ inline void setName(std::string name) { name_ = name ; processName() ; } /*! \brief Check if the specified string matches the parameter keyword (name) string Returns 1 if the string matches and meets the minimum match length, 2 if the string matches but doesn't meet the minimum match length, and 0 if the string doesn't match. Matches are \e not case-sensitive. */ int matches (std::string input) const ; /*! \brief Return the parameter keyword (name) string formatted to show the minimum match length For example, if the parameter name was defined as allow!ableGap, the string returned by matchName would be allow(ableGap). */ std::string matchName() const ; /*! \brief Set visibility of parameter Intended to control whether the parameter is shown when a list of parameters is processed. Used by CoinParamUtils::printHelp when printing help messages for a list of parameters. */ inline void setDisplay(bool display) { display_ = display ; } /*! \brief Get visibility of parameter */ inline bool display() const { return (display_) ; } /*! \brief Get push function */ inline CoinParamFunc pushFunc() { return (pushFunc_) ; } /*! \brief Set push function */ inline void setPushFunc(CoinParamFunc func) { pushFunc_ = func ; } /*! \brief Get pull function */ inline CoinParamFunc pullFunc() { return (pullFunc_) ; } /*! \brief Set pull function */ inline void setPullFunc(CoinParamFunc func) { pullFunc_ = func ; } //@} private: /*! \name Private methods */ //@{ /*! Process a name for efficient matching */ void processName() ; //@} /*! \name Private parameter data */ //@{ /// Parameter type (see #CoinParamType) CoinParamType type_ ; /// Parameter name std::string name_ ; /// Length of parameter name size_t lengthName_ ; /*! \brief Minimum length required to declare a match for the parameter name. */ size_t lengthMatch_ ; /// Lower bound on value for a double parameter double lowerDblValue_ ; /// Upper bound on value for a double parameter double upperDblValue_ ; /// Double parameter - current value double dblValue_ ; /// Lower bound on value for an integer parameter int lowerIntValue_ ; /// Upper bound on value for an integer parameter int upperIntValue_ ; /// Integer parameter - current value int intValue_ ; /// String parameter - current value std::string strValue_ ; /// Set of valid value-keywords for a keyword parameter std::vector definedKwds_ ; /*! \brief Current value for a keyword parameter (index into #definedKwds_) */ int currentKwd_ ; /// Push function CoinParamFunc pushFunc_ ; /// Pull function CoinParamFunc pullFunc_ ; /// Short help std::string shortHelp_ ; /// Long help std::string longHelp_ ; /// Display when processing lists of parameters? bool display_ ; //@} } ; /*! \relatesalso CoinParam \brief A type for a parameter vector. */ typedef std::vector CoinParamVec ; /*! \relatesalso CoinParam \brief A stream output function for a CoinParam object. */ std::ostream &operator<< (std::ostream &s, const CoinParam ¶m) ; /* Bring in the utility functions for parameter handling (CbcParamUtils). */ /*! \brief Utility functions for processing CoinParam parameters. The functions in CoinParamUtils support command line or interactive parameter processing and a help facility. Consult the `Related Functions' section of the CoinParam class documentation for individual function documentation. */ namespace CoinParamUtils { /*! \relatesalso CoinParam \brief Take command input from the file specified by src. Use stdin for \p src to specify interactive prompting for commands. */ void setInputSrc(FILE *src) ; /*! \relatesalso CoinParam \brief Returns true if command line parameters are being processed. */ bool isCommandLine() ; /*! \relatesalso CoinParam \brief Returns true if parameters are being obtained from stdin. */ bool isInteractive() ; /*! \relatesalso CoinParam \brief Attempt to read a string from the input. \p argc and \p argv are used only if isCommandLine() would return true. If \p valid is supplied, it will be set to 0 if a string is parsed without error, 2 if no field is present. */ std::string getStringField(int argc, const char *argv[], int *valid) ; /*! \relatesalso CoinParam \brief Attempt to read an integer from the input. \p argc and \p argv are used only if isCommandLine() would return true. If \p valid is supplied, it will be set to 0 if an integer is parsed without error, 1 if there's a parse error, and 2 if no field is present. */ int getIntField(int argc, const char *argv[], int *valid) ; /*! \relatesalso CoinParam \brief Attempt to read a real (double) from the input. \p argc and \p argv are used only if isCommandLine() would return true. If \p valid is supplied, it will be set to 0 if a real number is parsed without error, 1 if there's a parse error, and 2 if no field is present. */ double getDoubleField(int argc, const char *argv[], int *valid) ; /*! \relatesalso CoinParam \brief Scan a parameter vector for parameters whose keyword (name) string matches \p name using minimal match rules. \p matchNdx is set to the index of the last parameter that meets the minimal match criteria (but note there should be at most one matching parameter if the parameter vector is properly configured). \p shortCnt is set to the number of short matches (should be zero for a properly configured parameter vector if a minimal match is found). The return value is the number of matches satisfying the minimal match requirement (should be 0 or 1 in a properly configured vector). */ int matchParam(const CoinParamVec ¶mVec, std::string name, int &matchNdx, int &shortCnt) ; /*! \relatesalso CoinParam \brief Get the next command keyword (name) To be precise, return the next field from the current command input source, after a bit of processing. In command line mode (isCommandLine() returns true) the next field will normally be of the form `-keyword' or `--keyword' (\e i.e., a parameter keyword), and the string returned would be `keyword'. In interactive mode (isInteractive() returns true), the user will be prompted if necessary. It is assumed that the user knows not to use the `-' or `--' prefixes unless specifying parameters on the command line. There are a number of special cases if we're in command line mode. The order of processing of the raw string goes like this:
    • A stand-alone `-' is forced to `stdin'.
    • A stand-alone '--' is returned as a word; interpretation is up to the client.
    • A prefix of '-' or '--' is stripped from the string.
    If the result is the string `stdin', command processing shifts to interactive mode and the user is immediately prompted for a new command. Whatever results from the above sequence is returned to the user as the return value of the function. An empty string indicates end of input. \p prompt will be used only if it's necessary to prompt the user in interactive mode. */ std::string getCommand(int argc, const char *argv[], const std::string prompt, std::string *pfx = 0) ; /*! \relatesalso CoinParam \brief Look up the command keyword (name) in the parameter vector. Print help if requested. In the most straightforward use, \p name is a string without `?', and the value returned is the index in \p paramVec of the single parameter that matched \p name. One or more '?' characters at the end of \p name is a query for information. The routine prints short (one '?') or long (more than one '?') help messages for a query. Help is also printed in the case where the name is ambiguous (some of the matches did not meet the minimal match length requirement). Note that multiple matches meeting the minimal match requirement is a configuration error. The mimimal match length for the parameters involved is too short. If provided as parameters, on return
    • \p matchCnt will be set to the number of matches meeting the minimal match requirement
    • \p shortCnt will be set to the number of matches that did not meet the miminal match requirement
    • \p queryCnt will be set to the number of '?' characters at the end of the name
    The return values are:
    • >0: index in \p paramVec of the single unique match for \p name
    • -1: a query was detected (one or more '?' characters at the end of \p name
    • -2: one or more short matches, not a query
    • -3: no matches, not a query
    • -4: multiple matches meeting the minimal match requirement (configuration error)
    */ int lookupParam(std::string name, CoinParamVec ¶mVec, int *matchCnt = 0, int *shortCnt = 0, int *queryCnt = 0) ; /*! \relatesalso CoinParam \brief Utility to print a long message as filled lines of text The routine makes a best effort to break lines without exceeding the standard 80 character line length. Explicit newlines in \p msg will be obeyed. */ void printIt(const char *msg) ; /*! \relatesalso CoinParam \brief Utility routine to print help given a short match or explicit request for help. The two really are related, in that a query (a string that ends with one or more `?' characters) will often result in a short match. The routine expects that \p name matches a single parameter, and does not look for multiple matches. If called with \p matchNdx < 0, the routine will look up \p name in \p paramVec and print the full name from the parameter. If called with \p matchNdx > 0, it just prints the name from the specified parameter. If the name is a query, short (one '?') or long (more than one '?') help is printed. */ void shortOrHelpOne(CoinParamVec ¶mVec,int matchNdx, std::string name, int numQuery) ; /*! \relatesalso CoinParam \brief Utility routine to print help given multiple matches. If the name is not a query, or asks for short help (\e i.e., contains zero or one '?' characters), the list of matching names is printed. If the name asks for long help (contains two or more '?' characters), short help is printed for each matching name. */ void shortOrHelpMany(CoinParamVec ¶mVec, std::string name, int numQuery) ; /*! \relatesalso CoinParam \brief Print a generic `how to use the command interface' help message. The message is hard coded to match the behaviour of the parsing utilities. */ void printGenericHelp() ; /*! \relatesalso CoinParam \brief Utility routine to print help messages for one or more parameters. Intended as a utility to implement explicit `help' commands. Help will be printed for all parameters in \p paramVec from \p firstParam to \p lastParam, inclusive. If \p shortHelp is true, short help messages will be printed. If \p longHelp is true, long help messages are printed. \p shortHelp overrules \p longHelp. If neither is true, only command keywords are printed. \p prefix is printed before each line; it's an imperfect attempt at indentation. */ void printHelp(CoinParamVec ¶mVec, int firstParam, int lastParam, std::string prefix, bool shortHelp, bool longHelp, bool hidden) ; } #endif /* CoinParam_H */ CoinMP-1.8.3/CoinUtils/src/CoinFileIO.cpp0000644000175000017500000003701611575435531016460 0ustar renerene/* $Id: CoinFileIO.cpp 1439 2011-06-13 16:31:21Z stefan $ */ // Copyright (C) 2005, COIN-OR. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include "CoinUtilsConfig.h" #include "CoinFileIO.hpp" #include "CoinError.hpp" #include "CoinHelperFunctions.hpp" #include #include // ------ CoinFileIOBase ------- CoinFileIOBase::CoinFileIOBase (const std::string &fileName): fileName_ (fileName) {} CoinFileIOBase::~CoinFileIOBase () {} const char *CoinFileIOBase::getFileName () const { return fileName_.c_str (); } // ------------------------------------------------------ // next we implement some subclasses of CoinFileInput // for plain text and compressed files // ------------------------------------------------------ // ------ Input for plain text ------ #include // This reads plain text files class CoinPlainFileInput: public CoinFileInput { public: CoinPlainFileInput (const std::string &fileName): CoinFileInput (fileName), f_ (0) { readType_="plain"; if (fileName!="stdin") { f_ = fopen (fileName.c_str (), "r"); if (f_ == 0) throw CoinError ("Could not open file for reading!", "CoinPlainFileInput", "CoinPlainFileInput"); } else { f_ = stdin; } } virtual ~CoinPlainFileInput () { if (f_ != 0) fclose (f_); } virtual int read (void *buffer, int size) { return static_cast(fread (buffer, 1, size, f_)); } virtual char *gets (char *buffer, int size) { return fgets (buffer, size, f_); } private: FILE *f_; }; // ------ helper class supporting buffered gets ------- // This is a CoinFileInput class to handle cases, where the gets method // is not easy to implement (i.e. bzlib has no equivalent to gets, and // zlib's gzgets is extremely slow). It's subclasses only have to implement // the readRaw method, while the read and gets methods are handled by this // class using an internal buffer. class CoinGetslessFileInput: public CoinFileInput { public: CoinGetslessFileInput (const std::string &fileName): CoinFileInput (fileName), dataBuffer_ (8*1024), dataStart_ (&dataBuffer_[0]), dataEnd_ (&dataBuffer_[0]) {} virtual ~CoinGetslessFileInput () {} virtual int read (void *buffer, int size) { if (size <= 0) return 0; // return value int r = 0; // treat destination as char * char *dest = static_cast(buffer); // First consume data from buffer if available. if (dataStart_ < dataEnd_) { int amount = static_cast(dataEnd_ - dataStart_); if (amount > size) amount = size; CoinMemcpyN( dataStart_, amount, dest); dest += amount; size -= amount; dataStart_ += amount; r = amount; } // If we require more data, use readRaw. // We don't use the buffer here, as readRaw is ecpected to be efficient. if (size > 0) r += readRaw (dest, size); return r; } virtual char *gets (char *buffer, int size) { if (size <= 1) return 0; char *dest = buffer; char *destLast = dest + size - 2; // last position allowed to be written bool initiallyEmpty = (dataStart_ == dataEnd_); for (;;) { // refill dataBuffer if needed if (dataStart_ == dataEnd_) { dataStart_ = dataEnd_ = &dataBuffer_[0]; int count = readRaw (dataStart_, static_cast(dataBuffer_.size ())); // at EOF? if (count <= 0) { *dest = 0; // if it was initially empty we had nothing written and should // return 0, otherwise at least the buffer contents were // transfered and buffer has to be returned. return initiallyEmpty ? 0 : buffer; } dataEnd_ = dataStart_ + count; } // copy character from buffer *dest = *dataStart_++; // terminate, if character was \n or bufferEnd was reached if (*dest == '\n' || dest == destLast) { *++dest = 0; return buffer; } ++dest; } // we should never reach this place throw CoinError ("Reached unreachable code!", "gets", "CoinGetslessFileInput"); } protected: // This should be implemented by the subclasses. It essentially behaves // like fread: the location pointed to by buffer should be filled with // size bytes. Return value is the number of bytes written (0 indicates EOF). virtual int readRaw (void *buffer, int size) = 0; private: std::vector dataBuffer_; // memory used for buffering char *dataStart_; // pointer to currently buffered data char *dataEnd_; // pointer to "one behind last data element" }; // -------- input for gzip compressed files ------- #ifdef COIN_HAS_ZLIB #include // This class handles gzip'ed files using libz. // While zlib offers the gzread and gzgets functions which do all we want, // the gzgets is _very_ slow as it gets single bytes via the complex gzread. // So we use the CoinGetslessFileInput as base. class CoinGzipFileInput: public CoinGetslessFileInput { public: CoinGzipFileInput (const std::string &fileName): CoinGetslessFileInput (fileName), gzf_ (0) { readType_="zlib"; gzf_ = gzopen (fileName.c_str (), "r"); if (gzf_ == 0) throw CoinError ("Could not open file for reading!", "CoinGzipFileInput", "CoinGzipFileInput"); } virtual ~CoinGzipFileInput () { if (gzf_ != 0) gzclose (gzf_); } protected: virtual int readRaw (void *buffer, int size) { return gzread (gzf_, buffer, size); } private: gzFile gzf_; }; #endif // COIN_HAS_ZLIB // ------- input for bzip2 compressed files ------ #ifdef COIN_HAS_BZLIB #include // This class handles files compressed by bzip2 using libbz. // As bzlib has no builtin gets, we use the CoinGetslessFileInput. class CoinBzip2FileInput: public CoinGetslessFileInput { public: CoinBzip2FileInput (const std::string &fileName): CoinGetslessFileInput (fileName), f_ (0), bzf_ (0) { int bzError = BZ_OK; readType_="bzlib"; f_ = fopen (fileName.c_str (), "r"); if (f_ != 0) bzf_ = BZ2_bzReadOpen (&bzError, f_, 0, 0, 0, 0); if (f_ == 0 || bzError != BZ_OK || bzf_ == 0) throw CoinError ("Could not open file for reading!", "CoinBzip2FileInput", "CoinBzip2FileInput"); } virtual ~CoinBzip2FileInput () { int bzError = BZ_OK; if (bzf_ != 0) BZ2_bzReadClose (&bzError, bzf_); if (f_ != 0) fclose (f_); } protected: virtual int readRaw (void *buffer, int size) { int bzError = BZ_OK; int count = BZ2_bzRead (&bzError, bzf_, buffer, size); if (bzError == BZ_OK || bzError == BZ_STREAM_END) return count; // Error? return 0; } private: FILE *f_; BZFILE *bzf_; }; #endif // COIN_HAS_BZLIB // ----- implementation of CoinFileInput's methods /// indicates whether CoinFileInput supports gzip'ed files bool CoinFileInput::haveGzipSupport() { #ifdef COIN_HAS_ZLIB return true; #else return false; #endif } /// indicates whether CoinFileInput supports bzip2'ed files bool CoinFileInput::haveBzip2Support() { #ifdef COIN_HAS_BZLIB return true; #else return false; #endif } CoinFileInput *CoinFileInput::create (const std::string &fileName) { // first try to open file, and read first bytes unsigned char header[4]; size_t count ; // So stdin will be plain file if (fileName!="stdin") { FILE *f = fopen (fileName.c_str (), "r"); if (f == 0) throw CoinError ("Could not open file for reading!", "create", "CoinFileInput"); count = fread (header, 1, 4, f); fclose (f); } else { // Reading from stdin - for moment not compressed count=0 ; // So stdin will be plain file } // gzip files start with the magic numbers 0x1f 0x8b if (count >= 2 && header[0] == 0x1f && header[1] == 0x8b) { #ifdef COIN_HAS_ZLIB return new CoinGzipFileInput (fileName); #else throw CoinError ("Cannot read gzip'ed file because zlib was " "not compiled into COIN!", "create", "CoinFileInput"); #endif } // bzip2 files start with the string "BZh" if (count >= 3 && header[0] == 'B' && header[1] == 'Z' && header[2] == 'h') { #ifdef COIN_HAS_BZLIB return new CoinBzip2FileInput (fileName); #else throw CoinError ("Cannot read bzip2'ed file because bzlib was " "not compiled into COIN!", "create", "CoinFileInput"); #endif } // fallback: probably plain text file return new CoinPlainFileInput (fileName); } CoinFileInput::CoinFileInput (const std::string &fileName): CoinFileIOBase (fileName) {} CoinFileInput::~CoinFileInput () {} // ------------------------------------------------------ // Some subclasses of CoinFileOutput // for plain text and compressed files // ------------------------------------------------------ // -------- CoinPlainFileOutput --------- // Class to handle output to text files without compression. class CoinPlainFileOutput: public CoinFileOutput { public: CoinPlainFileOutput (const std::string &fileName): CoinFileOutput (fileName), f_ (0) { if (fileName == "-" || fileName == "stdout") { f_ = stdout; } else { f_ = fopen (fileName.c_str (), "w"); if (f_ == 0) throw CoinError ("Could not open file for writing!", "CoinPlainFileOutput", "CoinPlainFileOutput"); } } virtual ~CoinPlainFileOutput () { if (f_ != 0 && f_ != stdout) fclose (f_); } virtual int write (const void *buffer, int size) { return static_cast(fwrite (buffer, 1, size, f_)); } // we have something better than the default implementation virtual bool puts (const char *s) { return fputs (s, f_) >= 0; } private: FILE *f_; }; // ------- CoinGzipFileOutput --------- #ifdef COIN_HAS_ZLIB // no need to include the header, as this was done for the input class // Handle output with gzip compression class CoinGzipFileOutput: public CoinFileOutput { public: CoinGzipFileOutput (const std::string &fileName): CoinFileOutput (fileName), gzf_ (0) { gzf_ = gzopen (fileName.c_str (), "w"); if (gzf_ == 0) throw CoinError ("Could not open file for writing!", "CoinGzipFileOutput", "CoinGzipFileOutput"); } virtual ~CoinGzipFileOutput () { if (gzf_ != 0) gzclose (gzf_); } virtual int write (const void * buffer, int size) { return gzwrite (gzf_, const_cast (buffer), size); } // as zlib's gzputs is no more clever than our own, there's // no need to replace the default. private: gzFile gzf_; }; #endif // COIN_HAS_ZLIB // ------- CoinBzip2FileOutput ------- #ifdef COIN_HAS_BZLIB // no need to include the header, as this was done for the input class // Output to bzip2 compressed file class CoinBzip2FileOutput: public CoinFileOutput { public: CoinBzip2FileOutput (const std::string &fileName): CoinFileOutput (fileName), f_ (0), bzf_ (0) { int bzError = BZ_OK; f_ = fopen (fileName.c_str (), "w"); if (f_ != 0) bzf_ = BZ2_bzWriteOpen (&bzError, f_, 9, /* Number of 100k blocks used for compression. Must be between 1 and 9 inclusive. As 9 gives best compression and I guess we can spend some memory, we use it. */ 0, /* verbosity */ 30 /* suggested by bzlib manual */ ); if (f_ == 0 || bzError != BZ_OK || bzf_ == 0) throw CoinError ("Could not open file for writing!", "CoinBzip2FileOutput", "CoinBzip2FileOutput"); } virtual ~CoinBzip2FileOutput () { int bzError = BZ_OK; if (bzf_ != 0) BZ2_bzWriteClose (&bzError, bzf_, 0, 0, 0); if (f_ != 0) fclose (f_); } virtual int write (const void *buffer, int size) { int bzError = BZ_OK; BZ2_bzWrite (&bzError, bzf_, const_cast (buffer), size); return (bzError == BZ_OK) ? size : 0; } private: FILE *f_; BZFILE *bzf_; }; #endif // COIN_HAS_BZLIB // ------- implementation of CoinFileOutput's methods bool CoinFileOutput::compressionSupported (Compression compression) { switch (compression) { case COMPRESS_NONE: return true; case COMPRESS_GZIP: #ifdef COIN_HAS_ZLIB return true; #else return false; #endif case COMPRESS_BZIP2: #ifdef COIN_HAS_BZLIB return true; #else return false; #endif default: return false; } } CoinFileOutput *CoinFileOutput::create (const std::string &fileName, Compression compression) { switch (compression) { case COMPRESS_NONE: return new CoinPlainFileOutput (fileName); case COMPRESS_GZIP: #ifdef COIN_HAS_ZLIB return new CoinGzipFileOutput (fileName); #endif break; case COMPRESS_BZIP2: #ifdef COIN_HAS_BZLIB return new CoinBzip2FileOutput (fileName); #endif break; default: break; } throw CoinError ("Unsupported compression selected!", "create", "CoinFileOutput"); } CoinFileOutput::CoinFileOutput (const std::string &fileName): CoinFileIOBase (fileName) {} CoinFileOutput::~CoinFileOutput () {} bool CoinFileOutput::puts (const char *s) { int len = static_cast(strlen (s)); if (len == 0) return true; return write (s, len) == len; } /* Tests if the given string looks like an absolute path to a file. - unix: string begins with `/' - windows: string begins with `\' or `drv:', where drv is a drive designator. */ bool fileAbsPath (const std::string &path) { const char dirsep = CoinFindDirSeparator() ; // If the first two chars are drive designators then treat it as absolute // path (noone in their right mind would create a file named 'Z:' on unix, // right?...) const size_t len = path.length(); if (len >= 2 && path[1] == ':') { const char ch = path[0]; if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) { return true; } } return path[0] == dirsep; } /* Tests if file readable and may change name to add compression extension. Here to get ZLIB etc in one place stdin goes by unmolested by all the fussing with file names. We shouldn't close it, either. */ bool fileCoinReadable(std::string & fileName, const std::string &dfltPrefix) { if (fileName != "stdin") { const char dirsep = CoinFindDirSeparator(); std::string directory ; if (dfltPrefix == "") { directory = (dirsep == '/' ? "./" : ".\\") ; } else { directory = dfltPrefix ; if (directory[directory.length()-1] != dirsep) { directory += dirsep ; } } bool absolutePath = fileAbsPath(fileName) ; std::string field = fileName; if (absolutePath) { // nothing to do } else if (field[0]=='~') { char * home_dir = getenv("HOME"); if (home_dir) { std::string home(home_dir); field=field.erase(0,1); fileName = home+field; } else { fileName=field; } } else { fileName = directory+field; } } // I am opening it to make sure not odd FILE *fp; if (strcmp(fileName.c_str(),"stdin")) { fp = fopen ( fileName.c_str(), "r" ); } else { fp = stdin; } #ifdef COIN_HAS_ZLIB if (!fp) { std::string fname = fileName; fname += ".gz"; fp = fopen ( fname.c_str(), "r" ); if (fp) fileName=fname; } #endif #ifdef COIN_HAS_BZLIB if (!fp) { std::string fname = fileName; fname += ".bz2"; fp = fopen ( fname.c_str(), "r" ); if (fp) fileName=fname; } #endif if (!fp) { return false; } else { if (fp != stdin) { fclose(fp); } return true; } } CoinMP-1.8.3/CoinUtils/src/CoinPostsolveMatrix.cpp0000644000175000017500000001327311510461170020516 0ustar renerene/* $Id: CoinPostsolveMatrix.cpp 1373 2011-01-03 23:57:44Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" #if PRESOLVE_DEBUG || PRESOLVE_CONSISTENCY #include "CoinPresolvePsdebug.hpp" #endif /*! \file This file contains methods for CoinPostsolveMatrix, the object used during postsolve transformations. */ /* Constructor and destructor for CoinPostsolveMatrix. */ /* Default constructor Postpone allocation of space until we actually load the object. */ CoinPostsolveMatrix::CoinPostsolveMatrix (int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc) : CoinPrePostsolveMatrix(ncols_alloc,nrows_alloc,nelems_alloc), free_list_(0), maxlink_(nelems_alloc), link_(0), cdone_(0), rdone_(0) { /* nothing to do here */ return ; } /* Destructor */ CoinPostsolveMatrix::~CoinPostsolveMatrix() { delete[] link_ ; delete[] cdone_ ; delete[] rdone_ ; return ; } /* This routine loads a CoinPostsolveMatrix object from a CoinPresolveMatrix object. The CoinPresolveMatrix object will be stripped, its components transferred to the CoinPostsolveMatrix object, and the empty shell of the CoinPresolveObject will be destroyed. The routine expects an empty CoinPostsolveMatrix object, and will leak any memory already allocated. */ void CoinPostsolveMatrix::assignPresolveToPostsolve (CoinPresolveMatrix *&preObj) { /* Start with simple data --- allocated and current size. */ ncols0_ = preObj->ncols0_ ; nrows0_ = preObj->nrows0_ ; nelems0_ = preObj->nelems0_ ; bulk0_ = preObj->bulk0_ ; ncols_ = preObj->ncols_ ; nrows_ = preObj->nrows_ ; nelems_ = preObj->nelems_ ; /* Now bring over the column-major matrix and other problem data. */ mcstrt_ = preObj->mcstrt_ ; preObj->mcstrt_ = 0 ; hincol_ = preObj->hincol_ ; preObj->hincol_ = 0 ; hrow_ = preObj->hrow_ ; preObj->hrow_ = 0 ; colels_ = preObj->colels_ ; preObj->colels_ = 0 ; cost_ = preObj->cost_ ; preObj->cost_ = 0 ; originalOffset_ = preObj->originalOffset_ ; clo_ = preObj->clo_ ; preObj->clo_ = 0 ; cup_ = preObj->cup_ ; preObj->cup_ = 0 ; rlo_ = preObj->rlo_ ; preObj->rlo_ = 0 ; rup_ = preObj->rup_ ; preObj->rup_ = 0 ; originalColumn_ = preObj->originalColumn_ ; preObj->originalColumn_ = 0 ; originalRow_ = preObj->originalRow_ ; preObj->originalRow_ = 0 ; ztolzb_ = preObj->ztolzb_ ; ztoldj_ = preObj->ztoldj_ ; maxmin_ = preObj->maxmin_ ; /* Now the problem solution. Often this will be empty, but that's not a problem. */ sol_ = preObj->sol_ ; preObj->sol_ = 0 ; rowduals_ = preObj->rowduals_ ; preObj->rowduals_ = 0 ; acts_ = preObj->acts_ ; preObj->acts_ = 0 ; rcosts_ = preObj->rcosts_ ; preObj->rcosts_ = 0 ; colstat_ = preObj->colstat_ ; preObj->colstat_ = 0 ; rowstat_ = preObj->rowstat_ ; preObj->rowstat_ = 0 ; /* The CoinPostsolveMatrix comes with messages and a handler, but replace them with the versions from the CoinPresolveObject, in case they've been customized. Let preObj believe it's no longer responsible for the handler. */ if (defaultHandler_ == true) delete handler_ ; handler_ = preObj->handler_ ; preObj->defaultHandler_ = false ; messages_ = preObj->messages_ ; /* Initialise the postsolve portions of this object. Which amounts to setting up the thread links to match the column-major matrix representation. This would be trivial except that the presolve matrix is loosely packed. We can either compress the matrix, or record the existing free space pattern. Bet that the latter is more efficient. Remember that mcstrt_[ncols_] actually points to the end of the bulk storage area, so when we process the last column in the bulk storage area, we'll add the free space block at the end of bulk storage to the free list. We need to allow for a 0x0 matrix here --- a pathological case, but it slips in when (for example) confirming a solution in an ILP code. */ free_list_ = NO_LINK ; maxlink_ = bulk0_ ; link_ = new CoinBigIndex [maxlink_] ; if (ncols_ > 0) { CoinBigIndex minkcs = -1 ; for (int j = 0 ; j < ncols_ ; j++) { CoinBigIndex kcs = mcstrt_[j] ; int lenj = hincol_[j] ; assert(lenj > 0) ; CoinBigIndex kce = kcs+lenj-1 ; CoinBigIndex k ; for (k = kcs ; k < kce ; k++) { link_[k] = k+1 ; } link_[k++] = NO_LINK ; if (preObj->clink_[j].pre == NO_LINK) { minkcs = kcs ; } int nxtj = preObj->clink_[j].suc ; assert(nxtj >= 0 && nxtj <= ncols_) ; CoinBigIndex nxtcs = mcstrt_[nxtj] ; for ( ; k < nxtcs ; k++) { link_[k] = free_list_ ; free_list_ = k ; } } assert(minkcs >= 0) ; if (minkcs > 0) { for (CoinBigIndex k = 0 ; k < minkcs ; k++) { link_[k] = free_list_ ; free_list_ = k ; } } } else { for (CoinBigIndex k = 0 ; k < maxlink_ ; k++) { link_[k] = free_list_ ; free_list_ = k ; } } /* That's it, preObj can die now. */ delete preObj ; preObj = 0 ; # if PRESOLVE_DEBUG || PRESOLVE_CONSISTENCY /* These are used to track the action of postsolve transforms during debugging. */ cdone_ = new char [ncols0_] ; CoinFillN(cdone_,ncols_,PRESENT_IN_REDUCED) ; CoinZeroN(cdone_+ncols_,ncols0_-ncols_) ; rdone_ = new char [nrows0_] ; CoinFillN(rdone_,nrows_,PRESENT_IN_REDUCED) ; CoinZeroN(rdone_+nrows_,nrows0_-nrows_) ; # else cdone_ = 0 ; rdone_ = 0 ; # endif # if PRESOLVE_CONSISTENCY presolve_check_free_list(this,true) ; presolve_check_threads(this) ; # endif return ; } CoinMP-1.8.3/CoinUtils/src/CoinPresolveSubst.hpp0000644000175000017500000000603212054013177020157 0ustar renerene/* $Id: CoinPresolveSubst.hpp 1562 2012-11-24 00:36:15Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinPresolveSubst_H #define CoinPresolveSubst_H /*! \file */ #define SUBST_ROW 21 #include "CoinPresolveMatrix.hpp" /*! \class subst_constraint_action \brief Detect and process implied free variables Consider a variable x. Suppose that we can find an equality such that the bound on the equality, combined with the bounds on the other variables involved in the equality, are such that even the worst case values of the other variables still imply bounds for x which are tighter than the variable's original bounds. Since x can never reach its upper or lower bounds, it is an implied free variable. By solving the equality for x and substituting for x in every other constraint entangled with x, we can make x into a column singleton. Now x is an implied free column singleton and both x and the equality can be removed. A similar transform for the case where the variable is a natural column singleton is handled by #implied_free_action. In the current presolve architecture, #implied_free_action is responsible for detecting implied free variables that are natural column singletons or can be reduced to column singletons. #implied_free_action calls subst_constraint_action to process variables that must be reduced to column singletons. */ class subst_constraint_action : public CoinPresolveAction { private: subst_constraint_action(); subst_constraint_action(const subst_constraint_action& rhs); subst_constraint_action& operator=(const subst_constraint_action& rhs); struct action { double *rlos; double *rups; double *coeffxs; int *rows; int *ninrowxs; int *rowcolsxs; double *rowelsxs; const double *costsx; int col; int rowy; int nincol; }; const int nactions_; // actions_ is owned by the class and must be deleted at destruction const action *const actions_; subst_constraint_action(int nactions, action *actions, const CoinPresolveAction *next) : CoinPresolveAction(next), nactions_(nactions), actions_(actions) {} public: const char *name() const; static const CoinPresolveAction *presolve(CoinPresolveMatrix * prob, const int *implied_free, const int * which, int numberFree, const CoinPresolveAction *next, int fill_level); static const CoinPresolveAction *presolveX(CoinPresolveMatrix * prob, const CoinPresolveAction *next, int fillLevel); void postsolve(CoinPostsolveMatrix *prob) const; virtual ~subst_constraint_action(); }; /*static*/ void implied_bounds(const double *els, const double *clo, const double *cup, const int *hcol, CoinBigIndex krs, CoinBigIndex kre, double *maxupp, double *maxdownp, int jcol, double rlo, double rup, double *iclb, double *icub); #endif CoinMP-1.8.3/CoinUtils/src/CoinPresolveZeros.cpp0000644000175000017500000002115412054012620020146 0ustar renerene/* $Id: CoinPresolveZeros.cpp 1561 2012-11-24 00:32:16Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include "CoinHelperFunctions.hpp" #include "CoinPresolveMatrix.hpp" #include "CoinPresolveZeros.hpp" #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 #include "CoinPresolvePsdebug.hpp" #endif namespace { // begin unnamed file-local namespace /* Count the number of zeros in the columns listed in checkcols. Trim back checkcols to just the columns with zeros. */ int count_col_zeros (int &ncheckcols, int *checkcols, const CoinBigIndex *mcstrt, const double *colels, const int *hincol) { int nzeros = 0 ; int zeroCols = 0 ; for (int ndx = 0 ; ndx < ncheckcols ; ndx++) { const int j = checkcols[ndx] ; const CoinBigIndex kcs = mcstrt[j] ; const CoinBigIndex kce = kcs+hincol[j] ; int zerosj = 0 ; for (CoinBigIndex kcol = kcs ; kcol < kce ; ++kcol) { if (fabs(colels[kcol]) < ZTOLDP) { zerosj++ ; } } if (zerosj) { checkcols[zeroCols++] = j ; nzeros += zerosj ; } } ncheckcols = zeroCols ; return (nzeros) ; } /* Count the number of zeros. Intended for the case where all columns 0 .. ncheckcols should be scanned. Typically ncheckcols is the number of columns in the matrix. Leave a list of columns with explicit zeros at the front of checkcols, with the count in ncheckcols. */ int count_col_zeros2 (int &ncheckcols, int *checkcols, const CoinBigIndex *mcstrt, const double *colels, const int *hincol) { int nzeros = 0 ; int zeroCols = 0 ; for (int j = 0 ; j < ncheckcols ; j++) { const CoinBigIndex kcs = mcstrt[j] ; CoinBigIndex kce = kcs+hincol[j] ; int zerosj = 0 ; for (CoinBigIndex k = kcs ; k < kce ; ++k) { if (fabs(colels[k]) < ZTOLDP) { zerosj++ ; } } if (zerosj) { checkcols[zeroCols++] = j ; nzeros += zerosj ; } } ncheckcols = zeroCols ; return (nzeros) ; } /* Searches the cols in checkcols for zero entries. Creates a dropped_zero entry for each one; doesn't check for out-of-memory. Returns number of zeros found. */ int drop_col_zeros (int ncheckcols, const int *checkcols, const CoinBigIndex *mcstrt, double *colels, int *hrow, int *hincol, presolvehlink *clink, dropped_zero *actions) { int nactions = 0 ; /* Physically remove explicit zeros. To maintain loose packing, move the element at the end of the column into the empty space. Of course, that element could also be zero, so recheck the position. */ for (int i = 0 ; i < ncheckcols ; i++) { int col = checkcols[i] ; const CoinBigIndex kcs = mcstrt[col] ; CoinBigIndex kce = kcs+hincol[col] ; # if PRESOLVE_DEBUG > 1 std::cout << " scanning column " << col << "..." ; # endif for (CoinBigIndex k = kcs ; k < kce ; ++k) { if (fabs(colels[k]) < ZTOLDP) { actions[nactions].col = col ; actions[nactions].row = hrow[k] ; # if PRESOLVE_DEBUG > 2 std::cout << " (" << hrow[k] << "," << col << ") " ; # endif nactions++ ; kce-- ; colels[k] = colels[kce] ; hrow[k] = hrow[kce] ; hincol[col]-- ; --k ; } } # if PRESOLVE_DEBUG > 1 if (nactions) std::cout << std::endl ; # endif if (hincol[col] == 0) PRESOLVE_REMOVE_LINK(clink,col) ; } return (nactions) ; } /* Scan rows to remove explicit zeros. This will, in general, scan a row once for each explicit zero in the row, but will remove all zeros the first time through. It's tempting to try and do something about this, but given the relatively small number of explicit zeros created by presolve, the bookkeeping likely exceeds the gain. */ void drop_row_zeros(int nzeros, const dropped_zero *zeros, const CoinBigIndex *mrstrt, double *rowels, int *hcol, int *hinrow, presolvehlink *rlink) { for (int i = 0 ; i < nzeros ; i++) { int row = zeros[i].row ; const CoinBigIndex krs = mrstrt[row] ; CoinBigIndex kre = krs+hinrow[row] ; # if PRESOLVE_DEBUG > 2 std::cout << " scanning row " << row << " for a(" << row << "," << zeros[i].col << ") ..." ; bool found = false ; # endif for (CoinBigIndex k = krs ; k < kre ; k++) { if (fabs(rowels[k]) < ZTOLDP) { # if PRESOLVE_DEBUG > 2 std::cout << " (" << row << "," << hcol[k] << ") " ; found = true ; # endif rowels[k] = rowels[kre-1] ; hcol[k] = hcol[kre-1] ; kre-- ; hinrow[row]-- ; --k ; } } # if PRESOLVE_DEBUG > 2 if (found) std::cout << " found; " << hinrow[row] << " coeffs remaining." << std::endl ; # endif if (hinrow[row] == 0) PRESOLVE_REMOVE_LINK(rlink,row) ; } } } // end unnamed file-local namespace /* Scan the columns listed in checkcols for explicit zeros and eliminate them. For the special case where all columns should be scanned (ncheckcols == prob->ncols_), there is no need to initialise checkcols. */ const CoinPresolveAction *drop_zero_coefficients_action::presolve (CoinPresolveMatrix *prob, int *checkcols, int ncheckcols, const CoinPresolveAction *next) { double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; presolvehlink *clink = prob->clink_ ; presolvehlink *rlink = prob->rlink_ ; # if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0 # if PRESOLVE_DEBUG > 0 std::cout << "Entering drop_zero_action::presolve, " << ncheckcols << " columns to scan." << std::endl ; # endif presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif /* Scan for zeros. */ int nzeros ; if (ncheckcols == prob->ncols_) { nzeros = count_col_zeros2(ncheckcols,checkcols,mcstrt,colels,hincol) ; } else { nzeros = count_col_zeros(ncheckcols,checkcols,mcstrt,colels,hincol) ; } # if PRESOLVE_DEBUG > 1 std::cout << " drop_zero_action: " << nzeros << " zeros in " << ncheckcols << " columns." << std::endl ; # endif /* Do we have zeros to remove? If so, get to it. */ if (nzeros != 0) { /* We have zeros to remove. drop_col_zeros will scan the columns and remove zeros, adding records of the dropped entries to zeros. The we need to clean the row representation. */ dropped_zero *zeros = new dropped_zero[nzeros] ; nzeros = drop_col_zeros(ncheckcols,checkcols,mcstrt,colels, hrow,hincol,clink,zeros) ; double *rowels = prob->rowels_ ; int *hcol = prob->hcol_ ; CoinBigIndex *mrstrt = prob->mrstrt_ ; int *hinrow = prob->hinrow_ ; drop_row_zeros(nzeros,zeros,mrstrt,rowels,hcol,hinrow,rlink) ; next = new drop_zero_coefficients_action(nzeros,zeros,next) ; } # if PRESOLVE_CONSISTENCY > 0 || PRESOLVE_DEBUG > 0 presolve_consistent(prob) ; presolve_links_ok(prob) ; presolve_check_sol(prob) ; presolve_check_nbasic(prob) ; # endif # if PRESOLVE_DEBUG > 0 || COIN_PRESOLVE_TUNING > 0 std::cout << "Leaving drop_zero_action::presolve, dropped " << nzeros << " zeroes." << std::endl ; # endif return (next) ; } /* This wrapper initialises checkcols for the case where the entire matrix should be scanned. Typically used from the presolve driver as part of final cleanup. */ const CoinPresolveAction *drop_zero_coefficients (CoinPresolveMatrix *prob, const CoinPresolveAction *next) { int ncheck = prob->ncols_ ; int *checkcols = new int[ncheck] ; if (prob->anyProhibited()) { ncheck = 0 ; for (int i = 0 ; i < prob->ncols_ ; i++) if (!prob->colProhibited(i)) checkcols[ncheck++] = i ; } const CoinPresolveAction *retval = drop_zero_coefficients_action::presolve(prob,checkcols,ncheck,next) ; delete [] checkcols ; return (retval) ; } void drop_zero_coefficients_action::postsolve(CoinPostsolveMatrix *prob) const { const int nzeros = nzeros_ ; const dropped_zero *const zeros = zeros_ ; double *colels = prob->colels_ ; int *hrow = prob->hrow_ ; CoinBigIndex *mcstrt = prob->mcstrt_ ; int *hincol = prob->hincol_ ; int *link = prob->link_ ; CoinBigIndex &free_list = prob->free_list_ ; for (const dropped_zero *z = &zeros[nzeros-1] ; zeros <= z ; z--) { const int i = z->row ; const int j = z->col ; CoinBigIndex k = free_list ; assert(k >= 0 && k < prob->bulk0_) ; free_list = link[free_list] ; hrow[k] = i ; colels[k] = 0.0 ; link[k] = mcstrt[j] ; mcstrt[j] = k ; hincol[j]++ ; } # if PRESOLVE_CONSISTENCY > 0 presolve_check_free_list(prob) ; # endif } CoinMP-1.8.3/CoinUtils/src/CoinWarmStart.hpp0000644000175000017500000000306611510456064017271 0ustar renerene/* $Id: CoinWarmStart.hpp 1372 2011-01-03 23:31:00Z lou $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinWarmStart_H #define CoinWarmStart_H //############################################################################# class CoinWarmStartDiff; /** Abstract base class for warm start information. Really nothing can be generalized for warm start information --- all we know is that it exists. Hence the abstract base class contains only a virtual destructor and a virtual clone function (a virtual constructor), so that derived classes can provide these functions. */ class CoinWarmStart { public: /// Abstract destructor virtual ~CoinWarmStart() {} /// `Virtual constructor' virtual CoinWarmStart *clone() const = 0 ; virtual CoinWarmStartDiff* generateDiff (const CoinWarmStart *const ) const { return 0; } virtual void applyDiff (const CoinWarmStartDiff *const ) {} }; /*! \class CoinWarmStartDiff \brief Abstract base class for warm start `diff' objects For those types of warm start objects where the notion of a `diff' makes sense, this virtual base class is provided. As with CoinWarmStart, its sole reason for existence is to make it possible to write solver-independent code. */ class CoinWarmStartDiff { public: /// Abstract destructor virtual ~CoinWarmStartDiff() {} /// `Virtual constructor' virtual CoinWarmStartDiff *clone() const = 0 ; }; #endif CoinMP-1.8.3/CoinUtils/AUTHORS0000644000175000017500000000022111111534643014267 0ustar renereneThis file is last updated on 11/21/2008 Fasano, J.P. Forrest, John J. Hafer, Lou Ladanyi, Laszlo Margot, Francois Tomlin, John Waechter, Andreas CoinMP-1.8.3/Clp/0000755000175000017500000000000012600453455012036 5ustar renereneCoinMP-1.8.3/Clp/Makefile.in0000644000175000017500000011120312506111472014074 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 # Copyright (C) 2006, 2007 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 ######################################################################## # Documentation installation # ######################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ # Don't do src/OsiClp recursively, since src/OsiClp/libOsiClp depends on src/libClp @COIN_HAS_OSI_TRUE@am__append_1 = src/OsiClp # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball @ALWAYS_FALSE@am__append_2 = test @COIN_HAS_OSI_TRUE@am__append_3 = osi-clp.pc DIST_COMMON = README $(am__configure_deps) \ $(srcdir)/BuildTools/Makemain.inc $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/clp-uninstalled.pc.in \ $(srcdir)/clp.pc.in $(top_srcdir)/configure \ $(top_srcdir)/doxydoc/doxygen.conf.in \ $(top_srcdir)/examples/Makefile.in \ $(top_srcdir)/src/OsiClp/osi-clp-uninstalled.pc.in \ $(top_srcdir)/src/OsiClp/osi-clp.pc.in AUTHORS config.guess \ config.sub depcomp install-sh ltmain.sh missing @HAVE_EXTERNALS_TRUE@am__append_4 = Dependencies @HAVE_EXTERNALS_TRUE@am__append_5 = .Dependencies-stamp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_clp.h CONFIG_CLEAN_FILES = examples/Makefile clp.pc clp-uninstalled.pc \ osi-clp.pc osi-clp-uninstalled.pc doxydoc/doxygen.conf SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(pkgconfiglibdir)" pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) DATA = $(pkgconfiglib_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = src src/OsiClp test DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMDINCDIR = @AMDINCDIR@ AMDLIB = @AMDLIB@ AMTAR = @AMTAR@ AR = @AR@ ASL_CFLAGS = @ASL_CFLAGS@ ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ ASL_DATA = @ASL_DATA@ ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ ASL_LIBS = @ASL_LIBS@ ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BLAS_CFLAGS = @BLAS_CFLAGS@ BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ BLAS_DATA = @BLAS_DATA@ BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ BLAS_LIBS = @BLAS_LIBS@ BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CHOLMODINCDIR = @CHOLMODINCDIR@ CHOLMODLIB = @CHOLMODLIB@ CLPLIB_CFLAGS = @CLPLIB_CFLAGS@ CLPLIB_CFLAGS_INSTALLED = @CLPLIB_CFLAGS_INSTALLED@ CLPLIB_DEPENDENCIES = @CLPLIB_DEPENDENCIES@ CLPLIB_LIBS = @CLPLIB_LIBS@ CLPLIB_LIBS_INSTALLED = @CLPLIB_LIBS_INSTALLED@ CLPLIB_PCLIBS = @CLPLIB_PCLIBS@ CLPLIB_PCREQUIRES = @CLPLIB_PCREQUIRES@ CLP_SVN_REV = @CLP_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_ABC_FALSE = @COIN_HAS_ABC_FALSE@ COIN_HAS_ABC_TRUE = @COIN_HAS_ABC_TRUE@ COIN_HAS_AMD_FALSE = @COIN_HAS_AMD_FALSE@ COIN_HAS_AMD_TRUE = @COIN_HAS_AMD_TRUE@ COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ COIN_HAS_CHOLMOD_FALSE = @COIN_HAS_CHOLMOD_FALSE@ COIN_HAS_CHOLMOD_TRUE = @COIN_HAS_CHOLMOD_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MUMPS_FALSE = @COIN_HAS_MUMPS_FALSE@ COIN_HAS_MUMPS_TRUE = @COIN_HAS_MUMPS_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_OSITESTS_FALSE = @COIN_HAS_OSITESTS_FALSE@ COIN_HAS_OSITESTS_TRUE = @COIN_HAS_OSITESTS_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_WSMP_FALSE = @COIN_HAS_WSMP_FALSE@ COIN_HAS_WSMP_TRUE = @COIN_HAS_WSMP_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FLIBS = @FLIBS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MPIF77 = @MPIF77@ MUMPS_CFLAGS = @MUMPS_CFLAGS@ MUMPS_CFLAGS_INSTALLED = @MUMPS_CFLAGS_INSTALLED@ MUMPS_DATA = @MUMPS_DATA@ MUMPS_DATA_INSTALLED = @MUMPS_DATA_INSTALLED@ MUMPS_DEPENDENCIES = @MUMPS_DEPENDENCIES@ MUMPS_LIBS = @MUMPS_LIBS@ MUMPS_LIBS_INSTALLED = @MUMPS_LIBS_INSTALLED@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OPT_FFLAGS = @OPT_FFLAGS@ OSICLPLIB_CFLAGS = @OSICLPLIB_CFLAGS@ OSICLPLIB_CFLAGS_INSTALLED = @OSICLPLIB_CFLAGS_INSTALLED@ OSICLPLIB_DEPENDENCIES = @OSICLPLIB_DEPENDENCIES@ OSICLPLIB_LIBS = @OSICLPLIB_LIBS@ OSICLPLIB_LIBS_INSTALLED = @OSICLPLIB_LIBS_INSTALLED@ OSICLPLIB_PCLIBS = @OSICLPLIB_PCLIBS@ OSICLPLIB_PCREQUIRES = @OSICLPLIB_PCREQUIRES@ OSITESTS_CFLAGS = @OSITESTS_CFLAGS@ OSITESTS_CFLAGS_INSTALLED = @OSITESTS_CFLAGS_INSTALLED@ OSITESTS_DATA = @OSITESTS_DATA@ OSITESTS_DATA_INSTALLED = @OSITESTS_DATA_INSTALLED@ OSITESTS_DEPENDENCIES = @OSITESTS_DEPENDENCIES@ OSITESTS_LIBS = @OSITESTS_LIBS@ OSITESTS_LIBS_INSTALLED = @OSITESTS_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src $(am__append_1) $(am__append_2) ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = doc/authors.xml doc/basicmodelclasses.xml doc/clpexe.xml \ doc/clpuserguide.xml doc/doxygen.xml doc/faqcontent.xml \ doc/faq.xml doc/intro.xml doc/legal.xml doc/messages.xml \ doc/moresamples.xml doc/notsobasic.xml doc/revhist.xml \ doc/Howto/docbook4clp.xml examples/addBits.cpp \ examples/addColumns.cpp examples/addRows.cpp \ examples/decompose.cpp examples/defaults.cpp \ examples/driver2.cpp examples/driverC.c examples/driver.cpp \ examples/dualCuts.cpp examples/ekk.cpp \ examples/ekk_interface.cpp examples/hello.cpp \ examples/hello.mps examples/input.130 examples/INSTALL \ examples/makeDual.cpp examples/Makefile.in \ examples/minimum.cpp examples/network.cpp examples/piece.cpp \ examples/rowColumn.cpp examples/sprint2.cpp \ examples/sprint.cpp examples/testBarrier.cpp \ examples/testBasis.cpp examples/testGub2.cpp \ examples/testGub.cpp examples/testQP.cpp \ examples/useVolume.cpp $(am__append_4) ######################################################################## # Creation of the addlibs file # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = clp.pc $(am__append_3) addlibsdir = $(DESTDIR)$(datadir)/coin/doc/Clp ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = $(am__append_5) $(VPATH_DISTCLEANFILES) DocFiles = README AUTHORS LICENSE DocInstallDir = $(datadir)/coin/doc/$(PACKAGE_NAME) COIN_HAS_DOXYGEN = @COIN_HAS_DOXYGEN_TRUE@TRUE COIN_HAS_LATEX = @COIN_HAS_LATEX_TRUE@TRUE all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/BuildTools/Makemain.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) examples/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ clp.pc: $(top_builddir)/config.status $(srcdir)/clp.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ clp-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/clp-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-clp.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiClp/osi-clp.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ osi-clp-uninstalled.pc: $(top_builddir)/config.status $(top_srcdir)/src/OsiClp/osi-clp-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ doxydoc/doxygen.conf: $(top_builddir)/config.status $(top_srcdir)/doxydoc/doxygen.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ 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; } \ END { 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: ctags-recursive $(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; } \ END { 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) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/BuildTools $(distdir)/doc $(distdir)/doc/Howto $(distdir)/doxydoc $(distdir)/examples $(distdir)/src/OsiClp @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfiglibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-exec-am: install-exec-local install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-local \ uninstall-pkgconfiglibDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-local \ clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-libtool distclean-local \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-exec install-exec-am \ install-exec-local install-info install-info-am install-man \ install-pkgconfiglibDATA install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-libtool \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-hook uninstall-info-am \ uninstall-local uninstall-pkgconfiglibDATA ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc install-data-hook: @$(mkdir_p) "$(addlibsdir)" @COIN_HAS_PKGCONFIG_TRUE@ PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ @COIN_HAS_PKGCONFIG_TRUE@ $(PKG_CONFIG) --libs clp > $(addlibsdir)/clp_addlibs.txt @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libClpSolver.lib libClp.lib @CLPLIB_LIBS_INSTALLED@" > $(addlibsdir)/clp_addlibs.txt @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lClp @CLPLIB_LIBS_INSTALLED@ > $(addlibsdir)/clp_addlibs.txt uninstall-hook: rm -f $(addlibsdir)/clp_addlibs.txt doxygen-docs: if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ doxygen doxydoc/doxygen.conf;\ fi;\ fi pdf-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/latex"; then \ if test "$(COIN_HAS_LATEX)" = TRUE; then \ cd doxydoc/latex;\ $(MAKE) pdf;\ cd -;\ fi;\ fi;\ fi clean-doxygen-docs: if test -d "doxydoc/"; then \ cd doxydoc ;\ rm -rf html latex *.log *.tag;\ fi install-doxygen-docs: doxygen-docs if test "$(COIN_HAS_DOXYGEN)" = TRUE; then \ if test -d "doxydoc/"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc"; \ $(INSTALL_DATA) @coin_doxy_tagname@ "$(DESTDIR)$(DocInstallDir)/@coin_doxy_tagname@";\ if test -f "doxydoc/latex/refman.pdf"; then \ $(INSTALL_DATA) doxydoc/latex/refman.pdf "$(DESTDIR)$(DocInstallDir)";\ fi;\ if test -d "doxydoc/html"; then \ test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/search/" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)/doxydoc/search/"; \ $(INSTALL_DATA) doxydoc/html/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc";\ $(INSTALL_DATA) doxydoc/html/search/*.* "$(DESTDIR)$(DocInstallDir)/doxydoc/search";\ fi;\ fi;\ fi uninstall-doxygen-docs: if test -d "$(DESTDIR)$(DocInstallDir)/doxydoc/"; then \ rm -rf "$(DESTDIR)$(DocInstallDir)/doxydoc/"; \ fi if test -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; then \ rm -f "$(DESTDIR)$(DocInstallDir)/refman.pdf"; \ fi all-doxygen-docs: for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) doxygen-docs) \ fi ; \ done ; clean-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) clean-doxygen-docs) \ fi ; \ done ; install-all-doxygen-docs: all-doxygen-docs for dir in $(subdirs) ; do \ do_project=true;\ for proj in $(COIN_SKIP_DOXYGEN); do\ if test $$dir = $$proj; then\ do_project=false;\ fi;\ done;\ if test -r $$dir/doxydoc & $$do_project = true; then \ (cd $$dir ; $(MAKE) install-doxygen-docs) \ fi ; \ done ; uninstall-all-doxygen-docs: for dir in $(subdirs) ; do \ if test -r $$dir/doxydoc ; then \ (cd $$dir ; $(MAKE) uninstall-doxygen-docs) \ fi ; \ done ; install-doc: $(DocFiles) test -z "$(DocInstallDir)" || $(mkdir_p) "$(DESTDIR)$(DocInstallDir)" for file in $(DocFiles); do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$dir$$file"; then $(INSTALL_DATA) "$$dir$$file" "$(DESTDIR)$(DocInstallDir)/$$file"; fi; \ done uninstall-doc: for file in $(DocFiles); do \ rm -f "$(DESTDIR)$(DocInstallDir)/$$file"; \ done ######################################################################## # Maintainer Stuff # ######################################################################## # Make sure acinclude is using most recent coin.m4 @MAINTAINER_MODE_TRUE@$(srcdir)/acinclude.m4: $(BUILDTOOLSDIR)/coin.m4 @MAINTAINER_MODE_TRUE@ cat $(LIBTOOLM4) $< > $@ # Make sure the autotools scripts are up to date @MAINTAINER_MODE_TRUE@$(AUX_DIR)/install-sh: $(BUILDTOOLSDIR)/install-sh @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/missing: $(BUILDTOOLSDIR)/missing @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.guess: $(BUILDTOOLSDIR)/config.guess @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/config.sub: $(BUILDTOOLSDIR)/config.sub @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/depcomp: $(BUILDTOOLSDIR)/depcomp @MAINTAINER_MODE_TRUE@ cp $< $@ @MAINTAINER_MODE_TRUE@$(AUX_DIR)/ltmain.sh: $(BUILDTOOLSDIR)/ltmain.sh @MAINTAINER_MODE_TRUE@ cp $< $@ # Take care of updating externals (if Dependencies file exists) @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@$(top_builddir)/Makefile: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@.Dependencies-stamp: $(srcdir)/Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); BuildTools/set_externals Dependencies @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ touch .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@update-externals: .Dependencies-stamp @HAVE_EXTERNALS_TRUE@@MAINTAINER_MODE_TRUE@ cd $(srcdir); svn update .PHONY: install-doc uninstall-doc update-externals # 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: CoinMP-1.8.3/Clp/examples/0000755000175000017500000000000012600453455013654 5ustar renereneCoinMP-1.8.3/Clp/examples/Makefile.in0000644000175000017500000001243312323253043015715 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # $Id: Makefile.in 726 2006-04-17 04:16:00Z andreasw $ ########################################################################## # You can modify this example makefile to fit for your own program. # # Usually, you only need to change the five CHANGEME entries below. # ########################################################################## # To compile other examples, either changed the following line, or # add the argument DRIVER=problem_name to make DRIVER = driver # CHANGEME: This should be the name of your executable EXE = $(DRIVER)@EXEEXT@ # CHANGEME: Here is the name of all object files corresponding to the source # code that you wrote in order to define the problem statement OBJS = $(DRIVER).@OBJEXT@ # CHANGEME: Additional libraries ADDLIBS = # CHANGEME: Additional flags for compilation (e.g., include flags) ADDINCFLAGS = # CHANGEME: Directory to the sources for the (example) problem definition # files SRCDIR = @srcdir@ VPATH = @srcdir@ ########################################################################## # Usually, you don't have to change anything below. Note that if you # # change certain compiler options, you might have to recompile the # # COIN package. # ########################################################################## COIN_HAS_PKGCONFIG = @COIN_HAS_PKGCONFIG_TRUE@TRUE COIN_CXX_IS_CL = @COIN_CXX_IS_CL_TRUE@TRUE COIN_HAS_SAMPLE = @COIN_HAS_SAMPLE_TRUE@TRUE COIN_HAS_NETLIB = @COIN_HAS_NETLIB_TRUE@TRUE # C++ Compiler command CXX = @CXX@ # C++ Compiler options CXXFLAGS = @CXXFLAGS@ # additional C++ Compiler options for linking CXXLINKFLAGS = @RPATH_FLAGS@ # C Compiler command CC = @CC@ # C Compiler options CFLAGS = @CFLAGS@ # Sample data directory ifeq ($(COIN_HAS_SAMPLE), TRUE) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) CXXFLAGS += -DSAMPLEDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatasample`\" CFLAGS += -DSAMPLEDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatasample`\" else CXXFLAGS += -DSAMPLEDIR=\"@SAMPLE_DATA_INSTALLED@\" CFLAGS += -DSAMPLEDIR=\"@SAMPLE_DATA_INSTALLED@\" endif endif # Netlib data directory ifeq ($(COIN_HAS_NETLIB), TRUE) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) CXXFLAGS += -DNETLIBDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatanetlib`\" CFLAGS += -DNETLIBDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatanetlib`\" else CXXFLAGS += -DNETLIBDIR=\"@NETLIB_DATA_INSTALLED@\" CFLAGS += -DNETLIBDIR=\"@NETLIB_DATA_INSTALLED@\" endif endif # Include directories (we use the CYGPATH_W variables to allow compilation with Windows compilers) ifeq ($(COIN_HAS_PKGCONFIG), TRUE) INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags clp` else INCL = @CLPLIB_CFLAGS_INSTALLED@ endif INCL += $(ADDINCFLAGS) # Linker flags ifeq ($(COIN_HAS_PKGCONFIG), TRUE) LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs clp` else ifeq ($(COIN_CXX_IS_CL), TRUE) LIBS = -link -libpath:`$(CYGPATH_W) @abs_lib_dir@` libClpSolver.lib libClp.lib @CLPLIB_LIBS_INSTALLED@ else LIBS = -L@abs_lib_dir@ -lClpSolver -lClp @CLPLIB_LIBS_INSTALLED@ endif endif # The following is necessary under cygwin, if native compilers are used CYGPATH_W = @CYGPATH_W@ # Here we list all possible generated objects or executables to delete them CLEANFILES = \ addBits.@OBJEXT@ addBits@EXEEXT@ \ addColumns.@OBJEXT@ addColumns@EXEEXT@ \ addRows.@OBJEXT@ addRows@EXEEXT@ \ decomp2.@OBJEXT@ decomp2@EXEEXT@ \ decomp3.@OBJEXT@ decomp3@EXEEXT@ \ decompose.@OBJEXT@ decompose@EXEEXT@ \ defaults.@OBJEXT@ defaults@EXEEXT@ \ driver2.@OBJEXT@ driver2@EXEEXT@ \ driver.@OBJEXT@ driver@EXEEXT@ \ driverC.@OBJEXT@ driverC@EXEEXT@ \ dualCuts.@OBJEXT@ dualCuts@EXEEXT@ \ ekk.@OBJEXT@ ekk@EXEEXT@ \ ekk_interface.@OBJEXT@ ekk_interface@EXEEXT@ \ hello.@OBJEXT@ hello@EXEEXT@ \ makeDual.@OBJEXT@ makeDual@EXEEXT@ \ minimum.@OBJEXT@ minimum@EXEEXT@ \ modify.@OBJEXT@ modify@EXEEXT@ \ network.@OBJEXT@ network@EXEEXT@ \ pdco.@OBJEXT@ pdco@EXEEXT@ \ piece.@OBJEXT@ piece@EXEEXT@ \ rowColumn.@OBJEXT@ rowColumn@EXEEXT@ \ sprint2.@OBJEXT@ sprint2@EXEEXT@ \ sprint.@OBJEXT@ sprint@EXEEXT@ \ testBarrier.@OBJEXT@ testBarrier@EXEEXT@ \ testBasis.@OBJEXT@ testBasis@EXEEXT@ \ testGub2.@OBJEXT@ testGub2@EXEEXT@ \ testGub.@OBJEXT@ testGub@EXEEXT@ \ testQP.@OBJEXT@ testQP@EXEEXT@ \ useVolume.@OBJEXT@ useVolume@EXEEXT@ all: $(EXE) .SUFFIXES: .cpp .c .o .obj $(EXE): $(OBJS) bla=;\ for file in $(OBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \ $(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $@ $$bla $(LIBS) $(ADDLIBS) clean: rm -rf $(CLEANFILES) .cpp.o: $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$< .cpp.obj: $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi` .c.o: $(CC) $(CFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$< .c.obj: $(CC) $(CFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi` CoinMP-1.8.3/Clp/examples/sprint2.cpp0000644000175000017500000001511012130767057015763 0ustar renerene/* $Id: sprint2.cpp 1937 2013-04-09 10:32:15Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "ClpPresolve.hpp" #include "CoinSort.hpp" #include int main(int argc, const char *argv[]) { ClpSimplex model; int status; // Keep names if (argc < 2) { status = model.readMps("small.mps", true); } else { status = model.readMps(argv[1], true); } if (status) exit(10); /* This driver implements the presolve variation of Sprint. This assumes we can get feasible easily */ int numberRows = model.numberRows(); int numberColumns = model.numberColumns(); // We will need arrays to choose variables. These are too big but .. double * weight = new double [numberRows+numberColumns]; int * sort = new int [numberRows+numberColumns]; double * columnLower = model.columnLower(); double * columnUpper = model.columnUpper(); double * saveLower = new double [numberColumns]; memcpy(saveLower, columnLower, numberColumns * sizeof(double)); double * saveUpper = new double [numberColumns]; memcpy(saveUpper, columnUpper, numberColumns * sizeof(double)); double * solution = model.primalColumnSolution(); // Fix in some magical way so remaining problem is easy #if 0 // This is from a real-world problem for (int iColumn = 0; iColumn < numberColumns; iColumn++) { char firstCharacter = model.columnName(iColumn)[0]; if (firstCharacter == 'F' || firstCharacter == 'P' || firstCharacter == 'L' || firstCharacter == 'T') { columnUpper[iColumn] = columnLower[iColumn]; } } #else double * obj = model.objective(); double * saveObj = new double [numberColumns]; memcpy(saveObj, obj, numberColumns * sizeof(double)); memset(obj, 0, numberColumns * sizeof(double)); model.dual(); memcpy(obj, saveObj, numberColumns * sizeof(double)); delete [] saveObj; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (solution[iColumn]setFactorizationFrequency(100 + model2->numberRows() / 50); model2->primal(); pinfo.postsolve(true); // adjust smallNumberColumns if necessary if (iPass) { double ratio = ((double) smallNumberRows) / ((double) model2->numberRows()); smallNumberColumns = (int)(smallNumberColumns * ratio); // deal with pathological case smallNumberColumns = CoinMax(smallNumberColumns,0); } delete model2; /* After this postsolve model should be optimal. We can use checkSolution and test feasibility */ model.checkSolution(); if (model.numberDualInfeasibilities() || model.numberPrimalInfeasibilities()) printf("%g dual %g(%d) Primal %g(%d)\n", model.objectiveValue(), model.sumDualInfeasibilities(), model.numberDualInfeasibilities(), model.sumPrimalInfeasibilities(), model.numberPrimalInfeasibilities()); // Put back true bounds memcpy(columnLower, saveLower, numberColumns * sizeof(double)); memcpy(columnUpper, saveUpper, numberColumns * sizeof(double)); if ((model.objectiveValue() > lastObjective - 1.0e-7 && iPass > 5) || iPass == maxPass - 1) { break; // finished } else { lastObjective = model.objectiveValue(); // now massage weight so all basic in plus good djs const double * djs = model.dualColumnSolution(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double dj = djs[iColumn]; double value = solution[iColumn]; if (model.getStatus(iColumn) == ClpSimplex::basic) dj = -1.0e50; else if (dj < 0.0 && value < columnUpper[iColumn]) dj = dj; else if (dj > 0.0 && value > columnLower[iColumn]) dj = -dj; else if (columnUpper[iColumn] > columnLower[iColumn]) dj = fabs(dj); else dj = 1.0e50; weight[iColumn] = dj; sort[iColumn] = iColumn; } // sort CoinSort_2(weight, weight + numberColumns, sort); // and fix others for (int iColumn = smallNumberColumns; iColumn < numberColumns; iColumn++) { int kColumn = sort[iColumn]; double value = solution[kColumn]; columnLower[kColumn] = value; columnUpper[kColumn] = value; } } } delete [] weight; delete [] sort; delete [] saveLower; delete [] saveUpper; model.primal(1); return 0; } CoinMP-1.8.3/Clp/examples/g.tiny0000644000175000017500000000007410763274574015023 0ustar renerene0 1 0 2 1 3 1 4 2 3 2 4 3 5 3 6 4 5 4 6 4 7 5 8 6 8 7 8 8 0 CoinMP-1.8.3/Clp/examples/testGub2.cpp0000644000175000017500000004127711510657150016067 0ustar renerene/* $Id: testGub2.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "ClpGubDynamicMatrix.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "CoinSort.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "CoinMpsIO.hpp" int main(int argc, const char *argv[]) { ClpSimplex model; int status; int maxIts = 0; int maxFactor = 100; if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1]); if (status) { printf("errors on input\n"); exit(77); } if (argc > 2) { maxFactor = atoi(argv[2]); printf("max factor %d\n", maxFactor); } if (argc > 3) { maxIts = atoi(argv[3]); printf("max its %d\n", maxIts); } // For now scaling off model.scaling(0); if (maxIts) { // Do partial dantzig ClpPrimalColumnSteepest dantzig(5); model.setPrimalColumnPivotAlgorithm(dantzig); //model.messageHandler()->setLogLevel(63); model.setFactorizationFrequency(maxFactor); model.setMaximumIterations(maxIts); model.primal(); if (!model.status()) exit(1); } // find gub int numberRows = model.numberRows(); int * gubStart = new int[numberRows+1]; int * gubEnd = new int[numberRows]; int * which = new int[numberRows]; int * whichGub = new int[numberRows]; int numberColumns = model.numberColumns(); int * mark = new int[numberColumns]; int iRow, iColumn; // delete variables fixed to zero const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); int numberDelete = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] == 0.0 && columnLower[iColumn] == 0.0) mark[numberDelete++] = iColumn; } if (numberDelete) { model.deleteColumns(numberDelete, mark); numberColumns -= numberDelete; columnLower = model.columnLower(); columnUpper = model.columnUpper(); #if 0 CoinMpsIO writer; writer.setMpsData(*model.matrix(), COIN_DBL_MAX, model.getColLower(), model.getColUpper(), model.getObjCoefficients(), (const char*) 0 /*integrality*/, model.getRowLower(), model.getRowUpper(), NULL, NULL); writer.writeMps("cza.mps", 0, 0, 1); #endif } double * lower = new double[numberRows]; double * upper = new double[numberRows]; const double * rowLower = model.rowLower(); const double * rowUpper = model.rowUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) mark[iColumn] = -1; CoinPackedMatrix * matrix = model.matrix(); // get row copy CoinPackedMatrix rowCopy = *matrix; rowCopy.reverseOrdering(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const double * element = rowCopy.getElements(); int putGub = numberRows; int putNonGub = numberRows; int * rowIsGub = new int [numberRows]; for (iRow = numberRows - 1; iRow >= 0; iRow--) { bool gubRow = true; int first = numberColumns + 1; int last = -1; for (int j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { if (element[j] != 1.0) { gubRow = false; break; } else { int iColumn = column[j]; if (mark[iColumn] >= 0) { gubRow = false; break; } else { last = CoinMax(last, iColumn); first = CoinMin(first, iColumn); } } } if (last - first + 1 != rowLength[iRow] || !gubRow) { which[--putNonGub] = iRow; rowIsGub[iRow] = 0; } else { for (int j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; mark[iColumn] = iRow; } rowIsGub[iRow] = -1; putGub--; gubStart[putGub] = first; gubEnd[putGub] = last + 1; lower[putGub] = rowLower[iRow]; upper[putGub] = rowUpper[iRow]; whichGub[putGub] = iRow; } } int numberNonGub = numberRows - putNonGub; int numberGub = numberRows - putGub; if (numberGub > 0) { printf("** %d gub rows\n", numberGub); int numberNormal = 0; const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); int numberElements = 0; bool doLower = false; bool doUpper = false; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (mark[iColumn] < 0) { mark[numberNormal++] = iColumn; } else { numberElements += columnLength[iColumn]; if (columnLower[iColumn] != 0.0) doLower = true; if (columnUpper[iColumn] < 1.0e20) doUpper = true; } } if (!numberNormal) { printf("Putting back one gub row to make non-empty\n"); for (iColumn = gubStart[putGub]; iColumn < gubEnd[putGub]; iColumn++) mark[numberNormal++] = iColumn; putGub++; numberGub--; } ClpSimplex model2(&model, numberNonGub, which + putNonGub, numberNormal, mark); int numberGubColumns = numberColumns - numberNormal; // sort gubs so monotonic int * which = new int[numberGub]; int i; for (i = 0; i < numberGub; i++) which[i] = i; CoinSort_2(gubStart + putGub, gubStart + putGub + numberGub, which); int * temp1 = new int [numberGub]; for (i = 0; i < numberGub; i++) { int k = which[i]; temp1[i] = gubEnd[putGub+k]; } memcpy(gubEnd + putGub, temp1, numberGub * sizeof(int)); delete [] temp1; double * temp2 = new double [numberGub]; for (i = 0; i < numberGub; i++) { int k = which[i]; temp2[i] = lower[putGub+k]; } memcpy(lower + putGub, temp2, numberGub * sizeof(double)); for (i = 0; i < numberGub; i++) { int k = which[i]; temp2[i] = upper[putGub+k]; } memcpy(upper + putGub, temp2, numberGub * sizeof(double)); delete [] temp2; delete [] which; numberElements -= numberGubColumns; int * start2 = new int[numberGubColumns+1]; int * row2 = new int[numberElements]; double * element2 = new double[numberElements]; double * cost2 = new double [numberGubColumns]; double * lowerColumn2 = NULL; if (doLower) { lowerColumn2 = new double [numberGubColumns]; CoinFillN(lowerColumn2, numberGubColumns, 0.0); } double * upperColumn2 = NULL; if (doUpper) { upperColumn2 = new double [numberGubColumns]; CoinFillN(upperColumn2, numberGubColumns, COIN_DBL_MAX); } numberElements = 0; int numberNonGubRows = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (!rowIsGub[iRow]) rowIsGub[iRow] = numberNonGubRows++; } numberColumns = 0; gubStart[0] = 0; start2[0] = 0; const double * cost = model.objective(); for (int iSet = 0; iSet < numberGub; iSet++) { int iStart = gubStart[iSet+putGub]; int iEnd = gubEnd[iSet+putGub]; for (int k = iStart; k < iEnd; k++) { cost2[numberColumns] = cost[k]; if (columnLower[k]) lowerColumn2[numberColumns] = columnLower[k]; if (columnUpper[k] < 1.0e20) upperColumn2[numberColumns] = columnUpper[k]; for (int j = columnStart[k]; j < columnStart[k] + columnLength[k]; j++) { int iRow = rowIsGub[row[j]]; if (iRow >= 0) { row2[numberElements] = iRow; element2[numberElements++] = elementByColumn[j]; } } start2[++numberColumns] = numberElements; } gubStart[iSet+1] = numberColumns; } model2.replaceMatrix(new ClpGubDynamicMatrix(&model2, numberGub, numberColumns, gubStart, lower + putGub, upper + putGub, start2, row2, element2, cost2, lowerColumn2, upperColumn2)); delete [] rowIsGub; delete [] start2; delete [] row2; delete [] element2; delete [] cost2; delete [] lowerColumn2; delete [] upperColumn2; // For now scaling off model2.scaling(0); // Do partial dantzig ClpPrimalColumnSteepest dantzig(5); model2.setPrimalColumnPivotAlgorithm(dantzig); //model2.messageHandler()->setLogLevel(63); model2.setFactorizationFrequency(maxFactor); model2.setMaximumIterations(4000000); double time1 = CoinCpuTime(); model2.primal(); { ClpGubDynamicMatrix * gubMatrix = dynamic_cast< ClpGubDynamicMatrix*>(model2.clpMatrix()); assert(gubMatrix); const double * solution = model2.primalColumnSolution(); int numberGubColumns = gubMatrix->numberGubColumns(); int firstOdd = gubMatrix->firstDynamic(); int lastOdd = gubMatrix->firstAvailable(); int numberTotalColumns = firstOdd + numberGubColumns; int numberRows = model2.numberRows(); char * status = new char [numberTotalColumns]; double * gubSolution = new double [numberTotalColumns]; int numberSets = gubMatrix->numberSets(); const int * id = gubMatrix->id(); int i; const double * lowerColumn = gubMatrix->lowerColumn(); const double * upperColumn = gubMatrix->upperColumn(); for (i = 0; i < numberGubColumns; i++) { if (gubMatrix->getDynamicStatus(i) == ClpGubDynamicMatrix::atUpperBound) { gubSolution[i+firstOdd] = upperColumn[i]; status[i+firstOdd] = 2; } else if (gubMatrix->getDynamicStatus(i) == ClpGubDynamicMatrix::atLowerBound && lowerColumn) { gubSolution[i+firstOdd] = lowerColumn[i]; status[i+firstOdd] = 1; } else { gubSolution[i+firstOdd] = 0.0; status[i+firstOdd] = 1; } } for (i = 0; i < firstOdd; i++) { ClpSimplex::Status thisStatus = model2.getStatus(i); if (thisStatus == ClpSimplex::basic) status[i] = 0; else if (thisStatus == ClpSimplex::atLowerBound) status[i] = 1; else if (thisStatus == ClpSimplex::atUpperBound) status[i] = 2; else if (thisStatus == ClpSimplex::isFixed) status[i] = 3; else abort(); gubSolution[i] = solution[i]; } for (i = firstOdd; i < lastOdd; i++) { int iBig = id[i-firstOdd] + firstOdd; ClpSimplex::Status thisStatus = model2.getStatus(i); if (thisStatus == ClpSimplex::basic) status[iBig] = 0; else if (thisStatus == ClpSimplex::atLowerBound) status[iBig] = 1; else if (thisStatus == ClpSimplex::atUpperBound) status[iBig] = 2; else if (thisStatus == ClpSimplex::isFixed) status[iBig] = 3; else abort(); gubSolution[iBig] = solution[i]; } char * rowStatus = new char[numberRows]; for (i = 0; i < numberRows; i++) { ClpSimplex::Status thisStatus = model2.getRowStatus(i); if (thisStatus == ClpSimplex::basic) rowStatus[i] = 0; else if (thisStatus == ClpSimplex::atLowerBound) rowStatus[i] = 1; else if (thisStatus == ClpSimplex::atUpperBound) rowStatus[i] = 2; else if (thisStatus == ClpSimplex::isFixed) rowStatus[i] = 3; else abort(); } char * setStatus = new char[numberSets]; int * keyVariable = new int[numberSets]; memcpy(keyVariable, gubMatrix->keyVariable(), numberSets * sizeof(int)); for (i = 0; i < numberSets; i++) { int iKey = keyVariable[i]; if (iKey > lastOdd) iKey = numberTotalColumns + i; else iKey = id[iKey-firstOdd] + firstOdd; keyVariable[i] = iKey; ClpSimplex::Status thisStatus = gubMatrix->getStatus(i); if (thisStatus == ClpSimplex::basic) setStatus[i] = 0; else if (thisStatus == ClpSimplex::atLowerBound) setStatus[i] = 1; else if (thisStatus == ClpSimplex::atUpperBound) setStatus[i] = 2; else if (thisStatus == ClpSimplex::isFixed) setStatus[i] = 3; else abort(); } FILE * fp = fopen("xx.sol", "w"); fwrite(gubSolution, sizeof(double), numberTotalColumns, fp); fwrite(status, sizeof(char), numberTotalColumns, fp); const double * rowsol = model2.primalRowSolution(); int originalNumberRows = model.numberRows(); double * rowsol2 = new double[originalNumberRows]; memset(rowsol2, 0, originalNumberRows * sizeof(double)); model.times(1.0, gubSolution, rowsol2); for (i = 0; i < numberRows; i++) assert(fabs(rowsol[i] - rowsol2[i]) < 1.0e-3); //for (;i #include #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #ifdef ABC_INHERIT #include "AbcSimplex.hpp" #endif #include "CoinTime.hpp" //############################################################################# /************************************************************************ This main program shows how to take advantage of the standalone clp in your program. It should perform very nearly the same as clp First it reads in a model from an mps file Then it calls ClpMain1 passing all parameters apart from first Finally it prints solution ************************************************************************/ #ifndef ABC_INHERIT void ClpMain0(ClpSimplex * models); int ClpMain1(int argc, const char *argv[],ClpSimplex * model); #else void ClpMain0(AbcSimplex * models); int ClpMain1(int argc, const char *argv[],AbcSimplex * model); #endif int main (int argc, const char *argv[]) { #ifndef ABC_INHERIT ClpSimplex model; #else AbcSimplex model; #endif if (argc > 1) { printf("command line - "); for (int i = 0; i < argc; i++) printf("%s ", argv[i]); printf("\n"); } // change defaults to match standalone solver ClpMain0(&model); // Read in model using argv[1] // and assert that it is a clean model std::string mpsFileName; #if defined(SAMPLEDIR) mpsFileName = SAMPLEDIR "/p0033.mps"; #else if (argc < 2) { fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); } #endif if (argc>=2) mpsFileName = argv[1]; int numMpsReadErrors = model.readMps(mpsFileName.c_str()); if( numMpsReadErrors != 0 ) { printf("%d errors reading MPS file\n", numMpsReadErrors); return numMpsReadErrors; } /* Now go into code for standalone solver Could copy arguments and add -quit at end to be safe but this will do */ if (argc>2) { ClpMain1(argc-1,argv+1,&model); } else { const char * argv2[]={"driver3","-solve","-quit"}; ClpMain1(3,argv2,&model); } // Print solution const double * solution = model.primalColumnSolution(); int numberColumns = model.numberColumns(); //const double * reducedCosts = model.dualColumnSolution(); std::cout<1.0e-7) std::cout< #include #include #include /* Call back function - just says whenever it gets Clp0005 or Coin0002 */ static void callBack(Clp_Simplex * model, int messageNumber, int nDouble, const double * vDouble, int nInt, const int * vInt, int nString, char ** vString) { if (messageNumber == 1000002) { /* Coin0002 */ assert(nString == 1 && nInt == 3); printf("Name of problem is %s\n", vString[0]); printf("row %d col %d el %d\n", vInt[0], vInt[1], vInt[2]); } else if (messageNumber == 5) { /* Clp0005 */ int i; assert(nInt == 4 && nDouble == 3); /* they may not all print */ for (i = 0; i < 3; i++) printf("%d %g\n", vInt[i], vDouble[i]); } } int main(int argc, const char *argv[]) { /* Get default model */ Clp_Simplex * model = Clp_newModel(); int status; /* register callback */ Clp_registerCallBack(model, callBack); /* Keep names when reading an mps file */ if (argc < 2) { #if defined(SAMPLEDIR) status = Clp_readMps(model, SAMPLEDIR "/p0033.mps", 1, 0); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = Clp_readMps(model, argv[1], 1, 0); if (status) { fprintf(stderr, "Bad readMps %s\n", argv[1]); fprintf(stdout, "Bad readMps %s\n", argv[1]); exit(1); } if (argc < 3 || !strstr(argv[2], "primal")) { /* Use the dual algorithm unless user said "primal" */ Clp_initialDualSolve(model); } else { Clp_initialPrimalSolve(model); } { char modelName[80]; Clp_problemName(model, 80, modelName); printf("Model %s has %d rows and %d columns\n", modelName, Clp_numberRows(model), Clp_numberColumns(model)); } /* remove this to print solution */ /*exit(0); */ { /* Now to print out solution. The methods used return modifiable arrays while the alternative names return const pointers - which is of course much more virtuous. This version just does non-zero columns */ /* Columns */ int numberColumns = Clp_numberColumns(model); int iColumn; /* Alternatively getColSolution(model) */ double * columnPrimal = Clp_primalColumnSolution(model); /* Alternatively getReducedCost(model) */ double * columnDual = Clp_dualColumnSolution(model); /* Alternatively getColLower(model) */ double * columnLower = Clp_columnLower(model); /* Alternatively getColUpper(model) */ double * columnUpper = Clp_columnUpper(model); /* Alternatively getObjCoefficients(model) */ double * columnObjective = Clp_objective(model); printf("--------------------------------------\n"); /* If we have not kept names (parameter to readMps) this will be 0 */ assert(Clp_lengthNames(model)); printf(" Primal Dual Lower Upper Cost\n"); for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value; value = columnPrimal[iColumn]; if (value > 1.0e-8 || value < -1.0e-8) { char name[20]; Clp_columnName(model, iColumn, name); printf("%6d %8s", iColumn, name); printf(" %13g", columnPrimal[iColumn]); printf(" %13g", columnDual[iColumn]); printf(" %13g", columnLower[iColumn]); printf(" %13g", columnUpper[iColumn]); printf(" %13g", columnObjective[iColumn]); printf("\n"); } } printf("--------------------------------------\n"); } return 0; } CoinMP-1.8.3/Clp/examples/makeDual.cpp0000644000175000017500000001626411510657150016111 0ustar renerene/* $Id: makeDual.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "CoinHelperFunctions.hpp" #include "CoinBuild.hpp" int main(int argc, const char *argv[]) { ClpSimplex model; int status; if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1]); if (status) { printf("errors on input\n"); exit(77); } { // check if we need to change bounds to rows int numberColumns = model.numberColumns(); const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); int iColumn; CoinBuild build; double one = 1.0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] < 1.0e20 && columnLower[iColumn] > -1.0e20) { if (fabs(columnLower[iColumn]) < fabs(columnUpper[iColumn])) { double value = columnUpper[iColumn]; model.setColumnUpper(iColumn, COIN_DBL_MAX); build.addRow(1, &iColumn, &one, -COIN_DBL_MAX, value); } else { double value = columnLower[iColumn]; model.setColumnLower(iColumn, -COIN_DBL_MAX); build.addRow(1, &iColumn, &one, value, COIN_DBL_MAX); } } } if (build.numberRows()) model.addRows(build); } int numberColumns = model.numberColumns(); const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); int numberRows = model.numberRows(); double * rowLower = CoinCopyOfArray(model.rowLower(), numberRows); double * rowUpper = CoinCopyOfArray(model.rowUpper(), numberRows); const double * objective = model.objective(); CoinPackedMatrix * matrix = model.matrix(); // get transpose CoinPackedMatrix rowCopy = *matrix; int iRow, iColumn; int numberExtraRows = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow] <= -1.0e20) { } else if (rowUpper[iRow] >= 1.0e20) { } else { if (rowUpper[iRow] != rowLower[iRow]) numberExtraRows++; } } const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); double objOffset = 0.0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double offset = 0.0; if (columnUpper[iColumn] >= 1.0e20) { if (columnLower[iColumn] > -1.0e20) offset = columnLower[iColumn]; } else if (columnLower[iColumn] <= -1.0e20) { offset = columnUpper[iColumn]; } else { // taken care of before abort(); } if (offset) { objOffset += offset * objective[iColumn]; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (rowLower[iRow] > -1.0e20) rowLower[iRow] -= offset * elementByColumn[j]; if (rowUpper[iRow] < 1.0e20) rowUpper[iRow] -= offset * elementByColumn[j]; } } } int * which = new int[numberRows+numberExtraRows]; rowCopy.reverseOrdering(); rowCopy.transpose(); double * fromRowsLower = new double[numberRows+numberExtraRows]; double * fromRowsUpper = new double[numberRows+numberExtraRows]; double * newObjective = new double[numberRows+numberExtraRows]; double * fromColumnsLower = new double[numberColumns]; double * fromColumnsUpper = new double[numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) { // Offset is already in if (columnUpper[iColumn] >= 1.0e20) { if (columnLower[iColumn] > -1.0e20) { fromColumnsLower[iColumn] = -COIN_DBL_MAX; fromColumnsUpper[iColumn] = objective[iColumn]; } else { // free fromColumnsLower[iColumn] = objective[iColumn]; fromColumnsUpper[iColumn] = objective[iColumn]; } } else if (columnLower[iColumn] <= -1.0e20) { fromColumnsLower[iColumn] = objective[iColumn]; fromColumnsUpper[iColumn] = COIN_DBL_MAX; } else { abort(); } } int kRow = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow] <= -1.0e20) { assert(rowUpper[iRow] < 1.0e20); newObjective[kRow] = -rowUpper[iRow]; fromRowsLower[kRow] = -COIN_DBL_MAX; fromRowsUpper[kRow] = 0.0; which[kRow] = iRow; kRow++; } else if (rowUpper[iRow] >= 1.0e20) { newObjective[kRow] = -rowLower[iRow]; fromRowsLower[kRow] = 0.0; fromRowsUpper[kRow] = COIN_DBL_MAX; which[kRow] = iRow; kRow++; } else { if (rowUpper[iRow] == rowLower[iRow]) { newObjective[kRow] = -rowLower[iRow]; fromRowsLower[kRow] = -COIN_DBL_MAX;; fromRowsUpper[kRow] = COIN_DBL_MAX; which[kRow] = iRow; kRow++; } else { // range newObjective[kRow] = -rowUpper[iRow]; fromRowsLower[kRow] = -COIN_DBL_MAX; fromRowsUpper[kRow] = 0.0; which[kRow] = iRow; kRow++; newObjective[kRow] = -rowLower[iRow]; fromRowsLower[kRow] = 0.0; fromRowsUpper[kRow] = COIN_DBL_MAX; which[kRow] = iRow; kRow++; } } } if (numberExtraRows) { CoinPackedMatrix newCopy; newCopy.submatrixOfWithDuplicates(rowCopy, kRow, which); rowCopy = newCopy; } ClpSimplex modelDual; modelDual.loadProblem(rowCopy, fromRowsLower, fromRowsUpper, newObjective, fromColumnsLower, fromColumnsUpper); modelDual.setObjectiveOffset(objOffset); delete [] fromRowsLower; delete [] fromRowsUpper; delete [] fromColumnsLower; delete [] fromColumnsUpper; delete [] newObjective; delete [] which; delete [] rowLower; delete [] rowUpper; modelDual.writeMps("dual.mps"); return 0; } CoinMP-1.8.3/Clp/examples/sprint.cpp0000644000175000017500000002304112130767057015703 0ustar renerene/* $Id: sprint.cpp 1937 2013-04-09 10:32:15Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "CoinSort.hpp" #include int main(int argc, const char *argv[]) { ClpSimplex model; int status; // Keep names if (argc < 2) { status = model.readMps("small.mps", true); } else { status = model.readMps(argv[1], true); } if (status) exit(10); /* This driver implements what I called Sprint. Cplex calls it "sifting" which is just as silly. When I thought of this trivial idea it reminded me of an LP code of the 60's called sprint which after every factorization took a subset of the matrix into memory (all 64K words!) and then iterated very fast on that subset. On the problems of those days it did not work very well, but it worked very well on aircrew scheduling problems where there were very large numbers of columns all with the same flavor. */ /* The idea works best if you can get feasible easily. To make it more general we can add in costed slacks */ int originalNumberColumns = model.numberColumns(); int numberRows = model.numberRows(); // We will need arrays to choose variables. These are too big but .. double * weight = new double [numberRows+originalNumberColumns]; int * sort = new int [numberRows+originalNumberColumns]; int numberSort = 0; // Say we are going to add slacks - if you can get a feasible // solution then do that at the comment - Add in your own coding here bool addSlacks = true; if (addSlacks) { // initial list will just be artificials // first we will set all variables as close to zero as possible int iColumn; const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); double * columnSolution = model.primalColumnSolution(); for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) { double value = 0.0; if (columnLower[iColumn] > 0.0) value = columnLower[iColumn]; else if (columnUpper[iColumn] < 0.0) value = columnUpper[iColumn]; columnSolution[iColumn] = value; } // now see what that does to row solution double * rowSolution = model.primalRowSolution(); memset(rowSolution, 0, numberRows * sizeof(double)); model.times(1.0, columnSolution, rowSolution); int * addStarts = new int [numberRows+1]; int * addRow = new int[numberRows]; double * addElement = new double[numberRows]; const double * lower = model.rowLower(); const double * upper = model.rowUpper(); addStarts[0] = 0; int numberArtificials = 0; double * addCost = new double [numberRows]; const double penalty = 1.0e8; int iRow; for (iRow = 0; iRow < numberRows; iRow++) { if (lower[iRow] > rowSolution[iRow]) { addRow[numberArtificials] = iRow; addElement[numberArtificials] = 1.0; addCost[numberArtificials] = penalty; numberArtificials++; addStarts[numberArtificials] = numberArtificials; } else if (upper[iRow] < rowSolution[iRow]) { addRow[numberArtificials] = iRow; addElement[numberArtificials] = -1.0; addCost[numberArtificials] = penalty; numberArtificials++; addStarts[numberArtificials] = numberArtificials; } } model.addColumns(numberArtificials, NULL, NULL, addCost, addStarts, addRow, addElement); delete [] addStarts; delete [] addRow; delete [] addElement; delete [] addCost; // Set up initial list numberSort = numberArtificials; int i; for (i = 0; i < numberSort; i++) sort[i] = i + originalNumberColumns; } else { // Get initial list in some magical way // Add in your own coding here abort(); } int numberColumns = model.numberColumns(); const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); double * fullSolution = model.primalColumnSolution(); // Just do this number of passes int maxPass = 100; int iPass; double lastObjective = 1.0e31; // Just take this number of columns in small problem int smallNumberColumns = CoinMin(3 * numberRows, numberColumns); smallNumberColumns = CoinMax(smallNumberColumns, 3000); // To stop seg faults on unsuitable problems smallNumberColumns = CoinMin(smallNumberColumns,numberColumns); // We will be using all rows int * whichRows = new int [numberRows]; for (int iRow = 0; iRow < numberRows; iRow++) whichRows[iRow] = iRow; double originalOffset; model.getDblParam(ClpObjOffset, originalOffset); for (iPass = 0; iPass < maxPass; iPass++) { printf("Start of pass %d\n", iPass); //printf("Bug until submodel new version\n"); CoinSort_2(sort, sort + numberSort, weight); // Create small problem ClpSimplex small(&model, numberRows, whichRows, numberSort, sort); // now see what variables left out do to row solution double * rowSolution = model.primalRowSolution(); memset(rowSolution, 0, numberRows * sizeof(double)); int iRow, iColumn; // zero out ones in small problem for (iColumn = 0; iColumn < numberSort; iColumn++) { int kColumn = sort[iColumn]; fullSolution[kColumn] = 0.0; } // Get objective offset double offset = 0.0; const double * objective = model.objective(); for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) offset += fullSolution[iColumn] * objective[iColumn]; small.setDblParam(ClpObjOffset, originalOffset - offset); model.times(1.0, fullSolution, rowSolution); double * lower = small.rowLower(); double * upper = small.rowUpper(); for (iRow = 0; iRow < numberRows; iRow++) { if (lower[iRow] > -1.0e50) lower[iRow] -= rowSolution[iRow]; if (upper[iRow] < 1.0e50) upper[iRow] -= rowSolution[iRow]; } /* For some problems a useful variant is to presolve problem. In this case you need to adjust smallNumberColumns to get right size problem. Also you can dispense with creating small problem and fix variables in large problem and do presolve on that. */ // Solve small.primal(); // move solution back const double * solution = small.primalColumnSolution(); for (iColumn = 0; iColumn < numberSort; iColumn++) { int kColumn = sort[iColumn]; model.setColumnStatus(kColumn, small.getColumnStatus(iColumn)); fullSolution[kColumn] = solution[iColumn]; } for (iRow = 0; iRow < numberRows; iRow++) model.setRowStatus(iRow, small.getRowStatus(iRow)); memcpy(model.primalRowSolution(), small.primalRowSolution(), numberRows * sizeof(double)); if ((small.objectiveValue() > lastObjective - 1.0e-7 && iPass > 5) || !small.numberIterations() || iPass == maxPass - 1) { break; // finished } else { lastObjective = small.objectiveValue(); // get reduced cost for large problem // this assumes minimization memcpy(weight, model.objective(), numberColumns * sizeof(double)); model.transposeTimes(-1.0, small.dualRowSolution(), weight); // now massage weight so all basic in plus good djs for (iColumn = 0; iColumn < numberColumns; iColumn++) { double dj = weight[iColumn]; double value = fullSolution[iColumn]; if (model.getColumnStatus(iColumn) == ClpSimplex::basic) dj = -1.0e50; else if (dj < 0.0 && value < columnUpper[iColumn]) dj = dj; else if (dj > 0.0 && value > columnLower[iColumn]) dj = -dj; else if (columnUpper[iColumn] > columnLower[iColumn]) dj = fabs(dj); else dj = 1.0e50; weight[iColumn] = dj; sort[iColumn] = iColumn; } // sort CoinSort_2(weight, weight + numberColumns, sort); numberSort = smallNumberColumns; } } if (addSlacks) { int i; int numberArtificials = numberColumns - originalNumberColumns; for (i = 0; i < numberArtificials; i++) sort[i] = i + originalNumberColumns; model.deleteColumns(numberArtificials, sort); } delete [] weight; delete [] sort; delete [] whichRows; model.primal(1); return 0; } CoinMP-1.8.3/Clp/examples/useVolume.cpp0000644000175000017500000002325612130613567016354 0ustar renerene/* $Id: useVolume.cpp 1935 2013-04-08 19:16:07Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" #include "VolVolume.hpp" //############################################################################# class lpHook : public VOL_user_hooks { private: lpHook(const lpHook&); lpHook& operator= (const lpHook&); private: /// Pointer to dense vector of structural variable upper bounds double *colupper_; /// Pointer to dense vector of structural variable lower bounds double *collower_; /// Pointer to dense vector of objective coefficients double *objcoeffs_; /// Pointer to dense vector of right hand sides double *rhs_; /// Pointer to dense vector of senses char *sense_; /// The problem matrix in a row ordered form CoinPackedMatrix rowMatrix_; /// The problem matrix in a column ordered form CoinPackedMatrix colMatrix_; public: lpHook(const double* clb, const double* cub, const double* obj, const double* rhs, const char* sense, const CoinPackedMatrix& mat); virtual ~lpHook(); public: // for all hooks: return value of -1 means that volume should quit /** compute reduced costs @param u (IN) the dual variables @param rc (OUT) the reduced cost with respect to the dual values */ virtual int compute_rc(const VOL_dvector& u, VOL_dvector& rc); /** Solve the subproblem for the subgradient step. @param dual (IN) the dual variables @param rc (IN) the reduced cost with respect to the dual values @param lcost (OUT) the lagrangean cost with respect to the dual values @param x (OUT) the primal result of solving the subproblem @param v (OUT) b-Ax for the relaxed constraints @param pcost (OUT) the primal objective value of x */ virtual int solve_subproblem(const VOL_dvector& dual, const VOL_dvector& rc, double& lcost, VOL_dvector& x, VOL_dvector& v, double& pcost); /** Starting from the primal vector x, run a heuristic to produce an integer solution @param x (IN) the primal vector @param heur_val (OUT) the value of the integer solution (return DBL_MAX here if no feas sol was found */ virtual int heuristics(const VOL_problem& p, const VOL_dvector& x, double& heur_val) { return 0; } }; //############################################################################# lpHook::lpHook(const double* clb, const double* cub, const double* obj, const double* rhs, const char* sense, const CoinPackedMatrix& mat) { const int colnum = mat.getNumCols(); const int rownum = mat.getNumRows(); colupper_ = new double[colnum]; collower_ = new double[colnum]; objcoeffs_ = new double[colnum]; rhs_ = new double[rownum]; sense_ = new char[rownum]; std::copy(clb, clb + colnum, collower_); std::copy(cub, cub + colnum, colupper_); std::copy(obj, obj + colnum, objcoeffs_); std::copy(rhs, rhs + rownum, rhs_); std::copy(sense, sense + rownum, sense_); if (mat.isColOrdered()) { colMatrix_.copyOf(mat); rowMatrix_.reverseOrderedCopyOf(mat); } else { rowMatrix_.copyOf(mat); colMatrix_.reverseOrderedCopyOf(mat); } } //----------------------------------------------------------------------------- lpHook::~lpHook() { delete[] colupper_; delete[] collower_; delete[] objcoeffs_; delete[] rhs_; delete[] sense_; } //############################################################################# int lpHook::compute_rc(const VOL_dvector& u, VOL_dvector& rc) { rowMatrix_.transposeTimes(u.v, rc.v); const int psize = rowMatrix_.getNumCols(); for (int i = 0; i < psize; ++i) rc[i] = objcoeffs_[i] - rc[i]; return 0; } //----------------------------------------------------------------------------- int lpHook::solve_subproblem(const VOL_dvector& dual, const VOL_dvector& rc, double& lcost, VOL_dvector& x, VOL_dvector& v, double& pcost) { int i; const int psize = x.size(); const int dsize = v.size(); // compute the lagrangean solution corresponding to the reduced costs for (i = 0; i < psize; ++i) x[i] = (rc[i] >= 0.0) ? collower_[i] : colupper_[i]; // compute the lagrangean value (rhs*dual + primal*rc) lcost = 0; for (i = 0; i < dsize; ++i) lcost += rhs_[i] * dual[i]; for (i = 0; i < psize; ++i) lcost += x[i] * rc[i]; // compute the rhs - lhs colMatrix_.times(x.v, v.v); for (i = 0; i < dsize; ++i) v[i] = rhs_[i] - v[i]; // compute the lagrangean primal objective pcost = 0; for (i = 0; i < psize; ++i) pcost += x[i] * objcoeffs_[i]; return 0; } //############################################################################# int main(int argc, const char *argv[]) { ClpSimplex model; int status; if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1], true); if( status != 0 ) { printf("Error %d reading MPS file\n", status); return status; } /* This driver uses volume algorithm then does dual - after adjusting costs then solves real problem */ // do volume for a bit VOL_problem volprob; const CoinPackedMatrix* mat = model.matrix(); const int psize = mat->getNumCols(); const int dsize = mat->getNumRows(); char * sense = new char[dsize]; double * rhs = new double[dsize]; const double * rowLower = model.rowLower(); const double * rowUpper = model.rowUpper(); // Set the lb/ub on the duals volprob.dsize = dsize; volprob.psize = psize; volprob.dual_lb.allocate(dsize); volprob.dual_ub.allocate(dsize); volprob.dsol.allocate(dsize); int i; for (i = 0; i < dsize; ++i) { if (rowUpper[i] == rowLower[i]) { // 'E': volprob.dual_lb[i] = -1.0e31; volprob.dual_ub[i] = 1.0e31; rhs[i] = rowUpper[i]; sense[i] = 'E'; } else if (rowLower[i] < -0.99e10 && rowUpper[i] < 0.99e10) { // 'L': volprob.dual_lb[i] = -1.0e31; volprob.dual_ub[i] = 0.0; rhs[i] = rowUpper[i]; sense[i] = 'L'; } else if (rowLower[i] > -0.99e10 && rowUpper[i] > 0.99e10) { // 'G': volprob.dual_lb[i] = 0.0; volprob.dual_ub[i] = 1.0e31; rhs[i] = rowLower[i]; sense[i] = 'G'; } else { printf("Volume Algorithm can't work if there is a non ELG row\n"); abort(); } } // Can't use read_param as private // anyway I want automatic use - so maybe this is problem #if 0 FILE* infile = fopen("parameters", "r"); if (!infile) { printf("Failure to open parameter file\n"); } else { volprob.read_params("parameters"); } #endif #if 0 // should save and restore bounds model.tightenPrimalBounds(); #else double * colUpper = model.columnUpper(); for (i = 0; i < psize; i++) colUpper[i] = 1.0; #endif lpHook myHook(model.getColLower(), model.getColUpper(), model.getObjCoefficients(), rhs, sense, *mat); // move duals double * pi = model.dualRowSolution(); memcpy(volprob.dsol.v, pi, dsize * sizeof(double)); volprob.solve(myHook, false /* not warmstart */); // For now stop as not doing any good exit(77); // create objectives int numberRows = model.numberRows(); int numberColumns = model.numberColumns(); memcpy(pi, volprob.dsol.v, numberRows * sizeof(double)); #define MODIFYCOSTS #ifdef MODIFYCOSTS double * saveObj = new double[numberColumns]; memcpy(saveObj, model.objective(), numberColumns * sizeof(double)); memcpy(model.dualColumnSolution(), model.objective(), numberColumns * sizeof(double)); model.clpMatrix()->transposeTimes(-1.0, pi, model.dualColumnSolution()); memcpy(model.objective(), model.dualColumnSolution(), numberColumns * sizeof(double)); const double * rowsol = model.primalRowSolution(); //const double * rowLower = model.rowLower(); //const double * rowUpper = model.rowUpper(); double offset = 0.0; for (i = 0; i < numberRows; i++) { offset += pi[i] * rowsol[i]; } double value2; model.getDblParam(ClpObjOffset, value2); printf("Offset %g %g\n", offset, value2); model.setRowObjective(pi); // zero out pi memset(pi, 0, numberRows * sizeof(double)); #endif // Could put some in basis - only partially tested model.allSlackBasis(); model.factorization()->maximumPivots(1000); //model.setLogLevel(63); // solve model.dual(1); //model.primal(1); #ifdef MODIFYCOSTS memcpy(model.objective(), saveObj, numberColumns * sizeof(double)); // zero out pi memset(pi, 0, numberRows * sizeof(double)); model.setRowObjective(pi); delete [] saveObj; model.primal(); #endif return 0; } CoinMP-1.8.3/Clp/examples/hello.cpp0000644000175000017500000000346511402524254015466 0ustar renerene/* $Id: hello.cpp 1559 2010-06-05 19:42:36Z stefan $ */ /* Copyright (C) 2004, International Business Machines Corporation and others. All Rights Reserved. This sample program is designed to illustrate programming techniques using CoinLP, has not been thoroughly tested and comes without any warranty whatsoever. You may copy, modify and distribute this sample program without any restrictions whatsoever and without any payment to anyone. */ /* This shows how to provide a simple picture of a matrix. The default matrix will print Hello World */ #include "ClpSimplex.hpp" int main(int argc, const char *argv[]) { ClpSimplex model; int status; // Keep names if (argc < 2) { status = model.readMps("hello.mps", true); } else { status = model.readMps(argv[1], true); } if (status) exit(10); int numberColumns = model.numberColumns(); int numberRows = model.numberRows(); if (numberColumns > 80 || numberRows > 80) { printf("model too large\n"); exit(11); } printf("This prints x wherever a non-zero element exists in the matrix.\n\n\n"); char x[81]; int iRow; // get row copy CoinPackedMatrix rowCopy = *model.matrix(); rowCopy.reverseOrdering(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); x[numberColumns] = '\0'; for (iRow = 0; iRow < numberRows; iRow++) { memset(x, ' ', numberColumns); for (int k = rowStart[iRow]; k < rowStart[iRow] + rowLength[iRow]; k++) { int iColumn = column[k]; x[iColumn] = 'x'; } printf("%s\n", x); } printf("\n\n"); return 0; } CoinMP-1.8.3/Clp/examples/driver2.cpp0000644000175000017500000003532111510657150015736 0ustar renerene/* $Id: driver2.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "ClpPresolve.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "ClpDualRowSteepest.hpp" #include "ClpPrimalColumnSteepest.hpp" #include // This driver shows how to trap messages - this is just as in unitTest.cpp // ****** THis code is similar to MyMessageHandler.hpp and MyMessagehandler.cpp #include "CoinMessageHandler.hpp" /** This just adds a model to CoinMessage and a void pointer so user can trap messages and do useful stuff. This is used in Clp/Test/unitTest.cpp The file pointer is just there as an example of user stuff. */ class ClpSimplex; class MyMessageHandler : public CoinMessageHandler { public: /**@name Overrides */ //@{ virtual int print(); //@} /**@name set and get */ //@{ /// Model const ClpSimplex * model() const; void setModel(ClpSimplex * model); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ MyMessageHandler(); /// Constructor with pointer to model MyMessageHandler(ClpSimplex * model, FILE * userPointer = NULL); /** Destructor */ virtual ~MyMessageHandler(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ MyMessageHandler(const MyMessageHandler&); /** The copy constructor from an CoinSimplexMessageHandler. */ MyMessageHandler(const CoinMessageHandler&); MyMessageHandler& operator= (const MyMessageHandler&); /// Clone virtual CoinMessageHandler * clone() const ; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer back to model ClpSimplex * model_; //@} }; //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- MyMessageHandler::MyMessageHandler() : CoinMessageHandler(), model_(NULL) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- MyMessageHandler::MyMessageHandler(const MyMessageHandler & rhs) : CoinMessageHandler(rhs), model_(rhs.model_) { } MyMessageHandler::MyMessageHandler(const CoinMessageHandler & rhs) : CoinMessageHandler(), model_(NULL) { } // Constructor with pointer to model MyMessageHandler::MyMessageHandler(ClpSimplex * model, FILE * userPointer) : CoinMessageHandler(), model_(model) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- MyMessageHandler::~MyMessageHandler() { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- MyMessageHandler & MyMessageHandler::operator= (const MyMessageHandler & rhs) { if (this != &rhs) { CoinMessageHandler::operator= (rhs); model_ = rhs.model_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CoinMessageHandler * MyMessageHandler::clone() const { return new MyMessageHandler(*this); } // Print out values from first 20 messages static int times = 0; int MyMessageHandler::print() { // You could have added a callback flag if you had wanted - see Clp_C_Interface.c times++; if (times <= 20) { int messageNumber = currentMessage().externalNumber(); if (currentSource() != "Clp") messageNumber += 1000000; int i; int nDouble = numberDoubleFields(); printf("%d doubles - ", nDouble); for (i = 0; i < nDouble; i++) printf("%g ", doubleValue(i)); printf("\n");; int nInt = numberIntFields(); printf("%d ints - ", nInt); for (i = 0; i < nInt; i++) printf("%d ", intValue(i)); printf("\n");; int nString = numberStringFields(); printf("%d strings - ", nString); for (i = 0; i < nString; i++) printf("%s ", stringValue(i).c_str()); printf("\n");; } return CoinMessageHandler::print(); } const ClpSimplex * MyMessageHandler::model() const { return model_; } void MyMessageHandler::setModel(ClpSimplex * model) { model_ = model; } int main(int argc, const char *argv[]) { ClpSimplex model; // Message handler MyMessageHandler messageHandler(&model); std::cout << "Testing derived message handler" << std::endl; model.passInMessageHandler(&messageHandler); int status; // Keep names when reading an mps file if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1], true); if (status) { fprintf(stderr, "Bad readMps %s\n", argv[1]); fprintf(stdout, "Bad readMps %s\n", argv[1]); exit(1); } double time1 = CoinCpuTime(); /* This driver shows how to do presolve.by hand (rather than with initialSolve) */ ClpSimplex * model2; ClpPresolve pinfo; int numberPasses = 5; // can change this /* Use a tolerance of 1.0e-8 for feasibility, treat problem as not being integer, do "numberpasses" passes and throw away names in presolved model */ model2 = pinfo.presolvedModel(model, 1.0e-8, false, numberPasses, false); if (!model2) { fprintf(stderr, "ClpPresolve says %s is infeasible with tolerance of %g\n", argv[1], 1.0e-8); fprintf(stdout, "ClpPresolve says %s is infeasible with tolerance of %g\n", argv[1], 1.0e-8); // model was infeasible - maybe try again with looser tolerances model2 = pinfo.presolvedModel(model, 1.0e-7, false, numberPasses, false); if (!model2) { fprintf(stderr, "ClpPresolve says %s is infeasible with tolerance of %g\n", argv[1], 1.0e-7); fprintf(stdout, "ClpPresolve says %s is infeasible with tolerance of %g\n", argv[1], 1.0e-7); exit(2); } } // change factorization frequency from 200 model2->setFactorizationFrequency(100 + model2->numberRows() / 50); if (argc < 3 || !strstr(argv[2], "primal")) { // Use the dual algorithm unless user said "primal" /* faster if bounds tightened as then dual can flip variables to other bound to stay dual feasible. We can trash the bounds as this model is going to be thrown away */ int numberInfeasibilities = model2->tightenPrimalBounds(); if (numberInfeasibilities) std::cout << "** Analysis indicates model infeasible" << std::endl; model2->crash(1000.0, 2); ClpDualRowSteepest steep(1); model2->setDualRowPivotAlgorithm(steep); model2->dual(); } else { ClpPrimalColumnSteepest steep(1); model2->setPrimalColumnPivotAlgorithm(steep); model2->primal(); } pinfo.postsolve(true); int numberIterations = model2->numberIterations();; delete model2; /* After this postsolve model should be optimal. We can use checkSolution and test feasibility */ model.checkSolution(); if (model.numberDualInfeasibilities() || model.numberPrimalInfeasibilities()) printf("%g dual %g(%d) Primal %g(%d)\n", model.objectiveValue(), model.sumDualInfeasibilities(), model.numberDualInfeasibilities(), model.sumPrimalInfeasibilities(), model.numberPrimalInfeasibilities()); // But resolve for safety model.primal(1); numberIterations += model.numberIterations();; // for running timing tests std::cout << argv[1] << " Objective " << model.objectiveValue() << " took " << numberIterations << " iterations and " << CoinCpuTime() - time1 << " seconds" << std::endl; std::string modelName; model.getStrParam(ClpProbName, modelName); std::cout << "Model " << modelName << " has " << model.numberRows() << " rows and " << model.numberColumns() << " columns" << std::endl; // remove this to print solution exit(0); /* Now to print out solution. The methods used return modifiable arrays while the alternative names return const pointers - which is of course much more virtuous. This version just does non-zero columns */ #if 0 int numberRows = model.numberRows(); // Alternatively getRowActivity() double * rowPrimal = model.primalRowSolution(); // Alternatively getRowPrice() double * rowDual = model.dualRowSolution(); // Alternatively getRowLower() double * rowLower = model.rowLower(); // Alternatively getRowUpper() double * rowUpper = model.rowUpper(); // Alternatively getRowObjCoefficients() double * rowObjective = model.rowObjective(); // If we have not kept names (parameter to readMps) this will be 0 assert(model.lengthNames()); // Row names const std::vector * rowNames = model.rowNames(); int iRow; std::cout << " Primal Dual Lower Upper (Cost)" << std::endl; for (iRow = 0; iRow < numberRows; iRow++) { double value; std::cout << std::setw(6) << iRow << " " << std::setw(8) << (*rowNames)[iRow]; value = rowPrimal[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowDual[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowLower[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowUpper[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; if (rowObjective) { value = rowObjective[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; } std::cout << std::endl; } #endif std::cout << "--------------------------------------" << std::endl; // Columns int numberColumns = model.numberColumns(); // Alternatively getColSolution() double * columnPrimal = model.primalColumnSolution(); // Alternatively getReducedCost() double * columnDual = model.dualColumnSolution(); // Alternatively getColLower() double * columnLower = model.columnLower(); // Alternatively getColUpper() double * columnUpper = model.columnUpper(); // Alternatively getObjCoefficients() double * columnObjective = model.objective(); // If we have not kept names (parameter to readMps) this will be 0 assert(model.lengthNames()); // Column names const std::vector * columnNames = model.columnNames(); int iColumn; std::cout << " Primal Dual Lower Upper Cost" << std::endl; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value; value = columnPrimal[iColumn]; if (fabs(value) > 1.0e-8) { std::cout << std::setw(6) << iColumn << " " << std::setw(8) << (*columnNames)[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnDual[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnLower[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnUpper[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnObjective[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; std::cout << std::endl; } } std::cout << "--------------------------------------" << std::endl; return 0; } CoinMP-1.8.3/Clp/examples/myPdco.cpp0000644000175000017500000002206511510657150015615 0ustar renerene/* $Id: myPdco.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "ClpInterior.hpp" #include "myPdco.hpp" #include "ClpDummyMatrix.hpp" #include "ClpMessage.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- myPdco::myPdco() : ClpPdcoBase(), rowIndex_(NULL), numlinks_(0), numnodes_(0) { setType(11); } // Constructor from stuff myPdco::myPdco(double d1, double d2, int numnodes, int numlinks) : ClpPdcoBase(), rowIndex_(NULL), numlinks_(numlinks), numnodes_(numnodes) { d1_ = d1; d2_ = d2; setType(11); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- myPdco::myPdco(const myPdco & rhs) : ClpPdcoBase(rhs), numlinks_(rhs.numlinks_), numnodes_(rhs.numnodes_) { rowIndex_ = ClpCopyOfArray(rhs.rowIndex_, 2 * (numlinks_ + 2 * numnodes_)); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- myPdco::~myPdco() { delete [] rowIndex_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- myPdco & myPdco::operator= (const myPdco & rhs) { if (this != &rhs) { ClpPdcoBase::operator= (rhs); numlinks_ = rhs.numlinks_; numnodes_ = rhs.numnodes_; rowIndex_ = ClpCopyOfArray(rhs.rowIndex_, 2 * (numlinks_ + 2 * numnodes_)); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpPdcoBase * myPdco::clone() const { return new myPdco(*this); } void myPdco::matVecMult(ClpInterior * model, int mode, double* x_elts, double* y_elts) const { int nrow = model->numberRows(); if (mode == 1) { double y_sum = 0.0; for (int k = 0; k < numlinks_; k++) { y_sum += y_elts[k]; int i1 = rowIndex_[2*k]; assert(i1 >= 0); x_elts[i1] += y_elts[k]; int i2 = rowIndex_[2*k+1]; assert(i2 >= 0); x_elts[i2] -= y_elts[k]; } double y_suma = 0.0; double y_sumb = 0.0; for (int k = 0; k < numnodes_; k++) { y_suma -= y_elts[numlinks_ + k]; y_sumb += y_elts[numlinks_ + numnodes_ + k]; x_elts[k] += y_elts[numlinks_ + k]; x_elts[k] -= y_elts[numlinks_ + numnodes_ + k]; } x_elts[nrow-3] += y_suma; x_elts[nrow-2] += y_sumb; x_elts[nrow-1] += (y_sum - y_suma + y_sumb); } else { for (int k = 0; k < numlinks_; k++) { x_elts[k] += y_elts[nrow-1]; int i1 = rowIndex_[2*k]; x_elts[k] += y_elts[i1]; int i2 = rowIndex_[2*k+1]; x_elts[k] -= y_elts[i2]; } for (int k = 0; k < numnodes_; k++) { x_elts[numlinks_ + k] += (y_elts[k] - y_elts[nrow-3] + y_elts[nrow-1]); x_elts[numlinks_ + numnodes_ + k] += (y_elts[nrow-2] - y_elts[k] + y_elts[nrow-1]); } } return; } void myPdco::matPrecon(ClpInterior * model, double delta, double* x_elts, double* y_elts) const { double y_sum = 0.0; int ncol = model->numberColumns(); int nrow = model->numberRows(); double *ysq = new double[ncol]; for (int k = 0; k < nrow; k++) x_elts[k] = 0.0; for (int k = 0; k < ncol; k++) ysq[k] = y_elts[k] * y_elts[k]; for (int k = 0; k < numlinks_; k++) { y_sum += ysq[k]; int i1 = rowIndex_[2*k]; x_elts[i1] += ysq[k]; int i2 = rowIndex_[2*k+1]; x_elts[i2] += ysq[k]; } double y_suma = 0.0; double y_sumb = 0.0; for (int k = 0; k < numnodes_; k++) { y_suma += ysq[numlinks_ + k]; y_sumb += ysq[numlinks_ + numnodes_ + k]; x_elts[k] += ysq[numlinks_ + k]; x_elts[k] += ysq[numlinks_ + numnodes_ + k]; } x_elts[nrow-3] += y_suma; x_elts[nrow-2] += y_sumb; x_elts[nrow-1] += (y_sum + y_suma + y_sumb); delete [] ysq; double delsq = delta * delta; for (int k = 0; k < nrow; k++) x_elts[k] = 1.0 / (sqrt(x_elts[k] + delsq)); return; } double myPdco::getObj(ClpInterior * model, CoinDenseVector &x) const { double obj = 0; double *x_elts = x.getElements(); int ncol = model->numberColumns(); for (int k = 0; k < ncol; k++) obj += x_elts[k] * log(x_elts[k]); return obj; } void myPdco::getGrad(ClpInterior * model, CoinDenseVector &x, CoinDenseVector &g) const { double *x_elts = x.getElements(); double *g_elts = g.getElements(); int ncol = model->numberColumns(); for (int k = 0; k < ncol; k++) g_elts[k] = 1.0 + log(x_elts[k]); return; } void myPdco::getHessian(ClpInterior * model, CoinDenseVector &x, CoinDenseVector &H) const { double *x_elts = x.getElements(); double *H_elts = H.getElements(); int ncol = model->numberColumns(); for (int k = 0; k < ncol; k++) H_elts[k] = 1.0 / x_elts[k]; return; } myPdco::myPdco(ClpInterior & model, FILE * fpData, FILE * fpParam) { int nrow; int ncol; int numelts; double *rowUpper; double *rowLower; double *colUpper; double *colLower; double *rhs; double *x; double *y; double *dj; int ipair[2], igparm[4], maxrows, maxlinks; // Read max array sizes and allocate them fscanf(fpParam, "%d %d", &maxrows, &maxlinks); int *ir = new int[2*maxlinks + 5]; /********************** alpha parameter hrdwired here ***********/ double alpha = 0.9; int kct = 0; int imax = 0; int imin = 0x7fffffff; int *ifrom = &ipair[0]; int *ito = &ipair[1]; int nonzpt = 0; numlinks_ = 0; while (fscanf(fpData, "%d %d", ifrom, ito) && kct++ < maxlinks) { // while(fread(ipair, 4,2, fpData) && kct++ < maxlinks){ if ((*ifrom) < 0) { printf("Bad link %d %d\n", *ifrom, *ito); continue; } ipair[0]--; ipair[1]--; //assert(*ifrom>=0&&*ifrom=0&&*ifrom= maxrows || *ito < 0 || *ito >= maxrows) { printf("bad link %d %d\n", *ifrom, *ito); continue; } numlinks_++; ir[nonzpt++] = *ifrom; ir[nonzpt++] = *ito; imax = CoinMax(imax, *ifrom); imax = CoinMax(imax, *ito); imin = CoinMin(imin, *ifrom); imin = CoinMin(imin, *ito); } fclose(fpData); fclose(fpParam); printf("imax %d imin %d\n", imax, imin); // Set model size numnodes_ = imax + 1; nrow = numnodes_ + 3; ncol = numlinks_ + 2 * numnodes_; numelts = 3 * ncol; rowIndex_ = ir; d1_ = 1.0e-3; d2_ = 1.0e-3; double* rhs_def = new double[nrow]; for (int k = 0; k < nrow; k++) rhs_def[k] = 0.0; rhs_def[nrow-3] = alpha - 1.0; rhs_def[nrow-2] = 1.0 - alpha; rhs_def[nrow-1] = 1.0; // rhs_ etc should not be public rhs = rhs_def; rowUpper = rhs_def; rowLower = rhs_def; double *x_def = new double[ncol]; double *U_def = new double[ncol]; double *L_def = new double[ncol]; for (int k = 0; k < ncol; k++) { // x_def[k] = 10.0/ncol; x_def[k] = 1.0 / ncol; U_def[k] = 1e20;; L_def[k] = 0.0; } x = x_def; colUpper = U_def; colLower = L_def; // We have enough to create a model ClpDummyMatrix dummy(ncol, nrow, numelts); model.loadProblem(dummy, colLower, colUpper, NULL, rowLower, rowUpper); double *y_def = new double[nrow]; for (int k = 0; k < nrow; k++) y_def[k] = 0.0; y = y_def; double *dj_def = new double[ncol]; for (int k = 0; k < ncol; k++) dj_def[k] = 1.0; dj = dj_def; // delete arrays delete [] U_def; delete [] L_def; // Should be sets model.rhs_ = rhs; model.x_ = x; model.y_ = y; model.dj_ = dj; model.xsize_ = 50 / ncol; model.xsize_ = CoinMin(model.xsize_, 1.0); model.zsize_ = 1; } CoinMP-1.8.3/Clp/examples/decomp3.cpp0000644000175000017500000000666111510657150015720 0ustar renerene/* $Id: decomp3.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "ClpPresolve.hpp" #include "CoinStructuredModel.hpp" #include "CoinTime.hpp" #include int main(int argc, const char *argv[]) { /* Create a structured model by reading mps file and trying Dantzig-Wolfe or Benders decomposition */ // Get maximum number of blocks int maxBlocks = 50; if (argc > 2) maxBlocks = atoi(argv[2]); int decompose = 1; if (maxBlocks < 0) { maxBlocks = -maxBlocks; decompose = 2; } if (maxBlocks < 2) { printf("Second parameters is maximum number of blocks >=2)\n"); exit(5); } else { printf("Allowing at most %d blocks\n", maxBlocks); } //#define PRESOLVE #ifndef PRESOLVE #if defined(NETLIBDIR) CoinStructuredModel model((argc < 2) ? NETLIBDIR "/czprob.mps" : argv[1], decompose, maxBlocks); #else if (argc<2) { fprintf(stderr, "Do not know where to find netlib MPS files.\n"); return 1; } CoinStructuredModel model(argv[1], 1); #endif if (!model.numberRows()) exit(10); // Get default solver - could change stuff ClpSimplex solver; // change factorization frequency from 200 solver.setFactorizationFrequency(100 + model.numberRows() / 50); /* This driver does a simple Dantzig Wolfe decomposition */ double time1 = CoinCpuTime() ; solver.solve(&model); std::cout << "model took " << CoinCpuTime() - time1 << " seconds" << std::endl; // Double check solver.primal(1); #else ClpSimplex model; #if defined(NETLIBDIR) int status = model.readMps((argc < 2) ? NETLIBDIR "/czprob.mps" : argv[1]); #else if (argc<2) { fprintf(stderr, "Do not know where to find netlib MPS files.\n"); return 1; } int status = model.readMps(argv[1]); #endif if (status) { fprintf(stdout, "Bad readMps %s\n", argv[1]); exit(1); } ClpSimplex * model2 = &model; CoinStructuredModel modelB; modelB.decompose(*model2->matrix(), model2->rowLower(), model2->rowUpper(), model2->columnLower(), model2->columnUpper(), model2->objective(), 1, maxBlocks, model2->objectiveOffset()); // change factorization frequency from 200 model2->setFactorizationFrequency(100 + modelB.numberRows() / 50); /* This driver does a simple Dantzig Wolfe decomposition */ double time1 = CoinCpuTime() ; model2->solve(&modelB); std::cout << "model took " << CoinCpuTime() - time1 << " seconds" << std::endl; // But resolve for safety model.primal(1); #endif return 0; ClpSimplex solver2; #if defined(NETLIBDIR) solver2.readMps((argc < 2) ? NETLIBDIR "/czprob.mps" : argv[1]); #else if (argc<2) { fprintf(stderr, "Do not know where to find netlib MPS files.\n"); return 1; } solver2.readMps(argv[1]); #endif time1 = CoinCpuTime() ; solver2.dual(); std::cout << "second try took " << CoinCpuTime() - time1 << " seconds" << std::endl; return 0; } CoinMP-1.8.3/Clp/examples/myPdco.hpp0000644000175000017500000000356711510657150015630 0ustar renerene/* $Id: myPdco.hpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef myPdco_H #define myPdco_H #include "CoinPragma.hpp" #include "ClpPdcoBase.hpp" /** This implements a simple network matrix as derived from ClpMatrixBase. If you want more sophisticated version then you could inherit from this. Also you might want to allow networks with gain */ class myPdco : public ClpPdcoBase { public: /**@name Useful methods */ //@{ virtual void matVecMult(ClpInterior * model, int mode, double * x, double * y) const; virtual void getGrad(ClpInterior * model, CoinDenseVector &x, CoinDenseVector &grad) const; virtual void getHessian(ClpInterior * model, CoinDenseVector &x, CoinDenseVector &H) const; virtual double getObj(ClpInterior * model, CoinDenseVector &x) const; virtual void matPrecon(ClpInterior * model, double delta, double * x, double * y) const ; //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ myPdco(); /** Constructor from Stuff */ myPdco(double d1, double d2, int numnodes, int numlinks); /// Also reads a model myPdco(ClpInterior & model, FILE * fpData, FILE * fpParam); /** Destructor */ virtual ~myPdco(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ myPdco(const myPdco&); myPdco& operator=(const myPdco&); /// Clone virtual ClpPdcoBase * clone() const ; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ int * rowIndex_; int numlinks_; int numnodes_; //@} }; #endif CoinMP-1.8.3/Clp/examples/addColumns.cpp0000644000175000017500000002626711510657150016463 0ustar renerene/* $Id: addColumns.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // This is a simple example to create a model by column #include "ClpSimplex.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "CoinBuild.hpp" #include "CoinModel.hpp" #include #include int main(int argc, const char *argv[]) { { // Empty model ClpSimplex model; // Bounds on rows - as dense vector double lower[] = {2.0, 1.0}; double upper[] = {COIN_DBL_MAX, 1.0}; // Create space for 2 rows model.resize(2, 0); // Fill in int i; // Now row bounds for (i = 0; i < 2; i++) { model.setRowLower(i, lower[i]); model.setRowUpper(i, upper[i]); } // Now add column 1 int column1Index[] = {0, 1}; double column1Value[] = {1.0, 1.0}; model.addColumn(2, column1Index, column1Value, 0.0, 2, 1.0); // Now add column 2 int column2Index[] = {1}; double column2Value[] = { -5.0}; model.addColumn(1, column2Index, column2Value, 0.0, COIN_DBL_MAX, 0.0); // Now add column 3 int column3Index[] = {0, 1}; double column3Value[] = {1.0, 1.0}; model.addColumn(2, column3Index, column3Value, 0.0, 4.0, 4.0); // solve model.dual(); /* Adding one column at a time has a significant overhead so let's try a more complicated but faster way First time adding in 10000 columns one by one */ model.allSlackBasis(); ClpSimplex modelSave = model; double time1 = CoinCpuTime(); int k; for (k = 0; k < 10000; k++) { int column2Index[] = {0, 1}; double column2Value[] = {1.0, -5.0}; model.addColumn(2, column2Index, column2Value, 0.0, 1.0, 10000.0); } printf("Time for 10000 addColumn is %g\n", CoinCpuTime() - time1); model.dual(); model = modelSave; // Now use build CoinBuild buildObject; time1 = CoinCpuTime(); for (k = 0; k < 100000; k++) { int column2Index[] = {0, 1}; double column2Value[] = {1.0, -5.0}; buildObject.addColumn(2, column2Index, column2Value, 0.0, 1.0, 10000.0); } model.addColumns(buildObject); printf("Time for 100000 addColumn using CoinBuild is %g\n", CoinCpuTime() - time1); model.dual(); model = modelSave; // Now use build +-1 int del[] = {0, 1, 2}; model.deleteColumns(3, del); CoinBuild buildObject2; time1 = CoinCpuTime(); for (k = 0; k < 10000; k++) { int column2Index[] = {0, 1}; double column2Value[] = {1.0, 1.0, -1.0}; int bias = k & 1; buildObject2.addColumn(2, column2Index, column2Value + bias, 0.0, 1.0, 10000.0); } model.addColumns(buildObject2, true); printf("Time for 10000 addColumn using CoinBuild+-1 is %g\n", CoinCpuTime() - time1); model.dual(); model = modelSave; // Now use build +-1 model.deleteColumns(3, del); CoinModel modelObject2; time1 = CoinCpuTime(); for (k = 0; k < 10000; k++) { int column2Index[] = {0, 1}; double column2Value[] = {1.0, 1.0, -1.0}; int bias = k & 1; modelObject2.addColumn(2, column2Index, column2Value + bias, 0.0, 1.0, 10000.0); } model.addColumns(modelObject2, true); printf("Time for 10000 addColumn using CoinModel+-1 is %g\n", CoinCpuTime() - time1); //model.writeMps("xx.mps"); model.dual(); model = modelSave; // Now use model CoinModel modelObject; time1 = CoinCpuTime(); for (k = 0; k < 100000; k++) { int column2Index[] = {0, 1}; double column2Value[] = {1.0, -5.0}; modelObject.addColumn(2, column2Index, column2Value, 0.0, 1.0, 10000.0); } model.addColumns(modelObject); printf("Time for 100000 addColumn using CoinModel is %g\n", CoinCpuTime() - time1); model.dual(); // Print column solution Just first 3 columns int numberColumns = model.numberColumns(); numberColumns = CoinMin(3, numberColumns); // Alternatively getColSolution() double * columnPrimal = model.primalColumnSolution(); // Alternatively getReducedCost() double * columnDual = model.dualColumnSolution(); // Alternatively getColLower() double * columnLower = model.columnLower(); // Alternatively getColUpper() double * columnUpper = model.columnUpper(); // Alternatively getObjCoefficients() double * columnObjective = model.objective(); int iColumn; std::cout << " Primal Dual Lower Upper Cost" << std::endl; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value; std::cout << std::setw(6) << iColumn << " "; value = columnPrimal[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnDual[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnLower[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnUpper[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnObjective[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; std::cout << std::endl; } std::cout << "--------------------------------------" << std::endl; } { // Now copy a model ClpSimplex model; int status; if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1]); if (status) { printf("errors on input\n"); exit(77); } model.initialSolve(); int numberRows = model.numberRows(); int numberColumns = model.numberColumns(); const double * rowLower = model.rowLower(); const double * rowUpper = model.rowUpper(); // Start off model2 ClpSimplex model2; model2.addRows(numberRows, rowLower, rowUpper, NULL); // Build object CoinBuild buildObject; // Add columns const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); const double * objective = model.objective(); CoinPackedMatrix * matrix = model.matrix(); const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex start = columnStart[iColumn]; buildObject.addColumn(columnLength[iColumn], row + start, elementByColumn + start, columnLower[iColumn], columnUpper[iColumn], objective[iColumn]); } // add in model2.addColumns(buildObject); model2.initialSolve(); } { // and again ClpSimplex model; int status; if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1]); if (status) { printf("errors on input\n"); exit(77); } model.initialSolve(); int numberRows = model.numberRows(); int numberColumns = model.numberColumns(); const double * rowLower = model.rowLower(); const double * rowUpper = model.rowUpper(); // Build object CoinModel buildObject; for (int iRow = 0; iRow < numberRows; iRow++) buildObject.setRowBounds(iRow, rowLower[iRow], rowUpper[iRow]); // Add columns const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); const double * objective = model.objective(); CoinPackedMatrix * matrix = model.matrix(); const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex start = columnStart[iColumn]; buildObject.addColumn(columnLength[iColumn], row + start, elementByColumn + start, columnLower[iColumn], columnUpper[iColumn], objective[iColumn]); } // add in ClpSimplex model2; model2.loadProblem(buildObject); model2.initialSolve(); } return 0; } CoinMP-1.8.3/Clp/examples/network.cpp0000644000175000017500000001351311510657150016051 0ustar renerene/* $Id: network.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // The point of this example is to show how to create a model without // using mps files. // This reads a network problem created by netgen which can be // downloaded from www.netlib.org/lp/generators/netgen // This is a generator due to Darwin Klingman #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" #include "ClpNetworkMatrix.hpp" #include #include #include int main(int argc, const char *argv[]) { int numberColumns; int numberRows; FILE * fp; if (argc > 1) { fp = fopen(argv[1], "r"); if (!fp) { fprintf(stderr, "Unable to open file %s\n", argv[1]); exit(1); } } else { fp = fopen("input.130", "r"); if (!fp) { fprintf(stderr, "Unable to open file input.l30 in Samples directory\n"); exit(1); } } int problem; char temp[100]; // read and skip fscanf(fp, "%s", temp); assert(!strcmp(temp, "BEGIN")); fscanf(fp, "%*s %*s %d %d %*s %*s %d %*s", &problem, &numberRows, &numberColumns); // scan down to SUPPLY while (fgets(temp, 100, fp)) { if (!strncmp(temp, "SUPPLY", 6)) break; } if (strncmp(temp, "SUPPLY", 6)) { fprintf(stderr, "Unable to find SUPPLY\n"); exit(2); } // get space for rhs double * lower = new double[numberRows]; double * upper = new double[numberRows]; int i; for (i = 0; i < numberRows; i++) { lower[i] = 0.0; upper[i] = 0.0; } // ***** Remember to convert to C notation while (fgets(temp, 100, fp)) { int row; int value; if (!strncmp(temp, "ARCS", 4)) break; sscanf(temp, "%d %d", &row, &value); upper[row-1] = -value; lower[row-1] = -value; } if (strncmp(temp, "ARCS", 4)) { fprintf(stderr, "Unable to find ARCS\n"); exit(2); } // number of columns may be underestimate int * head = new int[2*numberColumns]; int * tail = new int[2*numberColumns]; int * ub = new int[2*numberColumns]; int * cost = new int[2*numberColumns]; // ***** Remember to convert to C notation numberColumns = 0; while (fgets(temp, 100, fp)) { int iHead; int iTail; int iUb; int iCost; if (!strncmp(temp, "DEMAND", 6)) break; sscanf(temp, "%d %d %d %d", &iHead, &iTail, &iCost, &iUb); iHead--; iTail--; head[numberColumns] = iHead; tail[numberColumns] = iTail; ub[numberColumns] = iUb; cost[numberColumns] = iCost; numberColumns++; } if (strncmp(temp, "DEMAND", 6)) { fprintf(stderr, "Unable to find DEMAND\n"); exit(2); } // ***** Remember to convert to C notation while (fgets(temp, 100, fp)) { int row; int value; if (!strncmp(temp, "END", 3)) break; sscanf(temp, "%d %d", &row, &value); upper[row-1] = value; lower[row-1] = value; } if (strncmp(temp, "END", 3)) { fprintf(stderr, "Unable to find END\n"); exit(2); } printf("Problem %d has %d rows and %d columns\n", problem, numberRows, numberColumns); fclose(fp); ClpSimplex model; // now build model - we have rhs so build columns - two elements // per column double * objective = new double[numberColumns]; double * lowerColumn = new double[numberColumns]; double * upperColumn = new double[numberColumns]; double * element = new double [2*numberColumns]; int * start = new int[numberColumns+1]; int * row = new int[2*numberColumns]; start[numberColumns] = 2 * numberColumns; for (i = 0; i < numberColumns; i++) { start[i] = 2 * i; element[2*i] = -1.0; element[2*i+1] = 1.0; row[2*i] = head[i]; row[2*i+1] = tail[i]; lowerColumn[i] = 0.0; upperColumn[i] = ub[i]; objective[i] = cost[i]; } // Create Packed Matrix CoinPackedMatrix matrix; int * lengths = NULL; matrix.assignMatrix(true, numberRows, numberColumns, 2 * numberColumns, element, row, start, lengths); ClpNetworkMatrix network(matrix); // load model model.loadProblem(network, lowerColumn, upperColumn, objective, lower, upper); delete [] lower; delete [] upper; delete [] head; delete [] tail; delete [] ub; delete [] cost; delete [] objective; delete [] lowerColumn; delete [] upperColumn; delete [] element; delete [] start; delete [] row; /* The confusing flow below is in to exercise both dual and primal when ClpNetworkMatrix storage used. For practical use just one call e.g. model.dual(); would be used. If network then factorization scheme is changed to be much faster. Still not as fast as a real network code, but more flexible */ model.factorization()->maximumPivots(200 + model.numberRows() / 100); model.factorization()->maximumPivots(1000); //model.factorization()->maximumPivots(1); if (model.numberRows() < 50) model.messageHandler()->setLogLevel(63); model.dual(); model.setOptimizationDirection(-1); //model.messageHandler()->setLogLevel(63); model.primal(); model.setOptimizationDirection(1); model.primal(); return 0; } CoinMP-1.8.3/Clp/examples/INSTALL0000644000175000017500000000112010445377214014702 0ustar renereneThere are a number of example/test programs in this directory. Before any of these sample programs could be compiled one needs to install the COIN libraries used. This includes Clp for sure, and may include others (like Vol). Please go to the appropriate directories, read the INSTALL file there and install the libraries. The examples here can be compiled by `make DRIVER=`, where should be replaced with the name of the source file you want to compile (without the .cpp or .c). The output of the compilation is an executable named (or .exe on Windows). CoinMP-1.8.3/Clp/examples/rowColumn.cpp0000644000175000017500000001015611402524254016343 0ustar renerene/* $Id: rowColumn.cpp 1559 2010-06-05 19:42:36Z stefan $ */ /* Copyright (C) 2004, International Business Machines Corporation and others. All Rights Reserved. This sample program is designed to illustrate programming techniques using CoinLP, has not been thoroughly tested and comes without any warranty whatsoever. You may copy, modify and distribute this sample program without any restrictions whatsoever and without any payment to anyone. */ #include "ClpSimplex.hpp" #include #include int main(int argc, const char *argv[]) { ClpSimplex modelByRow, modelByColumn; // This very simple example shows how to create a model by row and by column int numberRows = 3; int numberColumns = 5; // Rim of problem is same in both cases double objective [] = {1000.0, 400.0, 500.0, 10000.0, 10000.0}; double columnLower[] = {0.0, 0.0, 0.0, 0.0, 0.0}; double columnUpper[] = {COIN_DBL_MAX, COIN_DBL_MAX, COIN_DBL_MAX, 20.0, 20.0}; double rowLower[] = {20.0, -COIN_DBL_MAX, 8.0}; double rowUpper[] = {COIN_DBL_MAX, 30.0, 8.0}; // Matrix by row int rowStart[] = {0, 5, 10, 13}; int column[] = {0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2 }; double elementByRow[] = {8.0, 5.0, 4.0, 4.0, -4.0, 8.0, 4.0, 5.0, 5.0, -5.0, 1.0, -1.0, -1.0 }; // Matrix by column int columnStart[] = {0, 3, 6, 9, 11, 13}; int row[] = {0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 0, 1 }; double elementByColumn[] = {8.0, 8.0, 1.0, 5.0, 4.0, -1.0, 4.0, 5.0, -1.0, 4.0, 5.0, -4.0, -5.0 }; int numberElements; // Do column version first as it can be done two ways // a) As one step using matrix as stored modelByColumn.loadProblem(numberColumns, numberRows, columnStart, row, elementByColumn, columnLower, columnUpper, objective, rowLower, rowUpper); // Solve modelByColumn.dual(); // check value of objective assert(fabs(modelByColumn.objectiveValue() - 76000.0) < 1.0e-7); // b) As two steps - first creating a CoinPackedMatrix // NULL for column lengths indicate they are stored without gaps // Look at CoinPackedMatrix.hpp for other ways to create a matrix numberElements = columnStart[numberColumns]; CoinPackedMatrix byColumn(true, numberRows, numberColumns, numberElements, elementByColumn, row, columnStart, NULL); // now load matrix and rim modelByColumn.loadProblem(byColumn, columnLower, columnUpper, objective, rowLower, rowUpper); // Solve modelByColumn.dual(); // check value of objective assert(fabs(modelByColumn.objectiveValue() - 76000.0) < 1.0e-7); // Now do by row // The false says row ordered so numberRows and numberColumns swapped - see CoinPackedMatrix.hpp assert(numberElements == rowStart[numberRows]); // check same number of elements in each copy CoinPackedMatrix byRow(false, numberColumns, numberRows, numberElements, elementByRow, column, rowStart, NULL); // now load matrix and rim modelByRow.loadProblem(byRow, columnLower, columnUpper, objective, rowLower, rowUpper); // Solve modelByRow.dual(); // check value of objective assert(fabs(modelByRow.objectiveValue() - 76000.0) < 1.0e-7); // write solution const double * solution = modelByRow.primalColumnSolution(); for (int i = 0; i < numberColumns; i++) { if (solution[i]) printf("Column %d has value %g\n", i, solution[i]); } modelByRow.writeMps("Tiny.mps"); return 0; } CoinMP-1.8.3/Clp/examples/testBarrier.cpp0000644000175000017500000000266011573730475016662 0ustar renerene/* $Id: testBarrier.cpp 1734 2011-06-08 17:28:29Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // @TODO the ifdef WSSMP_BARRIER currently does not work - the define is never set // best would be if one could tell ClpModel to use the wssmp factorization code, if available, without having to check for some define #include "ClpInterior.hpp" #include "ClpSimplex.hpp" #ifdef WSSMP_BARRIER #include "ClpCholeskyWssmp.hpp" #endif #include "ClpCholeskyDense.hpp" int main(int argc, const char *argv[]) { ClpInterior model; int status; if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1]); if (status) { printf("errors on input\n"); exit(77); } // ** note this does not have presolve #ifdef WSSMP_BARRIER ClpCholeskyWssmp * cholesky = new ClpCholeskyWssmp(); #else ClpCholeskyDense * cholesky = new ClpCholeskyDense(); #endif model.setCholesky(cholesky); model.primalDual(); // Do crossover ClpSimplex model2(model); // make sure no status left model2.createStatus(); model2.primal(1); return 0; } CoinMP-1.8.3/Clp/examples/defaults.cpp0000644000175000017500000003050111510657150016163 0ustar renerene/* $Id: defaults.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "ClpDualRowSteepest.hpp" #include int main(int argc, const char *argv[]) { ClpSimplex model; int status; // Keep names if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1], true); /* This driver is similar to minimum.cpp, but it sets all parameter values to their defaults. The purpose of this is to give a list of most of the methods that the end user will need. There are also some more methods as for OsiSolverInterface e.g. some loadProblem methods and deleteRows and deleteColumns. Often two methods do the same thing, one having a name I like while the other adheres to OsiSolverInterface standards */ // Use exact devex ( a variant of steepest edge) ClpPrimalColumnSteepest primalSteepest; model.setPrimalColumnPivotAlgorithm(primalSteepest); int integerValue; double value; // Infeasibility cost value = model.infeasibilityCost(); std::cout << "Default value of infeasibility cost is " << value << std::endl; model.setInfeasibilityCost(value); if (!status) { model.primal(); } // Number of rows and columns - also getNumRows, getNumCols std::string modelName; model.getStrParam(ClpProbName, modelName); std::cout << "Model " << modelName << " has " << model.numberRows() << " rows and " << model.numberColumns() << " columns" << std::endl; /* Some parameters as in OsiSolverParameters. ObjectiveLimits are not active yet. dualTolerance, setDualTolerance, primalTolerance and setPrimalTolerance may be used as well */ model.getDblParam(ClpDualObjectiveLimit, value); std::cout << "Value of ClpDualObjectiveLimit is " << value << std::endl; model.getDblParam(ClpPrimalObjectiveLimit, value); std::cout << "Value of ClpPrimalObjectiveLimit is " << value << std::endl; model.getDblParam(ClpDualTolerance, value); std::cout << "Value of ClpDualTolerance is " << value << std::endl; model.getDblParam(ClpPrimalTolerance, value); std::cout << "Value of ClpPrimalTolerance is " << value << std::endl; model.getDblParam(ClpObjOffset, value); std::cout << "Value of ClpObjOffset is " << value << std::endl; // setDblParam(ClpPrimalTolerance) is same as this model.getDblParam(ClpPrimalTolerance, value); model.setPrimalTolerance(value); model.setDualTolerance(model.dualTolerance()) ; // Other Param stuff // Can also use maximumIterations model.getIntParam(ClpMaxNumIteration, integerValue); std::cout << "Value of ClpMaxNumIteration is " << integerValue << std::endl; model.setMaximumIterations(integerValue); // Not sure this works yet model.getIntParam(ClpMaxNumIterationHotStart, integerValue); std::cout << "Value of ClpMaxNumIterationHotStart is " << integerValue << std::endl; // Can also use getIterationCount and getObjValue /* Status of problem: 0 - optimal 1 - primal infeasible 2 - dual infeasible 3 - stopped on iterations etc 4 - stopped due to errors */ std::cout << "Model status is " << model.status() << " after " << model.numberIterations() << " iterations - objective is " << model.objectiveValue() << std::endl; assert(!model.isAbandoned()); assert(model.isProvenOptimal()); assert(!model.isProvenPrimalInfeasible()); assert(!model.isProvenDualInfeasible()); assert(!model.isPrimalObjectiveLimitReached()); assert(!model.isDualObjectiveLimitReached()); assert(!model.isIterationLimitReached()); // Things to help you determine if optimal assert(model.primalFeasible()); assert(!model.numberPrimalInfeasibilities()); assert(model.sumPrimalInfeasibilities() < 1.0e-7); assert(model.dualFeasible()); assert(!model.numberDualInfeasibilities()); assert(model.sumDualInfeasibilities() < 1.0e-7); // Save warm start and set to all slack unsigned char * basis1 = model.statusCopy(); model.createStatus(); // Now create another model and do hot start ClpSimplex model2 = model; model2.copyinStatus(basis1); delete [] basis1; // Check model has not got basis (should iterate) model.dual(); // Can use getObjSense model2.setOptimizationDirection(model.optimizationDirection()); // Can use scalingFlag() to check if scaling on // But set up scaling model2.scaling(); // Could play with sparse factorization on/off model2.setSparseFactorization(model.sparseFactorization()); // Sets row pivot choice algorithm in dual ClpDualRowSteepest dualSteepest; model2.setDualRowPivotAlgorithm(dualSteepest); // Dual bound (i.e. dual infeasibility cost) value = model.dualBound(); std::cout << "Default value of dual bound is " << value << std::endl; model.setDualBound(value); // Do some deafult message handling // To see real use - see OsiOslSolverInterfaceTest.cpp CoinMessageHandler handler; model2.passInMessageHandler(& handler); model2.newLanguage(CoinMessages::us_en); //Increase level of detail model2.setLogLevel(4); // solve model2.dual(); // flip direction twice and solve model2.setOptimizationDirection(-1); model2.dual(); model2.setOptimizationDirection(1); //Decrease level of detail model2.setLogLevel(1); model2.dual(); /* Now for getting at information. This will not deal with: ClpMatrixBase * rowCopy() and ClpMatrixbase * clpMatrix() nor with double * infeasibilityRay() and double * unboundedRay() (NULL returned if none/wrong) Up to user to use delete [] on these arrays. */ /* Now to print out solution. The methods used return modifiable arrays while the alternative names return const pointers - which is of course much more virtuous */ int numberRows = model2.numberRows(); // Alternatively getRowActivity() double * rowPrimal = model2.primalRowSolution(); // Alternatively getRowPrice() double * rowDual = model2.dualRowSolution(); // Alternatively getRowLower() double * rowLower = model2.rowLower(); // Alternatively getRowUpper() double * rowUpper = model2.rowUpper(); // Alternatively getRowObjCoefficients() double * rowObjective = model2.rowObjective(); // If we have not kept names (parameter to readMps) this will be 0 assert(model2.lengthNames()); // Row names const std::vector * rowNames = model2.rowNames(); int iRow; std::cout << " Primal Dual Lower Upper (Cost)" << std::endl; for (iRow = 0; iRow < numberRows; iRow++) { double value; std::cout << std::setw(6) << iRow << " " << std::setw(8) << (*rowNames)[iRow]; value = rowPrimal[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowDual[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowLower[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowUpper[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; if (rowObjective) { value = rowObjective[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; } std::cout << std::endl; } std::cout << "--------------------------------------" << std::endl; // Columns int numberColumns = model2.numberColumns(); // Alternatively getColSolution() double * columnPrimal = model2.primalColumnSolution(); // Alternatively getReducedCost() double * columnDual = model2.dualColumnSolution(); // Alternatively getColLower() double * columnLower = model2.columnLower(); // Alternatively getColUpper() double * columnUpper = model2.columnUpper(); // Alternatively getObjCoefficients() double * columnObjective = model2.objective(); // If we have not kept names (parameter to readMps) this will be 0 assert(model2.lengthNames()); // Column names const std::vector * columnNames = model2.columnNames(); int iColumn; std::cout << " Primal Dual Lower Upper Cost" << std::endl; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value; std::cout << std::setw(6) << iColumn << " " << std::setw(8) << (*columnNames)[iColumn]; value = columnPrimal[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnDual[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnLower[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnUpper[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnObjective[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; std::cout << std::endl; } std::cout << "--------------------------------------" << std::endl; std::cout << std::resetiosflags(std::ios::fixed | std::ios::showpoint | std::ios::scientific); // Now matrix CoinPackedMatrix * matrix = model2.matrix(); const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const int * start = matrix->getVectorStarts(); const int * length = matrix->getVectorLengths(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { std::cout << "Column " << iColumn; int j; for (j = start[iColumn]; j < start[iColumn] + length[iColumn]; j++) std::cout << " ( " << row[j] << ", " << element[j] << ")"; std::cout << std::endl; } return 0; } CoinMP-1.8.3/Clp/examples/testQP.cpp0000644000175000017500000001724412246362226015611 0ustar renerene/* $Id: testQP.cpp 2001 2013-11-30 13:13:58Z stefan $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinMpsIO.hpp" #include "ClpInterior.hpp" #include "ClpSimplex.hpp" #include "ClpCholeskyBase.hpp" #include "ClpQuadraticObjective.hpp" #include int main(int argc, const char *argv[]) { /* Read quadratic model in two stages to test loadQuadraticObjective. And is also possible to just read into ClpSimplex/Interior which sets it all up in one go. But this is only if it is in QUADOBJ format. If no arguments does share2qp using ClpInterior (also creates quad.mps which is in QUADOBJ format) If one argument uses simplex e.g. testit quad.mps If > one uses barrier via ClpSimplex input and then ClpInterior borrow */ if (argc < 2) { CoinMpsIO m; #if defined(SAMPLEDIR) int status = m.readMps(SAMPLEDIR "/share2qp", "mps"); if (status) { printf("errors on input\n"); exit(77); } #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif ClpInterior model; model.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); // get quadratic part int * start = NULL; int * column = NULL; double * element = NULL; m.readQuadraticMps(NULL, start, column, element, 2); int j; for (j = 0; j < 79; j++) { if (start[j] < start[j+1]) { int i; printf("Column %d ", j); for (i = start[j]; i < start[j+1]; i++) { printf("( %d, %g) ", column[i], element[i]); } printf("\n"); } } model.loadQuadraticObjective(model.numberColumns(), start, column, element); // share2qp is in old style qp format - convert to new so other options can use model.writeMps("quad.mps"); ClpCholeskyBase * cholesky = new ClpCholeskyBase(); cholesky->setKKT(true); model.setCholesky(cholesky); model.primalDual(); double *primal; double *dual; primal = model.primalColumnSolution(); dual = model.dualRowSolution(); int i; int numberColumns = model.numberColumns(); int numberRows = model.numberRows(); for (i = 0; i < numberColumns; i++) { if (fabs(primal[i]) > 1.0e-8) printf("%d primal %g\n", i, primal[i]); } for (i = 0; i < numberRows; i++) { if (fabs(dual[i]) > 1.0e-8) printf("%d dual %g\n", i, dual[i]); } } else { // Could read into ClpInterior ClpSimplex model; if (model.readMps(argv[1])) { printf("errors on input\n"); exit(77); } model.writeMps("quad"); if (argc < 3) { // simplex - just primal as dual does not work // also I need to fix scaling of duals on output // (Was okay in first place - can't mix and match scaling techniques) // model.scaling(0); model.primal(); } else { // barrier ClpInterior barrier; barrier.borrowModel(model); ClpCholeskyBase * cholesky = new ClpCholeskyBase(); cholesky->setKKT(true); barrier.setCholesky(cholesky); barrier.primalDual(); barrier.returnModel(model); } // Just check if share2qp (quad.mps here) // this is because I am not checking if variables at ub if (model.numberColumns() == 79) { double *primal; double *dual; primal = model.primalColumnSolution(); dual = model.dualRowSolution(); // Check duals by hand const ClpQuadraticObjective * quadraticObj = (dynamic_cast(model.objectiveAsObject())); assert(quadraticObj); CoinPackedMatrix * quad = quadraticObj->quadraticObjective(); const int * columnQuadratic = quad->getIndices(); const CoinBigIndex * columnQuadraticStart = quad->getVectorStarts(); const int * columnQuadraticLength = quad->getVectorLengths(); const double * quadraticElement = quad->getElements(); int numberColumns = model.numberColumns(); int numberRows = model.numberRows(); double * gradient = new double [numberColumns]; // move linear objective memcpy(gradient, quadraticObj->linearObjective(), numberColumns * sizeof(double)); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double valueI = primal[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = primal[jColumn]; double elementValue = quadraticElement[j]; if (iColumn != jColumn) { double gradientI = valueJ * elementValue; double gradientJ = valueI * elementValue; gradient[iColumn] += gradientI; gradient[jColumn] += gradientJ; } else { double gradientI = valueI * elementValue; gradient[iColumn] += gradientI; } } if (fabs(primal[iColumn]) > 1.0e-8) printf("%d primal %g\n", iColumn, primal[iColumn]); } for (int i = 0; i < numberRows; i++) { if (fabs(dual[i]) > 1.0e-8) printf("%d dual %g\n", i, dual[i]); } // Now use duals to get reduced costs // Can't use this as will try and use scaling // model.transposeTimes(-1.0,dual,gradient); // So ... CoinPackedMatrix * matrix = model.matrix(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * element = matrix->getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { double dj = gradient[iColumn]; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int jRow = row[j]; dj -= element[j] * dual[jRow]; } if (model.getColumnStatus(iColumn) == ClpSimplex::basic) { assert(fabs(dj) < 1.0e-5); } else { assert(dj > -1.0e-5); } } delete [] gradient; } } return 0; } CoinMP-1.8.3/Clp/examples/addRows.cpp0000644000175000017500000002731212130613567015770 0ustar renerene/* $Id: addRows.cpp 1935 2013-04-08 19:16:07Z stefan $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // This is a simple example to create a model by row #include "ClpSimplex.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "CoinBuild.hpp" #include "CoinModel.hpp" #include #include int main(int argc, const char *argv[]) { try { // Empty model ClpSimplex model; // Objective - just nonzeros int objIndex[] = {0, 2}; double objValue[] = {1.0, 4.0}; // Upper bounds - as dense vector double upper[] = {2.0, COIN_DBL_MAX, 4.0}; // Create space for 3 columns model.resize(0, 3); // Fill in int i; // Virtuous way // First objective for (i = 0; i < 2; i++) model.setObjectiveCoefficient(objIndex[i], objValue[i]); // Now bounds (lower will be zero by default but do again) for (i = 0; i < 3; i++) { model.setColumnLower(i, 0.0); model.setColumnUpper(i, upper[i]); } /* We could also have done in non-virtuous way e.g. double * objective = model.objective(); and then set directly */ // Faster to add rows all at once - but this is easier to show // Now add row 1 as >= 2.0 int row1Index[] = {0, 2}; double row1Value[] = {1.0, 1.0}; model.addRow(2, row1Index, row1Value, 2.0, COIN_DBL_MAX); // Now add row 2 as == 1.0 int row2Index[] = {0, 1, 2}; double row2Value[] = {1.0, -5.0, 1.0}; model.addRow(3, row2Index, row2Value, 1.0, 1.0); // solve model.dual(); /* Adding one row at a time has a significant overhead so let's try a more complicated but faster way First time adding in 10000 rows one by one */ model.allSlackBasis(); ClpSimplex modelSave = model; double time1 = CoinCpuTime(); int k; for (k = 0; k < 10000; k++) { int row2Index[] = {0, 1, 2}; double row2Value[] = {1.0, -5.0, 1.0}; model.addRow(3, row2Index, row2Value, 1.0, 1.0); } printf("Time for 10000 addRow is %g\n", CoinCpuTime() - time1); model.dual(); model = modelSave; // Now use build CoinBuild buildObject; time1 = CoinCpuTime(); for (k = 0; k < 10000; k++) { int row2Index[] = {0, 1, 2}; double row2Value[] = {1.0, -5.0, 1.0}; buildObject.addRow(3, row2Index, row2Value, 1.0, 1.0); } model.addRows(buildObject); printf("Time for 10000 addRow using CoinBuild is %g\n", CoinCpuTime() - time1); model.dual(); model = modelSave; int del[] = {0, 1, 2}; model.deleteRows(2, del); // Now use build +-1 CoinBuild buildObject2; time1 = CoinCpuTime(); for (k = 0; k < 10000; k++) { int row2Index[] = {0, 1, 2}; double row2Value[] = {1.0, -1.0, 1.0}; buildObject2.addRow(3, row2Index, row2Value, 1.0, 1.0); } model.addRows(buildObject2, true); printf("Time for 10000 addRow using CoinBuild+-1 is %g\n", CoinCpuTime() - time1); model.dual(); model = modelSave; model.deleteRows(2, del); // Now use build +-1 CoinModel modelObject2; time1 = CoinCpuTime(); for (k = 0; k < 10000; k++) { int row2Index[] = {0, 1, 2}; double row2Value[] = {1.0, -1.0, 1.0}; modelObject2.addRow(3, row2Index, row2Value, 1.0, 1.0); } model.addRows(modelObject2, true); printf("Time for 10000 addRow using CoinModel+-1 is %g\n", CoinCpuTime() - time1); model.dual(); model = ClpSimplex(); // Now use build +-1 CoinModel modelObject3; time1 = CoinCpuTime(); for (k = 0; k < 10000; k++) { int row2Index[] = {0, 1, 2}; double row2Value[] = {1.0, -1.0, 1.0}; modelObject3.addRow(3, row2Index, row2Value, 1.0, 1.0); } model.loadProblem(modelObject3, true); printf("Time for 10000 addRow using CoinModel load +-1 is %g\n", CoinCpuTime() - time1); model.writeMps("xx.mps"); model.dual(); model = modelSave; // Now use model CoinModel modelObject; time1 = CoinCpuTime(); for (k = 0; k < 10000; k++) { int row2Index[] = {0, 1, 2}; double row2Value[] = {1.0, -5.0, 1.0}; modelObject.addRow(3, row2Index, row2Value, 1.0, 1.0); } model.addRows(modelObject); printf("Time for 10000 addRow using CoinModel is %g\n", CoinCpuTime() - time1); model.dual(); model.writeMps("b.mps"); // Method using least memory - but most complicated time1 = CoinCpuTime(); // Assumes we know exact size of model and matrix // Empty model ClpSimplex model2; { // Create space for 3 columns and 10000 rows int numberRows = 10000; int numberColumns = 3; // This is fully dense - but would not normally be so int numberElements = numberRows * numberColumns; // Arrays will be set to default values model2.resize(numberRows, numberColumns); double * elements = new double [numberElements]; CoinBigIndex * starts = new CoinBigIndex [numberColumns+1]; int * rows = new int [numberElements];; int * lengths = new int[numberColumns]; // Now fill in - totally unsafe but .... // no need as defaults to 0.0 double * columnLower = model2.columnLower(); double * columnUpper = model2.columnUpper(); double * objective = model2.objective(); double * rowLower = model2.rowLower(); double * rowUpper = model2.rowUpper(); // Columns - objective was packed for (k = 0; k < 2; k++) { int iColumn = objIndex[k]; objective[iColumn] = objValue[k]; } for (k = 0; k < numberColumns; k++) columnUpper[k] = upper[k]; // Rows for (k = 0; k < numberRows; k++) { rowLower[k] = 1.0; rowUpper[k] = 1.0; } // Now elements double row2Value[] = {1.0, -5.0, 1.0}; CoinBigIndex put = 0; for (k = 0; k < numberColumns; k++) { starts[k] = put; lengths[k] = numberRows; double value = row2Value[k]; for (int i = 0; i < numberRows; i++) { rows[put] = i; elements[put] = value; put++; } } starts[numberColumns] = put; // assign to matrix CoinPackedMatrix * matrix = new CoinPackedMatrix(true, 0.0, 0.0); matrix->assignMatrix(true, numberRows, numberColumns, numberElements, elements, rows, starts, lengths); ClpPackedMatrix * clpMatrix = new ClpPackedMatrix(matrix); model2.replaceMatrix(clpMatrix, true); printf("Time for 10000 addRow using hand written code is %g\n", CoinCpuTime() - time1); // If matrix is really big could switch off creation of row copy // model2.setSpecialOptions(256); } model2.dual(); model2.writeMps("a.mps"); // Print column solution int numberColumns = model.numberColumns(); // Alternatively getColSolution() double * columnPrimal = model.primalColumnSolution(); // Alternatively getReducedCost() double * columnDual = model.dualColumnSolution(); // Alternatively getColLower() double * columnLower = model.columnLower(); // Alternatively getColUpper() double * columnUpper = model.columnUpper(); // Alternatively getObjCoefficients() double * columnObjective = model.objective(); int iColumn; std::cout << " Primal Dual Lower Upper Cost" << std::endl; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value; std::cout << std::setw(6) << iColumn << " "; value = columnPrimal[iColumn]; if (fabs(value) < 1.0e5) std::cout << setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnDual[iColumn]; if (fabs(value) < 1.0e5) std::cout << setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnLower[iColumn]; if (fabs(value) < 1.0e5) std::cout << setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnUpper[iColumn]; if (fabs(value) < 1.0e5) std::cout << setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnObjective[iColumn]; if (fabs(value) < 1.0e5) std::cout << setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << setiosflags(std::ios::scientific) << std::setw(14) << value; std::cout << std::endl; } std::cout << "--------------------------------------" << std::endl; // Test CoinAssert std::cout << "If Clp compiled without NDEBUG below should give assert, if with NDEBUG or COIN_ASSERT CoinError" << std::endl; model = modelSave; model.deleteRows(2, del); // Deliberate error model.deleteColumns(1, del + 2); // Now use build +-1 CoinBuild buildObject3; time1 = CoinCpuTime(); for (k = 0; k < 10000; k++) { int row2Index[] = {0, 1, 2}; double row2Value[] = {1.0, -1.0, 1.0}; buildObject3.addRow(3, row2Index, row2Value, 1.0, 1.0); } model.addRows(buildObject3, true); } catch (CoinError e) { e.print(); if (e.lineNumber() >= 0) std::cout << "This was from a CoinAssert" << std::endl; } return 0; } CoinMP-1.8.3/Clp/examples/testBasis.cpp0000644000175000017500000000651011510657150016320 0ustar renerene/* $Id: testBasis.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "CoinHelperFunctions.hpp" #include #include int main(int argc, const char *argv[]) { ClpSimplex model; int status; // Keep names if (argc < 2) { status = model.readMps("small.mps", true); } else { status = model.readMps(argv[1], true); } if (status) exit(10); /* This driver turns a problem into all equalities, solves it and then creates optimal basis. */ // copy of original ClpSimplex model2(model); // And another ClpSimplex model3(model); int originalNumberColumns = model.numberColumns(); int numberRows = model.numberRows(); int * addStarts = new int [numberRows+1]; int * addRow = new int[numberRows]; double * addElement = new double[numberRows]; double * newUpper = new double[numberRows]; double * newLower = new double[numberRows]; double * lower = model2.rowLower(); double * upper = model2.rowUpper(); int iRow; // Simplest is to change all rhs to zero // One should skip E rows but this is simpler coding for (iRow = 0; iRow < numberRows; iRow++) { newUpper[iRow] = upper[iRow]; upper[iRow] = 0.0; newLower[iRow] = lower[iRow]; lower[iRow] = 0.0; addRow[iRow] = iRow; addElement[iRow] = -1.0; addStarts[iRow] = iRow; } addStarts[numberRows] = numberRows; model2.addColumns(numberRows, newLower, newUpper, NULL, addStarts, addRow, addElement); delete [] addStarts; delete [] addRow; delete [] addElement; delete [] newLower; delete [] newUpper; // Modify costs double * randomArray = new double[numberRows]; for (iRow = 0; iRow < numberRows; iRow++) randomArray[iRow] = CoinDrand48(); model2.transposeTimes(1.0, randomArray, model2.objective()); delete [] randomArray; // solve model2.primal(); // first check okay if solution values back memcpy(model.primalColumnSolution(), model2.primalColumnSolution(), originalNumberColumns * sizeof(double)); memcpy(model.primalRowSolution(), model2.primalRowSolution(), numberRows * sizeof(double)); int iColumn; for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) model.setColumnStatus(iColumn, model2.getColumnStatus(iColumn)); for (iRow = 0; iRow < numberRows; iRow++) { if (model2.getRowStatus(iRow) == ClpSimplex::basic) { model.setRowStatus(iRow, ClpSimplex::basic); } else { model.setRowStatus(iRow, model2.getColumnStatus(iRow + originalNumberColumns)); } } model.primal(0); // and now without solution values for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) model3.setColumnStatus(iColumn, model2.getColumnStatus(iColumn)); for (iRow = 0; iRow < numberRows; iRow++) model3.setRowStatus(iRow, model2.getColumnStatus(iRow + originalNumberColumns)); model3.primal(0); return 0; } CoinMP-1.8.3/Clp/examples/hello.mps0000644000175000017500000003024210057415246015501 0ustar renereneNAME Hello ROWS N OBJROW L R0000000 L R0000001 L R0000002 L R0000003 L R0000004 L R0000005 L R0000006 L R0000007 L R0000008 L R0000009 L R0000010 L R0000011 L R0000012 L R0000013 L R0000014 L R0000015 L R0000016 L R0000017 L R0000018 L R0000019 L R0000020 COLUMNS C0000000 OBJROW 1. R0000000 1. C0000000 R0000001 1. R0000002 1. C0000000 R0000003 1. R0000004 1. C0000000 R0000005 1. R0000006 1. C0000000 R0000007 1. R0000008 1. C0000000 R0000011 1. R0000012 1. C0000000 R0000013 1. R0000014 1. C0000000 R0000015 1. R0000016 1. C0000000 R0000017 1. C0000001 OBJROW 1. R0000004 1. C0000001 R0000018 1. C0000002 OBJROW 1. R0000004 1. C0000002 R0000019 1. C0000003 OBJROW 1. R0000004 1. C0000003 R0000018 1. C0000004 OBJROW 1. R0000004 1. C0000004 R0000017 1. C0000005 OBJROW 1. R0000004 1. C0000005 R0000018 1. C0000006 OBJROW 1. R0000004 1. C0000006 R0000019 1. C0000007 OBJROW 1. R0000004 1. C0000007 R0000018 1. C0000008 OBJROW 1. R0000000 1. C0000008 R0000001 1. R0000002 1. C0000008 R0000003 1. R0000004 1. C0000008 R0000005 1. R0000006 1. C0000008 R0000007 1. R0000008 1. C0000008 R0000011 1. R0000012 1. C0000008 R0000013 1. R0000014 1. C0000008 R0000015 1. R0000016 1. C0000008 R0000017 1. C0000009 OBJROW 1. C0000010 OBJROW 1. C0000011 OBJROW 1. R0000000 1. C0000011 R0000001 1. R0000002 1. C0000011 R0000003 1. R0000004 1. C0000011 R0000005 1. R0000006 1. C0000011 R0000007 1. R0000008 1. C0000011 R0000013 1. R0000014 1. C0000011 R0000015 1. R0000016 1. C0000011 R0000017 1. C0000012 OBJROW 1. R0000000 1. C0000012 R0000004 1. R0000008 1. C0000012 R0000012 1. R0000018 1. C0000013 OBJROW 1. R0000000 1. C0000013 R0000004 1. R0000008 1. C0000013 R0000011 1. R0000019 1. C0000014 OBJROW 1. R0000000 1. C0000014 R0000004 1. R0000008 1. C0000014 R0000011 1. R0000019 1. C0000015 OBJROW 1. R0000000 1. C0000015 R0000004 1. R0000008 1. C0000015 R0000011 1. R0000019 1. C0000016 OBJROW 1. R0000000 1. C0000016 R0000004 1. R0000008 1. C0000016 R0000011 1. R0000019 1. C0000017 OBJROW 1. R0000000 1. C0000017 R0000008 1. R0000011 1. C0000017 R0000019 1. C0000018 OBJROW 1. R0000000 1. C0000018 R0000008 1. R0000012 1. C0000018 R0000018 1. C0000019 OBJROW 1. R0000000 1. C0000019 R0000008 1. R0000013 1. C0000019 R0000014 1. R0000015 1. C0000019 R0000016 1. R0000017 1. C0000020 OBJROW 1. C0000021 OBJROW 1. C0000022 OBJROW 1. R0000000 1. C0000022 R0000001 1. R0000002 1. C0000022 R0000003 1. R0000004 1. C0000022 R0000005 1. R0000006 1. C0000022 R0000007 1. R0000008 1. C0000022 R0000011 1. R0000012 1. C0000022 R0000013 1. R0000014 1. C0000022 R0000015 1. R0000016 1. C0000022 R0000017 1. R0000018 1. C0000022 R0000019 1. C0000023 OBJROW 1. R0000008 1. C0000023 R0000011 1. R0000015 1. C0000024 OBJROW 1. R0000008 1. C0000024 R0000011 1. R0000015 1. C0000025 OBJROW 1. R0000008 1. C0000025 R0000011 1. R0000015 1. C0000025 R0000016 1. C0000026 OBJROW 1. R0000008 1. C0000026 R0000011 1. R0000015 1. C0000026 R0000017 1. C0000027 OBJROW 1. R0000008 1. C0000027 R0000012 1. R0000014 1. C0000027 R0000018 1. C0000028 OBJROW 1. R0000008 1. C0000028 R0000013 1. R0000014 1. C0000028 R0000019 1. C0000029 OBJROW 1. R0000008 1. C0000030 OBJROW 1. R0000008 1. C0000031 OBJROW 1. C0000032 OBJROW 1. C0000033 OBJROW 1. R0000000 1. C0000033 R0000001 1. R0000002 1. C0000033 R0000003 1. R0000004 1. C0000033 R0000005 1. R0000006 1. C0000033 R0000007 1. R0000008 1. C0000033 R0000011 1. R0000012 1. C0000033 R0000013 1. R0000014 1. C0000033 R0000015 1. R0000016 1. C0000033 R0000017 1. R0000018 1. C0000033 R0000019 1. C0000034 OBJROW 1. R0000008 1. C0000034 R0000019 1. C0000035 OBJROW 1. R0000008 1. C0000035 R0000019 1. C0000036 OBJROW 1. R0000008 1. C0000036 R0000019 1. C0000037 OBJROW 1. R0000008 1. C0000037 R0000019 1. C0000038 OBJROW 1. R0000008 1. C0000038 R0000019 1. C0000039 OBJROW 1. R0000008 1. C0000039 R0000019 1. C0000040 OBJROW 1. R0000008 1. C0000040 R0000019 1. C0000041 OBJROW 1. R0000008 1. C0000041 R0000019 1. C0000042 OBJROW 1. C0000043 OBJROW 1. C0000044 OBJROW 1. R0000002 1. C0000044 R0000003 1. R0000004 1. C0000044 R0000005 1. R0000006 1. C0000044 R0000011 1. R0000012 1. C0000044 R0000013 1. R0000014 1. C0000044 R0000015 1. R0000016 1. C0000044 R0000017 1. R0000018 1. C0000044 R0000019 1. C0000045 OBJROW 1. R0000001 1. C0000045 R0000007 1. R0000011 1. C0000045 R0000019 1. C0000046 OBJROW 1. R0000000 1. C0000046 R0000008 1. R0000011 1. C0000046 R0000019 1. C0000047 OBJROW 1. R0000000 1. C0000047 R0000008 1. R0000011 1. C0000047 R0000019 1. C0000048 OBJROW 1. R0000000 1. C0000048 R0000008 1. R0000011 1. C0000048 R0000019 1. C0000049 OBJROW 1. R0000000 1. C0000049 R0000008 1. R0000012 1. C0000049 R0000018 1. C0000050 OBJROW 1. R0000000 1. C0000050 R0000008 1. R0000013 1. C0000050 R0000017 1. C0000051 OBJROW 1. R0000001 1. C0000051 R0000007 1. R0000014 1. C0000051 R0000015 1. R0000016 1. C0000052 OBJROW 1. R0000002 1. C0000052 R0000003 1. R0000004 1. C0000052 R0000005 1. R0000006 1. RHS RHS R0000000 1. R0000001 1. RHS R0000002 1. R0000003 1. RHS R0000004 1. R0000005 1. RHS R0000006 1. R0000007 1. RHS R0000008 1. R0000009 1. RHS R0000010 1. R0000011 1. RHS R0000012 1. R0000013 1. RHS R0000014 1. R0000015 1. RHS R0000016 1. R0000017 1. RHS R0000018 1. R0000019 1. RHS R0000020 1. RANGES RANGE R0000000 1. R0000001 1. RANGE R0000002 1. R0000003 1. RANGE R0000004 1. R0000005 1. RANGE R0000006 1. R0000007 1. RANGE R0000008 1. R0000009 1. RANGE R0000010 1. R0000011 1. RANGE R0000012 1. R0000013 1. RANGE R0000014 1. R0000015 1. RANGE R0000016 1. R0000017 1. RANGE R0000018 1. R0000019 1. RANGE R0000020 1. BOUNDS UP BOUND C0000000 1. UP BOUND C0000001 1. UP BOUND C0000002 1. UP BOUND C0000003 1. UP BOUND C0000004 1. UP BOUND C0000005 1. UP BOUND C0000006 1. UP BOUND C0000007 1. UP BOUND C0000008 1. UP BOUND C0000009 1. UP BOUND C0000010 1. UP BOUND C0000011 1. UP BOUND C0000012 1. UP BOUND C0000013 1. UP BOUND C0000014 1. UP BOUND C0000015 1. UP BOUND C0000016 1. UP BOUND C0000017 1. UP BOUND C0000018 1. UP BOUND C0000019 1. UP BOUND C0000020 1. UP BOUND C0000021 1. UP BOUND C0000022 1. UP BOUND C0000023 1. UP BOUND C0000024 1. UP BOUND C0000025 1. UP BOUND C0000026 1. UP BOUND C0000027 1. UP BOUND C0000028 1. UP BOUND C0000029 1. UP BOUND C0000030 1. UP BOUND C0000031 1. UP BOUND C0000032 1. UP BOUND C0000033 1. UP BOUND C0000034 1. UP BOUND C0000035 1. UP BOUND C0000036 1. UP BOUND C0000037 1. UP BOUND C0000038 1. UP BOUND C0000039 1. UP BOUND C0000040 1. UP BOUND C0000041 1. UP BOUND C0000042 1. UP BOUND C0000043 1. UP BOUND C0000044 1. UP BOUND C0000045 1. UP BOUND C0000046 1. UP BOUND C0000047 1. UP BOUND C0000048 1. UP BOUND C0000049 1. UP BOUND C0000050 1. UP BOUND C0000051 1. UP BOUND C0000052 1. ENDATA CoinMP-1.8.3/Clp/examples/ekk.cpp0000644000175000017500000001357111510657150015136 0ustar renerene/* $Id: ekk.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* This can be used to compare OSL and Clp. The interface functions below (in ekk_interface.cpp) were written so that calls to osl in the middle of complex algorithms could easily be swapped for Clp code. This was to stress test Clp (and Osl :-)). With the addition of ekk_crash it may be used to see if we need a crash in Clp. With "both" set it can also be used to see which gives better behavior after postSolve. However they may be useful as sample code. Virtuous people would add return code checking. This main could just as easily be C code. */ #include "ekk_c_api.h" // These interface functions are needed // Note - This example wastes memory as it has several copies of matrix /* As ekk_primalSimplex + postsolve instructions: presolve - 0 , no presolve, 1 presolve but no primal after postsolve, 2 do primal if any infeasibilities, 3 always do primal. */ extern "C" int ekk_primalClp(EKKModel * model, int startup, int presolve); /* As ekk_dualSimplex + postsolve instructions: presolve - 0 , no presolve, 1 presolve but no primal after postsolve, 2 do primal if any infeasibilities, 3 always do primal. */ extern "C" int ekk_dualClp(EKKModel * model, int presolve); /* rather like ekk_preSolve (3) plus: keepIntegers - false to treat as if continuous pass - do this many passes (0==default(5)) returns 1 if infeasible */ extern "C" int ekk_preSolveClp(EKKModel * model, bool keepIntegers, int pass); #include "ClpSimplex.hpp" #include #include int main(int argc, const char *argv[]) { const char * name; // problem is actually scaled for osl, dynamically for clp (slows clp) // default is primal, no presolve, minimise and use clp bool primal = true, presolve = false; int useosl = 0; bool freeFormat = false; bool exportIt = false; EKKModel * model; EKKContext * context; if (argc > 1) { name = argv[1]; } else { #if defined(SAMPLEDIR) name = (SAMPLEDIR "/p0033.mps"; #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } /* initialize OSL environment */ context = ekk_initializeContext(); model = ekk_newModel(context, ""); int i; printf("*** Options "); for (i = 2; i < argc; i++) { printf("%s ", argv[i]); } printf("\n"); // see if free format needed for (i = 2; i < argc; i++) { if (!strncmp(argv[i], "free", 4)) { freeFormat = true; } } // create model from MPS file if (!freeFormat) { ekk_importModel(model, name); } else { ekk_importModelFree(model, name); } // other options for (i = 2; i < argc; i++) { if (!strncmp(argv[i], "max", 3)) { if (!strncmp(argv[i], "max2", 4)) { // This is for testing - it just reverses signs and maximizes int i, n = ekk_getInumcols(model); double * objective = ekk_getObjective(model); for (i = 0; i < n; i++) { objective[i] = -objective[i]; } ekk_setObjective(model, objective); ekk_setMaximize(model); } else { // maximize ekk_setMaximize(model); } } if (!strncmp(argv[i], "dual", 4)) { primal = false; } if (!strncmp(argv[i], "presol", 6)) { presolve = true; } if (!strncmp(argv[i], "osl", 3)) { useosl = 1; } if (!strncmp(argv[i], "both", 4)) { useosl = 2; } if (!strncmp(argv[i], "export", 6)) { exportIt = true; } } if (useosl) { // OSL if (presolve) ekk_preSolve(model, 3, NULL); ekk_scale(model); if (primal) ekk_primalSimplex(model, 1); else ekk_dualSimplex(model); if (presolve) { ekk_postSolve(model, NULL); ekk_primalSimplex(model, 3); } if (useosl == 2) ekk_allSlackBasis(model); // otherwise it would be easy } if ((useosl & 2) == 0) { // CLP if (presolve) ekk_preSolveClp(model, true, 5); /* 3 is because it is ignored if no presolve, and we are forcing Clp to re-optimize */ if (primal) ekk_primalClp(model, 1, 3); else ekk_dualClp(model, 3); } if (exportIt) { ClpSimplex * clp = new ClpSimplex();; int numberRows = ekk_getInumrows(model); int numberColumns = ekk_getInumcols(model); clp->loadProblem(numberColumns, numberRows, ekk_blockColumn(model, 0), ekk_blockRow(model, 0), ekk_blockElement(model, 0), ekk_collower(model), ekk_colupper(model), ekk_objective(model), ekk_rowlower(model), ekk_rowupper(model)); // Do integer stuff int * which = ekk_listOfIntegers(model); int numberIntegers = ekk_getInumints(model); for (int i = 0; i < numberIntegers; i++) clp->setInteger(which[i]); ekk_free(which); clp->writeMps("try1.mps"); delete clp; } ekk_deleteModel(model); ekk_endContext(context); return 0; } CoinMP-1.8.3/Clp/examples/decompose.cpp0000644000175000017500000005453611510657150016350 0ustar renerene/* $Id: decompose.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "CoinMpsIO.hpp" #include int main(int argc, const char *argv[]) { ClpSimplex model; int status; // Keep names if (argc < 2) { #if defined(NETLIBDIR) status = model.readMps(NETLIBDIR "/czprob.mps", true); #else fprintf(stderr, "Do not know where to find netlib MPS files.\n"); return 1; #endif } else { status = model.readMps(argv[1], true); } if (status) exit(10); /* This driver does a simple Dantzig Wolfe decomposition */ // Get master rows in some mysterious way int numberRows = model.numberRows(); int * rowBlock = new int[numberRows]; int iRow; for (iRow = 0; iRow < numberRows; iRow++) rowBlock[iRow] = -2; // these are master rows if (numberRows == 105127) { // ken-18 for (iRow = 104976; iRow < numberRows; iRow++) rowBlock[iRow] = -1; } else if (numberRows == 2426) { // ken-7 for (iRow = 2401; iRow < numberRows; iRow++) rowBlock[iRow] = -1; } else if (numberRows == 810) { for (iRow = 81; iRow < 84; iRow++) rowBlock[iRow] = -1; } else if (numberRows == 5418) { for (iRow = 564; iRow < 603; iRow++) rowBlock[iRow] = -1; } else if (numberRows == 10280) { // osa-60 for (iRow = 10198; iRow < 10280; iRow++) rowBlock[iRow] = -1; } else if (numberRows == 1503) { // degen3 for (iRow = 0; iRow < 561; iRow++) rowBlock[iRow] = -1; } else if (numberRows == 929) { // czprob for (iRow = 0; iRow < 39; iRow++) rowBlock[iRow] = -1; } CoinPackedMatrix * matrix = model.matrix(); // get row copy CoinPackedMatrix rowCopy = *matrix; rowCopy.reverseOrdering(); const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); //const double * elementByColumn = matrix->getElements(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); //const double * elementByRow = rowCopy.getElements(); int numberBlocks = 0; int * stack = new int [numberRows]; // to say if column looked at int numberColumns = model.numberColumns(); int * columnBlock = new int[numberColumns]; int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) columnBlock[iColumn] = -2; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int kstart = columnStart[iColumn]; int kend = columnStart[iColumn] + columnLength[iColumn]; if (columnBlock[iColumn] == -2) { // column not allocated int j; int nstack = 0; for (j = kstart; j < kend; j++) { int iRow = row[j]; if (rowBlock[iRow] != -1) { assert(rowBlock[iRow] == -2); rowBlock[iRow] = numberBlocks; // mark stack[nstack++] = iRow; } } if (nstack) { // new block - put all connected in numberBlocks++; columnBlock[iColumn] = numberBlocks - 1; while (nstack) { int iRow = stack[--nstack]; int k; for (k = rowStart[iRow]; k < rowStart[iRow] + rowLength[iRow]; k++) { int iColumn = column[k]; int kkstart = columnStart[iColumn]; int kkend = kkstart + columnLength[iColumn]; if (columnBlock[iColumn] == -2) { columnBlock[iColumn] = numberBlocks - 1; // mark // column not allocated int jj; for (jj = kkstart; jj < kkend; jj++) { int jRow = row[jj]; if (rowBlock[jRow] == -2) { rowBlock[jRow] = numberBlocks - 1; stack[nstack++] = jRow; } } } else { assert(columnBlock[iColumn] == numberBlocks - 1); } } } } else { // Only in master columnBlock[iColumn] = -1; } } } printf("%d blocks found\n", numberBlocks); if (numberBlocks > 50) { int iBlock; for (iRow = 0; iRow < numberRows; iRow++) { iBlock = rowBlock[iRow]; if (iBlock >= 0) rowBlock[iRow] = iBlock % 50; } for (iColumn = 0; iColumn < numberColumns; iColumn++) { iBlock = columnBlock[iColumn]; if (iBlock >= 0) columnBlock[iColumn] = iBlock % 50; } numberBlocks = 50; } delete [] stack; // make up problems CoinPackedMatrix * top = new CoinPackedMatrix [numberBlocks]; ClpSimplex * sub = new ClpSimplex [numberBlocks]; ClpSimplex master; // Create all sub problems // Could do much faster - but do that later int * whichRow = new int [numberRows]; int * whichColumn = new int [numberColumns]; // get top matrix CoinPackedMatrix topMatrix = *model.matrix(); int numberRow2, numberColumn2; numberRow2 = 0; for (iRow = 0; iRow < numberRows; iRow++) if (rowBlock[iRow] >= 0) whichRow[numberRow2++] = iRow; topMatrix.deleteRows(numberRow2, whichRow); int iBlock; for (iBlock = 0; iBlock < numberBlocks; iBlock++) { numberRow2 = 0; numberColumn2 = 0; for (iRow = 0; iRow < numberRows; iRow++) if (iBlock == rowBlock[iRow]) whichRow[numberRow2++] = iRow; for (iColumn = 0; iColumn < numberColumns; iColumn++) if (iBlock == columnBlock[iColumn]) whichColumn[numberColumn2++] = iColumn; sub[iBlock] = ClpSimplex(&model, numberRow2, whichRow, numberColumn2, whichColumn); #if 0 // temp double * upper = sub[iBlock].columnUpper(); for (iColumn = 0; iColumn < numberColumn2; iColumn++) upper[iColumn] = 100.0; #endif // and top matrix CoinPackedMatrix matrix = topMatrix; // and delete bits numberColumn2 = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) if (iBlock != columnBlock[iColumn]) whichColumn[numberColumn2++] = iColumn; matrix.deleteCols(numberColumn2, whichColumn); top[iBlock] = matrix; } // and master numberRow2 = 0; numberColumn2 = 0; for (iRow = 0; iRow < numberRows; iRow++) if (rowBlock[iRow] < 0) whichRow[numberRow2++] = iRow; for (iColumn = 0; iColumn < numberColumns; iColumn++) if (columnBlock[iColumn] == -1) whichColumn[numberColumn2++] = iColumn; ClpModel masterModel(&model, numberRow2, whichRow, numberColumn2, whichColumn); master = ClpSimplex(masterModel); delete [] whichRow; delete [] whichColumn; // Overkill in terms of space int numberMasterRows = master.numberRows(); int * columnAdd = new int[numberBlocks+1]; int * rowAdd = new int[numberBlocks*(numberMasterRows+1)]; double * elementAdd = new double[numberBlocks*(numberMasterRows+1)]; double * objective = new double[numberBlocks]; int maxPass = 500; int iPass; double lastObjective = 1.0e31; // Create convexity rows for proposals int numberMasterColumns = master.numberColumns(); master.resize(numberMasterRows + numberBlocks, numberMasterColumns); // Arrays to say which block and when created int maximumColumns = 2 * numberMasterRows + 10 * numberBlocks; int * whichBlock = new int[maximumColumns]; int * when = new int[maximumColumns]; int numberColumnsGenerated = numberBlocks; // fill in rhs and add in artificials { double * rowLower = master.rowLower(); double * rowUpper = master.rowUpper(); int iBlock; columnAdd[0] = 0; for (iBlock = 0; iBlock < numberBlocks; iBlock++) { int iRow = iBlock + numberMasterRows;; rowLower[iRow] = 1.0; rowUpper[iRow] = 1.0; rowAdd[iBlock] = iRow; elementAdd[iBlock] = 1.0; objective[iBlock] = 1.0e9; columnAdd[iBlock+1] = iBlock + 1; when[iBlock] = -1; whichBlock[iBlock] = iBlock; } master.addColumns(numberBlocks, NULL, NULL, objective, columnAdd, rowAdd, elementAdd); } // and resize matrix to double check clp will be happy //master.matrix()->setDimensions(numberMasterRows+numberBlocks, // numberMasterColumns+numberBlocks); for (iPass = 0; iPass < maxPass; iPass++) { printf("Start of pass %d\n", iPass); // Solve master - may be infeasible master.scaling(false); if (0) { master.writeMps("yy.mps"); } master.primal(); int problemStatus = master.status(); // do here as can change (delcols) if (master.numberIterations() == 0 && iPass) break; // finished if (master.objectiveValue() > lastObjective - 1.0e-7 && iPass > 555) break; // finished lastObjective = master.objectiveValue(); // mark basic ones and delete if necessary int iColumn; numberColumnsGenerated = master.numberColumns() - numberMasterColumns; for (iColumn = 0; iColumn < numberColumnsGenerated; iColumn++) { if (master.getStatus(iColumn + numberMasterColumns) == ClpSimplex::basic) when[iColumn] = iPass; } if (numberColumnsGenerated + numberBlocks > maximumColumns) { // delete int numberKeep = 0; int numberDelete = 0; int * whichDelete = new int[numberColumns]; for (iColumn = 0; iColumn < numberColumnsGenerated; iColumn++) { if (when[iColumn] > iPass - 7) { // keep when[numberKeep] = when[iColumn]; whichBlock[numberKeep++] = whichBlock[iColumn]; } else { // delete whichDelete[numberDelete++] = iColumn + numberMasterColumns; } } numberColumnsGenerated -= numberDelete; master.deleteColumns(numberDelete, whichDelete); delete [] whichDelete; } const double * dual = NULL; bool deleteDual = false; if (problemStatus == 0) { dual = master.dualRowSolution(); } else if (problemStatus == 1) { // could do composite objective dual = master.infeasibilityRay(); deleteDual = true; printf("The sum of infeasibilities is %g\n", master.sumPrimalInfeasibilities()); } else if (!master.numberColumns()) { assert(!iPass); dual = master.dualRowSolution(); memset(master.dualRowSolution(), 0, (numberMasterRows + numberBlocks) *sizeof(double)); } else { abort(); } // Create objective for sub problems and solve columnAdd[0] = 0; int numberProposals = 0; for (iBlock = 0; iBlock < numberBlocks; iBlock++) { int numberColumns2 = sub[iBlock].numberColumns(); double * saveObj = new double [numberColumns2]; double * objective2 = sub[iBlock].objective(); memcpy(saveObj, objective2, numberColumns2 * sizeof(double)); // new objective top[iBlock].transposeTimes(dual, objective2); int i; if (problemStatus == 0) { for (i = 0; i < numberColumns2; i++) objective2[i] = saveObj[i] - objective2[i]; } else { for (i = 0; i < numberColumns2; i++) objective2[i] = -objective2[i]; } sub[iBlock].primal(); memcpy(objective2, saveObj, numberColumns2 * sizeof(double)); // get proposal if (sub[iBlock].numberIterations() || !iPass) { double objValue = 0.0; int start = columnAdd[numberProposals]; // proposal if (sub[iBlock].isProvenOptimal()) { const double * solution = sub[iBlock].primalColumnSolution(); top[iBlock].times(solution, elementAdd + start); for (i = 0; i < numberColumns2; i++) objValue += solution[i] * saveObj[i]; // See if good dj and pack down int number = start; double dj = objValue; if (problemStatus) dj = 0.0; double smallest = 1.0e100; double largest = 0.0; for (i = 0; i < numberMasterRows; i++) { double value = elementAdd[start+i]; if (fabs(value) > 1.0e-15) { dj -= dual[i] * value; smallest = CoinMin(smallest, fabs(value)); largest = CoinMax(largest, fabs(value)); rowAdd[number] = i; elementAdd[number++] = value; } } // and convexity dj -= dual[numberMasterRows+iBlock]; rowAdd[number] = numberMasterRows + iBlock; elementAdd[number++] = 1.0; // if elements large then scale? //if (largest>1.0e8||smallest<1.0e-8) printf("For subproblem %d smallest - %g, largest %g - dj %g\n", iBlock, smallest, largest, dj); if (dj < -1.0e-6 || !iPass) { // take objective[numberProposals] = objValue; columnAdd[++numberProposals] = number; when[numberColumnsGenerated] = iPass; whichBlock[numberColumnsGenerated++] = iBlock; } } else if (sub[iBlock].isProvenDualInfeasible()) { // use ray const double * solution = sub[iBlock].unboundedRay(); top[iBlock].times(solution, elementAdd + start); for (i = 0; i < numberColumns2; i++) objValue += solution[i] * saveObj[i]; // See if good dj and pack down int number = start; double dj = objValue; double smallest = 1.0e100; double largest = 0.0; for (i = 0; i < numberMasterRows; i++) { double value = elementAdd[start+i]; if (fabs(value) > 1.0e-15) { dj -= dual[i] * value; smallest = CoinMin(smallest, fabs(value)); largest = CoinMax(largest, fabs(value)); rowAdd[number] = i; elementAdd[number++] = value; } } // if elements large or small then scale? //if (largest>1.0e8||smallest<1.0e-8) printf("For subproblem ray %d smallest - %g, largest %g - dj %g\n", iBlock, smallest, largest, dj); if (dj < -1.0e-6) { // take objective[numberProposals] = objValue; columnAdd[++numberProposals] = number; when[numberColumnsGenerated] = iPass; whichBlock[numberColumnsGenerated++] = iBlock; } } else { abort(); } } delete [] saveObj; } if (deleteDual) delete [] dual; if (numberProposals) master.addColumns(numberProposals, NULL, NULL, objective, columnAdd, rowAdd, elementAdd); } // now put back a good solution double * lower = new double[numberMasterRows+numberBlocks]; double * upper = new double[numberMasterRows+numberBlocks]; numberColumnsGenerated += numberMasterColumns; double * sol = new double[numberColumnsGenerated]; const double * solution = master.primalColumnSolution(); const double * masterLower = master.rowLower(); const double * masterUpper = master.rowUpper(); double * fullSolution = model.primalColumnSolution(); const double * fullLower = model.columnLower(); const double * fullUpper = model.columnUpper(); const double * rowSolution = master.primalRowSolution(); double * fullRowSolution = model.primalRowSolution(); int kRow = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (rowBlock[iRow] == -1) { model.setRowStatus(iRow, master.getRowStatus(kRow)); fullRowSolution[iRow] = rowSolution[kRow++]; } } int kColumn = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnBlock[iColumn] == -1) { model.setStatus(iColumn, master.getStatus(kColumn)); fullSolution[iColumn] = solution[kColumn++]; } } for (iBlock = 0; iBlock < numberBlocks; iBlock++) { // convert top bit to by rows top[iBlock].reverseOrdering(); // zero solution memset(sol, 0, numberColumnsGenerated * sizeof(double)); int i; for (i = numberMasterColumns; i < numberColumnsGenerated; i++) if (whichBlock[i-numberMasterColumns] == iBlock) sol[i] = solution[i]; memset(lower, 0, (numberMasterRows + numberBlocks) *sizeof(double)); master.times(1.0, sol, lower); for (iRow = 0; iRow < numberMasterRows; iRow++) { double value = lower[iRow]; if (masterUpper[iRow] < 1.0e20) upper[iRow] = value; else upper[iRow] = COIN_DBL_MAX; if (masterLower[iRow] > -1.0e20) lower[iRow] = value; else lower[iRow] = -COIN_DBL_MAX; } sub[iBlock].addRows(numberMasterRows, lower, upper, top[iBlock].getVectorStarts(), top[iBlock].getVectorLengths(), top[iBlock].getIndices(), top[iBlock].getElements()); sub[iBlock].primal(); const double * subSolution = sub[iBlock].primalColumnSolution(); const double * subRowSolution = sub[iBlock].primalRowSolution(); // move solution kColumn = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnBlock[iColumn] == iBlock) { model.setStatus(iColumn, sub[iBlock].getStatus(kColumn)); fullSolution[iColumn] = subSolution[kColumn++]; } } assert(kColumn == sub[iBlock].numberColumns()); kRow = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (rowBlock[iRow] == iBlock) { model.setRowStatus(iRow, sub[iBlock].getRowStatus(kRow)); fullRowSolution[iRow] = subRowSolution[kRow++]; } } assert(kRow == sub[iBlock].numberRows() - numberMasterRows); } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (fullSolution[iColumn] < fullUpper[iColumn] - 1.0e-8 && fullSolution[iColumn] > fullLower[iColumn] + 1.0e-8) { assert(model.getStatus(iColumn) == ClpSimplex::basic); } else if (fullSolution[iColumn] >= fullUpper[iColumn] - 1.0e-8) { // may help to make rest non basic model.setStatus(iColumn, ClpSimplex::atUpperBound); } else if (fullSolution[iColumn] <= fullLower[iColumn] + 1.0e-8) { // may help to make rest non basic model.setStatus(iColumn, ClpSimplex::atLowerBound); } } for (iRow = 0; iRow < numberRows; iRow++) model.setRowStatus(iRow, ClpSimplex::superBasic); model.primal(1); delete [] sol; delete [] lower; delete [] upper; delete [] whichBlock; delete [] when; delete [] columnAdd; delete [] rowAdd; delete [] elementAdd; delete [] objective; delete [] top; delete [] sub; delete [] rowBlock; delete [] columnBlock; return 0; } CoinMP-1.8.3/Clp/examples/testGub.cpp0000644000175000017500000005026112130767057016005 0ustar renerene/* $Id: testGub.cpp 1937 2013-04-09 10:32:15Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "ClpDynamicExampleMatrix.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "CoinSort.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "CoinMpsIO.hpp" int main(int argc, const char *argv[]) { ClpSimplex model; int status; int maxFactor = 100; if (argc < 2) { #if defined(NETLIBDIR) status = model.readMps(NETLIBDIR "/czprob.mps"); if (status) { printf("Unable to read matrix - trying gzipped version\n"); status = model.readMps(NETLIBDIR "/czprob.mps.gz"); } #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else { status = model.readMps(argv[1]); } if (status) { printf("errors on input\n"); exit(77); } if (argc > 2) { maxFactor = atoi(argv[2]); printf("max factor %d\n", maxFactor); } if (argc > 3) { printf("Using ClpDynamicMatrix\n"); } else { printf("Using ClpDynamicExampleMatrix\n"); } // find gub int numberRows = model.numberRows(); int * gubStart = new int[numberRows+1]; int * gubEnd = new int[numberRows]; int * which = new int[numberRows]; int * whichGub = new int[numberRows]; int numberColumns = model.numberColumns(); int * mark = new int[numberColumns]; int iRow, iColumn; // delete variables fixed to zero const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); int numberDelete = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] == 0.0 && columnLower[iColumn] == 0.0) mark[numberDelete++] = iColumn; } if (numberDelete) { model.deleteColumns(numberDelete, mark); numberColumns -= numberDelete; columnLower = model.columnLower(); columnUpper = model.columnUpper(); } double * lower = new double[numberRows]; double * upper = new double[numberRows]; const double * rowLower = model.rowLower(); const double * rowUpper = model.rowUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) mark[iColumn] = -1; CoinPackedMatrix * matrix = model.matrix(); // get row copy CoinPackedMatrix rowCopy = *matrix; rowCopy.reverseOrdering(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const double * element = rowCopy.getElements(); int putGub = numberRows; int putNonGub = numberRows; int * rowIsGub = new int [numberRows]; for (iRow = numberRows - 1; iRow >= 0; iRow--) { bool gubRow = true; int first = numberColumns + 1; int last = -1; for (int j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { if (element[j] != 1.0) { gubRow = false; break; } else { int iColumn = column[j]; if (mark[iColumn] >= 0) { gubRow = false; break; } else { last = CoinMax(last, iColumn); first = CoinMin(first, iColumn); } } } if (last - first + 1 != rowLength[iRow] || !gubRow) { which[--putNonGub] = iRow; rowIsGub[iRow] = 0; } else { for (int j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; mark[iColumn] = iRow; } rowIsGub[iRow] = -1; putGub--; gubStart[putGub] = first; gubEnd[putGub] = last + 1; lower[putGub] = rowLower[iRow]; upper[putGub] = rowUpper[iRow]; whichGub[putGub] = iRow; } } int numberNonGub = numberRows - putNonGub; int numberGub = numberRows - putGub; if (numberGub > 0) { printf("** %d gub rows\n", numberGub); int numberNormal = 0; const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); int numberElements = 0; bool doLower = false; bool doUpper = false; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (mark[iColumn] < 0) { mark[numberNormal++] = iColumn; } else { numberElements += columnLength[iColumn]; if (columnLower[iColumn] != 0.0) doLower = true; if (columnUpper[iColumn] < 1.0e20) doUpper = true; } } if (!numberNormal) { printf("Putting back one gub row to make non-empty\n"); for (iColumn = gubStart[putGub]; iColumn < gubEnd[putGub]; iColumn++) mark[numberNormal++] = iColumn; putGub++; numberGub--; } ClpSimplex model2(&model, numberNonGub, which + putNonGub, numberNormal, mark); // and copy for restart test ClpSimplex model3 = model2; int numberGubColumns = numberColumns - numberNormal; // sort gubs so monotonic int * which = new int[numberGub]; int i; for (i = 0; i < numberGub; i++) which[i] = i; CoinSort_2(gubStart + putGub, gubStart + putGub + numberGub, which); // move to bottom if we want to use later memmove(gubStart, gubStart + putGub, numberGub * sizeof(int)); int * temp1 = new int [numberGub]; for (i = 0; i < numberGub; i++) { int k = which[i]; temp1[i] = gubEnd[putGub+k]; } memcpy(gubEnd, temp1, numberGub * sizeof(int)); delete [] temp1; double * temp2 = new double [numberGub]; for (i = 0; i < numberGub; i++) { int k = which[i]; temp2[i] = lower[putGub+k]; } memcpy(lower, temp2, numberGub * sizeof(double)); for (i = 0; i < numberGub; i++) { int k = which[i]; temp2[i] = upper[putGub+k]; } memcpy(upper, temp2, numberGub * sizeof(double)); delete [] temp2; delete [] which; numberElements -= numberGubColumns; int * start2 = new int[numberGubColumns+1]; int * row2 = new int[numberElements]; double * element2 = new double[numberElements]; double * cost2 = new double [numberGubColumns]; double * lowerColumn2 = NULL; if (doLower) { lowerColumn2 = new double [numberGubColumns]; CoinFillN(lowerColumn2, numberGubColumns, 0.0); } double * upperColumn2 = NULL; if (doUpper) { upperColumn2 = new double [numberGubColumns]; CoinFillN(upperColumn2, numberGubColumns, COIN_DBL_MAX); } numberElements = 0; int numberNonGubRows = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (!rowIsGub[iRow]) rowIsGub[iRow] = numberNonGubRows++; } numberColumns = 0; int iStart = gubStart[0]; gubStart[0] = 0; start2[0] = 0; const double * cost = model.objective(); for (int iSet = 0; iSet < numberGub; iSet++) { int iEnd = gubEnd[iSet]; for (int k = iStart; k < iEnd; k++) { cost2[numberColumns] = cost[k]; if (columnLower[k]) lowerColumn2[numberColumns] = columnLower[k]; if (columnUpper[k] < 1.0e20) upperColumn2[numberColumns] = columnUpper[k]; for (int j = columnStart[k]; j < columnStart[k] + columnLength[k]; j++) { int iRow = rowIsGub[row[j]]; if (iRow >= 0) { row2[numberElements] = iRow; element2[numberElements++] = elementByColumn[j]; } } start2[++numberColumns] = numberElements; } if (iSet < numberGub - 1) iStart = gubStart[iSet+1]; gubStart[iSet+1] = numberColumns; } printf("** Before adding matrix there are %d rows and %d columns\n", model2.numberRows(), model2.numberColumns()); if (argc > 3) { ClpDynamicMatrix * newMatrix = new ClpDynamicMatrix(&model2, numberGub, numberColumns, gubStart, lower, upper, start2, row2, element2, cost2, lowerColumn2, upperColumn2); model2.replaceMatrix(newMatrix); newMatrix->switchOffCheck(); newMatrix->setRefreshFrequency(1000); } else { ClpDynamicExampleMatrix * newMatrix = new ClpDynamicExampleMatrix(&model2, numberGub, numberColumns, gubStart, lower, upper, start2, row2, element2, cost2, lowerColumn2, upperColumn2); model2.replaceMatrix(newMatrix,true); newMatrix->switchOffCheck(); newMatrix->setRefreshFrequency(1000); } printf("** While after adding matrix there are %d rows and %d columns\n", model2.numberRows(), model2.numberColumns()); model2.setSpecialOptions(4); // exactly to bound // For now scaling off model2.scaling(0); ClpPrimalColumnSteepest steepest(5); model2.setPrimalColumnPivotAlgorithm(steepest); //model2.messageHandler()->setLogLevel(63); model2.setFactorizationFrequency(maxFactor); model2.setMaximumIterations(4000000); double time1 = CoinCpuTime(); model2.primal(); // can't use values pass model2.primal(0); // test proper restart if (argc > 3) { ClpDynamicMatrix * oldMatrix = dynamic_cast< ClpDynamicMatrix*>(model2.clpMatrix()); assert(oldMatrix); ClpDynamicMatrix * newMatrix = new ClpDynamicMatrix(&model3, numberGub, numberColumns, gubStart, lower, upper, start2, row2, element2, cost2, lowerColumn2, upperColumn2, oldMatrix->gubRowStatus(), oldMatrix->dynamicStatus()); model3.replaceMatrix(newMatrix,true); // and ordinary status (but only NON gub rows) memcpy(model3.statusArray(), model2.statusArray(), (newMatrix->numberStaticRows() + model3.numberColumns()) *sizeof(unsigned char)); newMatrix->switchOffCheck(); newMatrix->setRefreshFrequency(1000); } else { ClpDynamicExampleMatrix * oldMatrix = dynamic_cast< ClpDynamicExampleMatrix*>(model2.clpMatrix()); assert(oldMatrix); ClpDynamicExampleMatrix * newMatrix = new ClpDynamicExampleMatrix(&model3, numberGub, numberColumns, gubStart, lower, upper, start2, row2, element2, cost2, lowerColumn2, upperColumn2, oldMatrix->gubRowStatus(), oldMatrix->dynamicStatus(), oldMatrix->numberGubColumns(), oldMatrix->idGen()); model3.replaceMatrix(newMatrix,true); // and ordinary status (but only NON gub rows) memcpy(model3.statusArray(), model2.statusArray(), (newMatrix->numberStaticRows() + model3.numberColumns()) *sizeof(unsigned char)); newMatrix->switchOffCheck(); newMatrix->setRefreshFrequency(1000); } model3.setSpecialOptions(4); // exactly to bound // For now scaling off model3.scaling(0); model3.setPrimalColumnPivotAlgorithm(steepest); model3.messageHandler()->setLogLevel(63); model3.setFactorizationFrequency(maxFactor); model3.setMaximumIterations(4000000); delete [] rowIsGub; delete [] start2; delete [] row2; delete [] element2; delete [] cost2; delete [] lowerColumn2; delete [] upperColumn2; model3.primal(); // this code expects non gub first in original matrix // and only works at present for ClpDynamicMatrix ClpDynamicMatrix * gubMatrix = dynamic_cast< ClpDynamicMatrix*>(model2.clpMatrix()); assert(gubMatrix); ClpDynamicExampleMatrix * gubMatrix2 = dynamic_cast< ClpDynamicExampleMatrix*>(model2.clpMatrix()); if (!gubMatrix2) { const double * solution = model2.primalColumnSolution(); const double * cost = model.objective(); int numberGubColumns = gubMatrix->numberGubColumns(); int firstOdd = gubMatrix->firstDynamic(); int lastOdd = gubMatrix->firstAvailable(); int numberTotalColumns = firstOdd + numberGubColumns; int originalNumberRows = model.numberRows(); int numberStaticRows = gubMatrix->numberStaticRows(); char * status = new char [numberTotalColumns]; double * gubSolution = new double [numberTotalColumns]; int numberSets = gubMatrix->numberSets(); const int * id = gubMatrix->id(); int i; const double * columnLower = gubMatrix->columnLower(); const double * columnUpper = gubMatrix->columnUpper(); for (i = 0; i < numberGubColumns; i++) { if (gubMatrix->getDynamicStatus(i) == ClpDynamicMatrix::atUpperBound) { gubSolution[i+firstOdd] = columnUpper[i]; status[i+firstOdd] = 2; } else if (gubMatrix->getDynamicStatus(i) == ClpDynamicMatrix::atLowerBound && columnLower) { gubSolution[i+firstOdd] = columnLower[i]; status[i+firstOdd] = 1; } else if (gubMatrix->getDynamicStatus(i) == ClpDynamicMatrix::soloKey) { int iSet = gubMatrix->whichSet(i); gubSolution[i+firstOdd] = gubMatrix->keyValue(iSet); status[i+firstOdd] = 0; } else { gubSolution[i+firstOdd] = 0.0; status[i+firstOdd] = 1; } } for (i = 0; i < firstOdd; i++) { ClpSimplex::Status thisStatus = model2.getStatus(i); if (thisStatus == ClpSimplex::basic) status[i] = 0; else if (thisStatus == ClpSimplex::atLowerBound) status[i] = 1; else if (thisStatus == ClpSimplex::atUpperBound) status[i] = 2; else if (thisStatus == ClpSimplex::isFixed) status[i] = 3; else abort(); gubSolution[i] = solution[i]; } for (i = firstOdd; i < lastOdd; i++) { int iBig = id[i-firstOdd] + firstOdd; ClpSimplex::Status thisStatus = model2.getStatus(i); if (thisStatus == ClpSimplex::basic) status[iBig] = 0; else if (thisStatus == ClpSimplex::atLowerBound) status[iBig] = 1; else if (thisStatus == ClpSimplex::atUpperBound) status[iBig] = 2; else if (thisStatus == ClpSimplex::isFixed) status[iBig] = 3; else abort(); gubSolution[iBig] = solution[i]; } char * rowStatus = new char[originalNumberRows]; for (i = 0; i < numberStaticRows; i++) { ClpSimplex::Status thisStatus = model2.getRowStatus(i); if (thisStatus == ClpSimplex::basic) rowStatus[i] = 0; else if (thisStatus == ClpSimplex::atLowerBound) rowStatus[i] = 1; else if (thisStatus == ClpSimplex::atUpperBound) rowStatus[i] = 2; else if (thisStatus == ClpSimplex::isFixed) rowStatus[i] = 3; else abort(); } double objValue = 0.0; for (i = 0; i < numberTotalColumns; i++) objValue += cost[i] * gubSolution[i]; printf("objective value is %g\n", objValue); for (i = 0; i < numberSets; i++) { ClpSimplex::Status thisStatus = gubMatrix->getStatus(i); if (thisStatus == ClpSimplex::basic) rowStatus[numberStaticRows+i] = 0; else if (thisStatus == ClpSimplex::atLowerBound) rowStatus[numberStaticRows+i] = 1; else if (thisStatus == ClpSimplex::atUpperBound) rowStatus[numberStaticRows+i] = 2; else if (thisStatus == ClpSimplex::isFixed) rowStatus[numberStaticRows+i] = 3; else abort(); } // Coding below may not work if gub rows not at end FILE * fp = fopen("xx.sol", "w"); fwrite(gubSolution, sizeof(double), numberTotalColumns, fp); fwrite(status, sizeof(char), numberTotalColumns, fp); #ifndef NDEBUG const double * rowsol = model2.primalRowSolution(); #endif double * rowsol2 = new double[originalNumberRows]; memset(rowsol2, 0, originalNumberRows * sizeof(double)); model.times(1.0, gubSolution, rowsol2); for (i = 0; i < numberStaticRows; i++) assert(fabs(rowsol[i] - rowsol2[i]) < 1.0e-3); for (; i < originalNumberRows; i++) assert(rowsol2[i] > lower[i-numberStaticRows] - 1.0e-3 && rowsol2[i] < upper[i-numberStaticRows] + 1.0e-3); //for (;i int main(int argc, const char *argv[]) { ClpSimplex model; int status; // Keep names when reading an mps file if (argc < 2) { #if defined(SAMPLEDIR) status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1], true); if (status) { fprintf(stderr, "Bad readMps %s\n", argv[1]); fprintf(stdout, "Bad readMps %s\n", argv[1]); exit(1); } #ifdef STYLE1 if (argc < 3 || !strstr(argv[2], "primal")) { // Use the dual algorithm unless user said "primal" model.initialDualSolve(); } else { model.initialPrimalSolve(); } #else ClpSolve solvectl; if (argc < 3 || (!strstr(argv[2], "primal") && !strstr(argv[2], "barrier"))) { // Use the dual algorithm unless user said "primal" or "barrier" std::cout << std::endl << " Solve using Dual: " << std::endl; solvectl.setSolveType(ClpSolve::useDual); solvectl.setPresolveType(ClpSolve::presolveOn); model.initialSolve(solvectl); } else if (strstr(argv[2], "barrier")) { // Use the barrier algorithm if user said "barrier" std::cout << std::endl << " Solve using Barrier: " << std::endl; solvectl.setSolveType(ClpSolve::useBarrier); solvectl.setPresolveType(ClpSolve::presolveOn); model.initialSolve(solvectl); } else { std::cout << std::endl << " Solve using Primal: " << std::endl; solvectl.setSolveType(ClpSolve::usePrimal); solvectl.setPresolveType(ClpSolve::presolveOn); model.initialSolve(solvectl); } #endif std::string modelName; model.getStrParam(ClpProbName, modelName); std::cout << "Model " << modelName << " has " << model.numberRows() << " rows and " << model.numberColumns() << " columns" << std::endl; // remove this to print solution exit(0); /* Now to print out solution. The methods used return modifiable arrays while the alternative names return const pointers - which is of course much more virtuous. This version just does non-zero columns */ #if 0 int numberRows = model.numberRows(); // Alternatively getRowActivity() double * rowPrimal = model.primalRowSolution(); // Alternatively getRowPrice() double * rowDual = model.dualRowSolution(); // Alternatively getRowLower() double * rowLower = model.rowLower(); // Alternatively getRowUpper() double * rowUpper = model.rowUpper(); // Alternatively getRowObjCoefficients() double * rowObjective = model.rowObjective(); // If we have not kept names (parameter to readMps) this will be 0 assert(model.lengthNames()); // Row names const std::vector * rowNames = model.rowNames(); int iRow; std::cout << " Primal Dual Lower Upper (Cost)" << std::endl; for (iRow = 0; iRow < numberRows; iRow++) { double value; std::cout << std::setw(6) << iRow << " " << std::setw(8) << (*rowNames)[iRow]; value = rowPrimal[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowDual[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowLower[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = rowUpper[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; if (rowObjective) { value = rowObjective[iRow]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; } std::cout << std::endl; } #endif std::cout << "--------------------------------------" << std::endl; // Columns int numberColumns = model.numberColumns(); // Alternatively getColSolution() double * columnPrimal = model.primalColumnSolution(); // Alternatively getReducedCost() double * columnDual = model.dualColumnSolution(); // Alternatively getColLower() double * columnLower = model.columnLower(); // Alternatively getColUpper() double * columnUpper = model.columnUpper(); // Alternatively getObjCoefficients() double * columnObjective = model.objective(); // If we have not kept names (parameter to readMps) this will be 0 assert(model.lengthNames()); // Column names const std::vector * columnNames = model.columnNames(); int iColumn; std::cout << " Primal Dual Lower Upper Cost" << std::endl; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value; value = columnPrimal[iColumn]; if (fabs(value) > 1.0e-8) { std::cout << std::setw(6) << iColumn << " " << std::setw(8) << (*columnNames)[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnDual[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnLower[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnUpper[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; value = columnObjective[iColumn]; if (fabs(value) < 1.0e5) std::cout << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setw(14) << value; else std::cout << std::setiosflags(std::ios::scientific) << std::setw(14) << value; std::cout << std::endl; } } std::cout << "--------------------------------------" << std::endl; return 0; } CoinMP-1.8.3/Clp/examples/dualCuts.cpp0000644000175000017500000003055011510657150016144 0ustar renerene/* $Id: dualCuts.cpp 1662 2011-01-04 17:52:40Z lou $ */ /* Copyright (C) 2003, International Business Machines Corporation and others. All Rights Reserved. This sample program is designed to illustrate programming techniques using CoinLP, has not been thoroughly tested and comes without any warranty whatsoever. You may copy, modify and distribute this sample program without any restrictions whatsoever and without any payment to anyone. */ #include "ClpSimplex.hpp" #include "ClpPresolve.hpp" #include "ClpFactorization.hpp" #include "CoinSort.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "CoinMpsIO.hpp" #include int main(int argc, const char *argv[]) { ClpSimplex model; int status; // Keep names if (argc < 2) { status = model.readMps("small.mps", true); } else { status = model.readMps(argv[1], false); } if (status) exit(10); /* This driver implements a method of treating a problem as all cuts. So it adds in all E rows, solves and then adds in violated rows. */ double time1 = CoinCpuTime(); ClpSimplex * model2; ClpPresolve pinfo; int numberPasses = 5; // can change this /* Use a tolerance of 1.0e-8 for feasibility, treat problem as not being integer, do "numberpasses" passes and throw away names in presolved model */ model2 = pinfo.presolvedModel(model, 1.0e-8, false, numberPasses, false); if (!model2) { fprintf(stderr, "ClpPresolve says %s is infeasible with tolerance of %g\n", argv[1], 1.0e-8); fprintf(stdout, "ClpPresolve says %s is infeasible with tolerance of %g\n", argv[1], 1.0e-8); // model was infeasible - maybe try again with looser tolerances model2 = pinfo.presolvedModel(model, 1.0e-7, false, numberPasses, false); if (!model2) { fprintf(stderr, "ClpPresolve says %s is infeasible with tolerance of %g\n", argv[1], 1.0e-7); fprintf(stdout, "ClpPresolve says %s is infeasible with tolerance of %g\n", argv[1], 1.0e-7); exit(2); } } // change factorization frequency from 200 model2->setFactorizationFrequency(100 + model2->numberRows() / 50); int numberColumns = model2->numberColumns(); int originalNumberRows = model2->numberRows(); // We will need arrays to choose rows to add double * weight = new double [originalNumberRows]; int * sort = new int [originalNumberRows]; int numberSort = 0; char * take = new char [originalNumberRows]; const double * rowLower = model2->rowLower(); const double * rowUpper = model2->rowUpper(); int iRow, iColumn; // Set up initial list numberSort = 0; for (iRow = 0; iRow < originalNumberRows; iRow++) { weight[iRow] = 1.123e50; if (rowLower[iRow] == rowUpper[iRow]) { sort[numberSort++] = iRow; weight[iRow] = 0.0; } } numberSort /= 2; // Just add this number of rows each time in small problem int smallNumberRows = 2 * numberColumns; smallNumberRows = CoinMin(smallNumberRows, originalNumberRows / 20); // and pad out with random rows double ratio = ((double)(smallNumberRows - numberSort)) / ((double) originalNumberRows); for (iRow = 0; iRow < originalNumberRows; iRow++) { if (weight[iRow] == 1.123e50 && CoinDrand48() < ratio) sort[numberSort++] = iRow; } /* This is optional. The best thing to do is to miss out random rows and do a set which makes dual feasible. If that is not possible then make sure variables have bounds. One way that normally works is to automatically tighten bounds. */ #if 0 // However for some we need to do anyway double * columnLower = model2->columnLower(); double * columnUpper = model2->columnUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { columnLower[iColumn] = CoinMax(-1.0e6, columnLower[iColumn]); columnUpper[iColumn] = CoinMin(1.0e6, columnUpper[iColumn]); } #endif model2->tightenPrimalBounds(-1.0e4, true); printf("%d rows in initial problem\n", numberSort); double * fullSolution = model2->primalRowSolution(); // Just do this number of passes int maxPass = 50; // And take out slack rows until this pass int takeOutPass = 30; int iPass; const int * start = model2->clpMatrix()->getVectorStarts(); const int * length = model2->clpMatrix()->getVectorLengths(); const int * row = model2->clpMatrix()->getIndices(); int * whichColumns = new int [numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) whichColumns[iColumn] = iColumn; int numberSmallColumns = numberColumns; for (iPass = 0; iPass < maxPass; iPass++) { printf("Start of pass %d\n", iPass); // Cleaner this way std::sort(sort, sort + numberSort); // Create small problem ClpSimplex small(model2, numberSort, sort, numberSmallColumns, whichColumns); small.setFactorizationFrequency(100 + numberSort / 200); //small.setPerturbation(50); //small.setLogLevel(63); // A variation is to just do N iterations //if (iPass) //small.setMaximumIterations(100); // Solve small.factorization()->messageLevel(8); if (iPass) { small.dual(); } else { small.writeMps("continf.mps"); ClpSolve solveOptions; solveOptions.setSolveType(ClpSolve::useDual); //solveOptions.setSolveType(ClpSolve::usePrimalorSprint); //solveOptions.setSpecialOption(1,2,200); // idiot small.initialSolve(solveOptions); } bool dualInfeasible = (small.status() == 2); // move solution back double * solution = model2->primalColumnSolution(); const double * smallSolution = small.primalColumnSolution(); for (int j = 0; j < numberSmallColumns; j++) { iColumn = whichColumns[j]; solution[iColumn] = smallSolution[j]; model2->setColumnStatus(iColumn, small.getColumnStatus(j)); } for (iRow = 0; iRow < numberSort; iRow++) { int kRow = sort[iRow]; model2->setRowStatus(kRow, small.getRowStatus(iRow)); } // compute full solution memset(fullSolution, 0, originalNumberRows * sizeof(double)); model2->times(1.0, model2->primalColumnSolution(), fullSolution); if (iPass != maxPass - 1) { // Mark row as not looked at for (iRow = 0; iRow < originalNumberRows; iRow++) weight[iRow] = 1.123e50; // Look at rows already in small problem int iSort; int numberDropped = 0; int numberKept = 0; int numberBinding = 0; int numberInfeasibilities = 0; double sumInfeasibilities = 0.0; for (iSort = 0; iSort < numberSort; iSort++) { iRow = sort[iSort]; //printf("%d %g %g\n",iRow,fullSolution[iRow],small.primalRowSolution()[iSort]); if (model2->getRowStatus(iRow) == ClpSimplex::basic) { // Basic - we can get rid of if early on if (iPass < takeOutPass && !dualInfeasible) { // may have hit max iterations so check double infeasibility = CoinMax(fullSolution[iRow] - rowUpper[iRow], rowLower[iRow] - fullSolution[iRow]); weight[iRow] = -infeasibility; if (infeasibility > 1.0e-8) { numberInfeasibilities++; sumInfeasibilities += infeasibility; } else { weight[iRow] = 1.0; numberDropped++; } } else { // keep weight[iRow] = -1.0e40; numberKept++; } } else { // keep weight[iRow] = -1.0e50; numberKept++; numberBinding++; } } // Now rest for (iRow = 0; iRow < originalNumberRows; iRow++) { sort[iRow] = iRow; if (weight[iRow] == 1.123e50) { // not looked at yet double infeasibility = CoinMax(fullSolution[iRow] - rowUpper[iRow], rowLower[iRow] - fullSolution[iRow]); weight[iRow] = -infeasibility; if (infeasibility > 1.0e-8) { numberInfeasibilities++; sumInfeasibilities += infeasibility; } } } // sort CoinSort_2(weight, weight + originalNumberRows, sort); numberSort = CoinMin(originalNumberRows, smallNumberRows + numberKept); memset(take, 0, originalNumberRows); for (iRow = 0; iRow < numberSort; iRow++) take[sort[iRow]] = 1; numberSmallColumns = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int n = 0; for (int j = start[iColumn]; j < start[iColumn] + length[iColumn]; j++) { int iRow = row[j]; if (take[iRow]) n++; } if (n) whichColumns[numberSmallColumns++] = iColumn; } printf("%d rows binding, %d rows kept, %d rows dropped - new size %d rows, %d columns\n", numberBinding, numberKept, numberDropped, numberSort, numberSmallColumns); printf("%d rows are infeasible - sum is %g\n", numberInfeasibilities, sumInfeasibilities); if (!numberInfeasibilities) { printf("Exiting as looks optimal\n"); break; } numberInfeasibilities = 0; sumInfeasibilities = 0.0; for (iSort = 0; iSort < numberSort; iSort++) { if (weight[iSort] > -1.0e30 && weight[iSort] < -1.0e-8) { numberInfeasibilities++; sumInfeasibilities += -weight[iSort]; } } printf("in small model %d rows are infeasible - sum is %g\n", numberInfeasibilities, sumInfeasibilities); } } delete [] weight; delete [] sort; delete [] whichColumns; delete [] take; // If problem is big you may wish to skip this model2->dual(); int numberBinding = 0; for (iRow = 0; iRow < originalNumberRows; iRow++) { if (model2->getRowStatus(iRow) != ClpSimplex::basic) numberBinding++; } printf("%d binding rows at end\n", numberBinding); pinfo.postsolve(true); int numberIterations = model2->numberIterations();; delete model2; /* After this postsolve model should be optimal. We can use checkSolution and test feasibility */ model.checkSolution(); if (model.numberDualInfeasibilities() || model.numberPrimalInfeasibilities()) printf("%g dual %g(%d) Primal %g(%d)\n", model.objectiveValue(), model.sumDualInfeasibilities(), model.numberDualInfeasibilities(), model.sumPrimalInfeasibilities(), model.numberPrimalInfeasibilities()); // But resolve for safety model.primal(1); numberIterations += model.numberIterations();; printf("Solve took %g seconds\n", CoinCpuTime() - time1); return 0; } CoinMP-1.8.3/Clp/examples/input.1300000644000175000017500000207141507743336601015257 0ustar renereneBEGIN NETGEN PROBLEM 130 5000 NODES AND 12500 ARCS USER: 25440925 500 500 1 100 250000 DATA: 500 500 0 100 1 1000 SUPPLY 1 223 2 220 3 1103 4 75 5 800 6 392 7 132 8 622 9 309 10 145 11 113 12 206 13 427 14 480 15 797 16 963 17 339 18 865 19 826 20 1291 21 117 22 481 23 547 24 837 25 935 26 34 27 354 28 390 29 1016 30 934 31 693 32 411 33 137 34 800 35 48 36 854 37 817 38 756 39 523 40 1074 41 507 42 440 43 256 44 22 45 569 46 341 47 410 48 129 49 1269 50 570 51 456 52 320 53 415 54 105 55 445 56 863 57 104 58 620 59 300 60 286 61 435 62 87 63 97 64 435 65 773 66 137 67 99 68 792 69 544 70 558 71 275 72 467 73 350 74 477 75 1231 76 486 77 773 78 422 79 526 80 402 81 602 82 262 83 321 84 1135 85 459 86 915 87 505 88 193 89 1133 90 500 91 742 92 403 93 442 94 1077 95 552 96 398 97 292 98 1180 99 449 100 618 101 623 102 695 103 312 104 447 105 420 106 758 107 880 108 846 109 694 110 804 111 411 112 299 113 395 114 120 115 702 116 269 117 703 118 619 119 172 120 689 121 341 122 699 123 735 124 4 125 764 126 735 127 271 128 564 129 28 130 32 131 822 132 654 133 561 134 644 135 621 136 392 137 964 138 108 139 394 140 1149 141 284 142 433 143 346 144 168 145 982 146 790 147 469 148 287 149 427 150 763 151 407 152 323 153 776 154 1109 155 896 156 288 157 680 158 1632 159 385 160 364 161 1053 162 382 163 582 164 378 165 217 166 412 167 378 168 371 169 420 170 1017 171 719 172 24 173 476 174 692 175 334 176 426 177 26 178 71 179 45 180 97 181 619 182 803 183 236 184 293 185 571 186 497 187 390 188 451 189 545 190 524 191 27 192 402 193 468 194 721 195 497 196 584 197 630 198 755 199 308 200 853 201 1693 202 1352 203 224 204 247 205 688 206 585 207 334 208 526 209 399 210 270 211 826 212 150 213 472 214 545 215 275 216 732 217 675 218 351 219 897 220 572 221 270 222 68 223 843 224 352 225 395 226 584 227 192 228 379 229 325 230 843 231 105 232 978 233 446 234 102 235 315 236 368 237 293 238 391 239 816 240 456 241 490 242 123 243 146 244 498 245 595 246 229 247 761 248 520 249 1198 250 463 251 497 252 529 253 913 254 543 255 584 256 193 257 614 258 449 259 1 260 612 261 349 262 355 263 511 264 1586 265 383 266 192 267 92 268 842 269 601 270 39 271 276 272 363 273 371 274 53 275 486 276 348 277 407 278 647 279 417 280 1070 281 32 282 887 283 387 284 339 285 882 286 400 287 410 288 534 289 932 290 367 291 747 292 470 293 202 294 680 295 354 296 730 297 451 298 408 299 559 300 1159 301 153 302 260 303 689 304 914 305 83 306 256 307 52 308 194 309 1290 310 473 311 717 312 163 313 728 314 756 315 353 316 294 317 316 318 213 319 698 320 407 321 416 322 385 323 532 324 277 325 593 326 972 327 694 328 289 329 1387 330 296 331 922 332 184 333 535 334 1428 335 384 336 271 337 74 338 427 339 400 340 584 341 411 342 656 343 453 344 327 345 729 346 265 347 663 348 968 349 246 350 250 351 144 352 189 353 713 354 317 355 439 356 404 357 937 358 218 359 803 360 333 361 215 362 217 363 757 364 437 365 888 366 318 367 104 368 358 369 451 370 451 371 135 372 753 373 273 374 22 375 284 376 15 377 1020 378 326 379 436 380 360 381 389 382 949 383 311 384 990 385 75 386 563 387 481 388 546 389 455 390 356 391 496 392 525 393 682 394 215 395 632 396 339 397 91 398 326 399 8 400 413 401 448 402 597 403 854 404 227 405 337 406 326 407 402 408 212 409 265 410 415 411 239 412 659 413 603 414 827 415 28 416 309 417 384 418 115 419 386 420 342 421 523 422 309 423 204 424 264 425 632 426 692 427 930 428 648 429 404 430 264 431 1014 432 298 433 498 434 36 435 141 436 957 437 574 438 507 439 257 440 531 441 1178 442 689 443 445 444 422 445 1222 446 404 447 516 448 298 449 359 450 196 451 394 452 412 453 276 454 484 455 635 456 204 457 826 458 169 459 361 460 906 461 1143 462 484 463 670 464 248 465 94 466 109 467 506 468 718 469 381 470 1110 471 414 472 1002 473 327 474 452 475 379 476 315 477 1012 478 572 479 421 480 653 481 492 482 485 483 91 484 667 485 793 486 192 487 631 488 404 489 635 490 60 491 252 492 739 493 117 494 412 495 804 496 472 497 672 498 833 499 1251 500 638 ARCS 1 1890 47 223 1 1745 90 194 1 2252 68 612 505 3498 71 223 505 4707 94 223 505 2628 71 375 941 3285 33 223 941 649 1 308 941 1930 21 351 1730 2231 5 223 1730 2634 42 263 1730 167 50 156 1890 505 61 223 1890 1204 93 959 2231 4450 90 223 2231 1227 77 670 2231 2893 61 898 3285 1730 90 223 3285 2960 2 572 3285 2496 79 227 3498 941 63 223 3498 570 14 579 3498 3089 5 165 4450 4932 35 223 4450 2364 18 89 4450 1331 34 61 2 3149 96 220 2 4853 6 753 1256 3667 25 220 1256 4279 83 645 1256 3207 53 466 2358 4513 73 220 2358 202 63 151 2770 4472 36 220 2770 2837 91 401 3149 3856 15 220 3149 1948 55 604 3149 2839 94 172 3667 2358 69 220 3667 3172 12 305 3667 3591 70 846 3856 4243 52 220 3856 4684 33 220 3856 3273 39 430 4243 2770 30 220 4243 837 85 347 4243 4038 95 343 4472 1256 78 220 4472 2370 2 984 3 3225 42 1103 3 2531 61 326 3 433 2 3 2280 3684 82 1103 2280 715 53 919 2280 514 41 275 2608 3932 17 1103 2608 2138 64 293 2608 1694 49 504 3225 3734 36 1103 3225 3688 86 893 3365 2280 5 1103 3365 4245 17 654 3684 2608 99 1103 3684 4319 1 377 3684 1271 64 104 3734 3365 72 1103 3734 4578 94 1103 3734 3581 65 175 3734 484 57 539 3932 4774 95 1103 3932 820 31 479 3932 3144 36 30 4 3408 51 75 4 1634 14 68 4 4261 21 402 683 4122 86 75 683 4788 98 75 683 4142 75 57 683 1337 77 506 1857 2877 31 75 1857 2111 22 479 1857 1672 7 908 2160 683 89 75 2160 1842 56 797 2877 4822 46 75 2877 4887 67 45 3408 2160 24 75 3408 2475 7 705 3408 2044 30 727 4122 1857 35 75 4122 1102 23 480 5 2037 20 800 5 3900 58 72 5 4855 99 527 859 4848 37 800 859 2944 29 40 859 3611 46 806 864 859 51 800 864 1514 29 725 864 360 95 421 1516 4074 39 800 1516 878 3 910 1516 890 53 47 1950 864 16 800 1950 4648 80 800 1950 1965 76 897 2037 3311 71 800 2037 2166 99 478 3311 1516 44 800 3311 104 62 576 3311 4481 77 158 3786 1950 38 800 3786 159 38 685 3786 3893 27 47 4074 3786 24 800 4074 2348 71 720 6 1315 57 392 6 3193 78 763 521 2260 90 392 521 3029 27 210 1315 2412 30 392 1315 2691 77 852 1315 3526 24 565 2260 2737 62 392 2260 4233 61 486 2412 4019 99 392 2412 1325 75 322 2412 488 44 558 2641 4464 38 392 2641 4649 45 756 2641 1336 25 238 2737 2641 25 392 2737 3789 14 65 2737 378 43 616 2818 4008 20 392 2818 1081 19 814 2818 280 5 694 4008 521 1 392 4008 3922 48 516 4019 2818 83 392 4019 4776 12 392 4019 1938 65 532 4464 4634 88 392 4464 305 23 632 7 3805 73 132 7 2369 76 718 714 3037 87 132 714 1258 71 90 2715 4016 11 132 2715 4484 79 988 2715 1299 58 621 3037 4663 68 132 3037 3922 34 170 3037 2295 45 980 3733 2715 72 132 3733 1463 6 424 3805 4205 17 132 3805 4730 76 132 3805 3271 56 196 4016 714 24 132 4016 1210 69 380 4016 2371 61 209 4205 3733 90 132 4205 2075 10 677 4205 4365 95 361 8 2573 32 622 8 265 96 567 8 2946 23 597 1265 1299 50 622 1265 1230 18 451 1299 3374 13 622 1299 4280 61 408 1299 459 59 186 1326 4821 7 622 1326 4788 37 622 1326 1052 47 231 1326 1812 100 433 2573 3698 82 622 2573 1276 99 401 3374 1326 52 622 3374 4855 58 489 3698 1265 46 622 3698 653 41 113 9 2743 8 309 9 721 55 372 580 1398 98 309 580 4563 16 33 580 3738 66 973 1226 4640 45 309 1226 4243 80 667 1398 3675 94 309 1398 229 78 249 2203 2594 68 309 2203 4043 16 851 2203 857 37 514 2291 3081 63 309 2291 2627 94 252 2291 3559 89 982 2594 2291 34 309 2594 4656 12 309 2594 745 54 682 2602 2203 55 309 2602 3319 91 771 2743 580 13 309 2743 3750 42 94 3081 1226 65 309 3081 570 53 162 3675 2602 55 309 3675 1871 59 328 10 928 55 145 10 2851 51 732 10 2902 16 315 699 3326 64 145 699 4752 53 10 928 4458 11 145 928 4497 82 450 928 952 66 863 1663 3769 59 145 1663 576 49 256 3326 3817 47 145 3326 4344 69 141 3326 3536 30 702 3550 3867 34 145 3550 3793 41 534 3769 3550 82 145 3769 4795 92 145 3769 2302 9 817 3769 3809 88 349 3817 4596 68 145 3817 1627 100 326 3867 699 20 145 3867 2216 13 13 3867 1415 17 931 4458 1663 79 145 4458 3546 100 624 11 609 79 113 11 3674 75 260 11 4712 21 389 609 3975 63 113 609 2367 41 146 2190 2966 39 113 2190 3788 100 811 2190 4752 39 12 2748 3889 15 113 2748 2441 26 516 2748 3825 74 667 2832 3236 45 113 2832 4130 47 134 2832 447 34 941 2966 3963 54 113 2966 4560 94 189 3236 2748 40 113 3236 2307 22 333 3236 4629 41 916 3889 2190 35 113 3889 4118 48 172 3963 4524 42 113 3963 4739 30 113 3963 1077 38 589 3975 2832 7 113 3975 578 97 293 3975 4418 45 880 12 1959 7 206 12 321 43 854 12 586 28 298 1959 3989 66 206 1959 3783 74 508 2413 4730 1 206 2413 3221 5 206 2413 4688 34 37 2990 2413 32 206 2990 2386 68 56 2990 833 78 110 3039 4107 89 206 3039 4793 57 106 3039 328 60 358 3221 3484 4 206 3221 3605 4 179 3484 3760 86 206 3484 2298 80 497 3484 1964 55 761 3760 4518 38 206 3760 2698 94 508 3760 1927 66 694 3989 3039 30 206 3989 2577 34 305 4107 2990 48 206 4107 1964 22 218 4107 4722 21 276 13 3789 28 427 13 4977 8 84 741 2359 47 427 741 2114 26 351 741 1350 97 675 1090 4651 98 427 1090 2134 7 137 1090 1865 14 820 1551 3036 87 427 1551 1157 80 775 1551 3476 70 230 1885 1551 30 427 1885 4891 34 214 2359 3956 22 427 2359 3563 23 54 2799 741 11 427 2799 1066 32 84 2799 2255 33 447 3036 1090 9 427 3036 4640 52 427 3036 4898 55 884 3789 2799 23 427 3789 4552 85 207 3956 1885 16 427 3956 1336 53 744 3956 2873 20 242 14 2070 1 480 14 4783 56 820 14 2062 84 32 2053 3584 53 480 2053 2633 76 657 2070 3088 57 480 2070 3355 9 217 2070 1278 14 707 2092 4916 60 480 2092 3997 37 842 3088 4181 76 480 3088 2766 60 763 3584 2092 9 480 3584 422 26 69 4181 2053 99 480 4181 4874 11 480 4181 3870 26 759 4181 3938 20 814 15 3785 3 797 15 2265 67 471 15 1304 59 113 587 658 87 797 587 3791 23 185 658 4110 12 797 658 1445 65 69 658 4126 90 724 726 857 9 797 726 1085 60 104 726 4105 95 13 857 587 81 797 857 4974 45 797 857 1412 66 385 857 4441 20 230 1738 4242 8 797 1738 2194 82 647 2454 4965 57 797 2454 8 24 559 3785 726 58 797 3785 3286 34 208 3785 2162 81 681 4110 1738 99 797 4110 3466 16 607 4110 1027 9 4 4242 2454 55 797 4242 2802 81 214 16 2713 68 963 16 2425 2 2 541 4655 82 963 541 2793 33 963 541 1084 57 402 541 1056 35 72 681 3351 36 963 681 4280 82 741 681 2257 100 514 1130 2064 54 963 1130 3856 17 328 1130 2286 1 697 2064 3806 7 963 2064 4586 90 963 2064 2927 44 399 2083 681 81 963 2083 4034 14 781 2083 3692 17 329 2713 541 65 963 2713 2456 16 2 2793 3811 14 963 2793 912 39 559 3331 2083 60 963 3331 3700 95 148 3351 3658 7 963 3351 3122 29 810 3351 133 72 668 3658 4719 51 963 3658 1969 21 307 3658 1951 62 365 3806 4358 21 963 3806 2538 53 955 3811 1130 55 963 3811 1971 12 511 4358 3331 71 963 4358 3762 84 208 4358 2800 67 139 17 3009 71 339 17 2373 26 939 17 629 3 38 559 2633 38 339 559 4107 95 887 1610 3588 63 339 1610 1247 27 480 1610 1184 57 133 1694 2652 43 339 1694 4901 91 766 1694 4972 8 139 1864 4981 18 339 1864 4836 81 339 1864 339 33 138 2633 1694 99 339 2633 889 72 547 2633 315 93 255 2652 4133 24 339 2652 3483 42 711 2652 1340 68 19 2939 1864 81 339 2939 2101 39 359 2939 431 65 368 3009 559 39 339 3009 803 90 67 3588 2939 76 339 3588 2656 97 123 4133 1610 64 339 4133 4576 39 371 18 1662 78 865 18 3741 4 401 1155 4588 18 865 1155 3272 11 356 1662 4901 87 865 1662 4432 57 865 1662 4319 77 186 1676 3847 25 865 1676 3898 33 556 1911 2680 76 865 1911 177 35 495 2680 1676 99 865 2680 832 52 121 3847 4196 77 865 3847 3230 26 559 3847 3187 28 702 4196 1155 95 865 4196 2598 36 191 4196 2774 99 249 4432 1911 40 865 4432 180 58 30 4432 499 29 222 19 3610 77 826 19 3267 7 860 630 1214 86 826 630 4134 58 353 845 3372 59 826 845 2587 22 735 1101 4948 81 826 1101 630 80 826 1101 3243 90 434 1101 1994 98 356 1214 845 6 826 1214 4503 32 965 2693 3346 77 826 2693 2633 66 44 2693 4799 24 88 3346 3482 11 826 3346 2527 98 789 3372 4925 41 826 3372 1536 79 31 3372 2936 32 283 3482 1101 68 826 3482 289 67 875 3610 2693 88 826 3610 3190 94 4 3610 3966 43 734 20 3791 46 1291 20 2288 69 488 633 2383 12 1291 633 209 8 673 1309 1441 43 1291 1309 521 96 478 1441 3428 12 1291 1441 3278 15 224 1937 4987 69 1291 1937 3362 84 1291 1937 1364 33 214 2383 1937 23 1291 2383 702 95 467 3234 633 14 1291 3234 1150 14 269 3362 4651 97 1291 3362 184 1 27 3428 3234 6 1291 3428 1060 62 583 3428 3282 18 76 3791 1309 37 1291 3791 4565 10 757 3791 2018 42 773 21 3582 73 117 21 3167 62 463 990 2685 74 117 990 4158 96 572 1157 3155 69 117 1157 143 64 275 1157 4362 94 767 1473 4815 80 117 1473 105 40 383 1473 3025 98 348 1669 4590 75 117 1669 990 55 117 1669 2942 83 910 1669 4649 90 252 2522 1157 65 117 2522 2383 54 633 2685 4398 10 117 2685 4538 35 736 2685 1740 8 951 3155 1473 31 117 3155 1577 38 923 3155 1991 29 277 3412 2522 61 117 3412 2179 74 811 3582 4305 92 117 3582 2058 42 483 3582 4129 98 816 4305 1669 25 117 4305 303 92 414 4305 221 14 989 4398 3412 41 117 4398 2947 25 871 22 3778 14 481 22 900 48 461 803 4738 52 481 803 4571 53 481 803 2873 28 461 1216 2035 5 481 1216 4115 99 436 1216 4443 79 59 2035 2103 31 481 2035 2779 90 661 2084 4299 100 481 2084 1541 3 810 2103 2084 22 481 2103 3419 73 332 3048 803 64 481 3048 4506 52 655 3048 1767 85 482 3778 1216 41 481 3778 4603 41 897 3778 657 19 61 4299 3048 49 481 4299 1121 28 860 4299 1549 77 724 23 2534 69 547 23 1265 74 141 661 1053 21 547 661 504 47 897 1053 2735 41 547 1053 4992 41 15 1053 4483 100 523 1191 4867 59 547 1191 1193 12 547 1191 2700 13 928 1191 367 28 456 1193 3725 40 547 1193 945 7 373 1193 4005 59 850 1471 1191 2 547 1471 4584 88 595 1471 83 22 739 2534 1471 50 547 2534 3661 12 715 2735 4966 35 547 2735 1322 43 577 3725 661 48 547 3725 390 27 436 24 4457 47 837 24 4668 34 873 24 429 17 101 543 1437 18 837 543 4928 63 837 543 1307 70 824 1437 4866 97 837 1437 1758 36 524 2372 543 9 837 2372 4117 28 703 3264 4046 64 837 3264 873 81 406 3264 1517 55 135 3646 3731 88 837 3646 2221 30 246 3646 4595 20 494 3731 3264 71 837 3731 927 73 792 3731 2397 40 747 4046 2372 72 837 4046 634 36 861 4046 926 7 940 4457 3646 25 837 4457 1426 97 486 25 2894 36 935 25 809 2 584 1206 4932 38 935 1206 3131 1 935 1206 4086 70 875 1236 3393 13 935 1236 1195 72 363 1729 3141 13 935 1729 3841 67 468 1729 189 31 887 1770 1236 95 935 1770 2191 51 43 1770 4043 54 149 2342 3069 57 935 2342 4573 96 184 2342 3366 88 849 2843 4486 66 935 2843 1161 65 622 2894 1206 82 935 2894 4764 73 431 3069 4749 13 935 3069 3236 31 219 3131 1729 96 935 3131 4740 55 935 3131 3230 14 293 3131 143 6 848 3141 2843 13 935 3141 3303 4 85 3141 4616 93 1 3393 2342 55 935 3393 1114 24 672 4486 1770 20 935 4486 512 5 844 4486 2383 84 593 26 3964 23 34 26 88 89 25 26 3771 52 111 766 4431 99 34 766 4076 65 129 2115 2337 3 34 2115 1875 91 939 2115 102 71 353 2337 2765 11 34 2337 313 64 715 2337 1718 82 771 2765 4223 25 34 2765 4771 23 34 2765 1325 89 827 2765 4937 5 9 2789 766 18 34 2789 3674 98 648 3802 2789 29 34 3802 3973 99 625 3964 4203 11 34 3964 4253 67 942 3964 2583 47 275 4203 3802 97 34 4203 3843 16 197 4203 3364 99 239 4223 4916 55 34 4223 3397 62 977 4431 2115 15 34 4431 1414 69 985 27 3355 77 354 27 318 84 121 713 896 84 354 713 585 63 56 896 3314 31 354 896 1767 100 158 896 1772 71 441 1378 713 99 354 1378 4414 48 118 2209 1378 100 354 2209 1751 28 819 2209 4077 32 969 2842 2209 98 354 2842 4558 44 549 3314 4737 74 354 3314 4566 9 354 3314 3610 39 894 3314 4266 5 773 3355 2842 82 354 3355 2738 45 279 28 2340 50 390 28 1982 54 445 560 2334 91 390 560 1510 69 633 560 666 92 437 617 2686 36 390 617 2587 22 779 645 3807 37 390 645 1605 62 503 2122 617 53 390 2122 2762 61 59 2254 3154 17 390 2254 333 92 864 2254 3435 55 473 2316 2122 50 390 2316 2518 23 763 2334 2316 63 390 2334 4267 18 674 2340 2254 3 390 2340 3061 100 179 2340 4507 41 202 2686 645 1 390 2686 2929 79 826 3154 4610 12 390 3154 3538 37 390 3154 4792 92 390 3154 4611 27 271 3538 560 84 390 3538 4853 93 919 3538 1937 27 971 3807 4684 37 390 3807 3971 68 205 29 1844 11 1016 29 3884 99 824 563 3095 57 1016 563 3829 97 843 1453 563 15 1016 1453 3142 87 591 1844 2592 80 1016 1844 2843 6 110 1844 709 70 88 1928 4776 85 1016 1928 2803 69 1 1928 3326 31 604 2364 1928 98 1016 2364 4619 42 1016 2364 2473 71 126 2592 1453 72 1016 2592 4521 40 601 2592 2724 97 701 3095 2364 91 1016 3095 4927 98 568 30 1010 8 934 30 2846 60 424 30 150 26 269 738 1858 73 934 738 3868 12 68 738 4739 86 202 940 2759 71 934 940 1583 11 131 1010 3657 67 934 1010 2971 99 250 1010 2032 3 138 1202 940 18 934 1202 3707 54 977 1354 1202 50 934 1354 4869 46 402 1354 1572 70 15 1858 1884 21 934 1858 4829 60 934 1858 1583 33 228 1884 4777 63 934 1884 3888 38 554 1884 2302 45 475 2759 738 44 934 2759 186 46 16 2759 1726 68 458 3061 1354 69 934 3061 3047 70 388 3657 3061 29 934 3657 428 57 154 31 3585 56 693 31 2769 78 723 31 2254 90 998 1098 2549 46 693 1098 4765 15 654 1098 2717 34 551 1599 3521 54 693 1599 4951 60 351 2549 1599 46 693 2549 2542 49 814 2549 598 87 50 3359 4623 29 693 3359 394 39 846 3521 4389 29 693 3521 4017 20 64 3585 4683 33 693 3585 1098 12 693 3585 4715 12 895 3585 3642 83 718 4389 3359 43 693 4389 627 94 555 4389 4511 6 944 32 2825 46 411 32 2989 91 980 32 1897 68 9 1288 1615 24 411 1288 509 25 468 1288 2936 80 696 1615 3404 97 411 1615 3488 41 115 1615 3306 54 27 2133 1288 99 411 2133 4729 87 411 2133 3863 73 751 2133 4040 71 512 2825 3505 95 411 2825 4473 53 527 2825 3891 46 237 3404 4834 67 411 3404 3830 29 812 3404 2916 24 767 3505 2133 65 411 3505 4669 14 628 33 1176 8 137 33 4361 58 798 721 1294 31 137 721 4754 31 137 721 3277 97 408 1176 2038 82 137 1176 602 47 250 1294 1347 19 137 1294 125 98 413 1347 4647 79 137 1347 16 91 482 1347 2851 87 933 2038 2597 16 137 2038 669 70 798 2038 4531 67 123 2237 721 39 137 2237 123 69 216 2237 4967 81 591 2597 2237 3 137 2597 646 54 553 2597 406 92 542 34 2794 77 800 34 4830 9 908 1621 3767 20 800 1621 3714 67 28 1973 4244 45 800 1973 1898 75 241 2046 1973 9 800 2046 4724 1 863 2046 118 52 537 2227 4662 37 800 2227 4459 22 187 2227 3336 40 341 2794 2046 89 800 2794 2739 90 599 3157 1621 49 800 3157 3494 34 679 3767 2227 16 800 3767 4744 7 800 3767 4758 63 873 3767 108 74 694 4244 3157 30 800 4244 415 73 281 4244 4987 70 88 35 1564 72 48 35 782 20 274 35 4287 64 419 1037 1934 67 48 1037 4996 20 12 1037 1692 64 363 1491 3086 32 48 1491 2746 11 353 1491 3621 57 92 1564 3918 54 48 1564 3481 45 900 1564 4688 74 847 1934 4622 31 48 1934 2244 75 48 1934 3761 73 563 2055 1491 20 48 2055 201 21 38 2244 2055 2 48 2244 3991 51 879 2244 3475 70 551 3086 4611 70 48 3086 2405 47 654 3274 1037 9 48 3274 433 64 259 3918 3274 18 48 3918 2824 7 248 36 1696 4 854 36 2848 31 1 36 290 28 614 1148 2960 84 854 1148 3924 89 820 1496 1602 49 854 1496 3642 4 280 1602 3091 60 854 1602 4234 70 312 1696 1148 93 854 1696 3222 15 496 1696 1215 7 858 2960 1496 96 854 2960 4626 61 854 2960 698 43 688 2960 2782 32 372 3091 4894 91 854 3091 628 71 276 3091 251 86 953 37 2345 91 817 37 3013 51 683 1590 4423 14 817 1590 2464 8 613 1590 1745 7 503 1979 4828 7 817 1979 2257 23 35 1979 4348 83 120 2345 1590 46 817 2345 3215 14 872 2345 1180 76 400 2520 2682 49 817 2520 4436 50 295 2682 2970 93 817 2682 4471 51 731 2682 4480 27 149 2970 1979 57 817 2970 4300 64 61 4423 2520 63 817 4423 4892 68 817 4423 725 59 15 4423 4290 23 799 38 829 79 756 38 3503 67 779 746 2810 28 756 746 4212 67 550 746 54 84 390 829 2542 89 756 829 2095 15 630 829 382 24 86 1394 746 54 756 1394 2185 91 484 1394 3163 33 187 1896 4834 90 756 1896 4926 47 756 1896 428 59 433 1896 2645 95 507 2397 2598 69 756 2397 4720 12 42 2542 1394 19 756 2542 4653 36 898 2542 2690 14 265 2598 2965 34 756 2598 827 96 888 2810 2397 62 756 2810 4491 48 6 2810 1478 99 113 2965 1896 96 756 2965 845 75 851 2965 4859 48 396 39 2567 59 523 39 3648 49 726 39 3825 63 948 1054 3118 44 523 1054 1625 1 467 2567 3818 45 523 2567 2959 89 834 2567 1602 93 144 3118 3873 31 523 3118 4637 28 523 3118 3543 50 330 3118 4222 45 497 3818 1054 76 523 3818 4726 100 727 3818 98 70 6 3873 4970 91 523 3873 2000 95 380 3873 635 45 472 40 4274 99 1074 40 2809 28 357 725 4100 70 1074 725 4451 64 946 1654 2888 92 1074 1654 1221 24 529 1654 2703 58 368 2047 4607 100 1074 2047 3772 63 212 2047 4680 88 842 2888 2047 48 1074 2888 4876 3 623 2888 1160 22 191 3909 725 19 1074 3909 3232 1 840 4100 1654 88 1074 4100 4706 56 1074 4100 203 43 426 4100 1749 25 426 4274 3909 39 1074 4274 2248 63 485 41 3449 56 507 41 397 81 544 41 1861 20 632 1081 1616 4 507 1081 4 39 423 1106 4774 87 507 1106 3689 13 783 1106 1812 71 237 1483 1618 41 507 1483 890 28 476 1483 3393 73 447 1616 1752 9 507 1616 1551 61 983 1618 3105 35 507 1618 4080 7 261 1618 4920 57 111 1625 1982 62 507 1625 4272 65 195 1736 4597 94 507 1736 4516 7 507 1736 1625 52 507 1736 503 80 731 1736 3257 4 361 1752 1483 82 507 1752 3205 51 988 1752 3889 98 222 1982 2524 22 507 1982 4474 87 611 2524 1081 37 507 2524 389 35 262 2524 1375 34 833 3105 1106 81 507 3105 4638 20 238 3105 804 25 188 3449 1736 97 507 3449 2279 80 137 3449 1044 15 141 42 2077 67 440 42 4332 100 141 613 4919 27 440 613 1899 66 519 1681 4160 91 440 1681 3786 56 163 2077 2706 40 440 2077 959 30 200 2077 3667 35 424 2197 613 21 440 2197 4641 64 440 2197 4096 22 518 2706 1681 85 440 2706 2325 81 152 3106 2197 52 440 3106 1384 4 469 3106 2615 19 359 4160 3106 82 440 4160 2284 21 160 43 2021 87 256 43 1635 22 683 43 1329 26 210 823 2089 78 256 823 2676 33 796 1503 4794 79 256 1503 2656 65 256 1503 4115 14 196 1503 2627 64 743 2021 2915 9 256 2021 4760 25 425 2021 4047 75 325 2089 1503 96 256 2089 3708 89 189 2089 2977 15 488 2208 4700 55 256 2208 445 73 623 2208 303 37 855 2656 2208 66 256 2656 3339 96 872 2915 823 55 256 2915 4917 69 269 2915 1994 100 708 44 690 67 22 44 1066 29 199 44 3296 48 687 626 2181 71 22 626 4649 76 22 626 1886 27 838 690 626 82 22 690 3598 71 335 690 3316 1 596 1905 3323 3 22 1905 3004 1 985 1905 1010 23 51 2181 2343 2 22 2181 2100 89 716 2181 3750 62 955 2343 1905 50 22 2343 2871 89 974 2343 2443 38 573 3323 3702 59 22 3323 3031 95 425 3702 4206 93 22 3702 841 45 19 4206 4650 76 22 4206 1552 27 596 4206 2502 71 17 45 1079 52 569 45 922 37 300 592 4803 16 569 592 3624 25 48 592 3722 80 88 706 592 9 569 706 3615 46 729 768 4076 30 569 768 1924 18 215 768 2998 6 202 819 706 95 569 819 3972 72 985 819 4224 52 352 1079 4889 8 569 1079 768 87 569 1079 1151 79 131 1702 819 65 569 1702 3541 7 483 1887 2437 49 569 1887 3033 80 429 2437 1702 10 569 2437 3282 86 449 2437 4751 33 886 4076 1887 5 569 4076 2663 8 711 46 2891 93 341 46 4458 48 81 1022 4972 75 341 1022 1045 49 341 1022 2418 13 953 1045 3912 39 341 1045 1869 58 256 1493 3248 33 341 1493 4138 65 397 1787 1493 66 341 1787 3113 64 654 2891 3467 7 341 2891 1947 32 398 3248 4700 90 341 3248 4937 49 804 3248 4185 15 223 3467 1022 94 341 3467 3537 87 390 3467 536 28 396 3912 1787 55 341 3912 3383 6 358 47 2683 39 410 47 320 49 882 679 3860 94 410 679 1966 27 118 679 3483 57 990 1308 4580 34 410 1308 3612 16 410 1308 1960 24 827 1308 2161 52 838 2683 679 79 410 2683 3492 19 918 3001 1308 2 410 3001 3893 68 788 3612 4286 44 410 3612 4230 45 461 3612 4093 40 20 3674 4979 37 410 3674 896 44 524 3674 1309 41 196 3860 3001 38 410 3860 1443 87 266 3860 2255 66 81 4232 3674 67 410 4232 3687 59 364 4232 1782 10 109 4286 4232 15 410 4286 392 51 959 48 2385 11 129 48 707 31 118 729 3792 77 129 729 2665 82 588 729 4717 23 809 2385 3960 91 129 2385 769 58 905 2385 1296 84 628 2387 4887 70 129 2387 1475 92 175 2869 4168 20 129 2869 1753 77 91 2869 151 16 373 3503 2869 85 129 3503 650 94 423 3503 613 24 725 3792 2387 7 129 3792 2555 42 906 3960 4888 59 129 3960 4322 93 129 3960 4948 81 708 3960 2367 25 551 4036 3503 77 129 4036 2959 34 506 4168 729 95 129 4168 4034 33 89 4168 266 88 723 4322 4036 88 129 4322 3 21 160 4322 4094 48 418 49 831 52 1269 49 4763 79 982 49 112 59 271 518 1259 68 1269 518 617 70 841 518 1359 70 261 831 4098 33 1269 831 1415 41 93 1170 2605 6 1269 1170 3414 3 114 1182 518 28 1269 1182 4911 59 649 1259 1726 31 1269 1259 4868 38 770 1671 4705 51 1269 1671 4843 61 1269 1671 2219 63 741 1671 3913 49 816 1726 1170 83 1269 1726 279 41 235 1726 171 84 55 2605 1671 93 1269 2605 2151 56 170 4098 1182 23 1269 4098 3460 32 877 4098 1990 74 206 50 736 67 570 50 689 49 520 50 4628 87 256 736 1069 61 570 736 866 78 533 1041 4041 81 570 1041 4857 3 575 1041 4917 44 924 1069 1041 75 570 1069 2729 18 666 1983 2773 71 570 1983 4799 34 570 1983 4945 95 261 1983 905 11 965 2773 4754 15 570 2773 3892 38 182 4041 1983 6 570 4041 3488 52 471 4041 4606 45 649 51 4422 85 456 51 3598 3 180 51 4132 86 142 1513 3060 24 456 1513 3803 88 786 1608 4139 2 456 1608 846 37 403 2068 1608 26 456 2068 4811 36 456 2068 3222 9 730 3060 4999 23 456 3060 2524 56 227 3060 4274 33 767 4139 1513 74 456 4139 3143 96 624 4422 2068 74 456 4422 1284 66 479 4422 1505 42 635 52 3133 7 320 52 1910 43 481 52 811 21 836 1000 1865 59 320 1000 195 41 151 1000 1768 68 366 1529 1000 94 320 1529 610 85 990 1865 4715 61 320 1865 1574 38 4 2245 1529 65 320 2245 949 2 327 2769 2245 78 320 2769 814 11 339 2957 4485 10 320 2957 408 93 874 2957 655 40 584 3133 3524 12 320 3133 3451 75 611 3133 4482 57 50 3448 2957 5 320 3448 4934 48 320 3448 4273 29 268 3448 4348 19 797 3524 3448 40 320 3524 4545 42 788 4485 2769 98 320 4485 377 80 435 53 2073 98 415 53 3346 73 301 53 1342 48 348 739 3864 100 415 739 2868 60 828 739 39 58 677 814 4923 80 415 814 2812 4 678 1881 3361 31 415 1881 4213 2 866 2032 739 22 415 2032 3538 23 391 2073 4215 92 415 2073 2024 13 930 2073 712 17 366 2433 814 77 415 2433 1467 8 561 2433 2861 80 395 3361 4026 74 415 3361 4527 18 415 3361 4942 40 113 3361 1488 4 395 3864 2433 89 415 3864 3304 78 632 4026 2032 45 415 4026 2360 60 900 4215 1881 86 415 4215 4976 42 811 4215 4052 82 551 54 3488 82 105 54 3267 82 322 1637 4384 11 105 1637 502 55 571 1637 4616 96 636 1886 2130 48 105 1886 1918 49 536 1977 1637 10 105 1977 1861 20 902 2130 4820 64 105 2130 142 59 874 3488 4593 35 105 3488 1977 15 105 3488 2491 9 984 4384 1886 75 105 4384 3337 67 909 55 1163 96 445 55 1296 46 957 55 4058 17 439 603 2477 43 445 603 2582 98 323 603 2797 7 370 1126 603 15 445 1126 1352 28 458 1126 223 89 748 1163 3640 61 445 1163 739 20 289 1275 1126 64 445 1275 1885 53 343 1275 738 87 438 1283 3442 45 445 1283 2625 98 204 1584 4762 79 445 1584 4701 37 445 1584 1740 58 710 2477 1584 93 445 2477 3216 93 870 3442 1275 9 445 3442 3694 21 575 3489 1283 67 445 3489 4987 41 12 3489 2740 27 196 3640 3489 22 445 3640 1046 59 665 3640 3084 58 498 56 3594 78 863 56 2228 77 437 860 4304 98 863 860 4602 90 863 860 3131 74 416 860 3277 97 610 912 2752 78 863 912 4897 42 445 912 3106 99 23 2752 860 53 863 2752 1607 38 677 3003 4594 57 863 3003 3133 12 205 3003 4846 26 471 3349 912 96 863 3349 3759 54 971 3349 2706 97 660 3594 3349 81 863 3594 4409 40 36 3594 4462 88 261 4304 3003 57 863 4304 2786 24 430 4304 2732 100 468 57 4329 93 104 57 3653 23 686 57 369 55 298 1776 2666 82 104 1776 4366 49 624 1776 1710 8 400 1941 3161 72 104 1941 4800 10 104 1941 287 48 991 1941 1086 11 840 1952 1776 14 104 1952 714 72 62 2666 4734 36 104 2666 4359 3 261 3161 4342 78 104 3161 4778 30 960 3161 1180 21 761 3876 1952 44 104 3876 3034 70 104 3876 2921 92 133 4329 1941 30 104 4329 3528 74 872 4342 3876 11 104 4342 737 3 397 58 4273 55 620 58 66 85 33 58 3027 30 167 2097 3231 6 620 2097 1633 90 546 2097 1925 76 513 2488 2097 100 620 2488 3135 72 819 2488 3412 20 329 3089 3202 27 620 3089 2693 53 370 3089 4454 97 961 3202 3224 94 620 3202 3935 1 466 3224 4569 63 620 3224 1096 34 917 3224 3894 4 791 3231 3451 58 620 3231 4797 56 243 3231 2411 45 177 3451 4343 64 620 3451 4940 62 620 3451 2881 44 225 3451 1564 37 100 4273 2488 25 620 4273 1289 97 902 4343 3089 31 620 4343 1132 74 677 4343 2234 33 142 59 2523 21 300 59 4912 50 128 59 1419 19 300 1205 2110 3 300 1205 102 28 616 1305 2375 15 300 1305 4581 78 674 2110 4505 36 300 2110 1305 21 300 2110 4032 88 487 2375 4829 33 300 2375 1027 26 645 2523 1205 78 300 2523 4168 38 806 60 1061 97 286 60 2677 12 71 1061 3241 46 286 1061 199 19 311 1061 498 23 238 1832 2673 98 286 1832 2189 98 186 1832 4795 10 893 2257 1832 55 286 2257 72 87 587 2673 4720 48 286 2673 2709 75 498 2673 812 9 966 2852 4860 73 286 2852 3175 55 286 2852 1221 9 519 3175 4461 28 286 3175 4032 60 705 3241 2852 69 286 3241 2373 85 517 3241 4544 61 258 4461 2257 93 286 4461 770 90 63 61 1250 83 435 61 3215 52 624 853 1703 49 435 853 4587 76 435 853 4742 52 223 853 2132 7 837 1250 853 51 435 1250 2087 3 773 1642 1876 27 435 1642 476 86 887 1642 3153 81 22 1703 1642 51 435 1703 1191 76 648 1703 49 70 89 1840 4603 85 435 1840 2050 83 521 1876 1840 65 435 1876 2208 77 633 62 3309 9 87 62 1942 79 920 62 3568 53 381 608 2161 23 87 608 4530 50 822 869 1823 74 87 869 3054 90 511 1269 2117 7 87 1269 4954 77 941 1269 4888 12 115 1296 869 54 87 1296 4273 100 677 1823 3005 54 87 1823 1083 75 793 2117 3162 4 87 2117 2757 35 722 2161 4860 55 87 2161 3921 4 832 3005 1269 28 87 3005 4285 20 16 3005 4287 8 593 3162 608 90 87 3162 455 22 967 3162 3909 40 926 3309 1296 49 87 3309 4966 31 87 3309 782 53 985 3309 4448 88 294 63 3454 86 97 63 638 63 630 1403 3243 61 97 1403 1559 6 502 1820 3208 43 97 1820 559 78 466 2419 4796 27 97 2419 4603 61 97 2419 3740 11 470 2419 4129 38 45 3208 3302 77 97 3208 2553 36 354 3208 439 95 431 3243 1820 58 97 3243 3795 9 260 3302 2419 52 97 3302 2706 32 398 3302 4356 90 158 3454 4394 67 97 3454 1459 48 190 3454 565 91 112 4394 1403 1 97 4394 4806 92 587 64 1925 100 435 64 305 62 484 837 4637 99 435 837 4972 90 435 837 1592 25 557 1032 2365 87 435 1032 748 65 242 1032 4487 89 863 1925 3996 98 435 1925 612 63 423 2264 3514 13 435 2264 1353 17 411 2365 837 7 435 2365 2697 14 954 3514 1032 79 435 3514 3878 59 966 3996 2264 35 435 3996 262 31 909 65 2164 93 773 65 1415 53 502 65 2070 16 376 841 4400 1 773 841 1984 37 785 841 3727 28 374 893 3948 48 773 893 3871 37 777 893 4641 76 243 1036 3308 74 773 1036 4033 70 625 1036 4103 53 850 1812 4567 11 773 1812 3367 87 289 2164 841 24 773 2164 1199 86 255 3308 893 75 773 3308 2179 74 774 3308 708 99 202 3948 1812 70 773 3948 4554 41 773 3948 3541 34 928 4400 1036 34 773 4400 4887 93 405 4400 1783 46 65 66 3072 83 137 66 3650 87 350 66 1791 22 190 590 4593 92 137 590 2433 52 64 590 4904 74 151 2615 4126 23 137 2615 4509 55 259 2615 289 75 744 3072 3136 92 137 3072 2589 35 6 3136 3344 61 137 3136 1095 48 726 3344 4875 51 137 3344 3592 74 137 3344 3991 40 431 3592 4010 100 137 3592 2868 87 636 3592 1704 23 941 4010 2615 33 137 4010 2707 63 258 4126 590 6 137 4126 2656 93 897 67 3090 6 99 67 84 17 240 67 3155 62 118 1183 3743 90 99 1183 2073 69 980 2378 2824 79 99 2378 1857 45 773 2378 3229 44 126 2824 3581 70 99 2824 2975 68 257 2824 42 1 695 3090 2378 4 99 3090 92 47 815 3090 4016 26 584 3411 3961 7 99 3411 4708 42 99 3411 439 29 152 3411 587 41 59 3581 3411 45 99 3581 2234 22 470 3743 4733 97 99 3743 1519 2 793 3961 1183 92 99 3961 1054 34 250 68 1111 52 792 68 734 28 318 68 118 36 853 591 4388 20 792 591 2805 54 228 838 3038 57 792 838 97 78 544 861 2054 41 792 861 1963 37 996 861 1123 28 665 1111 3718 1 792 1111 1459 71 689 1111 592 17 290 1978 838 88 792 1978 762 32 884 1978 674 56 781 2054 1978 12 792 2054 1869 14 835 2054 4450 6 708 2314 4527 79 792 2314 3221 67 465 2314 3227 56 185 3038 591 59 792 3038 4955 70 792 3038 777 12 603 3038 2711 2 45 3718 861 8 792 3718 3504 68 528 4388 2314 42 792 4388 2991 26 849 4388 1894 24 105 69 751 81 544 69 3944 47 339 751 1333 24 544 751 22 81 656 751 2806 95 124 1310 3121 83 544 1310 3636 76 556 1333 3732 45 544 1333 4301 56 823 1333 360 35 655 2152 1310 5 544 2152 499 6 103 2152 94 15 174 2538 4520 44 544 2538 2906 81 544 2538 1297 41 185 2906 3209 49 544 2906 3993 60 657 3121 4549 13 544 3121 2815 16 951 3121 3812 7 523 3209 2152 56 544 3209 1089 48 475 3209 4396 23 766 3732 2538 31 544 3732 4575 95 410 3732 4807 54 534 70 3020 92 558 70 2643 28 138 576 3833 82 558 576 4608 94 646 680 4864 94 558 680 1614 6 558 680 2544 60 25 999 1991 45 558 999 4688 73 558 999 3409 96 835 999 324 20 534 1108 999 10 558 1108 1926 8 964 1108 2698 98 160 1189 2583 13 558 1189 1627 78 159 1189 4858 47 797 1588 4625 97 558 1588 438 69 735 1588 706 60 928 1614 576 30 558 1614 4896 65 945 1991 1189 22 558 1991 1443 56 873 2583 4017 86 558 2583 1043 24 678 2583 4064 25 393 3020 1108 13 558 3020 4924 68 646 3833 1588 33 558 3833 1509 10 440 4017 680 45 558 4017 1692 5 779 4017 3333 62 343 71 3590 78 275 71 1512 32 518 71 3566 55 276 971 1350 84 275 971 2908 18 125 1011 2849 4 275 1011 3385 17 722 1268 1011 40 275 1268 583 31 507 1268 1493 63 191 1350 1268 82 275 1350 4975 20 275 1350 4048 32 719 2543 4784 72 275 2543 2018 17 205 2849 2543 43 275 2849 1350 93 924 3240 971 63 275 3240 2980 51 965 3240 2638 59 331 3415 3240 24 275 3415 2088 21 438 3590 4092 64 275 3590 3998 69 935 4092 3415 70 275 4092 4350 88 751 72 1817 36 467 72 1927 31 60 795 4877 6 467 795 3051 97 442 1817 4529 20 467 1817 4247 83 467 1817 653 86 8 1817 4265 64 86 2667 795 22 467 2667 118 88 209 2667 1924 38 119 2911 2976 96 467 2911 218 88 726 2911 6 33 538 2976 2667 63 467 2976 2351 13 372 2976 1188 1 470 3999 2911 31 467 3999 435 5 512 4247 3999 91 467 4247 760 72 391 4247 881 41 911 73 1860 76 350 73 550 69 788 73 957 25 889 578 4355 45 350 578 544 28 866 1068 3881 7 350 1068 3793 5 129 1068 4257 46 192 1860 578 89 350 1860 4833 60 350 1860 2842 37 825 2075 1068 19 350 2075 2035 91 23 2646 4625 92 350 2646 97 11 977 2646 4851 18 499 2838 2075 35 350 2838 2389 61 682 3881 4495 8 350 3881 3367 13 121 4334 2646 88 350 4334 3033 32 691 4334 1914 56 676 4355 2838 63 350 4355 4316 29 331 4495 4334 64 350 4495 444 73 167 74 1293 3 477 74 2001 79 749 74 73 98 410 524 4730 53 477 524 4896 71 366 524 3647 48 716 1293 4350 43 477 1293 4609 7 537 1293 3988 84 852 1432 3030 4 477 1432 4616 86 884 2124 3850 36 477 2124 1651 39 638 2124 2499 75 831 3030 2124 16 477 3030 2488 51 132 3030 4990 59 679 3850 524 23 477 3850 4003 28 500 3850 1910 90 86 4350 1432 57 477 4350 4785 13 477 4350 1306 16 886 4350 4830 59 126 75 3613 48 1231 75 1858 10 886 75 2110 17 162 1153 2657 24 1231 1153 4470 34 591 1153 1279 71 708 1215 4933 28 1231 1215 1572 45 938 1457 1215 64 1231 1457 4897 11 368 1568 1690 82 1231 1568 3105 93 800 1690 1457 34 1231 1690 1454 92 186 2657 1568 32 1231 2657 4954 17 575 2657 2941 29 94 3613 3949 50 1231 3613 1747 53 757 3949 4411 32 1231 3949 4761 47 528 4411 1153 35 1231 4411 4868 81 1231 4411 2760 75 454 4411 1081 53 963 76 1468 11 486 76 650 39 678 791 3902 90 486 791 4226 36 985 791 2773 2 356 972 3556 50 486 972 695 32 173 972 2163 3 235 1369 972 33 486 1369 666 88 597 1396 791 100 486 1396 1051 67 905 1468 1396 80 486 1468 534 71 398 3556 3762 24 486 3556 2610 84 919 3556 4489 5 833 3762 4749 27 486 3762 4516 9 486 3762 2717 97 653 3902 4013 42 486 3902 2667 39 468 4013 1369 30 486 4013 272 67 749 77 3700 69 773 77 2638 66 273 77 3307 4 750 1469 2090 19 773 1469 1544 38 86 1469 965 42 690 1678 2577 3 773 1678 987 80 998 2090 2400 3 773 2090 4557 28 773 2090 3561 100 6 2090 1032 38 575 2400 2758 79 773 2400 2159 98 351 2577 2841 37 773 2577 3387 69 700 2758 3203 42 773 2758 4693 64 723 2758 552 57 811 2841 3637 71 773 2841 4068 59 106 2841 2948 67 830 3203 4587 25 773 3203 2169 97 486 3203 3487 23 856 3637 1469 54 773 3637 169 91 773 3637 4803 5 656 3700 1678 14 773 3700 4894 100 749 3700 3254 5 674 78 4195 37 422 78 2431 96 456 78 1292 25 432 637 3080 91 422 637 361 16 278 2287 4810 89 422 2287 4366 83 881 2287 2684 42 75 2977 2287 9 422 2977 3539 46 913 2977 3959 10 970 3080 4770 49 422 3080 2977 56 422 3080 3993 16 344 3080 3976 98 35 4195 637 73 422 4195 2336 77 837 79 3474 78 526 79 4411 1 145 79 399 97 616 1874 2949 39 526 1874 317 31 257 1874 2915 58 817 2949 4569 12 526 2949 166 35 134 2949 4792 72 924 3474 4057 50 526 3474 4597 20 526 3474 4563 20 94 3474 3032 78 434 3629 3803 56 526 3629 2282 54 710 3803 4289 48 526 3803 1246 87 997 4012 1874 53 526 4012 2941 54 652 4012 3666 39 471 4057 3629 90 526 4057 1023 39 876 4289 4012 42 526 4289 2646 67 205 4289 4670 72 21 80 2921 95 402 80 2138 7 282 1532 2135 73 402 1532 3684 21 760 1891 3908 63 402 1891 259 38 652 1891 1941 3 248 2135 4515 67 402 2135 3691 95 279 2141 3959 14 402 2141 341 28 309 2921 4198 45 402 2921 3242 72 376 3628 4492 9 402 3628 2332 61 715 3908 4011 60 402 3908 2677 85 525 3959 3628 14 402 3959 215 51 625 4011 1532 33 402 4011 3063 93 192 4198 2141 91 402 4198 4839 50 402 4198 1710 94 229 4198 3047 50 553 4492 1891 52 402 4492 2274 69 268 81 2434 6 602 81 4235 63 785 951 3027 53 602 951 3188 58 380 951 708 3 825 1026 2166 78 602 1026 1759 42 779 1822 3316 41 602 1822 451 10 517 2166 4572 35 602 2166 1001 19 234 2434 2636 55 602 2434 2924 58 924 2636 3298 64 602 2636 1171 34 755 2636 714 4 199 3027 4265 74 602 3027 1070 78 93 3298 951 91 602 3298 212 26 911 3298 3070 33 905 3316 4051 2 602 3316 4868 65 296 3316 2303 80 96 4051 1026 73 602 4051 48 32 377 4265 1822 77 602 4265 4840 89 602 4265 333 2 811 82 3207 87 262 82 2016 98 787 82 4323 23 472 2156 3102 41 262 2156 4856 43 262 2156 194 91 342 2156 4406 12 241 2282 2156 87 262 2282 3600 21 878 2282 2105 3 180 2902 4754 8 262 2902 188 2 596 2902 2611 63 49 3102 3922 97 262 3102 4150 64 565 3102 4750 97 446 3207 2282 12 262 3207 3378 88 279 3922 2902 19 262 3922 2040 45 500 83 2167 34 321 83 3772 54 32 554 2414 11 321 554 924 9 413 554 613 83 57 966 4272 91 321 966 4552 33 321 966 4564 56 797 966 4208 47 501 2167 3000 69 321 2167 4888 82 209 2167 3364 6 731 2171 2511 42 321 2171 1086 29 50 2296 2171 44 321 2296 4443 1 861 2296 4169 21 480 2351 2296 66 321 2351 2404 68 775 2351 2335 88 897 2414 966 34 321 2414 3381 71 435 2511 554 80 321 2511 67 17 398 3000 2351 63 321 3000 3369 54 444 3000 822 11 704 4272 4572 65 321 4272 4649 41 936 4272 922 10 679 84 2517 5 1135 84 3461 36 852 1073 2399 56 1135 1073 4178 75 920 1073 2453 84 839 1535 1073 19 1135 1535 3869 58 188 2399 3891 62 1135 2399 4528 98 855 2399 507 60 98 2517 4478 49 1135 2517 1570 85 993 3834 1535 36 1135 3834 1298 55 903 3834 4853 68 572 3891 4717 60 1135 3891 1586 72 318 3891 1121 94 954 4478 3834 28 1135 4478 4875 64 1135 4478 3712 34 959 4478 234 26 160 85 2828 6 459 85 2695 75 62 622 2427 33 459 622 4996 62 897 830 4765 48 459 830 4872 82 921 830 1500 35 109 1763 3735 12 459 1763 4070 78 274 2427 830 36 459 2427 4905 23 459 2427 3147 1 569 2427 421 19 618 2489 3755 83 459 2489 1477 94 293 2489 4960 89 480 2828 2489 14 459 2828 4961 64 644 2828 2108 24 513 3735 622 74 459 3735 4532 36 50 3735 58 65 672 3755 1763 34 459 3755 955 82 247 3755 216 99 975 86 3172 63 915 86 2576 5 971 974 3007 94 915 974 3226 30 773 1178 4784 12 915 1178 4710 94 915 1178 2987 36 508 2059 974 21 915 2059 4526 76 557 3007 1178 64 915 3007 4610 45 967 3172 3315 51 915 3172 1790 8 66 3315 2059 90 915 3315 3801 47 499 3315 2909 98 704 87 1958 92 505 87 2342 15 288 826 1629 34 505 826 2435 93 127 826 508 22 516 1272 1969 66 505 1272 127 96 585 1272 3733 90 796 1629 4035 58 505 1629 827 6 311 1629 2318 79 500 1958 4668 44 505 1958 1272 91 505 1958 4991 24 322 1969 2916 59 505 1969 992 56 723 1969 2053 72 260 2546 4815 11 505 2546 962 34 28 2916 826 37 505 2916 3974 97 202 4035 2546 6 505 4035 4988 15 268 88 957 70 193 88 4453 34 366 88 2187 93 135 957 3275 33 193 957 4735 79 193 957 4367 2 158 1474 2586 78 193 1474 1806 56 318 1474 1342 52 728 1747 2529 55 193 1747 948 13 955 1747 4244 43 745 2529 4468 95 193 2529 3203 98 350 2529 4454 45 919 2586 5000 32 193 2586 1293 79 987 3275 1747 74 193 3275 4297 8 884 3574 1474 46 193 3574 339 77 766 3574 997 41 384 4468 3574 7 193 4468 1611 60 173 4468 2428 46 43 89 3013 85 1133 89 3914 36 527 868 2491 88 1133 868 1531 28 467 868 2073 87 769 1102 1358 79 1133 1102 556 20 37 1102 575 3 956 1358 868 71 1133 1358 4483 83 798 1358 3712 11 50 2162 2350 14 1133 2162 690 11 222 2350 4544 40 1133 2350 4967 68 1133 2350 4682 39 920 2491 2162 68 1133 2491 3853 51 995 2491 2110 59 856 3013 1102 38 1133 3013 3523 71 167 3013 4563 3 313 90 1245 75 500 90 1680 96 485 90 4649 37 725 1121 3880 23 500 1121 1891 25 391 1121 948 78 448 1245 3043 40 500 1245 4679 83 89 1522 3570 99 500 1522 4310 5 416 1522 2656 94 363 2819 1522 62 500 2819 364 54 844 2819 76 55 366 3043 2819 10 500 3043 2593 27 516 3043 1101 13 674 3093 4559 39 500 3093 3399 17 746 3093 2913 56 943 3570 1121 82 500 3570 4712 98 500 3570 1172 76 522 3880 3093 84 500 3880 1111 7 690 91 3168 47 742 91 4704 57 882 781 4696 8 742 781 576 37 512 788 2622 17 742 788 3437 63 272 1772 2993 98 742 1772 2661 16 990 1772 2140 9 737 2622 3350 91 742 2622 3593 6 913 2993 4377 77 742 2993 371 47 668 3168 788 62 742 3168 255 71 602 3350 1772 78 742 3350 4117 63 355 3350 3346 66 779 4239 781 12 742 4239 3199 98 142 4377 4239 63 742 4377 4705 63 742 4377 896 46 419 92 3911 81 403 92 4815 47 696 696 2855 33 403 696 4512 92 403 696 3725 12 387 908 696 37 403 908 2771 45 110 2855 3616 33 403 2855 2413 8 439 2855 1667 63 520 2884 3185 81 403 2884 1845 28 715 2884 142 72 774 3185 908 100 403 3185 2943 72 437 3185 676 41 556 3616 4787 8 403 3616 4802 75 969 3911 2884 81 403 3911 2032 26 148 3911 3155 92 273 93 1285 13 442 93 1256 87 384 1085 4094 36 442 1085 3504 39 934 1285 2258 26 442 1285 3527 79 807 1285 2768 34 598 1442 1485 8 442 1442 915 6 951 1485 2654 64 442 1485 3834 80 555 1485 3994 82 761 1524 1085 67 442 1524 2940 59 917 1524 4380 67 454 2258 2506 49 442 2258 888 40 968 2258 980 67 841 2506 4121 61 442 2506 3016 83 650 2506 3243 39 246 2654 1524 38 442 2654 4535 30 722 2654 988 53 548 4094 4685 12 442 4094 4510 64 442 4094 1033 91 642 4094 4770 80 996 4121 1442 10 442 4121 2192 41 977 4121 4085 72 940 94 2229 77 1077 94 864 62 198 94 2522 67 40 880 1030 94 1077 880 1133 98 242 1030 2196 41 1077 1030 2607 30 569 1030 435 7 884 1064 2095 28 1077 1064 3483 14 555 2095 4002 9 1077 2095 1959 43 780 2095 1025 39 552 2196 1064 24 1077 2196 4604 60 1077 2196 4337 15 88 2196 349 100 413 2229 2555 86 1077 2229 3259 20 993 2555 880 4 1077 2555 1875 31 461 2555 1770 13 923 4002 4553 25 1077 4002 4973 4 739 4002 2160 63 399 95 1105 13 552 95 1626 85 155 95 4780 39 558 1105 2469 94 552 1105 4968 42 897 1105 4017 36 39 1499 4104 9 552 1499 4566 47 818 1656 4810 20 552 1656 1681 15 267 1660 1656 44 552 1660 4967 14 552 1660 4458 23 433 1796 3838 1 552 1796 1269 23 47 1796 2440 84 947 2469 4224 56 552 2469 4494 33 344 2469 1318 46 254 3838 1499 38 552 3838 863 68 932 3838 782 32 273 4104 1660 84 552 4104 2815 49 146 4104 384 12 65 4224 1796 64 552 4224 635 59 561 96 2831 40 398 96 360 76 538 547 4551 17 398 547 1488 19 398 547 4603 31 55 1488 3555 81 398 1488 2938 23 23 2831 3052 95 398 2831 899 82 38 2831 4748 86 300 3052 3437 46 398 3052 1237 7 945 3437 547 12 398 3437 4121 8 414 3555 4805 20 398 3555 3697 82 315 3555 1512 94 36 97 1262 55 292 97 4976 40 928 97 893 79 428 1262 4226 15 292 1262 2843 85 105 1430 2530 25 292 1430 764 7 449 1430 184 27 848 1708 4755 43 292 1708 4704 7 292 1708 4758 48 752 1708 3301 98 375 2034 2518 94 292 2034 1290 40 415 2034 4317 58 149 2328 1430 61 292 2328 660 86 174 2518 1708 29 292 2518 1002 64 215 2518 1546 19 458 2530 2034 78 292 2530 248 11 55 3405 2328 16 292 3405 4212 34 459 4226 3405 58 292 4226 2372 48 85 4226 1179 5 406 98 2206 11 1180 98 3981 19 359 1984 3801 60 1180 1984 4359 19 396 1984 3450 12 763 2206 3327 96 1180 2206 3614 67 34 3252 4910 24 1180 3252 1444 42 463 3252 2544 3 384 3327 4406 84 1180 3327 3531 4 797 3327 1981 6 795 3801 3252 2 1180 3801 4954 42 1180 3801 3455 84 818 3801 2733 58 253 4406 1984 50 1180 4406 1363 99 20 4406 4460 43 221 99 1426 5 449 99 3868 45 417 1033 1707 48 449 1033 4540 34 582 1033 4390 90 537 1426 1033 78 449 1426 1973 39 859 1707 3075 4 449 1707 340 77 364 1707 2656 45 407 1932 3458 38 449 1932 3174 52 401 1932 1745 10 567 3075 3507 61 449 3075 3216 81 904 3458 3826 95 449 3458 2361 3 445 3507 1932 53 449 3507 4667 64 449 3507 3187 15 596 3507 3053 56 624 3826 4596 82 449 3826 4735 85 173 100 2933 66 618 100 3283 61 752 2214 3465 33 618 2214 3105 74 368 2214 926 45 504 2232 2964 45 618 2232 2912 36 528 2232 4912 71 46 2330 2214 78 618 2330 2796 55 197 2330 218 27 27 2933 2232 39 618 2933 4575 75 595 2933 1473 100 380 2964 3977 38 618 2964 4738 66 618 2964 1513 88 211 3465 4825 68 618 3465 4019 41 614 3465 591 47 214 3492 3893 28 618 3492 934 35 584 3492 1613 20 543 3893 2330 20 618 3893 3425 71 204 3893 3098 31 885 3977 3492 8 618 3977 3337 12 273 3977 3129 20 758 101 4093 64 623 101 2346 8 300 101 44 7 833 581 4515 1 623 581 4648 40 623 581 3785 70 671 663 2620 53 623 663 4200 45 426 663 65 57 748 854 663 35 623 854 303 73 904 2620 3539 84 623 2620 3922 50 374 2668 4037 51 623 2668 1316 27 241 2668 3846 14 378 3539 3848 10 623 3539 2802 15 714 3848 2668 27 623 3848 2410 35 272 3848 4371 33 940 4037 581 52 623 4037 576 59 823 4037 1292 35 881 4093 854 82 623 4093 1696 56 733 102 3112 28 695 102 3029 38 598 102 2659 38 981 2175 3605 34 695 2175 2253 93 235 2753 4730 80 695 2753 3869 40 866 2798 2753 99 695 2798 3814 70 302 2798 4260 61 4 3112 4378 66 695 3112 2573 13 60 3112 3788 71 86 3605 4170 12 695 3605 2818 7 272 4170 2798 3 695 4170 871 90 79 4170 1376 9 36 4378 2175 26 695 4378 4797 22 695 4378 1485 9 200 4378 4627 45 690 103 3419 15 312 103 2244 64 796 103 2117 79 659 947 2066 83 312 947 3735 96 965 1948 3017 56 312 1948 2771 57 977 2066 1948 64 312 2066 4188 27 372 2066 4544 28 588 2112 3443 48 312 2112 1716 54 109 2112 4894 22 304 3017 4141 34 312 3017 4301 73 957 3419 947 67 312 3419 4750 34 312 3419 3115 100 96 3443 4657 46 312 3443 942 97 720 4141 2112 95 312 4141 1181 53 447 104 2878 76 447 104 4104 20 324 1954 4886 8 447 1954 4766 88 447 1954 2827 74 192 2294 4148 42 447 2294 1573 49 409 2294 4413 80 13 2391 1954 75 447 2391 1108 87 753 2756 4154 15 447 2756 2520 91 33 2756 2135 93 408 2878 3339 85 447 2878 4528 76 683 3339 2294 58 447 3339 4840 79 699 3339 4820 36 967 4148 4298 63 447 4148 791 1 923 4148 2585 20 422 4154 2391 75 447 4154 2537 20 355 4154 277 45 56 4298 2756 73 447 4298 2377 88 435 4298 4252 51 701 105 1001 71 420 105 2579 88 601 833 2678 76 420 833 1794 18 418 833 3106 63 31 994 4763 79 420 994 4061 63 81 1001 4216 92 420 1001 4109 33 335 1083 4536 60 420 1083 2547 16 420 1083 2002 79 132 1083 3648 77 215 2547 833 40 420 2547 4180 84 654 2678 994 62 420 2678 3643 5 149 2678 1533 37 43 3729 1083 24 420 3729 2255 53 328 4216 3729 45 420 4216 4242 39 204 4216 4976 93 602 106 3301 71 758 106 2686 44 985 106 199 88 235 1169 3067 79 758 1169 3709 96 789 1428 4660 62 758 1428 4888 14 636 1428 1697 39 813 1444 4367 62 758 1444 2320 9 838 1444 3097 7 274 3067 3795 71 758 3067 4295 59 590 3067 4706 29 278 3301 1169 90 758 3301 1202 78 441 3795 1444 99 758 3795 4829 100 758 3795 4709 16 476 3795 3983 67 935 4114 1428 21 758 4114 1864 41 593 4367 4114 40 758 4367 805 3 511 107 2540 86 880 107 2668 22 456 895 1987 75 880 895 2896 6 989 983 2551 67 880 983 4718 3 495 1512 895 53 880 1512 181 60 240 1512 2698 69 965 1570 983 22 880 1570 1900 73 724 1667 4916 85 880 1667 3330 59 880 1667 3571 43 110 1667 2116 81 807 1987 2581 93 880 1987 780 39 157 1987 4944 20 768 2540 1512 39 880 2540 2122 92 42 2551 4790 13 880 2551 2309 52 484 2581 1667 33 880 2581 871 83 442 3330 1570 17 880 3330 3209 88 945 108 3607 73 846 108 1800 86 435 1025 1773 28 846 1025 2608 23 157 1025 2268 47 965 1322 4862 35 846 1322 4583 43 846 1322 3588 96 849 1322 4764 23 146 1773 3946 34 846 1773 322 31 415 3607 1025 41 846 3607 4179 67 886 3607 2565 70 93 3946 1322 37 846 3946 756 32 706 109 1749 60 694 109 3051 11 184 109 2236 22 649 568 2613 61 694 568 255 53 590 568 374 53 803 1239 4856 55 694 1239 3194 100 694 1239 1299 92 291 1239 3546 34 740 1251 4172 42 694 1251 475 16 175 1251 4904 48 902 1544 4583 7 694 1544 4730 36 197 1544 1211 89 358 1620 1251 16 694 1620 4713 50 172 1622 1544 38 694 1622 3232 60 996 1749 1620 19 694 1749 618 1 254 1749 1726 16 968 1789 1239 26 694 1789 4819 63 757 1789 3838 47 153 2613 1622 75 694 2613 4476 1 813 2613 2275 6 969 3194 568 30 694 3194 4056 7 257 3194 1569 78 566 4172 1789 77 694 4172 426 45 737 110 1161 35 804 110 117 69 728 110 1036 10 858 703 4759 4 804 703 3335 76 757 703 4688 45 675 1161 3797 82 804 1161 4874 8 804 1161 3205 24 221 2890 703 12 804 2890 4144 76 835 3371 2890 15 804 3371 227 30 310 3513 3371 92 804 3513 1640 37 248 3513 3683 85 358 3797 3513 40 804 3797 4718 94 93 3797 2972 5 234 111 1888 14 411 111 2668 25 341 111 3079 95 760 1640 2502 26 411 1640 4795 10 662 1640 1519 82 70 1888 3608 70 411 1888 4742 50 411 1888 2482 93 513 2502 4534 58 411 2502 630 5 648 3608 4217 41 411 3608 2222 5 320 3608 4762 45 245 4217 1640 94 411 4217 1433 9 561 112 1346 53 299 112 298 83 310 654 2031 96 299 654 2253 15 433 654 1739 64 472 1222 2494 23 299 1222 4628 63 299 1222 4556 13 349 1346 2432 53 299 1346 1128 67 194 1346 543 9 705 2031 1222 57 299 2031 4374 62 700 2031 2103 14 325 2368 4477 56 299 2368 666 5 721 2432 3220 1 299 2432 2012 6 975 2432 4552 52 555 2494 4945 65 299 2494 2905 57 47 2494 4580 98 129 3220 4038 69 299 3220 4983 2 445 4038 2368 2 299 4038 3190 30 593 4477 654 45 299 4477 2949 61 947 113 754 93 395 113 1813 53 198 113 3854 25 26 515 3335 20 395 515 2833 21 615 515 1637 100 326 754 515 65 395 754 3831 24 626 754 1669 69 783 1057 3491 20 395 1057 897 51 407 1057 2162 96 537 3165 4968 37 395 3165 4577 18 395 3165 1797 99 665 3165 1336 26 534 3335 4059 46 395 3335 3208 40 330 3491 3165 82 395 3491 1163 29 187 3491 1744 94 974 4059 1057 2 395 4059 568 41 729 4059 2388 4 479 114 2310 33 120 114 3611 70 478 114 918 81 456 1223 4788 2 120 1223 1286 98 875 1223 1580 57 657 1899 3692 57 120 1899 2726 72 224 2310 4336 56 120 2310 1041 12 89 2310 2204 29 864 3044 1223 68 120 3044 2074 40 767 3692 4530 40 120 3692 3044 34 120 3692 2483 42 171 4336 1899 41 120 4336 643 98 207 4336 305 2 253 115 1859 32 702 115 3428 21 22 115 2699 93 499 704 2349 72 702 704 2259 49 540 704 3383 66 245 1219 704 57 702 1219 3454 5 850 1373 3500 61 702 1373 342 23 149 1859 1373 11 702 1859 1685 90 424 2349 4525 10 702 2349 4947 19 702 2349 3722 98 304 2349 4928 12 629 2402 1219 80 702 2402 669 69 560 2402 1028 21 286 3500 4347 17 702 3500 1162 92 7 4347 2402 32 702 4347 2493 68 41 4347 3658 77 500 116 3472 94 269 116 3011 21 963 956 4498 9 269 956 4617 74 147 2026 3303 4 269 2026 2098 15 78 3148 956 66 269 3148 552 91 938 3148 3512 35 688 3303 4301 38 269 3303 89 74 854 3303 1872 73 21 3472 2026 47 269 3472 672 87 889 3472 1741 57 527 4138 4649 37 269 4138 4543 7 269 4138 3018 44 628 4301 3148 36 269 4301 2178 25 181 4498 4138 72 269 4498 1577 72 975 4498 4183 5 827 117 4128 78 703 117 264 69 513 1699 4150 42 703 1699 2277 79 706 1794 4883 24 703 1794 1832 64 882 2498 1794 83 703 2498 1294 35 266 2498 2121 2 18 2512 4928 1 703 2512 3284 16 703 2512 1223 69 416 3277 2498 69 703 3277 4795 31 48 3277 1040 27 137 3284 3277 51 703 3284 3449 30 413 4128 1699 23 703 4128 2104 54 85 4150 2512 40 703 4150 1941 18 464 118 1609 88 619 118 4697 41 760 118 826 4 502 535 675 96 619 535 1075 79 479 675 1038 72 619 675 487 18 743 675 4320 33 362 1038 3824 6 619 1038 4386 71 518 1609 1647 89 619 1609 2067 34 627 1647 3466 92 619 1647 4522 57 619 1647 343 9 366 2367 3885 56 619 2367 3625 15 305 3466 2367 79 619 3466 1300 79 325 3466 2507 83 743 3824 4726 97 619 3824 2840 81 405 3824 4816 83 130 3885 535 86 619 3885 201 66 832 3885 2978 18 655 119 4219 12 172 119 1544 35 516 119 3889 43 710 512 1168 68 172 512 298 96 29 946 512 2 172 946 2531 64 33 1168 3651 15 172 1168 4770 28 172 1168 1233 54 295 1168 3464 75 267 1425 1679 88 172 1425 1241 97 379 1425 3227 73 1 1679 4496 92 172 1679 2097 51 872 1679 3031 37 688 1988 4042 55 172 1988 2769 82 381 1988 2698 17 471 2225 946 34 172 2225 2395 76 464 3398 2225 13 172 3398 4601 5 172 3398 4878 46 79 3651 1988 32 172 3651 1517 64 128 3651 4114 16 105 4042 1425 12 172 4042 4466 41 713 4219 3398 35 172 4219 441 13 574 4219 1796 45 690 4496 4810 19 172 4496 3296 39 98 120 4365 19 689 120 1075 25 988 120 2207 27 184 820 2807 35 689 820 2419 39 338 820 4397 96 963 1372 1975 15 689 1372 3149 90 680 1372 3700 73 292 1975 4043 41 689 1975 388 63 788 1975 2044 35 563 2188 2731 16 689 2188 4506 13 885 2188 3230 79 908 2731 4631 68 689 2731 207 2 314 2731 783 58 661 2807 2188 89 689 2807 606 90 393 4043 820 28 689 4043 4608 91 689 4043 1801 66 76 4043 4369 56 871 4365 1372 62 689 4365 1360 20 639 121 2262 5 341 121 3747 54 648 121 18 31 874 558 4135 59 341 558 795 65 37 558 3855 84 43 2094 3281 49 341 2094 559 72 785 2262 3360 16 341 2262 2799 10 419 2262 865 84 478 3281 4706 33 341 3281 3742 35 885 3360 3722 85 341 3360 3222 62 226 3722 4270 33 341 3722 4870 8 965 3722 1500 1 519 4135 2094 52 341 4135 3919 17 875 4270 558 26 341 4270 4602 67 341 4270 2459 98 811 4270 3188 58 73 122 3280 22 699 122 2561 51 773 122 2655 53 102 1351 1687 27 699 1351 1176 37 228 1687 3313 97 699 1687 3242 71 883 1687 2122 64 887 2216 4211 52 699 2216 3888 43 420 2216 644 54 304 3280 1351 43 699 3280 1340 56 864 3313 2216 69 699 3313 4701 100 699 3313 2388 50 175 3313 3213 33 388 4211 4924 19 699 4211 22 24 331 123 2475 78 735 123 2266 9 704 123 1573 74 424 1188 3606 80 735 1188 3915 8 68 1188 4877 69 945 1472 4876 57 735 1472 1916 12 964 1472 2662 37 68 2475 1188 19 735 2475 4078 11 427 2475 3127 20 517 2607 4844 79 735 2607 3433 61 735 2607 199 60 411 3433 1472 27 735 3433 4405 93 585 3606 4255 63 735 3606 4748 78 304 4255 2607 50 735 4255 325 77 991 4255 892 97 292 124 3596 64 4 124 4368 60 49 124 3217 77 289 847 3066 78 4 847 4912 36 430 1298 4667 36 4 1298 3310 99 4 1298 893 31 975 1744 3076 75 4 1744 1192 85 648 1818 1298 14 4 1818 3783 53 137 1818 1529 18 872 2284 3659 68 4 2284 1297 74 108 2783 1818 93 4 2783 4998 94 4 2783 1969 21 18 2783 4629 28 689 3066 1744 77 4 3066 2926 37 772 3066 332 97 136 3076 3223 7 4 3076 4141 97 22 3223 2783 30 4 3223 891 98 884 3223 3195 37 514 3310 4926 61 4 3310 4954 61 422 3596 2284 23 4 3596 1874 63 206 3659 847 76 4 3659 3640 22 32 125 1993 54 764 125 4987 76 870 125 3091 95 293 664 2548 41 764 664 637 13 835 1112 2531 72 764 1112 3485 25 449 1181 4049 65 764 1181 478 37 631 1181 2186 2 806 1993 1181 45 764 1993 2201 77 504 1993 1525 41 197 2531 4271 22 764 2531 1503 76 945 2531 4226 96 172 2548 3751 64 764 2548 489 35 981 3523 4409 55 764 3523 3440 95 732 3523 4523 40 738 3751 4879 11 764 3751 359 57 565 4049 3523 1 764 4049 4660 26 764 4049 4212 67 644 4271 664 53 764 4271 4598 79 155 4271 1712 20 722 4409 1112 24 764 4409 4155 80 476 126 4165 53 735 126 584 21 507 1438 4500 61 735 1438 4798 13 967 3139 1438 3 735 3139 4992 68 735 3139 1051 24 573 3648 4994 40 735 3648 2837 22 721 3648 1622 71 835 4165 4248 54 735 4165 147 71 593 4248 3139 88 735 4248 500 79 485 4248 4940 29 680 4500 3648 90 735 4500 4866 2 159 127 2147 34 271 127 4410 84 207 127 3844 82 943 1675 4806 38 271 1675 3433 52 132 2147 2952 17 271 2147 39 85 421 2147 4785 98 371 2952 4306 4 271 2952 2164 80 69 2952 986 95 186 3476 1675 75 271 3476 2737 16 898 3619 3476 35 271 3619 2258 80 9 4306 3619 47 271 4306 4771 18 271 4306 3907 56 556 128 2837 21 564 128 1928 27 887 598 3924 20 564 598 4518 82 915 2061 3167 61 564 2061 2424 26 941 2061 325 38 880 2651 598 45 564 2651 1699 88 20 2651 389 30 734 2837 2061 47 564 2837 4020 89 956 3113 2651 59 564 3113 2404 47 12 3113 2178 70 722 3167 3113 76 564 3167 4789 33 564 3167 3946 93 328 3167 994 21 841 3924 4853 77 564 3924 4269 86 725 3924 4869 97 877 129 3812 7 28 129 1562 38 294 903 2198 15 28 903 2683 28 412 1149 4897 90 28 1149 4884 48 28 1149 912 80 34 1149 1450 74 565 1582 903 12 28 1582 3299 27 628 1582 2590 36 999 2198 1149 43 28 2198 1144 20 556 2198 4263 96 112 3631 3992 20 28 3631 4895 85 483 3631 3912 37 279 3812 4222 61 28 3812 2515 28 262 3846 1582 51 28 3846 4482 41 499 3846 4056 67 564 3992 3846 31 28 3992 2691 83 408 3992 856 31 57 4222 3631 89 28 4222 2351 8 138 130 1565 64 32 130 3887 50 636 1091 2754 63 32 1091 57 15 30 1091 1758 1 487 1565 2201 89 32 1565 4254 99 150 1565 2314 13 227 2201 4595 37 32 2201 4112 85 32 2201 4874 30 499 2754 3965 55 32 2754 2253 45 309 2754 1120 63 529 2892 3387 37 32 2892 217 44 605 3387 1091 89 32 3387 4465 53 173 3387 1803 81 714 3445 2892 78 32 3445 4357 34 283 3445 169 77 960 3965 4767 84 32 3965 4426 34 600 4112 3445 19 32 4112 4597 3 79 4112 1924 94 58 131 1799 2 822 131 4556 21 673 131 4570 63 595 678 1021 64 822 678 4990 75 194 1021 3945 76 822 1021 4277 96 422 1040 3726 37 822 1040 3321 40 266 1040 4071 2 790 1799 4446 4 822 1799 4923 42 822 1799 2206 8 973 3726 4892 8 822 3726 2050 49 383 3945 4269 89 822 3945 228 85 205 3945 4522 19 388 4269 1040 29 822 4269 144 35 525 4446 678 64 822 4446 2143 53 862 4446 817 34 367 132 2525 51 654 132 1895 70 719 132 1168 18 831 629 4361 35 654 629 2976 76 284 629 359 57 794 1408 1648 10 654 1408 4244 23 285 1408 1535 92 408 1439 1701 67 654 1439 1550 50 471 1648 4556 94 654 1648 3997 100 654 1648 2672 48 568 1701 2868 34 654 1701 3380 20 511 2199 629 45 654 2199 339 19 189 2199 1600 76 691 2525 1408 65 654 2525 2053 2 219 2857 2199 75 654 2857 4895 49 654 2857 4005 72 960 2857 2821 39 448 2868 2908 21 654 2868 2080 18 558 2868 290 7 821 2908 4802 59 654 2908 3721 85 178 3997 2857 34 654 3997 2669 47 849 3997 580 35 590 4361 1439 75 654 4361 1403 86 684 4361 756 95 458 133 2497 100 561 133 1777 51 131 1139 4617 9 561 1139 211 56 613 2497 2956 93 561 2497 2803 17 814 2780 1139 27 561 2780 3344 1 445 2780 2169 83 175 2956 3019 46 561 2956 4965 72 413 3019 4060 37 561 3019 1628 18 115 3019 2506 32 15 3776 4117 45 561 3776 2299 45 517 3776 4820 70 606 4060 3776 11 561 4060 4715 82 561 4060 492 61 872 4060 4546 83 438 4075 2780 38 561 4075 831 33 946 4075 2563 94 837 4117 4075 10 561 4117 135 77 863 4117 63 79 713 134 660 6 644 134 1816 4 489 660 2303 41 644 660 2500 35 92 1459 1953 13 644 1459 1188 39 46 1459 2692 64 582 1834 2436 66 644 1834 1833 7 796 1953 1834 86 644 1953 3624 64 265 1953 251 82 647 1968 2007 26 644 1968 2195 58 730 2007 1459 11 644 2007 1715 32 750 2303 1968 20 644 2303 2988 24 205 2303 4063 39 107 2436 4895 95 644 2436 4746 61 644 2436 4240 18 67 2436 4684 95 715 135 3666 1 621 135 2190 15 452 135 4593 48 459 747 1463 70 621 747 2066 47 365 1463 3377 23 621 1463 1927 76 623 1463 431 51 453 2063 4767 32 621 2063 227 14 166 2411 2755 89 621 2411 4075 45 652 2411 2417 85 132 2755 3627 15 621 2755 4905 53 621 2755 3395 27 291 3377 2411 74 621 3377 1376 29 315 3627 2063 48 621 3627 4233 99 647 3666 747 16 621 3666 436 18 794 136 2134 65 392 136 3839 32 727 136 2365 89 308 783 4022 2 392 783 4956 62 167 783 2609 35 390 866 783 99 392 866 3016 42 306 938 2785 63 392 938 31 95 769 1352 1797 85 392 1352 2098 46 692 1797 866 78 392 1797 303 7 64 1797 1049 70 940 2134 938 37 392 2134 1379 17 3 2785 1352 21 392 2785 2756 24 440 2785 2882 67 86 2796 4893 56 392 2796 1810 10 388 4022 4252 25 392 4022 4600 4 392 4022 4796 86 128 4022 4685 37 214 4252 2796 42 392 4252 291 73 616 137 900 47 964 137 4185 47 824 137 2051 99 811 900 2204 20 964 900 1697 28 221 900 2493 49 451 1405 4069 19 964 1405 4465 89 773 1805 1405 35 964 1805 1453 52 900 1805 2929 3 90 1944 4996 74 964 1944 3144 7 937 2204 1805 77 964 2204 4904 22 964 2204 1203 60 280 2535 1944 78 964 2535 4303 88 810 2535 3415 7 211 4069 2535 83 964 4069 3519 3 206 4069 1305 1 96 138 4081 79 108 138 1075 15 988 138 4232 57 654 1114 2078 67 108 1114 2360 9 357 2078 4399 47 108 2078 4613 61 763 2078 1780 74 484 2527 1114 15 108 2527 1486 70 772 2527 693 83 281 2930 2527 83 108 2930 218 80 134 2930 931 55 838 3018 2930 16 108 3018 446 17 363 3018 2856 20 847 3974 3018 27 108 3974 4316 3 697 4081 3974 97 108 4081 1614 13 874 4399 4821 55 108 4399 4573 54 108 4399 2033 93 197 4399 3687 83 37 139 4335 46 394 139 792 20 410 139 4082 4 965 659 4860 61 394 659 2461 60 72 1525 1743 75 394 1525 138 27 864 1525 2743 4 163 1743 4158 77 394 1743 4046 35 812 1743 4592 97 977 1746 1525 71 394 1746 3023 28 569 2459 3092 2 394 2459 3152 89 788 2459 3837 24 167 3092 659 51 394 3092 1493 35 546 3238 4280 97 394 3238 3582 37 244 4158 2459 38 394 4158 4702 59 394 4158 1764 43 48 4280 1746 7 394 4280 3187 55 503 4280 544 14 130 4335 3238 51 394 4335 3847 2 516 4335 2380 67 335 140 2591 16 1149 140 4714 44 325 140 3703 74 9 982 1996 85 1149 982 3684 73 558 982 4080 20 64 1996 3034 29 1149 1996 4613 86 1149 1996 906 60 247 1996 4963 49 76 2591 4484 32 1149 2591 3792 93 524 3034 4976 98 1149 3034 3777 45 910 4341 982 91 1149 4341 1294 11 543 4484 4341 75 1149 4484 1347 7 996 4484 1123 55 290 141 3033 89 284 141 1191 92 26 552 3545 95 284 552 437 10 936 552 2653 60 705 1412 1824 2 284 1412 3981 9 278 1412 924 71 109 1824 4629 79 284 1824 4811 63 284 1824 4684 36 209 1824 4078 90 946 2467 552 67 284 2467 128 96 789 2467 673 89 398 2834 2467 85 284 2834 375 21 955 3033 2834 93 284 3033 4597 82 408 3033 4499 26 628 3545 4214 52 284 3545 3725 87 900 4214 1412 92 284 4214 2377 25 57 4214 1319 30 573 142 2604 62 433 142 4060 64 690 142 2123 90 783 566 4791 17 433 566 4567 34 737 566 4291 76 481 789 566 65 433 789 2826 61 487 789 6 47 257 1166 3096 43 433 1166 2782 96 645 1166 2808 62 680 2003 4841 7 433 2003 3914 33 433 2003 3193 33 376 2374 1166 42 433 2374 976 36 483 2374 571 9 338 2604 2003 14 433 2604 2912 39 98 3096 789 24 433 3096 682 8 402 3402 4240 20 433 3402 2935 26 43 3554 2374 21 433 3554 1113 97 364 3914 3402 71 433 3914 669 65 731 4240 3554 96 433 4240 1376 6 94 4240 900 66 397 143 844 34 346 143 91 45 771 143 2657 33 456 502 3245 92 346 502 2215 62 138 844 1889 19 346 844 2679 84 535 884 502 11 346 884 1377 23 30 884 4443 14 37 1889 3057 11 346 1889 1097 53 874 2645 4762 69 346 2645 1973 50 840 2645 2630 55 445 3057 4296 52 346 3057 4692 97 128 3245 4764 89 346 3245 4435 3 346 3245 510 99 5 3245 1963 55 928 4296 884 17 346 4296 896 53 294 4435 2645 1 346 4435 4081 62 73 144 2105 2 168 144 525 100 589 144 605 47 287 522 4872 12 168 522 1453 20 233 784 1915 23 168 784 4759 41 136 784 2463 92 518 1915 2423 5 168 1915 464 44 425 1915 2404 17 455 2105 4374 62 168 2105 3321 7 391 2105 1546 49 777 2217 3794 57 168 2217 966 3 621 2217 3056 60 880 2423 522 8 168 2423 4677 87 168 2423 951 24 636 2423 2368 69 610 2972 2217 51 168 2972 3811 50 855 3794 784 70 168 3794 1949 3 704 4374 2972 89 168 4374 2433 18 805 145 4444 66 982 145 3341 69 554 145 897 80 164 583 1174 81 982 583 1128 57 810 770 583 46 982 770 850 83 278 1174 4715 68 982 1174 3271 73 66 1174 2077 44 861 3062 4311 57 982 3062 4993 79 982 3062 4247 88 111 4311 770 82 982 4311 325 76 618 4444 3062 42 982 4444 4434 1 11 146 3260 67 790 146 1511 58 874 1587 3753 25 790 1587 2548 47 317 2074 4903 41 790 2074 4053 70 887 2074 719 100 432 3260 1587 38 790 3260 588 85 928 3260 4761 4 209 3753 4072 62 790 3753 369 50 245 3981 2074 25 790 3981 1852 73 578 3981 1754 28 257 4072 4179 83 790 4072 4601 64 790 4072 1505 2 676 4072 1326 71 403 4179 3981 81 790 4179 4802 5 309 4179 1935 32 694 147 3071 36 469 147 3942 11 241 147 2741 21 509 526 3369 7 469 526 3362 63 64 1260 3942 63 469 1260 4089 2 725 2914 4197 38 469 2914 1871 34 876 3071 2914 61 469 3071 1008 48 767 3258 3968 14 469 3258 4860 27 469 3258 355 98 132 3258 425 73 390 3369 4396 89 469 3369 2158 21 860 3942 526 94 469 3942 2620 51 865 3968 4576 42 469 3968 3473 84 917 4197 1260 54 469 4197 3690 95 623 4396 3258 91 469 4396 4110 50 387 148 865 36 287 148 3154 45 303 865 2948 96 287 865 4598 28 287 865 4387 3 739 865 4447 72 810 1670 2445 91 287 1670 1654 91 1000 1670 3422 16 340 2176 1670 44 287 2176 4864 83 580 2445 2509 10 287 2445 2282 72 329 2509 4931 13 287 2509 243 15 855 2509 3203 97 786 2948 2176 36 287 2948 3331 60 459 149 4364 83 427 149 2765 49 322 762 1727 73 427 762 4078 69 255 888 2111 64 427 888 311 57 42 1421 4118 50 427 1421 4582 14 761 1421 3259 54 416 1727 4101 44 427 1727 4283 9 601 1727 3345 19 193 2111 1421 77 427 2111 1061 64 339 2111 4690 28 27 2471 762 51 427 2471 4605 16 427 2471 1117 95 467 4101 4760 43 427 4101 3619 58 243 4118 2471 78 427 4118 4842 45 31 4364 888 57 427 4364 4082 45 883 150 3184 41 763 150 2928 66 501 589 777 67 763 589 3922 43 445 589 1237 31 632 777 1416 81 763 777 932 41 145 777 1917 53 950 1416 3430 95 763 1416 4977 28 763 1416 4483 28 23 3184 4202 31 763 3184 4900 19 902 3184 2263 19 95 3430 4647 55 763 3430 2094 99 224 3430 2603 31 332 4202 589 87 763 4202 3459 23 459 4202 1031 4 278 151 3389 79 407 151 3457 12 340 612 2040 64 407 612 3191 65 2 612 485 61 73 804 3662 43 407 804 4291 43 23 804 4394 62 35 1227 3497 75 407 1227 4827 76 816 2040 804 26 407 2040 1184 81 140 2805 1227 59 407 2805 2649 69 303 2805 756 44 685 3389 612 97 407 3389 3208 49 672 3497 4692 58 407 3497 4359 85 551 3662 3890 82 407 3662 4883 79 407 3662 2077 24 86 3662 4330 5 881 3890 2805 5 407 3890 3265 15 280 3890 3305 52 1 152 3586 62 323 152 3457 90 763 1552 2896 23 323 1552 3728 91 890 2029 3701 44 323 2029 3505 10 416 2873 2029 42 323 2873 3334 68 254 2896 3283 89 323 2896 1497 8 225 2896 76 87 68 3283 4359 94 323 3283 4637 11 323 3283 2985 98 761 3586 2873 34 323 3586 4702 74 413 3701 3825 27 323 3701 4964 82 295 3825 1552 96 323 3825 3781 23 724 3825 1772 61 276 4359 4829 64 323 4359 4296 58 681 153 4184 51 776 153 529 42 847 1076 4537 96 776 1076 3570 12 82 1076 4410 55 768 1931 1076 20 776 1931 1393 85 784 3796 4676 43 776 3796 1931 50 776 3796 448 52 367 3796 3715 62 314 4184 4393 33 776 4184 513 95 767 4393 3796 87 776 4393 1252 26 977 154 3599 19 1109 154 564 16 6 154 1947 60 285 810 1244 33 1109 810 4957 42 61 810 4467 52 730 1177 3232 78 1109 1177 671 43 469 1177 554 39 921 1244 4893 68 1109 1244 1856 40 362 1244 2133 83 922 2259 810 25 1109 2259 3132 2 40 2259 4765 8 586 3232 2259 97 1109 3232 4640 1 1109 3232 4985 95 927 3232 2464 26 81 3599 1177 63 1109 3599 2220 6 58 3599 2092 81 300 155 501 49 896 155 1905 92 377 501 1841 6 896 501 4621 67 896 501 1402 100 148 501 1863 64 988 827 2687 41 896 827 213 72 810 827 4248 67 647 1841 827 96 896 1841 1484 56 166 2687 3399 66 896 2687 898 28 566 3399 4726 78 896 3399 3934 70 786 3399 4651 3 600 156 1455 2 288 156 428 42 902 525 4583 53 288 525 2203 95 57 525 197 87 456 975 3844 62 288 975 1842 44 554 1118 525 40 288 1118 592 1 672 1118 1612 56 493 1345 3892 11 288 1345 2758 61 984 1345 1963 63 332 1455 4953 45 288 1455 4033 23 288 1455 3167 22 555 1455 3639 10 512 3844 1345 71 288 3844 4147 37 53 3892 1118 47 288 3892 680 56 539 3892 4073 4 591 4033 4354 3 288 4033 663 31 189 4033 201 72 973 4354 975 85 288 4354 2219 39 271 4354 1730 18 182 157 4237 35 680 157 2116 99 342 157 2488 78 412 1760 3744 85 680 1760 2328 64 291 1760 4646 100 50 2128 4417 35 680 2128 379 67 576 2312 4879 50 680 2312 2394 98 69 2728 3063 18 680 2728 708 83 589 2817 2728 23 680 2817 3789 23 145 2817 2960 65 649 3063 1760 1 680 3063 3149 73 591 3063 162 71 714 3744 2128 11 680 3744 3051 73 409 3947 4638 36 680 3947 2312 6 680 3947 2854 97 411 3947 4619 87 582 4237 2817 40 680 4237 2534 9 473 4417 3947 67 680 4417 3364 11 605 158 2428 84 1632 158 4403 51 450 910 3921 11 1632 910 4614 99 524 910 3175 32 220 939 2655 28 1632 939 4145 69 958 939 1357 82 594 1940 2670 99 1632 1940 4710 41 1632 1940 1307 69 260 2065 4660 37 1632 2065 4448 60 150 2428 1940 49 1632 2428 2600 90 127 2655 910 25 1632 2655 2257 84 622 2655 1462 37 407 2670 939 74 1632 2670 1810 65 333 3921 2065 73 1632 3921 1173 28 704 159 3672 75 385 159 3077 72 203 159 1473 26 511 579 3293 11 385 579 1752 78 135 579 4647 39 952 790 4750 13 385 790 681 90 967 1071 1160 41 385 1071 3135 37 535 1160 3366 67 385 1160 3628 34 957 1385 2751 21 385 1385 624 35 485 2751 3677 61 385 2751 4012 24 626 3293 1385 51 385 3293 2496 41 24 3293 467 84 484 3366 579 100 385 3366 2747 92 148 3672 1071 71 385 3672 4976 30 385 3672 3284 50 123 3672 2428 20 208 3677 790 35 385 3677 1577 26 867 160 3589 62 364 160 619 83 667 160 1778 89 801 881 1125 99 364 881 3647 89 342 1039 1856 29 364 1039 708 53 434 1039 3704 83 974 1125 2574 51 364 1125 4960 96 364 1125 4614 22 597 1125 910 1 90 1856 2982 95 364 1856 1195 85 106 1856 2441 40 135 1862 1039 29 364 1862 3931 32 549 2574 1862 86 364 2574 4154 32 936 2574 2115 6 169 2898 881 67 364 2898 815 39 336 2898 2146 87 414 2982 4581 15 364 2982 2350 22 211 2982 788 96 283 3589 2898 73 364 3589 3483 97 178 161 3887 58 1053 161 4993 55 503 673 1527 88 1053 673 837 25 554 822 4143 5 1053 822 4982 20 43 1527 2777 81 1053 1527 501 42 388 2366 4920 51 1053 2366 4828 27 1053 2366 1295 90 617 2777 4020 4 1053 2777 3193 45 97 2777 3024 6 508 2994 673 90 1053 2994 607 73 116 3887 2994 13 1053 3887 4893 19 281 3887 1589 97 244 4020 822 96 1053 4020 4904 91 360 4020 3773 61 861 4143 2366 94 1053 4143 469 86 879 162 2564 15 382 162 2026 70 338 1024 2750 38 382 1024 4735 14 382 1024 3907 84 7 1024 4638 13 426 1451 1024 58 382 1451 3725 99 754 2564 2918 11 382 2564 4072 81 293 2750 4649 99 382 2750 1607 46 645 2750 1888 9 686 2918 1451 34 382 2918 1403 93 762 163 2127 94 582 163 3987 45 308 163 391 57 704 1312 4005 63 582 1312 2082 39 41 1762 3417 1 582 1762 4672 81 582 1762 560 40 224 2127 3919 71 582 2127 4131 100 369 3417 1312 69 582 3417 3561 91 626 3919 1762 13 582 3919 1079 79 543 3919 2970 97 574 4005 4697 75 582 4005 1670 79 582 4005 3172 19 731 164 702 70 378 164 1795 70 625 692 4797 11 378 692 4695 16 378 692 2750 68 879 702 3553 71 378 702 3853 98 104 702 4604 74 207 3098 3257 55 378 3098 2757 17 127 3098 1537 72 828 3257 3682 9 378 3257 3627 56 603 3257 1553 62 450 3304 3098 92 378 3304 4956 48 117 3304 4657 26 198 3553 3304 83 378 3553 4400 2 401 3553 3770 26 400 3682 692 29 378 3682 784 12 192 165 961 49 217 165 1380 48 692 961 2784 74 217 961 2345 2 867 961 1756 55 253 1320 2420 51 217 1320 2368 12 648 1320 1715 55 632 1381 2306 90 217 1381 1271 2 747 1717 4922 25 217 1717 4773 60 973 1717 3259 86 878 2306 4264 85 217 2306 4614 52 294 2420 4667 3 217 2420 2771 20 217 2420 4577 75 330 2420 4412 35 896 2771 4208 46 217 2771 2495 82 293 2784 2882 6 217 2784 4701 52 235 2882 1320 73 217 2882 2780 6 457 4208 1381 14 217 4208 1141 15 811 4264 1717 9 217 4264 1573 100 459 166 3886 28 412 166 3909 77 439 1253 1997 25 412 1253 362 97 14 1997 4797 83 412 1997 1817 44 780 2009 1253 59 412 2009 3142 30 256 2309 2009 18 412 2309 815 82 985 2309 2355 62 464 3475 2309 55 412 3475 4606 26 412 3475 3507 92 66 3475 4006 10 312 3886 3475 43 412 3886 1791 89 136 3886 1869 78 179 167 4260 31 378 167 1040 11 157 167 2308 68 828 607 932 81 378 607 2639 83 513 932 3895 67 378 932 591 33 305 932 3264 33 537 2550 3198 7 378 2550 3578 54 538 2550 1683 72 993 2663 4748 25 378 2663 4895 47 378 2663 478 78 838 3198 2663 91 378 3198 89 48 122 3198 3062 27 370 3823 2550 42 378 3823 3836 83 347 3895 3823 20 378 3895 893 25 549 4260 607 22 378 4260 1714 70 39 4260 1038 19 777 168 2513 56 371 168 1425 90 794 168 253 18 388 562 3562 51 371 562 2570 75 189 562 376 52 318 616 4934 77 371 616 3055 46 371 616 294 41 299 616 1626 41 692 2513 3668 6 371 2513 423 2 621 2513 4207 23 345 2848 3580 54 371 2848 2368 47 885 2848 3362 64 921 3055 3099 76 371 3055 990 36 554 3055 4638 4 339 3099 562 27 371 3099 1711 69 233 3099 387 10 279 3562 3814 9 371 3562 2971 93 527 3562 2047 29 976 3580 3703 46 371 3580 413 74 246 3580 3272 75 443 3668 2848 77 371 3668 2764 67 886 3703 616 53 371 3703 2004 12 665 3814 4585 27 371 3814 1013 51 42 3814 4249 77 224 169 2409 28 420 169 4148 6 931 169 2556 93 512 1100 2069 99 420 1100 4926 71 423 1698 4633 16 420 1698 4590 48 769 1811 2584 75 420 1811 4612 62 356 1811 4810 92 113 2069 4757 83 420 2069 1811 8 420 2069 3603 72 504 2069 4393 69 267 2324 3436 38 420 2324 2885 81 937 2409 2324 45 420 2409 4553 92 513 2409 1120 5 497 2584 1698 49 420 2584 1322 24 785 2584 4061 86 532 3436 1100 36 420 3436 4956 76 114 170 1801 13 1017 170 3196 73 82 170 1505 86 258 665 779 76 1017 665 4306 53 648 779 4405 85 1017 779 4265 4 90 779 2909 89 796 992 665 22 1017 992 1103 16 27 992 1382 55 79 1361 2741 67 1017 1361 4816 74 639 1361 895 67 909 1801 4633 63 1017 1801 3782 47 1017 1801 3096 59 13 1801 2934 27 518 2741 4091 56 1017 2741 3436 3 95 3782 1361 87 1017 3782 4164 67 790 4091 4368 64 1017 4091 1943 59 981 4368 992 3 1017 4368 16 7 708 4368 2046 88 736 4405 4745 62 1017 4405 1958 31 740 4405 3636 2 15 171 2395 72 719 171 4135 8 921 171 4728 41 685 1539 1725 47 719 1539 2128 31 550 1725 2669 33 719 1725 2902 75 316 1725 2209 40 381 2395 2880 85 719 2395 340 80 728 2395 3890 98 842 2669 4856 36 719 2669 3716 99 1000 2880 3079 60 719 2880 1840 91 622 2880 2826 26 440 3079 1539 22 719 3079 4937 3 719 3079 1322 15 801 3079 3186 61 756 172 3420 64 24 172 3232 71 11 734 769 45 24 734 796 50 10 769 4587 57 24 769 4842 25 24 769 1449 39 378 769 2599 42 825 1237 2766 50 24 1237 4270 35 29 1237 2300 81 180 2766 734 77 24 2766 2336 66 702 2992 1237 13 24 2992 1015 80 141 2992 1181 35 165 3420 2992 42 24 3420 4916 53 307 173 3146 3 476 173 1662 76 798 173 1909 66 846 874 2664 39 476 874 310 3 27 1162 874 70 476 1162 3372 78 297 1162 4154 48 309 2576 3135 45 476 2576 1697 49 44 2664 4542 65 476 2664 3597 41 984 3135 4625 37 476 3135 1162 68 476 3135 4061 45 687 3135 448 33 998 3146 4161 44 476 3146 4004 100 869 4161 2576 35 476 4161 3684 68 389 174 3749 37 692 174 648 81 995 1115 4291 58 692 1115 651 93 580 1115 1010 15 590 2362 4390 52 692 2362 4509 24 692 2362 2951 80 384 2362 2630 59 259 3664 4880 68 692 3664 736 32 51 3664 1941 78 792 3749 1115 52 692 3749 3625 28 263 3749 4257 61 52 4291 2362 8 692 4291 4315 98 792 4390 3664 26 692 4390 96 81 366 175 1397 41 334 175 3617 58 252 1397 2585 38 334 1397 3031 92 532 1397 3842 88 45 2281 3473 11 334 2281 1676 8 392 2281 1692 65 60 2585 3986 41 334 2585 4850 68 334 2585 3478 35 115 2744 2281 67 334 2744 1271 47 504 2744 3945 39 205 2937 4604 72 334 2937 3410 77 176 3473 2937 99 334 3473 4767 98 951 3473 2713 37 463 3986 2744 4 334 3986 1060 15 589 176 763 44 426 176 1162 69 174 176 1775 36 536 763 2931 68 426 763 4340 93 254 763 913 66 791 2192 4963 13 426 2192 2310 56 623 2205 2967 4 426 2205 2795 77 389 2775 3542 24 426 2775 1707 98 178 2775 207 58 421 2931 2775 25 426 2931 4955 96 391 2931 658 91 440 2967 2192 97 426 2967 4342 41 273 3542 2205 62 426 3542 4929 61 426 3542 3761 70 771 3542 1640 48 943 177 1645 85 26 177 603 88 814 892 2625 94 26 892 2977 100 844 892 3419 60 435 1645 892 38 26 1645 4589 43 26 1645 3455 97 264 1645 1893 28 360 1956 4360 85 26 1956 1988 64 752 2625 4279 71 26 2625 4149 95 262 2625 470 35 946 2954 4671 13 26 2954 657 45 521 2954 4790 96 560 4279 1956 14 26 4279 4354 37 189 4279 3564 92 148 4360 2954 53 26 4360 2037 22 125 178 3808 67 71 178 1550 50 992 1447 4549 5 71 1447 4703 97 71 1447 4775 44 551 1447 4506 22 303 2472 2851 59 71 2472 232 72 775 2851 4385 14 71 2851 4944 77 94 3808 2472 93 71 3808 4641 79 893 3808 867 2 689 4385 1447 28 71 4385 4824 5 413 4385 1984 72 491 179 3687 6 45 179 3045 60 241 179 1887 87 890 1386 3401 50 45 1386 4981 29 45 1386 4034 98 58 1545 2709 51 45 1545 2715 38 360 1545 3227 7 926 2709 3875 72 45 2709 1212 80 603 2709 1553 97 486 3401 1545 41 45 3401 93 2 494 3401 1233 82 261 3687 1386 78 45 3687 1228 63 777 3875 4976 64 45 3875 4608 52 131 180 4366 16 97 180 778 79 317 978 3213 64 97 978 2071 33 507 978 2680 86 161 1146 4173 12 97 1146 862 40 616 1146 1724 75 36 1750 978 94 97 1750 1427 21 100 1750 3950 65 44 2361 1750 61 97 2361 4611 96 97 2361 3365 71 949 2361 4782 88 499 3201 4916 54 97 3201 4342 15 740 3201 2133 2 318 3213 1146 50 97 3213 1701 13 195 3213 1376 82 531 4173 3201 31 97 4173 4514 60 684 4173 4200 8 225 4366 2361 49 97 4366 416 74 668 4366 4407 50 424 181 1624 100 619 181 4493 3 842 181 3159 43 138 698 1400 49 619 698 37 66 273 698 906 44 583 1400 4791 11 619 1400 1392 29 229 1624 4082 12 619 1624 3987 60 688 2071 4645 83 619 2071 3756 49 619 2071 2811 63 767 2071 3371 58 625 3756 4474 41 619 3756 4684 30 985 3756 3183 14 369 4082 4178 99 619 4082 330 67 349 4178 2071 32 619 4178 4712 98 133 4474 698 39 619 4474 341 66 475 182 1137 74 803 182 1051 33 749 182 4160 10 103 1137 2881 13 803 1137 3651 81 734 1137 4082 58 906 1506 3819 13 803 1506 2014 66 851 1506 2967 18 223 2501 1506 40 803 2501 2538 6 920 2501 4541 82 424 2721 3717 61 803 2721 4305 32 461 2721 402 22 313 2738 4980 95 803 2738 4799 43 396 2738 3115 97 613 2881 2501 87 803 2881 1100 85 702 2973 2721 54 803 2973 4851 58 187 3623 2973 17 803 3623 4549 23 803 3623 3861 95 942 3717 2738 18 803 3717 3553 44 900 3819 3623 90 803 3819 2305 7 798 3819 1700 25 912 183 942 40 236 183 2355 60 227 879 3988 5 236 879 4347 39 953 942 2030 86 236 942 3270 54 729 1204 879 16 236 1204 4906 83 360 1204 2925 4 844 2030 1204 2 236 2030 4694 59 577 2288 2619 61 236 2288 4741 11 236 2288 3085 22 44 2288 1113 82 492 2619 4810 56 236 2619 828 48 925 3988 2288 88 236 3988 778 84 203 3988 633 5 478 184 2639 5 293 184 4235 15 317 184 1643 12 610 1639 4768 22 293 1639 1245 44 635 1639 4439 45 89 1980 3643 88 293 1980 379 88 764 2639 3669 49 293 2639 441 82 528 2639 329 69 484 3643 4386 24 293 3643 1004 96 488 3669 3931 8 293 3669 4260 90 771 3669 4080 30 625 3931 4707 72 293 3931 1980 83 293 3931 1462 40 897 3931 81 58 917 4386 1639 23 293 4386 3052 24 91 185 3085 69 571 185 822 8 423 1540 2320 20 571 1540 3318 64 728 1540 4718 48 284 1636 4608 57 571 1636 4604 13 571 1636 1188 62 169 1742 2804 33 571 1742 925 24 903 1742 1960 63 372 2159 1742 43 571 2159 3213 95 860 2320 1636 15 571 2320 3067 12 549 2390 1540 54 571 2390 3219 86 61 2390 4089 46 602 2804 2390 97 571 2804 1861 64 826 3085 2159 5 571 3085 4476 21 735 186 2448 36 497 186 3572 68 738 1129 1277 28 497 1129 4745 99 118 1277 4880 72 497 1277 2929 95 497 1277 4659 16 253 1633 2184 48 497 1633 4819 10 743 1633 2276 56 763 2184 3649 52 497 2184 823 92 576 2448 1633 65 497 2448 2484 44 522 2448 3462 37 267 2929 3152 63 497 2929 1203 8 387 2929 963 62 984 3152 4578 20 497 3152 888 77 202 3152 2650 11 929 3649 1129 94 497 3649 1169 29 943 3649 3644 97 457 187 2599 68 390 187 446 8 782 187 2558 91 240 935 2346 50 390 935 113 26 881 2285 4328 26 390 2285 2952 74 654 2285 1792 77 301 2346 3758 33 390 2346 4961 95 276 2346 2275 83 478 2599 2285 46 390 2599 160 89 775 3153 4928 3 390 3153 250 93 468 3307 935 61 390 3307 4339 80 931 3307 1942 76 125 3758 3153 30 390 3758 4988 27 390 3758 3486 100 197 3758 4202 83 854 4328 3307 7 390 4328 1555 72 548 4328 44 70 385 188 3559 18 451 188 597 93 255 949 1080 10 451 949 1877 46 211 949 2423 39 250 1080 1739 27 451 1080 49 20 278 1080 780 15 892 1498 3501 100 451 1498 4541 57 451 1498 266 71 16 1498 1136 10 888 1739 1498 91 451 1739 1385 71 747 2017 4798 6 451 2017 3450 53 482 2017 4571 2 920 3490 949 58 451 3490 3951 37 903 3490 3240 88 764 3501 2017 69 451 3501 2400 29 977 3501 3957 52 126 3559 3490 85 451 3559 4500 49 594 189 708 95 545 189 4237 79 784 708 3906 24 545 708 4508 2 545 708 4311 3 854 708 3313 24 733 1974 2123 19 545 1974 3500 21 234 1974 2761 77 854 2123 2446 20 545 2123 4057 13 619 2123 4271 15 199 2426 3966 94 545 2426 3631 25 997 2426 1702 61 890 2446 4822 97 545 2446 3377 1 173 3906 2426 1 545 3906 2461 58 905 3966 1974 15 545 3966 2280 42 282 190 4116 8 524 190 2149 6 569 799 1919 74 524 799 2581 21 131 1591 799 93 524 1591 1192 36 263 1919 3515 76 524 1919 2717 40 511 1919 4008 98 793 2271 4759 88 524 2271 4846 96 524 2271 2784 24 253 2271 3431 80 561 3515 3913 84 524 3515 556 16 860 3913 2271 44 524 3913 4350 100 664 3913 2735 41 586 4116 4404 56 524 4116 205 67 943 4404 1591 70 524 4404 3045 4 607 191 1718 80 27 191 4569 63 388 191 1735 40 299 529 3508 97 27 529 1186 69 4 550 2493 79 27 550 945 35 87 1718 550 52 27 1718 4815 45 116 1740 4949 81 27 1740 203 28 97 1740 3514 74 816 2493 529 1 27 2493 4954 12 27 2493 1971 95 673 3508 1740 6 27 3508 2246 50 977 192 3267 42 402 192 3082 40 585 192 631 37 485 625 4540 94 402 625 4929 49 968 1353 1715 96 402 1353 1289 85 137 1695 4402 22 402 1695 3701 55 769 1715 4892 37 402 1715 2136 5 402 1715 4391 34 497 1715 4013 93 67 2136 1695 52 402 2136 3599 79 278 2136 243 32 885 2907 625 65 402 2907 2107 37 151 2907 3797 60 222 3267 3694 68 402 3267 1568 92 650 3694 1353 54 402 3694 4959 56 311 3694 4443 27 74 4402 2907 55 402 4402 250 50 394 193 730 97 468 193 4684 70 965 599 3532 10 468 599 3962 5 10 730 2570 63 468 730 4633 10 201 730 4033 38 991 1132 1930 58 468 1132 3687 24 525 1209 1132 70 468 1209 3351 57 278 1930 2450 7 468 1930 2914 38 791 1930 3853 41 420 2450 4954 70 468 2450 2052 5 518 2450 3252 92 845 2570 599 28 468 2570 4183 52 25 3532 1209 8 468 3532 4845 37 468 3532 1343 31 636 194 3540 60 721 194 3544 97 123 194 3036 63 566 570 2612 56 721 570 4479 98 16 570 3850 51 843 921 4833 11 721 921 1927 17 721 921 1565 50 441 1246 570 64 721 1246 2014 23 115 1246 1890 19 365 1682 2104 73 721 1682 2920 64 853 1927 4463 63 721 1927 4364 66 578 2104 1246 94 721 2104 4501 95 780 2104 4783 79 849 2612 4745 5 721 2612 167 22 568 2768 921 26 721 2768 450 38 135 2768 4139 40 253 3540 2768 48 721 3540 1320 2 63 3540 3259 5 568 4024 1682 87 721 4024 960 2 541 4463 4024 29 721 4463 1106 23 799 195 2711 36 497 195 3230 87 843 794 2545 25 497 794 295 9 192 1716 3597 84 497 1716 3373 44 812 2218 1716 63 497 2218 4578 8 993 2545 4227 2 497 2545 1233 64 931 2545 959 3 459 2587 2218 77 497 2587 4256 29 335 2711 794 60 497 2711 3525 85 764 3320 4687 33 497 3320 3378 18 497 3320 3381 58 423 3320 1556 10 109 3378 4987 36 497 3378 3623 94 702 3378 4903 2 613 3597 3320 26 497 3597 689 70 946 3597 2743 60 715 4227 2587 47 497 4227 4508 20 429 196 2108 41 584 196 340 61 440 196 179 7 603 1414 2919 93 584 1414 4394 50 863 1477 1414 1 584 1477 1630 32 81 1505 4984 37 584 1505 4694 97 584 1505 1176 37 268 1596 1477 96 584 1596 1394 76 267 1596 1046 55 775 2108 1596 18 584 2108 2935 22 71 2108 1895 40 39 2919 1505 10 584 2919 4841 45 932 2919 1614 55 327 197 3865 30 630 197 2580 77 448 719 4078 2 630 719 4869 43 630 719 3557 77 839 846 3600 45 630 846 4965 47 829 1435 2272 22 630 1435 3803 51 333 1803 1435 38 630 1803 2101 56 632 1803 565 69 632 2272 719 19 630 2272 3553 62 225 3600 4939 80 630 3600 3189 53 642 3865 1803 85 630 3865 2297 5 556 4078 846 11 630 4078 3392 55 136 4078 4389 36 238 198 1775 78 755 198 122 43 937 198 968 64 773 1330 3477 53 755 1330 2669 76 518 1330 4415 93 652 1775 4475 18 755 1775 3869 78 937 2662 3414 14 755 2662 1188 86 17 3414 1330 30 755 3414 2945 21 403 3414 1211 24 259 3477 4309 44 755 3477 4590 19 755 3477 80 25 235 3477 3222 74 669 3609 3630 62 755 3609 523 62 320 3609 2263 58 864 3630 2662 99 755 3630 3389 47 676 4309 4792 93 755 4309 1649 93 583 4309 270 31 386 4475 3609 49 755 4475 47 13 292 199 1295 52 308 199 2003 14 893 199 4091 44 551 1295 3424 9 308 1295 3754 89 668 1722 3357 44 308 1722 1572 3 931 2691 1722 73 308 2691 155 60 613 3357 4535 9 308 3357 3410 29 595 3407 2691 26 308 3407 1558 18 647 3407 463 69 651 3424 3407 92 308 3424 4957 84 308 3424 1850 65 27 3424 3258 43 272 200 4337 27 853 200 3348 82 747 943 4259 58 853 943 1484 98 695 1433 4066 19 853 1433 2212 20 522 2708 3291 3 853 2708 3517 82 868 2708 4620 11 917 3291 4176 45 853 3291 2920 3 486 3300 943 97 853 3300 172 4 899 3300 3999 85 450 3770 1433 57 853 3770 1800 84 918 3770 4044 94 510 4066 4863 96 853 4066 2745 93 593 4176 3770 30 853 4176 2159 38 412 4176 2898 47 669 4259 2708 19 853 4259 4742 16 853 4259 4599 22 676 4337 3300 25 853 4337 2383 51 80 201 3928 96 1693 201 4850 64 110 201 811 33 652 744 2455 38 1693 744 4007 36 753 1006 4516 83 1693 1006 4946 98 1693 1006 716 21 22 1893 4415 21 1693 1893 1070 45 729 2455 1893 15 1693 2455 4568 78 516 2455 4546 53 848 3928 744 47 1693 3928 1142 100 711 3928 944 29 401 4415 1006 88 1693 4415 1909 39 790 202 1955 66 1352 202 3407 45 665 202 2568 31 708 731 3421 26 1352 731 3 66 673 1764 731 97 1352 1764 4988 63 1352 1764 24 97 799 1955 2872 78 1352 1955 2330 50 263 2872 1764 60 1352 2872 4006 81 328 3050 4625 23 1352 3050 3838 73 932 3050 4545 56 794 3421 3951 19 1352 3421 4602 12 84 3951 3050 71 1352 3951 3775 76 125 203 3736 26 224 203 4225 99 405 203 4158 27 165 1806 2963 53 224 1806 1585 31 575 1806 4029 9 571 2800 3845 41 224 2800 854 28 904 2800 1961 2 341 2963 4839 91 224 2963 2800 9 224 2963 4641 81 4 3736 1806 99 224 3736 2942 50 728 3736 3037 50 374 3845 4755 26 224 3845 1338 33 894 3845 4345 46 885 204 2922 36 247 204 170 65 462 856 1992 99 247 856 1724 63 628 856 3776 23 178 871 998 46 247 871 3734 45 442 871 4449 25 557 998 3352 85 247 998 4770 42 148 998 164 19 316 1409 871 84 247 1409 2782 98 993 1547 4938 46 247 1547 4511 44 247 1547 2833 9 149 1986 2384 65 247 1986 3249 53 198 1992 1409 30 247 1992 2270 50 737 2384 1547 44 247 2384 2009 58 799 2922 856 81 247 2922 3810 15 517 2922 4178 86 906 3352 1986 54 247 3352 4995 55 31 3352 1840 31 510 205 1238 2 688 205 3823 58 369 1084 2701 42 688 1084 1645 1 855 1238 1084 70 688 1238 1789 29 371 2236 4659 36 688 2236 3472 95 587 2701 2943 6 688 2701 2551 3 392 2943 3006 49 688 2943 4369 70 996 3006 4445 84 688 3006 4538 55 688 3006 2708 52 192 3006 4497 84 223 4257 2236 20 688 4257 2776 56 248 4445 4257 21 688 4445 2834 90 689 206 3883 22 585 206 2943 10 322 551 2261 61 585 551 1742 34 649 601 2988 71 585 601 4949 66 585 601 1046 71 709 743 4212 62 585 743 934 34 725 2261 2867 7 585 2261 590 87 320 2867 601 42 585 2867 4725 55 997 2867 4892 13 362 2988 4642 73 585 2988 3793 44 80 3883 743 69 585 3883 802 72 370 3883 640 34 337 4212 551 51 585 4212 306 54 262 4212 1788 47 358 207 1327 25 334 207 1665 68 196 207 4224 73 311 1180 4253 32 334 1180 2630 90 327 1180 1749 15 155 1327 3233 33 334 1327 3285 54 811 1807 4531 15 334 1807 4180 38 334 1807 1990 33 347 3233 1180 68 334 3233 1631 26 315 3233 1890 50 861 4180 4672 3 334 4180 4800 6 76 4253 1807 78 334 4253 3433 27 789 4253 227 70 250 208 3041 6 526 208 2741 31 541 948 1399 92 526 948 3297 12 404 1159 3170 80 526 1159 2227 65 562 1159 692 5 340 1399 1159 3 526 1399 645 88 275 1877 4267 58 526 1877 2102 20 65 1877 163 3 274 2224 3907 63 526 2224 4084 2 285 3041 4662 34 526 3041 948 99 526 3041 4624 28 204 3170 1877 25 526 3170 3010 50 638 3170 502 10 271 3907 4914 90 526 3907 671 80 198 4267 2224 38 526 4267 4064 43 399 209 3971 39 399 209 4521 6 462 209 1163 79 548 1196 2812 4 399 1196 1855 2 499 1631 1196 8 399 1631 4274 100 383 1631 147 82 410 2000 4591 6 399 2000 4391 60 528 2812 2000 2 399 2812 4776 36 668 2812 3753 76 204 2833 1631 43 399 2833 4655 28 399 2833 4347 53 594 3971 2833 84 399 3971 1341 88 559 3971 3517 18 264 210 657 62 270 210 4827 16 359 657 3614 57 270 657 3216 95 65 767 4561 33 270 767 526 32 697 767 3044 92 989 1391 2980 11 270 1391 1113 31 62 1391 191 88 921 2980 3031 95 270 2980 4196 77 834 2980 1503 18 969 3031 767 34 270 3031 4934 32 681 3031 2102 71 85 3614 1391 47 270 3614 4734 84 270 3614 1122 18 786 211 3937 30 826 211 1230 12 252 574 2295 60 826 574 2625 84 714 1093 2355 41 826 1093 1048 89 335 1470 3453 46 826 1470 287 99 24 1470 746 83 422 1827 2293 23 826 1827 1541 6 597 2293 574 59 826 2293 1908 53 2 2293 722 9 687 2295 3534 19 826 2295 4355 72 133 2355 1827 34 826 2355 2583 94 775 3453 3622 45 826 3453 4355 58 640 3453 2875 72 205 3534 1470 72 826 3534 655 42 220 3622 3763 98 826 3622 3519 11 886 3763 4858 53 826 3763 4782 12 826 3763 4639 50 826 3763 2261 51 559 3937 1093 41 826 3937 2660 34 399 212 2559 42 150 212 1109 57 697 212 925 25 918 1786 4103 59 150 1786 4648 19 150 1786 3409 86 986 1786 2634 46 809 2157 2301 13 150 2157 4851 54 381 2157 2703 36 606 2301 3510 56 150 2301 3545 39 537 2301 1617 27 597 2559 3836 94 150 2559 2738 21 967 2559 1075 34 313 2776 1786 99 150 2776 3155 67 825 3510 2776 4 150 3510 2494 40 519 3510 4861 74 874 3836 2157 48 150 3836 3720 26 219 3836 1336 21 406 4103 4852 80 150 4103 806 93 360 213 4099 5 472 213 170 28 197 855 2822 45 472 855 1828 52 885 855 3707 5 728 934 3432 55 472 934 1882 20 958 934 1371 57 543 1028 1970 51 472 1028 2403 26 477 1028 143 75 173 1374 1028 13 472 1374 3507 24 711 1374 836 95 291 1970 4629 53 472 1970 2478 43 94 2822 4672 50 472 2822 934 45 472 2822 2410 49 984 2822 4399 37 462 3078 855 96 472 3078 591 97 679 3078 3812 4 702 3432 1374 79 472 3432 4976 10 400 3432 4085 30 973 4027 3078 17 472 4027 3276 39 758 4027 3232 47 341 4099 4027 35 472 4099 719 78 784 214 4034 81 545 214 589 87 380 214 3758 18 932 887 3544 96 545 887 4130 15 773 952 887 29 545 952 303 70 556 952 1367 44 405 1097 1110 35 545 1097 849 1 261 1110 952 58 545 1110 2489 92 389 1110 901 16 298 1829 4807 12 545 1829 3118 81 506 1829 3107 85 98 3544 1829 33 545 3544 4834 61 545 3544 3117 86 942 4034 1097 52 545 4034 1089 23 147 4034 1889 61 347 215 2045 57 275 215 4995 30 86 215 4506 78 342 1487 4896 3 275 1487 4984 3 275 1487 126 64 185 1487 2774 67 918 1578 1487 7 275 1578 1786 5 649 1828 3464 26 275 1828 2898 52 50 1828 898 90 22 2045 1828 99 275 2045 4782 28 170 2045 4018 85 940 3464 4136 92 275 3464 2447 8 322 3464 153 63 518 4136 4459 72 275 4136 829 87 582 4136 1426 44 24 4459 1578 70 275 4459 1762 29 331 4459 4683 57 128 216 2403 42 732 216 3159 72 244 1404 2801 7 732 1404 2272 81 949 1404 4511 64 231 2321 3049 42 732 2321 4547 90 732 2321 825 45 831 2403 2321 77 732 2403 2438 59 506 2561 1404 39 732 2561 1430 48 416 2801 4810 86 732 2801 361 64 481 2801 1073 6 554 3049 3084 48 732 3049 3652 35 509 3084 2561 95 732 3084 2578 40 882 3084 2549 74 152 217 1816 78 675 217 3882 43 533 217 4007 33 252 917 4725 98 675 917 2612 60 906 1500 4433 70 675 1500 2298 16 126 1500 3395 42 166 1689 917 73 675 1689 4090 66 389 1816 3219 41 675 1816 4951 4 618 1816 2436 41 41 3219 1500 45 675 3219 2162 41 66 3329 1689 85 675 3329 2603 47 498 3329 3829 91 424 3635 3329 8 675 3635 4752 88 675 3635 2550 9 917 4433 3635 55 675 4433 1716 24 356 218 1088 25 351 218 3638 76 823 1016 3788 62 351 1016 1467 18 355 1016 972 78 194 1088 3288 71 351 1088 4996 91 351 1088 3287 18 920 2859 2861 91 351 2859 2429 57 418 2861 1016 61 351 2861 2172 85 949 3288 3593 68 351 3288 2625 6 640 3593 2859 35 351 3593 1702 38 610 3593 3730 78 168 3788 4882 21 351 3788 4861 20 144 219 4155 26 897 219 1102 33 424 219 4317 95 782 565 2360 36 897 565 2052 88 122 565 459 55 710 1593 2659 45 897 1593 4030 6 634 1593 4410 50 906 2325 4469 91 897 2325 3794 14 307 2360 4609 54 897 2360 4501 16 664 2360 923 86 249 2462 2325 78 897 2462 148 17 585 2659 565 20 897 2659 4645 19 897 2659 2946 74 983 4155 2462 86 897 4155 3746 30 334 4469 1593 5 897 4469 1841 85 596 4469 1428 12 661 220 3294 60 572 220 1290 17 806 516 929 32 572 516 4103 29 843 516 1995 62 622 724 2163 87 572 724 1676 34 862 839 1116 65 572 839 3193 33 768 929 4910 45 572 929 3531 23 572 929 91 43 982 929 3490 32 48 1012 724 75 572 1012 4315 75 551 1012 2168 49 318 1116 1165 10 572 1116 4030 36 767 1165 1012 20 572 1165 757 24 457 1165 1304 2 259 2163 516 94 572 2163 3775 32 594 3294 839 80 572 3294 4547 38 476 3531 4759 22 572 3531 13 21 67 221 4235 56 270 221 2474 31 10 1627 3306 42 270 1627 3943 17 173 1627 4681 17 152 3306 4714 6 270 3306 1392 93 78 3306 4969 10 560 3328 4070 89 270 3328 3611 14 278 3328 650 5 157 4070 4418 85 270 4070 4983 8 270 4070 1841 82 312 4235 3328 57 270 4235 3358 35 171 4418 1627 48 270 4418 777 2 296 4418 3631 72 207 222 926 76 68 222 3995 35 917 926 4023 41 68 926 339 5 207 1957 4889 6 68 1957 4456 48 68 1957 4433 67 895 1957 3965 87 124 2036 3434 24 68 2036 674 22 444 2036 2825 20 611 3269 1957 20 68 3269 2400 19 548 3269 4469 78 847 3434 4694 7 68 3434 2473 36 312 3990 3269 55 68 3990 714 45 883 4023 3990 76 68 4023 364 29 326 4456 2036 53 68 4456 1976 21 579 223 2684 83 843 223 3028 91 829 648 3373 3 843 648 3209 81 596 648 995 45 563 1198 4958 63 843 1198 439 78 645 1198 775 32 248 1479 3688 45 843 1479 763 70 78 2684 648 40 843 2684 4535 99 940 2684 224 24 399 3045 3815 22 843 3045 4400 41 663 3373 3045 12 843 3373 201 84 981 3688 1198 53 843 3688 4177 66 193 3815 1479 86 843 3815 4694 89 843 3815 224 21 990 224 4319 50 352 224 595 28 950 1027 4958 53 352 1027 2502 15 148 2080 4950 17 352 2080 3341 73 352 2080 1422 35 263 2999 1027 82 352 2999 3991 45 384 3268 4045 44 352 3268 1148 75 342 3341 2999 45 352 3341 3744 92 284 3341 1419 22 999 4045 2080 17 352 4045 3774 44 812 4319 3268 10 352 4319 149 56 764 225 2644 8 395 225 3812 66 308 225 4158 26 410 1650 4685 1 395 1650 147 61 75 1880 1650 99 395 1880 3521 60 810 1880 2599 44 884 2424 3780 97 395 2424 905 49 735 2631 1880 93 395 2631 2462 56 339 2631 4630 65 682 2644 2808 65 395 2644 1033 39 4 2808 2424 96 395 2808 3638 54 1000 2808 556 75 149 3780 2631 100 395 3780 4609 33 395 3780 3862 41 507 226 1902 77 584 226 3564 41 863 745 4834 34 584 745 2704 61 142 817 4348 42 584 817 3488 85 435 873 2464 70 584 873 3897 15 237 873 1995 98 784 1561 817 67 584 1561 4667 88 528 1561 2742 7 74 1902 2588 56 584 1902 3248 99 77 2131 873 76 584 2131 3075 70 433 2464 745 29 584 2464 816 39 843 2464 2792 68 969 2588 1561 16 584 2588 4830 58 584 2588 1558 83 85 2588 3467 11 77 3525 2131 68 584 3525 1326 56 874 4348 3525 14 584 4348 72 10 876 227 3681 74 192 227 869 51 79 227 3365 57 384 2129 3116 94 192 2129 4914 10 192 2129 1700 6 349 2924 4531 66 192 2924 731 49 246 2924 3473 34 379 3116 3263 45 192 3116 2171 92 626 3116 2063 92 314 3263 2924 2 192 3263 3985 47 224 3276 2129 25 192 3276 2599 11 373 3276 4340 27 114 3681 3276 70 192 3681 1911 70 346 228 4230 43 379 228 4758 69 289 980 3193 58 379 980 4941 1 411 1291 1691 94 379 1291 4118 26 567 1691 2440 65 379 1691 4059 28 567 1691 1466 25 912 2276 3639 95 379 2276 2621 6 544 2276 2569 12 675 2440 3840 92 379 2440 4665 84 270 3193 2276 97 379 3193 2846 42 329 3639 1291 23 379 3639 4752 22 379 3639 3099 28 273 3639 2609 34 87 3840 4869 86 379 3840 3047 99 97 4230 980 89 379 4230 2500 82 415 4230 1724 36 97 229 2699 38 325 229 1075 86 358 229 4133 13 241 802 1611 95 325 802 1836 82 795 802 2372 67 499 851 802 6 325 851 465 28 778 851 3706 96 489 976 4869 18 325 976 1176 7 615 1611 976 70 325 1611 3777 31 957 1611 2416 2 153 2699 3456 2 325 2699 4523 16 325 2699 3671 12 541 3456 3463 82 325 3456 1624 47 446 3463 851 12 325 3463 4847 35 790 230 1951 64 843 230 3913 77 339 230 2007 75 435 1141 4009 39 843 1141 3344 17 486 1951 4189 76 843 1951 4667 87 469 1951 1986 7 91 2051 4146 79 843 2051 23 52 847 2621 4591 76 843 2621 3745 42 843 2621 963 10 62 2621 2814 46 330 3745 2051 69 843 3745 792 28 186 4009 2621 11 843 4009 4668 9 504 4146 4516 79 843 4146 4982 33 698 4146 3194 59 857 4186 1141 70 843 4186 3961 62 368 4186 3096 27 203 4189 4186 88 843 4189 109 72 372 4189 29 1 879 231 3218 45 105 231 1169 10 240 800 1935 56 105 800 4842 55 422 969 3784 86 105 969 3984 40 624 969 3992 82 723 1413 969 71 105 1413 4893 30 105 1413 4804 52 900 1935 2624 3 105 1935 3491 58 310 1935 2448 66 135 2624 3899 21 105 2624 3850 75 431 3218 800 80 105 3218 3875 17 609 3218 4677 48 546 3784 4684 93 105 3784 3221 97 654 3899 1413 88 105 3899 820 52 691 3899 4188 32 334 232 584 79 978 232 4487 51 377 232 4489 1 635 584 4294 24 978 584 1737 10 296 584 365 68 681 1140 3511 9 978 1140 420 46 760 1140 4568 53 906 2406 4580 17 978 2406 1350 59 100 2995 3985 51 978 2995 454 96 341 3511 2406 39 978 3511 2303 77 17 3511 2541 99 929 3985 1140 91 978 3985 1181 51 627 4231 4701 62 978 4231 2995 100 978 4231 645 28 383 4294 4231 81 978 4294 617 1 181 233 1049 41 446 233 1268 51 975 233 4940 71 383 968 3140 48 446 968 2661 72 988 1049 968 11 446 1049 1609 71 898 1049 929 83 152 3140 4297 26 446 3140 2279 88 626 3140 1332 31 655 3159 4600 44 446 3159 454 31 676 3159 903 44 82 3765 4164 74 446 3765 1284 38 137 3765 2646 56 354 4164 3159 86 446 4164 4194 50 465 4164 4466 40 967 4297 3765 74 446 4297 4782 77 446 4297 4859 57 499 4297 655 15 548 234 919 67 102 234 1052 46 486 843 3502 52 102 843 2196 75 382 843 3816 28 864 919 3024 19 102 919 4960 75 102 919 4932 69 844 919 2559 48 308 1344 3816 43 102 1344 3427 6 868 1344 3952 86 899 3024 3230 18 102 3024 234 21 10 3230 843 1 102 3230 676 13 158 3502 1344 55 102 3502 4769 47 974 3502 3338 60 390 3816 4755 3 102 3816 488 21 923 3816 3060 68 645 235 967 73 315 235 1606 40 290 967 1926 25 315 967 4187 63 219 1297 2700 10 315 1297 1854 31 692 1926 4085 80 315 1926 4475 57 424 2202 3278 93 315 2202 4149 41 510 2202 2195 12 35 2315 3661 53 315 2315 1941 69 271 2315 102 49 98 2560 4800 10 315 2560 4513 78 932 2560 3963 60 765 2700 2315 62 315 2700 1458 47 718 2700 1693 86 676 3278 2560 79 315 3278 3371 87 814 3278 1175 17 372 3661 2202 22 315 3661 3866 100 866 4085 4709 86 315 4085 4144 26 315 4085 1701 21 391 4085 2212 73 159 4144 1297 5 315 4144 3706 11 412 4144 2030 55 859 236 3740 51 368 236 262 54 438 236 1060 11 657 902 4715 94 368 902 844 22 566 2398 3634 49 368 2398 4129 88 593 2398 4652 53 61 2418 2398 63 368 2418 4581 22 303 2418 3563 69 5 3634 4312 26 368 3634 4753 65 368 3634 1090 41 998 3634 3367 42 43 3740 2418 99 368 3740 1383 72 457 4312 902 72 368 4312 3703 27 877 4312 1296 92 248 237 4000 14 293 237 207 44 707 695 4543 75 293 695 2375 78 712 2647 695 93 293 2647 1338 52 846 3706 4220 25 293 3706 3675 71 715 4000 3706 35 293 4000 1207 94 630 4220 2647 9 293 4220 4596 13 293 4220 4513 52 513 4220 3485 80 503 238 1029 91 391 238 2508 29 331 1029 4062 62 391 1029 1888 23 744 1029 2913 96 728 1424 3296 49 391 1424 2785 1 48 1628 1424 57 391 1628 727 98 739 1628 2940 34 614 1632 1628 42 391 1632 2664 5 765 1632 4902 97 487 1765 1632 13 391 1765 4575 100 391 1765 392 33 23 1765 2822 16 138 3296 4744 71 391 3296 4909 47 229 4062 1765 65 391 4062 3630 14 464 4062 3551 52 979 239 2048 81 816 239 3523 29 323 239 3648 52 672 870 3828 3 816 870 260 63 412 1674 2533 52 816 1674 4656 40 816 1674 2651 72 889 2048 4108 73 816 2048 2066 67 593 2048 884 70 414 2533 4975 86 816 2533 4483 85 815 2533 2116 64 985 3828 1674 24 816 3828 2613 20 823 4108 870 80 816 4108 2387 18 842 4108 458 41 904 240 3888 76 456 240 785 17 496 2185 3761 12 456 2185 3305 38 618 2928 4363 35 456 2928 2584 30 245 2928 4534 88 605 3132 2928 78 456 3132 922 86 105 3292 3132 9 456 3292 3590 32 710 3292 3400 9 615 3761 4838 63 456 3761 447 89 295 3888 4387 66 456 3888 219 95 714 4363 2185 25 456 4363 4045 78 222 4363 4473 100 515 4387 3292 46 456 4387 4930 25 456 4387 588 63 106 4387 671 79 94 241 1821 98 490 241 3717 33 386 241 846 2 129 1521 3345 28 490 1521 1633 29 436 1821 3558 42 490 1821 4863 17 827 1821 569 81 799 2274 1521 2 490 2274 1292 44 612 2274 4498 94 162 2515 2274 28 490 2515 1960 64 998 2515 2100 50 674 3345 3839 54 490 3345 4757 63 490 3345 3654 54 14 3345 1077 54 30 3558 4430 84 490 3558 2860 92 510 3558 1275 35 31 3839 4826 51 490 3839 4845 80 887 4430 2515 8 490 4430 493 39 763 4430 4019 23 825 242 2763 32 123 242 4406 3 318 877 3253 58 123 877 2018 60 918 1156 2088 73 123 1156 690 88 207 1156 4044 69 214 2088 4506 15 123 2088 4980 20 553 2088 2879 97 802 2465 877 72 123 2465 2351 6 454 2763 4083 40 123 2763 134 39 244 2883 1156 63 123 2883 3338 95 971 3253 3261 26 123 3253 4824 23 388 3261 4854 29 123 3261 2883 38 123 3261 1749 57 109 4083 2465 37 123 4083 4978 82 739 243 2220 42 146 243 3109 80 592 1559 1598 61 146 1559 4731 56 146 1559 2661 79 898 1576 4353 42 146 1576 1737 33 725 1576 3522 97 16 1598 1790 32 146 1598 1477 51 912 1598 4910 91 619 1668 2650 8 146 1668 4523 88 619 1790 1576 70 146 1790 1246 48 437 2220 1559 58 146 2220 2181 39 307 2220 3102 25 699 2650 4900 33 146 2650 2016 60 449 4353 1668 86 146 4353 3998 36 407 4353 4196 9 891 244 1641 63 498 244 2800 83 498 1017 1142 7 498 1017 1641 39 673 1142 2871 46 498 1142 1842 43 509 1395 1871 85 498 1395 3358 48 374 1641 1395 51 498 1641 178 86 552 1641 246 94 68 1728 2453 67 498 1728 4600 15 498 1728 1819 92 887 1871 1728 85 498 1871 3504 26 742 1871 980 5 979 2453 2786 97 498 2453 4099 20 987 2786 1017 41 498 2786 3790 86 654 2871 3016 85 498 2871 2740 100 566 2871 4614 78 863 3016 4741 25 498 3016 1142 23 1 3016 1952 88 220 245 883 76 595 245 225 23 134 245 2882 11 774 883 4152 64 595 883 239 85 961 883 3565 68 303 1383 3054 17 595 1383 878 55 231 1867 2143 21 595 1867 1903 22 630 2143 3799 3 595 2143 1249 13 75 3054 1867 100 595 3054 1521 16 341 3054 2723 3 951 3187 4102 30 595 3187 4831 48 595 3187 2597 29 967 3799 3187 88 595 3799 903 92 967 4063 1383 6 595 4063 3342 79 268 4102 4758 41 595 4102 538 24 983 4152 4063 42 595 4152 4943 44 543 246 787 61 229 246 890 65 56 246 105 91 685 787 4802 58 229 787 1768 36 229 787 3448 21 708 787 4336 5 610 1768 3270 72 229 1768 4574 75 371 1768 2262 50 20 1791 3940 58 229 1791 454 12 821 1791 4757 7 891 2228 3471 67 229 2228 3701 59 342 2228 4174 77 661 2327 4938 59 229 2327 449 25 381 2327 2620 58 775 2726 2327 97 229 2726 4333 68 345 2726 1496 88 203 3270 1791 22 229 3270 1048 66 15 3270 4979 76 859 3471 2726 38 229 3471 22 65 757 3940 2228 37 229 3940 1375 2 568 3940 4938 48 712 247 1693 57 761 247 3380 75 857 572 1961 27 761 572 4465 82 591 600 4953 14 761 600 1579 70 85 600 2345 2 664 1510 572 59 761 1510 4960 58 761 1510 582 51 594 1693 4096 24 761 1693 77 80 364 1693 3189 59 678 1961 4369 44 761 1961 2554 15 250 1961 966 11 485 1995 600 81 761 1995 1855 16 555 4096 4371 99 761 4096 1349 33 528 4369 1995 50 761 4369 4193 75 15 4369 1503 89 467 4371 1510 1 761 4371 260 11 275 248 3495 8 520 248 2414 85 388 631 915 29 520 631 3825 15 996 631 581 57 893 915 1848 82 520 915 1432 35 413 915 1939 54 969 1131 2986 9 520 1131 2642 31 246 1825 1936 51 520 1825 3859 49 493 1848 1131 83 520 1848 4183 12 646 1936 4671 83 520 1936 4734 75 520 1936 4903 58 636 2986 3379 20 520 2986 3404 4 514 3379 1825 21 520 3379 2725 5 372 3495 631 65 520 3495 4059 46 287 3495 2822 50 82 249 1179 60 1198 249 3700 41 737 249 546 77 643 931 2863 6 1198 931 4928 57 71 1179 2194 22 1198 1179 4774 41 1198 1179 1580 38 23 1563 4763 32 1198 1563 3557 2 595 2194 4482 11 1198 2194 4564 42 483 2194 150 99 907 2430 1563 66 1198 2430 3450 54 107 2863 2430 95 1198 2863 3873 66 699 4482 931 80 1198 4482 1783 5 784 4482 4806 12 928 250 1462 3 463 250 3952 14 483 1462 2920 60 463 1462 1796 22 350 1462 292 45 159 1504 4440 73 463 1504 1263 43 579 1504 1893 26 504 1813 4538 45 463 1813 1504 12 463 1813 2903 25 804 2118 4788 73 463 2118 2368 23 210 2920 4194 16 463 2920 232 97 843 2920 4620 20 548 3129 1813 49 463 3129 1256 93 524 3129 3955 84 443 3239 3129 30 463 3239 609 23 657 3239 1753 39 769 3438 3239 80 463 3438 4804 45 959 4194 3438 68 463 4194 463 66 719 4194 284 55 478 4440 2118 19 463 4440 4239 79 63 4440 4474 47 149 251 1692 99 497 251 3642 86 285 540 2712 57 497 540 3744 97 474 689 4960 50 497 689 1375 23 363 773 689 26 497 773 2016 94 658 773 2304 74 212 1692 3774 66 497 1692 4795 10 497 1692 2371 82 529 1692 4970 30 217 2339 2593 25 497 2339 2396 15 968 2339 17 90 177 2593 3191 77 497 2593 2271 50 325 2593 3615 19 337 2712 2339 32 497 2712 1823 97 898 2764 773 74 497 2764 581 85 561 2971 540 75 497 2971 1510 54 535 2971 1054 73 322 3070 4657 28 497 3070 2764 26 497 3070 4066 6 957 3070 1915 57 42 3191 3070 31 497 3191 4096 29 237 3774 2971 12 497 3774 3399 44 625 252 988 3 529 252 1350 71 463 252 406 95 663 655 3738 26 529 655 2414 14 496 655 3589 21 462 988 2694 45 529 988 4634 13 52 1249 1603 64 529 1249 4532 78 366 1249 1714 30 349 1603 2019 99 529 1603 3494 5 659 2019 655 35 529 2019 1354 51 486 2694 1249 77 529 2694 4587 69 529 2694 26 61 681 2694 1751 52 441 3738 4690 72 529 3738 4684 99 122 3738 4449 66 160 253 1966 92 913 253 636 33 275 761 3025 68 913 761 2291 11 840 761 3077 73 449 1107 4302 36 913 1107 3975 32 617 1966 4316 57 913 1966 1381 3 876 1966 4255 43 44 3025 4476 3 913 3025 930 89 451 3025 3265 37 87 3591 4509 41 913 3591 1200 49 356 3936 3591 34 913 3936 64 7 370 4302 3936 67 913 4302 1432 69 901 4302 3987 28 642 4316 761 29 913 4316 4314 30 398 4476 1107 82 913 4476 4620 60 913 4476 2452 90 346 4476 4972 15 576 254 3083 62 543 254 1824 56 746 2132 2554 3 543 2132 3771 91 141 2132 1444 12 260 2487 2132 61 543 2487 3435 69 394 2487 1184 59 982 2554 2978 59 543 2554 2412 6 458 2978 4119 17 543 2978 1069 84 593 3083 2487 20 543 3083 4560 62 543 3083 1102 18 821 3246 4709 85 543 3246 3023 99 115 4119 4175 54 543 4119 1879 63 626 4119 4358 80 159 4175 3246 86 543 4175 183 77 40 4175 1021 6 615 255 4420 20 584 255 133 55 598 255 1365 82 50 878 3265 41 584 878 4899 56 897 1086 1464 15 584 1086 4518 69 319 1464 3752 56 584 1464 1404 52 156 3265 3853 54 584 3265 142 60 476 3265 1668 83 745 3752 878 71 584 3752 4515 8 584 3752 1200 45 36 3752 146 25 796 3853 4809 66 584 3853 2247 6 902 3853 430 6 168 4420 1086 99 584 4420 123 61 439 256 735 9 193 256 4601 44 807 667 1075 69 193 667 3097 69 598 735 4127 18 193 735 3254 15 260 818 4928 90 193 818 54 70 905 818 3718 91 49 1046 3615 70 193 1046 2515 19 995 1046 4769 53 562 1075 2969 37 193 1075 80 13 487 1075 2474 84 780 1733 4532 82 193 1733 818 77 193 1733 2435 31 111 1733 237 82 660 2689 1733 6 193 2689 332 100 44 2969 2689 13 193 2969 2169 53 260 3615 667 43 193 3615 4062 32 593 4127 1046 63 193 4127 2696 59 695 257 1078 91 614 257 1771 8 49 624 4606 92 614 624 4894 25 614 624 2384 28 135 624 4024 86 429 984 2876 82 614 984 3626 18 494 1078 3998 29 614 1078 1700 21 298 1144 984 82 614 1144 4826 90 614 1144 3394 49 832 1144 1250 19 45 1555 1851 15 614 1555 2712 58 685 1555 3117 43 52 1851 4193 85 614 1851 3639 28 780 1851 1469 10 86 2001 624 49 614 2001 2669 94 455 2001 1666 37 137 2823 2001 99 614 2823 4343 12 285 2876 1555 68 614 2876 2253 50 42 3097 1144 93 614 3097 4106 24 527 3998 3097 67 614 3998 2264 59 987 4193 2823 27 614 4193 875 31 147 258 2806 1 449 258 3451 70 110 749 4693 61 449 749 170 22 735 1314 3930 28 449 1314 3492 51 622 1338 2846 93 449 1338 1021 54 37 1338 311 50 698 2148 2938 86 449 2148 1924 72 211 2519 749 21 449 2519 4932 75 449 2519 3877 80 487 2519 3260 25 200 2806 1314 17 449 2806 209 78 442 2846 3535 9 449 2846 1194 77 364 2938 1338 86 449 2938 4949 94 978 3186 4149 52 449 3186 2698 95 580 3535 3186 75 449 3535 1498 47 674 3535 2102 78 41 3930 2148 89 449 3930 757 11 714 3930 4396 54 79 4149 2519 20 449 4149 4512 32 449 4149 3468 70 465 259 3124 22 1 259 2540 61 415 1077 1849 2 1 1077 709 21 480 1077 2337 33 43 1774 1077 85 1 1774 4718 42 255 1849 2816 89 1 1849 4822 78 58 1849 2953 79 223 2571 4593 100 1 2571 4944 23 1 2571 247 13 908 2571 3861 95 277 2816 3403 62 1 2816 2348 17 590 3124 4123 81 1 3124 313 47 419 3403 3878 1 1 3403 4162 92 635 3878 2571 93 1 3878 1809 35 494 3878 1816 69 706 4123 1774 98 1 4123 2126 7 251 260 4183 35 612 260 4784 64 218 260 2371 28 247 727 4916 49 612 727 3764 1 612 727 786 74 368 1478 4538 68 612 1478 4134 36 112 1478 4123 95 548 1557 727 49 612 1557 2208 38 137 3764 3855 89 612 3764 1382 22 451 3855 1478 44 612 3855 1992 10 23 4183 4479 8 612 4183 2116 82 567 4183 1494 97 615 4479 1557 67 612 4479 4161 5 998 261 2642 50 349 261 2663 11 763 530 4761 76 349 530 765 79 464 530 435 26 953 1087 2482 88 349 1087 1405 2 128 1185 530 74 349 1185 296 39 530 1723 1087 80 349 1723 1245 72 864 2213 1723 93 349 2213 4786 87 349 2213 3689 10 1000 2213 3766 94 321 2482 1185 70 349 2482 752 18 694 2642 2213 84 349 2642 632 72 210 2642 3593 69 958 262 1704 100 355 262 323 99 206 716 2242 62 355 716 1520 96 809 891 716 20 355 891 1311 42 163 996 4508 56 355 996 3836 17 654 1704 3697 12 355 1704 1133 47 542 1704 1776 38 305 2242 996 96 355 2242 3935 29 489 2242 59 92 647 3697 891 90 355 3697 4868 42 355 3697 2282 19 679 3697 1858 96 197 263 2844 49 511 263 1082 8 162 1560 1754 74 511 1560 3827 44 186 1560 3266 13 498 1735 2661 71 511 1735 3848 12 598 1754 4419 2 511 1754 4564 67 185 1754 3435 72 647 2191 1560 96 511 2191 1388 58 853 2318 4694 18 511 2318 3744 37 848 2661 4163 89 511 2661 1945 63 641 2844 2961 93 511 2844 2987 10 891 2936 2191 53 511 2936 2432 16 92 2961 1735 85 511 2961 2504 95 159 2961 528 4 612 4163 4668 13 511 4163 2936 13 511 4163 4676 19 338 4163 3896 95 605 4419 2318 55 511 4419 4681 57 185 4419 1112 83 232 264 1878 76 1586 264 1256 87 161 264 1483 80 875 793 1407 61 1586 793 2598 64 263 1290 3642 20 1586 1290 1995 44 697 1290 2662 67 691 1407 4654 83 1586 1407 3645 37 1586 1407 906 37 400 1784 3577 40 1586 1784 829 24 858 1784 958 10 235 1878 793 81 1586 1878 3798 7 375 1878 4843 70 981 3145 4307 45 1586 3145 234 9 587 3214 4790 47 1586 3214 1887 55 168 3214 4544 73 389 3217 4849 2 1586 3217 3145 82 1586 3217 1214 21 628 3577 3217 99 1586 3577 4306 6 683 3642 3214 25 1586 3642 2833 82 116 3645 1784 41 1586 3645 4753 3 338 3645 4609 65 882 4307 1290 85 1586 4307 3244 88 977 265 1316 36 383 265 1788 95 887 815 3380 31 383 815 3446 76 463 815 3126 25 467 1060 3130 40 383 1060 4530 7 383 1060 3372 18 16 1316 4483 24 383 1316 3744 48 349 1461 3915 52 383 1461 1512 28 683 1461 2986 80 785 2474 1461 50 383 2474 2110 86 779 2474 1560 8 769 3130 815 74 383 3130 2717 10 304 3130 4319 45 272 3250 1060 35 383 3250 3377 18 465 3380 2474 84 383 3380 3680 16 704 3380 2304 87 812 3915 4847 90 383 3915 2688 77 791 4483 3250 59 383 4483 3692 94 995 266 619 97 192 266 4688 30 661 266 721 88 832 545 3952 21 192 545 1016 11 733 545 3775 19 335 619 3858 31 192 619 19 92 313 641 3775 13 192 641 3947 33 640 641 3571 25 196 682 641 76 192 682 4735 53 192 682 2994 34 176 682 4822 27 743 1466 545 19 192 1466 1039 11 505 3775 4018 36 192 3775 1162 49 977 3775 3955 16 547 3858 682 26 192 3858 3952 74 106 3858 2446 1 179 3952 4602 30 192 3952 3897 12 683 3952 2477 79 340 4018 1466 27 192 4018 2062 46 231 267 2537 73 92 267 2596 56 656 267 995 80 335 671 3541 29 92 671 1002 21 145 671 3792 67 271 707 3548 30 92 707 3516 74 96 2067 3690 5 92 2067 1516 43 95 2067 1421 46 587 2307 4804 20 92 2307 2699 69 314 2537 4330 25 92 2537 380 37 625 3541 2067 76 92 3541 2008 38 392 3548 2307 91 92 3548 1521 95 124 3690 707 11 92 3690 1371 91 874 4330 671 49 92 4330 4993 87 92 4330 18 57 105 4330 3518 23 750 268 2072 21 842 268 3731 35 216 646 4266 34 842 646 1774 99 816 646 2274 99 220 669 4357 91 842 669 1253 5 633 669 4999 72 364 1167 1371 75 842 1167 1584 82 632 1371 669 94 842 1371 1847 41 905 2072 4564 22 842 2072 4317 46 842 2072 2889 41 18 2072 3822 90 241 4030 4826 62 842 4030 2682 93 578 4266 4030 99 842 4266 285 74 182 4266 732 86 335 4317 1167 14 842 4317 3279 70 497 4357 646 32 842 4357 1454 28 286 4357 3239 71 700 269 4134 58 601 269 395 69 300 269 1841 98 555 1173 2243 23 601 1173 4186 45 221 1173 3505 33 375 1657 3576 15 601 1657 2815 80 39 1666 2925 7 601 1666 616 19 890 2243 4453 52 601 2243 3018 92 967 2243 4568 73 946 2925 4771 12 601 2925 4831 92 160 3249 1173 21 601 3249 2724 86 330 3249 3990 82 449 3576 4996 98 601 3576 4229 90 601 3576 3883 23 774 4134 1657 52 601 4134 3816 44 164 4134 4252 21 75 4229 3249 37 601 4229 1951 73 221 4229 2987 100 953 4453 1666 65 601 4453 4690 22 447 270 1661 83 39 270 1388 93 762 511 4748 15 39 511 1970 100 133 511 4921 34 800 717 2575 92 39 717 3205 3 24 1661 4499 55 39 1661 1889 58 432 2052 511 22 39 2052 4838 74 39 2052 4603 6 239 2052 2116 75 841 2575 2052 93 39 2575 4287 33 684 2609 3216 15 39 2609 2314 89 952 2609 1874 65 23 2820 2609 85 39 2820 2553 11 351 3156 2820 100 39 3156 2083 59 563 3156 1384 47 527 3216 717 87 39 3216 41 70 962 3686 3156 38 39 3686 2431 75 856 4499 3686 96 39 4499 3037 7 960 271 3506 40 276 271 592 88 628 670 2425 99 276 670 171 92 362 670 3738 63 984 914 2299 47 276 914 885 2 50 1706 1947 81 276 1706 1710 54 867 1947 2606 89 276 1947 3419 62 227 1947 3746 63 600 2299 1706 50 276 2299 417 76 890 2425 914 27 276 2425 2974 10 793 2425 4166 48 993 2606 3663 99 276 2606 4743 85 276 2606 4239 38 435 3506 670 56 276 3506 3888 24 914 3506 3747 90 120 3663 4898 19 276 3663 1417 31 839 3663 4095 83 79 272 1467 17 363 272 3815 90 140 715 4113 65 363 715 3382 30 978 1467 1943 75 363 1467 3217 46 820 1467 325 14 910 1830 715 9 363 1830 1366 94 388 1943 1830 59 363 1943 3362 67 497 1943 4006 14 657 2893 4372 62 363 2893 641 51 523 4113 4421 76 363 4113 1072 100 556 4113 4457 21 864 4372 4833 27 363 4372 4718 66 363 4372 843 53 742 4372 3161 60 564 4421 2893 45 363 4421 4721 71 695 273 2634 6 371 273 25 16 547 514 2354 98 371 514 4981 57 803 1460 4803 14 371 1460 1476 8 371 1460 2452 77 21 1460 3766 8 902 1476 514 34 371 1476 3936 94 871 2354 3647 33 371 2354 650 15 649 2634 4015 12 371 2634 1643 95 926 3647 4740 24 371 3647 2340 43 155 4015 1460 3 371 4015 406 75 383 4015 1438 22 362 274 4397 86 53 274 401 96 28 274 3190 20 62 1043 4667 42 53 1043 3026 94 53 1043 3080 78 312 1517 3367 26 53 1517 4209 13 469 1845 3695 69 53 1845 1814 88 369 2761 3683 51 53 2761 4437 83 957 2761 2240 83 25 2934 1845 27 53 2934 4659 33 654 2996 1517 37 53 2996 134 19 287 3026 2934 90 53 3026 1757 2 150 3367 2761 1 53 3367 3308 60 650 3683 4974 14 53 3683 2285 40 932 3683 2165 49 76 3695 2996 3 53 3695 1411 64 402 4397 1043 25 53 4397 1426 11 384 275 3676 9 486 275 484 89 844 275 710 16 357 809 1753 98 486 809 2762 81 236 809 2029 60 335 1062 2566 100 486 1062 3092 100 384 1062 542 97 234 1089 2747 85 486 1089 2321 47 730 1533 3984 45 486 1533 4774 34 538 1753 1757 84 486 1753 3312 50 325 1753 2802 58 824 1757 4548 58 486 1757 4922 25 486 1757 1459 70 630 1757 2124 49 142 1923 1062 28 486 1923 4008 50 684 2566 1089 22 486 2566 2391 49 455 2566 3540 69 938 2747 3127 96 486 2747 1894 25 482 3127 809 51 486 3127 947 43 817 3676 4951 41 486 3676 1533 39 486 3676 2354 25 80 3984 1923 12 486 3984 4794 14 979 3984 2573 21 755 276 993 32 348 276 4462 4 844 276 2644 58 738 993 3358 64 348 993 4715 91 348 993 1460 89 650 993 780 12 726 1261 4147 32 348 1261 2399 18 804 1920 4710 58 348 1920 2118 63 346 3358 1261 41 348 3358 998 19 597 3358 176 80 812 4147 4467 63 348 4147 216 53 938 4467 1920 82 348 4467 1807 85 213 277 4300 31 407 277 1245 51 180 277 3369 82 665 555 3679 75 407 555 977 99 918 555 1190 94 643 1008 4835 82 407 1008 3579 57 407 1008 391 49 376 1558 1008 56 407 1558 3784 54 101 1558 837 34 59 1589 2912 17 407 1589 4505 30 407 1589 2636 7 825 2091 1589 33 407 2091 2921 98 717 2091 4397 76 428 2508 2091 73 407 2508 1568 90 225 2508 1330 10 519 2589 1558 20 407 2589 1010 15 289 2589 1746 31 196 2610 4677 1 407 2610 4553 97 768 2912 2589 54 407 2912 3610 38 361 3579 2610 63 407 3579 2131 90 419 3579 4826 71 345 3679 2508 79 407 3679 984 30 590 4300 555 57 407 4300 1485 61 524 278 4278 77 647 278 1401 73 713 653 1534 75 647 653 350 85 251 653 4765 30 724 1337 1793 32 647 1337 4129 11 1000 1337 2035 49 789 1534 4589 90 647 1534 377 51 83 1534 1798 96 160 1709 4086 32 647 1709 4528 83 647 1709 2496 98 656 1709 2431 31 337 1793 4190 22 647 1793 2343 84 506 3337 1337 39 647 3337 4645 78 74 3337 3263 28 811 4086 3337 25 647 4086 3774 11 363 4086 3148 51 510 4190 653 79 647 4190 823 41 326 4190 3186 14 541 4278 1709 15 647 4278 2290 16 609 4278 2734 20 15 279 674 18 417 279 990 60 282 656 2579 62 417 656 4550 79 613 674 2637 83 417 674 4393 32 984 890 1367 10 417 890 4694 13 116 890 180 90 581 1367 4816 94 417 1367 1819 44 643 2579 4471 7 417 2579 1749 81 578 2637 656 2 417 2637 1634 97 6 3318 4958 38 417 3318 890 28 417 3318 4676 52 509 3318 348 93 572 4471 3318 25 417 4471 859 90 258 280 1745 55 1070 280 665 100 143 1511 4351 76 1070 1511 4406 100 416 1713 3188 55 1070 1713 2292 59 503 1745 2681 32 1070 1745 4765 57 134 2096 3205 92 1070 2096 3670 64 405 2096 1232 87 591 2178 1713 16 1070 2178 3477 98 738 2681 2178 40 1070 2681 2772 92 97 2681 1215 2 631 3188 1511 57 1070 3188 4025 57 438 3205 4504 15 1070 3205 4045 82 301 3205 918 12 850 4351 2096 43 1070 4351 4731 10 1070 4351 879 33 704 281 3422 36 32 281 3113 7 995 1128 2638 73 32 1128 2796 57 795 1128 2739 33 441 2297 1128 1 32 2297 1272 9 373 2297 4313 73 677 2638 2998 24 32 2638 4672 97 32 2638 3345 2 741 2998 4826 86 32 2998 4992 28 459 2998 778 54 273 3422 2297 34 32 3422 4316 64 828 282 811 40 887 282 358 42 739 282 4225 91 164 811 2802 87 887 811 4961 10 887 811 1999 39 523 1673 4512 83 887 1673 3797 37 897 1673 3243 31 184 2353 4131 37 887 2353 344 40 477 2802 3656 34 887 2802 1451 77 733 3656 4321 72 887 3656 4241 78 620 3656 1839 72 668 4131 1673 4 887 4131 264 44 371 4131 4514 38 889 4321 2353 62 887 4321 1474 90 181 283 1257 39 387 283 291 79 733 759 3117 36 387 759 2103 8 191 1117 759 34 387 1117 250 98 899 1257 2486 10 387 1257 4978 53 519 1257 2889 36 507 1484 2811 95 387 1484 4598 24 387 1484 536 28 717 1484 2395 50 218 2027 2120 33 387 2027 1754 49 626 2027 4210 39 815 2120 4004 45 387 2120 4693 64 387 2120 4392 14 719 2120 4282 67 50 2486 1484 92 387 2486 2950 44 490 2811 1117 62 387 2811 1695 51 836 2811 4554 100 539 3117 2027 23 387 3117 3690 64 331 3117 4616 69 638 3813 4909 28 387 3813 2823 18 620 3813 400 7 102 4004 4376 98 387 4004 4894 39 53 4004 202 62 436 4376 3813 44 387 4376 1321 7 719 4376 722 49 502 284 3279 66 339 284 1049 76 96 284 4340 21 904 1683 4413 82 339 1683 358 70 940 2404 4657 93 339 2404 4119 84 245 2404 2343 15 55 2710 2404 70 339 2710 1734 99 531 3279 4251 59 339 3279 3648 2 78 3279 4216 71 485 3493 2710 44 339 3493 3180 86 475 3493 231 48 85 3665 4530 91 339 3665 1683 13 339 3665 4543 1 33 4251 3665 98 339 4251 4918 6 77 4251 1117 75 865 4413 3493 24 339 4413 30 90 955 285 1147 54 882 285 3609 59 774 701 1145 15 882 701 723 8 570 701 1408 22 426 1145 1519 43 882 1145 4057 100 194 1145 548 87 825 1147 701 57 882 1147 481 97 740 1147 2138 55 975 1519 2452 79 882 1519 3952 72 904 2174 3251 99 882 2174 4629 8 882 2174 3033 14 435 2174 3371 27 484 2298 2174 93 882 2298 2277 8 287 2452 2792 61 882 2452 44 74 263 2792 3242 11 882 2792 4986 68 73 3242 2298 69 882 3242 575 61 70 3242 1143 95 169 3251 4684 79 882 3251 769 52 530 286 4303 31 400 286 1041 82 678 286 4841 81 931 1201 1389 26 400 1201 4991 38 739 1375 1201 36 400 1375 693 92 427 1375 2942 83 867 1389 2495 41 400 1389 4698 10 244 1389 2191 4 1000 1548 3487 14 400 1548 4643 19 622 1548 1751 53 133 1875 1548 22 400 1875 4619 2 400 1875 3637 36 808 1875 4168 49 298 2140 1375 63 400 2140 4815 73 899 2495 4856 24 400 2495 584 96 559 3376 1875 76 400 3376 4783 7 604 3376 4847 17 308 3487 2140 77 400 3487 4985 27 799 4249 3376 53 400 4249 193 74 471 4249 757 23 752 4303 4249 25 400 4303 246 32 999 4303 615 83 346 287 4029 78 410 287 3554 14 440 287 2555 91 435 556 848 96 410 556 346 16 358 848 2885 2 410 848 2419 54 950 848 4282 58 342 2447 3435 26 410 2447 1635 73 361 2885 4288 95 410 2885 4731 99 410 2885 3122 52 778 2955 3455 58 410 2955 635 61 866 3435 2955 18 410 3435 1436 23 301 3435 2607 66 435 3455 556 12 410 3455 1407 81 560 4029 2447 39 410 4029 1998 21 430 4029 1302 55 378 4288 4770 38 410 4288 4746 82 508 4288 4401 12 994 288 3125 12 534 288 459 76 866 672 4922 15 534 672 1277 81 793 672 4763 89 982 987 2665 86 534 987 1711 10 101 987 342 98 367 1450 2044 87 534 1450 3110 16 875 1450 1876 48 266 1604 672 97 534 1604 2756 53 181 1604 2836 29 823 1839 4891 36 534 1839 1450 5 534 1839 1511 35 437 1839 4487 66 769 1910 3877 9 534 1910 2454 18 6 1910 581 76 856 2044 1910 67 534 2044 1291 69 229 2044 3589 77 988 2356 3370 39 534 2356 4509 37 534 2356 2916 9 577 2356 4430 53 825 2665 2356 63 534 2665 4856 97 884 3125 987 27 534 3125 1727 39 525 3370 1839 68 534 3370 4911 51 323 3877 1604 16 534 3877 4057 99 534 289 3962 17 932 289 813 60 307 289 2110 6 64 963 4375 56 932 963 727 78 746 963 851 48 212 1051 1592 66 932 1051 4800 84 932 1051 1815 60 826 1501 1741 61 932 1501 755 33 1 1592 4766 10 932 1592 4930 26 288 1592 2554 54 313 1741 963 86 932 1741 1637 41 427 2357 1051 99 932 2357 1858 92 147 2357 3210 51 650 3962 1501 36 932 3962 2318 96 368 4375 2357 92 932 4375 2755 98 537 290 3479 55 367 290 3686 85 78 290 789 95 939 2169 2947 2 367 2169 3409 56 37 2169 3126 10 706 2484 3804 49 367 2484 2673 47 847 2484 1874 42 6 2947 3189 13 367 2947 1148 17 93 2947 4748 8 824 3189 4068 8 367 3189 2915 37 553 3418 4947 24 367 3418 662 42 19 3418 4749 71 440 3479 2484 19 367 3479 4560 66 464 3804 2169 73 367 3804 873 91 72 4068 3418 79 367 4068 4932 83 367 4068 3704 39 422 291 4254 25 747 291 2018 97 145 291 3167 28 629 586 4089 28 747 586 2680 80 816 1569 4961 74 747 1569 4627 3 747 1569 3489 57 724 1569 1398 48 640 2180 586 31 747 2180 4085 84 437 4089 4356 65 747 4089 885 36 740 4254 4491 16 747 4254 3763 61 320 4356 1569 71 747 4356 2586 16 481 4356 3751 39 405 4491 2180 88 747 4491 4221 25 381 4491 1200 27 660 292 3820 76 470 292 64 70 101 292 2612 63 413 537 2085 90 470 537 278 8 749 981 4512 49 470 981 752 77 247 1972 2989 34 470 1972 3900 58 331 1972 4315 3 940 2085 1972 71 470 2085 3232 1 12 2085 202 34 668 2989 981 53 470 2989 4135 61 682 3757 537 16 470 3757 4292 67 853 3757 1098 27 551 3820 3757 58 470 3820 4766 11 470 3820 1722 31 810 293 954 95 202 293 491 83 717 293 2886 91 944 954 997 68 202 954 623 45 134 997 1838 29 202 997 4801 51 93 997 4336 49 925 1013 4789 18 202 1013 3096 2 149 1838 2510 86 202 1838 1039 48 570 2510 4345 6 202 2510 1717 59 320 2510 3246 83 36 4345 1013 8 202 4345 4625 19 202 4345 3274 39 589 4345 69 99 36 294 882 91 680 294 3735 25 561 882 1092 67 680 882 1028 35 544 882 3148 70 142 1044 2720 31 680 1044 432 65 667 1092 4151 26 680 1092 1333 76 145 2720 4846 31 680 2720 3200 20 283 2720 715 13 172 2897 3111 43 680 2897 4506 11 680 2897 1800 80 842 2897 683 63 238 3111 1044 79 680 3111 4679 53 633 3111 1748 9 667 4151 2897 72 680 4151 4794 97 683 4151 1461 68 564 295 4275 9 354 295 4475 29 326 295 4538 33 9 548 2772 85 354 548 2749 9 298 652 4490 5 354 652 3291 96 615 652 3333 98 44 1384 4680 67 354 1384 2504 74 143 1653 2717 18 354 1653 2709 32 139 1653 1969 99 295 1879 652 77 354 1879 2538 13 523 2012 1653 42 354 2012 1954 51 799 2012 70 53 686 2717 1384 100 354 2717 3774 76 676 2772 4542 53 354 2772 4182 31 354 2772 494 34 691 4182 2012 32 354 4182 2517 9 86 4182 4318 69 124 4275 1879 58 354 4275 1207 48 124 4275 1335 36 527 4490 548 3 354 4490 1088 93 174 4490 624 53 600 296 3716 18 730 296 1419 75 781 296 3413 29 623 904 3322 2 730 904 3470 7 967 904 4370 29 230 1229 3518 96 730 1229 3507 48 785 1229 2254 61 593 1509 1815 37 730 1509 4130 41 233 1815 4513 65 730 1815 4748 33 730 1815 4417 73 509 1815 4465 68 761 3322 1229 58 730 3322 2661 12 888 3322 3001 25 653 3496 1509 4 730 3496 6 22 296 3496 943 59 981 3518 4047 43 730 3518 4393 61 719 3518 2245 41 223 3716 904 48 730 3716 1043 52 939 3716 890 30 54 4047 3496 61 730 4047 3144 11 832 297 643 94 451 297 446 100 861 297 2259 99 248 643 3011 2 451 643 1181 75 130 1266 3671 31 451 1266 1769 98 928 1843 1266 8 451 1843 3082 51 994 2381 3262 81 451 2381 4741 4 451 2381 266 34 650 2381 3030 40 664 3011 1843 94 451 3011 1445 49 177 3011 4317 68 567 3262 4669 59 451 3262 4403 36 448 3262 4027 17 748 3671 4185 22 451 3671 30 96 243 4185 2381 52 451 4185 739 85 602 298 3809 36 408 298 35 82 975 298 3738 67 242 1573 4705 12 408 1573 2865 43 408 1573 544 80 308 1945 2189 88 408 1945 3996 55 294 2189 4382 2 408 2189 1085 35 131 2865 3827 49 408 2865 3037 96 33 2865 4242 76 389 3572 4106 55 408 3572 1419 97 426 3572 3004 14 214 3809 1945 6 408 3809 4547 47 508 3809 526 38 447 3827 4518 43 408 3827 4034 2 992 3827 948 62 505 4106 1573 7 408 4106 2372 25 20 4382 3572 48 408 4382 803 91 651 4382 2601 99 880 299 757 33 559 299 4995 33 494 299 200 7 839 757 1520 64 559 757 3872 74 781 757 196 70 475 1307 4588 98 559 1307 301 46 410 1307 327 60 919 1520 2745 88 559 1520 2052 53 562 1520 4721 45 578 2371 4442 56 559 2371 1233 5 567 2371 3728 77 977 2745 3022 95 559 2745 4827 6 702 3022 2371 76 559 3022 4986 2 127 3022 3379 40 36 3529 3861 43 559 3529 4797 87 421 3529 2134 72 96 3551 1307 8 559 3551 3286 42 133 3551 1615 15 931 3861 3551 28 559 3861 2594 16 875 4442 3529 60 559 4442 4613 66 559 4442 3985 57 350 300 2049 20 1159 300 3666 8 114 2049 2240 53 1159 2049 1517 75 435 2240 2813 66 1159 2240 4833 6 1159 2240 2994 31 776 2267 3440 46 1159 2267 3048 64 720 2313 3955 32 1159 2313 3271 20 340 2813 2267 97 1159 2813 4977 43 440 2813 3486 18 484 3440 2313 11 1159 3440 3193 21 243 3440 1393 66 28 3955 4427 84 1159 3955 2747 48 832 4427 4968 83 1159 4427 4157 1 881 4427 2341 67 491 301 812 85 153 301 2132 7 363 301 3919 15 486 812 3517 8 153 812 4266 2 888 1325 3993 96 153 1325 391 85 214 1393 4707 8 153 1393 3068 72 153 1393 743 61 766 1393 3361 78 758 1546 4890 57 153 1546 747 66 755 1546 3799 1 634 2081 1546 41 153 2081 4737 85 217 2081 2481 33 180 2974 2081 89 153 2974 1418 20 816 2974 2758 39 456 3068 2974 89 153 3068 1913 51 304 3068 1230 26 32 3517 1325 93 153 3517 4400 6 28 3993 1393 21 153 3993 2215 88 673 3993 1508 89 420 302 3854 58 260 302 3386 51 514 1714 2539 62 260 1714 3765 28 757 1714 4617 40 426 1897 4157 37 260 1897 3497 35 348 2079 1897 77 260 2079 1715 43 317 2079 2759 59 745 2444 3122 71 260 2444 799 49 653 2473 4979 93 260 2473 2444 8 260 2473 1897 43 734 2473 3072 92 741 2539 2079 87 260 2539 3572 50 76 2539 2673 10 208 3122 1714 23 260 3122 2407 88 538 3122 1287 36 790 3854 2473 94 260 3854 1713 59 614 4084 4429 11 260 4084 268 35 476 4157 4084 65 260 4157 371 67 672 4157 1360 7 112 4429 4781 80 260 4429 2761 59 576 4429 149 29 720 303 1918 48 689 303 4081 42 166 875 1113 57 689 875 1763 79 739 875 851 4 80 1113 1712 3 689 1113 1881 88 142 1712 4661 19 689 1712 3316 96 383 1712 4570 26 291 1918 3053 31 689 1918 3398 76 525 1918 2224 47 701 2086 2210 84 689 2086 1090 3 821 2210 3900 67 689 2210 2756 23 483 3053 2086 28 689 3053 535 27 268 3053 2036 38 319 3900 875 17 689 3900 4666 71 689 3900 2354 19 587 3900 4205 41 235 304 3259 69 914 304 3667 62 7 748 2945 52 914 748 4215 99 428 1854 4503 66 914 1854 3830 17 914 1854 1196 20 840 2004 3109 21 914 2004 4102 24 666 2004 707 43 508 2215 2449 42 914 2215 4391 8 61 2215 2673 6 585 2449 4623 42 914 2449 4376 4 845 2945 1854 1 914 2945 223 35 158 2945 3691 48 140 2946 2004 58 914 2946 1158 76 104 3109 2215 81 914 3109 180 47 601 3109 1092 99 866 3259 4381 9 914 3259 3186 93 305 3830 2946 50 914 3830 1838 11 623 3830 3092 56 794 4381 748 10 914 4381 4003 41 552 4381 1142 6 89 305 3604 41 83 305 3154 70 608 305 4420 49 335 977 2716 44 83 977 4317 37 332 977 1751 59 519 1301 2099 6 83 1301 2396 20 237 1301 1038 7 335 1579 977 83 83 1579 3126 76 828 1579 1725 39 615 1600 2595 68 83 1600 2892 6 626 1705 4949 22 83 1705 2695 57 992 2008 1579 77 83 2008 3396 18 381 2099 1600 86 83 2099 4583 73 83 2099 4550 7 360 2116 1705 100 83 2116 4515 68 113 2595 2008 87 83 2595 4942 98 83 2595 1661 81 209 2716 3382 10 83 2716 2135 51 24 2716 3199 88 376 3382 2116 46 83 3382 234 55 682 3382 1952 56 560 3604 1301 28 83 3604 4268 100 86 306 2514 96 256 306 3235 33 909 306 3932 57 807 758 1836 23 256 758 1663 18 563 1440 1863 11 256 1440 851 84 577 1613 1440 42 256 1613 3004 100 909 1836 1613 28 256 1836 1769 34 983 1863 4648 71 256 1863 4994 94 256 1863 3514 81 534 2431 758 96 256 2431 3247 53 486 2431 2667 37 759 2514 2431 25 256 2514 3104 95 216 307 2601 31 52 307 233 26 813 1377 4976 50 52 1377 2233 73 52 1377 99 81 813 1553 4434 15 52 1553 2430 64 214 1553 1069 4 931 1804 1377 44 52 1804 3311 35 109 2233 3520 56 52 2233 3810 90 575 2601 3282 39 52 2601 196 47 19 2601 172 63 728 3282 4489 64 52 3282 3781 44 149 3282 666 54 272 3520 1553 57 52 3520 2624 21 599 4434 4796 71 52 4434 3458 68 821 4489 1804 55 52 4489 302 19 99 308 3598 98 194 308 291 76 609 634 4989 6 194 634 2102 87 194 634 647 62 590 1136 4742 13 194 1136 3880 16 148 2102 1136 38 194 2102 676 66 202 2139 634 70 194 2139 3687 72 835 2139 1756 80 975 3598 3783 15 194 3598 4699 66 929 3598 4647 78 352 3783 2139 93 194 3783 854 82 177 309 4284 96 1290 309 1790 26 78 309 4580 83 456 508 4579 53 1290 508 3170 90 647 508 1557 23 595 1034 508 82 1290 1034 4697 45 217 1034 4837 42 666 1597 2552 78 1290 1597 4016 53 244 1597 3370 10 315 2552 1034 100 1290 2552 418 47 331 2552 2025 65 964 4263 1597 74 1290 4263 4654 54 1290 4263 2169 13 187 4263 3316 11 874 4284 4426 55 1290 4284 2774 57 544 4426 4263 24 1290 4426 1293 29 415 4426 1231 66 85 310 1274 58 473 310 3545 6 767 825 2466 32 473 825 4941 48 265 1274 825 33 473 1274 4763 28 473 1274 2298 44 401 1274 1681 41 524 1883 2879 51 473 1883 635 42 711 1883 1526 69 654 1998 1883 91 473 1998 749 45 538 1998 3760 68 216 2268 1998 55 473 2268 3547 20 277 2466 4025 94 473 2466 4362 72 981 2466 220 96 188 2879 4508 60 473 2879 3287 44 41 4025 2268 9 473 4025 4039 67 250 311 3938 42 717 311 4002 62 283 311 2995 10 540 662 4979 3 717 662 128 9 966 662 1194 15 390 862 3934 57 717 862 4886 60 717 862 4811 8 195 862 2920 44 931 1781 662 5 717 1781 22 74 477 2439 4156 91 717 2439 1332 37 601 3934 2439 62 717 3934 583 4 760 3938 4145 80 717 3938 3536 90 729 4145 862 72 717 4145 1672 33 660 4145 3177 16 650 4156 1781 53 717 4156 4023 21 970 312 2840 34 163 312 3786 53 525 1341 3779 90 163 1341 2288 53 930 1990 2421 13 163 1990 2998 81 514 1990 4607 31 832 2394 1341 87 163 2394 2059 84 6 2421 4087 76 163 2421 4408 62 999 2421 2322 72 504 2840 1990 78 163 2840 2343 98 312 2840 1542 84 861 3779 4742 17 163 3779 4969 64 163 3779 4486 28 659 4087 2394 26 163 4087 4510 80 803 313 2503 6 728 313 3690 20 189 313 1243 92 605 611 2821 59 728 611 3971 27 921 710 4428 55 728 710 3442 38 832 1542 611 70 728 1542 53 20 532 1542 2111 35 975 2279 3462 100 728 2279 1263 50 987 2503 710 33 728 2503 2985 76 116 2503 4920 11 559 2821 4584 71 728 2821 2279 70 728 2821 1743 3 717 2821 989 73 987 3462 4682 75 728 3462 2639 86 749 4428 1542 64 728 4428 4531 98 943 4428 524 83 352 314 3512 17 756 314 3235 31 964 573 3494 96 756 573 174 98 874 573 2010 69 162 916 2249 97 756 916 4741 84 756 916 3010 47 665 1186 916 27 756 1186 1633 22 113 1186 2455 42 901 2249 573 63 756 2249 850 27 984 2249 4565 5 158 3494 4691 73 756 3494 1579 36 602 3512 1186 57 756 3512 1151 59 700 315 2082 46 353 315 551 35 417 513 3567 2 353 513 2390 56 385 513 3148 92 913 1419 2815 65 353 1419 391 3 985 1419 3826 83 59 1536 3058 65 353 1536 2849 11 705 1720 3837 40 353 1720 1864 82 712 1720 3918 29 187 1967 4890 72 353 1967 1720 64 353 1967 2487 100 974 1967 283 18 549 2082 513 25 353 2082 4962 57 353 2082 1971 96 248 2815 4541 61 353 2815 1583 42 790 2815 1217 1 616 3058 3957 98 353 3058 3856 54 525 3058 1256 72 199 3567 4283 80 353 3567 1032 7 89 3567 265 90 24 3837 1536 32 353 3837 390 81 253 3957 1419 43 353 3957 4438 37 821 4109 1967 25 353 4109 1313 100 908 4109 1827 63 364 4283 4109 3 353 4283 2576 67 857 4283 3397 83 26 316 1009 10 294 316 4747 11 372 316 4770 1 521 894 4750 99 294 894 4937 76 294 894 3222 34 986 1009 2909 96 294 1009 950 7 966 1009 3138 43 370 1248 2170 62 294 1248 3302 86 374 2170 894 95 294 2170 912 58 45 2170 2088 8 285 2909 1248 99 294 2909 3557 66 346 2909 4505 73 677 317 2932 2 316 317 4149 14 922 317 1570 29 687 546 4690 65 316 546 3229 76 316 546 1214 76 552 546 3183 18 178 2932 3200 43 316 2932 1767 30 377 2932 2621 3 806 3200 3863 45 316 3200 762 43 90 3229 4040 76 316 3229 1000 77 708 3229 838 14 104 3746 4877 91 316 3746 4554 18 301 3863 546 25 316 3863 2356 54 743 3863 2706 40 849 4040 3746 22 316 4040 1090 100 499 4040 3554 25 519 318 557 8 213 318 38 24 281 318 592 18 956 523 4645 18 213 523 1358 30 199 523 3522 28 656 549 911 35 213 549 1511 12 188 549 392 49 754 557 3388 99 213 557 2800 52 857 557 451 78 514 911 523 39 213 911 3427 63 474 1528 549 48 213 1528 4888 81 213 1528 4545 87 389 1528 4236 35 158 1761 1528 20 213 1761 2539 28 290 1761 673 53 30 2596 1761 24 213 2596 2419 82 245 3388 2596 4 213 3388 1882 47 939 3388 2597 63 229 319 2630 31 698 319 3985 49 852 319 630 24 614 650 3004 73 698 650 2592 7 388 842 2935 26 698 842 1684 92 795 1917 650 87 698 1917 1665 32 331 2005 3741 26 698 2005 1032 58 107 2005 34 85 332 2630 3721 74 698 2630 4926 77 38 2630 2382 33 330 2697 1917 35 698 2697 4537 73 654 2697 3595 99 804 2935 4527 30 698 2935 2697 23 698 2935 3675 59 554 3004 4692 26 698 3004 3735 44 711 3721 2005 98 698 3721 1681 53 98 3721 760 77 855 3741 842 8 698 3741 2342 96 330 3741 1771 35 840 320 506 89 407 320 3938 40 274 506 1537 70 407 506 2372 54 112 1258 4686 78 407 1258 1994 78 713 1258 1362 78 584 1328 3884 82 407 1328 485 28 881 1328 1116 53 368 1537 2643 42 407 1537 2351 80 255 1846 1258 22 407 1846 2945 17 832 1846 4995 42 739 2643 1328 46 407 2643 3989 87 391 2643 664 51 64 3074 3926 47 407 3074 209 22 7 3884 3074 35 407 3884 1684 81 22 3884 1064 91 886 3926 1846 47 407 3926 4755 13 407 3926 2784 32 609 321 897 23 416 321 72 37 180 321 304 75 496 694 2238 44 416 694 3970 75 160 694 513 88 666 897 1697 67 416 897 1198 31 445 1697 2632 23 416 1697 4862 67 416 1697 3054 32 67 2238 2410 26 416 2238 176 60 112 2410 3447 56 416 2410 1269 29 484 2632 694 87 416 2632 196 38 787 2632 881 97 925 3447 4904 92 416 3447 3988 57 62 322 3114 82 385 322 2243 47 600 1074 1685 29 385 1074 2136 42 459 1234 2101 9 385 1234 598 65 4 1242 1074 21 385 1242 502 58 496 1242 4074 6 354 1685 1234 44 385 1685 4738 17 80 2101 4848 77 385 2101 4014 11 245 3114 1242 97 385 3114 4716 12 385 3114 1038 45 934 323 4448 86 532 323 1422 24 805 323 812 93 190 764 1497 35 532 764 4956 97 532 764 4485 68 695 1212 4065 27 532 1212 2622 72 528 1212 3103 46 731 1497 1212 4 532 1497 3735 64 672 2950 764 52 532 2950 1663 83 990 2950 3947 4 781 4065 4614 21 532 4065 1251 67 669 4065 2299 71 239 4448 2950 55 532 4448 1896 59 900 324 2211 67 277 324 2739 81 52 324 3090 88 930 1014 4798 43 277 1014 4599 80 662 1489 2341 86 277 1489 1749 24 774 1489 357 39 312 2211 4315 5 277 2211 4547 70 277 2211 3152 93 287 2317 2326 25 277 2317 1398 17 276 2317 4477 13 115 2326 1014 39 277 2326 4617 43 616 2341 2317 36 277 2341 1154 6 925 2341 3362 43 420 4315 4318 18 277 4315 4312 14 999 4318 1489 1 277 4318 2545 27 569 325 1852 76 593 325 67 36 110 325 3376 24 796 632 3748 67 593 632 1434 82 28 1852 3522 29 593 1852 1785 71 515 1852 623 16 315 2981 4571 87 593 2981 3299 2 446 3522 632 47 593 3522 2607 4 870 3522 733 40 61 3711 4924 13 593 3711 2981 29 593 3711 4334 18 784 3711 2665 62 549 3748 3711 72 593 3748 3847 52 508 326 3499 48 972 326 828 83 444 326 1565 45 633 544 3759 38 972 544 4414 86 819 544 44 2 559 1349 3910 33 972 1349 826 71 672 1349 571 78 533 2393 4140 5 972 2393 1290 10 898 3325 4533 89 972 3325 2393 70 972 3325 1415 62 623 3499 544 64 972 3499 3808 87 162 3759 1349 10 972 3759 4467 16 669 3910 3325 2 972 3910 1411 2 276 3910 3142 36 368 3967 4914 84 972 3967 1466 72 853 4140 3967 53 972 4140 1531 9 374 4140 4187 76 557 327 3624 7 694 327 3428 100 248 327 4988 82 432 1225 3051 10 694 1225 1833 56 103 1225 4619 22 513 2382 4914 21 694 2382 4638 19 919 2382 153 60 938 2405 1225 61 694 2405 3607 29 619 3051 2382 27 694 3051 3850 14 767 3624 4941 20 694 3624 4115 38 694 3624 3527 78 6 4115 2405 65 694 4115 3431 36 331 4115 4640 92 745 328 3059 99 289 328 1350 64 434 328 1797 81 732 732 4137 99 289 732 3099 22 537 899 1187 54 289 899 1694 42 95 1187 1721 66 289 1187 4875 65 289 1187 154 31 200 1721 732 61 289 1721 1890 75 344 2942 899 46 289 2942 2631 80 929 2942 3459 51 51 3059 3206 64 289 3059 108 6 2 3059 3323 16 604 3206 2942 7 289 3206 2439 76 226 3206 587 49 295 4137 4928 10 289 4137 541 6 759 329 577 27 1387 329 4573 56 216 329 3796 76 154 577 3179 84 1387 577 574 71 178 577 2552 81 963 872 4722 79 1387 872 4538 22 211 872 1711 70 293 1318 2767 48 1387 1318 98 9 291 1318 4562 75 778 2376 4031 8 1387 2376 4387 79 476 2376 2672 57 470 2480 1318 77 1387 2480 2223 85 804 2480 33 10 309 2767 872 99 1387 2767 1933 19 786 3179 2376 9 1387 3179 3356 96 679 3179 4931 96 359 4031 2480 3 1387 4031 4709 99 1387 4031 3192 96 340 4031 4681 77 176 330 2458 54 296 330 52 76 175 561 4097 44 296 561 4512 10 291 1538 3446 61 296 1538 3224 7 623 1686 1771 96 296 1686 1524 85 245 1771 3015 42 296 1771 4939 33 282 1771 4602 25 106 2458 1686 86 296 2458 2586 97 749 3015 3983 55 296 3015 2116 42 99 3035 4708 90 296 3035 4551 60 296 3035 2226 43 558 3035 2693 9 380 3446 3035 73 296 3446 662 5 142 3446 2923 2 548 3983 4438 54 296 3983 957 59 935 4097 1538 46 296 4097 2983 16 902 4438 561 71 296 4438 168 22 513 331 2050 2 922 331 526 86 618 782 1566 52 922 782 4934 50 922 782 2977 79 913 1007 1921 84 922 1007 3597 54 2 1007 1882 22 503 1566 3903 13 922 1566 3891 37 393 1566 281 49 282 1921 3944 99 922 1921 4210 94 754 2050 3174 99 922 2050 1556 40 920 3174 1007 15 922 3174 1858 23 496 3903 4528 55 922 3903 808 41 810 3944 782 11 922 3944 1455 88 223 332 3334 32 184 332 2538 76 459 593 4523 85 184 593 2521 58 751 593 3038 19 994 1319 4579 64 184 1319 2719 17 184 1319 2068 66 55 2719 593 81 184 2719 3621 32 477 3334 4346 40 184 3334 3013 34 696 4346 1319 54 184 4346 3885 28 530 333 3356 73 535 333 1613 95 612 333 3147 1 57 636 4258 78 535 636 87 67 240 636 3801 11 838 2983 3573 93 535 2983 4335 16 967 3021 3082 55 535 3021 141 32 314 3021 3181 1 798 3082 636 45 535 3082 99 16 8 3082 1421 99 147 3356 3021 100 535 3356 4977 32 535 3356 2051 97 161 3356 4564 18 209 3573 4787 22 535 3573 4243 67 86 3573 4711 27 236 4073 2983 87 535 4073 2807 62 936 4177 4073 2 535 4177 4478 27 628 4177 1560 55 760 4258 4177 41 535 4258 4224 47 709 334 4245 65 1428 334 1409 17 172 334 3886 20 787 1254 3413 28 1428 1254 4214 42 766 1254 1510 81 578 2173 2905 36 1428 2173 4683 38 1428 2173 3880 15 700 2173 1950 52 553 2723 2173 16 1428 2723 4186 91 519 2723 2895 94 389 2905 1254 86 1428 2905 1232 41 78 3413 4665 84 1428 3413 2056 25 383 4245 2723 59 1428 4245 4979 18 713 4245 980 64 116 335 1894 66 384 335 994 1 620 335 1036 10 46 1042 4625 44 384 1042 43 72 509 1042 2674 94 140 1224 4132 1 384 1224 3426 94 704 1317 2628 95 384 1317 4730 54 384 1317 2514 69 585 1638 1317 31 384 1638 3243 18 241 1894 1224 7 384 1894 1256 19 95 2628 3150 27 384 2628 1951 74 359 2628 4899 78 53 3150 1042 46 384 3150 2027 74 613 4132 1638 42 384 4132 1642 58 242 4132 1842 43 687 336 1780 12 271 336 1340 2 373 336 2455 72 205 588 1486 97 271 588 467 7 689 588 871 42 439 1486 3181 28 271 1486 2066 64 521 1486 2055 87 831 1780 2109 3 271 1780 2933 75 787 1780 4038 33 17 2109 2528 59 271 2109 4483 58 727 2109 4251 71 842 2528 588 86 271 2528 3536 27 734 2528 1360 91 71 3181 4584 33 271 3181 4877 4 271 3181 4349 76 23 337 4218 39 74 337 2481 16 863 2093 3478 34 74 2093 1390 38 774 2392 4313 64 74 2392 4705 77 74 2392 4295 64 603 3375 2093 26 74 3375 4381 36 119 3478 4403 36 74 3478 2687 15 772 3478 1908 35 156 4218 3375 49 74 4218 55 91 325 4313 4924 34 74 4313 57 21 306 4403 2392 58 74 4403 1117 66 944 338 2835 73 427 338 3938 40 145 597 3750 67 427 597 4775 31 295 780 2457 23 427 780 1126 1 394 2457 597 94 427 2457 4727 40 427 2457 1625 95 648 2803 4003 77 427 2803 906 32 725 2835 2803 77 427 2835 4202 50 173 3486 780 53 427 3486 2971 86 923 3486 2496 36 560 3602 4414 59 427 3602 4477 66 540 3602 1126 77 425 3750 3602 54 427 3750 2191 18 606 4003 3486 56 427 4003 2871 75 511 4003 797 36 817 4414 4760 7 427 4414 1343 27 181 4414 4943 71 452 339 1913 81 400 339 4296 70 640 339 2699 80 355 1912 4683 58 400 1912 4204 51 877 1913 2114 62 400 1913 3685 50 500 2114 3450 95 400 2114 505 46 796 2114 943 68 322 2347 4576 94 400 2347 3587 30 400 2347 1270 6 366 2347 134 53 42 3450 2347 79 400 3450 3400 52 860 3587 3894 51 400 3587 1259 96 916 3894 1912 87 400 3894 887 53 554 340 1127 85 584 340 3969 66 139 775 2270 94 584 775 223 49 86 775 50 29 59 1127 1626 96 584 1127 2995 95 549 1127 4541 14 919 1207 3255 70 584 1207 4321 75 984 1207 2065 88 110 1431 2248 39 584 1431 3103 38 552 1431 4573 45 739 1626 1431 94 584 1626 4080 17 320 1626 3420 2 511 1861 2015 7 584 1861 3150 98 355 2015 775 2 584 2015 4682 45 584 2015 737 91 604 2248 1207 45 584 2248 510 28 672 2248 2943 91 29 2270 4776 29 584 2270 2419 85 292 2270 4192 78 467 3255 1861 41 584 3255 2991 6 382 3255 3947 75 467 341 1514 65 411 341 4750 1 753 341 2443 46 500 1514 3237 93 411 1514 4714 73 925 1550 3904 73 411 1550 4991 72 411 1550 4587 79 710 1550 721 59 75 3002 4290 60 411 3002 4409 45 305 3002 3867 2 280 3237 3002 51 411 3237 1915 80 501 3237 2422 67 882 3904 4810 49 411 3904 4510 37 378 4290 1550 91 411 4290 4818 83 666 342 1436 72 656 342 1545 87 221 342 3166 53 130 697 3338 2 656 697 4442 12 978 697 4362 3 13 1436 1855 90 656 1436 3191 76 715 1855 697 28 656 1855 4616 75 656 1855 1040 51 165 1855 1810 96 554 2056 3256 36 656 2056 152 91 769 3256 4765 82 656 3256 4453 6 654 3338 2056 97 656 3338 4626 84 939 343 2623 19 453 343 4213 58 971 343 623 24 867 1164 4052 71 453 1164 1678 61 143 1164 4802 68 194 1809 1164 88 453 1809 1242 88 568 1809 3193 90 453 1929 1809 52 453 1929 4534 97 864 1929 4495 39 543 2623 1929 35 453 2623 4574 65 453 2623 4652 75 525 2623 4789 55 144 3655 4277 20 453 3655 813 79 914 3655 2676 41 446 4052 4201 63 453 4052 1747 5 345 4052 2436 10 992 4201 3655 100 453 4201 2178 22 326 4201 3974 49 987 4277 4614 97 453 4277 1703 82 731 4277 1775 91 733 344 1909 59 327 344 154 60 81 886 4956 56 327 886 4887 88 327 886 4579 2 740 1454 2014 80 327 1454 4180 90 145 1800 1454 15 327 1800 2170 16 400 1800 1536 41 214 1909 4466 87 327 1909 2110 51 634 2014 3950 46 327 2014 3710 95 794 3516 886 81 327 3516 396 55 647 3516 442 13 179 3829 3516 94 327 3829 26 11 392 3829 657 2 243 3950 3829 18 327 3950 2647 33 444 3950 4433 54 640 4466 1800 28 327 4466 4859 85 999 4466 1114 45 111 345 1267 97 729 345 4640 100 944 925 4794 73 729 925 873 76 332 1267 2106 24 729 1267 3276 64 342 1267 29 55 837 1365 2558 16 729 1365 825 30 766 1541 925 29 729 1541 4789 73 729 1541 2175 8 2 1541 1142 85 78 2106 3254 67 729 2106 1665 21 629 2106 2048 5 810 2558 1541 79 729 2558 3766 17 736 2558 4867 67 154 3254 1365 54 729 3254 3099 69 909 346 4326 36 265 346 3471 100 922 1066 4999 8 265 1066 4918 88 683 1942 2724 6 265 1942 926 91 884 2438 3504 97 265 2438 2630 70 265 2438 2604 62 268 2724 2438 35 265 2724 2647 35 315 2856 3859 54 265 2856 4898 29 265 2856 2881 13 422 2856 4721 43 83 3504 2856 22 265 3504 784 12 803 3504 1962 30 348 3859 1066 24 265 3859 2158 45 905 3859 4927 16 661 4326 1942 70 265 4326 4244 8 808 4326 2038 24 858 347 691 54 663 347 2933 24 303 347 4336 81 314 691 1672 34 663 691 1848 68 187 691 154 74 302 760 1562 21 663 760 2586 89 554 1434 3363 49 663 1434 1776 53 712 1434 4747 69 868 1562 4700 56 663 1562 4952 18 663 1562 3625 44 893 1562 4263 48 386 1672 3617 17 663 1672 2691 93 480 1672 1448 45 264 1732 1434 47 663 1732 594 55 835 3363 3537 94 663 3363 551 38 342 3363 183 57 976 3537 760 7 663 3537 12 30 98 3537 1729 80 390 3617 1732 98 663 3617 1764 8 227 348 687 78 968 348 219 95 898 348 712 37 10 687 3709 83 968 687 1827 14 892 687 2231 48 110 959 3235 49 968 959 3231 77 511 959 1684 68 673 962 3429 23 968 962 2368 85 75 1119 1415 37 968 1119 2891 57 38 1119 1208 40 716 1143 959 2 968 1143 3383 98 980 1143 1405 16 163 1415 3995 43 968 1415 4995 97 968 1415 4472 97 184 2042 1119 97 968 2042 4793 21 968 2042 1545 33 33 2042 625 95 873 3235 962 100 968 3235 4404 31 524 3429 4557 29 968 3429 2178 50 534 3429 557 42 69 3709 3822 35 968 3709 3257 49 412 3822 2042 19 968 3822 1842 4 577 3822 3432 62 394 3995 1143 71 968 3995 4684 67 131 3995 1438 98 282 349 3192 93 246 349 36 41 516 2221 2887 39 246 2221 4735 76 89 2221 407 89 118 2703 4626 91 246 2703 4098 32 976 2703 50 2 153 2887 3685 58 246 2887 1954 53 46 2887 528 20 419 3142 2221 57 246 3142 4629 29 246 3142 3790 57 33 3142 3968 11 510 3192 3142 54 246 3192 3793 94 589 3685 2703 7 246 3685 3728 44 477 350 1737 62 250 350 2076 56 883 350 966 24 26 1035 2557 26 250 1035 4554 25 250 1035 1108 2 883 1737 1964 85 250 1737 779 91 833 1737 1841 41 308 1964 3543 62 250 1964 1374 60 311 1964 3415 2 629 2247 2676 42 250 2247 1325 8 144 2247 3232 5 720 2541 3673 78 250 2541 4151 6 181 2557 4963 82 250 2557 4267 36 543 2676 3101 10 250 2676 15 2 160 2676 518 33 386 3101 1035 10 250 3101 512 39 329 3273 2247 78 250 3273 493 5 180 3543 2541 98 250 3543 2081 57 405 3673 3273 29 250 3673 4491 49 643 3673 944 93 15 351 582 76 144 351 4378 70 566 351 4262 3 876 582 2435 31 144 582 1907 81 199 635 1356 87 144 635 3247 60 524 635 1975 61 361 651 3173 25 144 651 3837 63 86 651 4015 99 879 1356 3480 41 144 1356 486 33 72 1356 4674 61 759 2435 651 2 144 2435 369 7 48 2435 3642 15 419 2698 635 45 144 2698 4788 70 144 2698 2327 90 531 2698 101 22 433 3173 2698 30 144 3173 3110 12 267 3173 4298 32 556 3480 4805 10 144 3480 367 31 984 352 2223 94 189 352 2006 27 841 709 4600 33 189 709 2171 47 803 1976 4088 38 189 1976 1574 86 507 1976 1270 92 74 2223 4199 14 189 2223 981 85 768 2223 1609 95 391 2289 4840 27 189 2289 709 35 189 2289 1902 25 711 2289 2273 30 483 4088 2289 65 189 4088 1374 99 919 4088 4691 99 632 4199 1976 92 189 4199 3882 59 591 4199 4969 72 520 353 835 27 713 353 3652 25 882 835 4362 48 713 835 4127 96 355 898 1343 79 713 898 4542 56 685 898 4661 27 236 1343 4401 2 713 1343 2007 2 236 4362 898 6 713 4362 4069 94 174 4401 4601 22 713 4401 4637 11 713 4401 2825 34 995 354 1646 96 317 354 789 37 471 354 2060 48 577 792 1526 67 317 792 3412 31 164 792 1117 84 929 850 792 95 317 850 1153 39 210 1526 4513 9 317 1526 1330 75 146 1526 495 47 591 1646 2600 58 317 1646 255 68 1000 1646 2947 86 399 2600 2866 74 317 2600 1630 27 244 2600 2420 54 978 2866 3898 90 317 2866 4397 13 19 2866 4966 88 133 3898 850 17 317 3898 4570 10 317 3898 3033 50 386 3898 2722 58 893 355 1306 24 439 355 2183 51 909 355 4811 95 813 531 2874 21 439 531 979 65 661 1306 3557 63 439 1306 4318 58 576 1306 535 93 487 1355 2618 92 439 1355 4272 20 479 1355 3155 93 774 2618 4416 57 439 2618 4807 98 439 2618 3151 51 650 2874 1355 75 439 2874 4171 99 810 2874 2002 99 899 3557 531 97 439 3557 4761 66 227 3557 4109 4 285 4416 4542 6 439 4416 3569 64 599 4416 4118 22 94 356 936 9 404 356 1174 64 848 356 358 99 503 936 1850 20 404 936 4609 55 512 936 234 88 914 1390 3713 96 404 1390 3664 4 208 1390 1957 75 354 1850 3042 33 404 1850 1174 77 851 3042 1390 53 404 3042 4214 82 250 3042 590 14 843 3713 3800 73 404 3713 4824 66 404 3713 213 25 740 3800 4848 83 404 3800 2918 42 283 3800 3456 69 761 357 1655 97 937 357 1902 1 81 357 93 86 451 737 836 7 937 737 3022 23 188 836 1630 63 937 836 2642 78 179 836 147 79 291 1281 3754 11 937 1281 4867 27 51 1281 638 79 456 1339 4517 58 937 1339 3140 80 960 1339 1232 19 876 1630 4061 80 937 1630 4978 56 992 1655 1281 69 937 1655 4634 96 937 1655 431 3 729 1802 737 99 937 1802 2842 1 440 3754 1802 51 937 3754 3111 28 89 3754 1084 68 261 4061 1339 25 937 4061 3273 98 639 4061 2800 100 856 358 1417 35 218 358 3667 46 531 358 4882 28 242 1417 4210 84 218 1417 4629 84 218 1417 2373 83 493 3394 3979 55 218 3394 445 87 258 3394 858 100 218 3632 3866 89 218 3632 3505 57 936 3632 3229 79 246 3866 4053 8 218 3866 733 44 916 3866 202 85 209 3979 4597 21 218 3979 903 56 765 3979 98 56 284 4053 3394 17 218 4053 3418 71 632 4053 4065 45 682 4210 4241 15 218 4210 1320 80 792 4210 1040 99 623 4241 3632 70 218 4241 2023 61 280 4241 1910 22 629 359 2797 95 803 359 4335 44 982 359 3080 39 943 1748 4951 4 803 1748 1484 70 437 2041 4494 80 803 2041 4194 12 856 2797 3969 16 803 2797 1085 77 51 2797 1411 60 464 3483 4898 86 803 3483 1748 85 803 3483 163 26 741 3483 3024 49 923 3969 2041 25 803 3969 4263 52 616 4494 3483 14 803 4494 4326 5 348 4494 784 43 767 360 2658 72 333 360 1900 68 122 1103 1594 46 333 1103 3560 52 338 1594 4700 10 333 1594 3387 75 671 1594 4390 98 607 2266 4913 23 333 2266 1103 47 333 2266 761 65 210 2266 3704 58 45 2658 3336 72 333 2658 2459 87 762 3183 2266 76 333 3183 1421 44 18 3183 4819 68 190 3336 3183 26 333 3336 1437 37 351 3336 1855 19 841 361 1231 38 215 361 1161 5 403 361 914 77 715 534 3790 59 215 534 1441 80 982 534 2904 14 450 1231 2212 65 215 1231 4795 67 215 1231 3495 71 907 1231 2986 28 637 1523 534 23 215 1523 2883 25 477 1523 2072 55 582 1605 1523 18 215 1605 2349 27 668 1605 4272 63 150 2212 3571 34 215 2212 673 64 334 3571 1605 40 215 3571 3523 98 947 3790 4855 37 215 3790 4355 14 168 362 4209 13 217 362 2727 71 289 362 4696 41 759 1096 3340 48 217 1096 217 71 959 1096 1382 41 618 1531 4815 58 217 1531 2506 70 298 1531 1856 83 878 1758 1096 79 217 1758 1076 68 36 3340 4221 86 217 3340 2707 45 557 3340 2677 37 947 4209 1758 95 217 4209 2264 43 139 4209 4419 50 357 4221 1531 84 217 4221 4783 49 217 4221 2417 37 5 363 1448 51 757 363 4112 33 623 363 3321 45 463 538 3929 43 757 538 2771 89 878 538 1054 8 50 705 3295 26 757 705 4065 22 176 1448 2408 73 757 1448 214 84 92 1448 2588 24 76 2028 2422 50 757 2028 4978 13 76 2408 3459 2 757 2408 1788 68 923 2408 523 83 865 2422 4882 59 757 2422 2458 47 193 2864 538 3 757 2864 2557 12 713 3295 2864 96 757 3295 1448 22 113 3295 2742 59 596 3459 705 72 757 3459 4961 73 757 3459 859 52 961 3459 4099 91 703 3929 2028 73 757 3929 911 72 806 3929 2667 13 410 364 644 39 437 364 2131 9 511 571 965 64 437 571 3548 38 123 571 1116 46 876 644 1150 100 437 644 1649 9 968 644 4205 6 131 700 4548 14 437 700 1122 68 527 965 4535 95 437 965 1070 5 437 965 4662 37 437 965 2299 44 309 1070 3395 49 437 1070 908 76 863 1070 3670 2 892 1150 1882 21 437 1150 1053 90 551 1150 2291 26 811 1423 3104 39 437 1423 4854 94 54 1423 3225 51 338 1882 1423 96 437 1882 2076 54 585 2854 571 2 437 2854 4848 70 400 2854 362 47 84 2991 4028 84 437 2991 978 13 244 3104 2854 58 437 3104 2588 91 113 3104 2082 38 520 3353 700 26 437 3353 312 92 730 3395 2991 92 437 3395 3342 67 329 4028 3353 22 437 4028 4421 61 147 365 3103 98 888 365 3950 98 890 365 1103 7 508 1481 1495 46 888 1481 1367 76 915 1495 3444 86 888 1495 4025 68 953 3103 3390 82 888 3103 2339 49 21 3390 4324 37 888 3390 4454 45 298 3390 4584 80 487 3444 4886 53 888 3444 432 1 30 3444 3725 6 55 3869 1481 95 888 3869 4965 49 888 3869 1677 10 874 4324 3869 29 888 4324 3583 41 943 4324 4265 47 90 366 2997 75 318 366 1927 56 281 686 1651 51 318 686 4713 47 135 1556 4746 63 318 1556 3180 51 318 1556 299 17 457 1556 2877 30 828 1651 4920 8 318 1651 4019 17 187 1651 4865 61 946 2481 1556 22 318 2481 2225 71 410 2481 4087 1 85 2997 2481 65 318 2997 4506 16 328 3120 4171 55 318 3120 4564 37 383 3120 590 30 97 3180 3871 91 318 3180 2875 55 984 3871 3120 7 318 3871 2367 18 907 3871 2532 80 645 4171 686 75 318 4171 3886 55 866 4171 1118 64 281 367 1826 39 104 367 3744 23 483 776 3773 87 104 776 2619 65 685 776 4924 42 643 1172 2251 28 104 1172 2428 87 980 1172 1267 31 982 1387 776 39 104 1387 1421 34 848 1387 1968 77 464 1826 2018 9 104 1826 2752 57 197 2018 1172 78 104 2018 4940 6 947 2251 3014 80 104 2251 3482 35 265 2269 2456 96 104 2269 1544 47 328 2456 2953 29 104 2456 4721 61 104 2456 2198 24 488 2953 4861 80 104 2953 4838 29 104 2953 1373 26 677 2953 4629 85 330 3014 1387 86 104 3014 1078 76 245 3126 2269 58 104 3126 327 61 788 3126 815 58 920 3773 3126 30 104 3773 4657 2 370 3773 3786 62 996 368 1406 9 358 368 3565 66 772 368 4802 42 875 1406 1586 18 358 1406 3908 49 466 1406 1413 98 463 1586 2565 64 358 1586 482 19 240 1586 498 70 99 1985 4729 68 358 1985 445 46 580 2338 4837 3 358 2338 2582 33 358 2338 3834 73 440 2565 2338 74 358 2565 133 96 590 2582 3396 58 358 2582 2325 82 705 2582 4556 25 722 3396 1985 88 358 3396 4969 82 184 3396 1466 45 768 369 3470 22 451 369 198 40 175 594 4064 99 451 594 1830 10 335 1120 2377 14 451 1120 4833 51 632 1151 2496 83 451 1151 2864 67 385 1151 1037 72 764 1158 1151 29 451 1158 2829 95 653 1158 2619 55 133 1649 2718 73 451 1649 4672 88 451 1649 2267 59 944 2256 1158 62 451 2256 89 27 837 2256 3364 42 853 2377 1649 100 451 2377 3979 36 516 2377 268 78 111 2496 594 66 451 2496 2470 97 879 2496 2086 35 749 2718 2256 38 451 2718 2506 84 740 3222 4797 6 451 3222 1123 10 78 3222 2853 94 233 3470 4940 30 451 3470 1120 77 451 3470 1551 14 70 3470 512 86 703 4064 3222 93 451 4064 3363 66 404 370 840 14 451 370 852 52 705 840 3163 14 451 840 4131 79 369 991 4558 6 451 991 4982 57 451 991 2052 35 416 1783 991 46 451 1783 2864 17 212 2722 1783 81 451 2722 2794 38 154 2722 4072 5 625 3163 3793 95 451 3163 2466 70 314 3793 4379 32 451 3793 1937 84 88 4379 2722 30 451 4379 3459 63 842 371 3457 93 135 371 4349 35 867 371 1497 82 755 1058 2043 76 135 1058 4446 24 720 1058 2513 3 694 1230 1058 69 135 1230 3774 59 24 1230 912 17 496 1420 1465 21 135 1420 4132 41 844 1465 4436 95 135 1465 1444 38 142 2043 2302 23 135 2043 2736 5 348 2043 2263 5 484 2302 4581 41 135 2302 3351 28 403 3457 1420 48 135 3457 4144 3 724 3457 960 47 692 4436 1230 97 135 4436 4851 93 135 4436 42 41 474 4436 3792 15 605 372 3680 2 753 372 1770 68 642 372 580 22 486 778 2154 85 753 778 4587 54 904 2154 2675 92 753 2154 4600 7 906 2675 4380 75 753 2675 4977 29 512 2730 4981 32 753 2730 1120 1 739 3680 778 73 753 3680 4694 7 753 3680 2199 26 813 3972 2730 63 753 3972 3167 15 550 4380 3972 92 753 4380 711 39 934 4380 3980 93 803 373 3691 62 273 373 2713 16 458 373 1781 78 658 1050 4981 75 273 1050 2416 71 273 1050 4132 23 485 1050 503 93 862 1382 4911 30 273 1382 3533 6 312 1382 4485 13 774 1652 3787 90 273 1652 496 31 189 1652 2648 55 470 2013 3595 74 273 2013 4801 32 102 2416 1382 42 273 2416 1183 29 878 2416 333 95 329 3595 4125 76 273 3595 2259 54 631 3595 2764 80 775 3691 4014 61 273 3691 3660 41 346 3787 4349 88 273 3787 603 68 732 3787 4347 94 164 4014 2013 43 273 4014 4877 24 207 4125 1652 35 273 4125 4778 10 426 4349 1050 4 273 4349 394 16 55 374 1782 16 22 374 1534 99 734 374 2856 24 967 532 676 38 22 532 2702 78 957 676 4071 73 22 676 284 40 321 1782 3227 22 22 1782 1049 97 538 1904 4741 47 22 1904 532 63 22 1904 4079 43 604 2137 1904 9 22 2137 3482 36 212 2774 2137 17 22 2774 1186 50 72 2774 84 64 521 3227 3392 8 22 3227 3503 20 685 3227 242 48 593 3392 3708 84 22 3392 4490 28 831 3392 1008 95 344 3708 2774 21 22 3708 4830 39 813 3708 1607 65 468 4071 4987 97 22 4071 232 68 986 4071 842 78 510 375 510 90 284 375 3764 16 245 375 1704 61 616 510 3077 75 284 510 3005 44 606 510 1190 19 953 602 4077 52 284 602 3994 70 719 602 2434 59 451 927 4054 24 284 927 1722 38 849 927 3202 93 730 2060 2507 26 284 2060 4268 75 493 2060 754 37 324 2183 602 68 284 2183 1477 56 656 2183 851 76 298 2507 4733 92 284 2507 4529 30 284 2507 3338 27 946 2507 1004 55 184 3077 4310 98 284 3077 4731 6 175 4054 2060 63 284 4054 3894 90 271 4054 645 18 363 4077 927 53 284 4077 935 71 670 4077 2811 54 694 4310 2183 15 284 4310 3321 98 390 4310 619 45 829 376 2150 71 15 376 4556 24 657 376 4303 100 416 798 1004 73 15 798 640 30 195 824 1340 24 15 824 2399 81 663 1004 2913 62 15 1004 3267 2 303 1004 4201 17 122 1243 824 52 15 1243 255 4 9 1340 798 86 15 1340 760 97 401 1922 2572 86 15 1922 4962 22 15 1922 418 71 247 2150 1243 71 15 2150 3295 11 370 2572 4710 40 15 2572 2710 29 283 2572 863 100 923 2913 1922 38 15 2913 4582 74 833 2913 1635 100 245 377 4320 74 1020 377 4370 81 803 796 4169 9 1020 796 1283 7 797 796 3285 51 552 1065 3385 73 1020 1065 4467 80 927 1443 4983 11 1020 1443 3640 69 22 3385 796 71 1020 3385 3081 59 350 3385 272 25 451 4169 1443 5 1020 4169 2497 52 155 4169 3519 1 717 4320 1065 73 1020 4320 4544 33 1020 4320 574 70 242 4320 1573 41 81 378 1901 43 326 378 379 73 844 378 1798 5 597 924 1724 40 326 924 1445 99 159 924 2550 54 979 1724 3348 57 326 1724 3203 86 263 1724 1593 86 523 1901 3935 47 326 1901 3508 62 703 2010 2460 39 326 2010 4835 59 326 2010 4282 43 272 2460 3354 48 326 2460 3093 37 657 3348 4250 83 326 3348 819 43 875 3348 1573 67 99 3354 924 1 326 3354 1690 37 919 3354 4629 87 918 3935 2010 74 326 3935 3751 87 903 4250 4803 28 326 4250 2248 93 708 379 569 46 436 379 4819 47 463 379 807 67 459 569 2332 10 436 569 1716 54 219 1518 2886 52 436 1518 1011 60 125 1518 3261 1 54 1684 4236 88 436 1684 4964 36 70 2332 4373 9 436 2332 4675 37 436 2332 2709 39 668 2886 3704 17 436 2886 4248 20 305 2886 2146 50 360 3601 1518 33 436 3601 164 49 256 3601 4700 4 706 3704 4653 58 436 3704 2995 94 952 3704 4374 26 368 3714 3601 57 436 3714 2889 50 25 4236 3714 48 436 4236 2590 84 349 4373 1684 7 436 4373 32 57 435 4373 1333 76 814 380 2563 41 360 380 2761 12 159 677 3196 6 360 677 1448 14 906 1192 4120 26 360 1192 730 97 390 1577 677 83 360 1577 29 50 517 1577 4902 50 183 2563 1577 28 360 2563 3743 51 205 2563 3182 19 824 3196 1192 100 360 3196 4693 20 360 3196 4500 75 649 3196 389 86 557 4120 4564 33 360 4120 3762 83 638 4120 3526 20 516 381 4325 82 389 381 3303 1 726 2100 3923 15 389 2100 3153 77 210 2100 959 75 718 3073 2100 61 389 3073 4771 85 389 3073 1952 25 908 3536 4167 12 389 3536 1210 43 689 3603 3073 52 389 3603 330 46 128 3923 4609 83 389 3923 4181 92 5 4167 3603 72 389 4167 1300 80 989 4325 3536 76 389 4325 873 64 22 382 2344 42 949 382 1912 9 996 382 994 88 659 889 4544 2 949 889 4643 94 949 889 3987 39 907 909 2590 34 949 909 4455 23 760 1658 909 13 949 1658 1123 99 702 1658 3303 31 39 1680 1719 12 949 1680 562 55 605 1680 1692 54 181 1719 1778 89 949 1719 2586 39 629 1778 889 4 949 1778 632 6 406 2344 1658 21 949 2344 357 43 557 2344 719 13 451 2590 1680 62 949 2590 326 60 366 2590 3482 55 792 383 2979 74 311 383 625 71 780 383 968 98 679 1005 3137 40 311 1005 903 35 406 1255 4582 62 311 1255 1421 57 450 2352 3939 44 311 2352 2844 98 153 2483 4631 84 311 2483 2352 88 311 2483 584 27 242 2979 3032 79 311 2979 5000 1 649 2979 3402 49 609 3032 3215 10 311 3032 1105 78 387 3032 2354 99 989 3137 1255 19 311 3137 2328 96 917 3137 1037 92 964 3215 2483 39 311 3215 2723 38 435 3939 1005 17 311 3939 3280 45 30 3939 2025 72 89 384 3431 21 990 384 3698 23 489 384 4140 46 248 1278 3832 62 990 1278 1690 82 782 1422 4323 19 990 1422 295 78 266 1422 4784 4 556 3138 4830 52 990 3138 4968 30 990 3138 1076 34 499 3138 603 55 984 3147 3546 98 990 3147 3929 43 441 3147 4561 82 17 3431 3147 57 990 3431 2469 32 430 3431 2935 37 28 3546 3728 91 990 3546 2669 76 143 3728 1278 87 990 3728 4164 1 29 3832 1422 84 990 3832 2405 90 950 3832 1764 97 491 4323 3138 87 990 4323 2087 78 981 385 1279 41 75 385 869 38 962 1279 4333 93 75 1279 1742 10 258 2779 3290 6 75 2779 2393 77 90 2779 4930 98 427 3290 3917 52 75 3290 3154 71 582 3461 4497 96 75 3461 1103 23 462 3461 2757 57 487 3917 4451 26 75 3917 3797 88 584 3917 4912 47 69 4333 2779 14 75 4333 1628 17 850 4451 3461 54 75 4451 4780 71 75 4451 2610 67 223 4451 4718 84 469 4497 4610 5 75 4497 712 26 972 4497 3213 64 901 386 649 73 563 386 734 9 58 649 1711 35 563 649 561 46 39 1003 1492 73 563 1003 2423 68 824 1152 2578 12 563 1152 4780 98 563 1152 3704 71 976 1152 2249 74 261 1492 2526 38 563 1492 207 67 573 1492 3608 33 46 1711 1971 84 563 1711 796 72 404 1971 2959 59 563 1971 1230 17 351 2526 1152 5 563 2526 4873 74 629 2578 4556 46 563 2578 373 80 83 2578 75 66 408 2959 3178 40 563 2959 2915 65 878 3164 1003 100 563 3164 4282 17 857 3178 3164 82 563 3178 2449 88 546 387 2850 33 481 387 264 48 31 711 4510 57 481 711 2174 31 822 711 2141 39 462 1554 711 5 481 1554 898 22 394 1554 2711 91 31 1583 3879 41 481 1583 2385 90 453 2850 4615 62 481 2850 4130 11 481 2850 1588 29 330 2850 2201 45 290 3879 1554 22 481 3879 1228 28 766 3879 1463 82 360 4130 1583 7 481 4130 3235 43 976 388 4056 25 546 388 3304 61 512 807 1688 22 546 807 188 25 897 1235 4443 78 546 1235 731 8 779 1235 1875 3 666 1688 4789 51 546 1688 2391 63 839 1914 1235 63 546 1914 3907 84 31 2039 807 100 546 2039 4454 98 784 2521 1914 40 546 2521 2488 72 389 2521 3175 98 627 4056 4207 12 546 4056 1926 40 323 4207 2521 47 546 4207 3001 62 547 4225 2039 34 546 4225 4527 18 546 4225 3417 25 515 4443 4225 9 546 4443 4150 45 429 4443 3293 33 330 389 885 19 455 389 4326 84 914 885 1357 37 455 885 3657 57 493 1203 4992 57 455 1203 2417 75 220 1203 515 65 655 1357 4603 99 455 1357 4460 93 455 1357 892 53 724 1357 244 74 12 2158 3509 43 455 2158 532 88 947 2158 799 17 194 2853 3882 6 455 2853 3672 29 167 2853 2665 24 989 3509 4067 50 455 3509 1470 46 71 3509 1468 44 44 3882 4292 27 455 3882 3375 47 67 4067 1203 68 455 4067 2910 50 908 4292 2158 75 455 4292 4013 93 74 4460 4462 91 455 4460 2996 9 752 4462 2853 64 455 4462 3824 84 711 4462 1708 39 859 390 4105 59 356 390 2400 22 402 390 3138 5 780 816 2740 100 356 816 2979 4 525 1048 1677 67 356 1048 1261 81 335 1048 2265 17 831 1549 1048 26 356 1549 3993 73 12 1677 2380 84 356 1677 1085 97 58 1677 4156 32 908 2380 3441 74 356 2380 4315 63 193 2740 3730 25 356 2740 4961 60 742 2740 1262 27 726 3441 816 64 356 3441 4713 64 567 3730 4700 89 356 3730 2756 39 585 4105 1549 96 356 4105 4907 100 356 4105 1240 1 591 391 1376 38 496 391 69 38 533 964 4285 78 496 964 2500 5 526 964 2752 41 553 1376 4755 28 496 1376 2729 67 496 1376 535 58 183 1376 988 93 871 1916 2640 76 496 1916 1559 54 588 1916 3804 79 918 2151 4937 59 496 2151 4931 28 872 2500 1916 33 496 2500 2561 18 296 2500 3110 93 896 2640 964 64 496 2640 430 53 556 2640 226 31 800 2729 2500 38 496 2729 4623 55 400 4285 2151 48 496 4285 4598 87 881 4285 802 82 730 392 4268 57 525 392 480 35 16 623 797 23 525 623 1721 67 47 623 375 24 951 797 4261 71 525 797 4128 37 983 1020 4725 1 525 1020 2813 88 893 1020 2555 92 242 1052 623 5 525 1052 2768 94 752 1052 5 16 606 2727 3364 16 525 2727 4855 51 525 2727 4697 10 85 2727 828 35 261 3364 3857 91 525 3364 1071 63 18 3364 2853 73 612 3857 1020 47 525 3857 3695 56 200 4228 1052 100 525 4228 653 70 1 4261 2727 20 525 4261 4466 45 864 4268 4228 38 525 4268 2592 22 337 393 2504 30 682 393 4283 32 652 1280 4864 1 682 1280 2165 85 682 1280 308 10 506 1280 4202 48 230 1289 1280 95 682 1289 4837 75 249 1289 4142 37 796 1452 3439 64 682 1452 3231 91 471 1452 1521 36 617 2165 4191 91 682 2165 31 57 483 2386 3343 29 682 2386 1260 17 808 2504 2386 97 682 2504 1206 50 176 3343 1289 57 682 3343 4919 34 32 3343 4552 61 135 3439 4843 61 682 3439 2604 39 393 3439 3499 23 887 4191 1452 19 682 4191 1979 16 173 394 2331 14 215 394 2618 5 946 394 619 31 819 527 4558 2 215 527 4908 52 215 527 2845 76 235 953 3151 27 215 953 1482 72 949 1220 953 74 215 1220 3665 12 241 1220 2389 8 60 2331 1220 3 215 2331 769 53 239 2331 986 16 404 2441 2616 30 215 2441 315 1 562 2616 3271 65 215 2616 4736 20 468 2616 1441 100 720 3151 2441 42 215 3151 3801 74 622 3151 1241 34 73 3271 527 72 215 3271 4457 8 577 3271 3227 63 681 395 2336 32 632 395 598 62 456 395 2358 15 857 832 1837 35 632 832 4076 38 912 832 3239 16 27 1300 1792 43 632 1300 1846 40 180 1580 3771 69 632 1580 926 36 996 1580 2806 47 458 1792 3849 6 632 1792 1267 65 245 1837 1300 3 632 1837 4352 85 362 1837 1414 14 423 2336 1580 63 632 2336 3085 35 901 3481 832 31 632 3481 189 91 209 3583 3481 94 632 3583 4634 69 771 3583 2969 52 943 3771 3583 98 632 3771 976 90 845 3849 4911 21 632 3849 4697 48 632 3849 1939 34 517 396 1360 75 339 396 1692 87 499 973 4760 33 339 973 379 89 566 1360 3874 16 339 1360 2341 100 405 1360 3201 63 992 1853 2193 38 339 1853 4771 93 550 1853 4865 76 133 2193 4159 94 339 2193 1126 57 32 2193 1054 27 55 2253 4281 91 339 2253 4729 77 155 3874 2253 43 339 3874 4901 58 339 3874 4846 92 790 3874 3486 34 108 4159 973 33 339 4159 4106 48 428 4159 3081 77 265 4281 1853 46 339 4281 1232 36 202 4281 4690 46 919 397 1323 66 91 397 3119 77 45 397 3057 73 161 1323 3798 46 91 1323 4112 60 897 1585 2910 86 91 1585 341 60 539 1585 1105 89 469 2553 3547 47 91 2553 3022 90 963 2829 3468 29 91 2829 4765 78 91 2829 2982 54 583 2910 2829 93 91 2910 1201 66 123 2910 1817 18 243 3468 2553 9 91 3468 1383 2 67 3547 4784 21 91 3547 4507 99 348 3547 449 89 489 3798 1585 25 91 3798 1916 51 739 398 755 55 326 398 3184 88 482 398 4595 78 249 528 3552 27 326 528 386 96 199 755 528 78 326 755 4644 33 326 755 2791 19 354 755 3028 68 348 1379 4007 37 326 1379 1363 99 488 3552 1379 92 326 3552 1088 84 140 4007 4816 12 326 4007 548 60 292 4007 128 82 698 399 2611 38 8 399 832 89 188 399 1731 54 191 1247 2058 41 8 1247 1245 31 602 1247 4282 100 368 1359 1751 46 8 1359 4509 18 8 1359 710 48 840 1751 3400 79 8 1751 348 41 83 1751 4477 54 578 2058 4987 26 8 2058 616 78 879 2058 4516 19 583 2611 1359 46 8 2611 2427 37 56 2611 2678 63 460 3400 1247 28 8 3400 1961 33 39 3400 3807 17 296 400 922 44 413 400 2971 29 483 753 3176 37 413 753 4849 87 341 753 1831 12 52 922 1769 53 413 922 3604 51 471 1769 4338 71 413 1769 4946 42 413 1769 4436 64 721 3176 3696 100 413 3176 1857 35 299 3176 4607 77 123 3324 4761 95 413 3324 1012 30 975 3696 3324 40 413 3696 2864 42 734 3696 1379 65 19 4338 753 47 413 4338 1301 51 174 401 1938 92 448 401 3173 94 849 401 4047 18 566 1869 4649 79 448 1869 1655 96 189 1869 189 32 542 1938 1963 5 448 1938 3299 51 577 1938 3018 37 568 1963 3920 62 448 1963 2496 81 61 2142 4976 11 448 2142 3563 15 448 2142 4255 25 668 2142 3871 77 802 3563 3715 24 448 3563 4554 60 976 3715 1869 56 448 3715 2918 100 950 3920 2142 51 448 3920 1467 86 546 402 3171 38 597 402 2192 84 882 402 3855 69 90 2125 2858 79 597 2125 3193 32 516 2858 4383 46 597 2858 918 40 444 2858 2765 42 495 3171 3868 27 597 3171 4145 78 521 3868 2125 47 597 3868 4675 90 597 3868 4806 32 930 3868 4054 76 777 4383 4956 53 597 4383 4792 41 223 403 2900 42 854 403 546 51 229 403 1431 11 459 750 4545 55 854 750 4841 52 854 750 1007 81 958 1271 4001 97 854 1271 944 99 773 1623 3916 15 854 1623 936 63 32 1623 1364 57 487 1949 1623 8 854 1949 2706 64 431 2627 1949 18 854 2627 3645 34 483 2900 1271 96 854 2900 1270 68 958 3916 750 97 854 3916 3650 93 102 4001 2627 90 854 4001 2494 17 683 404 1962 35 227 404 2090 4 729 404 3234 84 559 1264 4395 71 227 1264 782 68 411 1264 1237 46 120 1962 2451 12 227 1962 4824 59 262 1962 1837 32 323 2076 4480 78 227 2076 3800 1 10 2076 2684 40 464 2451 2562 86 227 2451 4880 84 451 2562 1264 75 227 2562 3105 48 654 2562 1968 43 223 3065 4630 23 227 3065 194 84 423 3065 2165 59 539 3204 2076 65 227 3204 4412 17 594 3204 2492 100 16 4395 3204 65 227 4395 2480 89 581 4480 3065 37 227 4480 4972 16 227 4480 3924 95 606 4480 4499 13 616 405 2987 5 337 405 201 21 391 867 2113 51 337 867 1483 99 141 867 4932 48 330 2113 2707 3 337 2113 4403 72 5 2707 4965 11 337 2707 3591 89 281 2707 2775 71 308 2926 3195 71 337 2926 4510 57 51 2926 521 60 908 2987 2926 13 337 2987 1956 14 528 2987 1534 9 865 3195 867 13 337 3195 4916 3 337 3195 3030 15 319 406 1023 94 326 406 1736 28 13 1023 3028 77 326 1023 4696 39 326 1023 1908 56 200 1023 1821 54 766 2335 3896 5 326 2335 2740 54 946 2335 1191 30 272 3028 2335 59 326 3028 1583 84 22 3028 4744 34 528 3896 4553 84 326 3896 119 83 532 407 668 100 402 407 768 52 659 407 4505 84 935 668 2263 78 402 668 1020 42 607 945 1895 38 402 945 4705 51 172 1895 3087 13 402 1895 2498 38 857 1895 3231 26 68 2263 945 66 402 2263 2304 51 790 3087 3720 72 402 3087 4919 85 402 3087 289 4 891 3087 282 98 840 3720 4834 50 402 3720 2864 58 827 3720 3010 68 351 408 821 40 212 408 393 17 204 408 1466 89 501 740 4584 18 212 740 1541 28 222 740 4921 73 516 821 3660 59 212 821 2543 48 191 821 2493 10 149 1099 2239 23 212 1099 2143 80 459 1099 4072 16 677 2239 740 27 212 2239 2483 94 737 3530 4737 11 212 3530 1099 72 212 3530 4145 67 392 3660 3530 97 212 3660 3123 30 29 409 2839 69 265 409 1422 24 255 409 1368 40 874 536 4797 73 265 536 2819 64 547 728 3158 27 265 728 1432 62 892 728 1485 51 69 979 536 60 265 979 1477 58 148 979 1297 30 199 1055 2704 23 265 1055 1941 90 791 1055 618 5 191 2704 728 93 265 2704 1205 24 396 2839 1055 77 265 2839 4725 78 265 2839 13 83 837 2839 4698 18 495 3158 979 53 265 3158 4392 54 237 3158 2442 7 437 410 3197 54 415 410 2092 88 868 533 4811 77 415 533 805 54 799 533 992 57 221 849 2308 22 415 849 1054 55 335 1313 1456 50 415 1313 4687 56 415 1313 3569 25 298 1313 2378 1 176 1368 1313 51 415 1368 3322 21 48 1456 533 35 415 1456 2696 37 690 1456 519 89 424 2308 3177 93 415 2308 4977 81 708 2308 771 41 36 3177 1368 38 415 3177 4992 9 922 3177 349 75 59 3197 849 34 415 3197 2540 26 390 411 2250 34 239 411 2855 23 732 411 16 52 909 1232 1924 17 239 1232 2643 23 867 1429 1232 38 239 1429 4253 27 297 1429 4628 85 808 1924 2200 17 239 1924 1451 51 688 2168 1429 81 239 2168 635 93 648 2168 2206 27 342 2200 4838 93 239 2200 1889 34 341 2200 1169 93 85 2250 4810 17 239 2250 2749 36 239 2250 4392 94 422 2749 2168 45 239 2749 4741 95 377 2749 4404 75 620 412 1292 60 659 412 1801 77 143 412 2673 98 976 575 2705 38 659 575 2685 52 685 575 4980 89 662 907 4437 55 659 907 3897 34 380 907 1941 66 342 933 1380 33 659 933 3075 70 725 1217 933 50 659 1217 740 14 859 1292 907 69 659 1292 2586 57 101 1364 1217 68 659 1364 2406 78 763 1380 4895 19 659 1380 1798 30 469 1380 2935 19 430 2705 1364 62 659 2705 110 96 55 2705 2533 2 68 4437 575 6 659 4437 4737 24 659 4437 4501 10 922 4437 1983 45 540 413 3347 82 603 413 206 62 508 876 4640 89 603 876 4537 17 603 876 2106 61 550 876 2609 36 69 1635 876 17 603 1635 2738 81 181 1635 2929 76 703 3287 1635 24 603 3287 1694 51 220 3347 3739 15 603 3347 2744 32 508 3386 3287 75 603 3386 1612 96 869 3739 3386 45 603 3739 1869 83 680 3739 1050 32 660 414 3321 78 827 414 412 79 737 723 2006 58 827 723 1890 74 876 723 50 63 217 2006 3941 59 827 2006 209 75 429 2006 533 46 311 2505 4187 91 827 2505 2601 2 671 2505 2275 4 436 2649 723 68 827 2649 2547 74 786 3321 2505 59 827 3321 4869 58 827 3321 2533 65 58 3321 226 14 325 3941 4902 35 827 3941 1221 33 387 3941 656 43 694 4187 2649 8 827 4187 3910 88 688 415 4447 15 28 415 4347 66 705 415 4077 80 532 1363 4690 75 28 1363 4855 36 98 2492 1363 49 28 2492 4589 58 800 3210 3650 11 28 3210 2217 55 88 3210 2897 26 85 3333 2492 3 28 3333 2840 63 882 3650 3333 77 28 3650 4522 73 580 4447 3210 82 28 4447 4697 45 28 4447 1168 48 716 416 1575 33 309 416 3415 100 458 416 4499 89 882 693 4344 59 309 693 3800 79 904 1059 693 4 309 1059 2902 29 988 1575 2788 30 309 1575 1870 76 683 1575 63 50 344 1700 4856 90 309 1700 389 26 11 2788 4295 46 309 2788 706 56 42 2788 1608 80 868 4295 4828 87 309 4295 1059 52 309 4295 1714 38 63 4344 1700 64 309 4344 1288 71 268 417 828 33 384 417 1264 10 421 417 527 55 390 828 4392 4 384 828 3839 14 563 828 1551 63 982 1664 1873 12 384 1664 4746 68 593 1664 2159 9 203 1873 3094 80 384 1873 4611 90 384 1873 509 58 358 1873 2880 39 371 2787 1664 76 384 2787 4427 86 77 2904 4048 99 384 2904 4076 10 666 2904 4995 1 898 3094 2904 25 384 3094 3446 75 725 3772 2787 18 384 3772 1142 69 504 3772 312 30 919 4048 4906 68 384 4048 3177 20 877 4392 3772 94 384 4392 1233 46 485 418 2087 20 115 418 1212 64 356 618 1304 22 115 618 2146 98 633 642 4757 49 115 642 331 6 262 1200 618 42 115 1200 1111 58 764 1211 1900 10 115 1211 3669 60 669 1304 1211 19 115 1304 1377 17 935 1304 1508 93 57 1900 642 60 115 1900 2940 40 259 2087 2968 30 115 2087 4182 75 242 2968 1200 55 115 2968 4719 7 115 2968 3512 58 894 2968 2553 67 636 419 4050 58 386 419 4171 18 29 1194 2516 6 386 1194 1033 20 649 1263 1194 38 386 1263 1564 31 844 1263 1745 82 444 1324 2975 26 386 1324 1628 28 228 1324 3326 75 692 2516 3119 23 386 2516 1529 12 523 2516 3231 3 908 2951 4994 92 386 2951 1263 29 386 2951 313 65 822 2975 2951 34 386 2975 4927 1 982 3119 4619 56 386 3119 2982 57 774 3119 2334 47 827 4050 1324 34 386 4050 3856 57 246 420 805 82 342 420 3945 48 664 805 3991 86 342 805 1198 93 391 805 1093 76 265 1056 2277 70 342 1056 611 24 677 1056 1179 1 503 1366 2011 8 342 1366 3687 81 491 1366 467 10 332 2011 4851 91 342 2011 1056 94 342 2011 1565 56 655 2277 3943 18 342 2277 565 12 314 3943 4753 80 342 3943 2199 53 546 3991 1366 76 342 3991 4172 89 667 3991 4264 28 954 421 1063 74 523 421 4589 73 933 606 1302 96 523 606 3904 98 789 1063 2746 57 523 1063 522 94 274 1302 4570 17 523 1302 1370 16 523 1302 1038 25 324 1370 4408 55 523 1370 1890 2 604 2322 606 64 523 2322 761 53 11 2746 3654 45 523 2746 4433 10 952 2746 2508 24 131 3654 2322 76 523 3654 2504 8 228 4408 4565 21 523 4408 887 89 683 422 2476 68 309 422 318 56 149 1273 4200 12 309 1273 537 43 291 1411 2062 14 309 1411 3918 60 596 1411 4720 72 960 1866 4803 37 309 1866 4141 36 711 1866 3677 86 752 1903 4502 36 309 1903 4166 80 309 1903 308 13 974 1903 3450 67 613 2062 1866 50 309 2062 2119 31 375 2476 1273 22 309 2476 2697 81 125 3299 1903 76 309 3299 19 42 974 3299 4445 85 488 4166 1411 99 309 4166 42 19 618 4166 210 72 561 4200 3299 55 309 4200 196 44 742 4200 1940 97 524 423 1392 45 204 423 2126 67 347 423 2610 48 815 960 3781 65 204 960 4928 49 110 1392 2241 48 204 1392 1061 1 32 2241 3980 12 204 2241 376 84 807 2241 3984 30 552 3047 4546 51 204 3047 4535 90 176 3781 3047 78 204 3781 4796 36 204 3781 3178 41 395 3781 1563 95 617 3980 960 40 204 3980 3379 99 163 424 1908 38 264 424 1245 27 774 666 4535 74 264 666 3489 5 335 666 1423 10 855 1490 4021 29 264 1490 799 13 813 1490 713 27 301 1798 666 28 264 1798 2610 71 774 1908 1490 100 264 1908 1266 14 577 1908 3556 31 854 4021 1798 41 264 4021 4626 15 264 4021 4221 23 778 425 742 79 632 425 283 92 794 610 3427 69 632 610 2266 78 496 610 4716 53 474 742 1898 78 632 742 2133 26 278 742 975 88 640 1303 2901 48 632 1303 185 6 944 1303 902 20 550 1898 4238 43 632 1898 4634 87 632 1898 1825 92 951 2827 2941 87 632 2827 3296 33 57 2901 4953 70 632 2901 4677 49 632 2901 4661 80 995 2901 3433 19 55 2941 1303 82 632 2941 621 36 245 2941 4479 34 673 3427 3976 14 632 3427 1414 5 83 3533 610 40 632 3533 925 100 186 3533 1917 70 800 3976 2827 72 632 3976 4160 81 240 4238 4331 50 632 4238 3282 33 223 4238 4356 45 878 4331 3533 24 632 4331 2401 98 179 4331 184 48 798 426 3933 24 692 426 1951 90 104 426 3461 46 108 604 4909 33 692 604 3853 82 639 604 3610 6 262 2246 4683 52 692 2246 2300 92 692 2246 3774 88 313 2300 604 72 692 2300 2074 82 633 3933 4339 69 692 3933 4004 5 609 3933 1143 8 313 4339 2246 63 692 4339 2946 81 578 427 3526 56 930 427 2645 60 376 2478 4623 35 930 2478 3954 70 930 2478 2649 65 121 2478 896 1 534 3289 4079 8 930 3289 965 9 588 3526 3289 49 930 3526 2068 79 76 3526 757 14 885 3633 3810 35 930 3633 2958 42 333 3633 3627 4 384 3810 4829 21 930 3810 4860 97 746 3954 3633 76 930 3954 2150 76 304 4079 2478 22 930 4079 4414 42 237 428 2461 31 648 428 4556 8 434 428 1608 34 549 2155 4576 71 648 2155 2407 36 648 2155 4521 47 107 2155 1981 11 180 2407 4913 43 648 2407 4557 97 279 2461 4142 32 648 2461 3834 72 311 4142 2155 60 648 4142 297 30 514 4142 3369 22 726 429 2304 61 404 429 1033 16 225 2187 3410 63 404 2187 2531 50 443 2304 3927 12 404 2304 4540 9 404 2304 1716 9 670 2304 899 33 84 2305 2187 60 404 2305 4270 59 607 2305 3425 63 808 2369 2305 27 404 2369 1094 95 23 2369 2972 2 930 2895 2369 5 404 2895 4314 12 795 2895 3988 36 459 3410 4624 89 404 3410 3446 79 498 3410 3536 39 5 3927 4090 23 404 3927 1334 23 888 4090 2895 90 404 4090 868 25 406 4090 1244 20 233 430 3342 21 264 430 933 33 242 621 4439 18 264 621 4852 2 877 621 3474 46 807 3266 4974 54 264 3266 2799 68 775 3266 3876 75 314 3342 3978 47 264 3342 4703 89 988 3342 1512 60 720 3978 4737 57 264 3978 621 10 264 3978 4006 15 317 4439 3266 38 264 4439 2888 38 135 431 1123 63 1014 431 2610 86 52 1082 3897 9 1014 1082 2593 36 704 1082 4390 11 787 1123 1643 49 1014 1123 765 13 105 1123 3548 54 673 1643 4493 38 1014 1643 2835 13 297 1643 2331 94 223 3008 3843 62 1014 3008 1050 87 25 3123 3008 32 1014 3123 3740 51 184 3123 4929 83 469 3843 4845 87 1014 3843 1082 31 1014 3843 4650 1 432 3897 4573 10 1014 3897 4243 81 158 4493 3123 21 1014 4493 680 46 693 432 1731 91 298 432 3089 94 816 432 3482 54 964 1731 3406 71 298 1731 2667 54 715 1767 2725 61 298 1767 2041 12 747 1767 2160 18 812 1933 1767 54 298 1933 4937 71 298 1933 19 3 874 1933 2477 75 123 2696 4757 19 298 2696 4213 92 57 2725 2696 41 298 2725 3001 40 348 3406 1933 1 298 3406 1612 44 329 3406 2186 21 836 433 2958 38 498 433 742 67 917 1606 3852 70 498 1606 4918 4 776 2177 1606 61 498 2177 4430 83 407 2177 1288 66 602 2688 2177 20 498 2688 4510 16 498 2688 1322 75 651 2791 2688 25 498 2791 3957 85 566 2791 1103 75 170 2958 2791 23 498 2958 4833 78 14 2958 4857 60 499 3742 4862 98 498 3742 517 22 974 3742 3183 96 765 3852 3742 5 498 3852 4919 98 344 434 1276 86 36 434 4871 90 531 434 1378 72 399 1072 3128 81 36 1072 4959 73 36 1072 4181 33 116 1072 1532 30 297 1276 1072 93 36 1276 3779 57 103 1276 4545 1 534 1401 4643 64 36 1401 3103 81 825 1892 2144 8 36 1892 1992 94 274 1892 4899 59 619 2144 1401 36 36 2144 1634 19 34 2144 3635 44 660 3128 3416 91 36 3128 2561 20 223 3128 4679 87 756 3416 1892 100 36 3416 3117 75 861 435 585 11 141 435 2795 67 117 435 1996 38 507 585 3611 46 141 585 1921 97 277 585 286 51 527 944 4908 29 141 944 288 91 270 1665 4838 23 141 1665 3012 76 141 1665 869 94 142 1665 4774 44 965 3012 3029 14 141 3012 1802 57 826 3012 250 2 107 3029 944 74 141 3029 1857 86 290 3611 1665 58 141 3611 321 37 269 436 1154 99 957 436 1409 93 395 436 434 17 925 906 1595 5 957 906 4542 39 957 906 164 2 47 906 1126 69 963 1154 1335 15 957 1154 4305 54 456 1184 906 48 957 1184 2088 21 443 1335 4282 20 957 1335 446 74 128 1595 4873 79 957 1595 2784 72 784 1595 1143 97 23 2149 1184 37 957 2149 3905 55 63 2149 710 68 621 4282 2149 89 957 4282 2523 17 959 437 1134 60 574 437 4496 10 304 1018 3272 83 574 1018 2980 96 162 1031 3064 54 574 1031 2816 73 426 1134 1018 30 574 1134 4530 29 574 1134 2018 67 593 1134 2387 96 401 1710 1031 45 574 1710 1988 16 29 1710 3546 1 549 3064 4526 41 574 3064 3919 16 732 3272 1710 90 574 3272 2440 58 446 438 4256 99 507 438 4889 74 409 958 4192 10 507 958 1754 10 883 1287 2532 42 507 1287 1303 24 390 1287 973 64 502 2286 958 55 507 2286 3023 29 298 2532 3618 37 507 2532 253 56 375 2532 1873 17 946 3319 2286 89 507 3319 780 60 60 3319 3704 43 527 3618 4800 5 507 3618 4683 90 507 3618 3879 54 807 3618 4379 55 760 4192 1287 52 507 4256 4332 62 507 4256 4300 73 774 4332 3319 84 507 4332 222 70 19 439 4095 14 257 439 2258 9 709 1480 2311 22 257 1480 4749 82 257 2023 4633 69 257 2023 596 42 242 2311 2870 100 257 2311 1675 57 224 2311 2088 91 113 2648 1480 72 257 2870 2023 55 257 2870 1869 53 768 4095 2648 81 257 4095 3689 80 703 440 1284 37 531 440 686 57 423 440 1740 74 566 627 3768 56 531 722 4640 99 531 722 1111 44 183 985 3561 32 531 985 291 37 594 1284 627 47 531 1284 500 54 11 1284 407 9 21 2025 722 87 531 3286 2025 47 531 3286 837 78 468 3561 3286 5 531 3561 3990 13 447 3561 138 65 515 3768 4327 51 531 3768 4778 45 531 4327 985 28 531 441 509 77 1178 441 2704 41 431 509 2022 31 1178 509 61 51 433 509 2606 51 543 647 3409 44 1178 1572 647 5 1178 1572 2098 90 345 2022 3381 83 1178 2022 4743 3 1178 2219 3485 6 1178 2219 4198 2 234 2415 2219 44 1178 2415 1742 28 284 2671 3107 41 1178 2671 4613 45 292 3107 4781 69 1178 3107 1289 17 273 3381 1572 22 1178 3381 4547 75 909 3381 1073 33 581 3409 3575 91 1178 3409 4733 69 1178 3485 2671 45 1178 3575 2415 19 1178 3575 688 2 855 442 2809 76 689 442 4350 73 576 442 3644 90 721 772 4246 92 689 1218 1311 71 689 1218 4301 99 526 1218 1448 31 497 1311 4487 75 689 1348 1810 49 689 1348 3360 58 333 1810 3644 38 689 1810 1634 61 310 1810 1967 88 275 2569 4830 36 689 2809 772 86 689 2809 4685 33 306 3644 1218 73 689 3644 1504 5 219 3644 2419 46 269 4246 1348 27 689 4487 2569 66 689 4487 4824 70 689 443 2278 90 445 443 738 89 376 443 101 88 290 918 2830 54 445 1135 4910 64 445 1135 2556 32 864 1321 1946 70 445 1321 94 50 682 1612 3747 54 445 1612 1007 4 76 1946 1135 60 445 1946 4129 91 583 1946 4158 80 602 2278 918 11 445 2278 4512 30 445 2544 1321 3 445 2830 1612 73 445 2830 2721 57 98 3747 2544 60 445 3747 4874 17 505 3747 725 84 618 444 1756 55 422 1410 4552 99 422 1410 3226 68 201 1659 1872 88 422 1659 2856 98 478 1659 3267 63 773 1756 1659 50 422 1872 3621 58 422 1872 522 40 693 2348 1410 99 422 2348 4564 75 422 3621 3678 21 422 3621 4337 87 167 3678 4111 36 422 3678 443 79 644 4111 2348 54 422 4111 1892 35 420 445 1755 17 1222 445 3943 13 601 445 2542 79 88 995 4584 85 1222 1329 995 69 1222 1329 2491 88 540 1329 3914 88 257 1755 2923 22 1222 1870 2739 9 1222 1870 1971 64 39 2121 4044 13 1222 2121 21 1 507 2146 2734 36 1222 2146 3343 63 562 2146 3549 21 39 2734 4948 18 1222 2734 1870 53 1222 2739 1329 28 1222 2923 2121 36 1222 2923 2184 30 786 4044 2146 43 1222 4044 381 44 687 446 3737 67 404 446 1920 41 526 446 2117 39 641 1795 4925 89 404 1795 4854 11 404 2172 3905 33 404 3723 1795 43 404 3723 1588 53 584 3737 2172 20 404 3737 3410 84 277 3737 804 26 719 3905 3723 54 404 447 4470 69 516 447 2609 86 728 950 4608 95 516 950 582 83 719 2429 3549 96 516 2429 1407 32 282 2429 3634 54 996 2795 3705 9 516 3549 2795 73 516 3549 3319 50 178 3705 950 81 516 3705 1788 55 860 3705 955 73 438 4470 2429 5 516 4470 4844 97 516 448 2826 45 298 955 1122 47 298 955 3479 32 363 1122 1171 59 298 1122 4643 96 298 1171 3312 12 298 1171 1826 28 767 1171 1545 64 428 1788 4986 27 298 2826 955 37 298 2826 578 46 526 2826 4940 22 287 3312 1788 62 298 449 1336 86 359 449 2178 62 946 628 4986 16 359 628 132 51 224 1210 4985 61 359 1210 1907 59 359 1336 1210 47 359 1336 785 44 447 1907 628 15 359 1907 1879 57 527 450 596 16 196 450 709 40 193 596 2845 55 196 596 3765 30 312 596 3339 74 79 858 3925 38 196 937 1252 50 196 937 4691 9 886 989 937 19 196 989 4990 32 196 1252 858 1 196 1252 372 77 975 2845 989 86 196 2845 4952 16 771 3925 4913 29 196 3925 4068 15 906 451 2536 80 394 451 680 94 499 1819 4823 68 394 1819 1728 4 791 1835 2033 45 394 1835 1863 85 329 1835 2619 33 731 2033 2463 93 394 2388 1835 74 394 2388 892 63 318 2463 1819 14 394 2463 4830 34 394 2536 2690 72 394 2536 657 13 768 2690 2388 8 394 2690 2830 99 924 2690 1269 63 717 452 3638 17 412 638 2222 55 412 638 4801 44 171 1342 1777 21 412 1342 294 12 584 1607 4352 5 412 1607 3073 72 449 1607 2195 45 548 1619 638 7 412 1777 4841 78 412 1777 1906 66 412 1906 2002 1 412 1906 3759 2 38 1906 1997 21 610 2002 4514 58 412 2222 1607 27 412 2222 625 81 3 3368 1619 4 412 3368 3415 25 706 3368 1243 55 315 3452 4645 22 412 3452 1342 27 412 3638 3368 50 412 4352 3452 8 412 4352 4706 16 255 4352 4834 4 734 453 1241 77 276 1241 2329 69 276 1241 3434 57 216 1241 1835 12 16 2329 2379 2 276 2379 3528 31 276 2379 261 65 592 3010 4907 71 276 3010 4066 42 880 3528 3565 20 276 3528 4509 37 276 3565 3010 50 276 3565 3356 53 883 3565 4845 18 491 454 2333 58 484 542 2145 93 484 542 1147 53 410 786 3641 43 484 786 1396 12 603 786 4512 13 819 2016 542 78 484 2145 3578 29 484 2145 3048 7 22 2333 4412 34 484 2333 4518 80 282 2333 4173 23 438 2417 4204 52 484 3578 786 34 484 3578 3466 14 625 3641 4913 3 484 3641 665 68 346 4204 2016 51 484 4204 4542 51 484 4412 2417 35 484 4412 294 28 624 4412 3289 61 230 455 2814 72 635 1785 2273 44 635 1785 2312 20 949 1808 1785 90 635 1808 4525 16 268 1808 2134 22 249 2273 2292 47 635 2292 4410 2 635 2292 1905 60 684 2732 4793 30 635 2732 3900 1 501 2732 1011 69 909 2814 1808 25 635 2984 2732 60 635 2984 1046 22 402 3620 2984 76 635 3620 4676 70 938 3620 3628 52 343 4410 3620 27 635 4410 4962 59 635 456 1508 72 204 1233 2672 45 204 1233 2614 53 411 1482 1233 21 204 1482 505 90 879 1508 2679 27 204 1508 1683 34 51 1508 4526 83 883 1574 4774 26 204 2226 1574 97 204 2226 3461 16 276 2672 2226 24 204 2672 1078 42 600 2672 4104 34 693 2679 1482 34 204 2679 4817 99 204 457 2057 25 826 1047 1960 67 826 1047 4884 76 826 1449 4473 3 826 1449 183 87 454 1960 3190 84 826 1960 1588 29 253 1960 733 83 682 2057 1047 56 826 3190 1449 75 826 3190 1834 25 684 3190 3429 95 857 4473 4554 1 826 458 688 33 169 458 3560 79 587 688 1332 38 169 688 4861 69 169 1332 2790 39 169 1332 2326 79 722 1332 4161 100 253 2790 3226 70 169 3226 4129 66 169 3226 1544 51 811 3226 1015 51 848 4129 4934 58 169 459 2778 19 361 459 1608 22 283 685 3625 72 361 685 3346 32 832 685 1369 28 607 1175 2614 69 361 1515 1530 38 361 1515 785 78 272 1515 4211 34 995 1530 4996 37 361 2614 4039 88 361 2614 4608 2 361 2778 3247 72 361 2778 2811 20 948 3247 685 67 361 3247 1998 2 10 3625 1175 11 361 3625 268 84 16 4039 1515 38 361 4039 1433 65 536 460 4032 61 906 460 1230 54 949 460 3942 76 972 923 2252 56 906 1240 3199 63 906 1240 3890 69 991 1240 4353 60 31 2252 4788 32 906 2252 4685 7 906 2695 4454 71 906 3199 2695 3 906 3199 1789 2 554 3519 923 19 906 3519 3083 31 675 3519 242 59 887 4032 4340 49 906 4340 1240 71 906 4340 3480 56 50 4454 3519 36 906 4454 863 13 97 461 3212 70 1143 461 284 36 253 461 4996 93 135 564 913 96 1143 863 4879 87 1143 863 4981 93 1143 913 2479 43 1143 913 1786 16 992 913 2453 69 42 1494 863 100 1143 2126 4233 43 1143 2126 4272 4 733 2126 3969 67 784 2479 3425 98 1143 3212 2126 46 1143 3212 4687 90 256 3212 2716 10 560 3425 1494 47 1143 4233 564 59 1143 4233 2357 70 201 462 3872 6 484 462 306 57 119 752 1213 29 484 752 633 80 560 852 4488 39 484 852 3620 74 832 852 4280 2 118 920 2195 21 484 1213 852 76 484 1213 2627 19 865 1213 3699 51 35 2098 920 87 484 2195 2674 14 484 2195 4642 42 484 2674 3821 43 484 2674 1082 43 985 2674 1188 87 323 3821 752 66 484 3872 2098 68 484 3872 3065 93 711 4488 4916 63 484 4488 3428 96 536 463 4308 23 670 463 2581 4 130 463 3574 76 36 503 2186 6 670 905 4631 39 670 905 4274 32 574 905 990 23 55 1221 905 67 670 2186 4945 15 670 2186 1221 39 670 4308 503 40 670 4308 806 24 833 464 3391 55 248 464 393 39 694 1507 4789 18 248 1507 1449 86 875 2207 1507 5 248 2207 2070 9 596 2207 570 20 944 2363 3636 66 248 3391 2363 19 248 3391 3834 28 661 3391 221 4 699 3636 2207 100 248 3636 4573 55 248 465 2499 92 94 756 2235 34 94 756 4026 19 753 756 3461 29 976 785 1067 7 94 1067 1133 98 94 1067 4528 88 13 1133 756 86 94 1133 701 7 185 1133 2571 60 911 1734 2875 84 94 2235 4838 22 94 2235 1763 20 810 2499 3831 75 94 2499 2136 1 854 2875 4635 87 94 2875 785 69 94 3831 1734 15 94 3831 1890 69 466 3831 2931 45 215 466 2677 23 109 640 3670 53 109 640 2159 35 920 1362 3169 91 109 1362 3500 25 202 2468 3397 47 109 2468 284 54 819 2677 1362 57 109 2677 3378 83 278 2677 2712 58 521 3169 2468 16 109 3397 3973 18 109 3397 4836 50 235 3670 4728 56 109 3670 4608 68 109 3973 640 50 109 3973 3295 78 137 3973 4064 36 764 467 4153 77 506 774 3305 4 506 774 4988 92 387 774 2008 46 403 1095 1994 41 506 1994 774 38 506 1994 4963 26 908 2138 2626 21 506 2138 836 75 514 2138 938 2 810 2626 4961 18 506 2626 1095 48 506 2860 4293 90 506 3305 2860 31 506 3305 117 21 660 4153 2138 78 506 4153 2631 62 917 4293 4769 4 506 4293 3075 88 838 468 615 42 718 468 2001 61 706 615 3693 16 718 615 3101 27 543 684 4668 3 718 684 3134 91 718 813 4681 47 718 813 731 47 115 2733 684 27 718 2733 3238 52 128 2733 1752 58 809 3134 813 57 718 3460 2733 100 718 3460 3551 2 729 3693 3460 64 718 3693 1545 58 176 3693 4703 30 558 469 1388 44 381 520 1402 85 381 520 3704 94 431 1388 2617 6 381 1388 1347 25 885 1402 4949 78 381 1402 403 83 83 2617 4649 9 381 2617 3707 78 381 2917 4213 16 381 2917 1651 75 703 3160 2917 32 381 3160 3488 17 708 3707 3160 57 381 3707 4925 77 958 3707 4892 85 547 4213 520 36 381 470 1019 29 1110 470 1900 96 388 519 733 73 1110 519 3056 78 105 733 4932 97 1110 733 3137 22 177 733 4724 80 753 1019 2944 96 1110 2568 519 43 1110 2568 1364 30 90 2944 4234 51 1110 2944 4630 91 1110 4124 2568 46 1110 4124 1272 24 671 4124 1291 45 125 4234 4124 18 1110 471 3228 4 414 471 809 23 33 517 4774 98 414 517 3400 76 520 517 881 75 401 1634 517 11 414 1634 4967 11 414 2443 1634 48 414 3228 3564 48 414 3228 1877 38 867 3228 4718 41 479 3564 2443 94 414 472 3182 1 1002 472 4334 61 17 1195 4424 21 1002 1195 644 45 89 3182 3211 61 1002 3182 1228 38 331 3182 2767 83 414 3211 3469 53 1002 3469 1195 59 1002 3469 4626 65 1002 4424 4855 29 1002 4424 4598 45 750 473 801 85 327 473 3783 22 467 801 3108 97 327 801 4465 98 235 801 990 10 255 1109 3297 47 327 2736 1109 7 327 2736 3667 14 728 2736 1953 57 838 3108 4276 2 327 3108 4643 68 327 3297 4287 10 327 4276 2736 41 327 4276 2372 13 232 4276 659 98 203 4287 4511 41 327 474 1759 71 452 474 1202 60 963 474 1947 1 278 1418 3689 29 452 1581 1779 34 452 1581 155 27 674 1581 1757 23 5 1759 2940 17 452 1779 2020 14 452 1779 1126 28 687 2020 1418 78 452 2020 3331 78 461 2940 1581 91 452 2940 3331 33 696 2940 932 89 994 3689 4601 24 452 3689 4656 84 452 475 3835 33 379 3046 4856 71 379 3046 3842 31 379 3244 4914 19 379 3244 2721 15 574 3244 755 89 504 3835 3046 66 379 3842 4391 33 379 3842 397 39 528 3842 4182 90 694 4391 3244 39 379 476 2847 50 315 476 1987 52 512 1766 4735 19 315 1766 3943 75 348 1766 1717 60 682 2119 4795 92 315 2119 1766 62 315 2847 2889 11 315 2889 2119 68 315 2889 645 62 246 477 2234 37 1012 477 3926 94 40 477 4325 96 37 901 4586 63 1012 2234 3699 4 1012 2234 2332 32 190 2603 2702 32 1012 2603 2682 67 578 2702 901 96 1012 2702 1231 45 546 3699 4481 40 1012 3699 2501 39 825 3699 651 76 225 4481 2603 17 1012 4481 4777 74 1012 478 1138 29 572 620 2442 87 572 620 4799 25 572 712 4314 79 572 712 330 13 806 712 1036 94 380 718 4867 79 572 1002 620 56 572 1002 320 79 189 1002 1845 37 413 1138 1002 25 572 1831 3982 61 572 1831 2423 47 660 1831 83 95 457 2442 1831 1 572 3982 712 13 572 3982 4008 60 951 3982 804 28 389 4314 718 70 572 479 3056 99 421 479 1720 48 494 479 2994 87 983 614 3110 28 421 1190 1999 61 421 1190 4183 14 467 1999 2490 46 421 1999 4752 55 421 2490 614 54 421 2490 2830 63 120 2490 509 88 457 3056 1190 39 421 3110 4917 19 421 3110 4719 72 770 480 1197 79 653 480 2349 3 855 567 3560 30 653 567 3864 28 397 1197 2782 80 653 1197 3207 84 798 1197 2835 51 23 2265 2323 5 653 2323 2401 81 653 2323 2111 89 443 2401 4900 35 653 2401 4779 95 712 2580 567 92 653 2580 347 9 911 2580 272 2 574 2782 4452 83 653 3560 4663 7 653 3560 2265 68 653 4452 2580 1 653 4452 109 68 866 481 3653 30 492 481 1158 54 611 481 4867 73 62 970 4807 72 492 970 4674 41 492 2107 4188 5 492 2692 970 67 492 2692 3213 50 988 2692 4241 50 605 2985 2692 23 492 3653 2107 89 492 3653 2628 70 350 3653 532 77 650 4188 2985 96 492 482 3115 32 485 482 2195 58 890 482 451 30 743 2290 3710 74 485 3115 4441 79 485 3115 3739 9 273 3115 148 94 4 3317 4370 97 485 3626 2290 26 485 3626 4861 91 319 3710 4518 95 485 3710 4031 11 58 4370 4449 3 485 4370 4956 4 563 4370 3800 6 925 4441 3317 42 485 4449 3626 63 485 4449 4831 19 485 483 2903 65 91 483 4926 11 69 1617 4630 39 91 1617 1306 2 85 2899 3994 99 91 2899 4943 13 804 2899 1864 23 903 2903 2899 82 91 3568 3958 71 91 3568 4676 80 265 3568 368 89 470 3958 1617 2 91 3994 3568 45 91 3994 4698 67 91 484 930 24 667 484 1368 56 873 504 4557 5 667 504 4526 83 667 930 1228 12 667 930 134 46 698 1208 1965 21 667 1208 3324 36 250 1228 2396 49 667 1228 2148 57 84 1228 4310 100 47 1965 504 77 667 2396 1208 19 667 2396 4818 43 661 2396 2734 39 612 485 2653 69 793 806 3143 80 793 806 2430 84 292 806 4140 98 277 1868 2283 47 793 1981 1868 63 793 1981 334 29 143 2283 4825 39 793 2283 4971 73 793 2653 806 76 793 2653 523 86 727 2653 459 17 92 3143 1981 100 793 486 808 61 192 486 1234 8 729 605 2757 4 192 605 1666 13 180 808 1334 27 192 808 4553 84 192 986 2660 94 192 986 4876 64 635 1334 2389 38 192 1334 992 17 160 1334 2674 87 897 2389 2760 19 192 2660 3851 74 192 2660 1535 44 24 2660 1109 23 732 2757 986 94 192 2760 605 32 192 2760 4233 65 308 2760 1939 32 817 3851 4080 68 192 4080 4670 47 192 4080 2428 50 321 487 3862 93 631 487 2662 87 672 2275 2962 88 631 2275 1263 60 511 2962 3527 90 631 2962 4840 55 568 2962 30 37 313 3527 4892 17 631 3862 4455 86 631 3862 2891 77 680 4055 4955 45 631 4055 2275 18 631 4455 4055 61 631 4455 4452 23 503 488 3724 29 404 488 1273 40 139 488 3989 86 350 553 1989 92 404 1094 4548 54 404 1094 4568 20 404 1989 2370 65 404 1989 1907 65 885 1989 2064 20 235 2370 1094 28 404 3724 553 18 404 3724 2427 49 523 3724 2598 8 273 489 1124 21 635 507 4763 4 635 507 818 46 445 1124 1842 100 635 1124 915 74 515 1124 127 11 220 1842 3901 48 635 2556 4879 61 635 2556 3426 65 635 3426 507 28 635 3426 3730 76 572 3426 3251 23 355 3901 3970 52 635 3970 2556 67 635 3970 522 23 772 3970 3556 63 386 490 1601 85 60 1502 4174 71 60 1502 2646 67 431 1601 1502 4 60 1601 2227 62 652 2153 4407 70 60 2153 2783 47 808 2153 103 24 669 2781 4577 99 60 3766 4058 53 60 3766 158 4 916 4058 2781 81 60 4058 4795 29 60 4174 2153 24 60 4174 604 51 600 4174 3813 26 45 4407 3766 11 60 491 3953 91 252 491 202 28 44 491 2189 90 337 1282 2714 42 252 2714 4425 95 252 2714 4780 47 811 3712 4656 84 252 3712 644 1 753 3841 1282 33 252 3841 4305 5 918 3870 3841 64 252 3870 2399 11 578 3870 1084 72 711 3953 3870 4 252 4425 3712 74 252 4425 4949 43 252 492 1543 5 739 492 4164 96 549 720 4679 96 739 720 2743 81 594 1199 4746 21 739 1199 2230 7 739 1543 2742 66 739 1543 3269 33 508 2230 720 78 739 2230 1507 75 372 2742 1199 11 739 2742 440 28 422 493 539 25 117 493 345 11 946 539 1104 97 117 539 4135 56 631 765 3727 56 117 765 418 51 106 765 4865 82 943 1104 1427 39 117 1270 765 72 117 1270 3572 40 20 1427 2024 64 117 1427 1394 52 839 2024 1270 27 117 2024 3528 97 202 2629 4825 16 117 2629 4642 24 117 3727 2629 57 117 3727 2758 74 902 494 3166 22 412 494 88 34 479 595 4527 82 412 595 2959 69 973 595 292 13 391 771 2927 71 412 771 4571 63 412 834 595 29 412 1567 834 48 412 1567 2405 38 32 1567 2417 27 501 2927 3719 62 412 3040 771 1 412 3040 3488 33 468 3040 372 17 136 3166 3040 35 412 3569 1567 89 412 3569 248 33 103 3569 184 70 422 3719 3569 4 412 495 639 61 804 495 303 11 66 495 3767 42 178 639 1814 32 804 1458 3332 76 804 1458 1653 56 518 1458 99 88 693 1475 4465 60 804 1475 4752 53 804 1814 4162 65 804 2470 1475 65 804 2470 4743 20 939 2470 1129 44 475 2635 1458 32 804 3332 4916 2 804 3332 3363 89 506 3332 2003 4 734 3987 2635 97 804 4162 2470 96 804 4162 1159 51 634 4465 3987 42 804 4465 3464 65 125 496 4006 4 472 496 1569 32 916 496 3329 15 557 1644 4895 12 472 2485 3384 25 472 2485 3921 14 548 2485 4800 78 850 3144 3777 68 472 3384 1644 84 472 3384 3095 24 410 3777 2485 96 472 3777 2263 6 983 4006 3144 70 472 4006 4843 21 472 497 3652 98 672 497 1880 13 988 497 4595 38 640 1286 2373 41 672 1331 1286 46 672 1331 4069 66 114 1445 1833 90 672 1445 1802 66 201 1445 4101 31 77 1833 2862 54 672 2373 3023 51 672 2373 4652 55 672 2862 4634 48 672 2862 1806 93 847 2862 3228 48 18 3023 1445 48 672 3652 1331 25 672 3652 3832 73 64 3652 915 43 261 498 2182 23 833 1571 1847 31 833 1571 3728 39 468 1571 3669 32 943 1847 4657 100 833 2182 2836 97 833 2182 1969 77 153 2319 1571 14 833 2319 2103 83 602 2836 2319 83 833 2836 4958 78 833 499 2255 49 1251 499 2214 85 522 499 1111 8 694 1939 4556 52 1251 2179 3423 44 1251 2179 4580 54 894 2179 4216 11 716 2255 3383 7 1251 3383 4689 69 1251 3383 2179 85 1251 3423 1939 67 1251 3423 3313 38 767 500 1446 59 638 500 1573 90 877 1015 4751 77 638 1015 4618 23 638 1015 4773 27 638 1015 4723 60 638 1015 2762 17 638 1015 4857 26 638 1015 4563 46 638 1015 4997 87 638 1015 4678 29 638 1015 4899 48 638 1015 4921 8 638 1015 4632 64 638 1015 4870 55 638 1015 4859 30 638 1446 3566 64 638 1446 4521 94 638 1446 4812 86 638 1446 4927 59 638 1446 4612 74 638 1446 4818 71 638 1446 4713 28 638 1446 4918 16 638 1446 4592 57 638 1446 4756 79 638 1446 4664 67 638 1446 4871 17 638 2762 4885 22 638 2762 4562 7 638 2762 4912 7 638 2762 4819 53 638 2762 4724 24 638 2762 4964 82 638 2762 4878 87 638 2762 4711 40 638 2762 4775 66 638 2762 4262 68 638 2762 4779 20 638 2762 4814 13 638 2762 4599 86 638 3100 4943 23 638 3100 4936 90 638 3100 4933 82 638 3100 4915 64 638 3100 4501 1 638 3100 4801 45 638 3100 4732 14 638 3100 1015 10 638 3100 4832 86 638 3100 4973 10 638 3100 4813 62 638 3566 4550 61 638 3566 3100 1 638 3566 4865 19 638 3566 4808 38 638 3566 4519 65 638 3566 4772 47 638 3566 4881 1 638 3566 4636 10 638 3566 4646 62 638 3566 4555 71 638 3566 4507 51 638 3566 4673 16 638 3566 4747 87 638 4262 4613 78 638 4262 4736 26 638 4262 4539 16 638 4262 4935 8 638 4262 4699 12 638 4262 4658 50 638 4262 4978 2 638 4262 4827 12 638 4530 1476 21 514 4531 56 19 39 4532 4910 61 239 4532 214 36 426 4533 3283 38 810 4534 1362 64 724 4534 4172 77 766 4535 1271 9 530 4536 4178 2 800 4536 757 98 704 4537 506 59 323 4537 4215 37 284 4538 1386 60 797 4539 3111 15 779 4540 668 61 370 4541 783 78 874 4541 775 12 557 4542 3521 11 457 4543 2472 80 263 4543 3930 7 277 4544 170 23 980 4544 1593 74 93 4545 2985 6 259 4546 3274 64 481 4547 1709 81 666 4548 259 33 229 4548 901 98 731 4549 4598 26 141 4550 2231 59 885 4550 1429 47 367 4551 1291 54 538 4552 4147 79 76 4552 398 35 796 4553 2267 31 739 4553 1604 29 9 4554 3596 3 94 4555 2884 75 209 4556 4588 19 782 4556 4796 76 997 4557 4850 53 545 4558 367 4 458 4558 4656 100 668 4559 196 60 94 4560 3611 98 30 4560 4675 88 261 4561 1494 31 824 4562 710 92 226 4563 481 58 543 4564 984 26 659 4565 4911 44 387 4565 846 38 938 4566 1760 92 868 4567 872 31 790 4568 3739 53 196 4568 301 11 449 4569 4888 47 431 4569 268 14 788 4570 3083 40 138 4570 91 5 712 4571 3271 13 314 4571 362 10 205 4572 845 83 442 4573 793 26 928 4574 3158 67 624 4574 4123 45 540 4575 4727 91 569 4575 2996 59 101 4576 3220 19 2 4576 23 7 824 4577 1186 26 331 4577 4258 99 194 4578 22 15 156 4578 3660 66 367 4579 3687 42 346 4579 403 8 987 4580 757 26 863 4581 4975 31 95 4582 4012 93 157 4583 2694 43 200 4583 3069 58 415 4584 2502 45 867 4584 3416 9 206 4585 566 9 177 4586 2454 48 237 4586 1401 3 121 4587 2844 43 561 4587 1869 52 219 4588 4144 65 51 4589 1703 50 345 4589 778 82 168 4590 512 76 406 4591 3201 15 847 4591 955 1 540 4592 2492 97 567 4592 2478 64 798 4593 2172 81 389 4593 3337 84 257 4594 2263 20 920 4594 1987 5 598 4595 826 39 985 4596 791 9 100 4597 3801 64 604 4597 4330 12 897 4598 4946 31 141 4598 450 57 219 4599 4677 39 668 4600 3861 14 48 4600 3193 70 567 4601 2431 78 878 4602 908 78 885 4602 931 90 807 4603 928 35 687 4603 2346 82 398 4604 1361 77 767 4605 4368 58 341 4606 3018 25 667 4606 4131 4 891 4607 4968 80 853 4607 801 12 693 4608 649 55 100 4608 4917 14 459 4609 2106 60 451 4609 4257 87 530 4610 4221 1 950 4611 1513 10 483 4612 1378 12 387 4612 4696 86 789 4613 3688 90 414 4614 3393 8 853 4614 4289 94 219 4615 3009 71 645 4616 2096 44 157 4617 4446 34 754 4618 4512 85 232 4619 4659 68 690 4619 2747 26 182 4620 3659 52 938 4621 2748 95 484 4622 259 31 883 4623 4010 86 738 4623 1650 29 323 4624 3549 48 652 4624 344 42 922 4625 4212 43 812 4626 1977 55 940 4627 157 68 74 4628 127 21 198 4628 1156 80 184 4629 4639 1 114 4629 1359 34 968 4630 606 37 751 4630 2762 39 57 4631 1303 3 677 4632 3641 20 400 4632 3792 71 66 4633 3868 45 604 4633 3950 81 574 4634 1330 41 898 4634 1770 18 149 4635 2733 96 720 4636 3973 51 800 4636 3685 98 815 4637 3033 45 429 4637 3067 83 37 4638 4278 23 322 4638 2012 25 364 4639 2314 18 851 4639 1303 58 821 4640 158 4 744 4640 1313 94 834 4641 4549 80 232 4641 1553 90 353 4642 1528 16 105 4643 1986 23 206 4644 2525 19 105 4644 4116 10 627 4645 1652 81 881 4646 3973 19 873 4647 3284 18 48 4647 562 98 976 4648 592 17 734 4648 1602 52 76 4649 708 35 394 4650 2174 14 810 4650 661 67 202 4651 875 41 368 4652 4766 92 585 4653 3090 2 840 4653 956 80 765 4654 2022 92 478 4655 4912 64 315 4656 2300 88 93 4656 640 87 167 4657 841 82 826 4657 4027 42 659 4658 2266 47 550 4658 3865 18 254 4659 1332 78 781 4660 1273 6 324 4661 4463 70 610 4662 27 99 201 4663 40 54 314 4663 1533 84 600 4664 2987 44 628 4665 2752 59 163 4665 1445 78 221 4666 2649 93 248 4666 2615 4 187 4667 3098 95 522 4668 768 45 449 4669 943 46 794 4669 450 36 45 4670 3525 40 249 4671 1657 53 357 4672 2496 63 458 4672 4698 51 547 4673 1729 38 169 4673 2717 56 353 4674 555 20 770 4675 4713 50 968 4675 1729 20 182 4676 4229 90 259 4676 3097 56 125 4677 2078 41 409 4677 4510 66 743 4678 62 97 859 4679 1613 40 602 4679 2665 14 471 4680 1197 81 55 4680 1585 17 996 4681 4118 71 419 4682 665 93 696 4683 3367 2 312 4684 4905 78 879 4684 4673 60 822 4685 3405 8 157 4686 2923 46 419 4686 4925 53 484 4687 2673 25 285 4688 4256 59 627 4688 2685 53 501 4689 3476 24 92 4690 1745 90 965 4690 4879 26 795 4691 3785 3 939 4691 4372 32 981 4692 1361 4 867 4693 4351 38 142 4693 4872 5 942 4694 1620 66 846 4695 3514 57 58 4696 4376 72 479 4697 4593 2 912 4697 4013 66 270 4698 4620 87 107 4699 1924 12 818 4699 1293 36 223 4700 3705 58 592 4701 1681 65 856 4702 2754 74 76 4702 1349 4 284 4703 1967 54 853 4703 713 100 532 4704 4571 36 30 4705 3854 58 367 4706 958 9 12 4706 2074 65 640 4707 4186 46 735 4708 2015 64 891 4709 4629 50 857 4709 2016 87 929 4710 3633 45 29 4710 1341 75 764 4711 2264 100 163 4712 2292 3 987 4712 2531 9 576 4713 308 27 864 4714 4363 1 47 4715 3969 5 661 4715 3246 57 513 4716 4027 84 454 4717 3459 69 375 4718 1657 17 473 4719 582 26 625 4720 2502 95 724 4721 1072 33 296 4721 4047 98 718 4722 1161 2 925 4722 2171 80 693 4723 2188 33 899 4723 353 87 211 4724 4661 75 351 4724 149 25 52 4725 4835 98 130 4726 674 99 338 4727 747 70 312 4728 3552 20 732 4728 2710 78 146 4729 4875 52 981 4729 588 73 298 4730 488 87 867 4730 3759 95 760 4731 2213 64 499 4732 3284 79 714 4733 1977 86 728 4734 3027 17 796 4734 241 45 555 4735 3009 25 730 4735 2708 70 545 4736 4062 83 606 4737 170 87 717 4738 2673 72 291 4739 332 48 3 4739 3614 22 719 4740 2019 94 274 4741 4711 68 667 4741 2979 97 561 4742 2610 98 402 4742 3733 81 721 4743 422 89 521 4744 4840 99 191 4745 3995 39 574 4745 4820 52 213 4746 4096 63 92 4747 2232 33 341 4747 1883 91 191 4748 4742 91 354 4748 2422 52 456 4749 359 76 690 4749 2935 40 695 4750 768 34 243 4750 216 46 269 4751 2415 53 877 4752 2603 100 277 4753 444 1 457 4753 4381 54 69 4754 2049 18 806 4755 4020 3 379 4755 4025 2 812 4756 807 1 573 4757 791 29 981 4757 3051 31 335 4758 4435 92 558 4759 2508 58 623 4759 1269 10 784 4760 4458 35 194 4761 1276 1 262 4762 1933 43 865 4763 3027 35 473 4763 3357 57 763 4764 2129 33 426 4764 1779 61 492 4765 1439 69 309 4766 3735 62 481 4767 290 61 87 4768 3468 30 381 4768 4764 71 336 4769 3174 4 894 4770 1548 46 997 4770 1880 6 383 4771 3178 45 292 4771 1391 17 246 4772 1018 88 461 4772 2981 20 287 4773 2308 26 795 4774 1318 56 294 4774 2971 23 329 4775 2779 8 36 4776 4112 70 67 4777 2427 39 798 4777 4820 10 391 4778 1183 43 224 4778 3692 74 919 4779 1397 33 442 4780 1435 21 285 4780 3217 6 171 4781 4538 15 152 4781 4739 62 567 4782 2485 86 628 4782 2650 19 841 4783 4364 47 381 4784 3134 53 749 4784 2008 16 400 4785 1288 22 295 4786 4460 33 789 4786 4068 1 416 4787 4462 38 50 4788 181 3 984 4788 2182 42 137 4789 378 62 786 4790 1337 14 916 4790 3097 11 52 4791 4632 37 949 4791 1446 97 27 4792 2441 77 984 4792 2691 94 796 4793 197 81 683 4794 618 73 534 4795 2931 57 867 4796 51 98 114 4796 289 5 982 4797 4885 40 736 4797 3879 63 308 4798 3205 39 985 4798 3994 80 799 4799 3525 35 226 4799 2566 36 338 4800 116 58 761 4800 2711 88 618 4801 348 10 931 4802 3915 33 266 4803 3149 6 622 4803 2932 74 255 4804 2219 95 354 4805 2768 33 675 4806 4942 81 956 4807 4341 47 509 4808 3147 43 458 4808 421 6 614 4809 90 19 330 4810 2901 11 914 4811 4607 36 817 4811 577 92 656 4812 3498 15 785 4812 4179 24 42 4813 4925 99 249 4814 3168 4 291 4815 2198 60 673 4815 4245 42 476 4816 1425 86 9 4816 1956 98 238 4817 4399 61 937 4818 4143 69 603 4819 1506 4 932 4819 809 63 9 4820 81 84 325 4820 2783 6 812 4821 686 37 704 4821 1006 55 591 4822 3896 30 428 4822 100 25 240 4823 3868 44 964 4824 3158 8 583 4824 3442 71 117 4825 451 91 899 4826 3955 79 584 4827 3181 83 466 4827 4499 87 387 4828 3449 90 158 4829 412 41 932 4830 409 72 829 4831 1715 44 345 4831 804 98 596 4832 2219 49 790 4832 3452 29 727 4833 11 27 43 4833 2348 47 218 4834 1701 70 32 4835 2067 96 554 4836 3940 31 587 4837 3810 6 896 4837 2985 2 508 4838 471 15 118 4838 2535 21 718 4839 2030 47 497 4839 4383 28 734 4840 877 22 520 4840 95 61 522 4841 4608 1 684 4841 1219 17 479 4842 3803 20 16 4843 4026 91 311 4843 778 60 911 4844 2047 27 658 4844 332 52 591 4845 136 87 466 4845 513 92 76 4846 2925 34 333 4846 1576 14 50 4847 1221 96 708 4847 198 1 953 4847 2218 55 70 4848 4738 36 474 4848 2336 93 65 4849 1302 72 977 4849 2039 58 449 4849 1851 35 140 4849 3412 89 798 4850 1737 92 726 4850 3178 46 366 4850 4388 62 796 4851 4048 51 146 4851 4246 7 573 4851 2394 73 228 4852 1136 72 689 4852 2551 30 556 4852 3371 75 844 4852 5 46 569 4853 2347 56 658 4854 3003 31 478 4854 4619 63 621 4854 3456 77 712 4854 3418 55 826 4855 600 82 500 4855 3040 69 543 4855 2470 44 83 4856 1244 13 789 4857 2603 74 549 4857 425 23 938 4857 2308 73 966 4857 2357 77 700 4858 2377 45 310 4858 955 39 507 4858 2854 95 789 4859 2490 42 918 4860 3414 48 810 4860 4042 9 121 4860 4105 82 41 4860 4637 88 753 4861 69 35 447 4862 1121 49 519 4862 2644 57 292 4862 1437 11 816 4862 2328 33 173 4863 4654 87 291 4863 933 26 304 4864 4907 58 443 4864 3143 85 8 4865 2056 48 567 4865 3866 84 80 4865 149 57 29 4865 3558 62 665 4866 1030 100 502 4866 931 68 784 4867 955 96 177 4867 1192 65 240 4867 2857 14 317 4868 1193 26 848 4868 3474 48 852 4868 2661 93 982 4869 4909 50 958 4869 4675 44 179 4869 34 44 597 4869 343 2 128 4870 25 93 419 4870 4605 30 553 4870 3756 1 463 4870 766 45 697 4871 1745 35 595 4871 4354 54 162 4872 571 56 539 4872 1574 15 383 4872 4251 88 112 4872 990 86 229 4873 2630 63 489 4873 690 46 817 4874 3352 26 678 4875 3758 41 153 4875 2338 64 803 4875 2811 67 196 4876 4 51 78 4876 1047 34 657 4877 807 12 42 4878 1808 50 398 4878 99 90 692 4879 2263 37 849 4879 2173 9 417 4879 3324 11 568 4880 2260 59 84 4880 2951 79 557 4880 2574 81 361 4880 2068 68 19 4881 3775 8 524 4881 4055 61 900 4882 2464 29 354 4882 986 61 24 4883 1389 34 991 4883 3138 62 659 4884 1594 27 186 4884 4229 95 483 4885 4544 60 20 4886 4021 37 514 4887 4565 92 77 4887 1490 2 711 4887 4745 2 556 4887 921 62 941 4888 1724 8 672 4888 2455 99 956 4888 4649 15 762 4888 2648 21 354 4889 3691 85 169 4890 238 4 644 4890 4651 61 734 4891 2464 71 461 4892 743 13 110 4892 4523 79 687 4893 83 90 464 4893 4276 89 172 4893 4860 53 63 4893 3447 81 728 4894 4481 33 46 4894 1995 11 472 4894 496 96 240 4894 1155 25 965 4895 1904 14 702 4895 4710 42 198 4895 2039 87 985 4896 1552 100 977 4896 1266 42 340 4897 2566 88 810 4897 474 95 273 4898 2809 48 781 4898 357 40 551 4899 3353 57 595 4899 3298 77 24 4900 3997 35 433 4900 271 80 355 4900 2285 44 821 4901 1509 9 274 4901 57 16 143 4902 577 30 910 4902 3591 85 848 4903 1032 53 2 4903 4016 98 746 4903 1795 45 741 4904 1862 22 759 4905 2646 90 910 4905 4603 92 815 4905 1409 78 570 4905 4914 70 468 4906 3472 82 172 4906 4494 63 20 4906 855 100 561 4906 1629 57 333 4907 2340 14 714 4908 3718 48 58 4908 2080 97 33 4909 1858 78 536 4909 2896 44 775 4910 182 50 127 4910 2602 58 429 4911 4466 68 406 4912 745 83 897 4913 562 19 815 4913 3213 36 965 4913 3535 30 815 4913 27 26 558 4914 2822 31 151 4914 3194 72 65 4914 4473 13 979 4915 1223 32 508 4916 1225 63 722 4916 4223 68 599 4917 1295 70 704 4917 692 41 748 4917 325 45 233 4918 1433 92 515 4918 4309 70 99 4919 4251 86 969 4920 1024 59 608 4920 2922 11 146 4920 411 59 13 4921 85 29 753 4921 889 29 244 4922 4258 50 167 4923 216 56 341 4924 4834 26 515 4924 362 51 372 4925 1249 21 294 4925 3098 73 132 4925 2168 6 90 4926 377 35 347 4927 3231 97 673 4928 2125 74 457 4928 4213 75 84 4929 2515 64 761 4930 4205 21 589 4931 4782 74 946 4931 2280 86 845 4931 1942 33 971 4932 380 73 498 4932 4165 59 346 4933 2839 81 36 4933 3209 4 143 4933 4789 48 142 4934 1171 4 747 4934 4190 73 353 4934 1298 52 163 4934 3297 48 275 4935 2907 7 919 4936 1284 3 138 4936 915 60 2 4936 1454 11 712 4936 690 67 782 4937 3599 39 876 4937 347 83 985 4937 2567 29 617 4937 3596 20 21 4938 2187 66 76 4938 2619 65 787 4939 3259 12 191 4939 3160 92 836 4940 98 31 590 4940 4649 46 625 4940 4570 56 757 4941 4612 51 718 4941 2776 66 665 4942 2294 36 810 4942 831 90 593 4942 1908 83 598 4943 266 80 719 4943 621 87 218 4943 1201 87 187 4943 598 16 245 4943 2074 29 477 4943 1189 46 487 4944 2072 71 98 4944 2204 57 458 4944 328 39 765 4945 509 93 792 4946 2197 16 455 4946 12 33 649 4946 4846 9 631 4946 4762 20 130 4946 4312 14 807 4947 2045 8 508 4947 3558 15 314 4947 4308 46 280 4947 90 6 360 4948 4384 69 456 4949 2198 5 369 4949 4790 60 443 4950 254 34 92 4950 3858 55 120 4950 469 82 606 4950 2233 22 729 4950 1012 26 450 4950 200 86 760 4951 4072 45 606 4951 4852 42 191 4951 1400 50 665 4951 81 21 329 4951 4263 96 94 4951 513 84 769 4952 668 41 914 4952 148 16 48 4952 417 49 59 4952 4483 78 355 4952 2041 48 573 4952 1087 61 781 4953 3711 55 102 4953 289 70 144 4953 4938 1 934 4953 3108 59 889 4954 1348 68 754 4954 2786 18 373 4954 2458 10 259 4954 3579 27 608 4954 4277 64 926 4955 2738 87 16 4955 1487 66 337 4955 888 96 963 4955 3910 16 664 4956 291 11 676 4956 1009 70 574 4957 2057 88 702 4957 4988 46 478 4957 1831 5 313 4957 3137 98 563 4957 3857 1 257 4957 4061 53 642 4958 3582 82 675 4958 862 66 53 4958 490 25 825 4958 776 57 173 4959 512 2 456 4960 4562 32 72 4960 2771 64 256 4960 4093 49 110 4960 809 49 585 4961 2283 38 113 4961 3036 68 435 4961 2222 5 678 4961 3 7 161 4961 305 100 753 4962 237 95 664 4963 2554 37 991 4963 862 65 939 4964 4630 11 211 4964 3311 95 354 4964 3669 22 798 4964 1097 9 294 4964 1872 20 722 4965 49 87 314 4965 3264 5 516 4965 440 85 117 4965 3561 51 200 4965 358 89 720 4965 1622 16 380 4966 1161 52 826 4966 751 31 5 4966 147 35 743 4966 2193 2 107 4966 4596 20 586 4967 1489 27 205 4967 294 99 199 4968 1976 93 889 4968 3284 47 255 4968 3479 31 538 4968 2487 65 233 4968 3998 88 677 4968 3645 12 165 4969 4191 20 832 4969 3700 20 180 4970 1983 74 978 4970 1820 63 841 4970 2301 81 508 4971 356 49 767 4972 2869 97 432 4972 1779 59 440 4972 1863 30 721 4972 478 61 685 4972 2717 19 875 4973 1467 50 43 4974 694 62 123 4974 898 80 262 4974 1660 50 397 4974 2919 81 750 4974 734 28 492 4975 68 42 973 4975 1124 11 439 4975 1985 39 527 4975 3420 33 667 4975 667 38 457 4975 1827 11 189 4976 1358 99 772 4977 4229 62 554 4977 1027 99 839 4977 437 18 265 4977 4104 10 451 4977 4686 92 416 4978 1321 50 471 4979 287 42 449 4979 499 58 29 4979 3565 27 573 4979 2454 27 954 4980 1180 65 415 4980 1399 9 101 4980 2282 37 613 4981 656 71 212 4981 1529 55 440 4982 4862 49 926 4982 3493 70 577 4983 2439 45 194 4983 2931 71 379 4983 4821 15 762 4983 349 13 209 4983 4898 19 453 4984 4473 12 803 4984 2327 96 591 4984 879 11 672 4985 4141 48 942 4985 3061 56 255 4985 1479 23 900 4985 4597 37 122 4985 2493 6 900 4985 702 55 344 4985 59 84 366 4986 1167 13 640 4986 4925 10 682 4986 2740 34 475 4987 27 84 826 4987 2071 20 261 4987 651 65 562 4987 3525 48 370 4988 108 41 222 4988 1414 53 287 4988 2533 8 106 4988 1369 100 880 4989 2128 35 661 4989 2035 50 532 4989 1380 46 553 4989 124 10 647 4990 2668 50 212 4990 4813 93 3 4990 166 73 517 4990 3247 96 207 4990 3672 66 371 4990 3954 81 951 4991 442 79 689 4991 776 88 899 4991 623 31 282 4992 4697 23 803 4992 1679 31 4 4992 3837 20 240 4992 4301 52 666 4992 2450 6 941 4992 2486 31 379 4992 4039 80 902 4992 3099 41 935 4993 2788 32 140 4993 3695 41 659 4993 3818 63 850 4993 2220 29 542 4993 4947 70 422 4993 1138 18 977 4993 4527 23 350 4994 2461 87 32 4994 1994 14 205 4994 3496 51 444 4994 3272 53 103 4994 119 50 608 4994 3680 87 167 4994 1391 45 176 4994 179 80 320 4995 521 71 322 4996 2229 51 221 4997 4620 76 382 4997 2967 75 729 4997 549 28 654 4997 2696 75 399 4997 3519 52 762 4997 3261 4 562 4998 2734 61 88 4998 2788 54 78 4998 1377 33 55 4998 858 45 411 4998 2349 68 165 4998 2497 47 155 4998 3671 33 789 4998 3096 52 971 4999 1557 14 710 4999 3386 15 339 4999 659 46 813 4999 985 72 672 5000 2885 15 816 5000 4900 49 879 5000 3070 83 269 5000 273 99 25 5000 509 48 345 5000 808 90 288 5000 2694 21 249 DEMAND 4501 4 4502 150 4503 668 4504 535 4505 285 4506 740 4507 8 4508 567 4509 1283 4510 961 4511 335 4512 586 4513 1085 4514 25 4515 877 4516 1882 4517 469 4518 661 4519 11 4520 464 4521 5 4522 309 4523 248 4524 87 4525 512 4526 620 4527 1261 4528 1070 4529 211 4530 630 4531 107 4532 96 4533 486 4534 357 4535 316 4536 295 4537 564 4538 750 4539 2 4540 500 4541 375 4542 1809 4543 266 4544 1552 4545 427 4546 136 4547 19 4548 313 4549 509 4550 15 4551 312 4552 269 4553 501 4554 1145 4555 5 4556 680 4557 1303 4558 302 4559 495 4560 213 4561 83 4562 5 4563 7 4564 669 4565 18 4566 286 4567 387 4568 393 4569 451 4570 562 4571 286 4572 411 4573 974 4574 120 4575 181 4576 693 4577 204 4578 1117 4579 376 4580 755 4581 466 4582 156 4583 1187 4584 709 4585 123 4586 1242 4587 704 4588 703 4589 51 4590 319 4591 476 4592 13 4593 72 4594 120 4595 28 4596 505 4597 373 4598 243 4599 1 4600 818 4601 1175 4602 1013 4603 662 4604 1058 4605 275 4606 400 4607 537 4608 926 4609 708 4610 124 4611 372 4612 5 4613 511 4614 595 4615 240 4616 328 4617 187 4618 20 4619 1109 4620 423 4621 210 4622 24 4623 1041 4624 40 4625 1668 4626 1592 4627 373 4628 149 4629 875 4630 760 4631 1163 4632 18 4633 1372 4634 1160 4635 91 4636 13 4637 922 4638 340 4639 504 4640 1460 4641 425 4642 586 4643 690 4644 112 4645 1332 4646 20 4647 268 4648 770 4649 839 4650 11 4651 737 4652 336 4653 66 4654 1849 4655 483 4656 853 4657 1214 4658 1 4659 592 4660 1574 4661 84 4662 806 4663 606 4664 9 4665 1301 4666 605 4667 382 4668 903 4669 295 4670 44 4671 474 4672 729 4673 4 4674 174 4675 632 4676 513 4677 553 4678 27 4679 336 4680 33 4681 143 4682 561 4683 1105 4684 939 4685 441 4686 109 4687 315 4688 187 4689 791 4690 520 4691 378 4692 1028 4693 619 4694 1623 4695 310 4696 625 4697 630 4698 23 4699 10 4700 1020 4701 664 4702 326 4703 43 4704 238 4705 1654 4706 753 4707 393 4708 244 4709 1164 4710 1917 4711 18 4712 5 4713 9 4714 237 4715 1083 4716 268 4717 130 4718 154 4719 416 4720 143 4721 34 4722 694 4723 6 4724 8 4725 669 4726 996 4727 266 4728 53 4729 400 4730 829 4731 798 4732 6 4733 817 4734 298 4735 442 4736 3 4737 861 4738 769 4739 26 4740 792 4741 962 4742 557 4743 539 4744 645 4745 442 4746 795 4747 6 4748 284 4749 667 4750 587 4751 16 4752 1663 4753 296 4754 569 4755 883 4756 3 4757 450 4758 258 4759 416 4760 551 4761 532 4762 568 4763 1450 4764 158 4765 584 4766 1087 4767 84 4768 147 4769 349 4770 456 4771 626 4772 7 4773 8 4774 1255 4775 8 4776 780 4777 710 4778 13 4779 11 4780 406 4781 438 4782 415 4783 52 4784 258 4785 238 4786 201 4787 296 4788 1360 4789 762 4790 936 4791 313 4792 598 4793 576 4794 915 4795 301 4796 135 4797 1025 4798 502 4799 776 4800 897 4801 15 4802 476 4803 759 4804 46 4805 271 4806 163 4807 883 4808 4 4809 292 4810 1850 4811 600 4812 3 4813 9 4814 13 4815 653 4816 423 4817 103 4818 4 4819 8 4820 67 4821 369 4822 205 4823 197 4824 700 4825 764 4826 982 4827 7 4828 1199 4829 1588 4830 1708 4831 579 4832 15 4833 1397 4834 1131 4835 264 4836 133 4837 179 4838 381 4839 340 4840 408 4841 893 4842 6 4843 569 4844 565 4845 223 4846 264 4847 87 4848 549 4849 231 4850 256 4851 247 4852 53 4853 529 4854 276 4855 1039 4856 1348 4857 4 4858 128 4859 10 4860 325 4861 98 4862 594 4863 427 4864 543 4865 6 4866 262 4867 211 4868 995 4869 1268 4870 1 4871 2 4872 108 4873 320 4874 1013 4875 1252 4876 428 4877 510 4878 13 4879 1459 4880 594 4881 20 4882 613 4883 560 4884 251 4885 12 4886 1023 4887 116 4888 186 4889 247 4890 100 4891 98 4892 1012 4893 1292 4894 138 4895 1555 4896 157 4897 13 4898 424 4899 17 4900 157 4901 707 4902 65 4903 364 4904 881 4905 770 4906 47 4907 314 4908 244 4909 706 4910 1571 4911 539 4912 6 4913 1057 4914 1669 4915 6 4916 1703 4917 30 4918 6 4919 406 4920 774 4921 10 4922 394 4923 716 4924 1055 4925 992 4926 380 4927 8 4928 1217 4929 36 4930 251 4931 217 4932 1274 4933 568 4934 958 4935 8 4936 1 4937 538 4938 204 4939 315 4940 713 4941 261 4942 15 4943 10 4944 1 4945 298 4946 875 4947 227 4948 1229 4949 712 4950 176 4951 985 4952 332 4953 484 4954 920 4955 581 4956 881 4957 154 4958 1138 4959 6 4960 789 4961 1528 4962 415 4963 471 4964 2 4965 1008 4966 361 4967 1049 4968 885 4969 151 4970 204 4971 396 4972 477 4973 11 4974 494 4975 514 4976 1155 4977 991 4978 12 4979 576 4980 402 4981 1074 4982 226 4983 543 4984 384 4985 228 4986 299 4987 919 4988 508 4989 129 4990 98 4991 205 4992 434 4993 853 4994 769 4995 314 4996 1138 4997 20 4998 1 4999 465 5000 121 END CoinMP-1.8.3/Clp/examples/decomp2.cpp0000644000175000017500000000221711510657150015710 0ustar renerene/* $Id: decomp2.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" #include "CoinStructuredModel.hpp" #include int main(int argc, const char *argv[]) { /* Create a structured model by reading mps file and trying Dantzig-Wolfe decomposition (that's the 1 parameter) */ // At present D-W rows are hard coded - will move stuff from OSL #if defined(NETLIBDIR) CoinStructuredModel model((argc < 2) ? NETLIBDIR "/czprob.mps" : argv[1], 1); #else if (argc<2) { fprintf(stderr, "Do not know where to find netlib MPS files.\n"); return 1; } CoinStructuredModel model(argv[1], 1); #endif if (!model.numberRows()) exit(10); // Get default solver - could change stuff ClpSimplex solver; /* This driver does a simple Dantzig Wolfe decomposition */ solver.solve(&model); // Double check solver.primal(1); return 0; } CoinMP-1.8.3/Clp/examples/addBits.cpp0000644000175000017500000001667112130613567015745 0ustar renerene/* $Id: addBits.cpp 1935 2013-04-08 19:16:07Z stefan $ */ // Copyright (C) 2005, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* This is a simple example to create a model using CoinModel. For even simpler methods see addRows.cpp and addColumns.cpp This reads in one model and then creates another one: a) Row bounds b) Column bounds and objective c) Adds elements one by one by row. Solve It then repeats the exercise: a) Column bounds b) Objective - half the columns as is and half with multiplier of "1.0+multiplier" c) It then adds rows one by one but for half the rows sets their values with multiplier of "1.0+1.5*multiplier" where column affected It then loops with multiplier going from 0.0 to 2.0 in increments of 0.1 (you can have as many different strings as you want) */ #include "ClpSimplex.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "CoinModel.hpp" #include #include int main(int argc, const char *argv[]) { // Empty model ClpSimplex model; std::string mpsFileName; if (argc >= 2) mpsFileName = argv[1]; else { #if defined(NETLIBDIR) mpsFileName = NETLIBDIR "/25fv47.mps"; #else fprintf(stderr, "Do not know where to find netlib MPS files.\n"); exit(1); #endif } int status = model.readMps(mpsFileName.c_str(), true); if (status) { fprintf(stderr, "Bad readMps %s\n", mpsFileName.c_str()); fprintf(stdout, "Bad readMps %s\n", mpsFileName.c_str()); exit(1); } // Point to data int numberRows = model.numberRows(); const double * rowLower = model.rowLower(); const double * rowUpper = model.rowUpper(); int numberColumns = model.numberColumns(); const double * columnLower = model.columnLower(); const double * columnUpper = model.columnUpper(); const double * columnObjective = model.objective(); CoinPackedMatrix * matrix = model.matrix(); // get row copy CoinPackedMatrix rowCopy = *matrix; rowCopy.reverseOrdering(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const double * element = rowCopy.getElements(); //const int * row = matrix->getIndices(); //const int * columnLength = matrix->getVectorLengths(); //const CoinBigIndex * columnStart = matrix->getVectorStarts(); //const double * elementByColumn = matrix->getElements(); // solve model.dual(); // Now build new model CoinModel build; double time1 = CoinCpuTime(); // Row bounds int iRow; for (iRow = 0; iRow < numberRows; iRow++) { build.setRowBounds(iRow, rowLower[iRow], rowUpper[iRow]); // optional name build.setRowName(iRow, model.rowName(iRow).c_str()); } // Column bounds and objective int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { build.setColumnLower(iColumn, columnLower[iColumn]); build.setColumnUpper(iColumn, columnUpper[iColumn]); build.setObjective(iColumn, columnObjective[iColumn]); // optional name build.setColumnName(iColumn, model.columnName(iColumn).c_str()); } // Adds elements one by one by row (backwards by row) for (iRow = numberRows - 1; iRow >= 0; iRow--) { int start = rowStart[iRow]; for (int j = start; j < start + rowLength[iRow]; j++) build(iRow, column[j], element[j]); } double time2 = CoinCpuTime(); // Now create clpsimplex ClpSimplex model2; model2.loadProblem(build); double time3 = CoinCpuTime(); printf("Time for build using CoinModel is %g (%g for loadproblem)\n", time3 - time1, time3 - time2); model2.dual(); // Now do with strings attached // Save build to show how to go over rows CoinModel saveBuild = build; build = CoinModel(); time1 = CoinCpuTime(); // Column bounds for (iColumn = 0; iColumn < numberColumns; iColumn++) { build.setColumnLower(iColumn, columnLower[iColumn]); build.setColumnUpper(iColumn, columnUpper[iColumn]); } // Objective - half the columns as is and half with multiplier of "1.0+multiplier" // Pick up from saveBuild (for no reason at all) for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = saveBuild.objective(iColumn); if (iColumn * 2 < numberColumns) { build.setObjective(iColumn, columnObjective[iColumn]); } else { // create as string char temp[100]; sprintf(temp, "%g + abs(%g*multiplier)", value, value); build.setObjective(iColumn, temp); } } // It then adds rows one by one but for half the rows sets their values // with multiplier of "1.0+1.5*multiplier" for (iRow = 0; iRow < numberRows; iRow++) { if (iRow * 2 < numberRows) { // add row in simple way int start = rowStart[iRow]; build.addRow(rowLength[iRow], column + start, element + start, rowLower[iRow], rowUpper[iRow]); } else { // As we have to add one by one let's get from saveBuild CoinModelLink triple = saveBuild.firstInRow(iRow); while (triple.column() >= 0) { int iColumn = triple.column(); if (iColumn * 2 < numberColumns) { // just value as normal build(iRow, triple.column(), triple.value()); } else { // create as string char temp[100]; sprintf(temp, "%g + (1.5*%g*multiplier)", triple.value(), triple.value()); build(iRow, iColumn, temp); } triple = saveBuild.next(triple); } // but remember to do rhs build.setRowLower(iRow, rowLower[iRow]); build.setRowUpper(iRow, rowUpper[iRow]); } } time2 = CoinCpuTime(); // Now create ClpSimplex // If small switch on error printing if (numberColumns < 50) build.setLogLevel(1); // should fail as we never set multiplier int numberErrors = model2.loadProblem(build); if( numberErrors == 0 ) { printf("%d errors from model2.loadProblem(build), but we expected some", numberErrors); return 1; } time3 = CoinCpuTime() - time2; // subtract out unsuccessful times time1 += time3; time2 += time3; build.associateElement("multiplier", 0.0); numberErrors = model2.loadProblem(build); assert(!numberErrors); time3 = CoinCpuTime(); printf("Time for build using CoinModel is %g (%g for successful loadproblem)\n", time3 - time1, time3 - time2); build.writeMps("zero.mps"); // It then loops with multiplier going from 0.0 to 2.0 in increments of 0.1 for (double multiplier = 0.0; multiplier < 2.0; multiplier += 0.1) { build.associateElement("multiplier", multiplier); numberErrors = model2.loadProblem(build, true); assert(!numberErrors); model2.dual(); } return 0; } CoinMP-1.8.3/Clp/examples/ekk_interface.cpp0000644000175000017500000002413211510657150017151 0ustar renerene/* $Id: ekk_interface.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "ClpSimplexPrimal.hpp" #include "ClpFactorization.hpp" #include "ClpPresolve.hpp" #include "ekk_c_api.h" //#include "ekk_c_api_undoc.h" extern "C" { OSLLIBAPI void * OSLLINKAGE ekk_compressModel(EKKModel * model); OSLLIBAPI void OSLLINKAGE ekk_decompressModel(EKKModel * model, void * compressInfo); } static ClpPresolve * presolveInfo = NULL; static ClpSimplex * clpmodel(EKKModel * model, int startup) { ClpSimplex * clp = new ClpSimplex();; int numberRows = ekk_getInumrows(model); int numberColumns = ekk_getInumcols(model); clp->loadProblem(numberColumns, numberRows, ekk_blockColumn(model, 0), ekk_blockRow(model, 0), ekk_blockElement(model, 0), ekk_collower(model), ekk_colupper(model), ekk_objective(model), ekk_rowlower(model), ekk_rowupper(model)); clp->setOptimizationDirection((int) ekk_getRmaxmin(model)); clp->setPrimalTolerance(ekk_getRtolpinf(model)); if (ekk_getRpweight(model) != 0.1) clp->setInfeasibilityCost(1.0 / ekk_getRpweight(model)); clp->setDualTolerance(ekk_getRtoldinf(model)); if (ekk_getRdweight(model) != 0.1) clp->setDualBound(1.0 / ekk_getRdweight(model)); clp->setDblParam(ClpObjOffset, ekk_getRobjectiveOffset(model)); const int * rowStatus = ekk_rowstat(model); const double * rowSolution = ekk_rowacts(model); int i; clp->createStatus(); double * clpSolution; clpSolution = clp->primalRowSolution(); memcpy(clpSolution, rowSolution, numberRows * sizeof(double)); const double * rowLower = ekk_rowlower(model); const double * rowUpper = ekk_rowupper(model); for (i = 0; i < numberRows; i++) { ClpSimplex::Status status; if ((rowStatus[i] & 0x80000000) != 0) { status = ClpSimplex::basic; } else { if (!startup) { // believe bits int ikey = rowStatus[i] & 0x60000000; if (ikey == 0x40000000) { // at ub status = ClpSimplex::atUpperBound; clpSolution[i] = rowUpper[i]; } else if (ikey == 0x20000000) { // at lb status = ClpSimplex::atLowerBound; clpSolution[i] = rowLower[i]; } else if (ikey == 0x60000000) { // free status = ClpSimplex::isFree; clpSolution[i] = 0.0; } else { // fixed status = ClpSimplex::atLowerBound; clpSolution[i] = rowLower[i]; } } else { status = ClpSimplex::superBasic; } } clp->setRowStatus(i, status); } const int * columnStatus = ekk_colstat(model); const double * columnSolution = ekk_colsol(model); clpSolution = clp->primalColumnSolution(); memcpy(clpSolution, columnSolution, numberColumns * sizeof(double)); const double * columnLower = ekk_collower(model); const double * columnUpper = ekk_colupper(model); for (i = 0; i < numberColumns; i++) { ClpSimplex::Status status; if ((columnStatus[i] & 0x80000000) != 0) { status = ClpSimplex::basic; } else { if (!startup) { // believe bits int ikey = columnStatus[i] & 0x60000000; if (ikey == 0x40000000) { // at ub status = ClpSimplex::atUpperBound; clpSolution[i] = columnUpper[i]; } else if (ikey == 0x20000000) { // at lb status = ClpSimplex::atLowerBound; clpSolution[i] = columnLower[i]; } else if (ikey == 0x60000000) { // free status = ClpSimplex::isFree; clpSolution[i] = 0.0; } else { // fixed status = ClpSimplex::atLowerBound; clpSolution[i] = columnLower[i]; } } else { status = ClpSimplex::superBasic; } } clp->setColumnStatus(i, status); } return clp; } static int solve(EKKModel * model, int startup, int algorithm, int presolve) { // values pass or not if (startup) startup = 1; // if scaled then be careful bool scaled = ekk_scaling(model) == 1; if (scaled) ekk_scaleRim(model, 1); void * compressInfo = NULL; ClpSimplex * clp; if (!presolve || !presolveInfo) { // no presolve or osl presolve - compact columns compressInfo = ekk_compressModel(model); clp = clpmodel(model, startup);; } else { // pick up clp model clp = presolveInfo->model(); } // don't scale if alreday scaled if (scaled) clp->scaling(false); if (clp->numberRows() > 10000) clp->factorization()->maximumPivots(100 + clp->numberRows() / 100); if (algorithm > 0) clp->primal(startup); else clp->dual(); int numberIterations = clp->numberIterations(); if (presolve && presolveInfo) { // very wasteful - create a clp copy of osl model ClpSimplex * clpOriginal = clpmodel(model, 0); presolveInfo->setOriginalModel(clpOriginal); // do postsolve presolveInfo->postsolve(true); delete clp; delete presolveInfo; presolveInfo = NULL; clp = clpOriginal; if (presolve == 3 || (presolve == 2 && clp->status())) { printf("Resolving from postsolved model\n"); clp->primal(1); numberIterations += clp->numberIterations(); } } // put back solution double * rowDual = (double *) ekk_rowduals(model); int numberRows = ekk_getInumrows(model); int numberColumns = ekk_getInumcols(model); int * rowStatus = (int *) ekk_rowstat(model); double * rowSolution = (double *) ekk_rowacts(model); int i; int * columnStatus = (int *) ekk_colstat(model); double * columnSolution = (double *) ekk_colsol(model); memcpy(rowSolution, clp->primalRowSolution(), numberRows * sizeof(double)); memcpy(rowDual, clp->dualRowSolution(), numberRows * sizeof(double)); for (i = 0; i < numberRows; i++) { if (clp->getRowStatus(i) == ClpSimplex::basic) rowStatus[i] = 0x80000000; else rowStatus[i] = 0; } double * columnDual = (double *) ekk_colrcosts(model); memcpy(columnSolution, clp->primalColumnSolution(), numberColumns * sizeof(double)); memcpy(columnDual, clp->dualColumnSolution(), numberColumns * sizeof(double)); for (i = 0; i < numberColumns; i++) { if (clp->getColumnStatus(i) == ClpSimplex::basic) columnStatus[i] = 0x80000000; else columnStatus[i] = 0; } ekk_setIprobstat(model, clp->status()); ekk_setRobjvalue(model, clp->objectiveValue()); ekk_setInumpinf(model, clp->numberPrimalInfeasibilities()); ekk_setInumdinf(model, clp->numberDualInfeasibilities()); ekk_setIiternum(model, numberIterations); ekk_setRsumpinf(model, clp->sumPrimalInfeasibilities()); ekk_setRsumdinf(model, clp->sumDualInfeasibilities()); delete clp; if (compressInfo) ekk_decompressModel(model, compressInfo); if (scaled) ekk_scaleRim(model, 2); return 0; } /* As ekk_primalSimplex + postsolve instructions: presolve - 0 , no presolve, 1 presolve but no primal after postsolve, 2 do primal if any infeasibilities, 3 always do primal. */ extern "C" int ekk_primalClp(EKKModel * model, int startup, int presolve) { if (presolveInfo) { if (!presolve) presolve = 3; return solve(model, startup, 1, presolve); } else { return solve(model, startup, 1, 0); } } /* As ekk_dualSimplex + postsolve instructions: presolve - 0 , no presolve, 1 presolve but no primal after postsolve, 2 do primal if any infeasibilities, 3 always do primal. */ extern "C" int ekk_dualClp(EKKModel * model, int presolve) { if (presolveInfo) { if (!presolve) presolve = 3; return solve(model, 0, -1, presolve); } else { return solve(model, 0, -1, 0); } } /* rather like ekk_preSolve (3) plus: keepIntegers - false to treat as if continuous pass - do this many passes (0==default(5)) returns 1 if infeasible */ extern "C" int ekk_preSolveClp(EKKModel * model, bool keepIntegers, int pass) { delete presolveInfo; presolveInfo = new ClpPresolve(); bool scaled = ekk_scaling(model) == 1; if (scaled) ekk_scaleRim(model, 1); if (!pass) pass = 5; // very wasteful - create a clp copy of osl model // 1 to keep solution as is ClpSimplex * clp = clpmodel(model, 1); // could get round with tailored version of ClpPresolve.cpp ClpSimplex * newModel = presolveInfo->presolvedModel(*clp, ekk_getRtolpinf(model), keepIntegers, pass, true); delete clp; presolveInfo->setOriginalModel(NULL); if (scaled) ekk_scaleRim(model, 2); if (newModel) { return 0; } else { delete presolveInfo; presolveInfo = NULL; return 1; } } CoinMP-1.8.3/Clp/examples/pdco.cpp0000644000175000017500000000427612131041005015275 0ustar renerene/* $Id: pdco.cpp 1938 2013-04-09 16:29:57Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // It also tests pdco // This reads a network problem created by netgen which can be // downloaded from www.netlib.org/lp/generators/netgen // This is a generator due to Darwin Klingman #include "ClpInterior.hpp" #include "myPdco.hpp" #include #include #include // easy way to allow compiling all sources for this example within one file, // so no need to do something special in Makefile #include "myPdco.cpp" int main(int argc, const char *argv[]) { // Get model in some way ClpInterior model; // Open graph and parameter files //FILE *fpin = fopen("./g.graph","r"); //FILE *fpp = fopen("./gparm","r"); FILE *fpin = fopen("./g.tiny", "r"); FILE *fpp = fopen("./gparm.tiny", "r"); assert(fpin); assert(fpp); myPdco stuff(model, fpin, fpp); Info info; Outfo outfo; Options options; /* * Set the input parameters for LSQR. */ options.gamma = stuff.getD1(); options.delta = stuff.getD2(); options.MaxIter = 40; options.FeaTol = 5.0e-4; options.OptTol = 5.0e-4; options.StepTol = 0.99; // options.x0min = 10.0/num_cols; options.x0min = 0.01; options.z0min = 0.01; options.mu0 = 1.0e-6; options.LSmethod = 3; // 1=Cholesky 2=QR 3=LSQR options.LSproblem = 1; // See below options.LSQRMaxIter = 999; options.LSQRatol1 = 1.0e-3; // Initial atol options.LSQRatol2 = 1.0e-6; // Smallest atol (unless atol1 is smaller) options.LSQRconlim = 1.0e12; info.atolmin = options.LSQRatol2; info.LSdamp = 0.0; // These are already set? model.xsize_ = 50.0 / (model.numberColumns()); model.xsize_ = CoinMin(1.0, model.xsize_); /* * Solve the test problem */ model.pdco(&stuff, options, info, outfo); /* * Examine the results. * Print the residual norms RNORM and ARNORM given by LSQR, and then compute */ return 0; } CoinMP-1.8.3/Clp/examples/minimum.cpp0000644000175000017500000000142012130613567016030 0ustar renerene/* $Id: minimum.cpp 1935 2013-04-08 19:16:07Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpSimplex.hpp" int main(int argc, const char *argv[]) { ClpSimplex model; int status; if (argc < 2) { #if defined(SAMPLEDIR) /* SAMPLEDIR should "path/to/Data/Sample" Include the quotes and final path separator. */ status = model.readMps(SAMPLEDIR "/p0033.mps", true); #else fprintf(stderr, "Do not know where to find sample MPS files.\n"); exit(1); #endif } else status = model.readMps(argv[1]); if (!status) { model.primal(); } return 0; } CoinMP-1.8.3/Clp/examples/modify.cpp0000644000175000017500000000541011510657150015644 0ustar renerene/* $Id: modify.cpp 1662 2011-01-04 17:52:40Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* This example shows the creation of a model from arrays, solution and then changes to objective and adding a row */ #include "ClpSimplex.hpp" #include "CoinHelperFunctions.hpp" int main(int argc, const char *argv[]) { ClpSimplex model; // model is as exmip1.mps from Data/samples int numberRows = 5; int numberColumns = 8; int numberElements = 14; // matrix data - column ordered CoinBigIndex start[9] = {0, 2, 4, 6, 8, 10, 11, 12, 14}; int length[8] = {2, 2, 2, 2, 2, 1, 1, 2}; int rows[14] = {0, 4, 0, 1, 1, 2, 0, 3, 0, 4, 2, 3, 0, 4}; double elements[14] = {3, 5.6, 1, 2, 1.1, 1, -2, 2.8, -1, 1, 1, -1.2, -1, 1.9}; CoinPackedMatrix matrix(true, numberRows, numberColumns, numberElements, elements, rows, start, length); // rim data double objective[8] = {1, 0, 0, 0, 2, 0, 0, -1}; double rowLower[5] = {2.5, -COIN_DBL_MAX, 4, 1.8, 3}; double rowUpper[5] = {COIN_DBL_MAX, 2.1, 4, 5, 15}; double colLower[8] = {2.5, 0, 0, 0, 0.5, 0, 0, 0}; double colUpper[8] = {COIN_DBL_MAX, 4.1, 1, 1, 4, COIN_DBL_MAX, COIN_DBL_MAX, 4.3}; // load problem model.loadProblem(matrix, colLower, colUpper, objective, rowLower, rowUpper); // mark integer (really for Cbc/examples/modify.cpp model.setInteger(2); model.setInteger(3); // Solve model.initialSolve(); // Solution const double * solution = model.primalColumnSolution(); int i; for (i = 0; i < numberColumns; i++) if (solution[i]) printf("Column %d has value %g\n", i, solution[i]); // Change objective double * objective2 = model.objective(); objective2[0] = -100.0; // Solve - primal as primal feasible model.primal(1); // Solution (array won't have changed) for (i = 0; i < numberColumns; i++) if (solution[i]) printf("Column %d has value %g\n", i, solution[i]); // Add constraint int column[8] = {0, 1, 2, 3, 4, 5, 6, 7}; double element2[8] = {1, 1, 1, 1, 1, 1, 1, 1}; model.addRow(8, column, element2, 7.8, COIN_DBL_MAX); // Solve - dual as dual feasible model.dual(); /* Solution This time we have changed arrays of solver so - array won't have changed as column array and we added a row - but be on safe side */ solution = model.primalColumnSolution(); for (i = 0; i < numberColumns; i++) if (solution[i]) printf("Column %d has value %g\n", i, solution[i]); return 0; } CoinMP-1.8.3/Clp/examples/piece.cpp0000644000175000017500000002451112130613567015450 0ustar renerene/* $Id: piece.cpp 1935 2013-04-08 19:16:07Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* This simple example takes a matrix read in by CoinMpsIo, deletes every second column and solves the resulting problem */ #include "ClpSimplex.hpp" #include "ClpNonLinearCost.hpp" #include "CoinMpsIO.hpp" #include int main(int argc, const char *argv[]) { int status; CoinMpsIO m; if (argc < 2) status = m.readMps("model1.mps", ""); else status = m.readMps(argv[1], ""); if (status) { fprintf(stdout, "Bad readMps %s\n", argv[1]); exit(1); } // Load up model1 - so we can use known good solution ClpSimplex model1; model1.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); model1.dual(); // Get data arrays const CoinPackedMatrix * matrix1 = m.getMatrixByCol(); const int * start1 = matrix1->getVectorStarts(); const int * length1 = matrix1->getVectorLengths(); const int * row1 = matrix1->getIndices(); const double * element1 = matrix1->getElements(); const double * columnLower1 = m.getColLower(); const double * columnUpper1 = m.getColUpper(); const double * rowLower1 = m.getRowLower(); const double * rowUpper1 = m.getRowUpper(); const double * objective1 = m.getObjCoefficients(); int numberColumns = m.getNumCols(); int numberRows = m.getNumRows(); int numberElements = m.getNumElements(); // Get new arrays int numberColumns2 = (numberColumns + 1); int * start2 = new int[numberColumns2+1]; int * row2 = new int[numberElements]; double * element2 = new double[numberElements]; int * segstart = new int[numberColumns+1]; double * breakpt = new double[2*numberColumns]; double * slope = new double[2*numberColumns]; double * objective2 = new double[numberColumns2]; double * columnLower2 = new double[numberColumns2]; double * columnUpper2 = new double[numberColumns2]; double * rowLower2 = new double[numberRows]; double * rowUpper2 = new double[numberRows]; // We need to modify rhs memcpy(rowLower2, rowLower1, numberRows * sizeof(double)); memcpy(rowUpper2, rowUpper1, numberRows * sizeof(double)); double objectiveOffset = 0.0; // For new solution double * newSolution = new double [numberColumns]; const double * oldSolution = model1.primalColumnSolution(); int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) printf("%g ", oldSolution[iColumn]); printf("\n"); numberColumns2 = 0; numberElements = 0; start2[0] = 0; int segptr = 0; segstart[0] = 0; // Now check for duplicates for (iColumn = 0; iColumn < numberColumns; iColumn++) { // test if column identical to next column bool ifcopy = 1; if (iColumn < numberColumns - 1) { int joff = length1[iColumn]; for (int j = start1[iColumn]; j < start1[iColumn] + length1[iColumn]; j++) { if (row1[j] != row1[j+joff]) { ifcopy = 0; break; } if (element1[j] != element1[j+joff]) { ifcopy = 0; break; } } } else { ifcopy = 0; } //if (iColumn>47||iColumn<45) //ifcopy=0; if (ifcopy) { double lo1 = columnLower1[iColumn]; double up1 = columnUpper1[iColumn]; double obj1 = objective1[iColumn]; double sol1 = oldSolution[iColumn]; double lo2 = columnLower1[iColumn+1]; double up2 = columnUpper1[iColumn+1]; double obj2 = objective1[iColumn+1]; double sol2 = oldSolution[iColumn+1]; if (fabs(up1 - lo2) > 1.0e-8) { // try other way double temp; temp = lo1; lo1 = lo2; lo2 = temp; temp = up1; up1 = up2; up2 = temp; temp = obj1; obj1 = obj2; obj2 = temp; temp = sol1; sol1 = sol2; sol2 = temp; assert(fabs(up1 - lo2) < 1.0e-8); } // subtract out from rhs double fixed = up1; // do offset objectiveOffset += fixed * obj2; for (int j = start1[iColumn]; j < start1[iColumn] + length1[iColumn]; j++) { int iRow = row1[j]; double value = element1[j]; if (rowLower2[iRow] > -1.0e30) rowLower2[iRow] -= value * fixed; if (rowUpper2[iRow] < 1.0e30) rowUpper2[iRow] -= value * fixed; } newSolution[numberColumns2] = fixed; if (fabs(sol1 - fixed) > 1.0e-8) newSolution[numberColumns2] = sol1; if (fabs(sol2 - fixed) > 1.0e-8) newSolution[numberColumns2] = sol2; columnLower2[numberColumns2] = lo1; columnUpper2[numberColumns2] = up2; objective2[numberColumns2] = 0.0; breakpt[segptr] = lo1; slope[segptr++] = obj1; breakpt[segptr] = lo2; slope[segptr++] = obj2; for (int j = start1[iColumn]; j < start1[iColumn] + length1[iColumn]; j++) { row2[numberElements] = row1[j]; element2[numberElements++] = element1[j]; } start2[++numberColumns2] = numberElements; breakpt[segptr] = up2; slope[segptr++] = COIN_DBL_MAX; segstart[numberColumns2] = segptr; iColumn++; // skip next column } else { // normal column columnLower2[numberColumns2] = columnLower1[iColumn]; columnUpper2[numberColumns2] = columnUpper1[iColumn]; objective2[numberColumns2] = objective1[iColumn]; breakpt[segptr] = columnLower1[iColumn]; slope[segptr++] = objective1[iColumn]; for (int j = start1[iColumn]; j < start1[iColumn] + length1[iColumn]; j++) { row2[numberElements] = row1[j]; element2[numberElements++] = element1[j]; } newSolution[numberColumns2] = oldSolution[iColumn]; start2[++numberColumns2] = numberElements; breakpt[segptr] = columnUpper1[iColumn]; slope[segptr++] = COIN_DBL_MAX; segstart[numberColumns2] = segptr; } } // print new number of columns, elements printf("New number of columns = %d\n", numberColumns2); printf("New number of elements = %d\n", numberElements); printf("Objective offset is %g\n", objectiveOffset); ClpSimplex model; // load up model.loadProblem(numberColumns2, numberRows, start2, row2, element2, columnLower2, columnUpper2, objective2, rowLower2, rowUpper2); model.scaling(0); model.setDblParam(ClpObjOffset, -objectiveOffset); // Create nonlinear objective int returnCode = model.createPiecewiseLinearCosts(segstart, breakpt, slope); if( returnCode != 0 ) { printf("Unexpected return code %d from model.createPiecewiseLinearCosts()\n", returnCode); return returnCode; } // delete delete [] segstart; delete [] breakpt; delete [] slope; delete [] start2; delete [] row2 ; delete [] element2; delete [] objective2; delete [] columnLower2; delete [] columnUpper2; delete [] rowLower2; delete [] rowUpper2; // copy in solution - (should be optimal) model.allSlackBasis(); memcpy(model.primalColumnSolution(), newSolution, numberColumns2 * sizeof(double)); //memcpy(model.columnLower(),newSolution,numberColumns2*sizeof(double)); //memcpy(model.columnUpper(),newSolution,numberColumns2*sizeof(double)); delete [] newSolution; //model.setLogLevel(63); const double * solution = model.primalColumnSolution(); double * saveSol = new double[numberColumns2]; memcpy(saveSol, solution, numberColumns2 * sizeof(double)); for (iColumn = 0; iColumn < numberColumns2; iColumn++) printf("%g ", solution[iColumn]); printf("\n"); // solve model.primal(1); for (iColumn = 0; iColumn < numberColumns2; iColumn++) { if (fabs(solution[iColumn] - saveSol[iColumn]) > 1.0e-3) printf(" ** was %g ", saveSol[iColumn]); printf("%g ", solution[iColumn]); } printf("\n"); model.primal(1); for (iColumn = 0; iColumn < numberColumns2; iColumn++) { if (fabs(solution[iColumn] - saveSol[iColumn]) > 1.0e-3) printf(" ** was %g ", saveSol[iColumn]); printf("%g ", solution[iColumn]); } printf("\n"); model.primal(); for (iColumn = 0; iColumn < numberColumns2; iColumn++) { if (fabs(solution[iColumn] - saveSol[iColumn]) > 1.0e-3) printf(" ** was %g ", saveSol[iColumn]); printf("%g ", solution[iColumn]); } printf("\n"); model.allSlackBasis(); for (iColumn = 0; iColumn < numberColumns2; iColumn++) { if (fabs(solution[iColumn] - saveSol[iColumn]) > 1.0e-3) printf(" ** was %g ", saveSol[iColumn]); printf("%g ", solution[iColumn]); } printf("\n"); model.setLogLevel(63); model.primal(); for (iColumn = 0; iColumn < numberColumns2; iColumn++) { if (fabs(solution[iColumn] - saveSol[iColumn]) > 1.0e-3) printf(" ** was %g ", saveSol[iColumn]); printf("%g ", solution[iColumn]); } printf("\n"); return 0; } CoinMP-1.8.3/Clp/MSVisualStudio/0000755000175000017500000000000012600453455014731 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/0000755000175000017500000000000012600453455015267 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/clp/0000755000175000017500000000000012600453455016045 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/clp/clp.vcproj0000644000175000017500000003631512323254507020057 0ustar renerene CoinMP-1.8.3/Clp/MSVisualStudio/v9/ClpExamplesTestQP/0000755000175000017500000000000012600453455020605 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/ClpExamplesTestQP/ClpExamplesTestQP.vcproj0000644000175000017500000001317511475602445025363 0ustar renerene CoinMP-1.8.3/Clp/MSVisualStudio/v9/ClpExamplesTestBarrier/0000755000175000017500000000000012600453455021653 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/ClpExamplesTestBarrier/ClpExamplesTestBarrier.vcproj0000644000175000017500000001333011475602445027470 0ustar renerene CoinMP-1.8.3/Clp/MSVisualStudio/v9/ClpExamplesMinimum/0000755000175000017500000000000012600453455021040 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/ClpExamplesMinimum/ClpExamplesMinimum.vcproj0000644000175000017500000001320711475602445026045 0ustar renerene CoinMP-1.8.3/Clp/MSVisualStudio/v9/Clp.sln0000644000175000017500000002124011475602445016526 0ustar renereneMicrosoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClpExamplesMinimum", "ClpExamplesMinimum\ClpExamplesMinimum.vcproj", "{C23C220A-5EF9-4C87-93E9-31472E684D6A}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClpExamplesTestBarrier", "ClpExamplesTestBarrier\ClpExamplesTestBarrier.vcproj", "{F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClpExamplesTestQP", "ClpExamplesTestQP\ClpExamplesTestQP.vcproj", "{E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clp", "clp\clp.vcproj", "{0E9135A7-CB30-48D9-A83D-0F49EC3B601B}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libClp", "libClp\libClp.vcproj", "{4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v9\libCoinUtils\libCoinUtils.vcproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiClp", "libOsiClp\libOsiClp.vcproj", "{02D45875-A8CF-41B9-990B-3699C0ECFE10}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiClpUnitTest", "OsiClpUnitTest\OsiClpUnitTest.vcproj", "{70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} {109D6E6F-6D91-460F-86AE-DF27400E09A9} = {109D6E6F-6D91-460F-86AE-DF27400E09A9} {02D45875-A8CF-41B9-990B-3699C0ECFE10} = {02D45875-A8CF-41B9-990B-3699C0ECFE10} {7D98E2CB-876E-4F75-9F71-77D3FE87E149} = {7D98E2CB-876E-4F75-9F71-77D3FE87E149} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "..\..\..\Osi\MSVisualStudio\v9\libOsi\libOsi.vcproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "..\..\..\Osi\MSVisualStudio\v9\libOsiCommonTest\libOsiCommonTest.vcproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Debug|Win32.ActiveCfg = Debug|Win32 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Debug|x64.ActiveCfg = Debug|Win32 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Release|Win32.ActiveCfg = Release|Win32 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Release|x64.ActiveCfg = Release|Win32 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Debug|Win32.ActiveCfg = Debug|Win32 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Debug|x64.ActiveCfg = Debug|Win32 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Release|Win32.ActiveCfg = Release|Win32 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Release|x64.ActiveCfg = Release|Win32 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Debug|Win32.ActiveCfg = Debug|Win32 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Debug|x64.ActiveCfg = Debug|Win32 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Release|Win32.ActiveCfg = Release|Win32 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Release|x64.ActiveCfg = Release|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Debug|Win32.ActiveCfg = Debug|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Debug|Win32.Build.0 = Debug|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Debug|x64.ActiveCfg = Debug|x64 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Debug|x64.Build.0 = Debug|x64 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Release|Win32.ActiveCfg = Release|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Release|Win32.Build.0 = Release|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Release|x64.ActiveCfg = Release|x64 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Release|x64.Build.0 = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.Build.0 = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.ActiveCfg = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.Build.0 = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.Build.0 = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.ActiveCfg = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.Build.0 = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.ActiveCfg = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.Build.0 = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.Build.0 = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.ActiveCfg = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.Build.0 = Release|x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Debug|Win32.ActiveCfg = Debug|Win32 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Debug|Win32.Build.0 = Debug|Win32 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Debug|x64.ActiveCfg = Debug|x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Debug|x64.Build.0 = Debug|x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Release|Win32.ActiveCfg = Release|Win32 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Release|Win32.Build.0 = Release|Win32 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Release|x64.ActiveCfg = Release|x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Release|x64.Build.0 = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Clp/MSVisualStudio/v9/OsiClpUnitTest/0000755000175000017500000000000012600453455020160 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/OsiClpUnitTest/OsiClpUnitTest.vcproj0000644000175000017500000002043111475602445024302 0ustar renerene CoinMP-1.8.3/Clp/MSVisualStudio/v9/libOsiClp/0000755000175000017500000000000012600453455017147 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/libOsiClp/libOsiClp.vcproj0000644000175000017500000001721111562355604022261 0ustar renerene CoinMP-1.8.3/Clp/MSVisualStudio/v9/libClp/0000755000175000017500000000000012600453455016474 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v9/libClp/libClp.vcproj0000644000175000017500000015644411654750131021143 0ustar renerene CoinMP-1.8.3/Clp/MSVisualStudio/v10/0000755000175000017500000000000012600453455015337 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v10/clp/0000755000175000017500000000000012600453455016115 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v10/clp/clp.vcxproj0000644000175000017500000005733212542032201020305 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B} clp Application v120 Application v120 Application v120 Application v120 <_ProjectFileVersion>10.0.30319.1 false false false false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset .\Debug/clp.tlb ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CLP_BUILD;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;COIN_MSVS;%(PreprocessorDefinitions) EditAndContinue _DEBUG;%(PreprocessorDefinitions) 0x0409 true true Console false MachineX86 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false X64 .\Debug/clp.tlb ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CLP_BUILD;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;COIN_MSVS;%(PreprocessorDefinitions) ProgramDatabase _DEBUG;%(PreprocessorDefinitions) 0x0409 true true Console false MachineX64 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Release/clp.tlb ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CLP_BUILD;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;COIN_MSVS;%(PreprocessorDefinitions) true NDEBUG;%(PreprocessorDefinitions) 0x0409 true Console false MachineX86 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false X64 .\Release/clp.tlb ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CLP_BUILD;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;COIN_MSVS;%(PreprocessorDefinitions) NDEBUG;%(PreprocessorDefinitions) 0x0409 true Console false MachineX64 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) CoinMP-1.8.3/Clp/MSVisualStudio/v10/ClpExamplesTestQP/0000755000175000017500000000000012600453455020655 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v10/ClpExamplesTestQP/ClpExamplesTestQP.vcxproj0000644000175000017500000004401112101652412025576 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613} Application false MultiByte Application false MultiByte Application false MultiByte Application false MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false $(SolutionDir)$(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset .\Debug/ClpExamplesTestQP.tlb Disabled ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true EditAndContinue Default _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true true .\Debug/ClpExamplesTestQP.pdb Console false MachineX86 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Debug/ClpExamplesTestQP.tlb Disabled ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true ProgramDatabase Default _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true true .\Debug/ClpExamplesTestQP.pdb Console false $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Release/ClpExamplesTestQP.tlb MaxSpeed OnlyExplicitInline ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) true MultiThreadedDLL true true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true .\Release/ClpExamplesTestQP.pdb Console false MachineX86 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Release/ClpExamplesTestQP.tlb MaxSpeed OnlyExplicitInline ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) true MultiThreadedDLL true true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true .\Release/ClpExamplesTestQP.pdb Console false $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false Disabled Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) %(PreprocessorDefinitions) EnableFastChecks EnableFastChecks MaxSpeed MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) %(PreprocessorDefinitions) {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false CoinMP-1.8.3/Clp/MSVisualStudio/v10/ClpExamplesTestBarrier/0000755000175000017500000000000012600453455021723 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v10/ClpExamplesTestBarrier/ClpExamplesTestBarrier.vcxproj0000644000175000017500000004416012101652412027717 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4} ClpExamplesTestBarrier Application false MultiByte Application false MultiByte Application false MultiByte Application false MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false $(SolutionDir)$(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset .\Release/ClpExamplesTestBarrier.tlb MaxSpeed OnlyExplicitInline ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) true MultiThreadedDLL true true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true .\Release/ClpExamplesTestBarrier.pdb Console false MachineX86 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Release/ClpExamplesTestBarrier.tlb MaxSpeed OnlyExplicitInline ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) true MultiThreadedDLL true true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true .\Release/ClpExamplesTestBarrier.pdb Console false $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Debug/ClpExamplesTestBarrier.tlb Disabled ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true EditAndContinue Default _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true true .\Debug/ClpExamplesTestBarrier.pdb Console false MachineX86 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Debug/ClpExamplesTestBarrier.tlb Disabled ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true ProgramDatabase Default _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true true .\Debug/ClpExamplesTestBarrier.pdb Console false $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false Disabled Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) %(PreprocessorDefinitions) EnableFastChecks EnableFastChecks MaxSpeed MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) %(PreprocessorDefinitions) {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false CoinMP-1.8.3/Clp/MSVisualStudio/v10/ClpExamplesMinimum/0000755000175000017500000000000012600453455021110 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v10/ClpExamplesMinimum/ClpExamplesMinimum.vcxproj0000644000175000017500000004402212101652412026266 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {C23C220A-5EF9-4C87-93E9-31472E684D6A} Application false MultiByte Application false MultiByte Application false MultiByte Application false MultiByte <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false $(SolutionDir)$(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset .\Debug/ClpExamplesMinimum.tlb Disabled ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true EditAndContinue Default _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true true .\Debug/ClpExamplesMinimum.pdb Console false MachineX86 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Debug/ClpExamplesMinimum.tlb Disabled ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true ProgramDatabase Default _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true true .\Debug/ClpExamplesMinimum.pdb Console false $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Release/ClpExamplesMinimum.tlb MaxSpeed OnlyExplicitInline ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) true MultiThreadedDLL true true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true .\Release/ClpExamplesMinimum.pdb Console false MachineX86 $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false .\Release/ClpExamplesMinimum.tlb MaxSpeed OnlyExplicitInline ..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;SAMPLEDIR="..\\..\\..\\..\\Data\\Sample\\\";%(PreprocessorDefinitions) true MultiThreadedDLL true true $(IntDir)$(TargetName).pch $(IntDir) $(IntDir) $(IntDir)vc$(PlatformToolsetVersion).pdb Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true .\Release/ClpExamplesMinimum.pdb Console false $(OutDir);%(AdditionalLibraryDirectories) libCoinUtils.lib;libClp.lib;%(AdditionalDependencies) false Disabled Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) %(PreprocessorDefinitions) EnableFastChecks EnableFastChecks MaxSpeed MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) %(PreprocessorDefinitions) {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false CoinMP-1.8.3/Clp/MSVisualStudio/v10/Clp.sln0000644000175000017500000002060011616026445016572 0ustar renereneMicrosoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClpExamplesMinimum", "ClpExamplesMinimum\ClpExamplesMinimum.vcxproj", "{C23C220A-5EF9-4C87-93E9-31472E684D6A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClpExamplesTestBarrier", "ClpExamplesTestBarrier\ClpExamplesTestBarrier.vcxproj", "{F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClpExamplesTestQP", "ClpExamplesTestQP\ClpExamplesTestQP.vcxproj", "{E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clp", "clp\clp.vcxproj", "{0E9135A7-CB30-48D9-A83D-0F49EC3B601B}" ProjectSection(ProjectDependencies) = postProject {C4867F15-438D-4FF8-8388-62FBAAA9786C} = {C4867F15-438D-4FF8-8388-62FBAAA9786C} {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} = {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libClp", "libClp\libClp.vcxproj", "{4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v10\libCoinUtils\libCoinUtils.vcxproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiClp", "libOsiClp\libOsiClp.vcxproj", "{02D45875-A8CF-41B9-990B-3699C0ECFE10}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiClpUnitTest", "OsiClpUnitTest\OsiClpUnitTest.vcxproj", "{70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "..\..\..\Osi\MSVisualStudio\v10\libOsi\libOsi.vcxproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "..\..\..\Osi\MSVisualStudio\v10\libOsiCommonTest\libOsiCommonTest.vcxproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Debug|Win32.ActiveCfg = Debug|Win32 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Debug|Win32.Build.0 = Debug|Win32 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Debug|x64.ActiveCfg = Debug|x64 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Debug|x64.Build.0 = Debug|x64 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Release|Win32.ActiveCfg = Release|Win32 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Release|Win32.Build.0 = Release|Win32 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Release|x64.ActiveCfg = Release|x64 {C23C220A-5EF9-4C87-93E9-31472E684D6A}.Release|x64.Build.0 = Release|x64 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Debug|Win32.ActiveCfg = Debug|Win32 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Debug|Win32.Build.0 = Debug|Win32 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Debug|x64.ActiveCfg = Debug|x64 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Debug|x64.Build.0 = Debug|x64 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Release|Win32.ActiveCfg = Release|Win32 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Release|Win32.Build.0 = Release|Win32 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Release|x64.ActiveCfg = Release|x64 {F6DD73C8-6714-414E-9A98-D51F6D6AD9B4}.Release|x64.Build.0 = Release|x64 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Debug|Win32.ActiveCfg = Debug|Win32 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Debug|Win32.Build.0 = Debug|Win32 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Debug|x64.ActiveCfg = Debug|x64 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Debug|x64.Build.0 = Debug|x64 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Release|Win32.ActiveCfg = Release|Win32 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Release|Win32.Build.0 = Release|Win32 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Release|x64.ActiveCfg = Release|x64 {E7EA8BD6-D2AA-40F0-9F0E-42A339DCF613}.Release|x64.Build.0 = Release|x64 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Debug|Win32.ActiveCfg = Debug|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Debug|Win32.Build.0 = Debug|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Debug|x64.ActiveCfg = Debug|x64 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Debug|x64.Build.0 = Debug|x64 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Release|Win32.ActiveCfg = Release|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Release|Win32.Build.0 = Release|Win32 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Release|x64.ActiveCfg = Release|x64 {0E9135A7-CB30-48D9-A83D-0F49EC3B601B}.Release|x64.Build.0 = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.ActiveCfg = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|Win32.Build.0 = Debug|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.ActiveCfg = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Debug|x64.Build.0 = Debug|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.ActiveCfg = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|Win32.Build.0 = Release|Win32 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.ActiveCfg = Release|x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994}.Release|x64.Build.0 = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.ActiveCfg = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|Win32.Build.0 = Debug|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.ActiveCfg = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Debug|x64.Build.0 = Debug|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.ActiveCfg = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|Win32.Build.0 = Release|Win32 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.ActiveCfg = Release|x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10}.Release|x64.Build.0 = Release|x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Debug|Win32.ActiveCfg = Debug|Win32 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Debug|Win32.Build.0 = Debug|Win32 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Debug|x64.ActiveCfg = Debug|x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Debug|x64.Build.0 = Debug|x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Release|Win32.ActiveCfg = Release|Win32 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Release|Win32.Build.0 = Release|Win32 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Release|x64.ActiveCfg = Release|x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7}.Release|x64.Build.0 = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal CoinMP-1.8.3/Clp/MSVisualStudio/v10/OsiClpUnitTest/0000755000175000017500000000000012600453455020230 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v10/OsiClpUnitTest/OsiClpUnitTest.vcxproj0000644000175000017500000003267712101652412024543 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {70730B26-9A00-4C1D-8AD2-ECE43B8F96A7} OsiClpUnitTest Win32Proj Application Unicode false Application Unicode Application Unicode false Application Unicode <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset Disabled ..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;_DEBUG;_CONSOLE;COIN_MSVS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 EditAndContinue libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;libClp.lib;libOsiClp.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Console MachineX86 false X64 Disabled ..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;COIN_MSVS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL Level3 ProgramDatabase libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;libClp.lib;libOsiClp.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Console MachineX64 false MaxSpeed true ..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;NDEBUG;_CONSOLE;COIN_MSVS;%(PreprocessorDefinitions) MultiThreadedDLL true Level3 ProgramDatabase libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;libClp.lib;libOsiClp.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Console true true MachineX86 false X64 MaxSpeed true ..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Osi\src\Osi;..\..\..\..\Osi\src\OsiCommonTest;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;COIN_MSVS;%(PreprocessorDefinitions) MultiThreadedDLL true Level3 ProgramDatabase libCoinUtils.lib;libOsi.lib;libOsiCommonTest.lib;libClp.lib;libOsiClp.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Console true true MachineX64 false {c4867f15-438d-4ff8-8388-62fbaaa9786c} false {109d6e6f-6d91-460f-86ae-df27400e09a9} false {7d98e2cb-876e-4f75-9f71-77d3fe87e149} false {4f8f7d1c-3a9e-444d-8ee9-77f33fa05994} false {02d45875-a8cf-41b9-990b-3699c0ecfe10} false CoinMP-1.8.3/Clp/MSVisualStudio/v10/libOsiClp/0000755000175000017500000000000012600453455017217 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v10/libOsiClp/libOsiClp.vcxproj0000644000175000017500000002254012542032201022502 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {02D45875-A8CF-41B9-990B-3699C0ECFE10} libOsiClp StaticLibrary v120 StaticLibrary v120 StaticLibrary v120 StaticLibrary v120 <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) _DEBUG;%(PreprocessorDefinitions) 0x0409 ..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 X64 ..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks ProgramDatabase Default _DEBUG;%(PreprocessorDefinitions) 0x0409 X64 Default ..\..\..\..\Clp\src;..\..\..\..\Clp\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Osi\src\Osi;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) OSI_BUILD;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) Default NDEBUG;%(PreprocessorDefinitions) 0x0409 CoinMP-1.8.3/Clp/MSVisualStudio/v10/libClp/0000755000175000017500000000000012600453455016544 5ustar renereneCoinMP-1.8.3/Clp/MSVisualStudio/v10/libClp/libClp.vcxproj0000644000175000017500000027376612542032201021376 0ustar renerene Debug Win32 Debug x64 Release Win32 Release x64 {4F8F7D1C-3A9E-444D-8EE9-77F33FA05994} libClp StaticLibrary v120 StaticLibrary v120 StaticLibrary v120 StaticLibrary v120 <_ProjectFileVersion>10.0.30319.1 AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CLP_BUILD;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) _DEBUG;%(PreprocessorDefinitions) 0x0409 true ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CLP_BUILD;WIN32;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true true NDEBUG;%(PreprocessorDefinitions) 0x0409 true X64 ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CLP_BUILD;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks ProgramDatabase _DEBUG;%(PreprocessorDefinitions) 0x0409 true X64 Default ..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) CLP_BUILD;WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) NDEBUG;%(PreprocessorDefinitions) 0x0409 true true true true true Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) true true true true Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) true true true true Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) true true true true Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks Disabled %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) EnableFastChecks MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MaxSpeed %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) CoinMP-1.8.3/Clp/Makefile.am0000644000175000017500000000776612477334547014126 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 2122 2015-03-09 15:16:55Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # Subdirectories # ######################################################################## SUBDIRS = src # Don't do src/OsiClp recursively, since src/OsiClp/libOsiClp depends on src/libClp if COIN_HAS_OSI SUBDIRS += src/OsiClp endif # We don't want to compile the test subdirectory, unless the test target is # specified. But we need to list it as subdirectory to make sure that it is # included in the tarball if ALWAYS_FALSE SUBDIRS += test endif ######################################################################## # Additional files to be included in tarball # ######################################################################## # Here we need include all files that are not mentioned in other Makefiles EXTRA_DIST = \ doc/authors.xml \ doc/basicmodelclasses.xml \ doc/clpexe.xml \ doc/clpuserguide.xml \ doc/doxygen.xml \ doc/faqcontent.xml \ doc/faq.xml \ doc/intro.xml \ doc/legal.xml \ doc/messages.xml \ doc/moresamples.xml \ doc/notsobasic.xml \ doc/revhist.xml \ doc/Howto/docbook4clp.xml \ examples/addBits.cpp \ examples/addColumns.cpp \ examples/addRows.cpp \ examples/decompose.cpp \ examples/defaults.cpp \ examples/driver2.cpp \ examples/driverC.c \ examples/driver.cpp \ examples/dualCuts.cpp \ examples/ekk.cpp \ examples/ekk_interface.cpp \ examples/hello.cpp \ examples/hello.mps \ examples/input.130 \ examples/INSTALL \ examples/makeDual.cpp \ examples/Makefile.in \ examples/minimum.cpp \ examples/network.cpp \ examples/piece.cpp \ examples/rowColumn.cpp \ examples/sprint2.cpp \ examples/sprint.cpp \ examples/testBarrier.cpp \ examples/testBasis.cpp \ examples/testGub2.cpp \ examples/testGub.cpp \ examples/testQP.cpp \ examples/useVolume.cpp ######################################################################## # Extra Targets # ######################################################################## test: all cd test; $(MAKE) test unitTest: test # Doxygen documentation doxydoc: doxygen doxydoc/doxygen.conf clean-doxydoc: ( cd doxydoc ; rm -rf html *.log *.tag ) clean-local: clean-doxydoc if test -r test/Makefile; then cd test; $(MAKE) clean; fi distclean-local: if test -r test/Makefile; then cd test; $(MAKE) distclean; fi install-exec-local: install-doc uninstall-local: uninstall-doc .PHONY: test unitTest doxydoc ######################################################################## # Creation of the addlibs file # ######################################################################## pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = clp.pc if COIN_HAS_OSI pkgconfiglib_DATA += osi-clp.pc endif addlibsdir = $(DESTDIR)$(datadir)/coin/doc/Clp install-data-hook: @$(mkdir_p) "$(addlibsdir)" if COIN_HAS_PKGCONFIG PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ $(PKG_CONFIG) --libs clp > $(addlibsdir)/clp_addlibs.txt else if COIN_CXX_IS_CL echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libClpSolver.lib libClp.lib @CLPLIB_LIBS_INSTALLED@" > $(addlibsdir)/clp_addlibs.txt else echo -L@abs_lib_dir@ -lClp @CLPLIB_LIBS_INSTALLED@ > $(addlibsdir)/clp_addlibs.txt endif endif uninstall-hook: rm -f $(addlibsdir)/clp_addlibs.txt ######################################################################## # Maintainer Stuff # ######################################################################## CLEANFILES = # Files that are generated and should be cleaned with make distclean DISTCLEANFILES = include BuildTools/Makemain.inc CoinMP-1.8.3/Clp/depcomp0000755000175000017500000003710011405215425013407 0ustar renerene#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Clp/LICENSE0000644000175000017500000002622711507174377013064 0ustar renereneEclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. CoinMP-1.8.3/Clp/README0000644000175000017500000000403510662211377012721 0ustar renereneNOTE: The information in this file might not yet include the changes introduced with the switch to the autotools. To build Clp see INSTALL file To use Clp you need the Clp and Coin libraries To make standalone executable do 'make Clp' in the Clp directory. This creates an executable clp in Clp/src. To run unitTest do 'make unitTest' in the Clp directory. This will do some minimal testing. To run clp on all netlib problems do 'make unitTest NETLIBDIR=' dirname should be the path to the directory containing all the netlib files. If you have compiled Clp without zlib support then the files must be uncompressed. Running clp gives you some hints. It can do a unit test (clp -unitTest) and solve netlib problems (-netlib or -netlibp using primal). It can also solve problems and set tolerances etc. Just do clp and then try ? or setting various stuff. clp filename reads file, does presolve and dual algorithm clp filename -primalsimplex would use primal instead On Linux clp can do file completion and line editing if it can find history, readline and termcap.. If you want to stress the code you can set various stuff e.g. dantzig pricing and then go into netlib testing. I do not guarantee that it will solve all netlib if you get too creative. For instance using presolve makes netlib solve faster - but pilot87 prefers a large infeasibility weight. So clp -presolve on -dualbound 1.0e10 -netlib works well. There are samples in ./Samples. To create an executable - testit do make DRIVER=minimum to use minimum.cpp or whichever driver you want. A list is in Makefile. Three useful samples are: minimum.cpp This is the simplest possible program to read an mps file. defaults.cpp. This does not do much more, but it does it in much more complicated way by specifically setting defaults so it does give more useful information. It also prints a solution in a format "similar" to that of MPSX. presolve.cpp. This is a good driver for larger problems. Other ones can get complicated so start simple and work your way up. CoinMP-1.8.3/Clp/config.sub0000755000175000017500000007772611405215425014037 0ustar renerene#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-04-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Clp/doc/0000755000175000017500000000000012600453455012603 5ustar renereneCoinMP-1.8.3/Clp/doc/moresamples.xml0000644000175000017500000003664110430454205015657 0ustar renerene More Samples
    CLP's Samples Directory The CLP dsitribution includes a number of .cpp sample files. Users are encouraged to use them as starting points for their own CLP projects. The files can be found in the &clpsamplesdir; directory. For the latest information on compiling and running these samples, please see the file &clpsamplesdir;INSTALL. Below is a list of some of the most useful sample files with a short description for each file. Basic Samples Source file        Description &minimumcpp; This is a CLP "Hello, world" program. It reads a problem from an MPS file, and solves the problem. [More...] &defaultscpp; This is one of the simpler driver programs available. It sets tolerances to defaults and is a good place to find straightforward uses of "set" and "get" methods. It also prints out full MPS-like solutions. [More...] &drivercpp; This is designed to be a file that a user could modify to get a useful driver program for his or her project. In particular, it demonstrates the use of CLP's presolve functionality. [More...] &networkcpp; This shows the use of non-standard matrices and how to load a problem without the use of MPS files. [More...] &testbarriercpp; This is a basic driver file for the barrier method of CLP, similar to &minimumcpp;. The barrier method is not currently addressed in this guide. [More...]
    Advanced Samples Source file        Description &driver2cpp; This sample, in addition to some tasks common to other samples, does some advanced message handling and presolve. &dualcutscpp; This sample implements a method of treating a problem as a collection of cuts. &decomposecpp; This does full Dantzig-Wolfe decomposition. It illustrates the use of many models, adding columns, et cetera. &sprintcpp; This solves a long, thin problem by solving smaller subsets. It is a simplified version of work done by one of the authors on aircrew scheduling problems. It shows the use of two models and their synchronization. A more general version can be found in COIN/Clp/ClpSolve.cpp &sprint2cpp; This is similar to sprint.cpp but is designed for solving large problems with little choice. The idea is that if relatively few variables are fixed, presolve can greatly reduce the problem size so that a series of solves can get close to the optimal solution much faster than would a naïve solve of the full problem.
    The remaining Samples listed here are considered unsupported in that they are of a more esoteric nature and are sometimes contributed as a result of an individual's request. The are to be found in &clpsamplesdir;Contributed. Unsupported Samples Source file        Description &testbasiscpp; This sample takes a problem, changes any inequality constraints to equality constraints, solves the problem, and creates the optimal basis. &testgubcpp; This sample illustrates the use of the GUB ("Generalized Upper Bound") technique. &ekkcpp; This sample can be used to compare CLP and OSL. It uses an additional file in the Samples directory, ekk_interface.cpp. These sample files are not likely to be interesting to new CLP users who do not have experience with OSL. &hellocpp; This sample creates a text-based picture of a matrix on screen (limited to an 80x80 matrix). It's not terribly useful but it does illustrate one way to step through the elements of a matrix. &piececpp; This sample takes a matrix read in by CoinMpsIo (can be used to read in MPS files without a solver), deletes every second column and solves the resulting problem. &usevolumecpp; The Volume Algorithm is another solver available as part of the COIN-OR distribution. This sample shows how to use the Volume Algorithm with CLP.
    minimum.cpp This sample is examined in more detail in .
    defaults.cpp This sample begins by reading an MPS file. The default MPS file is COIN/Mps/Sample/p0033.mps; this can be over-riden by a command-line specification of a (path and) file name). The sample then sets the pivot algorithm to be exact devex. It "gets" the default infeasibility cost and "sets" it to that value (and prints it to standard out). This sort of getting and setting of various parameters constitutes a common theme in this sample, with the purpose of illustrating usage of some of the more common get and set methods available in CLP. At this point the model is solved by the primal method. A sequence of sets, gets and prints is then followed by a number of calls to methods which give specific information about the status of the problem (for example, the code checks that the current solution has been proven to be optimal by assert(model.isProvenOptimal())). Next, a copy of the original model is made. More sets and gets are performed to demonstrate the use of additional options (including the setting of the default message handling as well as changing of the "log level" (amount of output)). The model is solved again a number of times between changes of the optimization direction (i.e. changing from min to max or vice versa). The remaining lines of this sample serve to display solution and problem information in much the same way as is done in driver.cpp.
    driver.cpp This sample begins by reading an MPS file. The default MPS file is COIN/Mps/Sample/p0033.mps; this can be over-riden by a command-line specification of a (path and) file name). A second command-line argument can specify that either the "primal" or "dual" method (or even the "barrier", see below) should be used by CLP. Once the problem has been read, there are two options for how to solve it, one of which must be chosen at compile-time (STYLE1 being defined or not determines this choice). The second manner is more flexible and involves more specific directions being given to CLP, including the ability to specify that the barrier method should be used. At this point in the sample, the problem is solved by CLP, and some basic ouput is generated. If more output is desired, at compile-time, an exit(0) statement must either be removed or commented. There are two levels of additional output, the first of which is suppressed by a #if 0 directive which may be modified at compile-time if desired. This first level of output only involves non-zero columns, whereas the second provides additional information.
    network.cpp This handy sample reads a network problem generated by netgen, converts it to an LP using CLP's network matrix type, and solves. This entirely avoids the use of an MPS file, as the LP is built in memory from the network data file created by netgen. Also, the factorization frequency is changed, and the problem is solved more than once (demonstrating the change of optimization sense as well as switching from dual to primal methods).
    testBarrier.cpp This straightfoward sample begins by reading a problem from an MPS file. It then chooses a Cholesky factorization and solves the problem using the predictor corrector barrier method. It then copies the problem and performs a crossover to a simplex solution in the new copy.
    dualCuts.cpp This sample begins with only the equality constraints of a problem. The inequalities are considered to be part of a pool of available cuts in much the same way as is done in integer programming. However, in this case, the cuts are not "generated", they are simply the inequalities of the problem.
    decompose.cpp More on this sample coming soon!
    driver2.cpp More on this sample coming soon!
    Common CLP Tasks in the Samples Below is a listing of a number of common CLP tasks, such as loading a problem from an MPS file, matched with a list of each Sample file which illustrates the performance of a given task. Contents of the Samples directory CLP Task(s) Method(s) Sample(s) Read problem from MPS file int readMps(const char *filename) &defaultscpp;, &drivercpp;, &minimumcpp; Solve by primal method int primal() &drivercpp; Choose pivot rule void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice) void setDualRowPivotAlgorithm(ClpDualRowPivot &choice) &defaultscpp; Get/set infeasibility cost void setInfeasibilityCost(double value) void setInfeasibilityCost(double value) &defaultscpp; Get string/"double"/integer information bool getStrParam(ClpStrParam key, std::string &value) const bool getDblParam(ClpDblParam key, double &value) const bool getIntParam (ClpIntParam key, int &value) const &defaultscpp; Set maximum number of iterations void setMaximumIterations(int value) &defaultscpp; Check solution status int status() const bool isAbandoned() const bool isProvenOptimal() const bool isProvenPrimalInfeasible() const bool isProvenDualInfeasible() const bool isPrimalObjectiveLimitReached() const bool isDualObjectiveLimitReached() const bool isIterationLimitReached() const
    CoinMP-1.8.3/Clp/doc/clpexe.xml0000644000175000017500000002067610430454205014611 0ustar renerene The CLP Executable
    Quick Start The result of make unitTest (executed in COIN/Clp) is an executable clp as well as the CLP and COIN libraries. The executable can be used to perform various unit tests, but can also be used as a standalone solver. As the executable has a very simple solution file format, the user may wish to modify COIN/Clp/Test/ClpMain.cpp, which contains the source of the executable (modifications could even be offered as a contribution to CLP). The clp executable operates in command line mode or prompted mode. Entering clp will invoke the prompted mode, while clp <filename> will import a problem in MPS format from filename, solve it using the dual simplex method and exit. The command clp <filename> -primalsimplex instructs the executable tp import a file and solve using the primal simplex method. An additional solitary dash ("-") starts the prompt mode once the execution of the initial command has been completed. The "-" is necessary as part of the command; invoking prompt mode as a separate command will result in the loss of problem information related to the initial command. So, the following sequences of commands are equivalent in the sense that both maximize a problem using the dual simplex method and write a solution to file: solfile:
    $ clp filename -maximize -dualsimplex -solution solfile
    $ clp filename -maximize - Clp:duals Clp:solution solfile Clp:quit
    The executable is at a very early stage of development. Comments and suggestions would be appreciated.
    Online Help and Basic Usage The executable has some command-completion functionality as well as some online help. Below is a table with some examples which summarize these capabilities. Command examples for the clp executable Command     Result ? Gives a list of all commands p? Gives a list of all commands which begin with <p>. p?? Gives a list of all commands which begin with <p>., with a short explanation for each. primals?? If is this is enough to uniquely determine a command (in this example, primalS, for primal simplex), a long explanation is given.
    In addition, matching a name without a ? will either execute the command or give the value of the corresponding parameter as follows: primalw will give the current value of the primalWeight parameter while primalw 1.0e7 will change it to 1.0e7.
    A Sample Session Below is a sample CLP executable prompt-mode session. A small problem is loaded and solved under various conditions with the primal and dual simplex methods. Note the use of the allslack command; it sets the basis to all slacks and resets the solution. $clp Coin LP version 0.99.9, build Sep 14 2004 Clp takes input from arguments ( - switches to stdin) Enter ? for list of commands or help Clp:import../Mps/Sample/p0033.mps At line 15 NAME P0033 At line 16 ROWS At line 34 COLUMNS At line 109 RHS At line 118 BOUNDS At line 152 ENDATA Problem P0033 has 16 rows, 33 columns and 98 elements Model was imported from ./../Mps/Sample/p0033.mps in 0 seconds Clp:primals Presolve 15 (-1) rows, 32 (-1) columns and 97 (-1) elements 0 Obj 0 Primal inf 27.2175 (10) Dual inf 6.42094e+11 (32) 32 Obj 2520.57 Optimal - objective value 2520.57 After Postsolve, objective 2520.57, infeasibilities - dual 0 (0), primal 0 (0) Optimal objective 2520.571739 - 32 iterations time 0.012, Presolve 0.01 Clp:max Clp:primals Presolve 11 (-5) rows, 25 (-8) columns and 84 (-14) elements 0 Obj 4807.92 Dual inf 1700.71 (15) End of values pass after 2 iterations 2 Obj 4921.7 Dual inf 580.637 (5) 9 Obj 5299.7 Optimal - objective value 5299.7 After Postsolve, objective 5299.7, infeasibilities - dual 643.608 (9), primal 27.0826 (10) Presolved model was optimal, full model needs cleaning up 0 Obj 5299.7 0 Obj 5299.7 Optimal - objective value 5299.7 Optimal objective 5299.698868 - 9 iterations time 0.022, Presolve 0.02 Clp:allslack Clp:duals Presolve 11 (-5) rows, 25 (-8) columns and 84 (-14) elements 0 Obj 2752 Primal inf 24.4867 (6) Dual inf 4280.55 (25) 8 Obj 5299.7 Optimal - objective value 5299.7 After Postsolve, objective 5299.7, infeasibilities - dual 704.58 (8), primal 27.0792 (10) Presolved model was optimal, full model needs cleaning up 0 Obj 5299.7 0 Obj 5299.7 Optimal - objective value 5299.7 Optimal objective 5299.698868 - 8 iterations time 0.032, Presolve 0.01 Clp:min Clp:duals Presolve 15 (-1) rows, 32 (-1) columns and 97 (-1) elements 0 Obj 5299.7 Dual inf 4632.26 (28) 16 Obj 2520.57 Optimal - objective value 2520.57 After Postsolve, objective 2520.57, infeasibilities - dual 2052.5 (13), primal 27.1143 (10) Presolved model was optimal, full model needs cleaning up 0 Obj 2520.57 0 Obj 2520.57 Optimal - objective value 2520.57 Optimal objective 2520.571739 - 16 iterations time 0.012, Presolve 0.01 Clp:allslack Clp:presolve off Clp:primals 0 Obj 0 Primal inf 27.2175 (10) Dual inf 6.39167e+11 (32) 32 Obj 2520.57 Optimal - objective value 2520.57 Optimal objective 2520.571739 - 32 iterations time 0.002 Clp:allslack Clp:maxIt 10 maxIterations was changed from 99999999 to 10 Clp:primals 0 Obj 0 Primal inf 27.2175 (10) Dual inf 6.39167e+11 (32) Stopped - objective value 4.24664e+10 Stopped objective 4.246637759e+10 - 10 iterations time 0.002 Clp:quit
    CoinMP-1.8.3/Clp/doc/doxygen.xml0000644000175000017500000000121410430454205014771 0ustar renerene Doxygen There is Doxygen content for CLP available online at http://www.coin-or.org/Doxygen/Clp/index.html. A local version of the Doxygen content can be generated from the CLP distribution. To do so, in the directory COIN/Clp, enter make doc. The Doxygen content will be created in the directory COIN/Clp/Doc/html. The same can be done for the COIN core, from the COIN/Coin directory. CoinMP-1.8.3/Clp/doc/messages.xml0000644000175000017500000005556310430454205015143 0ustar renerene Messages Some of the more common messages and codes passed by CLP are listed in the tables below. This is list is not meant to exhaustive. The notation is as for printf from "C": %s is a string %d is an integer %g or %f is a floating point value COIN Messages passed at or above logging level 1 Code Area Text and notes 1 MPSREAD At line %d %s This just prints out NAME line, ROW line, etc 2 MPSREAD Problem %s has %d rows, %d columns and %d elements This gives statistics after reading an MPS file 8 MPSREAD %s read with %d errors This gives error statistics for file 505 PRESOLVE Presolved poblem not optimal, resolve after postsolve This could be because it was not feasible or because of maximum iterations. If this message occurs then consider using primal clean up 506 PRESOLVE Presolve %d (%d) rows, %d (%d) columns and %d (%d) elements The first number is the number after presolve and the number in parentheses is amount of reduction 510 PRESOLVE Presolve is modifying %d integer bounds and re-presolving If presolve determines at the end that an integer variable have its bounds changed then it will repeat the entrire presolve 511 PRESOLVE After Postsolve, objective %g, infeasibilities - dual %g (%d), primal %g (%d) This gives the state after postsolve - this gives the objective value and the sum of dual and primal infeasibilities with the number of infeasibilities in parentheses. Hopefully these should be zero 512 PRESOLVE Presolved model was optimal, full model needs cleaning up If the numbers in previous message (511) were large then maybe we need to know, if small then that's life
    CLP Messages passed at or above logging level 1 Code Area Text and notes 0 SIMPLEX Optimal - objective value %g The only message you want to see 1 SIMPLEX Primal infeasible - objective value %g You may need to look at previous messages or use methods. Such as sumPrimalInfeasibilities() to find cause 2 SIMPLEX Dual infeasible - objective value %g You may need to look at previous messages or use methods. Such as sumDualInfeasibilities() to find cause 3 SIMPLEX Stopped - objective value %g The algorithm stopped as requested by the user. 4 SIMPLEX Stopped due to errors - objective value %g Switch on log level 2 to see information on size of elements etc. If they look reasonable then maybe we need to know. 5 SIMPLEX %d Obj %g Primal inf %g (%d) Dual inf %g (%d) At each re-factorization this gives the number of iterations and the value of the objective function. If there are primal infeasibilities then the sum and number are given and similarly for dual infeasibilities. (This is a simplified form of message.) 14 SIMPLEX Perturbing problem by %g % of %g There is more to this message but if the user sees this then s/he has chosen to perturb the problem or the algorithm has decided to do so. If the numbers look too large the user may wish to think again. 19 SIMPLEX %d variables/rows fixed as scaled bounds too close If this occurs look carefully at your input data 24 SIMPLEX Matrix will be packed to eliminate small elements If this occurs the user should look carefully at data. 26 SIMPLEX Matrix will be packed to eliminate %d duplicate elements If this occurs the user should look carefully at data. 28 SIMPLEX Crash put %d variables in basis, %d dual infeasibilities 29 SIMPLEX End of values pass after %d iterations ??? If primal(1) or dual(1) the a sweep through model is made and this signals end of pass.
    COIN Messages passed at or above logging level 0 Code Area Text and notes 3001 MPSREAD Illegal value for %s of %g String will be "infinity" if setInfinity passed bad value, or "default integer bound" if setDefaultBound passed bad value. 3002 MPSREAD Bad image at line %d < %s > This gives line number and the offending line 3003 MPSREAD Duplicate objective at line %d < %s > An objective row appears twice in one column 3004 MPSREAD Duplicate row %s at line %d %s The named row appears twice in one column. 3005 MPSREAD No match for row %s at line %d < %s > The named row did not appear in ROWS section. 3006 MPSREAD No match for column at line %d < %s > The named column (in BOUNDS section) did not appear in COLUMNS section. 6001 MPSREAD Unable to open mps input file %s 6002 MPSREAD Unknown image %s at line %d of file %s The Mps reader could not make sense of the image file specified. 6003 MPSREAD Consider the possibility of a compressed file which zlib is unable to read. Some .gz files can not be read by zlib. Using gunzip and then gzip normally cures problem. 6004 MPSREAD EOF on file %s The Mps reader did not find expected section marker. 6005 MPSREAD Returning as too many errors The reader has put out 100 messages and is giving up. 507 PRESOLVE Presolve determined that the problem is infeasible with tolerance of %g If you want you can try with a larger tolerance 508 PRESOLVE Presolve thinks problem is unbounded Perhaps the user should maximize if initially minimizing or vice versa. 509 PRESOLVE Presolve thinks problem is infeasible AND unbounded??? If you get this message we want to know
    CLP Messages passed at or above logging level 0 Code Area Text and notes 3002 SIMPLEX Not solving empty problem - %d rows, %d columns and %d elements Test problem size before solving. 6002 SIMPLEX %d bad bound pairs or bad objectives were found Either the value in the objective was too large or a lower bound was greater than an upper bound. 6003 SIMPLEX Matrix has %d large values, first at column %d, row %d is %g Some of the values in matrix are ridiculous. 6004 SIMPLEX Can't get out of loop ...
    There are also messages available at log level 2 (the most likely useful relate to scaling), and will be addressed in a future version of this User Guide.
    CoinMP-1.8.3/Clp/doc/legal.xml0000644000175000017500000000164611507203075014414 0ustar renerene 2004 IBM Coportation CLP and this documentation are provided under the terms of the Eclipse Public License (EPL). Any use, reproduction or distribution of the programs constitutes the recipient's acceptance of the license. The EPL is approved by the Open Source Initiative. The Eclipse Foundation, the steward of the EPL, has an EPL FAQ available which is based on the Eclipse Foundation's understanding of the EPL. CoinMP-1.8.3/Clp/doc/notsobasic.xml0000644000175000017500000002012610430454205015463 0ustar renerene Not-Quite-So-Basic Model Classes
    Pivot Choices In the dual algorithm, any infeasible basic variable may be chosen to leave the basis. Similarly in the primal algorithm, any non-basic variable with a "bad" reduced cost may be chosen to enter the basis. This choice is probably the most important factor in determining the number of iterations it will take to solve a problem. Clp provides a abstract base class for each case and then instances of each. It is relatively simple for an advanced user to create new instances. For the dual method the base class is ClpDualRowPivot. The two existing instances are ClpDualRowDantzig and ClpDualRowSteepest. The Dantzig version implements the "standard" pivot rule: choose the most violated basic variable. It is easily dominated by the Steepest instance which should normally be used. The default is to use un-initialized weights where the initial weight for each basic variable is 1.0. If an all-slack basis is being used then these are the correct weights. To use a version which calculates the weights, create an instance and pass it to ClpSimplex model as in the following code fragment: ClpDualRowSteepest steep(1); // 0 uninitialized, 1 compute weights model.setDualRowPivotAlgorithm(steep); Similarly for the primal method the base class is ClpPrimalColumnPivot. The two existing instances are ClpPrimalColumnDantzig and ClpPrimalColumnSteepest. The Dantzig version implements "standard" pivot rule: choose the most "violated" non-basic variable. It is dominated by the Steepest instance which should normally be used. The default is to use exact Devex where the initial weight for each non-basic variable is 1.0. Unlike for the dual, this is never the same as normal steepest edge. To use a version which does steepest edge create an instance and pass it to ClpSimplex model as in the following code fragment: ClpPrimalColumnSteepest steep(1); // 0 devex, 1 steepest model.setPrimalColumnPivotAlgorithm(steep); The partial pricing scheme (for long, thin problems) currently does not exist. This could be implemented by anyone who is interested.
    Matrix Classes The next abstract class of interest is ClpMatrixBase. CLP encapsulates its knowledge of how a matrix is stored in this class. The default instance of this is the ClpPackedMatrix class. This is identical in format to CoinPackedMatrix. Below is a diagram summarizing the hierarchy of the most important matrix classes: The important new methods implemented are for filling a basis, checking validity of elements and faster "times" and "transposeTimes" when the input array is sparse and/or we have a row copy of the matrix. Advanced users should note that not all methods have to be implemented. In particular, scaling need not be implemented and reverseOrderedCopy can return NULL if a row copy does not make sense. In addition to the default class, there are two others at present: ClpPlusMinusOneMatrix and ClpNetworkMatrix. As the name implies, the first one is useful when all elements are ±1. In this case multiplies are not needed and more importantly less memory is used and there are fewer cache misses. A class for a matrix where all elements are +1 would be trivial to create. If there were fewer than 64000 rows one could even store row indices as shorts etc. The use of ClpPlusMinusOneMatrix involves some work as one cannot simply read-in an MPS file. The key is to use loadProblem to pass in a matrix. So if matrix was a CoinPackedMatrix one could do the following: ClpPlusMinusOneMatrix plusMinus(matrix); assert (plusMinus.getIndices()); // would be zero if not +- one model.loadProblem(plusMinus, lowerColumn,upperColumn,objective, lower,upper); ClpNetworkMatrix is similar, but represents a network, thus may only have one element per column. Fortunately, using is is very easy. Given head and tail, one could do the following: ClpNetworkMatrix network(numberColumns,head,tail); model.loadProblem(network, lowerColumn,upperColumn,objective, lower,upper); Actual code is in COIN/Clp/Test/unitTest.cpp. A quick glance at the output of this program shows that use of ClpNetworkMatrix gives much faster run times. This is not because of storage issues, but because CLP recognizes the network and uses a network basis factorization which is much faster. However, in this mode CLP is not a genuine network code as it does not take full advantage of the structure by combining operations but it does have the advantage of flexibility. Other instances are possible. In particular, it should be possible to use the abstract class for column generation or for dynamic matrices which change over time. Minor modifications may be needed but it should work quite smoothly (there is already a dummy "refresh" method which would be used).
    Message Handling Strictly speaking, message handling is a general COIN topic, but it won't hurt to repeat a few important things here. A simple user you may wish to turn off some output. This is done with model.setLogLevel(int value) where 0 gives nothing and each increase in value switches on more messages. See ClpMessage.cpp, CoinMessage.cpp and to see which messages are at which level. A more sophisticated user may wish to handle messages in a different way. This is done using passInMessageHandler with a pointer to a handler of the user's own design. The simplest case would be to use the default handler but use a constructor which writes to file. The code would be: FILE * fp; // assumed open CoinMessageHandler handler(fp); model.passInMessageHandler(&handler); A still more sophisticated use would be to write a class derived from CoinMessageHandler and then override the print method. Below follows an example which would print only a message for optimality (or infeasibility): Sophisticated message handling class DerivedHandler : public CoinMessageHandler { public: virtual int print() ; }; int DerivedHandler::print() { if (currentSource()=="Clp") { if (currentMessage().externalNumber()>=0 && currentMessage().externalNumber()<4) { // finished return CoinMessageHandler::print(); // print } } return 0; }
    CoinMP-1.8.3/Clp/doc/faq.xml0000644000175000017500000000022410430454205014063 0ustar renerene FAQ &faqcontent; CoinMP-1.8.3/Clp/doc/basicmodelclasses.xml0000644000175000017500000006330610430454205017006 0ustar renerene Basic Model Classes
    Hierarchy The basic CLP model class hierarchy is simple. The top three levels of the hierarchy are depicted in the figure below. The first two levels (i.e. ClpModel, ClpSimplex, ClpInterior) contain all the problem data which define a model (that is, a problem instance). The third level contains most of the algorithmic aspects of CLP. There is a fourth level (for models with more general objectives than linear ones), but a description of it is beyond the current scope of this document. Most Simplex users need only concern themselves with the classes ClpModel and ClpSimplex. There are algorithm-specific classes which inherit from ClpSimplex (e.g. ClpSimplexDual and ClpSimplexPrimal), but they have no member data and rarely need be visible to the user. These classes are cast at algorithm time. So, for example, after instantiating an object model of type ClpSimplex, a user only need call model.dual() to invoke the dual simplex method.
    First Example Below is our first CLP sample program. It is short enough to present in full (this code can be found in the CLP Samples directory, see ). Most of the remaining examples in this Guide will take the form of small code fragments. minimum.cpp This sample program creates a ClpSimplex model, reads an MPS file, and if there are no errors, solves it using the primal algorithm. The program is easy to follow, but it is not terribly useful: it does not attempt to inspect the results of the solve. There are two main kinds of results: a "status" describing what happened to the model during the solve, and arrays filled with solution values. Both will be addressed in this chapter.
    Getting at the Solution It is often the case with CLP that there is more than one way to do something. This is a consequence of CLP's mixed heritage as a child of OSL and a cousin of OSI. Finding the status of a model exemplifies this situation. The OSI way to check for optimality is to call model.isProvenOptimal(). Also available are isProvenPrimalInfeasible(), isProvenDualInfeasible(), isPrimalObjectiveLimitReached(), isDualObjectiveLimitReached(), isIterationLimitReached() or the feared isAbandoned(). Should one prefer the OSL way of doing things, model.status() returns as it would in OSL, so 0 means optimal, 1 means primal infeasible etc. Similarly, to pick up the solution values, one could inhabit the virtuous world of OSI, or the not-quite-so-virtuous world of OSL and "pure" CLP. By this it is meant that const and non-const forms of arrays are used, respectively. It is easier to deal with the non-const versions, so most of the elaborate algorithms in CLP and its Samples use them. Methods for getting solution information Purpose OSI-style (virtuous) CLP-style (less virtuous) Primal column solution const double * getColSolution() double * primalColumnSolution() Dual row solution const double * getRowPrice() double * dualColumnSolution() Primal row solution const double * getRowActivity() double * primalRowSolution() Dual row solution const double * getReducedCost() double * dualColumnSolution() Number of rows in model int getNumRows() int numberRows() Number of columns in model int getNumCols() int numberColumns()
    The reader may have noted a preference for "number" over "num" and "column" over "col". This may be a reaction to when one of the authors was young and 5 or 6 letters was the maximum in FORTRAN for any name or to early days with OSL when seven characters were allowed but the first three had to be "ekk"! Using the above-listed functions, our initial example might be continued as follows: Possible extension of minimum.cpp This code sample would pretty-print information about the model's primal and dual solutions. How to additionally print row and column names is illustrated in the defaults.cpp file in the "Samples" directory (the Samples are properly addressed in ). This sample is also useful as it explicitly performs default actions (e.g. it sets the primal feasiblility tolerance value to the default value). The remainder of this chapter will show more of the basic CLP tasks a user might wish to perform. Apart from presolve we will only be looking at actions which can be performed when including the single header file COIN/Clp/include/ClpSimplex.hpp.
    Building and Modifying a Model Rather than reading a model from an MPS file we can load a model from arrays in memory. There are various loadProblem methods which are similar to those in OSI. It is easy to add more such methods to CLP if the need arises. We can copy in integer information by copyInIntegerInformation(const char * array) where array is 0 or 1 to say integer and we can drop existing information by deleteIntegerInformation(). There are various ways of changing the size of a model. The simplest is by the use of the method resize(newNumberRows,newNumberColumns) - this will either truncate the model or add "default" rows or columns - a default row has lower bound of -infinity and upper bound of +infinity, while a default column has zero cost, zero lower bound and an upper bound of +infinity. Normally we would use deleteRows, addRows, deleteColumns and addColumns, where the add methods will also add in the elements. A potentially very useful way of modifying a model is strictly a constructor. Given a large model and a list of rows and a list of columns it constructs the model as a subset of the large model. It is possible to change the order of the columns/rows and to duplicate columns/rows. So a list of columns 4,4,1,0 will create a new model where the first two columns are copies of column 4 in original model and the next two are the first two of original model in reverse order. This can be useful to form a model with piecewise linear costs by duplicating columns and then modifying bounds and costs.
    Tolerances There are set and get methods for tolerances, for example, double primalTolerance() and setPrimalTolerance(double). Assuming that one has a minimization problem, an individual variable is deemed primal feasible if it is less than the tolerance referred to by these methods below its lower bound and less than it above its upper bound. Similarly for dual tolerances, a variable is deemed to be dual feasible if its reduced cost is greater than minus the tolerance or its distance to the upper bound is less than primal tolerance and the reduced cost is less than plus the tolerance or the distance to lower bound is less than primal tolerance. In short, this is complementarity conditions adadpted for tolerances and simple lower and upper bounds.(Note that the above was stated as for minimization; signs are reversed for maximization.)
    Some Useful Set and Get Methods Some Useful Set and Get Methods Method(s) Description setMaximumIterations(int value) int maximumIterations() setMaximumSeconds(double value) double maximumIterations() These methods tell CLP to stop after a given number of iterations or seconds (and returns these values). double objectiveValue() This method returns the objective value. const double * getObjCoefficients() double * objective() These methods return the objective coefficients. const double * getRowLower() double * rowLower() const double * getRowUpper() double * rowUpper() const double * getColLower() double * columnLower() const double * getColUpper() double * columnUpper() These methods give lower and upper bounds on row and column activities. double * infeasibilityRay() double * unboundedRay() If the problem was primal or dual infeasible, these methods will give a pointer to a ray proving infeasibility. CoinPackMatrix * matrix() There are more options as the user has great flexibility in how the problem matrix is stored, but the default matrix class is CoinPackedMatrix (see ). So we have that this method returns a pointer to a CoinPackedMatrix which can be further manipulated. CoinBigIndex getNumElements() CoinBigIndex is a typedef which in most cases is the same as int. Returns the number of elements in the problem matrix. void setOptimizationDirection(double value) double optimizationDirection() These methods set and get the objective sense. The parameter value should be +1 to minimize, -1 to maximize, and 0 to ignore.
    Simplex-specific Methods Some of the most commonly-used methods when working with Simplex are listed in the table below. Common Simplex-specific methods Method(s) Description primal(int mode=0) This applies the primal algorithm. If mode is set to the default of 0, then the method uses the status variables to determine basis and solution. If mode is 1 then the method does a values pass so variables not in basis are given their current values and one pass of variables is done to clean up the basis with an equal or better objective value. dual(int mode=0) This applies the dual algorithm. if mode is set to the default of 0, then the method uses the status variables to determine basis and solution. If mode is 1 then the method uses input duals and does a values pass so one pass of basic variables is done to clean up the duals with an equal or better objective value. scaling(int mode=1) This method toggles scaling on (mode set to 1) and off (mode set to 0). int crash(double gap,int mode) This method attemps to improve on an all slack basis. For dual this will move variables to the dual feasible bound if the gap between bounds is less than gap. Setting mode to 0 guesses which algorithm is better, while a value of 1 or 2 will result in more work being done. The return code is 0 if the basis was not slacks in first case, it is negative if dual is preferred or positive if primal. ±1 means an all slack basis seemed best, while ±2 means some work was done. perturb(int mode) This method toggles perturbation on (mode set to 1) and off (mode set to 0). It should be considered a work in progress, although on some problems it gives very good results. factorizationFrequency() setFactorizationFrequency(int value) These are "get" and "set" methods for the basis matrix factorization frequency. The default is to refactor every 200 iterations, but it may make more sense to use something such as 100 + the number of rows divided by 50. dualBound() setDualBound(double value) These are "get" and "set" methods for the "dual bound". The CLP dual algorithm declares all problems to be dual feasible by putting non-basic variables to correct bounds for the reduced cost. If the gap between the bounds is too big then it pretends the gap is only the value specified by this set method. In essence, this gives a composite dual rather than a pure Phase I- Phase II method. infeasibilityCost() setInfeasibilityCost(double value) These are the primal analogs to the "dual bound" methods. numberPrimalInfeasibilities() sumPrimalInfeasibilities() After a solve, there may be infeasibilities. These methods serve to check for said infeasibilities. One could check the solution explicitly as well. For a code fragement illustrating this, see .
    Presolve The header file for the use of CLP's presolve functionality is COIN/Clp/include/Presolve.hpp. The sample program below illustrates some of the possibilities offered by CLP's presolve: Presolve code fragment #include "ClpSimplex.hpp" #include "ClpPresolve.hpp" int main (int argc, const char *argv[]) { ClpSimplex model; model.readMps("../../Mps/Sample/p0033.mps"); // initialized by readMps or whatever ClpPresolve presolveInfo; ClpSimplex * presolvedModel = presolveInfo.presolvedModel(model); // at this point we have original model and a new model. The information // on the operations done is in presolveInfo if (presolvedModel) { // was not found to be infeasible - so lets solve // if presolvedModel was NULL then it was primal infeasible and ... presolvedModel->dual(); // or whatever else we wish to do presolveInfo.postsolve(true); // the true updates status arrays in original /* If the presolved model was optimal then so should the original be. We can use checkSolution and test feasibility */ model.checkSolution(); if (model.numberDualInfeasibilities()|| model.numberPrimalInfeasibilities()) printf("%g dual %g(%d) Primal %g(%d)\n", model.objectiveValue(), model.sumDualInfeasibilities(), model.numberDualInfeasibilities(), model.sumPrimalInfeasibilities(), model.numberPrimalInfeasibilities()); // Due to tolerances we can not guarantee that so you may wish to throw in model.primal(1); } } Presolve has a few more options which can be found in the header file, for example whether to treat as an integer problem or whether to keep row and column names.
    Status Array The astute reader may have noticed that the status array has been mentioned once or twice. The beginning user will not need to look at it Nevertheless, for completeness the status of a variable can be found and set as shown below. The possible state of a variable are listed in the following table (each may have to be preceded by ClpSimplex::): Possible states of a variable StatusStatus is an enumeration. Description basic In basis isFree Not in basis, has infinite bounds isFixed Not in basis, bounds are equal atUpperBound At upper bound, not in basis atLowerBound At lower bound, not in basis superBasic Between bounds, but not basic or free
    To get or set the status of a variable is a simple task: // Get row status... Status status=model.getRowStatus(sequenceNumber) // ... or get column status. Status status=model.getColumnStatus(sequenceNumber) // Set row status to basic (for example)... model.setRowStatus(sequenceNumber,ClpSimplex::basic) // ... or column status to basic. model.setColumnStatus(sequenceNumber,ClpSimplex::basic)
    CoinMP-1.8.3/Clp/doc/intro.xml0000644000175000017500000000321110430454205014446 0ustar renerene Introduction
    Welcome to CLP! The COIN Linear Program code or CLP is an open-source simplex solver written in C++. It is primarily meant to be used as a callable library, but a basic, stand-alone executable version is also available. There are a number of resources available to help new CLP users get started. This document is designed to be used in conjunction with the files in the Samples subdirectory of the main CLP directory (COIN/Clp/Samples). The Samples illustrate how to use CLP and may also serve as useful starting points for user projects. In the rare event that either this document or the available Doxygen content conflicts with the observed behavior of the source code, the comments in the header files, found in COIN/Clp/include, are the ultimate reference.
    Prerequisites CLP is written in C++, so it is expected that users of CLP will be writing C++ programs which use CLP as a library. Thus a working knowledge of C++, including basic object-oriented programming terminology is assumed in this document. In addition, the user should be familiar with the fundamental concepts of Linear Programming.
    CoinMP-1.8.3/Clp/doc/revhist.xml0000644000175000017500000000173210430454205015005 0ustar renerene Revision History 0.4 18 Oct 2004 DdlN Second official release, including some corrections, clarifications, and several improvements (better treatment of clp executable and Samples). 0.3 19 Aug 2004 DdlN Major overhaul, including transition from MS Word to DocBook XML. 0.2 23 Feb 2004 RLH Revisions to make it clearer to the non-author reader. 0.1 Nov 2003 JF First draft CoinMP-1.8.3/Clp/doc/clpuserguide.xml0000644000175000017500000000557510430454205016025 0ustar renerene defaults.cpp"> driver.cpp"> driver2.cpp"> minimum.cpp"> decompose.cpp"> piece.cpp"> network.cpp"> sprint.cpp"> sprint2.cpp"> ekk.cpp"> hello.cpp"> testBarrier.cpp"> dualCuts.cpp"> testGub.cpp"> testBasis.cpp"> useVolume.cpp"> ]> CLP User Guide &authors; &legal; &intro; &basicmodelclasses; ¬sobasic; &moresamples; &clpexe; &messages; &faq; &doxygen; &revhist; CoinMP-1.8.3/Clp/doc/faqcontent.xml0000644000175000017500000002170111510660312015457 0ustar renerene What is CLP? (DN 08/27/04) The COIN-OR LP code is designed to be a high quality Simplex code provided under the terms of the Eclipse Public License. CLP is written in C++, and is primarily intended to be used as a callable library (though a rudimentary stand-alone executable exists). The first release was version .90. The current release is version 1.00.2. What are some of the features of CLP? (DN 08/27/04) CLP includes primal and dual Simplex solvers. Both dual and primal algorithms can use matrix storage methods provided by the user (0-1 and network matrices are already supported in addition to the default sparse matrix). The dual algorithm has Dantzig and Steepest edge row pivot choices; new ones may be provided by the user. The same is true for the column pivot choice of the primal algorithm. The primal can also use a non linear cost which should work for piecewise linear convex functions. CLP also includes a barrier method for solving LPs. How do I obtain and install CLP? (DN 08/27/04) Please see the COIN-OR FAQ for details on how to obtain and install COIN-OR modules. Is CLP reliable? (DN 09/07/04) CLP has been tested on many problems of up to 1.5 million constraints and has shown itself as reliable as OSL. It is also being tested in the context of developing CBC ("Coin Branch and Cut", which is used to solve integer programs); it is now considered reliable enough to be at version 1.0. On which platforms does CLP run? (DN 08/27/04) CLP compiles and has been tested (to varying degrees) on the following platforms: Linux using g++ version 3.1.1 (or later) Windows using Microsoft Visual C++ 6 Windows using cygwin AIX using xIC (not supported in the current Makefile) Is there any documentation for CLP? (DN 09/16/04) An early release of a User Guide is available on the CLP documentation webpage. Also available is a list of CLP class descriptions generated by Doxygen. Is CLP as fast as OSL? (DN 08/27/04) CLP uses sparse matrix techniques designed for very large problems. The design criteria were for it not to be too slow. Some speed has been sacrificed to make the code less opaque OSL (not difficult!). When will version 1.0 of CLP be available? (DN 08/27/04) Version 1.0 was released in time for the 2004 INFORMS Annual Meeting (24-27 October, 2004). The barrier method sounds interesting, what are some of the details? (DN 08/30/04) The CLP barrier method solves convex QPs as well as LPs. In general, a barrier method requires implementation of the algorithm, as well as a fast Cholesky factorization. CLP provides the algorithm, and is expected to have a reasonable factorization implementation by the release of CLP version 1.0. However, the sparse factorization requires a good ordering algorithm, which the user is expected to provide (perhaps a better factorization code as well). Which Cholesky factorizations codes are supported by CLP's barrier method? (DN 09/16/04) The Cholesky interface is flexible enough so that a variety of Cholesky ordering and factorization codes can be used. Interfaces are provided to each of the following: Anshul Gupta's WSSMP parallel enabled ordering and factorization code Sivan Toledo's TAUCS parallel enabled factorization code (the package includes third party ordering codes) University of Florida's Approximate Minimum Degree (AMD) ordering code (the CLP native factorization code is used with this ordering code) CLP native code: very weak ordering but competitive nonparallel factorization Fast dense factorization When will CLP have a good native ordering? (DN 09/16/04) The best outcome would be to have an existing ordering code available as part of the COIN distribution under the EPL. However, if this is not possible, the native ordering will be made respectable. Is the barrier code as mature as the simplex code? (DN 09/16/04) The simplex code has been exposed to user testing for more than a year and and the principal author, John Forrest, knows more about simplex algorithms than interior point algorithms, so the answer is "no". However, it performs well on test sets and seems to be more reliable than some commercially available codes (including OSL). Which algorithm should I use for quadratic programming and should I keep an eye open for any issues? (DN 09/16/04) The interior point algorithm for quadratic programming is much more elegant and normally much faster than the quadratic simplex code. Caution is suggested with the presolve as not all bugs have been found and squashed when a quadratic objective is used. One may wish to switch off the crossover to a basic feasible solution as the simplex code can be slow. The sequential linear code is useful as a "crash" to the simplex code; its convergence is poor but, say, 100 iterations could set up the problem well for the simplex code. What can the community do to help? (DN 09/09/04) A lot! A good first step would be to join the CLP mailing lists. Some other possibilities: Comment on the design Break the code, or better yet, mend it. Add non-English language support in your own favo(u)rite language. Improve the CLP executable. In particular it would be nice to be able to link the executable's online help system with the existing CLP Samples (e.g. entering presol??? would give the user references to all CLP Sample files which use presolve). Implement a dual Simplex method for QPs (quadratic programs) Implement a parametric Simplex method Implement a true network Simplex method (network matrix and factorization are already in place, but the method is not) Fill the holes in the barrier method mentioned above. CoinMP-1.8.3/Clp/doc/authors.xml0000644000175000017500000000150510430454205015004 0ustar renerene John Forrest jjforre at us dot ibm dot com IBM Research David de la Nuez dmd57 at columbia dot edu Columbia University & IBM Research Robin Lougee-Heimer robinlh at us dot ibm dot com IBM Research CoinMP-1.8.3/Clp/doc/Howto/0000755000175000017500000000000012600453455013703 5ustar renereneCoinMP-1.8.3/Clp/doc/Howto/docbook4clp.xml0000644000175000017500000004326410115426415016634 0ustar renerene
    DocBook for Writers of CLP Documentation Davidde la Nuez
    Introduction The CLP User Guide is written in DocBook XML. This tutorial serves as an introduction to using DocBook for maintaining the Guide, as well as writing new documentation. There are countless DocBook and XML resources available both in print and online, so this tutorial will be limited in its scope to applying these two technologies to documenting CLP. See to learn more about DocBook and XML.
    DocBook? Why DocBook? Why not HTML or LaTeX? Here are a few of the reasons: DocBook and the tools we use to work with it are Open Source. LaTeX is nice for mathematical markup, but DocBook exists for marking-up technical documentation. Basic HTML is easy to learn and use, but it is very clumsy. DocBook does a good job of separating content from presentation (HTML does not do this particularly well, even with the use of CSS), allowing the writer to focus on what really matters, the content. DocBook can transformed into high-quality online and printed output (e.g. HTML and PDF, respectively), while working from a single source. DocBook is very robust, thoroughly documented, and has a strong community behind it. DocBook is a modern though mature standard for documentation of software (or other) projects which is at no risk of obsolescence. The tools needed for creating and manipulating DocBook documents are typically part of existing *nix installations (including Cygwin) so little or no installation of new software is required to use DocBook (editing can be done in any text editor). Many tedious tasks, such as the creation of a table of contents, are handled automatically by a good DocBook configuration.
    Getting Ready for DocBook Editing and publishing CLP documentation with DocBook requires that some important tools be installed. It is likely that all or most of these tools are already in place on a typical *nix (e.g. Linux) system. Windows users should strongly consider installing Cygwin, as this tutorial assumes a *nix environment for DocBook development. In fact, the following instructions for installation are for Cygwin and Red Hat Linux, (and should not be altogether different for another *nix system). The necessary Cygwin packages can all be found in the "Doc" section of the categorical view of Cygwin's setup.exe. The user should verify that all of them are selected (because there may not be adequate dependency rules to ensure that all the correct packages are installed). The packages in question are: dockbook-xml42 This is for version 4.2 of DocBook. Future versions will have a slightly different name. docbook-xsl libxml2 libxslt xmlto According to The Selfdocbook (XML Edition), the Red Hat Linux (7.3) packages needed are: sgml-common and xml-common docbook-style-xsl docbook-dtds xmlto The Selfdocbook also lists a few other packages, but they are not necessary for HTML output (this tutorial does not (yet) address how to create output in other formats such as PDF). The last of the packages, xmlto, is a shell script which facilitates the conversion of DocBook documents to HTML and other formats. If all the tools are properly installed, creating an HTML version of this tutorial, for example, is as trivial as typing xmlto html docbook4clp.xml at the command line. But before jumping in to work with DocBook, there are some important issues which need to be addressed.
    Need to Know Knowledge of DocBook is like a security clearance: the user is on a need-to-know basis. That is, to start working with DocBook in a properly configured environment, a user needs to know very little, but there is always something more out there to learn. This section addresses a few details of DocBook that the typical user needs to know to get a first DocBook document up and running. Details will be left to the reader to fill-in from other resources (see ). What makes an XML document a DocBook document? It is not difficult to write a "valid" XML document. The following example would constitute a valid XML document: How CLP Won the West In the Beginning There once was a large LP... ]]> This document is not much use, though, without some meaning for the tags in it. The DocBook DTD is what gives a document meaning. The following example works better, and constitutes a valid DocBook document: How CLP Won the West In the Beginning There once was a large LP... ]]> The only difference is the document type declaration which states the document is meant to adhere to the standard described in the file /usr/share/docbook-xml42/docbookx.dtd (see for where to read more about document type declarations the DocBook DTD). In other words, adding the extra line of code makes this little example a genuine DocBook document. In this case, the declaration uses an absolute path for a particular system (Cygwin). DocBook has an elaborate system for eliminating this lack of elegance. Future versions of this tutorial will address this (see for more on this topic). Suppose the name of the file containing the example above is bookex.xml. To create a single HTML document from this file is as simple as typing one command:
    $ xmlto html-nochunks bookex.xml
    To create a multi-part HTML version is just as easy:
    $ xmlto html bookex.xml
    A final and very important DocBook topic is that of "entities". For the purposes of writing CLP documentation (i.e. what follows is a gross simplification), entities are a way of "#include-ing" one document into another, and of using certain special characters which would otherwise confuse the tools used to process DocBook documents. The simplest example of the latter is the < symbol, which is used to begin tags in XML. Rather than putting the character directly into the document text, an entity can be used. Specifically, one would use the string instead. The other use of entities, as suggested above, is to split a document into convenient pieces. This is demonstrated in .
    DocBook and CLP, Perfect Together The DocBook XML source of the CLP documentation is available via the COIN CVS repository in the COIN/Clp/Docs directory. The first file of interest is clpuserguide.xml. At the time of this tutorial's writing, the file looked like this: ]> CLP User Manual &authors; &legal; &intro; &basicmodelclasses; ¬sobasic; &moresamples; &clpexe; &messages; &faq; &doxygen; &revhist; ]]> Essentially clpuserguide.xml contains a series of entity declarations which refer to other XML files (e.g. ]]>, which are then included into the main file via use of the entities (e.g. . This allows a neat separation of chapters in the Guide, resulting in more manageable and readable source than would be possible without the use of entities. Neither the names nor the order of the declarations of the entities is particularly important, but it is a good practice to follow the informal convention of naming the entity after the chapter filename, and declaring it in a sensible place with respect to the order of the chapters. Editing a particular chapter of the Guide is a matter of editing a single, reasonably sized file. The addition of a new chapter merely entails the declaration of a new entity and the writing of a short additional line in clpuserguide.xml. Suppose a chapter on the barrier method of CLP was planned (it is, in fact). The chapter could be written in a file named barrier.xml, while an entity was declared and used in clpuserguide.xml. If the barrier chapter was to preceed, say, the chapter on the CLP executable, the new clpuserguide.xml would look like this (with changes emphasized): ]]> <!ENTITY barrier SYSTEM "barrier.xml"> ]> CLP User Manual &authors; &legal; &intro; &basicmodelclasses; ¬sobasic; &moresamples; ]]> &barrier; ]]> The barrier chapter source might look something like this: The CLP Barrier Method
    The CLP barrier method can be used ]]>…
    ]]>
    Note the absence of a document type declaration; it is not necessary (and in fact "illegal") in this context because this file is included in the main file via the entity mechanism (only one document type declaration is allowed). With some content in the proposed barrier.xml and the appropriate changes made to clpuserguide.xml, a new HTML version of the Guide could be created in much the same manner as the small book example above was transformed to HTML:
    $ xmlto html-nochunks clpuserguide.xml
    or for a sectioned version:
    $ xmlto html clpuserguide.xml
    Most of the chapters and appendices in the Guide exist only to be used in the Guide. There is currently one exception, the FAQ. The FAQ is constructed in a way that allows its inclusion in the Guide as well as on the CLP website (i.e. we have a single source document for our frequently asked questions). The file pointed to by the entity faq, faq.xml, is a wrapper for the file faqcontent.xml (with corresponding entity faqcontent). faqcontent.xml has another wrapper in coin-web/Clp named faqwrapper.xml, which will be addressed elsewhere.
    Tips and Suggestions This tutorial, as well as the first DocBook release of the CLP User Guide, were written using the Emacs editor. Most any text editor will do as a DocBook editor, but Emacs has its advantages. First, naturally, Emacs is Open Source. Second, there are Emacs modes tailored for editing XML documents which provide features such as syntax highlighting. One such mode is PGSML, which may be part of a system's default Emacs configuration (this appears to be the case with Cygwin, at the very least). As the size of a DocBook project grows, so does the time it takes to transform it to HTML. If one wishes to simply check the validity of a document rather than wait for the entire HTML generation process to complete, the validating parser called by xmlto is easy enough to use:
    $ xmllint --nout --postvalid --xinclude clpuserguide.xml
    If there are no errors in the document, the parser will terminate without any explicit output. If there is in fact an error, a (sometimes) helpful error message will be printed by the parser. With DocBook, as is the case with any other computer language, it is easiest to learn by example. The existing examples which are part of CLP are this tutorial, of course, and the User Guide itself. The Selfdocbook (XML Edition) is also an excellent example, as it is a DocBook document which includes its own source. The DocBook community is quite active, so the official mailing lists are highly recommended. See for more information on the lists as well as a number of other helpful resources.
    Resources Below is a list of some online resources for learning more about DocBook and XML. DocBook.org: The official site for DocBook: The Definitive Guide (see below). DocBook:The Definitive Guide: The number one reference for DocBook tags. The book is very much oriented toward users of the SGML version of DocBook, but is still the best resource available for CLP documenters. The Selfdocbook (XML Edition) is another very useful reference. It is a self-documenting introduction to DocBook XML (it includes its own source, which makes ita great learning tool). DocBook Wiki Full of useful DocBook links. The Official DocBook homepage: Not terribly useful, but it includes information on the DocBook mailing lists, and a page where one can download DocBook. DocBook FAQ A very handy list of frequently asked quesions (with answers!) about DocBook.
    CoinMP-1.8.3/Clp/clp-uninstalled.pc.in0000644000175000017500000000047112477334547016103 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src Name: CLP Description: COIN-OR Linear Programming Solver URL: https://projects.coin-or.org/Clp Version: @PACKAGE_VERSION@ Libs: ${libdir}/libClpSolver.la ${libdir}/libClp.la @CLPLIB_PCLIBS@ Cflags: -I@abs_source_dir@/src -I@ABSBUILDDIR@/src Requires: @CLPLIB_PCREQUIRES@ CoinMP-1.8.3/Clp/configure0000755000175000017500000417477612600050735013771 0ustar renerene#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for Clp 1.16.8. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # # Copyright 2006 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package Coin which is distributed # under the Eclipse Public License. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='Clp' PACKAGE_TARNAME='clp' PACKAGE_VERSION='1.16.8' PACKAGE_STRING='Clp 1.16.8' PACKAGE_BUGREPORT='clp@list.coin-or.org' ac_unique_file="src/ClpSimplex.cpp" ac_default_prefix=`pwd` # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os ALWAYS_FALSE_TRUE ALWAYS_FALSE_FALSE have_svnversion CLP_SVN_REV CDEFS ADD_CFLAGS DBG_CFLAGS OPT_CFLAGS sol_cc_compiler CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT COIN_CC_IS_CL_TRUE COIN_CC_IS_CL_FALSE MPICC CXXDEFS ADD_CXXFLAGS DBG_CXXFLAGS OPT_CXXFLAGS CXX CXXFLAGS ac_ct_CXX COIN_CXX_IS_CL_TRUE COIN_CXX_IS_CL_FALSE MPICXX EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOLM4 have_autoconf have_automake have_svn BUILDTOOLSDIR AUX_DIR abs_source_dir abs_lib_dir abs_include_dir abs_bin_dir HAVE_EXTERNALS_TRUE HAVE_EXTERNALS_FALSE host host_cpu host_vendor host_os ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ac_c_preproc_warn_flag ac_cxx_preproc_warn_flag RPATH_FLAGS DEPENDENCY_LINKING_TRUE DEPENDENCY_LINKING_FALSE LT_LDFLAGS PKG_CONFIG ac_ct_PKG_CONFIG COIN_HAS_PKGCONFIG_TRUE COIN_HAS_PKGCONFIG_FALSE COIN_PKG_CONFIG_PATH COIN_PKG_CONFIG_PATH_UNINSTALLED COINUTILS_LIBS COINUTILS_CFLAGS COINUTILS_DATA COINUTILS_DEPENDENCIES COINUTILS_LIBS_INSTALLED COINUTILS_CFLAGS_INSTALLED COINUTILS_DATA_INSTALLED CLPLIB_CFLAGS CLPLIB_LIBS CLPLIB_PCLIBS CLPLIB_PCREQUIRES CLPLIB_DEPENDENCIES CLPLIB_CFLAGS_INSTALLED CLPLIB_LIBS_INSTALLED COIN_HAS_COINUTILS_TRUE COIN_HAS_COINUTILS_FALSE OSI_LIBS OSI_CFLAGS OSI_DATA OSI_DEPENDENCIES OSI_LIBS_INSTALLED OSI_CFLAGS_INSTALLED OSI_DATA_INSTALLED OSICLPLIB_CFLAGS OSICLPLIB_LIBS OSICLPLIB_PCLIBS OSICLPLIB_PCREQUIRES OSICLPLIB_DEPENDENCIES OSICLPLIB_CFLAGS_INSTALLED OSICLPLIB_LIBS_INSTALLED COIN_HAS_OSI_TRUE COIN_HAS_OSI_FALSE OSITESTS_LIBS OSITESTS_CFLAGS OSITESTS_DATA OSITESTS_DEPENDENCIES OSITESTS_LIBS_INSTALLED OSITESTS_CFLAGS_INSTALLED OSITESTS_DATA_INSTALLED COIN_HAS_OSITESTS_TRUE COIN_HAS_OSITESTS_FALSE SAMPLE_LIBS SAMPLE_CFLAGS SAMPLE_DATA SAMPLE_DEPENDENCIES SAMPLE_LIBS_INSTALLED SAMPLE_CFLAGS_INSTALLED SAMPLE_DATA_INSTALLED COIN_HAS_SAMPLE_TRUE COIN_HAS_SAMPLE_FALSE NETLIB_LIBS NETLIB_CFLAGS NETLIB_DATA NETLIB_DEPENDENCIES NETLIB_LIBS_INSTALLED NETLIB_CFLAGS_INSTALLED NETLIB_DATA_INSTALLED COIN_HAS_NETLIB_TRUE COIN_HAS_NETLIB_FALSE COIN_HAS_ABC_TRUE COIN_HAS_ABC_FALSE AMDINCDIR AMDLIB COIN_HAS_AMD_TRUE COIN_HAS_AMD_FALSE CHOLMODINCDIR CHOLMODLIB COIN_HAS_CHOLMOD_TRUE COIN_HAS_CHOLMOD_FALSE GLPK_LIBS GLPK_CFLAGS GLPK_DATA GLPK_DEPENDENCIES GLPK_LIBS_INSTALLED GLPK_CFLAGS_INSTALLED GLPK_DATA_INSTALLED COIN_HAS_GLPK_TRUE COIN_HAS_GLPK_FALSE MUMPS_LIBS MUMPS_CFLAGS MUMPS_DATA MUMPS_DEPENDENCIES MUMPS_LIBS_INSTALLED MUMPS_CFLAGS_INSTALLED MUMPS_DATA_INSTALLED COIN_HAS_MUMPS_TRUE COIN_HAS_MUMPS_FALSE ADD_FFLAGS DBG_FFLAGS OPT_FFLAGS MPIF77 FLIBS BLAS_LIBS BLAS_CFLAGS BLAS_DATA BLAS_DEPENDENCIES BLAS_LIBS_INSTALLED BLAS_CFLAGS_INSTALLED BLAS_DATA_INSTALLED COIN_HAS_BLAS_TRUE COIN_HAS_BLAS_FALSE COIN_HAS_WSMP_TRUE COIN_HAS_WSMP_FALSE ASL_LIBS ASL_CFLAGS ASL_DATA ASL_DEPENDENCIES ASL_LIBS_INSTALLED ASL_CFLAGS_INSTALLED ASL_DATA_INSTALLED COIN_HAS_ASL_TRUE COIN_HAS_ASL_FALSE coin_have_doxygen coin_have_latex coin_doxy_usedot coin_doxy_tagname coin_doxy_logname COIN_HAS_DOXYGEN_TRUE COIN_HAS_DOXYGEN_FALSE COIN_HAS_LATEX_TRUE COIN_HAS_LATEX_FALSE coin_doxy_tagfiles coin_doxy_excludes LIBEXT VPATH_DISTCLEANFILES ABSBUILDDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CDEFS_set=${CDEFS+set} ac_env_CDEFS_value=$CDEFS ac_cv_env_CDEFS_set=${CDEFS+set} ac_cv_env_CDEFS_value=$CDEFS ac_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_cv_env_ADD_CFLAGS_set=${ADD_CFLAGS+set} ac_cv_env_ADD_CFLAGS_value=$ADD_CFLAGS ac_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_cv_env_DBG_CFLAGS_set=${DBG_CFLAGS+set} ac_cv_env_DBG_CFLAGS_value=$DBG_CFLAGS ac_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_cv_env_OPT_CFLAGS_set=${OPT_CFLAGS+set} ac_cv_env_OPT_CFLAGS_value=$OPT_CFLAGS ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_MPICC_set=${MPICC+set} ac_env_MPICC_value=$MPICC ac_cv_env_MPICC_set=${MPICC+set} ac_cv_env_MPICC_value=$MPICC ac_env_CXXDEFS_set=${CXXDEFS+set} ac_env_CXXDEFS_value=$CXXDEFS ac_cv_env_CXXDEFS_set=${CXXDEFS+set} ac_cv_env_CXXDEFS_value=$CXXDEFS ac_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_cv_env_ADD_CXXFLAGS_set=${ADD_CXXFLAGS+set} ac_cv_env_ADD_CXXFLAGS_value=$ADD_CXXFLAGS ac_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_cv_env_DBG_CXXFLAGS_set=${DBG_CXXFLAGS+set} ac_cv_env_DBG_CXXFLAGS_value=$DBG_CXXFLAGS ac_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_cv_env_OPT_CXXFLAGS_set=${OPT_CXXFLAGS+set} ac_cv_env_OPT_CXXFLAGS_value=$OPT_CXXFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_MPICXX_set=${MPICXX+set} ac_env_MPICXX_value=$MPICXX ac_cv_env_MPICXX_set=${MPICXX+set} ac_cv_env_MPICXX_value=$MPICXX ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP ac_env_F77_set=${F77+set} ac_env_F77_value=$F77 ac_cv_env_F77_set=${F77+set} ac_cv_env_F77_value=$F77 ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_env_PKG_CONFIG_value=$PKG_CONFIG ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG ac_env_ADD_FFLAGS_set=${ADD_FFLAGS+set} ac_env_ADD_FFLAGS_value=$ADD_FFLAGS ac_cv_env_ADD_FFLAGS_set=${ADD_FFLAGS+set} ac_cv_env_ADD_FFLAGS_value=$ADD_FFLAGS ac_env_DBG_FFLAGS_set=${DBG_FFLAGS+set} ac_env_DBG_FFLAGS_value=$DBG_FFLAGS ac_cv_env_DBG_FFLAGS_set=${DBG_FFLAGS+set} ac_cv_env_DBG_FFLAGS_value=$DBG_FFLAGS ac_env_OPT_FFLAGS_set=${OPT_FFLAGS+set} ac_env_OPT_FFLAGS_value=$OPT_FFLAGS ac_cv_env_OPT_FFLAGS_set=${OPT_FFLAGS+set} ac_cv_env_OPT_FFLAGS_value=$OPT_FFLAGS ac_env_MPIF77_set=${MPIF77+set} ac_env_MPIF77_value=$MPIF77 ac_cv_env_MPIF77_set=${MPIF77+set} ac_cv_env_MPIF77_value=$MPIF77 # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Clp 1.16.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Clp 1.16.8:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug compile all projects with debug options tests (implies --disable-shared) --enable-debug-clp compile project Clp with debug compiler flags --enable-msvc Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin. --enable-static[=PKGS] build static libraries [default=no] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-dependency-linking disable linking library dependencies into shared libraries --disable-pkg-config disable use of pkg-config (if available) --disable-interpackage-dependencies disables deduction of Makefile dependencies from package linker flags --enable-aboca enables build of Aboca solver (set to 1,2,3,4) --disable-amd-libcheck skip the link check at configuration time --disable-cholmod-libcheck skip the link check at configuration time --enable-gnu-packages compile with GNU packages (disabled by default) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-clp-verbosity specify the debug verbosity level for project Clp --with-clp-checklevel specify the sanity check level for project Clp --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-coin-instdir prefix of installation directory for precompiled COIN packages --with-coinutils-lib linker flags for using package CoinUtils --with-coinutils-incdir directory with header files for using package CoinUtils --with-coinutils-datadir directory with data files for using package CoinUtils --with-osi-lib linker flags for using package Osi --with-osi-incdir directory with header files for using package Osi --with-osi-datadir directory with data files for using package Osi --with-ositests-lib linker flags for using package OsiTests --with-ositests-incdir directory with header files for using package OsiTests --with-ositests-datadir directory with data files for using package OsiTests --with-sample-lib linker flags for using package Sample --with-sample-incdir directory with header files for using package Sample --with-sample-datadir directory with data files for using package Sample --with-netlib-lib linker flags for using package Netlib --with-netlib-incdir directory with header files for using package Netlib --with-netlib-datadir directory with data files for using package Netlib --with-amd-incdir specify the header file directory for library AMD --with-amd-lib specify the flags used to link with the library AMD --with-cholmod-incdir specify the header file directory for library CHOLMOD --with-cholmod-lib specify the flags used to link with the library CHOLMOD --with-glpk-lib linker flags for using package Glpk --with-glpk-incdir directory with header files for using package Glpk --with-glpk-datadir directory with data files for using package Glpk --with-mumps-lib linker flags for using package Mumps --with-mumps-incdir directory with header files for using package Mumps --with-mumps-datadir directory with data files for using package Mumps --with-wsmp specify WSMP library --with-blas specify BLAS library (or BUILD to enforce use of ThirdParty/Blas) --with-blas-lib linker flags for using package Blas --with-blas-incdir directory with header files for using package Blas --with-blas-datadir directory with data files for using package Blas --with-asl-lib linker flags for using package ASL --with-asl-incdir directory with header files for using package ASL --with-asl-datadir directory with data files for using package ASL --with-dot use dot (from graphviz) when creating documentation with doxygen if available; --without-dot to disable Some influential environment variables: CDEFS Additional -D flags to be used when compiling C code. ADD_CFLAGS Additional C compiler options DBG_CFLAGS Debug C compiler options OPT_CFLAGS Optimize C compiler options CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory MPICC C MPI Compiler CXXDEFS Additional -D flags to be used when compiling C++ code. ADD_CXXFLAGS Additional C++ compiler options DBG_CXXFLAGS Debug C++ compiler options OPT_CXXFLAGS Optimize C++ compiler options CXX C++ compiler command CXXFLAGS C++ compiler flags MPICXX C++ MPI Compiler CPP C preprocessor CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags PKG_CONFIG path to pkg-config utility ADD_FFLAGS Additional Fortran compiler options DBG_FFLAGS Debug Fortran compiler options OPT_FFLAGS Optimize Fortran compiler options MPIF77 Fortran MPI Compiler Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Clp configure 1.16.8 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Clp $as_me 1.16.8, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # List one file in the package so that the configure script can test # whether the package is actually there # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. # As backup, we make sure we don't loose an FLIBS if it has been set # by the user save_FLIBS="$FLIBS" # A useful makefile conditional that is always false if false; then ALWAYS_FALSE_TRUE= ALWAYS_FALSE_FALSE='#' else ALWAYS_FALSE_TRUE='#' ALWAYS_FALSE_FALSE= fi # We set the following variable so that we know later in AC_COIN_FINALIZE # that we are in a project main directory coin_projectdir=yes # Set the project's version numbers cat >>confdefs.h <<_ACEOF #define CLP_VERSION "$PACKAGE_VERSION" _ACEOF coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'` coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'` coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'` if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi cat >>confdefs.h <<_ACEOF #define CLP_VERSION_MAJOR $coin_majorver _ACEOF cat >>confdefs.h <<_ACEOF #define CLP_VERSION_MINOR $coin_minorver _ACEOF cat >>confdefs.h <<_ACEOF #define CLP_VERSION_RELEASE $coin_releasever _ACEOF # We use the following variable to have a string with the upper case # version of the project name COIN_PRJCT=CLP # Set the project's SVN revision number. The complicated sed expression # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up # as a single number. # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svnversion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svnversion"; then ac_cv_prog_have_svnversion="$have_svnversion" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svnversion="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svnversion" && ac_cv_prog_have_svnversion="no" fi fi have_svnversion=$ac_cv_prog_have_svnversion if test -n "$have_svnversion"; then echo "$as_me:$LINENO: result: $have_svnversion" >&5 echo "${ECHO_T}$have_svnversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$have_svnversion" = xyes; then svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null` if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then CLP_SVN_REV=`echo $svn_rev_tmp | sed -n -e 's/^[0-9]*://' -e 's/\([0-9]\)[^0-9]*$/\1/p'` cat >>confdefs.h <<_ACEOF #define CLP_SVN_REV $CLP_SVN_REV _ACEOF fi fi # Capture libtool library version, if given. coin_libversion=14:8:13 # Check if user wants to produce debugging code echo "$as_me:$LINENO: checking whether we want to compile in debug mode" >&5 echo $ECHO_N "checking whether we want to compile in debug mode... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" case "${enableval}" in yes) coin_debug_compile=true if test "${enable_shared+set}" = set; then :; else enable_shared=no fi ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug" >&2;} { (exit 1); exit 1; }; } ;; esac else coin_debug_compile=false fi; # Check whether --enable-debug-clp or --disable-debug-clp was given. if test "${enable_debug_clp+set}" = set; then enableval="$enable_debug_clp" case "${enableval}" in yes) coin_debug_compile=true ;; no) coin_debug_compile=false ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug-clp" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug-clp" >&2;} { (exit 1); exit 1; }; } ;; esac else : fi; # m4_ifvaln([Clp], if test $coin_debug_compile = true; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Check whether --with-clp-verbosity or --without-clp-verbosity was given. if test "${with_clp_verbosity+set}" = set; then withval="$with_clp_verbosity" if test "$withval" = yes; then withval=1 fi coin_clp_verbosity=$withval else coin_clp_verbosity=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_CLP_VERBOSITY $coin_clp_verbosity _ACEOF # Check whether --with-clp-checklevel or --without-clp-checklevel was given. if test "${with_clp_checklevel+set}" = set; then withval="$with_clp_checklevel" if test "$withval" = yes; then withval=1 fi coin_clp_checklevel=$withval else coin_clp_checklevel=0 fi; cat >>confdefs.h <<_ACEOF #define COIN_CLP_CHECKLEVEL $coin_clp_checklevel _ACEOF # m4_ifvaln([Clp], # Get the name of the C++ compiler and appropriate compiler options # for backward compatibility # Check whether --enable-doscompile or --disable-doscompile was given. if test "${enable_doscompile+set}" = set; then enableval="$enable_doscompile" enable_doscompile=$enableval else enable_doscompile=no fi; # Check whether --enable-msvc or --disable-msvc was given. if test "${enable_msvc+set}" = set; then enableval="$enable_msvc" enable_msvc=$enableval else enable_msvc=no if test "$enable_doscompile" = msvc ; then enable_msvc=yes elif test "$enable_doscompile" != no ; then { { echo "$as_me:$LINENO: error: --enable-doscompile=$enable_doscompile not supported anymore." >&5 echo "$as_me: error: --enable-doscompile=$enable_doscompile not supported anymore." >&2;} { (exit 1); exit 1; }; } fi fi; if test "$enable_msvc" = MD; then enable_shared=yes enable_msvc=yes fi if test "$enable_msvc" = yes; then case $build in *-cygwin* | *-mingw*) ;; *) { { echo "$as_me:$LINENO: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&5 echo "$as_me: error: --enable-msvc option makes sense only under Cygwin or MinGW" >&2;} { (exit 1); exit 1; }; } ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # For consistency, we set the C compiler to the same value of the C++ # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" { echo "$as_me:$LINENO: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&5 echo "$as_me: WARNING: C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX" >&2;} fi ;; esac fi coin_has_cc=yes save_cflags="$CFLAGS" # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. # Depending on the user's PATH, when Studio/Workshop cc is not present we may # find /usr/ucb/cc, which is almost certainly not a good choice for the C # compiler. In this case, put cc after gcc. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl gcc" else comps="gcc icl cl" fi ;; *-*-solaris*) # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_sol_cc_compiler+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$sol_cc_compiler"; then ac_cv_prog_sol_cc_compiler="$sol_cc_compiler" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_sol_cc_compiler="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_sol_cc_compiler shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set sol_cc_compiler to just the basename; use the full file name. shift ac_cv_prog_sol_cc_compiler="$as_dir/$ac_word${1+' '}$@" fi fi fi fi sol_cc_compiler=$ac_cv_prog_sol_cc_compiler if test -n "$sol_cc_compiler"; then echo "$as_me:$LINENO: result: $sol_cc_compiler" >&5 echo "${ECHO_T}$sol_cc_compiler" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$sol_cc_compiler" = "cc" ; then comps="cc xlc gcc pgcc icc" else comps="xlc gcc pgcc icc cc" fi ;; *-*-darwin*) comps="clang gcc cc" ;; *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;; *-linux-*) comps="xlc gcc cc pgcc icc" ;; *) comps="xlc_r xlc cc gcc pgcc icc" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } # AC_MSG_NOTICE([C compiler candidates: $comps]) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -z "$CC" ; then { { echo "$as_me:$LINENO: error: Failed to find a C compiler!" >&5 echo "$as_me: error: Failed to find a C compiler!" >&2;} { (exit 1); exit 1; }; } fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; esac if test $coin_cc_is_cl = true; then COIN_CC_IS_CL_TRUE= COIN_CC_IS_CL_FALSE='#' else COIN_CC_IS_CL_TRUE='#' COIN_CC_IS_CL_FALSE= fi # Check if a project specific CFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} if test x$coin_tmp = xset; then eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} fi fi if test x"$CFLAGS" = x; then coin_add_cflags= coin_opt_cflags= coin_dbg_cflags= coin_warn_cflags= if test "$GCC" = "yes"; then case "$CC" in icc* | */icc*) ;; *) coin_opt_cflags="-O3" coin_add_cflags="-pipe" coin_dbg_cflags="-g -O0" coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cflags="-pedantic-errors $coin_warn_cflags" ;; esac esac fi if test -z "$coin_opt_cflags"; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' coin_dbg_cflags='-MDd' else coin_opt_cflags='-MT -O2' coin_dbg_cflags='-MTd' fi coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -Ox' coin_dbg_cflags='-MDd -debug' else coin_opt_cflags='-MT -Ox' coin_dbg_cflags='-MTd -debug' fi coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CC" in icc* | */icc*) coin_opt_cflags="-O3 -ip -mp1" coin_add_cflags="" coin_dbg_cflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cflags="-i_dynamic $coin_add_cflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgcc* | */pgcc*) coin_opt_cflags="-fast" coin_add_cflags="-Kieee -pc 64" coin_dbg_cflags="-g" ;; esac ;; *-ibm-*) case "$CC" in xlc* | */xlc* | mpxlc* | */mpxlc*) coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_cflags="-g" ;; esac ;; *-hp-*) coin_opt_cflags="-O" coin_add_cflags="-Ae" coin_dbg_cflags="-g" ;; *-*-solaris*) coin_opt_cflags="-xO4" coin_dbg_cflags="-g" ;; *-sgi-*) coin_opt_cflags="-O -OPT:Olimit=0" coin_dbg_cflags="-g" ;; esac fi if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then coin_dbg_cflags="-g" fi if test -z "$coin_opt_cflags"; then # Try if -O option works if nothing else is set CFLAGS="-O" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cflags" = xyes; then coin_warn_cflags= fi if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" fi DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" if test "$coin_debug_compile" = "true"; then CFLAGS="$DBG_CFLAGS" else CFLAGS="$OPT_CFLAGS" fi else CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" if test x${DBG_CFLAGS+set} != xset; then DBG_CFLAGS="$CFLAGS" fi if test x${OPT_CFLAGS+set} != xset; then OPT_CFLAGS="$CFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CFLAGS works save_CFLAGS="$CFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: The value CFLAGS=\"$save_CFLAGS\" do not work. I will now just try '-O', but you might want to set CFLAGS manually." >&2;} CFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&5 echo "$as_me: WARNING: This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C compiler options are: $CFLAGS" >&5 echo "$as_me: C compiler options are: $CFLAGS" >&6;} if test x"$MPICC" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C compiler $MPICC" >&5 echo "$as_me: Will use MPI C compiler $MPICC" >&6;} CC="$MPICC" fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #Let's try if that overcomes configuration problem with VC++ 6.0 ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_has_cxx=yes save_cxxflags="$CXXFLAGS" # For *-*-solaris*, promote Studio/Workshop compiler to front of list. case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then comps="icl cl g++" else comps="g++ icl cl" fi ;; *-*-solaris*) comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; *-darwin*) comps="clang++ g++ c++ CC" ;; *-linux-gnu*) comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;; *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; esac # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } # AC_MSG_NOTICE([C++ compiler candidates: $comps]) ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC $comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC $comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler #thus, we test here whether $CXX is actually working ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking whether C++ compiler $CXX works" >&5 echo $ECHO_N "checking whether C++ compiler $CXX works... $ECHO_C" >&6; cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&5 echo "$as_me: error: failed to find a C++ compiler or C++ compiler $CXX does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu coin_cxx_is_cl=false # It seems that we need to cleanup something here for the Windows case "$CXX" in clang* | */clang*) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh mv confdefs.hh confdefs.h coin_cxx_is_cl=true ;; esac # add automake conditional so we can recognize cl compiler in makefile if test $coin_cxx_is_cl = true; then COIN_CXX_IS_CL_TRUE= COIN_CXX_IS_CL_FALSE='#' else COIN_CXX_IS_CL_TRUE='#' COIN_CXX_IS_CL_FALSE= fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no { echo "$as_me:$LINENO: Overruling autoconf; cl does not recognise -g." >&5 echo "$as_me: Overruling autoconf; cl does not recognise -g." >&6;} fi ;; * ) if test x"$CYGPATH_W" = x ; then CYGPATH_W=echo fi ;; esac CXXFLAGS="$save_cxxflags" # Check if a project specific CXXFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} if test x$coin_tmp = xset; then eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} fi fi if test x"$CXXFLAGS" = x; then # ToDo decide whether we want -DNDEBUG for optimization coin_add_cxxflags= coin_opt_cxxflags= coin_dbg_cxxflags= coin_warn_cxxflags= if test "$GXX" = "yes"; then case "$CXX" in icpc* | */icpc*) ;; *) # ToDo decide about unroll-loops coin_opt_cxxflags="-O3" coin_add_cxxflags="-pipe" coin_dbg_cxxflags="-g -O0" coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long" case $build in *-darwin*) ;; *) coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" ;; esac esac fi # Note that we do not need to cover GCC in the following tests. if test -z "$coin_opt_cxxflags"; then case $build in *-cygwin* | *-mingw*) case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -O2' coin_dbg_cxxflags='-MDd' else coin_opt_cxxflags='-MT -O2' coin_dbg_cxxflags='-MTd' fi coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' ;; icl* | */icl* | ICL* | */ICL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cxxflags='-MD -Ox' coin_dbg_cxxflags='-MDd -debug' else coin_opt_cxxflags='-MT -Ox' coin_dbg_cxxflags='-MTd -debug' fi coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' ;; esac ;; *-linux-*) case "$CXX" in icpc* | */icpc*) coin_opt_cxxflags="-O3 -ip -mp1" coin_add_cxxflags="" coin_dbg_cxxflags="-g" # Check if -i_dynamic is necessary (for new glibc library) CXXFLAGS= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_cxxflags="-i_dynamic $coin_add_cxxflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgCC* | */pgCC*) coin_opt_cxxflags="-fast" coin_add_cxxflags="-Kieee -pc 64" coin_dbg_cxxflags="-g" ;; esac ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" coin_dbg_cxxflags="-g" ;; esac ;; *-hp-*) case "$CXX" in aCC* | */aCC* ) coin_opt_cxxflags="-O" coin_add_cxxflags="-AA" coin_dbg_cxxflags="-g" ;; esac ;; *-*-solaris*) coin_opt_cxxflags="-O4" coin_dbg_cxxflags="-g" ;; esac fi # Generic flag settings. If these don't work, add a case above. if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then coin_dbg_cxxflags="-g" fi if test -z "$coin_opt_cxxflags"; then # Try if -O option works if nothing else is set CXXFLAGS=-O cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_cxxflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_cxxflags" = xyes; then coin_warn_cxxflags= fi # Do final setup of flags based on values determined above. if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" fi DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test "$coin_debug_compile" = "true"; then CXXFLAGS="$DBG_CXXFLAGS" else CXXFLAGS="$OPT_CXXFLAGS" fi # Handle the case where CXXFLAGS was set externally. else CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" if test x${DBG_CXXFLAGS+set} != xset; then DBG_CXXFLAGS="$CXXFLAGS" fi if test x${OPT_CXXFLAGS+set} != xset; then OPT_CXXFLAGS="$CXXFLAGS" fi fi # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include if test x$COIN_PRJCT != x; then CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD" fi # Try if CXXFLAGS works save_CXXFLAGS="$CXXFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: The flags CXXFLAGS=\"$save_CXXFLAGS\" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually." >&2;} CXXFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i=0; i++; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$CXXFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&5 echo "$as_me: WARNING: This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually." >&2;} fi fi { echo "$as_me:$LINENO: C++ compiler options are: $CXXFLAGS" >&5 echo "$as_me: C++ compiler options are: $CXXFLAGS" >&6;} if test x"$MPICXX" = x; then :; else { echo "$as_me:$LINENO: Will use MPI C++ compiler $MPICXX" >&5 echo "$as_me: Will use MPI C++ compiler $MPICXX" >&6;} CXX="$MPICXX" fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Initialize automake and libtool { # START coin_disable_shared=no # Test if force_shared has been set if test "x" = xforce_shared; then if test x$enable_shared = xno; then { { echo "$as_me:$LINENO: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&5 echo "$as_me: error: Shared libraries are disabled by user, but this is not feasible with the given options" >&2;} { (exit 1); exit 1; }; } fi enable_shared=yes; else case $build in *-cygwin* | *-mingw*) coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in clang* ) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Building of DLLs not supported in this configuration." >&5 echo "$as_me: Building of DLLs not supported in this configuration." >&6;} ;; *gcc*) if test x"$enable_dependency_linking" = xyes; then coin_disable_shared=no else { echo "$as_me:$LINENO: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&5 echo "$as_me: WARNING: Dependency linking seems to be disabled, so shared libraries (DLLs) will not be built" >&2;} fi ;; *) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; esac fi ;; *-aix*) coin_disable_shared=yes platform=AIX if test x"$enable_shared" = xyes; then { echo "$as_me:$LINENO: WARNING: Shared objects are not supported." >&5 echo "$as_me: WARNING: Shared objects are not supported." >&2;} fi ;; esac fi if test x"$coin_disable_shared" = xyes; then if test x"$enable_shared" = xyes; then : else # we don't disable shared, because it was not selected anyway coin_disable_shared=no fi enable_shared=no fi # By default, we only want the shared objects to be compiled # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=no fi; # Initialize automake echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # AC_MSG_NOTICE([Beginning automake initialisation.]) # Stuff for automake # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='clp' VERSION='1.16.8' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi depcc="$CXX" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE coin_have_externals=no if test "$enable_maintainer_mode" = yes; then # If maintainer mode is chosen, we make sure that the correct versions # of the tools are used, and that we know where libtool.m4 is (to # recreate acinclude.m4) LIBTOOLM4= # Normally, $HOME AUTOTOOLS_DFLT=$HOME echo "$as_me:$LINENO: checking whether we are using the correct autotools" >&5 echo $ECHO_N "checking whether we are using the correct autotools... $ECHO_C" >&6 if test "${ac_cv_use_correct_autotools+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_correct_autotools=check fi echo "$as_me:$LINENO: result: $ac_cv_use_correct_autotools" >&5 echo "${ECHO_T}$ac_cv_use_correct_autotools" >&6 if test $ac_cv_use_correct_autotools = check; then ac_cv_use_correct_autotools=yes # Check if we have autoconf # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_autoconf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_autoconf"; then ac_cv_prog_have_autoconf="$have_autoconf" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_autoconf="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_autoconf" && ac_cv_prog_have_autoconf="no" fi fi have_autoconf=$ac_cv_prog_have_autoconf if test -n "$have_autoconf"; then echo "$as_me:$LINENO: result: $have_autoconf" >&5 echo "${ECHO_T}$have_autoconf" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_autoconf = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find autoconf in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether autoconf is the correct version correct_version='2.59' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of autoconf" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of autoconf... $ECHO_C" >&6 autoconf --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of autoconf as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of autoconf as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable autoconf is picked up from the correct location echo "$as_me:$LINENO: checking whether autoconf is coming from the correct location" >&5 echo $ECHO_N "checking whether autoconf is coming from the correct location... $ECHO_C" >&6 autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` autoconf_dir=`cd $autoconf_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $autoconf_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if we have automake # Extract the first word of "automake", so it can be a program name with args. set dummy automake; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_automake+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_automake"; then ac_cv_prog_have_automake="$have_automake" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_automake="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_automake" && ac_cv_prog_have_automake="no" fi fi have_automake=$ac_cv_prog_have_automake if test -n "$have_automake"; then echo "$as_me:$LINENO: result: $have_automake" >&5 echo "${ECHO_T}$have_automake" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test $have_automake = no; then { { echo "$as_me:$LINENO: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&5 echo "$as_me: error: You specified you want to use maintainer mode, but I cannot find automake in your path." >&2;} { (exit 1); exit 1; }; } fi # Check whether automake is the correct version correct_version='1.9.6' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of automake" >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of automake... $ECHO_C" >&6 automake --version > confauto.out 2>&1 if $EGREP $grep_version confauto.out >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of automake as the first one in your path." >&5 echo "$as_me: error: You don't have the correct version of automake as the first one in your path." >&2;} { (exit 1); exit 1; }; } fi rm -f confauto.out # Check if the executable automake is picked up from the correct location echo "$as_me:$LINENO: checking whether automake is coming from the correct location" >&5 echo $ECHO_N "checking whether automake is coming from the correct location... $ECHO_C" >&6 automake_dir=`which automake | sed -e 's=/automake=='` automake_dir=`cd $automake_dir; pwd` if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/bin else want_dir=$AUTOTOOLS_DIR/bin fi if test $automake_dir = `cd $want_dir; pwd`; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else rm -f confauto.out echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&5 echo "$as_me: error: The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin." >&2;} { (exit 1); exit 1; }; } fi # Check if this is the correct version of libtool (with escaped dots) if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi correct_version='1.5.22' grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` if test -r $want_dir/libtool/ltmain.sh; then have_ltmain=yes : else have_ltmain=no : fi echo "$as_me:$LINENO: checking whether we are using the correct version ($correct_version) of libtool." >&5 echo $ECHO_N "checking whether we are using the correct version ($correct_version) of libtool.... $ECHO_C" >&6 if test $have_ltmain = yes; then if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: You don't have the correct version of libtool." >&5 echo "$as_me: error: You don't have the correct version of libtool." >&2;} { (exit 1); exit 1; }; } fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: I cannot find the ltmain.sh file." >&5 echo "$as_me: error: I cannot find the ltmain.sh file." >&2;} { (exit 1); exit 1; }; } fi fi # Check if we can find the libtool file if test x$AUTOTOOLS_DIR = x; then want_dir=$AUTOTOOLS_DFLT/share else want_dir=$AUTOTOOLS_DIR/share fi if test -r $want_dir/aclocal/libtool.m4; then LIBTOOLM4="$want_dir/aclocal/libtool.m4" : else { { echo "$as_me:$LINENO: error: I cannot find the libtool.m4 file." >&5 echo "$as_me: error: I cannot find the libtool.m4 file." >&2;} { (exit 1); exit 1; }; } : fi # Check if we have an Dependencies file if test -r $srcdir/Dependencies; then coin_have_externals=yes fi # Check if subversion is installed and understands https # Extract the first word of "svn", so it can be a program name with args. set dummy svn; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_have_svn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$have_svn"; then ac_cv_prog_have_svn="$have_svn" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_have_svn="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_have_svn" && ac_cv_prog_have_svn="no" fi fi have_svn=$ac_cv_prog_have_svn if test -n "$have_svn"; then echo "$as_me:$LINENO: result: $have_svn" >&5 echo "${ECHO_T}$have_svn" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$have_svn = xyes; then echo "$as_me:$LINENO: checking whether svn understands https" >&5 echo $ECHO_N "checking whether svn understands https... $ECHO_C" >&6 if test "${ac_cv_svn_understands_https+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else svn --version > confauto.out 2>&1 if $EGREP https confauto.out >/dev/null 2>&1; then ac_cv_svn_understands_https=yes else ac_cv_svn_understands_https=no have_svn=no ac_cv_prog_have_svn=no fi rm -f confauto.out fi echo "$as_me:$LINENO: result: $ac_cv_svn_understands_https" >&5 echo "${ECHO_T}$ac_cv_svn_understands_https" >&6 fi # Find the location of the BuildTools directory BUILDTOOLSDIR= if test -r $srcdir/BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/BuildTools else if test -r $srcdir/../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../BuildTools else if test -r $srcdir/../../BuildTools/coin.m4; then BUILDTOOLSDIR=$srcdir/../../BuildTools else { { echo "$as_me:$LINENO: error: Cannot find the BuildTools directory" >&5 echo "$as_me: error: Cannot find the BuildTools directory" >&2;} { (exit better disable maintainer mode.); exit better disable maintainer mode.; }; } fi fi fi # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools" fi # The following variable is set to the name of the directory where # the autotool scripts are located AUX_DIR=$ac_aux_dir fi # helpful variable for the base directory of this package abs_source_dir=`cd $srcdir; pwd` # Stuff for example Makefiles if test x$prefix = xNONE; then full_prefix=$ac_default_prefix else full_prefix=$prefix fi full_prefix=`cd $full_prefix ; pwd` abs_lib_dir=$full_prefix/lib abs_include_dir=$full_prefix/include abs_bin_dir=$full_prefix/bin if test $coin_have_externals = yes && test x$have_svn = xyes; then HAVE_EXTERNALS_TRUE= HAVE_EXTERNALS_FALSE='#' else HAVE_EXTERNALS_TRUE='#' HAVE_EXTERNALS_FALSE= fi # AC_MSG_NOTICE([End automake initialisation.]) LIBTOOL= if test -f ../libtool; then coin_config_dir=.. LIBTOOL='$(SHELL) $(top_builddir)/../libtool' fi if test "x$LIBTOOL" = x; then if test -f ../../libtool; then coin_config_dir=../.. LIBTOOL='$(SHELL) $(top_builddir)/../../libtool' fi fi if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) # Stuff for libtool # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi; echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done fi SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix4* | aix5*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | kfreebsd*-gnu | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 5875 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to clp@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done F77=$ac_ct_F77 fi # Provide some information about the compiler. echo "$as_me:7009:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 else echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux*) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6 else echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 fi echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6 if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6 objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAGIC_CMD=: fi fi fi ;; esac enable_dlopen=no enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default fi; test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8076: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8080: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8344: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8348: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 if test x"$lt_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works=yes fi else lt_prog_compiler_static_works=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 if test x"$lt_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8448: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:8452: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix3*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs=no ;; esac fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var" || \ test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_link (); int main () { dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which library types will actually be built echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags or --without-tags was given. if test "${with_tags+set}" = set; then withval="$with_tags" tagnames="$withval" fi; if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_CXX=yes else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_CXX=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_CXX='+b $libdir' ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix3*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. We must also pass each convience library through # to the system linker between allextract/defaultextract. # The C++ compiler will combine linker options so we # cannot just pass the convience library names through # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix3*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; solaris*) case $cc_basename in CC*) # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. postdeps_CXX='-lCstd -lCrun' ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13237: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:13241: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_CXX=yes fi else lt_prog_compiler_static_works_CXX=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 if test x"$lt_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13341: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:13345: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var_CXX" || \ test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6 if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_CXX" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code=" subroutine t\n return\n end\n" # Code to be used in simple link tests lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6 echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6 echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14911: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14915: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_F77=yes fi else lt_prog_compiler_static_works_F77=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 if test x"$lt_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:15015: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:15019: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix3*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_F77=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_F77=yes else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_F77=no ;; esac fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var_F77" || \ test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6 if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_F77" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no old_archive_cmds_GCJ=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17222: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17226: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_GCJ='-Qoption ld ';; *) lt_prog_compiler_wl_GCJ='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; unicos*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_can_build_shared_GCJ=no ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17490: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17494: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi $rm conftest* fi echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_GCJ=yes fi else lt_prog_compiler_static_works_GCJ=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17594: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:17598: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix3*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else ld_shlibs_GCJ=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = no; then runpath_var= hardcode_libdir_flag_spec_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct_GCJ=yes else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_GCJ=no ;; esac fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; *) whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6 test "$ld_shlibs_GCJ" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ pic_flag=$lt_prog_compiler_pic_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 ;; esac fi ;; esac echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var_GCJ" || \ test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6 if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_GCJ" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path_RC" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion # No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- # AC_REQUIRE([AC_COIN_DLFCN_H]) # NEW: If libtool exists in the directory higher up, we use that one # instead of creating a new one # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED # out in front of this macro body. You'll notice that LIBTOOL is already # defined here. We'll have to count on this macro not being called if libtool # already exists, or at least move the libtool fixes outside the conditional. # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".]) # This test is therefore removed. -- lh, 061214 -- # if test "x$LIBTOOL" = x; then # AC_MSG_NOTICE([Calling PROG_LIBTOOL.]) # AC_MSG_NOTICE([Finished PROG_LIBTOOL.]) { echo "$as_me:$LINENO: Build is \"$build\"." >&5 echo "$as_me: Build is \"$build\"." >&6;} mydos2unix='| dos2unix' case $build in *-mingw*) CYGPATH_W=echo mydos2unix= ;; esac case $build in # Here we need to check if -m32 is specified. If so, we need to correct # sys_lib_search_path_spec *-cygwin* | *-mingw*) case "$CXX" in clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? { echo "$as_me:$LINENO: Applying patches to libtool for CLANG compiler" >&5 echo "$as_me: Applying patches to libtool for CLANG compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) { echo "$as_me:$LINENO: Applying patches to libtool for cl compiler" >&5 echo "$as_me: Applying patches to libtool for cl compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ -e 's%lib /OUT:%lib -OUT:%' \ -e "s%cygpath -w%$CYGPATH_W%" \ -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$1"'); done%' \ -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$1"') '"$mydos2unix"'%' \ -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ libtool > conftest.bla ;; *) { echo "$as_me:$LINENO: Applying patches to libtool for GNU compiler" >&5 echo "$as_me: Applying patches to libtool for GNU compiler" >&6;} sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ -e 's|libext="lib"|libext="a"|' \ libtool > conftest.bla ;; esac mv conftest.bla libtool chmod 755 libtool ;; *x86_64-*) if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then { echo "$as_me:$LINENO: Applying patches to libtool for 32bit compilation" >&5 echo "$as_me: Applying patches to libtool for 32bit compilation" >&6;} sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi ;; *-solaris*) if test "$GCC" = yes && \ (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then hdwisa=`isainfo | sed -e 's/\([^ ]*\) .*$/\1/'` if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then { echo "$as_me:$LINENO: Applying patches to libtool for 64-bit GCC compilation" >&5 echo "$as_me: Applying patches to libtool for 64-bit GCC compilation" >&6;} fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then # AC_MSG_NOTICE(Compensating for broken gcc) for lib in $fixlibtmp ; do if test -d "${lib}${hdwisa}" ; then syslibpath64="$syslibpath64 ${lib}${hdwisa}/" fi done syslibpath64="${syslibpath64} ${fixlibtmp}" else syslibpath64="$fixlibtmp" fi sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool fi # AC_MSG_NOTICE(Result is ) # $EGREP 'sys_lib_search_path_spec=' libtool fi ;; # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. *-darwin*) { echo "$as_me:$LINENO: Applying patches to libtool for Darwin" >&5 echo "$as_me: Applying patches to libtool for Darwin" >&6;} sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ libtool > conftest.bla mv conftest.bla libtool chmod 755 libtool ;; esac # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of # the macro. -- lh, 061214 -- # fi # AC_MSG_NOTICE([End libtool initialisation.]) # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) # set RPATH_FLAGS to the compiler link flags required to hardcode location # of the shared objects RPATH_FLAGS= if test $enable_shared = yes; then case $build in *-linux-*) if test "$GXX" = "yes"; then RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" done fi ;; *-darwin*) RPATH_FLAGS=nothing ;; *-ibm-*) case "$CXX" in xlC* | */xlC* | mpxlC* | */mpxlC*) RPATH_FLAGS=nothing ;; esac ;; *-hp-*) RPATH_FLAGS=nothing ;; *-mingw32) RPATH_FLAGS=nothing ;; *-*-solaris*) RPATH_FLAGS= for dir in $abs_lib_dir; do RPATH_FLAGS="$RPATH_FLAGS -R$dir" done esac if test "$RPATH_FLAGS" = ""; then { echo "$as_me:$LINENO: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&5 echo "$as_me: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&2;} fi if test "$RPATH_FLAGS" = "nothing"; then RPATH_FLAGS= fi fi else { echo "$as_me:$LINENO: Using libtool script in directory $coin_config_dir" >&5 echo "$as_me: Using libtool script in directory $coin_config_dir" >&6;} # get all missing information from the config.log file # output variables and defines as_save_IFS=$IFS IFS=' ' for oneline in `cat $coin_config_dir/config.status`; do case "$oneline" in # First some automake conditionals s,@am__fastdep* | s,@AR@* | s,@CPP@* | s,@CPPFLAGS@* | s,@CXXCPP@* | \ s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \ s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \ s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; s,@DEFS@* ) command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` # echo "$command" eval "$command" ;; esac done IFS=$as_save_IFS # And some defines (assuming here that the packages base dir # doesn't have a config.h file for word in $defsline; do # echo word $word case $word in -DHAVE_[A-Z_]*_H=1 | -DSTDC_HEADERS=1 ) i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` # echo dd $i echo $i >>confdefs.h ;; esac done fi # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) # Check whether --enable-dependency-linking or --disable-dependency-linking was given. if test "${enable_dependency_linking+set}" = set; then enableval="$enable_dependency_linking" dependency_linking="$enableval" else dependency_linking=auto fi; if test "$dependency_linking" = auto; then # On Cygwin and AIX, building DLLs doesn't work dependency_linking=no if test x"$coin_disable_shared" = xno; then case $build in *-cygwin* | *-mingw*) case "$CC" in clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) dependency_linking=no ;; *gcc*) dependency_linking=yes ;; *) dependency_linking=yes ;; esac ;; *) dependency_linking=yes ;; esac fi fi if test "$dependency_linking" = yes ; then LT_LDFLAGS="-no-undefined" else LT_LDFLAGS= fi if test "$dependency_linking" = yes; then DEPENDENCY_LINKING_TRUE= DEPENDENCY_LINKING_FALSE='#' else DEPENDENCY_LINKING_TRUE='#' DEPENDENCY_LINKING_FALSE= fi # Check if we want to set the library version echo "$as_me:$LINENO: checking if library version is set" >&5 echo $ECHO_N "checking if library version is set... $ECHO_C" >&6 if test x"$coin_libversion" != x; then LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion" echo "$as_me:$LINENO: result: $coin_libversion" >&5 echo "${ECHO_T}$coin_libversion" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi #END } ############################################################################# # COIN-OR components # ############################################################################# # Check whether --enable-pkg-config or --disable-pkg-config was given. if test "${enable_pkg_config+set}" = set; then enableval="$enable_pkg_config" use_pkgconfig="$enableval" else if test x$coin_cc_is_cl = xtrue; then use_pkgconfig=no else use_pkgconfig=yes fi fi; if test $use_pkgconfig = yes ; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PKG_CONFIG=$ac_cv_prog_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_PKG_CONFIG"; then ac_ct_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_PKG_CONFIG"; then ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG if test -n "$ac_ct_PKG_CONFIG"; then echo "$as_me:$LINENO: result: $ac_ct_PKG_CONFIG" >&5 echo "${ECHO_T}$ac_ct_PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi PKG_CONFIG=$ac_ct_PKG_CONFIG else PKG_CONFIG="$ac_cv_prog_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.16.0 echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 PKG_CONFIG="" fi fi # check if pkg-config supports the short-errors flag if test -n "$PKG_CONFIG" && \ $PKG_CONFIG --atleast-pkgconfig-version 0.20; then pkg_short_errors=" --short-errors " else pkg_short_errors="" fi fi if test -n "$PKG_CONFIG"; then COIN_HAS_PKGCONFIG_TRUE= COIN_HAS_PKGCONFIG_FALSE='#' else COIN_HAS_PKGCONFIG_TRUE='#' COIN_HAS_PKGCONFIG_FALSE= fi # assemble pkg-config search path for installed projects COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" # let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there # best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig, # unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}... if test "x${prefix}" = xNONE ; then COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" else COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi # Check whether --with-coin-instdir or --without-coin-instdir was given. if test "${with_coin_instdir+set}" = set; then withval="$with_coin_instdir" if test -d "$withval"; then : ; else { { echo "$as_me:$LINENO: error: argument for --with-coin-instdir not a directory" >&5 echo "$as_me: error: argument for --with-coin-instdir not a directory" >&2;} { (exit 1); exit 1; }; } fi COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" fi; # assemble additional pkg-config search paths for uninstalled projects if test x$coin_projectdir = xyes ; then # if we are in a project setup, then in a classic setup, we want to find uninstalled projects # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory # unfortunately, if the user set prefix, then we do not know where the project base directory is located # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data) COIN_PKG_CONFIG_PATH_UNINSTALLED= if test -f ../coin_subdirs.txt ; then for i in `cat ../coin_subdirs.txt` ; do if test -d ../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi if test -f ../../coin_subdirs.txt ; then for i in `cat ../../coin_subdirs.txt` ; do if test -d ../../$i ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi if test -d ../../$i/pkgconfig ; then COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}" fi done fi fi if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then { echo "$as_me:$LINENO: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&5 echo "$as_me: WARNING: Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config." >&2;} fi echo "$as_me:$LINENO: checking for COIN-OR package CoinUtils" >&5 echo $ECHO_N "checking for COIN-OR package CoinUtils... $ECHO_C" >&6 coin_has_coinutils=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "CoinUtils"; then coin_has_coinutils=skipping fi done fi if test "$coin_has_coinutils" != skipping; then # Check whether --with-m4_tolower(CoinUtils) or --without-m4_tolower(CoinUtils) was given. if test "${with_coinutils+set}" = set; then withval="$with_coinutils" if test "$withval" = no ; then coin_has_coinutils=skipping fi fi; fi COINUTILS_LIBS= COINUTILS_CFLAGS= COINUTILS_DATA= COINUTILS_DEPENDENCIES= COINUTILS_PCLIBS= COINUTILS_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-lib or --without-m4_tolower(CoinUtils)-lib was given. if test "${with_coinutils_lib+set}" = set; then withval="$with_coinutils_lib" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_LIBS="$withval" COINUTILS_PCLIBS="$withval" CLPLIB_PCLIBS="$withval $CLPLIB_PCLIBS" CLPLIB_LIBS="$withval $CLPLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_LIBS_INSTALLED="$withval" CLPLIB_LIBS_INSTALLED="$withval $CLPLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-incdir or --without-m4_tolower(CoinUtils)-incdir was given. if test "${with_coinutils_incdir+set}" = set; then withval="$with_coinutils_incdir" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_CFLAGS="-I`${CYGPATH_W} $withval`" CLPLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CLPLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_CFLAGS_INSTALLED="$COINUTILS_CFLAGS" CLPLIB_CFLAGS_INSTALLED="$COINUTILS_CFLAGS $CLPLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_coinutils != skipping; then # Check whether --with-m4_tolower(CoinUtils)-datadir or --without-m4_tolower(CoinUtils)-datadir was given. if test "${with_coinutils_datadir+set}" = set; then withval="$with_coinutils_datadir" if test "$withval" = no ; then coin_has_coinutils=skipping else coin_has_coinutils=yes COINUTILS_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then COINUTILS_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_coinutils = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinutils"; then COINUTILS_VERSIONS=`$PKG_CONFIG --modversion "coinutils" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinutils" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS="$cflags" COINUTILS_LIBS=`$PKG_CONFIG --libs "coinutils" 2>/dev/null` COINUTILS_DATA=`$PKG_CONFIG --variable=datadir "coinutils" 2>/dev/null` coin_has_coinutils=yes echo "$as_me:$LINENO: result: yes: $COINUTILS_VERSIONS" >&5 echo "${ECHO_T}yes: $COINUTILS_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then COINUTILS_LIBS=`echo " $COINUTILS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi COINUTILS_PCREQUIRES="coinutils" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in ClpLib CLPLIB_PCREQUIRES="coinutils $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$COINUTILS_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$COINUTILS_LIBS $CLPLIB_LIBS" else COINUTILS_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinutils"` coin_has_coinutils=notGiven echo "$as_me:$LINENO: result: not given: $COINUTILS_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $COINUTILS_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module CoinUtils without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module CoinUtils without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package CoinUtils (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package CoinUtils (fallback)... $ECHO_C" >&6 coin_has_coinutils=notGiven COINUTILS_LIBS= COINUTILS_LIBS_INSTALLED= COINUTILS_CFLAGS= COINUTILS_CFLAGS_INSTALLED= COINUTILS_DATA= COINUTILS_DATA_INSTALLED= COINUTILS_PCLIBS= COINUTILS_PCREQUIRES= # initial list of dependencies is "coinutils", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinutils" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$COINUTILS_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` COINUTILS_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$COINUTILS_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi COINUTILS_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS="$projcflags $COINUTILS_CFLAGS" # set LIBS variable COINUTILS_LIBS="$projlibs $COINUTILS_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi COINUTILS_CFLAGS_INSTALLED="$projcflags $COINUTILS_CFLAGS_INSTALLED" # set LIBS variable COINUTILS_LIBS_INSTALLED="$projlibs $COINUTILS_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_coinutils=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_COINUTILS 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then COINUTILS_LIBS=`echo " $COINUTILS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` COINUTILS_LIBS_INSTALLED=`echo " $COINUTILS_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi COINUTILS_PCREQUIRES="coinutils" CLPLIB_PCREQUIRES="coinutils $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$COINUTILS_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$COINUTILS_LIBS $CLPLIB_LIBS" CLPLIB_CFLAGS_INSTALLED="$COINUTILS_CFLAGS_INSTALLED $CLPLIB_CFLAGS_INSTALLED" CLPLIB_LIBS_INSTALLED="$COINUTILS_LIBS_INSTALLED $CLPLIB_LIBS_INSTALLED" fi if test $coin_has_coinutils != notGiven && test $coin_has_coinutils != skipping; then COIN_HAS_COINUTILS_TRUE= COIN_HAS_COINUTILS_FALSE='#' else COIN_HAS_COINUTILS_TRUE='#' COIN_HAS_COINUTILS_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_coinutils" >&5 echo "${ECHO_T}$coin_has_coinutils" >&6 fi if test $coin_has_coinutils != skipping && test $coin_has_coinutils != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_COINUTILS 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) COINUTILS_DEPENDENCIES=`echo " $COINUTILS_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CLPLIB_DEPENDENCIES=`echo " $CLPLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$COINUTILS_CFLAGS" ; then { echo "$as_me:$LINENO: CoinUtils CFLAGS are $COINUTILS_CFLAGS" >&5 echo "$as_me: CoinUtils CFLAGS are $COINUTILS_CFLAGS" >&6;} fi if test -n "$COINUTILS_LIBS" ; then { echo "$as_me:$LINENO: CoinUtils LIBS are $COINUTILS_LIBS" >&5 echo "$as_me: CoinUtils LIBS are $COINUTILS_LIBS" >&6;} fi if test -n "$COINUTILS_DEPENDENCIES" ; then { echo "$as_me:$LINENO: CoinUtils DEPENDENCIES are $COINUTILS_DEPENDENCIES" >&5 echo "$as_me: CoinUtils DEPENDENCIES are $COINUTILS_DEPENDENCIES" >&6;} fi if test -n "$COINUTILS_DATA" ; then { echo "$as_me:$LINENO: CoinUtils DATA is $COINUTILS_DATA" >&5 echo "$as_me: CoinUtils DATA is $COINUTILS_DATA" >&6;} fi if test -n "$COINUTILS_PCLIBS" ; then { echo "$as_me:$LINENO: CoinUtils PCLIBS are $COINUTILS_PCLIBS" >&5 echo "$as_me: CoinUtils PCLIBS are $COINUTILS_PCLIBS" >&6;} fi if test -n "$COINUTILS_PCREQUIRES" ; then { echo "$as_me:$LINENO: CoinUtils PCREQUIRES are $COINUTILS_PCREQUIRES" >&5 echo "$as_me: CoinUtils PCREQUIRES are $COINUTILS_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&5 echo "$as_me: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: ClpLib LIBS are $CLPLIB_LIBS" >&5 echo "$as_me: ClpLib LIBS are $CLPLIB_LIBS" >&6;} { echo "$as_me:$LINENO: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&5 echo "$as_me: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_coinutils != notGiven && test $coin_has_coinutils != skipping; then COIN_HAS_COINUTILS_TRUE= COIN_HAS_COINUTILS_FALSE='#' else COIN_HAS_COINUTILS_TRUE='#' COIN_HAS_COINUTILS_FALSE= fi if test $coin_has_coinutils != yes ; then { { echo "$as_me:$LINENO: error: Required package CoinUtils not available." >&5 echo "$as_me: error: Required package CoinUtils not available." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for COIN-OR package Osi" >&5 echo $ECHO_N "checking for COIN-OR package Osi... $ECHO_C" >&6 coin_has_osi=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Osi"; then coin_has_osi=skipping fi done fi if test "$coin_has_osi" != skipping; then # Check whether --with-m4_tolower(Osi) or --without-m4_tolower(Osi) was given. if test "${with_osi+set}" = set; then withval="$with_osi" if test "$withval" = no ; then coin_has_osi=skipping fi fi; fi OSI_LIBS= OSI_CFLAGS= OSI_DATA= OSI_DEPENDENCIES= OSI_PCLIBS= OSI_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_osi != skipping; then # Check whether --with-m4_tolower(Osi)-lib or --without-m4_tolower(Osi)-lib was given. if test "${with_osi_lib+set}" = set; then withval="$with_osi_lib" if test "$withval" = no ; then coin_has_osi=skipping else coin_has_osi=yes OSI_LIBS="$withval" OSI_PCLIBS="$withval" OSICLPLIB_PCLIBS="$withval $OSICLPLIB_PCLIBS" OSICLPLIB_LIBS="$withval $OSICLPLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSI_LIBS_INSTALLED="$withval" OSICLPLIB_LIBS_INSTALLED="$withval $OSICLPLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_osi != skipping; then # Check whether --with-m4_tolower(Osi)-incdir or --without-m4_tolower(Osi)-incdir was given. if test "${with_osi_incdir+set}" = set; then withval="$with_osi_incdir" if test "$withval" = no ; then coin_has_osi=skipping else coin_has_osi=yes OSI_CFLAGS="-I`${CYGPATH_W} $withval`" OSICLPLIB_CFLAGS="-I`${CYGPATH_W} $withval` $OSICLPLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSI_CFLAGS_INSTALLED="$OSI_CFLAGS" OSICLPLIB_CFLAGS_INSTALLED="$OSI_CFLAGS $OSICLPLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_osi != skipping; then # Check whether --with-m4_tolower(Osi)-datadir or --without-m4_tolower(Osi)-datadir was given. if test "${with_osi_datadir+set}" = set; then withval="$with_osi_datadir" if test "$withval" = no ; then coin_has_osi=skipping else coin_has_osi=yes OSI_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSI_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_osi = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi"; then OSI_VERSIONS=`$PKG_CONFIG --modversion "osi" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSI_CFLAGS="$cflags" OSI_LIBS=`$PKG_CONFIG --libs "osi" 2>/dev/null` OSI_DATA=`$PKG_CONFIG --variable=datadir "osi" 2>/dev/null` coin_has_osi=yes echo "$as_me:$LINENO: result: yes: $OSI_VERSIONS" >&5 echo "${ECHO_T}yes: $OSI_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSI_LIBS=`echo " $OSI_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSI_PCREQUIRES="osi" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in OsiClpLib OSICLPLIB_PCREQUIRES="osi $OSICLPLIB_PCREQUIRES" OSICLPLIB_CFLAGS="$OSI_CFLAGS $OSICLPLIB_CFLAGS" OSICLPLIB_LIBS="$OSI_LIBS $OSICLPLIB_LIBS" else OSI_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi"` coin_has_osi=notGiven echo "$as_me:$LINENO: result: not given: $OSI_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSI_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Osi without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Osi without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Osi (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Osi (fallback)... $ECHO_C" >&6 coin_has_osi=notGiven OSI_LIBS= OSI_LIBS_INSTALLED= OSI_CFLAGS= OSI_CFLAGS_INSTALLED= OSI_DATA= OSI_DATA_INSTALLED= OSI_PCLIBS= OSI_PCREQUIRES= # initial list of dependencies is "osi", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSI_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSI_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSI_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSI_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSI_CFLAGS="$projcflags $OSI_CFLAGS" # set LIBS variable OSI_LIBS="$projlibs $OSI_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSI_CFLAGS_INSTALLED="$projcflags $OSI_CFLAGS_INSTALLED" # set LIBS variable OSI_LIBS_INSTALLED="$projlibs $OSI_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_osi=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSI 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSI_LIBS=`echo " $OSI_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSI_LIBS_INSTALLED=`echo " $OSI_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSI_PCREQUIRES="osi" OSICLPLIB_PCREQUIRES="osi $OSICLPLIB_PCREQUIRES" OSICLPLIB_CFLAGS="$OSI_CFLAGS $OSICLPLIB_CFLAGS" OSICLPLIB_LIBS="$OSI_LIBS $OSICLPLIB_LIBS" OSICLPLIB_CFLAGS_INSTALLED="$OSI_CFLAGS_INSTALLED $OSICLPLIB_CFLAGS_INSTALLED" OSICLPLIB_LIBS_INSTALLED="$OSI_LIBS_INSTALLED $OSICLPLIB_LIBS_INSTALLED" fi if test $coin_has_osi != notGiven && test $coin_has_osi != skipping; then COIN_HAS_OSI_TRUE= COIN_HAS_OSI_FALSE='#' else COIN_HAS_OSI_TRUE='#' COIN_HAS_OSI_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_osi" >&5 echo "${ECHO_T}$coin_has_osi" >&6 fi if test $coin_has_osi != skipping && test $coin_has_osi != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSI 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSI_DEPENDENCIES=`echo " $OSI_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` OSICLPLIB_DEPENDENCIES=`echo " $OSICLPLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSI_CFLAGS" ; then { echo "$as_me:$LINENO: Osi CFLAGS are $OSI_CFLAGS" >&5 echo "$as_me: Osi CFLAGS are $OSI_CFLAGS" >&6;} fi if test -n "$OSI_LIBS" ; then { echo "$as_me:$LINENO: Osi LIBS are $OSI_LIBS" >&5 echo "$as_me: Osi LIBS are $OSI_LIBS" >&6;} fi if test -n "$OSI_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Osi DEPENDENCIES are $OSI_DEPENDENCIES" >&5 echo "$as_me: Osi DEPENDENCIES are $OSI_DEPENDENCIES" >&6;} fi if test -n "$OSI_DATA" ; then { echo "$as_me:$LINENO: Osi DATA is $OSI_DATA" >&5 echo "$as_me: Osi DATA is $OSI_DATA" >&6;} fi if test -n "$OSI_PCLIBS" ; then { echo "$as_me:$LINENO: Osi PCLIBS are $OSI_PCLIBS" >&5 echo "$as_me: Osi PCLIBS are $OSI_PCLIBS" >&6;} fi if test -n "$OSI_PCREQUIRES" ; then { echo "$as_me:$LINENO: Osi PCREQUIRES are $OSI_PCREQUIRES" >&5 echo "$as_me: Osi PCREQUIRES are $OSI_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: OsiClpLib CFLAGS are $OSICLPLIB_CFLAGS" >&5 echo "$as_me: OsiClpLib CFLAGS are $OSICLPLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: OsiClpLib LIBS are $OSICLPLIB_LIBS" >&5 echo "$as_me: OsiClpLib LIBS are $OSICLPLIB_LIBS" >&6;} { echo "$as_me:$LINENO: OsiClpLib DEPENDENCIES are $OSICLPLIB_DEPENDENCIES" >&5 echo "$as_me: OsiClpLib DEPENDENCIES are $OSICLPLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_osi != notGiven && test $coin_has_osi != skipping; then COIN_HAS_OSI_TRUE= COIN_HAS_OSI_FALSE='#' else COIN_HAS_OSI_TRUE='#' COIN_HAS_OSI_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package OsiTests" >&5 echo $ECHO_N "checking for COIN-OR package OsiTests... $ECHO_C" >&6 coin_has_ositests=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "OsiTests"; then coin_has_ositests=skipping fi done fi if test "$coin_has_ositests" != skipping; then # Check whether --with-m4_tolower(OsiTests) or --without-m4_tolower(OsiTests) was given. if test "${with_ositests+set}" = set; then withval="$with_ositests" if test "$withval" = no ; then coin_has_ositests=skipping fi fi; fi OSITESTS_LIBS= OSITESTS_CFLAGS= OSITESTS_DATA= OSITESTS_DEPENDENCIES= OSITESTS_PCLIBS= OSITESTS_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_ositests != skipping; then # Check whether --with-m4_tolower(OsiTests)-lib or --without-m4_tolower(OsiTests)-lib was given. if test "${with_ositests_lib+set}" = set; then withval="$with_ositests_lib" if test "$withval" = no ; then coin_has_ositests=skipping else coin_has_ositests=yes OSITESTS_LIBS="$withval" OSITESTS_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSITESTS_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_ositests != skipping; then # Check whether --with-m4_tolower(OsiTests)-incdir or --without-m4_tolower(OsiTests)-incdir was given. if test "${with_ositests_incdir+set}" = set; then withval="$with_ositests_incdir" if test "$withval" = no ; then coin_has_ositests=skipping else coin_has_ositests=yes OSITESTS_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSITESTS_CFLAGS_INSTALLED="$OSITESTS_CFLAGS" fi fi fi; fi if test $coin_has_ositests != skipping; then # Check whether --with-m4_tolower(OsiTests)-datadir or --without-m4_tolower(OsiTests)-datadir was given. if test "${with_ositests_datadir+set}" = set; then withval="$with_ositests_datadir" if test "$withval" = no ; then coin_has_ositests=skipping else coin_has_ositests=yes OSITESTS_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then OSITESTS_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_ositests = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "osi-unittests"; then OSITESTS_VERSIONS=`$PKG_CONFIG --modversion "osi-unittests" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "osi-unittests" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSITESTS_CFLAGS="$cflags" OSITESTS_LIBS=`$PKG_CONFIG --libs "osi-unittests" 2>/dev/null` OSITESTS_DATA=`$PKG_CONFIG --variable=datadir "osi-unittests" 2>/dev/null` coin_has_ositests=yes echo "$as_me:$LINENO: result: yes: $OSITESTS_VERSIONS" >&5 echo "${ECHO_T}yes: $OSITESTS_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSITESTS_LIBS=`echo " $OSITESTS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi OSITESTS_PCREQUIRES="osi-unittests" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else OSITESTS_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "osi-unittests"` coin_has_ositests=notGiven echo "$as_me:$LINENO: result: not given: $OSITESTS_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $OSITESTS_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module OsiTests without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module OsiTests without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package OsiTests (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package OsiTests (fallback)... $ECHO_C" >&6 coin_has_ositests=notGiven OSITESTS_LIBS= OSITESTS_LIBS_INSTALLED= OSITESTS_CFLAGS= OSITESTS_CFLAGS_INSTALLED= OSITESTS_DATA= OSITESTS_DATA_INSTALLED= OSITESTS_PCLIBS= OSITESTS_PCREQUIRES= # initial list of dependencies is "osi-unittests", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="osi-unittests" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$OSITESTS_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` OSITESTS_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$OSITESTS_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi OSITESTS_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSITESTS_CFLAGS="$projcflags $OSITESTS_CFLAGS" # set LIBS variable OSITESTS_LIBS="$projlibs $OSITESTS_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi OSITESTS_CFLAGS_INSTALLED="$projcflags $OSITESTS_CFLAGS_INSTALLED" # set LIBS variable OSITESTS_LIBS_INSTALLED="$projlibs $OSITESTS_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_ositests=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSITESTS 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then OSITESTS_LIBS=`echo " $OSITESTS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` OSITESTS_LIBS_INSTALLED=`echo " $OSITESTS_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi OSITESTS_PCREQUIRES="osi-unittests" fi if test $coin_has_ositests != notGiven && test $coin_has_ositests != skipping; then COIN_HAS_OSITESTS_TRUE= COIN_HAS_OSITESTS_FALSE='#' else COIN_HAS_OSITESTS_TRUE='#' COIN_HAS_OSITESTS_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_ositests" >&5 echo "${ECHO_T}$coin_has_ositests" >&6 fi if test $coin_has_ositests != skipping && test $coin_has_ositests != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_OSITESTS 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) OSITESTS_DEPENDENCIES=`echo " $OSITESTS_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$OSITESTS_CFLAGS" ; then { echo "$as_me:$LINENO: OsiTests CFLAGS are $OSITESTS_CFLAGS" >&5 echo "$as_me: OsiTests CFLAGS are $OSITESTS_CFLAGS" >&6;} fi if test -n "$OSITESTS_LIBS" ; then { echo "$as_me:$LINENO: OsiTests LIBS are $OSITESTS_LIBS" >&5 echo "$as_me: OsiTests LIBS are $OSITESTS_LIBS" >&6;} fi if test -n "$OSITESTS_DEPENDENCIES" ; then { echo "$as_me:$LINENO: OsiTests DEPENDENCIES are $OSITESTS_DEPENDENCIES" >&5 echo "$as_me: OsiTests DEPENDENCIES are $OSITESTS_DEPENDENCIES" >&6;} fi if test -n "$OSITESTS_DATA" ; then { echo "$as_me:$LINENO: OsiTests DATA is $OSITESTS_DATA" >&5 echo "$as_me: OsiTests DATA is $OSITESTS_DATA" >&6;} fi if test -n "$OSITESTS_PCLIBS" ; then { echo "$as_me:$LINENO: OsiTests PCLIBS are $OSITESTS_PCLIBS" >&5 echo "$as_me: OsiTests PCLIBS are $OSITESTS_PCLIBS" >&6;} fi if test -n "$OSITESTS_PCREQUIRES" ; then { echo "$as_me:$LINENO: OsiTests PCREQUIRES are $OSITESTS_PCREQUIRES" >&5 echo "$as_me: OsiTests PCREQUIRES are $OSITESTS_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_ositests != notGiven && test $coin_has_ositests != skipping; then COIN_HAS_OSITESTS_TRUE= COIN_HAS_OSITESTS_FALSE='#' else COIN_HAS_OSITESTS_TRUE='#' COIN_HAS_OSITESTS_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Sample" >&5 echo $ECHO_N "checking for COIN-OR package Sample... $ECHO_C" >&6 coin_has_sample=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Sample"; then coin_has_sample=skipping fi done fi if test "$coin_has_sample" != skipping; then # Check whether --with-m4_tolower(Sample) or --without-m4_tolower(Sample) was given. if test "${with_sample+set}" = set; then withval="$with_sample" if test "$withval" = no ; then coin_has_sample=skipping fi fi; fi SAMPLE_LIBS= SAMPLE_CFLAGS= SAMPLE_DATA= SAMPLE_DEPENDENCIES= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-lib or --without-m4_tolower(Sample)-lib was given. if test "${with_sample_lib+set}" = set; then withval="$with_sample_lib" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_LIBS="$withval" SAMPLE_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-incdir or --without-m4_tolower(Sample)-incdir was given. if test "${with_sample_incdir+set}" = set; then withval="$with_sample_incdir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_CFLAGS_INSTALLED="$SAMPLE_CFLAGS" fi fi fi; fi if test $coin_has_sample != skipping; then # Check whether --with-m4_tolower(Sample)-datadir or --without-m4_tolower(Sample)-datadir was given. if test "${with_sample_datadir+set}" = set; then withval="$with_sample_datadir" if test "$withval" = no ; then coin_has_sample=skipping else coin_has_sample=yes SAMPLE_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then SAMPLE_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_sample = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatasample"; then SAMPLE_VERSIONS=`$PKG_CONFIG --modversion "coindatasample" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatasample" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$cflags" SAMPLE_LIBS=`$PKG_CONFIG --libs "coindatasample" 2>/dev/null` SAMPLE_DATA=`$PKG_CONFIG --variable=datadir "coindatasample" 2>/dev/null` coin_has_sample=yes echo "$as_me:$LINENO: result: yes: $SAMPLE_VERSIONS" >&5 echo "${ECHO_T}yes: $SAMPLE_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi SAMPLE_PCREQUIRES="coindatasample" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else SAMPLE_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatasample"` coin_has_sample=notGiven echo "$as_me:$LINENO: result: not given: $SAMPLE_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $SAMPLE_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Sample without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Sample without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Sample (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Sample (fallback)... $ECHO_C" >&6 coin_has_sample=notGiven SAMPLE_LIBS= SAMPLE_LIBS_INSTALLED= SAMPLE_CFLAGS= SAMPLE_CFLAGS_INSTALLED= SAMPLE_DATA= SAMPLE_DATA_INSTALLED= SAMPLE_PCLIBS= SAMPLE_PCREQUIRES= # initial list of dependencies is "coindatasample", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatasample" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$SAMPLE_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` SAMPLE_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$SAMPLE_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi SAMPLE_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS="$projcflags $SAMPLE_CFLAGS" # set LIBS variable SAMPLE_LIBS="$projlibs $SAMPLE_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi SAMPLE_CFLAGS_INSTALLED="$projcflags $SAMPLE_CFLAGS_INSTALLED" # set LIBS variable SAMPLE_LIBS_INSTALLED="$projlibs $SAMPLE_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_sample=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then SAMPLE_LIBS=`echo " $SAMPLE_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` SAMPLE_LIBS_INSTALLED=`echo " $SAMPLE_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi SAMPLE_PCREQUIRES="coindatasample" fi if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_sample" >&5 echo "${ECHO_T}$coin_has_sample" >&6 fi if test $coin_has_sample != skipping && test $coin_has_sample != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_SAMPLE 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) SAMPLE_DEPENDENCIES=`echo " $SAMPLE_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$SAMPLE_CFLAGS" ; then { echo "$as_me:$LINENO: Sample CFLAGS are $SAMPLE_CFLAGS" >&5 echo "$as_me: Sample CFLAGS are $SAMPLE_CFLAGS" >&6;} fi if test -n "$SAMPLE_LIBS" ; then { echo "$as_me:$LINENO: Sample LIBS are $SAMPLE_LIBS" >&5 echo "$as_me: Sample LIBS are $SAMPLE_LIBS" >&6;} fi if test -n "$SAMPLE_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&5 echo "$as_me: Sample DEPENDENCIES are $SAMPLE_DEPENDENCIES" >&6;} fi if test -n "$SAMPLE_DATA" ; then { echo "$as_me:$LINENO: Sample DATA is $SAMPLE_DATA" >&5 echo "$as_me: Sample DATA is $SAMPLE_DATA" >&6;} fi if test -n "$SAMPLE_PCLIBS" ; then { echo "$as_me:$LINENO: Sample PCLIBS are $SAMPLE_PCLIBS" >&5 echo "$as_me: Sample PCLIBS are $SAMPLE_PCLIBS" >&6;} fi if test -n "$SAMPLE_PCREQUIRES" ; then { echo "$as_me:$LINENO: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&5 echo "$as_me: Sample PCREQUIRES are $SAMPLE_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_sample != notGiven && test $coin_has_sample != skipping; then COIN_HAS_SAMPLE_TRUE= COIN_HAS_SAMPLE_FALSE='#' else COIN_HAS_SAMPLE_TRUE='#' COIN_HAS_SAMPLE_FALSE= fi echo "$as_me:$LINENO: checking for COIN-OR package Netlib" >&5 echo $ECHO_N "checking for COIN-OR package Netlib... $ECHO_C" >&6 coin_has_netlib=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Netlib"; then coin_has_netlib=skipping fi done fi if test "$coin_has_netlib" != skipping; then # Check whether --with-m4_tolower(Netlib) or --without-m4_tolower(Netlib) was given. if test "${with_netlib+set}" = set; then withval="$with_netlib" if test "$withval" = no ; then coin_has_netlib=skipping fi fi; fi NETLIB_LIBS= NETLIB_CFLAGS= NETLIB_DATA= NETLIB_DEPENDENCIES= NETLIB_PCLIBS= NETLIB_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-lib or --without-m4_tolower(Netlib)-lib was given. if test "${with_netlib_lib+set}" = set; then withval="$with_netlib_lib" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_LIBS="$withval" NETLIB_PCLIBS="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_LIBS_INSTALLED="$withval" fi fi fi; fi if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-incdir or --without-m4_tolower(Netlib)-incdir was given. if test "${with_netlib_incdir+set}" = set; then withval="$with_netlib_incdir" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_CFLAGS="-I`${CYGPATH_W} $withval`" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_CFLAGS_INSTALLED="$NETLIB_CFLAGS" fi fi fi; fi if test $coin_has_netlib != skipping; then # Check whether --with-m4_tolower(Netlib)-datadir or --without-m4_tolower(Netlib)-datadir was given. if test "${with_netlib_datadir+set}" = set; then withval="$with_netlib_datadir" if test "$withval" = no ; then coin_has_netlib=skipping else coin_has_netlib=yes NETLIB_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then NETLIB_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_netlib = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coindatanetlib"; then NETLIB_VERSIONS=`$PKG_CONFIG --modversion "coindatanetlib" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coindatanetlib" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS="$cflags" NETLIB_LIBS=`$PKG_CONFIG --libs "coindatanetlib" 2>/dev/null` NETLIB_DATA=`$PKG_CONFIG --variable=datadir "coindatanetlib" 2>/dev/null` coin_has_netlib=yes echo "$as_me:$LINENO: result: yes: $NETLIB_VERSIONS" >&5 echo "${ECHO_T}yes: $NETLIB_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then NETLIB_LIBS=`echo " $NETLIB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi NETLIB_PCREQUIRES="coindatanetlib" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in else NETLIB_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coindatanetlib"` coin_has_netlib=notGiven echo "$as_me:$LINENO: result: not given: $NETLIB_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $NETLIB_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Netlib without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Netlib without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Netlib (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Netlib (fallback)... $ECHO_C" >&6 coin_has_netlib=notGiven NETLIB_LIBS= NETLIB_LIBS_INSTALLED= NETLIB_CFLAGS= NETLIB_CFLAGS_INSTALLED= NETLIB_DATA= NETLIB_DATA_INSTALLED= NETLIB_PCLIBS= NETLIB_PCREQUIRES= # initial list of dependencies is "coindatanetlib", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coindatanetlib" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$NETLIB_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` NETLIB_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$NETLIB_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi NETLIB_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS="$projcflags $NETLIB_CFLAGS" # set LIBS variable NETLIB_LIBS="$projlibs $NETLIB_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi NETLIB_CFLAGS_INSTALLED="$projcflags $NETLIB_CFLAGS_INSTALLED" # set LIBS variable NETLIB_LIBS_INSTALLED="$projlibs $NETLIB_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_netlib=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NETLIB 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then NETLIB_LIBS=`echo " $NETLIB_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` NETLIB_LIBS_INSTALLED=`echo " $NETLIB_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi NETLIB_PCREQUIRES="coindatanetlib" fi if test $coin_has_netlib != notGiven && test $coin_has_netlib != skipping; then COIN_HAS_NETLIB_TRUE= COIN_HAS_NETLIB_FALSE='#' else COIN_HAS_NETLIB_TRUE='#' COIN_HAS_NETLIB_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_netlib" >&5 echo "${ECHO_T}$coin_has_netlib" >&6 fi if test $coin_has_netlib != skipping && test $coin_has_netlib != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_NETLIB 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) NETLIB_DEPENDENCIES=`echo " $NETLIB_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$NETLIB_CFLAGS" ; then { echo "$as_me:$LINENO: Netlib CFLAGS are $NETLIB_CFLAGS" >&5 echo "$as_me: Netlib CFLAGS are $NETLIB_CFLAGS" >&6;} fi if test -n "$NETLIB_LIBS" ; then { echo "$as_me:$LINENO: Netlib LIBS are $NETLIB_LIBS" >&5 echo "$as_me: Netlib LIBS are $NETLIB_LIBS" >&6;} fi if test -n "$NETLIB_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Netlib DEPENDENCIES are $NETLIB_DEPENDENCIES" >&5 echo "$as_me: Netlib DEPENDENCIES are $NETLIB_DEPENDENCIES" >&6;} fi if test -n "$NETLIB_DATA" ; then { echo "$as_me:$LINENO: Netlib DATA is $NETLIB_DATA" >&5 echo "$as_me: Netlib DATA is $NETLIB_DATA" >&6;} fi if test -n "$NETLIB_PCLIBS" ; then { echo "$as_me:$LINENO: Netlib PCLIBS are $NETLIB_PCLIBS" >&5 echo "$as_me: Netlib PCLIBS are $NETLIB_PCLIBS" >&6;} fi if test -n "$NETLIB_PCREQUIRES" ; then { echo "$as_me:$LINENO: Netlib PCREQUIRES are $NETLIB_PCREQUIRES" >&5 echo "$as_me: Netlib PCREQUIRES are $NETLIB_PCREQUIRES" >&6;} fi fi fi # Define the Makefile conditional if test $coin_has_netlib != notGiven && test $coin_has_netlib != skipping; then COIN_HAS_NETLIB_TRUE= COIN_HAS_NETLIB_FALSE='#' else COIN_HAS_NETLIB_TRUE='#' COIN_HAS_NETLIB_FALSE= fi ############################################################################# # Aboca # ############################################################################# # 1 - build Abc serial but no inherit code # 2 - build Abc serial and inherit code # 3 - build Abc cilk parallel but no inherit code # 4 - build Abc cilk parallel and inherit code # Check whether --enable-aboca or --disable-aboca was given. if test "${enable_aboca+set}" = set; then enableval="$enable_aboca" use_aboca=$enableval else use_aboca=no fi; if test "$use_aboca" = yes ; then use_aboca=1 fi case "$use_aboca" in 1 | 2 | 3 | 4) cat >>confdefs.h <<_ACEOF #define CLP_HAS_ABC $use_aboca _ACEOF ;; no) ;; *) { { echo "$as_me:$LINENO: error: invalid argument for --enable-aboca: $use_aboca" >&5 echo "$as_me: error: invalid argument for --enable-aboca: $use_aboca" >&2;} { (exit 1); exit 1; }; } ;; esac if test ! "$use_aboca" = no; then COIN_HAS_ABC_TRUE= COIN_HAS_ABC_FALSE='#' else COIN_HAS_ABC_TRUE='#' COIN_HAS_ABC_FALSE= fi ############################################################################# # Third party linear solvers # ############################################################################# # AMD from UFL echo "$as_me:$LINENO: checking if user provides library for AMD" >&5 echo $ECHO_N "checking if user provides library for AMD... $ECHO_C" >&6 # Check for header file directory # Check whether --with-amd-incdir or --without-amd-incdir was given. if test "${with_amd_incdir+set}" = set; then withval="$with_amd_incdir" AMDINCDIR=`cd $withval; pwd` fi; # Check for library directory # Check whether --with-amd-lib or --without-amd-lib was given. if test "${with_amd_lib+set}" = set; then withval="$with_amd_lib" AMDLIB=$withval fi; # Switch to disable library check if requested # Check whether --enable-amd-libcheck or --disable-amd-libcheck was given. if test "${enable_amd_libcheck+set}" = set; then enableval="$enable_amd_libcheck" amd_libcheck=$enableval else amd_libcheck=yes fi; # At this point, if we're going to use the library, both LBRYINCDIR and # LBRYLIB must be defined and not empty. if test x"$AMDINCDIR" != x || test x"$AMDLIB" != x; then if test x"$AMDINCDIR" = x || test x"$AMDLIB" = x; then { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library AMD. Use --with-amd-incdir of environment variable $AMDINCDIR to specify the include directory. Use --with-amd-lib or environment variable $AMDLIB to specify link flags." >&5 echo "$as_me: error: You need to specify both an include directory and link flags to use library AMD. Use --with-amd-incdir of environment variable $AMDINCDIR to specify the include directory. Use --with-amd-lib or environment variable $AMDLIB to specify link flags." >&2;} { (exit 1); exit 1; }; } fi coin_has_amd=true echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else coin_has_amd=false echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # If we have instructions for use, consider header and link checks. if test $coin_has_amd = true; then # If argument 3 (file) is given, check for the file. Typically this will be a # header file, but that's not assumed. if test -r $AMDINCDIR/amd.h; then : else { { echo "$as_me:$LINENO: error: Cannot find file amd.h in $AMDINCDIR" >&5 echo "$as_me: error: Cannot find file amd.h in $AMDINCDIR" >&2;} { (exit 1); exit 1; }; } : fi # Now see if we can link the function. There are arguments for and against # assuming argument 3 is a header file declaring the function. A correct # function declaration is the main argument in favour. Having to cope with # possible dependencies or other oddities are the main arguments against. # Force the use of C as the best single choice amongst C++, C, and Fortran. # Obviously, this has limits. if test x"$amd_libcheck" != xno; then coin_save_LIBS="$LIBS" LIBS="$AMDLIB " coin_AMD_link=no ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for fnm in amd_defaults ; do echo "$as_me:$LINENO: checking whether symbol $fnm is available with AMD" >&5 echo $ECHO_N "checking whether symbol $fnm is available with AMD... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $fnm() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 coin_AMD_link=yes break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$coin_save_LIBS" if test x"$coin_AMD_link" != xyes ; then { { echo "$as_me:$LINENO: error: Cannot find symbol(s) amd_defaults with AMD" >&5 echo "$as_me: error: Cannot find symbol(s) amd_defaults with AMD" >&2;} { (exit 1); exit 1; }; } fi fi # If we make it this far, we've verified the file and linked the function. Add # the necessary link flags to ClpLib_{PC}LIBS and define the preprocessor symbol # COIN_HAS_LBRY. CLPLIB_LIBS="$AMDLIB $CLPLIB_LIBS" CLPLIB_PCLIBS="$AMDLIB $CLPLIB_PCLIBS" CLPLIB_LIBS_INSTALLED="$AMDLIB $CLPLIB_LIBS_INSTALLED" cat >>confdefs.h <<\_ACEOF #define COIN_HAS_AMD 1 _ACEOF fi # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the # automake conditional. These actions must occur unconditionally. if test $coin_has_amd = true; then COIN_HAS_AMD_TRUE= COIN_HAS_AMD_FALSE='#' else COIN_HAS_AMD_TRUE='#' COIN_HAS_AMD_FALSE= fi # CHOLMOD from UFL # CHOLMOD requires AMD, which can be given by AMD_LIBS # CHOLMOD requires Blas and Lapack? coin_save_LIBS="$LIBS" LIBS="$LIBS $AMD_LIBS" echo "$as_me:$LINENO: checking if user provides library for CHOLMOD" >&5 echo $ECHO_N "checking if user provides library for CHOLMOD... $ECHO_C" >&6 # Check for header file directory # Check whether --with-cholmod-incdir or --without-cholmod-incdir was given. if test "${with_cholmod_incdir+set}" = set; then withval="$with_cholmod_incdir" CHOLMODINCDIR=`cd $withval; pwd` fi; # Check for library directory # Check whether --with-cholmod-lib or --without-cholmod-lib was given. if test "${with_cholmod_lib+set}" = set; then withval="$with_cholmod_lib" CHOLMODLIB=$withval fi; # Switch to disable library check if requested # Check whether --enable-cholmod-libcheck or --disable-cholmod-libcheck was given. if test "${enable_cholmod_libcheck+set}" = set; then enableval="$enable_cholmod_libcheck" cholmod_libcheck=$enableval else cholmod_libcheck=yes fi; # At this point, if we're going to use the library, both LBRYINCDIR and # LBRYLIB must be defined and not empty. if test x"$CHOLMODINCDIR" != x || test x"$CHOLMODLIB" != x; then if test x"$CHOLMODINCDIR" = x || test x"$CHOLMODLIB" = x; then { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library CHOLMOD. Use --with-cholmod-incdir of environment variable $CHOLMODINCDIR to specify the include directory. Use --with-cholmod-lib or environment variable $CHOLMODLIB to specify link flags." >&5 echo "$as_me: error: You need to specify both an include directory and link flags to use library CHOLMOD. Use --with-cholmod-incdir of environment variable $CHOLMODINCDIR to specify the include directory. Use --with-cholmod-lib or environment variable $CHOLMODLIB to specify link flags." >&2;} { (exit 1); exit 1; }; } fi coin_has_cholmod=true echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else coin_has_cholmod=false echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # If we have instructions for use, consider header and link checks. if test $coin_has_cholmod = true; then # If argument 3 (file) is given, check for the file. Typically this will be a # header file, but that's not assumed. if test -r $CHOLMODINCDIR/cholmod.h; then : else { { echo "$as_me:$LINENO: error: Cannot find file cholmod.h in $CHOLMODINCDIR" >&5 echo "$as_me: error: Cannot find file cholmod.h in $CHOLMODINCDIR" >&2;} { (exit 1); exit 1; }; } : fi # Now see if we can link the function. There are arguments for and against # assuming argument 3 is a header file declaring the function. A correct # function declaration is the main argument in favour. Having to cope with # possible dependencies or other oddities are the main arguments against. # Force the use of C as the best single choice amongst C++, C, and Fortran. # Obviously, this has limits. if test x"$cholmod_libcheck" != xno; then coin_save_LIBS="$LIBS" LIBS="$CHOLMODLIB " coin_CHOLMOD_link=no ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for fnm in cholmod_start ; do echo "$as_me:$LINENO: checking whether symbol $fnm is available with CHOLMOD" >&5 echo $ECHO_N "checking whether symbol $fnm is available with CHOLMOD... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { $fnm() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 coin_CHOLMOD_link=yes break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$coin_save_LIBS" if test x"$coin_CHOLMOD_link" != xyes ; then { { echo "$as_me:$LINENO: error: Cannot find symbol(s) cholmod_start with CHOLMOD" >&5 echo "$as_me: error: Cannot find symbol(s) cholmod_start with CHOLMOD" >&2;} { (exit 1); exit 1; }; } fi fi # If we make it this far, we've verified the file and linked the function. Add # the necessary link flags to ClpLib_{PC}LIBS and define the preprocessor symbol # COIN_HAS_LBRY. CLPLIB_LIBS="$CHOLMODLIB $CLPLIB_LIBS" CLPLIB_PCLIBS="$CHOLMODLIB $CLPLIB_PCLIBS" CLPLIB_LIBS_INSTALLED="$CHOLMODLIB $CLPLIB_LIBS_INSTALLED" cat >>confdefs.h <<\_ACEOF #define COIN_HAS_CHOLMOD 1 _ACEOF fi # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the # automake conditional. These actions must occur unconditionally. if test $coin_has_cholmod = true; then COIN_HAS_CHOLMOD_TRUE= COIN_HAS_CHOLMOD_FALSE='#' else COIN_HAS_CHOLMOD_TRUE='#' COIN_HAS_CHOLMOD_FALSE= fi LIBS="$coin_save_LIBS" # Glpk also brings AMD if test $coin_has_cholmod = false -a $coin_has_amd = false ; then echo "$as_me:$LINENO: checking for COIN-OR package Glpk" >&5 echo $ECHO_N "checking for COIN-OR package Glpk... $ECHO_C" >&6 coin_has_glpk=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Glpk"; then coin_has_glpk=skipping fi done fi if test "$coin_has_glpk" != skipping; then # Check whether --with-m4_tolower(Glpk) or --without-m4_tolower(Glpk) was given. if test "${with_glpk+set}" = set; then withval="$with_glpk" if test "$withval" = no ; then coin_has_glpk=skipping fi fi; fi GLPK_LIBS= GLPK_CFLAGS= GLPK_DATA= GLPK_DEPENDENCIES= GLPK_PCLIBS= GLPK_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-lib or --without-m4_tolower(Glpk)-lib was given. if test "${with_glpk_lib+set}" = set; then withval="$with_glpk_lib" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_LIBS="$withval" GLPK_PCLIBS="$withval" CLPLIB_PCLIBS="$withval $CLPLIB_PCLIBS" CLPLIB_LIBS="$withval $CLPLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_LIBS_INSTALLED="$withval" CLPLIB_LIBS_INSTALLED="$withval $CLPLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-incdir or --without-m4_tolower(Glpk)-incdir was given. if test "${with_glpk_incdir+set}" = set; then withval="$with_glpk_incdir" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_CFLAGS="-I`${CYGPATH_W} $withval`" CLPLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CLPLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_CFLAGS_INSTALLED="$GLPK_CFLAGS" CLPLIB_CFLAGS_INSTALLED="$GLPK_CFLAGS $CLPLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_glpk != skipping; then # Check whether --with-m4_tolower(Glpk)-datadir or --without-m4_tolower(Glpk)-datadir was given. if test "${with_glpk_datadir+set}" = set; then withval="$with_glpk_datadir" if test "$withval" = no ; then coin_has_glpk=skipping else coin_has_glpk=yes GLPK_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then GLPK_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_glpk = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinglpk"; then GLPK_VERSIONS=`$PKG_CONFIG --modversion "coinglpk" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinglpk" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS="$cflags" GLPK_LIBS=`$PKG_CONFIG --libs "coinglpk" 2>/dev/null` GLPK_DATA=`$PKG_CONFIG --variable=datadir "coinglpk" 2>/dev/null` coin_has_glpk=yes echo "$as_me:$LINENO: result: yes: $GLPK_VERSIONS" >&5 echo "${ECHO_T}yes: $GLPK_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GLPK_LIBS=`echo " $GLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi GLPK_PCREQUIRES="coinglpk" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in ClpLib CLPLIB_PCREQUIRES="coinglpk $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$GLPK_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$GLPK_LIBS $CLPLIB_LIBS" else GLPK_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinglpk"` coin_has_glpk=notGiven echo "$as_me:$LINENO: result: not given: $GLPK_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $GLPK_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Glpk without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Glpk without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Glpk (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Glpk (fallback)... $ECHO_C" >&6 coin_has_glpk=notGiven GLPK_LIBS= GLPK_LIBS_INSTALLED= GLPK_CFLAGS= GLPK_CFLAGS_INSTALLED= GLPK_DATA= GLPK_DATA_INSTALLED= GLPK_PCLIBS= GLPK_PCREQUIRES= # initial list of dependencies is "coinglpk", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinglpk" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$GLPK_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` GLPK_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$GLPK_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi GLPK_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS="$projcflags $GLPK_CFLAGS" # set LIBS variable GLPK_LIBS="$projlibs $GLPK_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi GLPK_CFLAGS_INSTALLED="$projcflags $GLPK_CFLAGS_INSTALLED" # set LIBS variable GLPK_LIBS_INSTALLED="$projlibs $GLPK_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_glpk=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GLPK 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then GLPK_LIBS=`echo " $GLPK_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` GLPK_LIBS_INSTALLED=`echo " $GLPK_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi GLPK_PCREQUIRES="coinglpk" CLPLIB_PCREQUIRES="coinglpk $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$GLPK_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$GLPK_LIBS $CLPLIB_LIBS" CLPLIB_CFLAGS_INSTALLED="$GLPK_CFLAGS_INSTALLED $CLPLIB_CFLAGS_INSTALLED" CLPLIB_LIBS_INSTALLED="$GLPK_LIBS_INSTALLED $CLPLIB_LIBS_INSTALLED" fi if test $coin_has_glpk != notGiven && test $coin_has_glpk != skipping; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_glpk" >&5 echo "${ECHO_T}$coin_has_glpk" >&6 fi if test $coin_has_glpk != skipping && test $coin_has_glpk != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_GLPK 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) GLPK_DEPENDENCIES=`echo " $GLPK_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CLPLIB_DEPENDENCIES=`echo " $CLPLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$GLPK_CFLAGS" ; then { echo "$as_me:$LINENO: Glpk CFLAGS are $GLPK_CFLAGS" >&5 echo "$as_me: Glpk CFLAGS are $GLPK_CFLAGS" >&6;} fi if test -n "$GLPK_LIBS" ; then { echo "$as_me:$LINENO: Glpk LIBS are $GLPK_LIBS" >&5 echo "$as_me: Glpk LIBS are $GLPK_LIBS" >&6;} fi if test -n "$GLPK_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Glpk DEPENDENCIES are $GLPK_DEPENDENCIES" >&5 echo "$as_me: Glpk DEPENDENCIES are $GLPK_DEPENDENCIES" >&6;} fi if test -n "$GLPK_DATA" ; then { echo "$as_me:$LINENO: Glpk DATA is $GLPK_DATA" >&5 echo "$as_me: Glpk DATA is $GLPK_DATA" >&6;} fi if test -n "$GLPK_PCLIBS" ; then { echo "$as_me:$LINENO: Glpk PCLIBS are $GLPK_PCLIBS" >&5 echo "$as_me: Glpk PCLIBS are $GLPK_PCLIBS" >&6;} fi if test -n "$GLPK_PCREQUIRES" ; then { echo "$as_me:$LINENO: Glpk PCREQUIRES are $GLPK_PCREQUIRES" >&5 echo "$as_me: Glpk PCREQUIRES are $GLPK_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&5 echo "$as_me: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: ClpLib LIBS are $CLPLIB_LIBS" >&5 echo "$as_me: ClpLib LIBS are $CLPLIB_LIBS" >&6;} { echo "$as_me:$LINENO: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&5 echo "$as_me: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_glpk != notGiven && test $coin_has_glpk != skipping; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi if test $coin_has_glpk = yes ; then { echo "$as_me:$LINENO: using AMD from GLPK package" >&5 echo "$as_me: using AMD from GLPK package" >&6;} cat >>confdefs.h <<\_ACEOF #define COIN_HAS_AMD 1 _ACEOF fi else # for configure if test 0 = 1; then COIN_HAS_GLPK_TRUE= COIN_HAS_GLPK_FALSE='#' else COIN_HAS_GLPK_TRUE='#' COIN_HAS_GLPK_FALSE= fi fi # MUMPS echo "$as_me:$LINENO: checking for COIN-OR package Mumps" >&5 echo $ECHO_N "checking for COIN-OR package Mumps... $ECHO_C" >&6 coin_has_mumps=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Mumps"; then coin_has_mumps=skipping fi done fi if test "$coin_has_mumps" != skipping; then # Check whether --with-m4_tolower(Mumps) or --without-m4_tolower(Mumps) was given. if test "${with_mumps+set}" = set; then withval="$with_mumps" if test "$withval" = no ; then coin_has_mumps=skipping fi fi; fi MUMPS_LIBS= MUMPS_CFLAGS= MUMPS_DATA= MUMPS_DEPENDENCIES= MUMPS_PCLIBS= MUMPS_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_mumps != skipping; then # Check whether --with-m4_tolower(Mumps)-lib or --without-m4_tolower(Mumps)-lib was given. if test "${with_mumps_lib+set}" = set; then withval="$with_mumps_lib" if test "$withval" = no ; then coin_has_mumps=skipping else coin_has_mumps=yes MUMPS_LIBS="$withval" MUMPS_PCLIBS="$withval" CLPLIB_PCLIBS="$withval $CLPLIB_PCLIBS" CLPLIB_LIBS="$withval $CLPLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MUMPS_LIBS_INSTALLED="$withval" CLPLIB_LIBS_INSTALLED="$withval $CLPLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_mumps != skipping; then # Check whether --with-m4_tolower(Mumps)-incdir or --without-m4_tolower(Mumps)-incdir was given. if test "${with_mumps_incdir+set}" = set; then withval="$with_mumps_incdir" if test "$withval" = no ; then coin_has_mumps=skipping else coin_has_mumps=yes MUMPS_CFLAGS="-I`${CYGPATH_W} $withval`" CLPLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CLPLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MUMPS_CFLAGS_INSTALLED="$MUMPS_CFLAGS" CLPLIB_CFLAGS_INSTALLED="$MUMPS_CFLAGS $CLPLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_mumps != skipping; then # Check whether --with-m4_tolower(Mumps)-datadir or --without-m4_tolower(Mumps)-datadir was given. if test "${with_mumps_datadir+set}" = set; then withval="$with_mumps_datadir" if test "$withval" = no ; then coin_has_mumps=skipping else coin_has_mumps=yes MUMPS_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then MUMPS_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_mumps = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinmumps"; then MUMPS_VERSIONS=`$PKG_CONFIG --modversion "coinmumps" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinmumps" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MUMPS_CFLAGS="$cflags" MUMPS_LIBS=`$PKG_CONFIG --libs "coinmumps" 2>/dev/null` MUMPS_DATA=`$PKG_CONFIG --variable=datadir "coinmumps" 2>/dev/null` coin_has_mumps=yes echo "$as_me:$LINENO: result: yes: $MUMPS_VERSIONS" >&5 echo "${ECHO_T}yes: $MUMPS_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then MUMPS_LIBS=`echo " $MUMPS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi MUMPS_PCREQUIRES="coinmumps" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in ClpLib CLPLIB_PCREQUIRES="coinmumps $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$MUMPS_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$MUMPS_LIBS $CLPLIB_LIBS" else MUMPS_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinmumps"` coin_has_mumps=notGiven echo "$as_me:$LINENO: result: not given: $MUMPS_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $MUMPS_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Mumps without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Mumps without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Mumps (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Mumps (fallback)... $ECHO_C" >&6 coin_has_mumps=notGiven MUMPS_LIBS= MUMPS_LIBS_INSTALLED= MUMPS_CFLAGS= MUMPS_CFLAGS_INSTALLED= MUMPS_DATA= MUMPS_DATA_INSTALLED= MUMPS_PCLIBS= MUMPS_PCREQUIRES= # initial list of dependencies is "coinmumps", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinmumps" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$MUMPS_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` MUMPS_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$MUMPS_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi MUMPS_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MUMPS_CFLAGS="$projcflags $MUMPS_CFLAGS" # set LIBS variable MUMPS_LIBS="$projlibs $MUMPS_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi MUMPS_CFLAGS_INSTALLED="$projcflags $MUMPS_CFLAGS_INSTALLED" # set LIBS variable MUMPS_LIBS_INSTALLED="$projlibs $MUMPS_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_mumps=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_MUMPS 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then MUMPS_LIBS=`echo " $MUMPS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` MUMPS_LIBS_INSTALLED=`echo " $MUMPS_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi MUMPS_PCREQUIRES="coinmumps" CLPLIB_PCREQUIRES="coinmumps $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$MUMPS_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$MUMPS_LIBS $CLPLIB_LIBS" CLPLIB_CFLAGS_INSTALLED="$MUMPS_CFLAGS_INSTALLED $CLPLIB_CFLAGS_INSTALLED" CLPLIB_LIBS_INSTALLED="$MUMPS_LIBS_INSTALLED $CLPLIB_LIBS_INSTALLED" fi if test $coin_has_mumps != notGiven && test $coin_has_mumps != skipping; then COIN_HAS_MUMPS_TRUE= COIN_HAS_MUMPS_FALSE='#' else COIN_HAS_MUMPS_TRUE='#' COIN_HAS_MUMPS_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_mumps" >&5 echo "${ECHO_T}$coin_has_mumps" >&6 fi if test $coin_has_mumps != skipping && test $coin_has_mumps != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_MUMPS 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) MUMPS_DEPENDENCIES=`echo " $MUMPS_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CLPLIB_DEPENDENCIES=`echo " $CLPLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$MUMPS_CFLAGS" ; then { echo "$as_me:$LINENO: Mumps CFLAGS are $MUMPS_CFLAGS" >&5 echo "$as_me: Mumps CFLAGS are $MUMPS_CFLAGS" >&6;} fi if test -n "$MUMPS_LIBS" ; then { echo "$as_me:$LINENO: Mumps LIBS are $MUMPS_LIBS" >&5 echo "$as_me: Mumps LIBS are $MUMPS_LIBS" >&6;} fi if test -n "$MUMPS_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Mumps DEPENDENCIES are $MUMPS_DEPENDENCIES" >&5 echo "$as_me: Mumps DEPENDENCIES are $MUMPS_DEPENDENCIES" >&6;} fi if test -n "$MUMPS_DATA" ; then { echo "$as_me:$LINENO: Mumps DATA is $MUMPS_DATA" >&5 echo "$as_me: Mumps DATA is $MUMPS_DATA" >&6;} fi if test -n "$MUMPS_PCLIBS" ; then { echo "$as_me:$LINENO: Mumps PCLIBS are $MUMPS_PCLIBS" >&5 echo "$as_me: Mumps PCLIBS are $MUMPS_PCLIBS" >&6;} fi if test -n "$MUMPS_PCREQUIRES" ; then { echo "$as_me:$LINENO: Mumps PCREQUIRES are $MUMPS_PCREQUIRES" >&5 echo "$as_me: Mumps PCREQUIRES are $MUMPS_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&5 echo "$as_me: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: ClpLib LIBS are $CLPLIB_LIBS" >&5 echo "$as_me: ClpLib LIBS are $CLPLIB_LIBS" >&6;} { echo "$as_me:$LINENO: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&5 echo "$as_me: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_mumps != notGiven && test $coin_has_mumps != skipping; then COIN_HAS_MUMPS_TRUE= COIN_HAS_MUMPS_FALSE='#' else COIN_HAS_MUMPS_TRUE='#' COIN_HAS_MUMPS_FALSE= fi # WSMP # Check whether --with-wsmp or --without-wsmp was given. if test "${with_wsmp+set}" = set; then withval="$with_wsmp" use_wsmp=$withval else use_wsmp=no fi; if test "$use_wsmp" != "no"; then # Check how to link against Fortran libraries from C case $build in *-cygwin* | *-mingw*) if test "$enable_msvc" = yes ; then coin_f77_comps="ifort fl32 compile_f2c gfortran g95 g77" else coin_f77_comps="gfortran ifort g95 g77 fl32 compile_f2c" fi ;; *-*-solaris*) coin_f77_comps="f95 f90 g95 f77 xlf_r fort77 gfortran g77 pgf90 pgf77 ifort ifc frt af77" ;; *-linux-gnu*) coin_f77_comps="gfortran ifort g95 fort77 f77 g77 pgf90 pgf77 ifc frt af77 xlf_r" ;; *) coin_f77_comps="xlf_r fort77 gfortran ifort g95 f77 g77 pgf90 pgf77 ifc frt af77" ;; esac ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu coin_has_f77=yes save_fflags="$FFLAGS" # We delete the cached value, since the test might not have been # performed with our choice of compilers earlier $as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; } # This is a real belt-and-suspenders approach. AC_COIN_FIND_F77 will use # coin_f77_comps to see if there's a program that matches one of the names. # If there's no such program, F77 = unavailable. If we match the name, # feed AC_PROG_F77 the same search list, just to be sure it's a functioning # compiler. # AC_MSG_NOTICE([Fortran compiler candidates: $coin_f77_comps]) { echo "$as_me:$LINENO: Trying to determine Fortran compiler name" >&5 echo "$as_me: Trying to determine Fortran compiler name" >&6;} if test -n "$ac_tool_prefix"; then for ac_prog in $coin_f77_comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in $coin_f77_comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done test -n "$ac_ct_F77" || ac_ct_F77="unavailable" F77=$ac_ct_F77 fi if test "$F77" != "unavailable" ; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $coin_f77_comps do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in $coin_f77_comps do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_F77" && break done F77=$ac_ct_F77 fi # Provide some information about the compiler. echo "$as_me:24932:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu else { echo "$as_me:$LINENO: WARNING: Failed to find a Fortran compiler!" >&5 echo "$as_me: WARNING: Failed to find a Fortran compiler!" >&2;} fi FFLAGS="$save_fflags" # Check if a project specific FFLAGS variable has been set if test x$COIN_PRJCT != x; then eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set} if test x$coin_tmp = xset; then eval FFLAGS=\${${COIN_PRJCT}_FFLAGS} fi fi if test "$F77" != "unavailable" && test x"$FFLAGS" = x ; then coin_add_fflags= coin_opt_fflags= coin_dbg_fflags= coin_warn_fflags= if test "$G77" = "yes"; then coin_opt_fflags="-O3" coin_add_fflags="-pipe" coin_dbg_fflags="-g -O0" else case $build in *-cygwin* | *-mingw*) case $F77 in ifort* | */ifort* | IFORT* | */IFORT* ) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_fflags='-MD -O3' coin_dbg_fflags='-MDd -debug' else coin_opt_fflags='-MT -O3' coin_dbg_fflags='-MTd -debug' fi coin_add_fflags='-fpp -nologo' ;; compile_f2c*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_fflags='-MD -O2' coin_dbg_fflags='-MDd' else coin_opt_fflags='-MT -O2' coin_dbg_fflags='-MTd' fi coin_add_fflags='-nologo -wd4996' ;; esac ;; *-linux-*) case $F77 in ifc* | */ifc* | ifort* | */ifort*) coin_opt_fflags="-O3 -ip" coin_add_fflags="-cm -w90 -w95" coin_dbg_fflags="-g -CA -CB -CS" # Check if -i_dynamic is necessary (for new glibc library) FFLAGS= cat >conftest.$ac_ext <<_ACEOF program main write(*,*) 'Hello world' end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 coin_add_fflags="-i_dynamic $coin_add_fflags" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; pgf77* | */pgf77* | pgf90* | */pgf90*) coin_opt_fflags="-fast" coin_add_fflags="-Kieee -pc 64" coin_dbg_fflags="-g" ;; esac ;; *-ibm-*) case "$F77" in xlf* | */xlf* | mpxlf* | */mpxlf* ) coin_opt_fflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" coin_add_fflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" coin_dbg_fflags="-g -C" ;; esac ;; *-hp-*) coin_opt_fflags="+O3" coin_add_fflags="+U77" coin_dbg_fflags="-C -g" ;; *-*-solaris*) coin_opt_fflags="-O4" coin_dbg_fflags="-g" ;; *-sgi-*) coin_opt_fflags="-O5 -OPT:Olimit=0" coin_dbg_fflags="-g" ;; esac fi if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then coin_dbg_fflags="-g" fi if test -z "$coin_opt_fflags"; then # Try if -O option works if nothing else is set FFLAGS=-O cat >conftest.$ac_ext <<_ACEOF program main integer i end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then coin_opt_fflags="-O" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # if PM doesn't want the warning messages, take them out if test x"$coin_skip_warn_fflags" = xyes; then coin_warn_fflags= fi if test x${DBG_FFLAGS+set} != xset; then DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags" fi if test x${OPT_FFLAGS+set} != xset; then OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags" fi DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS" OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS" if test "$coin_debug_compile" = "true"; then FFLAGS="$DBG_FFLAGS" else FFLAGS="$OPT_FFLAGS" fi else FFLAGS="$FFLAGS $ADD_FFLAGS" if test x${DBG_FFLAGS+set} != xset; then DBG_FFLAGS="$FFLAGS" fi if test x${OPT_FFLAGS+set} != xset; then OPT_FFLAGS="$FFLAGS" fi fi # Try if FFLAGS works if test "$F77" != "unavailable" ; then cat >conftest.$ac_ext <<_ACEOF program main integer i end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 FFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$FFLAGS"; then { echo "$as_me:$LINENO: WARNING: The flags FFLAGS=\"$FFLAGS\" do not work. I will now just try '-O', but you might want to set FFLAGS manually." >&5 echo "$as_me: WARNING: The flags FFLAGS=\"$FFLAGS\" do not work. I will now just try '-O', but you might want to set FFLAGS manually." >&2;} FFLAGS='-O' cat >conftest.$ac_ext <<_ACEOF program main integer i end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 FFLAGS= fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$FFLAGS"; then { echo "$as_me:$LINENO: WARNING: This value for FFLAGS does not work. I will continue with empty FFLAGS, but you might want to set FFLAGS manually." >&5 echo "$as_me: WARNING: This value for FFLAGS does not work. I will continue with empty FFLAGS, but you might want to set FFLAGS manually." >&2;} fi fi fi { echo "$as_me:$LINENO: Fortran compiler options are: $FFLAGS" >&5 echo "$as_me: Fortran compiler options are: $FFLAGS" >&6;} if test x"$MPIF77" = x; then :; else { echo "$as_me:$LINENO: Will use MPI Fortran compiler $MPIF77" >&5 echo "$as_me: Will use MPI Fortran compiler $MPIF77" >&6;} F77="$MPIF77" fi # correct the LD variable if we use the intel fortran compiler in windows case $build in *-cygwin* | *-mingw*) case "$F77" in ifort* | */ifort* | IFORT* | */IFORT*) LD=link ;; esac ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # get FLIBS ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu echo "$as_me:$LINENO: checking how to get verbose linking output from $F77" >&5 echo $ECHO_N "checking how to get verbose linking output from $F77... $ECHO_C" >&6 if test "${ac_cv_prog_f77_v+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_f77_v= # Try some options frequently used verbose output for ac_verb in -v -verbose --verbose -V -\#\#\#; do cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF # Compile and link our simple test program by passing a flag (argument # 1 to this macro) to the Fortran compiler in order to get # "verbose" output that we can then parse for the Fortran linker # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" (eval echo $as_me:25444: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS rm -f conftest* # On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where # /foo, /bar, and /baz are search directories for the Fortran linker. # Here, we change these into -L/foo -L/bar -L/baz (and put it first): ac_f77_v_output="`echo $ac_f77_v_output | grep 'LPATH is:' | sed 's,.*LPATH is\(: *[^ ]*\).*,\1,;s,: */, -L/,g'` $ac_f77_v_output" case $ac_f77_v_output in # If we are using xlf then replace all the commas with spaces. *xlfentry*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted # $LIBS confuse us, and the libraries appear later in the output anyway). *mGLOB_options_string*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/\"-mGLOB[^\"]*\"/ /g'` ;; # If we are using Cray Fortran then delete quotes. # Use "\"" instead of '"' for font-lock-mode. # FIXME: a more general fix for quoted arguments with spaces? *cft90*) ac_f77_v_output=`echo $ac_f77_v_output | sed "s/\"//g"` ;; esac # look for -l* and *.a constructs in the output for ac_arg in $ac_f77_v_output; do case $ac_arg in [\\/]*.a | ?:[\\/]*.a | -[lLRu]*) ac_cv_prog_f77_v=$ac_verb break 2 ;; esac done done if test -z "$ac_cv_prog_f77_v"; then { echo "$as_me:$LINENO: WARNING: cannot determine how to obtain linking information from $F77" >&5 echo "$as_me: WARNING: cannot determine how to obtain linking information from $F77" >&2;} fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: WARNING: compilation failed" >&5 echo "$as_me: WARNING: compilation failed" >&2;} fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_v" >&5 echo "${ECHO_T}$ac_cv_prog_f77_v" >&6 echo "$as_me:$LINENO: checking for Fortran libraries of $F77" >&5 echo $ECHO_N "checking for Fortran libraries of $F77... $ECHO_C" >&6 if test "${ac_cv_f77_libs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$FLIBS" != "x"; then ac_cv_f77_libs="$FLIBS" # Let the user override the test. else cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF # Compile and link our simple test program by passing a flag (argument # 1 to this macro) to the Fortran compiler in order to get # "verbose" output that we can then parse for the Fortran linker # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" (eval echo $as_me:25522: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS rm -f conftest* # On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where # /foo, /bar, and /baz are search directories for the Fortran linker. # Here, we change these into -L/foo -L/bar -L/baz (and put it first): ac_f77_v_output="`echo $ac_f77_v_output | grep 'LPATH is:' | sed 's,.*LPATH is\(: *[^ ]*\).*,\1,;s,: */, -L/,g'` $ac_f77_v_output" case $ac_f77_v_output in # If we are using xlf then replace all the commas with spaces. *xlfentry*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted # $LIBS confuse us, and the libraries appear later in the output anyway). *mGLOB_options_string*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/\"-mGLOB[^\"]*\"/ /g'` ;; # If we are using Cray Fortran then delete quotes. # Use "\"" instead of '"' for font-lock-mode. # FIXME: a more general fix for quoted arguments with spaces? *cft90*) ac_f77_v_output=`echo $ac_f77_v_output | sed "s/\"//g"` ;; esac ac_cv_f77_libs= # Save positional arguments (if any) ac_save_positional="$@" set X $ac_f77_v_output while test $# != 1; do shift ac_arg=$1 case $ac_arg in [\\/]*.a | ?:[\\/]*.a) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi ;; -bI:*) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else if test "$ac_compiler_gnu" = yes; then for ac_link_opt in $ac_arg; do ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" done else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi fi ;; # Ignore these flags. -lang* | -lcrt[01].o | -lcrtbegin.o | -lc | -lgcc | -libmil | -LANG:=*) ;; -lkernel32) test x"$CYGWIN" != xyes && ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" ;; -[LRuY]) # These flags, when seen by themselves, take an argument. # We remove the space between option and argument and re-iterate # unless we find an empty arg or a new option (starting with -) case $2 in "" | -*);; *) ac_arg="$ac_arg$2" shift; shift set X $ac_arg "$@" ;; esac ;; -YP,*) for ac_j in `echo $ac_arg | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_j" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_arg="$ac_arg $ac_j" ac_cv_f77_libs="$ac_cv_f77_libs $ac_j" fi done ;; -[lLR]*) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi ;; # Ignore everything else. esac done # restore positional arguments set X $ac_save_positional; shift # We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, # then we insist that the "run path" must be an absolute path (i.e. it # must begin with a "/"). case `(uname -sr) 2>/dev/null` in "SunOS 5"*) ac_ld_run_path=`echo $ac_f77_v_output | sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'` test "x$ac_ld_run_path" != x && if test "$ac_compiler_gnu" = yes; then for ac_link_opt in $ac_ld_run_path; do ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" done else ac_cv_f77_libs="$ac_cv_f77_libs $ac_ld_run_path" fi ;; esac fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x" fi echo "$as_me:$LINENO: result: $ac_cv_f77_libs" >&5 echo "${ECHO_T}$ac_cv_f77_libs" >&6 FLIBS="$ac_cv_f77_libs" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu orig_FLIBS="$FLIBS" # If FLIBS has been set by the user, we just restore its value here if test x"$save_FLIBS" != x; then FLIBS="$save_FLIBS" else # This is to correct a missing exclusion in autoconf 2.59 if test x"$FLIBS" != x; then my_flibs= for flag in $FLIBS; do case $flag in -lcrt*.o) ;; -lcygwin) ;; -lgcc*) ;; *) my_flibs="$my_flibs $flag" ;; esac done FLIBS="$my_flibs" fi case $build in # The following is a fix to define FLIBS for ifort on Windows # In its original version, it linked in libifcorert.lib or libifcorertd.lib on Windows/ifort explicitly. # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables. # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line. # Further, excluding libc.lib from the default libs seemed to be necessary only for VS < 8. # Since the corresponding flag seems to make more trouble than it avoids, it has been removed now. *-cygwin* | *-mingw*) case "$F77" in # ifort* | */ifort* | IFORT* | */IFORT*) # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib" # if "$coin_debug_compile" = true ; then # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib" # else # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib" # fi # ;; compile_f2c*) FLIBS=`$F77 -FLIBS` ;; esac;; *-hp-*) FLIBS="$FLIBS -lm";; *-ibm-*) FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;; *-linux-*) case "$F77" in pgf77* | */pgf77* | pgf90* | */pgf90*) # ask linker to go through the archives multiple times # (the Fortran compiler seems to do that automatically...) FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;; esac esac ac_cv_f77_libs="$FLIBS" fi if test "x$orig_FLIBS" != "x$FLIBS" ; then { echo "$as_me:$LINENO: Corrected Fortran libraries: $FLIBS" >&5 echo "$as_me: Corrected Fortran libraries: $FLIBS" >&6;} fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu echo "$as_me:$LINENO: checking for dummy main to link with Fortran libraries" >&5 echo $ECHO_N "checking for dummy main to link with Fortran libraries... $ECHO_C" >&6 if test "${ac_cv_f77_dummy_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_f77_dm_save_LIBS=$LIBS LIBS="$LIBS $FLIBS" ac_fortran_dm_var=F77_DUMMY_MAIN ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # First, try linking without a dummy main: cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_fortran_dummy_main=none else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_fortran_dummy_main=unknown fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_cv_fortran_dummy_main = unknown; then for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define $ac_fortran_dm_var $ac_func #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_fortran_dummy_main=$ac_func; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_cv_f77_dummy_main=$ac_cv_fortran_dummy_main rm -f conftest* LIBS=$ac_f77_dm_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_f77_dummy_main" >&5 echo "${ECHO_T}$ac_cv_f77_dummy_main" >&6 F77_DUMMY_MAIN=$ac_cv_f77_dummy_main if test "$F77_DUMMY_MAIN" != unknown; then if test $F77_DUMMY_MAIN != none; then cat >>confdefs.h <<_ACEOF #define F77_DUMMY_MAIN $F77_DUMMY_MAIN _ACEOF if test "x$ac_cv_fc_dummy_main" = "x$ac_cv_f77_dummy_main"; then cat >>confdefs.h <<\_ACEOF #define FC_DUMMY_MAIN_EQ_F77 1 _ACEOF fi fi else { { echo "$as_me:$LINENO: error: linking to Fortran libraries from C fails See \`config.log' for more details." >&5 echo "$as_me: error: linking to Fortran libraries from C fails See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu echo "$as_me:$LINENO: checking for Fortran name-mangling scheme" >&5 echo $ECHO_N "checking for Fortran name-mangling scheme... $ECHO_C" >&6 if test "${ac_cv_f77_mangling+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF subroutine foobar() return end subroutine foo_bar() return end _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then mv conftest.$ac_objext cfortran_test.$ac_objext ac_save_LIBS=$LIBS LIBS="cfortran_test.$ac_objext $LIBS $FLIBS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success=no for ac_foobar in foobar FOOBAR; do for ac_underscore in "" "_"; do ac_func="$ac_foobar$ac_underscore" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_success=yes; break 2 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done done ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success" = "yes"; then case $ac_foobar in foobar) ac_case=lower ac_foo_bar=foo_bar ;; FOOBAR) ac_case=upper ac_foo_bar=FOO_BAR ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success_extra=no for ac_extra in "" "_"; do ac_func="$ac_foo_bar$ac_underscore$ac_extra" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_success_extra=yes; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success_extra" = "yes"; then ac_cv_f77_mangling="$ac_case case" if test -z "$ac_underscore"; then ac_cv_f77_mangling="$ac_cv_f77_mangling, no underscore" else ac_cv_f77_mangling="$ac_cv_f77_mangling, underscore" fi if test -z "$ac_extra"; then ac_cv_f77_mangling="$ac_cv_f77_mangling, no extra underscore" else ac_cv_f77_mangling="$ac_cv_f77_mangling, extra underscore" fi else ac_cv_f77_mangling="unknown" fi else ac_cv_f77_mangling="unknown" fi LIBS=$ac_save_LIBS rm -f cfortran_test* conftest* else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compile a simple Fortran program See \`config.log' for more details." >&5 echo "$as_me: error: cannot compile a simple Fortran program See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_f77_mangling" >&5 echo "${ECHO_T}$ac_cv_f77_mangling" >&6 ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in "lower case, no underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name _ACEOF ;; "lower case, no underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## _ _ACEOF ;; "lower case, underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## _ _ACEOF ;; "lower case, underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## __ _ACEOF ;; "upper case, no underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME _ACEOF ;; "upper case, no underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## _ _ACEOF ;; "upper case, underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## _ _ACEOF ;; "upper case, underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## __ _ACEOF ;; *) { echo "$as_me:$LINENO: WARNING: unknown Fortran name-mangling scheme" >&5 echo "$as_me: WARNING: unknown Fortran name-mangling scheme" >&2;} ;; esac ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # WSMP requires Blas # Check whether --with-blas or --without-blas was given. if test "${with_blas+set}" = set; then withval="$with_blas" use_blas="$withval" else use_blas= fi; # if user specified --with-blas-lib, then we should give COIN_CHECK_PACKAGE # preference # Check whether --with-blas-lib or --without-blas-lib was given. if test "${with_blas_lib+set}" = set; then withval="$with_blas_lib" use_blas=BUILD fi; # Check if user supplied option makes sense if test x"$use_blas" != x; then if test "$use_blas" = "BUILD"; then # we come to this later : elif test "$use_blas" != "no"; then echo "$as_me:$LINENO: checking whether user supplied BLASLIB=\"$use_blas\" works" >&5 echo $ECHO_N "checking whether user supplied BLASLIB=\"$use_blas\" works... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="$use_blas $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: user supplied BLAS library \"$use_blas\" does not work" >&5 echo "$as_me: error: user supplied BLAS library \"$use_blas\" does not work" >&2;} { (exit 1); exit 1; }; } fi fi ;; esac LIBS="$coin_save_LIBS" fi else # Try to autodetect the library for blas based on build system #AC_MSG_CHECKING([default locations for BLAS]) case $build in *-sgi-*) echo "$as_me:$LINENO: checking whether -lcomplib.sgimath has BLAS" >&5 echo $ECHO_N "checking whether -lcomplib.sgimath has BLAS... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lcomplib.sgimath $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas="-lcomplib.sgimath" if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" ;; # Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio # cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't # recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims # that CC and cc will understand -library in Studio 13. The main extra # function of -xlic_lib and -library is to arrange for the Fortran run-time # libraries to be linked for C++ and C. We can arrange that explicitly. *-*-solaris*) echo "$as_me:$LINENO: checking for BLAS in libsunperf" >&5 echo $ECHO_N "checking for BLAS in libsunperf... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lsunperf $FLIBS $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-lsunperf' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" ;; *-cygwin* | *-mingw*) case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_save_LIBS="$LIBS" echo "$as_me:$LINENO: checking for BLAS in MKL (32bit)" >&5 echo $ECHO_N "checking for BLAS in MKL (32bit)... $ECHO_C" >&6 LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" if test "x$use_blas" = x ; then echo "$as_me:$LINENO: checking for BLAS in MKL (64bit)" >&5 echo $ECHO_N "checking for BLAS in MKL (64bit)... $ECHO_C" >&6 LIBS="mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib' echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" fi ;; esac ;; *-darwin*) echo "$as_me:$LINENO: checking for BLAS in Veclib" >&5 echo $ECHO_N "checking for BLAS in Veclib... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-framework Accelerate $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-framework Accelerate' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" ;; esac if test -z "$use_blas" ; then echo "$as_me:$LINENO: checking whether -lblas has BLAS" >&5 echo $ECHO_N "checking whether -lblas has BLAS... $ECHO_C" >&6 coin_need_flibs=no coin_save_LIBS="$LIBS" LIBS="-lblas $LIBS" case $ac_ext in f) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { call daxpy ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; c) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ void $cfuncdaxpy(); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; cc|cpp) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in upper*) ac_val="DAXPY" ;; lower*) ac_val="daxpy" ;; *) ac_val="unknown" ;; esac case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac cfuncdaxpy="$ac_val" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$coin_need_flibs" = xyes; then flink_try=no; else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then flink_try=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 flink_try=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test $flink_try = yes; then use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else if test x"$FLIBS" != x; then flink_save_libs="$LIBS" LIBS="$LIBS $FLIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern "C" {void $cfuncdaxpy();} #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { $cfuncdaxpy() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$flink_save_libs" coin_need_flibs=yes use_blas='-lblas' if test $coin_need_flibs = yes ; then use_blas="$use_blas $FLIBS" fi echo "$as_me:$LINENO: result: yes: $use_blas" >&5 echo "${ECHO_T}yes: $use_blas" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$flink_save_libs" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi ;; esac LIBS="$coin_save_LIBS" fi # If we have no other ideas, consider building BLAS. if test -z "$use_blas" ; then use_blas=BUILD fi fi if test "x$use_blas" = xBUILD ; then echo "$as_me:$LINENO: checking for COIN-OR package Blas" >&5 echo $ECHO_N "checking for COIN-OR package Blas... $ECHO_C" >&6 coin_has_blas=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "Blas"; then coin_has_blas=skipping fi done fi if test "$coin_has_blas" != skipping; then # Check whether --with-m4_tolower(Blas) or --without-m4_tolower(Blas) was given. if test "${with_blas+set}" = set; then withval="$with_blas" if test "$withval" = no ; then coin_has_blas=skipping fi fi; fi BLAS_LIBS= BLAS_CFLAGS= BLAS_DATA= BLAS_DEPENDENCIES= BLAS_PCLIBS= BLAS_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_blas != skipping; then # Check whether --with-m4_tolower(Blas)-lib or --without-m4_tolower(Blas)-lib was given. if test "${with_blas_lib+set}" = set; then withval="$with_blas_lib" if test "$withval" = no ; then coin_has_blas=skipping else coin_has_blas=yes BLAS_LIBS="$withval" BLAS_PCLIBS="$withval" CLPLIB_PCLIBS="$withval $CLPLIB_PCLIBS" CLPLIB_LIBS="$withval $CLPLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then BLAS_LIBS_INSTALLED="$withval" CLPLIB_LIBS_INSTALLED="$withval $CLPLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_blas != skipping; then # Check whether --with-m4_tolower(Blas)-incdir or --without-m4_tolower(Blas)-incdir was given. if test "${with_blas_incdir+set}" = set; then withval="$with_blas_incdir" if test "$withval" = no ; then coin_has_blas=skipping else coin_has_blas=yes BLAS_CFLAGS="-I`${CYGPATH_W} $withval`" CLPLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CLPLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then BLAS_CFLAGS_INSTALLED="$BLAS_CFLAGS" CLPLIB_CFLAGS_INSTALLED="$BLAS_CFLAGS $CLPLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_blas != skipping; then # Check whether --with-m4_tolower(Blas)-datadir or --without-m4_tolower(Blas)-datadir was given. if test "${with_blas_datadir+set}" = set; then withval="$with_blas_datadir" if test "$withval" = no ; then coin_has_blas=skipping else coin_has_blas=yes BLAS_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then BLAS_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_blas = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinblas"; then BLAS_VERSIONS=`$PKG_CONFIG --modversion "coinblas" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinblas" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi BLAS_CFLAGS="$cflags" BLAS_LIBS=`$PKG_CONFIG --libs "coinblas" 2>/dev/null` BLAS_DATA=`$PKG_CONFIG --variable=datadir "coinblas" 2>/dev/null` coin_has_blas=yes echo "$as_me:$LINENO: result: yes: $BLAS_VERSIONS" >&5 echo "${ECHO_T}yes: $BLAS_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then BLAS_LIBS=`echo " $BLAS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi BLAS_PCREQUIRES="coinblas" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in ClpLib CLPLIB_PCREQUIRES="coinblas $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$BLAS_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$BLAS_LIBS $CLPLIB_LIBS" else BLAS_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinblas"` coin_has_blas=notGiven echo "$as_me:$LINENO: result: not given: $BLAS_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $BLAS_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module Blas without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module Blas without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package Blas (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package Blas (fallback)... $ECHO_C" >&6 coin_has_blas=notGiven BLAS_LIBS= BLAS_LIBS_INSTALLED= BLAS_CFLAGS= BLAS_CFLAGS_INSTALLED= BLAS_DATA= BLAS_DATA_INSTALLED= BLAS_PCLIBS= BLAS_PCREQUIRES= # initial list of dependencies is "coinblas", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinblas" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$BLAS_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` BLAS_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$BLAS_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi BLAS_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi BLAS_CFLAGS="$projcflags $BLAS_CFLAGS" # set LIBS variable BLAS_LIBS="$projlibs $BLAS_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi BLAS_CFLAGS_INSTALLED="$projcflags $BLAS_CFLAGS_INSTALLED" # set LIBS variable BLAS_LIBS_INSTALLED="$projlibs $BLAS_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_blas=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_BLAS 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then BLAS_LIBS=`echo " $BLAS_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` BLAS_LIBS_INSTALLED=`echo " $BLAS_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi BLAS_PCREQUIRES="coinblas" CLPLIB_PCREQUIRES="coinblas $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$BLAS_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$BLAS_LIBS $CLPLIB_LIBS" CLPLIB_CFLAGS_INSTALLED="$BLAS_CFLAGS_INSTALLED $CLPLIB_CFLAGS_INSTALLED" CLPLIB_LIBS_INSTALLED="$BLAS_LIBS_INSTALLED $CLPLIB_LIBS_INSTALLED" fi if test $coin_has_blas != notGiven && test $coin_has_blas != skipping; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_blas" >&5 echo "${ECHO_T}$coin_has_blas" >&6 fi if test $coin_has_blas != skipping && test $coin_has_blas != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_BLAS 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) BLAS_DEPENDENCIES=`echo " $BLAS_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CLPLIB_DEPENDENCIES=`echo " $CLPLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$BLAS_CFLAGS" ; then { echo "$as_me:$LINENO: Blas CFLAGS are $BLAS_CFLAGS" >&5 echo "$as_me: Blas CFLAGS are $BLAS_CFLAGS" >&6;} fi if test -n "$BLAS_LIBS" ; then { echo "$as_me:$LINENO: Blas LIBS are $BLAS_LIBS" >&5 echo "$as_me: Blas LIBS are $BLAS_LIBS" >&6;} fi if test -n "$BLAS_DEPENDENCIES" ; then { echo "$as_me:$LINENO: Blas DEPENDENCIES are $BLAS_DEPENDENCIES" >&5 echo "$as_me: Blas DEPENDENCIES are $BLAS_DEPENDENCIES" >&6;} fi if test -n "$BLAS_DATA" ; then { echo "$as_me:$LINENO: Blas DATA is $BLAS_DATA" >&5 echo "$as_me: Blas DATA is $BLAS_DATA" >&6;} fi if test -n "$BLAS_PCLIBS" ; then { echo "$as_me:$LINENO: Blas PCLIBS are $BLAS_PCLIBS" >&5 echo "$as_me: Blas PCLIBS are $BLAS_PCLIBS" >&6;} fi if test -n "$BLAS_PCREQUIRES" ; then { echo "$as_me:$LINENO: Blas PCREQUIRES are $BLAS_PCREQUIRES" >&5 echo "$as_me: Blas PCREQUIRES are $BLAS_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&5 echo "$as_me: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: ClpLib LIBS are $CLPLIB_LIBS" >&5 echo "$as_me: ClpLib LIBS are $CLPLIB_LIBS" >&6;} { echo "$as_me:$LINENO: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&5 echo "$as_me: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_blas != notGiven && test $coin_has_blas != skipping; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi elif test "x$use_blas" != x && test "$use_blas" != no; then coin_has_blas=yes if test 0 = 0; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi cat >>confdefs.h <<\_ACEOF #define COIN_HAS_BLAS 1 _ACEOF BLAS_LIBS="$use_blas" BLAS_CFLAGS= BLAS_DATA= CLPLIB_PCLIBS="$BLAS_LIBS $CLPLIB_PCLIBS" CLPLIB_LIBS="$BLAS_LIBS $CLPLIB_LIBS" CLPLIB_LIBS_INSTALLED="$BLAS_LIBS $CLPLIB_LIBS_INSTALLED" else coin_has_blas=no if test 0 = 1; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi fi coin_save_LIBS="$LIBS" LIBS="$LIBS $use_wsmp $BLAS_LIBS" ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu echo "$as_me:$LINENO: checking whether user-supplied WSMP library \"$use_wsmp\" works" >&5 echo $ECHO_N "checking whether user-supplied WSMP library \"$use_wsmp\" works... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF program main call WSSMP() end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: WSMP library $use_wsmp does not seem to work" >&5 echo "$as_me: error: WSMP library $use_wsmp does not seem to work" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$coin_save_LIBS" cat >>confdefs.h <<_ACEOF #define COIN_HAS_WSMP 1 _ACEOF CLPLIB_LIBS="$use_wsmp $CLPLIB_LIBS" CLPLIB_LIBS_INSTALLED="$use_wsmp $CLPLIB_LIBS_INSTALLED" CLPLIB_PCLIBS="$use_wsmp $CLPLIB_PCLIBS" else # to please configure if test 0 = 1; then COIN_HAS_BLAS_TRUE= COIN_HAS_BLAS_FALSE='#' else COIN_HAS_BLAS_TRUE='#' COIN_HAS_BLAS_FALSE= fi fi if test "$use_wsmp" != no; then COIN_HAS_WSMP_TRUE= COIN_HAS_WSMP_FALSE='#' else COIN_HAS_WSMP_TRUE='#' COIN_HAS_WSMP_FALSE= fi ############################################################################# # Other dependencies # ############################################################################# # Ampl Solver library echo "$as_me:$LINENO: checking for COIN-OR package ASL" >&5 echo $ECHO_N "checking for COIN-OR package ASL... $ECHO_C" >&6 coin_has_asl=notGiven # check if user wants to skip package in any case if test x"$COIN_SKIP_PROJECTS" != x; then for dir in $COIN_SKIP_PROJECTS; do if test $dir = "ASL"; then coin_has_asl=skipping fi done fi if test "$coin_has_asl" != skipping; then # Check whether --with-m4_tolower(ASL) or --without-m4_tolower(ASL) was given. if test "${with_asl+set}" = set; then withval="$with_asl" if test "$withval" = no ; then coin_has_asl=skipping fi fi; fi ASL_LIBS= ASL_CFLAGS= ASL_DATA= ASL_DEPENDENCIES= ASL_PCLIBS= ASL_PCREQUIRES= #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package if test $coin_has_asl != skipping; then # Check whether --with-m4_tolower(ASL)-lib or --without-m4_tolower(ASL)-lib was given. if test "${with_asl_lib+set}" = set; then withval="$with_asl_lib" if test "$withval" = no ; then coin_has_asl=skipping else coin_has_asl=yes ASL_LIBS="$withval" ASL_PCLIBS="$withval" CLPLIB_PCLIBS="$withval $CLPLIB_PCLIBS" CLPLIB_LIBS="$withval $CLPLIB_LIBS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then ASL_LIBS_INSTALLED="$withval" CLPLIB_LIBS_INSTALLED="$withval $CLPLIB_LIBS_INSTALLED" fi fi fi; fi if test $coin_has_asl != skipping; then # Check whether --with-m4_tolower(ASL)-incdir or --without-m4_tolower(ASL)-incdir was given. if test "${with_asl_incdir+set}" = set; then withval="$with_asl_incdir" if test "$withval" = no ; then coin_has_asl=skipping else coin_has_asl=yes ASL_CFLAGS="-I`${CYGPATH_W} $withval`" CLPLIB_CFLAGS="-I`${CYGPATH_W} $withval` $CLPLIB_CFLAGS" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then ASL_CFLAGS_INSTALLED="$ASL_CFLAGS" CLPLIB_CFLAGS_INSTALLED="$ASL_CFLAGS $CLPLIB_CFLAGS_INSTALLED" fi fi fi; fi if test $coin_has_asl != skipping; then # Check whether --with-m4_tolower(ASL)-datadir or --without-m4_tolower(ASL)-datadir was given. if test "${with_asl_datadir+set}" = set; then withval="$with_asl_datadir" if test "$withval" = no ; then coin_has_asl=skipping else coin_has_asl=yes ASL_DATA="$withval" # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables if test -z "$PKG_CONFIG" ; then ASL_DATA_INSTALLED="$withval" fi fi fi; fi if test $coin_has_asl = notGiven; then if test -n "$PKG_CONFIG" ; then # set search path for pkg-config # need to export variable to be sure that the following pkg-config gets these values coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED" export PKG_CONFIG_PATH # let pkg-config do it's magic if test -n "$PKG_CONFIG" ; then if $PKG_CONFIG --exists "coinasl"; then ASL_VERSIONS=`$PKG_CONFIG --modversion "coinasl" 2>/dev/null | tr '\n' ' '` cflags=`$PKG_CONFIG --cflags "coinasl" 2>/dev/null` # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's # but only do this if is not trivial if test "$CYGPATH_W" != "echo" ; then # need to put into brackets since otherwise autoconf replaces the brackets in the sed command cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi ASL_CFLAGS="$cflags" ASL_LIBS=`$PKG_CONFIG --libs "coinasl" 2>/dev/null` ASL_DATA=`$PKG_CONFIG --variable=datadir "coinasl" 2>/dev/null` coin_has_asl=yes echo "$as_me:$LINENO: result: yes: $ASL_VERSIONS" >&5 echo "${ECHO_T}yes: $ASL_VERSIONS" >&6 # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl) if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then ASL_LIBS=`echo " $ASL_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` fi ASL_PCREQUIRES="coinasl" # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in ClpLib CLPLIB_PCREQUIRES="coinasl $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$ASL_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$ASL_LIBS $CLPLIB_LIBS" else ASL_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "coinasl"` coin_has_asl=notGiven echo "$as_me:$LINENO: result: not given: $ASL_PKG_ERRORS" >&5 echo "${ECHO_T}not given: $ASL_PKG_ERRORS" >&6 fi else { { echo "$as_me:$LINENO: error: \"Cannot check for existance of module ASL without pkg-config\"" >&5 echo "$as_me: error: \"Cannot check for existance of module ASL without pkg-config\"" >&2;} { (exit 1); exit 1; }; } fi # reset PKG_CONFIG_PATH variable PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH" export PKG_CONFIG_PATH else echo "$as_me:$LINENO: result: skipped check via pkg-config, redirect to fallback" >&5 echo "${ECHO_T}skipped check via pkg-config, redirect to fallback" >&6 echo "$as_me:$LINENO: checking for COIN-OR package ASL (fallback)" >&5 echo $ECHO_N "checking for COIN-OR package ASL (fallback)... $ECHO_C" >&6 coin_has_asl=notGiven ASL_LIBS= ASL_LIBS_INSTALLED= ASL_CFLAGS= ASL_CFLAGS_INSTALLED= ASL_DATA= ASL_DATA_INSTALLED= ASL_PCLIBS= ASL_PCREQUIRES= # initial list of dependencies is "coinasl", but we need to filter out version number specifications (= x, <= x, >= x, != x) projtoprocess="coinasl" # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples # also, we setup the DATA variable allproj="" allpcfiles="" allpcifiles="" while test "x$projtoprocess" != x ; do for proj in $projtoprocess ; do # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it pcfile="" save_IFS="$IFS" IFS=":" for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again if test -r "$dir/${proj}-uninstalled.pc" ; then pcfile="$dir/$proj-uninstalled.pc" if test -r "$dir/${proj}.pc" ; then pcifile="$dir/${proj}.pc" else { echo "$as_me:$LINENO: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&5 echo "$as_me: WARNING: Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples." >&2;} pcifile= fi break fi done IFS="$save_IFS" if test "x$pcfile" != x ; then # read dependencies from $pcfile and filter it projrequires=`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[ ]\{0,\}[^ ]\{1,\}//g'` # add projrequires to the front of the list of projects that have to be processed next # at the same time, remove $proj from this list projtoprocess=`echo $projtoprocess | sed -e "s/$proj/$projrequires/"` # read DATA from $pcfile, if _DATA is still empty if test "x$ASL_DATA" = x ; then projdatadir= pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile` eval `sh -c "$pcfilemod"` ASL_DATA="$projdatadir" fi allproj="$allproj $proj" allpcfiles="$pcfile:$allpcfiles" else echo "$as_me:$LINENO: result: no, dependency $proj not available" >&5 echo "${ECHO_T}no, dependency $proj not available" >&6 allproj=fail break 2 fi if test "x$pcifile" != x ; then allpcifiles="$pcifile:$allpcifiles" # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty if test "x$ASL_DATA_INSTALLED" = x ; then projdatadir= pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile` eval `sh -c "$pcifilemod"` if test "${CYGPATH_W}" != "echo"; then projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`" fi ASL_DATA_INSTALLED="$projdatadir" fi fi break done # remove spaces on begin of $projtoprocess projtoprocess=`echo $projtoprocess | sed -e 's/^ *//'` done if test "$allproj" != fail ; then # now go through the list of .pc files and assemble compiler and linker flags # important is here to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcfiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi ASL_CFLAGS="$projcflags $ASL_CFLAGS" # set LIBS variable ASL_LIBS="$projlibs $ASL_LIBS" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # now go through the list of .pc files for installed projects and assemble compiler and linker flags # important is here again to obey the reverse order that has been setup before, # since then libraries that are required by several others should be after these other libraries pcfilesprocessed="" save_IFS="$IFS" IFS=":" for pcfile in $allpcifiles ; do # if $pcfile has been processed already, skip this round if test "x$pcfilesprocessed" != x ; then for pcfiledone in $pcfilesprocessed ; do if test "$pcfiledone" = "$pcfile" ; then continue 2 fi done fi # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags: # replace "Libs:" by "echo projlibs=" # replace "Cflags:" by "echo projcflags=" # remove every line starting with : pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile` # set projcflags and projlibs variables by running $pcfilemod # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default projcflags= projlibs= IFS="$save_IFS" eval `sh -c "$pcfilemod"` IFS=":" # add CYGPATH_W cludge into include flags and set CFLAGS variable if test "${CYGPATH_W}" != "echo"; then projcflags=`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'` fi ASL_CFLAGS_INSTALLED="$projcflags $ASL_CFLAGS_INSTALLED" # set LIBS variable ASL_LIBS_INSTALLED="$projlibs $ASL_LIBS_INSTALLED" # remember that we have processed $pcfile pcfilesprocessed="$pcfilesprocessed:$pcfile" done IFS="$save_IFS" # finish up coin_has_asl=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define COIN_HAS_ASL 1 _ACEOF # adjust linker flags for (i)cl compiler # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl), # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`", # everything of the form "-lname" by "libname.lib", and # everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path` if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ; then ASL_LIBS=`echo " $ASL_LIBS " | sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g'` ASL_LIBS_INSTALLED=`echo " $ASL_LIBS_INSTALLED" | sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g'` fi ASL_PCREQUIRES="coinasl" CLPLIB_PCREQUIRES="coinasl $CLPLIB_PCREQUIRES" CLPLIB_CFLAGS="$ASL_CFLAGS $CLPLIB_CFLAGS" CLPLIB_LIBS="$ASL_LIBS $CLPLIB_LIBS" CLPLIB_CFLAGS_INSTALLED="$ASL_CFLAGS_INSTALLED $CLPLIB_CFLAGS_INSTALLED" CLPLIB_LIBS_INSTALLED="$ASL_LIBS_INSTALLED $CLPLIB_LIBS_INSTALLED" fi if test $coin_has_asl != notGiven && test $coin_has_asl != skipping; then COIN_HAS_ASL_TRUE= COIN_HAS_ASL_FALSE='#' else COIN_HAS_ASL_TRUE='#' COIN_HAS_ASL_FALSE= fi fi else echo "$as_me:$LINENO: result: $coin_has_asl" >&5 echo "${ECHO_T}$coin_has_asl" >&6 fi if test $coin_has_asl != skipping && test $coin_has_asl != notGiven ; then cat >>confdefs.h <<\_ACEOF #define COIN_HAS_ASL 1 _ACEOF # Check whether --enable-interpackage-dependencies or --disable-interpackage-dependencies was given. if test "${enable_interpackage_dependencies+set}" = set; then enableval="$enable_interpackage_dependencies" else enable_interpackage_dependencies=yes fi; if test $enable_interpackage_dependencies = yes ; then # construct dependencies variables from LIBS variables # we add an extra space in LIBS so we can substitute out everything starting with " -" # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows # then remove everything of the form -xxx # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl) ASL_DEPENDENCIES=`echo " $ASL_LIBS" | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` CLPLIB_DEPENDENCIES=`echo " $CLPLIB_LIBS " | sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g'` fi if test 1 = 0 ; then #change this test to enable a bit of debugging output if test -n "$ASL_CFLAGS" ; then { echo "$as_me:$LINENO: ASL CFLAGS are $ASL_CFLAGS" >&5 echo "$as_me: ASL CFLAGS are $ASL_CFLAGS" >&6;} fi if test -n "$ASL_LIBS" ; then { echo "$as_me:$LINENO: ASL LIBS are $ASL_LIBS" >&5 echo "$as_me: ASL LIBS are $ASL_LIBS" >&6;} fi if test -n "$ASL_DEPENDENCIES" ; then { echo "$as_me:$LINENO: ASL DEPENDENCIES are $ASL_DEPENDENCIES" >&5 echo "$as_me: ASL DEPENDENCIES are $ASL_DEPENDENCIES" >&6;} fi if test -n "$ASL_DATA" ; then { echo "$as_me:$LINENO: ASL DATA is $ASL_DATA" >&5 echo "$as_me: ASL DATA is $ASL_DATA" >&6;} fi if test -n "$ASL_PCLIBS" ; then { echo "$as_me:$LINENO: ASL PCLIBS are $ASL_PCLIBS" >&5 echo "$as_me: ASL PCLIBS are $ASL_PCLIBS" >&6;} fi if test -n "$ASL_PCREQUIRES" ; then { echo "$as_me:$LINENO: ASL PCREQUIRES are $ASL_PCREQUIRES" >&5 echo "$as_me: ASL PCREQUIRES are $ASL_PCREQUIRES" >&6;} fi { echo "$as_me:$LINENO: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&5 echo "$as_me: ClpLib CFLAGS are $CLPLIB_CFLAGS" >&6;} { echo "$as_me:$LINENO: ClpLib LIBS are $CLPLIB_LIBS" >&5 echo "$as_me: ClpLib LIBS are $CLPLIB_LIBS" >&6;} { echo "$as_me:$LINENO: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&5 echo "$as_me: ClpLib DEPENDENCIES are $CLPLIB_DEPENDENCIES" >&6;} fi fi # Define the Makefile conditional if test $coin_has_asl != notGiven && test $coin_has_asl != skipping; then COIN_HAS_ASL_TRUE= COIN_HAS_ASL_FALSE='#' else COIN_HAS_ASL_TRUE='#' COIN_HAS_ASL_FALSE= fi # Check whether --enable-gnu-packages or --disable-gnu-packages was given. if test "${enable_gnu_packages+set}" = set; then enableval="$enable_gnu_packages" coin_enable_gnu=$enableval else coin_enable_gnu=no fi; coin_has_readline=no if test $coin_enable_gnu = yes; then #if test x"#include " = x; then # hdr="#include " #else # hdr="#include " #fi #AC_CHECK_HEADERS([readline/readline.h],[coin_has_readline=yes],[],[$hdr]) for ac_header in readline/readline.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF coin_has_readline=yes fi done coin_save_LIBS="$LIBS" LIBS= # First we check if tputs and friends are available if test $coin_has_readline = yes; then echo "$as_me:$LINENO: checking for library containing tputs" >&5 echo $ECHO_N "checking for library containing tputs... $ECHO_C" >&6 if test "${ac_cv_search_tputs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_tputs=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tputs (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { tputs (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_tputs="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_tputs" = no; then for ac_lib in ncurses termcap curses; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tputs (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { tputs (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_tputs="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_tputs" >&5 echo "${ECHO_T}$ac_cv_search_tputs" >&6 if test "$ac_cv_search_tputs" != no; then test "$ac_cv_search_tputs" = "none required" || LIBS="$ac_cv_search_tputs $LIBS" else coin_has_readline=no fi fi # Now we check for readline if test $coin_has_readline = yes; then echo "$as_me:$LINENO: checking for readline in -lreadline" >&5 echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6 if test "${ac_cv_lib_readline_readline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char readline (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { readline (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_readline_readline=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_readline=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5 echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6 if test $ac_cv_lib_readline_readline = yes; then : else coin_has_readline=no fi fi if test $coin_has_readline = yes; then CLPLIB_LIBS="-lreadline $LIBS $CLPLIB_LIBS" CLPLIB_PCLIBS="-lreadline $LIBS $CLPLIB_PCLIBS" CLPLIB_LIBS_INSTALLED="-lreadline $LIBS $CLPLIB_LIBS_INSTALLED" cat >>confdefs.h <<\_ACEOF #define COIN_HAS_READLINE 1 _ACEOF fi LIBS="$coin_save_LIBS" fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cmath],[],[],[$hdr]) for ac_header in cmath do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to clp@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cmath" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([math.h],[],[],[$hdr]) for ac_header in math.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to clp@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cfloat],[],[],[$hdr]) for ac_header in cfloat do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to clp@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cfloat" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([float.h],[],[],[$hdr]) for ac_header in float.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to clp@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([cieeefp],[],[],[$hdr]) for ac_header in cieeefp do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to clp@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_cieeefp" != "yes"; then #if test x"" = x; then # hdr="#include " #else # hdr="" #fi #AC_CHECK_HEADERS([ieeefp.h],[],[],[$hdr]) for ac_header in ieeefp.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to clp@list.coin-or.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ############################################################################## # VPATH links for example input files # ############################################################################## # In case this is a VPATH configuration we need to make sure that the # input files for the examples are available in the VPATH directory. echo "$as_me:$LINENO: checking whether this is a VPATH configuration" >&5 echo $ECHO_N "checking whether this is a VPATH configuration... $ECHO_C" >&6 if test `cd $srcdir; pwd` != `pwd`; then coin_vpath_config=yes; else coin_vpath_config=no; fi echo "$as_me:$LINENO: result: $coin_vpath_config" >&5 echo "${ECHO_T}$coin_vpath_config" >&6 # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="examples/hello.mps" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="examples/input.130" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="examples/g.tiny" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi # Allow for newlines in the parameter if test $coin_vpath_config = yes; then cvl_tmp="examples/gparm.tiny" for file in $cvl_tmp ; do coin_vpath_link_files="$coin_vpath_link_files $file" done fi ############################################################################# # Check for doxygen # ############################################################################# { echo "$as_me:$LINENO: configuring doxygen documentation options" >&5 echo "$as_me: configuring doxygen documentation options" >&6;} # Check to see if doxygen is available. # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_doxygen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_doxygen"; then ac_cv_prog_coin_have_doxygen="$coin_have_doxygen" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_doxygen="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_doxygen" && ac_cv_prog_coin_have_doxygen="no" fi fi coin_have_doxygen=$ac_cv_prog_coin_have_doxygen if test -n "$coin_have_doxygen"; then echo "$as_me:$LINENO: result: $coin_have_doxygen" >&5 echo "${ECHO_T}$coin_have_doxygen" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_have_latex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_have_latex"; then ac_cv_prog_coin_have_latex="$coin_have_latex" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_latex="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_have_latex" && ac_cv_prog_coin_have_latex="no" fi fi coin_have_latex=$ac_cv_prog_coin_have_latex if test -n "$coin_have_latex"; then echo "$as_me:$LINENO: result: $coin_have_latex" >&5 echo "${ECHO_T}$coin_have_latex" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Look for the dot tool from the graphviz package, unless the user has # disabled it. # Check whether --with-dot or --without-dot was given. if test "${with_dot+set}" = set; then withval="$with_dot" else withval=yes fi; if test x"$withval" = xno ; then coin_doxy_usedot=NO echo "$as_me:$LINENO: checking for dot " >&5 echo $ECHO_N "checking for dot ... $ECHO_C" >&6 echo "$as_me:$LINENO: result: disabled" >&5 echo "${ECHO_T}disabled" >&6 else # Extract the first word of "dot", so it can be a program name with args. set dummy dot; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_coin_doxy_usedot+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$coin_doxy_usedot"; then ac_cv_prog_coin_doxy_usedot="$coin_doxy_usedot" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_coin_doxy_usedot="YES" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_coin_doxy_usedot" && ac_cv_prog_coin_doxy_usedot="NO" fi fi coin_doxy_usedot=$ac_cv_prog_coin_doxy_usedot if test -n "$coin_doxy_usedot"; then echo "$as_me:$LINENO: result: $coin_doxy_usedot" >&5 echo "${ECHO_T}$coin_doxy_usedot" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi # Generate a tag file name and a log file name coin_doxy_tagname=doxydoc/${PACKAGE}_doxy.tag coin_doxy_logname=doxydoc/${PACKAGE}_doxy.log if test $coin_have_doxygen = yes; then COIN_HAS_DOXYGEN_TRUE= COIN_HAS_DOXYGEN_FALSE='#' else COIN_HAS_DOXYGEN_TRUE='#' COIN_HAS_DOXYGEN_FALSE= fi if test $coin_have_latex = yes; then COIN_HAS_LATEX_TRUE= COIN_HAS_LATEX_FALSE='#' else COIN_HAS_LATEX_TRUE='#' COIN_HAS_LATEX_FALSE= fi # Process the list of project names and massage them into possible doxygen # doc'n directories. Prefer 1) classic external, source processed using # a project-specific doxygen.conf, we use the tag file; 2) classic # external, source processed using package doxygen.conf; 3) installed # doxydoc. Alternatives 1) and 2) are only possible if the directory will be # configured, which we can't know unless this is the package base configure, # since coin_subdirs is only set there. Hence it's sufficient to check for # membership. If we use a tag file from a classic external, exclude the # source from doxygen processing when doxygen runs in the base directory. coin_doxy_tagfiles= coin_doxy_excludes= tmp="CoinUtils Osi" for proj in $tmp ; do lc_proj=`echo $proj | tr [A-Z] [a-z]` echo "$as_me:$LINENO: checking for doxygen doc'n for $proj " >&5 echo $ECHO_N "checking for doxygen doc'n for $proj ... $ECHO_C" >&6 doxytag=${lc_proj}_doxy.tag doxyfound=no # proj will be configured, hence doxydoc present in build tree doxysrcdir="${srcdir}/../${proj}" # AC_MSG_NOTICE([Considering $doxysrcdir (base)]) if test -d "$doxysrcdir" ; then # with a doxydoc directory? doxydir="$doxysrcdir/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (base)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) if test -d "$doxydir" ; then # use tag file; don't process source doxydir="../${proj}/doxydoc" coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=../../$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 coin_doxy_excludes="$coin_doxy_excludes */${proj}" else # will process the source -- nothing further to be done here echo "$as_me:$LINENO: result: $doxysrcdir (src)" >&5 echo "${ECHO_T}$doxysrcdir (src)" >&6 fi doxyfound=yes fi # Not built, fall back to installed tag file if test $doxyfound = no ; then eval doxydir="${datadir}/coin/doc/${proj}/doxydoc" # AC_MSG_NOTICE([Considering $doxydir (install)]) # AC_MSG_NOTICE([Subdirs: $coin_subdirs)]) coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html" echo "$as_me:$LINENO: result: $doxydir (tag)" >&5 echo "${ECHO_T}$doxydir (tag)" >&6 fi done ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) ac_config_files="$ac_config_files Makefile examples/Makefile src/Makefile src/OsiClp/Makefile test/Makefile clp.pc clp-uninstalled.pc" if test $coin_has_osi = yes ; then ac_config_files="$ac_config_files osi-clp.pc:src/OsiClp/osi-clp.pc.in osi-clp-uninstalled.pc:src/OsiClp/osi-clp-uninstalled.pc.in" fi ac_config_files="$ac_config_files doxydoc/doxygen.conf" # Here put the location and name of the configuration header file ac_config_headers="$ac_config_headers src/config.h src/config_clp.h" # Finally, we let configure write all the output... echo "$as_me:$LINENO: checking which command should be used to link input files" >&5 echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac echo "$as_me:$LINENO: result: $coin_link_input_cmd" >&5 echo "${ECHO_T}$coin_link_input_cmd" >&6 if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; *) LIBEXT=a ;; esac # Define VPATH_DISTCLEANFILES to be everything that needs to be # cleaned for distclean in a vpath configuration VPATH_DISTCLEANFILES="$coin_vpath_link_files" # Take out subdirectories if their configuration concluded that they # don't need to be compiled if test x"$coin_ac_skip_subdirs" != x; then new_subdirs= for i in $subdirs; do skipme=no for j in $coin_ac_skip_subdirs; do if test $i = $j; then skipme=yes; fi done if test $skipme = no; then new_subdirs="$new_subdirs $i" fi done subdirs="$new_subdirs" fi # need to come before AC_OUTPUT if test x$coin_projectdir != xyes; then # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects echo $coin_subdirs > coin_subdirs.txt else # substitute for OBJDIR, needed to setup .pc file for uninstalled project ABSBUILDDIR="`pwd`" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${ALWAYS_FALSE_TRUE}" && test -z "${ALWAYS_FALSE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ALWAYS_FALSE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CC_IS_CL_TRUE}" && test -z "${COIN_CC_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CC_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_CXX_IS_CL_TRUE}" && test -z "${COIN_CXX_IS_CL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_CXX_IS_CL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_EXTERNALS_TRUE}" && test -z "${HAVE_EXTERNALS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_EXTERNALS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${DEPENDENCY_LINKING_TRUE}" && test -z "${DEPENDENCY_LINKING_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"DEPENDENCY_LINKING\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_PKGCONFIG_TRUE}" && test -z "${COIN_HAS_PKGCONFIG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_COINUTILS_TRUE}" && test -z "${COIN_HAS_COINUTILS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_COINUTILS_TRUE}" && test -z "${COIN_HAS_COINUTILS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_COINUTILS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSI_TRUE}" && test -z "${COIN_HAS_OSI_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSI\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSI\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSI_TRUE}" && test -z "${COIN_HAS_OSI_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSI\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSI\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSITESTS_TRUE}" && test -z "${COIN_HAS_OSITESTS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSITESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSITESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_OSITESTS_TRUE}" && test -z "${COIN_HAS_OSITESTS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_OSITESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_OSITESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_SAMPLE_TRUE}" && test -z "${COIN_HAS_SAMPLE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_SAMPLE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NETLIB_TRUE}" && test -z "${COIN_HAS_NETLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_NETLIB_TRUE}" && test -z "${COIN_HAS_NETLIB_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_NETLIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_ABC_TRUE}" && test -z "${COIN_HAS_ABC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_ABC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_ABC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_AMD_TRUE}" && test -z "${COIN_HAS_AMD_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_AMD\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_AMD\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_CHOLMOD_TRUE}" && test -z "${COIN_HAS_CHOLMOD_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_CHOLMOD\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_CHOLMOD\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_GLPK_TRUE}" && test -z "${COIN_HAS_GLPK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_GLPK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_MUMPS_TRUE}" && test -z "${COIN_HAS_MUMPS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_MUMPS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_MUMPS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_MUMPS_TRUE}" && test -z "${COIN_HAS_MUMPS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_MUMPS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_MUMPS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_BLAS_TRUE}" && test -z "${COIN_HAS_BLAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_BLAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_WSMP_TRUE}" && test -z "${COIN_HAS_WSMP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_WSMP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_WSMP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_ASL_TRUE}" && test -z "${COIN_HAS_ASL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_ASL_TRUE}" && test -z "${COIN_HAS_ASL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_DOXYGEN_TRUE}" && test -z "${COIN_HAS_DOXYGEN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COIN_HAS_LATEX_TRUE}" && test -z "${COIN_HAS_LATEX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by Clp $as_me 1.16.8, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Clp config.status 1.16.8 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/OsiClp/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/OsiClp/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "clp.pc" ) CONFIG_FILES="$CONFIG_FILES clp.pc" ;; "clp-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES clp-uninstalled.pc" ;; "osi-clp.pc" ) CONFIG_FILES="$CONFIG_FILES osi-clp.pc:src/OsiClp/osi-clp.pc.in" ;; "osi-clp-uninstalled.pc" ) CONFIG_FILES="$CONFIG_FILES osi-clp-uninstalled.pc:src/OsiClp/osi-clp-uninstalled.pc.in" ;; "doxydoc/doxygen.conf" ) CONFIG_FILES="$CONFIG_FILES doxydoc/doxygen.conf" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "src/config_clp.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config_clp.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@ALWAYS_FALSE_TRUE@,$ALWAYS_FALSE_TRUE,;t t s,@ALWAYS_FALSE_FALSE@,$ALWAYS_FALSE_FALSE,;t t s,@have_svnversion@,$have_svnversion,;t t s,@CLP_SVN_REV@,$CLP_SVN_REV,;t t s,@CDEFS@,$CDEFS,;t t s,@ADD_CFLAGS@,$ADD_CFLAGS,;t t s,@DBG_CFLAGS@,$DBG_CFLAGS,;t t s,@OPT_CFLAGS@,$OPT_CFLAGS,;t t s,@sol_cc_compiler@,$sol_cc_compiler,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@COIN_CC_IS_CL_TRUE@,$COIN_CC_IS_CL_TRUE,;t t s,@COIN_CC_IS_CL_FALSE@,$COIN_CC_IS_CL_FALSE,;t t s,@MPICC@,$MPICC,;t t s,@CXXDEFS@,$CXXDEFS,;t t s,@ADD_CXXFLAGS@,$ADD_CXXFLAGS,;t t s,@DBG_CXXFLAGS@,$DBG_CXXFLAGS,;t t s,@OPT_CXXFLAGS@,$OPT_CXXFLAGS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@COIN_CXX_IS_CL_TRUE@,$COIN_CXX_IS_CL_TRUE,;t t s,@COIN_CXX_IS_CL_FALSE@,$COIN_CXX_IS_CL_FALSE,;t t s,@MPICXX@,$MPICXX,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBTOOLM4@,$LIBTOOLM4,;t t s,@have_autoconf@,$have_autoconf,;t t s,@have_automake@,$have_automake,;t t s,@have_svn@,$have_svn,;t t s,@BUILDTOOLSDIR@,$BUILDTOOLSDIR,;t t s,@AUX_DIR@,$AUX_DIR,;t t s,@abs_source_dir@,$abs_source_dir,;t t s,@abs_lib_dir@,$abs_lib_dir,;t t s,@abs_include_dir@,$abs_include_dir,;t t s,@abs_bin_dir@,$abs_bin_dir,;t t s,@HAVE_EXTERNALS_TRUE@,$HAVE_EXTERNALS_TRUE,;t t s,@HAVE_EXTERNALS_FALSE@,$HAVE_EXTERNALS_FALSE,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@CXXCPP@,$CXXCPP,;t t s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@ac_c_preproc_warn_flag@,$ac_c_preproc_warn_flag,;t t s,@ac_cxx_preproc_warn_flag@,$ac_cxx_preproc_warn_flag,;t t s,@RPATH_FLAGS@,$RPATH_FLAGS,;t t s,@DEPENDENCY_LINKING_TRUE@,$DEPENDENCY_LINKING_TRUE,;t t s,@DEPENDENCY_LINKING_FALSE@,$DEPENDENCY_LINKING_FALSE,;t t s,@LT_LDFLAGS@,$LT_LDFLAGS,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@ac_ct_PKG_CONFIG@,$ac_ct_PKG_CONFIG,;t t s,@COIN_HAS_PKGCONFIG_TRUE@,$COIN_HAS_PKGCONFIG_TRUE,;t t s,@COIN_HAS_PKGCONFIG_FALSE@,$COIN_HAS_PKGCONFIG_FALSE,;t t s,@COIN_PKG_CONFIG_PATH@,$COIN_PKG_CONFIG_PATH,;t t s,@COIN_PKG_CONFIG_PATH_UNINSTALLED@,$COIN_PKG_CONFIG_PATH_UNINSTALLED,;t t s,@COINUTILS_LIBS@,$COINUTILS_LIBS,;t t s,@COINUTILS_CFLAGS@,$COINUTILS_CFLAGS,;t t s,@COINUTILS_DATA@,$COINUTILS_DATA,;t t s,@COINUTILS_DEPENDENCIES@,$COINUTILS_DEPENDENCIES,;t t s,@COINUTILS_LIBS_INSTALLED@,$COINUTILS_LIBS_INSTALLED,;t t s,@COINUTILS_CFLAGS_INSTALLED@,$COINUTILS_CFLAGS_INSTALLED,;t t s,@COINUTILS_DATA_INSTALLED@,$COINUTILS_DATA_INSTALLED,;t t s,@CLPLIB_CFLAGS@,$CLPLIB_CFLAGS,;t t s,@CLPLIB_LIBS@,$CLPLIB_LIBS,;t t s,@CLPLIB_PCLIBS@,$CLPLIB_PCLIBS,;t t s,@CLPLIB_PCREQUIRES@,$CLPLIB_PCREQUIRES,;t t s,@CLPLIB_DEPENDENCIES@,$CLPLIB_DEPENDENCIES,;t t s,@CLPLIB_CFLAGS_INSTALLED@,$CLPLIB_CFLAGS_INSTALLED,;t t s,@CLPLIB_LIBS_INSTALLED@,$CLPLIB_LIBS_INSTALLED,;t t s,@COIN_HAS_COINUTILS_TRUE@,$COIN_HAS_COINUTILS_TRUE,;t t s,@COIN_HAS_COINUTILS_FALSE@,$COIN_HAS_COINUTILS_FALSE,;t t s,@OSI_LIBS@,$OSI_LIBS,;t t s,@OSI_CFLAGS@,$OSI_CFLAGS,;t t s,@OSI_DATA@,$OSI_DATA,;t t s,@OSI_DEPENDENCIES@,$OSI_DEPENDENCIES,;t t s,@OSI_LIBS_INSTALLED@,$OSI_LIBS_INSTALLED,;t t s,@OSI_CFLAGS_INSTALLED@,$OSI_CFLAGS_INSTALLED,;t t s,@OSI_DATA_INSTALLED@,$OSI_DATA_INSTALLED,;t t s,@OSICLPLIB_CFLAGS@,$OSICLPLIB_CFLAGS,;t t s,@OSICLPLIB_LIBS@,$OSICLPLIB_LIBS,;t t s,@OSICLPLIB_PCLIBS@,$OSICLPLIB_PCLIBS,;t t s,@OSICLPLIB_PCREQUIRES@,$OSICLPLIB_PCREQUIRES,;t t s,@OSICLPLIB_DEPENDENCIES@,$OSICLPLIB_DEPENDENCIES,;t t s,@OSICLPLIB_CFLAGS_INSTALLED@,$OSICLPLIB_CFLAGS_INSTALLED,;t t s,@OSICLPLIB_LIBS_INSTALLED@,$OSICLPLIB_LIBS_INSTALLED,;t t s,@COIN_HAS_OSI_TRUE@,$COIN_HAS_OSI_TRUE,;t t s,@COIN_HAS_OSI_FALSE@,$COIN_HAS_OSI_FALSE,;t t s,@OSITESTS_LIBS@,$OSITESTS_LIBS,;t t s,@OSITESTS_CFLAGS@,$OSITESTS_CFLAGS,;t t s,@OSITESTS_DATA@,$OSITESTS_DATA,;t t s,@OSITESTS_DEPENDENCIES@,$OSITESTS_DEPENDENCIES,;t t s,@OSITESTS_LIBS_INSTALLED@,$OSITESTS_LIBS_INSTALLED,;t t s,@OSITESTS_CFLAGS_INSTALLED@,$OSITESTS_CFLAGS_INSTALLED,;t t s,@OSITESTS_DATA_INSTALLED@,$OSITESTS_DATA_INSTALLED,;t t s,@COIN_HAS_OSITESTS_TRUE@,$COIN_HAS_OSITESTS_TRUE,;t t s,@COIN_HAS_OSITESTS_FALSE@,$COIN_HAS_OSITESTS_FALSE,;t t s,@SAMPLE_LIBS@,$SAMPLE_LIBS,;t t s,@SAMPLE_CFLAGS@,$SAMPLE_CFLAGS,;t t s,@SAMPLE_DATA@,$SAMPLE_DATA,;t t s,@SAMPLE_DEPENDENCIES@,$SAMPLE_DEPENDENCIES,;t t s,@SAMPLE_LIBS_INSTALLED@,$SAMPLE_LIBS_INSTALLED,;t t s,@SAMPLE_CFLAGS_INSTALLED@,$SAMPLE_CFLAGS_INSTALLED,;t t s,@SAMPLE_DATA_INSTALLED@,$SAMPLE_DATA_INSTALLED,;t t s,@COIN_HAS_SAMPLE_TRUE@,$COIN_HAS_SAMPLE_TRUE,;t t s,@COIN_HAS_SAMPLE_FALSE@,$COIN_HAS_SAMPLE_FALSE,;t t s,@NETLIB_LIBS@,$NETLIB_LIBS,;t t s,@NETLIB_CFLAGS@,$NETLIB_CFLAGS,;t t s,@NETLIB_DATA@,$NETLIB_DATA,;t t s,@NETLIB_DEPENDENCIES@,$NETLIB_DEPENDENCIES,;t t s,@NETLIB_LIBS_INSTALLED@,$NETLIB_LIBS_INSTALLED,;t t s,@NETLIB_CFLAGS_INSTALLED@,$NETLIB_CFLAGS_INSTALLED,;t t s,@NETLIB_DATA_INSTALLED@,$NETLIB_DATA_INSTALLED,;t t s,@COIN_HAS_NETLIB_TRUE@,$COIN_HAS_NETLIB_TRUE,;t t s,@COIN_HAS_NETLIB_FALSE@,$COIN_HAS_NETLIB_FALSE,;t t s,@COIN_HAS_ABC_TRUE@,$COIN_HAS_ABC_TRUE,;t t s,@COIN_HAS_ABC_FALSE@,$COIN_HAS_ABC_FALSE,;t t s,@AMDINCDIR@,$AMDINCDIR,;t t s,@AMDLIB@,$AMDLIB,;t t s,@COIN_HAS_AMD_TRUE@,$COIN_HAS_AMD_TRUE,;t t s,@COIN_HAS_AMD_FALSE@,$COIN_HAS_AMD_FALSE,;t t s,@CHOLMODINCDIR@,$CHOLMODINCDIR,;t t s,@CHOLMODLIB@,$CHOLMODLIB,;t t s,@COIN_HAS_CHOLMOD_TRUE@,$COIN_HAS_CHOLMOD_TRUE,;t t s,@COIN_HAS_CHOLMOD_FALSE@,$COIN_HAS_CHOLMOD_FALSE,;t t s,@GLPK_LIBS@,$GLPK_LIBS,;t t s,@GLPK_CFLAGS@,$GLPK_CFLAGS,;t t s,@GLPK_DATA@,$GLPK_DATA,;t t s,@GLPK_DEPENDENCIES@,$GLPK_DEPENDENCIES,;t t s,@GLPK_LIBS_INSTALLED@,$GLPK_LIBS_INSTALLED,;t t s,@GLPK_CFLAGS_INSTALLED@,$GLPK_CFLAGS_INSTALLED,;t t s,@GLPK_DATA_INSTALLED@,$GLPK_DATA_INSTALLED,;t t s,@COIN_HAS_GLPK_TRUE@,$COIN_HAS_GLPK_TRUE,;t t s,@COIN_HAS_GLPK_FALSE@,$COIN_HAS_GLPK_FALSE,;t t s,@MUMPS_LIBS@,$MUMPS_LIBS,;t t s,@MUMPS_CFLAGS@,$MUMPS_CFLAGS,;t t s,@MUMPS_DATA@,$MUMPS_DATA,;t t s,@MUMPS_DEPENDENCIES@,$MUMPS_DEPENDENCIES,;t t s,@MUMPS_LIBS_INSTALLED@,$MUMPS_LIBS_INSTALLED,;t t s,@MUMPS_CFLAGS_INSTALLED@,$MUMPS_CFLAGS_INSTALLED,;t t s,@MUMPS_DATA_INSTALLED@,$MUMPS_DATA_INSTALLED,;t t s,@COIN_HAS_MUMPS_TRUE@,$COIN_HAS_MUMPS_TRUE,;t t s,@COIN_HAS_MUMPS_FALSE@,$COIN_HAS_MUMPS_FALSE,;t t s,@ADD_FFLAGS@,$ADD_FFLAGS,;t t s,@DBG_FFLAGS@,$DBG_FFLAGS,;t t s,@OPT_FFLAGS@,$OPT_FFLAGS,;t t s,@MPIF77@,$MPIF77,;t t s,@FLIBS@,$FLIBS,;t t s,@BLAS_LIBS@,$BLAS_LIBS,;t t s,@BLAS_CFLAGS@,$BLAS_CFLAGS,;t t s,@BLAS_DATA@,$BLAS_DATA,;t t s,@BLAS_DEPENDENCIES@,$BLAS_DEPENDENCIES,;t t s,@BLAS_LIBS_INSTALLED@,$BLAS_LIBS_INSTALLED,;t t s,@BLAS_CFLAGS_INSTALLED@,$BLAS_CFLAGS_INSTALLED,;t t s,@BLAS_DATA_INSTALLED@,$BLAS_DATA_INSTALLED,;t t s,@COIN_HAS_BLAS_TRUE@,$COIN_HAS_BLAS_TRUE,;t t s,@COIN_HAS_BLAS_FALSE@,$COIN_HAS_BLAS_FALSE,;t t s,@COIN_HAS_WSMP_TRUE@,$COIN_HAS_WSMP_TRUE,;t t s,@COIN_HAS_WSMP_FALSE@,$COIN_HAS_WSMP_FALSE,;t t s,@ASL_LIBS@,$ASL_LIBS,;t t s,@ASL_CFLAGS@,$ASL_CFLAGS,;t t s,@ASL_DATA@,$ASL_DATA,;t t s,@ASL_DEPENDENCIES@,$ASL_DEPENDENCIES,;t t s,@ASL_LIBS_INSTALLED@,$ASL_LIBS_INSTALLED,;t t s,@ASL_CFLAGS_INSTALLED@,$ASL_CFLAGS_INSTALLED,;t t s,@ASL_DATA_INSTALLED@,$ASL_DATA_INSTALLED,;t t s,@COIN_HAS_ASL_TRUE@,$COIN_HAS_ASL_TRUE,;t t s,@COIN_HAS_ASL_FALSE@,$COIN_HAS_ASL_FALSE,;t t s,@coin_have_doxygen@,$coin_have_doxygen,;t t s,@coin_have_latex@,$coin_have_latex,;t t s,@coin_doxy_usedot@,$coin_doxy_usedot,;t t s,@coin_doxy_tagname@,$coin_doxy_tagname,;t t s,@coin_doxy_logname@,$coin_doxy_logname,;t t s,@COIN_HAS_DOXYGEN_TRUE@,$COIN_HAS_DOXYGEN_TRUE,;t t s,@COIN_HAS_DOXYGEN_FALSE@,$COIN_HAS_DOXYGEN_FALSE,;t t s,@COIN_HAS_LATEX_TRUE@,$COIN_HAS_LATEX_TRUE,;t t s,@COIN_HAS_LATEX_FALSE@,$COIN_HAS_LATEX_FALSE,;t t s,@coin_doxy_tagfiles@,$coin_doxy_tagfiles,;t t s,@coin_doxy_excludes@,$coin_doxy_excludes,;t t s,@LIBEXT@,$LIBEXT,;t t s,@VPATH_DISTCLEANFILES@,$VPATH_DISTCLEANFILES,;t t s,@ABSBUILDDIR@,$ABSBUILDDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test x"$coin_vpath_link_files" = x; then : ; else lnkcmd="$coin_link_input_cmd" if test "$lnkcmd" = cp; then { echo "$as_me:$LINENO: Copying data files for VPATH configuration" >&5 echo "$as_me: Copying data files for VPATH configuration" >&6;} else { echo "$as_me:$LINENO: Creating VPATH links for data files" >&5 echo "$as_me: Creating VPATH links for data files" >&6;} fi for file in $coin_vpath_link_files; do dir=`(dirname "./$file") 2>/dev/null || $as_expr X"./$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"./$file" : 'X\(//\)[^/]' \| \ X"./$file" : 'X\(//\)$' \| \ X"./$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"./$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test -d $dir; then : ; else { if $as_mkdir_p; then mkdir -p $dir else as_dir=$dir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dir" >&5 echo "$as_me: error: cannot create directory $dir" >&2;} { (exit 1); exit 1; }; }; } fi rm -f $file $lnkcmd $abs_source_dir/$file $file done fi { echo "$as_me:$LINENO: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&5 echo "$as_me: In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting" >&6;} if test x$coin_projectdir = xyes; then { echo "$as_me:$LINENO: Configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} else { echo "$as_me:$LINENO: Main configuration of $PACKAGE_NAME successful" >&5 echo "$as_me: Main configuration of $PACKAGE_NAME successful" >&6;} fi else { echo "$as_me:$LINENO: No configuration of $PACKAGE_NAME necessary" >&5 echo "$as_me: No configuration of $PACKAGE_NAME necessary" >&6;} fi CoinMP-1.8.3/Clp/ltmain.sh0000755000175000017500000057753011405215425013675 0ustar renerene# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` fi ;; * ) compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: CoinMP-1.8.3/Clp/config.guess0000755000175000017500000012706311405215425014362 0ustar renerene#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: CoinMP-1.8.3/Clp/test/0000755000175000017500000000000012600453455013015 5ustar renereneCoinMP-1.8.3/Clp/test/Makefile.in0000644000175000017500000005334112506111472015063 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ @COIN_HAS_OSITESTS_TRUE@noinst_PROGRAMS = osiUnitTest$(EXEEXT) @COIN_HAS_SAMPLE_TRUE@am__append_1 = -dirSample `$(CYGPATH_W) $(SAMPLE_DATA)` @COIN_HAS_SAMPLE_TRUE@am__append_2 = -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` @COIN_HAS_NETLIB_TRUE@am__append_3 = -dirNetlib `$(CYGPATH_W) $(NETLIB_DATA)` -netlib @COIN_HAS_NETLIB_TRUE@am__append_4 = -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testOsiSolverInterface subdir = test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_clp.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) am__osiUnitTest_SOURCES_DIST = osiUnitTest.cpp \ OsiClpSolverInterfaceTest.cpp @COIN_HAS_OSITESTS_TRUE@am_osiUnitTest_OBJECTS = \ @COIN_HAS_OSITESTS_TRUE@ osiUnitTest.$(OBJEXT) \ @COIN_HAS_OSITESTS_TRUE@ OsiClpSolverInterfaceTest.$(OBJEXT) osiUnitTest_OBJECTS = $(am_osiUnitTest_OBJECTS) am__DEPENDENCIES_1 = DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src -I$(top_builddir)/src 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(osiUnitTest_SOURCES) DIST_SOURCES = $(am__osiUnitTest_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMDINCDIR = @AMDINCDIR@ AMDLIB = @AMDLIB@ AMTAR = @AMTAR@ AR = @AR@ ASL_CFLAGS = @ASL_CFLAGS@ ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ ASL_DATA = @ASL_DATA@ ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ ASL_LIBS = @ASL_LIBS@ ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BLAS_CFLAGS = @BLAS_CFLAGS@ BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ BLAS_DATA = @BLAS_DATA@ BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ BLAS_LIBS = @BLAS_LIBS@ BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CHOLMODINCDIR = @CHOLMODINCDIR@ CHOLMODLIB = @CHOLMODLIB@ CLPLIB_CFLAGS = @CLPLIB_CFLAGS@ CLPLIB_CFLAGS_INSTALLED = @CLPLIB_CFLAGS_INSTALLED@ CLPLIB_DEPENDENCIES = @CLPLIB_DEPENDENCIES@ CLPLIB_LIBS = @CLPLIB_LIBS@ CLPLIB_LIBS_INSTALLED = @CLPLIB_LIBS_INSTALLED@ CLPLIB_PCLIBS = @CLPLIB_PCLIBS@ CLPLIB_PCREQUIRES = @CLPLIB_PCREQUIRES@ CLP_SVN_REV = @CLP_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_ABC_FALSE = @COIN_HAS_ABC_FALSE@ COIN_HAS_ABC_TRUE = @COIN_HAS_ABC_TRUE@ COIN_HAS_AMD_FALSE = @COIN_HAS_AMD_FALSE@ COIN_HAS_AMD_TRUE = @COIN_HAS_AMD_TRUE@ COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ COIN_HAS_CHOLMOD_FALSE = @COIN_HAS_CHOLMOD_FALSE@ COIN_HAS_CHOLMOD_TRUE = @COIN_HAS_CHOLMOD_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MUMPS_FALSE = @COIN_HAS_MUMPS_FALSE@ COIN_HAS_MUMPS_TRUE = @COIN_HAS_MUMPS_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_OSITESTS_FALSE = @COIN_HAS_OSITESTS_FALSE@ COIN_HAS_OSITESTS_TRUE = @COIN_HAS_OSITESTS_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_WSMP_FALSE = @COIN_HAS_WSMP_FALSE@ COIN_HAS_WSMP_TRUE = @COIN_HAS_WSMP_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FLIBS = @FLIBS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MPIF77 = @MPIF77@ MUMPS_CFLAGS = @MUMPS_CFLAGS@ MUMPS_CFLAGS_INSTALLED = @MUMPS_CFLAGS_INSTALLED@ MUMPS_DATA = @MUMPS_DATA@ MUMPS_DATA_INSTALLED = @MUMPS_DATA_INSTALLED@ MUMPS_DEPENDENCIES = @MUMPS_DEPENDENCIES@ MUMPS_LIBS = @MUMPS_LIBS@ MUMPS_LIBS_INSTALLED = @MUMPS_LIBS_INSTALLED@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OPT_FFLAGS = @OPT_FFLAGS@ OSICLPLIB_CFLAGS = @OSICLPLIB_CFLAGS@ OSICLPLIB_CFLAGS_INSTALLED = @OSICLPLIB_CFLAGS_INSTALLED@ OSICLPLIB_DEPENDENCIES = @OSICLPLIB_DEPENDENCIES@ OSICLPLIB_LIBS = @OSICLPLIB_LIBS@ OSICLPLIB_LIBS_INSTALLED = @OSICLPLIB_LIBS_INSTALLED@ OSICLPLIB_PCLIBS = @OSICLPLIB_PCLIBS@ OSICLPLIB_PCREQUIRES = @OSICLPLIB_PCREQUIRES@ OSITESTS_CFLAGS = @OSITESTS_CFLAGS@ OSITESTS_CFLAGS_INSTALLED = @OSITESTS_CFLAGS_INSTALLED@ OSITESTS_DATA = @OSITESTS_DATA@ OSITESTS_DATA_INSTALLED = @OSITESTS_DATA_INSTALLED@ OSITESTS_DEPENDENCIES = @OSITESTS_DEPENDENCIES@ OSITESTS_LIBS = @OSITESTS_LIBS@ OSITESTS_LIBS_INSTALLED = @OSITESTS_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign @COIN_HAS_OSITESTS_TRUE@osiUnitTest_SOURCES = osiUnitTest.cpp OsiClpSolverInterfaceTest.cpp @COIN_HAS_OSITESTS_TRUE@osiUnitTest_LDADD = ../src/libClp.la ../src/OsiClp/libOsiClp.la \ @COIN_HAS_OSITESTS_TRUE@ $(CLPLIB_LIBS) $(OSICLP_LIBS) $(OSITESTS_LIBS) @COIN_HAS_OSITESTS_TRUE@osiUnitTest_DEPENDENCIES = ../src/libClp.la ../src/OsiClp/libOsiClp.la \ @COIN_HAS_OSITESTS_TRUE@ $(CLPLIB_DEPENDENCIES) $(OSICLP_DEPENDENCIES) $(OSITESTS_DEPENDENCIES) @COIN_HAS_OSITESTS_TRUE@AM_CPPFLAGS = \ @COIN_HAS_OSITESTS_TRUE@ -I`$(CYGPATH_W) $(srcdir)/../src` \ @COIN_HAS_OSITESTS_TRUE@ -I`$(CYGPATH_W) $(srcdir)/../src/OsiClp` \ @COIN_HAS_OSITESTS_TRUE@ $(COINUTILS_CFLAGS) $(OSI_CFLAGS) $(OSITESTS_CFLAGS) @COIN_HAS_OSITESTS_TRUE@testdepend = osiUnitTest$(EXEEXT) ######################################################################## # unitTest for Clp # ######################################################################## unittestflags = $(am__append_1) -unitTest $(am__append_3) osiunittestflags = $(am__append_2) $(am__append_4) ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = yy.mps xx.mps all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 test/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign test/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done osiUnitTest$(EXEEXT): $(osiUnitTest_OBJECTS) $(osiUnitTest_DEPENDENCIES) @rm -f osiUnitTest$(EXEEXT) $(CXXLINK) $(osiUnitTest_LDFLAGS) $(osiUnitTest_OBJECTS) $(osiUnitTest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiClpSolverInterfaceTest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osiUnitTest.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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 $(PROGRAMS) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: 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: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS 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-exec \ install-exec-am install-info install-info-am install-man \ 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 \ uninstall-info-am # We are using the CLP solver executable to do the unit test test: ../src/clp$(EXEEXT) $(testdepend) ../src/clp$(EXEEXT) $(unittestflags) || exit 1 if test -e osiUnitTest$(EXEEXT) ; then \ ./osiUnitTest$(EXEEXT) $(osiunittestflags) || exit 1 ; \ fi .PHONY: test # 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: CoinMP-1.8.3/Clp/test/Makefile.am0000644000175000017500000000442011621723240015043 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1781 2011-08-14 10:42:40Z stefan $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # unitTest for OsiClp # ######################################################################## if COIN_HAS_OSITESTS noinst_PROGRAMS = osiUnitTest osiUnitTest_SOURCES = osiUnitTest.cpp OsiClpSolverInterfaceTest.cpp osiUnitTest_LDADD = ../src/libClp.la ../src/OsiClp/libOsiClp.la \ $(CLPLIB_LIBS) $(OSICLP_LIBS) $(OSITESTS_LIBS) osiUnitTest_DEPENDENCIES = ../src/libClp.la ../src/OsiClp/libOsiClp.la \ $(CLPLIB_DEPENDENCIES) $(OSICLP_DEPENDENCIES) $(OSITESTS_DEPENDENCIES) AM_CPPFLAGS = \ -I`$(CYGPATH_W) $(srcdir)/../src` \ -I`$(CYGPATH_W) $(srcdir)/../src/OsiClp` \ $(COINUTILS_CFLAGS) $(OSI_CFLAGS) $(OSITESTS_CFLAGS) testdepend = osiUnitTest$(EXEEXT) endif ######################################################################## # unitTest for Clp # ######################################################################## unittestflags = osiunittestflags = if COIN_HAS_SAMPLE unittestflags += -dirSample `$(CYGPATH_W) $(SAMPLE_DATA)` osiunittestflags += -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` endif unittestflags += -unitTest if COIN_HAS_NETLIB unittestflags += -dirNetlib `$(CYGPATH_W) $(NETLIB_DATA)` -netlib osiunittestflags += -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testOsiSolverInterface endif # We are using the CLP solver executable to do the unit test test: ../src/clp$(EXEEXT) $(testdepend) ../src/clp$(EXEEXT) $(unittestflags) || exit 1 if test -e osiUnitTest$(EXEEXT) ; then \ ./osiUnitTest$(EXEEXT) $(osiunittestflags) || exit 1 ; \ fi .PHONY: test ######################################################################## # Cleaning stuff # ######################################################################## # Here we list everything that is not generated by the compiler, e.g., # output files of a program DISTCLEANFILES = yy.mps xx.mps CoinMP-1.8.3/Clp/test/osiUnitTest.cpp0000644000175000017500000000637411575424014016024 0ustar renerene// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // $Id$ #include "CoinPragma.hpp" #include #include "OsiUnitTests.hpp" #include "OsiClpSolverInterface.hpp" using namespace OsiUnitTest; //---------------------------------------------------------------- // to see parameter list, call unitTest -usage //---------------------------------------------------------------- int main (int argc, const char *argv[]) { /* Start off with various bits of initialisation that don't really belong anywhere else. Synchronise C++ stream i/o with C stdio. This makes debugging output a bit more comprehensible. It still suffers from interleave of cout (stdout) and cerr (stderr), but -nobuf deals with that. */ std::ios::sync_with_stdio() ; /* Suppress an popup window that Windows shows in response to a crash. See note at head of file. */ WindowsErrorPopupBlocker(); /* Process command line parameters. */ std::map parms; if (processParameters(argc,argv,parms) == false) return 1; std::string mpsDir = parms["-mpsDir"] ; std::string netlibDir = parms["-netlibDir"] ; /* Test Osi{Row,Col}Cut routines. */ { OsiClpSolverInterface clpSi; testingMessage( "Testing OsiRowCut with OsiClpSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&clpSi,mpsDir), {}, clpSi, "rowcut unittest"); } { OsiClpSolverInterface clpSi; testingMessage( "Testing OsiColCut with OsiClpSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&clpSi,mpsDir), {}, clpSi, "colcut unittest"); } { OsiClpSolverInterface clpSi; testingMessage( "Testing OsiRowCutDebugger with OsiClpSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&clpSi,mpsDir), {}, clpSi, "rowcut debugger unittest"); } /* Run the OsiClp class test. This will also call OsiSolverInterfaceCommonUnitTest. */ testingMessage( "Testing OsiClpSolverInterface\n" ); OSIUNITTEST_CATCH_ERROR(OsiClpSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "clp", "osiclp unittest"); /* We have run the specialised unit test. Check now to see if we need to run through the Netlib problems. */ if (parms.find("-testOsiSolverInterface") != parms.end()) { // Create vector of solver interfaces std::vector vecSi(1, new OsiClpSolverInterface); testingMessage( "Testing OsiSolverInterface on Netlib problems.\n" ); OSIUNITTEST_CATCH_ERROR(OsiSolverInterfaceMpsUnitTest(vecSi,netlibDir), {}, "clp", "netlib unittest"); delete vecSi[0]; } else testingMessage( "***Skipped Testing of OsiClpSolverInterface on Netlib problems, use -testOsiSolverInterface to run them.***\n" ); /* We're done. Report on the results. */ std::cout.flush(); outcomes.print(); int nerrors; int nerrors_expected; outcomes.getCountBySeverity(TestOutcome::ERROR, nerrors, nerrors_expected); if (nerrors > nerrors_expected) std::cerr << "Tests completed with " << nerrors - nerrors_expected << " unexpected errors." << std::endl ; else std::cerr << "All tests completed successfully\n"; return nerrors - nerrors_expected; } CoinMP-1.8.3/Clp/test/OsiClpSolverInterfaceTest.cpp0000644000175000017500000017103111722233153020564 0ustar renerene// $Id$ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" //#include //#include //#include //#include #include "OsiClpSolverInterface.hpp" #include "OsiUnitTests.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "CoinMessage.hpp" #include "ClpMessage.hpp" #include "ClpFactorization.hpp" #include "CoinModel.hpp" #include "CoinIndexedVector.hpp" #include "ClpPlusMinusOneMatrix.hpp" //############################################################################# class OsiClpMessageTest : public CoinMessageHandler { public: virtual int print() ; OsiClpMessageTest(); }; OsiClpMessageTest::OsiClpMessageTest() : CoinMessageHandler() { } int OsiClpMessageTest::print() { if (currentMessage().externalNumber()==0&¤tSource()=="Clp") std::cout<<"This is not actually an advertisement by Dash Associates - just my feeble attempt to test message handling and language - JJHF"<clone(); OsiClpSolverInterface * clpClone = dynamic_cast(siClone); OSIUNITTEST_ASSERT_ERROR(clpClone != NULL, {}, "clp", "clone"); OSIUNITTEST_ASSERT_ERROR(clpClone->getModelPtr() != clpSi.getModelPtr(), {}, "clp", "clone"); OSIUNITTEST_ASSERT_ERROR(clpClone->getNumRows() == clpSi.getNumRows(), {}, "clp", "clone"); OSIUNITTEST_ASSERT_ERROR(clpClone->getNumCols() == m.getNumCols(), {}, "clp", "clone"); delete siClone; } // Test infinity { OsiClpSolverInterface si; OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == OsiClpInfinity, {}, "clp", "infinity"); } // Test some catches if (!OsiClpHasNDEBUG()) { OsiClpSolverInterface solver; try { solver.setObjCoeff(0,0.0); OSIUNITTEST_ADD_OUTCOME("clp", "setObjCoeff on empty model", "should throw exception", OsiUnitTest::TestOutcome::ERROR, false); } catch (CoinError e) { if (OsiUnitTest::verbosity >= 1) std::cout<<"Correct throw from setObjCoeff on empty model"<= 1) std::cout<<"Correct throw from setObjCoeff on empty model"<getMajorDim() == 5, return, "clp", "getMatrixByRow: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "clp", "getMatrixByRow: num elements"); CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[0], 3.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[1], 1.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[2], -2.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[3], -1.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[4], -1.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[5], 2.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[6], 1.1), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[7], 1.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[8], 1.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[9], 2.8), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "clp", "getMatrixByRow: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "clp", "getMatrixByRow: elements"); const int * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "clp", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "clp", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "clp", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "clp", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "clp", "getMatrixByRow: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "clp", "getMatrixByRow: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "clp", "getMatrixByRow: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "clp", "getMatrixByRow: indices"); } // Test adding several cuts { OsiClpSolverInterface fim; std::string fn = mpsDir+"exmip1"; fim.readMps(fn.c_str(),"mps"); // exmip1.mps has 2 integer variables with index 2 & 3 fim.initialSolve(); OsiRowCut cuts[3]; // Generate one ineffective cut plus two trivial cuts int c; int nc = fim.getNumCols(); int *inx = new int[nc]; for (c=0;cnumberRows(); int * rowStatus = new int[numberRows]; int numberColumns = fim.getModelPtr()->numberColumns(); int * columnStatus = new int[numberColumns]; fim.getBasisStatus(columnStatus,rowStatus); for (int i=0; igetMajorDim() == 8, return, "clp", "getMatrixByCol: major dim"); OSIUNITTEST_ASSERT_ERROR(smP->getMinorDim() == 5, return, "clp", "getMatrixByCol: minor dim"); OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "clp", "getMatrixByCol: number of elements"); OSIUNITTEST_ASSERT_ERROR(smP->getSizeVectorStarts() == 9, return, "clp", "getMatrixByCol: vector starts size"); CoinRelFltEq eq; const double * ev = smP->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 5.6), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2], 1.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3], 2.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4], 1.1), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 1.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6],-2.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 2.8), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8],-1.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 1.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10], 1.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11],-1.2), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12],-1.0), {}, "clp", "getMatrixByCol: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "clp", "getMatrixByCol: elements"); const CoinBigIndex * mi = smP->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "clp", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 2, {}, "clp", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 4, {}, "clp", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 6, {}, "clp", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 8, {}, "clp", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 10, {}, "clp", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[6] == 11, {}, "clp", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[7] == 12, {}, "clp", "getMatrixByCol: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[8] == 14, {}, "clp", "getMatrixByCol: vector starts"); const int * ei = smP->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 4, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 0, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 1, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 1, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 2, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 0, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 3, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 0, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 4, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 2, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 3, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 0, {}, "clp", "getMatrixByCol: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 4, {}, "clp", "getMatrixByCol: indices"); } //-------------- // Test rowsense, rhs, rowrange, matrixByRow { OsiClpSolverInterface lhs; { OsiClpSolverInterface siC1(m); OSIUNITTEST_ASSERT_WARNING(siC1.rowrange_ == NULL, {}, "clp", "row range"); OSIUNITTEST_ASSERT_WARNING(siC1.rowsense_ == NULL, {}, "clp", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1.rhs_ == NULL, {}, "clp", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1.matrixByRow_ == NULL, {}, "clp", "matrix by row"); const char * siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "clp", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "clp", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "clp", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "clp", "row sense"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "clp", "row sense"); const double * siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "clp", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "clp", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "clp", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "clp", "right hand side"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "clp", "right hand side"); const double * siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "clp", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "clp", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "clp", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "clp", "row range"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "clp", "row range"); const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "clp", "matrix by row"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim() == 5, return, "clp", "matrix by row: major dim"); OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "clp", "matrix by row: num elements"); const double * ev = siC1mbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "clp", "matrix by row: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "clp", "matrix by row: elements"); const CoinBigIndex * mi = siC1mbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "clp", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "clp", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "clp", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "clp", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "clp", "matrix by row: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "clp", "matrix by row: vector starts"); const int * ei = siC1mbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "clp", "matrix by row: indices"); OSIUNITTEST_ASSERT_WARNING(siC1rs == siC1.getRowSense(), {}, "clp", "row sense"); OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "clp", "right hand side"); OSIUNITTEST_ASSERT_WARNING(siC1rr == siC1.getRowRange(), {}, "clp", "row range"); // Change CLP Model by adding free row OsiRowCut rc; rc.setLb(-COIN_DBL_MAX); rc.setUb( COIN_DBL_MAX); OsiCuts cuts; cuts.insert(rc); siC1.applyCuts(cuts); // Since model was changed, test that cached data is now freed. OSIUNITTEST_ASSERT_ERROR(siC1.rowrange_ == NULL, {}, "clp", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rowsense_ == NULL, {}, "clp", "free cached data after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1.rhs_ == NULL, {}, "clp", "free cached data after adding row"); // siC1.matrixByRow_ is updated, so it does not have to be NULL siC1rs = siC1.getRowSense(); OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "clp", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "clp", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "clp", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "clp", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "clp", "row sense after adding row"); OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "clp", "row sense after adding row"); siC1rhs = siC1.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "clp", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "clp", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "clp", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "clp", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "clp", "right hand side after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "clp", "right hand side after adding row"); siC1rr = siC1.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "clp", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "clp", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "clp", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "clp", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "clp", "row range after adding row"); OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "clp", "row range after adding row"); lhs = siC1; } // Test that lhs has correct values even though siC1 has gone out of scope OSIUNITTEST_ASSERT_ERROR(lhs.rowrange_ == NULL, {}, "clp", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rowsense_ == NULL, {}, "clp", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.rhs_ == NULL, {}, "clp", "freed origin after assignment"); OSIUNITTEST_ASSERT_ERROR(lhs.matrixByRow_ == NULL, {}, "clp", "freed origin after assignment"); const char * lhsrs = lhs.getRowSense(); OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "clp", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "clp", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "clp", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "clp", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "clp", "row sense after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "clp", "row sense after assignment"); const double * lhsrhs = lhs.getRightHandSide(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "clp", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "clp", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "clp", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "clp", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "clp", "right hand side after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "clp", "right hand side after assignment"); const double *lhsrr = lhs.getRowRange(); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "clp", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "clp", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "clp", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "clp", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "clp", "row range after assignment"); OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "clp", "row range after assignment"); const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow(); OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "clp", "matrix by row after assignment"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim() == 6, return, "clp", "matrix by row after assignment: major dim"); OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "clp", "matrix by row after assignment: num elements"); const double * ev = lhsmbr->getElements(); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "clp", "matrix by row after assignment: elements"); OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "clp", "matrix by row after assignment: elements"); const CoinBigIndex * mi = lhsmbr->getVectorStarts(); OSIUNITTEST_ASSERT_ERROR(mi[0] == 0, {}, "clp", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[1] == 5, {}, "clp", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[2] == 7, {}, "clp", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[3] == 9, {}, "clp", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "clp", "matrix by row after assignment: vector starts"); OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "clp", "matrix by row after assignment: vector starts"); const int * ei = lhsmbr->getIndices(); OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "clp", "matrix by row after assignment: indices"); OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "clp", "matrix by row after assignment: indices"); } } // Test ClpPlusMinusOneMatrix by way of loadProblem(ClpMatrixBase, ... ) { int pos_start[4] = {0,5,9,12}; int neg_start[4] = {3,7,11,12}; int col[12] = {0,1,2,3,4,5,6,7,0,1,2,3}; double rhs[3] = {0.0,0.0,0.0}; double cost[8]; double var_lb[8]; double var_ub[8]; for (int i = 0 ; i < 8 ; i++) { cost[i] = 1.0; var_lb[i] = 0.0; var_ub[i] = 1.0; } ClpPlusMinusOneMatrix pmone_matrix(3,8,false,col,pos_start,neg_start); OsiClpSolverInterface clpSi; OSIUNITTEST_CATCH_ERROR( {clpSi.loadProblem(pmone_matrix,var_lb,var_ub,cost,rhs,rhs); clpSi.initialSolve();}, {},"clp","loadProblem(ClpMatrixBase, ...)") } // Test add/delete columns { OsiClpSolverInterface m; std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); double inf = m.getInfinity(); CoinPackedVector c0; c0.insert(0, 4); c0.insert(1, 1); m.addCol(c0, 0, inf, 3); m.initialSolve(); double objValue = m.getObjValue(); CoinRelFltEq eq(1.0e-2); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after adding col"); // Try deleting first column int * d = new int[1]; d[0]=0; m.deleteCols(1,d); delete [] d; d=NULL; m.resolve(); objValue = m.getObjValue(); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after deleting first col"); // Try deleting column we added int iCol = m.getNumCols()-1; m.deleteCols(1,&iCol); m.resolve(); objValue = m.getObjValue(); OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after deleting added col"); } // Test branch and bound { OsiClpSolverInterface m; std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); // reduce printout m.setHintParam(OsiDoReducePrint,true,OsiHintTry); // test maximization int n = m.getNumCols(); int i; double * obj2 = new double[n]; const double * obj = m.getObjCoefficients(); for (i=0;i= 2 ) for ( i=0;i1.0e-7) printf("%d has value %g\n",i,cs[i]); } } // Test infeasible bounds { OsiClpSolverInterface solver; std::string fn = mpsDir+"exmip1"; solver.readMps(fn.c_str(),"mps"); int index[]={0}; double value[]={1.0,0.0}; solver.setColSetBounds(index,index+1,value); solver.setHintParam(OsiDoPresolveInInitial, false, OsiHintDo); solver.initialSolve(); OSIUNITTEST_ASSERT_ERROR(!solver.isProvenOptimal(), {}, "clp", "infeasible bounds"); } // Build a model { OsiClpSolverInterface model; std::string fn = mpsDir+"p0033"; model.readMps(fn.c_str(),"mps"); // Point to data int numberRows = model.getNumRows(); const double * rowLower = model.getRowLower(); const double * rowUpper = model.getRowUpper(); int numberColumns = model.getNumCols(); const double * columnLower = model.getColLower(); const double * columnUpper = model.getColUpper(); const double * columnObjective = model.getObjCoefficients(); // get row copy CoinPackedMatrix rowCopy = *model.getMatrixByRow(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const double * element = rowCopy.getElements(); // solve model.initialSolve(); // Now build new model CoinModel build; // Row bounds int iRow; for (iRow=0;iRow=0;iRow--) { int start = rowStart[iRow]; for (int j=start;j= 1) for (iColumn=0;iColumn=0) { int iColumn = triple.column(); if (iColumn*2messageHandler()->setLogLevel(4); m.initialSolve(); m.getModelPtr()->factorization()->maximumPivots(5); m.setObjSense(1.0); // clone to test pivot as well as primalPivot OsiSolverInterface * mm =m.clone(); // enable special mode m.enableSimplexInterface(true); // need to do after clone mm->enableSimplexInterface(true); // we happen to know that variables are 0-1 and rows are L int numberIterations=0; int numberColumns = m.getNumCols(); int numberRows = m.getNumRows(); double * fakeCost = new double[numberColumns]; double * duals = new double [numberRows]; double * djs = new double [numberColumns]; const double * solution = m.getColSolution(); memcpy(fakeCost,m.getObjCoefficients(),numberColumns*sizeof(double)); while (1) { const double * dj; const double * dual; if ((numberIterations&1)==0) { // use given ones dj = m.getReducedCost(); dual = m.getRowPrice(); } else { // create dj = djs; dual = duals; m.getReducedGradient(djs,duals,fakeCost); } int i; int colIn=9999; int direction=1; double best=1.0e-6; // find most negative reduced cost // Should check basic - but should be okay on this problem for (i=0;ibest) { direction=-1; best=value; colIn=-i-1; } } for (i=0;ibest&&solution[i]>1.0-1.0e-6) { direction=-1; best=value; colIn=i; } } if (colIn==9999) break; // should be optimal int colOut; int outStatus; double theta; OSIUNITTEST_ASSERT_ERROR(m.primalPivotResult(colIn,direction,colOut,outStatus,theta,NULL) == 0, {}, "clp", "solve model by hand"); if (OsiUnitTest::verbosity >= 1) printf("out %d, direction %d theta %g\n", colOut,outStatus,theta); if (colIn!=colOut) { OSIUNITTEST_ASSERT_ERROR(mm->pivot(colIn,colOut,outStatus) >= 0, {}, "clp", "solve model by hand"); } else { // bound flip (so pivot does not make sense) OSIUNITTEST_ASSERT_ERROR(mm->primalPivotResult(colIn,direction,colOut,outStatus,theta,NULL) == 0, {}, "clp", "solve model by hand"); } numberIterations++; } delete mm; delete [] fakeCost; delete [] duals; delete [] djs; // exit special mode m.disableSimplexInterface(); m.getModelPtr()->messageHandler()->setLogLevel(4); m.messageHandler()->setLogLevel(0); m.resolve(); OSIUNITTEST_ASSERT_ERROR(m.getIterationCount() == 0, {}, "clp", "resolve after solving model by hand"); m.setObjSense(-1.0); m.initialSolve(); } # if 0 /* This section stops working without setObjectiveAndRefresh. Assertion failure down in the guts of clp, likely due to reduced costs not properly updated. Leave the code in for a bit so it's easily recoverable if anyone actually yells about the loss. There was no response to a public announcement of intent to delete, but sometimes it takes a whack on the head to get peoples' attention. At some point, it'd be good to come back through and make this work again. -- lh, 100828 -- */ // Do parametrics on the objective by hand { std::cout << " Beginning Osi Simplex mode 2 ... " << std::endl ; OsiClpSolverInterface m; std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); ClpSimplex * simplex = m.getModelPtr(); simplex->messageHandler()->setLogLevel(4); m.initialSolve(); simplex->factorization()->maximumPivots(5); simplex->messageHandler()->setLogLevel(63); m.setObjSense(1.0); // enable special mode m.enableSimplexInterface(true); int numberIterations=0; int numberColumns = m.getNumCols(); int numberRows = m.getNumRows(); double * changeCost = new double[numberColumns]; double * duals = new double [numberRows]; double * djs = new double [numberColumns]; // As getReducedGradient mucks about with innards of Clp get arrays to save double * dualsNow = new double [numberRows]; double * djsNow = new double [numberColumns]; const double * solution = m.getColSolution(); int i; // Set up change cost for (i=0;igetRowStatus(i)==ClpSimplex::basic) { assert (fabs(dualsNow[i])<1.0e-4&&fabs(duals[i])<1.0e-4); } else { assert (dualsNow[i]<1.0e-4); if (duals[i]>1.0e-8) { if (dualsNow[i]+best*duals[i]>0.0) { best = CoinMax(-dualsNow[i]/duals[i],0.0); direction=-1; colIn=-i-1; } } } } for (i=0;igetColumnStatus(i)==ClpSimplex::basic) { assert (fabs(djsNow[i])<1.0e-4&&fabs(djs[i])<1.0e-4); } else { if (solution[i]<1.0e-6) { assert (djsNow[i]>-1.0e-4); if (djs[i]<-1.0e-8) { if (djsNow[i]+best*djs[i]<0.0) { best = CoinMax(-djsNow[i]/djs[i],0.0); direction=1; colIn=i; } } } else if (solution[i]>1.0-1.0e-6) { assert (djsNow[i]<1.0e-4); if (djs[i]>1.0e-8) { if (djsNow[i]+best*djs[i]>0.0) { best = CoinMax(-djsNow[i]/djs[i],0.0); direction=-1; colIn=i; } } } } } if (colIn==9999) break; // should be optimal // update objective - djs is spare array const double * obj = m.getObjCoefficients(); for (i=0;imessageHandler()->setLogLevel(4); m.resolve(); assert (!m.getIterationCount()); } # endif // Solve an lp when interface is on { OsiClpSolverInterface m; std::string fn = mpsDir+"p0033"; m.readMps(fn.c_str(),"mps"); // enable special mode m.setHintParam(OsiDoScale,false,OsiHintDo); m.setHintParam(OsiDoPresolveInInitial,false,OsiHintDo); m.setHintParam(OsiDoDualInInitial,false,OsiHintDo); m.setHintParam(OsiDoPresolveInResolve,false,OsiHintDo); m.setHintParam(OsiDoDualInResolve,false,OsiHintDo); m.enableSimplexInterface(true); m.initialSolve(); } // Check tableau stuff when simplex interface is on { OsiClpSolverInterface m; /* Wolsey : Page 130 max 4x1 - x2 7x1 - 2x2 <= 14 x2 <= 3 2x1 - 2x2 <= 3 x1 in Z+, x2 >= 0 */ double inf_ = m.getInfinity(); int n_cols = 2; int n_rows = 3; double obj[2] = {-4.0, 1.0}; double collb[2] = {0.0, 0.0}; double colub[2] = {inf_, inf_}; double rowlb[3] = {-inf_, -inf_, -inf_}; double rowub[3] = {14.0, 3.0, 3.0}; int rowIndices[5] = {0, 2, 0, 1, 2}; int colIndices[5] = {0, 0, 1, 1, 1}; double elements[5] = {7.0, 2.0, -2.0, 1.0, -2.0}; CoinPackedMatrix M(true, rowIndices, colIndices, elements, 5); m.loadProblem(M, collb, colub, obj, rowlb, rowub); m.enableSimplexInterface(true); m.initialSolve(); //check that the tableau matches wolsey (B-1 A) // slacks in second part of binvA double * binvA = (double*) malloc((n_cols+n_rows) * sizeof(double)); if (OsiUnitTest::verbosity >= 2) printf("B-1 A"); int i; for( i = 0; i < n_rows; i++){ m.getBInvARow(i, binvA,binvA+n_cols); if (OsiUnitTest::verbosity >= 2) { printf("\nrow: %d -> ",i); for(int j=0; j < n_cols+n_rows; j++) printf("%g, ", binvA[j]); } } if (OsiUnitTest::verbosity >= 2) { printf("\n"); printf("And by column"); } for( i = 0; i < n_cols+n_rows; i++){ m.getBInvACol(i, binvA); if (OsiUnitTest::verbosity >= 2) { printf("\ncolumn: %d -> ",i); for(int j=0; j < n_rows; j++) printf("%g, ", binvA[j]); } } if (OsiUnitTest::verbosity >= 2) printf("\n"); // and when doing as expert m.setSpecialOptions(m.specialOptions()|512); ClpSimplex * clp = m.getModelPtr(); /* Do twice - first time with enableSimplexInterface still set then without and with scaling */ for (int iPass=0;iPass<2;iPass++) { const double * rowScale = clp->rowScale(); const double * columnScale = clp->columnScale(); # if 0 if (!iPass) assert (!rowScale); else assert (rowScale); // only true for this example # endif /* has to be exactly correct as in OsiClpsolverInterface.cpp (also redo each pass as may change */ CoinIndexedVector * rowArray = clp->rowArray(1); CoinIndexedVector * columnArray = clp->columnArray(0); int n; int * which; double * array; if (OsiUnitTest::verbosity >= 2) printf("B-1 A"); for( i = 0; i < n_rows; i++){ m.getBInvARow(i, binvA,binvA+n_cols); if (OsiUnitTest::verbosity >= 2) printf("\nrow: %d -> ",i); int j; // First columns n = columnArray->getNumElements(); which = columnArray->getIndices(); array = columnArray->denseVector(); for(j=0; j < n; j++){ int k=which[j]; if (OsiUnitTest::verbosity >= 2) { if (!columnScale) { printf("(%d %g), ", k, array[k]); } else { printf("(%d %g), ", k, array[k]/columnScale[k]); } } // zero out array[k]=0.0; } // say empty columnArray->setNumElements(0); // and check (would not be in any production code) columnArray->checkClear(); // now rows n = rowArray->getNumElements(); which = rowArray->getIndices(); array = rowArray->denseVector(); for(j=0; j < n; j++){ int k=which[j]; if (OsiUnitTest::verbosity >= 2) { if (!rowScale) { printf("(%d %g), ", k+n_cols, array[k]); } else { printf("(%d %g), ", k+n_cols, array[k]*rowScale[k]); } } // zero out array[k]=0.0; } // say empty rowArray->setNumElements(0); // and check (would not be in any production code) rowArray->checkClear(); } if (OsiUnitTest::verbosity >= 2) { printf("\n"); printf("And by column (trickier)"); } const int * pivotVariable = clp->pivotVariable(); for( i = 0; i < n_cols+n_rows; i++){ m.getBInvACol(i, binvA); if (OsiUnitTest::verbosity >= 2) printf("\ncolumn: %d -> ",i); n = rowArray->getNumElements(); which = rowArray->getIndices(); array = rowArray->denseVector(); for(int j=0; j < n; j++){ int k=which[j]; // need to know pivot variable for +1/-1 (slack) and row/column scaling int pivot = pivotVariable[k]; if (OsiUnitTest::verbosity >= 2) { if (pivotsetNumElements(0); // and check (would not be in any production code) rowArray->checkClear(); } if (OsiUnitTest::verbosity >= 2) printf("\n"); // now deal with next pass if (!iPass) { m.disableSimplexInterface(); // see if we can get scaling for testing clp->scaling(1); m.enableFactorization(); } else { // may not be needed - but cleaner m.disableFactorization(); } } m.setSpecialOptions(m.specialOptions()&~512); free(binvA); // Do using newer interface m.enableFactorization(); { CoinIndexedVector * rowArray = new CoinIndexedVector(n_rows); CoinIndexedVector * columnArray = new CoinIndexedVector(n_cols); int n; int * which; double * array; if (OsiUnitTest::verbosity >= 2) printf("B-1 A"); for( i = 0; i < n_rows; i++){ m.getBInvARow(i, columnArray,rowArray); if (OsiUnitTest::verbosity >= 2) printf("\nrow: %d -> ",i); int j; // First columns n = columnArray->getNumElements(); which = columnArray->getIndices(); array = columnArray->denseVector(); for(j=0; j < n; j++){ int k=which[j]; if (OsiUnitTest::verbosity >= 2) printf("(%d %g), ", k, array[k]); // zero out array[k]=0.0; } // say empty (if I had not zeroed array[k] I would use ->clear()) columnArray->setNumElements(0); // and check (would not be in any production code) columnArray->checkClear(); // now rows n = rowArray->getNumElements(); which = rowArray->getIndices(); array = rowArray->denseVector(); for(j=0; j < n; j++){ int k=which[j]; if (OsiUnitTest::verbosity >= 2) printf("(%d %g), ", k+n_cols, array[k]); // zero out array[k]=0.0; } // say empty rowArray->setNumElements(0); // and check (would not be in any production code) rowArray->checkClear(); } if (OsiUnitTest::verbosity >= 2) { printf("\n"); printf("And by column"); } for( i = 0; i < n_cols+n_rows; i++){ m.getBInvACol(i, rowArray); if (OsiUnitTest::verbosity >= 2) printf("\ncolumn: %d -> ",i); n = rowArray->getNumElements(); which = rowArray->getIndices(); array = rowArray->denseVector(); for(int j=0; j < n; j++){ int k=which[j]; if (OsiUnitTest::verbosity >= 2) printf("(%d %g), ", k, array[k]); // zero out array[k]=0.0; } // say empty rowArray->setNumElements(0); // and check (would not be in any production code) rowArray->checkClear(); } if (OsiUnitTest::verbosity >= 2) printf("\n"); delete rowArray; delete columnArray; } // may not be needed - but cleaner m.disableFactorization(); } // Check tableau stuff when simplex interface is off { OsiClpSolverInterface m; /* Wolsey : Page 130 max 4x1 - x2 7x1 - 2x2 <= 14 x2 <= 3 2x1 - 2x2 <= 3 x1 in Z+, x2 >= 0 */ double inf_ = m.getInfinity(); int n_cols = 2; int n_rows = 3; double obj[2] = {-4.0, 1.0}; double collb[2] = {0.0, 0.0}; double colub[2] = {inf_, inf_}; double rowlb[3] = {-inf_, -inf_, -inf_}; double rowub[3] = {14.0, 3.0, 3.0}; int rowIndices[5] = {0, 2, 0, 1, 2}; int colIndices[5] = {0, 0, 1, 1, 1}; double elements[5] = {7.0, 2.0, -2.0, 1.0, -2.0}; CoinPackedMatrix M(true, rowIndices, colIndices, elements, 5); m.loadProblem(M, collb, colub, obj, rowlb, rowub); // Test with scaling m.setHintParam(OsiDoScale,true); // Tell code to keep factorization m.setupForRepeatedUse(3,0); m.initialSolve(); // Repeated stuff only in resolve // m.resolve(); (now in both (just for (3,0)) //check that the tableau matches wolsey (B-1 A) // slacks in second part of binvA double * binvA = (double*) malloc((n_cols+n_rows) * sizeof(double)); // and getBasics int * pivots = new int[n_rows]; m.getBasics(pivots); if (OsiUnitTest::verbosity >= 2) printf("B-1 A"); int i; for( i = 0; i < n_rows; i++){ m.getBInvARow(i, binvA,binvA+n_cols); if (OsiUnitTest::verbosity >= 2) { printf("\nrow: %d (pivot %d) -> ",i,pivots[i]); for(int j=0; j < n_cols+n_rows; j++) printf("%g, ", binvA[j]); } } if (OsiUnitTest::verbosity >= 2) { printf("\n"); printf("And by column"); } for( i = 0; i < n_cols+n_rows; i++){ m.getBInvACol(i, binvA); if (OsiUnitTest::verbosity >= 2) { printf("\ncolumn: %d -> ",i); for(int j=0; j < n_rows; j++) printf("%g, ", binvA[j]); } } if (OsiUnitTest::verbosity >= 2) printf("\n"); free(binvA); delete [] pivots; } // Do common solverInterface testing { OsiClpSolverInterface m; OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir); } } CoinMP-1.8.3/Clp/missing0000755000175000017500000002540611405215425013437 0ustar renerene#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Clp/install-sh0000755000175000017500000002202111405215425014032 0ustar renerene#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: CoinMP-1.8.3/Clp/configure.ac0000644000175000017500000001731212600050735014322 0ustar renerene# Copyright (C) 2006 International Business Machines. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: configure.ac 2167 2015-09-21 18:52:13Z tkr $ # Author: Andreas Waechter IBM 2006-04-13 ############################################################################# # Names and other basic things # ############################################################################# AC_PREREQ(2.59) AC_INIT([Clp],[1.16.8],[clp@list.coin-or.org]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. All Rights Reserved. This file is part of the open source package Coin which is distributed under the Eclipse Public License.]) # List one file in the package so that the configure script can test # whether the package is actually there AC_CONFIG_SRCDIR(src/ClpSimplex.cpp) # Where should everything be installed by default? Here, we want it # to be installed directly in 'bin', 'lib', 'include' subdirectories # of the directory where configure is run. The default would be # /usr/local. AC_PREFIX_DEFAULT([`pwd`]) ############################################################################# # Standard build tool stuff # ############################################################################# # Get the system type AC_CANONICAL_BUILD # If this project depends on external projects, the Externals file in # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. AC_COIN_PROJECTDIR_INIT(Clp,14:8:13) # Check if user wants to produce debugging code AC_COIN_DEBUG_COMPILE(Clp) # Get the name of the C++ compiler and appropriate compiler options AC_COIN_PROG_CXX # Initialize automake and libtool AC_COIN_INIT_AUTO_TOOLS ############################################################################# # COIN-OR components # ############################################################################# AC_COIN_CHECK_PACKAGE(CoinUtils, [coinutils], [ClpLib]) if test $coin_has_coinutils != yes ; then AC_MSG_ERROR([Required package CoinUtils not available.]) fi AC_COIN_CHECK_PACKAGE(Osi, [osi], [OsiClpLib]) AC_COIN_CHECK_PACKAGE(OsiTests, [osi-unittests]) AC_COIN_CHECK_PACKAGE(Sample, [coindatasample]) AC_COIN_CHECK_PACKAGE(Netlib, [coindatanetlib]) ############################################################################# # Aboca # ############################################################################# # 1 - build Abc serial but no inherit code # 2 - build Abc serial and inherit code # 3 - build Abc cilk parallel but no inherit code # 4 - build Abc cilk parallel and inherit code AC_ARG_ENABLE([aboca], [AC_HELP_STRING([--enable-aboca],[enables build of Aboca solver (set to 1,2,3,4)])], [use_aboca=$enableval], [use_aboca=no]) if test "$use_aboca" = yes ; then use_aboca=1 fi case "$use_aboca" in 1 | 2 | 3 | 4) AC_DEFINE_UNQUOTED([CLP_HAS_ABC], [$use_aboca], [Define to 1, 2, 3, or 4 if Aboca should be build.]) ;; no) ;; *) AC_MSG_ERROR([invalid argument for --enable-aboca: $use_aboca]) ;; esac AM_CONDITIONAL(COIN_HAS_ABC, test ! "$use_aboca" = no) ############################################################################# # Third party linear solvers # ############################################################################# # AMD from UFL AC_COIN_CHECK_USER_LIBRARY(AMD, AMD, [amd.h], [amd_defaults],,[ClpLib]) # CHOLMOD from UFL # CHOLMOD requires AMD, which can be given by AMD_LIBS # CHOLMOD requires Blas and Lapack? coin_save_LIBS="$LIBS" LIBS="$LIBS $AMD_LIBS" AC_COIN_CHECK_USER_LIBRARY(CHOLMOD, CHOLMOD, [cholmod.h], [cholmod_start],,[ClpLib]) LIBS="$coin_save_LIBS" # Glpk also brings AMD if test $coin_has_cholmod = false -a $coin_has_amd = false ; then AC_COIN_CHECK_PACKAGE(Glpk, [coinglpk], [ClpLib]) if test $coin_has_glpk = yes ; then AC_MSG_NOTICE([using AMD from GLPK package]) AC_DEFINE(COIN_HAS_AMD,[1],[Define to 1 if the AMD package is available]) fi else # for configure AM_CONDITIONAL(COIN_HAS_GLPK, [test 0 = 1]) fi # MUMPS AC_COIN_CHECK_PACKAGE(Mumps, [coinmumps], [ClpLib]) # WSMP AC_ARG_WITH([wsmp], AC_HELP_STRING([--with-wsmp], [specify WSMP library]), [use_wsmp=$withval], [use_wsmp=no]) if test "$use_wsmp" != "no"; then # Check how to link against Fortran libraries from C AC_COIN_PROG_F77 AC_COIN_F77_WRAPPERS # WSMP requires Blas AC_COIN_CHECK_PACKAGE_BLAS(ClpLib) coin_save_LIBS="$LIBS" LIBS="$LIBS $use_wsmp $BLAS_LIBS" AC_LANG_PUSH([Fortran 77]) AC_MSG_CHECKING([whether user-supplied WSMP library \"$use_wsmp\" works]) AC_TRY_LINK([],[ call WSSMP()], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) AC_MSG_ERROR([WSMP library $use_wsmp does not seem to work])]) AC_LANG_POP([Fortran 77]) LIBS="$coin_save_LIBS" AC_DEFINE_UNQUOTED([COIN_HAS_WSMP], [1], [Define to 1 if the WSMP package is available]) CLPLIB_LIBS="$use_wsmp $CLPLIB_LIBS" CLPLIB_LIBS_INSTALLED="$use_wsmp $CLPLIB_LIBS_INSTALLED" CLPLIB_PCLIBS="$use_wsmp $CLPLIB_PCLIBS" else # to please configure AM_CONDITIONAL(COIN_HAS_BLAS, [test 0 = 1]) fi AM_CONDITIONAL(COIN_HAS_WSMP, [test "$use_wsmp" != no]) ############################################################################# # Other dependencies # ############################################################################# # Ampl Solver library AC_COIN_CHECK_PACKAGE(ASL, [coinasl], [ClpLib]) AC_COIN_CHECK_GNU_READLINE(ClpLib) AC_COIN_CHECK_CXX_CHEADER(math) AC_COIN_CHECK_CXX_CHEADER(float) AC_COIN_CHECK_CXX_CHEADER(ieeefp) ############################################################################## # VPATH links for example input files # ############################################################################## # In case this is a VPATH configuration we need to make sure that the # input files for the examples are available in the VPATH directory. AC_COIN_VPATH_LINK(examples/hello.mps) AC_COIN_VPATH_LINK(examples/input.130) AC_COIN_VPATH_LINK(examples/g.tiny) AC_COIN_VPATH_LINK(examples/gparm.tiny) ############################################################################# # Check for doxygen # ############################################################################# AC_COIN_DOXYGEN(CoinUtils Osi) ############################################################################## # Finishing up by writing all the output # ############################################################################## # Here list all the files that configure should create (except for the # configuration header file) AC_CONFIG_FILES([Makefile examples/Makefile src/Makefile src/OsiClp/Makefile test/Makefile clp.pc clp-uninstalled.pc]) if test $coin_has_osi = yes ; then AC_CONFIG_FILES([osi-clp.pc:src/OsiClp/osi-clp.pc.in osi-clp-uninstalled.pc:src/OsiClp/osi-clp-uninstalled.pc.in]) fi AC_CONFIG_FILES([doxydoc/doxygen.conf]) # Here put the location and name of the configuration header file AC_CONFIG_HEADER([src/config.h src/config_clp.h]) # Finally, we let configure write all the output... AC_COIN_FINALIZE CoinMP-1.8.3/Clp/doxydoc/0000755000175000017500000000000012600453455013507 5ustar renereneCoinMP-1.8.3/Clp/doxydoc/doxygen.conf.in0000644000175000017500000017377512231275133016457 0ustar renerene# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doxydoc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = "@abs_top_srcdir@" # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = @coin_doxy_logname@ #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @abs_top_srcdir@/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.hpp \ *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.svn* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 3 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = YES # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = YES # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = letter # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = @coin_doxy_tagfiles@ # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = @coin_doxy_tagname@ # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = YES # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = @coin_doxy_usedot@ # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES CoinMP-1.8.3/Clp/clp.pc.in0000644000175000017500000000047412323253043013543 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: CLP Description: COIN-OR Linear Programming Solver URL: https://projects.coin-or.org/Clp Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lClpSolver -lClp @CLPLIB_PCLIBS@ Cflags: -I${includedir} Requires: @CLPLIB_PCREQUIRES@ CoinMP-1.8.3/Clp/src/0000755000175000017500000000000012600453455012625 5ustar renereneCoinMP-1.8.3/Clp/src/AbcNonLinearCost.hpp0000644000175000017500000002153712306377527016502 0ustar renerene/* $Id: AbcNonLinearCost.hpp 2024 2014-03-07 17:18:15Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef AbcNonLinearCost_H #define AbcNonLinearCost_H #include "CoinPragma.hpp" #include "AbcCommon.hpp" class AbcSimplex; class CoinIndexedVector; /** Trivial class to deal with non linear costs I don't make any explicit assumptions about convexity but I am sure I do make implicit ones. One interesting idea for normal LP's will be to allow non-basic variables to come into basis as infeasible i.e. if variable at lower bound has very large positive reduced cost (when problem is infeasible) could it reduce overall problem infeasibility more by bringing it into basis below its lower bound. Another feature would be to automatically discover when problems are convex piecewise linear and re-formulate to use non-linear. I did some work on this many years ago on "grade" problems, but while it improved primal interior point algorithms were much better for that particular problem. */ /* status has original status and current status 0 - below lower so stored is upper 1 - in range 2 - above upper so stored is lower 4 - (for current) - same as original */ #define CLP_BELOW_LOWER 0 #define CLP_FEASIBLE 1 #define CLP_ABOVE_UPPER 2 #define CLP_SAME 4 #ifndef ClpNonLinearCost_H inline int originalStatus(unsigned char status) { return (status & 15); } inline int currentStatus(unsigned char status) { return (status >> 4); } inline void setOriginalStatus(unsigned char & status, int value) { status = static_cast(status & ~15); status = static_cast(status | value); } inline void setCurrentStatus(unsigned char &status, int value) { status = static_cast(status & ~(15 << 4)); status = static_cast(status | (value << 4)); } inline void setInitialStatus(unsigned char &status) { status = static_cast(CLP_FEASIBLE | (CLP_SAME << 4)); } inline void setSameStatus(unsigned char &status) { status = static_cast(status & ~(15 << 4)); status = static_cast(status | (CLP_SAME << 4)); } #endif class AbcNonLinearCost { public: /**@name Constructors, destructor */ //@{ /// Default constructor. AbcNonLinearCost(); /** Constructor from simplex. This will just set up wasteful arrays for linear, but later may do dual analysis and even finding duplicate columns . */ AbcNonLinearCost(AbcSimplex * model); /// Destructor ~AbcNonLinearCost(); // Copy AbcNonLinearCost(const AbcNonLinearCost&); // Assignment AbcNonLinearCost& operator=(const AbcNonLinearCost&); //@} /**@name Actual work in primal */ //@{ /** Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variables to bounds and all free variables to zero if oldTolerance is non-zero - but does not move those <= oldTolerance away*/ void checkInfeasibilities(double oldTolerance = 0.0); /** Changes infeasible costs for each variable The indices are row indices and need converting to sequences */ void checkInfeasibilities(int numberInArray, const int * index); /** Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. On input array is empty (but indices exist). On exit just changed costs will be stored as normal CoinIndexedVector */ void checkChanged(int numberInArray, CoinIndexedVector * update); /** Goes through one bound for each variable. If multiplier*work[iRow]>0 goes down, otherwise up. The indices are row indices and need converting to sequences Temporary offsets may be set Rhs entries are increased */ void goThru(int numberInArray, double multiplier, const int * index, const double * work, double * rhs); /** Takes off last iteration (i.e. offsets closer to 0) */ void goBack(int numberInArray, const int * index, double * rhs); /** Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. At the end of this all temporary offsets are zero */ void goBackAll(const CoinIndexedVector * update); /// Temporary zeroing of feasible costs void zapCosts(); /// Refreshes costs always makes row costs zero void refreshCosts(const double * columnCosts); /// Puts feasible bounds into lower and upper void feasibleBounds(); /// Refresh - assuming regions OK void refresh(); /// Refresh - from original void refreshFromPerturbed(double tolerance); /** Sets bounds and cost for one variable Returns change in cost May need to be inline for speed */ double setOne(int sequence, double solutionValue); /** Sets bounds and cost for one variable Returns change in cost May need to be inline for speed */ double setOneBasic(int iRow, double solutionValue); /** Sets bounds and cost for outgoing variable may change value Returns direction */ int setOneOutgoing(int sequence, double &solutionValue); /// Returns nearest bound double nearest(int iRow, double solutionValue); /** Returns change in cost - one down if alpha >0.0, up if <0.0 Value is current - new */ inline double changeInCost(int /*sequence*/, double alpha) const { return (alpha > 0.0) ? infeasibilityWeight_ : -infeasibilityWeight_; } inline double changeUpInCost(int /*sequence*/) const { return -infeasibilityWeight_; } inline double changeDownInCost(int /*sequence*/) const { return infeasibilityWeight_; } /// This also updates next bound inline double changeInCost(int iRow, double alpha, double &rhs) { int sequence=model_->pivotVariable()[iRow]; double returnValue = 0.0; unsigned char iStatus = status_[sequence]; int iWhere = currentStatus(iStatus); if (iWhere == CLP_SAME) iWhere = originalStatus(iStatus); // rhs always increases if (iWhere == CLP_FEASIBLE) { if (alpha > 0.0) { // going below iWhere = CLP_BELOW_LOWER; rhs = COIN_DBL_MAX; } else { // going above iWhere = CLP_ABOVE_UPPER; rhs = COIN_DBL_MAX; } } else if (iWhere == CLP_BELOW_LOWER) { assert (alpha < 0); // going feasible iWhere = CLP_FEASIBLE; rhs += bound_[sequence] - model_->upperRegion()[sequence]; } else { assert (iWhere == CLP_ABOVE_UPPER); // going feasible iWhere = CLP_FEASIBLE; rhs += model_->lowerRegion()[sequence] - bound_[sequence]; } setCurrentStatus(status_[sequence], iWhere); returnValue = fabs(alpha) * infeasibilityWeight_; return returnValue; } //@} /**@name Gets and sets */ //@{ /// Number of infeasibilities inline int numberInfeasibilities() const { return numberInfeasibilities_; } /// Change in cost inline double changeInCost() const { return changeCost_; } /// Feasible cost inline double feasibleCost() const { return feasibleCost_; } /// Feasible cost with offset and direction (i.e. for reporting) double feasibleReportCost() const; /// Sum of infeasibilities inline double sumInfeasibilities() const { return sumInfeasibilities_; } /// Largest infeasibility inline double largestInfeasibility() const { return largestInfeasibility_; } /// Average theta inline double averageTheta() const { return averageTheta_; } inline void setAverageTheta(double value) { averageTheta_ = value; } inline void setChangeInCost(double value) { changeCost_ = value; } //@} ///@name Private functions to deal with infeasible regions inline unsigned char * statusArray() const { return status_; } inline int getCurrentStatus(int sequence) {return (status_[sequence] >> 4);} /// For debug void validate(); //@} private: /**@name Data members */ //@{ /// Change in cost because of infeasibilities double changeCost_; /// Feasible cost double feasibleCost_; /// Current infeasibility weight double infeasibilityWeight_; /// Largest infeasibility double largestInfeasibility_; /// Sum of infeasibilities double sumInfeasibilities_; /// Average theta - kept here as only for primal double averageTheta_; /// Number of rows (mainly for checking and copy) int numberRows_; /// Number of columns (mainly for checking and copy) int numberColumns_; /// Model AbcSimplex * model_; /// Number of infeasibilities found int numberInfeasibilities_; // new stuff /// Contains status at beginning and current unsigned char * status_; /// Bound which has been replaced in lower_ or upper_ double * bound_; /// Feasible cost array double * cost_; //@} }; #endif CoinMP-1.8.3/Clp/src/CoinAbcBaseFactorization2.cpp0000644000175000017500000013140712101105055020231 0ustar renerene/* $Id: CoinAbcBaseFactorization2.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef ABC_JUST_ONE_FACTORIZATION #include "CoinAbcCommonFactorization.hpp" #define CoinAbcTypeFactorization CoinAbcBaseFactorization #define ABC_SMALL -2 #include "CoinAbcBaseFactorization.hpp" #endif #ifdef CoinAbcTypeFactorization #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinFinite.hpp" // factorSparse. Does sparse phase of factorization //return code is <0 error, 0= finished CoinSimplexInt CoinAbcTypeFactorization::factorSparse ( ) { CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; CoinSimplexInt * COIN_RESTRICT indexColumn = indexColumnUAddress_; CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; workArea_.conditionalNew(numberRows_); workAreaAddress_=workArea_.array(); CoinFactorizationDouble * COIN_RESTRICT workArea = workAreaAddress_; double initialLargest = preProcess3(); // adjust for test initialLargest=1.0e-10/initialLargest; #if ABC_NORMAL_DEBUG>0 double largestPivot=1.0; double smallestPivot=1.0; #endif CoinSimplexInt status = 0; //do slacks first CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; //CoinSimplexInt * numberInColumnPlus = numberInColumnPlusAddress_; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; //CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; CoinZeroN ( workArea, numberRows_ ); CoinSimplexInt * COIN_RESTRICT nextCount = this->nextCountAddress_; CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCountAddress_; CoinBigIndex * COIN_RESTRICT startRow = startRowUAddress_; CoinBigIndex * COIN_RESTRICT startColumn = startColumnU; #if 0 { int checkEls=0; for (CoinSimplexInt iColumn=0;iColumn1 CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif //#define PRINT_INVERT_STATS #ifdef PRINT_INVERT_STATS int numberGoodUX=numberGoodU_; int numberTakenOutOfUSpace=0; #endif CoinSimplexInt look = firstCount[1]; while (look>=0) { checkLinks(1); CoinSimplexInt iPivotRow; CoinSimplexInt iPivotColumn=-1; #ifdef SMALL_PERMUTE int realPivotRow; int realPivotColumn=-1; #endif CoinFactorizationDouble pivotMultiplier=0.0; if ( look < numberRows_ ) { assert (numberInRow[look]==1); iPivotRow = look; CoinBigIndex start = startRow[iPivotRow]; iPivotColumn = indexColumn[start]; #ifdef SMALL_PERMUTE realPivotRow=fromSmallToBigRow_[iPivotRow]; realPivotColumn=fromSmallToBigColumn_[iPivotColumn]; //printf("singleton row realPivotRow %d realPivotColumn %d\n", // realPivotRow,realPivotColumn); #endif assert (numberInColumn[iPivotColumn]>0); CoinBigIndex startC = startColumn[iPivotColumn]; double minimumValue = fabs(element[startC]*tolerance ); #if CONVERTROW<2 CoinBigIndex where = startC; while ( indexRow[where] != iPivotRow ) { where++; } #else CoinBigIndex where = convertRowToColumn[start]; #endif assert ( where < startC+numberInColumn[iPivotColumn]); CoinFactorizationDouble value = element[where]; // size shouldn't matter as would be taken if matrix flipped but ... if ( fabs(value) > minimumValue ) { CoinSimplexInt numberDoColumn=numberInColumn[iPivotColumn]; totalElements_ -= numberDoColumn; // L is always big enough here //store column in L, compress in U and take column out CoinBigIndex l = lengthL_; lengthL_ += numberDoColumn-1; pivotMultiplier = 1.0/value; CoinBigIndex endC = startC + numberDoColumn; for (CoinBigIndex i = startC; i < endC; i++ ) { if (i!=where) { CoinSimplexInt iRow = indexRow[i]; #ifdef SMALL_PERMUTE indexRowL[l] = fromSmallToBigRow_[iRow]; #else indexRowL[l] = iRow; #endif elementL[l] = element[i] * pivotMultiplier; l++; //take out of row list CoinBigIndex startR = startRow[iRow]; CoinSimplexInt iNumberInRow = numberInRow[iRow]; CoinBigIndex endR = startR + iNumberInRow; #if CONVERTROW<2 CoinBigIndex whereRow = startR; while ( indexColumn[whereRow] != iPivotColumn ) whereRow++; assert ( whereRow < endR ); #else CoinBigIndex whereRow = convertColumnToRow[i]; #endif int iColumn = indexColumn[endR-1]; indexColumn[whereRow] = iColumn; #if CONVERTROW>1 CoinBigIndex whereColumnEntry = convertRowToColumn[endR-1]; convertRowToColumn[whereRow] = whereColumnEntry; convertColumnToRow[whereColumnEntry] = whereRow; #endif iNumberInRow--; numberInRow[iRow] = iNumberInRow; modifyLink ( iRow, iNumberInRow ); checkLinks(); } } } else { //printf("Rejecting as element %g largest %g\n",value,element[startC]); } } else { iPivotColumn = look - numberRows_; assert ( numberInColumn[iPivotColumn] == 1 ); { CoinBigIndex startC = startColumn[iPivotColumn]; iPivotRow = indexRow[startC]; #ifdef SMALL_PERMUTE realPivotRow=fromSmallToBigRow_[iPivotRow]; realPivotColumn=fromSmallToBigColumn_[iPivotColumn]; int realPivotRow; realPivotRow=fromSmallToBigRow_[iPivotRow]; indexRow[startC]=realPivotRow; //printf("singleton column realPivotRow %d realPivotColumn %d\n", // realPivotRow,realPivotColumn); #endif //store pivot columns (so can easily compress) assert (numberInColumn[iPivotColumn]==1); CoinSimplexInt numberDoRow = numberInRow[iPivotRow]; int numberDoColumn = numberInColumn[iPivotColumn] - 1; totalElements_ -= ( numberDoRow + numberDoColumn ); CoinBigIndex startR = startRow[iPivotRow]; CoinBigIndex endR = startR + numberDoRow ; //clean up counts pivotMultiplier = 1.0/element[startC]; // would I be better off doing other way first?? for (CoinBigIndex i = startR; i < endR; i++ ) { CoinSimplexInt iColumn = indexColumn[i]; if (iColumn==iPivotColumn) continue; assert ( numberInColumn[iColumn] ); CoinSimplexInt number = numberInColumn[iColumn] - 1; //modify linked list modifyLink ( iColumn + numberRows_, number ); CoinBigIndex start = startColumn[iColumn]; //move pivot row element if ( number ) { #if CONVERTROW<2 CoinBigIndex pivot = start; CoinSimplexInt iRow = indexRow[pivot]; while ( iRow != iPivotRow ) { pivot++; iRow = indexRow[pivot]; } #else CoinBigIndex pivot= convertRowToColumn[i]; #endif assert (pivot < startColumn[iColumn] + numberInColumn[iColumn]); if ( pivot != start ) { //move largest one up CoinFactorizationDouble value = element[start]; int iRow = indexRow[start]; element[start] = element[pivot]; indexRow[start] = indexRow[pivot]; element[pivot] = element[start + 1]; indexRow[pivot] = indexRow[start + 1]; #if CONVERTROW>1 CoinBigIndex whereRowEntry = convertColumnToRow[start+1]; CoinBigIndex whereRowEntry2 = convertColumnToRow[start]; convertRowToColumn[whereRowEntry] = pivot; convertColumnToRow[pivot] = whereRowEntry; convertRowToColumn[whereRowEntry2] = start+1; convertColumnToRow[start+1] = whereRowEntry2; #endif element[start + 1] = value; indexRow[start + 1] = iRow; } else { //find new largest element CoinSimplexInt iRowSave = indexRow[start + 1]; CoinFactorizationDouble valueSave = element[start + 1]; CoinFactorizationDouble valueLargest = fabs ( valueSave ); CoinBigIndex end = start + numberInColumn[iColumn]; CoinBigIndex largest = start + 1; for (CoinBigIndex k = start + 2; k < end; k++ ) { CoinFactorizationDouble value = element[k]; CoinFactorizationDouble valueAbs = fabs ( value ); if ( valueAbs > valueLargest ) { valueLargest = valueAbs; largest = k; } } indexRow[start + 1] = indexRow[largest]; element[start + 1] = element[largest]; #if CONVERTROW>1 CoinBigIndex whereRowEntry = convertColumnToRow[largest]; CoinBigIndex whereRowEntry2 = convertColumnToRow[start+1]; convertRowToColumn[whereRowEntry] = start+1; convertColumnToRow[start+1] = whereRowEntry; convertRowToColumn[whereRowEntry2] = largest; convertColumnToRow[largest] = whereRowEntry2; #endif indexRow[largest] = iRowSave; element[largest] = valueSave; } } //clean up counts numberInColumn[iColumn]--; numberInColumnPlus[iColumn]++; #ifdef SMALL_PERMUTE indexRow[start]=realPivotRow; #endif startColumn[iColumn]++; } } } if (pivotMultiplier) { numberGoodL_++; startColumnL[numberGoodL_] = lengthL_; //take out this bit of indexColumnU CoinSimplexInt next = nextRow[iPivotRow]; CoinSimplexInt last = lastRow[iPivotRow]; nextRow[last] = next; lastRow[next] = last; lastRow[iPivotRow] =-2; //mark #ifdef SMALL_PERMUTE // mark fromSmallToBigRow_[iPivotRow]=-1; fromSmallToBigColumn_[iPivotColumn]=-1; permuteAddress_[realPivotRow]=numberGoodU_; #else permuteAddress_[iPivotRow]=numberGoodU_; #endif #ifdef ABC_USE_FUNCTION_POINTERS int number = numberInColumnPlus[iPivotColumn]; #ifdef SMALL_PERMUTE #if ABC_USE_FUNCTION_POINTERS if (number<9) { scatter[realPivotRow].functionPointer=AbcScatterLowSubtract[number]; } else { scatter[realPivotRow].functionPointer=AbcScatterHighSubtract[number&3]; } #endif scatter[realPivotRow].offset=lastEntryByColumnUPlus_; scatter[realPivotRow].number=number; #else #if ABC_USE_FUNCTION_POINTERS if (number<9) { scatter[iPivotRow].functionPointer=AbcScatterLowSubtract[number]; } else { scatter[iPivotRow].functionPointer=AbcScatterHighSubtract[number&3]; } #endif scatter[iPivotRow].offset=lastEntryByColumnUPlus_; scatter[iPivotRow].number=number; #endif CoinBigIndex startC = startColumn[iPivotColumn]-number; for (int i=startC;i(elementUColumnPlus+lastEntryByColumnUPlus_),indexRow+startC,number); lastEntryByColumnUPlus_ += (number+1)>>1; #endif numberInColumn[iPivotColumn] = 0; numberInRow[iPivotRow] = 0; //modify linked list for pivots deleteLink ( iPivotRow ); deleteLink ( iPivotColumn + numberRows_ ); checkLinks(); #ifdef SMALL_PERMUTE assert (permuteAddress_[realPivotRow]==numberGoodU_); pivotColumn[numberGoodU_] = realPivotColumn; #else assert (permuteAddress_[iPivotRow]==numberGoodU_); pivotColumn[numberGoodU_] = iPivotColumn; #endif pivotRegion[numberGoodU_] = pivotMultiplier; numberGoodU_++; } else { //take out for moment modifyLink ( iPivotRow, numberRows_ + 1 ); } look=-1; //nextCount[look]; if (look<0) { // start again look = firstCount[1]; } assert (iPivotColumn>=0); #ifdef ABC_USE_FUNCTION_POINTERS if (!numberInColumn[iPivotColumn]) { int iNext=nextColumn[iPivotColumn]; int iLast=lastColumn[iPivotColumn]; assert (iLast>=0); #ifdef PRINT_INVERT_STATS numberTakenOutOfUSpace++; #endif lastColumn[iNext]=iLast; nextColumn[iLast]=iNext; } #endif } // put back all rejected look = firstCount[numberRows_+1]; while (look>=0) { #ifndef NDEBUG if ( look < numberRows_ ) { assert (numberInRow[look]==1); } else { int iColumn = look - numberRows_; assert ( numberInColumn[iColumn] == 1 ); } #endif int nextLook=nextCount[look]; modifyLink ( look, 1 ); look=nextLook; } #ifdef SMALL_PERMUTE if (numberGoodU_numberSlacks_+(numberRows_>>3)) { CoinSimplexInt * COIN_RESTRICT fromBigToSmallRow=reinterpret_cast(workArea_.array()); CoinSimplexInt * COIN_RESTRICT fromBigToSmallColumn=fromBigToSmallRow+numberRows_; int nSmall=0; for (int i=0;i=0&&bigRow=0&&bigColumnlastCountAddress_; CoinAbcMemcpy(temp,nextCount,numberRows_+numberRowsSmall_); for (int iCount=0;iCount<=nSmall;iCount++) { CoinSimplexInt nextBig=firstCount[iCount]; if (nextBig>=0) { //CoinSimplexInt next=firstCount[iCount]; CoinSimplexInt nextSmall; if (nextBig=0) { CoinSimplexInt thisSmall=nextSmall; nextBig=temp[nextBig]; if (nextBig>=0) { if (nextBig=0); // fill in odd one *where=iCount-numberRows_-2; } } //printf("%d rows small1 %d small2 %d\n",numberRows_,numberRowsSmall_,nSmall); numberRowsSmall_=nSmall; //exit(0); } #endif // Put .hpp functions in separate file for profiling #ifdef PRINT_INVERT_STATS int numberGoodUY=numberGoodU_; int numberElsLeftX=0; for (int i=0;i=0) { if (look2==numberRows_+1919) { printf("*** 1919 on list of count %d\n",count); abort(); } look2 = nextCount[look2]; } } #endif //printf("At count %d look %d\n",count,look); CoinSimplexInt trials = 0; //CoinSimplexInt * COIN_RESTRICT pivotColumn = pivotColumnAddress_; while ( look >= 0 ) { checkLinks(1); if ( look < numberRows_ ) { CoinSimplexInt iRow = look; look = nextCount[look]; bool rejected = false; CoinBigIndex start = startRow[iRow]; CoinBigIndex end = start + count; CoinBigIndex i; for ( i = start; i < end; i++ ) { CoinSimplexInt iColumn = indexColumn[i]; assert (numberInColumn[iColumn]>0); CoinFactorizationDouble cost = ( count - 1 ) * numberInColumn[iColumn] + 0.1; if ( cost < minimumCost ) { CoinBigIndex where = startColumn[iColumn]; double minimumValue = element[where]; minimumValue = fabs ( minimumValue ) * pivotTolerance; if (count==1) minimumValue=CoinMin(minimumValue,0.999999); while ( indexRow[where] != iRow ) { where++; } /* endwhile */ assert ( where < startColumn[iColumn] + numberInColumn[iColumn]); CoinFactorizationDouble value = element[where]; value = fabs ( value ); if ( value >= minimumValue ) { minimumCost = cost; minimumCount = numberInColumn[iColumn]; iPivotRow = iRow; pivotRowPosition = -1; iPivotColumn = iColumn; assert (iPivotRow>=0&&iPivotColumn>=0); pivotColumnPosition = i; rejected=false; } else if ( iPivotRow == -1 && count > 1) { rejected = true; } } } trials++; if ( iPivotRow >= 0 && (trials >= numberTrials||minimumCount= minimumValue ) { CoinSimplexInt iRow = indexRow[i]; CoinSimplexInt nInRow = numberInRow[iRow]; assert (nInRow>0); CoinFactorizationDouble cost = ( count - 1 ) * nInRow; if ( cost < minimumCost ) { minimumCost = cost; minimumCount = nInRow; iPivotRow = iRow; pivotRowPosition = i; iPivotColumn = iColumn; assert (iPivotRow>=0&&iPivotColumn>=0); pivotColumnPosition = -1; } } } trials++; if ( iPivotRow >= 0 && (trials >= numberTrials||minimumCount=0) { assert (iPivotRow5887) { int start=startRow[1181]; int end=start+numberInRow[1181]; for (int i=start;i 0 ) { if ( numberDoRow > 0 ) { if ( numberDoColumn > 1 ) { // if (1) { //need to adjust more for cache and SMP //allow at least 4 extra CoinSimplexInt increment = numberDoColumn + 1 + 4; if ( increment & 15 ) { increment = increment & ( ~15 ); increment += 16; } CoinSimplexInt increment2 = ( increment + COINFACTORIZATION_BITS_PER_INT - 1 ) >> COINFACTORIZATION_SHIFT_PER_INT; CoinBigIndex size = increment2 * numberDoRow; if ( size > workSize ) { workSize = size; workArea2_.conditionalNew(workSize); workArea2Address_=workArea2_.array(); workArea2 = workArea2Address_; } //branch out to best pivot routine #define ABC_PARALLEL_PIVOT #ifndef ABC_USE_FUNCTION_POINTERS #undef ABC_PARALLEL_PIVOT #endif #ifdef ABC_PARALLEL_PIVOT //if (numberRowsSmall_==7202&&numberGoodU_==15609) { //printf("NumberGoodU %d\n",numberGoodU_); //} if (numberDoRow<20) status = pivot ( iPivotRow, iPivotColumn, pivotRowPosition, pivotColumnPosition, workArea, workArea2, increment2, markRow ); else status = pivot ( iPivotRow, iPivotColumn, pivotRowPosition, pivotColumnPosition, markRow ); #else status = pivot ( iPivotRow, iPivotColumn, pivotRowPosition, pivotColumnPosition, workArea, workArea2, increment2, markRow ); #endif #if 0 for (int i=0;ilargestU) { iU=i; jU=j; largestU=fabs(element[j]); } } } printf("%d largest el %g at i=%d,j=%d start %d end %d count %d\n",numberGoodU_,element[jU], iU,jU,startColumn[iU],startColumn[iU]+numberInColumn[iU],count); } #endif #undef CHECK_SIZE checkLinks(); if ( status < 0) { count=numberRows_+1; break; } } else { if ( !pivotOneOtherRow ( iPivotRow, iPivotColumn ) ) { status = -99; count=numberRows_+1; break; } #ifdef CHECK_SIZE { double largestU=0.0; int iU=-1; int jU=-1; for (int i=0;ilargestU) { iU=i; jU=j; largestU=fabs(element[j]); } } } printf("B%d largest el %g at i=%d,j=%d\n",numberGoodU_,element[jU], iU,jU); } #endif checkLinks(); } } else { assert (!numberDoRow); checkLinks(); if ( !pivotRowSingleton ( iPivotRow, iPivotColumn ) ) { status = -99; count=numberRows_+1; break; } #ifdef CHECK_SIZE { double largestU=0.0; int iU=-1; int jU=-1; for (int i=0;ilargestU) { iU=i; jU=j; largestU=fabs(element[j]); } } } printf("C%d largest el %g at i=%d,j=%d\n",numberGoodU_,element[jU], iU,jU); } #endif checkLinks(); } } else { assert (!numberDoColumn); pivotColumnSingleton ( iPivotRow, iPivotColumn ); #ifdef CHECK_SIZE { double largestU=0.0; int iU=-1; int jU=-1; for (int i=0;ilargestU) { iU=i; jU=j; largestU=fabs(element[j]); } } } printf("D%d largest el %g at i=%d,j=%d\n",numberGoodU_,element[jU], iU,jU); } #endif checkLinks(); } double pivotValue=fabs(pivotRegion[numberGoodU_]); #if ABC_NORMAL_DEBUG>0 largestPivot=CoinMax(largestPivot,pivotValue); smallestPivot=CoinMin(smallestPivot,pivotValue); #endif if (pivotValue0 printf("PPPivot value of %g increasing pivot tolerance to %g\n", pivotValue,pivotTolerance_); #endif status=-97; break; } } afterPivot(iPivotRow,iPivotColumn); assert (numberGoodU_<=numberRows_); assert(startRow[numberRows_]==lengthAreaU_); #if 0 static int ixxxxxx=0; { int nLeft=0; for (int i=0;i=2744) { printf("Bad column %d at %d\n",iColumn,i); bad=true; } else if (cols[iColumn]>=0) { printf("Duplicate column %d at %d was at %d\n",iColumn,i,cols[iColumn]); bad=true; } else { cols[iColumn]=i; } } #else { int n=numberInRow[1160]; int start = startRow[1160]; int end=start+n; for (int i=start;inumberRows_-numberGoodU_) { printf("numberGoodU %d nrow-ngood %d\n",numberGoodU_,numberRows_-numberGoodU_); abort(); } if (ixxxxxx==2198||ixxxxxx==1347) { printf("Trouble ahead\n"); } #else if (ixxxxxx==1756) { printf("Trouble ahead\n"); } #endif } #endif #if ABC_DENSE_CODE if (!status) { status=wantToGoDense(); } #endif if (status) break; // start at 1 again count = 1; } else { //end of this - onto next count++; } } /* endwhile */ #if ABC_NORMAL_DEBUG>0 #if ABC_SMALL<2 int lenU=2*(lastEntryByColumnUPlus_/3); printf("largest initial element %g, smallestPivot %g largest %g (%d dense rows) - %d in L, %d in U\n", 1.0e-10/initialLargest,smallestPivot,largestPivot,numberRows_-numberGoodU_, lengthL_,lenU); #endif #endif workArea2_.conditionalDelete() ; workArea2Address_=NULL; #ifdef PRINT_INVERT_STATS int numberDense=numberRows_-numberGoodU_; printf("XX %d rows, %d in bump (%d slacks,%d triangular), % d dense - startels %d (%d) now %d - taken out of uspace (triang) %d\n", numberRows_,numberRows_-numberGoodUY,numberGoodUX,numberGoodUY-numberGoodUX, numberDense,numberElsLeftX,saveN1X,totalElements_,numberTakenOutOfUSpace); #endif return status; } #if ABC_DENSE_CODE //:method factorDense. Does dense phase of factorization //return code is <0 error, 0= finished CoinSimplexInt CoinAbcTypeFactorization::factorDense() { CoinSimplexInt status=0; numberDense_=numberRows_-numberGoodU_; if (sizeof(CoinBigIndex)==4&&numberDense_>=(2<<15)) { abort(); } CoinBigIndex full; full = numberDense_*numberDense_; totalElements_=full; // Add coding to align an object #if ABC_DENSE_CODE==1 leadingDimension_=((numberDense_>>4)+1)<<4; #else leadingDimension_=numberDense_; #endif CoinBigIndex newSize=(leadingDimension_+FACTOR_CPU)*numberDense_; newSize += (numberDense_+1)/(sizeof(CoinFactorizationDouble)/sizeof(CoinSimplexInt)); #if 1 newSize += 2*((numberDense_+3)/(sizeof(CoinFactorizationDouble)/sizeof(short))); newSize += ((numberRows_+3)/(sizeof(CoinFactorizationDouble)/sizeof(short))); // so we can align on 256 byte newSize+=32; //newSize += (numberDense_+1)/(sizeof(CoinFactorizationDouble)/sizeof(CoinSimplexInt)); #endif #ifdef SMALL_PERMUTE // densePermute has fromSmallToBig!!! CoinSimplexInt * COIN_RESTRICT fromSmallToBigRow=reinterpret_cast(workArea_.array()); CoinSimplexInt * COIN_RESTRICT fromSmallToBigColumn = fromSmallToBigRow+numberRowsSmall_; CoinAbcMemcpy(fromSmallToBigRow,fromSmallToBigRow_,numberRowsSmall_); CoinAbcMemcpy(fromSmallToBigColumn,fromSmallToBigColumn_,numberRowsSmall_); #endif denseArea_.conditionalDelete(); denseArea_.conditionalNew( newSize ); denseAreaAddress_=denseArea_.array(); CoinInt64 xx = reinterpret_cast(denseAreaAddress_); int iBottom = static_cast(xx & 63); int offset = (256-iBottom)>>3; denseAreaAddress_ += offset; CoinFactorizationDouble * COIN_RESTRICT denseArea = denseAreaAddress_; CoinZeroN(denseArea,newSize-32); CoinSimplexInt * COIN_RESTRICT densePermute= reinterpret_cast(denseArea+(leadingDimension_+FACTOR_CPU)*numberDense_); #if ABC_DENSE_CODE<0 CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; #endif //mark row lookup using lastRow CoinSimplexInt i; CoinSimplexInt * COIN_RESTRICT lastRow = lastRowAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; #if 0 char xxx[17000]; assert (numberRows_<=17000); memset(xxx,0,numberRows_); int nLeft=0; for (i=0;i=0) { xxx[i]=1; } else { nLeft++; } } printf("%d rows left\n",nLeft); bool bad=false; for (i=0;i=0) { lastRow[i]=0; printf("dense row %d translates to %d permute %d\n",i,iBigRow,permuteAddress_[iBigRow]); } else { if (permuteAddress_[iBigRow]<0) printf("sparse row %d translates to %d permute %d\n",i,iBigRow,permuteAddress_[iBigRow]); if (xxx[iBigRow]!=1) bad=true; xxx[iBigRow]=0; } } if (bad) abort(); #else for (i=0;i=0) { lastRow[i]=0; } } #endif CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; CoinSimplexInt which=0; for (i=0;i0) abort(); //} //for L part CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; #if ABC_DENSE_CODE<0 CoinFactorizationDouble * COIN_RESTRICT elementL = elementLAddress_; CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowLAddress_; #endif CoinBigIndex endL=startColumnL[numberGoodL_]; //take out of U CoinFactorizationDouble * COIN_RESTRICT column = denseArea; CoinSimplexInt rowsDone=0; CoinSimplexInt iColumn=0; CoinSimplexInt * COIN_RESTRICT pivotColumn = pivotColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; CoinBigIndex * startColumnU = startColumnUAddress_; #ifdef ABC_USE_FUNCTION_POINTERS scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); #if ABC_USE_FUNCTION_POINTERS extern scatterUpdate AbcScatterLowSubtract[9]; extern scatterUpdate AbcScatterHighSubtract[4]; #endif CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; #endif #if ABC_DENSE_CODE==2 int nDense=0; #endif for (iColumn=0;iColumn=0&&iRow>3; #elif BLOCKING8==4 int iBlock=iRow>>2; #elif BLOCKING8==2 int iBlock=iRow>>1; #else abort(); #endif iRow=iRow&(BLOCKING8-1); column[iRow+BLOCKING8X8*iBlock]=element[i]; #endif } /* endfor */ #if ABC_DENSE_CODE!=2 column+=leadingDimension_; #else if ((nDense&(BLOCKING8-1))!=0) column += BLOCKING8; else column += leadingDimension_*BLOCKING8-(BLOCKING8-1)*BLOCKING8; #endif while (lastRow[rowsDone]<0) { rowsDone++; } /* endwhile */ #ifdef ABC_USE_FUNCTION_POINTERS int numberIn = numberInColumnPlus[iColumn]; #ifdef SMALL_PERMUTE int realRowsDone=fromSmallToBigRow[rowsDone]; #if ABC_USE_FUNCTION_POINTERS if (numberIn<9) { scatter[realRowsDone].functionPointer=AbcScatterLowSubtract[numberIn]; } else { scatter[realRowsDone].functionPointer=AbcScatterHighSubtract[numberIn&3]; } #endif scatter[realRowsDone].offset=lastEntryByColumnUPlus_; scatter[realRowsDone].number=numberIn; #else #if ABC_USE_FUNCTION_POINTERS if (numberIn<9) { scatter[rowsDone].functionPointer=AbcScatterLowSubtract[numberIn]; } else { scatter[rowsDone].functionPointer=AbcScatterHighSubtract[numberIn&3]; } #endif scatter[rowsDone].offset=lastEntryByColumnUPlus_; scatter[rowsDone].number=numberIn; #endif CoinBigIndex startC = start-numberIn; for (int i=startC;i(elementUColumnPlus+lastEntryByColumnUPlus_),indexRow+startC,numberIn); lastEntryByColumnUPlus_ += (numberIn+1)>>1; #endif #ifdef SMALL_PERMUTE permuteAddress_[realRowsDone]=numberGoodU_; pivotColumn[numberGoodU_]=fromSmallToBigColumn[iColumn]; #else permuteAddress_[rowsDone]=numberGoodU_; pivotColumn[numberGoodU_]=iColumn; #endif rowsDone++; startColumnL[numberGoodU_+1]=endL; numberInColumn[iColumn]=0; pivotRegion[numberGoodU_]=1.0; numberGoodU_++; } } #if ABC_DENSE_CODE>0 //printf("Going dense at %d\n",numberDense_); if (denseThreshold_>0) { if(numberGoodU_!=numberRows_) return -1; // something odd numberGoodL_=numberRows_; //now factorize //dgef(denseArea,&numberDense_,&numberDense_,densePermute); #if ABC_DENSE_CODE!=2 #ifndef CLAPACK CoinSimplexInt info; F77_FUNC(dgetrf,DGETRF)(&numberDense_,&numberDense_,denseArea,&leadingDimension_,densePermute, &info); // need to check size of pivots if(info) status = -1; #else status = clapack_dgetrf(CblasColMajor, numberDense_,numberDense_, denseArea, leadingDimension_,densePermute); assert (!status); #endif #else status=CoinAbcDgetrf(numberDense_,numberDense_,denseArea,numberDense_,densePermute #if ABC_PARALLEL==2 ,parallelMode_ #endif ); if (status) { status=-1; printf("singular in dense\n"); } #endif return status; } #else numberGoodU_ = numberRows_-numberDense_; CoinSimplexInt base = numberGoodU_; CoinSimplexInt iDense; CoinSimplexInt numberToDo=numberDense_; denseThreshold_=-abs(denseThreshold_); //0; CoinSimplexInt * COIN_RESTRICT nextColumn = nextColumnAddress_; const CoinSimplexInt * COIN_RESTRICT pivotColumnConst = pivotColumnAddress_; // make sure we have enough space in L and U for (iDense=0;iDense space ) { //getColumnSpace also moves fixed part if ( !getColumnSpace ( iColumn, numberInPivotColumn ) ) { return -99; } } // set so further moves will work numberInColumn[iColumn]=numberInPivotColumn; } // Fill in ? for (iColumn=numberGoodU_+numberToDo;iColumn lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) std::cout << "more memory needed in middle of invert" << std::endl; return -99; } CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinSimplexInt * COIN_RESTRICT ipiv = densePermute-numberDense_; int returnCode=CoinAbcDgetrf(numberDense_,numberDense_,denseArea,numberDense_,ipiv); if (!returnCode) { CoinSimplexDouble * COIN_RESTRICT element = denseArea; for (int iDense=0;iDensenextCountAddress_; CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCountAddress_; CoinSimplexInt * COIN_RESTRICT lastCount = this->lastCountAddress_; CoinSimplexInt next = firstCount[count]; CoinSimplexInt firstRow=-1; CoinSimplexInt firstColumn=-1; CoinSimplexInt lastRow=-1; CoinSimplexInt lastColumn=-1; while(next>=0) { CoinSimplexInt next2=nextCount[next]; if (next>=numberRows_) { nextCount[next]=-1; // Column if (firstColumn>=0) { lastCount[next]=lastColumn; nextCount[lastColumn]=next; } else { lastCount[next]= -2 - count; firstColumn=next; } lastColumn=next; } else { // Row if (firstRow>=0) { lastCount[next]=lastRow; nextCount[lastRow]=next; } else { lastCount[next]= -2 - count; firstRow=next; } lastRow=next; } next=next2; } if (firstRow>=0) { firstCount[count]=firstRow; nextCount[lastRow]=firstColumn; if (firstColumn>=0) lastCount[firstColumn]=lastRow; } else if (firstRow<0) { firstCount[count]=firstColumn; } else if (firstColumn>=0) { firstCount[count]=firstColumn; nextCount[lastColumn]=firstRow; if (firstRow>=0) lastCount[firstRow]=lastColumn; } } #endif #endif CoinMP-1.8.3/Clp/src/AbcPrimalColumnDantzig.hpp0000644000175000017500000000371512101105055017657 0ustar renerene/* $Id: AbcPrimalColumnDantzig.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef AbcPrimalColumnDantzig_H #define AbcPrimalColumnDantzig_H #include "AbcPrimalColumnPivot.hpp" //############################################################################# /** Primal Column Pivot Dantzig Algorithm Class This is simplest choice - choose largest infeasibility */ class AbcPrimalColumnDantzig : public AbcPrimalColumnPivot { public: ///@name Algorithmic methods //@{ /** Returns pivot column, -1 if none. Lumbers over all columns - slow The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row Can just do full price if you really want to be slow */ virtual int pivotColumn(CoinPartitionedVector * updates, CoinPartitionedVector * spareRow2, CoinPartitionedVector * spareColumn1); /// Just sets model virtual void saveWeights(AbcSimplex * model, int) { model_ = model; } //@} ///@name Constructors and destructors //@{ /// Default Constructor AbcPrimalColumnDantzig(); /// Copy constructor AbcPrimalColumnDantzig(const AbcPrimalColumnDantzig &); /// Assignment operator AbcPrimalColumnDantzig & operator=(const AbcPrimalColumnDantzig& rhs); /// Destructor virtual ~AbcPrimalColumnDantzig (); /// Clone virtual AbcPrimalColumnPivot * clone(bool copyData = true) const; //@} //--------------------------------------------------------------------------- private: ///@name Private member data //@} }; #endif CoinMP-1.8.3/Clp/src/ClpCholeskyMumps.hpp0000644000175000017500000000417511534475515016615 0ustar renerene/* $Id: ClpCholeskyMumps.hpp 1692 2011-03-05 18:05:01Z stefan $ */ // Copyright (C) 2009, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpCholeskyMumps_H #define ClpCholeskyMumps_H #include "ClpCholeskyBase.hpp" class ClpMatrixBase; class ClpCholeskyDense; // unfortunately, DMUMPS_STRUC_C is an anonymous struct in MUMPS, so we define it to void for everyone outside ClpCholeskyMumps // if this file is included by ClpCholeskyMumps.cpp, then after dmumps_c.h has been included, which defines MUMPS_VERSION #ifndef MUMPS_VERSION typedef void DMUMPS_STRUC_C; #endif /** Mumps class for Clp Cholesky factorization */ class ClpCholeskyMumps : public ClpCholeskyBase { public: /**@name Virtual methods that the derived classes provides */ //@{ /** Orders rows and saves pointer to matrix.and model. Returns non-zero if not enough memory */ virtual int order(ClpInterior * model) ; /** Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ virtual int symbolic(); /** Factorize - filling in rowsDropped and returning number dropped. If return code negative then out of memory */ virtual int factorize(const double * diagonal, int * rowsDropped) ; /** Uses factorization to solve. */ virtual void solve (double * region) ; //@} /**@name Constructors, destructor */ //@{ /** Constructor which has dense columns activated. Default is off. */ ClpCholeskyMumps(int denseThreshold = -1); /** Destructor */ virtual ~ClpCholeskyMumps(); /// Clone virtual ClpCholeskyBase * clone() const ; //@} private: // Mumps structure DMUMPS_STRUC_C* mumps_; // Copy ClpCholeskyMumps(const ClpCholeskyMumps&); // Assignment ClpCholeskyMumps& operator=(const ClpCholeskyMumps&); }; #endif CoinMP-1.8.3/Clp/src/ClpPlusMinusOneMatrix.cpp0000644000175000017500000024137612452503025017565 0ustar renerene/* $Id: ClpPlusMinusOneMatrix.cpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "CoinPackedVector.hpp" #include "CoinHelperFunctions.hpp" #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" // at end to get min/max! #include "ClpPlusMinusOneMatrix.hpp" #include "ClpMessage.hpp" #ifdef CLP_PLUS_ONE_MATRIX static int oneitcount[13]={0,0,0,0,0,0,0,0,0,0,0,0,0}; static void oneit(int i) { if (!oneitcount[i]) printf("Plus ones for call %d\n",i); oneitcount[i]++; oneitcount[12]++; if ((oneitcount[12]%1000)==0) { printf("Plus counts"); for (int j=0;j<12;j++) printf(" %d",oneitcount[j]); printf("\n"); } } #endif //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpPlusMinusOneMatrix::ClpPlusMinusOneMatrix () : ClpMatrixBase() { setType(12); matrix_ = NULL; startPositive_ = NULL; startNegative_ = NULL; lengths_ = NULL; indices_ = NULL; numberRows_ = 0; numberColumns_ = 0; #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = 0; #endif columnOrdered_ = true; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpPlusMinusOneMatrix::ClpPlusMinusOneMatrix (const ClpPlusMinusOneMatrix & rhs) : ClpMatrixBase(rhs) { matrix_ = NULL; startPositive_ = NULL; startNegative_ = NULL; lengths_ = NULL; indices_ = NULL; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = rhs.otherFlags_; #endif columnOrdered_ = rhs.columnOrdered_; if (numberColumns_) { CoinBigIndex numberElements = rhs.startPositive_[numberColumns_]; indices_ = new int [ numberElements]; CoinMemcpyN(rhs.indices_, numberElements, indices_); startPositive_ = new CoinBigIndex [ numberColumns_+1]; CoinMemcpyN(rhs.startPositive_, (numberColumns_ + 1), startPositive_); startNegative_ = new CoinBigIndex [ numberColumns_]; CoinMemcpyN(rhs.startNegative_, numberColumns_, startNegative_); } int numberRows = getNumRows(); if (rhs.rhsOffset_ && numberRows) { rhsOffset_ = ClpCopyOfArray(rhs.rhsOffset_, numberRows); } else { rhsOffset_ = NULL; } } // Constructor from arrays ClpPlusMinusOneMatrix::ClpPlusMinusOneMatrix(int numberRows, int numberColumns, bool columnOrdered, const int * indices, const CoinBigIndex * startPositive, const CoinBigIndex * startNegative) : ClpMatrixBase() { setType(12); matrix_ = NULL; lengths_ = NULL; numberRows_ = numberRows; numberColumns_ = numberColumns; columnOrdered_ = columnOrdered; #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = 0; #endif int numberMajor = (columnOrdered_) ? numberColumns_ : numberRows_; int numberElements = startPositive[numberMajor]; startPositive_ = ClpCopyOfArray(startPositive, numberMajor + 1); startNegative_ = ClpCopyOfArray(startNegative, numberMajor); indices_ = ClpCopyOfArray(indices, numberElements); // Check valid checkValid(false); } ClpPlusMinusOneMatrix::ClpPlusMinusOneMatrix (const CoinPackedMatrix & rhs) : ClpMatrixBase() { setType(12); matrix_ = NULL; startPositive_ = NULL; startNegative_ = NULL; lengths_ = NULL; indices_ = NULL; int iColumn; assert (rhs.isColOrdered()); // get matrix data pointers const int * row = rhs.getIndices(); const CoinBigIndex * columnStart = rhs.getVectorStarts(); const int * columnLength = rhs.getVectorLengths(); const double * elementByColumn = rhs.getElements(); numberColumns_ = rhs.getNumCols(); numberRows_ = -1; indices_ = new int[rhs.getNumElements()]; startPositive_ = new CoinBigIndex [numberColumns_+1]; startNegative_ = new CoinBigIndex [numberColumns_]; int * temp = new int [rhs.getNumRows()]; CoinBigIndex j = 0; CoinBigIndex numberGoodP = 0; CoinBigIndex numberGoodM = 0; CoinBigIndex numberBad = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex k; int iNeg = 0; startPositive_[iColumn] = j; for (k = columnStart[iColumn]; k < columnStart[iColumn] + columnLength[iColumn]; k++) { int iRow; if (fabs(elementByColumn[k] - 1.0) < 1.0e-10) { iRow = row[k]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j++] = iRow; numberGoodP++; } else if (fabs(elementByColumn[k] + 1.0) < 1.0e-10) { iRow = row[k]; numberRows_ = CoinMax(numberRows_, iRow); temp[iNeg++] = iRow; numberGoodM++; } else { numberBad++; } } // move negative startNegative_[iColumn] = j; for (k = 0; k < iNeg; k++) { indices_[j++] = temp[k]; } } startPositive_[numberColumns_] = j; delete [] temp; if (numberBad) { delete [] indices_; indices_ = NULL; numberRows_ = 0; numberColumns_ = 0; delete [] startPositive_; delete [] startNegative_; // Put in statistics startPositive_ = new CoinBigIndex [3]; startPositive_[0] = numberGoodP; startPositive_[1] = numberGoodM; startPositive_[2] = numberBad; startNegative_ = NULL; } else { numberRows_ ++; // correct // but number should be same as rhs assert (numberRows_ <= rhs.getNumRows()); numberRows_ = rhs.getNumRows(); columnOrdered_ = true; } // Check valid if (!numberBad) checkValid(false); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpPlusMinusOneMatrix::~ClpPlusMinusOneMatrix () { delete matrix_; delete [] startPositive_; delete [] startNegative_; delete [] lengths_; delete [] indices_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpPlusMinusOneMatrix & ClpPlusMinusOneMatrix::operator=(const ClpPlusMinusOneMatrix& rhs) { if (this != &rhs) { ClpMatrixBase::operator=(rhs); delete matrix_; delete [] startPositive_; delete [] startNegative_; delete [] lengths_; delete [] indices_; matrix_ = NULL; startPositive_ = NULL; lengths_ = NULL; indices_ = NULL; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; columnOrdered_ = rhs.columnOrdered_; #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = rhs.otherFlags_; #endif if (numberColumns_) { CoinBigIndex numberElements = rhs.startPositive_[numberColumns_]; indices_ = new int [ numberElements]; CoinMemcpyN(rhs.indices_, numberElements, indices_); startPositive_ = new CoinBigIndex [ numberColumns_+1]; CoinMemcpyN(rhs.startPositive_, (numberColumns_ + 1), startPositive_); startNegative_ = new CoinBigIndex [ numberColumns_]; CoinMemcpyN(rhs.startNegative_, numberColumns_, startNegative_); } } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpMatrixBase * ClpPlusMinusOneMatrix::clone() const { return new ClpPlusMinusOneMatrix(*this); } /* Subset clone (without gaps). Duplicates are allowed and order is as given */ ClpMatrixBase * ClpPlusMinusOneMatrix::subsetClone (int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const { return new ClpPlusMinusOneMatrix(*this, numberRows, whichRows, numberColumns, whichColumns); } /* Subset constructor (without gaps). Duplicates are allowed and order is as given */ ClpPlusMinusOneMatrix::ClpPlusMinusOneMatrix ( const ClpPlusMinusOneMatrix & rhs, int numberRows, const int * whichRow, int numberColumns, const int * whichColumn) : ClpMatrixBase(rhs) { matrix_ = NULL; startPositive_ = NULL; startNegative_ = NULL; lengths_ = NULL; indices_ = NULL; numberRows_ = 0; numberColumns_ = 0; columnOrdered_ = rhs.columnOrdered_; #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = rhs.otherFlags_; #endif if (numberRows <= 0 || numberColumns <= 0) { startPositive_ = new CoinBigIndex [1]; startPositive_[0] = 0; } else { numberColumns_ = numberColumns; numberRows_ = numberRows; const int * index1 = rhs.indices_; CoinBigIndex * startPositive1 = rhs.startPositive_; int numberMinor = (!columnOrdered_) ? numberColumns_ : numberRows_; int numberMajor = (columnOrdered_) ? numberColumns_ : numberRows_; int numberMinor1 = (!columnOrdered_) ? rhs.numberColumns_ : rhs.numberRows_; int numberMajor1 = (columnOrdered_) ? rhs.numberColumns_ : rhs.numberRows_; // Also swap incoming if not column ordered if (!columnOrdered_) { int temp1 = numberRows; numberRows = numberColumns; numberColumns = temp1; const int * temp2; temp2 = whichRow; whichRow = whichColumn; whichColumn = temp2; } // Throw exception if rhs empty if (numberMajor1 <= 0 || numberMinor1 <= 0) throw CoinError("empty rhs", "subset constructor", "ClpPlusMinusOneMatrix"); // Array to say if an old row is in new copy int * newRow = new int [numberMinor1]; int iRow; for (iRow = 0; iRow < numberMinor1; iRow++) newRow[iRow] = -1; // and array for duplicating rows int * duplicateRow = new int [numberMinor]; int numberBad = 0; for (iRow = 0; iRow < numberMinor; iRow++) { duplicateRow[iRow] = -1; int kRow = whichRow[iRow]; if (kRow >= 0 && kRow < numberMinor1) { if (newRow[kRow] < 0) { // first time newRow[kRow] = iRow; } else { // duplicate int lastRow = newRow[kRow]; newRow[kRow] = iRow; duplicateRow[iRow] = lastRow; } } else { // bad row numberBad++; } } if (numberBad) throw CoinError("bad minor entries", "subset constructor", "ClpPlusMinusOneMatrix"); // now get size and check columns CoinBigIndex size = 0; int iColumn; numberBad = 0; for (iColumn = 0; iColumn < numberMajor; iColumn++) { int kColumn = whichColumn[iColumn]; if (kColumn >= 0 && kColumn < numberMajor1) { CoinBigIndex i; for (i = startPositive1[kColumn]; i < startPositive1[kColumn+1]; i++) { int kRow = index1[i]; kRow = newRow[kRow]; while (kRow >= 0) { size++; kRow = duplicateRow[kRow]; } } } else { // bad column numberBad++; printf("%d %d %d %d\n", iColumn, numberMajor, numberMajor1, kColumn); } } if (numberBad) throw CoinError("bad major entries", "subset constructor", "ClpPlusMinusOneMatrix"); // now create arrays startPositive_ = new CoinBigIndex [numberMajor+1]; startNegative_ = new CoinBigIndex [numberMajor]; indices_ = new int[size]; // and fill them size = 0; startPositive_[0] = 0; CoinBigIndex * startNegative1 = rhs.startNegative_; for (iColumn = 0; iColumn < numberMajor; iColumn++) { int kColumn = whichColumn[iColumn]; CoinBigIndex i; for (i = startPositive1[kColumn]; i < startNegative1[kColumn]; i++) { int kRow = index1[i]; kRow = newRow[kRow]; while (kRow >= 0) { indices_[size++] = kRow; kRow = duplicateRow[kRow]; } } startNegative_[iColumn] = size; for (; i < startPositive1[kColumn+1]; i++) { int kRow = index1[i]; kRow = newRow[kRow]; while (kRow >= 0) { indices_[size++] = kRow; kRow = duplicateRow[kRow]; } } startPositive_[iColumn+1] = size; } delete [] newRow; delete [] duplicateRow; } // Check valid checkValid(false); } /* Returns a new matrix in reverse order without gaps */ ClpMatrixBase * ClpPlusMinusOneMatrix::reverseOrderedCopy() const { int numberMinor = (!columnOrdered_) ? numberColumns_ : numberRows_; int numberMajor = (columnOrdered_) ? numberColumns_ : numberRows_; // count number in each row/column CoinBigIndex * tempP = new CoinBigIndex [numberMinor]; CoinBigIndex * tempN = new CoinBigIndex [numberMinor]; memset(tempP, 0, numberMinor * sizeof(CoinBigIndex)); memset(tempN, 0, numberMinor * sizeof(CoinBigIndex)); CoinBigIndex j = 0; int i; for (i = 0; i < numberMajor; i++) { for (; j < startNegative_[i]; j++) { int iRow = indices_[j]; tempP[iRow]++; } for (; j < startPositive_[i+1]; j++) { int iRow = indices_[j]; tempN[iRow]++; } } int * newIndices = new int [startPositive_[numberMajor]]; CoinBigIndex * newP = new CoinBigIndex [numberMinor+1]; CoinBigIndex * newN = new CoinBigIndex[numberMinor]; int iRow; j = 0; // do starts for (iRow = 0; iRow < numberMinor; iRow++) { newP[iRow] = j; j += tempP[iRow]; tempP[iRow] = newP[iRow]; newN[iRow] = j; j += tempN[iRow]; tempN[iRow] = newN[iRow]; } newP[numberMinor] = j; j = 0; for (i = 0; i < numberMajor; i++) { for (; j < startNegative_[i]; j++) { int iRow = indices_[j]; CoinBigIndex put = tempP[iRow]; newIndices[put++] = i; tempP[iRow] = put; } for (; j < startPositive_[i+1]; j++) { int iRow = indices_[j]; CoinBigIndex put = tempN[iRow]; newIndices[put++] = i; tempN[iRow] = put; } } delete [] tempP; delete [] tempN; ClpPlusMinusOneMatrix * newCopy = new ClpPlusMinusOneMatrix(); newCopy->passInCopy(numberMinor, numberMajor, !columnOrdered_, newIndices, newP, newN); return newCopy; } static bool doPlusOnes=true; //unscaled versions void ClpPlusMinusOneMatrix::times(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y) const { int numberMajor = (columnOrdered_) ? numberColumns_ : numberRows_; int i; CoinBigIndex j; assert (columnOrdered_); #ifdef CLP_PLUS_ONE_MATRIX if ((otherFlags_&1)==0||!doPlusOnes) { #endif for (i = 0; i < numberMajor; i++) { double value = scalar * x[i]; if (value) { for (j = startPositive_[i]; j < startNegative_[i]; j++) { int iRow = indices_[j]; y[iRow] += value; } for (; j < startPositive_[i+1]; j++) { int iRow = indices_[j]; y[iRow] -= value; } } } #ifdef CLP_PLUS_ONE_MATRIX } else { // plus one oneit(0); for (i = 0; i < numberMajor; i++) { double value = scalar * x[i]; if (value) { for (j = startPositive_[i]; j < startPositive_[i+1]; j++) { int iRow = indices_[j]; y[iRow] += value; } } } } #endif } void ClpPlusMinusOneMatrix::transposeTimes(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y) const { int numberMajor = (columnOrdered_) ? numberColumns_ : numberRows_; int i; CoinBigIndex j = 0; assert (columnOrdered_); #ifdef CLP_PLUS_ONE_MATRIX if ((otherFlags_&1)==0||!doPlusOnes) { #endif for (i = 0; i < numberMajor; i++) { double value = 0.0; for (; j < startNegative_[i]; j++) { int iRow = indices_[j]; value += x[iRow]; } for (; j < startPositive_[i+1]; j++) { int iRow = indices_[j]; value -= x[iRow]; } y[i] += scalar * value; } #ifdef CLP_PLUS_ONE_MATRIX } else { // plus one oneit(1); for (i = 0; i < numberMajor; i++) { double value = 0.0; for (; j < startPositive_[i+1]; j++) { int iRow = indices_[j]; value += x[iRow]; } y[i] += scalar * value; } } #endif } void ClpPlusMinusOneMatrix::times(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y, const double * /*rowScale*/, const double * /*columnScale*/) const { // we know it is not scaled times(scalar, x, y); } void ClpPlusMinusOneMatrix::transposeTimes( double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y, const double * /*rowScale*/, const double * /*columnScale*/, double * /*spare*/) const { // we know it is not scaled transposeTimes(scalar, x, y); } /* Return x * A + y in z. Squashes small elements and knows about ClpSimplex */ void ClpPlusMinusOneMatrix::transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * rowArray, CoinIndexedVector * y, CoinIndexedVector * columnArray) const { // we know it is not scaled columnArray->clear(); double * COIN_RESTRICT pi = rowArray->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = columnArray->getIndices(); double * COIN_RESTRICT array = columnArray->denseVector(); int numberInRowArray = rowArray->getNumElements(); // maybe I need one in OsiSimplex double zeroTolerance = model->zeroTolerance(); int numberRows = model->numberRows(); bool packed = rowArray->packedMode(); #ifndef NO_RTTI ClpPlusMinusOneMatrix* rowCopy = dynamic_cast< ClpPlusMinusOneMatrix*>(model->rowCopy()); #else ClpPlusMinusOneMatrix* rowCopy = static_cast< ClpPlusMinusOneMatrix*>(model->rowCopy()); #endif double factor = 0.3; // We may not want to do by row if there may be cache problems int numberColumns = model->numberColumns(); // It would be nice to find L2 cache size - for moment 512K // Be slightly optimistic if (numberColumns * sizeof(double) > 1000000) { if (numberRows * 10 < numberColumns) factor = 0.1; else if (numberRows * 4 < numberColumns) factor = 0.15; else if (numberRows * 2 < numberColumns) factor = 0.2; } if (numberInRowArray > factor * numberRows || !rowCopy) { assert (!y->getNumElements()); // do by column // Need to expand if packed mode int iColumn; CoinBigIndex j = 0; assert (columnOrdered_); if (packed) { // need to expand pi into y assert(y->capacity() >= numberRows); double * COIN_RESTRICT piOld = pi; pi = y->denseVector(); const int * COIN_RESTRICT whichRow = rowArray->getIndices(); int i; // modify pi so can collapse to one loop for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = scalar * piOld[i]; } #ifdef CLP_PLUS_ONE_MATRIX if ((otherFlags_&1)==0||!doPlusOnes) { #endif for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double value = 0.0; for (; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; value += pi[iRow]; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; value -= pi[iRow]; } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } #ifdef CLP_PLUS_ONE_MATRIX } else { // plus one oneit(2); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double value = 0.0; for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; value += pi[iRow]; } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } #endif for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = 0.0; } } else { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double value = 0.0; for (; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; value += pi[iRow]; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; value -= pi[iRow]; } value *= scalar; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } columnArray->setNumElements(numberNonZero); } else { // do by row rowCopy->transposeTimesByRow(model, scalar, rowArray, y, columnArray); } } /* Return x * A + y in z. Squashes small elements and knows about ClpSimplex */ void ClpPlusMinusOneMatrix::transposeTimesByRow(const ClpSimplex * model, double scalar, const CoinIndexedVector * rowArray, CoinIndexedVector * y, CoinIndexedVector * columnArray) const { columnArray->clear(); double * COIN_RESTRICT pi = rowArray->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = columnArray->getIndices(); double * COIN_RESTRICT array = columnArray->denseVector(); int numberInRowArray = rowArray->getNumElements(); // maybe I need one in OsiSimplex double zeroTolerance = model->zeroTolerance(); const int * COIN_RESTRICT column = indices_; const CoinBigIndex * COIN_RESTRICT startPositive = startPositive_; const CoinBigIndex * COIN_RESTRICT startNegative = startNegative_; const int * COIN_RESTRICT whichRow = rowArray->getIndices(); bool packed = rowArray->packedMode(); if (numberInRowArray > 2) { // do by rows int iRow; double * COIN_RESTRICT markVector = y->denseVector(); // probably empty .. but int numberOriginal = 0; int i; if (packed) { int numberCovered=0; int numberColumns = getNumCols(); bool sparse=true; int target=1*numberColumns; for (int i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; numberCovered += startPositive[iRow+1] - startPositive[iRow]; if (numberCovered>target) { sparse=false; break; } } numberNonZero = 0; if (sparse) { // and set up mark as char array char * COIN_RESTRICT marked = reinterpret_cast (index + columnArray->capacity()); double * COIN_RESTRICT array2 = y->denseVector(); #ifdef CLP_DEBUG int numberColumns = model->numberColumns(); for (int i = 0; i < numberColumns; i++) { assert(!marked[i]); assert(!array2[i]); } #endif #ifdef CLP_PLUS_ONE_MATRIX if ((otherFlags_&1)==0||!doPlusOnes) { #endif for (int i = 0; i < numberInRowArray; i++) { iRow = whichRow[i]; double value = pi[i] * scalar; CoinBigIndex j; for (j = startPositive[iRow]; j < startNegative[iRow]; j++) { int iColumn = column[j]; if (!marked[iColumn]) { marked[iColumn] = 1; index[numberNonZero++] = iColumn; } array2[iColumn] += value; } for (j = startNegative[iRow]; j < startPositive[iRow+1]; j++) { int iColumn = column[j]; if (!marked[iColumn]) { marked[iColumn] = 1; index[numberNonZero++] = iColumn; } array2[iColumn] -= value; } } #ifdef CLP_PLUS_ONE_MATRIX } else { // plus one oneit(4); for (int i = 0; i < numberInRowArray; i++) { iRow = whichRow[i]; double value = pi[i] * scalar; CoinBigIndex j; for (j = startPositive[iRow]; j < startPositive[iRow+1]; j++) { int iColumn = column[j]; if (!marked[iColumn]) { marked[iColumn] = 1; index[numberNonZero++] = iColumn; } array2[iColumn] += value; } } } #endif // get rid of tiny values and zero out marked numberOriginal = numberNonZero; numberNonZero = 0; for (int i = 0; i < numberOriginal; i++) { int iColumn = index[i]; if (marked[iColumn]) { double value = array2[iColumn]; array2[iColumn] = 0.0; marked[iColumn] = 0; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } } else { // not sparse #ifdef CLP_PLUS_ONE_MATRIX if ((otherFlags_&1)==0||!doPlusOnes) { #endif for (int i = 0; i < numberInRowArray; i++) { iRow = whichRow[i]; double value = pi[i] * scalar; CoinBigIndex j; for (j = startPositive[iRow]; j < startNegative[iRow]; j++) { int iColumn = column[j]; array[iColumn] += value; } for (j = startNegative[iRow]; j < startPositive[iRow+1]; j++) { int iColumn = column[j]; array[iColumn] -= value; } } #ifdef CLP_PLUS_ONE_MATRIX } else { // plus one oneit(5); for (int i = 0; i < numberInRowArray; i++) { iRow = whichRow[i]; double value = pi[i] * scalar; CoinBigIndex j; for (j = startPositive[iRow]; j < startPositive[iRow+1]; j++) { int iColumn = column[j]; array[iColumn] += value; } } } #endif // get rid of tiny values and count for (int i = 0; i < numberColumns; i++) { double value = array[i]; if (value) { array[i] = 0.0; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = i; } } } } } else { numberNonZero = 0; // and set up mark as char array char * COIN_RESTRICT marked = reinterpret_cast (markVector); for (i = 0; i < numberOriginal; i++) { int iColumn = index[i]; marked[iColumn] = 0; } for (i = 0; i < numberInRowArray; i++) { iRow = whichRow[i]; double value = pi[iRow] * scalar; CoinBigIndex j; for (j = startPositive[iRow]; j < startNegative[iRow]; j++) { int iColumn = column[j]; if (!marked[iColumn]) { marked[iColumn] = 1; index[numberNonZero++] = iColumn; } array[iColumn] += value; } for (j = startNegative[iRow]; j < startPositive[iRow+1]; j++) { int iColumn = column[j]; if (!marked[iColumn]) { marked[iColumn] = 1; index[numberNonZero++] = iColumn; } array[iColumn] -= value; } } // get rid of tiny values and zero out marked numberOriginal = numberNonZero; numberNonZero = 0; for (i = 0; i < numberOriginal; i++) { int iColumn = index[i]; marked[iColumn] = 0; if (fabs(array[iColumn]) > zeroTolerance) { index[numberNonZero++] = iColumn; } else { array[iColumn] = 0.0; } } } } else if (numberInRowArray == 2) { /* do by rows when two rows (do longer first when not packed and shorter first if packed */ int iRow0 = whichRow[0]; int iRow1 = whichRow[1]; CoinBigIndex j; if (packed) { double pi0 = pi[0]; double pi1 = pi[1]; if (startPositive[iRow0+1] - startPositive[iRow0] > startPositive[iRow1+1] - startPositive[iRow1]) { int temp = iRow0; iRow0 = iRow1; iRow1 = temp; pi0 = pi1; pi1 = pi[0]; } // and set up mark as char array char * COIN_RESTRICT marked = reinterpret_cast (index + columnArray->capacity()); int * COIN_RESTRICT lookup = y->getIndices(); double value = pi0 * scalar; int numberOriginal; #ifdef CLP_PLUS_ONE_MATRIX if ((otherFlags_&1)==0||!doPlusOnes) { #endif for (j = startPositive[iRow0]; j < startNegative[iRow0]; j++) { int iColumn = column[j]; array[numberNonZero] = value; marked[iColumn] = 1; lookup[iColumn] = numberNonZero; index[numberNonZero++] = iColumn; } for (j = startNegative[iRow0]; j < startPositive[iRow0+1]; j++) { int iColumn = column[j]; array[numberNonZero] = -value; marked[iColumn] = 1; lookup[iColumn] = numberNonZero; index[numberNonZero++] = iColumn; } numberOriginal = numberNonZero; value = pi1 * scalar; for (j = startPositive[iRow1]; j < startNegative[iRow1]; j++) { int iColumn = column[j]; if (marked[iColumn]) { int iLookup = lookup[iColumn]; array[iLookup] += value; } else { if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } for (j = startNegative[iRow1]; j < startPositive[iRow1+1]; j++) { int iColumn = column[j]; if (marked[iColumn]) { int iLookup = lookup[iColumn]; array[iLookup] -= value; } else { if (fabs(value) > zeroTolerance) { array[numberNonZero] = -value; index[numberNonZero++] = iColumn; } } } #ifdef CLP_PLUS_ONE_MATRIX } else { // plus one oneit(7); for (j = startPositive[iRow0]; j < startPositive[iRow0+1]; j++) { int iColumn = column[j]; array[numberNonZero] = value; marked[iColumn] = 1; lookup[iColumn] = numberNonZero; index[numberNonZero++] = iColumn; } numberOriginal = numberNonZero; value = pi1 * scalar; for (j = startPositive[iRow1]; j < startPositive[iRow1+1]; j++) { int iColumn = column[j]; if (marked[iColumn]) { int iLookup = lookup[iColumn]; array[iLookup] += value; } else { if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } } #endif // get rid of tiny values and zero out marked int nDelete = 0; for (j = 0; j < numberOriginal; j++) { int iColumn = index[j]; marked[iColumn] = 0; if (fabs(array[j]) <= zeroTolerance) nDelete++; } if (nDelete) { numberOriginal = numberNonZero; numberNonZero = 0; for (j = 0; j < numberOriginal; j++) { int iColumn = index[j]; double value = array[j]; array[j] = 0.0; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } } else { if (startPositive[iRow0+1] - startPositive[iRow0] < startPositive[iRow1+1] - startPositive[iRow1]) { int temp = iRow0; iRow0 = iRow1; iRow1 = temp; } int numberOriginal; int i; numberNonZero = 0; double value; value = pi[iRow0] * scalar; CoinBigIndex j; for (j = startPositive[iRow0]; j < startNegative[iRow0]; j++) { int iColumn = column[j]; index[numberNonZero++] = iColumn; array[iColumn] = value; } for (j = startNegative[iRow0]; j < startPositive[iRow0+1]; j++) { int iColumn = column[j]; index[numberNonZero++] = iColumn; array[iColumn] = -value; } value = pi[iRow1] * scalar; for (j = startPositive[iRow1]; j < startNegative[iRow1]; j++) { int iColumn = column[j]; double value2 = array[iColumn]; if (value2) { value2 += value; } else { value2 = value; index[numberNonZero++] = iColumn; } array[iColumn] = value2; } for (j = startNegative[iRow1]; j < startPositive[iRow1+1]; j++) { int iColumn = column[j]; double value2 = array[iColumn]; if (value2) { value2 -= value; } else { value2 = -value; index[numberNonZero++] = iColumn; } array[iColumn] = value2; } // get rid of tiny values and zero out marked numberOriginal = numberNonZero; numberNonZero = 0; for (i = 0; i < numberOriginal; i++) { int iColumn = index[i]; if (fabs(array[iColumn]) > zeroTolerance) { index[numberNonZero++] = iColumn; } else { array[iColumn] = 0.0; } } } } else if (numberInRowArray == 1) { // Just one row int iRow = rowArray->getIndices()[0]; numberNonZero = 0; double value; iRow = whichRow[0]; CoinBigIndex j; if (packed) { value = pi[0] * scalar; if (fabs(value) > zeroTolerance) { #ifdef CLP_PLUS_ONE_MATRIX if ((otherFlags_&1)==0||!doPlusOnes) { #endif for (j = startPositive[iRow]; j < startNegative[iRow]; j++) { int iColumn = column[j]; array[numberNonZero] = value; index[numberNonZero++] = iColumn; } for (j = startNegative[iRow]; j < startPositive[iRow+1]; j++) { int iColumn = column[j]; array[numberNonZero] = -value; index[numberNonZero++] = iColumn; } #ifdef CLP_PLUS_ONE_MATRIX } else { // plus one oneit(9); for (j = startPositive[iRow]; j < startPositive[iRow+1]; j++) { int iColumn = column[j]; array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } #endif } } else { value = pi[iRow] * scalar; if (fabs(value) > zeroTolerance) { for (j = startPositive[iRow]; j < startNegative[iRow]; j++) { int iColumn = column[j]; array[iColumn] = value; index[numberNonZero++] = iColumn; } for (j = startNegative[iRow]; j < startPositive[iRow+1]; j++) { int iColumn = column[j]; array[iColumn] = -value; index[numberNonZero++] = iColumn; } } } } columnArray->setNumElements(numberNonZero); if (packed) columnArray->setPacked(); y->setNumElements(0); } /* Return x *A in z but just for indices in y. */ void ClpPlusMinusOneMatrix::subsetTransposeTimes(const ClpSimplex * , const CoinIndexedVector * rowArray, const CoinIndexedVector * y, CoinIndexedVector * columnArray) const { columnArray->clear(); double * COIN_RESTRICT pi = rowArray->denseVector(); double * COIN_RESTRICT array = columnArray->denseVector(); int jColumn; int numberToDo = y->getNumElements(); const int * COIN_RESTRICT which = y->getIndices(); assert (!rowArray->packedMode()); columnArray->setPacked(); #ifdef CLP_PLUS_ONE_MATRIX if ((otherFlags_&1)==0||!doPlusOnes) { #endif for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; double value = 0.0; CoinBigIndex j = startPositive_[iColumn]; for (; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; value += pi[iRow]; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; value -= pi[iRow]; } array[jColumn] = value; } #ifdef CLP_PLUS_ONE_MATRIX } else { // plus one oneit(11); for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; double value = 0.0; CoinBigIndex j = startPositive_[iColumn]; for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; value += pi[iRow]; } array[jColumn] = value; } } #endif } /// returns number of elements in column part of basis, CoinBigIndex ClpPlusMinusOneMatrix::countBasis(const int * whichColumn, int & numberColumnBasic) { int i; CoinBigIndex numberElements = 0; for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; numberElements += startPositive_[iColumn+1] - startPositive_[iColumn]; } return numberElements; } void ClpPlusMinusOneMatrix::fillBasis(ClpSimplex * , const int * whichColumn, int & numberColumnBasic, int * indexRowU, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * elementU) { int i; CoinBigIndex numberElements = start[0]; assert (columnOrdered_); for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; CoinBigIndex j = startPositive_[iColumn]; for (; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = 1.0; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = -1.0; } start[i+1] = numberElements; columnCount[i] = numberElements - start[i]; } } /* Unpacks a column into an CoinIndexedvector */ void ClpPlusMinusOneMatrix::unpack(const ClpSimplex * , CoinIndexedVector * rowArray, int iColumn) const { CoinBigIndex j = startPositive_[iColumn]; for (; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; rowArray->add(iRow, 1.0); } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; rowArray->add(iRow, -1.0); } } /* Unpacks a column into an CoinIndexedvector ** in packed foramt Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ void ClpPlusMinusOneMatrix::unpackPacked(ClpSimplex * , CoinIndexedVector * rowArray, int iColumn) const { int * COIN_RESTRICT index = rowArray->getIndices(); double * COIN_RESTRICT array = rowArray->denseVector(); int number = 0; CoinBigIndex j = startPositive_[iColumn]; for (; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; array[number] = 1.0; index[number++] = iRow; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; array[number] = -1.0; index[number++] = iRow; } rowArray->setNumElements(number); rowArray->setPackedMode(true); } /* Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ void ClpPlusMinusOneMatrix::add(const ClpSimplex * , CoinIndexedVector * rowArray, int iColumn, double multiplier) const { CoinBigIndex j = startPositive_[iColumn]; for (; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; rowArray->quickAdd(iRow, multiplier); } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; rowArray->quickAdd(iRow, -multiplier); } } /* Adds multiple of a column into an array */ void ClpPlusMinusOneMatrix::add(const ClpSimplex * , double * array, int iColumn, double multiplier) const { CoinBigIndex j = startPositive_[iColumn]; for (; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; array[iRow] += multiplier; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; array[iRow] -= multiplier; } } // Return a complete CoinPackedMatrix CoinPackedMatrix * ClpPlusMinusOneMatrix::getPackedMatrix() const { if (!matrix_) { int numberMinor = (!columnOrdered_) ? numberColumns_ : numberRows_; int numberMajor = (columnOrdered_) ? numberColumns_ : numberRows_; int numberElements = startPositive_[numberMajor]; double * elements = new double [numberElements]; CoinBigIndex j = 0; int i; for (i = 0; i < numberMajor; i++) { for (; j < startNegative_[i]; j++) { elements[j] = 1.0; } for (; j < startPositive_[i+1]; j++) { elements[j] = -1.0; } } matrix_ = new CoinPackedMatrix(columnOrdered_, numberMinor, numberMajor, getNumElements(), elements, indices_, startPositive_, getVectorLengths()); delete [] elements; delete [] lengths_; lengths_ = NULL; } return matrix_; } /* A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ const double * ClpPlusMinusOneMatrix::getElements() const { if (!matrix_) getPackedMatrix(); return matrix_->getElements(); } const CoinBigIndex * ClpPlusMinusOneMatrix::getVectorStarts() const { return startPositive_; } /* The lengths of the major-dimension vectors. */ const int * ClpPlusMinusOneMatrix::getVectorLengths() const { if (!lengths_) { int numberMajor = (columnOrdered_) ? numberColumns_ : numberRows_; lengths_ = new int [numberMajor]; int i; for (i = 0; i < numberMajor; i++) { lengths_[i] = startPositive_[i+1] - startPositive_[i]; } } return lengths_; } /* Delete the columns whose indices are listed in indDel. */ void ClpPlusMinusOneMatrix::deleteCols(const int numDel, const int * indDel) { int iColumn; CoinBigIndex newSize = startPositive_[numberColumns_];; int numberBad = 0; // Use array to make sure we can have duplicates int * which = new int[numberColumns_]; memset(which, 0, numberColumns_ * sizeof(int)); int nDuplicate = 0; for (iColumn = 0; iColumn < numDel; iColumn++) { int jColumn = indDel[iColumn]; if (jColumn < 0 || jColumn >= numberColumns_) { numberBad++; } else { newSize -= startPositive_[jColumn+1] - startPositive_[jColumn]; if (which[jColumn]) nDuplicate++; else which[jColumn] = 1; } } if (numberBad) throw CoinError("Indices out of range", "deleteCols", "ClpPlusMinusOneMatrix"); int newNumber = numberColumns_ - numDel + nDuplicate; // Get rid of temporary arrays delete [] lengths_; lengths_ = NULL; delete matrix_; matrix_ = NULL; CoinBigIndex * newPositive = new CoinBigIndex [newNumber+1]; CoinBigIndex * newNegative = new CoinBigIndex [newNumber]; int * newIndices = new int [newSize]; newNumber = 0; newSize = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (!which[iColumn]) { CoinBigIndex start, end; CoinBigIndex i; start = startPositive_[iColumn]; end = startNegative_[iColumn]; newPositive[newNumber] = newSize; for (i = start; i < end; i++) newIndices[newSize++] = indices_[i]; start = startNegative_[iColumn]; end = startPositive_[iColumn+1]; newNegative[newNumber++] = newSize; for (i = start; i < end; i++) newIndices[newSize++] = indices_[i]; } } newPositive[newNumber] = newSize; delete [] which; delete [] startPositive_; startPositive_ = newPositive; delete [] startNegative_; startNegative_ = newNegative; delete [] indices_; indices_ = newIndices; numberColumns_ = newNumber; } /* Delete the rows whose indices are listed in indDel. */ void ClpPlusMinusOneMatrix::deleteRows(const int numDel, const int * indDel) { int iRow; int numberBad = 0; // Use array to make sure we can have duplicates int * which = new int[numberRows_]; memset(which, 0, numberRows_ * sizeof(int)); int nDuplicate = 0; for (iRow = 0; iRow < numDel; iRow++) { int jRow = indDel[iRow]; if (jRow < 0 || jRow >= numberRows_) { numberBad++; } else { if (which[jRow]) nDuplicate++; else which[jRow] = 1; } } if (numberBad) throw CoinError("Indices out of range", "deleteRows", "ClpPlusMinusOneMatrix"); CoinBigIndex iElement; CoinBigIndex numberElements = startPositive_[numberColumns_]; CoinBigIndex newSize = 0; for (iElement = 0; iElement < numberElements; iElement++) { iRow = indices_[iElement]; if (!which[iRow]) newSize++; } int newNumber = numberRows_ - numDel + nDuplicate; // Get rid of temporary arrays delete [] lengths_; lengths_ = NULL; delete matrix_; matrix_ = NULL; int * newIndices = new int [newSize]; newSize = 0; int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex start, end; CoinBigIndex i; start = startPositive_[iColumn]; end = startNegative_[iColumn]; startPositive_[newNumber] = newSize; for (i = start; i < end; i++) { iRow = indices_[i]; if (!which[iRow]) newIndices[newSize++] = iRow; } start = startNegative_[iColumn]; end = startPositive_[iColumn+1]; startNegative_[newNumber] = newSize; for (i = start; i < end; i++) { iRow = indices_[i]; if (!which[iRow]) newIndices[newSize++] = iRow; } } startPositive_[numberColumns_] = newSize; delete [] which; delete [] indices_; indices_ = newIndices; numberRows_ = newNumber; } bool ClpPlusMinusOneMatrix::isColOrdered() const { return columnOrdered_; } /* Number of entries in the packed matrix. */ CoinBigIndex ClpPlusMinusOneMatrix::getNumElements() const { int numberMajor = (columnOrdered_) ? numberColumns_ : numberRows_; if (startPositive_) return startPositive_[numberMajor]; else return 0; } // pass in copy (object takes ownership) void ClpPlusMinusOneMatrix::passInCopy(int numberRows, int numberColumns, bool columnOrdered, int * indices, CoinBigIndex * startPositive, CoinBigIndex * startNegative) { columnOrdered_ = columnOrdered; #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = 0; #endif startPositive_ = startPositive; startNegative_ = startNegative; indices_ = indices; numberRows_ = numberRows; numberColumns_ = numberColumns; // Check valid checkValid(false); } // Just checks matrix valid - will say if dimensions not quite right if detail void ClpPlusMinusOneMatrix::checkValid(bool detail) const { int maxIndex = -1; int minIndex = columnOrdered_ ? numberRows_ : numberColumns_; int number = !columnOrdered_ ? numberRows_ : numberColumns_; int numberElements = getNumElements(); CoinBigIndex last = -1; int bad = 0; // say if all +1 #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = 1; #endif for (int i = 0; i < number; i++) { if(startPositive_[i] < last) bad++; else last = startPositive_[i]; #ifdef CLP_PLUS_ONE_MATRIX if (startNegative_[i] < startPositive_[i+1]) otherFlags_ &= ~1; // not all +1 #endif if(startNegative_[i] < last) bad++; else last = startNegative_[i]; } if(startPositive_[number] < last) bad++; CoinAssertHint(!bad, "starts are not monotonic"); for (CoinBigIndex cbi = 0; cbi < numberElements; cbi++) { maxIndex = CoinMax(indices_[cbi], maxIndex); minIndex = CoinMin(indices_[cbi], minIndex); } CoinAssert(maxIndex < (columnOrdered_ ? numberRows_ : numberColumns_)); CoinAssert(minIndex >= 0); if (detail) { if (minIndex > 0 || maxIndex + 1 < (columnOrdered_ ? numberRows_ : numberColumns_)) printf("Not full range of indices - %d to %d\n", minIndex, maxIndex); } } /* Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector */ CoinBigIndex * ClpPlusMinusOneMatrix::dubiousWeights(const ClpSimplex * model, int * inputWeights) const { int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); int number = numberRows + numberColumns; CoinBigIndex * weights = new CoinBigIndex[number]; int i; for (i = 0; i < numberColumns; i++) { CoinBigIndex j; CoinBigIndex count = 0; for (j = startPositive_[i]; j < startPositive_[i+1]; j++) { int iRow = indices_[j]; count += inputWeights[iRow]; } weights[i] = count; } for (i = 0; i < numberRows; i++) { weights[i+numberColumns] = inputWeights[i]; } return weights; } // Append Columns void ClpPlusMinusOneMatrix::appendCols(int number, const CoinPackedVectorBase * const * columns) { int iColumn; CoinBigIndex size = 0; int numberBad = 0; // say if all +1 #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = 0; #endif for (iColumn = 0; iColumn < number; iColumn++) { int n = columns[iColumn]->getNumElements(); const double * element = columns[iColumn]->getElements(); size += n; int i; for (i = 0; i < n; i++) { if (fabs(element[i]) != 1.0) numberBad++; } } if (numberBad) throw CoinError("Not +- 1", "appendCols", "ClpPlusMinusOneMatrix"); // Get rid of temporary arrays delete [] lengths_; lengths_ = NULL; delete matrix_; matrix_ = NULL; int numberNow = startPositive_[numberColumns_]; CoinBigIndex * temp; temp = new CoinBigIndex [numberColumns_+1+number]; CoinMemcpyN(startPositive_, (numberColumns_ + 1), temp); delete [] startPositive_; startPositive_ = temp; temp = new CoinBigIndex [numberColumns_+number]; CoinMemcpyN(startNegative_, numberColumns_, temp); delete [] startNegative_; startNegative_ = temp; int * temp2 = new int [numberNow+size]; CoinMemcpyN(indices_, numberNow, temp2); delete [] indices_; indices_ = temp2; // now add size = numberNow; for (iColumn = 0; iColumn < number; iColumn++) { int n = columns[iColumn]->getNumElements(); const int * row = columns[iColumn]->getIndices(); const double * element = columns[iColumn]->getElements(); int i; for (i = 0; i < n; i++) { if (element[i] == 1.0) indices_[size++] = row[i]; } startNegative_[iColumn+numberColumns_] = size; for (i = 0; i < n; i++) { if (element[i] == -1.0) indices_[size++] = row[i]; } startPositive_[iColumn+numberColumns_+1] = size; } numberColumns_ += number; } // Append Rows void ClpPlusMinusOneMatrix::appendRows(int number, const CoinPackedVectorBase * const * rows) { // Allocate arrays to use for counting int * countPositive = new int [numberColumns_+1]; memset(countPositive, 0, numberColumns_ * sizeof(int)); int * countNegative = new int [numberColumns_]; memset(countNegative, 0, numberColumns_ * sizeof(int)); int iRow; CoinBigIndex size = 0; int numberBad = 0; // say if all +1 #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = 0; #endif for (iRow = 0; iRow < number; iRow++) { int n = rows[iRow]->getNumElements(); const int * column = rows[iRow]->getIndices(); const double * element = rows[iRow]->getElements(); size += n; int i; for (i = 0; i < n; i++) { int iColumn = column[i]; if (element[i] == 1.0) countPositive[iColumn]++; else if (element[i] == -1.0) countNegative[iColumn]++; else numberBad++; } } if (numberBad) throw CoinError("Not +- 1", "appendRows", "ClpPlusMinusOneMatrix"); // Get rid of temporary arrays delete [] lengths_; lengths_ = NULL; delete matrix_; matrix_ = NULL; int numberNow = startPositive_[numberColumns_]; int * newIndices = new int [numberNow+size]; // Update starts and turn counts into positions // also move current indices int iColumn; CoinBigIndex numberAdded = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { int n, move; CoinBigIndex now; now = startPositive_[iColumn]; move = startNegative_[iColumn] - now; n = countPositive[iColumn]; startPositive_[iColumn] += numberAdded; CoinMemcpyN(indices_+now, move, newIndices + startPositive_[iColumn]); countPositive[iColumn] = startNegative_[iColumn] + numberAdded; numberAdded += n; now = startNegative_[iColumn]; move = startPositive_[iColumn+1] - now; n = countNegative[iColumn]; startNegative_[iColumn] += numberAdded; CoinMemcpyN(indices_+now, move, newIndices + startNegative_[iColumn]); countNegative[iColumn] = startPositive_[iColumn+1] + numberAdded; numberAdded += n; } delete [] indices_; indices_ = newIndices; startPositive_[numberColumns_] += numberAdded; // Now put in for (iRow = 0; iRow < number; iRow++) { int newRow = numberRows_ + iRow; int n = rows[iRow]->getNumElements(); const int * column = rows[iRow]->getIndices(); const double * element = rows[iRow]->getElements(); int i; for (i = 0; i < n; i++) { int iColumn = column[i]; int put; if (element[i] == 1.0) { put = countPositive[iColumn]; countPositive[iColumn] = put + 1; } else { put = countNegative[iColumn]; countNegative[iColumn] = put + 1; } indices_[put] = newRow; } } delete [] countPositive; delete [] countNegative; numberRows_ += number; } /* Returns largest and smallest elements of both signs. Largest refers to largest absolute value. */ void ClpPlusMinusOneMatrix::rangeOfElements(double & smallestNegative, double & largestNegative, double & smallestPositive, double & largestPositive) { int iColumn; bool plusOne = false; bool minusOne = false; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (startNegative_[iColumn] > startPositive_[iColumn]) plusOne = true; if (startPositive_[iColumn+1] > startNegative_[iColumn]) minusOne = true; } if (minusOne) { smallestNegative = -1.0; largestNegative = -1.0; } else { smallestNegative = 0.0; largestNegative = 0.0; } if (plusOne) { smallestPositive = 1.0; largestPositive = 1.0; } else { smallestPositive = 0.0; largestPositive = 0.0; } } // Says whether it can do partial pricing bool ClpPlusMinusOneMatrix::canDoPartialPricing() const { return true; } // Partial pricing void ClpPlusMinusOneMatrix::partialPricing(ClpSimplex * model, double startFraction, double endFraction, int & bestSequence, int & numberWanted) { numberWanted = currentWanted_; int start = static_cast (startFraction * numberColumns_); int end = CoinMin(static_cast (endFraction * numberColumns_ + 1), numberColumns_); CoinBigIndex j; double tolerance = model->currentDualTolerance(); double * COIN_RESTRICT reducedCost = model->djRegion(); const double * COIN_RESTRICT duals = model->dualRowSolution(); const double * COIN_RESTRICT cost = model->costRegion(); double bestDj; if (bestSequence >= 0) bestDj = fabs(reducedCost[bestSequence]); else bestDj = tolerance; int sequenceOut = model->sequenceOut(); int saveSequence = bestSequence; int iSequence; for (iSequence = start; iSequence < end; iSequence++) { if (iSequence != sequenceOut) { double value; ClpSimplex::Status status = model->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = cost[iSequence]; j = startPositive_[iSequence]; for (; j < startNegative_[iSequence]; j++) { int iRow = indices_[j]; value -= duals[iRow]; } for (; j < startPositive_[iSequence+1]; j++) { int iRow = indices_[j]; value += duals[iRow]; } value = fabs(value); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atUpperBound: value = cost[iSequence]; j = startPositive_[iSequence]; for (; j < startNegative_[iSequence]; j++) { int iRow = indices_[j]; value -= duals[iRow]; } for (; j < startPositive_[iSequence+1]; j++) { int iRow = indices_[j]; value += duals[iRow]; } if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atLowerBound: value = cost[iSequence]; j = startPositive_[iSequence]; for (; j < startNegative_[iSequence]; j++) { int iRow = indices_[j]; value -= duals[iRow]; } for (; j < startPositive_[iSequence+1]; j++) { int iRow = indices_[j]; value += duals[iRow]; } value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (!numberWanted) break; } if (bestSequence != saveSequence) { // recompute dj double value = cost[bestSequence]; j = startPositive_[bestSequence]; for (; j < startNegative_[bestSequence]; j++) { int iRow = indices_[j]; value -= duals[iRow]; } for (; j < startPositive_[bestSequence+1]; j++) { int iRow = indices_[j]; value += duals[iRow]; } reducedCost[bestSequence] = value; savedBestSequence_ = bestSequence; savedBestDj_ = reducedCost[savedBestSequence_]; } currentWanted_ = numberWanted; } // Allow any parts of a created CoinMatrix to be deleted void ClpPlusMinusOneMatrix::releasePackedMatrix() const { delete matrix_; delete [] lengths_; matrix_ = NULL; lengths_ = NULL; // say if all +1 #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = 0; #endif } /* Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster */ bool ClpPlusMinusOneMatrix::canCombine(const ClpSimplex * model, const CoinIndexedVector * pi) const { int numberInRowArray = pi->getNumElements(); int numberRows = model->numberRows(); bool packed = pi->packedMode(); // factor should be smaller if doing both with two pi vectors double factor = 0.27; // We may not want to do by row if there may be cache problems // It would be nice to find L2 cache size - for moment 512K // Be slightly optimistic if (numberColumns_ * sizeof(double) > 1000000) { if (numberRows * 10 < numberColumns_) factor *= 0.333333333; else if (numberRows * 4 < numberColumns_) factor *= 0.5; else if (numberRows * 2 < numberColumns_) factor *= 0.66666666667; //if (model->numberIterations()%50==0) //printf("%d nonzero\n",numberInRowArray); } // if not packed then bias a bit more towards by column if (!packed) factor *= 0.9; return (numberInRowArray > factor * numberRows || !model->rowCopy()); } // These have to match ClpPrimalColumnSteepest version #define reference(i) (((reference[i>>5]>>(i&31))&1)!=0) // Updates two arrays for steepest void ClpPlusMinusOneMatrix::transposeTimes2(const ClpSimplex * model, const CoinIndexedVector * pi1, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * spare, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * COIN_RESTRICT reference, double * COIN_RESTRICT weights, double scaleFactor) { // put row of tableau in dj1 double * COIN_RESTRICT pi = pi1->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = dj1->getIndices(); double * COIN_RESTRICT array = dj1->denseVector(); int numberInRowArray = pi1->getNumElements(); double zeroTolerance = model->zeroTolerance(); bool packed = pi1->packedMode(); // do by column int iColumn; assert (!spare->getNumElements()); double * COIN_RESTRICT piWeight = pi2->denseVector(); assert (!pi2->packedMode()); bool killDjs = (scaleFactor == 0.0); if (!scaleFactor) scaleFactor = 1.0; // Note scale factor was -1.0 if (packed) { // need to expand pi into y assert(spare->capacity() >= model->numberRows()); double * COIN_RESTRICT piOld = pi; pi = spare->denseVector(); const int * COIN_RESTRICT whichRow = pi1->getIndices(); int i; // modify pi so can collapse to one loop for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = piOld[i]; } CoinBigIndex j; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { ClpSimplex::Status status = model->getStatus(iColumn); if (status == ClpSimplex::basic || status == ClpSimplex::isFixed) continue; double value = 0.0; for (j = startPositive_[iColumn]; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; value -= pi[iRow]; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; value += pi[iRow]; } if (fabs(value) > zeroTolerance) { // and do other array double modification = 0.0; for (j = startPositive_[iColumn]; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; modification += piWeight[iRow]; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; modification -= piWeight[iRow]; } double thisWeight = weights[iColumn]; double pivot = value * scaleFactor; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; if (!killDjs) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } // zero out for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = 0.0; } } else { CoinBigIndex j; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { ClpSimplex::Status status = model->getStatus(iColumn); if (status == ClpSimplex::basic || status == ClpSimplex::isFixed) continue; double value = 0.0; for (j = startPositive_[iColumn]; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; value -= pi[iRow]; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; value += pi[iRow]; } if (fabs(value) > zeroTolerance) { // and do other array double modification = 0.0; for (j = startPositive_[iColumn]; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; modification += piWeight[iRow]; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; modification -= piWeight[iRow]; } double thisWeight = weights[iColumn]; double pivot = value * scaleFactor; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; if (!killDjs) { array[iColumn] = value; index[numberNonZero++] = iColumn; } } } } dj1->setNumElements(numberNonZero); spare->setNumElements(0); if (packed) dj1->setPackedMode(true); } // Updates second array for steepest and does devex weights void ClpPlusMinusOneMatrix::subsetTimes2(const ClpSimplex * , CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector *, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * COIN_RESTRICT reference, double * COIN_RESTRICT weights, double scaleFactor) { int number = dj1->getNumElements(); const int * COIN_RESTRICT index = dj1->getIndices(); double * COIN_RESTRICT array = dj1->denseVector(); assert( dj1->packedMode()); double * COIN_RESTRICT piWeight = pi2->denseVector(); bool killDjs = (scaleFactor == 0.0); if (!scaleFactor) scaleFactor = 1.0; for (int k = 0; k < number; k++) { int iColumn = index[k]; double pivot = array[k] * scaleFactor; if (killDjs) array[k] = 0.0; // and do other array double modification = 0.0; CoinBigIndex j; for (j = startPositive_[iColumn]; j < startNegative_[iColumn]; j++) { int iRow = indices_[j]; modification += piWeight[iRow]; } for (; j < startPositive_[iColumn+1]; j++) { int iRow = indices_[j]; modification -= piWeight[iRow]; } double thisWeight = weights[iColumn]; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; } } /* Set the dimensions of the matrix. In effect, append new empty columns/rows to the matrix. A negative number for either dimension means that that dimension doesn't change. Otherwise the new dimensions MUST be at least as large as the current ones otherwise an exception is thrown. */ void ClpPlusMinusOneMatrix::setDimensions(int newnumrows, int newnumcols) { if (newnumrows < 0) newnumrows = numberRows_; if (newnumrows < numberRows_) throw CoinError("Bad new rownum (less than current)", "setDimensions", "CoinPackedMatrix"); if (newnumcols < 0) newnumcols = numberColumns_; if (newnumcols < numberColumns_) throw CoinError("Bad new colnum (less than current)", "setDimensions", "CoinPackedMatrix"); int number = 0; int length = 0; if (columnOrdered_) { length = numberColumns_; numberColumns_ = newnumcols; number = numberColumns_; } else { length = numberRows_; numberRows_ = newnumrows; number = numberRows_; } if (number > length) { CoinBigIndex * temp; int i; CoinBigIndex end = startPositive_[length]; temp = new CoinBigIndex [number+1]; CoinMemcpyN(startPositive_, (length + 1), temp); delete [] startPositive_; for (i = length + 1; i < number + 1; i++) temp[i] = end; startPositive_ = temp; temp = new CoinBigIndex [number]; CoinMemcpyN(startNegative_, length, temp); delete [] startNegative_; for (i = length; i < number; i++) temp[i] = end; startNegative_ = temp; } } #ifndef SLIM_CLP /* Append a set of rows/columns to the end of the matrix. Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns */ int ClpPlusMinusOneMatrix::appendMatrix(int number, int type, const CoinBigIndex * starts, const int * index, const double * element, int /*numberOther*/) { int numberErrors = 0; // say if all +1 #ifdef CLP_PLUS_ONE_MATRIX otherFlags_ = 0; #endif // make into CoinPackedVector CoinPackedVectorBase ** vectors = new CoinPackedVectorBase * [number]; int iVector; for (iVector = 0; iVector < number; iVector++) { int iStart = starts[iVector]; vectors[iVector] = new CoinPackedVector(starts[iVector+1] - iStart, index + iStart, element + iStart); } if (type == 0) { // rows appendRows(number, vectors); } else { // columns appendCols(number, vectors); } for (iVector = 0; iVector < number; iVector++) delete vectors[iVector]; delete [] vectors; return numberErrors; } #endif CoinMP-1.8.3/Clp/src/CoinAbcCommonFactorization.hpp0000644000175000017500000000561612101105055020534 0ustar renerene/* $Id: CoinAbcCommonFactorization.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2000, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinAbcCommonFactorization_H #define CoinAbcCommonFactorization_H /* meaning of ABC_SMALL -1 force copies (and no tests) 0 force copy of U 2 force no copies (and no tests) */ #include "CoinAbcCommon.hpp" //#define DONT_USE_SLACKS //#define COIN_ONE_ETA_COPY 100 //#define COIN_FAC_NEW 1 #define INITIAL_AVERAGE 1.0 #define INITIAL_AVERAGE2 1.0 #define AVERAGE_SCALE_BACK 0.8 //#define SWITCHABLE_STATISTICS #ifndef SWITCHABLE_STATISTICS #define setStatistics(x) #define factorizationStatistics() (true) #else #define setStatistics(x) collectStatistics_=x #define factorizationStatistics() (collectStatistics_) #endif #include "CoinAbcDenseFactorization.hpp" class CoinPackedMatrix; class CoinFactorization; #define FACTORIZATION_STATISTICS 0 //1 typedef struct { double countInput_; double countAfterL_; double countAfterR_; double countAfterU_; double averageAfterL_; double averageAfterR_; double averageAfterU_; #if FACTORIZATION_STATISTICS double twiddleFactor1_; double twiddleFactor2_; #endif CoinSimplexInt numberCounts_; } CoinAbcStatistics; #if FACTORIZATION_STATISTICS #define twiddleFactor1S() (statistics.twiddleFactor1_) #define twiddleFactor2S() (statistics.twiddleFactor2_) #define twiddleFtranFactor1() (ftranTwiddleFactor1_) #define twiddleFtranFTFactor1() (ftranFTTwiddleFactor1_) #define twiddleBtranFactor1() (btranTwiddleFactor1_) #define twiddleFtranFactor2() (ftranTwiddleFactor2_) #define twiddleFtranFTFactor2() (ftranFTTwiddleFactor2_) #define twiddleBtranFactor2() (btranTwiddleFactor2_) #define twiddleBtranFullFactor1() (btranFullTwiddleFactor1_) #else #define twiddleFactor1S() (1.0) #define twiddleFactor2S() (1.0) #define twiddleFtranFactor1() (1.0) #define twiddleFtranFTFactor1() (1.0) #define twiddleBtranFactor1() (1.0) #define twiddleFtranFactor2() (1.0) #define twiddleFtranFTFactor2() (1.0) #define twiddleBtranFactor2() (1.0) #define twiddleBtranFullFactor1() (1.0) #endif #define ABC_FAC_GOT_LCOPY 4 #define ABC_FAC_GOT_RCOPY 8 #define ABC_FAC_GOT_UCOPY 16 #define ABC_FAC_GOT_SPARSE 32 typedef struct { CoinBigIndex next; CoinBigIndex start; CoinSimplexUnsignedInt stack; } CoinAbcStack; void CoinAbcDgetrs(char trans,int m, double * a, double * work); int CoinAbcDgetrf(int m, int n, double * a, int lda, int * ipiv #if ABC_PARALLEL==2 ,int parallelMode #endif ); void CoinAbcDgetrs(char trans,int m, long double * a, long double * work); int CoinAbcDgetrf(int m, int n, long double * a, int lda, int * ipiv #if ABC_PARALLEL==2 ,int parallelMode #endif ); #define SWAP_FACTOR 2 #define BLOCKING8 8 #define BLOCKING8X8 BLOCKING8*BLOCKING8 #endif CoinMP-1.8.3/Clp/src/CoinAbcOrderedFactorization1.cpp0000644000175000017500000000107712101105055020741 0ustar renerene/* $Id: CoinAbcOrderedFactorization1.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcOrderedFactorization #define ABC_SMALL -1 #define ABC_ORDERED_FACTORIZATION #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization1.cpp" #endif CoinMP-1.8.3/Clp/src/ClpCholeskyTaucs.cpp0000644000175000017500000003772311510657452016567 0ustar renerene/* $Id: ClpCholeskyTaucs.cpp 1665 2011-01-04 17:55:54Z lou $ */ #ifdef TAUCS_BARRIER // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" #include "ClpInterior.hpp" #include "ClpCholeskyTaucs.hpp" #include "ClpMessage.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpCholeskyTaucs::ClpCholeskyTaucs () : ClpCholeskyBase(), matrix_(NULL), factorization_(NULL), sparseFactorT_(NULL), choleskyStartT_(NULL), choleskyRowT_(NULL), sizeFactorT_(0), rowCopyT_(NULL) { type_ = 13; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpCholeskyTaucs::ClpCholeskyTaucs (const ClpCholeskyTaucs & rhs) : ClpCholeskyBase(rhs) { type_ = rhs.type_; // For Taucs stuff is done by malloc matrix_ = rhs.matrix_; sizeFactorT_ = rhs.sizeFactorT_; if (matrix_) { choleskyStartT_ = (int *) malloc((numberRows_ + 1) * sizeof(int)); CoinMemcpyN(rhs.choleskyStartT_, (numberRows_ + 1), choleskyStartT_); choleskyRowT_ = (int *) malloc(sizeFactorT_ * sizeof(int)); CoinMemcpyN(rhs.choleskyRowT_, sizeFactorT_, choleskyRowT_); sparseFactorT_ = (double *) malloc(sizeFactorT_ * sizeof(double)); CoinMemcpyN(rhs.sparseFactorT_, sizeFactorT_, sparseFactorT_); matrix_->colptr = choleskyStartT_; matrix_->rowind = choleskyRowT_; matrix_->values.d = sparseFactorT_; } else { sparseFactorT_ = NULL; choleskyStartT_ = NULL; choleskyRowT_ = NULL; } factorization_ = NULL, rowCopyT_ = rhs.rowCopyT_->clone(); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpCholeskyTaucs::~ClpCholeskyTaucs () { taucs_ccs_free(matrix_); if (factorization_) taucs_supernodal_factor_free(factorization_); delete rowCopyT_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpCholeskyTaucs & ClpCholeskyTaucs::operator=(const ClpCholeskyTaucs& rhs) { if (this != &rhs) { ClpCholeskyBase::operator=(rhs); taucs_ccs_free(matrix_); if (factorization_) taucs_supernodal_factor_free(factorization_); factorization_ = NULL; sizeFactorT_ = rhs.sizeFactorT_; matrix_ = rhs.matrix_; if (matrix_) { choleskyStartT_ = (int *) malloc((numberRows_ + 1) * sizeof(int)); CoinMemcpyN(rhs.choleskyStartT_, (numberRows_ + 1), choleskyStartT_); choleskyRowT_ = (int *) malloc(sizeFactorT_ * sizeof(int)); CoinMemcpyN(rhs.choleskyRowT_, sizeFactorT_, choleskyRowT_); sparseFactorT_ = (double *) malloc(sizeFactorT_ * sizeof(double)); CoinMemcpyN(rhs.sparseFactorT_, sizeFactorT_, sparseFactorT_); matrix_->colptr = choleskyStartT_; matrix_->rowind = choleskyRowT_; matrix_->values.d = sparseFactorT_; } else { sparseFactorT_ = NULL; choleskyStartT_ = NULL; choleskyRowT_ = NULL; } delete rowCopyT_; rowCopyT_ = rhs.rowCopyT_->clone(); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpCholeskyBase * ClpCholeskyTaucs::clone() const { return new ClpCholeskyTaucs(*this); } /* Orders rows and saves pointer to matrix.and model */ int ClpCholeskyTaucs::order(ClpInterior * model) { numberRows_ = model->numberRows(); rowsDropped_ = new char [numberRows_]; memset(rowsDropped_, 0, numberRows_); numberRowsDropped_ = 0; model_ = model; rowCopyT_ = model->clpMatrix()->reverseOrderedCopy(); const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const CoinBigIndex * rowStart = rowCopyT_->getVectorStarts(); const int * rowLength = rowCopyT_->getVectorLengths(); const int * column = rowCopyT_->getIndices(); // We need two arrays for counts int * which = new int [numberRows_]; int * used = new int[numberRows_]; CoinZeroN(used, numberRows_); int iRow; sizeFactorT_ = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } sizeFactorT_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; } } delete [] which; // Now we have size - create arrays and fill in matrix_ = taucs_ccs_create(numberRows_, numberRows_, sizeFactorT_, TAUCS_DOUBLE | TAUCS_SYMMETRIC | TAUCS_LOWER); if (!matrix_) return 1; // Space for starts choleskyStartT_ = matrix_->colptr; choleskyRowT_ = matrix_->rowind; sparseFactorT_ = matrix_->values.d; sizeFactorT_ = 0; which = choleskyRowT_; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; choleskyStartT_[iRow] = sizeFactorT_; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } sizeFactorT_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; // Sort std::sort(which, which + number); // move which on which += number; } } choleskyStartT_[numberRows_] = sizeFactorT_; delete [] used; permuteInverse_ = new int [numberRows_]; permute_ = new int[numberRows_]; int * perm, *invp; // There seem to be bugs in ordering if model too small if (numberRows_ > 10) taucs_ccs_order(matrix_, &perm, &invp, (const char *) "genmmd"); else taucs_ccs_order(matrix_, &perm, &invp, (const char *) "identity"); CoinMemcpyN(perm, numberRows_, permuteInverse_); free(perm); CoinMemcpyN(invp, numberRows_, permute_); free(invp); // need to permute taucs_ccs_matrix * permuted = taucs_ccs_permute_symmetrically(matrix_, permuteInverse_, permute_); // symbolic factorization_ = taucs_ccs_factor_llt_symbolic(permuted); taucs_ccs_free(permuted); return factorization_ ? 0 : 1; } /* Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ int ClpCholeskyTaucs::symbolic() { return 0; } /* Factorize - filling in rowsDropped and returning number dropped */ int ClpCholeskyTaucs::factorize(const double * diagonal, int * rowsDropped) { const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const double * element = model_->clpMatrix()->getElements(); const CoinBigIndex * rowStart = rowCopyT_->getVectorStarts(); const int * rowLength = rowCopyT_->getVectorLengths(); const int * column = rowCopyT_->getIndices(); const double * elementByRow = rowCopyT_->getElements(); int numberColumns = model_->clpMatrix()->getNumCols(); int iRow; double * work = new double[numberRows_]; CoinZeroN(work, numberRows_); const double * diagonalSlack = diagonal + numberColumns; int newDropped = 0; double largest; //perturbation double perturbation = model_->diagonalPerturbation() * model_->diagonalNorm(); perturbation = perturbation * perturbation; if (perturbation > 1.0) { //if (model_->model()->logLevel()&4) std::cout << "large perturbation " << perturbation << std::endl; perturbation = sqrt(perturbation);; perturbation = 1.0; } for (iRow = 0; iRow < numberRows_; iRow++) { double * put = sparseFactorT_ + choleskyStartT_[iRow]; int * which = choleskyRowT_ + choleskyStartT_[iRow]; int number = choleskyStartT_[iRow+1] - choleskyStartT_[iRow]; if (!rowLength[iRow]) rowsDropped_[iRow] = 1; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; work[iRow] = diagonalSlack[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; double multiplier = diagonal[iColumn] * elementByRow[k]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { double value = element[j] * multiplier; work[jRow] += value; } } } int j; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; work[jRow] = 0.0; } } else { // dropped int j; for (j = 1; j < number; j++) { put[j] = 0.0; } put[0] = 1.0; } } //check sizes double largest2 = maximumAbsElement(sparseFactorT_, sizeFactorT_); largest2 *= 1.0e-19; largest = CoinMin(largest2, 1.0e-11); int numberDroppedBefore = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int dropped = rowsDropped_[iRow]; // Move to int array rowsDropped[iRow] = dropped; if (!dropped) { CoinBigIndex start = choleskyStartT_[iRow]; double diagonal = sparseFactorT_[start]; if (diagonal > largest2) { sparseFactorT_[start] = diagonal + perturbation; } else { sparseFactorT_[start] = diagonal + perturbation; rowsDropped[iRow] = 2; numberDroppedBefore++; } } } taucs_supernodal_factor_free_numeric(factorization_); // need to permute taucs_ccs_matrix * permuted = taucs_ccs_permute_symmetrically(matrix_, permuteInverse_, permute_); int rCode = taucs_ccs_factor_llt_numeric(permuted, factorization_); taucs_ccs_free(permuted); if (rCode) printf("return code of %d from factor\n", rCode); delete [] work; choleskyCondition_ = 1.0; bool cleanCholesky; if (model_->numberIterations() < 200) cleanCholesky = true; else cleanCholesky = false; /* How do I find out where 1.0e100's are in cholesky? */ if (cleanCholesky) { //drop fresh makes some formADAT easier int oldDropped = numberRowsDropped_; if (newDropped || numberRowsDropped_) { std::cout << "Rank " << numberRows_ - newDropped << " ( " << newDropped << " dropped)"; if (newDropped > oldDropped) std::cout << " ( " << newDropped - oldDropped << " dropped this time)"; std::cout << std::endl; newDropped = 0; for (int i = 0; i < numberRows_; i++) { char dropped = rowsDropped[i]; rowsDropped_[i] = dropped; if (dropped == 2) { //dropped this time rowsDropped[newDropped++] = i; rowsDropped_[i] = 0; } } numberRowsDropped_ = newDropped; newDropped = -(1 + newDropped); } } else { if (newDropped) { newDropped = 0; for (int i = 0; i < numberRows_; i++) { char dropped = rowsDropped[i]; int oldDropped = rowsDropped_[i];; rowsDropped_[i] = dropped; if (dropped == 2) { assert (!oldDropped); //dropped this time rowsDropped[newDropped++] = i; rowsDropped_[i] = 1; } } } numberRowsDropped_ += newDropped; if (numberRowsDropped_) { std::cout << "Rank " << numberRows_ - numberRowsDropped_ << " ( " << numberRowsDropped_ << " dropped)"; if (newDropped) { std::cout << " ( " << newDropped << " dropped this time)"; } std::cout << std::endl; } } status_ = 0; return newDropped; } /* Uses factorization to solve. */ void ClpCholeskyTaucs::solve (double * region) { double * in = new double[numberRows_]; double * out = new double[numberRows_]; taucs_vec_permute(numberRows_, TAUCS_DOUBLE, region, in, permuteInverse_); int rCode = taucs_supernodal_solve_llt(factorization_, out, in); if (rCode) printf("return code of %d from solve\n", rCode); taucs_vec_permute(numberRows_, TAUCS_DOUBLE, out, region, permute_); delete [] out; delete [] in; } #endif CoinMP-1.8.3/Clp/src/AbcWarmStart.hpp0000644000175000017500000001567612101105055015671 0ustar renerene/* $Id: AbcWarmStart.hpp 1910 2013-01-27 02:00:13Z stefan $ */ /*! \legal Copyright (C) 2002, International Business Machines Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #ifndef AbcWarmStart_H #define AbcWarmStart_H #include "AbcCommon.hpp" #include "CoinWarmStartBasis.hpp" // could test using ClpSimplex (or for fans) #define CLP_WARMSTART #ifdef CLP_WARMSTART #include "ClpSimplex.hpp" #define AbcSimplex ClpSimplex #else #include "AbcSimplex.hpp" #endif class AbcWarmStart; //############################################################################# class AbcWarmStartOrganizer { public: /// Create Basis type 0 void createBasis0(); /// Create Basis type 1,2 void createBasis12(); /// Create Basis type 3,4 void createBasis34(); /// delete basis void deleteBasis(AbcWarmStart * basis); /*! \name Constructors, destructors, and related functions */ //@{ /** Default constructor Creates a warm start object organizer */ AbcWarmStartOrganizer(AbcSimplex * model=NULL); /** Copy constructor */ AbcWarmStartOrganizer(const AbcWarmStartOrganizer& ws) ; /** Destructor */ virtual ~AbcWarmStartOrganizer(); /** Assignment */ virtual AbcWarmStartOrganizer& operator=(const AbcWarmStartOrganizer& rhs) ; //@} protected: /** \name Protected data members */ //@{ /// Pointer to AbcSimplex (can only be applied to that) AbcSimplex * model_; /// Pointer to first basis AbcWarmStart * firstBasis_; /// Pointer to last basis AbcWarmStart * lastBasis_; /// Number of bases int numberBases_; /// Size of bases (extra) int sizeBases_; //@} }; /*! \class AbcWarmStart As CoinWarmStartBasis but with alternatives (Also uses Clp status meaning for slacks) */ class AbcWarmStart : public virtual CoinWarmStartBasis { public: /*! \name Methods to modify the warm start object */ //@{ /*! \brief Set basis capacity; existing basis is discarded. After execution of this routine, the warm start object does not describe a valid basis: all structural and artificial variables have status isFree. */ virtual void setSize(int ns, int na) ; /*! \brief Set basis capacity; existing basis is maintained. After execution of this routine, the warm start object describes a valid basis: the status of new structural variables (added columns) is set to nonbasic at lower bound, and the status of new artificial variables (added rows) is set to basic. (The basis can be invalid if new structural variables do not have a finite lower bound.) */ virtual void resize (int newNumberRows, int newNumberColumns); /** \brief Delete a set of rows from the basis \warning This routine assumes that the set of indices to be deleted is sorted in ascending order and contains no duplicates. Use deleteRows() if this is not the case. \warning The resulting basis is guaranteed valid only if all deleted constraints are slack (hence the associated logicals are basic). Removal of a tight constraint with a nonbasic logical implies that some basic variable must be made nonbasic. This correction is left to the client. */ virtual void compressRows (int tgtCnt, const int *tgts) ; /** \brief Delete a set of rows from the basis \warning The resulting basis is guaranteed valid only if all deleted constraints are slack (hence the associated logicals are basic). Removal of a tight constraint with a nonbasic logical implies that some basic variable must be made nonbasic. This correction is left to the client. */ virtual void deleteRows(int rawTgtCnt, const int *rawTgts) ; /** \brief Delete a set of columns from the basis \warning The resulting basis is guaranteed valid only if all deleted variables are nonbasic. Removal of a basic variable implies that some nonbasic variable must be made basic. This correction is left to the client. */ virtual void deleteColumns(int number, const int * which); /// Set model inline void setModel(AbcSimplex * model) { model_=model;} /// Get model inline AbcSimplex * model() const { return model_;} /// Create Basis type 0 void createBasis0(const AbcSimplex * model); /// Create Basis type 12 void createBasis12(const AbcSimplex * model); /// Create Basis type 34 void createBasis34(const AbcSimplex * model); /*! \name Constructors, destructors, and related functions */ //@{ /** Default constructor Creates a warm start object representing an empty basis (0 rows, 0 columns). */ AbcWarmStart(); /** Constructs a warm start object with the specified status vectors. The parameters are copied. Consider assignBasisStatus(int,int,char*&,char*&) if the object should assume ownership. \sa AbcWarmStart::Status for a description of the packing used in the status arrays. */ AbcWarmStart(AbcSimplex * model,int type) ; /** Copy constructor */ AbcWarmStart(const AbcWarmStart& ws) ; /** `Virtual constructor' */ virtual CoinWarmStart *clone() const { return new AbcWarmStart(*this); } /** Destructor */ virtual ~AbcWarmStart(); /** Assignment */ virtual AbcWarmStart& operator=(const AbcWarmStart& rhs) ; /** Assign the status vectors to be the warm start information. In this method the AbcWarmStart object assumes ownership of the pointers and upon return the argument pointers will be NULL. If copying is desirable, use the \link AbcWarmStart(int,int,const char*,const char*) array constructor \endlink or the \link operator=(const AbcWarmStart&) assignment operator \endlink. \note The pointers passed to this method will be freed using delete[], so they must be created using new[]. */ virtual void assignBasisStatus(int ns, int na, char*& sStat, char*& aStat) ; //@} protected: /** \name Protected data members */ //@{ /** Type of basis (always status arrays) 0 - as CoinWarmStartBasis 1,2 - plus factor order as shorts or ints (top bit set means column) 3,4 - plus compact saved factorization add 8 to say steepest edge weights stored (as floats) may want to change next,previous to tree info so can use a different basis for weights */ int typeExtraInformation_; /// Length of extra information in bytes int lengthExtraInformation_; /// The extra information. char * extraInformation_; /// Pointer back to AbcSimplex (can only be applied to that) AbcSimplex * model_; /// Pointer back to AbcWarmStartOrganizer for organization AbcWarmStartOrganizer * organizer_; /// Pointer to previous basis AbcWarmStart * previousBasis_; /// Pointer to next basis AbcWarmStart * nextBasis_; /// Sequence stamp for deletion int stamp_; /** Number of valid rows (rest should have slacks) Check to see if weights are OK for these rows and then just btran new ones for weights */ int numberValidRows_; //@} }; #endif CoinMP-1.8.3/Clp/src/Makefile.in0000644000175000017500000014325712506111472014701 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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@ @COIN_HAS_ABC_TRUE@am__append_1 = \ @COIN_HAS_ABC_TRUE@ AbcCommon.hpp \ @COIN_HAS_ABC_TRUE@ AbcDualRowDantzig.cpp AbcDualRowDantzig.hpp \ @COIN_HAS_ABC_TRUE@ AbcDualRowPivot.cpp AbcDualRowPivot.hpp \ @COIN_HAS_ABC_TRUE@ AbcDualRowSteepest.cpp AbcDualRowSteepest.hpp \ @COIN_HAS_ABC_TRUE@ AbcMatrix.cpp AbcMatrix.hpp \ @COIN_HAS_ABC_TRUE@ AbcNonLinearCost.cpp AbcNonLinearCost.hpp \ @COIN_HAS_ABC_TRUE@ AbcPrimalColumnDantzig.cpp AbcPrimalColumnDantzig.hpp \ @COIN_HAS_ABC_TRUE@ AbcPrimalColumnPivot.cpp AbcPrimalColumnPivot.hpp \ @COIN_HAS_ABC_TRUE@ AbcPrimalColumnSteepest.cpp AbcPrimalColumnSteepest.hpp \ @COIN_HAS_ABC_TRUE@ AbcSimplex.cpp AbcSimplex.hpp \ @COIN_HAS_ABC_TRUE@ AbcSimplexDual.cpp AbcSimplexDual.hpp \ @COIN_HAS_ABC_TRUE@ AbcSimplexPrimal.cpp AbcSimplexPrimal.hpp \ @COIN_HAS_ABC_TRUE@ AbcSimplexParallel.cpp \ @COIN_HAS_ABC_TRUE@ AbcSimplexFactorization.cpp AbcSimplexFactorization.hpp \ @COIN_HAS_ABC_TRUE@ AbcWarmStart.cpp AbcWarmStart.hpp \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization.hpp \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization1.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization2.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization3.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization4.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization5.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcCommonFactorization.hpp \ @COIN_HAS_ABC_TRUE@ CoinAbcCommon.hpp \ @COIN_HAS_ABC_TRUE@ CoinAbcDenseFactorization.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcDenseFactorization.hpp \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization.hpp \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization1.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization2.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization3.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization4.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization5.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcHelperFunctions.cpp CoinAbcHelperFunctions.hpp \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization1.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization2.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization3.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization4.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization5.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization1.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization2.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization3.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization4.cpp \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization5.cpp # if AMD, CHOLMOD, or GLPK is available, then compile ClpCholeskyUfl.cpp @COIN_HAS_AMD_TRUE@am__append_2 = ClpCholeskyUfl.cpp ClpCholeskyUfl.hpp @COIN_HAS_AMD_FALSE@@COIN_HAS_CHOLMOD_TRUE@am__append_3 = ClpCholeskyUfl.cpp ClpCholeskyUfl.hpp @COIN_HAS_AMD_FALSE@@COIN_HAS_CHOLMOD_FALSE@@COIN_HAS_GLPK_TRUE@am__append_4 = ClpCholeskyUfl.cpp ClpCholeskyUfl.hpp @COIN_HAS_MUMPS_TRUE@am__append_5 = ClpCholeskyMumps.cpp ClpCholeskyMumps.hpp @COIN_HAS_WSMP_TRUE@am__append_6 = ClpCholeskyWssmp.cpp ClpCholeskyWssmp.hpp ClpCholeskyWssmpKKT.cpp ClpCholeskyWssmpKKT.hpp bin_PROGRAMS = clp$(EXEEXT) @COIN_HAS_CHOLMOD_TRUE@am__append_7 = -I`$(CYGPATH_W) $(CHOLMODINCDIR)` @COIN_HAS_AMD_TRUE@am__append_8 = -I`$(CYGPATH_W) $(AMDINCDIR)` @COIN_HAS_ABC_TRUE@am__append_9 = AbcSimplex.hpp CoinAbcCommon.hpp AbcCommon.hpp AbcNonLinearCost.hpp # if AMD, CHOLMOD, or GLPK is available, then install ClpCholeskyUfl.hpp (for advanced users) @COIN_HAS_AMD_TRUE@am__append_10 = ClpCholeskyUfl.hpp @COIN_HAS_AMD_FALSE@@COIN_HAS_CHOLMOD_TRUE@am__append_11 = ClpCholeskyUfl.hpp @COIN_HAS_AMD_FALSE@@COIN_HAS_CHOLMOD_FALSE@@COIN_HAS_GLPK_TRUE@am__append_12 = ClpCholeskyUfl.hpp @COIN_HAS_MUMPS_TRUE@am__append_13 = ClpCholeskyMumps.hpp @COIN_HAS_WSMP_TRUE@am__append_14 = ClpCholeskyWssmp.hpp ClpCholeskyWssmpKKT.hpp subdir = src DIST_COMMON = $(am__includecoin_HEADERS_DIST) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/config_clp.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h config_clp.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libClp_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) am__libClp_la_SOURCES_DIST = ClpConfig.h ClpCholeskyBase.cpp \ ClpCholeskyBase.hpp ClpCholeskyDense.cpp ClpCholeskyDense.hpp \ ClpConstraint.cpp ClpConstraint.hpp ClpConstraintLinear.cpp \ ClpConstraintLinear.hpp ClpConstraintQuadratic.cpp \ ClpConstraintQuadratic.hpp Clp_C_Interface.cpp \ Clp_C_Interface.h ClpDualRowDantzig.cpp ClpDualRowDantzig.hpp \ ClpDualRowPivot.cpp ClpDualRowPivot.hpp ClpDualRowSteepest.cpp \ ClpDualRowSteepest.hpp ClpDummyMatrix.cpp ClpDummyMatrix.hpp \ ClpDynamicExampleMatrix.cpp ClpDynamicExampleMatrix.hpp \ ClpDynamicMatrix.cpp ClpDynamicMatrix.hpp ClpEventHandler.cpp \ ClpEventHandler.hpp ClpFactorization.cpp ClpFactorization.hpp \ ClpGubDynamicMatrix.cpp ClpGubDynamicMatrix.hpp \ ClpGubMatrix.cpp ClpGubMatrix.hpp ClpHelperFunctions.cpp \ ClpHelperFunctions.hpp ClpInterior.cpp ClpInterior.hpp \ ClpLinearObjective.cpp ClpLinearObjective.hpp \ ClpMatrixBase.cpp ClpMatrixBase.hpp ClpMessage.cpp \ ClpMessage.hpp ClpModel.cpp ClpModel.hpp ClpNetworkBasis.cpp \ ClpNetworkBasis.hpp ClpNetworkMatrix.cpp ClpNetworkMatrix.hpp \ ClpNonLinearCost.cpp ClpNonLinearCost.hpp ClpNode.cpp \ ClpNode.hpp ClpObjective.cpp ClpObjective.hpp \ ClpPackedMatrix.cpp ClpPackedMatrix.hpp ClpParameters.hpp \ ClpPlusMinusOneMatrix.cpp ClpPlusMinusOneMatrix.hpp \ ClpPredictorCorrector.cpp ClpPredictorCorrector.hpp \ ClpPdco.cpp ClpPdco.hpp ClpPdcoBase.cpp ClpPdcoBase.hpp \ ClpLsqr.cpp ClpLsqr.hpp ClpPresolve.cpp ClpPresolve.hpp \ ClpPrimalColumnDantzig.cpp ClpPrimalColumnDantzig.hpp \ ClpPrimalColumnPivot.cpp ClpPrimalColumnPivot.hpp \ ClpPrimalColumnSteepest.cpp ClpPrimalColumnSteepest.hpp \ ClpQuadraticObjective.cpp ClpQuadraticObjective.hpp \ ClpSimplex.cpp ClpSimplex.hpp ClpSimplexDual.cpp \ ClpSimplexDual.hpp ClpSimplexNonlinear.cpp \ ClpSimplexNonlinear.hpp ClpSimplexOther.cpp \ ClpSimplexOther.hpp ClpSimplexPrimal.cpp ClpSimplexPrimal.hpp \ ClpSolve.cpp ClpSolve.hpp Idiot.cpp Idiot.hpp IdiSolve.cpp \ AbcCommon.hpp AbcDualRowDantzig.cpp AbcDualRowDantzig.hpp \ AbcDualRowPivot.cpp AbcDualRowPivot.hpp AbcDualRowSteepest.cpp \ AbcDualRowSteepest.hpp AbcMatrix.cpp AbcMatrix.hpp \ AbcNonLinearCost.cpp AbcNonLinearCost.hpp \ AbcPrimalColumnDantzig.cpp AbcPrimalColumnDantzig.hpp \ AbcPrimalColumnPivot.cpp AbcPrimalColumnPivot.hpp \ AbcPrimalColumnSteepest.cpp AbcPrimalColumnSteepest.hpp \ AbcSimplex.cpp AbcSimplex.hpp AbcSimplexDual.cpp \ AbcSimplexDual.hpp AbcSimplexPrimal.cpp AbcSimplexPrimal.hpp \ AbcSimplexParallel.cpp AbcSimplexFactorization.cpp \ AbcSimplexFactorization.hpp AbcWarmStart.cpp AbcWarmStart.hpp \ CoinAbcBaseFactorization.hpp CoinAbcBaseFactorization1.cpp \ CoinAbcBaseFactorization2.cpp CoinAbcBaseFactorization3.cpp \ CoinAbcBaseFactorization4.cpp CoinAbcBaseFactorization5.cpp \ CoinAbcCommonFactorization.hpp CoinAbcCommon.hpp \ CoinAbcDenseFactorization.cpp CoinAbcDenseFactorization.hpp \ CoinAbcFactorization.hpp CoinAbcFactorization1.cpp \ CoinAbcFactorization2.cpp CoinAbcFactorization3.cpp \ CoinAbcFactorization4.cpp CoinAbcFactorization5.cpp \ CoinAbcHelperFunctions.cpp CoinAbcHelperFunctions.hpp \ CoinAbcOrderedFactorization1.cpp \ CoinAbcOrderedFactorization2.cpp \ CoinAbcOrderedFactorization3.cpp \ CoinAbcOrderedFactorization4.cpp \ CoinAbcOrderedFactorization5.cpp \ CoinAbcSmallFactorization1.cpp CoinAbcSmallFactorization2.cpp \ CoinAbcSmallFactorization3.cpp CoinAbcSmallFactorization4.cpp \ CoinAbcSmallFactorization5.cpp ClpCholeskyUfl.cpp \ ClpCholeskyUfl.hpp ClpCholeskyMumps.cpp ClpCholeskyMumps.hpp \ ClpCholeskyWssmp.cpp ClpCholeskyWssmp.hpp \ ClpCholeskyWssmpKKT.cpp ClpCholeskyWssmpKKT.hpp @COIN_HAS_ABC_TRUE@am__objects_1 = AbcDualRowDantzig.lo \ @COIN_HAS_ABC_TRUE@ AbcDualRowPivot.lo AbcDualRowSteepest.lo \ @COIN_HAS_ABC_TRUE@ AbcMatrix.lo AbcNonLinearCost.lo \ @COIN_HAS_ABC_TRUE@ AbcPrimalColumnDantzig.lo \ @COIN_HAS_ABC_TRUE@ AbcPrimalColumnPivot.lo \ @COIN_HAS_ABC_TRUE@ AbcPrimalColumnSteepest.lo AbcSimplex.lo \ @COIN_HAS_ABC_TRUE@ AbcSimplexDual.lo AbcSimplexPrimal.lo \ @COIN_HAS_ABC_TRUE@ AbcSimplexParallel.lo \ @COIN_HAS_ABC_TRUE@ AbcSimplexFactorization.lo AbcWarmStart.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization1.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization2.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization3.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization4.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcBaseFactorization5.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcDenseFactorization.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization1.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization2.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization3.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization4.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcFactorization5.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcHelperFunctions.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization1.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization2.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization3.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization4.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcOrderedFactorization5.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization1.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization2.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization3.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization4.lo \ @COIN_HAS_ABC_TRUE@ CoinAbcSmallFactorization5.lo @COIN_HAS_AMD_TRUE@am__objects_2 = ClpCholeskyUfl.lo @COIN_HAS_AMD_FALSE@@COIN_HAS_CHOLMOD_TRUE@am__objects_3 = \ @COIN_HAS_AMD_FALSE@@COIN_HAS_CHOLMOD_TRUE@ ClpCholeskyUfl.lo @COIN_HAS_AMD_FALSE@@COIN_HAS_CHOLMOD_FALSE@@COIN_HAS_GLPK_TRUE@am__objects_4 = ClpCholeskyUfl.lo @COIN_HAS_MUMPS_TRUE@am__objects_5 = ClpCholeskyMumps.lo @COIN_HAS_WSMP_TRUE@am__objects_6 = ClpCholeskyWssmp.lo \ @COIN_HAS_WSMP_TRUE@ ClpCholeskyWssmpKKT.lo am_libClp_la_OBJECTS = ClpCholeskyBase.lo ClpCholeskyDense.lo \ ClpConstraint.lo ClpConstraintLinear.lo \ ClpConstraintQuadratic.lo Clp_C_Interface.lo \ ClpDualRowDantzig.lo ClpDualRowPivot.lo ClpDualRowSteepest.lo \ ClpDummyMatrix.lo ClpDynamicExampleMatrix.lo \ ClpDynamicMatrix.lo ClpEventHandler.lo ClpFactorization.lo \ ClpGubDynamicMatrix.lo ClpGubMatrix.lo ClpHelperFunctions.lo \ ClpInterior.lo ClpLinearObjective.lo ClpMatrixBase.lo \ ClpMessage.lo ClpModel.lo ClpNetworkBasis.lo \ ClpNetworkMatrix.lo ClpNonLinearCost.lo ClpNode.lo \ ClpObjective.lo ClpPackedMatrix.lo ClpPlusMinusOneMatrix.lo \ ClpPredictorCorrector.lo ClpPdco.lo ClpPdcoBase.lo ClpLsqr.lo \ ClpPresolve.lo ClpPrimalColumnDantzig.lo \ ClpPrimalColumnPivot.lo ClpPrimalColumnSteepest.lo \ ClpQuadraticObjective.lo ClpSimplex.lo ClpSimplexDual.lo \ ClpSimplexNonlinear.lo ClpSimplexOther.lo ClpSimplexPrimal.lo \ ClpSolve.lo Idiot.lo IdiSolve.lo $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_5) $(am__objects_6) libClp_la_OBJECTS = $(am_libClp_la_OBJECTS) @DEPENDENCY_LINKING_TRUE@libClpSolver_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) libClp.la am_libClpSolver_la_OBJECTS = ClpSolver.lo CbcOrClpParam.lo Clp_ampl.lo \ MyEventHandler.lo MyMessageHandler.lo unitTest.lo libClpSolver_la_OBJECTS = $(am_libClpSolver_la_OBJECTS) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_clp_OBJECTS = ClpMain.$(OBJEXT) clp_OBJECTS = $(am_clp_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libClp_la_SOURCES) $(libClpSolver_la_SOURCES) \ $(clp_SOURCES) DIST_SOURCES = $(am__libClp_la_SOURCES_DIST) \ $(libClpSolver_la_SOURCES) $(clp_SOURCES) am__includecoin_HEADERS_DIST = Clp_C_Interface.h ClpCholeskyBase.hpp \ ClpCholeskyDense.hpp ClpConstraint.hpp ClpConstraintLinear.hpp \ ClpConstraintQuadratic.hpp ClpDualRowDantzig.hpp \ ClpDualRowPivot.hpp ClpDualRowSteepest.hpp ClpDummyMatrix.hpp \ ClpDynamicExampleMatrix.hpp ClpDynamicMatrix.hpp \ ClpEventHandler.hpp ClpFactorization.hpp \ ClpGubDynamicMatrix.hpp ClpGubMatrix.hpp ClpInterior.hpp \ ClpLinearObjective.hpp ClpMatrixBase.hpp ClpMessage.hpp \ ClpModel.hpp ClpNetworkMatrix.hpp ClpNonLinearCost.hpp \ ClpNode.hpp ClpObjective.hpp ClpPackedMatrix.hpp \ ClpPdcoBase.hpp ClpPlusMinusOneMatrix.hpp ClpParameters.hpp \ ClpPresolve.hpp ClpPrimalColumnDantzig.hpp \ ClpPrimalColumnPivot.hpp ClpPrimalColumnSteepest.hpp \ ClpQuadraticObjective.hpp ClpSimplex.hpp \ ClpSimplexNonlinear.hpp ClpSimplexOther.hpp ClpSimplexDual.hpp \ ClpSimplexPrimal.hpp ClpSolve.hpp CbcOrClpParam.hpp Idiot.hpp \ AbcSimplex.hpp CoinAbcCommon.hpp AbcCommon.hpp \ AbcNonLinearCost.hpp ClpCholeskyUfl.hpp ClpCholeskyMumps.hpp \ ClpCholeskyWssmp.hpp ClpCholeskyWssmpKKT.hpp CbcOrClpParam.cpp includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMDINCDIR = @AMDINCDIR@ AMDLIB = @AMDLIB@ AMTAR = @AMTAR@ AR = @AR@ ASL_CFLAGS = @ASL_CFLAGS@ ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ ASL_DATA = @ASL_DATA@ ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ ASL_LIBS = @ASL_LIBS@ ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BLAS_CFLAGS = @BLAS_CFLAGS@ BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ BLAS_DATA = @BLAS_DATA@ BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ BLAS_LIBS = @BLAS_LIBS@ BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CHOLMODINCDIR = @CHOLMODINCDIR@ CHOLMODLIB = @CHOLMODLIB@ CLPLIB_CFLAGS = @CLPLIB_CFLAGS@ CLPLIB_CFLAGS_INSTALLED = @CLPLIB_CFLAGS_INSTALLED@ CLPLIB_DEPENDENCIES = @CLPLIB_DEPENDENCIES@ CLPLIB_LIBS = @CLPLIB_LIBS@ CLPLIB_LIBS_INSTALLED = @CLPLIB_LIBS_INSTALLED@ CLPLIB_PCLIBS = @CLPLIB_PCLIBS@ CLPLIB_PCREQUIRES = @CLPLIB_PCREQUIRES@ CLP_SVN_REV = @CLP_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_ABC_FALSE = @COIN_HAS_ABC_FALSE@ COIN_HAS_ABC_TRUE = @COIN_HAS_ABC_TRUE@ COIN_HAS_AMD_FALSE = @COIN_HAS_AMD_FALSE@ COIN_HAS_AMD_TRUE = @COIN_HAS_AMD_TRUE@ COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ COIN_HAS_CHOLMOD_FALSE = @COIN_HAS_CHOLMOD_FALSE@ COIN_HAS_CHOLMOD_TRUE = @COIN_HAS_CHOLMOD_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MUMPS_FALSE = @COIN_HAS_MUMPS_FALSE@ COIN_HAS_MUMPS_TRUE = @COIN_HAS_MUMPS_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_OSITESTS_FALSE = @COIN_HAS_OSITESTS_FALSE@ COIN_HAS_OSITESTS_TRUE = @COIN_HAS_OSITESTS_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_WSMP_FALSE = @COIN_HAS_WSMP_FALSE@ COIN_HAS_WSMP_TRUE = @COIN_HAS_WSMP_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FLIBS = @FLIBS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MPIF77 = @MPIF77@ MUMPS_CFLAGS = @MUMPS_CFLAGS@ MUMPS_CFLAGS_INSTALLED = @MUMPS_CFLAGS_INSTALLED@ MUMPS_DATA = @MUMPS_DATA@ MUMPS_DATA_INSTALLED = @MUMPS_DATA_INSTALLED@ MUMPS_DEPENDENCIES = @MUMPS_DEPENDENCIES@ MUMPS_LIBS = @MUMPS_LIBS@ MUMPS_LIBS_INSTALLED = @MUMPS_LIBS_INSTALLED@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OPT_FFLAGS = @OPT_FFLAGS@ OSICLPLIB_CFLAGS = @OSICLPLIB_CFLAGS@ OSICLPLIB_CFLAGS_INSTALLED = @OSICLPLIB_CFLAGS_INSTALLED@ OSICLPLIB_DEPENDENCIES = @OSICLPLIB_DEPENDENCIES@ OSICLPLIB_LIBS = @OSICLPLIB_LIBS@ OSICLPLIB_LIBS_INSTALLED = @OSICLPLIB_LIBS_INSTALLED@ OSICLPLIB_PCLIBS = @OSICLPLIB_PCLIBS@ OSICLPLIB_PCREQUIRES = @OSICLPLIB_PCREQUIRES@ OSITESTS_CFLAGS = @OSITESTS_CFLAGS@ OSITESTS_CFLAGS_INSTALLED = @OSITESTS_CFLAGS_INSTALLED@ OSITESTS_DATA = @OSITESTS_DATA@ OSITESTS_DATA_INSTALLED = @OSITESTS_DATA_INSTALLED@ OSITESTS_DEPENDENCIES = @OSITESTS_DEPENDENCIES@ OSITESTS_LIBS = @OSITESTS_LIBS@ OSITESTS_LIBS_INSTALLED = @OSITESTS_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libClp # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in the 'lib' directory lib_LTLIBRARIES = libClp.la libClpSolver.la # List all source files for this library, including headers libClp_la_SOURCES = ClpConfig.h ClpCholeskyBase.cpp \ ClpCholeskyBase.hpp ClpCholeskyDense.cpp ClpCholeskyDense.hpp \ ClpConstraint.cpp ClpConstraint.hpp ClpConstraintLinear.cpp \ ClpConstraintLinear.hpp ClpConstraintQuadratic.cpp \ ClpConstraintQuadratic.hpp Clp_C_Interface.cpp \ Clp_C_Interface.h ClpDualRowDantzig.cpp ClpDualRowDantzig.hpp \ ClpDualRowPivot.cpp ClpDualRowPivot.hpp ClpDualRowSteepest.cpp \ ClpDualRowSteepest.hpp ClpDummyMatrix.cpp ClpDummyMatrix.hpp \ ClpDynamicExampleMatrix.cpp ClpDynamicExampleMatrix.hpp \ ClpDynamicMatrix.cpp ClpDynamicMatrix.hpp ClpEventHandler.cpp \ ClpEventHandler.hpp ClpFactorization.cpp ClpFactorization.hpp \ ClpGubDynamicMatrix.cpp ClpGubDynamicMatrix.hpp \ ClpGubMatrix.cpp ClpGubMatrix.hpp ClpHelperFunctions.cpp \ ClpHelperFunctions.hpp ClpInterior.cpp ClpInterior.hpp \ ClpLinearObjective.cpp ClpLinearObjective.hpp \ ClpMatrixBase.cpp ClpMatrixBase.hpp ClpMessage.cpp \ ClpMessage.hpp ClpModel.cpp ClpModel.hpp ClpNetworkBasis.cpp \ ClpNetworkBasis.hpp ClpNetworkMatrix.cpp ClpNetworkMatrix.hpp \ ClpNonLinearCost.cpp ClpNonLinearCost.hpp ClpNode.cpp \ ClpNode.hpp ClpObjective.cpp ClpObjective.hpp \ ClpPackedMatrix.cpp ClpPackedMatrix.hpp ClpParameters.hpp \ ClpPlusMinusOneMatrix.cpp ClpPlusMinusOneMatrix.hpp \ ClpPredictorCorrector.cpp ClpPredictorCorrector.hpp \ ClpPdco.cpp ClpPdco.hpp ClpPdcoBase.cpp ClpPdcoBase.hpp \ ClpLsqr.cpp ClpLsqr.hpp ClpPresolve.cpp ClpPresolve.hpp \ ClpPrimalColumnDantzig.cpp ClpPrimalColumnDantzig.hpp \ ClpPrimalColumnPivot.cpp ClpPrimalColumnPivot.hpp \ ClpPrimalColumnSteepest.cpp ClpPrimalColumnSteepest.hpp \ ClpQuadraticObjective.cpp ClpQuadraticObjective.hpp \ ClpSimplex.cpp ClpSimplex.hpp ClpSimplexDual.cpp \ ClpSimplexDual.hpp ClpSimplexNonlinear.cpp \ ClpSimplexNonlinear.hpp ClpSimplexOther.cpp \ ClpSimplexOther.hpp ClpSimplexPrimal.cpp ClpSimplexPrimal.hpp \ ClpSolve.cpp ClpSolve.hpp Idiot.cpp Idiot.hpp IdiSolve.cpp \ $(am__append_1) $(am__append_2) $(am__append_3) \ $(am__append_4) $(am__append_5) $(am__append_6) libClpSolver_la_SOURCES = \ ClpSolver.cpp \ CbcOrClpParam.cpp CbcOrClpParam.hpp \ Clp_ampl.cpp Clp_ampl.h \ MyEventHandler.cpp MyEventHandler.hpp \ MyMessageHandler.cpp MyMessageHandler.hpp \ unitTest.cpp # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libClp_la_LIBADD = $(CLPLIB_LIBS) @DEPENDENCY_LINKING_TRUE@libClpSolver_la_LIBADD = $(CLPLIB_LIBS) libClp.la # This is for libtool libClp_la_LDFLAGS = $(LT_LDFLAGS) libClpSolver_la_LDFLAGS = $(LT_LDFLAGS) # List all source files for this executable, including headers clp_SOURCES = ClpMain.cpp # List all additionally required libraries clp_LDADD = libClpSolver.la libClp.la $(CLPLIB_LIBS) $(ASL_LIBS) # List all dependency libraries (similar to LDADD, but without -l, -L flags) clp_DEPENDENCIES = libClpSolver.la libClp.la $(CLPLIB_DEPENDENCIES) ######################################################################## # Additional flags # ######################################################################## # CbcOrClpParam seem to require COIN_HAS_CLP so that it knows that it is build within Clp AM_CPPFLAGS = $(CLPLIB_CFLAGS) -DCOIN_HAS_CLP $(am__append_7) \ $(am__append_8) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin # needed by Clp includecoin_HEADERS = Clp_C_Interface.h ClpCholeskyBase.hpp \ ClpCholeskyDense.hpp ClpConstraint.hpp ClpConstraintLinear.hpp \ ClpConstraintQuadratic.hpp ClpDualRowDantzig.hpp \ ClpDualRowPivot.hpp ClpDualRowSteepest.hpp ClpDummyMatrix.hpp \ ClpDynamicExampleMatrix.hpp ClpDynamicMatrix.hpp \ ClpEventHandler.hpp ClpFactorization.hpp \ ClpGubDynamicMatrix.hpp ClpGubMatrix.hpp ClpInterior.hpp \ ClpLinearObjective.hpp ClpMatrixBase.hpp ClpMessage.hpp \ ClpModel.hpp ClpNetworkMatrix.hpp ClpNonLinearCost.hpp \ ClpNode.hpp ClpObjective.hpp ClpPackedMatrix.hpp \ ClpPdcoBase.hpp ClpPlusMinusOneMatrix.hpp ClpParameters.hpp \ ClpPresolve.hpp ClpPrimalColumnDantzig.hpp \ ClpPrimalColumnPivot.hpp ClpPrimalColumnSteepest.hpp \ ClpQuadraticObjective.hpp ClpSimplex.hpp \ ClpSimplexNonlinear.hpp ClpSimplexOther.hpp ClpSimplexDual.hpp \ ClpSimplexPrimal.hpp ClpSolve.hpp CbcOrClpParam.hpp Idiot.hpp \ $(am__append_9) $(am__append_10) $(am__append_11) \ $(am__append_12) $(am__append_13) $(am__append_14) \ CbcOrClpParam.cpp all: config.h config_clp.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ config_clp.h: stamp-h2 @if test ! -f $@; then \ rm -f stamp-h2; \ $(MAKE) stamp-h2; \ else :; fi stamp-h2: $(srcdir)/config_clp.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status src/config_clp.h distclean-hdr: -rm -f config.h stamp-h1 config_clp.h stamp-h2 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libClp.la: $(libClp_la_OBJECTS) $(libClp_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libClp_la_LDFLAGS) $(libClp_la_OBJECTS) $(libClp_la_LIBADD) $(LIBS) libClpSolver.la: $(libClpSolver_la_OBJECTS) $(libClpSolver_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libClpSolver_la_LDFLAGS) $(libClpSolver_la_OBJECTS) $(libClpSolver_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done clp$(EXEEXT): $(clp_OBJECTS) $(clp_DEPENDENCIES) @rm -f clp$(EXEEXT) $(CXXLINK) $(clp_LDFLAGS) $(clp_OBJECTS) $(clp_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcDualRowDantzig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcDualRowPivot.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcDualRowSteepest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcNonLinearCost.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcPrimalColumnDantzig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcPrimalColumnPivot.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcPrimalColumnSteepest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcSimplex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcSimplexDual.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcSimplexFactorization.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcSimplexParallel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcSimplexPrimal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbcWarmStart.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcOrClpParam.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpCholeskyBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpCholeskyDense.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpCholeskyMumps.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpCholeskyUfl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpCholeskyWssmp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpCholeskyWssmpKKT.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpConstraint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpConstraintLinear.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpConstraintQuadratic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpDualRowDantzig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpDualRowPivot.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpDualRowSteepest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpDummyMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpDynamicExampleMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpDynamicMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpEventHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpFactorization.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpGubDynamicMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpGubMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpHelperFunctions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpInterior.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpLinearObjective.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpLsqr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpMain.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpMatrixBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpMessage.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpModel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpNetworkBasis.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpNetworkMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpNode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpNonLinearCost.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpObjective.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPackedMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPdco.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPdcoBase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPlusMinusOneMatrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPredictorCorrector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPresolve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPrimalColumnDantzig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPrimalColumnPivot.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpPrimalColumnSteepest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpQuadraticObjective.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpSimplex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpSimplexDual.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpSimplexNonlinear.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpSimplexOther.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpSimplexPrimal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpSolve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpSolver.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Clp_C_Interface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Clp_ampl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcBaseFactorization1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcBaseFactorization2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcBaseFactorization3.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcBaseFactorization4.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcBaseFactorization5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcDenseFactorization.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcFactorization1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcFactorization2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcFactorization3.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcFactorization4.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcFactorization5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcHelperFunctions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcOrderedFactorization1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcOrderedFactorization2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcOrderedFactorization3.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcOrderedFactorization4.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcOrderedFactorization5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcSmallFactorization1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcSmallFactorization2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcSmallFactorization3.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcSmallFactorization4.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinAbcSmallFactorization5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IdiSolve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Idiot.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MyEventHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MyMessageHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unitTest.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in config_clp.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_clp.h.in $(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; } \ END { 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) config.h.in config_clp.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in config_clp.h.in $(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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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) $(PROGRAMS) $(HEADERS) config.h \ config_clp.h install-binPROGRAMS: install-libLTLIBRARIES installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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." @COIN_CXX_IS_CL_FALSE@install-exec-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-binPROGRAMS install-exec-local \ install-libLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-info: install-info-am install-man: 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: uninstall-binPROGRAMS uninstall-includecoinHEADERS \ uninstall-info-am uninstall-libLTLIBRARIES uninstall-local .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libLTLIBRARIES clean-libtool ctags \ distclean distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-exec install-exec-am \ install-exec-hook install-exec-local \ install-includecoinHEADERS install-info install-info-am \ install-libLTLIBRARIES install-man 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 uninstall-binPROGRAMS \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-local ######################################################################## # Installing manifest (MSVC++) # ######################################################################## @COIN_CXX_IS_CL_TRUE@install-exec-hook: @COIN_CXX_IS_CL_TRUE@ test -s clp.exe.manifest && \ @COIN_CXX_IS_CL_TRUE@ mt -manifest clp.exe.manifest -outputresource:clp.exe;\ @COIN_CXX_IS_CL_TRUE@ cp clp.exe $(bindir)/clp.exe ####################################################################### # Create the Config.h file that has all public defines and install it # ####################################################################### install-exec-local: $(install_sh_DATA) config_clp.h $(DESTDIR)$(includecoindir)/ClpConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/ClpConfig.h # 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: CoinMP-1.8.3/Clp/src/AbcSimplexFactorization.cpp0000644000175000017500000010061712573000245020114 0ustar renerene/* $Id: AbcSimplexFactorization.cpp 2165 2015-09-06 09:00:21Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #define USE_DENSE_FAC -1 #define USE_SMALL_FAC 200 #define USE_LONG_FAC 10000 #include "CoinPragma.hpp" #include "AbcSimplexFactorization.hpp" #include "ClpFactorization.hpp" #include "ClpMessage.hpp" #include "CoinAbcCommon.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "AbcSimplex.hpp" #include "AbcSimplexDual.hpp" #include "AbcMatrix.hpp" #include "CoinAbcFactorization.hpp" #include "CoinFactorization.hpp" #ifdef ABC_JUST_ONE_FACTORIZATION #define CoinAbcFactorization CoinAbcBaseFactorization #define CoinAbcSmallFactorization CoinAbcBaseFactorization #define CoinAbcLongFactorization CoinAbcBaseFactorization #define CoinAbcOrderedFactorization CoinAbcBaseFactorization #endif #ifndef ABC_LONG_FACTORIZATION #undef CoinAbcLongFactorization #define CoinAbcLongFactorization CoinAbcOrderedFactorization #endif #ifdef ABC_TEMPORARY_FACTORIZATION #undef CoinAbcSmallFactorization #define CoinAbcSmallFactorization CoinAbcOrderedFactorization #endif #ifdef ABC_USE_COIN_FACTORIZATION #undef CoinAbcFactorization #undef CoinAbcSmallFactorization #undef CoinAbcLongFactorization #undef CoinAbcOrderedFactorization #define CoinAbcFactorization CoinFactorization #define CoinAbcSmallFactorization CoinFactorization #define CoinAbcLongFactorization CoinFactorization #define CoinAbcOrderedFactorization CoinFactorization #endif #ifndef ABC_USE_COIN_FACTORIZATION #undef CLP_FACTORIZATION_NEW_TIMING #else #ifndef CLP_FACTORIZATION_NEW_TIMING #define CLP_FACTORIZATION_NEW_TIMING 1 #endif #endif //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcSimplexFactorization::AbcSimplexFactorization (int /*numberRows*/) { model_=NULL; coinAbcFactorization_ = new CoinAbcFactorization(); forceB_ = 0; goDenseThreshold_ = USE_DENSE_FAC; goSmallThreshold_ = USE_SMALL_FAC; goLongThreshold_ = USE_LONG_FAC; numberSlacks_=0; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcSimplexFactorization::AbcSimplexFactorization (const AbcSimplexFactorization & rhs, int denseIfSmaller) { forceB_ = rhs.forceB_; goDenseThreshold_ = rhs.goDenseThreshold_; goSmallThreshold_ = rhs.goSmallThreshold_; goLongThreshold_ = rhs.goLongThreshold_; numberSlacks_=rhs.numberSlacks_; model_=rhs.model_; #ifndef ABC_USE_COIN_FACTORIZATION int goDense = 0; if (denseIfSmaller > 0 && denseIfSmaller <= goDenseThreshold_) { CoinAbcDenseFactorization * denseR = dynamic_cast(rhs.coinAbcFactorization_); if (!denseR) goDense = 1; } if (denseIfSmaller > 0 && !rhs.coinAbcFactorization_) { if (denseIfSmaller <= goDenseThreshold_) goDense = 1; else if (denseIfSmaller <= goSmallThreshold_) goDense = 2; else if (denseIfSmaller >= goLongThreshold_) goDense = 3; } else if (denseIfSmaller < 0) { if (-denseIfSmaller <= goDenseThreshold_) goDense = 1; else if (-denseIfSmaller <= goSmallThreshold_) goDense = 2; else if (-denseIfSmaller >= goLongThreshold_) goDense = 3; } if (rhs.coinAbcFactorization_ && (denseIfSmaller >= 0 || !goDense)) coinAbcFactorization_ = rhs.coinAbcFactorization_->clone(); else coinAbcFactorization_ = NULL; if (goDense) { delete coinAbcFactorization_; if (goDense == 1) coinAbcFactorization_ = new CoinAbcDenseFactorization(); else if (goDense == 2) coinAbcFactorization_ = new CoinAbcSmallFactorization(); else if (goDense == 3) coinAbcFactorization_ = new CoinAbcLongFactorization(); else coinAbcFactorization_ = new CoinAbcFactorization(); assert (coinAbcFactorization_); coinAbcFactorization_->maximumPivots(rhs.coinAbcFactorization_->maximumPivots()); coinAbcFactorization_->pivotTolerance(rhs.coinAbcFactorization_->pivotTolerance()); coinAbcFactorization_->zeroTolerance(rhs.coinAbcFactorization_->zeroTolerance()); } #else coinAbcFactorization_ = new CoinFactorization(*rhs.coinAbcFactorization_); #endif } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcSimplexFactorization::~AbcSimplexFactorization () { delete coinAbcFactorization_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcSimplexFactorization & AbcSimplexFactorization::operator=(const AbcSimplexFactorization& rhs) { if (this != &rhs) { forceB_ = rhs.forceB_; model_=rhs.model_; goDenseThreshold_ = rhs.goDenseThreshold_; goSmallThreshold_ = rhs.goSmallThreshold_; goLongThreshold_ = rhs.goLongThreshold_; numberSlacks_=rhs.numberSlacks_; if (rhs.coinAbcFactorization_) { delete coinAbcFactorization_; #ifndef ABC_USE_COIN_FACTORIZATION coinAbcFactorization_ = rhs.coinAbcFactorization_->clone(); #else coinAbcFactorization_ = new CoinFactorization(*rhs.coinAbcFactorization_); #endif } } return *this; } // Go over to dense code void AbcSimplexFactorization::goDenseOrSmall(int numberRows) { #ifndef ABC_USE_COIN_FACTORIZATION if (!forceB_) { delete coinAbcFactorization_; if (numberRows <= goDenseThreshold_) { coinAbcFactorization_ = new CoinAbcDenseFactorization(); } else if (numberRows <= goSmallThreshold_) { coinAbcFactorization_ = new CoinAbcSmallFactorization(); } else if (numberRows >= goLongThreshold_) { coinAbcFactorization_ = new CoinAbcLongFactorization(); } else { coinAbcFactorization_ = new CoinAbcFactorization(); } } #endif } // If nonzero force use of 1,dense 2,small 3,long void AbcSimplexFactorization::forceOtherFactorization(int which) { #ifndef ABC_USE_COIN_FACTORIZATION delete coinAbcFactorization_; forceB_ = 0; coinAbcFactorization_ = NULL; if (which > 0 && which < 6) { forceB_ = which; switch (which) { case 1: coinAbcFactorization_ = new CoinAbcDenseFactorization(); goDenseThreshold_ = COIN_INT_MAX; break; case 2: case 4: coinAbcFactorization_ = new CoinAbcSmallFactorization(); goSmallThreshold_ = COIN_INT_MAX; break; case 3: case 5: coinAbcFactorization_ = new CoinAbcLongFactorization(); goLongThreshold_ = 0; break; } } else { coinAbcFactorization_ = new CoinAbcFactorization(); } #endif } #ifdef CLP_FACTORIZATION_NEW_TIMING static bool readTwiddle=false; static double weightIncU=1.0; static double weightR=2.0; static double weightRest=1.0; static double weightFactL=30.0; static double weightFactDense=0.1; static double weightNrows=10.0; static double increaseNeeded=1.1; static double constWeightIterate = 1.0; static double weightNrowsIterate = 3.0; bool AbcSimplexFactorization::timeToRefactorize() const { bool reFactor = (coinAbcFactorization_->pivots() * 3 > coinAbcFactorization_->maximumPivots() * 2 && coinAbcFactorization_->numberElementsR() * 3 > (coinAbcFactorization_->numberElementsL() + coinAbcFactorization_->numberElementsU()) * 2 + 1000 && !coinAbcFactorization_->numberDense()); bool reFactor3=false; int numberPivots=coinAbcFactorization_->pivots(); //if (coinAbcFactorization_->pivots()<2) if (numberPivots>lastNumberPivots_) { if (!lastNumberPivots_) { //lastR=0; //lastU=endLengthU; totalInR_=0.0; totalInIncreasingU_=0.0; shortestAverage_=COIN_DBL_MAX; if (!readTwiddle) { readTwiddle=true; char * environ = getenv("CLP_TWIDDLE"); if (environ) { sscanf(environ,"%lg %lg %lg %lg %lg %lg %lg %lg %lg", &weightIncU,&weightR,&weightRest,&weightFactL, &weightFactDense,&weightNrows,&increaseNeeded, &constWeightIterate,&weightNrowsIterate); } printf("weightIncU %g, weightR %g, weightRest %g, weightFactL %g, weightFactDense %g, weightNrows %g increaseNeeded %g constWeightIterate %g weightNrowsIterate %g\n", weightIncU,weightR,weightRest,weightFactL, weightFactDense,weightNrows,increaseNeeded, constWeightIterate,weightNrowsIterate); } } lastNumberPivots_=numberPivots; int numberDense=coinAbcFactorization_->numberDense(); double nnd=numberDense*numberDense; int lengthL=coinAbcFactorization_->numberElementsL(); int lengthR=coinAbcFactorization_->numberElementsR(); int numberRows = coinAbcFactorization_->numberRows(); int lengthU=coinAbcFactorization_->numberElementsU()- (numberRows-numberDense); totalInR_ += lengthR; int effectiveU=lengthU-effectiveStartNumberU_; totalInIncreasingU_ += effectiveU; //lastR=lengthR; //lastU=lengthU; double rest=lengthL+0.05*nnd; double constWeightFactor = weightFactL*lengthL+weightFactDense*nnd + weightNrows*numberRows; double constWeightIterateX = constWeightIterate*(lengthL+endLengthU_) + weightNrowsIterate*numberRows; double variableWeight = weightIncU*totalInIncreasingU_+ weightR*totalInR_+weightRest*rest; double average=constWeightIterateX+ (constWeightFactor+variableWeight)/static_cast(numberPivots); #if 0 if ((numberPivots%20)==0&&!ifPrint3) printf("PIV %d nrow %d startU %d now %d L %d R %d dense %g average %g\n", numberPivots,numberRows,effectiveStartNumberU_, lengthU,lengthL,lengthR,nnd,average); #endif shortestAverage_=CoinMin(shortestAverage_,average); if (average>increaseNeeded*shortestAverage_&& coinAbcFactorization_->pivots()>30) { //printf("PIVX %d nrow %d startU %d now %d L %d R %d dense %g average %g\n", // numberPivots,numberRows,effectiveStartNumberU_, // lengthU,lengthL,lengthR,nnd,average); reFactor3=true; } } if (reFactor|| reFactor3) { reFactor=true; } return reFactor; } #if CLP_FACTORIZATION_NEW_TIMING>1 void AbcSimplexFactorization::statsRefactor(char when) const { int numberPivots=coinAbcFactorization_->pivots(); int numberDense=coinAbcFactorization_->numberDense(); double nnd=numberDense*numberDense; int lengthL=coinAbcFactorization_->numberElementsL(); int lengthR=coinAbcFactorization_->numberElementsR(); int numberRows = coinAbcFactorization_->numberRows(); int lengthU=coinAbcFactorization_->numberElementsU()- (numberRows-numberDense); double rest=lengthL+0.05*nnd; double constWeightFactor = weightFactL*lengthL+weightFactDense*nnd + weightNrows*numberRows; double constWeightIterateX = constWeightIterate*(lengthL+endLengthU_) + weightNrowsIterate*numberRows; double variableWeight = weightIncU*totalInIncreasingU_+ weightR*totalInR_+weightRest*rest; double average=constWeightIterateX+ (constWeightFactor+variableWeight)/static_cast(numberPivots); printf("APIV%c %d nrow %d startU %d now %d L %d R %d dense %g average %g - shortest %g\n", when,numberPivots,numberRows,effectiveStartNumberU_, lengthU,lengthL,lengthR,nnd,average,shortestAverage_); } #endif #else bool AbcSimplexFactorization::timeToRefactorize() const { return coinAbcFactorization_->pivots() > coinAbcFactorization_->numberRows() / 2.45 + 20; } #endif /* returns empty fake vector carved out of existing later - maybe use associated arrays */ static CoinIndexedVector * fakeVector(CoinIndexedVector * vector, int fakeCapacity) { int oldCapacity=vector->capacity(); CoinIndexedVector * newVector = new CoinIndexedVector(); newVector->setCapacity(fakeCapacity); newVector->setDenseVector(vector->denseVector()+oldCapacity); newVector->setIndexVector(vector->getIndices()+ oldCapacity+((oldCapacity+3)>>2)); vector->checkClean(); newVector->checkClear(); return newVector; } static void deleteFakeVector(CoinIndexedVector * vector, CoinIndexedVector * fakeVector) { int * index = vector->getIndices(); fakeVector->checkClear(); fakeVector->setCapacity(0); fakeVector->setDenseVector(NULL); fakeVector->setIndexVector(NULL); delete fakeVector; vector->checkClean(); } // Synchronize stuff void AbcSimplexFactorization::synchronize(const ClpFactorization * otherFactorization,const AbcSimplex * model) { goDenseThreshold_=otherFactorization->goDenseThreshold(); goSmallThreshold_=otherFactorization->goSmallThreshold(); goLongThreshold_=otherFactorization->goOslThreshold(); //forceOtherFactorization(otherFactorization->typeOfFactorization()); goDenseOrSmall(model->numberRows()); maximumPivots(static_cast(otherFactorization->maximumPivots()*1.2)); #ifdef ABC_USE_COIN_FACTORIZATION // redo region sizes int maximumRows=model->numberRows()+maximumPivots()+1; int currentCapacity = model->usefulArray(0)->capacity(); int newCapacity = currentCapacity+maximumRows+3; for (int i=0;iusefulArray(i); vector->reserve(newCapacity); // zero CoinZeroN(vector->getIndices(),newCapacity); // but pretend old //vector->setCapacity(currentCapacity); #if 0 //ndef NDEBUG vector->checkClear(); CoinIndexedVector * newVector = fakeVector(vector,maximumRows); deleteFakeVector(vector,newVector); #endif } #endif } #ifdef CLP_FACTORIZATION_INSTRUMENT extern double externalTimeStart; extern double timeInFactorize; extern double timeInUpdate; extern double timeInUpdateTranspose; extern double timeInUpdateFT; extern double timeInUpdateTwoFT; extern double timeInReplace; extern int numberUpdate; extern int numberUpdateTranspose; extern int numberUpdateFT; extern int numberUpdateTwoFT; extern int numberReplace; extern int currentLengthR; extern int currentLengthU; extern int currentTakeoutU; #endif int AbcSimplexFactorization::factorize ( AbcSimplex * model, int solveType, bool valuesPass) { #ifdef CLP_FACTORIZATION_INSTRUMENT externalTimeStart=CoinCpuTime(); #endif model_= model; AbcMatrix * matrix = model->abcMatrix(); int numberRows = model->numberRows(); if (!numberRows) return 0; bool anyChanged = false; coinAbcFactorization_->setStatus(-99); #ifndef ABC_USE_COIN_FACTORIZATION const #endif int * COIN_RESTRICT pivotVariable = model->pivotVariable(); //returns 0 -okay, -1 singular, -2 too many in basis */ // allow dense int solveMode = coinAbcFactorization_->solveMode()&1; if (model->numberIterations()>model->baseIteration()) solveMode |= 9; // was +8 - this allows dense else solveMode = 1; // try dense if (valuesPass) solveMode += 4; coinAbcFactorization_->setSolveMode(solveMode); while (status() < -98) { int i; int numberBasic = 0; // Move pivot variables across if they look good int * COIN_RESTRICT pivotTemp = model->usefulArray(0)->getIndices(); #ifndef NDEBUG model_->checkArrays(); #endif assert (!model->usefulArray(0)->getNumElements()); // Seems to prefer things in order so quickest // way is to go though like this for (i = 0; i < numberRows; i++) { if (pivotVariable[i]=numberRows) pivotTemp[numberBasic++] = pivotVariable[i]; } CoinBigIndex numberElements = numberSlacks_; // compute how much in basis int numberColumnBasic = numberBasic - numberSlacks_; numberElements += matrix->countBasis(pivotTemp + numberSlacks_, numberColumnBasic); //printf("Basis has %d slacks - size %d\n",numberSlacks_,numberElements); // Not needed for dense numberElements = 3 * numberBasic + 3 * numberElements + 20000; #ifndef ABC_USE_COIN_FACTORIZATION int numberIterations = model->numberIterations(); coinAbcFactorization_->setUsefulInformation(&numberIterations, 0); #else coinAbcFactorization_->gutsOfDestructor(); coinAbcFactorization_->gutsOfInitialize(2); #endif coinAbcFactorization_->getAreas ( numberRows, numberSlacks_ + numberColumnBasic, numberElements, 2 * numberElements ); #if 0 if (!model->numberIterations()) printf("do I need destructor etc in getAreas?\n"); #endif // Fill in counts so we can skip part of preProcess // This is NOT needed for dense but would be needed for later versions CoinFactorizationDouble * COIN_RESTRICT elementU; int * COIN_RESTRICT indexRowU; CoinBigIndex * COIN_RESTRICT startColumnU; int * COIN_RESTRICT numberInRow; int * COIN_RESTRICT numberInColumn; #define slackValue 1.0 #ifndef ABC_USE_COIN_FACTORIZATION elementU = coinAbcFactorization_->elements(); indexRowU = coinAbcFactorization_->indices(); startColumnU = coinAbcFactorization_->starts(); numberInRow = coinAbcFactorization_->numberInRow(); numberInColumn = coinAbcFactorization_->numberInColumn(); coinAbcFactorization_->setNumberSlacks(numberSlacks_); CoinZeroN ( numberInRow, numberRows ); CoinZeroN ( numberInColumn, numberRows ); #else elementU = coinAbcFactorization_->elementU(); indexRowU = coinAbcFactorization_->indexRowU(); startColumnU = coinAbcFactorization_->startColumnU(); numberInRow = coinAbcFactorization_->numberInRow(); numberInColumn = coinAbcFactorization_->numberInColumn(); CoinZeroN ( numberInRow, coinAbcFactorization_->numberRows() + 1 ); CoinZeroN ( numberInColumn, coinAbcFactorization_->maximumColumnsExtra() + 1 ); #endif for (i = 0; i < numberSlacks_; i++) { int iRow = pivotTemp[i]; indexRowU[i] = iRow; startColumnU[i] = i; elementU[i] = slackValue; numberInRow[iRow] = 1; numberInColumn[i] = 1; } startColumnU[numberSlacks_] = numberSlacks_; // can change for gub so redo numberColumnBasic = numberRows - numberSlacks_; matrix->fillBasis(pivotTemp + numberSlacks_, numberColumnBasic, indexRowU, startColumnU + numberSlacks_, numberInRow, numberInColumn + numberSlacks_, elementU); numberElements = startColumnU[numberRows-1] + numberInColumn[numberRows-1]; #ifndef ABC_USE_COIN_FACTORIZATION coinAbcFactorization_->preProcess ( ); coinAbcFactorization_->factor (model); #else // recompute number basic numberBasic = numberSlacks_ + numberColumnBasic; if (numberBasic) numberElements = startColumnU[numberBasic-1] + numberInColumn[numberBasic-1]; else numberElements = 0; coinAbcFactorization_->setNumberElementsU(numberElements); #ifdef CLP_FACTORIZATION_NEW_TIMING lastNumberPivots_=0; effectiveStartNumberU_=numberElements-numberRows; //printf("%d slacks,%d in U at beginning\n", //numberRowBasic,numberElements); #endif //saveFactorization("dump.d"); if (coinAbcFactorization_->biasLU() >= 3 || coinAbcFactorization_->numberRows() != coinAbcFactorization_->numberColumns()) coinAbcFactorization_->preProcess ( 2 ); else coinAbcFactorization_->preProcess ( 3 ); // no row copy coinAbcFactorization_->factor ( ); #endif #if 0 if (model_->numberIterations()==23) { CoinAbcFactorization * factor = dynamic_cast(coinAbcFactorization_); if (factor) factor->show_self(); } #endif if (coinAbcFactorization_->status() == -1 && (coinAbcFactorization_->solveMode() & 1) != 0) { int solveMode = coinAbcFactorization_->solveMode(); solveMode --; // so bottom will be 0 coinAbcFactorization_->setSolveMode(solveMode); coinAbcFactorization_->setStatus(-99); } else if (coinAbcFactorization_->status() == -99) { // get more memory coinAbcFactorization_->areaFactor( coinAbcFactorization_->areaFactor() * 2.0); } if (coinAbcFactorization_->status() == -99) continue; // If we get here status is 0 or -1 if (coinAbcFactorization_->status() == 0 && numberBasic == numberRows) { #ifndef ABC_USE_COIN_FACTORIZATION coinAbcFactorization_->postProcess(pivotTemp, model->pivotVariable()); #else const int * permuteBack = coinAbcFactorization_->permuteBack(); const int * back = coinAbcFactorization_->pivotColumnBack(); // Redo pivot order for (i = 0; i < numberRows; i++) { int k = pivotTemp[i]; // so rowIsBasic[k] would be permuteBack[back[i]] int j = permuteBack[back[i]]; //assert (pivotVariable[j] == -1); pivotVariable[j] = k; } // Set up permutation vector // these arrays start off as copies of permute // (and we could use permute_ instead of pivotColumn (not back though)) ClpDisjointCopyN ( coinAbcFactorization_->permute(), numberRows , coinAbcFactorization_->pivotColumn() ); ClpDisjointCopyN ( coinAbcFactorization_->permuteBack(), numberRows , coinAbcFactorization_->pivotColumnBack() ); // See if worth going sparse and when coinAbcFactorization_->checkSparse(); #ifdef CLP_FACTORIZATION_NEW_TIMING endLengthU_ = coinAbcFactorization_->numberElements() - coinAbcFactorization_->numberDense()*coinAbcFactorization_->numberDense() -coinAbcFactorization_->numberElementsL(); #endif #endif model_->moveToBasic(); } else if (solveType == 0 || solveType == 2/*||solveType==1*/) { // Change pivotTemp to be correct list anyChanged = true; coinAbcFactorization_->makeNonSingular(pivotTemp); const double * COIN_RESTRICT lowerArray = model->lowerRegion(); const double * COIN_RESTRICT upperArray = model->upperRegion(); double * COIN_RESTRICT solution = model->solutionRegion(); //int * pivotVariable=model_->pivotVariable(); //int * fromExternal=model_->fromExternal(); int numberTotal=model_->numberTotal(); //can use external status_ unsigned char * COIN_RESTRICT statusArray = model_->statusArray(); CoinAbcMemset0(statusArray,numberTotal); for (int iRow=0;iRowlargeValue(); for (int iRow=0;iRow -largeValue || upper < largeValue) { if (lower!=upper) { if (fabs(value - lower) < fabs(value - upper)) { thisStatus=AbcSimplex::atLowerBound; solution[iPivot] = lower; } else { thisStatus= AbcSimplex::atUpperBound; solution[iPivot] = upper; } } else { thisStatus= AbcSimplex::isFixed; } } else { thisStatus=AbcSimplex::isFree; } } else { thisStatus=AbcSimplex::superBasic; } model_->setInternalStatus(iPivot,thisStatus); model_->setInternalStatus(jPivot,AbcSimplex::basic); // swap (solution will be wrong - but that doesn't matter as basic) model_->swap(iRow,jPivot); } } CoinAbcMemcpy(model_->pivotVariable(),pivotTemp,numberRows); #ifndef NDEBUG model_->checkConsistentPivots(); #endif // signal repeat coinAbcFactorization_->pivotTolerance(0.999); coinAbcFactorization_->setStatus(-99); } } //coinAbcFactorization_->setSolveMode(solveMode|1); if ( anyChanged && model->algorithm() < 0 && solveType > 0) { double dummyCost; static_cast (model)->changeBounds(3,dummyCost); } return coinAbcFactorization_->status(); } #if 0 /* Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots Fills in region for use later partial update already in U */ int AbcSimplexFactorization::checkReplace ( const AbcSimplex * model, CoinIndexedVector * regionSparse, int pivotRow, double &pivotCheck, double acceptablePivot) { if (pivots()==maximumPivots()) return 5; else return coinAbcFactorization_->checkReplace(model,regionSparse,pivotRow,pivotCheck,acceptablePivot); } /* Replaces one Column in basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If skipBtranU is false will do btran part partial update already in U */ int AbcSimplexFactorization::replaceColumn ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, double pivotCheck , bool skipBtranU, double acceptablePivot) { bool tab = coinAbcFactorization_->wantsTableauColumn(); int tempInfo[1]; tempInfo[0] = model->numberIterations(); coinAbcFactorization_->setUsefulInformation(tempInfo, 1); #ifdef CLP_FACTORIZATION_NEW_TIMING int nOld=0; int nNew=0; int seq; const CoinPackedMatrix * matrix=model->matrix(); const int * columnLength = matrix->getVectorLengths(); seq=model->sequenceIn(); if (seq>=0&&seqnumberColumns()+model->numberRows()) { if (seqnumberRows()) nNew=1; else nNew=columnLength[seq-model->numberRows()]; } seq=model->sequenceOut(); if (seq>=0&&seqnumberColumns()+model->numberRows()) { if (seqnumberRows()) nOld=1; else nOld=columnLength[seq-model->numberRows()]; } effectiveStartNumberU_ += nNew-nOld; #endif int returnCode = coinAbcFactorization_->replaceColumn(tab ? tableauColumn : regionSparse, pivotRow, pivotCheck, skipBtranU, acceptablePivot); return returnCode; } #endif /* Replaces one Column to basis, partial update already in U */ void AbcSimplexFactorization::replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ) { #ifndef ABC_USE_COIN_FACTORIZATION bool tab = coinAbcFactorization_->wantsTableauColumn(); int tempInfo[1]; tempInfo[0] = model->numberIterations(); coinAbcFactorization_->setUsefulInformation(tempInfo, 1); if (tab) coinAbcFactorization_->replaceColumnPart3(model,NULL,tableauColumn, pivotRow, tableauColumn->denseVector()[pivotRow]); else coinAbcFactorization_->replaceColumnPart3(model,regionSparse,NULL, pivotRow, alpha); #else #ifdef CLP_FACTORIZATION_NEW_TIMING int nOld=0; int nNew=0; int seq; const CoinPackedMatrix * matrix=model->matrix(); const int * columnLength = matrix->getVectorLengths(); seq=model->sequenceIn(); if (seq>=0&&seqnumberColumns()+model->numberRows()) { if (seqnumberRows()) nNew=1; else nNew=columnLength[seq-model->numberRows()]; } seq=model->sequenceOut(); if (seq>=0&&seqnumberColumns()+model->numberRows()) { if (seqnumberRows()) nOld=1; else nOld=columnLength[seq-model->numberRows()]; } effectiveStartNumberU_ += nNew-nOld; #endif coinAbcFactorization_->replaceColumnPart3(regionSparse, pivotRow, alpha); #endif } /* Replaces one Column to basis, partial update in vector */ void AbcSimplexFactorization::replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, CoinIndexedVector * partialUpdate, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ) { #ifndef ABC_USE_COIN_FACTORIZATION bool tab = coinAbcFactorization_->wantsTableauColumn(); int tempInfo[1]; tempInfo[0] = model->numberIterations(); coinAbcFactorization_->setUsefulInformation(tempInfo, 1); if (tab) coinAbcFactorization_->replaceColumnPart3(model,NULL,tableauColumn, pivotRow, tableauColumn->denseVector()[pivotRow]); else coinAbcFactorization_->replaceColumnPart3(model,regionSparse,NULL,partialUpdate, pivotRow, alpha); #else coinAbcFactorization_->replaceColumnPart3(regionSparse,partialUpdate, pivotRow, alpha); #endif } #if 0 /* Updates one column (FTRAN) from region2 number returned is negative if no room region1 starts as zero and is zero at end */ int AbcSimplexFactorization::updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) { if (!numberRows()) return 0; int returnCode; returnCode = coinAbcFactorization_->updateColumnFT(regionSparse, regionSparse2); return returnCode; } /* Updates one column (FTRAN) from region2 number returned is negative if no room region1 starts as zero and is zero at end */ int AbcSimplexFactorization::updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { if (!numberRows()) return 0; int returnCode; returnCode = coinAbcFactorization_->updateColumn(regionSparse, regionSparse2,true); return returnCode; } /* Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room. Also updates region3 region1 starts as zero and is zero at end */ int AbcSimplexFactorization::updateTwoColumnsFT ( CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3) { if (!numberRows()) return 0; int returnCode = 0; returnCode = coinAbcFactorization_->updateTwoColumnsFT( regionSparse1, regionSparse2, regionSparse3, true); return returnCode; } /* Updates one column (BTRAN) from region2 region1 starts as zero and is zero at end */ int AbcSimplexFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { if (!numberRows()) return 0; int returnCode; returnCode = coinAbcFactorization_->updateColumnTranspose(regionSparse, regionSparse2); return returnCode; } /* Updates one column for dual steepest edge weights (FTRAN) */ void AbcSimplexFactorization::updateWeights ( CoinIndexedVector & regionSparse) const { // NOTE either switch off sparse or pass in a sparseArray_ so can go parallel // may be best to use inner product approach static double fraction[2]={0.0,0.0}; static int times=0; times++; fraction[0] += static_cast(regionSparse.getNumElements())/ (static_cast(model_->numberRows())+1.0); updateColumn(regionSparse); fraction[1] += static_cast(regionSparse.getNumElements())/ (static_cast(model_->numberRows())+1.0); if ((times%1000)==0) printf("Average density %g before then %g\n", (100.0*fraction[0])/static_cast(times), (100.0*fraction[1])/static_cast(times)); } #endif /* makes a row copy of L for speed and to allow very sparse problems */ void AbcSimplexFactorization::goSparse() { #ifdef ABC_USE_COIN_FACTORIZATION // sparse methods coinAbcFactorization_->sparseThreshold(0); coinAbcFactorization_->goSparse(); #else abort(); coinAbcFactorization_->goSparse(); #endif } // Set tolerances to safer of existing and given void AbcSimplexFactorization::saferTolerances ( double zeroValue, double pivotValue) { double newValue1; // better to have small tolerance even if slower if (zeroValue > 0.0) newValue1 = zeroValue; else newValue1 = -zeroTolerance() * zeroValue; newValue1 = CoinMin(zeroTolerance(),newValue1); if (newValue1>1.0e-15) zeroTolerance(newValue1); double newValue2; // better to have large tolerance even if slower if (pivotValue > 0.0) newValue2 = pivotValue; else newValue2 = -pivotTolerance() * pivotValue; newValue2 =CoinMin(CoinMax(pivotTolerance(), newValue2), 0.999); if (newValue2>pivotTolerance()) { pivotTolerance(newValue2); char line[100]; sprintf(line,"new zero tolerance %g new pivot tolerance %g", zeroTolerance(),pivotTolerance()); model_->messageHandler()->message(CLP_GENERAL2,*model_->messagesPointer()) << line << CoinMessageEol; } } // Sets factorization void AbcSimplexFactorization::setFactorization(AbcSimplexFactorization & rhs) { AbcSimplexFactorization::operator=(rhs); } CoinMP-1.8.3/Clp/src/CoinAbcFactorization2.cpp0000644000175000017500000000101712101105055017427 0ustar renerene/* $Id: CoinAbcFactorization2.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcFactorization #define ABC_SMALL -2 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization2.cpp" #endif CoinMP-1.8.3/Clp/src/ClpCholeskyUfl.cpp0000644000175000017500000004022211552601036016213 0ustar renerene/* $Id: ClpCholeskyUfl.cpp 1723 2011-04-17 15:07:10Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpConfig.h" extern "C" { #ifndef COIN_HAS_CHOLMOD #ifndef COIN_HAS_AMD #error "Need to have AMD or CHOLMOD to compile ClpCholeskyUfl." #else #include "amd.h" #endif #else #include "cholmod.h" #endif } #include "CoinPragma.hpp" #include "ClpCholeskyUfl.hpp" #include "ClpMessage.hpp" #include "ClpInterior.hpp" #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpCholeskyUfl::ClpCholeskyUfl (int denseThreshold) : ClpCholeskyBase(denseThreshold) { type_ = 14; L_ = NULL; c_ = NULL; #ifdef COIN_HAS_CHOLMOD c_ = (cholmod_common*) malloc(sizeof(cholmod_common)); cholmod_start (c_) ; // Can't use supernodal as may not be positive definite c_->supernodal = 0; #endif } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpCholeskyUfl::ClpCholeskyUfl (const ClpCholeskyUfl & rhs) : ClpCholeskyBase(rhs) { abort(); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpCholeskyUfl::~ClpCholeskyUfl () { #ifdef COIN_HAS_CHOLMOD cholmod_free_factor (&L_, c_) ; cholmod_finish (c_) ; free(c_); #endif } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpCholeskyUfl & ClpCholeskyUfl::operator=(const ClpCholeskyUfl& rhs) { if (this != &rhs) { ClpCholeskyBase::operator=(rhs); abort(); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpCholeskyBase * ClpCholeskyUfl::clone() const { return new ClpCholeskyUfl(*this); } #ifndef COIN_HAS_CHOLMOD /* Orders rows and saves pointer to matrix.and model */ int ClpCholeskyUfl::order(ClpInterior * model) { int iRow; model_ = model; if (preOrder(false, true, doKKT_)) return -1; permuteInverse_ = new int [numberRows_]; permute_ = new int[numberRows_]; double Control[AMD_CONTROL]; double Info[AMD_INFO]; amd_defaults(Control); //amd_control(Control); int returnCode = amd_order(numberRows_, choleskyStart_, choleskyRow_, permute_, Control, Info); delete [] choleskyRow_; choleskyRow_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; //amd_info(Info); if (returnCode != AMD_OK) { std::cout << "AMD ordering failed" << std::endl; return 1; } for (iRow = 0; iRow < numberRows_; iRow++) { permuteInverse_[permute_[iRow]] = iRow; } return 0; } #else /* Orders rows and saves pointer to matrix.and model */ int ClpCholeskyUfl::order(ClpInterior * model) { numberRows_ = model->numberRows(); if (doKKT_) { numberRows_ += numberRows_ + model->numberColumns(); printf("finish coding UFL KKT!\n"); abort(); } rowsDropped_ = new char [numberRows_]; memset(rowsDropped_, 0, numberRows_); numberRowsDropped_ = 0; model_ = model; rowCopy_ = model->clpMatrix()->reverseOrderedCopy(); // Space for starts choleskyStart_ = new CoinBigIndex[numberRows_+1]; const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); // We need two arrays for counts int * which = new int [numberRows_]; int * used = new int[numberRows_+1]; CoinZeroN(used, numberRows_); int iRow; sizeFactor_ = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; } } delete [] which; // Now we have size - create arrays and fill in try { choleskyRow_ = new int [sizeFactor_]; } catch (...) { // no memory delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } try { sparseFactor_ = new double[sizeFactor_]; } catch (...) { // no memory delete [] choleskyRow_; choleskyRow_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } sizeFactor_ = 0; which = choleskyRow_; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; choleskyStart_[iRow] = sizeFactor_; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; // Sort std::sort(which, which + number); // move which on which += number; } } choleskyStart_[numberRows_] = sizeFactor_; delete [] used; permuteInverse_ = new int [numberRows_]; permute_ = new int[numberRows_]; cholmod_sparse A ; A.nrow = numberRows_; A.ncol = numberRows_; A.nzmax = choleskyStart_[numberRows_]; A.p = choleskyStart_; A.i = choleskyRow_; A.x = NULL; A.stype = -1; A.itype = CHOLMOD_INT; A.xtype = CHOLMOD_PATTERN; A.dtype = CHOLMOD_DOUBLE; A.sorted = 1; A.packed = 1; c_->nmethods = 9; c_->postorder = true; //c_->dbound=1.0e-20; L_ = cholmod_analyze (&A, c_) ; if (c_->status) { COIN_DETAIL_PRINT(std::cout << "CHOLMOD ordering failed" << std::endl); return 1; } else { COIN_DETAIL_PRINT(printf("%g nonzeros, flop count %g\n", c_->lnz, c_->fl)); } for (iRow = 0; iRow < numberRows_; iRow++) { permuteInverse_[iRow] = iRow; permute_[iRow] = iRow; } return 0; } #endif /* Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ int ClpCholeskyUfl::symbolic() { #ifdef COIN_HAS_CHOLMOD return 0; #else return ClpCholeskyBase::symbolic(); #endif } #ifdef COIN_HAS_CHOLMOD /* Factorize - filling in rowsDropped and returning number dropped */ int ClpCholeskyUfl::factorize(const double * diagonal, int * rowsDropped) { const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const double * element = model_->clpMatrix()->getElements(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); const double * elementByRow = rowCopy_->getElements(); int numberColumns = model_->clpMatrix()->getNumCols(); int iRow; double * work = new double[numberRows_]; CoinZeroN(work, numberRows_); const double * diagonalSlack = diagonal + numberColumns; int newDropped = 0; double largest; //double smallest; //perturbation double perturbation = model_->diagonalPerturbation() * model_->diagonalNorm(); perturbation = 0.0; perturbation = perturbation * perturbation; if (perturbation > 1.0) { #ifdef COIN_DEVELOP //if (model_->model()->logLevel()&4) std::cout << "large perturbation " << perturbation << std::endl; #endif perturbation = sqrt(perturbation);; perturbation = 1.0; } double delta2 = model_->delta(); // add delta*delta to diagonal delta2 *= delta2; for (iRow = 0; iRow < numberRows_; iRow++) { double * put = sparseFactor_ + choleskyStart_[iRow]; int * which = choleskyRow_ + choleskyStart_[iRow]; int number = choleskyStart_[iRow+1] - choleskyStart_[iRow]; if (!rowLength[iRow]) rowsDropped_[iRow] = 1; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; work[iRow] = diagonalSlack[iRow] + delta2; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; double multiplier = diagonal[iColumn] * elementByRow[k]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { double value = element[j] * multiplier; work[jRow] += value; } } } } int j; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; work[jRow] = 0.0; } } else { // dropped int j; for (j = 1; j < number; j++) { put[j] = 0.0; } put[0] = 1.0; } } //check sizes double largest2 = maximumAbsElement(sparseFactor_, sizeFactor_); largest2 *= 1.0e-20; largest = CoinMin(largest2, 1.0e-11); int numberDroppedBefore = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int dropped = rowsDropped_[iRow]; // Move to int array rowsDropped[iRow] = dropped; if (!dropped) { CoinBigIndex start = choleskyStart_[iRow]; double diagonal = sparseFactor_[start]; if (diagonal > largest2) { sparseFactor_[start] = CoinMax(diagonal, 1.0e-10); } else { sparseFactor_[start] = CoinMax(diagonal, 1.0e-10); rowsDropped[iRow] = 2; numberDroppedBefore++; } } } delete [] work; cholmod_sparse A ; A.nrow = numberRows_; A.ncol = numberRows_; A.nzmax = choleskyStart_[numberRows_]; A.p = choleskyStart_; A.i = choleskyRow_; A.x = sparseFactor_; A.stype = -1; A.itype = CHOLMOD_INT; A.xtype = CHOLMOD_REAL; A.dtype = CHOLMOD_DOUBLE; A.sorted = 1; A.packed = 1; cholmod_factorize (&A, L_, c_) ; /* factorize */ choleskyCondition_ = 1.0; bool cleanCholesky; if (model_->numberIterations() < 2000) cleanCholesky = true; else cleanCholesky = false; if (cleanCholesky) { //drop fresh makes some formADAT easier //int oldDropped=numberRowsDropped_; if (newDropped || numberRowsDropped_) { //std::cout <<"Rank "<oldDropped) //std::cout<<" ( "<x); x = cholmod_solve (CHOLMOD_A, L_, b, c_) ; CoinMemcpyN((double *) x->x, numberRows_, region); cholmod_free_dense (&x, c_) ; cholmod_free_dense (&b, c_) ; } #else void ClpCholeskyUfl::solve (double * region) { ClpCholeskyBase::solve(region); } #endif CoinMP-1.8.3/Clp/src/ClpLsqr.hpp0000644000175000017500000001131111510657452014715 0ustar renerene/* $Id: ClpLsqr.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpLsqr_H_ #define ClpLsqr_H_ #include "CoinDenseVector.hpp" #include "ClpInterior.hpp" /** This class implements LSQR @verbatim LSQR solves Ax = b or min ||b - Ax||_2 if damp = 0, or min || (b) - ( A )x || otherwise. || (0) (damp I) ||2 A is an m by n matrix defined by user provided routines matVecMult(mode, y, x) which performs the matrix-vector operations where y and x are references or pointers to CoinDenseVector objects. If mode = 1, matVecMult must return y = Ax without altering x. If mode = 2, matVecMult must return y = A'x without altering x. ----------------------------------------------------------------------- LSQR uses an iterative (conjugate-gradient-like) method. For further information, see 1. C. C. Paige and M. A. Saunders (1982a). LSQR: An algorithm for sparse linear equations and sparse least squares, ACM TOMS 8(1), 43-71. 2. C. C. Paige and M. A. Saunders (1982b). Algorithm 583. LSQR: Sparse linear equations and least squares problems, ACM TOMS 8(2), 195-209. 3. M. A. Saunders (1995). Solution of sparse rectangular systems using LSQR and CRAIG, BIT 35, 588-604. Input parameters: atol, btol are stopping tolerances. If both are 1.0e-9 (say), the final residual norm should be accurate to about 9 digits. (The final x will usually have fewer correct digits, depending on cond(A) and the size of damp.) conlim is also a stopping tolerance. lsqr terminates if an estimate of cond(A) exceeds conlim. For compatible systems Ax = b, conlim could be as large as 1.0e+12 (say). For least-squares problems, conlim should be less than 1.0e+8. Maximum precision can be obtained by setting atol = btol = conlim = zero, but the number of iterations may then be excessive. itnlim is an explicit limit on iterations (for safety). show = 1 gives an iteration log, show = 0 suppresses output. info is a structure special to pdco.m, used to test if was small enough, and continuing if necessary with smaller atol. Output parameters: x is the final solution. *istop gives the reason for termination. *istop = 1 means x is an approximate solution to Ax = b. = 2 means x approximately solves the least-squares problem. rnorm = norm(r) if damp = 0, where r = b - Ax, = sqrt( norm(r)**2 + damp**2 * norm(x)**2 ) otherwise. xnorm = norm(x). var estimates diag( inv(A'A) ). Omitted in this special version. outfo is a structure special to pdco.m, returning information about whether atol had to be reduced. Other potential output parameters: anorm, acond, arnorm, xnorm @endverbatim */ class ClpLsqr { private: /**@name Private member data */ //@{ //@} public: /**@name Public member data */ //@{ /// Row dimension of matrix int nrows_; /// Column dimension of matrix int ncols_; /// Pointer to Model object for this instance ClpInterior *model_; /// Diagonal array 1 double *diag1_; /// Constant diagonal 2 double diag2_; //@} /**@name Constructors and destructors */ /** Default constructor */ ClpLsqr(); /** Constructor for use with Pdco model (note modified for pdco!!!!) */ ClpLsqr(ClpInterior *model); /// Copy constructor ClpLsqr(const ClpLsqr &); /// Assignment operator. This copies the data ClpLsqr & operator=(const ClpLsqr & rhs); /** Destructor */ ~ClpLsqr(); //@} /**@name Methods */ //@{ /// Set an int parameter bool setParam(char *parmName, int parmValue); /// Call the Lsqr algorithm void do_lsqr( CoinDenseVector &b, double damp, double atol, double btol, double conlim, int itnlim, bool show, Info info, CoinDenseVector &x , int *istop, int *itn, Outfo *outfo, bool precon, CoinDenseVector &Pr ); /// Matrix-vector multiply - implemented by user void matVecMult( int, CoinDenseVector *, CoinDenseVector *); void matVecMult( int, CoinDenseVector &, CoinDenseVector &); /// diag1 - we just borrow as it is part of a CoinDenseVector void borrowDiag1(double * array) { diag1_ = array; }; //@} }; #endif CoinMP-1.8.3/Clp/src/AbcDualRowDantzig.hpp0000644000175000017500000000523312101105055016627 0ustar renerene/* $Id: AbcDualRowDantzig.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef AbcDualRowDantzig_H #define AbcDualRowDantzig_H #include "AbcDualRowPivot.hpp" //############################################################################# /** Dual Row Pivot Dantzig Algorithm Class This is simplest choice - choose largest infeasibility */ class AbcDualRowDantzig : public AbcDualRowPivot { public: ///@name Algorithmic methods //@{ /// Returns pivot row, -1 if none virtual int pivotRow(); /** Updates weights and returns pivot alpha. Also does FT update */ virtual double updateWeights(CoinIndexedVector & input,CoinIndexedVector & updatedColumn); virtual double updateWeights1(CoinIndexedVector & input,CoinIndexedVector & updateColumn); virtual void updateWeightsOnly(CoinIndexedVector & /*input*/) {}; /// Actually updates weights virtual void updateWeights2(CoinIndexedVector & input,CoinIndexedVector & /*updateColumn*/) {input.clear();}; /** Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Computes change in objective function */ virtual void updatePrimalSolution(CoinIndexedVector & input, double theta); /** Saves any weights round factorization as pivot rows may change Will be empty unless steepest edge (will save model) May also recompute infeasibility stuff 1) before factorization 2) after good factorization (if weights empty may initialize) 3) after something happened but no factorization (e.g. check for infeasible) 4) as 2 but restore weights from previous snapshot 5) for strong branching - initialize , infeasibilities */ virtual void saveWeights(AbcSimplex * model, int mode); /// Recompute infeasibilities virtual void recomputeInfeasibilities(); //@} ///@name Constructors and destructors //@{ /// Default Constructor AbcDualRowDantzig(); /// Copy constructor AbcDualRowDantzig(const AbcDualRowDantzig &); /// Assignment operator AbcDualRowDantzig & operator=(const AbcDualRowDantzig& rhs); /// Destructor virtual ~AbcDualRowDantzig (); /// Clone virtual AbcDualRowPivot * clone(bool copyData = true) const; //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// infeasibility array (just for infeasible rows) CoinIndexedVector * infeasible_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpQuadraticObjective.cpp0000644000175000017500000013540211552601036017540 0ustar renerene/* $Id: ClpQuadraticObjective.cpp 1723 2011-04-17 15:07:10Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "ClpFactorization.hpp" #include "ClpSimplex.hpp" #include "ClpQuadraticObjective.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpQuadraticObjective::ClpQuadraticObjective () : ClpObjective() { type_ = 2; objective_ = NULL; quadraticObjective_ = NULL; gradient_ = NULL; numberColumns_ = 0; numberExtendedColumns_ = 0; activated_ = 0; fullMatrix_ = false; } //------------------------------------------------------------------- // Useful Constructor //------------------------------------------------------------------- ClpQuadraticObjective::ClpQuadraticObjective (const double * objective , int numberColumns, const CoinBigIndex * start, const int * column, const double * element, int numberExtendedColumns) : ClpObjective() { type_ = 2; numberColumns_ = numberColumns; if (numberExtendedColumns >= 0) numberExtendedColumns_ = CoinMax(numberColumns_, numberExtendedColumns); else numberExtendedColumns_ = numberColumns_; if (objective) { objective_ = new double [numberExtendedColumns_]; CoinMemcpyN(objective, numberColumns_, objective_); memset(objective_ + numberColumns_, 0, (numberExtendedColumns_ - numberColumns_)*sizeof(double)); } else { objective_ = new double [numberExtendedColumns_]; memset(objective_, 0, numberExtendedColumns_ * sizeof(double)); } if (start) quadraticObjective_ = new CoinPackedMatrix(true, numberColumns, numberColumns, start[numberColumns], element, column, start, NULL); else quadraticObjective_ = NULL; gradient_ = NULL; activated_ = 1; fullMatrix_ = false; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpQuadraticObjective::ClpQuadraticObjective (const ClpQuadraticObjective & rhs, int type) : ClpObjective(rhs) { numberColumns_ = rhs.numberColumns_; numberExtendedColumns_ = rhs.numberExtendedColumns_; fullMatrix_ = rhs.fullMatrix_; if (rhs.objective_) { objective_ = new double [numberExtendedColumns_]; CoinMemcpyN(rhs.objective_, numberExtendedColumns_, objective_); } else { objective_ = NULL; } if (rhs.gradient_) { gradient_ = new double [numberExtendedColumns_]; CoinMemcpyN(rhs.gradient_, numberExtendedColumns_, gradient_); } else { gradient_ = NULL; } if (rhs.quadraticObjective_) { // see what type of matrix wanted if (type == 0) { // just copy quadraticObjective_ = new CoinPackedMatrix(*rhs.quadraticObjective_); } else if (type == 1) { // expand to full symmetric fullMatrix_ = true; const int * columnQuadratic1 = rhs.quadraticObjective_->getIndices(); const CoinBigIndex * columnQuadraticStart1 = rhs.quadraticObjective_->getVectorStarts(); const int * columnQuadraticLength1 = rhs.quadraticObjective_->getVectorLengths(); const double * quadraticElement1 = rhs.quadraticObjective_->getElements(); CoinBigIndex * columnQuadraticStart2 = new CoinBigIndex [numberExtendedColumns_+1]; int * columnQuadraticLength2 = new int [numberExtendedColumns_]; int iColumn; int numberColumns = rhs.quadraticObjective_->getNumCols(); int numberBelow = 0; int numberAbove = 0; int numberDiagonal = 0; CoinZeroN(columnQuadraticLength2, numberExtendedColumns_); for (iColumn = 0; iColumn < numberColumns; iColumn++) { for (CoinBigIndex j = columnQuadraticStart1[iColumn]; j < columnQuadraticStart1[iColumn] + columnQuadraticLength1[iColumn]; j++) { int jColumn = columnQuadratic1[j]; if (jColumn > iColumn) { numberBelow++; columnQuadraticLength2[jColumn]++; columnQuadraticLength2[iColumn]++; } else if (jColumn == iColumn) { numberDiagonal++; columnQuadraticLength2[iColumn]++; } else { numberAbove++; } } } if (numberAbove > 0) { if (numberAbove == numberBelow) { // already done quadraticObjective_ = new CoinPackedMatrix(*rhs.quadraticObjective_); delete [] columnQuadraticStart2; delete [] columnQuadraticLength2; } else { printf("number above = %d, number below = %d, error\n", numberAbove, numberBelow); abort(); } } else { int numberElements = numberDiagonal + 2 * numberBelow; int * columnQuadratic2 = new int [numberElements]; double * quadraticElement2 = new double [numberElements]; columnQuadraticStart2[0] = 0; numberElements = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int n = columnQuadraticLength2[iColumn]; columnQuadraticLength2[iColumn] = 0; numberElements += n; columnQuadraticStart2[iColumn+1] = numberElements; } for (iColumn = 0; iColumn < numberColumns; iColumn++) { for (CoinBigIndex j = columnQuadraticStart1[iColumn]; j < columnQuadraticStart1[iColumn] + columnQuadraticLength1[iColumn]; j++) { int jColumn = columnQuadratic1[j]; if (jColumn > iColumn) { // put in two places CoinBigIndex put = columnQuadraticLength2[jColumn] + columnQuadraticStart2[jColumn]; columnQuadraticLength2[jColumn]++; quadraticElement2[put] = quadraticElement1[j]; columnQuadratic2[put] = iColumn; put = columnQuadraticLength2[iColumn] + columnQuadraticStart2[iColumn]; columnQuadraticLength2[iColumn]++; quadraticElement2[put] = quadraticElement1[j]; columnQuadratic2[put] = jColumn; } else if (jColumn == iColumn) { CoinBigIndex put = columnQuadraticLength2[iColumn] + columnQuadraticStart2[iColumn]; columnQuadraticLength2[iColumn]++; quadraticElement2[put] = quadraticElement1[j]; columnQuadratic2[put] = iColumn; } else { abort(); } } } // Now create quadraticObjective_ = new CoinPackedMatrix (true, rhs.numberExtendedColumns_, rhs.numberExtendedColumns_, numberElements, quadraticElement2, columnQuadratic2, columnQuadraticStart2, columnQuadraticLength2, 0.0, 0.0); delete [] columnQuadraticStart2; delete [] columnQuadraticLength2; delete [] columnQuadratic2; delete [] quadraticElement2; } } else { fullMatrix_ = false; abort(); // code when needed } } else { quadraticObjective_ = NULL; } } /* Subset constructor. Duplicates are allowed and order is as given. */ ClpQuadraticObjective::ClpQuadraticObjective (const ClpQuadraticObjective &rhs, int numberColumns, const int * whichColumn) : ClpObjective(rhs) { fullMatrix_ = rhs.fullMatrix_; objective_ = NULL; int extra = rhs.numberExtendedColumns_ - rhs.numberColumns_; numberColumns_ = 0; numberExtendedColumns_ = numberColumns + extra; if (numberColumns > 0) { // check valid lists int numberBad = 0; int i; for (i = 0; i < numberColumns; i++) if (whichColumn[i] < 0 || whichColumn[i] >= rhs.numberColumns_) numberBad++; if (numberBad) throw CoinError("bad column list", "subset constructor", "ClpQuadraticObjective"); numberColumns_ = numberColumns; objective_ = new double[numberExtendedColumns_]; for (i = 0; i < numberColumns_; i++) objective_[i] = rhs.objective_[whichColumn[i]]; CoinMemcpyN(rhs.objective_ + rhs.numberColumns_, (numberExtendedColumns_ - numberColumns_), objective_ + numberColumns_); if (rhs.gradient_) { gradient_ = new double[numberExtendedColumns_]; for (i = 0; i < numberColumns_; i++) gradient_[i] = rhs.gradient_[whichColumn[i]]; CoinMemcpyN(rhs.gradient_ + rhs.numberColumns_, (numberExtendedColumns_ - numberColumns_), gradient_ + numberColumns_); } else { gradient_ = NULL; } } else { gradient_ = NULL; objective_ = NULL; } if (rhs.quadraticObjective_) { quadraticObjective_ = new CoinPackedMatrix(*rhs.quadraticObjective_, numberColumns, whichColumn, numberColumns, whichColumn); } else { quadraticObjective_ = NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpQuadraticObjective::~ClpQuadraticObjective () { delete [] objective_; delete [] gradient_; delete quadraticObjective_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpQuadraticObjective & ClpQuadraticObjective::operator=(const ClpQuadraticObjective& rhs) { if (this != &rhs) { fullMatrix_ = rhs.fullMatrix_; delete quadraticObjective_; quadraticObjective_ = NULL; delete [] objective_; delete [] gradient_; ClpObjective::operator=(rhs); numberColumns_ = rhs.numberColumns_; numberExtendedColumns_ = rhs.numberExtendedColumns_; if (rhs.objective_) { objective_ = new double [numberExtendedColumns_]; CoinMemcpyN(rhs.objective_, numberExtendedColumns_, objective_); } else { objective_ = NULL; } if (rhs.gradient_) { gradient_ = new double [numberExtendedColumns_]; CoinMemcpyN(rhs.gradient_, numberExtendedColumns_, gradient_); } else { gradient_ = NULL; } if (rhs.quadraticObjective_) { quadraticObjective_ = new CoinPackedMatrix(*rhs.quadraticObjective_); } else { quadraticObjective_ = NULL; } } return *this; } // Returns gradient double * ClpQuadraticObjective::gradient(const ClpSimplex * model, const double * solution, double & offset, bool refresh, int includeLinear) { offset = 0.0; bool scaling = false; if (model && (model->rowScale() || model->objectiveScale() != 1.0 || model->optimizationDirection() != 1.0)) scaling = true; const double * cost = NULL; if (model) cost = model->costRegion(); if (!cost) { // not in solve cost = objective_; scaling = false; } if (!scaling) { if (!quadraticObjective_ || !solution || !activated_) { return objective_; } else { if (refresh || !gradient_) { if (!gradient_) gradient_ = new double[numberExtendedColumns_]; const int * columnQuadratic = quadraticObjective_->getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticObjective_->getVectorStarts(); const int * columnQuadraticLength = quadraticObjective_->getVectorLengths(); const double * quadraticElement = quadraticObjective_->getElements(); offset = 0.0; // use current linear cost region if (includeLinear == 1) CoinMemcpyN(cost, numberExtendedColumns_, gradient_); else if (includeLinear == 2) CoinMemcpyN(objective_, numberExtendedColumns_, gradient_); else memset(gradient_, 0, numberExtendedColumns_ * sizeof(double)); if (activated_) { if (!fullMatrix_) { int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double elementValue = quadraticElement[j]; if (iColumn != jColumn) { offset += valueI * valueJ * elementValue; //if (fabs(valueI*valueJ*elementValue)>1.0e-12) //printf("%d %d %g %g %g -> %g\n", // iColumn,jColumn,valueI,valueJ,elementValue, // valueI*valueJ*elementValue); double gradientI = valueJ * elementValue; double gradientJ = valueI * elementValue; gradient_[iColumn] += gradientI; gradient_[jColumn] += gradientJ; } else { offset += 0.5 * valueI * valueI * elementValue; //if (fabs(valueI*valueI*elementValue)>1.0e-12) //printf("XX %d %g %g -> %g\n", // iColumn,valueI,elementValue, // 0.5*valueI*valueI*elementValue); double gradientI = valueI * elementValue; gradient_[iColumn] += gradientI; } } } } else { // full matrix int iColumn; offset *= 2.0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex j; double value = 0.0; double current = gradient_[iColumn]; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn] * quadraticElement[j]; value += valueJ; } offset += value * solution[iColumn]; gradient_[iColumn] = current + value; } offset *= 0.5; } } } if (model) offset *= model->optimizationDirection() * model->objectiveScale(); return gradient_; } } else { // do scaling assert (solution); // for now only if half assert (!fullMatrix_); if (refresh || !gradient_) { if (!gradient_) gradient_ = new double[numberExtendedColumns_]; double direction = model->optimizationDirection() * model->objectiveScale(); // direction is actually scale out not scale in //if (direction) //direction = 1.0/direction; const int * columnQuadratic = quadraticObjective_->getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticObjective_->getVectorStarts(); const int * columnQuadraticLength = quadraticObjective_->getVectorLengths(); const double * quadraticElement = quadraticObjective_->getElements(); int iColumn; const double * columnScale = model->columnScale(); // use current linear cost region (already scaled) if (includeLinear == 1) { CoinMemcpyN(model->costRegion(), numberExtendedColumns_, gradient_); } else if (includeLinear == 2) { memset(gradient_ + numberColumns_, 0, (numberExtendedColumns_ - numberColumns_)*sizeof(double)); if (!columnScale) { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { gradient_[iColumn] = objective_[iColumn] * direction; } } else { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { gradient_[iColumn] = objective_[iColumn] * direction * columnScale[iColumn]; } } } else { memset(gradient_, 0, numberExtendedColumns_ * sizeof(double)); } if (!columnScale) { if (activated_) { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double elementValue = quadraticElement[j]; elementValue *= direction; if (iColumn != jColumn) { offset += valueI * valueJ * elementValue; double gradientI = valueJ * elementValue; double gradientJ = valueI * elementValue; gradient_[iColumn] += gradientI; gradient_[jColumn] += gradientJ; } else { offset += 0.5 * valueI * valueI * elementValue; double gradientI = valueI * elementValue; gradient_[iColumn] += gradientI; } } } } } else { // scaling if (activated_) { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; double scaleI = columnScale[iColumn] * direction; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double elementValue = quadraticElement[j]; double scaleJ = columnScale[jColumn]; elementValue *= scaleI * scaleJ; if (iColumn != jColumn) { offset += valueI * valueJ * elementValue; double gradientI = valueJ * elementValue; double gradientJ = valueI * elementValue; gradient_[iColumn] += gradientI; gradient_[jColumn] += gradientJ; } else { offset += 0.5 * valueI * valueI * elementValue; double gradientI = valueI * elementValue; gradient_[iColumn] += gradientI; } } } } } } if (model) offset *= model->optimizationDirection(); return gradient_; } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpObjective * ClpQuadraticObjective::clone() const { return new ClpQuadraticObjective(*this); } /* Subset clone. Duplicates are allowed and order is as given. */ ClpObjective * ClpQuadraticObjective::subsetClone (int numberColumns, const int * whichColumns) const { return new ClpQuadraticObjective(*this, numberColumns, whichColumns); } // Resize objective void ClpQuadraticObjective::resize(int newNumberColumns) { if (numberColumns_ != newNumberColumns) { int newExtended = newNumberColumns + (numberExtendedColumns_ - numberColumns_); int i; double * newArray = new double[newExtended]; if (objective_) CoinMemcpyN(objective_, CoinMin(newExtended, numberExtendedColumns_), newArray); delete [] objective_; objective_ = newArray; for (i = numberColumns_; i < newNumberColumns; i++) objective_[i] = 0.0; if (gradient_) { newArray = new double[newExtended]; if (gradient_) CoinMemcpyN(gradient_, CoinMin(newExtended, numberExtendedColumns_), newArray); delete [] gradient_; gradient_ = newArray; for (i = numberColumns_; i < newNumberColumns; i++) gradient_[i] = 0.0; } if (quadraticObjective_) { if (newNumberColumns < numberColumns_) { int * which = new int[numberColumns_-newNumberColumns]; int i; for (i = newNumberColumns; i < numberColumns_; i++) which[i-newNumberColumns] = i; quadraticObjective_->deleteRows(numberColumns_ - newNumberColumns, which); quadraticObjective_->deleteCols(numberColumns_ - newNumberColumns, which); delete [] which; } else { quadraticObjective_->setDimensions(newNumberColumns, newNumberColumns); } } numberColumns_ = newNumberColumns; numberExtendedColumns_ = newExtended; } } // Delete columns in objective void ClpQuadraticObjective::deleteSome(int numberToDelete, const int * which) { int newNumberColumns = numberColumns_ - numberToDelete; int newExtended = numberExtendedColumns_ - numberToDelete; if (objective_) { int i ; char * deleted = new char[numberColumns_]; int numberDeleted = 0; memset(deleted, 0, numberColumns_ * sizeof(char)); for (i = 0; i < numberToDelete; i++) { int j = which[i]; if (j >= 0 && j < numberColumns_ && !deleted[j]) { numberDeleted++; deleted[j] = 1; } } newNumberColumns = numberColumns_ - numberDeleted; newExtended = numberExtendedColumns_ - numberDeleted; double * newArray = new double[newExtended]; int put = 0; for (i = 0; i < numberColumns_; i++) { if (!deleted[i]) { newArray[put++] = objective_[i]; } } delete [] objective_; objective_ = newArray; delete [] deleted; CoinMemcpyN(objective_ + numberColumns_, (numberExtendedColumns_ - numberColumns_), objective_ + newNumberColumns); } if (gradient_) { int i ; char * deleted = new char[numberColumns_]; int numberDeleted = 0; memset(deleted, 0, numberColumns_ * sizeof(char)); for (i = 0; i < numberToDelete; i++) { int j = which[i]; if (j >= 0 && j < numberColumns_ && !deleted[j]) { numberDeleted++; deleted[j] = 1; } } newNumberColumns = numberColumns_ - numberDeleted; newExtended = numberExtendedColumns_ - numberDeleted; double * newArray = new double[newExtended]; int put = 0; for (i = 0; i < numberColumns_; i++) { if (!deleted[i]) { newArray[put++] = gradient_[i]; } } delete [] gradient_; gradient_ = newArray; delete [] deleted; CoinMemcpyN(gradient_ + numberColumns_, (numberExtendedColumns_ - numberColumns_), gradient_ + newNumberColumns); } numberColumns_ = newNumberColumns; numberExtendedColumns_ = newExtended; if (quadraticObjective_) { quadraticObjective_->deleteCols(numberToDelete, which); quadraticObjective_->deleteRows(numberToDelete, which); } } // Load up quadratic objective void ClpQuadraticObjective::loadQuadraticObjective(const int numberColumns, const CoinBigIndex * start, const int * column, const double * element, int numberExtended) { fullMatrix_ = false; delete quadraticObjective_; quadraticObjective_ = new CoinPackedMatrix(true, numberColumns, numberColumns, start[numberColumns], element, column, start, NULL); numberColumns_ = numberColumns; if (numberExtended > numberExtendedColumns_) { if (objective_) { // make correct size double * newArray = new double[numberExtended]; CoinMemcpyN(objective_, numberColumns_, newArray); delete [] objective_; objective_ = newArray; memset(objective_ + numberColumns_, 0, (numberExtended - numberColumns_)*sizeof(double)); } if (gradient_) { // make correct size double * newArray = new double[numberExtended]; CoinMemcpyN(gradient_, numberColumns_, newArray); delete [] gradient_; gradient_ = newArray; memset(gradient_ + numberColumns_, 0, (numberExtended - numberColumns_)*sizeof(double)); } numberExtendedColumns_ = numberExtended; } else { numberExtendedColumns_ = numberColumns_; } } void ClpQuadraticObjective::loadQuadraticObjective ( const CoinPackedMatrix& matrix) { delete quadraticObjective_; quadraticObjective_ = new CoinPackedMatrix(matrix); } // Get rid of quadratic objective void ClpQuadraticObjective::deleteQuadraticObjective() { delete quadraticObjective_; quadraticObjective_ = NULL; } /* Returns reduced gradient.Returns an offset (to be added to current one). */ double ClpQuadraticObjective::reducedGradient(ClpSimplex * model, double * region, bool useFeasibleCosts) { int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); //work space CoinIndexedVector * workSpace = model->rowArray(0); CoinIndexedVector arrayVector; arrayVector.reserve(numberRows + 1); int iRow; #ifdef CLP_DEBUG workSpace->checkClear(); #endif double * array = arrayVector.denseVector(); int * index = arrayVector.getIndices(); int number = 0; const double * costNow = gradient(model, model->solutionRegion(), offset_, true, useFeasibleCosts ? 2 : 1); double * cost = model->costRegion(); const int * pivotVariable = model->pivotVariable(); for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; double value; if (iPivot < numberColumns) value = costNow[iPivot]; else if (!useFeasibleCosts) value = cost[iPivot]; else value = 0.0; if (value) { array[iRow] = value; index[number++] = iRow; } } arrayVector.setNumElements(number); // Btran basic costs model->factorization()->updateColumnTranspose(workSpace, &arrayVector); double * work = workSpace->denseVector(); ClpFillN(work, numberRows, 0.0); // now look at dual solution double * rowReducedCost = region + numberColumns; double * dual = rowReducedCost; const double * rowCost = cost + numberColumns; for (iRow = 0; iRow < numberRows; iRow++) { dual[iRow] = array[iRow]; } double * dj = region; ClpDisjointCopyN(costNow, numberColumns, dj); model->transposeTimes(-1.0, dual, dj); for (iRow = 0; iRow < numberRows; iRow++) { // slack double value = dual[iRow]; value += rowCost[iRow]; rowReducedCost[iRow] = value; } return offset_; } /* Returns step length which gives minimum of objective for solution + theta * change vector up to maximum theta. arrays are numberColumns+numberRows */ double ClpQuadraticObjective::stepLength(ClpSimplex * model, const double * solution, const double * change, double maximumTheta, double & currentObj, double & predictedObj, double & thetaObj) { const double * cost = model->costRegion(); bool inSolve = true; if (!cost) { // not in solve cost = objective_; inSolve = false; } double delta = 0.0; double linearCost = 0.0; int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); int numberTotal = numberColumns; if (inSolve) numberTotal += numberRows; currentObj = 0.0; thetaObj = 0.0; for (int iColumn = 0; iColumn < numberTotal; iColumn++) { delta += cost[iColumn] * change[iColumn]; linearCost += cost[iColumn] * solution[iColumn]; } if (!activated_ || !quadraticObjective_) { currentObj = linearCost; thetaObj = currentObj + delta * maximumTheta; if (delta < 0.0) { return maximumTheta; } else { COIN_DETAIL_PRINT(printf("odd linear direction %g\n", delta)); return 0.0; } } assert (model); bool scaling = false; if ((model->rowScale() || model->objectiveScale() != 1.0 || model->optimizationDirection() != 1.0) && inSolve) scaling = true; const int * columnQuadratic = quadraticObjective_->getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticObjective_->getVectorStarts(); const int * columnQuadraticLength = quadraticObjective_->getVectorLengths(); const double * quadraticElement = quadraticObjective_->getElements(); double a = 0.0; double b = delta; double c = 0.0; if (!scaling) { if (!fullMatrix_) { int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; double changeI = change[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double changeJ = change[jColumn]; double elementValue = quadraticElement[j]; if (iColumn != jColumn) { a += changeI * changeJ * elementValue; b += (changeI * valueJ + changeJ * valueI) * elementValue; c += valueI * valueJ * elementValue; } else { a += 0.5 * changeI * changeI * elementValue; b += changeI * valueI * elementValue; c += 0.5 * valueI * valueI * elementValue; } } } } else { // full matrix stored int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; double changeI = change[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double changeJ = change[jColumn]; double elementValue = quadraticElement[j]; valueJ *= elementValue; a += changeI * changeJ * elementValue; b += changeI * valueJ; c += valueI * valueJ; } } a *= 0.5; c *= 0.5; } } else { // scaling // for now only if half assert (!fullMatrix_); const double * columnScale = model->columnScale(); double direction = model->optimizationDirection() * model->objectiveScale(); // direction is actually scale out not scale in if (direction) direction = 1.0 / direction; if (!columnScale) { for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; double changeI = change[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double changeJ = change[jColumn]; double elementValue = quadraticElement[j]; elementValue *= direction; if (iColumn != jColumn) { a += changeI * changeJ * elementValue; b += (changeI * valueJ + changeJ * valueI) * elementValue; c += valueI * valueJ * elementValue; } else { a += 0.5 * changeI * changeI * elementValue; b += changeI * valueI * elementValue; c += 0.5 * valueI * valueI * elementValue; } } } } else { // scaling for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; double changeI = change[iColumn]; double scaleI = columnScale[iColumn] * direction; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double changeJ = change[jColumn]; double elementValue = quadraticElement[j]; elementValue *= scaleI * columnScale[jColumn]; if (iColumn != jColumn) { a += changeI * changeJ * elementValue; b += (changeI * valueJ + changeJ * valueI) * elementValue; c += valueI * valueJ * elementValue; } else { a += 0.5 * changeI * changeI * elementValue; b += changeI * valueI * elementValue; c += 0.5 * valueI * valueI * elementValue; } } } } } double theta; //printf("Current cost %g\n",c+linearCost); currentObj = c + linearCost; thetaObj = currentObj + a * maximumTheta * maximumTheta + b * maximumTheta; // minimize a*x*x + b*x + c if (a <= 0.0) { theta = maximumTheta; } else { theta = -0.5 * b / a; } predictedObj = currentObj + a * theta * theta + b * theta; if (b > 0.0) { if (model->messageHandler()->logLevel() & 32) printf("a %g b %g c %g => %g\n", a, b, c, theta); b = 0.0; } return CoinMin(theta, maximumTheta); } // Return objective value (without any ClpModel offset) (model may be NULL) double ClpQuadraticObjective::objectiveValue(const ClpSimplex * model, const double * solution) const { bool scaling = false; if (model && (model->rowScale() || model->objectiveScale() != 1.0)) scaling = true; const double * cost = NULL; if (model) cost = model->costRegion(); if (!cost) { // not in solve cost = objective_; scaling = false; } double linearCost = 0.0; int numberColumns = model->numberColumns(); int numberTotal = numberColumns; double currentObj = 0.0; for (int iColumn = 0; iColumn < numberTotal; iColumn++) { linearCost += cost[iColumn] * solution[iColumn]; } if (!activated_ || !quadraticObjective_) { currentObj = linearCost; return currentObj; } assert (model); const int * columnQuadratic = quadraticObjective_->getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticObjective_->getVectorStarts(); const int * columnQuadraticLength = quadraticObjective_->getVectorLengths(); const double * quadraticElement = quadraticObjective_->getElements(); double c = 0.0; if (!scaling) { if (!fullMatrix_) { int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double elementValue = quadraticElement[j]; if (iColumn != jColumn) { c += valueI * valueJ * elementValue; } else { c += 0.5 * valueI * valueI * elementValue; } } } } else { // full matrix stored int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double elementValue = quadraticElement[j]; valueJ *= elementValue; c += valueI * valueJ; } } c *= 0.5; } } else { // scaling // for now only if half assert (!fullMatrix_); const double * columnScale = model->columnScale(); double direction = model->objectiveScale(); // direction is actually scale out not scale in if (direction) direction = 1.0 / direction; if (!columnScale) { for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double elementValue = quadraticElement[j]; elementValue *= direction; if (iColumn != jColumn) { c += valueI * valueJ * elementValue; } else { c += 0.5 * valueI * valueI * elementValue; } } } } else { // scaling for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double valueI = solution[iColumn]; double scaleI = columnScale[iColumn] * direction; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; double valueJ = solution[jColumn]; double elementValue = quadraticElement[j]; elementValue *= scaleI * columnScale[jColumn]; if (iColumn != jColumn) { c += valueI * valueJ * elementValue; } else { c += 0.5 * valueI * valueI * elementValue; } } } } } currentObj = c + linearCost; return currentObj; } // Scale objective void ClpQuadraticObjective::reallyScale(const double * columnScale) { const int * columnQuadratic = quadraticObjective_->getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticObjective_->getVectorStarts(); const int * columnQuadraticLength = quadraticObjective_->getVectorLengths(); double * quadraticElement = quadraticObjective_->getMutableElements(); for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double scaleI = columnScale[iColumn]; objective_[iColumn] *= scaleI; CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; quadraticElement[j] *= scaleI * columnScale[jColumn]; } } } /* Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ int ClpQuadraticObjective::markNonlinear(char * which) { int iColumn; const int * columnQuadratic = quadraticObjective_->getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticObjective_->getVectorStarts(); const int * columnQuadraticLength = quadraticObjective_->getVectorLengths(); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex j; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; which[jColumn] = 1; which[iColumn] = 1; } } int numberNonLinearColumns = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if(which[iColumn]) numberNonLinearColumns++; } return numberNonLinearColumns; } CoinMP-1.8.3/Clp/src/ClpPrimalQuadraticDantzig.hpp0000644000175000017500000000432111510657452020402 0ustar renerene/* $Id: ClpPrimalQuadraticDantzig.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpPrimalQuadraticDantzig_H #define ClpPrimalQuadraticDantzig_H #include "ClpPrimalColumnPivot.hpp" class ClpSimplexPrimalQuadratic; class ClpQuadraticInfo; //############################################################################# /** Primal Column Pivot Dantzig Algorithm Class This is simplest choice - choose largest infeasibility */ class ClpPrimalQuadraticDantzig : public ClpPrimalColumnPivot { public: ///@name Algorithmic methods //@{ /** Returns pivot column, -1 if none. Lumbers over all columns - slow updateArray has cost updates (also use pivotRow_ from last iteration) Can just do full price if you really want to be slow */ virtual int pivotColumn(CoinIndexedVector * updates, CoinIndexedVector * spareRow1, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Just sets model virtual void saveWeights(ClpSimplex * model, int mode) { model_ = model; } //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpPrimalQuadraticDantzig(); /// Copy constructor ClpPrimalQuadraticDantzig(const ClpPrimalQuadraticDantzig &); /// Constructor from model ClpPrimalQuadraticDantzig(ClpSimplexPrimalQuadratic * model, ClpQuadraticInfo * info); /// Assignment operator ClpPrimalQuadraticDantzig & operator=(const ClpPrimalQuadraticDantzig& rhs); /// Destructor virtual ~ClpPrimalQuadraticDantzig (); /// Clone virtual ClpPrimalColumnPivot * clone(bool copyData = true) const; //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// Pointer to info ClpQuadraticInfo * quadraticInfo_; //@} }; #endif CoinMP-1.8.3/Clp/src/Clp_C_Interface.h0000644000175000017500000006351512272631011015737 0ustar renerene/* $Id: Clp_C_Interface.h 2019 2014-01-31 05:18:01Z stefan $ */ /* Copyright (C) 2002, 2003 International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #ifndef ClpSimplexC_H #define ClpSimplexC_H /* include all defines and ugly stuff */ #include "Coin_C_defines.h" #if defined (CLP_EXTERN_C) typedef struct { ClpSolve options; } Clp_Solve; #else typedef void Clp_Solve; #endif /** This is a first "C" interface to Clp. It has similarities to the OSL V3 interface and only has most common functions */ #ifdef __cplusplus extern "C" { #endif /**@name Version info * * A Clp library has a version number of the form .., * where each of major, minor, and release are nonnegative integers. * For a checkout of the Clp stable branch, release is 9999. * For a checkout of the Clp development branch, major, minor, and release are 9999. */ /*@{*/ /** Clp library version number as string. */ COINLIBAPI const char* COINLINKAGE Clp_Version(void); /** Major number of Clp library version. */ COINLIBAPI int COINLINKAGE Clp_VersionMajor(void); /** Minor number of Clp library version. */ COINLIBAPI int COINLINKAGE Clp_VersionMinor(void); /** Release number of Clp library version. */ COINLIBAPI int COINLINKAGE Clp_VersionRelease(void); /*@}*/ /**@name Constructors and destructor These do not have an exact analogue in C++. The user does not need to know structure of Clp_Simplex or Clp_Solve. For (almost) all Clp_* functions outside this group there is an exact C++ analogue created by taking the first parameter out, removing the Clp_ from name and applying the method to an object of type ClpSimplex. Similarly, for all ClpSolve_* functions there is an exact C++ analogue created by taking the first parameter out, removing the ClpSolve_ from name and applying the method to an object of type ClpSolve. */ /*@{*/ /** Default constructor */ COINLIBAPI Clp_Simplex * COINLINKAGE Clp_newModel(void); /** Destructor */ COINLIBAPI void COINLINKAGE Clp_deleteModel(Clp_Simplex * model); /** Default constructor */ COINLIBAPI Clp_Solve * COINLINKAGE ClpSolve_new(); /** Destructor */ COINLIBAPI void COINLINKAGE ClpSolve_delete(Clp_Solve * solve); /*@}*/ /**@name Load model - loads some stuff and initializes others */ /*@{*/ /** Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is NULL then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ /** Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ COINLIBAPI void COINLINKAGE Clp_loadProblem (Clp_Simplex * model, const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /* read quadratic part of the objective (the matrix part) */ COINLIBAPI void COINLINKAGE Clp_loadQuadraticObjective(Clp_Simplex * model, const int numberColumns, const CoinBigIndex * start, const int * column, const double * element); /** Read an mps file from the given filename */ COINLIBAPI int COINLINKAGE Clp_readMps(Clp_Simplex * model, const char *filename, int keepNames, int ignoreErrors); /** Copy in integer informations */ COINLIBAPI void COINLINKAGE Clp_copyInIntegerInformation(Clp_Simplex * model, const char * information); /** Drop integer informations */ COINLIBAPI void COINLINKAGE Clp_deleteIntegerInformation(Clp_Simplex * model); /** Resizes rim part of model */ COINLIBAPI void COINLINKAGE Clp_resize (Clp_Simplex * model, int newNumberRows, int newNumberColumns); /** Deletes rows */ COINLIBAPI void COINLINKAGE Clp_deleteRows(Clp_Simplex * model, int number, const int * which); /** Add rows */ COINLIBAPI void COINLINKAGE Clp_addRows(Clp_Simplex * model, int number, const double * rowLower, const double * rowUpper, const int * rowStarts, const int * columns, const double * elements); /** Deletes columns */ COINLIBAPI void COINLINKAGE Clp_deleteColumns(Clp_Simplex * model, int number, const int * which); /** Add columns */ COINLIBAPI void COINLINKAGE Clp_addColumns(Clp_Simplex * model, int number, const double * columnLower, const double * columnUpper, const double * objective, const int * columnStarts, const int * rows, const double * elements); /** Change row lower bounds */ COINLIBAPI void COINLINKAGE Clp_chgRowLower(Clp_Simplex * model, const double * rowLower); /** Change row upper bounds */ COINLIBAPI void COINLINKAGE Clp_chgRowUpper(Clp_Simplex * model, const double * rowUpper); /** Change column lower bounds */ COINLIBAPI void COINLINKAGE Clp_chgColumnLower(Clp_Simplex * model, const double * columnLower); /** Change column upper bounds */ COINLIBAPI void COINLINKAGE Clp_chgColumnUpper(Clp_Simplex * model, const double * columnUpper); /** Change objective coefficients */ COINLIBAPI void COINLINKAGE Clp_chgObjCoefficients(Clp_Simplex * model, const double * objIn); /** Drops names - makes lengthnames 0 and names empty */ COINLIBAPI void COINLINKAGE Clp_dropNames(Clp_Simplex * model); /** Copies in names */ COINLIBAPI void COINLINKAGE Clp_copyNames(Clp_Simplex * model, const char * const * rowNames, const char * const * columnNames); /*@}*/ /**@name gets and sets - you will find some synonyms at the end of this file */ /*@{*/ /** Number of rows */ COINLIBAPI int COINLINKAGE Clp_numberRows(Clp_Simplex * model); /** Number of columns */ COINLIBAPI int COINLINKAGE Clp_numberColumns(Clp_Simplex * model); /** Primal tolerance to use */ COINLIBAPI double COINLINKAGE Clp_primalTolerance(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setPrimalTolerance(Clp_Simplex * model, double value) ; /** Dual tolerance to use */ COINLIBAPI double COINLINKAGE Clp_dualTolerance(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setDualTolerance(Clp_Simplex * model, double value) ; /** Dual objective limit */ COINLIBAPI double COINLINKAGE Clp_dualObjectiveLimit(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setDualObjectiveLimit(Clp_Simplex * model, double value); /** Objective offset */ COINLIBAPI double COINLINKAGE Clp_objectiveOffset(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setObjectiveOffset(Clp_Simplex * model, double value); /** Fills in array with problem name */ COINLIBAPI void COINLINKAGE Clp_problemName(Clp_Simplex * model, int maxNumberCharacters, char * array); /* Sets problem name. Must have \0 at end. */ COINLIBAPI int COINLINKAGE Clp_setProblemName(Clp_Simplex * model, int maxNumberCharacters, char * array); /** Number of iterations */ COINLIBAPI int COINLINKAGE Clp_numberIterations(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setNumberIterations(Clp_Simplex * model, int numberIterations); /** Maximum number of iterations */ COINLIBAPI int maximumIterations(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setMaximumIterations(Clp_Simplex * model, int value); /** Maximum time in seconds (from when set called) */ COINLIBAPI double COINLINKAGE Clp_maximumSeconds(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setMaximumSeconds(Clp_Simplex * model, double value); /** Returns true if hit maximum iterations (or time) */ COINLIBAPI int COINLINKAGE Clp_hitMaximumIterations(Clp_Simplex * model); /** Status of problem: 0 - optimal 1 - primal infeasible 2 - dual infeasible 3 - stopped on iterations etc 4 - stopped due to errors */ COINLIBAPI int COINLINKAGE Clp_status(Clp_Simplex * model); /** Set problem status */ COINLIBAPI void COINLINKAGE Clp_setProblemStatus(Clp_Simplex * model, int problemStatus); /** Secondary status of problem - may get extended 0 - none 1 - primal infeasible because dual limit reached 2 - scaled problem optimal - unscaled has primal infeasibilities 3 - scaled problem optimal - unscaled has dual infeasibilities 4 - scaled problem optimal - unscaled has both dual and primal infeasibilities */ COINLIBAPI int COINLINKAGE Clp_secondaryStatus(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setSecondaryStatus(Clp_Simplex * model, int status); /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ COINLIBAPI double COINLINKAGE Clp_optimizationDirection(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setOptimizationDirection(Clp_Simplex * model, double value); /** Primal row solution */ COINLIBAPI double * COINLINKAGE Clp_primalRowSolution(Clp_Simplex * model); /** Primal column solution */ COINLIBAPI double * COINLINKAGE Clp_primalColumnSolution(Clp_Simplex * model); /** Dual row solution */ COINLIBAPI double * COINLINKAGE Clp_dualRowSolution(Clp_Simplex * model); /** Reduced costs */ COINLIBAPI double * COINLINKAGE Clp_dualColumnSolution(Clp_Simplex * model); /** Row lower */ COINLIBAPI double* COINLINKAGE Clp_rowLower(Clp_Simplex * model); /** Row upper */ COINLIBAPI double* COINLINKAGE Clp_rowUpper(Clp_Simplex * model); /** Objective */ COINLIBAPI double * COINLINKAGE Clp_objective(Clp_Simplex * model); /** Column Lower */ COINLIBAPI double * COINLINKAGE Clp_columnLower(Clp_Simplex * model); /** Column Upper */ COINLIBAPI double * COINLINKAGE Clp_columnUpper(Clp_Simplex * model); /** Number of elements in matrix */ COINLIBAPI int COINLINKAGE Clp_getNumElements(Clp_Simplex * model); /* Column starts in matrix */ COINLIBAPI const CoinBigIndex * COINLINKAGE Clp_getVectorStarts(Clp_Simplex * model); /* Row indices in matrix */ COINLIBAPI const int * COINLINKAGE Clp_getIndices(Clp_Simplex * model); /* Column vector lengths in matrix */ COINLIBAPI const int * COINLINKAGE Clp_getVectorLengths(Clp_Simplex * model); /* Element values in matrix */ COINLIBAPI const double * COINLINKAGE Clp_getElements(Clp_Simplex * model); /** Objective value */ COINLIBAPI double COINLINKAGE Clp_objectiveValue(Clp_Simplex * model); /** Integer information */ COINLIBAPI char * COINLINKAGE Clp_integerInformation(Clp_Simplex * model); /** Gives Infeasibility ray. * * Use Clp_freeRay to free the returned array. * * @return infeasibility ray, or NULL returned if none/wrong. */ COINLIBAPI double * COINLINKAGE Clp_infeasibilityRay(Clp_Simplex * model); /** Gives ray in which the problem is unbounded. * * Use Clp_freeRay to free the returned array. * * @return unbounded ray, or NULL returned if none/wrong. */ COINLIBAPI double * COINLINKAGE Clp_unboundedRay(Clp_Simplex * model); /** Frees a infeasibility or unbounded ray. */ COINLIBAPI void COINLINKAGE Clp_freeRay(Clp_Simplex * model, double * ray); /** See if status array exists (partly for OsiClp) */ COINLIBAPI int COINLINKAGE Clp_statusExists(Clp_Simplex * model); /** Return address of status array (char[numberRows+numberColumns]) */ COINLIBAPI unsigned char * COINLINKAGE Clp_statusArray(Clp_Simplex * model); /** Copy in status vector */ COINLIBAPI void COINLINKAGE Clp_copyinStatus(Clp_Simplex * model, const unsigned char * statusArray); /* status values are as in ClpSimplex.hpp i.e. 0 - free, 1 basic, 2 at upper, 3 at lower, 4 superbasic, (5 fixed) */ /* Get variable basis info */ COINLIBAPI int COINLINKAGE Clp_getColumnStatus(Clp_Simplex * model, int sequence); /* Get row basis info */ COINLIBAPI int COINLINKAGE Clp_getRowStatus(Clp_Simplex * model, int sequence); /* Set variable basis info (and value if at bound) */ COINLIBAPI void COINLINKAGE Clp_setColumnStatus(Clp_Simplex * model, int sequence, int value); /* Set row basis info (and value if at bound) */ COINLIBAPI void COINLINKAGE Clp_setRowStatus(Clp_Simplex * model, int sequence, int value); /** User pointer for whatever reason */ COINLIBAPI void COINLINKAGE Clp_setUserPointer (Clp_Simplex * model, void * pointer); COINLIBAPI void * COINLINKAGE Clp_getUserPointer (Clp_Simplex * model); /*@}*/ /**@name Message handling. Call backs are handled by ONE function */ /*@{*/ /** Pass in Callback function. Message numbers up to 1000000 are Clp, Coin ones have 1000000 added */ COINLIBAPI void COINLINKAGE Clp_registerCallBack(Clp_Simplex * model, clp_callback userCallBack); /** Unset Callback function */ COINLIBAPI void COINLINKAGE Clp_clearCallBack(Clp_Simplex * model); /** Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - verbose above that 8,16,32 etc just for selective debug */ COINLIBAPI void COINLINKAGE Clp_setLogLevel(Clp_Simplex * model, int value); COINLIBAPI int COINLINKAGE Clp_logLevel(Clp_Simplex * model); /** length of names (0 means no names0 */ COINLIBAPI int COINLINKAGE Clp_lengthNames(Clp_Simplex * model); /** Fill in array (at least lengthNames+1 long) with a row name */ COINLIBAPI void COINLINKAGE Clp_rowName(Clp_Simplex * model, int iRow, char * name); /** Fill in array (at least lengthNames+1 long) with a column name */ COINLIBAPI void COINLINKAGE Clp_columnName(Clp_Simplex * model, int iColumn, char * name); /*@}*/ /**@name Functions most useful to user */ /*@{*/ /** General solve algorithm which can do presolve. See ClpSolve.hpp for options */ COINLIBAPI int COINLINKAGE Clp_initialSolve(Clp_Simplex * model); /** Pass solve options. (Exception to direct analogue rule) */ COINLIBAPI int COINLINKAGE Clp_initialSolveWithOptions(Clp_Simplex * model, Clp_Solve *); /** Dual initial solve */ COINLIBAPI int COINLINKAGE Clp_initialDualSolve(Clp_Simplex * model); /** Primal initial solve */ COINLIBAPI int COINLINKAGE Clp_initialPrimalSolve(Clp_Simplex * model); /** Barrier initial solve */ COINLIBAPI int COINLINKAGE Clp_initialBarrierSolve(Clp_Simplex * model); /** Barrier initial solve, no crossover */ COINLIBAPI int COINLINKAGE Clp_initialBarrierNoCrossSolve(Clp_Simplex * model); /** Dual algorithm - see ClpSimplexDual.hpp for method */ COINLIBAPI int COINLINKAGE Clp_dual(Clp_Simplex * model, int ifValuesPass); /** Primal algorithm - see ClpSimplexPrimal.hpp for method */ COINLIBAPI int COINLINKAGE Clp_primal(Clp_Simplex * model, int ifValuesPass); #ifndef SLIM_CLP /** Solve the problem with the idiot code */ COINLIBAPI void COINLINKAGE Clp_idiot(Clp_Simplex * model, int tryhard); #endif /** Sets or unsets scaling, 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later) */ COINLIBAPI void COINLINKAGE Clp_scaling(Clp_Simplex * model, int mode); /** Gets scalingFlag */ COINLIBAPI int COINLINKAGE Clp_scalingFlag(Clp_Simplex * model); /** Crash - at present just aimed at dual, returns -2 if dual preferred and crash basis created -1 if dual preferred and all slack basis preferred 0 if basis going in was not all slack 1 if primal preferred and all slack basis preferred 2 if primal preferred and crash basis created. if gap between bounds <="gap" variables can be flipped If "pivot" is 0 No pivoting (so will just be choice of algorithm) 1 Simple pivoting e.g. gub 2 Mini iterations */ COINLIBAPI int COINLINKAGE Clp_crash(Clp_Simplex * model, double gap, int pivot); /*@}*/ /**@name most useful gets and sets */ /*@{*/ /** If problem is primal feasible */ COINLIBAPI int COINLINKAGE Clp_primalFeasible(Clp_Simplex * model); /** If problem is dual feasible */ COINLIBAPI int COINLINKAGE Clp_dualFeasible(Clp_Simplex * model); /** Dual bound */ COINLIBAPI double COINLINKAGE Clp_dualBound(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setDualBound(Clp_Simplex * model, double value); /** Infeasibility cost */ COINLIBAPI double COINLINKAGE Clp_infeasibilityCost(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setInfeasibilityCost(Clp_Simplex * model, double value); /** Perturbation: 50 - switch on perturbation 100 - auto perturb if takes too long (1.0e-6 largest nonzero) 101 - we are perturbed 102 - don't try perturbing again default is 100 others are for playing */ COINLIBAPI int COINLINKAGE Clp_perturbation(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setPerturbation(Clp_Simplex * model, int value); /** Current (or last) algorithm */ COINLIBAPI int COINLINKAGE Clp_algorithm(Clp_Simplex * model); /** Set algorithm */ COINLIBAPI void COINLINKAGE Clp_setAlgorithm(Clp_Simplex * model, int value); /** Sum of dual infeasibilities */ COINLIBAPI double COINLINKAGE Clp_sumDualInfeasibilities(Clp_Simplex * model); /** Number of dual infeasibilities */ COINLIBAPI int COINLINKAGE Clp_numberDualInfeasibilities(Clp_Simplex * model); /** Sum of primal infeasibilities */ COINLIBAPI double COINLINKAGE Clp_sumPrimalInfeasibilities(Clp_Simplex * model); /** Number of primal infeasibilities */ COINLIBAPI int COINLINKAGE Clp_numberPrimalInfeasibilities(Clp_Simplex * model); /** Save model to file, returns 0 if success. This is designed for use outside algorithms so does not save iterating arrays etc. It does not save any messaging information. Does not save scaling values. It does not know about all types of virtual functions. */ COINLIBAPI int COINLINKAGE Clp_saveModel(Clp_Simplex * model, const char * fileName); /** Restore model from file, returns 0 if success, deletes current model */ COINLIBAPI int COINLINKAGE Clp_restoreModel(Clp_Simplex * model, const char * fileName); /** Just check solution (for external use) - sets sum of infeasibilities etc */ COINLIBAPI void COINLINKAGE Clp_checkSolution(Clp_Simplex * model); /*@}*/ /******************** End of most useful part **************/ /**@name gets and sets - some synonyms */ /*@{*/ /** Number of rows */ COINLIBAPI int COINLINKAGE Clp_getNumRows(Clp_Simplex * model); /** Number of columns */ COINLIBAPI int COINLINKAGE Clp_getNumCols(Clp_Simplex * model); /** Number of iterations */ COINLIBAPI int COINLINKAGE Clp_getIterationCount(Clp_Simplex * model); /** Are there a numerical difficulties? */ COINLIBAPI int COINLINKAGE Clp_isAbandoned(Clp_Simplex * model); /** Is optimality proven? */ COINLIBAPI int COINLINKAGE Clp_isProvenOptimal(Clp_Simplex * model); /** Is primal infeasiblity proven? */ COINLIBAPI int COINLINKAGE Clp_isProvenPrimalInfeasible(Clp_Simplex * model); /** Is dual infeasiblity proven? */ COINLIBAPI int COINLINKAGE Clp_isProvenDualInfeasible(Clp_Simplex * model); /** Is the given primal objective limit reached? */ COINLIBAPI int COINLINKAGE Clp_isPrimalObjectiveLimitReached(Clp_Simplex * model) ; /** Is the given dual objective limit reached? */ COINLIBAPI int COINLINKAGE Clp_isDualObjectiveLimitReached(Clp_Simplex * model) ; /** Iteration limit reached? */ COINLIBAPI int COINLINKAGE Clp_isIterationLimitReached(Clp_Simplex * model); /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ COINLIBAPI double COINLINKAGE Clp_getObjSense(Clp_Simplex * model); /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ COINLIBAPI void COINLINKAGE Clp_setObjSense(Clp_Simplex * model, double objsen); /** Primal row solution */ COINLIBAPI const double * COINLINKAGE Clp_getRowActivity(Clp_Simplex * model); /** Primal column solution */ COINLIBAPI const double * COINLINKAGE Clp_getColSolution(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setColSolution(Clp_Simplex * model, const double * input); /** Dual row solution */ COINLIBAPI const double * COINLINKAGE Clp_getRowPrice(Clp_Simplex * model); /** Reduced costs */ COINLIBAPI const double * COINLINKAGE Clp_getReducedCost(Clp_Simplex * model); /** Row lower */ COINLIBAPI const double* COINLINKAGE Clp_getRowLower(Clp_Simplex * model); /** Row upper */ COINLIBAPI const double* COINLINKAGE Clp_getRowUpper(Clp_Simplex * model); /** Objective */ COINLIBAPI const double * COINLINKAGE Clp_getObjCoefficients(Clp_Simplex * model); /** Column Lower */ COINLIBAPI const double * COINLINKAGE Clp_getColLower(Clp_Simplex * model); /** Column Upper */ COINLIBAPI const double * COINLINKAGE Clp_getColUpper(Clp_Simplex * model); /** Objective value */ COINLIBAPI double COINLINKAGE Clp_getObjValue(Clp_Simplex * model); /** Print model for debugging purposes */ COINLIBAPI void COINLINKAGE Clp_printModel(Clp_Simplex * model, const char * prefix); /* Small element value - elements less than this set to zero, default is 1.0e-20 */ COINLIBAPI double COINLINKAGE Clp_getSmallElementValue(Clp_Simplex * model); COINLIBAPI void COINLINKAGE Clp_setSmallElementValue(Clp_Simplex * model, double value); /*@}*/ /**@name Get and set ClpSolve options */ /*@{*/ COINLIBAPI void COINLINKAGE ClpSolve_setSpecialOption(Clp_Solve *, int which, int value, int extraInfo); COINLIBAPI int COINLINKAGE ClpSolve_getSpecialOption(Clp_Solve *, int which); /** method: (see ClpSolve::SolveType) 0 - dual simplex 1 - primal simplex 2 - primal or sprint 3 - barrier 4 - barrier no crossover 5 - automatic 6 - not implemented -- pass extraInfo == -1 for default behavior */ COINLIBAPI void COINLINKAGE ClpSolve_setSolveType(Clp_Solve *, int method, int extraInfo); COINLIBAPI int COINLINKAGE ClpSolve_getSolveType(Clp_Solve *); /** amount: (see ClpSolve::PresolveType) 0 - presolve on 1 - presolve off 2 - presolve number 3 - presolve number cost -- pass extraInfo == -1 for default behavior */ COINLIBAPI void COINLINKAGE ClpSolve_setPresolveType(Clp_Solve *, int amount, int extraInfo); COINLIBAPI int COINLINKAGE ClpSolve_getPresolveType(Clp_Solve *); COINLIBAPI int COINLINKAGE ClpSolve_getPresolvePasses(Clp_Solve *); COINLIBAPI int COINLINKAGE ClpSolve_getExtraInfo(Clp_Solve *, int which); COINLIBAPI void COINLINKAGE ClpSolve_setInfeasibleReturn(Clp_Solve *, int trueFalse); COINLIBAPI int COINLINKAGE ClpSolve_infeasibleReturn(Clp_Solve *); COINLIBAPI int COINLINKAGE ClpSolve_doDual(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoDual(Clp_Solve *, int doDual); COINLIBAPI int COINLINKAGE ClpSolve_doSingleton(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoSingleton(Clp_Solve *, int doSingleton); COINLIBAPI int COINLINKAGE ClpSolve_doDoubleton(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoDoubleton(Clp_Solve *, int doDoubleton); COINLIBAPI int COINLINKAGE ClpSolve_doTripleton(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoTripleton(Clp_Solve *, int doTripleton); COINLIBAPI int COINLINKAGE ClpSolve_doTighten(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoTighten(Clp_Solve *, int doTighten); COINLIBAPI int COINLINKAGE ClpSolve_doForcing(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoForcing(Clp_Solve *, int doForcing); COINLIBAPI int COINLINKAGE ClpSolve_doImpliedFree(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoImpliedFree(Clp_Solve *, int doImpliedFree); COINLIBAPI int COINLINKAGE ClpSolve_doDupcol(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoDupcol(Clp_Solve *, int doDupcol); COINLIBAPI int COINLINKAGE ClpSolve_doDuprow(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoDuprow(Clp_Solve *, int doDuprow); COINLIBAPI int COINLINKAGE ClpSolve_doSingletonColumn(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setDoSingletonColumn(Clp_Solve *, int doSingleton); COINLIBAPI int COINLINKAGE ClpSolve_presolveActions(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setPresolveActions(Clp_Solve *, int action); COINLIBAPI int COINLINKAGE ClpSolve_substitution(Clp_Solve *); COINLIBAPI void COINLINKAGE ClpSolve_setSubstitution(Clp_Solve *, int value); /*@}*/ #ifdef __cplusplus } #endif #endif CoinMP-1.8.3/Clp/src/ClpGubMatrix.cpp0000644000175000017500000056457412130037657015717 0ustar renerene/* $Id: ClpGubMatrix.cpp 1929 2013-04-06 15:30:55Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" #include "ClpQuadraticObjective.hpp" #include "ClpNonLinearCost.hpp" // at end to get min/max! #include "ClpGubMatrix.hpp" //#include "ClpGubDynamicMatrix.hpp" #include "ClpMessage.hpp" //#define CLP_DEBUG //#define CLP_DEBUG_PRINT //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpGubMatrix::ClpGubMatrix () : ClpPackedMatrix(), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), infeasibilityWeight_(0.0), start_(NULL), end_(NULL), lower_(NULL), upper_(NULL), status_(NULL), saveStatus_(NULL), savedKeyVariable_(NULL), backward_(NULL), backToPivotRow_(NULL), changeCost_(NULL), keyVariable_(NULL), next_(NULL), toIndex_(NULL), fromIndex_(NULL), model_(NULL), numberDualInfeasibilities_(0), numberPrimalInfeasibilities_(0), noCheck_(-1), numberSets_(0), saveNumber_(0), possiblePivotKey_(0), gubSlackIn_(-1), firstGub_(0), lastGub_(0), gubType_(0) { setType(16); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpGubMatrix::ClpGubMatrix (const ClpGubMatrix & rhs) : ClpPackedMatrix(rhs) { numberSets_ = rhs.numberSets_; saveNumber_ = rhs.saveNumber_; possiblePivotKey_ = rhs.possiblePivotKey_; gubSlackIn_ = rhs.gubSlackIn_; start_ = ClpCopyOfArray(rhs.start_, numberSets_); end_ = ClpCopyOfArray(rhs.end_, numberSets_); lower_ = ClpCopyOfArray(rhs.lower_, numberSets_); upper_ = ClpCopyOfArray(rhs.upper_, numberSets_); status_ = ClpCopyOfArray(rhs.status_, numberSets_); saveStatus_ = ClpCopyOfArray(rhs.saveStatus_, numberSets_); savedKeyVariable_ = ClpCopyOfArray(rhs.savedKeyVariable_, numberSets_); int numberColumns = getNumCols(); backward_ = ClpCopyOfArray(rhs.backward_, numberColumns); backToPivotRow_ = ClpCopyOfArray(rhs.backToPivotRow_, numberColumns); changeCost_ = ClpCopyOfArray(rhs.changeCost_, getNumRows() + numberSets_); fromIndex_ = ClpCopyOfArray(rhs.fromIndex_, getNumRows() + numberSets_ + 1); keyVariable_ = ClpCopyOfArray(rhs.keyVariable_, numberSets_); // find longest set int * longest = new int[numberSets_]; CoinZeroN(longest, numberSets_); int j; for (j = 0; j < numberColumns; j++) { int iSet = backward_[j]; if (iSet >= 0) longest[iSet]++; } int length = 0; for (j = 0; j < numberSets_; j++) length = CoinMax(length, longest[j]); next_ = ClpCopyOfArray(rhs.next_, numberColumns + numberSets_ + 2 * length); toIndex_ = ClpCopyOfArray(rhs.toIndex_, numberSets_); sumDualInfeasibilities_ = rhs. sumDualInfeasibilities_; sumPrimalInfeasibilities_ = rhs.sumPrimalInfeasibilities_; sumOfRelaxedDualInfeasibilities_ = rhs.sumOfRelaxedDualInfeasibilities_; sumOfRelaxedPrimalInfeasibilities_ = rhs.sumOfRelaxedPrimalInfeasibilities_; infeasibilityWeight_ = rhs.infeasibilityWeight_; numberDualInfeasibilities_ = rhs.numberDualInfeasibilities_; numberPrimalInfeasibilities_ = rhs.numberPrimalInfeasibilities_; noCheck_ = rhs.noCheck_; firstGub_ = rhs.firstGub_; lastGub_ = rhs.lastGub_; gubType_ = rhs.gubType_; model_ = rhs.model_; } //------------------------------------------------------------------- // assign matrix (for space reasons) //------------------------------------------------------------------- ClpGubMatrix::ClpGubMatrix (CoinPackedMatrix * rhs) : ClpPackedMatrix(rhs), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), infeasibilityWeight_(0.0), start_(NULL), end_(NULL), lower_(NULL), upper_(NULL), status_(NULL), saveStatus_(NULL), savedKeyVariable_(NULL), backward_(NULL), backToPivotRow_(NULL), changeCost_(NULL), keyVariable_(NULL), next_(NULL), toIndex_(NULL), fromIndex_(NULL), model_(NULL), numberDualInfeasibilities_(0), numberPrimalInfeasibilities_(0), noCheck_(-1), numberSets_(0), saveNumber_(0), possiblePivotKey_(0), gubSlackIn_(-1), firstGub_(0), lastGub_(0), gubType_(0) { setType(16); } /* This takes over ownership (for space reasons) and is the real constructor*/ ClpGubMatrix::ClpGubMatrix(ClpPackedMatrix * matrix, int numberSets, const int * start, const int * end, const double * lower, const double * upper, const unsigned char * status) : ClpPackedMatrix(matrix->matrix()), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), numberDualInfeasibilities_(0), numberPrimalInfeasibilities_(0), saveNumber_(0), possiblePivotKey_(0), gubSlackIn_(-1) { model_ = NULL; numberSets_ = numberSets; start_ = ClpCopyOfArray(start, numberSets_); end_ = ClpCopyOfArray(end, numberSets_); lower_ = ClpCopyOfArray(lower, numberSets_); upper_ = ClpCopyOfArray(upper, numberSets_); // Check valid and ordered int last = -1; int numberColumns = matrix_->getNumCols(); int numberRows = matrix_->getNumRows(); backward_ = new int[numberColumns]; backToPivotRow_ = new int[numberColumns]; changeCost_ = new double [numberRows+numberSets_]; keyVariable_ = new int[numberSets_]; // signal to need new ordering next_ = NULL; for (int iColumn = 0; iColumn < numberColumns; iColumn++) backward_[iColumn] = -1; int iSet; for (iSet = 0; iSet < numberSets_; iSet++) { // set key variable as slack keyVariable_[iSet] = iSet + numberColumns; if (start_[iSet] < 0 || start_[iSet] >= numberColumns) throw CoinError("Index out of range", "constructor", "ClpGubMatrix"); if (end_[iSet] < 0 || end_[iSet] > numberColumns) throw CoinError("Index out of range", "constructor", "ClpGubMatrix"); if (end_[iSet] <= start_[iSet]) throw CoinError("Empty or negative set", "constructor", "ClpGubMatrix"); if (start_[iSet] < last) throw CoinError("overlapping or non-monotonic sets", "constructor", "ClpGubMatrix"); last = end_[iSet]; int j; for (j = start_[iSet]; j < end_[iSet]; j++) backward_[j] = iSet; } // Find type of gub firstGub_ = numberColumns + 1; lastGub_ = -1; int i; for (i = 0; i < numberColumns; i++) { if (backward_[i] >= 0) { firstGub_ = CoinMin(firstGub_, i); lastGub_ = CoinMax(lastGub_, i); } } gubType_ = 0; // adjust lastGub_ if (lastGub_ > 0) lastGub_++; for (i = firstGub_; i < lastGub_; i++) { if (backward_[i] < 0) { gubType_ = 1; printf("interior non gub %d\n", i); break; } } if (status) { status_ = ClpCopyOfArray(status, numberSets_); } else { status_ = new unsigned char [numberSets_]; memset(status_, 0, numberSets_); int i; for (i = 0; i < numberSets_; i++) { // make slack key setStatus(i, ClpSimplex::basic); } } saveStatus_ = new unsigned char [numberSets_]; memset(saveStatus_, 0, numberSets_); savedKeyVariable_ = new int [numberSets_]; memset(savedKeyVariable_, 0, numberSets_ * sizeof(int)); noCheck_ = -1; infeasibilityWeight_ = 0.0; } ClpGubMatrix::ClpGubMatrix (const CoinPackedMatrix & rhs) : ClpPackedMatrix(rhs), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), infeasibilityWeight_(0.0), start_(NULL), end_(NULL), lower_(NULL), upper_(NULL), status_(NULL), saveStatus_(NULL), savedKeyVariable_(NULL), backward_(NULL), backToPivotRow_(NULL), changeCost_(NULL), keyVariable_(NULL), next_(NULL), toIndex_(NULL), fromIndex_(NULL), model_(NULL), numberDualInfeasibilities_(0), numberPrimalInfeasibilities_(0), noCheck_(-1), numberSets_(0), saveNumber_(0), possiblePivotKey_(0), gubSlackIn_(-1), firstGub_(0), lastGub_(0), gubType_(0) { setType(16); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpGubMatrix::~ClpGubMatrix () { delete [] start_; delete [] end_; delete [] lower_; delete [] upper_; delete [] status_; delete [] saveStatus_; delete [] savedKeyVariable_; delete [] backward_; delete [] backToPivotRow_; delete [] changeCost_; delete [] keyVariable_; delete [] next_; delete [] toIndex_; delete [] fromIndex_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpGubMatrix & ClpGubMatrix::operator=(const ClpGubMatrix& rhs) { if (this != &rhs) { ClpPackedMatrix::operator=(rhs); delete [] start_; delete [] end_; delete [] lower_; delete [] upper_; delete [] status_; delete [] saveStatus_; delete [] savedKeyVariable_; delete [] backward_; delete [] backToPivotRow_; delete [] changeCost_; delete [] keyVariable_; delete [] next_; delete [] toIndex_; delete [] fromIndex_; numberSets_ = rhs.numberSets_; saveNumber_ = rhs.saveNumber_; possiblePivotKey_ = rhs.possiblePivotKey_; gubSlackIn_ = rhs.gubSlackIn_; start_ = ClpCopyOfArray(rhs.start_, numberSets_); end_ = ClpCopyOfArray(rhs.end_, numberSets_); lower_ = ClpCopyOfArray(rhs.lower_, numberSets_); upper_ = ClpCopyOfArray(rhs.upper_, numberSets_); status_ = ClpCopyOfArray(rhs.status_, numberSets_); saveStatus_ = ClpCopyOfArray(rhs.saveStatus_, numberSets_); savedKeyVariable_ = ClpCopyOfArray(rhs.savedKeyVariable_, numberSets_); int numberColumns = getNumCols(); backward_ = ClpCopyOfArray(rhs.backward_, numberColumns); backToPivotRow_ = ClpCopyOfArray(rhs.backToPivotRow_, numberColumns); changeCost_ = ClpCopyOfArray(rhs.changeCost_, getNumRows() + numberSets_); fromIndex_ = ClpCopyOfArray(rhs.fromIndex_, getNumRows() + numberSets_ + 1); keyVariable_ = ClpCopyOfArray(rhs.keyVariable_, numberSets_); // find longest set int * longest = new int[numberSets_]; CoinZeroN(longest, numberSets_); int j; for (j = 0; j < numberColumns; j++) { int iSet = backward_[j]; if (iSet >= 0) longest[iSet]++; } int length = 0; for (j = 0; j < numberSets_; j++) length = CoinMax(length, longest[j]); next_ = ClpCopyOfArray(rhs.next_, numberColumns + numberSets_ + 2 * length); toIndex_ = ClpCopyOfArray(rhs.toIndex_, numberSets_); sumDualInfeasibilities_ = rhs. sumDualInfeasibilities_; sumPrimalInfeasibilities_ = rhs.sumPrimalInfeasibilities_; sumOfRelaxedDualInfeasibilities_ = rhs.sumOfRelaxedDualInfeasibilities_; sumOfRelaxedPrimalInfeasibilities_ = rhs.sumOfRelaxedPrimalInfeasibilities_; infeasibilityWeight_ = rhs.infeasibilityWeight_; numberDualInfeasibilities_ = rhs.numberDualInfeasibilities_; numberPrimalInfeasibilities_ = rhs.numberPrimalInfeasibilities_; noCheck_ = rhs.noCheck_; firstGub_ = rhs.firstGub_; lastGub_ = rhs.lastGub_; gubType_ = rhs.gubType_; model_ = rhs.model_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpMatrixBase * ClpGubMatrix::clone() const { return new ClpGubMatrix(*this); } /* Subset clone (without gaps). Duplicates are allowed and order is as given */ ClpMatrixBase * ClpGubMatrix::subsetClone (int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const { return new ClpGubMatrix(*this, numberRows, whichRows, numberColumns, whichColumns); } /* Returns a new matrix in reverse order without gaps Is allowed to return NULL if doesn't want to have row copy */ ClpMatrixBase * ClpGubMatrix::reverseOrderedCopy() const { return NULL; } int ClpGubMatrix::hiddenRows() const { return numberSets_; } /* Subset constructor (without gaps). Duplicates are allowed and order is as given */ ClpGubMatrix::ClpGubMatrix ( const ClpGubMatrix & rhs, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) : ClpPackedMatrix(rhs, numberRows, whichRows, numberColumns, whichColumns) { // Assuming no gub rows deleted // We also assume all sets in same order // Get array with backward pointers int numberColumnsOld = rhs.matrix_->getNumCols(); int * array = new int [ numberColumnsOld]; int i; for (i = 0; i < numberColumnsOld; i++) array[i] = -1; for (int iSet = 0; iSet < numberSets_; iSet++) { for (int j = start_[iSet]; j < end_[iSet]; j++) array[j] = iSet; } numberSets_ = -1; int lastSet = -1; bool inSet = false; for (i = 0; i < numberColumns; i++) { int iColumn = whichColumns[i]; int iSet = array[iColumn]; if (iSet < 0) { inSet = false; } else { if (!inSet) { // start of new set but check okay if (iSet <= lastSet) throw CoinError("overlapping or non-monotonic sets", "subset constructor", "ClpGubMatrix"); lastSet = iSet; numberSets_++; start_[numberSets_] = i; end_[numberSets_] = i + 1; lower_[numberSets_] = lower_[iSet]; upper_[numberSets_] = upper_[iSet]; inSet = true; } else { if (iSet < lastSet) { throw CoinError("overlapping or non-monotonic sets", "subset constructor", "ClpGubMatrix"); } else if (iSet == lastSet) { end_[numberSets_] = i + 1; } else { // new set lastSet = iSet; numberSets_++; start_[numberSets_] = i; end_[numberSets_] = i + 1; lower_[numberSets_] = lower_[iSet]; upper_[numberSets_] = upper_[iSet]; } } } } delete [] array; numberSets_++; // adjust // Find type of gub firstGub_ = numberColumns + 1; lastGub_ = -1; for (i = 0; i < numberColumns; i++) { if (backward_[i] >= 0) { firstGub_ = CoinMin(firstGub_, i); lastGub_ = CoinMax(lastGub_, i); } } if (lastGub_ > 0) lastGub_++; gubType_ = 0; for (i = firstGub_; i < lastGub_; i++) { if (backward_[i] < 0) { gubType_ = 1; break; } } // Make sure key is feasible if only key in set } ClpGubMatrix::ClpGubMatrix ( const CoinPackedMatrix & rhs, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) : ClpPackedMatrix(rhs, numberRows, whichRows, numberColumns, whichColumns), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), start_(NULL), end_(NULL), lower_(NULL), upper_(NULL), backward_(NULL), backToPivotRow_(NULL), changeCost_(NULL), keyVariable_(NULL), next_(NULL), toIndex_(NULL), fromIndex_(NULL), numberDualInfeasibilities_(0), numberPrimalInfeasibilities_(0), numberSets_(0), saveNumber_(0), possiblePivotKey_(0), gubSlackIn_(-1), firstGub_(0), lastGub_(0), gubType_(0) { setType(16); } /* Return x * A + y in z. Squashes small elements and knows about ClpSimplex */ void ClpGubMatrix::transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * rowArray, CoinIndexedVector * y, CoinIndexedVector * columnArray) const { columnArray->clear(); double * pi = rowArray->denseVector(); int numberNonZero = 0; int * index = columnArray->getIndices(); double * array = columnArray->denseVector(); int numberInRowArray = rowArray->getNumElements(); // maybe I need one in OsiSimplex double zeroTolerance = model->zeroTolerance(); int numberRows = model->numberRows(); ClpPackedMatrix* rowCopy = dynamic_cast< ClpPackedMatrix*>(model->rowCopy()); bool packed = rowArray->packedMode(); double factor = 0.3; // We may not want to do by row if there may be cache problems int numberColumns = model->numberColumns(); // It would be nice to find L2 cache size - for moment 512K // Be slightly optimistic if (numberColumns * sizeof(double) > 1000000) { if (numberRows * 10 < numberColumns) factor = 0.1; else if (numberRows * 4 < numberColumns) factor = 0.15; else if (numberRows * 2 < numberColumns) factor = 0.2; //if (model->numberIterations()%50==0) //printf("%d nonzero\n",numberInRowArray); } // reduce for gub factor *= 0.5; assert (!y->getNumElements()); if (numberInRowArray > factor * numberRows || !rowCopy) { // do by column int iColumn; // get matrix data pointers const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * elementByColumn = matrix_->getElements(); const double * rowScale = model->rowScale(); int numberColumns = model->numberColumns(); int iSet = -1; double djMod = 0.0; if (packed) { // need to expand pi into y assert(y->capacity() >= numberRows); double * piOld = pi; pi = y->denseVector(); const int * whichRow = rowArray->getIndices(); int i; if (!rowScale) { // modify pi so can collapse to one loop for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = scalar * piOld[i]; } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (backward_[iColumn] != iSet) { // get pi on gub row iSet = backward_[iColumn]; if (iSet >= 0) { int iBasic = keyVariable_[iSet]; if (iBasic < numberColumns) { // get dj without assert (model->getStatus(iBasic) == ClpSimplex::basic); djMod = 0.0; for (CoinBigIndex j = columnStart[iBasic]; j < columnStart[iBasic] + columnLength[iBasic]; j++) { int jRow = row[j]; djMod -= pi[jRow] * elementByColumn[j]; } } else { djMod = 0.0; } } else { djMod = 0.0; } } double value = -djMod; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } else { // scaled // modify pi so can collapse to one loop for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = scalar * piOld[i] * rowScale[iRow]; } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (backward_[iColumn] != iSet) { // get pi on gub row iSet = backward_[iColumn]; if (iSet >= 0) { int iBasic = keyVariable_[iSet]; if (iBasic < numberColumns) { // get dj without assert (model->getStatus(iBasic) == ClpSimplex::basic); djMod = 0.0; // scaled for (CoinBigIndex j = columnStart[iBasic]; j < columnStart[iBasic] + columnLength[iBasic]; j++) { int jRow = row[j]; djMod -= pi[jRow] * elementByColumn[j] * rowScale[jRow]; } } else { djMod = 0.0; } } else { djMod = 0.0; } } double value = -djMod; CoinBigIndex j; const double * columnScale = model->columnScale(); for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } value *= columnScale[iColumn]; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } // zero out for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = 0.0; } } else { // code later assert (packed); if (!rowScale) { if (scalar == -1.0) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = -value; } } } else if (scalar == 1.0) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } value *= scalar; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } } else { // scaled if (scalar == -1.0) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = 0.0; CoinBigIndex j; const double * columnScale = model->columnScale(); for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } value *= columnScale[iColumn]; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = -value; } } } else if (scalar == 1.0) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = 0.0; CoinBigIndex j; const double * columnScale = model->columnScale(); for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } value *= columnScale[iColumn]; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = 0.0; CoinBigIndex j; const double * columnScale = model->columnScale(); for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } value *= scalar * columnScale[iColumn]; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } } } columnArray->setNumElements(numberNonZero); y->setNumElements(0); } else { // do by row transposeTimesByRow(model, scalar, rowArray, y, columnArray); } if (packed) columnArray->setPackedMode(true); if (0) { columnArray->checkClean(); int numberNonZero = columnArray->getNumElements();; int * index = columnArray->getIndices(); double * array = columnArray->denseVector(); int i; for (i = 0; i < numberNonZero; i++) { int j = index[i]; double value; if (packed) value = array[i]; else value = array[j]; printf("Ti %d %d %g\n", i, j, value); } } } /* Return x * A + y in z. Squashes small elements and knows about ClpSimplex */ void ClpGubMatrix::transposeTimesByRow(const ClpSimplex * model, double scalar, const CoinIndexedVector * rowArray, CoinIndexedVector * y, CoinIndexedVector * columnArray) const { // Do packed part ClpPackedMatrix::transposeTimesByRow(model, scalar, rowArray, y, columnArray); if (numberSets_) { /* what we need to do is do by row as normal but get list of sets touched and then update those ones */ abort(); } } /* Return x *A in z but just for indices in y. */ void ClpGubMatrix::subsetTransposeTimes(const ClpSimplex * model, const CoinIndexedVector * rowArray, const CoinIndexedVector * y, CoinIndexedVector * columnArray) const { columnArray->clear(); double * pi = rowArray->denseVector(); double * array = columnArray->denseVector(); int jColumn; // get matrix data pointers const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * elementByColumn = matrix_->getElements(); const double * rowScale = model->rowScale(); int numberToDo = y->getNumElements(); const int * which = y->getIndices(); assert (!rowArray->packedMode()); columnArray->setPacked(); int numberTouched = 0; if (!rowScale) { for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } array[jColumn] = value; if (value) { int iSet = backward_[iColumn]; if (iSet >= 0) { int iBasic = keyVariable_[iSet]; if (iBasic == iColumn) { toIndex_[iSet] = jColumn; fromIndex_[numberTouched++] = iSet; } } } } } else { // scaled for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; double value = 0.0; CoinBigIndex j; const double * columnScale = model->columnScale(); for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } value *= columnScale[iColumn]; array[jColumn] = value; if (value) { int iSet = backward_[iColumn]; if (iSet >= 0) { int iBasic = keyVariable_[iSet]; if (iBasic == iColumn) { toIndex_[iSet] = jColumn; fromIndex_[numberTouched++] = iSet; } } } } } // adjust djs for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; int iSet = backward_[iColumn]; if (iSet >= 0) { int kColumn = toIndex_[iSet]; if (kColumn >= 0) array[jColumn] -= array[kColumn]; } } // and clear basic for (int j = 0; j < numberTouched; j++) { int iSet = fromIndex_[j]; int kColumn = toIndex_[iSet]; toIndex_[iSet] = -1; array[kColumn] = 0.0; } } /// returns number of elements in column part of basis, CoinBigIndex ClpGubMatrix::countBasis(const int * whichColumn, int & numberColumnBasic) { int i; int numberColumns = getNumCols(); const int * columnLength = matrix_->getVectorLengths(); int numberRows = getNumRows(); int numberBasic = 0; CoinBigIndex numberElements = 0; int lastSet = -1; int key = -1; int keyLength = -1; double * work = new double[numberRows]; CoinZeroN(work, numberRows); char * mark = new char[numberRows]; CoinZeroN(mark, numberRows); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * row = matrix_->getIndices(); const double * elementByColumn = matrix_->getElements(); //ClpGubDynamicMatrix* gubx = //dynamic_cast< ClpGubDynamicMatrix*>(this); //int * id = gubx->id(); // just count for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; int iSet = backward_[iColumn]; int length = columnLength[iColumn]; if (iSet < 0 || keyVariable_[iSet] >= numberColumns) { numberElements += length; numberBasic++; //printf("non gub - set %d id %d (column %d) nel %d\n",iSet,id[iColumn-20],iColumn,length); } else { // in gub set if (iColumn != keyVariable_[iSet]) { numberBasic++; CoinBigIndex j; // not key if (lastSet < iSet) { // erase work if (key >= 0) { for (j = columnStart[key]; j < columnStart[key] + keyLength; j++) work[row[j]] = 0.0; } key = keyVariable_[iSet]; lastSet = iSet; keyLength = columnLength[key]; for (j = columnStart[key]; j < columnStart[key] + keyLength; j++) work[row[j]] = elementByColumn[j]; } int extra = keyLength; for (j = columnStart[iColumn]; j < columnStart[iColumn] + length; j++) { int iRow = row[j]; double keyValue = work[iRow]; double value = elementByColumn[j]; if (!keyValue) { if (fabs(value) > 1.0e-20) extra++; } else { value -= keyValue; if (fabs(value) <= 1.0e-20) extra--; } } numberElements += extra; //printf("gub - set %d id %d (column %d) nel %d\n",iSet,id[iColumn-20],iColumn,extra); } } } delete [] work; delete [] mark; // update number of column basic numberColumnBasic = numberBasic; return numberElements; } void ClpGubMatrix::fillBasis(ClpSimplex * model, const int * whichColumn, int & numberColumnBasic, int * indexRowU, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * elementU) { int i; int numberColumns = getNumCols(); const int * columnLength = matrix_->getVectorLengths(); int numberRows = getNumRows(); assert (next_ || !elementU) ; CoinBigIndex numberElements = start[0]; int lastSet = -1; int key = -1; int keyLength = -1; double * work = new double[numberRows]; CoinZeroN(work, numberRows); char * mark = new char[numberRows]; CoinZeroN(mark, numberRows); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * row = matrix_->getIndices(); const double * elementByColumn = matrix_->getElements(); const double * rowScale = model->rowScale(); int numberBasic = 0; if (0) { printf("%d basiccolumns\n", numberColumnBasic); int i; for (i = 0; i < numberSets_; i++) { int k = keyVariable_[i]; if (k < numberColumns) { printf("key %d on set %d, %d elements\n", k, i, columnStart[k+1] - columnStart[k]); for (int j = columnStart[k]; j < columnStart[k+1]; j++) printf("row %d el %g\n", row[j], elementByColumn[j]); } else { printf("slack key on set %d\n", i); } } } // fill if (!rowScale) { // no scaling for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; int iSet = backward_[iColumn]; int length = columnLength[iColumn]; if (0) { int k = iColumn; printf("column %d in set %d, %d elements\n", k, iSet, columnStart[k+1] - columnStart[k]); for (int j = columnStart[k]; j < columnStart[k+1]; j++) printf("row %d el %g\n", row[j], elementByColumn[j]); } CoinBigIndex j; if (iSet < 0 || keyVariable_[iSet] >= numberColumns) { for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { double value = elementByColumn[j]; if (fabs(value) > 1.0e-20) { int iRow = row[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = value; } } // end of column columnCount[numberBasic] = numberElements - start[numberBasic]; numberBasic++; start[numberBasic] = numberElements; } else { // in gub set if (iColumn != keyVariable_[iSet]) { // not key if (lastSet != iSet) { // erase work if (key >= 0) { for (j = columnStart[key]; j < columnStart[key] + keyLength; j++) { int iRow = row[j]; work[iRow] = 0.0; mark[iRow] = 0; } } key = keyVariable_[iSet]; lastSet = iSet; keyLength = columnLength[key]; for (j = columnStart[key]; j < columnStart[key] + keyLength; j++) { int iRow = row[j]; work[iRow] = elementByColumn[j]; mark[iRow] = 1; } } for (j = columnStart[iColumn]; j < columnStart[iColumn] + length; j++) { int iRow = row[j]; double value = elementByColumn[j]; if (mark[iRow]) { mark[iRow] = 0; double keyValue = work[iRow]; value -= keyValue; } if (fabs(value) > 1.0e-20) { indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = value; } } for (j = columnStart[key]; j < columnStart[key] + keyLength; j++) { int iRow = row[j]; if (mark[iRow]) { double value = -work[iRow]; if (fabs(value) > 1.0e-20) { indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = value; } } else { // just put back mark mark[iRow] = 1; } } // end of column columnCount[numberBasic] = numberElements - start[numberBasic]; numberBasic++; start[numberBasic] = numberElements; } } } } else { // scaling const double * columnScale = model->columnScale(); for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; int iSet = backward_[iColumn]; int length = columnLength[iColumn]; CoinBigIndex j; if (iSet < 0 || keyVariable_[iSet] >= numberColumns) { double scale = columnScale[iColumn]; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = elementByColumn[j] * scale * rowScale[iRow]; if (fabs(value) > 1.0e-20) { indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = value; } } // end of column columnCount[numberBasic] = numberElements - start[numberBasic]; numberBasic++; start[numberBasic] = numberElements; } else { // in gub set if (iColumn != keyVariable_[iSet]) { double scale = columnScale[iColumn]; // not key if (lastSet < iSet) { // erase work if (key >= 0) { for (j = columnStart[key]; j < columnStart[key] + keyLength; j++) { int iRow = row[j]; work[iRow] = 0.0; mark[iRow] = 0; } } key = keyVariable_[iSet]; lastSet = iSet; keyLength = columnLength[key]; double scale = columnScale[key]; for (j = columnStart[key]; j < columnStart[key] + keyLength; j++) { int iRow = row[j]; work[iRow] = elementByColumn[j] * scale * rowScale[iRow]; mark[iRow] = 1; } } for (j = columnStart[iColumn]; j < columnStart[iColumn] + length; j++) { int iRow = row[j]; double value = elementByColumn[j] * scale * rowScale[iRow]; if (mark[iRow]) { mark[iRow] = 0; double keyValue = work[iRow]; value -= keyValue; } if (fabs(value) > 1.0e-20) { indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = value; } } for (j = columnStart[key]; j < columnStart[key] + keyLength; j++) { int iRow = row[j]; if (mark[iRow]) { double value = -work[iRow]; if (fabs(value) > 1.0e-20) { indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = value; } } else { // just put back mark mark[iRow] = 1; } } // end of column columnCount[numberBasic] = numberElements - start[numberBasic]; numberBasic++; start[numberBasic] = numberElements; } } } } delete [] work; delete [] mark; // update number of column basic numberColumnBasic = numberBasic; } /* Unpacks a column into an CoinIndexedvector */ void ClpGubMatrix::unpack(const ClpSimplex * model, CoinIndexedVector * rowArray, int iColumn) const { assert (iColumn < model->numberColumns()); // Do packed part ClpPackedMatrix::unpack(model, rowArray, iColumn); int iSet = backward_[iColumn]; if (iSet >= 0) { int iBasic = keyVariable_[iSet]; if (iBasic < model->numberColumns()) { add(model, rowArray, iBasic, -1.0); } } } /* Unpacks a column into a CoinIndexedVector ** in packed format Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ void ClpGubMatrix::unpackPacked(ClpSimplex * model, CoinIndexedVector * rowArray, int iColumn) const { int numberColumns = model->numberColumns(); if (iColumn < numberColumns) { // Do packed part ClpPackedMatrix::unpackPacked(model, rowArray, iColumn); int iSet = backward_[iColumn]; if (iSet >= 0) { // columns are in order int iBasic = keyVariable_[iSet]; if (iBasic < numberColumns) { int number = rowArray->getNumElements(); const double * rowScale = model->rowScale(); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * elementByColumn = matrix_->getElements(); double * array = rowArray->denseVector(); int * index = rowArray->getIndices(); CoinBigIndex i; int numberOld = number; int lastIndex = 0; int next = index[lastIndex]; if (!rowScale) { for (i = columnStart[iBasic]; i < columnStart[iBasic] + columnLength[iBasic]; i++) { int iRow = row[i]; while (iRow > next) { lastIndex++; if (lastIndex == numberOld) next = matrix_->getNumRows(); else next = index[lastIndex]; } if (iRow < next) { array[number] = -elementByColumn[i]; index[number++] = iRow; } else { assert (iRow == next); array[lastIndex] -= elementByColumn[i]; if (!array[lastIndex]) array[lastIndex] = 1.0e-100; } } } else { // apply scaling double scale = model->columnScale()[iBasic]; for (i = columnStart[iBasic]; i < columnStart[iBasic] + columnLength[iBasic]; i++) { int iRow = row[i]; while (iRow > next) { lastIndex++; if (lastIndex == numberOld) next = matrix_->getNumRows(); else next = index[lastIndex]; } if (iRow < next) { array[number] = -elementByColumn[i] * scale * rowScale[iRow]; index[number++] = iRow; } else { assert (iRow == next); array[lastIndex] -= elementByColumn[i] * scale * rowScale[iRow]; if (!array[lastIndex]) array[lastIndex] = 1.0e-100; } } } rowArray->setNumElements(number); } } } else { // key slack entering int iBasic = keyVariable_[gubSlackIn_]; assert (iBasic < numberColumns); int number = 0; const double * rowScale = model->rowScale(); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * elementByColumn = matrix_->getElements(); double * array = rowArray->denseVector(); int * index = rowArray->getIndices(); CoinBigIndex i; if (!rowScale) { for (i = columnStart[iBasic]; i < columnStart[iBasic] + columnLength[iBasic]; i++) { int iRow = row[i]; array[number] = elementByColumn[i]; index[number++] = iRow; } } else { // apply scaling double scale = model->columnScale()[iBasic]; for (i = columnStart[iBasic]; i < columnStart[iBasic] + columnLength[iBasic]; i++) { int iRow = row[i]; array[number] = elementByColumn[i] * scale * rowScale[iRow]; index[number++] = iRow; } } rowArray->setNumElements(number); rowArray->setPacked(); } } /* Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ void ClpGubMatrix::add(const ClpSimplex * model, CoinIndexedVector * rowArray, int iColumn, double multiplier) const { assert (iColumn < model->numberColumns()); // Do packed part ClpPackedMatrix::add(model, rowArray, iColumn, multiplier); int iSet = backward_[iColumn]; if (iSet >= 0 && iColumn != keyVariable_[iSet]) { ClpPackedMatrix::add(model, rowArray, keyVariable_[iSet], -multiplier); } } /* Adds multiple of a column into an array */ void ClpGubMatrix::add(const ClpSimplex * model, double * array, int iColumn, double multiplier) const { assert (iColumn < model->numberColumns()); // Do packed part ClpPackedMatrix::add(model, array, iColumn, multiplier); if (iColumn < model->numberColumns()) { int iSet = backward_[iColumn]; if (iSet >= 0 && iColumn != keyVariable_[iSet] && keyVariable_[iSet] < model->numberColumns()) { ClpPackedMatrix::add(model, array, keyVariable_[iSet], -multiplier); } } } // Partial pricing void ClpGubMatrix::partialPricing(ClpSimplex * model, double startFraction, double endFraction, int & bestSequence, int & numberWanted) { numberWanted = currentWanted_; if (numberSets_) { // Do packed part before gub int numberColumns = matrix_->getNumCols(); double ratio = static_cast (firstGub_) / static_cast (numberColumns); ClpPackedMatrix::partialPricing(model, startFraction * ratio, endFraction * ratio, bestSequence, numberWanted); if (numberWanted || minimumGoodReducedCosts_ < -1) { // do gub const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); const double * rowScale = model->rowScale(); const double * columnScale = model->columnScale(); int iSequence; CoinBigIndex j; double tolerance = model->currentDualTolerance(); double * reducedCost = model->djRegion(); const double * duals = model->dualRowSolution(); const double * cost = model->costRegion(); double bestDj; int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); if (bestSequence >= 0) bestDj = fabs(this->reducedCost(model, bestSequence)); else bestDj = tolerance; int sequenceOut = model->sequenceOut(); int saveSequence = bestSequence; int startG = firstGub_ + static_cast (startFraction * (lastGub_ - firstGub_)); int endG = firstGub_ + static_cast (endFraction * (lastGub_ - firstGub_)); endG = CoinMin(lastGub_, endG + 1); // If nothing found yet can go all the way to end int endAll = endG; if (bestSequence < 0 && !startG) endAll = lastGub_; int minSet = minimumObjectsScan_ < 0 ? 5 : minimumObjectsScan_; int minNeg = minimumGoodReducedCosts_ == -1 ? 5 : minimumGoodReducedCosts_; int nSets = 0; int iSet = -1; double djMod = 0.0; double infeasibilityCost = model->infeasibilityCost(); if (rowScale) { double bestDjMod = 0.0; // scaled for (iSequence = startG; iSequence < endAll; iSequence++) { if (numberWanted + minNeg < originalWanted_ && nSets > minSet) { // give up numberWanted = 0; break; } else if (iSequence == endG && bestSequence >= 0) { break; } if (backward_[iSequence] != iSet) { // get pi on gub row iSet = backward_[iSequence]; if (iSet >= 0) { nSets++; int iBasic = keyVariable_[iSet]; if (iBasic >= numberColumns) { djMod = - weight(iSet) * infeasibilityCost; } else { // get dj without assert (model->getStatus(iBasic) == ClpSimplex::basic); djMod = 0.0; // scaled for (j = startColumn[iBasic]; j < startColumn[iBasic] + length[iBasic]; j++) { int jRow = row[j]; djMod -= duals[jRow] * element[j] * rowScale[jRow]; } // allow for scaling djMod += cost[iBasic] / columnScale[iBasic]; // See if gub slack possible - dj is djMod if (getStatus(iSet) == ClpSimplex::atLowerBound) { double value = -djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = numberRows + numberColumns + iSet; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } else if (getStatus(iSet) == ClpSimplex::atUpperBound) { double value = djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = numberRows + numberColumns + iSet; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } } } else { // not in set djMod = 0.0; } } if (iSequence != sequenceOut) { double value; ClpSimplex::Status status = model->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = -djMod; // scaled for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j] * rowScale[jRow]; } value = fabs(cost[iSequence] + value * columnScale[iSequence]); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atUpperBound: value = -djMod; // scaled for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j] * rowScale[jRow]; } value = cost[iSequence] + value * columnScale[iSequence]; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atLowerBound: value = -djMod; // scaled for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j] * rowScale[jRow]; } value = -(cost[iSequence] + value * columnScale[iSequence]); if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (!numberWanted) break; } if (bestSequence != saveSequence) { if (bestSequence < numberRows + numberColumns) { // recompute dj double value = bestDjMod; // scaled for (j = startColumn[bestSequence]; j < startColumn[bestSequence] + length[bestSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j] * rowScale[jRow]; } reducedCost[bestSequence] = cost[bestSequence] + value * columnScale[bestSequence]; gubSlackIn_ = -1; } else { // slack - make last column gubSlackIn_ = bestSequence - numberRows - numberColumns; bestSequence = numberColumns + 2 * numberRows; reducedCost[bestSequence] = bestDjMod; model->setStatus(bestSequence, getStatus(gubSlackIn_)); if (getStatus(gubSlackIn_) == ClpSimplex::atUpperBound) model->solutionRegion()[bestSequence] = upper_[gubSlackIn_]; else model->solutionRegion()[bestSequence] = lower_[gubSlackIn_]; model->lowerRegion()[bestSequence] = lower_[gubSlackIn_]; model->upperRegion()[bestSequence] = upper_[gubSlackIn_]; model->costRegion()[bestSequence] = 0.0; } savedBestSequence_ = bestSequence; savedBestDj_ = reducedCost[savedBestSequence_]; } } else { double bestDjMod = 0.0; //printf("iteration %d start %d end %d - wanted %d\n",model->numberIterations(), // startG,endG,numberWanted); for (iSequence = startG; iSequence < endG; iSequence++) { if (numberWanted + minNeg < originalWanted_ && nSets > minSet) { // give up numberWanted = 0; break; } else if (iSequence == endG && bestSequence >= 0) { break; } if (backward_[iSequence] != iSet) { // get pi on gub row iSet = backward_[iSequence]; if (iSet >= 0) { nSets++; int iBasic = keyVariable_[iSet]; if (iBasic >= numberColumns) { djMod = - weight(iSet) * infeasibilityCost; } else { // get dj without assert (model->getStatus(iBasic) == ClpSimplex::basic); djMod = 0.0; for (j = startColumn[iBasic]; j < startColumn[iBasic] + length[iBasic]; j++) { int jRow = row[j]; djMod -= duals[jRow] * element[j]; } djMod += cost[iBasic]; // See if gub slack possible - dj is djMod if (getStatus(iSet) == ClpSimplex::atLowerBound) { double value = -djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = numberRows + numberColumns + iSet; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } else if (getStatus(iSet) == ClpSimplex::atUpperBound) { double value = djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = numberRows + numberColumns + iSet; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } } } else { // not in set djMod = 0.0; } } if (iSequence != sequenceOut) { double value; ClpSimplex::Status status = model->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = cost[iSequence] - djMod; for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j]; } value = fabs(value); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atUpperBound: value = cost[iSequence] - djMod; for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j]; } if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atLowerBound: value = cost[iSequence] - djMod; for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j]; } value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; bestDjMod = djMod; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (!numberWanted) break; } if (bestSequence != saveSequence) { if (bestSequence < numberRows + numberColumns) { // recompute dj double value = cost[bestSequence] - bestDjMod; for (j = startColumn[bestSequence]; j < startColumn[bestSequence] + length[bestSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j]; } //printf("price struct %d - dj %g gubpi %g\n",bestSequence,value,bestDjMod); reducedCost[bestSequence] = value; gubSlackIn_ = -1; } else { // slack - make last column gubSlackIn_ = bestSequence - numberRows - numberColumns; bestSequence = numberColumns + 2 * numberRows; reducedCost[bestSequence] = bestDjMod; //printf("price slack %d - gubpi %g\n",gubSlackIn_,bestDjMod); model->setStatus(bestSequence, getStatus(gubSlackIn_)); if (getStatus(gubSlackIn_) == ClpSimplex::atUpperBound) model->solutionRegion()[bestSequence] = upper_[gubSlackIn_]; else model->solutionRegion()[bestSequence] = lower_[gubSlackIn_]; model->lowerRegion()[bestSequence] = lower_[gubSlackIn_]; model->upperRegion()[bestSequence] = upper_[gubSlackIn_]; model->costRegion()[bestSequence] = 0.0; } } } // See if may be finished if (startG == firstGub_ && bestSequence < 0) infeasibilityWeight_ = model_->infeasibilityCost(); else if (bestSequence >= 0) infeasibilityWeight_ = -1.0; } if (numberWanted) { // Do packed part after gub double offset = static_cast (lastGub_) / static_cast (numberColumns); double ratio = static_cast (numberColumns) / static_cast (numberColumns) - offset; double start2 = offset + ratio * startFraction; double end2 = CoinMin(1.0, offset + ratio * endFraction + 1.0e-6); ClpPackedMatrix::partialPricing(model, start2, end2, bestSequence, numberWanted); } } else { // no gub ClpPackedMatrix::partialPricing(model, startFraction, endFraction, bestSequence, numberWanted); } if (bestSequence >= 0) infeasibilityWeight_ = -1.0; // not optimal currentWanted_ = numberWanted; } /* expands an updated column to allow for extra rows which the main solver does not know about and returns number added. */ int ClpGubMatrix::extendUpdated(ClpSimplex * model, CoinIndexedVector * update, int mode) { // I think we only need to bother about sets with two in basis or incoming set int number = update->getNumElements(); double * array = update->denseVector(); int * index = update->getIndices(); int i; assert (!number || update->packedMode()); int * pivotVariable = model->pivotVariable(); int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); int numberTotal = numberRows + numberColumns; int sequenceIn = model->sequenceIn(); int returnCode = 0; int iSetIn; if (sequenceIn < numberColumns) { iSetIn = backward_[sequenceIn]; gubSlackIn_ = -1; // in case set } else if (sequenceIn < numberRows + numberColumns) { iSetIn = -1; gubSlackIn_ = -1; // in case set } else { iSetIn = gubSlackIn_; } double * lower = model->lowerRegion(); double * upper = model->upperRegion(); double * cost = model->costRegion(); double * solution = model->solutionRegion(); int number2 = number; if (!mode) { double primalTolerance = model->primalTolerance(); double infeasibilityCost = model->infeasibilityCost(); // extend saveNumber_ = number; for (i = 0; i < number; i++) { int iRow = index[i]; int iPivot = pivotVariable[iRow]; if (iPivot < numberColumns) { int iSet = backward_[iPivot]; if (iSet >= 0) { // two (or more) in set int iIndex = toIndex_[iSet]; double otherValue = array[i]; double value; if (iIndex < 0) { toIndex_[iSet] = number2; int iNew = number2 - number; fromIndex_[number2-number] = iSet; iIndex = number2; index[number2] = numberRows + iNew; // do key stuff int iKey = keyVariable_[iSet]; if (iKey < numberColumns) { // Save current cost of key changeCost_[number2-number] = cost[iKey]; if (iSet != iSetIn) value = 0.0; else if (iSetIn != gubSlackIn_) value = 1.0; else value = -1.0; pivotVariable[numberRows+iNew] = iKey; // Do I need to recompute? double sol; assert (getStatus(iSet) != ClpSimplex::basic); if (getStatus(iSet) == ClpSimplex::atLowerBound) sol = lower_[iSet]; else sol = upper_[iSet]; if ((gubType_ & 8) != 0) { int iColumn = next_[iKey]; // sum all non-key variables while(iColumn >= 0) { sol -= solution[iColumn]; iColumn = next_[iColumn]; } } else { int stop = -(iKey + 1); int iColumn = next_[iKey]; // sum all non-key variables while(iColumn != stop) { if (iColumn < 0) iColumn = -iColumn - 1; sol -= solution[iColumn]; iColumn = next_[iColumn]; } } solution[iKey] = sol; if (model->algorithm() > 0) model->nonLinearCost()->setOne(iKey, sol); //assert (fabs(sol-solution[iKey])<1.0e-3); } else { // gub slack is basic // Save current cost of key changeCost_[number2-number] = -weight(iSet) * infeasibilityCost; otherValue = - otherValue; //allow for - sign on slack if (iSet != iSetIn) value = 0.0; else value = -1.0; pivotVariable[numberRows+iNew] = iNew + numberTotal; model->djRegion()[iNew+numberTotal] = 0.0; double sol = 0.0; if ((gubType_ & 8) != 0) { int iColumn = next_[iKey]; // sum all non-key variables while(iColumn >= 0) { sol += solution[iColumn]; iColumn = next_[iColumn]; } } else { int stop = -(iKey + 1); int iColumn = next_[iKey]; // sum all non-key variables while(iColumn != stop) { if (iColumn < 0) iColumn = -iColumn - 1; sol += solution[iColumn]; iColumn = next_[iColumn]; } } solution[iNew+numberTotal] = sol; // and do cost in nonLinearCost if (model->algorithm() > 0) model->nonLinearCost()->setOne(iNew + numberTotal, sol, lower_[iSet], upper_[iSet]); if (sol > upper_[iSet] + primalTolerance) { setAbove(iSet); lower[iNew+numberTotal] = upper_[iSet]; upper[iNew+numberTotal] = COIN_DBL_MAX; } else if (sol < lower_[iSet] - primalTolerance) { setBelow(iSet); lower[iNew+numberTotal] = -COIN_DBL_MAX; upper[iNew+numberTotal] = lower_[iSet]; } else { setFeasible(iSet); lower[iNew+numberTotal] = lower_[iSet]; upper[iNew+numberTotal] = upper_[iSet]; } cost[iNew+numberTotal] = weight(iSet) * infeasibilityCost; } number2++; } else { value = array[iIndex]; int iKey = keyVariable_[iSet]; if (iKey >= numberColumns) otherValue = - otherValue; //allow for - sign on slack } value -= otherValue; array[iIndex] = value; } } } if (iSetIn >= 0 && toIndex_[iSetIn] < 0) { // Do incoming update->setPacked(); // just in case no elements toIndex_[iSetIn] = number2; int iNew = number2 - number; fromIndex_[number2-number] = iSetIn; // Save current cost of key double currentCost; int key = keyVariable_[iSetIn]; if (key < numberColumns) currentCost = cost[key]; else currentCost = -weight(iSetIn) * infeasibilityCost; changeCost_[number2-number] = currentCost; index[number2] = numberRows + iNew; // do key stuff int iKey = keyVariable_[iSetIn]; if (iKey < numberColumns) { if (gubSlackIn_ < 0) array[number2] = 1.0; else array[number2] = -1.0; pivotVariable[numberRows+iNew] = iKey; // Do I need to recompute? double sol; assert (getStatus(iSetIn) != ClpSimplex::basic); if (getStatus(iSetIn) == ClpSimplex::atLowerBound) sol = lower_[iSetIn]; else sol = upper_[iSetIn]; if ((gubType_ & 8) != 0) { int iColumn = next_[iKey]; // sum all non-key variables while(iColumn >= 0) { sol -= solution[iColumn]; iColumn = next_[iColumn]; } } else { // bounds exist - sum over all except key int stop = -(iKey + 1); int iColumn = next_[iKey]; // sum all non-key variables while(iColumn != stop) { if (iColumn < 0) iColumn = -iColumn - 1; sol -= solution[iColumn]; iColumn = next_[iColumn]; } } solution[iKey] = sol; if (model->algorithm() > 0) model->nonLinearCost()->setOne(iKey, sol); //assert (fabs(sol-solution[iKey])<1.0e-3); } else { // gub slack is basic array[number2] = -1.0; pivotVariable[numberRows+iNew] = iNew + numberTotal; model->djRegion()[iNew+numberTotal] = 0.0; double sol = 0.0; if ((gubType_ & 8) != 0) { int iColumn = next_[iKey]; // sum all non-key variables while(iColumn >= 0) { sol += solution[iColumn]; iColumn = next_[iColumn]; } } else { // bounds exist - sum over all except key int stop = -(iKey + 1); int iColumn = next_[iKey]; // sum all non-key variables while(iColumn != stop) { if (iColumn < 0) iColumn = -iColumn - 1; sol += solution[iColumn]; iColumn = next_[iColumn]; } } solution[iNew+numberTotal] = sol; // and do cost in nonLinearCost if (model->algorithm() > 0) model->nonLinearCost()->setOne(iNew + numberTotal, sol, lower_[iSetIn], upper_[iSetIn]); if (sol > upper_[iSetIn] + primalTolerance) { setAbove(iSetIn); lower[iNew+numberTotal] = upper_[iSetIn]; upper[iNew+numberTotal] = COIN_DBL_MAX; } else if (sol < lower_[iSetIn] - primalTolerance) { setBelow(iSetIn); lower[iNew+numberTotal] = -COIN_DBL_MAX; upper[iNew+numberTotal] = lower_[iSetIn]; } else { setFeasible(iSetIn); lower[iNew+numberTotal] = lower_[iSetIn]; upper[iNew+numberTotal] = upper_[iSetIn]; } cost[iNew+numberTotal] = weight(iSetIn) * infeasibilityCost; } number2++; } // mark end fromIndex_[number2-number] = -1; returnCode = number2 - number; // make sure lower_ upper_ adjusted synchronize(model, 9); } else { // take off? if (number > saveNumber_) { // clear double theta = model->theta(); double * solution = model->solutionRegion(); for (i = saveNumber_; i < number; i++) { int iRow = index[i]; int iColumn = pivotVariable[iRow]; #ifdef CLP_DEBUG_PRINT printf("Column %d (set %d) lower %g, upper %g - alpha %g - old value %g, new %g (theta %g)\n", iColumn, fromIndex_[i-saveNumber_], lower[iColumn], upper[iColumn], array[i], solution[iColumn], solution[iColumn] - model->theta()*array[i], model->theta()); #endif double value = array[i]; array[i] = 0.0; int iSet = fromIndex_[i-saveNumber_]; toIndex_[iSet] = -1; if (iSet == iSetIn && iColumn < numberColumns) { // update as may need value solution[iColumn] -= theta * value; } } } #ifdef CLP_DEBUG for (i = 0; i < numberSets_; i++) assert(toIndex_[i] == -1); #endif number2 = saveNumber_; } update->setNumElements(number2); return returnCode; } /* utility primal function for dealing with dynamic constraints mode=n see ClpGubMatrix.hpp for definition Remember to update here when settled down */ void ClpGubMatrix::primalExpanded(ClpSimplex * model, int mode) { int numberColumns = model->numberColumns(); switch (mode) { // If key variable then slot in gub rhs so will get correct contribution case 0: { int i; double * solution = model->solutionRegion(); ClpSimplex::Status iStatus; for (i = 0; i < numberSets_; i++) { int iColumn = keyVariable_[i]; if (iColumn < numberColumns) { // key is structural - where is slack iStatus = getStatus(i); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) solution[iColumn] = lower_[i]; else solution[iColumn] = upper_[i]; } } } break; // Compute values of key variables case 1: { int i; double * solution = model->solutionRegion(); //const int * columnLength = matrix_->getVectorLengths(); //const CoinBigIndex * columnStart = matrix_->getVectorStarts(); //const int * row = matrix_->getIndices(); //const double * elementByColumn = matrix_->getElements(); //int * pivotVariable = model->pivotVariable(); sumPrimalInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; double primalTolerance = model->primalTolerance(); double relaxedTolerance = primalTolerance; // we can't really trust infeasibilities if there is primal error double error = CoinMin(1.0e-2, model->largestPrimalError()); // allow tolerance at least slightly bigger than standard relaxedTolerance = relaxedTolerance + error; // but we will be using difference relaxedTolerance -= primalTolerance; sumOfRelaxedPrimalInfeasibilities_ = 0.0; for (i = 0; i < numberSets_; i++) { // Could just be over basics (esp if no bounds) int kColumn = keyVariable_[i]; double value = 0.0; if ((gubType_ & 8) != 0) { int iColumn = next_[kColumn]; // sum all non-key variables while(iColumn >= 0) { value += solution[iColumn]; iColumn = next_[iColumn]; } } else { // bounds exist - sum over all except key int stop = -(kColumn + 1); int iColumn = next_[kColumn]; // sum all non-key variables while(iColumn != stop) { if (iColumn < 0) iColumn = -iColumn - 1; value += solution[iColumn]; iColumn = next_[iColumn]; } } if (kColumn < numberColumns) { // make sure key is basic - so will be skipped in values pass model->setStatus(kColumn, ClpSimplex::basic); // feasibility will be done later assert (getStatus(i) != ClpSimplex::basic); if (getStatus(i) == ClpSimplex::atUpperBound) solution[kColumn] = upper_[i] - value; else solution[kColumn] = lower_[i] - value; //printf("Value of key structural %d for set %d is %g\n",kColumn,i,solution[kColumn]); } else { // slack is key assert (getStatus(i) == ClpSimplex::basic); double infeasibility = 0.0; if (value > upper_[i] + primalTolerance) { infeasibility = value - upper_[i] - primalTolerance; setAbove(i); } else if (value < lower_[i] - primalTolerance) { infeasibility = lower_[i] - value - primalTolerance ; setBelow(i); } else { setFeasible(i); } //printf("Value of key slack for set %d is %g\n",i,value); if (infeasibility > 0.0) { sumPrimalInfeasibilities_ += infeasibility; if (infeasibility > relaxedTolerance) sumOfRelaxedPrimalInfeasibilities_ += infeasibility; numberPrimalInfeasibilities_ ++; } } } } break; // Report on infeasibilities of key variables case 2: { model->setSumPrimalInfeasibilities(model->sumPrimalInfeasibilities() + sumPrimalInfeasibilities_); model->setNumberPrimalInfeasibilities(model->numberPrimalInfeasibilities() + numberPrimalInfeasibilities_); model->setSumOfRelaxedPrimalInfeasibilities(model->sumOfRelaxedPrimalInfeasibilities() + sumOfRelaxedPrimalInfeasibilities_); } break; } } /* utility dual function for dealing with dynamic constraints mode=n see ClpGubMatrix.hpp for definition Remember to update here when settled down */ void ClpGubMatrix::dualExpanded(ClpSimplex * model, CoinIndexedVector * array, double * /*other*/, int mode) { switch (mode) { // modify costs before transposeUpdate case 0: { int i; double * cost = model->costRegion(); // not dual values yet //assert (!other); //double * work = array->denseVector(); double infeasibilityCost = model->infeasibilityCost(); int * pivotVariable = model->pivotVariable(); int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot < numberColumns) { int iSet = backward_[iPivot]; if (iSet >= 0) { int kColumn = keyVariable_[iSet]; double costValue; if (kColumn < numberColumns) { // structural has cost costValue = cost[kColumn]; } else { // slack is key assert (getStatus(iSet) == ClpSimplex::basic); // negative as -1.0 for slack costValue = -weight(iSet) * infeasibilityCost; } array->add(i, -costValue); // was work[i]-costValue } } } } break; // create duals for key variables (without check on dual infeasible) case 1: { // If key slack then dual 0.0 (if feasible) // dj for key is zero so that defines dual on set int i; double * dj = model->djRegion(); int numberColumns = model->numberColumns(); double infeasibilityCost = model->infeasibilityCost(); for (i = 0; i < numberSets_; i++) { int kColumn = keyVariable_[i]; if (kColumn < numberColumns) { // dj without set double value = dj[kColumn]; // Now subtract out from all dj[kColumn] = 0.0; int iColumn = next_[kColumn]; // modify all non-key variables while(iColumn >= 0) { dj[iColumn] -= value; iColumn = next_[iColumn]; } } else { // slack key - may not be feasible assert (getStatus(i) == ClpSimplex::basic); // negative as -1.0 for slack double value = -weight(i) * infeasibilityCost; if (value) { int iColumn = next_[kColumn]; // modify all non-key variables basic while(iColumn >= 0) { dj[iColumn] -= value; iColumn = next_[iColumn]; } } } } } break; // as 1 but check slacks and compute djs case 2: { // If key slack then dual 0.0 // If not then slack could be dual infeasible // dj for key is zero so that defines dual on set int i; // make sure fromIndex will not confuse pricing fromIndex_[0] = -1; possiblePivotKey_ = -1; // Create array int numberColumns = model->numberColumns(); int * pivotVariable = model->pivotVariable(); int numberRows = model->numberRows(); for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot < numberColumns) backToPivotRow_[iPivot] = i; } if (noCheck_ >= 0) { if (infeasibilityWeight_ != model->infeasibilityCost()) { // don't bother checking sumDualInfeasibilities_ = 100.0; numberDualInfeasibilities_ = 1; sumOfRelaxedDualInfeasibilities_ = 100.0; return; } } double * dj = model->djRegion(); double * dual = model->dualRowSolution(); double * cost = model->costRegion(); ClpSimplex::Status iStatus; const int * columnLength = matrix_->getVectorLengths(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * row = matrix_->getIndices(); const double * elementByColumn = matrix_->getElements(); double infeasibilityCost = model->infeasibilityCost(); sumDualInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; double dualTolerance = model->dualTolerance(); double relaxedTolerance = dualTolerance; // we can't really trust infeasibilities if there is dual error double error = CoinMin(1.0e-2, model->largestDualError()); // allow tolerance at least slightly bigger than standard relaxedTolerance = relaxedTolerance + error; // but we will be using difference relaxedTolerance -= dualTolerance; sumOfRelaxedDualInfeasibilities_ = 0.0; for (i = 0; i < numberSets_; i++) { int kColumn = keyVariable_[i]; if (kColumn < numberColumns) { // dj without set double value = cost[kColumn]; for (CoinBigIndex j = columnStart[kColumn]; j < columnStart[kColumn] + columnLength[kColumn]; j++) { int iRow = row[j]; value -= dual[iRow] * elementByColumn[j]; } // Now subtract out from all dj[kColumn] -= value; int stop = -(kColumn + 1); kColumn = next_[kColumn]; while (kColumn != stop) { if (kColumn < 0) kColumn = -kColumn - 1; double djValue = dj[kColumn] - value; dj[kColumn] = djValue;; double infeasibility = 0.0; iStatus = model->getStatus(kColumn); if (iStatus == ClpSimplex::atLowerBound) { if (djValue < -dualTolerance) infeasibility = -djValue - dualTolerance; } else if (iStatus == ClpSimplex::atUpperBound) { // at upper bound if (djValue > dualTolerance) infeasibility = djValue - dualTolerance; } if (infeasibility > 0.0) { sumDualInfeasibilities_ += infeasibility; if (infeasibility > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += infeasibility; numberDualInfeasibilities_ ++; } kColumn = next_[kColumn]; } // check slack iStatus = getStatus(i); assert (iStatus != ClpSimplex::basic); double infeasibility = 0.0; // dj of slack is -(-1.0)value if (iStatus == ClpSimplex::atLowerBound) { if (value < -dualTolerance) infeasibility = -value - dualTolerance; } else if (iStatus == ClpSimplex::atUpperBound) { // at upper bound if (value > dualTolerance) infeasibility = value - dualTolerance; } if (infeasibility > 0.0) { sumDualInfeasibilities_ += infeasibility; if (infeasibility > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += infeasibility; numberDualInfeasibilities_ ++; } } else { // slack key - may not be feasible assert (getStatus(i) == ClpSimplex::basic); // negative as -1.0 for slack double value = -weight(i) * infeasibilityCost; if (value) { // Now subtract out from all int kColumn = i + numberColumns; int stop = -(kColumn + 1); kColumn = next_[kColumn]; while (kColumn != stop) { if (kColumn < 0) kColumn = -kColumn - 1; double djValue = dj[kColumn] - value; dj[kColumn] = djValue;; double infeasibility = 0.0; iStatus = model->getStatus(kColumn); if (iStatus == ClpSimplex::atLowerBound) { if (djValue < -dualTolerance) infeasibility = -djValue - dualTolerance; } else if (iStatus == ClpSimplex::atUpperBound) { // at upper bound if (djValue > dualTolerance) infeasibility = djValue - dualTolerance; } if (infeasibility > 0.0) { sumDualInfeasibilities_ += infeasibility; if (infeasibility > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += infeasibility; numberDualInfeasibilities_ ++; } kColumn = next_[kColumn]; } } } } // and get statistics for column generation synchronize(model, 4); infeasibilityWeight_ = -1.0; } break; // Report on infeasibilities of key variables case 3: { model->setSumDualInfeasibilities(model->sumDualInfeasibilities() + sumDualInfeasibilities_); model->setNumberDualInfeasibilities(model->numberDualInfeasibilities() + numberDualInfeasibilities_); model->setSumOfRelaxedDualInfeasibilities(model->sumOfRelaxedDualInfeasibilities() + sumOfRelaxedDualInfeasibilities_); } break; // modify costs before transposeUpdate for partial pricing case 4: { // First compute new costs etc for interesting gubs int iLook = 0; int iSet = fromIndex_[0]; double primalTolerance = model->primalTolerance(); const double * cost = model->costRegion(); double * solution = model->solutionRegion(); double infeasibilityCost = model->infeasibilityCost(); int numberColumns = model->numberColumns(); int numberChanged = 0; int * pivotVariable = model->pivotVariable(); while (iSet >= 0) { int key = keyVariable_[iSet]; double value = 0.0; // sum over all except key if ((gubType_ & 8) != 0) { int iColumn = next_[key]; // sum all non-key variables while(iColumn >= 0) { value += solution[iColumn]; iColumn = next_[iColumn]; } } else { // bounds exist - sum over all except key int stop = -(key + 1); int iColumn = next_[key]; // sum all non-key variables while(iColumn != stop) { if (iColumn < 0) iColumn = -iColumn - 1; value += solution[iColumn]; iColumn = next_[iColumn]; } } double costChange; double oldCost = changeCost_[iLook]; if (key < numberColumns) { assert (getStatus(iSet) != ClpSimplex::basic); double sol; if (getStatus(iSet) == ClpSimplex::atUpperBound) sol = upper_[iSet] - value; else sol = lower_[iSet] - value; solution[key] = sol; // fix up cost model->nonLinearCost()->setOne(key, sol); #ifdef CLP_DEBUG_PRINT printf("yy Value of key structural %d for set %d is %g - cost %g old cost %g\n", key, iSet, sol, cost[key], oldCost); #endif costChange = cost[key] - oldCost; } else { // slack is key if (value > upper_[iSet] + primalTolerance) { setAbove(iSet); } else if (value < lower_[iSet] - primalTolerance) { setBelow(iSet); } else { setFeasible(iSet); } // negative as -1.0 for slack costChange = -weight(iSet) * infeasibilityCost - oldCost; #ifdef CLP_DEBUG_PRINT printf("yy Value of key slack for set %d is %g - cost %g old cost %g\n", iSet, value, weight(iSet)*infeasibilityCost, oldCost); #endif } if (costChange) { fromIndex_[numberChanged] = iSet; toIndex_[iSet] = numberChanged; changeCost_[numberChanged++] = costChange; } iSet = fromIndex_[++iLook]; } if (numberChanged || possiblePivotKey_ >= 0) { // first do those in list already int number = array->getNumElements(); array->setPacked(); int i; double * work = array->denseVector(); int * which = array->getIndices(); for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (iPivot < numberColumns) { int iSet = backward_[iPivot]; if (iSet >= 0 && toIndex_[iSet] >= 0) { double newValue = work[i] + changeCost_[toIndex_[iSet]]; if (!newValue) newValue = 1.0e-100; work[i] = newValue; // mark as done backward_[iPivot] = -1; } } if (possiblePivotKey_ == iRow) { double newValue = work[i] - model->dualIn(); if (!newValue) newValue = 1.0e-100; work[i] = newValue; possiblePivotKey_ = -1; } } // now do rest and clean up for (i = 0; i < numberChanged; i++) { int iSet = fromIndex_[i]; int key = keyVariable_[iSet]; int iColumn = next_[key]; double change = changeCost_[i]; while (iColumn >= 0) { if (backward_[iColumn] >= 0) { int iRow = backToPivotRow_[iColumn]; assert (iRow >= 0); work[number] = change; if (possiblePivotKey_ == iRow) { double newValue = work[number] - model->dualIn(); if (!newValue) newValue = 1.0e-100; work[number] = newValue; possiblePivotKey_ = -1; } which[number++] = iRow; } else { // reset backward_[iColumn] = iSet; } iColumn = next_[iColumn]; } toIndex_[iSet] = -1; } if (possiblePivotKey_ >= 0) { work[number] = -model->dualIn(); which[number++] = possiblePivotKey_; possiblePivotKey_ = -1; } fromIndex_[0] = -1; array->setNumElements(number); } } break; } } // This is local to Gub to allow synchronization when status is good int ClpGubMatrix::synchronize(ClpSimplex *, int) { return 0; } /* general utility function for dealing with dynamic constraints mode=n see ClpGubMatrix.hpp for definition Remember to update here when settled down */ int ClpGubMatrix::generalExpanded(ClpSimplex * model, int mode, int &number) { int returnCode = 0; int numberColumns = model->numberColumns(); switch (mode) { // Fill in pivotVariable but not for key variables case 0: { if (!next_ ) { // do ordering assert (!rhsOffset_); // create and do gub crash useEffectiveRhs(model, false); } int i; int numberBasic = number; // Use different array so can build from true pivotVariable_ //int * pivotVariable = model->pivotVariable(); int * pivotVariable = model->rowArray(0)->getIndices(); for (i = 0; i < numberColumns; i++) { if (model->getColumnStatus(i) == ClpSimplex::basic) { int iSet = backward_[i]; if (iSet < 0 || i != keyVariable_[iSet]) pivotVariable[numberBasic++] = i; } } number = numberBasic; if (model->numberIterations()) assert (number == model->numberRows()); } break; // Make all key variables basic case 1: { int i; for (i = 0; i < numberSets_; i++) { int iColumn = keyVariable_[i]; if (iColumn < numberColumns) model->setColumnStatus(iColumn, ClpSimplex::basic); } } break; // Do initial extra rows + maximum basic case 2: { returnCode = getNumRows() + 1; number = model->numberRows() + numberSets_; } break; // Before normal replaceColumn case 3: { int sequenceIn = model->sequenceIn(); int sequenceOut = model->sequenceOut(); int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); int pivotRow = model->pivotRow(); if (gubSlackIn_ >= 0) assert (sequenceIn > numberRows + numberColumns); if (sequenceIn == sequenceOut) return -1; int iSetIn = -1; int iSetOut = -1; if (sequenceOut < numberColumns) { iSetOut = backward_[sequenceOut]; } else if (sequenceOut >= numberRows + numberColumns) { assert (pivotRow >= numberRows); int iExtra = pivotRow - numberRows; assert (iExtra >= 0); if (iSetOut < 0) iSetOut = fromIndex_[iExtra]; else assert(iSetOut == fromIndex_[iExtra]); } if (sequenceIn < numberColumns) { iSetIn = backward_[sequenceIn]; } else if (gubSlackIn_ >= 0) { iSetIn = gubSlackIn_; } possiblePivotKey_ = -1; number = 0; // say do ordinary int * pivotVariable = model->pivotVariable(); if (pivotRow >= numberRows) { int iExtra = pivotRow - numberRows; //const int * length = matrix_->getVectorLengths(); assert (sequenceOut >= numberRows + numberColumns || sequenceOut == keyVariable_[iSetOut]); int incomingColumn = sequenceIn; // to be used in updates if (iSetIn != iSetOut) { // We need to find a possible pivot for incoming // look through rowArray_[1] int n = model->rowArray(1)->getNumElements(); int * which = model->rowArray(1)->getIndices(); double * array = model->rowArray(1)->denseVector(); double bestAlpha = 1.0e-5; //int shortest=numberRows+1; for (int i = 0; i < n; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (iPivot < numberColumns && backward_[iPivot] == iSetOut) { if (fabs(array[i]) > fabs(bestAlpha)) { bestAlpha = array[i]; possiblePivotKey_ = iRow; } } } assert (possiblePivotKey_ >= 0); // could set returnCode=4 number = 1; if (sequenceIn >= numberRows + numberColumns) { number = 3; // need swap as gub slack in and must become key // is this best way int key = keyVariable_[iSetIn]; assert (key < numberColumns); // check other basic int iColumn = next_[key]; // set new key to be used by unpack keyVariable_[iSetIn] = iSetIn + numberColumns; // change cost in changeCost { int iLook = 0; int iSet = fromIndex_[0]; while (iSet >= 0) { if (iSet == iSetIn) { changeCost_[iLook] = 0.0; break; } iSet = fromIndex_[++iLook]; } } while (iColumn >= 0) { if (iColumn != sequenceOut) { // need partial ftran and skip accuracy check in replaceColumn #ifdef CLP_DEBUG_PRINT printf("TTTTTry 5\n"); #endif int iRow = backToPivotRow_[iColumn]; assert (iRow >= 0); unpack(model, model->rowArray(3), iColumn); model->factorization()->updateColumnFT(model->rowArray(2), model->rowArray(3)); double alpha = model->rowArray(3)->denseVector()[iRow]; //if (!alpha) //printf("zero alpha a\n"); int updateStatus = model->factorization()->replaceColumn(model, model->rowArray(2), model->rowArray(3), iRow, alpha); returnCode = CoinMax(updateStatus, returnCode); model->rowArray(3)->clear(); if (returnCode) break; } iColumn = next_[iColumn]; } if (!returnCode) { // now factorization looks as if key is out // pivot back in #ifdef CLP_DEBUG_PRINT printf("TTTTTry 6\n"); #endif unpack(model, model->rowArray(3), key); model->factorization()->updateColumnFT(model->rowArray(2), model->rowArray(3)); pivotRow = possiblePivotKey_; double alpha = model->rowArray(3)->denseVector()[pivotRow]; //if (!alpha) //printf("zero alpha b\n"); int updateStatus = model->factorization()->replaceColumn(model, model->rowArray(2), model->rowArray(3), pivotRow, alpha); returnCode = CoinMax(updateStatus, returnCode); model->rowArray(3)->clear(); } // restore key keyVariable_[iSetIn] = key; // now alternate column can replace key on out incomingColumn = pivotVariable[possiblePivotKey_]; } else { #ifdef CLP_DEBUG_PRINT printf("TTTTTTry 4 %d\n", possiblePivotKey_); #endif int updateStatus = model->factorization()->replaceColumn(model, model->rowArray(2), model->rowArray(1), possiblePivotKey_, bestAlpha); returnCode = CoinMax(updateStatus, returnCode); incomingColumn = pivotVariable[possiblePivotKey_]; } //returnCode=4; // need swap } else { // key swap number = -1; } int key = keyVariable_[iSetOut]; if (key < numberColumns) assert(key == sequenceOut); // check if any other basic int iColumn = next_[key]; if (returnCode) iColumn = -1; // skip if error on previous // set new key to be used by unpack if (incomingColumn < numberColumns) keyVariable_[iSetOut] = incomingColumn; else keyVariable_[iSetOut] = iSetIn + numberColumns; double * cost = model->costRegion(); if (possiblePivotKey_ < 0) { double dj = model->djRegion()[sequenceIn] - cost[sequenceIn]; changeCost_[iExtra] = -dj; #ifdef CLP_DEBUG_PRINT printf("modifying changeCost %d by %g - cost %g\n", iExtra, dj, cost[sequenceIn]); #endif } while (iColumn >= 0) { if (iColumn != incomingColumn) { number = -2; // need partial ftran and skip accuracy check in replaceColumn #ifdef CLP_DEBUG_PRINT printf("TTTTTTry 1\n"); #endif int iRow = backToPivotRow_[iColumn]; assert (iRow >= 0 && iRow < numberRows); unpack(model, model->rowArray(3), iColumn); model->factorization()->updateColumnFT(model->rowArray(2), model->rowArray(3)); double * array = model->rowArray(3)->denseVector(); double alpha = array[iRow]; //if (!alpha) //printf("zero alpha d\n"); int updateStatus = model->factorization()->replaceColumn(model, model->rowArray(2), model->rowArray(3), iRow, alpha); returnCode = CoinMax(updateStatus, returnCode); model->rowArray(3)->clear(); if (returnCode) break; } iColumn = next_[iColumn]; } // restore key keyVariable_[iSetOut] = key; } else if (sequenceIn >= numberRows + numberColumns) { number = 2; //returnCode=4; // need swap as gub slack in and must become key // is this best way int key = keyVariable_[iSetIn]; assert (key < numberColumns); // check other basic int iColumn = next_[key]; // set new key to be used by unpack keyVariable_[iSetIn] = iSetIn + numberColumns; // change cost in changeCost { int iLook = 0; int iSet = fromIndex_[0]; while (iSet >= 0) { if (iSet == iSetIn) { changeCost_[iLook] = 0.0; break; } iSet = fromIndex_[++iLook]; } } while (iColumn >= 0) { if (iColumn != sequenceOut) { // need partial ftran and skip accuracy check in replaceColumn #ifdef CLP_DEBUG_PRINT printf("TTTTTry 2\n"); #endif int iRow = backToPivotRow_[iColumn]; assert (iRow >= 0); unpack(model, model->rowArray(3), iColumn); model->factorization()->updateColumnFT(model->rowArray(2), model->rowArray(3)); double alpha = model->rowArray(3)->denseVector()[iRow]; //if (!alpha) //printf("zero alpha e\n"); int updateStatus = model->factorization()->replaceColumn(model, model->rowArray(2), model->rowArray(3), iRow, alpha); returnCode = CoinMax(updateStatus, returnCode); model->rowArray(3)->clear(); if (returnCode) break; } iColumn = next_[iColumn]; } if (!returnCode) { // now factorization looks as if key is out // pivot back in #ifdef CLP_DEBUG_PRINT printf("TTTTTry 3\n"); #endif unpack(model, model->rowArray(3), key); model->factorization()->updateColumnFT(model->rowArray(2), model->rowArray(3)); double alpha = model->rowArray(3)->denseVector()[pivotRow]; //if (!alpha) //printf("zero alpha f\n"); int updateStatus = model->factorization()->replaceColumn(model, model->rowArray(2), model->rowArray(3), pivotRow, alpha); returnCode = CoinMax(updateStatus, returnCode); model->rowArray(3)->clear(); } // restore key keyVariable_[iSetIn] = key; } else { // normal - but might as well do here returnCode = model->factorization()->replaceColumn(model, model->rowArray(2), model->rowArray(1), model->pivotRow(), model->alpha()); } } #ifdef CLP_DEBUG_PRINT printf("Update type after %d - status %d - pivot row %d\n", number, returnCode, model->pivotRow()); #endif // see if column generation says time to re-factorize returnCode = CoinMax(returnCode, synchronize(model, 5)); number = -1; // say no need for normal replaceColumn break; // To see if can dual or primal case 4: { returnCode = 1; } break; // save status case 5: { synchronize(model, 0); CoinMemcpyN(status_, numberSets_, saveStatus_); CoinMemcpyN(keyVariable_, numberSets_, savedKeyVariable_); } break; // restore status case 6: { CoinMemcpyN(saveStatus_, numberSets_, status_); CoinMemcpyN(savedKeyVariable_, numberSets_, keyVariable_); // restore firstAvailable_ synchronize(model, 7); // redo next_ int i; int * last = new int[numberSets_]; for (i = 0; i < numberSets_; i++) { int iKey = keyVariable_[i]; assert(iKey >= numberColumns || backward_[iKey] == i); last[i] = iKey; // make sure basic //if (iKeysetStatus(iKey,ClpSimplex::basic); } for (i = 0; i < numberColumns; i++) { int iSet = backward_[i]; if (iSet >= 0) { next_[last[iSet]] = i; last[iSet] = i; } } for (i = 0; i < numberSets_; i++) { next_[last[i]] = -(keyVariable_[i] + 1); redoSet(model, keyVariable_[i], keyVariable_[i], i); } delete [] last; // redo pivotVariable int * pivotVariable = model->pivotVariable(); int iRow; int numberBasic = 0; int numberRows = model->numberRows(); for (iRow = 0; iRow < numberRows; iRow++) { if (model->getRowStatus(iRow) == ClpSimplex::basic) { numberBasic++; pivotVariable[iRow] = iRow + numberColumns; } else { pivotVariable[iRow] = -1; } } i = 0; int iColumn; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getStatus(iColumn) == ClpSimplex::basic) { int iSet = backward_[iColumn]; if (iSet < 0 || keyVariable_[iSet] != iColumn) { while (pivotVariable[i] >= 0) { i++; assert (i < numberRows); } pivotVariable[i] = iColumn; backToPivotRow_[iColumn] = i; numberBasic++; } } } assert (numberBasic == numberRows); rhsOffset(model, true); } break; // flag a variable case 7: { assert (number == model->sequenceIn()); synchronize(model, 1); synchronize(model, 8); } break; // unflag all variables case 8: { returnCode = synchronize(model, 2); } break; // redo costs in primal case 9: { returnCode = synchronize(model, 3); } break; // return 1 if there may be changing bounds on variable (column generation) case 10: { returnCode = synchronize(model, 6); } break; // make sure set is clean case 11: { assert (number == model->sequenceIn()); returnCode = synchronize(model, 8); } break; default: break; } return returnCode; } // Sets up an effective RHS and does gub crash if needed void ClpGubMatrix::useEffectiveRhs(ClpSimplex * model, bool cheapest) { // Do basis - cheapest or slack if feasible (unless cheapest set) int longestSet = 0; int iSet; for (iSet = 0; iSet < numberSets_; iSet++) longestSet = CoinMax(longestSet, end_[iSet] - start_[iSet]); double * upper = new double[longestSet+1]; double * cost = new double[longestSet+1]; double * lower = new double[longestSet+1]; double * solution = new double[longestSet+1]; assert (!next_); int numberColumns = getNumCols(); const int * columnLength = matrix_->getVectorLengths(); const double * columnLower = model->lowerRegion(); const double * columnUpper = model->upperRegion(); double * columnSolution = model->solutionRegion(); const double * objective = model->costRegion(); int numberRows = getNumRows(); toIndex_ = new int[numberSets_]; for (iSet = 0; iSet < numberSets_; iSet++) toIndex_[iSet] = -1; fromIndex_ = new int [getNumRows()+1]; double tolerance = model->primalTolerance(); bool noNormalBounds = true; gubType_ &= ~8; bool gotBasis = false; for (iSet = 0; iSet < numberSets_; iSet++) { if (keyVariable_[iSet] < numberColumns) gotBasis = true; CoinBigIndex j; CoinBigIndex iStart = start_[iSet]; CoinBigIndex iEnd = end_[iSet]; for (j = iStart; j < iEnd; j++) { if (columnLower[j] && columnLower[j] > -1.0e20) noNormalBounds = false; if (columnUpper[j] && columnUpper[j] < 1.0e20) noNormalBounds = false; } } if (noNormalBounds) gubType_ |= 8; if (!gotBasis) { for (iSet = 0; iSet < numberSets_; iSet++) { CoinBigIndex j; int numberBasic = 0; int iBasic = -1; CoinBigIndex iStart = start_[iSet]; CoinBigIndex iEnd = end_[iSet]; // find one with smallest length int smallest = numberRows + 1; double value = 0.0; for (j = iStart; j < iEnd; j++) { if (model->getStatus(j) == ClpSimplex::basic) { if (columnLength[j] < smallest) { smallest = columnLength[j]; iBasic = j; } numberBasic++; } value += columnSolution[j]; } bool done = false; if (numberBasic > 1 || (numberBasic == 1 && getStatus(iSet) == ClpSimplex::basic)) { if (getStatus(iSet) == ClpSimplex::basic) iBasic = iSet + numberColumns; // slack key - use done = true; } else if (numberBasic == 1) { // see if can be key double thisSolution = columnSolution[iBasic]; if (thisSolution > columnUpper[iBasic]) { value -= thisSolution - columnUpper[iBasic]; thisSolution = columnUpper[iBasic]; columnSolution[iBasic] = thisSolution; } if (thisSolution < columnLower[iBasic]) { value -= thisSolution - columnLower[iBasic]; thisSolution = columnLower[iBasic]; columnSolution[iBasic] = thisSolution; } // try setting slack to a bound assert (upper_[iSet] < 1.0e20 || lower_[iSet] > -1.0e20); double cost1 = COIN_DBL_MAX; int whichBound = -1; if (upper_[iSet] < 1.0e20) { // try slack at ub double newBasic = thisSolution + upper_[iSet] - value; if (newBasic >= columnLower[iBasic] - tolerance && newBasic <= columnUpper[iBasic] + tolerance) { // can go whichBound = 1; cost1 = newBasic * objective[iBasic]; // But if exact then may be good solution if (fabs(upper_[iSet] - value) < tolerance) cost1 = -COIN_DBL_MAX; } } if (lower_[iSet] > -1.0e20) { // try slack at lb double newBasic = thisSolution + lower_[iSet] - value; if (newBasic >= columnLower[iBasic] - tolerance && newBasic <= columnUpper[iBasic] + tolerance) { // can go but is it cheaper double cost2 = newBasic * objective[iBasic]; // But if exact then may be good solution if (fabs(lower_[iSet] - value) < tolerance) cost2 = -COIN_DBL_MAX; if (cost2 < cost1) whichBound = 0; } } if (whichBound != -1) { // key done = true; if (whichBound) { // slack to upper columnSolution[iBasic] = thisSolution + upper_[iSet] - value; setStatus(iSet, ClpSimplex::atUpperBound); } else { // slack to lower columnSolution[iBasic] = thisSolution + lower_[iSet] - value; setStatus(iSet, ClpSimplex::atLowerBound); } } } if (!done) { if (!cheapest) { // see if slack can be key if (value >= lower_[iSet] - tolerance && value <= upper_[iSet] + tolerance) { done = true; setStatus(iSet, ClpSimplex::basic); iBasic = iSet + numberColumns; } } if (!done) { // set non basic if there was one if (iBasic >= 0) model->setStatus(iBasic, ClpSimplex::atLowerBound); // find cheapest int numberInSet = iEnd - iStart; CoinMemcpyN(columnLower + iStart, numberInSet, lower); CoinMemcpyN(columnUpper + iStart, numberInSet, upper); CoinMemcpyN(columnSolution + iStart, numberInSet, solution); // and slack iBasic = numberInSet; solution[iBasic] = -value; lower[iBasic] = -upper_[iSet]; upper[iBasic] = -lower_[iSet]; int kphase; if (value >= lower_[iSet] - tolerance && value <= upper_[iSet] + tolerance) { // feasible kphase = 1; cost[iBasic] = 0.0; CoinMemcpyN(objective + iStart, numberInSet, cost); } else { // infeasible kphase = 0; // remember bounds are flipped so opposite to natural if (value < lower_[iSet] - tolerance) cost[iBasic] = 1.0; else cost[iBasic] = -1.0; CoinZeroN(cost, numberInSet); } double dualTolerance = model->dualTolerance(); for (int iphase = kphase; iphase < 2; iphase++) { if (iphase) { cost[numberInSet] = 0.0; CoinMemcpyN(objective + iStart, numberInSet, cost); } // now do one row lp bool improve = true; while (improve) { improve = false; double dual = cost[iBasic]; int chosen = -1; double best = dualTolerance; int way = 0; for (int i = 0; i <= numberInSet; i++) { double dj = cost[i] - dual; double improvement = 0.0; if (iphase || i < numberInSet) assert (solution[i] >= lower[i] && solution[i] <= upper[i]); if (dj > dualTolerance) improvement = dj * (solution[i] - lower[i]); else if (dj < -dualTolerance) improvement = dj * (solution[i] - upper[i]); if (improvement > best) { best = improvement; chosen = i; if (dj < 0.0) { way = 1; } else { way = -1; } } } if (chosen >= 0) { improve = true; // now see how far if (way > 0) { // incoming increasing so basic decreasing // if phase 0 then go to nearest bound double distance = upper[chosen] - solution[chosen]; double basicDistance; if (!iphase) { assert (iBasic == numberInSet); assert (solution[iBasic] > upper[iBasic]); basicDistance = solution[iBasic] - upper[iBasic]; } else { basicDistance = solution[iBasic] - lower[iBasic]; } // need extra coding for unbounded assert (CoinMin(distance, basicDistance) < 1.0e20); if (distance > basicDistance) { // incoming becomes basic solution[chosen] += basicDistance; if (!iphase) solution[iBasic] = upper[iBasic]; else solution[iBasic] = lower[iBasic]; iBasic = chosen; } else { // flip solution[chosen] = upper[chosen]; solution[iBasic] -= distance; } } else { // incoming decreasing so basic increasing // if phase 0 then go to nearest bound double distance = solution[chosen] - lower[chosen]; double basicDistance; if (!iphase) { assert (iBasic == numberInSet); assert (solution[iBasic] < lower[iBasic]); basicDistance = lower[iBasic] - solution[iBasic]; } else { basicDistance = upper[iBasic] - solution[iBasic]; } // need extra coding for unbounded - for now just exit if (CoinMin(distance, basicDistance) > 1.0e20) { printf("unbounded on set %d\n", iSet); iphase = 1; iBasic = numberInSet; break; } if (distance > basicDistance) { // incoming becomes basic solution[chosen] -= basicDistance; if (!iphase) solution[iBasic] = lower[iBasic]; else solution[iBasic] = upper[iBasic]; iBasic = chosen; } else { // flip solution[chosen] = lower[chosen]; solution[iBasic] += distance; } } if (!iphase) { if(iBasic < numberInSet) break; // feasible else if (solution[iBasic] >= lower[iBasic] && solution[iBasic] <= upper[iBasic]) break; // feasible (on flip) } } } } // convert iBasic back and do bounds if (iBasic == numberInSet) { // slack basic setStatus(iSet, ClpSimplex::basic); iBasic = iSet + numberColumns; } else { iBasic += start_[iSet]; model->setStatus(iBasic, ClpSimplex::basic); // remember bounds flipped if (upper[numberInSet] == lower[numberInSet]) setStatus(iSet, ClpSimplex::isFixed); else if (solution[numberInSet] == upper[numberInSet]) setStatus(iSet, ClpSimplex::atLowerBound); else if (solution[numberInSet] == lower[numberInSet]) setStatus(iSet, ClpSimplex::atUpperBound); else abort(); } for (j = iStart; j < iEnd; j++) { if (model->getStatus(j) != ClpSimplex::basic) { int inSet = j - iStart; columnSolution[j] = solution[inSet]; if (upper[inSet] == lower[inSet]) model->setStatus(j, ClpSimplex::isFixed); else if (solution[inSet] == upper[inSet]) model->setStatus(j, ClpSimplex::atUpperBound); else if (solution[inSet] == lower[inSet]) model->setStatus(j, ClpSimplex::atLowerBound); } } } } keyVariable_[iSet] = iBasic; } } delete [] lower; delete [] solution; delete [] upper; delete [] cost; // make sure matrix is in good shape matrix_->orderMatrix(); // create effective rhs delete [] rhsOffset_; rhsOffset_ = new double[numberRows]; delete [] next_; next_ = new int[numberColumns+numberSets_+2*longestSet]; char * mark = new char[numberColumns]; memset(mark, 0, numberColumns); for (int iColumn = 0; iColumn < numberColumns; iColumn++) next_[iColumn] = COIN_INT_MAX; int i; int * keys = new int[numberSets_]; for (i = 0; i < numberSets_; i++) keys[i] = COIN_INT_MAX; // set up chains for (i = 0; i < numberColumns; i++) { if (model->getStatus(i) == ClpSimplex::basic) mark[i] = 1; int iSet = backward_[i]; if (iSet >= 0) { int iNext = keys[iSet]; next_[i] = iNext; keys[iSet] = i; } } for (i = 0; i < numberSets_; i++) { int j; if (getStatus(i) != ClpSimplex::basic) { // make sure fixed if it is if (upper_[i] == lower_[i]) setStatus(i, ClpSimplex::isFixed); // slack not key - choose one with smallest length int smallest = numberRows + 1; int key = -1; j = keys[i]; if (j != COIN_INT_MAX) { while (1) { if (mark[j] && columnLength[j] < smallest && !gotBasis) { key = j; smallest = columnLength[j]; } if (next_[j] != COIN_INT_MAX) { j = next_[j]; } else { // correct end next_[j] = -(keys[i] + 1); break; } } } else { next_[i+numberColumns] = -(numberColumns + i + 1); } if (gotBasis) key = keyVariable_[i]; if (key >= 0) { keyVariable_[i] = key; } else { // nothing basic - make slack key //((ClpGubMatrix *)this)->setStatus(i,ClpSimplex::basic); // fudge to avoid const problem status_[i] = 1; } } else { // slack key keyVariable_[i] = numberColumns + i; int j; double sol = 0.0; j = keys[i]; if (j != COIN_INT_MAX) { while (1) { sol += columnSolution[j]; if (next_[j] != COIN_INT_MAX) { j = next_[j]; } else { // correct end next_[j] = -(keys[i] + 1); break; } } } else { next_[i+numberColumns] = -(numberColumns + i + 1); } if (sol > upper_[i] + tolerance) { setAbove(i); } else if (sol < lower_[i] - tolerance) { setBelow(i); } else { setFeasible(i); } } // Create next_ int key = keyVariable_[i]; redoSet(model, key, keys[i], i); } delete [] keys; delete [] mark; rhsOffset(model, true); } // redoes next_ for a set. void ClpGubMatrix::redoSet(ClpSimplex * model, int newKey, int oldKey, int iSet) { int numberColumns = model->numberColumns(); int * save = next_ + numberColumns + numberSets_; int number = 0; int stop = -(oldKey + 1); int j = next_[oldKey]; while (j != stop) { if (j < 0) j = -j - 1; if (j != newKey) save[number++] = j; j = next_[j]; } // and add oldkey if (newKey != oldKey) save[number++] = oldKey; // now do basic int lastMarker = -(newKey + 1); keyVariable_[iSet] = newKey; next_[newKey] = lastMarker; int last = newKey; for ( j = 0; j < number; j++) { int iColumn = save[j]; if (iColumn < numberColumns) { if (model->getStatus(iColumn) == ClpSimplex::basic) { next_[last] = iColumn; next_[iColumn] = lastMarker; last = iColumn; } } } // now add in non-basic for ( j = 0; j < number; j++) { int iColumn = save[j]; if (iColumn < numberColumns) { if (model->getStatus(iColumn) != ClpSimplex::basic) { next_[last] = -(iColumn + 1); next_[iColumn] = lastMarker; last = iColumn; } } } } /* Returns effective RHS if it is being used. This is used for long problems or big gub or anywhere where going through full columns is expensive. This may re-compute */ double * ClpGubMatrix::rhsOffset(ClpSimplex * model, bool forceRefresh, bool #ifdef CLP_DEBUG check #endif ) { //forceRefresh=true; if (rhsOffset_) { #ifdef CLP_DEBUG if (check) { // no need - but check anyway // zero out basic int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); double * solution = new double [numberColumns]; double * rhs = new double[numberRows]; CoinMemcpyN(model->solutionRegion(), numberColumns, solution); CoinZeroN(rhs, numberRows); int iRow; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) == ClpSimplex::basic) solution[iColumn] = 0.0; } for (int iSet = 0; iSet < numberSets_; iSet++) { int iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) solution[iColumn] = 0.0; } times(-1.0, solution, rhs); delete [] solution; const double * columnSolution = model->solutionRegion(); // and now subtract out non basic ClpSimplex::Status iStatus; for (int iSet = 0; iSet < numberSets_; iSet++) { int iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) { double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lower_[iSet]; else b = upper_[iSet]; // subtract out others at bounds if ((gubType_ & 8) == 0) { int stop = -(iColumn + 1); int jColumn = next_[iColumn]; // sum all non-basic variables - first skip basic while(jColumn >= 0) jColumn = next_[jColumn]; while(jColumn != stop) { assert (jColumn < 0); jColumn = -jColumn - 1; b -= columnSolution[jColumn]; jColumn = next_[jColumn]; } } // subtract out ClpPackedMatrix::add(model, rhs, iColumn, -b); } } for (iRow = 0; iRow < numberRows; iRow++) { if (fabs(rhs[iRow] - rhsOffset_[iRow]) > 1.0e-3) printf("** bad effective %d - true %g old %g\n", iRow, rhs[iRow], rhsOffset_[iRow]); } delete [] rhs; } #endif if (forceRefresh || (refreshFrequency_ && model->numberIterations() >= lastRefresh_ + refreshFrequency_)) { // zero out basic int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); double * solution = new double [numberColumns]; CoinMemcpyN(model->solutionRegion(), numberColumns, solution); CoinZeroN(rhsOffset_, numberRows); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) == ClpSimplex::basic) solution[iColumn] = 0.0; } int iSet; for ( iSet = 0; iSet < numberSets_; iSet++) { int iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) solution[iColumn] = 0.0; } times(-1.0, solution, rhsOffset_); delete [] solution; lastRefresh_ = model->numberIterations(); const double * columnSolution = model->solutionRegion(); // and now subtract out non basic ClpSimplex::Status iStatus; for ( iSet = 0; iSet < numberSets_; iSet++) { int iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) { double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lower_[iSet]; else b = upper_[iSet]; // subtract out others at bounds if ((gubType_ & 8) == 0) { int stop = -(iColumn + 1); int jColumn = next_[iColumn]; // sum all non-basic variables - first skip basic while(jColumn >= 0) jColumn = next_[jColumn]; while(jColumn != stop) { assert (jColumn < 0); jColumn = -jColumn - 1; b -= columnSolution[jColumn]; jColumn = next_[jColumn]; } } // subtract out if (b) ClpPackedMatrix::add(model, rhsOffset_, iColumn, -b); } } } } return rhsOffset_; } /* update information for a pivot (and effective rhs) */ int ClpGubMatrix::updatePivot(ClpSimplex * model, double oldInValue, double /*oldOutValue*/) { int sequenceIn = model->sequenceIn(); int sequenceOut = model->sequenceOut(); double * solution = model->solutionRegion(); int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); int pivotRow = model->pivotRow(); int iSetIn; // Correct sequence in trueSequenceIn_ = sequenceIn; if (sequenceIn < numberColumns) { iSetIn = backward_[sequenceIn]; } else if (sequenceIn < numberColumns + numberRows) { iSetIn = -1; } else { iSetIn = gubSlackIn_; trueSequenceIn_ = numberColumns + numberRows + iSetIn; } int iSetOut = -1; trueSequenceOut_ = sequenceOut; if (sequenceOut < numberColumns) { iSetOut = backward_[sequenceOut]; } else if (sequenceOut >= numberRows + numberColumns) { assert (pivotRow >= numberRows); int iExtra = pivotRow - numberRows; assert (iExtra >= 0); if (iSetOut < 0) iSetOut = fromIndex_[iExtra]; else assert(iSetOut == fromIndex_[iExtra]); trueSequenceOut_ = numberColumns + numberRows + iSetOut; } if (rhsOffset_) { // update effective rhs if (sequenceIn == sequenceOut) { assert (sequenceIn < numberRows + numberColumns); // should be easy to deal with if (sequenceIn < numberColumns) add(model, rhsOffset_, sequenceIn, oldInValue - solution[sequenceIn]); } else { if (sequenceIn < numberColumns) { // we need to test if WILL be key ClpPackedMatrix::add(model, rhsOffset_, sequenceIn, oldInValue); if (iSetIn >= 0) { // old contribution to rhsOffset_ int key = keyVariable_[iSetIn]; if (key < numberColumns) { double oldB = 0.0; ClpSimplex::Status iStatus = getStatus(iSetIn); if (iStatus == ClpSimplex::atLowerBound) oldB = lower_[iSetIn]; else oldB = upper_[iSetIn]; // subtract out others at bounds if ((gubType_ & 8) == 0) { int stop = -(key + 1); int iColumn = next_[key]; // skip basic while (iColumn >= 0) iColumn = next_[iColumn]; // sum all non-key variables while(iColumn != stop) { assert (iColumn < 0); iColumn = -iColumn - 1; if (iColumn == sequenceIn) oldB -= oldInValue; else if ( iColumn != sequenceOut ) oldB -= solution[iColumn]; iColumn = next_[iColumn]; } } if (oldB) ClpPackedMatrix::add(model, rhsOffset_, key, oldB); } } } else if (sequenceIn < numberRows + numberColumns) { //rhsOffset_[sequenceIn-numberColumns] -= oldInValue; } else { #ifdef CLP_DEBUG_PRINT printf("** in is key slack %d\n", sequenceIn); #endif // old contribution to rhsOffset_ int key = keyVariable_[iSetIn]; if (key < numberColumns) { double oldB = 0.0; ClpSimplex::Status iStatus = getStatus(iSetIn); if (iStatus == ClpSimplex::atLowerBound) oldB = lower_[iSetIn]; else oldB = upper_[iSetIn]; // subtract out others at bounds if ((gubType_ & 8) == 0) { int stop = -(key + 1); int iColumn = next_[key]; // skip basic while (iColumn >= 0) iColumn = next_[iColumn]; // sum all non-key variables while(iColumn != stop) { assert (iColumn < 0); iColumn = -iColumn - 1; if ( iColumn != sequenceOut ) oldB -= solution[iColumn]; iColumn = next_[iColumn]; } } if (oldB) ClpPackedMatrix::add(model, rhsOffset_, key, oldB); } } if (sequenceOut < numberColumns) { ClpPackedMatrix::add(model, rhsOffset_, sequenceOut, -solution[sequenceOut]); if (iSetOut >= 0) { // old contribution to rhsOffset_ int key = keyVariable_[iSetOut]; if (key < numberColumns && iSetIn != iSetOut) { double oldB = 0.0; ClpSimplex::Status iStatus = getStatus(iSetOut); if (iStatus == ClpSimplex::atLowerBound) oldB = lower_[iSetOut]; else oldB = upper_[iSetOut]; // subtract out others at bounds if ((gubType_ & 8) == 0) { int stop = -(key + 1); int iColumn = next_[key]; // skip basic while (iColumn >= 0) iColumn = next_[iColumn]; // sum all non-key variables while(iColumn != stop) { assert (iColumn < 0); iColumn = -iColumn - 1; if (iColumn == sequenceIn) oldB -= oldInValue; else if ( iColumn != sequenceOut ) oldB -= solution[iColumn]; iColumn = next_[iColumn]; } } if (oldB) ClpPackedMatrix::add(model, rhsOffset_, key, oldB); } } } else if (sequenceOut < numberRows + numberColumns) { //rhsOffset_[sequenceOut-numberColumns] -= -solution[sequenceOut]; } else { #ifdef CLP_DEBUG_PRINT printf("** out is key slack %d\n", sequenceOut); #endif assert (pivotRow >= numberRows); } } } int * pivotVariable = model->pivotVariable(); // may need to deal with key // Also need coding to mark/allow key slack entering if (pivotRow >= numberRows) { assert (sequenceOut >= numberRows + numberColumns || sequenceOut == keyVariable_[iSetOut]); #ifdef CLP_DEBUG_PRINT if (sequenceIn >= numberRows + numberColumns) printf("key slack %d in, set out %d\n", gubSlackIn_, iSetOut); printf("** danger - key out for set %d in %d (set %d)\n", iSetOut, sequenceIn, iSetIn); #endif // if slack out mark correctly if (sequenceOut >= numberRows + numberColumns) { double value = model->valueOut(); if (value == upper_[iSetOut]) { setStatus(iSetOut, ClpSimplex::atUpperBound); } else if (value == lower_[iSetOut]) { setStatus(iSetOut, ClpSimplex::atLowerBound); } else { if (fabs(value - upper_[iSetOut]) < fabs(value - lower_[iSetOut])) { setStatus(iSetOut, ClpSimplex::atUpperBound); } else { setStatus(iSetOut, ClpSimplex::atLowerBound); } } if (upper_[iSetOut] == lower_[iSetOut]) setStatus(iSetOut, ClpSimplex::isFixed); setFeasible(iSetOut); } if (iSetOut == iSetIn) { // key swap int key; if (sequenceIn >= numberRows + numberColumns) { key = numberColumns + iSetIn; setStatus(iSetIn, ClpSimplex::basic); } else { key = sequenceIn; } redoSet(model, key, keyVariable_[iSetIn], iSetIn); } else { // key was chosen assert (possiblePivotKey_ >= 0 && possiblePivotKey_ < numberRows); int key = pivotVariable[possiblePivotKey_]; // and set incoming here if (sequenceIn >= numberRows + numberColumns) { // slack in - so use old key sequenceIn = keyVariable_[iSetIn]; model->setStatus(sequenceIn, ClpSimplex::basic); setStatus(iSetIn, ClpSimplex::basic); redoSet(model, iSetIn + numberColumns, keyVariable_[iSetIn], iSetIn); } //? do not do if iSetIn<0 ? as will be done later pivotVariable[possiblePivotKey_] = sequenceIn; if (sequenceIn < numberColumns) backToPivotRow_[sequenceIn] = possiblePivotKey_; redoSet(model, key, keyVariable_[iSetOut], iSetOut); } } else { if (sequenceOut < numberColumns) { if (iSetIn >= 0 && iSetOut == iSetIn) { // key not out - only problem is if slack in int key; if (sequenceIn >= numberRows + numberColumns) { key = numberColumns + iSetIn; setStatus(iSetIn, ClpSimplex::basic); assert (pivotRow < numberRows); // must swap with current key int key = keyVariable_[iSetIn]; model->setStatus(key, ClpSimplex::basic); pivotVariable[pivotRow] = key; backToPivotRow_[key] = pivotRow; } else { key = keyVariable_[iSetIn]; } redoSet(model, key, keyVariable_[iSetIn], iSetIn); } else if (iSetOut >= 0) { // just redo set int key = keyVariable_[iSetOut];; redoSet(model, key, keyVariable_[iSetOut], iSetOut); } } } if (iSetIn >= 0 && iSetIn != iSetOut) { int key = keyVariable_[iSetIn]; if (sequenceIn == numberColumns + 2 * numberRows) { // key slack in assert (pivotRow < numberRows); // must swap with current key model->setStatus(key, ClpSimplex::basic); pivotVariable[pivotRow] = key; backToPivotRow_[key] = pivotRow; setStatus(iSetIn, ClpSimplex::basic); key = iSetIn + numberColumns; } // redo set to allow for new one redoSet(model, key, keyVariable_[iSetIn], iSetIn); } // update pivot if (sequenceIn < numberColumns) { if (pivotRow < numberRows) { backToPivotRow_[sequenceIn] = pivotRow; } else { if (possiblePivotKey_ >= 0) { assert (possiblePivotKey_ < numberRows); backToPivotRow_[sequenceIn] = possiblePivotKey_; pivotVariable[possiblePivotKey_] = sequenceIn; } } } else if (sequenceIn >= numberRows + numberColumns) { // key in - something should have been done before int key = keyVariable_[iSetIn]; assert (key == numberColumns + iSetIn); //pivotVariable[pivotRow]=key; //backToPivotRow_[key]=pivotRow; //model->setStatus(key,ClpSimplex::basic); //key=numberColumns+iSetIn; setStatus(iSetIn, ClpSimplex::basic); redoSet(model, key, keyVariable_[iSetIn], iSetIn); } #ifdef CLP_DEBUG { char * xx = new char[numberColumns+numberRows]; memset(xx, 0, numberRows + numberColumns); for (int i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; assert (iPivot < numberRows + numberColumns); assert (!xx[iPivot]); xx[iPivot] = 1; if (iPivot < numberColumns) { int iBack = backToPivotRow_[iPivot]; assert (i == iBack); } } delete [] xx; } #endif if (rhsOffset_) { // update effective rhs if (sequenceIn != sequenceOut) { if (sequenceIn < numberColumns) { if (iSetIn >= 0) { // new contribution to rhsOffset_ int key = keyVariable_[iSetIn]; if (key < numberColumns) { double newB = 0.0; ClpSimplex::Status iStatus = getStatus(iSetIn); if (iStatus == ClpSimplex::atLowerBound) newB = lower_[iSetIn]; else newB = upper_[iSetIn]; // subtract out others at bounds if ((gubType_ & 8) == 0) { int stop = -(key + 1); int iColumn = next_[key]; // skip basic while (iColumn >= 0) iColumn = next_[iColumn]; // sum all non-key variables while(iColumn != stop) { assert (iColumn < 0); iColumn = -iColumn - 1; newB -= solution[iColumn]; iColumn = next_[iColumn]; } } if (newB) ClpPackedMatrix::add(model, rhsOffset_, key, -newB); } } } if (iSetOut >= 0) { // new contribution to rhsOffset_ int key = keyVariable_[iSetOut]; if (key < numberColumns && iSetIn != iSetOut) { double newB = 0.0; ClpSimplex::Status iStatus = getStatus(iSetOut); if (iStatus == ClpSimplex::atLowerBound) newB = lower_[iSetOut]; else newB = upper_[iSetOut]; // subtract out others at bounds if ((gubType_ & 8) == 0) { int stop = -(key + 1); int iColumn = next_[key]; // skip basic while (iColumn >= 0) iColumn = next_[iColumn]; // sum all non-key variables while(iColumn != stop) { assert (iColumn < 0); iColumn = -iColumn - 1; newB -= solution[iColumn]; iColumn = next_[iColumn]; } } if (newB) ClpPackedMatrix::add(model, rhsOffset_, key, -newB); } } } } #ifdef CLP_DEBUG // debug { int i; char * xxxx = new char[numberColumns]; memset(xxxx, 0, numberColumns); for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; assert (model->getStatus(iPivot) == ClpSimplex::basic); if (iPivot < numberColumns && backward_[iPivot] >= 0) xxxx[iPivot] = 1; } double primalTolerance = model->primalTolerance(); for (i = 0; i < numberSets_; i++) { int key = keyVariable_[i]; double value = 0.0; // sum over all except key int iColumn = next_[key]; // sum all non-key variables int k = 0; int stop = -(key + 1); while (iColumn != stop) { if (iColumn < 0) iColumn = -iColumn - 1; value += solution[iColumn]; k++; assert (k < 100); assert (backward_[iColumn] == i); iColumn = next_[iColumn]; } iColumn = next_[key]; if (key < numberColumns) { // feasibility will be done later assert (getStatus(i) != ClpSimplex::basic); double sol; if (getStatus(i) == ClpSimplex::atUpperBound) sol = upper_[i] - value; else sol = lower_[i] - value; //printf("xx Value of key structural %d for set %d is %g - cost %g\n",key,i,sol, // cost[key]); //if (fabs(sol-solution[key])>1.0e-3) //printf("** stored value was %g\n",solution[key]); } else { // slack is key double infeasibility = 0.0; if (value > upper_[i] + primalTolerance) { infeasibility = value - upper_[i] - primalTolerance; //setAbove(i); } else if (value < lower_[i] - primalTolerance) { infeasibility = lower_[i] - value - primalTolerance ; //setBelow(i); } else { //setFeasible(i); } //printf("xx Value of key slack for set %d is %g\n",i,value); } while (iColumn >= 0) { assert (xxxx[iColumn]); xxxx[iColumn] = 0; iColumn = next_[iColumn]; } } for (i = 0; i < numberColumns; i++) { if (i < numberColumns && backward_[i] >= 0) { assert (!xxxx[i] || i == keyVariable_[backward_[i]]); } } delete [] xxxx; } #endif return 0; } // Switches off dj checking each factorization (for BIG models) void ClpGubMatrix::switchOffCheck() { noCheck_ = 0; infeasibilityWeight_ = 0.0; } // Correct sequence in and out to give true value void ClpGubMatrix::correctSequence(const ClpSimplex * /*model*/, int & sequenceIn, int & sequenceOut) { if (sequenceIn != -999) { sequenceIn = trueSequenceIn_; sequenceOut = trueSequenceOut_; } } CoinMP-1.8.3/Clp/src/ClpDualRowPivot.hpp0000644000175000017500000000760712432624666016415 0ustar renerene/* $Id: ClpDualRowPivot.hpp 2070 2014-11-18 11:12:54Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpDualRowPivot_H #define ClpDualRowPivot_H class ClpSimplex; class CoinIndexedVector; //############################################################################# /** Dual Row Pivot Abstract Base Class Abstract Base Class for describing an interface to an algorithm to choose row pivot in dual simplex algorithm. For some algorithms e.g. Dantzig choice then some functions may be null. */ class ClpDualRowPivot { public: ///@name Algorithmic methods //@{ /// Returns pivot row, -1 if none virtual int pivotRow() = 0; /** Updates weights and returns pivot alpha. Also does FT update */ virtual double updateWeights(CoinIndexedVector * input, CoinIndexedVector * spare, CoinIndexedVector * spare2, CoinIndexedVector * updatedColumn) = 0; /** Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Computes change in objective function Would be faster if we kept basic regions, but on other hand it means everything is always in sync */ /* FIXME: this was pure virtul (=0). Why? */ virtual void updatePrimalSolution(CoinIndexedVector * input, double theta, double & changeInObjective) = 0; /** Saves any weights round factorization as pivot rows may change Will be empty unless steepest edge (will save model) May also recompute infeasibility stuff 1) before factorization 2) after good factorization (if weights empty may initialize) 3) after something happened but no factorization (e.g. check for infeasible) 4) as 2 but restore weights from previous snapshot 5) for strong branching - initialize to 1 , infeasibilities 6) scale back 7) for strong branching - initialize full weights , infeasibilities */ virtual void saveWeights(ClpSimplex * model, int mode); /// checks accuracy and may re-initialize (may be empty) virtual void checkAccuracy(); /// Gets rid of last update (may be empty) virtual void unrollWeights(); /// Gets rid of all arrays (may be empty) virtual void clearArrays(); /// Returns true if would not find any row virtual bool looksOptimal() const { return false; } /// Called when maximum pivots changes virtual void maximumPivotsChanged() {} //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpDualRowPivot(); /// Copy constructor ClpDualRowPivot(const ClpDualRowPivot &); /// Assignment operator ClpDualRowPivot & operator=(const ClpDualRowPivot& rhs); /// Destructor virtual ~ClpDualRowPivot (); /// Clone virtual ClpDualRowPivot * clone(bool copyData = true) const = 0; //@} ///@name Other //@{ /// Returns model inline ClpSimplex * model() { return model_; } /// Sets model (normally to NULL) inline void setModel(ClpSimplex * newmodel) { model_ = newmodel; } /// Returns type (above 63 is extra information) inline int type() { return type_; } //@} //--------------------------------------------------------------------------- protected: ///@name Protected member data //@{ /// Pointer to model ClpSimplex * model_; /// Type of row pivot algorithm int type_; //@} }; #ifndef CLP_DUAL_COLUMN_MULTIPLIER //#define CLP_DUAL_COLUMN_MULTIPLIER 0.99999 #endif #endif CoinMP-1.8.3/Clp/src/ClpPrimalColumnPivot.cpp0000644000175000017500000000444411510657452017424 0ustar renerene/* $Id: ClpPrimalColumnPivot.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpPrimalColumnPivot.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpPrimalColumnPivot::ClpPrimalColumnPivot () : model_(NULL), type_(-1), looksOptimal_(false) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpPrimalColumnPivot::ClpPrimalColumnPivot (const ClpPrimalColumnPivot & source) : model_(source.model_), type_(source.type_), looksOptimal_(source.looksOptimal_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpPrimalColumnPivot::~ClpPrimalColumnPivot () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpPrimalColumnPivot & ClpPrimalColumnPivot::operator=(const ClpPrimalColumnPivot& rhs) { if (this != &rhs) { type_ = rhs.type_; model_ = rhs.model_; looksOptimal_ = rhs.looksOptimal_; } return *this; } void ClpPrimalColumnPivot::saveWeights(ClpSimplex * model, int ) { model_ = model; } // checks accuracy and may re-initialize (may be empty) void ClpPrimalColumnPivot::updateWeights(CoinIndexedVector *) { } // Gets rid of all arrays void ClpPrimalColumnPivot::clearArrays() { } /* Returns number of extra columns for sprint algorithm - 0 means off. Also number of iterations before recompute */ int ClpPrimalColumnPivot::numberSprintColumns(int & ) const { return 0; } // Switch off sprint idea void ClpPrimalColumnPivot::switchOffSprint() { } CoinMP-1.8.3/Clp/src/Makefile.am0000644000175000017500000002227112323253043014656 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 2030 2014-04-15 15:54:11Z forrest $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libClp # ######################################################################## # Name of the library compiled in this directory. We want it to be installed # in the 'lib' directory lib_LTLIBRARIES = libClp.la libClpSolver.la # List all source files for this library, including headers libClp_la_SOURCES = \ ClpConfig.h \ ClpCholeskyBase.cpp ClpCholeskyBase.hpp \ ClpCholeskyDense.cpp ClpCholeskyDense.hpp \ ClpConstraint.cpp ClpConstraint.hpp \ ClpConstraintLinear.cpp ClpConstraintLinear.hpp \ ClpConstraintQuadratic.cpp ClpConstraintQuadratic.hpp \ Clp_C_Interface.cpp Clp_C_Interface.h \ ClpDualRowDantzig.cpp ClpDualRowDantzig.hpp \ ClpDualRowPivot.cpp ClpDualRowPivot.hpp \ ClpDualRowSteepest.cpp ClpDualRowSteepest.hpp \ ClpDummyMatrix.cpp ClpDummyMatrix.hpp \ ClpDynamicExampleMatrix.cpp ClpDynamicExampleMatrix.hpp \ ClpDynamicMatrix.cpp ClpDynamicMatrix.hpp \ ClpEventHandler.cpp ClpEventHandler.hpp \ ClpFactorization.cpp ClpFactorization.hpp \ ClpGubDynamicMatrix.cpp ClpGubDynamicMatrix.hpp \ ClpGubMatrix.cpp ClpGubMatrix.hpp \ ClpHelperFunctions.cpp ClpHelperFunctions.hpp \ ClpInterior.cpp ClpInterior.hpp \ ClpLinearObjective.cpp ClpLinearObjective.hpp \ ClpMatrixBase.cpp ClpMatrixBase.hpp \ ClpMessage.cpp ClpMessage.hpp \ ClpModel.cpp ClpModel.hpp \ ClpNetworkBasis.cpp ClpNetworkBasis.hpp \ ClpNetworkMatrix.cpp ClpNetworkMatrix.hpp \ ClpNonLinearCost.cpp ClpNonLinearCost.hpp \ ClpNode.cpp ClpNode.hpp \ ClpObjective.cpp ClpObjective.hpp \ ClpPackedMatrix.cpp ClpPackedMatrix.hpp \ ClpParameters.hpp \ ClpPlusMinusOneMatrix.cpp ClpPlusMinusOneMatrix.hpp \ ClpPredictorCorrector.cpp ClpPredictorCorrector.hpp \ ClpPdco.cpp ClpPdco.hpp \ ClpPdcoBase.cpp ClpPdcoBase.hpp \ ClpLsqr.cpp ClpLsqr.hpp \ ClpPresolve.cpp ClpPresolve.hpp \ ClpPrimalColumnDantzig.cpp ClpPrimalColumnDantzig.hpp \ ClpPrimalColumnPivot.cpp ClpPrimalColumnPivot.hpp \ ClpPrimalColumnSteepest.cpp ClpPrimalColumnSteepest.hpp \ ClpQuadraticObjective.cpp ClpQuadraticObjective.hpp \ ClpSimplex.cpp ClpSimplex.hpp \ ClpSimplexDual.cpp ClpSimplexDual.hpp \ ClpSimplexNonlinear.cpp ClpSimplexNonlinear.hpp \ ClpSimplexOther.cpp ClpSimplexOther.hpp \ ClpSimplexPrimal.cpp ClpSimplexPrimal.hpp \ ClpSolve.cpp ClpSolve.hpp \ Idiot.cpp Idiot.hpp \ IdiSolve.cpp if COIN_HAS_ABC libClp_la_SOURCES += \ AbcCommon.hpp \ AbcDualRowDantzig.cpp AbcDualRowDantzig.hpp \ AbcDualRowPivot.cpp AbcDualRowPivot.hpp \ AbcDualRowSteepest.cpp AbcDualRowSteepest.hpp \ AbcMatrix.cpp AbcMatrix.hpp \ AbcNonLinearCost.cpp AbcNonLinearCost.hpp \ AbcPrimalColumnDantzig.cpp AbcPrimalColumnDantzig.hpp \ AbcPrimalColumnPivot.cpp AbcPrimalColumnPivot.hpp \ AbcPrimalColumnSteepest.cpp AbcPrimalColumnSteepest.hpp \ AbcSimplex.cpp AbcSimplex.hpp \ AbcSimplexDual.cpp AbcSimplexDual.hpp \ AbcSimplexPrimal.cpp AbcSimplexPrimal.hpp \ AbcSimplexParallel.cpp \ AbcSimplexFactorization.cpp AbcSimplexFactorization.hpp \ AbcWarmStart.cpp AbcWarmStart.hpp \ CoinAbcBaseFactorization.hpp \ CoinAbcBaseFactorization1.cpp \ CoinAbcBaseFactorization2.cpp \ CoinAbcBaseFactorization3.cpp \ CoinAbcBaseFactorization4.cpp \ CoinAbcBaseFactorization5.cpp \ CoinAbcCommonFactorization.hpp \ CoinAbcCommon.hpp \ CoinAbcDenseFactorization.cpp \ CoinAbcDenseFactorization.hpp \ CoinAbcFactorization.hpp \ CoinAbcFactorization1.cpp \ CoinAbcFactorization2.cpp \ CoinAbcFactorization3.cpp \ CoinAbcFactorization4.cpp \ CoinAbcFactorization5.cpp \ CoinAbcHelperFunctions.cpp CoinAbcHelperFunctions.hpp \ CoinAbcOrderedFactorization1.cpp \ CoinAbcOrderedFactorization2.cpp \ CoinAbcOrderedFactorization3.cpp \ CoinAbcOrderedFactorization4.cpp \ CoinAbcOrderedFactorization5.cpp \ CoinAbcSmallFactorization1.cpp \ CoinAbcSmallFactorization2.cpp \ CoinAbcSmallFactorization3.cpp \ CoinAbcSmallFactorization4.cpp \ CoinAbcSmallFactorization5.cpp endif libClpSolver_la_SOURCES = \ ClpSolver.cpp \ CbcOrClpParam.cpp CbcOrClpParam.hpp \ Clp_ampl.cpp Clp_ampl.h \ MyEventHandler.cpp MyEventHandler.hpp \ MyMessageHandler.cpp MyMessageHandler.hpp \ unitTest.cpp # if AMD, CHOLMOD, or GLPK is available, then compile ClpCholeskyUfl.cpp if COIN_HAS_AMD libClp_la_SOURCES += ClpCholeskyUfl.cpp ClpCholeskyUfl.hpp else if COIN_HAS_CHOLMOD libClp_la_SOURCES += ClpCholeskyUfl.cpp ClpCholeskyUfl.hpp else if COIN_HAS_GLPK libClp_la_SOURCES += ClpCholeskyUfl.cpp ClpCholeskyUfl.hpp endif endif endif if COIN_HAS_MUMPS libClp_la_SOURCES += ClpCholeskyMumps.cpp ClpCholeskyMumps.hpp endif if COIN_HAS_WSMP libClp_la_SOURCES += ClpCholeskyWssmp.cpp ClpCholeskyWssmp.hpp ClpCholeskyWssmpKKT.cpp ClpCholeskyWssmpKKT.hpp endif # List all additionally required libraries if DEPENDENCY_LINKING libClp_la_LIBADD = $(CLPLIB_LIBS) libClpSolver_la_LIBADD = $(CLPLIB_LIBS) libClp.la endif # This is for libtool libClp_la_LDFLAGS = $(LT_LDFLAGS) libClpSolver_la_LDFLAGS = $(LT_LDFLAGS) ######################################################################## # clp program # ######################################################################## # Name of the executable compiled in this directory. We want it to be # installed in the 'bin' directory bin_PROGRAMS = clp # List all source files for this executable, including headers clp_SOURCES = ClpMain.cpp # List all additionally required libraries clp_LDADD = libClpSolver.la libClp.la $(CLPLIB_LIBS) $(ASL_LIBS) # List all dependency libraries (similar to LDADD, but without -l, -L flags) clp_DEPENDENCIES = libClpSolver.la libClp.la $(CLPLIB_DEPENDENCIES) ######################################################################## # Additional flags # ######################################################################## # CbcOrClpParam seem to require COIN_HAS_CLP so that it knows that it is build within Clp AM_CPPFLAGS = $(CLPLIB_CFLAGS) -DCOIN_HAS_CLP if COIN_HAS_CHOLMOD AM_CPPFLAGS += -I`$(CYGPATH_W) $(CHOLMODINCDIR)` endif if COIN_HAS_AMD AM_CPPFLAGS += -I`$(CYGPATH_W) $(AMDINCDIR)` endif # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = \ Clp_C_Interface.h \ ClpCholeskyBase.hpp \ ClpCholeskyDense.hpp \ ClpConstraint.hpp \ ClpConstraintLinear.hpp \ ClpConstraintQuadratic.hpp \ ClpDualRowDantzig.hpp \ ClpDualRowPivot.hpp \ ClpDualRowSteepest.hpp \ ClpDummyMatrix.hpp \ ClpDynamicExampleMatrix.hpp \ ClpDynamicMatrix.hpp \ ClpEventHandler.hpp \ ClpFactorization.hpp \ ClpGubDynamicMatrix.hpp \ ClpGubMatrix.hpp \ ClpInterior.hpp \ ClpLinearObjective.hpp \ ClpMatrixBase.hpp \ ClpMessage.hpp \ ClpModel.hpp \ ClpNetworkMatrix.hpp \ ClpNonLinearCost.hpp \ ClpNode.hpp \ ClpObjective.hpp \ ClpPackedMatrix.hpp \ ClpPdcoBase.hpp \ ClpPlusMinusOneMatrix.hpp \ ClpParameters.hpp \ ClpPresolve.hpp \ ClpPrimalColumnDantzig.hpp \ ClpPrimalColumnPivot.hpp \ ClpPrimalColumnSteepest.hpp \ ClpQuadraticObjective.hpp \ ClpSimplex.hpp \ ClpSimplexNonlinear.hpp \ ClpSimplexOther.hpp \ ClpSimplexDual.hpp \ ClpSimplexPrimal.hpp \ ClpSolve.hpp \ CbcOrClpParam.hpp \ Idiot.hpp if COIN_HAS_ABC includecoin_HEADERS += AbcSimplex.hpp CoinAbcCommon.hpp AbcCommon.hpp AbcNonLinearCost.hpp endif # if AMD, CHOLMOD, or GLPK is available, then install ClpCholeskyUfl.hpp (for advanced users) if COIN_HAS_AMD includecoin_HEADERS += ClpCholeskyUfl.hpp else if COIN_HAS_CHOLMOD includecoin_HEADERS += ClpCholeskyUfl.hpp else if COIN_HAS_GLPK includecoin_HEADERS += ClpCholeskyUfl.hpp endif endif endif if COIN_HAS_MUMPS includecoin_HEADERS += ClpCholeskyMumps.hpp endif if COIN_HAS_WSMP includecoin_HEADERS += ClpCholeskyWssmp.hpp ClpCholeskyWssmpKKT.hpp endif # needed by Clp includecoin_HEADERS += CbcOrClpParam.cpp ######################################################################## # Installing manifest (MSVC++) # ######################################################################## if COIN_CXX_IS_CL install-exec-hook: test -s clp.exe.manifest && \ mt -manifest clp.exe.manifest -outputresource:clp.exe;\ cp clp.exe $(bindir)/clp.exe endif ####################################################################### # Create the Config.h file that has all public defines and install it # ####################################################################### install-exec-local: $(install_sh_DATA) config_clp.h $(DESTDIR)$(includecoindir)/ClpConfig.h uninstall-local: rm -f $(DESTDIR)$(includecoindir)/ClpConfig.h CoinMP-1.8.3/Clp/src/Clp_C_Interface.cpp0000644000175000017500000011525612272631011016272 0ustar renerene// $Id: Clp_C_Interface.cpp 2019 2014-01-31 05:18:01Z stefan $ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include #include "CoinHelperFunctions.hpp" #include "ClpConfig.h" #include "ClpSimplex.hpp" #include "ClpInterior.hpp" #ifndef SLIM_CLP #include "Idiot.hpp" #endif #include // Get C stuff but with extern C #define CLP_EXTERN_C #include "Coin_C_defines.h" /// To allow call backs class CMessageHandler : public CoinMessageHandler { public: /**@name Overrides */ //@{ virtual int print(); //@} /**@name set and get */ //@{ /// Model const Clp_Simplex * model() const; void setModel(Clp_Simplex * model); /// Call back void setCallBack(clp_callback callback); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ CMessageHandler(); /// Constructor with pointer to model CMessageHandler(Clp_Simplex * model, FILE * userPointer = NULL); /** Destructor */ virtual ~CMessageHandler(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ CMessageHandler(const CMessageHandler&); /** The copy constructor from an CoinSimplexMessageHandler. */ CMessageHandler(const CoinMessageHandler&); CMessageHandler& operator=(const CMessageHandler&); /// Clone virtual CoinMessageHandler * clone() const ; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer back to model Clp_Simplex * model_; /// call back clp_callback callback_; //@} }; //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CMessageHandler::CMessageHandler () : CoinMessageHandler(), model_(NULL), callback_(NULL) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CMessageHandler::CMessageHandler (const CMessageHandler & rhs) : CoinMessageHandler(rhs), model_(rhs.model_), callback_(rhs.callback_) { } CMessageHandler::CMessageHandler (const CoinMessageHandler & rhs) : CoinMessageHandler(rhs), model_(NULL), callback_(NULL) { } // Constructor with pointer to model CMessageHandler::CMessageHandler(Clp_Simplex * model, FILE * ) : CoinMessageHandler(), model_(model), callback_(NULL) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CMessageHandler::~CMessageHandler () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CMessageHandler & CMessageHandler::operator=(const CMessageHandler& rhs) { if (this != &rhs) { CoinMessageHandler::operator=(rhs); model_ = rhs.model_; callback_ = rhs.callback_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CoinMessageHandler * CMessageHandler::clone() const { return new CMessageHandler(*this); } int CMessageHandler::print() { if (callback_) { int messageNumber = currentMessage().externalNumber(); if (currentSource() != "Clp") messageNumber += 1000000; int i; int nDouble = numberDoubleFields(); assert (nDouble <= 10); double vDouble[10]; for (i = 0; i < nDouble; i++) vDouble[i] = doubleValue(i); int nInt = numberIntFields(); assert (nInt <= 10); int vInt[10]; for (i = 0; i < nInt; i++) vInt[i] = intValue(i); int nString = numberStringFields(); assert (nString <= 10); char * vString[10]; for (i = 0; i < nString; i++) { std::string value = stringValue(i); vString[i] = CoinStrdup(value.c_str()); } callback_(model_, messageNumber, nDouble, vDouble, nInt, vInt, nString, vString); for (i = 0; i < nString; i++) free(vString[i]); } return CoinMessageHandler::print(); } const Clp_Simplex * CMessageHandler::model() const { return model_; } void CMessageHandler::setModel(Clp_Simplex * model) { model_ = model; } // Call back void CMessageHandler::setCallBack(clp_callback callback) { callback_ = callback; } #include "Clp_C_Interface.h" #include #include #include #if defined(__MWERKS__) #pragma export on #endif COINLIBAPI const char* COINLINKAGE Clp_Version(void) { return CLP_VERSION; } COINLIBAPI int COINLINKAGE Clp_VersionMajor(void) { return CLP_VERSION_MAJOR; } COINLIBAPI int COINLINKAGE Clp_VersionMinor(void) { return CLP_VERSION_MINOR; } COINLIBAPI int COINLINKAGE Clp_VersionRelease(void) { return CLP_VERSION_RELEASE; } /* Default constructor */ COINLIBAPI Clp_Simplex * COINLINKAGE Clp_newModel() { Clp_Simplex * model = new Clp_Simplex; model->model_ = new ClpSimplex(); model->handler_ = NULL; return model; } /* Destructor */ COINLIBAPI void COINLINKAGE Clp_deleteModel(Clp_Simplex * model) { delete model->model_; delete model->handler_; delete model; } /* Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is NULL then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ /* Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ COINLIBAPI void COINLINKAGE Clp_loadProblem (Clp_Simplex * model, const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { const char prefix[] = "Clp_c_Interface::Clp_loadProblem(): "; const int verbose = 0; if (verbose > 1) { printf("%s numcols = %i, numrows = %i\n", prefix, numcols, numrows); printf("%s model = %p, start = %p, index = %p, value = %p\n", prefix, reinterpret_cast(model), reinterpret_cast(start), reinterpret_cast(index), reinterpret_cast(value)); printf("%s collb = %p, colub = %p, obj = %p, rowlb = %p, rowub = %p\n", prefix, reinterpret_cast(collb), reinterpret_cast(colub), reinterpret_cast(obj), reinterpret_cast(rowlb), reinterpret_cast(rowub)); } model->model_->loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); } /* read quadratic part of the objective (the matrix part) */ COINLIBAPI void COINLINKAGE Clp_loadQuadraticObjective(Clp_Simplex * model, const int numberColumns, const CoinBigIndex * start, const int * column, const double * element) { model->model_->loadQuadraticObjective(numberColumns, start, column, element); } /* Read an mps file from the given filename */ COINLIBAPI int COINLINKAGE Clp_readMps(Clp_Simplex * model, const char *filename, int keepNames, int ignoreErrors) { return model->model_->readMps(filename, keepNames != 0, ignoreErrors != 0); } /* Copy in integer informations */ COINLIBAPI void COINLINKAGE Clp_copyInIntegerInformation(Clp_Simplex * model, const char * information) { model->model_->copyInIntegerInformation(information); } /* Drop integer informations */ COINLIBAPI void COINLINKAGE Clp_deleteIntegerInformation(Clp_Simplex * model) { model->model_->deleteIntegerInformation(); } /* Resizes rim part of model */ COINLIBAPI void COINLINKAGE Clp_resize (Clp_Simplex * model, int newNumberRows, int newNumberColumns) { model->model_->resize(newNumberRows, newNumberColumns); } /* Deletes rows */ COINLIBAPI void COINLINKAGE Clp_deleteRows(Clp_Simplex * model, int number, const int * which) { model->model_->deleteRows(number, which); } /* Add rows */ COINLIBAPI void COINLINKAGE Clp_addRows(Clp_Simplex * model, int number, const double * rowLower, const double * rowUpper, const int * rowStarts, const int * columns, const double * elements) { model->model_->addRows(number, rowLower, rowUpper, rowStarts, columns, elements); } /* Deletes columns */ COINLIBAPI void COINLINKAGE Clp_deleteColumns(Clp_Simplex * model, int number, const int * which) { model->model_->deleteColumns(number, which); } /* Add columns */ COINLIBAPI void COINLINKAGE Clp_addColumns(Clp_Simplex * model, int number, const double * columnLower, const double * columnUpper, const double * objective, const int * columnStarts, const int * rows, const double * elements) { model->model_->addColumns(number, columnLower, columnUpper, objective, columnStarts, rows, elements); } /* Change row lower bounds */ COINLIBAPI void COINLINKAGE Clp_chgRowLower(Clp_Simplex * model, const double * rowLower) { model->model_->chgRowLower(rowLower); } /* Change row upper bounds */ COINLIBAPI void COINLINKAGE Clp_chgRowUpper(Clp_Simplex * model, const double * rowUpper) { model->model_->chgRowUpper(rowUpper); } /* Change column lower bounds */ COINLIBAPI void COINLINKAGE Clp_chgColumnLower(Clp_Simplex * model, const double * columnLower) { model->model_->chgColumnLower(columnLower); } /* Change column upper bounds */ COINLIBAPI void COINLINKAGE Clp_chgColumnUpper(Clp_Simplex * model, const double * columnUpper) { model->model_->chgColumnUpper(columnUpper); } /* Change objective coefficients */ COINLIBAPI void COINLINKAGE Clp_chgObjCoefficients(Clp_Simplex * model, const double * objIn) { model->model_->chgObjCoefficients(objIn); } /* Drops names - makes lengthnames 0 and names empty */ COINLIBAPI void COINLINKAGE Clp_dropNames(Clp_Simplex * model) { model->model_->dropNames(); } /* Copies in names */ COINLIBAPI void COINLINKAGE Clp_copyNames(Clp_Simplex * model, const char * const * rowNamesIn, const char * const * columnNamesIn) { int iRow; std::vector rowNames; int numberRows = model->model_->numberRows(); rowNames.reserve(numberRows); for (iRow = 0; iRow < numberRows; iRow++) { rowNames.push_back(rowNamesIn[iRow]); } int iColumn; std::vector columnNames; int numberColumns = model->model_->numberColumns(); columnNames.reserve(numberColumns); for (iColumn = 0; iColumn < numberColumns; iColumn++) { columnNames.push_back(columnNamesIn[iColumn]); } model->model_->copyNames(rowNames, columnNames); } /* Number of rows */ COINLIBAPI int COINLINKAGE Clp_numberRows(Clp_Simplex * model) { return model->model_->numberRows(); } /* Number of columns */ COINLIBAPI int COINLINKAGE Clp_numberColumns(Clp_Simplex * model) { return model->model_->numberColumns(); } /* Primal tolerance to use */ COINLIBAPI double COINLINKAGE Clp_primalTolerance(Clp_Simplex * model) { return model->model_->primalTolerance(); } COINLIBAPI void COINLINKAGE Clp_setPrimalTolerance(Clp_Simplex * model, double value) { model->model_->setPrimalTolerance(value); } /* Dual tolerance to use */ COINLIBAPI double COINLINKAGE Clp_dualTolerance(Clp_Simplex * model) { return model->model_->dualTolerance(); } COINLIBAPI void COINLINKAGE Clp_setDualTolerance(Clp_Simplex * model, double value) { model->model_->setDualTolerance(value); } /* Dual objective limit */ COINLIBAPI double COINLINKAGE Clp_dualObjectiveLimit(Clp_Simplex * model) { return model->model_->dualObjectiveLimit(); } COINLIBAPI void COINLINKAGE Clp_setDualObjectiveLimit(Clp_Simplex * model, double value) { model->model_->setDualObjectiveLimit(value); } /* Objective offset */ COINLIBAPI double COINLINKAGE Clp_objectiveOffset(Clp_Simplex * model) { return model->model_->objectiveOffset(); } COINLIBAPI void COINLINKAGE Clp_setObjectiveOffset(Clp_Simplex * model, double value) { model->model_->setObjectiveOffset(value); } /* Fills in array with problem name */ COINLIBAPI void COINLINKAGE Clp_problemName(Clp_Simplex * model, int maxNumberCharacters, char * array) { std::string name = model->model_->problemName(); maxNumberCharacters = CoinMin(maxNumberCharacters, ((int) strlen(name.c_str()))+1) ; strncpy(array, name.c_str(), maxNumberCharacters - 1); array[maxNumberCharacters-1] = '\0'; } /* Sets problem name. Must have \0 at end. */ COINLIBAPI int COINLINKAGE Clp_setProblemName(Clp_Simplex * model, int /*maxNumberCharacters*/, char * array) { return model->model_->setStrParam(ClpProbName, array); } /* Number of iterations */ COINLIBAPI int COINLINKAGE Clp_numberIterations(Clp_Simplex * model) { return model->model_->numberIterations(); } COINLIBAPI void COINLINKAGE Clp_setNumberIterations(Clp_Simplex * model, int numberIterations) { model->model_->setNumberIterations(numberIterations); } /* Maximum number of iterations */ COINLIBAPI int maximumIterations(Clp_Simplex * model) { return model->model_->maximumIterations(); } COINLIBAPI void COINLINKAGE Clp_setMaximumIterations(Clp_Simplex * model, int value) { model->model_->setMaximumIterations(value); } /* Maximum time in seconds (from when set called) */ COINLIBAPI double COINLINKAGE Clp_maximumSeconds(Clp_Simplex * model) { return model->model_->maximumSeconds(); } COINLIBAPI void COINLINKAGE Clp_setMaximumSeconds(Clp_Simplex * model, double value) { model->model_->setMaximumSeconds(value); } /* Returns true if hit maximum iteratio`ns (or time) */ COINLIBAPI int COINLINKAGE Clp_hitMaximumIterations(Clp_Simplex * model) { return model->model_->hitMaximumIterations() ? 1 : 0; } /* Status of problem: 0 - optimal 1 - primal infeasible 2 - dual infeasible 3 - stopped on iterations etc 4 - stopped due to errors */ COINLIBAPI int COINLINKAGE Clp_status(Clp_Simplex * model) { return model->model_->status(); } /* Set problem status */ COINLIBAPI void COINLINKAGE Clp_setProblemStatus(Clp_Simplex * model, int problemStatus) { model->model_->setProblemStatus(problemStatus); } /* Secondary status of problem - may get extended 0 - none 1 - primal infeasible because dual limit reached 2 - scaled problem optimal - unscaled has primal infeasibilities 3 - scaled problem optimal - unscaled has dual infeasibilities 4 - scaled problem optimal - unscaled has both dual and primal infeasibilities */ COINLIBAPI int COINLINKAGE Clp_secondaryStatus(Clp_Simplex * model) { return model->model_->secondaryStatus(); } COINLIBAPI void COINLINKAGE Clp_setSecondaryStatus(Clp_Simplex * model, int status) { model->model_->setSecondaryStatus(status); } /* Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ COINLIBAPI double COINLINKAGE Clp_optimizationDirection(Clp_Simplex * model) { return model->model_->optimizationDirection(); } COINLIBAPI void COINLINKAGE Clp_setOptimizationDirection(Clp_Simplex * model, double value) { model->model_->setOptimizationDirection(value); } /* Primal row solution */ COINLIBAPI double * COINLINKAGE Clp_primalRowSolution(Clp_Simplex * model) { return model->model_->primalRowSolution(); } /* Primal column solution */ COINLIBAPI double * COINLINKAGE Clp_primalColumnSolution(Clp_Simplex * model) { return model->model_->primalColumnSolution(); } /* Dual row solution */ COINLIBAPI double * COINLINKAGE Clp_dualRowSolution(Clp_Simplex * model) { return model->model_->dualRowSolution(); } /* Reduced costs */ COINLIBAPI double * COINLINKAGE Clp_dualColumnSolution(Clp_Simplex * model) { return model->model_->dualColumnSolution(); } /* Row lower */ COINLIBAPI double* COINLINKAGE Clp_rowLower(Clp_Simplex * model) { return model->model_->rowLower(); } /* Row upper */ COINLIBAPI double* COINLINKAGE Clp_rowUpper(Clp_Simplex * model) { return model->model_->rowUpper(); } /* Objective */ COINLIBAPI double * COINLINKAGE Clp_objective(Clp_Simplex * model) { return model->model_->objective(); } /* Column Lower */ COINLIBAPI double * COINLINKAGE Clp_columnLower(Clp_Simplex * model) { return model->model_->columnLower(); } /* Column Upper */ COINLIBAPI double * COINLINKAGE Clp_columnUpper(Clp_Simplex * model) { return model->model_->columnUpper(); } /* Number of elements in matrix */ COINLIBAPI int COINLINKAGE Clp_getNumElements(Clp_Simplex * model) { return model->model_->getNumElements(); } // Column starts in matrix COINLIBAPI const CoinBigIndex * COINLINKAGE Clp_getVectorStarts(Clp_Simplex * model) { CoinPackedMatrix * matrix; matrix = model->model_->matrix(); return (matrix == NULL) ? NULL : matrix->getVectorStarts(); } // Row indices in matrix COINLIBAPI const int * COINLINKAGE Clp_getIndices(Clp_Simplex * model) { CoinPackedMatrix * matrix = model->model_->matrix(); return (matrix == NULL) ? NULL : matrix->getIndices(); } // Column vector lengths in matrix COINLIBAPI const int * COINLINKAGE Clp_getVectorLengths(Clp_Simplex * model) { CoinPackedMatrix * matrix = model->model_->matrix(); return (matrix == NULL) ? NULL : matrix->getVectorLengths(); } // Element values in matrix COINLIBAPI const double * COINLINKAGE Clp_getElements(Clp_Simplex * model) { CoinPackedMatrix * matrix = model->model_->matrix(); return (matrix == NULL) ? NULL : matrix->getElements(); } /* Objective value */ COINLIBAPI double COINLINKAGE Clp_objectiveValue(Clp_Simplex * model) { return model->model_->objectiveValue(); } /* Integer information */ COINLIBAPI char * COINLINKAGE Clp_integerInformation(Clp_Simplex * model) { return model->model_->integerInformation(); } /* Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use free() on these arrays. */ COINLIBAPI double * COINLINKAGE Clp_infeasibilityRay(Clp_Simplex * model) { const double * ray = model->model_->internalRay(); double * array = NULL; int numberRows = model->model_->numberRows(); int status = model->model_->status(); if (status == 1 && ray) { array = static_cast(malloc(numberRows*sizeof(double))); memcpy(array,ray,numberRows*sizeof(double)); #ifdef PRINT_RAY_METHOD printf("Infeasibility ray obtained by algorithm %s\n",model->model_->algorithm()>0 ? "primal" : "dual"); #endif } return array; } COINLIBAPI double * COINLINKAGE Clp_unboundedRay(Clp_Simplex * model) { const double * ray = model->model_->internalRay(); double * array = NULL; int numberColumns = model->model_->numberColumns(); int status = model->model_->status(); if (status == 2 && ray) { array = static_cast(malloc(numberColumns*sizeof(double))); memcpy(array,ray,numberColumns*sizeof(double)); } return array; } COINLIBAPI void COINLINKAGE Clp_freeRay(Clp_Simplex * model, double * ray) { free(ray); } /* See if status array exists (partly for OsiClp) */ COINLIBAPI int COINLINKAGE Clp_statusExists(Clp_Simplex * model) { return model->model_->statusExists() ? 1 : 0; } /* Return address of status array (char[numberRows+numberColumns]) */ COINLIBAPI unsigned char * COINLINKAGE Clp_statusArray(Clp_Simplex * model) { return model->model_->statusArray(); } /* Copy in status vector */ COINLIBAPI void COINLINKAGE Clp_copyinStatus(Clp_Simplex * model, const unsigned char * statusArray) { model->model_->copyinStatus(statusArray); } /* User pointer for whatever reason */ COINLIBAPI void COINLINKAGE Clp_setUserPointer (Clp_Simplex * model, void * pointer) { model->model_->setUserPointer(pointer); } COINLIBAPI void * COINLINKAGE Clp_getUserPointer (Clp_Simplex * model) { return model->model_->getUserPointer(); } /* Pass in Callback function */ COINLIBAPI void COINLINKAGE Clp_registerCallBack(Clp_Simplex * model, clp_callback userCallBack) { // Will be copy of users one delete model->handler_; model->handler_ = new CMessageHandler(*(model->model_->messageHandler())); model->handler_->setCallBack(userCallBack); model->handler_->setModel(model); model->model_->passInMessageHandler(model->handler_); } /* Unset Callback function */ COINLIBAPI void COINLINKAGE Clp_clearCallBack(Clp_Simplex * model) { delete model->handler_; model->handler_ = NULL; } /* Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - verbose above that 8,16,32 etc just for selective debug */ COINLIBAPI void COINLINKAGE Clp_setLogLevel(Clp_Simplex * model, int value) { model->model_->setLogLevel(value); } COINLIBAPI int COINLINKAGE Clp_logLevel(Clp_Simplex * model) { return model->model_->logLevel(); } /* length of names (0 means no names0 */ COINLIBAPI int COINLINKAGE Clp_lengthNames(Clp_Simplex * model) { return model->model_->lengthNames(); } /* Fill in array (at least lengthNames+1 long) with a row name */ COINLIBAPI void COINLINKAGE Clp_rowName(Clp_Simplex * model, int iRow, char * name) { std::string rowName = model->model_->rowName(iRow); strcpy(name, rowName.c_str()); } /* Fill in array (at least lengthNames+1 long) with a column name */ COINLIBAPI void COINLINKAGE Clp_columnName(Clp_Simplex * model, int iColumn, char * name) { std::string columnName = model->model_->columnName(iColumn); strcpy(name, columnName.c_str()); } /* General solve algorithm which can do presolve. See ClpSolve.hpp for options */ COINLIBAPI int COINLINKAGE Clp_initialSolve(Clp_Simplex * model) { return model->model_->initialSolve(); } /* Pass solve options. (Exception to direct analogue rule) */ COINLIBAPI int COINLINKAGE Clp_initialSolveWithOptions(Clp_Simplex * model, Clp_Solve * s) { return model->model_->initialSolve(s->options); } /* Barrier initial solve */ COINLIBAPI int COINLINKAGE Clp_initialBarrierSolve(Clp_Simplex * model0) { ClpSimplex *model = model0->model_; return model->initialBarrierSolve(); } /* Barrier initial solve */ COINLIBAPI int COINLINKAGE Clp_initialBarrierNoCrossSolve(Clp_Simplex * model0) { ClpSimplex *model = model0->model_; return model->initialBarrierNoCrossSolve(); } /* Dual initial solve */ COINLIBAPI int COINLINKAGE Clp_initialDualSolve(Clp_Simplex * model) { return model->model_->initialDualSolve(); } /* Primal initial solve */ COINLIBAPI int COINLINKAGE Clp_initialPrimalSolve(Clp_Simplex * model) { return model->model_->initialPrimalSolve(); } /* Dual algorithm - see ClpSimplexDual.hpp for method */ COINLIBAPI int COINLINKAGE Clp_dual(Clp_Simplex * model, int ifValuesPass) { return model->model_->dual(ifValuesPass); } /* Primal algorithm - see ClpSimplexPrimal.hpp for method */ COINLIBAPI int COINLINKAGE Clp_primal(Clp_Simplex * model, int ifValuesPass) { return model->model_->primal(ifValuesPass); } /* Sets or unsets scaling, 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later) */ COINLIBAPI void COINLINKAGE Clp_scaling(Clp_Simplex * model, int mode) { model->model_->scaling(mode); } /* Gets scalingFlag */ COINLIBAPI int COINLINKAGE Clp_scalingFlag(Clp_Simplex * model) { return model->model_->scalingFlag(); } /* Crash - at present just aimed at dual, returns -2 if dual preferred and crash basis created -1 if dual preferred and all slack basis preferred 0 if basis going in was not all slack 1 if primal preferred and all slack basis preferred 2 if primal preferred and crash basis created. if gap between bounds <="gap" variables can be flipped If "pivot" is 0 No pivoting (so will just be choice of algorithm) 1 Simple pivoting e.g. gub 2 Mini iterations */ COINLIBAPI int COINLINKAGE Clp_crash(Clp_Simplex * model, double gap, int pivot) { return model->model_->crash(gap, pivot); } /* If problem is primal feasible */ COINLIBAPI int COINLINKAGE Clp_primalFeasible(Clp_Simplex * model) { return model->model_->primalFeasible() ? 1 : 0; } /* If problem is dual feasible */ COINLIBAPI int COINLINKAGE Clp_dualFeasible(Clp_Simplex * model) { return model->model_->dualFeasible() ? 1 : 0; } /* Dual bound */ COINLIBAPI double COINLINKAGE Clp_dualBound(Clp_Simplex * model) { return model->model_->dualBound(); } COINLIBAPI void COINLINKAGE Clp_setDualBound(Clp_Simplex * model, double value) { model->model_->setDualBound(value); } /* Infeasibility cost */ COINLIBAPI double COINLINKAGE Clp_infeasibilityCost(Clp_Simplex * model) { return model->model_->infeasibilityCost(); } COINLIBAPI void COINLINKAGE Clp_setInfeasibilityCost(Clp_Simplex * model, double value) { model->model_->setInfeasibilityCost(value); } /* Perturbation: 50 - switch on perturbation 100 - auto perturb if takes too long (1.0e-6 largest nonzero) 101 - we are perturbed 102 - don't try perturbing again default is 100 others are for playing */ COINLIBAPI int COINLINKAGE Clp_perturbation(Clp_Simplex * model) { return model->model_->perturbation(); } COINLIBAPI void COINLINKAGE Clp_setPerturbation(Clp_Simplex * model, int value) { model->model_->setPerturbation(value); } /* Current (or last) algorithm */ COINLIBAPI int COINLINKAGE Clp_algorithm(Clp_Simplex * model) { return model->model_->algorithm(); } /* Set algorithm */ COINLIBAPI void COINLINKAGE Clp_setAlgorithm(Clp_Simplex * model, int value) { model->model_->setAlgorithm(value); } /* Sum of dual infeasibilities */ COINLIBAPI double COINLINKAGE Clp_sumDualInfeasibilities(Clp_Simplex * model) { return model->model_->sumDualInfeasibilities(); } /* Number of dual infeasibilities */ COINLIBAPI int COINLINKAGE Clp_numberDualInfeasibilities(Clp_Simplex * model) { return model->model_->numberDualInfeasibilities(); } /* Sum of primal infeasibilities */ COINLIBAPI double COINLINKAGE Clp_sumPrimalInfeasibilities(Clp_Simplex * model) { return model->model_->sumPrimalInfeasibilities(); } /* Number of primal infeasibilities */ COINLIBAPI int COINLINKAGE Clp_numberPrimalInfeasibilities(Clp_Simplex * model) { return model->model_->numberPrimalInfeasibilities(); } /* Save model to file, returns 0 if success. This is designed for use outside algorithms so does not save iterating arrays etc. It does not save any messaging information. Does not save scaling values. It does not know about all types of virtual functions. */ COINLIBAPI int COINLINKAGE Clp_saveModel(Clp_Simplex * model, const char * fileName) { return model->model_->saveModel(fileName); } /* Restore model from file, returns 0 if success, deletes current model */ COINLIBAPI int COINLINKAGE Clp_restoreModel(Clp_Simplex * model, const char * fileName) { return model->model_->restoreModel(fileName); } /* Just check solution (for external use) - sets sum of infeasibilities etc */ COINLIBAPI void COINLINKAGE Clp_checkSolution(Clp_Simplex * model) { model->model_->checkSolution(); } /* Number of rows */ COINLIBAPI int COINLINKAGE Clp_getNumRows(Clp_Simplex * model) { return model->model_->getNumRows(); } /* Number of columns */ COINLIBAPI int COINLINKAGE Clp_getNumCols(Clp_Simplex * model) { return model->model_->getNumCols(); } /* Number of iterations */ COINLIBAPI int COINLINKAGE Clp_getIterationCount(Clp_Simplex * model) { return model->model_->getIterationCount(); } /* Are there a numerical difficulties? */ COINLIBAPI int COINLINKAGE Clp_isAbandoned(Clp_Simplex * model) { return model->model_->isAbandoned() ? 1 : 0; } /* Is optimality proven? */ COINLIBAPI int COINLINKAGE Clp_isProvenOptimal(Clp_Simplex * model) { return model->model_->isProvenOptimal() ? 1 : 0; } /* Is primal infeasiblity proven? */ COINLIBAPI int COINLINKAGE Clp_isProvenPrimalInfeasible(Clp_Simplex * model) { return model->model_->isProvenPrimalInfeasible() ? 1 : 0; } /* Is dual infeasiblity proven? */ COINLIBAPI int COINLINKAGE Clp_isProvenDualInfeasible(Clp_Simplex * model) { return model->model_->isProvenDualInfeasible() ? 1 : 0; } /* Is the given primal objective limit reached? */ COINLIBAPI int COINLINKAGE Clp_isPrimalObjectiveLimitReached(Clp_Simplex * model) { return model->model_->isPrimalObjectiveLimitReached() ? 1 : 0; } /* Is the given dual objective limit reached? */ COINLIBAPI int COINLINKAGE Clp_isDualObjectiveLimitReached(Clp_Simplex * model) { return model->model_->isDualObjectiveLimitReached() ? 1 : 0; } /* Iteration limit reached? */ COINLIBAPI int COINLINKAGE Clp_isIterationLimitReached(Clp_Simplex * model) { return model->model_->isIterationLimitReached() ? 1 : 0; } /* Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ COINLIBAPI double COINLINKAGE Clp_getObjSense(Clp_Simplex * model) { return model->model_->getObjSense(); } /* Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ COINLIBAPI void COINLINKAGE Clp_setObjSense(Clp_Simplex * model, double objsen) { model->model_->setOptimizationDirection(objsen); } /* Primal row solution */ COINLIBAPI const double * COINLINKAGE Clp_getRowActivity(Clp_Simplex * model) { return model->model_->getRowActivity(); } /* Primal column solution */ COINLIBAPI const double * COINLINKAGE Clp_getColSolution(Clp_Simplex * model) { return model->model_->getColSolution(); } COINLIBAPI void COINLINKAGE Clp_setColSolution(Clp_Simplex * model, const double * input) { model->model_->setColSolution(input); } /* Dual row solution */ COINLIBAPI const double * COINLINKAGE Clp_getRowPrice(Clp_Simplex * model) { return model->model_->getRowPrice(); } /* Reduced costs */ COINLIBAPI const double * COINLINKAGE Clp_getReducedCost(Clp_Simplex * model) { return model->model_->getReducedCost(); } /* Row lower */ COINLIBAPI const double* COINLINKAGE Clp_getRowLower(Clp_Simplex * model) { return model->model_->getRowLower(); } /* Row upper */ COINLIBAPI const double* COINLINKAGE Clp_getRowUpper(Clp_Simplex * model) { return model->model_->getRowUpper(); } /* Objective */ COINLIBAPI const double * COINLINKAGE Clp_getObjCoefficients(Clp_Simplex * model) { return model->model_->getObjCoefficients(); } /* Column Lower */ COINLIBAPI const double * COINLINKAGE Clp_getColLower(Clp_Simplex * model) { return model->model_->getColLower(); } /* Column Upper */ COINLIBAPI const double * COINLINKAGE Clp_getColUpper(Clp_Simplex * model) { return model->model_->getColUpper(); } /* Objective value */ COINLIBAPI double COINLINKAGE Clp_getObjValue(Clp_Simplex * model) { return model->model_->getObjValue(); } /* Get variable basis info */ COINLIBAPI int COINLINKAGE Clp_getColumnStatus(Clp_Simplex * model, int sequence) { return (int) model->model_->getColumnStatus(sequence); } /* Get row basis info */ COINLIBAPI int COINLINKAGE Clp_getRowStatus(Clp_Simplex * model, int sequence) { return (int) model->model_->getRowStatus(sequence); } /* Set variable basis info */ COINLIBAPI void COINLINKAGE Clp_setColumnStatus(Clp_Simplex * model, int sequence, int value) { if (value >= 0 && value <= 5) { model->model_->setColumnStatus(sequence, (ClpSimplex::Status) value ); if (value == 3 || value == 5) model->model_->primalColumnSolution()[sequence] = model->model_->columnLower()[sequence]; else if (value == 2) model->model_->primalColumnSolution()[sequence] = model->model_->columnUpper()[sequence]; } } /* Set row basis info */ COINLIBAPI void COINLINKAGE Clp_setRowStatus(Clp_Simplex * model, int sequence, int value) { if (value >= 0 && value <= 5) { model->model_->setRowStatus(sequence, (ClpSimplex::Status) value ); if (value == 3 || value == 5) model->model_->primalRowSolution()[sequence] = model->model_->rowLower()[sequence]; else if (value == 2) model->model_->primalRowSolution()[sequence] = model->model_->rowUpper()[sequence]; } } /* Small element value - elements less than this set to zero, default is 1.0e-20 */ COINLIBAPI double COINLINKAGE Clp_getSmallElementValue(Clp_Simplex * model) { return model->model_->getSmallElementValue(); } COINLIBAPI void COINLINKAGE Clp_setSmallElementValue(Clp_Simplex * model, double value) { model->model_->setSmallElementValue(value); } /* Print model */ COINLIBAPI void COINLINKAGE Clp_printModel(Clp_Simplex * model, const char * prefix) { ClpSimplex *clp_simplex = model->model_; int numrows = clp_simplex->numberRows(); int numcols = clp_simplex->numberColumns(); int numelem = clp_simplex->getNumElements(); const CoinBigIndex *start = clp_simplex->matrix()->getVectorStarts(); const int *index = clp_simplex->matrix()->getIndices(); const double *value = clp_simplex->matrix()->getElements(); const double *collb = model->model_->columnLower(); const double *colub = model->model_->columnUpper(); const double *obj = model->model_->objective(); const double *rowlb = model->model_->rowLower(); const double *rowub = model->model_->rowUpper(); printf("%s numcols = %i, numrows = %i, numelem = %i\n", prefix, numcols, numrows, numelem); printf("%s model = %p, start = %p, index = %p, value = %p\n", prefix, reinterpret_cast(model), reinterpret_cast(start), reinterpret_cast(index), reinterpret_cast(value)); clp_simplex->matrix()->dumpMatrix(NULL); { int i; for (i = 0; i <= numcols; i++) printf("%s start[%i] = %i\n", prefix, i, start[i]); for (i = 0; i < numelem; i++) printf("%s index[%i] = %i, value[%i] = %g\n", prefix, i, index[i], i, value[i]); } printf("%s collb = %p, colub = %p, obj = %p, rowlb = %p, rowub = %p\n", prefix, reinterpret_cast(collb), reinterpret_cast(colub), reinterpret_cast(obj), reinterpret_cast(rowlb), reinterpret_cast(rowub)); printf("%s optimization direction = %g\n", prefix, Clp_optimizationDirection(model)); printf(" (1 - minimize, -1 - maximize, 0 - ignore)\n"); { int i; for (i = 0; i < numcols; i++) printf("%s collb[%i] = %g, colub[%i] = %g, obj[%i] = %g\n", prefix, i, collb[i], i, colub[i], i, obj[i]); for (i = 0; i < numrows; i++) printf("%s rowlb[%i] = %g, rowub[%i] = %g\n", prefix, i, rowlb[i], i, rowub[i]); } } #ifndef SLIM_CLP /** Solve the problem with the idiot code */ /* tryhard values: tryhard & 7: 0: NOT lightweight, 105 iterations within a pass (when mu stays fixed) 1: lightweight, but focus more on optimality (mu is high) (23 iters in a pass) 2: lightweight, but focus more on feasibility (11 iters in a pass) 3: lightweight, but focus more on feasibility (23 iters in a pass, so it goes closer to opt than option 2) tryhard >> 3: number of passes, the larger the number the closer it gets to optimality */ COINLIBAPI void COINLINKAGE Clp_idiot(Clp_Simplex * model, int tryhard) { ClpSimplex *clp = model->model_; Idiot info(*clp); int numberpass = tryhard >> 3; int lightweight = tryhard & 7; info.setLightweight(lightweight); info.crash(numberpass, clp->messageHandler(), clp->messagesPointer(), false); } #endif COINLIBAPI Clp_Solve * COINLINKAGE ClpSolve_new() { return new Clp_Solve(); } COINLIBAPI void COINLINKAGE ClpSolve_delete(Clp_Solve * solve) { delete solve; } // space- and error-saving macros #define ClpSolveGetIntProperty(prop) \ COINLIBAPI int COINLINKAGE \ ClpSolve_ ## prop (Clp_Solve *s) \ { \ return s->options.prop(); \ } #define ClpSolveSetIntProperty(prop) \ COINLIBAPI void COINLINKAGE \ ClpSolve_ ## prop (Clp_Solve *s, int val) \ { \ s->options.prop(val); \ } COINLIBAPI void COINLINKAGE ClpSolve_setSpecialOption(Clp_Solve * s, int which, int value, int extraInfo) { s->options.setSpecialOption(which,value,extraInfo); } COINLIBAPI int COINLINKAGE ClpSolve_getSpecialOption(Clp_Solve * s, int which) { return s->options.getSpecialOption(which); } COINLIBAPI void COINLINKAGE ClpSolve_setSolveType(Clp_Solve * s, int method, int extraInfo) { s->options.setSolveType(static_cast(method), extraInfo); } ClpSolveGetIntProperty(getSolveType) COINLIBAPI void COINLINKAGE ClpSolve_setPresolveType(Clp_Solve * s, int amount, int extraInfo) { s->options.setPresolveType(static_cast(amount),extraInfo); } ClpSolveGetIntProperty(getPresolveType) ClpSolveGetIntProperty(getPresolvePasses) COINLIBAPI int COINLINKAGE ClpSolve_getExtraInfo(Clp_Solve * s, int which) { return s->options.getExtraInfo(which); } ClpSolveSetIntProperty(setInfeasibleReturn) ClpSolveGetIntProperty(infeasibleReturn) ClpSolveGetIntProperty(doDual) ClpSolveSetIntProperty(setDoDual) ClpSolveGetIntProperty(doSingleton) ClpSolveSetIntProperty(setDoSingleton) ClpSolveGetIntProperty(doDoubleton) ClpSolveSetIntProperty(setDoDoubleton) ClpSolveGetIntProperty(doTripleton) ClpSolveSetIntProperty(setDoTripleton) ClpSolveGetIntProperty(doTighten) ClpSolveSetIntProperty(setDoTighten) ClpSolveGetIntProperty(doForcing) ClpSolveSetIntProperty(setDoForcing) ClpSolveGetIntProperty(doImpliedFree) ClpSolveSetIntProperty(setDoImpliedFree) ClpSolveGetIntProperty(doDupcol) ClpSolveSetIntProperty(setDoDupcol) ClpSolveGetIntProperty(doDuprow) ClpSolveSetIntProperty(setDoDuprow) ClpSolveGetIntProperty(doSingletonColumn) ClpSolveSetIntProperty(setDoSingletonColumn) ClpSolveGetIntProperty(presolveActions) ClpSolveSetIntProperty(setPresolveActions) ClpSolveGetIntProperty(substitution) ClpSolveSetIntProperty(setSubstitution) #if defined(__MWERKS__) #pragma export off #endif CoinMP-1.8.3/Clp/src/ClpNonLinearCost.cpp0000644000175000017500000024447612323253043016520 0ustar renerene/* $Id: ClpNonLinearCost.cpp 2030 2014-04-15 15:54:11Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include #include "CoinIndexedVector.hpp" #include "ClpSimplex.hpp" #include "CoinHelperFunctions.hpp" #include "ClpNonLinearCost.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpNonLinearCost::ClpNonLinearCost () : changeCost_(0.0), feasibleCost_(0.0), infeasibilityWeight_(-1.0), largestInfeasibility_(0.0), sumInfeasibilities_(0.0), averageTheta_(0.0), numberRows_(0), numberColumns_(0), start_(NULL), whichRange_(NULL), offset_(NULL), lower_(NULL), cost_(NULL), model_(NULL), infeasible_(NULL), numberInfeasibilities_(-1), status_(NULL), bound_(NULL), cost2_(NULL), method_(1), convex_(true), bothWays_(false) { } //#define VALIDATE #ifdef VALIDATE static double * saveLowerV = NULL; static double * saveUpperV = NULL; #ifdef NDEBUG Validate sgould not be set if no debug #endif #endif /* Constructor from simplex. This will just set up wasteful arrays for linear, but later may do dual analysis and even finding duplicate columns */ ClpNonLinearCost::ClpNonLinearCost ( ClpSimplex * model, int method) { method = 2; model_ = model; numberRows_ = model_->numberRows(); //if (numberRows_==402) { //model_->setLogLevel(63); //model_->setMaximumIterations(30000); //} numberColumns_ = model_->numberColumns(); // If gub then we need this extra int numberExtra = model_->numberExtraRows(); if (numberExtra) method = 1; int numberTotal1 = numberRows_ + numberColumns_; int numberTotal = numberTotal1 + numberExtra; convex_ = true; bothWays_ = false; method_ = method; numberInfeasibilities_ = 0; changeCost_ = 0.0; feasibleCost_ = 0.0; infeasibilityWeight_ = -1.0; double * cost = model_->costRegion(); // check if all 0 int iSequence; bool allZero = true; for (iSequence = 0; iSequence < numberTotal1; iSequence++) { if (cost[iSequence]) { allZero = false; break; } } if (allZero&&model_->clpMatrix()->type()<15) model_->setInfeasibilityCost(1.0); double infeasibilityCost = model_->infeasibilityCost(); sumInfeasibilities_ = 0.0; averageTheta_ = 0.0; largestInfeasibility_ = 0.0; // All arrays NULL to start status_ = NULL; bound_ = NULL; cost2_ = NULL; start_ = NULL; whichRange_ = NULL; offset_ = NULL; lower_ = NULL; cost_ = NULL; infeasible_ = NULL; double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); // See how we are storing things bool always4 = (model_->clpMatrix()-> generalExpanded(model_, 10, iSequence) != 0); if (always4) method_ = 1; if (CLP_METHOD1) { start_ = new int [numberTotal+1]; whichRange_ = new int [numberTotal]; offset_ = new int [numberTotal]; memset(offset_, 0, numberTotal * sizeof(int)); // First see how much space we need int put = 0; // For quadratic we need -inf,0,0,+inf for (iSequence = 0; iSequence < numberTotal1; iSequence++) { if (!always4) { if (lower[iSequence] > -COIN_DBL_MAX) put++; if (upper[iSequence] < COIN_DBL_MAX) put++; put += 2; } else { put += 4; } } // and for extra put += 4 * numberExtra; #ifndef NDEBUG int kPut = put; #endif lower_ = new double [put]; cost_ = new double [put]; infeasible_ = new unsigned int[(put+31)>>5]; memset(infeasible_, 0, ((put + 31) >> 5)*sizeof(unsigned int)); put = 0; start_[0] = 0; for (iSequence = 0; iSequence < numberTotal1; iSequence++) { if (!always4) { if (lower[iSequence] > -COIN_DBL_MAX) { lower_[put] = -COIN_DBL_MAX; setInfeasible(put, true); cost_[put++] = cost[iSequence] - infeasibilityCost; } whichRange_[iSequence] = put; lower_[put] = lower[iSequence]; cost_[put++] = cost[iSequence]; lower_[put] = upper[iSequence]; cost_[put++] = cost[iSequence] + infeasibilityCost; if (upper[iSequence] < COIN_DBL_MAX) { lower_[put] = COIN_DBL_MAX; setInfeasible(put - 1, true); cost_[put++] = 1.0e50; } } else { lower_[put] = -COIN_DBL_MAX; setInfeasible(put, true); cost_[put++] = cost[iSequence] - infeasibilityCost; whichRange_[iSequence] = put; lower_[put] = lower[iSequence]; cost_[put++] = cost[iSequence]; lower_[put] = upper[iSequence]; cost_[put++] = cost[iSequence] + infeasibilityCost; lower_[put] = COIN_DBL_MAX; setInfeasible(put - 1, true); cost_[put++] = 1.0e50; } start_[iSequence+1] = put; } for (; iSequence < numberTotal; iSequence++) { lower_[put] = -COIN_DBL_MAX; setInfeasible(put, true); put++; whichRange_[iSequence] = put; lower_[put] = 0.0; cost_[put++] = 0.0; lower_[put] = 0.0; cost_[put++] = 0.0; lower_[put] = COIN_DBL_MAX; setInfeasible(put - 1, true); cost_[put++] = 1.0e50; start_[iSequence+1] = put; } assert (put <= kPut); } #ifdef FAST_CLPNON // See how we are storing things CoinAssert (model_->clpMatrix()-> generalExpanded(model_, 10, iSequence) == 0); #endif if (CLP_METHOD2) { assert (!numberExtra); bound_ = new double[numberTotal]; cost2_ = new double[numberTotal]; status_ = new unsigned char[numberTotal]; #ifdef VALIDATE delete [] saveLowerV; saveLowerV = CoinCopyOfArray(model_->lowerRegion(), numberTotal); delete [] saveUpperV; saveUpperV = CoinCopyOfArray(model_->upperRegion(), numberTotal); #endif for (iSequence = 0; iSequence < numberTotal; iSequence++) { bound_[iSequence] = 0.0; cost2_[iSequence] = cost[iSequence]; setInitialStatus(status_[iSequence]); } } } #if 0 // Refresh - assuming regions OK void ClpNonLinearCost::refresh() { int numberTotal = numberRows_ + numberColumns_; numberInfeasibilities_ = 0; sumInfeasibilities_ = 0.0; largestInfeasibility_ = 0.0; double infeasibilityCost = model_->infeasibilityCost(); double primalTolerance = model_->currentPrimalTolerance(); double * cost = model_->costRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * solution = model_->solutionRegion(); for (int iSequence = 0; iSequence < numberTotal; iSequence++) { cost2_[iSequence] = cost[iSequence]; double value = solution[iSequence]; double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible status_[iSequence] = static_cast(CLP_FEASIBLE | (CLP_SAME << 4)); bound_[iSequence] = 0.0; } else { // below double infeasibility = lowerValue - value - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); cost[iSequence] -= infeasibilityCost; numberInfeasibilities_++; status_[iSequence] = static_cast(CLP_BELOW_LOWER | (CLP_SAME << 4)); bound_[iSequence] = upperValue; upper[iSequence] = lowerValue; lower[iSequence] = -COIN_DBL_MAX; } } else { // above double infeasibility = value - upperValue - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); cost[iSequence] += infeasibilityCost; numberInfeasibilities_++; status_[iSequence] = static_cast(CLP_ABOVE_UPPER | (CLP_SAME << 4)); bound_[iSequence] = lowerValue; lower[iSequence] = upperValue; upper[iSequence] = COIN_DBL_MAX; } } // checkInfeasibilities(model_->primalTolerance()); } #endif // Refreshes costs always makes row costs zero void ClpNonLinearCost::refreshCosts(const double * columnCosts) { double * cost = model_->costRegion(); // zero row costs memset(cost + numberColumns_, 0, numberRows_ * sizeof(double)); // copy column costs CoinMemcpyN(columnCosts, numberColumns_, cost); if ((method_ & 1) != 0) { for (int iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { int start = start_[iSequence]; int end = start_[iSequence+1] - 1; double thisFeasibleCost = cost[iSequence]; if (infeasible(start)) { cost_[start] = thisFeasibleCost - infeasibilityWeight_; cost_[start+1] = thisFeasibleCost; } else { cost_[start] = thisFeasibleCost; } if (infeasible(end - 1)) { cost_[end-1] = thisFeasibleCost + infeasibilityWeight_; } } } if (CLP_METHOD2) { for (int iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { cost2_[iSequence] = cost[iSequence]; } } } ClpNonLinearCost::ClpNonLinearCost(ClpSimplex * model, const int * starts, const double * lowerNon, const double * costNon) { #ifndef FAST_CLPNON // what about scaling? - only try without it initially assert(!model->scalingFlag()); model_ = model; numberRows_ = model_->numberRows(); numberColumns_ = model_->numberColumns(); int numberTotal = numberRows_ + numberColumns_; convex_ = true; bothWays_ = true; start_ = new int [numberTotal+1]; whichRange_ = new int [numberTotal]; offset_ = new int [numberTotal]; memset(offset_, 0, numberTotal * sizeof(int)); double whichWay = model_->optimizationDirection(); COIN_DETAIL_PRINT(printf("Direction %g\n", whichWay)); numberInfeasibilities_ = 0; changeCost_ = 0.0; feasibleCost_ = 0.0; double infeasibilityCost = model_->infeasibilityCost(); infeasibilityWeight_ = infeasibilityCost;; largestInfeasibility_ = 0.0; sumInfeasibilities_ = 0.0; int iSequence; assert (!model_->rowObjective()); double * cost = model_->objective(); // First see how much space we need // Also set up feasible bounds int put = starts[numberColumns_]; double * columnUpper = model_->columnUpper(); double * columnLower = model_->columnLower(); for (iSequence = 0; iSequence < numberColumns_; iSequence++) { if (columnLower[iSequence] > -1.0e20) put++; if (columnUpper[iSequence] < 1.0e20) put++; } double * rowUpper = model_->rowUpper(); double * rowLower = model_->rowLower(); for (iSequence = 0; iSequence < numberRows_; iSequence++) { if (rowLower[iSequence] > -1.0e20) put++; if (rowUpper[iSequence] < 1.0e20) put++; put += 2; } lower_ = new double [put]; cost_ = new double [put]; infeasible_ = new unsigned int[(put+31)>>5]; memset(infeasible_, 0, ((put + 31) >> 5)*sizeof(unsigned int)); // now fill in put = 0; start_[0] = 0; for (iSequence = 0; iSequence < numberTotal; iSequence++) { lower_[put] = -COIN_DBL_MAX; whichRange_[iSequence] = put + 1; double thisCost; double lowerValue; double upperValue; if (iSequence >= numberColumns_) { // rows lowerValue = rowLower[iSequence-numberColumns_]; upperValue = rowUpper[iSequence-numberColumns_]; if (lowerValue > -1.0e30) { setInfeasible(put, true); cost_[put++] = -infeasibilityCost; lower_[put] = lowerValue; } cost_[put++] = 0.0; thisCost = 0.0; } else { // columns - move costs and see if convex lowerValue = columnLower[iSequence]; upperValue = columnUpper[iSequence]; if (lowerValue > -1.0e30) { setInfeasible(put, true); cost_[put++] = whichWay * cost[iSequence] - infeasibilityCost; lower_[put] = lowerValue; } int iIndex = starts[iSequence]; int end = starts[iSequence+1]; assert (fabs(columnLower[iSequence] - lowerNon[iIndex]) < 1.0e-8); thisCost = -COIN_DBL_MAX; for (; iIndex < end; iIndex++) { if (lowerNon[iIndex] < columnUpper[iSequence] - 1.0e-8) { lower_[put] = lowerNon[iIndex]; cost_[put++] = whichWay * costNon[iIndex]; // check convexity if (whichWay * costNon[iIndex] < thisCost - 1.0e-12) convex_ = false; thisCost = whichWay * costNon[iIndex]; } else { break; } } } lower_[put] = upperValue; setInfeasible(put, true); cost_[put++] = thisCost + infeasibilityCost; if (upperValue < 1.0e20) { lower_[put] = COIN_DBL_MAX; cost_[put++] = 1.0e50; } int iFirst = start_[iSequence]; if (lower_[iFirst] != -COIN_DBL_MAX) { setInfeasible(iFirst, true); whichRange_[iSequence] = iFirst + 1; } else { whichRange_[iSequence] = iFirst; } start_[iSequence+1] = put; } // can't handle non-convex at present assert(convex_); status_ = NULL; bound_ = NULL; cost2_ = NULL; method_ = 1; #else printf("recompile ClpNonLinearCost without FAST_CLPNON\n"); abort(); #endif } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpNonLinearCost::ClpNonLinearCost (const ClpNonLinearCost & rhs) : changeCost_(0.0), feasibleCost_(0.0), infeasibilityWeight_(-1.0), largestInfeasibility_(0.0), sumInfeasibilities_(0.0), averageTheta_(0.0), numberRows_(rhs.numberRows_), numberColumns_(rhs.numberColumns_), start_(NULL), whichRange_(NULL), offset_(NULL), lower_(NULL), cost_(NULL), model_(NULL), infeasible_(NULL), numberInfeasibilities_(-1), status_(NULL), bound_(NULL), cost2_(NULL), method_(rhs.method_), convex_(true), bothWays_(rhs.bothWays_) { if (numberRows_) { int numberTotal = numberRows_ + numberColumns_; model_ = rhs.model_; numberInfeasibilities_ = rhs.numberInfeasibilities_; changeCost_ = rhs.changeCost_; feasibleCost_ = rhs.feasibleCost_; infeasibilityWeight_ = rhs.infeasibilityWeight_; largestInfeasibility_ = rhs.largestInfeasibility_; sumInfeasibilities_ = rhs.sumInfeasibilities_; averageTheta_ = rhs.averageTheta_; convex_ = rhs.convex_; if (CLP_METHOD1) { start_ = new int [numberTotal+1]; CoinMemcpyN(rhs.start_, (numberTotal + 1), start_); whichRange_ = new int [numberTotal]; CoinMemcpyN(rhs.whichRange_, numberTotal, whichRange_); offset_ = new int [numberTotal]; CoinMemcpyN(rhs.offset_, numberTotal, offset_); int numberEntries = start_[numberTotal]; lower_ = new double [numberEntries]; CoinMemcpyN(rhs.lower_, numberEntries, lower_); cost_ = new double [numberEntries]; CoinMemcpyN(rhs.cost_, numberEntries, cost_); infeasible_ = new unsigned int[(numberEntries+31)>>5]; CoinMemcpyN(rhs.infeasible_, ((numberEntries + 31) >> 5), infeasible_); } if (CLP_METHOD2) { bound_ = CoinCopyOfArray(rhs.bound_, numberTotal); cost2_ = CoinCopyOfArray(rhs.cost2_, numberTotal); status_ = CoinCopyOfArray(rhs.status_, numberTotal); } } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpNonLinearCost::~ClpNonLinearCost () { delete [] start_; delete [] whichRange_; delete [] offset_; delete [] lower_; delete [] cost_; delete [] infeasible_; delete [] status_; delete [] bound_; delete [] cost2_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpNonLinearCost & ClpNonLinearCost::operator=(const ClpNonLinearCost& rhs) { if (this != &rhs) { numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; delete [] start_; delete [] whichRange_; delete [] offset_; delete [] lower_; delete [] cost_; delete [] infeasible_; delete [] status_; delete [] bound_; delete [] cost2_; start_ = NULL; whichRange_ = NULL; lower_ = NULL; cost_ = NULL; infeasible_ = NULL; status_ = NULL; bound_ = NULL; cost2_ = NULL; method_ = rhs.method_; if (numberRows_) { int numberTotal = numberRows_ + numberColumns_; if (CLP_METHOD1) { start_ = new int [numberTotal+1]; CoinMemcpyN(rhs.start_, (numberTotal + 1), start_); whichRange_ = new int [numberTotal]; CoinMemcpyN(rhs.whichRange_, numberTotal, whichRange_); offset_ = new int [numberTotal]; CoinMemcpyN(rhs.offset_, numberTotal, offset_); int numberEntries = start_[numberTotal]; lower_ = new double [numberEntries]; CoinMemcpyN(rhs.lower_, numberEntries, lower_); cost_ = new double [numberEntries]; CoinMemcpyN(rhs.cost_, numberEntries, cost_); infeasible_ = new unsigned int[(numberEntries+31)>>5]; CoinMemcpyN(rhs.infeasible_, ((numberEntries + 31) >> 5), infeasible_); } if (CLP_METHOD2) { bound_ = CoinCopyOfArray(rhs.bound_, numberTotal); cost2_ = CoinCopyOfArray(rhs.cost2_, numberTotal); status_ = CoinCopyOfArray(rhs.status_, numberTotal); } } model_ = rhs.model_; numberInfeasibilities_ = rhs.numberInfeasibilities_; changeCost_ = rhs.changeCost_; feasibleCost_ = rhs.feasibleCost_; infeasibilityWeight_ = rhs.infeasibilityWeight_; largestInfeasibility_ = rhs.largestInfeasibility_; sumInfeasibilities_ = rhs.sumInfeasibilities_; averageTheta_ = rhs.averageTheta_; convex_ = rhs.convex_; bothWays_ = rhs.bothWays_; } return *this; } // Changes infeasible costs and computes number and cost of infeas // We will need to re-think objective offsets later // We will also need a 2 bit per variable array for some // purpose which will come to me later void ClpNonLinearCost::checkInfeasibilities(double oldTolerance) { numberInfeasibilities_ = 0; double infeasibilityCost = model_->infeasibilityCost(); changeCost_ = 0.0; largestInfeasibility_ = 0.0; sumInfeasibilities_ = 0.0; double primalTolerance = model_->currentPrimalTolerance(); int iSequence; double * solution = model_->solutionRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); bool toNearest = oldTolerance <= 0.0; feasibleCost_ = 0.0; //bool checkCosts = (infeasibilityWeight_ != infeasibilityCost); infeasibilityWeight_ = infeasibilityCost; int numberTotal = numberColumns_ + numberRows_; //#define NONLIN_DEBUG #ifdef NONLIN_DEBUG double * saveSolution = NULL; double * saveLower = NULL; double * saveUpper = NULL; unsigned char * saveStatus = NULL; if (method_ == 3) { // Save solution as we will be checking saveSolution = CoinCopyOfArray(solution, numberTotal); saveLower = CoinCopyOfArray(lower, numberTotal); saveUpper = CoinCopyOfArray(upper, numberTotal); saveStatus = CoinCopyOfArray(model_->statusArray(), numberTotal); } #else assert (method_ != 3); #endif if (CLP_METHOD1) { // nonbasic should be at a valid bound for (iSequence = 0; iSequence < numberTotal; iSequence++) { double lowerValue; double upperValue; double value = solution[iSequence]; int iRange; // get correct place int start = start_[iSequence]; int end = start_[iSequence+1] - 1; // correct costs for this infeasibility weight // If free then true cost will be first double thisFeasibleCost = cost_[start]; if (infeasible(start)) { thisFeasibleCost = cost_[start+1]; cost_[start] = thisFeasibleCost - infeasibilityCost; } if (infeasible(end - 1)) { thisFeasibleCost = cost_[end-2]; cost_[end-1] = thisFeasibleCost + infeasibilityCost; } for (iRange = start; iRange < end; iRange++) { if (value < lower_[iRange+1] + primalTolerance) { // put in better range if infeasible if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; whichRange_[iSequence] = iRange; break; } } assert(iRange < end); lowerValue = lower_[iRange]; upperValue = lower_[iRange+1]; ClpSimplex::Status status = model_->getStatus(iSequence); if (upperValue == lowerValue && status != ClpSimplex::isFixed) { if (status != ClpSimplex::basic) { model_->setStatus(iSequence, ClpSimplex::isFixed); status = ClpSimplex::isFixed; } } //#define PRINT_DETAIL7 2 #if PRINT_DETAIL7>1 printf("NL %d sol %g bounds %g %g\n", iSequence,solution[iSequence], lowerValue,upperValue); #endif switch(status) { case ClpSimplex::basic: case ClpSimplex::superBasic: // iRange is in correct place // slot in here if (infeasible(iRange)) { if (lower_[iRange] < -1.0e50) { //cost_[iRange] = cost_[iRange+1]-infeasibilityCost; // possibly below lowerValue = lower_[iRange+1]; if (value - lowerValue < -primalTolerance) { value = lowerValue - value - primalTolerance; #ifndef NDEBUG if(value > 1.0e15) printf("nonlincostb %d %g %g %g\n", iSequence, lowerValue, solution[iSequence], lower_[iRange+2]); #endif #if PRINT_DETAIL7 printf("**NL %d sol %g below %g\n", iSequence,solution[iSequence], lowerValue); #endif sumInfeasibilities_ += value; largestInfeasibility_ = CoinMax(largestInfeasibility_, value); changeCost_ -= lowerValue * (cost_[iRange] - cost[iSequence]); numberInfeasibilities_++; } } else { //cost_[iRange] = cost_[iRange-1]+infeasibilityCost; // possibly above upperValue = lower_[iRange]; if (value - upperValue > primalTolerance) { value = value - upperValue - primalTolerance; #ifndef NDEBUG if(value > 1.0e15) printf("nonlincostu %d %g %g %g\n", iSequence, lower_[iRange-1], solution[iSequence], upperValue); #endif #if PRINT_DETAIL7 printf("**NL %d sol %g above %g\n", iSequence,solution[iSequence], upperValue); #endif sumInfeasibilities_ += value; largestInfeasibility_ = CoinMax(largestInfeasibility_, value); changeCost_ -= upperValue * (cost_[iRange] - cost[iSequence]); numberInfeasibilities_++; } } } //lower[iSequence] = lower_[iRange]; //upper[iSequence] = lower_[iRange+1]; //cost[iSequence] = cost_[iRange]; break; case ClpSimplex::isFree: //if (toNearest) //solution[iSequence] = 0.0; break; case ClpSimplex::atUpperBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place if (fabs(value - upperValue) > oldTolerance * 1.0001) { if (fabs(value - lowerValue) <= oldTolerance * 1.0001) { if (fabs(value - lowerValue) > primalTolerance) solution[iSequence] = lowerValue; model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else { model_->setStatus(iSequence, ClpSimplex::superBasic); } } else if (fabs(value - upperValue) > primalTolerance) { solution[iSequence] = upperValue; } } else { // Set to nearest and make at upper bound int kRange; iRange = -1; double nearest = COIN_DBL_MAX; for (kRange = start; kRange < end; kRange++) { if (fabs(lower_[kRange] - value) < nearest) { nearest = fabs(lower_[kRange] - value); iRange = kRange; } } assert (iRange >= 0); iRange--; whichRange_[iSequence] = iRange; solution[iSequence] = lower_[iRange+1]; } break; case ClpSimplex::atLowerBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place // below stops compiler error with gcc 3.2!!! if (iSequence == -119) printf("ZZ %g %g %g %g\n", lowerValue, value, upperValue, oldTolerance); if (fabs(value - lowerValue) > oldTolerance * 1.0001) { if (fabs(value - upperValue) <= oldTolerance * 1.0001) { if (fabs(value - upperValue) > primalTolerance) solution[iSequence] = upperValue; model_->setStatus(iSequence, ClpSimplex::atUpperBound); } else { model_->setStatus(iSequence, ClpSimplex::superBasic); } } else if (fabs(value - lowerValue) > primalTolerance) { solution[iSequence] = lowerValue; } } else { // Set to nearest and make at lower bound int kRange; iRange = -1; double nearest = COIN_DBL_MAX; for (kRange = start; kRange < end; kRange++) { if (fabs(lower_[kRange] - value) < nearest) { nearest = fabs(lower_[kRange] - value); iRange = kRange; } } assert (iRange >= 0); whichRange_[iSequence] = iRange; solution[iSequence] = lower_[iRange]; } break; case ClpSimplex::isFixed: if (toNearest) { // Set to true fixed for (iRange = start; iRange < end; iRange++) { if (lower_[iRange] == lower_[iRange+1]) break; } if (iRange == end) { // Odd - but make sensible // Set to nearest and make at lower bound int kRange; iRange = -1; double nearest = COIN_DBL_MAX; for (kRange = start; kRange < end; kRange++) { if (fabs(lower_[kRange] - value) < nearest) { nearest = fabs(lower_[kRange] - value); iRange = kRange; } } assert (iRange >= 0); whichRange_[iSequence] = iRange; if (lower_[iRange] != lower_[iRange+1]) model_->setStatus(iSequence, ClpSimplex::atLowerBound); else model_->setStatus(iSequence, ClpSimplex::atUpperBound); } solution[iSequence] = lower_[iRange]; } break; } lower[iSequence] = lower_[iRange]; upper[iSequence] = lower_[iRange+1]; cost[iSequence] = cost_[iRange]; feasibleCost_ += thisFeasibleCost * solution[iSequence]; //assert (iRange==whichRange_[iSequence]); } } #ifdef NONLIN_DEBUG double saveCost = feasibleCost_; if (method_ == 3) { feasibleCost_ = 0.0; // Put back solution as we will be checking unsigned char * statusA = model_->statusArray(); for (iSequence = 0; iSequence < numberTotal; iSequence++) { double value = solution[iSequence]; solution[iSequence] = saveSolution[iSequence]; saveSolution[iSequence] = value; value = lower[iSequence]; lower[iSequence] = saveLower[iSequence]; saveLower[iSequence] = value; value = upper[iSequence]; upper[iSequence] = saveUpper[iSequence]; saveUpper[iSequence] = value; unsigned char value2 = statusA[iSequence]; statusA[iSequence] = saveStatus[iSequence]; saveStatus[iSequence] = value2; } } #endif if (CLP_METHOD2) { //#define CLP_NON_JUST_BASIC #ifndef CLP_NON_JUST_BASIC // nonbasic should be at a valid bound for (iSequence = 0; iSequence < numberTotal; iSequence++) { #else const int * pivotVariable = model_->pivotVariable(); for (int i=0;igetStatus(iSequence); if (upperValue == lowerValue && status != ClpSimplex::isFixed) { if (status != ClpSimplex::basic) { model_->setStatus(iSequence, ClpSimplex::isFixed); status = ClpSimplex::isFixed; } } switch(status) { case ClpSimplex::basic: case ClpSimplex::superBasic: if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; assert (fabs(lowerValue) < 1.0e100); double infeasibility = lowerValue - value - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); costValue = trueCost - infeasibilityCost; changeCost_ -= lowerValue * (costValue - cost[iSequence]); numberInfeasibilities_++; } } else { // above newWhere = CLP_ABOVE_UPPER; double infeasibility = value - upperValue - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); costValue = trueCost + infeasibilityCost; changeCost_ -= upperValue * (costValue - cost[iSequence]); numberInfeasibilities_++; } break; case ClpSimplex::isFree: break; case ClpSimplex::atUpperBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place if (fabs(value - upperValue) > oldTolerance * 1.0001) { if (fabs(value - lowerValue) <= oldTolerance * 1.0001) { if (fabs(value - lowerValue) > primalTolerance) { solution[iSequence] = lowerValue; value = lowerValue; } model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else { if (value < upperValue) { if (value > lowerValue) { model_->setStatus(iSequence, ClpSimplex::superBasic); } else { // set to lower bound as infeasible solution[iSequence] = lowerValue; value = lowerValue; model_->setStatus(iSequence, ClpSimplex::atLowerBound); } } else { // set to upper bound as infeasible solution[iSequence] = upperValue; value = upperValue; } } } else if (fabs(value - upperValue) > primalTolerance) { solution[iSequence] = upperValue; value = upperValue; } } else { // Set to nearest and make at bound if (fabs(value - lowerValue) < fabs(value - upperValue)) { solution[iSequence] = lowerValue; value = lowerValue; model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else { solution[iSequence] = upperValue; value = upperValue; } } break; case ClpSimplex::atLowerBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place if (fabs(value - lowerValue) > oldTolerance * 1.0001) { if (fabs(value - upperValue) <= oldTolerance * 1.0001) { if (fabs(value - upperValue) > primalTolerance) { solution[iSequence] = upperValue; value = upperValue; } model_->setStatus(iSequence, ClpSimplex::atUpperBound); } else { if (value < upperValue) { if (value > lowerValue) { model_->setStatus(iSequence, ClpSimplex::superBasic); } else { // set to lower bound as infeasible solution[iSequence] = lowerValue; value = lowerValue; } } else { // set to upper bound as infeasible solution[iSequence] = upperValue; value = upperValue; model_->setStatus(iSequence, ClpSimplex::atUpperBound); } } } else if (fabs(value - lowerValue) > primalTolerance) { solution[iSequence] = lowerValue; value = lowerValue; } } else { // Set to nearest and make at bound if (fabs(value - lowerValue) < fabs(value - upperValue)) { solution[iSequence] = lowerValue; value = lowerValue; } else { solution[iSequence] = upperValue; value = upperValue; model_->setStatus(iSequence, ClpSimplex::atUpperBound); } } break; case ClpSimplex::isFixed: solution[iSequence] = lowerValue; value = lowerValue; break; } #ifdef NONLIN_DEBUG double lo = saveLower[iSequence]; double up = saveUpper[iSequence]; double cc = cost[iSequence]; unsigned char ss = saveStatus[iSequence]; unsigned char snow = model_->statusArray()[iSequence]; #endif if (iWhere != newWhere) { setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; costValue = trueCost - infeasibilityCost; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; costValue = trueCost + infeasibilityCost; } else { costValue = trueCost; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; assert (lowerValue<=upperValue); } // always do as other things may change cost[iSequence] = costValue; #ifdef NONLIN_DEBUG if (method_ == 3) { assert (ss == snow); assert (cc == cost[iSequence]); assert (lo == lower[iSequence]); assert (up == upper[iSequence]); assert (value == saveSolution[iSequence]); } #endif feasibleCost_ += trueCost * value; } } #ifdef NONLIN_DEBUG if (method_ == 3) assert (fabs(saveCost - feasibleCost_) < 0.001 * (1.0 + CoinMax(fabs(saveCost), fabs(feasibleCost_)))); delete [] saveSolution; delete [] saveLower; delete [] saveUpper; delete [] saveStatus; #endif //feasibleCost_ /= (model_->rhsScale()*model_->objScale()); } // Puts feasible bounds into lower and upper void ClpNonLinearCost::feasibleBounds() { if (CLP_METHOD2) { int iSequence; double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); int numberTotal = numberColumns_ + numberRows_; for (iSequence = 0; iSequence < numberTotal; iSequence++) { unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; } setOriginalStatus(status_[iSequence], CLP_FEASIBLE); lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } } } /* Goes through one bound for each variable. If array[i]*multiplier>0 goes down, otherwise up. The indices are row indices and need converting to sequences */ void ClpNonLinearCost::goThru(int numberInArray, double multiplier, const int * index, const double * array, double * rhs) { assert (model_ != NULL); abort(); const int * pivotVariable = model_->pivotVariable(); if (CLP_METHOD1) { for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double alpha = multiplier * array[iRow]; // get where in bound sequence int iRange = whichRange_[iSequence]; iRange += offset_[iSequence]; //add temporary bias double value = model_->solution(iSequence); if (alpha > 0.0) { // down one iRange--; assert(iRange >= start_[iSequence]); rhs[iRow] = value - lower_[iRange]; } else { // up one iRange++; assert(iRange < start_[iSequence+1] - 1); rhs[iRow] = lower_[iRange+1] - value; } offset_[iSequence] = iRange - whichRange_[iSequence]; } } #ifdef NONLIN_DEBUG double * saveRhs = NULL; if (method_ == 3) { int numberRows = model_->numberRows(); saveRhs = CoinCopyOfArray(rhs, numberRows); } #endif if (CLP_METHOD2) { const double * solution = model_->solutionRegion(); const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double alpha = multiplier * array[iRow]; double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; int iWhere = currentStatus(iStatus); if (iWhere == CLP_SAME) iWhere = originalStatus(iStatus); if (iWhere == CLP_FEASIBLE) { if (alpha > 0.0) { // going below iWhere = CLP_BELOW_LOWER; rhs[iRow] = value - lower[iSequence]; } else { // going above iWhere = CLP_ABOVE_UPPER; rhs[iRow] = upper[iSequence] - value; } } else if(iWhere == CLP_BELOW_LOWER) { assert (alpha < 0); // going feasible iWhere = CLP_FEASIBLE; rhs[iRow] = upper[iSequence] - value; } else { assert (iWhere == CLP_ABOVE_UPPER); // going feasible iWhere = CLP_FEASIBLE; rhs[iRow] = value - lower[iSequence]; } #ifdef NONLIN_DEBUG if (method_ == 3) assert (rhs[iRow] == saveRhs[iRow]); #endif setCurrentStatus(status_[iSequence], iWhere); } } #ifdef NONLIN_DEBUG delete [] saveRhs; #endif } /* Takes off last iteration (i.e. offsets closer to 0) */ void ClpNonLinearCost::goBack(int numberInArray, const int * index, double * rhs) { assert (model_ != NULL); abort(); const int * pivotVariable = model_->pivotVariable(); if (CLP_METHOD1) { for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; // get where in bound sequence int iRange = whichRange_[iSequence]; // get closer to original if (offset_[iSequence] > 0) { offset_[iSequence]--; assert (offset_[iSequence] >= 0); iRange += offset_[iSequence]; //add temporary bias double value = model_->solution(iSequence); // up one assert(iRange < start_[iSequence+1] - 1); rhs[iRow] = lower_[iRange+1] - value; // was earlier lower_[iRange] } else { offset_[iSequence]++; assert (offset_[iSequence] <= 0); iRange += offset_[iSequence]; //add temporary bias double value = model_->solution(iSequence); // down one assert(iRange >= start_[iSequence]); rhs[iRow] = value - lower_[iRange]; // was earlier lower_[iRange+1] } } } #ifdef NONLIN_DEBUG double * saveRhs = NULL; if (method_ == 3) { int numberRows = model_->numberRows(); saveRhs = CoinCopyOfArray(rhs, numberRows); } #endif if (CLP_METHOD2) { const double * solution = model_->solutionRegion(); const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; int iWhere = currentStatus(iStatus); int original = originalStatus(iStatus); assert (iWhere != CLP_SAME); if (iWhere == CLP_FEASIBLE) { if (original == CLP_BELOW_LOWER) { // going below iWhere = CLP_BELOW_LOWER; rhs[iRow] = lower[iSequence] - value; } else { // going above iWhere = CLP_ABOVE_UPPER; rhs[iRow] = value - upper[iSequence]; } } else if(iWhere == CLP_BELOW_LOWER) { // going feasible iWhere = CLP_FEASIBLE; rhs[iRow] = value - upper[iSequence]; } else { // going feasible iWhere = CLP_FEASIBLE; rhs[iRow] = lower[iSequence] - value; } #ifdef NONLIN_DEBUG if (method_ == 3) assert (rhs[iRow] == saveRhs[iRow]); #endif setCurrentStatus(status_[iSequence], iWhere); } } #ifdef NONLIN_DEBUG delete [] saveRhs; #endif } void ClpNonLinearCost::goBackAll(const CoinIndexedVector * update) { assert (model_ != NULL); const int * pivotVariable = model_->pivotVariable(); int number = update->getNumElements(); const int * index = update->getIndices(); if (CLP_METHOD1) { for (int i = 0; i < number; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; offset_[iSequence] = 0; } #ifdef CLP_DEBUG for (i = 0; i < numberRows_ + numberColumns_; i++) assert(!offset_[i]); #endif } if (CLP_METHOD2) { for (int i = 0; i < number; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; setSameStatus(status_[iSequence]); } } } void ClpNonLinearCost::checkInfeasibilities(int numberInArray, const int * index) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); const int * pivotVariable = model_->pivotVariable(); if (CLP_METHOD1) { for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; // get where in bound sequence int iRange; int currentRange = whichRange_[iSequence]; double value = model_->solution(iSequence); int start = start_[iSequence]; int end = start_[iSequence+1] - 1; for (iRange = start; iRange < end; iRange++) { if (value < lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } assert(iRange < end); assert(model_->getStatus(iSequence) == ClpSimplex::basic); double & lower = model_->lowerAddress(iSequence); double & upper = model_->upperAddress(iSequence); double & cost = model_->costAddress(iSequence); whichRange_[iSequence] = iRange; if (iRange != currentRange) { if (infeasible(iRange)) numberInfeasibilities_++; if (infeasible(currentRange)) numberInfeasibilities_--; } lower = lower_[iRange]; upper = lower_[iRange+1]; cost = cost_[iRange]; } } if (CLP_METHOD2) { double * solution = model_->solutionRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; assert (fabs(lowerValue) < 1.0e100); costValue -= infeasibilityWeight_; numberInfeasibilities_++; } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } } } } /* Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. On input array is empty (but indices exist). On exit just changed costs will be stored as normal CoinIndexedVector */ void ClpNonLinearCost::checkChanged(int numberInArray, CoinIndexedVector * update) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); const int * pivotVariable = model_->pivotVariable(); int number = 0; int * index = update->getIndices(); double * work = update->denseVector(); if (CLP_METHOD1) { for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; // get where in bound sequence int iRange; double value = model_->solution(iSequence); int start = start_[iSequence]; int end = start_[iSequence+1] - 1; for (iRange = start; iRange < end; iRange++) { if (value < lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } assert(iRange < end); assert(model_->getStatus(iSequence) == ClpSimplex::basic); int jRange = whichRange_[iSequence]; if (iRange != jRange) { // changed work[iRow] = cost_[jRange] - cost_[iRange]; index[number++] = iRow; double & lower = model_->lowerAddress(iSequence); double & upper = model_->upperAddress(iSequence); double & cost = model_->costAddress(iSequence); whichRange_[iSequence] = iRange; if (infeasible(iRange)) numberInfeasibilities_++; if (infeasible(jRange)) numberInfeasibilities_--; lower = lower_[iRange]; upper = lower_[iRange+1]; cost = cost_[iRange]; } } } if (CLP_METHOD2) { double * solution = model_->solutionRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { work[iRow] = cost[iSequence] - costValue; index[number++] = iRow; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } } } update->setNumElements(number); } /* Sets bounds and cost for one variable - returns change in cost*/ double ClpNonLinearCost::setOne(int iSequence, double value) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); // difference in cost double difference = 0.0; if (CLP_METHOD1) { // get where in bound sequence int iRange; int currentRange = whichRange_[iSequence]; int start = start_[iSequence]; int end = start_[iSequence+1] - 1; if (!bothWays_) { // If fixed try and get feasible if (lower_[start+1] == lower_[start+2] && fabs(value - lower_[start+1]) < 1.001 * primalTolerance) { iRange = start + 1; } else { for (iRange = start; iRange < end; iRange++) { if (value <= lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } } } else { // leave in current if possible iRange = whichRange_[iSequence]; if (value < lower_[iRange] - primalTolerance || value > lower_[iRange+1] + primalTolerance) { for (iRange = start; iRange < end; iRange++) { if (value < lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } } } assert(iRange < end); whichRange_[iSequence] = iRange; if (iRange != currentRange) { if (infeasible(iRange)) numberInfeasibilities_++; if (infeasible(currentRange)) numberInfeasibilities_--; } double & lower = model_->lowerAddress(iSequence); double & upper = model_->upperAddress(iSequence); double & cost = model_->costAddress(iSequence); lower = lower_[iRange]; upper = lower_[iRange+1]; ClpSimplex::Status status = model_->getStatus(iSequence); if (upper == lower) { if (status != ClpSimplex::basic) { model_->setStatus(iSequence, ClpSimplex::isFixed); status = ClpSimplex::basic; // so will skip } } switch(status) { case ClpSimplex::basic: case ClpSimplex::superBasic: case ClpSimplex::isFree: break; case ClpSimplex::atUpperBound: case ClpSimplex::atLowerBound: case ClpSimplex::isFixed: // set correctly if (fabs(value - lower) <= primalTolerance * 1.001) { model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else if (fabs(value - upper) <= primalTolerance * 1.001) { model_->setStatus(iSequence, ClpSimplex::atUpperBound); } else { // set superBasic model_->setStatus(iSequence, ClpSimplex::superBasic); } break; } difference = cost - cost_[iRange]; cost = cost_[iRange]; } if (CLP_METHOD2) { double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { difference = cost[iSequence] - costValue; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } ClpSimplex::Status status = model_->getStatus(iSequence); if (upperValue == lowerValue) { if (status != ClpSimplex::basic) { model_->setStatus(iSequence, ClpSimplex::isFixed); status = ClpSimplex::basic; // so will skip } } switch(status) { case ClpSimplex::basic: case ClpSimplex::superBasic: case ClpSimplex::isFree: break; case ClpSimplex::atUpperBound: case ClpSimplex::atLowerBound: case ClpSimplex::isFixed: // set correctly if (fabs(value - lowerValue) <= primalTolerance * 1.001) { model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else if (fabs(value - upperValue) <= primalTolerance * 1.001) { model_->setStatus(iSequence, ClpSimplex::atUpperBound); } else { // set superBasic model_->setStatus(iSequence, ClpSimplex::superBasic); } break; } } changeCost_ += value * difference; return difference; } /* Sets bounds and infeasible cost and true cost for one variable This is for gub and column generation etc */ void ClpNonLinearCost::setOne(int sequence, double solutionValue, double lowerValue, double upperValue, double costValue) { if (CLP_METHOD1) { int iRange = -1; int start = start_[sequence]; double infeasibilityCost = model_->infeasibilityCost(); cost_[start] = costValue - infeasibilityCost; lower_[start+1] = lowerValue; cost_[start+1] = costValue; lower_[start+2] = upperValue; cost_[start+2] = costValue + infeasibilityCost; double primalTolerance = model_->currentPrimalTolerance(); if (solutionValue - lowerValue >= -primalTolerance) { if (solutionValue - upperValue <= primalTolerance) { iRange = start + 1; } else { iRange = start + 2; } } else { iRange = start; } model_->costRegion()[sequence] = cost_[iRange]; whichRange_[sequence] = iRange; } if (CLP_METHOD2) { bound_[sequence]=0.0; cost2_[sequence]=costValue; setInitialStatus(status_[sequence]); } } /* Sets bounds and cost for outgoing variable may change value Returns direction */ int ClpNonLinearCost::setOneOutgoing(int iSequence, double & value) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); // difference in cost double difference = 0.0; int direction = 0; if (CLP_METHOD1) { // get where in bound sequence int iRange; int currentRange = whichRange_[iSequence]; int start = start_[iSequence]; int end = start_[iSequence+1] - 1; // Set perceived direction out if (value <= lower_[currentRange] + 1.001 * primalTolerance) { direction = 1; } else if (value >= lower_[currentRange+1] - 1.001 * primalTolerance) { direction = -1; } else { // odd direction = 0; } // If fixed try and get feasible if (lower_[start+1] == lower_[start+2] && fabs(value - lower_[start+1]) < 1.001 * primalTolerance) { iRange = start + 1; } else { // See if exact for (iRange = start; iRange < end; iRange++) { if (value == lower_[iRange+1]) { // put in better range if (infeasible(iRange) && iRange == start) iRange++; break; } } if (iRange == end) { // not exact for (iRange = start; iRange < end; iRange++) { if (value <= lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } } } assert(iRange < end); whichRange_[iSequence] = iRange; if (iRange != currentRange) { if (infeasible(iRange)) numberInfeasibilities_++; if (infeasible(currentRange)) numberInfeasibilities_--; } double & lower = model_->lowerAddress(iSequence); double & upper = model_->upperAddress(iSequence); double & cost = model_->costAddress(iSequence); lower = lower_[iRange]; upper = lower_[iRange+1]; if (upper == lower) { value = upper; } else { // set correctly if (fabs(value - lower) <= primalTolerance * 1.001) { value = CoinMin(value, lower + primalTolerance); } else if (fabs(value - upper) <= primalTolerance * 1.001) { value = CoinMax(value, upper - primalTolerance); } else { //printf("*** variable wandered off bound %g %g %g!\n", // lower,value,upper); if (value - lower <= upper - value) value = lower + primalTolerance; else value = upper - primalTolerance; } } difference = cost - cost_[iRange]; cost = cost_[iRange]; } if (CLP_METHOD2) { double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; // Set perceived direction out if (value <= lowerValue + 1.001 * primalTolerance) { direction = 1; } else if (value >= upperValue - 1.001 * primalTolerance) { direction = -1; } else { // odd direction = 0; } int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place // If fixed give benefit of doubt if (lowerValue == upperValue) value = lowerValue; int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { difference = cost[iSequence] - costValue; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upper[iSequence] = lowerValue; lower[iSequence] = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lower[iSequence] = upperValue; upper[iSequence] = COIN_DBL_MAX; } else { lower[iSequence] = lowerValue; upper[iSequence] = upperValue; } cost[iSequence] = costValue; } // set correctly if (fabs(value - lowerValue) <= primalTolerance * 1.001) { value = CoinMin(value, lowerValue + primalTolerance); } else if (fabs(value - upperValue) <= primalTolerance * 1.001) { value = CoinMax(value, upperValue - primalTolerance); } else { //printf("*** variable wandered off bound %g %g %g!\n", // lowerValue,value,upperValue); if (value - lowerValue <= upperValue - value) value = lowerValue + primalTolerance; else value = upperValue - primalTolerance; } } changeCost_ += value * difference; return direction; } // Returns nearest bound double ClpNonLinearCost::nearest(int iSequence, double solutionValue) { assert (model_ != NULL); double nearest = 0.0; if (CLP_METHOD1) { // get where in bound sequence int iRange; int start = start_[iSequence]; int end = start_[iSequence+1]; int jRange = -1; nearest = COIN_DBL_MAX; for (iRange = start; iRange < end; iRange++) { if (fabs(solutionValue - lower_[iRange]) < nearest) { jRange = iRange; nearest = fabs(solutionValue - lower_[iRange]); } } assert(jRange < end); nearest = lower_[jRange]; } if (CLP_METHOD2) { const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; int iWhere = originalStatus(status_[iSequence]); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; } if (fabs(solutionValue - lowerValue) < fabs(solutionValue - upperValue)) nearest = lowerValue; else nearest = upperValue; } return nearest; } /// Feasible cost with offset and direction (i.e. for reporting) double ClpNonLinearCost::feasibleReportCost() const { double value; model_->getDblParam(ClpObjOffset, value); return (feasibleCost_ + model_->objectiveAsObject()->nonlinearOffset()) * model_->optimizationDirection() / (model_->objectiveScale() * model_->rhsScale()) - value; } // Get rid of real costs (just for moment) void ClpNonLinearCost::zapCosts() { int iSequence; double infeasibilityCost = model_->infeasibilityCost(); // zero out all costs int numberTotal = numberColumns_ + numberRows_; if (CLP_METHOD1) { int n = start_[numberTotal]; memset(cost_, 0, n * sizeof(double)); for (iSequence = 0; iSequence < numberTotal; iSequence++) { int start = start_[iSequence]; int end = start_[iSequence+1] - 1; // correct costs for this infeasibility weight if (infeasible(start)) { cost_[start] = -infeasibilityCost; } if (infeasible(end - 1)) { cost_[end-1] = infeasibilityCost; } } } if (CLP_METHOD2) { } } #ifdef VALIDATE // For debug void ClpNonLinearCost::validate() { double primalTolerance = model_->currentPrimalTolerance(); int iSequence; const double * solution = model_->solutionRegion(); const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); const double * cost = model_->costRegion(); double infeasibilityCost = model_->infeasibilityCost(); int numberTotal = numberRows_ + numberColumns_; int numberInfeasibilities = 0; double sumInfeasibilities = 0.0; for (iSequence = 0; iSequence < numberTotal; iSequence++) { double value = solution[iSequence]; int iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); costValue -= infeasibilityCost; assert (value <= lowerValue - primalTolerance); numberInfeasibilities++; sumInfeasibilities += lowerValue - value - primalTolerance; assert (model_->getStatus(iSequence) == ClpSimplex::basic); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; costValue += infeasibilityCost; assert (value >= upperValue + primalTolerance); numberInfeasibilities++; sumInfeasibilities += value - upperValue - primalTolerance; assert (model_->getStatus(iSequence) == ClpSimplex::basic); } else { assert (value >= lowerValue - primalTolerance && value <= upperValue + primalTolerance); } assert (lowerValue == saveLowerV[iSequence]); assert (upperValue == saveUpperV[iSequence]); assert (costValue == cost[iSequence]); } if (numberInfeasibilities) printf("JJ %d infeasibilities summing to %g\n", numberInfeasibilities, sumInfeasibilities); } #endif CoinMP-1.8.3/Clp/src/CoinAbcBaseFactorization5.cpp0000644000175000017500000006554212101105055020242 0ustar renerene/* $Id: CoinAbcBaseFactorization5.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef ABC_JUST_ONE_FACTORIZATION #include "CoinAbcCommonFactorization.hpp" #define CoinAbcTypeFactorization CoinAbcBaseFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #endif #ifdef CoinAbcTypeFactorization #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #if ABC_NORMAL_DEBUG>0 // for conflicts extern int cilk_conflict; #endif #define UNROLL 1 #define INLINE_IT //#define INLINE_IT2 inline void scatterUpdateInline(CoinSimplexInt number, CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const CoinSimplexInt * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { #if UNROLL==0 for (CoinBigIndex j=number-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #elif UNROLL==1 if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } #elif UNROLL==2 CoinSimplexInt iRow0; CoinSimplexInt iRow1; CoinFactorizationDouble regionValue0; CoinFactorizationDouble regionValue1; switch(static_cast(number)) { case 0: break; case 1: iRow0 = thisIndex[0]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; break; case 2: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; break; case 3: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; break; case 4: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; break; case 5: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; break; case 6: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; break; case 7: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; break; case 8: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; iRow1 = thisIndex[7]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; region[iRow1] = regionValue1 - thisElement[7] * pivotValue; break; default: if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } break; } #endif } inline CoinFactorizationDouble gatherUpdate(CoinSimplexInt number, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const CoinSimplexInt * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { CoinFactorizationDouble pivotValue=0.0; for (CoinBigIndex j = 0; j < number; j ++ ) { CoinFactorizationDouble value = thisElement[j]; CoinSimplexInt jRow = thisIndex[j]; value *= region[jRow]; pivotValue -= value; } return pivotValue; } #undef INLINE_IT // updateColumnR. Updates part of column (FTRANR) void CoinAbcTypeFactorization::updateColumnR ( CoinIndexedVector * regionSparse #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichSparse #endif ) const { if ( numberR_ ) { CoinSimplexDouble * COIN_RESTRICT region = regionSparse->denseVector ( ); #if ABC_SMALL<3 CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinSimplexInt numberNonZero = regionSparse->getNumElements ( ); #endif const CoinBigIndex * COIN_RESTRICT startColumn = startColumnRAddress_-numberRows_; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowRAddress_; CoinSimplexInt * COIN_RESTRICT indexRowR2 = indexRowRAddress_+lengthAreaR_; if (gotRCopy()) indexRowR2 += lengthAreaR_; const CoinFactorizationDouble * COIN_RESTRICT element = elementRAddress_; const CoinSimplexInt * COIN_RESTRICT permute = permuteAddress_; instrument_do("CoinAbcFactorizationUpdateR",sizeR); #if ABC_SMALL<2 // Size of R CoinSimplexDouble sizeR=startColumnRAddress_[numberR_]; // Work out very dubious idea of what would be fastest // Average CoinSimplexDouble averageR = sizeR/(static_cast (numberRowsExtra_)); // weights (relative to actual work) CoinSimplexDouble setMark = 0.1; // setting mark CoinSimplexDouble test1= 1.0; // starting ftran (without testPivot) CoinSimplexDouble testPivot = 2.0; // Seeing if zero etc CoinSimplexDouble startDot=2.0; // For starting dot product version // For final scan CoinSimplexDouble final = numberNonZero*1.0; CoinSimplexDouble methodTime0; // For first type methodTime0 = numberPivots_ * (testPivot + ((static_cast (numberNonZero))/(static_cast (numberRows_)) * averageR)); methodTime0 += numberNonZero *(test1 + averageR); methodTime0 += (numberNonZero+numberPivots_)*setMark; // third CoinSimplexDouble methodTime2 = sizeR + numberPivots_*startDot + numberNonZero*final; // switch off if necessary CoinSimplexInt method=0; if (!gotRCopy()||!gotSparse()||methodTime2(reinterpret_cast(mark)+whichSparse*sizeSparseArray_); } #endif // mark all rows which will be permuted for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++ ) { CoinSimplexInt iRow = permute[i]; mark[iRow]=1; } // we have another copy of R in R const CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_ + lengthAreaR_; const CoinSimplexInt * COIN_RESTRICT indexRowR = indexRowRAddress_ + lengthAreaR_; const CoinBigIndex * COIN_RESTRICT startR = startColumnRAddress_+maximumPivots_+1; // For current list order does not matter as // only affects end CoinSimplexInt newNumber=0; for (CoinSimplexInt i = 0; i < numberNonZero; i++ ) { CoinSimplexInt iRow = regionIndex[i]; CoinFactorizationDouble pivotValue = region[iRow]; assert (region[iRow]); if (!mark[iRow]) { regionIndex[newNumber++]=iRow; } CoinSimplexInt kRow=permute[iRow]; CoinSimplexInt number = numberInColumnPlus[kRow]; instrument_add(number); if (TEST_INT_NONZERO(number)) { CoinBigIndex start=startR[kRow]; #ifndef INLINE_IT CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; CoinSimplexInt jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } #else CoinAbcScatterUpdate(number,pivotValue,elementR+start,indexRowR+start,region); #endif } } instrument_start("CoinAbcFactorizationUpdateRSparse2",numberRows_); numberNonZero = newNumber; for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++ ) { //move using permute_ (stored in inverse fashion) CoinSimplexInt iRow = permute[i]; CoinFactorizationDouble pivotValue = region[iRow]+region[i]; //zero out pre-permuted region[iRow] = 0.0; region[i]=0.0; if ( !TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue ) ) { int jRow=pivotRowBack[i]; assert (!region[jRow]); region[jRow]=pivotValue; CoinSimplexInt number = numberInColumnPlus[i]; instrument_add(number); if (TEST_INT_NONZERO(number)) { CoinBigIndex start=startR[i]; #ifndef INLINE_IT CoinBigIndex end = start+number; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = elementR[j]; CoinSimplexInt jRow = indexRowR[j]; region[jRow] -= pivotValue*value; } #else CoinAbcScatterUpdate(number,pivotValue,elementR+start,indexRowR+start,region); #endif } } } instrument_end(); for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++ ) { CoinSimplexInt iRow = permute[i]; assert (iRowsetNumElements ( numberNonZero ); #endif } #if ABC_SMALL<2 if (factorizationStatistics()) statistics.countAfterR_ += regionSparse->getNumElements(); #endif } #ifdef EARLY_FACTORIZE #include "AbcSimplex.hpp" #include "AbcMatrix.hpp" // Returns -2 if can't, -1 if singular, -99 memory, 0 OK int CoinAbcTypeFactorization::factorize (AbcSimplex * model, CoinIndexedVector & stuff) { AbcMatrix * matrix = model->abcMatrix(); setStatus(-99); int * COIN_RESTRICT pivotTemp = stuff.getIndices(); int numberColumnBasic = stuff.getNumElements(); // compute how much in basis int numberSlacks = numberRows_ - numberColumnBasic; CoinBigIndex numberElements = numberSlacks+matrix->countBasis(pivotTemp + numberSlacks, numberColumnBasic); // Not needed for dense numberElements = 3 * numberRows_ + 3 * numberElements + 20000; getAreas ( numberRows_, numberSlacks + numberColumnBasic, numberElements, 2 * numberElements ); numberSlacks_=numberSlacks; // Fill in counts so we can skip part of preProcess // This is NOT needed for dense but would be needed for later versions CoinFactorizationDouble * COIN_RESTRICT elementU; int * COIN_RESTRICT indexRowU; CoinBigIndex * COIN_RESTRICT startColumnU; int * COIN_RESTRICT numberInRow; int * COIN_RESTRICT numberInColumn; elementU = this->elements(); indexRowU = this->indices(); startColumnU = this->starts(); numberInRow = this->numberInRow(); numberInColumn = this->numberInColumn(); CoinZeroN ( numberInRow, numberRows_+1 ); CoinZeroN ( numberInColumn, numberRows_ ); for (int i = 0; i < numberSlacks_; i++) { int iRow = pivotTemp[i]; indexRowU[i] = iRow; startColumnU[i] = i; elementU[i] = 1.0; numberInRow[iRow] = 1; numberInColumn[i] = 1; } startColumnU[numberSlacks_] = numberSlacks_; matrix->fillBasis(pivotTemp + numberSlacks_, numberColumnBasic, indexRowU, startColumnU + numberSlacks_, numberInRow, numberInColumn + numberSlacks_, elementU); numberElements = startColumnU[numberRows_-1] + numberInColumn[numberRows_-1]; preProcess ( ); factor (model); if (status() == 0 ) { // Put sequence numbers in workArea int * savePivots = reinterpret_cast(workAreaAddress_); CoinAbcMemcpy(savePivots,pivotTemp,numberRows_); postProcess(pivotTemp, savePivots); return 0; } else { return -2; } } // 0 success, -1 can't +1 accuracy problems int CoinAbcTypeFactorization::replaceColumns ( const AbcSimplex * model, CoinIndexedVector & stuff, int firstPivot,int lastPivot, bool cleanUp) { // Could skip some if goes in and out (only if easy as then no alpha check) // Put sequence numbers in workArea int * savePivots = reinterpret_cast(workAreaAddress_); const int * pivotIndices = stuff.getIndices(); CoinSimplexDouble * pivotValues = stuff.denseVector(); int savePivot = stuff.capacity(); savePivot--; savePivot -= 2*firstPivot; int numberDo=lastPivot-firstPivot; // Say clear stuff.setNumElements(0); bool badUpdates=false; for (int iPivot=0;iPivotunpack(stuff,sequenceIn); updateColumnFTPart1(stuff); stuff.clear(); //checkReplacePart1a(&stuff,pivotRow); CoinSimplexDouble ftAlpha=checkReplacePart1(&stuff,pivotRow); // may need better check if (checkReplacePart2(pivotRow,btranAlpha,alpha,ftAlpha)>1) { badUpdates=true; printf("Inaccuracy ? btranAlpha %g ftranAlpha %g ftAlpha %g\n", btranAlpha,alpha,ftAlpha); break; } replaceColumnPart3(model,&stuff,NULL,pivotRow,ftAlpha); } int flag; if (!badUpdates) { flag=1; if (cleanUp) { CoinAbcMemcpy(model->pivotVariable(),savePivots,numberRows_); } } else { flag=-1; } stuff.setNumElements(flag); return flag >0 ? 0 : flag; } #endif #ifdef ABC_ORDERED_FACTORIZATION // Permute in for Ftran void CoinAbcTypeFactorization::permuteInForFtran(CoinIndexedVector & regionSparse, bool full) const { int numberNonZero=regionSparse.getNumElements(); const int * COIN_RESTRICT permuteIn = permuteAddress_+maximumRowsExtra_+1; double * COIN_RESTRICT region = regionSparse.denseVector(); double * COIN_RESTRICT tempRegion = region+numberRows_; int * COIN_RESTRICT index = regionSparse.getIndices(); if ((numberNonZero<<1)>numberRows_||full) { CoinAbcMemcpy(tempRegion,region,numberRows_); CoinAbcMemset0(region,numberRows_); numberNonZero=0; for (int i=0;i=0&&whichdenseVector ( ); CoinSimplexInt * COIN_RESTRICT regionIndex = vector->getIndices ( ); CoinSimplexInt numberNonZero = vector->getNumElements ( ); long double * COIN_RESTRICT longRegion = longArray_[which].array(); assert (!vector->packedMode()); // could check all of longRegion for zero but this should trap most errors for (int i=0;idenseVector ( ); CoinSimplexInt * COIN_RESTRICT regionIndex = vector->getIndices ( ); CoinSimplexInt numberNonZero = vector->getNumElements ( ); long double * COIN_RESTRICT longRegion = longArray_[which].array(); assert (!vector->packedMode()); // could check all of region for zero but this should trap most errors for (int i=0;idenseVector ( ); CoinSimplexInt * COIN_RESTRICT regionIndex = vector->getIndices ( ); CoinSimplexInt numberNonZero = vector->getNumElements ( ); long double * COIN_RESTRICT longRegion = longArray_[which].array(); assert (!vector->packedMode()); // could check all of region for zero but this should trap most errors for (int i=0;igetIndices(); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(vector); for (int i=0;izeroTolerance_) index[numberNonZero++]=i; else region[i]=0.0; } vector->setNumElements(numberNonZero); } // Clear all hidden arrays void CoinAbcTypeFactorization::clearHiddenArrays() { for (int which=0;whichgetIndices ( ); CoinSimplexInt numberNonZero = vector->getNumElements ( ); } } } #endif #endif CoinMP-1.8.3/Clp/src/ClpLinearObjective.hpp0000644000175000017500000000645411510657452017055 0ustar renerene/* $Id: ClpLinearObjective.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpLinearObjective_H #define ClpLinearObjective_H #include "ClpObjective.hpp" //############################################################################# /** Linear Objective Class */ class ClpLinearObjective : public ClpObjective { public: ///@name Stuff //@{ /** Returns objective coefficients. Offset is always set to 0.0. All other parameters unused. */ virtual double * gradient(const ClpSimplex * model, const double * solution, double & offset, bool refresh, int includeLinear = 2); /** Returns reduced gradient.Returns an offset (to be added to current one). */ virtual double reducedGradient(ClpSimplex * model, double * region, bool useFeasibleCosts); /** Returns step length which gives minimum of objective for solution + theta * change vector up to maximum theta. arrays are numberColumns+numberRows Also sets current objective, predicted and at maximumTheta */ virtual double stepLength(ClpSimplex * model, const double * solution, const double * change, double maximumTheta, double & currentObj, double & predictedObj, double & thetaObj); /// Return objective value (without any ClpModel offset) (model may be NULL) virtual double objectiveValue(const ClpSimplex * model, const double * solution) const ; /// Resize objective virtual void resize(int newNumberColumns) ; /// Delete columns in objective virtual void deleteSome(int numberToDelete, const int * which) ; /// Scale objective virtual void reallyScale(const double * columnScale) ; //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpLinearObjective(); /// Constructor from objective ClpLinearObjective(const double * objective, int numberColumns); /// Copy constructor ClpLinearObjective(const ClpLinearObjective &); /** Subset constructor. Duplicates are allowed and order is as given. */ ClpLinearObjective (const ClpLinearObjective &rhs, int numberColumns, const int * whichColumns) ; /// Assignment operator ClpLinearObjective & operator=(const ClpLinearObjective& rhs); /// Destructor virtual ~ClpLinearObjective (); /// Clone virtual ClpObjective * clone() const; /** Subset clone. Duplicates are allowed and order is as given. */ virtual ClpObjective * subsetClone (int numberColumns, const int * whichColumns) const; //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// Objective double * objective_; /// number of columns int numberColumns_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpSimplexPrimal.cpp0000644000175000017500000052377212572252725016603 0ustar renerene/* $Id: ClpSimplexPrimal.cpp 2163 2015-09-04 08:27:01Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Notes on implementation of primal simplex algorithm. When primal feasible(A): If dual feasible, we are optimal. Otherwise choose an infeasible basic variable to enter basis from a bound (B). We now need to find an outgoing variable which will leave problem primal feasible so we get the column of the tableau corresponding to the incoming variable (with the correct sign depending if variable will go up or down). We now perform a ratio test to determine which outgoing variable will preserve primal feasibility (C). If no variable found then problem is unbounded (in primal sense). If there is a variable, we then perform pivot and repeat. Trivial? ------------------------------------------- A) How do we get primal feasible? All variables have fake costs outside their feasible region so it is trivial to declare problem feasible. OSL did not have a phase 1/phase 2 approach but instead effectively put an extra cost on infeasible basic variables I am taking the same approach here, although it is generalized to allow for non-linear costs and dual information. In OSL, this weight was changed heuristically, here at present it is only increased if problem looks finished. If problem is feasible I check for unboundedness. If not unbounded we could play with going into dual. As long as weights increase any algorithm would be finite. B) Which incoming variable to choose is a virtual base class. For difficult problems steepest edge is preferred while for very easy (large) problems we will need partial scan. C) Sounds easy, but this is hardest part of algorithm. 1) Instead of stopping at first choice, we may be able to allow that variable to go through bound and if objective still improving choose again. These mini iterations can increase speed by orders of magnitude but we may need to go to more of a bucket choice of variable rather than looking at them one by one (for speed). 2) Accuracy. Basic infeasibilities may be less than tolerance. Pivoting on these makes objective go backwards. OSL modified cost so a zero move was made, Gill et al modified so a strictly positive move was made. The two problems are that re-factorizations can change rinfeasibilities above and below tolerances and that when finished we need to reset costs and try again. 3) Degeneracy. Gill et al helps but may not be enough. We may need more. Also it can improve speed a lot if we perturb the rhs and bounds significantly. References: Forrest and Goldfarb, Steepest-edge simplex algorithms for linear programming - Mathematical Programming 1992 Forrest and Tomlin, Implementing the simplex method for the Optimization Subroutine Library - IBM Systems Journal 1992 Gill, Murray, Saunders, Wright A Practical Anti-Cycling Procedure for Linear and Nonlinear Programming SOL report 1988 TODO: a) Better recovery procedures. At present I never check on forward progress. There is checkpoint/restart with reducing re-factorization frequency, but this is only on singular factorizations. b) Fast methods for large easy problems (and also the option for the code to automatically choose which method). c) We need to be able to stop in various ways for OSI - this is fairly easy. */ #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "ClpSimplexPrimal.hpp" #include "ClpFactorization.hpp" #include "ClpNonLinearCost.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "ClpPrimalColumnPivot.hpp" #include "ClpMessage.hpp" #include "ClpEventHandler.hpp" #include #include #include #include #include #ifdef CLP_USER_DRIVEN1 /* Returns true if variable sequenceOut can leave basis when model->sequenceIn() enters. This function may be entered several times for each sequenceOut. The first time realAlpha will be positive if going to lower bound and negative if going to upper bound (scaled bounds in lower,upper) - then will be zero. currentValue is distance to bound. currentTheta is current theta. alpha is fabs(pivot element). Variable will change theta if currentValue - currentTheta*alpha < 0.0 */ bool userChoiceValid1(const ClpSimplex * model, int sequenceOut, double currentValue, double currentTheta, double alpha, double realAlpha); /* This returns true if chosen in/out pair valid. The main thing to check would be variable flipping bounds may be OK. This would be signaled by reasonable theta_ and valueOut_. If you return false sequenceIn_ will be flagged as ineligible. */ bool userChoiceValid2(const ClpSimplex * model); /* If a good pivot then you may wish to unflag some variables. */ void userChoiceWasGood(ClpSimplex * model); #endif // primal int ClpSimplexPrimal::primal (int ifValuesPass , int startFinishOptions) { /* Method It tries to be a single phase approach with a weight of 1.0 being given to getting optimal and a weight of infeasibilityCost_ being given to getting primal feasible. In this version I have tried to be clever in a stupid way. The idea of fake bounds in dual seems to work so the primal analogue would be that of getting bounds on reduced costs (by a presolve approach) and using these for being above or below feasible region. I decided to waste memory and keep these explicitly. This allows for non-linear costs! The code is designed to take advantage of sparsity so arrays are seldom zeroed out from scratch or gone over in their entirety. The only exception is a full scan to find incoming variable for Dantzig row choice. For steepest edge we keep an updated list of dual infeasibilities (actually squares). On easy problems we don't need full scan - just pick first reasonable. One problem is how to tackle degeneracy and accuracy. At present I am using the modification of costs which I put in OSL and which was extended by Gill et al. I am still not sure of the exact details. The flow of primal is three while loops as follows: while (not finished) { while (not clean solution) { Factorize and/or clean up solution by changing bounds so primal feasible. If looks finished check fake primal bounds. Repeat until status is iterating (-1) or finished (0,1,2) } while (status==-1) { Iterate until no pivot in or out or time to re-factorize. Flow is: choose pivot column (incoming variable). if none then we are primal feasible so looks as if done but we need to break and check bounds etc. Get pivot column in tableau Choose outgoing row. If we don't find one then we look primal unbounded so break and check bounds etc. (Also the pivot tolerance is larger after any iterations so that may be reason) If we do find outgoing row, we may have to adjust costs to keep going forwards (anti-degeneracy). Check pivot will be stable and if unstable throw away iteration and break to re-factorize. If minor error re-factorize after iteration. Update everything (this may involve changing bounds on variables to stay primal feasible. } } At present we never check we are going forwards. I overdid that in OSL so will try and make a last resort. Needs partial scan pivot in option. May need other anti-degeneracy measures, especially if we try and use loose tolerances as a way to solve in fewer iterations. I like idea of dynamic scaling. This gives opportunity to decouple different implications of scaling for accuracy, iteration count and feasibility tolerance. */ algorithm_ = +1; moreSpecialOptions_ &= ~16; // clear check replaceColumn accuracy // save data ClpDataSave data = saveData(); if (problemStatus_==10&&sumPrimalInfeasibilities_==-123456789.0) { // large infeasibility cost wanted infeasibilityCost_ = CoinMax(infeasibilityCost_,1.0e13); } matrix_->refresh(this); // make sure matrix okay // Save so can see if doing after dual int initialStatus = problemStatus_; int initialIterations = numberIterations_; int initialNegDjs = -1; // initialize - maybe values pass and algorithm_ is +1 #if 0 // if so - put in any superbasic costed slacks if (ifValuesPass && specialOptions_ < 0x01000000) { // Get column copy const CoinPackedMatrix * columnCopy = matrix(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); //const double * element = columnCopy->getElements(); int n = 0; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnLength[iColumn] == 1) { Status status = getColumnStatus(iColumn); if (status != basic && status != isFree) { double value = columnActivity_[iColumn]; if (fabs(value - columnLower_[iColumn]) > primalTolerance_ && fabs(value - columnUpper_[iColumn]) > primalTolerance_) { int iRow = row[columnStart[iColumn]]; if (getRowStatus(iRow) == basic) { setRowStatus(iRow, superBasic); setColumnStatus(iColumn, basic); n++; } } } } } printf("%d costed slacks put in basis\n", n); } #endif // Start can skip some things in transposeTimes specialOptions_ |= 131072; if (!startup(ifValuesPass, startFinishOptions)) { // See if better to use all slack basis if (nonLinearCost_->sumInfeasibilities()>1.0e15) { // If not all slack then make it int numberRowBasic = 0; for (int i=0;isetAverageTheta(1.0e3); int lastCleaned = 0; // last time objective or bounds cleaned up // Say no pivot has occurred (for steepest edge and updates) pivotRow_ = -2; // This says whether to restore things etc int factorType = 0; if (problemStatus_ < 0 && perturbation_ < 100 && !ifValuesPass) { perturb(0); // Can't get here if values pass assert (!ifValuesPass); gutsOfSolution(NULL, NULL); if (handler_->logLevel() > 2) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } } ClpSimplex * saveModel = NULL; int stopSprint = -1; int sprintPass = 0; int reasonableSprintIteration = 0; int lastSprintIteration = 0; double lastObjectiveValue = COIN_DBL_MAX; // Start check for cycles progress_.fillFromModel(this); progress_.startCheck(); /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible -5 - looks unbounded */ while (problemStatus_ < 0) { int iRow, iColumn; // clear for (iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // give matrix (and model costs and bounds a chance to be // refreshed (normally null) matrix_->refresh(this); // If getting nowhere - why not give it a kick #if 1 if (perturbation_ < 101 && numberIterations_ > 2 * (numberRows_ + numberColumns_) && (specialOptions_ & 4) == 0 && initialStatus != 10) { perturb(1); matrix_->rhsOffset(this, true, false); } #endif // If we have done no iterations - special if (lastGoodIteration_ == numberIterations_ && factorType) factorType = 3; if (saveModel) { // Doing sprint if (sequenceIn_ < 0 || numberIterations_ >= stopSprint) { problemStatus_ = -1; originalModel(saveModel); saveModel = NULL; if (sequenceIn_ < 0 && numberIterations_ < reasonableSprintIteration && sprintPass > 100) primalColumnPivot_->switchOffSprint(); //lastSprintIteration=numberIterations_; COIN_DETAIL_PRINT(printf("End small model\n")); } } // may factorize, checks if problem finished statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, ifValuesPass, saveModel); if (initialStatus == 10) { // cleanup phase if(initialIterations != numberIterations_) { if (numberDualInfeasibilities_ > 10000 && numberDualInfeasibilities_ > 10 * initialNegDjs) { // getting worse - try perturbing if (perturbation_ < 101 && (specialOptions_ & 4) == 0) { perturb(1); matrix_->rhsOffset(this, true, false); statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, ifValuesPass, saveModel); } } } else { // save number of negative djs if (!numberPrimalInfeasibilities_) initialNegDjs = numberDualInfeasibilities_; // make sure weight won't be changed if (infeasibilityCost_ == 1.0e10) infeasibilityCost_ = 1.000001e10; } } // See if sprint says redo because of problems if (numberDualInfeasibilities_ == -776) { // Need new set of variables problemStatus_ = -1; originalModel(saveModel); saveModel = NULL; //lastSprintIteration=numberIterations_; COIN_DETAIL_PRINT(printf("End small model after\n")); statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, ifValuesPass, saveModel); } int numberSprintIterations = 0; int numberSprintColumns = primalColumnPivot_->numberSprintColumns(numberSprintIterations); if (problemStatus_ == 777) { // problems so do one pass with normal problemStatus_ = -1; originalModel(saveModel); saveModel = NULL; // Skip factorization //statusOfProblemInPrimal(lastCleaned,factorType,&progress_,false,saveModel); statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, ifValuesPass, saveModel); } else if (problemStatus_ < 0 && !saveModel && numberSprintColumns && firstFree_ < 0) { int numberSort = 0; int numberFixed = 0; int numberBasic = 0; reasonableSprintIteration = numberIterations_ + 100; int * whichColumns = new int[numberColumns_]; double * weight = new double[numberColumns_]; int numberNegative = 0; double sumNegative = 0.0; // now massage weight so all basic in plus good djs for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double dj = dj_[iColumn]; switch(getColumnStatus(iColumn)) { case basic: dj = -1.0e50; numberBasic++; break; case atUpperBound: dj = -dj; break; case isFixed: dj = 1.0e50; numberFixed++; break; case atLowerBound: dj = dj; break; case isFree: dj = -100.0 * fabs(dj); break; case superBasic: dj = -100.0 * fabs(dj); break; } if (dj < -dualTolerance_ && dj > -1.0e50) { numberNegative++; sumNegative -= dj; } weight[iColumn] = dj; whichColumns[iColumn] = iColumn; } handler_->message(CLP_SPRINT, messages_) << sprintPass << numberIterations_ - lastSprintIteration << objectiveValue() << sumNegative << numberNegative << CoinMessageEol; sprintPass++; lastSprintIteration = numberIterations_; if (objectiveValue()*optimizationDirection_ > lastObjectiveValue - 1.0e-7 && sprintPass > 5) { // switch off COIN_DETAIL_PRINT(printf("Switching off sprint\n")); primalColumnPivot_->switchOffSprint(); } else { lastObjectiveValue = objectiveValue() * optimizationDirection_; // sort CoinSort_2(weight, weight + numberColumns_, whichColumns); numberSort = CoinMin(numberColumns_ - numberFixed, numberBasic + numberSprintColumns); // Sort to make consistent ? std::sort(whichColumns, whichColumns + numberSort); saveModel = new ClpSimplex(this, numberSort, whichColumns); delete [] whichColumns; delete [] weight; // Skip factorization //statusOfProblemInPrimal(lastCleaned,factorType,&progress_,false,saveModel); //statusOfProblemInPrimal(lastCleaned,factorType,&progress_,true,saveModel); stopSprint = numberIterations_ + numberSprintIterations; COIN_DETAIL_PRINT(printf("Sprint with %d columns for %d iterations\n", numberSprintColumns, numberSprintIterations)); } } // Say good factorization factorType = 1; // Say no pivot has occurred (for steepest edge and updates) pivotRow_ = -2; // exit if victory declared if (problemStatus_ >= 0) { #ifdef CLP_USER_DRIVEN int status = eventHandler_->event(ClpEventHandler::endInPrimal); if (status>=0&&status<10) { // carry on problemStatus_=-1; if (status==0) continue; // re-factorize } else if (status>=10) { problemStatus_=status-10; break; } else { break; } #else break; #endif } // test for maximum iterations if (hitMaximumIterations() || (ifValuesPass == 2 && firstFree_ < 0)) { problemStatus_ = 3; break; } else if ((moreSpecialOptions_&524288)!=0&& !nonLinearCost_->numberInfeasibilities()&& fabs(dblParam_[ClpDualObjectiveLimit])>1.0e30) { problemStatus_ = 3; secondaryStatus_ = 10; break; } if (firstFree_ < 0) { if (ifValuesPass) { // end of values pass ifValuesPass = 0; int status = eventHandler_->event(ClpEventHandler::endOfValuesPass); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfValuesPass; break; } //#define FEB_TRY #if 1 //def FEB_TRY if (perturbation_ < 100) perturb(0); #endif } } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfFactorization); if (status >= 0) { // if >=100 - then special e.g. unperturb if (status!=101) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } else { unPerturb(); continue; } } } // Iterate whileIterating(ifValuesPass ? 1 : 0); if (sequenceIn_<0&&ifValuesPass==2) problemStatus_=3; // user wants to exit } } // if infeasible get real values //printf("XXXXY final cost %g\n",infeasibilityCost_); progress_.initialWeight_ = 0.0; if (problemStatus_ == 1 && secondaryStatus_ != 6) { infeasibilityCost_ = 0.0; createRim(1 + 4); delete nonLinearCost_; nonLinearCost_ = new ClpNonLinearCost(this); nonLinearCost_->checkInfeasibilities(0.0); sumPrimalInfeasibilities_ = nonLinearCost_->sumInfeasibilities(); numberPrimalInfeasibilities_ = nonLinearCost_->numberInfeasibilities(); // and get good feasible duals computeDuals(NULL); } // Stop can skip some things in transposeTimes specialOptions_ &= ~131072; // clean up unflag(); finish(startFinishOptions); restoreData(data); return problemStatus_; } /* Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) -4 end of values pass and done iterations +0 looks optimal (might be infeasible - but we will investigate) +2 looks unbounded +3 max iterations */ int ClpSimplexPrimal::whileIterating(int valuesOption) { // Say if values pass int ifValuesPass = (firstFree_ >= 0) ? 1 : 0; int returnCode = -1; int superBasicType = 1; if (valuesOption > 1) superBasicType = 3; // delete any rays delete [] ray_; ray_ = NULL; // status stays at -1 while iterating, >=0 finished, -2 to invert // status -3 to go to top without an invert while (problemStatus_ == -1) { //#define CLP_DEBUG 1 #ifdef CLP_DEBUG { int i; // not [1] as has information for (i = 0; i < 4; i++) { if (i != 1) rowArray_[i]->checkClear(); } for (i = 0; i < 2; i++) { columnArray_[i]->checkClear(); } } #endif #if 0 { int iPivot; double * array = rowArray_[3]->denseVector(); int * index = rowArray_[3]->getIndices(); int i; for (iPivot = 0; iPivot < numberRows_; iPivot++) { int iSequence = pivotVariable_[iPivot]; unpackPacked(rowArray_[3], iSequence); factorization_->updateColumn(rowArray_[2], rowArray_[3]); int number = rowArray_[3]->getNumElements(); for (i = 0; i < number; i++) { int iRow = index[i]; if (iRow == iPivot) assert (fabs(array[i] - 1.0) < 1.0e-4); else assert (fabs(array[i]) < 1.0e-4); } rowArray_[3]->clear(); } } #endif #if 0 nonLinearCost_->checkInfeasibilities(primalTolerance_); printf("suminf %g number %d\n", nonLinearCost_->sumInfeasibilities(), nonLinearCost_->numberInfeasibilities()); #endif #if CLP_DEBUG>2 // very expensive if (numberIterations_ > 0 && numberIterations_ < 100 && !ifValuesPass) { handler_->setLogLevel(63); double saveValue = objectiveValue_; double * saveRow1 = new double[numberRows_]; double * saveRow2 = new double[numberRows_]; CoinMemcpyN(rowReducedCost_, numberRows_, saveRow1); CoinMemcpyN(rowActivityWork_, numberRows_, saveRow2); double * saveColumn1 = new double[numberColumns_]; double * saveColumn2 = new double[numberColumns_]; CoinMemcpyN(reducedCostWork_, numberColumns_, saveColumn1); CoinMemcpyN(columnActivityWork_, numberColumns_, saveColumn2); gutsOfSolution(NULL, NULL, false); printf("xxx %d old obj %g, recomputed %g, sum primal inf %g\n", numberIterations_, saveValue, objectiveValue_, sumPrimalInfeasibilities_); CoinMemcpyN(saveRow1, numberRows_, rowReducedCost_); CoinMemcpyN(saveRow2, numberRows_, rowActivityWork_); CoinMemcpyN(saveColumn1, numberColumns_, reducedCostWork_); CoinMemcpyN(saveColumn2, numberColumns_, columnActivityWork_); delete [] saveRow1; delete [] saveRow2; delete [] saveColumn1; delete [] saveColumn2; objectiveValue_ = saveValue; } #endif if (!ifValuesPass) { // choose column to come in // can use pivotRow_ to update weights // pass in list of cost changes so can do row updates (rowArray_[1]) // NOTE rowArray_[0] is used by computeDuals which is a // slow way of getting duals but might be used primalColumn(rowArray_[1], rowArray_[2], rowArray_[3], columnArray_[0], columnArray_[1]); } else { // in values pass int sequenceIn = nextSuperBasic(superBasicType, columnArray_[0]); if (valuesOption > 1) superBasicType = 2; if (sequenceIn < 0) { // end of values pass - initialize weights etc handler_->message(CLP_END_VALUES_PASS, messages_) << numberIterations_; primalColumnPivot_->saveWeights(this, 5); problemStatus_ = -2; // factorize now pivotRow_ = -1; // say no weights update returnCode = -4; // Clean up int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (getColumnStatus(i) == atLowerBound || getColumnStatus(i) == isFixed) solution_[i] = lower_[i]; else if (getColumnStatus(i) == atUpperBound) solution_[i] = upper_[i]; } break; } else { // normal sequenceIn_ = sequenceIn; valueIn_ = solution_[sequenceIn_]; lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; } } pivotRow_ = -1; sequenceOut_ = -1; rowArray_[1]->clear(); if (sequenceIn_ >= 0) { // we found a pivot column assert (!flagged(sequenceIn_)); #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) { char x = isColumn(sequenceIn_) ? 'C' : 'R'; std::cout << "pivot column " << x << sequenceWithin(sequenceIn_) << std::endl; } #endif #ifdef CLP_DEBUG { int checkSequence = -2077; if (checkSequence >= 0 && checkSequence < numberRows_ + numberColumns_ && !ifValuesPass) { rowArray_[2]->checkClear(); rowArray_[3]->checkClear(); double * array = rowArray_[3]->denseVector(); int * index = rowArray_[3]->getIndices(); unpackPacked(rowArray_[3], checkSequence); factorization_->updateColumnForDebug(rowArray_[2], rowArray_[3]); int number = rowArray_[3]->getNumElements(); double dualIn = cost_[checkSequence]; int i; for (i = 0; i < number; i++) { int iRow = index[i]; int iPivot = pivotVariable_[iRow]; double alpha = array[i]; dualIn -= alpha * cost_[iPivot]; } printf("old dj for %d was %g, recomputed %g\n", checkSequence, dj_[checkSequence], dualIn); rowArray_[3]->clear(); if (numberIterations_ > 2000) exit(1); } } #endif // do second half of iteration returnCode = pivotResult(ifValuesPass); if (returnCode < -1 && returnCode > -5) { problemStatus_ = -2; // } else if (returnCode == -5) { if ((moreSpecialOptions_ & 16) == 0 && factorization_->pivots()) { moreSpecialOptions_ |= 16; problemStatus_ = -2; } // otherwise something flagged - continue; } else if (returnCode == 2) { problemStatus_ = -5; // looks unbounded } else if (returnCode == 4) { problemStatus_ = -2; // looks unbounded but has iterated } else if (returnCode != -1) { assert(returnCode == 3); if (problemStatus_ != 5) problemStatus_ = 3; } } else { // no pivot column #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("** no column pivot\n"); #endif if (nonLinearCost_->numberInfeasibilities()) problemStatus_ = -4; // might be infeasible // Force to re-factorize early next time int numberPivots = factorization_->pivots(); returnCode = 0; #ifdef CLP_USER_DRIVEN // If large number of pivots trap later? if (problemStatus_==-1 && numberPivots<1000000) { int status = eventHandler_->event(ClpEventHandler::noCandidateInPrimal); if (status>=0&&status<10) { // carry on problemStatus_=-1; if (status==0) break; } else if (status>=10) { problemStatus_=status-10; break; } else { forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); break; } } #else forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); break; #endif } } if (valuesOption > 1) columnArray_[0]->setNumElements(0); return returnCode; } /* Checks if finished. Updates status */ void ClpSimplexPrimal::statusOfProblemInPrimal(int & lastCleaned, int type, ClpSimplexProgress * progress, bool doFactorization, int ifValuesPass, ClpSimplex * originalModel) { int dummy; // for use in generalExpanded int saveFirstFree = firstFree_; // number of pivots done int numberPivots = factorization_->pivots(); if (type == 2) { // trouble - restore solution CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff matrix_->generalExpanded(this, 6, dummy); forceFactorization_ = 1; // a bit drastic but .. pivotRow_ = -1; // say no weights update changeMade_++; // say change made } int saveThreshold = factorization_->sparseThreshold(); int tentativeStatus = problemStatus_; int numberThrownOut = 1; // to loop round on bad factorization in values pass double lastSumInfeasibility = COIN_DBL_MAX; if (numberIterations_) lastSumInfeasibility = nonLinearCost_->sumInfeasibilities(); int nPass = 0; while (numberThrownOut) { int nSlackBasic = 0; if (nPass) { for (int i = 0; i < numberRows_; i++) { if (getRowStatus(i) == basic) nSlackBasic++; } } nPass++; if (problemStatus_ > -3 || problemStatus_ == -4) { // factorize // later on we will need to recover from singularities // also we could skip if first time // do weights // This may save pivotRow_ for use if (doFactorization) primalColumnPivot_->saveWeights(this, 1); if ((type && doFactorization) || nSlackBasic == numberRows_) { // is factorization okay? int factorStatus = internalFactorize(1); if (factorStatus) { if (solveType_ == 2 + 8) { // say odd problemStatus_ = 5; return; } if (type != 1 || largestPrimalError_ > 1.0e3 || largestDualError_ > 1.0e3) { // switch off dense int saveDense = factorization_->denseThreshold(); factorization_->setDenseThreshold(0); // Go to safe factorization_->pivotTolerance(0.99); // make sure will do safe factorization pivotVariable_[0] = -1; internalFactorize(2); factorization_->setDenseThreshold(saveDense); // restore extra stuff matrix_->generalExpanded(this, 6, dummy); } else { // no - restore previous basis // Keep any flagged variables int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (flagged(i)) saveStatus_[i] |= 64; //say flagged } CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); if (numberPivots <= 1) { // throw out something if (sequenceIn_ >= 0 && getStatus(sequenceIn_) != basic) { setFlagged(sequenceIn_); } else if (sequenceOut_ >= 0 && getStatus(sequenceOut_) != basic) { setFlagged(sequenceOut_); } double newTolerance = CoinMax(0.5 + 0.499 * randomNumberGenerator_.randomDouble(), factorization_->pivotTolerance()); factorization_->pivotTolerance(newTolerance); } else { // Go to safe factorization_->pivotTolerance(0.99); } CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff matrix_->generalExpanded(this, 6, dummy); matrix_->generalExpanded(this, 5, dummy); forceFactorization_ = 1; // a bit drastic but .. type = 2; if (internalFactorize(2) != 0) { largestPrimalError_ = 1.0e4; // force other type } } changeMade_++; // say change made } } if (problemStatus_ != -4) problemStatus_ = -3; } if(progress->realInfeasibility_[0]<1.0e-1 && primalTolerance_==1.0e-7&&progress->iterationNumber_[0]>0&& progress->iterationNumber_[CLP_PROGRESS-1]-progress->iterationNumber_[0]>25) { // default - so user did not set int iP; double minAverage=COIN_DBL_MAX; double maxAverage=0.0; for (iP=0;iPnumberInfeasibilities_[iP]; if (!n) { break; } else { double average=progress->realInfeasibility_[iP]; if (average>0.1) break; average /= static_cast(n); minAverage=CoinMin(minAverage,average); maxAverage=CoinMax(maxAverage,average); } } if (iP==CLP_PROGRESS&&minAverage<1.0e-5&&maxAverage<1.0e-3) { // change tolerance #if CBC_USEFUL_PRINTING>0 printf("CCchanging tolerance\n"); #endif primalTolerance_=1.0e-6; dblParam_[ClpPrimalTolerance]=1.0e-6; moreSpecialOptions_ |= 4194304; } } // at this stage status is -3 or -5 if looks unbounded // get primal and dual solutions // put back original costs and then check // createRim(4); // costs do not change // May need to do more if column generation dummy = 4; matrix_->generalExpanded(this, 9, dummy); #ifndef CLP_CAUTION #define CLP_CAUTION 1 #endif #if CLP_CAUTION double lastAverageInfeasibility = sumDualInfeasibilities_ / static_cast(numberDualInfeasibilities_ + 10); #endif #ifdef CLP_USER_DRIVEN int status = eventHandler_->event(ClpEventHandler::goodFactorization); if (status >= 0) { lastSumInfeasibility = COIN_DBL_MAX; } #endif if (ifValuesPass && firstFree_ <0) { largestPrimalError_=1.0e7; largestDualError_=1.0e7; } bool sayValuesPass = (firstFree_>=0); //if (ifValuesPass&&numberIterations_==baseIteration_) //sayValuesPass=true; numberThrownOut = gutsOfSolution(NULL, NULL, sayValuesPass); double sumInfeasibility = nonLinearCost_->sumInfeasibilities(); int reason2 = 0; #if CLP_CAUTION #if CLP_CAUTION==2 double test2 = 1.0e5; #else double test2 = 1.0e-1; #endif if (!lastSumInfeasibility && sumInfeasibility && lastAverageInfeasibility < test2 && numberPivots > 10) reason2 = 3; if (lastSumInfeasibility < 1.0e-6 && sumInfeasibility > 1.0e-3 && numberPivots > 10) reason2 = 4; #endif if (numberThrownOut) reason2 = 1; if ((sumInfeasibility > 1.0e7 && sumInfeasibility > 100.0 * lastSumInfeasibility && factorization_->pivotTolerance() < 0.11) || (largestPrimalError_ > 1.0e10 && largestDualError_ > 1.0e10)) reason2 = 2; if (reason2) { problemStatus_ = tentativeStatus; doFactorization = true; if (numberPivots||numberThrownOut==-123456789) { // go back // trouble - restore solution CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff matrix_->generalExpanded(this, 6, dummy); if (reason2 < 3) { // Go to safe factorization_->pivotTolerance(CoinMin(0.99, 1.01 * factorization_->pivotTolerance())); forceFactorization_ = 1; // a bit drastic but .. } else if (forceFactorization_ < 0) { forceFactorization_ = CoinMin(numberPivots / 2, 100); } else { forceFactorization_ = CoinMin(forceFactorization_, CoinMax(3, numberPivots / 2)); } pivotRow_ = -1; // say no weights update changeMade_++; // say change made if (numberPivots == 1) { // throw out something if (sequenceIn_ >= 0 && getStatus(sequenceIn_) != basic) { setFlagged(sequenceIn_); } else if (sequenceOut_ >= 0 && getStatus(sequenceOut_) != basic) { setFlagged(sequenceOut_); } } type = 2; // so will restore weights if (internalFactorize(2) != 0) { largestPrimalError_ = 1.0e4; // force other type } numberPivots = 0; numberThrownOut = gutsOfSolution(NULL, NULL, (firstFree_ >= 0)); //assert (!numberThrownOut); #ifdef CLP_USEFUL_PRINTOUT if (numberThrownOut) printf("OUCH! - %d thrownout at %s line %d\n", numberThrownOut,__FILE__,__LINE__); #endif sumInfeasibility = nonLinearCost_->sumInfeasibilities(); } } } // Double check reduced costs if no action if (progress->lastIterationNumber(0) == numberIterations_) { if (primalColumnPivot_->looksOptimal()) { numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; } } // If in primal and small dj give up if ((specialOptions_ & 1024) != 0 && !numberPrimalInfeasibilities_ && numberDualInfeasibilities_) { double average = sumDualInfeasibilities_ / (static_cast (numberDualInfeasibilities_)); if (numberIterations_ > 300 && average < 1.0e-4) { numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; } } // Check if looping int loop; if (type != 2 && !ifValuesPass) loop = progress->looping(); else loop = -1; if (loop >= 0) { if (!problemStatus_) { // declaring victory numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } else { problemStatus_ = loop; //exit if in loop problemStatus_ = 10; // instead - try other algorithm numberPrimalInfeasibilities_ = nonLinearCost_->numberInfeasibilities(); } problemStatus_ = 10; // instead - try other algorithm return ; } else if (loop < -1) { // Is it time for drastic measures if (nonLinearCost_->numberInfeasibilities() && progress->badTimes() > 5 && progress->oddState() < 10 && progress->oddState() >= 0) { progress->newOddState(); nonLinearCost_->zapCosts(); } // something may have changed gutsOfSolution(NULL, NULL, ifValuesPass != 0); } // If progress then reset costs if (loop == -1 && !nonLinearCost_->numberInfeasibilities() && progress->oddState() < 0) { createRim(4, false); // costs back delete nonLinearCost_; nonLinearCost_ = new ClpNonLinearCost(this); progress->endOddState(); gutsOfSolution(NULL, NULL, ifValuesPass != 0); } // Flag to say whether to go to dual to clean up bool goToDual = false; // really for free variables in //if((progressFlag_&2)!=0) //problemStatus_=-1;; progressFlag_ = 0; //reset progress flag handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << nonLinearCost_->feasibleReportCost(); handler_->printing(nonLinearCost_->numberInfeasibilities() > 0) << nonLinearCost_->sumInfeasibilities() << nonLinearCost_->numberInfeasibilities(); handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; if (!primalFeasible()) { nonLinearCost_->checkInfeasibilities(primalTolerance_); gutsOfSolution(NULL, NULL, ifValuesPass != 0); nonLinearCost_->checkInfeasibilities(primalTolerance_); } if (nonLinearCost_->numberInfeasibilities() > 0 && !progress->initialWeight_ && !ifValuesPass && infeasibilityCost_ == 1.0e10) { // first time infeasible - start up weight computation double * oldDj = dj_; double * oldCost = cost_; int numberRows2 = numberRows_ + numberExtraRows_; int numberTotal = numberRows2 + numberColumns_; dj_ = new double[numberTotal]; cost_ = new double[numberTotal]; reducedCostWork_ = dj_; rowReducedCost_ = dj_ + numberColumns_; objectiveWork_ = cost_; rowObjectiveWork_ = cost_ + numberColumns_; double direction = optimizationDirection_ * objectiveScale_; const double * obj = objective(); memset(rowObjectiveWork_, 0, numberRows_ * sizeof(double)); int iSequence; if (columnScale_) for (iSequence = 0; iSequence < numberColumns_; iSequence++) cost_[iSequence] = obj[iSequence] * direction * columnScale_[iSequence]; else for (iSequence = 0; iSequence < numberColumns_; iSequence++) cost_[iSequence] = obj[iSequence] * direction; computeDuals(NULL); int numberSame = 0; int numberDifferent = 0; int numberZero = 0; int numberFreeSame = 0; int numberFreeDifferent = 0; int numberFreeZero = 0; int n = 0; for (iSequence = 0; iSequence < numberTotal; iSequence++) { if (getStatus(iSequence) != basic && !flagged(iSequence)) { // not basic double distanceUp = upper_[iSequence] - solution_[iSequence]; double distanceDown = solution_[iSequence] - lower_[iSequence]; double feasibleDj = dj_[iSequence]; double infeasibleDj = oldDj[iSequence] - feasibleDj; double value = feasibleDj * infeasibleDj; if (distanceUp > primalTolerance_) { // Check if "free" if (distanceDown > primalTolerance_) { // free if (value > dualTolerance_) { numberFreeSame++; } else if(value < -dualTolerance_) { numberFreeDifferent++; dj_[n++] = feasibleDj / infeasibleDj; } else { numberFreeZero++; } } else { // should not be negative if (value > dualTolerance_) { numberSame++; } else if(value < -dualTolerance_) { numberDifferent++; dj_[n++] = feasibleDj / infeasibleDj; } else { numberZero++; } } } else if (distanceDown > primalTolerance_) { // should not be positive if (value > dualTolerance_) { numberSame++; } else if(value < -dualTolerance_) { numberDifferent++; dj_[n++] = feasibleDj / infeasibleDj; } else { numberZero++; } } } progress->initialWeight_ = -1.0; } #ifdef CLP_USEFUL_PRINTOUT printf("XXXX %d same, %d different, %d zero, -- free %d %d %d\n", numberSame,numberDifferent,numberZero, numberFreeSame,numberFreeDifferent,numberFreeZero); #endif // we want most to be same if (n) { std::sort(dj_, dj_ + n); #ifdef CLP_USEFUL_PRINTOUT double most = 0.95; int which = static_cast ((1.0 - most) * static_cast (n)); double take2 = -dj_[which] * infeasibilityCost_; printf("XXXX inf cost %g take %g (range %g %g)\n",infeasibilityCost_,take2,-dj_[0]*infeasibilityCost_,-dj_[n-1]*infeasibilityCost_); #endif double take = -dj_[0] * infeasibilityCost_; // was infeasibilityCost_ = CoinMin(CoinMax(1000.0 * take, 1.0e8), 1.0000001e10); infeasibilityCost_ = CoinMin(CoinMax(1000.0 * take, 1.0e3), 1.0000001e10); #ifdef CLP_USEFUL_PRINTOUT printf("XXXX changing weight to %g\n",infeasibilityCost_); #endif } delete [] dj_; delete [] cost_; dj_ = oldDj; cost_ = oldCost; reducedCostWork_ = dj_; rowReducedCost_ = dj_ + numberColumns_; objectiveWork_ = cost_; rowObjectiveWork_ = cost_ + numberColumns_; if (n||matrix_->type()>=15) gutsOfSolution(NULL, NULL, ifValuesPass != 0); } double trueInfeasibility = nonLinearCost_->sumInfeasibilities(); if (!nonLinearCost_->numberInfeasibilities() && infeasibilityCost_ == 1.0e10 && !ifValuesPass && true) { // relax if default infeasibilityCost_ = CoinMin(CoinMax(100.0 * sumDualInfeasibilities_, 1.0e8), 1.00000001e10); // reset looping criterion progress->reset(); trueInfeasibility = 1.123456e10; } if (trueInfeasibility > 1.0) { // If infeasibility going up may change weights double testValue = trueInfeasibility - 1.0e-4 * (10.0 + trueInfeasibility); double lastInf = progress->lastInfeasibility(1); double lastInf3 = progress->lastInfeasibility(3); double thisObj = progress->lastObjective(0); double thisInf = progress->lastInfeasibility(0); thisObj += infeasibilityCost_ * 2.0 * thisInf; double lastObj = progress->lastObjective(1); lastObj += infeasibilityCost_ * 2.0 * lastInf; double lastObj3 = progress->lastObjective(3); lastObj3 += infeasibilityCost_ * 2.0 * lastInf3; if (lastObj < thisObj - 1.0e-5 * CoinMax(fabs(thisObj), fabs(lastObj)) - 1.0e-7 && firstFree_ < 0 && thisInf >= lastInf) { if (handler_->logLevel() == 63) printf("lastobj %g this %g force %d\n", lastObj, thisObj, forceFactorization_); int maxFactor = factorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ >> 2)); if (handler_->logLevel() == 63) printf("Reducing factorization frequency to %d\n", forceFactorization_); } } else if (lastObj3 < thisObj - 1.0e-5 * CoinMax(fabs(thisObj), fabs(lastObj3)) - 1.0e-7 && firstFree_ < 0 && thisInf >= lastInf) { if (handler_->logLevel() == 63) printf("lastobj3 %g this3 %g force %d\n", lastObj3, thisObj, forceFactorization_); int maxFactor = factorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ * 2) / 3); if (handler_->logLevel() == 63) printf("Reducing factorization frequency to %d\n", forceFactorization_); } } else if(lastInf < testValue || trueInfeasibility == 1.123456e10) { if (infeasibilityCost_ < 1.0e14) { infeasibilityCost_ *= 1.5; // reset looping criterion progress->reset(); if (handler_->logLevel() == 63) printf("increasing weight to %g\n", infeasibilityCost_); gutsOfSolution(NULL, NULL, ifValuesPass != 0); } } } // we may wish to say it is optimal even if infeasible bool alwaysOptimal = (specialOptions_ & 1) != 0; // give code benefit of doubt if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0 && progress->objective_[CLP_PROGRESS-1]> progress->objective_[CLP_PROGRESS-2]-1.0e-9*(10.0+fabs(objectiveValue_))) { // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; // But check if in sprint if (originalModel) { // Carry on and re-do numberDualInfeasibilities_ = -776; } // But if real primal infeasibilities nonzero carry on if (nonLinearCost_->numberInfeasibilities()) { // most likely to happen if infeasible double relaxedToleranceP = primalTolerance_; // we can't really trust infeasibilities if there is primal error double error = CoinMin(1.0e-2, largestPrimalError_); // allow tolerance at least slightly bigger than standard relaxedToleranceP = relaxedToleranceP + error; int ninfeas = nonLinearCost_->numberInfeasibilities(); double sum = nonLinearCost_->sumInfeasibilities(); double average = sum / static_cast (ninfeas); #ifdef COIN_DEVELOP if (handler_->logLevel() > 0) printf("nonLinearCost says infeasible %d summing to %g\n", ninfeas, sum); #endif if (average > relaxedToleranceP) { sumOfRelaxedPrimalInfeasibilities_ = sum; numberPrimalInfeasibilities_ = ninfeas; sumPrimalInfeasibilities_ = sum; #ifdef COIN_DEVELOP bool unflagged = #endif unflag(); #ifdef COIN_DEVELOP if (unflagged && handler_->logLevel() > 0) printf(" - but flagged variables\n"); #endif } } } bool looksOptimal = (!numberDualInfeasibilities_&&!nonLinearCost_->sumInfeasibilities()); // had ||(type==3&&problemStatus_!=-5) -- ??? why ???? if ((dualFeasible() || problemStatus_ == -4) && (!ifValuesPass||looksOptimal)) { // see if extra helps if (nonLinearCost_->numberInfeasibilities() && (nonLinearCost_->sumInfeasibilities() > 1.0e-3 || sumOfRelaxedPrimalInfeasibilities_) && !alwaysOptimal) { //may need infeasiblity cost changed // we can see if we can construct a ray // make up a new objective double saveWeight = infeasibilityCost_; // save nonlinear cost as we are going to switch off costs ClpNonLinearCost * nonLinear = nonLinearCost_; // do twice to make sure Primal solution has settled // put non-basics to bounds in case tolerance moved // put back original costs createRim(4); nonLinearCost_->checkInfeasibilities(0.0); gutsOfSolution(NULL, NULL, ifValuesPass != 0); infeasibilityCost_ = 1.0e100; // put back original costs createRim(4); nonLinearCost_->checkInfeasibilities(primalTolerance_); // may have fixed infeasibilities - double check if (nonLinearCost_->numberInfeasibilities() == 0) { // carry on problemStatus_ = -1; infeasibilityCost_ = saveWeight; nonLinearCost_->checkInfeasibilities(primalTolerance_); } else { nonLinearCost_ = NULL; // scale int i; for (i = 0; i < numberRows_ + numberColumns_; i++) cost_[i] *= 1.0e-95; gutsOfSolution(NULL, NULL, ifValuesPass != 0); nonLinearCost_ = nonLinear; infeasibilityCost_ = saveWeight; if ((infeasibilityCost_ >= 1.0e18 || numberDualInfeasibilities_ == 0) && perturbation_ == 101) { goToDual = unPerturb(); // stop any further perturbation if (nonLinearCost_->sumInfeasibilities() > 1.0e-1) goToDual = false; nonLinearCost_->checkInfeasibilities(primalTolerance_); numberDualInfeasibilities_ = 1; // carry on problemStatus_ = -1; } else if (numberDualInfeasibilities_ == 0 && largestDualError_ > 1.0e-2 && (moreSpecialOptions_ & (256|8192)) == 0) { goToDual = true; factorization_->pivotTolerance(CoinMax(0.9, factorization_->pivotTolerance())); } if (!goToDual) { if (infeasibilityCost_ >= 1.0e20 || numberDualInfeasibilities_ == 0) { // we are infeasible - use as ray delete [] ray_; ray_ = new double [numberRows_]; // swap sign for (int i=0;icheckInfeasibilities(primalTolerance_); gutsOfSolution(NULL, NULL, ifValuesPass != 0); // so will exit infeasibilityCost_ = 1.0e30; // reset infeasibilities sumPrimalInfeasibilities_ = nonLinearCost_->sumInfeasibilities();; numberPrimalInfeasibilities_ = nonLinearCost_->numberInfeasibilities(); } if (infeasibilityCost_ < 1.0e20) { infeasibilityCost_ *= 5.0; // reset looping criterion progress->reset(); changeMade_++; // say change made handler_->message(CLP_PRIMAL_WEIGHT, messages_) << infeasibilityCost_ << CoinMessageEol; // put back original costs and then check createRim(4); nonLinearCost_->checkInfeasibilities(0.0); gutsOfSolution(NULL, NULL, ifValuesPass != 0); problemStatus_ = -1; //continue goToDual = false; } else { // say infeasible problemStatus_ = 1; } } } } else { // may be optimal if (perturbation_ == 101) { goToDual = unPerturb(); // stop any further perturbation if ((numberRows_ > 20000 || numberDualInfeasibilities_) && !numberTimesOptimal_) goToDual = false; // Better to carry on a bit longer lastCleaned = -1; // carry on } bool unflagged = (unflag() != 0); if ( lastCleaned != numberIterations_ || unflagged) { handler_->message(CLP_PRIMAL_OPTIMAL, messages_) << primalTolerance_ << CoinMessageEol; if (numberTimesOptimal_ < 4) { numberTimesOptimal_++; changeMade_++; // say change made if (numberTimesOptimal_ == 1) { // better to have small tolerance even if slower factorization_->zeroTolerance(CoinMin(factorization_->zeroTolerance(), 1.0e-15)); } lastCleaned = numberIterations_; if (primalTolerance_ != dblParam_[ClpPrimalTolerance]) handler_->message(CLP_PRIMAL_ORIGINAL, messages_) << CoinMessageEol; double oldTolerance = primalTolerance_; primalTolerance_ = dblParam_[ClpPrimalTolerance]; #if 0 double * xcost = new double[numberRows_+numberColumns_]; double * xlower = new double[numberRows_+numberColumns_]; double * xupper = new double[numberRows_+numberColumns_]; double * xdj = new double[numberRows_+numberColumns_]; double * xsolution = new double[numberRows_+numberColumns_]; CoinMemcpyN(cost_, (numberRows_ + numberColumns_), xcost); CoinMemcpyN(lower_, (numberRows_ + numberColumns_), xlower); CoinMemcpyN(upper_, (numberRows_ + numberColumns_), xupper); CoinMemcpyN(dj_, (numberRows_ + numberColumns_), xdj); CoinMemcpyN(solution_, (numberRows_ + numberColumns_), xsolution); #endif // put back original costs and then check createRim(4); nonLinearCost_->checkInfeasibilities(oldTolerance); #if 0 int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (cost_[i] != xcost[i]) printf("** %d old cost %g new %g sol %g\n", i, xcost[i], cost_[i], solution_[i]); if (lower_[i] != xlower[i]) printf("** %d old lower %g new %g sol %g\n", i, xlower[i], lower_[i], solution_[i]); if (upper_[i] != xupper[i]) printf("** %d old upper %g new %g sol %g\n", i, xupper[i], upper_[i], solution_[i]); if (dj_[i] != xdj[i]) printf("** %d old dj %g new %g sol %g\n", i, xdj[i], dj_[i], solution_[i]); if (solution_[i] != xsolution[i]) printf("** %d old solution %g new %g sol %g\n", i, xsolution[i], solution_[i], solution_[i]); } delete [] xcost; delete [] xupper; delete [] xlower; delete [] xdj; delete [] xsolution; #endif gutsOfSolution(NULL, NULL, ifValuesPass != 0); if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0) { // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } if (dualFeasible() && !nonLinearCost_->numberInfeasibilities() && lastCleaned >= 0) problemStatus_ = 0; else problemStatus_ = -1; } else { problemStatus_ = 0; // optimal if (lastCleaned < numberIterations_) { handler_->message(CLP_SIMPLEX_GIVINGUP, messages_) << CoinMessageEol; } } } else { if (!alwaysOptimal || !sumOfRelaxedPrimalInfeasibilities_) problemStatus_ = 0; // optimal else problemStatus_ = 1; // infeasible } } } else { // see if looks unbounded if (problemStatus_ == -5) { if (nonLinearCost_->numberInfeasibilities()) { if (infeasibilityCost_ > 1.0e18 && perturbation_ == 101) { // back off weight infeasibilityCost_ = 1.0e13; // reset looping criterion progress->reset(); unPerturb(); // stop any further perturbation } //we need infeasiblity cost changed if (infeasibilityCost_ < 1.0e20) { infeasibilityCost_ *= 5.0; // reset looping criterion progress->reset(); changeMade_++; // say change made handler_->message(CLP_PRIMAL_WEIGHT, messages_) << infeasibilityCost_ << CoinMessageEol; // put back original costs and then check createRim(4); gutsOfSolution(NULL, NULL, ifValuesPass != 0); problemStatus_ = -1; //continue } else { // say infeasible problemStatus_ = 1; // we are infeasible - use as ray delete [] ray_; ray_ = new double [numberRows_]; CoinMemcpyN(dual_, numberRows_, ray_); } } else { // say unbounded problemStatus_ = 2; } } else { // carry on problemStatus_ = -1; if(type == 3 && !ifValuesPass) { //bool unflagged = unflag(); if (sumDualInfeasibilities_ < 1.0e-3 || (sumDualInfeasibilities_ / static_cast (numberDualInfeasibilities_)) < 1.0e-5 || progress->lastIterationNumber(0) == numberIterations_) { if (!numberPrimalInfeasibilities_) { if (numberTimesOptimal_ < 4) { numberTimesOptimal_++; changeMade_++; // say change made } else { problemStatus_ = 0; secondaryStatus_ = 5; } } } } } } if (problemStatus_ == 0) { double objVal = (nonLinearCost_->feasibleCost() + objective_->nonlinearOffset()); objVal /= (objectiveScale_ * rhsScale_); double tol = 1.0e-10 * CoinMax(fabs(objVal), fabs(objectiveValue_)) + 1.0e-8; if (fabs(objVal - objectiveValue_) > tol) { #ifdef COIN_DEVELOP if (handler_->logLevel() > 0) printf("nonLinearCost has feasible obj of %g, objectiveValue_ is %g\n", objVal, objectiveValue_); #endif objectiveValue_ = objVal; } } // save extra stuff matrix_->generalExpanded(this, 5, dummy); if (type == 0 || type == 1) { if (type != 1 || !saveStatus_) { // create save arrays delete [] saveStatus_; delete [] savedSolution_; saveStatus_ = new unsigned char [numberRows_+numberColumns_]; savedSolution_ = new double [numberRows_+numberColumns_]; } // save arrays CoinMemcpyN(status_, numberColumns_ + numberRows_, saveStatus_); CoinMemcpyN(rowActivityWork_, numberRows_, savedSolution_ + numberColumns_); CoinMemcpyN(columnActivityWork_, numberColumns_, savedSolution_); } // see if in Cbc etc bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; bool disaster = false; if (disasterArea_ && inCbcOrOther && disasterArea_->check()) { disasterArea_->saveInfo(); disaster = true; } if (disaster) problemStatus_ = 3; if (problemStatus_ < 0 && !changeMade_) { problemStatus_ = 4; // unknown } lastGoodIteration_ = numberIterations_; if (numberIterations_ > lastBadIteration_ + 100) moreSpecialOptions_ &= ~16; // clear check accuracy flag if ((moreSpecialOptions_ & 256) != 0) goToDual=false; if (goToDual || (numberIterations_ > 1000 && largestPrimalError_ > 1.0e6 && largestDualError_ > 1.0e6)) { problemStatus_ = 10; // try dual // See if second call if ((moreSpecialOptions_ & 256) != 0&&nonLinearCost_->sumInfeasibilities()>1.0e2) { numberPrimalInfeasibilities_ = nonLinearCost_->numberInfeasibilities(); sumPrimalInfeasibilities_ = nonLinearCost_->sumInfeasibilities(); // say infeasible if (numberPrimalInfeasibilities_ && largestPrimalError_<1.0e-1) problemStatus_ = 1; } } // make sure first free monotonic if (firstFree_ >= 0 && saveFirstFree >= 0) { firstFree_ = (numberIterations_) ? saveFirstFree : -1; nextSuperBasic(1, NULL); } if (doFactorization) { // restore weights (if saved) - also recompute infeasibility list if (tentativeStatus > -3) primalColumnPivot_->saveWeights(this, (type < 2) ? 2 : 4); else primalColumnPivot_->saveWeights(this, 3); if (saveThreshold) { // use default at present factorization_->sparseThreshold(0); factorization_->goSparse(); } } // Allow matrices to be sorted etc int fake = -999; // signal sort matrix_->correctSequence(this, fake, fake); } /* Row array has pivot column This chooses pivot row. For speed, we may need to go to a bucket approach when many variables go through bounds On exit rhsArray will have changes in costs of basic variables */ void ClpSimplexPrimal::primalRow(CoinIndexedVector * rowArray, CoinIndexedVector * rhsArray, CoinIndexedVector * spareArray, int valuesPass) { double saveDj = dualIn_; if (valuesPass && objective_->type() < 2) { dualIn_ = cost_[sequenceIn_]; double * work = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); int iIndex; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iIndex]; int iPivot = pivotVariable_[iRow]; dualIn_ -= alpha * cost_[iPivot]; } // determine direction here if (dualIn_ < -dualTolerance_) { directionIn_ = 1; } else if (dualIn_ > dualTolerance_) { directionIn_ = -1; } else { // towards nearest bound if (valueIn_ - lowerIn_ < upperIn_ - valueIn_) { directionIn_ = -1; dualIn_ = dualTolerance_; } else { directionIn_ = 1; dualIn_ = -dualTolerance_; } } } // sequence stays as row number until end pivotRow_ = -1; int numberRemaining = 0; double totalThru = 0.0; // for when variables flip // Allow first few iterations to take tiny double acceptablePivot = 1.0e-1 * acceptablePivot_; if (numberIterations_ > 100) acceptablePivot = acceptablePivot_; if (factorization_->pivots() > 10) acceptablePivot = 1.0e+3 * acceptablePivot_; // if we have iterated be more strict else if (factorization_->pivots() > 5) acceptablePivot = 1.0e+2 * acceptablePivot_; // if we have iterated be slightly more strict else if (factorization_->pivots()) acceptablePivot = acceptablePivot_; // relax double bestEverPivot = acceptablePivot; int lastPivotRow = -1; double lastPivot = 0.0; double lastTheta = 1.0e50; // use spareArrays to put ones looked at in // First one is list of candidates // We could compress if we really know we won't need any more // Second array has current set of pivot candidates // with a backup list saved in double * part of indexed vector // pivot elements double * spare; // indices int * index; spareArray->clear(); spare = spareArray->denseVector(); index = spareArray->getIndices(); // we also need somewhere for effective rhs double * rhs = rhsArray->denseVector(); // and we can use indices to point to alpha // that way we can store fabs(alpha) int * indexPoint = rhsArray->getIndices(); //int numberFlip=0; // Those which may change if flips /* First we get a list of possible pivots. We can also see if the problem looks unbounded. At first we increase theta and see what happens. We start theta at a reasonable guess. If in right area then we do bit by bit. We save possible pivot candidates */ // do first pass to get possibles // We can also see if unbounded double * work = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); // we need to swap sign if coming in from ub double way = directionIn_; double maximumMovement; if (way > 0.0) maximumMovement = CoinMin(1.0e30, upperIn_ - valueIn_); else maximumMovement = CoinMin(1.0e30, valueIn_ - lowerIn_); double averageTheta = nonLinearCost_->averageTheta(); double tentativeTheta = CoinMin(10.0 * averageTheta, maximumMovement); double upperTheta = maximumMovement; if (tentativeTheta > 0.5 * maximumMovement) tentativeTheta = maximumMovement; bool thetaAtMaximum = tentativeTheta == maximumMovement; // In case tiny bounds increase if (maximumMovement < 1.0) tentativeTheta *= 1.1; double dualCheck = fabs(dualIn_); // but make a bit more pessimistic dualCheck = CoinMax(dualCheck - 100.0 * dualTolerance_, 0.99 * dualCheck); int iIndex; int pivotOne = -1; //#define CLP_DEBUG #ifdef CLP_DEBUG if (numberIterations_ == -3839 || numberIterations_ == -3840) { double dj = cost_[sequenceIn_]; printf("cost in on %d is %g, dual in %g\n", sequenceIn_, dj, dualIn_); for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iIndex]; int iPivot = pivotVariable_[iRow]; dj -= alpha * cost_[iPivot]; printf("row %d var %d current %g %g %g, alpha %g so sol => %g (cost %g, dj %g)\n", iRow, iPivot, lower_[iPivot], solution_[iPivot], upper_[iPivot], alpha, solution_[iPivot] - 1.0e9 * alpha, cost_[iPivot], dj); } } #endif while (true) { pivotOne = -1; totalThru = 0.0; // We also re-compute reduced cost numberRemaining = 0; dualIn_ = cost_[sequenceIn_]; #ifndef NDEBUG //double tolerance = primalTolerance_ * 1.002; #endif for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iIndex]; int iPivot = pivotVariable_[iRow]; if (cost_[iPivot]) dualIn_ -= alpha * cost_[iPivot]; alpha *= way; double oldValue = solution_[iPivot]; // get where in bound sequence // note that after this alpha is actually fabs(alpha) bool possible; // do computation same way as later on in primal if (alpha > 0.0) { // basic variable going towards lower bound double bound = lower_[iPivot]; // must be exactly same as when used double change = tentativeTheta * alpha; possible = (oldValue - change) <= bound + primalTolerance_; oldValue -= bound; } else { // basic variable going towards upper bound double bound = upper_[iPivot]; // must be exactly same as when used double change = tentativeTheta * alpha; possible = (oldValue - change) >= bound - primalTolerance_; oldValue = bound - oldValue; alpha = - alpha; } double value; //assert (oldValue >= -10.0*tolerance); if (possible) { value = oldValue - upperTheta * alpha; #ifdef CLP_USER_DRIVEN1 if(!userChoiceValid1(this,iPivot,oldValue, upperTheta,alpha,work[iIndex]*way)) value =0.0; // say can't use #endif if (value < -primalTolerance_ && alpha >= acceptablePivot) { upperTheta = (oldValue + primalTolerance_) / alpha; pivotOne = numberRemaining; } // add to list spare[numberRemaining] = alpha; rhs[numberRemaining] = oldValue; indexPoint[numberRemaining] = iIndex; index[numberRemaining++] = iRow; totalThru += alpha; setActive(iRow); //} else if (value= 1.0001 * dualCheck) { // Can pivot here break; } else if (!thetaAtMaximum) { //printf("Going round with average theta of %g\n",averageTheta); tentativeTheta = maximumMovement; thetaAtMaximum = true; // seems to be odd compiler error } else { break; } } totalThru = 0.0; theta_ = maximumMovement; bool goBackOne = false; if (objective_->type() > 1) dualIn_ = saveDj; //printf("%d remain out of %d\n",numberRemaining,number); int iTry = 0; #define MAXTRY 1000 if (numberRemaining && upperTheta < maximumMovement) { // First check if previously chosen one will work if (pivotOne >= 0 && 0) { double thruCost = infeasibilityCost_ * spare[pivotOne]; if (thruCost >= 0.99 * fabs(dualIn_)) COIN_DETAIL_PRINT(printf("Could pivot on %d as change %g dj %g\n", index[pivotOne], thruCost, dualIn_)); double alpha = spare[pivotOne]; double oldValue = rhs[pivotOne]; theta_ = oldValue / alpha; pivotRow_ = pivotOne; // Stop loop iTry = MAXTRY; } // first get ratio with tolerance for ( ; iTry < MAXTRY; iTry++) { upperTheta = maximumMovement; int iBest = -1; for (iIndex = 0; iIndex < numberRemaining; iIndex++) { double alpha = spare[iIndex]; double oldValue = rhs[iIndex]; double value = oldValue - upperTheta * alpha; #ifdef CLP_USER_DRIVEN1 int sequenceOut=pivotVariable_[index[iIndex]]; if(!userChoiceValid1(this,sequenceOut,oldValue, upperTheta,alpha, 0.0)) value =0.0; // say can't use #endif if (value < -primalTolerance_ && alpha >= acceptablePivot) { upperTheta = (oldValue + primalTolerance_) / alpha; iBest = iIndex; // just in case weird numbers } } // now look at best in this lot // But also see how infeasible small pivots will make double sumInfeasibilities = 0.0; double bestPivot = acceptablePivot; pivotRow_ = -1; for (iIndex = 0; iIndex < numberRemaining; iIndex++) { int iRow = index[iIndex]; double alpha = spare[iIndex]; double oldValue = rhs[iIndex]; double value = oldValue - upperTheta * alpha; if (value <= 0 || iBest == iIndex) { // how much would it cost to go thru and modify bound double trueAlpha = way * work[indexPoint[iIndex]]; totalThru += nonLinearCost_->changeInCost(pivotVariable_[iRow], trueAlpha, rhs[iIndex]); setActive(iRow); if (alpha > bestPivot) { bestPivot = alpha; theta_ = oldValue / bestPivot; pivotRow_ = iIndex; } else if (alpha < acceptablePivot #ifdef CLP_USER_DRIVEN1 ||!userChoiceValid1(this,pivotVariable_[index[iIndex]], oldValue,upperTheta,alpha,0.0) #endif ) { if (value < -primalTolerance_) sumInfeasibilities += -value - primalTolerance_; } } } if (bestPivot < 0.1 * bestEverPivot && bestEverPivot > 1.0e-6 && bestPivot < 1.0e-3) { // back to previous one goBackOne = true; break; } else if (pivotRow_ == -1 && upperTheta > largeValue_) { if (lastPivot > acceptablePivot) { // back to previous one goBackOne = true; } else { // can only get here if all pivots so far too small } break; } else if (totalThru >= dualCheck) { if (sumInfeasibilities > primalTolerance_ && !nonLinearCost_->numberInfeasibilities()) { // Looks a bad choice if (lastPivot > acceptablePivot) { goBackOne = true; } else { // say no good dualIn_ = 0.0; } } break; // no point trying another loop } else { lastPivotRow = pivotRow_; lastTheta = theta_; if (bestPivot > bestEverPivot) bestEverPivot = bestPivot; } } // can get here without pivotRow_ set but with lastPivotRow if (goBackOne || (pivotRow_ < 0 && lastPivotRow >= 0)) { // back to previous one pivotRow_ = lastPivotRow; theta_ = lastTheta; } } else if (pivotRow_ < 0 && maximumMovement > 1.0e20) { // looks unbounded valueOut_ = COIN_DBL_MAX; // say odd if (nonLinearCost_->numberInfeasibilities()) { // but infeasible?? // move variable but don't pivot tentativeTheta = 1.0e50; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iIndex]; int iPivot = pivotVariable_[iRow]; alpha *= way; double oldValue = solution_[iPivot]; // get where in bound sequence // note that after this alpha is actually fabs(alpha) if (alpha > 0.0) { // basic variable going towards lower bound double bound = lower_[iPivot]; oldValue -= bound; } else { // basic variable going towards upper bound double bound = upper_[iPivot]; oldValue = bound - oldValue; alpha = - alpha; } if (oldValue - tentativeTheta * alpha < 0.0) { tentativeTheta = oldValue / alpha; } } // If free in then see if we can get to 0.0 if (lowerIn_ < -1.0e20 && upperIn_ > 1.0e20) { if (dualIn_ * valueIn_ > 0.0) { if (fabs(valueIn_) < 1.0e-2 && (tentativeTheta < fabs(valueIn_) || tentativeTheta > 1.0e20)) { tentativeTheta = fabs(valueIn_); } } } if (tentativeTheta < 1.0e10) valueOut_ = valueIn_ + way * tentativeTheta; } } //if (iTry>50) //printf("** %d tries\n",iTry); if (pivotRow_ >= 0) { int position = pivotRow_; // position in list pivotRow_ = index[position]; alpha_ = work[indexPoint[position]]; // translate to sequence sequenceOut_ = pivotVariable_[pivotRow_]; valueOut_ = solution(sequenceOut_); lowerOut_ = lower_[sequenceOut_]; upperOut_ = upper_[sequenceOut_]; #define MINIMUMTHETA 1.0e-12 // Movement should be minimum for anti-degeneracy - unless // fixed variable out double minimumTheta; if (upperOut_ > lowerOut_) minimumTheta = MINIMUMTHETA; else minimumTheta = 0.0; // But can't go infeasible double distance; if (alpha_ * way > 0.0) distance = valueOut_ - lowerOut_; else distance = upperOut_ - valueOut_; if (distance - minimumTheta * fabs(alpha_) < -primalTolerance_) minimumTheta = CoinMax(0.0, (distance + 0.5 * primalTolerance_) / fabs(alpha_)); // will we need to increase tolerance //#define CLP_DEBUG double largestInfeasibility = primalTolerance_; if (theta_ < minimumTheta && (specialOptions_ & 4) == 0 && !valuesPass) { theta_ = minimumTheta; for (iIndex = 0; iIndex < numberRemaining - numberRemaining; iIndex++) { largestInfeasibility = CoinMax(largestInfeasibility, -(rhs[iIndex] - spare[iIndex] * theta_)); } //#define CLP_DEBUG #ifdef CLP_DEBUG if (largestInfeasibility > primalTolerance_ && (handler_->logLevel() & 32) > -1) printf("Primal tolerance increased from %g to %g\n", primalTolerance_, largestInfeasibility); #endif //#undef CLP_DEBUG primalTolerance_ = CoinMax(primalTolerance_, largestInfeasibility); } // Need to look at all in some cases if (theta_ > tentativeTheta) { for (iIndex = 0; iIndex < number; iIndex++) setActive(which[iIndex]); } if (way < 0.0) theta_ = - theta_; double newValue = valueOut_ - theta_ * alpha_; // If 4 bit set - Force outgoing variables to exact bound (primal) if (alpha_ * way < 0.0) { directionOut_ = -1; // to upper bound if (fabs(theta_) > 1.0e-6 || (specialOptions_ & 4) != 0) { upperOut_ = nonLinearCost_->nearest(sequenceOut_, newValue); } else { upperOut_ = newValue; } } else { directionOut_ = 1; // to lower bound if (fabs(theta_) > 1.0e-6 || (specialOptions_ & 4) != 0) { lowerOut_ = nonLinearCost_->nearest(sequenceOut_, newValue); } else { lowerOut_ = newValue; } } dualOut_ = reducedCost(sequenceOut_); } else if (maximumMovement < 1.0e20) { // flip pivotRow_ = -2; // so we can tell its a flip sequenceOut_ = sequenceIn_; valueOut_ = valueIn_; dualOut_ = dualIn_; lowerOut_ = lowerIn_; upperOut_ = upperIn_; alpha_ = 0.0; if (way < 0.0) { directionOut_ = 1; // to lower bound theta_ = lowerOut_ - valueOut_; } else { directionOut_ = -1; // to upper bound theta_ = upperOut_ - valueOut_; } } double theta1 = CoinMax(theta_, 1.0e-12); double theta2 = numberIterations_ * nonLinearCost_->averageTheta(); // Set average theta nonLinearCost_->setAverageTheta((theta1 + theta2) / (static_cast (numberIterations_ + 1))); //if (numberIterations_%1000==0) //printf("average theta is %g\n",nonLinearCost_->averageTheta()); // clear arrays CoinZeroN(spare, numberRemaining); // put back original bounds etc CoinMemcpyN(index, numberRemaining, rhsArray->getIndices()); rhsArray->setNumElements(numberRemaining); rhsArray->setPacked(); nonLinearCost_->goBackAll(rhsArray); rhsArray->clear(); } /* Chooses primal pivot column updateArray has cost updates (also use pivotRow_ from last iteration) Would be faster with separate region to scan and will have this (with square of infeasibility) when steepest For easy problems we can just choose one of the first columns we look at */ void ClpSimplexPrimal::primalColumn(CoinIndexedVector * updates, CoinIndexedVector * spareRow1, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { ClpMatrixBase * saveMatrix = matrix_; double * saveRowScale = rowScale_; if (scaledMatrix_) { rowScale_ = NULL; matrix_ = scaledMatrix_; } sequenceIn_ = primalColumnPivot_->pivotColumn(updates, spareRow1, spareRow2, spareColumn1, spareColumn2); if (scaledMatrix_) { matrix_ = saveMatrix; rowScale_ = saveRowScale; } if (sequenceIn_ >= 0) { valueIn_ = solution_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; if (nonLinearCost_->lookBothWays()) { // double check ClpSimplex::Status status = getStatus(sequenceIn_); switch(status) { case ClpSimplex::atUpperBound: if (dualIn_ < 0.0) { // move to other side COIN_DETAIL_PRINT(printf("For %d U (%g, %g, %g) dj changed from %g", sequenceIn_, lower_[sequenceIn_], solution_[sequenceIn_], upper_[sequenceIn_], dualIn_)); dualIn_ -= nonLinearCost_->changeUpInCost(sequenceIn_); COIN_DETAIL_PRINT(printf(" to %g\n", dualIn_)); nonLinearCost_->setOne(sequenceIn_, upper_[sequenceIn_] + 2.0 * currentPrimalTolerance()); setStatus(sequenceIn_, ClpSimplex::atLowerBound); } break; case ClpSimplex::atLowerBound: if (dualIn_ > 0.0) { // move to other side COIN_DETAIL_PRINT(printf("For %d L (%g, %g, %g) dj changed from %g", sequenceIn_, lower_[sequenceIn_], solution_[sequenceIn_], upper_[sequenceIn_], dualIn_)); dualIn_ -= nonLinearCost_->changeDownInCost(sequenceIn_); COIN_DETAIL_PRINT(printf(" to %g\n", dualIn_)); nonLinearCost_->setOne(sequenceIn_, lower_[sequenceIn_] - 2.0 * currentPrimalTolerance()); setStatus(sequenceIn_, ClpSimplex::atUpperBound); } break; default: break; } } lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; if (dualIn_ > 0.0) directionIn_ = -1; else directionIn_ = 1; } else { sequenceIn_ = -1; } } /* The primals are updated by the given array. Returns number of infeasibilities. After rowArray will have list of cost changes */ int ClpSimplexPrimal::updatePrimalsInPrimal(CoinIndexedVector * rowArray, double theta, double & objectiveChange, int valuesPass) { // Cost on pivot row may change - may need to change dualIn double oldCost = 0.0; if (pivotRow_ >= 0) oldCost = cost_[sequenceOut_]; //rowArray->scanAndPack(); double * work = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); int newNumber = 0; int pivotPosition = -1; nonLinearCost_->setChangeInCost(0.0); //printf("XX 4138 sol %g lower %g upper %g cost %g status %d\n", // solution_[4138],lower_[4138],upper_[4138],cost_[4138],status_[4138]); // allow for case where bound+tolerance == bound //double tolerance = 0.999999*primalTolerance_; double relaxedTolerance = 1.001 * primalTolerance_; int iIndex; if (!valuesPass) { for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iIndex]; work[iIndex] = 0.0; int iPivot = pivotVariable_[iRow]; double change = theta * alpha; double value = solution_[iPivot] - change; solution_[iPivot] = value; #ifndef NDEBUG // check if not active then okay if (!active(iRow) && (specialOptions_ & 4) == 0 && pivotRow_ != -1) { // But make sure one going out is feasible if (change > 0.0) { // going down if (value <= lower_[iPivot] + primalTolerance_) { if (iPivot == sequenceOut_ && value > lower_[iPivot] - relaxedTolerance) value = lower_[iPivot]; //double difference = nonLinearCost_->setOne(iPivot, value); //assert (!difference || fabs(change) > 1.0e9); } } else { // going up if (value >= upper_[iPivot] - primalTolerance_) { if (iPivot == sequenceOut_ && value < upper_[iPivot] + relaxedTolerance) value = upper_[iPivot]; //double difference = nonLinearCost_->setOne(iPivot, value); //assert (!difference || fabs(change) > 1.0e9); } } } #endif if (active(iRow) || theta_ < 0.0) { clearActive(iRow); // But make sure one going out is feasible if (change > 0.0) { // going down if (value <= lower_[iPivot] + primalTolerance_) { if (iPivot == sequenceOut_ && value >= lower_[iPivot] - relaxedTolerance) value = lower_[iPivot]; double difference = nonLinearCost_->setOne(iPivot, value); if (difference) { if (iRow == pivotRow_) pivotPosition = newNumber; work[newNumber] = difference; //change reduced cost on this dj_[iPivot] = -difference; which[newNumber++] = iRow; } } } else { // going up if (value >= upper_[iPivot] - primalTolerance_) { if (iPivot == sequenceOut_ && value < upper_[iPivot] + relaxedTolerance) value = upper_[iPivot]; double difference = nonLinearCost_->setOne(iPivot, value); if (difference) { if (iRow == pivotRow_) pivotPosition = newNumber; work[newNumber] = difference; //change reduced cost on this dj_[iPivot] = -difference; which[newNumber++] = iRow; } } } } } } else { // values pass so look at all for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iIndex]; work[iIndex] = 0.0; int iPivot = pivotVariable_[iRow]; double change = theta * alpha; double value = solution_[iPivot] - change; solution_[iPivot] = value; clearActive(iRow); // But make sure one going out is feasible if (change > 0.0) { // going down if (value <= lower_[iPivot] + primalTolerance_) { if (iPivot == sequenceOut_ && value > lower_[iPivot] - relaxedTolerance) value = lower_[iPivot]; double difference = nonLinearCost_->setOne(iPivot, value); if (difference) { if (iRow == pivotRow_) pivotPosition = newNumber; work[newNumber] = difference; //change reduced cost on this dj_[iPivot] = -difference; which[newNumber++] = iRow; } } } else { // going up if (value >= upper_[iPivot] - primalTolerance_) { if (iPivot == sequenceOut_ && value < upper_[iPivot] + relaxedTolerance) value = upper_[iPivot]; double difference = nonLinearCost_->setOne(iPivot, value); if (difference) { if (iRow == pivotRow_) pivotPosition = newNumber; work[newNumber] = difference; //change reduced cost on this dj_[iPivot] = -difference; which[newNumber++] = iRow; } } } } } objectiveChange += nonLinearCost_->changeInCost(); rowArray->setPacked(); #if 0 rowArray->setNumElements(newNumber); rowArray->expand(); if (pivotRow_ >= 0) { dualIn_ += (oldCost - cost_[sequenceOut_]); // update change vector to include pivot rowArray->add(pivotRow_, -dualIn_); // and convert to packed rowArray->scanAndPack(); } else { // and convert to packed rowArray->scanAndPack(); } #else if (pivotRow_ >= 0) { double dualIn = dualIn_ + (oldCost - cost_[sequenceOut_]); // update change vector to include pivot if (pivotPosition >= 0) { work[pivotPosition] -= dualIn; } else { work[newNumber] = -dualIn; which[newNumber++] = pivotRow_; } } rowArray->setNumElements(newNumber); #endif return 0; } // Perturbs problem void ClpSimplexPrimal::perturb(int type) { if (perturbation_ > 100) return; //perturbed already if (perturbation_ == 100) perturbation_ = 50; // treat as normal int savePerturbation = perturbation_; int i; if (!numberIterations_) cleanStatus(); // make sure status okay // Make sure feasible bounds if (nonLinearCost_) { nonLinearCost_->checkInfeasibilities(); //nonLinearCost_->feasibleBounds(); } // look at element range double smallestNegative; double largestNegative; double smallestPositive; double largestPositive; matrix_->rangeOfElements(smallestNegative, largestNegative, smallestPositive, largestPositive); smallestPositive = CoinMin(fabs(smallestNegative), smallestPositive); largestPositive = CoinMax(fabs(largestNegative), largestPositive); double elementRatio = largestPositive / smallestPositive; if (!numberIterations_ && perturbation_ == 50) { // See if we need to perturb int numberTotal = CoinMax(numberRows_, numberColumns_); double * sort = new double[numberTotal]; int nFixed = 0; for (i = 0; i < numberRows_; i++) { double lo = fabs(rowLower_[i]); double up = fabs(rowUpper_[i]); double value = 0.0; if (lo && lo < 1.0e20) { if (up && up < 1.0e20) { value = 0.5 * (lo + up); if (lo == up) nFixed++; } else { value = lo; } } else { if (up && up < 1.0e20) value = up; } sort[i] = value; } std::sort(sort, sort + numberRows_); int number = 1; double last = sort[0]; for (i = 1; i < numberRows_; i++) { if (last != sort[i]) number++; last = sort[i]; } #ifdef KEEP_GOING_IF_FIXED //printf("ratio number diff rhs %g (%d %d fixed), element ratio %g\n",((double)number)/((double) numberRows_), // numberRows_,nFixed,elementRatio); #endif if (number * 4 > numberRows_ || elementRatio > 1.0e12) { perturbation_ = 100; delete [] sort; return; // good enough } number = 0; #ifdef KEEP_GOING_IF_FIXED if (!integerType_) { // look at columns nFixed = 0; for (i = 0; i < numberColumns_; i++) { double lo = fabs(columnLower_[i]); double up = fabs(columnUpper_[i]); double value = 0.0; if (lo && lo < 1.0e20) { if (up && up < 1.0e20) { value = 0.5 * (lo + up); if (lo == up) nFixed++; } else { value = lo; } } else { if (up && up < 1.0e20) value = up; } sort[i] = value; } std::sort(sort, sort + numberColumns_); number = 1; last = sort[0]; for (i = 1; i < numberColumns_; i++) { if (last != sort[i]) number++; last = sort[i]; } //printf("cratio number diff bounds %g (%d %d fixed)\n",((double)number)/((double) numberColumns_), // numberColumns_,nFixed); } #endif delete [] sort; if (number * 4 > numberColumns_) { perturbation_ = 100; return; // good enough } } // primal perturbation double perturbation = 1.0e-20; double bias = 1.0; int numberNonZero = 0; // maximum fraction of rhs/bounds to perturb double maximumFraction = 1.0e-5; if (perturbation_ >= 50) { perturbation = 1.0e-4; for (i = 0; i < numberColumns_ + numberRows_; i++) { if (upper_[i] > lower_[i] + primalTolerance_) { double lowerValue, upperValue; if (lower_[i] > -1.0e20) lowerValue = fabs(lower_[i]); else lowerValue = 0.0; if (upper_[i] < 1.0e20) upperValue = fabs(upper_[i]); else upperValue = 0.0; double value = CoinMax(fabs(lowerValue), fabs(upperValue)); value = CoinMin(value, upper_[i] - lower_[i]); #if 1 if (value) { perturbation += value; numberNonZero++; } #else perturbation = CoinMax(perturbation, value); #endif } } if (numberNonZero) perturbation /= static_cast (numberNonZero); else perturbation = 1.0e-1; if (perturbation_ > 50 && perturbation_ < 55) { // reduce while (perturbation_ < 55) { perturbation_++; perturbation *= 0.25; bias *= 0.25; } } else if (perturbation_ >= 55 && perturbation_ < 60) { // increase while (perturbation_ > 55) { perturbation_--; perturbation *= 4.0; } perturbation_ = 50; } } else if (perturbation_ < 100) { perturbation = pow(10.0, perturbation_); // user is in charge maximumFraction = 1.0; } double largestZero = 0.0; double largest = 0.0; double largestPerCent = 0.0; bool printOut = (handler_->logLevel() == 63); printOut = false; //off // Check if all slack int number = 0; int iSequence; for (iSequence = 0; iSequence < numberRows_; iSequence++) { if (getRowStatus(iSequence) == basic) number++; } if (rhsScale_ > 100.0) { // tone down perturbation maximumFraction *= 0.1; } if (savePerturbation==51) { perturbation = CoinMin(0.1,perturbation); maximumFraction *=0.1; } if (number != numberRows_) type = 1; // modify bounds // Change so at least 1.0e-5 and no more than 0.1 // For now just no more than 0.1 // printf("Pert type %d perturbation %g, maxF %g\n",type,perturbation,maximumFraction); // seems much slower???#define SAVE_PERT #ifdef SAVE_PERT if (2 * numberColumns_ > maximumPerturbationSize_) { delete [] perturbationArray_; maximumPerturbationSize_ = 2 * numberColumns_; perturbationArray_ = new double [maximumPerturbationSize_]; for (int iColumn = 0; iColumn < maximumPerturbationSize_; iColumn++) { perturbationArray_[iColumn] = randomNumberGenerator_.randomDouble(); } } #endif if (type == 1) { double tolerance = 100.0 * primalTolerance_; tolerance = 10.0 * primalTolerance_; // try smaller //double multiplier = perturbation*maximumFraction; for (iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { if (getStatus(iSequence) == basic) { double lowerValue = lower_[iSequence]; double upperValue = upper_[iSequence]; if (upperValue > lowerValue + tolerance) { double solutionValue = solution_[iSequence]; double difference = upperValue - lowerValue; difference = CoinMin(difference, perturbation); difference = CoinMin(difference, fabs(solutionValue) + 1.0); double value = maximumFraction * (difference + bias); value = CoinMin(value, 0.1); value = CoinMax(value,primalTolerance_); #ifndef SAVE_PERT value *= randomNumberGenerator_.randomDouble(); #else value *= perturbationArray_[2*iSequence]; #endif if (value) { while (value= numberColumns_) { // may not be at bound - but still perturb (unless free) if (upperValue > 1.0e30 && lowerValue < -1.0e30) value = 0.0; else value = - value; // as -1.0 in matrix } else { value = 0.0; } #else value = 0.0; #endif } if (value) { if (printOut) printf("col %d lower from %g to %g, upper from %g to %g\n", iSequence, lowerValue, lower_[iSequence], upperValue , upper_[iSequence]); if (solutionValue) { largest = CoinMax(largest, value); if (value > (fabs(solutionValue) + 1.0)*largestPerCent) largestPerCent = value / (fabs(solutionValue) + 1.0); } else { largestZero = CoinMax(largestZero, value); } } } } } } else { double tolerance = 100.0 * primalTolerance_; tolerance = 10.0 * primalTolerance_; // try smaller for (i = 0; i < numberColumns_; i++) { double lowerValue = lower_[i], upperValue = upper_[i]; if (upperValue > lowerValue + primalTolerance_) { double value = perturbation * maximumFraction; value = CoinMin(value, 0.1); #ifndef SAVE_PERT value *= randomNumberGenerator_.randomDouble(); #else value *= perturbationArray_[2*i+1]; #endif value *= randomNumberGenerator_.randomDouble(); if (savePerturbation != 50) { if (fabs(value) <= primalTolerance_) value = 0.0; } if (value) { double valueL = value * (CoinMax(1.0e-2, 1.0e-5 * fabs(lowerValue))); // get in range if (valueL <= tolerance) { valueL *= 10.0; while (valueL <= tolerance) valueL *= 10.0; } else if (valueL > 1.0e-3) { valueL *= 0.1; while (valueL > 1.0e-3) valueL *= 0.1; } if (lowerValue > -1.0e20 && lowerValue) lowerValue -= valueL; double valueU = value * (CoinMax(1.0e-2, 1.0e-5 * fabs(upperValue))); // get in range if (valueU <= tolerance) { valueU *= 10.0; while (valueU <= tolerance) valueU *= 10.0; } else if (valueU > 1.0e-3) { valueU *= 0.1; while (valueU > 1.0e-3) valueU *= 0.1; } if (upperValue < 1.0e20 && upperValue) upperValue += valueU; } if (lowerValue != lower_[i]) { double difference = fabs(lowerValue - lower_[i]); largest = CoinMax(largest, difference); if (difference > fabs(lower_[i])*largestPerCent) largestPerCent = fabs(difference / lower_[i]); } if (upperValue != upper_[i]) { double difference = fabs(upperValue - upper_[i]); largest = CoinMax(largest, difference); if (difference > fabs(upper_[i])*largestPerCent) largestPerCent = fabs(difference / upper_[i]); } if (printOut) printf("col %d lower from %g to %g, upper from %g to %g\n", i, lower_[i], lowerValue, upper_[i], upperValue); } lower_[i] = lowerValue; upper_[i] = upperValue; } // biased const double * rowLower = rowLower_-numberColumns_; const double * rowUpper = rowUpper_-numberColumns_; for (; i < numberColumns_ + numberRows_; i++) { double lowerValue = lower_[i], upperValue = upper_[i]; double value = perturbation * maximumFraction; value = CoinMin(value, 0.1); value *= randomNumberGenerator_.randomDouble(); if (rowLower[i]!=rowUpper[i] && upperValue > lowerValue + tolerance) { if (savePerturbation != 50) { if (fabs(value) <= primalTolerance_) value = 0.0; if (lowerValue > -1.0e20 && lowerValue) lowerValue -= value * (CoinMax(1.0e-2, 1.0e-5 * fabs(lowerValue))); if (upperValue < 1.0e20 && upperValue) upperValue += value * (CoinMax(1.0e-2, 1.0e-5 * fabs(upperValue))); } else if (value) { double valueL = value * (CoinMax(1.0e-2, 1.0e-5 * fabs(lowerValue))); // get in range if (valueL <= tolerance) { valueL *= 10.0; while (valueL <= tolerance) valueL *= 10.0; } else if (valueL > 1.0) { valueL *= 0.1; while (valueL > 1.0) valueL *= 0.1; } if (lowerValue > -1.0e20 && lowerValue) lowerValue -= valueL; double valueU = value * (CoinMax(1.0e-2, 1.0e-5 * fabs(upperValue))); // get in range if (valueU <= tolerance) { valueU *= 10.0; while (valueU <= tolerance) valueU *= 10.0; } else if (valueU > 1.0) { valueU *= 0.1; while (valueU > 1.0) valueU *= 0.1; } if (upperValue < 1.0e20 && upperValue) upperValue += valueU; } } else if (upperValue > 0.0) { //upperValue -= value * (CoinMax(1.0e-2, 1.0e-5 * fabs(lowerValue))); // lowerValue -= value * (CoinMax(1.0e-2, 1.0e-5 * fabs(lowerValue))); } else if (upperValue < 0.0) { // upperValue += value * (CoinMax(1.0e-2, 1.0e-5 * fabs(lowerValue))); // lowerValue += value * (CoinMax(1.0e-2, 1.0e-5 * fabs(lowerValue))); } else { } if (lowerValue != lower_[i]) { double difference = fabs(lowerValue - lower_[i]); largest = CoinMax(largest, difference); if (difference > fabs(lower_[i])*largestPerCent) largestPerCent = fabs(difference / lower_[i]); } if (upperValue != upper_[i]) { double difference = fabs(upperValue - upper_[i]); largest = CoinMax(largest, difference); if (difference > fabs(upper_[i])*largestPerCent) largestPerCent = fabs(difference / upper_[i]); } if (printOut) printf("row %d lower from %g to %g, upper from %g to %g\n", i - numberColumns_, lower_[i], lowerValue, upper_[i], upperValue); lower_[i] = lowerValue; upper_[i] = upperValue; } } // Clean up for (i = 0; i < numberColumns_ + numberRows_; i++) { switch(getStatus(i)) { case basic: break; case atUpperBound: solution_[i] = upper_[i]; break; case isFixed: case atLowerBound: solution_[i] = lower_[i]; break; case isFree: break; case superBasic: break; } } if (largest || largestZero) { handler_->message(CLP_SIMPLEX_PERTURB, messages_) << 100.0 * maximumFraction << perturbation << largest << 100.0 * largestPerCent << largestZero << CoinMessageEol; // say perturbed perturbation_ = 101; } else { // say no need perturbation_ = 102; } } // un perturb bool ClpSimplexPrimal::unPerturb() { if (perturbation_ != 101) return false; // put back original bounds and costs createRim(1 + 4); sanityCheck(); // unflag unflag(); // get a valid nonlinear cost function delete nonLinearCost_; nonLinearCost_ = new ClpNonLinearCost(this); perturbation_ = 102; // stop any further perturbation // move non basic variables to new bounds nonLinearCost_->checkInfeasibilities(0.0); #if 1 // Try using dual return true; #else gutsOfSolution(NULL, NULL, ifValuesPass != 0); return false; #endif } // Unflag all variables and return number unflagged int ClpSimplexPrimal::unflag() { int i; int number = numberRows_ + numberColumns_; int numberFlagged = 0; // we can't really trust infeasibilities if there is dual error // allow tolerance bigger than standard to check on duals double relaxedToleranceD = dualTolerance_ + CoinMin(1.0e-2, 10.0 * largestDualError_); for (i = 0; i < number; i++) { if (flagged(i)) { clearFlagged(i); // only say if reasonable dj if (fabs(dj_[i]) > relaxedToleranceD) numberFlagged++; } } numberFlagged += matrix_->generalExpanded(this, 8, i); if (handler_->logLevel() > 2 && numberFlagged && objective_->type() > 1) printf("%d unflagged\n", numberFlagged); return numberFlagged; } // Do not change infeasibility cost and always say optimal void ClpSimplexPrimal::alwaysOptimal(bool onOff) { if (onOff) specialOptions_ |= 1; else specialOptions_ &= ~1; } bool ClpSimplexPrimal::alwaysOptimal() const { return (specialOptions_ & 1) != 0; } // Flatten outgoing variables i.e. - always to exact bound void ClpSimplexPrimal::exactOutgoing(bool onOff) { if (onOff) specialOptions_ |= 4; else specialOptions_ &= ~4; } bool ClpSimplexPrimal::exactOutgoing() const { return (specialOptions_ & 4) != 0; } /* Reasons to come out (normal mode/user mode): -1 normal -2 factorize now - good iteration/ NA -3 slight inaccuracy - refactorize - iteration done/ same but factor done -4 inaccuracy - refactorize - no iteration/ NA -5 something flagged - go round again/ pivot not possible +2 looks unbounded +3 max iterations (iteration done) */ int ClpSimplexPrimal::pivotResult(int ifValuesPass) { bool roundAgain = true; int returnCode = -1; // loop round if user setting and doing refactorization while (roundAgain) { roundAgain = false; returnCode = -1; pivotRow_ = -1; sequenceOut_ = -1; rowArray_[1]->clear(); #if 0 { int seq[] = {612, 643}; int k; for (k = 0; k < sizeof(seq) / sizeof(int); k++) { int iSeq = seq[k]; if (getColumnStatus(iSeq) != basic) { double djval; double * work; int number; int * which; int iIndex; unpack(rowArray_[1], iSeq); factorization_->updateColumn(rowArray_[2], rowArray_[1]); djval = cost_[iSeq]; work = rowArray_[1]->denseVector(); number = rowArray_[1]->getNumElements(); which = rowArray_[1]->getIndices(); for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; int iPivot = pivotVariable_[iRow]; djval -= alpha * cost_[iPivot]; } double comp = 1.0e-8 + 1.0e-7 * (CoinMax(fabs(dj_[iSeq]), fabs(djval))); if (fabs(djval - dj_[iSeq]) > comp) printf("Bad dj %g for %d - true is %g\n", dj_[iSeq], iSeq, djval); assert (fabs(djval) < 1.0e-3 || djval * dj_[iSeq] > 0.0); rowArray_[1]->clear(); } } } #endif // we found a pivot column // update the incoming column unpackPacked(rowArray_[1]); // save reduced cost double saveDj = dualIn_; factorization_->updateColumnFT(rowArray_[2], rowArray_[1]); // Get extra rows matrix_->extendUpdated(this, rowArray_[1], 0); // do ratio test and re-compute dj #ifdef CLP_USER_DRIVEN if (solveType_ != 2 || (moreSpecialOptions_ & 512) == 0) { #endif primalRow(rowArray_[1], rowArray_[3], rowArray_[2], ifValuesPass); #ifdef CLP_USER_DRIVEN // user can tell which use it is int status = eventHandler_->event(ClpEventHandler::pivotRow); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::pivotRow; break; } } else { int status = eventHandler_->event(ClpEventHandler::pivotRow); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::pivotRow; break; } } #endif if (ifValuesPass) { saveDj = dualIn_; //assert (fabs(alpha_)>=1.0e-5||(objective_->type()<2||!objective_->activated())||pivotRow_==-2); if (pivotRow_ == -1 || (pivotRow_ >= 0 && fabs(alpha_) < 1.0e-5)) { if(fabs(dualIn_) < 1.0e2 * dualTolerance_ && objective_->type() < 2) { // try other way directionIn_ = -directionIn_; primalRow(rowArray_[1], rowArray_[3], rowArray_[2], 0); } if (pivotRow_ == -1 || (pivotRow_ >= 0 && fabs(alpha_) < 1.0e-5)) { if (solveType_ == 1) { // reject it char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); progress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious clearAll(); pivotRow_ = -1; } returnCode = -5; break; } } } // need to clear toIndex_ in gub // ? when can I clear stuff // Clean up any gub stuff matrix_->extendUpdated(this, rowArray_[1], 1); double checkValue = 1.0e-2; if (largestDualError_ > 1.0e-5) checkValue = 1.0e-1; double test2 = dualTolerance_; double test1 = 1.0e-20; #if 0 //def FEB_TRY if (factorization_->pivots() < 1) { test1 = -1.0e-4; if ((saveDj < 0.0 && dualIn_ < -1.0e-5 * dualTolerance_) || (saveDj > 0.0 && dualIn_ > 1.0e-5 * dualTolerance_)) test2 = 0.0; // allow through } #endif if (!ifValuesPass && solveType_ == 1 && (saveDj * dualIn_ < test1 || fabs(saveDj - dualIn_) > checkValue*(1.0 + fabs(saveDj)) || fabs(dualIn_) < test2)) { if (!(saveDj * dualIn_ > 0.0 && CoinMin(fabs(saveDj), fabs(dualIn_)) > 1.0e5)) { char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_PRIMAL_DJ, messages_) << x << sequenceWithin(sequenceIn_) << saveDj << dualIn_ << CoinMessageEol; if(lastGoodIteration_ != numberIterations_) { clearAll(); pivotRow_ = -1; // say no weights update returnCode = -4; if(lastGoodIteration_ + 1 == numberIterations_) { // not looking wonderful - try cleaning bounds // put non-basics to bounds in case tolerance moved nonLinearCost_->checkInfeasibilities(0.0); } sequenceOut_ = -1; break; } else { // take on more relaxed criterion if ((saveDj * dualIn_ < test1 || fabs(saveDj - dualIn_) > 2.0e-1 * (1.0 + fabs(dualIn_)) || fabs(dualIn_) < test2) && (fabs(saveDj)>fabs(dualIn_) ||saveDj*dualIn_<1.0e-4||factorization_->pivots())) { // need to reject something char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); #if 1 //def FEB_TRY // could do conditional reset of weights to get larger djs primalColumnPivot_->saveWeights(this,6); // Make safer? double oldTolerance=factorization_->pivotTolerance(); factorization_->saferTolerances (-0.99, -1.03); if (factorization_->pivotTolerance()<1.029*oldTolerance &&oldTolerance<0.995 &&!factorization_->pivots()) { #ifdef CLP_USEFUL_PRINTOUT printf("Changing pivot tolerance from %g to %g and factorizing\n", oldTolerance,factorization_->pivotTolerance()); #endif clearAll(); pivotRow_ = -1; // say no weights update returnCode = -4; if(lastGoodIteration_ + 1 == numberIterations_) { // not looking wonderful - try cleaning bounds // put non-basics to bounds in case tolerance moved nonLinearCost_->checkInfeasibilities(0.0); } sequenceOut_ = -1; break; } #endif progress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious clearAll(); pivotRow_ = -1; returnCode = -5; sequenceOut_ = -1; break; } } } else { //printf("%d %g %g\n",numberIterations_,saveDj,dualIn_); } } if (pivotRow_ >= 0) { #ifdef CLP_USER_DRIVEN1 // Got good pivot - may need to unflag stuff userChoiceWasGood(this); #endif if (solveType_ >= 2 && (moreSpecialOptions_ & 512) == 0) { // **** Coding for user interface // do ray if (solveType_==2) primalRay(rowArray_[1]); // update duals // as packed need to find pivot row //assert (rowArray_[1]->packedMode()); //int i; //alpha_ = rowArray_[1]->denseVector()[pivotRow_]; CoinAssert (fabs(alpha_) > 1.0e-12); double multiplier = dualIn_ / alpha_; #ifndef NDEBUG rowArray_[0]->checkClear(); #endif rowArray_[0]->insert(pivotRow_, multiplier); factorization_->updateColumnTranspose(rowArray_[2], rowArray_[0]); // put row of tableau in rowArray[0] and columnArray[0] matrix_->transposeTimes(this, -1.0, rowArray_[0], columnArray_[1], columnArray_[0]); // update column djs int i; int * index = columnArray_[0]->getIndices(); int number = columnArray_[0]->getNumElements(); double * element = columnArray_[0]->denseVector(); for (i = 0; i < number; i++) { int ii = index[i]; dj_[ii] += element[ii]; reducedCost_[ii] = dj_[ii]; element[ii] = 0.0; } columnArray_[0]->setNumElements(0); // and row djs index = rowArray_[0]->getIndices(); number = rowArray_[0]->getNumElements(); element = rowArray_[0]->denseVector(); for (i = 0; i < number; i++) { int ii = index[i]; dj_[ii+numberColumns_] += element[ii]; dual_[ii] = dj_[ii+numberColumns_]; element[ii] = 0.0; } rowArray_[0]->setNumElements(0); // check incoming CoinAssert (fabs(dj_[sequenceIn_]) < 1.0e-1); } // if stable replace in basis // If gub or odd then alpha and pivotRow may change int updateType = 0; int updateStatus = matrix_->generalExpanded(this, 3, updateType); if (updateType >= 0) updateStatus = factorization_->replaceColumn(this, rowArray_[2], rowArray_[1], pivotRow_, alpha_, (moreSpecialOptions_ & 16) != 0); // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && lastGoodIteration_ == numberIterations_ && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4) { // slight error if (factorization_->pivots() > 5 || updateStatus == 4) { returnCode = -3; } } else if (updateStatus == 2) { // major error // better to have small tolerance even if slower factorization_->zeroTolerance(CoinMin(factorization_->zeroTolerance(), 1.0e-15)); int maxFactor = factorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ >> 1)); } // later we may need to unwind more e.g. fake bounds if(lastGoodIteration_ != numberIterations_) { clearAll(); pivotRow_ = -1; if (solveType_ == 1 || (moreSpecialOptions_ & 512) != 0) { returnCode = -4; break; } else { // user in charge - re-factorize int lastCleaned = 0; ClpSimplexProgress dummyProgress; if (saveStatus_) statusOfProblemInPrimal(lastCleaned, 1, &dummyProgress, true, ifValuesPass); else statusOfProblemInPrimal(lastCleaned, 0, &dummyProgress, true, ifValuesPass); roundAgain = true; continue; } } else { // need to reject something if (solveType_ == 1) { char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); progress_.clearBadTimes(); } lastBadIteration_ = numberIterations_; // say be more cautious clearAll(); pivotRow_ = -1; sequenceOut_ = -1; returnCode = -5; break; } } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (factorization_->pivots() < 0.5 * factorization_->maximumPivots() && factorization_->pivots() < 200) factorization_->areaFactor( factorization_->areaFactor() * 1.1); returnCode = -2; // factorize now } else if (updateStatus == 5) { problemStatus_ = -2; // factorize now } // here do part of steepest - ready for next iteration if (!ifValuesPass) primalColumnPivot_->updateWeights(rowArray_[1]); } else { if (pivotRow_ == -1) { // no outgoing row is valid if (valueOut_ != COIN_DBL_MAX) { double objectiveChange = 0.0; theta_ = valueOut_ - valueIn_; updatePrimalsInPrimal(rowArray_[1], theta_, objectiveChange, ifValuesPass); solution_[sequenceIn_] += theta_; } rowArray_[0]->clear(); #ifdef CLP_USER_DRIVEN1 /* Note if valueOut_ < COIN_DBL_MAX and theta_ reasonable then this may be a valid sub flip */ if(!userChoiceValid2(this)) { if (factorization_->pivots()<5) { // flag variable char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); progress_.clearBadTimes(); roundAgain = true; continue; } else { // try refactorizing first returnCode = 4; //say looks odd but has iterated break; } } #endif if (!factorization_->pivots() && acceptablePivot_ <= 1.0e-8 ) { returnCode = 2; //say looks unbounded // do ray if (!nonLinearCost_->sumInfeasibilities()) primalRay(rowArray_[1]); } else if (solveType_ == 2 && (moreSpecialOptions_ & 512) == 0) { // refactorize int lastCleaned = 0; ClpSimplexProgress dummyProgress; if (saveStatus_) statusOfProblemInPrimal(lastCleaned, 1, &dummyProgress, true, ifValuesPass); else statusOfProblemInPrimal(lastCleaned, 0, &dummyProgress, true, ifValuesPass); roundAgain = true; continue; } else { acceptablePivot_ = 1.0e-8; returnCode = 4; //say looks unbounded but has iterated } break; } else { // flipping from bound to bound } } double oldCost = 0.0; if (sequenceOut_ >= 0) oldCost = cost_[sequenceOut_]; // update primal solution double objectiveChange = 0.0; // after this rowArray_[1] is not empty - used to update djs // If pivot row >= numberRows then may be gub int savePivot = pivotRow_; if (pivotRow_ >= numberRows_) pivotRow_ = -1; #ifdef CLP_USER_DRIVEN if (theta_<0.0) { if (theta_>=-1.0e-12) theta_=0.0; //else //printf("negative theta %g\n",theta_); } #endif updatePrimalsInPrimal(rowArray_[1], theta_, objectiveChange, ifValuesPass); pivotRow_ = savePivot; double oldValue = valueIn_; if (directionIn_ == -1) { // as if from upper bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ -= fabs(theta_); } else { valueIn_ = lowerIn_; } } else { // as if from lower bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ += fabs(theta_); } else { valueIn_ = upperIn_; } } objectiveChange += dualIn_ * (valueIn_ - oldValue); // outgoing if (sequenceIn_ != sequenceOut_) { if (directionOut_ > 0) { valueOut_ = lowerOut_; } else { valueOut_ = upperOut_; } if(valueOut_ < lower_[sequenceOut_] - primalTolerance_) valueOut_ = lower_[sequenceOut_] - 0.9 * primalTolerance_; else if (valueOut_ > upper_[sequenceOut_] + primalTolerance_) valueOut_ = upper_[sequenceOut_] + 0.9 * primalTolerance_; // may not be exactly at bound and bounds may have changed // Make sure outgoing looks feasible directionOut_ = nonLinearCost_->setOneOutgoing(sequenceOut_, valueOut_); // May have got inaccurate //if (oldCost!=cost_[sequenceOut_]) //printf("costchange on %d from %g to %g\n",sequenceOut_, // oldCost,cost_[sequenceOut_]); if (solveType_ < 2) dj_[sequenceOut_] = cost_[sequenceOut_] - oldCost; // normally updated next iteration solution_[sequenceOut_] = valueOut_; } // change cost and bounds on incoming if primal nonLinearCost_->setOne(sequenceIn_, valueIn_); int whatNext = housekeeping(objectiveChange); //nonLinearCost_->validate(); #if CLP_DEBUG >1 { double sum; int ninf = matrix_->checkFeasible(this, sum); if (ninf) printf("infeas %d\n", ninf); } #endif if (whatNext == 1) { returnCode = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent returnCode = 3; } else if(numberIterations_ == lastGoodIteration_ + 2 * factorization_->maximumPivots()) { // done a lot of flips - be safe returnCode = -2; // refactorize } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 3; } } } if ((solveType_ == 2 && (moreSpecialOptions_ & 512) == 0) && (returnCode == -2 || returnCode == -3)) { // refactorize here int lastCleaned = 0; ClpSimplexProgress dummyProgress; if (saveStatus_) statusOfProblemInPrimal(lastCleaned, 1, &dummyProgress, true, ifValuesPass); else statusOfProblemInPrimal(lastCleaned, 0, &dummyProgress, true, ifValuesPass); if (problemStatus_ == 5) { COIN_DETAIL_PRINT(printf("Singular basis\n")); problemStatus_ = -1; returnCode = 5; } } #ifdef CLP_DEBUG { int i; // not [1] as may have information for (i = 0; i < 4; i++) { if (i != 1) rowArray_[i]->checkClear(); } for (i = 0; i < 2; i++) { columnArray_[i]->checkClear(); } } #endif return returnCode; } // Create primal ray void ClpSimplexPrimal::primalRay(CoinIndexedVector * rowArray) { delete [] ray_; ray_ = new double [numberColumns_]; CoinZeroN(ray_, numberColumns_); int number = rowArray->getNumElements(); int * index = rowArray->getIndices(); double * array = rowArray->denseVector(); double way = -directionIn_; int i; double zeroTolerance = 1.0e-12; if (sequenceIn_ < numberColumns_) ray_[sequenceIn_] = directionIn_; if (!rowArray->packedMode()) { for (i = 0; i < number; i++) { int iRow = index[i]; int iPivot = pivotVariable_[iRow]; double arrayValue = array[iRow]; if (iPivot < numberColumns_ && fabs(arrayValue) >= zeroTolerance) ray_[iPivot] = way * arrayValue; } } else { for (i = 0; i < number; i++) { int iRow = index[i]; int iPivot = pivotVariable_[iRow]; double arrayValue = array[i]; if (iPivot < numberColumns_ && fabs(arrayValue) >= zeroTolerance) ray_[iPivot] = way * arrayValue; } } } /* Get next superbasic -1 if none, Normal type is 1 If type is 3 then initializes sorted list if 2 uses list. */ int ClpSimplexPrimal::nextSuperBasic(int superBasicType, CoinIndexedVector * columnArray) { int returnValue = -1; bool finished = false; while (!finished) { returnValue = firstFree_; int iColumn = firstFree_ + 1; if (superBasicType > 1) { if (superBasicType > 2) { // Initialize list // Wild guess that lower bound more natural than upper int number = 0; double * work = columnArray->denseVector(); int * which = columnArray->getIndices(); for (iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) { if (!flagged(iColumn)) { if (getStatus(iColumn) == superBasic) { if (fabs(solution_[iColumn] - lower_[iColumn]) <= primalTolerance_) { solution_[iColumn] = lower_[iColumn]; setStatus(iColumn, atLowerBound); } else if (fabs(solution_[iColumn] - upper_[iColumn]) <= primalTolerance_) { solution_[iColumn] = upper_[iColumn]; setStatus(iColumn, atUpperBound); } else if (lower_[iColumn] < -1.0e20 && upper_[iColumn] > 1.0e20) { setStatus(iColumn, isFree); break; } else if (!flagged(iColumn)) { // put ones near bounds at end after sorting work[number] = - CoinMin(0.1 * (solution_[iColumn] - lower_[iColumn]), upper_[iColumn] - solution_[iColumn]); which[number++] = iColumn; } } } } CoinSort_2(work, work + number, which); columnArray->setNumElements(number); CoinZeroN(work, number); } int * which = columnArray->getIndices(); int number = columnArray->getNumElements(); if (!number) { // finished iColumn = numberRows_ + numberColumns_; returnValue = -1; } else { number--; returnValue = which[number]; iColumn = returnValue; columnArray->setNumElements(number); } } else { for (; iColumn < numberRows_ + numberColumns_; iColumn++) { if (!flagged(iColumn)) { if (getStatus(iColumn) == superBasic) { if (fabs(solution_[iColumn] - lower_[iColumn]) <= primalTolerance_) { solution_[iColumn] = lower_[iColumn]; setStatus(iColumn, atLowerBound); } else if (fabs(solution_[iColumn] - upper_[iColumn]) <= primalTolerance_) { solution_[iColumn] = upper_[iColumn]; setStatus(iColumn, atUpperBound); } else if (lower_[iColumn] < -1.0e20 && upper_[iColumn] > 1.0e20) { setStatus(iColumn, isFree); if (fabs(dj_[iColumn])>dualTolerance_) break; } else { break; } } } } } firstFree_ = iColumn; finished = true; if (firstFree_ == numberRows_ + numberColumns_) firstFree_ = -1; if (returnValue >= 0 && getStatus(returnValue) != superBasic && getStatus(returnValue) != isFree) finished = false; // somehow picked up odd one } return returnValue; } void ClpSimplexPrimal::clearAll() { // Clean up any gub stuff matrix_->extendUpdated(this, rowArray_[1], 1); int number = rowArray_[1]->getNumElements(); int * which = rowArray_[1]->getIndices(); int iIndex; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; clearActive(iRow); } rowArray_[1]->clear(); // make sure any gub sets are clean matrix_->generalExpanded(this, 11, sequenceIn_); } // Sort of lexicographic resolve int ClpSimplexPrimal::lexSolve() { algorithm_ = +1; //specialOptions_ |= 4; // save data ClpDataSave data = saveData(); matrix_->refresh(this); // make sure matrix okay // Save so can see if doing after dual int initialStatus = problemStatus_; int initialIterations = numberIterations_; int initialNegDjs = -1; // initialize - maybe values pass and algorithm_ is +1 int ifValuesPass = 0; #if 0 // if so - put in any superbasic costed slacks // Start can skip some things in transposeTimes specialOptions_ |= 131072; if (ifValuesPass && specialOptions_ < 0x01000000) { // Get column copy const CoinPackedMatrix * columnCopy = matrix(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); //const double * element = columnCopy->getElements(); int n = 0; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnLength[iColumn] == 1) { Status status = getColumnStatus(iColumn); if (status != basic && status != isFree) { double value = columnActivity_[iColumn]; if (fabs(value - columnLower_[iColumn]) > primalTolerance_ && fabs(value - columnUpper_[iColumn]) > primalTolerance_) { int iRow = row[columnStart[iColumn]]; if (getRowStatus(iRow) == basic) { setRowStatus(iRow, superBasic); setColumnStatus(iColumn, basic); n++; } } } } } printf("%d costed slacks put in basis\n", n); } #endif double * originalCost = NULL; double * originalLower = NULL; double * originalUpper = NULL; if (!startup(0, 0)) { // Set average theta nonLinearCost_->setAverageTheta(1.0e3); int lastCleaned = 0; // last time objective or bounds cleaned up // Say no pivot has occurred (for steepest edge and updates) pivotRow_ = -2; // This says whether to restore things etc int factorType = 0; if (problemStatus_ < 0 && perturbation_ < 100) { perturb(0); // Can't get here if values pass assert (!ifValuesPass); gutsOfSolution(NULL, NULL); if (handler_->logLevel() > 2) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } } ClpSimplex * saveModel = NULL; int stopSprint = -1; int sprintPass = 0; int reasonableSprintIteration = 0; int lastSprintIteration = 0; double lastObjectiveValue = COIN_DBL_MAX; // Start check for cycles progress_.fillFromModel(this); progress_.startCheck(); /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible -5 - looks unbounded */ originalCost = CoinCopyOfArray(cost_, numberColumns_ + numberRows_); originalLower = CoinCopyOfArray(lower_, numberColumns_ + numberRows_); originalUpper = CoinCopyOfArray(upper_, numberColumns_ + numberRows_); while (problemStatus_ < 0) { int iRow, iColumn; // clear for (iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // give matrix (and model costs and bounds a chance to be // refreshed (normally null) matrix_->refresh(this); // If getting nowhere - why not give it a kick #if 1 if (perturbation_ < 101 && numberIterations_ > 2 * (numberRows_ + numberColumns_) && (specialOptions_ & 4) == 0 && initialStatus != 10) { perturb(1); matrix_->rhsOffset(this, true, false); } #endif // If we have done no iterations - special if (lastGoodIteration_ == numberIterations_ && factorType) factorType = 3; if (saveModel) { // Doing sprint if (sequenceIn_ < 0 || numberIterations_ >= stopSprint) { problemStatus_ = -1; originalModel(saveModel); saveModel = NULL; if (sequenceIn_ < 0 && numberIterations_ < reasonableSprintIteration && sprintPass > 100) primalColumnPivot_->switchOffSprint(); //lastSprintIteration=numberIterations_; COIN_DETAIL_PRINT(printf("End small model\n")); } } // may factorize, checks if problem finished statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, ifValuesPass, saveModel); if (initialStatus == 10) { // cleanup phase if(initialIterations != numberIterations_) { if (numberDualInfeasibilities_ > 10000 && numberDualInfeasibilities_ > 10 * initialNegDjs) { // getting worse - try perturbing if (perturbation_ < 101 && (specialOptions_ & 4) == 0) { perturb(1); matrix_->rhsOffset(this, true, false); statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, ifValuesPass, saveModel); } } } else { // save number of negative djs if (!numberPrimalInfeasibilities_) initialNegDjs = numberDualInfeasibilities_; // make sure weight won't be changed if (infeasibilityCost_ == 1.0e10) infeasibilityCost_ = 1.000001e10; } } // See if sprint says redo because of problems if (numberDualInfeasibilities_ == -776) { // Need new set of variables problemStatus_ = -1; originalModel(saveModel); saveModel = NULL; //lastSprintIteration=numberIterations_; COIN_DETAIL_PRINT(printf("End small model after\n")); statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, ifValuesPass, saveModel); } int numberSprintIterations = 0; int numberSprintColumns = primalColumnPivot_->numberSprintColumns(numberSprintIterations); if (problemStatus_ == 777) { // problems so do one pass with normal problemStatus_ = -1; originalModel(saveModel); saveModel = NULL; // Skip factorization //statusOfProblemInPrimal(lastCleaned,factorType,&progress_,false,saveModel); statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, ifValuesPass, saveModel); } else if (problemStatus_ < 0 && !saveModel && numberSprintColumns && firstFree_ < 0) { int numberSort = 0; int numberFixed = 0; int numberBasic = 0; reasonableSprintIteration = numberIterations_ + 100; int * whichColumns = new int[numberColumns_]; double * weight = new double[numberColumns_]; int numberNegative = 0; double sumNegative = 0.0; // now massage weight so all basic in plus good djs for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double dj = dj_[iColumn]; switch(getColumnStatus(iColumn)) { case basic: dj = -1.0e50; numberBasic++; break; case atUpperBound: dj = -dj; break; case isFixed: dj = 1.0e50; numberFixed++; break; case atLowerBound: dj = dj; break; case isFree: dj = -100.0 * fabs(dj); break; case superBasic: dj = -100.0 * fabs(dj); break; } if (dj < -dualTolerance_ && dj > -1.0e50) { numberNegative++; sumNegative -= dj; } weight[iColumn] = dj; whichColumns[iColumn] = iColumn; } handler_->message(CLP_SPRINT, messages_) << sprintPass << numberIterations_ - lastSprintIteration << objectiveValue() << sumNegative << numberNegative << CoinMessageEol; sprintPass++; lastSprintIteration = numberIterations_; if (objectiveValue()*optimizationDirection_ > lastObjectiveValue - 1.0e-7 && sprintPass > 5) { // switch off COIN_DETAIL_PRINT(printf("Switching off sprint\n")); primalColumnPivot_->switchOffSprint(); } else { lastObjectiveValue = objectiveValue() * optimizationDirection_; // sort CoinSort_2(weight, weight + numberColumns_, whichColumns); numberSort = CoinMin(numberColumns_ - numberFixed, numberBasic + numberSprintColumns); // Sort to make consistent ? std::sort(whichColumns, whichColumns + numberSort); saveModel = new ClpSimplex(this, numberSort, whichColumns); delete [] whichColumns; delete [] weight; // Skip factorization //statusOfProblemInPrimal(lastCleaned,factorType,&progress_,false,saveModel); //statusOfProblemInPrimal(lastCleaned,factorType,&progress_,true,saveModel); stopSprint = numberIterations_ + numberSprintIterations; COIN_DETAIL_PRINT(printf("Sprint with %d columns for %d iterations\n", numberSprintColumns, numberSprintIterations)); } } // Say good factorization factorType = 1; // Say no pivot has occurred (for steepest edge and updates) pivotRow_ = -2; // exit if victory declared if (problemStatus_ >= 0) { if (originalCost) { // find number nonbasic with zero reduced costs int numberDegen = 0; int numberTotal = numberColumns_; //+numberRows_; for (int i = 0; i < numberTotal; i++) { cost_[i] = 0.0; if (getStatus(i) == atLowerBound) { if (dj_[i] <= dualTolerance_) { cost_[i] = numberTotal - i + randomNumberGenerator_.randomDouble() * 0.5; numberDegen++; } else { // fix cost_[i] = 1.0e10; //upper_[i]=lower_[i]; } } else if (getStatus(i) == atUpperBound) { if (dj_[i] >= -dualTolerance_) { cost_[i] = (numberTotal - i) + randomNumberGenerator_.randomDouble() * 0.5; numberDegen++; } else { // fix cost_[i] = -1.0e10; //lower_[i]=upper_[i]; } } else if (getStatus(i) == basic) { cost_[i] = (numberTotal - i) + randomNumberGenerator_.randomDouble() * 0.5; } } problemStatus_ = -1; lastObjectiveValue = COIN_DBL_MAX; // Start check for cycles progress_.fillFromModel(this); progress_.startCheck(); COIN_DETAIL_PRINT(printf("%d degenerate after %d iterations\n", numberDegen, numberIterations_)); if (!numberDegen) { CoinMemcpyN(originalCost, numberTotal, cost_); delete [] originalCost; originalCost = NULL; CoinMemcpyN(originalLower, numberTotal, lower_); delete [] originalLower; CoinMemcpyN(originalUpper, numberTotal, upper_); delete [] originalUpper; } delete nonLinearCost_; nonLinearCost_ = new ClpNonLinearCost(this); progress_.endOddState(); continue; } else { COIN_DETAIL_PRINT(printf("exiting after %d iterations\n", numberIterations_)); break; } } // test for maximum iterations if (hitMaximumIterations() || (ifValuesPass == 2 && firstFree_ < 0)) { problemStatus_ = 3; break; } if (firstFree_ < 0) { if (ifValuesPass) { // end of values pass ifValuesPass = 0; int status = eventHandler_->event(ClpEventHandler::endOfValuesPass); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfValuesPass; break; } } } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfFactorization); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } } // Iterate whileIterating(ifValuesPass ? 1 : 0); } } assert (!originalCost); // if infeasible get real values //printf("XXXXY final cost %g\n",infeasibilityCost_); progress_.initialWeight_ = 0.0; if (problemStatus_ == 1 && secondaryStatus_ != 6) { infeasibilityCost_ = 0.0; createRim(1 + 4); nonLinearCost_->checkInfeasibilities(0.0); sumPrimalInfeasibilities_ = nonLinearCost_->sumInfeasibilities(); numberPrimalInfeasibilities_ = nonLinearCost_->numberInfeasibilities(); // and get good feasible duals computeDuals(NULL); } // Stop can skip some things in transposeTimes specialOptions_ &= ~131072; // clean up unflag(); finish(0); restoreData(data); return problemStatus_; } CoinMP-1.8.3/Clp/src/CoinAbcDenseFactorization.cpp0000644000175000017500000005576512101105055020347 0ustar renerene/* $Id: CoinAbcDenseFactorization.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinUtilsConfig.h" #include "CoinPragma.hpp" #include #include #include "CoinAbcDenseFactorization.hpp" #include "CoinAbcCommonFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" //:class CoinAbcDenseFactorization. Deals with Factorization and Updates // CoinAbcDenseFactorization. Constructor CoinAbcDenseFactorization::CoinAbcDenseFactorization ( ) : CoinAbcAnyFactorization() { gutsOfInitialize(); } /// Copy constructor CoinAbcDenseFactorization::CoinAbcDenseFactorization ( const CoinAbcDenseFactorization &other) : CoinAbcAnyFactorization(other) { gutsOfInitialize(); gutsOfCopy(other); } // Clone CoinAbcAnyFactorization * CoinAbcDenseFactorization::clone() const { return new CoinAbcDenseFactorization(*this); } /// The real work of constructors etc void CoinAbcDenseFactorization::gutsOfDestructor() { delete [] elements_; delete [] pivotRow_; delete [] workArea_; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; numberRows_ = 0; numberGoodU_ = 0; status_ = -1; maximumRows_=0; #if ABC_PARALLEL==2 parallelMode_=0; #endif maximumSpace_=0; maximumRowsAdjusted_=0; solveMode_=0; } void CoinAbcDenseFactorization::gutsOfInitialize() { pivotTolerance_ = 1.0e-1; minimumPivotTolerance_ = 1.0e-1; zeroTolerance_ = 1.0e-13; areaFactor_=1.0; numberDense_=0; maximumPivots_=200; relaxCheck_=1.0; numberRows_ = 0; numberGoodU_ = 0; status_ = -1; numberSlacks_ = 0; numberPivots_ = 0; maximumRows_=0; #if ABC_PARALLEL==2 parallelMode_=0; #endif maximumSpace_=0; maximumRowsAdjusted_=0; elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; solveMode_=0; } // ~CoinAbcDenseFactorization. Destructor CoinAbcDenseFactorization::~CoinAbcDenseFactorization ( ) { gutsOfDestructor(); } // = CoinAbcDenseFactorization & CoinAbcDenseFactorization::operator = ( const CoinAbcDenseFactorization & other ) { if (this != &other) { gutsOfDestructor(); gutsOfInitialize(); gutsOfCopy(other); } return *this; } #define WORK_MULT 2 void CoinAbcDenseFactorization::gutsOfCopy(const CoinAbcDenseFactorization &other) { pivotTolerance_ = other.pivotTolerance_; minimumPivotTolerance_ = other.minimumPivotTolerance_; zeroTolerance_ = other.zeroTolerance_; areaFactor_=other.areaFactor_; numberDense_=other.numberDense_; relaxCheck_ = other.relaxCheck_; numberRows_ = other.numberRows_; maximumRows_ = other.maximumRows_; #if ABC_PARALLEL==2 parallelMode_=other.parallelMode_; #endif maximumSpace_ = other.maximumSpace_; maximumRowsAdjusted_ = other.maximumRowsAdjusted_; solveMode_ = other.solveMode_; numberGoodU_ = other.numberGoodU_; maximumPivots_ = other.maximumPivots_; numberPivots_ = other.numberPivots_; factorElements_ = other.factorElements_; status_ = other.status_; numberSlacks_ = other.numberSlacks_; if (other.pivotRow_) { pivotRow_ = new int [2*maximumRowsAdjusted_+maximumPivots_]; CoinMemcpyN(other.pivotRow_,(2*maximumRowsAdjusted_+numberPivots_),pivotRow_); elements_ = new CoinFactorizationDouble [maximumSpace_]; CoinMemcpyN(other.elements_,(maximumRowsAdjusted_+numberPivots_)*maximumRowsAdjusted_,elements_); workArea_ = new CoinFactorizationDouble [maximumRowsAdjusted_*WORK_MULT]; CoinZeroN(workArea_,maximumRowsAdjusted_*WORK_MULT); } else { elements_ = NULL; pivotRow_ = NULL; workArea_ = NULL; } } // getAreas. Gets space for a factorization //called by constructors void CoinAbcDenseFactorization::getAreas ( int numberOfRows, int /*numberOfColumns*/, CoinBigIndex , CoinBigIndex ) { numberRows_ = numberOfRows; numberDense_=numberRows_; if ((numberRows_&(BLOCKING8-1))!=0) numberDense_ += (BLOCKING8-(numberRows_&(BLOCKING8-1))); CoinBigIndex size = numberDense_*(2*numberDense_+CoinMax(maximumPivots_,(numberDense_+1)>>1)); if (size>maximumSpace_) { delete [] elements_; elements_ = new CoinFactorizationDouble [size]; maximumSpace_ = size; } if (numberRows_>maximumRows_) { maximumRows_ = numberRows_; maximumRowsAdjusted_ = maximumRows_; if ((maximumRows_&(BLOCKING8-1))!=0) maximumRowsAdjusted_ += (BLOCKING8-(maximumRows_&(BLOCKING8-1))); delete [] pivotRow_; delete [] workArea_; pivotRow_ = new int [2*maximumRowsAdjusted_+maximumPivots_]; workArea_ = new CoinFactorizationDouble [maximumRowsAdjusted_*WORK_MULT]; } } // preProcess. void CoinAbcDenseFactorization::preProcess () { CoinBigIndex put = numberDense_*numberDense_; CoinFactorizationDouble * COIN_RESTRICT area = elements_+maximumSpace_-put; CoinAbcMemset0(area,put); int *indexRow = reinterpret_cast (elements_+numberRows_*numberRows_); CoinBigIndex * starts = reinterpret_cast (pivotRow_); CoinFactorizationDouble * COIN_RESTRICT column = area; //if (solveMode_==10) //solveMode_=1; if ((solveMode_%10)!=0) { for (int i=0;i>3; iRow=iRow&(BLOCKING8-1); column[iRow+BLOCKING8X8*iBlock]=elements_[j]; } if ((i&(BLOCKING8-1))!=(BLOCKING8-1)) column += BLOCKING8; else column += numberDense_*BLOCKING8-(BLOCKING8-1)*BLOCKING8; } for (int i=numberRows_;i>3; iRow=iRow&(BLOCKING8-1); column[iRow+BLOCKING8X8*iBlock]=1.0; if ((i&(BLOCKING8-1))!=(BLOCKING8-1)) column += BLOCKING8; //else //column += numberDense_*BLOCKING8-(BLOCKING8-1)*BLOCKING8; } } else { // first or bad for (int i=0;ilargest) { largest=value; iRow=j; } } if (iRow>=0) { if (iRow!=i) { // swap assert (iRow>i); CoinFactorizationDouble * elementsA = area; for (int k=0;k<=i;k++) { // swap CoinFactorizationDouble value = elementsA[i]; elementsA[i]=elementsA[iRow]; elementsA[iRow]=value; elementsA += numberDense_; } int iPivot = pivotRow_[i+numberDense_]; pivotRow_[i+numberDense_]=pivotRow_[iRow+numberDense_]; pivotRow_[iRow+numberDense_]=iPivot; } CoinFactorizationDouble pivotValue = 1.0/elements[i]; elements[i]=pivotValue; for (int j=i+1;j (workArea_); int i; for ( i=0;i=0); for ( i=numberGoodU_;idenseVector ( ); int *regionIndex = regionSparse->getIndices ( ); int numberNonZero = regionSparse->getNumElements ( ); int i; memset(elements,0,numberRows_*sizeof(CoinFactorizationDouble)); CoinFactorizationDouble pivotValue = pivotCheck; if (fabs(pivotValue)packedMode()) { for (i=0;ipackedMode()) { for (i=0;idenseVector ( ); int *regionIndex = tableauColumn->getIndices ( ); int numberNonZero = tableauColumn->getNumElements ( ); int i; memset(elements,0,numberRows_*sizeof(CoinFactorizationDouble)); double pivotValue = 1.0/alpha; if ((solveMode_%10)==0) { if (tableauColumn->packedMode()) { for (i=0;ipackedMode()) { for (i=0;i=0;i--) { int ip=ipiv[i]; if (ip!=i) { double temp=a[i]; a[i]=a[ip]; a[ip]=temp; } } } /* This version has same effect as above with FTUpdate==false so number returned is always >=0 */ int CoinAbcDenseFactorization::updateColumn (CoinIndexedVector & regionSparse) const { double *region = regionSparse.denseVector ( ); CoinBigIndex put = numberDense_*numberDense_; CoinFactorizationDouble * COIN_RESTRICT area = elements_+maximumSpace_-put; CoinFactorizationDouble * COIN_RESTRICT elements = area; if ((solveMode_%10)==0) { // base factorization L for (int i=0;i=0;i--) { elements -= numberDense_; CoinFactorizationDouble value = region[i]*elements[i]; region[i] = value; for (int j=0;j=0;i--) { elements -= numberDense_; int iPivot = pivotRow_[i+2*numberDense_]; CoinFactorizationDouble value = region[iPivot]; //*elements[iPivot]; for (int j=0;j=0;i--) { elements -= numberDense_; CoinFactorizationDouble value = region[i]; for (int j=i+1;j0.0&&value<=1.0) { pivotTolerance_=CoinMax(value,minimumPivotTolerance_); } } void CoinAbcAnyFactorization::minimumPivotTolerance ( double value ) { if (value>0.0&&value<=1.0) { minimumPivotTolerance_=value; } } void CoinAbcAnyFactorization::zeroTolerance ( double value ) { if (value>0.0&&value<1.0) { zeroTolerance_=value; } } void CoinAbcAnyFactorization::maximumPivots ( int value ) { if (value>maximumPivots_) { delete [] pivotRow_; int n=maximumRows_; if ((n&(BLOCKING8-1))!=0) n += (BLOCKING8-(n&(BLOCKING8-1))); pivotRow_ = new int[2*n+value]; } maximumPivots_ = value; } // Number of entries in each row int * CoinAbcAnyFactorization::numberInRow() const { return reinterpret_cast (workArea_);} // Number of entries in each column int * CoinAbcAnyFactorization::numberInColumn() const { return (reinterpret_cast (workArea_))+numberRows_;} // Returns array to put basis starts in CoinBigIndex * CoinAbcAnyFactorization::starts() const { return reinterpret_cast (pivotRow_);} // Returns array to put basis elements in CoinFactorizationDouble * CoinAbcAnyFactorization::elements() const { return elements_;} // Returns pivot row int * CoinAbcAnyFactorization::pivotRow() const { return pivotRow_;} // Returns work area CoinFactorizationDouble * CoinAbcAnyFactorization::workArea() const { return workArea_;} // Returns int work area int * CoinAbcAnyFactorization::intWorkArea() const { return reinterpret_cast (workArea_);} // Returns permute back int * CoinAbcAnyFactorization::permuteBack() const { return pivotRow_+numberRows_;} // Returns pivot column int * CoinAbcAnyFactorization::pivotColumn() const { return permute();} // Returns true if wants tableauColumn in replaceColumn bool CoinAbcAnyFactorization::wantsTableauColumn() const { return true;} /* Useful information for factorization 0 - iteration number whereFrom is 0 for factorize and 1 for replaceColumn */ void CoinAbcAnyFactorization::setUsefulInformation(const int * ,int ) { } CoinMP-1.8.3/Clp/src/CoinAbcDenseFactorization.hpp0000644000175000017500000004446012101105055020342 0ustar renerene/* $Id: CoinAbcDenseFactorization.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef CoinAbcDenseFactorization_H #define CoinAbcDenseFactorization_H #include #include #include #include "CoinTypes.hpp" #include "CoinAbcCommon.hpp" #include "CoinIndexedVector.hpp" class CoinPackedMatrix; /// Abstract base class which also has some scalars so can be used from Dense or Simp class CoinAbcAnyFactorization { public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor CoinAbcAnyFactorization ( ); /// Copy constructor CoinAbcAnyFactorization ( const CoinAbcAnyFactorization &other); /// Destructor virtual ~CoinAbcAnyFactorization ( ); /// = copy CoinAbcAnyFactorization & operator = ( const CoinAbcAnyFactorization & other ); /// Clone virtual CoinAbcAnyFactorization * clone() const = 0; //@} /**@name general stuff such as status */ //@{ /// Returns status inline int status ( ) const { return status_; } /// Sets status inline void setStatus ( int value) { status_=value; } /// Returns number of pivots since factorization inline int pivots ( ) const { return numberPivots_; } #if ABC_PARALLEL==2 /// Says parallel inline void setParallelMode(int value) {parallelMode_=value;}; #endif /// Sets number of pivots since factorization inline void setPivots ( int value ) { numberPivots_=value; } /// Returns number of slacks inline int numberSlacks ( ) const { return numberSlacks_; } /// Sets number of slacks inline void setNumberSlacks ( int value ) { numberSlacks_=value; } /// Set number of Rows after factorization inline void setNumberRows(int value) { numberRows_ = value; } /// Number of Rows after factorization inline int numberRows ( ) const { return numberRows_; } /// Number of dense rows after factorization inline CoinSimplexInt numberDense ( ) const { return numberDense_; } /// Number of good columns in factorization inline int numberGoodColumns ( ) const { return numberGoodU_; } /// Allows change of pivot accuracy check 1.0 == none >1.0 relaxed inline void relaxAccuracyCheck(double value) { relaxCheck_ = value;} inline double getAccuracyCheck() const { return relaxCheck_;} /// Maximum number of pivots between factorizations inline int maximumPivots ( ) const { return maximumPivots_ ; } /// Set maximum pivots virtual void maximumPivots ( int value ); /// Pivot tolerance inline double pivotTolerance ( ) const { return pivotTolerance_ ; } void pivotTolerance ( double value ); /// Minimum pivot tolerance inline double minimumPivotTolerance ( ) const { return minimumPivotTolerance_ ; } void minimumPivotTolerance ( double value ); virtual CoinFactorizationDouble * pivotRegion() const { return NULL;} /// Area factor inline double areaFactor ( ) const { return areaFactor_ ; } inline void areaFactor ( CoinSimplexDouble value ) { areaFactor_=value; } /// Zero tolerance inline double zeroTolerance ( ) const { return zeroTolerance_ ; } void zeroTolerance ( double value ); /// Returns array to put basis elements in virtual CoinFactorizationDouble * elements() const; /// Returns pivot row virtual int * pivotRow() const; /// Returns work area virtual CoinFactorizationDouble * workArea() const; /// Returns int work area virtual int * intWorkArea() const; /// Number of entries in each row virtual int * numberInRow() const; /// Number of entries in each column virtual int * numberInColumn() const; /// Returns array to put basis starts in virtual CoinBigIndex * starts() const; /// Returns permute back virtual int * permuteBack() const; /// Sees whether to go sparse virtual void goSparse() {} #ifndef NDEBUG virtual inline void checkMarkArrays() const {} #endif /** Get solve mode e.g. 0 C++ code, 1 Lapack, 2 choose If 4 set then values pass if 8 set then has iterated */ inline int solveMode() const { return solveMode_ ;} /** Set solve mode e.g. 0 C++ code, 1 Lapack, 2 choose If 4 set then values pass if 8 set then has iterated */ inline void setSolveMode(int value) { solveMode_ = value;} /// Returns true if wants tableauColumn in replaceColumn virtual bool wantsTableauColumn() const; /** Useful information for factorization 0 - iteration number whereFrom is 0 for factorize and 1 for replaceColumn */ virtual void setUsefulInformation(const int * info,int whereFrom); /// Get rid of all memory virtual void clearArrays() {} //@} /**@name virtual general stuff such as permutation */ //@{ /// Returns array to put basis indices in virtual int * indices() const = 0; /// Returns permute in virtual int * permute() const = 0; /// Returns pivotColumn or permute virtual int * pivotColumn() const; /// Total number of elements in factorization virtual int numberElements ( ) const = 0; //@} /**@name Do factorization - public */ //@{ /// Gets space for a factorization virtual void getAreas ( int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ) = 0; /// PreProcesses column ordered copy of basis virtual void preProcess ( ) = 0; /** Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use numberGoodColumns and redo */ virtual int factor (AbcSimplex * model) = 0; #ifdef EARLY_FACTORIZE /// Returns -2 if can't, -1 if singular, -99 memory, 0 OK virtual int factorize (AbcSimplex * /*model*/, CoinIndexedVector & /*stuff*/) { return -2;} #endif /// Does post processing on valid factorization - putting variables on correct rows virtual void postProcess(const int * sequence, int * pivotVariable) = 0; /// Makes a non-singular basis by replacing variables virtual void makeNonSingular(int * sequence) = 0; //@} /**@name rank one updates which do exist */ //@{ #if 0 /** Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots Fills in region for use later partial update already in U */ virtual int checkReplace ( CoinIndexedVector * /*regionSparse*/, int /*pivotRow*/, double & /*pivotCheck*/, double /*acceptablePivot = 1.0e-8*/) {return 0;} /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If skipBtranU is false will do btran part partial update already in U */ virtual int replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow, double pivotCheck , bool skipBtranU=false, double acceptablePivot=1.0e-8)=0; #endif #ifdef EARLY_FACTORIZE /// 0 success, -1 can't +1 accuracy problems virtual int replaceColumns ( const AbcSimplex * /*model*/, CoinIndexedVector & /*stuff*/, int /*firstPivot*/,int /*lastPivot*/,bool /*cleanUp*/) { return -1;} #endif #ifdef ABC_LONG_FACTORIZATION /// Clear all hidden arrays virtual void clearHiddenArrays() {} #endif /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update already in U */ virtual #ifdef ABC_LONG_FACTORIZATION long #endif double checkReplacePart1 ( CoinIndexedVector * /*regionSparse*/, int /*pivotRow*/) {return 0.0;} virtual #ifdef ABC_LONG_FACTORIZATION long #endif double checkReplacePart1 ( CoinIndexedVector * /*regionSparse*/, CoinIndexedVector * /*partialUpdate*/, int /*pivotRow*/) {return 0.0;} virtual void checkReplacePart1a ( CoinIndexedVector * /* regionSparse */, int /*pivotRow*/) {} virtual double checkReplacePart1b (CoinIndexedVector * /*regionSparse*/, int /*pivotRow*/) {return 0.0;} /** Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */ virtual int checkReplacePart2 ( int pivotRow, double btranAlpha, double ftranAlpha, #ifdef ABC_LONG_FACTORIZATION long #endif double ftAlpha, double acceptablePivot = 1.0e-8) = 0; /** Replaces one Column to basis, partial update already in U */ virtual void replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ) = 0; /** Replaces one Column to basis, partial update in vector */ virtual void replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, CoinIndexedVector * partialUpdate, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha )=0; //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from unpacked regionSparse Tries to do FT update number returned is negative if no room */ virtual int updateColumnFT ( CoinIndexedVector & regionSparse) = 0; virtual int updateColumnFTPart1 ( CoinIndexedVector & regionSparse) = 0; virtual void updateColumnFTPart2 ( CoinIndexedVector & regionSparse) = 0; virtual void updateColumnFT ( CoinIndexedVector & regionSparseFT, CoinIndexedVector & partialUpdate, int which)=0; /** This version has same effect as above with FTUpdate==false so number returned is always >=0 */ virtual int updateColumn ( CoinIndexedVector & regionSparse) const = 0; /// does FTRAN on two unpacked columns virtual int updateTwoColumnsFT(CoinIndexedVector & regionFT, CoinIndexedVector & regionOther) = 0; /** Updates one column (BTRAN) from unpacked regionSparse */ virtual int updateColumnTranspose ( CoinIndexedVector & regionSparse) const = 0; /** This version does FTRAN on array when indices not set up */ virtual void updateFullColumn ( CoinIndexedVector & regionSparse) const = 0; /** Updates one column (BTRAN) from unpacked regionSparse */ virtual void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const = 0; /** Updates one column for dual steepest edge weights (FTRAN) */ virtual void updateWeights ( CoinIndexedVector & regionSparse) const=0; /** Updates one column (FTRAN) */ virtual void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const; /** Updates one column (BTRAN) */ virtual void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const; //@} ////////////////// data ////////////////// protected: /**@name data */ //@{ /// Pivot tolerance double pivotTolerance_; /// Minimum pivot tolerance double minimumPivotTolerance_; /// Area factor double areaFactor_; /// Zero tolerance double zeroTolerance_; //#ifndef slackValue_ #define slackValue2_ 1.0 //#endif /// Relax check on accuracy in replaceColumn double relaxCheck_; /// Number of elements after factorization CoinBigIndex factorElements_; /// Number of Rows in factorization int numberRows_; /// Number of dense rows in factorization int numberDense_; /// Number factorized in U (not row singletons) int numberGoodU_; /// Maximum number of pivots before factorization int maximumPivots_; /// Number pivots since last factorization int numberPivots_; /// Number slacks int numberSlacks_; /// Status of factorization int status_; /// Maximum rows ever (i.e. use to copy arrays etc) int maximumRows_; #if ABC_PARALLEL==2 int parallelMode_; #endif /// Pivot row int * pivotRow_; /** Elements of factorization and updates length is maxR*maxR+maxSpace will always be long enough so can have nR*nR ints in maxSpace */ CoinFactorizationDouble * elements_; /// Work area of numberRows_ CoinFactorizationDouble * workArea_; /** Solve mode e.g. 0 C++ code, 1 Lapack, 2 choose If 4 set then values pass if 8 set then has iterated */ int solveMode_; //@} }; /** This deals with Factorization and Updates This is a simple dense version so other people can write a better one I am assuming that 32 bits is enough for number of rows or columns, but CoinBigIndex may be redefined to get 64 bits. */ class CoinAbcDenseFactorization : public CoinAbcAnyFactorization { friend void CoinAbcDenseFactorizationUnitTest( const std::string & mpsDir ); public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor CoinAbcDenseFactorization ( ); /// Copy constructor CoinAbcDenseFactorization ( const CoinAbcDenseFactorization &other); /// Destructor virtual ~CoinAbcDenseFactorization ( ); /// = copy CoinAbcDenseFactorization & operator = ( const CoinAbcDenseFactorization & other ); /// Clone virtual CoinAbcAnyFactorization * clone() const ; //@} /**@name Do factorization - public */ //@{ /// Gets space for a factorization virtual void getAreas ( int numberRows, int numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ); /// PreProcesses column ordered copy of basis virtual void preProcess ( ); /** Does most of factorization returning status 0 - OK -99 - needs more memory -1 - singular - use numberGoodColumns and redo */ virtual int factor (AbcSimplex * model); /// Does post processing on valid factorization - putting variables on correct rows virtual void postProcess(const int * sequence, int * pivotVariable); /// Makes a non-singular basis by replacing variables virtual void makeNonSingular(int * sequence); //@} /**@name general stuff such as number of elements */ //@{ /// Total number of elements in factorization virtual inline int numberElements ( ) const { return numberRows_*(numberRows_+numberPivots_); } /// Returns maximum absolute value in factorization double maximumCoefficient() const; //@} /**@name rank one updates which do exist */ //@{ /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If skipBtranU is false will do btran part partial update already in U */ virtual int replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow, double pivotCheck , bool skipBtranU=false, double acceptablePivot=1.0e-8); /** Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */ virtual int checkReplacePart2 ( int pivotRow, double btranAlpha, double ftranAlpha, #ifdef ABC_LONG_FACTORIZATION long #endif double ftAlpha, double acceptablePivot = 1.0e-8) ; /** Replaces one Column to basis, partial update already in U */ virtual void replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ); /** Replaces one Column to basis, partial update in vector */ virtual void replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, CoinIndexedVector * /*partialUpdate*/, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ) { replaceColumnPart3(model,regionSparse,tableauColumn,pivotRow,alpha);} //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from unpacked regionSparse Tries to do FT update number returned is negative if no room */ virtual int updateColumnFT ( CoinIndexedVector & regionSparse) {return updateColumn(regionSparse);} virtual int updateColumnFTPart1 ( CoinIndexedVector & regionSparse) {return updateColumn(regionSparse);} virtual void updateColumnFTPart2 ( CoinIndexedVector & /*regionSparse*/) {} virtual void updateColumnFT ( CoinIndexedVector & regionSparseFT,CoinIndexedVector & /*partialUpdate*/,int /*which*/) { updateColumnFT(regionSparseFT);} /** This version has same effect as above with FTUpdate==false so number returned is always >=0 */ virtual int updateColumn ( CoinIndexedVector & regionSparse) const; /// does FTRAN on two unpacked columns virtual int updateTwoColumnsFT(CoinIndexedVector & regionFT, CoinIndexedVector & regionOther); /** Updates one column (BTRAN) from unpacked regionSparse */ virtual int updateColumnTranspose ( CoinIndexedVector & regionSparse) const; /** This version does FTRAN on array when indices not set up */ virtual void updateFullColumn ( CoinIndexedVector & regionSparse) const {updateColumn(regionSparse);} /** Updates one column (BTRAN) from unpacked regionSparse */ virtual void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const {updateColumnTranspose(regionSparse);} /** Updates one column for dual steepest edge weights (FTRAN) */ virtual void updateWeights ( CoinIndexedVector & regionSparse) const; //@} /// *** Below this user may not want to know about /**@name various uses of factorization which user may not want to know about (left over from my LP code) */ //@{ /// Get rid of all memory inline void clearArrays() { gutsOfDestructor();} /// Returns array to put basis indices in virtual inline int * indices() const { return reinterpret_cast (elements_+numberRows_*numberRows_);} /// Returns permute in virtual inline int * permute() const { return NULL;/*pivotRow_*/;} //@} /// The real work of desstructor void gutsOfDestructor(); /// The real work of constructor void gutsOfInitialize(); /// The real work of copy void gutsOfCopy(const CoinAbcDenseFactorization &other); //@} protected: /** Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular */ int checkPivot(double saveFromU, double oldPivot) const; ////////////////// data ////////////////// protected: /// Maximum length of iterating area CoinBigIndex maximumSpace_; /// Use for array size to get multiple of 8 CoinSimplexInt maximumRowsAdjusted_; /**@name data */ //@{ //@} }; #endif CoinMP-1.8.3/Clp/src/CoinAbcOrderedFactorization2.cpp0000644000175000017500000000107712101105055020742 0ustar renerene/* $Id: CoinAbcOrderedFactorization2.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcOrderedFactorization #define ABC_SMALL -2 #define ABC_ORDERED_FACTORIZATION #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization2.cpp" #endif CoinMP-1.8.3/Clp/src/AbcSimplexPrimal.cpp0000644000175000017500000043176312573000245016535 0ustar renerene/* $Id: AbcSimplexPrimal.cpp 2165 2015-09-06 09:00:21Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Notes on implementation of primal simplex algorithm. When primal feasible(A): If dual feasible, we are optimal. Otherwise choose an infeasible basic variable to enter basis from a bound (B). We now need to find an outgoing variable which will leave problem primal feasible so we get the column of the tableau corresponding to the incoming variable (with the correct sign depending if variable will go up or down). We now perform a ratio test to determine which outgoing variable will preserve primal feasibility (C). If no variable found then problem is unbounded (in primal sense). If there is a variable, we then perform pivot and repeat. Trivial? ------------------------------------------- A) How do we get primal feasible? All variables have fake costs outside their feasible region so it is trivial to declare problem feasible. OSL did not have a phase 1/phase 2 approach but instead effectively put an extra cost on infeasible basic variables I am taking the same approach here, although it is generalized to allow for non-linear costs and dual information. In OSL, this weight was changed heuristically, here at present it is only increased if problem looks finished. If problem is feasible I check for unboundedness. If not unbounded we could play with going into dual. As long as weights increase any algorithm would be finite. B) Which incoming variable to choose is a virtual base class. For difficult problems steepest edge is preferred while for very easy (large) problems we will need partial scan. C) Sounds easy, but this is hardest part of algorithm. 1) Instead of stopping at first choice, we may be able to allow that variable to go through bound and if objective still improving choose again. These mini iterations can increase speed by orders of magnitude but we may need to go to more of a bucket choice of variable rather than looking at them one by one (for speed). 2) Accuracy. Basic infeasibilities may be less than tolerance. Pivoting on these makes objective go backwards. OSL modified cost so a zero move was made, Gill et al modified so a strictly positive move was made. The two problems are that re-factorizations can change rinfeasibilities above and below tolerances and that when finished we need to reset costs and try again. 3) Degeneracy. Gill et al helps but may not be enough. We may need more. Also it can improve speed a lot if we perturb the rhs and bounds significantly. References: Forrest and Goldfarb, Steepest-edge simplex algorithms for linear programming - Mathematical Programming 1992 Forrest and Tomlin, Implementing the simplex method for the Optimization Subroutine Library - IBM Systems Journal 1992 Gill, Murray, Saunders, Wright A Practical Anti-Cycling Procedure for Linear and Nonlinear Programming SOL report 1988 TODO: a) Better recovery procedures. At present I never check on forward progress. There is checkpoint/restart with reducing re-factorization frequency, but this is only on singular factorizations. b) Fast methods for large easy problems (and also the option for the code to automatically choose which method). c) We need to be able to stop in various ways for OSI - this is fairly easy. */ #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #include "AbcSimplexPrimal.hpp" #include "AbcSimplexFactorization.hpp" #include "AbcNonLinearCost.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "AbcPrimalColumnPivot.hpp" #include "ClpMessage.hpp" #include "ClpEventHandler.hpp" #include #include #include #include #include #ifdef CLP_USER_DRIVEN1 /* Returns true if variable sequenceOut can leave basis when model->sequenceIn() enters. This function may be entered several times for each sequenceOut. The first time realAlpha will be positive if going to lower bound and negative if going to upper bound (scaled bounds in lower,upper) - then will be zero. currentValue is distance to bound. currentTheta is current theta. alpha is fabs(pivot element). Variable will change theta if currentValue - currentTheta*alpha < 0.0 */ bool userChoiceValid1(const AbcSimplex * model, int sequenceOut, double currentValue, double currentTheta, double alpha, double realAlpha); /* This returns true if chosen in/out pair valid. The main thing to check would be variable flipping bounds may be OK. This would be signaled by reasonable theta_ and valueOut_. If you return false sequenceIn_ will be flagged as ineligible. */ bool userChoiceValid2(const AbcSimplex * model); /* If a good pivot then you may wish to unflag some variables. */ void userChoiceWasGood(AbcSimplex * model); #endif #ifdef TRY_SPLIT_VALUES_PASS static double valuesChunk=-10.0; static double valuesRatio=0.1; static int valuesStop=-1; static int keepValuesPass=-1; static int doOrdinaryVariables=-1; #endif // primal int AbcSimplexPrimal::primal (int ifValuesPass , int /*startFinishOptions*/) { /* Method It tries to be a single phase approach with a weight of 1.0 being given to getting optimal and a weight of infeasibilityCost_ being given to getting primal feasible. In this version I have tried to be clever in a stupid way. The idea of fake bounds in dual seems to work so the primal analogue would be that of getting bounds on reduced costs (by a presolve approach) and using these for being above or below feasible region. I decided to waste memory and keep these explicitly. This allows for non-linear costs! The code is designed to take advantage of sparsity so arrays are seldom zeroed out from scratch or gone over in their entirety. The only exception is a full scan to find incoming variable for Dantzig row choice. For steepest edge we keep an updated list of dual infeasibilities (actually squares). On easy problems we don't need full scan - just pick first reasonable. One problem is how to tackle degeneracy and accuracy. At present I am using the modification of costs which I put in OSL and which was extended by Gill et al. I am still not sure of the exact details. The flow of primal is three while loops as follows: while (not finished) { while (not clean solution) { Factorize and/or clean up solution by changing bounds so primal feasible. If looks finished check fake primal bounds. Repeat until status is iterating (-1) or finished (0,1,2) } while (status==-1) { Iterate until no pivot in or out or time to re-factorize. Flow is: choose pivot column (incoming variable). if none then we are primal feasible so looks as if done but we need to break and check bounds etc. Get pivot column in tableau Choose outgoing row. If we don't find one then we look primal unbounded so break and check bounds etc. (Also the pivot tolerance is larger after any iterations so that may be reason) If we do find outgoing row, we may have to adjust costs to keep going forwards (anti-degeneracy). Check pivot will be stable and if unstable throw away iteration and break to re-factorize. If minor error re-factorize after iteration. Update everything (this may involve changing bounds on variables to stay primal feasible. } } At present we never check we are going forwards. I overdid that in OSL so will try and make a last resort. Needs partial scan pivot in option. May need other anti-degeneracy measures, especially if we try and use loose tolerances as a way to solve in fewer iterations. I like idea of dynamic scaling. This gives opportunity to decouple different implications of scaling for accuracy, iteration count and feasibility tolerance. */ algorithm_ = +1; moreSpecialOptions_ &= ~16; // clear check replaceColumn accuracy #if ABC_PARALLEL>0 if (parallelMode()) { // extra regions // for moment allow for ordered factorization int length=2*numberRows_+abcFactorization_->maximumPivots(); for (int i = 0; i < 6; i++) { delete rowArray_[i]; rowArray_[i] = new CoinIndexedVector(); rowArray_[i]->reserve(length); delete columnArray_[i]; columnArray_[i] = new CoinIndexedVector(); columnArray_[i]->reserve(length); } } #endif // save data ClpDataSave data = saveData(); dualTolerance_ = dblParam_[ClpDualTolerance]; primalTolerance_ = dblParam_[ClpPrimalTolerance]; currentDualTolerance_=dualTolerance_; //nextCleanNonBasicIteration_=baseIteration_+numberRows_; // Save so can see if doing after dual int initialStatus = problemStatus_; int initialIterations = numberIterations_; int initialNegDjs = -1; // copy bounds to perturbation CoinAbcMemcpy(abcPerturbation_,abcLower_,numberTotal_); CoinAbcMemcpy(abcPerturbation_+numberTotal_,abcUpper_,numberTotal_); #if 0 if (numberRows_>80000&&numberRows_<90000) { FILE * fp = fopen("save.stuff", "rb"); if (fp) { fread(internalStatus_,sizeof(char),numberTotal_,fp); fread(abcSolution_,sizeof(double),numberTotal_,fp); } else { printf("can't open save.stuff\n"); abort(); } fclose(fp); } #endif // initialize - maybe values pass and algorithm_ is +1 /// Initial coding here if (nonLinearCost_ == NULL && algorithm_ > 0) { // get a valid nonlinear cost function abcNonLinearCost_ = new AbcNonLinearCost(this); } statusOfProblemInPrimal(0); /*if (!startup(ifValuesPass))*/ { // Set average theta abcNonLinearCost_->setAverageTheta(1.0e3); // Say no pivot has occurred (for steepest edge and updates) pivotRow_ = -2; // This says whether to restore things etc int factorType = 0; if (problemStatus_ < 0 && perturbation_ < 100 && !ifValuesPass) { perturb(0); if (perturbation_!=100) { // Can't get here if values pass assert (!ifValuesPass); gutsOfPrimalSolution(3); if (handler_->logLevel() > 2) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } } } // Start check for cycles abcProgress_.fillFromModel(this); abcProgress_.startCheck(); bool needNewWeights=false; double pivotTolerance=abcFactorization_->pivotTolerance(); /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible -5 - looks unbounded */ while (problemStatus_ < 0) { // clear all arrays clearArrays(-1); // If getting nowhere - why not give it a kick #if 1 if (perturbation_ < 101 && numberIterations_ ==6078/*> 2 * (numberRows_ + numberColumns_)*/ && (specialOptions_ & 4) == 0 && initialStatus != 10) { perturb(1); } #endif // If we have done no iterations - special if (lastGoodIteration_ == numberIterations_ && factorType) factorType = 3; if(pivotTolerancepivotTolerance()) { // force factorization pivotTolerance = abcFactorization_->pivotTolerance(); factorType=5; } // may factorize, checks if problem finished if (factorType) statusOfProblemInPrimal(factorType + (needNewWeights ? 10 : 0)); needNewWeights=false; if (problemStatus_==10 && (moreSpecialOptions_ & 2048) != 0) { problemStatus_=0; } if (initialStatus == 10) { initialStatus=-1; // cleanup phase if(initialIterations != numberIterations_) { if (numberDualInfeasibilities_ > 10000 && numberDualInfeasibilities_ > 10 * initialNegDjs) { // getting worse - try perturbing if (perturbation_ < 101 && (specialOptions_ & 4) == 0) { perturb(1); statusOfProblemInPrimal(factorType); } } } else { // save number of negative djs if (!numberPrimalInfeasibilities_) initialNegDjs = numberDualInfeasibilities_; // make sure weight won't be changed if (infeasibilityCost_ == 1.0e10) infeasibilityCost_ = 1.000001e10; } } // Say good factorization factorType = 1; // Say no pivot has occurred (for steepest edge and updates) pivotRow_ = -2; // exit if victory declared if (problemStatus_ >= 0) { #ifdef CLP_USER_DRIVEN int status = eventHandler_->event(ClpEventHandler::endInPrimal); if (status>=0&&status<10) { // carry on problemStatus_=-1; if (status==0) continue; // re-factorize } else if (status>=10) { problemStatus_=status-10; break; } else { break; } #else break; #endif } // test for maximum iterations if (hitMaximumIterations() || (ifValuesPass == 2 && firstFree_ < 0)) { problemStatus_ = 3; break; } if (firstFree_ < 0) { if (ifValuesPass) { // end of values pass ifValuesPass = 0; needNewWeights=true; int status = eventHandler_->event(ClpEventHandler::endOfValuesPass); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfValuesPass; break; } //#define FEB_TRY #if 1 //def FEB_TRY if (perturbation_ < 100 #ifdef TRY_SPLIT_VALUES_PASS &&valuesStop<0 #endif ) perturb(0); #endif } } if (abcNonLinearCost_->numberInfeasibilities() > 0 && !abcProgress_.initialWeight_ && !ifValuesPass && infeasibilityCost_ == 1.0e10 #ifdef TRY_SPLIT_VALUES_PASS && valuesStop<0 #endif ) { // first time infeasible - start up weight computation // compute with original costs CoinAbcMemcpy(djSaved_,abcDj_,numberTotal_); CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_); CoinAbcGatherFrom(abcCost_,costBasic_,abcPivotVariable_,numberRows_); gutsOfPrimalSolution(1); int numberSame = 0; int numberDifferent = 0; int numberZero = 0; int numberFreeSame = 0; int numberFreeDifferent = 0; int numberFreeZero = 0; int n = 0; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if (getInternalStatus(iSequence) != basic && !flagged(iSequence)) { // not basic double distanceUp = abcUpper_[iSequence] - abcSolution_[iSequence]; double distanceDown = abcSolution_[iSequence] - abcLower_[iSequence]; double feasibleDj = abcDj_[iSequence]; double infeasibleDj = djSaved_[iSequence] - feasibleDj; double value = feasibleDj * infeasibleDj; if (distanceUp > primalTolerance_) { // Check if "free" if (distanceDown > primalTolerance_) { // free if (value > dualTolerance_) { numberFreeSame++; } else if(value < -dualTolerance_) { numberFreeDifferent++; abcDj_[n++] = feasibleDj / infeasibleDj; } else { numberFreeZero++; } } else { // should not be negative if (value > dualTolerance_) { numberSame++; } else if(value < -dualTolerance_) { numberDifferent++; abcDj_[n++] = feasibleDj / infeasibleDj; } else { numberZero++; } } } else if (distanceDown > primalTolerance_) { // should not be positive if (value > dualTolerance_) { numberSame++; } else if(value < -dualTolerance_) { numberDifferent++; abcDj_[n++] = feasibleDj / infeasibleDj; } else { numberZero++; } } } abcProgress_.initialWeight_ = -1.0; } #ifdef CLP_USEFUL_PRINTOUT printf("XXXX %d same, %d different, %d zero, -- free %d %d %d\n", numberSame,numberDifferent,numberZero, numberFreeSame,numberFreeDifferent,numberFreeZero); #endif // we want most to be same if (n) { std::sort(abcDj_, abcDj_ + n); #ifdef CLP_USEFUL_PRINTOUT double most = 0.95; int which = static_cast ((1.0 - most) * static_cast (n)); double take2 = -abcDj_[which] * infeasibilityCost_; printf("XXXX inf cost %g take %g (range %g %g)\n",infeasibilityCost_,take2,-abcDj_[0]*infeasibilityCost_,-abcDj_[n-1]*infeasibilityCost_); #endif double take = -abcDj_[0] * infeasibilityCost_; // was infeasibilityCost_ = CoinMin(CoinMax(1000.0 * take, 1.0e8), 1.0000001e10); infeasibilityCost_ = CoinMin(CoinMax(1000.0 * take, 1.0e3), 1.0000001e10); #ifdef CLP_USEFUL_PRINTOUT printf("XXXX changing weight to %g\n",infeasibilityCost_); #endif // may need to force redo of weights needNewWeights=true; } abcNonLinearCost_->checkInfeasibilities(0.0); gutsOfPrimalSolution(3); } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfFactorization); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } } // Iterate whileIterating(ifValuesPass ? 1 : 0); } } // if infeasible get real values //printf("XXXXY final cost %g\n",infeasibilityCost_); abcProgress_.initialWeight_ = 0.0; if (problemStatus_ == 1 && secondaryStatus_ != 6) { infeasibilityCost_ = 0.0; copyFromSaved(); delete abcNonLinearCost_; abcNonLinearCost_ = new AbcNonLinearCost(this); abcNonLinearCost_->checkInfeasibilities(0.0); sumPrimalInfeasibilities_ = abcNonLinearCost_->sumInfeasibilities(); numberPrimalInfeasibilities_ = abcNonLinearCost_->numberInfeasibilities(); // and get good feasible duals gutsOfPrimalSolution(1); } // clean up unflag(); abcProgress_.clearTimesFlagged(); #if ABC_PARALLEL>0 if (parallelMode()) { for (int i = 0; i < 6; i++) { delete rowArray_[i]; rowArray_[i] = NULL; delete columnArray_[i]; columnArray_[i] = NULL; } } #endif //finish(startFinishOptions); restoreData(data); setObjectiveValue(abcNonLinearCost_->feasibleReportCost()+objectiveOffset_); // clean up if (problemStatus_==10) abcNonLinearCost_->checkInfeasibilities(0.0); delete abcNonLinearCost_; abcNonLinearCost_=NULL; #if 0 if (numberRows_>80000&&numberRows_<90000) { FILE * fp = fopen("save.stuff", "wb"); if (fp) { fwrite(internalStatus_,sizeof(char),numberTotal_,fp); fwrite(abcSolution_,sizeof(double),numberTotal_,fp); } else { printf("can't open save.stuff\n"); abort(); } fclose(fp); } #endif return problemStatus_; } /* Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) -4 end of values pass and done iterations +0 looks optimal (might be infeasible - but we will investigate) +2 looks unbounded +3 max iterations */ int AbcSimplexPrimal::whileIterating(int valuesOption) { #if 1 #define DELAYED_UPDATE arrayForBtran_=0; //setUsedArray(arrayForBtran_); arrayForFtran_=1; setUsedArray(arrayForFtran_); arrayForFlipBounds_=2; setUsedArray(arrayForFlipBounds_); arrayForTableauRow_=3; setUsedArray(arrayForTableauRow_); //arrayForDualColumn_=4; //setUsedArray(arrayForDualColumn_); #if ABC_PARALLEL<2 arrayForReplaceColumn_=4; //4; #else arrayForReplaceColumn_=6; //4; setUsedArray(arrayForReplaceColumn_); #endif //arrayForFlipRhs_=5; //setUsedArray(arrayForFlipRhs_); #endif // Say if values pass int ifValuesPass = (firstFree_ >= 0) ? 1 : 0; int returnCode = -1; int superBasicType = 1; if (valuesOption > 1) superBasicType = 3; int numberStartingInfeasibilities=abcNonLinearCost_->numberInfeasibilities(); // status stays at -1 while iterating, >=0 finished, -2 to invert // status -3 to go to top without an invert int numberFlaggedStart =abcProgress_.timesFlagged(); while (problemStatus_ == -1) { if (!ifValuesPass) { // choose column to come in // can use pivotRow_ to update weights // pass in list of cost changes so can do row updates (rowArray_[1]) // NOTE rowArray_[0] is used by computeDuals which is a // slow way of getting duals but might be used int saveSequence=sequenceIn_; primalColumn(&usefulArray_[arrayForFtran_], &usefulArray_[arrayForTableauRow_], &usefulArray_[arrayForFlipBounds_]); if (saveSequence>=0&&saveSequence!=sequenceOut_) { if (getInternalStatus(saveSequence)==basic) abcDj_[saveSequence]=0.0; } #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel()==63) { for (int i=0;i1.0e2) assert (getInternalStatus(i)!=basic); } double largestCost=0.0; double largestDj=0.0; double largestGoodDj=0.0; int iLargest=-1; int numberInfeasibilities=0; double sum=0.0; for (int i=0;iabcUpper_[i]+primalTolerance_) { numberInfeasibilities++; sum += abcSolution_[i]-abcUpper_[i]-primalTolerance_; } else if (abcSolution_[i]=numberRows_) { xx='C'; kLargest=iLargest-numberRows_; } else { xx='R'; kLargest=iLargest; } printf("largest cost %g, largest dj %g best %g (%d==%c%d) - %d infeasible (sum %g) nonlininf %d\n", largestCost,largestDj,largestGoodDj,iLargest,xx,kLargest,numberInfeasibilities,sum, abcNonLinearCost_->numberInfeasibilities()); assert (getInternalStatus(iLargest)!=basic); } #endif } else { // in values pass for (int i=0;i<4;i++) multipleSequenceIn_[i]=-1; int sequenceIn = nextSuperBasic(superBasicType, &usefulArray_[arrayForFlipBounds_]); if (valuesOption > 1) superBasicType = 2; if (sequenceIn < 0) { // end of values pass - initialize weights etc sequenceIn_=-1; handler_->message(CLP_END_VALUES_PASS, messages_) << numberIterations_; stateOfProblem_ &= ~VALUES_PASS; #ifdef TRY_SPLIT_VALUES_PASS valuesStop=numberIterations_+doOrdinaryVariables; #endif abcPrimalColumnPivot_->saveWeights(this, 5); problemStatus_ = -2; // factorize now pivotRow_ = -1; // say no weights update returnCode = -4; // Clean up for (int i = 0; i < numberTotal_; i++) { if (getInternalStatus(i) == atLowerBound || getInternalStatus(i) == isFixed) abcSolution_[i] = abcLower_[i]; else if (getInternalStatus(i) == atUpperBound) abcSolution_[i] = abcUpper_[i]; } break; } else { // normal sequenceIn_ = sequenceIn; valueIn_ = abcSolution_[sequenceIn_]; lowerIn_ = abcLower_[sequenceIn_]; upperIn_ = abcUpper_[sequenceIn_]; dualIn_ = abcDj_[sequenceIn_]; // see if any more if (maximumIterations()==100000) { multipleSequenceIn_[0]=sequenceIn; for (int i=1;i<4;i++) { int sequenceIn = nextSuperBasic(superBasicType, &usefulArray_[arrayForFlipBounds_]); if (sequenceIn>=0) multipleSequenceIn_[i]=sequenceIn; else break; } } } } pivotRow_ = -1; sequenceOut_ = -1; usefulArray_[arrayForFtran_].clear(); if (sequenceIn_ >= 0) { // we found a pivot column assert (!flagged(sequenceIn_)); //#define MULTIPLE_PRICE // do second half of iteration if (multipleSequenceIn_[1]==-1||maximumIterations()!=100000) { returnCode = pivotResult(ifValuesPass); } else { if (multipleSequenceIn_[0]<0) multipleSequenceIn_[0]=sequenceIn_; returnCode = pivotResult4(ifValuesPass); #ifdef MULTIPLE_PRICE if (sequenceIn_>=0) returnCode = pivotResult(ifValuesPass); #endif } if(numberStartingInfeasibilities&&!abcNonLinearCost_->numberInfeasibilities()) { //if (abcFactorization_->pivots()>200&&numberIterations_>2*(numberRows_+numberColumns_)) if (abcFactorization_->pivots()>2&&numberIterations_>(numberRows_+numberColumns_)&&(stateOfProblem_&PESSIMISTIC)!=0) returnCode=-2; // refactorize - maybe just after n iterations } if (returnCode < -1 && returnCode > -5) { problemStatus_ = -2; // } else if (returnCode == -5) { if (abcProgress_.timesFlagged()>10+numberFlaggedStart) problemStatus_ =-2; if ((moreSpecialOptions_ & 16) == 0 && abcFactorization_->pivots()) { moreSpecialOptions_ |= 16; problemStatus_ = -2; } // otherwise something flagged - continue; } else if (returnCode == 2) { problemStatus_ = -5; // looks unbounded } else if (returnCode == 4) { problemStatus_ = -2; // looks unbounded but has iterated } else if (returnCode != -1) { assert(returnCode == 3); if (problemStatus_ != 5) problemStatus_ = 3; } } else { // no pivot column #if ABC_NORMAL_DEBUG>3 if (handler_->logLevel() & 32) printf("** no column pivot\n"); #endif if (abcNonLinearCost_->numberInfeasibilities()) problemStatus_ = -4; // might be infeasible // Force to re-factorize early next time int numberPivots = abcFactorization_->pivots(); returnCode = 0; #ifdef CLP_USER_DRIVEN // If large number of pivots trap later? if (problemStatus_==-1 && numberPivots<13000) { int status = eventHandler_->event(ClpEventHandler::noCandidateInPrimal); if (status>=0&&status<10) { // carry on problemStatus_=-1; if (status==0) break; } else if (status>=10) { problemStatus_=status-10; break; } else { forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); break; } } #else forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); break; #endif } } if (valuesOption > 1) usefulArray_[arrayForFlipBounds_].setNumElements(0); return returnCode; } /* Checks if finished. Updates status */ void AbcSimplexPrimal::statusOfProblemInPrimal(int type) { int saveFirstFree = firstFree_; // number of pivots done int numberPivots = abcFactorization_->pivots(); #if 0 printf("statusOf %d pivots type %d pstatus %d forceFac %d dont %d\n", numberPivots,type,problemStatus_,forceFactorization_,dontFactorizePivots_); #endif //int saveType=type; if (type>3) { // force factorization numberPivots=9999999; if (type>10) type -=10; else type &= 3; } #ifndef TRY_ABC_GUS bool doFactorization = (type != 3&&(numberPivots>dontFactorizePivots_||numberIterations_==baseIteration_||problemStatus_==10)); #else bool doFactorization = (type != 3&&(numberPivots>dontFactorizePivots_||numberIterations_==baseIteration_)); #endif bool doWeights = doFactorization||problemStatus_==10; if (type == 2) { // trouble - restore solution restoreGoodStatus(1); forceFactorization_ = 1; // a bit drastic but .. pivotRow_ = -1; // say no weights update changeMade_++; // say change made } int tentativeStatus = problemStatus_; double lastSumInfeasibility = COIN_DBL_MAX; int lastNumberInfeasibility = 1; #ifndef CLP_CAUTION #define CLP_CAUTION 1 #endif #if CLP_CAUTION double lastAverageInfeasibility = sumDualInfeasibilities_ / static_cast(numberDualInfeasibilities_ + 1); #endif if (numberIterations_&&type) { lastSumInfeasibility = abcNonLinearCost_->sumInfeasibilities(); lastNumberInfeasibility = abcNonLinearCost_->numberInfeasibilities(); } else { lastAverageInfeasibility=1.0e10; } bool ifValuesPass=(stateOfProblem_&VALUES_PASS)!=0; bool takenAction=false; double sumInfeasibility=0.0; if (problemStatus_ > -3 || problemStatus_ == -4) { // factorize // later on we will need to recover from singularities // also we could skip if first time // do weights // This may save pivotRow_ for use if (doFactorization) abcPrimalColumnPivot_->saveWeights(this, 1); if (!type) { // be optimistic stateOfProblem_ &= ~PESSIMISTIC; // but use 0.1 double newTolerance = CoinMax(0.1, saveData_.pivotTolerance_); abcFactorization_->pivotTolerance(newTolerance); } if (doFactorization) { // is factorization okay? int solveType = ifValuesPass ? 11 :1; if (!type) solveType++; int factorStatus = internalFactorize(solveType); if (factorStatus) { if (type != 1 || largestPrimalError_ > 1.0e3 || largestDualError_ > 1.0e3) { #if ABC_NORMAL_DEBUG>0 printf("Bad initial basis\n"); #endif internalFactorize(2); } else { // no - restore previous basis // Keep any flagged variables for (int i = 0; i < numberTotal_; i++) { if (flagged(i)) internalStatusSaved_[i] |= 64; //say flagged } restoreGoodStatus(1); if (numberPivots <= 1) { // throw out something if (sequenceIn_ >= 0 && getInternalStatus(sequenceIn_) != basic) { setFlagged(sequenceIn_); } else if (sequenceOut_ >= 0 && getInternalStatus(sequenceOut_) != basic) { setFlagged(sequenceOut_); } abcProgress_.incrementTimesFlagged(); double newTolerance = CoinMax(0.5 + 0.499 * randomNumberGenerator_.randomDouble(), abcFactorization_->pivotTolerance()); abcFactorization_->pivotTolerance(newTolerance); } else { // Go to safe abcFactorization_->pivotTolerance(0.99); } forceFactorization_ = 1; // a bit drastic but .. type = 2; abcNonLinearCost_->checkInfeasibilities(); if (internalFactorize(2) != 0) { largestPrimalError_ = 1.0e4; // force other type } } changeMade_++; // say change made } } if (problemStatus_ != -4) problemStatus_ = -3; if(abcProgress_.realInfeasibility_[0]<1.0e-1 && primalTolerance_==1.0e-7&&abcProgress_.iterationNumber_[0]>0&& abcProgress_.iterationNumber_[CLP_PROGRESS-1]-abcProgress_.iterationNumber_[0]>25) { // default - so user did not set int iP; double minAverage=COIN_DBL_MAX; double maxAverage=0.0; for (iP=0;iP0.1) break; average /= static_cast(n); minAverage=CoinMin(minAverage,average); maxAverage=CoinMax(maxAverage,average); } } if (iP==CLP_PROGRESS&&minAverage<1.0e-5&&maxAverage<1.0e-3) { // change tolerance #if CBC_USEFUL_PRINTING>0 printf("CCchanging tolerance\n"); #endif primalTolerance_=1.0e-6; dblParam_[ClpPrimalTolerance]=1.0e-6; moreSpecialOptions_ |= 4194304; } } // at this stage status is -3 or -5 if looks unbounded // get primal and dual solutions // put back original costs and then check // createRim(4); // costs do not change if (ifValuesPass&&numberIterations_==baseIteration_) { abcNonLinearCost_->checkInfeasibilities(primalTolerance_); lastSumInfeasibility = abcNonLinearCost_->largestInfeasibility(); } #ifdef CLP_USER_DRIVEN int status = eventHandler_->event(ClpEventHandler::goodFactorization); if (status >= 0) { lastSumInfeasibility = COIN_DBL_MAX; } #endif if (ifValuesPass&&numberIterations_==baseIteration_) { double * save = new double[numberRows_]; int numberOut = 1; while (numberOut) { for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; save[iRow] = abcSolution_[iPivot]; } gutsOfPrimalSolution(2); double badInfeasibility = abcNonLinearCost_->largestInfeasibility(); numberOut = 0; // But may be very large rhs etc double useError = CoinMin(largestPrimalError_, 1.0e5 / CoinAbcMaximumAbsElement(abcSolution_, numberTotal_)); if ((lastSumInfeasibility < incomingInfeasibility_ || badInfeasibility > (CoinMax(10.0, 100.0 * lastSumInfeasibility))) && (badInfeasibility > 10.0 ||useError > 1.0e-3)) { //printf("Original largest infeas %g, now %g, primalError %g\n", // lastSumInfeasibility,abcNonLinearCost_->largestInfeasibility(), // largestPrimalError_); // throw out up to 1000 structurals int * sort = new int[numberRows_]; // first put back solution and store difference for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; double difference = fabs(abcSolution_[iPivot] - save[iRow]); abcSolution_[iPivot] = save[iRow]; save[iRow] = difference; } abcNonLinearCost_->checkInfeasibilities(primalTolerance_); if (handler_->logLevel()>1) printf("Largest infeasibility %g\n",abcNonLinearCost_->largestInfeasibility()); int numberBasic = 0; for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; if (iPivot >= numberRows_) { // column double difference = save[iRow]; if (difference > 1.0e-4) { sort[numberOut] = iRow; save[numberOut++] = -difference; if (getInternalStatus(iPivot) == basic) numberBasic++; } } } if (!numberBasic) { //printf("no errors on basic - going to all slack - numberOut %d\n",numberOut); // allow numberOut = 0; } CoinSort_2(save, save + numberOut, sort); numberOut = CoinMin(1000, numberOut); // for now bring in any slack int jRow=0; for (int i = 0; i < numberOut; i++) { int iRow = sort[i]; int iColumn = abcPivotVariable_[iRow]; assert (getInternalStatus(iColumn)==basic); setInternalStatus(iColumn, superBasic); while (getInternalStatus(jRow)==basic) jRow++; setInternalStatus(jRow, basic); abcPivotVariable_[iRow] = jRow; if (fabs(abcSolution_[iColumn]) > 1.0e10) { if (abcUpper_[iColumn] < 0.0) { abcSolution_[iColumn] = abcUpper_[iColumn]; } else if (abcLower_[iColumn] > 0.0) { abcSolution_[iColumn] = abcLower_[iColumn]; } else { abcSolution_[iColumn] = 0.0; } } } delete [] sort; } if (numberOut) { double savePivotTolerance = abcFactorization_->pivotTolerance(); abcFactorization_->pivotTolerance(0.99); int factorStatus = internalFactorize(12); abcFactorization_->pivotTolerance(savePivotTolerance); assert (!factorStatus); } } delete [] save; } gutsOfPrimalSolution(3); sumInfeasibility = abcNonLinearCost_->sumInfeasibilities(); int reason2 = 0; #if CLP_CAUTION #if CLP_CAUTION==2 double test2 = 1.0e5; #else double test2 = 1.0e-1; #endif if (!lastSumInfeasibility && sumInfeasibility>1.0e3*primalTolerance_ && lastAverageInfeasibility < test2 && numberPivots > 10&&!ifValuesPass) reason2 = 3; if (lastSumInfeasibility < 1.0e-6 && sumInfeasibility > 1.0e-3 && numberPivots > 10&&!ifValuesPass) reason2 = 4; #endif if ((sumInfeasibility > 1.0e7 && sumInfeasibility > 100.0 * lastSumInfeasibility && abcFactorization_->pivotTolerance() < 0.11) || (largestPrimalError_ > 1.0e10 && largestDualError_ > 1.0e10)) reason2 = 2; if (reason2) { takenAction=true; problemStatus_ = tentativeStatus; doFactorization = true; if (numberPivots) { // go back // trouble - restore solution restoreGoodStatus(1); sequenceIn_=-1; sequenceOut_=-1; abcNonLinearCost_->checkInfeasibilities(); if (reason2 < 3) { // Go to safe abcFactorization_->pivotTolerance(CoinMin(0.99, 1.01 * abcFactorization_->pivotTolerance())); forceFactorization_ = 1; // a bit drastic but .. } else if (forceFactorization_ < 0) { forceFactorization_ = CoinMin(numberPivots / 4, 100); } else { forceFactorization_ = CoinMin(forceFactorization_, CoinMax(3, numberPivots / 4)); } pivotRow_ = -1; // say no weights update changeMade_++; // say change made if (numberPivots == 1) { // throw out something if (sequenceIn_ >= 0 && getInternalStatus(sequenceIn_) != basic) { setFlagged(sequenceIn_); } else if (sequenceOut_ >= 0 && getInternalStatus(sequenceOut_) != basic) { setFlagged(sequenceOut_); } abcProgress_.incrementTimesFlagged(); } type = 2; // so will restore weights if (internalFactorize(2) != 0) { largestPrimalError_ = 1.0e4; // force other type } numberPivots = 0; gutsOfPrimalSolution(3); sumInfeasibility = abcNonLinearCost_->sumInfeasibilities(); } } } // Double check reduced costs if no action if (abcProgress_.lastIterationNumber(0) == numberIterations_) { if (abcPrimalColumnPivot_->looksOptimal()) { numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; } } // If in primal and small dj give up if ((specialOptions_ & 1024) != 0 && !numberPrimalInfeasibilities_ && numberDualInfeasibilities_) { double average = sumDualInfeasibilities_ / (static_cast (numberDualInfeasibilities_)); if (numberIterations_ > 300 && average < 1.0e-4) { numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; } } // Check if looping int loop; ifValuesPass=firstFree_>=0; if (type != 2 && !ifValuesPass) loop = abcProgress_.looping(); else loop = -1; if ((moreSpecialOptions_ & 2048) != 0 && !numberPrimalInfeasibilities_ && numberDualInfeasibilities_) { double average = sumDualInfeasibilities_ / (static_cast (numberDualInfeasibilities_)); if (abcProgress_.lastIterationNumber(2)==numberIterations_&& ((abcProgress_.timesFlagged()>2&&average < 1.0e-1)|| abcProgress_.timesFlagged()>20)) { numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; problemStatus_=3; loop=0; } } if (loop >= 0) { if (!problemStatus_) { // declaring victory numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; // say been feasible abcState_ |= CLP_ABC_BEEN_FEASIBLE; } else { problemStatus_ = loop; //exit if in loop problemStatus_ = 10; // instead - try other algorithm numberPrimalInfeasibilities_ = abcNonLinearCost_->numberInfeasibilities(); } problemStatus_ = 10; // instead - try other algorithm return ; } else if (loop < -1) { // Is it time for drastic measures if (abcNonLinearCost_->numberInfeasibilities() && abcProgress_.badTimes() > 5 && abcProgress_.oddState() < 10 && abcProgress_.oddState() >= 0) { abcProgress_.newOddState(); abcNonLinearCost_->zapCosts(); } // something may have changed gutsOfPrimalSolution(3); } // If progress then reset costs if (loop == -1 && !abcNonLinearCost_->numberInfeasibilities() && abcProgress_.oddState() < 0) { copyFromSaved(); // costs back delete abcNonLinearCost_; abcNonLinearCost_ = new AbcNonLinearCost(this); abcProgress_.endOddState(); gutsOfPrimalSolution(3); } abcProgress_.modifyObjective(abcNonLinearCost_->feasibleReportCost()); if (!lastNumberInfeasibility && sumInfeasibility && numberPivots > 1&&!ifValuesPass&& !takenAction&& abcProgress_.lastObjective(0)>=abcProgress_.lastObjective(CLP_PROGRESS-1)) { // first increase minimumThetaMovement_; // be more careful //abcFactorization_->saferTolerances (-0.99, -1.002); #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() == 63) printf("thought feasible but sum is %g force %d minimum theta %g\n", sumInfeasibility, forceFactorization_,minimumThetaMovement_); #endif stateOfProblem_ |= PESSIMISTIC; if (minimumThetaMovement_<1.0e-10) { minimumThetaMovement_ *= 1.1; } else if (0) { int maxFactor = abcFactorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ >> 2)); if (handler_->logLevel() == 63) printf("Reducing factorization frequency to %d\n", forceFactorization_); } } } // Flag to say whether to go to dual to clean up bool goToDual = false; // really for free variables in //if((progressFlag_&2)!=0) //problemStatus_=-1;; progressFlag_ = 0; //reset progress flag handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << abcNonLinearCost_->feasibleReportCost()+objectiveOffset_; handler_->printing(abcNonLinearCost_->numberInfeasibilities() > 0) << abcNonLinearCost_->sumInfeasibilities() << abcNonLinearCost_->numberInfeasibilities(); handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; if (!primalFeasible()) { abcNonLinearCost_->checkInfeasibilities(primalTolerance_); gutsOfPrimalSolution(2); abcNonLinearCost_->checkInfeasibilities(primalTolerance_); } double trueInfeasibility = abcNonLinearCost_->sumInfeasibilities(); if (!abcNonLinearCost_->numberInfeasibilities() && infeasibilityCost_ == 1.0e10 && !ifValuesPass && true) { // say been feasible abcState_ |= CLP_ABC_BEEN_FEASIBLE; // relax if default infeasibilityCost_ = CoinMin(CoinMax(100.0 * sumDualInfeasibilities_, 1.0e8), 1.00000001e10); // reset looping criterion abcProgress_.reset(); trueInfeasibility = 1.123456e10; } if (trueInfeasibility > 1.0) { // If infeasibility going up may change weights double testValue = trueInfeasibility - 1.0e-4 * (10.0 + trueInfeasibility); double lastInf = abcProgress_.lastInfeasibility(1); double lastInf3 = abcProgress_.lastInfeasibility(3); double thisObj = abcProgress_.lastObjective(0); double thisInf = abcProgress_.lastInfeasibility(0); thisObj += infeasibilityCost_ * 2.0 * thisInf; double lastObj = abcProgress_.lastObjective(1); lastObj += infeasibilityCost_ * 2.0 * lastInf; double lastObj3 = abcProgress_.lastObjective(3); lastObj3 += infeasibilityCost_ * 2.0 * lastInf3; if (lastObj < thisObj - 1.0e-5 * CoinMax(fabs(thisObj), fabs(lastObj)) - 1.0e-7 && firstFree_ < 0 && thisInf >= lastInf) { #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() == 63) printf("lastobj %g this %g force %d\n", lastObj, thisObj, forceFactorization_); #endif int maxFactor = abcFactorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ >> 2)); #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() == 63) printf("Reducing factorization frequency to %d\n", forceFactorization_); #endif } } else if (lastObj3 < thisObj - 1.0e-5 * CoinMax(fabs(thisObj), fabs(lastObj3)) - 1.0e-7 && firstFree_ < 0 && thisInf >= lastInf) { #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() == 63) printf("lastobj3 %g this3 %g force %d\n", lastObj3, thisObj, forceFactorization_); #endif int maxFactor = abcFactorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ * 2) / 3); #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() == 63) printf("Reducing factorization frequency to %d\n", forceFactorization_); #endif } } else if(lastInf < testValue || trueInfeasibility == 1.123456e10) { if (infeasibilityCost_ < 1.0e14) { infeasibilityCost_ *= 1.5; // reset looping criterion abcProgress_.reset(); #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() == 63) printf("increasing weight to %g\n", infeasibilityCost_); #endif gutsOfPrimalSolution(3); } } } // we may wish to say it is optimal even if infeasible bool alwaysOptimal = (specialOptions_ & 1) != 0; #if CLP_CAUTION // If twice nearly there ... if (lastAverageInfeasibility<2.0*dualTolerance_) { double averageInfeasibility = sumDualInfeasibilities_ / static_cast(numberDualInfeasibilities_ + 1); printf("last av %g now %g\n",lastAverageInfeasibility, averageInfeasibility); if (averageInfeasibility<2.0*dualTolerance_) sumOfRelaxedDualInfeasibilities_ = 0.0; } #endif // give code benefit of doubt if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0) { // say been feasible abcState_ |= CLP_ABC_BEEN_FEASIBLE; // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; // But if real primal infeasibilities nonzero carry on if (abcNonLinearCost_->numberInfeasibilities()) { // most likely to happen if infeasible double relaxedToleranceP = primalTolerance_; // we can't really trust infeasibilities if there is primal error double error = CoinMin(1.0e-2, largestPrimalError_); // allow tolerance at least slightly bigger than standard relaxedToleranceP = relaxedToleranceP + error; int ninfeas = abcNonLinearCost_->numberInfeasibilities(); double sum = abcNonLinearCost_->sumInfeasibilities(); double average = sum / static_cast (ninfeas); #if ABC_NORMAL_DEBUG>3 if (handler_->logLevel() > 0) printf("nonLinearCost says infeasible %d summing to %g\n", ninfeas, sum); #endif if (average > relaxedToleranceP) { sumOfRelaxedPrimalInfeasibilities_ = sum; numberPrimalInfeasibilities_ = ninfeas; sumPrimalInfeasibilities_ = sum; #if ABC_NORMAL_DEBUG>3 bool unflagged = #endif unflag(); abcProgress_.clearTimesFlagged(); #if ABC_NORMAL_DEBUG>3 if (unflagged && handler_->logLevel() > 0) printf(" - but flagged variables\n"); #endif } } } //double saveSum=sumOfRelaxedDualInfeasibilities_; // had ||(type==3&&problemStatus_!=-5) -- ??? why ???? if ((dualFeasible() || problemStatus_ == -4) && !ifValuesPass) { // see if extra helps if (abcNonLinearCost_->numberInfeasibilities() && (abcNonLinearCost_->sumInfeasibilities() > 1.0e-3 || sumOfRelaxedPrimalInfeasibilities_) && !alwaysOptimal) { //may need infeasiblity cost changed // we can see if we can construct a ray // do twice to make sure Primal solution has settled // put non-basics to bounds in case tolerance moved // put back original costs CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_);; abcNonLinearCost_->checkInfeasibilities(0.0); gutsOfPrimalSolution(3); // put back original costs CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_);; abcNonLinearCost_->checkInfeasibilities(primalTolerance_); gutsOfPrimalSolution(3); // may have fixed infeasibilities - double check if (abcNonLinearCost_->numberInfeasibilities() == 0) { // carry on problemStatus_ = -1; abcNonLinearCost_->checkInfeasibilities(primalTolerance_); } else { if ((infeasibilityCost_ >= 1.0e18 || numberDualInfeasibilities_ == 0) && perturbation_ == 101 && (specialOptions_&8192)==0) { goToDual = unPerturb(); // stop any further perturbation #ifndef TRY_ABC_GUS if (abcNonLinearCost_->sumInfeasibilities() > 1.0e-1) goToDual = false; #endif numberDualInfeasibilities_ = 1; // carry on problemStatus_ = -1; } else if (numberDualInfeasibilities_ == 0 && largestDualError_ > 1.0e-2 #ifndef TRY_ABC_GUS &&((moreSpecialOptions_ & 256) == 0&&(specialOptions_ & 8192) == 0) #else &&(specialOptions_ & 8192) == 0 #endif ) { goToDual = true; abcFactorization_->pivotTolerance(CoinMax(0.5, abcFactorization_->pivotTolerance())); } if (!goToDual) { if (infeasibilityCost_ >= 1.0e20 || numberDualInfeasibilities_ == 0) { // we are infeasible - use as ray delete [] ray_; ray_ = new double [numberRows_]; CoinMemcpyN(dual_, numberRows_, ray_); // and get feasible duals infeasibilityCost_ = 0.0; CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_);; abcNonLinearCost_->checkInfeasibilities(primalTolerance_); gutsOfPrimalSolution(3); // so will exit infeasibilityCost_ = 1.0e30; // reset infeasibilities sumPrimalInfeasibilities_ = abcNonLinearCost_->sumInfeasibilities();; numberPrimalInfeasibilities_ = abcNonLinearCost_->numberInfeasibilities(); } if (infeasibilityCost_ < 1.0e20) { infeasibilityCost_ *= 5.0; // reset looping criterion abcProgress_.reset(); changeMade_++; // say change made handler_->message(CLP_PRIMAL_WEIGHT, messages_) << infeasibilityCost_ << CoinMessageEol; // put back original costs and then check CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_);; abcNonLinearCost_->checkInfeasibilities(0.0); gutsOfPrimalSolution(3); problemStatus_ = -1; //continue #ifndef TRY_ABC_GUS goToDual = false; #else if((specialOptions_&8192)==0&&!sumOfRelaxedDualInfeasibilities_) goToDual=true; #endif } else { // say infeasible problemStatus_ = 1; } } } } else { // may be optimal if (perturbation_ == 101) { goToDual = unPerturb(); // stop any further perturbation #ifndef TRY_ABC_GUS if ((numberRows_ > 20000 || numberDualInfeasibilities_) && !numberTimesOptimal_) #else if ((specialOptions_&8192)!=0) #endif goToDual = false; // Better to carry on a bit longer lastCleaned_ = -1; // carry on } bool unflagged = (unflag() != 0); abcProgress_.clearTimesFlagged(); if ( lastCleaned_ != numberIterations_ || unflagged) { handler_->message(CLP_PRIMAL_OPTIMAL, messages_) << primalTolerance_ << CoinMessageEol; if (numberTimesOptimal_ < 4) { numberTimesOptimal_++; changeMade_++; // say change made if (numberTimesOptimal_ == 1) { // better to have small tolerance even if slower abcFactorization_->zeroTolerance(CoinMin(abcFactorization_->zeroTolerance(), 1.0e-15)); } lastCleaned_ = numberIterations_; if (primalTolerance_ != dblParam_[ClpPrimalTolerance]) handler_->message(CLP_PRIMAL_ORIGINAL, messages_) << CoinMessageEol; double oldTolerance = primalTolerance_; primalTolerance_ = dblParam_[ClpPrimalTolerance]; // put back original costs and then check #if 0 //ndef NDEBUG double largestDifference=0.0; for (int i=0;ilogLevel()==63) printf("largest change in cost %g\n",largestDifference); #endif CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_);; abcNonLinearCost_->checkInfeasibilities(oldTolerance); gutsOfPrimalSolution(3); if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0) { // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; goToDual=false; } if (dualFeasible() && !abcNonLinearCost_->numberInfeasibilities() && lastCleaned_ >= 0) problemStatus_ = 0; else problemStatus_ = -1; } else { problemStatus_ = 0; // optimal if (lastCleaned_ < numberIterations_) { handler_->message(CLP_SIMPLEX_GIVINGUP, messages_) << CoinMessageEol; } } } else { if (!alwaysOptimal || !sumOfRelaxedPrimalInfeasibilities_) problemStatus_ = 0; // optimal else problemStatus_ = 1; // infeasible } } } else { // see if looks unbounded if (problemStatus_ == -5) { if (abcNonLinearCost_->numberInfeasibilities()) { if (infeasibilityCost_ > 1.0e18 && perturbation_ == 101) { // back off weight infeasibilityCost_ = 1.0e13; // reset looping criterion abcProgress_.reset(); unPerturb(); // stop any further perturbation } //we need infeasiblity cost changed if (infeasibilityCost_ < 1.0e20) { infeasibilityCost_ *= 5.0; // reset looping criterion abcProgress_.reset(); changeMade_++; // say change made handler_->message(CLP_PRIMAL_WEIGHT, messages_) << infeasibilityCost_ << CoinMessageEol; // put back original costs and then check CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_);; gutsOfPrimalSolution(3); problemStatus_ = -1; //continue } else { // say infeasible problemStatus_ = 1; // we are infeasible - use as ray delete [] ray_; ray_ = new double [numberRows_]; CoinMemcpyN(dual_, numberRows_, ray_); } } else { // say unbounded problemStatus_ = 2; } } else { // carry on problemStatus_ = -1; if(type == 3 && !ifValuesPass) { //bool unflagged = unflag(); abcProgress_.clearTimesFlagged(); if (sumDualInfeasibilities_ < 1.0e-3 || (sumDualInfeasibilities_ / static_cast (numberDualInfeasibilities_)) < 1.0e-5 || abcProgress_.lastIterationNumber(0) == numberIterations_) { if (!numberPrimalInfeasibilities_) { if (numberTimesOptimal_ < 4) { numberTimesOptimal_++; changeMade_++; // say change made } else { problemStatus_ = 0; secondaryStatus_ = 5; } } } } } } if (problemStatus_ == 0) { double objVal = (abcNonLinearCost_->feasibleCost() + objective_->nonlinearOffset()); objVal /= (objectiveScale_ * rhsScale_); double tol = 1.0e-10 * CoinMax(fabs(objVal), fabs(objectiveValue_)) + 1.0e-8; if (fabs(objVal - objectiveValue_) > tol) { #if ABC_NORMAL_DEBUG>3 if (handler_->logLevel() > 0) printf("nonLinearCost has feasible obj of %g, objectiveValue_ is %g\n", objVal, objectiveValue_); #endif objectiveValue_ = objVal; } } if (type == 0 || type == 1) { saveGoodStatus(); } // see if in Cbc etc bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; bool disaster = false; if (disasterArea_ && inCbcOrOther && disasterArea_->check()) { disasterArea_->saveInfo(); disaster = true; } if (disaster) problemStatus_ = 3; if (problemStatus_ < 0 && !changeMade_) { problemStatus_ = 4; // unknown } lastGoodIteration_ = numberIterations_; if (numberIterations_ > lastBadIteration_ + 100) moreSpecialOptions_ &= ~16; // clear check accuracy flag #ifndef TRY_ABC_GUS if ((moreSpecialOptions_ & 256) != 0||saveSum||(specialOptions_ & 8192) != 0) goToDual=false; #else if ((specialOptions_ & 8192) != 0) goToDual=false; #endif if (goToDual || (numberIterations_ > 1000+baseIteration_ && largestPrimalError_ > 1.0e6 && largestDualError_ > 1.0e6)) { problemStatus_ = 10; // try dual // See if second call if ((moreSpecialOptions_ & 256) != 0||abcNonLinearCost_->sumInfeasibilities()>1.0e20) { numberPrimalInfeasibilities_ = abcNonLinearCost_->numberInfeasibilities(); sumPrimalInfeasibilities_ = abcNonLinearCost_->sumInfeasibilities(); // say infeasible if (numberPrimalInfeasibilities_&&(abcState_&CLP_ABC_BEEN_FEASIBLE)==0) problemStatus_ = 1; } } // make sure first free monotonic if (firstFree_ >= 0 && saveFirstFree >= 0) { firstFree_ = (numberIterations_) ? saveFirstFree : -1; nextSuperBasic(1, NULL); } #ifdef TRY_SPLIT_VALUES_PASS if (valuesChunk>0) { bool doFixing=firstFree_<0; if (numberIterations_==baseIteration_&& numberDualInfeasibilitiesWithoutFree_+1000((1.01*numberSuperBasic)/valuesChunk); doOrdinaryVariables=static_cast(valuesRatio*keepValuesPass); } else if (valuesStop>0) { if (numberIterations_>=valuesStop||problemStatus_>=0) { gutsOfSolution(3); abcNonLinearCost_->refreshFromPerturbed(primalTolerance_); gutsOfSolution(3); int numberSuperBasic=0; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if (getInternalStatus(iSequence) == isFixed) { if (abcUpper_[iSequence]>abcLower_[iSequence]) { setInternalStatus(iSequence,superBasic); numberSuperBasic++; } } } if (numberSuperBasic) { stateOfProblem_ |= VALUES_PASS; problemStatus_=-1; gutsOfSolution(3); } else { doFixing=false; } valuesStop=-1; } else { doFixing=false; } } if (doFixing) { abcNonLinearCost_->refreshFromPerturbed(primalTolerance_); int numberSuperBasic=0; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if (getInternalStatus(iSequence) == isFixed) { if (abcUpper_[iSequence]>abcLower_[iSequence]) setInternalStatus(iSequence,superBasic); } if (getInternalStatus(iSequence) == superBasic) numberSuperBasic++; } int numberFixed=0; firstFree_=-1; if (numberSuperBasic) { double threshold = static_cast(keepValuesPass)/numberSuperBasic; if (1.1*keepValuesPass>numberSuperBasic) threshold=1.1; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if (getInternalStatus(iSequence) == superBasic) { if (randomNumberGenerator_.randomDouble() -3) abcPrimalColumnPivot_->saveWeights(this, (type < 2) ? 2 : 4); else abcPrimalColumnPivot_->saveWeights(this, 3); } } // Computes solutions - 1 do duals, 2 do primals, 3 both int AbcSimplex::gutsOfPrimalSolution(int type) { //work space int whichArray[2]; for (int i=0;i<2;i++) whichArray[i]=getAvailableArray(); CoinIndexedVector * array1 = &usefulArray_[whichArray[0]]; CoinIndexedVector * array2 = &usefulArray_[whichArray[1]]; // do work and check int numberRefinements=0; if ((type&2)!=0) { numberRefinements=computePrimals(array1,array2); if (algorithm_ > 0 && abcNonLinearCost_ != NULL) { // primal algorithm // get correct bounds on all variables abcNonLinearCost_->checkInfeasibilities(primalTolerance_); if (abcNonLinearCost_->numberInfeasibilities()) if (handler_->detail(CLP_SIMPLEX_NONLINEAR, messages_) < 100) { handler_->message(CLP_SIMPLEX_NONLINEAR, messages_) << abcNonLinearCost_->changeInCost() << abcNonLinearCost_->numberInfeasibilities() << CoinMessageEol; } } checkPrimalSolution(true); } if ((type&1)!=0 #if CAN_HAVE_ZERO_OBJ>1 &&(specialOptions_&2097152)==0 #endif ) { numberRefinements+=computeDuals(NULL,array1,array2); checkDualSolution(); } for (int i=0;i<2;i++) setAvailableArray(whichArray[i]); rawObjectiveValue_ +=sumNonBasicCosts_; //computeObjective(); // ? done in checkDualSolution?? setClpSimplexObjectiveValue(); if (handler_->logLevel() > 3 || (largestPrimalError_ > 1.0e-2 || largestDualError_ > 1.0e-2)) handler_->message(CLP_SIMPLEX_ACCURACY, messages_) << largestPrimalError_ << largestDualError_ << CoinMessageEol; if ((largestPrimalError_ > 1.0e1||largestDualError_>1.0e1) && numberRows_ > 100 && numberIterations_) { #if ABC_NORMAL_DEBUG>0 printf("Large errors - primal %g dual %g\n", largestPrimalError_,largestDualError_); #endif // Change factorization tolerance //if (abcFactorization_->zeroTolerance() > 1.0e-18) //abcFactorization_->zeroTolerance(1.0e-18); } return numberRefinements; } /* Row array has pivot column This chooses pivot row. For speed, we may need to go to a bucket approach when many variables go through bounds On exit rhsArray will have changes in costs of basic variables */ void AbcSimplexPrimal::primalRow(CoinIndexedVector * rowArray, CoinIndexedVector * rhsArray, CoinIndexedVector * spareArray, int valuesPass) { #if 1 for (int iRow=0;iRowdenseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); int iIndex; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; dualIn_ -= alpha * costBasic_[iRow]; } // determine direction here if (dualIn_ < -dualTolerance_) { directionIn_ = 1; } else if (dualIn_ > dualTolerance_) { directionIn_ = -1; } else { // towards nearest bound if (valueIn_ - lowerIn_ < upperIn_ - valueIn_) { directionIn_ = -1; dualIn_ = dualTolerance_; } else { directionIn_ = 1; dualIn_ = -dualTolerance_; } } } // sequence stays as row number until end pivotRow_ = -1; int numberRemaining = 0; double totalThru = 0.0; // for when variables flip // Allow first few iterations to take tiny double acceptablePivot = 1.0e-1 * acceptablePivot_; if (numberIterations_ > 100) acceptablePivot = acceptablePivot_; if (abcFactorization_->pivots() > 10) acceptablePivot = 1.0e+3 * acceptablePivot_; // if we have iterated be more strict else if (abcFactorization_->pivots() > 5) acceptablePivot = 1.0e+2 * acceptablePivot_; // if we have iterated be slightly more strict else if (abcFactorization_->pivots()) acceptablePivot = acceptablePivot_; // relax double bestEverPivot = acceptablePivot; int lastPivotRow = -1; double lastPivot = 0.0; double lastTheta = 1.0e50; // use spareArrays to put ones looked at in // First one is list of candidates // We could compress if we really know we won't need any more // Second array has current set of pivot candidates // with a backup list saved in double * part of indexed vector // pivot elements double * spare; // indices int * index; spareArray->clear(); spare = spareArray->denseVector(); index = spareArray->getIndices(); // we also need somewhere for effective rhs double * rhs = rhsArray->denseVector(); // and we can use indices to point to alpha // that way we can store fabs(alpha) int * indexPoint = rhsArray->getIndices(); //int numberFlip=0; // Those which may change if flips /* First we get a list of possible pivots. We can also see if the problem looks unbounded. At first we increase theta and see what happens. We start theta at a reasonable guess. If in right area then we do bit by bit. We save possible pivot candidates */ // do first pass to get possibles // We can also see if unbounded double * work = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); // we need to swap sign if coming in from ub double way = directionIn_; double maximumMovement; if (way > 0.0) maximumMovement = CoinMin(1.0e30, upperIn_ - valueIn_); else maximumMovement = CoinMin(1.0e30, valueIn_ - lowerIn_); double averageTheta = abcNonLinearCost_->averageTheta(); double tentativeTheta = CoinMin(10.0 * averageTheta, maximumMovement); double upperTheta = maximumMovement; if (tentativeTheta > 0.5 * maximumMovement) tentativeTheta = maximumMovement; bool thetaAtMaximum = tentativeTheta == maximumMovement; // In case tiny bounds increase if (maximumMovement < 1.0) tentativeTheta *= 1.1; double dualCheck = fabs(dualIn_); // but make a bit more pessimistic dualCheck = CoinMax(dualCheck - 100.0 * dualTolerance_, 0.99 * dualCheck); int iIndex; //#define CLP_DEBUG #if ABC_NORMAL_DEBUG>3 if (numberIterations_ == 1369 || numberIterations_ == -3840) { double dj = abcCost_[sequenceIn_]; printf("cost in on %d is %g, dual in %g\n", sequenceIn_, dj, dualIn_); for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; int iPivot = abcPivotVariable_[iRow]; dj -= alpha * costBasic_[iRow]; printf("row %d var %d current %g %g %g, alpha %g so sol => %g (cost %g, dj %g)\n", iRow, iPivot, lowerBasic_[iRow], solutionBasic_[iRow], upperBasic_[iRow], alpha, solutionBasic_[iRow] - 1.0e9 * alpha, costBasic_[iRow], dj); } } #endif while (true) { totalThru = 0.0; // We also re-compute reduced cost numberRemaining = 0; dualIn_ = abcCost_[sequenceIn_]; #ifndef NDEBUG //double tolerance = primalTolerance_ * 1.002; #endif for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; dualIn_ -= alpha * costBasic_[iRow]; alpha *= way; double oldValue = solutionBasic_[iRow]; // get where in bound sequence // note that after this alpha is actually fabs(alpha) bool possible; // do computation same way as later on in primal if (alpha > 0.0) { // basic variable going towards lower bound double bound = lowerBasic_[iRow]; // must be exactly same as when used double change = tentativeTheta * alpha; possible = (oldValue - change) <= bound + primalTolerance_; oldValue -= bound; } else { // basic variable going towards upper bound double bound = upperBasic_[iRow]; // must be exactly same as when used double change = tentativeTheta * alpha; possible = (oldValue - change) >= bound - primalTolerance_; oldValue = bound - oldValue; alpha = - alpha; } double value; //assert (oldValue >= -10.0*tolerance); if (possible) { value = oldValue - upperTheta * alpha; #ifdef CLP_USER_DRIVEN1 if(!userChoiceValid1(this,iPivot,oldValue, upperTheta,alpha,work[iRow]*way)) value =0.0; // say can't use #endif if (value < -primalTolerance_ && alpha >= acceptablePivot) { upperTheta = (oldValue + primalTolerance_) / alpha; } // add to list spare[numberRemaining] = alpha; rhs[numberRemaining] = oldValue; indexPoint[numberRemaining] = iIndex; index[numberRemaining++] = iRow; totalThru += alpha; setActive(iRow); //} else if (value= 1.0001 * dualCheck) { // Can pivot here break; } else if (!thetaAtMaximum) { //printf("Going round with average theta of %g\n",averageTheta); tentativeTheta = maximumMovement; thetaAtMaximum = true; // seems to be odd compiler error } else { break; } } totalThru = 0.0; theta_ = maximumMovement; bool goBackOne = false; if (objective_->type() > 1) dualIn_ = saveDj; //printf("%d remain out of %d\n",numberRemaining,number); int iTry = 0; #define MAXTRY 1000 if (numberRemaining && upperTheta < maximumMovement) { // First check if previously chosen one will work // first get ratio with tolerance for ( ; iTry < MAXTRY; iTry++) { upperTheta = maximumMovement; int iBest = -1; for (iIndex = 0; iIndex < numberRemaining; iIndex++) { double alpha = spare[iIndex]; double oldValue = rhs[iIndex]; double value = oldValue - upperTheta * alpha; #ifdef CLP_USER_DRIVEN1 int sequenceOut=abcPivotVariable_[index[iIndex]]; if(!userChoiceValid1(this,sequenceOut,oldValue, upperTheta,alpha, 0.0)) value =0.0; // say can't use #endif if (value < -primalTolerance_ && alpha >= acceptablePivot) { upperTheta = (oldValue + primalTolerance_) / alpha; iBest = iIndex; // just in case weird numbers } } // now look at best in this lot // But also see how infeasible small pivots will make double sumInfeasibilities = 0.0; double bestPivot = acceptablePivot; pivotRow_ = -1; for (iIndex = 0; iIndex < numberRemaining; iIndex++) { int iRow = index[iIndex]; double alpha = spare[iIndex]; double oldValue = rhs[iIndex]; double value = oldValue - upperTheta * alpha; if (value <= 0 || iBest == iIndex) { // how much would it cost to go thru and modify bound double trueAlpha = way * work[iRow]; totalThru += abcNonLinearCost_->changeInCost(iRow, trueAlpha, rhs[iIndex]); setActive(iRow); if (alpha > bestPivot) { bestPivot = alpha; theta_ = oldValue / bestPivot; pivotRow_ = iRow; } else if (alpha < acceptablePivot #ifdef CLP_USER_DRIVEN1 ||!userChoiceValid1(this,abcPivotVariable_[index[iIndex]], oldValue,upperTheta,alpha,0.0) #endif ) { if (value < -primalTolerance_) sumInfeasibilities += -value - primalTolerance_; } } } if (bestPivot < 0.1 * bestEverPivot && bestEverPivot > 1.0e-6 && bestPivot < 1.0e-3) { // back to previous one goBackOne = true; break; } else if (pivotRow_ == -1 && upperTheta > largeValue_) { if (lastPivot > acceptablePivot) { // back to previous one goBackOne = true; } else { // can only get here if all pivots so far too small } break; } else if (totalThru >= dualCheck) { if (sumInfeasibilities > primalTolerance_ && !abcNonLinearCost_->numberInfeasibilities()) { // Looks a bad choice if (lastPivot > acceptablePivot) { goBackOne = true; } else { // say no good dualIn_ = 0.0; } } break; // no point trying another loop } else { lastPivotRow = pivotRow_; lastTheta = theta_; if (bestPivot > bestEverPivot) bestEverPivot = bestPivot; } } // can get here without pivotRow_ set but with lastPivotRow if (goBackOne || (pivotRow_ < 0 && lastPivotRow >= 0)) { // back to previous one pivotRow_ = lastPivotRow; theta_ = lastTheta; } } else if (pivotRow_ < 0 && maximumMovement > 1.0e20) { // looks unbounded valueOut_ = COIN_DBL_MAX; // say odd if (abcNonLinearCost_->numberInfeasibilities()) { // but infeasible?? // move variable but don't pivot tentativeTheta = 1.0e50; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; alpha *= way; double oldValue = solutionBasic_[iRow]; // get where in bound sequence // note that after this alpha is actually fabs(alpha) if (alpha > 0.0) { // basic variable going towards lower bound double bound = lowerBasic_[iRow]; oldValue -= bound; } else { // basic variable going towards upper bound double bound = upperBasic_[iRow]; oldValue = bound - oldValue; alpha = - alpha; } if (oldValue - tentativeTheta * alpha < 0.0) { tentativeTheta = oldValue / alpha; } } // If free in then see if we can get to 0.0 if (lowerIn_ < -1.0e20 && upperIn_ > 1.0e20) { if (dualIn_ * valueIn_ > 0.0) { if (fabs(valueIn_) < 1.0e-2 && (tentativeTheta < fabs(valueIn_) || tentativeTheta > 1.0e20)) { tentativeTheta = fabs(valueIn_); } } } if (tentativeTheta < 1.0e10) valueOut_ = valueIn_ + way * tentativeTheta; } } //if (iTry>50) //printf("** %d tries\n",iTry); if (pivotRow_ >= 0) { alpha_ = work[pivotRow_]; // translate to sequence sequenceOut_ = abcPivotVariable_[pivotRow_]; valueOut_ = solution(sequenceOut_); lowerOut_ = abcLower_[sequenceOut_]; upperOut_ = abcUpper_[sequenceOut_]; //#define MINIMUMTHETA 1.0e-11 // Movement should be minimum for anti-degeneracy - unless // fixed variable out double minimumTheta; if (upperOut_ > lowerOut_) minimumTheta = minimumThetaMovement_; else minimumTheta = 0.0; // But can't go infeasible double distance; if (alpha_ * way > 0.0) distance = valueOut_ - lowerOut_; else distance = upperOut_ - valueOut_; if (distance - minimumTheta * fabs(alpha_) < -primalTolerance_) minimumTheta = CoinMax(0.0, (distance + 0.5 * primalTolerance_) / fabs(alpha_)); // will we need to increase tolerance //#define CLP_DEBUG double largestInfeasibility = primalTolerance_; if (theta_ < minimumTheta && (specialOptions_ & 4) == 0 && !valuesPass) { theta_ = minimumTheta; for (iIndex = 0; iIndex < numberRemaining - numberRemaining; iIndex++) { largestInfeasibility = CoinMax(largestInfeasibility, -(rhs[iIndex] - spare[iIndex] * theta_)); } //#define CLP_DEBUG #if ABC_NORMAL_DEBUG>3 if (largestInfeasibility > primalTolerance_ && (handler_->logLevel() & 32) > -1) printf("Primal tolerance increased from %g to %g\n", primalTolerance_, largestInfeasibility); #endif //#undef CLP_DEBUG primalTolerance_ = CoinMax(primalTolerance_, largestInfeasibility); } // Need to look at all in some cases if (theta_ > tentativeTheta) { for (iIndex = 0; iIndex < number; iIndex++) setActive(which[iIndex]); } if (way < 0.0) theta_ = - theta_; double newValue = valueOut_ - theta_ * alpha_; // If 4 bit set - Force outgoing variables to exact bound (primal) if (alpha_ * way < 0.0) { directionOut_ = -1; // to upper bound if (fabs(theta_) > 1.0e-6 || (specialOptions_ & 4) != 0) { upperOut_ = abcNonLinearCost_->nearest(pivotRow_, newValue); } else { upperOut_ = newValue; } } else { directionOut_ = 1; // to lower bound if (fabs(theta_) > 1.0e-6 || (specialOptions_ & 4) != 0) { lowerOut_ = abcNonLinearCost_->nearest(pivotRow_, newValue); } else { lowerOut_ = newValue; } } dualOut_ = reducedCost(sequenceOut_); } else if (maximumMovement < 1.0e20) { // flip pivotRow_ = -2; // so we can tell its a flip sequenceOut_ = sequenceIn_; valueOut_ = valueIn_; dualOut_ = dualIn_; lowerOut_ = lowerIn_; upperOut_ = upperIn_; alpha_ = 0.0; if (way < 0.0) { directionOut_ = 1; // to lower bound theta_ = lowerOut_ - valueOut_; } else { directionOut_ = -1; // to upper bound theta_ = upperOut_ - valueOut_; } } double theta1 = CoinMax(theta_, 1.0e-12); double theta2 = numberIterations_ * abcNonLinearCost_->averageTheta(); // Set average theta abcNonLinearCost_->setAverageTheta((theta1 + theta2) / (static_cast (numberIterations_ + 1))); //if (numberIterations_%1000==0) //printf("average theta is %g\n",abcNonLinearCost_->averageTheta()); // clear arrays CoinZeroN(spare, numberRemaining); CoinZeroN(rhs, numberRemaining); // put back original bounds etc CoinMemcpyN(index, numberRemaining, rhsArray->getIndices()); rhsArray->setNumElements(numberRemaining); //rhsArray->setPacked(); abcNonLinearCost_->goBackAll(rhsArray); rhsArray->clear(); } /* Row array has pivot column This chooses pivot row. For speed, we may need to go to a bucket approach when many variables go through bounds On exit rhsArray will have changes in costs of basic variables */ void AbcSimplexPrimal::primalRow(CoinIndexedVector * rowArray, CoinIndexedVector * rhsArray, CoinIndexedVector * spareArray, pivotStruct & stuff) { int valuesPass=stuff.valuesPass_; double dualIn=stuff.dualIn_; double lowerIn=stuff.lowerIn_; double upperIn=stuff.upperIn_; double valueIn=stuff.valueIn_; int sequenceIn=stuff.sequenceIn_; int directionIn=stuff.directionIn_; int pivotRow=-1; int sequenceOut=-1; double dualOut=0.0; double lowerOut=0.0; double upperOut=0.0; double valueOut=0.0; double theta; double alpha; int directionOut=0; if (valuesPass) { dualIn = abcCost_[sequenceIn]; double * work = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); int iIndex; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; dualIn -= alpha * costBasic_[iRow]; } // determine direction here if (dualIn < -dualTolerance_) { directionIn = 1; } else if (dualIn > dualTolerance_) { directionIn = -1; } else { // towards nearest bound if (valueIn - lowerIn < upperIn - valueIn) { directionIn = -1; dualIn = dualTolerance_; } else { directionIn = 1; dualIn = -dualTolerance_; } } } // sequence stays as row number until end pivotRow = -1; int numberRemaining = 0; double totalThru = 0.0; // for when variables flip // Allow first few iterations to take tiny double acceptablePivot = 1.0e-1 * acceptablePivot_; if (numberIterations_ > 100) acceptablePivot = acceptablePivot_; if (abcFactorization_->pivots() > 10) acceptablePivot = 1.0e+3 * acceptablePivot_; // if we have iterated be more strict else if (abcFactorization_->pivots() > 5) acceptablePivot = 1.0e+2 * acceptablePivot_; // if we have iterated be slightly more strict else if (abcFactorization_->pivots()) acceptablePivot = acceptablePivot_; // relax double bestEverPivot = acceptablePivot; int lastPivotRow = -1; double lastPivot = 0.0; double lastTheta = 1.0e50; // use spareArrays to put ones looked at in // First one is list of candidates // We could compress if we really know we won't need any more // Second array has current set of pivot candidates // with a backup list saved in double * part of indexed vector // pivot elements double * spare; // indices int * index; spareArray->clear(); spare = spareArray->denseVector(); index = spareArray->getIndices(); // we also need somewhere for effective rhs double * rhs = rhsArray->denseVector(); // and we can use indices to point to alpha // that way we can store fabs(alpha) int * indexPoint = rhsArray->getIndices(); //int numberFlip=0; // Those which may change if flips /* First we get a list of possible pivots. We can also see if the problem looks unbounded. At first we increase theta and see what happens. We start theta at a reasonable guess. If in right area then we do bit by bit. We save possible pivot candidates */ // do first pass to get possibles // We can also see if unbounded double * work = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); // we need to swap sign if coming in from ub double way = directionIn; double maximumMovement; if (way > 0.0) maximumMovement = CoinMin(1.0e30, upperIn - valueIn); else maximumMovement = CoinMin(1.0e30, valueIn - lowerIn); double averageTheta = abcNonLinearCost_->averageTheta(); double tentativeTheta = CoinMin(10.0 * averageTheta, maximumMovement); double upperTheta = maximumMovement; if (tentativeTheta > 0.5 * maximumMovement) tentativeTheta = maximumMovement; bool thetaAtMaximum = tentativeTheta == maximumMovement; // In case tiny bounds increase if (maximumMovement < 1.0) tentativeTheta *= 1.1; double dualCheck = fabs(dualIn); // but make a bit more pessimistic dualCheck = CoinMax(dualCheck - 100.0 * dualTolerance_, 0.99 * dualCheck); int iIndex; while (true) { totalThru = 0.0; // We also re-compute reduced cost numberRemaining = 0; dualIn = abcCost_[sequenceIn]; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; dualIn -= alpha * costBasic_[iRow]; alpha *= way; double oldValue = solutionBasic_[iRow]; // get where in bound sequence // note that after this alpha is actually fabs(alpha) bool possible; // do computation same way as later on in primal if (alpha > 0.0) { // basic variable going towards lower bound double bound = lowerBasic_[iRow]; // must be exactly same as when used double change = tentativeTheta * alpha; possible = (oldValue - change) <= bound + primalTolerance_; oldValue -= bound; } else { // basic variable going towards upper bound double bound = upperBasic_[iRow]; // must be exactly same as when used double change = tentativeTheta * alpha; possible = (oldValue - change) >= bound - primalTolerance_; oldValue = bound - oldValue; alpha = - alpha; } double value; if (possible) { value = oldValue - upperTheta * alpha; #ifdef CLP_USER_DRIVEN1 if(!userChoiceValid1(this,iPivot,oldValue, upperTheta,alpha,work[iRow]*way)) value =0.0; // say can't use #endif if (value < -primalTolerance_ && alpha >= acceptablePivot) { upperTheta = (oldValue + primalTolerance_) / alpha; } // add to list spare[numberRemaining] = alpha; rhs[numberRemaining] = oldValue; indexPoint[numberRemaining] = iIndex; index[numberRemaining++] = iRow; totalThru += alpha; setActive(iRow); } } if (upperTheta < maximumMovement && totalThru*infeasibilityCost_ >= 1.0001 * dualCheck) { // Can pivot here break; } else if (!thetaAtMaximum) { //printf("Going round with average theta of %g\n",averageTheta); tentativeTheta = maximumMovement; thetaAtMaximum = true; // seems to be odd compiler error } else { break; } } totalThru = 0.0; theta = maximumMovement; bool goBackOne = false; //printf("%d remain out of %d\n",numberRemaining,number); int iTry = 0; if (numberRemaining && upperTheta < maximumMovement) { // First check if previously chosen one will work // first get ratio with tolerance for ( ; iTry < MAXTRY; iTry++) { upperTheta = maximumMovement; int iBest = -1; for (iIndex = 0; iIndex < numberRemaining; iIndex++) { double alpha = spare[iIndex]; double oldValue = rhs[iIndex]; double value = oldValue - upperTheta * alpha; #ifdef CLP_USER_DRIVEN1 int sequenceOut=abcPivotVariable_[index[iIndex]]; if(!userChoiceValid1(this,sequenceOut,oldValue, upperTheta,alpha, 0.0)) value =0.0; // say can't use #endif if (value < -primalTolerance_ && alpha >= acceptablePivot) { upperTheta = (oldValue + primalTolerance_) / alpha; iBest = iIndex; // just in case weird numbers } } // now look at best in this lot // But also see how infeasible small pivots will make double sumInfeasibilities = 0.0; double bestPivot = acceptablePivot; pivotRow = -1; for (iIndex = 0; iIndex < numberRemaining; iIndex++) { int iRow = index[iIndex]; double alpha = spare[iIndex]; double oldValue = rhs[iIndex]; double value = oldValue - upperTheta * alpha; if (value <= 0 || iBest == iIndex) { // how much would it cost to go thru and modify bound double trueAlpha = way * work[iRow]; totalThru += abcNonLinearCost_->changeInCost(iRow, trueAlpha, rhs[iIndex]); setActive(iRow); if (alpha > bestPivot) { bestPivot = alpha; theta = oldValue / bestPivot; pivotRow = iRow; } else if (alpha < acceptablePivot #ifdef CLP_USER_DRIVEN1 ||!userChoiceValid1(this,abcPivotVariable_[index[iIndex]], oldValue,upperTheta,alpha,0.0) #endif ) { if (value < -primalTolerance_) sumInfeasibilities += -value - primalTolerance_; } } } if (bestPivot < 0.1 * bestEverPivot && bestEverPivot > 1.0e-6 && bestPivot < 1.0e-3) { // back to previous one goBackOne = true; break; } else if (pivotRow == -1 && upperTheta > largeValue_) { if (lastPivot > acceptablePivot) { // back to previous one goBackOne = true; } else { // can only get here if all pivots so far too small } break; } else if (totalThru >= dualCheck) { if (sumInfeasibilities > primalTolerance_ && !abcNonLinearCost_->numberInfeasibilities()) { // Looks a bad choice if (lastPivot > acceptablePivot) { goBackOne = true; } else { // say no good dualIn = 0.0; } } break; // no point trying another loop } else { lastPivotRow = pivotRow; lastTheta = theta; if (bestPivot > bestEverPivot) bestEverPivot = bestPivot; } } // can get here without pivotRow set but with lastPivotRow if (goBackOne || (pivotRow < 0 && lastPivotRow >= 0)) { // back to previous one pivotRow = lastPivotRow; theta = lastTheta; } } else if (pivotRow < 0 && maximumMovement > 1.0e20) { // looks unbounded valueOut = COIN_DBL_MAX; // say odd if (abcNonLinearCost_->numberInfeasibilities()) { // but infeasible?? // move variable but don't pivot tentativeTheta = 1.0e50; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; alpha *= way; double oldValue = solutionBasic_[iRow]; // get where in bound sequence // note that after this alpha is actually fabs(alpha) if (alpha > 0.0) { // basic variable going towards lower bound double bound = lowerBasic_[iRow]; oldValue -= bound; } else { // basic variable going towards upper bound double bound = upperBasic_[iRow]; oldValue = bound - oldValue; alpha = - alpha; } if (oldValue - tentativeTheta * alpha < 0.0) { tentativeTheta = oldValue / alpha; } } // If free in then see if we can get to 0.0 if (lowerIn < -1.0e20 && upperIn > 1.0e20) { if (dualIn * valueIn > 0.0) { if (fabs(valueIn) < 1.0e-2 && (tentativeTheta < fabs(valueIn) || tentativeTheta > 1.0e20)) { tentativeTheta = fabs(valueIn); } } } if (tentativeTheta < 1.0e10) valueOut = valueIn + way * tentativeTheta; } } if (pivotRow >= 0) { alpha = work[pivotRow]; // translate to sequence sequenceOut = abcPivotVariable_[pivotRow]; valueOut = solutionBasic_[pivotRow]; lowerOut = lowerBasic_[pivotRow]; upperOut = upperBasic_[pivotRow]; // Movement should be minimum for anti-degeneracy - unless // fixed variable out double minimumTheta; if (upperOut > lowerOut) minimumTheta = minimumThetaMovement_; else minimumTheta = 0.0; // But can't go infeasible double distance; if (alpha * way > 0.0) distance = valueOut - lowerOut; else distance = upperOut - valueOut; if (distance - minimumTheta * fabs(alpha) < -primalTolerance_) minimumTheta = CoinMax(0.0, (distance + 0.5 * primalTolerance_) / fabs(alpha)); // will we need to increase tolerance //double largestInfeasibility = primalTolerance_; if (theta < minimumTheta && (specialOptions_ & 4) == 0 && !valuesPass) { theta = minimumTheta; //for (iIndex = 0; iIndex < numberRemaining - numberRemaining; iIndex++) { //largestInfeasibility = CoinMax(largestInfeasibility, // -(rhs[iIndex] - spare[iIndex] * theta)); //} //primalTolerance_ = CoinMax(primalTolerance_, largestInfeasibility); } // Need to look at all in some cases if (theta > tentativeTheta) { for (iIndex = 0; iIndex < number; iIndex++) setActive(which[iIndex]); } if (way < 0.0) theta = - theta; double newValue = valueOut - theta * alpha; // If 4 bit set - Force outgoing variables to exact bound (primal) if (alpha * way < 0.0) { directionOut = -1; // to upper bound if (fabs(theta) > 1.0e-6 || (specialOptions_ & 4) != 0) { upperOut = abcNonLinearCost_->nearest(pivotRow, newValue); } else { upperOut = newValue; } } else { directionOut = 1; // to lower bound if (fabs(theta) > 1.0e-6 || (specialOptions_ & 4) != 0) { lowerOut = abcNonLinearCost_->nearest(pivotRow, newValue); } else { lowerOut = newValue; } } dualOut = reducedCost(sequenceOut); } else if (maximumMovement < 1.0e20) { // flip pivotRow = -2; // so we can tell its a flip sequenceOut = sequenceIn; valueOut = valueIn; dualOut = dualIn; lowerOut = lowerIn; upperOut = upperIn; alpha = 0.0; if (way < 0.0) { directionOut = 1; // to lower bound theta = lowerOut - valueOut; } else { directionOut = -1; // to upper bound theta = upperOut - valueOut; } } // clear arrays CoinZeroN(spare, numberRemaining); CoinZeroN(rhs, numberRemaining); // put back original bounds etc CoinMemcpyN(index, numberRemaining, rhsArray->getIndices()); rhsArray->setNumElements(numberRemaining); abcNonLinearCost_->goBackAll(rhsArray); rhsArray->clear(); stuff.theta_=theta; stuff.alpha_=alpha; stuff.dualIn_=dualIn; stuff.dualOut_=dualOut; stuff.lowerOut_=lowerOut; stuff.upperOut_=upperOut; stuff.valueOut_=valueOut; stuff.sequenceOut_=sequenceOut; stuff.directionOut_=directionOut; stuff.pivotRow_=pivotRow; } /* Chooses primal pivot column updateArray has cost updates (also use pivotRow_ from last iteration) Would be faster with separate region to scan and will have this (with square of infeasibility) when steepest For easy problems we can just choose one of the first columns we look at */ void AbcSimplexPrimal::primalColumn(CoinPartitionedVector * updates, CoinPartitionedVector * spareRow2, CoinPartitionedVector * spareColumn1) { for (int i=0;i<4;i++) multipleSequenceIn_[i]=-1; sequenceIn_ = abcPrimalColumnPivot_->pivotColumn(updates, spareRow2, spareColumn1); if (sequenceIn_ >= 0) { valueIn_ = abcSolution_[sequenceIn_]; dualIn_ = abcDj_[sequenceIn_]; lowerIn_ = abcLower_[sequenceIn_]; upperIn_ = abcUpper_[sequenceIn_]; if (dualIn_ > 0.0) directionIn_ = -1; else directionIn_ = 1; } else { sequenceIn_ = -1; } } /* The primals are updated by the given array. Returns number of infeasibilities. After rowArray will have list of cost changes */ int AbcSimplexPrimal::updatePrimalsInPrimal(CoinIndexedVector * rowArray, double theta, double & objectiveChange, int valuesPass) { // Cost on pivot row may change - may need to change dualIn double oldCost = 0.0; if (pivotRow_ >= 0) oldCost = abcCost_[sequenceOut_]; double * work = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); int newNumber = 0; abcNonLinearCost_->setChangeInCost(0.0); // allow for case where bound+tolerance == bound //double tolerance = 0.999999*primalTolerance_; double relaxedTolerance = 1.001 * primalTolerance_; int iIndex; if (!valuesPass) { for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; work[iRow] = 0.0; int iPivot = abcPivotVariable_[iRow]; double change = theta * alpha; double value = abcSolution_[iPivot] - change; abcSolution_[iPivot] = value; value = solutionBasic_[iRow] - change; solutionBasic_[iRow] = value; #ifndef NDEBUG // check if not active then okay if (!active(iRow) && (specialOptions_ & 4) == 0 && pivotRow_ != -1) { // But make sure one going out is feasible if (change > 0.0) { // going down if (value <= abcLower_[iPivot] + primalTolerance_) { if (iPivot == sequenceOut_ && value > abcLower_[iPivot] - relaxedTolerance) value = abcLower_[iPivot]; //double difference = abcNonLinearCost_->setOneBasic(iRow, value); //assert (!difference || fabs(change) > 1.0e9); } } else { // going up if (value >= abcUpper_[iPivot] - primalTolerance_) { if (iPivot == sequenceOut_ && value < abcUpper_[iPivot] + relaxedTolerance) value = abcUpper_[iPivot]; //double difference = abcNonLinearCost_->setOneBasic(iRow, value); //assert (!difference || fabs(change) > 1.0e9); } } } #endif if (active(iRow) || theta_ < 0.0) { clearActive(iRow); // But make sure one going out is feasible if (change > 0.0) { // going down if (value <= abcLower_[iPivot] + primalTolerance_) { if (iPivot == sequenceOut_ && value >= abcLower_[iPivot] - relaxedTolerance) value = abcLower_[iPivot]; double difference = abcNonLinearCost_->setOneBasic(iRow, value); if (difference) { work[iRow] = difference; //change reduced cost on this //abcDj_[iPivot] = -difference; which[newNumber++] = iRow; } } } else { // going up if (value >= abcUpper_[iPivot] - primalTolerance_) { if (iPivot == sequenceOut_ && value < abcUpper_[iPivot] + relaxedTolerance) value = abcUpper_[iPivot]; double difference = abcNonLinearCost_->setOneBasic(iRow, value); if (difference) { work[iRow] = difference; //change reduced cost on this //abcDj_[iPivot] = -difference; which[newNumber++] = iRow; } } } } } } else { // values pass so look at all for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; work[iRow] = 0.0; int iPivot = abcPivotVariable_[iRow]; double change = theta * alpha; double value = abcSolution_[iPivot] - change; abcSolution_[iPivot] = value; value = solutionBasic_[iRow] - change; solutionBasic_[iRow] = value; clearActive(iRow); // But make sure one going out is feasible if (change > 0.0) { // going down if (value <= abcLower_[iPivot] + primalTolerance_) { if (iPivot == sequenceOut_ && value > abcLower_[iPivot] - relaxedTolerance) value = abcLower_[iPivot]; double difference = abcNonLinearCost_->setOneBasic(iRow, value); if (difference) { work[iRow] = difference; //change reduced cost on this abcDj_[iPivot] = -difference; which[newNumber++] = iRow; } } } else { // going up if (value >= abcUpper_[iPivot] - primalTolerance_) { if (iPivot == sequenceOut_ && value < abcUpper_[iPivot] + relaxedTolerance) value = abcUpper_[iPivot]; double difference = abcNonLinearCost_->setOneBasic(iRow, value); if (difference) { work[iRow] = difference; //change reduced cost on this abcDj_[iPivot] = -difference; which[newNumber++] = iRow; } } } } } objectiveChange += abcNonLinearCost_->changeInCost(); //rowArray->setPacked(); if (pivotRow_ >= 0) { double dualIn = dualIn_ + (oldCost - abcCost_[sequenceOut_]); // update change vector to include pivot if (!work[pivotRow_]) which[newNumber++] = pivotRow_; work[pivotRow_] -= dualIn; // above seems marginally better for updates - below should also work //work[pivotRow_] = -dualIn_; } rowArray->setNumElements(newNumber); return 0; } // Perturbs problem void AbcSimplexPrimal::perturb(int /*type*/) { if (perturbation_ > 100) return; //perturbed already if (perturbation_ == 100) perturbation_ = 50; // treat as normal int savePerturbation = perturbation_; int i; copyFromSaved(14); // copy bounds and costs // look at element range double smallestNegative; double largestNegative; double smallestPositive; double largestPositive; matrix_->rangeOfElements(smallestNegative, largestNegative, smallestPositive, largestPositive); smallestPositive = CoinMin(fabs(smallestNegative), smallestPositive); largestPositive = CoinMax(fabs(largestNegative), largestPositive); double elementRatio = largestPositive / smallestPositive; if ((!numberIterations_ ||initialSumInfeasibilities_==1.23456789e-5)&& perturbation_ == 50) { // See if we need to perturb int numberTotal = CoinMax(numberRows_, numberColumns_); double * sort = new double[numberTotal]; int nFixed = 0; for (i = 0; i < numberRows_; i++) { double lo = fabs(rowLower_[i]); double up = fabs(rowUpper_[i]); double value = 0.0; if (lo && lo < 1.0e20) { if (up && up < 1.0e20) { value = 0.5 * (lo + up); if (lo == up) nFixed++; } else { value = lo; } } else { if (up && up < 1.0e20) value = up; } sort[i] = value; } std::sort(sort, sort + numberRows_); int number = 1; double last = sort[0]; for (i = 1; i < numberRows_; i++) { if (last != sort[i]) number++; last = sort[i]; } #ifdef KEEP_GOING_IF_FIXED //printf("ratio number diff rhs %g (%d %d fixed), element ratio %g\n",((double)number)/((double) numberRows_), // numberRows_,nFixed,elementRatio); #endif if (number * 4 > numberRows_ || elementRatio > 1.0e12) { perturbation_ = 100; delete [] sort; // Make sure feasible bounds if (abcNonLinearCost_) { abcNonLinearCost_->refresh(); abcNonLinearCost_->checkInfeasibilities(); //abcNonLinearCost_->feasibleBounds(); } moveToBasic(); return; // good enough } number = 0; #ifdef KEEP_GOING_IF_FIXED if (!integerType_) { // look at columns nFixed = 0; for (i = 0; i < numberColumns_; i++) { double lo = fabs(columnLower_[i]); double up = fabs(columnUpper_[i]); double value = 0.0; if (lo && lo < 1.0e20) { if (up && up < 1.0e20) { value = 0.5 * (lo + up); if (lo == up) nFixed++; } else { value = lo; } } else { if (up && up < 1.0e20) value = up; } sort[i] = value; } std::sort(sort, sort + numberColumns_); number = 1; last = sort[0]; for (i = 1; i < numberColumns_; i++) { if (last != sort[i]) number++; last = sort[i]; } //printf("cratio number diff bounds %g (%d %d fixed)\n",((double)number)/((double) numberColumns_), // numberColumns_,nFixed); } #endif delete [] sort; if (number * 4 > numberColumns_) { perturbation_ = 100; // Make sure feasible bounds if (abcNonLinearCost_) { abcNonLinearCost_->refresh(); abcNonLinearCost_->checkInfeasibilities(); //abcNonLinearCost_->feasibleBounds(); } moveToBasic(); return; // good enough } } // primal perturbation double perturbation = 1.0e-20; double bias = 1.0; int numberNonZero = 0; // maximum fraction of rhs/bounds to perturb double maximumFraction = 1.0e-5; double overallMultiplier= (perturbation_==50||perturbation_>54) ? 2.0 : 0.2; #ifdef HEAVY_PERTURBATION if (perturbation_==50) perturbation_=HEAVY_PERTURBATION; #endif if (perturbation_ >= 50) { perturbation = 1.0e-4; for (i = 0; i < numberColumns_ + numberRows_; i++) { if (abcUpper_[i] > abcLower_[i] + primalTolerance_) { double lowerValue, upperValue; if (abcLower_[i] > -1.0e20) lowerValue = fabs(abcLower_[i]); else lowerValue = 0.0; if (abcUpper_[i] < 1.0e20) upperValue = fabs(abcUpper_[i]); else upperValue = 0.0; double value = CoinMax(fabs(lowerValue), fabs(upperValue)); value = CoinMin(value, abcUpper_[i] - abcLower_[i]); #if 1 if (value) { perturbation += value; numberNonZero++; } #else perturbation = CoinMax(perturbation, value); #endif } } if (numberNonZero) perturbation /= static_cast (numberNonZero); else perturbation = 1.0e-1; if (perturbation_ > 50 && perturbation_ < 55) { // reduce while (perturbation_ < 55) { perturbation_++; perturbation *= 0.25; bias *= 0.25; } perturbation_ = 50; } else if (perturbation_ >= 55 && perturbation_ < 60) { // increase while (perturbation_ > 55) { overallMultiplier *= 1.2; perturbation_--; perturbation *= 4.0; } perturbation_ = 50; } } else if (perturbation_ < 100) { perturbation = pow(10.0, perturbation_); // user is in charge maximumFraction = 1.0; } double largestZero = 0.0; double largest = 0.0; double largestPerCent = 0.0; bool printOut = (handler_->logLevel() == 63); printOut = false; //off // Check if all slack int number = 0; int iSequence; for (iSequence = 0; iSequence < numberRows_; iSequence++) { if (getInternalStatus(iSequence) == basic) number++; } if (rhsScale_ > 100.0) { // tone down perturbation maximumFraction *= 0.1; } if (savePerturbation==51) { perturbation = CoinMin(0.1,perturbation); maximumFraction *=0.1; } //if (number != numberRows_) //type = 1; // modify bounds // Change so at least 1.0e-5 and no more than 0.1 // For now just no more than 0.1 // printf("Pert type %d perturbation %g, maxF %g\n",type,perturbation,maximumFraction); // seems much slower??? //const double * COIN_RESTRICT perturbationArray = perturbationSaved_; // Make sure feasible bounds if (abcNonLinearCost_&&true) { abcNonLinearCost_->refresh(); abcNonLinearCost_->checkInfeasibilities(primalTolerance_); //abcNonLinearCost_->feasibleBounds(); } double tolerance = 100.0 * primalTolerance_; int numberChanged=0; // Set bit if fixed for (int i=0;i lowerValue + tolerance) { double solutionValue = abcSolution_[iSequence]; double difference = upperValue - lowerValue; difference = CoinMin(difference, perturbation); difference = CoinMin(difference, fabs(solutionValue) + 1.0); double value = maximumFraction * (difference + bias); value = CoinMin(value, 0.1); value = CoinMax(value,primalTolerance_); double perturbationValue=overallMultiplier*randomNumberGenerator_.randomDouble(); value *= perturbationValue; if (solutionValue - lowerValue <= primalTolerance_) { abcLower_[iSequence] -= value; // change correct saved value if (abcNonLinearCost_->getCurrentStatus(iSequence)==CLP_FEASIBLE) abcPerturbation_[iSequence]=abcLower_[iSequence]; else abcPerturbation_[iSequence+numberTotal_]=abcLower_[iSequence]; } else if (upperValue - solutionValue <= primalTolerance_) { abcUpper_[iSequence] += value; // change correct saved value if (abcNonLinearCost_->getCurrentStatus(iSequence)==CLP_FEASIBLE) abcPerturbation_[iSequence+numberTotal_]=abcUpper_[iSequence]; else abcPerturbation_[iSequence]=abcUpper_[iSequence]; } else { #if 0 if (iSequence >= numberColumns_) { // may not be at bound - but still perturb (unless free) if (upperValue > 1.0e30 && lowerValue < -1.0e30) value = 0.0; else value = - value; // as -1.0 in matrix } else { value = 0.0; } #else value = 0.0; #endif } if (value) { numberChanged++; if (printOut) printf("col %d lower from %g to %g, upper from %g to %g\n", iSequence, abcLower_[iSequence], lowerValue, abcUpper_[iSequence], upperValue); if (solutionValue) { largest = CoinMax(largest, value); if (value > (fabs(solutionValue) + 1.0)*largestPerCent) largestPerCent = value / (fabs(solutionValue) + 1.0); } else { largestZero = CoinMax(largestZero, value); } } } } } if (!numberChanged) { // do non basic columns? for (iSequence = 0; iSequence < maximumAbcNumberRows_ + numberColumns_; iSequence++) { if (getInternalStatus(iSequence) != basic) { if ((internalStatus_[i] &128)!=0) continue; double lowerValue = abcLower_[iSequence]; double upperValue = abcUpper_[iSequence]; if (upperValue > lowerValue + tolerance) { double solutionValue = abcSolution_[iSequence]; double difference = upperValue - lowerValue; difference = CoinMin(difference, perturbation); difference = CoinMin(difference, fabs(solutionValue) + 1.0); double value = maximumFraction * (difference + bias); value = CoinMin(value, 0.1); value = CoinMax(value,primalTolerance_); double perturbationValue=overallMultiplier*randomNumberGenerator_.randomDouble(); value *= perturbationValue; if (solutionValue - lowerValue <= primalTolerance_) { abcLower_[iSequence] -= value; // change correct saved value if (abcNonLinearCost_->getCurrentStatus(iSequence)==CLP_FEASIBLE) abcPerturbation_[iSequence]=abcLower_[iSequence]; else abcPerturbation_[iSequence+numberTotal_]=abcLower_[iSequence]; } else if (upperValue - solutionValue <= primalTolerance_) { abcUpper_[iSequence] += value; // change correct saved value if (abcNonLinearCost_->getCurrentStatus(iSequence)==CLP_FEASIBLE) abcPerturbation_[iSequence+numberTotal_]=abcUpper_[iSequence]; else abcPerturbation_[iSequence]=abcUpper_[iSequence]; } else { value = 0.0; } if (value) { if (printOut) printf("col %d lower from %g to %g, upper from %g to %g\n", iSequence, abcLower_[iSequence], lowerValue, abcUpper_[iSequence], upperValue); if (solutionValue) { largest = CoinMax(largest, value); if (value > (fabs(solutionValue) + 1.0)*largestPerCent) largestPerCent = value / (fabs(solutionValue) + 1.0); } else { largestZero = CoinMax(largestZero, value); } } } } } } // Clean up for (i = 0; i < numberColumns_ + numberRows_; i++) { internalStatus_[i] &= ~128; switch(getInternalStatus(i)) { case basic: break; case atUpperBound: abcSolution_[i] = abcUpper_[i]; break; case isFixed: case atLowerBound: abcSolution_[i] = abcLower_[i]; break; case isFree: break; case superBasic: break; } } handler_->message(CLP_SIMPLEX_PERTURB, messages_) << 100.0 * maximumFraction << perturbation << largest << 100.0 * largestPerCent << largestZero << CoinMessageEol; // redo nonlinear costs //delete abcNonLinearCost_;abcNonLinearCost_=new AbcNonLinearCost(this);//abort();// something elseabcNonLinearCost_->refresh(); moveToBasic(); if (!numberChanged) { // we changed nonbasic gutsOfPrimalSolution(3); // Make sure feasible bounds if (abcNonLinearCost_) { //abcNonLinearCost_->refresh(); abcNonLinearCost_->checkInfeasibilities(primalTolerance_); //abcNonLinearCost_->feasibleBounds(); } abcPrimalColumnPivot_->saveWeights(this, 3); } // say perturbed perturbation_ = 101; } // un perturb bool AbcSimplexPrimal::unPerturb() { if (perturbation_ != 101) return false; // put back original bounds and costs copyFromSaved(); // copy bounds to perturbation CoinAbcMemcpy(abcPerturbation_,abcLower_,numberTotal_); CoinAbcMemcpy(abcPerturbation_+numberTotal_,abcUpper_,numberTotal_); //sanityCheck(); // unflag unflag(); abcProgress_.clearTimesFlagged(); // get a valid nonlinear cost function delete abcNonLinearCost_; abcNonLinearCost_ = new AbcNonLinearCost(this); perturbation_ = 102; // stop any further perturbation // move non basic variables to new bounds abcNonLinearCost_->checkInfeasibilities(0.0); gutsOfSolution(3); abcNonLinearCost_->checkInfeasibilities(primalTolerance_); // Try using dual return abcNonLinearCost_->sumInfeasibilities()!=0.0; } // Unflag all variables and return number unflagged int AbcSimplexPrimal::unflag() { int i; int number = numberRows_ + numberColumns_; int numberFlagged = 0; // we can't really trust infeasibilities if there is dual error // allow tolerance bigger than standard to check on duals double relaxedToleranceD = dualTolerance_ + CoinMin(1.0e-2, 10.0 * largestDualError_); for (i = 0; i < number; i++) { if (flagged(i)) { clearFlagged(i); // only say if reasonable dj if (fabs(abcDj_[i]) > relaxedToleranceD) numberFlagged++; } } #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() > 2 && numberFlagged && objective_->type() > 1) printf("%d unflagged\n", numberFlagged); #endif return numberFlagged; } // Do not change infeasibility cost and always say optimal void AbcSimplexPrimal::alwaysOptimal(bool onOff) { if (onOff) specialOptions_ |= 1; else specialOptions_ &= ~1; } bool AbcSimplexPrimal::alwaysOptimal() const { return (specialOptions_ & 1) != 0; } // Flatten outgoing variables i.e. - always to exact bound void AbcSimplexPrimal::exactOutgoing(bool onOff) { if (onOff) specialOptions_ |= 4; else specialOptions_ &= ~4; } bool AbcSimplexPrimal::exactOutgoing() const { return (specialOptions_ & 4) != 0; } /* Reasons to come out (normal mode/user mode): -1 normal -2 factorize now - good iteration/ NA -3 slight inaccuracy - refactorize - iteration done/ same but factor done -4 inaccuracy - refactorize - no iteration/ NA -5 something flagged - go round again/ pivot not possible +2 looks unbounded +3 max iterations (iteration done) */ int AbcSimplexPrimal::pivotResult(int ifValuesPass) { bool roundAgain = true; int returnCode = -1; // loop round if user setting and doing refactorization while (roundAgain) { roundAgain = false; returnCode = -1; pivotRow_ = -1; sequenceOut_ = -1; usefulArray_[arrayForFtran_].clear(); // we found a pivot column // update the incoming column unpack(usefulArray_[arrayForFtran_]); // save reduced cost double saveDj = dualIn_; abcFactorization_->updateColumnFT(usefulArray_[arrayForFtran_]); // do ratio test and re-compute dj #ifdef CLP_USER_DRIVEN if ((moreSpecialOptions_ & 512) == 0) { #endif primalRow(&usefulArray_[arrayForFtran_], &usefulArray_[arrayForFlipBounds_], &usefulArray_[arrayForTableauRow_], ifValuesPass); #ifdef CLP_USER_DRIVEN // user can tell which use it is int status = eventHandler_->event(ClpEventHandler::pivotRow); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::pivotRow; break; } } else { int status = eventHandler_->event(ClpEventHandler::pivotRow); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::pivotRow; break; } } #endif if (ifValuesPass) { saveDj = dualIn_; //assert (fabs(alpha_)>=1.0e-5||(objective_->type()<2||!objective_->activated())||pivotRow_==-2); if (pivotRow_ == -1 || (pivotRow_ >= 0 && fabs(alpha_) < 1.0e-5)) { if(fabs(dualIn_) < 1.0e2 * dualTolerance_ && objective_->type() < 2) { // try other way directionIn_ = -directionIn_; primalRow(&usefulArray_[arrayForFtran_], &usefulArray_[arrayForFlipBounds_], &usefulArray_[arrayForTableauRow_], 0); } if (pivotRow_ == -1 || (pivotRow_ >= 0 && fabs(alpha_) < 1.0e-5)) { // reject it char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); abcProgress_.incrementTimesFlagged(); abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious clearAll(); pivotRow_ = -1; returnCode = -5; break; } } } double checkValue = 1.0e-2; if (largestDualError_ > 1.0e-5) checkValue = 1.0e-1; double test2 = dualTolerance_; double test1 = 1.0e-20; #if 0 //def FEB_TRY if (abcFactorization_->pivots() < 1) { test1 = -1.0e-4; if ((saveDj < 0.0 && dualIn_ < -1.0e-5 * dualTolerance_) || (saveDj > 0.0 && dualIn_ > 1.0e-5 * dualTolerance_)) test2 = 0.0; // allow through } #endif if (!ifValuesPass && (saveDj * dualIn_ < test1 || fabs(saveDj - dualIn_) > checkValue*(1.0 + fabs(saveDj)) || fabs(dualIn_) < test2)) { if (!(saveDj * dualIn_ > 0.0 && CoinMin(fabs(saveDj), fabs(dualIn_)) > 1.0e5)) { char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_PRIMAL_DJ, messages_) << x << sequenceWithin(sequenceIn_) << saveDj << dualIn_ << CoinMessageEol; if(lastGoodIteration_ != numberIterations_) { clearAll(); pivotRow_ = -1; // say no weights update returnCode = -4; if(lastGoodIteration_ + 1 == numberIterations_) { // not looking wonderful - try cleaning bounds // put non-basics to bounds in case tolerance moved abcNonLinearCost_->checkInfeasibilities(0.0); } sequenceOut_ = -1; sequenceIn_=-1; if (abcFactorization_->pivots()<10&&abcFactorization_->pivotTolerance()<0.25) abcFactorization_->saferTolerances(1.0,-1.03); break; } else { // take on more relaxed criterion if (saveDj * dualIn_ < test1 || fabs(saveDj - dualIn_) > 2.0e-1 * (1.0 + fabs(dualIn_)) || fabs(dualIn_) < test2) { // need to reject something char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); abcProgress_.incrementTimesFlagged(); #if 1 //def FEB_TRY // Make safer? double tolerance=abcFactorization_->pivotTolerance(); abcFactorization_->saferTolerances (1.0, -1.03); #endif abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious clearAll(); pivotRow_ = -1; returnCode = -5; if(tolerancepivotTolerance()) returnCode=-4; sequenceOut_ = -1; sequenceIn_=-1; break; } } } else { //printf("%d %g %g\n",numberIterations_,saveDj,dualIn_); } } if (pivotRow_ >= 0) { #ifdef CLP_USER_DRIVEN1 // Got good pivot - may need to unflag stuff userChoiceWasGood(this); #endif // if stable replace in basis // check update //abcFactorization_->checkReplacePart1a(&usefulArray_[arrayForReplaceColumn_],pivotRow_); //usefulArray_[arrayForReplaceColumn_].print(); ftAlpha_=abcFactorization_->checkReplacePart1(&usefulArray_[arrayForReplaceColumn_],pivotRow_); int updateStatus=abcFactorization_->checkReplacePart2(pivotRow_,btranAlpha_,alpha_,ftAlpha_); abcFactorization_->replaceColumnPart3(this, &usefulArray_[arrayForReplaceColumn_], &usefulArray_[arrayForFtran_], pivotRow_, ftAlpha_?ftAlpha_:alpha_); // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && lastGoodIteration_ == numberIterations_ && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4) { // slight error if (abcFactorization_->pivots() > 5 || updateStatus == 4) { returnCode = -3; } } else if (updateStatus == 2) { // major error // better to have small tolerance even if slower abcFactorization_->zeroTolerance(CoinMin(abcFactorization_->zeroTolerance(), 1.0e-15)); int maxFactor = abcFactorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ >> 1)); } // later we may need to unwind more e.g. fake bounds if(lastGoodIteration_ != numberIterations_) { clearAll(); pivotRow_ = -1; sequenceIn_ = -1; sequenceOut_ = -1; returnCode = -4; break; } else { // need to reject something char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); abcProgress_.incrementTimesFlagged(); abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious clearAll(); pivotRow_ = -1; sequenceIn_ = -1; sequenceOut_ = -1; returnCode = -5; break; } } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (abcFactorization_->pivots() < 0.5 * abcFactorization_->maximumPivots() && abcFactorization_->pivots() < 200) abcFactorization_->areaFactor( abcFactorization_->areaFactor() * 1.1); returnCode = -2; // factorize now } else if (updateStatus == 5) { problemStatus_ = -2; // factorize now } // here do part of steepest - ready for next iteration if (!ifValuesPass) abcPrimalColumnPivot_->updateWeights(&usefulArray_[arrayForFtran_]); } else { if (pivotRow_ == -1) { // no outgoing row is valid if (valueOut_ != COIN_DBL_MAX) { double objectiveChange = 0.0; theta_ = valueOut_ - valueIn_; updatePrimalsInPrimal(&usefulArray_[arrayForFtran_], theta_, objectiveChange, ifValuesPass); abcSolution_[sequenceIn_] += theta_; } #ifdef CLP_USER_DRIVEN1 /* Note if valueOut_ < COIN_DBL_MAX and theta_ reasonable then this may be a valid sub flip */ if(!userChoiceValid2(this)) { if (abcFactorization_->pivots()<5) { // flag variable char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); abcProgress_.incrementTimesFlagged(); abcProgress_.clearBadTimes(); roundAgain = true; continue; } else { // try refactorizing first returnCode = 4; //say looks odd but has iterated break; } } #endif if (!abcFactorization_->pivots() && acceptablePivot_ <= 1.0e-8) { returnCode = 2; //say looks unbounded // do ray primalRay(&usefulArray_[arrayForFtran_]); } else { acceptablePivot_ = 1.0e-8; returnCode = 4; //say looks unbounded but has iterated } break; } else { // flipping from bound to bound } } double oldCost = 0.0; if (sequenceOut_ >= 0) oldCost = abcCost_[sequenceOut_]; // update primal solution double objectiveChange = 0.0; // after this usefulArray_[arrayForFtran_] is not empty - used to update djs #ifdef CLP_USER_DRIVEN if (theta_<0.0) { if (theta_>=-1.0e-12) theta_=0.0; //else //printf("negative theta %g\n",theta_); } #endif updatePrimalsInPrimal(&usefulArray_[arrayForFtran_], theta_, objectiveChange, ifValuesPass); double oldValue = valueIn_; if (directionIn_ == -1) { // as if from upper bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ -= fabs(theta_); } else { valueIn_ = lowerIn_; } } else { // as if from lower bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ += fabs(theta_); } else { valueIn_ = upperIn_; } } objectiveChange += dualIn_ * (valueIn_ - oldValue); // outgoing if (sequenceIn_ != sequenceOut_) { if (directionOut_ > 0) { valueOut_ = lowerOut_; } else { valueOut_ = upperOut_; } if(valueOut_ < abcLower_[sequenceOut_] - primalTolerance_) valueOut_ = abcLower_[sequenceOut_] - 0.9 * primalTolerance_; else if (valueOut_ > abcUpper_[sequenceOut_] + primalTolerance_) valueOut_ = abcUpper_[sequenceOut_] + 0.9 * primalTolerance_; // may not be exactly at bound and bounds may have changed // Make sure outgoing looks feasible directionOut_ = abcNonLinearCost_->setOneOutgoing(pivotRow_, valueOut_); // May have got inaccurate //if (oldCost!=abcCost_[sequenceOut_]) //printf("costchange on %d from %g to %g\n",sequenceOut_, // oldCost,abcCost_[sequenceOut_]); abcDj_[sequenceOut_] = abcCost_[sequenceOut_] - oldCost; // normally updated next iteration abcSolution_[sequenceOut_] = valueOut_; } // change cost and bounds on incoming if primal abcNonLinearCost_->setOne(sequenceIn_, valueIn_); int whatNext = housekeeping(/*objectiveChange*/); swapPrimalStuff(); if (whatNext == 1) { returnCode = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent returnCode = 3; } else if(numberIterations_ == lastGoodIteration_ + 2 * abcFactorization_->maximumPivots()) { // done a lot of flips - be safe returnCode = -2; // refactorize } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 3; } } } return returnCode; } /* Reasons to come out (normal mode/user mode): -1 normal -2 factorize now - good iteration/ NA -3 slight inaccuracy - refactorize - iteration done/ same but factor done -4 inaccuracy - refactorize - no iteration/ NA -5 something flagged - go round again/ pivot not possible +2 looks unbounded +3 max iterations (iteration done) */ int AbcSimplexPrimal::pivotResult4(int ifValuesPass) { int returnCode = -1; int numberMinor=0; int numberDone=0; CoinIndexedVector * vector[16]; pivotStruct stuff[4]; vector[0]=&usefulArray_[arrayForFtran_]; vector[1]=&usefulArray_[arrayForFlipBounds_]; vector[2]=&usefulArray_[arrayForTableauRow_]; vector[3]=&usefulArray_[arrayForBtran_]; /* For pricing we need to get a vector with difference in costs later we could modify code so only costBasic changed and store in first [4*x+1] array to go out the indices of changed plus at most four for pivots */ //double * saveCosts=CoinCopyOfArray(costBasic_,numberRows_); //double saveCostsIn[4]; for (int iMinor=0;iMinor<4;iMinor++) { int sequenceIn=multipleSequenceIn_[iMinor]; if (sequenceIn<0) break; stuff[iMinor].valuesPass_=ifValuesPass; stuff[iMinor].lowerIn_=abcLower_[sequenceIn]; stuff[iMinor].upperIn_=abcUpper_[sequenceIn]; stuff[iMinor].valueIn_=abcSolution_[sequenceIn]; stuff[iMinor].sequenceIn_=sequenceIn; //saveCostsIn[iMinor]=abcCost_[sequenceIn]; numberMinor++; if (iMinor) { vector[4*iMinor]=rowArray_[2*iMinor-2]; vector[4*iMinor+1]=rowArray_[2*iMinor-1]; vector[4*iMinor+2]=columnArray_[2*iMinor-2]; vector[4*iMinor+3]=columnArray_[2*iMinor-1]; } for (int i=0;i<4;i++) vector[4*iMinor+i]->checkClear(); unpack(*vector[4*iMinor],sequenceIn); } int numberLeft=numberMinor; // parallel (with cpu) for (int iMinor=1;iMinorupdateColumnFT(*vector[4*iMinor],*vector[4*iMinor+3],iMinor); } abcFactorization_->updateColumnFT(*vector[0],*vector[+3],0); cilk_sync; for (int iMinor=0;iMinorclear(); vector[4*jMinor+i]=vector[4*numberDo+i]; vector[4*numberDo+i]=NULL; } stuff[jMinor]=stuff[numberDo]; } } for (int jMinor=0;jMinorbestMovement) { bestMovement=movement; iBest=jMinor; } } #if 0 //ndef MULTIPLE_PRICE if (maximumIterations()!=100000) iBest=0; #endif if (iBest>=0) { dualIn_=stuff[iBest].dualIn_; dualOut_=stuff[iBest].dualOut_; lowerOut_=stuff[iBest].lowerOut_; upperOut_=stuff[iBest].upperOut_; valueOut_=stuff[iBest].valueOut_; sequenceOut_=stuff[iBest].sequenceOut_; sequenceIn_=stuff[iBest].sequenceIn_; lowerIn_=stuff[iBest].lowerIn_; upperIn_=stuff[iBest].upperIn_; valueIn_=stuff[iBest].valueIn_; directionIn_=stuff[iBest].directionIn_; directionOut_=stuff[iBest].directionOut_; pivotRow_=stuff[iBest].pivotRow_; theta_=stuff[iBest].theta_; alpha_=stuff[iBest].alpha_; #ifdef MULTIPLE_PRICE for (int i=0;i<4*numberLeft;i++) vector[i]->clear(); return 0; #endif // maybe do this on more? double theta1 = CoinMax(theta_, 1.0e-12); double theta2 = numberIterations_ * abcNonLinearCost_->averageTheta(); // Set average theta abcNonLinearCost_->setAverageTheta((theta1 + theta2) / (static_cast (numberIterations_ + 1))); if (pivotRow_ == -1 || (pivotRow_ >= 0 && fabs(alpha_) < 1.0e-5)) { if(fabs(dualIn_) < 1.0e2 * dualTolerance_) { // try other way stuff[iBest].directionIn_ = -directionIn_; stuff[iBest].valuesPass_=0; primalRow(vector[4*iBest],vector[4*iBest+1],vector[4*iBest+2],stuff[iBest]); dualIn_=stuff[iBest].dualIn_; dualOut_=stuff[iBest].dualOut_; lowerOut_=stuff[iBest].lowerOut_; upperOut_=stuff[iBest].upperOut_; valueOut_=stuff[iBest].valueOut_; sequenceOut_=stuff[iBest].sequenceOut_; sequenceIn_=stuff[iBest].sequenceIn_; lowerIn_=stuff[iBest].lowerIn_; upperIn_=stuff[iBest].upperIn_; valueIn_=stuff[iBest].valueIn_; directionIn_=stuff[iBest].directionIn_; directionOut_=stuff[iBest].directionOut_; pivotRow_=stuff[iBest].pivotRow_; theta_=stuff[iBest].theta_; alpha_=stuff[iBest].alpha_; } if (pivotRow_ == -1 || (pivotRow_ >= 0 && fabs(alpha_) < 1.0e-5)) { // reject it char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); abcProgress_.incrementTimesFlagged(); abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious clearAll(); pivotRow_ = -1; returnCode = -5; break; } } CoinIndexedVector * bestUpdate=NULL; if (pivotRow_ >= 0) { // Normal pivot // if stable replace in basis // check update CoinIndexedVector * tempVector[4]; for (int i=0;i<4;i++) tempVector[i] = vector[4*iBest+i]; returnCode = cilk_spawn doFTUpdate(tempVector); bestUpdate=tempVector[0]; // after this bestUpdate is not empty - used to update djs ?? cilk_spawn updatePrimalsInPrimal(*bestUpdate, theta_, ifValuesPass); numberDone++; numberLeft--; // throw away for (int i=0;i<4;i++) { vector[4*iBest+i]=vector[4*numberLeft+i]; vector[4*numberLeft+i]=NULL; } stuff[iBest]=stuff[numberLeft]; // update pi and other vectors and FT stuff // parallel (can go 8 way?) for (int jMinor=0;jMinorclear(); if (returnCode<-3) { clearAll(); break; } // end Normal pivot } else { // start Flip vector[4*iBest+3]->clear(); if (pivotRow_ == -1) { // no outgoing row is valid if (valueOut_ != COIN_DBL_MAX) { theta_ = valueOut_ - valueIn_; updatePrimalsInPrimal(*vector[4*iBest], theta_, ifValuesPass); abcSolution_[sequenceIn_] += theta_; } if (!abcFactorization_->pivots() && acceptablePivot_ <= 1.0e-8) { returnCode = 2; //say looks unbounded // do ray primalRay(vector[4*iBest]); } else { acceptablePivot_ = 1.0e-8; returnCode = 4; //say looks unbounded but has iterated } break; } else { // flipping from bound to bound bestUpdate=vector[4*iBest]; // after this bestUpdate is not empty - used to update djs ?? updatePrimalsInPrimal(*bestUpdate, theta_, ifValuesPass); // throw away best BUT remember we are updating costs somehow numberDone++; numberLeft--; // throw away for (int i=0;i<4;i++) { if (i) vector[4*iBest+i]->clear(); vector[4*iBest+i]=vector[4*numberLeft+i]; vector[4*numberLeft+i]=NULL; } stuff[iBest]=stuff[numberLeft]; // parallel for (int jMinor=0;jMinorclear(); // as only works in values pass if (directionIn_ == -1) { // as if from upper bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ -= fabs(theta_); } else { valueIn_ = lowerIn_; } } else { // as if from lower bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ += fabs(theta_); } else { valueIn_ = upperIn_; } } // outgoing if (sequenceIn_ != sequenceOut_) { if (directionOut_ > 0) { valueOut_ = lowerOut_; } else { valueOut_ = upperOut_; } if(valueOut_ < abcLower_[sequenceOut_] - primalTolerance_) valueOut_ = abcLower_[sequenceOut_] - 0.9 * primalTolerance_; else if (valueOut_ > abcUpper_[sequenceOut_] + primalTolerance_) valueOut_ = abcUpper_[sequenceOut_] + 0.9 * primalTolerance_; // may not be exactly at bound and bounds may have changed // Make sure outgoing looks feasible directionOut_ = abcNonLinearCost_->setOneOutgoing(pivotRow_, valueOut_); abcSolution_[sequenceOut_] = valueOut_; } // change cost and bounds on incoming if primal abcNonLinearCost_->setOne(sequenceIn_, valueIn_); int whatNext = housekeeping(/*objectiveChange*/); swapPrimalStuff(); if (whatNext == 1) { returnCode = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent returnCode = 3; } else if(numberIterations_ == lastGoodIteration_ + 2 * abcFactorization_->maximumPivots()) { // done a lot of flips - be safe returnCode = -2; // refactorize } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 3; } } } if (returnCode!=-1) break; } for (int i=0;i<16;i++) { if (vector[i]) vector[i]->clear(); if (vector[i]) vector[i]->checkClear(); } //delete [] saveCosts; return returnCode; } // Do FT update as separate function for minor iterations (nonzero return code on problems) int AbcSimplexPrimal::doFTUpdate(CoinIndexedVector * vector[4]) { ftAlpha_=abcFactorization_->checkReplacePart1(&usefulArray_[arrayForReplaceColumn_], vector[3],pivotRow_); int updateStatus=abcFactorization_->checkReplacePart2(pivotRow_,btranAlpha_,alpha_,ftAlpha_); if (!updateStatus) abcFactorization_->replaceColumnPart3(this, &usefulArray_[arrayForReplaceColumn_], vector[0], vector[3], pivotRow_, ftAlpha_?ftAlpha_:alpha_); else vector[3]->clear(); int returnCode=0; // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && lastGoodIteration_ == numberIterations_ && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4) { // slight error if (abcFactorization_->pivots() > 5 || updateStatus == 4) { returnCode = -3; } } else if (updateStatus == 2) { // major error // better to have small tolerance even if slower abcFactorization_->zeroTolerance(CoinMin(abcFactorization_->zeroTolerance(), 1.0e-15)); int maxFactor = abcFactorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ >> 1)); } // later we may need to unwind more e.g. fake bounds if(lastGoodIteration_ != numberIterations_) { pivotRow_ = -1; sequenceIn_ = -1; sequenceOut_ = -1; returnCode = -4; } else { // need to reject something char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); abcProgress_.incrementTimesFlagged(); abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious pivotRow_ = -1; sequenceIn_ = -1; sequenceOut_ = -1; returnCode = -5; } } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (abcFactorization_->pivots() < 0.5 * abcFactorization_->maximumPivots() && abcFactorization_->pivots() < 200) abcFactorization_->areaFactor( abcFactorization_->areaFactor() * 1.1); returnCode = -2; // factorize now } else if (updateStatus == 5) { problemStatus_ = -2; // factorize now returnCode=-2; } return returnCode; } /* The primals are updated by the given array. costs are changed */ void AbcSimplexPrimal::updatePrimalsInPrimal(CoinIndexedVector & rowArray, double theta,bool valuesPass) { // Cost on pivot row may change - may need to change dualIn //double oldCost = 0.0; //if (pivotRow_ >= 0) //oldCost = abcCost_[sequenceOut_]; double * work = rowArray.denseVector(); int number = rowArray.getNumElements(); int * which = rowArray.getIndices(); // allow for case where bound+tolerance == bound //double tolerance = 0.999999*primalTolerance_; double relaxedTolerance = 1.001 * primalTolerance_; int iIndex; if (!valuesPass) { for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; //work[iRow] = 0.0; int iPivot = abcPivotVariable_[iRow]; double change = theta * alpha; double value = abcSolution_[iPivot] - change; abcSolution_[iPivot] = value; value = solutionBasic_[iRow] - change; solutionBasic_[iRow] = value; if (active(iRow) || theta_ < 0.0) { clearActive(iRow); // But make sure one going out is feasible if (change > 0.0) { // going down if (value <= abcLower_[iPivot] + primalTolerance_) { if (iPivot == sequenceOut_ && value >= abcLower_[iPivot] - relaxedTolerance) value = abcLower_[iPivot]; abcNonLinearCost_->setOneBasic(iRow, value); } } else { // going up if (value >= abcUpper_[iPivot] - primalTolerance_) { if (iPivot == sequenceOut_ && value < abcUpper_[iPivot] + relaxedTolerance) value = abcUpper_[iPivot]; abcNonLinearCost_->setOneBasic(iRow, value); } } } } } else { // values pass so look at all for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iRow]; //work[iRow] = 0.0; int iPivot = abcPivotVariable_[iRow]; double change = theta * alpha; double value = abcSolution_[iPivot] - change; abcSolution_[iPivot] = value; value = solutionBasic_[iRow] - change; solutionBasic_[iRow] = value; clearActive(iRow); // But make sure one going out is feasible if (change > 0.0) { // going down if (value <= abcLower_[iPivot] + primalTolerance_) { if (iPivot == sequenceOut_ && value > abcLower_[iPivot] - relaxedTolerance) value = abcLower_[iPivot]; abcNonLinearCost_->setOneBasic(iRow, value); } } else { // going up if (value >= abcUpper_[iPivot] - primalTolerance_) { if (iPivot == sequenceOut_ && value < abcUpper_[iPivot] + relaxedTolerance) value = abcUpper_[iPivot]; abcNonLinearCost_->setOneBasic(iRow, value); } } } } //rowArray.setNumElements(0); } /* After rowArray will have cost changes for use next major iteration */ void AbcSimplexPrimal::createUpdateDuals(CoinIndexedVector & rowArray, const double * originalCost, const double extraCost[4], double & /*objectiveChange*/, int /*valuesPass*/) { int number=0; double * work = rowArray.denseVector(); int * which = rowArray.getIndices(); for (int iRow=0;iRow(abcFactorization_->factorization()); if (factorization) factorization->updatePartialUpdate(partialUpdate); #else abcFactorization_->factorization()->updatePartialUpdate(partialUpdate); #endif } // Create primal ray void AbcSimplexPrimal::primalRay(CoinIndexedVector * rowArray) { delete [] ray_; ray_ = new double [numberColumns_]; CoinZeroN(ray_, numberColumns_); int number = rowArray->getNumElements(); int * index = rowArray->getIndices(); double * array = rowArray->denseVector(); double way = -directionIn_; int i; double zeroTolerance = 1.0e-12; if (sequenceIn_ < numberColumns_) ray_[sequenceIn_] = directionIn_; for (i = 0; i < number; i++) { int iRow = index[i]; int iPivot = abcPivotVariable_[iRow]; double arrayValue = array[iRow]; if (iPivot < numberColumns_ && fabs(arrayValue) >= zeroTolerance) ray_[iPivot] = way * arrayValue; } } /* Get next superbasic -1 if none, Normal type is 1 If type is 3 then initializes sorted list if 2 uses list. */ int AbcSimplexPrimal::nextSuperBasic(int superBasicType, CoinIndexedVector * columnArray) { int returnValue = -1; bool finished = false; while (!finished) { returnValue = firstFree_; int iColumn = firstFree_ + 1; if (superBasicType > 1) { if (superBasicType > 2) { // Initialize list // Wild guess that lower bound more natural than upper int number = 0; double * work = columnArray->denseVector(); int * which = columnArray->getIndices(); for (iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) { if (!flagged(iColumn)) { if (getInternalStatus(iColumn) == superBasic) { if (fabs(abcSolution_[iColumn] - abcLower_[iColumn]) <= primalTolerance_) { abcSolution_[iColumn] = abcLower_[iColumn]; setInternalStatus(iColumn, atLowerBound); } else if (fabs(abcSolution_[iColumn] - abcUpper_[iColumn]) <= primalTolerance_) { abcSolution_[iColumn] = abcUpper_[iColumn]; setInternalStatus(iColumn, atUpperBound); } else if (abcLower_[iColumn] < -1.0e20 && abcUpper_[iColumn] > 1.0e20) { setInternalStatus(iColumn, isFree); break; } else if (!flagged(iColumn)) { // put ones near bounds at end after sorting work[number] = - CoinMin(0.1 * (abcSolution_[iColumn] - abcLower_[iColumn]), abcUpper_[iColumn] - abcSolution_[iColumn]); which[number++] = iColumn; } } } } CoinSort_2(work, work + number, which); columnArray->setNumElements(number); CoinZeroN(work, number); } int * which = columnArray->getIndices(); int number = columnArray->getNumElements(); if (!number) { // finished iColumn = numberRows_ + numberColumns_; returnValue = -1; } else { number--; returnValue = which[number]; iColumn = returnValue; columnArray->setNumElements(number); } } else { for (; iColumn < numberRows_ + numberColumns_; iColumn++) { if (!flagged(iColumn)) { if (getInternalStatus(iColumn) == superBasic|| getInternalStatus(iColumn) == isFree) { if (fabs(abcSolution_[iColumn] - abcLower_[iColumn]) <= primalTolerance_) { abcSolution_[iColumn] = abcLower_[iColumn]; setInternalStatus(iColumn, atLowerBound); } else if (fabs(abcSolution_[iColumn] - abcUpper_[iColumn]) <= primalTolerance_) { abcSolution_[iColumn] = abcUpper_[iColumn]; setInternalStatus(iColumn, atUpperBound); } else if (abcLower_[iColumn] < -1.0e20 && abcUpper_[iColumn] > 1.0e20) { setInternalStatus(iColumn, isFree); if (fabs(abcDj_[iColumn])>10.0*dualTolerance_) break; } else { break; } } } } } firstFree_ = iColumn; finished = true; if (firstFree_ == numberRows_ + numberColumns_) firstFree_ = -1; if (returnValue >= 0 && getInternalStatus(returnValue) != superBasic && getInternalStatus(returnValue) != isFree) finished = false; // somehow picked up odd one } return returnValue; } void AbcSimplexPrimal::clearAll() { int number = usefulArray_[arrayForFtran_].getNumElements(); int * which = usefulArray_[arrayForFtran_].getIndices(); int iIndex; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; clearActive(iRow); } usefulArray_[arrayForFtran_].clear(); for (int i=0;i<6;i++) { if (rowArray_[i]) rowArray_[i]->clear(); if (columnArray_[i]) columnArray_[i]->clear(); } } CoinMP-1.8.3/Clp/src/ClpConstraintQuadratic.hpp0000644000175000017500000000706611510657452017772 0ustar renerene/* $Id: ClpConstraintQuadratic.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpConstraintQuadratic_H #define ClpConstraintQuadratic_H #include "ClpConstraint.hpp" //############################################################################# /** Quadratic Constraint Class */ class ClpConstraintQuadratic : public ClpConstraint { public: ///@name Stuff //@{ /** Fills gradient. If Quadratic then solution may be NULL, also returns true value of function and offset so we can use x not deltaX in constraint If refresh is false then uses last solution Uses model for scaling Returns non-zero if gradient udefined at current solution */ virtual int gradient(const ClpSimplex * model, const double * solution, double * gradient, double & functionValue , double & offset, bool useScaling = false, bool refresh = true) const ; /// Resize constraint virtual void resize(int newNumberColumns) ; /// Delete columns in constraint virtual void deleteSome(int numberToDelete, const int * which) ; /// Scale constraint virtual void reallyScale(const double * columnScale) ; /** Given a zeroed array sets nonquadratic columns to 1. Returns number of nonquadratic columns */ virtual int markNonlinear(char * which) const ; /** Given a zeroed array sets possible nonzero coefficients to 1. Returns number of nonzeros */ virtual int markNonzero(char * which) const; //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpConstraintQuadratic(); /// Constructor from quadratic ClpConstraintQuadratic(int row, int numberQuadraticColumns, int numberColumns, const CoinBigIndex * start, const int * column, const double * element); /** Copy constructor . */ ClpConstraintQuadratic(const ClpConstraintQuadratic & rhs); /// Assignment operator ClpConstraintQuadratic & operator=(const ClpConstraintQuadratic& rhs); /// Destructor virtual ~ClpConstraintQuadratic (); /// Clone virtual ClpConstraint * clone() const; //@} ///@name Gets and sets //@{ /// Number of coefficients virtual int numberCoefficients() const; /// Number of columns in constraint inline int numberColumns() const { return numberColumns_; } /// Column starts inline CoinBigIndex * start() const { return start_; } /// Columns inline const int * column() const { return column_; } /// Coefficients inline const double * coefficient() const { return coefficient_; } //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// Column starts CoinBigIndex * start_; /// Column (if -1 then linear coefficient) int * column_; /// Coefficients double * coefficient_; /// Useful to have number of columns about int numberColumns_; /// Number of coefficients in gradient int numberCoefficients_; /// Number of quadratic columns int numberQuadraticColumns_; //@} }; #endif CoinMP-1.8.3/Clp/src/CoinAbcOrderedFactorization4.cpp0000644000175000017500000000107712101105055020744 0ustar renerene/* $Id: CoinAbcOrderedFactorization4.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcOrderedFactorization #define ABC_SMALL -1 #define ABC_ORDERED_FACTORIZATION #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization4.cpp" #endif CoinMP-1.8.3/Clp/src/ClpCholeskyWssmpKKT.cpp0000644000175000017500000005262411552601036017161 0ustar renerene/* $Id: ClpCholeskyWssmpKKT.cpp 1723 2011-04-17 15:07:10Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" #include "ClpInterior.hpp" #include "ClpCholeskyWssmpKKT.hpp" #include "ClpQuadraticObjective.hpp" #include "ClpMessage.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpCholeskyWssmpKKT::ClpCholeskyWssmpKKT (int denseThreshold) : ClpCholeskyBase(denseThreshold) { type_ = 21; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpCholeskyWssmpKKT::ClpCholeskyWssmpKKT (const ClpCholeskyWssmpKKT & rhs) : ClpCholeskyBase(rhs) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpCholeskyWssmpKKT::~ClpCholeskyWssmpKKT () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpCholeskyWssmpKKT & ClpCholeskyWssmpKKT::operator=(const ClpCholeskyWssmpKKT& rhs) { if (this != &rhs) { ClpCholeskyBase::operator=(rhs); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpCholeskyBase * ClpCholeskyWssmpKKT::clone() const { return new ClpCholeskyWssmpKKT(*this); } // At present I can't get wssmp to work as my libraries seem to be out of sync // so I have linked in ekkwssmp which is an older version #ifndef USE_EKKWSSMP extern "C" { void F77_FUNC(wsetmaxthrds,WSETMAXTHRDS)(const int* NTHREADS); void F77_FUNC(wssmp,WSSMP)(const int* N, const int* IA, const int* JA, const double* AVALS, double* DIAG, int* PERM, int* INVP, double* B, const int* LDB, const int* NRHS, double* AUX, const int* NAUX, int* MRP, int* IPARM, double* DPARM); void F77_FUNC_(wsmp_clear,WSMP_CLEAR)(void); } #else /* minimum needed for user */ typedef struct EKKModel EKKModel; typedef struct EKKContext EKKContext; extern "C" { EKKContext * ekk_initializeContext(); void ekk_endContext(EKKContext * context); EKKModel * ekk_newModel(EKKContext * env, const char * name); int ekk_deleteModel(EKKModel * model); } static EKKModel * model = NULL; static EKKContext * context = NULL; extern "C" void ekkwssmp(EKKModel *, int * n, int * columnStart , int * rowIndex , double * element, double * diagonal , int * perm , int * invp , double * rhs , int * ldb , int * nrhs , double * aux , int * naux , int * mrp , int * iparm , double * dparm); static void F77_FUNC(wssmp,WSSMP)( int *n, int *ia, int *ja, double *avals, double *diag, int *perm, int *invp, double *b, int *ldb, int *nrhs, double *aux, int * naux, int *mrp, int *iparm, double *dparm) { if (!context) { /* initialize OSL environment */ context = ekk_initializeContext(); model = ekk_newModel(context, ""); } ekkwssmp(model, n, ia, ja, avals, diag, perm, invp, b, ldb, nrhs, aux, naux, mrp, iparm, dparm); //ekk_deleteModel(model); //ekk_endContext(context); } #endif /* Orders rows and saves pointer to model */ int ClpCholeskyWssmpKKT::order(ClpInterior * model) { int numberRowsModel = model->numberRows(); int numberColumns = model->numberColumns(); int numberTotal = numberColumns + numberRowsModel; numberRows_ = 2 * numberRowsModel + numberColumns; rowsDropped_ = new char [numberRows_]; memset(rowsDropped_, 0, numberRows_); numberRowsDropped_ = 0; model_ = model; CoinPackedMatrix * quadratic = NULL; ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(model_->objectiveAsObject())); if (quadraticObj) quadratic = quadraticObj->quadraticObjective(); int numberElements = model_->clpMatrix()->getNumElements(); numberElements = numberElements + 2 * numberRowsModel + numberTotal; if (quadratic) numberElements += quadratic->getNumElements(); // Space for starts choleskyStart_ = new CoinBigIndex[numberRows_+1]; const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); //const double * element = model_->clpMatrix()->getElements(); // Now we have size - create arrays and fill in try { choleskyRow_ = new int [numberElements]; } catch (...) { // no memory delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } try { sparseFactor_ = new double[numberElements]; } catch (...) { // no memory delete [] choleskyRow_; choleskyRow_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } int iRow, iColumn; sizeFactor_ = 0; // matrix if (!quadratic) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { choleskyStart_[iColumn] = sizeFactor_; choleskyRow_[sizeFactor_++] = iColumn; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { choleskyRow_[sizeFactor_++] = row[j] + numberTotal; } } } else { // Quadratic const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); //const double * quadraticElement = quadratic->getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { choleskyStart_[iColumn] = sizeFactor_; choleskyRow_[sizeFactor_++] = iColumn; for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; if (jColumn > iColumn) choleskyRow_[sizeFactor_++] = jColumn; } CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { choleskyRow_[sizeFactor_++] = row[j] + numberTotal; } } } // slacks for (; iColumn < numberTotal; iColumn++) { choleskyStart_[iColumn] = sizeFactor_; choleskyRow_[sizeFactor_++] = iColumn; choleskyRow_[sizeFactor_++] = iColumn - numberColumns + numberTotal; } // Transpose - nonzero diagonal (may regularize) for (iRow = 0; iRow < numberRowsModel; iRow++) { choleskyStart_[iRow+numberTotal] = sizeFactor_; // diagonal choleskyRow_[sizeFactor_++] = iRow + numberTotal; } choleskyStart_[numberRows_] = sizeFactor_; permuteInverse_ = new int [numberRows_]; permute_ = new int[numberRows_]; integerParameters_[0] = 0; int i0 = 0; int i1 = 1; #ifndef USE_EKKWSSMP int i2 = 1; if (model->numberThreads() <= 0) i2 = 1; else i2 = model->numberThreads(); F77_FUNC(wsetmaxthrds,WSETMAXTHRDS)(&i2); #endif F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, 0, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); integerParameters_[1] = 1; //order and symbolic integerParameters_[2] = 2; integerParameters_[3] = 0; //CSR integerParameters_[4] = 0; //C style integerParameters_[13] = 1; //reuse initial factorization space integerParameters_[15+0] = 1; //ordering integerParameters_[15+1] = 0; integerParameters_[15+2] = 1; integerParameters_[15+3] = 0; integerParameters_[15+4] = 1; doubleParameters_[10] = 1.0e-20; doubleParameters_[11] = 1.0e-15; #if 1 integerParameters_[1] = 2; //just symbolic for (int iRow = 0; iRow < numberRows_; iRow++) { permuteInverse_[iRow] = iRow; permute_[iRow] = iRow; } #endif F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, NULL, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); //std::cout<<"Ordering and symbolic factorization took "<numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; int newDropped = 0; double largest = 0.0; double smallest; //perturbation double perturbation = model_->diagonalPerturbation() * model_->diagonalNorm(); perturbation = perturbation * perturbation; if (perturbation > 1.0) { #ifdef COIN_DEVELOP //if (model_->model()->logLevel()&4) std::cout << "large perturbation " << perturbation << std::endl; #endif perturbation = sqrt(perturbation);; perturbation = 1.0; } // need to recreate every time int iRow, iColumn; const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const double * element = model_->clpMatrix()->getElements(); CoinBigIndex numberElements = 0; CoinPackedMatrix * quadratic = NULL; ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(model_->objectiveAsObject())); if (quadraticObj) quadratic = quadraticObj->quadraticObjective(); // matrix if (!quadratic) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { choleskyStart_[iColumn] = numberElements; double value = diagonal[iColumn]; if (fabs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, fabs(value)); sparseFactor_[numberElements] = -value; choleskyRow_[numberElements++] = iColumn; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { choleskyRow_[numberElements] = row[j] + numberTotal; sparseFactor_[numberElements++] = element[j]; largest = CoinMax(largest, fabs(element[j])); } } else { sparseFactor_[numberElements] = -1.0e100; choleskyRow_[numberElements++] = iColumn; } } } else { // Quadratic const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); const double * quadraticElement = quadratic->getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { choleskyStart_[iColumn] = numberElements; CoinBigIndex savePosition = numberElements; choleskyRow_[numberElements++] = iColumn; double value = diagonal[iColumn]; if (fabs(value) > 1.0e-100) { value = 1.0 / value; for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; if (jColumn > iColumn) { sparseFactor_[numberElements] = -quadraticElement[j]; choleskyRow_[numberElements++] = jColumn; } else if (iColumn == jColumn) { value += quadraticElement[j]; } } largest = CoinMax(largest, fabs(value)); sparseFactor_[savePosition] = -value; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { choleskyRow_[numberElements] = row[j] + numberTotal; sparseFactor_[numberElements++] = element[j]; largest = CoinMax(largest, fabs(element[j])); } } else { value = 1.0e100; sparseFactor_[savePosition] = -value; } } } for (iColumn = 0; iColumn < numberColumns; iColumn++) { assert (sparseFactor_[choleskyStart_[iColumn]] < 0.0); } // slacks for (iColumn = numberColumns; iColumn < numberTotal; iColumn++) { choleskyStart_[iColumn] = numberElements; double value = diagonal[iColumn]; if (fabs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, fabs(value)); } else { value = 1.0e100; } sparseFactor_[numberElements] = -value; choleskyRow_[numberElements++] = iColumn; choleskyRow_[numberElements] = iColumn - numberColumns + numberTotal; sparseFactor_[numberElements++] = -1.0; } // Finish diagonal double delta2 = model_->delta(); // add delta*delta to bottom delta2 *= delta2; for (iRow = 0; iRow < numberRowsModel; iRow++) { choleskyStart_[iRow+numberTotal] = numberElements; choleskyRow_[numberElements] = iRow + numberTotal; sparseFactor_[numberElements++] = delta2; } choleskyStart_[numberRows_] = numberElements; int i1 = 1; int i0 = 0; integerParameters_[1] = 3; integerParameters_[2] = 3; integerParameters_[10] = 2; //integerParameters_[11]=1; integerParameters_[12] = 2; // LDLT integerParameters_[30] = 1; doubleParameters_[20] = 1.0e100; double largest2 = largest * 1.0e-20; largest = CoinMin(largest2, 1.0e-11); doubleParameters_[10] = CoinMax(1.0e-20, largest); if (doubleParameters_[10] > 1.0e-3) integerParameters_[9] = 1; else integerParameters_[9] = 0; #ifndef WSMP // Set up LDL cutoff integerParameters_[34] = numberTotal; doubleParameters_[20] = 1.0e-15; doubleParameters_[34] = 1.0e-12; //printf("tol is %g\n",doubleParameters_[10]); //doubleParameters_[10]=1.0e-17; #endif int * rowsDropped2 = new int[numberRows_]; CoinZeroN(rowsDropped2, numberRows_); F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, NULL, &numberRows_, &i1, NULL, &i0, rowsDropped2, integerParameters_, doubleParameters_); //std::cout<<"factorization took "<primalR(); double * dualR = model_->dualR(); for (iRow = 0; iRow < numberTotal; iRow++) { if (rowsDropped2[iRow]) { n1++; //printf("row region1 %d dropped\n",iRow); //rowsDropped_[iRow]=1; rowsDropped_[iRow] = 0; primalR[iRow] = doubleParameters_[20]; } else { rowsDropped_[iRow] = 0; primalR[iRow] = 0.0; } } for (; iRow < numberRows_; iRow++) { if (rowsDropped2[iRow]) { n2++; //printf("row region2 %d dropped\n",iRow); //rowsDropped_[iRow]=1; rowsDropped_[iRow] = 0; dualR[iRow-numberTotal] = doubleParameters_[34]; } else { rowsDropped_[iRow] = 0; dualR[iRow-numberTotal] = 0.0; } } //printf("%d rows dropped in region1, %d in region2\n",n1,n2); #endif delete [] rowsDropped2; //if (integerParameters_[20]) //std::cout<messageHandler()->logLevel() > 1) std::cout << "Cholesky - largest " << largest << " smallest " << smallest << std::endl; choleskyCondition_ = largest / smallest; if (integerParameters_[63] < 0) return -1; // out of memory status_ = 0; return 0; } /* Uses factorization to solve. */ void ClpCholeskyWssmpKKT::solve (double * region) { abort(); } /* Uses factorization to solve. */ void ClpCholeskyWssmpKKT::solveKKT (double * region1, double * region2, const double * diagonal, double diagonalScaleFactor) { int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; double * array = new double [numberRows_]; CoinMemcpyN(region1, numberTotal, array); CoinMemcpyN(region2, numberRowsModel, array + numberTotal); int i1 = 1; int i0 = 0; integerParameters_[1] = 4; integerParameters_[2] = 4; #if 0 integerParameters_[5] = 3; doubleParameters_[5] = 1.0e-10; integerParameters_[6] = 6; #endif F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, array, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); #if 0 int iRow; for (iRow = 0; iRow < numberTotal; iRow++) { if (rowsDropped_[iRow] && fabs(array[iRow]) > 1.0e-8) { printf("row region1 %d dropped %g\n", iRow, array[iRow]); } } for (; iRow < numberRows_; iRow++) { if (rowsDropped_[iRow] && fabs(array[iRow]) > 1.0e-8) { printf("row region2 %d dropped %g\n", iRow, array[iRow]); } } #endif CoinMemcpyN(array + numberTotal, numberRowsModel, region2); #if 1 CoinMemcpyN(array, numberTotal, region1); #else multiplyAdd(region2, numberRowsModel, -1.0, array + numberColumns, 0.0); CoinZeroN(array, numberColumns); model_->clpMatrix()->transposeTimes(1.0, region2, array); for (int iColumn = 0; iColumn < numberTotal; iColumn++) region1[iColumn] = diagonal[iColumn] * (array[iColumn] - region1[iColumn]); #endif delete [] array; #if 0 if (integerParameters_[5]) { std::cout << integerParameters_[5] << " refinements "; } std::cout << doubleParameters_[6] << std::endl; #endif } CoinMP-1.8.3/Clp/src/ClpCholeskyWssmp.cpp0000644000175000017500000006236111552601036016606 0ustar renerene/* $Id: ClpCholeskyWssmp.cpp 1723 2011-04-17 15:07:10Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" #include "ClpInterior.hpp" #include "ClpCholeskyWssmp.hpp" #include "ClpCholeskyDense.hpp" #include "ClpMessage.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpCholeskyWssmp::ClpCholeskyWssmp (int denseThreshold) : ClpCholeskyBase(denseThreshold) { type_ = 12; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpCholeskyWssmp::ClpCholeskyWssmp (const ClpCholeskyWssmp & rhs) : ClpCholeskyBase(rhs) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpCholeskyWssmp::~ClpCholeskyWssmp () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpCholeskyWssmp & ClpCholeskyWssmp::operator=(const ClpCholeskyWssmp& rhs) { if (this != &rhs) { ClpCholeskyBase::operator=(rhs); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpCholeskyBase * ClpCholeskyWssmp::clone() const { return new ClpCholeskyWssmp(*this); } // At present I can't get wssmp to work as my libraries seem to be out of sync // so I have linked in ekkwssmp which is an older version #ifndef USE_EKKWSSMP extern "C" { void F77_FUNC(wsetmaxthrds,WSETMAXTHRDS)(const int* NTHREADS); void F77_FUNC(wssmp,WSSMP)(const int* N, const int* IA, const int* JA, const double* AVALS, double* DIAG, int* PERM, int* INVP, double* B, const int* LDB, const int* NRHS, double* AUX, const int* NAUX, int* MRP, int* IPARM, double* DPARM); void F77_FUNC_(wsmp_clear,WSMP_CLEAR)(void); } #else /* minimum needed for user */ typedef struct EKKModel EKKModel; typedef struct EKKContext EKKContext; extern "C" { EKKContext * ekk_initializeContext(); void ekk_endContext(EKKContext * context); EKKModel * ekk_newModel(EKKContext * env, const char * name); int ekk_deleteModel(EKKModel * model); } static EKKModel * model = NULL; static EKKContext * context = NULL; extern "C" void ekkwssmp(EKKModel *, int * n, int * columnStart , int * rowIndex , double * element, double * diagonal , int * perm , int * invp , double * rhs , int * ldb , int * nrhs , double * aux , int * naux , int * mrp , int * iparm , double * dparm); static void F77_FUNC(wssmp,WSSMP)( int *n, int *ia, int *ja, double *avals, double *diag, int *perm, int *invp, double *b, int *ldb, int *nrhs, double *aux, int * naux, int *mrp, int *iparm, double *dparm) { if (!context) { /* initialize OSL environment */ context = ekk_initializeContext(); model = ekk_newModel(context, ""); } ekkwssmp(model, n, ia, ja, avals, diag, perm, invp, b, ldb, nrhs, aux, naux, mrp, iparm, dparm); //ekk_deleteModel(model); //ekk_endContext(context); } #endif /* Orders rows and saves pointer to matrix.and model */ int ClpCholeskyWssmp::order(ClpInterior * model) { numberRows_ = model->numberRows(); rowsDropped_ = new char [numberRows_]; memset(rowsDropped_, 0, numberRows_); numberRowsDropped_ = 0; model_ = model; rowCopy_ = model->clpMatrix()->reverseOrderedCopy(); // Space for starts choleskyStart_ = new CoinBigIndex[numberRows_+1]; const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); // We need two arrays for counts int * which = new int [numberRows_]; int * used = new int[numberRows_+1]; CoinZeroN(used, numberRows_); int iRow; sizeFactor_ = 0; int numberColumns = model->numberColumns(); int numberDense = 0; if (denseThreshold_ > 0) { delete [] whichDense_; delete [] denseColumn_; delete dense_; whichDense_ = new char[numberColumns]; int iColumn; used[numberRows_] = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; used[length] += 1; } int nLong = 0; int stop = CoinMax(denseThreshold_ / 2, 100); for (iRow = numberRows_; iRow >= stop; iRow--) { if (used[iRow]) COIN_DETAIL_PRINT(printf("%d columns are of length %d\n", used[iRow], iRow)); nLong += used[iRow]; if (nLong > 50 || nLong > (numberColumns >> 2)) break; } CoinZeroN(used, numberRows_); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLength[iColumn] < denseThreshold_) { whichDense_[iColumn] = 0; } else { whichDense_[iColumn] = 1; numberDense++; } } if (!numberDense || numberDense > 100) { // free delete [] whichDense_; whichDense_ = NULL; denseColumn_ = NULL; dense_ = NULL; } else { // space for dense columns denseColumn_ = new double [numberDense*numberRows_]; // dense cholesky dense_ = new ClpCholeskyDense(); dense_->reserveSpace(NULL, numberDense); COIN_DETAIL_PRINT(printf("Taking %d columns as dense\n", numberDense)); } } for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; } } delete [] which; // Now we have size - create arrays and fill in try { choleskyRow_ = new int [sizeFactor_]; } catch (...) { // no memory delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } try { sparseFactor_ = new double[sizeFactor_]; } catch (...) { // no memory delete [] choleskyRow_; choleskyRow_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } sizeFactor_ = 0; which = choleskyRow_; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; choleskyStart_[iRow] = sizeFactor_; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; // Sort std::sort(which, which + number); // move which on which += number; } } choleskyStart_[numberRows_] = sizeFactor_; delete [] used; permuteInverse_ = new int [numberRows_]; permute_ = new int[numberRows_]; integerParameters_[0] = 0; int i0 = 0; int i1 = 1; #ifndef USE_EKKWSSMP int i2 = 1; if (model->numberThreads() <= 0) i2 = 1; else i2 = model->numberThreads(); F77_FUNC(wsetmaxthrds,WSETMAXTHRDS)(&i2); #endif F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, 0, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); integerParameters_[1] = 1; //order and symbolic integerParameters_[2] = 2; integerParameters_[3] = 0; //CSR integerParameters_[4] = 0; //C style integerParameters_[13] = 1; //reuse initial factorization space integerParameters_[15+0] = 1; //ordering integerParameters_[15+1] = 0; integerParameters_[15+2] = 1; integerParameters_[15+3] = 0; integerParameters_[15+4] = 1; doubleParameters_[10] = 1.0e-20; doubleParameters_[11] = 1.0e-15; F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, NULL, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); //std::cout<<"Ordering and symbolic factorization took "<gamma() && !model->delta()) { model->setGamma(5.0e-5); model->setDelta(5.0e-5); } std::cout << integerParameters_[23] << " elements in sparse Cholesky" << std::endl; if (!integerParameters_[23]) { for (int iRow = 0; iRow < numberRows_; iRow++) { permuteInverse_[iRow] = iRow; permute_[iRow] = iRow; } std::cout << "wssmp says no elements - fully dense? - switching to dense" << std::endl; integerParameters_[1] = 2; integerParameters_[2] = 2; integerParameters_[7] = 1; // no permute F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, NULL, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); std::cout << integerParameters_[23] << " elements in dense Cholesky" << std::endl; } return 0; } /* Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ int ClpCholeskyWssmp::symbolic() { return 0; } /* Factorize - filling in rowsDropped and returning number dropped */ int ClpCholeskyWssmp::factorize(const double * diagonal, int * rowsDropped) { const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const double * element = model_->clpMatrix()->getElements(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); const double * elementByRow = rowCopy_->getElements(); int numberColumns = model_->clpMatrix()->getNumCols(); int iRow; double * work = new double[numberRows_]; CoinZeroN(work, numberRows_); const double * diagonalSlack = diagonal + numberColumns; int newDropped = 0; double largest; double smallest; int numberDense = 0; if (dense_) numberDense = dense_->numberRows(); //perturbation double perturbation = model_->diagonalPerturbation() * model_->diagonalNorm(); perturbation = perturbation * perturbation; if (perturbation > 1.0) { #ifdef COIN_DEVELOP //if (model_->model()->logLevel()&4) std::cout << "large perturbation " << perturbation << std::endl; #endif perturbation = sqrt(perturbation);; perturbation = 1.0; } if (whichDense_) { double * denseDiagonal = dense_->diagonal(); double * dense = denseColumn_; int iDense = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (whichDense_[iColumn]) { denseDiagonal[iDense++] = 1.0 / diagonal[iColumn]; CoinZeroN(dense, numberRows_); CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; dense[jRow] = element[j]; } dense += numberRows_; } } } double delta2 = model_->delta(); // add delta*delta to diagonal delta2 *= delta2; for (iRow = 0; iRow < numberRows_; iRow++) { double * put = sparseFactor_ + choleskyStart_[iRow]; int * which = choleskyRow_ + choleskyStart_[iRow]; int number = choleskyStart_[iRow+1] - choleskyStart_[iRow]; if (!rowLength[iRow]) rowsDropped_[iRow] = 1; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; work[iRow] = diagonalSlack[iRow] + delta2; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; double multiplier = diagonal[iColumn] * elementByRow[k]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { double value = element[j] * multiplier; work[jRow] += value; } } } } int j; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; work[jRow] = 0.0; } } else { // dropped int j; for (j = 1; j < number; j++) { put[j] = 0.0; } put[0] = 1.0; } } //check sizes double largest2 = maximumAbsElement(sparseFactor_, sizeFactor_); largest2 *= 1.0e-20; largest = CoinMin(largest2, 1.0e-11); int numberDroppedBefore = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int dropped = rowsDropped_[iRow]; // Move to int array rowsDropped[iRow] = dropped; if (!dropped) { CoinBigIndex start = choleskyStart_[iRow]; double diagonal = sparseFactor_[start]; if (diagonal > largest2) { sparseFactor_[start] = diagonal + perturbation; } else { sparseFactor_[start] = diagonal + perturbation; rowsDropped[iRow] = 2; numberDroppedBefore++; } } } int i1 = 1; int i0 = 0; integerParameters_[1] = 3; integerParameters_[2] = 3; integerParameters_[10] = 2; //integerParameters_[11]=1; integerParameters_[12] = 2; doubleParameters_[10] = CoinMax(1.0e-20, largest); if (doubleParameters_[10] > 1.0e-3) integerParameters_[9] = 1; else integerParameters_[9] = 0; F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, NULL, &numberRows_, &i1, NULL, &i0, rowsDropped, integerParameters_, doubleParameters_); //std::cout<<"factorization took "<messageHandler()->logLevel() > 1) std::cout << "Cholesky - largest " << largest << " smallest " << smallest << std::endl; choleskyCondition_ = largest / smallest; if (integerParameters_[63] < 0) return -1; // out of memory if (whichDense_) { // Update dense columns (just L) // Zero out dropped rows int i; for (i = 0; i < numberDense; i++) { double * a = denseColumn_ + i * numberRows_; for (int j = 0; j < numberRows_; j++) { if (rowsDropped[j]) a[j] = 0.0; } } integerParameters_[29] = 1; int i0 = 0; integerParameters_[1] = 4; integerParameters_[2] = 4; F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, denseColumn_, &numberRows_, &numberDense, NULL, &i0, NULL, integerParameters_, doubleParameters_); integerParameters_[29] = 0; dense_->resetRowsDropped(); longDouble * denseBlob = dense_->aMatrix(); double * denseDiagonal = dense_->diagonal(); // Update dense matrix for (i = 0; i < numberDense; i++) { const double * a = denseColumn_ + i * numberRows_; // do diagonal double value = denseDiagonal[i]; const double * b = denseColumn_ + i * numberRows_; for (int k = 0; k < numberRows_; k++) value += a[k] * b[k]; denseDiagonal[i] = value; for (int j = i + 1; j < numberDense; j++) { double value = 0.0; const double * b = denseColumn_ + j * numberRows_; for (int k = 0; k < numberRows_; k++) value += a[k] * b[k]; *denseBlob = value; denseBlob++; } } // dense cholesky (? long double) int * dropped = new int [numberDense]; dense_->factorizePart2(dropped); delete [] dropped; } bool cleanCholesky; if (model_->numberIterations() < 2000) cleanCholesky = true; else cleanCholesky = false; if (cleanCholesky) { //drop fresh makes some formADAT easier //int oldDropped=numberRowsDropped_; if (newDropped || numberRowsDropped_) { //std::cout <<"Rank "<oldDropped) //std::cout<<" ( "<(rowsDropped[i]); rowsDropped_[i] = dropped; rowsDropped_[i] = 0; if (dropped == 2) { //dropped this time rowsDropped[newDropped++] = i; rowsDropped_[i] = 0; } } numberRowsDropped_ = newDropped; newDropped = -(2 + newDropped); } } else { if (newDropped) { newDropped = 0; for (int i = 0; i < numberRows_; i++) { char dropped = static_cast(rowsDropped[i]); rowsDropped_[i] = dropped; if (dropped == 2) { //dropped this time rowsDropped[newDropped++] = i; rowsDropped_[i] = 1; } } } numberRowsDropped_ += newDropped; if (numberRowsDropped_ && 0) { std::cout << "Rank " << numberRows_ - numberRowsDropped_ << " ( " << numberRowsDropped_ << " dropped)"; if (newDropped) { std::cout << " ( " << newDropped << " dropped this time)"; } std::cout << std::endl; } } status_ = 0; return newDropped; } /* Uses factorization to solve. */ void ClpCholeskyWssmp::solve (double * region) { int i1 = 1; int i0 = 0; integerParameters_[1] = 4; integerParameters_[2] = 4; #if 1 integerParameters_[5] = 3; doubleParameters_[5] = 1.0e-10; integerParameters_[6] = 6; #endif if (!whichDense_) { F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, region, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); } else { // dense columns integerParameters_[29] = 1; F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, region, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); // do change; int numberDense = dense_->numberRows(); double * change = new double[numberDense]; int i; for (i = 0; i < numberDense; i++) { const double * a = denseColumn_ + i * numberRows_; double value = 0.0; for (int iRow = 0; iRow < numberRows_; iRow++) value += a[iRow] * region[iRow]; change[i] = value; } // solve dense_->solve(change); for (i = 0; i < numberDense; i++) { const double * a = denseColumn_ + i * numberRows_; double value = change[i]; for (int iRow = 0; iRow < numberRows_; iRow++) region[iRow] -= value * a[iRow]; } delete [] change; // and finish off integerParameters_[29] = 2; integerParameters_[1] = 4; F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_, NULL, permute_, permuteInverse_, region, &numberRows_, &i1, NULL, &i0, NULL, integerParameters_, doubleParameters_); integerParameters_[29] = 0; } #if 0 if (integerParameters_[5]) { std::cout << integerParameters_[5] << " refinements "; } std::cout << doubleParameters_[6] << std::endl; #endif } CoinMP-1.8.3/Clp/src/CoinAbcSmallFactorization2.cpp0000644000175000017500000000103012101105055020413 0ustar renerene/* $Id: CoinAbcSmallFactorization2.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcSmallFactorization #define ABC_SMALL 4 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization2.cpp" #endif CoinMP-1.8.3/Clp/src/ClpNetworkMatrix.cpp0000644000175000017500000013211611510657452016614 0ustar renerene/* $Id: ClpNetworkMatrix.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedVector.hpp" #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" // at end to get min/max! #include "ClpNetworkMatrix.hpp" #include "ClpPlusMinusOneMatrix.hpp" #include "ClpMessage.hpp" #include #include //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpNetworkMatrix::ClpNetworkMatrix () : ClpMatrixBase() { setType(11); matrix_ = NULL; lengths_ = NULL; indices_ = NULL; numberRows_ = 0; numberColumns_ = 0; trueNetwork_ = false; } /* Constructor from two arrays */ ClpNetworkMatrix::ClpNetworkMatrix(int numberColumns, const int * head, const int * tail) : ClpMatrixBase() { setType(11); matrix_ = NULL; lengths_ = NULL; indices_ = new int[2*numberColumns];; numberRows_ = -1; numberColumns_ = numberColumns; trueNetwork_ = true; int iColumn; CoinBigIndex j = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { int iRow = head[iColumn]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j] = iRow; iRow = tail[iColumn]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j+1] = iRow; } numberRows_++; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpNetworkMatrix::ClpNetworkMatrix (const ClpNetworkMatrix & rhs) : ClpMatrixBase(rhs) { matrix_ = NULL; lengths_ = NULL; indices_ = NULL; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; trueNetwork_ = rhs.trueNetwork_; if (numberColumns_) { indices_ = new int [ 2*numberColumns_]; CoinMemcpyN(rhs.indices_, 2 * numberColumns_, indices_); } int numberRows = getNumRows(); if (rhs.rhsOffset_ && numberRows) { rhsOffset_ = ClpCopyOfArray(rhs.rhsOffset_, numberRows); } else { rhsOffset_ = NULL; } } ClpNetworkMatrix::ClpNetworkMatrix (const CoinPackedMatrix & rhs) : ClpMatrixBase() { setType(11); matrix_ = NULL; lengths_ = NULL; indices_ = NULL; int iColumn; assert (rhs.isColOrdered()); // get matrix data pointers const int * row = rhs.getIndices(); const CoinBigIndex * columnStart = rhs.getVectorStarts(); const int * columnLength = rhs.getVectorLengths(); const double * elementByColumn = rhs.getElements(); numberColumns_ = rhs.getNumCols(); int goodNetwork = 1; numberRows_ = -1; indices_ = new int[2*numberColumns_]; CoinBigIndex j = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { CoinBigIndex k = columnStart[iColumn]; int iRow; switch (columnLength[iColumn]) { case 0: goodNetwork = -1; // not classic network indices_[j] = -1; indices_[j+1] = -1; break; case 1: goodNetwork = -1; // not classic network if (fabs(elementByColumn[k] - 1.0) < 1.0e-10) { indices_[j] = -1; iRow = row[k]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j+1] = iRow; } else if (fabs(elementByColumn[k] + 1.0) < 1.0e-10) { indices_[j+1] = -1; iRow = row[k]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j] = iRow; } else { goodNetwork = 0; // not a network } break; case 2: if (fabs(elementByColumn[k] - 1.0) < 1.0e-10) { if (fabs(elementByColumn[k+1] + 1.0) < 1.0e-10) { iRow = row[k]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j+1] = iRow; iRow = row[k+1]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j] = iRow; } else { goodNetwork = 0; // not a network } } else if (fabs(elementByColumn[k] + 1.0) < 1.0e-10) { if (fabs(elementByColumn[k+1] - 1.0) < 1.0e-10) { iRow = row[k]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j] = iRow; iRow = row[k+1]; numberRows_ = CoinMax(numberRows_, iRow); indices_[j+1] = iRow; } else { goodNetwork = 0; // not a network } } else { goodNetwork = 0; // not a network } break; default: goodNetwork = 0; // not a network break; } if (!goodNetwork) break; } if (!goodNetwork) { delete [] indices_; // put in message printf("Not a network - can test if indices_ null\n"); indices_ = NULL; numberRows_ = 0; numberColumns_ = 0; } else { numberRows_ ++; // correct trueNetwork_ = goodNetwork > 0; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpNetworkMatrix::~ClpNetworkMatrix () { delete matrix_; delete [] lengths_; delete [] indices_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpNetworkMatrix & ClpNetworkMatrix::operator=(const ClpNetworkMatrix& rhs) { if (this != &rhs) { ClpMatrixBase::operator=(rhs); delete matrix_; delete [] lengths_; delete [] indices_; matrix_ = NULL; lengths_ = NULL; indices_ = NULL; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; trueNetwork_ = rhs.trueNetwork_; if (numberColumns_) { indices_ = new int [ 2*numberColumns_]; CoinMemcpyN(rhs.indices_, 2 * numberColumns_, indices_); } } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpMatrixBase * ClpNetworkMatrix::clone() const { return new ClpNetworkMatrix(*this); } /* Returns a new matrix in reverse order without gaps */ ClpMatrixBase * ClpNetworkMatrix::reverseOrderedCopy() const { // count number in each row CoinBigIndex * tempP = new CoinBigIndex [numberRows_]; CoinBigIndex * tempN = new CoinBigIndex [numberRows_]; memset(tempP, 0, numberRows_ * sizeof(CoinBigIndex)); memset(tempN, 0, numberRows_ * sizeof(CoinBigIndex)); CoinBigIndex j = 0; int i; for (i = 0; i < numberColumns_; i++, j += 2) { int iRow = indices_[j]; tempN[iRow]++; iRow = indices_[j+1]; tempP[iRow]++; } int * newIndices = new int [2*numberColumns_]; CoinBigIndex * newP = new CoinBigIndex [numberRows_+1]; CoinBigIndex * newN = new CoinBigIndex[numberRows_]; int iRow; j = 0; // do starts for (iRow = 0; iRow < numberRows_; iRow++) { newP[iRow] = j; j += tempP[iRow]; tempP[iRow] = newP[iRow]; newN[iRow] = j; j += tempN[iRow]; tempN[iRow] = newN[iRow]; } newP[numberRows_] = j; j = 0; for (i = 0; i < numberColumns_; i++, j += 2) { int iRow = indices_[j]; CoinBigIndex put = tempN[iRow]; newIndices[put++] = i; tempN[iRow] = put; iRow = indices_[j+1]; put = tempP[iRow]; newIndices[put++] = i; tempP[iRow] = put; } delete [] tempP; delete [] tempN; ClpPlusMinusOneMatrix * newCopy = new ClpPlusMinusOneMatrix(); newCopy->passInCopy(numberRows_, numberColumns_, false, newIndices, newP, newN); return newCopy; } //unscaled versions void ClpNetworkMatrix::times(double scalar, const double * x, double * y) const { int iColumn; CoinBigIndex j = 0; if (trueNetwork_) { for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { double value = scalar * x[iColumn]; if (value) { int iRowM = indices_[j]; int iRowP = indices_[j+1]; y[iRowM] -= value; y[iRowP] += value; } } } else { // skip negative rows for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { double value = scalar * x[iColumn]; if (value) { int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) y[iRowM] -= value; if (iRowP >= 0) y[iRowP] += value; } } } } void ClpNetworkMatrix::transposeTimes(double scalar, const double * x, double * y) const { int iColumn; CoinBigIndex j = 0; if (trueNetwork_) { for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { double value = y[iColumn]; int iRowM = indices_[j]; int iRowP = indices_[j+1]; value -= scalar * x[iRowM]; value += scalar * x[iRowP]; y[iColumn] = value; } } else { // skip negative rows for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { double value = y[iColumn]; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) value -= scalar * x[iRowM]; if (iRowP >= 0) value += scalar * x[iRowP]; y[iColumn] = value; } } } void ClpNetworkMatrix::times(double scalar, const double * x, double * y, const double * /*rowScale*/, const double * /*columnScale*/) const { // we know it is not scaled times(scalar, x, y); } void ClpNetworkMatrix::transposeTimes( double scalar, const double * x, double * y, const double * /*rowScale*/, const double * /*columnScale*/, double * /*spare*/) const { // we know it is not scaled transposeTimes(scalar, x, y); } /* Return x * A + y in z. Squashes small elements and knows about ClpSimplex */ void ClpNetworkMatrix::transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * rowArray, CoinIndexedVector * y, CoinIndexedVector * columnArray) const { // we know it is not scaled columnArray->clear(); double * pi = rowArray->denseVector(); int numberNonZero = 0; int * index = columnArray->getIndices(); double * array = columnArray->denseVector(); int numberInRowArray = rowArray->getNumElements(); // maybe I need one in OsiSimplex double zeroTolerance = model->zeroTolerance(); int numberRows = model->numberRows(); #ifndef NO_RTTI ClpPlusMinusOneMatrix* rowCopy = dynamic_cast< ClpPlusMinusOneMatrix*>(model->rowCopy()); #else ClpPlusMinusOneMatrix* rowCopy = static_cast< ClpPlusMinusOneMatrix*>(model->rowCopy()); #endif bool packed = rowArray->packedMode(); double factor = 0.3; // We may not want to do by row if there may be cache problems int numberColumns = model->numberColumns(); // It would be nice to find L2 cache size - for moment 512K // Be slightly optimistic if (numberColumns * sizeof(double) > 1000000) { if (numberRows * 10 < numberColumns) factor = 0.1; else if (numberRows * 4 < numberColumns) factor = 0.15; else if (numberRows * 2 < numberColumns) factor = 0.2; //if (model->numberIterations()%50==0) //printf("%d nonzero\n",numberInRowArray); } if (numberInRowArray > factor * numberRows || !rowCopy) { // do by column int iColumn; assert (!y->getNumElements()); CoinBigIndex j = 0; if (packed) { // need to expand pi into y assert(y->capacity() >= numberRows); double * piOld = pi; pi = y->denseVector(); const int * whichRow = rowArray->getIndices(); int i; // modify pi so can collapse to one loop for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = scalar * piOld[i]; } if (trueNetwork_) { for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { double value = 0.0; int iRowM = indices_[j]; int iRowP = indices_[j+1]; value -= pi[iRowM]; value += pi[iRowP]; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } else { // skip negative rows for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { double value = 0.0; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) value -= pi[iRowM]; if (iRowP >= 0) value += pi[iRowP]; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = 0.0; } } else { if (trueNetwork_) { for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { double value = 0.0; int iRowM = indices_[j]; int iRowP = indices_[j+1]; value -= scalar * pi[iRowM]; value += scalar * pi[iRowP]; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } else { // skip negative rows for (iColumn = 0; iColumn < numberColumns_; iColumn++, j += 2) { double value = 0.0; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) value -= scalar * pi[iRowM]; if (iRowP >= 0) value += scalar * pi[iRowP]; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } } columnArray->setNumElements(numberNonZero); } else { // do by row rowCopy->transposeTimesByRow(model, scalar, rowArray, y, columnArray); } } /* Return x *A in z but just for indices in y. */ void ClpNetworkMatrix::subsetTransposeTimes(const ClpSimplex * /*model*/, const CoinIndexedVector * rowArray, const CoinIndexedVector * y, CoinIndexedVector * columnArray) const { columnArray->clear(); double * pi = rowArray->denseVector(); double * array = columnArray->denseVector(); int jColumn; int numberToDo = y->getNumElements(); const int * which = y->getIndices(); assert (!rowArray->packedMode()); columnArray->setPacked(); if (trueNetwork_) { for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; double value = 0.0; CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; value -= pi[iRowM]; value += pi[iRowP]; array[jColumn] = value; } } else { // skip negative rows for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; double value = 0.0; CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) value -= pi[iRowM]; if (iRowP >= 0) value += pi[iRowP]; array[jColumn] = value; } } } /// returns number of elements in column part of basis, CoinBigIndex ClpNetworkMatrix::countBasis( const int * whichColumn, int & numberColumnBasic) { int i; CoinBigIndex numberElements = 0; if (trueNetwork_) { numberElements = 2 * numberColumnBasic; } else { for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) numberElements ++; if (iRowP >= 0) numberElements ++; } } return numberElements; } void ClpNetworkMatrix::fillBasis(ClpSimplex * /*model*/, const int * whichColumn, int & numberColumnBasic, int * indexRowU, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * elementU) { int i; CoinBigIndex numberElements = start[0]; if (trueNetwork_) { for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; indexRowU[numberElements] = iRowM; rowCount[iRowM]++; elementU[numberElements] = -1.0; indexRowU[numberElements+1] = iRowP; rowCount[iRowP]++; elementU[numberElements+1] = 1.0; numberElements += 2; start[i+1] = numberElements; columnCount[i] = 2; } } else { for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) { indexRowU[numberElements] = iRowM; rowCount[iRowM]++; elementU[numberElements++] = -1.0; } if (iRowP >= 0) { indexRowU[numberElements] = iRowP; rowCount[iRowP]++; elementU[numberElements++] = 1.0; } start[i+1] = numberElements; columnCount[i] = numberElements - start[i]; } } } /* Unpacks a column into an CoinIndexedvector */ void ClpNetworkMatrix::unpack(const ClpSimplex * /*model*/, CoinIndexedVector * rowArray, int iColumn) const { CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) rowArray->add(iRowM, -1.0); if (iRowP >= 0) rowArray->add(iRowP, 1.0); } /* Unpacks a column into an CoinIndexedvector ** in packed foramt Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ void ClpNetworkMatrix::unpackPacked(ClpSimplex * /*model*/, CoinIndexedVector * rowArray, int iColumn) const { int * index = rowArray->getIndices(); double * array = rowArray->denseVector(); int number = 0; CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) { array[number] = -1.0; index[number++] = iRowM; } if (iRowP >= 0) { array[number] = 1.0; index[number++] = iRowP; } rowArray->setNumElements(number); rowArray->setPackedMode(true); } /* Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ void ClpNetworkMatrix::add(const ClpSimplex * /*model*/, CoinIndexedVector * rowArray, int iColumn, double multiplier) const { CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) rowArray->quickAdd(iRowM, -multiplier); if (iRowP >= 0) rowArray->quickAdd(iRowP, multiplier); } /* Adds multiple of a column into an array */ void ClpNetworkMatrix::add(const ClpSimplex * /*model*/, double * array, int iColumn, double multiplier) const { CoinBigIndex j = iColumn << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) array[iRowM] -= multiplier; if (iRowP >= 0) array[iRowP] += multiplier; } // Return a complete CoinPackedMatrix CoinPackedMatrix * ClpNetworkMatrix::getPackedMatrix() const { if (!matrix_) { assert (trueNetwork_); // fix later int numberElements = 2 * numberColumns_; double * elements = new double [numberElements]; CoinBigIndex i; for (i = 0; i < 2 * numberColumns_; i += 2) { elements[i] = -1.0; elements[i+1] = 1.0; } CoinBigIndex * starts = new CoinBigIndex [numberColumns_+1]; for (i = 0; i < numberColumns_ + 1; i++) { starts[i] = 2 * i; } // use assignMatrix to save space delete [] lengths_; lengths_ = NULL; matrix_ = new CoinPackedMatrix(); int * indices = CoinCopyOfArray(indices_, 2 * numberColumns_); matrix_->assignMatrix(true, numberRows_, numberColumns_, getNumElements(), elements, indices, starts, lengths_); assert(!elements); assert(!starts); assert (!indices); assert (!lengths_); } return matrix_; } /* A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ const double * ClpNetworkMatrix::getElements() const { if (!matrix_) getPackedMatrix(); return matrix_->getElements(); } const CoinBigIndex * ClpNetworkMatrix::getVectorStarts() const { if (!matrix_) getPackedMatrix(); return matrix_->getVectorStarts(); } /* The lengths of the major-dimension vectors. */ const int * ClpNetworkMatrix::getVectorLengths() const { assert (trueNetwork_); // fix later if (!lengths_) { lengths_ = new int [numberColumns_]; int i; for (i = 0; i < numberColumns_; i++) { lengths_[i] = 2; } } return lengths_; } /* Delete the columns whose indices are listed in indDel. */ void ClpNetworkMatrix::deleteCols(const int numDel, const int * indDel) { assert (trueNetwork_); int iColumn; int numberBad = 0; // Use array to make sure we can have duplicates char * which = new char[numberColumns_]; memset(which, 0, numberColumns_); int nDuplicate = 0; for (iColumn = 0; iColumn < numDel; iColumn++) { int jColumn = indDel[iColumn]; if (jColumn < 0 || jColumn >= numberColumns_) { numberBad++; } else { if (which[jColumn]) nDuplicate++; else which[jColumn] = 1; } } if (numberBad) throw CoinError("Indices out of range", "deleteCols", "ClpNetworkMatrix"); int newNumber = numberColumns_ - numDel + nDuplicate; // Get rid of temporary arrays delete [] lengths_; lengths_ = NULL; delete matrix_; matrix_ = NULL; int newSize = 2 * newNumber; int * newIndices = new int [newSize]; newSize = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (!which[iColumn]) { CoinBigIndex start; CoinBigIndex i; start = 2 * iColumn; for (i = start; i < start + 2; i++) newIndices[newSize++] = indices_[i]; } } delete [] which; delete [] indices_; indices_ = newIndices; numberColumns_ = newNumber; } /* Delete the rows whose indices are listed in indDel. */ void ClpNetworkMatrix::deleteRows(const int numDel, const int * indDel) { int iRow; int numberBad = 0; // Use array to make sure we can have duplicates int * which = new int [numberRows_]; memset(which, 0, numberRows_ * sizeof(int)); for (iRow = 0; iRow < numDel; iRow++) { int jRow = indDel[iRow]; if (jRow < 0 || jRow >= numberRows_) { numberBad++; } else { which[jRow] = 1; } } if (numberBad) throw CoinError("Indices out of range", "deleteRows", "ClpNetworkMatrix"); // Only valid of all columns have 0 entries int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex start; CoinBigIndex i; start = 2 * iColumn; for (i = start; i < start + 2; i++) { int iRow = indices_[i]; if (which[iRow]) numberBad++; } } if (numberBad) throw CoinError("Row has entries", "deleteRows", "ClpNetworkMatrix"); int newNumber = 0; for (iRow = 0; iRow < numberRows_; iRow++) { if (!which[iRow]) which[iRow] = newNumber++; else which[iRow] = -1; } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex start; CoinBigIndex i; start = 2 * iColumn; for (i = start; i < start + 2; i++) { int iRow = indices_[i]; indices_[i] = which[iRow]; } } delete [] which; numberRows_ = newNumber; } /* Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector */ CoinBigIndex * ClpNetworkMatrix::dubiousWeights(const ClpSimplex * model, int * inputWeights) const { int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); int number = numberRows + numberColumns; CoinBigIndex * weights = new CoinBigIndex[number]; int i; for (i = 0; i < numberColumns; i++) { CoinBigIndex j = i << 1; CoinBigIndex count = 0; int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) { count += inputWeights[iRowM]; } if (iRowP >= 0) { count += inputWeights[iRowP]; } weights[i] = count; } for (i = 0; i < numberRows; i++) { weights[i+numberColumns] = inputWeights[i]; } return weights; } /* Returns largest and smallest elements of both signs. Largest refers to largest absolute value. */ void ClpNetworkMatrix::rangeOfElements(double & smallestNegative, double & largestNegative, double & smallestPositive, double & largestPositive) { smallestNegative = -1.0; largestNegative = -1.0; smallestPositive = 1.0; largestPositive = 1.0; } // Says whether it can do partial pricing bool ClpNetworkMatrix::canDoPartialPricing() const { return true; } // Partial pricing void ClpNetworkMatrix::partialPricing(ClpSimplex * model, double startFraction, double endFraction, int & bestSequence, int & numberWanted) { numberWanted = currentWanted_; int j; int start = static_cast (startFraction * numberColumns_); int end = CoinMin(static_cast (endFraction * numberColumns_ + 1), numberColumns_); double tolerance = model->currentDualTolerance(); double * reducedCost = model->djRegion(); const double * duals = model->dualRowSolution(); const double * cost = model->costRegion(); double bestDj; if (bestSequence >= 0) bestDj = fabs(reducedCost[bestSequence]); else bestDj = tolerance; int sequenceOut = model->sequenceOut(); int saveSequence = bestSequence; if (!trueNetwork_) { // Not true network int iSequence; for (iSequence = start; iSequence < end; iSequence++) { if (iSequence != sequenceOut) { double value; int iRowM, iRowP; ClpSimplex::Status status = model->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = cost[iSequence]; j = iSequence << 1; // skip negative rows iRowM = indices_[j]; iRowP = indices_[j+1]; if (iRowM >= 0) value += duals[iRowM]; if (iRowP >= 0) value -= duals[iRowP]; value = fabs(value); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atUpperBound: value = cost[iSequence]; j = iSequence << 1; // skip negative rows iRowM = indices_[j]; iRowP = indices_[j+1]; if (iRowM >= 0) value += duals[iRowM]; if (iRowP >= 0) value -= duals[iRowP]; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atLowerBound: value = cost[iSequence]; j = iSequence << 1; // skip negative rows iRowM = indices_[j]; iRowP = indices_[j+1]; if (iRowM >= 0) value += duals[iRowM]; if (iRowP >= 0) value -= duals[iRowP]; value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (!numberWanted) break; } if (bestSequence != saveSequence) { // recompute dj double value = cost[bestSequence]; j = bestSequence << 1; // skip negative rows int iRowM = indices_[j]; int iRowP = indices_[j+1]; if (iRowM >= 0) value += duals[iRowM]; if (iRowP >= 0) value -= duals[iRowP]; reducedCost[bestSequence] = value; savedBestSequence_ = bestSequence; savedBestDj_ = reducedCost[savedBestSequence_]; } } else { // true network int iSequence; for (iSequence = start; iSequence < end; iSequence++) { if (iSequence != sequenceOut) { double value; int iRowM, iRowP; ClpSimplex::Status status = model->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = cost[iSequence]; j = iSequence << 1; iRowM = indices_[j]; iRowP = indices_[j+1]; value += duals[iRowM]; value -= duals[iRowP]; value = fabs(value); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atUpperBound: value = cost[iSequence]; j = iSequence << 1; iRowM = indices_[j]; iRowP = indices_[j+1]; value += duals[iRowM]; value -= duals[iRowP]; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atLowerBound: value = cost[iSequence]; j = iSequence << 1; iRowM = indices_[j]; iRowP = indices_[j+1]; value += duals[iRowM]; value -= duals[iRowP]; value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (!numberWanted) break; } if (bestSequence != saveSequence) { // recompute dj double value = cost[bestSequence]; j = bestSequence << 1; int iRowM = indices_[j]; int iRowP = indices_[j+1]; value += duals[iRowM]; value -= duals[iRowP]; reducedCost[bestSequence] = value; savedBestSequence_ = bestSequence; savedBestDj_ = reducedCost[savedBestSequence_]; } } currentWanted_ = numberWanted; } // Allow any parts of a created CoinMatrix to be deleted void ClpNetworkMatrix::releasePackedMatrix() const { delete matrix_; delete [] lengths_; matrix_ = NULL; lengths_ = NULL; } // Append Columns void ClpNetworkMatrix::appendCols(int number, const CoinPackedVectorBase * const * columns) { int iColumn; int numberBad = 0; for (iColumn = 0; iColumn < number; iColumn++) { int n = columns[iColumn]->getNumElements(); const double * element = columns[iColumn]->getElements(); if (n != 2) numberBad++; if (fabs(element[0]) != 1.0 || fabs(element[1]) != 1.0) numberBad++; else if (element[0]*element[1] != -1.0) numberBad++; } if (numberBad) throw CoinError("Not network", "appendCols", "ClpNetworkMatrix"); // Get rid of temporary arrays delete [] lengths_; lengths_ = NULL; delete matrix_; matrix_ = NULL; CoinBigIndex size = 2 * number; int * temp2 = new int [numberColumns_*2+size]; CoinMemcpyN(indices_, numberColumns_ * 2, temp2); delete [] indices_; indices_ = temp2; // now add size = 2 * numberColumns_; for (iColumn = 0; iColumn < number; iColumn++) { const int * row = columns[iColumn]->getIndices(); const double * element = columns[iColumn]->getElements(); if (element[0] == -1.0) { indices_[size++] = row[0]; indices_[size++] = row[1]; } else { indices_[size++] = row[1]; indices_[size++] = row[0]; } } numberColumns_ += number; } // Append Rows void ClpNetworkMatrix::appendRows(int number, const CoinPackedVectorBase * const * rows) { // must be zero arrays int numberBad = 0; int iRow; for (iRow = 0; iRow < number; iRow++) { numberBad += rows[iRow]->getNumElements(); } if (numberBad) throw CoinError("Not NULL rows", "appendRows", "ClpNetworkMatrix"); numberRows_ += number; } #ifndef SLIM_CLP /* Append a set of rows/columns to the end of the matrix. Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns */ int ClpNetworkMatrix::appendMatrix(int number, int type, const CoinBigIndex * starts, const int * index, const double * element, int /*numberOther*/) { int numberErrors = 0; // make into CoinPackedVector CoinPackedVectorBase ** vectors = new CoinPackedVectorBase * [number]; int iVector; for (iVector = 0; iVector < number; iVector++) { int iStart = starts[iVector]; vectors[iVector] = new CoinPackedVector(starts[iVector+1] - iStart, index + iStart, element + iStart); } if (type == 0) { // rows appendRows(number, vectors); } else { // columns appendCols(number, vectors); } for (iVector = 0; iVector < number; iVector++) delete vectors[iVector]; delete [] vectors; return numberErrors; } #endif /* Subset clone (without gaps). Duplicates are allowed and order is as given */ ClpMatrixBase * ClpNetworkMatrix::subsetClone (int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const { return new ClpNetworkMatrix(*this, numberRows, whichRows, numberColumns, whichColumns); } /* Subset constructor (without gaps). Duplicates are allowed and order is as given */ ClpNetworkMatrix::ClpNetworkMatrix ( const ClpNetworkMatrix & rhs, int numberRows, const int * whichRow, int numberColumns, const int * whichColumn) : ClpMatrixBase(rhs) { setType(11); matrix_ = NULL; lengths_ = NULL; indices_ = new int[2*numberColumns];; numberRows_ = numberRows; numberColumns_ = numberColumns; trueNetwork_ = true; int iColumn; int numberBad = 0; int * which = new int [rhs.numberRows_]; int iRow; for (iRow = 0; iRow < rhs.numberRows_; iRow++) which[iRow] = -1; int n = 0; for (iRow = 0; iRow < numberRows; iRow++) { int jRow = whichRow[iRow]; assert (jRow >= 0 && jRow < rhs.numberRows_); which[jRow] = n++; } for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex start; CoinBigIndex i; start = 2 * iColumn; CoinBigIndex offset = 2 * whichColumn[iColumn] - start; for (i = start; i < start + 2; i++) { int iRow = rhs.indices_[i+offset]; iRow = which[iRow]; if (iRow < 0) numberBad++; else indices_[i] = iRow; } } if (numberBad) throw CoinError("Invalid rows", "subsetConstructor", "ClpNetworkMatrix"); } CoinMP-1.8.3/Clp/src/ClpNode.hpp0000644000175000017500000002335612101105055014655 0ustar renerene/* $Id: ClpNode.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpNode_H #define ClpNode_H #include "CoinPragma.hpp" // This implements all stuff for Clp fathom /** This contains what is in a Clp "node" */ class ClpFactorization; class ClpDualRowSteepest; class ClpNodeStuff; class ClpNode { public: /**@name Useful methods */ //@{ /** Applies node to model 0 - just tree bounds 1 - tree bounds and basis etc 2 - saved bounds and basis etc */ void applyNode(ClpSimplex * model, int doBoundsEtc ); /// Choose a new variable void chooseVariable(ClpSimplex * model, ClpNodeStuff * info); /// Fix on reduced costs int fixOnReducedCosts(ClpSimplex * model); /// Create odd arrays void createArrays(ClpSimplex * model); /// Clean up as crunch is different model void cleanUpForCrunch(); //@} /**@name Gets and sets */ //@{ /// Objective value inline double objectiveValue() const { return objectiveValue_; } /// Set objective value inline void setObjectiveValue(double value) { objectiveValue_ = value; } /// Primal solution inline const double * primalSolution() const { return primalSolution_; } /// Dual solution inline const double * dualSolution() const { return dualSolution_; } /// Initial value of integer variable inline double branchingValue() const { return branchingValue_; } /// Sum infeasibilities inline double sumInfeasibilities() const { return sumInfeasibilities_; } /// Number infeasibilities inline int numberInfeasibilities() const { return numberInfeasibilities_; } /// Relative depth inline int depth() const { return depth_; } /// Estimated solution value inline double estimatedSolution() const { return estimatedSolution_; } /** Way for integer variable -1 down , +1 up */ int way() const; /// Return true if branch exhausted bool fathomed() const; /// Change state of variable i.e. go other way void changeState(); /// Sequence number of integer variable (-1 if none) inline int sequence() const { return sequence_; } /// If odd arrays exist inline bool oddArraysExist() const { return lower_ != NULL; } /// Status array inline const unsigned char * statusArray() const { return status_; } //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpNode(); /// Constructor from model ClpNode (ClpSimplex * model, const ClpNodeStuff * stuff, int depth); /// Does work of constructor (partly so gdb will work) void gutsOfConstructor(ClpSimplex * model, const ClpNodeStuff * stuff, int arraysExist, int depth); /** Destructor */ virtual ~ClpNode(); //@} /**@name Copy methods (at present illegal - will abort) */ //@{ /** The copy constructor. */ ClpNode(const ClpNode&); /// Operator = ClpNode& operator=(const ClpNode&); //@} protected: // For state of branch typedef struct { unsigned int firstBranch: 1; // nonzero if first branch on variable is up unsigned int branch: 2; // 0 means do first branch next, 1 second, 2 finished unsigned int spare: 29; } branchState; /**@name Data */ //@{ /// Initial value of integer variable double branchingValue_; /// Value of objective double objectiveValue_; /// Sum of infeasibilities double sumInfeasibilities_; /// Estimated solution value double estimatedSolution_; /// Factorization ClpFactorization * factorization_; /// Steepest edge weights ClpDualRowSteepest * weights_; /// Status vector unsigned char * status_; /// Primal solution double * primalSolution_; /// Dual solution double * dualSolution_; /// Integer lower bounds (only used in fathomMany) int * lower_; /// Integer upper bounds (only used in fathomMany) int * upper_; /// Pivot variables for factorization int * pivotVariables_; /// Variables fixed by reduced costs (at end of branch) 0x10000000 added if fixed to UB int * fixed_; /// State of branch branchState branchState_; /// Sequence number of integer variable (-1 if none) int sequence_; /// Number of infeasibilities int numberInfeasibilities_; /// Relative depth int depth_; /// Number fixed by reduced cost int numberFixed_; /// Flags - 1 duals scaled int flags_; /// Maximum number fixed by reduced cost int maximumFixed_; /// Maximum rows so far int maximumRows_; /// Maximum columns so far int maximumColumns_; /// Maximum Integers so far int maximumIntegers_; //@} }; class ClpNodeStuff { public: /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpNodeStuff(); /** Destructor */ virtual ~ClpNodeStuff(); //@} /**@name Copy methods (only copies ints etc, nulls arrays) */ //@{ /** The copy constructor. */ ClpNodeStuff(const ClpNodeStuff&); /// Operator = ClpNodeStuff& operator=(const ClpNodeStuff&); /// Zaps stuff 1 - arrays, 2 ints, 3 both void zap(int type); //@} /**@name Fill methods */ //@{ /** Fill with pseudocosts */ void fillPseudoCosts(const double * down, const double * up, const int * priority, const int * numberDown, const int * numberUp, const int * numberDownInfeasible, const int * numberUpInfeasible, int number); /// Update pseudo costs void update(int way, int sequence, double change, bool feasible); /// Return maximum number of nodes int maximumNodes() const; /// Return maximum space for nodes int maximumSpace() const; //@} public: /**@name Data */ //@{ /// Integer tolerance double integerTolerance_; /// Integer increment double integerIncrement_; /// Small change in branch double smallChange_; /// Down pseudo costs double * downPseudo_; /// Up pseudo costs double * upPseudo_; /// Priority int * priority_; /// Number of times down int * numberDown_; /// Number of times up int * numberUp_; /// Number of times down infeasible int * numberDownInfeasible_; /// Number of times up infeasible int * numberUpInfeasible_; /// Copy of costs (local) double * saveCosts_; /// Array of ClpNodes ClpNode ** nodeInfo_; /// Large model if crunched ClpSimplex * large_; /// Which rows in large model int * whichRow_; /// Which columns in large model int * whichColumn_; #ifndef NO_FATHOM_PRINT /// Cbc's message handler CoinMessageHandler * handler_; #endif /// Number bounds in large model int nBound_; /// Save of specialOptions_ (local) int saveOptions_; /** Options to pass to solver 1 - create external reduced costs for columns 2 - create external reduced costs for rows 4 - create external row activity (columns always done) Above only done if feasible 32 - just create up to nDepth_+1 nodes 65536 - set if activated */ int solverOptions_; /// Maximum number of nodes to do int maximumNodes_; /// Number before trust from CbcModel int numberBeforeTrust_; /// State of search from CbcModel int stateOfSearch_; /// Number deep int nDepth_; /// Number nodes returned (-1 if fathom aborted) int nNodes_; /// Number of nodes explored int numberNodesExplored_; /// Number of iterations int numberIterations_; /// Type of presolve - 0 none, 1 crunch int presolveType_; #ifndef NO_FATHOM_PRINT /// Depth passed in int startingDepth_; /// Node at which called int nodeCalled_; #endif //@} }; class ClpHashValue { public: /**@name Useful methods */ //@{ /// Return index or -1 if not found int index(double value) const; /// Add value to list and return index int addValue(double value) ; /// Number of different entries inline int numberEntries() const { return numberHash_; } //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpHashValue(); /** Useful constructor. */ ClpHashValue(ClpSimplex * model); /** Destructor */ virtual ~ClpHashValue(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpHashValue(const ClpHashValue&); /// = ClpHashValue& operator=(const ClpHashValue&); //@} private: /**@name private stuff */ //@{ /** returns hash */ int hash(double value) const; /// Resizes void resize(bool increaseMax); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Data // for hashing typedef struct { double value; int index, next; } CoinHashLink; /// Hash table mutable CoinHashLink *hash_; /// Number of entries in hash table int numberHash_; /// Maximum number of entries in hash table i.e. size int maxHash_; /// Last used space int lastUsed_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpModel.hpp0000644000175000017500000014171412442012732015036 0ustar renerene/* $Id: ClpModel.hpp 2074 2014-12-10 09:43:54Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpModel_H #define ClpModel_H #include "ClpConfig.h" #include #include #include #include #include //#ifndef COIN_USE_CLP //#define COIN_USE_CLP //#endif #include "ClpPackedMatrix.hpp" #include "CoinMessageHandler.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTypes.hpp" #include "CoinFinite.hpp" #include "ClpParameters.hpp" #include "ClpObjective.hpp" class ClpEventHandler; /** This is the base class for Linear and quadratic Models This knows nothing about the algorithm, but it seems to have a reasonable amount of information I would welcome suggestions for what should be in this and how it relates to OsiSolverInterface. Some methods look very similar. */ class CoinBuild; class CoinModel; class ClpModel { public: /**@name Constructors and destructor Note - copy methods copy ALL data so can chew up memory until other copy is freed */ //@{ /// Default constructor ClpModel (bool emptyMessages = false ); /** Copy constructor. May scale depending on mode -1 leave mode as is 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 auto-but-as-initialSolve-in-bab */ ClpModel(const ClpModel & rhs, int scalingMode = -1); /// Assignment operator. This copies the data ClpModel & operator=(const ClpModel & rhs); /** Subproblem constructor. A subset of whole model is created from the row and column lists given. The new order is given by list order and duplicates are allowed. Name and integer information can be dropped */ ClpModel (const ClpModel * wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns, bool dropNames = true, bool dropIntegers = true); /// Destructor ~ClpModel ( ); //@} /**@name Load model - loads some stuff and initializes others */ //@{ /** Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ void loadProblem ( const ClpMatrixBase& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); void loadProblem ( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /** Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ void loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /** This loads a model from a coinModel object - returns number of errors. modelObject not const as may be changed as part of process If tryPlusMinusOne then will try adding as +-1 matrix */ int loadProblem ( CoinModel & modelObject, bool tryPlusMinusOne = false); /// This one is for after presolve to save memory void loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const int * length, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /** Load up quadratic objective. This is stored as a CoinPackedMatrix */ void loadQuadraticObjective(const int numberColumns, const CoinBigIndex * start, const int * column, const double * element); void loadQuadraticObjective ( const CoinPackedMatrix& matrix); /// Get rid of quadratic objective void deleteQuadraticObjective(); /// This just loads up a row objective void setRowObjective(const double * rowObjective); /// Read an mps file from the given filename int readMps(const char *filename, bool keepNames = false, bool ignoreErrors = false); /// Read GMPL files from the given filenames int readGMPL(const char *filename, const char * dataName, bool keepNames = false); /// Copy in integer informations void copyInIntegerInformation(const char * information); /// Drop integer informations void deleteIntegerInformation(); /** Set the index-th variable to be a continuous variable */ void setContinuous(int index); /** Set the index-th variable to be an integer variable */ void setInteger(int index); /** Return true if the index-th variable is an integer variable */ bool isInteger(int index) const; /// Resizes rim part of model void resize (int newNumberRows, int newNumberColumns); /// Deletes rows void deleteRows(int number, const int * which); /// Add one row void addRow(int numberInRow, const int * columns, const double * elements, double rowLower = -COIN_DBL_MAX, double rowUpper = COIN_DBL_MAX); /// Add rows void addRows(int number, const double * rowLower, const double * rowUpper, const CoinBigIndex * rowStarts, const int * columns, const double * elements); /// Add rows void addRows(int number, const double * rowLower, const double * rowUpper, const CoinBigIndex * rowStarts, const int * rowLengths, const int * columns, const double * elements); #ifndef CLP_NO_VECTOR void addRows(int number, const double * rowLower, const double * rowUpper, const CoinPackedVectorBase * const * rows); #endif /** Add rows from a build object. If tryPlusMinusOne then will try adding as +-1 matrix if no matrix exists. Returns number of errors e.g. duplicates */ int addRows(const CoinBuild & buildObject, bool tryPlusMinusOne = false, bool checkDuplicates = true); /** Add rows from a model object. returns -1 if object in bad state (i.e. has column information) otherwise number of errors. modelObject non const as can be regularized as part of build If tryPlusMinusOne then will try adding as +-1 matrix if no matrix exists. */ int addRows(CoinModel & modelObject, bool tryPlusMinusOne = false, bool checkDuplicates = true); /// Deletes columns void deleteColumns(int number, const int * which); /// Deletes rows AND columns (keeps old sizes) void deleteRowsAndColumns(int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); /// Add one column void addColumn(int numberInColumn, const int * rows, const double * elements, double columnLower = 0.0, double columnUpper = COIN_DBL_MAX, double objective = 0.0); /// Add columns void addColumns(int number, const double * columnLower, const double * columnUpper, const double * objective, const CoinBigIndex * columnStarts, const int * rows, const double * elements); void addColumns(int number, const double * columnLower, const double * columnUpper, const double * objective, const CoinBigIndex * columnStarts, const int * columnLengths, const int * rows, const double * elements); #ifndef CLP_NO_VECTOR void addColumns(int number, const double * columnLower, const double * columnUpper, const double * objective, const CoinPackedVectorBase * const * columns); #endif /** Add columns from a build object If tryPlusMinusOne then will try adding as +-1 matrix if no matrix exists. Returns number of errors e.g. duplicates */ int addColumns(const CoinBuild & buildObject, bool tryPlusMinusOne = false, bool checkDuplicates = true); /** Add columns from a model object. returns -1 if object in bad state (i.e. has row information) otherwise number of errors modelObject non const as can be regularized as part of build If tryPlusMinusOne then will try adding as +-1 matrix if no matrix exists. */ int addColumns(CoinModel & modelObject, bool tryPlusMinusOne = false, bool checkDuplicates = true); /// Modify one element of a matrix inline void modifyCoefficient(int row, int column, double newElement, bool keepZero = false) { matrix_->modifyCoefficient(row, column, newElement, keepZero); } /** Change row lower bounds */ void chgRowLower(const double * rowLower); /** Change row upper bounds */ void chgRowUpper(const double * rowUpper); /** Change column lower bounds */ void chgColumnLower(const double * columnLower); /** Change column upper bounds */ void chgColumnUpper(const double * columnUpper); /** Change objective coefficients */ void chgObjCoefficients(const double * objIn); /** Borrow model. This is so we don't have to copy large amounts of data around. It assumes a derived class wants to overwrite an empty model with a real one - while it does an algorithm */ void borrowModel(ClpModel & otherModel); /** Return model - nulls all arrays so can be deleted safely also updates any scalars */ void returnModel(ClpModel & otherModel); /// Create empty ClpPackedMatrix void createEmptyMatrix(); /** Really clean up matrix (if ClpPackedMatrix). a) eliminate all duplicate AND small elements in matrix b) remove all gaps and set extraGap_ and extraMajor_ to 0.0 c) reallocate arrays and make max lengths equal to lengths d) orders elements returns number of elements eliminated or -1 if not ClpPackedMatrix */ int cleanMatrix(double threshold = 1.0e-20); /// Copy contents - resizing if necessary - otherwise re-use memory void copy(const ClpMatrixBase * from, ClpMatrixBase * & to); #ifndef CLP_NO_STD /// Drops names - makes lengthnames 0 and names empty void dropNames(); /// Copies in names void copyNames(const std::vector & rowNames, const std::vector & columnNames); /// Copies in Row names - modifies names first .. last-1 void copyRowNames(const std::vector & rowNames, int first, int last); /// Copies in Column names - modifies names first .. last-1 void copyColumnNames(const std::vector & columnNames, int first, int last); /// Copies in Row names - modifies names first .. last-1 void copyRowNames(const char * const * rowNames, int first, int last); /// Copies in Column names - modifies names first .. last-1 void copyColumnNames(const char * const * columnNames, int first, int last); /// Set name of row void setRowName(int rowIndex, std::string & name) ; /// Set name of col void setColumnName(int colIndex, std::string & name) ; #endif /** Find a network subset. rotate array should be numberRows. On output -1 not in network 0 in network as is 1 in network with signs swapped Returns number of network rows */ int findNetwork(char * rotate, double fractionNeeded = 0.75); /** This creates a coinModel object */ CoinModel * createCoinModel() const; /** Write the problem in MPS format to the specified file. Row and column names may be null. formatType is
    • 0 - normal
    • 1 - extra accuracy
    • 2 - IEEE hex
    Returns non-zero on I/O error */ int writeMps(const char *filename, int formatType = 0, int numberAcross = 2, double objSense = 0.0) const ; //@} /**@name gets and sets */ //@{ /// Number of rows inline int numberRows() const { return numberRows_; } inline int getNumRows() const { return numberRows_; } /// Number of columns inline int getNumCols() const { return numberColumns_; } inline int numberColumns() const { return numberColumns_; } /// Primal tolerance to use inline double primalTolerance() const { return dblParam_[ClpPrimalTolerance]; } void setPrimalTolerance( double value) ; /// Dual tolerance to use inline double dualTolerance() const { return dblParam_[ClpDualTolerance]; } void setDualTolerance( double value) ; /// Primal objective limit inline double primalObjectiveLimit() const { return dblParam_[ClpPrimalObjectiveLimit]; } void setPrimalObjectiveLimit(double value); /// Dual objective limit inline double dualObjectiveLimit() const { return dblParam_[ClpDualObjectiveLimit]; } void setDualObjectiveLimit(double value); /// Objective offset inline double objectiveOffset() const { return dblParam_[ClpObjOffset]; } void setObjectiveOffset(double value); /// Presolve tolerance to use inline double presolveTolerance() const { return dblParam_[ClpPresolveTolerance]; } #ifndef CLP_NO_STD inline const std::string & problemName() const { return strParam_[ClpProbName]; } #endif /// Number of iterations inline int numberIterations() const { return numberIterations_; } inline int getIterationCount() const { return numberIterations_; } inline void setNumberIterations(int numberIterationsNew) { numberIterations_ = numberIterationsNew; } /** Solve type - 1 simplex, 2 simplex interface, 3 Interior.*/ inline int solveType() const { return solveType_; } inline void setSolveType(int type) { solveType_ = type; } /// Maximum number of iterations inline int maximumIterations() const { return intParam_[ClpMaxNumIteration]; } void setMaximumIterations(int value); /// Maximum time in seconds (from when set called) inline double maximumSeconds() const { return dblParam_[ClpMaxSeconds]; } void setMaximumSeconds(double value); void setMaximumWallSeconds(double value); /// Returns true if hit maximum iterations (or time) bool hitMaximumIterations() const; /** Status of problem: -1 - unknown e.g. before solve or if postSolve says not optimal 0 - optimal 1 - primal infeasible 2 - dual infeasible 3 - stopped on iterations or time 4 - stopped due to errors 5 - stopped by event handler (virtual int ClpEventHandler::event()) */ inline int status() const { return problemStatus_; } inline int problemStatus() const { return problemStatus_; } /// Set problem status inline void setProblemStatus(int problemStatusNew) { problemStatus_ = problemStatusNew; } /** Secondary status of problem - may get extended 0 - none 1 - primal infeasible because dual limit reached OR (probably primal infeasible but can't prove it - main status was 4) 2 - scaled problem optimal - unscaled problem has primal infeasibilities 3 - scaled problem optimal - unscaled problem has dual infeasibilities 4 - scaled problem optimal - unscaled problem has primal and dual infeasibilities 5 - giving up in primal with flagged variables 6 - failed due to empty problem check 7 - postSolve says not optimal 8 - failed due to bad element check 9 - status was 3 and stopped on time 10 - status was 3 but stopped as primal feasible 100 up - translation of enum from ClpEventHandler */ inline int secondaryStatus() const { return secondaryStatus_; } inline void setSecondaryStatus(int newstatus) { secondaryStatus_ = newstatus; } /// Are there a numerical difficulties? inline bool isAbandoned() const { return problemStatus_ == 4; } /// Is optimality proven? inline bool isProvenOptimal() const { return problemStatus_ == 0; } /// Is primal infeasiblity proven? inline bool isProvenPrimalInfeasible() const { return problemStatus_ == 1; } /// Is dual infeasiblity proven? inline bool isProvenDualInfeasible() const { return problemStatus_ == 2; } /// Is the given primal objective limit reached? bool isPrimalObjectiveLimitReached() const ; /// Is the given dual objective limit reached? bool isDualObjectiveLimitReached() const ; /// Iteration limit reached? inline bool isIterationLimitReached() const { return problemStatus_ == 3; } /// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore inline double optimizationDirection() const { return optimizationDirection_; } inline double getObjSense() const { return optimizationDirection_; } void setOptimizationDirection(double value); /// Primal row solution inline double * primalRowSolution() const { return rowActivity_; } inline const double * getRowActivity() const { return rowActivity_; } /// Primal column solution inline double * primalColumnSolution() const { return columnActivity_; } inline const double * getColSolution() const { return columnActivity_; } inline void setColSolution(const double * input) { memcpy(columnActivity_, input, numberColumns_ * sizeof(double)); } /// Dual row solution inline double * dualRowSolution() const { return dual_; } inline const double * getRowPrice() const { return dual_; } /// Reduced costs inline double * dualColumnSolution() const { return reducedCost_; } inline const double * getReducedCost() const { return reducedCost_; } /// Row lower inline double* rowLower() const { return rowLower_; } inline const double* getRowLower() const { return rowLower_; } /// Row upper inline double* rowUpper() const { return rowUpper_; } inline const double* getRowUpper() const { return rowUpper_; } //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ void setObjectiveCoefficient( int elementIndex, double elementValue ); /** Set an objective function coefficient */ inline void setObjCoeff( int elementIndex, double elementValue ) { setObjectiveCoefficient( elementIndex, elementValue); } /** Set a single column lower bound
    Use -DBL_MAX for -infinity. */ void setColumnLower( int elementIndex, double elementValue ); /** Set a single column upper bound
    Use DBL_MAX for infinity. */ void setColumnUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound */ void setColumnBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
    The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ void setColumnSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single column lower bound
    Use -DBL_MAX for -infinity. */ inline void setColLower( int elementIndex, double elementValue ) { setColumnLower(elementIndex, elementValue); } /** Set a single column upper bound
    Use DBL_MAX for infinity. */ inline void setColUpper( int elementIndex, double elementValue ) { setColumnUpper(elementIndex, elementValue); } /** Set a single column lower and upper bound */ inline void setColBounds( int elementIndex, double lower, double upper ) { setColumnBounds(elementIndex, lower, upper); } /** Set the bounds on a number of columns simultaneously
    @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ inline void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { setColumnSetBounds(indexFirst, indexLast, boundList); } /** Set a single row lower bound
    Use -DBL_MAX for -infinity. */ void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
    Use DBL_MAX for infinity. */ void setRowUpper( int elementIndex, double elementValue ) ; /** Set a single row lower and upper bound */ void setRowBounds( int elementIndex, double lower, double upper ) ; /** Set the bounds on a number of rows simultaneously
    @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); //@} /// Scaling inline const double * rowScale() const { return rowScale_; } inline const double * columnScale() const { return columnScale_; } inline const double * inverseRowScale() const { return inverseRowScale_; } inline const double * inverseColumnScale() const { return inverseColumnScale_; } inline double * mutableRowScale() const { return rowScale_; } inline double * mutableColumnScale() const { return columnScale_; } inline double * mutableInverseRowScale() const { return inverseRowScale_; } inline double * mutableInverseColumnScale() const { return inverseColumnScale_; } inline double * swapRowScale(double * newScale) { double * oldScale = rowScale_; rowScale_ = newScale; return oldScale; } void setRowScale(double * scale) ; void setColumnScale(double * scale); /// Scaling of objective inline double objectiveScale() const { return objectiveScale_; } inline void setObjectiveScale(double value) { objectiveScale_ = value; } /// Scaling of rhs and bounds inline double rhsScale() const { return rhsScale_; } inline void setRhsScale(double value) { rhsScale_ = value; } /// Sets or unsets scaling, 0 -off, 1 equilibrium, 2 geometric, 3 auto, 4 auto-but-as-initialSolve-in-bab void scaling(int mode = 1); /** If we constructed a "really" scaled model then this reverses the operation. Quantities may not be exactly as they were before due to rounding errors */ void unscale(); /// Gets scalingFlag inline int scalingFlag() const { return scalingFlag_; } /// Objective inline double * objective() const { if (objective_) { double offset; return objective_->gradient(NULL, NULL, offset, false); } else { return NULL; } } inline double * objective(const double * solution, double & offset, bool refresh = true) const { offset = 0.0; if (objective_) { return objective_->gradient(NULL, solution, offset, refresh); } else { return NULL; } } inline const double * getObjCoefficients() const { if (objective_) { double offset; return objective_->gradient(NULL, NULL, offset, false); } else { return NULL; } } /// Row Objective inline double * rowObjective() const { return rowObjective_; } inline const double * getRowObjCoefficients() const { return rowObjective_; } /// Column Lower inline double * columnLower() const { return columnLower_; } inline const double * getColLower() const { return columnLower_; } /// Column Upper inline double * columnUpper() const { return columnUpper_; } inline const double * getColUpper() const { return columnUpper_; } /// Matrix (if not ClpPackedmatrix be careful about memory leak inline CoinPackedMatrix * matrix() const { if ( matrix_ == NULL ) return NULL; else return matrix_->getPackedMatrix(); } /// Number of elements in matrix inline int getNumElements() const { return matrix_->getNumElements(); } /** Small element value - elements less than this set to zero, default is 1.0e-20 */ inline double getSmallElementValue() const { return smallElement_; } inline void setSmallElementValue(double value) { smallElement_ = value; } /// Row Matrix inline ClpMatrixBase * rowCopy() const { return rowCopy_; } /// Set new row matrix void setNewRowCopy(ClpMatrixBase * newCopy); /// Clp Matrix inline ClpMatrixBase * clpMatrix() const { return matrix_; } /// Scaled ClpPackedMatrix inline ClpPackedMatrix * clpScaledMatrix() const { return scaledMatrix_; } /// Sets pointer to scaled ClpPackedMatrix inline void setClpScaledMatrix(ClpPackedMatrix * scaledMatrix) { delete scaledMatrix_; scaledMatrix_ = scaledMatrix; } /// Swaps pointer to scaled ClpPackedMatrix inline ClpPackedMatrix * swapScaledMatrix(ClpPackedMatrix * scaledMatrix) { ClpPackedMatrix * oldMatrix = scaledMatrix_; scaledMatrix_ = scaledMatrix; return oldMatrix; } /** Replace Clp Matrix (current is not deleted unless told to and new is used) So up to user to delete current. This was used where matrices were being rotated. ClpModel takes ownership. */ void replaceMatrix(ClpMatrixBase * matrix, bool deleteCurrent = false); /** Replace Clp Matrix (current is not deleted unless told to and new is used) So up to user to delete current. This was used where matrices were being rotated. This version changes CoinPackedMatrix to ClpPackedMatrix. ClpModel takes ownership. */ inline void replaceMatrix(CoinPackedMatrix * newmatrix, bool deleteCurrent = false) { replaceMatrix(new ClpPackedMatrix(newmatrix), deleteCurrent); } /// Objective value inline double objectiveValue() const { return objectiveValue_ * optimizationDirection_ - dblParam_[ClpObjOffset]; } inline void setObjectiveValue(double value) { objectiveValue_ = (value + dblParam_[ClpObjOffset]) / optimizationDirection_; } inline double getObjValue() const { return objectiveValue_ * optimizationDirection_ - dblParam_[ClpObjOffset]; } /// Integer information inline char * integerInformation() const { return integerType_; } /** Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use delete [] on these arrays. */ double * infeasibilityRay(bool fullRay=false) const; double * unboundedRay() const; /// For advanced users - no need to delete - sign not changed inline double * ray() const { return ray_;} /// just test if infeasibility or unbounded Ray exists inline bool rayExists() const { return (ray_!=NULL); } /// just delete ray if exists inline void deleteRay() { delete [] ray_; ray_=NULL; } /// Access internal ray storage. Users should call infeasibilityRay() or unboundedRay() instead. inline const double * internalRay() const { return ray_; } /// See if status (i.e. basis) array exists (partly for OsiClp) inline bool statusExists() const { return (status_ != NULL); } /// Return address of status (i.e. basis) array (char[numberRows+numberColumns]) inline unsigned char * statusArray() const { return status_; } /** Return copy of status (i.e. basis) array (char[numberRows+numberColumns]), use delete [] */ unsigned char * statusCopy() const; /// Copy in status (basis) vector void copyinStatus(const unsigned char * statusArray); /// User pointer for whatever reason inline void setUserPointer (void * pointer) { userPointer_ = pointer; } inline void * getUserPointer () const { return userPointer_; } /// Trusted user pointer inline void setTrustedUserPointer (ClpTrustedData * pointer) { trustedUserPointer_ = pointer; } inline ClpTrustedData * getTrustedUserPointer () const { return trustedUserPointer_; } /// What has changed in model (only for masochistic users) inline int whatsChanged() const { return whatsChanged_; } inline void setWhatsChanged(int value) { whatsChanged_ = value; } /// Number of threads (not really being used) inline int numberThreads() const { return numberThreads_; } inline void setNumberThreads(int value) { numberThreads_ = value; } //@} /**@name Message handling */ //@{ /// Pass in Message handler (not deleted at end) void passInMessageHandler(CoinMessageHandler * handler); /// Pass in Message handler (not deleted at end) and return current CoinMessageHandler * pushMessageHandler(CoinMessageHandler * handler, bool & oldDefault); /// back to previous message handler void popMessageHandler(CoinMessageHandler * oldHandler, bool oldDefault); /// Set language void newLanguage(CoinMessages::Language language); inline void setLanguage(CoinMessages::Language language) { newLanguage(language); } /// Overrides message handler with a default one void setDefaultMessageHandler(); /// Return handler inline CoinMessageHandler * messageHandler() const { return handler_; } /// Return messages inline CoinMessages messages() const { return messages_; } /// Return pointer to messages inline CoinMessages * messagesPointer() { return & messages_; } /// Return Coin messages inline CoinMessages coinMessages() const { return coinMessages_; } /// Return pointer to Coin messages inline CoinMessages * coinMessagesPointer() { return & coinMessages_; } /** Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - verbose above that 8,16,32 etc just for selective debug */ inline void setLogLevel(int value) { handler_->setLogLevel(value); } inline int logLevel() const { return handler_->logLevel(); } /// Return true if default handler inline bool defaultHandler() const { return defaultHandler_; } /// Pass in Event handler (cloned and deleted at end) void passInEventHandler(const ClpEventHandler * eventHandler); /// Event handler inline ClpEventHandler * eventHandler() const { return eventHandler_; } /// Thread specific random number generator inline CoinThreadRandom * randomNumberGenerator() { return &randomNumberGenerator_; } /// Thread specific random number generator inline CoinThreadRandom & mutableRandomNumberGenerator() { return randomNumberGenerator_; } /// Set seed for thread specific random number generator inline void setRandomSeed(int value) { randomNumberGenerator_.setSeed(value); } /// length of names (0 means no names0 inline int lengthNames() const { return lengthNames_; } #ifndef CLP_NO_STD /// length of names (0 means no names0 inline void setLengthNames(int value) { lengthNames_ = value; } /// Row names inline const std::vector * rowNames() const { return &rowNames_; } inline const std::string& rowName(int iRow) const { return rowNames_[iRow]; } /// Return name or Rnnnnnnn std::string getRowName(int iRow) const; /// Column names inline const std::vector * columnNames() const { return &columnNames_; } inline const std::string& columnName(int iColumn) const { return columnNames_[iColumn]; } /// Return name or Cnnnnnnn std::string getColumnName(int iColumn) const; #endif /// Objective methods inline ClpObjective * objectiveAsObject() const { return objective_; } void setObjective(ClpObjective * objective); inline void setObjectivePointer(ClpObjective * newobjective) { objective_ = newobjective; } /** Solve a problem with no elements - return status and dual and primal infeasibilites */ int emptyProblem(int * infeasNumber = NULL, double * infeasSum = NULL, bool printMessage = true); //@} /**@name Matrix times vector methods They can be faster if scalar is +- 1 These are covers so user need not worry about scaling Also for simplex I am not using basic/non-basic split */ //@{ /** Return y + A * x * scalar in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ void times(double scalar, const double * x, double * y) const; /** Return y + x * scalar * A in y. @pre x must be of size numRows() @pre y must be of size numColumns() */ void transposeTimes(double scalar, const double * x, double * y) const ; //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. ** once it has been decided where solver sits this may be redone */ //@{ /// Set an integer parameter bool setIntParam(ClpIntParam key, int value) ; /// Set an double parameter bool setDblParam(ClpDblParam key, double value) ; #ifndef CLP_NO_STD /// Set an string parameter bool setStrParam(ClpStrParam key, const std::string & value); #endif // Get an integer parameter inline bool getIntParam(ClpIntParam key, int& value) const { if (key < ClpLastIntParam) { value = intParam_[key]; return true; } else { return false; } } // Get an double parameter inline bool getDblParam(ClpDblParam key, double& value) const { if (key < ClpLastDblParam) { value = dblParam_[key]; return true; } else { return false; } } #ifndef CLP_NO_STD // Get a string parameter inline bool getStrParam(ClpStrParam key, std::string& value) const { if (key < ClpLastStrParam) { value = strParam_[key]; return true; } else { return false; } } #endif /// Create C++ lines to get to current state void generateCpp( FILE * fp); /** For advanced options 1 - Don't keep changing infeasibility weight 2 - Keep nonLinearCost round solves 4 - Force outgoing variables to exact bound (primal) 8 - Safe to use dense initial factorization 16 -Just use basic variables for operation if column generation 32 -Create ray even in BAB 64 -Treat problem as feasible until last minute (i.e. minimize infeasibilities) 128 - Switch off all matrix sanity checks 256 - No row copy 512 - If not in values pass, solution guaranteed, skip as much as possible 1024 - In branch and bound 2048 - Don't bother to re-factorize if < 20 iterations 4096 - Skip some optimality checks 8192 - Do Primal when cleaning up primal 16384 - In fast dual (so we can switch off things) 32768 - called from Osi 65536 - keep arrays around as much as possible (also use maximumR/C) 131072 - transposeTimes is -1.0 and can skip basic and fixed 262144 - extra copy of scaled matrix 524288 - Clp fast dual 1048576 - don't need to finish dual (can return 3) 2097152 - zero costs! 4194304 - don't scale integer variables 8388608 - Idiot when not really sure about it NOTE - many applications can call Clp but there may be some short cuts which are taken which are not guaranteed safe from all applications. Vetted applications will have a bit set and the code may test this At present I expect a few such applications - if too many I will have to re-think. It is up to application owner to change the code if she/he needs these short cuts. I will not debug unless in Coin repository. See COIN_CLP_VETTED comments. 0x01000000 is Cbc (and in branch and bound) 0x02000000 is in a different branch and bound */ inline unsigned int specialOptions() const { return specialOptions_; } void setSpecialOptions(unsigned int value); #define COIN_CBC_USING_CLP 0x01000000 inline bool inCbcBranchAndBound() const { return (specialOptions_ & COIN_CBC_USING_CLP) != 0; } //@} /**@name private or protected methods */ //@{ protected: /// Does most of deletion (0 = all, 1 = most) void gutsOfDelete(int type); /** Does most of copying If trueCopy 0 then just points to arrays If -1 leaves as much as possible */ void gutsOfCopy(const ClpModel & rhs, int trueCopy = 1); /// gets lower and upper bounds on rows void getRowBound(int iRow, double& lower, double& upper) const; /// puts in format I like - 4 array matrix - may make row copy void gutsOfLoadModel ( int numberRows, int numberColumns, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /// Does much of scaling void gutsOfScaling(); /// Objective value - always minimize inline double rawObjectiveValue() const { return objectiveValue_; } /// If we are using maximumRows_ and Columns_ inline bool permanentArrays() const { return (specialOptions_ & 65536) != 0; } /// Start using maximumRows_ and Columns_ void startPermanentArrays(); /// Stop using maximumRows_ and Columns_ void stopPermanentArrays(); /// Create row names as char ** const char * const * rowNamesAsChar() const; /// Create column names as char ** const char * const * columnNamesAsChar() const; /// Delete char * version of names void deleteNamesAsChar(const char * const * names, int number) const; /// On stopped - sets secondary status void onStopped(); //@} ////////////////// data ////////////////// protected: /**@name data */ //@{ /// Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore double optimizationDirection_; /// Array of double parameters double dblParam_[ClpLastDblParam]; /// Objective value double objectiveValue_; /// Small element value double smallElement_; /// Scaling of objective double objectiveScale_; /// Scaling of rhs and bounds double rhsScale_; /// Number of rows int numberRows_; /// Number of columns int numberColumns_; /// Row activities double * rowActivity_; /// Column activities double * columnActivity_; /// Duals double * dual_; /// Reduced costs double * reducedCost_; /// Row lower double* rowLower_; /// Row upper double* rowUpper_; /// Objective ClpObjective * objective_; /// Row Objective (? sign) - may be NULL double * rowObjective_; /// Column Lower double * columnLower_; /// Column Upper double * columnUpper_; /// Packed matrix ClpMatrixBase * matrix_; /// Row copy if wanted ClpMatrixBase * rowCopy_; /// Scaled packed matrix ClpPackedMatrix * scaledMatrix_; /// Infeasible/unbounded ray double * ray_; /// Row scale factors for matrix double * rowScale_; /// Column scale factors double * columnScale_; /// Inverse row scale factors for matrix (end of rowScale_) double * inverseRowScale_; /// Inverse column scale factors for matrix (end of columnScale_) double * inverseColumnScale_; /** Scale flag, 0 none, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic, 5 geometric on rows */ int scalingFlag_; /** Status (i.e. basis) Region. I know that not all algorithms need a status array, but it made sense for things like crossover and put all permanent stuff in one place. No assumption is made about what is in status array (although it might be good to reserve bottom 3 bits (i.e. 0-7 numeric) for classic status). This is number of columns + number of rows long (in that order). */ unsigned char * status_; /// Integer information char * integerType_; /// User pointer for whatever reason void * userPointer_; /// Trusted user pointer e.g. for heuristics ClpTrustedData * trustedUserPointer_; /// Array of integer parameters int intParam_[ClpLastIntParam]; /// Number of iterations int numberIterations_; /** Solve type - 1 simplex, 2 simplex interface, 3 Interior.*/ int solveType_; /** Whats changed since last solve. This is a work in progress It is designed so careful people can make go faster. It is only used when startFinishOptions used in dual or primal. Bit 1 - number of rows/columns has not changed (so work arrays valid) 2 - matrix has not changed 4 - if matrix has changed only by adding rows 8 - if matrix has changed only by adding columns 16 - row lbs not changed 32 - row ubs not changed 64 - column objective not changed 128 - column lbs not changed 256 - column ubs not changed 512 - basis not changed (up to user to set this to 0) top bits may be used internally shift by 65336 is 3 all same, 1 all except col bounds */ #define ROW_COLUMN_COUNTS_SAME 1 #define MATRIX_SAME 2 #define MATRIX_JUST_ROWS_ADDED 4 #define MATRIX_JUST_COLUMNS_ADDED 8 #define ROW_LOWER_SAME 16 #define ROW_UPPER_SAME 32 #define OBJECTIVE_SAME 64 #define COLUMN_LOWER_SAME 128 #define COLUMN_UPPER_SAME 256 #define BASIS_SAME 512 #define ALL_SAME 65339 #define ALL_SAME_EXCEPT_COLUMN_BOUNDS 65337 unsigned int whatsChanged_; /// Status of problem int problemStatus_; /// Secondary status of problem int secondaryStatus_; /// length of names (0 means no names) int lengthNames_; /// Number of threads (not very operational) int numberThreads_; /** For advanced options See get and set for meaning */ unsigned int specialOptions_; /// Message handler CoinMessageHandler * handler_; /// Flag to say if default handler (so delete) bool defaultHandler_; /// Thread specific random number generator CoinThreadRandom randomNumberGenerator_; /// Event handler ClpEventHandler * eventHandler_; #ifndef CLP_NO_STD /// Row names std::vector rowNames_; /// Column names std::vector columnNames_; #endif /// Messages CoinMessages messages_; /// Coin messages CoinMessages coinMessages_; /// Maximum number of columns in model int maximumColumns_; /// Maximum number of rows in model int maximumRows_; /// Maximum number of columns (internal arrays) in model int maximumInternalColumns_; /// Maximum number of rows (internal arrays) in model int maximumInternalRows_; /// Base packed matrix CoinPackedMatrix baseMatrix_; /// Base row copy CoinPackedMatrix baseRowCopy_; /// Saved row scale factors for matrix double * savedRowScale_; /// Saved column scale factors double * savedColumnScale_; #ifndef CLP_NO_STD /// Array of string parameters std::string strParam_[ClpLastStrParam]; #endif //@} }; /** This is a tiny class where data can be saved round calls. */ class ClpDataSave { public: /**@name Constructors and destructor */ //@{ /// Default constructor ClpDataSave ( ); /// Copy constructor. ClpDataSave(const ClpDataSave &); /// Assignment operator. This copies the data ClpDataSave & operator=(const ClpDataSave & rhs); /// Destructor ~ClpDataSave ( ); //@} ////////////////// data ////////////////// public: /**@name data - with same names as in other classes*/ //@{ double dualBound_; double infeasibilityCost_; double pivotTolerance_; double zeroFactorizationTolerance_; double zeroSimplexTolerance_; double acceptablePivot_; double objectiveScale_; int sparseThreshold_; int perturbation_; int forceFactorization_; int scalingFlag_; unsigned int specialOptions_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpPresolve.cpp0000644000175000017500000025371112503570213015572 0ustar renerene/* $Id: ClpPresolve.cpp 2134 2015-03-22 16:40:43Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //#define PRESOLVE_CONSISTENCY 1 //#define PRESOLVE_DEBUG 1 #include #include #include #include "CoinHelperFunctions.hpp" #include "ClpConfig.h" #ifdef CLP_HAS_ABC #include "CoinAbcCommon.hpp" #endif #include "CoinPackedMatrix.hpp" #include "ClpPackedMatrix.hpp" #include "ClpSimplex.hpp" #include "ClpSimplexOther.hpp" #ifndef SLIM_CLP #include "ClpQuadraticObjective.hpp" #endif #include "ClpPresolve.hpp" #include "CoinPresolveMatrix.hpp" #include "CoinPresolveEmpty.hpp" #include "CoinPresolveFixed.hpp" #include "CoinPresolvePsdebug.hpp" #include "CoinPresolveSingleton.hpp" #include "CoinPresolveDoubleton.hpp" #include "CoinPresolveTripleton.hpp" #include "CoinPresolveZeros.hpp" #include "CoinPresolveSubst.hpp" #include "CoinPresolveForcing.hpp" #include "CoinPresolveDual.hpp" #include "CoinPresolveTighten.hpp" #include "CoinPresolveUseless.hpp" #include "CoinPresolveDupcol.hpp" #include "CoinPresolveImpliedFree.hpp" #include "CoinPresolveIsolated.hpp" #include "CoinMessage.hpp" ClpPresolve::ClpPresolve() : originalModel_(NULL), presolvedModel_(NULL), nonLinearValue_(0.0), originalColumn_(NULL), originalRow_(NULL), rowObjective_(NULL), paction_(0), ncols_(0), nrows_(0), nelems_(0), #ifdef CLP_INHERIT_MODE numberPasses_(20), #else numberPasses_(5), #endif substitution_(3), #ifndef CLP_NO_STD saveFile_(""), #endif presolveActions_(0) { } ClpPresolve::~ClpPresolve() { destroyPresolve(); } // Gets rid of presolve actions (e.g.when infeasible) void ClpPresolve::destroyPresolve() { const CoinPresolveAction *paction = paction_; while (paction) { const CoinPresolveAction *next = paction->next; delete paction; paction = next; } delete [] originalColumn_; delete [] originalRow_; paction_ = NULL; originalColumn_ = NULL; originalRow_ = NULL; delete [] rowObjective_; rowObjective_ = NULL; } /* This version of presolve returns a pointer to a new presolved model. NULL if infeasible */ ClpSimplex * ClpPresolve::presolvedModel(ClpSimplex & si, double feasibilityTolerance, bool keepIntegers, int numberPasses, bool dropNames, bool doRowObjective, const char * prohibitedRows, const char * prohibitedColumns) { // Check matrix int checkType = ((si.specialOptions() & 128) != 0) ? 14 : 15; if (!si.clpMatrix()->allElementsInRange(&si, si.getSmallElementValue(), 1.0e20,checkType)) return NULL; else return gutsOfPresolvedModel(&si, feasibilityTolerance, keepIntegers, numberPasses, dropNames, doRowObjective, prohibitedRows, prohibitedColumns); } #ifndef CLP_NO_STD /* This version of presolve updates model and saves original data to file. Returns non-zero if infeasible */ int ClpPresolve::presolvedModelToFile(ClpSimplex &si, std::string fileName, double feasibilityTolerance, bool keepIntegers, int numberPasses, bool dropNames, bool doRowObjective) { // Check matrix if (!si.clpMatrix()->allElementsInRange(&si, si.getSmallElementValue(), 1.0e20)) return 2; saveFile_ = fileName; si.saveModel(saveFile_.c_str()); ClpSimplex * model = gutsOfPresolvedModel(&si, feasibilityTolerance, keepIntegers, numberPasses, dropNames, doRowObjective); if (model == &si) { return 0; } else { si.restoreModel(saveFile_.c_str()); remove(saveFile_.c_str()); return 1; } } #endif // Return pointer to presolved model ClpSimplex * ClpPresolve::model() const { return presolvedModel_; } // Return pointer to original model ClpSimplex * ClpPresolve::originalModel() const { return originalModel_; } // Return presolve status (0,1,2) int ClpPresolve::presolveStatus() const { if (nelems_>=0) { // feasible (or not done yet) return 0; } else { int presolveStatus = - nelems_; // If both infeasible and unbounded - say infeasible if (presolveStatus>2) presolveStatus = 1; return presolveStatus; } } void ClpPresolve::postsolve(bool updateStatus) { // Return at once if no presolved model if (!presolvedModel_) return; // Messages CoinMessages messages = originalModel_->coinMessages(); if (!presolvedModel_->isProvenOptimal()) { presolvedModel_->messageHandler()->message(COIN_PRESOLVE_NONOPTIMAL, messages) << CoinMessageEol; } // this is the size of the original problem const int ncols0 = ncols_; const int nrows0 = nrows_; const CoinBigIndex nelems0 = nelems_; // this is the reduced problem int ncols = presolvedModel_->getNumCols(); int nrows = presolvedModel_->getNumRows(); double * acts = NULL; double * sol = NULL; unsigned char * rowstat = NULL; unsigned char * colstat = NULL; #ifndef CLP_NO_STD if (saveFile_ == "") { #endif // reality check assert(ncols0 == originalModel_->getNumCols()); assert(nrows0 == originalModel_->getNumRows()); acts = originalModel_->primalRowSolution(); sol = originalModel_->primalColumnSolution(); if (updateStatus) { // postsolve does not know about fixed int i; for (i = 0; i < nrows + ncols; i++) { if (presolvedModel_->getColumnStatus(i) == ClpSimplex::isFixed) presolvedModel_->setColumnStatus(i, ClpSimplex::atLowerBound); } unsigned char *status = originalModel_->statusArray(); if (!status) { originalModel_->createStatus(); status = originalModel_->statusArray(); } rowstat = status + ncols0; colstat = status; CoinMemcpyN( presolvedModel_->statusArray(), ncols, colstat); CoinMemcpyN( presolvedModel_->statusArray() + ncols, nrows, rowstat); } #ifndef CLP_NO_STD } else { // from file acts = new double[nrows0]; sol = new double[ncols0]; CoinZeroN(acts, nrows0); CoinZeroN(sol, ncols0); if (updateStatus) { unsigned char *status = new unsigned char [nrows0+ncols0]; rowstat = status + ncols0; colstat = status; CoinMemcpyN( presolvedModel_->statusArray(), ncols, colstat); CoinMemcpyN( presolvedModel_->statusArray() + ncols, nrows, rowstat); } } #endif // CoinPostsolveMatrix object assumes ownership of sol, acts, colstat; // will be deleted by ~CoinPostsolveMatrix. delete[] operations below // cause duplicate free. In case where saveFile == "", as best I can see // arrays are owned by originalModel_. fix is to // clear fields in prob to avoid delete[] in ~CoinPostsolveMatrix. CoinPostsolveMatrix prob(presolvedModel_, ncols0, nrows0, nelems0, presolvedModel_->getObjSense(), // end prepost sol, acts, colstat, rowstat); postsolve(prob); #ifndef CLP_NO_STD if (saveFile_ != "") { // From file assert (originalModel_ == presolvedModel_); originalModel_->restoreModel(saveFile_.c_str()); remove(saveFile_.c_str()); CoinMemcpyN(acts, nrows0, originalModel_->primalRowSolution()); // delete [] acts; CoinMemcpyN(sol, ncols0, originalModel_->primalColumnSolution()); // delete [] sol; if (updateStatus) { CoinMemcpyN(colstat, nrows0 + ncols0, originalModel_->statusArray()); // delete [] colstat; } } else { #endif prob.sol_ = 0 ; prob.acts_ = 0 ; prob.colstat_ = 0 ; #ifndef CLP_NO_STD } #endif // put back duals CoinMemcpyN(prob.rowduals_, nrows_, originalModel_->dualRowSolution()); double maxmin = originalModel_->getObjSense(); if (maxmin < 0.0) { // swap signs int i; double * pi = originalModel_->dualRowSolution(); for (i = 0; i < nrows_; i++) pi[i] = -pi[i]; } // Now check solution double offset; CoinMemcpyN(originalModel_->objectiveAsObject()->gradient(originalModel_, originalModel_->primalColumnSolution(), offset, true), ncols_, originalModel_->dualColumnSolution()); originalModel_->clpMatrix()->transposeTimes(-1.0, originalModel_->dualRowSolution(), originalModel_->dualColumnSolution()); memset(originalModel_->primalRowSolution(), 0, nrows_ * sizeof(double)); originalModel_->clpMatrix()->times(1.0, originalModel_->primalColumnSolution(), originalModel_->primalRowSolution()); originalModel_->checkSolutionInternal(); if (originalModel_->sumDualInfeasibilities() > 1.0e-1) { // See if we can fix easily static_cast (originalModel_)->cleanupAfterPostsolve(); } // Messages presolvedModel_->messageHandler()->message(COIN_PRESOLVE_POSTSOLVE, messages) << originalModel_->objectiveValue() << originalModel_->sumDualInfeasibilities() << originalModel_->numberDualInfeasibilities() << originalModel_->sumPrimalInfeasibilities() << originalModel_->numberPrimalInfeasibilities() << CoinMessageEol; //originalModel_->objectiveValue_=objectiveValue_; originalModel_->setNumberIterations(presolvedModel_->numberIterations()); if (!presolvedModel_->status()) { if (!originalModel_->numberDualInfeasibilities() && !originalModel_->numberPrimalInfeasibilities()) { originalModel_->setProblemStatus( 0); } else { originalModel_->setProblemStatus( -1); // Say not optimal after presolve originalModel_->setSecondaryStatus(7); presolvedModel_->messageHandler()->message(COIN_PRESOLVE_NEEDS_CLEANING, messages) << CoinMessageEol; } } else { originalModel_->setProblemStatus( presolvedModel_->status()); // but not if close to feasible if( originalModel_->sumPrimalInfeasibilities()<1.0e-1) { originalModel_->setProblemStatus( -1); // Say not optimal after presolve originalModel_->setSecondaryStatus(7); } } #ifndef CLP_NO_STD if (saveFile_ != "") presolvedModel_ = NULL; #endif } // return pointer to original columns const int * ClpPresolve::originalColumns() const { return originalColumn_; } // return pointer to original rows const int * ClpPresolve::originalRows() const { return originalRow_; } // Set pointer to original model void ClpPresolve::setOriginalModel(ClpSimplex * model) { originalModel_ = model; } #if 0 // A lazy way to restrict which transformations are applied // during debugging. static int ATOI(const char *name) { return true; #if PRESOLVE_DEBUG || PRESOLVE_SUMMARY if (getenv(name)) { int val = atoi(getenv(name)); printf("%s = %d\n", name, val); return (val); } else { if (strcmp(name, "off")) return (true); else return (false); } #else return (true); #endif } #endif //#define PRESOLVE_DEBUG 1 #if PRESOLVE_DEBUG void check_sol(CoinPresolveMatrix *prob, double tol) { double *colels = prob->colels_; int *hrow = prob->hrow_; int *mcstrt = prob->mcstrt_; int *hincol = prob->hincol_; int *hinrow = prob->hinrow_; int ncols = prob->ncols_; double * csol = prob->sol_; double * acts = prob->acts_; double * clo = prob->clo_; double * cup = prob->cup_; int nrows = prob->nrows_; double * rlo = prob->rlo_; double * rup = prob->rup_; int colx; double * rsol = new double[nrows]; memset(rsol, 0, nrows * sizeof(double)); for (colx = 0; colx < ncols; ++colx) { if (1) { CoinBigIndex k = mcstrt[colx]; int nx = hincol[colx]; double solutionValue = csol[colx]; for (int i = 0; i < nx; ++i) { int row = hrow[k]; double coeff = colels[k]; k++; rsol[row] += solutionValue * coeff; } if (csol[colx] < clo[colx] - tol) { printf("low CSOL: %d - %g %g %g\n", colx, clo[colx], csol[colx], cup[colx]); } else if (csol[colx] > cup[colx] + tol) { printf("high CSOL: %d - %g %g %g\n", colx, clo[colx], csol[colx], cup[colx]); } } } int rowx; for (rowx = 0; rowx < nrows; ++rowx) { if (hinrow[rowx]) { if (fabs(rsol[rowx] - acts[rowx]) > tol) printf("inacc RSOL: %d - %g %g (acts_ %g) %g\n", rowx, rlo[rowx], rsol[rowx], acts[rowx], rup[rowx]); if (rsol[rowx] < rlo[rowx] - tol) { printf("low RSOL: %d - %g %g %g\n", rowx, rlo[rowx], rsol[rowx], rup[rowx]); } else if (rsol[rowx] > rup[rowx] + tol ) { printf("high RSOL: %d - %g %g %g\n", rowx, rlo[rowx], rsol[rowx], rup[rowx]); } } } delete [] rsol; } #endif static int tightenDoubletons2(CoinPresolveMatrix * prob) { // column-major representation const int ncols = prob->ncols_ ; const CoinBigIndex *const mcstrt = prob->mcstrt_ ; const int *const hincol = prob->hincol_ ; const int *const hrow = prob->hrow_ ; double * colels = prob->colels_ ; double * cost = prob->cost_ ; // column type, bounds, solution, and status const unsigned char *const integerType = prob->integerType_ ; double * clo = prob->clo_ ; double * cup = prob->cup_ ; // row-major representation //const int nrows = prob->nrows_ ; const CoinBigIndex *const mrstrt = prob->mrstrt_ ; const int *const hinrow = prob->hinrow_ ; const int *const hcol = prob->hcol_ ; double * rowels = prob->rowels_ ; // row bounds double *const rlo = prob->rlo_ ; double *const rup = prob->rup_ ; // tolerances //const double ekkinf2 = PRESOLVE_SMALL_INF ; //const double ekkinf = ekkinf2*1.0e8 ; //const double ztolcbarj = prob->ztoldj_ ; //const CoinRelFltEq relEq(prob->ztolzb_) ; int numberChanged=0; double bound[2]; double alpha[2]={0.0,0.0}; double offset=0.0; for (int icol=0;icol-1.0e30) { if (rup[row0]>1.0e30) { swapSigns0=true; rowUpper0=-rlo[row0]; element0=-element0; } else { // range or equality continue; } } else if (rup[row0]>1.0e30) { // free continue; } #if 0 // skip here for speed // skip if no cost (should be able to get rid of) if (!cost[icol]) { printf("should be able to get rid of %d with no cost\n",icol); continue; } // skip if negative cost for now if (cost[icol]<0.0) { printf("code for negative cost\n"); continue; } #endif double element1 = colels[start+1]; double rowUpper1=rup[row1]; bool swapSigns1=false; if (rlo[row1]>-1.0e30) { if (rup[row1]>1.0e30) { swapSigns1=true; rowUpper1=-rlo[row1]; element1=-element1; } else { // range or equality continue; } } else if (rup[row1]>1.0e30) { // free continue; } double lowerX=clo[icol]; double upperX=cup[icol]; int otherCol=-1; CoinBigIndex startRow=mrstrt[row0]; for (CoinBigIndex j=startRow;j0.0) { if (value<0.0) infLow0 =true; } else if (alpha[0]<0.0) { if (value>0.0) infLow0 =true; } if (alpha[1]>0.0) { if (value<0.0) infLow1 =true; } else if (alpha[1]<0.0) { if (value>0.0) infLow1 =true; } } /* Got sums */ double thisLowest0=-COIN_DBL_MAX; double thisHighest0=COIN_DBL_MAX; if (element0>0.0) { // upper bound unless inf&2 !=0 if (!infLow0) thisHighest0 = (rowUpper0-sum0)/element0; } else { // lower bound unless inf&2 !=0 if (!infLow0) thisLowest0 = (rowUpper0-sum0)/element0; } double thisLowest1=-COIN_DBL_MAX; double thisHighest1=COIN_DBL_MAX; if (element1>0.0) { // upper bound unless inf&2 !=0 if (!infLow1) thisHighest1 = (rowUpper1-sum1)/element1; } else { // lower bound unless inf&2 !=0 if (!infLow1) thisLowest1 = (rowUpper1-sum1)/element1; } if (thisLowest0>thisLowest1+1.0e-12) { if (thisLowest0>lowerX+1.0e-12) binding0|= 1<thisLowest0+1.0e-12) { if (thisLowest1>lowerX+1.0e-12) binding1|= 1<=0.0) { if (highestLowest=lowerX&&highestHighest<1.0e30) { highestHighest=CoinMin(highestHighest,highestLowest); } } if (cost[icol]<=0.0) { if (lowestHighest>lowerX&&lowestHighest<=upperX&&lowestHighest>-1.0e30) { lowestLowest=CoinMax(lowestLowest,lowestHighest); } } #if 1 if (lowestLowest>lowerX+1.0e-8) { #ifdef PRINT_VALUES printf("Can increase lower bound on %d from %g to %g\n", icol,lowerX,lowestLowest); #endif lowerX=lowestLowest; } if (highestHighest %g slope %g for constraint 1 ranges %g -> %g slope %g\n", costEqual,ranges0[0],ranges0[1],slope[0],ranges1[0],ranges1[1],slope[1]); #endif xValue=bound[0]; yValue0=(rowUpper0-xValue*alpha[0])/element0; yValue1=(rowUpper1-xValue*alpha[1])/element1; #ifdef PRINT_VALUES printf("value of %d is %g, value of %d is max(%g,%g) - %g\n", otherCol,xValue,icol,yValue0,yValue1,CoinMax(yValue0,yValue1)); #endif newLower=CoinMin(newLower,CoinMax(yValue0,yValue1)); // cost>0 so will be at lower //double yValueAtBound0=newLower; newUpper=CoinMax(newUpper,CoinMax(yValue0,yValue1)); xValue=bound[1]; yValue0=(rowUpper0-xValue*alpha[0])/element0; yValue1=(rowUpper1-xValue*alpha[1])/element1; #ifdef PRINT_VALUES printf("value of %d is %g, value of %d is max(%g,%g) - %g\n", otherCol,xValue,icol,yValue0,yValue1,CoinMax(yValue0,yValue1)); #endif newLower=CoinMin(newLower,CoinMax(yValue0,yValue1)); // cost>0 so will be at lower //double yValueAtBound1=newLower; newUpper=CoinMax(newUpper,CoinMax(yValue0,yValue1)); lowerX=CoinMax(lowerX,newLower-1.0e-12*fabs(newLower)); upperX=CoinMin(upperX,newUpper+1.0e-12*fabs(newUpper)); // Now make duplicate row // keep row 0 so need to adjust costs so same #ifdef PRINT_VALUES printf("Costs for x %g,%g,%g are %g,%g,%g\n", xValueEqual-1.0,xValueEqual,xValueEqual+1.0, costEqual-slope[0],costEqual,costEqual+slope[1]); #endif double costOther=cost[otherCol]+slope[1]; double costThis=cost[icol]+slope[1]*(element0/alpha[0]); xValue=xValueEqual; yValue0=CoinMax((rowUpper0-xValue*alpha[0])/element0,lowerX); double thisOffset=costEqual-(costOther*xValue+costThis*yValue0); offset += thisOffset; #ifdef PRINT_VALUES printf("new cost at equal %g\n",costOther*xValue+costThis*yValue0+thisOffset); #endif xValue=xValueEqual-1.0; yValue0=CoinMax((rowUpper0-xValue*alpha[0])/element0,lowerX); #ifdef PRINT_VALUES printf("new cost at -1 %g\n",costOther*xValue+costThis*yValue0+thisOffset); #endif assert(fabs((costOther*xValue+costThis*yValue0+thisOffset)-(costEqual-slope[0]))<1.0e-5); xValue=xValueEqual+1.0; yValue0=CoinMax((rowUpper0-xValue*alpha[0])/element0,lowerX); #ifdef PRINT_VALUES printf("new cost at +1 %g\n",costOther*xValue+costThis*yValue0+thisOffset); #endif assert(fabs((costOther*xValue+costThis*yValue0+thisOffset)-(costEqual+slope[1]))<1.0e-5); numberChanged++; // continue; cost[otherCol] = costOther; cost[icol] = costThis; clo[icol]=lowerX; cup[icol]=upperX; int startCol[2]; int endCol[2]; startCol[0]=mcstrt[icol]; endCol[0]=startCol[0]+2; startCol[1]=mcstrt[otherCol]; endCol[1]=startCol[1]+hincol[otherCol]; double values[2]={0.0,0.0}; for (int k=0;k<2;k++) { for (CoinBigIndex i=startCol[k];i0 if (offset) printf("Cost offset %g\n",offset); #endif return numberChanged; } //#define COIN_PRESOLVE_BUG #ifdef COIN_PRESOLVE_BUG static int counter=1000000; static int startEmptyRows=0; static int startEmptyColumns=0; static bool break2(CoinPresolveMatrix *prob) { int droppedRows = prob->countEmptyRows() - startEmptyRows ; int droppedColumns = prob->countEmptyCols() - startEmptyColumns; startEmptyRows=prob->countEmptyRows(); startEmptyColumns=prob->countEmptyCols(); printf("Dropped %d rows and %d columns - current empty %d, %d\n",droppedRows, droppedColumns,startEmptyRows,startEmptyColumns); counter--; if (!counter) { printf("skipping next and all\n"); } return (counter<=0); } #define possibleBreak if (break2(prob)) break #define possibleSkip if (!break2(prob)) #else #define possibleBreak #define possibleSkip #endif #define SOME_PRESOLVE_DETAIL #ifndef SOME_PRESOLVE_DETAIL #define printProgress(x,y) {} #else #define printProgress(x,y) {if ((presolveActions_ & 0x80000000) != 0) \ printf("%c loop %d %d empty rows, %d empty columns\n",x,y,prob->countEmptyRows(), \ prob->countEmptyCols());} #endif // This is the presolve loop. // It is a separate virtual function so that it can be easily // customized by subclassing CoinPresolve. const CoinPresolveAction *ClpPresolve::presolve(CoinPresolveMatrix *prob) { // Messages CoinMessages messages = CoinMessage(prob->messages().language()); paction_ = 0; prob->maxSubstLevel_ = CoinMax(3,prob->maxSubstLevel_) ; #ifndef PRESOLVE_DETAIL if (prob->tuning_) { #endif int numberEmptyRows=0; for ( int i=0;inrows_;i++) { if (!prob->hinrow_[i]) { PRESOLVE_DETAIL_PRINT(printf("pre_empty row %d\n",i)); //printf("pre_empty row %d\n",i); numberEmptyRows++; } } int numberEmptyCols=0; for ( int i=0;incols_;i++) { if (!prob->hincol_[i]) { PRESOLVE_DETAIL_PRINT(printf("pre_empty col %d\n",i)); //printf("pre_empty col %d\n",i); numberEmptyCols++; } } printf("CoinPresolve initial state %d empty rows and %d empty columns\n", numberEmptyRows,numberEmptyCols); #ifndef PRESOLVE_DETAIL } #endif prob->status_ = 0; // say feasible printProgress('A',0); paction_ = make_fixed(prob, paction_); paction_ = testRedundant(prob,paction_) ; printProgress('B',0); // if integers then switch off dual stuff // later just do individually bool doDualStuff = (presolvedModel_->integerInformation() == NULL); // but allow in some cases if ((presolveActions_ & 512) != 0) doDualStuff = true; if (prob->anyProhibited()) doDualStuff = false; if (!doDual()) doDualStuff = false; #if PRESOLVE_CONSISTENCY // presolve_links_ok(prob->rlink_, prob->mrstrt_, prob->hinrow_, prob->nrows_); presolve_links_ok(prob, false, true) ; #endif if (!prob->status_) { bool slackSingleton = doSingletonColumn(); slackSingleton = true; const bool slackd = doSingleton(); const bool doubleton = doDoubleton(); const bool tripleton = doTripleton(); //#define NO_FORCING #ifndef NO_FORCING const bool forcing = doForcing(); #endif const bool ifree = doImpliedFree(); const bool zerocost = doTighten(); const bool dupcol = doDupcol(); const bool duprow = doDuprow(); const bool dual = doDualStuff; // Whether we want to allow duplicate intersections if (doIntersection()) prob->presolveOptions_ |= 0x10; // zero small elements in aggregation prob->presolveOptions_ |= zeroSmall()*0x20000; // some things are expensive so just do once (normally) int i; // say look at all if (!prob->anyProhibited()) { for (i = 0; i < nrows_; i++) prob->rowsToDo_[i] = i; prob->numberRowsToDo_ = nrows_; for (i = 0; i < ncols_; i++) prob->colsToDo_[i] = i; prob->numberColsToDo_ = ncols_; } else { // some stuff must be left alone prob->numberRowsToDo_ = 0; for (i = 0; i < nrows_; i++) if (!prob->rowProhibited(i)) prob->rowsToDo_[prob->numberRowsToDo_++] = i; prob->numberColsToDo_ = 0; for (i = 0; i < ncols_; i++) if (!prob->colProhibited(i)) prob->colsToDo_[prob->numberColsToDo_++] = i; } // transfer costs (may want to do it in OsiPresolve) // need a transfer back at end of postsolve transferCosts(prob); int iLoop; #if PRESOLVE_DEBUG check_sol(prob, 1.0e0); #endif if (dupcol) { // maybe allow integer columns to be checked if ((presolveActions_ & 512) != 0) prob->setPresolveOptions(prob->presolveOptions() | 1); possibleSkip; paction_ = dupcol_action::presolve(prob, paction_); printProgress('C',0); } if (doTwoxTwo()) { possibleSkip; paction_ = twoxtwo_action::presolve(prob, paction_); } if (duprow) { possibleSkip; if (doTwoxTwo()) { int nTightened=tightenDoubletons2(prob); if (nTightened) PRESOLVE_DETAIL_PRINT(printf("%d doubletons tightened\n", nTightened)); } paction_ = duprow_action::presolve(prob, paction_); printProgress('D',0); //paction_ = doubleton_action::presolve(prob, paction_); //printProgress('d',0); //if (doDependency()) { //paction_ = duprow3_action::presolve(prob, paction_); //printProgress('Z',0); //} } if (doGubrow()) { possibleSkip; paction_ = gubrow_action::presolve(prob, paction_); printProgress('E',0); } if (ifree) { int fill_level=10; const CoinPresolveAction * lastAction = NULL; int iPass=4; while(lastAction!=paction_&&iPass) { lastAction=paction_; paction_ = implied_free_action::presolve(prob, paction_, fill_level); printProgress('l',0); iPass--; } } if ((presolveActions_ & 16384) != 0) prob->setPresolveOptions(prob->presolveOptions() | 16384); // For inaccurate data in implied free if ((presolveActions_ & 1024) != 0) prob->setPresolveOptions(prob->presolveOptions() | 0x20000); // Check number rows dropped int lastDropped = 0; prob->pass_ = 0; #if CLP_INHERIT_MODE>1 int numberRowsStart=nrows_-prob->countEmptyRows(); int numberColumnsStart=ncols_-prob->countEmptyCols(); int numberRowsLeft=numberRowsStart; int numberColumnsLeft=numberColumnsStart; bool lastPassWasGood=true; #if ABC_NORMAL_DEBUG printf("Original rows,columns %d,%d starting first pass with %d,%d\n", nrows_,ncols_,numberRowsLeft,numberColumnsLeft); #endif #endif if (numberPasses_<=5) prob->presolveOptions_ |= 0x10000; // say more lightweight for (iLoop = 0; iLoop < numberPasses_; iLoop++) { // See if we want statistics if ((presolveActions_ & 0x80000000) != 0) printf("Starting major pass %d after %g seconds with %d rows, %d columns\n", iLoop + 1, CoinCpuTime() - prob->startTime_, nrows_-prob->countEmptyRows(), ncols_-prob->countEmptyCols()); #ifdef PRESOLVE_SUMMARY printf("Starting major pass %d\n", iLoop + 1); #endif const CoinPresolveAction * const paction0 = paction_; // look for substitutions with no fill //#define IMPLIED 3 #ifdef IMPLIED int fill_level = 3; #define IMPLIED2 99 #if IMPLIED!=3 #if IMPLIED>2&&IMPLIED<11 fill_level = IMPLIED; COIN_DETAIL_PRINT(printf("** fill_level == %d !\n", fill_level)); #endif #if IMPLIED>11&&IMPLIED<21 fill_level = -(IMPLIED - 10); COIN_DETAIL_PRINT(printf("** fill_level == %d !\n", fill_level)); #endif #endif #else int fill_level = prob->maxSubstLevel_; #endif int whichPass = 0; while (1) { whichPass++; prob->pass_++; const CoinPresolveAction * const paction1 = paction_; if (slackd) { bool notFinished = true; while (notFinished) { possibleBreak; paction_ = slack_doubleton_action::presolve(prob, paction_, notFinished); } printProgress('F',iLoop+1); if (prob->status_) break; } if (zerocost) { possibleBreak; paction_ = do_tighten_action::presolve(prob, paction_); if (prob->status_) break; printProgress('J',iLoop+1); } if (dual && whichPass == 1) { // this can also make E rows so do one bit here possibleBreak; paction_ = remove_dual_action::presolve(prob, paction_); if (prob->status_) break; printProgress('G',iLoop+1); } if (doubleton) { possibleBreak; paction_ = doubleton_action::presolve(prob, paction_); if (prob->status_) break; printProgress('H',iLoop+1); } if (tripleton) { possibleBreak; paction_ = tripleton_action::presolve(prob, paction_); if (prob->status_) break; printProgress('I',iLoop+1); } #ifndef NO_FORCING if (forcing) { possibleBreak; paction_ = forcing_constraint_action::presolve(prob, paction_); if (prob->status_) break; printProgress('K',iLoop+1); } #endif if (ifree && (whichPass % 5) == 1) { possibleBreak; paction_ = implied_free_action::presolve(prob, paction_, fill_level); if (prob->status_) break; printProgress('L',iLoop+1); } #if PRESOLVE_DEBUG check_sol(prob, 1.0e0); #endif #if PRESOLVE_CONSISTENCY // presolve_links_ok(prob->rlink_, prob->mrstrt_, prob->hinrow_, // prob->nrows_); presolve_links_ok(prob, false, true) ; #endif //#if PRESOLVE_DEBUG // presolve_no_zeros(prob->mcstrt_, prob->colels_, prob->hincol_, // prob->ncols_); //#endif //#if PRESOLVE_CONSISTENCY // prob->consistent(); //#endif #if PRESOLVE_CONSISTENCY presolve_no_zeros(prob, true, false) ; presolve_consistent(prob, true) ; #endif { // set up for next pass // later do faster if many changes i.e. memset and memcpy const int * count = prob->hinrow_; const int * nextToDo = prob->nextRowsToDo_; int * toDo = prob->rowsToDo_; int nNext = prob->numberNextRowsToDo_; int n = 0; for (int i = 0; i < nNext; i++) { int index = nextToDo[i]; prob->unsetRowChanged(index); if (count[index]) toDo[n++] = index; } prob->numberRowsToDo_ = n; prob->numberNextRowsToDo_ = 0; count = prob->hincol_; nextToDo = prob->nextColsToDo_; toDo = prob->colsToDo_; nNext = prob->numberNextColsToDo_; n = 0; for (int i = 0; i < nNext; i++) { int index = nextToDo[i]; prob->unsetColChanged(index); if (count[index]) toDo[n++] = index; } prob->numberColsToDo_ = n; prob->numberNextColsToDo_ = 0; } if (paction_ == paction1 && fill_level > 0) break; } // say look at all int i; if (!prob->anyProhibited()) { const int * count = prob->hinrow_; int * toDo = prob->rowsToDo_; int n = 0; for (int i = 0; i < nrows_; i++) { prob->unsetRowChanged(i); if (count[i]) toDo[n++] = i; } prob->numberRowsToDo_ = n; prob->numberNextRowsToDo_ = 0; count = prob->hincol_; toDo = prob->colsToDo_; n = 0; for (int i = 0; i < ncols_; i++) { prob->unsetColChanged(i); if (count[i]) toDo[n++] = i; } prob->numberColsToDo_ = n; prob->numberNextColsToDo_ = 0; } else { // some stuff must be left alone prob->numberRowsToDo_ = 0; for (i = 0; i < nrows_; i++) if (!prob->rowProhibited(i)) prob->rowsToDo_[prob->numberRowsToDo_++] = i; prob->numberColsToDo_ = 0; for (i = 0; i < ncols_; i++) if (!prob->colProhibited(i)) prob->colsToDo_[prob->numberColsToDo_++] = i; } // now expensive things // this caused world.mps to run into numerical difficulties #ifdef PRESOLVE_SUMMARY printf("Starting expensive\n"); #endif if (dual) { int itry; for (itry = 0; itry < 5; itry++) { possibleBreak; paction_ = remove_dual_action::presolve(prob, paction_); if (prob->status_) break; printProgress('M',iLoop+1); const CoinPresolveAction * const paction2 = paction_; if (ifree) { #ifdef IMPLIED #if IMPLIED2 ==0 int fill_level = 0; // switches off substitution #elif IMPLIED2!=99 int fill_level = IMPLIED2; #endif #endif if ((itry & 1) == 0) { possibleBreak; paction_ = implied_free_action::presolve(prob, paction_, fill_level); } if (prob->status_) break; printProgress('N',iLoop+1); } if (paction_ == paction2) break; } } else if (ifree) { // just free #ifdef IMPLIED #if IMPLIED2 ==0 int fill_level = 0; // switches off substitution #elif IMPLIED2!=99 int fill_level = IMPLIED2; #endif #endif possibleBreak; paction_ = implied_free_action::presolve(prob, paction_, fill_level); if (prob->status_) break; printProgress('O',iLoop+1); } #if PRESOLVE_DEBUG check_sol(prob, 1.0e0); #endif if (dupcol) { // maybe allow integer columns to be checked if ((presolveActions_ & 512) != 0) prob->setPresolveOptions(prob->presolveOptions() | 1); possibleBreak; paction_ = dupcol_action::presolve(prob, paction_); if (prob->status_) break; printProgress('P',iLoop+1); } #if PRESOLVE_DEBUG check_sol(prob, 1.0e0); #endif if (duprow) { possibleBreak; paction_ = duprow_action::presolve(prob, paction_); if (prob->status_) break; printProgress('Q',iLoop+1); } // Marginally slower on netlib if this call is enabled. // paction_ = testRedundant(prob,paction_) ; #if PRESOLVE_DEBUG check_sol(prob, 1.0e0); #endif bool stopLoop = false; { int * hinrow = prob->hinrow_; int numberDropped = 0; for (i = 0; i < nrows_; i++) if (!hinrow[i]) numberDropped++; prob->messageHandler()->message(COIN_PRESOLVE_PASS, messages) << numberDropped << iLoop + 1 << CoinMessageEol; //printf("%d rows dropped after pass %d\n",numberDropped, // iLoop+1); if (numberDropped == lastDropped) stopLoop = true; else lastDropped = numberDropped; } // Do this here as not very loopy if (slackSingleton) { // On most passes do not touch costed slacks if (paction_ != paction0 && !stopLoop) { possibleBreak; paction_ = slack_singleton_action::presolve(prob, paction_, NULL); } else { // do costed if Clp (at end as ruins rest of presolve) possibleBreak; paction_ = slack_singleton_action::presolve(prob, paction_, rowObjective_); stopLoop = true; } printProgress('R',iLoop+1); } #if PRESOLVE_DEBUG check_sol(prob, 1.0e0); #endif if (paction_ == paction0 || stopLoop) break; #if CLP_INHERIT_MODE>1 // see whether to stop anyway int numberRowsNow=nrows_-prob->countEmptyRows(); int numberColumnsNow=ncols_-prob->countEmptyCols(); #if ABC_NORMAL_DEBUG printf("Original rows,columns %d,%d - last %d,%d end of pass %d has %d,%d\n", nrows_,ncols_,numberRowsLeft,numberColumnsLeft,iLoop+1,numberRowsNow, numberColumnsNow); #endif int rowsDeleted=numberRowsLeft-numberRowsNow; int columnsDeleted=numberColumnsLeft-numberColumnsNow; if (iLoop>15) { if (rowsDeleted*100status_&&doDependency()) { paction_ = duprow3_action::presolve(prob, paction_); printProgress('Z',0); } prob->presolveOptions_ &= ~0x10000; if (!prob->status_) { paction_ = drop_zero_coefficients(prob, paction_); #if PRESOLVE_DEBUG check_sol(prob, 1.0e0); #endif paction_ = drop_empty_cols_action::presolve(prob, paction_); paction_ = drop_empty_rows_action::presolve(prob, paction_); #if PRESOLVE_DEBUG check_sol(prob, 1.0e0); #endif } if (prob->status_) { if (prob->status_ == 1) prob->messageHandler()->message(COIN_PRESOLVE_INFEAS, messages) << prob->feasibilityTolerance_ << CoinMessageEol; else if (prob->status_ == 2) prob->messageHandler()->message(COIN_PRESOLVE_UNBOUND, messages) << CoinMessageEol; else prob->messageHandler()->message(COIN_PRESOLVE_INFEASUNBOUND, messages) << CoinMessageEol; // get rid of data destroyPresolve(); } return (paction_); } void check_djs(CoinPostsolveMatrix *prob); // We could have implemented this by having each postsolve routine // directly call the next one, but this may make it easier to add debugging checks. void ClpPresolve::postsolve(CoinPostsolveMatrix &prob) { { // Check activities double *colels = prob.colels_; int *hrow = prob.hrow_; CoinBigIndex *mcstrt = prob.mcstrt_; int *hincol = prob.hincol_; int *link = prob.link_; int ncols = prob.ncols_; char *cdone = prob.cdone_; double * csol = prob.sol_; int nrows = prob.nrows_; int colx; double * rsol = prob.acts_; memset(rsol, 0, nrows * sizeof(double)); for (colx = 0; colx < ncols; ++colx) { if (cdone[colx]) { CoinBigIndex k = mcstrt[colx]; int nx = hincol[colx]; double solutionValue = csol[colx]; for (int i = 0; i < nx; ++i) { int row = hrow[k]; double coeff = colels[k]; k = link[k]; assert (k!=NO_LINK||i==nx-1); rsol[row] += solutionValue * coeff; } } } } if (prob.maxmin_<0) { //for (int i=0;inumberRows();i++) //prob.rowduals_[i]=-prob.rowduals_[i]; for (int i=0;iname()); #endif paction->postsolve(&prob); #if PRESOLVE_DEBUG # if 0 /* This check fails (on exmip1 (!) in osiUnitTest) because clp enters postsolve with a solution that seems to have incorrect status for a logical. You can see similar behaviour with column status --- incorrect entering postsolve. -- lh, 111207 -- */ { int nr = 0; int i; for (i = 0; i < prob.nrows_; i++) { if ((prob.rowstat_[i] & 7) == 1) { nr++; } else if ((prob.rowstat_[i] & 7) == 2) { // at ub assert (prob.acts_[i] > prob.rup_[i] - 1.0e-6); } else if ((prob.rowstat_[i] & 7) == 3) { // at lb assert (prob.acts_[i] < prob.rlo_[i] + 1.0e-6); } } int nc = 0; for (i = 0; i < prob.ncols_; i++) { if ((prob.colstat_[i] & 7) == 1) nc++; } printf("%d rows (%d basic), %d cols (%d basic)\n", prob.nrows_, nr, prob.ncols_, nc); } # endif // if 0 checkit++; if (prob.colstat_ && checkit > 0) { presolve_check_nbasic(&prob) ; presolve_check_sol(&prob, 2, 2, 1) ; } #endif paction = paction->next; #if PRESOLVE_DEBUG // check_djs(&prob); if (checkit > 0) presolve_check_reduced_costs(&prob) ; #endif } #if PRESOLVE_DEBUG if (prob.colstat_) { presolve_check_nbasic(&prob) ; presolve_check_sol(&prob, 2, 2, 1) ; } #endif #undef PRESOLVE_DEBUG #if 0 && PRESOLVE_DEBUG for (i = 0; i < ncols0; i++) { if (!cdone[i]) { printf("!cdone[%d]\n", i); abort(); } } for (i = 0; i < nrows0; i++) { if (!rdone[i]) { printf("!rdone[%d]\n", i); abort(); } } for (i = 0; i < ncols0; i++) { if (sol[i] < -1e10 || sol[i] > 1e10) printf("!!!%d %g\n", i, sol[i]); } #endif #if 0 && PRESOLVE_DEBUG // debug check: make sure we ended up with same original matrix { int identical = 1; for (int i = 0; i < ncols0; i++) { PRESOLVEASSERT(hincol[i] == &prob->mcstrt0[i+1] - &prob->mcstrt0[i]); CoinBigIndex kcs0 = &prob->mcstrt0[i]; CoinBigIndex kcs = mcstrt[i]; int n = hincol[i]; for (int k = 0; k < n; k++) { CoinBigIndex k1 = presolve_find_row1(&prob->hrow0[kcs0+k], kcs, kcs + n, hrow); if (k1 == kcs + n) { printf("ROW %d NOT IN COL %d\n", &prob->hrow0[kcs0+k], i); abort(); } if (colels[k1] != &prob->dels0[kcs0+k]) printf("BAD COLEL[%d %d %d]: %g\n", k1, i, &prob->hrow0[kcs0+k], colels[k1] - &prob->dels0[kcs0+k]); if (kcs0 + k != k1) identical = 0; } } printf("identical? %d\n", identical); } #endif } static inline double getTolerance(const ClpSimplex *si, ClpDblParam key) { double tol; if (! si->getDblParam(key, tol)) { CoinPresolveAction::throwCoinError("getDblParam failed", "CoinPrePostsolveMatrix::CoinPrePostsolveMatrix"); } return (tol); } // Assumptions: // 1. nrows>=m.getNumRows() // 2. ncols>=m.getNumCols() // // In presolve, these values are equal. // In postsolve, they may be inequal, since the reduced problem // may be smaller, but we need room for the large problem. // ncols may be larger than si.getNumCols() in postsolve, // this at that point si will be the reduced problem, // but we need to reserve enough space for the original problem. CoinPrePostsolveMatrix::CoinPrePostsolveMatrix(const ClpSimplex * si, int ncols_in, int nrows_in, CoinBigIndex nelems_in, double bulkRatio) : ncols_(si->getNumCols()), nrows_(si->getNumRows()), nelems_(si->getNumElements()), ncols0_(ncols_in), nrows0_(nrows_in), bulkRatio_(bulkRatio), mcstrt_(new CoinBigIndex[ncols_in+1]), hincol_(new int[ncols_in+1]), cost_(new double[ncols_in]), clo_(new double[ncols_in]), cup_(new double[ncols_in]), rlo_(new double[nrows_in]), rup_(new double[nrows_in]), originalColumn_(new int[ncols_in]), originalRow_(new int[nrows_in]), ztolzb_(getTolerance(si, ClpPrimalTolerance)), ztoldj_(getTolerance(si, ClpDualTolerance)), maxmin_(si->getObjSense()), sol_(NULL), rowduals_(NULL), acts_(NULL), rcosts_(NULL), colstat_(NULL), rowstat_(NULL), handler_(NULL), defaultHandler_(false), messages_() { bulk0_ = static_cast (bulkRatio_ * CoinMax(nelems_in,nelems_)); hrow_ = new int [bulk0_]; colels_ = new double[bulk0_]; si->getDblParam(ClpObjOffset, originalOffset_); int ncols = si->getNumCols(); int nrows = si->getNumRows(); setMessageHandler(si->messageHandler()) ; ClpDisjointCopyN(si->getColLower(), ncols, clo_); ClpDisjointCopyN(si->getColUpper(), ncols, cup_); //ClpDisjointCopyN(si->getObjCoefficients(), ncols, cost_); double offset; ClpDisjointCopyN(si->objectiveAsObject()->gradient(si, si->getColSolution(), offset, true), ncols, cost_); ClpDisjointCopyN(si->getRowLower(), nrows, rlo_); ClpDisjointCopyN(si->getRowUpper(), nrows, rup_); int i; for (i = 0; i < ncols_in; i++) originalColumn_[i] = i; for (i = 0; i < nrows_in; i++) originalRow_[i] = i; sol_ = NULL; rowduals_ = NULL; acts_ = NULL; rcosts_ = NULL; colstat_ = NULL; rowstat_ = NULL; } // I am not familiar enough with CoinPackedMatrix to be confident // that I will implement a row-ordered version of toColumnOrderedGapFree // properly. static bool isGapFree(const CoinPackedMatrix& matrix) { const CoinBigIndex * start = matrix.getVectorStarts(); const int * length = matrix.getVectorLengths(); int i = matrix.getSizeVectorLengths() - 1; // Quick check if (matrix.getNumElements() == start[i]) { return true; } else { for (i = matrix.getSizeVectorLengths() - 1; i >= 0; --i) { if (start[i+1] - start[i] != length[i]) break; } return (! (i >= 0)); } } #if PRESOLVE_DEBUG static void matrix_bounds_ok(const double *lo, const double *up, int n) { int i; for (i = 0; i < n; i++) { PRESOLVEASSERT(lo[i] <= up[i]); PRESOLVEASSERT(lo[i] < PRESOLVE_INF); PRESOLVEASSERT(-PRESOLVE_INF < up[i]); } } #endif CoinPresolveMatrix::CoinPresolveMatrix(int ncols0_in, double /*maxmin*/, // end prepost members ClpSimplex * si, // rowrep int nrows_in, CoinBigIndex nelems_in, bool doStatus, double nonLinearValue, double bulkRatio) : CoinPrePostsolveMatrix(si, ncols0_in, nrows_in, nelems_in, bulkRatio), clink_(new presolvehlink[ncols0_in+1]), rlink_(new presolvehlink[nrows_in+1]), dobias_(0.0), // temporary init integerType_(new unsigned char[ncols0_in]), anyInteger_(false), tuning_(false), startTime_(0.0), feasibilityTolerance_(0.0), status_(-1), pass_(0), colsToDo_(new int [ncols0_in]), numberColsToDo_(0), nextColsToDo_(new int[ncols0_in]), numberNextColsToDo_(0), rowsToDo_(new int [nrows_in]), numberRowsToDo_(0), nextRowsToDo_(new int[nrows_in]), numberNextRowsToDo_(0), presolveOptions_(0) { const int bufsize = bulk0_; nrows_ = si->getNumRows() ; // Set up change bits etc rowChanged_ = new unsigned char[nrows_]; memset(rowChanged_, 0, nrows_); colChanged_ = new unsigned char[ncols_]; memset(colChanged_, 0, ncols_); CoinPackedMatrix * m = si->matrix(); // The coefficient matrix is a big hunk of stuff. // Do the copy here to try to avoid running out of memory. const CoinBigIndex * start = m->getVectorStarts(); const int * row = m->getIndices(); const double * element = m->getElements(); int icol, nel = 0; mcstrt_[0] = 0; ClpDisjointCopyN(m->getVectorLengths(), ncols_, hincol_); if (si->getObjSense() < 0.0) { for (int i=0;i ZTOLDP) colels_[nel++] = element[j]; } mcstrt_[icol+1] = nel; hincol_[icol] = nel - mcstrt_[icol]; } // same thing for row rep CoinPackedMatrix * mRow = new CoinPackedMatrix(); mRow->setExtraGap(0.0); mRow->setExtraMajor(0.0); mRow->reverseOrderedCopyOf(*m); //mRow->removeGaps(); //mRow->setExtraGap(0.0); // Now get rid of matrix si->createEmptyMatrix(); double * el = mRow->getMutableElements(); int * ind = mRow->getMutableIndices(); CoinBigIndex * strt = mRow->getMutableVectorStarts(); int * len = mRow->getMutableVectorLengths(); // Do carefully to save memory rowels_ = new double[bulk0_]; ClpDisjointCopyN(el, nelems_, rowels_); mRow->nullElementArray(); delete [] el; hcol_ = new int[bulk0_]; ClpDisjointCopyN(ind, nelems_, hcol_); mRow->nullIndexArray(); delete [] ind; mrstrt_ = new CoinBigIndex[nrows_in+1]; ClpDisjointCopyN(strt, nrows_, mrstrt_); mRow->nullStartArray(); mrstrt_[nrows_] = nelems_; delete [] strt; hinrow_ = new int[nrows_in+1]; ClpDisjointCopyN(len, nrows_, hinrow_); if (nelems_ > nel) { nelems_ = nel; // Clean any small elements int irow; nel = 0; CoinBigIndex start = 0; for (irow = 0; irow < nrows_; irow++) { CoinBigIndex j; for (j = start; j < start + hinrow_[irow]; j++) { hcol_[nel] = hcol_[j]; if (fabs(rowels_[j]) > ZTOLDP) rowels_[nel++] = rowels_[j]; } start = mrstrt_[irow+1]; mrstrt_[irow+1] = nel; hinrow_[irow] = nel - mrstrt_[irow]; } } delete mRow; if (si->integerInformation()) { CoinMemcpyN(reinterpret_cast (si->integerInformation()), ncols_, integerType_); } else { ClpFillN(integerType_, ncols_, static_cast (0)); } #ifndef SLIM_CLP #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(si->objectiveAsObject())); #else ClpQuadraticObjective * quadraticObj = NULL; if (si->objectiveAsObject()->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(si->objectiveAsObject())); #endif #endif // Set up prohibited bits if needed if (nonLinearValue) { anyProhibited_ = true; for (icol = 0; icol < ncols_; icol++) { int j; bool nonLinearColumn = false; if (cost_[icol] == nonLinearValue) nonLinearColumn = true; for (j = mcstrt_[icol]; j < mcstrt_[icol+1]; j++) { if (colels_[j] == nonLinearValue) { nonLinearColumn = true; setRowProhibited(hrow_[j]); } } if (nonLinearColumn) setColProhibited(icol); } #ifndef SLIM_CLP } else if (quadraticObj) { CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); //const int * columnQuadratic = quadratic->getIndices(); //const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); //double * quadraticElement = quadratic->getMutableElements(); int numberColumns = quadratic->getNumCols(); anyProhibited_ = true; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnQuadraticLength[iColumn]) { setColProhibited(iColumn); //printf("%d prohib\n",iColumn); } } #endif } else { anyProhibited_ = false; } if (doStatus) { // allow for status and solution sol_ = new double[ncols_]; CoinMemcpyN(si->primalColumnSolution(), ncols_, sol_);; acts_ = new double [nrows_]; CoinMemcpyN(si->primalRowSolution(), nrows_, acts_); if (!si->statusArray()) si->createStatus(); colstat_ = new unsigned char [nrows_+ncols_]; CoinMemcpyN(si->statusArray(), (nrows_ + ncols_), colstat_); rowstat_ = colstat_ + ncols_; } // the original model's fields are now unneeded - free them si->resize(0, 0); #if PRESOLVE_DEBUG matrix_bounds_ok(rlo_, rup_, nrows_); matrix_bounds_ok(clo_, cup_, ncols_); #endif #if 0 for (i = 0; i < nrows; ++i) printf("NR: %6d\n", hinrow[i]); for (int i = 0; i < ncols; ++i) printf("NC: %6d\n", hincol[i]); #endif presolve_make_memlists(/*mcstrt_,*/ hincol_, clink_, ncols_); presolve_make_memlists(/*mrstrt_,*/ hinrow_, rlink_, nrows_); // this allows last col/row to expand up to bufsize-1 (22); // this must come after the calls to presolve_prefix mcstrt_[ncols_] = bufsize - 1; mrstrt_[nrows_] = bufsize - 1; // Allocate useful arrays initializeStuff(); #if PRESOLVE_CONSISTENCY //consistent(false); presolve_consistent(this, false) ; #endif } // avoid compiler warnings #if PRESOLVE_SUMMARY > 0 void CoinPresolveMatrix::update_model(ClpSimplex * si, int nrows0, int ncols0, CoinBigIndex nelems0) #else void CoinPresolveMatrix::update_model(ClpSimplex * si, int /*nrows0*/, int /*ncols0*/, CoinBigIndex /*nelems0*/) #endif { if (si->getObjSense() < 0.0) { for (int i=0;iloadProblem(ncols_, nrows_, mcstrt_, hrow_, colels_, hincol_, clo_, cup_, cost_, rlo_, rup_); //delete [] si->integerInformation(); int numberIntegers = 0; for (int i = 0; i < ncols_; i++) { if (integerType_[i]) numberIntegers++; } if (numberIntegers) si->copyInIntegerInformation(reinterpret_cast (integerType_)); else si->copyInIntegerInformation(NULL); #if PRESOLVE_SUMMARY printf("NEW NCOL/NROW/NELS: %d(-%d) %d(-%d) %d(-%d)\n", ncols_, ncols0 - ncols_, nrows_, nrows0 - nrows_, si->getNumElements(), nelems0 - si->getNumElements()); #endif si->setDblParam(ClpObjOffset, originalOffset_ - dobias_); if (si->getObjSense() < 0.0) { // put back for (int i=0;igetNumRows() ; ncols_ = si->getNumCols() ; sol_ = sol_in; rowduals_ = NULL; acts_ = acts_in; rcosts_ = NULL; colstat_ = colstat_in; rowstat_ = rowstat_in; // this is the *reduced* model, which is probably smaller int ncols1 = ncols_ ; int nrows1 = nrows_ ; const CoinPackedMatrix * m = si->matrix(); const CoinBigIndex nelemsr = m->getNumElements(); if (m->getNumElements() && !isGapFree(*m)) { // Odd - gaps CoinPackedMatrix mm(*m); mm.removeGaps(); mm.setExtraGap(0.0); ClpDisjointCopyN(mm.getVectorStarts(), ncols1, mcstrt_); CoinZeroN(mcstrt_ + ncols1, ncols0_ - ncols1); mcstrt_[ncols1] = nelems0; // ?? (should point to end of bulk store -- lh --) ClpDisjointCopyN(mm.getVectorLengths(), ncols1, hincol_); ClpDisjointCopyN(mm.getIndices(), nelemsr, hrow_); ClpDisjointCopyN(mm.getElements(), nelemsr, colels_); } else { // No gaps ClpDisjointCopyN(m->getVectorStarts(), ncols1, mcstrt_); CoinZeroN(mcstrt_ + ncols1, ncols0_ - ncols1); mcstrt_[ncols1] = nelems0; // ?? (should point to end of bulk store -- lh --) ClpDisjointCopyN(m->getVectorLengths(), ncols1, hincol_); ClpDisjointCopyN(m->getIndices(), nelemsr, hrow_); ClpDisjointCopyN(m->getElements(), nelemsr, colels_); } #if 0 && PRESOLVE_DEBUG presolve_check_costs(model, &colcopy); #endif // This determines the size of the data structure that contains // the matrix being postsolved. Links are taken from the free_list // to recreate matrix entries that were presolved away, // and links are added to the free_list when entries created during // presolve are discarded. There is never a need to gc this list. // Naturally, it should contain // exactly nelems0 entries "in use" when postsolving is done, // but I don't know whether the matrix could temporarily get // larger during postsolving. Substitution into more than two // rows could do that, in principle. I am being very conservative // here by reserving much more than the amount of space I probably need. // If this guess is wrong, check_free_list may be called. // int bufsize = 2*nelems0; memset(cdone_, -1, ncols0_); memset(rdone_, -1, nrows0_); rowduals_ = new double[nrows0_]; ClpDisjointCopyN(si->getRowPrice(), nrows1, rowduals_); rcosts_ = new double[ncols0_]; ClpDisjointCopyN(si->getReducedCost(), ncols1, rcosts_); if (maxmin < 0.0) { // change so will look as if minimize int i; for (i = 0; i < nrows1; i++) rowduals_[i] = - rowduals_[i]; for (i = 0; i < ncols1; i++) { rcosts_[i] = - rcosts_[i]; } } //ClpDisjointCopyN(si->getRowUpper(), nrows1, rup_); //ClpDisjointCopyN(si->getRowLower(), nrows1, rlo_); ClpDisjointCopyN(si->getColSolution(), ncols1, sol_); si->setDblParam(ClpObjOffset, originalOffset_); // Test below only needed for QP ..... but ..... // To switch off define COIN_SLOW_PRESOLVE=0 #ifndef COIN_SLOW_PRESOLVE #define COIN_SLOW_PRESOLVE 1 #endif for (int j = 0; j < ncols1; j++) { #if COIN_SLOW_PRESOLVE if (hincol_[j]) { #endif CoinBigIndex kcs = mcstrt_[j]; CoinBigIndex kce = kcs + hincol_[j]; for (CoinBigIndex k = kcs; k < kce; ++k) { link_[k] = k + 1; } link_[kce-1] = NO_LINK ; #if COIN_SLOW_PRESOLVE } #endif } { int ml = maxlink_; for (CoinBigIndex k = nelemsr; k < ml; ++k) link_[k] = k + 1; if (ml) link_[ml-1] = NO_LINK; } free_list_ = nelemsr; # if PRESOLVE_DEBUG || PRESOLVE_CONSISTENCY /* These are used to track the action of postsolve transforms during debugging. */ CoinFillN(cdone_, ncols1, PRESENT_IN_REDUCED) ; CoinZeroN(cdone_ + ncols1, ncols0_in - ncols1) ; CoinFillN(rdone_, nrows1, PRESENT_IN_REDUCED) ; CoinZeroN(rdone_ + nrows1, nrows0_in - nrows1) ; # endif } /* This is main part of Presolve */ ClpSimplex * ClpPresolve::gutsOfPresolvedModel(ClpSimplex * originalModel, double feasibilityTolerance, bool keepIntegers, int numberPasses, bool dropNames, bool doRowObjective, const char * prohibitedRows, const char * prohibitedColumns) { ncols_ = originalModel->getNumCols(); nrows_ = originalModel->getNumRows(); nelems_ = originalModel->getNumElements(); numberPasses_ = numberPasses; double maxmin = originalModel->getObjSense(); originalModel_ = originalModel; delete [] originalColumn_; originalColumn_ = new int[ncols_]; delete [] originalRow_; originalRow_ = new int[nrows_]; // and fill in case returns early int i; for (i = 0; i < ncols_; i++) originalColumn_[i] = i; for (i = 0; i < nrows_; i++) originalRow_[i] = i; delete [] rowObjective_; if (doRowObjective) { rowObjective_ = new double [nrows_]; memset(rowObjective_, 0, nrows_ * sizeof(double)); } else { rowObjective_ = NULL; } // result is 0 - okay, 1 infeasible, -1 go round again, 2 - original model int result = -1; // User may have deleted - its their responsibility presolvedModel_ = NULL; // Messages CoinMessages messages = originalModel->coinMessages(); // Only go round 100 times even if integer preprocessing int totalPasses = 100; while (result == -1) { #ifndef CLP_NO_STD // make new copy if (saveFile_ == "") { #endif delete presolvedModel_; #ifndef CLP_NO_STD // So won't get names int lengthNames = originalModel->lengthNames(); originalModel->setLengthNames(0); #endif presolvedModel_ = new ClpSimplex(*originalModel); #ifndef CLP_NO_STD originalModel->setLengthNames(lengthNames); presolvedModel_->dropNames(); } else { presolvedModel_ = originalModel; if (dropNames) presolvedModel_->dropNames(); } #endif // drop integer information if wanted if (!keepIntegers) presolvedModel_->deleteIntegerInformation(); totalPasses--; double ratio = 2.0; if (substitution_ > 3) ratio = sqrt((substitution_-3)+5.0); else if (substitution_ == 2) ratio = 1.5; CoinPresolveMatrix prob(ncols_, maxmin, presolvedModel_, nrows_, nelems_, true, nonLinearValue_, ratio); if (prohibitedRows) { prob.setAnyProhibited(); for (int i=0;iprimalColumnSolution()); CoinMemcpyN( prob.acts_, prob.nrows_, presolvedModel_->primalRowSolution()); CoinMemcpyN( prob.colstat_, prob.ncols_, presolvedModel_->statusArray()); CoinMemcpyN( prob.rowstat_, prob.nrows_, presolvedModel_->statusArray() + prob.ncols_); if (fixInfeasibility && hasSolution) { // Looks feasible but double check to see if anything slipped through int n = prob.ncols_; double * lo = prob.clo_; double * up = prob.cup_; double * rsol = prob.acts_; //memset(prob.acts_,0,prob.nrows_*sizeof(double)); presolvedModel_->matrix()->times(prob.sol_,rsol); int i; for (i = 0; i < n; i++) { double gap=up[i]-lo[i]; if (rsol[i]up[i]+feasibilityTolerance&&fabs(rsol[i]-up[i])<1.0e-3) { up[i]=rsol[i]; if (gap<1.0e5) lo[i]=up[i]-gap; } if (up[i] < lo[i]) { up[i] = lo[i]; } } } int n = prob.nrows_; double * lo = prob.rlo_; double * up = prob.rup_; for (i = 0; i < n; i++) { if (up[i] < lo[i]) { if (up[i] < lo[i] - feasibilityTolerance && !fixInfeasibility) { // infeasible prob.status_ = 1; } else { up[i] = lo[i]; } } } delete [] prob.sol_; delete [] prob.acts_; delete [] prob.colstat_; prob.sol_ = NULL; prob.acts_ = NULL; prob.colstat_ = NULL; int ncolsNow = presolvedModel_->getNumCols(); CoinMemcpyN(prob.originalColumn_, ncolsNow, originalColumn_); #ifndef SLIM_CLP #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(originalModel->objectiveAsObject())); #else ClpQuadraticObjective * quadraticObj = NULL; if (originalModel->objectiveAsObject()->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(originalModel->objectiveAsObject())); #endif if (quadraticObj) { // set up for subset char * mark = new char [ncols_]; memset(mark, 0, ncols_); CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); //const int * columnQuadratic = quadratic->getIndices(); //const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); //double * quadraticElement = quadratic->getMutableElements(); int numberColumns = quadratic->getNumCols(); ClpQuadraticObjective * newObj = new ClpQuadraticObjective(*quadraticObj, ncolsNow, originalColumn_); // and modify linear and check double * linear = newObj->linearObjective(); CoinMemcpyN(presolvedModel_->objective(), ncolsNow, linear); int iColumn; for ( iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnQuadraticLength[iColumn]) mark[iColumn] = 1; } // and new quadratic = newObj->quadraticObjective(); columnQuadraticLength = quadratic->getVectorLengths(); int numberColumns2 = quadratic->getNumCols(); for ( iColumn = 0; iColumn < numberColumns2; iColumn++) { if (columnQuadraticLength[iColumn]) mark[originalColumn_[iColumn]] = 0; } presolvedModel_->setObjective(newObj); delete newObj; // final check for ( iColumn = 0; iColumn < numberColumns; iColumn++) if (mark[iColumn]) printf("Quadratic column %d modified - may be okay\n", iColumn); delete [] mark; } #endif delete [] prob.originalColumn_; prob.originalColumn_ = NULL; int nrowsNow = presolvedModel_->getNumRows(); CoinMemcpyN(prob.originalRow_, nrowsNow, originalRow_); delete [] prob.originalRow_; prob.originalRow_ = NULL; #ifndef CLP_NO_STD if (!dropNames && originalModel->lengthNames()) { // Redo names int iRow; std::vector rowNames; rowNames.reserve(nrowsNow); for (iRow = 0; iRow < nrowsNow; iRow++) { int kRow = originalRow_[iRow]; rowNames.push_back(originalModel->rowName(kRow)); } int iColumn; std::vector columnNames; columnNames.reserve(ncolsNow); for (iColumn = 0; iColumn < ncolsNow; iColumn++) { int kColumn = originalColumn_[iColumn]; columnNames.push_back(originalModel->columnName(kColumn)); } presolvedModel_->copyNames(rowNames, columnNames); } else { presolvedModel_->setLengthNames(0); } #endif if (rowObjective_) { int iRow; #ifndef NDEBUG int k = -1; #endif int nObj = 0; for (iRow = 0; iRow < nrowsNow; iRow++) { int kRow = originalRow_[iRow]; #ifndef NDEBUG assert (kRow > k); k = kRow; #endif rowObjective_[iRow] = rowObjective_[kRow]; if (rowObjective_[iRow]) nObj++; } if (nObj) { printf("%d costed slacks\n", nObj); presolvedModel_->setRowObjective(rowObjective_); } } /* now clean up integer variables. This can modify original Don't do if dupcol added columns together */ int i; const char * information = presolvedModel_->integerInformation(); if ((prob.presolveOptions_ & 0x80000000) == 0 && information) { int numberChanges = 0; double * lower0 = originalModel_->columnLower(); double * upper0 = originalModel_->columnUpper(); double * lower = presolvedModel_->columnLower(); double * upper = presolvedModel_->columnUpper(); for (i = 0; i < ncolsNow; i++) { if (!information[i]) continue; int iOriginal = originalColumn_[i]; double lowerValue0 = lower0[iOriginal]; double upperValue0 = upper0[iOriginal]; double lowerValue = ceil(lower[i] - 1.0e-5); double upperValue = floor(upper[i] + 1.0e-5); lower[i] = lowerValue; upper[i] = upperValue; if (lowerValue > upperValue) { numberChanges++; presolvedModel_->messageHandler()->message(COIN_PRESOLVE_COLINFEAS, messages) << iOriginal << lowerValue << upperValue << CoinMessageEol; result = 1; } else { if (lowerValue > lowerValue0 + 1.0e-8) { lower0[iOriginal] = lowerValue; numberChanges++; } if (upperValue < upperValue0 - 1.0e-8) { upper0[iOriginal] = upperValue; numberChanges++; } } } if (numberChanges) { presolvedModel_->messageHandler()->message(COIN_PRESOLVE_INTEGERMODS, messages) << numberChanges << CoinMessageEol; if (!result && totalPasses > 0) { result = -1; // round again const CoinPresolveAction *paction = paction_; while (paction) { const CoinPresolveAction *next = paction->next; delete paction; paction = next; } paction_ = NULL; } } } } else if (prob.status_) { // infeasible or unbounded result = 1; // Put status in nelems_! nelems_ = - prob.status_; originalModel->setProblemStatus(prob.status_); } else { // no changes - model needs restoring after Lou's changes #ifndef CLP_NO_STD if (saveFile_ == "") { #endif delete presolvedModel_; presolvedModel_ = new ClpSimplex(*originalModel); // but we need to remove gaps ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(presolvedModel_->clpMatrix()); if (clpMatrix) { clpMatrix->getPackedMatrix()->removeGaps(); } #ifndef CLP_NO_STD } else { presolvedModel_ = originalModel; } presolvedModel_->dropNames(); #endif // drop integer information if wanted if (!keepIntegers) presolvedModel_->deleteIntegerInformation(); result = 2; } } if (result == 0 || result == 2) { int nrowsAfter = presolvedModel_->getNumRows(); int ncolsAfter = presolvedModel_->getNumCols(); CoinBigIndex nelsAfter = presolvedModel_->getNumElements(); presolvedModel_->messageHandler()->message(COIN_PRESOLVE_STATS, messages) << nrowsAfter << -(nrows_ - nrowsAfter) << ncolsAfter << -(ncols_ - ncolsAfter) << nelsAfter << -(nelems_ - nelsAfter) << CoinMessageEol; } else { destroyPresolve(); if (presolvedModel_ != originalModel_) delete presolvedModel_; presolvedModel_ = NULL; } return presolvedModel_; } CoinMP-1.8.3/Clp/src/MyEventHandler.hpp0000644000175000017500000000231711510657452016230 0ustar renerene/* $Id: MyEventHandler.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef MyEventHandler_H #define MyEventHandler_H #include "ClpEventHandler.hpp" /** This is so user can trap events and do useful stuff. This is used in Clp/Test/unitTest.cpp ClpSimplex model_ is available as well as anything else you care to pass in */ class MyEventHandler : public ClpEventHandler { public: /**@name Overrides */ //@{ virtual int event(Event whichEvent); //@} /**@name Constructors, destructor etc*/ //@{ /** Default constructor. */ MyEventHandler(); /// Constructor with pointer to model (redundant as setEventHandler does) MyEventHandler(ClpSimplex * model); /** Destructor */ virtual ~MyEventHandler(); /** The copy constructor. */ MyEventHandler(const MyEventHandler & rhs); /// Assignment MyEventHandler& operator=(const MyEventHandler & rhs); /// Clone virtual ClpEventHandler * clone() const ; //@} protected: // data goes here }; #endif CoinMP-1.8.3/Clp/src/ClpDualRowDantzig.hpp0000644000175000017500000000367011510657452016703 0ustar renerene/* $Id: ClpDualRowDantzig.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpDualRowDantzig_H #define ClpDualRowDantzig_H #include "ClpDualRowPivot.hpp" //############################################################################# /** Dual Row Pivot Dantzig Algorithm Class This is simplest choice - choose largest infeasibility */ class ClpDualRowDantzig : public ClpDualRowPivot { public: ///@name Algorithmic methods //@{ /// Returns pivot row, -1 if none virtual int pivotRow(); /** Updates weights and returns pivot alpha. Also does FT update */ virtual double updateWeights(CoinIndexedVector * input, CoinIndexedVector * spare, CoinIndexedVector * spare2, CoinIndexedVector * updatedColumn); /** Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Computes change in objective function */ virtual void updatePrimalSolution(CoinIndexedVector * input, double theta, double & changeInObjective); //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpDualRowDantzig(); /// Copy constructor ClpDualRowDantzig(const ClpDualRowDantzig &); /// Assignment operator ClpDualRowDantzig & operator=(const ClpDualRowDantzig& rhs); /// Destructor virtual ~ClpDualRowDantzig (); /// Clone virtual ClpDualRowPivot * clone(bool copyData = true) const; //@} //--------------------------------------------------------------------------- private: ///@name Private member data //@} }; #endif CoinMP-1.8.3/Clp/src/AbcPrimalColumnSteepest.hpp0000644000175000017500000001605212101105055020051 0ustar renerene/* $Id: AbcPrimalColumnSteepest.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef AbcPrimalColumnSteepest_H #define AbcPrimalColumnSteepest_H #include "AbcPrimalColumnPivot.hpp" #include //############################################################################# class CoinIndexedVector; /** Primal Column Pivot Steepest Edge Algorithm Class See Forrest-Goldfarb paper for algorithm */ class AbcPrimalColumnSteepest : public AbcPrimalColumnPivot { public: ///@name Algorithmic methods //@{ /** Returns pivot column, -1 if none. The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row Parts of operation split out into separate functions for profiling and speed */ virtual int pivotColumn(CoinPartitionedVector * updates, CoinPartitionedVector * spareRow2, CoinPartitionedVector * spareColumn1); /// Just update djs void justDjs(CoinIndexedVector * updates, CoinIndexedVector * spareColumn1); /// Update djs doing partial pricing (dantzig) int partialPricing(CoinIndexedVector * updates, int numberWanted, int numberLook); /// Update djs, weights for Devex using djs void djsAndDevex(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1); /// Update djs, weights for Devex using pivot row void djsAndDevex2(CoinIndexedVector * updates, CoinIndexedVector * spareColumn1); /// Update weights for Devex void justDevex(CoinIndexedVector * updates, CoinIndexedVector * spareColumn1); /** Does steepest work type - 0 - just djs 1 - just steepest 2 - both using scaleFactor 3 - both using extra array */ int doSteepestWork(CoinPartitionedVector * updates, CoinPartitionedVector * spareRow2, CoinPartitionedVector * spareColumn1, int type); /// Updates weights - part 1 - also checks accuracy virtual void updateWeights(CoinIndexedVector * input); /// Checks accuracy - just for debug void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector * rowArray1); /// Initialize weights void initializeWeights(); /** Save weights - this may initialize weights as well mode is - 1) before factorization 2) after factorization 3) just redo infeasibilities 4) restore weights 5) at end of values pass (so need initialization) */ virtual void saveWeights(AbcSimplex * model, int mode); /// Gets rid of last update virtual void unrollWeights(); /// Gets rid of all arrays virtual void clearArrays(); /// Returns true if would not find any column virtual bool looksOptimal() const; /// Called when maximum pivots changes virtual void maximumPivotsChanged(); //@} /**@name gets and sets */ //@{ /// Mode inline int mode() const { return mode_; } //@} /** enums for persistence */ enum Persistence { normal = 0x00, // create (if necessary) and destroy keep = 0x01 // create (if necessary) and leave }; ///@name Constructors and destructors //@{ /** Default Constructor 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 and 2 depending on factorization 4 starts as partial dantzig/devex but then may switch between 0 and 2. By partial exact devex is meant that the weights are updated as normal but only part of the nonbasic variables are scanned. This can be faster on very easy problems. */ AbcPrimalColumnSteepest(int mode = 3); /// Copy constructor AbcPrimalColumnSteepest(const AbcPrimalColumnSteepest & rhs); /// Assignment operator AbcPrimalColumnSteepest & operator=(const AbcPrimalColumnSteepest& rhs); /// Destructor virtual ~AbcPrimalColumnSteepest (); /// Clone virtual AbcPrimalColumnPivot * clone(bool copyData = true) const; //@} ///@name Private functions to deal with devex /** reference would be faster using AbcSimplex's status_, but I prefer to keep modularity. */ inline bool reference(int i) const { return ((reference_[i>>5] >> (i & 31)) & 1) != 0; } inline void setReference(int i, bool trueFalse) { unsigned int & value = reference_[i>>5]; int bit = i & 31; if (trueFalse) value |= (1 << bit); else value &= ~(1 << bit); } /// Set/ get persistence inline void setPersistence(Persistence life) { persistence_ = life; } inline Persistence persistence() const { return persistence_ ; } //@} //--------------------------------------------------------------------------- private: ///@name Private member data // Update weight double devex_; /// weight array double * weights_; /// square of infeasibility array (just for infeasible columns) CoinIndexedVector * infeasible_; /// alternate weight array (so we can unroll) CoinIndexedVector * alternateWeights_; /// save weight array (so we can use checkpoint) double * savedWeights_; // Array for exact devex to say what is in reference framework unsigned int * reference_; /** Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number */ int state_; /** 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 and 2 depending on factorization 4 starts as partial dantzig/devex but then may switch between 0 and 2. 5 is always partial dantzig By partial exact devex is meant that the weights are updated as normal but only part of the nonbasic variables are scanned. This can be faster on very easy problems. New dubious option is >=10 which does mini-sprint */ int mode_; /// Life of weights Persistence persistence_; /// Number of times switched from partial dantzig to 0/2 int numberSwitched_; // This is pivot row (or pivot sequence round re-factorization) int pivotSequence_; // This is saved pivot sequence int savedPivotSequence_; // This is saved outgoing variable int savedSequenceOut_; // Iteration when last rectified int lastRectified_; // Size of factorization at invert (used to decide algorithm) int sizeFactorization_; //@} }; #endif CoinMP-1.8.3/Clp/src/AbcPrimalColumnSteepest.cpp0000644000175000017500000025231312452503025020056 0ustar renerene/* $Id: AbcPrimalColumnSteepest.cpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "AbcSimplex.hpp" #include "AbcPrimalColumnSteepest.hpp" #include "CoinIndexedVector.hpp" #include "AbcSimplexFactorization.hpp" #include "AbcNonLinearCost.hpp" #include "ClpMessage.hpp" #include "CoinHelperFunctions.hpp" #undef COIN_DETAIL_PRINT #define COIN_DETAIL_PRINT(s) s #include //#define CLP_DEBUG //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcPrimalColumnSteepest::AbcPrimalColumnSteepest (int mode) : AbcPrimalColumnPivot(), devex_(0.0), weights_(NULL), infeasible_(NULL), alternateWeights_(NULL), savedWeights_(NULL), reference_(NULL), state_(-1), mode_(mode), persistence_(normal), numberSwitched_(0), pivotSequence_(-1), savedPivotSequence_(-1), savedSequenceOut_(-1), sizeFactorization_(0) { type_ = 2 + 64 * mode; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcPrimalColumnSteepest::AbcPrimalColumnSteepest (const AbcPrimalColumnSteepest & rhs) : AbcPrimalColumnPivot(rhs) { state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; numberSwitched_ = rhs.numberSwitched_; model_ = rhs.model_; pivotSequence_ = rhs.pivotSequence_; savedPivotSequence_ = rhs.savedPivotSequence_; savedSequenceOut_ = rhs.savedSequenceOut_; sizeFactorization_ = rhs.sizeFactorization_; devex_ = rhs.devex_; if ((model_ && model_->whatsChanged() & 1) != 0) { if (rhs.infeasible_) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } reference_ = NULL; if (rhs.weights_) { assert(model_); int number = model_->numberRows() + model_->numberColumns(); assert (number == rhs.model_->numberRows() + rhs.model_->numberColumns()); weights_ = new double[number]; CoinMemcpyN(rhs.weights_, number, weights_); savedWeights_ = new double[number]; CoinMemcpyN(rhs.savedWeights_, number, savedWeights_); if (mode_ != 1) { reference_ = CoinCopyOfArray(rhs.reference_, (number + 31) >> 5); } } else { weights_ = NULL; savedWeights_ = NULL; } if (rhs.alternateWeights_) { #ifndef ABC_USE_COIN_FACTORIZATIONz alternateWeights_ = new CoinIndexedVector(rhs.alternateWeights_); // zero CoinZeroN(alternateWeights_->getIndices(), alternateWeights_->capacity()); #else #endif } else { alternateWeights_ = NULL; } } else { infeasible_ = NULL; reference_ = NULL; weights_ = NULL; savedWeights_ = NULL; alternateWeights_ = NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcPrimalColumnSteepest::~AbcPrimalColumnSteepest () { delete [] weights_; delete infeasible_; delete alternateWeights_; delete [] savedWeights_; delete [] reference_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcPrimalColumnSteepest & AbcPrimalColumnSteepest::operator=(const AbcPrimalColumnSteepest& rhs) { if (this != &rhs) { AbcPrimalColumnPivot::operator=(rhs); state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; numberSwitched_ = rhs.numberSwitched_; model_ = rhs.model_; pivotSequence_ = rhs.pivotSequence_; savedPivotSequence_ = rhs.savedPivotSequence_; savedSequenceOut_ = rhs.savedSequenceOut_; sizeFactorization_ = rhs.sizeFactorization_; devex_ = rhs.devex_; delete [] weights_; delete [] reference_; reference_ = NULL; delete infeasible_; delete alternateWeights_; delete [] savedWeights_; savedWeights_ = NULL; if (rhs.infeasible_ != NULL) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } if (rhs.weights_ != NULL) { assert(model_); int number = model_->numberRows() + model_->numberColumns(); assert (number == rhs.model_->numberRows() + rhs.model_->numberColumns()); weights_ = new double[number]; CoinMemcpyN(rhs.weights_, number, weights_); savedWeights_ = new double[number]; CoinMemcpyN(rhs.savedWeights_, number, savedWeights_); if (mode_ != 1) { reference_ = CoinCopyOfArray(rhs.reference_, (number + 31) >> 5); } } else { weights_ = NULL; } if (rhs.alternateWeights_ != NULL) { #ifndef ABC_USE_COIN_FACTORIZATIONz alternateWeights_ = new CoinIndexedVector(rhs.alternateWeights_); // zero CoinZeroN(alternateWeights_->getIndices(), alternateWeights_->capacity()); #else #endif } else { alternateWeights_ = NULL; } } return *this; } // These have to match ClpPackedMatrix version #define TRY_NORM 1.0e-4 #define ADD_ONE 1.0 // Returns pivot column, -1 if none /* The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row*/ int AbcPrimalColumnSteepest::pivotColumn(CoinPartitionedVector * updates, CoinPartitionedVector * spareRow2, CoinPartitionedVector * spareColumn1) { assert(model_); int number = 0; int * index; double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); int anyUpdates; double * infeas = infeasible_->denseVector(); // Local copy of mode so can decide what to do int switchType; if (mode_ == 4) switchType = 5 - numberSwitched_; else if (mode_ >= 10) switchType = 3; else switchType = mode_; /* switchType - 0 - all exact devex 1 - all steepest 2 - some exact devex 3 - auto some exact devex 4 - devex 5 - dantzig 10 - can go to mini-sprint */ if (updates->getNumElements() > 1) { // would have to have two goes for devex, three for steepest anyUpdates = 2; } else if (updates->getNumElements()) { if (updates->getIndices()[0] == pivotRow && fabs(updates->denseVector()[pivotRow]) > 1.0e-6) { //&& fabs(updates->denseVector()[pivotRow]) < 1.0e6) { // reasonable size anyUpdates = 1; //if (fabs(model_->dualIn())<1.0e-4||fabs(fabs(model_->dualIn())-fabs(updates->denseVector()[0]))>1.0e-5) //printf("dualin %g pivot %g\n",model_->dualIn(),updates->denseVector()[0]); } else { // too small anyUpdates = 2; } } else if (pivotSequence_ >= 0) { // just after re-factorization anyUpdates = -1; } else { // sub flip - nothing to do anyUpdates = 0; } int sequenceOut = model_->sequenceOut(); if (switchType == 5) { pivotSequence_ = -1; pivotRow = -1; // See if to switch int numberRows = model_->numberRows(); int numberWanted = 10; int numberColumns = model_->numberColumns(); double ratio = static_cast (sizeFactorization_) / static_cast (numberRows); // Number of dual infeasibilities at last invert int numberDual = model_->numberDualInfeasibilities(); int numberLook = CoinMin(numberDual, numberColumns / 10); if (ratio < 1.0) { numberWanted = 100; numberLook /= 20; numberWanted = CoinMax(numberWanted, numberLook); } else if (ratio < 3.0) { numberWanted = 500; numberLook /= 15; numberWanted = CoinMax(numberWanted, numberLook); } else if (ratio < 4.0 || mode_ == 5) { numberWanted = 1000; numberLook /= 10; numberWanted = CoinMax(numberWanted, numberLook); } else if (mode_ != 5) { switchType = 4; // initialize numberSwitched_++; // Make sure will re-do delete [] weights_; weights_ = NULL; //work space int whichArray[2]; for (int i=0;i<2;i++) whichArray[i]=model_->getAvailableArray(); CoinIndexedVector * array1 = model_->usefulArray(whichArray[0]); CoinIndexedVector * array2 = model_->usefulArray(whichArray[1]); model_->computeDuals(NULL,array1,array2); for (int i=0;i<2;i++) model_->setAvailableArray(whichArray[i]); saveWeights(model_, 4); anyUpdates = 0; COIN_DETAIL_PRINT(printf("switching to devex %d nel ratio %g\n", sizeFactorization_, ratio)); } if (switchType == 5) { numberLook *= 5; // needs tuning for gub if (model_->numberIterations() % 1000 == 0 && model_->logLevel() > 1) { COIN_DETAIL_PRINT(printf("numels %d ratio %g wanted %d look %d\n", sizeFactorization_, ratio, numberWanted, numberLook)); } // Update duals and row djs // Do partial pricing return partialPricing(updates, numberWanted, numberLook); } } if (switchType == 5) { if (anyUpdates > 0) { justDjs(updates,spareColumn1); } } else if (anyUpdates == 1) { if (switchType < 4) { // exact etc when can use dj doSteepestWork(updates,spareRow2,spareColumn1,2); } else { // devex etc when can use dj djsAndDevex(updates, spareRow2, spareColumn1); } } else if (anyUpdates == -1) { if (switchType < 4) { // exact etc when djs okay //if (model_->maximumIterations()!=1000) doSteepestWork(updates,spareRow2,spareColumn1,1); } else { // devex etc when djs okay justDevex(updates, spareColumn1); } } else if (anyUpdates == 2) { if (switchType < 4) { // exact etc when have to use pivot doSteepestWork(updates,spareRow2,spareColumn1,3); } else { // devex etc when have to use pivot djsAndDevex2(updates, spareColumn1); } } #ifdef CLP_DEBUG alternateWeights_->checkClear(); #endif // make sure outgoing from last iteration okay if (sequenceOut >= 0) { AbcSimplex::Status status = model_->getInternalStatus(sequenceOut); double value = model_->reducedCost(sequenceOut); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } break; case AbcSimplex::atUpperBound: if (value > tolerance) { // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } break; case AbcSimplex::atLowerBound: if (value < -tolerance) { // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } } } // update of duals finished - now do pricing // See what sort of pricing int numberWanted = 10; number = infeasible_->getNumElements(); int numberColumns = model_->numberColumns(); if (switchType == 5) { pivotSequence_ = -1; pivotRow = -1; // See if to switch int numberRows = model_->numberRows(); // ratio is done on number of columns here //double ratio = static_cast sizeFactorization_/static_cast numberColumns; double ratio = static_cast (sizeFactorization_) / static_cast (numberRows); if (ratio < 1.0) { numberWanted = CoinMax(100, number / 200); } else if (ratio < 2.0 - 1.0) { numberWanted = CoinMax(500, number / 40); } else if (ratio < 4.0 - 3.0 || mode_ == 5) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 30); } else if (mode_ != 5) { switchType = 4; // initialize numberSwitched_++; // Make sure will re-do delete [] weights_; weights_ = NULL; saveWeights(model_, 4); COIN_DETAIL_PRINT(printf("switching to devex %d nel ratio %g\n", sizeFactorization_, ratio)); } //if (model_->numberIterations()%1000==0) //printf("numels %d ratio %g wanted %d\n",sizeFactorization_,ratio,numberWanted); } int numberRows = model_->numberRows(); // ratio is done on number of rows here double ratio = static_cast (sizeFactorization_) / static_cast (numberRows); if(switchType == 4) { // Still in devex mode // Go to steepest if lot of iterations? if (ratio < 5.0) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 20); } else if (ratio < 7.0) { numberWanted = CoinMax(2000, number / 5); numberWanted = CoinMax(numberWanted, numberColumns / 10); } else { // we can zero out updates->clear(); spareColumn1->clear(); switchType = 3; // initialize pivotSequence_ = -1; pivotRow = -1; numberSwitched_++; // Make sure will re-do delete [] weights_; weights_ = NULL; saveWeights(model_, 4); COIN_DETAIL_PRINT(printf("switching to exact %d nel ratio %g\n", sizeFactorization_, ratio)); updates->clear(); } if (model_->numberIterations() % 1000 == 0) COIN_DETAIL_PRINT(printf("numels %d ratio %g wanted %d type x\n", sizeFactorization_, ratio, numberWanted)); } if (switchType < 4) { if (switchType < 2 ) { numberWanted = number + 1; } else if (switchType == 2) { numberWanted = CoinMax(2000, number / 8); } else { if (ratio < 1.0) { numberWanted = CoinMax(2000, number / 20); } else if (ratio < 5.0) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 40); } else if (ratio < 10.0) { numberWanted = CoinMax(2000, number / 8); numberWanted = CoinMax(numberWanted, numberColumns / 20); } else { ratio = number * (ratio / 80.0); if (ratio > number) { numberWanted = number + 1; } else { numberWanted = CoinMax(2000, static_cast (ratio)); numberWanted = CoinMax(numberWanted, numberColumns / 10); } } } //if (model_->numberIterations()%1000==0) //printf("numels %d ratio %g wanted %d type %d\n",sizeFactorization_,ratio,numberWanted, //switchType); } double bestDj = 1.0e-30; int bestSequence = -1; int i, iSequence; index = infeasible_->getIndices(); number = infeasible_->getNumElements(); if(model_->numberIterations() < model_->lastBadIteration() + 200 && model_->factorization()->pivots() > 10) { // we can't really trust infeasibilities if there is dual error double checkTolerance = 1.0e-8; if (model_->largestDualError() > checkTolerance) tolerance *= model_->largestDualError() / checkTolerance; // But cap tolerance = CoinMin(1000.0, tolerance); } #ifdef CLP_DEBUG if (model_->numberDualInfeasibilities() == 1) printf("** %g %g %g %x %x %d\n", tolerance, model_->dualTolerance(), model_->largestDualError(), model_, model_->messageHandler(), number); #endif // stop last one coming immediately double saveOutInfeasibility = 0.0; if (sequenceOut >= 0) { saveOutInfeasibility = infeas[sequenceOut]; infeas[sequenceOut] = 0.0; } if (model_->factorization()->pivots() && model_->numberPrimalInfeasibilities()) tolerance = CoinMax(tolerance, 1.0e-15 * model_->infeasibilityCost()); tolerance *= tolerance; // as we are using squares int iPass; // Setup two passes int start[4]; start[1] = number; start[2] = 0; double dstart = static_cast (number) * model_->randomNumberGenerator()->randomDouble(); start[0] = static_cast (dstart); start[3] = start[0]; //double largestWeight=0.0; //double smallestWeight=1.0e100; for (iPass = 0; iPass < 2; iPass++) { int end = start[2*iPass+1]; if (switchType < 5) { for (i = start[2*iPass]; i < end; i++) { iSequence = index[i]; double value = infeas[iSequence]; double weight = weights_[iSequence]; if (value > tolerance) { //weight=1.0; if (value > bestDj * weight) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value / weight; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } numberWanted--; } if (!numberWanted) break; } } else { // Dantzig for (i = start[2*iPass]; i < end; i++) { iSequence = index[i]; double value = infeas[iSequence]; if (value > tolerance) { if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } numberWanted--; } if (!numberWanted) break; } } if (!numberWanted) break; } if (sequenceOut >= 0) { infeas[sequenceOut] = saveOutInfeasibility; } /*if (model_->numberIterations()%100==0) printf("%d best %g\n",bestSequence,bestDj);*/ #ifndef NDEBUG if (bestSequence >= 0) { if (model_->getInternalStatus(bestSequence) == AbcSimplex::atLowerBound) assert(model_->reducedCost(bestSequence) < 0.0); if (model_->getInternalStatus(bestSequence) == AbcSimplex::atUpperBound) { assert(model_->reducedCost(bestSequence) > 0.0); } } #endif #if 1 if (model_->logLevel()==127) { double * reducedCost=model_->djRegion(); for (int i=0;i1.0e-13 ? infeas[i]: 0.0,reducedCost[i]); for (int i=numberRows;i1.0e-13 ? infeas[i]: 0.0,reducedCost[i]); } #endif #if SOME_DEBUG_1 if (switchType<4) { // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getInternalStatus(iCheck) != AbcSimplex::basic && model_->getInternalStatus(iCheck) != AbcSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates); } } #endif #if 0 for (int iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getInternalStatus(iCheck) != AbcSimplex::basic && model_->getInternalStatus(iCheck) != AbcSimplex::isFixed) assert (fabs(model_->costRegion()[iCheck])<1.0e9); } #endif return bestSequence; } /* Does steepest work type - 0 - just djs 1 - just steepest 2 - both using scaleFactor 3 - both using extra array */ int AbcPrimalColumnSteepest::doSteepestWork(CoinPartitionedVector * updates, CoinPartitionedVector * spareRow2, CoinPartitionedVector * spareColumn1, int type) { int pivotRow = model_->pivotRow(); if (type==1) { pivotRow=pivotSequence_; if (pivotRow<0) type=-1; } else if (pivotSequence_<0) { assert (model_->sequenceIn()==model_->sequenceOut()); type=0; } // see if reference int sequenceIn = pivotRow>=0 ? model_->sequenceIn() : -1; // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; double referenceIn; if (mode_ != 1) { if(sequenceIn>=0&&reference(sequenceIn)) referenceIn = 1.0; else referenceIn = 0.0; } else { referenceIn = -1.0; } double * infeasibilities=infeasible_->denseVector(); if (sequenceIn>=0) infeasibilities[sequenceIn]=0.0; double * array=updates->denseVector(); double scaleFactor; double devex=devex_; if (type==0) { // just djs - to keep clean swap scaleFactor=1.0; CoinPartitionedVector * temp = updates; updates=spareRow2; spareRow2=temp; assert (!alternateWeights_->getNumElements()); devex=0.0; } else if (type==1) { // just steepest updates->clear(); scaleFactor=COIN_DBL_MAX; // might as well set dj to 1 double dj = -1.0; assert (pivotRow>=0); spareRow2->createUnpacked(1, &pivotRow, &dj); } else if (type==2) { // using scaleFactor - swap assert (pivotRow>=0); scaleFactor=-array[pivotRow]; array[pivotRow]=-1.0; CoinPartitionedVector * temp = updates; updates=spareRow2; spareRow2=temp; } else if (type==3) { // need two arrays scaleFactor=0.0; // might as well set dj to 1 double dj = -1.0; assert (pivotRow>=0); spareRow2->createUnpacked(1, &pivotRow, &dj); } if (type>=0) { // parallelize this if (type==0) { model_->factorization()->updateColumnTranspose(*spareRow2); } else if (type<3) { cilk_spawn model_->factorization()->updateColumnTransposeCpu(*spareRow2,0); model_->factorization()->updateColumnTransposeCpu(*alternateWeights_,1); cilk_sync; } else { cilk_spawn model_->factorization()->updateColumnTransposeCpu(*updates,0); cilk_spawn model_->factorization()->updateColumnTransposeCpu(*spareRow2,1); model_->factorization()->updateColumnTransposeCpu(*alternateWeights_,2); cilk_sync; } model_->abcMatrix()->primalColumnDouble(*spareRow2, *updates, *alternateWeights_, *spareColumn1, *infeasible_,referenceIn,devex, reference_,weights_,scaleFactor); } pivotSequence_=-1; // later do pricing here // later move pricing into abcmatrix // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; alternateWeights_->clear(); updates->clear(); spareRow2->clear(); return 0; } // Just update djs void AbcPrimalColumnSteepest::justDjs(CoinIndexedVector * updates, CoinIndexedVector * spareColumn1) { int iSection, j; int number = 0; double multiplier; int * index; double * updateBy; double * reducedCost; double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); double * infeas = infeasible_->denseVector(); //updates->scanAndPack(); model_->factorization()->updateColumnTranspose(*updates); // put row of tableau in rowArray and columnArray model_->abcMatrix()->transposeTimes(*updates, *spareColumn1); // normal reducedCost = model_->djRegion(); for (iSection = 0; iSection < 2; iSection++) { int addSequence; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER double slack_multiplier; #endif if (!iSection) { number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); addSequence = 0; multiplier=-1; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = CLP_PRIMAL_SLACK_MULTIPLIER; #endif } else { number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); addSequence = model_->maximumAbcNumberRows(); multiplier=1; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = 1.0; #endif } for (j = 0; j < number; j++) { int iSequence = index[j]; double tableauValue=updateBy[iSequence]; updateBy[iSequence] = 0.0; iSequence += addSequence; double value = reducedCost[iSequence]; value -= multiplier*tableauValue; reducedCost[iSequence] = value; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: infeasible_->zero(iSequence); case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence , value * value); } else { infeasible_->zero(iSequence); } break; case AbcSimplex::atUpperBound: if (value > tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } break; case AbcSimplex::atLowerBound: if (value < -tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } } } } updates->setNumElements(0); spareColumn1->setNumElements(0); if (pivotRow >= 0) { // make sure infeasibility on incoming is 0.0 int sequenceIn = model_->sequenceIn(); infeasible_->zero(sequenceIn); } } // Update djs, weights for Devex void AbcPrimalColumnSteepest::djsAndDevex(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1) { int j; int number = 0; int * index; double * updateBy; double * reducedCost; double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; // for weights update we use pivotSequence // unset in case sub flip assert (pivotSequence_ >= 0); assert (model_->pivotVariable()[pivotSequence_] == model_->sequenceIn()); double scaleFactor = 1.0 / updates->denseVector()[pivotSequence_]; // as formula is with 1.0 pivotSequence_ = -1; double * infeas = infeasible_->denseVector(); //updates->scanAndPack(); model_->factorization()->updateColumnTranspose(*updates); // and we can see if reference //double referenceIn = 0.0; int sequenceIn = model_->sequenceIn(); //if (mode_ != 1 && reference(sequenceIn)) // referenceIn = 1.0; // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; // put row of tableau in rowArray and columnArray model_->abcMatrix()->transposeTimes(*updates, *spareColumn1); // update weights double * weight; // rows reducedCost = model_->djRegion(); number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_; // Devex for (j = 0; j < number; j++) { double thisWeight; double pivot; double value3; int iSequence = index[j]; double value = reducedCost[iSequence]; double value2 = updateBy[iSequence]; updateBy[iSequence] = 0.0; value -= -value2; reducedCost[iSequence] = value; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: infeasible_->zero(iSequence); case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence , value * value); } else { infeasible_->zero(iSequence); } break; case AbcSimplex::atUpperBound: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (value > tolerance) { // store square in list #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*CLP_PRIMAL_SLACK_MULTIPLIER; #else value *= value; #endif if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence , value); } else { infeasible_->zero(iSequence); } break; case AbcSimplex::atLowerBound: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (value < -tolerance) { // store square in list #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*CLP_PRIMAL_SLACK_MULTIPLIER; #else value *= value; #endif if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence , value); } else { infeasible_->zero(iSequence); } } } // columns int addSequence = model_->maximumAbcNumberRows(); scaleFactor = -scaleFactor; number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); // Devex for (j = 0; j < number; j++) { double thisWeight; double pivot; double value3; int iSequence = index[j]; double value2=updateBy[iSequence]; updateBy[iSequence] = 0.0; iSequence += addSequence; double value = reducedCost[iSequence]; value -= value2; reducedCost[iSequence] = value; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: infeasible_->zero(iSequence); case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } break; case AbcSimplex::atUpperBound: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (value > tolerance) { // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } break; case AbcSimplex::atLowerBound: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (value < -tolerance) { // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } } } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; // make sure infeasibility on incoming is 0.0 infeasible_->zero(sequenceIn); spareRow2->setNumElements(0); //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getInternalStatus(iCheck) != AbcSimplex::basic && !model_->getInternalStatus(iCheck) != AbcSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } // Update djs, weights for Devex void AbcPrimalColumnSteepest::djsAndDevex2(CoinIndexedVector * updates, CoinIndexedVector * spareColumn1) { int iSection, j; int number = 0; double multiplier; int * index; double * updateBy; double * reducedCost; // dj could be very small (or even zero - take care) double dj = model_->dualIn(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); double * infeas = infeasible_->denseVector(); //updates->scanAndPack(); model_->factorization()->updateColumnTranspose(*updates); // put row of tableau in rowArray and columnArray model_->abcMatrix()->transposeTimes(*updates, *spareColumn1); // normal reducedCost = model_->djRegion(); for (iSection = 0; iSection < 2; iSection++) { int addSequence; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER double slack_multiplier; #endif if (!iSection) { number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); addSequence = 0; multiplier=-1; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = CLP_PRIMAL_SLACK_MULTIPLIER; #endif } else { number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); addSequence = model_->maximumAbcNumberRows(); multiplier=1; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = 1.0; #endif } for (j = 0; j < number; j++) { int iSequence = index[j]; double tableauValue=updateBy[iSequence]; updateBy[iSequence] = 0.0; iSequence += addSequence; double value = reducedCost[iSequence]; value -= multiplier*tableauValue; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: infeasible_->zero(iSequence); case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: reducedCost[iSequence] = value; if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence , value * value); } else { infeasible_->zero(iSequence ); } break; case AbcSimplex::atUpperBound: reducedCost[iSequence] = value; if (value > tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } break; case AbcSimplex::atLowerBound: reducedCost[iSequence] = value; if (value < -tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } } } } // They are empty updates->setNumElements(0); spareColumn1->setNumElements(0); // make sure infeasibility on incoming is 0.0 int sequenceIn = model_->sequenceIn(); infeasible_->zero(sequenceIn); // for weights update we use pivotSequence if (pivotSequence_ >= 0) { pivotRow = pivotSequence_; // unset in case sub flip pivotSequence_ = -1; // make sure infeasibility on incoming is 0.0 const int * pivotVariable = model_->pivotVariable(); sequenceIn = pivotVariable[pivotRow]; infeasible_->zero(sequenceIn); // and we can see if reference //double referenceIn = 0.0; //if (mode_ != 1 && reference(sequenceIn)) // referenceIn = 1.0; // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; // update weights updates->setNumElements(0); spareColumn1->setNumElements(0); // might as well set dj to 1 dj = 1.0; updates->insert(pivotRow, -dj); model_->factorization()->updateColumnTranspose(*updates); // put row of tableau in rowArray and columnArray model_->abcMatrix()->transposeTimes(*updates, *spareColumn1); double * weight; int numberColumns = model_->numberColumns(); // rows number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_; assert (devex_ > 0.0); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = - updateBy[iSequence]; updateBy[iSequence] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence + numberColumns)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } // columns number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); int addSequence = model_->maximumAbcNumberRows(); for (j = 0; j < number; j++) { int iSequence = index[j]; double pivot=updateBy[iSequence]; updateBy[iSequence] = 0.0; iSequence += addSequence; double thisWeight = weight[iSequence]; // row has -1 double value = pivot * pivot * devex_; if (reference(iSequence)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getInternalStatus(iCheck) != AbcSimplex::basic && !model_->getInternalStatus(iCheck) != AbcSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } } // Update weights for Devex void AbcPrimalColumnSteepest::justDevex(CoinIndexedVector * updates, CoinIndexedVector * spareColumn1) { int j; int number = 0; int * index; double * updateBy; // dj could be very small (or even zero - take care) double dj = model_->dualIn(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); // for weights update we use pivotSequence pivotRow = pivotSequence_; assert (pivotRow >= 0); // make sure infeasibility on incoming is 0.0 const int * pivotVariable = model_->pivotVariable(); int sequenceIn = pivotVariable[pivotRow]; infeasible_->zero(sequenceIn); // and we can see if reference //double referenceIn = 0.0; //if (mode_ != 1 && reference(sequenceIn)) // referenceIn = 1.0; // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; assert (!updates->getNumElements()); assert (!spareColumn1->getNumElements()); // unset in case sub flip pivotSequence_ = -1; // might as well set dj to 1 dj = -1.0; updates->createUnpacked(1, &pivotRow, &dj); model_->factorization()->updateColumnTranspose(*updates); // put row of tableau in rowArray and columnArray model_->abcMatrix()->transposeTimes(*updates, *spareColumn1); double * weight; // rows number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_; // Devex assert (devex_ > 0.0); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = - updateBy[iSequence]; updateBy[iSequence] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } // columns int addSequence = model_->maximumAbcNumberRows(); number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); // Devex for (j = 0; j < number; j++) { int iSequence = index[j]; double pivot=updateBy[iSequence]; updateBy[iSequence] = 0.0; iSequence += addSequence; double thisWeight = weight[iSequence]; // row has -1 double value = pivot * pivot * devex_; if (reference(iSequence)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getInternalStatus(iCheck) != AbcSimplex::basic && !model_->getInternalStatus(iCheck) != AbcSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } // Called when maximum pivots changes void AbcPrimalColumnSteepest::maximumPivotsChanged() { if (alternateWeights_ && alternateWeights_->capacity() != model_->numberRows() + model_->factorization()->maximumPivots()) { delete alternateWeights_; alternateWeights_ = new CoinIndexedVector(); // enough space so can use it for factorization #ifndef ABC_USE_COIN_FACTORIZATION // enough for ordered alternateWeights_->reserve(2*model_->numberRows() + model_->factorization()->maximumPivots()); #else int n=(2*model_->numberRows()+ model_->factorization()->maximumPivots()+7)&~3; alternateWeights_->reserve(n); // zero CoinZeroN(alternateWeights_->getIndices(), alternateWeights_->capacity()); #endif } } /* 1) before factorization 2) after factorization 3) just redo infeasibilities 4) restore weights 5) at end of values pass (so need initialization) */ void AbcPrimalColumnSteepest::saveWeights(AbcSimplex * model, int mode) { model_ = model; if (mode_ == 4 || mode_ == 5) { if (mode == 1 && !weights_) numberSwitched_ = 0; // Reset } // alternateWeights_ is defined as indexed but is treated oddly // at times int numberRows = model_->numberRows(); int numberColumns = model_->numberColumns(); int maximumRows=model_->maximumAbcNumberRows(); const int * pivotVariable = model_->pivotVariable(); bool doInfeasibilities = true; if (mode == 1) { if(weights_) { // Check if size has changed if (infeasible_->capacity() == numberRows + numberColumns && alternateWeights_->capacity() == 2*numberRows + model_->factorization()->maximumPivots()) { //alternateWeights_->clear(); if (pivotSequence_ >= 0 && pivotSequence_ < numberRows) { // save pivot order CoinMemcpyN(pivotVariable, numberRows, alternateWeights_->getIndices()); // change from pivot row number to sequence number pivotSequence_ = pivotVariable[pivotSequence_]; } else { pivotSequence_ = -1; } state_ = 1; } else { // size has changed - clear everything delete [] weights_; weights_ = NULL; delete infeasible_; infeasible_ = NULL; delete alternateWeights_; alternateWeights_ = NULL; delete [] savedWeights_; savedWeights_ = NULL; delete [] reference_; reference_ = NULL; state_ = -1; pivotSequence_ = -1; } } } else if (mode == 2 || mode == 4 || mode == 5) { // restore if (!weights_ || state_ == -1 || mode == 5) { // Partial is only allowed with certain types of matrix if ((mode_ != 4 && mode_ != 5) || numberSwitched_ ) { // initialize weights delete [] weights_; delete alternateWeights_; weights_ = new double[numberRows+numberColumns]; alternateWeights_ = new CoinIndexedVector(); // enough space so can use it for factorization #ifndef ABC_USE_COIN_FACTORIZATION alternateWeights_->reserve(2*numberRows + model_->factorization()->maximumPivots()); #else int n=(2*model_->numberRows()+ model_->factorization()->maximumPivots()+7)&~3; alternateWeights_->reserve(n); // zero CoinZeroN(alternateWeights_->getIndices(), alternateWeights_->capacity()); #endif initializeWeights(); // create saved weights delete [] savedWeights_; savedWeights_ = CoinCopyOfArray(weights_, numberRows + numberColumns); // just do initialization mode = 3; } else { // Partial pricing // use region as somewhere to save non-fixed slacks // set up infeasibilities if (!infeasible_) { infeasible_ = new CoinIndexedVector(); infeasible_->reserve(numberColumns + numberRows); } infeasible_->clear(); int number = model_->numberRows(); int iSequence; int numberLook = 0; int * which = infeasible_->getIndices(); for (iSequence = 0; iSequence < number; iSequence++) { AbcSimplex::Status status = model_->getInternalStatus(iSequence); if (status != AbcSimplex::isFixed) which[numberLook++] = iSequence; } infeasible_->setNumElements(numberLook); doInfeasibilities = false; } savedPivotSequence_ = -2; savedSequenceOut_ = -2; } else { if (mode != 4) { // save CoinMemcpyN(weights_, (numberRows + numberColumns), savedWeights_); savedPivotSequence_ = pivotSequence_; savedSequenceOut_ = model_->sequenceOut(); } else { // restore CoinMemcpyN(savedWeights_, (numberRows + numberColumns), weights_); // was - but I think should not be //pivotSequence_= savedPivotSequence_; //model_->setSequenceOut(savedSequenceOut_); pivotSequence_ = -1; model_->setSequenceOut(-1); // indices are wrong so clear by hand //alternateWeights_->clear(); CoinZeroN(alternateWeights_->denseVector(), alternateWeights_->capacity()); alternateWeights_->setNumElements(0); } } state_ = 0; // set up infeasibilities if (!infeasible_) { infeasible_ = new CoinIndexedVector(); infeasible_->reserve(numberColumns + numberRows); } } if (mode >= 2 && mode != 5) { if (mode != 3) { if (pivotSequence_ >= 0) { // restore pivot row int iRow; // permute alternateWeights int iVector=model_->getAvailableArray(); double * temp = model_->usefulArray(iVector)->denseVector();; double * work = alternateWeights_->denseVector(); int * savePivotOrder = model_->usefulArray(iVector)->getIndices(); int * oldPivotOrder = alternateWeights_->getIndices(); for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = oldPivotOrder[iRow]; temp[iPivot] = work[iRow]; savePivotOrder[iRow] = iPivot; } int number = 0; int found = -1; int * which = oldPivotOrder; // find pivot row and re-create alternateWeights for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; if (iPivot == pivotSequence_) found = iRow; work[iRow] = temp[iPivot]; if (work[iRow]) which[number++] = iRow; } alternateWeights_->setNumElements(number); #ifdef CLP_DEBUG // Can happen but I should clean up assert(found >= 0); #endif pivotSequence_ = found; for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = savePivotOrder[iRow]; temp[iPivot] = 0.0; } model_->setAvailableArray(iVector); } else { // Just clean up if (alternateWeights_) alternateWeights_->clear(); } } // Save size of factorization if (!model->factorization()->pivots()) sizeFactorization_ = model_->factorization()->numberElements(); if(!doInfeasibilities) return; // don't disturb infeasibilities infeasible_->clear(); double tolerance = model_->currentDualTolerance(); int number = model_->numberRows() + model_->numberColumns(); int iSequence; double * reducedCost = model_->djRegion(); #ifndef CLP_PRIMAL_SLACK_MULTIPLIER for (iSequence = 0; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list infeasible_->quickAdd(iSequence, value * value); } break; case AbcSimplex::atUpperBound: if (value > tolerance) { infeasible_->quickAdd(iSequence, value * value); } break; case AbcSimplex::atLowerBound: if (value < -tolerance) { infeasible_->quickAdd(iSequence, value * value); } } } #else // Columns for (iSequence = maximumRows; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list infeasible_->quickAdd(iSequence, value * value); } break; case AbcSimplex::atUpperBound: if (value > tolerance) { infeasible_->quickAdd(iSequence, value * value); } break; case AbcSimplex::atLowerBound: if (value < -tolerance) { infeasible_->quickAdd(iSequence, value * value); } } } // Rows for (iSequence=0 ; iSequence < numberRows; iSequence++) { double value = reducedCost[iSequence]; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list infeasible_->quickAdd(iSequence, value * value); } break; case AbcSimplex::atUpperBound: if (value > tolerance) { infeasible_->quickAdd(iSequence, value * value * CLP_PRIMAL_SLACK_MULTIPLIER); } break; case AbcSimplex::atLowerBound: if (value < -tolerance) { infeasible_->quickAdd(iSequence, value * value * CLP_PRIMAL_SLACK_MULTIPLIER); } } } #endif } } // Gets rid of last update void AbcPrimalColumnSteepest::unrollWeights() { if ((mode_ == 4 || mode_ == 5) && !numberSwitched_) return; double * saved = alternateWeights_->denseVector(); int number = alternateWeights_->getNumElements(); int * which = alternateWeights_->getIndices(); int i; for (i = 0; i < number; i++) { int iRow = which[i]; weights_[iRow] = saved[iRow]; saved[iRow] = 0.0; } alternateWeights_->setNumElements(0); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- AbcPrimalColumnPivot * AbcPrimalColumnSteepest::clone(bool CopyData) const { if (CopyData) { return new AbcPrimalColumnSteepest(*this); } else { return new AbcPrimalColumnSteepest(); } } void AbcPrimalColumnSteepest::updateWeights(CoinIndexedVector * input) { // Local copy of mode so can decide what to do int switchType = mode_; if (mode_ == 4 && numberSwitched_) switchType = 3; else if (mode_ == 4 || mode_ == 5) return; int number = input->getNumElements(); int * which = input->getIndices(); double * work = input->denseVector(); int newNumber = 0; int * newWhich = alternateWeights_->getIndices(); double * newWork = alternateWeights_->denseVector(); int i; int sequenceIn = model_->sequenceIn(); int sequenceOut = model_->sequenceOut(); const int * pivotVariable = model_->pivotVariable(); int pivotRow = model_->pivotRow(); pivotSequence_ = pivotRow; devex_ = 0.0; if (pivotRow >= 0) { if (switchType == 1) { for (i = 0; i < number; i++) { int iRow = which[i]; devex_ += work[iRow] * work[iRow]; newWork[iRow] = -2.0 * work[iRow]; } newWork[pivotRow] = -2.0 * CoinMax(devex_, 0.0); devex_ += ADD_ONE; weights_[sequenceOut] = 1.0 + ADD_ONE; CoinMemcpyN(which, number, newWhich); alternateWeights_->setNumElements(number); } else { if ((mode_ != 4 && mode_ != 5) || numberSwitched_ > 1) { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) { devex_ += work[iRow] * work[iRow]; newWork[iRow] = -2.0 * work[iRow]; newWhich[newNumber++] = iRow; } } if (!newWork[pivotRow] && devex_ > 0.0) newWhich[newNumber++] = pivotRow; // add if not already in newWork[pivotRow] = -2.0 * CoinMax(devex_, 0.0); } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) devex_ += work[iRow] * work[iRow]; } } if (reference(sequenceIn)) { devex_ += 1.0; } else { } if (reference(sequenceOut)) { weights_[sequenceOut] = 1.0 + 1.0; } else { weights_[sequenceOut] = 1.0; } alternateWeights_->setNumElements(newNumber); } } else { if (switchType == 1) { for (i = 0; i < number; i++) { int iRow = which[i]; devex_ += work[iRow] * work[iRow]; } devex_ += ADD_ONE; } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) { devex_ += work[iRow] * work[iRow]; } } if (reference(sequenceIn)) devex_ += 1.0; } } double oldDevex = weights_[sequenceIn]; #ifdef CLP_DEBUG if ((model_->messageHandler()->logLevel() & 32)) printf("old weight %g, new %g\n", oldDevex, devex_); #endif double check = CoinMax(devex_, oldDevex) + 0.1; weights_[sequenceIn] = devex_; double testValue = 0.1; if (mode_ == 4 && numberSwitched_ == 1) testValue = 0.5; if ( fabs ( devex_ - oldDevex ) > testValue * check ) { #ifdef CLP_DEBUG if ((model_->messageHandler()->logLevel() & 48) == 16) printf("old weight %g, new %g\n", oldDevex, devex_); #endif //printf("old weight %g, new %g\n",oldDevex,devex_); testValue = 0.99; if (mode_ == 1) testValue = 1.01e1; // make unlikely to do if steepest else if (mode_ == 4 && numberSwitched_ == 1) testValue = 0.9; double difference = fabs(devex_ - oldDevex); if ( difference > testValue * check ) { // need to redo model_->messageHandler()->message(CLP_INITIALIZE_STEEP, *model_->messagesPointer()) << oldDevex << devex_ << CoinMessageEol; initializeWeights(); } } if (pivotRow >= 0) { // set outgoing weight here weights_[model_->sequenceOut()] = devex_ / (model_->alpha() * model_->alpha()); } } // Checks accuracy - just for debug void AbcPrimalColumnSteepest::checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector * rowArray1) { if ((mode_ == 4 || mode_ == 5) && !numberSwitched_) return; model_->unpack(*rowArray1, sequence); model_->factorization()->updateColumn(*rowArray1); int number = rowArray1->getNumElements(); int * which = rowArray1->getIndices(); double * work = rowArray1->denseVector(); const int * pivotVariable = model_->pivotVariable(); double devex = 0.0; int i; if (mode_ == 1) { for (i = 0; i < number; i++) { int iRow = which[i]; devex += work[iRow] * work[iRow]; work[iRow] = 0.0; } devex += ADD_ONE; } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) { devex += work[iRow] * work[iRow]; } work[iRow] = 0.0; } if (reference(sequence)) devex += 1.0; } double oldDevex = weights_[sequence]; double check = CoinMax(devex, oldDevex);; if ( fabs ( devex - oldDevex ) > relativeTolerance * check ) { COIN_DETAIL_PRINT(printf("check %d old weight %g, new %g\n", sequence, oldDevex, devex)); // update so won't print again weights_[sequence] = devex; } rowArray1->setNumElements(0); } // Initialize weights void AbcPrimalColumnSteepest::initializeWeights() { int numberRows = model_->numberRows(); int numberColumns = model_->numberColumns(); int number = numberRows + numberColumns; int iSequence; if (mode_ != 1) { // initialize to 1.0 // and set reference framework if (!reference_) { int nWords = (number + 31) >> 5; reference_ = new unsigned int[nWords]; CoinZeroN(reference_, nWords); } for (iSequence = 0; iSequence < number; iSequence++) { weights_[iSequence] = 1.0; if (model_->getInternalStatus(iSequence) == AbcSimplex::basic) { setReference(iSequence, false); } else { setReference(iSequence, true); } } } else { CoinIndexedVector * temp = new CoinIndexedVector(); #ifndef ABC_USE_COIN_FACTORIZATIONz temp->reserve(numberRows + model_->factorization()->maximumPivots()); #else #endif double * array = alternateWeights_->denseVector(); int * which = alternateWeights_->getIndices(); for (iSequence = 0; iSequence < number; iSequence++) { weights_[iSequence] = 1.0 + ADD_ONE; if (model_->getInternalStatus(iSequence) != AbcSimplex::basic && model_->getInternalStatus(iSequence) != AbcSimplex::isFixed) { model_->unpack(*alternateWeights_, iSequence); double value = ADD_ONE; model_->factorization()->updateColumn(*alternateWeights_); int number = alternateWeights_->getNumElements(); int j; for (j = 0; j < number; j++) { int iRow = which[j]; value += array[iRow] * array[iRow]; array[iRow] = 0.0; } alternateWeights_->setNumElements(0); weights_[iSequence] = value; } } delete temp; } } // Gets rid of all arrays void AbcPrimalColumnSteepest::clearArrays() { if (persistence_ == normal) { delete [] weights_; weights_ = NULL; delete infeasible_; infeasible_ = NULL; delete alternateWeights_; alternateWeights_ = NULL; delete [] savedWeights_; savedWeights_ = NULL; delete [] reference_; reference_ = NULL; } pivotSequence_ = -1; state_ = -1; savedPivotSequence_ = -1; savedSequenceOut_ = -1; devex_ = 0.0; } // Returns true if would not find any column bool AbcPrimalColumnSteepest::looksOptimal() const { if (looksOptimal_) return true; // user overrode //**** THIS MUST MATCH the action coding above double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; if(model_->numberIterations() < model_->lastBadIteration() + 200) { // we can't really trust infeasibilities if there is dual error double checkTolerance = 1.0e-8; if (!model_->factorization()->pivots()) checkTolerance = 1.0e-6; if (model_->largestDualError() > checkTolerance) tolerance *= model_->largestDualError() / checkTolerance; // But cap tolerance = CoinMin(1000.0, tolerance); } int number = model_->numberRows() + model_->numberColumns(); int iSequence; double * reducedCost = model_->djRegion(); int numberInfeasible = 0; for (iSequence = 0; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) numberInfeasible++; break; case AbcSimplex::atUpperBound: if (value > tolerance) numberInfeasible++; break; case AbcSimplex::atLowerBound: if (value < -tolerance) numberInfeasible++; } } return numberInfeasible == 0; } // Update djs doing partial pricing (dantzig) int AbcPrimalColumnSteepest::partialPricing(CoinIndexedVector * updates, int numberWanted, int numberLook) { int number = 0; int * index; double * updateBy; double * reducedCost; double saveTolerance = model_->currentDualTolerance(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; if(model_->numberIterations() < model_->lastBadIteration() + 200) { // we can't really trust infeasibilities if there is dual error double checkTolerance = 1.0e-8; if (!model_->factorization()->pivots()) checkTolerance = 1.0e-6; if (model_->largestDualError() > checkTolerance) tolerance *= model_->largestDualError() / checkTolerance; // But cap tolerance = CoinMin(1000.0, tolerance); } if (model_->factorization()->pivots() && model_->numberPrimalInfeasibilities()) tolerance = CoinMax(tolerance, 1.0e-15 * model_->infeasibilityCost()); // So partial pricing can use model_->setCurrentDualTolerance(tolerance); model_->factorization()->updateColumnTranspose(*updates); int numberColumns = model_->numberColumns(); // Rows reducedCost = model_->djRegion(); number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); int j; double * duals = model_->dualRowSolution(); for (j = 0; j < number; j++) { int iSequence = index[j]; double value = duals[iSequence]; value -= updateBy[iSequence]; updateBy[iSequence] = 0.0; duals[iSequence] = value; } //#define CLP_DEBUG #ifdef CLP_DEBUG // check duals { //work space CoinIndexedVector arrayVector; arrayVector.reserve(numberRows + 1000); CoinIndexedVector workSpace; workSpace.reserve(numberRows + 1000); int iRow; double * array = arrayVector.denseVector(); int * index = arrayVector.getIndices(); int number = 0; int * pivotVariable = model_->pivotVariable(); double * cost = model_->costRegion(); for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; double value = cost[iPivot]; if (value) { array[iRow] = value; index[number++] = iRow; } } arrayVector.setNumElements(number); // Btran basic costs model_->factorization()->updateColumnTranspose(&workSpace, &arrayVector); // now look at dual solution for (iRow = 0; iRow < numberRows; iRow++) { // slack double value = array[iRow]; if (fabs(duals[iRow] - value) > 1.0e-3) printf("bad row %d old dual %g new %g\n", iRow, duals[iRow], value); //duals[iRow]=value; } } #endif #undef CLP_DEBUG double bestDj = tolerance; int bestSequence = -1; const double * cost = model_->costRegion(); model_->abcMatrix()->setOriginalWanted(numberWanted); model_->abcMatrix()->setCurrentWanted(numberWanted); int iPassR = 0, iPassC = 0; // Setup two passes // This biases towards picking row variables // This probably should be fixed int startR[4]; const int * which = infeasible_->getIndices(); int nSlacks = infeasible_->getNumElements(); startR[1] = nSlacks; startR[2] = 0; double randomR = model_->randomNumberGenerator()->randomDouble(); double dstart = static_cast (nSlacks) * randomR; startR[0] = static_cast (dstart); startR[3] = startR[0]; double startC[4]; startC[1] = 1.0; startC[2] = 0; double randomC = model_->randomNumberGenerator()->randomDouble(); startC[0] = randomC; startC[3] = randomC; reducedCost = model_->djRegion(); int sequenceOut = model_->sequenceOut(); int chunk = CoinMin(1024, (numberColumns + nSlacks) / 32); #ifdef COIN_DETAIL if (model_->numberIterations() % 1000 == 0 && model_->logLevel() > 1) { printf("%d wanted, nSlacks %d, chunk %d\n", numberWanted, nSlacks, chunk); int i; for (i = 0; i < 4; i++) printf("start R %d C %g ", startR[i], startC[i]); printf("\n"); } #endif chunk = CoinMax(chunk, 256); bool finishedR = false, finishedC = false; bool doingR = randomR > randomC; //doingR=false; int saveNumberWanted = numberWanted; while (!finishedR || !finishedC) { if (finishedR) doingR = false; if (doingR) { int saveSequence = bestSequence; int start = startR[iPassR]; int end = CoinMin(startR[iPassR+1], start + chunk / 2); int jSequence; for (jSequence = start; jSequence < end; jSequence++) { int iSequence = which[jSequence]; if (iSequence != sequenceOut) { double value; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: value = fabs(cost[iSequence] - duals[iSequence]); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case AbcSimplex::atUpperBound: value = cost[iSequence] - duals[iSequence]; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case AbcSimplex::atLowerBound: value = -(cost[iSequence] - duals[iSequence]); if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (!numberWanted) break; } numberLook -= (end - start); if (numberLook < 0 && (10 * (saveNumberWanted - numberWanted) > saveNumberWanted)) numberWanted = 0; // give up if (saveSequence != bestSequence) { // dj reducedCost[bestSequence] = cost[bestSequence] - duals[bestSequence]; bestDj = fabs(reducedCost[bestSequence]); model_->abcMatrix()->setSavedBestSequence(bestSequence); model_->abcMatrix()->setSavedBestDj(reducedCost[bestSequence]); } model_->abcMatrix()->setCurrentWanted(numberWanted); if (!numberWanted) break; doingR = false; // update start startR[iPassR] = jSequence; if (jSequence >= startR[iPassR+1]) { if (iPassR) finishedR = true; else iPassR = 2; } } if (finishedC) doingR = true; if (!doingR) { // temp int saveSequence = bestSequence; // Columns double start = startC[iPassC]; // If we put this idea back then each function needs to update endFraction ** #if 0 double dchunk = (static_cast chunk) / (static_cast numberColumns); double end = CoinMin(startC[iPassC+1], start + dchunk);; #else double end = startC[iPassC+1]; // force end #endif model_->abcMatrix()->partialPricing(start, end, bestSequence, numberWanted); numberWanted = model_->abcMatrix()->currentWanted(); numberLook -= static_cast ((end - start) * numberColumns); if (numberLook < 0 && (10 * (saveNumberWanted - numberWanted) > saveNumberWanted)) numberWanted = 0; // give up if (bestSequence!=saveSequence) { // dj bestDj = fabs(reducedCost[bestSequence]); } if (!numberWanted) break; doingR = true; // update start startC[iPassC] = end; if (end >= startC[iPassC+1] - 1.0e-8) { if (iPassC) finishedC = true; else iPassC = 2; } } } updates->setNumElements(0); // Restore tolerance model_->setCurrentDualTolerance(saveTolerance); #ifndef NDEBUG if (bestSequence >= 0) { if (model_->getInternalStatus(bestSequence) == AbcSimplex::atLowerBound) assert(model_->reducedCost(bestSequence) < 0.0); if (model_->getInternalStatus(bestSequence) == AbcSimplex::atUpperBound) assert(model_->reducedCost(bestSequence) > 0.0); } #endif return bestSequence; } CoinMP-1.8.3/Clp/src/CoinAbcCommon.hpp0000644000175000017500000002370012442012732016000 0ustar renerene/* $Id: CoinAbcCommon.hpp 2074 2014-12-10 09:43:54Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinAbcCommon_H #define CoinAbcCommon_H #ifndef COIN_FAC_NEW #define COIN_FAC_NEW #endif #include "CoinPragma.hpp" #include "CoinUtilsConfig.h" #include #include #include #include #include #include "AbcCommon.hpp" #include "CoinHelperFunctions.hpp" //#include "config.h" typedef double CoinSimplexDouble; typedef int CoinSimplexInt; typedef unsigned int CoinSimplexUnsignedInt; //#define MOVE_REPLACE_PART1A #if defined(_MSC_VER) #define ABC_INLINE __forceinline #elif defined(__GNUC__) #define ABC_INLINE __attribute__((always_inline)) #else #define ABC_INLINE #endif #ifndef ABC_PARALLEL #ifdef HAS_CILK #define ABC_PARALLEL 2 #else #define ABC_PARALLEL 0 #endif #endif #if ABC_PARALLEL==2 //#define EARLY_FACTORIZE #ifndef FAKE_CILK #include //gcc4.9 main branch has not got cilk_for!!!!!!!!!!! #ifdef GCC_4_9 #undef cilk_for #define cilk_for for #endif #else #define cilk_for for #define cilk_spawn #define cilk_sync #endif #else #define cilk_for for #define cilk_spawn #define cilk_sync //#define ABC_PARALLEL 1 #endif #define SLACK_VALUE 1 #define ABC_INSTRUMENT 1 //2 #if ABC_INSTRUMENT!=2 // Below so can do deterministic B&B #define instrument_start(name,x) #define instrument_add(x) #define instrument_end() // one off #define instrument_do(name,x) // as end but multiply by factor #define instrument_end_and_adjust(x) #else void instrument_start(const char * type,int numberRowsEtc); void instrument_add(int count); void instrument_do(const char * type,double count); void instrument_end(); void instrument_end_and_adjust(double factor); #endif #ifndef __BYTE_ORDER #include #endif #if __BYTE_ORDER == __LITTLE_ENDIAN #define ABC_INTEL #endif #if COIN_BIG_DOUBLE==1 #undef USE_TEST_ZERO #undef USE_TEST_REALLY_ZERO #undef USE_TEST_ZERO_REGISTER #undef USE_TEST_LESS_TOLERANCE #undef USE_TEST_LESS_TOLERANCE_REGISTER #define CoinFabs(x) fabsl(x) #else #define CoinFabs(x) fabs(x) #endif #ifdef USE_TEST_ZERO #if __BYTE_ORDER == __LITTLE_ENDIAN #define TEST_DOUBLE_NONZERO(x) ((reinterpret_cast(&x))[1]!=0) #else #define TEST_DOUBLE_NONZERO(x) ((reinterpret_cast(&x))[0]!=0) #endif #else //always drop through #define TEST_DOUBLE_NONZERO(x) (true) #endif #define USE_TEST_INT_ZERO #ifdef USE_TEST_INT_ZERO #define TEST_INT_NONZERO(x) (x) #else //always drop through #define TEST_INT_NONZERO(x) (true) #endif #ifdef USE_TEST_REALLY_ZERO #if __BYTE_ORDER == __LITTLE_ENDIAN #define TEST_DOUBLE_REALLY_NONZERO(x) ((reinterpret_cast(&x))[1]!=0) #else #define TEST_DOUBLE_REALLY_NONZERO(x) ((reinterpret_cast(&x))[0]!=0) #endif #else #define TEST_DOUBLE_REALLY_NONZERO(x) (x) #endif #ifdef USE_TEST_ZERO_REGISTER #if __BYTE_ORDER == __LITTLE_ENDIAN #define TEST_DOUBLE_NONZERO_REGISTER(x) ((reinterpret_cast(&x))[1]!=0) #else #define TEST_DOUBLE_NONZERO_REGISTER(x) ((reinterpret_cast(&x))[0]!=0) #endif #else //always drop through #define TEST_DOUBLE_NONZERO_REGISTER(x) (true) #endif #define USE_FIXED_ZERO_TOLERANCE #ifdef USE_FIXED_ZERO_TOLERANCE // 3d400000... 0.5**43 approx 1.13687e-13 #ifdef USE_TEST_LESS_TOLERANCE #if __BYTE_ORDER == __LITTLE_ENDIAN #define TEST_LESS_THAN_TOLERANCE(x) ((reinterpret_cast(&x))[1]&0x7ff00000<0x3d400000) #define TEST_LESS_THAN_UPDATE_TOLERANCE(x) ((reinterpret_cast(&x))[1]&0x7ff00000<0x3d400000) #else #define TEST_LESS_THAN_TOLERANCE(x) ((reinterpret_cast(&x))[0]&0x7ff00000<0x3d400000) #define TEST_LESS_THAN_UPDATE_TOLERANCE(x) ((reinterpret_cast(&x))[0]&0x7ff00000<0x3d400000) #endif #else #define TEST_LESS_THAN_TOLERANCE(x) (fabs(x)(&x))[1]&0x7ff00000<0x3d400000) #else #define TEST_LESS_THAN_TOLERANCE_REGISTER(x) ((reinterpret_cast(&x))[0]&0x7ff00000<0x3d400000) #endif #else #define TEST_LESS_THAN_TOLERANCE_REGISTER(x) (fabs(x)(&x))[1]&0x7ff00000) #else #define ABC_EXPONENT(x) ((reinterpret_cast(&x))[0]&0x7ff00000) #endif #define TEST_EXPONENT_LESS_THAN_TOLERANCE(x) (x<0x3d400000) #define TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(x) (x<0x3d400000) #define TEST_EXPONENT_NON_ZERO(x) (x) #else typedef long double CoinExponent; #define ABC_EXPONENT(x) (x) #define TEST_EXPONENT_LESS_THAN_TOLERANCE(x) (fabs(x) inline void CoinAbcMemset0(register T* to, const int size) { #ifndef NDEBUG // Some debug so check if (size < 0) throw CoinError("trying to fill negative number of entries", "CoinAbcMemset0", ""); #endif std::memset(to,0,size*sizeof(T)); } template inline void CoinAbcMemcpy(register T* to, register const T* from, const int size ) { #ifndef NDEBUG // Some debug so check if (size < 0) throw CoinError("trying to copy negative number of entries", "CoinAbcMemcpy", ""); #endif std::memcpy(to,from,size*sizeof(T)); } class ClpSimplex; class AbcSimplex; class AbcTolerancesEtc { public: ///@name Constructors and destructors //@{ /// Default Constructor AbcTolerancesEtc(); /// Useful Constructors AbcTolerancesEtc(const ClpSimplex * model); AbcTolerancesEtc(const AbcSimplex * model); /// Copy constructor AbcTolerancesEtc(const AbcTolerancesEtc &); /// Assignment operator AbcTolerancesEtc & operator=(const AbcTolerancesEtc& rhs); /// Destructor ~AbcTolerancesEtc (); //@} //--------------------------------------------------------------------------- public: ///@name Public member data //@{ /// Zero tolerance double zeroTolerance_; /// Primal tolerance needed to make dual feasible (= incomingInfeasibility this is always possible altough you may end up with an all slack basis. Defaults are 1.0,10.0 */ double incomingInfeasibility_; double allowedInfeasibility_; /// Iteration when we entered dual or primal int baseIteration_; /// How many iterative refinements to do int numberRefinements_; /** Now for some reliability aids This forces re-factorization early */ int forceFactorization_; /** Perturbation: -50 to +50 - perturb by this power of ten (-6 sounds good) 100 - auto perturb if takes too long (1.0e-6 largest nonzero) 101 - we are perturbed 102 - don't try perturbing again default is 100 */ int perturbation_; /// If may skip final factorize then allow up to this pivots (default 20) int dontFactorizePivots_; /// For factorization /// Maximum number of pivots before factorization int maximumPivots_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpMessage.cpp0000644000175000017500000002253012124336572015357 0ustar renerene/* $Id: ClpMessage.cpp 1926 2013-03-26 15:23:38Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpMessage.hpp" /// Structure for use by ClpMessage.cpp typedef struct { CLP_Message internalNumber; int externalNumber; // or continuation char detail; const char * message; } Clp_message; static Clp_message clp_us_english[] = { {CLP_SIMPLEX_FINISHED, 0, 1, "Optimal - objective value %g"}, {CLP_SIMPLEX_INFEASIBLE, 1, 1, "Primal infeasible - objective value %g"}, {CLP_SIMPLEX_UNBOUNDED, 2, 1, "Dual infeasible - objective value %g"}, {CLP_SIMPLEX_STOPPED, 3, 1, "Stopped - objective value %g"}, {CLP_SIMPLEX_ERROR, 4, 1, "Stopped due to errors - objective value %g"}, {CLP_SIMPLEX_INTERRUPT, 5, 1, "Stopped by event handler - objective value %g"}, {CLP_SIMPLEX_STATUS, 6, 1, "%d Obj %g%? Primal inf %g (%d)%? Dual inf %g (%d)%? w.o. free dual inf (%d)"}, {CLP_DUAL_BOUNDS, 25, 3, "Looking optimal checking bounds with %g"}, #if ABC_NORMAL_DEBUG>1 {CLP_SIMPLEX_ACCURACY, 60, 1, "Primal error %g, dual error %g"}, #else {CLP_SIMPLEX_ACCURACY, 60, 3, "Primal error %g, dual error %g"}, #endif {CLP_SIMPLEX_BADFACTOR, 7, 2, "Singular factorization of basis - status %d"}, {CLP_SIMPLEX_BOUNDTIGHTEN, 8, 3, "Bounds were tightened %d times"}, {CLP_SIMPLEX_INFEASIBILITIES, 9, 1, "%d infeasibilities"}, {CLP_SIMPLEX_FLAG, 10, 3, "Flagging variable %c%d"}, {CLP_SIMPLEX_GIVINGUP, 11, 2, "Stopping as close enough"}, {CLP_DUAL_CHECKB, 12, 2, "New dual bound of %g"}, {CLP_DUAL_ORIGINAL, 13, 3, "Going back to original objective"}, {CLP_SIMPLEX_PERTURB, 14, 1, "Perturbing problem by %g %% of %g - largest nonzero change %g (%% %g) - largest zero change %g"}, {CLP_PRIMAL_ORIGINAL, 15, 2, "Going back to original tolerance"}, {CLP_PRIMAL_WEIGHT, 16, 2, "New infeasibility weight of %g"}, {CLP_PRIMAL_OPTIMAL, 17, 2, "Looking optimal with tolerance of %g"}, {CLP_SINGULARITIES, 18, 2, "%d total structurals rejected in initial factorization"}, {CLP_MODIFIEDBOUNDS, 19, 1, "%d variables/rows fixed as scaled bounds too close"}, {CLP_RIMSTATISTICS1, 20, 2, "Absolute values of scaled objective range from %g to %g"}, {CLP_RIMSTATISTICS2, 21, 2, "Absolute values of scaled bounds range from %g to %g, minimum gap %g"}, {CLP_RIMSTATISTICS3, 22, 2, "Absolute values of scaled rhs range from %g to %g, minimum gap %g"}, {CLP_POSSIBLELOOP, 23, 2, "Possible loop - %d matches (%x) after %d checks"}, {CLP_SMALLELEMENTS, 24, 1, "Matrix will be packed to eliminate %d small elements"}, {CLP_DUPLICATEELEMENTS, 26, 1, "Matrix will be packed to eliminate %d duplicate elements"}, {CLP_SIMPLEX_HOUSE1, 101, 32, "dirOut %d, dirIn %d, theta %g, out %g, dj %g, alpha %g"}, {CLP_SIMPLEX_HOUSE2, 102, 4, "%d %g In: %c%d Out: %c%d%? dj ratio %g distance %g%? dj %g distance %g"}, {CLP_SIMPLEX_NONLINEAR, 103, 4, "Primal nonlinear change %g (%d)"}, {CLP_SIMPLEX_FREEIN, 104, 32, "Free column in %d"}, {CLP_SIMPLEX_PIVOTROW, 105, 32, "Pivot row %d"}, {CLP_DUAL_CHECK, 106, 4, "Btran alpha %g, ftran alpha %g"}, {CLP_PRIMAL_DJ, 107, 4, "For %c%d btran dj %g, ftran dj %g"}, {CLP_PACKEDSCALE_INITIAL, 1001, 2, "Initial range of elements is %g to %g"}, {CLP_PACKEDSCALE_WHILE, 1002, 3, "Range of elements is %g to %g"}, {CLP_PACKEDSCALE_FINAL, 1003, 2, "Final range of elements is %g to %g"}, {CLP_PACKEDSCALE_FORGET, 1004, 2, "Not bothering to scale as good enough"}, {CLP_INITIALIZE_STEEP, 1005, 3, "Initializing steepest edge weights - old %g, new %g"}, {CLP_UNABLE_OPEN, 6001, 0, "Unable to open file %s for reading"}, {CLP_BAD_BOUNDS, 6002, 1, "%d bad bound pairs or bad objectives were found - first at %c%d"}, {CLP_BAD_MATRIX, 6003, 1, "Matrix has %d large values, first at column %d, row %d is %g"}, {CLP_LOOP, 6004, 1, "Can't get out of loop - stopping"}, {CLP_IMPORT_RESULT, 27, 1, "Model was imported from %s in %g seconds"}, {CLP_IMPORT_ERRORS, 3001, 1, " There were %d errors when importing model from %s"}, {CLP_EMPTY_PROBLEM, 3002, 1, "Empty problem - %d rows, %d columns and %d elements"}, {CLP_CRASH, 28, 1, "Crash put %d variables in basis, %d dual infeasibilities"}, {CLP_END_VALUES_PASS, 29, 1, "End of values pass after %d iterations"}, {CLP_QUADRATIC_BOTH, 108, 32, "%s %d (%g) and %d (%g) both basic"}, {CLP_QUADRATIC_PRIMAL_DETAILS, 109, 32, "coeff %g, %g, %g - dj %g - deriv zero at %g, sj at %g"}, {CLP_IDIOT_ITERATION, 30, 1, "%d infeas %g, obj %g - mu %g, its %d, %d interior"}, {CLP_INFEASIBLE, 3003, 1, "Analysis indicates model infeasible or unbounded"}, {CLP_MATRIX_CHANGE, 31, 2, "Matrix can not be converted into %s"}, {CLP_TIMING, 32, 1, "%s objective %.10g - %d iterations time %.2f2%?, Presolve %.2f%?, Idiot %.2f%?"}, {CLP_INTERVAL_TIMING, 33, 2, "%s took %.2f seconds (total %.2f)"}, {CLP_SPRINT, 34, 1, "Pass %d took %d iterations, objective %g, dual infeasibilities %g( %d)"}, {CLP_BARRIER_ITERATION, 35, 1, "%d Primal %g Dual %g Complementarity %g - %d fixed, rank %d"}, {CLP_BARRIER_OBJECTIVE_GAP, 36, 3, "Feasible - objective gap %g"}, {CLP_BARRIER_GONE_INFEASIBLE, 37, 2, "Infeasible"}, {CLP_BARRIER_CLOSE_TO_OPTIMAL, 38, 2, "Close to optimal after %d iterations with complementarity %g"}, {CLP_BARRIER_COMPLEMENTARITY, 39, 2, "Complementarity %g - %s"}, {CLP_BARRIER_EXIT2, 40, 1, "Exiting - using solution from iteration %d"}, {CLP_BARRIER_STOPPING, 41, 1, "Exiting on iterations"}, {CLP_BARRIER_EXIT, 42, 1, "Optimal %s"}, {CLP_BARRIER_SCALING, 43, 3, "Scaling %s by %g"}, {CLP_BARRIER_MU, 44, 3, "Changing mu from %g to %g"}, {CLP_BARRIER_INFO, 45, 3, "Detail - %s"}, {CLP_BARRIER_END, 46, 1, "At end primal/dual infeasibilities %g/%g, complementarity gap %g, objective %g"}, {CLP_BARRIER_ACCURACY, 47, 2, "Relative error in phase %d, %d passes %g => %g"}, {CLP_BARRIER_SAFE, 48, 2, "Initial safe primal value %g, objective norm %g"}, {CLP_BARRIER_NEGATIVE_GAPS, 49, 3, "%d negative gaps summing to %g"}, {CLP_BARRIER_REDUCING, 50, 2, "Reducing %s step from %g to %g"}, {CLP_BARRIER_DIAGONAL, 51, 3, "Range of diagonal values is %g to %g"}, {CLP_BARRIER_SLACKS, 52, 3, "%d slacks increased, %d decreased this iteration"}, {CLP_BARRIER_DUALINF, 53, 3, "Maximum dual infeasibility on fixed is %g"}, {CLP_BARRIER_KILLED, 54, 3, "%d variables killed this iteration"}, {CLP_BARRIER_ABS_DROPPED, 55, 2, "Absolute error on dropped rows is %g"}, {CLP_BARRIER_ABS_ERROR, 56, 2, "Primal error is %g and dual error is %g"}, {CLP_BARRIER_FEASIBLE, 57, 2, "Infeasibilities - bound %g , primal %g ,dual %g"}, {CLP_BARRIER_STEP, 58, 2, "Steps - primal %g ,dual %g , mu %g"}, {CLP_BARRIER_KKT, 6005, 0, "Quadratic barrier needs a KKT factorization"}, {CLP_RIM_SCALE, 59, 1, "Automatic rim scaling gives objective scale of %g and rhs/bounds scale of %g"}, {CLP_SLP_ITER, 58, 1, "Pass %d objective %g - drop %g, largest delta %g"}, {CLP_COMPLICATED_MODEL, 3004, 1, "Can not use addRows or addColumns on CoinModel as mixed, %d rows, %d columns"}, {CLP_BAD_STRING_VALUES, 3005, 1, "%d string elements had no values associated with them"}, {CLP_CRUNCH_STATS, 61, 2, "Crunch %d (%d) rows, %d (%d) columns and %d (%d) elements"}, {CLP_PARAMETRICS_STATS, 62, 1, "Theta %g - objective %g"}, {CLP_PARAMETRICS_STATS2, 63, 2, "Theta %g - objective %g, %s in, %s out"}, #ifndef NO_FATHOM_PRINT {CLP_FATHOM_STATUS, 63, 2, "Fathoming node %d - %d nodes (%d iterations) - current depth %d"}, {CLP_FATHOM_SOLUTION, 64, 1, "Fathoming node %d - solution of %g after %d nodes at depth %d"}, {CLP_FATHOM_FINISH, 65, 1, "Fathoming node %d (depth %d) took %d nodes (%d iterations) - maximum depth %d"}, #endif {CLP_GENERAL, 1000, 1, "%s"}, {CLP_GENERAL2, 1001, 2, "%s"}, {CLP_GENERAL_WARNING, 3006, 1, "%s"}, {CLP_DUMMY_END, 999999, 0, ""} }; static Clp_message uk_english[] = { { CLP_SIMPLEX_FINISHED, 0, 1, "Optimal - objective value %g,\ okay CLP can solve some LPs but you really need Xpress from Dash Associates :-)" }, {CLP_DUMMY_END, 999999, 0, ""} }; /* Constructor */ ClpMessage::ClpMessage(Language language) : CoinMessages(sizeof(clp_us_english) / sizeof(Clp_message)) { language_ = language; strcpy(source_, "Clp"); class_ = 1; //solver Clp_message * message = clp_us_english; while (message->internalNumber != CLP_DUMMY_END) { CoinOneMessage oneMessage(message->externalNumber, message->detail, message->message); addMessage(message->internalNumber, oneMessage); message ++; } // Put into compact form toCompact(); // now override any language ones switch (language) { case uk_en: message = uk_english; break; default: message = NULL; break; } // replace if any found if (message) { while (message->internalNumber != CLP_DUMMY_END) { replaceMessage(message->internalNumber, message->message); message ++; } } } CoinMP-1.8.3/Clp/src/ClpCholeskyWssmp.hpp0000644000175000017500000000347211510657452016620 0ustar renerene/* $Id: ClpCholeskyWssmp.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpCholeskyWssmp_H #define ClpCholeskyWssmp_H #include "ClpCholeskyBase.hpp" class ClpMatrixBase; class ClpCholeskyDense; /** Wssmp class for Clp Cholesky factorization */ class ClpCholeskyWssmp : public ClpCholeskyBase { public: /**@name Virtual methods that the derived classes provides */ //@{ /** Orders rows and saves pointer to matrix.and model. Returns non-zero if not enough memory */ virtual int order(ClpInterior * model) ; /** Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ virtual int symbolic(); /** Factorize - filling in rowsDropped and returning number dropped. If return code negative then out of memory */ virtual int factorize(const double * diagonal, int * rowsDropped) ; /** Uses factorization to solve. */ virtual void solve (double * region) ; //@} /**@name Constructors, destructor */ //@{ /** Constructor which has dense columns activated. Default is off. */ ClpCholeskyWssmp(int denseThreshold = -1); /** Destructor */ virtual ~ClpCholeskyWssmp(); // Copy ClpCholeskyWssmp(const ClpCholeskyWssmp&); // Assignment ClpCholeskyWssmp& operator=(const ClpCholeskyWssmp&); /// Clone virtual ClpCholeskyBase * clone() const ; //@} private: /**@name Data members */ //@{ //@} }; #endif CoinMP-1.8.3/Clp/src/CoinAbcFactorization.hpp0000644000175000017500000000250712101105055017357 0ustar renerene/* $Id: CoinAbcFactorization.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef CoinAbcFactorization_H #define CoinAbcFactorization_H #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #undef CoinAbcTypeFactorization #undef ABC_SMALL #undef COIN_BIG_DOUBLE #define COIN_BIG_DOUBLE 1 #define CoinAbcTypeFactorization CoinAbcLongFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #undef CoinAbcTypeFactorization #undef ABC_SMALL #undef COIN_BIG_DOUBLE #define CoinAbcTypeFactorization CoinAbcSmallFactorization #define ABC_SMALL 4 #include "CoinAbcBaseFactorization.hpp" #undef CoinAbcTypeFactorization #undef ABC_SMALL #define CoinAbcTypeFactorization CoinAbcOrderedFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #undef CoinAbcTypeFactorization #undef ABC_SMALL #else #define CoinAbcTypeFactorization CoinAbcBaseFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #endif #endif CoinMP-1.8.3/Clp/src/ClpPdcoBase.hpp0000644000175000017500000000524511510657452015465 0ustar renerene/* $Id: ClpPdcoBase.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpPdcoBase_H #define ClpPdcoBase_H #include "CoinPragma.hpp" #include "CoinPackedMatrix.hpp" #include "CoinDenseVector.hpp" class ClpInterior; /** Abstract base class for tailoring everything for Pcdo Since this class is abstract, no object of this type can be created. If a derived class provides all methods then all ClpPcdo algorithms should work. Eventually we should be able to use ClpObjective and ClpMatrixBase. */ class ClpPdcoBase { public: /**@name Virtual methods that the derived classes must provide */ //@{ virtual void matVecMult(ClpInterior * model, int mode, double * x, double * y) const = 0; virtual void getGrad(ClpInterior * model, CoinDenseVector &x, CoinDenseVector &grad) const = 0; virtual void getHessian(ClpInterior * model, CoinDenseVector &x, CoinDenseVector &H) const = 0; virtual double getObj(ClpInterior * model, CoinDenseVector &x) const = 0; virtual void matPrecon(ClpInterior * model, double delta, double * x, double * y) const = 0; //@} //@{ ///@name Other /// Clone virtual ClpPdcoBase * clone() const = 0; /// Returns type inline int type() const { return type_; }; /// Sets type inline void setType(int type) { type_ = type; }; /// Returns size of d1 inline int sizeD1() const { return 1; }; /// Returns d1 as scalar inline double getD1() const { return d1_; }; /// Returns size of d2 inline int sizeD2() const { return 1; }; /// Returns d2 as scalar inline double getD2() const { return d2_; }; //@} protected: /**@name Constructors, destructor
    NOTE: All constructors are protected. There's no need to expose them, after all, this is an abstract class. */ //@{ /** Default constructor. */ ClpPdcoBase(); /** Destructor (has to be public) */ public: virtual ~ClpPdcoBase(); protected: // Copy ClpPdcoBase(const ClpPdcoBase&); // Assignment ClpPdcoBase& operator=(const ClpPdcoBase&); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Should be dense vectors double d1_; double d2_; /// type (may be useful) int type_; //@} }; #endif CoinMP-1.8.3/Clp/src/AbcSimplexDual.cpp0000644000175000017500000063073512452503025016176 0ustar renerene/* $Id: AbcSimplexDual.cpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Notes on implementation of dual simplex algorithm. When dual feasible: If primal feasible, we are optimal. Otherwise choose an infeasible basic variable to leave basis (normally going to nearest bound) (B). We now need to find an incoming variable which will leave problem dual feasible so we get the row of the tableau corresponding to the basic variable (with the correct sign depending if basic variable above or below feasibility region - as that affects whether reduced cost on outgoing variable has to be positive or negative). We now perform a ratio test to determine which incoming variable will preserve dual feasibility (C). If no variable found then problem is infeasible (in primal sense). If there is a variable, we then perform pivot and repeat. Trivial? ------------------------------------------- A) How do we get dual feasible? If all variables have bounds then it is trivial to get feasible by putting non-basic variables to correct bounds. OSL did not have a phase 1/phase 2 approach but instead effectively put fake bounds on variables and this is the approach here, although I had hoped to make it cleaner. If there is a weight of X on getting dual feasible: Non-basic variables with negative reduced costs are put to lesser of their upper bound and their lower bound + X. Similarly, mutatis mutandis, for positive reduced costs. Free variables should normally be in basis, otherwise I have coding which may be able to come out (and may not be correct). In OSL, this weight was changed heuristically, here at present it is only increased if problem looks finished. If problem is feasible I check for unboundedness. If not unbounded we could play with going into primal. As long as weights increase any algorithm would be finite. B) Which outgoing variable to choose is a virtual base class. For difficult problems steepest edge is preferred while for very easy (large) problems we will need partial scan. C) Sounds easy, but this is hardest part of algorithm. 1) Instead of stopping at first choice, we may be able to flip that variable to other bound and if objective still improving choose again. These mini iterations can increase speed by orders of magnitude but we may need to go to more of a bucket choice of variable rather than looking at them one by one (for speed). 2) Accuracy. Reduced costs may be of wrong sign but less than tolerance. Pivoting on these makes objective go backwards. OSL modified cost so a zero move was made, Gill et al (in primal analogue) modified so a strictly positive move was made. It is not quite as neat in dual but that is what we try and do. The two problems are that re-factorizations can change reduced costs above and below tolerances and that when finished we need to reset costs and try again. 3) Degeneracy. Gill et al helps but may not be enough. We may need more. Also it can improve speed a lot if we perturb the costs significantly. References: Forrest and Goldfarb, Steepest-edge simplex algorithms for linear programming - Mathematical Programming 1992 Forrest and Tomlin, Implementing the simplex method for the Optimization Subroutine Library - IBM Systems Journal 1992 Gill, Murray, Saunders, Wright A Practical Anti-Cycling Procedure for Linear and Nonlinear Programming SOL report 1988 TODO: a) Better recovery procedures. At present I never check on forward progress. There is checkpoint/restart with reducing re-factorization frequency, but this is only on singular factorizations. b) Fast methods for large easy problems (and also the option for the code to automatically choose which method). c) We need to be able to stop in various ways for OSI - this is fairly easy. */ #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #include "AbcSimplexDual.hpp" #include "ClpEventHandler.hpp" #include "AbcSimplexFactorization.hpp" #include "AbcNonLinearCost.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "CoinFloatEqual.hpp" #include "AbcDualRowDantzig.hpp" #include "AbcDualRowSteepest.hpp" #include "ClpMessage.hpp" #include "ClpLinearObjective.hpp" class ClpSimplex; #include #include #include #include #include //#define CLP_DEBUG 1 #ifdef NDEBUG #define NDEBUG_CLP #endif #ifndef CLP_INVESTIGATE #define NDEBUG_CLP #endif // dual /* *** Method This is a vanilla version of dual simplex. It tries to be a single phase approach with a weight of 1.0 being given to getting optimal and a weight of dualBound_ being given to getting dual feasible. In this version I have used the idea that this weight can be thought of as a fake bound. If the distance between the lower and upper bounds on a variable is less than the feasibility weight then we are always better off flipping to other bound to make dual feasible. If the distance is greater then we make up a fake bound dualBound_ away from one bound. If we end up optimal or primal infeasible, we check to see if bounds okay. If so we have finished, if not we increase dualBound_ and continue (after checking if unbounded). I am undecided about free variables - there is coding but I am not sure about it. At present I put them in basis anyway. The code is designed to take advantage of sparsity so arrays are seldom zeroed out from scratch or gone over in their entirety. The only exception is a full scan to find outgoing variable. This will be changed to keep an updated list of infeasibilities (or squares if steepest edge). Also on easy problems we don't need full scan - just pick first reasonable. One problem is how to tackle degeneracy and accuracy. At present I am using the modification of costs which I put in OSL and which was extended by Gill et al. I am still not sure of the exact details. The flow of dual is three while loops as follows: while (not finished) { while (not clean solution) { Factorize and/or clean up solution by flipping variables so dual feasible. If looks finished check fake dual bounds. Repeat until status is iterating (-1) or finished (0,1,2) } while (status==-1) { Iterate until no pivot in or out or time to re-factorize. Flow is: choose pivot row (outgoing variable). if none then we are primal feasible so looks as if done but we need to break and check bounds etc. Get pivot row in tableau Choose incoming column. If we don't find one then we look primal infeasible so break and check bounds etc. (Also the pivot tolerance is larger after any iterations so that may be reason) If we do find incoming column, we may have to adjust costs to keep going forwards (anti-degeneracy). Check pivot will be stable and if unstable throw away iteration (we will need to implement flagging of basic variables sometime) and break to re-factorize. If minor error re-factorize after iteration. Update everything (this may involve flipping variables to stay dual feasible. } } At present we never check we are going forwards. I overdid that in OSL so will try and make a last resort. Needs partial scan pivot out option. Needs dantzig, uninitialized and full steepest edge options (can still use partial scan) May need other anti-degeneracy measures, especially if we try and use loose tolerances as a way to solve in fewer iterations. I like idea of dynamic scaling. This gives opportunity to decouple different implications of scaling for accuracy, iteration count and feasibility tolerance. */ #define CLEAN_FIXED 0 // Startup part of dual (may be extended to other algorithms) // To force to follow another run put logfile name here and define //#define FORCE_FOLLOW #ifdef FORCE_FOLLOW static FILE * fpFollow = NULL; static const char * forceFile = NULL; static int force_in = -1; static int force_out = -1; static int force_way_in = -1; static int force_way_out = -1; static int force_iterations = 0; int force_argc=0; const char ** force_argv=NULL; #endif void AbcSimplexDual::startupSolve() { #ifdef FORCE_FOLLOW int ifld; for (ifld=1;ifld1.0e30) { abcUpper_[i]=abcLower_[i]+dualBound_; setFakeUpper(i); } } } assert (numberBasic==numberRows_); } #endif // initialize - no values pass and algorithm_ is -1 // put in standard form (and make row copy) // create modifiable copies of model rim and do optional scaling // If problem looks okay // Do initial factorization numberFake_ = 0; // Number of variables at fake bounds numberChanged_ = 0; // Number of variables with changed costs /// Initial coding here statusOfProblemInDual(0); } void AbcSimplexDual::finishSolve() { assert (problemStatus_ || !sumPrimalInfeasibilities_); } void AbcSimplexDual::gutsOfDual() { double largestPrimalError = 0.0; double largestDualError = 0.0; lastCleaned_ = 0; // last time objective or bounds cleaned up numberDisasters_=0; // This says whether to restore things etc //startupSolve(); // startup will have factorized so can skip // Start check for cycles abcProgress_.startCheck(); // Say change made on first iteration changeMade_ = 1; // Say last objective infinite //lastObjectiveValue_=-COIN_DBL_MAX; if ((stateOfProblem_&VALUES_PASS)!=0) { // modify costs so nonbasic dual feasible with fake for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { switch(getInternalStatus(iSequence)) { case basic: case AbcSimplex::isFixed: break; case isFree: case superBasic: //abcCost_[iSequence]-=djSaved_[iSequence]; //abcDj_[iSequence]-=djSaved_[iSequence]; djSaved_[iSequence]=0.0; break; case atLowerBound: if (djSaved_[iSequence]<0.0) { //abcCost_[iSequence]-=djSaved_[iSequence]; //abcDj_[iSequence]-=djSaved_[iSequence]; djSaved_[iSequence]=0.0; } break; case atUpperBound: if (djSaved_[iSequence]>0.0) { //abcCost_[iSequence]-=djSaved_[iSequence]; //abcDj_[iSequence]-=djSaved_[iSequence]; djSaved_[iSequence]=0.0; } break; } } } progressFlag_ = 0; /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible */ int factorizationType=1; double pivotTolerance=abcFactorization_->pivotTolerance(); while (problemStatus_ < 0) { // If getting nowhere - return double limit = numberRows_ + numberColumns_; limit = 10000.0 +2000.0 * limit; #if ABC_NORMAL_DEBUG>0 if (numberIterations_ > limit) { printf("Set flag so ClpSimplexDual done\n"); abort(); } #endif bool disaster = false; if (disasterArea_ && disasterArea_->check()) { disasterArea_->saveInfo(); disaster = true; } if (numberIterations_>baseIteration_) { // may factorize, checks if problem finished statusOfProblemInDual(factorizationType); factorizationType=1; largestPrimalError = CoinMax(largestPrimalError, largestPrimalError_); largestDualError = CoinMax(largestDualError, largestDualError_); if (disaster) problemStatus_ = 3; } int saveNumberIterations=numberIterations_; // exit if victory declared if (problemStatus_ >= 0) break; // test for maximum iterations if (hitMaximumIterations()) { problemStatus_ = 3; break; } // Check event int eventStatus = eventHandler_->event(ClpEventHandler::endOfFactorization); if (eventStatus >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } if (!numberPrimalInfeasibilities_&&problemStatus_<0) { #if ABC_NORMAL_DEBUG>0 printf("Primal feasible - sum dual %g - go to primal\n",sumDualInfeasibilities_); #endif problemStatus_=10; break; } // Do iterations ? loop round #if PARTITION_ROW_COPY==1 stateOfProblem_ |= NEED_BASIS_SORT; #endif while (true) { #if PARTITION_ROW_COPY==1 if ((stateOfProblem_&NEED_BASIS_SORT)!=0) { int iVector=getAvailableArray(); abcMatrix_->sortUseful(usefulArray_[iVector]); setAvailableArray(iVector); stateOfProblem_ &= ~NEED_BASIS_SORT; } #endif problemStatus_=-1; if ((stateOfProblem_&VALUES_PASS)!=0) { assert (djSaved_-abcDj_==numberTotal_); abcDj_=djSaved_; djSaved_=NULL; } #if ABC_PARALLEL if (parallelMode_==0) { #endif whileIteratingSerial(); #if ABC_PARALLEL } else { #if ABC_PARALLEL==1 whileIteratingThread(); #else whileIteratingCilk(); #endif } #endif if ((stateOfProblem_&VALUES_PASS)!=0) { djSaved_=abcDj_; abcDj_=djSaved_-numberTotal_; } if (pivotRow_!=-100) { if (numberIterations_>saveNumberIterations||problemStatus_>=0) { if (problemStatus_==10&&abcFactorization_->pivots()&&numberTimesOptimal_<3) { factorizationType=5; problemStatus_=-4; if (!numberPrimalInfeasibilities_) factorizationType=9; } else if (problemStatus_==-2) { factorizationType=5; } break; } else if (abcFactorization_->pivots()||problemStatus_==-6|| pivotTolerancepivotTolerance()) { factorizationType=5; if (pivotTolerancepivotTolerance()) { pivotTolerance=abcFactorization_->pivotTolerance(); if (!abcFactorization_->pivots()) abcFactorization_->minimumPivotTolerance(CoinMin(0.25,1.05*abcFactorization_->minimumPivotTolerance())); } break; } else { bool tryFake=numberAtFakeBound()>0&¤tDualBound_<1.0e17; if (problemStatus_==-5||tryFake) { if (numberTimesOptimal_>10) problemStatus_=4; numberTimesOptimal_++; int numberChanged=-1; if (numberFlagged_) { numberFlagged_=0; for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; if (flagged(iPivot)) { clearFlagged(iPivot); } } numberChanged=0; } else if (tryFake) { double dummyChange; numberChanged = changeBounds(0,dummyChange); if (numberChanged>0) { handler_->message(CLP_DUAL_ORIGINAL, messages_) << CoinMessageEol; bounceTolerances(3 /*(numberChanged>0) ? 3 : 1*/); // temp #if ABC_NORMAL_DEBUG>0 //printf("should not need to break out of loop\n"); #endif abcProgress_.reset(); break; } else if (numberChanged<-1) { // some flipped bounceTolerances(3); abcProgress_.reset(); } } else if (numberChanged<0) { // what now printf("No iterations since last inverts A - nothing done - think\n"); abort(); } } else if (problemStatus_!=-4) { // what now printf("No iterations since last inverts B - nothing done - think\n"); abort(); } } } else { // end of values pass // we need to tell statusOf.. to restore costs etc // and take off flag bounceTolerances(2); assert (!solution_); delete [] solution_; solution_=NULL; gutsOfSolution(3); makeNonFreeVariablesDualFeasible(); stateOfProblem_ &= ~VALUES_PASS; problemStatus_=-2; factorizationType=5; break; } } if (problemStatus_ == 1 && (progressFlag_&8) != 0 && fabs(rawObjectiveValue_) > 1.0e10 ) { #if ABC_NORMAL_DEBUG>0 printf("fix looks infeasible when has been\n"); // goto primal #endif problemStatus_ = 10; // infeasible - but has looked feasible } if (!problemStatus_ && abcFactorization_->pivots()) { gutsOfSolution(1); // need to compute duals //computeInternalObjectiveValue(); checkCutoff(true); } } largestPrimalError_ = largestPrimalError; largestDualError_ = largestDualError; } /// The duals are updated by the given arrays. static void updateDualsInDualBit2(CoinPartitionedVector & row, double * COIN_RESTRICT djs, double theta, int iBlock) { int offset=row.startPartition(iBlock); double * COIN_RESTRICT work=row.denseVector()+offset; const int * COIN_RESTRICT which=row.getIndices()+offset; int number=row.getNumElements(iBlock); for (int i = 0; i < number; i++) { int iSequence = which[i]; double alphaI = work[i]; work[i] = 0.0; double value = djs[iSequence] - theta * alphaI; djs[iSequence] = value; } row.setNumElementsPartition(iBlock,0); } static void updateDualsInDualBit(CoinPartitionedVector & row, double * djs, double theta, int numberBlocks) { for (int iBlock=1;iBlockusefulArray(3)->compact(); CoinPartitionedVector & array=usefulArray_[arrayForTableauRow_]; //array.compact(); int numberBlocks=array.getNumPartitions(); int number=array.getNumElements(); if(numberBlocks) { if (number>100) { updateDualsInDualBit(array,abcDj_,theta_,numberBlocks); } else { for (int iBlock=0;iBlock= 0) { // make sure valid int returnValue = firstFree_; int iColumn = firstFree_ + 1; #ifdef PAN if (fakeSuperBasic(firstFree_)<0) { // somehow cleaned up returnValue=-1; for (; iColumn < numberTotal_; iColumn++) { if (getInternalStatus(iColumn) == isFree|| getInternalStatus(iColumn) == superBasic) { if (fakeSuperBasic(iColumn)>=0) { if (fabs(abcDj_[iColumn]) > 1.0e2 * dualTolerance_) break; } } } if (iColumn=0) { #endif if (fabs(abcDj_[iColumn]) > dualTolerance_) break; #ifdef PAN } #endif } } firstFree_ = iColumn; if (firstFree_ == numberTotal_) firstFree_ = -1; return returnValue; } else { return -1; } } /* Chooses dual pivot row For easy problems we can just choose one of the first rows we look at */ void AbcSimplexDual::dualPivotRow() { //int lastPivotRow=pivotRow_; pivotRow_=-1; const double * COIN_RESTRICT lowerBasic = lowerBasic_; const double * COIN_RESTRICT upperBasic = upperBasic_; const double * COIN_RESTRICT solutionBasic = solutionBasic_; const int * COIN_RESTRICT pivotVariable=abcPivotVariable_; freeSequenceIn_=-1; double worstValuesPass=0.0; if ((stateOfProblem_&VALUES_PASS)!=0) { for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { switch(getInternalStatus(iSequence)) { case basic: #if ABC_NORMAL_DEBUG>0 if (fabs(abcDj_[iSequence])>1.0e-6) printf("valuespass basic dj %d status %d dj %g\n",iSequence, getInternalStatus(iSequence),abcDj_[iSequence]); #endif break; case AbcSimplex::isFixed: break; case isFree: case superBasic: #if ABC_NORMAL_DEBUG>0 if (fabs(abcDj_[iSequence])>1.0e-6) printf("Bad valuespass dj %d status %d dj %g\n",iSequence, getInternalStatus(iSequence),abcDj_[iSequence]); #endif break; case atLowerBound: #if ABC_NORMAL_DEBUG>0 if (abcDj_[iSequence]<-1.0e-6) printf("Bad valuespass dj %d status %d dj %g\n",iSequence, getInternalStatus(iSequence),abcDj_[iSequence]); #endif break; case atUpperBound: #if ABC_NORMAL_DEBUG>0 if (abcDj_[iSequence]>1.0e-6) printf("Bad valuespass dj %d status %d dj %g\n",iSequence, getInternalStatus(iSequence),abcDj_[iSequence]); #endif break; } } // get worst basic dual - later do faster using steepest infeasibility array // does not have to be worst - just bad int iWorst=-1; double worst=dualTolerance_; for (int i=0;iworst) { iWorst=i; worst=fabs(abcDj_[iSequence]); } } if (iWorst>=0) { pivotRow_=iWorst; worstValuesPass=abcDj_[abcPivotVariable_[iWorst]]; } else { // factorize and clean up costs pivotRow_=-100; return; } } if (false&&numberFreeNonBasic_>abcFactorization_->maximumPivots()) { lastFirstFree_=-1; firstFree_=-1; } if (firstFree_>=0) { // free int nextFree = nextSuperBasic(); if (nextFree>=0) { freeSequenceIn_=nextFree; // **** should skip price (and maybe weights update) // unpack vector and find a good pivot unpack(usefulArray_[arrayForBtran_], nextFree); abcFactorization_->updateColumn(usefulArray_[arrayForBtran_]); double * COIN_RESTRICT work = usefulArray_[arrayForBtran_].denseVector(); int number = usefulArray_[arrayForBtran_].getNumElements(); int * COIN_RESTRICT which = usefulArray_[arrayForBtran_].getIndices(); double bestFeasibleAlpha = 0.0; int bestFeasibleRow = -1; double bestInfeasibleAlpha = 0.0; int bestInfeasibleRow = -1; // Go for big infeasibilities unless big changes double maxInfeas = (fabs(dualOut_)>1.0e3) ? 0.001 : 1.0e6; for (int i = 0; i < number; i++) { int iRow = which[i]; double alpha = fabs(work[iRow]); if (alpha > 1.0e-3) { double value = solutionBasic[iRow]; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; double infeasibility = 0.0; if (value > upper) infeasibility = value - upper; else if (value < lower) infeasibility = lower - value; infeasibility=CoinMin(maxInfeas,infeasibility); if (infeasibility * alpha > bestInfeasibleAlpha && alpha > 1.0e-1) { if (!flagged(pivotVariable[iRow])) { bestInfeasibleAlpha = infeasibility * alpha; bestInfeasibleRow = iRow; } } if (alpha > bestFeasibleAlpha && (lower > -1.0e20 || upper < 1.0e20)) { bestFeasibleAlpha = alpha; bestFeasibleRow = iRow; } } } if (bestInfeasibleRow >= 0) pivotRow_ = bestInfeasibleRow; else if (bestFeasibleAlpha > 1.0e-2) pivotRow_ = bestFeasibleRow; usefulArray_[arrayForBtran_].clear(); if (pivotRow_<0) { // no good freeSequenceIn_=-1; if (!abcFactorization_->pivots()) { lastFirstFree_=-1; firstFree_=-1; } } } } if (pivotRow_<0) { // put back so can test //pivotRow_=lastPivotRow; // get pivot row using whichever method it is pivotRow_ = abcDualRowPivot_->pivotRow(); } if (pivotRow_ >= 0) { sequenceOut_ = pivotVariable[pivotRow_]; valueOut_ = solutionBasic[pivotRow_]; lowerOut_ = lowerBasic[pivotRow_]; upperOut_ = upperBasic[pivotRow_]; // if we have problems we could try other way and hope we get a // zero pivot? if (valueOut_ > upperOut_) { directionOut_ = -1; dualOut_ = valueOut_ - upperOut_; } else if (valueOut_ < lowerOut_) { directionOut_ = 1; dualOut_ = lowerOut_ - valueOut_; } else { // odd (could be free) - it's feasible - go to nearest if (valueOut_ - lowerOut_ < upperOut_ - valueOut_) { directionOut_ = 1; dualOut_ = lowerOut_ - valueOut_; } else { directionOut_ = -1; dualOut_ = valueOut_ - upperOut_; } } if (worstValuesPass) { // in values pass so just use sign of dj // We don't want to go through any barriers so set dualOut low // free variables will never be here // need to think about tolerances with inexact solutions // could try crashing in variables away from bounds and with near zero djs // pivot to take out bad slack and increase objective double fakeValueOut=solution_[sequenceOut_]; dualOut_ = 1.0e-10; if (upperOut_>lowerOut_|| fabs(fakeValueOut-upperOut_)<100.0*primalTolerance_) { if (abcDj_[sequenceOut_] > 0.0) { directionOut_ = 1; } else { directionOut_ = -1; } } else { // foolishly trust primal solution if (fakeValueOut > upperOut_) { directionOut_ = -1; } else { directionOut_ = 1; } } #if 1 // make sure plausible but only when fake primals stored if (directionOut_ < 0 && fabs(fakeValueOut - upperOut_) > dualBound_ + primalTolerance_) { if (fabs(fakeValueOut - upperOut_) > fabs(fakeValueOut - lowerOut_)) directionOut_ = 1; } else if (directionOut_ > 0 && fabs(fakeValueOut - lowerOut_) > dualBound_ + primalTolerance_) { if (fabs(fakeValueOut - upperOut_) < fabs(fakeValueOut - lowerOut_)) directionOut_ = -1; } #endif } #if ABC_NORMAL_DEBUG>3 assert(dualOut_ >= 0.0); #endif } else { sequenceOut_=-1; } alpha_=0.0; upperTheta_=COIN_DBL_MAX; return ; } // Checks if any fake bounds active - if so returns number and modifies // dualBound_ and everything. // Free variables will be left as free // Returns number of bounds changed if >=0 // Returns -1 if not initialize and no effect // Fills in changeVector which can be used to see if unbounded // initialize is 0 or 3 // and cost of change vector int AbcSimplexDual::changeBounds(int initialize, double & changeCost) { assert (initialize==0||initialize==1||initialize==3||initialize==4); numberFake_ = 0; double * COIN_RESTRICT abcLower = abcLower_; double * COIN_RESTRICT abcUpper = abcUpper_; double * COIN_RESTRICT abcSolution = abcSolution_; double * COIN_RESTRICT abcCost = abcCost_; if (!initialize) { int numberInfeasibilities; double newBound; newBound = 5.0 * currentDualBound_; numberInfeasibilities = 0; changeCost = 0.0; // put back original bounds and then check CoinAbcMemcpy(abcLower,lowerSaved_,numberTotal_); CoinAbcMemcpy(abcUpper,upperSaved_,numberTotal_); const double * COIN_RESTRICT dj = abcDj_; int iSequence; // bounds will get bigger - just look at ones at bounds int numberFlipped=0; double checkBound=1.000000000001*currentDualBound_; for (iSequence = 0; iSequence < numberTotal_; iSequence++) { double lowerValue = abcLower[iSequence]; double upperValue = abcUpper[iSequence]; double value = abcSolution[iSequence]; setFakeBound(iSequence, AbcSimplexDual::noFake); switch(getInternalStatus(iSequence)) { case basic: case AbcSimplex::isFixed: break; case isFree: case superBasic: break; case atUpperBound: if (fabs(value - upperValue) > primalTolerance_) { // can we flip if (value-lowerValue-currentDualTolerance_) { abcSolution_[iSequence]=lowerValue; setInternalStatus(iSequence,atLowerBound); numberFlipped++; } else { numberInfeasibilities++; } } break; case atLowerBound: if (fabs(value - lowerValue) > primalTolerance_) { // can we flip if (upperValue-valuemessage(CLP_DUAL_CHECKB, messages_) << newBound << CoinMessageEol; int iSequence; for (iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { double lowerValue = abcLower[iSequence]; double upperValue = abcUpper[iSequence]; double newLowerValue; double newUpperValue; Status status = getInternalStatus(iSequence); if (status == atUpperBound || status == atLowerBound) { double value = abcSolution[iSequence]; if (value - lowerValue <= upperValue - value) { newLowerValue = CoinMax(lowerValue, value - 0.666667 * newBound); newUpperValue = CoinMin(upperValue, newLowerValue + newBound); } else { newUpperValue = CoinMin(upperValue, value + 0.666667 * newBound); newLowerValue = CoinMax(lowerValue, newUpperValue - newBound); } abcLower[iSequence] = newLowerValue; abcUpper[iSequence] = newUpperValue; if (newLowerValue > lowerValue) { if (newUpperValue < upperValue) { setFakeBound(iSequence, AbcSimplexDual::bothFake); #ifdef CLP_INVESTIGATE abort(); // No idea what should happen here - I have never got here #endif numberFake_++; } else { setFakeBound(iSequence, AbcSimplexDual::lowerFake); assert (abcLower[iSequence]>lowerSaved_[iSequence]); assert (abcUpper[iSequence]==upperSaved_[iSequence]); numberFake_++; } } else { if (newUpperValue < upperValue) { setFakeBound(iSequence, AbcSimplexDual::upperFake); assert (abcLower[iSequence]==lowerSaved_[iSequence]); assert (abcUpper[iSequence]0 printf("new dual bound %g\n",currentDualBound_); #endif } else { numberInfeasibilities = -1-numberFlipped; } return numberInfeasibilities; } else { int iSequence; if (initialize == 3) { for (iSequence = 0; iSequence < numberTotal_; iSequence++) { #if ABC_NORMAL_DEBUG>1 int bad=-1; if (getFakeBound(iSequence)==noFake) { if (abcLower_[iSequence]!=lowerSaved_[iSequence]|| abcUpper_[iSequence]!=upperSaved_[iSequence]) bad=0; } else if (getFakeBound(iSequence)==lowerFake) { if (abcLower_[iSequence]==lowerSaved_[iSequence]|| abcUpper_[iSequence]!=upperSaved_[iSequence]) bad=1; } else if (getFakeBound(iSequence)==upperFake) { if (abcLower_[iSequence]!=lowerSaved_[iSequence]|| abcUpper_[iSequence]==upperSaved_[iSequence]) bad=2; } else { if (abcLower_[iSequence]==lowerSaved_[iSequence]|| abcUpper_[iSequence]==upperSaved_[iSequence]) bad=3; } if (bad>=0) printf("%d status %d l %g,%g u %g,%g\n",iSequence,internalStatus_[iSequence], abcLower_[iSequence],lowerSaved_[iSequence], abcUpper_[iSequence],upperSaved_[iSequence]); #endif setFakeBound(iSequence, AbcSimplexDual::noFake); } CoinAbcMemcpy(abcLower_,lowerSaved_,numberTotal_); CoinAbcMemcpy(abcUpper_,upperSaved_,numberTotal_); } double testBound = /*0.999999 **/ currentDualBound_; for (iSequence = 0; iSequence < numberTotal_; iSequence++) { Status status = getInternalStatus(iSequence); if (status == atUpperBound || status == atLowerBound) { double lowerValue = abcLower[iSequence]; double upperValue = abcUpper[iSequence]; double value = abcSolution[iSequence]; if (lowerValue > -largeValue_ || upperValue < largeValue_) { if (true || lowerValue - value > -0.5 * currentDualBound_ || upperValue - value < 0.5 * currentDualBound_) { if (fabs(lowerValue - value) <= fabs(upperValue - value)) { if (upperValue > lowerValue + testBound) { if (getFakeBound(iSequence) == AbcSimplexDual::noFake) numberFake_++; abcUpper[iSequence] = lowerValue + currentDualBound_; double difference = upperSaved_[iSequence]-abcUpper[iSequence]; if (difference<1.0e-10*(1.0+fabs(upperSaved_[iSequence])+dualBound_)) abcUpper[iSequence] = upperSaved_[iSequence]; assert (abcUpper[iSequence]<=upperSaved_[iSequence]+1.0e-3*currentDualBound_); assert (abcLower[iSequence]>=lowerSaved_[iSequence]-1.0e-3*currentDualBound_); if (upperSaved_[iSequence]-abcUpper[iSequence]> abcLower[iSequence]-lowerSaved_[iSequence]) { setFakeBound(iSequence, AbcSimplexDual::upperFake); assert (abcLower[iSequence]==lowerSaved_[iSequence]); assert (abcUpper[iSequence]lowerSaved_[iSequence]); assert (abcUpper[iSequence]==upperSaved_[iSequence]); } } } else { if (lowerValue < upperValue - testBound) { if (getFakeBound(iSequence) == AbcSimplexDual::noFake) numberFake_++; abcLower[iSequence] = upperValue - currentDualBound_; double difference = abcLower[iSequence]-lowerSaved_[iSequence]; if (difference<1.0e-10*(1.0+fabs(lowerSaved_[iSequence])+dualBound_)) abcLower[iSequence] = lowerSaved_[iSequence]; assert (abcUpper[iSequence]<=upperSaved_[iSequence]+1.0e-3*currentDualBound_); assert (abcLower[iSequence]>=lowerSaved_[iSequence]-1.0e-3*currentDualBound_); if (upperSaved_[iSequence]-abcUpper[iSequence]> abcLower[iSequence]-lowerSaved_[iSequence]) { setFakeBound(iSequence, AbcSimplexDual::upperFake); //assert (abcLower[iSequence]==lowerSaved_[iSequence]); abcLower[iSequence]=CoinMax(abcLower[iSequence],lowerSaved_[iSequence]); assert (abcUpper[iSequence]lowerSaved_[iSequence]); //assert (abcUpper[iSequence]==upperSaved_[iSequence]); abcUpper[iSequence]=CoinMin(abcUpper[iSequence],upperSaved_[iSequence]); } } } } else { if (getFakeBound(iSequence) == AbcSimplexDual::noFake) numberFake_++; abcLower[iSequence] = -0.5 * currentDualBound_; abcUpper[iSequence] = 0.5 * currentDualBound_; setFakeBound(iSequence, AbcSimplexDual::bothFake); abort(); } if (status == atUpperBound) abcSolution[iSequence] = abcUpper[iSequence]; else abcSolution[iSequence] = abcLower[iSequence]; } else { // set non basic free variables to fake bounds // I don't think we should ever get here CoinAssert(!("should not be here")); abcLower[iSequence] = -0.5 * currentDualBound_; abcUpper[iSequence] = 0.5 * currentDualBound_; setFakeBound(iSequence, AbcSimplexDual::bothFake); numberFake_++; setInternalStatus(iSequence, atUpperBound); abcSolution[iSequence] = 0.5 * currentDualBound_; } } else if (status == basic) { // make sure not at fake bound and bounds correct setFakeBound(iSequence, AbcSimplexDual::noFake); double gap = abcUpper[iSequence] - abcLower[iSequence]; if (gap > 0.5 * currentDualBound_ && gap < 2.0 * currentDualBound_) { abcLower[iSequence] = lowerSaved_[iSequence];; abcUpper[iSequence] = upperSaved_[iSequence];; } } } return 0; } } /* order of variables is a) atLo/atUp b) free/superBasic pre pass done in AbcMatrix to get possibles dj's will be stored in a parallel array (tempArray) for first pass this pass to be done inside AbcMatrix then as now use perturbationArray as variable tolerance idea is to use large tolerances and then balance and reduce every so often this should be in conjunction with dualBound changes variables always stay at bounds on accuracy issues - only deliberate flips allowed variable tolerance should be 0.8-1.0 desired (at end) use going to clpMatrix_ as last resort */ /* Array has tableau row Puts candidates in list Returns upper theta (infinity if no pivot) and may set sequenceIn_ if free */ void AbcSimplexDual::dualColumn1(bool doAll) { const CoinIndexedVector & update = usefulArray_[arrayForBtran_]; CoinPartitionedVector & tableauRow = usefulArray_[arrayForTableauRow_]; CoinPartitionedVector & candidateList = usefulArray_[arrayForDualColumn_]; if ((stateOfProblem_&VALUES_PASS)==0) upperTheta_=1.0e31; else upperTheta_=fabs(abcDj_[sequenceOut_])-0.5*dualTolerance_; assert (upperTheta_>0.0); if (!doAll) upperTheta_ = abcMatrix_->dualColumn1(update,tableauRow,candidateList); else upperTheta_ = dualColumn1B(); //tableauRow.compact(); //candidateList.compact(); //tableauRow.setPackedMode(true); //candidateList.setPackedMode(true); } /* Array has tableau row Puts candidates in list Returns upper theta (infinity if no pivot) and may set sequenceIn_ if free */ double AbcSimplexDual::dualColumn1A() { const CoinIndexedVector & update = usefulArray_[arrayForBtran_]; CoinPartitionedVector & tableauRow = usefulArray_[arrayForTableauRow_]; CoinPartitionedVector & candidateList = usefulArray_[arrayForDualColumn_]; int numberRemaining = 0; double upperTheta = upperTheta_; // pivot elements double * COIN_RESTRICT arrayCandidate=candidateList.denseVector(); // indices int * COIN_RESTRICT indexCandidate = candidateList.getIndices(); const double * COIN_RESTRICT abcDj = abcDj_; //const double * COIN_RESTRICT abcPerturbation = abcPerturbation_; const unsigned char * COIN_RESTRICT internalStatus = internalStatus_; const double * COIN_RESTRICT pi=update.denseVector(); const int * COIN_RESTRICT piIndex = update.getIndices(); int number = update.getNumElements(); int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); assert (!tableauRow.getNumElements()); int numberNonZero=0; // do first pass to get possibles double bestPossible = 0.0; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; // try with this much smaller as guess double acceptablePivot = currentAcceptablePivot_; double dualT=-currentDualTolerance_; const double multiplier[] = { 1.0, -1.0}; if (ordinaryVariables_) { for (int i=0;i= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iRow; } } } } else { double badFree = 0.0; double freePivot = currentAcceptablePivot_; alpha_ = 0.0; // We can also see if infeasible or pivoting on free for (int i=0;i= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iRow; } } else if ((type&7)<6) { //} else if (getInternalStatus(iRow)==isFree||getInternalStatus(iRow)==superBasic) { bool keep; index[numberNonZero]=iRow; array[numberNonZero++]=piValue; bestPossible = CoinMax(bestPossible, fabs(piValue)); double oldValue = abcDj[iRow]; // If free has to be very large - should come in via dualRow //if (getInternalStatus(iRow+addSequence)==isFree&&fabs(piValue)<1.0e-3) //break; if (oldValue > currentDualTolerance_) { keep = true; } else if (oldValue < -currentDualTolerance_) { keep = true; } else { if (fabs(piValue) > CoinMax(10.0 * currentAcceptablePivot_, 1.0e-5)) { keep = true; } else { keep = false; badFree = CoinMax(badFree, fabs(piValue)); } } if (keep) { // free - choose largest if (fabs(piValue) > freePivot) { freePivot = fabs(piValue); sequenceIn_ = iRow; theta_ = oldValue / piValue; alpha_ = piValue; } } } } } //tableauRow.setNumElements(numberNonZero); //candidateList.setNumElements(numberRemaining); tableauRow.setNumElementsPartition(0,numberNonZero); candidateList.setNumElementsPartition(0,numberRemaining); if (!numberRemaining && sequenceIn_ < 0&&upperTheta_>1.0e29) { return COIN_DBL_MAX; // Looks infeasible } else { return upperTheta; } } /* Array has tableau row Puts candidates in list Returns upper theta (infinity if no pivot) and may set sequenceIn_ if free */ double AbcSimplexDual::dualColumn1B() { CoinPartitionedVector & tableauRow = usefulArray_[arrayForTableauRow_]; CoinPartitionedVector & candidateList = usefulArray_[arrayForDualColumn_]; tableauRow.compact(); candidateList.clearAndReset(); tableauRow.setPackedMode(true); candidateList.setPackedMode(true); int numberRemaining = 0; double upperTheta = upperTheta_; // pivot elements double * COIN_RESTRICT arrayCandidate=candidateList.denseVector(); // indices int * COIN_RESTRICT indexCandidate = candidateList.getIndices(); const double * COIN_RESTRICT abcDj = abcDj_; const unsigned char * COIN_RESTRICT internalStatus = internalStatus_; int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); int numberNonZero=tableauRow.getNumElements(); // do first pass to get possibles double bestPossible = 0.0; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; // try with this much smaller as guess double acceptablePivot = currentAcceptablePivot_; double dualT=-currentDualTolerance_; const double multiplier[] = { 1.0, -1.0}; if (ordinaryVariables_) { for (int i=0;izeroTolerance_) { double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } } } else { double badFree = 0.0; double freePivot = currentAcceptablePivot_; double currentDualTolerance = currentDualTolerance_; for (int i=0;izeroTolerance_) { if ((iStatus&4)==0) { double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } else { bool keep; bestPossible = CoinMax(bestPossible, fabs(tableauValue)); double oldValue = abcDj[iSequence]; // If free has to be very large - should come in via dualRow //if (getInternalStatus(iSequence+addSequence)==isFree&&fabs(tableauValue)<1.0e-3) //break; if (oldValue > currentDualTolerance) { keep = true; } else if (oldValue < -currentDualTolerance) { keep = true; } else { if (fabs(tableauValue) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) { keep = true; } else { keep = false; badFree = CoinMax(badFree, fabs(tableauValue)); } } if (keep) { #ifdef PAN if (fakeSuperBasic(iSequence)>=0) { #endif if (iSequence==freeSequenceIn_) tableauValue=COIN_DBL_MAX; // free - choose largest if (fabs(tableauValue) > fabs(freePivot)) { freePivot = tableauValue; sequenceIn_ = iSequence; theta_ = oldValue / tableauValue; alpha_ = tableauValue; } #ifdef PAN } #endif } } } } } } candidateList.setNumElements(numberRemaining); if (!numberRemaining && sequenceIn_ < 0&&upperTheta_>1.0e29) { return COIN_DBL_MAX; // Looks infeasible } else { return upperTheta; } } //#define MORE_CAREFUL //#define PRINT_RATIO_PROGRESS #define MINIMUMTHETA 1.0e-18 #define MAXTRY 100 #define TOL_TYPE -1 #if TOL_TYPE==-1 #define useTolerance1() (0.0) #define useTolerance2() (0.0) #define goToTolerance1() (0.0) #define goToTolerance2() (0.0) #elif TOL_TYPE==0 #define useTolerance1() (currentDualTolerance_) #define useTolerance2() (currentDualTolerance_) #define goToTolerance1() (0.0) #define goToTolerance2() (0.0) #elif TOL_TYPE==1 #define useTolerance1() (perturbedTolerance) #define useTolerance2() (0.0) #define goToTolerance1() (0.0) #define goToTolerance2() (0.0) #elif TOL_TYPE==2 #define useTolerance1() (perturbedTolerance) #define useTolerance2() (perturbedTolerance) #define goToTolerance1() (0.0) #define goToTolerance2() (0.0) #elif TOL_TYPE==3 #define useTolerance1() (perturbedTolerance) #define useTolerance2() (perturbedTolerance) #define goToTolerance1() (perturbedTolerance) #define goToTolerance2() (0.0) #elif TOL_TYPE==4 #define useTolerance1() (perturbedTolerance) #define useTolerance2() (perturbedTolerance) #define goToTolerance1() (perturbedTolerance) #define goToTolerance2() (perturbedTolerance) #else XXXX #endif #if CLP_CAN_HAVE_ZERO_OBJ<2 #define MODIFYCOST 2 #endif #define DONT_MOVE_OBJECTIVE static void dualColumn2Bit(AbcSimplexDual * dual,dualColumnResult * result, int numberBlocks) { for (int iBlock=1;iBlockdualColumn2First(result[iBlock]); } dual->dualColumn2First(result[0]); cilk_sync; } void AbcSimplexDual::dualColumn2First(dualColumnResult & result) { CoinPartitionedVector & candidateList = usefulArray_[arrayForDualColumn_]; CoinPartitionedVector & flipList = usefulArray_[arrayForFlipBounds_]; int iBlock=result.block; int numberSwapped = result.numberSwapped; int numberRemaining = result.numberRemaining; double tentativeTheta=result.tentativeTheta; // pivot elements double * COIN_RESTRICT array=candidateList.denseVector(); // indices int * COIN_RESTRICT indices = candidateList.getIndices(); const double * COIN_RESTRICT abcLower = abcLower_; const double * COIN_RESTRICT abcUpper = abcUpper_; const double * COIN_RESTRICT abcDj = abcDj_; const unsigned char * COIN_RESTRICT internalStatus = internalStatus_; const double multiplier[] = { 1.0, -1.0}; // For list of flipped int * COIN_RESTRICT flippedIndex = flipList.getIndices(); double * COIN_RESTRICT flippedElement = flipList.denseVector(); // adjust //if (iBlock>=0) { int offset=candidateList.startPartition(iBlock); assert(offset==flipList.startPartition(iBlock)); array += offset; indices+=offset; flippedIndex+=offset; flippedElement+=offset; //} double thruThis = 0.0; double bestPivot = currentAcceptablePivot_; int bestSequence = -1; int numberInList=numberRemaining; numberRemaining = 0; double upperTheta = 1.0e50; double increaseInThis = 0.0; //objective increase in this loop for (int i = 0; i < numberInList; i++) { int iSequence = indices[i]; assert (getInternalStatus(iSequence) != isFree && getInternalStatus(iSequence) != superBasic); int iStatus = internalStatus[iSequence] & 3; // treat as if at lower bound double mult = multiplier[iStatus]; double alpha = array[i]; double oldValue = abcDj[iSequence]*mult; double value = oldValue - tentativeTheta * alpha; assert (alpha>0.0); //double perturbedTolerance = abcPerturbation[iSequence]; if (value < -currentDualTolerance_) { // possible here or could go through double range = abcUpper[iSequence] - abcLower[iSequence]; thruThis += range * alpha; increaseInThis += (oldValue - useTolerance1()) * range; // goes on swapped list (also means candidates if too many) flippedElement[numberSwapped] = alpha; flippedIndex[numberSwapped++] = iSequence; if (alpha > bestPivot) { bestPivot = alpha; bestSequence = iSequence; } } else { // won't go through this time value = oldValue - upperTheta * alpha; if (value < -currentDualTolerance_ && alpha >= currentAcceptablePivot_) upperTheta = (oldValue + currentDualTolerance_) / alpha; array[numberRemaining] = alpha; indices[numberRemaining++] = iSequence; } } result.bestEverPivot=bestPivot; result.sequence=bestSequence; result.numberSwapped=numberSwapped; result.numberRemaining=numberRemaining; result.thruThis=thruThis; result.increaseInThis=increaseInThis; result.theta=upperTheta; } void AbcSimplexDual::dualColumn2Most(dualColumnResult & result) { CoinPartitionedVector & candidateList = usefulArray_[arrayForDualColumn_]; CoinPartitionedVector & flipList = usefulArray_[arrayForFlipBounds_]; int numberBlocksReal=candidateList.getNumPartitions(); flipList.setPartitions(numberBlocksReal,candidateList.startPartitions()); int numberBlocks; if (!numberBlocksReal) numberBlocks=1; else numberBlocks=numberBlocksReal; //usefulArray_[arrayForTableauRow_].compact(); //candidateList.compact(); int numberSwapped = 0; int numberRemaining = candidateList.getNumElements(); double totalThru = 0.0; // for when variables flip int sequenceIn=-1; double bestEverPivot = currentAcceptablePivot_; // If we think we need to modify costs (not if something from broad sweep) bool modifyCosts = false; // Increase in objective due to swapping bounds (may be negative) double increaseInObjective = 0.0; // pivot elements double * COIN_RESTRICT array=candidateList.denseVector(); // indices int * COIN_RESTRICT indices = candidateList.getIndices(); const double * COIN_RESTRICT abcLower = abcLower_; const double * COIN_RESTRICT abcUpper = abcUpper_; //const double * COIN_RESTRICT abcSolution = abcSolution_; const double * COIN_RESTRICT abcDj = abcDj_; //const double * COIN_RESTRICT abcPerturbation = abcPerturbation_; const unsigned char * COIN_RESTRICT internalStatus = internalStatus_; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; // try with this much smaller as guess const double multiplier[] = { 1.0, -1.0}; // For list of flipped int numberLastSwapped=0; int * COIN_RESTRICT flippedIndex = flipList.getIndices(); double * COIN_RESTRICT flippedElement = flipList.denseVector(); // If sum of bad small pivots too much #ifdef MORE_CAREFUL bool badSumPivots = false; #endif // not free int lastSequence = -1; double lastTheta = 0.0; double lastPivotValue = 0.0; double thisPivotValue=0.0; // if free then always choose , otherwise ... double theta = 1.0e50; // now flip flop between spare arrays until reasonable theta tentativeTheta = CoinMax(10.0 * upperTheta_, 1.0e-7); // loops increasing tentative theta until can't go through #ifdef PRINT_RATIO_PROGRESS int iPass=0; #endif dualColumnResult result2[8]; for (int iBlock=0;iBlockbestPivot) { bestPivot=result2[iBlock].bestEverPivot; bestSequence=result2[iBlock].sequence; } numberSwapped+=result2[iBlock].numberSwapped; numberRemaining+=result2[iBlock].numberRemaining; thruThis+=result2[iBlock].thruThis; increaseInThis+=result2[iBlock].increaseInThis; if (upperTheta>result2[iBlock].theta) upperTheta=result2[iBlock].theta; } // end of pass #ifdef PRINT_RATIO_PROGRESS iPass++; printf("Iteration %d pass %d dualOut %g thru %g increase %g numberRemain %d\n", numberIterations_,iPass,fabs(dualOut_),totalThru+thruThis,increaseInObjective+increaseInThis, numberRemaining); #endif if (totalThru + thruThis > fabs(dualOut_)-fabs(1.0e-9*dualOut_)-1.0e-12 || (increaseInObjective + increaseInThis < 0.0&&bestSequence>=0) || !numberRemaining) { // We should be pivoting in this batch // so compress down to this lot numberRemaining=0; candidateList.clearAndReset(); for (int iBlock=0;iBlock0.0); //double perturbedTolerance = abcPerturbation[iSequence]; if (value < -currentDualTolerance_) { if (alpha >= currentAcceptablePivot_) { upperTheta = (oldValue + currentDualTolerance_) / alpha; } } } bestPivot = currentAcceptablePivot_; sequenceIn = -1; double largestPivot = currentAcceptablePivot_; // Sum of bad small pivots #ifdef MORE_CAREFUL double sumBadPivots = 0.0; badSumPivots = false; #endif // Make sure upperTheta will work (-O2 and above gives problems) upperTheta *= 1.0000000001; for (int i = 0; i < numberInList; i++) { int iSequence = indices[i]; int iStatus = internalStatus[iSequence] & 3; // treat as if at lower bound double mult = multiplier[iStatus]; double alpha = array[i]; double oldValue = abcDj[iSequence]*mult; double value = oldValue - upperTheta * alpha; assert (alpha>0.0); //double perturbedTolerance = abcPerturbation[iSequence]; double badDj = 0.0; if (value <= 0.0) { // add to list of swapped flippedElement[numberSwapped] = alpha; flippedIndex[numberSwapped++] = iSequence; badDj = oldValue - useTolerance2(); // select if largest pivot bool take = (alpha > bestPivot); #ifdef MORE_CAREFUL if (alpha < currentAcceptablePivot_ && upperTheta < 1.0e20) { if (value < -currentDualTolerance_) { double gap = abcUpper[iSequence] - abcLower[iSequence]; if (gap < 1.0e20) sumBadPivots -= value * gap; else sumBadPivots += 1.0e20; //printf("bad %d alpha %g dj at lower %g\n", // iSequence,alpha,value); } } #endif if (take&&flagged(iSequence)) { if (bestPivot>currentAcceptablePivot_) take=false; } if (take) { sequenceIn = iSequence; thisPivotValue=alpha; bestPivot = alpha; if (flagged(iSequence)) bestPivot=currentAcceptablePivot_; bestSequence = iSequence; theta = (oldValue+goToTolerance1()) / alpha; //assert (oldValue==abcDj[iSequence]); largestPivot = CoinMax(largestPivot, 0.5 * bestPivot); } double range = abcUpper[iSequence] - abcLower[iSequence]; thruThis += range * fabs(alpha); increaseInThis += badDj * range; } else { // add to list of remaining array[numberRemaining] = alpha; indices[numberRemaining++] = iSequence; } } #ifdef MORE_CAREFUL // If we have done pivots and things look bad set alpha_ 0.0 to force factorization if (sumBadPivots > 1.0e4) { #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() > 1) printf("maybe forcing re-factorization - sum %g %d pivots\n", sumBadPivots, abcFactorization_->pivots()); #endif if(abcFactorization_->pivots() > 3) { badSumPivots = true; #ifdef PRINT_RATIO_PROGRESS printf("maybe forcing re-factorization - sum %g %d pivots\n", sumBadPivots, abcFactorization_->pivots()); #endif break; } } #endif // If we stop now this will be increase in objective (I think) double increase = (fabs(dualOut_) - totalThru) * theta; increase += increaseInObjective; if (theta < 0.0) thruThis += fabs(dualOut_); // force using this one if (((increaseInObjective < 0.0 && increase < 0.0)|| (theta>1.0e9 && lastTheta < 1.0e-5)) && lastSequence >= 0) { // back // We may need to be more careful - we could do by // switch so we always do fine grained? bestPivot = 0.0; bestSequence=-1; } else { // add in totalThru += thruThis; increaseInObjective += increaseInThis; lastTheta=theta; } if (bestPivot < 0.1 * bestEverPivot && bestEverPivot > 1.0e-6 && (bestPivot < 1.0e-3 || totalThru * 2.0 > fabs(dualOut_))) { // back to previous one sequenceIn = lastSequence; thisPivotValue=lastPivotValue; #ifdef PRINT_RATIO_PROGRESS printf("Try %d back to previous bestPivot %g bestEver %g totalThru %g\n", iTry,bestPivot,bestEverPivot,totalThru); #endif break; } else if (sequenceIn == -1 && upperTheta > largeValue_) { if (lastPivotValue > currentAcceptablePivot_) { // back to previous one sequenceIn = lastSequence; thisPivotValue=lastPivotValue; #ifdef PRINT_RATIO_PROGRESS printf("Try %d no pivot this time large theta %g lastPivot %g\n", iTry,upperTheta,lastPivotValue); #endif } else { // can only get here if all pivots too small #ifdef PRINT_RATIO_PROGRESS printf("XXBAD Try %d no pivot this time large theta %g lastPivot %g\n", iTry,upperTheta,lastPivotValue); #endif } break; } else if (totalThru >= fabs(dualOut_)) { #ifdef PRINT_RATIO_PROGRESS printf("Try %d upperTheta %g totalThru %g - can modify costs\n", iTry,upperTheta,lastPivotValue); #endif modifyCosts = true; // fine grain - we can modify costs break; // no point trying another loop } else { lastSequence = sequenceIn; lastPivotValue=thisPivotValue; if (bestPivot > bestEverPivot) { bestEverPivot = bestPivot; //bestEverSequence=bestSequence; } modifyCosts = true; // fine grain - we can modify costs } #ifdef PRINT_RATIO_PROGRESS printf("Onto next pass totalthru %g bestPivot %g\n", totalThru,lastPivotValue); #endif numberLastSwapped=numberSwapped; } break; } else { // skip this lot if (bestPivot > 1.0e-3 || bestPivot > bestEverPivot) { #ifdef PRINT_RATIO_PROGRESS printf("Continuing bestPivot %g bestEver %g %d swapped - new tentative %g\n", bestPivot,bestEverPivot,numberSwapped,2*upperTheta); #endif bestEverPivot = bestPivot; //bestEverSequence=bestSequence; lastPivotValue=bestPivot; lastSequence = bestSequence; for (int iBlock=0;iBlock 100) currentAcceptablePivot_ = acceptablePivot_; if (abcFactorization_->pivots() > 10 || (abcFactorization_->pivots() && sumDualInfeasibilities_)) currentAcceptablePivot_ = 1.0e+3 * acceptablePivot_; // if we have iterated be more strict else if (abcFactorization_->pivots() > 5) currentAcceptablePivot_ = 1.0e+2 * acceptablePivot_; // if we have iterated be slightly more strict else if (abcFactorization_->pivots()) currentAcceptablePivot_ = acceptablePivot_; // relax // If very large infeasibility use larger acceptable pivot if (abcFactorization_->pivots()) { double value=CoinMax(currentAcceptablePivot_,1.0e-12*fabs(dualOut_)); currentAcceptablePivot_=CoinMin(1.0e2*currentAcceptablePivot_,value); } // return at once if no free but there were free if (lastFirstFree_>=0&&sequenceIn_<0) { candidateList.clearAndReset(); upperTheta_=COIN_DBL_MAX; } if (upperTheta_==COIN_DBL_MAX) { usefulArray_[arrayForTableauRow_].compact(); assert (!candidateList.getNumElements()); return; } int numberSwapped = 0; //int numberRemaining = candidateList.getNumElements(); double useThru = 0.0; // for when variables flip // If we think we need to modify costs (not if something from broad sweep) bool modifyCosts = false; // pivot elements //double * COIN_RESTRICT array=candidateList.denseVector(); // indices const double * COIN_RESTRICT abcLower = abcLower_; const double * COIN_RESTRICT abcUpper = abcUpper_; const double * COIN_RESTRICT abcSolution = abcSolution_; const double * COIN_RESTRICT abcDj = abcDj_; //const double * COIN_RESTRICT abcPerturbation = abcPerturbation_; const unsigned char * COIN_RESTRICT internalStatus = internalStatus_; // We can also see if infeasible or pivoting on free const double multiplier[] = { 1.0, -1.0}; // For list of flipped int numberLastSwapped=0; int * COIN_RESTRICT flippedIndex = flipList.getIndices(); double * COIN_RESTRICT flippedElement = flipList.denseVector(); // If sum of bad small pivots too much #ifdef MORE_CAREFUL bool badSumPivots = false; #endif if (sequenceIn_<0) { int lastSequence = -1; double lastPivotValue = 0.0; double thisPivotValue=0.0; dualColumnResult result; dualColumn2Most(result); sequenceIn_=result.sequence; lastSequence=result.lastSequence; thisPivotValue=result.thisPivotValue; lastPivotValue=result.lastPivotValue; numberSwapped=result.numberSwapped; numberLastSwapped=result.numberLastSwapped; modifyCosts=result.modifyCosts; useThru=result.useThru; #ifdef PRINT_RATIO_PROGRESS printf("Iteration %d - out of loop - sequenceIn %d pivotValue %g\n", numberIterations_,sequenceIn_,thisPivotValue); #endif // can get here without sequenceIn_ set but with lastSequence if (sequenceIn_ < 0 && lastSequence >= 0) { // back to previous one sequenceIn_ = lastSequence; thisPivotValue=lastPivotValue; #ifdef PRINT_RATIO_PROGRESS printf("BUT back one - out of loop - sequenceIn %d pivotValue %g\n", sequenceIn_,thisPivotValue); #endif } // Movement should be minimum for anti-degeneracy - unless // fixed variable out // no need if just one candidate assert( numberSwapped-numberLastSwapped>=0); double minimumTheta; if (upperOut_ > lowerOut_&&numberSwapped-numberLastSwapped>1) #ifndef TRY_ABC_GUS minimumTheta = MINIMUMTHETA; #else minimumTheta = minimumThetaMovement_; #endif else minimumTheta = 0.0; if (sequenceIn_ >= 0) { double oldValue; alpha_ = thisPivotValue; // correct sign int iStatus = internalStatus[sequenceIn_] & 3; alpha_ *= multiplier[iStatus]; oldValue = abcDj[sequenceIn_]; theta_ = CoinMax(oldValue / alpha_, 0.0); if (theta_ < minimumTheta && fabs(alpha_) < 1.0e5 && 1) { // can't pivot to zero theta_ = minimumTheta; } // may need to adjust costs so all dual feasible AND pivoted is exactly 0 if (modifyCosts #ifdef MORE_CAREFUL &&!badSumPivots #endif ) { for (int i = numberLastSwapped; i < numberSwapped; i++) { int iSequence = flippedIndex[i]; int iStatus = internalStatus[iSequence] & 3; // treat as if at lower bound double mult = multiplier[iStatus]; double alpha = flippedElement[i]; flippedElement[i]=0.0; if (iSequence==sequenceIn_) continue; double oldValue = abcDj[iSequence]*mult; double value = oldValue - theta_ * alpha; //double perturbedTolerance = abcPerturbation[iSequence]; if (-value > currentDualTolerance_) { //thisIncrease = true; #if MODIFYCOST if (numberIterations_>=normalDualColumnIteration_) { // modify cost to hit new tolerance double modification = alpha * theta_ - oldValue - currentDualTolerance_; if ((specialOptions_&(2048 + 4096)) != 0) { if ((specialOptions_ & 2048) != 0) { if (fabs(modification) < 1.0e-10) modification = 0.0; } else { if (fabs(modification) < 1.0e-12) modification = 0.0; } } abcDj_[iSequence] += mult*modification; abcCost_[iSequence] += mult*modification; if (modification) numberChanged_ ++; // Say changed costs } #endif } } numberSwapped=numberLastSwapped; } } } #ifdef MORE_CAREFUL // If we have done pivots and things look bad set alpha_ 0.0 to force factorization if ((badSumPivots || fabs(theta_ * badFree) > 10.0 * currentDualTolerance_) && abcFactorization_->pivots()) { #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() > 1) printf("forcing re-factorization\n"); #endif sequenceIn_ = -1; } #endif if (sequenceIn_ >= 0) { lowerIn_ = abcLower[sequenceIn_]; upperIn_ = abcUpper[sequenceIn_]; valueIn_ = abcSolution[sequenceIn_]; dualIn_ = abcDj_[sequenceIn_]; if (numberTimesOptimal_) { // can we adjust cost back closer to original //*** add coding } if (numberIterations_>=normalDualColumnIteration_) { #if MODIFYCOST>1 // modify cost to hit zero exactly // so (dualIn_+modification)==theta_*alpha_ //double perturbedTolerance = abcPerturbation[sequenceIn_]; double modification = theta_ * alpha_ - (dualIn_+goToTolerance2()); // But should not move objective too much ?? #ifdef DONT_MOVE_OBJECTIVE double moveObjective = fabs(modification * abcSolution[sequenceIn_]); double smallMove = CoinMax(fabs(rawObjectiveValue_), 1.0e-3); if (moveObjective > smallMove) { #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() > 1) printf("would move objective by %g - original mod %g sol value %g\n", moveObjective, modification, abcSolution[sequenceIn_]); #endif modification *= smallMove / moveObjective; } #endif #ifdef MORE_CAREFUL if (badSumPivots) modification = 0.0; #endif if (atFakeBound(sequenceIn_)&&fabs(modification)3 if ((handler_->logLevel() & 32) && fabs(modification) > 1.0e-15) printf("exact %d new cost %g, change %g\n", sequenceIn_, abcCost_[sequenceIn_], modification); #endif #endif } if (alpha_ < 0.0) { // as if from upper bound directionIn_ = -1; upperIn_ = valueIn_; } else { // as if from lower bound directionIn_ = 1; lowerIn_ = valueIn_; } } else { // no pivot alpha_ = 0.0; } // clear array //printf("dualout %g theta %g alpha %g dj %g thru %g swapped %d product %g guess %g useThru %g\n", // dualOut_,theta_,alpha_,abcDj_[sequenceIn_],useThru,numberSwapped, // fabs(dualOut_)*theta_,objectiveValue()+(fabs(dualOut_)-useThru)*theta_,useThru); objectiveChange_ = (fabs(dualOut_)-useThru)*theta_; rawObjectiveValue_+= objectiveChange_; //CoinZeroN(array, maximumNumberInList); //candidateList.setNumElements(0); candidateList.clearAndReset(); flipList.setNumElements(numberSwapped); if (numberSwapped) flipList.setPackedMode(true); #ifdef PRINT_RATIO_PROGRESS printf("%d flipped\n",numberSwapped); #endif } /* Checks if tentative optimal actually means unbounded Returns -3 if not, 2 if is unbounded */ int AbcSimplexDual::checkUnbounded(CoinIndexedVector & ray, double changeCost) { int status = 2; // say unbounded abcFactorization_->updateColumn(ray); // get reduced cost int number = ray.getNumElements(); int * COIN_RESTRICT index = ray.getIndices(); double * COIN_RESTRICT array = ray.denseVector(); const int * COIN_RESTRICT abcPivotVariable = abcPivotVariable_; for (int i = 0; i < number; i++) { int iRow = index[i]; int iPivot = abcPivotVariable[iRow]; changeCost -= cost(iPivot) * array[iRow]; } double way; if (changeCost > 0.0) { //try going down way = 1.0; } else if (changeCost < 0.0) { //try going up way = -1.0; } else { #if ABC_NORMAL_DEBUG>3 printf("can't decide on up or down\n"); #endif way = 0.0; status = -3; } double movement = 1.0e10 * way; // some largish number double zeroTolerance = 1.0e-14 * dualBound_; for (int i = 0; i < number; i++) { int iRow = index[i]; int iPivot = abcPivotVariable[iRow]; double arrayValue = array[iRow]; if (fabs(arrayValue) < zeroTolerance) arrayValue = 0.0; double newValue = solution(iPivot) + movement * arrayValue; if (newValue > upper(iPivot) + primalTolerance_ || newValue < lower(iPivot) - primalTolerance_) status = -3; // not unbounded } if (status == 2) { // create ray delete [] ray_; ray_ = new double [numberColumns_]; CoinZeroN(ray_, numberColumns_); for (int i = 0; i < number; i++) { int iRow = index[i]; int iPivot = abcPivotVariable[iRow]; double arrayValue = array[iRow]; if (iPivot < numberColumns_ && fabs(arrayValue) >= zeroTolerance) ray_[iPivot] = way * array[iRow]; } } ray.clear(); return status; } // Saves good status etc void AbcSimplex::saveGoodStatus() { // save arrays CoinMemcpyN(internalStatus_, numberTotal_, internalStatusSaved_); // save costs CoinMemcpyN(abcCost_,numberTotal_,abcCost_+2*numberTotal_); CoinMemcpyN(abcSolution_,numberTotal_,solutionSaved_); } // Restores previous good status and says trouble void AbcSimplex::restoreGoodStatus(int type) { #if PARTITION_ROW_COPY==1 stateOfProblem_ |= NEED_BASIS_SORT; #endif if (type) { if (alphaAccuracy_ != -1.0) alphaAccuracy_ = -2.0; // trouble - restore solution CoinMemcpyN(internalStatusSaved_, numberTotal_, internalStatus_); CoinMemcpyN(abcCost_+2*numberTotal_,numberTotal_,abcCost_); CoinMemcpyN(solutionSaved_,numberTotal_, abcSolution_); int * COIN_RESTRICT abcPivotVariable = abcPivotVariable_; // redo pivotVariable int numberBasic=0; for (int i=0;iusefulArray(whichArray[0]); CoinIndexedVector * array2 = model->usefulArray(whichArray[1]); int numberRefinements=model->computePrimals(array1,array2); model->checkPrimalSolution(true); return numberRefinements; } static int computeDualsAndCheck(AbcSimplexDual * model,const int whichArray[2]) { CoinIndexedVector * array1 = model->usefulArray(whichArray[0]); CoinIndexedVector * array2 = model->usefulArray(whichArray[1]); int numberRefinements=model->computeDuals(NULL,array1,array2); model->checkDualSolutionPlusFake(); return numberRefinements; } // Computes solutions - 1 do duals, 2 do primals, 3 both int AbcSimplex::gutsOfSolution(int type) { double oldLargestPrimalError=largestPrimalError_; double oldLargestDualError=largestDualError_; AbcSimplexDual * dual = reinterpret_cast(this); // do work and check int numberRefinements=0; #if ABC_PARALLEL if (type!=3) { #endif if ((type&2)!=0) { //work space int whichArray[2]; for (int i=0;i<2;i++) whichArray[i]=getAvailableArray(); numberRefinements=computePrimalsAndCheck(dual,whichArray); for (int i=0;i<2;i++) setAvailableArray(whichArray[i]); } if ((type&1)!=0 #if CAN_HAVE_ZERO_OBJ>1 &&(specialOptions_&2097152)==0 #endif ) { //work space int whichArray[2]; for (int i=0;i<2;i++) whichArray[i]=getAvailableArray(); numberRefinements+=computeDualsAndCheck(dual,whichArray); for (int i=0;i<2;i++) setAvailableArray(whichArray[i]); } #if ABC_PARALLEL } else { #ifndef NDEBUG abcFactorization_->checkMarkArrays(); #endif // redo to do in parallel //work space int whichArray[5]; for (int i=1;i<5;i++) whichArray[i]=getAvailableArray(); if (parallelMode_==0) { numberRefinements+=computePrimalsAndCheck(dual,whichArray+3); numberRefinements+=computeDualsAndCheck(dual,whichArray+1); } else { #if ABC_PARALLEL==1 threadInfo_[0].stuff[0]=whichArray[1]; threadInfo_[0].stuff[1]=whichArray[2]; stopStart_=1+32*1; startParallelStuff(1); #else whichArray[0]=1; CoinThreadInfo info; info.status=1; info.stuff[0]=whichArray[1]; info.stuff[1]=whichArray[2]; int n=cilk_spawn computeDualsAndCheck(dual,whichArray+1); #endif numberRefinements=computePrimalsAndCheck(dual,whichArray+3); #if ABC_PARALLEL==1 numberRefinements+=stopParallelStuff(1); #else cilk_sync; numberRefinements+=n; #endif } for (int i=1;i<5;i++) setAvailableArray(whichArray[i]); } #endif rawObjectiveValue_ +=sumNonBasicCosts_; setClpSimplexObjectiveValue(); if (handler_->logLevel() > 3 || (largestPrimalError_ > 1.0e-2 || largestDualError_ > 1.0e-2)) handler_->message(CLP_SIMPLEX_ACCURACY, messages_) << largestPrimalError_ << largestDualError_ << CoinMessageEol; if ((largestPrimalError_ > 1.0e1||largestDualError_>1.0e1) && numberRows_ > 100 && numberIterations_) { #if ABC_NORMAL_DEBUG>0 printf("Large errors - primal %g dual %g\n", largestPrimalError_,largestDualError_); #endif // Change factorization tolerance //if (abcFactorization_->zeroTolerance() > 1.0e-18) //abcFactorization_->zeroTolerance(1.0e-18); } bool notChanged=true; if (numberIterations_ && (forceFactorization_ > 2 || forceFactorization_<0 || abcFactorization_->pivotTolerance()<0.9899999999) && (oldLargestDualError||oldLargestPrimalError)) { double useOldDualError=oldLargestDualError; double useDualError=largestDualError_; if (algorithm_>0&&abcNonLinearCost_&& abcNonLinearCost_->sumInfeasibilities()) { double factor=CoinMax(1.0,CoinMin(1.0e3,infeasibilityCost_*1.0e-6)); useOldDualError /= factor; useDualError /= factor; } if ((largestPrimalError_>1.0e3&& oldLargestPrimalError*1.0e21.0e3&& useOldDualError*1.0e2pivotTolerance(); double factor=(largestPrimalError_>1.0e10||largestDualError_>1.0e10) ? 2.0 : 1.2; if (pivotTolerance<0.1) abcFactorization_->pivotTolerance(0.1); else if (pivotTolerance<0.98999999) abcFactorization_->pivotTolerance(CoinMin(0.99,pivotTolerance*factor)); notChanged=pivotTolerance==abcFactorization_->pivotTolerance(); #if defined(CLP_USEFUL_PRINTOUT) && !defined(GCC_4_9) if (pivotTolerance<0.9899999) { double newTolerance=abcFactorization_->pivotTolerance(); printf("Changing pivot tolerance from %g to %g and backtracking\n", pivotTolerance,newTolerance); } printf("because old,new primal error %g,%g - dual %g,%g pivot_tol %g\n", oldLargestPrimalError,largestPrimalError_, oldLargestDualError,largestDualError_, pivotTolerance); #endif if (pivotTolerance<0.9899999) { //largestPrimalError_=0.0; //largestDualError_=0.0; //returnCode=1; } } } if (progress_.iterationNumber_[0]>0&& progress_.iterationNumber_[CLP_PROGRESS-1] -progress_.iterationNumber_[0]pivotTolerance()<0.25&¬Changed) { double pivotTolerance = abcFactorization_->pivotTolerance(); abcFactorization_->pivotTolerance(pivotTolerance*1.5); #if defined(CLP_USEFUL_PRINTOUT) && !defined(GCC_4_9) double newTolerance=abcFactorization_->pivotTolerance(); printf("Changing pivot tolerance from %g to %g - inverting too often\n", pivotTolerance,newTolerance); #endif } return numberRefinements; } // Make non free variables dual feasible by moving to a bound int AbcSimplexDual::makeNonFreeVariablesDualFeasible(bool changeCosts) { const double multiplier[] = { 1.0, -1.0}; // sign????????????? double dualT = - 100.0*currentDualTolerance_; int numberMoved=0; int numberChanged=0; double * COIN_RESTRICT solution = abcSolution_; double * COIN_RESTRICT lower = abcLower_; double * COIN_RESTRICT upper = abcUpper_; double saveNonBasicCosts =sumNonBasicCosts_; double largestCost=dualTolerance_; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { unsigned char iStatus = internalStatus_[iSequence] & 7; if (iStatus<4) { double mult = multiplier[iStatus]; double dj = abcDj_[iSequence] * mult; if (dj < dualT) { largestCost=CoinMax(fabs(abcPerturbation_[iSequence]),largestCost); } } else if (iStatus!=7) { largestCost=CoinMax(fabs(abcPerturbation_[iSequence]),largestCost); } } for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { unsigned char iStatus = internalStatus_[iSequence] & 7; if (iStatus<4) { double mult = multiplier[iStatus]; double dj = abcDj_[iSequence] * mult; // ? should use perturbationArray if (dj < dualT&&changeCosts) { double gap=upper[iSequence]-lower[iSequence]; if (gap>1.1*currentDualBound_) { assert(getFakeBound(iSequence)==AbcSimplexDual::noFake); if (!iStatus) { upper[iSequence]=lower[iSequence]+currentDualBound_; setFakeBound(iSequence, AbcSimplexDual::upperFake); } else { lower[iSequence]=upper[iSequence]-currentDualBound_; setFakeBound(iSequence, AbcSimplexDual::lowerFake); } } double costDifference=abcPerturbation_[iSequence]-abcCost_[iSequence]; if (costDifference*mult>0.0) { #if ABC_NORMAL_DEBUG>0 //printf("can improve situation on %d by %g\n",iSequence,costDifference*mult); #endif dj+=costDifference*mult; abcDj_[iSequence]+=costDifference; abcCost_[iSequence]=abcPerturbation_[iSequence]; costDifference=0.0; } double changeInObjective=-gap*dj; // probably need to be more intelligent if ((changeInObjective>1.0e3||gap>CoinMax(0.5*dualBound_,1.0e3))&&dj>-1.0e-1) { // change cost costDifference=(-dj-0.5*dualTolerance_)*mult; if (fabs(costDifference)<100000.0*dualTolerance_) { dj+=costDifference*mult; abcDj_[iSequence]+=costDifference; abcCost_[iSequence]+=costDifference; numberChanged++; } } } if (dj < dualT&&!changeCosts) { numberMoved++; if (iStatus==0) { // at lower bound // to upper bound setInternalStatus(iSequence, atUpperBound); solution[iSequence] = upper[iSequence]; sumNonBasicCosts_ += abcCost_[iSequence]*(upper[iSequence]-lower[iSequence]); } else { // at upper bound // to lower bound setInternalStatus(iSequence, atLowerBound); solution[iSequence] = lower[iSequence]; sumNonBasicCosts_ -= abcCost_[iSequence]*(upper[iSequence]-lower[iSequence]); } } } } #if ABC_NORMAL_DEBUG>0 if (numberMoved+numberChanged) printf("makeDualfeasible %d moved, %d had costs changed - sum dual %g\n", numberMoved,numberChanged,sumDualInfeasibilities_); #endif rawObjectiveValue_ +=(sumNonBasicCosts_-saveNonBasicCosts); setClpSimplexObjectiveValue(); return numberMoved; } int AbcSimplexDual::whatNext() { int returnCode=0; assert (!stateOfIteration_); // see if update stable #if ABC_NORMAL_DEBUG>3 if ((handler_->logLevel() & 32)) printf("btran alpha %g, ftran alpha %g\n", btranAlpha_, alpha_); #endif int numberPivots=abcFactorization_->pivots(); //double checkValue = 1.0e-7; // numberPivots<5 ? 1.0e-7 : 1.0e-6; double checkValue = numberPivots ? 1.0e-7 : 1.0e-5; // relax if free variable in if ((internalStatus_[sequenceIn_]&7)>1) checkValue=1.0e-5; // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) checkValue = CoinMin(1.0e-4, 1.0e-8 * largestPrimalError_); if (fabs(btranAlpha_) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha_ - alpha_) > checkValue*(1.0 + fabs(alpha_))) { handler_->message(CLP_DUAL_CHECK, messages_) << btranAlpha_ << alpha_ << CoinMessageEol; // see with more relaxed criterion double test; if (fabs(btranAlpha_) < 1.0e-8 || fabs(alpha_) < 1.0e-8) test = 1.0e-1 * fabs(alpha_); else test = 10.0*checkValue;//1.0e-4 * (1.0 + fabs(alpha_)); bool needFlag = (fabs(btranAlpha_) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha_ - alpha_) > test); #if ABC_NORMAL_DEBUG>0 if (fabs(btranAlpha_ + alpha_) < 1.0e-5*(1.0 + fabs(alpha_))) { printf("alpha diff (%g,%g) %g check %g\n",btranAlpha_,alpha_,fabs(btranAlpha_-alpha_),checkValue*(1.0+fabs(alpha_))); } #endif if (numberPivots) { if (needFlag&&numberPivots<10) { // need to reject something assert (sequenceOut_>=0); char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>0 printf("flag %d as alpha %g %g - after %d pivots\n", sequenceOut_, btranAlpha_, alpha_,numberPivots); #endif // Make safer? abcFactorization_->saferTolerances (1.0, -1.03); setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; lastBadIteration_ = numberIterations_; // say be more cautious } // Make safer? //if (numberPivots<5) //abcFactorization_->saferTolerances (-0.99, -1.01); problemStatus_ = -2; // factorize now returnCode = -2; stateOfIteration_=2; } else { if (needFlag) { // need to reject something assert (sequenceOut_>=0); char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>3 printf("flag a %g %g\n", btranAlpha_, alpha_); #endif // Make safer? double tolerance=abcFactorization_->pivotTolerance(); abcFactorization_->saferTolerances (1.0, -1.03); setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; //abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious if (fabs(alpha_) < 1.0e-10 && fabs(btranAlpha_) < 1.0e-8 && numberIterations_ > 100) { //printf("I think should declare infeasible\n"); problemStatus_ = 1; returnCode = 1; stateOfIteration_=2; } else { stateOfIteration_=1; if (tolerancepivotTolerance()) { stateOfIteration_=2; returnCode=-2; } } } } } if (!stateOfIteration_) { // check update returnCode=abcFactorization_->checkReplacePart2(pivotRow_,btranAlpha_,alpha_,ftAlpha_); } return returnCode; } /* Checks if finished. type 0 initial 1 normal 2 initial but we have solved problem before 3 can skip factorization Updates status */ void AbcSimplexDual::statusOfProblemInDual(int type) { // If lots of iterations then adjust costs if large ones int numberPivots = abcFactorization_->pivots(); #if 0 printf("statusOf %d pivots type %d pstatus %d forceFac %d dont %d\n", numberPivots,type,problemStatus_,forceFactorization_,dontFactorizePivots_); #endif int saveType=type; double lastSumDualInfeasibilities=sumDualInfeasibilities_; double lastSumPrimalInfeasibilities=sumPrimalInfeasibilities_; if (type>=4) { // force factorization type &= 3; numberPivots=9999999; } //double realDualInfeasibilities = 0.0; double changeCost; bool unflagVariables = numberFlagged_>0; int weightsSaved = 0; int numberBlackMarks=0; if (!type) { // be optimistic stateOfProblem_ &= ~PESSIMISTIC; // but use 0.1 double newTolerance = CoinMax(0.1, saveData_.pivotTolerance_); abcFactorization_->pivotTolerance(newTolerance); } if (type != 3&&(numberPivots>dontFactorizePivots_||numberIterations_==baseIteration_)) { // factorize // save dual weights abcDualRowPivot_->saveWeights(this, 1); weightsSaved = 2; // is factorization okay? int factorizationStatus=0; if ((largestPrimalError_ > 1.0e1||largestDualError_>1.0e1) && numberRows_ > 100 && numberIterations_>baseIteration_) { double newTolerance = CoinMin(1.1* abcFactorization_->pivotTolerance(), 0.99); abcFactorization_->pivotTolerance(newTolerance); } #ifdef EARLY_FACTORIZE if ((numberEarly_&0xffff)<=5||!usefulArray_[ABC_NUMBER_USEFUL-1].getNumElements()) { //#define KEEP_TRYING_EARLY #ifdef KEEP_TRYING_EARLY int savedEarly=numberEarly_>>16; int newEarly=(numberEarly_&0xffff); newEarly=CoinMin(savedEarly,1+2*newEarly); numberEarly_=(savedEarly<<16)|newEarly; #endif factorizationStatus = internalFactorize(type ? 1 : 2); } else { CoinIndexedVector & vector = usefulArray_[ABC_NUMBER_USEFUL-1]; bool bad = vector.getNumElements()<0; const int * indices = vector.getIndices(); double * array = vector.denseVector(); int capacity = vector.capacity(); capacity--; int numberPivotsStored = indices[capacity]; #if ABC_NORMAL_DEBUG>0 printf("early status %s nPivots %d\n",bad ? "bad" : "good",numberPivotsStored); #endif if (!bad) { // do remaining pivots int iterationsDone=abcEarlyFactorization_->pivots(); factorizationStatus = abcEarlyFactorization_->replaceColumns(this,vector, iterationsDone,numberPivotsStored,true); if (!factorizationStatus) { // should be able to compare e.g. basics 1.0 #define GOOD_EARLY #ifdef GOOD_EARLY AbcSimplexFactorization * temp = abcFactorization_; abcFactorization_=abcEarlyFactorization_; abcEarlyFactorization_=temp; #endif moveToBasic(); #ifndef GOOD_EARLY int * pivotSave = CoinCopyOfArray(abcPivotVariable_,numberRows_); factorizationStatus = internalFactorize(type ? 1 : 2); { double * array = usefulArray_[3].denseVector(); double * array2 = usefulArray_[4].denseVector(); for (int iPivot = 0; iPivot < numberRows_; iPivot++) { int iSequence = abcPivotVariable_[iPivot]; unpack(usefulArray_[3], iSequence); unpack(usefulArray_[4], iSequence); abcFactorization_->updateColumn(usefulArray_[3]); abcEarlyFactorization_->updateColumn(usefulArray_[4]); assert (fabs(array[iPivot] - 1.0) < 1.0e-4); array[iPivot] = 0.0; int iPivot2; for (iPivot2=0;iPivot20 printf("switching off early factorization(in statusOf)\n"); #endif #ifndef KEEP_TRYING_EARLY numberEarly_=0; delete abcEarlyFactorization_; abcEarlyFactorization_=NULL; #else numberEarly_&=0xffff0000; #endif factorizationStatus = internalFactorize(1); } } #else factorizationStatus = internalFactorize(type ? 1 : 2); #endif if (factorizationStatus) { if (type == 1&&lastFlaggedIteration_!=1) { // use for real disaster lastFlaggedIteration_ = 1; // no - restore previous basis unflagVariables = false; // restore weights weightsSaved = 4; changeMade_++; // say something changed // Keep any flagged variables for (int i = 0; i < numberTotal_; i++) { if (flagged(i)) internalStatusSaved_[i] |= 64; //say flagged } restoreGoodStatus(type); // get correct bounds on all variables resetFakeBounds(1); numberBlackMarks=10; if (sequenceOut_>=0) { // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>3 printf("flag d\n"); #endif setFlagged(sequenceOut_); lastBadIteration_ = numberIterations_; // say be more cautious // so can't happen immediately again sequenceOut_=-1; } //abcProgress_.clearBadTimes(); // Go to safe abcFactorization_->pivotTolerance(0.99); } else { #if ABC_NORMAL_DEBUG>0 printf("Bad initial basis\n"); #endif } if (internalFactorize(1)) { // try once more if (internalFactorize(0)) abort(); } #if PARTITION_ROW_COPY==1 int iVector=getAvailableArray(); abcMatrix_->sortUseful(usefulArray_[iVector]); setAvailableArray(iVector); #endif } else { lastFlaggedIteration_ = 0; } } // get primal and dual solutions numberBlackMarks+=gutsOfSolution(3)/2; assert (type!=0||numberIterations_==baseIteration_); // may be wrong if (!type) { initialSumInfeasibilities_=sumPrimalInfeasibilities_; initialNumberInfeasibilities_=numberPrimalInfeasibilities_; CoinAbcMemcpy(solutionSaved_+numberTotal_,abcSolution_,numberTotal_); CoinAbcMemcpy(internalStatusSaved_+numberTotal_,internalStatus_,numberTotal_); } double savePrimalInfeasibilities=sumPrimalInfeasibilities_; if ((moreSpecialOptions_&16384)!=0&&(moreSpecialOptions_&8192)==0) { if (numberIterations_==baseIteration_) { // If primal feasible and looks suited to primal go to primal if (!sumPrimalInfeasibilities_&&sumDualInfeasibilities_>1.0&& numberRows_*4>numberColumns_) { // do primal // mark so can perturb initialSumInfeasibilities_=-1.0; problemStatus_=10; return; } } else if ((numberIterations_>1000&& numberIterations_*10>numberRows_&&numberIterations_*4 1.0e10*(initialSumInfeasibilities_+1000.0)&&numberIterations_>10000&&sumDualInfeasibilities_>1.0)) { if (sumPrimalInfeasibilities_+1.0e2*sumDualInfeasibilities_> 2000.0*(initialSumInfeasibilities_+100.0)) { #if ABC_NORMAL_DEBUG>0 printf ("sump %g sumd %g initial %g\n",sumPrimalInfeasibilities_,sumDualInfeasibilities_, initialSumInfeasibilities_); #endif // but only if average gone up as well if (sumPrimalInfeasibilities_*initialNumberInfeasibilities_> 100.0*(initialSumInfeasibilities_+10.0)*numberPrimalInfeasibilities_) { #if ABC_NORMAL_DEBUG>0 printf("returning to do primal\n"); #endif // do primal problemStatus_=10; CoinAbcMemcpy(abcSolution_,solutionSaved_+numberTotal_,numberTotal_); CoinAbcMemcpy(internalStatus_,internalStatusSaved_+numberTotal_,numberTotal_); // mark so can perturb initialSumInfeasibilities_=-1.0; return; } } } } else if ((sumPrimalInfeasibilities_+sumDualInfeasibilities_> 1.0e6*(initialSumInfeasibilities_+1000.0)&&(moreSpecialOptions_&8192)==0&& numberIterations_>1000&& numberIterations_*10>numberRows_&&numberIterations_*4 1.0e10*(initialSumInfeasibilities_+1000.0)&&(moreSpecialOptions_&8192)==0&& numberIterations_>10000&&sumDualInfeasibilities_>1.0)) { // do primal problemStatus_=10; CoinAbcMemcpy(abcSolution_,solutionSaved_+numberTotal_,numberTotal_); CoinAbcMemcpy(internalStatus_,internalStatusSaved_+numberTotal_,numberTotal_); // mark so can perturb initialSumInfeasibilities_=-1.0; return; } //double saveDualInfeasibilities=sumDualInfeasibilities_; // 0 don't ignore, 1 ignore errors, 2 values pass int ignoreStuff=(firstFree_<0&&lastFirstFree_<0) ? 0 : 1; if ((stateOfProblem_&VALUES_PASS)!=0) ignoreStuff=2; { double thisObj = rawObjectiveValue(); double lastObj = abcProgress_.lastObjective(0); if ((lastObj > thisObj + 1.0e-3 * CoinMax(fabs(thisObj), fabs(lastObj)) + 1.0e-4|| (sumPrimalInfeasibilities_>10.0*lastSumPrimalInfeasibilities+1.0e3&& sumDualInfeasibilities_>10.0*CoinMax(lastSumDualInfeasibilities,1.0))) &&!ignoreStuff) { #if ABC_NORMAL_DEBUG>0 printf("bad - objective backwards %g %g errors %g %g suminf %g %g\n",lastObj,thisObj,largestDualError_,largestPrimalError_,sumDualInfeasibilities_,sumPrimalInfeasibilities_); #endif numberBlackMarks++; if (largestDualError_>1.0e-3||largestPrimalError_>1.0e-3|| (sumDualInfeasibilities_>10.0*CoinMax(lastSumDualInfeasibilities,1.0) &&firstFree_<0)) { #if ABC_NORMAL_DEBUG>0 printf("backtracking %d iterations - dual error %g primal error %g - sumDualInf %g\n", numberPivots, largestDualError_,largestPrimalError_,sumDualInfeasibilities_); #endif // restore previous basis unflagVariables = false; // restore weights weightsSaved = 4; changeMade_++; // say something changed // Keep any flagged variables for (int i = 0; i < numberTotal_; i++) { if (flagged(i)) internalStatusSaved_[i] |= 64; //say flagged } restoreGoodStatus(type); // get correct bounds on all variables resetFakeBounds(1); numberBlackMarks+=10; if (sequenceOut_>=0) { // need to reject something #if ABC_NORMAL_DEBUG>0 if (flagged(sequenceOut_)) printf("BAD %x already flagged\n",sequenceOut_); #endif char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>3 printf("flag d\n"); #endif setFlagged(sequenceOut_); lastBadIteration_ = numberIterations_; // say be more cautious #if ABC_NORMAL_DEBUG>0 } else { printf("backtracking - no valid sequence out\n"); #endif } // so can't happen immediately again sequenceOut_=-1; //abcProgress_.clearBadTimes(); // Go to safe //abcFactorization_->pivotTolerance(0.99); if (internalFactorize(1)) { abort(); } moveToBasic(); #if PARTITION_ROW_COPY==1 int iVector=getAvailableArray(); abcMatrix_->sortUseful(usefulArray_[iVector]); setAvailableArray(iVector); #endif // get primal and dual solutions numberBlackMarks+=gutsOfSolution(3); //gutsOfSolution(1); makeNonFreeVariablesDualFeasible(); } } } //#define PAN #ifdef PAN if (!type&&(specialOptions_&COIN_CBC_USING_CLP)==0&&firstFree_<0) { // first time - set large bad ones superbasic int whichArray=getAvailableArray(); double * COIN_RESTRICT work=usefulArray_[whichArray].denseVector(); int number=0; int * COIN_RESTRICT which=usefulArray_[whichArray].getIndices(); const double * COIN_RESTRICT reducedCost=abcDj_; const double * COIN_RESTRICT lower=abcLower_; const double * COIN_RESTRICT upper=abcUpper_; #if PRINT_PAN int nAtUb=0; #endif for (int i=0;i100000000.0) badValue = -djValue*CoinMin(gap,1.0e10); } else if (status==atUpperBound&&djValue>currentDualTolerance_) { double gap=upper[i]-lower[i]; if (gap>100000000.0) { badValue = djValue*CoinMin(gap,1.0e10); #if PRINT_PAN nAtUb++; #endif } } if (badValue) { work[number]=badValue; which[number++]=i; } } // for now don't do if primal feasible (probably should go to primal) if (!numberPrimalInfeasibilities_) { number=0; #if ABC_NORMAL_DEBUG>1 printf("XXXX doesn't work if primal feasible - also fix switch to Clp primal\n"); #endif } if (number&&ignoreStuff!=2) { CoinSort_2(work,work+number,which); int numberToDo=CoinMin(number,numberRows_/10); // ?? #if PRINT_PAN>1 CoinSort_2(which,which+numberToDo,work); int n=0; #endif #if PRINT_PAN printf("Panning %d variables (out of %d at lb and %d at ub)\n",numberToDo,number-nAtUb,nAtUb); #endif firstFree_=numberTotal_; for (int i=0;i1 if (!n) printf("Pan "); printf("%d ",iSequence); n++; if (n==10) { n=0; printf("\n"); } #endif setInternalStatus(iSequence,superBasic); firstFree_=CoinMin(firstFree_,iSequence); } #if PRINT_PAN>1 if (n) printf("\n"); #endif ordinaryVariables_=0; CoinAbcMemset0(work,number); stateOfProblem_ |= FAKE_SUPERBASIC; } setAvailableArray(whichArray); } #endif if (!sumOfRelaxedPrimalInfeasibilities_&&sumDualInfeasibilities_&&type&&saveType<9 &&ignoreStuff!=2) { // say been feasible abcState_ |= CLP_ABC_BEEN_FEASIBLE; int numberFake=numberAtFakeBound(); if (!numberFake) { makeNonFreeVariablesDualFeasible(); numberDualInfeasibilities_=0; sumDualInfeasibilities_=0.0; // just primal gutsOfSolution(2); } } bool computeNewSumInfeasibilities=numberIterations_==baseIteration_; if ((!type||(firstFree_<0&&lastFirstFree_>=0))&&ignoreStuff!=2) { #ifdef PAN if ((stateOfProblem_&FAKE_SUPERBASIC)!=0&&firstFree_<0&&lastFirstFree_>=0&&type) { // clean up #if PRINT_PAN printf("Pan switch off after %d iterations\n",numberIterations_); #endif computeNewSumInfeasibilities=true; ordinaryVariables_=1; const double * COIN_RESTRICT reducedCost=abcDj_; const double * COIN_RESTRICT lower=abcLower_; const double * COIN_RESTRICT upper=abcUpper_; for (int i=0;i0 if(djValue<-dualTolerance_) printf("Odd at lb %d dj %g\n",i,djValue); #endif } else if (value>upper[i]-primalTolerance_) { setInternalStatus(i,atUpperBound); #if ABC_NORMAL_DEBUG>0 if(djValue>dualTolerance_) printf("Odd at ub %d dj %g\n",i,djValue); #endif } else { assert (status!=superBasic); } } if (status==isFree) ordinaryVariables_=0; } stateOfProblem_ &= ~FAKE_SUPERBASIC; } #endif // set up perturbation and dualBound_ // make dual feasible if (firstFree_<0) { if (numberFlagged_) { numberFlagged_=0; for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; if (flagged(iPivot)) { clearFlagged(iPivot); } } } int numberChanged=resetFakeBounds(0); #if ABC_NORMAL_DEBUG>0 if (numberChanged>0) printf("Re-setting %d fake bounds %d gone dual infeasible - can expect backward objective\n", numberChanged,numberDualInfeasibilities_); #endif if (numberDualInfeasibilities_||numberChanged!=-1) { makeNonFreeVariablesDualFeasible(); numberDualInfeasibilities_=0; sumDualInfeasibilities_=0.0; sumOfRelaxedDualInfeasibilities_=0.0; // just primal gutsOfSolution(2); if (!numberIterations_ && sumPrimalInfeasibilities_ > 1.0e5*(savePrimalInfeasibilities+1.0e3) && (moreSpecialOptions_ & (256|8192)) == 0) { // Use primal problemStatus_=10; // mark so can perturb initialSumInfeasibilities_=-1.0; CoinAbcMemcpy(abcSolution_,solutionSaved_,numberTotal_); CoinAbcMemcpy(internalStatus_,internalStatusSaved_,numberTotal_); return; } // redo if(computeNewSumInfeasibilities) initialSumInfeasibilities_=sumPrimalInfeasibilities_; //computeObjective(); } } //bounceTolerances(type); } else if (numberIterations_>numberRows_&&stateDualColumn_==-2) { bounceTolerances(4); } // If bad accuracy treat as singular if ((largestPrimalError_ > 1.0e15 || largestDualError_ > 1.0e15) && numberIterations_>1000) { problemStatus_=10; //abort(); #if ABC_NORMAL_DEBUG>0 printf("Big problems - errors %g %g try primal\n",largestPrimalError_,largestDualError_); #endif } else if (goodAccuracy()&&numberIterations_>lastBadIteration_+200) { // Can reduce tolerance double newTolerance = CoinMax(0.995 * abcFactorization_->pivotTolerance(), saveData_.pivotTolerance_); if (!type) newTolerance = saveData_.pivotTolerance_; if (newTolerance>abcFactorization_->minimumPivotTolerance()) abcFactorization_->pivotTolerance(newTolerance); } bestObjectiveValue_ = CoinMax(bestObjectiveValue_, rawObjectiveValue_ - bestPossibleImprovement_); // Double check infeasibility if no action if (abcProgress_.lastIterationNumber(0) == numberIterations_) { if (abcDualRowPivot_->looksOptimal()) { // say been feasible abcState_ |= CLP_ABC_BEEN_FEASIBLE; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } } else { double thisObj = rawObjectiveValue_ - bestPossibleImprovement_; #ifdef CLP_INVESTIGATE assert (bestPossibleImprovement_ > -1000.0 && rawObjectiveValue_ > -1.0e100); if (bestPossibleImprovement_) printf("obj %g add in %g -> %g\n", rawObjectiveValue_, bestPossibleImprovement_, thisObj); #endif double lastObj = abcProgress_.lastObjective(0); #ifndef NDEBUG #if ABC_NORMAL_DEBUG>3 resetFakeBounds(-1); #endif #endif if (lastObj < thisObj - 1.0e-5 * CoinMax(fabs(thisObj), fabs(lastObj)) - 1.0e-3 && saveType<9) { numberTimesOptimal_ = 0; } } // Up tolerance if looks a bit odd if (numberIterations_ > CoinMax(1000, numberRows_ >> 4) && (specialOptions_ & 64) != 0) { if (sumPrimalInfeasibilities_ && sumPrimalInfeasibilities_ < 1.0e5) { int backIteration = abcProgress_.lastIterationNumber(CLP_PROGRESS - 1); if (backIteration > 0 && numberIterations_ - backIteration < 9 * CLP_PROGRESS) { if (abcFactorization_->pivotTolerance() < 0.9) { // up tolerance abcFactorization_->pivotTolerance(CoinMin(abcFactorization_->pivotTolerance() * 1.05 + 0.02, 0.91)); //printf("tol now %g\n",abcFactorization_->pivotTolerance()); abcProgress_.clearIterationNumbers(); } } } } // Check if looping int loop; if (type != 2) loop = abcProgress_.looping(); else loop = -1; if (abcProgress_.reallyBadTimes() > 10) { problemStatus_ = 10; // instead - try other algorithm #if ABC_NORMAL_DEBUG>3 printf("returning at %d\n", __LINE__); #endif } if (loop >= 0) { problemStatus_ = loop; //exit if in loop if (!problemStatus_) { // declaring victory // say been feasible abcState_ |= CLP_ABC_BEEN_FEASIBLE; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } else { problemStatus_ = 10; // instead - try other algorithm #if ABC_NORMAL_DEBUG>3 printf("returning at %d\n", __LINE__); #endif } return; } // really for free variables in if((progressFlag_ & 2) != 0) { //situationChanged = 2; } progressFlag_ &= (~3); //reset progress flag // mark as having gone optimal if looks like it if (!numberPrimalInfeasibilities_&& !numberDualInfeasibilities_) progressFlag_ |= 8; if (handler_->detail(CLP_SIMPLEX_STATUS, messages_) < 100) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } double approximateObjective = rawObjectiveValue_; //realDualInfeasibilities = sumDualInfeasibilities_; // If we need to carry on cleaning variables if (!numberPrimalInfeasibilities_ && (specialOptions_ & 1024) != 0 && CLEAN_FIXED) { for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; if (!flagged(iPivot) && pivoted(iPivot)) { // carry on numberPrimalInfeasibilities_ = -1; sumOfRelaxedPrimalInfeasibilities_ = 1.0; sumPrimalInfeasibilities_ = 1.0; break; } } } /* If we are primal feasible and any dual infeasibilities are on free variables then it is better to go to primal */ if (!numberPrimalInfeasibilities_ && !numberDualInfeasibilitiesWithoutFree_ && numberDualInfeasibilities_) { // say been feasible abcState_ |= CLP_ABC_BEEN_FEASIBLE; if (type&&ignoreStuff!=2) problemStatus_ = 10; else numberPrimalInfeasibilities_=1; } // check optimal // give code benefit of doubt if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0&&ignoreStuff!=2) { // say been feasible abcState_ |= CLP_ABC_BEEN_FEASIBLE; // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } else if (sumOfRelaxedDualInfeasibilities_>1.0e-3&&firstFree_<0&&ignoreStuff!=2 &&numberIterations_>lastCleaned_+10) { #if ABC_NORMAL_DEBUG>0 printf("Making dual feasible\n"); #endif makeNonFreeVariablesDualFeasible(true); lastCleaned_=numberIterations_; numberDualInfeasibilities_=0; sumDualInfeasibilities_=0.0; // just primal gutsOfSolution(2); } // see if cutoff reached double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); int numberChangedBounds=0; if (primalFeasible()&&ignoreStuff!=2) { // may be optimal - or may be bounds are wrong numberChangedBounds = changeBounds(0, changeCost); if (numberChangedBounds) gutsOfSolution(2); } if (primalFeasible()&&ignoreStuff!=2) { if (numberChangedBounds <= 0 && !numberDualInfeasibilities_) { //looks optimal - do we need to reset tolerance if (lastCleaned_ < numberIterations_ && /*numberTimesOptimal_*/ stateDualColumn_ < 4 && (numberChanged_ || (specialOptions_ & 4096) == 0)) { #if CLP_CAN_HAVE_ZERO_OBJ if ((specialOptions_&2097152)==0) { #endif numberTimesOptimal_++; if (stateDualColumn_==-2) { #if ABC_NORMAL_DEBUG>0 printf("Going straight from state -2 to 0\n"); #endif stateDualColumn_=-1; } changeMade_++; // say something changed if (numberTimesOptimal_ == 1) { if (fabs(currentDualTolerance_-dualTolerance_)>1.0e-12) { #if ABC_NORMAL_DEBUG>0 printf("changing dual tolerance from %g to %g (numberTimesOptimal_==%d)\n", currentDualTolerance_,dualTolerance_,numberTimesOptimal_); #endif currentDualTolerance_ = dualTolerance_; } } else { if (numberTimesOptimal_ == 2) { // better to have small tolerance even if slower abcFactorization_->zeroTolerance(CoinMin(abcFactorization_->zeroTolerance(), 1.0e-15)); } #if ABC_NORMAL_DEBUG>0 printf("changing dual tolerance from %g to %g (numberTimesOptimal_==%d)\n", currentDualTolerance_,dualTolerance_*pow(2.0,numberTimesOptimal_-1),numberTimesOptimal_); #endif currentDualTolerance_ = dualTolerance_ * pow(2.0, numberTimesOptimal_ - 1); } if (numberChanged_>0) { handler_->message(CLP_DUAL_ORIGINAL, messages_) << CoinMessageEol; //realDualInfeasibilities = sumDualInfeasibilities_; } else if (numberChangedBounds<-1) { // bounds were flipped //gutsOfSolution(2); } if (stateDualColumn_>=0) stateDualColumn_++; #ifndef TRY_ABC_GUS int returnCode=bounceTolerances(1); if (returnCode) #endif // always go to primal problemStatus_=10; lastCleaned_ = numberIterations_; #if CLP_CAN_HAVE_ZERO_OBJ } else { // no cost - skip checks problemStatus_=0; } #endif } else { problemStatus_ = 0; // optimal if (lastCleaned_ < numberIterations_ && numberChanged_) { handler_->message(CLP_SIMPLEX_GIVINGUP, messages_) << CoinMessageEol; } } } else if (numberChangedBounds<-1) { // some flipped bounceTolerances(2); #if ABC_NORMAL_DEBUG>0 printf("numberChangedBounds %d numberAtFakeBound %d at line %d in file %s\n", numberChangedBounds,numberAtFakeBound(),__LINE__,__FILE__); #endif } else if (numberChangedBounds>0||numberAtFakeBound()) { handler_->message(CLP_DUAL_BOUNDS, messages_) << currentDualBound_ << CoinMessageEol; #if ABC_NORMAL_DEBUG>0 printf("changing bounds\n"); printf("numberChangedBounds %d numberAtFakeBound %d at line %d in file %s\n", numberChangedBounds,numberAtFakeBound(),__LINE__,__FILE__); #endif if (!numberDualInfeasibilities_&&!numberPrimalInfeasibilities_) { // check unbounded // find a variable with bad dj int iChosen = -1; if ((specialOptions_ & 0x03000000) == 0) { double largest = 100.0 * primalTolerance_; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { double djValue = abcDj_[iSequence]; double originalLo = lowerSaved_[iSequence]; double originalUp = upperSaved_[iSequence]; if (fabs(djValue) > fabs(largest)) { if (getInternalStatus(iSequence) != basic) { if (djValue > 0 && originalLo < -1.0e20) { if (djValue > fabs(largest)) { largest = djValue; iChosen = iSequence; } } else if (djValue < 0 && originalUp > 1.0e20) { if (-djValue > fabs(largest)) { largest = djValue; iChosen = iSequence; } } } } } } if (iChosen >= 0) { int iVector=getAvailableArray(); unpack(usefulArray_[iVector],iChosen); //double changeCost; problemStatus_ = checkUnbounded(usefulArray_[iVector], 0.0/*changeCost*/); usefulArray_[iVector].clear(); setAvailableArray(iVector); } } gutsOfSolution(3); //bounceTolerances(2); //realDualInfeasibilities = sumDualInfeasibilities_; } // unflag all variables (we may want to wait a bit?) if (unflagVariables) { int numberFlagged = numberFlagged_; numberFlagged_=0; for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; if (flagged(iPivot)) { clearFlagged(iPivot); } } #if ABC_NORMAL_DEBUG>3 if (numberFlagged) { printf("unflagging %d variables - tentativeStatus %d probStat %d ninf %d nopt %d\n", numberFlagged, tentativeStatus, problemStatus_, numberPrimalInfeasibilities_, numberTimesOptimal_); } #endif unflagVariables = numberFlagged > 0; if (numberFlagged && !numberPivots) { /* looks like trouble as we have not done any iterations. Try changing pivot tolerance then give it a few goes and give up */ if (abcFactorization_->pivotTolerance() < 0.9) { abcFactorization_->pivotTolerance(0.99); problemStatus_ = -1; } else if (numberTimesOptimal_ < 3) { numberTimesOptimal_++; problemStatus_ = -1; } else { unflagVariables = false; //secondaryStatus_ = 1; // and say probably infeasible if ((moreSpecialOptions_ & 256) == 0||(abcState_&CLP_ABC_BEEN_FEASIBLE)!=0) { // try primal problemStatus_ = 10; } else { // almost certainly infeasible problemStatus_ = 1; } #if ABC_NORMAL_DEBUG>3 printf("returning at %d\n", __LINE__); #endif } } } } if (problemStatus_ < 0) { saveGoodStatus(); if (weightsSaved) { // restore weights (if saved) - also recompute infeasibility list abcDualRowPivot_->saveWeights(this, weightsSaved); } else { abcDualRowPivot_->recomputeInfeasibilities(); } } // see if cutoff reached checkCutoff(false); // If we are in trouble and in branch and bound give up if ((specialOptions_ & 1024) != 0) { int looksBad = 0; if (largestPrimalError_ * largestDualError_ > 1.0e2) { looksBad = 1; } else if (largestPrimalError_ > 1.0e-2 && rawObjectiveValue_ > CoinMin(1.0e15, 1.0e3 * limit)) { looksBad = 2; } if (looksBad) { if (abcFactorization_->pivotTolerance() < 0.9) { // up tolerance abcFactorization_->pivotTolerance(CoinMin(abcFactorization_->pivotTolerance() * 1.05 + 0.02, 0.91)); } else if (numberIterations_ > 10000) { #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() > 2) printf("bad dual - saying infeasible %d\n", looksBad); #endif problemStatus_ = 1; secondaryStatus_ = 1; // and say was on cutoff } else if (largestPrimalError_ > 1.0e5) { #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() > 2) printf("bad dual - going to primal %d %g\n", looksBad, largestPrimalError_); #endif allSlackBasis(); problemStatus_ = 10; } } } //if (problemStatus_ < 0 && !changeMade_) { //problemStatus_ = 4; // unknown //} lastGoodIteration_ = numberIterations_; if (numberIterations_ > lastBadIteration_ + 200) { moreSpecialOptions_ &= ~16; // clear check accuracy flag if (numberFlagged_) { numberFlagged_=0; for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; if (flagged(iPivot)) { clearFlagged(iPivot); } } } } if (problemStatus_ < 0&&ignoreStuff!=2) { //sumDualInfeasibilities_ = realDualInfeasibilities; // back to say be careful if (sumDualInfeasibilities_) { numberDualInfeasibilities_ = 1; } else if (!numberPrimalInfeasibilities_) { // Looks good problemStatus_=0; } } double thisObj = abcProgress_.lastObjective(0); double lastObj = abcProgress_.lastObjective(1); if (lastObj > thisObj + 1.0e-4 * CoinMax(fabs(thisObj), fabs(lastObj)) + 1.0e-4&& lastFirstFree_<0) { //printf("BAD - objective backwards\n"); //bounceTolerances(3); numberBlackMarks+=3; } if (numberBlackMarks>0&&numberIterations_>baseIteration_) { // be very careful int maxFactor = abcFactorization_->maximumPivots(); if (maxFactor > 10) { if ((stateOfProblem_&PESSIMISTIC)==0||true) { if (largestDualError_>10.0*CoinMax(lastDualError_,1.0e-6) ||largestPrimalError_>10.0*CoinMax(lastPrimalError_,1.0e-6)) maxFactor = CoinMin(maxFactor,20); forceFactorization_ = CoinMax(1, (maxFactor >> 1)); } else if (numberBlackMarks>2) { forceFactorization_ = CoinMax(1, (forceFactorization_ >> 1)); } } stateOfProblem_ |= PESSIMISTIC; if (numberBlackMarks>=10) forceFactorization_ = 1; } lastPrimalError_=largestPrimalError_; lastDualError_=largestDualError_; lastFirstFree_=firstFree_; if (ignoreStuff==2) { // in values pass lastFirstFree_=-1; // firstFree_=-1; } if (alphaAccuracy_ > 0.0) alphaAccuracy_ = 1.0; // If we are stopping - use plausible objective // Maybe only in fast dual if (problemStatus_ > 2) rawObjectiveValue_ = approximateObjective; if (problemStatus_ == 1 && (progressFlag_&8) != 0 && fabs(rawObjectiveValue_) > 1.0e10 ) problemStatus_ = 10; // infeasible - but has looked feasible checkMoveBack(true); #if 0 { double * array = usefulArray_[arrayForTableauRow_].denseVector(); for (int iPivot = 0; iPivot < numberRows_; iPivot++) { int iSequence = abcPivotVariable_[iPivot]; unpack(usefulArray_[arrayForTableauRow_],iSequence); abcFactorization_->updateColumn(usefulArray_[arrayForTableauRow_]); assert (fabs(array[iPivot] - 1.0) < 1.0e-4); array[iPivot] = 0.0; for (int i = 0; i < numberRows_; i++) assert (fabs(array[i]) < 1.0e-4); usefulArray_[arrayForTableauRow_].clear(); } } #endif #if 0 { // save status, cost and solution unsigned char * saveStatus = CoinCopyOfArray(internalStatus_,numberTotal_); double * saveSolution = CoinCopyOfArray(abcSolution_,numberTotal_); double * saveCost = CoinCopyOfArray(abcCost_,numberTotal_); printf("TestA sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); if (perturbation_>100) CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_); else CoinAbcMemcpy(abcCost_,abcPerturbation_,numberTotal_); moveToBasic(); gutsOfSolution(3); for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { bool changed=fabs(saveCost[iSequence]-abcCost_[iSequence])>1.0e-10; bool bad=false; int iStatus=internalStatus_[iSequence]&7; if (getInternalStatus(iSequence) != basic && !flagged(iSequence)) { // not basic double distanceUp = abcUpper_[iSequence] - abcSolution_[iSequence]; double distanceDown = abcSolution_[iSequence] - abcLower_[iSequence]; double value = abcDj_[iSequence]; if (distanceUp > primalTolerance_) { // Check if "free" if (distanceDown <= primalTolerance_) { // should not be negative if (value < 0.0) { value = - value; if (value > currentDualTolerance_) { bad=true; } } } else { // free value=fabs(value); if (value > currentDualTolerance_) { bad=true; } } } else if (distanceDown > primalTolerance_) { // should not be positive if (value > 0.0) { if (value > currentDualTolerance_) { bad=true; } } } } if (changed||bad) printf("seq %d status %d current cost %g original %g dj %g %s\n", iSequence,iStatus,saveCost[iSequence],abcCost_[iSequence], abcDj_[iSequence],bad ? "(bad)" : ""); } printf("TestB sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); if (numberDualInfeasibilities_) { makeNonFreeVariablesDualFeasible(); moveToBasic(); gutsOfSolution(3); printf("TestC sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); } CoinAbcMemcpy(internalStatus_,saveStatus,numberTotal_); CoinAbcMemcpy(abcSolution_,saveSolution,numberTotal_); CoinAbcMemcpy(abcCost_,saveCost,numberTotal_); delete [] saveStatus; delete [] saveSolution; delete [] saveCost; moveToBasic(); gutsOfSolution(3); printf("TestD sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); } #endif #if 0 { const double multiplier[] = { 1.0, -1.0}; // sign????????????? double dualT = - currentDualTolerance_; double largestCostDifference=0.1*currentDualTolerance_; int numberCostDifference=0; double largestBadDj=0.0; int numberBadDj=0; double sumBadDj=0.0; double sumCanMoveBad=0.0; int numberCanMoveBad=0; double sumCanMoveOthers=0.0; int numberCanMoveOthers=0; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { double costDifference=abcPerturbation_[iSequence]-abcCost_[iSequence]; if (fabs(costDifference)>0.1*currentDualTolerance_) { if (fabs(costDifference)>largestCostDifference) largestCostDifference=fabs(costDifference); numberCostDifference++; } unsigned char iStatus = internalStatus_[iSequence] & 7; if (iStatus<4) { double mult = multiplier[iStatus]; double dj = abcDj_[iSequence] * mult; if (dj < dualT) { sumBadDj+=dualT-dj; numberBadDj++; if (dualT-dj>largestBadDj) largestBadDj=dualT-dj; if (costDifference*mult>0.0) { sumCanMoveBad+=costDifference*mult; numberCanMoveBad++; //dj+=costDifference*mult; abcDj_[iSequence]+=costDifference; abcCost_[iSequence]=abcPerturbation_[iSequence]; } } else if (costDifference*mult>0.0) { sumCanMoveOthers+=costDifference*mult; numberCanMoveOthers++; //dj+=costDifference*mult; abcDj_[iSequence]+=costDifference; abcCost_[iSequence]=abcPerturbation_[iSequence]; } } } if (numberCostDifference+numberBadDj+numberCanMoveBad+numberCanMoveOthers) { printf("largest diff %g (%d), largest bad dj %g (%d - sum %g), can move bad %g (%d), good %g (%d) - %d at fake bound\n",largestCostDifference,numberCostDifference,largestBadDj, numberBadDj, sumBadDj,sumCanMoveBad=0.0,numberCanMoveBad, sumCanMoveOthers,numberCanMoveOthers,numberAtFakeBound()); } } #endif } // see if cutoff reached bool AbcSimplexDual::checkCutoff(bool computeObjective) { double objValue=COIN_DBL_MAX; if (computeObjective) objValue = computeInternalObjectiveValue(); else objValue = minimizationObjectiveValue(); double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); // Looks as if numberAtFakeBound() being computed too often if(fabs(limit) < 1.0e30 && objValue > limit && !numberAtFakeBound()) { bool looksInfeasible = !numberDualInfeasibilities_; if (objValue > limit + fabs(0.1 * limit) + 1.0e2 * sumDualInfeasibilities_ + 1.0e4 && sumDualInfeasibilities_ < largestDualError_ && numberIterations_ > 0.5 * numberRows_ + 1000) looksInfeasible = true; if (looksInfeasible&&!computeObjective) objValue = computeInternalObjectiveValue(); if (looksInfeasible) { // Even if not perturbed internal costs may have changed // be careful if(objValue > limit) { problemStatus_ = 1; secondaryStatus_ = 1; // and say was on cutoff return true; } } } return false; } #define CLEANUP_DJS 0 /* While updateDualsInDual sees what effect is of flip this does actual flipping. If change >0.0 then value in array >0.0 => from lower to upper returns 3 if skip this iteration and re-factorize */ int AbcSimplexDual::flipBounds() { CoinIndexedVector & array = usefulArray_[arrayForFlipBounds_]; CoinIndexedVector & output = usefulArray_[arrayForFlipRhs_]; output.clear(); int numberFlipped=array.getNumElements(); if (numberFlipped) { #if CLP_CAN_HAVE_ZERO_OBJ>1 if ((specialOptions_&2097152)==0) { #endif // do actual flips // do in parallel once got spare space in factorization #if ABC_PARALLEL==2 #endif int number=array.getNumElements(); const int * COIN_RESTRICT which=array.getIndices(); double * COIN_RESTRICT work = array.denseVector(); double * COIN_RESTRICT solution = abcSolution_; const double * COIN_RESTRICT lower = abcLower_; const double * COIN_RESTRICT upper = abcUpper_; #if CLEANUP_DJS double * COIN_RESTRICT cost = abcCost_; double * COIN_RESTRICT dj = abcDj_; // see if we can clean up djs // may have perturbation const double * COIN_RESTRICT originalCost = abcPerturbation_; #else const double * COIN_RESTRICT cost = abcCost_; const double * COIN_RESTRICT dj = abcDj_; #endif const double multiplier[] = { 1.0, -1.0}; for (int i = 0; i < number; i++) { double value=work[i]*theta_; work[i]=0.0; int iSequence = which[i]; unsigned char iStatus = internalStatus_[iSequence]&3; assert ((internalStatus_[iSequence]&7)==0|| (internalStatus_[iSequence]&7)==1); double mult = multiplier[iStatus]; double djValue = dj[iSequence] * mult-value; //double perturbedTolerance = abcPerturbation_[iSequence]; if (djValue<-currentDualTolerance_) { // might just happen - if so just skip assert (iSequence!=sequenceIn_); double movement=(upper[iSequence]-lower[iSequence])*mult; if (iStatus==0) { // at lower bound // to upper bound setInternalStatus(iSequence, atUpperBound); solution[iSequence] = upper[iSequence]; #if CLEANUP_DJS if (cost[iSequence]originalCost[iSequence]) { double difference = CoinMin(cost[iSequence]-originalCost[iSequence],-djValue); dj[iSequence]-=difference; cost[iSequence]-=difference; } #endif } abcMatrix_->add(output, iSequence, movement); objectiveChange_ += cost[iSequence]*movement; } } array.setNumElements(0); // double check something flipped if (output.getNumElements()) { #if ABC_PARALLEL==0 abcFactorization_->updateColumn(output); #else assert (FACTOR_CPU>2); abcFactorization_->updateColumnCpu(output,1); #endif abcDualRowPivot_->updatePrimalSolution(output,1.0); } #if CLP_CAN_HAVE_ZERO_OBJ>1 } else { clearArrays(3); } #endif } // recompute dualOut_ valueOut_ = solutionBasic_[pivotRow_]; if (directionOut_ < 0) { dualOut_ = valueOut_ - upperOut_; } else { dualOut_ = lowerOut_ - valueOut_; } #if 0 // amount primal will move movement_ = -dualOut_ * directionOut_ / alpha_; double movementOld = oldDualOut * directionOut_ / alpha_; // so objective should increase by fabs(dj)*movement_ // but we already have objective change - so check will be good if (objectiveChange_ + fabs(movementOld * dualIn_) < -CoinMax(1.0e-5, 1.0e-12 * fabs(rawObjectiveValue_))) { #if ABC_NORMAL_DEBUG>3 if (handler_->logLevel() & 32) printf("movement %g, movementOld %g swap change %g, rest %g * %g\n", objectiveChange_ + fabs(movement_ * dualIn_), movementOld,objectiveChange_, movement_, dualIn_); #endif } if (0) { if(abcFactorization_->pivots()) { // going backwards - factorize problemStatus_ = -2; // factorize now stateOfIteration_=2; } } #endif return numberFlipped; } /* Undo a flip */ void AbcSimplexDual::flipBack(int number) { CoinIndexedVector & array = usefulArray_[arrayForFlipBounds_]; const int * COIN_RESTRICT which=array.getIndices(); double * COIN_RESTRICT solution = abcSolution_; const double * COIN_RESTRICT lower = abcLower_; const double * COIN_RESTRICT upper = abcUpper_; for (int i = 0; i < number; i++) { int iSequence = which[i]; unsigned char iStatus = internalStatus_[iSequence]&3; assert ((internalStatus_[iSequence]&7)==0|| (internalStatus_[iSequence]&7)==1); if (iStatus==0) { // at lower bound // to upper bound setInternalStatus(iSequence, atUpperBound); solution[iSequence] = upper[iSequence]; } else { // at upper bound // to lower bound setInternalStatus(iSequence, atLowerBound); solution[iSequence] = lower[iSequence]; } } } // Restores bound to original bound void AbcSimplexDual::originalBound( int iSequence) { if (getFakeBound(iSequence) != noFake) { numberFake_--;; setFakeBound(iSequence, noFake); abcLower_[iSequence] = lowerSaved_[iSequence]; abcUpper_[iSequence] = upperSaved_[iSequence]; } } /* As changeBounds but just changes new bounds for a single variable. Returns true if change */ bool AbcSimplexDual::changeBound( int iSequence) { // old values double oldLower = abcLower_[iSequence]; double oldUpper = abcUpper_[iSequence]; double value = abcSolution_[iSequence]; bool modified = false; // original values double lowerValue = lowerSaved_[iSequence]; double upperValue = upperSaved_[iSequence]; setFakeBound(iSequence,noFake); if (value == oldLower) { if (upperValue > oldLower + currentDualBound_) { abcUpper_[iSequence] = oldLower + currentDualBound_; setFakeBound(iSequence, upperFake); assert (abcLower_[iSequence]==lowerSaved_[iSequence]); assert (abcUpper_[iSequence]lowerSaved_[iSequence]); assert (abcUpper_[iSequence]==upperSaved_[iSequence]); modified = true; numberFake_++; } } else { assert(value == oldLower || value == oldUpper); } return modified; } /* Checks number of variables at fake bounds. This is used by fastDual so can exit gracefully before end */ int AbcSimplexDual::numberAtFakeBound() { int numberFake = 0; if (numberFake_) { for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { FakeBound bound = getFakeBound(iSequence); switch(getInternalStatus(iSequence)) { case basic: break; case isFree: case superBasic: case AbcSimplex::isFixed: //setFakeBound (iSequence, noFake); break; case atUpperBound: if (bound == upperFake || bound == bothFake) numberFake++; break; case atLowerBound: if (bound == lowerFake || bound == bothFake) numberFake++; break; } } } return numberFake; } int AbcSimplexDual::resetFakeBounds(int type) { if (type == 0||type==1) { // put back original bounds and then check //CoinAbcMemcpy(abcLower_,lowerSaved_,numberTotal_); //CoinAbcMemcpy(abcUpper_,upperSaved_,numberTotal_); double dummyChangeCost = 0.0; return changeBounds(3+type, dummyChangeCost); } else if (type < 0) { #ifndef NDEBUG // just check int iSequence; int nFake = 0; int nErrors = 0; int nSuperBasic = 0; int nWarnings = 0; for (iSequence = 0; iSequence < numberTotal_; iSequence++) { FakeBound fakeStatus = getFakeBound(iSequence); Status status = getInternalStatus(iSequence); bool isFake = false; #ifdef CLP_INVESTIGATE char RC = 'C'; int jSequence = iSequence; if (jSequence >= numberColumns_) { RC = 'R'; jSequence -= numberColumns_; } #endif double lowerValue = lowerSaved_[iSequence]; double upperValue = upperSaved_[iSequence]; double value = abcSolution_[iSequence]; CoinRelFltEq equal; if (status == atUpperBound || status == atLowerBound) { if (fakeStatus == AbcSimplexDual::upperFake) { if(!equal(abcUpper_[iSequence], (lowerValue + currentDualBound_)) || !(equal(abcUpper_[iSequence], value) || equal(abcLower_[iSequence], value))) { nErrors++; #ifdef CLP_INVESTIGATE printf("** upperFake %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, abcLower_[iSequence], abcSolution_[iSequence], abcUpper_[iSequence], lowerValue, upperValue); #endif } isFake = true;; } else if (fakeStatus == AbcSimplexDual::lowerFake) { if(!equal(abcLower_[iSequence], (upperValue - currentDualBound_)) || !(equal(abcUpper_[iSequence], value) || equal(abcLower_[iSequence], value))) { nErrors++; #ifdef CLP_INVESTIGATE printf("** lowerFake %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, abcLower_[iSequence], abcSolution_[iSequence], abcUpper_[iSequence], lowerValue, upperValue); #endif } isFake = true;; } else if (fakeStatus == AbcSimplexDual::bothFake) { nWarnings++; #ifdef CLP_INVESTIGATE printf("** %d at bothFake?\n", iSequence); #endif } else if (abcUpper_[iSequence] - abcLower_[iSequence] > 2.0 * currentDualBound_) { nErrors++; #ifdef CLP_INVESTIGATE printf("** noFake! %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, abcLower_[iSequence], abcSolution_[iSequence], abcUpper_[iSequence], lowerValue, upperValue); #endif } } else if (status == superBasic || status == isFree) { nSuperBasic++; //printf("** free or superbasic %c%d %g <= %g <= %g true %g, %g - status %d\n", // RC,jSequence,abcLower_[iSequence],abcSolution_[iSequence], // abcUpper_[iSequence],lowerValue,upperValue,status); } else if (status == basic) { bool odd = false; if (!equal(abcLower_[iSequence], lowerValue)) odd = true; if (!equal(abcUpper_[iSequence], upperValue)) odd = true; if (odd) { #ifdef CLP_INVESTIGATE printf("** basic %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, abcLower_[iSequence], abcSolution_[iSequence], abcUpper_[iSequence], lowerValue, upperValue); #endif nWarnings++; } } else if (status == isFixed) { if (!equal(abcUpper_[iSequence], abcLower_[iSequence])) { nErrors++; #ifdef CLP_INVESTIGATE printf("** fixed! %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, abcLower_[iSequence], abcSolution_[iSequence], abcUpper_[iSequence], lowerValue, upperValue); #endif } } if (isFake) { nFake++; } else { if (fakeStatus != AbcSimplexDual::noFake) { nErrors++; #ifdef CLP_INVESTIGATE printf("** bad fake status %c%d %d\n", RC, jSequence, fakeStatus); #endif } } } if (nFake != numberFake_) { #ifdef CLP_INVESTIGATE printf("nfake %d numberFake %d\n", nFake, numberFake_); #endif nErrors++; } if (nErrors || type <= -1000) { #ifdef CLP_INVESTIGATE printf("%d errors, %d warnings, %d free/superbasic, %d fake\n", nErrors, nWarnings, nSuperBasic, numberFake_); printf("currentDualBound %g\n", currentDualBound_); #endif if (type <= -1000) { iSequence = -type; iSequence -= 1000; #ifdef CLP_INVESTIGATE char RC = 'C'; int jSequence = iSequence; if (jSequence >= numberColumns_) { RC = 'R'; jSequence -= numberColumns_; } double lowerValue = lowerSaved_[iSequence]; double upperValue = upperSaved_[iSequence]; printf("*** movement>1.0e30 for %c%d %g <= %g <= %g true %g, %g - status %d\n", RC, jSequence, abcLower_[iSequence], abcSolution_[iSequence], abcUpper_[iSequence], lowerValue, upperValue, internalStatus_[iSequence]); #endif assert (nErrors); // should have been picked up } assert (!nErrors); } #endif } else { CoinAbcMemcpy(abcLower_,lowerSaved_,numberTotal_); CoinAbcMemcpy(abcUpper_,upperSaved_,numberTotal_); // reset using status numberFake_ = 0; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { FakeBound fakeStatus = getFakeBound(iSequence); if (fakeStatus != AbcSimplexDual::noFake) { Status status = getInternalStatus(iSequence); if (status == basic) { setFakeBound(iSequence, AbcSimplexDual::noFake); continue; } double lowerValue = abcLower_[iSequence]; double upperValue = abcUpper_[iSequence]; double value = abcSolution_[iSequence]; numberFake_++; if (fakeStatus == AbcSimplexDual::upperFake) { abcUpper_[iSequence] = lowerValue + currentDualBound_; if (status == AbcSimplex::atLowerBound) { abcSolution_[iSequence] = lowerValue; } else if (status == AbcSimplex::atUpperBound) { abcSolution_[iSequence] = abcUpper_[iSequence]; } else { abort(); } } else if (fakeStatus == AbcSimplexDual::lowerFake) { abcLower_[iSequence] = upperValue - currentDualBound_; if (status == AbcSimplex::atLowerBound) { abcSolution_[iSequence] = abcLower_[iSequence]; } else if (status == AbcSimplex::atUpperBound) { abcSolution_[iSequence] = upperValue; } else { abort(); } } else { assert (fakeStatus == AbcSimplexDual::bothFake); if (status == AbcSimplex::atLowerBound) { abcLower_[iSequence] = value; abcUpper_[iSequence] = value + currentDualBound_; } else if (status == AbcSimplex::atUpperBound) { abcUpper_[iSequence] = value; abcLower_[iSequence] = value - currentDualBound_; } else if (status == AbcSimplex::isFree || status == AbcSimplex::superBasic) { abcLower_[iSequence] = value - 0.5 * currentDualBound_; abcUpper_[iSequence] = value + 0.5 * currentDualBound_; } else { abort(); } } } } } return -1; } // maybe could JUST check against perturbationArray void AbcSimplex::checkDualSolutionPlusFake() { sumDualInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; sumFakeInfeasibilities_=0.0; int firstFreePrimal = -1; int firstFreeDual = -1; int numberSuperBasicWithDj = 0; bestPossibleImprovement_ = 0.0; // we can't really trust infeasibilities if there is dual error double error = CoinMin(1.0e-2, largestDualError_); // allow tolerance at least slightly bigger than standard double relaxedTolerance = currentDualTolerance_ + error; // allow bigger tolerance for possible improvement double possTolerance = 5.0 * relaxedTolerance; sumOfRelaxedDualInfeasibilities_ = 0.0; //rawObjectiveValue_ -=sumNonBasicCosts_; sumNonBasicCosts_ = 0.0; const double * COIN_RESTRICT abcLower = abcLower_; const double * COIN_RESTRICT abcUpper = abcUpper_; const double * COIN_RESTRICT abcSolution = abcSolution_; #ifdef CLEANUP_DJS double * COIN_RESTRICT abcDj = abcDj_; double * COIN_RESTRICT abcCost = abcCost_; // see if we can clean up djs // may have perturbation const double * COIN_RESTRICT originalCost = abcPerturbation_; #else const double * COIN_RESTRICT abcDj = abcDj_; const double * COIN_RESTRICT abcCost = abcCost_; #endif //const double * COIN_RESTRICT abcPerturbation = abcPerturbation_; int badDjSequence=-1; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if (getInternalStatus(iSequence) != basic) { sumNonBasicCosts_ += abcSolution[iSequence]*abcCost[iSequence]; // not basic double distanceUp = abcUpper[iSequence] - abcSolution[iSequence]; double distanceDown = abcSolution[iSequence] - abcLower[iSequence]; double value = abcDj[iSequence]; if (distanceUp > primalTolerance_) { // Check if "free" if (distanceDown <= primalTolerance_) { // should not be negative if (value < 0.0) { value = - value; if (value > currentDualTolerance_) { bool treatAsSuperBasic=false; if (getInternalStatus(iSequence)==superBasic) { #ifdef PAN if (fakeSuperBasic(iSequence)>=0) { #endif treatAsSuperBasic=true; numberSuperBasicWithDj++; if (firstFreeDual < 0) firstFreeDual = iSequence; #ifdef PAN } #endif } if (!treatAsSuperBasic) { sumDualInfeasibilities_ += value - currentDualTolerance_; badDjSequence=iSequence; if (value > possTolerance) bestPossibleImprovement_ += CoinMin(distanceUp, 1.0e10) * value; if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; } } #ifdef CLEANUP_DJS } else { // adjust cost etc if (abcCost[iSequence]>originalCost[iSequence]) { double difference = CoinMin(abcCost[iSequence]-originalCost[iSequence],value); //printf("Lb %d changing cost from %g to %g, dj from %g to %g\n", // iSequence,abcCost[iSequence],abcCost[iSequence]-difference, // abcDj[iSequence],abcDj[iSequence]-difference); abcDj[iSequence]=value-difference; abcCost[iSequence]-=difference; } #endif } } else { // free value=fabs(value); if (value > 1.0 * relaxedTolerance) { numberSuperBasicWithDj++; if (firstFreeDual < 0) firstFreeDual = iSequence; } if (value > currentDualTolerance_) { sumDualInfeasibilities_ += value - currentDualTolerance_; if (value > possTolerance) bestPossibleImprovement_ += CoinMin(distanceUp, 1.0e10) * value; if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; } if (firstFreePrimal < 0) firstFreePrimal = iSequence; } } else if (distanceDown > primalTolerance_) { // should not be positive if (value > 0.0) { if (value > currentDualTolerance_) { bool treatAsSuperBasic=false; if (getInternalStatus(iSequence)==superBasic) { #ifdef PAN if (fakeSuperBasic(iSequence)>=0) { #endif treatAsSuperBasic=true; numberSuperBasicWithDj++; if (firstFreeDual < 0) firstFreeDual = iSequence; #ifdef PAN } #endif } if (!treatAsSuperBasic) { sumDualInfeasibilities_ += value - currentDualTolerance_; badDjSequence=iSequence; if (value > possTolerance) bestPossibleImprovement_ += value * CoinMin(distanceDown, 1.0e10); if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; } } #ifdef CLEANUP_DJS } else { // adjust cost etc if (abcCost[iSequence]=0); abcCost[badDjSequence]-=abcDj_[badDjSequence]; abcDj_[badDjSequence]=0.0; } #endif numberDualInfeasibilitiesWithoutFree_ = numberDualInfeasibilities_-numberSuperBasicWithDj; numberFreeNonBasic_=numberSuperBasicWithDj; firstFree_=-1; if (algorithm_ < 0 && firstFreeDual >= 0) { // dual firstFree_ = firstFreeDual; } else if ((numberSuperBasicWithDj || (abcProgress_.lastIterationNumber(0) <= 0))&&algorithm_>0) { firstFree_ = firstFreePrimal; } } // Perturbs problem void AbcSimplexDual::perturb(double factor) { const double * COIN_RESTRICT lower = lowerSaved_; const double * COIN_RESTRICT upper = upperSaved_; const double * COIN_RESTRICT perturbation = abcPerturbation_; double * COIN_RESTRICT cost = abcCost_; for (int i=0;i0 #define PERT_STATISTICS #endif #ifdef PERT_STATISTICS static void breakdown(const char * name, int numberLook, const double * region) { double range[] = { -COIN_DBL_MAX, -1.0e15, -1.0e11, -1.0e8, -1.0e5, -3.0e4, -1.0e4, -3.0e3, -1.0e3, -3.0e2, -1.0e2, -3.0e1, -1.0e1, -3.0, -1.0, -3.0e-1, -1.0e-1, -3.0e-1, -1.0e-2, -3.0e-2, -1.0e-3, -3.0e-3, -1.0e-4, -3.0e-4, -1.0e-5, -1.0e-8, -1.0e-11, -1.0e-15, 0.0, 1.0e-15, 1.0e-11, 1.0e-8, 1.0e-5, 3.0e-5, 1.0e-4, 3.0e-4, 1.0e-3, 3.0e-3, 1.0e-2, 3.0e-2, 1.0e-1, 3.0e-1, 1.0, 3.0, 1.0e1, 3.0e1, 1.0e2, 3.0e2, 1.0e3, 3.0e3, 1.0e4, 3.0e4, 1.0e5, 1.0e8, 1.0e11, 1.0e15, COIN_DBL_MAX }; int nRanges = static_cast (sizeof(range) / sizeof(double)); int * number = new int[nRanges]; memset(number, 0, nRanges * sizeof(int)); int * numberExact = new int[nRanges]; memset(numberExact, 0, nRanges * sizeof(int)); int i; for ( i = 0; i < numberLook; i++) { double value = region[i]; for (int j = 0; j < nRanges; j++) { if (value == range[j]) { numberExact[j]++; break; } else if (value < range[j]) { number[j]++; break; } } } printf("\n%s has %d entries\n", name, numberLook); for (i = 0; i < nRanges; i++) { if (number[i]) printf("%d between %g and %g", number[i], range[i-1], range[i]); if (numberExact[i]) { if (number[i]) printf(", "); printf("%d exactly at %g", numberExact[i], range[i]); } if (number[i] + numberExact[i]) printf("\n"); } delete [] number; delete [] numberExact; } #endif // Perturbs problem void AbcSimplexDual::perturbB(double /*factorIn*/,int /*type*/) { double overallMultiplier= (perturbation_==50||perturbation_>54) ? 1.0 : 0.1; // dual perturbation double perturbation = 1.0e-20; // maximum fraction of cost to perturb double maximumFraction = 1.0e-5; int maxLength = 0; int minLength = numberRows_; double averageCost = 0.0; int numberNonZero = 0; // See if we need to perturb double * COIN_RESTRICT sort = new double[numberColumns_]; // Use objective BEFORE scaling ?? const double * COIN_RESTRICT obj = objective(); for (int i = 0; i < numberColumns_; i++) { double value = fabs(obj[i]); sort[i] = value; averageCost += fabs(abcCost_[i+maximumAbcNumberRows_]); if (value) numberNonZero++; } if (numberNonZero) averageCost /= static_cast (numberNonZero); else averageCost = 1.0; // allow for cost scaling averageCost *= objectiveScale_; std::sort(sort, sort + numberColumns_); int number = 1; double last = sort[0]; for (int i = 1; i < numberColumns_; i++) { if (last != sort[i]) number++; last = sort[i]; } delete [] sort; #ifdef PERT_STATISTICS printf("%d different values\n",number); #endif #if 0 printf("nnz %d percent %d", number, (number * 100) / numberColumns_); if (number * 4 > numberColumns_) printf(" - Would not perturb\n"); else printf(" - Would perturb\n"); #endif // If small costs then more dangerous (better to scale) double numberMultiplier=1.25; if (averageCost<1.0e-3) numberMultiplier=20.0; else if (averageCost<1.0e-2) numberMultiplier=10.0; else if (averageCost<1.0e-1) numberMultiplier=3.0; else if (averageCost<1.0) numberMultiplier=2.0; numberMultiplier *= 2.0; // try if (number * numberMultiplier > numberColumns_||perturbation_>=100) { perturbation_=101; #if ABC_NORMAL_DEBUG>0 printf("Not perturbing - %d different costs, average %g\n", number,averageCost); #endif #ifdef CLEANUP_DJS // copy cost to perturbation CoinAbcMemcpy(abcPerturbation_,abcCost_,numberTotal_); #endif return ; // good enough } const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths()-maximumAbcNumberRows_; const double * COIN_RESTRICT lower = lowerSaved_; const double * COIN_RESTRICT upper = upperSaved_; for (int iSequence = maximumAbcNumberRows_; iSequence < numberTotal_; iSequence++) { if (lower[iSequence] < upper[iSequence]) { int length = columnLength[iSequence]; if (length > 2) { maxLength = CoinMax(maxLength, length); minLength = CoinMin(minLength, length); } } } bool uniformChange = false; bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; double constantPerturbation = 10.0 * dualTolerance_; #ifdef PERT_STATISTICS breakdown("Objective before perturbation", numberColumns_, abcCost_+numberRows_); #endif //#define PERTURB_OLD_WAY #ifndef PERTURB_OLD_WAY #if 1 #ifdef HEAVY_PERTURBATION if (perturbation_==50) perturbation_=HEAVY_PERTURBATION; #endif if (perturbation_ >= 50) { // Experiment // maximumFraction could be 1.0e-10 to 1.0 double m[] = {1.0e-10, 1.0e-9, 1.0e-8, 1.0e-7, 1.0e-6, 1.0e-5, 1.0e-4, 1.0e-3, 1.0e-2, 1.0e-1, 1.0}; int whichOne = CoinMin(perturbation_ - 51,10); if (whichOne<0) { if (numberRows_<5000) whichOne=2; // treat 50 as if 53 else whichOne=2; // treat 50 as if 52 } if (inCbcOrOther&&whichOne>0) whichOne--; maximumFraction = m[whichOne]; if (whichOne>7) constantPerturbation *= 10.0; //if (whichOne<2) //constantPerturbation = maximumFraction*1.0e-10 * dualTolerance_; } else if (inCbcOrOther) { maximumFraction = 1.0e-6; } #endif double smallestNonZero = 1.0e100; bool modifyRowCosts=false; numberNonZero = 0; //perturbation = 1.0e-10; perturbation = CoinMax(1.0e-10,maximumFraction); double * COIN_RESTRICT cost = abcCost_; bool allSame = true; double lastValue = 0.0; for (int iRow = 0; iRow < numberRows_; iRow++) { double lo = lower[iRow]; double up = upper[iRow]; if (lo < up) { double value = fabs(cost[iRow]); perturbation = CoinMax(perturbation, value); if (value) { modifyRowCosts = true; smallestNonZero = CoinMin(smallestNonZero, value); } } if (lo && lo > -1.0e10) { numberNonZero++; lo = fabs(lo); if (!lastValue) lastValue = lo; else if (fabs(lo - lastValue) > 1.0e-7) allSame = false; } if (up && up < 1.0e10) { numberNonZero++; up = fabs(up); if (!lastValue) lastValue = up; else if (fabs(up - lastValue) > 1.0e-7) allSame = false; } } double lastValue2 = 0.0; for (int iSequence = maximumAbcNumberRows_; iSequence < numberTotal_; iSequence++) { double lo = lower[iSequence]; double up = upper[iSequence]; if (lo < up) { double value = fabs(cost[iSequence]); perturbation = CoinMax(perturbation, value); if (value) { smallestNonZero = CoinMin(smallestNonZero, value); } } if (lo && lo > -1.0e10) { //numberNonZero++; lo = fabs(lo); if (!lastValue2) lastValue2 = lo; else if (fabs(lo - lastValue2) > 1.0e-7) allSame = false; } if (up && up < 1.0e10) { //numberNonZero++; up = fabs(up); if (!lastValue2) lastValue2 = up; else if (fabs(up - lastValue2) > 1.0e-7) allSame = false; } } if (allSame) { // Check elements double smallestNegative; double largestNegative; double smallestPositive; double largestPositive; matrix_->rangeOfElements(smallestNegative, largestNegative, smallestPositive, largestPositive); if (smallestNegative == largestNegative && smallestPositive == largestPositive) { // Really hit perturbation double adjust = CoinMin(100.0 * maximumFraction, 1.0e-3 * CoinMax(lastValue, lastValue2)); maximumFraction = CoinMax(adjust, maximumFraction); } } perturbation = CoinMin(perturbation, smallestNonZero / maximumFraction); double largestZero = 0.0; double largest = 0.0; double largestPerCent = 0.0; // modify costs bool printOut = (handler_->logLevel() == 63); printOut = false; //assert (!modifyRowCosts); modifyRowCosts = false; const double * COIN_RESTRICT perturbationArray = perturbationSaved_; if (modifyRowCosts) { for (int iRow = 0; iRow < numberRows_; iRow++) { if (lower[iRow] < upper[iRow]) { double value = perturbation; double currentValue = cost[iRow]; value = CoinMin(value, maximumFraction * (fabs(currentValue) + 1.0e-1 * perturbation + 1.0e-3)); double perturbationValue=2.0*(perturbationArray[iRow]-0.5); // for now back to normal random if (lower[iRow] > -largeValue_) { if (fabs(lower[iRow]) < fabs(upper[iRow])) value *= perturbationValue; else value *= -perturbationValue; } else if (upper[iRow] < largeValue_) { value *= -perturbationValue; } else { value = 0.0; } if (currentValue) { largest = CoinMax(largest, fabs(value)); if (fabs(value) > fabs(currentValue)*largestPerCent) largestPerCent = fabs(value / currentValue); } else { largestZero = CoinMax(largestZero, fabs(value)); } if (printOut) printf("row %d cost %g change %g\n", iRow, cost[iRow], value); cost[iRow] += value; } } } //double extraWeight = 10.0; // more its but faster double weight[]={1.0e-4,1.0e-2,1.0e-1,1.0,2.0,10.0,100.0,200.0,400.0,600.0,1000.0}; // good its double weight[]={1.0e-4,1.0e-2,5.0e-1,1.0,2.0,5.0,10.0,20.0,30.0,40.0,100.0}; double weight[] = {1.0e-4, 1.0e-2, 5.0e-1, 1.0, 2.0, 5.0, 10.0, 20.0, 30.0, 40.0, 100.0}; //double weight[]={1.0e-4,1.0e-2,5.0e-1,1.0,20.0,50.0,100.0,120.0,130.0,140.0,200.0}; // Scale back if wanted double weight2[] = {1.0e-4, 1.0e-2, 5.0e-1, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}; if (constantPerturbation < 99.0 * dualTolerance_&&false) { perturbation *= 0.1; //extraWeight = 0.5; memcpy(weight, weight2, sizeof(weight2)); } // adjust weights if all columns long double factor = 1.0; if (maxLength) { factor = 3.0 / static_cast (minLength); } // Make variables with more elements more expensive const double m1 = 0.5; double smallestAllowed = overallMultiplier*CoinMin(1.0e-2 * dualTolerance_, maximumFraction); double largestAllowed = overallMultiplier*CoinMax(1.0e3 * dualTolerance_, maximumFraction * averageCost); // smaller if in BAB //if (inCbcOrOther) //largestAllowed=CoinMin(largestAllowed,1.0e-5); //smallestAllowed = CoinMin(smallestAllowed,0.1*largestAllowed); randomNumberGenerator_.setSeed(1000000000); #if ABC_NORMAL_DEBUG>0 printf("perturbation %g constantPerturbation %g smallestNonZero %g maximumFraction %g smallestAllowed %g\n", perturbation,constantPerturbation,smallestNonZero,maximumFraction, smallestAllowed); #endif for (int iSequence = maximumAbcNumberRows_; iSequence < numberTotal_; iSequence++) { if (lower[iSequence] < upper[iSequence] && getInternalStatus(iSequence) != basic) { double value = perturbation; double currentValue = cost[iSequence]; double currentLargestAllowed=fabs(currentValue)*1.0e-3; if (!currentValue) currentLargestAllowed=1.0e-3; if (currentLargestAllowed<=10.0*smallestAllowed) continue; // don't perturb tiny value value = CoinMin(value, constantPerturbation + maximumFraction * (fabs(currentValue) + 1.0e-1 * perturbation + 1.0e-8)); //value = CoinMin(value,constantPerturbation;+maximumFraction*fabs(currentValue)); double value2 = constantPerturbation + 1.0e-1 * smallestNonZero; if (uniformChange) { value = maximumFraction; value2 = maximumFraction; } //double perturbationValue=2.0*(perturbationArray[iSequence]-0.5); // for now back to normal random double perturbationValue=randomNumberGenerator_.randomDouble(); perturbationValue = 1.0-m1+m1*perturbationValue; // clean up if (lower[iSequence] > -largeValue_) { if (fabs(lower[iSequence]) < fabs(upper[iSequence])) { value *= perturbationValue; value2 *= perturbationValue; } else { //value *= -(1.0-m1+m1*randomNumberGenerator_.randomDouble()); //value2 *= -(1.0-m1+m1*randomNumberGenerator_.randomDouble()); value = 0.0; } } else if (upper[iSequence] < largeValue_) { value *= -perturbationValue; value2 *= -perturbationValue; } else { value = 0.0; } if (value) { int length = columnLength[iSequence]; if (length > 3) { length = static_cast (static_cast (length) * factor); length = CoinMax(3, length); } double multiplier; if (length < 10) multiplier = weight[length]; else multiplier = weight[10]; value *= multiplier; value = CoinMin(value, value2); if (value) { // get in range if (fabs(value) <= smallestAllowed) { value *= 10.0; while (fabs(value) <= smallestAllowed) value *= 10.0; } else if (fabs(value) > currentLargestAllowed) { value *= 0.1; while (fabs(value) > currentLargestAllowed) value *= 0.1; } } if (currentValue) { largest = CoinMax(largest, fabs(value)); if (fabs(value) > fabs(currentValue)*largestPerCent) largestPerCent = fabs(value / currentValue); } else { largestZero = CoinMax(largestZero, fabs(value)); } // but negative if at ub if (getInternalStatus(iSequence) == atUpperBound) value = -value; if (printOut) printf("col %d cost %g change %g\n", iSequence, cost[iSequence], value); cost[iSequence] += value; } } } #else // old way if (perturbation_ > 50) { // Experiment // maximumFraction could be 1.0e-10 to 1.0 double m[] = {1.0e-10, 1.0e-9, 1.0e-8, 1.0e-7, 1.0e-6, 1.0e-5, 1.0e-4, 1.0e-3, 1.0e-2, 1.0e-1, 1.0}; int whichOne = perturbation_ - 51; //if (inCbcOrOther&&whichOne>0) //whichOne--; maximumFraction = m[CoinMin(whichOne, 10)]; } else if (inCbcOrOther) { //maximumFraction = 1.0e-6; } int iRow; double smallestNonZero = 1.0e100; numberNonZero = 0; if (perturbation_ >= 50) { perturbation = 1.0e-8; if (perturbation_ > 50 && perturbation_ < 60) perturbation = CoinMax(1.0e-8,maximumFraction); bool allSame = true; double lastValue = 0.0; for (iRow = 0; iRow < numberRows_; iRow++) { double lo = abcLower_[iRow]; double up = abcUpper_[iRow]; if (lo && lo > -1.0e10) { numberNonZero++; lo = fabs(lo); if (!lastValue) lastValue = lo; else if (fabs(lo - lastValue) > 1.0e-7) allSame = false; } if (up && up < 1.0e10) { numberNonZero++; up = fabs(up); if (!lastValue) lastValue = up; else if (fabs(up - lastValue) > 1.0e-7) allSame = false; } } double lastValue2 = 0.0; for (int iColumn = maximumAbcNumberRows_; iColumn < numberTotal_; iColumn++) { double lo = abcLower_[iColumn]; double up = abcUpper_[iColumn]; if (lo < up) { double value = fabs(abcCost_[iColumn]); perturbation = CoinMax(perturbation, value); if (value) { smallestNonZero = CoinMin(smallestNonZero, value); } } if (lo && lo > -1.0e10) { //numberNonZero++; lo = fabs(lo); if (!lastValue2) lastValue2 = lo; else if (fabs(lo - lastValue2) > 1.0e-7) allSame = false; } if (up && up < 1.0e10) { //numberNonZero++; up = fabs(up); if (!lastValue2) lastValue2 = up; else if (fabs(up - lastValue2) > 1.0e-7) allSame = false; } } if (allSame) { // Check elements double smallestNegative; double largestNegative; double smallestPositive; double largestPositive; matrix_->rangeOfElements(smallestNegative, largestNegative, smallestPositive, largestPositive); if (smallestNegative == largestNegative && smallestPositive == largestPositive) { // Really hit perturbation double adjust = CoinMin(100.0 * maximumFraction, 1.0e-3 * CoinMax(lastValue, lastValue2)); maximumFraction = CoinMax(adjust, maximumFraction); } } perturbation = CoinMin(perturbation, smallestNonZero / maximumFraction); } double largestZero = 0.0; double largest = 0.0; double largestPerCent = 0.0; // modify costs bool printOut = (handler_->logLevel() == 63); printOut = false; // more its but faster double weight[]={1.0e-4,1.0e-2,1.0e-1,1.0,2.0,10.0,100.0,200.0,400.0,600.0,1000.0}; // good its double weight[]={1.0e-4,1.0e-2,5.0e-1,1.0,2.0,5.0,10.0,20.0,30.0,40.0,100.0}; double weight[] = {1.0e-4, 1.0e-2, 5.0e-1, 1.0, 2.0, 5.0, 10.0, 20.0, 30.0, 40.0, 100.0}; //double weight[]={1.0e-4,1.0e-2,5.0e-1,1.0,20.0,50.0,100.0,120.0,130.0,140.0,200.0}; //double extraWeight = 10.0; // Scale back if wanted double weight2[] = {1.0e-4, 1.0e-2, 5.0e-1, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}; if (constantPerturbation < 99.0 * dualTolerance_) { perturbation *= 0.1; //extraWeight = 0.5; memcpy(weight, weight2, sizeof(weight2)); } // adjust weights if all columns long double factor = 1.0; if (maxLength) { factor = 3.0 / static_cast (minLength); } // Make variables with more elements more expensive const double m1 = 0.5; double smallestAllowed = CoinMin(1.0e-2 * dualTolerance_, maximumFraction); double largestAllowed = CoinMax(1.0e3 * dualTolerance_, maximumFraction * averageCost); // smaller if in BAB //if (inCbcOrOther) //largestAllowed=CoinMin(largestAllowed,1.0e-5); //smallestAllowed = CoinMin(smallestAllowed,0.1*largestAllowed); for (int iColumn = maximumAbcNumberRows_; iColumn < numberTotal_; iColumn++) { if (abcLower_[iColumn] < abcUpper_[iColumn] && getInternalStatus(iColumn) != basic) { double value = perturbation; double currentValue = abcCost_[iColumn]; value = CoinMin(value, constantPerturbation + maximumFraction * (fabs(currentValue) + 1.0e-1 * perturbation + 1.0e-8)); //value = CoinMin(value,constantPerturbation;+maximumFraction*fabs(currentValue)); double value2 = constantPerturbation + 1.0e-1 * smallestNonZero; if (uniformChange) { value = maximumFraction; value2 = maximumFraction; } if (abcLower_[iColumn] > -largeValue_) { if (fabs(abcLower_[iColumn]) < fabs(abcUpper_[iColumn])) { value *= (1.0 - m1 + m1 * randomNumberGenerator_.randomDouble()); value2 *= (1.0 - m1 + m1 * randomNumberGenerator_.randomDouble()); } else { //value *= -(1.0-m1+m1*randomNumberGenerator_.randomDouble()); //value2 *= -(1.0-m1+m1*randomNumberGenerator_.randomDouble()); value = 0.0; } } else if (abcUpper_[iColumn] < largeValue_) { value *= -(1.0 - m1 + m1 * randomNumberGenerator_.randomDouble()); value2 *= -(1.0 - m1 + m1 * randomNumberGenerator_.randomDouble()); } else { value = 0.0; } if (value) { int length = columnLength[iColumn]; if (length > 3) { length = static_cast (static_cast (length) * factor); length = CoinMax(3, length); } double multiplier; #if 1 if (length < 10) multiplier = weight[length]; else multiplier = weight[10]; #else if (length < 10) multiplier = weight[length]; else multiplier = weight[10] + extraWeight * (length - 10); multiplier *= 0.5; #endif value *= multiplier; value = CoinMin(value, value2); if (value) { // get in range if (fabs(value) <= smallestAllowed) { value *= 10.0; while (fabs(value) <= smallestAllowed) value *= 10.0; } else if (fabs(value) > largestAllowed) { value *= 0.1; while (fabs(value) > largestAllowed) value *= 0.1; } } if (currentValue) { largest = CoinMax(largest, fabs(value)); if (fabs(value) > fabs(currentValue)*largestPerCent) largestPerCent = fabs(value / currentValue); } else { largestZero = CoinMax(largestZero, fabs(value)); } // but negative if at ub if (getInternalStatus(iColumn) == atUpperBound) value = -value; if (printOut) printf("col %d cost %g change %g\n", iColumn, objectiveWork_[iColumn], value); abcCost_[iColumn] += value; } } } #endif #ifdef PERT_STATISTICS { double averageCost = 0.0; int numberNonZero = 0; double * COIN_RESTRICT sort = new double[numberColumns_]; for (int i = 0; i < numberColumns_; i++) { double value = fabs(abcCost_[i+maximumAbcNumberRows_]); sort[i] = value; averageCost += value; if (value) numberNonZero++; } if (numberNonZero) averageCost /= static_cast (numberNonZero); else averageCost = 1.0; std::sort(sort, sort + numberColumns_); int number = 1; double last = sort[0]; for (int i = 1; i < numberColumns_; i++) { if (last != sort[i]) number++; last = sort[i]; } delete [] sort; #if ABC_NORMAL_DEBUG>0 printf("nnz %d percent %d", number, (number * 100) / numberColumns_); breakdown("Objective after perturbation", numberColumns_, abcCost_+numberRows_); #endif } #endif perturbation_=100; // copy cost to perturbation #ifdef CLEANUP_DJS CoinAbcMemcpy(abcPerturbation_,abcCost_,numberTotal_); #endif handler_->message(CLP_SIMPLEX_PERTURB, messages_) << 100.0 * maximumFraction << perturbation << largest << 100.0 * largestPerCent << largestZero << CoinMessageEol; } /* Does something about fake tolerances -1 initializes 1 might be optimal (back to original costs) 2 after change currentDualBound 3 might be optimal BUT change currentDualBound */ int AbcSimplexDual::bounceTolerances(int type) { // for now turn off if (type==-1) { if (!perturbationFactor_) perturbationFactor_=0.001; CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_); if (!perturbationFactor_) { //currentDualBound_=CoinMin(dualBound_,1.0e11); //CoinAbcMultiplyAdd(perturbationSaved_,numberTotal_,currentDualTolerance_, // abcPerturbation_,0.0); } else { //currentDualBound_=CoinMin(dualBound_,1.0e11); double factor=currentDualTolerance_*perturbationFactor_; perturbB(factor,0); } #if ABC_NORMAL_DEBUG>0 //printf("new dual bound %g (bounceTolerances)\n",currentDualBound_); #endif } else { if (stateDualColumn_==-2) { double newTolerance=CoinMin(1.0e-1,dualTolerance_*100.0); #if ABC_NORMAL_DEBUG>0 printf("After %d iterations reducing dual tolerance from %g to %g\n", numberIterations_,currentDualTolerance_,newTolerance); #endif currentDualTolerance_=newTolerance; stateDualColumn_=-1; } else if (stateDualColumn_==-1) { #if ABC_NORMAL_DEBUG>0 printf("changing dual tolerance from %g to %g (vaguely optimal)\n", currentDualTolerance_,dualTolerance_); #endif currentDualTolerance_=dualTolerance_; stateDualColumn_=0; } else { if (stateDualColumn_>1) { normalDualColumnIteration_ = numberIterations_+CoinMax(10,numberRows_/4); #if ABC_NORMAL_DEBUG>0 printf("no cost modification until iteration %d\n",normalDualColumnIteration_); #endif } } resetFakeBounds(0); CoinAbcMemcpy(abcCost_,abcPerturbation_,numberTotal_); numberChanged_ = 0; // Number of variables with changed costs moveToBasic(); if (type!=1) return 0; // save status and solution CoinAbcMemcpy(status_,internalStatus_,numberTotal_); CoinAbcMemcpy(solutionSaved_,abcSolution_,numberTotal_); #if ABC_NORMAL_DEBUG>0 printf("A sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); #endif gutsOfSolution(3); #if ABC_NORMAL_DEBUG>0 printf("B sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); #endif double saveSum1=sumPrimalInfeasibilities_; double saveSumD1=sumDualInfeasibilities_; bool goToPrimal=false; if (!sumOfRelaxedDualInfeasibilities_) { if (perturbation_<101) { // try going back to original costs CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_); perturbation_=101; numberChanged_ = 0; // Number of variables with changed costs moveToBasic(); gutsOfSolution(3); #if ABC_NORMAL_DEBUG>0 printf("B2 sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); #endif saveSumD1=sumDualInfeasibilities_; } if (sumOfRelaxedDualInfeasibilities_) { makeNonFreeVariablesDualFeasible(); moveToBasic(); abcProgress_.reset(); gutsOfSolution(3); #if ABC_NORMAL_DEBUG>0 printf("C sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); #endif if (sumPrimalInfeasibilities_>1.0e2*saveSum1+currentDualBound_*0.2 /*|| sumOfRelaxedDualInfeasibilities_<1.0e-4*sumPrimalInfeasibilities_*/) { numberDisasters_++; if (numberDisasters_>2) goToPrimal=true; } } else { numberDualInfeasibilities_=0; sumDualInfeasibilities_=0.0; } } else { // carry on makeNonFreeVariablesDualFeasible(); moveToBasic(); abcProgress_.reset(); gutsOfSolution(3); #if ABC_NORMAL_DEBUG>0 printf("C2 sumDual %g sumPrimal %g\n",sumDualInfeasibilities_,sumPrimalInfeasibilities_); #endif numberDisasters_++; if (sumPrimalInfeasibilities_>1.0e2*saveSum1+currentDualBound_*0.2 ||(saveSumD1<1.0e-4*sumPrimalInfeasibilities_&&saveSumD1<1.0)) { numberDisasters_++; if (numberDisasters_>2||saveSumD1<1.0e-10*sumPrimalInfeasibilities_) goToPrimal=true; } } if (goToPrimal) { // go to primal CoinAbcMemcpy(internalStatus_,status_,numberTotal_); CoinAbcMemcpy(abcSolution_,solutionSaved_,numberTotal_); int * COIN_RESTRICT abcPivotVariable = abcPivotVariable_; // redo pivotVariable int numberBasic=0; for (int i=0;i0 printf("D sumPrimal %g\n",sumPrimalInfeasibilities_); #endif return 1; } } CoinAbcGatherFrom(abcCost_,costBasic_,abcPivotVariable_,numberRows_); return 0; } #if ABC_NORMAL_DEBUG>0 extern int cilk_conflict; #endif int AbcSimplexDual::noPivotRow() { #if ABC_NORMAL_DEBUG>3 if (handler_->logLevel() & 32) printf("** no row pivot\n"); #endif int numberPivots = abcFactorization_->pivots(); bool specialCase; int useNumberFake; int returnCode = 0; if (numberPivots <= CoinMax(dontFactorizePivots_, 20) && (specialOptions_ & 2048) != 0 && currentDualBound_ >= 1.0e8) { specialCase = true; // as dual bound high - should be okay useNumberFake = 0; } else { specialCase = false; useNumberFake = numberAtFakeBound(); } if (!numberPivots || specialCase) { // may have crept through - so may be optimal // check any flagged variables if (numberFlagged_ && numberPivots) { // try factorization returnCode = -2; } if (useNumberFake || numberDualInfeasibilities_) { // may be dual infeasible if ((specialOptions_ & 1024) == 0) problemStatus_ = -5; else if (!useNumberFake && numberPrimalInfeasibilities_ && !numberPivots) problemStatus_ = 1; } else { if (numberFlagged_) { #if ABC_NORMAL_DEBUG>3 std::cout << "Flagged variables at end - infeasible?" << std::endl; printf("Probably infeasible - pivot was %g\n", alpha_); #endif #if ABC_NORMAL_DEBUG>3 abort(); #endif problemStatus_ = -5; } else { problemStatus_ = 0; #ifndef CLP_CHECK_NUMBER_PIVOTS #define CLP_CHECK_NUMBER_PIVOTS 10 #endif #if CLP_CHECK_NUMBER_PIVOTS < 20 if (numberPivots > CLP_CHECK_NUMBER_PIVOTS) { gutsOfSolution(2); rawObjectiveValue_ +=sumNonBasicCosts_; setClpSimplexObjectiveValue(); if (numberPrimalInfeasibilities_) { problemStatus_ = -1; returnCode = -2; } } #endif if (!problemStatus_) { // make it look OK numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; if (numberChanged_) { numberChanged_ = 0; // Number of variables with changed costs CoinAbcMemcpy(abcCost_,abcCost_+maximumNumberTotal_,numberTotal_); CoinAbcGatherFrom(abcCost_,costBasic_,abcPivotVariable_,numberRows_); // make sure duals are current gutsOfSolution(1); setClpSimplexObjectiveValue(); abcProgress_.modifyObjective(-COIN_DBL_MAX); if (numberDualInfeasibilities_) { problemStatus_ = 10; // was -3; numberTimesOptimal_++; } else { computeObjectiveValue(true); } } else if (numberPivots) { computeObjectiveValue(true); } sumPrimalInfeasibilities_ = 0.0; } if ((specialOptions_&(1024 + 16384)) != 0 && !problemStatus_&&abcFactorization_->pivots()) { CoinIndexedVector * arrayVector = &usefulArray_[arrayForFtran_]; double * rhs = arrayVector->denseVector(); arrayVector->clear(); CoinAbcScatterTo(solutionBasic_,abcSolution_,abcPivotVariable_,numberRows_); abcMatrix_->timesModifyExcludingSlacks(-1.0, abcSolution_,rhs); //#define CHECK_ACCURACY #ifdef CHECK_ACCURACY bool bad = false; #endif bool bad2 = false; int i; for ( i = 0; i < numberRows_; i++) { if (rhs[i] < abcLower_[i] - primalTolerance_ || rhs[i] > abcUpper_[i] + primalTolerance_) { bad2 = true; #ifdef CHECK_ACCURACY printf("row %d out of bounds %g, %g correct %g bad %g\n", i, abcLower_[i], abcUpper_[i], rhs[i], abcSolution_[i]); #endif } else if (fabs(rhs[i] - abcSolution_[i]) > 1.0e-3) { #ifdef CHECK_ACCURACY bad = true; printf("row %d correct %g bad %g\n", i, rhs[i], abcSolution_[i]); #endif } rhs[i] = 0.0; } for (int i = 0; i < numberTotal_; i++) { if (abcSolution_[i] < abcLower_[i] - primalTolerance_ || abcSolution_[i] > abcUpper_[i] + primalTolerance_) { bad2 = true; #ifdef CHECK_ACCURACY printf("column %d out of bounds %g, %g value %g\n", i, abcLower_[i], abcUpper_[i], abcSolution_[i]); #endif } } if (bad2) { problemStatus_ = -3; returnCode = -2; // Force to re-factorize early next time int numberPivots = abcFactorization_->pivots(); if (forceFactorization_<0) forceFactorization_=100000; forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); } } } } } else { problemStatus_ = -3; returnCode = -2; // Force to re-factorize early next time int numberPivots = abcFactorization_->pivots(); if (forceFactorization_<0) forceFactorization_=100000; forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); } return returnCode; } void AbcSimplexDual::dualPivotColumn() { double saveAcceptable=acceptablePivot_; if (largestPrimalError_>1.0e-5||largestDualError_>1.0e-5) { //if ((largestPrimalError_>1.0e-5||largestDualError_>1.0e-5)&&false) { if (!abcFactorization_->pivots()) acceptablePivot_*=1.0e2; else if (abcFactorization_->pivots()<5) acceptablePivot_*=1.0e1; } dualColumn2(); if (sequenceIn_<0&&acceptablePivot_>saveAcceptable) { acceptablePivot_=saveAcceptable; #if ABC_NORMAL_DEBUG>0 printf("No pivot!!!\n"); #endif // try again dualColumn1(true); dualColumn2(); } else { acceptablePivot_=saveAcceptable; } if ((stateOfProblem_&VALUES_PASS)!=0) { // check no flips assert (!usefulArray_[arrayForFlipBounds_].getNumElements()); // If no pivot - then try other way if plausible if (sequenceIn_<0) { // could use fake primal basic values if ((directionOut_<0&&lowerOut_>-1.0e30)|| (directionOut_>0&&upperOut_<1.30)) { directionOut_=-directionOut_; if (directionOut_<0&&abcDj_[sequenceOut_]<0.0) upperTheta_=-abcDj_[sequenceOut_]; else if (directionOut_>0&&abcDj_[sequenceOut_]>0.0) upperTheta_=abcDj_[sequenceOut_]; else upperTheta_=1.0e30; CoinPartitionedVector & tableauRow = usefulArray_[arrayForTableauRow_]; CoinPartitionedVector & candidateList = usefulArray_[arrayForDualColumn_]; assert (!candidateList.getNumElements()); tableauRow.compact(); candidateList.compact(); // redo candidate list int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); double * COIN_RESTRICT arrayCandidate=candidateList.denseVector(); int * COIN_RESTRICT indexCandidate = candidateList.getIndices(); const double * COIN_RESTRICT abcDj = abcDj_; const unsigned char * COIN_RESTRICT internalStatus = internalStatus_; // do first pass to get possibles double bestPossible = 0.0; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; // try with this much smaller as guess double acceptablePivot = currentAcceptablePivot_; double dualT=-currentDualTolerance_; // fixed will have been taken out by now const double multiplier[] = { 1.0, -1.0}; int freeSequence=-1; double freeAlpha=0.0; int numberNonZero=tableauRow.getNumElements(); int numberRemaining=0; if (ordinaryVariables()) { for (int i = 0; i < numberNonZero; i++) { int iSequence = index[i]; double tableauValue=array[i]; unsigned char iStatus=internalStatus[iSequence]&7; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta_ * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta_ = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } else { double badFree = 0.0; freeAlpha = currentAcceptablePivot_; double currentDualTolerance = currentDualTolerance_; for (int i = 0; i < numberNonZero; i++) { int iSequence = index[i]; double tableauValue=array[i]; unsigned char iStatus=internalStatus[iSequence]&7; if ((iStatus&4)==0) { double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta_ * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta_ = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } else { bool keep; bestPossible = CoinMax(bestPossible, fabs(tableauValue)); double oldValue = abcDj[iSequence]; // If free has to be very large - should come in via dualRow //if (getInternalStatus(iSequence+addSequence)==isFree&&fabs(tableauValue)<1.0e-3) //break; if (oldValue > currentDualTolerance) { keep = true; } else if (oldValue < -currentDualTolerance) { keep = true; } else { if (fabs(tableauValue) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) { keep = true; } else { keep = false; badFree = CoinMax(badFree, fabs(tableauValue)); } } if (keep) { // free - choose largest if (fabs(tableauValue) > fabs(freeAlpha)) { freeAlpha = tableauValue; freeSequence = iSequence; } } } } } candidateList.setNumElements(numberRemaining); if (freeSequence>=0) { sequenceIn_=freeSequence; } else if (fabs(upperTheta_-fabs(abcDj_[sequenceOut_]))= 0&&upperTheta_==COIN_DBL_MAX) { lowerIn_ = abcLower_[sequenceIn_]; upperIn_ = abcUpper_[sequenceIn_]; valueIn_ = abcSolution_[sequenceIn_]; dualIn_ = abcDj_[sequenceIn_]; if (valueIn_upperIn_-primalTolerance_) { directionIn_ = -1; } else { if (alpha_ < 0.0) { // as if from upper bound directionIn_ = -1; //assert(upperIn_ == valueIn_); } else { // as if from lower bound directionIn_ = 1; //assert(lowerIn_ == valueIn_); } } } #if ABC_DEBUG checkArrays(4); #endif #if CAN_HAVE_ZERO_OBJ>1 if ((specialOptions_&2097152)!=0) theta_=0.0; #endif movement_=0.0; objectiveChange_=0.0; /* 0 - take iteration 1 - don't take but continue 2 - don't take and break */ btranAlpha_ = -alpha_ * directionOut_; // for check } void AbcSimplexDual::getTableauColumnPart2() { #if ABC_PARALLEL if (parallelMode_!=0) { abcFactorization_->updateColumnFTPart2(usefulArray_[arrayForFtran_]); // pivot element alpha_ = usefulArray_[arrayForFtran_].denseVector()[pivotRow_]; } #endif } void AbcSimplexDual::replaceColumnPart3() { abcFactorization_->replaceColumnPart3(this, &usefulArray_[arrayForReplaceColumn_], &usefulArray_[arrayForFtran_], lastPivotRow_, ftAlpha_?ftAlpha_:alpha_); } void AbcSimplexDual::checkReplacePart1() { //abcFactorization_->checkReplacePart1a(&usefulArray_[arrayForReplaceColumn_],pivotRow_); //usefulArray_[arrayForReplaceColumn_].print(); ftAlpha_=abcFactorization_->checkReplacePart1(&usefulArray_[arrayForReplaceColumn_],pivotRow_); } #if 0 void AbcSimplexDual::checkReplacePart1a() { abcFactorization_->checkReplacePart1a(&usefulArray_[arrayForReplaceColumn_],pivotRow_); } void AbcSimplexDual::checkReplacePart1b() { //usefulArray_[arrayForReplaceColumn_].print(); ftAlpha_=abcFactorization_->checkReplacePart1b(&usefulArray_[arrayForReplaceColumn_],pivotRow_); } #endif /* returns 0 - OK 1 - take iteration then re-factorize 2 - flag something and skip 3 - break and re-factorize 5 - take iteration then re-factorize because of memory */ int AbcSimplexDual::checkReplace() { int returnCode=0; if (!stateOfIteration_) { int saveStatus=problemStatus_; // check update #if MOVE_REPLACE_PART1A < 0 checkReplacePart1(); #endif int updateStatus=abcFactorization_->checkReplacePart2(pivotRow_,btranAlpha_,alpha_,ftAlpha_); #if ABC_DEBUG checkArrays(); #endif // If looks like bad pivot - refactorize if (fabs(dualOut_) > 1.0e50) updateStatus = 2; // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && !abcFactorization_->pivots() && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4) { // slight error if (abcFactorization_->pivots() > 5 || updateStatus == 4) { problemStatus_ = -2; // factorize now returnCode = -3; } } else if (updateStatus == 2) { // major error // later we may need to unwind more e.g. fake bounds if (abcFactorization_->pivots() && ((moreSpecialOptions_ & 16) == 0 || abcFactorization_->pivots() > 4)) { problemStatus_ = -2; // factorize now returnCode = -2; moreSpecialOptions_ |= 16; stateOfIteration_=2; } else { assert (sequenceOut_>=0); // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>0 printf("BAD flag b %g pivotRow %d (seqout %d) sequenceIn %d\n", alpha_,pivotRow_, sequenceOut_,sequenceIn_); #endif setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; //abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious //clearArrays(-1); //if(primalSolutionUpdated) //gutsOfSolution(2); stateOfIteration_=1; } } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (abcFactorization_->pivots() < 0.5 * abcFactorization_->maximumPivots() && abcFactorization_->pivots() < 200) abcFactorization_->areaFactor( abcFactorization_->areaFactor() * 1.1); problemStatus_ = -2; // factorize now } else if (updateStatus == 5) { problemStatus_ = -2; // factorize now } if (theta_ < 0.0) { #if ABC_NORMAL_DEBUG>3 if (handler_->logLevel() & 32) printf("negative theta %g\n", theta_); #endif theta_ = 0.0; } //printf("check pstatus %d ustatus %d returncode %d nels %d\n", // problemStatus_,updateStatus,returnCode,usefulArray_[arrayForReplaceColumn_].getNumElements()); if (saveStatus!=-1) problemStatus_=saveStatus; } return returnCode; } int AbcSimplexDual::noPivotColumn() { // no incoming column is valid int returnCode=0; if (abcFactorization_->pivots() < 5 && acceptablePivot_ > 1.0e-8) acceptablePivot_ = 1.0e-8; returnCode = 1; #if ABC_NORMAL_DEBUG>3 if (handler_->logLevel() & 32) printf("** no column pivot\n"); #endif if (abcFactorization_->pivots() <=dontFactorizePivots_ && acceptablePivot_ <= 1.0e-8 && lastFirstFree_<0) { // If not in branch and bound etc save ray delete [] ray_; if ((specialOptions_&(1024 | 4096)) == 0 || (specialOptions_ & 32) != 0) { // create ray anyway ray_ = new double [ numberRows_]; setUsedArray(0); usefulArray_[arrayForBtran_].createOneUnpackedElement(pivotRow_, -directionOut_); abcFactorization_->updateColumnTranspose(usefulArray_[arrayForBtran_]); CoinMemcpyN(usefulArray_[arrayForBtran_].denseVector(), numberRows_, ray_); clearArrays(0); } else { ray_ = NULL; } // If we have just factorized and infeasibility reasonable say infeas double dualTest = ((specialOptions_ & 4096) != 0) ? 1.0e8 : 1.0e13; if (largestGap_) dualTest=CoinMin(largestGap_,dualTest); // but ignore if none at fake bound if (currentDualBound_= dualTest) { double testValue = 1.0e-4; if (!abcFactorization_->pivots() && numberPrimalInfeasibilities_ == 1) testValue = 1.0e-6; if (valueOut_ > upperOut_ + testValue || valueOut_ < lowerOut_ - testValue || (specialOptions_ & 64) == 0) { // say infeasible problemStatus_ = 1; // unless primal feasible!!!! //#define TEST_CLP_NODE #ifndef TEST_CLP_NODE // Should be correct - but ... int numberFake = numberAtFakeBound(); double sumPrimal = (!numberFake) ? 2.0e5 : sumPrimalInfeasibilities_; if (sumPrimalInfeasibilities_ < 1.0e-3 || sumDualInfeasibilities_ > 1.0e-5 || (sumPrimal < 1.0e5 && (specialOptions_ & 1024) != 0 && abcFactorization_->pivots())) { if (sumPrimal > 50.0 && abcFactorization_->pivots() > 2) { problemStatus_ = -4; } else { problemStatus_ = 10; // Get rid of objective if ((specialOptions_ & 16384) == 0) objective_ = new ClpLinearObjective(NULL, numberColumns_); } } #else if (sumPrimalInfeasibilities_ < 1.0e-3 || sumDualInfeasibilities_ > 1.0e-6) { if ((specialOptions_ & 1024) != 0 && abcFactorization_->pivots()) { problemStatus_ = 10; // Get rid of objective if ((specialOptions_ & 16384) == 0) objective_ = new ClpLinearObjective(NULL, numberColumns_); } } #endif returnCode = 1; stateOfIteration_=2; } } if (abcFactorization_->pivots() != 0) { // If special option set - put off as long as possible if ((specialOptions_ & 64) == 0 || (moreSpecialOptions_ & 64) != 0) { if (numberTimesOptimal_<3&&abcFactorization_->pivots()>dontFactorizePivots_) problemStatus_ = -4; //say looks infeasible else problemStatus_ = 1; //say looks really infeasible } else { assert (sequenceOut_>=0); // flag char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>3 printf("flag c\n"); #endif setFlagged(sequenceOut_); lastBadIteration_ = numberIterations_; // say be more cautious // so can't happen immediately again sequenceOut_=-1; if (!abcFactorization_->pivots()) { stateOfIteration_=1; } } } } pivotRow_ = -1; lastPivotRow_=-1; return returnCode; } #if 0 #include "CoinTime.hpp" // Timed wait in nanoseconds - if negative then seconds static int timedWait(AbcSimplexDual * dual,int time, int which) { pthread_mutex_lock(dual->mutexPointer(which)); struct timespec absTime; clock_gettime(CLOCK_REALTIME, &absTime); if (time > 0) { absTime.tv_nsec += time; if (absTime.tv_nsec >= 1000000000) { absTime.tv_nsec -= 1000000000; absTime.tv_sec++; } } else { absTime.tv_sec -= time; } int rc = 0; while (! dual->threadInfoPointer()->status && rc == 0) { printf("waiting for signal on %d\n",which); rc = pthread_cond_timedwait(dual->conditionPointer(which), dual->mutexPointer(which), &absTime); } if (rc == 0) rc=dual->threadInfoPointer()->status; printf("got signal %d on %d\n",rc,which); //pthread_mutex_unlock(dual->mutexPointer(which)); return rc; } #endif #if ABC_PARALLEL==1 void * abc_parallelManager(void * simplex) { AbcSimplexDual * dual = reinterpret_cast(simplex); int whichThread=dual->whichThread(); CoinThreadInfo * threadInfo = dual->threadInfoPointer(whichThread); pthread_mutex_lock(dual->mutexPointer(2,whichThread)); pthread_barrier_wait(dual->barrierPointer()); #if 0 int status=-1; while (status!=100) status=timedWait(dual,1000,2); pthread_cond_signal(dual->conditionPointer(1)); pthread_mutex_unlock(dual->mutexPointer(1,whichThread)); #endif // so now mutex_ is locked int whichLocked=0; while (true) { pthread_mutex_t * mutexPointer = dual->mutexPointer(whichLocked,whichThread); // wait //printf("Child waiting for %d - status %d %d %d\n", // whichLocked,lockedX[0],lockedX[1],lockedX[2]); pthread_mutex_lock (mutexPointer); whichLocked++; if (whichLocked==3) whichLocked=0; int unLock=whichLocked+1; if (unLock==3) unLock=0; //printf("child pointer %x status %d\n",threadInfo,threadInfo->status); assert(threadInfo->status>=0); if (threadInfo->status==1000) pthread_exit(NULL); int type=threadInfo->status; int * which = threadInfo->stuff; int & returnCode=which[0]; CoinIndexedVector * array; double dummy; switch(type) { // dummy case 0: break; case 1: returnCode=computeDualsAndCheck(dual,which); break; case 2: array=dual->usefulArray(dual->arrayForBtran()); // assuming not big overlap dual->dualRowPivot()->updateWeightsOnly(*array); //array->checkClean(); break; case 3: //dual->replaceColumnPart3(); dual->updateDualsInDual(); break; case 4: which[2]=-1; dual->abcMatrix()->dualColumn1Part(which[1],which[2],threadInfo->result, *dual->usefulArray(dual->arrayForBtran()), *dual->usefulArray(dual->arrayForTableauRow()), *dual->usefulArray(dual->arrayForDualColumn())); break; case 5: which[2]=-1; threadInfo->result= dual->abcMatrix()->dualColumn1Row(which[1],COIN_DBL_MAX,which[2], *dual->usefulArray(dual->arrayForBtran()), *dual->usefulArray(dual->arrayForTableauRow()), *dual->usefulArray(dual->arrayForDualColumn())); break; case 6:// not used dual->getTableauColumnPart2(); break; case 7: dual->checkReplacePart1(); //dual->checkReplacePart1a(); //dual->checkReplacePart1b(); break; case 8: which[2] = dual->flipBounds(); break; case 9: dual->replaceColumnPart3(); break; case 100: // initialization break; } threadInfo->status=-1; pthread_mutex_unlock (dual->mutexPointer(unLock,whichThread)); } } void AbcSimplex::startParallelStuff(int type) { /* first time 0,1 owned by main 2 by child at end of cycle should be 1,2 by main 0 by child then 2,0 by main 1 by child */ int iStart=1; for (int i=0;i=3) locked-=3; pthread_mutex_lock(&mutex_[locked+i*3]); locked_[i]++; if (locked_[i]==3) locked_[i]=0; } iStop = iStop<<1; } return threadInfo_[0].stuff[0]; } #endif //#define PRINT_WEIGHTS_FREQUENCY #ifdef PRINT_WEIGHTS_FREQUENCY extern int xweights1; extern int xweights2; extern int xweights3; #endif //static int whichModel=0; int AbcSimplexDual::dual() { //handler_->setLogLevel(63); #if 0 whichModel++; printf("STARTing dual %d rows - model %d\n",numberRows_,whichModel); char modelName[20]; sprintf(modelName,"model%d.mps",whichModel); writeMps(modelName,2); sprintf(modelName,"model%d.bas",whichModel); writeBasis(modelName,true,2); #endif bestObjectiveValue_ = -COIN_DBL_MAX; algorithm_ = -1; moreSpecialOptions_ &= ~16; // clear check replaceColumn accuracy normalDualColumnIteration_=0; problemStatus_=-1; numberIterations_=baseIteration_; //baseIteration_=0; if (!lastDualBound_) { dualTolerance_ = dblParam_[ClpDualTolerance]; primalTolerance_ = dblParam_[ClpPrimalTolerance]; int tryType=moreSpecialOptions_/65536; if (tryType<5) { currentDualBound_=1.0e8; } else { currentDualBound_=1.0e4; tryType -=5; } currentDualBound_=CoinMin(currentDualBound_,dualBound_); #if ABC_NORMAL_DEBUG>0 printf("dual bound %g (initialize)\n",currentDualBound_); #endif switch(tryType) { default: currentDualTolerance_=dualTolerance_; stateDualColumn_=0; break; case 1: currentDualTolerance_=CoinMin(1.0e-1,dualTolerance_*10.0); stateDualColumn_=-1; break; case 2: currentDualTolerance_=CoinMin(1.0e-1,dualTolerance_*100.0); stateDualColumn_=-1; break; case 3: currentDualTolerance_=CoinMin(1.0e-1,dualTolerance_*10000.0); stateDualColumn_=-1; // was -2 but that doesn't seem to work break; case 4: currentDualTolerance_=CoinMin(1.0e-1,dualTolerance_*1000000.0); stateDualColumn_=-1; // was -2 but that doesn't seem to work break; } } else { // done before currentDualBound_=1.1*lastDualBound_; currentDualTolerance_=dualTolerance_; #if ABC_NORMAL_DEBUG>0 printf("new dual bound %g (resolve)\n",currentDualBound_); #endif } // save data saveData_ = saveData(); // initialize copyFromSaved(); // temp if (fabs(primalTolerance()-1.001e-6)<1.0e-12&&false) { printf("trying idiot idea - need scaled matrix\n"); primalTolerance_=1.0e-6; //for (int i=0;itransposeTimesAll(cost_,abcCost_); delete [] cost_; cost_=NULL; CoinAbcMemcpy(costSaved_,abcCost_,numberTotal_); CoinAbcMemcpy(abcDj_,abcCost_,numberTotal_); static_cast (this)->makeNonFreeVariablesDualFeasible(); const double multiplier[] = { 1.0, -1.0}; double dualT = - currentDualTolerance_; double * COIN_RESTRICT solution = abcSolution_; double * COIN_RESTRICT lower = abcLower_; double * COIN_RESTRICT upper = abcUpper_; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { int iStatus = internalStatus_[iSequence] & 7; if (iStatus<4) { double lowerValue=lower[iSequence]; double upperValue=upper[iSequence]; if (lowerValue>-1.0e10||upperValue<1.0e10) { double mult = multiplier[iStatus]; double dj = abcDj_[iSequence] * mult; if (dj < dualT) iStatus=1-iStatus; if (lowerValue<=-1.0e10) iStatus=1; else if (upperValue>=1.0e10) iStatus=0; if (iStatus==0) { setInternalStatus(iSequence, atLowerBound); solution[iSequence] = lower[iSequence]; } else { setInternalStatus(iSequence, atUpperBound); solution[iSequence] = upper[iSequence]; } } assert (fabs(solution[iSequence])<1.0e10); } } CoinAbcMemcpy(solutionSaved_,abcSolution_,numberTotal_); } numberFlagged_=0; #ifndef NDEBUG for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; assert (!flagged(iPivot)); } #endif #if ABC_PARALLEL==1 // redo to test on parallelMode_ if (parallelMode_!=0) { // For waking up thread memset(mutex_,0,sizeof(mutex_)); for (int iThread=0;iThread(this)); } pthread_barrier_wait(&barrier_); pthread_barrier_destroy(&barrier_); for (int iThread=0;iThreadsetParallelMode(parallelMode_); #endif static_cast(this)->bounceTolerances(-1); int saveDont = dontFactorizePivots_; if ((specialOptions_ & 2048) == 0) dontFactorizePivots_ = 0; else if(!dontFactorizePivots_) dontFactorizePivots_ = 20; if (alphaAccuracy_ != -1.0) alphaAccuracy_ = 1.0; startupSolve(); lastPivotRow_=-1; pivotRow_=-1; // Save so can see if doing after primal swappedAlgorithm_ = (problemStatus_==10) ? 10 : 0; if (problemStatus_) { #ifdef PRINT_WEIGHTS_FREQUENCY xweights1=0; xweights2=0; xweights3=0; #endif numberFreeNonBasic_=0; gutsOfDual(); #ifdef PRINT_WEIGHTS_FREQUENCY if (dynamic_cast(abcDualRowPivot_)) { printf("ZZZZ %d iterations weights updated %d times\n",numberIterations_,xweights1+xweights2+xweights3); assert(numberIterations_==xweights1+xweights2+xweights3); } #endif } if (!problemStatus_) { // see if cutoff reached double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if(fabs(limit) < 1.0e30 && minimizationObjectiveValue() > limit + 1.0e-7 + 1.0e-8 * fabs(limit)) { // actually infeasible on objective problemStatus_ = 1; secondaryStatus_ = 1; } } // If infeasible but primal errors - try dual if (problemStatus_==1 && numberPrimalInfeasibilities_) { bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; double factor = (!inCbcOrOther) ? 1.0 : 0.3; double averageInfeasibility = sumPrimalInfeasibilities_/ static_cast(numberPrimalInfeasibilities_); if (averageInfeasibility #include #include "ClpModel.hpp" #include "ClpMatrixBase.hpp" #include "ClpSolve.hpp" #include "ClpConfig.h" class ClpDualRowPivot; class ClpPrimalColumnPivot; class ClpFactorization; class CoinIndexedVector; class ClpNonLinearCost; class ClpNodeStuff; class CoinStructuredModel; class OsiClpSolverInterface; class CoinWarmStartBasis; class ClpDisasterHandler; class ClpConstraint; /* May want to use Clp defaults so that with ABC defined but not used it behaves as Clp (and ABC used will be different than if not defined) */ #ifdef ABC_INHERIT #ifndef CLP_INHERIT_MODE #define CLP_INHERIT_MODE 1 #endif #ifndef ABC_CLP_DEFAULTS #define ABC_CLP_DEFAULTS 0 #endif #else #undef ABC_CLP_DEFAULTS #define ABC_CLP_DEFAULTS 1 #endif #ifdef CLP_HAS_ABC #include "AbcCommon.hpp" class AbcTolerancesEtc; class AbcSimplex; #include "CoinAbcCommon.hpp" #endif /** This solves LPs using the simplex method It inherits from ClpModel and all its arrays are created at algorithm time. Originally I tried to work with model arrays but for simplicity of coding I changed to single arrays with structural variables then row variables. Some coding is still based on old style and needs cleaning up. For a description of algorithms: for dual see ClpSimplexDual.hpp and at top of ClpSimplexDual.cpp for primal see ClpSimplexPrimal.hpp and at top of ClpSimplexPrimal.cpp There is an algorithm data member. + for primal variations and - for dual variations */ class ClpSimplex : public ClpModel { friend void ClpSimplexUnitTest(const std::string & mpsDir); public: /** enums for status of various sorts. First 4 match CoinWarmStartBasis, isFixed means fixed at lower bound and out of basis */ enum Status { isFree = 0x00, basic = 0x01, atUpperBound = 0x02, atLowerBound = 0x03, superBasic = 0x04, isFixed = 0x05 }; // For Dual enum FakeBound { noFake = 0x00, lowerFake = 0x01, upperFake = 0x02, bothFake = 0x03 }; /**@name Constructors and destructor and copy */ //@{ /// Default constructor ClpSimplex (bool emptyMessages = false ); /** Copy constructor. May scale depending on mode -1 leave mode as is 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later) */ ClpSimplex(const ClpSimplex & rhs, int scalingMode = -1); /** Copy constructor from model. May scale depending on mode -1 leave mode as is 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later) */ ClpSimplex(const ClpModel & rhs, int scalingMode = -1); /** Subproblem constructor. A subset of whole model is created from the row and column lists given. The new order is given by list order and duplicates are allowed. Name and integer information can be dropped Can optionally modify rhs to take into account variables NOT in list in this case duplicates are not allowed (also see getbackSolution) */ ClpSimplex (const ClpModel * wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns, bool dropNames = true, bool dropIntegers = true, bool fixOthers = false); /** Subproblem constructor. A subset of whole model is created from the row and column lists given. The new order is given by list order and duplicates are allowed. Name and integer information can be dropped Can optionally modify rhs to take into account variables NOT in list in this case duplicates are not allowed (also see getbackSolution) */ ClpSimplex (const ClpSimplex * wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns, bool dropNames = true, bool dropIntegers = true, bool fixOthers = false); /** This constructor modifies original ClpSimplex and stores original stuff in created ClpSimplex. It is only to be used in conjunction with originalModel */ ClpSimplex (ClpSimplex * wholeModel, int numberColumns, const int * whichColumns); /** This copies back stuff from miniModel and then deletes miniModel. Only to be used with mini constructor */ void originalModel(ClpSimplex * miniModel); inline int abcState() const { return abcState_;} inline void setAbcState(int state) { abcState_=state;} #ifdef ABC_INHERIT inline AbcSimplex * abcSimplex() const { return abcSimplex_;} inline void setAbcSimplex(AbcSimplex * simplex) { abcSimplex_=simplex;} /// Returns 0 if dual can be skipped int doAbcDual(); /// Returns 0 if primal can be skipped int doAbcPrimal(int ifValuesPass); #endif /** Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 but give a bit extra if bigger needed */ void setPersistenceFlag(int value); /// Save a copy of model with certain state - normally without cuts void makeBaseModel(); /// Switch off base model void deleteBaseModel(); /// See if we have base model inline ClpSimplex * baseModel() const { return baseModel_; } /** Reset to base model (just size and arrays needed) If model NULL use internal copy */ void setToBaseModel(ClpSimplex * model = NULL); /// Assignment operator. This copies the data ClpSimplex & operator=(const ClpSimplex & rhs); /// Destructor ~ClpSimplex ( ); // Ones below are just ClpModel with some changes /** Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ void loadProblem ( const ClpMatrixBase& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); void loadProblem ( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /** Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ void loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /// This one is for after presolve to save memory void loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const int * length, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /** This loads a model from a coinModel object - returns number of errors. If keepSolution true and size is same as current then keeps current status and solution */ int loadProblem ( CoinModel & modelObject, bool keepSolution = false); /// Read an mps file from the given filename int readMps(const char *filename, bool keepNames = false, bool ignoreErrors = false); /// Read GMPL files from the given filenames int readGMPL(const char *filename, const char * dataName, bool keepNames = false); /// Read file in LP format from file with name filename. /// See class CoinLpIO for description of this format. int readLp(const char *filename, const double epsilon = 1e-5); /** Borrow model. This is so we dont have to copy large amounts of data around. It assumes a derived class wants to overwrite an empty model with a real one - while it does an algorithm. This is same as ClpModel one, but sets scaling on etc. */ void borrowModel(ClpModel & otherModel); void borrowModel(ClpSimplex & otherModel); /// Pass in Event handler (cloned and deleted at end) void passInEventHandler(const ClpEventHandler * eventHandler); /// Puts solution back into small model void getbackSolution(const ClpSimplex & smallModel, const int * whichRow, const int * whichColumn); /** Load nonlinear part of problem from AMPL info Returns 0 if linear 1 if quadratic objective 2 if quadratic constraints 3 if nonlinear objective 4 if nonlinear constraints -1 on failure */ int loadNonLinear(void * info, int & numberConstraints, ClpConstraint ** & constraints); #ifdef ABC_INHERIT /// Loads tolerances etc void loadTolerancesEtc(const AbcTolerancesEtc & data); /// Unloads tolerances etc void unloadTolerancesEtc(AbcTolerancesEtc & data); #endif //@} /**@name Functions most useful to user */ //@{ /** General solve algorithm which can do presolve. See ClpSolve.hpp for options */ int initialSolve(ClpSolve & options); /// Default initial solve int initialSolve(); /// Dual initial solve int initialDualSolve(); /// Primal initial solve int initialPrimalSolve(); /// Barrier initial solve int initialBarrierSolve(); /// Barrier initial solve, not to be followed by crossover int initialBarrierNoCrossSolve(); /** Dual algorithm - see ClpSimplexDual.hpp for method. ifValuesPass==2 just does values pass and then stops. startFinishOptions - bits 1 - do not delete work areas and factorization at end 2 - use old factorization if same number of rows 4 - skip as much initialization of work areas as possible (based on whatsChanged in clpmodel.hpp) ** work in progress maybe other bits later */ int dual(int ifValuesPass = 0, int startFinishOptions = 0); // If using Debug int dualDebug(int ifValuesPass = 0, int startFinishOptions = 0); /** Primal algorithm - see ClpSimplexPrimal.hpp for method. ifValuesPass==2 just does values pass and then stops. startFinishOptions - bits 1 - do not delete work areas and factorization at end 2 - use old factorization if same number of rows 4 - skip as much initialization of work areas as possible (based on whatsChanged in clpmodel.hpp) ** work in progress maybe other bits later */ int primal(int ifValuesPass = 0, int startFinishOptions = 0); /** Solves nonlinear problem using SLP - may be used as crash for other algorithms when number of iterations small. Also exits if all problematical variables are changing less than deltaTolerance */ int nonlinearSLP(int numberPasses, double deltaTolerance); /** Solves problem with nonlinear constraints using SLP - may be used as crash for other algorithms when number of iterations small. Also exits if all problematical variables are changing less than deltaTolerance */ int nonlinearSLP(int numberConstraints, ClpConstraint ** constraints, int numberPasses, double deltaTolerance); /** Solves using barrier (assumes you have good cholesky factor code). Does crossover to simplex if asked*/ int barrier(bool crossover = true); /** Solves non-linear using reduced gradient. Phase = 0 get feasible, =1 use solution */ int reducedGradient(int phase = 0); /// Solve using structure of model and maybe in parallel int solve(CoinStructuredModel * model); #ifdef ABC_INHERIT /** solvetype 0 for dual, 1 for primal startup 1 for values pass interrupt whether to pass across interrupt handler add 10 to return AbcSimplex */ AbcSimplex * dealWithAbc(int solveType,int startUp,bool interrupt=false); //void dealWithAbc(int solveType,int startUp,bool interrupt=false); #endif /** This loads a model from a CoinStructuredModel object - returns number of errors. If originalOrder then keep to order stored in blocks, otherwise first column/rows correspond to first block - etc. If keepSolution true and size is same as current then keeps current status and solution */ int loadProblem ( CoinStructuredModel & modelObject, bool originalOrder = true, bool keepSolution = false); /** When scaling is on it is possible that the scaled problem is feasible but the unscaled is not. Clp returns a secondary status code to that effect. This option allows for a cleanup. If you use it I would suggest 1. This only affects actions when scaled optimal 0 - no action 1 - clean up using dual if primal infeasibility 2 - clean up using dual if dual infeasibility 3 - clean up using dual if primal or dual infeasibility 11,12,13 - as 1,2,3 but use primal return code as dual/primal */ int cleanup(int cleanupScaling); /** Dual ranging. This computes increase/decrease in cost for each given variable and corresponding sequence numbers which would change basis. Sequence numbers are 0..numberColumns and numberColumns.. for artificials/slacks. For non-basic variables the information is trivial to compute and the change in cost is just minus the reduced cost and the sequence number will be that of the non-basic variables. For basic variables a ratio test is between the reduced costs for non-basic variables and the row of the tableau corresponding to the basic variable. The increase/decrease value is always >= 0.0 Up to user to provide correct length arrays where each array is of length numberCheck. which contains list of variables for which information is desired. All other arrays will be filled in by function. If fifth entry in which is variable 7 then fifth entry in output arrays will be information for variable 7. If valueIncrease/Decrease not NULL (both must be NULL or both non NULL) then these are filled with the value of variable if such a change in cost were made (the existing bounds are ignored) Returns non-zero if infeasible unbounded etc */ int dualRanging(int numberCheck, const int * which, double * costIncrease, int * sequenceIncrease, double * costDecrease, int * sequenceDecrease, double * valueIncrease = NULL, double * valueDecrease = NULL); /** Primal ranging. This computes increase/decrease in value for each given variable and corresponding sequence numbers which would change basis. Sequence numbers are 0..numberColumns and numberColumns.. for artificials/slacks. This should only be used for non-basic variabls as otherwise information is pretty useless For basic variables the sequence number will be that of the basic variables. Up to user to provide correct length arrays where each array is of length numberCheck. which contains list of variables for which information is desired. All other arrays will be filled in by function. If fifth entry in which is variable 7 then fifth entry in output arrays will be information for variable 7. Returns non-zero if infeasible unbounded etc */ int primalRanging(int numberCheck, const int * which, double * valueIncrease, int * sequenceIncrease, double * valueDecrease, int * sequenceDecrease); /** Modifies coefficients etc and if necessary pivots in and out. All at same status will be done (basis may go singular). User can tell which others have been done (i.e. if status matches). If called from outside will change status and return 0. If called from event handler returns non-zero if user has to take action. indices>=numberColumns are slacks (obviously no coefficients) status array is (char) Status enum */ int modifyCoefficientsAndPivot(int number, const int * which, const CoinBigIndex * start, const int * row, const double * newCoefficient, const unsigned char * newStatus=NULL, const double * newLower=NULL, const double * newUpper=NULL, const double * newObjective=NULL); /** Take out duplicate rows (includes scaled rows and intersections). On exit whichRows has rows to delete - return code is number can be deleted or -1 if would be infeasible. If tolerance is -1.0 use primalTolerance for equality rows and infeasibility If cleanUp not zero then spend more time trying to leave more stable row and make row bounds exact multiple of cleanUp if close enough */ int outDuplicateRows(int numberLook,int * whichRows, bool noOverlaps=false, double tolerance=-1.0, double cleanUp=0.0); /** Try simple crash like techniques to get closer to primal feasibility returns final sum of infeasibilities */ double moveTowardsPrimalFeasible(); /** Try simple crash like techniques to remove super basic slacks but only if > threshold */ void removeSuperBasicSlacks(int threshold=0); /** Mini presolve (faster) Char arrays must be numberRows and numberColumns long on entry second part must be filled in as follows - 0 - possible >0 - take out and do something (depending on value - TBD) -1 row/column can't vanish but can have entries removed/changed -2 don't touch at all on exit <=0 ones will be in presolved problem struct will be created and will be long enough (information on length etc in first entry) user must delete struct */ ClpSimplex * miniPresolve(char * rowType, char * columnType,void ** info); /// After mini presolve void miniPostsolve(const ClpSimplex * presolvedModel,void * info); /// mini presolve and solve void miniSolve(char * rowType, char *columnType,int algorithm, int startUp); /** Write the basis in MPS format to the specified file. If writeValues true writes values of structurals (and adds VALUES to end of NAME card) Row and column names may be null. formatType is
    • 0 - normal
    • 1 - extra accuracy
    • 2 - IEEE hex (later)
    Returns non-zero on I/O error */ int writeBasis(const char *filename, bool writeValues = false, int formatType = 0) const; /** Read a basis from the given filename, returns -1 on file error, 0 if no values, 1 if values */ int readBasis(const char *filename); /// Returns a basis (to be deleted by user) CoinWarmStartBasis * getBasis() const; /// Passes in factorization void setFactorization( ClpFactorization & factorization); // Swaps factorization ClpFactorization * swapFactorization( ClpFactorization * factorization); /// Copies in factorization to existing one void copyFactorization( ClpFactorization & factorization); /** Tightens primal bounds to make dual faster. Unless fixed or doTight>10, bounds are slightly looser than they could be. This is to make dual go faster and is probably not needed with a presolve. Returns non-zero if problem infeasible. Fudge for branch and bound - put bounds on columns of factor * largest value (at continuous) - should improve stability in branch and bound on infeasible branches (0.0 is off) */ int tightenPrimalBounds(double factor = 0.0, int doTight = 0, bool tightIntegers = false); /** Crash - at present just aimed at dual, returns -2 if dual preferred and crash basis created -1 if dual preferred and all slack basis preferred 0 if basis going in was not all slack 1 if primal preferred and all slack basis preferred 2 if primal preferred and crash basis created. if gap between bounds <="gap" variables can be flipped ( If pivot -1 then can be made super basic!) If "pivot" is -1 No pivoting - always primal 0 No pivoting (so will just be choice of algorithm) 1 Simple pivoting e.g. gub 2 Mini iterations */ int crash(double gap, int pivot); /// Sets row pivot choice algorithm in dual void setDualRowPivotAlgorithm(ClpDualRowPivot & choice); /// Sets column pivot choice algorithm in primal void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice); /// Create a hotstart point of the optimization process void markHotStart(void * & saveStuff); /// Optimize starting from the hotstart void solveFromHotStart(void * saveStuff); /// Delete the snapshot void unmarkHotStart(void * saveStuff); /** For strong branching. On input lower and upper are new bounds while on output they are change in objective function values (>1.0e50 infeasible). Return code is 0 if nothing interesting, -1 if infeasible both ways and +1 if infeasible one way (check values to see which one(s)) Solutions are filled in as well - even down, odd up - also status and number of iterations */ int strongBranching(int numberVariables, const int * variables, double * newLower, double * newUpper, double ** outputSolution, int * outputStatus, int * outputIterations, bool stopOnFirstInfeasible = true, bool alwaysFinish = false, int startFinishOptions = 0); /// Fathom - 1 if solution int fathom(void * stuff); /** Do up to N deep - returns -1 - no solution nNodes_ valid nodes >= if solution and that node gives solution ClpNode array is 2**N long. Values for N and array are in stuff (nNodes_ also in stuff) */ int fathomMany(void * stuff); /// Double checks OK double doubleCheck(); /// Starts Fast dual2 int startFastDual2(ClpNodeStuff * stuff); /// Like Fast dual int fastDual2(ClpNodeStuff * stuff); /// Stops Fast dual2 void stopFastDual2(ClpNodeStuff * stuff); /** Deals with crunch aspects mode 0 - in 1 - out with solution 2 - out without solution returns small model or NULL */ ClpSimplex * fastCrunch(ClpNodeStuff * stuff, int mode); //@} /**@name Needed for functionality of OsiSimplexInterface */ //@{ /** Pivot in a variable and out a variable. Returns 0 if okay, 1 if inaccuracy forced re-factorization, -1 if would be singular. Also updates primal/dual infeasibilities. Assumes sequenceIn_ and pivotRow_ set and also directionIn and Out. */ int pivot(); /** Pivot in a variable and choose an outgoing one. Assumes primal feasible - will not go through a bound. Returns step length in theta Returns ray in ray_ (or NULL if no pivot) Return codes as before but -1 means no acceptable pivot */ int primalPivotResult(); /** Pivot out a variable and choose an incoing one. Assumes dual feasible - will not go through a reduced cost. Returns step length in theta Return codes as before but -1 means no acceptable pivot */ int dualPivotResultPart1(); /** Do actual pivot state is 0 if need tableau column, 1 if in rowArray_[1] */ int pivotResultPart2(int algorithm,int state); /** Common bits of coding for dual and primal. Return 0 if okay, 1 if bad matrix, 2 if very bad factorization startFinishOptions - bits 1 - do not delete work areas and factorization at end 2 - use old factorization if same number of rows 4 - skip as much initialization of work areas as possible (based on whatsChanged in clpmodel.hpp) ** work in progress maybe other bits later */ int startup(int ifValuesPass, int startFinishOptions = 0); void finish(int startFinishOptions = 0); /** Factorizes and returns true if optimal. Used by user */ bool statusOfProblem(bool initial = false); /// If user left factorization frequency then compute void defaultFactorizationFrequency(); /// Copy across enabled stuff from one solver to another void copyEnabledStuff(const ClpSimplex * rhs); //@} /**@name most useful gets and sets */ //@{ /// If problem is primal feasible inline bool primalFeasible() const { return (numberPrimalInfeasibilities_ == 0); } /// If problem is dual feasible inline bool dualFeasible() const { return (numberDualInfeasibilities_ == 0); } /// factorization inline ClpFactorization * factorization() const { return factorization_; } /// Sparsity on or off bool sparseFactorization() const; void setSparseFactorization(bool value); /// Factorization frequency int factorizationFrequency() const; void setFactorizationFrequency(int value); /// Dual bound inline double dualBound() const { return dualBound_; } void setDualBound(double value); /// Infeasibility cost inline double infeasibilityCost() const { return infeasibilityCost_; } void setInfeasibilityCost(double value); /** Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - verbose above that 8,16,32 etc just for selective debug */ /** Perturbation: 50 - switch on perturbation 100 - auto perturb if takes too long (1.0e-6 largest nonzero) 101 - we are perturbed 102 - don't try perturbing again default is 100 others are for playing */ inline int perturbation() const { return perturbation_; } void setPerturbation(int value); /// Current (or last) algorithm inline int algorithm() const { return algorithm_; } /// Set algorithm inline void setAlgorithm(int value) { algorithm_ = value; } /// Return true if the objective limit test can be relied upon bool isObjectiveLimitTestValid() const ; /// Sum of dual infeasibilities inline double sumDualInfeasibilities() const { return sumDualInfeasibilities_; } inline void setSumDualInfeasibilities(double value) { sumDualInfeasibilities_ = value; } /// Sum of relaxed dual infeasibilities inline double sumOfRelaxedDualInfeasibilities() const { return sumOfRelaxedDualInfeasibilities_; } inline void setSumOfRelaxedDualInfeasibilities(double value) { sumOfRelaxedDualInfeasibilities_ = value; } /// Number of dual infeasibilities inline int numberDualInfeasibilities() const { return numberDualInfeasibilities_; } inline void setNumberDualInfeasibilities(int value) { numberDualInfeasibilities_ = value; } /// Number of dual infeasibilities (without free) inline int numberDualInfeasibilitiesWithoutFree() const { return numberDualInfeasibilitiesWithoutFree_; } /// Sum of primal infeasibilities inline double sumPrimalInfeasibilities() const { return sumPrimalInfeasibilities_; } inline void setSumPrimalInfeasibilities(double value) { sumPrimalInfeasibilities_ = value; } /// Sum of relaxed primal infeasibilities inline double sumOfRelaxedPrimalInfeasibilities() const { return sumOfRelaxedPrimalInfeasibilities_; } inline void setSumOfRelaxedPrimalInfeasibilities(double value) { sumOfRelaxedPrimalInfeasibilities_ = value; } /// Number of primal infeasibilities inline int numberPrimalInfeasibilities() const { return numberPrimalInfeasibilities_; } inline void setNumberPrimalInfeasibilities(int value) { numberPrimalInfeasibilities_ = value; } /** Save model to file, returns 0 if success. This is designed for use outside algorithms so does not save iterating arrays etc. It does not save any messaging information. Does not save scaling values. It does not know about all types of virtual functions. */ int saveModel(const char * fileName); /** Restore model from file, returns 0 if success, deletes current model */ int restoreModel(const char * fileName); /** Just check solution (for external use) - sets sum of infeasibilities etc. If setToBounds 0 then primal column values not changed and used to compute primal row activity values. If 1 or 2 then status used - so all nonbasic variables set to indicated bound and if any values changed (or ==2) basic values re-computed. */ void checkSolution(int setToBounds = 0); /** Just check solution (for internal use) - sets sum of infeasibilities etc. */ void checkSolutionInternal(); /// Check unscaled primal solution but allow for rounding error void checkUnscaledSolution(); /// Useful row length arrays (0,1,2,3,4,5) inline CoinIndexedVector * rowArray(int index) const { return rowArray_[index]; } /// Useful column length arrays (0,1,2,3,4,5) inline CoinIndexedVector * columnArray(int index) const { return columnArray_[index]; } //@} /******************** End of most useful part **************/ /**@name Functions less likely to be useful to casual user */ //@{ /** Given an existing factorization computes and checks primal and dual solutions. Uses input arrays for variables at bounds. Returns feasibility states */ int getSolution ( const double * rowActivities, const double * columnActivities); /** Given an existing factorization computes and checks primal and dual solutions. Uses current problem arrays for bounds. Returns feasibility states */ int getSolution (); /** Constructs a non linear cost from list of non-linearities (columns only) First lower of each column is taken as real lower Last lower is taken as real upper and cost ignored Returns nonzero if bad data e.g. lowers not monotonic */ int createPiecewiseLinearCosts(const int * starts, const double * lower, const double * gradient); /// dual row pivot choice inline ClpDualRowPivot * dualRowPivot() const { return dualRowPivot_; } /// primal column pivot choice inline ClpPrimalColumnPivot * primalColumnPivot() const { return primalColumnPivot_; } /// Returns true if model looks OK inline bool goodAccuracy() const { return (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7); } /** Return model - updates any scalars */ void returnModel(ClpSimplex & otherModel); /** Factorizes using current basis. solveType - 1 iterating, 0 initial, -1 external If 10 added then in primal values pass Return codes are as from ClpFactorization unless initial factorization when total number of singularities is returned. Special case is numberRows_+1 -> all slack basis. */ int internalFactorize(int solveType); /// Save data ClpDataSave saveData() ; /// Restore data void restoreData(ClpDataSave saved); /// Clean up status void cleanStatus(); /// Factorizes using current basis. For external use int factorize(); /** Computes duals from scratch. If givenDjs then allows for nonzero basic djs */ void computeDuals(double * givenDjs); /// Computes primals from scratch void computePrimals ( const double * rowActivities, const double * columnActivities); /** Adds multiple of a column into an array */ void add(double * array, int column, double multiplier) const; /** Unpacks one column of the matrix into indexed array Uses sequenceIn_ Also applies scaling if needed */ void unpack(CoinIndexedVector * rowArray) const ; /** Unpacks one column of the matrix into indexed array Slack if sequence>= numberColumns Also applies scaling if needed */ void unpack(CoinIndexedVector * rowArray, int sequence) const; /** Unpacks one column of the matrix into indexed array ** as packed vector Uses sequenceIn_ Also applies scaling if needed */ void unpackPacked(CoinIndexedVector * rowArray) ; /** Unpacks one column of the matrix into indexed array ** as packed vector Slack if sequence>= numberColumns Also applies scaling if needed */ void unpackPacked(CoinIndexedVector * rowArray, int sequence); #ifndef CLP_USER_DRIVEN protected: #endif /** This does basis housekeeping and does values for in/out variables. Can also decide to re-factorize */ int housekeeping(double objectiveChange); /** This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Primal) */ void checkPrimalSolution(const double * rowActivities = NULL, const double * columnActivies = NULL); /** This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Dual) */ void checkDualSolution(); /** This sets sum and number of infeasibilities (Dual and Primal) */ void checkBothSolutions(); /** If input negative scales objective so maximum <= -value and returns scale factor used. If positive unscales and also redoes dual stuff */ double scaleObjective(double value); /// Solve using Dantzig-Wolfe decomposition and maybe in parallel int solveDW(CoinStructuredModel * model, ClpSolve & options); /// Solve using Benders decomposition and maybe in parallel int solveBenders(CoinStructuredModel * model, ClpSolve & options); public: /** For advanced use. When doing iterative solves things can get nasty so on values pass if incoming solution has largest infeasibility < incomingInfeasibility throw out variables from basis until largest infeasibility < allowedInfeasibility or incoming largest infeasibility. If allowedInfeasibility>= incomingInfeasibility this is always possible altough you may end up with an all slack basis. Defaults are 1.0,10.0 */ void setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility); /** Get a clean factorization - i.e. throw out singularities may do more later */ int cleanFactorization(int ifValuesPass); //@} /**@name most useful gets and sets */ //@{ public: /// Initial value for alpha accuracy calculation (-1.0 off) inline double alphaAccuracy() const { return alphaAccuracy_; } inline void setAlphaAccuracy(double value) { alphaAccuracy_ = value; } public: /// Objective value //inline double objectiveValue() const { //return (objectiveValue_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset]; //} /// Set disaster handler inline void setDisasterHandler(ClpDisasterHandler * handler) { disasterArea_ = handler; } /// Get disaster handler inline ClpDisasterHandler * disasterHandler() const { return disasterArea_; } /// Large bound value (for complementarity etc) inline double largeValue() const { return largeValue_; } void setLargeValue( double value) ; /// Largest error on Ax-b inline double largestPrimalError() const { return largestPrimalError_; } /// Largest error on basic duals inline double largestDualError() const { return largestDualError_; } /// Largest error on Ax-b inline void setLargestPrimalError(double value) { largestPrimalError_ = value; } /// Largest error on basic duals inline void setLargestDualError(double value) { largestDualError_ = value; } /// Get zero tolerance inline double zeroTolerance() const { return zeroTolerance_;/*factorization_->zeroTolerance();*/ } /// Set zero tolerance inline void setZeroTolerance( double value) { zeroTolerance_ = value; } /// Basic variables pivoting on which rows inline int * pivotVariable() const { return pivotVariable_; } /// If automatic scaling on inline bool automaticScaling() const { return automaticScale_ != 0; } inline void setAutomaticScaling(bool onOff) { automaticScale_ = onOff ? 1 : 0; } /// Current dual tolerance inline double currentDualTolerance() const { return dualTolerance_; } inline void setCurrentDualTolerance(double value) { dualTolerance_ = value; } /// Current primal tolerance inline double currentPrimalTolerance() const { return primalTolerance_; } inline void setCurrentPrimalTolerance(double value) { primalTolerance_ = value; } /// How many iterative refinements to do inline int numberRefinements() const { return numberRefinements_; } void setNumberRefinements( int value) ; /// Alpha (pivot element) for use by classes e.g. steepestedge inline double alpha() const { return alpha_; } inline void setAlpha(double value) { alpha_ = value; } /// Reduced cost of last incoming for use by classes e.g. steepestedge inline double dualIn() const { return dualIn_; } /// Set reduced cost of last incoming to force error inline void setDualIn(double value) { dualIn_ = value; } /// Pivot Row for use by classes e.g. steepestedge inline int pivotRow() const { return pivotRow_; } inline void setPivotRow(int value) { pivotRow_ = value; } /// value of incoming variable (in Dual) double valueIncomingDual() const; //@} #ifndef CLP_USER_DRIVEN protected: #endif /**@name protected methods */ //@{ /** May change basis and then returns number changed. Computation of solutions may be overriden by given pi and solution */ int gutsOfSolution ( double * givenDuals, const double * givenPrimals, bool valuesPass = false); /// Does most of deletion (0 = all, 1 = most, 2 most + factorization) void gutsOfDelete(int type); /// Does most of copying void gutsOfCopy(const ClpSimplex & rhs); /** puts in format I like (rowLower,rowUpper) also see StandardMatrix 1 bit does rows (now and columns), (2 bit does column bounds), 4 bit does objective(s). 8 bit does solution scaling in 16 bit does rowArray and columnArray indexed vectors and makes row copy if wanted, also sets columnStart_ etc Also creates scaling arrays if needed. It does scaling if needed. 16 also moves solutions etc in to work arrays On 16 returns false if problem "bad" i.e. matrix or bounds bad If startFinishOptions is -1 then called by user in getSolution so do arrays but keep pivotVariable_ */ bool createRim(int what, bool makeRowCopy = false, int startFinishOptions = 0); /// Does rows and columns void createRim1(bool initial); /// Does objective void createRim4(bool initial); /// Does rows and columns and objective void createRim5(bool initial); /** releases above arrays and does solution scaling out. May also get rid of factorization data - 0 get rid of nothing, 1 get rid of arrays, 2 also factorization */ void deleteRim(int getRidOfFactorizationData = 2); /// Sanity check on input rim data (after scaling) - returns true if okay bool sanityCheck(); //@} public: /**@name public methods */ //@{ /** Return row or column sections - not as much needed as it once was. These just map into single arrays */ inline double * solutionRegion(int section) const { if (!section) return rowActivityWork_; else return columnActivityWork_; } inline double * djRegion(int section) const { if (!section) return rowReducedCost_; else return reducedCostWork_; } inline double * lowerRegion(int section) const { if (!section) return rowLowerWork_; else return columnLowerWork_; } inline double * upperRegion(int section) const { if (!section) return rowUpperWork_; else return columnUpperWork_; } inline double * costRegion(int section) const { if (!section) return rowObjectiveWork_; else return objectiveWork_; } /// Return region as single array inline double * solutionRegion() const { return solution_; } inline double * djRegion() const { return dj_; } inline double * lowerRegion() const { return lower_; } inline double * upperRegion() const { return upper_; } inline double * costRegion() const { return cost_; } inline Status getStatus(int sequence) const { return static_cast (status_[sequence] & 7); } inline void setStatus(int sequence, Status newstatus) { unsigned char & st_byte = status_[sequence]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | newstatus); } /// Start or reset using maximumRows_ and Columns_ - true if change bool startPermanentArrays(); /** Normally the first factorization does sparse coding because the factorization could be singular. This allows initial dense factorization when it is known to be safe */ void setInitialDenseFactorization(bool onOff); bool initialDenseFactorization() const; /** Return sequence In or Out */ inline int sequenceIn() const { return sequenceIn_; } inline int sequenceOut() const { return sequenceOut_; } /** Set sequenceIn or Out */ inline void setSequenceIn(int sequence) { sequenceIn_ = sequence; } inline void setSequenceOut(int sequence) { sequenceOut_ = sequence; } /** Return direction In or Out */ inline int directionIn() const { return directionIn_; } inline int directionOut() const { return directionOut_; } /** Set directionIn or Out */ inline void setDirectionIn(int direction) { directionIn_ = direction; } inline void setDirectionOut(int direction) { directionOut_ = direction; } /// Value of Out variable inline double valueOut() const { return valueOut_; } /// Set value of out variable inline void setValueOut(double value) { valueOut_ = value; } /// Dual value of Out variable inline double dualOut() const { return dualOut_; } /// Set dual value of out variable inline void setDualOut(double value) { dualOut_ = value; } /// Set lower of out variable inline void setLowerOut(double value) { lowerOut_ = value; } /// Set upper of out variable inline void setUpperOut(double value) { upperOut_ = value; } /// Set theta of out variable inline void setTheta(double value) { theta_ = value; } /// Returns 1 if sequence indicates column inline int isColumn(int sequence) const { return sequence < numberColumns_ ? 1 : 0; } /// Returns sequence number within section inline int sequenceWithin(int sequence) const { return sequence < numberColumns_ ? sequence : sequence - numberColumns_; } /// Return row or column values inline double solution(int sequence) { return solution_[sequence]; } /// Return address of row or column values inline double & solutionAddress(int sequence) { return solution_[sequence]; } inline double reducedCost(int sequence) { return dj_[sequence]; } inline double & reducedCostAddress(int sequence) { return dj_[sequence]; } inline double lower(int sequence) { return lower_[sequence]; } /// Return address of row or column lower bound inline double & lowerAddress(int sequence) { return lower_[sequence]; } inline double upper(int sequence) { return upper_[sequence]; } /// Return address of row or column upper bound inline double & upperAddress(int sequence) { return upper_[sequence]; } inline double cost(int sequence) { return cost_[sequence]; } /// Return address of row or column cost inline double & costAddress(int sequence) { return cost_[sequence]; } /// Return original lower bound inline double originalLower(int iSequence) const { if (iSequence < numberColumns_) return columnLower_[iSequence]; else return rowLower_[iSequence-numberColumns_]; } /// Return original lower bound inline double originalUpper(int iSequence) const { if (iSequence < numberColumns_) return columnUpper_[iSequence]; else return rowUpper_[iSequence-numberColumns_]; } /// Theta (pivot change) inline double theta() const { return theta_; } /** Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (dual) */ inline double bestPossibleImprovement() const { return bestPossibleImprovement_; } /// Return pointer to details of costs inline ClpNonLinearCost * nonLinearCost() const { return nonLinearCost_; } /** Return more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolved problem infeasible return 4 bit - keep arrays like upper_ around 8 bit - if factorization kept can still declare optimal at once 16 bit - if checking replaceColumn accuracy before updating 32 bit - say optimal if primal feasible! 64 bit - give up easily in dual (and say infeasible) 128 bit - no objective, 0-1 and in B&B 256 bit - in primal from dual or vice versa 512 bit - alternative use of solveType_ 1024 bit - don't do row copy of factorization 2048 bit - perturb in complete fathoming 4096 bit - try more for complete fathoming 8192 bit - don't even think of using primal if user asks for dual (and vv) 16384 bit - in initialSolve so be more flexible 32768 bit - don't swap algorithms from dual if small infeasibility 65536 bit - perturb in postsolve cleanup (even if < 10000 rows) 131072 bit (*3) initial stateDualColumn 524288 bit - stop when primal feasible */ inline int moreSpecialOptions() const { return moreSpecialOptions_; } /** Set more special options 1 bit - if presolve says infeasible in ClpSolve return 2 bit - if presolved problem infeasible return 4 bit - keep arrays like upper_ around 8 bit - no free or superBasic variables 16 bit - if checking replaceColumn accuracy before updating 32 bit - say optimal if primal feasible! 64 bit - give up easily in dual (and say infeasible) 128 bit - no objective, 0-1 and in B&B 256 bit - in primal from dual or vice versa 512 bit - alternative use of solveType_ 1024 bit - don't do row copy of factorization 2048 bit - perturb in complete fathoming 4096 bit - try more for complete fathoming 8192 bit - don't even think of using primal if user asks for dual (and vv) 16384 bit - in initialSolve so be more flexible 32768 bit - don't swap algorithms from dual if small infeasibility 65536 bit - perturb in postsolve cleanup (even if < 10000 rows) 131072 bit (*3) initial stateDualColumn 524288 bit - stop when primal feasible 1048576 bit - don't perturb even if long time 2097152 bit - no primal in fastDual2 if feasible 4194304 bit - tolerances have been changed by code 8388608 bit - tolerances are dynamic (at first) */ inline void setMoreSpecialOptions(int value) { moreSpecialOptions_ = value; } //@} /**@name status methods */ //@{ inline void setFakeBound(int sequence, FakeBound fakeBound) { unsigned char & st_byte = status_[sequence]; st_byte = static_cast(st_byte & ~24); st_byte = static_cast(st_byte | (fakeBound << 3)); } inline FakeBound getFakeBound(int sequence) const { return static_cast ((status_[sequence] >> 3) & 3); } inline void setRowStatus(int sequence, Status newstatus) { unsigned char & st_byte = status_[sequence+numberColumns_]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | newstatus); } inline Status getRowStatus(int sequence) const { return static_cast (status_[sequence+numberColumns_] & 7); } inline void setColumnStatus(int sequence, Status newstatus) { unsigned char & st_byte = status_[sequence]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | newstatus); } inline Status getColumnStatus(int sequence) const { return static_cast (status_[sequence] & 7); } inline void setPivoted( int sequence) { status_[sequence] = static_cast(status_[sequence] | 32); } inline void clearPivoted( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~32); } inline bool pivoted(int sequence) const { return (((status_[sequence] >> 5) & 1) != 0); } /// To flag a variable (not inline to allow for column generation) void setFlagged( int sequence); inline void clearFlagged( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~64); } inline bool flagged(int sequence) const { return ((status_[sequence] & 64) != 0); } /// To say row active in primal pivot row choice inline void setActive( int iRow) { status_[iRow] = static_cast(status_[iRow] | 128); } inline void clearActive( int iRow) { status_[iRow] = static_cast(status_[iRow] & ~128); } inline bool active(int iRow) const { return ((status_[iRow] & 128) != 0); } /// To say perturbed inline void setPerturbed( int iSequence) { status_[iSequence] = static_cast(status_[iSequence] | 128); } inline void clearPerturbed( int iSequence) { status_[iSequence] = static_cast(status_[iSequence] & ~128); } inline bool perturbed(int iSequence) const { return ((status_[iSequence] & 128) != 0); } /** Set up status array (can be used by OsiClp). Also can be used to set up all slack basis */ void createStatus() ; /** Sets up all slack basis and resets solution to as it was after initial load or readMps */ void allSlackBasis(bool resetSolution = false); /// So we know when to be cautious inline int lastBadIteration() const { return lastBadIteration_; } /// Set so we know when to be cautious inline void setLastBadIteration(int value) { lastBadIteration_=value; } /// Progress flag - at present 0 bit says artificials out inline int progressFlag() const { return (progressFlag_ & 3); } /// For dealing with all issues of cycling etc inline ClpSimplexProgress * progress() { return &progress_;} /// Force re-factorization early value inline int forceFactorization() const { return forceFactorization_ ; } /// Force re-factorization early inline void forceFactorization(int value) { forceFactorization_ = value; } /// Raw objective value (so always minimize in primal) inline double rawObjectiveValue() const { return objectiveValue_; } /// Compute objective value from solution and put in objectiveValue_ void computeObjectiveValue(bool useWorkingSolution = false); /// Compute minimization objective value from internal solution without perturbation double computeInternalObjectiveValue(); /** Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use delete [] on these arrays. */ double * infeasibilityRay(bool fullRay=false) const; /** Number of extra rows. These are ones which will be dynamically created each iteration. This is for GUB but may have other uses. */ inline int numberExtraRows() const { return numberExtraRows_; } /** Maximum number of basic variables - can be more than number of rows if GUB */ inline int maximumBasic() const { return maximumBasic_; } /// Iteration when we entered dual or primal inline int baseIteration() const { return baseIteration_; } /// Create C++ lines to get to current state void generateCpp( FILE * fp, bool defaultFactor = false); /// Gets clean and emptyish factorization ClpFactorization * getEmptyFactorization(); /// May delete or may make clean and emptyish factorization void setEmptyFactorization(); /// Move status and solution across void moveInfo(const ClpSimplex & rhs, bool justStatus = false); //@} ///@name Basis handling // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal) // *** At present only without scaling // *** Slacks havve -1.0 element (so == row activity) - take care ///Get a row of the tableau (slack part in slack if not NULL) void getBInvARow(int row, double* z, double * slack = NULL); ///Get a row of the basis inverse void getBInvRow(int row, double* z); ///Get a column of the tableau void getBInvACol(int col, double* vec); ///Get a column of the basis inverse void getBInvCol(int col, double* vec); /** Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBInvACol() and getBInvCol()). */ void getBasics(int* index); //@} //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ void setObjectiveCoefficient( int elementIndex, double elementValue ); /** Set an objective function coefficient */ inline void setObjCoeff( int elementIndex, double elementValue ) { setObjectiveCoefficient( elementIndex, elementValue); } /** Set a single column lower bound
    Use -DBL_MAX for -infinity. */ void setColumnLower( int elementIndex, double elementValue ); /** Set a single column upper bound
    Use DBL_MAX for infinity. */ void setColumnUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound */ void setColumnBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
    The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ void setColumnSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single column lower bound
    Use -DBL_MAX for -infinity. */ inline void setColLower( int elementIndex, double elementValue ) { setColumnLower(elementIndex, elementValue); } /** Set a single column upper bound
    Use DBL_MAX for infinity. */ inline void setColUpper( int elementIndex, double elementValue ) { setColumnUpper(elementIndex, elementValue); } /** Set a single column lower and upper bound */ inline void setColBounds( int elementIndex, double newlower, double newupper ) { setColumnBounds(elementIndex, newlower, newupper); } /** Set the bounds on a number of columns simultaneously
    @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ inline void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { setColumnSetBounds(indexFirst, indexLast, boundList); } /** Set a single row lower bound
    Use -DBL_MAX for -infinity. */ void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
    Use DBL_MAX for infinity. */ void setRowUpper( int elementIndex, double elementValue ) ; /** Set a single row lower and upper bound */ void setRowBounds( int elementIndex, double lower, double upper ) ; /** Set the bounds on a number of rows simultaneously
    @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /// Resizes rim part of model void resize (int newNumberRows, int newNumberColumns); //@} ////////////////// data ////////////////// protected: /**@name data. Many arrays have a row part and a column part. There is a single array with both - columns then rows and then normally two arrays pointing to rows and columns. The single array is the owner of memory */ //@{ /** Best possible improvement using djs (primal) or obj change by flipping bounds to make dual feasible (dual) */ double bestPossibleImprovement_; /// Zero tolerance double zeroTolerance_; /// Sequence of worst (-1 if feasible) int columnPrimalSequence_; /// Sequence of worst (-1 if feasible) int rowPrimalSequence_; /// "Best" objective value double bestObjectiveValue_; /// More special options - see set for details int moreSpecialOptions_; /// Iteration when we entered dual or primal int baseIteration_; /// Primal tolerance needed to make dual feasible (0 == Primal, <0 == Dual int algorithm_; /** Now for some reliability aids This forces re-factorization early */ int forceFactorization_; /** Perturbation: -50 to +50 - perturb by this power of ten (-6 sounds good) 100 - auto perturb if takes too long (1.0e-6 largest nonzero) 101 - we are perturbed 102 - don't try perturbing again default is 100 */ int perturbation_; /// Saved status regions unsigned char * saveStatus_; /** Very wasteful way of dealing with infeasibilities in primal. However it will allow non-linearities and use of dual analysis. If it doesn't work it can easily be replaced. */ ClpNonLinearCost * nonLinearCost_; /// So we know when to be cautious int lastBadIteration_; /// So we know when to open up again int lastFlaggedIteration_; /// Can be used for count of fake bounds (dual) or fake costs (primal) int numberFake_; /// Can be used for count of changed costs (dual) or changed bounds (primal) int numberChanged_; /// Progress flag - at present 0 bit says artificials out, 1 free in int progressFlag_; /// First free/super-basic variable (-1 if none) int firstFree_; /** Number of extra rows. These are ones which will be dynamically created each iteration. This is for GUB but may have other uses. */ int numberExtraRows_; /** Maximum number of basic variables - can be more than number of rows if GUB */ int maximumBasic_; /// If may skip final factorize then allow up to this pivots (default 20) int dontFactorizePivots_; /** For advanced use. When doing iterative solves things can get nasty so on values pass if incoming solution has largest infeasibility < incomingInfeasibility throw out variables from basis until largest infeasibility < allowedInfeasibility. if allowedInfeasibility>= incomingInfeasibility this is always possible altough you may end up with an all slack basis. Defaults are 1.0,10.0 */ double incomingInfeasibility_; double allowedInfeasibility_; /// Automatic scaling of objective and rhs and bounds int automaticScale_; /// Maximum perturbation array size (take out when code rewritten) int maximumPerturbationSize_; /// Perturbation array (maximumPerturbationSize_) double * perturbationArray_; /// A copy of model with certain state - normally without cuts ClpSimplex * baseModel_; /// For dealing with all issues of cycling etc ClpSimplexProgress progress_; #ifdef ABC_INHERIT AbcSimplex * abcSimplex_; #define CLP_ABC_WANTED 1 #define CLP_ABC_WANTED_PARALLEL 2 #define CLP_ABC_FULL_DONE 8 // bits 256,512,1024 for crash #endif #define CLP_ABC_BEEN_FEASIBLE 65536 int abcState_; /// Number of degenerate pivots since last perturbed int numberDegeneratePivots_; public: /// Spare int array for passing information [0]!=0 switches on mutable int spareIntArray_[4]; /// Spare double array for passing information [0]!=0 switches on mutable double spareDoubleArray_[4]; protected: /// Allow OsiClp certain perks friend class OsiClpSolverInterface; /// And OsiCLP friend class OsiCLPSolverInterface; //@} }; //############################################################################# /** A function that tests the methods in the ClpSimplex class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. It also does some testing of ClpFactorization class */ void ClpSimplexUnitTest(const std::string & mpsDir); // For Devex stuff #define DEVEX_TRY_NORM 1.0e-4 #define DEVEX_ADD_ONE 1.0 #if defined(ABC_INHERIT) || defined(CBC_THREAD) || defined(THREADS_IN_ANALYZE) // Use pthreads #include typedef struct { double result; //const CoinIndexedVector * constVector; // can get rid of //CoinIndexedVector * vectors[2]; // can get rid of void * extraInfo; void * extraInfo2; int status; int stuff[4]; } CoinThreadInfo; class CoinPthreadStuff { public: /**@name Constructors and destructor and copy */ //@{ /** Main constructor */ CoinPthreadStuff (int numberThreads=0, void * parallelManager(void * stuff)=NULL); /// Assignment operator. This copies the data CoinPthreadStuff & operator=(const CoinPthreadStuff & rhs); /// Destructor ~CoinPthreadStuff ( ); /// set stop start inline void setStopStart(int value) { stopStart_=value;} #ifndef NUMBER_THREADS #define NUMBER_THREADS 8 #endif // For waking up thread inline pthread_mutex_t * mutexPointer(int which,int thread=0) { return mutex_+which+3*thread;} #ifdef PTHREAD_BARRIER_SERIAL_THREAD inline pthread_barrier_t * barrierPointer() { return &barrier_;} #endif inline int whichLocked(int thread=0) const { return locked_[thread];} inline CoinThreadInfo * threadInfoPointer(int thread=0) { return threadInfo_+thread;} void startParallelTask(int type,int iThread,void * info=NULL); int waitParallelTask(int type, int & iThread,bool allowIdle); void waitAllTasks(); /// so thread can find out which one it is int whichThread() const; void sayIdle(int iThread); //void startThreads(int numberThreads); //void stopThreads(); // For waking up thread pthread_mutex_t mutex_[3*(NUMBER_THREADS+1)]; #ifdef PTHREAD_BARRIER_SERIAL_THREAD pthread_barrier_t barrier_; #endif CoinThreadInfo threadInfo_[NUMBER_THREADS+1]; pthread_t abcThread_[NUMBER_THREADS+1]; int locked_[NUMBER_THREADS+1]; int stopStart_; int numberThreads_; }; void * clp_parallelManager(void * stuff); #endif #endif CoinMP-1.8.3/Clp/src/ClpSimplexOther.hpp0000644000175000017500000003162712432624666016440 0ustar renerene/* $Id: ClpSimplexOther.hpp 2070 2014-11-18 11:12:54Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef ClpSimplexOther_H #define ClpSimplexOther_H #include "ClpSimplex.hpp" /** This is for Simplex stuff which is neither dual nor primal It inherits from ClpSimplex. It has no data of its own and is never created - only cast from a ClpSimplex object at algorithm time. */ class ClpSimplexOther : public ClpSimplex { public: /**@name Methods */ //@{ /** Dual ranging. This computes increase/decrease in cost for each given variable and corresponding sequence numbers which would change basis. Sequence numbers are 0..numberColumns and numberColumns.. for artificials/slacks. For non-basic variables the information is trivial to compute and the change in cost is just minus the reduced cost and the sequence number will be that of the non-basic variables. For basic variables a ratio test is between the reduced costs for non-basic variables and the row of the tableau corresponding to the basic variable. The increase/decrease value is always >= 0.0 Up to user to provide correct length arrays where each array is of length numberCheck. which contains list of variables for which information is desired. All other arrays will be filled in by function. If fifth entry in which is variable 7 then fifth entry in output arrays will be information for variable 7. If valueIncrease/Decrease not NULL (both must be NULL or both non NULL) then these are filled with the value of variable if such a change in cost were made (the existing bounds are ignored) When here - guaranteed optimal */ void dualRanging(int numberCheck, const int * which, double * costIncrease, int * sequenceIncrease, double * costDecrease, int * sequenceDecrease, double * valueIncrease = NULL, double * valueDecrease = NULL); /** Primal ranging. This computes increase/decrease in value for each given variable and corresponding sequence numbers which would change basis. Sequence numbers are 0..numberColumns and numberColumns.. for artificials/slacks. This should only be used for non-basic variabls as otherwise information is pretty useless For basic variables the sequence number will be that of the basic variables. Up to user to provide correct length arrays where each array is of length numberCheck. which contains list of variables for which information is desired. All other arrays will be filled in by function. If fifth entry in which is variable 7 then fifth entry in output arrays will be information for variable 7. When here - guaranteed optimal */ void primalRanging(int numberCheck, const int * which, double * valueIncrease, int * sequenceIncrease, double * valueDecrease, int * sequenceDecrease); /** Parametrics This is an initial slow version. The code uses current bounds + theta * change (if change array not NULL) and similarly for objective. It starts at startingTheta and returns ending theta in endingTheta. If reportIncrement 0.0 it will report on any movement If reportIncrement >0.0 it will report at startingTheta+k*reportIncrement. If it can not reach input endingTheta return code will be 1 for infeasible, 2 for unbounded, if error on ranges -1, otherwise 0. Normal report is just theta and objective but if event handler exists it may do more On exit endingTheta is maximum reached (can be used for next startingTheta) */ int parametrics(double startingTheta, double & endingTheta, double reportIncrement, const double * changeLowerBound, const double * changeUpperBound, const double * changeLowerRhs, const double * changeUpperRhs, const double * changeObjective); /** Version of parametrics which reads from file See CbcClpParam.cpp for details of format Returns -2 if unable to open file */ int parametrics(const char * dataFile); /** Parametrics This is an initial slow version. The code uses current bounds + theta * change (if change array not NULL) It starts at startingTheta and returns ending theta in endingTheta. If it can not reach input endingTheta return code will be 1 for infeasible, 2 for unbounded, if error on ranges -1, otherwise 0. Event handler may do more On exit endingTheta is maximum reached (can be used for next startingTheta) */ int parametrics(double startingTheta, double & endingTheta, const double * changeLowerBound, const double * changeUpperBound, const double * changeLowerRhs, const double * changeUpperRhs); int parametricsObj(double startingTheta, double & endingTheta, const double * changeObjective); /// Finds best possible pivot double bestPivot(bool justColumns=false); typedef struct { double startingTheta; double endingTheta; double maxTheta; double acceptableMaxTheta; // if this far then within tolerances double * lowerChange; // full array of lower bound changes int * lowerList; // list of lower bound changes double * upperChange; // full array of upper bound changes int * upperList; // list of upper bound changes char * markDone; // mark which ones looked at int * backwardBasic; // from sequence to pivot row int * lowerActive; double * lowerGap; double * lowerCoefficient; int * upperActive; double * upperGap; double * upperCoefficient; int unscaledChangesOffset; bool firstIteration; // so can update rhs for accuracy } parametricsData; private: /** Parametrics - inner loop This first attempt is when reportIncrement non zero and may not report endingTheta correctly If it can not reach input endingTheta return code will be 1 for infeasible, 2 for unbounded, otherwise 0. Normal report is just theta and objective but if event handler exists it may do more */ int parametricsLoop(parametricsData & paramData, double reportIncrement, const double * changeLower, const double * changeUpper, const double * changeObjective, ClpDataSave & data, bool canTryQuick); int parametricsLoop(parametricsData & paramData, ClpDataSave & data,bool canSkipFactorization=false); int parametricsObjLoop(parametricsData & paramData, ClpDataSave & data,bool canSkipFactorization=false); /** Refactorizes if necessary Checks if finished. Updates status. type - 0 initial so set up save arrays etc - 1 normal -if good update save - 2 restoring from saved */ void statusOfProblemInParametrics(int type, ClpDataSave & saveData); void statusOfProblemInParametricsObj(int type, ClpDataSave & saveData); /** This has the flow between re-factorizations Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations */ int whileIterating(parametricsData & paramData, double reportIncrement, const double * changeObjective); /** Computes next theta and says if objective or bounds (0= bounds, 1 objective, -1 none). theta is in theta_. type 1 bounds, 2 objective, 3 both. */ int nextTheta(int type, double maxTheta, parametricsData & paramData, const double * changeObjective); int whileIteratingObj(parametricsData & paramData); int nextThetaObj(double maxTheta, parametricsData & paramData); /// Restores bound to original bound void originalBound(int iSequence, double theta, const double * changeLower, const double * changeUpper); /// Compute new rowLower_ etc (return negative if infeasible - otherwise largest change) double computeRhsEtc(parametricsData & paramData); /// Redo lower_ from rowLower_ etc void redoInternalArrays(); /** Row array has row part of pivot row Column array has column part. This is used in dual ranging */ void checkDualRatios(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, double & costIncrease, int & sequenceIncrease, double & alphaIncrease, double & costDecrease, int & sequenceDecrease, double & alphaDecrease); /** Row array has pivot column This is used in primal ranging */ void checkPrimalRatios(CoinIndexedVector * rowArray, int direction); /// Returns new value of whichOther when whichIn enters basis double primalRanging1(int whichIn, int whichOther); public: /** Write the basis in MPS format to the specified file. If writeValues true writes values of structurals (and adds VALUES to end of NAME card) Row and column names may be null. formatType is
    • 0 - normal
    • 1 - extra accuracy
    • 2 - IEEE hex (later)
    Returns non-zero on I/O error */ int writeBasis(const char *filename, bool writeValues = false, int formatType = 0) const; /// Read a basis from the given filename int readBasis(const char *filename); /** Creates dual of a problem if looks plausible (defaults will always create model) fractionRowRanges is fraction of rows allowed to have ranges fractionColumnRanges is fraction of columns allowed to have ranges */ ClpSimplex * dualOfModel(double fractionRowRanges = 1.0, double fractionColumnRanges = 1.0) const; /** Restores solution from dualized problem non-zero return code indicates minor problems */ int restoreFromDual(const ClpSimplex * dualProblem, bool checkAccuracy=false); /** Sets solution in dualized problem non-zero return code indicates minor problems */ int setInDual(ClpSimplex * dualProblem); /** Does very cursory presolve. rhs is numberRows, whichRows is 3*numberRows and whichColumns is 2*numberColumns. */ ClpSimplex * crunch(double * rhs, int * whichRows, int * whichColumns, int & nBound, bool moreBounds = false, bool tightenBounds = false); /** After very cursory presolve. rhs is numberRows, whichRows is 3*numberRows and whichColumns is 2*numberColumns. */ void afterCrunch(const ClpSimplex & small, const int * whichRows, const int * whichColumns, int nBound); /** Returns gub version of model or NULL whichRows has to be numberRows whichColumns has to be numberRows+numberColumns */ ClpSimplex * gubVersion(int * whichRows, int * whichColumns, int neededGub, int factorizationFrequency=50); /// Sets basis from original void setGubBasis(ClpSimplex &original,const int * whichRows, const int * whichColumns); /// Restores basis to original void getGubBasis(ClpSimplex &original,const int * whichRows, const int * whichColumns) const; /// Quick try at cleaning up duals if postsolve gets wrong void cleanupAfterPostsolve(); /** Tightens integer bounds - returns number tightened or -1 if infeasible */ int tightenIntegerBounds(double * rhsSpace); /** Expands out all possible combinations for a knapsack If buildObj NULL then just computes space needed - returns number elements On entry numberOutput is maximum allowed, on exit it is number needed or -1 (as will be number elements) if maximum exceeded. numberOutput will have at least space to return values which reconstruct input. Rows returned will be original rows but no entries will be returned for any rows all of whose entries are in knapsack. So up to user to allow for this. If reConstruct >=0 then returns number of entrie which make up item "reConstruct" in expanded knapsack. Values in buildRow and buildElement; */ int expandKnapsack(int knapsackRow, int & numberOutput, double * buildObj, CoinBigIndex * buildStart, int * buildRow, double * buildElement, int reConstruct = -1) const; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpPackedMatrix.cpp0000644000175000017500000105474612452503025016357 0ustar renerene/* $Id: ClpPackedMatrix.cpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" //#define THREAD #include "ClpSimplex.hpp" #include "ClpSimplexDual.hpp" #include "ClpFactorization.hpp" #ifndef SLIM_CLP #include "ClpQuadraticObjective.hpp" #endif // at end to get min/max! #include "ClpPackedMatrix.hpp" #include "ClpMessage.hpp" #ifdef INTEL_MKL #include "mkl_spblas.h" #endif //#define DO_CHECK_FLAGS 1 //============================================================================= #ifdef COIN_PREFETCH #if 1 #define coin_prefetch(mem) \ __asm__ __volatile__ ("prefetchnta %0" : : "m" (*(reinterpret_cast(mem)))) #define coin_prefetch_const(mem) \ __asm__ __volatile__ ("prefetchnta %0" : : "m" (*(reinterpret_cast(mem)))) #else #define coin_prefetch(mem) \ __asm__ __volatile__ ("prefetch %0" : : "m" (*(reinterpret_cast(mem)))) #define coin_prefetch_const(mem) \ __asm__ __volatile__ ("prefetch %0" : : "m" (*(reinterpret_cast(mem)))) #endif #else // dummy #define coin_prefetch(mem) #define coin_prefetch_const(mem) #endif //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpPackedMatrix::ClpPackedMatrix () : ClpMatrixBase(), matrix_(NULL), numberActiveColumns_(0), flags_(2), rowCopy_(NULL), columnCopy_(NULL) { setType(1); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpPackedMatrix::ClpPackedMatrix (const ClpPackedMatrix & rhs) : ClpMatrixBase(rhs) { #ifdef DO_CHECK_FLAGS rhs.checkFlags(0); #endif #ifndef COIN_SPARSE_MATRIX // Guaranteed no gaps or small elements matrix_ = new CoinPackedMatrix(*(rhs.matrix_),-1,0) ; flags_ = rhs.flags_&(~0x02) ; #else // Gaps & small elements preserved matrix_ = new CoinPackedMatrix(*(rhs.matrix_),0,0) ; flags_ = rhs.flags_ ; if (matrix_->hasGaps()) flags_ |= 0x02 ; #endif numberActiveColumns_ = rhs.numberActiveColumns_; int numberRows = matrix_->getNumRows(); if (rhs.rhsOffset_ && numberRows) { rhsOffset_ = ClpCopyOfArray(rhs.rhsOffset_, numberRows); } else { rhsOffset_ = NULL; } if (rhs.rowCopy_) { assert ((flags_ & 4) != 0); rowCopy_ = new ClpPackedMatrix2(*rhs.rowCopy_); } else { rowCopy_ = NULL; } if (rhs.columnCopy_) { assert ((flags_&(8 + 16)) == 8 + 16); columnCopy_ = new ClpPackedMatrix3(*rhs.columnCopy_); } else { columnCopy_ = NULL; } #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } //------------------------------------------------------------------- // assign matrix (for space reasons) //------------------------------------------------------------------- ClpPackedMatrix::ClpPackedMatrix (CoinPackedMatrix * rhs) : ClpMatrixBase() { matrix_ = rhs; flags_ = ((matrix_->hasGaps())?0x02:0) ; numberActiveColumns_ = matrix_->getNumCols(); rowCopy_ = NULL; columnCopy_ = NULL; setType(1); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } ClpPackedMatrix::ClpPackedMatrix (const CoinPackedMatrix & rhs) : ClpMatrixBase() { #ifndef COIN_SPARSE_MATRIX matrix_ = new CoinPackedMatrix(rhs,-1,0) ; flags_ = 0 ; #else matrix_ = new CoinPackedMatrix(rhs,0,0) ; flags_ = ((matrix_->hasGaps())?0x02:0) ; #endif numberActiveColumns_ = matrix_->getNumCols(); rowCopy_ = NULL; columnCopy_ = NULL; setType(1); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpPackedMatrix::~ClpPackedMatrix () { delete matrix_; delete rowCopy_; delete columnCopy_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpPackedMatrix & ClpPackedMatrix::operator=(const ClpPackedMatrix& rhs) { if (this != &rhs) { ClpMatrixBase::operator=(rhs); delete matrix_; #ifndef COIN_SPARSE_MATRIX matrix_ = new CoinPackedMatrix(*(rhs.matrix_),-1,0) ; flags_ = rhs.flags_&(~0x02) ; #else matrix_ = new CoinPackedMatrix(*(rhs.matrix_),0,0) ; flags_ = rhs.flags_ ; if (matrix_->hasGaps()) flags_ |= 0x02 ; #endif numberActiveColumns_ = rhs.numberActiveColumns_; delete rowCopy_; delete columnCopy_; if (rhs.rowCopy_) { assert ((flags_ & 4) != 0); rowCopy_ = new ClpPackedMatrix2(*rhs.rowCopy_); } else { rowCopy_ = NULL; } if (rhs.columnCopy_) { assert ((flags_&(8 + 16)) == 8 + 16); columnCopy_ = new ClpPackedMatrix3(*rhs.columnCopy_); } else { columnCopy_ = NULL; } #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpMatrixBase * ClpPackedMatrix::clone() const { return new ClpPackedMatrix(*this); } // Copy contents - resizing if necessary - otherwise re-use memory void ClpPackedMatrix::copy(const ClpPackedMatrix * rhs) { //*this = *rhs; assert(numberActiveColumns_ == rhs->numberActiveColumns_); assert (matrix_->isColOrdered() == rhs->matrix_->isColOrdered()); matrix_->copyReuseArrays(*rhs->matrix_); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } /* Subset clone (without gaps). Duplicates are allowed and order is as given */ ClpMatrixBase * ClpPackedMatrix::subsetClone (int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const { return new ClpPackedMatrix(*this, numberRows, whichRows, numberColumns, whichColumns); } /* Subset constructor (without gaps). Duplicates are allowed and order is as given */ ClpPackedMatrix::ClpPackedMatrix ( const ClpPackedMatrix & rhs, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) : ClpMatrixBase(rhs) { matrix_ = new CoinPackedMatrix(*(rhs.matrix_), numberRows, whichRows, numberColumns, whichColumns); numberActiveColumns_ = matrix_->getNumCols(); rowCopy_ = NULL; flags_ = rhs.flags_&(~0x02) ; // no gaps columnCopy_ = NULL; #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } ClpPackedMatrix::ClpPackedMatrix ( const CoinPackedMatrix & rhs, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) : ClpMatrixBase() { matrix_ = new CoinPackedMatrix(rhs, numberRows, whichRows, numberColumns, whichColumns); numberActiveColumns_ = matrix_->getNumCols(); rowCopy_ = NULL; flags_ = 0 ; // no gaps columnCopy_ = NULL; setType(1); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } /* Returns a new matrix in reverse order without gaps */ ClpMatrixBase * ClpPackedMatrix::reverseOrderedCopy() const { ClpPackedMatrix * copy = new ClpPackedMatrix(); copy->matrix_ = new CoinPackedMatrix(); copy->matrix_->setExtraGap(0.0); copy->matrix_->setExtraMajor(0.0); copy->matrix_->reverseOrderedCopyOf(*matrix_); //copy->matrix_->removeGaps(); copy->numberActiveColumns_ = copy->matrix_->getNumCols(); copy->flags_ = flags_&(~0x02) ; // no gaps #ifdef DO_CHECK_FLAGS checkFlags(0); #endif return copy; } //unscaled versions void ClpPackedMatrix::times(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y) const { int iRow, iColumn; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); //memset(y,0,matrix_->getNumRows()*sizeof(double)); assert (((flags_&0x02) != 0) == matrix_->hasGaps()); if (!(flags_ & 2)) { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; double value = x[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; value *= scalar; for (j = start; j < end; j++) { iRow = row[j]; y[iRow] += value * elementByColumn[j]; } } } } else { const int * columnLength = matrix_->getVectorLengths(); for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; double value = x[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; value *= scalar; for (j = start; j < end; j++) { iRow = row[j]; y[iRow] += value * elementByColumn[j]; } } } } } void ClpPackedMatrix::transposeTimes(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y) const { int iColumn; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); if (!(flags_ & 2)) { if (scalar == -1.0) { CoinBigIndex start = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinBigIndex next = columnStart[iColumn+1]; double value = y[iColumn]; for (j = start; j < next; j++) { int jRow = row[j]; value -= x[jRow] * elementByColumn[j]; } start = next; y[iColumn] = value; } } else { CoinBigIndex start = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinBigIndex next = columnStart[iColumn+1]; double value = 0.0; for (j = start; j < next; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j]; } start = next; y[iColumn] += value * scalar; } } } else { const int * columnLength = matrix_->getVectorLengths(); for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; double value = 0.0; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (j = start; j < end; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j]; } y[iColumn] += value * scalar; } } } void ClpPackedMatrix::times(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y, const double * COIN_RESTRICT rowScale, const double * COIN_RESTRICT columnScale) const { if (rowScale) { int iRow, iColumn; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); if (!(flags_ & 2)) { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = x[iColumn]; if (value) { // scaled value *= scalar * columnScale[iColumn]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; CoinBigIndex j; for (j = start; j < end; j++) { iRow = row[j]; y[iRow] += value * elementByColumn[j] * rowScale[iRow]; } } } } else { const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = x[iColumn]; if (value) { // scaled value *= scalar * columnScale[iColumn]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; CoinBigIndex j; for (j = start; j < end; j++) { iRow = row[j]; y[iRow] += value * elementByColumn[j] * rowScale[iRow]; } } } } } else { times(scalar, x, y); } } void ClpPackedMatrix::transposeTimes( double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y, const double * COIN_RESTRICT rowScale, const double * COIN_RESTRICT columnScale, double * COIN_RESTRICT spare) const { if (rowScale) { int iColumn; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); if (!spare) { if (!(flags_ & 2)) { CoinBigIndex start = columnStart[0]; if (scalar == -1.0) { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinBigIndex next = columnStart[iColumn+1]; double value = 0.0; // scaled for (j = start; j < next; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j] * rowScale[jRow]; } start = next; y[iColumn] -= value * columnScale[iColumn]; } } else { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinBigIndex next = columnStart[iColumn+1]; double value = 0.0; // scaled for (j = start; j < next; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j] * rowScale[jRow]; } start = next; y[iColumn] += value * scalar * columnScale[iColumn]; } } } else { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; double value = 0.0; // scaled for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j] * rowScale[jRow]; } y[iColumn] += value * scalar * columnScale[iColumn]; } } } else { // can use spare region int iRow; int numberRows = matrix_->getNumRows(); for (iRow = 0; iRow < numberRows; iRow++) { double value = x[iRow]; if (value) spare[iRow] = value * rowScale[iRow]; else spare[iRow] = 0.0; } if (!(flags_ & 2)) { CoinBigIndex start = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinBigIndex next = columnStart[iColumn+1]; double value = 0.0; // scaled for (j = start; j < next; j++) { int jRow = row[j]; value += spare[jRow] * elementByColumn[j]; } start = next; y[iColumn] += value * scalar * columnScale[iColumn]; } } else { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; double value = 0.0; // scaled for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int jRow = row[j]; value += spare[jRow] * elementByColumn[j]; } y[iColumn] += value * scalar * columnScale[iColumn]; } } // no need to zero out //for (iRow=0;iRowgetIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); if (!spare || !rowScale) { if (rowScale) { for (int jColumn = 0; jColumn < number; jColumn++) { int iColumn = which[jColumn]; CoinBigIndex j; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex next = columnStart[iColumn+1]; double value = 0.0; for (j = start; j < next; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j] * rowScale[jRow]; } y[iColumn] -= value * columnScale[iColumn]; } } else { for (int jColumn = 0; jColumn < number; jColumn++) { int iColumn = which[jColumn]; CoinBigIndex j; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex next = columnStart[iColumn+1]; double value = 0.0; for (j = start; j < next; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j]; } y[iColumn] -= value; } } } else { // can use spare region int iRow; int numberRows = matrix_->getNumRows(); for (iRow = 0; iRow < numberRows; iRow++) { double value = x[iRow]; if (value) spare[iRow] = value * rowScale[iRow]; else spare[iRow] = 0.0; } for (int jColumn = 0; jColumn < number; jColumn++) { int iColumn = which[jColumn]; CoinBigIndex j; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex next = columnStart[iColumn+1]; double value = 0.0; for (j = start; j < next; j++) { int jRow = row[j]; value += spare[jRow] * elementByColumn[j]; } y[iColumn] -= value * columnScale[iColumn]; } } } /* Return x * A + y in z. Squashes small elements and knows about ClpSimplex */ void ClpPackedMatrix::transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * rowArray, CoinIndexedVector * y, CoinIndexedVector * columnArray) const { columnArray->clear(); double * COIN_RESTRICT pi = rowArray->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = columnArray->getIndices(); double * COIN_RESTRICT array = columnArray->denseVector(); int numberInRowArray = rowArray->getNumElements(); // maybe I need one in OsiSimplex double zeroTolerance = model->zeroTolerance(); #if 0 //def COIN_DEVELOP if (zeroTolerance != 1.0e-13) { printf("small element in matrix - zero tolerance %g\n", zeroTolerance); } #endif int numberRows = model->numberRows(); ClpPackedMatrix* rowCopy = static_cast< ClpPackedMatrix*>(model->rowCopy()); bool packed = rowArray->packedMode(); double factor = (numberRows < 100) ? 0.25 : 0.35; factor = 0.5; // We may not want to do by row if there may be cache problems // It would be nice to find L2 cache size - for moment 512K // Be slightly optimistic if (numberActiveColumns_ * sizeof(double) > 1000000) { if (numberRows * 10 < numberActiveColumns_) factor *= 0.333333333; else if (numberRows * 4 < numberActiveColumns_) factor *= 0.5; else if (numberRows * 2 < numberActiveColumns_) factor *= 0.66666666667; //if (model->numberIterations()%50==0) //printf("%d nonzero\n",numberInRowArray); } // if not packed then bias a bit more towards by column if (!packed) factor *= 0.9; assert (!y->getNumElements()); double multiplierX = 0.8; double factor2 = factor * multiplierX; if (packed && rowCopy_ && numberInRowArray > 2 && numberInRowArray > factor2 * numberRows && numberInRowArray < 0.9 * numberRows && 0) { rowCopy_->transposeTimes(model, rowCopy->matrix_, rowArray, y, columnArray); return; } if (numberInRowArray > factor * numberRows || !rowCopy) { // do by column // If no gaps - can do a bit faster if (!(flags_ & 2) || columnCopy_) { transposeTimesByColumn( model, scalar, rowArray, y, columnArray); return; } int iColumn; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT rowScale = model->rowScale(); #if 0 ClpPackedMatrix * scaledMatrix = model->clpScaledMatrix(); if (rowScale && scaledMatrix) { rowScale = NULL; // get matrix data pointers row = scaledMatrix->getIndices(); columnStart = scaledMatrix->getVectorStarts(); columnLength = scaledMatrix->getVectorLengths(); elementByColumn = scaledMatrix->getElements(); } #endif if (packed) { // need to expand pi into y assert(y->capacity() >= numberRows); double * COIN_RESTRICT piOld = pi; pi = y->denseVector(); const int * COIN_RESTRICT whichRow = rowArray->getIndices(); int i; if (!rowScale) { // modify pi so can collapse to one loop if (scalar == -1.0) { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = -piOld[i]; } } else { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = scalar * piOld[i]; } } for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } else { #ifdef CLP_INVESTIGATE if (model->clpScaledMatrix()) printf("scaledMatrix_ at %d of ClpPackedMatrix\n", __LINE__); #endif // scaled // modify pi so can collapse to one loop if (scalar == -1.0) { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = -piOld[i] * rowScale[iRow]; } } else { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = scalar * piOld[i] * rowScale[iRow]; } } for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = 0.0; CoinBigIndex j; const double * columnScale = model->columnScale(); for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } value *= columnScale[iColumn]; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } // zero out for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = 0.0; } } else { if (!rowScale) { if (scalar == -1.0) { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = -value; } } } else { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } value *= scalar; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } } else { #ifdef CLP_INVESTIGATE if (model->clpScaledMatrix()) printf("scaledMatrix_ at %d of ClpPackedMatrix\n", __LINE__); #endif // scaled if (scalar == -1.0) { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = 0.0; CoinBigIndex j; const double * columnScale = model->columnScale(); for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } value *= columnScale[iColumn]; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = -value; } } } else { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = 0.0; CoinBigIndex j; const double * columnScale = model->columnScale(); for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } value *= scalar * columnScale[iColumn]; if (fabs(value) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value; } } } } } columnArray->setNumElements(numberNonZero); y->setNumElements(0); } else { // do by row rowCopy->transposeTimesByRow(model, scalar, rowArray, y, columnArray); } if (packed) columnArray->setPackedMode(true); if (0) { columnArray->checkClean(); int numberNonZero = columnArray->getNumElements();; int * index = columnArray->getIndices(); double * array = columnArray->denseVector(); int i; for (i = 0; i < numberNonZero; i++) { int j = index[i]; double value; if (packed) value = array[i]; else value = array[j]; printf("Ti %d %d %g\n", i, j, value); } } } //static int xA=0; //static int xB=0; //static int xC=0; //static int xD=0; //static double yA=0.0; //static double yC=0.0; /* Return x * scalar * A + y in z. Note - If x packed mode - then z packed mode This does by column and knows no gaps Squashes small elements and knows about ClpSimplex */ void ClpPackedMatrix::transposeTimesByColumn(const ClpSimplex * model, double scalar, const CoinIndexedVector * rowArray, CoinIndexedVector * y, CoinIndexedVector * columnArray) const { double * COIN_RESTRICT pi = rowArray->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = columnArray->getIndices(); double * COIN_RESTRICT array = columnArray->denseVector(); int numberInRowArray = rowArray->getNumElements(); // maybe I need one in OsiSimplex double zeroTolerance = model->zeroTolerance(); bool packed = rowArray->packedMode(); // do by column int iColumn; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT rowScale = model->rowScale(); assert (!y->getNumElements()); assert (numberActiveColumns_ > 0); const ClpPackedMatrix * thisMatrix = this; #if 0 ClpPackedMatrix * scaledMatrix = model->clpScaledMatrix(); if (rowScale && scaledMatrix) { rowScale = NULL; // get matrix data pointers row = scaledMatrix->getIndices(); columnStart = scaledMatrix->getVectorStarts(); elementByColumn = scaledMatrix->getElements(); thisMatrix = scaledMatrix; //printf("scaledMatrix\n"); } else if (rowScale) { //printf("no scaledMatrix\n"); } else { //printf("no rowScale\n"); } #endif if (packed) { // need to expand pi into y assert(y->capacity() >= model->numberRows()); double * COIN_RESTRICT piOld = pi; pi = y->denseVector(); const int * COIN_RESTRICT whichRow = rowArray->getIndices(); int i; if (!rowScale) { // modify pi so can collapse to one loop if (scalar == -1.0) { //yA += numberInRowArray; for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = -piOld[i]; } } else { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = scalar * piOld[i]; } } if (!columnCopy_) { if ((model->specialOptions(), 131072) != 0) { if(model->spareIntArray_[0] > 0) { CoinIndexedVector * spareArray = model->rowArray(3); // also do dualColumn stuff double * COIN_RESTRICT spare = spareArray->denseVector(); int * COIN_RESTRICT spareIndex = spareArray->getIndices(); const double * COIN_RESTRICT reducedCost = model->djRegion(0); double multiplier[] = { -1.0, 1.0}; double dualT = - model->currentDualTolerance(); double acceptablePivot = model->spareDoubleArray_[0]; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e15; double upperTheta = 1.0e31; double bestPossible = 0.0; int addSequence = model->numberColumns(); const unsigned char * COIN_RESTRICT statusArray = model->statusArray() + addSequence; int numberRemaining = 0; assert (scalar == -1.0); for (i = 0; i < numberInRowArray; i++) { int iSequence = whichRow[i]; int iStatus = (statusArray[iSequence] & 3) - 1; if (iStatus) { double mult = multiplier[iStatus-1]; double alpha = piOld[i] * mult; double oldValue; double value; if (alpha > 0.0) { oldValue = reducedCost[iSequence] * mult; value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; //tentativeTheta = CoinMin(2.0*upperTheta,tentativeTheta); } // add to list spare[numberRemaining] = alpha * mult; spareIndex[numberRemaining++] = iSequence + addSequence; } } } } numberNonZero = thisMatrix->gutsOfTransposeTimesUnscaled(pi, columnArray->getIndices(), columnArray->denseVector(), model->statusArray(), spareIndex, spare, model->djRegion(1), upperTheta, bestPossible, acceptablePivot, model->currentDualTolerance(), numberRemaining, zeroTolerance); model->spareDoubleArray_[0] = upperTheta; model->spareDoubleArray_[1] = bestPossible; spareArray->setNumElements(numberRemaining); // signal partially done model->spareIntArray_[0] = -2; } else { numberNonZero = thisMatrix->gutsOfTransposeTimesUnscaled(pi, columnArray->getIndices(), columnArray->denseVector(), model->statusArray(), zeroTolerance); } } else { numberNonZero = thisMatrix->gutsOfTransposeTimesUnscaled(pi, columnArray->getIndices(), columnArray->denseVector(), zeroTolerance); } columnArray->setNumElements(numberNonZero); //xA++; } else { columnCopy_->transposeTimes(model, pi, columnArray); numberNonZero = columnArray->getNumElements(); //xB++; } } else { #ifdef CLP_INVESTIGATE if (model->clpScaledMatrix()) printf("scaledMatrix_ at %d of ClpPackedMatrix\n", __LINE__); #endif // scaled // modify pi so can collapse to one loop if (scalar == -1.0) { //yC += numberInRowArray; for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = -piOld[i] * rowScale[iRow]; } } else { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = scalar * piOld[i] * rowScale[iRow]; } } const double * columnScale = model->columnScale(); if (!columnCopy_) { if ((model->specialOptions(), 131072) != 0) numberNonZero = gutsOfTransposeTimesScaled(pi, columnScale, columnArray->getIndices(), columnArray->denseVector(), model->statusArray(), zeroTolerance); else numberNonZero = gutsOfTransposeTimesScaled(pi, columnScale, columnArray->getIndices(), columnArray->denseVector(), zeroTolerance); columnArray->setNumElements(numberNonZero); //xC++; } else { columnCopy_->transposeTimes(model, pi, columnArray); numberNonZero = columnArray->getNumElements(); //xD++; } } // zero out int numberRows = model->numberRows(); if (numberInRowArray * 4 < numberRows) { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = 0.0; } } else { CoinZeroN(pi, numberRows); } //int kA=xA+xB; //int kC=xC+xD; //if ((kA+kC)%10000==0) //printf("AA %d %d %g, CC %d %d %g\n", // xA,xB,kA ? yA/(double)(kA): 0.0,xC,xD,kC ? yC/(double) (kC) :0.0); } else { if (!rowScale) { if (scalar == -1.0) { double value = 0.0; CoinBigIndex j; CoinBigIndex end = columnStart[1]; for (j = columnStart[0]; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } for (iColumn = 0; iColumn < numberActiveColumns_ - 1; iColumn++) { CoinBigIndex start = end; end = columnStart[iColumn+2]; if (fabs(value) > zeroTolerance) { array[iColumn] = -value; index[numberNonZero++] = iColumn; } value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } } if (fabs(value) > zeroTolerance) { array[iColumn] = -value; index[numberNonZero++] = iColumn; } } else { double value = 0.0; CoinBigIndex j; CoinBigIndex end = columnStart[1]; for (j = columnStart[0]; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } for (iColumn = 0; iColumn < numberActiveColumns_ - 1; iColumn++) { value *= scalar; CoinBigIndex start = end; end = columnStart[iColumn+2]; if (fabs(value) > zeroTolerance) { array[iColumn] = value; index[numberNonZero++] = iColumn; } value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } } value *= scalar; if (fabs(value) > zeroTolerance) { array[iColumn] = value; index[numberNonZero++] = iColumn; } } } else { #ifdef CLP_INVESTIGATE if (model->clpScaledMatrix()) printf("scaledMatrix_ at %d of ClpPackedMatrix\n", __LINE__); #endif // scaled if (scalar == -1.0) { const double * COIN_RESTRICT columnScale = model->columnScale(); double value = 0.0; double scale = columnScale[0]; CoinBigIndex j; CoinBigIndex end = columnStart[1]; for (j = columnStart[0]; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } for (iColumn = 0; iColumn < numberActiveColumns_ - 1; iColumn++) { value *= scale; CoinBigIndex start = end; end = columnStart[iColumn+2]; scale = columnScale[iColumn+1]; if (fabs(value) > zeroTolerance) { array[iColumn] = -value; index[numberNonZero++] = iColumn; } value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } } value *= scale; if (fabs(value) > zeroTolerance) { array[iColumn] = -value; index[numberNonZero++] = iColumn; } } else { const double * COIN_RESTRICT columnScale = model->columnScale(); double value = 0.0; double scale = columnScale[0] * scalar; CoinBigIndex j; CoinBigIndex end = columnStart[1]; for (j = columnStart[0]; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } for (iColumn = 0; iColumn < numberActiveColumns_ - 1; iColumn++) { value *= scale; CoinBigIndex start = end; end = columnStart[iColumn+2]; scale = columnScale[iColumn+1] * scalar; if (fabs(value) > zeroTolerance) { array[iColumn] = value; index[numberNonZero++] = iColumn; } value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } } value *= scale; if (fabs(value) > zeroTolerance) { array[iColumn] = value; index[numberNonZero++] = iColumn; } } } } columnArray->setNumElements(numberNonZero); y->setNumElements(0); if (packed) columnArray->setPackedMode(true); } /* Return x * A + y in z. Squashes small elements and knows about ClpSimplex */ void ClpPackedMatrix::transposeTimesByRow(const ClpSimplex * model, double scalar, const CoinIndexedVector * rowArray, CoinIndexedVector * y, CoinIndexedVector * columnArray) const { columnArray->clear(); double * COIN_RESTRICT pi = rowArray->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = columnArray->getIndices(); double * COIN_RESTRICT array = columnArray->denseVector(); int numberInRowArray = rowArray->getNumElements(); // maybe I need one in OsiSimplex double zeroTolerance = model->zeroTolerance(); const int * COIN_RESTRICT column = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = getVectorStarts(); const double * COIN_RESTRICT element = getElements(); const int * COIN_RESTRICT whichRow = rowArray->getIndices(); bool packed = rowArray->packedMode(); if (numberInRowArray > 2) { // do by rows // ** Row copy is already scaled int iRow; int i; int numberOriginal = 0; if (packed) { int * COIN_RESTRICT index = columnArray->getIndices(); double * COIN_RESTRICT array = columnArray->denseVector(); #if 0 { double * COIN_RESTRICT array2 = y->denseVector(); int numberColumns = matrix_->getNumCols(); for (int i=0;igetNumCols(); bool sparse=true; for (int i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; numberCovered += rowStart[iRow+1] - rowStart[iRow]; // ? exact ratio if (numberCovered>numberColumns) { sparse=false; break; } } if (sparse) { assert (!y->getNumElements()); #if COIN_SPARSE_MATRIX != 2 // and set up mark as char array char * COIN_RESTRICT marked = reinterpret_cast (index+columnArray->capacity()); int * COIN_RESTRICT lookup = y->getIndices(); #ifndef NDEBUG //int numberColumns = matrix_->getNumCols(); //for (int i=0;idenseVector(); numberNonZero=gutsOfTransposeTimesByRowGE3(rowArray,index,array, array2,zeroTolerance,scalar); #endif } else { numberNonZero = gutsOfTransposeTimesByRowGEK(rowArray, index, array, numberColumns, zeroTolerance, scalar); } columnArray->setNumElements(numberNonZero); } else { double * COIN_RESTRICT markVector = y->denseVector(); numberNonZero = 0; // and set up mark as char array char * COIN_RESTRICT marked = reinterpret_cast (markVector); for (i = 0; i < numberOriginal; i++) { int iColumn = index[i]; marked[iColumn] = 0; } for (i = 0; i < numberInRowArray; i++) { iRow = whichRow[i]; double value = pi[iRow] * scalar; CoinBigIndex j; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (!marked[iColumn]) { marked[iColumn] = 1; index[numberNonZero++] = iColumn; } array[iColumn] += value * element[j]; } } // get rid of tiny values and zero out marked numberOriginal = numberNonZero; numberNonZero = 0; for (i = 0; i < numberOriginal; i++) { int iColumn = index[i]; marked[iColumn] = 0; if (fabs(array[iColumn]) > zeroTolerance) { index[numberNonZero++] = iColumn; } else { array[iColumn] = 0.0; } } } } else if (numberInRowArray == 2) { // do by rows when two rows int numberOriginal; int i; CoinBigIndex j; numberNonZero = 0; double value; if (packed) { gutsOfTransposeTimesByRowEQ2(rowArray, columnArray, y, zeroTolerance, scalar); numberNonZero = columnArray->getNumElements(); } else { int iRow = whichRow[0]; value = pi[iRow] * scalar; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; double value2 = value * element[j]; index[numberNonZero++] = iColumn; array[iColumn] = value2; } iRow = whichRow[1]; value = pi[iRow] * scalar; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; double value2 = value * element[j]; // I am assuming no zeros in matrix if (array[iColumn]) value2 += array[iColumn]; else index[numberNonZero++] = iColumn; array[iColumn] = value2; } // get rid of tiny values and zero out marked numberOriginal = numberNonZero; numberNonZero = 0; for (i = 0; i < numberOriginal; i++) { int iColumn = index[i]; if (fabs(array[iColumn]) > zeroTolerance) { index[numberNonZero++] = iColumn; } else { array[iColumn] = 0.0; } } } } else if (numberInRowArray == 1) { // Just one row int iRow = rowArray->getIndices()[0]; numberNonZero = 0; CoinBigIndex j; if (packed) { gutsOfTransposeTimesByRowEQ1(rowArray, columnArray, zeroTolerance, scalar); numberNonZero = columnArray->getNumElements(); } else { double value = pi[iRow] * scalar; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; double value2 = value * element[j]; if (fabs(value2) > zeroTolerance) { index[numberNonZero++] = iColumn; array[iColumn] = value2; } } } } columnArray->setNumElements(numberNonZero); y->setNumElements(0); } // Meat of transposeTimes by column when not scaled int ClpPackedMatrix::gutsOfTransposeTimesUnscaled(const double * COIN_RESTRICT pi, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const double zeroTolerance) const { int numberNonZero = 0; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); #if 1 //ndef INTEL_MKL double value = 0.0; CoinBigIndex j; CoinBigIndex end = columnStart[1]; for (j = columnStart[0]; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } int iColumn; for (iColumn = 0; iColumn < numberActiveColumns_ - 1; iColumn++) { CoinBigIndex start = end; end = columnStart[iColumn+2]; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } #else char transA = 'N'; //int numberRows = matrix_->getNumRows(); mkl_cspblas_dcsrgemv(&transA, const_cast(&numberActiveColumns_), const_cast(elementByColumn), const_cast(columnStart), const_cast(row), const_cast(pi), array); int iColumn; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { double value = array[iColumn]; if (value) { array[iColumn] = 0.0; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } #endif return numberNonZero; } // Meat of transposeTimes by column when scaled int ClpPackedMatrix::gutsOfTransposeTimesScaled(const double * COIN_RESTRICT pi, const double * COIN_RESTRICT columnScale, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const double zeroTolerance) const { int numberNonZero = 0; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); double value = 0.0; double scale = columnScale[0]; CoinBigIndex j; CoinBigIndex end = columnStart[1]; for (j = columnStart[0]; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } int iColumn; for (iColumn = 0; iColumn < numberActiveColumns_ - 1; iColumn++) { value *= scale; CoinBigIndex start = end; scale = columnScale[iColumn+1]; end = columnStart[iColumn+2]; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } } value *= scale; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } return numberNonZero; } // Meat of transposeTimes by column when not scaled int ClpPackedMatrix::gutsOfTransposeTimesUnscaled(const double * COIN_RESTRICT pi, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const unsigned char * COIN_RESTRICT status, const double zeroTolerance) const { int numberNonZero = 0; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); double value = 0.0; int jColumn = -1; for (int iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { bool wanted = ((status[iColumn] & 3) != 1); if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = jColumn; } value = 0.0; if (wanted) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; jColumn = iColumn; int n = end - start; bool odd = (n & 1) != 0; n = n >> 1; const int * COIN_RESTRICT rowThis = row + start; const double * COIN_RESTRICT elementThis = elementByColumn + start; for (; n; n--) { int iRow0 = *rowThis; int iRow1 = *(rowThis + 1); rowThis += 2; value += pi[iRow0] * (*elementThis); value += pi[iRow1] * (*(elementThis + 1)); elementThis += 2; } if (odd) { int iRow = *rowThis; value += pi[iRow] * (*elementThis); } } } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = jColumn; } return numberNonZero; } /* Meat of transposeTimes by column when not scaled and skipping and doing part of dualColumn */ int ClpPackedMatrix::gutsOfTransposeTimesUnscaled(const double * COIN_RESTRICT pi, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const unsigned char * COIN_RESTRICT status, int * COIN_RESTRICT spareIndex, double * COIN_RESTRICT spareArray, const double * COIN_RESTRICT reducedCost, double & upperThetaP, double & bestPossibleP, double acceptablePivot, double dualTolerance, int & numberRemainingP, const double zeroTolerance) const { double tentativeTheta = 1.0e15; int numberRemaining = numberRemainingP; double upperTheta = upperThetaP; double bestPossible = bestPossibleP; int numberNonZero = 0; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); double multiplier[] = { -1.0, 1.0}; double dualT = - dualTolerance; for (int iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { int wanted = (status[iColumn] & 3) - 1; if (wanted) { double value = 0.0; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; int n = end - start; #if 1 bool odd = (n & 1) != 0; n = n >> 1; const int * COIN_RESTRICT rowThis = row + start; const double * COIN_RESTRICT elementThis = elementByColumn + start; for (; n; n--) { int iRow0 = *rowThis; int iRow1 = *(rowThis + 1); rowThis += 2; value += pi[iRow0] * (*elementThis); value += pi[iRow1] * (*(elementThis + 1)); elementThis += 2; } if (odd) { int iRow = *rowThis; value += pi[iRow] * (*elementThis); } #else const int * COIN_RESTRICT rowThis = &row[end-16]; const double * COIN_RESTRICT elementThis = &elementByColumn[end-16]; bool odd = (n & 1) != 0; n = n >> 1; double value2 = 0.0; if (odd) { int iRow = row[start]; value2 = pi[iRow] * elementByColumn[start]; } switch (n) { default: { if (odd) { start++; } n -= 8; for (; n; n--) { int iRow0 = row[start]; int iRow1 = row[start+1]; value += pi[iRow0] * elementByColumn[start]; value2 += pi[iRow1] * elementByColumn[start+1]; start += 2; } case 8: { int iRow0 = rowThis[16-16]; int iRow1 = rowThis[16-15]; value += pi[iRow0] * elementThis[16-16]; value2 += pi[iRow1] * elementThis[16-15]; } case 7: { int iRow0 = rowThis[16-14]; int iRow1 = rowThis[16-13]; value += pi[iRow0] * elementThis[16-14]; value2 += pi[iRow1] * elementThis[16-13]; } case 6: { int iRow0 = rowThis[16-12]; int iRow1 = rowThis[16-11]; value += pi[iRow0] * elementThis[16-12]; value2 += pi[iRow1] * elementThis[16-11]; } case 5: { int iRow0 = rowThis[16-10]; int iRow1 = rowThis[16-9]; value += pi[iRow0] * elementThis[16-10]; value2 += pi[iRow1] * elementThis[16-9]; } case 4: { int iRow0 = rowThis[16-8]; int iRow1 = rowThis[16-7]; value += pi[iRow0] * elementThis[16-8]; value2 += pi[iRow1] * elementThis[16-7]; } case 3: { int iRow0 = rowThis[16-6]; int iRow1 = rowThis[16-5]; value += pi[iRow0] * elementThis[16-6]; value2 += pi[iRow1] * elementThis[16-5]; } case 2: { int iRow0 = rowThis[16-4]; int iRow1 = rowThis[16-3]; value += pi[iRow0] * elementThis[16-4]; value2 += pi[iRow1] * elementThis[16-3]; } case 1: { int iRow0 = rowThis[16-2]; int iRow1 = rowThis[16-1]; value += pi[iRow0] * elementThis[16-2]; value2 += pi[iRow1] * elementThis[16-1]; } case 0: ; } } value += value2; #endif if (fabs(value) > zeroTolerance) { double mult = multiplier[wanted-1]; double alpha = value * mult; array[numberNonZero] = value; index[numberNonZero++] = iColumn; if (alpha > 0.0) { double oldValue = reducedCost[iColumn] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; //tentativeTheta = CoinMin(2.0*upperTheta,tentativeTheta); } // add to list spareArray[numberRemaining] = alpha * mult; spareIndex[numberRemaining++] = iColumn; } } } } } numberRemainingP = numberRemaining; upperThetaP = upperTheta; bestPossibleP = bestPossible; return numberNonZero; } // Meat of transposeTimes by column when scaled int ClpPackedMatrix::gutsOfTransposeTimesScaled(const double * COIN_RESTRICT pi, const double * COIN_RESTRICT columnScale, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const unsigned char * COIN_RESTRICT status, const double zeroTolerance) const { int numberNonZero = 0; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); double value = 0.0; int jColumn = -1; for (int iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { bool wanted = ((status[iColumn] & 3) != 1); if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = jColumn; } value = 0.0; if (wanted) { double scale = columnScale[iColumn]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; jColumn = iColumn; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } value *= scale; } } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = jColumn; } return numberNonZero; } // Meat of transposeTimes by row n > K if packed - returns number nonzero int ClpPackedMatrix::gutsOfTransposeTimesByRowGEK(const CoinIndexedVector * COIN_RESTRICT piVector, int * COIN_RESTRICT index, double * COIN_RESTRICT output, int numberColumns, const double tolerance, const double scalar) const { const double * COIN_RESTRICT pi = piVector->denseVector(); int numberInRowArray = piVector->getNumElements(); const int * COIN_RESTRICT column = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT element = matrix_->getElements(); const int * COIN_RESTRICT whichRow = piVector->getIndices(); // ** Row copy is already scaled for (int i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; double value = pi[i] * scalar; CoinBigIndex start = rowStart[iRow]; CoinBigIndex end = rowStart[iRow+1]; int n = end - start; const int * COIN_RESTRICT columnThis = column + start; const double * COIN_RESTRICT elementThis = element + start; // could do by twos for (; n; n--) { int iColumn = *columnThis; columnThis++; double elValue = *elementThis; elementThis++; elValue *= value; output[iColumn] += elValue; } } // get rid of tiny values and count int numberNonZero = 0; for (int i = 0; i < numberColumns; i++) { double value = output[i]; if (value) { output[i] = 0.0; if (fabs(value) > tolerance) { output[numberNonZero] = value; index[numberNonZero++] = i; } } } #ifndef NDEBUG for (int i = numberNonZero; i < numberColumns; i++) assert(!output[i]); #endif return numberNonZero; } // Meat of transposeTimes by row n == 2 if packed void ClpPackedMatrix::gutsOfTransposeTimesByRowEQ2(const CoinIndexedVector * piVector, CoinIndexedVector * output, CoinIndexedVector * spareVector, const double tolerance, const double scalar) const { double * COIN_RESTRICT pi = piVector->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = output->getIndices(); double * COIN_RESTRICT array = output->denseVector(); const int * COIN_RESTRICT column = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT element = matrix_->getElements(); const int * COIN_RESTRICT whichRow = piVector->getIndices(); int iRow0 = whichRow[0]; int iRow1 = whichRow[1]; double pi0 = pi[0]; double pi1 = pi[1]; if (rowStart[iRow0+1] - rowStart[iRow0] > rowStart[iRow1+1] - rowStart[iRow1]) { // do one with fewer first iRow0 = iRow1; iRow1 = whichRow[0]; pi0 = pi1; pi1 = pi[0]; } // and set up mark as char array char * COIN_RESTRICT marked = reinterpret_cast (index + output->capacity()); int * COIN_RESTRICT lookup = spareVector->getIndices(); double value = pi0 * scalar; CoinBigIndex j; for (j = rowStart[iRow0]; j < rowStart[iRow0+1]; j++) { int iColumn = column[j]; double elValue = element[j]; double value2 = value * elValue; array[numberNonZero] = value2; marked[iColumn] = 1; lookup[iColumn] = numberNonZero; index[numberNonZero++] = iColumn; } int numberOriginal = numberNonZero; value = pi1 * scalar; for (j = rowStart[iRow1]; j < rowStart[iRow1+1]; j++) { int iColumn = column[j]; double elValue = element[j]; double value2 = value * elValue; // I am assuming no zeros in matrix if (marked[iColumn]) { int iLookup = lookup[iColumn]; array[iLookup] += value2; } else { if (fabs(value2) > tolerance) { array[numberNonZero] = value2; index[numberNonZero++] = iColumn; } } } // get rid of tiny values and zero out marked int i; int iFirst = numberNonZero; for (i = 0; i < numberOriginal; i++) { int iColumn = index[i]; marked[iColumn] = 0; if (fabs(array[i]) <= tolerance) { if (numberNonZero > numberOriginal) { numberNonZero--; double value = array[numberNonZero]; array[numberNonZero] = 0.0; array[i] = value; index[i] = index[numberNonZero]; } else { iFirst = i; } } } if (iFirst < numberNonZero) { int n = iFirst; for (i = n; i < numberOriginal; i++) { int iColumn = index[i]; double value = array[i]; array[i] = 0.0; if (fabs(value) > tolerance) { array[n] = value; index[n++] = iColumn; } } for (; i < numberNonZero; i++) { int iColumn = index[i]; double value = array[i]; array[i] = 0.0; array[n] = value; index[n++] = iColumn; } numberNonZero = n; } output->setNumElements(numberNonZero); spareVector->setNumElements(0); } // Meat of transposeTimes by row n == 1 if packed void ClpPackedMatrix::gutsOfTransposeTimesByRowEQ1(const CoinIndexedVector * piVector, CoinIndexedVector * output, const double tolerance, const double scalar) const { double * COIN_RESTRICT pi = piVector->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = output->getIndices(); double * COIN_RESTRICT array = output->denseVector(); const int * COIN_RESTRICT column = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT element = matrix_->getElements(); int iRow = piVector->getIndices()[0]; numberNonZero = 0; CoinBigIndex j; double value = pi[0] * scalar; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; double elValue = element[j]; double value2 = value * elValue; if (fabs(value2) > tolerance) { array[numberNonZero] = value2; index[numberNonZero++] = iColumn; } } output->setNumElements(numberNonZero); } /* Return x *A in z but just for indices in y. Squashes small elements and knows about ClpSimplex */ void ClpPackedMatrix::subsetTransposeTimes(const ClpSimplex * model, const CoinIndexedVector * rowArray, const CoinIndexedVector * y, CoinIndexedVector * columnArray) const { columnArray->clear(); double * COIN_RESTRICT pi = rowArray->denseVector(); double * COIN_RESTRICT array = columnArray->denseVector(); int jColumn; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT rowScale = model->rowScale(); int numberToDo = y->getNumElements(); const int * COIN_RESTRICT which = y->getIndices(); assert (!rowArray->packedMode()); columnArray->setPacked(); ClpPackedMatrix * scaledMatrix = model->clpScaledMatrix(); int flags = flags_; if (rowScale && scaledMatrix && !(scaledMatrix->flags() & 2)) { flags = 0; rowScale = NULL; // get matrix data pointers row = scaledMatrix->getIndices(); columnStart = scaledMatrix->getVectorStarts(); elementByColumn = scaledMatrix->getElements(); } if (!(flags & 2) && numberToDo>2) { // no gaps if (!rowScale) { int iColumn = which[0]; double value = 0.0; CoinBigIndex j; int columnNext = which[1]; CoinBigIndex startNext=columnStart[columnNext]; //coin_prefetch_const(row+startNext); //coin_prefetch_const(elementByColumn+startNext); CoinBigIndex endNext=columnStart[columnNext+1]; for (j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } for (jColumn = 0; jColumn < numberToDo - 2; jColumn++) { CoinBigIndex start = startNext; CoinBigIndex end = endNext; columnNext = which[jColumn+2]; startNext=columnStart[columnNext]; //coin_prefetch_const(row+startNext); //coin_prefetch_const(elementByColumn+startNext); endNext=columnStart[columnNext+1]; array[jColumn] = value; value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } } array[jColumn++] = value; value = 0.0; for (j = startNext; j < endNext; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } array[jColumn] = value; } else { #ifdef CLP_INVESTIGATE if (model->clpScaledMatrix()) printf("scaledMatrix_ at %d of ClpPackedMatrix\n", __LINE__); #endif // scaled const double * columnScale = model->columnScale(); int iColumn = which[0]; double value = 0.0; double scale = columnScale[iColumn]; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } for (jColumn = 0; jColumn < numberToDo - 1; jColumn++) { int iColumn = which[jColumn+1]; value *= scale; scale = columnScale[iColumn]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; array[jColumn] = value; value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } } value *= scale; array[jColumn] = value; } } else if (numberToDo) { // gaps if (!rowScale) { for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j]; } array[jColumn] = value; } } else { #ifdef CLP_INVESTIGATE if (model->clpScaledMatrix()) printf("scaledMatrix_ at %d of ClpPackedMatrix - flags %d (%d) n %d\n", __LINE__, flags_, model->clpScaledMatrix()->flags(), numberToDo); #endif // scaled const double * columnScale = model->columnScale(); for (jColumn = 0; jColumn < numberToDo; jColumn++) { int iColumn = which[jColumn]; double value = 0.0; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; value += pi[iRow] * elementByColumn[j] * rowScale[iRow]; } value *= columnScale[iColumn]; array[jColumn] = value; } } } } /* Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster */ bool ClpPackedMatrix::canCombine(const ClpSimplex * model, const CoinIndexedVector * pi) const { int numberInRowArray = pi->getNumElements(); int numberRows = model->numberRows(); bool packed = pi->packedMode(); // factor should be smaller if doing both with two pi vectors double factor = 0.30; // We may not want to do by row if there may be cache problems // It would be nice to find L2 cache size - for moment 512K // Be slightly optimistic if (numberActiveColumns_ * sizeof(double) > 1000000) { if (numberRows * 10 < numberActiveColumns_) factor *= 0.333333333; else if (numberRows * 4 < numberActiveColumns_) factor *= 0.5; else if (numberRows * 2 < numberActiveColumns_) factor *= 0.66666666667; //if (model->numberIterations()%50==0) //printf("%d nonzero\n",numberInRowArray); } // if not packed then bias a bit more towards by column if (!packed) factor *= 0.9; return ((numberInRowArray > factor * numberRows || !model->rowCopy()) && !(flags_ & 2)); } #ifndef CLP_ALL_ONE_FILE // These have to match ClpPrimalColumnSteepest version #define reference(i) (((reference[i>>5]>>(i&31))&1)!=0) #endif // Updates two arrays for steepest void ClpPackedMatrix::transposeTimes2(const ClpSimplex * model, const CoinIndexedVector * pi1, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * spare, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * COIN_RESTRICT reference, double * COIN_RESTRICT weights, double scaleFactor) { // put row of tableau in dj1 double * COIN_RESTRICT pi = pi1->denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = dj1->getIndices(); double * COIN_RESTRICT array = dj1->denseVector(); int numberInRowArray = pi1->getNumElements(); double zeroTolerance = model->zeroTolerance(); bool packed = pi1->packedMode(); // do by column int iColumn; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT rowScale = model->rowScale(); assert (!spare->getNumElements()); assert (numberActiveColumns_ > 0); double * COIN_RESTRICT piWeight = pi2->denseVector(); assert (!pi2->packedMode()); bool killDjs = (scaleFactor == 0.0); if (!scaleFactor) scaleFactor = 1.0; if (packed) { // need to expand pi into y assert(spare->capacity() >= model->numberRows()); double * COIN_RESTRICT piOld = pi; pi = spare->denseVector(); const int * COIN_RESTRICT whichRow = pi1->getIndices(); int i; ClpPackedMatrix * scaledMatrix = model->clpScaledMatrix(); if (rowScale && scaledMatrix) { rowScale = NULL; // get matrix data pointers row = scaledMatrix->getIndices(); columnStart = scaledMatrix->getVectorStarts(); elementByColumn = scaledMatrix->getElements(); } if (!rowScale) { // modify pi so can collapse to one loop for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = piOld[i]; } if (!columnCopy_) { CoinBigIndex j; CoinBigIndex end = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex start = end; end = columnStart[iColumn+1]; ClpSimplex::Status status = model->getStatus(iColumn); if (status == ClpSimplex::basic || status == ClpSimplex::isFixed) continue; double value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value -= pi[iRow] * elementByColumn[j]; } if (fabs(value) > zeroTolerance) { // and do other array double modification = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; modification += piWeight[iRow] * elementByColumn[j]; } double thisWeight = weights[iColumn]; double pivot = value * scaleFactor; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; if (!killDjs) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } } else { // use special column copy // reset back if (killDjs) scaleFactor = 0.0; columnCopy_->transposeTimes2(model, pi, dj1, piWeight, referenceIn, devex, reference, weights, scaleFactor); numberNonZero = dj1->getNumElements(); } } else { // scaled // modify pi so can collapse to one loop for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = piOld[i] * rowScale[iRow]; } // can also scale piWeight as not used again int numberWeight = pi2->getNumElements(); const int * indexWeight = pi2->getIndices(); for (i = 0; i < numberWeight; i++) { int iRow = indexWeight[i]; piWeight[iRow] *= rowScale[iRow]; } if (!columnCopy_) { const double * COIN_RESTRICT columnScale = model->columnScale(); CoinBigIndex j; CoinBigIndex end = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex start = end; end = columnStart[iColumn+1]; ClpSimplex::Status status = model->getStatus(iColumn); if (status == ClpSimplex::basic || status == ClpSimplex::isFixed) continue; double scale = columnScale[iColumn]; double value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value -= pi[iRow] * elementByColumn[j]; } value *= scale; if (fabs(value) > zeroTolerance) { double modification = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; modification += piWeight[iRow] * elementByColumn[j]; } modification *= scale; double thisWeight = weights[iColumn]; double pivot = value * scaleFactor; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; if (!killDjs) { array[numberNonZero] = value; index[numberNonZero++] = iColumn; } } } } else { // use special column copy // reset back if (killDjs) scaleFactor = 0.0; columnCopy_->transposeTimes2(model, pi, dj1, piWeight, referenceIn, devex, reference, weights, scaleFactor); numberNonZero = dj1->getNumElements(); } } // zero out int numberRows = model->numberRows(); if (numberInRowArray * 4 < numberRows) { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; pi[iRow] = 0.0; } } else { CoinZeroN(pi, numberRows); } } else { if (!rowScale) { CoinBigIndex j; CoinBigIndex end = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex start = end; end = columnStart[iColumn+1]; ClpSimplex::Status status = model->getStatus(iColumn); if (status == ClpSimplex::basic || status == ClpSimplex::isFixed) continue; double value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value -= pi[iRow] * elementByColumn[j]; } if (fabs(value) > zeroTolerance) { // and do other array double modification = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; modification += piWeight[iRow] * elementByColumn[j]; } double thisWeight = weights[iColumn]; double pivot = value * scaleFactor; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; if (!killDjs) { array[iColumn] = value; index[numberNonZero++] = iColumn; } } } } else { #ifdef CLP_INVESTIGATE if (model->clpScaledMatrix()) printf("scaledMatrix_ at %d of ClpPackedMatrix\n", __LINE__); #endif // scaled // can also scale piWeight as not used again int numberWeight = pi2->getNumElements(); const int * COIN_RESTRICT indexWeight = pi2->getIndices(); for (int i = 0; i < numberWeight; i++) { int iRow = indexWeight[i]; piWeight[iRow] *= rowScale[iRow]; } const double * COIN_RESTRICT columnScale = model->columnScale(); CoinBigIndex j; CoinBigIndex end = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex start = end; end = columnStart[iColumn+1]; ClpSimplex::Status status = model->getStatus(iColumn); if (status == ClpSimplex::basic || status == ClpSimplex::isFixed) continue; double scale = columnScale[iColumn]; double value = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; value -= pi[iRow] * elementByColumn[j] * rowScale[iRow]; } value *= scale; if (fabs(value) > zeroTolerance) { double modification = 0.0; for (j = start; j < end; j++) { int iRow = row[j]; modification += piWeight[iRow] * elementByColumn[j]; } modification *= scale; double thisWeight = weights[iColumn]; double pivot = value * scaleFactor; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; if (!killDjs) { array[iColumn] = value; index[numberNonZero++] = iColumn; } } } } } dj1->setNumElements(numberNonZero); spare->setNumElements(0); if (packed) dj1->setPackedMode(true); } // Updates second array for steepest and does devex weights void ClpPackedMatrix::subsetTimes2(const ClpSimplex * model, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector *, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * COIN_RESTRICT reference, double * COIN_RESTRICT weights, double scaleFactor) { int number = dj1->getNumElements(); const int * COIN_RESTRICT index = dj1->getIndices(); double * COIN_RESTRICT array = dj1->denseVector(); assert( dj1->packedMode()); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT rowScale = model->rowScale(); double * COIN_RESTRICT piWeight = pi2->denseVector(); bool killDjs = (scaleFactor == 0.0); if (!scaleFactor) scaleFactor = 1.0; if (!rowScale) { for (int k = 0; k < number; k++) { int iColumn = index[k]; double pivot = array[k] * scaleFactor; if (killDjs) array[k] = 0.0; // and do other array double modification = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; modification += piWeight[iRow] * elementByColumn[j]; } double thisWeight = weights[iColumn]; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; } } else { #ifdef CLP_INVESTIGATE if (model->clpScaledMatrix()) printf("scaledMatrix_ at %d of ClpPackedMatrix\n", __LINE__); #endif // scaled const double * columnScale = model->columnScale(); for (int k = 0; k < number; k++) { int iColumn = index[k]; double pivot = array[k] * scaleFactor; double scale = columnScale[iColumn]; if (killDjs) array[k] = 0.0; // and do other array double modification = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; modification += piWeight[iRow] * elementByColumn[j] * rowScale[iRow]; } double thisWeight = weights[iColumn]; modification *= scale; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iColumn] = thisWeight; } } } /// returns number of elements in column part of basis, CoinBigIndex ClpPackedMatrix::countBasis( const int * whichColumn, int & numberColumnBasic) { const int * columnLength = matrix_->getVectorLengths(); int i; CoinBigIndex numberElements = 0; // just count - can be over so ignore zero problem for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; numberElements += columnLength[iColumn]; } return numberElements; } void ClpPackedMatrix::fillBasis(ClpSimplex * model, const int * COIN_RESTRICT whichColumn, int & numberColumnBasic, int * COIN_RESTRICT indexRowU, int * COIN_RESTRICT start, int * COIN_RESTRICT rowCount, int * COIN_RESTRICT columnCount, CoinFactorizationDouble * COIN_RESTRICT elementU) { const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); int i; CoinBigIndex numberElements = start[0]; // fill const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT rowScale = model->rowScale(); const int * COIN_RESTRICT row = matrix_->getIndices(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); ClpPackedMatrix * scaledMatrix = model->clpScaledMatrix(); if (scaledMatrix && true) { columnLength = scaledMatrix->matrix_->getVectorLengths(); columnStart = scaledMatrix->matrix_->getVectorStarts(); rowScale = NULL; row = scaledMatrix->matrix_->getIndices(); elementByColumn = scaledMatrix->matrix_->getElements(); } if ((flags_ & 1) == 0) { if (!rowScale) { // no scaling for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; int length = columnLength[iColumn]; CoinBigIndex startThis = columnStart[iColumn]; columnCount[i] = length; CoinBigIndex endThis = startThis + length; for (CoinBigIndex j = startThis; j < endThis; j++) { int iRow = row[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; assert (elementByColumn[j]); elementU[numberElements++] = elementByColumn[j]; } start[i+1] = numberElements; } } else { // scaling const double * COIN_RESTRICT columnScale = model->columnScale(); for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; double scale = columnScale[iColumn]; int length = columnLength[iColumn]; CoinBigIndex startThis = columnStart[iColumn]; columnCount[i] = length; CoinBigIndex endThis = startThis + length; for (CoinBigIndex j = startThis; j < endThis; j++) { int iRow = row[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; assert (elementByColumn[j]); elementU[numberElements++] = elementByColumn[j] * scale * rowScale[iRow]; } start[i+1] = numberElements; } } } else { // there are zero elements so need to look more closely if (!rowScale) { // no scaling for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { double value = elementByColumn[j]; if (value) { int iRow = row[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = value; } } start[i+1] = numberElements; columnCount[i] = numberElements - start[i]; } } else { // scaling const double * columnScale = model->columnScale(); for (i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]; CoinBigIndex j; double scale = columnScale[iColumn]; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[i]; j++) { double value = elementByColumn[j]; if (value) { int iRow = row[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; elementU[numberElements++] = value * scale * rowScale[iRow]; } } start[i+1] = numberElements; columnCount[i] = numberElements - start[i]; } } } } #if 0 int ClpPackedMatrix::scale2(ClpModel * model) const { ClpSimplex * baseModel = NULL; #ifndef NDEBUG //checkFlags(); #endif int numberRows = model->numberRows(); int numberColumns = matrix_->getNumCols(); model->setClpScaledMatrix(NULL); // get rid of any scaled matrix // If empty - return as sanityCheck will trap if (!numberRows || !numberColumns) { model->setRowScale(NULL); model->setColumnScale(NULL); return 1; } ClpMatrixBase * rowCopyBase = model->rowCopy(); double * rowScale; double * columnScale; //assert (!model->rowScale()); bool arraysExist; double * inverseRowScale = NULL; double * inverseColumnScale = NULL; if (!model->rowScale()) { rowScale = new double [numberRows*2]; columnScale = new double [numberColumns*2]; inverseRowScale = rowScale + numberRows; inverseColumnScale = columnScale + numberColumns; arraysExist = false; } else { rowScale = model->mutableRowScale(); columnScale = model->mutableColumnScale(); inverseRowScale = model->mutableInverseRowScale(); inverseColumnScale = model->mutableInverseColumnScale(); arraysExist = true; } assert (inverseRowScale == rowScale + numberRows); assert (inverseColumnScale == columnScale + numberColumns); // we are going to mark bits we are interested in char * usefulRow = new char [numberRows]; char * usefulColumn = new char [numberColumns]; double * rowLower = model->rowLower(); double * rowUpper = model->rowUpper(); double * columnLower = model->columnLower(); double * columnUpper = model->columnUpper(); int iColumn, iRow; //#define LEAVE_FIXED // mark free rows for (iRow = 0; iRow < numberRows; iRow++) { #if 0 //ndef LEAVE_FIXED if (rowUpper[iRow] < 1.0e20 || rowLower[iRow] > -1.0e20) usefulRow[iRow] = 1; else usefulRow[iRow] = 0; #else usefulRow[iRow] = 1; #endif } // mark empty and fixed columns // also see if worth scaling assert (model->scalingFlag() <= 4); // scale_stats[model->scalingFlag()]++; double largest = 0.0; double smallest = 1.0e50; // get matrix data pointers int * row = matrix_->getMutableIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); int * columnLength = matrix_->getMutableVectorLengths(); double * elementByColumn = matrix_->getMutableElements(); bool deletedElements = false; for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; char useful = 0; bool deleteSome = false; int start = columnStart[iColumn]; int end = start + columnLength[iColumn]; #ifndef LEAVE_FIXED if (columnUpper[iColumn] > columnLower[iColumn] + 1.0e-12) { #endif for (j = start; j < end; j++) { iRow = row[j]; double value = fabs(elementByColumn[j]); if (value > 1.0e-20) { if(usefulRow[iRow]) { useful = 1; largest = CoinMax(largest, fabs(elementByColumn[j])); smallest = CoinMin(smallest, fabs(elementByColumn[j])); } } else { // small deleteSome = true; } } #ifndef LEAVE_FIXED } else { // just check values for (j = start; j < end; j++) { double value = fabs(elementByColumn[j]); if (value <= 1.0e-20) { // small deleteSome = true; } } } #endif usefulColumn[iColumn] = useful; if (deleteSome) { deletedElements = true; CoinBigIndex put = start; for (j = start; j < end; j++) { double value = elementByColumn[j]; if (fabs(value) > 1.0e-20) { row[put] = row[j]; elementByColumn[put++] = value; } } columnLength[iColumn] = put - start; } } model->messageHandler()->message(CLP_PACKEDSCALE_INITIAL, *model->messagesPointer()) << smallest << largest << CoinMessageEol; if (smallest >= 0.5 && largest <= 2.0 && !deletedElements) { // don't bother scaling model->messageHandler()->message(CLP_PACKEDSCALE_FORGET, *model->messagesPointer()) << CoinMessageEol; if (!arraysExist) { delete [] rowScale; delete [] columnScale; } else { model->setRowScale(NULL); model->setColumnScale(NULL); } delete [] usefulRow; delete [] usefulColumn; return 1; } else { #ifdef CLP_INVESTIGATE if (deletedElements) printf("DEL_ELS\n"); #endif if (!rowCopyBase) { // temporary copy rowCopyBase = reverseOrderedCopy(); } else if (deletedElements) { rowCopyBase = reverseOrderedCopy(); model->setNewRowCopy(rowCopyBase); } #ifndef NDEBUG ClpPackedMatrix* rowCopy = dynamic_cast< ClpPackedMatrix*>(rowCopyBase); // Make sure it is really a ClpPackedMatrix assert (rowCopy != NULL); #else ClpPackedMatrix* rowCopy = static_cast< ClpPackedMatrix*>(rowCopyBase); #endif const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const double * element = rowCopy->getElements(); // need to scale if (largest > 1.0e13 * smallest) { // safer to have smaller zero tolerance double ratio = smallest / largest; ClpSimplex * simplex = static_cast (model); double newTolerance = CoinMax(ratio * 0.5, 1.0e-18); if (simplex->zeroTolerance() > newTolerance) simplex->setZeroTolerance(newTolerance); } int scalingMethod = model->scalingFlag(); if (scalingMethod == 4) { // As auto scalingMethod = 3; } // and see if there any empty rows for (iRow = 0; iRow < numberRows; iRow++) { if (usefulRow[iRow]) { CoinBigIndex j; int useful = 0; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { useful = 1; break; } } usefulRow[iRow] = static_cast(useful); } } double savedOverallRatio = 0.0; double tolerance = 5.0 * model->primalTolerance(); double overallLargest = -1.0e-20; double overallSmallest = 1.0e20; bool finished = false; // if scalingMethod 3 then may change bool extraDetails = (model->logLevel() > 2); while (!finished) { int numberPass = 3; overallLargest = -1.0e-20; overallSmallest = 1.0e20; if (!baseModel) { ClpFillN ( rowScale, numberRows, 1.0); ClpFillN ( columnScale, numberColumns, 1.0); } else { // Copy scales and do quick scale on extra rows // Then just one? pass assert (numberColumns == baseModel->numberColumns()); int numberRows2 = baseModel->numberRows(); assert (numberRows >= numberRows2); assert (baseModel->rowScale()); CoinMemcpyN(baseModel->rowScale(), numberRows2, rowScale); CoinMemcpyN(baseModel->columnScale(), numberColumns, columnScale); if (numberRows > numberRows2) { numberPass = 1; // do some scaling if (scalingMethod == 1 || scalingMethod == 3) { // Maximum in each row for (iRow = numberRows2; iRow < numberRows; iRow++) { if (usefulRow[iRow]) { CoinBigIndex j; largest = 1.0e-10; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { double value = fabs(element[j] * columnScale[iColumn]); largest = CoinMax(largest, value); assert (largest < 1.0e40); } } rowScale[iRow] = 1.0 / largest; #ifdef COIN_DEVELOP if (extraDetails) { overallLargest = CoinMax(overallLargest, largest); overallSmallest = CoinMin(overallSmallest, largest); } #endif } } } else { overallLargest = 0.0; overallSmallest = 1.0e50; // Geometric mean on row scales for (iRow = 0; iRow < numberRows; iRow++) { if (usefulRow[iRow]) { CoinBigIndex j; largest = 1.0e-20; smallest = 1.0e50; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { double value = fabs(element[j]); value *= columnScale[iColumn]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } if (iRow >= numberRows2) { rowScale[iRow] = 1.0 / sqrt(smallest * largest); //rowScale[iRow]=CoinMax(1.0e-10,CoinMin(1.0e10,rowScale[iRow])); } #ifdef COIN_DEVELOP if (extraDetails) { overallLargest = CoinMax(largest * rowScale[iRow], overallLargest); overallSmallest = CoinMin(smallest * rowScale[iRow], overallSmallest); } #endif } } } } else { // just use numberPass = 0; } } if (!baseModel && (scalingMethod == 1 || scalingMethod == 3)) { // Maximum in each row for (iRow = 0; iRow < numberRows; iRow++) { if (usefulRow[iRow]) { CoinBigIndex j; largest = 1.0e-10; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { double value = fabs(element[j]); largest = CoinMax(largest, value); assert (largest < 1.0e40); } } rowScale[iRow] = 1.0 / largest; #ifdef COIN_DEVELOP if (extraDetails) { overallLargest = CoinMax(overallLargest, largest); overallSmallest = CoinMin(overallSmallest, largest); } #endif } } } else { #ifdef USE_OBJECTIVE // This will be used to help get scale factors double * objective = new double[numberColumns]; CoinMemcpyN(model->costRegion(1), numberColumns, objective); double objScale = 1.0; #endif while (numberPass) { overallLargest = 0.0; overallSmallest = 1.0e50; numberPass--; // Geometric mean on row scales for (iRow = 0; iRow < numberRows; iRow++) { if (usefulRow[iRow]) { CoinBigIndex j; largest = 1.0e-20; smallest = 1.0e50; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { double value = fabs(element[j]); value *= columnScale[iColumn]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } rowScale[iRow] = 1.0 / sqrt(smallest * largest); //rowScale[iRow]=CoinMax(1.0e-10,CoinMin(1.0e10,rowScale[iRow])); if (extraDetails) { overallLargest = CoinMax(largest * rowScale[iRow], overallLargest); overallSmallest = CoinMin(smallest * rowScale[iRow], overallSmallest); } } } #ifdef USE_OBJECTIVE largest = 1.0e-20; smallest = 1.0e50; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { double value = fabs(objective[iColumn]); value *= columnScale[iColumn]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } objScale = 1.0 / sqrt(smallest * largest); #endif model->messageHandler()->message(CLP_PACKEDSCALE_WHILE, *model->messagesPointer()) << overallSmallest << overallLargest << CoinMessageEol; // skip last column round if (numberPass == 1) break; // Geometric mean on column scales for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { CoinBigIndex j; largest = 1.0e-20; smallest = 1.0e50; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { iRow = row[j]; double value = fabs(elementByColumn[j]); if (usefulRow[iRow]) { value *= rowScale[iRow]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } #ifdef USE_OBJECTIVE if (fabs(objective[iColumn]) > 1.0e-20) { double value = fabs(objective[iColumn]) * objScale; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } #endif columnScale[iColumn] = 1.0 / sqrt(smallest * largest); //columnScale[iColumn]=CoinMax(1.0e-10,CoinMin(1.0e10,columnScale[iColumn])); } } } #ifdef USE_OBJECTIVE delete [] objective; printf("obj scale %g - use it if you want\n", objScale); #endif } // If ranges will make horrid then scale for (iRow = 0; iRow < numberRows; iRow++) { if (usefulRow[iRow]) { double difference = rowUpper[iRow] - rowLower[iRow]; double scaledDifference = difference * rowScale[iRow]; if (scaledDifference > tolerance && scaledDifference < 1.0e-4) { // make gap larger rowScale[iRow] *= 1.0e-4 / scaledDifference; rowScale[iRow] = CoinMax(1.0e-10, CoinMin(1.0e10, rowScale[iRow])); //printf("Row %d difference %g scaled diff %g => %g\n",iRow,difference, // scaledDifference,difference*rowScale[iRow]); } } } // final pass to scale columns so largest is reasonable // See what smallest will be if largest is 1.0 overallSmallest = 1.0e50; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { CoinBigIndex j; largest = 1.0e-20; smallest = 1.0e50; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { iRow = row[j]; if(elementByColumn[j] && usefulRow[iRow]) { double value = fabs(elementByColumn[j] * rowScale[iRow]); largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } if (overallSmallest * largest > smallest) overallSmallest = smallest / largest; } } if (scalingMethod == 1 || scalingMethod == 2) { finished = true; } else if (savedOverallRatio == 0.0 && scalingMethod != 4) { savedOverallRatio = overallSmallest; scalingMethod = 4; } else { assert (scalingMethod == 4); if (overallSmallest > 2.0 * savedOverallRatio) { finished = true; // geometric was better if (model->scalingFlag() == 4) { // If in Branch and bound change if ((model->specialOptions() & 1024) != 0) { model->scaling(2); } } } else { scalingMethod = 1; // redo equilibrium if (model->scalingFlag() == 4) { // If in Branch and bound change if ((model->specialOptions() & 1024) != 0) { model->scaling(1); } } } #if 0 if (extraDetails) { if (finished) printf("equilibrium ratio %g, geometric ratio %g , geo chosen\n", savedOverallRatio, overallSmallest); else printf("equilibrium ratio %g, geometric ratio %g , equi chosen\n", savedOverallRatio, overallSmallest); } #endif } } //#define RANDOMIZE #ifdef RANDOMIZE // randomize by up to 10% for (iRow = 0; iRow < numberRows; iRow++) { double value = 0.5 - randomNumberGenerator_.randomDouble(); //between -0.5 to + 0.5 rowScale[iRow] *= (1.0 + 0.1 * value); } #endif overallLargest = 1.0; if (overallSmallest < 1.0e-1) overallLargest = 1.0 / sqrt(overallSmallest); overallLargest = CoinMin(100.0, overallLargest); overallSmallest = 1.0e50; //printf("scaling %d\n",model->scalingFlag()); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn] + 1.0e-12) { //if (usefulColumn[iColumn]) { CoinBigIndex j; largest = 1.0e-20; smallest = 1.0e50; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { iRow = row[j]; if(elementByColumn[j] && usefulRow[iRow]) { double value = fabs(elementByColumn[j] * rowScale[iRow]); largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } columnScale[iColumn] = overallLargest / largest; //columnScale[iColumn]=CoinMax(1.0e-10,CoinMin(1.0e10,columnScale[iColumn])); #ifdef RANDOMIZE double value = 0.5 - randomNumberGenerator_.randomDouble(); //between -0.5 to + 0.5 columnScale[iColumn] *= (1.0 + 0.1 * value); #endif double difference = columnUpper[iColumn] - columnLower[iColumn]; if (difference < 1.0e-5 * columnScale[iColumn]) { // make gap larger columnScale[iColumn] = difference / 1.0e-5; //printf("Column %d difference %g scaled diff %g => %g\n",iColumn,difference, // scaledDifference,difference*columnScale[iColumn]); } double value = smallest * columnScale[iColumn]; if (overallSmallest > value) overallSmallest = value; //overallSmallest = CoinMin(overallSmallest,smallest*columnScale[iColumn]); } } model->messageHandler()->message(CLP_PACKEDSCALE_FINAL, *model->messagesPointer()) << overallSmallest << overallLargest << CoinMessageEol; if (overallSmallest < 1.0e-13) { // Change factorization zero tolerance double newTolerance = CoinMax(1.0e-15 * (overallSmallest / 1.0e-13), 1.0e-18); ClpSimplex * simplex = static_cast (model); if (simplex->factorization()->zeroTolerance() > newTolerance) simplex->factorization()->zeroTolerance(newTolerance); newTolerance = CoinMax(overallSmallest * 0.5, 1.0e-18); simplex->setZeroTolerance(newTolerance); } delete [] usefulRow; delete [] usefulColumn; #ifndef SLIM_CLP // If quadratic then make symmetric ClpObjective * obj = model->objectiveAsObject(); #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(obj)); #else ClpQuadraticObjective * quadraticObj = NULL; if (obj->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(obj)); #endif if (quadraticObj) { if (!rowCopyBase) { // temporary copy rowCopyBase = reverseOrderedCopy(); } #ifndef NDEBUG ClpPackedMatrix* rowCopy = dynamic_cast< ClpPackedMatrix*>(rowCopyBase); // Make sure it is really a ClpPackedMatrix assert (rowCopy != NULL); #else ClpPackedMatrix* rowCopy = static_cast< ClpPackedMatrix*>(rowCopyBase); #endif const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); int numberXColumns = quadratic->getNumCols(); if (numberXColumns < numberColumns) { // we assume symmetric int numberQuadraticColumns = 0; int i; //const int * columnQuadratic = quadratic->getIndices(); //const int * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); for (i = 0; i < numberXColumns; i++) { int length = columnQuadraticLength[i]; #ifndef CORRECT_COLUMN_COUNTS length = 1; #endif if (length) numberQuadraticColumns++; } int numberXRows = numberRows - numberQuadraticColumns; numberQuadraticColumns = 0; for (i = 0; i < numberXColumns; i++) { int length = columnQuadraticLength[i]; #ifndef CORRECT_COLUMN_COUNTS length = 1; #endif if (length) { rowScale[numberQuadraticColumns+numberXRows] = columnScale[i]; numberQuadraticColumns++; } } int numberQuadraticRows = 0; for (i = 0; i < numberXRows; i++) { // See if any in row quadratic CoinBigIndex j; int numberQ = 0; for (j = rowStart[i]; j < rowStart[i+1]; j++) { int iColumn = column[j]; if (columnQuadraticLength[iColumn]) numberQ++; } #ifndef CORRECT_ROW_COUNTS numberQ = 1; #endif if (numberQ) { columnScale[numberQuadraticRows+numberXColumns] = rowScale[i]; numberQuadraticRows++; } } // and make sure Sj okay for (iColumn = numberQuadraticRows + numberXColumns; iColumn < numberColumns; iColumn++) { CoinBigIndex j = columnStart[iColumn]; assert(columnLength[iColumn] == 1); int iRow = row[j]; double value = fabs(elementByColumn[j] * rowScale[iRow]); columnScale[iColumn] = 1.0 / value; } } } #endif // make copy (could do faster by using previous values) // could just do partial for (iRow = 0; iRow < numberRows; iRow++) inverseRowScale[iRow] = 1.0 / rowScale[iRow] ; for (iColumn = 0; iColumn < numberColumns; iColumn++) inverseColumnScale[iColumn] = 1.0 / columnScale[iColumn] ; if (!arraysExist) { model->setRowScale(rowScale); model->setColumnScale(columnScale); } if (model->rowCopy()) { // need to replace row by row ClpPackedMatrix* rowCopy = static_cast< ClpPackedMatrix*>(model->rowCopy()); double * element = rowCopy->getMutableElements(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); // scale row copy for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex j; double scale = rowScale[iRow]; double * elementsInThisRow = element + rowStart[iRow]; const int * columnsInThisRow = column + rowStart[iRow]; int number = rowStart[iRow+1] - rowStart[iRow]; assert (number <= numberColumns); for (j = 0; j < number; j++) { int iColumn = columnsInThisRow[j]; elementsInThisRow[j] *= scale * columnScale[iColumn]; } } if ((model->specialOptions() & 262144) != 0) { //if ((model->specialOptions()&(COIN_CBC_USING_CLP|16384))!=0) { //if (model->inCbcBranchAndBound()&&false) { // copy without gaps CoinPackedMatrix * scaledMatrix = new CoinPackedMatrix(*matrix_, 0, 0); ClpPackedMatrix * scaled = new ClpPackedMatrix(scaledMatrix); model->setClpScaledMatrix(scaled); // get matrix data pointers const int * row = scaledMatrix->getIndices(); const CoinBigIndex * columnStart = scaledMatrix->getVectorStarts(); #ifndef NDEBUG const int * columnLength = scaledMatrix->getVectorLengths(); #endif double * elementByColumn = scaledMatrix->getMutableElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double scale = columnScale[iColumn]; assert (columnStart[iColumn+1] == columnStart[iColumn] + columnLength[iColumn]); for (j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; elementByColumn[j] *= scale * rowScale[iRow]; } } } else { //printf("not in b&b\n"); } } else { // no row copy delete rowCopyBase; } return 0; } } #endif //#define SQRT_ARRAY #ifdef SQRT_ARRAY static void doSqrts(double * array, int n) { for (int i = 0; i < n; i++) array[i] = 1.0 / sqrt(array[i]); } #endif //static int scale_stats[5]={0,0,0,0,0}; // Creates scales for column copy (rowCopy in model may be modified) int ClpPackedMatrix::scale(ClpModel * model, const ClpSimplex * /*baseModel*/) const { //const ClpSimplex * baseModel=NULL; //return scale2(model); #if 0 ClpMatrixBase * rowClone = NULL; if (model->rowCopy()) rowClone = model->rowCopy()->clone(); assert (!model->rowScale()); assert (!model->columnScale()); int returnCode = scale2(model); if (returnCode) return returnCode; #endif #ifndef NDEBUG //checkFlags(); #endif int numberRows = model->numberRows(); int numberColumns = matrix_->getNumCols(); model->setClpScaledMatrix(NULL); // get rid of any scaled matrix // If empty - return as sanityCheck will trap if (!numberRows || !numberColumns) { model->setRowScale(NULL); model->setColumnScale(NULL); return 1; } #if 0 // start fake double * rowScale2 = CoinCopyOfArray(model->rowScale(), numberRows); double * columnScale2 = CoinCopyOfArray(model->columnScale(), numberColumns); model->setRowScale(NULL); model->setColumnScale(NULL); model->setNewRowCopy(rowClone); #endif ClpMatrixBase * rowCopyBase = model->rowCopy(); double * COIN_RESTRICT rowScale; double * COIN_RESTRICT columnScale; //assert (!model->rowScale()); bool arraysExist; double * COIN_RESTRICT inverseRowScale = NULL; double * COIN_RESTRICT inverseColumnScale = NULL; if (!model->rowScale()) { rowScale = new double [numberRows*2]; columnScale = new double [numberColumns*2]; inverseRowScale = rowScale + numberRows; inverseColumnScale = columnScale + numberColumns; arraysExist = false; } else { rowScale = model->mutableRowScale(); columnScale = model->mutableColumnScale(); inverseRowScale = model->mutableInverseRowScale(); inverseColumnScale = model->mutableInverseColumnScale(); arraysExist = true; } assert (inverseRowScale == rowScale + numberRows); assert (inverseColumnScale == columnScale + numberColumns); // we are going to mark bits we are interested in char * COIN_RESTRICT usefulColumn = new char [numberColumns]; double * COIN_RESTRICT rowLower = model->rowLower(); double * COIN_RESTRICT rowUpper = model->rowUpper(); double * COIN_RESTRICT columnLower = model->columnLower(); double * COIN_RESTRICT columnUpper = model->columnUpper(); int iColumn, iRow; //#define LEAVE_FIXED // mark empty and fixed columns // also see if worth scaling assert (model->scalingFlag() <= 5); // scale_stats[model->scalingFlag()]++; double largest = 0.0; double smallest = 1.0e50; // get matrix data pointers int * COIN_RESTRICT row = matrix_->getMutableIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); int * COIN_RESTRICT columnLength = matrix_->getMutableVectorLengths(); double * COIN_RESTRICT elementByColumn = matrix_->getMutableElements(); int deletedElements = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; char useful = 0; bool deleteSome = false; int start = columnStart[iColumn]; int end = start + columnLength[iColumn]; #ifndef LEAVE_FIXED if (columnUpper[iColumn] > columnLower[iColumn] + 1.0e-12) { #endif for (j = start; j < end; j++) { iRow = row[j]; double value = fabs(elementByColumn[j]); if (value > 1.0e-20) { useful = 1; largest = CoinMax(largest, fabs(elementByColumn[j])); smallest = CoinMin(smallest, fabs(elementByColumn[j])); } else { // small deleteSome = true; } } #ifndef LEAVE_FIXED } else { // just check values for (j = start; j < end; j++) { double value = fabs(elementByColumn[j]); if (value <= 1.0e-20) { // small deleteSome = true; } } } #endif usefulColumn[iColumn] = useful; if (deleteSome) { CoinBigIndex put = start; for (j = start; j < end; j++) { double value = elementByColumn[j]; if (fabs(value) > 1.0e-20) { row[put] = row[j]; elementByColumn[put++] = value; } } deletedElements += end - put; columnLength[iColumn] = put - start; } } // don't scale integers if option set if ((model->specialOptions()&4194304)!=0 && model->integerInformation()) { const char * COIN_RESTRICT integer = model->integerInformation(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (integer[iColumn]) usefulColumn[iColumn]=0; } } if (deletedElements) { matrix_->setNumElements(matrix_->getNumElements()-deletedElements); flags_ |= 0x02 ; } model->messageHandler()->message(CLP_PACKEDSCALE_INITIAL, *model->messagesPointer()) << smallest << largest << CoinMessageEol; if (smallest >= 0.5 && largest <= 2.0 && !deletedElements) { // don't bother scaling model->messageHandler()->message(CLP_PACKEDSCALE_FORGET, *model->messagesPointer()) << CoinMessageEol; if (!arraysExist) { delete [] rowScale; delete [] columnScale; } else { model->setRowScale(NULL); model->setColumnScale(NULL); } delete [] usefulColumn; return 1; } else { #ifdef CLP_INVESTIGATE if (deletedElements) printf("DEL_ELS\n"); #endif if (!rowCopyBase) { // temporary copy rowCopyBase = reverseOrderedCopy(); } else if (deletedElements) { rowCopyBase = reverseOrderedCopy(); model->setNewRowCopy(rowCopyBase); } #ifndef NDEBUG ClpPackedMatrix* rowCopy = dynamic_cast< ClpPackedMatrix*>(rowCopyBase); // Make sure it is really a ClpPackedMatrix assert (rowCopy != NULL); #else ClpPackedMatrix* rowCopy = static_cast< ClpPackedMatrix*>(rowCopyBase); #endif const int * COIN_RESTRICT column = rowCopy->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = rowCopy->getVectorStarts(); const double * COIN_RESTRICT element = rowCopy->getElements(); // need to scale if (largest > 1.0e13 * smallest) { // safer to have smaller zero tolerance double ratio = smallest / largest; ClpSimplex * simplex = static_cast (model); double newTolerance = CoinMax(ratio * 0.5, 1.0e-18); if (simplex->zeroTolerance() > newTolerance) simplex->setZeroTolerance(newTolerance); } int scalingMethod = model->scalingFlag(); if (scalingMethod == 4) { // As auto scalingMethod = 3; } else if (scalingMethod == 5) { // As geometric scalingMethod = 2; } double savedOverallRatio = 0.0; double tolerance = 5.0 * model->primalTolerance(); double overallLargest = -1.0e-20; double overallSmallest = 1.0e20; bool finished = false; // if scalingMethod 3 then may change bool extraDetails = (model->logLevel() > 2); #if 0 for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn] + 1.0e-12 && columnLength[iColumn]) assert(usefulColumn[iColumn]!=0); else assert(usefulColumn[iColumn]==0); } #endif while (!finished) { int numberPass = 3; overallLargest = -1.0e-20; overallSmallest = 1.0e20; ClpFillN ( rowScale, numberRows, 1.0); ClpFillN ( columnScale, numberColumns, 1.0); if (scalingMethod == 1 || scalingMethod == 3) { // Maximum in each row for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex j; largest = 1.0e-10; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { double value = fabs(element[j]); largest = CoinMax(largest, value); assert (largest < 1.0e40); } } rowScale[iRow] = 1.0 / largest; #ifdef COIN_DEVELOP if (extraDetails) { overallLargest = CoinMax(overallLargest, largest); overallSmallest = CoinMin(overallSmallest, largest); } #endif } } else { #ifdef USE_OBJECTIVE // This will be used to help get scale factors double * COIN_RESTRICT objective = new double[numberColumns]; CoinMemcpyN(model->costRegion(1), numberColumns, objective); double objScale = 1.0; #endif while (numberPass) { overallLargest = 0.0; overallSmallest = 1.0e50; numberPass--; // Geometric mean on row scales for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex j; largest = 1.0e-50; smallest = 1.0e50; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { double value = fabs(element[j]); value *= columnScale[iColumn]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } #ifdef SQRT_ARRAY rowScale[iRow] = smallest * largest; #else rowScale[iRow] = 1.0 / sqrt(smallest * largest); #endif //rowScale[iRow]=CoinMax(1.0e-10,CoinMin(1.0e10,rowScale[iRow])); if (extraDetails) { overallLargest = CoinMax(largest * rowScale[iRow], overallLargest); overallSmallest = CoinMin(smallest * rowScale[iRow], overallSmallest); } } if (model->scalingFlag() == 5) break; // just scale rows #ifdef SQRT_ARRAY doSqrts(rowScale, numberRows); #endif #ifdef USE_OBJECTIVE largest = 1.0e-20; smallest = 1.0e50; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { double value = fabs(objective[iColumn]); value *= columnScale[iColumn]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } objScale = 1.0 / sqrt(smallest * largest); #endif model->messageHandler()->message(CLP_PACKEDSCALE_WHILE, *model->messagesPointer()) << overallSmallest << overallLargest << CoinMessageEol; // skip last column round if (numberPass == 1) break; // Geometric mean on column scales for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { CoinBigIndex j; largest = 1.0e-50; smallest = 1.0e50; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { iRow = row[j]; double value = fabs(elementByColumn[j]); value *= rowScale[iRow]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } #ifdef USE_OBJECTIVE if (fabs(objective[iColumn]) > 1.0e-20) { double value = fabs(objective[iColumn]) * objScale; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } #endif #ifdef SQRT_ARRAY columnScale[iColumn] = smallest * largest; #else columnScale[iColumn] = 1.0 / sqrt(smallest * largest); #endif //columnScale[iColumn]=CoinMax(1.0e-10,CoinMin(1.0e10,columnScale[iColumn])); } } #ifdef SQRT_ARRAY doSqrts(columnScale, numberColumns); #endif } #ifdef USE_OBJECTIVE delete [] objective; printf("obj scale %g - use it if you want\n", objScale); #endif } // If ranges will make horrid then scale for (iRow = 0; iRow < numberRows; iRow++) { double difference = rowUpper[iRow] - rowLower[iRow]; double scaledDifference = difference * rowScale[iRow]; if (scaledDifference > tolerance && scaledDifference < 1.0e-4) { // make gap larger rowScale[iRow] *= 1.0e-4 / scaledDifference; rowScale[iRow] = CoinMax(1.0e-10, CoinMin(1.0e10, rowScale[iRow])); //printf("Row %d difference %g scaled diff %g => %g\n",iRow,difference, // scaledDifference,difference*rowScale[iRow]); } } // final pass to scale columns so largest is reasonable // See what smallest will be if largest is 1.0 if (model->scalingFlag() != 5) { overallSmallest = 1.0e50; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { CoinBigIndex j; largest = 1.0e-20; smallest = 1.0e50; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { iRow = row[j]; double value = fabs(elementByColumn[j] * rowScale[iRow]); largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } if (overallSmallest * largest > smallest) overallSmallest = smallest / largest; } } } if (scalingMethod == 1 || scalingMethod == 2) { finished = true; } else if (savedOverallRatio == 0.0 && scalingMethod != 4) { savedOverallRatio = overallSmallest; scalingMethod = 4; } else { assert (scalingMethod == 4); if (overallSmallest > 2.0 * savedOverallRatio) { finished = true; // geometric was better if (model->scalingFlag() == 4) { // If in Branch and bound change if ((model->specialOptions() & 1024) != 0) { model->scaling(2); } } } else { scalingMethod = 1; // redo equilibrium if (model->scalingFlag() == 4) { // If in Branch and bound change if ((model->specialOptions() & 1024) != 0) { model->scaling(1); } } } #if 0 if (extraDetails) { if (finished) printf("equilibrium ratio %g, geometric ratio %g , geo chosen\n", savedOverallRatio, overallSmallest); else printf("equilibrium ratio %g, geometric ratio %g , equi chosen\n", savedOverallRatio, overallSmallest); } #endif } } //#define RANDOMIZE #ifdef RANDOMIZE // randomize by up to 10% for (iRow = 0; iRow < numberRows; iRow++) { double value = 0.5 - randomNumberGenerator_.randomDouble(); //between -0.5 to + 0.5 rowScale[iRow] *= (1.0 + 0.1 * value); } #endif overallLargest = 1.0; if (overallSmallest < 1.0e-1) overallLargest = 1.0 / sqrt(overallSmallest); overallLargest = CoinMin(100.0, overallLargest); overallSmallest = 1.0e50; char * usedRow = reinterpret_cast(inverseRowScale); memset(usedRow, 0, numberRows); //printf("scaling %d\n",model->scalingFlag()); if (model->scalingFlag() != 5) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn] + 1.0e-12) { //if (usefulColumn[iColumn]) { CoinBigIndex j; largest = 1.0e-20; smallest = 1.0e50; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { iRow = row[j]; usedRow[iRow] = 1; double value = fabs(elementByColumn[j] * rowScale[iRow]); largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } columnScale[iColumn] = overallLargest / largest; //columnScale[iColumn]=CoinMax(1.0e-10,CoinMin(1.0e10,columnScale[iColumn])); #ifdef RANDOMIZE double value = 0.5 - randomNumberGenerator_.randomDouble(); //between -0.5 to + 0.5 columnScale[iColumn] *= (1.0 + 0.1 * value); #endif double difference = columnUpper[iColumn] - columnLower[iColumn]; if (difference < 1.0e-5 * columnScale[iColumn]) { // make gap larger columnScale[iColumn] = difference / 1.0e-5; //printf("Column %d difference %g scaled diff %g => %g\n",iColumn,difference, // scaledDifference,difference*columnScale[iColumn]); } double value = smallest * columnScale[iColumn]; if (overallSmallest > value) overallSmallest = value; //overallSmallest = CoinMin(overallSmallest,smallest*columnScale[iColumn]); } else { assert(columnScale[iColumn] == 1.0); //columnScale[iColumn]=1.0; } } for (iRow = 0; iRow < numberRows; iRow++) { if (!usedRow[iRow]) { rowScale[iRow] = 1.0; } } } model->messageHandler()->message(CLP_PACKEDSCALE_FINAL, *model->messagesPointer()) << overallSmallest << overallLargest << CoinMessageEol; #if 0 { for (iRow = 0; iRow < numberRows; iRow++) { assert (rowScale[iRow] == rowScale2[iRow]); } delete [] rowScale2; for (iColumn = 0; iColumn < numberColumns; iColumn++) { assert (columnScale[iColumn] == columnScale2[iColumn]); } delete [] columnScale2; } #endif if (overallSmallest < 1.0e-13) { // Change factorization zero tolerance double newTolerance = CoinMax(1.0e-15 * (overallSmallest / 1.0e-13), 1.0e-18); ClpSimplex * simplex = static_cast (model); if (simplex->factorization()->zeroTolerance() > newTolerance) simplex->factorization()->zeroTolerance(newTolerance); newTolerance = CoinMax(overallSmallest * 0.5, 1.0e-18); simplex->setZeroTolerance(newTolerance); } delete [] usefulColumn; #ifndef SLIM_CLP // If quadratic then make symmetric ClpObjective * obj = model->objectiveAsObject(); #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(obj)); #else ClpQuadraticObjective * quadraticObj = NULL; if (obj->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(obj)); #endif if (quadraticObj) { if (!rowCopyBase) { // temporary copy rowCopyBase = reverseOrderedCopy(); } #ifndef NDEBUG ClpPackedMatrix* rowCopy = dynamic_cast< ClpPackedMatrix*>(rowCopyBase); // Make sure it is really a ClpPackedMatrix assert (rowCopy != NULL); #else ClpPackedMatrix* rowCopy = static_cast< ClpPackedMatrix*>(rowCopyBase); #endif const int * COIN_RESTRICT column = rowCopy->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = rowCopy->getVectorStarts(); CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); int numberXColumns = quadratic->getNumCols(); if (numberXColumns < numberColumns) { // we assume symmetric int numberQuadraticColumns = 0; int i; //const int * columnQuadratic = quadratic->getIndices(); //const int * columnQuadraticStart = quadratic->getVectorStarts(); const int * COIN_RESTRICT columnQuadraticLength = quadratic->getVectorLengths(); for (i = 0; i < numberXColumns; i++) { int length = columnQuadraticLength[i]; #ifndef CORRECT_COLUMN_COUNTS length = 1; #endif if (length) numberQuadraticColumns++; } int numberXRows = numberRows - numberQuadraticColumns; numberQuadraticColumns = 0; for (i = 0; i < numberXColumns; i++) { int length = columnQuadraticLength[i]; #ifndef CORRECT_COLUMN_COUNTS length = 1; #endif if (length) { rowScale[numberQuadraticColumns+numberXRows] = columnScale[i]; numberQuadraticColumns++; } } int numberQuadraticRows = 0; for (i = 0; i < numberXRows; i++) { // See if any in row quadratic CoinBigIndex j; int numberQ = 0; for (j = rowStart[i]; j < rowStart[i+1]; j++) { int iColumn = column[j]; if (columnQuadraticLength[iColumn]) numberQ++; } #ifndef CORRECT_ROW_COUNTS numberQ = 1; #endif if (numberQ) { columnScale[numberQuadraticRows+numberXColumns] = rowScale[i]; numberQuadraticRows++; } } // and make sure Sj okay for (iColumn = numberQuadraticRows + numberXColumns; iColumn < numberColumns; iColumn++) { CoinBigIndex j = columnStart[iColumn]; assert(columnLength[iColumn] == 1); int iRow = row[j]; double value = fabs(elementByColumn[j] * rowScale[iRow]); columnScale[iColumn] = 1.0 / value; } } } #endif // make copy (could do faster by using previous values) // could just do partial for (iRow = 0; iRow < numberRows; iRow++) inverseRowScale[iRow] = 1.0 / rowScale[iRow] ; for (iColumn = 0; iColumn < numberColumns; iColumn++) inverseColumnScale[iColumn] = 1.0 / columnScale[iColumn] ; if (!arraysExist) { model->setRowScale(rowScale); model->setColumnScale(columnScale); } if (model->rowCopy()) { // need to replace row by row ClpPackedMatrix* rowCopy = static_cast< ClpPackedMatrix*>(model->rowCopy()); double * COIN_RESTRICT element = rowCopy->getMutableElements(); const int * COIN_RESTRICT column = rowCopy->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = rowCopy->getVectorStarts(); // scale row copy for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex j; double scale = rowScale[iRow]; double * COIN_RESTRICT elementsInThisRow = element + rowStart[iRow]; const int * COIN_RESTRICT columnsInThisRow = column + rowStart[iRow]; int number = rowStart[iRow+1] - rowStart[iRow]; assert (number <= numberColumns); for (j = 0; j < number; j++) { int iColumn = columnsInThisRow[j]; elementsInThisRow[j] *= scale * columnScale[iColumn]; } } if ((model->specialOptions() & 262144) != 0) { //if ((model->specialOptions()&(COIN_CBC_USING_CLP|16384))!=0) { //if (model->inCbcBranchAndBound()&&false) { // copy without gaps CoinPackedMatrix * scaledMatrix = new CoinPackedMatrix(*matrix_, 0, 0); ClpPackedMatrix * scaled = new ClpPackedMatrix(scaledMatrix); model->setClpScaledMatrix(scaled); // get matrix data pointers const int * COIN_RESTRICT row = scaledMatrix->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = scaledMatrix->getVectorStarts(); #ifndef NDEBUG const int * COIN_RESTRICT columnLength = scaledMatrix->getVectorLengths(); #endif double * COIN_RESTRICT elementByColumn = scaledMatrix->getMutableElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double scale = columnScale[iColumn]; assert (columnStart[iColumn+1] == columnStart[iColumn] + columnLength[iColumn]); for (j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; elementByColumn[j] *= scale * rowScale[iRow]; } } } else { //printf("not in b&b\n"); } } else { // no row copy delete rowCopyBase; } return 0; } } // Creates scaled column copy if scales exist void ClpPackedMatrix::createScaledMatrix(ClpSimplex * model) const { int numberRows = model->numberRows(); int numberColumns = matrix_->getNumCols(); model->setClpScaledMatrix(NULL); // get rid of any scaled matrix // If empty - return as sanityCheck will trap if (!numberRows || !numberColumns) { model->setRowScale(NULL); model->setColumnScale(NULL); return ; } if (!model->rowScale()) return; double * COIN_RESTRICT rowScale = model->mutableRowScale(); double * COIN_RESTRICT columnScale = model->mutableColumnScale(); // copy without gaps CoinPackedMatrix * scaledMatrix = new CoinPackedMatrix(*matrix_, 0, 0); ClpPackedMatrix * scaled = new ClpPackedMatrix(scaledMatrix); model->setClpScaledMatrix(scaled); // get matrix data pointers const int * COIN_RESTRICT row = scaledMatrix->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = scaledMatrix->getVectorStarts(); #ifndef NDEBUG const int * COIN_RESTRICT columnLength = scaledMatrix->getVectorLengths(); #endif double * COIN_RESTRICT elementByColumn = scaledMatrix->getMutableElements(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double scale = columnScale[iColumn]; assert (columnStart[iColumn+1] == columnStart[iColumn] + columnLength[iColumn]); for (j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; elementByColumn[j] *= scale * rowScale[iRow]; } } #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } /* Unpacks a column into an CoinIndexedvector */ void ClpPackedMatrix::unpack(const ClpSimplex * model, CoinIndexedVector * rowArray, int iColumn) const { const double * COIN_RESTRICT rowScale = model->rowScale(); const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); CoinBigIndex i; if (!rowScale) { for (i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { rowArray->quickAdd(row[i], elementByColumn[i]); } } else { // apply scaling double scale = model->columnScale()[iColumn]; for (i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { int iRow = row[i]; rowArray->quickAdd(iRow, elementByColumn[i]*scale * rowScale[iRow]); } } } /* Unpacks a column into a CoinIndexedVector ** in packed format Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ void ClpPackedMatrix::unpackPacked(ClpSimplex * model, CoinIndexedVector * rowArray, int iColumn) const { const double * COIN_RESTRICT rowScale = model->rowScale(); const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); CoinBigIndex i; int * COIN_RESTRICT index = rowArray->getIndices(); double * COIN_RESTRICT array = rowArray->denseVector(); int number = 0; if (!rowScale) { for (i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { int iRow = row[i]; double value = elementByColumn[i]; if (value) { array[number] = value; index[number++] = iRow; } } rowArray->setNumElements(number); rowArray->setPackedMode(true); } else { // apply scaling double scale = model->columnScale()[iColumn]; for (i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { int iRow = row[i]; double value = elementByColumn[i] * scale * rowScale[iRow]; if (value) { array[number] = value; index[number++] = iRow; } } rowArray->setNumElements(number); rowArray->setPackedMode(true); } } /* Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ void ClpPackedMatrix::add(const ClpSimplex * model, CoinIndexedVector * rowArray, int iColumn, double multiplier) const { const double * COIN_RESTRICT rowScale = model->rowScale(); const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); CoinBigIndex i; if (!rowScale) { for (i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { int iRow = row[i]; rowArray->quickAdd(iRow, multiplier * elementByColumn[i]); } } else { // apply scaling double scale = model->columnScale()[iColumn] * multiplier; for (i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { int iRow = row[i]; rowArray->quickAdd(iRow, elementByColumn[i]*scale * rowScale[iRow]); } } } /* Adds multiple of a column into an array */ void ClpPackedMatrix::add(const ClpSimplex * model, double * COIN_RESTRICT array, int iColumn, double multiplier) const { const double * COIN_RESTRICT rowScale = model->rowScale(); const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); CoinBigIndex i; if (!rowScale) { for (i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { int iRow = row[i]; array[iRow] += multiplier * elementByColumn[i]; } } else { // apply scaling double scale = model->columnScale()[iColumn] * multiplier; for (i = columnStart[iColumn]; i < columnStart[iColumn] + columnLength[iColumn]; i++) { int iRow = row[i]; array[iRow] += elementByColumn[i] * scale * rowScale[iRow]; } } } /* Checks if all elements are in valid range. Can just return true if you are not paranoid. For Clp I will probably expect no zeros. Code can modify matrix to get rid of small elements. check bits (can be turned off to save time) : 1 - check if matrix has gaps 2 - check if zero elements 4 - check and compress duplicates 8 - report on large and small */ bool ClpPackedMatrix::allElementsInRange(ClpModel * model, double smallest, double largest, int check) { int iColumn; // make sure matrix correct size assert (matrix_->getNumRows() <= model->numberRows()); if (model->clpScaledMatrix()) assert (model->clpScaledMatrix()->getNumElements() == matrix_->getNumElements()); assert (matrix_->getNumRows() <= model->numberRows()); matrix_->setDimensions(model->numberRows(), model->numberColumns()); CoinBigIndex numberLarge = 0;; CoinBigIndex numberSmall = 0;; CoinBigIndex numberDuplicate = 0;; int firstBadColumn = -1; int firstBadRow = -1; double firstBadElement = 0.0; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); int numberRows = model->numberRows(); int numberColumns = matrix_->getNumCols(); // Say no gaps flags_ &= ~2; if (type_>=10) return true; // gub if (check == 14 || check == 10) { if (matrix_->getNumElements() < columnStart[numberColumns]) { // pack down! #if 0 matrix_->removeGaps(); #else checkGaps(); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif #endif #ifdef COIN_DEVELOP //printf("flags set to 2\n"); #endif } else if (numberColumns) { assert(columnStart[numberColumns] == columnStart[numberColumns-1] + columnLength[numberColumns-1]); } return true; } assert (check == 15 || check == 11); if (check == 15) { int * COIN_RESTRICT mark = new int [numberRows]; int i; for (i = 0; i < numberRows; i++) mark[i] = -1; for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; if (end != columnStart[iColumn+1]) flags_ |= 2; for (j = start; j < end; j++) { double value = fabs(elementByColumn[j]); int iRow = row[j]; if (iRow < 0 || iRow >= numberRows) { #ifndef COIN_BIG_INDEX printf("Out of range %d %d %d %g\n", iColumn, j, row[j], elementByColumn[j]); #elif COIN_BIG_INDEX==0 printf("Out of range %d %d %d %g\n", iColumn, j, row[j], elementByColumn[j]); #elif COIN_BIG_INDEX==1 printf("Out of range %d %ld %d %g\n", iColumn, j, row[j], elementByColumn[j]); #else printf("Out of range %d %lld %d %g\n", iColumn, j, row[j], elementByColumn[j]); #endif return false; } if (mark[iRow] == -1) { mark[iRow] = j; } else { // duplicate numberDuplicate++; } //printf("%d %d %d %g\n",iColumn,j,row[j],elementByColumn[j]); if (!value) flags_ |= 1; // there are zero elements if (value < smallest) { numberSmall++; } else if (!(value <= largest)) { numberLarge++; if (firstBadColumn < 0) { firstBadColumn = iColumn; firstBadRow = row[j]; firstBadElement = elementByColumn[j]; } } } //clear mark for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; mark[iRow] = -1; } } delete [] mark; } else { // just check for out of range - not for duplicates for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; if (end != columnStart[iColumn+1]) flags_ |= 2; for (j = start; j < end; j++) { double value = fabs(elementByColumn[j]); int iRow = row[j]; if (iRow < 0 || iRow >= numberRows) { #ifndef COIN_BIG_INDEX printf("Out of range %d %d %d %g\n", iColumn, j, row[j], elementByColumn[j]); #elif COIN_BIG_INDEX==0 printf("Out of range %d %d %d %g\n", iColumn, j, row[j], elementByColumn[j]); #elif COIN_BIG_INDEX==1 printf("Out of range %d %ld %d %g\n", iColumn, j, row[j], elementByColumn[j]); #else printf("Out of range %d %lld %d %g\n", iColumn, j, row[j], elementByColumn[j]); #endif return false; } if (!value) flags_ |= 1; // there are zero elements if (value < smallest) { numberSmall++; } else if (!(value <= largest)) { numberLarge++; if (firstBadColumn < 0) { firstBadColumn = iColumn; firstBadRow = iRow; firstBadElement = value; } } } } } if (numberLarge) { model->messageHandler()->message(CLP_BAD_MATRIX, model->messages()) << numberLarge << firstBadColumn << firstBadRow << firstBadElement << CoinMessageEol; return false; } if (numberSmall) model->messageHandler()->message(CLP_SMALLELEMENTS, model->messages()) << numberSmall << CoinMessageEol; if (numberDuplicate) model->messageHandler()->message(CLP_DUPLICATEELEMENTS, model->messages()) << numberDuplicate << CoinMessageEol; if (numberDuplicate) matrix_->eliminateDuplicates(smallest); else if (numberSmall) matrix_->compress(smallest); // If smallest >0.0 then there can't be zero elements if (smallest > 0.0) flags_ &= ~1;; if (numberSmall || numberDuplicate) flags_ |= 2; // will have gaps return true; } int ClpPackedMatrix::gutsOfTransposeTimesByRowGE3a(const CoinIndexedVector * COIN_RESTRICT piVector, int * COIN_RESTRICT index, double * COIN_RESTRICT output, int * COIN_RESTRICT lookup, char * COIN_RESTRICT marked, const double tolerance, const double scalar) const { const double * COIN_RESTRICT pi = piVector->denseVector(); int numberNonZero = 0; int numberInRowArray = piVector->getNumElements(); const int * COIN_RESTRICT column = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT element = matrix_->getElements(); const int * COIN_RESTRICT whichRow = piVector->getIndices(); int * COIN_RESTRICT fakeRow = const_cast (whichRow); fakeRow[numberInRowArray]=0; // so can touch #ifndef NDEBUG int maxColumn = 0; #endif // ** Row copy is already scaled int nextRow=whichRow[0]; CoinBigIndex nextStart = rowStart[nextRow]; CoinBigIndex nextEnd = rowStart[nextRow+1]; for (int i = 0; i < numberInRowArray; i++) { double value = pi[i] * scalar; CoinBigIndex start=nextStart; CoinBigIndex end=nextEnd; nextRow=whichRow[i+1]; nextStart = rowStart[nextRow]; //coin_prefetch_const(column + nextStart); //coin_prefetch_const(element + nextStart); nextEnd = rowStart[nextRow+1]; CoinBigIndex j; for (j = start; j < end; j++) { int iColumn = column[j]; #ifndef NDEBUG maxColumn = CoinMax(maxColumn, iColumn); #endif double elValue = element[j]; elValue *= value; if (marked[iColumn]) { int k = lookup[iColumn]; output[k] += elValue; } else { output[numberNonZero] = elValue; marked[iColumn] = 1; lookup[iColumn] = numberNonZero; index[numberNonZero++] = iColumn; } } } #ifndef NDEBUG int saveN = numberNonZero; #endif // get rid of tiny values and zero out lookup for (int i = 0; i < numberNonZero; i++) { int iColumn = index[i]; marked[iColumn] = 0; double value = output[i]; if (fabs(value) <= tolerance) { while (fabs(value) <= tolerance) { numberNonZero--; value = output[numberNonZero]; iColumn = index[numberNonZero]; marked[iColumn] = 0; if (i < numberNonZero) { output[numberNonZero] = 0.0; output[i] = value; index[i] = iColumn; } else { output[i] = 0.0; value = 1.0; // to force end of while } } } } #ifndef NDEBUG for (int i = numberNonZero; i < saveN; i++) assert(!output[i]); for (int i = 0; i <= maxColumn; i++) assert (!marked[i]); #endif return numberNonZero; } int ClpPackedMatrix::gutsOfTransposeTimesByRowGE3(const CoinIndexedVector * COIN_RESTRICT piVector, int * COIN_RESTRICT index, double * COIN_RESTRICT output, double * COIN_RESTRICT array, const double tolerance, const double scalar) const { const double * COIN_RESTRICT pi = piVector->denseVector(); int numberNonZero = 0; int numberInRowArray = piVector->getNumElements(); const int * COIN_RESTRICT column = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT element = matrix_->getElements(); const int * COIN_RESTRICT whichRow = piVector->getIndices(); // ** Row copy is already scaled for (int i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; double value = pi[i] * scalar; CoinBigIndex j; for (j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; double inValue = array[iColumn]; double elValue = element[j]; elValue *= value; if (inValue) { double outValue = inValue + elValue; if (!outValue) outValue = COIN_INDEXED_REALLY_TINY_ELEMENT; array[iColumn] = outValue; } else { array[iColumn] = elValue; assert (elValue); index[numberNonZero++] = iColumn; } } } int saveN = numberNonZero; // get rid of tiny values numberNonZero=0; for (int i = 0; i < saveN; i++) { int iColumn = index[i]; double value = array[iColumn]; array[iColumn] =0.0; if (fabs(value) > tolerance) { output[numberNonZero] = value; index[numberNonZero++] = iColumn; } } return numberNonZero; } /* Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector */ CoinBigIndex * ClpPackedMatrix::dubiousWeights(const ClpSimplex * model, int * inputWeights) const { int numberRows = model->numberRows(); int numberColumns = matrix_->getNumCols(); int number = numberRows + numberColumns; CoinBigIndex * weights = new CoinBigIndex[number]; // get matrix data pointers const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); int i; for (i = 0; i < numberColumns; i++) { CoinBigIndex j; CoinBigIndex count = 0; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; count += inputWeights[iRow]; } weights[i] = count; } for (i = 0; i < numberRows; i++) { weights[i+numberColumns] = inputWeights[i]; } return weights; } /* Returns largest and smallest elements of both signs. Largest refers to largest absolute value. */ void ClpPackedMatrix::rangeOfElements(double & smallestNegative, double & largestNegative, double & smallestPositive, double & largestPositive) { smallestNegative = -COIN_DBL_MAX; largestNegative = 0.0; smallestPositive = COIN_DBL_MAX; largestPositive = 0.0; // get matrix data pointers const double * elementByColumn = matrix_->getElements(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); int numberColumns = matrix_->getNumCols(); int i; for (i = 0; i < numberColumns; i++) { CoinBigIndex j; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { double value = elementByColumn[j]; if (value > 0.0) { smallestPositive = CoinMin(smallestPositive, value); largestPositive = CoinMax(largestPositive, value); } else if (value < 0.0) { smallestNegative = CoinMax(smallestNegative, value); largestNegative = CoinMin(largestNegative, value); } } } } // Says whether it can do partial pricing bool ClpPackedMatrix::canDoPartialPricing() const { return true; } // Partial pricing void ClpPackedMatrix::partialPricing(ClpSimplex * model, double startFraction, double endFraction, int & bestSequence, int & numberWanted) { numberWanted = currentWanted_; int start = static_cast (startFraction * numberActiveColumns_); int end = CoinMin(static_cast (endFraction * numberActiveColumns_ + 1), numberActiveColumns_); const double * COIN_RESTRICT element = matrix_->getElements(); const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT startColumn = matrix_->getVectorStarts(); const int * COIN_RESTRICT length = matrix_->getVectorLengths(); const double * COIN_RESTRICT rowScale = model->rowScale(); const double * COIN_RESTRICT columnScale = model->columnScale(); int iSequence; CoinBigIndex j; double tolerance = model->currentDualTolerance(); double * COIN_RESTRICT reducedCost = model->djRegion(); const double * COIN_RESTRICT duals = model->dualRowSolution(); const double * COIN_RESTRICT cost = model->costRegion(); double bestDj; if (bestSequence >= 0) bestDj = fabs(model->clpMatrix()->reducedCost(model, bestSequence)); else bestDj = tolerance; int sequenceOut = model->sequenceOut(); int saveSequence = bestSequence; int lastScan = minimumObjectsScan_ < 0 ? end : start + minimumObjectsScan_; int minNeg = minimumGoodReducedCosts_ == -1 ? numberWanted : minimumGoodReducedCosts_; if (rowScale) { // scaled for (iSequence = start; iSequence < end; iSequence++) { if (iSequence != sequenceOut) { double value; ClpSimplex::Status status = model->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = 0.0; // scaled for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j] * rowScale[jRow]; } value = fabs(cost[iSequence] + value * columnScale[iSequence]); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atUpperBound: value = 0.0; // scaled for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j] * rowScale[jRow]; } value = cost[iSequence] + value * columnScale[iSequence]; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atLowerBound: value = 0.0; // scaled for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j] * rowScale[jRow]; } value = -(cost[iSequence] + value * columnScale[iSequence]); if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (numberWanted + minNeg < originalWanted_ && iSequence > lastScan) { // give up break; } if (!numberWanted) break; } if (bestSequence != saveSequence) { // recompute dj double value = 0.0; // scaled for (j = startColumn[bestSequence]; j < startColumn[bestSequence] + length[bestSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j] * rowScale[jRow]; } reducedCost[bestSequence] = cost[bestSequence] + value * columnScale[bestSequence]; savedBestSequence_ = bestSequence; savedBestDj_ = reducedCost[savedBestSequence_]; } } else { // not scaled for (iSequence = start; iSequence < end; iSequence++) { if (iSequence != sequenceOut) { double value; ClpSimplex::Status status = model->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = cost[iSequence]; for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j]; } value = fabs(value); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atUpperBound: value = cost[iSequence]; // scaled for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j]; } if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atLowerBound: value = cost[iSequence]; for (j = startColumn[iSequence]; j < startColumn[iSequence] + length[iSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j]; } value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (numberWanted + minNeg < originalWanted_ && iSequence > lastScan) { // give up break; } if (!numberWanted) break; } if (bestSequence != saveSequence) { // recompute dj double value = cost[bestSequence]; for (j = startColumn[bestSequence]; j < startColumn[bestSequence] + length[bestSequence]; j++) { int jRow = row[j]; value -= duals[jRow] * element[j]; } reducedCost[bestSequence] = value; savedBestSequence_ = bestSequence; savedBestDj_ = reducedCost[savedBestSequence_]; } } currentWanted_ = numberWanted; } // Sets up an effective RHS void ClpPackedMatrix::useEffectiveRhs(ClpSimplex * model) { delete [] rhsOffset_; int numberRows = model->numberRows(); rhsOffset_ = new double[numberRows]; rhsOffset(model, true); } // Gets rid of special copies void ClpPackedMatrix::clearCopies() { delete rowCopy_; delete columnCopy_; rowCopy_ = NULL; columnCopy_ = NULL; flags_ &= ~(4 + 8); checkGaps(); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } // makes sure active columns correct int ClpPackedMatrix::refresh(ClpSimplex * ) { numberActiveColumns_ = matrix_->getNumCols(); #if 0 ClpMatrixBase * rowCopyBase = reverseOrderedCopy(); ClpPackedMatrix* rowCopy = dynamic_cast< ClpPackedMatrix*>(rowCopyBase); // Make sure it is really a ClpPackedMatrix assert (rowCopy != NULL); const int * column = rowCopy->matrix_->getIndices(); const CoinBigIndex * rowStart = rowCopy->matrix_->getVectorStarts(); const int * rowLength = rowCopy->matrix_->getVectorLengths(); const double * element = rowCopy->matrix_->getElements(); int numberRows = rowCopy->matrix_->getNumRows(); for (int i = 0; i < numberRows; i++) { if (!rowLength[i]) printf("zero row %d\n", i); } delete rowCopy; #endif checkGaps(); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif return 0; } /* Scales rowCopy if column copy scaled Only called if scales already exist */ void ClpPackedMatrix::scaleRowCopy(ClpModel * model) const { if (model->rowCopy()) { // need to replace row by row int numberRows = model->numberRows(); #ifndef NDEBUG int numberColumns = matrix_->getNumCols(); #endif ClpMatrixBase * rowCopyBase = model->rowCopy(); #ifndef NDEBUG ClpPackedMatrix* rowCopy = dynamic_cast< ClpPackedMatrix*>(rowCopyBase); // Make sure it is really a ClpPackedMatrix assert (rowCopy != NULL); #else ClpPackedMatrix* rowCopy = static_cast< ClpPackedMatrix*>(rowCopyBase); #endif const int * COIN_RESTRICT column = rowCopy->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = rowCopy->getVectorStarts(); double * COIN_RESTRICT element = rowCopy->getMutableElements(); const double * COIN_RESTRICT rowScale = model->rowScale(); const double * COIN_RESTRICT columnScale = model->columnScale(); // scale row copy for (int iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex j; double scale = rowScale[iRow]; double * COIN_RESTRICT elementsInThisRow = element + rowStart[iRow]; const int * COIN_RESTRICT columnsInThisRow = column + rowStart[iRow]; int number = rowStart[iRow+1] - rowStart[iRow]; assert (number <= numberColumns); for (j = 0; j < number; j++) { int iColumn = columnsInThisRow[j]; elementsInThisRow[j] *= scale * columnScale[iColumn]; } } } } /* Realy really scales column copy Only called if scales already exist. Up to user ro delete */ ClpMatrixBase * ClpPackedMatrix::scaledColumnCopy(ClpModel * model) const { // need to replace column by column #ifndef NDEBUG int numberRows = model->numberRows(); #endif int numberColumns = matrix_->getNumCols(); ClpPackedMatrix * copy = new ClpPackedMatrix(*this); const int * COIN_RESTRICT row = copy->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = copy->getVectorStarts(); const int * COIN_RESTRICT length = copy->getVectorLengths(); double * COIN_RESTRICT element = copy->getMutableElements(); const double * COIN_RESTRICT rowScale = model->rowScale(); const double * COIN_RESTRICT columnScale = model->columnScale(); // scale column copy for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double scale = columnScale[iColumn]; double * COIN_RESTRICT elementsInThisColumn = element + columnStart[iColumn]; const int * COIN_RESTRICT rowsInThisColumn = row + columnStart[iColumn]; int number = length[iColumn]; assert (number <= numberRows); for (j = 0; j < number; j++) { int iRow = rowsInThisColumn[j]; elementsInThisColumn[j] *= scale * rowScale[iRow]; } } return copy; } // Really scale matrix void ClpPackedMatrix::reallyScale(const double * rowScale, const double * columnScale) { clearCopies(); int numberColumns = matrix_->getNumCols(); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); double * element = matrix_->getMutableElements(); // scale for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex j; double scale = columnScale[iColumn]; for (j = columnStart[iColumn]; j < columnStart[iColumn] + length[iColumn]; j++) { int iRow = row[j]; element[j] *= scale * rowScale[iRow]; } } } /* Delete the columns whose indices are listed in indDel. */ void ClpPackedMatrix::deleteCols(const int numDel, const int * indDel) { if (matrix_->getNumCols()) matrix_->deleteCols(numDel, indDel); clearCopies(); numberActiveColumns_ = matrix_->getNumCols(); // may now have gaps checkGaps(); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif matrix_->setExtraGap(0.0); } /* Delete the rows whose indices are listed in indDel. */ void ClpPackedMatrix::deleteRows(const int numDel, const int * indDel) { if (matrix_->getNumRows()) matrix_->deleteRows(numDel, indDel); clearCopies(); numberActiveColumns_ = matrix_->getNumCols(); // may now have gaps checkGaps(); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif matrix_->setExtraGap(0.0); } #ifndef CLP_NO_VECTOR // Append Columns void ClpPackedMatrix::appendCols(int number, const CoinPackedVectorBase * const * columns) { matrix_->appendCols(number, columns); numberActiveColumns_ = matrix_->getNumCols(); clearCopies(); } // Append Rows void ClpPackedMatrix::appendRows(int number, const CoinPackedVectorBase * const * rows) { matrix_->appendRows(number, rows); numberActiveColumns_ = matrix_->getNumCols(); // may now have gaps checkGaps(); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif clearCopies(); } #endif /* Set the dimensions of the matrix. In effect, append new empty columns/rows to the matrix. A negative number for either dimension means that that dimension doesn't change. Otherwise the new dimensions MUST be at least as large as the current ones otherwise an exception is thrown. */ void ClpPackedMatrix::setDimensions(int numrows, int numcols) { matrix_->setDimensions(numrows, numcols); #ifdef DO_CHECK_FLAGS checkFlags(0); #endif } /* Append a set of rows/columns to the end of the matrix. Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns */ int ClpPackedMatrix::appendMatrix(int number, int type, const CoinBigIndex * starts, const int * index, const double * element, int numberOther) { int numberErrors = 0; // make sure other dimension is big enough if (type == 0) { // rows if (matrix_->isColOrdered() && numberOther > matrix_->getNumCols()) matrix_->setDimensions(-1, numberOther); if (!matrix_->isColOrdered() || numberOther >= 0 || matrix_->getExtraGap()) { numberErrors = matrix_->appendRows(number, starts, index, element, numberOther); } else { //CoinPackedMatrix mm(*matrix_); matrix_->appendMinorFast(number, starts, index, element); //mm.appendRows(number,starts,index,element,numberOther); //if (!mm.isEquivalent(*matrix_)) { //printf("bad append\n"); //abort(); //} } } else { // columns if (!matrix_->isColOrdered() && numberOther > matrix_->getNumRows()) matrix_->setDimensions(numberOther, -1); if (element) numberErrors = matrix_->appendCols(number, starts, index, element, numberOther); else matrix_->setDimensions(-1,matrix_->getNumCols()+number); // resize } clearCopies(); numberActiveColumns_ = matrix_->getNumCols(); return numberErrors; } void ClpPackedMatrix::specialRowCopy(ClpSimplex * model, const ClpMatrixBase * rowCopy) { delete rowCopy_; rowCopy_ = new ClpPackedMatrix2(model, rowCopy->getPackedMatrix()); // See if anything in it if (!rowCopy_->usefulInfo()) { delete rowCopy_; rowCopy_ = NULL; flags_ &= ~4; } else { flags_ |= 4; } } void ClpPackedMatrix::specialColumnCopy(ClpSimplex * model) { delete columnCopy_; if ((flags_ & 16) != 0) { columnCopy_ = new ClpPackedMatrix3(model, matrix_); flags_ |= 8; } else { columnCopy_ = NULL; } } // Say we don't want special column copy void ClpPackedMatrix::releaseSpecialColumnCopy() { flags_ &= ~(8 + 16); delete columnCopy_; columnCopy_ = NULL; } // Correct sequence in and out to give true value void ClpPackedMatrix::correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) { if (columnCopy_) { if (sequenceIn != -999) { if (sequenceIn != sequenceOut) { if (sequenceIn < numberActiveColumns_) columnCopy_->swapOne(model, this, sequenceIn); if (sequenceOut < numberActiveColumns_) columnCopy_->swapOne(model, this, sequenceOut); } } else { // do all columnCopy_->sortBlocks(model); } } } // Check validity void ClpPackedMatrix::checkFlags(int type) const { int iColumn; // get matrix data pointers //const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * elementByColumn = matrix_->getElements(); if (!zeros()) { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (!elementByColumn[j]) abort(); } } } if ((flags_ & 2) == 0) { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { if (columnStart[iColumn+1] != columnStart[iColumn] + columnLength[iColumn]) { abort(); } } } if (type) { if ((flags_ & 2) != 0) { bool ok = true; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { if (columnStart[iColumn+1] != columnStart[iColumn] + columnLength[iColumn]) { ok = false; break; } } if (ok) COIN_DETAIL_PRINT(printf("flags_ could be 0\n")); } } } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpPackedMatrix2::ClpPackedMatrix2 () : numberBlocks_(0), numberRows_(0), offset_(NULL), count_(NULL), rowStart_(NULL), column_(NULL), work_(NULL) { #ifdef THREAD threadId_ = NULL; info_ = NULL; #endif } //------------------------------------------------------------------- // Useful Constructor //------------------------------------------------------------------- ClpPackedMatrix2::ClpPackedMatrix2 (ClpSimplex * , const CoinPackedMatrix * rowCopy) : numberBlocks_(0), numberRows_(0), offset_(NULL), count_(NULL), rowStart_(NULL), column_(NULL), work_(NULL) { #ifdef THREAD threadId_ = NULL; info_ = NULL; #endif numberRows_ = rowCopy->getNumRows(); if (!numberRows_) return; int numberColumns = rowCopy->getNumCols(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * length = rowCopy->getVectorLengths(); const double * element = rowCopy->getElements(); int chunk = 32768; // tune //chunk=100; // tune #if 0 int chunkY[7] = {1024, 2048, 4096, 8192, 16384, 32768, 65535}; int its = model->maximumIterations(); if (its >= 1000000 && its < 1000999) { its -= 1000000; its = its / 10; if (its >= 7) abort(); chunk = chunkY[its]; printf("chunk size %d\n", chunk); #define cpuid(func,ax,bx,cx,dx)\ __asm__ __volatile__ ("cpuid":\ "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func)); unsigned int a, b, c, d; int func = 0; cpuid(func, a, b, c, d); { int i; unsigned int value; value = b; for (i = 0; i < 4; i++) { printf("%c", (value & 0xff)); value = value >> 8; } value = d; for (i = 0; i < 4; i++) { printf("%c", (value & 0xff)); value = value >> 8; } value = c; for (i = 0; i < 4; i++) { printf("%c", (value & 0xff)); value = value >> 8; } printf("\n"); int maxfunc = a; if (maxfunc > 10) { printf("not intel?\n"); abort(); } for (func = 1; func <= maxfunc; func++) { cpuid(func, a, b, c, d); printf("func %d, %x %x %x %x\n", func, a, b, c, d); } } #else if (numberColumns > 10000 || chunk == 100) { #endif } else { //printf("no chunk\n"); return; } // Could also analyze matrix to get natural breaks numberBlocks_ = (numberColumns + chunk - 1) / chunk; #ifdef THREAD // Get work areas threadId_ = new pthread_t [numberBlocks_]; info_ = new dualColumn0Struct[numberBlocks_]; #endif // Even out chunk = (numberColumns + numberBlocks_ - 1) / numberBlocks_; offset_ = new int[numberBlocks_+1]; offset_[numberBlocks_] = numberColumns; int nRow = numberBlocks_ * numberRows_; count_ = new unsigned short[nRow]; memset(count_, 0, nRow * sizeof(unsigned short)); rowStart_ = new CoinBigIndex[nRow+numberRows_+1]; CoinBigIndex nElement = rowStart[numberRows_]; rowStart_[nRow+numberRows_] = nElement; column_ = new unsigned short [nElement]; // assumes int <= double int sizeWork = 6 * numberBlocks_; work_ = new double[sizeWork];; int iBlock; int nZero = 0; for (iBlock = 0; iBlock < numberBlocks_; iBlock++) { int start = iBlock * chunk; offset_[iBlock] = start; int end = start + chunk; for (int iRow = 0; iRow < numberRows_; iRow++) { if (rowStart[iRow+1] != rowStart[iRow] + length[iRow]) { printf("not packed correctly - gaps\n"); abort(); } bool lastFound = false; int nFound = 0; for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + length[iRow]; j++) { int iColumn = column[j]; if (iColumn >= start) { if (iColumn < end) { if (!element[j]) { printf("not packed correctly - zero element\n"); abort(); } column_[j] = static_cast(iColumn - start); nFound++; if (lastFound) { printf("not packed correctly - out of order\n"); abort(); } } else { //can't find any more lastFound = true; } } } count_[iRow*numberBlocks_+iBlock] = static_cast(nFound); if (!nFound) nZero++; } } //double fraction = ((double) nZero)/((double) (numberBlocks_*numberRows_)); //printf("%d empty blocks, %g%%\n",nZero,100.0*fraction); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpPackedMatrix2::ClpPackedMatrix2 (const ClpPackedMatrix2 & rhs) : numberBlocks_(rhs.numberBlocks_), numberRows_(rhs.numberRows_) { if (numberBlocks_) { offset_ = CoinCopyOfArray(rhs.offset_, numberBlocks_ + 1); int nRow = numberBlocks_ * numberRows_; count_ = CoinCopyOfArray(rhs.count_, nRow); rowStart_ = CoinCopyOfArray(rhs.rowStart_, nRow + numberRows_ + 1); CoinBigIndex nElement = rowStart_[nRow+numberRows_]; column_ = CoinCopyOfArray(rhs.column_, nElement); int sizeWork = 6 * numberBlocks_; work_ = CoinCopyOfArray(rhs.work_, sizeWork); #ifdef THREAD threadId_ = new pthread_t [numberBlocks_]; info_ = new dualColumn0Struct[numberBlocks_]; #endif } else { offset_ = NULL; count_ = NULL; rowStart_ = NULL; column_ = NULL; work_ = NULL; #ifdef THREAD threadId_ = NULL; info_ = NULL; #endif } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpPackedMatrix2::~ClpPackedMatrix2 () { delete [] offset_; delete [] count_; delete [] rowStart_; delete [] column_; delete [] work_; #ifdef THREAD delete [] threadId_; delete [] info_; #endif } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpPackedMatrix2 & ClpPackedMatrix2::operator=(const ClpPackedMatrix2& rhs) { if (this != &rhs) { numberBlocks_ = rhs.numberBlocks_; numberRows_ = rhs.numberRows_; delete [] offset_; delete [] count_; delete [] rowStart_; delete [] column_; delete [] work_; #ifdef THREAD delete [] threadId_; delete [] info_; #endif if (numberBlocks_) { offset_ = CoinCopyOfArray(rhs.offset_, numberBlocks_ + 1); int nRow = numberBlocks_ * numberRows_; count_ = CoinCopyOfArray(rhs.count_, nRow); rowStart_ = CoinCopyOfArray(rhs.rowStart_, nRow + numberRows_ + 1); CoinBigIndex nElement = rowStart_[nRow+numberRows_]; column_ = CoinCopyOfArray(rhs.column_, nElement); int sizeWork = 6 * numberBlocks_; work_ = CoinCopyOfArray(rhs.work_, sizeWork); #ifdef THREAD threadId_ = new pthread_t [numberBlocks_]; info_ = new dualColumn0Struct[numberBlocks_]; #endif } else { offset_ = NULL; count_ = NULL; rowStart_ = NULL; column_ = NULL; work_ = NULL; #ifdef THREAD threadId_ = NULL; info_ = NULL; #endif } } return *this; } static int dualColumn0(const ClpSimplex * model, double * spare, int * spareIndex, const double * arrayTemp, const int * indexTemp, int numberIn, int offset, double acceptablePivot, double * bestPossiblePtr, double * upperThetaPtr, int * posFreePtr, double * freePivotPtr) { // do dualColumn0 int i; int numberRemaining = 0; double bestPossible = 0.0; double upperTheta = 1.0e31; double freePivot = acceptablePivot; int posFree = -1; const double * reducedCost = model->djRegion(1); double dualTolerance = model->dualTolerance(); // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; for (i = 0; i < numberIn; i++) { double alpha = arrayTemp[i]; int iSequence = indexTemp[i] + offset; double oldValue; double value; bool keep; switch(model->getStatus(iSequence)) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: bestPossible = CoinMax(bestPossible, fabs(alpha)); oldValue = reducedCost[iSequence]; // If free has to be very large - should come in via dualRow if (model->getStatus(iSequence) == ClpSimplex::isFree && fabs(alpha) < 1.0e-3) break; if (oldValue > dualTolerance) { keep = true; } else if (oldValue < -dualTolerance) { keep = true; } else { if (fabs(alpha) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) keep = true; else keep = false; } if (keep) { // free - choose largest if (fabs(alpha) > freePivot) { freePivot = fabs(alpha); posFree = i; } } break; case ClpSimplex::atUpperBound: oldValue = reducedCost[iSequence]; value = oldValue - tentativeTheta * alpha; //assert (oldValue<=dualTolerance*1.0001); if (value > dualTolerance) { bestPossible = CoinMax(bestPossible, -alpha); value = oldValue - upperTheta * alpha; if (value > dualTolerance && -alpha >= acceptablePivot) upperTheta = (oldValue - dualTolerance) / alpha; // add to list spare[numberRemaining] = alpha; spareIndex[numberRemaining++] = iSequence; } break; case ClpSimplex::atLowerBound: oldValue = reducedCost[iSequence]; value = oldValue - tentativeTheta * alpha; //assert (oldValue>=-dualTolerance*1.0001); if (value < -dualTolerance) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < -dualTolerance && alpha >= acceptablePivot) upperTheta = (oldValue + dualTolerance) / alpha; // add to list spare[numberRemaining] = alpha; spareIndex[numberRemaining++] = iSequence; } break; } } *bestPossiblePtr = bestPossible; *upperThetaPtr = upperTheta; *freePivotPtr = freePivot; *posFreePtr = posFree; return numberRemaining; } static int doOneBlock(double * array, int * index, const double * pi, const CoinBigIndex * rowStart, const double * element, const unsigned short * column, int numberInRowArray, int numberLook) { int iWhich = 0; int nextN = 0; CoinBigIndex nextStart = 0; double nextPi = 0.0; for (; iWhich < numberInRowArray; iWhich++) { nextStart = rowStart[0]; nextN = rowStart[numberInRowArray] - nextStart; rowStart++; if (nextN) { nextPi = pi[iWhich]; break; } } int i; while (iWhich < numberInRowArray) { double value = nextPi; CoinBigIndex j = nextStart; int n = nextN; // get next iWhich++; for (; iWhich < numberInRowArray; iWhich++) { nextStart = rowStart[0]; nextN = rowStart[numberInRowArray] - nextStart; rowStart++; if (nextN) { //coin_prefetch_const(element + nextStart); nextPi = pi[iWhich]; break; } } CoinBigIndex end = j + n; //coin_prefetch_const(element+rowStart_[i+1]); //coin_prefetch_const(column_+rowStart_[i+1]); if (n < 100) { if ((n & 1) != 0) { unsigned int jColumn = column[j]; array[jColumn] -= value * element[j]; j++; } //coin_prefetch_const(column + nextStart); for (; j < end; j += 2) { unsigned int jColumn0 = column[j]; double value0 = value * element[j]; unsigned int jColumn1 = column[j+1]; double value1 = value * element[j+1]; array[jColumn0] -= value0; array[jColumn1] -= value1; } } else { if ((n & 1) != 0) { unsigned int jColumn = column[j]; array[jColumn] -= value * element[j]; j++; } if ((n & 2) != 0) { unsigned int jColumn0 = column[j]; double value0 = value * element[j]; unsigned int jColumn1 = column[j+1]; double value1 = value * element[j+1]; array[jColumn0] -= value0; array[jColumn1] -= value1; j += 2; } if ((n & 4) != 0) { unsigned int jColumn0 = column[j]; double value0 = value * element[j]; unsigned int jColumn1 = column[j+1]; double value1 = value * element[j+1]; unsigned int jColumn2 = column[j+2]; double value2 = value * element[j+2]; unsigned int jColumn3 = column[j+3]; double value3 = value * element[j+3]; array[jColumn0] -= value0; array[jColumn1] -= value1; array[jColumn2] -= value2; array[jColumn3] -= value3; j += 4; } //coin_prefetch_const(column+nextStart); for (; j < end; j += 8) { //coin_prefetch_const(element + j + 16); unsigned int jColumn0 = column[j]; double value0 = value * element[j]; unsigned int jColumn1 = column[j+1]; double value1 = value * element[j+1]; unsigned int jColumn2 = column[j+2]; double value2 = value * element[j+2]; unsigned int jColumn3 = column[j+3]; double value3 = value * element[j+3]; array[jColumn0] -= value0; array[jColumn1] -= value1; array[jColumn2] -= value2; array[jColumn3] -= value3; //coin_prefetch_const(column + j + 16); jColumn0 = column[j+4]; value0 = value * element[j+4]; jColumn1 = column[j+5]; value1 = value * element[j+5]; jColumn2 = column[j+6]; value2 = value * element[j+6]; jColumn3 = column[j+7]; value3 = value * element[j+7]; array[jColumn0] -= value0; array[jColumn1] -= value1; array[jColumn2] -= value2; array[jColumn3] -= value3; } } } // get rid of tiny values int nSmall = numberLook; int numberNonZero = 0; for (i = 0; i < nSmall; i++) { double value = array[i]; array[i] = 0.0; if (fabs(value) > 1.0e-12) { array[numberNonZero] = value; index[numberNonZero++] = i; } } for (; i < numberLook; i += 4) { double value0 = array[i+0]; double value1 = array[i+1]; double value2 = array[i+2]; double value3 = array[i+3]; array[i+0] = 0.0; array[i+1] = 0.0; array[i+2] = 0.0; array[i+3] = 0.0; if (fabs(value0) > 1.0e-12) { array[numberNonZero] = value0; index[numberNonZero++] = i + 0; } if (fabs(value1) > 1.0e-12) { array[numberNonZero] = value1; index[numberNonZero++] = i + 1; } if (fabs(value2) > 1.0e-12) { array[numberNonZero] = value2; index[numberNonZero++] = i + 2; } if (fabs(value3) > 1.0e-12) { array[numberNonZero] = value3; index[numberNonZero++] = i + 3; } } return numberNonZero; } #ifdef THREAD static void * doOneBlockThread(void * voidInfo) { dualColumn0Struct * info = (dualColumn0Struct *) voidInfo; *(info->numberInPtr) = doOneBlock(info->arrayTemp, info->indexTemp, info->pi, info->rowStart, info->element, info->column, info->numberInRowArray, info->numberLook); return NULL; } static void * doOneBlockAnd0Thread(void * voidInfo) { dualColumn0Struct * info = (dualColumn0Struct *) voidInfo; *(info->numberInPtr) = doOneBlock(info->arrayTemp, info->indexTemp, info->pi, info->rowStart, info->element, info->column, info->numberInRowArray, info->numberLook); *(info->numberOutPtr) = dualColumn0(info->model, info->spare, info->spareIndex, (const double *)info->arrayTemp, (const int *) info->indexTemp, *(info->numberInPtr), info->offset, info->acceptablePivot, info->bestPossiblePtr, info->upperThetaPtr, info->posFreePtr, info->freePivotPtr); return NULL; } #endif /* Return x * scalar * A in z. Note - x packed and z will be packed mode Squashes small elements and knows about ClpSimplex */ void ClpPackedMatrix2::transposeTimes(const ClpSimplex * model, const CoinPackedMatrix * rowCopy, const CoinIndexedVector * rowArray, CoinIndexedVector * spareArray, CoinIndexedVector * columnArray) const { // See if dualColumn0 coding wanted bool dualColumn = model->spareIntArray_[0] == 1; double acceptablePivot = model->spareDoubleArray_[0]; double bestPossible = 0.0; double upperTheta = 1.0e31; double freePivot = acceptablePivot; int posFree = -1; int numberRemaining = 0; //if (model->numberIterations()>=200000) { //printf("time %g\n",CoinCpuTime()-startTime); //exit(77); //} double * pi = rowArray->denseVector(); int numberNonZero = 0; int * index = columnArray->getIndices(); double * array = columnArray->denseVector(); int numberInRowArray = rowArray->getNumElements(); const int * whichRow = rowArray->getIndices(); double * element = const_cast(rowCopy->getElements()); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); int i; CoinBigIndex * rowStart2 = rowStart_; if (!dualColumn) { for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; CoinBigIndex start = rowStart[iRow]; *rowStart2 = start; unsigned short * count1 = count_ + iRow * numberBlocks_; int put = 0; for (int j = 0; j < numberBlocks_; j++) { put += numberInRowArray; start += count1[j]; rowStart2[put] = start; } rowStart2 ++; } } else { // also do dualColumn stuff double * spare = spareArray->denseVector(); int * spareIndex = spareArray->getIndices(); const double * reducedCost = model->djRegion(0); double dualTolerance = model->dualTolerance(); // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; int addSequence = model->numberColumns(); for (i = 0; i < numberInRowArray; i++) { int iRow = whichRow[i]; double alpha = pi[i]; double oldValue; double value; bool keep; switch(model->getStatus(iRow + addSequence)) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: bestPossible = CoinMax(bestPossible, fabs(alpha)); oldValue = reducedCost[iRow]; // If free has to be very large - should come in via dualRow if (model->getStatus(iRow + addSequence) == ClpSimplex::isFree && fabs(alpha) < 1.0e-3) break; if (oldValue > dualTolerance) { keep = true; } else if (oldValue < -dualTolerance) { keep = true; } else { if (fabs(alpha) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) keep = true; else keep = false; } if (keep) { // free - choose largest if (fabs(alpha) > freePivot) { freePivot = fabs(alpha); posFree = i + addSequence; } } break; case ClpSimplex::atUpperBound: oldValue = reducedCost[iRow]; value = oldValue - tentativeTheta * alpha; //assert (oldValue<=dualTolerance*1.0001); if (value > dualTolerance) { bestPossible = CoinMax(bestPossible, -alpha); value = oldValue - upperTheta * alpha; if (value > dualTolerance && -alpha >= acceptablePivot) upperTheta = (oldValue - dualTolerance) / alpha; // add to list spare[numberRemaining] = alpha; spareIndex[numberRemaining++] = iRow + addSequence; } break; case ClpSimplex::atLowerBound: oldValue = reducedCost[iRow]; value = oldValue - tentativeTheta * alpha; //assert (oldValue>=-dualTolerance*1.0001); if (value < -dualTolerance) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < -dualTolerance && alpha >= acceptablePivot) upperTheta = (oldValue + dualTolerance) / alpha; // add to list spare[numberRemaining] = alpha; spareIndex[numberRemaining++] = iRow + addSequence; } break; } CoinBigIndex start = rowStart[iRow]; *rowStart2 = start; unsigned short * count1 = count_ + iRow * numberBlocks_; int put = 0; for (int j = 0; j < numberBlocks_; j++) { put += numberInRowArray; start += count1[j]; rowStart2[put] = start; } rowStart2 ++; } } double * spare = spareArray->denseVector(); int * spareIndex = spareArray->getIndices(); int saveNumberRemaining = numberRemaining; int iBlock; for (iBlock = 0; iBlock < numberBlocks_; iBlock++) { double * dwork = work_ + 6 * iBlock; int * iwork = reinterpret_cast (dwork + 3); if (!dualColumn) { #ifndef THREAD int offset = offset_[iBlock]; int offset3 = offset; offset = numberNonZero; double * arrayTemp = array + offset; int * indexTemp = index + offset; iwork[0] = doOneBlock(arrayTemp, indexTemp, pi, rowStart_ + numberInRowArray * iBlock, element, column_, numberInRowArray, offset_[iBlock+1] - offset); int number = iwork[0]; for (i = 0; i < number; i++) { //double value = arrayTemp[i]; //arrayTemp[i]=0.0; //array[numberNonZero]=value; index[numberNonZero++] = indexTemp[i] + offset3; } #else int offset = offset_[iBlock]; double * arrayTemp = array + offset; int * indexTemp = index + offset; dualColumn0Struct * infoPtr = info_ + iBlock; infoPtr->arrayTemp = arrayTemp; infoPtr->indexTemp = indexTemp; infoPtr->numberInPtr = &iwork[0]; infoPtr->pi = pi; infoPtr->rowStart = rowStart_ + numberInRowArray * iBlock; infoPtr->element = element; infoPtr->column = column_; infoPtr->numberInRowArray = numberInRowArray; infoPtr->numberLook = offset_[iBlock+1] - offset; pthread_create(&threadId_[iBlock], NULL, doOneBlockThread, infoPtr); #endif } else { #ifndef THREAD int offset = offset_[iBlock]; // allow for already saved int offset2 = offset + saveNumberRemaining; int offset3 = offset; offset = numberNonZero; offset2 = numberRemaining; double * arrayTemp = array + offset; int * indexTemp = index + offset; iwork[0] = doOneBlock(arrayTemp, indexTemp, pi, rowStart_ + numberInRowArray * iBlock, element, column_, numberInRowArray, offset_[iBlock+1] - offset); iwork[1] = dualColumn0(model, spare + offset2, spareIndex + offset2, arrayTemp, indexTemp, iwork[0], offset3, acceptablePivot, &dwork[0], &dwork[1], &iwork[2], &dwork[2]); int number = iwork[0]; int numberLook = iwork[1]; #if 1 numberRemaining += numberLook; #else double * spareTemp = spare + offset2; const int * spareIndexTemp = spareIndex + offset2; for (i = 0; i < numberLook; i++) { double value = spareTemp[i]; spareTemp[i] = 0.0; spare[numberRemaining] = value; spareIndex[numberRemaining++] = spareIndexTemp[i]; } #endif if (dwork[2] > freePivot) { freePivot = dwork[2]; posFree = iwork[2] + numberNonZero; } upperTheta = CoinMin(dwork[1], upperTheta); bestPossible = CoinMax(dwork[0], bestPossible); for (i = 0; i < number; i++) { // double value = arrayTemp[i]; //arrayTemp[i]=0.0; //array[numberNonZero]=value; index[numberNonZero++] = indexTemp[i] + offset3; } #else int offset = offset_[iBlock]; // allow for already saved int offset2 = offset + saveNumberRemaining; double * arrayTemp = array + offset; int * indexTemp = index + offset; dualColumn0Struct * infoPtr = info_ + iBlock; infoPtr->model = model; infoPtr->spare = spare + offset2; infoPtr->spareIndex = spareIndex + offset2; infoPtr->arrayTemp = arrayTemp; infoPtr->indexTemp = indexTemp; infoPtr->numberInPtr = &iwork[0]; infoPtr->offset = offset; infoPtr->acceptablePivot = acceptablePivot; infoPtr->bestPossiblePtr = &dwork[0]; infoPtr->upperThetaPtr = &dwork[1]; infoPtr->posFreePtr = &iwork[2]; infoPtr->freePivotPtr = &dwork[2]; infoPtr->numberOutPtr = &iwork[1]; infoPtr->pi = pi; infoPtr->rowStart = rowStart_ + numberInRowArray * iBlock; infoPtr->element = element; infoPtr->column = column_; infoPtr->numberInRowArray = numberInRowArray; infoPtr->numberLook = offset_[iBlock+1] - offset; if (iBlock >= 2) pthread_join(threadId_[iBlock-2], NULL); pthread_create(threadId_ + iBlock, NULL, doOneBlockAnd0Thread, infoPtr); //pthread_join(threadId_[iBlock],NULL); #endif } } for ( iBlock = CoinMax(0, numberBlocks_ - 2); iBlock < numberBlocks_; iBlock++) { #ifdef THREAD pthread_join(threadId_[iBlock], NULL); #endif } #ifdef THREAD for ( iBlock = 0; iBlock < numberBlocks_; iBlock++) { //pthread_join(threadId_[iBlock],NULL); int offset = offset_[iBlock]; double * dwork = work_ + 6 * iBlock; int * iwork = (int *) (dwork + 3); int number = iwork[0]; if (dualColumn) { // allow for already saved int offset2 = offset + saveNumberRemaining; int numberLook = iwork[1]; double * spareTemp = spare + offset2; const int * spareIndexTemp = spareIndex + offset2; for (i = 0; i < numberLook; i++) { double value = spareTemp[i]; spareTemp[i] = 0.0; spare[numberRemaining] = value; spareIndex[numberRemaining++] = spareIndexTemp[i]; } if (dwork[2] > freePivot) { freePivot = dwork[2]; posFree = iwork[2] + numberNonZero; } upperTheta = CoinMin(dwork[1], upperTheta); bestPossible = CoinMax(dwork[0], bestPossible); } double * arrayTemp = array + offset; const int * indexTemp = index + offset; for (i = 0; i < number; i++) { double value = arrayTemp[i]; arrayTemp[i] = 0.0; array[numberNonZero] = value; index[numberNonZero++] = indexTemp[i] + offset; } } #endif columnArray->setNumElements(numberNonZero); columnArray->setPackedMode(true); if (dualColumn) { model->spareDoubleArray_[0] = upperTheta; model->spareDoubleArray_[1] = bestPossible; // and theta and alpha and sequence if (posFree < 0) { model->spareIntArray_[1] = -1; } else { const double * reducedCost = model->djRegion(0); double alpha; int numberColumns = model->numberColumns(); if (posFree < numberColumns) { alpha = columnArray->denseVector()[posFree]; posFree = columnArray->getIndices()[posFree]; } else { alpha = rowArray->denseVector()[posFree-numberColumns]; posFree = rowArray->getIndices()[posFree-numberColumns] + numberColumns; } model->spareDoubleArray_[2] = fabs(reducedCost[posFree] / alpha);; model->spareDoubleArray_[3] = alpha; model->spareIntArray_[1] = posFree; } spareArray->setNumElements(numberRemaining); // signal done model->spareIntArray_[0] = -1; } } /* Default constructor. */ ClpPackedMatrix3::ClpPackedMatrix3() : numberBlocks_(0), numberColumns_(0), column_(NULL), start_(NULL), row_(NULL), element_(NULL), block_(NULL) { } /* Constructor from copy. */ ClpPackedMatrix3::ClpPackedMatrix3(ClpSimplex * model, const CoinPackedMatrix * columnCopy) : numberBlocks_(0), numberColumns_(0), column_(NULL), start_(NULL), row_(NULL), element_(NULL), block_(NULL) { #define MINBLOCK 6 #define MAXBLOCK 100 #define MAXUNROLL 10 numberColumns_ = model->getNumCols(); int numberColumns = columnCopy->getNumCols(); assert (numberColumns_ >= numberColumns); int numberRows = columnCopy->getNumRows(); int * counts = new int[numberRows+1]; CoinZeroN(counts, numberRows + 1); CoinBigIndex nels = 0; CoinBigIndex nZeroEl = 0; int iColumn; // get matrix data pointers const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); const double * elementByColumn = columnCopy->getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex start = columnStart[iColumn]; int n = columnLength[iColumn]; CoinBigIndex end = start + n; int kZero = 0; for (CoinBigIndex j = start; j < end; j++) { if(!elementByColumn[j]) kZero++; } n -= kZero; nZeroEl += kZero; nels += n; counts[n]++; } counts[0] += numberColumns_ - numberColumns; int nZeroColumns = counts[0]; counts[0] = -1; numberColumns_ -= nZeroColumns; column_ = new int [2*numberColumns_+nZeroColumns]; int * lookup = column_ + numberColumns_; row_ = new int[nels]; element_ = new double[nels]; int nOdd = 0; CoinBigIndex nInOdd = 0; int i; for (i = 1; i <= numberRows; i++) { int n = counts[i]; if (n) { if (n < MINBLOCK || i > MAXBLOCK) { nOdd += n; counts[i] = -1; nInOdd += n * i; } else { numberBlocks_++; } } else { counts[i] = -1; } } start_ = new CoinBigIndex [nOdd+1]; // even if no blocks do a dummy one numberBlocks_ = CoinMax(numberBlocks_, 1); block_ = new blockStruct [numberBlocks_]; memset(block_, 0, numberBlocks_ * sizeof(blockStruct)); // Fill in what we can int nTotal = nOdd; // in case no blocks block_->startIndices_ = nTotal; nels = nInOdd; int nBlock = 0; for (i = 0; i <= CoinMin(MAXBLOCK, numberRows); i++) { if (counts[i] > 0) { blockStruct * block = block_ + nBlock; int n = counts[i]; counts[i] = nBlock; // backward pointer nBlock++; block->startIndices_ = nTotal; block->startElements_ = nels; block->numberElements_ = i; // up counts nTotal += n; nels += n * i; } } for (iColumn = numberColumns; iColumn < numberColumns_; iColumn++) lookup[iColumn] = -1; // fill start_[0] = 0; nOdd = 0; nInOdd = 0; const double * columnScale = model->columnScale(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex start = columnStart[iColumn]; int n = columnLength[iColumn]; CoinBigIndex end = start + n; int kZero = 0; for (CoinBigIndex j = start; j < end; j++) { if(!elementByColumn[j]) kZero++; } n -= kZero; if (n) { int iBlock = counts[n]; if (iBlock >= 0) { blockStruct * block = block_ + iBlock; int k = block->numberInBlock_; block->numberInBlock_ ++; column_[block->startIndices_+k] = iColumn; lookup[iColumn] = k; CoinBigIndex put = block->startElements_ + k * n; for (CoinBigIndex j = start; j < end; j++) { double value = elementByColumn[j]; if(value) { if (columnScale) value *= columnScale[iColumn]; element_[put] = value; row_[put++] = row[j]; } } } else { // odd ones for (CoinBigIndex j = start; j < end; j++) { double value = elementByColumn[j]; if(value) { if (columnScale) value *= columnScale[iColumn]; element_[nInOdd] = value; row_[nInOdd++] = row[j]; } } column_[nOdd] = iColumn; lookup[iColumn] = -1; nOdd++; start_[nOdd] = nInOdd; } } else { // zero column lookup[iColumn] = -1; } } delete [] counts; } /* Destructor */ ClpPackedMatrix3::~ClpPackedMatrix3() { delete [] column_; delete [] start_; delete [] row_; delete [] element_; delete [] block_; } /* The copy constructor. */ ClpPackedMatrix3::ClpPackedMatrix3(const ClpPackedMatrix3 & rhs) : numberBlocks_(rhs.numberBlocks_), numberColumns_(rhs.numberColumns_), column_(NULL), start_(NULL), row_(NULL), element_(NULL), block_(NULL) { if (rhs.numberBlocks_) { block_ = CoinCopyOfArray(rhs.block_, numberBlocks_); column_ = CoinCopyOfArray(rhs.column_, 2 * numberColumns_); int numberOdd = block_->startIndices_; start_ = CoinCopyOfArray(rhs.start_, numberOdd + 1); blockStruct * lastBlock = block_ + (numberBlocks_ - 1); CoinBigIndex numberElements = lastBlock->startElements_ + lastBlock->numberInBlock_ * lastBlock->numberElements_; row_ = CoinCopyOfArray(rhs.row_, numberElements); element_ = CoinCopyOfArray(rhs.element_, numberElements); } } ClpPackedMatrix3& ClpPackedMatrix3::operator=(const ClpPackedMatrix3 & rhs) { if (this != &rhs) { delete [] column_; delete [] start_; delete [] row_; delete [] element_; delete [] block_; numberBlocks_ = rhs.numberBlocks_; numberColumns_ = rhs.numberColumns_; if (rhs.numberBlocks_) { block_ = CoinCopyOfArray(rhs.block_, numberBlocks_); column_ = CoinCopyOfArray(rhs.column_, 2 * numberColumns_); int numberOdd = block_->startIndices_; start_ = CoinCopyOfArray(rhs.start_, numberOdd + 1); blockStruct * lastBlock = block_ + (numberBlocks_ - 1); CoinBigIndex numberElements = lastBlock->startElements_ + lastBlock->numberInBlock_ * lastBlock->numberElements_; row_ = CoinCopyOfArray(rhs.row_, numberElements); element_ = CoinCopyOfArray(rhs.element_, numberElements); } else { column_ = NULL; start_ = NULL; row_ = NULL; element_ = NULL; block_ = NULL; } } return *this; } /* Sort blocks */ void ClpPackedMatrix3::sortBlocks(const ClpSimplex * model) { int * lookup = column_ + numberColumns_; for (int iBlock = 0; iBlock < numberBlocks_; iBlock++) { blockStruct * block = block_ + iBlock; int numberInBlock = block->numberInBlock_; int nel = block->numberElements_; int * row = row_ + block->startElements_; double * element = element_ + block->startElements_; int * column = column_ + block->startIndices_; int lastPrice = 0; int firstNotPrice = numberInBlock - 1; while (lastPrice <= firstNotPrice) { // find first basic or fixed int iColumn = numberInBlock; for (; lastPrice <= firstNotPrice; lastPrice++) { iColumn = column[lastPrice]; if (model->getColumnStatus(iColumn) == ClpSimplex::basic || model->getColumnStatus(iColumn) == ClpSimplex::isFixed) break; } // find last non basic or fixed int jColumn = -1; for (; firstNotPrice > lastPrice; firstNotPrice--) { jColumn = column[firstNotPrice]; if (model->getColumnStatus(jColumn) != ClpSimplex::basic && model->getColumnStatus(jColumn) != ClpSimplex::isFixed) break; } if (firstNotPrice > lastPrice) { assert (column[lastPrice] == iColumn); assert (column[firstNotPrice] == jColumn); // need to swap column[firstNotPrice] = iColumn; lookup[iColumn] = firstNotPrice; column[lastPrice] = jColumn; lookup[jColumn] = lastPrice; double * elementA = element + lastPrice * nel; int * rowA = row + lastPrice * nel; double * elementB = element + firstNotPrice * nel; int * rowB = row + firstNotPrice * nel; for (int i = 0; i < nel; i++) { int temp = rowA[i]; double tempE = elementA[i]; rowA[i] = rowB[i]; elementA[i] = elementB[i]; rowB[i] = temp; elementB[i] = tempE; } firstNotPrice--; lastPrice++; } else if (lastPrice == firstNotPrice) { // make sure correct side iColumn = column[lastPrice]; if (model->getColumnStatus(iColumn) != ClpSimplex::basic && model->getColumnStatus(iColumn) != ClpSimplex::isFixed) lastPrice++; break; } } block->numberPrice_ = lastPrice; #ifndef NDEBUG // check int i; for (i = 0; i < lastPrice; i++) { int iColumn = column[i]; assert (model->getColumnStatus(iColumn) != ClpSimplex::basic && model->getColumnStatus(iColumn) != ClpSimplex::isFixed); assert (lookup[iColumn] == i); } for (; i < numberInBlock; i++) { int iColumn = column[i]; assert (model->getColumnStatus(iColumn) == ClpSimplex::basic || model->getColumnStatus(iColumn) == ClpSimplex::isFixed); assert (lookup[iColumn] == i); } #endif } } // Swap one variable void ClpPackedMatrix3::swapOne(const ClpSimplex * model, const ClpPackedMatrix * matrix, int iColumn) { int * lookup = column_ + numberColumns_; // position in block int kA = lookup[iColumn]; if (kA < 0) return; // odd one // get matrix data pointers const CoinPackedMatrix * columnCopy = matrix->getPackedMatrix(); //const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); const double * elementByColumn = columnCopy->getElements(); CoinBigIndex start = columnStart[iColumn]; int n = columnLength[iColumn]; if (matrix->zeros()) { CoinBigIndex end = start + n; for (CoinBigIndex j = start; j < end; j++) { if(!elementByColumn[j]) n--; } } // find block - could do binary search int iBlock = CoinMin(n, numberBlocks_) - 1; while (block_[iBlock].numberElements_ != n) iBlock--; blockStruct * block = block_ + iBlock; int nel = block->numberElements_; int * row = row_ + block->startElements_; double * element = element_ + block->startElements_; int * column = column_ + block->startIndices_; assert (column[kA] == iColumn); bool moveUp = (model->getColumnStatus(iColumn) == ClpSimplex::basic || model->getColumnStatus(iColumn) == ClpSimplex::isFixed); int lastPrice = block->numberPrice_; int kB; if (moveUp) { // May already be in correct place (e.g. fixed basic leaving basis) if (kA >= lastPrice) return; kB = lastPrice - 1; block->numberPrice_--; } else { assert (kA >= lastPrice); kB = lastPrice; block->numberPrice_++; } int jColumn = column[kB]; column[kA] = jColumn; lookup[jColumn] = kA; column[kB] = iColumn; lookup[iColumn] = kB; double * elementA = element + kB * nel; int * rowA = row + kB * nel; double * elementB = element + kA * nel; int * rowB = row + kA * nel; int i; for (i = 0; i < nel; i++) { int temp = rowA[i]; double tempE = elementA[i]; rowA[i] = rowB[i]; elementA[i] = elementB[i]; rowB[i] = temp; elementB[i] = tempE; } #ifndef NDEBUG // check for (i = 0; i < block->numberPrice_; i++) { int iColumn = column[i]; if (iColumn != model->sequenceIn() && iColumn != model->sequenceOut()) assert (model->getColumnStatus(iColumn) != ClpSimplex::basic && model->getColumnStatus(iColumn) != ClpSimplex::isFixed); assert (lookup[iColumn] == i); } int numberInBlock = block->numberInBlock_; for (; i < numberInBlock; i++) { int iColumn = column[i]; if (iColumn != model->sequenceIn() && iColumn != model->sequenceOut()) assert (model->getColumnStatus(iColumn) == ClpSimplex::basic || model->getColumnStatus(iColumn) == ClpSimplex::isFixed); assert (lookup[iColumn] == i); } #endif } /* Return x * -1 * A in z. Note - x packed and z will be packed mode Squashes small elements and knows about ClpSimplex */ void ClpPackedMatrix3::transposeTimes(const ClpSimplex * model, const double * pi, CoinIndexedVector * output) const { int numberNonZero = 0; int * index = output->getIndices(); double * array = output->denseVector(); double zeroTolerance = model->zeroTolerance(); double value = 0.0; CoinBigIndex j; int numberOdd = block_->startIndices_; if (numberOdd) { // A) as probably long may be worth unrolling CoinBigIndex end = start_[1]; for (j = start_[0]; j < end; j++) { int iRow = row_[j]; value += pi[iRow] * element_[j]; } int iColumn; // int jColumn=column_[0]; for (iColumn = 0; iColumn < numberOdd - 1; iColumn++) { CoinBigIndex start = end; end = start_[iColumn+2]; if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = column_[iColumn]; //index[numberNonZero++]=jColumn; } // jColumn = column_[iColumn+1]; value = 0.0; //if (model->getColumnStatus(jColumn)!=ClpSimplex::basic) { for (j = start; j < end; j++) { int iRow = row_[j]; value += pi[iRow] * element_[j]; } //} } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = column_[iColumn]; //index[numberNonZero++]=jColumn; } } for (int iBlock = 0; iBlock < numberBlocks_; iBlock++) { // B) Can sort so just do nonbasic (and nonfixed) // C) Can do two at a time (if so put odd one into start_) // D) can use switch blockStruct * block = block_ + iBlock; //int numberPrice = block->numberInBlock_; int numberPrice = block->numberPrice_; int nel = block->numberElements_; int * row = row_ + block->startElements_; double * element = element_ + block->startElements_; int * column = column_ + block->startIndices_; #if 0 // two at a time if ((numberPrice & 1) != 0) { double value = 0.0; int nel2 = nel; for (; nel2; nel2--) { int iRow = *row++; value += pi[iRow] * (*element++); } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = *column; } column++; } numberPrice = numberPrice >> 1; switch ((nel % 2)) { // 2 k +0 case 0: for (; numberPrice; numberPrice--) { double value0 = 0.0; double value1 = 0.0; int nel2 = nel; for (; nel2; nel2--) { int iRow0 = *row; int iRow1 = *(row + nel); row++; double element0 = *element; double element1 = *(element + nel); element++; value0 += pi[iRow0] * element0; value1 += pi[iRow1] * element1; } row += nel; element += nel; if (fabs(value0) > zeroTolerance) { array[numberNonZero] = value0; index[numberNonZero++] = *column; } column++; if (fabs(value1) > zeroTolerance) { array[numberNonZero] = value1; index[numberNonZero++] = *column; } column++; } break; // 2 k +1 case 1: for (; numberPrice; numberPrice--) { double value0; double value1; int nel2 = nel - 1; { int iRow0 = row[0]; int iRow1 = row[nel]; double pi0 = pi[iRow0]; double pi1 = pi[iRow1]; value0 = pi0 * element[0]; value1 = pi1 * element[nel]; row++; element++; } for (; nel2; nel2--) { int iRow0 = *row; int iRow1 = *(row + nel); row++; double element0 = *element; double element1 = *(element + nel); element++; value0 += pi[iRow0] * element0; value1 += pi[iRow1] * element1; } row += nel; element += nel; if (fabs(value0) > zeroTolerance) { array[numberNonZero] = value0; index[numberNonZero++] = *column; } column++; if (fabs(value1) > zeroTolerance) { array[numberNonZero] = value1; index[numberNonZero++] = *column; } column++; } break; } #else for (; numberPrice; numberPrice--) { double value = 0.0; int nel2 = nel; for (; nel2; nel2--) { int iRow = *row++; value += pi[iRow] * (*element++); } if (fabs(value) > zeroTolerance) { array[numberNonZero] = value; index[numberNonZero++] = *column; } column++; } #endif } output->setNumElements(numberNonZero); } // Updates two arrays for steepest void ClpPackedMatrix3::transposeTimes2(const ClpSimplex * model, const double * pi, CoinIndexedVector * output, const double * piWeight, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor) { int numberNonZero = 0; int * index = output->getIndices(); double * array = output->denseVector(); double zeroTolerance = model->zeroTolerance(); double value = 0.0; bool killDjs = (scaleFactor == 0.0); if (!scaleFactor) scaleFactor = 1.0; int numberOdd = block_->startIndices_; int iColumn; CoinBigIndex end = start_[0]; for (iColumn = 0; iColumn < numberOdd; iColumn++) { CoinBigIndex start = end; CoinBigIndex j; int jColumn = column_[iColumn]; end = start_[iColumn+1]; value = 0.0; if (model->getColumnStatus(jColumn) != ClpSimplex::basic) { for (j = start; j < end; j++) { int iRow = row_[j]; value -= pi[iRow] * element_[j]; } if (fabs(value) > zeroTolerance) { // and do other array double modification = 0.0; for (j = start; j < end; j++) { int iRow = row_[j]; modification += piWeight[iRow] * element_[j]; } double thisWeight = weights[jColumn]; double pivot = value * scaleFactor; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(jColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[jColumn] = thisWeight; if (!killDjs) { array[numberNonZero] = value; index[numberNonZero++] = jColumn; } } } } for (int iBlock = 0; iBlock < numberBlocks_; iBlock++) { // B) Can sort so just do nonbasic (and nonfixed) // C) Can do two at a time (if so put odd one into start_) // D) can use switch blockStruct * block = block_ + iBlock; //int numberPrice = block->numberInBlock_; int numberPrice = block->numberPrice_; int nel = block->numberElements_; int * row = row_ + block->startElements_; double * element = element_ + block->startElements_; int * column = column_ + block->startIndices_; for (; numberPrice; numberPrice--) { double value = 0.0; int nel2 = nel; for (; nel2; nel2--) { int iRow = *row++; value -= pi[iRow] * (*element++); } if (fabs(value) > zeroTolerance) { int jColumn = *column; // back to beginning row -= nel; element -= nel; // and do other array double modification = 0.0; nel2 = nel; for (; nel2; nel2--) { int iRow = *row++; modification += piWeight[iRow] * (*element++); } double thisWeight = weights[jColumn]; double pivot = value * scaleFactor; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(jColumn)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[jColumn] = thisWeight; if (!killDjs) { array[numberNonZero] = value; index[numberNonZero++] = jColumn; } } column++; } } output->setNumElements(numberNonZero); output->setPackedMode(true); } #if COIN_LONG_WORK // For long double versions void ClpPackedMatrix::times(CoinWorkDouble scalar, const CoinWorkDouble * x, CoinWorkDouble * y) const { int iRow, iColumn; // get matrix data pointers const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const double * elementByColumn = matrix_->getElements(); //memset(y,0,matrix_->getNumRows()*sizeof(double)); assert (((flags_ & 2) != 0) == matrix_->hasGaps()); if (!(flags_ & 2)) { for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinWorkDouble value = x[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; value *= scalar; for (j = start; j < end; j++) { iRow = row[j]; y[iRow] += value * elementByColumn[j]; } } } } else { const int * columnLength = matrix_->getVectorLengths(); for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinWorkDouble value = x[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; value *= scalar; for (j = start; j < end; j++) { iRow = row[j]; y[iRow] += value * elementByColumn[j]; } } } } } void ClpPackedMatrix::transposeTimes(CoinWorkDouble scalar, const CoinWorkDouble * x, CoinWorkDouble * y) const { int iColumn; // get matrix data pointers const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const double * elementByColumn = matrix_->getElements(); if (!(flags_ & 2)) { if (scalar == -1.0) { CoinBigIndex start = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinBigIndex next = columnStart[iColumn+1]; CoinWorkDouble value = y[iColumn]; for (j = start; j < next; j++) { int jRow = row[j]; value -= x[jRow] * elementByColumn[j]; } start = next; y[iColumn] = value; } } else { CoinBigIndex start = columnStart[0]; for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinBigIndex next = columnStart[iColumn+1]; CoinWorkDouble value = 0.0; for (j = start; j < next; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j]; } start = next; y[iColumn] += value * scalar; } } } else { const int * columnLength = matrix_->getVectorLengths(); for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) { CoinBigIndex j; CoinWorkDouble value = 0.0; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (j = start; j < end; j++) { int jRow = row[j]; value += x[jRow] * elementByColumn[j]; } y[iColumn] += value * scalar; } } } #endif #ifdef CLP_ALL_ONE_FILE #undef reference #endif CoinMP-1.8.3/Clp/src/AbcSimplexParallel.cpp0000644000175000017500000030067512432624666017057 0ustar renerene/* $Id: AbcSimplexParallel.cpp 2070 2014-11-18 11:12:54Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #include "AbcSimplexDual.hpp" #include "ClpEventHandler.hpp" #include "AbcSimplexFactorization.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "CoinFloatEqual.hpp" #include "AbcDualRowDantzig.hpp" #include "ClpMessage.hpp" #include "ClpLinearObjective.hpp" #include #include #include #include #include //#undef AVX2 #define _mm256_broadcast_sd(x) static_cast<__m256d> (__builtin_ia32_vbroadcastsd256 (x)) #define _mm256_load_pd(x) *(__m256d *)(x) #define _mm256_store_pd (s, x) *((__m256d *)s)=x //#define ABC_DEBUG 2 /* Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations */ int AbcSimplexDual::whileIteratingSerial() { /* arrays 0 - to get tableau row and then for weights update 1 - tableau column 2 - for flip 3 - actual tableau row */ #ifdef CLP_DEBUG int debugIteration = -1; #endif // if can't trust much and long way from optimal then relax //if (largestPrimalError_ > 10.0) //abcFactorization_->relaxAccuracyCheck(CoinMin(1.0e2, largestPrimalError_ / 10.0)); //else //abcFactorization_->relaxAccuracyCheck(1.0); // status stays at -1 while iterating, >=0 finished, -2 to invert // status -3 to go to top without an invert int returnCode = -1; #define DELAYED_UPDATE arrayForBtran_=0; setUsedArray(arrayForBtran_); arrayForFtran_=1; setUsedArray(arrayForFtran_); arrayForFlipBounds_=2; setUsedArray(arrayForFlipBounds_); arrayForTableauRow_=3; setUsedArray(arrayForTableauRow_); arrayForDualColumn_=4; setUsedArray(arrayForDualColumn_); arrayForReplaceColumn_=4; //4; arrayForFlipRhs_=5; setUsedArray(arrayForFlipRhs_); dualPivotRow(); lastPivotRow_=pivotRow_; if (pivotRow_ >= 0) { // we found a pivot row createDualPricingVectorSerial(); do { #if ABC_DEBUG checkArrays(); #endif /* -1 - just move dual in values pass 0 - take iteration 1 - don't take but continue 2 - don't take and break */ stateOfIteration_=0; returnCode=-1; // put row of tableau in usefulArray[arrayForTableauRow_] /* Could a) copy [arrayForBtran_] and start off updateWeights earlier b) break transposeTimes into two and do after slack part c) also think if cleaner to go all way with update but just don't do final part */ //upperTheta=COIN_DBL_MAX; double saveAcceptable=acceptablePivot_; if (largestPrimalError_>1.0e-5||largestDualError_>1.0e-5) { if (!abcFactorization_->pivots()) acceptablePivot_*=1.0e2; else if (abcFactorization_->pivots()<5) acceptablePivot_*=1.0e1; } dualColumn1(); acceptablePivot_=saveAcceptable; if ((stateOfProblem_&VALUES_PASS)!=0) { // see if can just move dual if (fabs(upperTheta_-fabs(abcDj_[sequenceOut_]))= 0) { // normal iteration // update the incoming column (and do weights) getTableauColumnFlipAndStartReplaceSerial(); } else if (stateOfIteration_!=-1) { stateOfIteration_=2; } } if (!stateOfIteration_) { // assert (stateOfIteration_!=1); int whatNext=0; whatNext = housekeeping(); if (whatNext == 1) { problemStatus_ = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent problemStatus_ = 3; returnCode = 3; stateOfIteration_=2; } if (problemStatus_==-1) { replaceColumnPart3(); //clearArrays(arrayForReplaceColumn_); #if ABC_DEBUG checkArrays(); #endif updateDualsInDual(); abcDualRowPivot_->updatePrimalSolutionAndWeights(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_], movement_); #if ABC_DEBUG checkArrays(); #endif } else { abcDualRowPivot_->updateWeights2(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_]); //clearArrays(arrayForBtran_); //clearArrays(arrayForFtran_); } } else { if (stateOfIteration_<0) { // move dual in dual values pass theta_=abcDj_[sequenceOut_]; updateDualsInDual(); abcDj_[sequenceOut_]=0.0; sequenceOut_=-1; } // clear all arrays clearArrays(-1); //sequenceIn_=-1; //sequenceOut_=-1; } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 4; stateOfIteration_=2; } } // at this stage sequenceIn_ may be <0 if (sequenceIn_<0&&sequenceOut_>=0) { // no incoming column is valid returnCode=noPivotColumn(); } if (stateOfIteration_==2) { sequenceIn_=-1; break; } swapPrimalStuff(); if (problemStatus_!=-1) { break; } // dualRow will go to virtual row pivot choice algorithm // make sure values pass off if it should be // use Btran array and clear inside dualPivotRow (if used) int lastSequenceOut=sequenceOut_; int lastDirectionOut=directionOut_; dualPivotRow(); lastPivotRow_=pivotRow_; if (pivotRow_ >= 0) { // we found a pivot row // create as packed createDualPricingVectorSerial(); swapDualStuff(lastSequenceOut,lastDirectionOut); // next pivot } else { // no pivot row clearArrays(-1); returnCode=noPivotRow(); break; } } while (problemStatus_ == -1); usefulArray_[arrayForTableauRow_].compact(); #if ABC_DEBUG checkArrays(); #endif } else { // no pivot row on first try clearArrays(-1); returnCode=noPivotRow(); } //printStuff(); clearArrays(-1); //if (pivotRow_==-100) //returnCode=-100; // end of values pass return returnCode; } // Create dual pricing vector void AbcSimplexDual::createDualPricingVectorSerial() { #ifndef NDEBUG #if ABC_NORMAL_DEBUG>3 checkArrays(); #endif #endif // we found a pivot row if (handler_->detail(CLP_SIMPLEX_PIVOTROW, messages_) < 100) { handler_->message(CLP_SIMPLEX_PIVOTROW, messages_) << pivotRow_ << CoinMessageEol; } // check accuracy of weights abcDualRowPivot_->checkAccuracy(); // get sign for finding row of tableau // create as packed usefulArray_[arrayForBtran_].createOneUnpackedElement(pivotRow_, -directionOut_); abcFactorization_->updateColumnTranspose(usefulArray_[arrayForBtran_]); sequenceIn_ = -1; } void AbcSimplexDual::getTableauColumnPart1Serial() { #if ABC_DEBUG { const double * work=usefulArray_[arrayForTableauRow_].denseVector(); int number=usefulArray_[arrayForTableauRow_].getNumElements(); const int * which=usefulArray_[arrayForTableauRow_].getIndices(); for (int i=0;iupdateWeights1(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_]); } int AbcSimplexDual::getTableauColumnFlipAndStartReplaceSerial() { // move checking stuff down into called functions int numberFlipped; numberFlipped=flipBounds(); // update the incoming column getTableauColumnPart1Serial(); checkReplacePart1(); //checkReplacePart1a(); //checkReplacePart1b(); getTableauColumnPart2(); //usefulArray_[arrayForTableauRow_].compact(); // returns 3 if skip this iteration and re-factorize /* return code 0 - OK 2 - flag something and skip 3 - break and re-factorize 4 - break and say infeasible */ int returnCode=0; // amount primal will move movement_ = -dualOut_ * directionOut_ / alpha_; // see if update stable #if ABC_NORMAL_DEBUG>3 if ((handler_->logLevel() & 32)) { double ft=ftAlpha_*abcFactorization_->pivotRegion()[pivotRow_]; double diff1=fabs(alpha_-btranAlpha_); double diff2=fabs(fabs(alpha_)-fabs(ft)); double diff3=fabs(fabs(ft)-fabs(btranAlpha_)); double largest=CoinMax(CoinMax(diff1,diff2),diff3); printf("btran alpha %g, ftran alpha %g ftAlpha %g largest diff %g\n", btranAlpha_, alpha_,ft,largest); if (largest>0.001*fabs(alpha_)) { printf("bad\n"); } } #endif int numberPivots=abcFactorization_->pivots(); //double checkValue = 1.0e-7; // numberPivots<5 ? 1.0e-7 : 1.0e-6; double checkValue = numberPivots ? 1.0e-7 : 1.0e-5; // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) checkValue = CoinMin(1.0e-4, 1.0e-8 * largestPrimalError_); if (fabs(btranAlpha_) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha_ - alpha_) > checkValue*(1.0 + fabs(alpha_))) { handler_->message(CLP_DUAL_CHECK, messages_) << btranAlpha_ << alpha_ << CoinMessageEol; // see with more relaxed criterion double test; if (fabs(btranAlpha_) < 1.0e-8 || fabs(alpha_) < 1.0e-8) test = 1.0e-1 * fabs(alpha_); else test = 10.0*checkValue;//1.0e-4 * (1.0 + fabs(alpha_)); bool needFlag = (fabs(btranAlpha_) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha_ - alpha_) > test); double derror = CoinMin(fabs(btranAlpha_ - alpha_)/(1.0 + fabs(alpha_)),1.0)*0.9999e7; int error=0; while (derror>1.0) { error++; derror *= 0.1; } int frequency[8]={99999999,100,10,2,1,1,1,1}; int newFactorFrequency=CoinMin(forceFactorization_,frequency[error]); #if ABC_NORMAL_DEBUG>0 if (newFactorFrequency0.5e-6 &&abcFactorization_->pivotTolerance()<0.5) abcFactorization_->saferTolerances (1.0, -1.03); forceFactorization_=newFactorFrequency; #if ABC_NORMAL_DEBUG>0 if (fabs(btranAlpha_ + alpha_) < 1.0e-5*(1.0 + fabs(alpha_))) { printf("diff (%g,%g) %g check %g\n",btranAlpha_,alpha_,fabs(btranAlpha_-alpha_),checkValue*(1.0+fabs(alpha_))); } #endif if (numberPivots) { if (needFlag&&numberPivots<10) { // need to reject something assert (sequenceOut_>=0); char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>0 printf("flag %d as alpha %g %g - after %d pivots\n", sequenceOut_, btranAlpha_, alpha_,numberPivots); #endif // Make safer? abcFactorization_->saferTolerances (1.0, -1.03); setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; lastBadIteration_ = numberIterations_; // say be more cautious } // Make safer? //if (numberPivots<5) //abcFactorization_->saferTolerances (-0.99, -1.01); problemStatus_ = -2; // factorize now returnCode = -2; stateOfIteration_=2; } else { if (needFlag) { assert (sequenceOut_>=0); // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>3 printf("flag a %g %g\n", btranAlpha_, alpha_); #endif setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; //abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious if (fabs(alpha_) < 1.0e-10 && fabs(btranAlpha_) < 1.0e-8 && numberIterations_ > 100) { //printf("I think should declare infeasible\n"); problemStatus_ = 1; returnCode = 1; stateOfIteration_=2; } else { stateOfIteration_=1; } // Make safer? if (abcFactorization_->pivotTolerance()<0.999&&stateOfIteration_==1) { // change tolerance and re-invert abcFactorization_->saferTolerances (1.0, -1.03); problemStatus_ = -6; // factorize now returnCode = -2; stateOfIteration_=2; } } } } if (!stateOfIteration_) { // check update //int updateStatus = /* returns 0 - OK 1 - take iteration then re-factorize 2 - flag something and skip 3 - break and re-factorize 5 - take iteration then re-factorize because of memory */ int status=checkReplace(); if (status&&!returnCode) returnCode=status; } //clearArrays(arrayForFlipRhs_); if (stateOfIteration_&&numberFlipped) { //usefulArray_[arrayForTableauRow_].compact(); // move variables back flipBack(numberFlipped); } // could choose average of all three return returnCode; } #if ABC_PARALLEL==1 /* Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations */ int AbcSimplexDual::whileIteratingThread() { /* arrays 0 - to get tableau row and then for weights update 1 - tableau column 2 - for flip 3 - actual tableau row */ #ifdef CLP_DEBUG int debugIteration = -1; #endif // if can't trust much and long way from optimal then relax //if (largestPrimalError_ > 10.0) //abcFactorization_->relaxAccuracyCheck(CoinMin(1.0e2, largestPrimalError_ / 10.0)); //else //abcFactorization_->relaxAccuracyCheck(1.0); // status stays at -1 while iterating, >=0 finished, -2 to invert // status -3 to go to top without an invert int returnCode = -1; #define DELAYED_UPDATE arrayForBtran_=0; setUsedArray(arrayForBtran_); arrayForFtran_=1; setUsedArray(arrayForFtran_); arrayForFlipBounds_=2; setUsedArray(arrayForFlipBounds_); arrayForTableauRow_=3; setUsedArray(arrayForTableauRow_); arrayForDualColumn_=4; setUsedArray(arrayForDualColumn_); arrayForReplaceColumn_=4; //4; arrayForFlipRhs_=5; setUsedArray(arrayForFlipRhs_); dualPivotRow(); lastPivotRow_=pivotRow_; if (pivotRow_ >= 0) { // we found a pivot row createDualPricingVectorThread(); do { #if ABC_DEBUG checkArrays(); #endif /* -1 - just move dual in values pass 0 - take iteration 1 - don't take but continue 2 - don't take and break */ stateOfIteration_=0; returnCode=-1; // put row of tableau in usefulArray[arrayForTableauRow_] /* Could a) copy [arrayForBtran_] and start off updateWeights earlier b) break transposeTimes into two and do after slack part c) also think if cleaner to go all way with update but just don't do final part */ //upperTheta=COIN_DBL_MAX; double saveAcceptable=acceptablePivot_; if (largestPrimalError_>1.0e-5||largestDualError_>1.0e-5) { if (!abcFactorization_->pivots()) acceptablePivot_*=1.0e2; else if (abcFactorization_->pivots()<5) acceptablePivot_*=1.0e1; } dualColumn1(); acceptablePivot_=saveAcceptable; if ((stateOfProblem_&VALUES_PASS)!=0) { // see if can just move dual if (fabs(upperTheta_-fabs(abcDj_[sequenceOut_]))= 0) { // normal iteration // update the incoming column (and do weights if serial) getTableauColumnFlipAndStartReplaceThread(); //usleep(1000); } else if (stateOfIteration_!=-1) { stateOfIteration_=2; } } if (parallelMode_!=0) { // do sync here stopParallelStuff(2); } if (!stateOfIteration_) { // assert (stateOfIteration_!=1); int whatNext=0; whatNext = housekeeping(); if (whatNext == 1) { problemStatus_ = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent problemStatus_ = 3; returnCode = 3; stateOfIteration_=2; } } else { if (stateOfIteration_<0) { // move dual in dual values pass theta_=abcDj_[sequenceOut_]; updateDualsInDual(); abcDj_[sequenceOut_]=0.0; sequenceOut_=-1; } // clear all arrays clearArrays(-1); } // at this stage sequenceIn_ may be <0 if (sequenceIn_<0&&sequenceOut_>=0) { // no incoming column is valid returnCode=noPivotColumn(); } if (stateOfIteration_==2) { sequenceIn_=-1; break; } if (problemStatus_!=-1) { abcDualRowPivot_->updateWeights2(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_]); swapPrimalStuff(); break; } #if ABC_DEBUG checkArrays(); #endif if (stateOfIteration_!=-1) { assert (stateOfIteration_==0); // if 1 why are we here // can do these in parallel if (parallelMode_==0) { replaceColumnPart3(); updateDualsInDual(); abcDualRowPivot_->updatePrimalSolutionAndWeights(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_], movement_); } else { stopStart_=1+32*1; startParallelStuff(3); if (parallelMode_>1) { stopStart_=2+32*2; startParallelStuff(9); } else { replaceColumnPart3(); } abcDualRowPivot_->updatePrimalSolutionAndWeights(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_], movement_); } } #if ABC_DEBUG checkArrays(); #endif swapPrimalStuff(); // dualRow will go to virtual row pivot choice algorithm // make sure values pass off if it should be // use Btran array and clear inside dualPivotRow (if used) int lastSequenceOut=sequenceOut_; int lastDirectionOut=directionOut_; // redo to test on parallelMode_ if (parallelMode_>1) { stopStart_=2+32*2; // stop factorization update //stopStart_=3+32*3; // stop all stopParallelStuff(9); } dualPivotRow(); lastPivotRow_=pivotRow_; if (pivotRow_ >= 0) { // we found a pivot row // create as packed createDualPricingVectorThread(); swapDualStuff(lastSequenceOut,lastDirectionOut); // next pivot // redo to test on parallelMode_ if (parallelMode_!=0) { stopStart_=1+32*1; // stop dual update stopParallelStuff(3); } } else { // no pivot row // redo to test on parallelMode_ if (parallelMode_!=0) { stopStart_=1+32*1; // stop dual update stopParallelStuff(3); } clearArrays(-1); returnCode=noPivotRow(); break; } } while (problemStatus_ == -1); usefulArray_[arrayForTableauRow_].compact(); #if ABC_DEBUG checkArrays(); #endif } else { // no pivot row on first try clearArrays(-1); returnCode=noPivotRow(); } //printStuff(); clearArrays(-1); //if (pivotRow_==-100) //returnCode=-100; // end of values pass return returnCode; } // Create dual pricing vector void AbcSimplexDual::createDualPricingVectorThread() { #ifndef NDEBUG #if ABC_NORMAL_DEBUG>3 checkArrays(); #endif #endif // we found a pivot row if (handler_->detail(CLP_SIMPLEX_PIVOTROW, messages_) < 100) { handler_->message(CLP_SIMPLEX_PIVOTROW, messages_) << pivotRow_ << CoinMessageEol; } // check accuracy of weights abcDualRowPivot_->checkAccuracy(); // get sign for finding row of tableau // create as packed usefulArray_[arrayForBtran_].createOneUnpackedElement(pivotRow_, -directionOut_); abcFactorization_->updateColumnTranspose(usefulArray_[arrayForBtran_]); sequenceIn_ = -1; } void AbcSimplexDual::getTableauColumnPart1Thread() { #if ABC_DEBUG { const double * work=usefulArray_[arrayForTableauRow_].denseVector(); int number=usefulArray_[arrayForTableauRow_].getNumElements(); const int * which=usefulArray_[arrayForTableauRow_].getIndices(); for (int i=0;iupdateColumnFTPart1(usefulArray_[arrayForFtran_]); // pivot element //alpha_ = usefulArray_[arrayForFtran_].denseVector()[pivotRow_]; } else { alpha_ = abcDualRowPivot_->updateWeights1(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_]); } } int AbcSimplexDual::getTableauColumnFlipAndStartReplaceThread() { // move checking stuff down into called functions // threads 2 and 3 are available int numberFlipped; if (parallelMode_==0) { numberFlipped=flipBounds(); // update the incoming column getTableauColumnPart1Thread(); checkReplacePart1(); //checkReplacePart1a(); //checkReplacePart1b(); getTableauColumnPart2(); } else { // save stopStart int saveStopStart=stopStart_; if (parallelMode_>1) { // we can flip immediately stopStart_=2+32*2; // just thread 1 startParallelStuff(8); // update the incoming column getTableauColumnPart1Thread(); stopStart_=4+32*4; // just thread 2 startParallelStuff(7); getTableauColumnPart2(); stopStart_=6+32*6; // just threads 1 and 2 stopParallelStuff(8); //ftAlpha_=threadInfo_[2].result; } else { // just one extra thread - do replace // update the incoming column getTableauColumnPart1Thread(); stopStart_=2+32*2; // just thread 1 startParallelStuff(7); getTableauColumnPart2(); numberFlipped=flipBounds(); stopParallelStuff(8); //ftAlpha_=threadInfo_[1].result; } stopStart_=saveStopStart; } //usefulArray_[arrayForTableauRow_].compact(); // returns 3 if skip this iteration and re-factorize /* return code 0 - OK 2 - flag something and skip 3 - break and re-factorize 4 - break and say infeasible */ int returnCode=0; // amount primal will move movement_ = -dualOut_ * directionOut_ / alpha_; // see if update stable #if ABC_NORMAL_DEBUG>3 if ((handler_->logLevel() & 32)) { double ft=ftAlpha_*abcFactorization_->pivotRegion()[pivotRow_]; double diff1=fabs(alpha_-btranAlpha_); double diff2=fabs(fabs(alpha_)-fabs(ft)); double diff3=fabs(fabs(ft)-fabs(btranAlpha_)); double largest=CoinMax(CoinMax(diff1,diff2),diff3); printf("btran alpha %g, ftran alpha %g ftAlpha %g largest diff %g\n", btranAlpha_, alpha_,ft,largest); if (largest>0.001*fabs(alpha_)) { printf("bad\n"); } } #endif int numberPivots=abcFactorization_->pivots(); //double checkValue = 1.0e-7; // numberPivots<5 ? 1.0e-7 : 1.0e-6; double checkValue = numberPivots ? 1.0e-7 : 1.0e-5; // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) checkValue = CoinMin(1.0e-4, 1.0e-8 * largestPrimalError_); if (fabs(btranAlpha_) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha_ - alpha_) > checkValue*(1.0 + fabs(alpha_))) { handler_->message(CLP_DUAL_CHECK, messages_) << btranAlpha_ << alpha_ << CoinMessageEol; // see with more relaxed criterion double test; if (fabs(btranAlpha_) < 1.0e-8 || fabs(alpha_) < 1.0e-8) test = 1.0e-1 * fabs(alpha_); else test = 10.0*checkValue;//1.0e-4 * (1.0 + fabs(alpha_)); bool needFlag = (fabs(btranAlpha_) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha_ - alpha_) > test); double derror = CoinMin(fabs(btranAlpha_ - alpha_)/(1.0 + fabs(alpha_)),1.0)*0.9999e7; int error=0; while (derror>1.0) { error++; derror *= 0.1; } int frequency[8]={99999999,100,10,2,1,1,1,1}; int newFactorFrequency=CoinMin(forceFactorization_,frequency[error]); #if ABC_NORMAL_DEBUG>0 if (newFactorFrequency0.5e-6 &&abcFactorization_->pivotTolerance()<0.5) abcFactorization_->saferTolerances (1.0, -1.03); forceFactorization_=newFactorFrequency; #if ABC_NORMAL_DEBUG>0 if (fabs(btranAlpha_ + alpha_) < 1.0e-5*(1.0 + fabs(alpha_))) { printf("diff (%g,%g) %g check %g\n",btranAlpha_,alpha_,fabs(btranAlpha_-alpha_),checkValue*(1.0+fabs(alpha_))); } #endif if (numberPivots) { if (needFlag&&numberPivots<10) { // need to reject something assert (sequenceOut_>=0); char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>0 printf("flag %d as alpha %g %g - after %d pivots\n", sequenceOut_, btranAlpha_, alpha_,numberPivots); #endif // Make safer? abcFactorization_->saferTolerances (1.0, -1.03); setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; lastBadIteration_ = numberIterations_; // say be more cautious } // Make safer? //if (numberPivots<5) //abcFactorization_->saferTolerances (-0.99, -1.01); problemStatus_ = -2; // factorize now returnCode = -2; stateOfIteration_=2; } else { if (needFlag) { assert (sequenceOut_>=0); // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>3 printf("flag a %g %g\n", btranAlpha_, alpha_); #endif setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; //abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious if (fabs(alpha_) < 1.0e-10 && fabs(btranAlpha_) < 1.0e-8 && numberIterations_ > 100) { //printf("I think should declare infeasible\n"); problemStatus_ = 1; returnCode = 1; stateOfIteration_=2; } else { stateOfIteration_=1; } // Make safer? if (abcFactorization_->pivotTolerance()<0.999&&stateOfIteration_==1) { // change tolerance and re-invert abcFactorization_->saferTolerances (1.0, -1.03); problemStatus_ = -6; // factorize now returnCode = -2; stateOfIteration_=2; } } } } if (!stateOfIteration_) { // check update //int updateStatus = /* returns 0 - OK 1 - take iteration then re-factorize 2 - flag something and skip 3 - break and re-factorize 5 - take iteration then re-factorize because of memory */ int status=checkReplace(); if (status&&!returnCode) returnCode=status; } //clearArrays(arrayForFlipRhs_); if (stateOfIteration_&&numberFlipped) { //usefulArray_[arrayForTableauRow_].compact(); // move variables back flipBack(numberFlipped); } // could choose average of all three return returnCode; } #endif #if ABC_PARALLEL==2 #if ABC_NORMAL_DEBUG>0 // for conflicts int cilk_conflict=0; #endif #ifdef EARLY_FACTORIZE static int doEarlyFactorization(AbcSimplexDual * dual) { int returnCode=cilk_spawn dual->whileIteratingParallel(123456789); CoinIndexedVector & vector = *dual->usefulArray(ABC_NUMBER_USEFUL-1); int status=dual->earlyFactorization()->factorize(dual,vector); #if 0 // Is this safe if (!status&&true) { // do pivots if there are any int capacity = vector.capacity(); capacity--; int numberPivotsStored = vector.getIndices()[capacity]; status = dual->earlyFactorization()->replaceColumns(dual,vector, 0,numberPivotsStored,false); } #endif if (status) { printf("bad early factorization in doEarly - switch off\n"); vector.setNumElements(-1); } cilk_sync; return returnCode; } #endif #define MOVE_UPDATE_WEIGHTS /* Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations */ int AbcSimplexDual::whileIteratingCilk() { /* arrays 0 - to get tableau row and then for weights update 1 - tableau column 2 - for flip 3 - actual tableau row */ #ifdef CLP_DEBUG int debugIteration = -1; #endif // if can't trust much and long way from optimal then relax //if (largestPrimalError_ > 10.0) //abcFactorization_->relaxAccuracyCheck(CoinMin(1.0e2, largestPrimalError_ / 10.0)); //else //abcFactorization_->relaxAccuracyCheck(1.0); // status stays at -1 while iterating, >=0 finished, -2 to invert // status -3 to go to top without an invert int returnCode = -1; #define DELAYED_UPDATE arrayForBtran_=0; setUsedArray(arrayForBtran_); arrayForFtran_=1; setUsedArray(arrayForFtran_); arrayForFlipBounds_=2; setUsedArray(arrayForFlipBounds_); arrayForTableauRow_=3; setUsedArray(arrayForTableauRow_); arrayForDualColumn_=4; setUsedArray(arrayForDualColumn_); arrayForReplaceColumn_=6; //4; setUsedArray(arrayForReplaceColumn_); #ifndef MOVE_UPDATE_WEIGHTS arrayForFlipRhs_=5; setUsedArray(arrayForFlipRhs_); #else arrayForFlipRhs_=0; // use for weights setUsedArray(5); #endif dualPivotRow(); lastPivotRow_=pivotRow_; if (pivotRow_ >= 0) { // we found a pivot row createDualPricingVectorCilk(); // ABC_PARALLEL 2 #if 0 { for (int i=0;i=0) printf("%d status %d l %g,%g u %g,%g\n",iSequence,internalStatus_[iSequence], abcLower_[iSequence],lowerSaved_[iSequence], abcUpper_[iSequence],upperSaved_[iSequence]); } #endif int numberPivots = abcFactorization_->maximumPivots(); #ifdef EARLY_FACTORIZE int numberEarly=0; if (numberPivots>20&&(numberEarly_&0xffff)>5) { numberEarly=numberEarly_&0xffff; numberPivots=CoinMax(numberPivots-numberEarly-abcFactorization_->pivots(),numberPivots/2); } returnCode=whileIteratingParallel(numberPivots); if (returnCode==-99) { if (numberEarly) { if (!abcEarlyFactorization_) abcEarlyFactorization_ = new AbcSimplexFactorization(*abcFactorization_); // create pivot list CoinIndexedVector & vector = usefulArray_[ABC_NUMBER_USEFUL-1]; vector.checkClear(); int * indices = vector.getIndices(); int capacity = vector.capacity(); int numberNeeded=numberRows_+2*numberEarly+1; if (capacity=numberRows_) indices[numberBasic++]=iSequence; } assert (numberBasic==numberRows_); indices[capacity-1]=0; // could set iterations to -1 for safety #if 0 cilk_spawn doEarlyFactorization(this); returnCode=whileIteratingParallel(123456789); cilk_sync; #else returnCode=doEarlyFactorization(this); #endif } else { returnCode=whileIteratingParallel(123456789); } } #else returnCode=whileIteratingParallel(numberPivots); #endif usefulArray_[arrayForTableauRow_].compact(); #if ABC_DEBUG checkArrays(); #endif } else { // no pivot row on first try clearArrays(-1); returnCode=noPivotRow(); } //printStuff(); clearArrays(-1); //if (pivotRow_==-100) //returnCode=-100; // end of values pass return returnCode; } // Create dual pricing vector void AbcSimplexDual::createDualPricingVectorCilk() { #if CILK_CONFLICT>0 if(cilk_conflict&15!=0) { printf("cilk_conflict %d!\n",cilk_conflict); cilk_conflict=0; } #endif #ifndef NDEBUG #if ABC_NORMAL_DEBUG>3 checkArrays(); #endif #endif // we found a pivot row if (handler_->detail(CLP_SIMPLEX_PIVOTROW, messages_) < 100) { handler_->message(CLP_SIMPLEX_PIVOTROW, messages_) << pivotRow_ << CoinMessageEol; } // check accuracy of weights abcDualRowPivot_->checkAccuracy(); // get sign for finding row of tableau // create as packed #if MOVE_REPLACE_PART1A > 0 if (!abcFactorization_->usingFT()) { #endif usefulArray_[arrayForBtran_].createOneUnpackedElement(pivotRow_, -directionOut_); abcFactorization_->updateColumnTranspose(usefulArray_[arrayForBtran_]); #if MOVE_REPLACE_PART1A > 0 } else { cilk_spawn abcFactorization_->checkReplacePart1a(&usefulArray_[arrayForReplaceColumn_],pivotRow_); usefulArray_[arrayForBtran_].createOneUnpackedElement(pivotRow_, -directionOut_); abcFactorization_->updateColumnTransposeCpu(usefulArray_[arrayForBtran_],1); cilk_sync; } #endif sequenceIn_ = -1; } void AbcSimplexDual::getTableauColumnPart1Cilk() { #if ABC_DEBUG { const double * work=usefulArray_[arrayForTableauRow_].denseVector(); int number=usefulArray_[arrayForTableauRow_].getNumElements(); const int * which=usefulArray_[arrayForTableauRow_].getIndices(); for (int i=0;iupdateColumnFTPart1(usefulArray_[arrayForFtran_]); } int AbcSimplexDual::getTableauColumnFlipAndStartReplaceCilk() { // move checking stuff down into called functions // threads 2 and 3 are available int numberFlipped; //cilk getTableauColumnPart1Cilk(); #if MOVE_REPLACE_PART1A <= 0 cilk_spawn getTableauColumnPart2(); #if MOVE_REPLACE_PART1A == 0 cilk_spawn checkReplacePart1(); #endif numberFlipped=flipBounds(); cilk_sync; #else if (abcFactorization_->usingFT()) { cilk_spawn getTableauColumnPart2(); ftAlpha_ = cilk_spawn abcFactorization_->checkReplacePart1b(&usefulArray_[arrayForReplaceColumn_],pivotRow_); numberFlipped=flipBounds(); cilk_sync; } else { cilk_spawn getTableauColumnPart2(); numberFlipped=flipBounds(); cilk_sync; } #endif //usefulArray_[arrayForTableauRow_].compact(); // returns 3 if skip this iteration and re-factorize /* return code 0 - OK 2 - flag something and skip 3 - break and re-factorize 4 - break and say infeasible */ int returnCode=0; // amount primal will move movement_ = -dualOut_ * directionOut_ / alpha_; // see if update stable #if ABC_NORMAL_DEBUG>3 if ((handler_->logLevel() & 32)) { double ft=ftAlpha_*abcFactorization_->pivotRegion()[pivotRow_]; double diff1=fabs(alpha_-btranAlpha_); double diff2=fabs(fabs(alpha_)-fabs(ft)); double diff3=fabs(fabs(ft)-fabs(btranAlpha_)); double largest=CoinMax(CoinMax(diff1,diff2),diff3); printf("btran alpha %g, ftran alpha %g ftAlpha %g largest diff %g\n", btranAlpha_, alpha_,ft,largest); if (largest>0.001*fabs(alpha_)) { printf("bad\n"); } } #endif int numberPivots=abcFactorization_->pivots(); //double checkValue = 1.0e-7; // numberPivots<5 ? 1.0e-7 : 1.0e-6; double checkValue = numberPivots ? 1.0e-7 : 1.0e-5; // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) checkValue = CoinMin(1.0e-4, 1.0e-8 * largestPrimalError_); if (fabs(btranAlpha_) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha_ - alpha_) > checkValue*(1.0 + fabs(alpha_))) { handler_->message(CLP_DUAL_CHECK, messages_) << btranAlpha_ << alpha_ << CoinMessageEol; // see with more relaxed criterion double test; if (fabs(btranAlpha_) < 1.0e-8 || fabs(alpha_) < 1.0e-8) test = 1.0e-1 * fabs(alpha_); else test = CoinMin(10.0*checkValue,1.0e-4 * (1.0 + fabs(alpha_))); bool needFlag = (fabs(btranAlpha_) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha_ - alpha_) > test); double derror = CoinMin(fabs(btranAlpha_ - alpha_)/(1.0 + fabs(alpha_)),1.0)*0.9999e7; int error=0; while (derror>1.0) { error++; derror *= 0.1; } int frequency[8]={99999999,100,10,2,1,1,1,1}; int newFactorFrequency=CoinMin(forceFactorization_,frequency[error]); #if ABC_NORMAL_DEBUG>0 if (newFactorFrequency0.5e-6 &&abcFactorization_->pivotTolerance()<0.5) abcFactorization_->saferTolerances (1.0, -1.03); forceFactorization_=newFactorFrequency; #if ABC_NORMAL_DEBUG>0 if (fabs(btranAlpha_ + alpha_) < 1.0e-5*(1.0 + fabs(alpha_))) { printf("diff (%g,%g) %g check %g\n",btranAlpha_,alpha_,fabs(btranAlpha_-alpha_),checkValue*(1.0+fabs(alpha_))); } #endif if (numberPivots) { if (needFlag&&numberPivots<10) { // need to reject something assert (sequenceOut_>=0); char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>0 printf("flag %d as alpha %g %g - after %d pivots\n", sequenceOut_, btranAlpha_, alpha_,numberPivots); #endif // Make safer? abcFactorization_->saferTolerances (1.0, -1.03); setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; lastBadIteration_ = numberIterations_; // say be more cautious } // Make safer? //if (numberPivots<5) //abcFactorization_->saferTolerances (-0.99, -1.01); problemStatus_ = -2; // factorize now returnCode = -2; stateOfIteration_=2; } else { if (needFlag) { assert (sequenceOut_>=0); // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #if ABC_NORMAL_DEBUG>3 printf("flag a %g %g\n", btranAlpha_, alpha_); #endif setFlagged(sequenceOut_); // so can't happen immediately again sequenceOut_=-1; //abcProgress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious if (fabs(alpha_) < 1.0e-10 && fabs(btranAlpha_) < 1.0e-8 && numberIterations_ > 100) { //printf("I think should declare infeasible\n"); problemStatus_ = 1; returnCode = 1; stateOfIteration_=2; } else { stateOfIteration_=1; } // Make safer? if (abcFactorization_->pivotTolerance()<0.999&&stateOfIteration_==1) { // change tolerance and re-invert abcFactorization_->saferTolerances (1.0, -1.03); problemStatus_ = -6; // factorize now returnCode = -2; stateOfIteration_=2; } } } } if (!stateOfIteration_) { // check update //int updateStatus = /* returns 0 - OK 1 - take iteration then re-factorize 2 - flag something and skip 3 - break and re-factorize 5 - take iteration then re-factorize because of memory */ int status=checkReplace(); if (status&&!returnCode) returnCode=status; } //clearArrays(arrayForFlipRhs_); if (stateOfIteration_&&numberFlipped) { //usefulArray_[arrayForTableauRow_].compact(); // move variables back flipBack(numberFlipped); } // could choose average of all three return returnCode; } int AbcSimplexDual::whileIteratingParallel(int numberIterations) { int returnCode=-1; #ifdef EARLY_FACTORIZE int savePivot=-1; CoinIndexedVector & early = usefulArray_[ABC_NUMBER_USEFUL-1]; int * pivotIndices = early.getIndices(); double * pivotValues = early.denseVector(); int pivotCountPosition=early.capacity()-1; int numberSaved=0; if (numberIterations==123456789) savePivot=pivotCountPosition;; #endif numberIterations += numberIterations_; do { #if ABC_DEBUG checkArrays(); #endif /* -1 - just move dual in values pass 0 - take iteration 1 - don't take but continue 2 - don't take and break */ stateOfIteration_=0; returnCode=-1; // put row of tableau in usefulArray[arrayForTableauRow_] /* Could a) copy [arrayForBtran_] and start off updateWeights earlier b) break transposeTimes into two and do after slack part c) also think if cleaner to go all way with update but just don't do final part */ //upperTheta=COIN_DBL_MAX; double saveAcceptable=acceptablePivot_; if (largestPrimalError_>1.0e-5||largestDualError_>1.0e-5) { //if ((largestPrimalError_>1.0e-5||largestDualError_>1.0e-5)&&false) { if (!abcFactorization_->pivots()) acceptablePivot_*=1.0e2; else if (abcFactorization_->pivots()<5) acceptablePivot_*=1.0e1; } #ifdef MOVE_UPDATE_WEIGHTS // copy btran across usefulArray_[5].copy(usefulArray_[arrayForBtran_]); cilk_spawn abcDualRowPivot_->updateWeightsOnly(usefulArray_[5]);; #endif dualColumn1(); acceptablePivot_=saveAcceptable; if ((stateOfProblem_&VALUES_PASS)!=0) { // see if can just move dual if (fabs(upperTheta_-fabs(abcDj_[sequenceOut_]))updateWeightsOnly(usefulArray_[arrayForBtran_]);; #endif // get sequenceIn_ dualPivotColumn(); //stateOfIteration_=0; if (sequenceIn_ >= 0) { // normal iteration // update the incoming column //arrayForReplaceColumn_=getAvailableArray(); getTableauColumnFlipAndStartReplaceCilk(); //usleep(1000); } else if (stateOfIteration_!=-1) { stateOfIteration_=2; } } cilk_sync; // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 4; stateOfIteration_=2; } } if (!stateOfIteration_) { // assert (stateOfIteration_!=1); int whatNext=0; whatNext = housekeeping(); #ifdef EARLY_FACTORIZE if (savePivot>=0) { // save pivot pivotIndices[--savePivot]=sequenceOut_; pivotValues[savePivot]=alpha_; pivotIndices[--savePivot]=sequenceIn_; pivotValues[savePivot]=btranAlpha_; numberSaved++; } #endif if (whatNext == 1) { problemStatus_ = -2; // refactorize usefulArray_[arrayForTableauRow_].compact(); } else if (whatNext == 2) { // maximum iterations or equivalent problemStatus_ = 3; returnCode = 3; stateOfIteration_=2; } #ifdef EARLY_FACTORIZE if (savePivot>=0) { // tell worker can update this pivotIndices[pivotCountPosition]=numberSaved; } #endif } else { usefulArray_[arrayForTableauRow_].compact(); if (stateOfIteration_<0) { // move dual in dual values pass theta_=abcDj_[sequenceOut_]; updateDualsInDual(); abcDj_[sequenceOut_]=0.0; sequenceOut_=-1; } // clear all arrays clearArrays(-1); } // at this stage sequenceIn_ may be <0 if (sequenceIn_<0&&sequenceOut_>=0) { usefulArray_[arrayForTableauRow_].compact(); // no incoming column is valid returnCode=noPivotColumn(); } if (stateOfIteration_==2) { usefulArray_[arrayForTableauRow_].compact(); sequenceIn_=-1; #ifdef ABC_LONG_FACTORIZATION abcFactorization_->clearHiddenArrays(); #endif break; } if (problemStatus_!=-1) { #ifndef MOVE_UPDATE_WEIGHTS abcDualRowPivot_->updateWeights2(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_]); #else abcDualRowPivot_->updateWeights2(usefulArray_[5],usefulArray_[arrayForFtran_]); #endif #ifdef ABC_LONG_FACTORIZATION abcFactorization_->clearHiddenArrays(); #endif swapPrimalStuff(); break; } if (stateOfIteration_==1) { // clear all arrays clearArrays(-2); #ifdef ABC_LONG_FACTORIZATION abcFactorization_->clearHiddenArrays(); #endif } if (stateOfIteration_==0) { // can do these in parallel // No idea why I need this - but otherwise runs not repeatable (try again??) //usefulArray_[3].compact(); cilk_spawn updateDualsInDual(); int lastSequenceOut; int lastDirectionOut; if (firstFree_<0) { // can do in parallel cilk_spawn replaceColumnPart3(); updatePrimalSolution(); swapPrimalStuff(); // dualRow will go to virtual row pivot choice algorithm // make sure values pass off if it should be // use Btran array and clear inside dualPivotRow (if used) lastSequenceOut=sequenceOut_; lastDirectionOut=directionOut_; dualPivotRow(); cilk_sync; } else { // be more careful as dualPivotRow may do update cilk_spawn replaceColumnPart3(); updatePrimalSolution(); swapPrimalStuff(); // dualRow will go to virtual row pivot choice algorithm // make sure values pass off if it should be // use Btran array and clear inside dualPivotRow (if used) lastSequenceOut=sequenceOut_; lastDirectionOut=directionOut_; cilk_sync; dualPivotRow(); } lastPivotRow_=pivotRow_; if (pivotRow_ >= 0) { // we found a pivot row // create as packed // dual->checkReplacePart1a(); createDualPricingVectorCilk(); swapDualStuff(lastSequenceOut,lastDirectionOut); } cilk_sync; } else { // after moving dual in values pass dualPivotRow(); lastPivotRow_=pivotRow_; if (pivotRow_ >= 0) { // we found a pivot row // create as packed createDualPricingVectorCilk(); } } if (pivotRow_<0) { // no pivot row clearArrays(-1); returnCode=noPivotRow(); break; } if (numberIterations == numberIterations_&&problemStatus_==-1) { returnCode=-99; break; } } while (problemStatus_ == -1); return returnCode; } #if 0 void AbcSimplexDual::whileIterating2() { // get sequenceIn_ dualPivotColumn(); //stateOfIteration_=0; if (sequenceIn_ >= 0) { // normal iteration // update the incoming column //arrayForReplaceColumn_=getAvailableArray(); getTableauColumnFlipAndStartReplaceCilk(); //usleep(1000); } else if (stateOfIteration_!=-1) { stateOfIteration_=2; } } #endif #endif void AbcSimplexDual::updatePrimalSolution() { // finish doing weights #ifndef MOVE_UPDATE_WEIGHTS abcDualRowPivot_->updatePrimalSolutionAndWeights(usefulArray_[arrayForBtran_],usefulArray_[arrayForFtran_], movement_); #else abcDualRowPivot_->updatePrimalSolutionAndWeights(usefulArray_[5],usefulArray_[arrayForFtran_], movement_); #endif } int xxInfo[6][8]; double parallelDual4(AbcSimplexDual * dual) { int maximumRows=dual->maximumAbcNumberRows(); //int numberTotal=dual->numberTotal(); CoinIndexedVector & update = *dual->usefulArray(dual->arrayForBtran()); CoinPartitionedVector & tableauRow= *dual->usefulArray(dual->arrayForTableauRow()); CoinPartitionedVector & candidateList= *dual->usefulArray(dual->arrayForDualColumn()); AbcMatrix * matrix = dual->abcMatrix(); // do slacks first (move before sync) double upperTheta=dual->upperTheta(); //assert (upperTheta>-100*dual->dualTolerance()||dual->sequenceIn()>=0||dual->lastFirstFree()>=0); #if ABC_PARALLEL #define NUMBER_BLOCKS NUMBER_ROW_BLOCKS int numberBlocks=CoinMin(NUMBER_BLOCKS,dual->numberCpus()); #else #define NUMBER_BLOCKS 1 int numberBlocks=NUMBER_BLOCKS; #endif #if ABC_PARALLEL if (dual->parallelMode()==0) numberBlocks=1; #endif // see if worth using row copy bool gotRowCopy = matrix->gotRowCopy(); int number=update.getNumElements(); assert (number); bool useRowCopy = (gotRowCopy&&(number<<2)numberRowBlocks()); #if ABC_PARALLEL==1 // redo so can pass info in with void * CoinThreadInfo * infoP = dual->threadInfoPointer(); int cpuMask=((1<parallelMode())-1); cpuMask += cpuMask<<5; dual->setStopStart(cpuMask); #endif CoinThreadInfo info[NUMBER_BLOCKS]; const int * starts; if (useRowCopy) starts=matrix->blockStart(); else starts=matrix->startColumnBlock(); tableauRow.setPartitions(numberBlocks,starts); candidateList.setPartitions(numberBlocks,starts); //printf("free sequence in %d\n",dual->freeSequenceIn()); if (useRowCopy) { // using row copy #if ABC_PARALLEL if (numberBlocks>1) { #if ABC_PARALLEL==2 for (int i=0;idualColumn1Row(info[i].stuff[1],COIN_DBL_MAX,info[i].stuff[2], update,tableauRow,candidateList); } cilk_sync; #else // parallel 1 for (int i=0;istartParallelStuff(5); } } info[numberBlocks-1].stuff[1]=numberBlocks-1; info[numberBlocks-1].stuff[2]=-1; //double freeAlpha; info[numberBlocks-1].result = matrix->dualColumn1Row(info[numberBlocks-1].stuff[1], upperTheta,info[numberBlocks-1].stuff[2], update,tableauRow,candidateList); dual->stopParallelStuff(5); for (int i=0;i2); info[0].result = matrix->dualColumn1Row(info[0].stuff[1], upperTheta,info[0].stuff[2], update,tableauRow,candidateList); #if ABC_PARALLEL } #endif } else { // end of useRowCopy #if ABC_PARALLEL if (numberBlocks>1) { #if ABC_PARALLEL==2 // do by column for (int i=0;idualColumn1Part(info[i].stuff[1],info[i].stuff[2], info[i].result, update,tableauRow,candidateList); } cilk_sync; #else // parallel 1 // do by column for (int i=0;istartParallelStuff(4); } } matrix->dualColumn1Part(info[numberBlocks-1].stuff[1],info[numberBlocks-1].stuff[2], info[numberBlocks-1].result, update,tableauRow,candidateList); dual->stopParallelStuff(4); for (int i=0;idualColumn1Part(info[0].stuff[1],info[0].stuff[2], info[0].result, update,tableauRow,candidateList); #if ABC_PARALLEL } #endif } int sequenceIn[NUMBER_BLOCKS]; bool anyFree=false; #if 0 if (useRowCopy) { printf("Result at iteration %d slack seqIn %d upperTheta %g\n", dual->numberIterations(),dual->freeSequenceIn(),upperTheta); double * arrayT = tableauRow.denseVector(); int * indexT = tableauRow.getIndices(); double * arrayC = candidateList.denseVector(); int * indexC = candidateList.getIndices(); for (int i=0;i=0) anyFree=true; upperTheta=CoinMin(info[i].result,upperTheta); //assert (info[i].result>-100*dual->dualTolerance()||sequenceIn[i]>=0||dual->lastFirstFree()>=0); } if (anyFree) { int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); // search for free coming in double bestFree=0.0; int bestSequence=dual->sequenceIn(); if (bestSequence>=0) bestFree=dual->alpha(); for (int i=0;i=0) { // free variable - search int start=starts[i]; int end=start+tableauRow.getNumElements(i); for (int k=start;k=0) { double oldValue = dual->djRegion()[bestSequence]; dual->setSequenceIn(bestSequence); dual->setAlpha(bestFree); dual->setTheta(oldValue / bestFree); } } //tableauRow.compact(); //candidateList.compact(); #if 0//ndef NDEBUG tableauRow.setPackedMode(true); tableauRow.sortPacked(); candidateList.setPackedMode(true); candidateList.sortPacked(); #endif return upperTheta; } #if ABC_PARALLEL==2 static void parallelDual5a(AbcSimplexFactorization * factorization, CoinIndexedVector * whichVector, int numberCpu, int whichCpu, double * weights) { double * COIN_RESTRICT array = whichVector->denseVector(); int * COIN_RESTRICT which = whichVector->getIndices(); int numberRows=factorization->numberRows(); for (int i = whichCpu; i < numberRows; i+=numberCpu) { double value = 0.0; array[i] = 1.0; which[0] = i; whichVector->setNumElements(1); factorization->updateColumnTransposeCpu(*whichVector,whichCpu); int number = whichVector->getNumElements(); for (int j = 0; j < number; j++) { int k= which[j]; value += array[k] * array[k]; array[k] = 0.0; } weights[i] = value; } whichVector->setNumElements(0); } #endif #if ABC_PARALLEL==2 void parallelDual5(AbcSimplexFactorization * factorization, CoinIndexedVector ** whichVector, int numberCpu, int whichCpu, double * weights) { if (whichCpu) { cilk_spawn parallelDual5(factorization,whichVector,numberCpu,whichCpu-1,weights); parallelDual5a(factorization,whichVector[whichCpu],numberCpu,whichCpu,weights); cilk_sync; } else { parallelDual5a(factorization,whichVector[whichCpu],numberCpu,whichCpu,weights); } } #endif // cilk seems a bit fragile #define CILK_FRAGILE 1 #if CILK_FRAGILE>1 #undef cilk_spawn #undef cilk_sync #define cilk_spawn #define cilk_sync #define ONWARD 0 #elif CILK_FRAGILE==1 #define ONWARD 0 #else #define ONWARD 1 #endif // Code below is just a translation of LAPACK #define BLOCKING1 8 // factorization strip #define BLOCKING2 8 // dgemm recursive #define BLOCKING3 16 // dgemm parallel /* type 0 Left Lower NoTranspose Unit 1 Left Upper NoTranspose NonUnit 2 Left Lower Transpose Unit 3 Left Upper Transpose NonUnit */ static void CoinAbcDtrsmFactor(int m, int n, double * COIN_RESTRICT a,int lda) { assert ((m&(BLOCKING8-1))==0&&(n&(BLOCKING8-1))==0); assert (m==BLOCKING8); // 0 Left Lower NoTranspose Unit /* entry for column j and row i (when multiple of BLOCKING8) is at aBlocked+j*m+i*BLOCKING8 */ double * COIN_RESTRICT aBase2 = a; double * COIN_RESTRICT bBase2 = aBase2+lda*BLOCKING8; for (int jj=0;jjCILK_DTRSM) { int mid=((first+last)>>4)<<3; cilk_spawn dtrsm0(kkk,first,mid,m,a,b); dtrsm0(kkk,mid,last,m,a,b); cilk_sync; } else { const double * COIN_RESTRICT aBaseA = a+UNROLL_DTRSM*BLOCKING8X8+kkk*BLOCKING8; aBaseA += (first-mm)*BLOCKING8-BLOCKING8X8; aBaseA += m*kkk; for (int ii=first;ii(bBaseI)=b0; //_mm256_store_pd (bBaseI+4, b1); *reinterpret_cast<__m256d *>(bBaseI+4)=b1; #endif } } } } void CoinAbcDtrsm0(int m, double * COIN_RESTRICT a,double * COIN_RESTRICT b) { assert ((m&(BLOCKING8-1))==0); // 0 Left Lower NoTranspose Unit for (int kkk=0;kkkCILK_DTRSM) { int mid=((first+last)>>4)<<3; cilk_spawn dtrsm1(kkk,first,mid,m,a,b); dtrsm1(kkk,mid,last,m,a,b); cilk_sync; } else { for (int iii=last-BLOCKING8;iii>=first;iii-=BLOCKING8) { double * COIN_RESTRICT bBase2 = b+iii; const double * COIN_RESTRICT aBaseA= a+BLOCKING8X8+BLOCKING8*iii; for (int ii=kkk;ii>=mm;ii-=BLOCKING8) { double * COIN_RESTRICT bBase = b+ii; const double * COIN_RESTRICT aBase=aBaseA+m*ii; #if AVX2 !=2 #ifndef ALTERNATE_INNER for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; //coin_prefetch_const(aBase-BLOCKING8); for (int k=BLOCKING8-1;k>=0;k--) { bBase2[k] -= bBase[i]*aBase[k]; } } #else double b0=bBase2[0]; double b1=bBase2[1]; double b2=bBase2[2]; double b3=bBase2[3]; double b4=bBase2[4]; double b5=bBase2[5]; double b6=bBase2[6]; double b7=bBase2[7]; for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; //coin_prefetch_const(aBase-BLOCKING8); double bValue=bBase[i]; b0 -= bValue * aBase[0]; b1 -= bValue * aBase[1]; b2 -= bValue * aBase[2]; b3 -= bValue * aBase[3]; b4 -= bValue * aBase[4]; b5 -= bValue * aBase[5]; b6 -= bValue * aBase[6]; b7 -= bValue * aBase[7]; } bBase2[0]=b0; bBase2[1]=b1; bBase2[2]=b2; bBase2[3]=b3; bBase2[4]=b4; bBase2[5]=b5; bBase2[6]=b6; bBase2[7]=b7; #endif #else __m256d b0=_mm256_load_pd(bBase2); __m256d b1=_mm256_load_pd(bBase2+4); for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; //coin_prefetch_const(aBase5-BLOCKING8); __m256d bb = _mm256_broadcast_sd(bBase+i); __m256d a0 = _mm256_load_pd(aBase); b0 -= a0*bb; __m256d a1 = _mm256_load_pd(aBase+4); b1 -= a1*bb; } //_mm256_store_pd (bBase2, b0); *reinterpret_cast<__m256d *>(bBase2)=b0; //_mm256_store_pd (bBase2+4, b1); *reinterpret_cast<__m256d *>(bBase2+4)=b1; #endif } } } } void CoinAbcDtrsm1(int m, double * COIN_RESTRICT a,double * COIN_RESTRICT b) { assert ((m&(BLOCKING8-1))==0); // 1 Left Upper NoTranspose NonUnit for (int kkk=m-BLOCKING8;kkk>=0;kkk-=UNROLL_DTRSM*BLOCKING8) { int mm=CoinMax(0,kkk-(UNROLL_DTRSM-1)*BLOCKING8); for (int ii=kkk;ii>=mm;ii-=BLOCKING8) { const double * COIN_RESTRICT aBase = a+m*ii+ii*BLOCKING8; double * COIN_RESTRICT bBase = b+ii; for (int i=BLOCKING8-1;i>=0;i--) { bBase[i] *= aBase[i*(BLOCKING8+1)]; for (int k=i-1;k>=0;k--) { bBase[k] -= bBase[i]*aBase[k+i*BLOCKING8]; } } double * COIN_RESTRICT bBase2 = bBase; for (int iii=ii;iii>mm;iii-=BLOCKING8) { bBase2 -= BLOCKING8; for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; coin_prefetch_const(aBase-BLOCKING8); for (int k=BLOCKING8-1;k>=0;k--) { bBase2[k] -= bBase[i]*aBase[k]; } } } } dtrsm1(kkk, 0, mm, m, a, b); } } static void dtrsm2(int kkk, int first, int last, int m, double * COIN_RESTRICT a,double * COIN_RESTRICT b) { int mm=CoinMax(0,kkk-(UNROLL_DTRSM-1)*BLOCKING8); assert ((last-first)%BLOCKING8==0); if (last-first>CILK_DTRSM) { int mid=((first+last)>>4)<<3; cilk_spawn dtrsm2(kkk,first,mid,m,a,b); dtrsm2(kkk,mid,last,m,a,b); cilk_sync; } else { for (int iii=last-BLOCKING8;iii>=first;iii-=BLOCKING8) { for (int ii=kkk;ii>=mm;ii-=BLOCKING8) { const double * COIN_RESTRICT bBase = b+ii; double * COIN_RESTRICT bBase2=b+iii; const double * COIN_RESTRICT aBase=a+ii*BLOCKING8+m*iii+BLOCKING8X8; for (int j=BLOCKING8-1;j>=0;j-=4) { double bValue0=bBase2[j]; double bValue1=bBase2[j-1]; double bValue2=bBase2[j-2]; double bValue3=bBase2[j-3]; bValue0 -= aBase[-1*BLOCKING8+7]*bBase[7]; bValue1 -= aBase[-2*BLOCKING8+7]*bBase[7]; bValue2 -= aBase[-3*BLOCKING8+7]*bBase[7]; bValue3 -= aBase[-4*BLOCKING8+7]*bBase[7]; bValue0 -= aBase[-1*BLOCKING8+6]*bBase[6]; bValue1 -= aBase[-2*BLOCKING8+6]*bBase[6]; bValue2 -= aBase[-3*BLOCKING8+6]*bBase[6]; bValue3 -= aBase[-4*BLOCKING8+6]*bBase[6]; bValue0 -= aBase[-1*BLOCKING8+5]*bBase[5]; bValue1 -= aBase[-2*BLOCKING8+5]*bBase[5]; bValue2 -= aBase[-3*BLOCKING8+5]*bBase[5]; bValue3 -= aBase[-4*BLOCKING8+5]*bBase[5]; bValue0 -= aBase[-1*BLOCKING8+4]*bBase[4]; bValue1 -= aBase[-2*BLOCKING8+4]*bBase[4]; bValue2 -= aBase[-3*BLOCKING8+4]*bBase[4]; bValue3 -= aBase[-4*BLOCKING8+4]*bBase[4]; bValue0 -= aBase[-1*BLOCKING8+3]*bBase[3]; bValue1 -= aBase[-2*BLOCKING8+3]*bBase[3]; bValue2 -= aBase[-3*BLOCKING8+3]*bBase[3]; bValue3 -= aBase[-4*BLOCKING8+3]*bBase[3]; bValue0 -= aBase[-1*BLOCKING8+2]*bBase[2]; bValue1 -= aBase[-2*BLOCKING8+2]*bBase[2]; bValue2 -= aBase[-3*BLOCKING8+2]*bBase[2]; bValue3 -= aBase[-4*BLOCKING8+2]*bBase[2]; bValue0 -= aBase[-1*BLOCKING8+1]*bBase[1]; bValue1 -= aBase[-2*BLOCKING8+1]*bBase[1]; bValue2 -= aBase[-3*BLOCKING8+1]*bBase[1]; bValue3 -= aBase[-4*BLOCKING8+1]*bBase[1]; bValue0 -= aBase[-1*BLOCKING8+0]*bBase[0]; bValue1 -= aBase[-2*BLOCKING8+0]*bBase[0]; bValue2 -= aBase[-3*BLOCKING8+0]*bBase[0]; bValue3 -= aBase[-4*BLOCKING8+0]*bBase[0]; bBase2[j]=bValue0; bBase2[j-1]=bValue1; bBase2[j-2]=bValue2; bBase2[j-3]=bValue3; aBase -= 4*BLOCKING8; } } } } } void CoinAbcDtrsm2(int m, double * COIN_RESTRICT a,double * COIN_RESTRICT b) { assert ((m&(BLOCKING8-1))==0); // 2 Left Lower Transpose Unit for (int kkk=m-BLOCKING8;kkk>=0;kkk-=UNROLL_DTRSM*BLOCKING8) { int mm=CoinMax(0,kkk-(UNROLL_DTRSM-1)*BLOCKING8); for (int ii=kkk;ii>=mm;ii-=BLOCKING8) { double * COIN_RESTRICT bBase = b+ii; double * COIN_RESTRICT bBase2 = bBase; const double * COIN_RESTRICT aBase=a+m*ii+(ii+BLOCKING8)*BLOCKING8; for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; for (int k=i+1;k=mm;iii-=BLOCKING8) { bBase2 -= BLOCKING8; assert (bBase2==b+iii); aBase -= m*BLOCKING8; const double * COIN_RESTRICT aBase2 = aBase+BLOCKING8X8; for (int i=BLOCKING8-1;i>=0;i--) { aBase2 -= BLOCKING8; for (int k=BLOCKING8-1;k>=0;k--) { bBase2[i] -= aBase2[k]*bBase[k]; } } } } dtrsm2(kkk, 0, mm, m, a, b); } } #define UNROLL_DTRSM3 16 #define CILK_DTRSM3 32 static void dtrsm3(int kkk, int first, int last, int m, double * COIN_RESTRICT a,double * COIN_RESTRICT b) { //int mm=CoinMin(kkk+UNROLL_DTRSM3*BLOCKING8,m); assert ((last-first)%BLOCKING8==0); if (last-first>CILK_DTRSM3) { int mid=((first+last)>>4)<<3; cilk_spawn dtrsm3(kkk,first,mid,m,a,b); dtrsm3(kkk,mid,last,m,a,b); cilk_sync; } else { for (int kk=0;kklargest) { largest=value; pivotRow2=i; } } // other blocks int iBias=0; for (int ii=BLOCKING8;iilargest) { largest=value; pivotRow2=i; iBias=ii; } } } pivotRow=pivotRow2+iBias; ipiv[j]=pivotRow; if (largest) { if (j!=pivotRow) { double * COIN_RESTRICT aTop=aThis3; double * COIN_RESTRICT aNotTop=aThis3+iBias*BLOCKING8; for (int i=0;i=end CoinAbcDlaswp(n-end,a+end*lda,lda,start,end,ipiv); CoinAbcDtrsmFactor(newSize,n-end,a+(start*lda+start*BLOCKING8),lda); CoinAbcDgemm(n-end,n-end,newSize, a+start*lda+end*BLOCKING8,lda, a+end*lda+start*BLOCKING8,a+end*lda+end*BLOCKING8 #if ABC_PARALLEL==2 ,parallelMode #endif ); } } else { return returnCode; } } } return 0; } void CoinAbcDgetrs(char trans,int m, double * COIN_RESTRICT a, double * COIN_RESTRICT work) { assert ((m&(BLOCKING8-1))==0); if (trans=='N') { //CoinAbcDlaswp1(work,m,ipiv); CoinAbcDtrsm0(m,a,work); CoinAbcDtrsm1(m,a,work); } else { assert (trans=='T'); CoinAbcDtrsm3(m,a,work); CoinAbcDtrsm2(m,a,work); //CoinAbcDlaswp1Backwards(work,m,ipiv); } } #ifdef ABC_LONG_FACTORIZATION /// ****** Start long double version /* type 0 Left Lower NoTranspose Unit 1 Left Upper NoTranspose NonUnit 2 Left Lower Transpose Unit 3 Left Upper Transpose NonUnit */ static void CoinAbcDtrsmFactor(int m, int n, long double * COIN_RESTRICT a,int lda) { assert ((m&(BLOCKING8-1))==0&&(n&(BLOCKING8-1))==0); assert (m==BLOCKING8); // 0 Left Lower NoTranspose Unit /* entry for column j and row i (when multiple of BLOCKING8) is at aBlocked+j*m+i*BLOCKING8 */ long double * COIN_RESTRICT aBase2 = a; long double * COIN_RESTRICT bBase2 = aBase2+lda*BLOCKING8; for (int jj=0;jjCILK_DTRSM) { int mid=((first+last)>>4)<<3; cilk_spawn dtrsm0(kkk,first,mid,m,a,b); dtrsm0(kkk,mid,last,m,a,b); cilk_sync; } else { const long double * COIN_RESTRICT aBaseA = a+UNROLL_DTRSM*BLOCKING8X8+kkk*BLOCKING8; aBaseA += (first-mm)*BLOCKING8-BLOCKING8X8; aBaseA += m*kkk; for (int ii=first;ii(bBaseI)=b0; //_mm256_store_pd (bBaseI+4, b1); *reinterpret_cast<__m256d *>(bBaseI+4)=b1; #endif } } } } void CoinAbcDtrsm0(int m, long double * COIN_RESTRICT a,long double * COIN_RESTRICT b) { assert ((m&(BLOCKING8-1))==0); // 0 Left Lower NoTranspose Unit for (int kkk=0;kkkCILK_DTRSM) { int mid=((first+last)>>4)<<3; cilk_spawn dtrsm1(kkk,first,mid,m,a,b); dtrsm1(kkk,mid,last,m,a,b); cilk_sync; } else { for (int iii=last-BLOCKING8;iii>=first;iii-=BLOCKING8) { long double * COIN_RESTRICT bBase2 = b+iii; const long double * COIN_RESTRICT aBaseA= a+BLOCKING8X8+BLOCKING8*iii; for (int ii=kkk;ii>=mm;ii-=BLOCKING8) { long double * COIN_RESTRICT bBase = b+ii; const long double * COIN_RESTRICT aBase=aBaseA+m*ii; #if AVX2 !=2 #ifndef ALTERNATE_INNER for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; //coin_prefetch_const(aBase-BLOCKING8); for (int k=BLOCKING8-1;k>=0;k--) { bBase2[k] -= bBase[i]*aBase[k]; } } #else long double b0=bBase2[0]; long double b1=bBase2[1]; long double b2=bBase2[2]; long double b3=bBase2[3]; long double b4=bBase2[4]; long double b5=bBase2[5]; long double b6=bBase2[6]; long double b7=bBase2[7]; for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; //coin_prefetch_const(aBase-BLOCKING8); long double bValue=bBase[i]; b0 -= bValue * aBase[0]; b1 -= bValue * aBase[1]; b2 -= bValue * aBase[2]; b3 -= bValue * aBase[3]; b4 -= bValue * aBase[4]; b5 -= bValue * aBase[5]; b6 -= bValue * aBase[6]; b7 -= bValue * aBase[7]; } bBase2[0]=b0; bBase2[1]=b1; bBase2[2]=b2; bBase2[3]=b3; bBase2[4]=b4; bBase2[5]=b5; bBase2[6]=b6; bBase2[7]=b7; #endif #else __m256d b0=_mm256_load_pd(bBase2); __m256d b1=_mm256_load_pd(bBase2+4); for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; //coin_prefetch_const(aBase5-BLOCKING8); __m256d bb = _mm256_broadcast_sd(bBase+i); __m256d a0 = _mm256_load_pd(aBase); b0 -= a0*bb; __m256d a1 = _mm256_load_pd(aBase+4); b1 -= a1*bb; } //_mm256_store_pd (bBase2, b0); *reinterpret_cast<__m256d *>(bBase2)=b0; //_mm256_store_pd (bBase2+4, b1); *reinterpret_cast<__m256d *>(bBase2+4)=b1; #endif } } } } void CoinAbcDtrsm1(int m, long double * COIN_RESTRICT a,long double * COIN_RESTRICT b) { assert ((m&(BLOCKING8-1))==0); // 1 Left Upper NoTranspose NonUnit for (int kkk=m-BLOCKING8;kkk>=0;kkk-=UNROLL_DTRSM*BLOCKING8) { int mm=CoinMax(0,kkk-(UNROLL_DTRSM-1)*BLOCKING8); for (int ii=kkk;ii>=mm;ii-=BLOCKING8) { const long double * COIN_RESTRICT aBase = a+m*ii+ii*BLOCKING8; long double * COIN_RESTRICT bBase = b+ii; for (int i=BLOCKING8-1;i>=0;i--) { bBase[i] *= aBase[i*(BLOCKING8+1)]; for (int k=i-1;k>=0;k--) { bBase[k] -= bBase[i]*aBase[k+i*BLOCKING8]; } } long double * COIN_RESTRICT bBase2 = bBase; for (int iii=ii;iii>mm;iii-=BLOCKING8) { bBase2 -= BLOCKING8; for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; coin_prefetch_const(aBase-BLOCKING8); for (int k=BLOCKING8-1;k>=0;k--) { bBase2[k] -= bBase[i]*aBase[k]; } } } } dtrsm1(kkk, 0, mm, m, a, b); } } static void dtrsm2(int kkk, int first, int last, int m, long double * COIN_RESTRICT a,long double * COIN_RESTRICT b) { int mm=CoinMax(0,kkk-(UNROLL_DTRSM-1)*BLOCKING8); assert ((last-first)%BLOCKING8==0); if (last-first>CILK_DTRSM) { int mid=((first+last)>>4)<<3; cilk_spawn dtrsm2(kkk,first,mid,m,a,b); dtrsm2(kkk,mid,last,m,a,b); cilk_sync; } else { for (int iii=last-BLOCKING8;iii>=first;iii-=BLOCKING8) { for (int ii=kkk;ii>=mm;ii-=BLOCKING8) { const long double * COIN_RESTRICT bBase = b+ii; long double * COIN_RESTRICT bBase2=b+iii; const long double * COIN_RESTRICT aBase=a+ii*BLOCKING8+m*iii+BLOCKING8X8; for (int j=BLOCKING8-1;j>=0;j-=4) { long double bValue0=bBase2[j]; long double bValue1=bBase2[j-1]; long double bValue2=bBase2[j-2]; long double bValue3=bBase2[j-3]; bValue0 -= aBase[-1*BLOCKING8+7]*bBase[7]; bValue1 -= aBase[-2*BLOCKING8+7]*bBase[7]; bValue2 -= aBase[-3*BLOCKING8+7]*bBase[7]; bValue3 -= aBase[-4*BLOCKING8+7]*bBase[7]; bValue0 -= aBase[-1*BLOCKING8+6]*bBase[6]; bValue1 -= aBase[-2*BLOCKING8+6]*bBase[6]; bValue2 -= aBase[-3*BLOCKING8+6]*bBase[6]; bValue3 -= aBase[-4*BLOCKING8+6]*bBase[6]; bValue0 -= aBase[-1*BLOCKING8+5]*bBase[5]; bValue1 -= aBase[-2*BLOCKING8+5]*bBase[5]; bValue2 -= aBase[-3*BLOCKING8+5]*bBase[5]; bValue3 -= aBase[-4*BLOCKING8+5]*bBase[5]; bValue0 -= aBase[-1*BLOCKING8+4]*bBase[4]; bValue1 -= aBase[-2*BLOCKING8+4]*bBase[4]; bValue2 -= aBase[-3*BLOCKING8+4]*bBase[4]; bValue3 -= aBase[-4*BLOCKING8+4]*bBase[4]; bValue0 -= aBase[-1*BLOCKING8+3]*bBase[3]; bValue1 -= aBase[-2*BLOCKING8+3]*bBase[3]; bValue2 -= aBase[-3*BLOCKING8+3]*bBase[3]; bValue3 -= aBase[-4*BLOCKING8+3]*bBase[3]; bValue0 -= aBase[-1*BLOCKING8+2]*bBase[2]; bValue1 -= aBase[-2*BLOCKING8+2]*bBase[2]; bValue2 -= aBase[-3*BLOCKING8+2]*bBase[2]; bValue3 -= aBase[-4*BLOCKING8+2]*bBase[2]; bValue0 -= aBase[-1*BLOCKING8+1]*bBase[1]; bValue1 -= aBase[-2*BLOCKING8+1]*bBase[1]; bValue2 -= aBase[-3*BLOCKING8+1]*bBase[1]; bValue3 -= aBase[-4*BLOCKING8+1]*bBase[1]; bValue0 -= aBase[-1*BLOCKING8+0]*bBase[0]; bValue1 -= aBase[-2*BLOCKING8+0]*bBase[0]; bValue2 -= aBase[-3*BLOCKING8+0]*bBase[0]; bValue3 -= aBase[-4*BLOCKING8+0]*bBase[0]; bBase2[j]=bValue0; bBase2[j-1]=bValue1; bBase2[j-2]=bValue2; bBase2[j-3]=bValue3; aBase -= 4*BLOCKING8; } } } } } void CoinAbcDtrsm2(int m, long double * COIN_RESTRICT a,long double * COIN_RESTRICT b) { assert ((m&(BLOCKING8-1))==0); // 2 Left Lower Transpose Unit for (int kkk=m-BLOCKING8;kkk>=0;kkk-=UNROLL_DTRSM*BLOCKING8) { int mm=CoinMax(0,kkk-(UNROLL_DTRSM-1)*BLOCKING8); for (int ii=kkk;ii>=mm;ii-=BLOCKING8) { long double * COIN_RESTRICT bBase = b+ii; long double * COIN_RESTRICT bBase2 = bBase; const long double * COIN_RESTRICT aBase=a+m*ii+(ii+BLOCKING8)*BLOCKING8; for (int i=BLOCKING8-1;i>=0;i--) { aBase -= BLOCKING8; for (int k=i+1;k=mm;iii-=BLOCKING8) { bBase2 -= BLOCKING8; assert (bBase2==b+iii); aBase -= m*BLOCKING8; const long double * COIN_RESTRICT aBase2 = aBase+BLOCKING8X8; for (int i=BLOCKING8-1;i>=0;i--) { aBase2 -= BLOCKING8; for (int k=BLOCKING8-1;k>=0;k--) { bBase2[i] -= aBase2[k]*bBase[k]; } } } } dtrsm2(kkk, 0, mm, m, a, b); } } #define UNROLL_DTRSM3 16 #define CILK_DTRSM3 32 static void dtrsm3(int kkk, int first, int last, int m, long double * COIN_RESTRICT a,long double * COIN_RESTRICT b) { //int mm=CoinMin(kkk+UNROLL_DTRSM3*BLOCKING8,m); assert ((last-first)%BLOCKING8==0); if (last-first>CILK_DTRSM3) { int mid=((first+last)>>4)<<3; cilk_spawn dtrsm3(kkk,first,mid,m,a,b); dtrsm3(kkk,mid,last,m,a,b); cilk_sync; } else { for (int kk=0;kklargest) { largest=value; pivotRow2=i; } } // other blocks int iBias=0; for (int ii=BLOCKING8;iilargest) { largest=value; pivotRow2=i; iBias=ii; } } } pivotRow=pivotRow2+iBias; ipiv[j]=pivotRow; if (largest) { if (j!=pivotRow) { long double * COIN_RESTRICT aTop=aThis3; long double * COIN_RESTRICT aNotTop=aThis3+iBias*BLOCKING8; for (int i=0;i=end CoinAbcDlaswp(n-end,a+end*lda,lda,start,end,ipiv); CoinAbcDtrsmFactor(newSize,n-end,a+(start*lda+start*BLOCKING8),lda); CoinAbcDgemm(n-end,n-end,newSize, a+start*lda+end*BLOCKING8,lda, a+end*lda+start*BLOCKING8,a+end*lda+end*BLOCKING8 #if ABC_PARALLEL==2 ,parallelMode #endif ); } } else { return returnCode; } } } return 0; } void CoinAbcDgetrs(char trans,int m, long double * COIN_RESTRICT a, long double * COIN_RESTRICT work) { assert ((m&(BLOCKING8-1))==0); if (trans=='N') { //CoinAbcDlaswp1(work,m,ipiv); CoinAbcDtrsm0(m,a,work); CoinAbcDtrsm1(m,a,work); } else { assert (trans=='T'); CoinAbcDtrsm3(m,a,work); CoinAbcDtrsm2(m,a,work); //CoinAbcDlaswp1Backwards(work,m,ipiv); } } #endif CoinMP-1.8.3/Clp/src/AbcSimplexDual.hpp0000644000175000017500000002715412101105055016166 0ustar renerene/* $Id: AbcSimplexDual.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef AbcSimplexDual_H #define AbcSimplexDual_H #include "AbcSimplex.hpp" #if 0 #undef ABC_PARALLEL #define ABC_PARALLEL 2 #undef cilk_for #undef cilk_spawn #undef cilk_sync #include #endif typedef struct { double theta; double totalThru; double useThru; double bestEverPivot; double increaseInObjective; double tentativeTheta; double lastPivotValue; double thisPivotValue; double thruThis; double increaseInThis; int lastSequence; int sequence; int block; int numberSwapped; int numberRemaining; int numberLastSwapped; bool modifyCosts; } dualColumnResult; /** This solves LPs using the dual simplex method It inherits from AbcSimplex. It has no data of its own and is never created - only cast from a AbcSimplex object at algorithm time. */ class AbcSimplexDual : public AbcSimplex { public: /**@name Description of algorithm */ //@{ /** Dual algorithm Method It tries to be a single phase approach with a weight of 1.0 being given to getting optimal and a weight of updatedDualBound_ being given to getting dual feasible. In this version I have used the idea that this weight can be thought of as a fake bound. If the distance between the lower and upper bounds on a variable is less than the feasibility weight then we are always better off flipping to other bound to make dual feasible. If the distance is greater then we make up a fake bound updatedDualBound_ away from one bound. If we end up optimal or primal infeasible, we check to see if bounds okay. If so we have finished, if not we increase updatedDualBound_ and continue (after checking if unbounded). I am undecided about free variables - there is coding but I am not sure about it. At present I put them in basis anyway. The code is designed to take advantage of sparsity so arrays are seldom zeroed out from scratch or gone over in their entirety. The only exception is a full scan to find outgoing variable for Dantzig row choice. For steepest edge we keep an updated list of infeasibilities (actually squares). On easy problems we don't need full scan - just pick first reasonable. One problem is how to tackle degeneracy and accuracy. At present I am using the modification of costs which I put in OSL and some of what I think is the dual analog of Gill et al. I am still not sure of the exact details. The flow of dual is three while loops as follows: while (not finished) { while (not clean solution) { Factorize and/or clean up solution by flipping variables so dual feasible. If looks finished check fake dual bounds. Repeat until status is iterating (-1) or finished (0,1,2) } while (status==-1) { Iterate until no pivot in or out or time to re-factorize. Flow is: choose pivot row (outgoing variable). if none then we are primal feasible so looks as if done but we need to break and check bounds etc. Get pivot row in tableau Choose incoming column. If we don't find one then we look primal infeasible so break and check bounds etc. (Also the pivot tolerance is larger after any iterations so that may be reason) If we do find incoming column, we may have to adjust costs to keep going forwards (anti-degeneracy). Check pivot will be stable and if unstable throw away iteration and break to re-factorize. If minor error re-factorize after iteration. Update everything (this may involve flipping variables to stay dual feasible. } } TODO's (or maybe not) At present we never check we are going forwards. I overdid that in OSL so will try and make a last resort. Needs partial scan pivot out option. May need other anti-degeneracy measures, especially if we try and use loose tolerances as a way to solve in fewer iterations. I like idea of dynamic scaling. This gives opportunity to decouple different implications of scaling for accuracy, iteration count and feasibility tolerance. for use of exotic parameter startFinishoptions see Abcsimplex.hpp */ int dual(); /** For strong branching. On input lower and upper are new bounds while on output they are change in objective function values (>1.0e50 infeasible). Return code is 0 if nothing interesting, -1 if infeasible both ways and +1 if infeasible one way (check values to see which one(s)) Solutions are filled in as well - even down, odd up - also status and number of iterations */ int strongBranching(int numberVariables, const int * variables, double * newLower, double * newUpper, double ** outputSolution, int * outputStatus, int * outputIterations, bool stopOnFirstInfeasible = true, bool alwaysFinish = false, int startFinishOptions = 0); /// This does first part of StrongBranching AbcSimplexFactorization * setupForStrongBranching(char * arrays, int numberRows, int numberColumns, bool solveLp = false); /// This cleans up after strong branching void cleanupAfterStrongBranching(AbcSimplexFactorization * factorization); //@} /**@name Functions used in dual */ //@{ /** This has the flow between re-factorizations Broken out for clarity and will be used by strong branching Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations If givenPi not NULL then in values pass (copy from ClpSimplexDual) */ int whileIteratingSerial(); #if ABC_PARALLEL==1 int whileIteratingThread(); #endif #if ABC_PARALLEL==2 int whileIteratingCilk(); #endif void whileIterating2(); int whileIteratingParallel(int numberIterations); int whileIterating3(); void updatePrimalSolution(); int noPivotRow(); int noPivotColumn(); void dualPivotColumn(); /// Create dual pricing vector void createDualPricingVectorSerial(); int getTableauColumnFlipAndStartReplaceSerial(); void getTableauColumnPart1Serial(); #if ABC_PARALLEL==1 /// Create dual pricing vector void createDualPricingVectorThread(); int getTableauColumnFlipAndStartReplaceThread(); void getTableauColumnPart1Thread(); #endif #if ABC_PARALLEL==2 /// Create dual pricing vector void createDualPricingVectorCilk(); int getTableauColumnFlipAndStartReplaceCilk(); void getTableauColumnPart1Cilk(); #endif void getTableauColumnPart2(); int checkReplace(); void replaceColumnPart3(); void checkReplacePart1(); void checkReplacePart1a(); void checkReplacePart1b(); /// The duals are updated void updateDualsInDual(); /** The duals are updated by the given arrays. This is in values pass - so no changes to primal is made */ //void updateDualsInValuesPass(CoinIndexedVector * array, // double theta); /** While dualColumn gets flips this does actual flipping. returns number flipped */ int flipBounds(); /** Undo a flip */ void flipBack(int number); /** Array has tableau row (row section) Puts candidates for rows in list Returns guess at upper theta (infinite if no pivot) and may set sequenceIn_ if free Can do all (if tableauRow created) */ void dualColumn1(bool doAll=false); /** Array has tableau row (row section) Just does slack part Returns guess at upper theta (infinite if no pivot) and may set sequenceIn_ if free */ double dualColumn1A(); /// Do all given tableau row double dualColumn1B(); /** Chooses incoming Puts flipped ones in list If necessary will modify costs */ void dualColumn2(); void dualColumn2Most(dualColumnResult & result); void dualColumn2First(dualColumnResult & result); /** Chooses part of incoming Puts flipped ones in list If necessary will modify costs */ void dualColumn2(dualColumnResult & result); /** This sees what is best thing to do in branch and bound cleanup If sequenceIn_ < 0 then can't do anything */ void checkPossibleCleanup(CoinIndexedVector * array); /** Chooses dual pivot row Would be faster with separate region to scan and will have this (with square of infeasibility) when steepest For easy problems we can just choose one of the first rows we look at */ void dualPivotRow(); /** Checks if any fake bounds active - if so returns number and modifies updatedDualBound_ and everything. Free variables will be left as free Returns number of bounds changed if >=0 Returns -1 if not initialize and no effect fills cost of change vector */ int changeBounds(int initialize, double & changeCost); /** As changeBounds but just changes new bounds for a single variable. Returns true if change */ bool changeBound( int iSequence); /// Restores bound to original bound void originalBound(int iSequence); /** Checks if tentative optimal actually means unbounded in dual Returns -3 if not, 2 if is unbounded */ int checkUnbounded(CoinIndexedVector & ray, double changeCost); /** Refactorizes if necessary Checks if finished. Updates status. lastCleaned refers to iteration at which some objective/feasibility cleaning too place. type - 0 initial so set up save arrays etc - 1 normal -if good update save - 2 restoring from saved */ void statusOfProblemInDual(int type); /** Fast iterations. Misses out a lot of initialization. Normally stops on maximum iterations, first re-factorization or tentative optimum. If looks interesting then continues as normal. Returns 0 if finished properly, 1 otherwise. */ /// Gets tableau column - does flips and checks what to do next /// Knows tableau column in 1, flips in 2 and gets an array for flips (as serial here) int whatNext(); /// see if cutoff reached bool checkCutoff(bool computeObjective); /// Does something about fake tolerances int bounceTolerances(int type); /// Perturbs problem void perturb(double factor); /// Perturbs problem B void perturbB(double factor,int type); /// Make non free variables dual feasible by moving to a bound int makeNonFreeVariablesDualFeasible(bool changeCosts=false); int fastDual(bool alwaysFinish = false); /** Checks number of variables at fake bounds. This is used by fastDual so can exit gracefully before end */ int numberAtFakeBound(); /** Pivot in a variable and choose an outgoing one. Assumes dual feasible - will not go through a reduced cost. Returns step length in theta Return codes as before but -1 means no acceptable pivot */ int pivotResultPart1(); /** Get next free , -1 if none */ int nextSuperBasic(); /// Startup part of dual void startupSolve(); /// Ending part of dual void finishSolve(); void gutsOfDual(); //int dual2(int ifValuesPass,int startFinishOptions=0); int resetFakeBounds(int type); //@} }; #if ABC_PARALLEL==1 void * abc_parallelManager(void * simplex); #endif #endif CoinMP-1.8.3/Clp/src/ClpGubDynamicMatrix.cpp0000644000175000017500000030537711571121105017204 0ustar renerene/* $Id: ClpGubDynamicMatrix.cpp 1732 2011-05-31 08:09:41Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" #include "ClpQuadraticObjective.hpp" #include "ClpNonLinearCost.hpp" // at end to get min/max! #include "ClpGubDynamicMatrix.hpp" #include "ClpMessage.hpp" //#define CLP_DEBUG //#define CLP_DEBUG_PRINT //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpGubDynamicMatrix::ClpGubDynamicMatrix () : ClpGubMatrix(), objectiveOffset_(0.0), startColumn_(NULL), row_(NULL), element_(NULL), cost_(NULL), fullStart_(NULL), id_(NULL), dynamicStatus_(NULL), lowerColumn_(NULL), upperColumn_(NULL), lowerSet_(NULL), upperSet_(NULL), numberGubColumns_(0), firstAvailable_(0), savedFirstAvailable_(0), firstDynamic_(0), lastDynamic_(0), numberElements_(0) { setType(13); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpGubDynamicMatrix::ClpGubDynamicMatrix (const ClpGubDynamicMatrix & rhs) : ClpGubMatrix(rhs) { objectiveOffset_ = rhs.objectiveOffset_; numberGubColumns_ = rhs.numberGubColumns_; firstAvailable_ = rhs.firstAvailable_; savedFirstAvailable_ = rhs.savedFirstAvailable_; firstDynamic_ = rhs.firstDynamic_; lastDynamic_ = rhs.lastDynamic_; numberElements_ = rhs.numberElements_; startColumn_ = ClpCopyOfArray(rhs.startColumn_, numberGubColumns_ + 1); CoinBigIndex numberElements = startColumn_[numberGubColumns_]; row_ = ClpCopyOfArray(rhs.row_, numberElements);; element_ = ClpCopyOfArray(rhs.element_, numberElements);; cost_ = ClpCopyOfArray(rhs.cost_, numberGubColumns_); fullStart_ = ClpCopyOfArray(rhs.fullStart_, numberSets_ + 1); id_ = ClpCopyOfArray(rhs.id_, lastDynamic_ - firstDynamic_); lowerColumn_ = ClpCopyOfArray(rhs.lowerColumn_, numberGubColumns_); upperColumn_ = ClpCopyOfArray(rhs.upperColumn_, numberGubColumns_); dynamicStatus_ = ClpCopyOfArray(rhs.dynamicStatus_, numberGubColumns_); lowerSet_ = ClpCopyOfArray(rhs.lowerSet_, numberSets_); upperSet_ = ClpCopyOfArray(rhs.upperSet_, numberSets_); } /* This is the real constructor*/ ClpGubDynamicMatrix::ClpGubDynamicMatrix(ClpSimplex * model, int numberSets, int numberGubColumns, const int * starts, const double * lower, const double * upper, const CoinBigIndex * startColumn, const int * row, const double * element, const double * cost, const double * lowerColumn, const double * upperColumn, const unsigned char * status) : ClpGubMatrix() { objectiveOffset_ = model->objectiveOffset(); model_ = model; numberSets_ = numberSets; numberGubColumns_ = numberGubColumns; fullStart_ = ClpCopyOfArray(starts, numberSets_ + 1); lower_ = ClpCopyOfArray(lower, numberSets_); upper_ = ClpCopyOfArray(upper, numberSets_); int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); // Number of columns needed int numberGubInSmall = numberSets_ + numberRows + 2 * model->factorizationFrequency() + 2; // for small problems this could be too big //numberGubInSmall = CoinMin(numberGubInSmall,numberGubColumns_); int numberNeeded = numberGubInSmall + numberColumns; firstAvailable_ = numberColumns; savedFirstAvailable_ = numberColumns; firstDynamic_ = numberColumns; lastDynamic_ = numberNeeded; startColumn_ = ClpCopyOfArray(startColumn, numberGubColumns_ + 1); CoinBigIndex numberElements = startColumn_[numberGubColumns_]; row_ = ClpCopyOfArray(row, numberElements); element_ = new double[numberElements]; CoinBigIndex i; for (i = 0; i < numberElements; i++) element_[i] = element[i]; cost_ = new double[numberGubColumns_]; for (i = 0; i < numberGubColumns_; i++) { cost_[i] = cost[i]; // need sorted CoinSort_2(row_ + startColumn_[i], row_ + startColumn_[i+1], element_ + startColumn_[i]); } if (lowerColumn) { lowerColumn_ = new double[numberGubColumns_]; for (i = 0; i < numberGubColumns_; i++) lowerColumn_[i] = lowerColumn[i]; } else { lowerColumn_ = NULL; } if (upperColumn) { upperColumn_ = new double[numberGubColumns_]; for (i = 0; i < numberGubColumns_; i++) upperColumn_[i] = upperColumn[i]; } else { upperColumn_ = NULL; } if (upperColumn || lowerColumn) { lowerSet_ = new double[numberSets_]; for (i = 0; i < numberSets_; i++) { if (lower[i] > -1.0e20) lowerSet_[i] = lower[i]; else lowerSet_[i] = -1.0e30; } upperSet_ = new double[numberSets_]; for (i = 0; i < numberSets_; i++) { if (upper[i] < 1.0e20) upperSet_[i] = upper[i]; else upperSet_[i] = 1.0e30; } } else { lowerSet_ = NULL; upperSet_ = NULL; } start_ = NULL; end_ = NULL; dynamicStatus_ = NULL; id_ = new int[numberGubInSmall]; for (i = 0; i < numberGubInSmall; i++) id_[i] = -1; ClpPackedMatrix* originalMatrixA = dynamic_cast< ClpPackedMatrix*>(model->clpMatrix()); assert (originalMatrixA); CoinPackedMatrix * originalMatrix = originalMatrixA->getPackedMatrix(); originalMatrixA->setMatrixNull(); // so can be deleted safely // guess how much space needed double guess = originalMatrix->getNumElements() + 10; guess /= static_cast (numberColumns); guess *= 2 * numberGubColumns_; numberElements_ = static_cast (CoinMin(guess, 10000000.0)); numberElements_ = CoinMin(numberElements_, numberElements) + originalMatrix->getNumElements(); matrix_ = originalMatrix; flags_ &= ~1; // resize model (matrix stays same) model->resize(numberRows, numberNeeded); if (upperColumn_) { // set all upper bounds so we have enough space double * columnUpper = model->columnUpper(); for(i = firstDynamic_; i < lastDynamic_; i++) columnUpper[i] = 1.0e10; } // resize matrix // extra 1 is so can keep number of elements handy originalMatrix->reserve(numberNeeded, numberElements_, true); originalMatrix->reserve(numberNeeded + 1, numberElements_, false); originalMatrix->getMutableVectorStarts()[numberColumns] = originalMatrix->getNumElements(); // redo number of columns numberColumns = matrix_->getNumCols(); backward_ = new int[numberNeeded]; backToPivotRow_ = new int[numberNeeded]; // We know a bit better delete [] changeCost_; changeCost_ = new double [numberRows+numberSets_]; keyVariable_ = new int[numberSets_]; // signal to need new ordering next_ = NULL; for (int iColumn = 0; iColumn < numberNeeded; iColumn++) backward_[iColumn] = -1; firstGub_ = firstDynamic_; lastGub_ = lastDynamic_; if (!lowerColumn_ && !upperColumn_) gubType_ = 8; if (status) { status_ = ClpCopyOfArray(status, numberSets_); } else { status_ = new unsigned char [numberSets_]; memset(status_, 0, numberSets_); int i; for (i = 0; i < numberSets_; i++) { // make slack key setStatus(i, ClpSimplex::basic); } } saveStatus_ = new unsigned char [numberSets_]; memset(saveStatus_, 0, numberSets_); savedKeyVariable_ = new int [numberSets_]; memset(savedKeyVariable_, 0, numberSets_ * sizeof(int)); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpGubDynamicMatrix::~ClpGubDynamicMatrix () { delete [] startColumn_; delete [] row_; delete [] element_; delete [] cost_; delete [] fullStart_; delete [] id_; delete [] dynamicStatus_; delete [] lowerColumn_; delete [] upperColumn_; delete [] lowerSet_; delete [] upperSet_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpGubDynamicMatrix & ClpGubDynamicMatrix::operator=(const ClpGubDynamicMatrix& rhs) { if (this != &rhs) { ClpGubMatrix::operator=(rhs); delete [] startColumn_; delete [] row_; delete [] element_; delete [] cost_; delete [] fullStart_; delete [] id_; delete [] dynamicStatus_; delete [] lowerColumn_; delete [] upperColumn_; delete [] lowerSet_; delete [] upperSet_; objectiveOffset_ = rhs.objectiveOffset_; numberGubColumns_ = rhs.numberGubColumns_; firstAvailable_ = rhs.firstAvailable_; savedFirstAvailable_ = rhs.savedFirstAvailable_; firstDynamic_ = rhs.firstDynamic_; lastDynamic_ = rhs.lastDynamic_; numberElements_ = rhs.numberElements_; startColumn_ = ClpCopyOfArray(rhs.startColumn_, numberGubColumns_ + 1); int numberElements = startColumn_[numberGubColumns_]; row_ = ClpCopyOfArray(rhs.row_, numberElements);; element_ = ClpCopyOfArray(rhs.element_, numberElements);; cost_ = ClpCopyOfArray(rhs.cost_, numberGubColumns_); fullStart_ = ClpCopyOfArray(rhs.fullStart_, numberSets_ + 1); id_ = ClpCopyOfArray(rhs.id_, lastDynamic_ - firstDynamic_); lowerColumn_ = ClpCopyOfArray(rhs.lowerColumn_, numberGubColumns_); upperColumn_ = ClpCopyOfArray(rhs.upperColumn_, numberGubColumns_); dynamicStatus_ = ClpCopyOfArray(rhs.dynamicStatus_, numberGubColumns_); lowerSet_ = ClpCopyOfArray(rhs.lowerSet_, numberSets_); upperSet_ = ClpCopyOfArray(rhs.upperSet_, numberSets_); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpMatrixBase * ClpGubDynamicMatrix::clone() const { return new ClpGubDynamicMatrix(*this); } // Partial pricing void ClpGubDynamicMatrix::partialPricing(ClpSimplex * model, double startFraction, double endFraction, int & bestSequence, int & numberWanted) { assert(!model->rowScale()); numberWanted = currentWanted_; if (!numberSets_) { // no gub ClpPackedMatrix::partialPricing(model, startFraction, endFraction, bestSequence, numberWanted); return; } else { // and do some proportion of full set int startG2 = static_cast (startFraction * numberSets_); int endG2 = static_cast (endFraction * numberSets_ + 0.1); endG2 = CoinMin(endG2, numberSets_); //printf("gub price - set start %d end %d\n", // startG2,endG2); double tolerance = model->currentDualTolerance(); double * reducedCost = model->djRegion(); const double * duals = model->dualRowSolution(); double * cost = model->costRegion(); double bestDj; int numberRows = model->numberRows(); int numberColumns = lastDynamic_; // If nothing found yet can go all the way to end int endAll = endG2; if (bestSequence < 0 && !startG2) endAll = numberSets_; if (bestSequence >= 0) bestDj = fabs(reducedCost[bestSequence]); else bestDj = tolerance; int saveSequence = bestSequence; double djMod = 0.0; double infeasibilityCost = model->infeasibilityCost(); double bestDjMod = 0.0; //printf("iteration %d start %d end %d - wanted %d\n",model->numberIterations(), // startG2,endG2,numberWanted); int bestType = -1; int bestSet = -1; const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); int * length = matrix_->getMutableVectorLengths(); #if 0 // make sure first available is clean (in case last iteration rejected) cost[firstAvailable_] = 0.0; length[firstAvailable_] = 0; model->nonLinearCost()->setOne(firstAvailable_, 0.0, 0.0, COIN_DBL_MAX, 0.0); model->setStatus(firstAvailable_, ClpSimplex::atLowerBound); { for (int i = firstAvailable_; i < lastDynamic_; i++) assert(!cost[i]); } #endif #ifdef CLP_DEBUG { for (int i = firstDynamic_; i < firstAvailable_; i++) { assert (getDynamicStatus(id_[i-firstDynamic_]) == inSmall); } } #endif int minSet = minimumObjectsScan_ < 0 ? 5 : minimumObjectsScan_; int minNeg = minimumGoodReducedCosts_ < 0 ? 5 : minimumGoodReducedCosts_; for (int iSet = startG2; iSet < endAll; iSet++) { if (numberWanted + minNeg < originalWanted_ && iSet > startG2 + minSet) { // give up numberWanted = 0; break; } else if (iSet == endG2 && bestSequence >= 0) { break; } CoinBigIndex j; int iBasic = keyVariable_[iSet]; if (iBasic >= numberColumns) { djMod = - weight(iSet) * infeasibilityCost; } else { // get dj without assert (model->getStatus(iBasic) == ClpSimplex::basic); djMod = 0.0; for (j = startColumn[iBasic]; j < startColumn[iBasic] + length[iBasic]; j++) { int jRow = row[j]; djMod -= duals[jRow] * element[j]; } djMod += cost[iBasic]; // See if gub slack possible - dj is djMod if (getStatus(iSet) == ClpSimplex::atLowerBound) { double value = -djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = numberRows + numberColumns + iSet; bestDjMod = djMod; bestType = 0; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } else if (getStatus(iSet) == ClpSimplex::atUpperBound) { double value = djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = numberRows + numberColumns + iSet; bestDjMod = djMod; bestType = 0; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } } for (int iSequence = fullStart_[iSet]; iSequence < fullStart_[iSet+1]; iSequence++) { DynamicStatus status = getDynamicStatus(iSequence); if (status != inSmall) { double value = cost_[iSequence] - djMod; for (j = startColumn_[iSequence]; j < startColumn_[iSequence+1]; j++) { int jRow = row_[j]; value -= duals[jRow] * element_[j]; } // change sign if at lower bound if (status == atLowerBound) value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSequence)) { bestDj = value; bestSequence = iSequence; bestDjMod = djMod; bestType = 1; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; } } } } } if (numberWanted <= 0) { numberWanted = 0; break; } } // Do packed part before gub and small gub - but lightly int saveMinNeg = minimumGoodReducedCosts_; int saveSequence2 = bestSequence; if (bestSequence >= 0) minimumGoodReducedCosts_ = -2; int saveLast = lastGub_; lastGub_ = firstAvailable_; currentWanted_ = numberWanted; ClpGubMatrix::partialPricing(model, startFraction, endFraction, bestSequence, numberWanted); minimumGoodReducedCosts_ = saveMinNeg; lastGub_ = saveLast; if (bestSequence != saveSequence2) { bestType = -1; // in normal or small gub part saveSequence = bestSequence; } if (bestSequence != saveSequence || bestType >= 0) { double * lowerColumn = model->lowerRegion(); double * upperColumn = model->upperRegion(); double * solution = model->solutionRegion(); if (bestType > 0) { // recompute dj and create double value = cost_[bestSequence] - bestDjMod; for (CoinBigIndex jBigIndex = startColumn_[bestSequence]; jBigIndex < startColumn_[bestSequence+1]; jBigIndex++) { int jRow = row_[jBigIndex]; value -= duals[jRow] * element_[jBigIndex]; } double * element = matrix_->getMutableElements(); int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int * length = matrix_->getMutableVectorLengths(); CoinBigIndex numberElements = startColumn[firstAvailable_]; int numberThis = startColumn_[bestSequence+1] - startColumn_[bestSequence]; if (numberElements + numberThis > numberElements_) { // need to redo numberElements_ = CoinMax(3 * numberElements_ / 2, numberElements + numberThis); matrix_->reserve(numberColumns, numberElements_); element = matrix_->getMutableElements(); row = matrix_->getMutableIndices(); // these probably okay but be safe startColumn = matrix_->getMutableVectorStarts(); length = matrix_->getMutableVectorLengths(); } // already set startColumn[firstAvailable_]=numberElements; length[firstAvailable_] = numberThis; model->costRegion()[firstAvailable_] = cost_[bestSequence]; CoinBigIndex base = startColumn_[bestSequence]; for (int j = 0; j < numberThis; j++) { row[numberElements] = row_[base+j]; element[numberElements++] = element_[base+j]; } id_[firstAvailable_-firstDynamic_] = bestSequence; //printf("best %d\n",bestSequence); backward_[firstAvailable_] = bestSet; model->solutionRegion()[firstAvailable_] = 0.0; if (!lowerColumn_ && !upperColumn_) { model->setStatus(firstAvailable_, ClpSimplex::atLowerBound); lowerColumn[firstAvailable_] = 0.0; upperColumn[firstAvailable_] = COIN_DBL_MAX; } else { DynamicStatus status = getDynamicStatus(bestSequence); if (lowerColumn_) lowerColumn[firstAvailable_] = lowerColumn_[bestSequence]; else lowerColumn[firstAvailable_] = 0.0; if (upperColumn_) upperColumn[firstAvailable_] = upperColumn_[bestSequence]; else upperColumn[firstAvailable_] = COIN_DBL_MAX; if (status == atLowerBound) { solution[firstAvailable_] = lowerColumn[firstAvailable_]; model->setStatus(firstAvailable_, ClpSimplex::atLowerBound); } else { solution[firstAvailable_] = upperColumn[firstAvailable_]; model->setStatus(firstAvailable_, ClpSimplex::atUpperBound); } } model->nonLinearCost()->setOne(firstAvailable_, solution[firstAvailable_], lowerColumn[firstAvailable_], upperColumn[firstAvailable_], cost_[bestSequence]); bestSequence = firstAvailable_; // firstAvailable_ only updated if good pivot (in updatePivot) startColumn[firstAvailable_+1] = numberElements; //printf("price struct %d - dj %g gubpi %g\n",bestSequence,value,bestDjMod); reducedCost[bestSequence] = value; gubSlackIn_ = -1; } else { // slack - make last column gubSlackIn_ = bestSequence - numberRows - numberColumns; bestSequence = numberColumns + 2 * numberRows; reducedCost[bestSequence] = bestDjMod; //printf("price slack %d - gubpi %g\n",gubSlackIn_,bestDjMod); model->setStatus(bestSequence, getStatus(gubSlackIn_)); if (getStatus(gubSlackIn_) == ClpSimplex::atUpperBound) solution[bestSequence] = upper_[gubSlackIn_]; else solution[bestSequence] = lower_[gubSlackIn_]; lowerColumn[bestSequence] = lower_[gubSlackIn_]; upperColumn[bestSequence] = upper_[gubSlackIn_]; model->costRegion()[bestSequence] = 0.0; model->nonLinearCost()->setOne(bestSequence, solution[bestSequence], lowerColumn[bestSequence], upperColumn[bestSequence], 0.0); } savedBestSequence_ = bestSequence; savedBestDj_ = reducedCost[savedBestSequence_]; } // See if may be finished if (!startG2 && bestSequence < 0) infeasibilityWeight_ = model_->infeasibilityCost(); else if (bestSequence >= 0) infeasibilityWeight_ = -1.0; } currentWanted_ = numberWanted; } // This is local to Gub to allow synchronization when status is good int ClpGubDynamicMatrix::synchronize(ClpSimplex * model, int mode) { int returnNumber = 0; switch (mode) { case 0: { #ifdef CLP_DEBUG { for (int i = 0; i < numberSets_; i++) assert(toIndex_[i] == -1); } #endif // lookup array int * lookup = new int[lastDynamic_]; int iColumn; int numberColumns = model->numberColumns(); double * element = matrix_->getMutableElements(); int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int * length = matrix_->getMutableVectorLengths(); double * cost = model->costRegion(); double * lowerColumn = model->lowerRegion(); double * upperColumn = model->upperRegion(); int * pivotVariable = model->pivotVariable(); CoinBigIndex numberElements = startColumn[firstDynamic_]; // first just do lookup and basic stuff int currentNumber = firstAvailable_; firstAvailable_ = firstDynamic_; int numberToDo = 0; double objectiveChange = 0.0; double * solution = model->solutionRegion(); for (iColumn = firstDynamic_; iColumn < currentNumber; iColumn++) { int iSet = backward_[iColumn]; if (toIndex_[iSet] < 0) { toIndex_[iSet] = 0; fromIndex_[numberToDo++] = iSet; } if (model->getStatus(iColumn) == ClpSimplex::basic || iColumn == keyVariable_[iSet]) { lookup[iColumn] = firstAvailable_; if (iColumn != keyVariable_[iSet]) { int iPivot = backToPivotRow_[iColumn]; backToPivotRow_[firstAvailable_] = iPivot; pivotVariable[iPivot] = firstAvailable_; } firstAvailable_++; } else { int jColumn = id_[iColumn-firstDynamic_]; setDynamicStatus(jColumn, atLowerBound); if (lowerColumn_ || upperColumn_) { if (model->getStatus(iColumn) == ClpSimplex::atUpperBound) setDynamicStatus(jColumn, atUpperBound); // treat solution as if exactly at a bound double value = solution[iColumn]; if (fabs(value - lowerColumn[iColumn]) < fabs(value - upperColumn[iColumn])) value = lowerColumn[iColumn]; else value = upperColumn[iColumn]; objectiveChange += cost[iColumn] * value; // redo lower and upper on sets double shift = value; if (lowerSet_[iSet] > -1.0e20) lower_[iSet] = lowerSet_[iSet] - shift; if (upperSet_[iSet] < 1.0e20) upper_[iSet] = upperSet_[iSet] - shift; } lookup[iColumn] = -1; } } model->setObjectiveOffset(model->objectiveOffset() + objectiveChange); firstAvailable_ = firstDynamic_; for (iColumn = firstDynamic_; iColumn < currentNumber; iColumn++) { if (lookup[iColumn] >= 0) { // move int jColumn = id_[iColumn-firstDynamic_]; id_[firstAvailable_-firstDynamic_] = jColumn; int numberThis = startColumn_[jColumn+1] - startColumn_[jColumn]; length[firstAvailable_] = numberThis; cost[firstAvailable_] = cost[iColumn]; lowerColumn[firstAvailable_] = lowerColumn[iColumn]; upperColumn[firstAvailable_] = upperColumn[iColumn]; double originalLower = lowerColumn_ ? lowerColumn_[jColumn] : 0.0; double originalUpper = upperColumn_ ? upperColumn_[jColumn] : COIN_DBL_MAX; if (originalUpper > 1.0e30) originalUpper = COIN_DBL_MAX; model->nonLinearCost()->setOne(firstAvailable_, solution[iColumn], originalLower, originalUpper, cost_[jColumn]); CoinBigIndex base = startColumn_[jColumn]; for (int j = 0; j < numberThis; j++) { row[numberElements] = row_[base+j]; element[numberElements++] = element_[base+j]; } model->setStatus(firstAvailable_, model->getStatus(iColumn)); backward_[firstAvailable_] = backward_[iColumn]; solution[firstAvailable_] = solution[iColumn]; firstAvailable_++; startColumn[firstAvailable_] = numberElements; } } // clean up next_ int * temp = new int [firstAvailable_]; for (int jSet = 0; jSet < numberToDo; jSet++) { int iSet = fromIndex_[jSet]; toIndex_[iSet] = -1; int last = keyVariable_[iSet]; int j = next_[last]; bool setTemp = true; if (last < lastDynamic_) { last = lookup[last]; assert (last >= 0); keyVariable_[iSet] = last; } else if (j >= 0) { int newJ = lookup[j]; assert (newJ >= 0); j = next_[j]; next_[last] = newJ; last = newJ; } else { next_[last] = -(iSet + numberColumns + 1); setTemp = false; } while (j >= 0) { int newJ = lookup[j]; assert (newJ >= 0); temp[last] = newJ; last = newJ; j = next_[j]; } if (setTemp) temp[last] = -(keyVariable_[iSet] + 1); if (lowerSet_) { // we only need to get lower_ and upper_ correct double shift = 0.0; for (int j = fullStart_[iSet]; j < fullStart_[iSet+1]; j++) if (getDynamicStatus(j) == atUpperBound) shift += upperColumn_[j]; else if (getDynamicStatus(j) == atLowerBound && lowerColumn_) shift += lowerColumn_[j]; if (lowerSet_[iSet] > -1.0e20) lower_[iSet] = lowerSet_[iSet] - shift; if (upperSet_[iSet] < 1.0e20) upper_[iSet] = upperSet_[iSet] - shift; } } // move to next_ CoinMemcpyN(temp + firstDynamic_, (firstAvailable_ - firstDynamic_), next_ + firstDynamic_); // if odd iterations may be one out so adjust currentNumber currentNumber = CoinMin(currentNumber + 1, lastDynamic_); // zero solution CoinZeroN(solution + firstAvailable_, currentNumber - firstAvailable_); // zero cost CoinZeroN(cost + firstAvailable_, currentNumber - firstAvailable_); // zero lengths CoinZeroN(length + firstAvailable_, currentNumber - firstAvailable_); for ( iColumn = firstAvailable_; iColumn < currentNumber; iColumn++) { model->nonLinearCost()->setOne(iColumn, 0.0, 0.0, COIN_DBL_MAX, 0.0); model->setStatus(iColumn, ClpSimplex::atLowerBound); backward_[iColumn] = -1; } delete [] lookup; delete [] temp; // make sure fromIndex clean fromIndex_[0] = -1; //#define CLP_DEBUG #ifdef CLP_DEBUG // debug { int i; int numberRows = model->numberRows(); char * xxxx = new char[numberColumns]; memset(xxxx, 0, numberColumns); for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; assert (model->getStatus(iPivot) == ClpSimplex::basic); if (iPivot < numberColumns && backward_[iPivot] >= 0) xxxx[iPivot] = 1; } for (i = 0; i < numberSets_; i++) { int key = keyVariable_[i]; int iColumn = next_[key]; int k = 0; while(iColumn >= 0) { k++; assert (k < 100); assert (backward_[iColumn] == i); iColumn = next_[iColumn]; } int stop = -(key + 1); while (iColumn != stop) { assert (iColumn < 0); iColumn = -iColumn - 1; k++; assert (k < 100); assert (backward_[iColumn] == i); iColumn = next_[iColumn]; } iColumn = next_[key]; while (iColumn >= 0) { assert (xxxx[iColumn]); xxxx[iColumn] = 0; iColumn = next_[iColumn]; } } for (i = 0; i < numberColumns; i++) { if (i < numberColumns && backward_[i] >= 0) { assert (!xxxx[i] || i == keyVariable_[backward_[i]]); } } delete [] xxxx; } { for (int i = 0; i < numberSets_; i++) assert(toIndex_[i] == -1); } #endif savedFirstAvailable_ = firstAvailable_; } break; // flag a variable case 1: { // id will be sitting at firstAvailable int sequence = id_[firstAvailable_-firstDynamic_]; assert (!flagged(sequence)); setFlagged(sequence); model->clearFlagged(firstAvailable_); } break; // unflag all variables case 2: { for (int i = 0; i < numberGubColumns_; i++) { if (flagged(i)) { unsetFlagged(i); returnNumber++; } } } break; // just reset costs and bounds (primal) case 3: { double * cost = model->costRegion(); double * solution = model->solutionRegion(); double * lowerColumn = model->columnLower(); double * upperColumn = model->columnUpper(); for (int i = firstDynamic_; i < firstAvailable_; i++) { int jColumn = id_[i-firstDynamic_]; cost[i] = cost_[jColumn]; if (!lowerColumn_ && !upperColumn_) { lowerColumn[i] = 0.0; upperColumn[i] = COIN_DBL_MAX; } else { if (lowerColumn_) lowerColumn[i] = lowerColumn_[jColumn]; else lowerColumn[i] = 0.0; if (upperColumn_) upperColumn[i] = upperColumn_[jColumn]; else upperColumn[i] = COIN_DBL_MAX; } if (model->nonLinearCost()) model->nonLinearCost()->setOne(i, solution[i], lowerColumn[i], upperColumn[i], cost_[jColumn]); } if (!model->numberIterations() && rhsOffset_) { lastRefresh_ = - refreshFrequency_; // force refresh } } break; // and get statistics for column generation case 4: { // In theory we should subtract out ones we have done but .... // If key slack then dual 0.0 // If not then slack could be dual infeasible // dj for key is zero so that defines dual on set int i; int numberColumns = model->numberColumns(); double * dual = model->dualRowSolution(); double infeasibilityCost = model->infeasibilityCost(); double dualTolerance = model->dualTolerance(); double relaxedTolerance = dualTolerance; // we can't really trust infeasibilities if there is dual error double error = CoinMin(1.0e-2, model->largestDualError()); // allow tolerance at least slightly bigger than standard relaxedTolerance = relaxedTolerance + error; // but we will be using difference relaxedTolerance -= dualTolerance; double objectiveOffset = 0.0; for (i = 0; i < numberSets_; i++) { int kColumn = keyVariable_[i]; double value = 0.0; if (kColumn < numberColumns) { kColumn = id_[kColumn-firstDynamic_]; // dj without set value = cost_[kColumn]; for (CoinBigIndex j = startColumn_[kColumn]; j < startColumn_[kColumn+1]; j++) { int iRow = row_[j]; value -= dual[iRow] * element_[j]; } double infeasibility = 0.0; if (getStatus(i) == ClpSimplex::atLowerBound) { if (-value > dualTolerance) infeasibility = -value - dualTolerance; } else if (getStatus(i) == ClpSimplex::atUpperBound) { if (value > dualTolerance) infeasibility = value - dualTolerance; } if (infeasibility > 0.0) { sumDualInfeasibilities_ += infeasibility; if (infeasibility > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += infeasibility; numberDualInfeasibilities_ ++; } } else { // slack key - may not be feasible assert (getStatus(i) == ClpSimplex::basic); // negative as -1.0 for slack value = -weight(i) * infeasibilityCost; } // Now subtract out from all for (CoinBigIndex k = fullStart_[i]; k < fullStart_[i+1]; k++) { if (getDynamicStatus(k) != inSmall) { double djValue = cost_[k] - value; for (CoinBigIndex j = startColumn_[k]; j < startColumn_[k+1]; j++) { int iRow = row_[j]; djValue -= dual[iRow] * element_[j]; } double infeasibility = 0.0; double shift = 0.0; if (getDynamicStatus(k) == atLowerBound) { if (lowerColumn_) shift = lowerColumn_[k]; if (djValue < -dualTolerance) infeasibility = -djValue - dualTolerance; } else { // at upper bound shift = upperColumn_[k]; if (djValue > dualTolerance) infeasibility = djValue - dualTolerance; } objectiveOffset += shift * cost_[k]; if (infeasibility > 0.0) { sumDualInfeasibilities_ += infeasibility; if (infeasibility > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += infeasibility; numberDualInfeasibilities_ ++; } } } } model->setObjectiveOffset(objectiveOffset_ - objectiveOffset); } break; // see if time to re-factorize case 5: { if (firstAvailable_ > numberSets_ + model->numberRows() + model->factorizationFrequency()) returnNumber = 4; } break; // return 1 if there may be changing bounds on variable (column generation) case 6: { returnNumber = (lowerColumn_ != NULL || upperColumn_ != NULL) ? 1 : 0; #if 0 if (!returnNumber) { // may be gub slacks for (int i = 0; i < numberSets_; i++) { if (upper_[i] > lower_[i]) { returnNumber = 1; break; } } } #endif } break; // restore firstAvailable_ case 7: { int iColumn; int * length = matrix_->getMutableVectorLengths(); double * cost = model->costRegion(); double * solution = model->solutionRegion(); int currentNumber = firstAvailable_; firstAvailable_ = savedFirstAvailable_; // zero solution CoinZeroN(solution + firstAvailable_, currentNumber - firstAvailable_); // zero cost CoinZeroN(cost + firstAvailable_, currentNumber - firstAvailable_); // zero lengths CoinZeroN(length + firstAvailable_, currentNumber - firstAvailable_); for ( iColumn = firstAvailable_; iColumn < currentNumber; iColumn++) { model->nonLinearCost()->setOne(iColumn, 0.0, 0.0, COIN_DBL_MAX, 0.0); model->setStatus(iColumn, ClpSimplex::atLowerBound); backward_[iColumn] = -1; } } break; // make sure set is clean case 8: { int sequenceIn = model->sequenceIn(); if (sequenceIn < model->numberColumns()) { int iSet = backward_[sequenceIn]; if (iSet >= 0 && lowerSet_) { // we only need to get lower_ and upper_ correct double shift = 0.0; for (int j = fullStart_[iSet]; j < fullStart_[iSet+1]; j++) if (getDynamicStatus(j) == atUpperBound) shift += upperColumn_[j]; else if (getDynamicStatus(j) == atLowerBound && lowerColumn_) shift += lowerColumn_[j]; if (lowerSet_[iSet] > -1.0e20) lower_[iSet] = lowerSet_[iSet] - shift; if (upperSet_[iSet] < 1.0e20) upper_[iSet] = upperSet_[iSet] - shift; } if (sequenceIn == firstAvailable_) { // not really in small problem int iBig = id_[sequenceIn-firstDynamic_]; if (model->getStatus(sequenceIn) == ClpSimplex::atLowerBound) setDynamicStatus(iBig, atLowerBound); else setDynamicStatus(iBig, atUpperBound); } } } break; // adjust lower,upper case 9: { int sequenceIn = model->sequenceIn(); if (sequenceIn >= firstDynamic_ && sequenceIn < lastDynamic_ && lowerSet_) { int iSet = backward_[sequenceIn]; assert (iSet >= 0); int inBig = id_[sequenceIn-firstDynamic_]; const double * solution = model->solutionRegion(); setDynamicStatus(inBig, inSmall); if (lowerSet_[iSet] > -1.0e20) lower_[iSet] += solution[sequenceIn]; if (upperSet_[iSet] < 1.0e20) upper_[iSet] += solution[sequenceIn]; model->setObjectiveOffset(model->objectiveOffset() - solution[sequenceIn]*cost_[inBig]); } } } return returnNumber; } // Add a new variable to a set void ClpGubDynamicMatrix::insertNonBasic(int sequence, int iSet) { int last = keyVariable_[iSet]; int j = next_[last]; while (j >= 0) { last = j; j = next_[j]; } next_[last] = -(sequence + 1); next_[sequence] = j; } // Sets up an effective RHS and does gub crash if needed void ClpGubDynamicMatrix::useEffectiveRhs(ClpSimplex * model, bool cheapest) { // Do basis - cheapest or slack if feasible (unless cheapest set) int longestSet = 0; int iSet; for (iSet = 0; iSet < numberSets_; iSet++) longestSet = CoinMax(longestSet, fullStart_[iSet+1] - fullStart_[iSet]); double * upper = new double[longestSet+1]; double * cost = new double[longestSet+1]; double * lower = new double[longestSet+1]; double * solution = new double[longestSet+1]; assert (!next_); delete [] next_; int numberColumns = model->numberColumns(); next_ = new int[numberColumns+numberSets_+CoinMax(2*longestSet, lastDynamic_-firstDynamic_)]; char * mark = new char[numberColumns]; memset(mark, 0, numberColumns); for (int iColumn = 0; iColumn < numberColumns; iColumn++) next_[iColumn] = COIN_INT_MAX; int i; int * keys = new int[numberSets_]; int * back = new int[numberGubColumns_]; CoinFillN(back, numberGubColumns_, -1); for (i = 0; i < numberSets_; i++) keys[i] = COIN_INT_MAX; delete [] dynamicStatus_; dynamicStatus_ = new unsigned char [numberGubColumns_]; memset(dynamicStatus_, 0, numberGubColumns_); // for clarity for (i = 0; i < numberGubColumns_; i++) setDynamicStatus(i, atLowerBound); // set up chains for (i = firstDynamic_; i < lastDynamic_; i++) { if (id_[i-firstDynamic_] >= 0) { if (model->getStatus(i) == ClpSimplex::basic) mark[i] = 1; int iSet = backward_[i]; assert (iSet >= 0); int iNext = keys[iSet]; next_[i] = iNext; keys[iSet] = i; back[id_[i-firstDynamic_]] = i; } else { model->setStatus(i, ClpSimplex::atLowerBound); backward_[i] = -1; } } double * columnSolution = model->solutionRegion(); int numberRows = getNumRows(); toIndex_ = new int[numberSets_]; for (iSet = 0; iSet < numberSets_; iSet++) toIndex_[iSet] = -1; fromIndex_ = new int [numberRows+numberSets_]; double tolerance = model->primalTolerance(); double * element = matrix_->getMutableElements(); int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int * length = matrix_->getMutableVectorLengths(); double objectiveOffset = 0.0; for (iSet = 0; iSet < numberSets_; iSet++) { int j; int numberBasic = 0; int iBasic = -1; int iStart = fullStart_[iSet]; int iEnd = fullStart_[iSet+1]; // find one with smallest length int smallest = numberRows + 1; double value = 0.0; j = keys[iSet]; while (j != COIN_INT_MAX) { if (model->getStatus(j) == ClpSimplex::basic) { if (length[j] < smallest) { smallest = length[j]; iBasic = j; } numberBasic++; } value += columnSolution[j]; j = next_[j]; } bool done = false; if (numberBasic > 1 || (numberBasic == 1 && getStatus(iSet) == ClpSimplex::basic)) { if (getStatus(iSet) == ClpSimplex::basic) iBasic = iSet + numberColumns; // slack key - use done = true; } else if (numberBasic == 1) { // see if can be key double thisSolution = columnSolution[iBasic]; if (thisSolution < 0.0) { value -= thisSolution; thisSolution = 0.0; columnSolution[iBasic] = thisSolution; } // try setting slack to a bound assert (upper_[iSet] < 1.0e20 || lower_[iSet] > -1.0e20); double cost1 = COIN_DBL_MAX; int whichBound = -1; if (upper_[iSet] < 1.0e20) { // try slack at ub double newBasic = thisSolution + upper_[iSet] - value; if (newBasic >= -tolerance) { // can go whichBound = 1; cost1 = newBasic * cost_[iBasic]; // But if exact then may be good solution if (fabs(upper_[iSet] - value) < tolerance) cost1 = -COIN_DBL_MAX; } } if (lower_[iSet] > -1.0e20) { // try slack at lb double newBasic = thisSolution + lower_[iSet] - value; if (newBasic >= -tolerance) { // can go but is it cheaper double cost2 = newBasic * cost_[iBasic]; // But if exact then may be good solution if (fabs(lower_[iSet] - value) < tolerance) cost2 = -COIN_DBL_MAX; if (cost2 < cost1) whichBound = 0; } } if (whichBound != -1) { // key done = true; if (whichBound) { // slack to upper columnSolution[iBasic] = thisSolution + upper_[iSet] - value; setStatus(iSet, ClpSimplex::atUpperBound); } else { // slack to lower columnSolution[iBasic] = thisSolution + lower_[iSet] - value; setStatus(iSet, ClpSimplex::atLowerBound); } } } if (!done) { if (!cheapest) { // see if slack can be key if (value >= lower_[iSet] - tolerance && value <= upper_[iSet] + tolerance) { done = true; setStatus(iSet, ClpSimplex::basic); iBasic = iSet + numberColumns; } } if (!done) { // set non basic if there was one if (iBasic >= 0) model->setStatus(iBasic, ClpSimplex::atLowerBound); // find cheapest int numberInSet = iEnd - iStart; if (!lowerColumn_) { CoinZeroN(lower, numberInSet); } else { for (int j = 0; j < numberInSet; j++) lower[j] = lowerColumn_[j+iStart]; } if (!upperColumn_) { CoinFillN(upper, numberInSet, COIN_DBL_MAX); } else { for (int j = 0; j < numberInSet; j++) upper[j] = upperColumn_[j+iStart]; } CoinFillN(solution, numberInSet, 0.0); // and slack iBasic = numberInSet; solution[iBasic] = -value; lower[iBasic] = -upper_[iSet]; upper[iBasic] = -lower_[iSet]; int kphase; if (value >= lower_[iSet] - tolerance && value <= upper_[iSet] + tolerance) { // feasible kphase = 1; cost[iBasic] = 0.0; for (int j = 0; j < numberInSet; j++) cost[j] = cost_[j+iStart]; } else { // infeasible kphase = 0; // remember bounds are flipped so opposite to natural if (value < lower_[iSet] - tolerance) cost[iBasic] = 1.0; else cost[iBasic] = -1.0; CoinZeroN(cost, numberInSet); } double dualTolerance = model->dualTolerance(); for (int iphase = kphase; iphase < 2; iphase++) { if (iphase) { cost[numberInSet] = 0.0; for (int j = 0; j < numberInSet; j++) cost[j] = cost_[j+iStart]; } // now do one row lp bool improve = true; while (improve) { improve = false; double dual = cost[iBasic]; int chosen = -1; double best = dualTolerance; int way = 0; for (int i = 0; i <= numberInSet; i++) { double dj = cost[i] - dual; double improvement = 0.0; if (iphase || i < numberInSet) assert (solution[i] >= lower[i] && solution[i] <= upper[i]); if (dj > dualTolerance) improvement = dj * (solution[i] - lower[i]); else if (dj < -dualTolerance) improvement = dj * (solution[i] - upper[i]); if (improvement > best) { best = improvement; chosen = i; if (dj < 0.0) { way = 1; } else { way = -1; } } } if (chosen >= 0) { improve = true; // now see how far if (way > 0) { // incoming increasing so basic decreasing // if phase 0 then go to nearest bound double distance = upper[chosen] - solution[chosen]; double basicDistance; if (!iphase) { assert (iBasic == numberInSet); assert (solution[iBasic] > upper[iBasic]); basicDistance = solution[iBasic] - upper[iBasic]; } else { basicDistance = solution[iBasic] - lower[iBasic]; } // need extra coding for unbounded assert (CoinMin(distance, basicDistance) < 1.0e20); if (distance > basicDistance) { // incoming becomes basic solution[chosen] += basicDistance; if (!iphase) solution[iBasic] = upper[iBasic]; else solution[iBasic] = lower[iBasic]; iBasic = chosen; } else { // flip solution[chosen] = upper[chosen]; solution[iBasic] -= distance; } } else { // incoming decreasing so basic increasing // if phase 0 then go to nearest bound double distance = solution[chosen] - lower[chosen]; double basicDistance; if (!iphase) { assert (iBasic == numberInSet); assert (solution[iBasic] < lower[iBasic]); basicDistance = lower[iBasic] - solution[iBasic]; } else { basicDistance = upper[iBasic] - solution[iBasic]; } // need extra coding for unbounded - for now just exit if (CoinMin(distance, basicDistance) > 1.0e20) { printf("unbounded on set %d\n", iSet); iphase = 1; iBasic = numberInSet; break; } if (distance > basicDistance) { // incoming becomes basic solution[chosen] -= basicDistance; if (!iphase) solution[iBasic] = lower[iBasic]; else solution[iBasic] = upper[iBasic]; iBasic = chosen; } else { // flip solution[chosen] = lower[chosen]; solution[iBasic] += distance; } } if (!iphase) { if(iBasic < numberInSet) break; // feasible else if (solution[iBasic] >= lower[iBasic] && solution[iBasic] <= upper[iBasic]) break; // feasible (on flip) } } } } // do solution i.e. bounds if (lowerColumn_ || upperColumn_) { for (int j = 0; j < numberInSet; j++) { if (j != iBasic) { objectiveOffset += solution[j] * cost[j]; if (lowerColumn_ && upperColumn_) { if (fabs(solution[j] - lowerColumn_[j+iStart]) > fabs(solution[j] - upperColumn_[j+iStart])) setDynamicStatus(j + iStart, atUpperBound); } else if (upperColumn_ && solution[j] > 0.0) { setDynamicStatus(j + iStart, atUpperBound); } else { setDynamicStatus(j + iStart, atLowerBound); } } } } // convert iBasic back and do bounds if (iBasic == numberInSet) { // slack basic setStatus(iSet, ClpSimplex::basic); iBasic = iSet + numberColumns; } else { iBasic += fullStart_[iSet]; if (back[iBasic] >= 0) { // exists iBasic = back[iBasic]; } else { // create CoinBigIndex numberElements = startColumn[firstAvailable_]; int numberThis = startColumn_[iBasic+1] - startColumn_[iBasic]; if (numberElements + numberThis > numberElements_) { // need to redo numberElements_ = CoinMax(3 * numberElements_ / 2, numberElements + numberThis); matrix_->reserve(numberColumns, numberElements_); element = matrix_->getMutableElements(); row = matrix_->getMutableIndices(); // these probably okay but be safe startColumn = matrix_->getMutableVectorStarts(); length = matrix_->getMutableVectorLengths(); } length[firstAvailable_] = numberThis; model->costRegion()[firstAvailable_] = cost_[iBasic]; if (lowerColumn_) model->lowerRegion()[firstAvailable_] = lowerColumn_[iBasic]; else model->lowerRegion()[firstAvailable_] = 0.0; if (upperColumn_) model->upperRegion()[firstAvailable_] = upperColumn_[iBasic]; else model->upperRegion()[firstAvailable_] = COIN_DBL_MAX; columnSolution[firstAvailable_] = solution[iBasic-fullStart_[iSet]]; CoinBigIndex base = startColumn_[iBasic]; for (int j = 0; j < numberThis; j++) { row[numberElements] = row_[base+j]; element[numberElements++] = element_[base+j]; } // already set startColumn[firstAvailable_]=numberElements; id_[firstAvailable_-firstDynamic_] = iBasic; setDynamicStatus(iBasic, inSmall); backward_[firstAvailable_] = iSet; iBasic = firstAvailable_; firstAvailable_++; startColumn[firstAvailable_] = numberElements; } model->setStatus(iBasic, ClpSimplex::basic); // remember bounds flipped if (upper[numberInSet] == lower[numberInSet]) setStatus(iSet, ClpSimplex::isFixed); else if (solution[numberInSet] == upper[numberInSet]) setStatus(iSet, ClpSimplex::atLowerBound); else if (solution[numberInSet] == lower[numberInSet]) setStatus(iSet, ClpSimplex::atUpperBound); else abort(); } for (j = iStart; j < iEnd; j++) { int iBack = back[j]; if (iBack >= 0) { if (model->getStatus(iBack) != ClpSimplex::basic) { int inSet = j - iStart; columnSolution[iBack] = solution[inSet]; if (upper[inSet] == lower[inSet]) model->setStatus(iBack, ClpSimplex::isFixed); else if (solution[inSet] == upper[inSet]) model->setStatus(iBack, ClpSimplex::atUpperBound); else if (solution[inSet] == lower[inSet]) model->setStatus(iBack, ClpSimplex::atLowerBound); } } } } } keyVariable_[iSet] = iBasic; } model->setObjectiveOffset(objectiveOffset_ - objectiveOffset); delete [] lower; delete [] solution; delete [] upper; delete [] cost; // make sure matrix is in good shape matrix_->orderMatrix(); // create effective rhs delete [] rhsOffset_; rhsOffset_ = new double[numberRows]; // and redo chains memset(mark, 0, numberColumns); for (int iColumnX = 0; iColumnX < firstAvailable_; iColumnX++) next_[iColumnX] = COIN_INT_MAX; for (i = 0; i < numberSets_; i++) { keys[i] = COIN_INT_MAX; int iKey = keyVariable_[i]; if (iKey < numberColumns) model->setStatus(iKey, ClpSimplex::basic); } // set up chains for (i = 0; i < firstAvailable_; i++) { if (model->getStatus(i) == ClpSimplex::basic) mark[i] = 1; int iSet = backward_[i]; if (iSet >= 0) { int iNext = keys[iSet]; next_[i] = iNext; keys[iSet] = i; } } for (i = 0; i < numberSets_; i++) { if (keys[i] != COIN_INT_MAX) { // something in set int j; if (getStatus(i) != ClpSimplex::basic) { // make sure fixed if it is if (upper_[i] == lower_[i]) setStatus(i, ClpSimplex::isFixed); // slack not key - choose one with smallest length int smallest = numberRows + 1; int key = -1; j = keys[i]; while (1) { if (mark[j] && length[j] < smallest) { key = j; smallest = length[j]; } if (next_[j] != COIN_INT_MAX) { j = next_[j]; } else { // correct end next_[j] = -(keys[i] + 1); break; } } if (key >= 0) { keyVariable_[i] = key; } else { // nothing basic - make slack key //((ClpGubMatrix *)this)->setStatus(i,ClpSimplex::basic); // fudge to avoid const problem status_[i] = 1; } } else { // slack key keyVariable_[i] = numberColumns + i; int j; double sol = 0.0; j = keys[i]; while (1) { sol += columnSolution[j]; if (next_[j] != COIN_INT_MAX) { j = next_[j]; } else { // correct end next_[j] = -(keys[i] + 1); break; } } if (sol > upper_[i] + tolerance) { setAbove(i); } else if (sol < lower_[i] - tolerance) { setBelow(i); } else { setFeasible(i); } } // Create next_ int key = keyVariable_[i]; redoSet(model, key, keys[i], i); } else { // nothing in set! next_[i+numberColumns] = -(i + numberColumns + 1); keyVariable_[i] = numberColumns + i; double sol = 0.0; if (sol > upper_[i] + tolerance) { setAbove(i); } else if (sol < lower_[i] - tolerance) { setBelow(i); } else { setFeasible(i); } } } delete [] keys; delete [] mark; delete [] back; rhsOffset(model, true); } /* Returns effective RHS if it is being used. This is used for long problems or big gub or anywhere where going through full columns is expensive. This may re-compute */ double * ClpGubDynamicMatrix::rhsOffset(ClpSimplex * model, bool forceRefresh, bool #ifdef CLP_DEBUG check #endif ) { //forceRefresh=true; //check=false; #ifdef CLP_DEBUG double * saveE = NULL; if (rhsOffset_ && check) { int numberRows = model->numberRows(); saveE = new double[numberRows]; } #endif if (rhsOffset_) { #ifdef CLP_DEBUG if (check) { // no need - but check anyway int numberRows = model->numberRows(); double * rhs = new double[numberRows]; int numberColumns = model->numberColumns(); int iRow; CoinZeroN(rhs, numberRows); // do ones at bounds before gub const double * smallSolution = model->solutionRegion(); const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); int iColumn; for (iColumn = 0; iColumn < firstDynamic_; iColumn++) { if (model->getStatus(iColumn) != ClpSimplex::basic) { double value = smallSolution[iColumn]; for (CoinBigIndex j = startColumn[iColumn]; j < startColumn[iColumn] + length[iColumn]; j++) { int jRow = row[j]; rhs[jRow] -= value * element[j]; } } } if (lowerColumn_ || upperColumn_) { double * solution = new double [numberGubColumns_]; for (iColumn = 0; iColumn < numberGubColumns_; iColumn++) { double value = 0.0; if(getDynamicStatus(iColumn) == atUpperBound) value = upperColumn_[iColumn]; else if (lowerColumn_) value = lowerColumn_[iColumn]; solution[iColumn] = value; } // ones at bounds in small and gub for (iColumn = firstDynamic_; iColumn < firstAvailable_; iColumn++) { int jFull = id_[iColumn-firstDynamic_]; solution[jFull] = smallSolution[iColumn]; } // zero all basic in small model int * pivotVariable = model->pivotVariable(); for (iRow = 0; iRow < numberRows; iRow++) { int iColumn = pivotVariable[iRow]; if (iColumn >= firstDynamic_ && iColumn < lastDynamic_) { int iSequence = id_[iColumn-firstDynamic_]; solution[iSequence] = 0.0; } } // and now compute value to use for key ClpSimplex::Status iStatus; for (int iSet = 0; iSet < numberSets_; iSet++) { iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) { int iSequence = id_[iColumn-firstDynamic_]; solution[iSequence] = 0.0; double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lowerSet_[iSet]; else b = upperSet_[iSet]; // subtract out others at bounds for (int j = fullStart_[iSet]; j < fullStart_[iSet+1]; j++) b -= solution[j]; solution[iSequence] = b; } } for (iColumn = 0; iColumn < numberGubColumns_; iColumn++) { double value = solution[iColumn]; if (value) { for (CoinBigIndex j = startColumn_[iColumn]; j < startColumn_[iColumn+1]; j++) { int iRow = row_[j]; rhs[iRow] -= element_[j] * value; } } } // now do lower and upper bounds on sets for (int iSet = 0; iSet < numberSets_; iSet++) { iColumn = keyVariable_[iSet]; double shift = 0.0; for (int j = fullStart_[iSet]; j < fullStart_[iSet+1]; j++) { if (getDynamicStatus(j) != inSmall && j != iColumn) { if (getDynamicStatus(j) == atLowerBound) { if (lowerColumn_) shift += lowerColumn_[j]; } else { shift += upperColumn_[j]; } } } if (lowerSet_[iSet] > -1.0e20) assert(fabs(lower_[iSet] - (lowerSet_[iSet] - shift)) < 1.0e-3); if (upperSet_[iSet] < 1.0e20) assert(fabs(upper_[iSet] - ( upperSet_[iSet] - shift)) < 1.0e-3); } delete [] solution; } else { // no bounds ClpSimplex::Status iStatus; for (int iSet = 0; iSet < numberSets_; iSet++) { int iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) { int iSequence = id_[iColumn-firstDynamic_]; double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lower_[iSet]; else b = upper_[iSet]; if (b) { for (CoinBigIndex j = startColumn_[iSequence]; j < startColumn_[iSequence+1]; j++) { int iRow = row_[j]; rhs[iRow] -= element_[j] * b; } } } } } for (iRow = 0; iRow < numberRows; iRow++) { if (fabs(rhs[iRow] - rhsOffset_[iRow]) > 1.0e-3) printf("** bad effective %d - true %g old %g\n", iRow, rhs[iRow], rhsOffset_[iRow]); } CoinMemcpyN(rhs, numberRows, saveE); delete [] rhs; } #endif if (forceRefresh || (refreshFrequency_ && model->numberIterations() >= lastRefresh_ + refreshFrequency_)) { int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); int iRow; CoinZeroN(rhsOffset_, numberRows); // do ones at bounds before gub const double * smallSolution = model->solutionRegion(); const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); int iColumn; for (iColumn = 0; iColumn < firstDynamic_; iColumn++) { if (model->getStatus(iColumn) != ClpSimplex::basic) { double value = smallSolution[iColumn]; for (CoinBigIndex j = startColumn[iColumn]; j < startColumn[iColumn] + length[iColumn]; j++) { int jRow = row[j]; rhsOffset_[jRow] -= value * element[j]; } } } if (lowerColumn_ || upperColumn_) { double * solution = new double [numberGubColumns_]; for (iColumn = 0; iColumn < numberGubColumns_; iColumn++) { double value = 0.0; if(getDynamicStatus(iColumn) == atUpperBound) value = upperColumn_[iColumn]; else if (lowerColumn_) value = lowerColumn_[iColumn]; solution[iColumn] = value; } // ones in gub and in small problem for (iColumn = firstDynamic_; iColumn < firstAvailable_; iColumn++) { int jFull = id_[iColumn-firstDynamic_]; solution[jFull] = smallSolution[iColumn]; } // zero all basic in small model int * pivotVariable = model->pivotVariable(); for (iRow = 0; iRow < numberRows; iRow++) { int iColumn = pivotVariable[iRow]; if (iColumn >= firstDynamic_ && iColumn < lastDynamic_) { int iSequence = id_[iColumn-firstDynamic_]; solution[iSequence] = 0.0; } } // and now compute value to use for key ClpSimplex::Status iStatus; int iSet; for ( iSet = 0; iSet < numberSets_; iSet++) { iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) { int iSequence = id_[iColumn-firstDynamic_]; solution[iSequence] = 0.0; double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lowerSet_[iSet]; else b = upperSet_[iSet]; // subtract out others at bounds for (int j = fullStart_[iSet]; j < fullStart_[iSet+1]; j++) b -= solution[j]; solution[iSequence] = b; } } for (iColumn = 0; iColumn < numberGubColumns_; iColumn++) { double value = solution[iColumn]; if (value) { for (CoinBigIndex j = startColumn_[iColumn]; j < startColumn_[iColumn+1]; j++) { int iRow = row_[j]; rhsOffset_[iRow] -= element_[j] * value; } } } // now do lower and upper bounds on sets // and offset double objectiveOffset = 0.0; for ( iSet = 0; iSet < numberSets_; iSet++) { iColumn = keyVariable_[iSet]; double shift = 0.0; for (CoinBigIndex j = fullStart_[iSet]; j < fullStart_[iSet+1]; j++) { if (getDynamicStatus(j) != inSmall) { double value = 0.0; if (getDynamicStatus(j) == atLowerBound) { if (lowerColumn_) value = lowerColumn_[j]; } else { value = upperColumn_[j]; } if (j != iColumn) shift += value; objectiveOffset += value * cost_[j]; } } if (lowerSet_[iSet] > -1.0e20) lower_[iSet] = lowerSet_[iSet] - shift; if (upperSet_[iSet] < 1.0e20) upper_[iSet] = upperSet_[iSet] - shift; } delete [] solution; model->setObjectiveOffset(objectiveOffset_ - objectiveOffset); } else { // no bounds ClpSimplex::Status iStatus; for (int iSet = 0; iSet < numberSets_; iSet++) { int iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) { int iSequence = id_[iColumn-firstDynamic_]; double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lower_[iSet]; else b = upper_[iSet]; if (b) { for (CoinBigIndex j = startColumn_[iSequence]; j < startColumn_[iSequence+1]; j++) { int iRow = row_[j]; rhsOffset_[iRow] -= element_[j] * b; } } } } } #ifdef CLP_DEBUG if (saveE) { for (iRow = 0; iRow < numberRows; iRow++) { if (fabs(saveE[iRow] - rhsOffset_[iRow]) > 1.0e-3) printf("** %d - old eff %g new %g\n", iRow, saveE[iRow], rhsOffset_[iRow]); } delete [] saveE; } #endif lastRefresh_ = model->numberIterations(); } } return rhsOffset_; } /* update information for a pivot (and effective rhs) */ int ClpGubDynamicMatrix::updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue) { // now update working model int sequenceIn = model->sequenceIn(); int sequenceOut = model->sequenceOut(); bool doPrinting = (model->messageHandler()->logLevel() == 63); bool print = false; int iSet; int trueIn = -1; int trueOut = -1; int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); if (sequenceIn == firstAvailable_) { if (doPrinting) printf("New variable "); if (sequenceIn != sequenceOut) { insertNonBasic(firstAvailable_, backward_[firstAvailable_]); setDynamicStatus(id_[sequenceIn-firstDynamic_], inSmall); firstAvailable_++; } else { int bigSequence = id_[sequenceIn-firstDynamic_]; if (model->getStatus(sequenceIn) == ClpSimplex::atUpperBound) setDynamicStatus(bigSequence, atUpperBound); else setDynamicStatus(bigSequence, atLowerBound); } synchronize(model, 8); } if (sequenceIn < lastDynamic_) { iSet = backward_[sequenceIn]; if (iSet >= 0) { int bigSequence = id_[sequenceIn-firstDynamic_]; trueIn = bigSequence + numberRows + numberColumns + numberSets_; if (doPrinting) printf(" incoming set %d big seq %d", iSet, bigSequence); print = true; } } else if (sequenceIn >= numberRows + numberColumns) { trueIn = numberRows + numberColumns + gubSlackIn_; } if (sequenceOut < lastDynamic_) { iSet = backward_[sequenceOut]; if (iSet >= 0) { int bigSequence = id_[sequenceOut-firstDynamic_]; trueOut = bigSequence + firstDynamic_; if (getDynamicStatus(bigSequence) != inSmall) { if (model->getStatus(sequenceOut) == ClpSimplex::atUpperBound) setDynamicStatus(bigSequence, atUpperBound); else setDynamicStatus(bigSequence, atLowerBound); } if (doPrinting) printf(" ,outgoing set %d big seq %d,", iSet, bigSequence); print = true; model->setSequenceIn(sequenceOut); synchronize(model, 8); model->setSequenceIn(sequenceIn); } } if (print && doPrinting) printf("\n"); ClpGubMatrix::updatePivot(model, oldInValue, oldOutValue); // Redo true in and out if (trueIn >= 0) trueSequenceIn_ = trueIn; if (trueOut >= 0) trueSequenceOut_ = trueOut; if (doPrinting && 0) { for (int i = 0; i < numberSets_; i++) { printf("set %d key %d lower %g upper %g\n", i, keyVariable_[i], lower_[i], upper_[i]); for (int j = fullStart_[i]; j < fullStart_[i+1]; j++) if (getDynamicStatus(j) == atUpperBound) { bool print = true; for (int k = firstDynamic_; k < firstAvailable_; k++) { if (id_[k-firstDynamic_] == j) print = false; if (id_[k-firstDynamic_] == j) assert(getDynamicStatus(j) == inSmall); } if (print) printf("variable %d at ub\n", j); } } } #ifdef CLP_DEBUG char * inSmall = new char [numberGubColumns_]; memset(inSmall, 0, numberGubColumns_); for (int i = 0; i < numberGubColumns_; i++) if (getDynamicStatus(i) == ClpGubDynamicMatrix::inSmall) inSmall[i] = 1; for (int i = firstDynamic_; i < firstAvailable_; i++) { int k = id_[i-firstDynamic_]; inSmall[k] = 0; } for (int i = 0; i < numberGubColumns_; i++) assert (!inSmall[i]); delete [] inSmall; #endif return 0; } void ClpGubDynamicMatrix::times(double scalar, const double * x, double * y) const { if (model_->specialOptions() != 16) { ClpPackedMatrix::times(scalar, x, y); } else { int iRow; int numberColumns = model_->numberColumns(); int numberRows = model_->numberRows(); const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); int * pivotVariable = model_->pivotVariable(); int numberToDo = 0; for (iRow = 0; iRow < numberRows; iRow++) { y[iRow] -= scalar * rhsOffset_[iRow]; int iColumn = pivotVariable[iRow]; if (iColumn < numberColumns) { int iSet = backward_[iColumn]; if (iSet >= 0 && toIndex_[iSet] < 0) { toIndex_[iSet] = 0; fromIndex_[numberToDo++] = iSet; } CoinBigIndex j; double value = scalar * x[iColumn]; if (value) { for (j = startColumn[iColumn]; j < startColumn[iColumn] + length[iColumn]; j++) { int jRow = row[j]; y[jRow] += value * element[j]; } } } } // and gubs which are interacting for (int jSet = 0; jSet < numberToDo; jSet++) { int iSet = fromIndex_[jSet]; toIndex_[iSet] = -1; int iKey = keyVariable_[iSet]; if (iKey < numberColumns) { double valueKey; if (getStatus(iSet) == ClpSimplex::atLowerBound) valueKey = lower_[iSet]; else valueKey = upper_[iSet]; double value = scalar * (x[iKey] - valueKey); if (value) { for (CoinBigIndex j = startColumn[iKey]; j < startColumn[iKey] + length[iKey]; j++) { int jRow = row[j]; y[jRow] += value * element[j]; } } } } } } /* Just for debug - may be extended to other matrix types later. Returns number and sum of primal infeasibilities. */ int ClpGubDynamicMatrix::checkFeasible(ClpSimplex * /*model*/, double & sum) const { int numberRows = model_->numberRows(); double * rhs = new double[numberRows]; int numberColumns = model_->numberColumns(); int iRow; CoinZeroN(rhs, numberRows); // do ones at bounds before gub const double * smallSolution = model_->solutionRegion(); const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); int iColumn; int numberInfeasible = 0; const double * rowLower = model_->rowLower(); const double * rowUpper = model_->rowUpper(); sum = 0.0; for (iRow = 0; iRow < numberRows; iRow++) { double value = smallSolution[numberColumns+iRow]; if (value < rowLower[iRow] - 1.0e-5 || value > rowUpper[iRow] + 1.0e-5) { //printf("row %d %g %g %g\n", // iRow,rowLower[iRow],value,rowUpper[iRow]); numberInfeasible++; sum += CoinMax(rowLower[iRow] - value, value - rowUpper[iRow]); } rhs[iRow] = value; } const double * columnLower = model_->columnLower(); const double * columnUpper = model_->columnUpper(); for (iColumn = 0; iColumn < firstDynamic_; iColumn++) { double value = smallSolution[iColumn]; if (value < columnLower[iColumn] - 1.0e-5 || value > columnUpper[iColumn] + 1.0e-5) { //printf("column %d %g %g %g\n", // iColumn,columnLower[iColumn],value,columnUpper[iColumn]); numberInfeasible++; sum += CoinMax(columnLower[iColumn] - value, value - columnUpper[iColumn]); } for (CoinBigIndex j = startColumn[iColumn]; j < startColumn[iColumn] + length[iColumn]; j++) { int jRow = row[j]; rhs[jRow] -= value * element[j]; } } double * solution = new double [numberGubColumns_]; for (iColumn = 0; iColumn < numberGubColumns_; iColumn++) { double value = 0.0; if(getDynamicStatus(iColumn) == atUpperBound) value = upperColumn_[iColumn]; else if (lowerColumn_) value = lowerColumn_[iColumn]; solution[iColumn] = value; } // ones in small and gub for (iColumn = firstDynamic_; iColumn < firstAvailable_; iColumn++) { int jFull = id_[iColumn-firstDynamic_]; solution[jFull] = smallSolution[iColumn]; } // fill in all basic in small model int * pivotVariable = model_->pivotVariable(); for (iRow = 0; iRow < numberRows; iRow++) { int iColumn = pivotVariable[iRow]; if (iColumn >= firstDynamic_ && iColumn < lastDynamic_) { int iSequence = id_[iColumn-firstDynamic_]; solution[iSequence] = smallSolution[iColumn]; } } // and now compute value to use for key ClpSimplex::Status iStatus; for (int iSet = 0; iSet < numberSets_; iSet++) { iColumn = keyVariable_[iSet]; if (iColumn < numberColumns) { int iSequence = id_[iColumn-firstDynamic_]; solution[iSequence] = 0.0; double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lower_[iSet]; else b = upper_[iSet]; // subtract out others at bounds for (int j = fullStart_[iSet]; j < fullStart_[iSet+1]; j++) b -= solution[j]; solution[iSequence] = b; } } for (iColumn = 0; iColumn < numberGubColumns_; iColumn++) { double value = solution[iColumn]; if ((lowerColumn_ && value < lowerColumn_[iColumn] - 1.0e-5) || (!lowerColumn_ && value < -1.0e-5) || (upperColumn_ && value > upperColumn_[iColumn] + 1.0e-5)) { //printf("column %d %g %g %g\n", // iColumn,lowerColumn_[iColumn],value,upperColumn_[iColumn]); numberInfeasible++; } if (value) { for (CoinBigIndex j = startColumn_[iColumn]; j < startColumn_[iColumn+1]; j++) { int iRow = row_[j]; rhs[iRow] -= element_[j] * value; } } } for (iRow = 0; iRow < numberRows; iRow++) { if (fabs(rhs[iRow]) > 1.0e-5) printf("rhs mismatch %d %g\n", iRow, rhs[iRow]); } delete [] solution; delete [] rhs; return numberInfeasible; } // Cleans data after setWarmStart void ClpGubDynamicMatrix::cleanData(ClpSimplex * model) { // and redo chains int numberColumns = model->numberColumns(); int iColumn; // do backward int * mark = new int [numberGubColumns_]; for (iColumn = 0; iColumn < numberGubColumns_; iColumn++) mark[iColumn] = -1; int i; for (i = 0; i < firstDynamic_; i++) { assert (backward_[i] == -1); next_[i] = -1; } for (i = firstDynamic_; i < firstAvailable_; i++) { iColumn = id_[i-firstDynamic_]; mark[iColumn] = i; } for (i = 0; i < numberSets_; i++) { int iKey = keyVariable_[i]; int lastNext = -1; int firstNext = -1; for (CoinBigIndex k = fullStart_[i]; k < fullStart_[i+1]; k++) { iColumn = mark[k]; if (iColumn >= 0) { if (iColumn != iKey) { if (lastNext >= 0) next_[lastNext] = iColumn; else firstNext = iColumn; lastNext = iColumn; } backward_[iColumn] = i; } } setFeasible(i); if (firstNext >= 0) { // others next_[iKey] = firstNext; next_[lastNext] = -(iKey + 1); } else if (iKey < numberColumns) { next_[iKey] = -(iKey + 1); } } delete [] mark; // fill matrix double * element = matrix_->getMutableElements(); int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int * length = matrix_->getMutableVectorLengths(); CoinBigIndex numberElements = startColumn[firstDynamic_]; for (i = firstDynamic_; i < firstAvailable_; i++) { int iColumn = id_[i-firstDynamic_]; int numberThis = startColumn_[iColumn+1] - startColumn_[iColumn]; length[i] = numberThis; for (CoinBigIndex jBigIndex = startColumn_[iColumn]; jBigIndex < startColumn_[iColumn+1]; jBigIndex++) { row[numberElements] = row_[jBigIndex]; element[numberElements++] = element_[jBigIndex]; } startColumn[i+1] = numberElements; } } CoinMP-1.8.3/Clp/src/Clp_ampl.h0000644000175000017500000000323712134517542014532 0ustar renerene/* $Id: Clp_ampl.h 1573 2011-01-05 01:12:36Z lou $ */ /* Copyright (C) 2006, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #ifndef AmplInterface_H #define AmplInterface_H typedef struct { int numberRows; int numberColumns; int numberBinary; int numberIntegers; /* non binary */ int numberSos; int numberElements; int numberArguments; int problemStatus; double direction; double offset; double objValue; double * objective; double * rowLower; double * rowUpper; double * columnLower; double * columnUpper; int * starts; int * rows; double * elements; double * primalSolution; double * dualSolution; int * columnStatus; int * rowStatus; int * priorities; int * branchDirection; double * pseudoDown; double * pseudoUp; char * sosType; int * sosPriority; int * sosStart; int * sosIndices; double * sosReference; int * cut; int * special; char ** arguments; char buffer[300]; int logLevel; int nonLinear; } ampl_info; #ifdef __cplusplus extern "C" { #endif /* return nonzero if bad */ int readAmpl(ampl_info * info, int argc, char ** argv, void ** coinModel); /* frees some input arrays */ void freeArrays1(ampl_info * info); /* frees rest */ void freeArrays2(ampl_info * info); /* frees fake arguments */ void freeArgs(ampl_info * info); /* writes ampl stuff */ void writeAmpl(ampl_info * info); /* objective precision */ int ampl_obj_prec(); #ifdef __cplusplus } #endif #endif CoinMP-1.8.3/Clp/src/ClpSimplexDual.cpp0000644000175000017500000126132312562404644016232 0ustar renerene/* $Id: ClpSimplexDual.cpp 2158 2015-08-11 14:41:40Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Notes on implementation of dual simplex algorithm. When dual feasible: If primal feasible, we are optimal. Otherwise choose an infeasible basic variable to leave basis (normally going to nearest bound) (B). We now need to find an incoming variable which will leave problem dual feasible so we get the row of the tableau corresponding to the basic variable (with the correct sign depending if basic variable above or below feasibility region - as that affects whether reduced cost on outgoing variable has to be positive or negative). We now perform a ratio test to determine which incoming variable will preserve dual feasibility (C). If no variable found then problem is infeasible (in primal sense). If there is a variable, we then perform pivot and repeat. Trivial? ------------------------------------------- A) How do we get dual feasible? If all variables have bounds then it is trivial to get feasible by putting non-basic variables to correct bounds. OSL did not have a phase 1/phase 2 approach but instead effectively put fake bounds on variables and this is the approach here, although I had hoped to make it cleaner. If there is a weight of X on getting dual feasible: Non-basic variables with negative reduced costs are put to lesser of their upper bound and their lower bound + X. Similarly, mutatis mutandis, for positive reduced costs. Free variables should normally be in basis, otherwise I have coding which may be able to come out (and may not be correct). In OSL, this weight was changed heuristically, here at present it is only increased if problem looks finished. If problem is feasible I check for unboundedness. If not unbounded we could play with going into primal. As long as weights increase any algorithm would be finite. B) Which outgoing variable to choose is a virtual base class. For difficult problems steepest edge is preferred while for very easy (large) problems we will need partial scan. C) Sounds easy, but this is hardest part of algorithm. 1) Instead of stopping at first choice, we may be able to flip that variable to other bound and if objective still improving choose again. These mini iterations can increase speed by orders of magnitude but we may need to go to more of a bucket choice of variable rather than looking at them one by one (for speed). 2) Accuracy. Reduced costs may be of wrong sign but less than tolerance. Pivoting on these makes objective go backwards. OSL modified cost so a zero move was made, Gill et al (in primal analogue) modified so a strictly positive move was made. It is not quite as neat in dual but that is what we try and do. The two problems are that re-factorizations can change reduced costs above and below tolerances and that when finished we need to reset costs and try again. 3) Degeneracy. Gill et al helps but may not be enough. We may need more. Also it can improve speed a lot if we perturb the costs significantly. References: Forrest and Goldfarb, Steepest-edge simplex algorithms for linear programming - Mathematical Programming 1992 Forrest and Tomlin, Implementing the simplex method for the Optimization Subroutine Library - IBM Systems Journal 1992 Gill, Murray, Saunders, Wright A Practical Anti-Cycling Procedure for Linear and Nonlinear Programming SOL report 1988 TODO: a) Better recovery procedures. At present I never check on forward progress. There is checkpoint/restart with reducing re-factorization frequency, but this is only on singular factorizations. b) Fast methods for large easy problems (and also the option for the code to automatically choose which method). c) We need to be able to stop in various ways for OSI - this is fairly easy. */ #ifdef COIN_DEVELOP #undef COIN_DEVELOP #define COIN_DEVELOP 2 #endif #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" #include "ClpSimplexDual.hpp" #include "ClpEventHandler.hpp" #include "ClpFactorization.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "CoinFloatEqual.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpMessage.hpp" #include "ClpLinearObjective.hpp" #include #include #include #include #include //#define CLP_DEBUG 1 // To force to follow another run put logfile name here and define //#define FORCE_FOLLOW #ifdef FORCE_FOLLOW static FILE * fpFollow = NULL; static char * forceFile = "old.log"; static int force_in = -1; static int force_out = -1; static int force_iteration = 0; #endif //#define VUB #ifdef VUB extern int * vub; extern int * toVub; extern int * nextDescendent; #endif #ifdef NDEBUG #define NDEBUG_CLP #endif #ifndef CLP_INVESTIGATE #define NDEBUG_CLP #endif // dual /* *** Method This is a vanilla version of dual simplex. It tries to be a single phase approach with a weight of 1.0 being given to getting optimal and a weight of dualBound_ being given to getting dual feasible. In this version I have used the idea that this weight can be thought of as a fake bound. If the distance between the lower and upper bounds on a variable is less than the feasibility weight then we are always better off flipping to other bound to make dual feasible. If the distance is greater then we make up a fake bound dualBound_ away from one bound. If we end up optimal or primal infeasible, we check to see if bounds okay. If so we have finished, if not we increase dualBound_ and continue (after checking if unbounded). I am undecided about free variables - there is coding but I am not sure about it. At present I put them in basis anyway. The code is designed to take advantage of sparsity so arrays are seldom zeroed out from scratch or gone over in their entirety. The only exception is a full scan to find outgoing variable. This will be changed to keep an updated list of infeasibilities (or squares if steepest edge). Also on easy problems we don't need full scan - just pick first reasonable. One problem is how to tackle degeneracy and accuracy. At present I am using the modification of costs which I put in OSL and which was extended by Gill et al. I am still not sure of the exact details. The flow of dual is three while loops as follows: while (not finished) { while (not clean solution) { Factorize and/or clean up solution by flipping variables so dual feasible. If looks finished check fake dual bounds. Repeat until status is iterating (-1) or finished (0,1,2) } while (status==-1) { Iterate until no pivot in or out or time to re-factorize. Flow is: choose pivot row (outgoing variable). if none then we are primal feasible so looks as if done but we need to break and check bounds etc. Get pivot row in tableau Choose incoming column. If we don't find one then we look primal infeasible so break and check bounds etc. (Also the pivot tolerance is larger after any iterations so that may be reason) If we do find incoming column, we may have to adjust costs to keep going forwards (anti-degeneracy). Check pivot will be stable and if unstable throw away iteration (we will need to implement flagging of basic variables sometime) and break to re-factorize. If minor error re-factorize after iteration. Update everything (this may involve flipping variables to stay dual feasible. } } At present we never check we are going forwards. I overdid that in OSL so will try and make a last resort. Needs partial scan pivot out option. Needs dantzig, uninitialized and full steepest edge options (can still use partial scan) May need other anti-degeneracy measures, especially if we try and use loose tolerances as a way to solve in fewer iterations. I like idea of dynamic scaling. This gives opportunity to decouple different implications of scaling for accuracy, iteration count and feasibility tolerance. */ #define CLEAN_FIXED 0 // Startup part of dual (may be extended to other algorithms) int ClpSimplexDual::startupSolve(int ifValuesPass, double * saveDuals, int startFinishOptions) { // If values pass then save given duals round check solution // sanity check // initialize - no values pass and algorithm_ is -1 // put in standard form (and make row copy) // create modifiable copies of model rim and do optional scaling // If problem looks okay // Do initial factorization // If user asked for perturbation - do it numberFake_ = 0; // Number of variables at fake bounds numberChanged_ = 0; // Number of variables with changed costs if (!startup(0, startFinishOptions)) { int usePrimal = 0; // looks okay // Superbasic variables not allowed // If values pass then scale pi if (ifValuesPass) { if (problemStatus_ && perturbation_ < 100) usePrimal = perturb(); int i; if (scalingFlag_ > 0) { for (i = 0; i < numberRows_; i++) { dual_[i] = saveDuals[i] * inverseRowScale_[i]; } } else { CoinMemcpyN(saveDuals, numberRows_, dual_); } // now create my duals for (i = 0; i < numberRows_; i++) { // slack double value = dual_[i]; value += rowObjectiveWork_[i]; saveDuals[i+numberColumns_] = value; } CoinMemcpyN(objectiveWork_, numberColumns_, saveDuals); transposeTimes(-1.0, dual_, saveDuals); // make reduced costs okay for (i = 0; i < numberColumns_; i++) { if (getStatus(i) == atLowerBound) { if (saveDuals[i] < 0.0) { //if (saveDuals[i]<-1.0e-3) //printf("bad dj at lb %d %g\n",i,saveDuals[i]); saveDuals[i] = 0.0; } } else if (getStatus(i) == atUpperBound) { if (saveDuals[i] > 0.0) { //if (saveDuals[i]>1.0e-3) //printf("bad dj at ub %d %g\n",i,saveDuals[i]); saveDuals[i] = 0.0; } } } CoinMemcpyN(saveDuals, (numberColumns_ + numberRows_), dj_); // set up possible ones for (i = 0; i < numberRows_ + numberColumns_; i++) clearPivoted(i); int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (fabs(saveDuals[iPivot]) > dualTolerance_) { if (getStatus(iPivot) != isFree) setPivoted(iPivot); } } } else if ((specialOptions_ & 1024) != 0 && CLEAN_FIXED) { // set up possible ones for (int i = 0; i < numberRows_ + numberColumns_; i++) clearPivoted(i); int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (iPivot < numberColumns_ && lower_[iPivot] == upper_[iPivot]) { setPivoted(iPivot); } } } double objectiveChange; assert (!numberFake_); assert (numberChanged_ == 0); if (!numberFake_) // if nonzero then adjust changeBounds(1, NULL, objectiveChange); if (!ifValuesPass) { // Check optimal if (!numberDualInfeasibilities_ && !numberPrimalInfeasibilities_) problemStatus_ = 0; } if (problemStatus_ < 0 && perturbation_ < 100) { bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; if (!inCbcOrOther) usePrimal = perturb(); // Can't get here if values pass gutsOfSolution(NULL, NULL); #ifdef CLP_INVESTIGATE if (numberDualInfeasibilities_) printf("ZZZ %d primal %d dual - sumdinf %g\n", numberPrimalInfeasibilities_, numberDualInfeasibilities_, sumDualInfeasibilities_); #endif if (handler_->logLevel() > 2) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } if (inCbcOrOther) { if (numberPrimalInfeasibilities_) { usePrimal = perturb(); if (perturbation_ >= 101) { computeDuals(NULL); //gutsOfSolution(NULL,NULL); checkDualSolution(); // recompute objective } } else if (numberDualInfeasibilities_) { problemStatus_ = 10; if ((moreSpecialOptions_ & 32) != 0 && false) problemStatus_ = 0; // say optimal!! #if COIN_DEVELOP>2 printf("returning at %d\n", __LINE__); #endif return 1; // to primal } } } else if (!ifValuesPass) { gutsOfSolution(NULL, NULL); // double check if (numberDualInfeasibilities_ || numberPrimalInfeasibilities_) problemStatus_ = -1; } if (usePrimal) { problemStatus_ = 10; #if COIN_DEVELOP>2 printf("returning to use primal (no obj) at %d\n", __LINE__); #endif } return usePrimal; } else { return 1; } } void ClpSimplexDual::finishSolve(int startFinishOptions) { assert (problemStatus_ || !sumPrimalInfeasibilities_); // clean up finish(startFinishOptions); } //#define CLP_REPORT_PROGRESS #ifdef CLP_REPORT_PROGRESS static int ixxxxxx = 0; static int ixxyyyy = 90; #endif #ifdef CLP_INVESTIGATE_SERIAL static int z_reason[7] = {0, 0, 0, 0, 0, 0, 0}; static int z_thinks = -1; #endif void ClpSimplexDual::gutsOfDual(int ifValuesPass, double * & saveDuals, int initialStatus, ClpDataSave & data) { #ifdef CLP_INVESTIGATE_SERIAL z_reason[0]++; z_thinks = -1; int nPivots = 9999; #endif double largestPrimalError = 0.0; double largestDualError = 0.0; int numberRayTries=0; // Start can skip some things in transposeTimes specialOptions_ |= 131072; int lastCleaned = 0; // last time objective or bounds cleaned up // This says whether to restore things etc // startup will have factorized so can skip int factorType = 0; // Start check for cycles progress_.startCheck(); // Say change made on first iteration changeMade_ = 1; // Say last objective infinite //lastObjectiveValue_=-COIN_DBL_MAX; progressFlag_ = 0; /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible */ while (problemStatus_ < 0) { int iRow, iColumn; // clear for (iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // give matrix (and model costs and bounds a chance to be // refreshed (normally null) matrix_->refresh(this); // If getting nowhere - why not give it a kick // does not seem to work too well - do some more work if (perturbation_ < 101 && numberIterations_ > 2 * (numberRows_ + numberColumns_) && (moreSpecialOptions_&1048576)==0 && initialStatus != 10) { perturb(); // Can't get here if values pass gutsOfSolution(NULL, NULL); if (handler_->logLevel() > 2) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } } // see if in Cbc etc bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; #if 0 bool gotoPrimal = false; if (inCbcOrOther && numberIterations_ > disasterArea_ + numberRows_ && numberDualInfeasibilitiesWithoutFree_ && largestDualError_ > 1.0e-1) { if (!disasterArea_) { printf("trying all slack\n"); // try all slack basis allSlackBasis(true); disasterArea_ = 2 * numberRows_; } else { printf("going to primal\n"); // go to primal gotoPrimal = true; allSlackBasis(true); } } #endif bool disaster = false; if (disasterArea_ && inCbcOrOther && disasterArea_->check()) { disasterArea_->saveInfo(); disaster = true; } // may factorize, checks if problem finished statusOfProblemInDual(lastCleaned, factorType, saveDuals, data, ifValuesPass); if ((specialOptions_&2097152)!=0&&problemStatus_==1&&!ray_&& !numberRayTries && numberIterations_) { numberRayTries=1; problemStatus_=-1; } largestPrimalError = CoinMax(largestPrimalError, largestPrimalError_); largestDualError = CoinMax(largestDualError, largestDualError_); if (disaster) problemStatus_ = 3; // If values pass then do easy ones on first time if (ifValuesPass && progress_.lastIterationNumber(0) < 0 && saveDuals) { doEasyOnesInValuesPass(saveDuals); } // Say good factorization factorType = 1; if (data.sparseThreshold_) { // use default at present factorization_->sparseThreshold(0); factorization_->goSparse(); } // exit if victory declared if (problemStatus_ >= 0) break; // test for maximum iterations if (hitMaximumIterations() || (ifValuesPass == 2 && !saveDuals)) { problemStatus_ = 3; break; } if (ifValuesPass && !saveDuals) { // end of values pass ifValuesPass = 0; int status = eventHandler_->event(ClpEventHandler::endOfValuesPass); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfValuesPass; break; } } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfFactorization); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } } // If looks odd try other way if ((moreSpecialOptions_&256)==0 && fabs(objectiveValue_)>1.0e20&&sumDualInfeasibilities_>1.0 &&problemStatus_<0) { problemStatus_=10; break; } // Do iterations int returnCode = whileIterating(saveDuals, ifValuesPass); if (problemStatus_ == 1 && (progressFlag_&8) != 0 && fabs(objectiveValue_) > 1.0e10 ) problemStatus_ = 10; // infeasible - but has looked feasible #ifdef CLP_INVESTIGATE_SERIAL nPivots = factorization_->pivots(); #endif if (!problemStatus_ && factorization_->pivots()) computeDuals(NULL); // need to compute duals if (returnCode == -2) factorType = 3; } #ifdef CLP_INVESTIGATE_SERIAL // NOTE - can fail if parallel if (z_thinks != -1) { assert (z_thinks < 4); if ((!factorization_->pivots() && nPivots < 20) && z_thinks >= 0 && z_thinks < 2) z_thinks += 4; z_reason[1+z_thinks]++; } if ((z_reason[0] % 1000) == 0) { printf("Reason"); for (int i = 0; i < 7; i++) printf(" %d", z_reason[i]); printf("\n"); } #endif // Stop can skip some things in transposeTimes specialOptions_ &= ~131072; largestPrimalError_ = largestPrimalError; largestDualError_ = largestDualError; } int ClpSimplexDual::dual(int ifValuesPass, int startFinishOptions) { //handler_->setLogLevel(63); //yprintf("STARTing dual %d rows\n",numberRows_); bestObjectiveValue_ = -COIN_DBL_MAX; algorithm_ = -1; moreSpecialOptions_ &= ~16; // clear check replaceColumn accuracy // save data ClpDataSave data = saveData(); double * saveDuals = NULL; int saveDont = dontFactorizePivots_; if ((specialOptions_ & 2048) == 0) dontFactorizePivots_ = 0; else if(!dontFactorizePivots_) dontFactorizePivots_ = 20; if (ifValuesPass) { saveDuals = new double [numberRows_+numberColumns_]; CoinMemcpyN(dual_, numberRows_, saveDuals); } if (alphaAccuracy_ != -1.0) alphaAccuracy_ = 1.0; minimumPrimalTolerance_=primalTolerance(); int returnCode = startupSolve(ifValuesPass, saveDuals, startFinishOptions); // Save so can see if doing after primal int initialStatus = problemStatus_; if (!returnCode && !numberDualInfeasibilities_ && !numberPrimalInfeasibilities_ && perturbation_ < 101) { returnCode = 1; // to skip gutsOfDual problemStatus_ = 0; } if (!returnCode) gutsOfDual(ifValuesPass, saveDuals, initialStatus, data); if (!problemStatus_) { // see if cutoff reached double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if(fabs(limit) < 1.0e30 && objectiveValue()*optimizationDirection_ > limit + 1.0e-7 + 1.0e-8 * fabs(limit)) { // actually infeasible on objective problemStatus_ = 1; secondaryStatus_ = 1; } } // If infeasible but primal errors - try dual if (problemStatus_==1 && numberPrimalInfeasibilities_) { bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; double factor = (!inCbcOrOther) ? 1.0 : 0.3; double averageInfeasibility = sumPrimalInfeasibilities_/ static_cast(numberPrimalInfeasibilities_); if (averageInfeasibility 0) { for (i = 0; i < numberRows_; i++) { dual_[i] = saveDuals[i] * inverseRowScale_[i]; } } else { CoinMemcpyN(saveDuals, numberRows_, dual_); } // now create my duals for (i = 0; i < numberRows_; i++) { // slack double value = dual_[i]; value += rowObjectiveWork_[i]; saveDuals[i+numberColumns_] = value; } CoinMemcpyN(objectiveWork_, numberColumns_, saveDuals); transposeTimes(-1.0, dual_, saveDuals); // make reduced costs okay for (i = 0; i < numberColumns_; i++) { if (getStatus(i) == atLowerBound) { if (saveDuals[i] < 0.0) { //if (saveDuals[i]<-1.0e-3) //printf("bad dj at lb %d %g\n",i,saveDuals[i]); saveDuals[i] = 0.0; } } else if (getStatus(i) == atUpperBound) { if (saveDuals[i] > 0.0) { //if (saveDuals[i]>1.0e-3) //printf("bad dj at ub %d %g\n",i,saveDuals[i]); saveDuals[i] = 0.0; } } } CoinMemcpyN(saveDuals, numberColumns_ + numberRows_, dj_); // set up possible ones for (i = 0; i < numberRows_ + numberColumns_; i++) clearPivoted(i); int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (fabs(saveDuals[iPivot]) > dualTolerance_) { if (getStatus(iPivot) != isFree) setPivoted(iPivot); } } } else if ((specialOptions_ & 1024) != 0 && CLEAN_FIXED) { // set up possible ones for (int i = 0; i < numberRows_ + numberColumns_; i++) clearPivoted(i); int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (iPivot < numberColumns_ && lower_[iPivot] == upper_[iPivot]) { setPivoted(iPivot); } } } double objectiveChange; numberFake_ = 0; // Number of variables at fake bounds numberChanged_ = 0; // Number of variables with changed costs changeBounds(1, NULL, objectiveChange); int lastCleaned = 0; // last time objective or bounds cleaned up if (!ifValuesPass) { // Check optimal if (!numberDualInfeasibilities_ && !numberPrimalInfeasibilities_) problemStatus_ = 0; } if (problemStatus_ < 0 && perturbation_ < 100) { perturb(); // Can't get here if values pass gutsOfSolution(NULL, NULL); if (handler_->logLevel() > 2) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } } // This says whether to restore things etc // startup will have factorized so can skip int factorType = 0; // Start check for cycles progress_.startCheck(); // Say change made on first iteration changeMade_ = 1; /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible */ while (problemStatus_ < 0) { int iRow, iColumn; // clear for (iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // give matrix (and model costs and bounds a chance to be // refreshed (normally null) matrix_->refresh(this); // If getting nowhere - why not give it a kick // does not seem to work too well - do some more work if (perturbation_ < 101 && numberIterations_ > 2 * (numberRows_ + numberColumns_) && (moreSpecialOptions_&1048576)==0 && initialStatus != 10) { perturb(); // Can't get here if values pass gutsOfSolution(NULL, NULL); if (handler_->logLevel() > 2) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } } // may factorize, checks if problem finished statusOfProblemInDual(lastCleaned, factorType, saveDuals, data, ifValuesPass); // If values pass then do easy ones on first time if (ifValuesPass && progress_.lastIterationNumber(0) < 0 && saveDuals) { doEasyOnesInValuesPass(saveDuals); } // Say good factorization factorType = 1; if (data.sparseThreshold_) { // use default at present factorization_->sparseThreshold(0); factorization_->goSparse(); } // exit if victory declared if (problemStatus_ >= 0) break; // test for maximum iterations if (hitMaximumIterations() || (ifValuesPass == 2 && !saveDuals)) { problemStatus_ = 3; break; } if (ifValuesPass && !saveDuals) { // end of values pass ifValuesPass = 0; int status = eventHandler_->event(ClpEventHandler::endOfValuesPass); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfValuesPass; break; } } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfFactorization); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } } // Do iterations whileIterating(saveDuals, ifValuesPass); } } assert (problemStatus_ || !sumPrimalInfeasibilities_); // clean up finish(startFinishOptions); delete [] saveDuals; // Restore any saved stuff restoreData(data); return problemStatus_; } #endif //#define CHECK_ACCURACY #ifdef CHECK_ACCURACY static double zzzzzz[100000]; #endif /* Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations */ int ClpSimplexDual::whileIterating(double * & givenDuals, int ifValuesPass) { #ifdef CLP_INVESTIGATE_SERIAL z_thinks = -1; #endif #ifdef CLP_DEBUG int debugIteration = -1; #endif { int i; for (i = 0; i < 4; i++) { rowArray_[i]->clear(); } for (i = 0; i < 2; i++) { columnArray_[i]->clear(); } } #ifdef CLP_REPORT_PROGRESS double * savePSol = new double [numberRows_+numberColumns_]; double * saveDj = new double [numberRows_+numberColumns_]; double * saveCost = new double [numberRows_+numberColumns_]; unsigned char * saveStat = new unsigned char [numberRows_+numberColumns_]; #endif // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) factorization_->relaxAccuracyCheck(CoinMin(1.0e2, largestPrimalError_ / 10.0)); else factorization_->relaxAccuracyCheck(1.0); // status stays at -1 while iterating, >=0 finished, -2 to invert // status -3 to go to top without an invert int returnCode = -1; double saveSumDual = sumDualInfeasibilities_; // so we know to be careful #if 0 // compute average infeasibility for backward test double averagePrimalInfeasibility = sumPrimalInfeasibilities_ / ((double ) (numberPrimalInfeasibilities_ + 1)); #endif // Get dubious weights CoinBigIndex * dubiousWeights = NULL; #ifdef DUBIOUS_WEIGHTS factorization_->getWeights(rowArray_[0]->getIndices()); dubiousWeights = matrix_->dubiousWeights(this, rowArray_[0]->getIndices()); #endif // If values pass then get list of candidates int * candidateList = NULL; int numberCandidates = 0; #ifdef CLP_DEBUG bool wasInValuesPass = (givenDuals != NULL); #endif int candidate = -1; if (givenDuals) { assert (ifValuesPass); ifValuesPass = 1; candidateList = new int[numberRows_]; // move reduced costs across CoinMemcpyN(givenDuals, numberRows_ + numberColumns_, dj_); int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (flagged(iPivot)) continue; if (fabs(dj_[iPivot]) > dualTolerance_) { // for now safer to ignore free ones if (lower_[iPivot] > -1.0e50 || upper_[iPivot] < 1.0e50) if (pivoted(iPivot)) candidateList[numberCandidates++] = iRow; } else { clearPivoted(iPivot); } } // and set first candidate if (!numberCandidates) { delete [] candidateList; delete [] givenDuals; givenDuals = NULL; candidateList = NULL; int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; clearPivoted(iPivot); } } } else { assert (!ifValuesPass); } #ifdef CHECK_ACCURACY { if (numberIterations_) { int il = -1; double largest = 1.0e-1; int ilnb = -1; double largestnb = 1.0e-8; for (int i = 0; i < numberRows_ + numberColumns_; i++) { double diff = fabs(solution_[i] - zzzzzz[i]); if (diff > largest) { largest = diff; il = i; } if (getColumnStatus(i) != basic) { if (diff > largestnb) { largestnb = diff; ilnb = i; } } } if (il >= 0 && ilnb < 0) printf("largest diff of %g at %d, nonbasic %g at %d\n", largest, il, largestnb, ilnb); } } #endif while (problemStatus_ == -1) { //if (numberIterations_>=101624) //resetFakeBounds(-1); #ifdef CLP_DEBUG if (givenDuals) { double value5 = 0.0; int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (dj_[i] < -1.0e-6) if (upper_[i] < 1.0e20) value5 += dj_[i] * upper_[i]; else printf("bad dj %g on %d with large upper status %d\n", dj_[i], i, status_[i] & 7); else if (dj_[i] > 1.0e-6) if (lower_[i] > -1.0e20) value5 += dj_[i] * lower_[i]; else printf("bad dj %g on %d with large lower status %d\n", dj_[i], i, status_[i] & 7); } printf("Values objective Value %g\n", value5); } if ((handler_->logLevel() & 32) && wasInValuesPass) { double value5 = 0.0; int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (dj_[i] < -1.0e-6) if (upper_[i] < 1.0e20) value5 += dj_[i] * upper_[i]; else if (dj_[i] > 1.0e-6) if (lower_[i] > -1.0e20) value5 += dj_[i] * lower_[i]; } printf("Values objective Value %g\n", value5); { int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { int iSequence = i; double oldValue; switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case isFree: case superBasic: abort(); break; case atUpperBound: oldValue = dj_[iSequence]; //assert (oldValue<=tolerance); assert (fabs(solution_[iSequence] - upper_[iSequence]) < 1.0e-7); break; case atLowerBound: oldValue = dj_[iSequence]; //assert (oldValue>=-tolerance); assert (fabs(solution_[iSequence] - lower_[iSequence]) < 1.0e-7); break; } } } } #endif #ifdef CLP_DEBUG { int i; for (i = 0; i < 4; i++) { rowArray_[i]->checkClear(); } for (i = 0; i < 2; i++) { columnArray_[i]->checkClear(); } } #endif #if CLP_DEBUG>2 // very expensive if (numberIterations_ > 3063 && numberIterations_ < 30700) { //handler_->setLogLevel(63); double saveValue = objectiveValue_; double * saveRow1 = new double[numberRows_]; double * saveRow2 = new double[numberRows_]; CoinMemcpyN(rowReducedCost_, numberRows_, saveRow1); CoinMemcpyN(rowActivityWork_, numberRows_, saveRow2); double * saveColumn1 = new double[numberColumns_]; double * saveColumn2 = new double[numberColumns_]; CoinMemcpyN(reducedCostWork_, numberColumns_, saveColumn1); CoinMemcpyN(columnActivityWork_, numberColumns_, saveColumn2); gutsOfSolution(NULL, NULL); printf("xxx %d old obj %g, recomputed %g, sum dual inf %g\n", numberIterations_, saveValue, objectiveValue_, sumDualInfeasibilities_); if (saveValue > objectiveValue_ + 1.0e-2) printf("**bad**\n"); CoinMemcpyN(saveRow1, numberRows_, rowReducedCost_); CoinMemcpyN(saveRow2, numberRows_, rowActivityWork_); CoinMemcpyN(saveColumn1, numberColumns_, reducedCostWork_); CoinMemcpyN(saveColumn2, numberColumns_, columnActivityWork_); delete [] saveRow1; delete [] saveRow2; delete [] saveColumn1; delete [] saveColumn2; objectiveValue_ = saveValue; } #endif #if 0 // if (factorization_->pivots()){ { int iPivot; double * array = rowArray_[3]->denseVector(); int i; for (iPivot = 0; iPivot < numberRows_; iPivot++) { int iSequence = pivotVariable_[iPivot]; unpack(rowArray_[3], iSequence); factorization_->updateColumn(rowArray_[2], rowArray_[3]); assert (fabs(array[iPivot] - 1.0) < 1.0e-4); array[iPivot] = 0.0; for (i = 0; i < numberRows_; i++) assert (fabs(array[i]) < 1.0e-4); rowArray_[3]->clear(); } } #endif #ifdef CLP_DEBUG { int iSequence, number = numberRows_ + numberColumns_; for (iSequence = 0; iSequence < number; iSequence++) { double lowerValue = lower_[iSequence]; double upperValue = upper_[iSequence]; double value = solution_[iSequence]; if(getStatus(iSequence) != basic && getStatus(iSequence) != isFree) { assert(lowerValue > -1.0e20); assert(upperValue < 1.0e20); } switch(getStatus(iSequence)) { case basic: break; case isFree: case superBasic: break; case atUpperBound: assert (fabs(value - upperValue) <= primalTolerance_) ; break; case atLowerBound: case ClpSimplex::isFixed: assert (fabs(value - lowerValue) <= primalTolerance_) ; break; } } } if(numberIterations_ == debugIteration) { printf("dodgy iteration coming up\n"); } #endif #if 0 printf("checking nz\n"); for (int i = 0; i < 3; i++) { if (!rowArray_[i]->getNumElements()) rowArray_[i]->checkClear(); } #endif // choose row to go out // dualRow will go to virtual row pivot choice algorithm // make sure values pass off if it should be if (numberCandidates) candidate = candidateList[--numberCandidates]; else candidate = -1; dualRow(candidate); if (pivotRow_ >= 0) { // we found a pivot row if (handler_->detail(CLP_SIMPLEX_PIVOTROW, messages_) < 100) { handler_->message(CLP_SIMPLEX_PIVOTROW, messages_) << pivotRow_ << CoinMessageEol; } // check accuracy of weights dualRowPivot_->checkAccuracy(); // Get good size for pivot // Allow first few iterations to take tiny double acceptablePivot = 1.0e-1 * acceptablePivot_; if (numberIterations_ > 100) acceptablePivot = acceptablePivot_; if (factorization_->pivots() > 10 || (factorization_->pivots() && saveSumDual)) acceptablePivot = 1.0e+3 * acceptablePivot_; // if we have iterated be more strict else if (factorization_->pivots() > 5) acceptablePivot = 1.0e+2 * acceptablePivot_; // if we have iterated be slightly more strict else if (factorization_->pivots()) acceptablePivot = acceptablePivot_; // relax // But factorizations complain if <1.0e-8 //acceptablePivot=CoinMax(acceptablePivot,1.0e-8); double bestPossiblePivot = 1.0; // get sign for finding row of tableau if (candidate < 0) { // normal iteration // create as packed double direction = directionOut_; rowArray_[0]->createPacked(1, &pivotRow_, &direction); factorization_->updateColumnTranspose(rowArray_[1], rowArray_[0]); // Allow to do dualColumn0 if (numberThreads_ < -1) spareIntArray_[0] = 1; spareDoubleArray_[0] = acceptablePivot; rowArray_[3]->clear(); sequenceIn_ = -1; // put row of tableau in rowArray[0] and columnArray[0] assert (!rowArray_[1]->getNumElements()); if (!scaledMatrix_) { if ((moreSpecialOptions_ & 8) != 0 && !rowScale_) spareIntArray_[0] = 1; matrix_->transposeTimes(this, -1.0, rowArray_[0], rowArray_[1], columnArray_[0]); } else { double * saveR = rowScale_; double * saveC = columnScale_; rowScale_ = NULL; columnScale_ = NULL; if ((moreSpecialOptions_ & 8) != 0) spareIntArray_[0] = 1; scaledMatrix_->transposeTimes(this, -1.0, rowArray_[0], rowArray_[1], columnArray_[0]); rowScale_ = saveR; columnScale_ = saveC; } #ifdef CLP_REPORT_PROGRESS memcpy(savePSol, solution_, (numberColumns_ + numberRows_)*sizeof(double)); memcpy(saveDj, dj_, (numberColumns_ + numberRows_)*sizeof(double)); memcpy(saveCost, cost_, (numberColumns_ + numberRows_)*sizeof(double)); memcpy(saveStat, status_, (numberColumns_ + numberRows_)*sizeof(char)); #endif // do ratio test for normal iteration bestPossiblePivot = dualColumn(rowArray_[0], columnArray_[0], rowArray_[3], columnArray_[1], acceptablePivot, dubiousWeights); if (sequenceIn_<0&&acceptablePivot>acceptablePivot_) acceptablePivot_ = - fabs(acceptablePivot_); // stop early exit #if CAN_HAVE_ZERO_OBJ>1 if ((specialOptions_&2097152)!=0) theta_=0.0; #endif } else { // Make sure direction plausible CoinAssert (upperOut_ < 1.0e50 || lowerOut_ > -1.0e50); // If in integer cleanup do direction using duals // may be wrong way round if(ifValuesPass == 2) { if (dual_[pivotRow_] > 0.0) { // this will give a -1 in pivot row (as slacks are -1.0) directionOut_ = 1; } else { directionOut_ = -1; } } if (directionOut_ < 0 && fabs(valueOut_ - upperOut_) > dualBound_ + primalTolerance_) { if (fabs(valueOut_ - upperOut_) > fabs(valueOut_ - lowerOut_)) directionOut_ = 1; } else if (directionOut_ > 0 && fabs(valueOut_ - lowerOut_) > dualBound_ + primalTolerance_) { if (fabs(valueOut_ - upperOut_) < fabs(valueOut_ - lowerOut_)) directionOut_ = -1; } double direction = directionOut_; rowArray_[0]->createPacked(1, &pivotRow_, &direction); factorization_->updateColumnTranspose(rowArray_[1], rowArray_[0]); // put row of tableau in rowArray[0] and columnArray[0] if (!scaledMatrix_) { matrix_->transposeTimes(this, -1.0, rowArray_[0], rowArray_[3], columnArray_[0]); } else { double * saveR = rowScale_; double * saveC = columnScale_; rowScale_ = NULL; columnScale_ = NULL; scaledMatrix_->transposeTimes(this, -1.0, rowArray_[0], rowArray_[3], columnArray_[0]); rowScale_ = saveR; columnScale_ = saveC; } acceptablePivot *= 10.0; // do ratio test if (ifValuesPass == 1) { checkPossibleValuesMove(rowArray_[0], columnArray_[0], acceptablePivot); } else { checkPossibleCleanup(rowArray_[0], columnArray_[0], acceptablePivot); if (sequenceIn_ < 0) { rowArray_[0]->clear(); columnArray_[0]->clear(); continue; // can't do anything } } // recompute true dualOut_ if (directionOut_ < 0) { dualOut_ = valueOut_ - upperOut_; } else { dualOut_ = lowerOut_ - valueOut_; } // check what happened if was values pass // may want to move part way i.e. movement bool normalIteration = (sequenceIn_ != sequenceOut_); clearPivoted(sequenceOut_); // make sure won't be done again // see if end of values pass if (!numberCandidates) { int iRow; delete [] candidateList; delete [] givenDuals; candidate = -2; // -2 signals end givenDuals = NULL; candidateList = NULL; ifValuesPass = 1; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; //assert (fabs(dj_[iPivot]),1.0e-5); clearPivoted(iPivot); } } if (!normalIteration) { //rowArray_[0]->cleanAndPackSafe(1.0e-60); //columnArray_[0]->cleanAndPackSafe(1.0e-60); updateDualsInValuesPass(rowArray_[0], columnArray_[0], theta_); if (candidate == -2) problemStatus_ = -2; continue; // skip rest of iteration } else { // recompute dualOut_ if (directionOut_ < 0) { dualOut_ = valueOut_ - upperOut_; } else { dualOut_ = lowerOut_ - valueOut_; } } } if (sequenceIn_ >= 0) { // normal iteration // update the incoming column double btranAlpha = -alpha_ * directionOut_; // for check unpackPacked(rowArray_[1]); // moved into updateWeights - factorization_->updateColumnFT(rowArray_[2],rowArray_[1]); // and update dual weights (can do in parallel - with extra array) alpha_ = dualRowPivot_->updateWeights(rowArray_[0], rowArray_[2], rowArray_[3], rowArray_[1]); // see if update stable #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("btran alpha %g, ftran alpha %g\n", btranAlpha, alpha_); #endif double checkValue = 1.0e-7; // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) checkValue = CoinMin(1.0e-4, 1.0e-8 * largestPrimalError_); if (fabs(btranAlpha) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha - alpha_) > checkValue*(1.0 + fabs(alpha_))) { handler_->message(CLP_DUAL_CHECK, messages_) << btranAlpha << alpha_ << CoinMessageEol; if (factorization_->pivots()) { dualRowPivot_->unrollWeights(); problemStatus_ = -2; // factorize now rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); returnCode = -2; break; } else { // take on more relaxed criterion double test; if (fabs(btranAlpha) < 1.0e-8 || fabs(alpha_) < 1.0e-8) test = 1.0e-1 * fabs(alpha_); else test = 1.0e-4 * (1.0 + fabs(alpha_)); if (fabs(btranAlpha) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha - alpha_) > test) { dualRowPivot_->unrollWeights(); // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #ifdef COIN_DEVELOP printf("flag a %g %g\n", btranAlpha, alpha_); #endif //#define FEB_TRY #if 1 //def FEB_TRY // Make safer? factorization_->saferTolerances (-0.99, -1.03); #endif setFlagged(sequenceOut_); progress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); if (fabs(alpha_) < 1.0e-10 && fabs(btranAlpha) < 1.0e-8 && numberIterations_ > 100) { //printf("I think should declare infeasible\n"); problemStatus_ = 1; returnCode = 1; break; } continue; } } } // update duals BEFORE replaceColumn so can do updateColumn double objectiveChange = 0.0; // do duals first as variables may flip bounds // rowArray_[0] and columnArray_[0] may have flips // so use rowArray_[3] for work array from here on int nswapped = 0; //rowArray_[0]->cleanAndPackSafe(1.0e-60); //columnArray_[0]->cleanAndPackSafe(1.0e-60); if (candidate == -1) { #if CLP_CAN_HAVE_ZERO_OBJ>1 if ((specialOptions_&2097152)==0) { #endif // make sure incoming doesn't count Status saveStatus = getStatus(sequenceIn_); setStatus(sequenceIn_, basic); nswapped = updateDualsInDual(rowArray_[0], columnArray_[0], rowArray_[2], theta_, objectiveChange, false); setStatus(sequenceIn_, saveStatus); #if CLP_CAN_HAVE_ZERO_OBJ>1 } else { rowArray_[0]->clear(); rowArray_[2]->clear(); columnArray_[0]->clear(); } #endif } else { updateDualsInValuesPass(rowArray_[0], columnArray_[0], theta_); } double oldDualOut = dualOut_; // which will change basic solution if (nswapped) { if (rowArray_[2]->getNumElements()) { factorization_->updateColumn(rowArray_[3], rowArray_[2]); dualRowPivot_->updatePrimalSolution(rowArray_[2], 1.0, objectiveChange); } // recompute dualOut_ valueOut_ = solution_[sequenceOut_]; if (directionOut_ < 0) { dualOut_ = valueOut_ - upperOut_; } else { dualOut_ = lowerOut_ - valueOut_; } #if 0 if (dualOut_ < 0.0) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) { printf(" dualOut_ %g %g save %g\n", dualOut_, averagePrimalInfeasibility, saveDualOut); printf("values %g %g %g %g %g %g %g\n", lowerOut_, valueOut_, upperOut_, objectiveChange,); } #endif if (upperOut_ == lowerOut_) dualOut_ = 0.0; } if(dualOut_ < -CoinMax(1.0e-12 * averagePrimalInfeasibility, 1.0e-8) && factorization_->pivots() > 100 && getStatus(sequenceIn_) != isFree) { // going backwards - factorize dualRowPivot_->unrollWeights(); problemStatus_ = -2; // factorize now returnCode = -2; break; } #endif } // amount primal will move double movement = -dualOut_ * directionOut_ / alpha_; double movementOld = oldDualOut * directionOut_ / alpha_; // so objective should increase by fabs(dj)*movement // but we already have objective change - so check will be good if (objectiveChange + fabs(movementOld * dualIn_) < -CoinMax(1.0e-5, 1.0e-12 * fabs(objectiveValue_))) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("movement %g, swap change %g, rest %g * %g\n", objectiveChange + fabs(movement * dualIn_), objectiveChange, movement, dualIn_); #endif if(factorization_->pivots()) { // going backwards - factorize dualRowPivot_->unrollWeights(); problemStatus_ = -2; // factorize now returnCode = -2; break; } } // if stable replace in basis int updateStatus = factorization_->replaceColumn(this, rowArray_[2], rowArray_[1], pivotRow_, alpha_, (moreSpecialOptions_ & 16) != 0, acceptablePivot); // If looks like bad pivot - refactorize if (fabs(dualOut_) > 1.0e50) updateStatus = 2; // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && !factorization_->pivots() && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4) { // slight error if (factorization_->pivots() > 5 || updateStatus == 4) { problemStatus_ = -2; // factorize now returnCode = -3; } } else if (updateStatus == 2) { // major error dualRowPivot_->unrollWeights(); // later we may need to unwind more e.g. fake bounds if (factorization_->pivots() && ((moreSpecialOptions_ & 16) == 0 || factorization_->pivots() > 4)) { problemStatus_ = -2; // factorize now returnCode = -2; moreSpecialOptions_ |= 16; double pivotTolerance = factorization_->pivotTolerance(); if (pivotTolerance<0.4&&factorization_->pivots()<100) { factorization_->pivotTolerance(1.05*pivotTolerance); #ifdef CLP_USEFUL_PRINTOUT printf("Changing pivot tolerance from %g to %g as ftran/btran error %g/%g\n", pivotTolerance,factorization_->pivotTolerance(), alpha_,btranAlpha); #endif } break; } else { // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #ifdef COIN_DEVELOP printf("flag b %g\n", alpha_); #endif setFlagged(sequenceOut_); progress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); // make sure dual feasible // look at all rows and columns double objectiveChange = 0.0; updateDualsInDual(rowArray_[0], columnArray_[0], rowArray_[1], 0.0, objectiveChange, true); rowArray_[1]->clear(); columnArray_[0]->clear(); continue; } } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (factorization_->pivots() < 0.5 * factorization_->maximumPivots() && factorization_->pivots() < 200) factorization_->areaFactor( factorization_->areaFactor() * 1.1); problemStatus_ = -2; // factorize now } else if (updateStatus == 5) { problemStatus_ = -2; // factorize now } // update primal solution if (theta_ < 0.0 && candidate == -1) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("negative theta %g\n", theta_); #endif theta_ = 0.0; } // do actual flips flipBounds(rowArray_[0], columnArray_[0]); //rowArray_[1]->expand(); dualRowPivot_->updatePrimalSolution(rowArray_[1], movement, objectiveChange); #ifdef CLP_DEBUG double oldobj = objectiveValue_; #endif // modify dualout dualOut_ /= alpha_; dualOut_ *= -directionOut_; //setStatus(sequenceIn_,basic); dj_[sequenceIn_] = 0.0; double oldValue = valueIn_; if (directionIn_ == -1) { // as if from upper bound valueIn_ = upperIn_ + dualOut_; } else { // as if from lower bound valueIn_ = lowerIn_ + dualOut_; } objectiveChange += cost_[sequenceIn_] * (valueIn_ - oldValue); // outgoing // set dj to zero unless values pass if (directionOut_ > 0) { valueOut_ = lowerOut_; if (candidate == -1) dj_[sequenceOut_] = theta_; } else { valueOut_ = upperOut_; if (candidate == -1) dj_[sequenceOut_] = -theta_; } solution_[sequenceOut_] = valueOut_; int whatNext = housekeeping(objectiveChange); #if 0 for (int i=0;i-1.0e-5); assert (solution_[i]<=lower_[i]+1.0e-5); } else if (getStatus(i)==atUpperBound) { assert (dj_[i]<1.0e-5); assert (solution_[i]>=upper_[i]-1.0e-5); } } #endif #ifdef CLP_REPORT_PROGRESS if (ixxxxxx > ixxyyyy - 5) { handler_->setLogLevel(63); int nTotal = numberColumns_ + numberRows_; double oldObj = 0.0; double newObj = 0.0; for (int i = 0; i < nTotal; i++) { if (savePSol[i]) oldObj += savePSol[i] * saveCost[i]; if (solution_[i]) newObj += solution_[i] * cost_[i]; bool printIt = false; if (cost_[i] != saveCost[i]) printIt = true; if (status_[i] != saveStat[i]) printIt = true; if (printIt) printf("%d old %d cost %g sol %g, new %d cost %g sol %g\n", i, saveStat[i], saveCost[i], savePSol[i], status_[i], cost_[i], solution_[i]); // difference savePSol[i] = solution_[i] - savePSol[i]; } printf("pivots %d, old obj %g new %g\n", factorization_->pivots(), oldObj, newObj); memset(saveDj, 0, numberRows_ * sizeof(double)); times(1.0, savePSol, saveDj); double largest = 1.0e-6; int k = -1; for (int i = 0; i < numberRows_; i++) { saveDj[i] -= savePSol[i+numberColumns_]; if (fabs(saveDj[i]) > largest) { largest = fabs(saveDj[i]); k = i; } } if (k >= 0) printf("Not null %d %g\n", k, largest); } #endif #ifdef VUB { if ((sequenceIn_ < numberColumns_ && vub[sequenceIn_] >= 0) || toVub[sequenceIn_] >= 0 || (sequenceOut_ < numberColumns_ && vub[sequenceOut_] >= 0) || toVub[sequenceOut_] >= 0) { int inSequence = sequenceIn_; int inVub = -1; if (sequenceIn_ < numberColumns_) inVub = vub[sequenceIn_]; int inBack = toVub[inSequence]; int inSlack = -1; if (inSequence >= numberColumns_ && inBack >= 0) { inSlack = inSequence - numberColumns_; inSequence = inBack; inBack = toVub[inSequence]; } if (inVub >= 0) printf("Vub %d in ", inSequence); if (inBack >= 0 && inSlack < 0) printf("%d (descendent of %d) in ", inSequence, inBack); if (inSlack >= 0) printf("slack for row %d -> %d (descendent of %d) in ", inSlack, inSequence, inBack); int outSequence = sequenceOut_; int outVub = -1; if (sequenceOut_ < numberColumns_) outVub = vub[sequenceOut_]; int outBack = toVub[outSequence]; int outSlack = -1; if (outSequence >= numberColumns_ && outBack >= 0) { outSlack = outSequence - numberColumns_; outSequence = outBack; outBack = toVub[outSequence]; } if (outVub >= 0) printf("Vub %d out ", outSequence); if (outBack >= 0 && outSlack < 0) printf("%d (descendent of %d) out ", outSequence, outBack); if (outSlack >= 0) printf("slack for row %d -> %d (descendent of %d) out ", outSlack, outSequence, outBack); printf("\n"); } } #endif #if 0 if (numberIterations_ > 206033) handler_->setLogLevel(63); if (numberIterations_ > 210567) exit(77); #endif if (!givenDuals && ifValuesPass && ifValuesPass != 2) { handler_->message(CLP_END_VALUES_PASS, messages_) << numberIterations_; whatNext = 1; } #ifdef CHECK_ACCURACY if (whatNext) { CoinMemcpyN(solution_, (numberRows_ + numberColumns_), zzzzzz); } #endif //if (numberIterations_==1890) //whatNext=1; //if (numberIterations_>2000) //exit(77); // and set bounds correctly originalBound(sequenceIn_); changeBound(sequenceOut_); #ifdef CLP_DEBUG if (objectiveValue_ < oldobj - 1.0e-5 && (handler_->logLevel() & 16)) printf("obj backwards %g %g\n", objectiveValue_, oldobj); #endif #if 0 { for (int i = 0; i < numberRows_ + numberColumns_; i++) { FakeBound bound = getFakeBound(i); if (bound == ClpSimplexDual::upperFake) { assert (upper_[i] < 1.0e20); } else if (bound == ClpSimplexDual::lowerFake) { assert (lower_[i] > -1.0e20); } else if (bound == ClpSimplexDual::bothFake) { assert (upper_[i] < 1.0e20); assert (lower_[i] > -1.0e20); } } } #endif if (whatNext == 1 || candidate == -2) { problemStatus_ = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent problemStatus_ = 3; returnCode = 3; break; } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 4; break; } } } else { #ifdef CLP_INVESTIGATE_SERIAL z_thinks = 1; #endif // no incoming column is valid spareIntArray_[3]=pivotRow_; pivotRow_ = -1; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("** no column pivot\n"); #endif if ((factorization_->pivots() < 2 ||((specialOptions_&2097152)!=0&&factorization_->pivots()<50)) && acceptablePivot_ <= 1.0e-8 && acceptablePivot_ > 0.0) { //&&goodAccuracy()) { // If not in branch and bound etc save ray delete [] ray_; if ((specialOptions_&(1024 | 4096)) == 0 || (specialOptions_ & (32|2097152)) != 0) { // create ray anyway ray_ = new double [ numberRows_]; rowArray_[0]->expand(); // in case packed const double * array = rowArray_[0]->denseVector(); for (int i=0;i1.0e-7) { if (getRowStatus(i)==basic) { nBasic++; } else if (getRowStatus(i)==atLowerBound) { if (ray_[i]>0.0) nPlusLower++; else nMinusLower++; } else if (getRowStatus(i)==atUpperBound) { if (ray_[i]>0.0) nPlusUpper++; else nMinusUpper++; } else { // fixed slack } } } printf("Slacks %d basic lower +,- %d,%d upper +,- %d,%d\n", nBasic,nPlusLower,nMinusLower,nPlusUpper,nMinusLower); for (int i=0;i1.0e-7) { if (getColumnStatus(i)==basic) { nBasic++; } else if (getColumnStatus(i)==atLowerBound) { if (farkas[i]>0.0) nPlusLower++; else nMinusLower++; } else if (getColumnStatus(i)==atUpperBound) { if (farkas[i]>0.0) nPlusUpper++; else nMinusUpper++; } else { if (!lower_[i]) { if (farkas[i]>0.0) { nPlusFixedLower++; } else { nMinusFixedLower++; } } else { if (farkas[i]>0.0) { nPlusFixedUpper++; } else { nMinusFixedUpper++; } } } } } printf("End %d basic lower +,- %d,%d upper +,- %d,%d fixed %d,%d %d,%d\n", nBasic,nPlusLower,nMinusLower,nPlusUpper,nMinusUpper, nPlusFixedLower,nMinusFixedLower,nPlusFixedUpper,nMinusFixedUpper); printf("Dual creating infeasibility ray direction out %d - pivRow %d seqOut %d lower %g,val %g,upper %g\n", directionOut_,spareIntArray_[3],sequenceOut_,lowerOut_,valueOut_,upperOut_); delete [] farkas; } #endif } else { ray_ = NULL; } // If we have just factorized and infeasibility reasonable say infeas double dualTest = ((specialOptions_ & 4096) != 0) ? 1.0e8 : 1.0e13; if (((specialOptions_ & 4096) != 0 || bestPossiblePivot < 1.0e-11) && dualBound_ > dualTest) { double testValue = 1.0e-4; if (!factorization_->pivots() && numberPrimalInfeasibilities_ == 1) testValue = 1.0e-6; if (valueOut_ > upperOut_ + testValue || valueOut_ < lowerOut_ - testValue || (specialOptions_ & 64) == 0) { // say infeasible problemStatus_ = 1; // unless primal feasible!!!! //printf("%d %g %d %g\n",numberPrimalInfeasibilities_,sumPrimalInfeasibilities_, // numberDualInfeasibilities_,sumDualInfeasibilities_); //#define TEST_CLP_NODE #ifndef TEST_CLP_NODE // Should be correct - but ... int numberFake = numberAtFakeBound(); double sumPrimal = (!numberFake) ? 2.0e5 : sumPrimalInfeasibilities_; if (sumPrimalInfeasibilities_ < 1.0e-3 || sumDualInfeasibilities_ > 1.0e-5 || (sumPrimal < 1.0e5 && (specialOptions_ & 1024) != 0 && factorization_->pivots())) { if (sumPrimal > 50.0 && factorization_->pivots() > 2) { problemStatus_ = -4; #ifdef COIN_DEVELOP printf("status to -4 at %d - primalinf %g pivots %d\n", __LINE__, sumPrimalInfeasibilities_, factorization_->pivots()); #endif } else { problemStatus_ = 10; #if COIN_DEVELOP>1 printf("returning at %d - primal %d %g - dual %d %g fake %d weight %g - pivs %d - options (1024-16384) %d %d %d %d %d\n", __LINE__, numberPrimalInfeasibilities_, sumPrimalInfeasibilities_, numberDualInfeasibilities_, sumDualInfeasibilities_, numberFake_, dualBound_, factorization_->pivots(), (specialOptions_ & 1024) != 0 ? 1 : 0, (specialOptions_ & 2048) != 0 ? 1 : 0, (specialOptions_ & 4096) != 0 ? 1 : 0, (specialOptions_ & 8192) != 0 ? 1 : 0, (specialOptions_ & 16384) != 0 ? 1 : 0 ); #endif // Get rid of objective if ((specialOptions_ & 16384) == 0) objective_ = new ClpLinearObjective(NULL, numberColumns_); } } #else if (sumPrimalInfeasibilities_ < 1.0e-3 || sumDualInfeasibilities_ > 1.0e-6) { #ifdef COIN_DEVELOP printf("at %d - primal %d %g - dual %d %g fake %d weight %g - pivs %d\n", __LINE__, numberPrimalInfeasibilities_, sumPrimalInfeasibilities_, numberDualInfeasibilities_, sumDualInfeasibilities_, numberFake_, dualBound_, factorization_->pivots()); #endif if ((specialOptions_ & 1024) != 0 && factorization_->pivots()) { problemStatus_ = 10; #if COIN_DEVELOP>1 printf("returning at %d\n", __LINE__); #endif // Get rid of objective if ((specialOptions_ & 16384) == 0) objective_ = new ClpLinearObjective(NULL, numberColumns_); } } #endif rowArray_[0]->clear(); columnArray_[0]->clear(); returnCode = 1; break; } } // If special option set - put off as long as possible if ((specialOptions_ & 64) == 0 || (moreSpecialOptions_ & 64) != 0) { if (factorization_->pivots() == 0) problemStatus_ = -4; //say looks infeasible } else { // flag char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #ifdef COIN_DEVELOP printf("flag c\n"); #endif setFlagged(sequenceOut_); if (!factorization_->pivots()) { rowArray_[0]->clear(); columnArray_[0]->clear(); continue; } } } acceptablePivot_ = fabs(acceptablePivot_); if (factorization_->pivots() < 5 && acceptablePivot_ > 1.0e-8) acceptablePivot_ = 1.0e-8; rowArray_[0]->clear(); columnArray_[0]->clear(); returnCode = 1; break; } } else { #ifdef CLP_INVESTIGATE_SERIAL z_thinks = 0; #endif // no pivot row #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("** no row pivot\n"); #endif // If in branch and bound try and get rid of fixed variables if ((specialOptions_ & 1024) != 0 && CLEAN_FIXED) { assert (!candidateList); candidateList = new int[numberRows_]; int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (flagged(iPivot) || !pivoted(iPivot)) continue; assert (iPivot < numberColumns_ && lower_[iPivot] == upper_[iPivot]); candidateList[numberCandidates++] = iRow; } // and set first candidate if (!numberCandidates) { delete [] candidateList; candidateList = NULL; int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; clearPivoted(iPivot); } } else { ifValuesPass = 2; continue; } } int numberPivots = factorization_->pivots(); bool specialCase; int useNumberFake; returnCode = 0; if (numberPivots <= CoinMax(dontFactorizePivots_, 20) && (specialOptions_ & 2048) != 0 && (true || !numberChanged_ || perturbation_ == 101) && dualBound_ >= 1.0e8) { specialCase = true; // as dual bound high - should be okay useNumberFake = 0; } else { specialCase = false; useNumberFake = numberFake_; } if (!numberPivots || specialCase) { if (numberPrimalInfeasibilities_ && problemStatus_==-1) problemStatus_=-4; // may have crept through - so may be optimal // check any flagged variables int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (flagged(iPivot)) break; } if (iRow < numberRows_ && numberPivots) { // try factorization returnCode = -2; } if (useNumberFake || numberDualInfeasibilities_) { // may be dual infeasible if ((specialOptions_ & 1024) == 0) problemStatus_ = -5; else if (!useNumberFake && numberPrimalInfeasibilities_ && !numberPivots) problemStatus_ = 1; } else { if (iRow < numberRows_) { #ifdef COIN_DEVELOP std::cout << "Flagged variables at end - infeasible?" << std::endl; printf("Probably infeasible - pivot was %g\n", alpha_); #endif //if (fabs(alpha_)<1.0e-4) { //problemStatus_=1; //} else { #ifdef CLP_DEBUG abort(); #endif //} problemStatus_ = -5; } else { problemStatus_ = 0; #ifndef CLP_CHECK_NUMBER_PIVOTS #define CLP_CHECK_NUMBER_PIVOTS 10 #endif #if CLP_CHECK_NUMBER_PIVOTS < 20 if (numberPivots > CLP_CHECK_NUMBER_PIVOTS) { #ifndef NDEBUG_CLP int nTotal = numberRows_ + numberColumns_; double * comp = CoinCopyOfArray(solution_, nTotal); #endif computePrimals(rowActivityWork_, columnActivityWork_); #ifndef NDEBUG_CLP double largest = 1.0e-5; int bad = -1; for (int i = 0; i < nTotal; i++) { double value = solution_[i]; double larger = CoinMax(fabs(value), fabs(comp[i])); double tol = 1.0e-5 + 1.0e-5 * larger; double diff = fabs(value - comp[i]); if (diff - tol > largest) { bad = i; largest = diff - tol; } } if (bad >= 0) COIN_DETAIL_PRINT(printf("bad %d old %g new %g\n", bad, comp[bad], solution_[bad])); #endif checkPrimalSolution(rowActivityWork_, columnActivityWork_); if (numberPrimalInfeasibilities_) { #ifdef CLP_INVESTIGATE printf("XXX Infeas ? %d inf summing to %g\n", numberPrimalInfeasibilities_, sumPrimalInfeasibilities_); #endif problemStatus_ = -1; returnCode = -2; } #ifndef NDEBUG_CLP memcpy(solution_, comp, nTotal * sizeof(double)); delete [] comp; #endif } #endif if (!problemStatus_) { // make it look OK numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; // May be perturbed if (perturbation_ == 101 || numberChanged_) { numberChanged_ = 0; // Number of variables with changed costs perturbation_ = 102; // stop any perturbations //double changeCost; //changeBounds(1,NULL,changeCost); createRim4(false); // make sure duals are current computeDuals(givenDuals); checkDualSolution(); progress_.modifyObjective(-COIN_DBL_MAX); if (numberDualInfeasibilities_) { problemStatus_ = 10; // was -3; } else { computeObjectiveValue(true); } } else if (numberPivots) { computeObjectiveValue(true); } if (numberPivots < -1000) { // objective may be wrong objectiveValue_ = innerProduct(cost_, numberColumns_ + numberRows_, solution_); objectiveValue_ += objective_->nonlinearOffset(); objectiveValue_ /= (objectiveScale_ * rhsScale_); if ((specialOptions_ & 16384) == 0) { // and dual_ may be wrong (i.e. for fixed or basic) CoinIndexedVector * arrayVector = rowArray_[1]; arrayVector->clear(); int iRow; double * array = arrayVector->denseVector(); /* Use dual_ instead of array Even though dual_ is only numberRows_ long this is okay as gets permuted to longer rowArray_[2] */ arrayVector->setDenseVector(dual_); int * index = arrayVector->getIndices(); int number = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; double value = cost_[iPivot]; dual_[iRow] = value; if (value) { index[number++] = iRow; } } arrayVector->setNumElements(number); // Extended duals before "updateTranspose" matrix_->dualExpanded(this, arrayVector, NULL, 0); // Btran basic costs rowArray_[2]->clear(); factorization_->updateColumnTranspose(rowArray_[2], arrayVector); // and return vector arrayVector->setDenseVector(array); } } sumPrimalInfeasibilities_ = 0.0; } if ((specialOptions_&(1024 + 16384)) != 0 && !problemStatus_) { CoinIndexedVector * arrayVector = rowArray_[1]; arrayVector->clear(); double * rhs = arrayVector->denseVector(); times(1.0, solution_, rhs); #ifdef CHECK_ACCURACY bool bad = false; #endif bool bad2 = false; int i; for ( i = 0; i < numberRows_; i++) { if (rhs[i] < rowLowerWork_[i] - primalTolerance_ || rhs[i] > rowUpperWork_[i] + primalTolerance_) { bad2 = true; #ifdef CHECK_ACCURACY printf("row %d out of bounds %g, %g correct %g bad %g\n", i, rowLowerWork_[i], rowUpperWork_[i], rhs[i], rowActivityWork_[i]); #endif } else if (fabs(rhs[i] - rowActivityWork_[i]) > 1.0e-3) { #ifdef CHECK_ACCURACY bad = true; printf("row %d correct %g bad %g\n", i, rhs[i], rowActivityWork_[i]); #endif } rhs[i] = 0.0; } for ( i = 0; i < numberColumns_; i++) { if (solution_[i] < columnLowerWork_[i] - primalTolerance_ || solution_[i] > columnUpperWork_[i] + primalTolerance_) { bad2 = true; #ifdef CHECK_ACCURACY printf("column %d out of bounds %g, %g correct %g bad %g\n", i, columnLowerWork_[i], columnUpperWork_[i], solution_[i], columnActivityWork_[i]); #endif } } if (bad2) { problemStatus_ = -3; returnCode = -2; // Force to re-factorize early next time int numberPivots = factorization_->pivots(); forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); } } } } } else { problemStatus_ = -3; returnCode = -2; // Force to re-factorize early next time int numberPivots = factorization_->pivots(); forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); } break; } } if (givenDuals) { CoinMemcpyN(dj_, numberRows_ + numberColumns_, givenDuals); // get rid of any values pass array delete [] candidateList; } delete [] dubiousWeights; #ifdef CLP_REPORT_PROGRESS if (ixxxxxx > ixxyyyy - 5) { int nTotal = numberColumns_ + numberRows_; double oldObj = 0.0; double newObj = 0.0; for (int i = 0; i < nTotal; i++) { if (savePSol[i]) oldObj += savePSol[i] * saveCost[i]; if (solution_[i]) newObj += solution_[i] * cost_[i]; bool printIt = false; if (cost_[i] != saveCost[i]) printIt = true; if (status_[i] != saveStat[i]) printIt = true; if (printIt) printf("%d old %d cost %g sol %g, new %d cost %g sol %g\n", i, saveStat[i], saveCost[i], savePSol[i], status_[i], cost_[i], solution_[i]); // difference savePSol[i] = solution_[i] - savePSol[i]; } printf("exit pivots %d, old obj %g new %g\n", factorization_->pivots(), oldObj, newObj); memset(saveDj, 0, numberRows_ * sizeof(double)); times(1.0, savePSol, saveDj); double largest = 1.0e-6; int k = -1; for (int i = 0; i < numberRows_; i++) { saveDj[i] -= savePSol[i+numberColumns_]; if (fabs(saveDj[i]) > largest) { largest = fabs(saveDj[i]); k = i; } } if (k >= 0) printf("Not null %d %g\n", k, largest); } delete [] savePSol ; delete [] saveDj ; delete [] saveCost ; delete [] saveStat ; #endif return returnCode; } //#define ABOCA_LITE 4 #if ABOCA_LITE #include typedef struct { double tolerance; double theta; double * reducedCost; const double * lower; const double * upper; double * work; const unsigned char * statusArray; int * which; int numberInfeasibilities; int numberToDo; } update_duals; static void updateDualBit(update_duals & info) { int numberInfeasibilities = 0; double tolerance = info.tolerance; double theta = info.theta; double * COIN_RESTRICT reducedCost = info.reducedCost; const double * COIN_RESTRICT lower = info.lower; const double * COIN_RESTRICT upper = info.upper; double * COIN_RESTRICT work = info.work; int number = info.numberToDo; int * COIN_RESTRICT which = info.which; const unsigned char * COIN_RESTRICT statusArray = info.statusArray; double multiplier[] = { -1.0, 1.0}; for (int i = 0; i < number; i++) { int iSequence = which[i]; double alphaI = work[i]; work[i] = 0.0; int iStatus = (statusArray[iSequence] & 3) - 1; if (iStatus) { double value = reducedCost[iSequence] - theta * alphaI; reducedCost[iSequence] = value; //printf("xx %d %.18g\n",iSequence,reducedCost[iSequence]); double mult = multiplier[iStatus-1]; value *= mult; // skip if free if (value < -tolerance&&iStatus > 0) { // flipping bounds double movement = mult * (upper[iSequence] - lower[iSequence]); work[numberInfeasibilities] = movement; which[numberInfeasibilities++] = iSequence; } } } info.numberInfeasibilities=numberInfeasibilities; } #endif /* The duals are updated by the given arrays. Returns number of infeasibilities. rowArray and columnarray will have flipped The output vector has movement (row length array) */ int ClpSimplexDual::updateDualsInDual(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, CoinIndexedVector * outputArray, double theta, double & objectiveChange, bool fullRecompute) { outputArray->clear(); int numberInfeasibilities = 0; int numberRowInfeasibilities = 0; // get a tolerance double tolerance = dualTolerance_; // we can't really trust infeasibilities if there is dual error double error = CoinMin(1.0e-2, largestDualError_); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; double changeObj = 0.0; // Coding is very similar but we can save a bit by splitting // Do rows if (!fullRecompute) { int i; double * COIN_RESTRICT reducedCost = djRegion(0); const double * COIN_RESTRICT lower = lowerRegion(0); const double * COIN_RESTRICT upper = upperRegion(0); const double * COIN_RESTRICT cost = costRegion(0); double * COIN_RESTRICT work; int number; int * COIN_RESTRICT which; const unsigned char * COIN_RESTRICT statusArray = status_ + numberColumns_; assert(rowArray->packedMode()); work = rowArray->denseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); double multiplier[] = { -1.0, 1.0}; for (i = 0; i < number; i++) { int iSequence = which[i]; double alphaI = work[i]; work[i] = 0.0; int iStatus = (statusArray[iSequence] & 3) - 1; if (iStatus) { double value = reducedCost[iSequence] - theta * alphaI; reducedCost[iSequence] = value; double mult = multiplier[iStatus-1]; value *= mult; // skip if free if (value < -tolerance&&iStatus > 0) { // flipping bounds double movement = mult * (lower[iSequence] - upper[iSequence]); which[numberInfeasibilities++] = iSequence; #ifndef NDEBUG if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("%d %d, new dj %g, alpha %g, movement %g\n", 0, iSequence, value, alphaI, movement); #endif changeObj -= movement * cost[iSequence]; outputArray->quickAdd(iSequence, movement); } } } // Do columns reducedCost = djRegion(1); lower = lowerRegion(1); upper = upperRegion(1); cost = costRegion(1); // set number of infeasibilities in row array numberRowInfeasibilities = numberInfeasibilities; rowArray->setNumElements(numberInfeasibilities); numberInfeasibilities = 0; work = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); if ((moreSpecialOptions_ & 8) != 0) { const unsigned char * COIN_RESTRICT statusArray = status_; #if ABOCA_LITE update_duals info[ABOCA_LITE]; int chunk = (number+ABOCA_LITE-1)/ABOCA_LITE; int n=0; int * whichX = which; for (i=0;i= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif changeObj += movement * cost[iSequence]; matrix_->add(this, outputArray, iSequence, movement); } } #else for (i = 0; i < number; i++) { int iSequence = which[i]; double alphaI = work[i]; work[i] = 0.0; int iStatus = (statusArray[iSequence] & 3) - 1; if (iStatus) { double value = reducedCost[iSequence] - theta * alphaI; reducedCost[iSequence] = value; //printf("xx %d %.18g\n",iSequence,reducedCost[iSequence]); double mult = multiplier[iStatus-1]; value *= mult; // skip if free if (value < -tolerance&&iStatus > 0) { // flipping bounds double movement = mult * (upper[iSequence] - lower[iSequence]); which[numberInfeasibilities++] = iSequence; #ifndef NDEBUG if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("%d %d, new dj %g, alpha %g, movement %g\n", 1, iSequence, value, alphaI, movement); #endif changeObj += movement * cost[iSequence]; matrix_->add(this, outputArray, iSequence, movement); } } } #endif } else { for (i = 0; i < number; i++) { int iSequence = which[i]; double alphaI = work[i]; work[i] = 0.0; Status status = getStatus(iSequence); if (status == atLowerBound) { double value = reducedCost[iSequence] - theta * alphaI; reducedCost[iSequence] = value; double movement = 0.0; if (value < -tolerance) { // to upper bound which[numberInfeasibilities++] = iSequence; movement = upper[iSequence] - lower[iSequence]; #ifndef NDEBUG if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("%d %d, new dj %g, alpha %g, movement %g\n", 1, iSequence, value, alphaI, movement); #endif changeObj += movement * cost[iSequence]; matrix_->add(this, outputArray, iSequence, movement); } } else if (status == atUpperBound) { double value = reducedCost[iSequence] - theta * alphaI; reducedCost[iSequence] = value; double movement = 0.0; if (value > tolerance) { // to lower bound (if swap) which[numberInfeasibilities++] = iSequence; movement = lower[iSequence] - upper[iSequence]; #ifndef NDEBUG if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("%d %d, new dj %g, alpha %g, movement %g\n", 1, iSequence, value, alphaI, movement); #endif changeObj += movement * cost[iSequence]; matrix_->add(this, outputArray, iSequence, movement); } } else if (status == isFree) { double value = reducedCost[iSequence] - theta * alphaI; reducedCost[iSequence] = value; } } } } else { double * COIN_RESTRICT solution = solutionRegion(0); double * COIN_RESTRICT reducedCost = djRegion(0); double * COIN_RESTRICT lower = lowerRegion(0); double * COIN_RESTRICT upper = upperRegion(0); const double * COIN_RESTRICT cost = costRegion(0); int * COIN_RESTRICT which; which = rowArray->getIndices(); int iSequence; for (iSequence = 0; iSequence < numberRows_; iSequence++) { double value = reducedCost[iSequence]; Status status = getStatus(iSequence + numberColumns_); // more likely to be at upper bound ? if (status == atUpperBound) { double movement = 0.0; //#define NO_SWAP7 if (value > tolerance) { // to lower bound (if swap) // put back alpha which[numberInfeasibilities++] = iSequence; movement = lower[iSequence] - upper[iSequence]; #define TRY_SET_FAKE #ifdef TRY_SET_FAKE if (fabs(movement) > dualBound_) { FakeBound bound = getFakeBound(iSequence + numberColumns_); if (bound == ClpSimplexDual::noFake) { setFakeBound(iSequence + numberColumns_, ClpSimplexDual::lowerFake); lower[iSequence] = upper[iSequence] - dualBound_; assert (fabs(lower[iSequence])<1.0e30); movement = lower[iSequence] - upper[iSequence]; numberFake_++; #ifndef NDEBUG } else { if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif } } #endif changeObj += movement * cost[iSequence]; outputArray->quickAdd(iSequence, -movement); #ifndef NO_SWAP7 } else if (value > -tolerance) { // at correct bound but may swap FakeBound bound = getFakeBound(iSequence + numberColumns_); if (bound == ClpSimplexDual::upperFake) { movement = lower[iSequence] - upper[iSequence]; #ifndef NDEBUG if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif setStatus(iSequence + numberColumns_, atLowerBound); solution[iSequence] = lower[iSequence]; changeObj += movement * cost[iSequence]; //numberFake_--; //setFakeBound(iSequence+numberColumns_,noFake); } #endif } } else if (status == atLowerBound) { double movement = 0.0; if (value < -tolerance) { // to upper bound // put back alpha which[numberInfeasibilities++] = iSequence; movement = upper[iSequence] - lower[iSequence]; #ifdef TRY_SET_FAKE if (fabs(movement) > dualBound_) { FakeBound bound = getFakeBound(iSequence + numberColumns_); if (bound == ClpSimplexDual::noFake) { setFakeBound(iSequence + numberColumns_, ClpSimplexDual::upperFake); upper[iSequence] = lower[iSequence] + dualBound_; assert (fabs(upper[iSequence])<1.0e30); movement = upper[iSequence] - lower[iSequence]; numberFake_++; #ifndef NDEBUG } else { if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif } } #endif changeObj += movement * cost[iSequence]; outputArray->quickAdd(iSequence, -movement); #ifndef NO_SWAP7 } else if (value < tolerance) { // at correct bound but may swap FakeBound bound = getFakeBound(iSequence + numberColumns_); if (bound == ClpSimplexDual::lowerFake) { movement = upper[iSequence] - lower[iSequence]; #ifndef NDEBUG if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif setStatus(iSequence + numberColumns_, atUpperBound); solution[iSequence] = upper[iSequence]; changeObj += movement * cost[iSequence]; //numberFake_--; //setFakeBound(iSequence+numberColumns_,noFake); } #endif } } } // Do columns solution = solutionRegion(1); reducedCost = djRegion(1); lower = lowerRegion(1); upper = upperRegion(1); cost = costRegion(1); // set number of infeasibilities in row array numberRowInfeasibilities = numberInfeasibilities; rowArray->setNumElements(numberInfeasibilities); numberInfeasibilities = 0; which = columnArray->getIndices(); for (iSequence = 0; iSequence < numberColumns_; iSequence++) { double value = reducedCost[iSequence]; Status status = getStatus(iSequence); if (status == atLowerBound) { double movement = 0.0; if (value < -tolerance) { // to upper bound // put back alpha which[numberInfeasibilities++] = iSequence; movement = upper[iSequence] - lower[iSequence]; #ifdef TRY_SET_FAKE if (fabs(movement) > dualBound_) { FakeBound bound = getFakeBound(iSequence); if (bound == ClpSimplexDual::noFake) { setFakeBound(iSequence, ClpSimplexDual::upperFake); upper[iSequence] = lower[iSequence] + dualBound_; assert (fabs(upper[iSequence])<1.0e30); movement = upper[iSequence] - lower[iSequence]; numberFake_++; #ifndef NDEBUG } else { if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif } } #endif changeObj += movement * cost[iSequence]; matrix_->add(this, outputArray, iSequence, movement); #ifndef NO_SWAP7 } else if (value < tolerance) { // at correct bound but may swap FakeBound bound = getFakeBound(iSequence); if (bound == ClpSimplexDual::lowerFake) { movement = upper[iSequence] - lower[iSequence]; #ifndef NDEBUG if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif setStatus(iSequence, atUpperBound); solution[iSequence] = upper[iSequence]; changeObj += movement * cost[iSequence]; //numberFake_--; //setFakeBound(iSequence,noFake); } #endif } } else if (status == atUpperBound) { double movement = 0.0; if (value > tolerance) { // to lower bound (if swap) // put back alpha which[numberInfeasibilities++] = iSequence; movement = lower[iSequence] - upper[iSequence]; #ifdef TRY_SET_FAKE if (fabs(movement) > dualBound_) { FakeBound bound = getFakeBound(iSequence); if (bound == ClpSimplexDual::noFake) { setFakeBound(iSequence, ClpSimplexDual::lowerFake); lower[iSequence] = upper[iSequence] - dualBound_; assert (fabs(lower[iSequence])<1.0e30); movement = lower[iSequence] - upper[iSequence]; numberFake_++; #ifndef NDEBUG } else { if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif } } #endif changeObj += movement * cost[iSequence]; matrix_->add(this, outputArray, iSequence, movement); #ifndef NO_SWAP7 } else if (value > -tolerance) { // at correct bound but may swap FakeBound bound = getFakeBound(iSequence); if (bound == ClpSimplexDual::upperFake) { movement = lower[iSequence] - upper[iSequence]; #ifndef NDEBUG if (fabs(movement) >= 1.0e30) resetFakeBounds(-1000 - iSequence); #endif setStatus(iSequence, atLowerBound); solution[iSequence] = lower[iSequence]; changeObj += movement * cost[iSequence]; //numberFake_--; //setFakeBound(iSequence,noFake); } #endif } } } } #ifdef CLP_DEBUG if (fullRecompute && numberFake_ && (handler_->logLevel() & 16) != 0) printf("%d fake after full update\n", numberFake_); #endif // set number of infeasibilities columnArray->setNumElements(numberInfeasibilities); numberInfeasibilities += numberRowInfeasibilities; if (fullRecompute) { // do actual flips flipBounds(rowArray, columnArray); } objectiveChange += changeObj; return numberInfeasibilities; } void ClpSimplexDual::updateDualsInValuesPass(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, double theta) { // use a tighter tolerance except for all being okay double tolerance = dualTolerance_; // Coding is very similar but we can save a bit by splitting // Do rows { int i; double * reducedCost = djRegion(0); double * work; int number; int * which; work = rowArray->denseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); for (i = 0; i < number; i++) { int iSequence = which[i]; double alphaI = work[i]; double value = reducedCost[iSequence] - theta * alphaI; work[i] = 0.0; reducedCost[iSequence] = value; Status status = getStatus(iSequence + numberColumns_); // more likely to be at upper bound ? if (status == atUpperBound) { if (value > tolerance) reducedCost[iSequence] = 0.0; } else if (status == atLowerBound) { if (value < -tolerance) { reducedCost[iSequence] = 0.0; } } } } rowArray->setNumElements(0); // Do columns { int i; double * reducedCost = djRegion(1); double * work; int number; int * which; work = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); for (i = 0; i < number; i++) { int iSequence = which[i]; double alphaI = work[i]; double value = reducedCost[iSequence] - theta * alphaI; work[i] = 0.0; reducedCost[iSequence] = value; Status status = getStatus(iSequence); if (status == atLowerBound) { if (value < -tolerance) reducedCost[iSequence] = 0.0; } else if (status == atUpperBound) { if (value > tolerance) reducedCost[iSequence] = 0.0; } } } columnArray->setNumElements(0); } /* Chooses dual pivot row Would be faster with separate region to scan and will have this (with square of infeasibility) when steepest For easy problems we can just choose one of the first rows we look at */ void ClpSimplexDual::dualRow(int alreadyChosen) { // get pivot row using whichever method it is int chosenRow = -1; #ifdef FORCE_FOLLOW bool forceThis = false; if (!fpFollow && strlen(forceFile)) { fpFollow = fopen(forceFile, "r"); assert (fpFollow); } if (fpFollow) { if (numberIterations_ <= force_iteration) { // read to next Clp0102 char temp[300]; while (fgets(temp, 250, fpFollow)) { if (strncmp(temp, "Clp0102", 7)) continue; char cin, cout; sscanf(temp + 9, "%d%*f%*s%*c%c%d%*s%*c%c%d", &force_iteration, &cin, &force_in, &cout, &force_out); if (cin == 'R') force_in += numberColumns_; if (cout == 'R') force_out += numberColumns_; forceThis = true; assert (numberIterations_ == force_iteration - 1); printf("Iteration %d will force %d out and %d in\n", force_iteration, force_out, force_in); alreadyChosen = force_out; break; } } else { // use old forceThis = true; } if (!forceThis) { fclose(fpFollow); fpFollow = NULL; forceFile = ""; } } #endif //double freeAlpha = 0.0; if (alreadyChosen < 0) { // first see if any free variables and put them in basis int nextFree = nextSuperBasic(); //nextFree=-1; //off if (nextFree >= 0) { // unpack vector and find a good pivot unpack(rowArray_[1], nextFree); factorization_->updateColumn(rowArray_[2], rowArray_[1]); double * work = rowArray_[1]->denseVector(); int number = rowArray_[1]->getNumElements(); int * which = rowArray_[1]->getIndices(); double bestFeasibleAlpha = 0.0; int bestFeasibleRow = -1; double bestInfeasibleAlpha = 0.0; int bestInfeasibleRow = -1; int i; for (i = 0; i < number; i++) { int iRow = which[i]; double alpha = fabs(work[iRow]); if (alpha > 1.0e-3) { int iSequence = pivotVariable_[iRow]; double value = solution_[iSequence]; double lower = lower_[iSequence]; double upper = upper_[iSequence]; double infeasibility = 0.0; if (value > upper) infeasibility = value - upper; else if (value < lower) infeasibility = lower - value; if (infeasibility * alpha > bestInfeasibleAlpha && alpha > 1.0e-1) { if (!flagged(iSequence)) { bestInfeasibleAlpha = infeasibility * alpha; bestInfeasibleRow = iRow; } } if (alpha > bestFeasibleAlpha && (lower > -1.0e20 || upper < 1.0e20)) { bestFeasibleAlpha = alpha; bestFeasibleRow = iRow; } } } if (bestInfeasibleRow >= 0) chosenRow = bestInfeasibleRow; else if (bestFeasibleAlpha > 1.0e-2) chosenRow = bestFeasibleRow; if (chosenRow >= 0) { pivotRow_ = chosenRow; //freeAlpha = work[chosenRow]; } rowArray_[1]->clear(); } } else { // in values pass chosenRow = alreadyChosen; #ifdef FORCE_FOLLOW if(forceThis) { alreadyChosen = -1; chosenRow = -1; for (int i = 0; i < numberRows_; i++) { if (pivotVariable_[i] == force_out) { chosenRow = i; break; } } assert (chosenRow >= 0); } #endif pivotRow_ = chosenRow; } if (chosenRow < 0) pivotRow_ = dualRowPivot_->pivotRow(); if (pivotRow_ >= 0) { sequenceOut_ = pivotVariable_[pivotRow_]; valueOut_ = solution_[sequenceOut_]; lowerOut_ = lower_[sequenceOut_]; upperOut_ = upper_[sequenceOut_]; if (alreadyChosen < 0) { // if we have problems we could try other way and hope we get a // zero pivot? if (valueOut_ > upperOut_) { directionOut_ = -1; dualOut_ = valueOut_ - upperOut_; } else if (valueOut_ < lowerOut_) { directionOut_ = 1; dualOut_ = lowerOut_ - valueOut_; } else { #if 1 // odd (could be free) - it's feasible - go to nearest if (valueOut_ - lowerOut_ < upperOut_ - valueOut_) { directionOut_ = 1; dualOut_ = lowerOut_ - valueOut_; } else { directionOut_ = -1; dualOut_ = valueOut_ - upperOut_; } #else // odd (could be free) - it's feasible - improve obj printf("direction from alpha of %g is %d\n", freeAlpha, freeAlpha > 0.0 ? 1 : -1); if (valueOut_ - lowerOut_ > 1.0e20) freeAlpha = 1.0; else if(upperOut_ - valueOut_ > 1.0e20) freeAlpha = -1.0; //if (valueOut_-lowerOut_= 0.0); #endif } else { // in values pass so just use sign of dj // We don't want to go through any barriers so set dualOut low // free variables will never be here dualOut_ = 1.0e-6; if (dj_[sequenceOut_] > 0.0) { // this will give a -1 in pivot row (as slacks are -1.0) directionOut_ = 1; } else { directionOut_ = -1; } } } return ; } // Checks if any fake bounds active - if so returns number and modifies // dualBound_ and everything. // Free variables will be left as free // Returns number of bounds changed if >=0 // Returns -1 if not initialize and no effect // Fills in changeVector which can be used to see if unbounded // and cost of change vector int ClpSimplexDual::changeBounds(int initialize, CoinIndexedVector * outputArray, double & changeCost) { numberFake_ = 0; if (!initialize) { int numberInfeasibilities; double newBound; newBound = 5.0 * dualBound_; numberInfeasibilities = 0; changeCost = 0.0; // put back original bounds and then check createRim1(false); int iSequence; // bounds will get bigger - just look at ones at bounds for (iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { double lowerValue = lower_[iSequence]; double upperValue = upper_[iSequence]; double value = solution_[iSequence]; setFakeBound(iSequence, ClpSimplexDual::noFake); switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case isFree: case superBasic: break; case atUpperBound: if (fabs(value - upperValue) > primalTolerance_) numberInfeasibilities++; break; case atLowerBound: if (fabs(value - lowerValue) > primalTolerance_) numberInfeasibilities++; break; } } // If dual infeasible then carry on if (numberInfeasibilities) { handler_->message(CLP_DUAL_CHECKB, messages_) << newBound << CoinMessageEol; int iSequence; for (iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { double lowerValue = lower_[iSequence]; double upperValue = upper_[iSequence]; double newLowerValue; double newUpperValue; Status status = getStatus(iSequence); if (status == atUpperBound || status == atLowerBound) { double value = solution_[iSequence]; if (value - lowerValue <= upperValue - value) { newLowerValue = CoinMax(lowerValue, value - 0.666667 * newBound); newUpperValue = CoinMin(upperValue, newLowerValue + newBound); } else { newUpperValue = CoinMin(upperValue, value + 0.666667 * newBound); newLowerValue = CoinMax(lowerValue, newUpperValue - newBound); } lower_[iSequence] = newLowerValue; upper_[iSequence] = newUpperValue; if (newLowerValue > lowerValue) { if (newUpperValue < upperValue) { setFakeBound(iSequence, ClpSimplexDual::bothFake); #ifdef CLP_INVESTIGATE abort(); // No idea what should happen here - I have never got here #endif numberFake_++; } else { setFakeBound(iSequence, ClpSimplexDual::lowerFake); numberFake_++; } } else { if (newUpperValue < upperValue) { setFakeBound(iSequence, ClpSimplexDual::upperFake); numberFake_++; } } if (status == atUpperBound) solution_[iSequence] = newUpperValue; else solution_[iSequence] = newLowerValue; double movement = solution_[iSequence] - value; if (movement && outputArray) { if (iSequence >= numberColumns_) { outputArray->quickAdd(iSequence, -movement); changeCost += movement * cost_[iSequence]; } else { matrix_->add(this, outputArray, iSequence, movement); changeCost += movement * cost_[iSequence]; } } } } dualBound_ = newBound; } else { numberInfeasibilities = -1; } return numberInfeasibilities; } else if (initialize == 1 || initialize == 3) { int iSequence; if (initialize == 3) { for (iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { setFakeBound(iSequence, ClpSimplexDual::noFake); } } double testBound = 0.999999 * dualBound_; for (iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { Status status = getStatus(iSequence); if (status == atUpperBound || status == atLowerBound) { double lowerValue = lower_[iSequence]; double upperValue = upper_[iSequence]; double value = solution_[iSequence]; if (lowerValue > -largeValue_ || upperValue < largeValue_) { if (true || lowerValue - value > -0.5 * dualBound_ || upperValue - value < 0.5 * dualBound_) { if (fabs(lowerValue - value) <= fabs(upperValue - value)) { if (upperValue > lowerValue + testBound) { if (getFakeBound(iSequence) == ClpSimplexDual::noFake) numberFake_++; upper_[iSequence] = lowerValue + dualBound_; setFakeBound(iSequence, ClpSimplexDual::upperFake); } } else { if (lowerValue < upperValue - testBound) { if (getFakeBound(iSequence) == ClpSimplexDual::noFake) numberFake_++; lower_[iSequence] = upperValue - dualBound_; setFakeBound(iSequence, ClpSimplexDual::lowerFake); } } } else { if (getFakeBound(iSequence) == ClpSimplexDual::noFake) numberFake_++; lower_[iSequence] = -0.5 * dualBound_; upper_[iSequence] = 0.5 * dualBound_; setFakeBound(iSequence, ClpSimplexDual::bothFake); abort(); } if (status == atUpperBound) solution_[iSequence] = upper_[iSequence]; else solution_[iSequence] = lower_[iSequence]; } else { // set non basic free variables to fake bounds // I don't think we should ever get here CoinAssert(!("should not be here")); lower_[iSequence] = -0.5 * dualBound_; upper_[iSequence] = 0.5 * dualBound_; setFakeBound(iSequence, ClpSimplexDual::bothFake); numberFake_++; setStatus(iSequence, atUpperBound); solution_[iSequence] = 0.5 * dualBound_; } } else if (status == basic) { // make sure not at fake bound and bounds correct setFakeBound(iSequence, ClpSimplexDual::noFake); double gap = upper_[iSequence] - lower_[iSequence]; if (gap > 0.5 * dualBound_ && gap < 2.0 * dualBound_) { if (iSequence < numberColumns_) { if (columnScale_) { double multiplier = rhsScale_ * inverseColumnScale_[iSequence]; // lower double value = columnLower_[iSequence]; if (value > -1.0e30) { value *= multiplier; } lower_[iSequence] = value; // upper value = columnUpper_[iSequence]; if (value < 1.0e30) { value *= multiplier; } upper_[iSequence] = value; } else { lower_[iSequence] = columnLower_[iSequence];; upper_[iSequence] = columnUpper_[iSequence];; } } else { int iRow = iSequence - numberColumns_; if (rowScale_) { // lower double multiplier = rhsScale_ * rowScale_[iRow]; double value = rowLower_[iRow]; if (value > -1.0e30) { value *= multiplier; } lower_[iSequence] = value; // upper value = rowUpper_[iRow]; if (value < 1.0e30) { value *= multiplier; } upper_[iSequence] = value; } else { lower_[iSequence] = rowLower_[iRow];; upper_[iSequence] = rowUpper_[iRow];; } } } } } return 1; } else { // just reset changed ones if (columnScale_) { int iSequence; for (iSequence = 0; iSequence < numberColumns_; iSequence++) { FakeBound fakeStatus = getFakeBound(iSequence); if (fakeStatus != noFake) { if ((static_cast (fakeStatus) & 1) != 0) { // lower double value = columnLower_[iSequence]; if (value > -1.0e30) { double multiplier = rhsScale_ * inverseColumnScale_[iSequence]; value *= multiplier; } columnLowerWork_[iSequence] = value; } if ((static_cast (fakeStatus) & 2) != 0) { // upper double value = columnUpper_[iSequence]; if (value < 1.0e30) { double multiplier = rhsScale_ * inverseColumnScale_[iSequence]; value *= multiplier; } columnUpperWork_[iSequence] = value; } } } for (iSequence = 0; iSequence < numberRows_; iSequence++) { FakeBound fakeStatus = getFakeBound(iSequence + numberColumns_); if (fakeStatus != noFake) { if ((static_cast (fakeStatus) & 1) != 0) { // lower double value = rowLower_[iSequence]; if (value > -1.0e30) { double multiplier = rhsScale_ * rowScale_[iSequence]; value *= multiplier; } rowLowerWork_[iSequence] = value; } if ((static_cast (fakeStatus) & 2) != 0) { // upper double value = rowUpper_[iSequence]; if (value < 1.0e30) { double multiplier = rhsScale_ * rowScale_[iSequence]; value *= multiplier; } rowUpperWork_[iSequence] = value; } } } } else { int iSequence; for (iSequence = 0; iSequence < numberColumns_; iSequence++) { FakeBound fakeStatus = getFakeBound(iSequence); if ((static_cast (fakeStatus) & 1) != 0) { // lower columnLowerWork_[iSequence] = columnLower_[iSequence]; } if ((static_cast (fakeStatus) & 2) != 0) { // upper columnUpperWork_[iSequence] = columnUpper_[iSequence]; } } for (iSequence = 0; iSequence < numberRows_; iSequence++) { FakeBound fakeStatus = getFakeBound(iSequence + numberColumns_); if ((static_cast (fakeStatus) & 1) != 0) { // lower rowLowerWork_[iSequence] = rowLower_[iSequence]; } if ((static_cast (fakeStatus) & 2) != 0) { // upper rowUpperWork_[iSequence] = rowUpper_[iSequence]; } } } return 0; } } #if ABOCA_LITE typedef struct { const int * COIN_RESTRICT which; const double * COIN_RESTRICT work; int * COIN_RESTRICT index; double * COIN_RESTRICT spare; const unsigned char * COIN_RESTRICT status; const double * COIN_RESTRICT reducedCost; double upperTheta; double bestPossible; double acceptablePivot; double dualTolerance; int numberRemaining; int numberToDo; } pricingInfo; /* Meat of transposeTimes by column when not scaled and skipping and doing part of dualColumn */ static void dualColumn00(pricingInfo & info) { const int * COIN_RESTRICT which = info.which; const double * COIN_RESTRICT work = info.work; int * COIN_RESTRICT index = info.index; double * COIN_RESTRICT spare = info.spare; const unsigned char * COIN_RESTRICT status = info.status; const double * COIN_RESTRICT reducedCost = info.reducedCost; double upperTheta = info.upperTheta; double acceptablePivot = info.acceptablePivot; double dualTolerance = info.dualTolerance; double bestPossible = info.bestPossible; int numberToDo=info.numberToDo; double tentativeTheta = 1.0e15; int numberRemaining = 0; double multiplier[] = { -1.0, 1.0}; double dualT = - dualTolerance; for (int i = 0; i < numberToDo; i++) { int iSequence = which[i]; int wanted = (status[iSequence] & 3) - 1; if (wanted) { double mult = multiplier[wanted-1]; double alpha = work[i] * mult; if (alpha > 0.0) { double oldValue = reducedCost[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list spare[numberRemaining] = alpha * mult; index[numberRemaining++] = iSequence; } } } } info.numberRemaining = numberRemaining; info.upperTheta = upperTheta; info.bestPossible = bestPossible; } // later do so less zeroing in first blocks // and some of it combined for loop to move and zero static void moveAndZero(double * to, double * from, int n) { long int distance = from-to; assert (distance>=0); if (distance==0) return; memmove(to,from,n*sizeof(double)); if (ndenseVector(); int * index = spareArray->getIndices(); const double * work; int number; const int * which; const double * reducedCost; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e15; double upperTheta = 1.0e31; double freePivot = acceptablePivot; double bestPossible = 0.0; int numberRemaining = 0; int i; badFree = 0.0; if ((moreSpecialOptions_ & 8) != 0) { // No free or super basic double multiplier[] = { -1.0, 1.0}; double dualT = - dualTolerance_; #if ABOCA_LITE==0 int nSections=2; #else int nSections=1; #endif for (int iSection = 0; iSection < nSections; iSection++) { int addSequence; unsigned char * statusArray; if (!iSection) { work = rowArray->denseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); reducedCost = rowReducedCost_; addSequence = numberColumns_; statusArray = status_ + numberColumns_; } else { work = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); reducedCost = reducedCostWork_; addSequence = 0; statusArray = status_; } for (i = 0; i < number; i++) { int iSequence = which[i]; double alpha; double oldValue; double value; assert (getStatus(iSequence + addSequence) != isFree && getStatus(iSequence + addSequence) != superBasic); int iStatus = (statusArray[iSequence] & 3) - 1; if (iStatus) { double mult = multiplier[iStatus-1]; alpha = work[i] * mult; if (alpha > 0.0) { oldValue = reducedCost[iSequence] * mult; value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; //tentativeTheta = CoinMin(2.0*upperTheta,tentativeTheta); } // add to list spare[numberRemaining] = alpha * mult; index[numberRemaining++] = iSequence + addSequence; } } } } } #if ABOCA_LITE work = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); reducedCost = reducedCostWork_; unsigned char * statusArray = status_; pricingInfo info[ABOCA_LITE]; int chunk = (number+ABOCA_LITE-1)/ABOCA_LITE; int n=0; int nR=numberRemaining; for (int i=0;idenseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); reducedCost = rowReducedCost_; addSequence = numberColumns_; } else { work = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); reducedCost = reducedCostWork_; addSequence = 0; } for (i = 0; i < number; i++) { int iSequence = which[i]; double alpha; double oldValue; double value; bool keep; switch(getStatus(iSequence + addSequence)) { case basic: case ClpSimplex::isFixed: break; case isFree: case superBasic: alpha = work[i]; bestPossible = CoinMax(bestPossible, fabs(alpha)); oldValue = reducedCost[iSequence]; // If free has to be very large - should come in via dualRow //if (getStatus(iSequence+addSequence)==isFree&&fabs(alpha)<1.0e-3) //break; if (oldValue > dualTolerance_) { keep = true; } else if (oldValue < -dualTolerance_) { keep = true; } else { if (fabs(alpha) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) { keep = true; } else { keep = false; badFree = CoinMax(badFree, fabs(alpha)); } } if (keep) { // free - choose largest if (fabs(alpha) > freePivot) { freePivot = fabs(alpha); sequenceIn_ = iSequence + addSequence; theta_ = oldValue / alpha; alpha_ = alpha; } } break; case atUpperBound: alpha = work[i]; oldValue = reducedCost[iSequence]; value = oldValue - tentativeTheta * alpha; //assert (oldValue<=dualTolerance_*1.0001); if (value > dualTolerance_) { bestPossible = CoinMax(bestPossible, -alpha); value = oldValue - upperTheta * alpha; if (value > dualTolerance_ && -alpha >= acceptablePivot) { upperTheta = (oldValue - dualTolerance_) / alpha; //tentativeTheta = CoinMin(2.0*upperTheta,tentativeTheta); } // add to list spare[numberRemaining] = alpha; index[numberRemaining++] = iSequence + addSequence; } break; case atLowerBound: alpha = work[i]; oldValue = reducedCost[iSequence]; value = oldValue - tentativeTheta * alpha; //assert (oldValue>=-dualTolerance_*1.0001); if (value < -dualTolerance_) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < -dualTolerance_ && alpha >= acceptablePivot) { upperTheta = (oldValue + dualTolerance_) / alpha; //tentativeTheta = CoinMin(2.0*upperTheta,tentativeTheta); } // add to list spare[numberRemaining] = alpha; index[numberRemaining++] = iSequence + addSequence; } break; } } } } upperReturn = upperTheta; bestReturn = bestPossible; return numberRemaining; } /* Row array has row part of pivot row (as duals so sign may be switched) Column array has column part. This chooses pivot column. Spare array will be needed when we start getting clever. We will check for basic so spare array will never overflow. If necessary will modify costs */ double ClpSimplexDual::dualColumn(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, CoinIndexedVector * spareArray, CoinIndexedVector * spareArray2, double acceptablePivot, CoinBigIndex * /*dubiousWeights*/) { int numberPossiblySwapped = 0; int numberRemaining = 0; double totalThru = 0.0; // for when variables flip //double saveAcceptable=acceptablePivot; //acceptablePivot=1.0e-9; double bestEverPivot = acceptablePivot; int lastSequence = -1; double lastPivot = 0.0; double upperTheta; double newTolerance = dualTolerance_; //newTolerance = dualTolerance_+1.0e-6*dblParam_[ClpDualTolerance]; // will we need to increase tolerance //bool thisIncrease = false; // If we think we need to modify costs (not if something from broad sweep) bool modifyCosts = false; // Increase in objective due to swapping bounds (may be negative) double increaseInObjective = 0.0; // use spareArrays to put ones looked at in // we are going to flip flop between int iFlip = 0; // Possible list of pivots int interesting[2]; // where possible swapped ones are int swapped[2]; // for zeroing out arrays after int marker[2][2]; // pivot elements double * array[2], * spare, * spare2; // indices int * indices[2], * index, * index2; spareArray2->clear(); array[0] = spareArray->denseVector(); indices[0] = spareArray->getIndices(); spare = array[0]; index = indices[0]; array[1] = spareArray2->denseVector(); indices[1] = spareArray2->getIndices(); int i; // initialize lists for (i = 0; i < 2; i++) { interesting[i] = 0; swapped[i] = numberColumns_; marker[i][0] = 0; marker[i][1] = numberColumns_; } /* First we get a list of possible pivots. We can also see if the problem looks infeasible or whether we want to pivot in free variable. This may make objective go backwards but can only happen a finite number of times and I do want free variables basic. Then we flip back and forth. At the start of each iteration interesting[iFlip] should have possible candidates and swapped[iFlip] will have pivots if we decide to take a previous pivot. At end of each iteration interesting[1-iFlip] should have candidates if we go through this theta and swapped[1-iFlip] pivots if we don't go through. At first we increase theta and see what happens. We start theta at a reasonable guess. If in right area then we do bit by bit. */ // do first pass to get possibles upperTheta = 1.0e31; double bestPossible = 0.0; double badFree = 0.0; alpha_ = 0.0; if (spareIntArray_[0] >= 0) { numberRemaining = dualColumn0(rowArray, columnArray, spareArray, acceptablePivot, upperTheta, bestPossible, badFree); } else { // already done numberRemaining = spareArray->getNumElements(); spareArray->setNumElements(0); upperTheta = spareDoubleArray_[0]; bestPossible = spareDoubleArray_[1]; if (spareIntArray_[0] == -1) { theta_ = spareDoubleArray_[2]; alpha_ = spareDoubleArray_[3]; sequenceIn_ = spareIntArray_[1]; } else { #if 0 int n = numberRemaining; double u = upperTheta; double b = bestPossible; upperTheta = 1.0e31; bestPossible = 0.0; numberRemaining = dualColumn0(rowArray, columnArray, spareArray, acceptablePivot, upperTheta, bestPossible, badFree); assert (n == numberRemaining); assert (fabs(b - bestPossible) < 1.0e-7); assert (fabs(u - upperTheta) < 1.0e-7); #endif } } // switch off spareIntArray_[0] = 0; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; interesting[0] = numberRemaining; marker[0][0] = numberRemaining; if (!numberRemaining && sequenceIn_ < 0) return 0.0; // Looks infeasible // If sum of bad small pivots too much #define MORE_CAREFUL #ifdef MORE_CAREFUL bool badSumPivots = false; #endif if (sequenceIn_ >= 0) { // free variable - always choose } else { theta_ = 1.0e50; // now flip flop between spare arrays until reasonable theta tentativeTheta = CoinMax(10.0 * upperTheta, 1.0e-7); // loops increasing tentative theta until can't go through while (tentativeTheta < 1.0e22) { double thruThis = 0.0; double bestPivot = acceptablePivot; int bestSequence = -1; numberPossiblySwapped = numberColumns_; numberRemaining = 0; upperTheta = 1.0e50; spare = array[iFlip]; index = indices[iFlip]; spare2 = array[1-iFlip]; index2 = indices[1-iFlip]; // try 3 different ways // 1 bias increase by ones with slightly wrong djs // 2 bias by all // 3 bias by all - tolerance #define TRYBIAS 3 double increaseInThis = 0.0; //objective increase in this loop for (i = 0; i < interesting[iFlip]; i++) { int iSequence = index[i]; double alpha = spare[i]; double oldValue = dj_[iSequence]; double value = oldValue - tentativeTheta * alpha; if (alpha < 0.0) { //at upper bound if (value > newTolerance) { double range = upper_[iSequence] - lower_[iSequence]; thruThis -= range * alpha; #if TRYBIAS==1 if (oldValue > 0.0) increaseInThis -= oldValue * range; #elif TRYBIAS==2 increaseInThis -= oldValue * range; #else increaseInThis -= (oldValue + dualTolerance_) * range; #endif // goes on swapped list (also means candidates if too many) spare2[--numberPossiblySwapped] = alpha; index2[numberPossiblySwapped] = iSequence; if (fabs(alpha) > bestPivot) { bestPivot = fabs(alpha); bestSequence = numberPossiblySwapped; } } else { value = oldValue - upperTheta * alpha; if (value > newTolerance && -alpha >= acceptablePivot) upperTheta = (oldValue - newTolerance) / alpha; spare2[numberRemaining] = alpha; index2[numberRemaining++] = iSequence; } } else { // at lower bound if (value < -newTolerance) { double range = upper_[iSequence] - lower_[iSequence]; thruThis += range * alpha; //?? is this correct - and should we look at good ones #if TRYBIAS==1 if (oldValue < 0.0) increaseInThis += oldValue * range; #elif TRYBIAS==2 increaseInThis += oldValue * range; #else increaseInThis += (oldValue - dualTolerance_) * range; #endif // goes on swapped list (also means candidates if too many) spare2[--numberPossiblySwapped] = alpha; index2[numberPossiblySwapped] = iSequence; if (fabs(alpha) > bestPivot) { bestPivot = fabs(alpha); bestSequence = numberPossiblySwapped; } } else { value = oldValue - upperTheta * alpha; if (value < -newTolerance && alpha >= acceptablePivot) upperTheta = (oldValue + newTolerance) / alpha; spare2[numberRemaining] = alpha; index2[numberRemaining++] = iSequence; } } } swapped[1-iFlip] = numberPossiblySwapped; interesting[1-iFlip] = numberRemaining; marker[1-iFlip][0] = CoinMax(marker[1-iFlip][0], numberRemaining); marker[1-iFlip][1] = CoinMin(marker[1-iFlip][1], numberPossiblySwapped); double check = fabs(totalThru+thruThis); // add a bit check += 1.0e-8+1.0e-10*check; if (check >= fabs(dualOut_) || increaseInObjective + increaseInThis < 0.0) { // We should be pivoting in this batch // so compress down to this lot numberRemaining = 0; for (i = numberColumns_ - 1; i >= swapped[1-iFlip]; i--) { spare[numberRemaining] = spare2[i]; index[numberRemaining++] = index2[i]; } interesting[iFlip] = numberRemaining; int iTry; #define MAXTRY 100 // first get ratio with tolerance for (iTry = 0; iTry < MAXTRY; iTry++) { upperTheta = 1.0e50; numberPossiblySwapped = numberColumns_; numberRemaining = 0; increaseInThis = 0.0; //objective increase in this loop thruThis = 0.0; spare = array[iFlip]; index = indices[iFlip]; spare2 = array[1-iFlip]; index2 = indices[1-iFlip]; for (i = 0; i < interesting[iFlip]; i++) { int iSequence = index[i]; double alpha = spare[i]; double oldValue = dj_[iSequence]; double value = oldValue - upperTheta * alpha; if (alpha < 0.0) { //at upper bound if (value > newTolerance) { if (-alpha >= acceptablePivot) { upperTheta = (oldValue - newTolerance) / alpha; } } } else { // at lower bound if (value < -newTolerance) { if (alpha >= acceptablePivot) { upperTheta = (oldValue + newTolerance) / alpha; } } } } bestPivot = acceptablePivot; sequenceIn_ = -1; #ifdef DUBIOUS_WEIGHTS double bestWeight = COIN_DBL_MAX; #endif double largestPivot = acceptablePivot; // now choose largest and sum all ones which will go through //printf("XX it %d number %d\n",numberIterations_,interesting[iFlip]); // Sum of bad small pivots #ifdef MORE_CAREFUL double sumBadPivots = 0.0; badSumPivots = false; #endif // Make sure upperTheta will work (-O2 and above gives problems) upperTheta *= 1.0000000001; for (i = 0; i < interesting[iFlip]; i++) { int iSequence = index[i]; double alpha = spare[i]; double value = dj_[iSequence] - upperTheta * alpha; double badDj = 0.0; bool addToSwapped = false; if (alpha < 0.0) { //at upper bound if (value >= 0.0) { addToSwapped = true; #if TRYBIAS==1 badDj = -CoinMax(dj_[iSequence], 0.0); #elif TRYBIAS==2 badDj = -dj_[iSequence]; #else badDj = -dj_[iSequence] - dualTolerance_; #endif } } else { // at lower bound if (value <= 0.0) { addToSwapped = true; #if TRYBIAS==1 badDj = CoinMin(dj_[iSequence], 0.0); #elif TRYBIAS==2 badDj = dj_[iSequence]; #else badDj = dj_[iSequence] - dualTolerance_; #endif } } if (!addToSwapped) { // add to list of remaining spare2[numberRemaining] = alpha; index2[numberRemaining++] = iSequence; } else { // add to list of swapped spare2[--numberPossiblySwapped] = alpha; index2[numberPossiblySwapped] = iSequence; // select if largest pivot bool take = false; double absAlpha = fabs(alpha); #ifdef DUBIOUS_WEIGHTS // User could do anything to break ties here double weight; if (dubiousWeights) weight = dubiousWeights[iSequence]; else weight = 1.0; weight += randomNumberGenerator_.randomDouble() * 1.0e-2; if (absAlpha > 2.0 * bestPivot) { take = true; } else if (absAlpha > largestPivot) { // could multiply absAlpha and weight if (weight * bestPivot < bestWeight * absAlpha) take = true; } #else if (absAlpha > bestPivot) take = true; #endif #ifdef MORE_CAREFUL if (absAlpha < acceptablePivot && upperTheta < 1.0e20) { if (alpha < 0.0) { //at upper bound if (value > dualTolerance_) { double gap = upper_[iSequence] - lower_[iSequence]; if (gap < 1.0e20) sumBadPivots += value * gap; else sumBadPivots += 1.0e20; //printf("bad %d alpha %g dj at upper %g\n", // iSequence,alpha,value); } } else { //at lower bound if (value < -dualTolerance_) { double gap = upper_[iSequence] - lower_[iSequence]; if (gap < 1.0e20) sumBadPivots -= value * gap; else sumBadPivots += 1.0e20; //printf("bad %d alpha %g dj at lower %g\n", // iSequence,alpha,value); } } } #endif #ifdef FORCE_FOLLOW if (iSequence == force_in) { printf("taking %d - alpha %g best %g\n", force_in, absAlpha, largestPivot); take = true; } #endif if (take) { sequenceIn_ = numberPossiblySwapped; bestPivot = absAlpha; theta_ = dj_[iSequence] / alpha; largestPivot = CoinMax(largestPivot, 0.5 * bestPivot); #ifdef DUBIOUS_WEIGHTS bestWeight = weight; #endif //printf(" taken seq %d alpha %g weight %d\n", // iSequence,absAlpha,dubiousWeights[iSequence]); } else { //printf(" not taken seq %d alpha %g weight %d\n", // iSequence,absAlpha,dubiousWeights[iSequence]); } double range = upper_[iSequence] - lower_[iSequence]; thruThis += range * fabs(alpha); increaseInThis += badDj * range; } } marker[1-iFlip][0] = CoinMax(marker[1-iFlip][0], numberRemaining); marker[1-iFlip][1] = CoinMin(marker[1-iFlip][1], numberPossiblySwapped); #ifdef MORE_CAREFUL // If we have done pivots and things look bad set alpha_ 0.0 to force factorization if (sumBadPivots > 1.0e4) { if (handler_->logLevel() > 1) *handler_ << "maybe forcing re-factorization - sum " << sumBadPivots << " " << factorization_->pivots() << " pivots" << CoinMessageEol; if(factorization_->pivots() > 3) { badSumPivots = true; break; } } #endif swapped[1-iFlip] = numberPossiblySwapped; interesting[1-iFlip] = numberRemaining; // If we stop now this will be increase in objective (I think) double increase = (fabs(dualOut_) - totalThru) * theta_; increase += increaseInObjective; if (theta_ < 0.0) thruThis += fabs(dualOut_); // force using this one if (increaseInObjective < 0.0 && increase < 0.0 && lastSequence >= 0) { // back // We may need to be more careful - we could do by // switch so we always do fine grained? bestPivot = 0.0; } else { // add in totalThru += thruThis; increaseInObjective += increaseInThis; } if (bestPivot < 0.1 * bestEverPivot && bestEverPivot > 1.0e-6 && (bestPivot < 1.0e-3 || totalThru * 2.0 > fabs(dualOut_))) { // back to previous one sequenceIn_ = lastSequence; // swap regions iFlip = 1 - iFlip; break; } else if (sequenceIn_ == -1 && upperTheta > largeValue_) { if (lastPivot > acceptablePivot) { // back to previous one sequenceIn_ = lastSequence; // swap regions iFlip = 1 - iFlip; } else { // can only get here if all pivots too small } break; } else if (totalThru >= fabs(dualOut_)) { modifyCosts = true; // fine grain - we can modify costs break; // no point trying another loop } else { lastSequence = sequenceIn_; if (bestPivot > bestEverPivot) bestEverPivot = bestPivot; iFlip = 1 - iFlip; modifyCosts = true; // fine grain - we can modify costs } } if (iTry == MAXTRY) iFlip = 1 - iFlip; // flip back break; } else { // skip this lot if (bestPivot > 1.0e-3 || bestPivot > bestEverPivot) { bestEverPivot = bestPivot; lastSequence = bestSequence; } else { // keep old swapped CoinMemcpyN(array[iFlip] + swapped[iFlip], numberColumns_ - swapped[iFlip], array[1-iFlip] + swapped[iFlip]); CoinMemcpyN(indices[iFlip] + swapped[iFlip], numberColumns_ - swapped[iFlip], indices[1-iFlip] + swapped[iFlip]); marker[1-iFlip][1] = CoinMin(marker[1-iFlip][1], swapped[iFlip]); swapped[1-iFlip] = swapped[iFlip]; } increaseInObjective += increaseInThis; iFlip = 1 - iFlip; // swap regions tentativeTheta = 2.0 * upperTheta; totalThru += thruThis; } } // can get here without sequenceIn_ set but with lastSequence if (sequenceIn_ < 0 && lastSequence >= 0) { // back to previous one sequenceIn_ = lastSequence; // swap regions iFlip = 1 - iFlip; } #define MINIMUMTHETA 1.0e-18 // Movement should be minimum for anti-degeneracy - unless // fixed variable out double minimumTheta; if (upperOut_ > lowerOut_) minimumTheta = MINIMUMTHETA; else minimumTheta = 0.0; if (sequenceIn_ >= 0) { // at this stage sequenceIn_ is just pointer into index array // flip just so we can use iFlip iFlip = 1 - iFlip; spare = array[iFlip]; index = indices[iFlip]; double oldValue; alpha_ = spare[sequenceIn_]; sequenceIn_ = indices[iFlip][sequenceIn_]; oldValue = dj_[sequenceIn_]; theta_ = CoinMax(oldValue / alpha_, 0.0); if (theta_ < minimumTheta && fabs(alpha_) < 1.0e5 && 1) { // can't pivot to zero #if 0 if (oldValue - minimumTheta*alpha_ >= -dualTolerance_) { theta_ = minimumTheta; } else if (oldValue - minimumTheta*alpha_ >= -newTolerance) { theta_ = minimumTheta; thisIncrease = true; } else { theta_ = CoinMax((oldValue + newTolerance) / alpha_, 0.0); thisIncrease = true; } #else theta_ = minimumTheta; #endif } // may need to adjust costs so all dual feasible AND pivoted is exactly 0 //int costOffset = numberRows_+numberColumns_; if (modifyCosts && !badSumPivots) { int i; for (i = numberColumns_ - 1; i >= swapped[iFlip]; i--) { int iSequence = index[i]; double alpha = spare[i]; double value = dj_[iSequence] - theta_ * alpha; // can't be free here if (alpha < 0.0) { //at upper bound if (value > dualTolerance_) { //thisIncrease = true; #if CLP_CAN_HAVE_ZERO_OBJ<2 #define MODIFYCOST 2 #endif #if MODIFYCOST // modify cost to hit new tolerance double modification = alpha * theta_ - dj_[iSequence] + newTolerance; if ((specialOptions_&(2048 + 4096 + 16384)) != 0) { if ((specialOptions_ & 16384) != 0) { if (fabs(modification) < 1.0e-8) modification = 0.0; } else if ((specialOptions_ & 2048) != 0) { if (fabs(modification) < 1.0e-10) modification = 0.0; } else { if (fabs(modification) < 1.0e-12) modification = 0.0; } } dj_[iSequence] += modification; cost_[iSequence] += modification; if (modification) numberChanged_ ++; // Say changed costs //cost_[iSequence+costOffset] += modification; // save change #endif } } else { // at lower bound if (-value > dualTolerance_) { //thisIncrease = true; #if MODIFYCOST // modify cost to hit new tolerance double modification = alpha * theta_ - dj_[iSequence] - newTolerance; //modification = CoinMax(modification,-dualTolerance_); //assert (fabs(modification)<1.0e-7); if ((specialOptions_&(2048 + 4096)) != 0) { if ((specialOptions_ & 2048) != 0) { if (fabs(modification) < 1.0e-10) modification = 0.0; } else { if (fabs(modification) < 1.0e-12) modification = 0.0; } } dj_[iSequence] += modification; cost_[iSequence] += modification; if (modification) numberChanged_ ++; // Say changed costs //cost_[iSequence+costOffset] += modification; // save change #endif } } } } } } #ifdef MORE_CAREFUL // If we have done pivots and things look bad set alpha_ 0.0 to force factorization if ((badSumPivots || fabs(theta_ * badFree) > 10.0 * dualTolerance_) && factorization_->pivots()) { if (handler_->logLevel() > 1) *handler_ << "forcing re-factorization" << CoinMessageEol; //printf("badSumPivots %g theta_ %g badFree %g\n",badSumPivots,theta_,badFree); sequenceIn_ = -1; acceptablePivot_=-acceptablePivot_; } #endif if (sequenceIn_ >= 0) { lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; valueIn_ = solution_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; if (numberTimesOptimal_) { // can we adjust cost back closer to original //*** add coding } #if MODIFYCOST>1 // modify cost to hit zero exactly // so (dualIn_+modification)==theta_*alpha_ double modification = theta_ * alpha_ - dualIn_; // But should not move objective too much ?? #define DONT_MOVE_OBJECTIVE #ifdef DONT_MOVE_OBJECTIVE double moveObjective = fabs(modification * solution_[sequenceIn_]); double smallMove = CoinMax(fabs(objectiveValue_), 1.0e-3); if (moveObjective > smallMove) { if (handler_->logLevel() > 1) printf("would move objective by %g - original mod %g sol value %g\n", moveObjective, modification, solution_[sequenceIn_]); modification *= smallMove / moveObjective; } #endif if (badSumPivots) modification = 0.0; if ((specialOptions_&(2048 + 4096)) != 0) { if ((specialOptions_ & 16384) != 0) { // in fast dual if (fabs(modification) < 1.0e-7) modification = 0.0; } else if ((specialOptions_ & 2048) != 0) { if (fabs(modification) < 1.0e-10) modification = 0.0; } else { if (fabs(modification) < 1.0e-12) modification = 0.0; } } dualIn_ += modification; dj_[sequenceIn_] = dualIn_; cost_[sequenceIn_] += modification; if (modification) numberChanged_ ++; // Say changed costs //int costOffset = numberRows_+numberColumns_; //cost_[sequenceIn_+costOffset] += modification; // save change //assert (fabs(modification)<1.0e-6); #ifdef CLP_DEBUG if ((handler_->logLevel() & 32) && fabs(modification) > 1.0e-15) printf("exact %d new cost %g, change %g\n", sequenceIn_, cost_[sequenceIn_], modification); #endif #endif if (alpha_ < 0.0) { // as if from upper bound directionIn_ = -1; upperIn_ = valueIn_; } else { // as if from lower bound directionIn_ = 1; lowerIn_ = valueIn_; } } else { // no pivot bestPossible = 0.0; alpha_ = 0.0; } //if (thisIncrease) //dualTolerance_+= 1.0e-6*dblParam_[ClpDualTolerance]; // clear arrays for (i = 0; i < 2; i++) { CoinZeroN(array[i], marker[i][0]); CoinZeroN(array[i] + marker[i][1], numberColumns_ - marker[i][1]); } return bestPossible; } #ifdef CLP_ALL_ONE_FILE #undef MAXTRY #endif /* Checks if tentative optimal actually means unbounded Returns -3 if not, 2 if is unbounded */ int ClpSimplexDual::checkUnbounded(CoinIndexedVector * ray, CoinIndexedVector * spare, double changeCost) { int status = 2; // say unbounded factorization_->updateColumn(spare, ray); // get reduced cost int i; int number = ray->getNumElements(); int * index = ray->getIndices(); double * array = ray->denseVector(); for (i = 0; i < number; i++) { int iRow = index[i]; int iPivot = pivotVariable_[iRow]; changeCost -= cost(iPivot) * array[iRow]; } double way; if (changeCost > 0.0) { //try going down way = 1.0; } else if (changeCost < 0.0) { //try going up way = -1.0; } else { #ifdef CLP_DEBUG printf("can't decide on up or down\n"); #endif way = 0.0; status = -3; } double movement = 1.0e10 * way; // some largish number double zeroTolerance = 1.0e-14 * dualBound_; for (i = 0; i < number; i++) { int iRow = index[i]; int iPivot = pivotVariable_[iRow]; double arrayValue = array[iRow]; if (fabs(arrayValue) < zeroTolerance) arrayValue = 0.0; double newValue = solution(iPivot) + movement * arrayValue; if (newValue > upper(iPivot) + primalTolerance_ || newValue < lower(iPivot) - primalTolerance_) status = -3; // not unbounded } if (status == 2) { // create ray delete [] ray_; ray_ = new double [numberColumns_]; CoinZeroN(ray_, numberColumns_); for (i = 0; i < number; i++) { int iRow = index[i]; int iPivot = pivotVariable_[iRow]; double arrayValue = array[iRow]; if (iPivot < numberColumns_ && fabs(arrayValue) >= zeroTolerance) ray_[iPivot] = way * array[iRow]; } } ray->clear(); return status; } //static int count_status=0; //static double obj_status=0.0; //static int check_status=123456789;//41754; //static int count_alpha=0; /* Checks if finished. Updates status */ void ClpSimplexDual::statusOfProblemInDual(int & lastCleaned, int type, double * givenDuals, ClpDataSave & saveData, int ifValuesPass) { #ifdef CLP_INVESTIGATE_SERIAL if (z_thinks > 0 && z_thinks < 2) z_thinks += 2; #endif bool arraysNotCreated = (type==0); // If lots of iterations then adjust costs if large ones if (numberIterations_ > 4 * (numberRows_ + numberColumns_) && objectiveScale_ == 1.0) { double largest = 0.0; for (int i = 0; i < numberRows_; i++) { int iColumn = pivotVariable_[i]; largest = CoinMax(largest, fabs(cost_[iColumn])); } if (largest > 1.0e6) { objectiveScale_ = 1.0e6 / largest; for (int i = 0; i < numberRows_ + numberColumns_; i++) cost_[i] *= objectiveScale_; } } int numberPivots = factorization_->pivots(); double realDualInfeasibilities = 0.0; if (type == 2) { if (alphaAccuracy_ != -1.0) alphaAccuracy_ = -2.0; // trouble - restore solution CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff int dummy; matrix_->generalExpanded(this, 6, dummy); forceFactorization_ = 1; // a bit drastic but .. changeMade_++; // say something changed // get correct bounds on all variables resetFakeBounds(0); } int tentativeStatus = problemStatus_; double changeCost; bool unflagVariables = true; bool weightsSaved = false; bool weightsSaved2 = numberIterations_ && !numberPrimalInfeasibilities_; int dontFactorizePivots = dontFactorizePivots_; if (type == 3) { type = 1; dontFactorizePivots = 1; } if (alphaAccuracy_ < 0.0 || !numberPivots || alphaAccuracy_ > 1.0e4 || numberPivots > 20) { if (problemStatus_ > -3 || numberPivots > dontFactorizePivots) { // factorize // later on we will need to recover from singularities // also we could skip if first time // save dual weights dualRowPivot_->saveWeights(this, 1); weightsSaved = true; if (type) { // is factorization okay? if (internalFactorize(1)) { // no - restore previous basis unflagVariables = false; assert (type == 1); changeMade_++; // say something changed // Keep any flagged variables int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (flagged(i)) saveStatus_[i] |= 64; //say flagged } CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff int dummy; matrix_->generalExpanded(this, 6, dummy); // get correct bounds on all variables resetFakeBounds(1); // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #ifdef COIN_DEVELOP printf("flag d\n"); #endif setFlagged(sequenceOut_); progress_.clearBadTimes(); // Go to safe factorization_->pivotTolerance(0.99); forceFactorization_ = 1; // a bit drastic but .. type = 2; //assert (internalFactorize(1)==0); if (internalFactorize(1)) { CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff int dummy; matrix_->generalExpanded(this, 6, dummy); // debug int returnCode = internalFactorize(1); while (returnCode) { // ouch // switch off dense int saveDense = factorization_->denseThreshold(); factorization_->setDenseThreshold(0); // Go to safe factorization_->pivotTolerance(0.99); // make sure will do safe factorization pivotVariable_[0] = -1; returnCode = internalFactorize(2); factorization_->setDenseThreshold(saveDense); } // get correct bounds on all variables resetFakeBounds(1); } } } if (problemStatus_ != -4 || numberPivots > 10) problemStatus_ = -3; } } else { //printf("testing with accuracy of %g and status of %d\n",alphaAccuracy_,problemStatus_); //count_alpha++; //if ((count_alpha%5000)==0) //printf("count alpha %d\n",count_alpha); } if(progress_.infeasibility_[0]<1.0e-1 && primalTolerance_==1.0e-7&&progress_.iterationNumber_[0]>0&& progress_.iterationNumber_[CLP_PROGRESS-1]-progress_.iterationNumber_[0]>25) { // default - so user did not set int iP; double minAverage=COIN_DBL_MAX; double maxAverage=0.0; for (iP=0;iP0.1) break; average /= static_cast(n); minAverage=CoinMin(minAverage,average); maxAverage=CoinMax(maxAverage,average); } } if (iP==CLP_PROGRESS&&minAverage<1.0e-5&&maxAverage<1.0e-3) { // change tolerance #if CBC_USEFUL_PRINTING>0 printf("CCchanging tolerance\n"); #endif primalTolerance_=1.0e-6; minimumPrimalTolerance_=primalTolerance_; dblParam_[ClpPrimalTolerance]=1.0e-6; moreSpecialOptions_ |= 4194304; } } // at this stage status is -3 or -4 if looks infeasible // get primal and dual solutions #if 0 { int numberTotal = numberRows_ + numberColumns_; double * saveSol = CoinCopyOfArray(solution_, numberTotal); double * saveDj = CoinCopyOfArray(dj_, numberTotal); double tolerance = type ? 1.0e-4 : 1.0e-8; // always if values pass double saveObj = objectiveValue_; double sumPrimal = sumPrimalInfeasibilities_; int numberPrimal = numberPrimalInfeasibilities_; double sumDual = sumDualInfeasibilities_; int numberDual = numberDualInfeasibilities_; gutsOfSolution(givenDuals, NULL); int j; double largestPrimal = tolerance; int iPrimal = -1; for (j = 0; j < numberTotal; j++) { double difference = solution_[j] - saveSol[j]; if (fabs(difference) > largestPrimal) { iPrimal = j; largestPrimal = fabs(difference); } } double largestDual = tolerance; int iDual = -1; for (j = 0; j < numberTotal; j++) { double difference = dj_[j] - saveDj[j]; if (fabs(difference) > largestDual && upper_[j] > lower_[j]) { iDual = j; largestDual = fabs(difference); } } if (!type) { if (fabs(saveObj - objectiveValue_) > 1.0e-5 || numberPrimal != numberPrimalInfeasibilities_ || numberPrimal != 1 || fabs(sumPrimal - sumPrimalInfeasibilities_) > 1.0e-5 || iPrimal >= 0 || numberDual != numberDualInfeasibilities_ || numberDual != 0 || fabs(sumDual - sumDualInfeasibilities_) > 1.0e-5 || iDual >= 0) printf("type %d its %d pivots %d primal n(%d,%d) s(%g,%g) diff(%g,%d) dual n(%d,%d) s(%g,%g) diff(%g,%d) obj(%g,%g)\n", type, numberIterations_, numberPivots, numberPrimal, numberPrimalInfeasibilities_, sumPrimal, sumPrimalInfeasibilities_, largestPrimal, iPrimal, numberDual, numberDualInfeasibilities_, sumDual, sumDualInfeasibilities_, largestDual, iDual, saveObj, objectiveValue_); } else { if (fabs(saveObj - objectiveValue_) > 1.0e-5 || numberPrimalInfeasibilities_ || iPrimal >= 0 || numberDualInfeasibilities_ || iDual >= 0) printf("type %d its %d pivots %d primal n(%d,%d) s(%g,%g) diff(%g,%d) dual n(%d,%d) s(%g,%g) diff(%g,%d) obj(%g,%g)\n", type, numberIterations_, numberPivots, numberPrimal, numberPrimalInfeasibilities_, sumPrimal, sumPrimalInfeasibilities_, largestPrimal, iPrimal, numberDual, numberDualInfeasibilities_, sumDual, sumDualInfeasibilities_, largestDual, iDual, saveObj, objectiveValue_); } delete [] saveSol; delete [] saveDj; } #else if (type || ifValuesPass) gutsOfSolution(givenDuals, NULL); #endif // If bad accuracy treat as singular if ((largestPrimalError_ > 1.0e15 || largestDualError_ > 1.0e15) && numberIterations_) { // restore previous basis unflagVariables = false; changeMade_++; // say something changed // Keep any flagged variables int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (flagged(i)) saveStatus_[i] |= 64; //say flagged } CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff int dummy; matrix_->generalExpanded(this, 6, dummy); // get correct bounds on all variables resetFakeBounds(1); // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #ifdef COIN_DEVELOP printf("flag e\n"); #endif setFlagged(sequenceOut_); progress_.clearBadTimes(); // Go to safer double newTolerance = CoinMin(1.1 * factorization_->pivotTolerance(), 0.99); factorization_->pivotTolerance(newTolerance); forceFactorization_ = 1; // a bit drastic but .. if (alphaAccuracy_ != -1.0) alphaAccuracy_ = -2.0; type = 2; //assert (internalFactorize(1)==0); if (internalFactorize(1)) { CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff int dummy; matrix_->generalExpanded(this, 6, dummy); // debug int returnCode = internalFactorize(1); while (returnCode) { // ouch // switch off dense int saveDense = factorization_->denseThreshold(); factorization_->setDenseThreshold(0); // Go to safe factorization_->pivotTolerance(0.99); // make sure will do safe factorization pivotVariable_[0] = -1; returnCode = internalFactorize(2); factorization_->setDenseThreshold(saveDense); } // get correct bounds on all variables resetFakeBounds(1); } // get primal and dual solutions gutsOfSolution(givenDuals, NULL); } else if (goodAccuracy()) { // Can reduce tolerance double newTolerance = CoinMax(0.995 * factorization_->pivotTolerance(), saveData.pivotTolerance_); factorization_->pivotTolerance(newTolerance); } bestObjectiveValue_ = CoinMax(bestObjectiveValue_, objectiveValue_ - bestPossibleImprovement_); bool reallyBadProblems = false; // Double check infeasibility if no action if (progress_.lastIterationNumber(0) == numberIterations_) { if (dualRowPivot_->looksOptimal()) { numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } #if 1 } else { double thisObj = objectiveValue_ - bestPossibleImprovement_; #ifdef CLP_INVESTIGATE assert (bestPossibleImprovement_ > -1000.0 && objectiveValue_ > -1.0e100); if (bestPossibleImprovement_) printf("obj %g add in %g -> %g\n", objectiveValue_, bestPossibleImprovement_, thisObj); #endif double lastObj = progress_.lastObjective(0); #ifndef NDEBUG #ifdef COIN_DEVELOP resetFakeBounds(-1); #endif #endif #ifdef CLP_REPORT_PROGRESS ixxxxxx++; if (ixxxxxx >= ixxyyyy - 4 && ixxxxxx <= ixxyyyy) { char temp[20]; sprintf(temp, "sol%d.out", ixxxxxx); printf("sol%d.out\n", ixxxxxx); FILE * fp = fopen(temp, "w"); int nTotal = numberRows_ + numberColumns_; for (int i = 0; i < nTotal; i++) fprintf(fp, "%d %d %g %g %g %g %g\n", i, status_[i], lower_[i], solution_[i], upper_[i], cost_[i], dj_[i]); fclose(fp); } #endif if(!ifValuesPass && firstFree_ < 0) { double testTol = 5.0e-3; if (progress_.timesFlagged() > 10) { testTol *= pow(2.0, progress_.timesFlagged() - 8); } else if (progress_.timesFlagged() > 5) { testTol *= 5.0; } if (lastObj > thisObj + testTol*(fabs(thisObj) + fabs(lastObj)) + testTol) { int maxFactor = factorization_->maximumPivots(); if ((specialOptions_ & 1048576) == 0) { if (progress_.timesFlagged() > 10) progress_.incrementReallyBadTimes(); if (maxFactor > 10 - 9) { #ifdef COIN_DEVELOP printf("lastobj %g thisobj %g\n", lastObj, thisObj); #endif //if (forceFactorization_<0) //forceFactorization_= maxFactor; //forceFactorization_ = CoinMax(1,(forceFactorization_>>1)); if ((progressFlag_ & 4) == 0 && lastObj < thisObj + 1.0e4 && largestPrimalError_ < 1.0e2) { // Just save costs // save extra copy of cost_ int nTotal = numberRows_ + numberColumns_; double * temp = new double [2*nTotal]; memcpy(temp, cost_, nTotal * sizeof(double)); memcpy(temp + nTotal, cost_, nTotal * sizeof(double)); delete [] cost_; cost_ = temp; objectiveWork_ = cost_; rowObjectiveWork_ = cost_ + numberColumns_; progressFlag_ |= 4; } else { forceFactorization_ = 1; #ifdef COIN_DEVELOP printf("Reducing factorization frequency - bad backwards\n"); #endif #if 1 unflagVariables = false; changeMade_++; // say something changed int nTotal = numberRows_ + numberColumns_; CoinMemcpyN(saveStatus_, nTotal, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); if ((progressFlag_ & 4) == 0) { // save extra copy of cost_ double * temp = new double [2*nTotal]; memcpy(temp, cost_, nTotal * sizeof(double)); memcpy(temp + nTotal, cost_, nTotal * sizeof(double)); delete [] cost_; cost_ = temp; objectiveWork_ = cost_; rowObjectiveWork_ = cost_ + numberColumns_; progressFlag_ |= 4; } else { memcpy(cost_, cost_ + nTotal, nTotal * sizeof(double)); } // restore extra stuff int dummy; matrix_->generalExpanded(this, 6, dummy); double pivotTolerance = factorization_->pivotTolerance(); if(pivotTolerance < 0.2) factorization_->pivotTolerance(0.2); else if(progress_.timesFlagged() > 2) factorization_->pivotTolerance(CoinMin(pivotTolerance * 1.1, 0.99)); if (alphaAccuracy_ != -1.0) alphaAccuracy_ = -2.0; if (internalFactorize(1)) { CoinMemcpyN(saveStatus_, numberColumns_ + numberRows_, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff int dummy; matrix_->generalExpanded(this, 6, dummy); // debug int returnCode = internalFactorize(1); while (returnCode) { // ouch // switch off dense int saveDense = factorization_->denseThreshold(); factorization_->setDenseThreshold(0); // Go to safe factorization_->pivotTolerance(0.99); // make sure will do safe factorization pivotVariable_[0] = -1; returnCode = internalFactorize(2); factorization_->setDenseThreshold(saveDense); } } resetFakeBounds(0); type = 2; // so will restore weights // get primal and dual solutions gutsOfSolution(givenDuals, NULL); if (numberPivots < 2) { // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; #ifdef COIN_DEVELOP printf("flag d\n"); #endif setFlagged(sequenceOut_); progress_.clearBadTimes(); progress_.incrementTimesFlagged(); } if (numberPivots < 10) reallyBadProblems = true; #ifdef COIN_DEVELOP printf("obj now %g\n", objectiveValue_); #endif progress_.modifyObjective(objectiveValue_ - bestPossibleImprovement_); #endif } } } else { // in fast dual give up #ifdef COIN_DEVELOP printf("In fast dual?\n"); #endif problemStatus_ = 3; } } else if (lastObj < thisObj - 1.0e-5 * CoinMax(fabs(thisObj), fabs(lastObj)) - 1.0e-3) { numberTimesOptimal_ = 0; } } #endif } // Up tolerance if looks a bit odd if (numberIterations_ > CoinMax(1000, numberRows_ >> 4) && (specialOptions_ & 64) != 0) { if (sumPrimalInfeasibilities_ && sumPrimalInfeasibilities_ < 1.0e5) { int backIteration = progress_.lastIterationNumber(CLP_PROGRESS - 1); if (backIteration > 0 && numberIterations_ - backIteration < 9 * CLP_PROGRESS) { if (factorization_->pivotTolerance() < 0.9) { // up tolerance factorization_->pivotTolerance(CoinMin(factorization_->pivotTolerance() * 1.05 + 0.02, 0.91)); //printf("tol now %g\n",factorization_->pivotTolerance()); progress_.clearIterationNumbers(); } } } } // Check if looping int loop; if (!givenDuals && type != 2) loop = progress_.looping(); else loop = -1; if (progress_.reallyBadTimes() > 10) { problemStatus_ = 10; // instead - try other algorithm #if COIN_DEVELOP>2 printf("returning at %d\n", __LINE__); #endif } int situationChanged = 0; if (loop >= 0) { problemStatus_ = loop; //exit if in loop if (!problemStatus_) { // declaring victory numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } else { problemStatus_ = 10; // instead - try other algorithm #if COIN_DEVELOP>2 printf("returning at %d\n", __LINE__); #endif } return; } else if (loop < -1) { // something may have changed gutsOfSolution(NULL, NULL); situationChanged = 1; } // really for free variables in if((progressFlag_ & 2) != 0) { situationChanged = 2; } progressFlag_ &= (~3); //reset progress flag if ((progressFlag_ & 4) != 0) { // save copy of cost_ int nTotal = numberRows_ + numberColumns_; memcpy(cost_ + nTotal, cost_, nTotal * sizeof(double)); } /*if (!numberIterations_&&sumDualInfeasibilities_) printf("OBJ %g sumPinf %g sumDinf %g\n", objectiveValue(),sumPrimalInfeasibilities_, sumDualInfeasibilities_);*/ // mark as having gone optimal if looks like it if (!numberPrimalInfeasibilities_&& !numberDualInfeasibilities_) progressFlag_ |= 8; if (handler_->detail(CLP_SIMPLEX_STATUS, messages_) < 100) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } #if 0 count_status++; if (!numberIterations_) obj_status=-1.0e30; if (objectiveValue()=check_status-1) { printf("Trouble ahead - count_status %d\n",count_status); } #endif #if 0 printf("IT %d %g %g(%d) %g(%d)\n", numberIterations_, objectiveValue(), sumPrimalInfeasibilities_, numberPrimalInfeasibilities_, sumDualInfeasibilities_, numberDualInfeasibilities_); #endif double approximateObjective = objectiveValue_; #ifdef CLP_REPORT_PROGRESS if (ixxxxxx >= ixxyyyy - 4 && ixxxxxx <= ixxyyyy) { char temp[20]; sprintf(temp, "x_sol%d.out", ixxxxxx); FILE * fp = fopen(temp, "w"); int nTotal = numberRows_ + numberColumns_; for (int i = 0; i < nTotal; i++) fprintf(fp, "%d %d %g %g %g %g %g\n", i, status_[i], lower_[i], solution_[i], upper_[i], cost_[i], dj_[i]); fclose(fp); if (ixxxxxx == ixxyyyy) exit(6); } #endif realDualInfeasibilities = sumDualInfeasibilities_; double saveTolerance = dualTolerance_; // If we need to carry on cleaning variables if (!numberPrimalInfeasibilities_ && (specialOptions_ & 1024) != 0 && CLEAN_FIXED) { for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (!flagged(iPivot) && pivoted(iPivot)) { // carry on numberPrimalInfeasibilities_ = -1; sumOfRelaxedPrimalInfeasibilities_ = 1.0; sumPrimalInfeasibilities_ = 1.0; break; } } } /* If we are primal feasible and any dual infeasibilities are on free variables then it is better to go to primal */ if (!numberPrimalInfeasibilities_ && ((!numberDualInfeasibilitiesWithoutFree_ && numberDualInfeasibilities_)|| (moreSpecialOptions_&2097152)!=0)) problemStatus_ = 10; // dual bound coming in //double saveDualBound = dualBound_; bool needCleanFake = false; while (problemStatus_ <= -3) { int cleanDuals = 0; if (situationChanged != 0) cleanDuals = 1; int numberChangedBounds = 0; int doOriginalTolerance = 0; if ( lastCleaned == numberIterations_) doOriginalTolerance = 1; // check optimal // give code benefit of doubt if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0) { // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } //if (dualFeasible()||problemStatus_==-4||(primalFeasible()&&!numberDualInfeasibilitiesWithoutFree_)) { if (dualFeasible() || problemStatus_ == -4) { progress_.modifyObjective(objectiveValue_ - bestPossibleImprovement_); #ifdef COIN_DEVELOP if (sumDualInfeasibilities_ || bestPossibleImprovement_) printf("improve %g dualinf %g -> %g\n", bestPossibleImprovement_, sumDualInfeasibilities_, sumDualInfeasibilities_ * dualBound_); #endif // see if cutoff reached double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); #if 0 if(fabs(limit) < 1.0e30 && objectiveValue()*optimizationDirection_ > limit + 1.0e-7 + 1.0e-8 * fabs(limit) && !numberAtFakeBound()) { //looks infeasible on objective if (perturbation_ == 101) { cleanDuals = 1; // Save costs int numberTotal = numberRows_ + numberColumns_; double * saveCost = CoinCopyOfArray(cost_, numberTotal); // make sure fake bounds are back changeBounds(1, NULL, changeCost); createRim4(false); // make sure duals are current computeDuals(givenDuals); checkDualSolution(); if(objectiveValue()*optimizationDirection_ > limit + 1.0e-7 + 1.0e-8 * fabs(limit) && !numberDualInfeasibilities_) { perturbation_ = 102; // stop any perturbations printf("cutoff test succeeded\n"); } else { printf("cutoff test failed\n"); // put back memcpy(cost_, saveCost, numberTotal * sizeof(double)); // make sure duals are current computeDuals(givenDuals); checkDualSolution(); progress_.modifyObjective(-COIN_DBL_MAX); problemStatus_ = -1; } delete [] saveCost; } } #endif if (primalFeasible() && !givenDuals) { // may be optimal - or may be bounds are wrong handler_->message(CLP_DUAL_BOUNDS, messages_) << dualBound_ << CoinMessageEol; // save solution in case unbounded double * saveColumnSolution = NULL; double * saveRowSolution = NULL; bool inCbc = (specialOptions_ & (0x01000000 | 16384)) != 0; if (!inCbc) { saveColumnSolution = CoinCopyOfArray(columnActivityWork_, numberColumns_); saveRowSolution = CoinCopyOfArray(rowActivityWork_, numberRows_); } numberChangedBounds = changeBounds(0, rowArray_[3], changeCost); if (numberChangedBounds <= 0 && !numberDualInfeasibilities_) { //looks optimal - do we need to reset tolerance if (perturbation_ == 101) { perturbation_ = 102; // stop any perturbations cleanDuals = 1; // make sure fake bounds are back //computeObjectiveValue(); changeBounds(1, NULL, changeCost); //computeObjectiveValue(); createRim4(false); // make sure duals are current computeDuals(givenDuals); checkDualSolution(); progress_.modifyObjective(-COIN_DBL_MAX); #define DUAL_TRY_FASTER #ifdef DUAL_TRY_FASTER if (numberDualInfeasibilities_) { #endif numberChanged_ = 1; // force something to happen lastCleaned = numberIterations_ - 1; #ifdef DUAL_TRY_FASTER } else { //double value = objectiveValue_; computeObjectiveValue(true); //printf("old %g new %g\n",value,objectiveValue_); //numberChanged_=1; } #endif } if (lastCleaned < numberIterations_ && numberTimesOptimal_ < 4 && (numberChanged_ || (specialOptions_ & 4096) == 0)) { #if CLP_CAN_HAVE_ZERO_OBJ if ((specialOptions_&2097152)==0) { #endif doOriginalTolerance = 2; numberTimesOptimal_++; changeMade_++; // say something changed if (numberTimesOptimal_ == 1) { dualTolerance_ = dblParam_[ClpDualTolerance]; } else { if (numberTimesOptimal_ == 2) { // better to have small tolerance even if slower factorization_->zeroTolerance(CoinMin(factorization_->zeroTolerance(), 1.0e-15)); } dualTolerance_ = dblParam_[ClpDualTolerance]; dualTolerance_ *= pow(2.0, numberTimesOptimal_ - 1); } cleanDuals = 2; // If nothing changed optimal else primal #if CLP_CAN_HAVE_ZERO_OBJ } else { // no cost - skip checks problemStatus_=0; } #endif } else { problemStatus_ = 0; // optimal if (lastCleaned < numberIterations_ && numberChanged_) { handler_->message(CLP_SIMPLEX_GIVINGUP, messages_) << CoinMessageEol; } } } else { cleanDuals = 1; if (doOriginalTolerance == 1) { // check unbounded // find a variable with bad dj int iSequence; int iChosen = -1; if (!inCbc) { double largest = 100.0 * primalTolerance_; for (iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { double djValue = dj_[iSequence]; double originalLo = originalLower(iSequence); double originalUp = originalUpper(iSequence); if (fabs(djValue) > fabs(largest)) { if (getStatus(iSequence) != basic) { if (djValue > 0 && originalLo < -1.0e20) { if (djValue > fabs(largest)) { largest = djValue; iChosen = iSequence; } } else if (djValue < 0 && originalUp > 1.0e20) { if (-djValue > fabs(largest)) { largest = djValue; iChosen = iSequence; } } } } } } if (iChosen >= 0) { int iSave = sequenceIn_; sequenceIn_ = iChosen; unpack(rowArray_[1]); sequenceIn_ = iSave; // if dual infeasibilities then must be free vector so add in dual if (numberDualInfeasibilities_) { if (fabs(changeCost) > 1.0e-5) COIN_DETAIL_PRINT(printf("Odd free/unbounded combo\n")); changeCost += cost_[iChosen]; } problemStatus_ = checkUnbounded(rowArray_[1], rowArray_[0], changeCost); rowArray_[1]->clear(); } else { problemStatus_ = -3; } if (problemStatus_ == 2 && perturbation_ == 101) { perturbation_ = 102; // stop any perturbations cleanDuals = 1; createRim4(false); progress_.modifyObjective(-COIN_DBL_MAX); problemStatus_ = -1; } if (problemStatus_ == 2) { // it is unbounded - restore solution // but first add in changes to non-basic int iColumn; double * original = columnArray_[0]->denseVector(); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if(getColumnStatus(iColumn) != basic) ray_[iColumn] += saveColumnSolution[iColumn] - original[iColumn]; columnActivityWork_[iColumn] = original[iColumn]; } CoinMemcpyN(saveRowSolution, numberRows_, rowActivityWork_); } } else { doOriginalTolerance = 2; rowArray_[0]->clear(); } } delete [] saveColumnSolution; delete [] saveRowSolution; } if (problemStatus_ == -4 || problemStatus_ == -5) { // may be infeasible - or may be bounds are wrong numberChangedBounds = changeBounds(0, NULL, changeCost); needCleanFake = true; /* Should this be here as makes no difference to being feasible. But seems to make a difference to run times. */ if (perturbation_ == 101 && 0) { perturbation_ = 102; // stop any perturbations cleanDuals = 1; numberChangedBounds = 1; // make sure fake bounds are back changeBounds(1, NULL, changeCost); needCleanFake = true; createRim4(false); progress_.modifyObjective(-COIN_DBL_MAX); } if ((numberChangedBounds <= 0 || dualBound_ > 1.0e20 || (largestPrimalError_ > 1.0 && dualBound_ > 1.0e17)) && (numberPivots < 4 || sumPrimalInfeasibilities_ > 1.0e-6)) { problemStatus_ = 1; // infeasible if (perturbation_ == 101) { perturbation_ = 102; // stop any perturbations //cleanDuals=1; //numberChangedBounds=1; //createRim4(false); } // but double check if (!numberPrimalInfeasibilities_) { problemStatus_=-1; doOriginalTolerance=2; } } else { problemStatus_ = -1; //iterate cleanDuals = 1; if (numberChangedBounds <= 0) doOriginalTolerance = 2; // and delete ray which has been created delete [] ray_; ray_ = NULL; } } } else { cleanDuals = 1; } if (problemStatus_ < 0) { if (doOriginalTolerance == 2) { // put back original tolerance lastCleaned = numberIterations_; numberChanged_ = 0; // Number of variables with changed costs handler_->message(CLP_DUAL_ORIGINAL, messages_) << CoinMessageEol; perturbation_ = 102; // stop any perturbations #if 0 double * xcost = new double[numberRows_+numberColumns_]; double * xlower = new double[numberRows_+numberColumns_]; double * xupper = new double[numberRows_+numberColumns_]; double * xdj = new double[numberRows_+numberColumns_]; double * xsolution = new double[numberRows_+numberColumns_]; CoinMemcpyN(cost_, (numberRows_ + numberColumns_), xcost); CoinMemcpyN(lower_, (numberRows_ + numberColumns_), xlower); CoinMemcpyN(upper_, (numberRows_ + numberColumns_), xupper); CoinMemcpyN(dj_, (numberRows_ + numberColumns_), xdj); CoinMemcpyN(solution_, (numberRows_ + numberColumns_), xsolution); #endif createRim4(false); progress_.modifyObjective(-COIN_DBL_MAX); // make sure duals are current computeDuals(givenDuals); checkDualSolution(); #if 0 int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (cost_[i] != xcost[i]) printf("** %d old cost %g new %g sol %g\n", i, xcost[i], cost_[i], solution_[i]); if (lower_[i] != xlower[i]) printf("** %d old lower %g new %g sol %g\n", i, xlower[i], lower_[i], solution_[i]); if (upper_[i] != xupper[i]) printf("** %d old upper %g new %g sol %g\n", i, xupper[i], upper_[i], solution_[i]); if (dj_[i] != xdj[i]) printf("** %d old dj %g new %g sol %g\n", i, xdj[i], dj_[i], solution_[i]); if (solution_[i] != xsolution[i]) printf("** %d old solution %g new %g sol %g\n", i, xsolution[i], solution_[i], solution_[i]); } //delete [] xcost; //delete [] xupper; //delete [] xlower; //delete [] xdj; //delete [] xsolution; #endif // put back bounds as they were if was optimal if (doOriginalTolerance == 2 && cleanDuals != 2) { changeMade_++; // say something changed /* We may have already changed some bounds in this function so save numberFake_ and add in. Worst that can happen is that we waste a bit of time - but it must be finite. */ //int saveNumberFake = numberFake_; //resetFakeBounds(-1); changeBounds(3, NULL, changeCost); needCleanFake = true; //numberFake_ += saveNumberFake; //resetFakeBounds(-1); cleanDuals = 2; //cleanDuals=1; } #if 0 //int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (cost_[i] != xcost[i]) printf("** %d old cost %g new %g sol %g\n", i, xcost[i], cost_[i], solution_[i]); if (lower_[i] != xlower[i]) printf("** %d old lower %g new %g sol %g\n", i, xlower[i], lower_[i], solution_[i]); if (upper_[i] != xupper[i]) printf("** %d old upper %g new %g sol %g\n", i, xupper[i], upper_[i], solution_[i]); if (dj_[i] != xdj[i]) printf("** %d old dj %g new %g sol %g\n", i, xdj[i], dj_[i], solution_[i]); if (solution_[i] != xsolution[i]) printf("** %d old solution %g new %g sol %g\n", i, xsolution[i], solution_[i], solution_[i]); } delete [] xcost; delete [] xupper; delete [] xlower; delete [] xdj; delete [] xsolution; #endif } if (cleanDuals == 1 || (cleanDuals == 2 && !numberDualInfeasibilities_)) { // make sure dual feasible // look at all rows and columns rowArray_[0]->clear(); columnArray_[0]->clear(); double objectiveChange = 0.0; double savePrimalInfeasibilities = sumPrimalInfeasibilities_; if (!numberIterations_) { int nTotal = numberRows_ + numberColumns_; if (arraysNotCreated) { // create save arrays delete [] saveStatus_; delete [] savedSolution_; saveStatus_ = new unsigned char [nTotal]; savedSolution_ = new double [nTotal]; arraysNotCreated = false; } // save arrays CoinMemcpyN(status_, nTotal, saveStatus_); CoinMemcpyN(rowActivityWork_, numberRows_, savedSolution_ + numberColumns_); CoinMemcpyN(columnActivityWork_, numberColumns_, savedSolution_); } #if 0 double * xcost = new double[numberRows_+numberColumns_]; double * xlower = new double[numberRows_+numberColumns_]; double * xupper = new double[numberRows_+numberColumns_]; double * xdj = new double[numberRows_+numberColumns_]; double * xsolution = new double[numberRows_+numberColumns_]; CoinMemcpyN(cost_, (numberRows_ + numberColumns_), xcost); CoinMemcpyN(lower_, (numberRows_ + numberColumns_), xlower); CoinMemcpyN(upper_, (numberRows_ + numberColumns_), xupper); CoinMemcpyN(dj_, (numberRows_ + numberColumns_), xdj); CoinMemcpyN(solution_, (numberRows_ + numberColumns_), xsolution); #endif if (givenDuals) dualTolerance_ = 1.0e50; #if CLP_CAN_HAVE_ZERO_OBJ>1 if ((specialOptions_&2097152)==0) { #endif updateDualsInDual(rowArray_[0], columnArray_[0], rowArray_[1], 0.0, objectiveChange, true); #if CLP_CAN_HAVE_ZERO_OBJ>1 } else { rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); } #endif dualTolerance_ = saveTolerance; #if 0 int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (cost_[i] != xcost[i]) printf("** %d old cost %g new %g sol %g\n", i, xcost[i], cost_[i], solution_[i]); if (lower_[i] != xlower[i]) printf("** %d old lower %g new %g sol %g\n", i, xlower[i], lower_[i], solution_[i]); if (upper_[i] != xupper[i]) printf("** %d old upper %g new %g sol %g\n", i, xupper[i], upper_[i], solution_[i]); if (dj_[i] != xdj[i]) printf("** %d old dj %g new %g sol %g\n", i, xdj[i], dj_[i], solution_[i]); if (solution_[i] != xsolution[i]) printf("** %d old solution %g new %g sol %g\n", i, xsolution[i], solution_[i], solution_[i]); } delete [] xcost; delete [] xupper; delete [] xlower; delete [] xdj; delete [] xsolution; #endif // for now - recompute all gutsOfSolution(NULL, NULL); if (givenDuals) dualTolerance_ = 1.0e50; #if CLP_CAN_HAVE_ZERO_OBJ>1 if ((specialOptions_&2097152)==0) { #endif updateDualsInDual(rowArray_[0], columnArray_[0], rowArray_[1], 0.0, objectiveChange, true); #if CLP_CAN_HAVE_ZERO_OBJ>1 } else { rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); } #endif dualTolerance_ = saveTolerance; if (!numberIterations_ && sumPrimalInfeasibilities_ > 1.0e5*(savePrimalInfeasibilities+1.0e3) && (moreSpecialOptions_ & (256|8192)) == 0) { // Use primal int nTotal = numberRows_ + numberColumns_; CoinMemcpyN(saveStatus_, nTotal, status_); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); problemStatus_ = 10; situationChanged = 0; } //assert(numberDualInfeasibilitiesWithoutFree_==0); if (numberDualInfeasibilities_) { if ((numberPrimalInfeasibilities_ || numberPivots) && problemStatus_!=10) { problemStatus_ = -1; // carry on as normal } else { problemStatus_ = 10; // try primal #if COIN_DEVELOP>1 printf("returning at %d\n", __LINE__); #endif } } else if (situationChanged == 2) { problemStatus_ = -1; // carry on as normal // need to reset bounds changeBounds(3, NULL, changeCost); } situationChanged = 0; } else { // iterate if (cleanDuals != 2) { problemStatus_ = -1; } else { problemStatus_ = 10; // try primal #if COIN_DEVELOP>2 printf("returning at %d\n", __LINE__); #endif } } } } // unflag all variables (we may want to wait a bit?) if ((tentativeStatus != -2 && tentativeStatus != -1) && unflagVariables) { int iRow; int numberFlagged = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (flagged(iPivot)) { numberFlagged++; clearFlagged(iPivot); } } #ifdef COIN_DEVELOP if (numberFlagged) { printf("unflagging %d variables - tentativeStatus %d probStat %d ninf %d nopt %d\n", numberFlagged, tentativeStatus, problemStatus_, numberPrimalInfeasibilities_, numberTimesOptimal_); } #endif unflagVariables = numberFlagged > 0; if (numberFlagged && !numberPivots) { /* looks like trouble as we have not done any iterations. Try changing pivot tolerance then give it a few goes and give up */ if (factorization_->pivotTolerance() < 0.9) { factorization_->pivotTolerance(0.99); problemStatus_ = -1; } else if (numberTimesOptimal_ < 3) { numberTimesOptimal_++; problemStatus_ = -1; } else { unflagVariables = false; //secondaryStatus_ = 1; // and say probably infeasible if ((moreSpecialOptions_ & 256) == 0) { // try primal problemStatus_ = 10; } else { // almost certainly infeasible problemStatus_ = 1; } #if COIN_DEVELOP>1 printf("returning at %d\n", __LINE__); #endif } } } if (problemStatus_ < 0) { if (needCleanFake) { double dummyChangeCost = 0.0; changeBounds(3, NULL, dummyChangeCost); } #if 0 if (objectiveValue_ < lastObjectiveValue_ - 1.0e-8 * CoinMax(fabs(objectivevalue_), fabs(lastObjectiveValue_))) { } else { lastObjectiveValue_ = objectiveValue_; } #endif if (type == 0 || type == 1) { if (!type && arraysNotCreated) { // create save arrays delete [] saveStatus_; delete [] savedSolution_; saveStatus_ = new unsigned char [numberRows_+numberColumns_]; savedSolution_ = new double [numberRows_+numberColumns_]; } // save arrays CoinMemcpyN(status_, numberColumns_ + numberRows_, saveStatus_); CoinMemcpyN(rowActivityWork_, numberRows_, savedSolution_ + numberColumns_); CoinMemcpyN(columnActivityWork_, numberColumns_, savedSolution_); // save extra stuff int dummy; matrix_->generalExpanded(this, 5, dummy); } if (weightsSaved) { // restore weights (if saved) - also recompute infeasibility list if (!reallyBadProblems && (largestPrimalError_ < 100.0 || numberPivots > 10)) { if (tentativeStatus > -3) dualRowPivot_->saveWeights(this, (type < 2) ? 2 : 4); else dualRowPivot_->saveWeights(this, 3); } else { // reset weights or scale back dualRowPivot_->saveWeights(this, 6); } } else if (weightsSaved2 && numberPrimalInfeasibilities_) { dualRowPivot_->saveWeights(this, 3); } } // see if cutoff reached double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); #if 0 if(fabs(limit) < 1.0e30 && objectiveValue()*optimizationDirection_ > limit + 100.0) { printf("lim %g obj %g %g - wo perturb %g sum dual %g\n", limit, objectiveValue_, objectiveValue(), computeInternalObjectiveValue(), sumDualInfeasibilities_); } #endif if(fabs(limit) < 1.0e30 && objectiveValue()*optimizationDirection_ > limit && !numberAtFakeBound()) { bool looksInfeasible = !numberDualInfeasibilities_; if (objectiveValue()*optimizationDirection_ > limit + fabs(0.1 * limit) + 1.0e2 * sumDualInfeasibilities_ + 1.0e4 && sumDualInfeasibilities_ < largestDualError_ && numberIterations_ > 0.5 * numberRows_ + 1000) looksInfeasible = true; if (looksInfeasible) { // Even if not perturbed internal costs may have changed // be careful if (true || numberIterations_) { if(computeInternalObjectiveValue() > limit) { problemStatus_ = 1; secondaryStatus_ = 1; // and say was on cutoff } } else { problemStatus_ = 1; secondaryStatus_ = 1; // and say was on cutoff } } } // If we are in trouble and in branch and bound give up if ((specialOptions_ & 1024) != 0) { int looksBad = 0; if (largestPrimalError_ * largestDualError_ > 1.0e2) { looksBad = 1; } else if (largestPrimalError_ > 1.0e-2 && objectiveValue_ > CoinMin(1.0e15, 1.0e3 * limit)) { looksBad = 2; } if (looksBad) { if (factorization_->pivotTolerance() < 0.9) { // up tolerance factorization_->pivotTolerance(CoinMin(factorization_->pivotTolerance() * 1.05 + 0.02, 0.91)); } else if (numberIterations_ > 10000) { if (handler_->logLevel() > 2) printf("bad dual - saying infeasible %d\n", looksBad); problemStatus_ = 1; secondaryStatus_ = 1; // and say was on cutoff } else if (largestPrimalError_ > 1.0e5) { { //int iBigB = -1; double bigB = 0.0; //int iBigN = -1; double bigN = 0.0; for (int i = 0; i < numberRows_ + numberColumns_; i++) { double value = fabs(solution_[i]); if (getStatus(i) == basic) { if (value > bigB) { bigB = value; //iBigB = i; } } else { if (value > bigN) { bigN = value; //iBigN = i; } } } #ifdef CLP_INVESTIGATE if (bigB > 1.0e8 || bigN > 1.0e8) { if (handler_->logLevel() > 0) printf("it %d - basic %d %g, nonbasic %d %g\n", numberIterations_, iBigB, bigB, iBigN, bigN); } #endif } #if COIN_DEVELOP!=2 if (handler_->logLevel() > 2) #endif printf("bad dual - going to primal %d %g\n", looksBad, largestPrimalError_); allSlackBasis(true); problemStatus_ = 10; } } } if (problemStatus_ < 0 && !changeMade_) { problemStatus_ = 4; // unknown } lastGoodIteration_ = numberIterations_; if (numberIterations_ > lastBadIteration_ + 100) moreSpecialOptions_ &= ~16; // clear check accuracy flag if (problemStatus_ < 0) { sumDualInfeasibilities_ = realDualInfeasibilities; // back to say be careful if (sumDualInfeasibilities_) numberDualInfeasibilities_ = 1; } #ifdef CLP_REPORT_PROGRESS if (ixxxxxx > ixxyyyy - 3) { printf("objectiveValue_ %g\n", objectiveValue_); handler_->setLogLevel(63); int nTotal = numberColumns_ + numberRows_; double newObj = 0.0; for (int i = 0; i < nTotal; i++) { if (solution_[i]) newObj += solution_[i] * cost_[i]; } printf("xxx obj %g\n", newObj); // for now - recompute all gutsOfSolution(NULL, NULL); newObj = 0.0; for (int i = 0; i < nTotal; i++) { if (solution_[i]) newObj += solution_[i] * cost_[i]; } printf("yyy obj %g %g\n", newObj, objectiveValue_); progress_.modifyObjective(objectiveValue_ - bestPossibleImprovement_); } #endif #if 1 double thisObj = progress_.lastObjective(0); double lastObj = progress_.lastObjective(1); if (lastObj > thisObj + 1.0e-4 * CoinMax(fabs(thisObj), fabs(lastObj)) + 1.0e-4 && givenDuals == NULL && firstFree_ < 0) { int maxFactor = factorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ >> 1)); //printf("Reducing factorization frequency\n"); } } #endif // Allow matrices to be sorted etc int fake = -999; // signal sort matrix_->correctSequence(this, fake, fake); if (alphaAccuracy_ > 0.0) alphaAccuracy_ = 1.0; // If we are stopping - use plausible objective // Maybe only in fast dual if (problemStatus_ > 2) objectiveValue_ = approximateObjective; if (problemStatus_ == 1 && (progressFlag_&8) != 0 && fabs(objectiveValue_) > 1.0e10 ) problemStatus_ = 10; // infeasible - but has looked feasible } /* While updateDualsInDual sees what effect is of flip this does actual flipping. If change >0.0 then value in array >0.0 => from lower to upper */ void ClpSimplexDual::flipBounds(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray) { int number; int * which; int iSection; for (iSection = 0; iSection < 2; iSection++) { int i; double * solution = solutionRegion(iSection); double * lower = lowerRegion(iSection); double * upper = upperRegion(iSection); int addSequence; if (!iSection) { number = rowArray->getNumElements(); which = rowArray->getIndices(); addSequence = numberColumns_; } else { number = columnArray->getNumElements(); which = columnArray->getIndices(); addSequence = 0; } for (i = 0; i < number; i++) { int iSequence = which[i]; Status status = getStatus(iSequence + addSequence); switch(status) { case basic: case isFree: case superBasic: case ClpSimplex::isFixed: break; case atUpperBound: // to lower bound setStatus(iSequence + addSequence, atLowerBound); solution[iSequence] = lower[iSequence]; break; case atLowerBound: // to upper bound setStatus(iSequence + addSequence, atUpperBound); solution[iSequence] = upper[iSequence]; break; } } } rowArray->setNumElements(0); columnArray->setNumElements(0); } // Restores bound to original bound void ClpSimplexDual::originalBound( int iSequence) { if (getFakeBound(iSequence) != noFake) { numberFake_--;; setFakeBound(iSequence, noFake); if (iSequence >= numberColumns_) { // rows int iRow = iSequence - numberColumns_; rowLowerWork_[iRow] = rowLower_[iRow]; rowUpperWork_[iRow] = rowUpper_[iRow]; if (rowScale_) { if (rowLowerWork_[iRow] > -1.0e50) rowLowerWork_[iRow] *= rowScale_[iRow] * rhsScale_; if (rowUpperWork_[iRow] < 1.0e50) rowUpperWork_[iRow] *= rowScale_[iRow] * rhsScale_; } else if (rhsScale_ != 1.0) { if (rowLowerWork_[iRow] > -1.0e50) rowLowerWork_[iRow] *= rhsScale_; if (rowUpperWork_[iRow] < 1.0e50) rowUpperWork_[iRow] *= rhsScale_; } } else { // columns columnLowerWork_[iSequence] = columnLower_[iSequence]; columnUpperWork_[iSequence] = columnUpper_[iSequence]; if (rowScale_) { double multiplier = 1.0 * inverseColumnScale_[iSequence]; if (columnLowerWork_[iSequence] > -1.0e50) columnLowerWork_[iSequence] *= multiplier * rhsScale_; if (columnUpperWork_[iSequence] < 1.0e50) columnUpperWork_[iSequence] *= multiplier * rhsScale_; } else if (rhsScale_ != 1.0) { if (columnLowerWork_[iSequence] > -1.0e50) columnLowerWork_[iSequence] *= rhsScale_; if (columnUpperWork_[iSequence] < 1.0e50) columnUpperWork_[iSequence] *= rhsScale_; } } } } /* As changeBounds but just changes new bounds for a single variable. Returns true if change */ bool ClpSimplexDual::changeBound( int iSequence) { // old values double oldLower = lower_[iSequence]; double oldUpper = upper_[iSequence]; double value = solution_[iSequence]; bool modified = false; originalBound(iSequence); // original values double lowerValue = lower_[iSequence]; double upperValue = upper_[iSequence]; // back to altered values lower_[iSequence] = oldLower; upper_[iSequence] = oldUpper; assert (getFakeBound(iSequence) == noFake); //if (getFakeBound(iSequence)!=noFake) //numberFake_--;; if (value == oldLower) { if (upperValue > oldLower + dualBound_) { upper_[iSequence] = oldLower + dualBound_; setFakeBound(iSequence, upperFake); modified = true; numberFake_++; } } else if (value == oldUpper) { if (lowerValue < oldUpper - dualBound_) { lower_[iSequence] = oldUpper - dualBound_; setFakeBound(iSequence, lowerFake); modified = true; numberFake_++; } } else { assert(value == oldLower || value == oldUpper); } return modified; } #if ABC_NORMAL_DEBUG>0 //#define PERT_STATISTICS #endif #ifdef PERT_STATISTICS static void breakdown(const char * name, int numberLook, const double * region) { double range[] = { -COIN_DBL_MAX, -1.0e15, -1.0e11, -1.0e8, -1.0e5, -1.0e4, -1.0e3, -1.0e2, -1.0e1, -1.0, -1.0e-1, -1.0e-2, -1.0e-3, -1.0e-4, -1.0e-5, -1.0e-8, -1.0e-11, -1.0e-15, 0.0, 1.0e-15, 1.0e-11, 1.0e-8, 1.0e-5, 1.0e-4, 1.0e-3, 1.0e-2, 1.0e-1, 1.0, 1.0e1, 1.0e2, 1.0e3, 1.0e4, 1.0e5, 1.0e8, 1.0e11, 1.0e15, COIN_DBL_MAX }; int nRanges = static_cast (sizeof(range) / sizeof(double)); int * number = new int[nRanges]; memset(number, 0, nRanges * sizeof(int)); int * numberExact = new int[nRanges]; memset(numberExact, 0, nRanges * sizeof(int)); int i; for ( i = 0; i < numberLook; i++) { double value = region[i]; for (int j = 0; j < nRanges; j++) { if (value == range[j]) { numberExact[j]++; break; } else if (value < range[j]) { number[j]++; break; } } } printf("\n%s has %d entries\n", name, numberLook); for (i = 0; i < nRanges; i++) { if (number[i]) printf("%d between %g and %g", number[i], range[i-1], range[i]); if (numberExact[i]) { if (number[i]) printf(", "); printf("%d exactly at %g", numberExact[i], range[i]); } if (number[i] + numberExact[i]) printf("\n"); } delete [] number; delete [] numberExact; } #endif // Perturbs problem int ClpSimplexDual::perturb() { if (perturbation_ > 100) return 0; //perturbed already if (perturbation_ == 100) perturbation_ = 50; // treat as normal int savePerturbation = perturbation_; bool modifyRowCosts = false; // dual perturbation double perturbation = 1.0e-20; // maximum fraction of cost to perturb double maximumFraction = 1.0e-5; double constantPerturbation = 100.0 * dualTolerance_; int maxLength = 0; int minLength = numberRows_; double averageCost = 0.0; #if 0 // look at element range double smallestNegative; double largestNegative; double smallestPositive; double largestPositive; matrix_->rangeOfElements(smallestNegative, largestNegative, smallestPositive, largestPositive); smallestPositive = CoinMin(fabs(smallestNegative), smallestPositive); largestPositive = CoinMax(fabs(largestNegative), largestPositive); double elementRatio = largestPositive / smallestPositive; #endif int numberNonZero = 0; if (!numberIterations_ && perturbation_ >= 50) { // See if we need to perturb double * sort = new double[numberColumns_]; // Use objective BEFORE scaling const double * obj = ((moreSpecialOptions_ & 128) == 0) ? objective() : cost_; int i; for (i = 0; i < numberColumns_; i++) { double value = fabs(obj[i]); sort[i] = value; averageCost += value; if (value) numberNonZero++; } if (numberNonZero) averageCost /= static_cast (numberNonZero); else averageCost = 1.0; std::sort(sort, sort + numberColumns_); int number = 1; double last = sort[0]; for (i = 1; i < numberColumns_; i++) { if (last != sort[i]) number++; last = sort[i]; } delete [] sort; if (!numberNonZero && perturbation_ < 55) return 1; // safer to use primal #if 0 printf("nnz %d percent %d", number, (number * 100) / numberColumns_); if (number * 4 > numberColumns_) printf(" - Would not perturb\n"); else printf(" - Would perturb\n"); //exit(0); #endif //printf("ratio number diff costs %g, element ratio %g\n",((double)number)/((double) numberColumns_), // elementRatio); //number=0; //if (number*4>numberColumns_||elementRatio>1.0e12) { if (number * 4 > numberColumns_) { perturbation_ = 100; return 0; // good enough } } int iColumn; const int * columnLength = matrix_->getVectorLengths(); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnLowerWork_[iColumn] < columnUpperWork_[iColumn]) { int length = columnLength[iColumn]; if (length > 2) { maxLength = CoinMax(maxLength, length); minLength = CoinMin(minLength, length); } } } // If > 70 then do rows if (perturbation_ >= 70) { modifyRowCosts = true; perturbation_ -= 20; printf("Row costs modified, "); } bool uniformChange = false; bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; if (perturbation_ > 50) { // Experiment // maximumFraction could be 1.0e-10 to 1.0 double m[] = {1.0e-10, 1.0e-9, 1.0e-8, 1.0e-7, 1.0e-6, 1.0e-5, 1.0e-4, 1.0e-3, 1.0e-2, 1.0e-1, 1.0}; int whichOne = perturbation_ - 51; //if (inCbcOrOther&&whichOne>0) //whichOne--; maximumFraction = m[CoinMin(whichOne, 10)]; } else if (inCbcOrOther) { //maximumFraction = 1.0e-6; } int iRow; double smallestNonZero = 1.0e100; numberNonZero = 0; if (perturbation_ >= 50) { perturbation = 1.0e-8; if (perturbation_ > 50 && perturbation_ < 60) perturbation = CoinMax(1.0e-8,maximumFraction); bool allSame = true; double lastValue = 0.0; for (iRow = 0; iRow < numberRows_; iRow++) { double lo = rowLowerWork_[iRow]; double up = rowUpperWork_[iRow]; if (lo < up) { double value = fabs(rowObjectiveWork_[iRow]); perturbation = CoinMax(perturbation, value); if (value) { modifyRowCosts = true; smallestNonZero = CoinMin(smallestNonZero, value); } } if (lo && lo > -1.0e10) { numberNonZero++; lo = fabs(lo); if (!lastValue) lastValue = lo; else if (fabs(lo - lastValue) > 1.0e-7) allSame = false; } if (up && up < 1.0e10) { numberNonZero++; up = fabs(up); if (!lastValue) lastValue = up; else if (fabs(up - lastValue) > 1.0e-7) allSame = false; } } double lastValue2 = 0.0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double lo = columnLowerWork_[iColumn]; double up = columnUpperWork_[iColumn]; if (lo < up) { double value = fabs(objectiveWork_[iColumn]); perturbation = CoinMax(perturbation, value); if (value) { smallestNonZero = CoinMin(smallestNonZero, value); } } if (lo && lo > -1.0e10) { //numberNonZero++; lo = fabs(lo); if (!lastValue2) lastValue2 = lo; else if (fabs(lo - lastValue2) > 1.0e-7) allSame = false; } if (up && up < 1.0e10) { //numberNonZero++; up = fabs(up); if (!lastValue2) lastValue2 = up; else if (fabs(up - lastValue2) > 1.0e-7) allSame = false; } } if (allSame) { // Check elements double smallestNegative; double largestNegative; double smallestPositive; double largestPositive; matrix_->rangeOfElements(smallestNegative, largestNegative, smallestPositive, largestPositive); if (smallestNegative == largestNegative && smallestPositive == largestPositive) { // Really hit perturbation double adjust = CoinMin(100.0 * maximumFraction, 1.0e-3 * CoinMax(lastValue, lastValue2)); maximumFraction = CoinMax(adjust, maximumFraction); } } perturbation = CoinMin(perturbation, smallestNonZero / maximumFraction); } else { // user is in charge maximumFraction = 1.0e-1; // but some experiments if (perturbation_ <= -900) { modifyRowCosts = true; perturbation_ += 1000; printf("Row costs modified, "); } if (perturbation_ <= -10) { perturbation_ += 10; maximumFraction = 1.0; if ((-perturbation_) % 100 >= 10) { uniformChange = true; perturbation_ += 20; } while (perturbation_ < -10) { perturbation_ += 100; maximumFraction *= 1.0e-1; } } perturbation = pow(10.0, perturbation_); } double largestZero = 0.0; double largest = 0.0; double largestPerCent = 0.0; // modify costs bool printOut = (handler_->logLevel() == 63); printOut = false; //assert (!modifyRowCosts); modifyRowCosts = false; if (modifyRowCosts) { for (iRow = 0; iRow < numberRows_; iRow++) { if (rowLowerWork_[iRow] < rowUpperWork_[iRow]) { double value = perturbation; double currentValue = rowObjectiveWork_[iRow]; value = CoinMin(value, maximumFraction * (fabs(currentValue) + 1.0e-1 * perturbation + 1.0e-3)); if (rowLowerWork_[iRow] > -largeValue_) { if (fabs(rowLowerWork_[iRow]) < fabs(rowUpperWork_[iRow])) value *= randomNumberGenerator_.randomDouble(); else value *= -randomNumberGenerator_.randomDouble(); } else if (rowUpperWork_[iRow] < largeValue_) { value *= -randomNumberGenerator_.randomDouble(); } else { value = 0.0; } if (currentValue) { largest = CoinMax(largest, fabs(value)); if (fabs(value) > fabs(currentValue)*largestPerCent) largestPerCent = fabs(value / currentValue); } else { largestZero = CoinMax(largestZero, fabs(value)); } if (printOut) printf("row %d cost %g change %g\n", iRow, rowObjectiveWork_[iRow], value); rowObjectiveWork_[iRow] += value; } } } // more its but faster double weight[]={1.0e-4,1.0e-2,1.0e-1,1.0,2.0,10.0,100.0,200.0,400.0,600.0,1000.0}; // good its double weight[]={1.0e-4,1.0e-2,5.0e-1,1.0,2.0,5.0,10.0,20.0,30.0,40.0,100.0}; double weight[] = {1.0e-4, 1.0e-2, 5.0e-1, 1.0, 2.0, 5.0, 10.0, 20.0, 30.0, 40.0, 100.0}; //double weight[]={1.0e-4,1.0e-2,5.0e-1,1.0,20.0,50.0,100.0,120.0,130.0,140.0,200.0}; //double extraWeight = 10.0; // Scale back if wanted double weight2[] = {1.0e-4, 1.0e-2, 5.0e-1, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}; if (constantPerturbation < 99.0 * dualTolerance_) { perturbation *= 0.1; //extraWeight = 0.5; memcpy(weight, weight2, sizeof(weight2)); } // adjust weights if all columns long double factor = 1.0; if (maxLength) { factor = 3.0 / static_cast (minLength); } // Make variables with more elements more expensive const double m1 = 0.5; double smallestAllowed = CoinMin(1.0e-2 * dualTolerance_, maximumFraction); double largestAllowed = CoinMax(1.0e3 * dualTolerance_, maximumFraction * averageCost); // smaller if in BAB //if (inCbcOrOther) //largestAllowed=CoinMin(largestAllowed,1.0e-5); //smallestAllowed = CoinMin(smallestAllowed,0.1*largestAllowed); #define SAVE_PERT #ifdef SAVE_PERT if (2 * numberColumns_ > maximumPerturbationSize_) { delete [] perturbationArray_; maximumPerturbationSize_ = 2 * numberColumns_; perturbationArray_ = new double [maximumPerturbationSize_]; for (iColumn = 0; iColumn < maximumPerturbationSize_; iColumn++) { perturbationArray_[iColumn] = randomNumberGenerator_.randomDouble(); } } #endif for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnLowerWork_[iColumn] < columnUpperWork_[iColumn] && getStatus(iColumn) != basic) { double value = perturbation; double currentValue = objectiveWork_[iColumn]; value = CoinMin(value, constantPerturbation + maximumFraction * (fabs(currentValue) + 1.0e-1 * perturbation + 1.0e-8)); //value = CoinMin(value,constantPerturbation;+maximumFraction*fabs(currentValue)); double value2 = constantPerturbation + 1.0e-1 * smallestNonZero; if (uniformChange) { value = maximumFraction; value2 = maximumFraction; } if (columnLowerWork_[iColumn] > -largeValue_) { if (fabs(columnLowerWork_[iColumn]) < fabs(columnUpperWork_[iColumn])) { #ifndef SAVE_PERT value *= (1.0 - m1 + m1 * randomNumberGenerator_.randomDouble()); value2 *= (1.0 - m1 + m1 * randomNumberGenerator_.randomDouble()); #else value *= (1.0 - m1 + m1 * perturbationArray_[2*iColumn]); value2 *= (1.0 - m1 + m1 * perturbationArray_[2*iColumn+1]); #endif } else { //value *= -(1.0-m1+m1*randomNumberGenerator_.randomDouble()); //value2 *= -(1.0-m1+m1*randomNumberGenerator_.randomDouble()); value = 0.0; } } else if (columnUpperWork_[iColumn] < largeValue_) { #ifndef SAVE_PERT value *= -(1.0 - m1 + m1 * randomNumberGenerator_.randomDouble()); value2 *= -(1.0 - m1 + m1 * randomNumberGenerator_.randomDouble()); #else value *= -(1.0 - m1 + m1 * perturbationArray_[2*iColumn]); value2 *= -(1.0 - m1 + m1 * perturbationArray_[2*iColumn+1]); #endif } else { value = 0.0; } if (value) { int length = columnLength[iColumn]; if (length > 3) { length = static_cast (static_cast (length) * factor); length = CoinMax(3, length); } double multiplier; #if 1 if (length < 10) multiplier = weight[length]; else multiplier = weight[10]; #else if (length < 10) multiplier = weight[length]; else multiplier = weight[10] + extraWeight * (length - 10); multiplier *= 0.5; #endif value *= multiplier; value = CoinMin(value, value2); if (savePerturbation < 50 || savePerturbation > 60) { if (fabs(value) <= dualTolerance_) value = 0.0; } else if (value) { // get in range if (fabs(value) <= smallestAllowed) { value *= 10.0; while (fabs(value) <= smallestAllowed) value *= 10.0; } else if (fabs(value) > largestAllowed) { value *= 0.1; while (fabs(value) > largestAllowed) value *= 0.1; } } if (currentValue) { largest = CoinMax(largest, fabs(value)); if (fabs(value) > fabs(currentValue)*largestPerCent) largestPerCent = fabs(value / currentValue); } else { largestZero = CoinMax(largestZero, fabs(value)); } // but negative if at ub if (getStatus(iColumn) == atUpperBound) value = -value; if (printOut) printf("col %d cost %g change %g\n", iColumn, objectiveWork_[iColumn], value); objectiveWork_[iColumn] += value; } } } if (largestZero>1.0*largest&&largest) { //printf("largest zero perturbation of %g too big (nonzero %g)\n", // largestZero,largest); largestZero = 0.0; const double * obj = objective(); double test=CoinMax(1.0e-8,largest); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (!obj[iColumn]) { double cost = cost_[iColumn]; while (fabs(cost)>test) cost *= 0.5; cost_[iColumn] = cost; largestZero=CoinMax(largestZero,fabs(cost)); } } } handler_->message(CLP_SIMPLEX_PERTURB, messages_) << 100.0 * maximumFraction << perturbation << largest << 100.0 * largestPerCent << largestZero << CoinMessageEol; // and zero changes //int nTotal = numberRows_+numberColumns_; //CoinZeroN(cost_+nTotal,nTotal); // say perturbed #ifdef PERT_STATISTICS { double averageCost = 0.0; int numberNonZero = 0; double * COIN_RESTRICT sort = new double[numberColumns_]; for (int i = 0; i < numberColumns_; i++) { double value = fabs(cost_[i]); sort[i] = value; averageCost += value; if (value) numberNonZero++; } if (numberNonZero) averageCost /= static_cast (numberNonZero); else averageCost = 1.0; std::sort(sort, sort + numberColumns_); int number = 1; double last = sort[0]; for (int i = 1; i < numberColumns_; i++) { if (last != sort[i]) number++; last = sort[i]; } printf("nnz %d percent %d", number, (number * 100) / numberColumns_); delete [] sort; breakdown("Objective", numberColumns_+numberRows_, cost_); } #endif perturbation_ = 101; return 0; } /* For strong branching. On input lower and upper are new bounds while on output they are change in objective function values (>1.0e50 infeasible). Return code is 0 if nothing interesting, -1 if infeasible both ways and +1 if infeasible one way (check values to see which one(s)) Returns -2 if bad factorization */ int ClpSimplexDual::strongBranching(int numberVariables, const int * variables, double * newLower, double * newUpper, double ** outputSolution, int * outputStatus, int * outputIterations, bool stopOnFirstInfeasible, bool alwaysFinish, int startFinishOptions) { int i; int returnCode = 0; double saveObjectiveValue = objectiveValue_; algorithm_ = -1; //scaling(false); // put in standard form (and make row copy) // create modifiable copies of model rim and do optional scaling createRim(7 + 8 + 16 + 32, true, startFinishOptions); // change newLower and newUpper if scaled // Do initial factorization // and set certain stuff // We can either set increasing rows so ...IsBasic gives pivot row // or we can just increment iBasic one by one // for now let ...iBasic give pivot row int useFactorization = false; if ((startFinishOptions & 2) != 0 && (whatsChanged_&(2 + 512)) == 2 + 512) useFactorization = true; // Keep factorization if possible // switch off factorization if bad if (pivotVariable_[0] < 0) useFactorization = false; if (!useFactorization || factorization_->numberRows() != numberRows_) { useFactorization = false; factorization_->setDefaultValues(); int factorizationStatus = internalFactorize(0); if (factorizationStatus < 0) { // some error // we should either debug or ignore #ifndef NDEBUG printf("***** ClpDual strong branching factorization error - debug\n"); #endif return -2; } else if (factorizationStatus && factorizationStatus <= numberRows_) { handler_->message(CLP_SINGULARITIES, messages_) << factorizationStatus << CoinMessageEol; } } // save stuff ClpFactorization saveFactorization(*factorization_); // Get fake bounds correctly double changeCost; changeBounds(3, NULL, changeCost); int saveNumberFake = numberFake_; // save basis and solution double * saveSolution = new double[numberRows_+numberColumns_]; CoinMemcpyN(solution_, numberRows_ + numberColumns_, saveSolution); unsigned char * saveStatus = new unsigned char [numberRows_+numberColumns_]; CoinMemcpyN(status_, numberColumns_ + numberRows_, saveStatus); // save bounds as createRim makes clean copies double * saveLower = new double[numberRows_+numberColumns_]; CoinMemcpyN(lower_, numberRows_ + numberColumns_, saveLower); double * saveUpper = new double[numberRows_+numberColumns_]; CoinMemcpyN(upper_, numberRows_ + numberColumns_, saveUpper); double * saveObjective = new double[numberRows_+numberColumns_]; CoinMemcpyN(cost_, numberRows_ + numberColumns_, saveObjective); int * savePivot = new int [numberRows_]; CoinMemcpyN(pivotVariable_, numberRows_, savePivot); // need to save/restore weights. int iSolution = 0; for (i = 0; i < numberVariables; i++) { int iColumn = variables[i]; double objectiveChange; double saveBound; // try down saveBound = columnUpper_[iColumn]; // external view - in case really getting optimal columnUpper_[iColumn] = newUpper[i]; assert (inverseColumnScale_ || scalingFlag_ <= 0); if (scalingFlag_ <= 0) upper_[iColumn] = newUpper[i] * rhsScale_; else upper_[iColumn] = (newUpper[i] * inverseColumnScale_[iColumn]) * rhsScale_; // scale // Start of fast iterations int status = fastDual(alwaysFinish); CoinAssert (problemStatus_ || objectiveValue_ < 1.0e50); #ifdef CLP_DEBUG printf("first status %d obj %g\n",problemStatus_,objectiveValue_); #endif if(problemStatus_==10) problemStatus_=3; // make sure plausible double obj = CoinMax(objectiveValue_, saveObjectiveValue); if (status && problemStatus_ != 3) { // not finished - might be optimal checkPrimalSolution(rowActivityWork_, columnActivityWork_); double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if (!numberPrimalInfeasibilities_ && obj < limit) { problemStatus_ = 0; } status = problemStatus_; } if (problemStatus_ == 3) status = 2; if (status || (problemStatus_ == 0 && !isDualObjectiveLimitReached())) { objectiveChange = obj - saveObjectiveValue; } else { objectiveChange = 1.0e100; status = 1; } if (outputSolution) { if (scalingFlag_ <= 0) { CoinMemcpyN(solution_, numberColumns_, outputSolution[iSolution]); } else { int j; double * sol = outputSolution[iSolution]; for (j = 0; j < numberColumns_; j++) sol[j] = solution_[j] * columnScale_[j]; } } outputStatus[iSolution] = status; outputIterations[iSolution] = numberIterations_; iSolution++; // restore numberFake_ = saveNumberFake; CoinMemcpyN(saveSolution, numberRows_ + numberColumns_, solution_); CoinMemcpyN(saveStatus, numberColumns_ + numberRows_, status_); CoinMemcpyN(saveLower, numberRows_ + numberColumns_, lower_); CoinMemcpyN(saveUpper, numberRows_ + numberColumns_, upper_); CoinMemcpyN(saveObjective, numberRows_ + numberColumns_, cost_); columnUpper_[iColumn] = saveBound; CoinMemcpyN(savePivot, numberRows_, pivotVariable_); //delete factorization_; //factorization_ = new ClpFactorization(saveFactorization,numberRows_); setFactorization(saveFactorization); newUpper[i] = objectiveChange; #ifdef CLP_DEBUG printf("down on %d costs %g\n", iColumn, objectiveChange); #endif // try up saveBound = columnLower_[iColumn]; // external view - in case really getting optimal columnLower_[iColumn] = newLower[i]; assert (inverseColumnScale_ || scalingFlag_ <= 0); if (scalingFlag_ <= 0) lower_[iColumn] = newLower[i] * rhsScale_; else lower_[iColumn] = (newLower[i] * inverseColumnScale_[iColumn]) * rhsScale_; // scale // Start of fast iterations status = fastDual(alwaysFinish); CoinAssert (problemStatus_||objectiveValue_<1.0e50); #ifdef CLP_DEBUG printf("second status %d obj %g\n",problemStatus_,objectiveValue_); #endif if(problemStatus_==10) problemStatus_=3; // make sure plausible obj = CoinMax(objectiveValue_, saveObjectiveValue); if (status && problemStatus_ != 3) { // not finished - might be optimal checkPrimalSolution(rowActivityWork_, columnActivityWork_); double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if (!numberPrimalInfeasibilities_ && obj < limit) { problemStatus_ = 0; } status = problemStatus_; } if (problemStatus_ == 3) status = 2; if (status || (problemStatus_ == 0 && !isDualObjectiveLimitReached())) { objectiveChange = obj - saveObjectiveValue; } else { objectiveChange = 1.0e100; status = 1; } if (outputSolution) { if (scalingFlag_ <= 0) { CoinMemcpyN(solution_, numberColumns_, outputSolution[iSolution]); } else { int j; double * sol = outputSolution[iSolution]; for (j = 0; j < numberColumns_; j++) sol[j] = solution_[j] * columnScale_[j]; } } outputStatus[iSolution] = status; outputIterations[iSolution] = numberIterations_; iSolution++; // restore numberFake_ = saveNumberFake; CoinMemcpyN(saveSolution, numberRows_ + numberColumns_, solution_); CoinMemcpyN(saveStatus, numberColumns_ + numberRows_, status_); CoinMemcpyN(saveLower, numberRows_ + numberColumns_, lower_); CoinMemcpyN(saveUpper, numberRows_ + numberColumns_, upper_); CoinMemcpyN(saveObjective, numberRows_ + numberColumns_, cost_); columnLower_[iColumn] = saveBound; CoinMemcpyN(savePivot, numberRows_, pivotVariable_); //delete factorization_; //factorization_ = new ClpFactorization(saveFactorization,numberRows_); setFactorization(saveFactorization); newLower[i] = objectiveChange; #ifdef CLP_DEBUG printf("up on %d costs %g\n", iColumn, objectiveChange); #endif /* Possibilities are: Both sides feasible - store Neither side feasible - set objective high and exit if desired One side feasible - change bounds and resolve */ if (newUpper[i] < 1.0e100) { if(newLower[i] < 1.0e100) { // feasible - no action } else { // up feasible, down infeasible returnCode = 1; if (stopOnFirstInfeasible) break; } } else { if(newLower[i] < 1.0e100) { // down feasible, up infeasible returnCode = 1; if (stopOnFirstInfeasible) break; } else { // neither side feasible returnCode = -1; break; } } } delete [] saveSolution; delete [] saveLower; delete [] saveUpper; delete [] saveObjective; delete [] saveStatus; delete [] savePivot; if ((startFinishOptions & 1) == 0) { deleteRim(1); whatsChanged_ &= ~0xffff; } else { // Original factorization will have been put back by last loop //delete factorization_; //factorization_ = new ClpFactorization(saveFactorization); deleteRim(0); // mark all as current whatsChanged_ = 0x3ffffff; } objectiveValue_ = saveObjectiveValue; return returnCode; } // treat no pivot as finished (unless interesting) int ClpSimplexDual::fastDual(bool alwaysFinish) { progressFlag_ = 0; bestObjectiveValue_ = objectiveValue_; algorithm_ = -1; secondaryStatus_ = 0; // Say in fast dual if (!alwaysFinish) specialOptions_ |= 1048576; specialOptions_ |= 16384; int saveDont = dontFactorizePivots_; if ((specialOptions_ & 2048) == 0) dontFactorizePivots_ = 0; else if(!dontFactorizePivots_) dontFactorizePivots_ = 20; //handler_->setLogLevel(63); // save data ClpDataSave data = saveData(); dualTolerance_ = dblParam_[ClpDualTolerance]; primalTolerance_ = dblParam_[ClpPrimalTolerance]; // save dual bound double saveDualBound = dualBound_; // Start can skip some things in transposeTimes specialOptions_ |= 131072; if (alphaAccuracy_ != -1.0) alphaAccuracy_ = 1.0; // for dual we will change bounds using dualBound_ // for this we need clean basis so it is after factorize #if 0 { int numberTotal = numberRows_ + numberColumns_; double * saveSol = CoinCopyOfArray(solution_, numberTotal); double * saveDj = CoinCopyOfArray(dj_, numberTotal); double tolerance = 1.0e-8; gutsOfSolution(NULL, NULL); int j; double largestPrimal = tolerance; int iPrimal = -1; for (j = 0; j < numberTotal; j++) { double difference = solution_[j] - saveSol[j]; if (fabs(difference) > largestPrimal) { iPrimal = j; largestPrimal = fabs(difference); } } double largestDual = tolerance; int iDual = -1; for (j = 0; j < numberTotal; j++) { double difference = dj_[j] - saveDj[j]; if (fabs(difference) > largestDual && upper_[j] > lower_[j]) { iDual = j; largestDual = fabs(difference); } } if (iPrimal >= 0 || iDual >= 0) printf("pivots %d primal diff(%g,%d) dual diff(%g,%d)\n", factorization_->pivots(), largestPrimal, iPrimal, largestDual, iDual); delete [] saveSol; delete [] saveDj; } #else if ((specialOptions_ & 524288) == 0) gutsOfSolution(NULL, NULL); #endif #if 0 if (numberPrimalInfeasibilities_ != 1 || numberDualInfeasibilities_) printf("dual %g (%d) primal %g (%d)\n", sumDualInfeasibilities_, numberDualInfeasibilities_, sumPrimalInfeasibilities_, numberPrimalInfeasibilities_); #endif #ifndef NDEBUG #ifdef COIN_DEVELOP resetFakeBounds(-1); #endif #endif //numberFake_ =0; // Number of variables at fake bounds numberChanged_ = 0; // Number of variables with changed costs //changeBounds(1,NULL,objectiveChange); problemStatus_ = -1; numberIterations_ = 0; if ((specialOptions_ & 524288) == 0) { factorization_->sparseThreshold(0); factorization_->goSparse(); } int lastCleaned = 0; // last time objective or bounds cleaned up // number of times we have declared optimality numberTimesOptimal_ = 0; // This says whether to restore things etc int factorType = 0; /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible BUT also from whileIterating return code is: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations */ int returnCode = 0; int iRow, iColumn; int maxPass = maximumIterations(); while (problemStatus_ < 0) { // clear for (iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // give matrix (and model costs and bounds a chance to be // refreshed (normally null) matrix_->refresh(this); // If getting nowhere - why not give it a kick // does not seem to work too well - do some more work if ((specialOptions_ & 524288) != 0 && (moreSpecialOptions_&2048) == 0 && perturbation_ < 101 && numberIterations_ > 2 * (numberRows_ + numberColumns_) && (moreSpecialOptions_&1048576)==0) { perturb(); // Can't get here if values pass gutsOfSolution(NULL, NULL); if (handler_->logLevel() > 2) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } } // may factorize, checks if problem finished // should be able to speed this up on first time statusOfProblemInDual(lastCleaned, factorType, NULL, data, 0); // Say good factorization factorType = 1; maxPass--; if (maxPass < -10) { // odd returnCode = 1; problemStatus_ = 3; // can't say anything interesting - might as well return #ifdef CLP_DEBUG printf("returning from fastDual after %d iterations with code %d because of loop\n", numberIterations_, returnCode); #endif break; } // Do iterations if (problemStatus_ < 0) { double * givenPi = NULL; returnCode = whileIterating(givenPi, 0); if ((!alwaysFinish && returnCode < 0) || returnCode == 3) { if (returnCode != 3) assert (problemStatus_ < 0); returnCode = 1; problemStatus_ = 3; // can't say anything interesting - might as well return #ifdef CLP_DEBUG printf("returning from fastDual after %d iterations with code %d\n", numberIterations_, returnCode); #endif break; } if (returnCode == -2) factorType = 3; returnCode = 0; } } // slows down slightly - but more accurate if (factorization_->pivots()) computeDuals(NULL); // clear for (iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // Say not in fast dual specialOptions_ &= ~(16384 | 1048576); assert(!numberFake_ || ((specialOptions_&(2048 | 4096)) != 0 && dualBound_ >= 1.0e8) || returnCode || problemStatus_); // all bounds should be okay if (numberFake_ > 0 && false) { // Set back double dummy; changeBounds(2, NULL, dummy); } // Restore any saved stuff restoreData(data); dontFactorizePivots_ = saveDont; dualBound_ = saveDualBound; // Stop can skip some things in transposeTimes specialOptions_ &= ~131072; if (!problemStatus_) { // see if cutoff reached double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if(fabs(limit) < 1.0e30 && objectiveValue()*optimizationDirection_ > limit + 1.0e-7 + 1.0e-8 * fabs(limit)) { // actually infeasible on objective problemStatus_ = 1; secondaryStatus_ = 1; } } if (problemStatus_ == 3) objectiveValue_ = CoinMax(bestObjectiveValue_, objectiveValue_ - bestPossibleImprovement_); return returnCode; } // This does first part of StrongBranching ClpFactorization * ClpSimplexDual::setupForStrongBranching(char * arrays, int numberRows, int numberColumns, bool solveLp) { if (solveLp) { // make sure won't create fake objective int saveOptions = specialOptions_; specialOptions_ |= 16384; // solve int saveMaximumIterations = intParam_[ClpMaxNumIteration]; intParam_[ClpMaxNumIteration] = 100+numberRows_+numberColumns_; dual(0, 7); if (problemStatus_ == 10) { ClpSimplex::dual(0, 0); //if (problemStatus_) //printf("second go in hot start %d iterations - status %d\n", // numberIterations_,problemStatus_); assert (problemStatus_ != 10); if (problemStatus_ == 0) { dual(0, 7); #if 0 if (problemStatus_) { printf("third go in hot start %d iterations - status %d\n", numberIterations_,problemStatus_); //ClpSimplex::dual(0, 7); //printf("fourth go (part 1) in hot start %d iterations - status %d\n", // numberIterations_,problemStatus_); } #endif #if 0 if (problemStatus_==10 && rowScale_) { ClpSimplex::dual(0, 0); printf("fourth go (part 1) in hot start %d iterations - status %d\n", numberIterations_,problemStatus_); scaling(0); dual(0, 7); printf("fourth go (part 2) in hot start %d iterations - status %d\n", numberIterations_,problemStatus_); //assert (problemStatus_!=10); } #endif } } intParam_[ClpMaxNumIteration] = saveMaximumIterations; specialOptions_ = saveOptions; if (problemStatus_ != 0 /*&& problemStatus_ != 10*/) return NULL; // say infeasible or odd // May be empty solveLp = (solution_ != NULL && problemStatus_ == 0); } problemStatus_ = 0; if (!solveLp) { algorithm_ = -1; // put in standard form (and make row copy) // create modifiable copies of model rim and do optional scaling int startFinishOptions; if((specialOptions_ & 4096) == 0) { startFinishOptions = 0; } else { startFinishOptions = 1 + 2 + 4; } createRim(7 + 8 + 16 + 32, true, startFinishOptions); // Do initial factorization // and set certain stuff // We can either set increasing rows so ...IsBasic gives pivot row // or we can just increment iBasic one by one // for now let ...iBasic give pivot row bool useFactorization = false; if ((startFinishOptions & 2) != 0 && (whatsChanged_&(2 + 512)) == 2 + 512) { useFactorization = true; // Keep factorization if possible // switch off factorization if bad if (pivotVariable_[0] < 0 || factorization_->numberRows() != numberRows_) useFactorization = false; } if (!useFactorization) { factorization_->setDefaultValues(); int factorizationStatus = internalFactorize(0); if (factorizationStatus < 0) { // some error // we should either debug or ignore #ifndef NDEBUG printf("***** ClpDual strong branching factorization error - debug\n"); #endif } else if (factorizationStatus && factorizationStatus <= numberRows_) { handler_->message(CLP_SINGULARITIES, messages_) << factorizationStatus << CoinMessageEol; } } } // Get fake bounds correctly double dummyChangeCost; changeBounds(3, NULL, dummyChangeCost); double * arrayD = reinterpret_cast (arrays); arrayD[0] = objectiveValue() * optimizationDirection_; double * saveSolution = arrayD + 1; double * saveLower = saveSolution + (numberRows + numberColumns); double * saveUpper = saveLower + (numberRows + numberColumns); double * saveObjective = saveUpper + (numberRows + numberColumns); double * saveLowerOriginal = saveObjective + (numberRows + numberColumns); double * saveUpperOriginal = saveLowerOriginal + numberColumns; arrayD = saveUpperOriginal + numberColumns; int * savePivot = reinterpret_cast (arrayD); int * whichRow = savePivot + numberRows; int * whichColumn = whichRow + 3 * numberRows; int * arrayI = whichColumn + 2 * numberColumns; unsigned char * saveStatus = reinterpret_cast (arrayI + 1); // save stuff // save basis and solution CoinMemcpyN(solution_, numberRows_ + numberColumns_, saveSolution); CoinMemcpyN(status_, numberColumns_ + numberRows_, saveStatus); CoinMemcpyN(lower_, numberRows_ + numberColumns_, saveLower); CoinMemcpyN(upper_, numberRows_ + numberColumns_, saveUpper); CoinMemcpyN(cost_, numberRows_ + numberColumns_, saveObjective); CoinMemcpyN(pivotVariable_, numberRows_, savePivot); ClpFactorization * factorization = factorization_; factorization_ = NULL; return factorization; } // This cleans up after strong branching void ClpSimplexDual::cleanupAfterStrongBranching(ClpFactorization * factorization) { int startFinishOptions; /* COIN_CLP_VETTED Looks safe for Cbc */ if((specialOptions_ & 4096) == 0) { startFinishOptions = 0; } else { startFinishOptions = 1 + 2 + 4; } if ((startFinishOptions & 1) == 0 && cost_) { deleteRim(1); } else { // Original factorization will have been put back by last loop delete factorization_; factorization_ = factorization; //deleteRim(0); // mark all as current } whatsChanged_ &= ~0xffff; } /* Checks number of variables at fake bounds. This is used by fastDual so can exit gracefully before end */ int ClpSimplexDual::numberAtFakeBound() { int iSequence; int numberFake = 0; for (iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { FakeBound bound = getFakeBound(iSequence); switch(getStatus(iSequence)) { case basic: break; case isFree: case superBasic: case ClpSimplex::isFixed: //setFakeBound (iSequence, noFake); break; case atUpperBound: if (bound == upperFake || bound == bothFake) numberFake++; break; case atLowerBound: if (bound == lowerFake || bound == bothFake) numberFake++; break; } } //numberFake_ = numberFake; return numberFake; } /* Pivot out a variable and choose an incoing one. Assumes dual feasible - will not go through a reduced cost. Returns step length in theta Return codes as before but -1 means no acceptable pivot */ int ClpSimplexDual::pivotResultPart1() { // Get good size for pivot // Allow first few iterations to take tiny double acceptablePivot = 1.0e-1 * acceptablePivot_; if (numberIterations_ > 100) acceptablePivot = acceptablePivot_; if (factorization_->pivots() > 10) acceptablePivot = 1.0e+3 * acceptablePivot_; // if we have iterated be more strict else if (factorization_->pivots() > 5) acceptablePivot = 1.0e+2 * acceptablePivot_; // if we have iterated be slightly more strict else if (factorization_->pivots()) acceptablePivot = acceptablePivot_; // relax // But factorizations complain if <1.0e-8 //acceptablePivot=CoinMax(acceptablePivot,1.0e-8); double bestPossiblePivot = 1.0; // get sign for finding row of tableau // create as packed double direction = directionOut_; assert (!rowArray_[0]->getNumElements()); rowArray_[1]->clear(); //assert (!rowArray_[1]->getNumElements()); assert (!columnArray_[0]->getNumElements()); assert (!columnArray_[1]->getNumElements()); rowArray_[0]->createPacked(1, &pivotRow_, &direction); factorization_->updateColumnTranspose(rowArray_[1], rowArray_[0]); // Allow to do dualColumn0 if (numberThreads_ < -1) spareIntArray_[0] = 1; spareDoubleArray_[0] = acceptablePivot; rowArray_[3]->clear(); sequenceIn_ = -1; // put row of tableau in rowArray[0] and columnArray[0] assert (!rowArray_[1]->getNumElements()); if (!scaledMatrix_) { if ((moreSpecialOptions_ & 8) != 0 && !rowScale_) spareIntArray_[0] = 1; matrix_->transposeTimes(this, -1.0, rowArray_[0], rowArray_[1], columnArray_[0]); } else { double * saveR = rowScale_; double * saveC = columnScale_; rowScale_ = NULL; columnScale_ = NULL; if ((moreSpecialOptions_ & 8) != 0) spareIntArray_[0] = 1; scaledMatrix_->transposeTimes(this, -1.0, rowArray_[0], rowArray_[1], columnArray_[0]); rowScale_ = saveR; columnScale_ = saveC; } // do ratio test for normal iteration dualOut_ *= 1.0e-8; bestPossiblePivot = dualColumn(rowArray_[0], columnArray_[0], rowArray_[3], columnArray_[1], acceptablePivot, NULL/*dubiousWeights*/); dualOut_ *= 1.0e8; if (fabs(bestPossiblePivot)<1.0e-6) return -1; else return 0; } /* Row array has row part of pivot row Column array has column part. This is used in dual values pass */ void ClpSimplexDual::checkPossibleValuesMove(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, double acceptablePivot) { double * work; int number; int * which; int iSection; double tolerance = dualTolerance_ * 1.001; double thetaDown = 1.0e31; double changeDown ; double thetaUp = 1.0e31; double bestAlphaDown = acceptablePivot * 0.99999; double bestAlphaUp = acceptablePivot * 0.99999; int sequenceDown = -1; int sequenceUp = sequenceOut_; double djBasic = dj_[sequenceOut_]; if (djBasic > 0.0) { // basic at lower bound so directionOut_ 1 and -1 in pivot row // dj will go to zero on other way thetaUp = djBasic; changeDown = -lower_[sequenceOut_]; } else { // basic at upper bound so directionOut_ -1 and 1 in pivot row // dj will go to zero on other way thetaUp = -djBasic; changeDown = upper_[sequenceOut_]; } bestAlphaUp = 1.0; int addSequence; double alphaUp = 0.0; double alphaDown = 0.0; for (iSection = 0; iSection < 2; iSection++) { int i; if (!iSection) { work = rowArray->denseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); addSequence = numberColumns_; } else { work = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); addSequence = 0; } for (i = 0; i < number; i++) { int iSequence = which[i]; int iSequence2 = iSequence + addSequence; double alpha; double oldValue; double value; switch(getStatus(iSequence2)) { case basic: break; case ClpSimplex::isFixed: alpha = work[i]; changeDown += alpha * upper_[iSequence2]; break; case isFree: case superBasic: alpha = work[i]; // dj must be effectively zero as dual feasible if (fabs(alpha) > bestAlphaUp) { thetaDown = 0.0; thetaUp = 0.0; bestAlphaDown = fabs(alpha); bestAlphaUp = bestAlphaDown; sequenceDown = iSequence2; sequenceUp = sequenceDown; alphaUp = alpha; alphaDown = alpha; } break; case atUpperBound: alpha = work[i]; oldValue = dj_[iSequence2]; changeDown += alpha * upper_[iSequence2]; if (alpha >= acceptablePivot) { // might do other way value = oldValue + thetaUp * alpha; if (value > -tolerance) { if (value > tolerance || fabs(alpha) > bestAlphaUp) { thetaUp = -oldValue / alpha; bestAlphaUp = fabs(alpha); sequenceUp = iSequence2; alphaUp = alpha; } } } else if (alpha <= -acceptablePivot) { // might do this way value = oldValue - thetaDown * alpha; if (value > -tolerance) { if (value > tolerance || fabs(alpha) > bestAlphaDown) { thetaDown = oldValue / alpha; bestAlphaDown = fabs(alpha); sequenceDown = iSequence2; alphaDown = alpha; } } } break; case atLowerBound: alpha = work[i]; oldValue = dj_[iSequence2]; changeDown += alpha * lower_[iSequence2]; if (alpha <= -acceptablePivot) { // might do other way value = oldValue + thetaUp * alpha; if (value < tolerance) { if (value < -tolerance || fabs(alpha) > bestAlphaUp) { thetaUp = -oldValue / alpha; bestAlphaUp = fabs(alpha); sequenceUp = iSequence2; alphaUp = alpha; } } } else if (alpha >= acceptablePivot) { // might do this way value = oldValue - thetaDown * alpha; if (value < tolerance) { if (value < -tolerance || fabs(alpha) > bestAlphaDown) { thetaDown = oldValue / alpha; bestAlphaDown = fabs(alpha); sequenceDown = iSequence2; alphaDown = alpha; } } } break; } } } thetaUp *= -1.0; double changeUp = -thetaUp * changeDown; changeDown = -thetaDown * changeDown; if (CoinMax(fabs(thetaDown), fabs(thetaUp)) < 1.0e-8) { // largest if (fabs(alphaDown) < fabs(alphaUp)) { sequenceDown = -1; } } // choose sequenceIn_ = -1; if (changeDown > changeUp && sequenceDown >= 0) { theta_ = thetaDown; if (fabs(changeDown) < 1.0e30) sequenceIn_ = sequenceDown; alpha_ = alphaDown; #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("predicted way - dirout %d, change %g,%g theta %g\n", directionOut_, changeDown, changeUp, theta_); #endif } else { theta_ = thetaUp; if (fabs(changeUp) < 1.0e30) sequenceIn_ = sequenceUp; alpha_ = alphaUp; if (sequenceIn_ != sequenceOut_) { #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("opposite way - dirout %d, change %g,%g theta %g\n", directionOut_, changeDown, changeUp, theta_); #endif } else { #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("opposite way to zero dj - dirout %d, change %g,%g theta %g\n", directionOut_, changeDown, changeUp, theta_); #endif } } if (sequenceIn_ >= 0) { lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; valueIn_ = solution_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; if (alpha_ < 0.0) { // as if from upper bound directionIn_ = -1; upperIn_ = valueIn_; } else { // as if from lower bound directionIn_ = 1; lowerIn_ = valueIn_; } } } /* Row array has row part of pivot row Column array has column part. This is used in cleanup */ void ClpSimplexDual::checkPossibleCleanup(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, double acceptablePivot) { double * work; int number; int * which; int iSection; double tolerance = dualTolerance_ * 1.001; double thetaDown = 1.0e31; double thetaUp = 1.0e31; double bestAlphaDown = acceptablePivot * 10.0; double bestAlphaUp = acceptablePivot * 10.0; int sequenceDown = -1; int sequenceUp = -1; double djSlack = dj_[pivotRow_]; if (getRowStatus(pivotRow_) == basic) djSlack = COIN_DBL_MAX; if (fabs(djSlack) < tolerance) djSlack = 0.0; int addSequence; double alphaUp = 0.0; double alphaDown = 0.0; for (iSection = 0; iSection < 2; iSection++) { int i; if (!iSection) { work = rowArray->denseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); addSequence = numberColumns_; } else { work = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); addSequence = 0; } for (i = 0; i < number; i++) { int iSequence = which[i]; int iSequence2 = iSequence + addSequence; double alpha; double oldValue; double value; switch(getStatus(iSequence2)) { case basic: break; case ClpSimplex::isFixed: alpha = work[i]; if (addSequence) { COIN_DETAIL_PRINT(printf("possible - pivot row %d this %d\n", pivotRow_, iSequence)); oldValue = dj_[iSequence2]; if (alpha <= -acceptablePivot) { // might do other way value = oldValue + thetaUp * alpha; if (value < tolerance) { if (value < -tolerance || fabs(alpha) > bestAlphaUp) { thetaUp = -oldValue / alpha; bestAlphaUp = fabs(alpha); sequenceUp = iSequence2; alphaUp = alpha; } } } else if (alpha >= acceptablePivot) { // might do this way value = oldValue - thetaDown * alpha; if (value < tolerance) { if (value < -tolerance || fabs(alpha) > bestAlphaDown) { thetaDown = oldValue / alpha; bestAlphaDown = fabs(alpha); sequenceDown = iSequence2; alphaDown = alpha; } } } } break; case isFree: case superBasic: alpha = work[i]; // dj must be effectively zero as dual feasible if (fabs(alpha) > bestAlphaUp) { thetaDown = 0.0; thetaUp = 0.0; bestAlphaDown = fabs(alpha); bestAlphaUp = bestAlphaDown; sequenceDown = iSequence2; sequenceUp = sequenceDown; alphaUp = alpha; alphaDown = alpha; } break; case atUpperBound: alpha = work[i]; oldValue = dj_[iSequence2]; if (alpha >= acceptablePivot) { // might do other way value = oldValue + thetaUp * alpha; if (value > -tolerance) { if (value > tolerance || fabs(alpha) > bestAlphaUp) { thetaUp = -oldValue / alpha; bestAlphaUp = fabs(alpha); sequenceUp = iSequence2; alphaUp = alpha; } } } else if (alpha <= -acceptablePivot) { // might do this way value = oldValue - thetaDown * alpha; if (value > -tolerance) { if (value > tolerance || fabs(alpha) > bestAlphaDown) { thetaDown = oldValue / alpha; bestAlphaDown = fabs(alpha); sequenceDown = iSequence2; alphaDown = alpha; } } } break; case atLowerBound: alpha = work[i]; oldValue = dj_[iSequence2]; if (alpha <= -acceptablePivot) { // might do other way value = oldValue + thetaUp * alpha; if (value < tolerance) { if (value < -tolerance || fabs(alpha) > bestAlphaUp) { thetaUp = -oldValue / alpha; bestAlphaUp = fabs(alpha); sequenceUp = iSequence2; alphaUp = alpha; } } } else if (alpha >= acceptablePivot) { // might do this way value = oldValue - thetaDown * alpha; if (value < tolerance) { if (value < -tolerance || fabs(alpha) > bestAlphaDown) { thetaDown = oldValue / alpha; bestAlphaDown = fabs(alpha); sequenceDown = iSequence2; alphaDown = alpha; } } } break; } } } thetaUp *= -1.0; // largest if (bestAlphaDown < bestAlphaUp) sequenceDown = -1; else sequenceUp = -1; sequenceIn_ = -1; if (sequenceDown >= 0) { theta_ = thetaDown; sequenceIn_ = sequenceDown; alpha_ = alphaDown; #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("predicted way - dirout %d, theta %g\n", directionOut_, theta_); #endif } else if (sequenceUp >= 0) { theta_ = thetaUp; sequenceIn_ = sequenceUp; alpha_ = alphaUp; #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("opposite way - dirout %d,theta %g\n", directionOut_, theta_); #endif } if (sequenceIn_ >= 0) { lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; valueIn_ = solution_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; if (alpha_ < 0.0) { // as if from upper bound directionIn_ = -1; upperIn_ = valueIn_; } else { // as if from lower bound directionIn_ = 1; lowerIn_ = valueIn_; } } } /* This sees if we can move duals in dual values pass. This is done before any pivoting */ void ClpSimplexDual::doEasyOnesInValuesPass(double * dj) { // Get column copy CoinPackedMatrix * columnCopy = matrix(); // Get a row copy in standard format CoinPackedMatrix copy; copy.setExtraGap(0.0); copy.setExtraMajor(0.0); copy.reverseOrderedCopyOf(*columnCopy); // get matrix data pointers const int * column = copy.getIndices(); const CoinBigIndex * rowStart = copy.getVectorStarts(); const int * rowLength = copy.getVectorLengths(); const double * elementByRow = copy.getElements(); double tolerance = dualTolerance_ * 1.001; int iRow; #ifdef CLP_DEBUG { double value5 = 0.0; int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (dj[i] < -1.0e-6) value5 += dj[i] * upper_[i]; else if (dj[i] > 1.0e-6) value5 += dj[i] * lower_[i]; } printf("Values objective Value before %g\n", value5); } #endif // for scaled row double * scaled = NULL; if (rowScale_) scaled = new double[numberColumns_]; for (iRow = 0; iRow < numberRows_; iRow++) { int iSequence = iRow + numberColumns_; double djBasic = dj[iSequence]; if (getRowStatus(iRow) == basic && fabs(djBasic) > tolerance) { double changeUp ; // always -1 in pivot row if (djBasic > 0.0) { // basic at lower bound changeUp = -lower_[iSequence]; } else { // basic at upper bound changeUp = upper_[iSequence]; } bool canMove = true; int i; const double * thisElements = elementByRow + rowStart[iRow]; const int * thisIndices = column + rowStart[iRow]; if (rowScale_) { // scale row double scale = rowScale_[iRow]; for (i = 0; i < rowLength[iRow]; i++) { int iColumn = thisIndices[i]; double alpha = thisElements[i]; scaled[i] = scale * alpha * columnScale_[iColumn]; } thisElements = scaled; } for (i = 0; i < rowLength[iRow]; i++) { int iColumn = thisIndices[i]; double alpha = thisElements[i]; double oldValue = dj[iColumn];; double value; switch(getStatus(iColumn)) { case basic: if (dj[iColumn] < -tolerance && fabs(solution_[iColumn] - upper_[iColumn]) < 1.0e-8) { // at ub changeUp += alpha * upper_[iColumn]; // might do other way value = oldValue + djBasic * alpha; if (value > tolerance) canMove = false; } else if (dj[iColumn] > tolerance && fabs(solution_[iColumn] - lower_[iColumn]) < 1.0e-8) { changeUp += alpha * lower_[iColumn]; // might do other way value = oldValue + djBasic * alpha; if (value < -tolerance) canMove = false; } else { canMove = false; } break; case ClpSimplex::isFixed: changeUp += alpha * upper_[iColumn]; break; case isFree: case superBasic: canMove = false; break; case atUpperBound: changeUp += alpha * upper_[iColumn]; // might do other way value = oldValue + djBasic * alpha; if (value > tolerance) canMove = false; break; case atLowerBound: changeUp += alpha * lower_[iColumn]; // might do other way value = oldValue + djBasic * alpha; if (value < -tolerance) canMove = false; break; } } if (canMove) { if (changeUp * djBasic > 1.0e-12 || fabs(changeUp) < 1.0e-8) { // move for (i = 0; i < rowLength[iRow]; i++) { int iColumn = thisIndices[i]; double alpha = thisElements[i]; dj[iColumn] += djBasic * alpha; } dj[iSequence] = 0.0; #ifdef CLP_DEBUG { double value5 = 0.0; int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (dj[i] < -1.0e-6) value5 += dj[i] * upper_[i]; else if (dj[i] > 1.0e-6) value5 += dj[i] * lower_[i]; } printf("Values objective Value after row %d old dj %g %g\n", iRow, djBasic, value5); } #endif } } } } delete [] scaled; } int ClpSimplexDual::nextSuperBasic() { if (firstFree_ >= 0) { int returnValue = firstFree_; int iColumn = firstFree_ + 1; for (; iColumn < numberRows_ + numberColumns_; iColumn++) { if (getStatus(iColumn) == isFree) if (fabs(dj_[iColumn]) > 1.0e2 * dualTolerance_) break; } firstFree_ = iColumn; if (firstFree_ == numberRows_ + numberColumns_) firstFree_ = -1; return returnValue; } else { return -1; } } void ClpSimplexDual::resetFakeBounds(int type) { if (type == 0) { // put back original bounds and then check createRim1(false); double dummyChangeCost = 0.0; changeBounds(3, NULL, dummyChangeCost); } else if (type < 0) { #ifndef NDEBUG // just check int nTotal = numberRows_ + numberColumns_; double * tempLower = CoinCopyOfArray(lower_, nTotal); double * tempUpper = CoinCopyOfArray(upper_, nTotal); int iSequence; // Get scaled true bounds if (columnScale_) { for (iSequence = 0; iSequence < numberColumns_; iSequence++) { // lower double value = columnLower_[iSequence]; if (value > -1.0e30) { double multiplier = rhsScale_ * inverseColumnScale_[iSequence]; value *= multiplier; } tempLower[iSequence] = value; // upper value = columnUpper_[iSequence]; if (value < 1.0e30) { double multiplier = rhsScale_ * inverseColumnScale_[iSequence]; value *= multiplier; } tempUpper[iSequence] = value; } for (iSequence = 0; iSequence < numberRows_; iSequence++) { // lower double value = rowLower_[iSequence]; if (value > -1.0e30) { double multiplier = rhsScale_ * rowScale_[iSequence]; value *= multiplier; } tempLower[iSequence+numberColumns_] = value; // upper value = rowUpper_[iSequence]; if (value < 1.0e30) { double multiplier = rhsScale_ * rowScale_[iSequence]; value *= multiplier; } tempUpper[iSequence+numberColumns_] = value; } } else { for (iSequence = 0; iSequence < numberColumns_; iSequence++) { // lower tempLower[iSequence] = columnLower_[iSequence]; // upper tempUpper[iSequence] = columnUpper_[iSequence]; } for (iSequence = 0; iSequence < numberRows_; iSequence++) { // lower tempLower[iSequence+numberColumns_] = rowLower_[iSequence]; // upper tempUpper[iSequence+numberColumns_] = rowUpper_[iSequence]; } } int nFake = 0; int nErrors = 0; int nSuperBasic = 0; int nWarnings = 0; for (iSequence = 0; iSequence < nTotal; iSequence++) { FakeBound fakeStatus = getFakeBound(iSequence); Status status = getStatus(iSequence); bool isFake = false; #ifdef CLP_INVESTIGATE char RC = 'C'; #endif int jSequence = iSequence; if (jSequence >= numberColumns_) { #ifdef CLP_INVESTIGATE RC = 'R'; #endif jSequence -= numberColumns_; } double lowerValue = tempLower[iSequence]; double upperValue = tempUpper[iSequence]; double value = solution_[iSequence]; CoinRelFltEq equal; if (status == atUpperBound || status == atLowerBound) { if (fakeStatus == ClpSimplexDual::upperFake) { if(!equal(upper_[iSequence], (lowerValue + dualBound_)) || !(equal(upper_[iSequence], value) || equal(lower_[iSequence], value))) { nErrors++; #ifdef CLP_INVESTIGATE printf("** upperFake %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, lower_[iSequence], solution_[iSequence], upper_[iSequence], lowerValue, upperValue); #endif } isFake = true;; } else if (fakeStatus == ClpSimplexDual::lowerFake) { if(!equal(lower_[iSequence], (upperValue - dualBound_)) || !(equal(upper_[iSequence], value) || equal(lower_[iSequence], value))) { nErrors++; #ifdef CLP_INVESTIGATE printf("** lowerFake %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, lower_[iSequence], solution_[iSequence], upper_[iSequence], lowerValue, upperValue); #endif } isFake = true;; } else if (fakeStatus == ClpSimplexDual::bothFake) { nWarnings++; #ifdef CLP_INVESTIGATE printf("** %d at bothFake?\n", iSequence); #endif } else if (upper_[iSequence] - lower_[iSequence] > 2.0 * dualBound_) { nErrors++; #ifdef CLP_INVESTIGATE printf("** noFake! %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, lower_[iSequence], solution_[iSequence], upper_[iSequence], lowerValue, upperValue); #endif } } else if (status == superBasic || status == isFree) { nSuperBasic++; //printf("** free or superbasic %c%d %g <= %g <= %g true %g, %g - status %d\n", // RC,jSequence,lower_[iSequence],solution_[iSequence], // upper_[iSequence],lowerValue,upperValue,status); } else if (status == basic) { bool odd = false; if (!equal(lower_[iSequence], lowerValue)) odd = true; if (!equal(upper_[iSequence], upperValue)) odd = true; if (odd) { #ifdef CLP_INVESTIGATE printf("** basic %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, lower_[iSequence], solution_[iSequence], upper_[iSequence], lowerValue, upperValue); #endif nWarnings++; } } else if (status == isFixed) { if (!equal(upper_[iSequence], lower_[iSequence])) { nErrors++; #ifdef CLP_INVESTIGATE printf("** fixed! %c%d %g <= %g <= %g true %g, %g\n", RC, jSequence, lower_[iSequence], solution_[iSequence], upper_[iSequence], lowerValue, upperValue); #endif } } if (isFake) { nFake++; } else { if (fakeStatus != ClpSimplexDual::noFake) { nErrors++; #ifdef CLP_INVESTIGATE printf("** bad fake status %c%d %d\n", RC, jSequence, fakeStatus); #endif } } } if (nFake != numberFake_) { #ifdef CLP_INVESTIGATE printf("nfake %d numberFake %d\n", nFake, numberFake_); #endif nErrors++; } if (nErrors || type <= -1000) { #ifdef CLP_INVESTIGATE printf("%d errors, %d warnings, %d free/superbasic, %d fake\n", nErrors, nWarnings, nSuperBasic, numberFake_); printf("dualBound %g\n", dualBound_); #endif if (type <= -1000) { iSequence = -type; iSequence -= 1000; #ifdef CLP_INVESTIGATE char RC = 'C'; #endif int jSequence = iSequence; if (jSequence >= numberColumns_) { #ifdef CLP_INVESTIGATE RC = 'R'; #endif jSequence -= numberColumns_; } #ifdef CLP_INVESTIGATE double lowerValue = tempLower[iSequence]; double upperValue = tempUpper[iSequence]; printf("*** movement>1.0e30 for %c%d %g <= %g <= %g true %g, %g - status %d\n", RC, jSequence, lower_[iSequence], solution_[iSequence], upper_[iSequence], lowerValue, upperValue, status_[iSequence]); #endif assert (nErrors); // should have been picked up } assert (!nErrors); } delete [] tempLower; delete [] tempUpper; #endif } else if (lower_) { // reset using status int nTotal = numberRows_ + numberColumns_; int iSequence; if (columnScale_) { for (iSequence = 0; iSequence < numberColumns_; iSequence++) { double multiplier = rhsScale_ * inverseColumnScale_[iSequence]; // lower double value = columnLower_[iSequence]; if (value > -1.0e30) { value *= multiplier; } lower_[iSequence] = value; // upper value = columnUpper_[iSequence]; if (value < 1.0e30) { value *= multiplier; } upper_[iSequence] = value; } for (iSequence = 0; iSequence < numberRows_; iSequence++) { // lower double multiplier = rhsScale_ * rowScale_[iSequence]; double value = rowLower_[iSequence]; if (value > -1.0e30) { value *= multiplier; } lower_[iSequence+numberColumns_] = value; // upper value = rowUpper_[iSequence]; if (value < 1.0e30) { value *= multiplier; } upper_[iSequence+numberColumns_] = value; } } else { memcpy(lower_, columnLower_, numberColumns_ * sizeof(double)); memcpy(upper_, columnUpper_, numberColumns_ * sizeof(double)); memcpy(lower_ + numberColumns_, rowLower_, numberRows_ * sizeof(double)); memcpy(upper_ + numberColumns_, rowUpper_, numberRows_ * sizeof(double)); } numberFake_ = 0; for (iSequence = 0; iSequence < nTotal; iSequence++) { FakeBound fakeStatus = getFakeBound(iSequence); if (fakeStatus != ClpSimplexDual::noFake) { Status status = getStatus(iSequence); if (status == basic || status == isFixed) { setFakeBound(iSequence, ClpSimplexDual::noFake); continue; } double lowerValue = lower_[iSequence]; double upperValue = upper_[iSequence]; double value = solution_[iSequence]; numberFake_++; if (fakeStatus == ClpSimplexDual::upperFake) { upper_[iSequence] = lowerValue + dualBound_; if (status == ClpSimplex::atLowerBound) { solution_[iSequence] = lowerValue; } else if (status == ClpSimplex::atUpperBound) { solution_[iSequence] = upper_[iSequence]; } else { printf("Unknown status %d for variable %d in %s line %d\n", status,iSequence,__FILE__,__LINE__); abort(); } } else if (fakeStatus == ClpSimplexDual::lowerFake) { lower_[iSequence] = upperValue - dualBound_; if (status == ClpSimplex::atLowerBound) { solution_[iSequence] = lower_[iSequence]; } else if (status == ClpSimplex::atUpperBound) { solution_[iSequence] = upperValue; } else { printf("Unknown status %d for variable %d in %s line %d\n", status,iSequence,__FILE__,__LINE__); abort(); } } else { assert (fakeStatus == ClpSimplexDual::bothFake); if (status == ClpSimplex::atLowerBound) { lower_[iSequence] = value; upper_[iSequence] = value + dualBound_; } else if (status == ClpSimplex::atUpperBound) { upper_[iSequence] = value; lower_[iSequence] = value - dualBound_; } else if (status == ClpSimplex::isFree || status == ClpSimplex::superBasic) { lower_[iSequence] = value - 0.5 * dualBound_; upper_[iSequence] = value + 0.5 * dualBound_; } else { printf("Unknown status %d for variable %d in %s line %d\n", status,iSequence,__FILE__,__LINE__); abort(); } } } } #ifndef NDEBUG } else { COIN_DETAIL_PRINT(printf("NULL lower\n")); #endif } } CoinMP-1.8.3/Clp/src/ClpSimplexDual.hpp0000644000175000017500000003064011605104000016206 0ustar renerene/* $Id: ClpSimplexDual.hpp 1761 2011-07-06 16:06:24Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef ClpSimplexDual_H #define ClpSimplexDual_H #include "ClpSimplex.hpp" /** This solves LPs using the dual simplex method It inherits from ClpSimplex. It has no data of its own and is never created - only cast from a ClpSimplex object at algorithm time. */ class ClpSimplexDual : public ClpSimplex { public: /**@name Description of algorithm */ //@{ /** Dual algorithm Method It tries to be a single phase approach with a weight of 1.0 being given to getting optimal and a weight of updatedDualBound_ being given to getting dual feasible. In this version I have used the idea that this weight can be thought of as a fake bound. If the distance between the lower and upper bounds on a variable is less than the feasibility weight then we are always better off flipping to other bound to make dual feasible. If the distance is greater then we make up a fake bound updatedDualBound_ away from one bound. If we end up optimal or primal infeasible, we check to see if bounds okay. If so we have finished, if not we increase updatedDualBound_ and continue (after checking if unbounded). I am undecided about free variables - there is coding but I am not sure about it. At present I put them in basis anyway. The code is designed to take advantage of sparsity so arrays are seldom zeroed out from scratch or gone over in their entirety. The only exception is a full scan to find outgoing variable for Dantzig row choice. For steepest edge we keep an updated list of infeasibilities (actually squares). On easy problems we don't need full scan - just pick first reasonable. One problem is how to tackle degeneracy and accuracy. At present I am using the modification of costs which I put in OSL and some of what I think is the dual analog of Gill et al. I am still not sure of the exact details. The flow of dual is three while loops as follows: while (not finished) { while (not clean solution) { Factorize and/or clean up solution by flipping variables so dual feasible. If looks finished check fake dual bounds. Repeat until status is iterating (-1) or finished (0,1,2) } while (status==-1) { Iterate until no pivot in or out or time to re-factorize. Flow is: choose pivot row (outgoing variable). if none then we are primal feasible so looks as if done but we need to break and check bounds etc. Get pivot row in tableau Choose incoming column. If we don't find one then we look primal infeasible so break and check bounds etc. (Also the pivot tolerance is larger after any iterations so that may be reason) If we do find incoming column, we may have to adjust costs to keep going forwards (anti-degeneracy). Check pivot will be stable and if unstable throw away iteration and break to re-factorize. If minor error re-factorize after iteration. Update everything (this may involve flipping variables to stay dual feasible. } } TODO's (or maybe not) At present we never check we are going forwards. I overdid that in OSL so will try and make a last resort. Needs partial scan pivot out option. May need other anti-degeneracy measures, especially if we try and use loose tolerances as a way to solve in fewer iterations. I like idea of dynamic scaling. This gives opportunity to decouple different implications of scaling for accuracy, iteration count and feasibility tolerance. for use of exotic parameter startFinishoptions see Clpsimplex.hpp */ int dual(int ifValuesPass, int startFinishOptions = 0); /** For strong branching. On input lower and upper are new bounds while on output they are change in objective function values (>1.0e50 infeasible). Return code is 0 if nothing interesting, -1 if infeasible both ways and +1 if infeasible one way (check values to see which one(s)) Solutions are filled in as well - even down, odd up - also status and number of iterations */ int strongBranching(int numberVariables, const int * variables, double * newLower, double * newUpper, double ** outputSolution, int * outputStatus, int * outputIterations, bool stopOnFirstInfeasible = true, bool alwaysFinish = false, int startFinishOptions = 0); /// This does first part of StrongBranching ClpFactorization * setupForStrongBranching(char * arrays, int numberRows, int numberColumns, bool solveLp = false); /// This cleans up after strong branching void cleanupAfterStrongBranching(ClpFactorization * factorization); //@} /**@name Functions used in dual */ //@{ /** This has the flow between re-factorizations Broken out for clarity and will be used by strong branching Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations If givenPi not NULL then in values pass */ int whileIterating(double * & givenPi, int ifValuesPass); /** The duals are updated by the given arrays. Returns number of infeasibilities. After rowArray and columnArray will just have those which have been flipped. Variables may be flipped between bounds to stay dual feasible. The output vector has movement of primal solution (row length array) */ int updateDualsInDual(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, CoinIndexedVector * outputArray, double theta, double & objectiveChange, bool fullRecompute); /** The duals are updated by the given arrays. This is in values pass - so no changes to primal is made */ void updateDualsInValuesPass(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, double theta); /** While updateDualsInDual sees what effect is of flip this does actual flipping. */ void flipBounds(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray); /** Row array has row part of pivot row Column array has column part. This chooses pivot column. Spare arrays are used to save pivots which will go infeasible We will check for basic so spare array will never overflow. If necessary will modify costs For speed, we may need to go to a bucket approach when many variables are being flipped. Returns best possible pivot value */ double dualColumn(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, CoinIndexedVector * spareArray, CoinIndexedVector * spareArray2, double accpetablePivot, CoinBigIndex * dubiousWeights); /// Does first bit of dualColumn int dualColumn0(const CoinIndexedVector * rowArray, const CoinIndexedVector * columnArray, CoinIndexedVector * spareArray, double acceptablePivot, double & upperReturn, double &bestReturn, double & badFree); /** Row array has row part of pivot row Column array has column part. This sees what is best thing to do in dual values pass if sequenceIn==sequenceOut can change dual on chosen row and leave variable in basis */ void checkPossibleValuesMove(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, double acceptablePivot); /** Row array has row part of pivot row Column array has column part. This sees what is best thing to do in branch and bound cleanup If sequenceIn_ < 0 then can't do anything */ void checkPossibleCleanup(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, double acceptablePivot); /** This sees if we can move duals in dual values pass. This is done before any pivoting */ void doEasyOnesInValuesPass(double * givenReducedCosts); /** Chooses dual pivot row Would be faster with separate region to scan and will have this (with square of infeasibility) when steepest For easy problems we can just choose one of the first rows we look at If alreadyChosen >=0 then in values pass and that row has been selected */ void dualRow(int alreadyChosen); /** Checks if any fake bounds active - if so returns number and modifies updatedDualBound_ and everything. Free variables will be left as free Returns number of bounds changed if >=0 Returns -1 if not initialize and no effect Fills in changeVector which can be used to see if unbounded and cost of change vector If 2 sets to original (just changed) */ int changeBounds(int initialize, CoinIndexedVector * outputArray, double & changeCost); /** As changeBounds but just changes new bounds for a single variable. Returns true if change */ bool changeBound( int iSequence); /// Restores bound to original bound void originalBound(int iSequence); /** Checks if tentative optimal actually means unbounded in dual Returns -3 if not, 2 if is unbounded */ int checkUnbounded(CoinIndexedVector * ray, CoinIndexedVector * spare, double changeCost); /** Refactorizes if necessary Checks if finished. Updates status. lastCleaned refers to iteration at which some objective/feasibility cleaning too place. type - 0 initial so set up save arrays etc - 1 normal -if good update save - 2 restoring from saved */ void statusOfProblemInDual(int & lastCleaned, int type, double * givenDjs, ClpDataSave & saveData, int ifValuesPass); /** Perturbs problem (method depends on perturbation()) returns nonzero if should go to dual */ int perturb(); /** Fast iterations. Misses out a lot of initialization. Normally stops on maximum iterations, first re-factorization or tentative optimum. If looks interesting then continues as normal. Returns 0 if finished properly, 1 otherwise. */ int fastDual(bool alwaysFinish = false); /** Checks number of variables at fake bounds. This is used by fastDual so can exit gracefully before end */ int numberAtFakeBound(); /** Pivot in a variable and choose an outgoing one. Assumes dual feasible - will not go through a reduced cost. Returns step length in theta Return codes as before but -1 means no acceptable pivot */ int pivotResultPart1(); /** Get next free , -1 if none */ int nextSuperBasic(); /** Startup part of dual (may be extended to other algorithms) returns 0 if good, 1 if bad */ int startupSolve(int ifValuesPass, double * saveDuals, int startFinishOptions); void finishSolve(int startFinishOptions); void gutsOfDual(int ifValuesPass, double * & saveDuals, int initialStatus, ClpDataSave & saveData); //int dual2(int ifValuesPass,int startFinishOptions=0); void resetFakeBounds(int type); //@} }; #endif CoinMP-1.8.3/Clp/src/ClpObjective.cpp0000644000175000017500000000406311510657452015707 0ustar renerene/* $Id: ClpObjective.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpObjective.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpObjective::ClpObjective () : offset_(0.0), type_(-1), activated_(1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpObjective::ClpObjective (const ClpObjective & source) : offset_(source.offset_), type_(source.type_), activated_(source.activated_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpObjective::~ClpObjective () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpObjective & ClpObjective::operator=(const ClpObjective& rhs) { if (this != &rhs) { offset_ = rhs.offset_; type_ = rhs.type_; activated_ = rhs.activated_; } return *this; } /* Subset clone. Duplicates are allowed and order is as given. */ ClpObjective * ClpObjective::subsetClone (int, const int * ) const { std::cerr << "subsetClone not supported - ClpObjective" << std::endl; abort(); return NULL; } /* Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ int ClpObjective::markNonlinear(char *) { return 0; } CoinMP-1.8.3/Clp/src/ClpGubMatrix.hpp0000644000175000017500000003474511510657452015716 0ustar renerene/* $Id: ClpGubMatrix.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpGubMatrix_H #define ClpGubMatrix_H #include "CoinPragma.hpp" #include "ClpPackedMatrix.hpp" class ClpSimplex; /** This implements Gub rows plus a ClpPackedMatrix. There will be a version using ClpPlusMinusOne matrix but there is no point doing one with ClpNetworkMatrix (although an embedded network is attractive). */ class ClpGubMatrix : public ClpPackedMatrix { public: /**@name Main functions provided */ //@{ /** Returns a new matrix in reverse order without gaps (GUB wants NULL) */ virtual ClpMatrixBase * reverseOrderedCopy() const; /// Returns number of elements in column part of basis virtual CoinBigIndex countBasis(const int * whichColumn, int & numberColumnBasic); /// Fills in column part of basis virtual void fillBasis(ClpSimplex * model, const int * whichColumn, int & numberColumnBasic, int * row, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * element); /** Unpacks a column into an CoinIndexedvector */ virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray, int column) const ; /** Unpacks a column into an CoinIndexedvector ** in packed foramt Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ virtual void unpackPacked(ClpSimplex * model, CoinIndexedVector * rowArray, int column) const; /** Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray, int column, double multiplier) const ; /** Adds multiple of a column into an array */ virtual void add(const ClpSimplex * model, double * array, int column, double multiplier) const; /// Partial pricing virtual void partialPricing(ClpSimplex * model, double start, double end, int & bestSequence, int & numberWanted); /// Returns number of hidden rows e.g. gub virtual int hiddenRows() const; //@} /**@name Matrix times vector methods */ //@{ using ClpPackedMatrix::transposeTimes ; /** Return x * scalar * A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex */ virtual void transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x * scalar * A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex. This version uses row copy*/ virtual void transposeTimesByRow(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x *A in z but just for indices in y. Note - z always packed mode */ virtual void subsetTransposeTimes(const ClpSimplex * model, const CoinIndexedVector * x, const CoinIndexedVector * y, CoinIndexedVector * z) const; /** expands an updated column to allow for extra rows which the main solver does not know about and returns number added if mode 0. If mode 1 deletes extra entries This active in Gub */ virtual int extendUpdated(ClpSimplex * model, CoinIndexedVector * update, int mode); /** mode=0 - Set up before "update" and "times" for primal solution using extended rows mode=1 - Cleanup primal solution after "times" using extended rows. mode=2 - Check (or report on) primal infeasibilities */ virtual void primalExpanded(ClpSimplex * model, int mode); /** mode=0 - Set up before "updateTranspose" and "transposeTimes" for duals using extended updates array (and may use other if dual values pass) mode=1 - Update dual solution after "transposeTimes" using extended rows. mode=2 - Compute all djs and compute key dual infeasibilities mode=3 - Report on key dual infeasibilities mode=4 - Modify before updateTranspose in partial pricing */ virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array, double * other, int mode); /** mode=0 - Create list of non-key basics in pivotVariable_ using number as numberBasic in and out mode=1 - Set all key variables as basic mode=2 - return number extra rows needed, number gives maximum number basic mode=3 - before replaceColumn mode=4 - return 1 if can do primal, 2 if dual, 3 if both mode=5 - save any status stuff (when in good state) mode=6 - restore status stuff mode=7 - flag given variable (normally sequenceIn) mode=8 - unflag all variables mode=9 - synchronize costs mode=10 - return 1 if there may be changing bounds on variable (column generation) mode=11 - make sure set is clean (used when a variable rejected - but not flagged) mode=12 - after factorize but before permute stuff mode=13 - at end of simplex to delete stuff */ virtual int generalExpanded(ClpSimplex * model, int mode, int & number); /** update information for a pivot (and effective rhs) */ virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue); /// Sets up an effective RHS and does gub crash if needed virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true); /** Returns effective RHS offset if it is being used. This is used for long problems or big gub or anywhere where going through full columns is expensive. This may re-compute */ virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false, bool check = false); /** This is local to Gub to allow synchronization: mode=0 when status of basis is good mode=1 when variable is flagged mode=2 when all variables unflagged (returns number flagged) mode=3 just reset costs (primal) mode=4 correct number of dual infeasibilities mode=5 return 4 if time to re-factorize mode=6 - return 1 if there may be changing bounds on variable (column generation) mode=7 - do extra restores for column generation mode=8 - make sure set is clean mode=9 - adjust lower, upper on set by incoming */ virtual int synchronize(ClpSimplex * model, int mode); /// Correct sequence in and out to give true value virtual void correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) ; //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpGubMatrix(); /** Destructor */ virtual ~ClpGubMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpGubMatrix(const ClpGubMatrix&); /** The copy constructor from an CoinPackedMatrix. */ ClpGubMatrix(const CoinPackedMatrix&); /** Subset constructor (without gaps). Duplicates are allowed and order is as given */ ClpGubMatrix (const ClpGubMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); ClpGubMatrix (const CoinPackedMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); /** This takes over ownership (for space reasons) */ ClpGubMatrix(CoinPackedMatrix * matrix); /** This takes over ownership (for space reasons) and is the real constructor*/ ClpGubMatrix(ClpPackedMatrix * matrix, int numberSets, const int * start, const int * end, const double * lower, const double * upper, const unsigned char * status = NULL); ClpGubMatrix& operator=(const ClpGubMatrix&); /// Clone virtual ClpMatrixBase * clone() const ; /** Subset clone (without gaps). Duplicates are allowed and order is as given */ virtual ClpMatrixBase * subsetClone ( int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const ; /** redoes next_ for a set. */ void redoSet(ClpSimplex * model, int newKey, int oldKey, int iSet); //@} /**@name gets and sets */ //@{ /// Status inline ClpSimplex::Status getStatus(int sequence) const { return static_cast (status_[sequence] & 7); } inline void setStatus(int sequence, ClpSimplex::Status status) { unsigned char & st_byte = status_[sequence]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | status); } /// To flag a variable inline void setFlagged( int sequence) { status_[sequence] = static_cast(status_[sequence] | 64); } inline void clearFlagged( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~64); } inline bool flagged(int sequence) const { return ((status_[sequence] & 64) != 0); } /// To say key is above ub inline void setAbove( int sequence) { unsigned char iStat = status_[sequence]; iStat = static_cast(iStat & ~24); status_[sequence] = static_cast(iStat | 16); } /// To say key is feasible inline void setFeasible( int sequence) { unsigned char iStat = status_[sequence]; iStat = static_cast(iStat & ~24); status_[sequence] = static_cast(iStat | 8); } /// To say key is below lb inline void setBelow( int sequence) { unsigned char iStat = status_[sequence]; iStat = static_cast(iStat & ~24); status_[sequence] = iStat; } inline double weight( int sequence) const { int iStat = status_[sequence] & 31; iStat = iStat >> 3; return static_cast (iStat - 1); } /// Starts inline int * start() const { return start_; } /// End inline int * end() const { return end_; } /// Lower bounds on sets inline double * lower() const { return lower_; } /// Upper bounds on sets inline double * upper() const { return upper_; } /// Key variable of set inline int * keyVariable() const { return keyVariable_; } /// Backward pointer to set number inline int * backward() const { return backward_; } /// Number of sets (gub rows) inline int numberSets() const { return numberSets_; } /// Switches off dj checking each factorization (for BIG models) void switchOffCheck(); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Sum of dual infeasibilities double sumDualInfeasibilities_; /// Sum of primal infeasibilities double sumPrimalInfeasibilities_; /// Sum of Dual infeasibilities using tolerance based on error in duals double sumOfRelaxedDualInfeasibilities_; /// Sum of Primal infeasibilities using tolerance based on error in primals double sumOfRelaxedPrimalInfeasibilities_; /// Infeasibility weight when last full pass done double infeasibilityWeight_; /// Starts int * start_; /// End int * end_; /// Lower bounds on sets double * lower_; /// Upper bounds on sets double * upper_; /// Status of slacks mutable unsigned char * status_; /// Saved status of slacks unsigned char * saveStatus_; /// Saved key variables int * savedKeyVariable_; /// Backward pointer to set number int * backward_; /// Backward pointer to pivot row !!! int * backToPivotRow_; /// Change in costs for keys double * changeCost_; /// Key variable of set mutable int * keyVariable_; /** Next basic variable in set - starts at key and end with -(set+1). Now changes to -(nonbasic+1). next_ has extra space for 2* longest set */ mutable int * next_; /// Backward pointer to index in CoinIndexedVector int * toIndex_; // Reverse pointer from index to set int * fromIndex_; /// Pointer back to model ClpSimplex * model_; /// Number of dual infeasibilities int numberDualInfeasibilities_; /// Number of primal infeasibilities int numberPrimalInfeasibilities_; /** If pricing will declare victory (i.e. no check every factorization). -1 - always check 0 - don't check 1 - in don't check mode but looks optimal */ int noCheck_; /// Number of sets (gub rows) int numberSets_; /// Number in vector without gub extension int saveNumber_; /// Pivot row of possible next key int possiblePivotKey_; /// Gub slack in (set number or -1) int gubSlackIn_; /// First gub variables (same as start_[0] at present) int firstGub_; /// last gub variable (same as end_[numberSets_-1] at present) int lastGub_; /** type of gub - 0 not contiguous, 1 contiguous add 8 bit to say no ubs on individual variables */ int gubType_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpPlusMinusOneMatrix.hpp0000644000175000017500000003171212452503025017561 0ustar renerene/* $Id: ClpPlusMinusOneMatrix.hpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpPlusMinusOneMatrix_H #define ClpPlusMinusOneMatrix_H #include "CoinPragma.hpp" #include "ClpMatrixBase.hpp" /** This implements a simple +- one matrix as derived from ClpMatrixBase. */ class ClpPlusMinusOneMatrix : public ClpMatrixBase { public: /**@name Useful methods */ //@{ /// Return a complete CoinPackedMatrix virtual CoinPackedMatrix * getPackedMatrix() const; /** Whether the packed matrix is column major ordered or not. */ virtual bool isColOrdered() const ; /** Number of entries in the packed matrix. */ virtual CoinBigIndex getNumElements() const; /** Number of columns. */ virtual int getNumCols() const { return numberColumns_; } /** Number of rows. */ virtual int getNumRows() const { return numberRows_; } /** A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const double * getElements() const; /** A vector containing the minor indices of the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const int * getIndices() const { return indices_; } // and for advanced use int * getMutableIndices() const { return indices_; } virtual const CoinBigIndex * getVectorStarts() const; /** The lengths of the major-dimension vectors. */ virtual const int * getVectorLengths() const; /** Delete the columns whose indices are listed in indDel. */ virtual void deleteCols(const int numDel, const int * indDel); /** Delete the rows whose indices are listed in indDel. */ virtual void deleteRows(const int numDel, const int * indDel); /// Append Columns virtual void appendCols(int number, const CoinPackedVectorBase * const * columns); /// Append Rows virtual void appendRows(int number, const CoinPackedVectorBase * const * rows); #ifndef SLIM_CLP /** Append a set of rows/columns to the end of the matrix. Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns */ virtual int appendMatrix(int number, int type, const CoinBigIndex * starts, const int * index, const double * element, int numberOther = -1); #endif /** Returns a new matrix in reverse order without gaps */ virtual ClpMatrixBase * reverseOrderedCopy() const; /// Returns number of elements in column part of basis virtual CoinBigIndex countBasis( const int * whichColumn, int & numberColumnBasic); /// Fills in column part of basis virtual void fillBasis(ClpSimplex * model, const int * whichColumn, int & numberColumnBasic, int * row, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * element); /** Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector */ virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const; /** Returns largest and smallest elements of both signs. Largest refers to largest absolute value. */ virtual void rangeOfElements(double & smallestNegative, double & largestNegative, double & smallestPositive, double & largestPositive); /** Unpacks a column into an CoinIndexedvector */ virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray, int column) const ; /** Unpacks a column into an CoinIndexedvector ** in packed foramt Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ virtual void unpackPacked(ClpSimplex * model, CoinIndexedVector * rowArray, int column) const; /** Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray, int column, double multiplier) const ; /** Adds multiple of a column into an array */ virtual void add(const ClpSimplex * model, double * array, int column, double multiplier) const; /// Allow any parts of a created CoinMatrix to be deleted virtual void releasePackedMatrix() const; /** Set the dimensions of the matrix. In effect, append new empty columns/rows to the matrix. A negative number for either dimension means that that dimension doesn't change. Otherwise the new dimensions MUST be at least as large as the current ones otherwise an exception is thrown. */ virtual void setDimensions(int numrows, int numcols); /// Just checks matrix valid - will say if dimensions not quite right if detail void checkValid(bool detail) const; //@} /**@name Matrix times vector methods */ //@{ /** Return y + A * scalar *x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ virtual void times(double scalar, const double * x, double * y) const; /// And for scaling virtual void times(double scalar, const double * x, double * y, const double * rowScale, const double * columnScale) const; /** Return y + x * scalar * A in y. @pre x must be of size numRows() @pre y must be of size numColumns() */ virtual void transposeTimes(double scalar, const double * x, double * y) const; /// And for scaling virtual void transposeTimes(double scalar, const double * x, double * y, const double * rowScale, const double * columnScale, double * spare = NULL) const; /** Return x * scalar * A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex */ virtual void transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x * scalar * A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex. This version uses row copy*/ virtual void transposeTimesByRow(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x *A in z but just for indices in y. Note - z always packed mode */ virtual void subsetTransposeTimes(const ClpSimplex * model, const CoinIndexedVector * x, const CoinIndexedVector * y, CoinIndexedVector * z) const; /** Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster */ virtual bool canCombine(const ClpSimplex * model, const CoinIndexedVector * pi) const; /// Updates two arrays for steepest virtual void transposeTimes2(const ClpSimplex * model, const CoinIndexedVector * pi1, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * spare, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor); /// Updates second array for steepest and does devex weights virtual void subsetTimes2(const ClpSimplex * model, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * dj2, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor); //@} /**@name Other */ //@{ /// Return starts of +1s inline CoinBigIndex * startPositive() const { return startPositive_; } /// Return starts of -1s inline CoinBigIndex * startNegative() const { return startNegative_; } //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpPlusMinusOneMatrix(); /** Destructor */ virtual ~ClpPlusMinusOneMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpPlusMinusOneMatrix(const ClpPlusMinusOneMatrix&); /** The copy constructor from an CoinPlusMinusOneMatrix. If not a valid matrix then getIndices will be NULL and startPositive[0] will have number of +1, startPositive[1] will have number of -1, startPositive[2] will have number of others, */ ClpPlusMinusOneMatrix(const CoinPackedMatrix&); /// Constructor from arrays ClpPlusMinusOneMatrix(int numberRows, int numberColumns, bool columnOrdered, const int * indices, const CoinBigIndex * startPositive, const CoinBigIndex * startNegative); /** Subset constructor (without gaps). Duplicates are allowed and order is as given */ ClpPlusMinusOneMatrix (const ClpPlusMinusOneMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); ClpPlusMinusOneMatrix& operator=(const ClpPlusMinusOneMatrix&); /// Clone virtual ClpMatrixBase * clone() const ; /** Subset clone (without gaps). Duplicates are allowed and order is as given */ virtual ClpMatrixBase * subsetClone ( int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const ; /// pass in copy (object takes ownership) void passInCopy(int numberRows, int numberColumns, bool columnOrdered, int * indices, CoinBigIndex * startPositive, CoinBigIndex * startNegative); /// Says whether it can do partial pricing virtual bool canDoPartialPricing() const; /// Partial pricing virtual void partialPricing(ClpSimplex * model, double start, double end, int & bestSequence, int & numberWanted); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// For fake CoinPackedMatrix mutable CoinPackedMatrix * matrix_; mutable int * lengths_; /// Start of +1's for each CoinBigIndex * COIN_RESTRICT startPositive_; /// Start of -1's for each CoinBigIndex * COIN_RESTRICT startNegative_; /// Data -1, then +1 rows in pairs (row==-1 if one entry) int * COIN_RESTRICT indices_; /// Number of rows int numberRows_; /// Number of columns int numberColumns_; #ifdef CLP_PLUS_ONE_MATRIX /** Other flags (could have columnOrdered_?) 1 bit - says just +1 */ mutable int otherFlags_; #endif /// True if column ordered bool columnOrdered_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpPrimalColumnSteepest.hpp0000644000175000017500000002176611510657452020132 0ustar renerene/* $Id: ClpPrimalColumnSteepest.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpPrimalColumnSteepest_H #define ClpPrimalColumnSteepest_H #include "ClpPrimalColumnPivot.hpp" #include //############################################################################# class CoinIndexedVector; /** Primal Column Pivot Steepest Edge Algorithm Class See Forrest-Goldfarb paper for algorithm */ class ClpPrimalColumnSteepest : public ClpPrimalColumnPivot { public: ///@name Algorithmic methods //@{ /** Returns pivot column, -1 if none. The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row Parts of operation split out into separate functions for profiling and speed */ virtual int pivotColumn(CoinIndexedVector * updates, CoinIndexedVector * spareRow1, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// For quadratic or funny nonlinearities int pivotColumnOldMethod(CoinIndexedVector * updates, CoinIndexedVector * spareRow1, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Just update djs void justDjs(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Update djs doing partial pricing (dantzig) int partialPricing(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, int numberWanted, int numberLook); /// Update djs, weights for Devex using djs void djsAndDevex(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Update djs, weights for Steepest using djs void djsAndSteepest(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Update djs, weights for Devex using pivot row void djsAndDevex2(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Update djs, weights for Steepest using pivot row void djsAndSteepest2(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Update weights for Devex void justDevex(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Update weights for Steepest void justSteepest(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Updates two arrays for steepest void transposeTimes2(const CoinIndexedVector * pi1, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * dj2, CoinIndexedVector * spare, double scaleFactor); /// Updates weights - part 1 - also checks accuracy virtual void updateWeights(CoinIndexedVector * input); /// Checks accuracy - just for debug void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector * rowArray1, CoinIndexedVector * rowArray2); /// Initialize weights void initializeWeights(); /** Save weights - this may initialize weights as well mode is - 1) before factorization 2) after factorization 3) just redo infeasibilities 4) restore weights 5) at end of values pass (so need initialization) */ virtual void saveWeights(ClpSimplex * model, int mode); /// Gets rid of last update virtual void unrollWeights(); /// Gets rid of all arrays virtual void clearArrays(); /// Returns true if would not find any column virtual bool looksOptimal() const; /// Called when maximum pivots changes virtual void maximumPivotsChanged(); //@} /**@name gets and sets */ //@{ /// Mode inline int mode() const { return mode_; } /** Returns number of extra columns for sprint algorithm - 0 means off. Also number of iterations before recompute */ virtual int numberSprintColumns(int & numberIterations) const; /// Switch off sprint idea virtual void switchOffSprint(); //@} /** enums for persistence */ enum Persistence { normal = 0x00, // create (if necessary) and destroy keep = 0x01 // create (if necessary) and leave }; ///@name Constructors and destructors //@{ /** Default Constructor 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 and 2 depending on factorization 4 starts as partial dantzig/devex but then may switch between 0 and 2. By partial exact devex is meant that the weights are updated as normal but only part of the nonbasic variables are scanned. This can be faster on very easy problems. */ ClpPrimalColumnSteepest(int mode = 3); /// Copy constructor ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest & rhs); /// Assignment operator ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest& rhs); /// Destructor virtual ~ClpPrimalColumnSteepest (); /// Clone virtual ClpPrimalColumnPivot * clone(bool copyData = true) const; //@} ///@name Private functions to deal with devex /** reference would be faster using ClpSimplex's status_, but I prefer to keep modularity. */ inline bool reference(int i) const { return ((reference_[i>>5] >> (i & 31)) & 1) != 0; } inline void setReference(int i, bool trueFalse) { unsigned int & value = reference_[i>>5]; int bit = i & 31; if (trueFalse) value |= (1 << bit); else value &= ~(1 << bit); } /// Set/ get persistence inline void setPersistence(Persistence life) { persistence_ = life; } inline Persistence persistence() const { return persistence_ ; } //@} //--------------------------------------------------------------------------- private: ///@name Private member data // Update weight double devex_; /// weight array double * weights_; /// square of infeasibility array (just for infeasible columns) CoinIndexedVector * infeasible_; /// alternate weight array (so we can unroll) CoinIndexedVector * alternateWeights_; /// save weight array (so we can use checkpoint) double * savedWeights_; // Array for exact devex to say what is in reference framework unsigned int * reference_; /** Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number */ int state_; /** 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 and 2 depending on factorization 4 starts as partial dantzig/devex but then may switch between 0 and 2. 5 is always partial dantzig By partial exact devex is meant that the weights are updated as normal but only part of the nonbasic variables are scanned. This can be faster on very easy problems. New dubious option is >=10 which does mini-sprint */ int mode_; /// Life of weights Persistence persistence_; /// Number of times switched from partial dantzig to 0/2 int numberSwitched_; // This is pivot row (or pivot sequence round re-factorization) int pivotSequence_; // This is saved pivot sequence int savedPivotSequence_; // This is saved outgoing variable int savedSequenceOut_; // Iteration when last rectified int lastRectified_; // Size of factorization at invert (used to decide algorithm) int sizeFactorization_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpMessage.hpp0000644000175000017500000000613312124336572015365 0ustar renerene/* $Id: ClpMessage.hpp 1926 2013-03-26 15:23:38Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpMessage_H #define ClpMessage_H #include "CoinPragma.hpp" #include // This deals with Clp messages (as against Osi messages etc) #include "CoinMessageHandler.hpp" enum CLP_Message { CLP_SIMPLEX_FINISHED, CLP_SIMPLEX_INFEASIBLE, CLP_SIMPLEX_UNBOUNDED, CLP_SIMPLEX_STOPPED, CLP_SIMPLEX_ERROR, CLP_SIMPLEX_INTERRUPT, CLP_SIMPLEX_STATUS, CLP_DUAL_BOUNDS, CLP_SIMPLEX_ACCURACY, CLP_SIMPLEX_BADFACTOR, CLP_SIMPLEX_BOUNDTIGHTEN, CLP_SIMPLEX_INFEASIBILITIES, CLP_SIMPLEX_FLAG, CLP_SIMPLEX_GIVINGUP, CLP_DUAL_CHECKB, CLP_DUAL_ORIGINAL, CLP_SIMPLEX_PERTURB, CLP_PRIMAL_ORIGINAL, CLP_PRIMAL_WEIGHT, CLP_PRIMAL_OPTIMAL, CLP_SINGULARITIES, CLP_MODIFIEDBOUNDS, CLP_RIMSTATISTICS1, CLP_RIMSTATISTICS2, CLP_RIMSTATISTICS3, CLP_POSSIBLELOOP, CLP_SMALLELEMENTS, CLP_DUPLICATEELEMENTS, CLP_SIMPLEX_HOUSE1, CLP_SIMPLEX_HOUSE2, CLP_SIMPLEX_NONLINEAR, CLP_SIMPLEX_FREEIN, CLP_SIMPLEX_PIVOTROW, CLP_DUAL_CHECK, CLP_PRIMAL_DJ, CLP_PACKEDSCALE_INITIAL, CLP_PACKEDSCALE_WHILE, CLP_PACKEDSCALE_FINAL, CLP_PACKEDSCALE_FORGET, CLP_INITIALIZE_STEEP, CLP_UNABLE_OPEN, CLP_BAD_BOUNDS, CLP_BAD_MATRIX, CLP_LOOP, CLP_IMPORT_RESULT, CLP_IMPORT_ERRORS, CLP_EMPTY_PROBLEM, CLP_CRASH, CLP_END_VALUES_PASS, CLP_QUADRATIC_BOTH, CLP_QUADRATIC_PRIMAL_DETAILS, CLP_IDIOT_ITERATION, CLP_INFEASIBLE, CLP_MATRIX_CHANGE, CLP_TIMING, CLP_INTERVAL_TIMING, CLP_SPRINT, CLP_BARRIER_ITERATION, CLP_BARRIER_OBJECTIVE_GAP, CLP_BARRIER_GONE_INFEASIBLE, CLP_BARRIER_CLOSE_TO_OPTIMAL, CLP_BARRIER_COMPLEMENTARITY, CLP_BARRIER_EXIT2, CLP_BARRIER_STOPPING, CLP_BARRIER_EXIT, CLP_BARRIER_SCALING, CLP_BARRIER_MU, CLP_BARRIER_INFO, CLP_BARRIER_END, CLP_BARRIER_ACCURACY, CLP_BARRIER_SAFE, CLP_BARRIER_NEGATIVE_GAPS, CLP_BARRIER_REDUCING, CLP_BARRIER_DIAGONAL, CLP_BARRIER_SLACKS, CLP_BARRIER_DUALINF, CLP_BARRIER_KILLED, CLP_BARRIER_ABS_DROPPED, CLP_BARRIER_ABS_ERROR, CLP_BARRIER_FEASIBLE, CLP_BARRIER_STEP, CLP_BARRIER_KKT, CLP_RIM_SCALE, CLP_SLP_ITER, CLP_COMPLICATED_MODEL, CLP_BAD_STRING_VALUES, CLP_CRUNCH_STATS, CLP_PARAMETRICS_STATS, CLP_PARAMETRICS_STATS2, #ifndef NO_FATHOM_PRINT CLP_FATHOM_STATUS, CLP_FATHOM_SOLUTION, CLP_FATHOM_FINISH, #endif CLP_GENERAL, CLP_GENERAL2, CLP_GENERAL_WARNING, CLP_DUMMY_END }; /** This deals with Clp messages (as against Osi messages etc) */ class ClpMessage : public CoinMessages { public: /**@name Constructors etc */ //@{ /** Constructor */ ClpMessage(Language language = us_en); //@} }; #endif CoinMP-1.8.3/Clp/src/ClpCholeskyDense.cpp0000644000175000017500000017562412101105055016531 0ustar renerene/* $Id: ClpCholeskyDense.cpp 1910 2013-01-27 02:00:13Z stefan $ */ /* Copyright (C) 2003, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "ClpConfig.h" #include "ClpHelperFunctions.hpp" #include "ClpInterior.hpp" #include "ClpCholeskyDense.hpp" #include "ClpMessage.hpp" #include "ClpQuadraticObjective.hpp" #if CLP_HAS_ABC #include "CoinAbcCommon.hpp" #endif #if CLP_HAS_ABC<3 #undef cilk_for #undef cilk_spawn #undef cilk_sync #define cilk_for for #define cilk_spawn #define cilk_sync #endif /*#############################################################################*/ /* Constructors / Destructor / Assignment*/ /*#############################################################################*/ /*-------------------------------------------------------------------*/ /* Default Constructor */ /*-------------------------------------------------------------------*/ ClpCholeskyDense::ClpCholeskyDense () : ClpCholeskyBase(), borrowSpace_(false) { type_ = 11;; } /*-------------------------------------------------------------------*/ /* Copy constructor */ /*-------------------------------------------------------------------*/ ClpCholeskyDense::ClpCholeskyDense (const ClpCholeskyDense & rhs) : ClpCholeskyBase(rhs), borrowSpace_(rhs.borrowSpace_) { assert(!rhs.borrowSpace_ || !rhs.sizeFactor_); /* can't do if borrowing space*/ } /*-------------------------------------------------------------------*/ /* Destructor */ /*-------------------------------------------------------------------*/ ClpCholeskyDense::~ClpCholeskyDense () { if (borrowSpace_) { /* set NULL*/ sparseFactor_ = NULL; workDouble_ = NULL; diagonal_ = NULL; } } /*----------------------------------------------------------------*/ /* Assignment operator */ /*-------------------------------------------------------------------*/ ClpCholeskyDense & ClpCholeskyDense::operator=(const ClpCholeskyDense& rhs) { if (this != &rhs) { assert(!rhs.borrowSpace_ || !rhs.sizeFactor_); /* can't do if borrowing space*/ ClpCholeskyBase::operator=(rhs); borrowSpace_ = rhs.borrowSpace_; } return *this; } /*-------------------------------------------------------------------*/ /* Clone*/ /*-------------------------------------------------------------------*/ ClpCholeskyBase * ClpCholeskyDense::clone() const { return new ClpCholeskyDense(*this); } /* If not power of 2 then need to redo a bit*/ #define BLOCK 16 #define BLOCKSHIFT 4 /* Block unroll if power of 2 and at least 8*/ #define BLOCKUNROLL #define BLOCKSQ ( BLOCK*BLOCK ) #define BLOCKSQSHIFT ( BLOCKSHIFT+BLOCKSHIFT ) #define number_blocks(x) (((x)+BLOCK-1)>>BLOCKSHIFT) #define number_rows(x) ((x)<> BLOCKSHIFT; /* allow one stripe extra*/ numberBlocks = numberBlocks + ((numberBlocks * (numberBlocks + 1)) / 2); sizeFactor_ = numberBlocks * BLOCKSQ; /*#define CHOL_COMPARE*/ #ifdef CHOL_COMPARE sizeFactor_ += 95000; #endif if (!factor) { sparseFactor_ = new longDouble [sizeFactor_]; rowsDropped_ = new char [numberRows_]; memset(rowsDropped_, 0, numberRows_); workDouble_ = new longDouble[numberRows_]; diagonal_ = new longDouble[numberRows_]; } else { borrowSpace_ = true; int numberFull = factor->numberRows(); sparseFactor_ = factor->sparseFactor() + (factor->size() - sizeFactor_); workDouble_ = factor->workDouble() + (numberFull - numberRows_); diagonal_ = factor->diagonal() + (numberFull - numberRows_); } numberRowsDropped_ = 0; return 0; } /* Returns space needed */ CoinBigIndex ClpCholeskyDense::space( int numberRows) const { int numberBlocks = (numberRows + BLOCK - 1) >> BLOCKSHIFT; /* allow one stripe extra*/ numberBlocks = numberBlocks + ((numberBlocks * (numberBlocks + 1)) / 2); CoinBigIndex sizeFactor = numberBlocks * BLOCKSQ; #ifdef CHOL_COMPARE sizeFactor += 95000; #endif return sizeFactor; } /* Orders rows and saves pointer to matrix.and model */ int ClpCholeskyDense::order(ClpInterior * model) { model_ = model; int numberRows; int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); if (!doKKT_) { numberRows = numberRowsModel; } else { numberRows = 2 * numberRowsModel + numberColumns; } reserveSpace(NULL, numberRows); rowCopy_ = model->clpMatrix()->reverseOrderedCopy(); return 0; } /* Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ int ClpCholeskyDense::symbolic() { return 0; } /* Factorize - filling in rowsDropped and returning number dropped */ int ClpCholeskyDense::factorize(const CoinWorkDouble * diagonal, int * rowsDropped) { assert (!borrowSpace_); const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const double * element = model_->clpMatrix()->getElements(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); const double * elementByRow = rowCopy_->getElements(); int numberColumns = model_->clpMatrix()->getNumCols(); CoinZeroN(sparseFactor_, sizeFactor_); /*perturbation*/ CoinWorkDouble perturbation = model_->diagonalPerturbation() * model_->diagonalNorm(); perturbation = perturbation * perturbation; if (perturbation > 1.0) { #ifdef COIN_DEVELOP /*if (model_->model()->logLevel()&4) */ std::cout << "large perturbation " << perturbation << std::endl; #endif perturbation = CoinSqrt(perturbation);; perturbation = 1.0; } int iRow; int newDropped = 0; CoinWorkDouble largest = 1.0; CoinWorkDouble smallest = COIN_DBL_MAX; CoinWorkDouble delta2 = model_->delta(); /* add delta*delta to diagonal*/ delta2 *= delta2; if (!doKKT_) { longDouble * work = sparseFactor_; work--; /* skip diagonal*/ int addOffset = numberRows_ - 1; const CoinWorkDouble * diagonalSlack = diagonal + numberColumns; /* largest in initial matrix*/ CoinWorkDouble largest2 = 1.0e-20; for (iRow = 0; iRow < numberRows_; iRow++) { if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; CoinWorkDouble diagonalValue = diagonalSlack[iRow] + delta2; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; CoinWorkDouble multiplier = diagonal[iColumn] * elementByRow[k]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (!rowsDropped_[jRow]) { if (jRow > iRow) { CoinWorkDouble value = element[j] * multiplier; work[jRow] += value; } else if (jRow == iRow) { CoinWorkDouble value = element[j] * multiplier; diagonalValue += value; } } } } for (int j = iRow + 1; j < numberRows_; j++) largest2 = CoinMax(largest2, CoinAbs(work[j])); diagonal_[iRow] = diagonalValue; largest2 = CoinMax(largest2, CoinAbs(diagonalValue)); } else { /* dropped*/ diagonal_[iRow] = 1.0; } addOffset--; work += addOffset; } /*check sizes*/ largest2 *= 1.0e-20; largest = CoinMin(largest2, CHOL_SMALL_VALUE); int numberDroppedBefore = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int dropped = rowsDropped_[iRow]; /* Move to int array*/ rowsDropped[iRow] = dropped; if (!dropped) { CoinWorkDouble diagonal = diagonal_[iRow]; if (diagonal > largest2) { diagonal_[iRow] = diagonal + perturbation; } else { diagonal_[iRow] = diagonal + perturbation; rowsDropped[iRow] = 2; numberDroppedBefore++; } } } doubleParameters_[10] = CoinMax(1.0e-20, largest); integerParameters_[20] = 0; doubleParameters_[3] = 0.0; doubleParameters_[4] = COIN_DBL_MAX; integerParameters_[34] = 0; /* say all must be positive*/ #ifdef CHOL_COMPARE if (numberRows_ < 200) factorizePart3(rowsDropped); #endif factorizePart2(rowsDropped); newDropped = integerParameters_[20] + numberDroppedBefore; largest = doubleParameters_[3]; smallest = doubleParameters_[4]; if (model_->messageHandler()->logLevel() > 1) std::cout << "Cholesky - largest " << largest << " smallest " << smallest << std::endl; choleskyCondition_ = largest / smallest; /*drop fresh makes some formADAT easier*/ if (newDropped || numberRowsDropped_) { newDropped = 0; for (int i = 0; i < numberRows_; i++) { char dropped = static_cast(rowsDropped[i]); rowsDropped_[i] = dropped; if (dropped == 2) { /*dropped this time*/ rowsDropped[newDropped++] = i; rowsDropped_[i] = 0; } } numberRowsDropped_ = newDropped; newDropped = -(2 + newDropped); } } else { /* KKT*/ CoinPackedMatrix * quadratic = NULL; ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(model_->objectiveAsObject())); if (quadraticObj) quadratic = quadraticObj->quadraticObjective(); /* matrix*/ int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; longDouble * work = sparseFactor_; work--; /* skip diagonal*/ int addOffset = numberRows_ - 1; int iColumn; if (!quadratic) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinWorkDouble value = diagonal[iColumn]; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, CoinAbs(value)); diagonal_[iColumn] = -value; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { /*choleskyRow_[numberElements]=row[j]+numberTotal;*/ /*sparseFactor_[numberElements++]=element[j];*/ work[row[j] + numberTotal] = element[j]; largest = CoinMax(largest, CoinAbs(element[j])); } } else { diagonal_[iColumn] = -value; } addOffset--; work += addOffset; } } else { /* Quadratic*/ const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); const double * quadraticElement = quadratic->getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinWorkDouble value = diagonal[iColumn]; CoinBigIndex j; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; if (jColumn > iColumn) { work[jColumn] = -quadraticElement[j]; } else if (iColumn == jColumn) { value += quadraticElement[j]; } } largest = CoinMax(largest, CoinAbs(value)); diagonal_[iColumn] = -value; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (j = start; j < end; j++) { work[row[j] + numberTotal] = element[j]; largest = CoinMax(largest, CoinAbs(element[j])); } } else { value = 1.0e100; diagonal_[iColumn] = -value; } addOffset--; work += addOffset; } } /* slacks*/ for (iColumn = numberColumns; iColumn < numberTotal; iColumn++) { CoinWorkDouble value = diagonal[iColumn]; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, CoinAbs(value)); } else { value = 1.0e100; } diagonal_[iColumn] = -value; work[iColumn-numberColumns+numberTotal] = -1.0; addOffset--; work += addOffset; } /* Finish diagonal*/ for (iRow = 0; iRow < numberRowsModel; iRow++) { diagonal_[iRow+numberTotal] = delta2; } /*check sizes*/ largest *= 1.0e-20; largest = CoinMin(largest, CHOL_SMALL_VALUE); doubleParameters_[10] = CoinMax(1.0e-20, largest); integerParameters_[20] = 0; doubleParameters_[3] = 0.0; doubleParameters_[4] = COIN_DBL_MAX; /* Set up LDL cutoff*/ integerParameters_[34] = numberTotal; /* KKT*/ int * rowsDropped2 = new int[numberRows_]; CoinZeroN(rowsDropped2, numberRows_); #ifdef CHOL_COMPARE if (numberRows_ < 200) factorizePart3(rowsDropped2); #endif factorizePart2(rowsDropped2); newDropped = integerParameters_[20]; largest = doubleParameters_[3]; smallest = doubleParameters_[4]; if (model_->messageHandler()->logLevel() > 1) COIN_DETAIL_PRINT(std::cout << "Cholesky - largest " << largest << " smallest " << smallest << std::endl); choleskyCondition_ = largest / smallest; /* Should save adjustments in ..R_*/ int n1 = 0, n2 = 0; CoinWorkDouble * primalR = model_->primalR(); CoinWorkDouble * dualR = model_->dualR(); for (iRow = 0; iRow < numberTotal; iRow++) { if (rowsDropped2[iRow]) { n1++; /*printf("row region1 %d dropped\n",iRow);*/ /*rowsDropped_[iRow]=1;*/ rowsDropped_[iRow] = 0; primalR[iRow] = doubleParameters_[20]; } else { rowsDropped_[iRow] = 0; primalR[iRow] = 0.0; } } for (; iRow < numberRows_; iRow++) { if (rowsDropped2[iRow]) { n2++; /*printf("row region2 %d dropped\n",iRow);*/ /*rowsDropped_[iRow]=1;*/ rowsDropped_[iRow] = 0; dualR[iRow-numberTotal] = doubleParameters_[34]; } else { rowsDropped_[iRow] = 0; dualR[iRow-numberTotal] = 0.0; } } } return 0; } /* Factorize - filling in rowsDropped and returning number dropped */ void ClpCholeskyDense::factorizePart3( int * rowsDropped) { int iColumn; longDouble * xx = sparseFactor_; longDouble * yy = diagonal_; diagonal_ = sparseFactor_ + 40000; sparseFactor_ = diagonal_ + numberRows_; /*memcpy(sparseFactor_,xx,sizeFactor_*sizeof(double));*/ CoinMemcpyN(xx, 40000, sparseFactor_); CoinMemcpyN(yy, numberRows_, diagonal_); int numberDropped = 0; CoinWorkDouble largest = 0.0; CoinWorkDouble smallest = COIN_DBL_MAX; double dropValue = doubleParameters_[10]; int firstPositive = integerParameters_[34]; longDouble * work = sparseFactor_; /* Allow for triangular*/ int addOffset = numberRows_ - 1; work--; for (iColumn = 0; iColumn < numberRows_; iColumn++) { int iRow; int addOffsetNow = numberRows_ - 1;; longDouble * workNow = sparseFactor_ - 1 + iColumn; CoinWorkDouble diagonalValue = diagonal_[iColumn]; for (iRow = 0; iRow < iColumn; iRow++) { double aj = *workNow; addOffsetNow--; workNow += addOffsetNow; diagonalValue -= aj * aj * workDouble_[iRow]; } bool dropColumn = false; if (iColumn < firstPositive) { /* must be negative*/ if (diagonalValue <= -dropValue) { smallest = CoinMin(smallest, -diagonalValue); largest = CoinMax(largest, -diagonalValue); workDouble_[iColumn] = diagonalValue; diagonalValue = 1.0 / diagonalValue; } else { dropColumn = true; workDouble_[iColumn] = -1.0e100; diagonalValue = 0.0; integerParameters_[20]++; } } else { /* must be positive*/ if (diagonalValue >= dropValue) { smallest = CoinMin(smallest, diagonalValue); largest = CoinMax(largest, diagonalValue); workDouble_[iColumn] = diagonalValue; diagonalValue = 1.0 / diagonalValue; } else { dropColumn = true; workDouble_[iColumn] = 1.0e100; diagonalValue = 0.0; integerParameters_[20]++; } } if (!dropColumn) { diagonal_[iColumn] = diagonalValue; for (iRow = iColumn + 1; iRow < numberRows_; iRow++) { double value = work[iRow]; workNow = sparseFactor_ - 1; int addOffsetNow = numberRows_ - 1;; for (int jColumn = 0; jColumn < iColumn; jColumn++) { double aj = workNow[iColumn]; double multiplier = workDouble_[jColumn]; double ai = workNow[iRow]; addOffsetNow--; workNow += addOffsetNow; value -= aj * ai * multiplier; } work[iRow] = value * diagonalValue; } } else { /* drop column*/ rowsDropped[iColumn] = 2; numberDropped++; diagonal_[iColumn] = 0.0; for (iRow = iColumn + 1; iRow < numberRows_; iRow++) { work[iRow] = 0.0; } } addOffset--; work += addOffset; } doubleParameters_[3] = largest; doubleParameters_[4] = smallest; integerParameters_[20] = numberDropped; sparseFactor_ = xx; diagonal_ = yy; } /*#define POS_DEBUG*/ #ifdef POS_DEBUG static int counter = 0; int ClpCholeskyDense::bNumber(const longDouble * array, int &iRow, int &iCol) { int numberBlocks = (numberRows_ + BLOCK - 1) >> BLOCKSHIFT; longDouble * a = sparseFactor_ + BLOCKSQ * numberBlocks; int k = array - a; assert ((k % BLOCKSQ) == 0); iCol = 0; int kk = k >> BLOCKSQSHIFT; /*printf("%d %d %d %d\n",k,kk,BLOCKSQ,BLOCKSQSHIFT);*/ k = kk; while (k >= numberBlocks) { iCol++; k -= numberBlocks; numberBlocks--; } iRow = iCol + k; counter++; if(counter > 100000) exit(77); return kk; } #endif /* Factorize - filling in rowsDropped and returning number dropped */ void ClpCholeskyDense::factorizePart2( int * rowsDropped) { int iColumn; /*longDouble * xx = sparseFactor_;*/ /*longDouble * yy = diagonal_;*/ /*diagonal_ = sparseFactor_ + 40000;*/ /*sparseFactor_=diagonal_ + numberRows_;*/ /*memcpy(sparseFactor_,xx,sizeFactor_*sizeof(double));*/ /*memcpy(sparseFactor_,xx,40000*sizeof(double));*/ /*memcpy(diagonal_,yy,numberRows_*sizeof(double));*/ int numberBlocks = (numberRows_ + BLOCK - 1) >> BLOCKSHIFT; /* later align on boundary*/ longDouble * a = sparseFactor_ + BLOCKSQ * numberBlocks; int n = numberRows_; int nRound = numberRows_ & (~(BLOCK - 1)); /* adjust if exact*/ if (nRound == n) nRound -= BLOCK; int sizeLastBlock = n - nRound; int get = n * (n - 1) / 2; /* ? as no diagonal*/ int block = numberBlocks * (numberBlocks + 1) / 2; int ifOdd; int rowLast; if (sizeLastBlock != BLOCK) { longDouble * aa = &a[(block-1)*BLOCKSQ]; rowLast = nRound - 1; ifOdd = 1; int put = BLOCKSQ; /* do last separately*/ put -= (BLOCK - sizeLastBlock) * (BLOCK + 1); for (iColumn = numberRows_ - 1; iColumn >= nRound; iColumn--) { int put2 = put; put -= BLOCK; for (int iRow = numberRows_ - 1; iRow > iColumn; iRow--) { aa[--put2] = sparseFactor_[--get]; assert (aa + put2 >= sparseFactor_ + get); } /* save diagonal as well*/ aa[--put2] = diagonal_[iColumn]; } n = nRound; block--; } else { /* exact fit*/ rowLast = numberRows_ - 1; ifOdd = 0; } /* Now main loop*/ int nBlock = 0; for (; n > 0; n -= BLOCK) { longDouble * aa = &a[(block-1)*BLOCKSQ]; longDouble * aaLast = NULL; int put = BLOCKSQ; int putLast = 0; /* see if we have small block*/ if (ifOdd) { aaLast = &a[(block-1)*BLOCKSQ]; aa = aaLast - BLOCKSQ; putLast = BLOCKSQ - BLOCK + sizeLastBlock; } for (iColumn = n - 1; iColumn >= n - BLOCK; iColumn--) { if (aaLast) { /* last bit*/ for (int iRow = numberRows_ - 1; iRow > rowLast; iRow--) { aaLast[--putLast] = sparseFactor_[--get]; assert (aaLast + putLast >= sparseFactor_ + get); } putLast -= BLOCK - sizeLastBlock; } longDouble * aPut = aa; int j = rowLast; for (int jBlock = 0; jBlock <= nBlock; jBlock++) { int put2 = put; int last = CoinMax(j - BLOCK, iColumn); for (int iRow = j; iRow > last; iRow--) { aPut[--put2] = sparseFactor_[--get]; assert (aPut + put2 >= sparseFactor_ + get); } if (j - BLOCK < iColumn) { /* save diagonal as well*/ aPut[--put2] = diagonal_[iColumn]; } j -= BLOCK; aPut -= BLOCKSQ; } put -= BLOCK; } nBlock++; block -= nBlock + ifOdd; } ClpCholeskyDenseC info; info.diagonal_ = diagonal_; info.doubleParameters_[0] = doubleParameters_[10]; info.integerParameters_[0] = integerParameters_[34]; #ifndef CLP_CILK ClpCholeskyCfactor(&info, a, numberRows_, numberBlocks, diagonal_, workDouble_, rowsDropped); #else info.a = a; info.n = numberRows_; info.numberBlocks = numberBlocks; info.work = workDouble_; info.rowsDropped = rowsDropped; info.integerParameters_[1] = model_->numberThreads(); ClpCholeskySpawn(&info); #endif double largest = 0.0; double smallest = COIN_DBL_MAX; int numberDropped = 0; for (int i = 0; i < numberRows_; i++) { if (diagonal_[i]) { largest = CoinMax(largest, CoinAbs(diagonal_[i])); smallest = CoinMin(smallest, CoinAbs(diagonal_[i])); } else { numberDropped++; } } doubleParameters_[3] = CoinMax(doubleParameters_[3], 1.0 / smallest); doubleParameters_[4] = CoinMin(doubleParameters_[4], 1.0 / largest); integerParameters_[20] += numberDropped; } /* Non leaf recursive factor*/ void ClpCholeskyCfactor(ClpCholeskyDenseC * thisStruct, longDouble * a, int n, int numberBlocks, longDouble * diagonal, longDouble * work, int * rowsDropped) { if (n <= BLOCK) { ClpCholeskyCfactorLeaf(thisStruct, a, n, diagonal, work, rowsDropped); } else { int nb = number_blocks((n + 1) >> 1); int nThis = number_rows(nb); longDouble * aother; int nLeft = n - nThis; int nintri = (nb * (nb + 1)) >> 1; int nbelow = (numberBlocks - nb) * nb; ClpCholeskyCfactor(thisStruct, a, nThis, numberBlocks, diagonal, work, rowsDropped); ClpCholeskyCtriRec(thisStruct, a, nThis, a + number_entries(nb), diagonal, work, nLeft, nb, 0, numberBlocks); aother = a + number_entries(nintri + nbelow); ClpCholeskyCrecTri(thisStruct, a + number_entries(nb), nLeft, nThis, nb, 0, aother, diagonal, work, numberBlocks); ClpCholeskyCfactor(thisStruct, aother, nLeft, numberBlocks - nb, diagonal + nThis, work + nThis, rowsDropped); } } /* Non leaf recursive triangle rectangle update*/ void ClpCholeskyCtriRec(ClpCholeskyDenseC * thisStruct, longDouble * aTri, int nThis, longDouble * aUnder, longDouble * diagonal, longDouble * work, int nLeft, int iBlock, int jBlock, int numberBlocks) { if (nThis <= BLOCK && nLeft <= BLOCK) { ClpCholeskyCtriRecLeaf(/*thisStruct,*/ aTri, aUnder, diagonal, work, nLeft); } else if (nThis < nLeft) { int nb = number_blocks((nLeft + 1) >> 1); int nLeft2 = number_rows(nb); cilk_spawn ClpCholeskyCtriRec(thisStruct, aTri, nThis, aUnder, diagonal, work, nLeft2, iBlock, jBlock, numberBlocks); ClpCholeskyCtriRec(thisStruct, aTri, nThis, aUnder + number_entries(nb), diagonal, work, nLeft - nLeft2, iBlock + nb, jBlock, numberBlocks); cilk_sync; } else { int nb = number_blocks((nThis + 1) >> 1); int nThis2 = number_rows(nb); longDouble * aother; int kBlock = jBlock + nb; int i; int nintri = (nb * (nb + 1)) >> 1; int nbelow = (numberBlocks - nb) * nb; ClpCholeskyCtriRec(thisStruct, aTri, nThis2, aUnder, diagonal, work, nLeft, iBlock, jBlock, numberBlocks); /* and rectangular update */ i = ((numberBlocks - jBlock) * (numberBlocks - jBlock - 1) - (numberBlocks - jBlock - nb) * (numberBlocks - jBlock - nb - 1)) >> 1; aother = aUnder + number_entries(i); ClpCholeskyCrecRec(thisStruct, aTri + number_entries(nb), nThis - nThis2, nLeft, nThis2, aUnder, aother, work, kBlock, jBlock, numberBlocks); ClpCholeskyCtriRec(thisStruct, aTri + number_entries(nintri + nbelow), nThis - nThis2, aother, diagonal + nThis2, work + nThis2, nLeft, iBlock - nb, kBlock - nb, numberBlocks - nb); } } /* Non leaf recursive rectangle triangle update*/ void ClpCholeskyCrecTri(ClpCholeskyDenseC * thisStruct, longDouble * aUnder, int nTri, int nDo, int iBlock, int jBlock, longDouble * aTri, longDouble * diagonal, longDouble * work, int numberBlocks) { if (nTri <= BLOCK && nDo <= BLOCK) { ClpCholeskyCrecTriLeaf(/*thisStruct,*/ aUnder, aTri,/*diagonal,*/work, nTri); } else if (nTri < nDo) { int nb = number_blocks((nDo + 1) >> 1); int nDo2 = number_rows(nb); longDouble * aother; int i; ClpCholeskyCrecTri(thisStruct, aUnder, nTri, nDo2, iBlock, jBlock, aTri, diagonal, work, numberBlocks); i = ((numberBlocks - jBlock) * (numberBlocks - jBlock - 1) - (numberBlocks - jBlock - nb) * (numberBlocks - jBlock - nb - 1)) >> 1; aother = aUnder + number_entries(i); ClpCholeskyCrecTri(thisStruct, aother, nTri, nDo - nDo2, iBlock - nb, jBlock, aTri, diagonal + nDo2, work + nDo2, numberBlocks - nb); } else { int nb = number_blocks((nTri + 1) >> 1); int nTri2 = number_rows(nb); longDouble * aother; int i; cilk_spawn ClpCholeskyCrecTri(thisStruct, aUnder, nTri2, nDo, iBlock, jBlock, aTri, diagonal, work, numberBlocks); /* and rectangular update */ i = ((numberBlocks - iBlock) * (numberBlocks - iBlock + 1) - (numberBlocks - iBlock - nb) * (numberBlocks - iBlock - nb + 1)) >> 1; aother = aTri + number_entries(nb); ClpCholeskyCrecRec(thisStruct, aUnder, nTri2, nTri - nTri2, nDo, aUnder + number_entries(nb), aother, work, iBlock, jBlock, numberBlocks); ClpCholeskyCrecTri(thisStruct, aUnder + number_entries(nb), nTri - nTri2, nDo, iBlock + nb, jBlock, aTri + number_entries(i), diagonal, work, numberBlocks); cilk_sync; } } /* Non leaf recursive rectangle rectangle update, nUnder is number of rows in iBlock, nUnderK is number of rows in kBlock */ void ClpCholeskyCrecRec(ClpCholeskyDenseC * thisStruct, longDouble * above, int nUnder, int nUnderK, int nDo, longDouble * aUnder, longDouble *aOther, longDouble * work, int iBlock, int jBlock, int numberBlocks) { if (nDo <= BLOCK && nUnder <= BLOCK && nUnderK <= BLOCK) { assert (nDo == BLOCK && nUnder == BLOCK); ClpCholeskyCrecRecLeaf(/*thisStruct,*/ above , aUnder , aOther, work, nUnderK); } else if (nDo <= nUnderK && nUnder <= nUnderK) { int nb = number_blocks((nUnderK + 1) >> 1); int nUnder2 = number_rows(nb); cilk_spawn ClpCholeskyCrecRec(thisStruct, above, nUnder, nUnder2, nDo, aUnder, aOther, work, iBlock, jBlock, numberBlocks); ClpCholeskyCrecRec(thisStruct, above, nUnder, nUnderK - nUnder2, nDo, aUnder + number_entries(nb), aOther + number_entries(nb), work, iBlock, jBlock, numberBlocks); cilk_sync; } else if (nUnderK <= nDo && nUnder <= nDo) { int nb = number_blocks((nDo + 1) >> 1); int nDo2 = number_rows(nb); int i; ClpCholeskyCrecRec(thisStruct, above, nUnder, nUnderK, nDo2, aUnder, aOther, work, iBlock, jBlock, numberBlocks); i = ((numberBlocks - jBlock) * (numberBlocks - jBlock - 1) - (numberBlocks - jBlock - nb) * (numberBlocks - jBlock - nb - 1)) >> 1; ClpCholeskyCrecRec(thisStruct, above + number_entries(i), nUnder, nUnderK, nDo - nDo2, aUnder + number_entries(i), aOther, work + nDo2, iBlock - nb, jBlock, numberBlocks - nb); } else { int nb = number_blocks((nUnder + 1) >> 1); int nUnder2 = number_rows(nb); int i; cilk_spawn ClpCholeskyCrecRec(thisStruct, above, nUnder2, nUnderK, nDo, aUnder, aOther, work, iBlock, jBlock, numberBlocks); i = ((numberBlocks - iBlock) * (numberBlocks - iBlock - 1) - (numberBlocks - iBlock - nb) * (numberBlocks - iBlock - nb - 1)) >> 1; ClpCholeskyCrecRec(thisStruct, above + number_entries(nb), nUnder - nUnder2, nUnderK, nDo, aUnder, aOther + number_entries(i), work, iBlock + nb, jBlock, numberBlocks); cilk_sync; } } /* Leaf recursive factor*/ void ClpCholeskyCfactorLeaf(ClpCholeskyDenseC * thisStruct, longDouble * a, int n, longDouble * diagonal, longDouble * work, int * rowsDropped) { double dropValue = thisStruct->doubleParameters_[0]; int firstPositive = thisStruct->integerParameters_[0]; int rowOffset = static_cast(diagonal - thisStruct->diagonal_); int i, j, k; CoinWorkDouble t00, temp1; longDouble * aa; aa = a - BLOCK; for (j = 0; j < n; j ++) { bool dropColumn; CoinWorkDouble useT00; aa += BLOCK; t00 = aa[j]; for (k = 0; k < j; ++k) { CoinWorkDouble multiplier = work[k]; t00 -= a[j + k * BLOCK] * a[j + k * BLOCK] * multiplier; } dropColumn = false; useT00 = t00; if (j + rowOffset < firstPositive) { /* must be negative*/ if (t00 <= -dropValue) { /*aa[j]=t00;*/ t00 = 1.0 / t00; } else { dropColumn = true; /*aa[j]=-1.0e100;*/ useT00 = -1.0e-100; t00 = 0.0; } } else { /* must be positive*/ if (t00 >= dropValue) { /*aa[j]=t00;*/ t00 = 1.0 / t00; } else { dropColumn = true; /*aa[j]=1.0e100;*/ useT00 = 1.0e-100; t00 = 0.0; } } if (!dropColumn) { diagonal[j] = t00; work[j] = useT00; temp1 = t00; for (i = j + 1; i < n; i++) { t00 = aa[i]; for (k = 0; k < j; ++k) { CoinWorkDouble multiplier = work[k]; t00 -= a[i + k * BLOCK] * a[j + k * BLOCK] * multiplier; } aa[i] = t00 * temp1; } } else { /* drop column*/ rowsDropped[j+rowOffset] = 2; diagonal[j] = 0.0; /*aa[j]=1.0e100;*/ work[j] = 1.0e100; for (i = j + 1; i < n; i++) { aa[i] = 0.0; } } } } /* Leaf recursive triangle rectangle update*/ void ClpCholeskyCtriRecLeaf(/*ClpCholeskyDenseC * thisStruct,*/ longDouble * aTri, longDouble * aUnder, longDouble * diagonal, longDouble * work, int nUnder) { #ifdef POS_DEBUG int iru, icu; int iu = bNumber(aUnder, iru, icu); int irt, ict; int it = bNumber(aTri, irt, ict); /*printf("%d %d\n",iu,it);*/ printf("trirecleaf under (%d,%d), tri (%d,%d)\n", iru, icu, irt, ict); assert (diagonal == thisStruct->diagonal_ + ict * BLOCK); #endif int j; longDouble * aa; #ifdef BLOCKUNROLL if (nUnder == BLOCK) { aa = aTri - 2 * BLOCK; for (j = 0; j < BLOCK; j += 2) { int i; CoinWorkDouble temp0 = diagonal[j]; CoinWorkDouble temp1 = diagonal[j+1]; aa += 2 * BLOCK; for ( i = 0; i < BLOCK; i += 2) { CoinWorkDouble at1; CoinWorkDouble t00 = aUnder[i+j*BLOCK]; CoinWorkDouble t10 = aUnder[i+ BLOCK + j*BLOCK]; CoinWorkDouble t01 = aUnder[i+1+j*BLOCK]; CoinWorkDouble t11 = aUnder[i+1+ BLOCK + j*BLOCK]; int k; for (k = 0; k < j; ++k) { CoinWorkDouble multiplier = work[k]; CoinWorkDouble au0 = aUnder[i + k * BLOCK] * multiplier; CoinWorkDouble au1 = aUnder[i + 1 + k * BLOCK] * multiplier; CoinWorkDouble at0 = aTri[j + k * BLOCK]; CoinWorkDouble at1 = aTri[j + 1 + k * BLOCK]; t00 -= au0 * at0; t10 -= au0 * at1; t01 -= au1 * at0; t11 -= au1 * at1; } t00 *= temp0; at1 = aTri[j + 1 + j*BLOCK] * work[j]; t10 -= t00 * at1; t01 *= temp0; t11 -= t01 * at1; aUnder[i+j*BLOCK] = t00; aUnder[i+1+j*BLOCK] = t01; aUnder[i+ BLOCK + j*BLOCK] = t10 * temp1; aUnder[i+1+ BLOCK + j*BLOCK] = t11 * temp1; } } } else { #endif aa = aTri - BLOCK; for (j = 0; j < BLOCK; j ++) { int i; CoinWorkDouble temp1 = diagonal[j]; aa += BLOCK; for (i = 0; i < nUnder; i++) { int k; CoinWorkDouble t00 = aUnder[i+j*BLOCK]; for ( k = 0; k < j; ++k) { CoinWorkDouble multiplier = work[k]; t00 -= aUnder[i + k * BLOCK] * aTri[j + k * BLOCK] * multiplier; } aUnder[i+j*BLOCK] = t00 * temp1; } } #ifdef BLOCKUNROLL } #endif } /* Leaf recursive rectangle triangle update*/ void ClpCholeskyCrecTriLeaf(/*ClpCholeskyDenseC * thisStruct,*/ longDouble * aUnder, longDouble * aTri, /*longDouble * diagonal,*/ longDouble * work, int nUnder) { #ifdef POS_DEBUG int iru, icu; int iu = bNumber(aUnder, iru, icu); int irt, ict; int it = bNumber(aTri, irt, ict); /*printf("%d %d\n",iu,it);*/ printf("rectrileaf under (%d,%d), tri (%d,%d)\n", iru, icu, irt, ict); assert (diagonal == thisStruct->diagonal_ + icu * BLOCK); #endif int i, j, k; CoinWorkDouble t00; longDouble * aa; #ifdef BLOCKUNROLL if (nUnder == BLOCK) { longDouble * aUnder2 = aUnder - 2; aa = aTri - 2 * BLOCK; for (j = 0; j < BLOCK; j += 2) { CoinWorkDouble t00, t01, t10, t11; aa += 2 * BLOCK; aUnder2 += 2; t00 = aa[j]; t01 = aa[j+1]; t10 = aa[j+1+BLOCK]; for (k = 0; k < BLOCK; ++k) { CoinWorkDouble multiplier = work[k]; CoinWorkDouble a0 = aUnder2[k * BLOCK]; CoinWorkDouble a1 = aUnder2[1 + k * BLOCK]; CoinWorkDouble x0 = a0 * multiplier; CoinWorkDouble x1 = a1 * multiplier; t00 -= a0 * x0; t01 -= a1 * x0; t10 -= a1 * x1; } aa[j] = t00; aa[j+1] = t01; aa[j+1+BLOCK] = t10; for (i = j + 2; i < BLOCK; i += 2) { t00 = aa[i]; t01 = aa[i+BLOCK]; t10 = aa[i+1]; t11 = aa[i+1+BLOCK]; for (k = 0; k < BLOCK; ++k) { CoinWorkDouble multiplier = work[k]; CoinWorkDouble a0 = aUnder2[k * BLOCK] * multiplier; CoinWorkDouble a1 = aUnder2[1 + k * BLOCK] * multiplier; t00 -= aUnder[i + k * BLOCK] * a0; t01 -= aUnder[i + k * BLOCK] * a1; t10 -= aUnder[i + 1 + k * BLOCK] * a0; t11 -= aUnder[i + 1 + k * BLOCK] * a1; } aa[i] = t00; aa[i+BLOCK] = t01; aa[i+1] = t10; aa[i+1+BLOCK] = t11; } } } else { #endif aa = aTri - BLOCK; for (j = 0; j < nUnder; j ++) { aa += BLOCK; for (i = j; i < nUnder; i++) { t00 = aa[i]; for (k = 0; k < BLOCK; ++k) { CoinWorkDouble multiplier = work[k]; t00 -= aUnder[i + k * BLOCK] * aUnder[j + k * BLOCK] * multiplier; } aa[i] = t00; } } #ifdef BLOCKUNROLL } #endif } /* Leaf recursive rectangle rectangle update, nUnder is number of rows in iBlock, nUnderK is number of rows in kBlock */ void ClpCholeskyCrecRecLeaf(/*ClpCholeskyDenseC * thisStruct,*/ const longDouble * COIN_RESTRICT above, const longDouble * COIN_RESTRICT aUnder, longDouble * COIN_RESTRICT aOther, const longDouble * COIN_RESTRICT work, int nUnder) { #ifdef POS_DEBUG int ira, ica; int ia = bNumber(above, ira, ica); int iru, icu; int iu = bNumber(aUnder, iru, icu); int iro, ico; int io = bNumber(aOther, iro, ico); /*printf("%d %d %d\n",ia,iu,io);*/ printf("recrecleaf above (%d,%d), under (%d,%d), other (%d,%d)\n", ira, ica, iru, icu, iro, ico); #endif int i, j, k; longDouble * aa; #ifdef BLOCKUNROLL aa = aOther - 4 * BLOCK; if (nUnder == BLOCK) { /*#define INTEL*/ #ifdef INTEL aa += 2 * BLOCK; for (j = 0; j < BLOCK; j += 2) { aa += 2 * BLOCK; for (i = 0; i < BLOCK; i += 2) { CoinWorkDouble t00 = aa[i+0*BLOCK]; CoinWorkDouble t10 = aa[i+1*BLOCK]; CoinWorkDouble t01 = aa[i+1+0*BLOCK]; CoinWorkDouble t11 = aa[i+1+1*BLOCK]; for (k = 0; k < BLOCK; k++) { CoinWorkDouble multiplier = work[k]; CoinWorkDouble a00 = aUnder[i+k*BLOCK] * multiplier; CoinWorkDouble a01 = aUnder[i+1+k*BLOCK] * multiplier; t00 -= a00 * above[j + 0 + k * BLOCK]; t10 -= a00 * above[j + 1 + k * BLOCK]; t01 -= a01 * above[j + 0 + k * BLOCK]; t11 -= a01 * above[j + 1 + k * BLOCK]; } aa[i+0*BLOCK] = t00; aa[i+1*BLOCK] = t10; aa[i+1+0*BLOCK] = t01; aa[i+1+1*BLOCK] = t11; } } #else for (j = 0; j < BLOCK; j += 4) { aa += 4 * BLOCK; for (i = 0; i < BLOCK; i += 4) { CoinWorkDouble t00 = aa[i+0+0*BLOCK]; CoinWorkDouble t10 = aa[i+0+1*BLOCK]; CoinWorkDouble t20 = aa[i+0+2*BLOCK]; CoinWorkDouble t30 = aa[i+0+3*BLOCK]; CoinWorkDouble t01 = aa[i+1+0*BLOCK]; CoinWorkDouble t11 = aa[i+1+1*BLOCK]; CoinWorkDouble t21 = aa[i+1+2*BLOCK]; CoinWorkDouble t31 = aa[i+1+3*BLOCK]; CoinWorkDouble t02 = aa[i+2+0*BLOCK]; CoinWorkDouble t12 = aa[i+2+1*BLOCK]; CoinWorkDouble t22 = aa[i+2+2*BLOCK]; CoinWorkDouble t32 = aa[i+2+3*BLOCK]; CoinWorkDouble t03 = aa[i+3+0*BLOCK]; CoinWorkDouble t13 = aa[i+3+1*BLOCK]; CoinWorkDouble t23 = aa[i+3+2*BLOCK]; CoinWorkDouble t33 = aa[i+3+3*BLOCK]; const longDouble * COIN_RESTRICT aUnderNow = aUnder + i; const longDouble * COIN_RESTRICT aboveNow = above + j; for (k = 0; k < BLOCK; k++) { CoinWorkDouble multiplier = work[k]; CoinWorkDouble a00 = aUnderNow[0] * multiplier; CoinWorkDouble a01 = aUnderNow[1] * multiplier; CoinWorkDouble a02 = aUnderNow[2] * multiplier; CoinWorkDouble a03 = aUnderNow[3] * multiplier; t00 -= a00 * aboveNow[0]; t10 -= a00 * aboveNow[1]; t20 -= a00 * aboveNow[2]; t30 -= a00 * aboveNow[3]; t01 -= a01 * aboveNow[0]; t11 -= a01 * aboveNow[1]; t21 -= a01 * aboveNow[2]; t31 -= a01 * aboveNow[3]; t02 -= a02 * aboveNow[0]; t12 -= a02 * aboveNow[1]; t22 -= a02 * aboveNow[2]; t32 -= a02 * aboveNow[3]; t03 -= a03 * aboveNow[0]; t13 -= a03 * aboveNow[1]; t23 -= a03 * aboveNow[2]; t33 -= a03 * aboveNow[3]; aUnderNow += BLOCK; aboveNow += BLOCK; } aa[i+0+0*BLOCK] = t00; aa[i+0+1*BLOCK] = t10; aa[i+0+2*BLOCK] = t20; aa[i+0+3*BLOCK] = t30; aa[i+1+0*BLOCK] = t01; aa[i+1+1*BLOCK] = t11; aa[i+1+2*BLOCK] = t21; aa[i+1+3*BLOCK] = t31; aa[i+2+0*BLOCK] = t02; aa[i+2+1*BLOCK] = t12; aa[i+2+2*BLOCK] = t22; aa[i+2+3*BLOCK] = t32; aa[i+3+0*BLOCK] = t03; aa[i+3+1*BLOCK] = t13; aa[i+3+2*BLOCK] = t23; aa[i+3+3*BLOCK] = t33; } } #endif } else { int odd = nUnder & 1; int n = nUnder - odd; for (j = 0; j < BLOCK; j += 4) { aa += 4 * BLOCK; for (i = 0; i < n; i += 2) { CoinWorkDouble t00 = aa[i+0*BLOCK]; CoinWorkDouble t10 = aa[i+1*BLOCK]; CoinWorkDouble t20 = aa[i+2*BLOCK]; CoinWorkDouble t30 = aa[i+3*BLOCK]; CoinWorkDouble t01 = aa[i+1+0*BLOCK]; CoinWorkDouble t11 = aa[i+1+1*BLOCK]; CoinWorkDouble t21 = aa[i+1+2*BLOCK]; CoinWorkDouble t31 = aa[i+1+3*BLOCK]; const longDouble * COIN_RESTRICT aUnderNow = aUnder + i; const longDouble * COIN_RESTRICT aboveNow = above + j; for (k = 0; k < BLOCK; k++) { CoinWorkDouble multiplier = work[k]; CoinWorkDouble a00 = aUnderNow[0] * multiplier; CoinWorkDouble a01 = aUnderNow[1] * multiplier; t00 -= a00 * aboveNow[0]; t10 -= a00 * aboveNow[1]; t20 -= a00 * aboveNow[2]; t30 -= a00 * aboveNow[3]; t01 -= a01 * aboveNow[0]; t11 -= a01 * aboveNow[1]; t21 -= a01 * aboveNow[2]; t31 -= a01 * aboveNow[3]; aUnderNow += BLOCK; aboveNow += BLOCK; } aa[i+0*BLOCK] = t00; aa[i+1*BLOCK] = t10; aa[i+2*BLOCK] = t20; aa[i+3*BLOCK] = t30; aa[i+1+0*BLOCK] = t01; aa[i+1+1*BLOCK] = t11; aa[i+1+2*BLOCK] = t21; aa[i+1+3*BLOCK] = t31; } if (odd) { CoinWorkDouble t0 = aa[n+0*BLOCK]; CoinWorkDouble t1 = aa[n+1*BLOCK]; CoinWorkDouble t2 = aa[n+2*BLOCK]; CoinWorkDouble t3 = aa[n+3*BLOCK]; CoinWorkDouble a0; for (k = 0; k < BLOCK; k++) { a0 = aUnder[n+k*BLOCK] * work[k]; t0 -= a0 * above[j + 0 + k * BLOCK]; t1 -= a0 * above[j + 1 + k * BLOCK]; t2 -= a0 * above[j + 2 + k * BLOCK]; t3 -= a0 * above[j + 3 + k * BLOCK]; } aa[n+0*BLOCK] = t0; aa[n+1*BLOCK] = t1; aa[n+2*BLOCK] = t2; aa[n+3*BLOCK] = t3; } } } #else aa = aOther - BLOCK; for (j = 0; j < BLOCK; j ++) { aa += BLOCK; for (i = 0; i < nUnder; i++) { CoinWorkDouble t00 = aa[i+0*BLOCK]; for (k = 0; k < BLOCK; k++) { CoinWorkDouble a00 = aUnder[i+k*BLOCK] * work[k]; t00 -= a00 * above[j + k * BLOCK]; } aa[i] = t00; } } #endif } /* Uses factorization to solve. */ void ClpCholeskyDense::solve (CoinWorkDouble * region) { #ifdef CHOL_COMPARE double * region2 = NULL; if (numberRows_ < 200) { longDouble * xx = sparseFactor_; longDouble * yy = diagonal_; diagonal_ = sparseFactor_ + 40000; sparseFactor_ = diagonal_ + numberRows_; region2 = ClpCopyOfArray(region, numberRows_); int iRow, iColumn; int addOffset = numberRows_ - 1; longDouble * work = sparseFactor_ - 1; for (iColumn = 0; iColumn < numberRows_; iColumn++) { double value = region2[iColumn]; for (iRow = iColumn + 1; iRow < numberRows_; iRow++) region2[iRow] -= value * work[iRow]; addOffset--; work += addOffset; } for (iColumn = numberRows_ - 1; iColumn >= 0; iColumn--) { double value = region2[iColumn] * diagonal_[iColumn]; work -= addOffset; addOffset++; for (iRow = iColumn + 1; iRow < numberRows_; iRow++) value -= region2[iRow] * work[iRow]; region2[iColumn] = value; } sparseFactor_ = xx; diagonal_ = yy; } #endif /*longDouble * xx = sparseFactor_;*/ /*longDouble * yy = diagonal_;*/ /*diagonal_ = sparseFactor_ + 40000;*/ /*sparseFactor_=diagonal_ + numberRows_;*/ int numberBlocks = (numberRows_ + BLOCK - 1) >> BLOCKSHIFT; /* later align on boundary*/ longDouble * a = sparseFactor_ + BLOCKSQ * numberBlocks; int iBlock; longDouble * aa = a; int iColumn; for (iBlock = 0; iBlock < numberBlocks; iBlock++) { int nChunk; int jBlock; int iDo = iBlock * BLOCK; int base = iDo; if (iDo + BLOCK > numberRows_) { nChunk = numberRows_ - iDo; } else { nChunk = BLOCK; } solveF1(aa, nChunk, region + iDo); for (jBlock = iBlock + 1; jBlock < numberBlocks; jBlock++) { base += BLOCK; aa += BLOCKSQ; if (base + BLOCK > numberRows_) { nChunk = numberRows_ - base; } else { nChunk = BLOCK; } solveF2(aa, nChunk, region + iDo, region + base); } aa += BLOCKSQ; } /* do diagonal outside*/ for (iColumn = 0; iColumn < numberRows_; iColumn++) region[iColumn] *= diagonal_[iColumn]; int offset = ((numberBlocks * (numberBlocks + 1)) >> 1); aa = a + number_entries(offset - 1); int lBase = (numberBlocks - 1) * BLOCK; for (iBlock = numberBlocks - 1; iBlock >= 0; iBlock--) { int nChunk; int jBlock; int triBase = iBlock * BLOCK; int iBase = lBase; for (jBlock = iBlock + 1; jBlock < numberBlocks; jBlock++) { if (iBase + BLOCK > numberRows_) { nChunk = numberRows_ - iBase; } else { nChunk = BLOCK; } solveB2(aa, nChunk, region + triBase, region + iBase); iBase -= BLOCK; aa -= BLOCKSQ; } if (triBase + BLOCK > numberRows_) { nChunk = numberRows_ - triBase; } else { nChunk = BLOCK; } solveB1(aa, nChunk, region + triBase); aa -= BLOCKSQ; } #ifdef CHOL_COMPARE if (numberRows_ < 200) { for (int i = 0; i < numberRows_; i++) { assert(CoinAbs(region[i] - region2[i]) < 1.0e-3); } delete [] region2; } #endif } /* Forward part of solve 1*/ void ClpCholeskyDense::solveF1(longDouble * a, int n, CoinWorkDouble * region) { int j, k; CoinWorkDouble t00; for (j = 0; j < n; j ++) { t00 = region[j]; for (k = 0; k < j; ++k) { t00 -= region[k] * a[j + k * BLOCK]; } /*t00*=a[j + j * BLOCK];*/ region[j] = t00; } } /* Forward part of solve 2*/ void ClpCholeskyDense::solveF2(longDouble * a, int n, CoinWorkDouble * region, CoinWorkDouble * region2) { int j, k; #ifdef BLOCKUNROLL if (n == BLOCK) { for (k = 0; k < BLOCK; k += 4) { CoinWorkDouble t0 = region2[0]; CoinWorkDouble t1 = region2[1]; CoinWorkDouble t2 = region2[2]; CoinWorkDouble t3 = region2[3]; t0 -= region[0] * a[0 + 0 * BLOCK]; t1 -= region[0] * a[1 + 0 * BLOCK]; t2 -= region[0] * a[2 + 0 * BLOCK]; t3 -= region[0] * a[3 + 0 * BLOCK]; t0 -= region[1] * a[0 + 1 * BLOCK]; t1 -= region[1] * a[1 + 1 * BLOCK]; t2 -= region[1] * a[2 + 1 * BLOCK]; t3 -= region[1] * a[3 + 1 * BLOCK]; t0 -= region[2] * a[0 + 2 * BLOCK]; t1 -= region[2] * a[1 + 2 * BLOCK]; t2 -= region[2] * a[2 + 2 * BLOCK]; t3 -= region[2] * a[3 + 2 * BLOCK]; t0 -= region[3] * a[0 + 3 * BLOCK]; t1 -= region[3] * a[1 + 3 * BLOCK]; t2 -= region[3] * a[2 + 3 * BLOCK]; t3 -= region[3] * a[3 + 3 * BLOCK]; t0 -= region[4] * a[0 + 4 * BLOCK]; t1 -= region[4] * a[1 + 4 * BLOCK]; t2 -= region[4] * a[2 + 4 * BLOCK]; t3 -= region[4] * a[3 + 4 * BLOCK]; t0 -= region[5] * a[0 + 5 * BLOCK]; t1 -= region[5] * a[1 + 5 * BLOCK]; t2 -= region[5] * a[2 + 5 * BLOCK]; t3 -= region[5] * a[3 + 5 * BLOCK]; t0 -= region[6] * a[0 + 6 * BLOCK]; t1 -= region[6] * a[1 + 6 * BLOCK]; t2 -= region[6] * a[2 + 6 * BLOCK]; t3 -= region[6] * a[3 + 6 * BLOCK]; t0 -= region[7] * a[0 + 7 * BLOCK]; t1 -= region[7] * a[1 + 7 * BLOCK]; t2 -= region[7] * a[2 + 7 * BLOCK]; t3 -= region[7] * a[3 + 7 * BLOCK]; #if BLOCK>8 t0 -= region[8] * a[0 + 8 * BLOCK]; t1 -= region[8] * a[1 + 8 * BLOCK]; t2 -= region[8] * a[2 + 8 * BLOCK]; t3 -= region[8] * a[3 + 8 * BLOCK]; t0 -= region[9] * a[0 + 9 * BLOCK]; t1 -= region[9] * a[1 + 9 * BLOCK]; t2 -= region[9] * a[2 + 9 * BLOCK]; t3 -= region[9] * a[3 + 9 * BLOCK]; t0 -= region[10] * a[0 + 10 * BLOCK]; t1 -= region[10] * a[1 + 10 * BLOCK]; t2 -= region[10] * a[2 + 10 * BLOCK]; t3 -= region[10] * a[3 + 10 * BLOCK]; t0 -= region[11] * a[0 + 11 * BLOCK]; t1 -= region[11] * a[1 + 11 * BLOCK]; t2 -= region[11] * a[2 + 11 * BLOCK]; t3 -= region[11] * a[3 + 11 * BLOCK]; t0 -= region[12] * a[0 + 12 * BLOCK]; t1 -= region[12] * a[1 + 12 * BLOCK]; t2 -= region[12] * a[2 + 12 * BLOCK]; t3 -= region[12] * a[3 + 12 * BLOCK]; t0 -= region[13] * a[0 + 13 * BLOCK]; t1 -= region[13] * a[1 + 13 * BLOCK]; t2 -= region[13] * a[2 + 13 * BLOCK]; t3 -= region[13] * a[3 + 13 * BLOCK]; t0 -= region[14] * a[0 + 14 * BLOCK]; t1 -= region[14] * a[1 + 14 * BLOCK]; t2 -= region[14] * a[2 + 14 * BLOCK]; t3 -= region[14] * a[3 + 14 * BLOCK]; t0 -= region[15] * a[0 + 15 * BLOCK]; t1 -= region[15] * a[1 + 15 * BLOCK]; t2 -= region[15] * a[2 + 15 * BLOCK]; t3 -= region[15] * a[3 + 15 * BLOCK]; #endif region2[0] = t0; region2[1] = t1; region2[2] = t2; region2[3] = t3; region2 += 4; a += 4; } } else { #endif for (k = 0; k < n; ++k) { CoinWorkDouble t00 = region2[k]; for (j = 0; j < BLOCK; j ++) { t00 -= region[j] * a[k + j * BLOCK]; } region2[k] = t00; } #ifdef BLOCKUNROLL } #endif } /* Backward part of solve 1*/ void ClpCholeskyDense::solveB1(longDouble * a, int n, CoinWorkDouble * region) { int j, k; CoinWorkDouble t00; for (j = n - 1; j >= 0; j --) { t00 = region[j]; for (k = j + 1; k < n; ++k) { t00 -= region[k] * a[k + j * BLOCK]; } /*t00*=a[j + j * BLOCK];*/ region[j] = t00; } } /* Backward part of solve 2*/ void ClpCholeskyDense::solveB2(longDouble * a, int n, CoinWorkDouble * region, CoinWorkDouble * region2) { int j, k; #ifdef BLOCKUNROLL if (n == BLOCK) { for (j = 0; j < BLOCK; j += 4) { CoinWorkDouble t0 = region[0]; CoinWorkDouble t1 = region[1]; CoinWorkDouble t2 = region[2]; CoinWorkDouble t3 = region[3]; t0 -= region2[0] * a[0 + 0*BLOCK]; t1 -= region2[0] * a[0 + 1*BLOCK]; t2 -= region2[0] * a[0 + 2*BLOCK]; t3 -= region2[0] * a[0 + 3*BLOCK]; t0 -= region2[1] * a[1 + 0*BLOCK]; t1 -= region2[1] * a[1 + 1*BLOCK]; t2 -= region2[1] * a[1 + 2*BLOCK]; t3 -= region2[1] * a[1 + 3*BLOCK]; t0 -= region2[2] * a[2 + 0*BLOCK]; t1 -= region2[2] * a[2 + 1*BLOCK]; t2 -= region2[2] * a[2 + 2*BLOCK]; t3 -= region2[2] * a[2 + 3*BLOCK]; t0 -= region2[3] * a[3 + 0*BLOCK]; t1 -= region2[3] * a[3 + 1*BLOCK]; t2 -= region2[3] * a[3 + 2*BLOCK]; t3 -= region2[3] * a[3 + 3*BLOCK]; t0 -= region2[4] * a[4 + 0*BLOCK]; t1 -= region2[4] * a[4 + 1*BLOCK]; t2 -= region2[4] * a[4 + 2*BLOCK]; t3 -= region2[4] * a[4 + 3*BLOCK]; t0 -= region2[5] * a[5 + 0*BLOCK]; t1 -= region2[5] * a[5 + 1*BLOCK]; t2 -= region2[5] * a[5 + 2*BLOCK]; t3 -= region2[5] * a[5 + 3*BLOCK]; t0 -= region2[6] * a[6 + 0*BLOCK]; t1 -= region2[6] * a[6 + 1*BLOCK]; t2 -= region2[6] * a[6 + 2*BLOCK]; t3 -= region2[6] * a[6 + 3*BLOCK]; t0 -= region2[7] * a[7 + 0*BLOCK]; t1 -= region2[7] * a[7 + 1*BLOCK]; t2 -= region2[7] * a[7 + 2*BLOCK]; t3 -= region2[7] * a[7 + 3*BLOCK]; #if BLOCK>8 t0 -= region2[8] * a[8 + 0*BLOCK]; t1 -= region2[8] * a[8 + 1*BLOCK]; t2 -= region2[8] * a[8 + 2*BLOCK]; t3 -= region2[8] * a[8 + 3*BLOCK]; t0 -= region2[9] * a[9 + 0*BLOCK]; t1 -= region2[9] * a[9 + 1*BLOCK]; t2 -= region2[9] * a[9 + 2*BLOCK]; t3 -= region2[9] * a[9 + 3*BLOCK]; t0 -= region2[10] * a[10 + 0*BLOCK]; t1 -= region2[10] * a[10 + 1*BLOCK]; t2 -= region2[10] * a[10 + 2*BLOCK]; t3 -= region2[10] * a[10 + 3*BLOCK]; t0 -= region2[11] * a[11 + 0*BLOCK]; t1 -= region2[11] * a[11 + 1*BLOCK]; t2 -= region2[11] * a[11 + 2*BLOCK]; t3 -= region2[11] * a[11 + 3*BLOCK]; t0 -= region2[12] * a[12 + 0*BLOCK]; t1 -= region2[12] * a[12 + 1*BLOCK]; t2 -= region2[12] * a[12 + 2*BLOCK]; t3 -= region2[12] * a[12 + 3*BLOCK]; t0 -= region2[13] * a[13 + 0*BLOCK]; t1 -= region2[13] * a[13 + 1*BLOCK]; t2 -= region2[13] * a[13 + 2*BLOCK]; t3 -= region2[13] * a[13 + 3*BLOCK]; t0 -= region2[14] * a[14 + 0*BLOCK]; t1 -= region2[14] * a[14 + 1*BLOCK]; t2 -= region2[14] * a[14 + 2*BLOCK]; t3 -= region2[14] * a[14 + 3*BLOCK]; t0 -= region2[15] * a[15 + 0*BLOCK]; t1 -= region2[15] * a[15 + 1*BLOCK]; t2 -= region2[15] * a[15 + 2*BLOCK]; t3 -= region2[15] * a[15 + 3*BLOCK]; #endif region[0] = t0; region[1] = t1; region[2] = t2; region[3] = t3; a += 4 * BLOCK; region += 4; } } else { #endif for (j = 0; j < BLOCK; j ++) { CoinWorkDouble t00 = region[j]; for (k = 0; k < n; ++k) { t00 -= region2[k] * a[k + j * BLOCK]; } region[j] = t00; } #ifdef BLOCKUNROLL } #endif } CoinMP-1.8.3/Clp/src/unitTest.cpp0000644000175000017500000034555612017705027015167 0ustar renerene/* $Id: unitTest.cpp 1878 2012-08-30 15:43:19Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef NDEBUG #undef NDEBUG #endif #include "ClpConfig.h" #include "CoinPragma.hpp" #include #include #include #include #include #include #include #include "CoinMpsIO.hpp" #include "CoinPackedMatrix.hpp" #include "CoinPackedVector.hpp" #include "CoinStructuredModel.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "CoinFloatEqual.hpp" #if CLP_HAS_ABC #include "CoinAbcCommon.hpp" #endif #ifdef ABC_INHERIT #include "CoinAbcFactorization.hpp" #endif #include "ClpFactorization.hpp" #include "ClpSimplex.hpp" #include "ClpSimplexOther.hpp" #include "ClpSimplexNonlinear.hpp" #include "ClpInterior.hpp" #include "ClpLinearObjective.hpp" #include "ClpDualRowSteepest.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "ClpPrimalColumnDantzig.hpp" #include "ClpParameters.hpp" #include "ClpNetworkMatrix.hpp" #include "ClpPlusMinusOneMatrix.hpp" #include "MyMessageHandler.hpp" #include "MyEventHandler.hpp" #include "ClpPresolve.hpp" #include "Idiot.hpp" #if FACTORIZATION_STATISTICS extern double ftranTwiddleFactor1X; extern double ftranTwiddleFactor2X; extern double ftranFTTwiddleFactor1X; extern double ftranFTTwiddleFactor2X; extern double btranTwiddleFactor1X; extern double btranTwiddleFactor2X; extern double ftranFullTwiddleFactor1X; extern double ftranFullTwiddleFactor2X; extern double btranFullTwiddleFactor1X; extern double btranFullTwiddleFactor2X; extern double denseThresholdX; extern double twoThresholdX; extern double minRowsSparse; extern double largeRowsSparse; extern double mediumRowsDivider; extern double mediumRowsMinCount; extern double largeRowsCount; #endif //############################################################################# // Function Prototypes. Function definitions is in this file. void testingMessage( const char * const msg ); #if defined(COIN_HAS_AMD) || defined(COIN_HAS_CHOLMOD) || defined(COIN_HAS_GLPK) static int barrierAvailable = 1; static std::string nameBarrier = "barrier-UFL"; #elif COIN_HAS_WSMP static int barrierAvailable = 2; static std::string nameBarrier = "barrier-WSSMP"; #elif defined(COIN_HAS_MUMPS) static int barrierAvailable = 3; static std::string nameBarrier = "barrier-MUMPS"; #else static int barrierAvailable = 0; static std::string nameBarrier = "barrier-slow"; #endif #define NUMBER_ALGORITHMS 12 // If you just want a subset then set some to 1 static int switchOff[NUMBER_ALGORITHMS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // shortName - 0 no , 1 yes ClpSolve setupForSolve(int algorithm, std::string & nameAlgorithm, int shortName) { ClpSolve solveOptions; /* algorithms are 0 barrier 1 dual with volumne crash 2,3 dual with and without crash 4,5 primal with and without 6,7 automatic with and without 8,9 primal with idiot 1 and 5 10,11 primal with 70, dual with volume */ switch (algorithm) { case 0: if (shortName) nameAlgorithm = "ba"; else nameAlgorithm = "nameBarrier"; solveOptions.setSolveType(ClpSolve::useBarrier); if (barrierAvailable == 1) solveOptions.setSpecialOption(4, 4); else if (barrierAvailable == 2) solveOptions.setSpecialOption(4, 2); break; case 1: #ifdef COIN_HAS_VOL if (shortName) nameAlgorithm = "du-vol-50"; else nameAlgorithm = "dual-volume-50"; solveOptions.setSolveType(ClpSolve::useDual); solveOptions.setSpecialOption(0, 2, 50); // volume #else solveOptions.setSolveType(ClpSolve::notImplemented); #endif break; case 2: if (shortName) nameAlgorithm = "du-cr"; else nameAlgorithm = "dual-crash"; solveOptions.setSolveType(ClpSolve::useDual); solveOptions.setSpecialOption(0, 1); break; case 3: if (shortName) nameAlgorithm = "du"; else nameAlgorithm = "dual"; solveOptions.setSolveType(ClpSolve::useDual); break; case 4: if (shortName) nameAlgorithm = "pr-cr"; else nameAlgorithm = "primal-crash"; solveOptions.setSolveType(ClpSolve::usePrimal); solveOptions.setSpecialOption(1, 1); break; case 5: if (shortName) nameAlgorithm = "pr"; else nameAlgorithm = "primal"; solveOptions.setSolveType(ClpSolve::usePrimal); break; case 6: if (shortName) nameAlgorithm = "au-cr"; else nameAlgorithm = "either-crash"; solveOptions.setSolveType(ClpSolve::automatic); solveOptions.setSpecialOption(1, 1); break; case 7: if (shortName) nameAlgorithm = "au"; else nameAlgorithm = "either"; solveOptions.setSolveType(ClpSolve::automatic); break; case 8: if (shortName) nameAlgorithm = "pr-id-1"; else nameAlgorithm = "primal-idiot-1"; solveOptions.setSolveType(ClpSolve::usePrimalorSprint); solveOptions.setSpecialOption(1, 2, 1); // idiot break; case 9: if (shortName) nameAlgorithm = "pr-id-5"; else nameAlgorithm = "primal-idiot-5"; solveOptions.setSolveType(ClpSolve::usePrimalorSprint); solveOptions.setSpecialOption(1, 2, 5); // idiot break; case 10: if (shortName) nameAlgorithm = "pr-id-70"; else nameAlgorithm = "primal-idiot-70"; solveOptions.setSolveType(ClpSolve::usePrimalorSprint); solveOptions.setSpecialOption(1, 2, 70); // idiot break; case 11: #ifdef COIN_HAS_VOL if (shortName) nameAlgorithm = "du-vol"; else nameAlgorithm = "dual-volume"; solveOptions.setSolveType(ClpSolve::useDual); solveOptions.setSpecialOption(0, 2, 3000); // volume #else solveOptions.setSolveType(ClpSolve::notImplemented); #endif break; default: abort(); } if (shortName) { // can switch off if (switchOff[algorithm]) solveOptions.setSolveType(ClpSolve::notImplemented); } return solveOptions; } static void printSol(ClpSimplex & model) { int numberRows = model.numberRows(); int numberColumns = model.numberColumns(); double * rowPrimal = model.primalRowSolution(); double * rowDual = model.dualRowSolution(); double * rowLower = model.rowLower(); double * rowUpper = model.rowUpper(); int iRow; double objValue = model.getObjValue(); printf("Objvalue %g Rows (%d)\n", objValue, numberRows); for (iRow = 0; iRow < numberRows; iRow++) { printf("%d primal %g dual %g low %g up %g\n", iRow, rowPrimal[iRow], rowDual[iRow], rowLower[iRow], rowUpper[iRow]); } double * columnPrimal = model.primalColumnSolution(); double * columnDual = model.dualColumnSolution(); double * columnLower = model.columnLower(); double * columnUpper = model.columnUpper(); double offset; //const double * gradient = model.objectiveAsObject()->gradient(&model, // columnPrimal,offset,true,1); const double * gradient = model.objective(columnPrimal, offset); int iColumn; objValue = -offset - model.objectiveOffset(); printf("offset %g (%g)\n", offset, model.objectiveOffset()); printf("Columns (%d)\n", numberColumns); for (iColumn = 0; iColumn < numberColumns; iColumn++) { printf("%d primal %g dual %g low %g up %g\n", iColumn, columnPrimal[iColumn], columnDual[iColumn], columnLower[iColumn], columnUpper[iColumn]); objValue += columnPrimal[iColumn] * gradient[iColumn]; if (fabs(columnPrimal[iColumn]*gradient[iColumn]) > 1.0e-8) printf("obj -> %g gradient %g\n", objValue, gradient[iColumn]); } printf("Computed objective %g\n", objValue); } void usage(const std::string& key) { std::cerr << "Undefined parameter \"" << key << "\".\n" << "Correct usage: \n" << " clp [-dirSample=V1] [-dirNetlib=V2] [-netlib]\n" << " where:\n" << " -dirSample: directory containing mps test files\n" << " Default value V1=\"../../Data/Sample\"\n" << " -dirNetlib: directory containing netlib files\"\n" << " Default value V2=\"../../Data/Netlib\"\n" << " -netlib\n" << " If specified, then netlib testset run as well as the nitTest.\n"; } #if FACTORIZATION_STATISTICS int loSizeX=-1; int hiSizeX=1000000; #endif //---------------------------------------------------------------- #ifndef ABC_INHERIT #define AnySimplex ClpSimplex #else #include "AbcSimplex.hpp" #define AnySimplex AbcSimplex #endif int mainTest (int argc, const char *argv[], int algorithm, AnySimplex empty, ClpSolve solveOptionsIn, int switchOffValue, bool doVector) { int i; if (switchOffValue > 0) { // switch off some int iTest; for (iTest = 0; iTest < NUMBER_ALGORITHMS; iTest++) { #ifndef NDEBUG int bottom = switchOffValue % 10; assert (bottom == 0 || bottom == 1); #endif switchOffValue /= 10; switchOff[iTest] = 0; } } int numberFailures=0; // define valid parameter keywords std::set definedKeyWords; definedKeyWords.insert("-dirSample"); definedKeyWords.insert("-dirNetlib"); definedKeyWords.insert("-netlib"); // Create a map of parameter keys and associated data std::map parms; for ( i = 1; i < argc; i++ ) { std::string parm(argv[i]); std::string key, value; std::string::size_type eqPos = parm.find('='); // Does parm contain and '=' if ( eqPos == std::string::npos ) { //Parm does not contain '=' key = parm; } else { key = parm.substr(0, eqPos); value = parm.substr(eqPos + 1); } // Is specifed key valid? if ( definedKeyWords.find(key) == definedKeyWords.end() ) { // invalid key word. // Write help text usage(key); return 1; } parms[key] = value; } const char dirsep = CoinFindDirSeparator(); // Set directory containing mps data files. std::string dirSample; if (parms.find("-dirSample") != parms.end()) dirSample = parms["-dirSample"]; else dirSample = dirsep == '/' ? "../../Data/Sample/" : "..\\..\\Data\\Sample\\"; // Set directory containing netlib data files. std::string dirNetlib; if (parms.find("-dirNetlib") != parms.end()) dirNetlib = parms["-dirNetlib"]; else dirNetlib = dirsep == '/' ? "../../Data/Netlib/" : "..\\..\\Data\\Netlib\\"; #if 0 //FACTORIZATION_STATISTICS==0 if (!empty.numberRows()) { testingMessage( "Testing ClpSimplex\n" ); ClpSimplexUnitTest(dirSample); } #endif if (parms.find("-netlib") != parms.end() || empty.numberRows()) { unsigned int m; std::string sizeLoHi; #if FACTORIZATION_STATISTICS double ftranTwiddleFactor1XChoice[3]={0.9,1.0,1.1}; double ftranTwiddleFactor2XChoice[3]={0.9,1.0,1.1}; double ftranFTTwiddleFactor1XChoice[3]={0.9,1.0,1.1}; double ftranFTTwiddleFactor2XChoice[3]={0.9,1.0,1.1}; double btranTwiddleFactor1XChoice[3]={0.9,1.0,1.1}; double btranTwiddleFactor2XChoice[3]={0.9,1.0,1.1}; double ftranFullTwiddleFactor1XChoice[3]={0.9,1.0,1.1}; double ftranFullTwiddleFactor2XChoice[3]={0.9,1.0,1.1}; double btranFullTwiddleFactor1XChoice[3]={0.9,1.0,1.1}; double btranFullTwiddleFactor2XChoice[3]={0.9,1.0,1.1}; double denseThresholdXChoice[3]={2,20,40}; double twoThresholdXChoice[3]={800,1000,1200}; double minRowsSparseChoice[3]={250,300,350}; double largeRowsSparseChoice[3]={8000,10000,12000}; double mediumRowsDividerChoice[3]={5,6,7}; double mediumRowsMinCountChoice[3]={300,500,600}; double largeRowsCountChoice[3]={700,1000,1300}; double times[3*3*3*3*3]; memset(times,0,sizeof(times)); #define whichParam(za,zname) const char * choice##za=#zname; \ const double * use##za=zname##Choice; \ double * external##za=&zname whichParam(A,denseThresholdX); whichParam(B,twoThresholdX); whichParam(C,minRowsSparse); whichParam(D,mediumRowsDivider); whichParam(E,mediumRowsMinCount); #endif // Define test problems: // mps names, // maximization or minimization, // Number of rows and columns in problem, and // objective function value std::vector mpsName; std::vector min; std::vector nRows; std::vector nCols; std::vector objValue; std::vector objValueTol; // 100 added means no presolve std::vector bestStrategy; if(empty.numberRows()) { std::string alg; for (int iTest = 0; iTest < NUMBER_ALGORITHMS; iTest++) { ClpSolve solveOptions = setupForSolve(iTest, alg, 0); printf("%d %s ", iTest, alg.c_str()); if (switchOff[iTest]) printf("skipped by user\n"); else if(solveOptions.getSolveType() == ClpSolve::notImplemented) printf("skipped as not available\n"); else printf("will be tested\n"); } } if (!empty.numberRows()) { #if 1 mpsName.push_back("25fv47"); min.push_back(true); nRows.push_back(822); nCols.push_back(1571); objValueTol.push_back(1.E-10); objValue.push_back(5.5018458883E+03); bestStrategy.push_back(0); mpsName.push_back("80bau3b"); min.push_back(true); nRows.push_back(2263); nCols.push_back(9799); objValueTol.push_back(1.e-8); objValue.push_back(9.8722419241E+05); bestStrategy.push_back(3); mpsName.push_back("blend"); min.push_back(true); nRows.push_back(75); nCols.push_back(83); objValueTol.push_back(1.e-8); objValue.push_back(-3.0812149846e+01); bestStrategy.push_back(3); mpsName.push_back("pilotnov"); min.push_back(true); nRows.push_back(976); nCols.push_back(2172); objValueTol.push_back(1.e-10); objValue.push_back(-4.4972761882e+03); bestStrategy.push_back(3); mpsName.push_back("maros-r7"); min.push_back(true); nRows.push_back(3137); nCols.push_back(9408); objValueTol.push_back(1.e-10); objValue.push_back(1.4971851665e+06); bestStrategy.push_back(2); mpsName.push_back("pilot"); min.push_back(true); nRows.push_back(1442); nCols.push_back(3652); objValueTol.push_back(1.e-5); objValue.push_back(/*-5.5740430007e+02*/ -557.48972927292); bestStrategy.push_back(3); mpsName.push_back("pilot4"); min.push_back(true); nRows.push_back(411); nCols.push_back(1000); objValueTol.push_back(5.e-5); objValue.push_back(-2.5811392641e+03); bestStrategy.push_back(3); #endif mpsName.push_back("pilot87"); min.push_back(true); nRows.push_back(2031); nCols.push_back(4883); objValueTol.push_back(1.e-4); objValue.push_back(3.0171072827e+02); bestStrategy.push_back(0); #if 1 mpsName.push_back("adlittle"); min.push_back(true); nRows.push_back(57); nCols.push_back(97); objValueTol.push_back(1.e-10); objValue.push_back(2.2549496316e+05); bestStrategy.push_back(3); mpsName.push_back("afiro"); min.push_back(true); nRows.push_back(28); nCols.push_back(32); objValueTol.push_back(1.e-10); objValue.push_back(-4.6475314286e+02); bestStrategy.push_back(3); mpsName.push_back("agg"); min.push_back(true); nRows.push_back(489); nCols.push_back(163); objValueTol.push_back(1.e-10); objValue.push_back(-3.5991767287e+07); bestStrategy.push_back(3); mpsName.push_back("agg2"); min.push_back(true); nRows.push_back(517); nCols.push_back(302); objValueTol.push_back(1.e-10); objValue.push_back(-2.0239252356e+07); bestStrategy.push_back(3); mpsName.push_back("agg3"); min.push_back(true); nRows.push_back(517); nCols.push_back(302); objValueTol.push_back(1.e-10); objValue.push_back(1.0312115935e+07); bestStrategy.push_back(4); mpsName.push_back("bandm"); min.push_back(true); nRows.push_back(306); nCols.push_back(472); objValueTol.push_back(1.e-10); objValue.push_back(-1.5862801845e+02); bestStrategy.push_back(2); mpsName.push_back("beaconfd"); min.push_back(true); nRows.push_back(174); nCols.push_back(262); objValueTol.push_back(1.e-10); objValue.push_back(3.3592485807e+04); bestStrategy.push_back(0); mpsName.push_back("bnl1"); min.push_back(true); nRows.push_back(644); nCols.push_back(1175); objValueTol.push_back(1.e-10); objValue.push_back(1.9776295615E+03); bestStrategy.push_back(3); mpsName.push_back("bnl2"); min.push_back(true); nRows.push_back(2325); nCols.push_back(3489); objValueTol.push_back(1.e-10); objValue.push_back(1.8112365404e+03); bestStrategy.push_back(3); mpsName.push_back("boeing1"); min.push_back(true); nRows.push_back(/*351*/352); nCols.push_back(384); objValueTol.push_back(1.e-10); objValue.push_back(-3.3521356751e+02); bestStrategy.push_back(3); mpsName.push_back("boeing2"); min.push_back(true); nRows.push_back(167); nCols.push_back(143); objValueTol.push_back(1.e-10); objValue.push_back(-3.1501872802e+02); bestStrategy.push_back(3); mpsName.push_back("bore3d"); min.push_back(true); nRows.push_back(234); nCols.push_back(315); objValueTol.push_back(1.e-10); objValue.push_back(1.3730803942e+03); bestStrategy.push_back(3); mpsName.push_back("brandy"); min.push_back(true); nRows.push_back(221); nCols.push_back(249); objValueTol.push_back(1.e-10); objValue.push_back(1.5185098965e+03); bestStrategy.push_back(3); mpsName.push_back("capri"); min.push_back(true); nRows.push_back(272); nCols.push_back(353); objValueTol.push_back(1.e-10); objValue.push_back(2.6900129138e+03); bestStrategy.push_back(3); mpsName.push_back("cycle"); min.push_back(true); nRows.push_back(1904); nCols.push_back(2857); objValueTol.push_back(1.e-9); objValue.push_back(-5.2263930249e+00); bestStrategy.push_back(3); mpsName.push_back("czprob"); min.push_back(true); nRows.push_back(930); nCols.push_back(3523); objValueTol.push_back(1.e-10); objValue.push_back(2.1851966989e+06); bestStrategy.push_back(3); mpsName.push_back("d2q06c"); min.push_back(true); nRows.push_back(2172); nCols.push_back(5167); objValueTol.push_back(1.e-7); objValue.push_back(122784.21557456); bestStrategy.push_back(0); mpsName.push_back("d6cube"); min.push_back(true); nRows.push_back(416); nCols.push_back(6184); objValueTol.push_back(1.e-7); objValue.push_back(3.1549166667e+02); bestStrategy.push_back(3); mpsName.push_back("degen2"); min.push_back(true); nRows.push_back(445); nCols.push_back(534); objValueTol.push_back(1.e-10); objValue.push_back(-1.4351780000e+03); bestStrategy.push_back(3); mpsName.push_back("degen3"); min.push_back(true); nRows.push_back(1504); nCols.push_back(1818); objValueTol.push_back(1.e-10); objValue.push_back(-9.8729400000e+02); bestStrategy.push_back(2); mpsName.push_back("dfl001"); min.push_back(true); nRows.push_back(6072); nCols.push_back(12230); objValueTol.push_back(1.e-5); objValue.push_back(1.1266396047E+07); bestStrategy.push_back(5); mpsName.push_back("e226"); min.push_back(true); nRows.push_back(224); nCols.push_back(282); objValueTol.push_back(1.e-10); objValue.push_back(-1.8751929066e+01 + 7.113); bestStrategy.push_back(3); // The correct answer includes -7.113 term. This is a constant in the objective function. See line 1683 of the mps file. mpsName.push_back("etamacro"); min.push_back(true); nRows.push_back(401); nCols.push_back(688); objValueTol.push_back(1.e-6); objValue.push_back(-7.5571521774e+02 ); bestStrategy.push_back(3); mpsName.push_back("fffff800"); min.push_back(true); nRows.push_back(525); nCols.push_back(854); objValueTol.push_back(1.e-6); objValue.push_back(5.5567961165e+05); bestStrategy.push_back(3); mpsName.push_back("finnis"); min.push_back(true); nRows.push_back(498); nCols.push_back(614); objValueTol.push_back(1.e-6); objValue.push_back(1.7279096547e+05); bestStrategy.push_back(3); mpsName.push_back("fit1d"); min.push_back(true); nRows.push_back(25); nCols.push_back(1026); objValueTol.push_back(1.e-10); objValue.push_back(-9.1463780924e+03); bestStrategy.push_back(3 + 100); mpsName.push_back("fit1p"); min.push_back(true); nRows.push_back(628); nCols.push_back(1677); objValueTol.push_back(1.e-10); objValue.push_back(9.1463780924e+03); bestStrategy.push_back(5 + 100); mpsName.push_back("fit2d"); min.push_back(true); nRows.push_back(26); nCols.push_back(10500); objValueTol.push_back(1.e-10); objValue.push_back(-6.8464293294e+04); bestStrategy.push_back(3 + 100); mpsName.push_back("fit2p"); min.push_back(true); nRows.push_back(3001); nCols.push_back(13525); objValueTol.push_back(1.e-9); objValue.push_back(6.8464293232e+04); bestStrategy.push_back(5 + 100); mpsName.push_back("forplan"); min.push_back(true); nRows.push_back(162); nCols.push_back(421); objValueTol.push_back(1.e-6); objValue.push_back(-6.6421873953e+02); bestStrategy.push_back(3); mpsName.push_back("ganges"); min.push_back(true); nRows.push_back(1310); nCols.push_back(1681); objValueTol.push_back(1.e-5); objValue.push_back(-1.0958636356e+05); bestStrategy.push_back(3); mpsName.push_back("gfrd-pnc"); min.push_back(true); nRows.push_back(617); nCols.push_back(1092); objValueTol.push_back(1.e-10); objValue.push_back(6.9022359995e+06); bestStrategy.push_back(3); mpsName.push_back("greenbea"); min.push_back(true); nRows.push_back(2393); nCols.push_back(5405); objValueTol.push_back(1.e-10); objValue.push_back(/*-7.2462405908e+07*/ -72555248.129846); bestStrategy.push_back(3); mpsName.push_back("greenbeb"); min.push_back(true); nRows.push_back(2393); nCols.push_back(5405); objValueTol.push_back(1.e-10); objValue.push_back(/*-4.3021476065e+06*/ -4302260.2612066); bestStrategy.push_back(3); mpsName.push_back("grow15"); min.push_back(true); nRows.push_back(301); nCols.push_back(645); objValueTol.push_back(1.e-10); objValue.push_back(-1.0687094129e+08); bestStrategy.push_back(4 + 100); mpsName.push_back("grow22"); min.push_back(true); nRows.push_back(441); nCols.push_back(946); objValueTol.push_back(1.e-10); objValue.push_back(-1.6083433648e+08); bestStrategy.push_back(4 + 100); mpsName.push_back("grow7"); min.push_back(true); nRows.push_back(141); nCols.push_back(301); objValueTol.push_back(1.e-10); objValue.push_back(-4.7787811815e+07); bestStrategy.push_back(4 + 100); mpsName.push_back("israel"); min.push_back(true); nRows.push_back(175); nCols.push_back(142); objValueTol.push_back(1.e-10); objValue.push_back(-8.9664482186e+05); bestStrategy.push_back(2); mpsName.push_back("kb2"); min.push_back(true); nRows.push_back(44); nCols.push_back(41); objValueTol.push_back(1.e-10); objValue.push_back(-1.7499001299e+03); bestStrategy.push_back(3); mpsName.push_back("lotfi"); min.push_back(true); nRows.push_back(154); nCols.push_back(308); objValueTol.push_back(1.e-10); objValue.push_back(-2.5264706062e+01); bestStrategy.push_back(3); mpsName.push_back("maros"); min.push_back(true); nRows.push_back(847); nCols.push_back(1443); objValueTol.push_back(1.e-10); objValue.push_back(-5.8063743701e+04); bestStrategy.push_back(3); mpsName.push_back("modszk1"); min.push_back(true); nRows.push_back(688); nCols.push_back(1620); objValueTol.push_back(1.e-10); objValue.push_back(3.2061972906e+02); bestStrategy.push_back(3); mpsName.push_back("nesm"); min.push_back(true); nRows.push_back(663); nCols.push_back(2923); objValueTol.push_back(1.e-5); objValue.push_back(1.4076073035e+07); bestStrategy.push_back(2); mpsName.push_back("perold"); min.push_back(true); nRows.push_back(626); nCols.push_back(1376); objValueTol.push_back(1.e-6); objValue.push_back(-9.3807580773e+03); bestStrategy.push_back(3); //mpsName.push_back("qap12");min.push_back(true);nRows.push_back(3193);nCols.push_back(8856);objValueTol.push_back(1.e-6);objValue.push_back(5.2289435056e+02);bestStrategy.push_back(3); //mpsName.push_back("qap15");min.push_back(true);nRows.push_back(6331);nCols.push_back(22275);objValueTol.push_back(1.e-10);objValue.push_back(1.0409940410e+03);bestStrategy.push_back(3); mpsName.push_back("recipe"); min.push_back(true); nRows.push_back(92); nCols.push_back(180); objValueTol.push_back(1.e-10); objValue.push_back(-2.6661600000e+02); bestStrategy.push_back(3); mpsName.push_back("sc105"); min.push_back(true); nRows.push_back(106); nCols.push_back(103); objValueTol.push_back(1.e-10); objValue.push_back(-5.2202061212e+01); bestStrategy.push_back(3); mpsName.push_back("sc205"); min.push_back(true); nRows.push_back(206); nCols.push_back(203); objValueTol.push_back(1.e-10); objValue.push_back(-5.2202061212e+01); bestStrategy.push_back(3); mpsName.push_back("sc50a"); min.push_back(true); nRows.push_back(51); nCols.push_back(48); objValueTol.push_back(1.e-10); objValue.push_back(-6.4575077059e+01); bestStrategy.push_back(3); mpsName.push_back("sc50b"); min.push_back(true); nRows.push_back(51); nCols.push_back(48); objValueTol.push_back(1.e-10); objValue.push_back(-7.0000000000e+01); bestStrategy.push_back(3); mpsName.push_back("scagr25"); min.push_back(true); nRows.push_back(472); nCols.push_back(500); objValueTol.push_back(1.e-10); objValue.push_back(-1.4753433061e+07); bestStrategy.push_back(3); mpsName.push_back("scagr7"); min.push_back(true); nRows.push_back(130); nCols.push_back(140); objValueTol.push_back(1.e-6); objValue.push_back(-2.3313892548e+06); bestStrategy.push_back(3); mpsName.push_back("scfxm1"); min.push_back(true); nRows.push_back(331); nCols.push_back(457); objValueTol.push_back(1.e-10); objValue.push_back(1.8416759028e+04); bestStrategy.push_back(3); mpsName.push_back("scfxm2"); min.push_back(true); nRows.push_back(661); nCols.push_back(914); objValueTol.push_back(1.e-10); objValue.push_back(3.6660261565e+04); bestStrategy.push_back(3); mpsName.push_back("scfxm3"); min.push_back(true); nRows.push_back(991); nCols.push_back(1371); objValueTol.push_back(1.e-10); objValue.push_back(5.4901254550e+04); bestStrategy.push_back(3); mpsName.push_back("scorpion"); min.push_back(true); nRows.push_back(389); nCols.push_back(358); objValueTol.push_back(1.e-10); objValue.push_back(1.8781248227e+03); bestStrategy.push_back(3); mpsName.push_back("scrs8"); min.push_back(true); nRows.push_back(491); nCols.push_back(1169); objValueTol.push_back(1.e-5); objValue.push_back(9.0429998619e+02); bestStrategy.push_back(2); mpsName.push_back("scsd1"); min.push_back(true); nRows.push_back(78); nCols.push_back(760); objValueTol.push_back(1.e-10); objValue.push_back(8.6666666743e+00); bestStrategy.push_back(3 + 100); mpsName.push_back("scsd6"); min.push_back(true); nRows.push_back(148); nCols.push_back(1350); objValueTol.push_back(1.e-10); objValue.push_back(5.0500000078e+01); bestStrategy.push_back(3 + 100); mpsName.push_back("scsd8"); min.push_back(true); nRows.push_back(398); nCols.push_back(2750); objValueTol.push_back(1.e-10); objValue.push_back(9.0499999993e+02); bestStrategy.push_back(1 + 100); mpsName.push_back("sctap1"); min.push_back(true); nRows.push_back(301); nCols.push_back(480); objValueTol.push_back(1.e-10); objValue.push_back(1.4122500000e+03); bestStrategy.push_back(3); mpsName.push_back("sctap2"); min.push_back(true); nRows.push_back(1091); nCols.push_back(1880); objValueTol.push_back(1.e-10); objValue.push_back(1.7248071429e+03); bestStrategy.push_back(3); mpsName.push_back("sctap3"); min.push_back(true); nRows.push_back(1481); nCols.push_back(2480); objValueTol.push_back(1.e-10); objValue.push_back(1.4240000000e+03); bestStrategy.push_back(3); mpsName.push_back("seba"); min.push_back(true); nRows.push_back(516); nCols.push_back(1028); objValueTol.push_back(1.e-10); objValue.push_back(1.5711600000e+04); bestStrategy.push_back(3); mpsName.push_back("share1b"); min.push_back(true); nRows.push_back(118); nCols.push_back(225); objValueTol.push_back(1.e-10); objValue.push_back(-7.6589318579e+04); bestStrategy.push_back(3); mpsName.push_back("share2b"); min.push_back(true); nRows.push_back(97); nCols.push_back(79); objValueTol.push_back(1.e-10); objValue.push_back(-4.1573224074e+02); bestStrategy.push_back(3); mpsName.push_back("shell"); min.push_back(true); nRows.push_back(537); nCols.push_back(1775); objValueTol.push_back(1.e-10); objValue.push_back(1.2088253460e+09); bestStrategy.push_back(3); mpsName.push_back("ship04l"); min.push_back(true); nRows.push_back(403); nCols.push_back(2118); objValueTol.push_back(1.e-10); objValue.push_back(1.7933245380e+06); bestStrategy.push_back(3); mpsName.push_back("ship04s"); min.push_back(true); nRows.push_back(403); nCols.push_back(1458); objValueTol.push_back(1.e-10); objValue.push_back(1.7987147004e+06); bestStrategy.push_back(3); mpsName.push_back("ship08l"); min.push_back(true); nRows.push_back(779); nCols.push_back(4283); objValueTol.push_back(1.e-10); objValue.push_back(1.9090552114e+06); bestStrategy.push_back(3); mpsName.push_back("ship08s"); min.push_back(true); nRows.push_back(779); nCols.push_back(2387); objValueTol.push_back(1.e-10); objValue.push_back(1.9200982105e+06); bestStrategy.push_back(2); mpsName.push_back("ship12l"); min.push_back(true); nRows.push_back(1152); nCols.push_back(5427); objValueTol.push_back(1.e-10); objValue.push_back(1.4701879193e+06); bestStrategy.push_back(3); mpsName.push_back("ship12s"); min.push_back(true); nRows.push_back(1152); nCols.push_back(2763); objValueTol.push_back(1.e-10); objValue.push_back(1.4892361344e+06); bestStrategy.push_back(2); mpsName.push_back("sierra"); min.push_back(true); nRows.push_back(1228); nCols.push_back(2036); objValueTol.push_back(1.e-10); objValue.push_back(1.5394362184e+07); bestStrategy.push_back(3); mpsName.push_back("stair"); min.push_back(true); nRows.push_back(357); nCols.push_back(467); objValueTol.push_back(1.e-10); objValue.push_back(-2.5126695119e+02); bestStrategy.push_back(3); mpsName.push_back("standata"); min.push_back(true); nRows.push_back(360); nCols.push_back(1075); objValueTol.push_back(1.e-10); objValue.push_back(1.2576995000e+03); bestStrategy.push_back(3); //mpsName.push_back("standgub");min.push_back(true);nRows.push_back(362);nCols.push_back(1184);objValueTol.push_back(1.e-10);objValue.push_back(1257.6995); bestStrategy.push_back(3); mpsName.push_back("standmps"); min.push_back(true); nRows.push_back(468); nCols.push_back(1075); objValueTol.push_back(1.e-10); objValue.push_back(1.4060175000E+03); bestStrategy.push_back(3); mpsName.push_back("stocfor1"); min.push_back(true); nRows.push_back(118); nCols.push_back(111); objValueTol.push_back(1.e-10); objValue.push_back(-4.1131976219E+04); bestStrategy.push_back(3); mpsName.push_back("stocfor2"); min.push_back(true); nRows.push_back(2158); nCols.push_back(2031); objValueTol.push_back(1.e-10); objValue.push_back(-3.9024408538e+04); bestStrategy.push_back(3); //mpsName.push_back("stocfor3");min.push_back(true);nRows.push_back(16676);nCols.push_back(15695);objValueTol.push_back(1.e-10);objValue.push_back(-3.9976661576e+04);bestStrategy.push_back(3); //mpsName.push_back("truss");min.push_back(true);nRows.push_back(1001);nCols.push_back(8806);objValueTol.push_back(1.e-10);objValue.push_back(4.5881584719e+05);bestStrategy.push_back(3); mpsName.push_back("tuff"); min.push_back(true); nRows.push_back(334); nCols.push_back(587); objValueTol.push_back(1.e-10); objValue.push_back(2.9214776509e-01); bestStrategy.push_back(3); mpsName.push_back("vtpbase"); min.push_back(true); nRows.push_back(199); nCols.push_back(203); objValueTol.push_back(1.e-10); objValue.push_back(1.2983146246e+05); bestStrategy.push_back(3); mpsName.push_back("wood1p"); min.push_back(true); nRows.push_back(245); nCols.push_back(2594); objValueTol.push_back(5.e-5); objValue.push_back(1.4429024116e+00); bestStrategy.push_back(3); mpsName.push_back("woodw"); min.push_back(true); nRows.push_back(1099); nCols.push_back(8405); objValueTol.push_back(1.e-10); objValue.push_back(1.3044763331E+00); bestStrategy.push_back(3); #endif } else { // Just testing one mpsName.push_back(empty.problemName()); min.push_back(true); nRows.push_back(-1); nCols.push_back(-1); objValueTol.push_back(1.e-10); objValue.push_back(0.0); bestStrategy.push_back(0); int iTest; std::string alg; for (iTest = 0; iTest < NUMBER_ALGORITHMS; iTest++) { ClpSolve solveOptions = setupForSolve(iTest, alg, 0); printf("%d %s ", iTest, alg.c_str()); if (switchOff[iTest]) printf("skipped by user\n"); else if(solveOptions.getSolveType() == ClpSolve::notImplemented) printf("skipped as not available\n"); else printf("will be tested\n"); } } double timeTaken = 0.0; if( !barrierAvailable) switchOff[0] = 1; // Loop once for each Mps File for (m = 0; m < mpsName.size(); m++ ) { #if FACTORIZATION_STATISTICS if (nRows[m]=hiSizeX) { std::cerr << " skipping mps file: " << mpsName[m] <<" as "<(matrix)) { ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); clpMatrix->makeSpecialColumnCopy(); } } solution.initialSolve(solveOptions); double time2 = CoinCpuTime() - time1; testTime[iTest] = time2; printf("Finished %s Took %g seconds (%d iterations) - status %d\n", mpsName[m].c_str(),time2, solution.problemStatus(),solution.numberIterations()); if (solution.problemStatus()) testTime[iTest] = 1.0e20; } else { testTime[iTest] = 1.0e30; } } int iBest = -1; double dBest = 1.0e10; printf("%s", fn.c_str()); for (iTest = 0; iTest < NUMBER_ALGORITHMS; iTest++) { if (testTime[iTest] < 1.0e30) { printf(" %s %g", alg[iTest].c_str(), testTime[iTest]); if (testTime[iTest] < dBest) { dBest = testTime[iTest]; iBest = iTest; } } } printf("\n"); if (iBest >= 0) printf("Best strategy for %s is %s (%d) which takes %g seconds\n", fn.c_str(), alg[iBest].c_str(), iBest, testTime[iBest]); else printf("No strategy finished in time limit\n"); continue; } double time1 = CoinCpuTime(); AnySimplex solution = solutionBase; #if 0 solution.setOptimizationDirection(-1); { int j; double * obj = solution.objective(); int n = solution.numberColumns(); for (j = 0; j < n; j++) obj[j] *= -1.0; } #endif ClpSolve::SolveType method; ClpSolve solveOptions = solveOptionsIn; std::string nameAlgorithm; if (algorithm != 5) { if (algorithm == 0) { method = ClpSolve::useDual; nameAlgorithm = "dual"; } else if (algorithm == 1) { method = ClpSolve::usePrimalorSprint; nameAlgorithm = "primal"; } else if (algorithm == 3) { method = ClpSolve::automatic; nameAlgorithm = "either"; } else { nameAlgorithm = "barrier-slow"; #if defined(COIN_HAS_AMD) || defined(COIN_HAS_CHOLMOD) || defined(COIN_HAS_GLPK) solveOptions.setSpecialOption(4, 4); nameAlgorithm = "barrier-UFL"; #endif #ifdef COIN_HAS_WSMP solveOptions.setSpecialOption(4, 2); nameAlgorithm = "barrier-WSSMP"; #endif #ifdef COIN_HAS_MUMPS solveOptions.setSpecialOption(4, 6); nameAlgorithm = "barrier-MUMPS"; #endif method = ClpSolve::useBarrier; } solveOptions.setSolveType(method); } else { int iAlg = bestStrategy[m]; int presolveOff = iAlg / 100; iAlg = iAlg % 100; if( !barrierAvailable && iAlg == 0) { if (nRows[m] != 2172) iAlg = 5; // try primal else iAlg = 3; // d2q06c } solveOptions = setupForSolve(iAlg, nameAlgorithm, 0); if (presolveOff) solveOptions.setPresolveType(ClpSolve::presolveOff); } if (doVector) { ClpMatrixBase * matrix = solution.clpMatrix(); if (dynamic_cast< ClpPackedMatrix*>(matrix)) { ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); clpMatrix->makeSpecialColumnCopy(); } } #if FACTORIZATION_STATISTICS double timesOne[3*3*3*3*3]; memset(timesOne,0,sizeof(timesOne)); int iterationsOne[3*3*3*3*3]; memset(iterationsOne,0,sizeof(iterationsOne)); AnySimplex saveModel(solution); double time2; #if 0 solution.initialSolve(solveOptions); time2 = CoinCpuTime() - time1; timeTaken += time2; printf("%s took %g seconds using algorithm %s\n", fn.c_str(), time2, nameAlgorithm.c_str()); #endif #define loA 1 #define loB 0 #define loC 0 #define loD 1 #define loE 1 #define hiA 2 #define hiB 1 #define hiC 1 #define hiD 2 #define hiE 2 time2 = CoinCpuTime(); for (int iA=loA;iA(iterationsOne[i]); if (timesOne[i]setDetailMessage(1, 102); model.setFactorizationFrequency(10); model.primal(); model.primal(0, 3); model.setObjCoeff(3, -2.9473684210526314); model.primal(0, 3); // Write saved solutions int nc = model.getNumCols(); size_t s; std::deque fep = messageHandler.getFeasibleExtremePoints(); size_t numSavedSolutions = fep.size(); for ( s = 0; s < numSavedSolutions; ++s ) { const StdVectorDouble & solnVec = fep[s]; for ( int c = 0; c < nc; ++c ) { if (fabs(solnVec[c]) > 1.0e-8) std::cout << "Saved Solution: " << s << " ColNum: " << c << " Value: " << solnVec[c] << std::endl; } } // Solve again without scaling // and maximize then minimize messageHandler.clearFeasibleExtremePoints(); model.scaling(0); model.setOptimizationDirection(-1); model.primal(); model.setOptimizationDirection(1); model.primal(); fep = messageHandler.getFeasibleExtremePoints(); numSavedSolutions = fep.size(); for ( s = 0; s < numSavedSolutions; ++s ) { const StdVectorDouble & solnVec = fep[s]; for ( int c = 0; c < nc; ++c ) { if (fabs(solnVec[c]) > 1.0e-8) std::cout << "Saved Solution: " << s << " ColNum: " << c << " Value: " << solnVec[c] << std::endl; } } } else { std::cerr << "Error reading exmip1 from sample data. Skipping test." << std::endl; } } #endif // Test dual ranging { CoinMpsIO m; std::string fn = dirSample + "exmip1"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex model; model.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); model.primal(); int which[13] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; double costIncrease[13]; int sequenceIncrease[13]; double costDecrease[13]; int sequenceDecrease[13]; // ranging model.dualRanging(13, which, costIncrease, sequenceIncrease, costDecrease, sequenceDecrease); int i; for ( i = 0; i < 13; i++) printf("%d increase %g %d, decrease %g %d\n", i, costIncrease[i], sequenceIncrease[i], costDecrease[i], sequenceDecrease[i]); assert (fabs(costDecrease[3]) < 1.0e-4); assert (fabs(costIncrease[7] - 1.0) < 1.0e-4); model.setOptimizationDirection(-1); { int j; double * obj = model.objective(); int n = model.numberColumns(); for (j = 0; j < n; j++) obj[j] *= -1.0; } double costIncrease2[13]; int sequenceIncrease2[13]; double costDecrease2[13]; int sequenceDecrease2[13]; // ranging model.dualRanging(13, which, costIncrease2, sequenceIncrease2, costDecrease2, sequenceDecrease2); for (i = 0; i < 13; i++) { assert (fabs(costIncrease[i] - costDecrease2[i]) < 1.0e-6); assert (fabs(costDecrease[i] - costIncrease2[i]) < 1.0e-6); assert (sequenceIncrease[i] == sequenceDecrease2[i]); assert (sequenceDecrease[i] == sequenceIncrease2[i]); } // Now delete all rows and see what happens model.deleteRows(model.numberRows(), which); model.primal(); // ranging if (!model.dualRanging(8, which, costIncrease, sequenceIncrease, costDecrease, sequenceDecrease)) { for (i = 0; i < 8; i++) { printf("%d increase %g %d, decrease %g %d\n", i, costIncrease[i], sequenceIncrease[i], costDecrease[i], sequenceDecrease[i]); } } } else { std::cerr << "Error reading exmip1 from sample data. Skipping test." << std::endl; } } // Test primal ranging { CoinMpsIO m; std::string fn = dirSample + "exmip1"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex model; model.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); model.primal(); int which[13] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; double valueIncrease[13]; int sequenceIncrease[13]; double valueDecrease[13]; int sequenceDecrease[13]; // ranging model.primalRanging(13, which, valueIncrease, sequenceIncrease, valueDecrease, sequenceDecrease); int i; for ( i = 0; i < 13; i++) printf("%d increase %g %d, decrease %g %d\n", i, valueIncrease[i], sequenceIncrease[i], valueDecrease[i], sequenceDecrease[i]); assert (fabs(valueIncrease[3] - 0.642857) < 1.0e-4); assert (fabs(valueIncrease[8] - 2.95113) < 1.0e-4); } else { std::cerr << "Error reading exmip1 from sample data. Skipping test." << std::endl; } #if 0 // out until I find optimization bug // Test parametrics ClpSimplexOther * model2 = (ClpSimplexOther *) (&model); double rhs[] = { 1.0, 2.0, 3.0, 4.0, 5.0}; double endingTheta = 1.0; model2->scaling(0); model2->setLogLevel(63); model2->parametrics(0.0, endingTheta, 0.1, NULL, NULL, rhs, rhs, NULL); #endif } // Test binv etc { /* Wolsey : Page 130 max 4x1 - x2 7x1 - 2x2 <= 14 x2 <= 3 2x1 - 2x2 <= 3 x1 in Z+, x2 >= 0 note slacks are -1 in Clp so signs may be different */ int n_cols = 2; int n_rows = 3; double obj[2] = { -4.0, 1.0}; double collb[2] = {0.0, 0.0}; double colub[2] = {COIN_DBL_MAX, COIN_DBL_MAX}; double rowlb[3] = { -COIN_DBL_MAX, -COIN_DBL_MAX, -COIN_DBL_MAX}; double rowub[3] = {14.0, 3.0, 3.0}; int rowIndices[5] = {0, 2, 0, 1, 2}; int colIndices[5] = {0, 0, 1, 1, 1}; double elements[5] = {7.0, 2.0, -2.0, 1.0, -2.0}; CoinPackedMatrix M(true, rowIndices, colIndices, elements, 5); ClpSimplex model; model.loadProblem(M, collb, colub, obj, rowlb, rowub); model.dual(0, 1); // keep factorization //check that the tableau matches wolsey (B-1 A) // slacks in second part of binvA double * binvA = reinterpret_cast (malloc((n_cols + n_rows) * sizeof(double))); printf("B-1 A by row\n"); int i; for( i = 0; i < n_rows; i++) { model.getBInvARow(i, binvA, binvA + n_cols); printf("row: %d -> ", i); for(int j = 0; j < n_cols + n_rows; j++) { printf("%g, ", binvA[j]); } printf("\n"); } // See if can re-use factorization AND arrays model.primal(0, 3 + 4); // keep factorization // And do by column printf("B-1 A by column\n"); for( i = 0; i < n_rows + n_cols; i++) { model.getBInvACol(i, binvA); printf("column: %d -> ", i); for(int j = 0; j < n_rows; j++) { printf("%g, ", binvA[j]); } printf("\n"); } /* Do twice - without and with scaling */ // set scaling off model.scaling(0); for (int iPass = 0; iPass < 2; iPass++) { model.primal(0, 3 + 4); // keep factorization const double * rowScale = model.rowScale(); const double * columnScale = model.columnScale(); if (!iPass) assert (!rowScale); else assert (rowScale); // only true for this example /* has to be exactly correct as in OsiClpsolverInterface.cpp (also redo each pass as may change */ printf("B-1 A"); for( i = 0; i < n_rows; i++) { model.getBInvARow(i, binvA, binvA + n_cols); printf("\nrow: %d -> ", i); int j; // First columns for(j = 0; j < n_cols; j++) { if (binvA[j]) { printf("(%d %g), ", j, binvA[j]); } } // now rows for(j = 0; j < n_rows; j++) { if (binvA[j+n_cols]) { printf("(%d %g), ", j + n_cols, binvA[j+n_cols]); } } } printf("\n"); printf("And by column (trickier)"); const int * pivotVariable = model.pivotVariable(); for( i = 0; i < n_cols + n_rows; i++) { model.getBInvACol(i, binvA); printf("\ncolumn: %d -> ", i); for(int j = 0; j < n_rows; j++) { if (binvA[j]) { // need to know pivot variable for +1/-1 (slack) and row/column scaling int pivot = pivotVariable[j]; if (pivot < n_cols) { // scaled coding is in just in case if (!columnScale) { printf("(%d %g), ", j, binvA[j]); } else { printf("(%d %g), ", j, binvA[j]*columnScale[pivot]); } } else { if (!rowScale) { printf("(%d %g), ", j, binvA[j]); } else { printf("(%d %g), ", j, binvA[j] / rowScale[pivot-n_cols]); } } } } } printf("\n"); printf("binvrow"); for( i = 0; i < n_rows; i++) { model.getBInvRow(i, binvA); printf("\nrow: %d -> ", i); int j; for (j = 0; j < n_rows; j++) { if (binvA[j]) printf("(%d %g), ", j, binvA[j]); } } printf("\n"); printf("And by column "); for( i = 0; i < n_rows; i++) { model.getBInvCol(i, binvA); printf("\ncol: %d -> ", i); int j; for (j = 0; j < n_rows; j++) { if (binvA[j]) printf("(%d %g), ", j, binvA[j]); } } printf("\n"); // now deal with next pass if (!iPass) { // get scaling for testing model.scaling(1); } } free(binvA); model.setColUpper(1, 2.0); model.dual(0, 2 + 4); // use factorization and arrays model.dual(0, 2); // hopefully will not use factorization model.primal(0, 3 + 4); // keep factorization // but say basis has changed model.setWhatsChanged(model.whatsChanged()&(~512)); model.dual(0, 2); // hopefully will not use factorization } // test steepest edge { CoinMpsIO m; std::string fn = dirSample + "finnis"; int returnCode = m.readMps(fn.c_str(), "mps"); if (returnCode) { // probable cause is that gz not there fprintf(stderr, "Unable to open finnis.mps in %s\n", dirSample.c_str()); fprintf(stderr, "Most probable cause is that sample data is not available, or finnis.mps is gzipped i.e. finnis.mps.gz and libz has not been activated\n"); fprintf(stderr, "Either gunzip files or edit Makefiles/Makefile.location to get libz\n"); } else { ClpModel model; model.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); ClpSimplex solution(model); solution.scaling(1); solution.setDualBound(1.0e8); //solution.factorization()->maximumPivots(1); //solution.setLogLevel(3); solution.setDualTolerance(1.0e-7); // set objective sense, ClpDualRowSteepest steep; solution.setDualRowPivotAlgorithm(steep); solution.setDblParam(ClpObjOffset, m.objectiveOffset()); solution.dual(); } } // test normal solution { CoinMpsIO m; std::string fn = dirSample + "afiro"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex solution; ClpModel model; // do twice - without and with scaling int iPass; for (iPass = 0; iPass < 2; iPass++) { // explicit row objective for testing int nr = m.getNumRows(); double * rowObj = new double[nr]; CoinFillN(rowObj, nr, 0.0); model.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper(), rowObj); delete [] rowObj; solution = ClpSimplex(model); if (iPass) { solution.scaling(); } solution.dual(); solution.dual(); // test optimal assert (solution.status() == 0); int numberColumns = solution.numberColumns(); int numberRows = solution.numberRows(); CoinPackedVector colsol(numberColumns, solution.primalColumnSolution()); double * objective = solution.objective(); #ifndef NDEBUG double objValue = colsol.dotProduct(objective); #endif CoinRelFltEq eq(1.0e-8); assert(eq(objValue, -4.6475314286e+02)); solution.dual(); assert(eq(solution.objectiveValue(), -4.6475314286e+02)); double * lower = solution.columnLower(); double * upper = solution.columnUpper(); double * sol = solution.primalColumnSolution(); double * result = new double[numberColumns]; CoinFillN ( result, numberColumns, 0.0); solution.matrix()->transposeTimes(solution.dualRowSolution(), result); int iRow , iColumn; // see if feasible and dual feasible for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = sol[iColumn]; assert(value < upper[iColumn] + 1.0e-8); assert(value > lower[iColumn] - 1.0e-8); value = objective[iColumn] - result[iColumn]; assert (value > -1.0e-5); if (sol[iColumn] > 1.0e-5) assert (value < 1.0e-5); } delete [] result; result = new double[numberRows]; CoinFillN ( result, numberRows, 0.0); solution.matrix()->times(colsol, result); lower = solution.rowLower(); upper = solution.rowUpper(); sol = solution.primalRowSolution(); #ifndef NDEBUG for (iRow = 0; iRow < numberRows; iRow++) { double value = result[iRow]; assert(eq(value, sol[iRow])); assert(value < upper[iRow] + 1.0e-8); assert(value > lower[iRow] - 1.0e-8); } #endif delete [] result; // test row objective double * rowObjective = solution.rowObjective(); CoinDisjointCopyN(solution.dualRowSolution(), numberRows, rowObjective); CoinDisjointCopyN(solution.dualColumnSolution(), numberColumns, objective); // this sets up all slack basis solution.createStatus(); solution.dual(); CoinFillN(rowObjective, numberRows, 0.0); CoinDisjointCopyN(m.getObjCoefficients(), numberColumns, objective); solution.dual(); } } else { std::cerr << "Error reading afiro from sample data. Skipping test." << std::endl; } } // test unbounded { CoinMpsIO m; std::string fn = dirSample + "brandy"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex solution; // do twice - without and with scaling int iPass; for (iPass = 0; iPass < 2; iPass++) { solution.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); if (iPass) solution.scaling(); solution.setOptimizationDirection(-1); // test unbounded and ray #ifdef DUAL solution.setDualBound(100.0); solution.dual(); #else solution.primal(); #endif assert (solution.status() == 2); int numberColumns = solution.numberColumns(); int numberRows = solution.numberRows(); double * lower = solution.columnLower(); double * upper = solution.columnUpper(); double * sol = solution.primalColumnSolution(); double * ray = solution.unboundedRay(); double * objective = solution.objective(); double objChange = 0.0; int iRow , iColumn; // make sure feasible and columns form ray for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = sol[iColumn]; assert(value < upper[iColumn] + 1.0e-8); assert(value > lower[iColumn] - 1.0e-8); value = ray[iColumn]; if (value > 0.0) assert(upper[iColumn] > 1.0e30); else if (value < 0.0) assert(lower[iColumn] < -1.0e30); objChange += value * objective[iColumn]; } // make sure increasing objective assert(objChange > 0.0); double * result = new double[numberRows]; CoinFillN ( result, numberRows, 0.0); solution.matrix()->times(sol, result); lower = solution.rowLower(); upper = solution.rowUpper(); sol = solution.primalRowSolution(); #ifndef NDEBUG for (iRow = 0; iRow < numberRows; iRow++) { double value = result[iRow]; assert(eq(value, sol[iRow])); assert(value < upper[iRow] + 2.0e-8); assert(value > lower[iRow] - 2.0e-8); } #endif CoinFillN ( result, numberRows, 0.0); solution.matrix()->times(ray, result); // there may be small differences (especially if scaled) for (iRow = 0; iRow < numberRows; iRow++) { double value = result[iRow]; if (value > 1.0e-8) assert(upper[iRow] > 1.0e30); else if (value < -1.0e-8) assert(lower[iRow] < -1.0e30); } delete [] result; delete [] ray; } } else { std::cerr << "Error reading brandy from sample data. Skipping test." << std::endl; } } // test infeasible { CoinMpsIO m; std::string fn = dirSample + "brandy"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex solution; // do twice - without and with scaling int iPass; for (iPass = 0; iPass < 2; iPass++) { solution.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); if (iPass) solution.scaling(); // test infeasible and ray solution.columnUpper()[0] = 0.0; #ifdef DUAL solution.setDualBound(100.0); solution.dual(); #else solution.primal(); #endif assert (solution.status() == 1); int numberColumns = solution.numberColumns(); int numberRows = solution.numberRows(); double * lower = solution.rowLower(); double * upper = solution.rowUpper(); double * ray = solution.infeasibilityRay(); assert(ray); // construct proof of infeasibility int iRow , iColumn; double lo = 0.0, up = 0.0; int nl = 0, nu = 0; for (iRow = 0; iRow < numberRows; iRow++) { if (lower[iRow] > -1.0e20) { lo += ray[iRow] * lower[iRow]; } else { if (ray[iRow] > 1.0e-8) nl++; } if (upper[iRow] < 1.0e20) { up += ray[iRow] * upper[iRow]; } else { if (ray[iRow] > 1.0e-8) nu++; } } if (nl) lo = -1.0e100; if (nu) up = 1.0e100; double * result = new double[numberColumns]; double lo2 = 0.0, up2 = 0.0; CoinFillN ( result, numberColumns, 0.0); solution.matrix()->transposeTimes(ray, result); lower = solution.columnLower(); upper = solution.columnUpper(); nl = nu = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (result[iColumn] > 1.0e-8) { if (lower[iColumn] > -1.0e20) lo2 += result[iColumn] * lower[iColumn]; else nl++; if (upper[iColumn] < 1.0e20) up2 += result[iColumn] * upper[iColumn]; else nu++; } else if (result[iColumn] < -1.0e-8) { if (lower[iColumn] > -1.0e20) up2 += result[iColumn] * lower[iColumn]; else nu++; if (upper[iColumn] < 1.0e20) lo2 += result[iColumn] * upper[iColumn]; else nl++; } } if (nl) lo2 = -1.0e100; if (nu) up2 = 1.0e100; // make sure inconsistency assert(lo2 > up || up2 < lo); delete [] result; delete [] ray; } } else { std::cerr << "Error reading brandy from sample data. Skipping test." << std::endl; } } // test delete and add { CoinMpsIO m; std::string fn = dirSample + "brandy"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex solution; solution.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); solution.dual(); CoinRelFltEq eq(1.0e-8); assert(eq(solution.objectiveValue(), 1.5185098965e+03)); int numberColumns = solution.numberColumns(); int numberRows = solution.numberRows(); double * saveObj = new double [numberColumns]; double * saveLower = new double[numberRows+numberColumns]; double * saveUpper = new double[numberRows+numberColumns]; int * which = new int [numberRows+numberColumns]; int numberElements = m.getMatrixByCol()->getNumElements(); int * starts = new int[numberRows+numberColumns]; int * index = new int[numberElements]; double * element = new double[numberElements]; const CoinBigIndex * startM; const int * lengthM; const int * indexM; const double * elementM; int n, nel; // delete non basic columns n = 0; nel = 0; int iRow , iColumn; const double * lower = m.getColLower(); const double * upper = m.getColUpper(); const double * objective = m.getObjCoefficients(); startM = m.getMatrixByCol()->getVectorStarts(); lengthM = m.getMatrixByCol()->getVectorLengths(); indexM = m.getMatrixByCol()->getIndices(); elementM = m.getMatrixByCol()->getElements(); starts[0] = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (solution.getColumnStatus(iColumn) != ClpSimplex::basic) { saveObj[n] = objective[iColumn]; saveLower[n] = lower[iColumn]; saveUpper[n] = upper[iColumn]; int j; for (j = startM[iColumn]; j < startM[iColumn] + lengthM[iColumn]; j++) { index[nel] = indexM[j]; element[nel++] = elementM[j]; } which[n++] = iColumn; starts[n] = nel; } } solution.deleteColumns(n, which); solution.dual(); // Put back solution.addColumns(n, saveLower, saveUpper, saveObj, starts, index, element); solution.dual(); assert(eq(solution.objectiveValue(), 1.5185098965e+03)); // Delete all columns and add back n = 0; nel = 0; starts[0] = 0; lower = m.getColLower(); upper = m.getColUpper(); objective = m.getObjCoefficients(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { saveObj[n] = objective[iColumn]; saveLower[n] = lower[iColumn]; saveUpper[n] = upper[iColumn]; int j; for (j = startM[iColumn]; j < startM[iColumn] + lengthM[iColumn]; j++) { index[nel] = indexM[j]; element[nel++] = elementM[j]; } which[n++] = iColumn; starts[n] = nel; } solution.deleteColumns(n, which); solution.dual(); // Put back solution.addColumns(n, saveLower, saveUpper, saveObj, starts, index, element); solution.dual(); assert(eq(solution.objectiveValue(), 1.5185098965e+03)); // reload with original solution.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); // delete half rows n = 0; nel = 0; lower = m.getRowLower(); upper = m.getRowUpper(); startM = m.getMatrixByRow()->getVectorStarts(); lengthM = m.getMatrixByRow()->getVectorLengths(); indexM = m.getMatrixByRow()->getIndices(); elementM = m.getMatrixByRow()->getElements(); starts[0] = 0; for (iRow = 0; iRow < numberRows; iRow++) { if ((iRow & 1) == 0) { saveLower[n] = lower[iRow]; saveUpper[n] = upper[iRow]; int j; for (j = startM[iRow]; j < startM[iRow] + lengthM[iRow]; j++) { index[nel] = indexM[j]; element[nel++] = elementM[j]; } which[n++] = iRow; starts[n] = nel; } } solution.deleteRows(n, which); solution.dual(); // Put back solution.addRows(n, saveLower, saveUpper, starts, index, element); solution.dual(); assert(eq(solution.objectiveValue(), 1.5185098965e+03)); solution.writeMps("yy.mps"); // Delete all rows n = 0; nel = 0; lower = m.getRowLower(); upper = m.getRowUpper(); starts[0] = 0; for (iRow = 0; iRow < numberRows; iRow++) { saveLower[n] = lower[iRow]; saveUpper[n] = upper[iRow]; int j; for (j = startM[iRow]; j < startM[iRow] + lengthM[iRow]; j++) { index[nel] = indexM[j]; element[nel++] = elementM[j]; } which[n++] = iRow; starts[n] = nel; } solution.deleteRows(n, which); solution.dual(); // Put back solution.addRows(n, saveLower, saveUpper, starts, index, element); solution.dual(); solution.writeMps("xx.mps"); assert(eq(solution.objectiveValue(), 1.5185098965e+03)); // Zero out status array to give some interest memset(solution.statusArray() + numberColumns, 0, numberRows); solution.primal(1); assert(eq(solution.objectiveValue(), 1.5185098965e+03)); // Delete all columns and rows n = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { which[n++] = iColumn; starts[n] = nel; } solution.deleteColumns(n, which); n = 0; for (iRow = 0; iRow < numberRows; iRow++) { which[n++] = iRow; starts[n] = nel; } solution.deleteRows(n, which); delete [] saveObj; delete [] saveLower; delete [] saveUpper; delete [] which; delete [] starts; delete [] index; delete [] element; } else { std::cerr << "Error reading brandy from sample data. Skipping test." << std::endl; } } #if 1 // Test barrier { CoinMpsIO m; std::string fn = dirSample + "exmip1"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpInterior solution; solution.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); solution.primalDual(); } else { std::cerr << "Error reading exmip1 from sample data. Skipping test." << std::endl; } } #endif // test network #define QUADRATIC if (1) { std::string fn = dirSample + "input.130"; int numberColumns; int numberRows; FILE * fp = fopen(fn.c_str(), "r"); if (!fp) { // Try in Data/Sample fn = "Data/Sample/input.130"; fp = fopen(fn.c_str(), "r"); } if (!fp) { fprintf(stderr, "Unable to open file input.130 in dirSample or Data/Sample directory\n"); } else { int problem; char temp[100]; // read and skip int x = fscanf(fp, "%s", temp); if (x < 0) throw("bad fscanf"); assert (!strcmp(temp, "BEGIN")); x = fscanf(fp, "%*s %*s %d %d %*s %*s %d %*s", &problem, &numberRows, &numberColumns); if (x < 0) throw("bad fscanf"); // scan down to SUPPLY while (fgets(temp, 100, fp)) { if (!strncmp(temp, "SUPPLY", 6)) break; } if (strncmp(temp, "SUPPLY", 6)) { fprintf(stderr, "Unable to find SUPPLY\n"); exit(2); } // get space for rhs double * lower = new double[numberRows]; double * upper = new double[numberRows]; int i; for (i = 0; i < numberRows; i++) { lower[i] = 0.0; upper[i] = 0.0; } // ***** Remember to convert to C notation while (fgets(temp, 100, fp)) { int row; int value; if (!strncmp(temp, "ARCS", 4)) break; sscanf(temp, "%d %d", &row, &value); upper[row-1] = -value; lower[row-1] = -value; } if (strncmp(temp, "ARCS", 4)) { fprintf(stderr, "Unable to find ARCS\n"); exit(2); } // number of columns may be underestimate int * head = new int[2*numberColumns]; int * tail = new int[2*numberColumns]; int * ub = new int[2*numberColumns]; int * cost = new int[2*numberColumns]; // ***** Remember to convert to C notation numberColumns = 0; while (fgets(temp, 100, fp)) { int iHead; int iTail; int iUb; int iCost; if (!strncmp(temp, "DEMAND", 6)) break; sscanf(temp, "%d %d %d %d", &iHead, &iTail, &iCost, &iUb); iHead--; iTail--; head[numberColumns] = iHead; tail[numberColumns] = iTail; ub[numberColumns] = iUb; cost[numberColumns] = iCost; numberColumns++; } if (strncmp(temp, "DEMAND", 6)) { fprintf(stderr, "Unable to find DEMAND\n"); exit(2); } // ***** Remember to convert to C notation while (fgets(temp, 100, fp)) { int row; int value; if (!strncmp(temp, "END", 3)) break; sscanf(temp, "%d %d", &row, &value); upper[row-1] = value; lower[row-1] = value; } if (strncmp(temp, "END", 3)) { fprintf(stderr, "Unable to find END\n"); exit(2); } printf("Problem %d has %d rows and %d columns\n", problem, numberRows, numberColumns); fclose(fp); ClpSimplex model; // now build model double * objective = new double[numberColumns]; double * lowerColumn = new double[numberColumns]; double * upperColumn = new double[numberColumns]; double * element = new double [2*numberColumns]; CoinBigIndex * start = new CoinBigIndex [numberColumns+1]; int * row = new int[2*numberColumns]; start[numberColumns] = 2 * numberColumns; for (i = 0; i < numberColumns; i++) { start[i] = 2 * i; element[2*i] = -1.0; element[2*i+1] = 1.0; row[2*i] = head[i]; row[2*i+1] = tail[i]; lowerColumn[i] = 0.0; upperColumn[i] = ub[i]; objective[i] = cost[i]; } // Create Packed Matrix CoinPackedMatrix matrix; int * lengths = NULL; matrix.assignMatrix(true, numberRows, numberColumns, 2 * numberColumns, element, row, start, lengths); // load model model.loadProblem(matrix, lowerColumn, upperColumn, objective, lower, upper); model.factorization()->maximumPivots(200 + model.numberRows() / 100); model.createStatus(); double time1 = CoinCpuTime(); model.dual(); std::cout << "Network problem, ClpPackedMatrix took " << CoinCpuTime() - time1 << " seconds" << std::endl; ClpPlusMinusOneMatrix * plusMinus = new ClpPlusMinusOneMatrix(matrix); assert (plusMinus->getIndices()); // would be zero if not +- one //ClpPlusMinusOneMatrix *plusminus_matrix; //plusminus_matrix = new ClpPlusMinusOneMatrix; //plusminus_matrix->passInCopy(numberRows, numberColumns, true, plusMinus->getMutableIndices(), // plusMinus->startPositive(),plusMinus->startNegative()); model.loadProblem(*plusMinus, lowerColumn, upperColumn, objective, lower, upper); //model.replaceMatrix( plusminus_matrix , true); delete plusMinus; //model.createStatus(); //model.initialSolve(); //model.writeMps("xx.mps"); model.factorization()->maximumPivots(200 + model.numberRows() / 100); model.createStatus(); time1 = CoinCpuTime(); model.dual(); std::cout << "Network problem, ClpPlusMinusOneMatrix took " << CoinCpuTime() - time1 << " seconds" << std::endl; ClpNetworkMatrix network(numberColumns, head, tail); model.loadProblem(network, lowerColumn, upperColumn, objective, lower, upper); model.factorization()->maximumPivots(200 + model.numberRows() / 100); model.createStatus(); time1 = CoinCpuTime(); model.dual(); std::cout << "Network problem, ClpNetworkMatrix took " << CoinCpuTime() - time1 << " seconds" << std::endl; delete [] lower; delete [] upper; delete [] head; delete [] tail; delete [] ub; delete [] cost; delete [] objective; delete [] lowerColumn; delete [] upperColumn; } } #ifdef QUADRATIC // Test quadratic to solve linear if (1) { CoinMpsIO m; std::string fn = dirSample + "exmip1"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex solution; solution.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); //solution.dual(); // get quadratic part int numberColumns = solution.numberColumns(); int * start = new int [numberColumns+1]; int * column = new int[numberColumns]; double * element = new double[numberColumns]; int i; start[0] = 0; int n = 0; int kk = numberColumns - 1; int kk2 = numberColumns - 1; for (i = 0; i < numberColumns; i++) { if (i >= kk) { column[n] = i; if (i >= kk2) element[n] = 1.0e-1; else element[n] = 0.0; n++; } start[i+1] = n; } // Load up objective solution.loadQuadraticObjective(numberColumns, start, column, element); delete [] start; delete [] column; delete [] element; //solution.quadraticSLP(50,1.0e-4); CoinRelFltEq eq(1.0e-4); //assert(eq(objValue,820.0)); //solution.setLogLevel(63); solution.primal(); printSol(solution); //assert(eq(objValue,3.2368421)); //exit(77); } else { std::cerr << "Error reading exmip1 from sample data. Skipping test." << std::endl; } } // Test quadratic if (1) { CoinMpsIO m; std::string fn = dirSample + "share2qp"; //fn = "share2qpb"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex model; model.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); model.dual(); // get quadratic part int * start = NULL; int * column = NULL; double * element = NULL; m.readQuadraticMps(NULL, start, column, element, 2); int column2[200]; double element2[200]; int start2[80]; int j; start2[0] = 0; int nel = 0; bool good = false; for (j = 0; j < 79; j++) { if (start[j] == start[j+1]) { column2[nel] = j; element2[nel] = 0.0; nel++; } else { int i; for (i = start[j]; i < start[j+1]; i++) { column2[nel] = column[i]; element2[nel++] = element[i]; } } start2[j+1] = nel; } // Load up objective if (good) model.loadQuadraticObjective(model.numberColumns(), start2, column2, element2); else model.loadQuadraticObjective(model.numberColumns(), start, column, element); delete [] start; delete [] column; delete [] element; int numberColumns = model.numberColumns(); model.scaling(0); #if 0 model.nonlinearSLP(50, 1.0e-4); #else // Get feasible ClpObjective * saveObjective = model.objectiveAsObject()->clone(); ClpLinearObjective zeroObjective(NULL, numberColumns); model.setObjective(&zeroObjective); model.dual(); model.setObjective(saveObjective); delete saveObjective; #endif //model.setLogLevel(63); //exit(77); model.setFactorizationFrequency(10); model.primal(); printSol(model); #ifndef NDEBUG double objValue = model.getObjValue(); #endif CoinRelFltEq eq(1.0e-4); assert(eq(objValue, -400.92)); // and again for barrier model.barrier(false); //printSol(model); model.allSlackBasis(); model.primal(); //printSol(model); } else { std::cerr << "Error reading share2qp from sample data. Skipping test." << std::endl; } } if (0) { CoinMpsIO m; std::string fn = "./beale"; //fn = "./jensen"; if (m.readMps(fn.c_str(), "mps") == 0) { ClpSimplex solution; solution.loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); solution.setDblParam(ClpObjOffset, m.objectiveOffset()); solution.dual(); // get quadratic part int * start = NULL; int * column = NULL; double * element = NULL; m.readQuadraticMps(NULL, start, column, element, 2); // Load up objective solution.loadQuadraticObjective(solution.numberColumns(), start, column, element); delete [] start; delete [] column; delete [] element; solution.primal(1); solution.nonlinearSLP(50, 1.0e-4); double objValue = solution.getObjValue(); CoinRelFltEq eq(1.0e-4); assert(eq(objValue, 0.5)); solution.primal(); objValue = solution.getObjValue(); assert(eq(objValue, 0.5)); } else { std::cerr << "Error reading beale.mps. Skipping test." << std::endl; } } #endif // Test CoinStructuredModel { // Sub block CoinModel sub; { // matrix data //deliberate hiccup of 2 between 0 and 1 CoinBigIndex start[5] = {0, 4, 7, 8, 9}; int length[5] = {2, 3, 1, 1, 1}; int rows[11] = {0, 2, -1, -1, 0, 1, 2, 0, 1, 2}; double elements[11] = {7.0, 2.0, 1.0e10, 1.0e10, -2.0, 1.0, -2.0, 1, 1, 1}; CoinPackedMatrix matrix(true, 3, 5, 8, elements, rows, start, length); // by row matrix.reverseOrdering(); const double * element = matrix.getElements(); const int * column = matrix.getIndices(); const CoinBigIndex * rowStart = matrix.getVectorStarts(); const int * rowLength = matrix.getVectorLengths(); // rim data //double objective[5]={-4.0,1.0,0.0,0.0,0.0}; double rowLower[3] = {14.0, 3.0, 3.0}; double rowUpper[3] = {14.0, 3.0, 3.0}; //double columnLower[5]={0.0,0.0,0.0,0.0,0.0}; //double columnUpper[5]={100.0,100.0,100.0,100.0,100.0}; for (int i = 0; i < 3; i++) { sub.addRow(rowLength[i], column + rowStart[i], element + rowStart[i], rowLower[i], rowUpper[i]); } //for (int i=0;i<5;i++) { //sub.setColumnBounds(i,columnLower[i],columnUpper[i]); //sub.setColumnObjective(i,objective[i]); //} sub.convertMatrix(); } // Top CoinModel top; { // matrix data CoinBigIndex start[5] = {0, 2, 4, 6, 8}; int length[5] = {2, 2, 2, 2, 2}; int rows[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; double elements[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; CoinPackedMatrix matrix(true, 2, 5, 8, elements, rows, start, length); // by row matrix.reverseOrdering(); const double * element = matrix.getElements(); const int * column = matrix.getIndices(); const CoinBigIndex * rowStart = matrix.getVectorStarts(); const int * rowLength = matrix.getVectorLengths(); // rim data double objective[5] = { -4.0, 1.0, 0.0, 0.0, 0.0}; //double rowLower[3]={14.0,3.0,3.0}; //double rowUpper[3]={14.0,3.0,3.0}; double columnLower[5] = {0.0, 0.0, 0.0, 0.0, 0.0}; double columnUpper[5] = {100.0, 100.0, 100.0, 100.0, 100.0}; for (int i = 0; i < 2; i++) { top.addRow(rowLength[i], column + rowStart[i], element + rowStart[i], -COIN_DBL_MAX, COIN_DBL_MAX); } for (int i = 0; i < 5; i++) { top.setColumnBounds(i, columnLower[i], columnUpper[i]); top.setColumnObjective(i, objective[i]); } top.convertMatrix(); } // Create a structured model CoinStructuredModel structured; int numberBlocks = 5; for (int i = 0; i < numberBlocks; i++) { std::string topName = "row_master"; std::string blockName = "block_"; char bName = static_cast('a' + static_cast(i)); blockName.append(1, bName); structured.addBlock(topName, blockName, top); structured.addBlock(blockName, blockName, sub); } // Set rhs on first block CoinModel * first = structured.coinBlock(0); for (int i = 0; i < 2; i++) { first->setRowLower(i, 0.0); first->setRowUpper(i, 100.0); } // Refresh whats set structured.refresh(0); // Could perturb stuff, but for first go don't bother ClpSimplex fullModel; // There is no original stuff set - think fullModel.loadProblem(structured, false); fullModel.dual(); fullModel.dropNames(); fullModel.writeMps("test.mps"); // Make up very simple nested model - not realistic // Create a structured model CoinStructuredModel structured2; numberBlocks = 3; for (int i = 0; i < numberBlocks; i++) { std::string blockName = "block_"; char bName = static_cast('a' + static_cast(i)); blockName.append(1, bName); structured2.addBlock(blockName, blockName, structured); } fullModel.loadProblem(structured2, false); fullModel.dual(); fullModel.dropNames(); fullModel.writeMps("test2.mps"); } } CoinMP-1.8.3/Clp/src/ClpPredictorCorrector.cpp0000644000175000017500000055033312140214550017605 0ustar renerene/* $Id: ClpPredictorCorrector.cpp 1951 2013-05-01 13:32:24Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Implements crude primal dual predictor corrector algorithm */ //#define SOME_DEBUG #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "ClpPredictorCorrector.hpp" #include "ClpEventHandler.hpp" #include "CoinPackedMatrix.hpp" #include "ClpMessage.hpp" #include "ClpCholeskyBase.hpp" #include "ClpHelperFunctions.hpp" #include "ClpQuadraticObjective.hpp" #include #include #include #include #include #if 0 static int yyyyyy = 0; void ClpPredictorCorrector::saveSolution(std::string fileName) { FILE * fp = fopen(fileName.c_str(), "wb"); if (fp) { int numberRows = numberRows_; int numberColumns = numberColumns_; fwrite(&numberRows, sizeof(int), 1, fp); fwrite(&numberColumns, sizeof(int), 1, fp); CoinWorkDouble dsave[20]; memset(dsave, 0, sizeof(dsave)); fwrite(dsave, sizeof(CoinWorkDouble), 20, fp); int msave[20]; memset(msave, 0, sizeof(msave)); msave[0] = numberIterations_; fwrite(msave, sizeof(int), 20, fp); fwrite(dual_, sizeof(CoinWorkDouble), numberRows, fp); fwrite(errorRegion_, sizeof(CoinWorkDouble), numberRows, fp); fwrite(rhsFixRegion_, sizeof(CoinWorkDouble), numberRows, fp); fwrite(solution_, sizeof(CoinWorkDouble), numberColumns, fp); fwrite(solution_ + numberColumns, sizeof(CoinWorkDouble), numberRows, fp); fwrite(diagonal_, sizeof(CoinWorkDouble), numberColumns, fp); fwrite(diagonal_ + numberColumns, sizeof(CoinWorkDouble), numberRows, fp); fwrite(wVec_, sizeof(CoinWorkDouble), numberColumns, fp); fwrite(wVec_ + numberColumns, sizeof(CoinWorkDouble), numberRows, fp); fwrite(zVec_, sizeof(CoinWorkDouble), numberColumns, fp); fwrite(zVec_ + numberColumns, sizeof(CoinWorkDouble), numberRows, fp); fwrite(upperSlack_, sizeof(CoinWorkDouble), numberColumns, fp); fwrite(upperSlack_ + numberColumns, sizeof(CoinWorkDouble), numberRows, fp); fwrite(lowerSlack_, sizeof(CoinWorkDouble), numberColumns, fp); fwrite(lowerSlack_ + numberColumns, sizeof(CoinWorkDouble), numberRows, fp); fclose(fp); } else { std::cout << "Unable to open file " << fileName << std::endl; } } #endif // Could change on CLP_LONG_CHOLESKY or COIN_LONG_WORK? static CoinWorkDouble eScale = 1.0e27; static CoinWorkDouble eBaseCaution = 1.0e-12; static CoinWorkDouble eBase = 1.0e-12; static CoinWorkDouble eDiagonal = 1.0e25; static CoinWorkDouble eDiagonalCaution = 1.0e18; static CoinWorkDouble eExtra = 1.0e-12; // main function int ClpPredictorCorrector::solve ( ) { problemStatus_ = -1; algorithm_ = 1; //create all regions if (!createWorkingData()) { problemStatus_ = 4; return 2; } #if COIN_LONG_WORK // reallocate some regions double * dualSave = dual_; dual_ = reinterpret_cast(new CoinWorkDouble[numberRows_]); double * reducedCostSave = reducedCost_; reducedCost_ = reinterpret_cast(new CoinWorkDouble[numberColumns_]); #endif //diagonalPerturbation_=1.0e-25; ClpMatrixBase * saveMatrix = NULL; // If quadratic then make copy so we can actually scale or normalize #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif /* If modeSwitch is : 0 - normal 1 - bit switch off centering 2 - bit always do type 2 4 - accept corrector nearly always */ int modeSwitch = 0; //if (quadraticObj) //modeSwitch |= 1; // switch off centring for now //if (quadraticObj) //modeSwitch |=4; ClpObjective * saveObjective = NULL; if (quadraticObj) { // check KKT is on if (!cholesky_->kkt()) { //No! handler_->message(CLP_BARRIER_KKT, messages_) << CoinMessageEol; return -1; } saveObjective = objective_; // We are going to make matrix full rather half objective_ = new ClpQuadraticObjective(*quadraticObj, 1); } bool allowIncreasingGap = (modeSwitch & 4) != 0; // If scaled then really scale matrix if (scalingFlag_ > 0 && rowScale_) { saveMatrix = matrix_; matrix_ = matrix_->scaledColumnCopy(this); } //initializeFeasible(); - this just set fixed flag smallestInfeasibility_ = COIN_DBL_MAX; int i; for (i = 0; i < LENGTH_HISTORY; i++) historyInfeasibility_[i] = COIN_DBL_MAX; //bool firstTime=true; //firstFactorization(true); int returnCode = cholesky_->order(this); if (returnCode || cholesky_->symbolic()) { COIN_DETAIL_PRINT(printf("Error return from symbolic - probably not enough memory\n")); problemStatus_ = 4; //delete all temporary regions deleteWorkingData(); if (saveMatrix) { // restore normal copy delete matrix_; matrix_ = saveMatrix; } // Restore quadratic objective if necessary if (saveObjective) { delete objective_; objective_ = saveObjective; } return -1; } mu_ = 1.0e10; diagonalScaleFactor_ = 1.0; //set iterations numberIterations_ = -1; int numberTotal = numberRows_ + numberColumns_; //initialize solution here if(createSolution() < 0) { COIN_DETAIL_PRINT(printf("Not enough memory\n")); problemStatus_ = 4; //delete all temporary regions deleteWorkingData(); if (saveMatrix) { // restore normal copy delete matrix_; matrix_ = saveMatrix; } return -1; } CoinWorkDouble * dualArray = reinterpret_cast(dual_); // Could try centering steps without any original step i.e. just center //firstFactorization(false); CoinZeroN(dualArray, numberRows_); multiplyAdd(solution_ + numberColumns_, numberRows_, -1.0, errorRegion_, 0.0); matrix_->times(1.0, solution_, errorRegion_); maximumRHSError_ = maximumAbsElement(errorRegion_, numberRows_); maximumBoundInfeasibility_ = maximumRHSError_; //CoinWorkDouble maximumDualError_=COIN_DBL_MAX; //initialize actualDualStep_ = 0.0; actualPrimalStep_ = 0.0; gonePrimalFeasible_ = false; goneDualFeasible_ = false; //bool hadGoodSolution=false; diagonalNorm_ = solutionNorm_; mu_ = solutionNorm_; int numberFixed = updateSolution(-COIN_DBL_MAX); int numberFixedTotal = numberFixed; //int numberRows_DroppedBefore=0; //CoinWorkDouble extra=eExtra; //CoinWorkDouble maximumPerturbation=COIN_DBL_MAX; //constants for infeas interior point const CoinWorkDouble beta2 = 0.99995; const CoinWorkDouble tau = 0.00002; CoinWorkDouble lastComplementarityGap = COIN_DBL_MAX * 1.0e-20; CoinWorkDouble lastStep = 1.0; // use to see if to take affine CoinWorkDouble checkGap = COIN_DBL_MAX; int lastGoodIteration = 0; CoinWorkDouble bestObjectiveGap = COIN_DBL_MAX; CoinWorkDouble bestObjective = COIN_DBL_MAX; int bestKilled = -1; int saveIteration = -1; int saveIteration2 = -1; bool sloppyOptimal = false; // this just to be used to exit bool sloppyOptimal2 = false; CoinWorkDouble * savePi = NULL; CoinWorkDouble * savePrimal = NULL; CoinWorkDouble * savePi2 = NULL; CoinWorkDouble * savePrimal2 = NULL; // Extra regions for centering CoinWorkDouble * saveX = new CoinWorkDouble[numberTotal]; CoinWorkDouble * saveY = new CoinWorkDouble[numberRows_]; CoinWorkDouble * saveZ = new CoinWorkDouble[numberTotal]; CoinWorkDouble * saveW = new CoinWorkDouble[numberTotal]; CoinWorkDouble * saveSL = new CoinWorkDouble[numberTotal]; CoinWorkDouble * saveSU = new CoinWorkDouble[numberTotal]; // Save smallest mu used in primal dual moves CoinWorkDouble objScale = optimizationDirection_ / (rhsScale_ * objectiveScale_); while (problemStatus_ < 0) { //#define FULL_DEBUG #ifdef FULL_DEBUG { int i; printf("row pi artvec rhsfx\n"); for (i = 0; i < numberRows_; i++) { printf("%d %g %g %g\n", i, dual_[i], errorRegion_[i], rhsFixRegion_[i]); } printf(" col dsol ddiag dwvec dzvec dbdslu dbdsll\n"); for (i = 0; i < numberColumns_ + numberRows_; i++) { printf(" %d %g %g %g %g %g %g\n", i, solution_[i], diagonal_[i], wVec_[i], zVec_[i], upperSlack_[i], lowerSlack_[i]); } } #endif complementarityGap_ = complementarityGap(numberComplementarityPairs_, numberComplementarityItems_, 0); handler_->message(CLP_BARRIER_ITERATION, messages_) << numberIterations_ << static_cast(primalObjective_ * objScale - dblParam_[ClpObjOffset]) << static_cast(dualObjective_ * objScale - dblParam_[ClpObjOffset]) << static_cast(complementarityGap_) << numberFixedTotal << cholesky_->rank() << CoinMessageEol; // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; break; } } #if 0 if (numberIterations_ == -1) { saveSolution("xxx.sav"); if (yyyyyy) exit(99); } #endif // move up history for (i = 1; i < LENGTH_HISTORY; i++) historyInfeasibility_[i-1] = historyInfeasibility_[i]; historyInfeasibility_[LENGTH_HISTORY-1] = complementarityGap_; // switch off saved if changes //if (saveIteration+10 KEEP_GOING_IF_FIXED) goodGapChange = 0.99; // make more likely to carry on } CoinWorkDouble gapO; CoinWorkDouble lastGood = bestObjectiveGap; if (gonePrimalFeasible_ && goneDualFeasible_) { CoinWorkDouble largestObjective; if (CoinAbs(primalObjective_) > CoinAbs(dualObjective_)) { largestObjective = CoinAbs(primalObjective_); } else { largestObjective = CoinAbs(dualObjective_); } if (largestObjective < 1.0) { largestObjective = 1.0; } gapO = CoinAbs(primalObjective_ - dualObjective_) / largestObjective; handler_->message(CLP_BARRIER_OBJECTIVE_GAP, messages_) << static_cast(gapO) << CoinMessageEol; //start saving best bool saveIt = false; if (gapO < bestObjectiveGap) { bestObjectiveGap = gapO; #ifndef SAVE_ON_OBJ saveIt = true; #endif } if (primalObjective_ < bestObjective) { bestObjective = primalObjective_; #ifdef SAVE_ON_OBJ saveIt = true; #endif } if (numberFixedTotal > bestKilled) { bestKilled = numberFixedTotal; #if KEEP_GOING_IF_FIXED<10 saveIt = true; #endif } if (saveIt) { #if KEEP_GOING_IF_FIXED<10 COIN_DETAIL_PRINT(printf("saving\n")); #endif saveIteration = numberIterations_; if (!savePi) { savePi = new CoinWorkDouble[numberRows_]; savePrimal = new CoinWorkDouble [numberTotal]; } CoinMemcpyN(dualArray, numberRows_, savePi); CoinMemcpyN(solution_, numberTotal, savePrimal); } else if(gapO > 2.0 * bestObjectiveGap) { //maybe be more sophisticated e.g. re-initialize having //fixed variables and dropped rows //std::cout <<" gap increasing "<= 0) { handler_->message(CLP_BARRIER_GONE_INFEASIBLE, messages_) << CoinMessageEol; CoinWorkDouble scaledRHSError = maximumRHSError_ / (solutionNorm_ + 10.0); // save alternate if (numberFixedTotal > bestKilled && maximumBoundInfeasibility_ < 1.0e-6 && scaledRHSError < 1.0e-2) { bestKilled = numberFixedTotal; #if KEEP_GOING_IF_FIXED<10 COIN_DETAIL_PRINT(printf("saving alternate\n")); #endif saveIteration2 = numberIterations_; if (!savePi2) { savePi2 = new CoinWorkDouble[numberRows_]; savePrimal2 = new CoinWorkDouble [numberTotal]; } CoinMemcpyN(dualArray, numberRows_, savePi2); CoinMemcpyN(solution_, numberTotal, savePrimal2); } if (sloppyOptimal2) { // vaguely optimal if (maximumBoundInfeasibility_ > 1.0e-2 || scaledRHSError > 1.0e-2 || maximumDualError_ > objectiveNorm_ * 1.0e-2) { handler_->message(CLP_BARRIER_EXIT2, messages_) << saveIteration << CoinMessageEol; problemStatus_ = 0; // benefit of doubt break; } } else { // not close to optimal but check if getting bad CoinWorkDouble scaledRHSError = maximumRHSError_ / (solutionNorm_ + 10.0); if ((maximumBoundInfeasibility_ > 1.0e-1 || scaledRHSError > 1.0e-1 || maximumDualError_ > objectiveNorm_ * 1.0e-1) && (numberIterations_ > 50 && complementarityGap_ > 0.9 * historyInfeasibility_[0])) { handler_->message(CLP_BARRIER_EXIT2, messages_) << saveIteration << CoinMessageEol; break; } if (complementarityGap_ > 0.95 * checkGap && bestObjectiveGap < 1.0e-3 && (numberIterations_ > saveIteration + 5 || numberIterations_ > 100)) { handler_->message(CLP_BARRIER_EXIT2, messages_) << saveIteration << CoinMessageEol; break; } } } if (complementarityGap_ > 0.5 * checkGap && primalObjective_ > bestObjective + 1.0e-9 && (numberIterations_ > saveIteration + 5 || numberIterations_ > 100)) { handler_->message(CLP_BARRIER_EXIT2, messages_) << saveIteration << CoinMessageEol; break; } } // See if we should be thinking about exit if diverging double relativeMultiplier = 1.0 + fabs(primalObjective_) + fabs(dualObjective_); // Quadratic coding is rubbish so be more forgiving? if (quadraticObj) relativeMultiplier *= 5.0; if (gapO < 1.0e-5 + 1.0e-9 * relativeMultiplier || complementarityGap_ < 0.1 + 1.0e-9 * relativeMultiplier) sloppyOptimal2 = true; if ((gapO < 1.0e-6 || (gapO < 1.0e-4 && complementarityGap_ < 0.1)) && !sloppyOptimal) { sloppyOptimal = true; sloppyOptimal2 = true; handler_->message(CLP_BARRIER_CLOSE_TO_OPTIMAL, messages_) << numberIterations_ << static_cast(complementarityGap_) << CoinMessageEol; } int numberBack = quadraticObj ? 10 : 5; //tryJustPredictor=true; //printf("trying just predictor\n"); //} if (complementarityGap_ >= 1.05 * lastComplementarityGap) { handler_->message(CLP_BARRIER_COMPLEMENTARITY, messages_) << static_cast(complementarityGap_) << "increasing" << CoinMessageEol; if (saveIteration >= 0 && sloppyOptimal2) { handler_->message(CLP_BARRIER_EXIT2, messages_) << saveIteration << CoinMessageEol; break; } else if (numberIterations_ - lastGoodIteration >= numberBack && complementarityGap_ < 1.0e-6) { break; // not doing very well - give up } } else if (complementarityGap_ < goodGapChange * lastComplementarityGap) { lastGoodIteration = numberIterations_; lastComplementarityGap = complementarityGap_; } else if (numberIterations_ - lastGoodIteration >= numberBack && complementarityGap_ < 1.0e-3) { handler_->message(CLP_BARRIER_COMPLEMENTARITY, messages_) << static_cast(complementarityGap_) << "not decreasing" << CoinMessageEol; if (gapO > 0.75 * lastGood && numberFixed < KEEP_GOING_IF_FIXED) { break; } } else if (numberIterations_ - lastGoodIteration >= 2 && complementarityGap_ < 1.0e-6) { handler_->message(CLP_BARRIER_COMPLEMENTARITY, messages_) << static_cast(complementarityGap_) << "not decreasing" << CoinMessageEol; break; } if (numberIterations_ > maximumBarrierIterations_ || hitMaximumIterations()) { handler_->message(CLP_BARRIER_STOPPING, messages_) << CoinMessageEol; problemStatus_ = 3; onStopped(); // set secondary status break; } if (gapO < targetGap_) { problemStatus_ = 0; handler_->message(CLP_BARRIER_EXIT, messages_) << " " << CoinMessageEol; break;//finished } if (complementarityGap_ < 1.0e-12) { problemStatus_ = 0; handler_->message(CLP_BARRIER_EXIT, messages_) << "- small complementarity gap" << CoinMessageEol; break;//finished } if (complementarityGap_ < 1.0e-10 && gapO < 1.0e-10) { problemStatus_ = 0; handler_->message(CLP_BARRIER_EXIT, messages_) << "- objective gap and complementarity gap both small" << CoinMessageEol; break;//finished } if (gapO < 1.0e-9) { CoinWorkDouble value = gapO * complementarityGap_; value *= actualPrimalStep_; value *= actualDualStep_; //std::cout< lastGoodIteration) { problemStatus_ = 0; handler_->message(CLP_BARRIER_EXIT, messages_) << "- objective gap and complementarity gap both smallish and small steps" << CoinMessageEol; break;//finished } } CoinWorkDouble nextGap = COIN_DBL_MAX; int nextNumber = 0; int nextNumberItems = 0; worstDirectionAccuracy_ = 0.0; int newDropped = 0; //Predictor step //prepare for cholesky. Set up scaled diagonal in deltaX // ** for efficiency may be better if scale factor known before CoinWorkDouble norm2 = 0.0; CoinWorkDouble maximumValue; getNorms(diagonal_, numberTotal, maximumValue, norm2); diagonalNorm_ = CoinSqrt(norm2 / numberComplementarityPairs_); diagonalScaleFactor_ = 1.0; CoinWorkDouble maximumAllowable = eScale; //scale so largest is less than allowable ? could do better CoinWorkDouble factor = 0.5; while (maximumValue > maximumAllowable) { diagonalScaleFactor_ *= factor; maximumValue *= factor; } /* endwhile */ if (diagonalScaleFactor_ != 1.0) { handler_->message(CLP_BARRIER_SCALING, messages_) << "diagonal" << static_cast(diagonalScaleFactor_) << CoinMessageEol; diagonalNorm_ *= diagonalScaleFactor_; } multiplyAdd(NULL, numberTotal, 0.0, diagonal_, diagonalScaleFactor_); int * rowsDroppedThisTime = new int [numberRows_]; newDropped = cholesky_->factorize(diagonal_, rowsDroppedThisTime); if (newDropped) { if (newDropped == -1) { COIN_DETAIL_PRINT(printf("Out of memory\n")); problemStatus_ = 4; //delete all temporary regions deleteWorkingData(); if (saveMatrix) { // restore normal copy delete matrix_; matrix_ = saveMatrix; } return -1; } else { #ifndef NDEBUG //int newDropped2=cholesky_->factorize(diagonal_,rowsDroppedThisTime); //assert(!newDropped2); #endif if (newDropped < 0 && 0) { //replace dropped newDropped = -newDropped; //off 1 to allow for reset all newDropped--; //set all bits false cholesky_->resetRowsDropped(); } } } delete [] rowsDroppedThisTime; if (cholesky_->status()) { std::cout << "bad cholesky?" << std::endl; abort(); } int phase = 0; // predictor, corrector , primal dual CoinWorkDouble directionAccuracy = 0.0; bool doCorrector = true; bool goodMove = true; //set up for affine direction setupForSolve(phase); if ((modeSwitch & 2) == 0) { directionAccuracy = findDirectionVector(phase); if (directionAccuracy > worstDirectionAccuracy_) { worstDirectionAccuracy_ = directionAccuracy; } if (saveIteration > 0 && directionAccuracy > 1.0) { handler_->message(CLP_BARRIER_EXIT2, messages_) << saveIteration << CoinMessageEol; break; } findStepLength(phase); nextGap = complementarityGap(nextNumber, nextNumberItems, 1); debugMove(0, actualPrimalStep_, actualDualStep_); debugMove(0, 1.0e-2, 1.0e-2); } CoinWorkDouble affineGap = nextGap; int bestPhase = 0; CoinWorkDouble bestNextGap = nextGap; // ? bestNextGap = CoinMax(nextGap, 0.8 * complementarityGap_); if (quadraticObj) bestNextGap = CoinMax(nextGap, 0.99 * complementarityGap_); if (complementarityGap_ > 1.0e-4 * numberComplementarityPairs_) { //std::cout <<"predicted duality gap "< (numberComplementarityPairs_), 2.0); } else { phi = pow(static_cast (numberComplementarityPairs_), 1.5); if (phi < 500.0 * 500.0) { phi = 500.0 * 500.0; } } mu_ = complementarityGap_ / phi; } //save information CoinWorkDouble product = affineProduct(); #if 0 //can we do corrector step? CoinWorkDouble xx = complementarityGap_ * (beta2 - tau) + product; if (xx > 0.0) { CoinWorkDouble saveMu = mu_; CoinWorkDouble mu2 = numberComplementarityPairs_; mu2 = xx / mu2; if (mu2 > mu_) { //std::cout<<" could increase to "<message(CLP_BARRIER_MU, messages_) << saveMu << mu_ << CoinMessageEol; } else { //std::cout<<" bad by any standards"< 0.9 * complementarityGap_ || 1) { goodMove = false; bestNextGap = COIN_DBL_MAX; } //CoinWorkDouble floatNumber = 2.0*numberComplementarityPairs_; //floatNumber = 1.0*numberComplementarityItems_; //mu_=nextGap/floatNumber; handler_->message(CLP_BARRIER_INFO, messages_) << "no corrector step" << CoinMessageEol; } else { phase = 1; } // If bad gap - try standard primal dual if (nextGap > complementarityGap_ * 1.001) goodMove = false; if ((modeSwitch & 2) != 0) goodMove = false; if (goodMove && doCorrector) { CoinMemcpyN(deltaX_, numberTotal, saveX); CoinMemcpyN(deltaY_, numberRows_, saveY); CoinMemcpyN(deltaZ_, numberTotal, saveZ); CoinMemcpyN(deltaW_, numberTotal, saveW); CoinMemcpyN(deltaSL_, numberTotal, saveSL); CoinMemcpyN(deltaSU_, numberTotal, saveSU); #ifdef HALVE CoinWorkDouble savePrimalStep = actualPrimalStep_; CoinWorkDouble saveDualStep = actualDualStep_; CoinWorkDouble saveMu = mu_; #endif //set up for next step setupForSolve(phase); CoinWorkDouble directionAccuracy2 = findDirectionVector(phase); if (directionAccuracy2 > worstDirectionAccuracy_) { worstDirectionAccuracy_ = directionAccuracy2; } CoinWorkDouble testValue = 1.0e2 * directionAccuracy; if (1.0e2 * projectionTolerance_ > testValue) { testValue = 1.0e2 * projectionTolerance_; } if (primalTolerance() > testValue) { testValue = primalTolerance(); } if (maximumRHSError_ > testValue) { testValue = maximumRHSError_; } if (directionAccuracy2 > testValue && numberIterations_ >= -77) { goodMove = false; #ifdef SOME_DEBUG printf("accuracy %g phase 1 failed, test value %g\n", directionAccuracy2, testValue); #endif } if (goodMove) { phase = 1; CoinWorkDouble norm = findStepLength(phase); nextGap = complementarityGap(nextNumber, nextNumberItems, 1); debugMove(1, actualPrimalStep_, actualDualStep_); //debugMove(1,1.0e-7,1.0e-7); goodMove = checkGoodMove(true, bestNextGap, allowIncreasingGap); if (norm < 0) goodMove = false; if (!goodMove) { #ifdef SOME_DEBUG printf("checkGoodMove failed\n"); #endif } } #ifdef HALVE int nHalve = 0; // relax test bestNextGap = CoinMax(bestNextGap, 0.9 * complementarityGap_); while (!goodMove) { mu_ = saveMu; actualPrimalStep_ = savePrimalStep; actualDualStep_ = saveDualStep; int i; //printf("halve %d\n",nHalve); nHalve++; const CoinWorkDouble lambda = 0.5; for (i = 0; i < numberRows_; i++) deltaY_[i] = lambda * deltaY_[i] + (1.0 - lambda) * saveY[i]; for (i = 0; i < numberTotal; i++) { deltaX_[i] = lambda * deltaX_[i] + (1.0 - lambda) * saveX[i]; deltaZ_[i] = lambda * deltaZ_[i] + (1.0 - lambda) * saveZ[i]; deltaW_[i] = lambda * deltaW_[i] + (1.0 - lambda) * saveW[i]; deltaSL_[i] = lambda * deltaSL_[i] + (1.0 - lambda) * saveSL[i]; deltaSU_[i] = lambda * deltaSU_[i] + (1.0 - lambda) * saveSU[i]; } CoinMemcpyN(saveX, numberTotal, deltaX_); CoinMemcpyN(saveY, numberRows_, deltaY_); CoinMemcpyN(saveZ, numberTotal, deltaZ_); CoinMemcpyN(saveW, numberTotal, deltaW_); CoinMemcpyN(saveSL, numberTotal, deltaSL_); CoinMemcpyN(saveSU, numberTotal, deltaSU_); findStepLength(1); nextGap = complementarityGap(nextNumber, nextNumberItems, 1); goodMove = checkGoodMove(true, bestNextGap, allowIncreasingGap); if (nHalve > 10) break; //assert (goodMove); } if (nHalve && handler_->logLevel() > 2) printf("halved %d times\n", nHalve); #endif } //bestPhase=-1; //goodMove=false; if (!goodMove) { // Just primal dual step CoinWorkDouble floatNumber; floatNumber = 2.0 * numberComplementarityPairs_; //floatNumber = numberComplementarityItems_; CoinWorkDouble saveMu = mu_; // use one from predictor corrector mu_ = complementarityGap_ / floatNumber; // If going well try small mu mu_ *= CoinSqrt((1.0 - lastStep) / (1.0 + 10.0 * lastStep)); CoinWorkDouble mu1 = mu_; CoinWorkDouble phi; if (numberComplementarityPairs_ <= 500) { phi = pow(static_cast (numberComplementarityPairs_), 2.0); } else { phi = pow(static_cast (numberComplementarityPairs_), 1.5); if (phi < 500.0 * 500.0) { phi = 500.0 * 500.0; } } mu_ = complementarityGap_ / phi; //printf("pd mu %g, alternate %g, smallest\n",mu_,mu1); mu_ = CoinSqrt(mu_ * mu1); mu_ = mu1; if ((numberIterations_ & 1) == 0 || numberIterations_ < 10) mu_ = saveMu; // Try simpler floatNumber = numberComplementarityItems_; mu_ = 0.5 * complementarityGap_ / floatNumber; //if ((modeSwitch&2)==0) { //if ((numberIterations_&1)==0) // mu_ *= 0.5; //} else { //mu_ *= 0.8; //} //set up for next step setupForSolve(2); findDirectionVector(2); CoinWorkDouble norm = findStepLength(2); // just for debug bestNextGap = complementarityGap_ * 1.0005; //bestNextGap=COIN_DBL_MAX; nextGap = complementarityGap(nextNumber, nextNumberItems, 2); debugMove(2, actualPrimalStep_, actualDualStep_); //debugMove(2,1.0e-7,1.0e-7); checkGoodMove(false, bestNextGap, allowIncreasingGap); if ((nextGap > 0.9 * complementarityGap_ && bestPhase == 0 && affineGap < nextGap && (numberIterations_ > 80 || (numberIterations_ > 20 && quadraticObj))) || norm < 0.0) { // Back to affine phase = 0; setupForSolve(phase); directionAccuracy = findDirectionVector(phase); findStepLength(phase); nextGap = complementarityGap(nextNumber, nextNumberItems, 1); bestNextGap = complementarityGap_; //checkGoodMove(false, bestNextGap,allowIncreasingGap); } } if (!goodMove) mu_ = nextGap / (static_cast (nextNumber) * 1.1); //if (quadraticObj) //goodMove=true; //goodMove=false; //TEMP // Do centering steps int numberTries = 0; int numberGoodTries = 0; #ifdef COIN_DETAIL CoinWorkDouble nextCenterGap = 0.0; CoinWorkDouble originalDualStep = actualDualStep_; CoinWorkDouble originalPrimalStep = actualPrimalStep_; #endif if (actualDualStep_ > 0.9 && actualPrimalStep_ > 0.9) goodMove = false; // don't bother if ((modeSwitch & 1) != 0) goodMove = false; while (goodMove && numberTries < 5) { goodMove = false; numberTries++; CoinMemcpyN(deltaX_, numberTotal, saveX); CoinMemcpyN(deltaY_, numberRows_, saveY); CoinMemcpyN(deltaZ_, numberTotal, saveZ); CoinMemcpyN(deltaW_, numberTotal, saveW); CoinWorkDouble savePrimalStep = actualPrimalStep_; CoinWorkDouble saveDualStep = actualDualStep_; CoinWorkDouble saveMu = mu_; setupForSolve(3); findDirectionVector(3); findStepLength(3); debugMove(3, actualPrimalStep_, actualDualStep_); //debugMove(3,1.0e-7,1.0e-7); CoinWorkDouble xGap = complementarityGap(nextNumber, nextNumberItems, 3); // If one small then that's the one that counts CoinWorkDouble checkDual = saveDualStep; CoinWorkDouble checkPrimal = savePrimalStep; if (checkDual > 5.0 * checkPrimal) { checkDual = 2.0 * checkPrimal; } else if (checkPrimal > 5.0 * checkDual) { checkPrimal = 2.0 * checkDual; } if (actualPrimalStep_ < checkPrimal || actualDualStep_ < checkDual || (xGap > nextGap && xGap > 0.9 * complementarityGap_)) { //if (actualPrimalStep_<=checkPrimal|| //actualDualStep_<=checkDual) { #ifdef SOME_DEBUG printf("PP rejected gap %.18g, steps %.18g %.18g, 2 gap %.18g, steps %.18g %.18g\n", xGap, actualPrimalStep_, actualDualStep_, nextGap, savePrimalStep, saveDualStep); #endif mu_ = saveMu; actualPrimalStep_ = savePrimalStep; actualDualStep_ = saveDualStep; CoinMemcpyN(saveX, numberTotal, deltaX_); CoinMemcpyN(saveY, numberRows_, deltaY_); CoinMemcpyN(saveZ, numberTotal, deltaZ_); CoinMemcpyN(saveW, numberTotal, deltaW_); } else { #ifdef SOME_DEBUG printf("PPphase 3 gap %.18g, steps %.18g %.18g, 2 gap %.18g, steps %.18g %.18g\n", xGap, actualPrimalStep_, actualDualStep_, nextGap, savePrimalStep, saveDualStep); #endif numberGoodTries++; #ifdef COIN_DETAIL nextCenterGap = xGap; #endif // See if big enough change if (actualPrimalStep_ < 1.01 * checkPrimal || actualDualStep_ < 1.01 * checkDual) { // stop now } else { // carry on goodMove = true; } } } if (numberGoodTries && handler_->logLevel() > 1) { COIN_DETAIL_PRINT(printf("%d centering steps moved from (gap %.18g, dual %.18g, primal %.18g) to (gap %.18g, dual %.18g, primal %.18g)\n", numberGoodTries, static_cast(nextGap), static_cast(originalDualStep), static_cast(originalPrimalStep), static_cast(nextCenterGap), static_cast(actualDualStep_), static_cast(actualPrimalStep_))); } // save last gap checkGap = complementarityGap_; numberFixed = updateSolution(nextGap); numberFixedTotal += numberFixed; } /* endwhile */ delete [] saveX; delete [] saveY; delete [] saveZ; delete [] saveW; delete [] saveSL; delete [] saveSU; if (savePi) { if (numberIterations_ - saveIteration > 20 && numberIterations_ - saveIteration2 < 5) { #if KEEP_GOING_IF_FIXED<10 std::cout << "Restoring2 from iteration " << saveIteration2 << std::endl; #endif CoinMemcpyN(savePi2, numberRows_, dualArray); CoinMemcpyN(savePrimal2, numberTotal, solution_); } else { #if KEEP_GOING_IF_FIXED<10 std::cout << "Restoring from iteration " << saveIteration << std::endl; #endif CoinMemcpyN(savePi, numberRows_, dualArray); CoinMemcpyN(savePrimal, numberTotal, solution_); } delete [] savePi; delete [] savePrimal; } delete [] savePi2; delete [] savePrimal2; //recompute slacks // Split out solution CoinZeroN(rowActivity_, numberRows_); CoinMemcpyN(solution_, numberColumns_, columnActivity_); matrix_->times(1.0, columnActivity_, rowActivity_); //unscale objective multiplyAdd(NULL, numberTotal, 0.0, cost_, scaleFactor_); multiplyAdd(NULL, numberRows_, 0, dualArray, scaleFactor_); checkSolution(); //CoinMemcpyN(reducedCost_,numberColumns_,dj_); // If quadratic use last solution // Restore quadratic objective if necessary if (saveObjective) { delete objective_; objective_ = saveObjective; objectiveValue_ = 0.5 * (primalObjective_ + dualObjective_); } handler_->message(CLP_BARRIER_END, messages_) << static_cast(sumPrimalInfeasibilities_) << static_cast(sumDualInfeasibilities_) << static_cast(complementarityGap_) << static_cast(objectiveValue()) << CoinMessageEol; //#ifdef SOME_DEBUG if (handler_->logLevel() > 1) COIN_DETAIL_PRINT(printf("ENDRUN status %d after %d iterations\n", problemStatus_, numberIterations_)); //#endif //std::cout<<"Absolute primal infeasibility at end "< tolerance) { if (zVec_[iColumn] < -z1 * maximumDualStep) { maximumDualStep = -zVec_[iColumn] / z1; #ifdef SOME_DEBUG chosenDualSequence = iColumn; lowDual = true; #endif } } if (lowerSlack_[iColumn] < maximumPrimalStep * delta) { CoinWorkDouble newStep = lowerSlack_[iColumn] / delta; if (newStep > 0.2 || newZ < hitTolerance || delta > 1.0e3 || delta <= 1.0e-6 || dj_[iColumn] < hitTolerance) { maximumPrimalStep = newStep; #ifdef SOME_DEBUG chosenPrimalSequence = iColumn; lowPrimal = true; #endif } else { //printf("small %d delta %g newZ %g step %g\n",iColumn,delta,newZ,newStep); } } } if (upperBound(iColumn)) { CoinWorkDouble delta = - deltaSU_[iColumn];; CoinWorkDouble w1 = deltaW_[iColumn]; CoinWorkDouble newT = wVec_[iColumn] + w1; if (wVec_[iColumn] > tolerance) { if (wVec_[iColumn] < -w1 * maximumDualStep) { maximumDualStep = -wVec_[iColumn] / w1; #ifdef SOME_DEBUG chosenDualSequence = iColumn; lowDual = false; #endif } } if (upperSlack_[iColumn] < maximumPrimalStep * delta) { CoinWorkDouble newStep = upperSlack_[iColumn] / delta; if (newStep > 0.2 || newT < hitTolerance || delta > 1.0e3 || delta <= 1.0e-6 || dj_[iColumn] > -hitTolerance) { maximumPrimalStep = newStep; #ifdef SOME_DEBUG chosenPrimalSequence = iColumn; lowPrimal = false; #endif } else { //printf("small %d delta %g newT %g step %g\n",iColumn,delta,newT,newStep); } } } } } #ifdef SOME_DEBUG printf("new step - phase %d, norm %.18g, dual step %.18g, primal step %.18g\n", phase, directionNorm, maximumDualStep, maximumPrimalStep); if (lowDual) printf("ld %d %g %g => %g (dj %g,sol %g) ", chosenDualSequence, zVec_[chosenDualSequence], deltaZ_[chosenDualSequence], zVec_[chosenDualSequence] + maximumDualStep * deltaZ_[chosenDualSequence], dj_[chosenDualSequence], solution_[chosenDualSequence]); else printf("ud %d %g %g => %g (dj %g,sol %g) ", chosenDualSequence, wVec_[chosenDualSequence], deltaW_[chosenDualSequence], wVec_[chosenDualSequence] + maximumDualStep * deltaW_[chosenDualSequence], dj_[chosenDualSequence], solution_[chosenDualSequence]); if (lowPrimal) printf("lp %d %g %g => %g (dj %g,sol %g)\n", chosenPrimalSequence, lowerSlack_[chosenPrimalSequence], deltaSL_[chosenPrimalSequence], lowerSlack_[chosenPrimalSequence] + maximumPrimalStep * deltaSL_[chosenPrimalSequence], dj_[chosenPrimalSequence], solution_[chosenPrimalSequence]); else printf("up %d %g %g => %g (dj %g,sol %g)\n", chosenPrimalSequence, upperSlack_[chosenPrimalSequence], deltaSU_[chosenPrimalSequence], upperSlack_[chosenPrimalSequence] + maximumPrimalStep * deltaSU_[chosenPrimalSequence], dj_[chosenPrimalSequence], solution_[chosenPrimalSequence]); #endif actualPrimalStep_ = stepLength_ * maximumPrimalStep; if (phase >= 0 && actualPrimalStep_ > 1.0) { actualPrimalStep_ = 1.0; } actualDualStep_ = stepLength_ * maximumDualStep; if (phase >= 0 && actualDualStep_ > 1.0) { actualDualStep_ = 1.0; } // See if quadratic objective #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif if (quadraticObj) { // Use smaller unless very small CoinWorkDouble smallerStep = CoinMin(actualDualStep_, actualPrimalStep_); if (smallerStep > 0.0001) { actualDualStep_ = smallerStep; actualPrimalStep_ = smallerStep; } } #define OFFQ #ifndef OFFQ if (quadraticObj) { // Don't bother if phase 0 or 3 or large gap //if ((phase==1||phase==2||phase==0)&&maximumDualError_>0.1*complementarityGap_ //&&smallerStep>0.001) { if ((phase == 1 || phase == 2 || phase == 0 || phase == 3)) { // minimize complementarity + norm*dual inf ? primal inf // at first - just check better - if not // Complementarity gap will be a*change*change + b*change +c CoinWorkDouble a = 0.0; CoinWorkDouble b = 0.0; CoinWorkDouble c = 0.0; /* SQUARE of dual infeasibility will be: square of dj - ...... */ CoinWorkDouble aq = 0.0; CoinWorkDouble bq = 0.0; CoinWorkDouble cq = 0.0; CoinWorkDouble gamma2 = gamma_ * gamma_; // gamma*gamma will be added to diagonal CoinWorkDouble * linearDjChange = new CoinWorkDouble[numberTotal]; CoinZeroN(linearDjChange, numberColumns_); multiplyAdd(deltaY_, numberRows_, 1.0, linearDjChange + numberColumns_, 0.0); matrix_->transposeTimes(-1.0, deltaY_, linearDjChange); CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); CoinWorkDouble * quadraticElement = quadratic->getMutableElements(); for (iColumn = 0; iColumn < numberTotal; iColumn++) { CoinWorkDouble oldPrimal = solution_[iColumn]; if (!flagged(iColumn)) { if (lowerBound(iColumn)) { CoinWorkDouble change = oldPrimal + deltaX_[iColumn] - lowerSlack_[iColumn] - lower_[iColumn]; c += lowerSlack_[iColumn] * zVec_[iColumn]; b += lowerSlack_[iColumn] * deltaZ_[iColumn] + zVec_[iColumn] * change; a += deltaZ_[iColumn] * change; } if (upperBound(iColumn)) { CoinWorkDouble change = upper_[iColumn] - oldPrimal - deltaX_[iColumn] - upperSlack_[iColumn]; c += upperSlack_[iColumn] * wVec_[iColumn]; b += upperSlack_[iColumn] * deltaW_[iColumn] + wVec_[iColumn] * change; a += deltaW_[iColumn] * change; } // new djs are dj_ + change*value CoinWorkDouble djChange = linearDjChange[iColumn]; if (iColumn < numberColumns_) { for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; CoinWorkDouble changeJ = deltaX_[jColumn]; CoinWorkDouble elementValue = quadraticElement[j]; djChange += changeJ * elementValue; } } CoinWorkDouble gammaTerm = gamma2; if (primalR_) { gammaTerm += primalR_[iColumn]; } djChange += gammaTerm; // and dual infeasibility CoinWorkDouble oldInf = dj_[iColumn] - zVec_[iColumn] + wVec_[iColumn] + gammaTerm * solution_[iColumn]; CoinWorkDouble changeInf = djChange - deltaZ_[iColumn] + deltaW_[iColumn]; cq += oldInf * oldInf; bq += 2.0 * oldInf * changeInf; aq += changeInf * changeInf; } else { // fixed if (lowerBound(iColumn)) { c += lowerSlack_[iColumn] * zVec_[iColumn]; } if (upperBound(iColumn)) { c += upperSlack_[iColumn] * wVec_[iColumn]; } // new djs are dj_ + change*value CoinWorkDouble djChange = linearDjChange[iColumn]; if (iColumn < numberColumns_) { for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; CoinWorkDouble changeJ = deltaX_[jColumn]; CoinWorkDouble elementValue = quadraticElement[j]; djChange += changeJ * elementValue; } } CoinWorkDouble gammaTerm = gamma2; if (primalR_) { gammaTerm += primalR_[iColumn]; } djChange += gammaTerm; // and dual infeasibility CoinWorkDouble oldInf = dj_[iColumn] - zVec_[iColumn] + wVec_[iColumn] + gammaTerm * solution_[iColumn]; CoinWorkDouble changeInf = djChange - deltaZ_[iColumn] + deltaW_[iColumn]; cq += oldInf * oldInf; bq += 2.0 * oldInf * changeInf; aq += changeInf * changeInf; } } delete [] linearDjChange; // ? We want to minimize complementarityGap + solutionNorm_*square of inf ?? // maybe use inf and do line search // To check see if matches at current step CoinWorkDouble step = actualPrimalStep_; //Current gap + solutionNorm_ * CoinSqrt (sum square inf) CoinWorkDouble multiplier = solutionNorm_; multiplier *= 0.01; multiplier = 1.0; CoinWorkDouble currentInf = multiplier * CoinSqrt(cq); CoinWorkDouble nextInf = multiplier * CoinSqrt(CoinMax(cq + step * bq + step * step * aq, 0.0)); CoinWorkDouble allowedIncrease = 1.4; #ifdef SOME_DEBUG printf("lin %g %g %g -> %g\n", a, b, c, c + b * step + a * step * step); printf("quad %g %g %g -> %g\n", aq, bq, cq, cq + bq * step + aq * step * step); debugMove(7, step, step); printf ("current dualInf %g, with step of %g is %g\n", currentInf, step, nextInf); #endif if (b > -1.0e-6) { if (phase != 0) directionNorm = -1.0; } if ((phase == 1 || phase == 2 || phase == 0 || phase == 3) && nextInf > 0.1 * complementarityGap_ && nextInf > currentInf * allowedIncrease) { //cq = CoinMax(cq,10.0); // convert to (x+q)*(x+q) = w CoinWorkDouble q = bq / (1.0 * aq); CoinWorkDouble w = CoinMax(q * q + (cq / aq) * (allowedIncrease - 1.0), 0.0); w = CoinSqrt(w); CoinWorkDouble stepX = w - q; step = stepX; nextInf = multiplier * CoinSqrt(CoinMax(cq + step * bq + step * step * aq, 0.0)); #ifdef SOME_DEBUG printf ("with step of %g dualInf is %g\n", step, nextInf); #endif actualDualStep_ = CoinMin(step, actualDualStep_); actualPrimalStep_ = CoinMin(step, actualPrimalStep_); } } } else { // probably pointless as linear // minimize complementarity // Complementarity gap will be a*change*change + b*change +c CoinWorkDouble a = 0.0; CoinWorkDouble b = 0.0; CoinWorkDouble c = 0.0; for (iColumn = 0; iColumn < numberTotal; iColumn++) { CoinWorkDouble oldPrimal = solution_[iColumn]; if (!flagged(iColumn)) { if (lowerBound(iColumn)) { CoinWorkDouble change = oldPrimal + deltaX_[iColumn] - lowerSlack_[iColumn] - lower_[iColumn]; c += lowerSlack_[iColumn] * zVec_[iColumn]; b += lowerSlack_[iColumn] * deltaZ_[iColumn] + zVec_[iColumn] * change; a += deltaZ_[iColumn] * change; } if (upperBound(iColumn)) { CoinWorkDouble change = upper_[iColumn] - oldPrimal - deltaX_[iColumn] - upperSlack_[iColumn]; c += upperSlack_[iColumn] * wVec_[iColumn]; b += upperSlack_[iColumn] * deltaW_[iColumn] + wVec_[iColumn] * change; a += deltaW_[iColumn] * change; } } else { // fixed if (lowerBound(iColumn)) { c += lowerSlack_[iColumn] * zVec_[iColumn]; } if (upperBound(iColumn)) { c += upperSlack_[iColumn] * wVec_[iColumn]; } } } // ? We want to minimize complementarityGap; // maybe use inf and do line search // To check see if matches at current step CoinWorkDouble step = CoinMin(actualPrimalStep_, actualDualStep_); CoinWorkDouble next = c + b * step + a * step * step; #ifdef SOME_DEBUG printf("lin %g %g %g -> %g\n", a, b, c, c + b * step + a * step * step); debugMove(7, step, step); #endif if (b > -1.0e-6) { if (phase == 0) { #ifdef SOME_DEBUG printf("*** odd phase 0 direction\n"); #endif } else { directionNorm = -1.0; } } // and with ratio a = 0.0; b = 0.0; CoinWorkDouble ratio = actualDualStep_ / actualPrimalStep_; for (iColumn = 0; iColumn < numberTotal; iColumn++) { CoinWorkDouble oldPrimal = solution_[iColumn]; if (!flagged(iColumn)) { if (lowerBound(iColumn)) { CoinWorkDouble change = oldPrimal + deltaX_[iColumn] - lowerSlack_[iColumn] - lower_[iColumn]; b += lowerSlack_[iColumn] * deltaZ_[iColumn] * ratio + zVec_[iColumn] * change; a += deltaZ_[iColumn] * change * ratio; } if (upperBound(iColumn)) { CoinWorkDouble change = upper_[iColumn] - oldPrimal - deltaX_[iColumn] - upperSlack_[iColumn]; b += upperSlack_[iColumn] * deltaW_[iColumn] * ratio + wVec_[iColumn] * change; a += deltaW_[iColumn] * change * ratio; } } } // ? We want to minimize complementarityGap; // maybe use inf and do line search // To check see if matches at current step step = actualPrimalStep_; CoinWorkDouble next2 = c + b * step + a * step * step; if (next2 > next) { actualPrimalStep_ = CoinMin(actualPrimalStep_, actualDualStep_); actualDualStep_ = actualPrimalStep_; } #ifdef SOME_DEBUG printf("linb %g %g %g -> %g\n", a, b, c, c + b * step + a * step * step); debugMove(7, actualPrimalStep_, actualDualStep_); #endif if (b > -1.0e-6) { if (phase == 0) { #ifdef SOME_DEBUG printf("*** odd phase 0 direction\n"); #endif } else { directionNorm = -1.0; } } } #else //actualPrimalStep_ =0.5*actualDualStep_; #endif #ifdef FULL_DEBUG if (phase == 3) { CoinWorkDouble minBeta = 0.1 * mu_; CoinWorkDouble maxBeta = 10.0 * mu_; for (iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) { if (!flagged(iColumn)) { if (lowerBound(iColumn)) { CoinWorkDouble change = -rhsL_[iColumn] + deltaX_[iColumn]; CoinWorkDouble dualValue = zVec_[iColumn] + actualDualStep_ * deltaZ_[iColumn]; CoinWorkDouble primalValue = lowerSlack_[iColumn] + actualPrimalStep_ * change; CoinWorkDouble gapProduct = dualValue * primalValue; if (delta2Z_[iColumn] < minBeta || delta2Z_[iColumn] > maxBeta) printf("3lower %d primal %g, dual %g, gap %g, old gap %g\n", iColumn, primalValue, dualValue, gapProduct, delta2Z_[iColumn]); } if (upperBound(iColumn)) { CoinWorkDouble change = rhsU_[iColumn] - deltaX_[iColumn]; CoinWorkDouble dualValue = wVec_[iColumn] + actualDualStep_ * deltaW_[iColumn]; CoinWorkDouble primalValue = upperSlack_[iColumn] + actualPrimalStep_ * change; CoinWorkDouble gapProduct = dualValue * primalValue; if (delta2W_[iColumn] < minBeta || delta2W_[iColumn] > maxBeta) printf("3upper %d primal %g, dual %g, gap %g, old gap %g\n", iColumn, primalValue, dualValue, gapProduct, delta2W_[iColumn]); } } } } #endif #ifdef SOME_DEBUG_not { CoinWorkDouble largestL = 0.0; CoinWorkDouble smallestL = COIN_DBL_MAX; CoinWorkDouble largestU = 0.0; CoinWorkDouble smallestU = COIN_DBL_MAX; CoinWorkDouble sumL = 0.0; CoinWorkDouble sumU = 0.0; int nL = 0; int nU = 0; for (iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) { if (!flagged(iColumn)) { if (lowerBound(iColumn)) { CoinWorkDouble change = -rhsL_[iColumn] + deltaX_[iColumn]; CoinWorkDouble dualValue = zVec_[iColumn] + actualDualStep_ * deltaZ_[iColumn]; CoinWorkDouble primalValue = lowerSlack_[iColumn] + actualPrimalStep_ * change; CoinWorkDouble gapProduct = dualValue * primalValue; largestL = CoinMax(largestL, gapProduct); smallestL = CoinMin(smallestL, gapProduct); nL++; sumL += gapProduct; } if (upperBound(iColumn)) { CoinWorkDouble change = rhsU_[iColumn] - deltaX_[iColumn]; CoinWorkDouble dualValue = wVec_[iColumn] + actualDualStep_ * deltaW_[iColumn]; CoinWorkDouble primalValue = upperSlack_[iColumn] + actualPrimalStep_ * change; CoinWorkDouble gapProduct = dualValue * primalValue; largestU = CoinMax(largestU, gapProduct); smallestU = CoinMin(smallestU, gapProduct); nU++; sumU += gapProduct; } } } CoinWorkDouble mu = (sumL + sumU) / (static_cast (nL + nU)); CoinWorkDouble minBeta = 0.1 * mu; CoinWorkDouble maxBeta = 10.0 * mu; int nBL = 0; int nAL = 0; int nBU = 0; int nAU = 0; for (iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) { if (!flagged(iColumn)) { if (lowerBound(iColumn)) { CoinWorkDouble change = -rhsL_[iColumn] + deltaX_[iColumn]; CoinWorkDouble dualValue = zVec_[iColumn] + actualDualStep_ * deltaZ_[iColumn]; CoinWorkDouble primalValue = lowerSlack_[iColumn] + actualPrimalStep_ * change; CoinWorkDouble gapProduct = dualValue * primalValue; if (gapProduct < minBeta) nBL++; else if (gapProduct > maxBeta) nAL++; //if (gapProduct<0.1*minBeta) //printf("Lsmall one %d dual %g primal %g\n",iColumn, // dualValue,primalValue); } if (upperBound(iColumn)) { CoinWorkDouble change = rhsU_[iColumn] - deltaX_[iColumn]; CoinWorkDouble dualValue = wVec_[iColumn] + actualDualStep_ * deltaW_[iColumn]; CoinWorkDouble primalValue = upperSlack_[iColumn] + actualPrimalStep_ * change; CoinWorkDouble gapProduct = dualValue * primalValue; if (gapProduct < minBeta) nBU++; else if (gapProduct > maxBeta) nAU++; //if (gapProduct<0.1*minBeta) //printf("Usmall one %d dual %g primal %g\n",iColumn, // dualValue,primalValue); } } } printf("phase %d new mu %.18g new gap %.18g\n", phase, mu, sumL + sumU); printf(" %d lower, smallest %.18g, %d below - largest %.18g, %d above\n", nL, smallestL, nBL, largestL, nAL); printf(" %d upper, smallest %.18g, %d below - largest %.18g, %d above\n", nU, smallestU, nBU, largestU, nAU); } #endif return directionNorm; } /* Does solve. region1 is for deltaX (columns+rows), region2 for deltaPi (rows) */ void ClpPredictorCorrector::solveSystem(CoinWorkDouble * region1, CoinWorkDouble * region2, const CoinWorkDouble * region1In, const CoinWorkDouble * region2In, const CoinWorkDouble * saveRegion1, const CoinWorkDouble * saveRegion2, bool gentleRefine) { int iRow; int numberTotal = numberRows_ + numberColumns_; if (region2In) { // normal for (iRow = 0; iRow < numberRows_; iRow++) region2[iRow] = region2In[iRow]; } else { // initial solution - (diagonal is 1 or 0) CoinZeroN(region2, numberRows_); } int iColumn; if (cholesky_->type() < 20) { // not KKT for (iColumn = 0; iColumn < numberTotal; iColumn++) region1[iColumn] = region1In[iColumn] * diagonal_[iColumn]; multiplyAdd(region1 + numberColumns_, numberRows_, -1.0, region2, 1.0); matrix_->times(1.0, region1, region2); CoinWorkDouble maximumRHS = maximumAbsElement(region2, numberRows_); CoinWorkDouble scale = 1.0; CoinWorkDouble unscale = 1.0; if (maximumRHS > 1.0e-30) { if (maximumRHS <= 0.5) { CoinWorkDouble factor = 2.0; while (maximumRHS <= 0.5) { maximumRHS *= factor; scale *= factor; } /* endwhile */ } else if (maximumRHS >= 2.0 && maximumRHS <= COIN_DBL_MAX) { CoinWorkDouble factor = 0.5; while (maximumRHS >= 2.0) { maximumRHS *= factor; scale *= factor; } /* endwhile */ } unscale = diagonalScaleFactor_ / scale; } else { //effectively zero scale = 0.0; unscale = 0.0; } multiplyAdd(NULL, numberRows_, 0.0, region2, scale); cholesky_->solve(region2); multiplyAdd(NULL, numberRows_, 0.0, region2, unscale); multiplyAdd(region2, numberRows_, -1.0, region1 + numberColumns_, 0.0); CoinZeroN(region1, numberColumns_); matrix_->transposeTimes(1.0, region2, region1); for (iColumn = 0; iColumn < numberTotal; iColumn++) region1[iColumn] = (region1[iColumn] - region1In[iColumn]) * diagonal_[iColumn]; } else { for (iColumn = 0; iColumn < numberTotal; iColumn++) region1[iColumn] = region1In[iColumn]; cholesky_->solveKKT(region1, region2, diagonal_, diagonalScaleFactor_); } if (saveRegion2) { //refine? CoinWorkDouble scaleX = 1.0; if (gentleRefine) scaleX = 0.8; multiplyAdd(saveRegion2, numberRows_, 1.0, region2, scaleX); assert (saveRegion1); multiplyAdd(saveRegion1, numberTotal, 1.0, region1, scaleX); } } // findDirectionVector. CoinWorkDouble ClpPredictorCorrector::findDirectionVector(const int phase) { CoinWorkDouble projectionTolerance = projectionTolerance_; //temporary //projectionTolerance=1.0e-15; CoinWorkDouble errorCheck = 0.9 * maximumRHSError_ / solutionNorm_; if (errorCheck > primalTolerance()) { if (errorCheck < projectionTolerance) { projectionTolerance = errorCheck; } } else { if (primalTolerance() < projectionTolerance) { projectionTolerance = primalTolerance(); } } CoinWorkDouble * newError = new CoinWorkDouble [numberRows_]; int numberTotal = numberRows_ + numberColumns_; //if flagged then entries zero so can do // For KKT separate out CoinWorkDouble * region1Save = NULL; //for refinement int iColumn; if (cholesky_->type() < 20) { int iColumn; for (iColumn = 0; iColumn < numberTotal; iColumn++) deltaX_[iColumn] = workArray_[iColumn] - solution_[iColumn]; multiplyAdd(deltaX_ + numberColumns_, numberRows_, -1.0, deltaY_, 0.0); matrix_->times(1.0, deltaX_, deltaY_); } else { // regions in will be workArray and newError // regions out deltaX_ and deltaY_ multiplyAdd(solution_ + numberColumns_, numberRows_, 1.0, newError, 0.0); matrix_->times(-1.0, solution_, newError); // This is inefficient but just for now get values which will be in deltay int iColumn; for (iColumn = 0; iColumn < numberTotal; iColumn++) deltaX_[iColumn] = workArray_[iColumn] - solution_[iColumn]; multiplyAdd(deltaX_ + numberColumns_, numberRows_, -1.0, deltaY_, 0.0); matrix_->times(1.0, deltaX_, deltaY_); } bool goodSolve = false; CoinWorkDouble * regionSave = NULL; //for refinement int numberTries = 0; CoinWorkDouble relativeError = COIN_DBL_MAX; CoinWorkDouble tryError = 1.0e31; CoinWorkDouble saveMaximum = 0.0; double firstError = 0.0; double lastError2 = 0.0; while (!goodSolve && numberTries < 30) { CoinWorkDouble lastError = relativeError; goodSolve = true; CoinWorkDouble maximumRHS; maximumRHS = CoinMax(maximumAbsElement(deltaY_, numberRows_), 1.0e-12); if (!numberTries) saveMaximum = maximumRHS; if (cholesky_->type() < 20) { // no kkt CoinWorkDouble scale = 1.0; CoinWorkDouble unscale = 1.0; if (maximumRHS > 1.0e-30) { if (maximumRHS <= 0.5) { CoinWorkDouble factor = 2.0; while (maximumRHS <= 0.5) { maximumRHS *= factor; scale *= factor; } /* endwhile */ } else if (maximumRHS >= 2.0 && maximumRHS <= COIN_DBL_MAX) { CoinWorkDouble factor = 0.5; while (maximumRHS >= 2.0) { maximumRHS *= factor; scale *= factor; } /* endwhile */ } unscale = diagonalScaleFactor_ / scale; } else { //effectively zero scale = 0.0; unscale = 0.0; } //printf("--putting scales to 1.0\n"); //scale=1.0; //unscale=1.0; multiplyAdd(NULL, numberRows_, 0.0, deltaY_, scale); cholesky_->solve(deltaY_); multiplyAdd(NULL, numberRows_, 0.0, deltaY_, unscale); #if 0 { printf("deltay\n"); for (int i = 0; i < numberRows_; i++) printf("%d %.18g\n", i, deltaY_[i]); } exit(66); #endif if (numberTries) { //refine? CoinWorkDouble scaleX = 1.0; if (lastError > 1.0e-5) scaleX = 0.8; multiplyAdd(regionSave, numberRows_, 1.0, deltaY_, scaleX); } //CoinZeroN(newError,numberRows_); multiplyAdd(deltaY_, numberRows_, -1.0, deltaX_ + numberColumns_, 0.0); CoinZeroN(deltaX_, numberColumns_); matrix_->transposeTimes(1.0, deltaY_, deltaX_); //if flagged then entries zero so can do for (iColumn = 0; iColumn < numberTotal; iColumn++) deltaX_[iColumn] = deltaX_[iColumn] * diagonal_[iColumn] - workArray_[iColumn]; } else { // KKT solveSystem(deltaX_, deltaY_, workArray_, newError, region1Save, regionSave, lastError > 1.0e-5); } multiplyAdd(deltaX_ + numberColumns_, numberRows_, -1.0, newError, 0.0); matrix_->times(1.0, deltaX_, newError); numberTries++; //now add in old Ax - doing extra checking CoinWorkDouble maximumRHSError = 0.0; CoinWorkDouble maximumRHSChange = 0.0; int iRow; char * dropped = cholesky_->rowsDropped(); for (iRow = 0; iRow < numberRows_; iRow++) { if (!dropped[iRow]) { CoinWorkDouble newValue = newError[iRow]; CoinWorkDouble oldValue = errorRegion_[iRow]; //severity of errors depend on signs //**later */ if (CoinAbs(newValue) > maximumRHSChange) { maximumRHSChange = CoinAbs(newValue); } CoinWorkDouble result = newValue + oldValue; if (CoinAbs(result) > maximumRHSError) { maximumRHSError = CoinAbs(result); } newError[iRow] = result; } else { CoinWorkDouble newValue = newError[iRow]; CoinWorkDouble oldValue = errorRegion_[iRow]; if (CoinAbs(newValue) > maximumRHSChange) { maximumRHSChange = CoinAbs(newValue); } CoinWorkDouble result = newValue + oldValue; newError[iRow] = result; //newError[iRow]=0.0; //assert(deltaY_[iRow]==0.0); deltaY_[iRow] = 0.0; } } relativeError = maximumRHSError / solutionNorm_; relativeError = maximumRHSError / saveMaximum; if (relativeError > tryError) relativeError = tryError; if (numberTries == 1) firstError = relativeError; if (relativeError < lastError) { lastError2 = relativeError; maximumRHSChange_ = maximumRHSChange; if (relativeError > projectionTolerance && numberTries <= 3) { //try and refine goodSolve = false; } //*** extra test here if (!goodSolve) { if (!regionSave) { regionSave = new CoinWorkDouble [numberRows_]; if (cholesky_->type() >= 20) region1Save = new CoinWorkDouble [numberTotal]; } CoinMemcpyN(deltaY_, numberRows_, regionSave); if (cholesky_->type() < 20) { // not KKT multiplyAdd(newError, numberRows_, -1.0, deltaY_, 0.0); } else { // KKT CoinMemcpyN(deltaX_, numberTotal, region1Save); // and back to input region CoinMemcpyN(deltaY_, numberRows_, newError); } } } else { //std::cout <<" worse residual = "<type() < 20) { // not KKT multiplyAdd(deltaY_, numberRows_, -1.0, deltaX_ + numberColumns_, 0.0); CoinZeroN(deltaX_, numberColumns_); matrix_->transposeTimes(1.0, deltaY_, deltaX_); //if flagged then entries zero so can do for (iColumn = 0; iColumn < numberTotal; iColumn++) deltaX_[iColumn] = deltaX_[iColumn] * diagonal_[iColumn] - workArray_[iColumn]; } else { // KKT CoinMemcpyN(region1Save, numberTotal, deltaX_); } } else { // disaster CoinFillN(deltaX_, numberTotal, static_cast(1.0)); CoinFillN(deltaY_, numberRows_, static_cast(1.0)); COIN_DETAIL_PRINT(printf("bad cholesky\n")); } } } /* endwhile */ if (firstError > 1.0e-8 || numberTries > 1) { handler_->message(CLP_BARRIER_ACCURACY, messages_) << phase << numberTries << static_cast(firstError) << static_cast(lastError2) << CoinMessageEol; } delete [] regionSave; delete [] region1Save; delete [] newError; // now rest CoinWorkDouble extra = eExtra; //multiplyAdd(deltaY_,numberRows_,1.0,deltaW_+numberColumns_,0.0); //CoinZeroN(deltaW_,numberColumns_); //matrix_->transposeTimes(-1.0,deltaY_,deltaW_); for (iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) { deltaSU_[iColumn] = 0.0; deltaSL_[iColumn] = 0.0; deltaZ_[iColumn] = 0.0; CoinWorkDouble dd = deltaW_[iColumn]; deltaW_[iColumn] = 0.0; if (!flagged(iColumn)) { CoinWorkDouble deltaX = deltaX_[iColumn]; if (lowerBound(iColumn)) { CoinWorkDouble zValue = rhsZ_[iColumn]; CoinWorkDouble gHat = zValue + zVec_[iColumn] * rhsL_[iColumn]; CoinWorkDouble slack = lowerSlack_[iColumn] + extra; deltaSL_[iColumn] = -rhsL_[iColumn] + deltaX; deltaZ_[iColumn] = (gHat - zVec_[iColumn] * deltaX) / slack; } if (upperBound(iColumn)) { CoinWorkDouble wValue = rhsW_[iColumn]; CoinWorkDouble hHat = wValue - wVec_[iColumn] * rhsU_[iColumn]; CoinWorkDouble slack = upperSlack_[iColumn] + extra; deltaSU_[iColumn] = rhsU_[iColumn] - deltaX; deltaW_[iColumn] = (hHat + wVec_[iColumn] * deltaX) / slack; } if (0) { // different way of calculating CoinWorkDouble gamma2 = gamma_ * gamma_; CoinWorkDouble dZ = 0.0; CoinWorkDouble dW = 0.0; CoinWorkDouble zValue = rhsZ_[iColumn]; CoinWorkDouble gHat = zValue + zVec_[iColumn] * rhsL_[iColumn]; CoinWorkDouble slackL = lowerSlack_[iColumn] + extra; CoinWorkDouble wValue = rhsW_[iColumn]; CoinWorkDouble hHat = wValue - wVec_[iColumn] * rhsU_[iColumn]; CoinWorkDouble slackU = upperSlack_[iColumn] + extra; CoinWorkDouble q = rhsC_[iColumn] + gamma2 * deltaX + dd; if (primalR_) q += deltaX * primalR_[iColumn]; dW = (gHat + hHat - slackL * q + (wValue - zValue) * deltaX) / (slackL + slackU); dZ = dW + q; //printf("B %d old %g %g new %g %g\n",iColumn,deltaZ_[iColumn], //deltaW_[iColumn],dZ,dW); if (lowerBound(iColumn)) { if (upperBound(iColumn)) { //printf("B %d old %g %g new %g %g\n",iColumn,deltaZ_[iColumn], //deltaW_[iColumn],dZ,dW); deltaW_[iColumn] = dW; deltaZ_[iColumn] = dZ; } else { // just lower //printf("L %d old %g new %g\n",iColumn,deltaZ_[iColumn], //dZ); } } else { assert (upperBound(iColumn)); //printf("U %d old %g new %g\n",iColumn,deltaW_[iColumn], //dW); } } } } #if 0 CoinWorkDouble * check = new CoinWorkDouble[numberTotal]; // Check out rhsC_ multiplyAdd(deltaY_, numberRows_, -1.0, check + numberColumns_, 0.0); CoinZeroN(check, numberColumns_); matrix_->transposeTimes(1.0, deltaY_, check); quadraticDjs(check, deltaX_, -1.0); for (iColumn = 0; iColumn < numberTotal; iColumn++) { check[iColumn] += deltaZ_[iColumn] - deltaW_[iColumn]; if (CoinAbs(check[iColumn] - rhsC_[iColumn]) > 1.0e-3) printf("rhsC %d %g %g\n", iColumn, check[iColumn], rhsC_[iColumn]); } // Check out rhsZ_ for (iColumn = 0; iColumn < numberTotal; iColumn++) { check[iColumn] += lowerSlack_[iColumn] * deltaZ_[iColumn] + zVec_[iColumn] * deltaSL_[iColumn]; if (CoinAbs(check[iColumn] - rhsZ_[iColumn]) > 1.0e-3) printf("rhsZ %d %g %g\n", iColumn, check[iColumn], rhsZ_[iColumn]); } // Check out rhsW_ for (iColumn = 0; iColumn < numberTotal; iColumn++) { check[iColumn] += upperSlack_[iColumn] * deltaW_[iColumn] + wVec_[iColumn] * deltaSU_[iColumn]; if (CoinAbs(check[iColumn] - rhsW_[iColumn]) > 1.0e-3) printf("rhsW %d %g %g\n", iColumn, check[iColumn], rhsW_[iColumn]); } delete [] check; #endif return relativeError; } // createSolution. Creates solution from scratch int ClpPredictorCorrector::createSolution() { int numberTotal = numberRows_ + numberColumns_; int iColumn; CoinWorkDouble tolerance = primalTolerance(); // See if quadratic objective #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif if (!quadraticObj) { for (iColumn = 0; iColumn < numberTotal; iColumn++) { if (upper_[iColumn] - lower_[iColumn] > tolerance) clearFixed(iColumn); else setFixed(iColumn); } } else { // try leaving fixed for (iColumn = 0; iColumn < numberTotal; iColumn++) clearFixed(iColumn); } CoinWorkDouble maximumObjective = 0.0; CoinWorkDouble objectiveNorm2 = 0.0; getNorms(cost_, numberTotal, maximumObjective, objectiveNorm2); if (!maximumObjective) { maximumObjective = 1.0; // objective all zero } objectiveNorm2 = CoinSqrt(objectiveNorm2) / static_cast (numberTotal); objectiveNorm_ = maximumObjective; scaleFactor_ = 1.0; if (maximumObjective > 0.0) { if (maximumObjective < 1.0) { scaleFactor_ = maximumObjective; } else if (maximumObjective > 1.0e4) { scaleFactor_ = maximumObjective / 1.0e4; } } if (scaleFactor_ != 1.0) { objectiveNorm2 *= scaleFactor_; multiplyAdd(NULL, numberTotal, 0.0, cost_, 1.0 / scaleFactor_); objectiveNorm_ = maximumObjective / scaleFactor_; } // See if quadratic objective if (quadraticObj) { // If scaled then really scale matrix CoinWorkDouble scaleFactor = scaleFactor_ * optimizationDirection_ * objectiveScale_ * rhsScale_; if ((scalingFlag_ > 0 && rowScale_) || scaleFactor != 1.0) { CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); double * quadraticElement = quadratic->getMutableElements(); int numberColumns = quadratic->getNumCols(); CoinWorkDouble scale = 1.0 / scaleFactor; if (scalingFlag_ > 0 && rowScale_) { for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinWorkDouble scaleI = columnScale_[iColumn] * scale; for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; CoinWorkDouble scaleJ = columnScale_[jColumn]; quadraticElement[j] *= scaleI * scaleJ; objectiveNorm_ = CoinMax(objectiveNorm_, CoinAbs(quadraticElement[j])); } } } else { // not scaled for (int iColumn = 0; iColumn < numberColumns; iColumn++) { for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { quadraticElement[j] *= scale; objectiveNorm_ = CoinMax(objectiveNorm_, CoinAbs(quadraticElement[j])); } } } } } baseObjectiveNorm_ = objectiveNorm_; //accumulate fixed in dj region (as spare) //accumulate primal solution in primal region //DZ in lowerDual //DW in upperDual CoinWorkDouble infiniteCheck = 1.0e40; //CoinWorkDouble fakeCheck=1.0e10; //use deltaX region for work region for (iColumn = 0; iColumn < numberTotal; iColumn++) { CoinWorkDouble primalValue = solution_[iColumn]; clearFlagged(iColumn); clearFixedOrFree(iColumn); clearLowerBound(iColumn); clearUpperBound(iColumn); clearFakeLower(iColumn); clearFakeUpper(iColumn); if (!fixed(iColumn)) { dj_[iColumn] = 0.0; diagonal_[iColumn] = 1.0; deltaX_[iColumn] = 1.0; CoinWorkDouble lowerValue = lower_[iColumn]; CoinWorkDouble upperValue = upper_[iColumn]; if (lowerValue > -infiniteCheck) { if (upperValue < infiniteCheck) { //upper and lower bounds setLowerBound(iColumn); setUpperBound(iColumn); if (lowerValue >= 0.0) { solution_[iColumn] = lowerValue; } else if (upperValue <= 0.0) { solution_[iColumn] = upperValue; } else { solution_[iColumn] = 0.0; } } else { //just lower bound setLowerBound(iColumn); if (lowerValue >= 0.0) { solution_[iColumn] = lowerValue; } else { solution_[iColumn] = 0.0; } } } else { if (upperValue < infiniteCheck) { //just upper bound setUpperBound(iColumn); if (upperValue <= 0.0) { solution_[iColumn] = upperValue; } else { solution_[iColumn] = 0.0; } } else { //free setFixedOrFree(iColumn); solution_[iColumn] = 0.0; //std::cout<<" free "<times(-1.0, dj_, rhsFixRegion_); multiplyAdd(solution_ + numberColumns_, numberRows_, 1.0, errorRegion_, 0.0); matrix_->times(-1.0, solution_, errorRegion_); rhsNorm_ = maximumAbsElement(errorRegion_, numberRows_); if (rhsNorm_ < 1.0) { rhsNorm_ = 1.0; } int * rowsDropped = new int [numberRows_]; int returnCode = cholesky_->factorize(diagonal_, rowsDropped); if (returnCode == -1) { COIN_DETAIL_PRINT(printf("Out of memory\n")); problemStatus_ = 4; return -1; } if (cholesky_->status()) { std::cout << "singular on initial cholesky?" << std::endl; cholesky_->resetRowsDropped(); //cholesky_->factorize(rowDropped_); //if (cholesky_->status()) { //std::cout << "bad cholesky??? (after retry)" <type() < 20) { // not KKT cholesky_->solve(errorRegion_); //create information for solution multiplyAdd(errorRegion_, numberRows_, -1.0, deltaX_ + numberColumns_, 0.0); CoinZeroN(deltaX_, numberColumns_); matrix_->transposeTimes(1.0, errorRegion_, deltaX_); } else { // KKT // reverse sign on solution multiplyAdd(NULL, numberRows_ + numberColumns_, 0.0, solution_, -1.0); solveSystem(deltaX_, errorRegion_, solution_, NULL, NULL, NULL, false); } CoinWorkDouble initialValue = 1.0e2; if (rhsNorm_ * 1.0e-2 > initialValue) { initialValue = rhsNorm_ * 1.0e-2; } //initialValue = CoinMax(1.0,rhsNorm_); CoinWorkDouble smallestBoundDifference = COIN_DBL_MAX; CoinWorkDouble * fakeSolution = deltaX_; for ( iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) { if (lower_[iColumn] - fakeSolution[iColumn] > initialValue) { initialValue = lower_[iColumn] - fakeSolution[iColumn]; } if (fakeSolution[iColumn] - upper_[iColumn] > initialValue) { initialValue = fakeSolution[iColumn] - upper_[iColumn]; } if (upper_[iColumn] - lower_[iColumn] < smallestBoundDifference) { smallestBoundDifference = upper_[iColumn] - lower_[iColumn]; } } } solutionNorm_ = 1.0e-12; handler_->message(CLP_BARRIER_SAFE, messages_) << static_cast(initialValue) << static_cast(objectiveNorm_) << CoinMessageEol; CoinWorkDouble extra = 1.0e-10; CoinWorkDouble largeGap = 1.0e15; //CoinWorkDouble safeObjectiveValue=2.0*objectiveNorm_; CoinWorkDouble safeObjectiveValue = objectiveNorm_ + 1.0; CoinWorkDouble safeFree = 1.0e-1 * initialValue; //printf("normal safe dual value of %g, primal value of %g\n", // safeObjectiveValue,initialValue); //safeObjectiveValue=CoinMax(2.0,1.0e-1*safeObjectiveValue); //initialValue=CoinMax(100.0,1.0e-1*initialValue);; //printf("temp safe dual value of %g, primal value of %g\n", // safeObjectiveValue,initialValue); CoinWorkDouble zwLarge = 1.0e2 * initialValue; //zwLarge=1.0e40; if (cholesky_->choleskyCondition() < 0.0 && cholesky_->type() < 20) { // looks bad - play safe initialValue *= 10.0; safeObjectiveValue *= 10.0; safeFree *= 10.0; } CoinWorkDouble gamma2 = gamma_ * gamma_; // gamma*gamma will be added to diagonal // First do primal side for ( iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) { CoinWorkDouble lowerValue = lower_[iColumn]; CoinWorkDouble upperValue = upper_[iColumn]; CoinWorkDouble newValue; CoinWorkDouble setPrimal = initialValue; if (quadraticObj) { // perturb primal solution a bit //fakeSolution[iColumn] *= 0.002*CoinDrand48()+0.999; } if (lowerBound(iColumn)) { if (upperBound(iColumn)) { //upper and lower bounds if (upperValue - lowerValue > 2.0 * setPrimal) { CoinWorkDouble fakeValue = fakeSolution[iColumn]; if (fakeValue < lowerValue + setPrimal) { fakeValue = lowerValue + setPrimal; } if (fakeValue > upperValue - setPrimal) { fakeValue = upperValue - setPrimal; } newValue = fakeValue; } else { newValue = 0.5 * (upperValue + lowerValue); } } else { //just lower bound CoinWorkDouble fakeValue = fakeSolution[iColumn]; if (fakeValue < lowerValue + setPrimal) { fakeValue = lowerValue + setPrimal; } newValue = fakeValue; } } else { if (upperBound(iColumn)) { //just upper bound CoinWorkDouble fakeValue = fakeSolution[iColumn]; if (fakeValue > upperValue - setPrimal) { fakeValue = upperValue - setPrimal; } newValue = fakeValue; } else { //free newValue = fakeSolution[iColumn]; if (newValue >= 0.0) { if (newValue < safeFree) { newValue = safeFree; } } else { if (newValue > -safeFree) { newValue = -safeFree; } } } } solution_[iColumn] = newValue; } else { // fixed lowerSlack_[iColumn] = 0.0; upperSlack_[iColumn] = 0.0; solution_[iColumn] = lower_[iColumn]; zVec_[iColumn] = 0.0; wVec_[iColumn] = 0.0; diagonal_[iColumn] = 0.0; } } solutionNorm_ = maximumAbsElement(solution_, numberTotal); // Set bounds and do dj including quadratic largeGap = CoinMax(1.0e7, 1.02 * solutionNorm_); CoinPackedMatrix * quadratic = NULL; const int * columnQuadratic = NULL; const CoinBigIndex * columnQuadraticStart = NULL; const int * columnQuadraticLength = NULL; const double * quadraticElement = NULL; if (quadraticObj) { quadratic = quadraticObj->quadraticObjective(); columnQuadratic = quadratic->getIndices(); columnQuadraticStart = quadratic->getVectorStarts(); columnQuadraticLength = quadratic->getVectorLengths(); quadraticElement = quadratic->getElements(); } CoinWorkDouble quadraticNorm = 0.0; for ( iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) { CoinWorkDouble primalValue = solution_[iColumn]; CoinWorkDouble lowerValue = lower_[iColumn]; CoinWorkDouble upperValue = upper_[iColumn]; // Do dj CoinWorkDouble reducedCost = cost_[iColumn]; if (lowerBound(iColumn)) { reducedCost += linearPerturbation_; } if (upperBound(iColumn)) { reducedCost -= linearPerturbation_; } if (quadraticObj && iColumn < numberColumns_) { for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; CoinWorkDouble valueJ = solution_[jColumn]; CoinWorkDouble elementValue = quadraticElement[j]; reducedCost += valueJ * elementValue; } quadraticNorm = CoinMax(quadraticNorm, CoinAbs(reducedCost)); } dj_[iColumn] = reducedCost; if (primalValue > lowerValue + largeGap && primalValue < upperValue - largeGap) { clearFixedOrFree(iColumn); setLowerBound(iColumn); setUpperBound(iColumn); lowerValue = CoinMax(lowerValue, primalValue - largeGap); upperValue = CoinMin(upperValue, primalValue + largeGap); lower_[iColumn] = lowerValue; upper_[iColumn] = upperValue; } } } safeObjectiveValue = CoinMax(safeObjectiveValue, quadraticNorm); for ( iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) { CoinWorkDouble primalValue = solution_[iColumn]; CoinWorkDouble lowerValue = lower_[iColumn]; CoinWorkDouble upperValue = upper_[iColumn]; CoinWorkDouble reducedCost = dj_[iColumn]; CoinWorkDouble low = 0.0; CoinWorkDouble high = 0.0; if (lowerBound(iColumn)) { if (upperBound(iColumn)) { //upper and lower bounds if (upperValue - lowerValue > 2.0 * initialValue) { low = primalValue - lowerValue; high = upperValue - primalValue; } else { low = initialValue; high = initialValue; } CoinWorkDouble s = low + extra; CoinWorkDouble ratioZ; if (s < zwLarge) { ratioZ = 1.0; } else { ratioZ = CoinSqrt(zwLarge / s); } CoinWorkDouble t = high + extra; CoinWorkDouble ratioT; if (t < zwLarge) { ratioT = 1.0; } else { ratioT = CoinSqrt(zwLarge / t); } //modify s and t if (s > largeGap) { s = largeGap; } if (t > largeGap) { t = largeGap; } //modify if long long way away from bound if (reducedCost >= 0.0) { zVec_[iColumn] = reducedCost + safeObjectiveValue * ratioZ; zVec_[iColumn] = CoinMax(reducedCost, safeObjectiveValue * ratioZ); wVec_[iColumn] = safeObjectiveValue * ratioT; } else { zVec_[iColumn] = safeObjectiveValue * ratioZ; wVec_[iColumn] = -reducedCost + safeObjectiveValue * ratioT; wVec_[iColumn] = CoinMax(-reducedCost , safeObjectiveValue * ratioT); } CoinWorkDouble gammaTerm = gamma2; if (primalR_) gammaTerm += primalR_[iColumn]; diagonal_[iColumn] = (t * s) / (s * wVec_[iColumn] + t * zVec_[iColumn] + gammaTerm * t * s); } else { //just lower bound low = primalValue - lowerValue; high = 0.0; CoinWorkDouble s = low + extra; CoinWorkDouble ratioZ; if (s < zwLarge) { ratioZ = 1.0; } else { ratioZ = CoinSqrt(zwLarge / s); } //modify s if (s > largeGap) { s = largeGap; } if (reducedCost >= 0.0) { zVec_[iColumn] = reducedCost + safeObjectiveValue * ratioZ; zVec_[iColumn] = CoinMax(reducedCost , safeObjectiveValue * ratioZ); wVec_[iColumn] = 0.0; } else { zVec_[iColumn] = safeObjectiveValue * ratioZ; wVec_[iColumn] = 0.0; } CoinWorkDouble gammaTerm = gamma2; if (primalR_) gammaTerm += primalR_[iColumn]; diagonal_[iColumn] = s / (zVec_[iColumn] + s * gammaTerm); } } else { if (upperBound(iColumn)) { //just upper bound low = 0.0; high = upperValue - primalValue; CoinWorkDouble t = high + extra; CoinWorkDouble ratioT; if (t < zwLarge) { ratioT = 1.0; } else { ratioT = CoinSqrt(zwLarge / t); } //modify t if (t > largeGap) { t = largeGap; } if (reducedCost >= 0.0) { zVec_[iColumn] = 0.0; wVec_[iColumn] = safeObjectiveValue * ratioT; } else { zVec_[iColumn] = 0.0; wVec_[iColumn] = -reducedCost + safeObjectiveValue * ratioT; wVec_[iColumn] = CoinMax(-reducedCost , safeObjectiveValue * ratioT); } CoinWorkDouble gammaTerm = gamma2; if (primalR_) gammaTerm += primalR_[iColumn]; diagonal_[iColumn] = t / (wVec_[iColumn] + t * gammaTerm); } } lowerSlack_[iColumn] = low; upperSlack_[iColumn] = high; } } #if 0 if (solution_[0] > 0.0) { for (int i = 0; i < numberTotal; i++) printf("%d %.18g %.18g %.18g %.18g %.18g %.18g %.18g\n", i, CoinAbs(solution_[i]), diagonal_[i], CoinAbs(dj_[i]), lowerSlack_[i], zVec_[i], upperSlack_[i], wVec_[i]); } else { for (int i = 0; i < numberTotal; i++) printf("%d %.18g %.18g %.18g %.18g %.18g %.18g %.18g\n", i, CoinAbs(solution_[i]), diagonal_[i], CoinAbs(dj_[i]), upperSlack_[i], wVec_[i], lowerSlack_[i], zVec_[i] ); } exit(66); #endif return 0; } // complementarityGap. Computes gap //phase 0=as is , 1 = after predictor , 2 after corrector CoinWorkDouble ClpPredictorCorrector::complementarityGap(int & numberComplementarityPairs, int & numberComplementarityItems, const int phase) { CoinWorkDouble gap = 0.0; //seems to be same coding for phase = 1 or 2 numberComplementarityPairs = 0; numberComplementarityItems = 0; int numberTotal = numberRows_ + numberColumns_; CoinWorkDouble toleranceGap = 0.0; CoinWorkDouble largestGap = 0.0; CoinWorkDouble smallestGap = COIN_DBL_MAX; //seems to be same coding for phase = 1 or 2 int numberNegativeGaps = 0; CoinWorkDouble sumNegativeGap = 0.0; CoinWorkDouble largeGap = 1.0e2 * solutionNorm_; if (largeGap < 1.0e10) { largeGap = 1.0e10; } largeGap = 1.0e30; CoinWorkDouble dualTolerance = dblParam_[ClpDualTolerance]; CoinWorkDouble primalTolerance = dblParam_[ClpPrimalTolerance]; dualTolerance = dualTolerance / scaleFactor_; for (int iColumn = 0; iColumn < numberTotal; iColumn++) { if (!fixedOrFree(iColumn)) { numberComplementarityPairs++; //can collapse as if no lower bound both zVec and deltaZ 0.0 if (lowerBound(iColumn)) { numberComplementarityItems++; CoinWorkDouble dualValue; CoinWorkDouble primalValue; if (!phase) { dualValue = zVec_[iColumn]; primalValue = lowerSlack_[iColumn]; } else { CoinWorkDouble change; change = solution_[iColumn] + deltaX_[iColumn] - lowerSlack_[iColumn] - lower_[iColumn]; dualValue = zVec_[iColumn] + actualDualStep_ * deltaZ_[iColumn]; primalValue = lowerSlack_[iColumn] + actualPrimalStep_ * change; } //reduce primalValue if (primalValue > largeGap) { primalValue = largeGap; } CoinWorkDouble gapProduct = dualValue * primalValue; if (gapProduct < 0.0) { //cout<<"negative gap component "< largestGap) { largestGap = gapProduct; } smallestGap = CoinMin(smallestGap, gapProduct); if (dualValue > dualTolerance && primalValue > primalTolerance) { toleranceGap += dualValue * primalValue; } } if (upperBound(iColumn)) { numberComplementarityItems++; CoinWorkDouble dualValue; CoinWorkDouble primalValue; if (!phase) { dualValue = wVec_[iColumn]; primalValue = upperSlack_[iColumn]; } else { CoinWorkDouble change; change = upper_[iColumn] - solution_[iColumn] - deltaX_[iColumn] - upperSlack_[iColumn]; dualValue = wVec_[iColumn] + actualDualStep_ * deltaW_[iColumn]; primalValue = upperSlack_[iColumn] + actualPrimalStep_ * change; } //reduce primalValue if (primalValue > largeGap) { primalValue = largeGap; } CoinWorkDouble gapProduct = dualValue * primalValue; if (gapProduct < 0.0) { //cout<<"negative gap component "< largestGap) { largestGap = gapProduct; } if (dualValue > dualTolerance && primalValue > primalTolerance) { toleranceGap += dualValue * primalValue; } } } } //if (numberIterations_>4) //exit(9); if (!phase && numberNegativeGaps) { handler_->message(CLP_BARRIER_NEGATIVE_GAPS, messages_) << numberNegativeGaps << static_cast(sumNegativeGap) << CoinMessageEol; } //in case all free! if (!numberComplementarityPairs) { numberComplementarityPairs = 1; } #ifdef SOME_DEBUG printf("with d,p steps %g,%g gap %g - smallest %g, largest %g, pairs %d\n", actualDualStep_, actualPrimalStep_, gap, smallestGap, largestGap, numberComplementarityPairs); #endif return gap; } // setupForSolve. //phase 0=affine , 1 = corrector , 2 = primal-dual void ClpPredictorCorrector::setupForSolve(const int phase) { CoinWorkDouble extra = eExtra; int numberTotal = numberRows_ + numberColumns_; int iColumn; #ifdef SOME_DEBUG printf("phase %d in setupForSolve, mu %.18g\n", phase, mu_); #endif CoinWorkDouble gamma2 = gamma_ * gamma_; // gamma*gamma will be added to diagonal CoinWorkDouble * dualArray = reinterpret_cast(dual_); switch (phase) { case 0: CoinMemcpyN(errorRegion_, numberRows_, rhsB_); if (delta_ || dualR_) { // add in regularization CoinWorkDouble delta2 = delta_ * delta_; for (int iRow = 0; iRow < numberRows_; iRow++) { rhsB_[iRow] -= delta2 * dualArray[iRow]; if (dualR_) rhsB_[iRow] -= dualR_[iRow] * dualArray[iRow]; } } for (iColumn = 0; iColumn < numberTotal; iColumn++) { rhsC_[iColumn] = 0.0; rhsU_[iColumn] = 0.0; rhsL_[iColumn] = 0.0; rhsZ_[iColumn] = 0.0; rhsW_[iColumn] = 0.0; if (!flagged(iColumn)) { rhsC_[iColumn] = dj_[iColumn] - zVec_[iColumn] + wVec_[iColumn]; rhsC_[iColumn] += gamma2 * solution_[iColumn]; if (primalR_) rhsC_[iColumn] += primalR_[iColumn] * solution_[iColumn]; if (lowerBound(iColumn)) { rhsZ_[iColumn] = -zVec_[iColumn] * (lowerSlack_[iColumn] + extra); rhsL_[iColumn] = CoinMax(0.0, (lower_[iColumn] + lowerSlack_[iColumn]) - solution_[iColumn]); } if (upperBound(iColumn)) { rhsW_[iColumn] = -wVec_[iColumn] * (upperSlack_[iColumn] + extra); rhsU_[iColumn] = CoinMin(0.0, (upper_[iColumn] - upperSlack_[iColumn]) - solution_[iColumn]); } } } #if 0 for (int i = 0; i < 3; i++) { if (!CoinAbs(rhsZ_[i])) rhsZ_[i] = 0.0; if (!CoinAbs(rhsW_[i])) rhsW_[i] = 0.0; if (!CoinAbs(rhsU_[i])) rhsU_[i] = 0.0; if (!CoinAbs(rhsL_[i])) rhsL_[i] = 0.0; } if (solution_[0] > 0.0) { for (int i = 0; i < 3; i++) printf("%d %.18g %.18g %.18g %.18g %.18g %.18g %.18g\n", i, solution_[i], diagonal_[i], dj_[i], lowerSlack_[i], zVec_[i], upperSlack_[i], wVec_[i]); for (int i = 0; i < 3; i++) printf("%d %.18g %.18g %.18g %.18g %.18g\n", i, rhsC_[i], rhsZ_[i], rhsL_[i], rhsW_[i], rhsU_[i]); } else { for (int i = 0; i < 3; i++) printf("%d %.18g %.18g %.18g %.18g %.18g %.18g %.18g\n", i, solution_[i], diagonal_[i], dj_[i], lowerSlack_[i], zVec_[i], upperSlack_[i], wVec_[i]); for (int i = 0; i < 3; i++) printf("%d %.18g %.18g %.18g %.18g %.18g\n", i, rhsC_[i], rhsZ_[i], rhsL_[i], rhsW_[i], rhsU_[i]); } #endif break; case 1: // could be stored in delta2? for (iColumn = 0; iColumn < numberTotal; iColumn++) { rhsZ_[iColumn] = 0.0; rhsW_[iColumn] = 0.0; if (!flagged(iColumn)) { if (lowerBound(iColumn)) { rhsZ_[iColumn] = mu_ - zVec_[iColumn] * (lowerSlack_[iColumn] + extra) - deltaZ_[iColumn] * deltaX_[iColumn]; // To bring in line with OSL rhsZ_[iColumn] += deltaZ_[iColumn] * rhsL_[iColumn]; } if (upperBound(iColumn)) { rhsW_[iColumn] = mu_ - wVec_[iColumn] * (upperSlack_[iColumn] + extra) + deltaW_[iColumn] * deltaX_[iColumn]; // To bring in line with OSL rhsW_[iColumn] -= deltaW_[iColumn] * rhsU_[iColumn]; } } } #if 0 for (int i = 0; i < numberTotal; i++) { if (!CoinAbs(rhsZ_[i])) rhsZ_[i] = 0.0; if (!CoinAbs(rhsW_[i])) rhsW_[i] = 0.0; if (!CoinAbs(rhsU_[i])) rhsU_[i] = 0.0; if (!CoinAbs(rhsL_[i])) rhsL_[i] = 0.0; } if (solution_[0] > 0.0) { for (int i = 0; i < numberTotal; i++) printf("%d %.18g %.18g %.18g %.18g %.18g %.18g %.18g\n", i, CoinAbs(solution_[i]), diagonal_[i], CoinAbs(dj_[i]), lowerSlack_[i], zVec_[i], upperSlack_[i], wVec_[i]); for (int i = 0; i < numberTotal; i++) printf("%d %.18g %.18g %.18g %.18g %.18g\n", i, CoinAbs(rhsC_[i]), rhsZ_[i], rhsL_[i], rhsW_[i], rhsU_[i]); } else { for (int i = 0; i < numberTotal; i++) printf("%d %.18g %.18g %.18g %.18g %.18g %.18g %.18g\n", i, CoinAbs(solution_[i]), diagonal_[i], CoinAbs(dj_[i]), upperSlack_[i], wVec_[i], lowerSlack_[i], zVec_[i] ); for (int i = 0; i < numberTotal; i++) printf("%d %.18g %.18g %.18g %.18g %.18g\n", i, CoinAbs(rhsC_[i]), rhsW_[i], rhsU_[i], rhsZ_[i], rhsL_[i]); } exit(66); #endif break; case 2: CoinMemcpyN(errorRegion_, numberRows_, rhsB_); for (iColumn = 0; iColumn < numberTotal; iColumn++) { rhsZ_[iColumn] = 0.0; rhsW_[iColumn] = 0.0; if (!flagged(iColumn)) { if (lowerBound(iColumn)) { rhsZ_[iColumn] = mu_ - zVec_[iColumn] * (lowerSlack_[iColumn] + extra); } if (upperBound(iColumn)) { rhsW_[iColumn] = mu_ - wVec_[iColumn] * (upperSlack_[iColumn] + extra); } } } break; case 3: { CoinWorkDouble minBeta = 0.1 * mu_; CoinWorkDouble maxBeta = 10.0 * mu_; CoinWorkDouble dualStep = CoinMin(1.0, actualDualStep_ + 0.1); CoinWorkDouble primalStep = CoinMin(1.0, actualPrimalStep_ + 0.1); #ifdef SOME_DEBUG printf("good complementarity range %g to %g\n", minBeta, maxBeta); #endif //minBeta=0.0; //maxBeta=COIN_DBL_MAX; for (iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) { if (lowerBound(iColumn)) { CoinWorkDouble change = -rhsL_[iColumn] + deltaX_[iColumn]; CoinWorkDouble dualValue = zVec_[iColumn] + dualStep * deltaZ_[iColumn]; CoinWorkDouble primalValue = lowerSlack_[iColumn] + primalStep * change; CoinWorkDouble gapProduct = dualValue * primalValue; if (gapProduct > 0.0 && dualValue < 0.0) gapProduct = - gapProduct; #ifdef FULL_DEBUG delta2Z_[iColumn] = gapProduct; if (delta2Z_[iColumn] < minBeta || delta2Z_[iColumn] > maxBeta) printf("lower %d primal %g, dual %g, gap %g\n", iColumn, primalValue, dualValue, gapProduct); #endif CoinWorkDouble value = 0.0; if (gapProduct < minBeta) { value = 2.0 * (minBeta - gapProduct); value = (mu_ - gapProduct); value = (minBeta - gapProduct); assert (value > 0.0); } else if (gapProduct > maxBeta) { value = CoinMax(maxBeta - gapProduct, -maxBeta); assert (value < 0.0); } rhsZ_[iColumn] += value; } if (upperBound(iColumn)) { CoinWorkDouble change = rhsU_[iColumn] - deltaX_[iColumn]; CoinWorkDouble dualValue = wVec_[iColumn] + dualStep * deltaW_[iColumn]; CoinWorkDouble primalValue = upperSlack_[iColumn] + primalStep * change; CoinWorkDouble gapProduct = dualValue * primalValue; if (gapProduct > 0.0 && dualValue < 0.0) gapProduct = - gapProduct; #ifdef FULL_DEBUG delta2W_[iColumn] = gapProduct; if (delta2W_[iColumn] < minBeta || delta2W_[iColumn] > maxBeta) printf("upper %d primal %g, dual %g, gap %g\n", iColumn, primalValue, dualValue, gapProduct); #endif CoinWorkDouble value = 0.0; if (gapProduct < minBeta) { value = (minBeta - gapProduct); assert (value > 0.0); } else if (gapProduct > maxBeta) { value = CoinMax(maxBeta - gapProduct, -maxBeta); assert (value < 0.0); } rhsW_[iColumn] += value; } } } } break; } /* endswitch */ if (cholesky_->type() < 20) { for (iColumn = 0; iColumn < numberTotal; iColumn++) { CoinWorkDouble value = rhsC_[iColumn]; CoinWorkDouble zValue = rhsZ_[iColumn]; CoinWorkDouble wValue = rhsW_[iColumn]; #if 0 #if 1 if (phase == 0) { // more accurate value = dj[iColumn]; zValue = 0.0; wValue = 0.0; } else if (phase == 2) { // more accurate value = dj[iColumn]; zValue = mu_; wValue = mu_; } #endif assert (rhsL_[iColumn] >= 0.0); assert (rhsU_[iColumn] <= 0.0); if (lowerBound(iColumn)) { value += (-zVec_[iColumn] * rhsL_[iColumn] - zValue) / (lowerSlack_[iColumn] + extra); } if (upperBound(iColumn)) { value += (wValue - wVec_[iColumn] * rhsU_[iColumn]) / (upperSlack_[iColumn] + extra); } #else if (lowerBound(iColumn)) { CoinWorkDouble gHat = zValue + zVec_[iColumn] * rhsL_[iColumn]; value -= gHat / (lowerSlack_[iColumn] + extra); } if (upperBound(iColumn)) { CoinWorkDouble hHat = wValue - wVec_[iColumn] * rhsU_[iColumn]; value += hHat / (upperSlack_[iColumn] + extra); } #endif workArray_[iColumn] = diagonal_[iColumn] * value; } #if 0 if (solution_[0] > 0.0) { for (int i = 0; i < numberTotal; i++) printf("%d %.18g\n", i, workArray_[i]); } else { for (int i = 0; i < numberTotal; i++) printf("%d %.18g\n", i, workArray_[i]); } exit(66); #endif } else { // KKT for (iColumn = 0; iColumn < numberTotal; iColumn++) { CoinWorkDouble value = rhsC_[iColumn]; CoinWorkDouble zValue = rhsZ_[iColumn]; CoinWorkDouble wValue = rhsW_[iColumn]; if (lowerBound(iColumn)) { CoinWorkDouble gHat = zValue + zVec_[iColumn] * rhsL_[iColumn]; value -= gHat / (lowerSlack_[iColumn] + extra); } if (upperBound(iColumn)) { CoinWorkDouble hHat = wValue - wVec_[iColumn] * rhsU_[iColumn]; value += hHat / (upperSlack_[iColumn] + extra); } workArray_[iColumn] = value; } } } //method: sees if looks plausible change in complementarity bool ClpPredictorCorrector::checkGoodMove(const bool doCorrector, CoinWorkDouble & bestNextGap, bool allowIncreasingGap) { const CoinWorkDouble beta3 = 0.99997; bool goodMove = false; int nextNumber; int nextNumberItems; int numberTotal = numberRows_ + numberColumns_; CoinWorkDouble returnGap = bestNextGap; CoinWorkDouble nextGap = complementarityGap(nextNumber, nextNumberItems, 2); #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif if (nextGap > bestNextGap && nextGap > 0.9 * complementarityGap_ && doCorrector && !quadraticObj && !allowIncreasingGap) { #ifdef SOME_DEBUG printf("checkGood phase 1 next gap %.18g, phase 0 %.18g, old gap %.18g\n", nextGap, bestNextGap, complementarityGap_); #endif return false; } else { returnGap = nextGap; } CoinWorkDouble step; if (actualDualStep_ > actualPrimalStep_) { step = actualDualStep_; } else { step = actualPrimalStep_; } CoinWorkDouble testValue = 1.0 - step * (1.0 - beta3); //testValue=0.0; testValue *= complementarityGap_; if (nextGap < testValue) { //std::cout <<"predicted duality gap "< 1.0) { step = 1.0; } actualPrimalStep_ = step; //if (quadraticObj) //actualPrimalStep_ *=0.5; actualDualStep_ = step; goodMove = checkGoodMove2(step, bestNextGap, allowIncreasingGap); int pass = 0; while (!goodMove) { pass++; CoinWorkDouble gap = bestNextGap; goodMove = checkGoodMove2(step, gap, allowIncreasingGap); if (goodMove || pass > 3) { returnGap = gap; break; } if (step < 1.0e-4) { break; } step *= 0.5; actualPrimalStep_ = step; //if (quadraticObj) //actualPrimalStep_ *=0.5; actualDualStep_ = step; } /* endwhile */ if (doCorrector) { //say bad move if both small if (numberIterations_ & 1) { if (actualPrimalStep_ < 1.0e-2 && actualDualStep_ < 1.0e-2) { goodMove = false; } } else { if (actualPrimalStep_ < 1.0e-5 && actualDualStep_ < 1.0e-5) { goodMove = false; } if (actualPrimalStep_ * actualDualStep_ < 1.0e-20) { goodMove = false; } } } } if (goodMove) { //compute delta in objectives CoinWorkDouble deltaObjectivePrimal = 0.0; CoinWorkDouble deltaObjectiveDual = innerProduct(deltaY_, numberRows_, rhsFixRegion_); CoinWorkDouble error = 0.0; CoinWorkDouble * workArray = workArray_; CoinZeroN(workArray, numberColumns_); CoinMemcpyN(deltaY_, numberRows_, workArray + numberColumns_); matrix_->transposeTimes(-1.0, deltaY_, workArray); //CoinWorkDouble sumPerturbCost=0.0; for (int iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) { if (lowerBound(iColumn)) { //sumPerturbCost+=deltaX_[iColumn]; deltaObjectiveDual += deltaZ_[iColumn] * lower_[iColumn]; } if (upperBound(iColumn)) { //sumPerturbCost-=deltaX_[iColumn]; deltaObjectiveDual -= deltaW_[iColumn] * upper_[iColumn]; } CoinWorkDouble change = CoinAbs(workArray_[iColumn] - deltaZ_[iColumn] + deltaW_[iColumn]); error = CoinMax(change, error); } deltaObjectivePrimal += cost_[iColumn] * deltaX_[iColumn]; } //deltaObjectivePrimal+=sumPerturbCost*linearPerturbation_; CoinWorkDouble testValue; if (error > 0.0) { testValue = 1.0e1 * CoinMax(maximumDualError_, 1.0e-12) / error; } else { testValue = 1.0e1; } // If quadratic then primal step may compensate if (testValue < actualDualStep_ && !quadraticObj) { handler_->message(CLP_BARRIER_REDUCING, messages_) << "dual" << static_cast(actualDualStep_) << static_cast(testValue) << CoinMessageEol; actualDualStep_ = testValue; } } if (maximumRHSError_ < 1.0e1 * solutionNorm_ * primalTolerance() && maximumRHSChange_ > 1.0e-16 * solutionNorm_) { //check change in AX not too much //??? could be dropped row going infeasible CoinWorkDouble ratio = 1.0e1 * CoinMax(maximumRHSError_, 1.0e-12) / maximumRHSChange_; if (ratio < actualPrimalStep_) { handler_->message(CLP_BARRIER_REDUCING, messages_) << "primal" << static_cast(actualPrimalStep_) << static_cast(ratio) << CoinMessageEol; if (ratio > 1.0e-6) { actualPrimalStep_ = ratio; } else { actualPrimalStep_ = ratio; //std::cout <<"sign we should be stopping"< bestNextGap && !allowIncreasingGap) return false; CoinWorkDouble lowerBoundGap = gamma * nextGap * complementarityMultiplier; bool goodMove = true; int iColumn; for ( iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) { if (!flagged(iColumn)) { if (lowerBound(iColumn)) { CoinWorkDouble part1 = lowerSlack_[iColumn] + actualPrimalStep_ * deltaSL_[iColumn]; CoinWorkDouble part2 = zVec_[iColumn] + actualDualStep_ * deltaZ_[iColumn]; if (part1 * part2 < lowerBoundGap) { goodMove = false; break; } } if (upperBound(iColumn)) { CoinWorkDouble part1 = upperSlack_[iColumn] + actualPrimalStep_ * deltaSU_[iColumn]; CoinWorkDouble part2 = wVec_[iColumn] + actualDualStep_ * deltaW_[iColumn]; if (part1 * part2 < lowerBoundGap) { goodMove = false; break; } } } } CoinWorkDouble * nextDj = NULL; CoinWorkDouble maximumDualError = maximumDualError_; #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif CoinWorkDouble * dualArray = reinterpret_cast(dual_); if (quadraticObj) { // change gammad gammad = 1.0e-4; CoinWorkDouble gamma2 = gamma_ * gamma_; nextDj = new CoinWorkDouble [numberColumns_]; CoinWorkDouble * nextSolution = new CoinWorkDouble [numberColumns_]; // put next primal into nextSolution for ( iColumn = 0; iColumn < numberColumns_; iColumn++) { if (!flagged(iColumn)) { nextSolution[iColumn] = solution_[iColumn] + actualPrimalStep_ * deltaX_[iColumn]; } else { nextSolution[iColumn] = solution_[iColumn]; } } // do reduced costs CoinMemcpyN(cost_, numberColumns_, nextDj); matrix_->transposeTimes(-1.0, dualArray, nextDj); matrix_->transposeTimes(-actualDualStep_, deltaY_, nextDj); quadraticDjs(nextDj, nextSolution, 1.0); delete [] nextSolution; CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); const int * columnQuadraticLength = quadratic->getVectorLengths(); for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (!fixedOrFree(iColumn)) { CoinWorkDouble newZ = 0.0; CoinWorkDouble newW = 0.0; if (lowerBound(iColumn)) { newZ = zVec_[iColumn] + actualDualStep_ * deltaZ_[iColumn]; } if (upperBound(iColumn)) { newW = wVec_[iColumn] + actualDualStep_ * deltaW_[iColumn]; } if (columnQuadraticLength[iColumn]) { CoinWorkDouble gammaTerm = gamma2; if (primalR_) gammaTerm += primalR_[iColumn]; //CoinWorkDouble dualInfeasibility= //dj_[iColumn]-zVec_[iColumn]+wVec_[iColumn] //+gammaTerm*solution_[iColumn]; CoinWorkDouble newInfeasibility = nextDj[iColumn] - newZ + newW + gammaTerm * (solution_[iColumn] + actualPrimalStep_ * deltaX_[iColumn]); maximumDualError = CoinMax(maximumDualError, newInfeasibility); //if (CoinAbs(newInfeasibility)>CoinMax(2000.0*maximumDualError_,1.0e-2)) { //if (dualInfeasibility*newInfeasibility<0.0) { // printf("%d current %g next %g\n",iColumn,dualInfeasibility, // newInfeasibility); // goodMove=false; //} //} } } } delete [] nextDj; } // Satisfy g_p(alpha)? if (rhsNorm_ > solutionNorm_) { solutionNorm_ = rhsNorm_; } CoinWorkDouble errorCheck = maximumRHSError_ / solutionNorm_; if (errorCheck < maximumBoundInfeasibility_) { errorCheck = maximumBoundInfeasibility_; } // scale back move move = CoinMin(move, 0.95); //scale if ((1.0 - move)*errorCheck > primalTolerance()) { if (nextGap < gammap*(1.0 - move)*errorCheck) { goodMove = false; } } // Satisfy g_d(alpha)? errorCheck = maximumDualError / objectiveNorm_; if ((1.0 - move)*errorCheck > dualTolerance()) { if (nextGap < gammad*(1.0 - move)*errorCheck) { goodMove = false; } } if (goodMove) bestNextGap = nextGap; return goodMove; } // updateSolution. Updates solution at end of iteration //returns number fixed int ClpPredictorCorrector::updateSolution(CoinWorkDouble /*nextGap*/) { CoinWorkDouble * dualArray = reinterpret_cast(dual_); int numberTotal = numberRows_ + numberColumns_; //update pi multiplyAdd(deltaY_, numberRows_, actualDualStep_, dualArray, 1.0); CoinZeroN(errorRegion_, numberRows_); CoinZeroN(rhsFixRegion_, numberRows_); CoinWorkDouble maximumRhsInfeasibility = 0.0; CoinWorkDouble maximumBoundInfeasibility = 0.0; CoinWorkDouble maximumDualError = 1.0e-12; CoinWorkDouble primalObjectiveValue = 0.0; CoinWorkDouble dualObjectiveValue = 0.0; CoinWorkDouble solutionNorm = 1.0e-12; int numberKilled = 0; CoinWorkDouble freeMultiplier = 1.0e6; CoinWorkDouble trueNorm = diagonalNorm_ / diagonalScaleFactor_; if (freeMultiplier < trueNorm) { freeMultiplier = trueNorm; } if (freeMultiplier > 1.0e12) { freeMultiplier = 1.0e12; } freeMultiplier = 0.5 / freeMultiplier; CoinWorkDouble condition = CoinAbs(cholesky_->choleskyCondition()); bool caution; if ((condition < 1.0e10 && trueNorm < 1.0e12) || numberIterations_ < 20) { caution = false; } else { caution = true; } CoinWorkDouble extra = eExtra; const CoinWorkDouble largeFactor = 1.0e2; CoinWorkDouble largeGap = largeFactor * solutionNorm_; if (largeGap < largeFactor) { largeGap = largeFactor; } CoinWorkDouble dualFake = 0.0; CoinWorkDouble dualTolerance = dblParam_[ClpDualTolerance]; dualTolerance = dualTolerance / scaleFactor_; if (dualTolerance < 1.0e-12) { dualTolerance = 1.0e-12; } CoinWorkDouble offsetObjective = 0.0; CoinWorkDouble killTolerance = primalTolerance(); //CoinWorkDouble nextMu = nextGap/(static_cast(2*numberComplementarityPairs_)); //printf("using gap of %g\n",nextMu); //largest allowable ratio of lowerSlack/zVec (etc) CoinWorkDouble epsilonBase; CoinWorkDouble diagonalLimit; if (!caution) { epsilonBase = eBase; diagonalLimit = eDiagonal; } else { epsilonBase = eBaseCaution; diagonalLimit = eDiagonalCaution; } CoinWorkDouble maximumDJInfeasibility = 0.0; int numberIncreased = 0; int numberDecreased = 0; CoinWorkDouble largestDiagonal = 0.0; CoinWorkDouble smallestDiagonal = 1.0e50; CoinWorkDouble largeGap2 = CoinMax(1.0e7, 1.0e2 * solutionNorm_); //largeGap2 = 1.0e9; // When to start looking at killing (factor0 CoinWorkDouble killFactor; #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif #ifndef CLP_CAUTION #define KILL_ITERATION 50 #else #if CLP_CAUTION < 1 #define KILL_ITERATION 50 #else #define KILL_ITERATION 100 #endif #endif if (!quadraticObj || 1) { if (numberIterations_ < KILL_ITERATION) { killFactor = 1.0; } else if (numberIterations_ < 2 * KILL_ITERATION) { killFactor = 5.0; stepLength_ = CoinMax(stepLength_, 0.9995); } else if (numberIterations_ < 4 * KILL_ITERATION) { killFactor = 20.0; stepLength_ = CoinMax(stepLength_, 0.99995); } else { killFactor = 1.0e2; stepLength_ = CoinMax(stepLength_, 0.999995); } } else { killFactor = 1.0; } // put next primal into deltaSL_ int iColumn; int iRow; for (iColumn = 0; iColumn < numberTotal; iColumn++) { CoinWorkDouble thisWeight = deltaX_[iColumn]; CoinWorkDouble newPrimal = solution_[iColumn] + 1.0 * actualPrimalStep_ * thisWeight; deltaSL_[iColumn] = newPrimal; } #if 0 // nice idea but doesn't work multiplyAdd(solution_ + numberColumns_, numberRows_, -1.0, errorRegion_, 0.0); matrix_->times(1.0, solution_, errorRegion_); multiplyAdd(deltaSL_ + numberColumns_, numberRows_, -1.0, rhsFixRegion_, 0.0); matrix_->times(1.0, deltaSL_, rhsFixRegion_); CoinWorkDouble newNorm = maximumAbsElement(deltaSL_, numberTotal); CoinWorkDouble tol = newNorm * primalTolerance(); bool goneInf = false; for (iRow = 0; iRow < numberRows_; iRow++) { CoinWorkDouble value = errorRegion_[iRow]; CoinWorkDouble valueNew = rhsFixRegion_[iRow]; if (CoinAbs(value) < tol && CoinAbs(valueNew) > tol) { printf("row %d old %g new %g\n", iRow, value, valueNew); goneInf = true; } } if (goneInf) { actualPrimalStep_ *= 0.5; for (iColumn = 0; iColumn < numberTotal; iColumn++) { CoinWorkDouble thisWeight = deltaX_[iColumn]; CoinWorkDouble newPrimal = solution_[iColumn] + 1.0 * actualPrimalStep_ * thisWeight; deltaSL_[iColumn] = newPrimal; } } CoinZeroN(errorRegion_, numberRows_); CoinZeroN(rhsFixRegion_, numberRows_); #endif // do reduced costs CoinMemcpyN(dualArray, numberRows_, dj_ + numberColumns_); CoinMemcpyN(cost_, numberColumns_, dj_); CoinWorkDouble quadraticOffset = quadraticDjs(dj_, deltaSL_, 1.0); // Save modified costs for fixed variables CoinMemcpyN(dj_, numberColumns_, deltaSU_); matrix_->transposeTimes(-1.0, dualArray, dj_); CoinWorkDouble gamma2 = gamma_ * gamma_; // gamma*gamma will be added to diagonal CoinWorkDouble gammaOffset = 0.0; #if 0 const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const int * row = matrix_->getIndices(); const double * element = matrix_->getElements(); #endif for (iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) { CoinWorkDouble reducedCost = dj_[iColumn]; bool thisKilled = false; CoinWorkDouble zValue = zVec_[iColumn] + actualDualStep_ * deltaZ_[iColumn]; CoinWorkDouble wValue = wVec_[iColumn] + actualDualStep_ * deltaW_[iColumn]; zVec_[iColumn] = zValue; wVec_[iColumn] = wValue; CoinWorkDouble thisWeight = deltaX_[iColumn]; CoinWorkDouble oldPrimal = solution_[iColumn]; CoinWorkDouble newPrimal = solution_[iColumn] + actualPrimalStep_ * thisWeight; CoinWorkDouble dualObjectiveThis = 0.0; CoinWorkDouble sUpper = extra; CoinWorkDouble sLower = extra; CoinWorkDouble kill; if (CoinAbs(newPrimal) > 1.0e4) { kill = killTolerance * 1.0e-4 * newPrimal; } else { kill = killTolerance; } kill *= 1.0e-3; //be conservative CoinWorkDouble smallerSlack = COIN_DBL_MAX; bool fakeOldBounds = false; bool fakeNewBounds = false; CoinWorkDouble trueLower; CoinWorkDouble trueUpper; if (iColumn < numberColumns_) { trueLower = columnLower_[iColumn]; trueUpper = columnUpper_[iColumn]; } else { trueLower = rowLower_[iColumn-numberColumns_]; trueUpper = rowUpper_[iColumn-numberColumns_]; } if (oldPrimal > trueLower + largeGap2 && oldPrimal < trueUpper - largeGap2) fakeOldBounds = true; if (newPrimal > trueLower + largeGap2 && newPrimal < trueUpper - largeGap2) fakeNewBounds = true; if (fakeOldBounds) { if (fakeNewBounds) { lower_[iColumn] = newPrimal - largeGap2; lowerSlack_[iColumn] = largeGap2; upper_[iColumn] = newPrimal + largeGap2; upperSlack_[iColumn] = largeGap2; } else { lower_[iColumn] = trueLower; setLowerBound(iColumn); lowerSlack_[iColumn] = CoinMax(newPrimal - trueLower, 1.0); upper_[iColumn] = trueUpper; setUpperBound(iColumn); upperSlack_[iColumn] = CoinMax(trueUpper - newPrimal, 1.0); } } else if (fakeNewBounds) { lower_[iColumn] = newPrimal - largeGap2; lowerSlack_[iColumn] = largeGap2; upper_[iColumn] = newPrimal + largeGap2; upperSlack_[iColumn] = largeGap2; // so we can just have one test fakeOldBounds = true; } CoinWorkDouble lowerBoundInfeasibility = 0.0; CoinWorkDouble upperBoundInfeasibility = 0.0; //double saveNewPrimal = newPrimal; if (lowerBound(iColumn)) { CoinWorkDouble oldSlack = lowerSlack_[iColumn]; CoinWorkDouble newSlack; newSlack = lowerSlack_[iColumn] + actualPrimalStep_ * (oldPrimal - oldSlack + thisWeight - lower_[iColumn]); if (fakeOldBounds) newSlack = lowerSlack_[iColumn]; CoinWorkDouble epsilon = CoinAbs(newSlack) * epsilonBase; epsilon = CoinMin(epsilon, 1.0e-5); //epsilon=1.0e-14; //make sure reasonable if (zValue < epsilon) { zValue = epsilon; } CoinWorkDouble feasibleSlack = newPrimal - lower_[iColumn]; if (feasibleSlack > 0.0 && newSlack > 0.0) { CoinWorkDouble larger; if (newSlack > feasibleSlack) { larger = newSlack; } else { larger = feasibleSlack; } if (CoinAbs(feasibleSlack - newSlack) < 1.0e-6 * larger) { newSlack = feasibleSlack; } } if (zVec_[iColumn] > dualTolerance) { dualObjectiveThis += lower_[iColumn] * zVec_[iColumn]; } lowerSlack_[iColumn] = newSlack; if (newSlack < smallerSlack) { smallerSlack = newSlack; } lowerBoundInfeasibility = CoinAbs(newPrimal - lowerSlack_[iColumn] - lower_[iColumn]); if (lowerSlack_[iColumn] <= kill * killFactor && CoinAbs(newPrimal - lower_[iColumn]) <= kill * killFactor) { CoinWorkDouble step = CoinMin(actualPrimalStep_ * 1.1, 1.0); CoinWorkDouble newPrimal2 = solution_[iColumn] + step * thisWeight; if (newPrimal2 < newPrimal && dj_[iColumn] > 1.0e-5 && numberIterations_ > 50 - 40) { newPrimal = lower_[iColumn]; lowerSlack_[iColumn] = 0.0; //printf("fixing %d to lower\n",iColumn); } } if (lowerSlack_[iColumn] <= kill && CoinAbs(newPrimal - lower_[iColumn]) <= kill) { //may be better to leave at value? newPrimal = lower_[iColumn]; lowerSlack_[iColumn] = 0.0; thisKilled = true; //cout< 0.0 && newSlack > 0.0) { CoinWorkDouble larger; if (newSlack > feasibleSlack) { larger = newSlack; } else { larger = feasibleSlack; } if (CoinAbs(feasibleSlack - newSlack) < 1.0e-6 * larger) { newSlack = feasibleSlack; } } if (wVec_[iColumn] > dualTolerance) { dualObjectiveThis -= upper_[iColumn] * wVec_[iColumn]; } upperSlack_[iColumn] = newSlack; if (newSlack < smallerSlack) { smallerSlack = newSlack; } upperBoundInfeasibility = CoinAbs(newPrimal + upperSlack_[iColumn] - upper_[iColumn]); if (upperSlack_[iColumn] <= kill * killFactor && CoinAbs(newPrimal - upper_[iColumn]) <= kill * killFactor) { CoinWorkDouble step = CoinMin(actualPrimalStep_ * 1.1, 1.0); CoinWorkDouble newPrimal2 = solution_[iColumn] + step * thisWeight; if (newPrimal2 > newPrimal && dj_[iColumn] < -1.0e-5 && numberIterations_ > 50 - 40) { newPrimal = upper_[iColumn]; upperSlack_[iColumn] = 0.0; //printf("fixing %d to upper\n",iColumn); } } if (upperSlack_[iColumn] <= kill && CoinAbs(newPrimal - upper_[iColumn]) <= kill) { //may be better to leave at value? newPrimal = upper_[iColumn]; upperSlack_[iColumn] = 0.0; thisKilled = true; } else { sUpper += upperSlack_[iColumn]; } } #if 0 if (newPrimal != saveNewPrimal && iColumn < numberColumns_) { // adjust slacks double movement = newPrimal - saveNewPrimal; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double slackMovement = element[j] * movement; solution_[iRow+numberColumns_] += slackMovement; // sign? } } #endif solution_[iColumn] = newPrimal; if (CoinAbs(newPrimal) > solutionNorm) { solutionNorm = CoinAbs(newPrimal); } if (!thisKilled) { CoinWorkDouble gammaTerm = gamma2; if (primalR_) { gammaTerm += primalR_[iColumn]; quadraticOffset += newPrimal * newPrimal * primalR_[iColumn]; } CoinWorkDouble dualInfeasibility = reducedCost - zVec_[iColumn] + wVec_[iColumn] + gammaTerm * newPrimal; if (CoinAbs(dualInfeasibility) > dualTolerance) { #if 0 if (dualInfeasibility > 0.0) { // To improve we could reduce t and/or increase z if (lowerBound(iColumn)) { CoinWorkDouble complementarity = zVec_[iColumn] * lowerSlack_[iColumn]; if (complementarity < nextMu) { CoinWorkDouble change = CoinMin(dualInfeasibility, (nextMu - complementarity) / lowerSlack_[iColumn]); dualInfeasibility -= change; COIN_DETAIL_PRINT(printf("%d lb locomp %g - dual inf from %g to %g\n", iColumn, complementarity, dualInfeasibility + change, dualInfeasibility)); zVec_[iColumn] += change; zValue = CoinMax(zVec_[iColumn], 1.0e-12); } } if (upperBound(iColumn)) { CoinWorkDouble complementarity = wVec_[iColumn] * upperSlack_[iColumn]; if (complementarity > nextMu) { CoinWorkDouble change = CoinMin(dualInfeasibility, (complementarity - nextMu) / upperSlack_[iColumn]); dualInfeasibility -= change; COIN_DETAIL_PRINT(printf("%d ub hicomp %g - dual inf from %g to %g\n", iColumn, complementarity, dualInfeasibility + change, dualInfeasibility)); wVec_[iColumn] -= change; wValue = CoinMax(wVec_[iColumn], 1.0e-12); } } } else { // To improve we could reduce z and/or increase t if (lowerBound(iColumn)) { CoinWorkDouble complementarity = zVec_[iColumn] * lowerSlack_[iColumn]; if (complementarity > nextMu) { CoinWorkDouble change = CoinMax(dualInfeasibility, (nextMu - complementarity) / lowerSlack_[iColumn]); dualInfeasibility -= change; COIN_DETAIL_PRINT(printf("%d lb hicomp %g - dual inf from %g to %g\n", iColumn, complementarity, dualInfeasibility + change, dualInfeasibility)); zVec_[iColumn] += change; zValue = CoinMax(zVec_[iColumn], 1.0e-12); } } if (upperBound(iColumn)) { CoinWorkDouble complementarity = wVec_[iColumn] * upperSlack_[iColumn]; if (complementarity < nextMu) { CoinWorkDouble change = CoinMax(dualInfeasibility, (complementarity - nextMu) / upperSlack_[iColumn]); dualInfeasibility -= change; COIN_DETAIL_PRINT(printf("%d ub locomp %g - dual inf from %g to %g\n", iColumn, complementarity, dualInfeasibility + change, dualInfeasibility)); wVec_[iColumn] -= change; wValue = CoinMax(wVec_[iColumn], 1.0e-12); } } } #endif dualFake += newPrimal * dualInfeasibility; } if (lowerBoundInfeasibility > maximumBoundInfeasibility) { maximumBoundInfeasibility = lowerBoundInfeasibility; } if (upperBoundInfeasibility > maximumBoundInfeasibility) { maximumBoundInfeasibility = upperBoundInfeasibility; } dualInfeasibility = CoinAbs(dualInfeasibility); if (dualInfeasibility > maximumDualError) { //printf("bad dual %d %g\n",iColumn, // reducedCost-zVec_[iColumn]+wVec_[iColumn]+gammaTerm*newPrimal); maximumDualError = dualInfeasibility; } dualObjectiveValue += dualObjectiveThis; gammaOffset += newPrimal * newPrimal; if (sLower > largeGap) { sLower = largeGap; } if (sUpper > largeGap) { sUpper = largeGap; } #if 1 CoinWorkDouble divisor = sLower * wValue + sUpper * zValue + gammaTerm * sLower * sUpper; CoinWorkDouble diagonalValue = (sUpper * sLower) / divisor; #else CoinWorkDouble divisor = sLower * wValue + sUpper * zValue + gammaTerm * sLower * sUpper; CoinWorkDouble diagonalValue2 = (sUpper * sLower) / divisor; CoinWorkDouble diagonalValue; if (!lowerBound(iColumn)) { diagonalValue = wValue / sUpper + gammaTerm; } else if (!upperBound(iColumn)) { diagonalValue = zValue / sLower + gammaTerm; } else { diagonalValue = zValue / sLower + wValue / sUpper + gammaTerm; } diagonalValue = 1.0 / diagonalValue; #endif diagonal_[iColumn] = diagonalValue; //FUDGE if (diagonalValue > diagonalLimit) { #ifdef COIN_DEVELOP std::cout << "large diagonal " << diagonalValue << std::endl; #endif diagonal_[iColumn] = diagonalLimit; } #ifdef COIN_DEVELOP if (diagonalValue < 1.0e-10) { //std::cout<<"small diagonal "< largestDiagonal) { largestDiagonal = diagonalValue; } if (diagonalValue < smallestDiagonal) { smallestDiagonal = diagonalValue; } deltaX_[iColumn] = 0.0; } else { numberKilled++; if (solution_[iColumn] != lower_[iColumn] && solution_[iColumn] != upper_[iColumn]) { COIN_DETAIL_PRINT(printf("%d %g %g %g\n", iColumn, static_cast(lower_[iColumn]), static_cast(solution_[iColumn]), static_cast(upper_[iColumn]))); } diagonal_[iColumn] = 0.0; zVec_[iColumn] = 0.0; wVec_[iColumn] = 0.0; setFlagged(iColumn); setFixedOrFree(iColumn); deltaX_[iColumn] = newPrimal; offsetObjective += newPrimal * deltaSU_[iColumn]; } } else { deltaX_[iColumn] = solution_[iColumn]; diagonal_[iColumn] = 0.0; offsetObjective += solution_[iColumn] * deltaSU_[iColumn]; if (upper_[iColumn] - lower_[iColumn] > 1.0e-5) { if (solution_[iColumn] < lower_[iColumn] + 1.0e-8 && dj_[iColumn] < -1.0e-8) { if (-dj_[iColumn] > maximumDJInfeasibility) { maximumDJInfeasibility = -dj_[iColumn]; } } if (solution_[iColumn] > upper_[iColumn] - 1.0e-8 && dj_[iColumn] > 1.0e-8) { if (dj_[iColumn] > maximumDJInfeasibility) { maximumDJInfeasibility = dj_[iColumn]; } } } } primalObjectiveValue += solution_[iColumn] * cost_[iColumn]; } handler_->message(CLP_BARRIER_DIAGONAL, messages_) << static_cast(largestDiagonal) << static_cast(smallestDiagonal) << CoinMessageEol; #if 0 // If diagonal wild - kill some if (largestDiagonal > 1.0e17 * smallestDiagonal) { CoinWorkDouble killValue = largestDiagonal * 1.0e-17; for (int iColumn = 0; iColumn < numberTotal; iColumn++) { if (CoinAbs(diagonal_[iColumn]) < killValue) diagonal_[iolumn] = 0.0; } } #endif // update rhs region multiplyAdd(deltaX_ + numberColumns_, numberRows_, -1.0, rhsFixRegion_, 1.0); matrix_->times(1.0, deltaX_, rhsFixRegion_); primalObjectiveValue += 0.5 * gamma2 * gammaOffset + 0.5 * quadraticOffset; if (quadraticOffset) { // printf("gamma offset %g %g, quadoffset %g\n",gammaOffset,gamma2*gammaOffset,quadraticOffset); } dualObjectiveValue += offsetObjective + dualFake; dualObjectiveValue -= 0.5 * gamma2 * gammaOffset + 0.5 * quadraticOffset; if (numberIncreased || numberDecreased) { handler_->message(CLP_BARRIER_SLACKS, messages_) << numberIncreased << numberDecreased << CoinMessageEol; } if (maximumDJInfeasibility) { handler_->message(CLP_BARRIER_DUALINF, messages_) << static_cast(maximumDJInfeasibility) << CoinMessageEol; } // Need to rethink (but it is only for printing) sumPrimalInfeasibilities_ = maximumRhsInfeasibility; sumDualInfeasibilities_ = maximumDualError; maximumBoundInfeasibility_ = maximumBoundInfeasibility; //compute error and fixed RHS multiplyAdd(solution_ + numberColumns_, numberRows_, -1.0, errorRegion_, 0.0); matrix_->times(1.0, solution_, errorRegion_); maximumDualError_ = maximumDualError; maximumBoundInfeasibility_ = maximumBoundInfeasibility; solutionNorm_ = solutionNorm; //finish off objective computation primalObjective_ = primalObjectiveValue * scaleFactor_; CoinWorkDouble dualValue2 = innerProduct(dualArray, numberRows_, rhsFixRegion_); dualObjectiveValue -= dualValue2; dualObjective_ = dualObjectiveValue * scaleFactor_; if (numberKilled) { handler_->message(CLP_BARRIER_KILLED, messages_) << numberKilled << CoinMessageEol; } CoinWorkDouble maximumRHSError1 = 0.0; CoinWorkDouble maximumRHSError2 = 0.0; CoinWorkDouble primalOffset = 0.0; char * dropped = cholesky_->rowsDropped(); for (iRow = 0; iRow < numberRows_; iRow++) { CoinWorkDouble value = errorRegion_[iRow]; if (!dropped[iRow]) { if (CoinAbs(value) > maximumRHSError1) { maximumRHSError1 = CoinAbs(value); } } else { if (CoinAbs(value) > maximumRHSError2) { maximumRHSError2 = CoinAbs(value); } primalOffset += value * dualArray[iRow]; } } primalObjective_ -= primalOffset * scaleFactor_; if (maximumRHSError1 > maximumRHSError2) { maximumRHSError_ = maximumRHSError1; } else { maximumRHSError_ = maximumRHSError1; //note change if (maximumRHSError2 > primalTolerance()) { handler_->message(CLP_BARRIER_ABS_DROPPED, messages_) << static_cast(maximumRHSError2) << CoinMessageEol; } } objectiveNorm_ = maximumAbsElement(dualArray, numberRows_); if (objectiveNorm_ < 1.0e-12) { objectiveNorm_ = 1.0e-12; } if (objectiveNorm_ < baseObjectiveNorm_) { //std::cout<<" base "< primalTolerance() || maximumDualError_ > dualTolerance / scaleFactor_) { handler_->message(CLP_BARRIER_ABS_ERROR, messages_) << static_cast(maximumRHSError_) << static_cast(maximumDualError_) << CoinMessageEol; } if (rhsNorm_ > solutionNorm_) { solutionNorm_ = rhsNorm_; } CoinWorkDouble scaledRHSError = maximumRHSError_ / (solutionNorm_ + 10.0); bool dualFeasible = true; #if KEEP_GOING_IF_FIXED > 5 if (maximumBoundInfeasibility_ > primalTolerance() || scaledRHSError > primalTolerance()) primalFeasible = false; #else if (maximumBoundInfeasibility_ > primalTolerance() || scaledRHSError > CoinMax(CoinMin(100.0 * primalTolerance(), 1.0e-5), primalTolerance())) primalFeasible = false; #endif // relax dual test if obj big and gap smallish CoinWorkDouble gap = CoinAbs(primalObjective_ - dualObjective_); CoinWorkDouble sizeObj = CoinMin(CoinAbs(primalObjective_), CoinAbs(dualObjective_)) + 1.0e-50; //printf("gap %g sizeObj %g ratio %g comp %g\n", // gap,sizeObj,gap/sizeObj,complementarityGap_); if (numberIterations_ > 100 && gap / sizeObj < 1.0e-9 && complementarityGap_ < 1.0e-7 * sizeObj) dualTolerance *= 1.0e2; if (maximumDualError_ > objectiveNorm_ * dualTolerance) dualFeasible = false; if (!primalFeasible || !dualFeasible) { handler_->message(CLP_BARRIER_FEASIBLE, messages_) << static_cast(maximumBoundInfeasibility_) << static_cast(scaledRHSError) << static_cast(maximumDualError_ / objectiveNorm_) << CoinMessageEol; } if (!gonePrimalFeasible_) { gonePrimalFeasible_ = primalFeasible; } else if (!primalFeasible) { gonePrimalFeasible_ = primalFeasible; if (!numberKilled) { handler_->message(CLP_BARRIER_GONE_INFEASIBLE, messages_) << CoinMessageEol; } } if (!goneDualFeasible_) { goneDualFeasible_ = dualFeasible; } else if (!dualFeasible) { handler_->message(CLP_BARRIER_GONE_INFEASIBLE, messages_) << CoinMessageEol; goneDualFeasible_ = dualFeasible; } //objectiveValue(); if (solutionNorm_ > 1.0e40) { std::cout << "primal off to infinity" << std::endl; abort(); } if (objectiveNorm_ > 1.0e40) { std::cout << "dual off to infinity" << std::endl; abort(); } handler_->message(CLP_BARRIER_STEP, messages_) << static_cast(actualPrimalStep_) << static_cast(actualDualStep_) << static_cast(mu_) << CoinMessageEol; numberIterations_++; return numberKilled; } // Save info on products of affine deltaSU*deltaW and deltaSL*deltaZ CoinWorkDouble ClpPredictorCorrector::affineProduct() { CoinWorkDouble product = 0.0; //IF zVec starts as 0 then deltaZ always zero //(remember if free then zVec not 0) //I think free can be done with careful use of boundSlacks to zero //out all we want for (int iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) { CoinWorkDouble w3 = deltaZ_[iColumn] * deltaX_[iColumn]; CoinWorkDouble w4 = -deltaW_[iColumn] * deltaX_[iColumn]; if (lowerBound(iColumn)) { w3 += deltaZ_[iColumn] * (solution_[iColumn] - lowerSlack_[iColumn] - lower_[iColumn]); product += w3; } if (upperBound(iColumn)) { w4 += deltaW_[iColumn] * (-solution_[iColumn] - upperSlack_[iColumn] + upper_[iColumn]); product += w4; } } return product; } //See exactly what would happen given current deltas void ClpPredictorCorrector::debugMove(int /*phase*/, CoinWorkDouble primalStep, CoinWorkDouble dualStep) { #ifndef SOME_DEBUG return; #endif CoinWorkDouble * dualArray = reinterpret_cast(dual_); int numberTotal = numberRows_ + numberColumns_; CoinWorkDouble * dualNew = ClpCopyOfArray(dualArray, numberRows_); CoinWorkDouble * errorRegionNew = new CoinWorkDouble [numberRows_]; CoinWorkDouble * rhsFixRegionNew = new CoinWorkDouble [numberRows_]; CoinWorkDouble * primalNew = ClpCopyOfArray(solution_, numberTotal); CoinWorkDouble * djNew = new CoinWorkDouble[numberTotal]; //update pi multiplyAdd(deltaY_, numberRows_, dualStep, dualNew, 1.0); // do reduced costs CoinMemcpyN(dualNew, numberRows_, djNew + numberColumns_); CoinMemcpyN(cost_, numberColumns_, djNew); matrix_->transposeTimes(-1.0, dualNew, djNew); // update x int iColumn; for (iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) primalNew[iColumn] += primalStep * deltaX_[iColumn]; } CoinWorkDouble quadraticOffset = quadraticDjs(djNew, primalNew, 1.0); CoinZeroN(errorRegionNew, numberRows_); CoinZeroN(rhsFixRegionNew, numberRows_); CoinWorkDouble maximumBoundInfeasibility = 0.0; CoinWorkDouble maximumDualError = 1.0e-12; CoinWorkDouble primalObjectiveValue = 0.0; CoinWorkDouble dualObjectiveValue = 0.0; CoinWorkDouble solutionNorm = 1.0e-12; const CoinWorkDouble largeFactor = 1.0e2; CoinWorkDouble largeGap = largeFactor * solutionNorm_; if (largeGap < largeFactor) { largeGap = largeFactor; } CoinWorkDouble dualFake = 0.0; CoinWorkDouble dualTolerance = dblParam_[ClpDualTolerance]; dualTolerance = dualTolerance / scaleFactor_; if (dualTolerance < 1.0e-12) { dualTolerance = 1.0e-12; } CoinWorkDouble newGap = 0.0; CoinWorkDouble offsetObjective = 0.0; CoinWorkDouble gamma2 = gamma_ * gamma_; // gamma*gamma will be added to diagonal CoinWorkDouble gammaOffset = 0.0; CoinWorkDouble maximumDjInfeasibility = 0.0; for ( iColumn = 0; iColumn < numberTotal; iColumn++) { if (!flagged(iColumn)) { CoinWorkDouble reducedCost = djNew[iColumn]; CoinWorkDouble zValue = zVec_[iColumn] + dualStep * deltaZ_[iColumn]; CoinWorkDouble wValue = wVec_[iColumn] + dualStep * deltaW_[iColumn]; CoinWorkDouble thisWeight = deltaX_[iColumn]; CoinWorkDouble oldPrimal = solution_[iColumn]; CoinWorkDouble newPrimal = primalNew[iColumn]; CoinWorkDouble lowerBoundInfeasibility = 0.0; CoinWorkDouble upperBoundInfeasibility = 0.0; if (lowerBound(iColumn)) { CoinWorkDouble oldSlack = lowerSlack_[iColumn]; CoinWorkDouble newSlack = lowerSlack_[iColumn] + primalStep * (oldPrimal - oldSlack + thisWeight - lower_[iColumn]); if (zValue > dualTolerance) { dualObjectiveValue += lower_[iColumn] * zVec_[iColumn]; } lowerBoundInfeasibility = CoinAbs(newPrimal - newSlack - lower_[iColumn]); newGap += newSlack * zValue; } if (upperBound(iColumn)) { CoinWorkDouble oldSlack = upperSlack_[iColumn]; CoinWorkDouble newSlack = upperSlack_[iColumn] + primalStep * (-oldPrimal - oldSlack - thisWeight + upper_[iColumn]); if (wValue > dualTolerance) { dualObjectiveValue -= upper_[iColumn] * wVec_[iColumn]; } upperBoundInfeasibility = CoinAbs(newPrimal + newSlack - upper_[iColumn]); newGap += newSlack * wValue; } if (CoinAbs(newPrimal) > solutionNorm) { solutionNorm = CoinAbs(newPrimal); } CoinWorkDouble gammaTerm = gamma2; if (primalR_) { gammaTerm += primalR_[iColumn]; quadraticOffset += newPrimal * newPrimal * primalR_[iColumn]; } CoinWorkDouble dualInfeasibility = reducedCost - zValue + wValue + gammaTerm * newPrimal; if (CoinAbs(dualInfeasibility) > dualTolerance) { dualFake += newPrimal * dualInfeasibility; } if (lowerBoundInfeasibility > maximumBoundInfeasibility) { maximumBoundInfeasibility = lowerBoundInfeasibility; } if (upperBoundInfeasibility > maximumBoundInfeasibility) { maximumBoundInfeasibility = upperBoundInfeasibility; } dualInfeasibility = CoinAbs(dualInfeasibility); if (dualInfeasibility > maximumDualError) { //printf("bad dual %d %g\n",iColumn, // reducedCost-zVec_[iColumn]+wVec_[iColumn]+gammaTerm*newPrimal); maximumDualError = dualInfeasibility; } gammaOffset += newPrimal * newPrimal; djNew[iColumn] = 0.0; } else { offsetObjective += primalNew[iColumn] * cost_[iColumn]; if (upper_[iColumn] - lower_[iColumn] > 1.0e-5) { if (primalNew[iColumn] < lower_[iColumn] + 1.0e-8 && djNew[iColumn] < -1.0e-8) { if (-djNew[iColumn] > maximumDjInfeasibility) { maximumDjInfeasibility = -djNew[iColumn]; } } if (primalNew[iColumn] > upper_[iColumn] - 1.0e-8 && djNew[iColumn] > 1.0e-8) { if (djNew[iColumn] > maximumDjInfeasibility) { maximumDjInfeasibility = djNew[iColumn]; } } } djNew[iColumn] = primalNew[iColumn]; } primalObjectiveValue += solution_[iColumn] * cost_[iColumn]; } // update rhs region multiplyAdd(djNew + numberColumns_, numberRows_, -1.0, rhsFixRegionNew, 1.0); matrix_->times(1.0, djNew, rhsFixRegionNew); primalObjectiveValue += 0.5 * gamma2 * gammaOffset + 0.5 * quadraticOffset; dualObjectiveValue += offsetObjective + dualFake; dualObjectiveValue -= 0.5 * gamma2 * gammaOffset + 0.5 * quadraticOffset; // Need to rethink (but it is only for printing) //compute error and fixed RHS multiplyAdd(primalNew + numberColumns_, numberRows_, -1.0, errorRegionNew, 0.0); matrix_->times(1.0, primalNew, errorRegionNew); //finish off objective computation CoinWorkDouble primalObjectiveNew = primalObjectiveValue * scaleFactor_; CoinWorkDouble dualValue2 = innerProduct(dualNew, numberRows_, rhsFixRegionNew); dualObjectiveValue -= dualValue2; //CoinWorkDouble dualObjectiveNew=dualObjectiveValue*scaleFactor_; CoinWorkDouble maximumRHSError1 = 0.0; CoinWorkDouble maximumRHSError2 = 0.0; CoinWorkDouble primalOffset = 0.0; char * dropped = cholesky_->rowsDropped(); int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { CoinWorkDouble value = errorRegionNew[iRow]; if (!dropped[iRow]) { if (CoinAbs(value) > maximumRHSError1) { maximumRHSError1 = CoinAbs(value); } } else { if (CoinAbs(value) > maximumRHSError2) { maximumRHSError2 = CoinAbs(value); } primalOffset += value * dualNew[iRow]; } } primalObjectiveNew -= primalOffset * scaleFactor_; //CoinWorkDouble maximumRHSError; if (maximumRHSError1 > maximumRHSError2) { ;//maximumRHSError = maximumRHSError1; } else { //maximumRHSError = maximumRHSError1; //note change if (maximumRHSError2 > primalTolerance()) { handler_->message(CLP_BARRIER_ABS_DROPPED, messages_) << static_cast(maximumRHSError2) << CoinMessageEol; } } /*printf("PH %d %g, %g new comp %g, b %g, p %g, d %g\n",phase, primalStep,dualStep,newGap,maximumBoundInfeasibility, maximumRHSError,maximumDualError); if (handler_->logLevel()>1) printf(" objs %g %g\n", primalObjectiveNew,dualObjectiveNew); if (maximumDjInfeasibility) { printf(" max dj error on fixed %g\n", maximumDjInfeasibility); } */ delete [] dualNew; delete [] errorRegionNew; delete [] rhsFixRegionNew; delete [] primalNew; delete [] djNew; } CoinMP-1.8.3/Clp/src/ClpDualRowPivot.cpp0000644000175000017500000000356111510657452016376 0ustar renerene/* $Id: ClpDualRowPivot.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpDualRowPivot.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpDualRowPivot::ClpDualRowPivot () : model_(NULL), type_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpDualRowPivot::ClpDualRowPivot (const ClpDualRowPivot & source) : model_(source.model_), type_(source.type_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpDualRowPivot::~ClpDualRowPivot () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpDualRowPivot & ClpDualRowPivot::operator=(const ClpDualRowPivot& rhs) { if (this != &rhs) { type_ = rhs.type_; model_ = rhs.model_; } return *this; } void ClpDualRowPivot::saveWeights(ClpSimplex * model, int /*mode*/) { model_ = model; } // checks accuracy and may re-initialize (may be empty) void ClpDualRowPivot::checkAccuracy() { } void ClpDualRowPivot::unrollWeights() { } // Gets rid of all arrays void ClpDualRowPivot::clearArrays() { } CoinMP-1.8.3/Clp/src/ClpCholeskyUfl.hpp0000644000175000017500000000436711534466607016247 0ustar renerene/* $Id: ClpCholeskyUfl.hpp 1691 2011-03-05 17:06:15Z stefan $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpCholeskyUfl_H #define ClpCholeskyUfl_H #include "ClpCholeskyBase.hpp" class ClpMatrixBase; class ClpCholeskyDense; typedef struct cholmod_factor_struct cholmod_factor; typedef struct cholmod_common_struct cholmod_common; /** Ufl class for Clp Cholesky factorization If you wish to use AMD code from University of Florida see http://www.cise.ufl.edu/research/sparse/amd for terms of use If you wish to use CHOLMOD code from University of Florida see http://www.cise.ufl.edu/research/sparse/cholmod for terms of use */ class ClpCholeskyUfl : public ClpCholeskyBase { public: /**@name Virtual methods that the derived classes provides */ //@{ /** Orders rows and saves pointer to matrix.and model. Returns non-zero if not enough memory */ virtual int order(ClpInterior * model) ; /** Does Symbolic factorization given permutation using CHOLMOD (if available). This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory. */ virtual int symbolic(); /** Factorize - filling in rowsDropped and returning number dropped using CHOLMOD (if available). If return code negative then out of memory */ virtual int factorize(const double * diagonal, int * rowsDropped) ; /** Uses factorization to solve. Uses CHOLMOD (if available). */ virtual void solve (double * region) ; //@} /**@name Constructors, destructor */ //@{ /** Constructor which has dense columns activated. Default is off. */ ClpCholeskyUfl(int denseThreshold = -1); /** Destructor */ virtual ~ClpCholeskyUfl(); /// Clone virtual ClpCholeskyBase * clone() const ; //@} private: cholmod_factor * L_ ; cholmod_common * c_ ; // Copy ClpCholeskyUfl(const ClpCholeskyUfl&); // Assignment ClpCholeskyUfl& operator=(const ClpCholeskyUfl&); }; #endif CoinMP-1.8.3/Clp/src/AbcPrimalColumnPivot.hpp0000644000175000017500000001137412101105055017360 0ustar renerene/* $Id: AbcPrimalColumnPivot.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef AbcPrimalColumnPivot_H #define AbcPrimalColumnPivot_H #include "AbcCommon.hpp" class AbcSimplex; class CoinIndexedVector; //############################################################################# /** Primal Column Pivot Abstract Base Class Abstract Base Class for describing an interface to an algorithm to choose column pivot in primal simplex algorithm. For some algorithms e.g. Dantzig choice then some functions may be null. For Dantzig the only one of any importance is pivotColumn. If you wish to inherit from this look at AbcPrimalColumnDantzig.cpp as that is simplest version. */ class AbcPrimalColumnPivot { public: ///@name Algorithmic methods //@{ /** Returns pivot column, -1 if none Normally updates reduced costs using result of last iteration before selecting incoming column. The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row Inside pivotColumn the pivotRow_ and reduced cost from last iteration are also used. So in the simplest case i.e. feasible we compute the row of the tableau corresponding to last pivot and add a multiple of this to current reduced costs. We can use other arrays to help updates */ virtual int pivotColumn(CoinPartitionedVector * updates, CoinPartitionedVector * spareRow2, CoinPartitionedVector * spareColumn1) = 0; /// Updates weights - part 1 (may be empty) virtual void updateWeights(CoinIndexedVector * input); /** Saves any weights round factorization as pivot rows may change Will be empty unless steepest edge (will save model) May also recompute infeasibility stuff 1) before factorization 2) after good factorization (if weights empty may initialize) 3) after something happened but no factorization (e.g. check for infeasible) 4) as 2 but restore weights from previous snapshot 5) forces some initialization e.g. weights Also sets model */ virtual void saveWeights(AbcSimplex * model, int mode) = 0; /** Signals pivot row choice: -2 (default) - use normal pivot row choice -1 to numberRows-1 - use this (will be checked) way should be -1 to go to lower bound, +1 to upper bound */ virtual int pivotRow(double & way) { way = 0; return -2; } /// Gets rid of all arrays (may be empty) virtual void clearArrays(); /// Returns true if would not find any column virtual bool looksOptimal() const { return looksOptimal_; } /// Sets optimality flag (for advanced use) virtual void setLooksOptimal(bool flag) { looksOptimal_ = flag; } //@} ///@name Constructors and destructors //@{ /// Default Constructor AbcPrimalColumnPivot(); /// Copy constructor AbcPrimalColumnPivot(const AbcPrimalColumnPivot &); /// Assignment operator AbcPrimalColumnPivot & operator=(const AbcPrimalColumnPivot& rhs); /// Destructor virtual ~AbcPrimalColumnPivot (); /// Clone virtual AbcPrimalColumnPivot * clone(bool copyData = true) const = 0; //@} ///@name Other //@{ /// Returns model inline AbcSimplex * model() { return model_; } /// Sets model inline void setModel(AbcSimplex * newmodel) { model_ = newmodel; } /// Returns type (above 63 is extra information) inline int type() { return type_; } /** Returns number of extra columns for sprint algorithm - 0 means off. Also number of iterations before recompute */ virtual int numberSprintColumns(int & numberIterations) const; /// Switch off sprint idea virtual void switchOffSprint(); /// Called when maximum pivots changes virtual void maximumPivotsChanged() {} //@} //--------------------------------------------------------------------------- protected: ///@name Protected member data //@{ /// Pointer to model AbcSimplex * model_; /// Type of column pivot algorithm int type_; /// Says if looks optimal (normally computed) bool looksOptimal_; //@} }; #ifndef CLP_PRIMAL_SLACK_MULTIPLIER #define CLP_PRIMAL_SLACK_MULTIPLIER 1.01 #endif #endif CoinMP-1.8.3/Clp/src/ClpDynamicExampleMatrix.hpp0000644000175000017500000001550212130766607020071 0ustar renerene/* $Id: ClpDynamicExampleMatrix.hpp 1936 2013-04-09 10:29:27Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpDynamicExampleMatrix_H #define ClpDynamicExampleMatrix_H #include "CoinPragma.hpp" #include "ClpDynamicMatrix.hpp" class ClpSimplex; /** This implements a dynamic matrix when we have a limit on the number of "interesting rows". This version inherits from ClpDynamicMatrix and knows that the real matrix is gub. This acts just like ClpDynamicMatrix but generates columns. This "generates" columns by choosing from stored set. It is maent as a starting point as to how you could use shortest path to generate columns. So it has its own copy of all data needed. It populates ClpDynamicWatrix with enough to allow for gub keys and active variables. In turn ClpDynamicMatrix populates a CoinPackedMatrix with active columns and rows. As there is one copy here and one in ClpDynamicmatrix these names end in Gen_ It is obviously more efficient to just use ClpDynamicMatrix but the ideas is to show how much code a user would have to write. This does not work very well with bounds */ class ClpDynamicExampleMatrix : public ClpDynamicMatrix { public: /**@name Main functions provided */ //@{ /// Partial pricing virtual void partialPricing(ClpSimplex * model, double start, double end, int & bestSequence, int & numberWanted); /** Creates a variable. This is called after partial pricing and will modify matrix. Will update bestSequence. */ virtual void createVariable(ClpSimplex * model, int & bestSequence); /** If addColumn forces compression then this allows descendant to know what to do. If >= then entry stayed in, if -1 then entry went out to lower bound.of zero. Entries at upper bound (really nonzero) never go out (at present). */ virtual void packDown(const int * in, int numberToPack); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpDynamicExampleMatrix(); /** This is the real constructor. It assumes factorization frequency will not be changed. This resizes model !!!! The contents of original matrix in model will be taken over and original matrix will be sanitized so can be deleted (to avoid a very small memory leak) */ ClpDynamicExampleMatrix(ClpSimplex * model, int numberSets, int numberColumns, const int * starts, const double * lower, const double * upper, const int * startColumn, const int * row, const double * element, const double * cost, const double * columnLower = NULL, const double * columnUpper = NULL, const unsigned char * status = NULL, const unsigned char * dynamicStatus = NULL, int numberIds = 0, const int *ids = NULL); #if 0 /// This constructor just takes over ownership (except for lower, upper) ClpDynamicExampleMatrix(ClpSimplex * model, int numberSets, int numberColumns, int * starts, const double * lower, const double * upper, int * startColumn, int * row, double * element, double * cost, double * columnLower = NULL, double * columnUpper = NULL, const unsigned char * status = NULL, const unsigned char * dynamicStatus = NULL, int numberIds = 0, const int *ids = NULL); #endif /** Destructor */ virtual ~ClpDynamicExampleMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpDynamicExampleMatrix(const ClpDynamicExampleMatrix&); ClpDynamicExampleMatrix& operator=(const ClpDynamicExampleMatrix&); /// Clone virtual ClpMatrixBase * clone() const ; //@} /**@name gets and sets */ //@{ /// Starts of each column inline CoinBigIndex * startColumnGen() const { return startColumnGen_; } /// rows inline int * rowGen() const { return rowGen_; } /// elements inline double * elementGen() const { return elementGen_; } /// costs inline double * costGen() const { return costGen_; } /// full starts inline int * fullStartGen() const { return fullStartGen_; } /// ids in next level matrix inline int * idGen() const { return idGen_; } /// Optional lower bounds on columns inline double * columnLowerGen() const { return columnLowerGen_; } /// Optional upper bounds on columns inline double * columnUpperGen() const { return columnUpperGen_; } /// size inline int numberColumns() const { return numberColumns_; } inline void setDynamicStatusGen(int sequence, DynamicStatus status) { unsigned char & st_byte = dynamicStatusGen_[sequence]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | status); } inline DynamicStatus getDynamicStatusGen(int sequence) const { return static_cast (dynamicStatusGen_[sequence] & 7); } /// Whether flagged inline bool flaggedGen(int i) const { return (dynamicStatusGen_[i] & 8) != 0; } inline void setFlaggedGen(int i) { dynamicStatusGen_[i] = static_cast(dynamicStatusGen_[i] | 8); } inline void unsetFlagged(int i) { dynamicStatusGen_[i] = static_cast(dynamicStatusGen_[i] & ~8); } //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// size int numberColumns_; /// Starts of each column CoinBigIndex * startColumnGen_; /// rows int * rowGen_; /// elements double * elementGen_; /// costs double * costGen_; /// start of each set int * fullStartGen_; /// for status and which bound unsigned char * dynamicStatusGen_; /** identifier for each variable up one level (startColumn_, etc). This is of length maximumGubColumns_. For this version it is just sequence number at this level */ int * idGen_; /// Optional lower bounds on columns double * columnLowerGen_; /// Optional upper bounds on columns double * columnUpperGen_; //@} }; #endif CoinMP-1.8.3/Clp/src/AbcDualRowPivot.cpp0000644000175000017500000000426012101105055016322 0ustar renerene/* $Id: AbcDualRowPivot.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "AbcSimplex.hpp" #include "AbcDualRowPivot.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcDualRowPivot::AbcDualRowPivot () : model_(NULL), type_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcDualRowPivot::AbcDualRowPivot (const AbcDualRowPivot & source) : model_(source.model_), type_(source.type_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcDualRowPivot::~AbcDualRowPivot () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcDualRowPivot & AbcDualRowPivot::operator=(const AbcDualRowPivot& rhs) { if (this != &rhs) { type_ = rhs.type_; model_ = rhs.model_; } return *this; } void AbcDualRowPivot::saveWeights(AbcSimplex * model, int /*mode*/) { model_ = model; } // Recompute infeasibilities void AbcDualRowPivot::recomputeInfeasibilities() { } void AbcDualRowPivot::updatePrimalSolutionAndWeights(CoinIndexedVector & weightsVector, CoinIndexedVector & updateColumn, double theta) { // finish doing weights updateWeights2(weightsVector,updateColumn); updatePrimalSolution(updateColumn,theta); } // checks accuracy and may re-initialize (may be empty) void AbcDualRowPivot::checkAccuracy() { } // Gets rid of all arrays void AbcDualRowPivot::clearArrays() { } CoinMP-1.8.3/Clp/src/ClpPresolve.hpp0000644000175000017500000002653512503570213015601 0ustar renerene/* $Id: ClpPresolve.hpp 2134 2015-03-22 16:40:43Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpPresolve_H #define ClpPresolve_H #include "ClpSimplex.hpp" class CoinPresolveAction; #include "CoinPresolveMatrix.hpp" /** This is the Clp interface to CoinPresolve */ class ClpPresolve { public: /**@name Main Constructor, destructor */ //@{ /// Default constructor ClpPresolve(); /// Virtual destructor virtual ~ClpPresolve(); //@} /**@name presolve - presolves a model, transforming the model * and saving information in the ClpPresolve object needed for postsolving. * This underlying (protected) method is virtual; the idea is that in the future, * one could override this method to customize how the various * presolve techniques are applied. This version of presolve returns a pointer to a new presolved model. NULL if infeasible or unbounded. This should be paired with postsolve below. The advantage of going back to original model is that it will be exactly as it was i.e. 0.0 will not become 1.0e-19. If keepIntegers is true then bounds may be tightened in original. Bounds will be moved by up to feasibilityTolerance to try and stay feasible. Names will be dropped in presolved model if asked */ ClpSimplex * presolvedModel(ClpSimplex & si, double feasibilityTolerance = 0.0, bool keepIntegers = true, int numberPasses = 5, bool dropNames = false, bool doRowObjective = false, const char * prohibitedRows=NULL, const char * prohibitedColumns=NULL); #ifndef CLP_NO_STD /** This version saves data in a file. The passed in model is updated to be presolved model. Returns non-zero if infeasible*/ int presolvedModelToFile(ClpSimplex &si, std::string fileName, double feasibilityTolerance = 0.0, bool keepIntegers = true, int numberPasses = 5, bool dropNames = false, bool doRowObjective = false); #endif /** Return pointer to presolved model, Up to user to destroy */ ClpSimplex * model() const; /// Return pointer to original model ClpSimplex * originalModel() const; /// Set pointer to original model void setOriginalModel(ClpSimplex * model); /// return pointer to original columns const int * originalColumns() const; /// return pointer to original rows const int * originalRows() const; /** "Magic" number. If this is non-zero then any elements with this value may change and so presolve is very limited in what can be done to the row and column. This is for non-linear problems. */ inline void setNonLinearValue(double value) { nonLinearValue_ = value; } inline double nonLinearValue() const { return nonLinearValue_; } /// Whether we want to do dual part of presolve inline bool doDual() const { return (presolveActions_ & 1) == 0; } inline void setDoDual(bool doDual) { if (doDual) presolveActions_ &= ~1; else presolveActions_ |= 1; } /// Whether we want to do singleton part of presolve inline bool doSingleton() const { return (presolveActions_ & 2) == 0; } inline void setDoSingleton(bool doSingleton) { if (doSingleton) presolveActions_ &= ~2; else presolveActions_ |= 2; } /// Whether we want to do doubleton part of presolve inline bool doDoubleton() const { return (presolveActions_ & 4) == 0; } inline void setDoDoubleton(bool doDoubleton) { if (doDoubleton) presolveActions_ &= ~4; else presolveActions_ |= 4; } /// Whether we want to do tripleton part of presolve inline bool doTripleton() const { return (presolveActions_ & 8) == 0; } inline void setDoTripleton(bool doTripleton) { if (doTripleton) presolveActions_ &= ~8; else presolveActions_ |= 8; } /// Whether we want to do tighten part of presolve inline bool doTighten() const { return (presolveActions_ & 16) == 0; } inline void setDoTighten(bool doTighten) { if (doTighten) presolveActions_ &= ~16; else presolveActions_ |= 16; } /// Whether we want to do forcing part of presolve inline bool doForcing() const { return (presolveActions_ & 32) == 0; } inline void setDoForcing(bool doForcing) { if (doForcing) presolveActions_ &= ~32; else presolveActions_ |= 32; } /// Whether we want to do impliedfree part of presolve inline bool doImpliedFree() const { return (presolveActions_ & 64) == 0; } inline void setDoImpliedFree(bool doImpliedfree) { if (doImpliedfree) presolveActions_ &= ~64; else presolveActions_ |= 64; } /// Whether we want to do dupcol part of presolve inline bool doDupcol() const { return (presolveActions_ & 128) == 0; } inline void setDoDupcol(bool doDupcol) { if (doDupcol) presolveActions_ &= ~128; else presolveActions_ |= 128; } /// Whether we want to do duprow part of presolve inline bool doDuprow() const { return (presolveActions_ & 256) == 0; } inline void setDoDuprow(bool doDuprow) { if (doDuprow) presolveActions_ &= ~256; else presolveActions_ |= 256; } /// Whether we want to do dependency part of presolve inline bool doDependency() const { return (presolveActions_ & 32768) != 0; } inline void setDoDependency(bool doDependency) { if (doDependency) presolveActions_ |= 32768; else presolveActions_ &= ~32768; } /// Whether we want to do singleton column part of presolve inline bool doSingletonColumn() const { return (presolveActions_ & 512) == 0; } inline void setDoSingletonColumn(bool doSingleton) { if (doSingleton) presolveActions_ &= ~512; else presolveActions_ |= 512; } /// Whether we want to do gubrow part of presolve inline bool doGubrow() const { return (presolveActions_ & 1024) == 0; } inline void setDoGubrow(bool doGubrow) { if (doGubrow) presolveActions_ &= ~1024; else presolveActions_ |= 1024; } /// Whether we want to do twoxtwo part of presolve inline bool doTwoxTwo() const { return (presolveActions_ & 2048) != 0; } inline void setDoTwoxtwo(bool doTwoxTwo) { if (!doTwoxTwo) presolveActions_ &= ~2048; else presolveActions_ |= 2048; } /// Whether we want to allow duplicate intersections inline bool doIntersection() const { return (presolveActions_ & 4096) != 0; } inline void setDoIntersection(bool doIntersection) { if (doIntersection) presolveActions_ &= ~4096; else presolveActions_ |= 4096; } /** How much we want to zero small values from aggregation - ratio 0 - 1.0e-12, 1 1.0e-11, 2 1.0e-10, 3 1.0e-9 */ inline int zeroSmall() const { return (presolveActions_&(8192|16384))>>13; } inline void setZeroSmall(int value) { presolveActions_ &= ~(8192|16384); presolveActions_ |= value<<13; } /// Set whole group inline int presolveActions() const { return presolveActions_ & 0xffff; } inline void setPresolveActions(int action) { presolveActions_ = (presolveActions_ & 0xffff0000) | (action & 0xffff); } /// Substitution level inline void setSubstitution(int value) { substitution_ = value; } /// Asks for statistics inline void statistics() { presolveActions_ |= 0x80000000; } /// Return presolve status (0,1,2) int presolveStatus() const; /**@name postsolve - postsolve the problem. If the problem has not been solved to optimality, there are no guarantees. If you are using an algorithm like simplex that has a concept of "basic" rows/cols, then set updateStatus Note that if you modified the original problem after presolving, then you must ``undo'' these modifications before calling postsolve. This version updates original*/ virtual void postsolve(bool updateStatus = true); /// Gets rid of presolve actions (e.g.when infeasible) void destroyPresolve(); /**@name private or protected data */ private: /// Original model - must not be destroyed before postsolve ClpSimplex * originalModel_; /// ClpPresolved model - up to user to destroy by deleteClpPresolvedModel ClpSimplex * presolvedModel_; /** "Magic" number. If this is non-zero then any elements with this value may change and so presolve is very limited in what can be done to the row and column. This is for non-linear problems. One could also allow for cases where sign of coefficient is known. */ double nonLinearValue_; /// Original column numbers int * originalColumn_; /// Original row numbers int * originalRow_; /// Row objective double * rowObjective_; /// The list of transformations applied. const CoinPresolveAction *paction_; /// The postsolved problem will expand back to its former size /// as postsolve transformations are applied. /// It is efficient to allocate data structures for the final size /// of the problem rather than expand them as needed. /// These fields give the size of the original problem. int ncols_; int nrows_; CoinBigIndex nelems_; /// Number of major passes int numberPasses_; /// Substitution level int substitution_; #ifndef CLP_NO_STD /// Name of saved model file std::string saveFile_; #endif /** Whether we want to skip dual part of presolve etc. 512 bit allows duplicate column processing on integer columns and dual stuff on integers */ int presolveActions_; protected: /// If you want to apply the individual presolve routines differently, /// or perhaps add your own to the mix, /// define a derived class and override this method virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob); /// Postsolving is pretty generic; just apply the transformations /// in reverse order. /// You will probably only be interested in overriding this method /// if you want to add code to test for consistency /// while debugging new presolve techniques. virtual void postsolve(CoinPostsolveMatrix &prob); /** This is main part of Presolve */ virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex * originalModel, double feasibilityTolerance, bool keepIntegers, int numberPasses, bool dropNames, bool doRowObjective, const char * prohibitedRows=NULL, const char * prohibitedColumns=NULL); }; #endif CoinMP-1.8.3/Clp/src/CoinAbcFactorization5.cpp0000644000175000017500000000102012101105055017424 0ustar renerene/* $Id: CoinAbcFactorization5.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization5.cpp" #endif CoinMP-1.8.3/Clp/src/CbcOrClpParam.hpp0000644000175000017500000004333412432624666015764 0ustar renerene /* $Id: CbcOrClpParam.hpp 2070 2014-11-18 11:12:54Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef USE_CBCCONFIG # include "CbcConfig.h" #else # include "ClpConfig.h" #endif #ifndef CbcOrClpParam_H #define CbcOrClpParam_H /** This has parameter handling stuff which can be shared between Cbc and Clp (and Dylp etc). This (and .cpp) should be copied so that it is the same in Cbc/Test and Clp/Test. I know this is not elegant but it seems simplest. It uses COIN_HAS_CBC for parameters wanted by CBC It uses COIN_HAS_CLP for parameters wanted by CLP (or CBC using CLP) It could use COIN_HAS_DYLP for parameters wanted by DYLP It could use COIN_HAS_DYLP_OR_CLP for parameters wanted by DYLP or CLP etc etc */ class OsiSolverInterface; class CbcModel; class ClpSimplex; /*! \brief Parameter codes Parameter type ranges are allocated as follows
    • 1 -- 100 double parameters
    • 101 -- 200 integer parameters
    • 201 -- 250 string parameters
    • 251 -- 300 cuts etc(string but broken out for clarity)
    • 301 -- 400 `actions'
    `Actions' do not necessarily invoke an immediate action; it's just that they don't fit neatly into the parameters array. This coding scheme is in flux. */ enum CbcOrClpParameterType { CBC_PARAM_GENERALQUERY = -100, CBC_PARAM_FULLGENERALQUERY, CLP_PARAM_DBL_PRIMALTOLERANCE = 1, CLP_PARAM_DBL_DUALTOLERANCE, CLP_PARAM_DBL_TIMELIMIT, CLP_PARAM_DBL_DUALBOUND, CLP_PARAM_DBL_PRIMALWEIGHT, CLP_PARAM_DBL_OBJSCALE, CLP_PARAM_DBL_RHSSCALE, CLP_PARAM_DBL_ZEROTOLERANCE, CBC_PARAM_DBL_INFEASIBILITYWEIGHT = 51, CBC_PARAM_DBL_CUTOFF, CBC_PARAM_DBL_INTEGERTOLERANCE, CBC_PARAM_DBL_INCREMENT, CBC_PARAM_DBL_ALLOWABLEGAP, CBC_PARAM_DBL_TIMELIMIT_BAB, CBC_PARAM_DBL_GAPRATIO, CBC_PARAM_DBL_DJFIX = 81, CBC_PARAM_DBL_TIGHTENFACTOR, CLP_PARAM_DBL_PRESOLVETOLERANCE, CLP_PARAM_DBL_OBJSCALE2, CBC_PARAM_DBL_FAKEINCREMENT, CBC_PARAM_DBL_FAKECUTOFF, CBC_PARAM_DBL_ARTIFICIALCOST, CBC_PARAM_DBL_DEXTRA3, CBC_PARAM_DBL_SMALLBAB, CBC_PARAM_DBL_DEXTRA4, CBC_PARAM_DBL_DEXTRA5, CLP_PARAM_INT_SOLVERLOGLEVEL = 101, #ifndef COIN_HAS_CBC CLP_PARAM_INT_LOGLEVEL = 101, #endif CLP_PARAM_INT_MAXFACTOR, CLP_PARAM_INT_PERTVALUE, CLP_PARAM_INT_MAXITERATION, CLP_PARAM_INT_PRESOLVEPASS, CLP_PARAM_INT_IDIOT, CLP_PARAM_INT_SPRINT, CLP_PARAM_INT_OUTPUTFORMAT, CLP_PARAM_INT_SLPVALUE, CLP_PARAM_INT_PRESOLVEOPTIONS, CLP_PARAM_INT_PRINTOPTIONS, CLP_PARAM_INT_SPECIALOPTIONS, CLP_PARAM_INT_SUBSTITUTION, CLP_PARAM_INT_DUALIZE, CLP_PARAM_INT_VERBOSE, CLP_PARAM_INT_CPP, CLP_PARAM_INT_PROCESSTUNE, CLP_PARAM_INT_USESOLUTION, CLP_PARAM_INT_RANDOMSEED, CLP_PARAM_INT_MORESPECIALOPTIONS, CLP_PARAM_INT_DECOMPOSE_BLOCKS, CBC_PARAM_INT_STRONGBRANCHING = 151, CBC_PARAM_INT_CUTDEPTH, CBC_PARAM_INT_MAXNODES, CBC_PARAM_INT_NUMBERBEFORE, CBC_PARAM_INT_NUMBERANALYZE, CBC_PARAM_INT_MIPOPTIONS, CBC_PARAM_INT_MOREMIPOPTIONS, CBC_PARAM_INT_MAXHOTITS, CBC_PARAM_INT_FPUMPITS, CBC_PARAM_INT_MAXSOLS, CBC_PARAM_INT_FPUMPTUNE, CBC_PARAM_INT_TESTOSI, CBC_PARAM_INT_EXTRA1, CBC_PARAM_INT_EXTRA2, CBC_PARAM_INT_EXTRA3, CBC_PARAM_INT_EXTRA4, CBC_PARAM_INT_DEPTHMINIBAB, CBC_PARAM_INT_CUTPASSINTREE, CBC_PARAM_INT_THREADS, CBC_PARAM_INT_CUTPASS, CBC_PARAM_INT_VUBTRY, CBC_PARAM_INT_DENSE, CBC_PARAM_INT_EXPERIMENT, CBC_PARAM_INT_DIVEOPT, CBC_PARAM_INT_DIVEOPTSOLVES, CBC_PARAM_INT_STRATEGY, CBC_PARAM_INT_SMALLFACT, CBC_PARAM_INT_HOPTIONS, CBC_PARAM_INT_CUTLENGTH, CBC_PARAM_INT_FPUMPTUNE2, #ifdef COIN_HAS_CBC CLP_PARAM_INT_LOGLEVEL , #endif CBC_PARAM_INT_MAXSAVEDSOLS, CBC_PARAM_INT_RANDOMSEED, CBC_PARAM_INT_MULTIPLEROOTS, CBC_PARAM_INT_STRONG_STRATEGY, CBC_PARAM_INT_EXTRA_VARIABLES, CBC_PARAM_INT_MAX_SLOW_CUTS, CBC_PARAM_INT_MOREMOREMIPOPTIONS, CLP_PARAM_STR_DIRECTION = 201, CLP_PARAM_STR_DUALPIVOT, CLP_PARAM_STR_SCALING, CLP_PARAM_STR_ERRORSALLOWED, CLP_PARAM_STR_KEEPNAMES, CLP_PARAM_STR_SPARSEFACTOR, CLP_PARAM_STR_PRIMALPIVOT, CLP_PARAM_STR_PRESOLVE, CLP_PARAM_STR_CRASH, CLP_PARAM_STR_BIASLU, CLP_PARAM_STR_PERTURBATION, CLP_PARAM_STR_MESSAGES, CLP_PARAM_STR_AUTOSCALE, CLP_PARAM_STR_CHOLESKY, CLP_PARAM_STR_KKT, CLP_PARAM_STR_BARRIERSCALE, CLP_PARAM_STR_GAMMA, CLP_PARAM_STR_CROSSOVER, CLP_PARAM_STR_PFI, CLP_PARAM_STR_INTPRINT, CLP_PARAM_STR_VECTOR, CLP_PARAM_STR_FACTORIZATION, CLP_PARAM_STR_ALLCOMMANDS, CLP_PARAM_STR_TIME_MODE, CLP_PARAM_STR_ABCWANTED, CBC_PARAM_STR_NODESTRATEGY = 251, CBC_PARAM_STR_BRANCHSTRATEGY, CBC_PARAM_STR_CUTSSTRATEGY, CBC_PARAM_STR_HEURISTICSTRATEGY, CBC_PARAM_STR_GOMORYCUTS, CBC_PARAM_STR_PROBINGCUTS, CBC_PARAM_STR_KNAPSACKCUTS, CBC_PARAM_STR_REDSPLITCUTS, CBC_PARAM_STR_ROUNDING, CBC_PARAM_STR_SOLVER, CBC_PARAM_STR_CLIQUECUTS, CBC_PARAM_STR_COSTSTRATEGY, CBC_PARAM_STR_FLOWCUTS, CBC_PARAM_STR_MIXEDCUTS, CBC_PARAM_STR_TWOMIRCUTS, CBC_PARAM_STR_PREPROCESS, CBC_PARAM_STR_FPUMP, CBC_PARAM_STR_GREEDY, CBC_PARAM_STR_COMBINE, CBC_PARAM_STR_PROXIMITY, CBC_PARAM_STR_LOCALTREE, CBC_PARAM_STR_SOS, CBC_PARAM_STR_LANDPCUTS, CBC_PARAM_STR_RINS, CBC_PARAM_STR_RESIDCUTS, CBC_PARAM_STR_RENS, CBC_PARAM_STR_DIVINGS, CBC_PARAM_STR_DIVINGC, CBC_PARAM_STR_DIVINGF, CBC_PARAM_STR_DIVINGG, CBC_PARAM_STR_DIVINGL, CBC_PARAM_STR_DIVINGP, CBC_PARAM_STR_DIVINGV, CBC_PARAM_STR_DINS, CBC_PARAM_STR_PIVOTANDFIX, CBC_PARAM_STR_RANDROUND, CBC_PARAM_STR_NAIVE, CBC_PARAM_STR_ZEROHALFCUTS, CBC_PARAM_STR_CPX, CBC_PARAM_STR_CROSSOVER2, CBC_PARAM_STR_PIVOTANDCOMPLEMENT, CBC_PARAM_STR_VND, CBC_PARAM_STR_LAGOMORYCUTS, CBC_PARAM_STR_LATWOMIRCUTS, CBC_PARAM_STR_REDSPLIT2CUTS, CBC_PARAM_STR_GMICUTS, CBC_PARAM_STR_CUTOFF_CONSTRAINT, CBC_PARAM_STR_DW, CBC_PARAM_STR_ORBITAL, CLP_PARAM_ACTION_DIRECTORY = 301, CLP_PARAM_ACTION_DIRSAMPLE, CLP_PARAM_ACTION_DIRNETLIB, CBC_PARAM_ACTION_DIRMIPLIB, CLP_PARAM_ACTION_IMPORT, CLP_PARAM_ACTION_EXPORT, CLP_PARAM_ACTION_RESTORE, CLP_PARAM_ACTION_SAVE, CLP_PARAM_ACTION_DUALSIMPLEX, CLP_PARAM_ACTION_PRIMALSIMPLEX, CLP_PARAM_ACTION_EITHERSIMPLEX, CLP_PARAM_ACTION_MAXIMIZE, CLP_PARAM_ACTION_MINIMIZE, CLP_PARAM_ACTION_EXIT, CLP_PARAM_ACTION_STDIN, CLP_PARAM_ACTION_UNITTEST, CLP_PARAM_ACTION_NETLIB_EITHER, CLP_PARAM_ACTION_NETLIB_DUAL, CLP_PARAM_ACTION_NETLIB_PRIMAL, CLP_PARAM_ACTION_SOLUTION, CLP_PARAM_ACTION_SAVESOL, CLP_PARAM_ACTION_TIGHTEN, CLP_PARAM_ACTION_FAKEBOUND, CLP_PARAM_ACTION_HELP, CLP_PARAM_ACTION_PLUSMINUS, CLP_PARAM_ACTION_NETWORK, CLP_PARAM_ACTION_ALLSLACK, CLP_PARAM_ACTION_REVERSE, CLP_PARAM_ACTION_BARRIER, CLP_PARAM_ACTION_NETLIB_BARRIER, CLP_PARAM_ACTION_NETLIB_TUNE, CLP_PARAM_ACTION_REALLY_SCALE, CLP_PARAM_ACTION_BASISIN, CLP_PARAM_ACTION_BASISOUT, CLP_PARAM_ACTION_SOLVECONTINUOUS, CLP_PARAM_ACTION_CLEARCUTS, CLP_PARAM_ACTION_VERSION, CLP_PARAM_ACTION_STATISTICS, CLP_PARAM_ACTION_DEBUG, CLP_PARAM_ACTION_DUMMY, CLP_PARAM_ACTION_PRINTMASK, CLP_PARAM_ACTION_OUTDUPROWS, CLP_PARAM_ACTION_USERCLP, CLP_PARAM_ACTION_MODELIN, CLP_PARAM_ACTION_CSVSTATISTICS, CLP_PARAM_ACTION_STOREDFILE, CLP_PARAM_ACTION_ENVIRONMENT, CLP_PARAM_ACTION_PARAMETRICS, CLP_PARAM_ACTION_GMPL_SOLUTION, CLP_PARAM_ACTION_RESTORESOL, CBC_PARAM_ACTION_BAB = 361, CBC_PARAM_ACTION_MIPLIB, CBC_PARAM_ACTION_STRENGTHEN, CBC_PARAM_ACTION_PRIORITYIN, CBC_PARAM_ACTION_MIPSTART, CBC_PARAM_ACTION_USERCBC, CBC_PARAM_ACTION_DOHEURISTIC, CLP_PARAM_ACTION_NEXTBESTSOLUTION, CBC_PARAM_NOTUSED_OSLSTUFF = 401, CBC_PARAM_NOTUSED_CBCSTUFF, CBC_PARAM_NOTUSED_INVALID = 1000 } ; #include #include /// Very simple class for setting parameters class CbcOrClpParam { public: /**@name Constructor and destructor */ //@{ /// Constructors CbcOrClpParam ( ); CbcOrClpParam (std::string name, std::string help, double lower, double upper, CbcOrClpParameterType type, int display = 2); CbcOrClpParam (std::string name, std::string help, int lower, int upper, CbcOrClpParameterType type, int display = 2); // Other strings will be added by insert CbcOrClpParam (std::string name, std::string help, std::string firstValue, CbcOrClpParameterType type, int whereUsed = 7, int display = 2); // Action CbcOrClpParam (std::string name, std::string help, CbcOrClpParameterType type, int whereUsed = 7, int display = 2); /// Copy constructor. CbcOrClpParam(const CbcOrClpParam &); /// Assignment operator. This copies the data CbcOrClpParam & operator=(const CbcOrClpParam & rhs); /// Destructor ~CbcOrClpParam ( ); //@} /**@name stuff */ //@{ /// Insert string (only valid for keywords) void append(std::string keyWord); /// Adds one help line void addHelp(std::string keyWord); /// Returns name inline std::string name( ) const { return name_; } /// Returns short help inline std::string shortHelp( ) const { return shortHelp_; } /// Sets a double parameter (nonzero code if error) int setDoubleParameter(CbcModel & model, double value) ; /// Sets double parameter and returns printable string and error code const char * setDoubleParameterWithMessage ( CbcModel & model, double value , int & returnCode); /// Gets a double parameter double doubleParameter(CbcModel & model) const; /// Sets a int parameter (nonzero code if error) int setIntParameter(CbcModel & model, int value) ; /// Sets int parameter and returns printable string and error code const char * setIntParameterWithMessage ( CbcModel & model, int value , int & returnCode); /// Gets a int parameter int intParameter(CbcModel & model) const; /// Sets a double parameter (nonzero code if error) int setDoubleParameter(ClpSimplex * model, double value) ; /// Gets a double parameter double doubleParameter(ClpSimplex * model) const; /// Sets double parameter and returns printable string and error code const char * setDoubleParameterWithMessage ( ClpSimplex * model, double value , int & returnCode); /// Sets a int parameter (nonzero code if error) int setIntParameter(ClpSimplex * model, int value) ; /// Sets int parameter and returns printable string and error code const char * setIntParameterWithMessage ( ClpSimplex * model, int value , int & returnCode); /// Gets a int parameter int intParameter(ClpSimplex * model) const; /// Sets a double parameter (nonzero code if error) int setDoubleParameter(OsiSolverInterface * model, double value) ; /// Sets double parameter and returns printable string and error code const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double value , int & returnCode); /// Gets a double parameter double doubleParameter(OsiSolverInterface * model) const; /// Sets a int parameter (nonzero code if error) int setIntParameter(OsiSolverInterface * model, int value) ; /// Sets int parameter and returns printable string and error code const char * setIntParameterWithMessage ( OsiSolverInterface * model, int value , int & returnCode); /// Gets a int parameter int intParameter(OsiSolverInterface * model) const; /// Checks a double parameter (nonzero code if error) int checkDoubleParameter(double value) const; /// Returns name which could match std::string matchName ( ) const; /// Returns length of name for ptinting int lengthMatchName ( ) const; /// Returns parameter option which matches (-1 if none) int parameterOption ( std::string check ) const; /// Prints parameter options void printOptions ( ) const; /// Returns current parameter option inline std::string currentOption ( ) const { return definedKeyWords_[currentKeyWord_]; } /// Sets current parameter option void setCurrentOption ( int value , bool printIt = false); /// Sets current parameter option and returns printable string const char * setCurrentOptionWithMessage ( int value ); /// Sets current parameter option using string void setCurrentOption (const std::string value ); /// Sets current parameter option using string with message const char * setCurrentOptionWithMessage (const std::string value ); /// Returns current parameter option position int currentOptionAsInteger ( ) const ; /** Returns current parameter option position but if fake keyword returns a fake value and sets fakeInteger to true value. If not fake then fakeInteger is -COIN_INT_MAX */ int currentOptionAsInteger ( int & fakeInteger ) const; /// Sets int value void setIntValue ( int value ); /// Sets int value with message const char * setIntValueWithMessage ( int value ); inline int intValue () const { return intValue_; } /// Sets double value void setDoubleValue ( double value ); /// Sets double value with message const char * setDoubleValueWithMessage ( double value ); inline double doubleValue () const { return doubleValue_; } /// Sets string value void setStringValue ( std::string value ); inline std::string stringValue () const { return stringValue_; } /// Returns 1 if matches minimum, 2 if matches less, 0 if not matched int matches (std::string input) const; /// type inline CbcOrClpParameterType type() const { return type_; } /// whether to display inline int displayThis() const { return display_; } /// Set Long help inline void setLonghelp(const std::string help) { longHelp_ = help; } /// Print Long help void printLongHelp() const; /// Print action and string void printString() const; /** 7 if used everywhere, 1 - used by clp 2 - used by cbc 4 - used by ampl */ inline int whereUsed() const { return whereUsed_; } /// Gets value of fake keyword inline int fakeKeyWord() const { return fakeKeyWord_;} /// Sets value of fake keyword inline void setFakeKeyWord(int value, int fakeValue) { fakeKeyWord_ = value; fakeValue_ = fakeValue;} /// Sets value of fake keyword to current size of keywords void setFakeKeyWord(int fakeValue); private: /// gutsOfConstructor void gutsOfConstructor(); //@} ////////////////// data ////////////////// private: /**@name data We might as well throw all type data in - could derive? */ //@{ // Type see CbcOrClpParameterType CbcOrClpParameterType type_; /// If double == okay double lowerDoubleValue_; double upperDoubleValue_; /// If int == okay int lowerIntValue_; int upperIntValue_; // Length of name unsigned int lengthName_; // Minimum match unsigned int lengthMatch_; /// set of valid strings std::vector definedKeyWords_; /// Name std::string name_; /// Short help std::string shortHelp_; /// Long help std::string longHelp_; /// Action CbcOrClpParameterType action_; /// Current keyWord (if a keyword parameter) int currentKeyWord_; /// Display on ? int display_; /// Integer parameter - current value int intValue_; /// Double parameter - current value double doubleValue_; /// String parameter - current value std::string stringValue_; /** 7 if used everywhere, 1 - used by clp 2 - used by cbc 4 - used by ampl */ int whereUsed_; /** If >=0 then integers allowed as a fake keyword So minusnnnn would got to -nnnn in currentKeyword_ and plusnnnn would go to fakeKeyword_+nnnn */ int fakeKeyWord_; /// Return this as main value if an integer int fakeValue_; //@} }; /// Simple read stuff std::string CoinReadNextField(); std::string CoinReadGetCommand(int argc, const char *argv[]); std::string CoinReadGetString(int argc, const char *argv[]); // valid 0 - okay, 1 bad, 2 not there int CoinReadGetIntField(int argc, const char *argv[], int * valid); double CoinReadGetDoubleField(int argc, const char *argv[], int * valid); void CoinReadPrintit(const char * input); void setCbcOrClpPrinting(bool yesNo); #define CBCMAXPARAMETERS 250 /* Subroutine to establish the cbc parameter array. See the description of class CbcOrClpParam for details. Pulled from C..Main() for clarity. */ void establishParams (int &numberParameters, CbcOrClpParam *const parameters); // Given a parameter type - returns its number in list int whichParam (CbcOrClpParameterType name, int numberParameters, CbcOrClpParam *const parameters); // Dump/restore a solution to file void saveSolution(const ClpSimplex * lpSolver, std::string fileName); void restoreSolution(ClpSimplex * lpSolver, std::string fileName, int mode); #endif /* CbcOrClpParam_H */ CoinMP-1.8.3/Clp/src/ClpLsqr.cpp0000644000175000017500000003256612131237131014713 0ustar renerene/* $Id: ClpLsqr.cpp 1940 2013-04-10 10:26:33Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpLsqr.hpp" #include "ClpPdco.hpp" void ClpLsqr::do_lsqr( CoinDenseVector &b, double damp, double atol, double btol, double conlim, int itnlim, bool show, Info info, CoinDenseVector &x , int *istop, int *itn, Outfo *outfo, bool precon, CoinDenseVector &Pr) { /** Special version of LSQR for use with pdco.m. It continues with a reduced atol if a pdco-specific test isn't satisfied with the input atol. */ // Initialize. static char term_msg[8][80] = { "The exact solution is x = 0", "The residual Ax - b is small enough, given ATOL and BTOL", "The least squares error is small enough, given ATOL", "The estimated condition number has exceeded CONLIM", "The residual Ax - b is small enough, given machine precision", "The least squares error is small enough, given machine precision", "The estimated condition number has exceeded machine precision", "The iteration limit has been reached" }; // printf("***************** Entering LSQR *************\n"); assert (model_); char str1[100], str2[100], str3[100], str4[100], head1[100], head2[100]; int n = ncols_; // set m,n from lsqr object *itn = 0; *istop = 0; double ctol = 0; if (conlim > 0) ctol = 1 / conlim; double anorm = 0; double acond = 0; double ddnorm = 0; double xnorm = 0; double xxnorm = 0; double z = 0; double cs2 = -1; double sn2 = 0; // Set up the first vectors u and v for the bidiagonalization. // These satisfy beta*u = b, alfa*v = A'u. CoinDenseVector u(b); CoinDenseVector v(n, 0.0); x.clear(); double alfa = 0; double beta = u.twoNorm(); if (beta > 0) { u = (1 / beta) * u; matVecMult( 2, v, u ); if (precon) v = v * Pr; alfa = v.twoNorm(); } if (alfa > 0) { v.scale(1 / alfa); } CoinDenseVector w(v); double arnorm = alfa * beta; if (arnorm == 0) { printf(" %s\n\n", term_msg[0]); return; } double rhobar = alfa; double phibar = beta; double bnorm = beta; double rnorm = beta; sprintf(head1, " Itn x(1) Function"); sprintf(head2, " Compatible LS Norm A Cond A"); if (show) { printf(" %s%s\n", head1, head2); double test1 = 1; double test2 = alfa / beta; sprintf(str1, "%6d %12.5e %10.3e", *itn, x[0], rnorm ); sprintf(str2, " %8.1e %8.1e", test1, test2 ); printf("%s%s\n", str1, str2); } //---------------------------------------------------------------- // Main iteration loop. //---------------------------------------------------------------- while (*itn < itnlim) { *itn += 1; // Perform the next step of the bidiagonalization to obtain the // next beta, u, alfa, v. These satisfy the relations // beta*u = a*v - alfa*u, // alfa*v = A'*u - beta*v. u.scale((-alfa)); if (precon) { CoinDenseVector pv(v * Pr); matVecMult( 1, u, pv); } else { matVecMult( 1, u, v); } beta = u.twoNorm(); if (beta > 0) { u.scale((1 / beta)); anorm = sqrt(anorm * anorm + alfa * alfa + beta * beta + damp * damp); v.scale((-beta)); CoinDenseVector vv(n); vv.clear(); matVecMult( 2, vv, u ); if (precon) vv = vv * Pr; v = v + vv; alfa = v.twoNorm(); if (alfa > 0) v.scale((1 / alfa)); } // Use a plane rotation to eliminate the damping parameter. // This alters the diagonal (rhobar) of the lower-bidiagonal matrix. double rhobar1 = sqrt(rhobar * rhobar + damp * damp); double cs1 = rhobar / rhobar1; double sn1 = damp / rhobar1; double psi = sn1 * phibar; phibar *= cs1; // Use a plane rotation to eliminate the subdiagonal element (beta) // of the lower-bidiagonal matrix, giving an upper-bidiagonal matrix. double rho = sqrt(rhobar1 * rhobar1 + beta * beta); double cs = rhobar1 / rho; double sn = beta / rho; double theta = sn * alfa; rhobar = - cs * alfa; double phi = cs * phibar; phibar = sn * phibar; double tau = sn * phi; // Update x and w. double t1 = phi / rho; double t2 = - theta / rho; // dk = ((1/rho)*w); double w_norm = w.twoNorm(); x = x + t1 * w; w = v + t2 * w; ddnorm = ddnorm + (w_norm / rho) * (w_norm / rho); // if wantvar, var = var + dk.*dk; end // Use a plane rotation on the right to eliminate the // super-diagonal element (theta) of the upper-bidiagonal matrix. // Then use the result to estimate norm(x). double delta = sn2 * rho; double gambar = - cs2 * rho; double rhs = phi - delta * z; double zbar = rhs / gambar; xnorm = sqrt(xxnorm + zbar * zbar); double gamma = sqrt(gambar * gambar + theta * theta); cs2 = gambar / gamma; sn2 = theta / gamma; z = rhs / gamma; xxnorm = xxnorm + z * z; // Test for convergence. // First, estimate the condition of the matrix Abar, // and the norms of rbar and Abar'rbar. acond = anorm * sqrt( ddnorm ); double res1 = phibar * phibar; double res2 = res1 + psi * psi; rnorm = sqrt( res1 + res2 ); arnorm = alfa * fabs( tau ); // Now use these norms to estimate certain other quantities, // some of which will be small near a solution. double test1 = rnorm / bnorm; double test2 = arnorm / ( anorm * rnorm ); double test3 = 1 / acond; t1 = test1 / (1 + anorm * xnorm / bnorm); double rtol = btol + atol * anorm * xnorm / bnorm; // The following tests guard against extremely small values of // atol, btol or ctol. (The user may have set any or all of // the parameters atol, btol, conlim to 0.) // The effect is equivalent to the normal tests using // atol = eps, btol = eps, conlim = 1/eps. if (*itn >= itnlim) *istop = 7; if (1 + test3 <= 1) *istop = 6; if (1 + test2 <= 1) *istop = 5; if (1 + t1 <= 1) *istop = 4; // Allow for tolerances set by the user. if (test3 <= ctol) *istop = 3; if (test2 <= atol) *istop = 2; if (test1 <= rtol) *istop = 1; //------------------------------------------------------------------- // SPECIAL TEST THAT DEPENDS ON pdco.m. // Aname in pdco is iw in lsqr. // dy is x // Other stuff is in info. // We allow for diagonal preconditioning in pdDDD3. //------------------------------------------------------------------- if (*istop > 0) { double r3new = arnorm; double r3ratio = r3new / info.r3norm; double atolold = atol; double atolnew = atol; if (atol > info.atolmin) { if (r3ratio <= 0.1) { // dy seems good // Relax } else if (r3ratio <= 0.5) { // Accept dy but make next one more accurate. atolnew = atolnew * 0.1; } else { // Recompute dy more accurately if (show) { printf("\n "); printf(" \n"); printf(" %5.1f%7d%7.3f", log10(atolold), *itn, r3ratio); } atol = atol * 0.1; atolnew = atol; *istop = 0; } outfo->atolold = atolold; outfo->atolnew = atolnew; outfo->r3ratio = r3ratio; } //------------------------------------------------------------------- // See if it is time to print something. //------------------------------------------------------------------- int prnt = 0; if (n <= 40 ) prnt = 1; if (*itn <= 10 ) prnt = 1; if (*itn >= itnlim - 10) prnt = 1; if (*itn % 10 == 0 ) prnt = 1; if (test3 <= 2 * ctol ) prnt = 1; if (test2 <= 10 * atol ) prnt = 1; if (test1 <= 10 * rtol ) prnt = 1; if (*istop != 0 ) prnt = 1; if (prnt == 1) { if (show) { sprintf(str1, " %6d %12.5e %10.3e", *itn, x[0], rnorm ); sprintf(str2, " %8.1e %8.1e", test1, test2 ); sprintf(str3, " %8.1e %8.1e", anorm, acond ); printf("%s%s%s\n", str1, str2, str3); } } if (*istop > 0) break; } } // End of iteration loop. // Print the stopping condition. if (show) { printf("\n LSQR finished\n"); // disp(msg(istop+1,:)) // disp(' ') printf("%s\n", term_msg[*istop]); sprintf(str1, "istop =%8d itn =%8d", *istop, *itn ); sprintf(str2, "anorm =%8.1e acond =%8.1e", anorm, acond ); sprintf(str3, "rnorm =%8.1e arnorm =%8.1e", rnorm, arnorm ); sprintf(str4, "bnorm =%8.1e xnorm =%8.1e", bnorm, xnorm ); printf("%s %s\n", str1, str2); printf("%s %s\n", str3, str4); } } void ClpLsqr::matVecMult( int mode, CoinDenseVector *x, CoinDenseVector *y) { int n = model_->numberColumns(); int m = model_->numberRows(); CoinDenseVector *temp = new CoinDenseVector(n, 0.0); double *t_elts = temp->getElements(); double *x_elts = x->getElements(); double *y_elts = y->getElements(); ClpPdco * pdcoModel = (ClpPdco *) model_; if (mode == 1) { pdcoModel->matVecMult( 2, temp, y); for (int k = 0; k < n; k++) x_elts[k] += (diag1_[k] * t_elts[k]); for (int k = 0; k < m; k++) x_elts[n+k] += (diag2_ * y_elts[k]); } else { for (int k = 0; k < n; k++) t_elts[k] = diag1_[k] * y_elts[k]; pdcoModel->matVecMult( 1, x, temp); for (int k = 0; k < m; k++) x_elts[k] += diag2_ * y_elts[n+k]; } delete temp; return; } void ClpLsqr::matVecMult( int mode, CoinDenseVector &x, CoinDenseVector &y) { matVecMult( mode, &x, &y); return; } /* Default constructor */ ClpLsqr::ClpLsqr() : nrows_(0), ncols_(0), model_(NULL), diag1_(NULL), diag2_(0.0) {} /* Constructor for use with Pdco model (note modified for pdco!!!!) */ ClpLsqr::ClpLsqr(ClpInterior *model) : diag1_(NULL), diag2_(0.0) { model_ = model; nrows_ = model->numberRows() + model->numberColumns(); ncols_ = model->numberRows(); } /** Destructor */ ClpLsqr::~ClpLsqr() { // delete [] diag1_; no as we just borrowed it } bool ClpLsqr::setParam(char *parmName, int parmValue) { std::cout << "Set lsqr integer parameter " << parmName << "to " << parmValue << std::endl; if ( strcmp(parmName, "nrows") == 0) { nrows_ = parmValue; return 1; } else if ( strcmp(parmName, "ncols") == 0) { ncols_ = parmValue; return 1; } std::cout << "Attempt to set unknown integer parameter name " << parmName << std::endl; return 0; } ClpLsqr::ClpLsqr(const ClpLsqr &rhs) : nrows_(rhs.nrows_), ncols_(rhs.ncols_), model_(rhs.model_), diag2_(rhs.diag2_) { diag1_ = ClpCopyOfArray(rhs.diag1_, nrows_); } // Assignment operator. This copies the data ClpLsqr & ClpLsqr::operator=(const ClpLsqr & rhs) { if (this != &rhs) { delete [] diag1_; diag1_ = ClpCopyOfArray(rhs.diag1_, nrows_); nrows_ = rhs.nrows_; ncols_ = rhs.ncols_; model_ = rhs.model_; diag2_ = rhs.diag2_; } return *this; } CoinMP-1.8.3/Clp/src/ClpGubDynamicMatrix.hpp0000644000175000017500000002004011510657452017202 0ustar renerene/* $Id: ClpGubDynamicMatrix.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpGubDynamicMatrix_H #define ClpGubDynamicMatrix_H #include "CoinPragma.hpp" #include "ClpGubMatrix.hpp" /** This implements Gub rows plus a ClpPackedMatrix. This a dynamic version which stores the gub part and dynamically creates matrix. All bounds are assumed to be zero and infinity This is just a simple example for real column generation */ class ClpGubDynamicMatrix : public ClpGubMatrix { public: /**@name Main functions provided */ //@{ /// Partial pricing virtual void partialPricing(ClpSimplex * model, double start, double end, int & bestSequence, int & numberWanted); /** This is local to Gub to allow synchronization: mode=0 when status of basis is good mode=1 when variable is flagged mode=2 when all variables unflagged (returns number flagged) mode=3 just reset costs (primal) mode=4 correct number of dual infeasibilities mode=5 return 4 if time to re-factorize mode=8 - make sure set is clean mode=9 - adjust lower, upper on set by incoming */ virtual int synchronize(ClpSimplex * model, int mode); /// Sets up an effective RHS and does gub crash if needed virtual void useEffectiveRhs(ClpSimplex * model, bool cheapest = true); /** update information for a pivot (and effective rhs) */ virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue); /// Add a new variable to a set void insertNonBasic(int sequence, int iSet); /** Returns effective RHS offset if it is being used. This is used for long problems or big gub or anywhere where going through full columns is expensive. This may re-compute */ virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false, bool check = false); using ClpPackedMatrix::times ; /** Return y + A * scalar *x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ virtual void times(double scalar, const double * x, double * y) const; /** Just for debug Returns sum and number of primal infeasibilities. Recomputes keys */ virtual int checkFeasible(ClpSimplex * model, double & sum) const; /// Cleans data after setWarmStart void cleanData(ClpSimplex * model); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpGubDynamicMatrix(); /** Destructor */ virtual ~ClpGubDynamicMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpGubDynamicMatrix(const ClpGubDynamicMatrix&); /** This is the real constructor. It assumes factorization frequency will not be changed. This resizes model !!!! */ ClpGubDynamicMatrix(ClpSimplex * model, int numberSets, int numberColumns, const int * starts, const double * lower, const double * upper, const int * startColumn, const int * row, const double * element, const double * cost, const double * lowerColumn = NULL, const double * upperColumn = NULL, const unsigned char * status = NULL); ClpGubDynamicMatrix& operator=(const ClpGubDynamicMatrix&); /// Clone virtual ClpMatrixBase * clone() const ; //@} /**@name gets and sets */ //@{ /// enums for status of various sorts enum DynamicStatus { inSmall = 0x01, atUpperBound = 0x02, atLowerBound = 0x03 }; /// Whether flagged inline bool flagged(int i) const { return (dynamicStatus_[i] & 8) != 0; } inline void setFlagged(int i) { dynamicStatus_[i] = static_cast(dynamicStatus_[i] | 8); } inline void unsetFlagged(int i) { dynamicStatus_[i] = static_cast(dynamicStatus_[i] & ~8); } inline void setDynamicStatus(int sequence, DynamicStatus status) { unsigned char & st_byte = dynamicStatus_[sequence]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | status); } inline DynamicStatus getDynamicStatus(int sequence) const { return static_cast (dynamicStatus_[sequence] & 7); } /// Saved value of objective offset inline double objectiveOffset() const { return objectiveOffset_; } /// Starts of each column inline CoinBigIndex * startColumn() const { return startColumn_; } /// rows inline int * row() const { return row_; } /// elements inline double * element() const { return element_; } /// costs inline double * cost() const { return cost_; } /// full starts inline int * fullStart() const { return fullStart_; } /// ids of active columns (just index here) inline int * id() const { return id_; } /// Optional lower bounds on columns inline double * lowerColumn() const { return lowerColumn_; } /// Optional upper bounds on columns inline double * upperColumn() const { return upperColumn_; } /// Optional true lower bounds on sets inline double * lowerSet() const { return lowerSet_; } /// Optional true upper bounds on sets inline double * upperSet() const { return upperSet_; } /// size inline int numberGubColumns() const { return numberGubColumns_; } /// first free inline int firstAvailable() const { return firstAvailable_; } /// set first free inline void setFirstAvailable(int value) { firstAvailable_ = value; } /// first dynamic inline int firstDynamic() const { return firstDynamic_; } /// number of columns in dynamic model inline int lastDynamic() const { return lastDynamic_; } /// size of working matrix (max) inline int numberElements() const { return numberElements_; } /// Status region for gub slacks inline unsigned char * gubRowStatus() const { return status_; } /// Status region for gub variables inline unsigned char * dynamicStatus() const { return dynamicStatus_; } /// Returns which set a variable is in int whichSet (int sequence) const; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Saved value of objective offset double objectiveOffset_; /// Starts of each column CoinBigIndex * startColumn_; /// rows int * row_; /// elements double * element_; /// costs double * cost_; /// full starts int * fullStart_; /// ids of active columns (just index here) int * id_; /// for status and which bound unsigned char * dynamicStatus_; /// Optional lower bounds on columns double * lowerColumn_; /// Optional upper bounds on columns double * upperColumn_; /// Optional true lower bounds on sets double * lowerSet_; /// Optional true upper bounds on sets double * upperSet_; /// size int numberGubColumns_; /// first free int firstAvailable_; /// saved first free int savedFirstAvailable_; /// first dynamic int firstDynamic_; /// number of columns in dynamic model int lastDynamic_; /// size of working matrix (max) int numberElements_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpMain.cpp0000644000175000017500000002542012454754530014664 0ustar renerene/* $Id: ClpMain.cpp 2084 2015-01-12 14:25:28Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "AbcCommon.hpp" #include "ClpSimplex.hpp" #ifdef ABC_INHERIT #include "AbcSimplex.hpp" #endif #ifndef ABC_INHERIT void ClpMain0(ClpSimplex * models); int ClpMain1(int argc, const char *argv[],ClpSimplex * model); #else void ClpMain0(AbcSimplex * models); int ClpMain1(int argc, const char *argv[],AbcSimplex * model); #endif //#define CILK_TEST #ifdef CILK_TEST static void cilkTest(); #endif //#define LAPACK_TEST /* Somehow with some BLAS we get multithreaded by default For 99.99% of problems this is not a good idea. The openblas_set_num_threads(1) seems to work even with other blas */ #if CLP_USE_OPENBLAS extern "C" { void openblas_set_num_threads(int num_threads); } #endif #ifdef LAPACK_TEST #include "/include/lapacke.h" #ifndef COIN_FACTORIZATION_DENSE_CODE #define COIN_FACTORIZATION_DENSE_CODE 1 #endif #if COIN_FACTORIZATION_DENSE_CODE==1 // using simple lapack interface extern "C" { void openblas_set_num_threads(int num_threads); #if 0 /** LAPACK Fortran subroutine DGETRF. */ void LAPACK_dgetrf(int * m, int *n, double *A, int *ldA, int * ipiv, int *info); /** LAPACK Fortran subroutine DGETRS. */ void LAPACK_dgetrs(char *trans, int *n, int *nrhs, const double *A, int *ldA, int * ipiv, double *B, int *ldB, int *info); // LAPACK_dgetrf(&N, &N, m, &LDA,ipiv, &info); #endif } int test_lapack(int n) { int* ipiv; int info; int i, j; double * m, *x, *y; int LDB,LDA, N, NRHS; char transp = 'N'; m=(double*)malloc(sizeof(double)*n*n); x=(double*)malloc(sizeof(double)*n); y=(double*)malloc(sizeof(double)*n); ipiv=(int*)malloc(sizeof(int)*n); for (i=0; i #include #include static double malloc_times = 0.0; static double malloc_total = 0.0; static int malloc_amount[] = {0, 32, 128, 256, 1024, 4096, 16384, 65536, 262144, COIN_INT_MAX}; static int malloc_n = 10; double malloc_counts[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; bool malloc_counts_on = true; void * operator new (size_t size) throw (std::bad_alloc) { malloc_times ++; malloc_total += size; int i; for (i = 0; i < malloc_n; i++) { if ((int) size <= malloc_amount[i]) { malloc_counts[i]++; break; } } if (size>100000) { printf("allocating %ld bytes\n",size); } void * p = malloc(size); return p; } void operator delete (void *p) throw() { free(p); } static void malloc_stats2() { double average = malloc_total / malloc_times; printf("count %g bytes %g - average %g\n", malloc_times, malloc_total, average); for (int i = 0; i < malloc_n; i++) printf("%g ", malloc_counts[i]); printf("\n"); malloc_times = 0.0; malloc_total = 0.0; memset(malloc_counts, 0, sizeof(malloc_counts)); // print results } #endif //CLP_MALLOC_STATISTICS int #if defined(_MSC_VER) __cdecl #endif // _MSC_VER main (int argc, const char *argv[]) { #ifdef CILK_TEST cilkTest(); #endif #if CLP_USE_OPENBLAS openblas_set_num_threads(CLP_USE_OPENBLAS); #endif #ifdef LAPACK_TEST //void openblas_set_num_threads(int num_threads); openblas_set_num_threads(1); if(argc<2){ printf("Error - need size of matrix for lapack test\n"); return 1; } int n=atoi(argv[1]); printf("n=%d\n",n); if(argc>2){ int nThreads=atoi(argv[2]); printf("Using %d threads\n",nThreads); openblas_set_num_threads(nThreads); } test_lapack(n); return 0; #endif #ifndef ABC_INHERIT ClpSimplex * models = new ClpSimplex[1]; #else AbcSimplex * models = new AbcSimplex[1]; #endif std::cout << "Coin LP version " << CLP_VERSION << ", build " << __DATE__ << std::endl; // Print command line if (argc > 1) { printf("command line - "); for (int i = 0; i < argc; i++) printf("%s ", argv[i]); printf("\n"); } ClpMain0(models); int returnCode = ClpMain1(argc, argv,models); delete [] models; return returnCode; } /* Version 1.00.00 October 13 2004. 1.00.01 October 18. Added basis handling helped/prodded by Thorsten Koch. Also modifications to make faster with sbb (I hope I haven't broken anything). 1.00.02 March 21 2005. Redid ClpNonLinearCost to save memory also redid createRim to try and improve cache characteristics. 1.00.03 April 8 2005. Added Volume algorithm as crash and made code more robust on testing. Also added "either" and "tune" algorithm. 1.01.01 April 12 2005. Decided to go to different numbering. Backups will be last 2 digits while middle 2 are for improvements. Still take a long time to get to 2.00.01 1.01.02 May 4 2005. Will be putting in many changes - so saving stable version 1.02.01 May 6 2005. Lots of changes to try and make faster and more stable in branch and cut. 1.02.02 May 19 2005. Stuff for strong branching and some improvements to simplex 1.03.01 May 24 2006. Lots done but I can't remember what! 1.03.03 June 13 2006. For clean up after dual perturbation 1.04.01 June 26 2007. Lots of changes but I got lazy 1.05.00 June 27 2007. This is trunk so when gets to stable will be 1.5 1.11.00 November 5 2009 (Guy Fawkes) - OSL factorization and better ordering */ #ifdef CILK_TEST // -*- C++ -*- /* * cilk-for.cilk * * Copyright (c) 2007-2008 Cilk Arts, Inc. 55 Cambridge Street, * Burlington, MA 01803. Patents pending. All rights reserved. You may * freely use the sample code to guide development of your own works, * provided that you reproduce this notice in any works you make that * use the sample code. This sample code is provided "AS IS" without * warranty of any kind, either express or implied, including but not * limited to any implied warranty of non-infringement, merchantability * or fitness for a particular purpose. In no event shall Cilk Arts, * Inc. be liable for any direct, indirect, special, or consequential * damages, or any other damages whatsoever, for any use of or reliance * on this sample code, including, without limitation, any lost * opportunity, lost profits, business interruption, loss of programs or * data, even if expressly advised of or otherwise aware of the * possibility of such damages, whether in an action of contract, * negligence, tort, or otherwise. * * This file demonstrates a Cilk++ for loop */ #include //#include #include #include #include // cilk_for granularity. #define CILK_FOR_GRAINSIZE 128 double dowork(double i) { // Waste time: int j; double k = i; for (j = 0; j < 50000; ++j) { k += k / ((j + 1) * (k + 1)); } return k; } static void doSomeWork(double * a,int low, int high) { if (high-low>300) { int mid=(high+low)>>1; cilk_spawn doSomeWork(a,low,mid); doSomeWork(a,mid,high); cilk_sync; } else { for(int i = low; i < high; ++i) { a[i] = dowork(a[i]); } } } void cilkTest() { unsigned int n = 10000; //cilk::cilkview cv; double* a = new double[n]; for(unsigned int i = 0; i < n; i++) { // Populate A a[i] = (double) ((i * i) % 1024 + 512) / 512; } std::cout << "Iterating over " << n << " integers" << std::endl; //cv.start(); #if 1 //#pragma cilk_grainsize=CILK_FOR_GRAINSIZE cilk_for(unsigned int i = 0; i < n; ++i) { a[i] = dowork(a[i]); } #else doSomeWork(a,0,n); #endif int * which =new int[n]; unsigned int n2=n>>1; for (int i=0;i maximumIndex(-1,0.0); cilk_for(unsigned int i = 0; i < n2; ++i) { int iWhich=which[i]; maximumIndex.calc_max(iWhich,a[iWhich]); } int bestIndex=maximumIndex.get_index(); int bestIndex2=-1; double largest=0.0; cilk_for(unsigned int i = 0; i < n2; ++i) { int iWhich=which[i]; if (a[iWhich]>largest) { bestIndex2=iWhich; largest=a[iWhich]; } } assert (bestIndex==bestIndex2); //cv.stop(); //cv.dump("cilk-for-results", false); //std::cout << cv.accumulated_milliseconds() / 1000.f << " seconds" << std::endl; exit(0); } #endif CoinMP-1.8.3/Clp/src/MyMessageHandler.cpp0000644000175000017500000001300311557471077016530 0ustar renerene/* $Id: MyMessageHandler.cpp 1726 2011-05-02 08:58:39Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) // move into CoinPragma.hpp ? #pragma warning(disable:4503) #endif #include #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpNonLinearCost.hpp" #include "MyMessageHandler.hpp" #include "ClpMessage.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- MyMessageHandler::MyMessageHandler () : CoinMessageHandler(), model_(NULL), feasibleExtremePoints_(), iterationNumber_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- MyMessageHandler::MyMessageHandler (const MyMessageHandler & rhs) : CoinMessageHandler(rhs), model_(rhs.model_), feasibleExtremePoints_(rhs.feasibleExtremePoints_), iterationNumber_(rhs.iterationNumber_) { } MyMessageHandler::MyMessageHandler (const CoinMessageHandler & rhs) : CoinMessageHandler(rhs), model_(NULL), feasibleExtremePoints_(), iterationNumber_(-1) { } // Constructor with pointer to model MyMessageHandler::MyMessageHandler(ClpSimplex * model, FILE * /*userPointer*/) : CoinMessageHandler(), model_(model), feasibleExtremePoints_(), iterationNumber_(-1) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- MyMessageHandler::~MyMessageHandler () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- MyMessageHandler & MyMessageHandler::operator=(const MyMessageHandler& rhs) { if (this != &rhs) { CoinMessageHandler::operator=(rhs); model_ = rhs.model_; feasibleExtremePoints_ = rhs.feasibleExtremePoints_; iterationNumber_ = rhs.iterationNumber_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- CoinMessageHandler * MyMessageHandler::clone() const { return new MyMessageHandler(*this); } int MyMessageHandler::print() { if (currentSource() == "Clp") { if (currentMessage().externalNumber() == 102) { printf("There are %d primal infeasibilities\n", model_->nonLinearCost()->numberInfeasibilities()); // Feasibility if (!model_->nonLinearCost()->numberInfeasibilities()) { // Column solution int numberColumns = model_->numberColumns(); const double * solution = model_->solutionRegion(1); // Create vector to contain solution StdVectorDouble feasibleExtremePoint; const double *objective = model_->objective(); double objectiveValue = 0; if (!model_->columnScale()) { // No scaling for (int i = 0; i < numberColumns; i++) { feasibleExtremePoint.push_back(solution[i]); objectiveValue += solution[i] * objective[i]; } } else { // scaled const double * columnScale = model_->columnScale(); for (int i = 0; i < numberColumns; i++) { feasibleExtremePoint.push_back(solution[i]*columnScale[i]); objectiveValue += solution[i] * objective[i] * columnScale[i]; } } std::cout << "Objective " << objectiveValue << std::endl; // Save solution feasibleExtremePoints_.push_front(feasibleExtremePoint); // Want maximum of 10 solutions, so if more then 10 get rid of oldest size_t numExtremePointsSaved = feasibleExtremePoints_.size(); if ( numExtremePointsSaved >= 10 ) { feasibleExtremePoints_.pop_back(); assert( feasibleExtremePoints_.size() == numExtremePointsSaved - 1 ); }; } return 0; // skip printing } } // If one wants access to the message text, // it is available using method messageBuffer(). // For example, one could code: // std::cout < & MyMessageHandler::getFeasibleExtremePoints() const { return feasibleExtremePoints_; } void MyMessageHandler::clearFeasibleExtremePoints() { feasibleExtremePoints_.clear(); } CoinMP-1.8.3/Clp/src/Idiot.hpp0000644000175000017500000002507612527126375014426 0ustar renerene/* $Id: Idiot.hpp 2143 2015-05-20 15:49:17Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // "Idiot" as the name of this algorithm is copylefted. If you want to change // the name then it should be something equally stupid (but not "Stupid") or // even better something witty. #ifndef Idiot_H #define Idiot_H #ifndef OSI_IDIOT #include "ClpSimplex.hpp" #define OsiSolverInterface ClpSimplex #else #include "OsiSolverInterface.hpp" typedef int CoinBigIndex; #endif class CoinMessageHandler; class CoinMessages; /// for use internally typedef struct { double infeas; double objval; double dropThis; double weighted; double sumSquared; double djAtBeginning; double djAtEnd; int iteration; } IdiotResult; /** This class implements a very silly algorithm. It has no merit apart from the fact that it gets an approximate solution to some classes of problems. Better if vaguely homogeneous. It works on problems where volume algorithm works and often gets a better primal solution but it has no dual solution. It can also be used as a "crash" to get a problem started. This is probably its most useful function. It is based on the idea that algorithms with terrible convergence properties may be okay at first. Throw in some random dubious tricks and the resulting code may be worth keeping as long as you don't look at it. */ class Idiot { public: /**@name Constructors and destructor Just a pointer to model is kept */ //@{ /// Default constructor Idiot ( ); /// Constructor with model Idiot ( OsiSolverInterface & model ); /// Copy constructor. Idiot(const Idiot &); /// Assignment operator. This copies the data Idiot & operator=(const Idiot & rhs); /// Destructor ~Idiot ( ); //@} /**@name Algorithmic calls */ //@{ /// Get an approximate solution with the idiot code void solve(); /// Lightweight "crash" void crash(int numberPass, CoinMessageHandler * handler, const CoinMessages * messages, bool doCrossover = true); /** Use simplex to get an optimal solution mode is how many steps the simplex crossover should take to arrive to an extreme point: 0 - chosen,all ever used, all 1 - chosen, all 2 - all 3 - do not do anything - maybe basis + 16 do presolves */ void crossOver(int mode); //@} /**@name Gets and sets of most useful data */ //@{ /** Starting weight - small emphasizes feasibility, default 1.0e-4 */ inline double getStartingWeight() const { return mu_; } inline void setStartingWeight(double value) { mu_ = value; } /** Weight factor - weight multiplied by this when changes, default 0.333 */ inline double getWeightFactor() const { return muFactor_; } inline void setWeightFactor(double value) { muFactor_ = value; } /** Feasibility tolerance - problem essentially feasible if individual infeasibilities less than this. default 0.1 */ inline double getFeasibilityTolerance() const { return smallInfeas_; } inline void setFeasibilityTolerance(double value) { smallInfeas_ = value; } /** Reasonably feasible. Dubious method concentrates more on objective when sum of infeasibilities less than this. Very dubious default value of (Number of rows)/20 */ inline double getReasonablyFeasible() const { return reasonableInfeas_; } inline void setReasonablyFeasible(double value) { reasonableInfeas_ = value; } /** Exit infeasibility - exit if sum of infeasibilities less than this. Default -1.0 (i.e. switched off) */ inline double getExitInfeasibility() const { return exitFeasibility_; } inline void setExitInfeasibility(double value) { exitFeasibility_ = value; } /** Major iterations. stop after this number. Default 30. Use 2-5 for "crash" 50-100 for serious crunching */ inline int getMajorIterations() const { return majorIterations_; } inline void setMajorIterations(int value) { majorIterations_ = value; } /** Minor iterations. Do this number of tiny steps before deciding whether to change weights etc. Default - dubious sqrt(Number of Rows). Good numbers 105 to 405 say (5 is dubious method of making sure idiot is not trying to be clever which it may do every 10 minor iterations) */ inline int getMinorIterations() const { return maxIts2_; } inline void setMinorIterations(int value) { maxIts2_ = value; } // minor iterations for first time inline int getMinorIterations0() const { return maxIts_; } inline void setMinorIterations0(int value) { maxIts_ = value; } /** Reduce weight after this many major iterations. It may get reduced before this but this is a maximum. Default 3. 3-10 plausible. */ inline int getReduceIterations() const { return maxBigIts_; } inline void setReduceIterations(int value) { maxBigIts_ = value; } /// Amount of information - default of 1 should be okay inline int getLogLevel() const { return logLevel_; } inline void setLogLevel(int value) { logLevel_ = value; } /// How lightweight - 0 not, 1 yes, 2 very lightweight inline int getLightweight() const { return lightWeight_; } inline void setLightweight(int value) { lightWeight_ = value; } /// strategy inline int getStrategy() const { return strategy_; } inline void setStrategy(int value) { strategy_ = value; } /// Fine tuning - okay if feasibility drop this factor inline double getDropEnoughFeasibility() const { return dropEnoughFeasibility_; } inline void setDropEnoughFeasibility(double value) { dropEnoughFeasibility_ = value; } /// Fine tuning - okay if weighted obj drop this factor inline double getDropEnoughWeighted() const { return dropEnoughWeighted_; } inline void setDropEnoughWeighted(double value) { dropEnoughWeighted_ = value; } /// Set model inline void setModel(OsiSolverInterface * model) { model_ = model; }; //@} /// Stuff for internal use private: /// Does actual work // allow public! public: void solve2(CoinMessageHandler * handler, const CoinMessages *messages); private: IdiotResult IdiSolve( int nrows, int ncols, double * rowsol , double * colsol, double * pi, double * djs, const double * origcost , double * rowlower, double * rowupper, const double * lower, const double * upper, const double * element, const int * row, const CoinBigIndex * colcc, const int * length, double * lambda, int maxIts, double mu, double drop, double maxmin, double offset, int strategy, double djTol, double djExit, double djFlag, CoinThreadRandom * randomNumberGenerator); int dropping(IdiotResult result, double tolerance, double small, int *nbad); IdiotResult objval(int nrows, int ncols, double * rowsol , double * colsol, double * pi, double * djs, const double * cost , const double * rowlower, const double * rowupper, const double * lower, const double * upper, const double * elemnt, const int * row, const CoinBigIndex * columnStart, const int * length, int extraBlock, int * rowExtra, double * solExtra, double * elemExtra, double * upperExtra, double * costExtra, double weight); // Deals with whenUsed and slacks int cleanIteration(int iteration, int ordinaryStart, int ordinaryEnd, double * colsol, const double * lower, const double * upper, const double * rowLower, const double * rowUpper, const double * cost, const double * element, double fixTolerance, double & objChange, double & infChange, double & maxInfeasibility); private: /// Underlying model OsiSolverInterface * model_; double djTolerance_; double mu_; /* starting mu */ double drop_; /* exit if drop over 5 checks less than this */ double muFactor_; /* reduce mu by this */ double stopMu_; /* exit if mu gets smaller than this */ double smallInfeas_; /* feasibility tolerance */ double reasonableInfeas_; /* use lambdas if feasibility less than this */ double exitDrop_; /* candidate for stopping after a major iteration */ double muAtExit_; /* mu on exit */ double exitFeasibility_; /* exit if infeasibility less than this */ double dropEnoughFeasibility_; /* okay if feasibility drop this factor */ double dropEnoughWeighted_; /* okay if weighted obj drop this factor */ int * whenUsed_; /* array to say what was used */ int maxBigIts_; /* always reduce mu after this */ int maxIts_; /* do this many iterations on first go */ int majorIterations_; int logLevel_; int logFreq_; int checkFrequency_; /* can exit after 5 * this iterations (on drop) */ int lambdaIterations_; /* do at least this many lambda iterations */ int maxIts2_; /* do this many iterations on subsequent goes */ int strategy_; /* 0 - default strategy 1 - do accelerator step but be cautious 2 - do not do accelerator step 4 - drop, exitDrop and djTolerance all relative 8 - keep accelerator step to theta=10.0 32 - Scale 512 - crossover 2048 - keep lambda across mu change 4096 - return best solution (not last found) 8192 - always do a presolve in crossover 16384 - costed slacks found - so whenUsed_ longer 32768 - experimental 1 65536 - experimental 2 131072 - experimental 3 262144 - just values pass etc 524288 - don't treat structural slacks as slacks */ int lightWeight_; // 0 - normal, 1 lightweight }; #endif CoinMP-1.8.3/Clp/src/ClpCholeskyWssmpKKT.hpp0000644000175000017500000000413011510657452017162 0ustar renerene/* $Id: ClpCholeskyWssmpKKT.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpCholeskyWssmpKKT_H #define ClpCholeskyWssmpKKT_H #include "ClpCholeskyBase.hpp" class ClpMatrixBase; class ClpCholeskyDense; /** WssmpKKT class for Clp Cholesky factorization */ class ClpCholeskyWssmpKKT : public ClpCholeskyBase { public: /**@name Virtual methods that the derived classes provides */ //@{ /** Orders rows and saves pointer to matrix.and model. Returns non-zero if not enough memory */ virtual int order(ClpInterior * model) ; /** Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ virtual int symbolic(); /** Factorize - filling in rowsDropped and returning number dropped. If return code negative then out of memory */ virtual int factorize(const double * diagonal, int * rowsDropped) ; /** Uses factorization to solve. */ virtual void solve (double * region) ; /** Uses factorization to solve. - given as if KKT. region1 is rows+columns, region2 is rows */ virtual void solveKKT (double * region1, double * region2, const double * diagonal, double diagonalScaleFactor); //@} /**@name Constructors, destructor */ //@{ /** Constructor which has dense columns activated. Default is off. */ ClpCholeskyWssmpKKT(int denseThreshold = -1); /** Destructor */ virtual ~ClpCholeskyWssmpKKT(); // Copy ClpCholeskyWssmpKKT(const ClpCholeskyWssmpKKT&); // Assignment ClpCholeskyWssmpKKT& operator=(const ClpCholeskyWssmpKKT&); /// Clone virtual ClpCholeskyBase * clone() const ; //@} private: /**@name Data members */ //@{ //@} }; #endif CoinMP-1.8.3/Clp/src/CoinAbcFactorization1.cpp0000644000175000017500000000101712101105055017426 0ustar renerene/* $Id: CoinAbcFactorization1.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization1.cpp" #endif CoinMP-1.8.3/Clp/src/ClpPredictorCorrector.hpp0000644000175000017500000000625211510657452017622 0ustar renerene/* $Id: ClpPredictorCorrector.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef ClpPredictorCorrector_H #define ClpPredictorCorrector_H #include "ClpInterior.hpp" /** This solves LPs using the predictor-corrector method due to Mehrotra. It also uses multiple centrality corrections as in Gondzio. See; S. Mehrotra, "On the implementation of a primal-dual interior point method", SIAM Journal on optimization, 2 (1992) J. Gondzio, "Multiple centraility corrections in a primal-dual method for linear programming", Computational Optimization and Applications",6 (1996) It is rather basic as Interior point is not my speciality It inherits from ClpInterior. It has no data of its own and is never created - only cast from a ClpInterior object at algorithm time. It can also solve QPs */ class ClpPredictorCorrector : public ClpInterior { public: /**@name Description of algorithm */ //@{ /** Primal Dual Predictor Corrector algorithm Method Big TODO */ int solve(); //@} /**@name Functions used in algorithm */ //@{ /// findStepLength. //phase - 0 predictor // 1 corrector // 2 primal dual CoinWorkDouble findStepLength( int phase); /// findDirectionVector. CoinWorkDouble findDirectionVector(const int phase); /// createSolution. Creates solution from scratch (- code if no memory) int createSolution(); /// complementarityGap. Computes gap //phase 0=as is , 1 = after predictor , 2 after corrector CoinWorkDouble complementarityGap(int & numberComplementarityPairs, int & numberComplementarityItems, const int phase); /// setupForSolve. //phase 0=affine , 1 = corrector , 2 = primal-dual void setupForSolve(const int phase); /** Does solve. region1 is for deltaX (columns+rows), region2 for deltaPi (rows) */ void solveSystem(CoinWorkDouble * region1, CoinWorkDouble * region2, const CoinWorkDouble * region1In, const CoinWorkDouble * region2In, const CoinWorkDouble * saveRegion1, const CoinWorkDouble * saveRegion2, bool gentleRefine); /// sees if looks plausible change in complementarity bool checkGoodMove(const bool doCorrector, CoinWorkDouble & bestNextGap, bool allowIncreasingGap); ///: checks for one step size bool checkGoodMove2(CoinWorkDouble move, CoinWorkDouble & bestNextGap, bool allowIncreasingGap); /// updateSolution. Updates solution at end of iteration //returns number fixed int updateSolution(CoinWorkDouble nextGap); /// Save info on products of affine deltaT*deltaW and deltaS*deltaZ CoinWorkDouble affineProduct(); ///See exactly what would happen given current deltas void debugMove(int phase, CoinWorkDouble primalStep, CoinWorkDouble dualStep); //@} }; #endif CoinMP-1.8.3/Clp/src/ClpPackedMatrix.hpp0000644000175000017500000006671512452503025016362 0ustar renerene/* $Id: ClpPackedMatrix.hpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpPackedMatrix_H #define ClpPackedMatrix_H #include "CoinPragma.hpp" #include "ClpMatrixBase.hpp" /** This implements CoinPackedMatrix as derived from ClpMatrixBase. It adds a few methods that know about model as well as matrix For details see CoinPackedMatrix */ class ClpPackedMatrix2; class ClpPackedMatrix3; class ClpPackedMatrix : public ClpMatrixBase { public: /**@name Useful methods */ //@{ /// Return a complete CoinPackedMatrix virtual CoinPackedMatrix * getPackedMatrix() const { return matrix_; } /** Whether the packed matrix is column major ordered or not. */ virtual bool isColOrdered() const { return matrix_->isColOrdered(); } /** Number of entries in the packed matrix. */ virtual CoinBigIndex getNumElements() const { return matrix_->getNumElements(); } /** Number of columns. */ virtual int getNumCols() const { return matrix_->getNumCols(); } /** Number of rows. */ virtual int getNumRows() const { return matrix_->getNumRows(); } /** A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const double * getElements() const { return matrix_->getElements(); } /// Mutable elements inline double * getMutableElements() const { return matrix_->getMutableElements(); } /** A vector containing the minor indices of the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const int * getIndices() const { return matrix_->getIndices(); } virtual const CoinBigIndex * getVectorStarts() const { return matrix_->getVectorStarts(); } /** The lengths of the major-dimension vectors. */ virtual const int * getVectorLengths() const { return matrix_->getVectorLengths(); } /** The length of a single major-dimension vector. */ virtual int getVectorLength(int index) const { return matrix_->getVectorSize(index); } /** Delete the columns whose indices are listed in indDel. */ virtual void deleteCols(const int numDel, const int * indDel); /** Delete the rows whose indices are listed in indDel. */ virtual void deleteRows(const int numDel, const int * indDel); #ifndef CLP_NO_VECTOR /// Append Columns virtual void appendCols(int number, const CoinPackedVectorBase * const * columns); /// Append Rows virtual void appendRows(int number, const CoinPackedVectorBase * const * rows); #endif /** Append a set of rows/columns to the end of the matrix. Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns */ virtual int appendMatrix(int number, int type, const CoinBigIndex * starts, const int * index, const double * element, int numberOther = -1); /** Replace the elements of a vector. The indices remain the same. This is only needed if scaling and a row copy is used. At most the number specified will be replaced. The index is between 0 and major dimension of matrix */ virtual void replaceVector(const int index, const int numReplace, const double * newElements) { matrix_->replaceVector(index, numReplace, newElements); } /** Modify one element of packed matrix. An element may be added. This works for either ordering If the new element is zero it will be deleted unless keepZero true */ virtual void modifyCoefficient(int row, int column, double newElement, bool keepZero = false) { matrix_->modifyCoefficient(row, column, newElement, keepZero); } /** Returns a new matrix in reverse order without gaps */ virtual ClpMatrixBase * reverseOrderedCopy() const; /// Returns number of elements in column part of basis virtual CoinBigIndex countBasis(const int * whichColumn, int & numberColumnBasic); /// Fills in column part of basis virtual void fillBasis(ClpSimplex * model, const int * whichColumn, int & numberColumnBasic, int * row, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * element); /** Creates scales for column copy (rowCopy in model may be modified) returns non-zero if no scaling done */ virtual int scale(ClpModel * model, const ClpSimplex * baseModel = NULL) const ; /** Scales rowCopy if column copy scaled Only called if scales already exist */ virtual void scaleRowCopy(ClpModel * model) const ; /// Creates scaled column copy if scales exist void createScaledMatrix(ClpSimplex * model) const; /** Realy really scales column copy Only called if scales already exist. Up to user ro delete */ virtual ClpMatrixBase * scaledColumnCopy(ClpModel * model) const ; /** Checks if all elements are in valid range. Can just return true if you are not paranoid. For Clp I will probably expect no zeros. Code can modify matrix to get rid of small elements. check bits (can be turned off to save time) : 1 - check if matrix has gaps 2 - check if zero elements 4 - check and compress duplicates 8 - report on large and small */ virtual bool allElementsInRange(ClpModel * model, double smallest, double largest, int check = 15); /** Returns largest and smallest elements of both signs. Largest refers to largest absolute value. */ virtual void rangeOfElements(double & smallestNegative, double & largestNegative, double & smallestPositive, double & largestPositive); /** Unpacks a column into an CoinIndexedvector */ virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray, int column) const ; /** Unpacks a column into an CoinIndexedvector ** in packed foramt Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ virtual void unpackPacked(ClpSimplex * model, CoinIndexedVector * rowArray, int column) const; /** Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray, int column, double multiplier) const ; /** Adds multiple of a column into an array */ virtual void add(const ClpSimplex * model, double * array, int column, double multiplier) const; /// Allow any parts of a created CoinPackedMatrix to be deleted virtual void releasePackedMatrix() const { } /** Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector */ virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const; /// Says whether it can do partial pricing virtual bool canDoPartialPricing() const; /// Partial pricing virtual void partialPricing(ClpSimplex * model, double start, double end, int & bestSequence, int & numberWanted); /// makes sure active columns correct virtual int refresh(ClpSimplex * model); // Really scale matrix virtual void reallyScale(const double * rowScale, const double * columnScale); /** Set the dimensions of the matrix. In effect, append new empty columns/rows to the matrix. A negative number for either dimension means that that dimension doesn't change. Otherwise the new dimensions MUST be at least as large as the current ones otherwise an exception is thrown. */ virtual void setDimensions(int numrows, int numcols); //@} /**@name Matrix times vector methods */ //@{ /** Return y + A * scalar *x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ virtual void times(double scalar, const double * x, double * y) const; /// And for scaling virtual void times(double scalar, const double * x, double * y, const double * rowScale, const double * columnScale) const; /** Return y + x * scalar * A in y. @pre x must be of size numRows() @pre y must be of size numColumns() */ virtual void transposeTimes(double scalar, const double * x, double * y) const; /// And for scaling virtual void transposeTimes(double scalar, const double * x, double * y, const double * rowScale, const double * columnScale, double * spare = NULL) const; /** Return y - pi * A in y. @pre pi must be of size numRows() @pre y must be of size numColumns() This just does subset (but puts in correct place in y) */ void transposeTimesSubset( int number, const int * which, const double * pi, double * y, const double * rowScale, const double * columnScale, double * spare = NULL) const; /** Return x * scalar * A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex */ virtual void transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x * scalar * A + y in z. Note - If x packed mode - then z packed mode This does by column and knows no gaps Squashes small elements and knows about ClpSimplex */ void transposeTimesByColumn(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x * scalar * A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex. This version uses row copy*/ virtual void transposeTimesByRow(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x *A in z but just for indices in y. Note - z always packed mode */ virtual void subsetTransposeTimes(const ClpSimplex * model, const CoinIndexedVector * x, const CoinIndexedVector * y, CoinIndexedVector * z) const; /** Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster */ virtual bool canCombine(const ClpSimplex * model, const CoinIndexedVector * pi) const; /// Updates two arrays for steepest virtual void transposeTimes2(const ClpSimplex * model, const CoinIndexedVector * pi1, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * spare, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor); /// Updates second array for steepest and does devex weights virtual void subsetTimes2(const ClpSimplex * model, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * dj2, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor); /// Sets up an effective RHS void useEffectiveRhs(ClpSimplex * model); #if COIN_LONG_WORK // For long double versions virtual void times(CoinWorkDouble scalar, const CoinWorkDouble * x, CoinWorkDouble * y) const ; virtual void transposeTimes(CoinWorkDouble scalar, const CoinWorkDouble * x, CoinWorkDouble * y) const ; #endif //@} /**@name Other */ //@{ /// Returns CoinPackedMatrix (non const) inline CoinPackedMatrix * matrix() const { return matrix_; } /** Just sets matrix_ to NULL so it can be used elsewhere. used in GUB */ inline void setMatrixNull() { matrix_ = NULL; } /// Say we want special column copy inline void makeSpecialColumnCopy() { flags_ |= 16; } /// Say we don't want special column copy void releaseSpecialColumnCopy(); /// Are there zeros? inline bool zeros() const { return ((flags_ & 1) != 0); } /// Do we want special column copy inline bool wantsSpecialColumnCopy() const { return ((flags_ & 16) != 0); } /// Flags inline int flags() const { return flags_; } /// Sets flags_ correctly inline void checkGaps() { flags_ = (matrix_->hasGaps()) ? (flags_ | 2) : (flags_ & (~2)); } /// number of active columns (normally same as number of columns) inline int numberActiveColumns() const { return numberActiveColumns_;} /// Set number of active columns (normally same as number of columns) inline void setNumberActiveColumns(int value) { numberActiveColumns_ = value;} //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpPackedMatrix(); /** Destructor */ virtual ~ClpPackedMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpPackedMatrix(const ClpPackedMatrix&); /** The copy constructor from an CoinPackedMatrix. */ ClpPackedMatrix(const CoinPackedMatrix&); /** Subset constructor (without gaps). Duplicates are allowed and order is as given */ ClpPackedMatrix (const ClpPackedMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); ClpPackedMatrix (const CoinPackedMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); /** This takes over ownership (for space reasons) */ ClpPackedMatrix(CoinPackedMatrix * matrix); ClpPackedMatrix& operator=(const ClpPackedMatrix&); /// Clone virtual ClpMatrixBase * clone() const ; /// Copy contents - resizing if necessary - otherwise re-use memory virtual void copy(const ClpPackedMatrix * from); /** Subset clone (without gaps). Duplicates are allowed and order is as given */ virtual ClpMatrixBase * subsetClone ( int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const ; /// make special row copy void specialRowCopy(ClpSimplex * model, const ClpMatrixBase * rowCopy); /// make special column copy void specialColumnCopy(ClpSimplex * model); /// Correct sequence in and out to give true value virtual void correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) ; //@} private: /// Meat of transposeTimes by column when not scaled int gutsOfTransposeTimesUnscaled(const double * COIN_RESTRICT pi, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const double tolerance) const; /// Meat of transposeTimes by column when scaled int gutsOfTransposeTimesScaled(const double * COIN_RESTRICT pi, const double * COIN_RESTRICT columnScale, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const double tolerance) const; /// Meat of transposeTimes by column when not scaled and skipping int gutsOfTransposeTimesUnscaled(const double * COIN_RESTRICT pi, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const unsigned char * status, const double tolerance) const; /** Meat of transposeTimes by column when not scaled and skipping and doing part of dualColumn */ int gutsOfTransposeTimesUnscaled(const double * COIN_RESTRICT pi, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const unsigned char * status, int * COIN_RESTRICT spareIndex, double * COIN_RESTRICT spareArray, const double * COIN_RESTRICT reducedCost, double & upperTheta, double & bestPossible, double acceptablePivot, double dualTolerance, int & numberRemaining, const double zeroTolerance) const; /// Meat of transposeTimes by column when scaled and skipping int gutsOfTransposeTimesScaled(const double * COIN_RESTRICT pi, const double * COIN_RESTRICT columnScale, int * COIN_RESTRICT index, double * COIN_RESTRICT array, const unsigned char * status, const double tolerance) const; /// Meat of transposeTimes by row n > K if packed - returns number nonzero int gutsOfTransposeTimesByRowGEK(const CoinIndexedVector * COIN_RESTRICT piVector, int * COIN_RESTRICT index, double * COIN_RESTRICT output, int numberColumns, const double tolerance, const double scalar) const; /// Meat of transposeTimes by row n > 2 if packed - returns number nonzero int gutsOfTransposeTimesByRowGE3(const CoinIndexedVector * COIN_RESTRICT piVector, int * COIN_RESTRICT index, double * COIN_RESTRICT output, double * COIN_RESTRICT array2, const double tolerance, const double scalar) const; /// Meat of transposeTimes by row n > 2 if packed - returns number nonzero int gutsOfTransposeTimesByRowGE3a(const CoinIndexedVector * COIN_RESTRICT piVector, int * COIN_RESTRICT index, double * COIN_RESTRICT output, int * COIN_RESTRICT lookup, char * COIN_RESTRICT marked, const double tolerance, const double scalar) const; /// Meat of transposeTimes by row n == 2 if packed void gutsOfTransposeTimesByRowEQ2(const CoinIndexedVector * piVector, CoinIndexedVector * output, CoinIndexedVector * spareVector, const double tolerance, const double scalar) const; /// Meat of transposeTimes by row n == 1 if packed void gutsOfTransposeTimesByRowEQ1(const CoinIndexedVector * piVector, CoinIndexedVector * output, const double tolerance, const double scalar) const; /// Gets rid of special copies void clearCopies(); protected: /// Check validity void checkFlags(int type) const; /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Data CoinPackedMatrix * matrix_; /// number of active columns (normally same as number of columns) int numberActiveColumns_; /** Flags - 1 - has zero elements 2 - has gaps 4 - has special row copy 8 - has special column copy 16 - wants special column copy */ mutable int flags_; /// Special row copy ClpPackedMatrix2 * rowCopy_; /// Special column copy ClpPackedMatrix3 * columnCopy_; //@} }; #ifdef THREAD #include typedef struct { double acceptablePivot; const ClpSimplex * model; double * spare; int * spareIndex; double * arrayTemp; int * indexTemp; int * numberInPtr; double * bestPossiblePtr; double * upperThetaPtr; int * posFreePtr; double * freePivotPtr; int * numberOutPtr; const unsigned short * count; const double * pi; const CoinBigIndex * rowStart; const double * element; const unsigned short * column; int offset; int numberInRowArray; int numberLook; } dualColumn0Struct; #endif class ClpPackedMatrix2 { public: /**@name Useful methods */ //@{ /** Return x * -1 * A in z. Note - x packed and z will be packed mode Squashes small elements and knows about ClpSimplex */ void transposeTimes(const ClpSimplex * model, const CoinPackedMatrix * rowCopy, const CoinIndexedVector * x, CoinIndexedVector * spareArray, CoinIndexedVector * z) const; /// Returns true if copy has useful information inline bool usefulInfo() const { return rowStart_ != NULL; } //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpPackedMatrix2(); /** Constructor from copy. */ ClpPackedMatrix2(ClpSimplex * model, const CoinPackedMatrix * rowCopy); /** Destructor */ virtual ~ClpPackedMatrix2(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpPackedMatrix2(const ClpPackedMatrix2&); ClpPackedMatrix2& operator=(const ClpPackedMatrix2&); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Number of blocks int numberBlocks_; /// Number of rows int numberRows_; /// Column offset for each block (plus one at end) int * offset_; /// Counts of elements in each part of row mutable unsigned short * count_; /// Row starts mutable CoinBigIndex * rowStart_; /// columns within block unsigned short * column_; /// work arrays double * work_; #ifdef THREAD pthread_t * threadId_; dualColumn0Struct * info_; #endif //@} }; typedef struct { CoinBigIndex startElements_; // point to data int startIndices_; // point to column_ int numberInBlock_; int numberPrice_; // at beginning int numberElements_; // number elements per column } blockStruct; class ClpPackedMatrix3 { public: /**@name Useful methods */ //@{ /** Return x * -1 * A in z. Note - x packed and z will be packed mode Squashes small elements and knows about ClpSimplex */ void transposeTimes(const ClpSimplex * model, const double * pi, CoinIndexedVector * output) const; /// Updates two arrays for steepest void transposeTimes2(const ClpSimplex * model, const double * pi, CoinIndexedVector * dj1, const double * piWeight, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpPackedMatrix3(); /** Constructor from copy. */ ClpPackedMatrix3(ClpSimplex * model, const CoinPackedMatrix * columnCopy); /** Destructor */ virtual ~ClpPackedMatrix3(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpPackedMatrix3(const ClpPackedMatrix3&); ClpPackedMatrix3& operator=(const ClpPackedMatrix3&); //@} /**@name Sort methods */ //@{ /** Sort blocks */ void sortBlocks(const ClpSimplex * model); /// Swap one variable void swapOne(const ClpSimplex * model, const ClpPackedMatrix * matrix, int iColumn); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Number of blocks int numberBlocks_; /// Number of columns int numberColumns_; /// Column indices and reverse lookup (within block) int * column_; /// Starts for odd/long vectors CoinBigIndex * start_; /// Rows int * row_; /// Elements double * element_; /// Blocks (ordinary start at 0 and go to first block) blockStruct * block_; //@} }; #endif CoinMP-1.8.3/Clp/src/CoinAbcSmallFactorization4.cpp0000644000175000017500000000112612101105055020423 0ustar renerene/* $Id: CoinAbcSmallFactorization4.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcSmallFactorization #define ABC_SMALL 4 #include "CoinAbcBaseFactorization.hpp" // If we are twiddling this one has data #define FACTORS_HERE #include "CoinAbcBaseFactorization4.cpp" #endif CoinMP-1.8.3/Clp/src/AbcWarmStart.cpp0000644000175000017500000001074712101105055015656 0ustar renerene/* $Id: AbcWarmStart.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinUtilsConfig.h" #include #include "AbcWarmStart.hpp" #include "CoinHelperFunctions.hpp" #include #include //############################################################################# void AbcWarmStart::setSize(int ns, int na) { CoinWarmStartBasis::setSize(ns,na); delete [] extraInformation_; extraInformation_=NULL; typeExtraInformation_=0; } void AbcWarmStart::assignBasisStatus(int ns, int na, char*& sStat, char*& aStat) { CoinWarmStartBasis::assignBasisStatus(ns,na,sStat,aStat); delete [] extraInformation_; extraInformation_=NULL; typeExtraInformation_=0; } AbcWarmStart::AbcWarmStart(AbcSimplex * model,int type) : CoinWarmStartBasis(model->numberColumns(),model->numberRows(), #ifdef CLP_WARMSTART reinterpret_cast(model->statusArray()), reinterpret_cast(model->statusArray()+model->numberColumns()) #else reinterpret_cast(model->statusArray()+model->maximumAbcNumberRows()), reinterpret_cast(model->statusArray()) #endif ), typeExtraInformation_(type), lengthExtraInformation_(0), extraInformation_(NULL), model_(model), organizer_(NULL), previousBasis_(NULL), nextBasis_(NULL), stamp_(-1), numberValidRows_(0) { assert (!typeExtraInformation_); } AbcWarmStart::AbcWarmStart(const AbcWarmStart& rhs) : CoinWarmStartBasis(rhs), typeExtraInformation_(rhs.typeExtraInformation_), lengthExtraInformation_(rhs.lengthExtraInformation_), extraInformation_(NULL), model_(rhs.model_), organizer_(rhs.organizer_), previousBasis_(NULL), nextBasis_(NULL), stamp_(-1), numberValidRows_(0) { if (typeExtraInformation_) extraInformation_=CoinCopyOfArray(rhs.extraInformation_,lengthExtraInformation_); } AbcWarmStart& AbcWarmStart::operator=(const AbcWarmStart& rhs) { if (this != &rhs) { CoinWarmStartBasis::operator=(rhs); delete [] extraInformation_; extraInformation_=NULL; typeExtraInformation_ = rhs.typeExtraInformation_; lengthExtraInformation_ = rhs.lengthExtraInformation_; model_ = rhs.model_; organizer_ = rhs.organizer_; previousBasis_ = NULL; nextBasis_ = NULL; stamp_ = -1; numberValidRows_ = 0; if (typeExtraInformation_) extraInformation_=CoinCopyOfArray(rhs.extraInformation_,lengthExtraInformation_); } return *this; } // Resizes void AbcWarmStart::resize (int newNumberRows, int newNumberColumns) { if (newNumberRows==numArtificial_&&newNumberColumns==numStructural_) return; CoinWarmStartBasis::resize(newNumberRows,newNumberColumns); delete [] extraInformation_; extraInformation_=NULL; typeExtraInformation_=0; } /* compressRows takes an ascending list of target indices without duplicates and removes them, compressing the artificialStatus_ array in place. It will fail spectacularly if the indices are not sorted. Use deleteRows if you need to preprocess the target indices to satisfy the conditions. */ void AbcWarmStart::compressRows (int tgtCnt, const int *tgts) { if (!tgtCnt) return; CoinWarmStartBasis::compressRows(tgtCnt,tgts); delete [] extraInformation_; extraInformation_=NULL; typeExtraInformation_=0; } /* deleteRows takes an unordered list of target indices with duplicates and removes them from the basis. The strategy is to preprocesses the list into an ascending list without duplicates, suitable for compressRows. */ void AbcWarmStart::deleteRows (int rawTgtCnt, const int *rawTgts) { if (rawTgtCnt <= 0) return ; CoinWarmStartBasis::deleteRows(rawTgtCnt,rawTgts); delete [] extraInformation_; extraInformation_=NULL; typeExtraInformation_=0; } // Deletes columns void AbcWarmStart::deleteColumns(int number, const int * which) { CoinWarmStartBasis::deleteColumns(number,which); delete [] extraInformation_; extraInformation_=NULL; typeExtraInformation_=0; } AbcWarmStart::AbcWarmStart() : CoinWarmStartBasis(), typeExtraInformation_(0), lengthExtraInformation_(0), extraInformation_(NULL), model_(NULL), organizer_(NULL), previousBasis_(NULL), nextBasis_(NULL), stamp_(-1), numberValidRows_(0) { } AbcWarmStart::~AbcWarmStart() { delete[] extraInformation_; } CoinMP-1.8.3/Clp/src/config.h.in0000644000175000017500000000763712354060244014661 0ustar renerene/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1, 2, 3, or 4 if Aboca should be build. */ #undef CLP_HAS_ABC /* SVN revision number of project */ #undef CLP_SVN_REV /* Version number of project */ #undef CLP_VERSION /* Major Version number of project */ #undef CLP_VERSION_MAJOR /* Minor Version number of project */ #undef CLP_VERSION_MINOR /* Release Version number of project */ #undef CLP_VERSION_RELEASE /* Define to the debug sanity check level (0 is no test) */ #undef COIN_CLP_CHECKLEVEL /* Define to the debug verbosity level (0 is no output) */ #undef COIN_CLP_VERBOSITY /* Define to 1 if the AMD package is available */ #undef COIN_HAS_AMD /* Define to 1 if the ASL package is available */ #undef COIN_HAS_ASL /* If defined, the BLAS Library is available. */ #undef COIN_HAS_BLAS /* Define to 1 if the CHOLMOD package is available */ #undef COIN_HAS_CHOLMOD /* Define to 1 if the CoinUtils package is available */ #undef COIN_HAS_COINUTILS /* Define to 1 if the Glpk package is available */ #undef COIN_HAS_GLPK /* Define to 1 if the Mumps package is available */ #undef COIN_HAS_MUMPS /* Define to 1 if the Netlib package is available */ #undef COIN_HAS_NETLIB /* Define to 1 if the Osi package is available */ #undef COIN_HAS_OSI /* Define to 1 if the OsiTests package is available */ #undef COIN_HAS_OSITESTS /* Define to 1 if readline is available */ #undef COIN_HAS_READLINE /* Define to 1 if the Sample package is available */ #undef COIN_HAS_SAMPLE /* Define to 1 if the WSMP package is available */ #undef COIN_HAS_WSMP /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ #undef F77_DUMMY_MAIN /* Define to a macro mangling the given C identifier (in lower and upper case), which must not contain underscores, for linking with Fortran. */ #undef F77_FUNC /* As F77_FUNC, but for C identifiers containing underscores. */ #undef F77_FUNC_ /* Define if F77 and FC dummy `main' functions are identical. */ #undef FC_DUMMY_MAIN_EQ_F77 /* Define to 1 if you have the header file. */ #undef HAVE_CFLOAT /* Define to 1 if you have the header file. */ #undef HAVE_CIEEEFP /* Define to 1 if you have the header file. */ #undef HAVE_CMATH /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the header file. */ #undef HAVE_IEEEFP_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_READLINE_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION CoinMP-1.8.3/Clp/src/ClpSimplex.cpp0000644000175000017500000202622412551231015015410 0ustar renerene/* $Id: ClpSimplex.cpp 2154 2015-07-14 16:00:13Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). //#undef NDEBUG #include "ClpConfig.h" #include "CoinPragma.hpp" #include #if SLIM_CLP==2 #define SLIM_NOIO #endif #include "CoinHelperFunctions.hpp" #include "CoinFloatEqual.hpp" #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" #include "ClpPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpDualRowSteepest.hpp" #include "ClpPrimalColumnDantzig.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "ClpNonLinearCost.hpp" #include "ClpMessage.hpp" #include "ClpEventHandler.hpp" #include "ClpLinearObjective.hpp" #include "ClpHelperFunctions.hpp" #include "CoinModel.hpp" #include "CoinLpIO.hpp" #include #if CLP_HAS_ABC #include "CoinAbcCommon.hpp" #endif #include #include #include //############################################################################# ClpSimplex::ClpSimplex (bool emptyMessages) : ClpModel(emptyMessages), bestPossibleImprovement_(0.0), zeroTolerance_(1.0e-13), columnPrimalSequence_(-2), rowPrimalSequence_(-2), bestObjectiveValue_(-COIN_DBL_MAX), moreSpecialOptions_(2), baseIteration_(0), primalToleranceToGetOptimal_(-1.0), largeValue_(1.0e15), largestPrimalError_(0.0), largestDualError_(0.0), alphaAccuracy_(-1.0), dualBound_(1.0e10), alpha_(0.0), theta_(0.0), lowerIn_(0.0), valueIn_(0.0), upperIn_(-COIN_DBL_MAX), dualIn_(0.0), lowerOut_(-1), valueOut_(-1), upperOut_(-1), dualOut_(-1), dualTolerance_(1.0e-7), primalTolerance_(1.0e-7), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), infeasibilityCost_(1.0e10), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), acceptablePivot_(1.0e-8), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rowObjectiveWork_(NULL), objectiveWork_(NULL), sequenceIn_(-1), directionIn_(-1), sequenceOut_(-1), directionOut_(-1), pivotRow_(-1), lastGoodIteration_(-100), dj_(NULL), rowReducedCost_(NULL), reducedCostWork_(NULL), solution_(NULL), rowActivityWork_(NULL), columnActivityWork_(NULL), numberDualInfeasibilities_(0), numberDualInfeasibilitiesWithoutFree_(0), numberPrimalInfeasibilities_(100), numberRefinements_(0), pivotVariable_(NULL), factorization_(NULL), savedSolution_(NULL), numberTimesOptimal_(0), disasterArea_(NULL), changeMade_(1), algorithm_(0), forceFactorization_(-1), perturbation_(100), nonLinearCost_(NULL), lastBadIteration_(-999999), lastFlaggedIteration_(-999999), numberFake_(0), numberChanged_(0), progressFlag_(0), firstFree_(-1), numberExtraRows_(0), maximumBasic_(0), dontFactorizePivots_(0), incomingInfeasibility_(1.0), allowedInfeasibility_(10.0), automaticScale_(0), maximumPerturbationSize_(0), perturbationArray_(NULL), baseModel_(NULL) #ifdef ABC_INHERIT ,abcSimplex_(NULL), abcState_(0) #endif { int i; for (i = 0; i < 6; i++) { rowArray_[i] = NULL; columnArray_[i] = NULL; } for (i = 0; i < 4; i++) { spareIntArray_[i] = 0; spareDoubleArray_[i] = 0.0; } saveStatus_ = NULL; // get an empty factorization so we can set tolerances etc getEmptyFactorization(); // Say sparse factorization_->sparseThreshold(1); // say Steepest pricing dualRowPivot_ = new ClpDualRowSteepest(); // say Steepest pricing primalColumnPivot_ = new ClpPrimalColumnSteepest(); solveType_ = 1; // say simplex based life form } // Subproblem constructor ClpSimplex::ClpSimplex ( const ClpModel * rhs, int numberRows, const int * whichRow, int numberColumns, const int * whichColumn, bool dropNames, bool dropIntegers, bool fixOthers) : ClpModel(rhs, numberRows, whichRow, numberColumns, whichColumn, dropNames, dropIntegers), bestPossibleImprovement_(0.0), zeroTolerance_(1.0e-13), columnPrimalSequence_(-2), rowPrimalSequence_(-2), bestObjectiveValue_(-COIN_DBL_MAX), moreSpecialOptions_(2), baseIteration_(0), primalToleranceToGetOptimal_(-1.0), largeValue_(1.0e15), largestPrimalError_(0.0), largestDualError_(0.0), alphaAccuracy_(-1.0), dualBound_(1.0e10), alpha_(0.0), theta_(0.0), lowerIn_(0.0), valueIn_(0.0), upperIn_(-COIN_DBL_MAX), dualIn_(0.0), lowerOut_(-1), valueOut_(-1), upperOut_(-1), dualOut_(-1), dualTolerance_(1.0e-7), primalTolerance_(1.0e-7), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), infeasibilityCost_(1.0e10), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), acceptablePivot_(1.0e-8), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rowObjectiveWork_(NULL), objectiveWork_(NULL), sequenceIn_(-1), directionIn_(-1), sequenceOut_(-1), directionOut_(-1), pivotRow_(-1), lastGoodIteration_(-100), dj_(NULL), rowReducedCost_(NULL), reducedCostWork_(NULL), solution_(NULL), rowActivityWork_(NULL), columnActivityWork_(NULL), numberDualInfeasibilities_(0), numberDualInfeasibilitiesWithoutFree_(0), numberPrimalInfeasibilities_(100), numberRefinements_(0), pivotVariable_(NULL), factorization_(NULL), savedSolution_(NULL), numberTimesOptimal_(0), disasterArea_(NULL), changeMade_(1), algorithm_(0), forceFactorization_(-1), perturbation_(100), nonLinearCost_(NULL), lastBadIteration_(-999999), lastFlaggedIteration_(-999999), numberFake_(0), numberChanged_(0), progressFlag_(0), firstFree_(-1), numberExtraRows_(0), maximumBasic_(0), dontFactorizePivots_(0), incomingInfeasibility_(1.0), allowedInfeasibility_(10.0), automaticScale_(0), maximumPerturbationSize_(0), perturbationArray_(NULL), baseModel_(NULL) #ifdef ABC_INHERIT ,abcSimplex_(NULL), abcState_(0) #endif { int i; for (i = 0; i < 6; i++) { rowArray_[i] = NULL; columnArray_[i] = NULL; } for (i = 0; i < 4; i++) { spareIntArray_[i] = 0; spareDoubleArray_[i] = 0.0; } saveStatus_ = NULL; // get an empty factorization so we can set tolerances etc getEmptyFactorization(); // say Steepest pricing dualRowPivot_ = new ClpDualRowSteepest(); // say Steepest pricing primalColumnPivot_ = new ClpPrimalColumnSteepest(); solveType_ = 1; // say simplex based life form if (fixOthers) { int numberOtherColumns = rhs->numberColumns(); int numberOtherRows = rhs->numberRows(); double * solution = new double [numberOtherColumns]; CoinZeroN(solution, numberOtherColumns); int i; for (i = 0; i < numberColumns; i++) { int iColumn = whichColumn[i]; if (solution[iColumn]) fixOthers = false; // duplicates solution[iColumn] = 1.0; } if (fixOthers) { const double * otherSolution = rhs->primalColumnSolution(); const double * objective = rhs->objective(); double offset = 0.0; for (i = 0; i < numberOtherColumns; i++) { if (solution[i]) { solution[i] = 0.0; // in } else { solution[i] = otherSolution[i]; offset += objective[i] * otherSolution[i]; } } double * rhsModification = new double [numberOtherRows]; CoinZeroN(rhsModification, numberOtherRows); rhs->matrix()->times(solution, rhsModification) ; for ( i = 0; i < numberRows; i++) { int iRow = whichRow[i]; if (rowLower_[i] > -1.0e20) rowLower_[i] -= rhsModification[iRow]; if (rowUpper_[i] < 1.0e20) rowUpper_[i] -= rhsModification[iRow]; } delete [] rhsModification; setObjectiveOffset(rhs->objectiveOffset() - offset); // And set objective value to match setObjectiveValue(rhs->objectiveValue()); } delete [] solution; } } // Subproblem constructor ClpSimplex::ClpSimplex ( const ClpSimplex * rhs, int numberRows, const int * whichRow, int numberColumns, const int * whichColumn, bool dropNames, bool dropIntegers, bool fixOthers) : ClpModel(rhs, numberRows, whichRow, numberColumns, whichColumn, dropNames, dropIntegers), bestPossibleImprovement_(0.0), zeroTolerance_(1.0e-13), columnPrimalSequence_(-2), rowPrimalSequence_(-2), bestObjectiveValue_(-COIN_DBL_MAX), moreSpecialOptions_(2), baseIteration_(0), primalToleranceToGetOptimal_(-1.0), largeValue_(1.0e15), largestPrimalError_(0.0), largestDualError_(0.0), alphaAccuracy_(-1.0), dualBound_(1.0e10), alpha_(0.0), theta_(0.0), lowerIn_(0.0), valueIn_(0.0), upperIn_(-COIN_DBL_MAX), dualIn_(0.0), lowerOut_(-1), valueOut_(-1), upperOut_(-1), dualOut_(-1), dualTolerance_(rhs->dualTolerance_), primalTolerance_(rhs->primalTolerance_), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), infeasibilityCost_(1.0e10), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), acceptablePivot_(1.0e-8), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rowObjectiveWork_(NULL), objectiveWork_(NULL), sequenceIn_(-1), directionIn_(-1), sequenceOut_(-1), directionOut_(-1), pivotRow_(-1), lastGoodIteration_(-100), dj_(NULL), rowReducedCost_(NULL), reducedCostWork_(NULL), solution_(NULL), rowActivityWork_(NULL), columnActivityWork_(NULL), numberDualInfeasibilities_(0), numberDualInfeasibilitiesWithoutFree_(0), numberPrimalInfeasibilities_(100), numberRefinements_(0), pivotVariable_(NULL), factorization_(NULL), savedSolution_(NULL), numberTimesOptimal_(0), disasterArea_(NULL), changeMade_(1), algorithm_(0), forceFactorization_(-1), perturbation_(100), nonLinearCost_(NULL), lastBadIteration_(-999999), lastFlaggedIteration_(-999999), numberFake_(0), numberChanged_(0), progressFlag_(0), firstFree_(-1), numberExtraRows_(0), maximumBasic_(0), dontFactorizePivots_(0), incomingInfeasibility_(1.0), allowedInfeasibility_(10.0), automaticScale_(0), maximumPerturbationSize_(0), perturbationArray_(NULL), baseModel_(NULL) #ifdef ABC_INHERIT ,abcSimplex_(NULL), abcState_(rhs->abcState_) #endif { int i; for (i = 0; i < 6; i++) { rowArray_[i] = NULL; columnArray_[i] = NULL; } for (i = 0; i < 4; i++) { spareIntArray_[i] = 0; spareDoubleArray_[i] = 0.0; } saveStatus_ = NULL; factorization_ = new ClpFactorization(*rhs->factorization_, -numberRows_); //factorization_ = new ClpFactorization(*rhs->factorization_, // rhs->factorization_->goDenseThreshold()); ClpDualRowDantzig * pivot = dynamic_cast< ClpDualRowDantzig*>(rhs->dualRowPivot_); // say Steepest pricing if (!pivot) dualRowPivot_ = new ClpDualRowSteepest(); else dualRowPivot_ = new ClpDualRowDantzig(); // say Steepest pricing primalColumnPivot_ = new ClpPrimalColumnSteepest(); solveType_ = 1; // say simplex based life form if (fixOthers) { int numberOtherColumns = rhs->numberColumns(); int numberOtherRows = rhs->numberRows(); double * solution = new double [numberOtherColumns]; CoinZeroN(solution, numberOtherColumns); int i; for (i = 0; i < numberColumns; i++) { int iColumn = whichColumn[i]; if (solution[iColumn]) fixOthers = false; // duplicates solution[iColumn] = 1.0; } if (fixOthers) { const double * otherSolution = rhs->primalColumnSolution(); const double * objective = rhs->objective(); double offset = 0.0; for (i = 0; i < numberOtherColumns; i++) { if (solution[i]) { solution[i] = 0.0; // in } else { solution[i] = otherSolution[i]; offset += objective[i] * otherSolution[i]; } } double * rhsModification = new double [numberOtherRows]; CoinZeroN(rhsModification, numberOtherRows); rhs->matrix()->times(solution, rhsModification) ; for ( i = 0; i < numberRows; i++) { int iRow = whichRow[i]; if (rowLower_[i] > -1.0e20) rowLower_[i] -= rhsModification[iRow]; if (rowUpper_[i] < 1.0e20) rowUpper_[i] -= rhsModification[iRow]; } delete [] rhsModification; setObjectiveOffset(rhs->objectiveOffset() - offset); // And set objective value to match setObjectiveValue(rhs->objectiveValue()); } delete [] solution; } if (rhs->maximumPerturbationSize_) { maximumPerturbationSize_ = 2 * numberColumns; perturbationArray_ = new double [maximumPerturbationSize_]; for (i = 0; i < numberColumns; i++) { int iColumn = whichColumn[i]; perturbationArray_[2*i] = rhs->perturbationArray_[2*iColumn]; perturbationArray_[2*i+1] = rhs->perturbationArray_[2*iColumn+1]; } } } // Puts solution back small model void ClpSimplex::getbackSolution(const ClpSimplex & smallModel, const int * whichRow, const int * whichColumn) { setSumDualInfeasibilities(smallModel.sumDualInfeasibilities()); setNumberDualInfeasibilities(smallModel.numberDualInfeasibilities()); setSumPrimalInfeasibilities(smallModel.sumPrimalInfeasibilities()); setNumberPrimalInfeasibilities(smallModel.numberPrimalInfeasibilities()); setNumberIterations(smallModel.numberIterations()); setProblemStatus(smallModel.status()); setObjectiveValue(smallModel.objectiveValue()); const double * solution2 = smallModel.primalColumnSolution(); int i; int numberRows2 = smallModel.numberRows(); int numberColumns2 = smallModel.numberColumns(); const double * dj2 = smallModel.dualColumnSolution(); for ( i = 0; i < numberColumns2; i++) { int iColumn = whichColumn[i]; columnActivity_[iColumn] = solution2[i]; reducedCost_[iColumn] = dj2[i]; setStatus(iColumn, smallModel.getStatus(i)); } const double * dual2 = smallModel.dualRowSolution(); memset(dual_, 0, numberRows_ * sizeof(double)); for (i = 0; i < numberRows2; i++) { int iRow = whichRow[i]; setRowStatus(iRow, smallModel.getRowStatus(i)); dual_[iRow] = dual2[i]; } CoinZeroN(rowActivity_, numberRows_); #if 0 if (!problemStatus_) { ClpDisjointCopyN(smallModel.objective(), smallModel.numberColumns_, smallModel.reducedCost_); smallModel.matrix_->transposeTimes(-1.0, smallModel.dual_, smallModel.reducedCost_); for (int i = 0; i < smallModel.numberColumns_; i++) { if (smallModel.getColumnStatus(i) == basic) assert (fabs(smallModel.reducedCost_[i]) < 1.0e-5); } ClpDisjointCopyN(objective(), numberColumns_, reducedCost_); matrix_->transposeTimes(-1.0, dual_, reducedCost_); for (int i = 0; i < numberColumns_; i++) { if (getColumnStatus(i) == basic) assert (fabs(reducedCost_[i]) < 1.0e-5); } } #endif matrix()->times(columnActivity_, rowActivity_) ; } //----------------------------------------------------------------------------- ClpSimplex::~ClpSimplex () { setPersistenceFlag(0); gutsOfDelete(0); delete nonLinearCost_; } //############################################################################# void ClpSimplex::setLargeValue( double value) { if (value > 0.0 && value < COIN_DBL_MAX) largeValue_ = value; } int ClpSimplex::gutsOfSolution ( double * givenDuals, const double * givenPrimals, bool valuesPass) { // if values pass, save values of basic variables double * save = NULL; double oldValue = 0.0; double oldLargestPrimalError=largestPrimalError_; double oldLargestDualError=largestDualError_; if (valuesPass) { assert(algorithm_ > 0); // only primal at present assert(nonLinearCost_); int iRow; checkPrimalSolution( rowActivityWork_, columnActivityWork_); // get correct bounds on all variables nonLinearCost_->checkInfeasibilities(primalTolerance_); oldValue = nonLinearCost_->largestInfeasibility(); save = new double[numberRows_]; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; save[iRow] = solution_[iPivot]; } } // do work computePrimals(rowActivityWork_, columnActivityWork_); // If necessary - override results if (givenPrimals) { CoinMemcpyN(givenPrimals, numberColumns_, columnActivityWork_); memset(rowActivityWork_, 0, numberRows_ * sizeof(double)); times(-1.0, columnActivityWork_, rowActivityWork_); } double objectiveModification = 0.0; if (algorithm_ > 0 && nonLinearCost_ != NULL) { // primal algorithm // get correct bounds on all variables // If 4 bit set - Force outgoing variables to exact bound (primal) if ((specialOptions_ & 4) == 0) nonLinearCost_->checkInfeasibilities(primalTolerance_); else nonLinearCost_->checkInfeasibilities(0.0); objectiveModification += nonLinearCost_->changeInCost(); if (nonLinearCost_->numberInfeasibilities()) if (handler_->detail(CLP_SIMPLEX_NONLINEAR, messages_) < 100) { handler_->message(CLP_SIMPLEX_NONLINEAR, messages_) << nonLinearCost_->changeInCost() << nonLinearCost_->numberInfeasibilities() << CoinMessageEol; } } if (valuesPass) { double badInfeasibility = nonLinearCost_->largestInfeasibility(); #ifdef CLP_DEBUG std::cout << "Largest given infeasibility " << oldValue << " now " << nonLinearCost_->largestInfeasibility() << std::endl; #endif int numberOut = 0; // But may be very large rhs etc double useError = CoinMin(largestPrimalError_, 1.0e5 / maximumAbsElement(solution_, numberRows_ + numberColumns_)); if ((oldValue < incomingInfeasibility_ || badInfeasibility > (CoinMax(10.0 * allowedInfeasibility_, 100.0 * oldValue))) && (badInfeasibility > CoinMax(incomingInfeasibility_, allowedInfeasibility_) || useError > 1.0e-3)) { if (algorithm_>1) { // nonlinear //printf("Original largest infeas %g, now %g, primalError %g\n", // oldValue,nonLinearCost_->largestInfeasibility(), // largestPrimalError_); //printf("going to all slack\n"); allSlackBasis(true); CoinIotaN(pivotVariable_, numberRows_, numberColumns_); return 1; } //printf("Original largest infeas %g, now %g, primalError %g\n", // oldValue,nonLinearCost_->largestInfeasibility(), // largestPrimalError_); // throw out up to 1000 structurals int maxOut = (allowedInfeasibility_==10.0) ? 1000 : 100; int iRow; int * sort = new int[numberRows_]; // first put back solution and store difference for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; double difference = fabs(solution_[iPivot] - save[iRow]); solution_[iPivot] = save[iRow]; save[iRow] = difference; } int numberBasic = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (iPivot < numberColumns_) { // column double difference = save[iRow]; if (difference > 1.0e-4) { sort[numberOut] = iRow; save[numberOut++] = -difference; if (getStatus(iPivot) == basic) numberBasic++; } } } if (!numberBasic) { //printf("no errors on basic - going to all slack - numberOut %d\n",numberOut); #if 0 allSlackBasis(true); CoinIotaN(pivotVariable_, numberRows_, numberColumns_); #else // allow numberOut = 0; #endif } CoinSort_2(save, save + numberOut, sort); numberOut = CoinMin(maxOut, numberOut); for (iRow = 0; iRow < numberOut; iRow++) { int jRow = sort[iRow]; int iColumn = pivotVariable_[jRow]; setColumnStatus(iColumn, superBasic); setRowStatus(jRow, basic); pivotVariable_[jRow] = jRow + numberColumns_; if (fabs(solution_[iColumn]) > 1.0e10) { if (upper_[iColumn] < 0.0) { solution_[iColumn] = upper_[iColumn]; } else if (lower_[iColumn] > 0.0) { solution_[iColumn] = lower_[iColumn]; } else { solution_[iColumn] = 0.0; } } } delete [] sort; } delete [] save; if (numberOut) return numberOut; } if ((moreSpecialOptions_ & 128) != 0 && !numberIterations_) { //printf("trying feas pump\n"); const char * integerType = integerInformation(); assert (integerType); assert (perturbationArray_); CoinZeroN(cost_, numberRows_ + numberColumns_); for (int i = 0; i < numberRows_ - numberRows_; i++) { int iSequence = pivotVariable_[i]; if (iSequence < numberColumns_ && integerType[iSequence]) { double lower = lower_[iSequence]; double upper = upper_[iSequence]; double value = solution_[iSequence]; if (value >= lower - primalTolerance_ && value <= upper + primalTolerance_) { double sign; if (value - lower < upper - value) sign = 1.0; else sign = -1.0; cost_[iSequence] = sign * perturbationArray_[iSequence]; } } } } #if CAN_HAVE_ZERO_OBJ>1 if ((specialOptions_&2097152)==0) { #endif computeDuals(givenDuals); if ((moreSpecialOptions_ & 128) != 0 && !numberIterations_) { const char * integerType = integerInformation(); // Need to do columns and rows to stay dual feasible for (int iSequence = 0; iSequence < numberColumns_; iSequence++) { if (integerType[iSequence] && getStatus(iSequence) != basic) { double djValue = dj_[iSequence]; double change = 0.0; if (getStatus(iSequence) == atLowerBound) change = CoinMax(-djValue, 10.0 * perturbationArray_[iSequence]); else if (getStatus(iSequence) == atUpperBound) change = CoinMin(-djValue, -10.0 * perturbationArray_[iSequence]); cost_[iSequence] = change; dj_[iSequence] += change; } } } // now check solutions //checkPrimalSolution( rowActivityWork_, columnActivityWork_); //checkDualSolution(); checkBothSolutions(); objectiveValue_ += objectiveModification / (objectiveScale_ * rhsScale_); #if CAN_HAVE_ZERO_OBJ>1 } else { checkPrimalSolution( rowActivityWork_, columnActivityWork_); #ifndef COIN_REUSE_RANDOM memset(dj_,0,(numberRows_+numberColumns_)*sizeof(double)); #else for (int iSequence=0;iSequencelogLevel() > 3 || (largestPrimalError_ > 1.0e-2 || largestDualError_ > 1.0e-2)) handler_->message(CLP_SIMPLEX_ACCURACY, messages_) << largestPrimalError_ << largestDualError_ << CoinMessageEol; if (largestPrimalError_ > 1.0e-1 && numberRows_ > 100 && numberIterations_) { // Change factorization tolerance if (factorization_->zeroTolerance() > 1.0e-18) factorization_->zeroTolerance(1.0e-18); } int returnCode=0; bool notChanged=true; if (numberIterations_ && (forceFactorization_ > 2 || forceFactorization_<0 || factorization_->pivotTolerance()<0.9899999999) && (oldLargestDualError||oldLargestPrimalError)) { double useOldDualError=oldLargestDualError; double useDualError=largestDualError_; if (algorithm_>0&&nonLinearCost_&& nonLinearCost_->sumInfeasibilities()) { double factor=CoinMax(1.0,CoinMin(1.0e3,infeasibilityCost_*1.0e-6)); useOldDualError /= factor; useDualError /= factor; } if ((largestPrimalError_>1.0e3&& oldLargestPrimalError*1.0e21.0e3&& useOldDualError*1.0e2pivotTolerance(); double factor=(largestPrimalError_>1.0e10||largestDualError_>1.0e10) ? 2.0 : 1.2; if (pivotTolerance<0.1) factorization_->pivotTolerance(0.1); else if (pivotTolerance<0.98999999) factorization_->pivotTolerance(CoinMin(0.99,pivotTolerance*factor)); notChanged=pivotTolerance==factorization_->pivotTolerance(); #ifdef CLP_USEFUL_PRINTOUT if (pivotTolerance<0.9899999) { printf("Changing pivot tolerance from %g to %g and backtracking\n", pivotTolerance,factorization_->pivotTolerance()); } printf("because old,new primal error %g,%g - dual %g,%g pivot_tol %g\n", oldLargestPrimalError,largestPrimalError_, oldLargestDualError,largestDualError_, pivotTolerance); #endif if (pivotTolerance<0.9899999) { largestPrimalError_=0.0; largestDualError_=0.0; returnCode=1; } } } if (progress_.iterationNumber_[0]>0&& progress_.iterationNumber_[CLP_PROGRESS-1] -progress_.iterationNumber_[0]pivotTolerance()<0.25&¬Changed) { double pivotTolerance = factorization_->pivotTolerance(); factorization_->pivotTolerance(pivotTolerance*1.5); #ifdef CLP_USEFUL_PRINTOUT printf("Changing pivot tolerance from %g to %g - inverting too often\n", pivotTolerance,factorization_->pivotTolerance()); #endif } // Switch off false values pass indicator if (!valuesPass && algorithm_ > 0) firstFree_ = -1; if (handler_->logLevel()==63) printf("end getsolution algorithm %d status %d npinf %d sum,relaxed %g,%g ndinf %d sum,relaxed %g,%g\n", algorithm_,problemStatus_, numberPrimalInfeasibilities_,sumPrimalInfeasibilities_,sumOfRelaxedPrimalInfeasibilities_, numberDualInfeasibilities_,sumDualInfeasibilities_,sumOfRelaxedDualInfeasibilities_); if ((moreSpecialOptions_&8388608)!=0) { if (algorithm_<0) { bool doneFiddling=false; // Optimization may make exact test iffy double testTolerance=minimumPrimalTolerance_+1.0e-15; while (!doneFiddling) { doneFiddling=true; while( !sumOfRelaxedPrimalInfeasibilities_&& primalTolerance_>testTolerance) { // feasible - adjust tolerance double saveTolerance=primalTolerance_; primalTolerance_=CoinMax(0.25*primalTolerance_, minimumPrimalTolerance_); printf("Resetting primal tolerance from %g to %g\n", saveTolerance,primalTolerance_); dblParam_[ClpPrimalTolerance]=primalTolerance_; moreSpecialOptions_ &= ~8388608; // redo with switch off returnCode=gutsOfSolution ( givenDuals,givenPrimals,valuesPass); } if(primalTolerance_>testTolerance) moreSpecialOptions_ |= 8388608; // back on if ((moreSpecialOptions_&8388608)!=0) { assert( numberPrimalInfeasibilities_); // average infeasibility double average=sumPrimalInfeasibilities_/numberPrimalInfeasibilities_; double minimum=COIN_DBL_MAX; double averageTotal=average; bool firstTime=averageInfeasibility_[0]==COIN_DBL_MAX; for (int i=0;i0.1*minimum) { primalTolerance_=0.1*minimum; } primalTolerance_= CoinMax(primalTolerance_,minimumPrimalTolerance_); } if (primalTolerance_!=oldTolerance) { printf("Changing primal tolerance from %g to %g\n", oldTolerance,primalTolerance_); moreSpecialOptions_ &= ~8388608; // redo with switch off returnCode=gutsOfSolution ( givenDuals,givenPrimals,valuesPass); if(primalTolerance_>testTolerance) moreSpecialOptions_ |= 8388608|4194304; if( !sumOfRelaxedPrimalInfeasibilities_) doneFiddling=false; // over done it } } } } } return returnCode; } void ClpSimplex::computePrimals ( const double * rowActivities, const double * columnActivities) { //work space CoinIndexedVector * workSpace = rowArray_[0]; CoinIndexedVector * arrayVector = rowArray_[1]; arrayVector->clear(); CoinIndexedVector * previousVector = rowArray_[2]; previousVector->clear(); // accumulate non basic stuff int iRow; // order is this way for scaling if (columnActivities != columnActivityWork_) ClpDisjointCopyN(columnActivities, numberColumns_, columnActivityWork_); if (rowActivities != rowActivityWork_) ClpDisjointCopyN(rowActivities, numberRows_, rowActivityWork_); double * array = arrayVector->denseVector(); int * index = arrayVector->getIndices(); int number = 0; const double * rhsOffset = matrix_->rhsOffset(this, false, true); if (!rhsOffset) { // Use whole matrix every time to make it easier for ClpMatrixBase // So zero out basic for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; assert (iPivot >= 0); solution_[iPivot] = 0.0; #ifdef CLP_INVESTIGATE assert (getStatus(iPivot) == basic); #endif } // Extended solution before "update" matrix_->primalExpanded(this, 0); times(-1.0, columnActivityWork_, array); for (iRow = 0; iRow < numberRows_; iRow++) { double value = array[iRow] + rowActivityWork_[iRow]; if (value) { array[iRow] = value; index[number++] = iRow; } else { array[iRow] = 0.0; } } } else { // we have an effective rhs lying around // zero out basic (really just for slacks) for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; solution_[iPivot] = 0.0; } for (iRow = 0; iRow < numberRows_; iRow++) { double value = rhsOffset[iRow] + rowActivityWork_[iRow]; if (value) { array[iRow] = value; index[number++] = iRow; } else { array[iRow] = 0.0; } } } arrayVector->setNumElements(number); #ifdef CLP_DEBUG if (numberIterations_ == -3840) { int i; for (i = 0; i < numberRows_ + numberColumns_; i++) printf("%d status %d\n", i, status_[i]); printf("xxxxx1\n"); for (i = 0; i < numberRows_; i++) if (array[i]) printf("%d rhs %g\n", i, array[i]); printf("xxxxx2\n"); for (i = 0; i < numberRows_ + numberColumns_; i++) if (getStatus(i) != basic) printf("%d non basic %g %g %g\n", i, lower_[i], solution_[i], upper_[i]); printf("xxxxx3\n"); } #endif // Ftran adjusted RHS and iterate to improve accuracy double lastError = COIN_DBL_MAX; int iRefine; CoinIndexedVector * thisVector = arrayVector; CoinIndexedVector * lastVector = previousVector; #if 0 static double * xsave=NULL; { double * xx = thisVector->denseVector(); double largest=0.0; int iLargest=-1; for (int i=0;ilargest) { largest=fabs(xx[i]); iLargest=i; } } printf("largest incoming rhs %g on row %d\n",largest,iLargest); } if (numberIterations_<-40722) { double * xx = thisVector->denseVector(); if (xsave) { double * sol = xsave+numberRows_; double largest=0.0; int iLargest=-1; for (int i=0;ilargest) { largest=fabs(xx[i]-xsave[i]); iLargest=i; } } printf("error %g on row %d\n",largest,iLargest); largest=0.0; iLargest=-1; for (int i=0;ilargest) { largest=fabs(solution_[i]-sol[i]); iLargest=i; } } printf("error %g on col %d\n",largest,iLargest); } else { xsave=new double[2*numberRows_+numberColumns_]; } memcpy(xsave,xx,numberRows_*sizeof(double)); memcpy(xsave+numberRows_,solution_,(numberRows_+numberColumns_)*sizeof(double)); } #endif //printf ("ZZ0 n before %d",number); if (number) factorization_->updateColumn(workSpace, thisVector); //printf(" - after %d\n",thisVector->getNumElements()); double * work = workSpace->denseVector(); #ifdef CLP_DEBUG if (numberIterations_ == -3840) { int i; for (i = 0; i < numberRows_; i++) if (array[i]) printf("%d after rhs %g\n", i, array[i]); printf("xxxxx4\n"); } #endif bool goodSolution = true; for (iRefine = 0; iRefine < numberRefinements_ + 1; iRefine++) { int numberIn = thisVector->getNumElements(); int * indexIn = thisVector->getIndices(); double * arrayIn = thisVector->denseVector(); // put solution in correct place if (!rhsOffset) { int j; for (j = 0; j < numberIn; j++) { iRow = indexIn[j]; int iPivot = pivotVariable_[iRow]; solution_[iPivot] = arrayIn[iRow]; //assert (fabs(solution_[iPivot])<1.0e100); } } else { for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; solution_[iPivot] = arrayIn[iRow]; //assert (fabs(solution_[iPivot])<1.0e100); } } // Extended solution after "update" matrix_->primalExpanded(this, 1); // check Ax == b (for all) // signal column generated matrix to just do basic (and gub) unsigned int saveOptions = specialOptions(); setSpecialOptions(16); times(-1.0, columnActivityWork_, work); setSpecialOptions(saveOptions); largestPrimalError_ = 0.0; double multiplier = 131072.0; for (iRow = 0; iRow < numberRows_; iRow++) { double value = work[iRow] + rowActivityWork_[iRow]; work[iRow] = value * multiplier; if (fabs(value) > largestPrimalError_) { largestPrimalError_ = fabs(value); } } if (largestPrimalError_ >= lastError) { // restore CoinIndexedVector * temp = thisVector; thisVector = lastVector; lastVector = temp; goodSolution = false; break; } if (iRefine < numberRefinements_ && largestPrimalError_ > 1.0e-10) { // try and make better // save this CoinIndexedVector * temp = thisVector; thisVector = lastVector; lastVector = temp; int * indexOut = thisVector->getIndices(); int number = 0; array = thisVector->denseVector(); thisVector->clear(); for (iRow = 0; iRow < numberRows_; iRow++) { double value = work[iRow]; if (value) { array[iRow] = value; indexOut[number++] = iRow; work[iRow] = 0.0; } } thisVector->setNumElements(number); lastError = largestPrimalError_; //printf ("ZZ%d n before %d",iRefine+1,number); factorization_->updateColumn(workSpace, thisVector); //printf(" - after %d\n",thisVector->getNumElements()); multiplier = 1.0 / multiplier; double * previous = lastVector->denseVector(); number = 0; for (iRow = 0; iRow < numberRows_; iRow++) { double value = previous[iRow] + multiplier * array[iRow]; if (value) { array[iRow] = value; indexOut[number++] = iRow; } else { array[iRow] = 0.0; } } thisVector->setNumElements(number); } else { break; } } // solution as accurate as we are going to get ClpFillN(work, numberRows_, 0.0); if (!goodSolution) { array = thisVector->denseVector(); // put solution in correct place for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; solution_[iPivot] = array[iRow]; //assert (fabs(solution_[iPivot])<1.0e100); } } arrayVector->clear(); previousVector->clear(); #ifdef CLP_DEBUG if (numberIterations_ == -3840) { exit(77); } #endif } // now dual side void ClpSimplex::computeDuals(double * givenDjs) { #ifndef SLIM_CLP if (objective_->type() == 1 || !objective_->activated()) { #endif // Linear //work space CoinIndexedVector * workSpace = rowArray_[0]; CoinIndexedVector * arrayVector = rowArray_[1]; arrayVector->clear(); CoinIndexedVector * previousVector = rowArray_[2]; previousVector->clear(); int iRow; #ifdef CLP_DEBUG workSpace->checkClear(); #endif double * array = arrayVector->denseVector(); int * index = arrayVector->getIndices(); int number = 0; if (!givenDjs) { for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; double value = cost_[iPivot]; if (value) { array[iRow] = value; index[number++] = iRow; } } } else { // dual values pass - djs may not be zero for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; // make sure zero if done if (!pivoted(iPivot)) givenDjs[iPivot] = 0.0; double value = cost_[iPivot] - givenDjs[iPivot]; if (value) { array[iRow] = value; index[number++] = iRow; } } } arrayVector->setNumElements(number); // Extended duals before "updateTranspose" matrix_->dualExpanded(this, arrayVector, givenDjs, 0); // Btran basic costs and get as accurate as possible double lastError = COIN_DBL_MAX; int iRefine; double * work = workSpace->denseVector(); CoinIndexedVector * thisVector = arrayVector; CoinIndexedVector * lastVector = previousVector; factorization_->updateColumnTranspose(workSpace, thisVector); for (iRefine = 0; iRefine < numberRefinements_ + 1; iRefine++) { // check basic reduced costs zero largestDualError_ = 0.0; if (!numberExtraRows_) { // Just basic int * index2 = workSpace->getIndices(); // use reduced costs for slacks as work array double * work2 = reducedCostWork_ + numberColumns_; int numberStructurals = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (iPivot < numberColumns_) index2[numberStructurals++] = iPivot; } matrix_->listTransposeTimes(this, array, index2, numberStructurals, work2); numberStructurals = 0; if (!givenDjs) { for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; double value; if (iPivot >= numberColumns_) { // slack value = rowObjectiveWork_[iPivot-numberColumns_] + array[iPivot-numberColumns_]; } else { // column value = objectiveWork_[iPivot] - work2[numberStructurals++]; } work[iRow] = value; if (fabs(value) > largestDualError_) { largestDualError_ = fabs(value); } } } else { for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (iPivot >= numberColumns_) { // slack work[iRow] = rowObjectiveWork_[iPivot-numberColumns_] + array[iPivot-numberColumns_] - givenDjs[iPivot]; } else { // column work[iRow] = objectiveWork_[iPivot] - work2[numberStructurals++] - givenDjs[iPivot]; } if (fabs(work[iRow]) > largestDualError_) { largestDualError_ = fabs(work[iRow]); //assert (largestDualError_<1.0e-7); //if (largestDualError_>1.0e-7) //printf("large dual error %g\n",largestDualError_); } } } } else { // extra rows - be more careful #if 1 // would be faster to do just for basic but this reduces code ClpDisjointCopyN(objectiveWork_, numberColumns_, reducedCostWork_); transposeTimes(-1.0, array, reducedCostWork_); #else // Just basic int * index2 = workSpace->getIndices(); int numberStructurals = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (iPivot < numberColumns_) index2[numberStructurals++] = iPivot; } matrix_->listTransposeTimes(this, array, index2, numberStructurals, work); for (iRow = 0; iRow < numberStructurals; iRow++) { int iPivot = index2[iRow]; reducedCostWork_[iPivot] = objectiveWork_[iPivot] - work[iRow]; } #endif // update by duals on sets matrix_->dualExpanded(this, NULL, NULL, 1); if (!givenDjs) { for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; double value; if (iPivot >= numberColumns_) { // slack value = rowObjectiveWork_[iPivot-numberColumns_] + array[iPivot-numberColumns_]; } else { // column value = reducedCostWork_[iPivot]; } work[iRow] = value; if (fabs(value) > largestDualError_) { largestDualError_ = fabs(value); } } } else { for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (iPivot >= numberColumns_) { // slack work[iRow] = rowObjectiveWork_[iPivot-numberColumns_] + array[iPivot-numberColumns_] - givenDjs[iPivot]; } else { // column work[iRow] = reducedCostWork_[iPivot] - givenDjs[iPivot]; } if (fabs(work[iRow]) > largestDualError_) { largestDualError_ = fabs(work[iRow]); //assert (largestDualError_<1.0e-7); //if (largestDualError_>1.0e-7) //printf("large dual error %g\n",largestDualError_); } } } } if (largestDualError_ >= lastError) { // restore CoinIndexedVector * temp = thisVector; thisVector = lastVector; lastVector = temp; break; } if (iRefine < numberRefinements_ && largestDualError_ > 1.0e-10 && !givenDjs) { // try and make better // save this CoinIndexedVector * temp = thisVector; thisVector = lastVector; lastVector = temp; int * indexOut = thisVector->getIndices(); int number = 0; array = thisVector->denseVector(); thisVector->clear(); double multiplier = 131072.0; for (iRow = 0; iRow < numberRows_; iRow++) { double value = multiplier * work[iRow]; if (value) { array[iRow] = value; indexOut[number++] = iRow; work[iRow] = 0.0; } work[iRow] = 0.0; } thisVector->setNumElements(number); lastError = largestDualError_; factorization_->updateColumnTranspose(workSpace, thisVector); multiplier = 1.0 / multiplier; double * previous = lastVector->denseVector(); number = 0; for (iRow = 0; iRow < numberRows_; iRow++) { double value = previous[iRow] + multiplier * array[iRow]; if (value) { array[iRow] = value; indexOut[number++] = iRow; } else { array[iRow] = 0.0; } } thisVector->setNumElements(number); } else { break; } } // now look at dual solution array = thisVector->denseVector(); for (iRow = 0; iRow < numberRows_; iRow++) { // slack double value = array[iRow]; dual_[iRow] = value; value += rowObjectiveWork_[iRow]; rowReducedCost_[iRow] = value; } // can use work if problem scaled (for better cache) ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix_); double * saveRowScale = rowScale_; //double * saveColumnScale = columnScale_; if (scaledMatrix_) { rowScale_ = NULL; clpMatrix = scaledMatrix_; } if (clpMatrix && (clpMatrix->flags() & 2) == 0) { CoinIndexedVector * cVector = columnArray_[0]; int * whichColumn = cVector->getIndices(); assert (!cVector->getNumElements()); int n = 0; for (int i = 0; i < numberColumns_; i++) { if (getColumnStatus(i) != basic) { whichColumn[n++] = i; reducedCostWork_[i] = objectiveWork_[i]; } else { reducedCostWork_[i] = 0.0; } } if (numberRows_ > 4000) clpMatrix->transposeTimesSubset(n, whichColumn, dual_, reducedCostWork_, rowScale_, columnScale_, work); else clpMatrix->transposeTimesSubset(n, whichColumn, dual_, reducedCostWork_, rowScale_, columnScale_, NULL); } else { ClpDisjointCopyN(objectiveWork_, numberColumns_, reducedCostWork_); if (numberRows_ > 4000) matrix_->transposeTimes(-1.0, dual_, reducedCostWork_, rowScale_, columnScale_, work); else matrix_->transposeTimes(-1.0, dual_, reducedCostWork_, rowScale_, columnScale_, NULL); } rowScale_ = saveRowScale; //columnScale_ = saveColumnScale; ClpFillN(work, numberRows_, 0.0); // Extended duals and check dual infeasibility if (!matrix_->skipDualCheck() || algorithm_ < 0 || problemStatus_ != -2) matrix_->dualExpanded(this, NULL, NULL, 2); // If necessary - override results if (givenDjs) { // restore accurate duals CoinMemcpyN(dj_, (numberRows_ + numberColumns_), givenDjs); } arrayVector->clear(); previousVector->clear(); #ifndef SLIM_CLP } else { // Nonlinear objective_->reducedGradient(this, dj_, false); // get dual_ by moving from reduced costs for slacks CoinMemcpyN(dj_ + numberColumns_, numberRows_, dual_); } #endif } /* Given an existing factorization computes and checks primal and dual solutions. Uses input arrays for variables at bounds. Returns feasibility states */ int ClpSimplex::getSolution ( const double * /*rowActivities*/, const double * /*columnActivities*/) { if (!factorization_->status()) { // put in standard form createRim(7 + 8 + 16 + 32, false, -1); if (pivotVariable_[0] < 0) internalFactorize(0); // do work gutsOfSolution ( NULL, NULL); // release extra memory deleteRim(0); } return factorization_->status(); } /* Given an existing factorization computes and checks primal and dual solutions. Uses current problem arrays for bounds. Returns feasibility states */ int ClpSimplex::getSolution ( ) { double * rowActivities = new double[numberRows_]; double * columnActivities = new double[numberColumns_]; ClpDisjointCopyN ( rowActivityWork_, numberRows_ , rowActivities); ClpDisjointCopyN ( columnActivityWork_, numberColumns_ , columnActivities); int status = getSolution( rowActivities, columnActivities); delete [] rowActivities; delete [] columnActivities; return status; } // Factorizes using current basis. This is for external use // Return codes are as from ClpFactorization int ClpSimplex::factorize () { // put in standard form createRim(7 + 8 + 16 + 32, false); // do work int status = internalFactorize(-1); // release extra memory deleteRim(0); return status; } // Clean up status void ClpSimplex::cleanStatus() { int iRow, iColumn; int numberBasic = 0; // make row activities correct memset(rowActivityWork_, 0, numberRows_ * sizeof(double)); times(1.0, columnActivityWork_, rowActivityWork_); if (!status_) createStatus(); for (iRow = 0; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) == basic) numberBasic++; else { setRowStatus(iRow, superBasic); // but put to bound if close if (fabs(rowActivityWork_[iRow] - rowLowerWork_[iRow]) <= primalTolerance_) { rowActivityWork_[iRow] = rowLowerWork_[iRow]; setRowStatus(iRow, atLowerBound); } else if (fabs(rowActivityWork_[iRow] - rowUpperWork_[iRow]) <= primalTolerance_) { rowActivityWork_[iRow] = rowUpperWork_[iRow]; setRowStatus(iRow, atUpperBound); } } } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (getColumnStatus(iColumn) == basic) { if (numberBasic == numberRows_) { // take out of basis setColumnStatus(iColumn, superBasic); // but put to bound if close if (fabs(columnActivityWork_[iColumn] - columnLowerWork_[iColumn]) <= primalTolerance_) { columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; setColumnStatus(iColumn, atLowerBound); } else if (fabs(columnActivityWork_[iColumn] - columnUpperWork_[iColumn]) <= primalTolerance_) { columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } else numberBasic++; } else { setColumnStatus(iColumn, superBasic); // but put to bound if close if (fabs(columnActivityWork_[iColumn] - columnLowerWork_[iColumn]) <= primalTolerance_) { columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; setColumnStatus(iColumn, atLowerBound); } else if (fabs(columnActivityWork_[iColumn] - columnUpperWork_[iColumn]) <= primalTolerance_) { columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } } } /* Factorizes using current basis. solveType - 1 iterating, 0 initial, -1 external - 2 then iterating but can throw out of basis If 10 added then in primal values pass Return codes are as from ClpFactorization unless initial factorization when total number of singularities is returned. Special case is numberRows_+1 -> all slack basis. */ int ClpSimplex::internalFactorize ( int solveType) { int iRow, iColumn; int totalSlacks = numberRows_; if (!status_) createStatus(); bool valuesPass = false; if (solveType >= 10) { valuesPass = true; solveType -= 10; } #ifdef CLP_DEBUG if (solveType > 0) { int numberFreeIn = 0, numberFreeOut = 0; double biggestDj = 0.0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { switch(getColumnStatus(iColumn)) { case basic: if (columnLower_[iColumn] < -largeValue_ && columnUpper_[iColumn] > largeValue_) numberFreeIn++; break; default: if (columnLower_[iColumn] < -largeValue_ && columnUpper_[iColumn] > largeValue_) { numberFreeOut++; biggestDj = CoinMax(fabs(dj_[iColumn]), biggestDj); } break; } } if (numberFreeIn + numberFreeOut) printf("%d in basis, %d out - largest dj %g\n", numberFreeIn, numberFreeOut, biggestDj); } #endif if (solveType <= 0) { // Make sure everything is clean for (iRow = 0; iRow < numberRows_; iRow++) { if(getRowStatus(iRow) == isFixed) { // double check fixed if (rowUpperWork_[iRow] > rowLowerWork_[iRow]) setRowStatus(iRow, atLowerBound); } else if (getRowStatus(iRow) == isFree) { // may not be free after all if (rowLowerWork_[iRow] > -largeValue_ || rowUpperWork_[iRow] < largeValue_) setRowStatus(iRow, superBasic); } } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if(getColumnStatus(iColumn) == isFixed) { // double check fixed if (columnUpperWork_[iColumn] > columnLowerWork_[iColumn]) setColumnStatus(iColumn, atLowerBound); } else if (getColumnStatus(iColumn) == isFree) { // may not be free after all if (columnLowerWork_[iColumn] > -largeValue_ || columnUpperWork_[iColumn] < largeValue_) setColumnStatus(iColumn, superBasic); } } if (!valuesPass) { // not values pass so set to bounds bool allSlack = true; if (status_) { for (iRow = 0; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) != basic) { allSlack = false; break; } } } if (!allSlack) { //#define CLP_INVESTIGATE2 #ifdef CLP_INVESTIGATE3 int numberTotal = numberRows_ + numberColumns_; double * saveSol = valuesPass ? CoinCopyOfArray(solution_, numberTotal) : NULL; #endif // set values from warm start (if sensible) int numberBasic = 0; for (iRow = 0; iRow < numberRows_; iRow++) { switch(getRowStatus(iRow)) { case basic: numberBasic++; break; case atUpperBound: rowActivityWork_[iRow] = rowUpperWork_[iRow]; if (rowActivityWork_[iRow] > largeValue_) { if (rowLowerWork_[iRow] > -largeValue_) { rowActivityWork_[iRow] = rowLowerWork_[iRow]; setRowStatus(iRow, atLowerBound); } else { // say free setRowStatus(iRow, isFree); rowActivityWork_[iRow] = 0.0; } } break; case ClpSimplex::isFixed: case atLowerBound: rowActivityWork_[iRow] = rowLowerWork_[iRow]; if (rowActivityWork_[iRow] < -largeValue_) { if (rowUpperWork_[iRow] < largeValue_) { rowActivityWork_[iRow] = rowUpperWork_[iRow]; setRowStatus(iRow, atUpperBound); } else { // say free setRowStatus(iRow, isFree); rowActivityWork_[iRow] = 0.0; } } break; case isFree: break; // not really free - fall through to superbasic case superBasic: if (rowUpperWork_[iRow] > largeValue_) { if (rowLowerWork_[iRow] > -largeValue_) { rowActivityWork_[iRow] = rowLowerWork_[iRow]; setRowStatus(iRow, atLowerBound); } else { // say free setRowStatus(iRow, isFree); rowActivityWork_[iRow] = 0.0; } } else { if (rowLowerWork_[iRow] > -largeValue_) { // set to nearest if (fabs(rowActivityWork_[iRow] - rowLowerWork_[iRow]) < fabs(rowActivityWork_[iRow] - rowLowerWork_[iRow])) { rowActivityWork_[iRow] = rowLowerWork_[iRow]; setRowStatus(iRow, atLowerBound); } else { rowActivityWork_[iRow] = rowUpperWork_[iRow]; setRowStatus(iRow, atUpperBound); } } else { rowActivityWork_[iRow] = rowUpperWork_[iRow]; setRowStatus(iRow, atUpperBound); } } break; } } totalSlacks = numberBasic; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { switch(getColumnStatus(iColumn)) { case basic: if (numberBasic == maximumBasic_) { // take out of basis if (columnLowerWork_[iColumn] > -largeValue_) { if (columnActivityWork_[iColumn] - columnLowerWork_[iColumn] < columnUpperWork_[iColumn] - columnActivityWork_[iColumn]) { columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; setColumnStatus(iColumn, atLowerBound); } else { columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } else if (columnUpperWork_[iColumn] < largeValue_) { columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; setColumnStatus(iColumn, atUpperBound); } else { columnActivityWork_[iColumn] = 0.0; setColumnStatus(iColumn, isFree); } } else { numberBasic++; } break; case atUpperBound: columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; if (columnActivityWork_[iColumn] > largeValue_) { if (columnLowerWork_[iColumn] < -largeValue_) { columnActivityWork_[iColumn] = 0.0; setColumnStatus(iColumn, isFree); } else { columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; setColumnStatus(iColumn, atLowerBound); } } break; case isFixed: case atLowerBound: columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; if (columnActivityWork_[iColumn] < -largeValue_) { if (columnUpperWork_[iColumn] > largeValue_) { columnActivityWork_[iColumn] = 0.0; setColumnStatus(iColumn, isFree); } else { columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } break; case isFree: break; // not really free - fall through to superbasic case superBasic: if (columnUpperWork_[iColumn] > largeValue_) { if (columnLowerWork_[iColumn] > -largeValue_) { columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; setColumnStatus(iColumn, atLowerBound); } else { // say free setColumnStatus(iColumn, isFree); columnActivityWork_[iColumn] = 0.0; } } else { if (columnLowerWork_[iColumn] > -largeValue_) { // set to nearest if (fabs(columnActivityWork_[iColumn] - columnLowerWork_[iColumn]) < fabs(columnActivityWork_[iColumn] - columnLowerWork_[iColumn])) { columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; setColumnStatus(iColumn, atLowerBound); } else { columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } else { columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } break; } } #ifdef CLP_INVESTIGATE3 if (saveSol) { int numberChanged = 0; double largestChanged = 0.0; for (int i = 0; i < numberTotal; i++) { double difference = fabs(solution_[i] - saveSol[i]); if (difference > 1.0e-7) { numberChanged++; if (difference > largestChanged) largestChanged = difference; } } if (numberChanged) printf("%d changed, largest %g\n", numberChanged, largestChanged); delete [] saveSol; } #endif #if 0 if (numberBasic < numberRows_) { // add some slacks in case odd warmstart #ifdef CLP_INVESTIGATE printf("BAD %d basic, %d rows %d slacks\n", numberBasic, numberRows_, totalSlacks); #endif int iRow = numberRows_ - 1; while (numberBasic < numberRows_) { if (getRowStatus(iRow) != basic) { setRowStatus(iRow, basic); numberBasic++; totalSlacks++; iRow--; } else { break; } } } #endif } else { // all slack basis int numberBasic = 0; if (!status_) { createStatus(); } for (iRow = 0; iRow < numberRows_; iRow++) { double lower = rowLowerWork_[iRow]; double upper = rowUpperWork_[iRow]; if (lower > -largeValue_ || upper < largeValue_) { if (fabs(lower) <= fabs(upper)) { rowActivityWork_[iRow] = lower; } else { rowActivityWork_[iRow] = upper; } } else { rowActivityWork_[iRow] = 0.0; } setRowStatus(iRow, basic); numberBasic++; } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double lower = columnLowerWork_[iColumn]; double upper = columnUpperWork_[iColumn]; double big_bound = largeValue_; if (lower > -big_bound || upper < big_bound) { if ((getColumnStatus(iColumn) == atLowerBound && columnActivityWork_[iColumn] == lower) || (getColumnStatus(iColumn) == atUpperBound && columnActivityWork_[iColumn] == upper)) { // status looks plausible } else { // set to sensible if (fabs(lower) <= fabs(upper)) { setColumnStatus(iColumn, atLowerBound); columnActivityWork_[iColumn] = lower; } else { setColumnStatus(iColumn, atUpperBound); columnActivityWork_[iColumn] = upper; } } } else { setColumnStatus(iColumn, isFree); columnActivityWork_[iColumn] = 0.0; } } } } else { // values pass has less coding // make row activities correct and clean basis a bit cleanStatus(); if (status_) { int numberBasic = 0; for (iRow = 0; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) == basic) numberBasic++; } totalSlacks = numberBasic; #if 0 for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (getColumnStatus(iColumn) == basic) numberBasic++; } #endif } else { // all slack basis int numberBasic = 0; if (!status_) { createStatus(); } for (iRow = 0; iRow < numberRows_; iRow++) { setRowStatus(iRow, basic); numberBasic++; } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { setColumnStatus(iColumn, superBasic); // but put to bound if close if (fabs(columnActivityWork_[iColumn] - columnLowerWork_[iColumn]) <= primalTolerance_) { columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; setColumnStatus(iColumn, atLowerBound); } else if (fabs(columnActivityWork_[iColumn] - columnUpperWork_[iColumn]) <= primalTolerance_) { columnActivityWork_[iColumn] = columnUpperWork_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } } } numberRefinements_ = 1; // set fixed if they are for (iRow = 0; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) != basic ) { if (rowLowerWork_[iRow] == rowUpperWork_[iRow]) { rowActivityWork_[iRow] = rowLowerWork_[iRow]; setRowStatus(iRow, isFixed); } } } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (getColumnStatus(iColumn) != basic ) { if (columnLowerWork_[iColumn] == columnUpperWork_[iColumn]) { columnActivityWork_[iColumn] = columnLowerWork_[iColumn]; setColumnStatus(iColumn, isFixed); } } } } //for (iRow=0;iRow1.0e10) { // printf("large %g at %d - status %d\n", // solution_[iRow],iRow,status_[iRow]); //} //} # if 0 //ndef _MSC_VER // The local static var k is a problem when trying to build a DLL. Since this is // just for debugging (likely done on *nix), just hide it from Windows // -- lh, 101016 -- if (0) { static int k = 0; printf("start basis\n"); int i; for (i = 0; i < numberRows_; i++) printf ("xx %d %d\n", i, pivotVariable_[i]); for (i = 0; i < numberRows_ + numberColumns_; i++) if (getColumnStatus(i) == basic) printf ("yy %d basic\n", i); if (k > 20) exit(0); k++; } # endif #if 0 //ndef NDEBUG // Make sure everything is clean double sumOutside=0.0; int numberOutside=0; //double sumOutsideLarge=0.0; int numberOutsideLarge=0; double sumInside=0.0; int numberInside=0; //double sumInsideLarge=0.0; int numberInsideLarge=0; int numberTotal=numberRows_+numberColumns_; for (int iSequence = 0; iSequence < numberTotal; iSequence++) { if(getStatus(iSequence) == isFixed) { // double check fixed assert (upper_[iSequence] == lower_[iSequence]); assert (fabs(solution_[iSequence]-lower_[iSequence])lower_[iSequence]) { numberInside++; sumInside+=solution_[iSequence]-lower_[iSequence]; if (solution_[iSequence]>lower_[iSequence]+primalTolerance_) numberInsideLarge++; } } else if (getStatus(iSequence) == atUpperBound) { assert (fabs(solution_[iSequence]-upper_[iSequence])<1000.0*primalTolerance_); if (solution_[iSequence]>upper_[iSequence]) { numberOutside++; sumOutside+=solution_[iSequence]-upper_[iSequence]; if (solution_[iSequence]>upper_[iSequence]+primalTolerance_) numberOutsideLarge++; } else if (solution_[iSequence]factorize(this, solveType, valuesPass); if (status) { handler_->message(CLP_SIMPLEX_BADFACTOR, messages_) << status << CoinMessageEol; #ifdef CLP_USEFUL_PRINTOUT printf("Basis singular - pivot tolerance %g\n", factorization_->pivotTolerance()); #endif return -1; } else if (!solveType) { // Initial basis - return number of singularities int numberSlacks = 0; for (iRow = 0; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) == basic) numberSlacks++; } status = CoinMax(numberSlacks - totalSlacks, 0); // special case if all slack if (numberSlacks == numberRows_) { status = numberRows_ + 1; } } // sparse methods //if (factorization_->sparseThreshold()) { // get default value factorization_->sparseThreshold(0); if (!(moreSpecialOptions_&1024)) factorization_->goSparse(); //} return status; } /* This does basis housekeeping and does values for in/out variables. Can also decide to re-factorize */ int ClpSimplex::housekeeping(double objectiveChange) { // save value of incoming and outgoing double oldIn = solution_[sequenceIn_]; double oldOut = solution_[sequenceOut_]; numberIterations_++; changeMade_++; // something has happened // incoming variable if (handler_->logLevel() > 7) { //if (handler_->detail(CLP_SIMPLEX_HOUSE1,messages_)<100) { handler_->message(CLP_SIMPLEX_HOUSE1, messages_) << directionOut_ << directionIn_ << theta_ << dualOut_ << dualIn_ << alpha_ << CoinMessageEol; if (getStatus(sequenceIn_) == isFree) { handler_->message(CLP_SIMPLEX_FREEIN, messages_) << sequenceIn_ << CoinMessageEol; } } #if 0 printf("h1 %d %d %g %g %g %g", directionOut_ , directionIn_, theta_ , dualOut_, dualIn_, alpha_); #endif // change of incoming char rowcol[] = {'R', 'C'}; if (pivotRow_ >= 0) pivotVariable_[pivotRow_] = sequenceIn(); if (upper_[sequenceIn_] > 1.0e20 && lower_[sequenceIn_] < -1.0e20) progressFlag_ |= 2; // making real progress solution_[sequenceIn_] = valueIn_; if (upper_[sequenceOut_] - lower_[sequenceOut_] < 1.0e-12) progressFlag_ |= 1; // making real progress if (sequenceIn_ != sequenceOut_) { if (alphaAccuracy_ > 0.0) { double value = fabs(alpha_); if (value > 1.0) alphaAccuracy_ *= value; else alphaAccuracy_ /= value; } //assert( getStatus(sequenceOut_)== basic); setStatus(sequenceIn_, basic); if (upper_[sequenceOut_] - lower_[sequenceOut_] > 0) { // As Nonlinear costs may have moved bounds (to more feasible) // Redo using value if (fabs(valueOut_ - lower_[sequenceOut_]) < fabs(valueOut_ - upper_[sequenceOut_])) { // going to lower setStatus(sequenceOut_, atLowerBound); oldOut = lower_[sequenceOut_]; } else { // going to upper setStatus(sequenceOut_, atUpperBound); oldOut = upper_[sequenceOut_]; } } else { // fixed setStatus(sequenceOut_, isFixed); } solution_[sequenceOut_] = valueOut_; } else { //if (objective_->type()<2) //assert (fabs(theta_)>1.0e-13); // flip from bound to bound // As Nonlinear costs may have moved bounds (to more feasible) // Redo using value if (fabs(valueIn_ - lower_[sequenceIn_]) < fabs(valueIn_ - upper_[sequenceIn_])) { // as if from upper bound setStatus(sequenceIn_, atLowerBound); } else { // as if from lower bound setStatus(sequenceIn_, atUpperBound); } } // Update hidden stuff e.g. effective RHS and gub int invertNow=matrix_->updatePivot(this, oldIn, oldOut); objectiveValue_ += objectiveChange / (objectiveScale_ * rhsScale_); if (handler_->logLevel() > 7) { //if (handler_->detail(CLP_SIMPLEX_HOUSE2,messages_)<100) { handler_->message(CLP_SIMPLEX_HOUSE2, messages_) << numberIterations_ << objectiveValue() << rowcol[isColumn(sequenceIn_)] << sequenceWithin(sequenceIn_) << rowcol[isColumn(sequenceOut_)] << sequenceWithin(sequenceOut_); handler_->printing(algorithm_ < 0) << dualOut_ << theta_; handler_->printing(algorithm_ > 0) << dualIn_ << theta_; handler_->message() << CoinMessageEol; } #if 0 if (numberIterations_ > 10000) printf(" it %d %g %c%d %c%d\n" , numberIterations_, objectiveValue() , rowcol[isColumn(sequenceIn_)], sequenceWithin(sequenceIn_) , rowcol[isColumn(sequenceOut_)], sequenceWithin(sequenceOut_)); #endif if (trustedUserPointer_ && trustedUserPointer_->typeStruct == 1) { if (algorithm_ > 0 && integerType_ && !nonLinearCost_->numberInfeasibilities()) { if (fabs(theta_) > 1.0e-6 || !numberIterations_) { // For saving solutions typedef struct { int numberSolutions; int maximumSolutions; int numberColumns; double ** solution; int * numberUnsatisfied; } clpSolution; clpSolution * solution = reinterpret_cast (trustedUserPointer_->data); if (solution->numberSolutions == solution->maximumSolutions) { int n = solution->maximumSolutions; int n2 = (n * 3) / 2 + 10; solution->maximumSolutions = n2; double ** temp = new double * [n2]; for (int i = 0; i < n; i++) temp[i] = solution->solution[i]; delete [] solution->solution; solution->solution = temp; int * tempN = new int [n2]; for (int i = 0; i < n; i++) tempN[i] = solution->numberUnsatisfied[i]; delete [] solution->numberUnsatisfied; solution->numberUnsatisfied = tempN; } assert (numberColumns_ == solution->numberColumns); double * sol = new double [numberColumns_]; solution->solution[solution->numberSolutions] = sol; int numberFixed = 0; int numberUnsat = 0; int numberSat = 0; double sumUnsat = 0.0; double tolerance = 10.0 * primalTolerance_; double mostAway = 0.0; for (int i = 0; i < numberColumns_; i++) { // Save anyway sol[i] = columnScale_ ? solution_[i] * columnScale_[i] : solution_[i]; // rest is optional if (upper_[i] > lower_[i]) { double value = solution_[i]; if (value > lower_[i] + tolerance && value < upper_[i] - tolerance && integerType_[i]) { // may have to modify value if scaled if (columnScale_) value *= columnScale_[i]; double closest = floor(value + 0.5); // problem may be perturbed so relax test if (fabs(value - closest) > 1.0e-4) { numberUnsat++; sumUnsat += fabs(value - closest); if (mostAway < fabs(value - closest)) { mostAway = fabs(value - closest); } } else { numberSat++; } } else { numberSat++; } } else { numberFixed++; } } solution->numberUnsatisfied[solution->numberSolutions++] = numberUnsat; COIN_DETAIL_PRINT(printf("iteration %d, %d unsatisfied (%g,%g), %d fixed, %d satisfied\n", numberIterations_, numberUnsat, sumUnsat, mostAway, numberFixed, numberSat)); } } } if (hitMaximumIterations()) return 2; #if 1 //if (numberIterations_>14000) //handler_->setLogLevel(63); //if (numberIterations_>24000) //exit(77); // check for small cycles int in = sequenceIn_; int out = sequenceOut_; matrix_->correctSequence(this, in, out); int cycle = progress_.cycle(in, out, directionIn_, directionOut_); if (cycle > 0 && objective_->type() < 2 && matrix_->type() < 15) { //if (cycle>0) { if (handler_->logLevel() >= 63) printf("Cycle of %d\n", cycle); // reset progress_.startCheck(); double random = randomNumberGenerator_.randomDouble(); int extra = static_cast (9.999 * random); int off[] = {1, 1, 1, 1, 2, 2, 2, 3, 3, 4}; if (factorization_->pivots() > cycle) { forceFactorization_ = CoinMax(1, cycle - off[extra]); } else { /* need to reject something should be better if don't reject incoming as it is in basis */ int iSequence; //if (algorithm_ > 0) // iSequence = sequenceIn_; //else iSequence = sequenceOut_; char x = isColumn(iSequence) ? 'C' : 'R'; if (handler_->logLevel() >= 63) handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(iSequence) << CoinMessageEol; setFlagged(iSequence); //printf("flagging %d\n",iSequence); } return 1; } #endif // only time to re-factorize if one before real time // this is so user won't be surprised that maximumPivots has exact meaning int numberPivots = factorization_->pivots(); int maximumPivots = factorization_->maximumPivots(); int numberDense = factorization_->numberDense(); bool dontInvert = ((specialOptions_ & 16384) != 0 && numberIterations_ * 3 > 2 * maximumIterations()); if (numberPivots == maximumPivots || maximumPivots < 2) { // If dense then increase if (maximumPivots > 100 && numberDense > 1.5 * maximumPivots && false) { factorization_->maximumPivots(numberDense); dualRowPivot_->maximumPivotsChanged(); primalColumnPivot_->maximumPivotsChanged(); // and redo arrays for (int iRow = 0; iRow < 4; iRow++) { int length = rowArray_[iRow]->capacity() + numberDense - maximumPivots; rowArray_[iRow]->reserve(length); } } #if CLP_FACTORIZATION_NEW_TIMING>1 factorization_->statsRefactor('M'); #endif return 1; } else if ((factorization_->timeToRefactorize() && !dontInvert) ||invertNow) { //printf("ret after %d pivots\n",factorization_->pivots()); #if CLP_FACTORIZATION_NEW_TIMING>1 factorization_->statsRefactor('T'); #endif return 1; } else if (forceFactorization_ > 0 && factorization_->pivots() == forceFactorization_) { // relax forceFactorization_ = (3 + 5 * forceFactorization_) / 4; if (forceFactorization_ > factorization_->maximumPivots()) forceFactorization_ = -1; //off #if CLP_FACTORIZATION_NEW_TIMING>1 factorization_->statsRefactor('F'); #endif return 1; } else if (numberIterations_ > 1000 + 10 * (numberRows_ + (numberColumns_ >> 2)) && matrix_->type()<15) { double random = randomNumberGenerator_.randomDouble(); while (random<0.45) random *= 2.0; int maxNumber = (forceFactorization_ < 0) ? maximumPivots : CoinMin(forceFactorization_, maximumPivots); if (factorization_->pivots() >= random * maxNumber) { return 1; } else if (numberIterations_ > 1000000 + 10 * (numberRows_ + (numberColumns_ >> 2)) && numberIterations_ < 1001000 + 10 * (numberRows_ + (numberColumns_ >> 2))) { return 1; } else { // carry on iterating return 0; } } else { // carry on iterating return 0; } } // Copy constructor. ClpSimplex::ClpSimplex(const ClpSimplex &rhs, int scalingMode) : ClpModel(rhs, scalingMode), bestPossibleImprovement_(0.0), zeroTolerance_(1.0e-13), columnPrimalSequence_(-2), rowPrimalSequence_(-2), bestObjectiveValue_(rhs.bestObjectiveValue_), moreSpecialOptions_(2), baseIteration_(0), primalToleranceToGetOptimal_(-1.0), largeValue_(1.0e15), largestPrimalError_(0.0), largestDualError_(0.0), alphaAccuracy_(-1.0), dualBound_(1.0e10), alpha_(0.0), theta_(0.0), lowerIn_(0.0), valueIn_(0.0), upperIn_(-COIN_DBL_MAX), dualIn_(0.0), lowerOut_(-1), valueOut_(-1), upperOut_(-1), dualOut_(-1), dualTolerance_(1.0e-7), primalTolerance_(1.0e-7), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), infeasibilityCost_(1.0e10), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), acceptablePivot_(1.0e-8), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rowObjectiveWork_(NULL), objectiveWork_(NULL), sequenceIn_(-1), directionIn_(-1), sequenceOut_(-1), directionOut_(-1), pivotRow_(-1), lastGoodIteration_(-100), dj_(NULL), rowReducedCost_(NULL), reducedCostWork_(NULL), solution_(NULL), rowActivityWork_(NULL), columnActivityWork_(NULL), numberDualInfeasibilities_(0), numberDualInfeasibilitiesWithoutFree_(0), numberPrimalInfeasibilities_(100), numberRefinements_(0), pivotVariable_(NULL), factorization_(NULL), savedSolution_(NULL), numberTimesOptimal_(0), disasterArea_(NULL), changeMade_(1), algorithm_(0), forceFactorization_(-1), perturbation_(100), nonLinearCost_(NULL), lastBadIteration_(-999999), lastFlaggedIteration_(-999999), numberFake_(0), numberChanged_(0), progressFlag_(0), firstFree_(-1), numberExtraRows_(0), maximumBasic_(0), dontFactorizePivots_(0), incomingInfeasibility_(1.0), allowedInfeasibility_(10.0), automaticScale_(0), maximumPerturbationSize_(0), perturbationArray_(NULL), baseModel_(NULL) #ifdef ABC_INHERIT ,abcSimplex_(NULL), abcState_(0) #endif { int i; for (i = 0; i < 6; i++) { rowArray_[i] = NULL; columnArray_[i] = NULL; } for (i = 0; i < 4; i++) { spareIntArray_[i] = 0; spareDoubleArray_[i] = 0.0; } saveStatus_ = NULL; factorization_ = NULL; dualRowPivot_ = NULL; primalColumnPivot_ = NULL; gutsOfDelete(0); delete nonLinearCost_; nonLinearCost_ = NULL; gutsOfCopy(rhs); solveType_ = 1; // say simplex based life form } // Copy constructor from model ClpSimplex::ClpSimplex(const ClpModel &rhs, int scalingMode) : ClpModel(rhs, scalingMode), bestPossibleImprovement_(0.0), zeroTolerance_(1.0e-13), columnPrimalSequence_(-2), rowPrimalSequence_(-2), bestObjectiveValue_(-COIN_DBL_MAX), moreSpecialOptions_(2), baseIteration_(0), primalToleranceToGetOptimal_(-1.0), largeValue_(1.0e15), largestPrimalError_(0.0), largestDualError_(0.0), alphaAccuracy_(-1.0), dualBound_(1.0e10), alpha_(0.0), theta_(0.0), lowerIn_(0.0), valueIn_(0.0), upperIn_(-COIN_DBL_MAX), dualIn_(0.0), lowerOut_(-1), valueOut_(-1), upperOut_(-1), dualOut_(-1), dualTolerance_(1.0e-7), primalTolerance_(1.0e-7), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), infeasibilityCost_(1.0e10), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), acceptablePivot_(1.0e-8), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rowObjectiveWork_(NULL), objectiveWork_(NULL), sequenceIn_(-1), directionIn_(-1), sequenceOut_(-1), directionOut_(-1), pivotRow_(-1), lastGoodIteration_(-100), dj_(NULL), rowReducedCost_(NULL), reducedCostWork_(NULL), solution_(NULL), rowActivityWork_(NULL), columnActivityWork_(NULL), numberDualInfeasibilities_(0), numberDualInfeasibilitiesWithoutFree_(0), numberPrimalInfeasibilities_(100), numberRefinements_(0), pivotVariable_(NULL), factorization_(NULL), savedSolution_(NULL), numberTimesOptimal_(0), disasterArea_(NULL), changeMade_(1), algorithm_(0), forceFactorization_(-1), perturbation_(100), nonLinearCost_(NULL), lastBadIteration_(-999999), lastFlaggedIteration_(-999999), numberFake_(0), numberChanged_(0), progressFlag_(0), firstFree_(-1), numberExtraRows_(0), maximumBasic_(0), dontFactorizePivots_(0), incomingInfeasibility_(1.0), allowedInfeasibility_(10.0), automaticScale_(0), maximumPerturbationSize_(0), perturbationArray_(NULL), baseModel_(NULL) #ifdef ABC_INHERIT ,abcSimplex_(NULL), abcState_(0) #endif { int i; for (i = 0; i < 6; i++) { rowArray_[i] = NULL; columnArray_[i] = NULL; } for (i = 0; i < 4; i++) { spareIntArray_[i] = 0; spareDoubleArray_[i] = 0.0; } saveStatus_ = NULL; // get an empty factorization so we can set tolerances etc getEmptyFactorization(); // say Steepest pricing dualRowPivot_ = new ClpDualRowSteepest(); // say Steepest pricing primalColumnPivot_ = new ClpPrimalColumnSteepest(); solveType_ = 1; // say simplex based life form } // Assignment operator. This copies the data ClpSimplex & ClpSimplex::operator=(const ClpSimplex & rhs) { if (this != &rhs) { gutsOfDelete(0); delete nonLinearCost_; nonLinearCost_ = NULL; ClpModel::operator=(rhs); gutsOfCopy(rhs); } return *this; } void ClpSimplex::gutsOfCopy(const ClpSimplex & rhs) { assert (numberRows_ == rhs.numberRows_); assert (numberColumns_ == rhs.numberColumns_); numberExtraRows_ = rhs.numberExtraRows_; maximumBasic_ = rhs.maximumBasic_; dontFactorizePivots_ = rhs.dontFactorizePivots_; int numberRows2 = numberRows_ + numberExtraRows_; moreSpecialOptions_ = rhs.moreSpecialOptions_; if ((whatsChanged_ & 1) != 0) { int numberTotal = numberColumns_ + numberRows2; if ((specialOptions_ & 65536) != 0 && maximumRows_ >= 0) { assert (maximumInternalRows_ >= numberRows2); assert (maximumInternalColumns_ >= numberColumns_); numberTotal = 2 * (maximumInternalColumns_ + maximumInternalRows_); } lower_ = ClpCopyOfArray(rhs.lower_, numberTotal); rowLowerWork_ = lower_ + numberColumns_; columnLowerWork_ = lower_; upper_ = ClpCopyOfArray(rhs.upper_, numberTotal); rowUpperWork_ = upper_ + numberColumns_; columnUpperWork_ = upper_; cost_ = ClpCopyOfArray(rhs.cost_, numberTotal); objectiveWork_ = cost_; rowObjectiveWork_ = cost_ + numberColumns_; dj_ = ClpCopyOfArray(rhs.dj_, numberTotal); if (dj_) { reducedCostWork_ = dj_; rowReducedCost_ = dj_ + numberColumns_; } solution_ = ClpCopyOfArray(rhs.solution_, numberTotal); if (solution_) { columnActivityWork_ = solution_; rowActivityWork_ = solution_ + numberColumns_; } if (rhs.pivotVariable_) { pivotVariable_ = new int[numberRows2]; CoinMemcpyN ( rhs.pivotVariable_, numberRows2 , pivotVariable_); } else { pivotVariable_ = NULL; } savedSolution_ = ClpCopyOfArray(rhs.savedSolution_, numberTotal); int i; for (i = 0; i < 6; i++) { rowArray_[i] = NULL; if (rhs.rowArray_[i]) rowArray_[i] = new CoinIndexedVector(*rhs.rowArray_[i]); columnArray_[i] = NULL; if (rhs.columnArray_[i]) columnArray_[i] = new CoinIndexedVector(*rhs.columnArray_[i]); } if (rhs.saveStatus_) { saveStatus_ = ClpCopyOfArray( rhs.saveStatus_, numberTotal); } } else { lower_ = NULL; rowLowerWork_ = NULL; columnLowerWork_ = NULL; upper_ = NULL; rowUpperWork_ = NULL; columnUpperWork_ = NULL; cost_ = NULL; objectiveWork_ = NULL; rowObjectiveWork_ = NULL; dj_ = NULL; reducedCostWork_ = NULL; rowReducedCost_ = NULL; solution_ = NULL; columnActivityWork_ = NULL; rowActivityWork_ = NULL; pivotVariable_ = NULL; savedSolution_ = NULL; int i; for (i = 0; i < 6; i++) { rowArray_[i] = NULL; columnArray_[i] = NULL; } saveStatus_ = NULL; } if (rhs.factorization_) { setFactorization(*rhs.factorization_); } else { delete factorization_; factorization_ = NULL; } bestPossibleImprovement_ = rhs.bestPossibleImprovement_; columnPrimalSequence_ = rhs.columnPrimalSequence_; zeroTolerance_ = rhs.zeroTolerance_; rowPrimalSequence_ = rhs.rowPrimalSequence_; bestObjectiveValue_ = rhs.bestObjectiveValue_; baseIteration_ = rhs.baseIteration_; primalToleranceToGetOptimal_ = rhs.primalToleranceToGetOptimal_; largeValue_ = rhs.largeValue_; largestPrimalError_ = rhs.largestPrimalError_; largestDualError_ = rhs.largestDualError_; alphaAccuracy_ = rhs.alphaAccuracy_; dualBound_ = rhs.dualBound_; alpha_ = rhs.alpha_; theta_ = rhs.theta_; lowerIn_ = rhs.lowerIn_; valueIn_ = rhs.valueIn_; upperIn_ = rhs.upperIn_; dualIn_ = rhs.dualIn_; sequenceIn_ = rhs.sequenceIn_; directionIn_ = rhs.directionIn_; lowerOut_ = rhs.lowerOut_; valueOut_ = rhs.valueOut_; upperOut_ = rhs.upperOut_; dualOut_ = rhs.dualOut_; sequenceOut_ = rhs.sequenceOut_; directionOut_ = rhs.directionOut_; pivotRow_ = rhs.pivotRow_; lastGoodIteration_ = rhs.lastGoodIteration_; numberRefinements_ = rhs.numberRefinements_; dualTolerance_ = rhs.dualTolerance_; primalTolerance_ = rhs.primalTolerance_; sumDualInfeasibilities_ = rhs.sumDualInfeasibilities_; numberDualInfeasibilities_ = rhs.numberDualInfeasibilities_; numberDualInfeasibilitiesWithoutFree_ = rhs.numberDualInfeasibilitiesWithoutFree_; sumPrimalInfeasibilities_ = rhs.sumPrimalInfeasibilities_; numberPrimalInfeasibilities_ = rhs.numberPrimalInfeasibilities_; dualRowPivot_ = rhs.dualRowPivot_->clone(true); dualRowPivot_->setModel(this); primalColumnPivot_ = rhs.primalColumnPivot_->clone(true); primalColumnPivot_->setModel(this); numberTimesOptimal_ = rhs.numberTimesOptimal_; disasterArea_ = NULL; changeMade_ = rhs.changeMade_; algorithm_ = rhs.algorithm_; forceFactorization_ = rhs.forceFactorization_; perturbation_ = rhs.perturbation_; infeasibilityCost_ = rhs.infeasibilityCost_; lastBadIteration_ = rhs.lastBadIteration_; lastFlaggedIteration_ = rhs.lastFlaggedIteration_; numberFake_ = rhs.numberFake_; numberChanged_ = rhs.numberChanged_; progressFlag_ = rhs.progressFlag_; firstFree_ = rhs.firstFree_; incomingInfeasibility_ = rhs.incomingInfeasibility_; allowedInfeasibility_ = rhs.allowedInfeasibility_; automaticScale_ = rhs.automaticScale_; #ifdef ABC_INHERIT abcSimplex_ = NULL; abcState_ = rhs.abcState_; #endif maximumPerturbationSize_ = rhs.maximumPerturbationSize_; if (maximumPerturbationSize_ && maximumPerturbationSize_ >= 2 * numberColumns_) { perturbationArray_ = CoinCopyOfArray(rhs.perturbationArray_, maximumPerturbationSize_); } else { maximumPerturbationSize_ = 0; perturbationArray_ = NULL; } if (rhs.baseModel_) { baseModel_ = new ClpSimplex(*rhs.baseModel_); } else { baseModel_ = NULL; } progress_ = rhs.progress_; for (int i = 0; i < 4; i++) { spareIntArray_[i] = rhs.spareIntArray_[i]; spareDoubleArray_[i] = rhs.spareDoubleArray_[i]; } sumOfRelaxedDualInfeasibilities_ = rhs.sumOfRelaxedDualInfeasibilities_; sumOfRelaxedPrimalInfeasibilities_ = rhs.sumOfRelaxedPrimalInfeasibilities_; acceptablePivot_ = rhs.acceptablePivot_; if (rhs.nonLinearCost_ != NULL) nonLinearCost_ = new ClpNonLinearCost(*rhs.nonLinearCost_); else nonLinearCost_ = NULL; solveType_ = rhs.solveType_; eventHandler_->setSimplex(this); } // type == 0 do everything, most + pivot data, 2 factorization data as well void ClpSimplex::gutsOfDelete(int type) { if (!type || (specialOptions_ & 65536) == 0) { maximumInternalColumns_ = -1; maximumInternalRows_ = -1; delete [] lower_; lower_ = NULL; rowLowerWork_ = NULL; columnLowerWork_ = NULL; delete [] upper_; upper_ = NULL; rowUpperWork_ = NULL; columnUpperWork_ = NULL; delete [] cost_; cost_ = NULL; objectiveWork_ = NULL; rowObjectiveWork_ = NULL; delete [] dj_; dj_ = NULL; reducedCostWork_ = NULL; rowReducedCost_ = NULL; delete [] solution_; solution_ = NULL; rowActivityWork_ = NULL; columnActivityWork_ = NULL; delete [] savedSolution_; savedSolution_ = NULL; } if ((specialOptions_ & 2) == 0) { delete nonLinearCost_; nonLinearCost_ = NULL; } int i; if ((specialOptions_ & 65536) == 0) { for (i = 0; i < 6; i++) { delete rowArray_[i]; rowArray_[i] = NULL; delete columnArray_[i]; columnArray_[i] = NULL; } } delete [] saveStatus_; saveStatus_ = NULL; if (type != 1) { delete rowCopy_; rowCopy_ = NULL; } if (!type) { // delete everything setEmptyFactorization(); delete [] pivotVariable_; pivotVariable_ = NULL; delete dualRowPivot_; dualRowPivot_ = NULL; delete primalColumnPivot_; primalColumnPivot_ = NULL; delete baseModel_; baseModel_ = NULL; delete [] perturbationArray_; perturbationArray_ = NULL; maximumPerturbationSize_ = 0; } else { // delete any size information in methods if (type > 1) { //assert (factorization_); if (factorization_) factorization_->clearArrays(); delete [] pivotVariable_; pivotVariable_ = NULL; } dualRowPivot_->clearArrays(); primalColumnPivot_->clearArrays(); } } // This sets largest infeasibility and most infeasible void ClpSimplex::checkPrimalSolution(const double * rowActivities, const double * columnActivities) { double * solution; int iRow, iColumn; objectiveValue_ = 0.0; // now look at primal solution solution = rowActivityWork_; sumPrimalInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; double primalTolerance = primalTolerance_; double relaxedTolerance = primalTolerance_; // we can't really trust infeasibilities if there is primal error double error = CoinMin(1.0e-2, largestPrimalError_); // allow tolerance at least slightly bigger than standard relaxedTolerance = relaxedTolerance + error; sumOfRelaxedPrimalInfeasibilities_ = 0.0; for (iRow = 0; iRow < numberRows_; iRow++) { //assert (fabs(solution[iRow])<1.0e15||getRowStatus(iRow) == basic); double infeasibility = 0.0; objectiveValue_ += solution[iRow] * rowObjectiveWork_[iRow]; if (solution[iRow] > rowUpperWork_[iRow]) { infeasibility = solution[iRow] - rowUpperWork_[iRow]; } else if (solution[iRow] < rowLowerWork_[iRow]) { infeasibility = rowLowerWork_[iRow] - solution[iRow]; } if (infeasibility > primalTolerance) { sumPrimalInfeasibilities_ += infeasibility - primalTolerance_; if (infeasibility > relaxedTolerance) sumOfRelaxedPrimalInfeasibilities_ += infeasibility - relaxedTolerance; numberPrimalInfeasibilities_ ++; } infeasibility = fabs(rowActivities[iRow] - solution[iRow]); } // Check any infeasibilities from dynamic rows matrix_->primalExpanded(this, 2); solution = columnActivityWork_; if (!matrix_->rhsOffset(this)) { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { //assert (fabs(solution[iColumn])<1.0e15||getColumnStatus(iColumn) == basic); double infeasibility = 0.0; objectiveValue_ += objectiveWork_[iColumn] * solution[iColumn]; if (solution[iColumn] > columnUpperWork_[iColumn]) { infeasibility = solution[iColumn] - columnUpperWork_[iColumn]; } else if (solution[iColumn] < columnLowerWork_[iColumn]) { infeasibility = columnLowerWork_[iColumn] - solution[iColumn]; } if (infeasibility > primalTolerance) { sumPrimalInfeasibilities_ += infeasibility - primalTolerance_; if (infeasibility > relaxedTolerance) sumOfRelaxedPrimalInfeasibilities_ += infeasibility - relaxedTolerance; numberPrimalInfeasibilities_ ++; } infeasibility = fabs(columnActivities[iColumn] - solution[iColumn]); } } else { // as we are using effective rhs we only check basics // But we do need to get objective objectiveValue_ += innerProduct(objectiveWork_, numberColumns_, solution); for (int j = 0; j < numberRows_; j++) { int iColumn = pivotVariable_[j]; //assert (fabs(solution[iColumn])<1.0e15||getColumnStatus(iColumn) == basic); double infeasibility = 0.0; if (solution[iColumn] > columnUpperWork_[iColumn]) { infeasibility = solution[iColumn] - columnUpperWork_[iColumn]; } else if (solution[iColumn] < columnLowerWork_[iColumn]) { infeasibility = columnLowerWork_[iColumn] - solution[iColumn]; } if (infeasibility > primalTolerance) { sumPrimalInfeasibilities_ += infeasibility - primalTolerance_; if (infeasibility > relaxedTolerance) sumOfRelaxedPrimalInfeasibilities_ += infeasibility - relaxedTolerance; numberPrimalInfeasibilities_ ++; } infeasibility = fabs(columnActivities[iColumn] - solution[iColumn]); } } objectiveValue_ += objective_->nonlinearOffset(); objectiveValue_ /= (objectiveScale_ * rhsScale_); } void ClpSimplex::checkDualSolution() { int iRow, iColumn; sumDualInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; numberDualInfeasibilitiesWithoutFree_ = 0; if (matrix_->skipDualCheck() && algorithm_ > 0 && problemStatus_ == -2) { // pretend we found dual infeasibilities sumOfRelaxedDualInfeasibilities_ = 1.0; sumDualInfeasibilities_ = 1.0; numberDualInfeasibilities_ = 1; return; } int firstFreePrimal = -1; int firstFreeDual = -1; int numberSuperBasicWithDj = 0; bestPossibleImprovement_ = 0.0; // we can't really trust infeasibilities if there is dual error double error = CoinMin(1.0e-2, largestDualError_); // allow tolerance at least slightly bigger than standard double relaxedTolerance = dualTolerance_ + error; // allow bigger tolerance for possible improvement double possTolerance = 5.0 * relaxedTolerance; sumOfRelaxedDualInfeasibilities_ = 0.0; // Check any djs from dynamic rows matrix_->dualExpanded(this, NULL, NULL, 3); numberDualInfeasibilitiesWithoutFree_ = numberDualInfeasibilities_; objectiveValue_ = 0.0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { objectiveValue_ += objectiveWork_[iColumn] * columnActivityWork_[iColumn]; if (getColumnStatus(iColumn) != basic && !flagged(iColumn)) { // not basic double distanceUp = columnUpperWork_[iColumn] - columnActivityWork_[iColumn]; double distanceDown = columnActivityWork_[iColumn] - columnLowerWork_[iColumn]; if (distanceUp > primalTolerance_) { double value = reducedCostWork_[iColumn]; // Check if "free" if (distanceDown > primalTolerance_) { if (fabs(value) > 1.0e2 * relaxedTolerance) { numberSuperBasicWithDj++; if (firstFreeDual < 0) firstFreeDual = iColumn; } if (firstFreePrimal < 0) firstFreePrimal = iColumn; } // should not be negative if (value < 0.0) { value = - value; if (value > dualTolerance_) { if (getColumnStatus(iColumn) != isFree) { numberDualInfeasibilitiesWithoutFree_ ++; sumDualInfeasibilities_ += value - dualTolerance_; if (value > possTolerance) bestPossibleImprovement_ += CoinMin(distanceUp, 1.0e10) * value; if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; } else { // free so relax a lot value *= 0.01; if (value > dualTolerance_) { sumDualInfeasibilities_ += value - dualTolerance_; if (value > possTolerance) bestPossibleImprovement_ = 1.0e100; if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; } } } } } if (distanceDown > primalTolerance_) { double value = reducedCostWork_[iColumn]; // should not be positive if (value > 0.0) { if (value > dualTolerance_) { sumDualInfeasibilities_ += value - dualTolerance_; if (value > possTolerance) bestPossibleImprovement_ += value * CoinMin(distanceDown, 1.0e10); if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; if (getColumnStatus(iColumn) != isFree) numberDualInfeasibilitiesWithoutFree_ ++; // maybe we can make feasible by increasing tolerance } } } } } for (iRow = 0; iRow < numberRows_; iRow++) { objectiveValue_ += rowActivityWork_[iRow] * rowObjectiveWork_[iRow]; if (getRowStatus(iRow) != basic && !flagged(iRow + numberColumns_)) { // not basic double distanceUp = rowUpperWork_[iRow] - rowActivityWork_[iRow]; double distanceDown = rowActivityWork_[iRow] - rowLowerWork_[iRow]; if (distanceUp > primalTolerance_) { double value = rowReducedCost_[iRow]; // Check if "free" if (distanceDown > primalTolerance_) { if (fabs(value) > 1.0e2 * relaxedTolerance) { numberSuperBasicWithDj++; if (firstFreeDual < 0) firstFreeDual = iRow + numberColumns_; } if (firstFreePrimal < 0) firstFreePrimal = iRow + numberColumns_; } // should not be negative if (value < 0.0) { value = - value; if (value > dualTolerance_) { sumDualInfeasibilities_ += value - dualTolerance_; if (value > possTolerance) bestPossibleImprovement_ += value * CoinMin(distanceUp, 1.0e10); if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; if (getRowStatus(iRow) != isFree) numberDualInfeasibilitiesWithoutFree_ ++; } } } if (distanceDown > primalTolerance_) { double value = rowReducedCost_[iRow]; // should not be positive if (value > 0.0) { if (value > dualTolerance_) { sumDualInfeasibilities_ += value - dualTolerance_; if (value > possTolerance) bestPossibleImprovement_ += value * CoinMin(distanceDown, 1.0e10); if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; if (getRowStatus(iRow) != isFree) numberDualInfeasibilitiesWithoutFree_ ++; // maybe we can make feasible by increasing tolerance } } } } } if (algorithm_ < 0 && firstFreeDual >= 0) { // dual firstFree_ = firstFreeDual; } else if (numberSuperBasicWithDj || (progress_.lastIterationNumber(0) <= 0)) { firstFree_ = firstFreePrimal; } objectiveValue_ += objective_->nonlinearOffset(); objectiveValue_ /= (objectiveScale_ * rhsScale_); } /* This sets sum and number of infeasibilities (Dual and Primal) */ void ClpSimplex::checkBothSolutions() { if ((matrix_->skipDualCheck() && algorithm_ > 0 && problemStatus_ == -2) || matrix_->rhsOffset(this)) { // Say may be free or superbasic moreSpecialOptions_ &= ~8; // old way checkPrimalSolution(rowActivityWork_, columnActivityWork_); checkDualSolution(); return; } int iSequence; assert (dualTolerance_ > 0.0 && dualTolerance_ < 1.0e10); assert (primalTolerance_ > 0.0 && primalTolerance_ < 1.0e10); objectiveValue_ = 0.0; sumPrimalInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; double primalTolerance = primalTolerance_; double relaxedToleranceP = primalTolerance_; // we can't really trust infeasibilities if there is primal error double error = CoinMin(1.0e-2, CoinMax(largestPrimalError_,0.0*primalTolerance_)); // allow tolerance at least slightly bigger than standard relaxedToleranceP = relaxedToleranceP + error; sumOfRelaxedPrimalInfeasibilities_ = 0.0; sumDualInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; double dualTolerance = dualTolerance_; double relaxedToleranceD = dualTolerance; // we can't really trust infeasibilities if there is dual error error = CoinMin(1.0e-2, CoinMax(largestDualError_,5.0*dualTolerance_)); // allow tolerance at least slightly bigger than standard relaxedToleranceD = relaxedToleranceD + error; // allow bigger tolerance for possible improvement double possTolerance = 5.0 * relaxedToleranceD; sumOfRelaxedDualInfeasibilities_ = 0.0; bestPossibleImprovement_ = 0.0; // Check any infeasibilities from dynamic rows matrix_->primalExpanded(this, 2); // Check any djs from dynamic rows matrix_->dualExpanded(this, NULL, NULL, 3); int numberDualInfeasibilitiesFree = 0; int firstFreePrimal = -1; int firstFreeDual = -1; int numberSuperBasicWithDj = 0; int numberTotal = numberRows_ + numberColumns_; // Say no free or superbasic moreSpecialOptions_ |= 8; //#define PRINT_INFEAS #ifdef PRINT_INFEAS int seqInf[10]; #endif for (iSequence = 0; iSequence < numberTotal; iSequence++) { double value = solution_[iSequence]; #ifdef COIN_DEBUG if (fabs(value) > 1.0e20) printf("%d values %g %g %g - status %d\n", iSequence, lower_[iSequence], solution_[iSequence], upper_[iSequence], status_[iSequence]); #endif objectiveValue_ += value * cost_[iSequence]; double distanceUp = upper_[iSequence] - value; double distanceDown = value - lower_[iSequence]; if (distanceUp < -primalTolerance) { double infeasibility = -distanceUp; sumPrimalInfeasibilities_ += infeasibility - primalTolerance_; if (infeasibility > relaxedToleranceP) sumOfRelaxedPrimalInfeasibilities_ += infeasibility - relaxedToleranceP; #ifdef PRINT_INFEAS if (numberPrimalInfeasibilities_<10) { seqInf[numberPrimalInfeasibilities_]=iSequence; } #endif numberPrimalInfeasibilities_ ++; } else if (distanceDown < -primalTolerance) { double infeasibility = -distanceDown; sumPrimalInfeasibilities_ += infeasibility - primalTolerance_; if (infeasibility > relaxedToleranceP) sumOfRelaxedPrimalInfeasibilities_ += infeasibility - relaxedToleranceP; #ifdef PRINT_INFEAS if (numberPrimalInfeasibilities_<10) { seqInf[numberPrimalInfeasibilities_]=iSequence; } #endif numberPrimalInfeasibilities_ ++; } else { // feasible (so could be free) if (getStatus(iSequence) != basic && !flagged(iSequence)) { // not basic double djValue = dj_[iSequence]; if (distanceDown < primalTolerance) { if (distanceUp > primalTolerance && djValue < -dualTolerance) { sumDualInfeasibilities_ -= djValue + dualTolerance; if (djValue < -possTolerance) bestPossibleImprovement_ -= distanceUp * djValue; if (djValue < -relaxedToleranceD) sumOfRelaxedDualInfeasibilities_ -= djValue + relaxedToleranceD; numberDualInfeasibilities_ ++; } } else if (distanceUp < primalTolerance) { if (djValue > dualTolerance) { sumDualInfeasibilities_ += djValue - dualTolerance; if (djValue > possTolerance) bestPossibleImprovement_ += distanceDown * djValue; if (djValue > relaxedToleranceD) sumOfRelaxedDualInfeasibilities_ += djValue - relaxedToleranceD; numberDualInfeasibilities_ ++; } } else { // may be free // Say free or superbasic moreSpecialOptions_ &= ~8; djValue *= 0.01; if (fabs(djValue) > dualTolerance) { if (getStatus(iSequence) == isFree) numberDualInfeasibilitiesFree++; sumDualInfeasibilities_ += fabs(djValue) - dualTolerance; bestPossibleImprovement_ = 1.0e100; numberDualInfeasibilities_ ++; if (fabs(djValue) > relaxedToleranceD) { sumOfRelaxedDualInfeasibilities_ += value - relaxedToleranceD; numberSuperBasicWithDj++; if (firstFreeDual < 0) firstFreeDual = iSequence; } } if (firstFreePrimal < 0) firstFreePrimal = iSequence; } } } } objectiveValue_ += objective_->nonlinearOffset(); objectiveValue_ /= (objectiveScale_ * rhsScale_); numberDualInfeasibilitiesWithoutFree_ = numberDualInfeasibilities_ - numberDualInfeasibilitiesFree; #ifdef PRINT_INFEAS if (numberPrimalInfeasibilities_<=10) { printf("---------------start-----------\n"); if (!rowScale_) { for (int i=0;i= 0) { // dual firstFree_ = firstFreeDual; } else if (numberSuperBasicWithDj || (progress_.lastIterationNumber(0) <= 0)) { firstFree_ = firstFreePrimal; } } /* Adds multiple of a column into an array */ void ClpSimplex::add(double * array, int sequence, double multiplier) const { if (sequence >= numberColumns_ && sequence < numberColumns_ + numberRows_) { //slack array [sequence-numberColumns_] -= multiplier; } else { // column matrix_->add(this, array, sequence, multiplier); } } /* Unpacks one column of the matrix into indexed array */ void ClpSimplex::unpack(CoinIndexedVector * rowArray) const { rowArray->clear(); if (sequenceIn_ >= numberColumns_ && sequenceIn_ < numberColumns_ + numberRows_) { //slack rowArray->insert(sequenceIn_ - numberColumns_, -1.0); } else { // column matrix_->unpack(this, rowArray, sequenceIn_); } } void ClpSimplex::unpack(CoinIndexedVector * rowArray, int sequence) const { rowArray->clear(); if (sequence >= numberColumns_ && sequence < numberColumns_ + numberRows_) { //slack rowArray->insert(sequence - numberColumns_, -1.0); } else { // column matrix_->unpack(this, rowArray, sequence); } } /* Unpacks one column of the matrix into indexed array */ void ClpSimplex::unpackPacked(CoinIndexedVector * rowArray) { rowArray->clear(); if (sequenceIn_ >= numberColumns_ && sequenceIn_ < numberColumns_ + numberRows_) { //slack int * index = rowArray->getIndices(); double * array = rowArray->denseVector(); array[0] = -1.0; index[0] = sequenceIn_ - numberColumns_; rowArray->setNumElements(1); rowArray->setPackedMode(true); } else { // column matrix_->unpackPacked(this, rowArray, sequenceIn_); } } void ClpSimplex::unpackPacked(CoinIndexedVector * rowArray, int sequence) { rowArray->clear(); if (sequence >= numberColumns_ && sequence < numberColumns_ + numberRows_) { //slack int * index = rowArray->getIndices(); double * array = rowArray->denseVector(); array[0] = -1.0; index[0] = sequence - numberColumns_; rowArray->setNumElements(1); rowArray->setPackedMode(true); } else { // column matrix_->unpackPacked(this, rowArray, sequence); } } //static int x_gaps[4]={0,0,0,0}; //static int scale_times[]={0,0,0,0}; bool ClpSimplex::createRim(int what, bool makeRowCopy, int startFinishOptions) { bool goodMatrix = true; int saveLevel = handler_->logLevel(); spareIntArray_[0] = 0; if (!matrix_->canGetRowCopy()) makeRowCopy = false; // switch off row copy if can't produce // Arrays will be there and correct size unless what is 63 bool newArrays = (what == 63); // We may be restarting with same size bool keepPivots = false; if (startFinishOptions == -1) { startFinishOptions = 0; keepPivots = true; } bool oldMatrix = ((startFinishOptions & 4) != 0 && (whatsChanged_ & 1) != 0); if (what == 63) { pivotRow_ = -1; if (!status_) createStatus(); if (oldMatrix) newArrays = false; if (problemStatus_ == 10) { handler_->setLogLevel(0); // switch off messages if (rowArray_[0]) { // stuff is still there oldMatrix = true; newArrays = false; keepPivots = true; for (int iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (int iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } } } else if (factorization_) { // match up factorization messages if (handler_->logLevel() < 3) factorization_->messageLevel(0); else factorization_->messageLevel(CoinMax(3, factorization_->messageLevel())); /* Faster to keep pivots rather than re-scan matrix. Matrix may have changed i.e. oldMatrix false but okay as long as same number rows and status array exists */ if ((startFinishOptions & 2) != 0 && factorization_->numberRows() == numberRows_ && status_) keepPivots = true; } numberExtraRows_ = matrix_->generalExpanded(this, 2, maximumBasic_); if (numberExtraRows_ && newArrays) { // make sure status array large enough assert (status_); int numberOld = numberRows_ + numberColumns_; int numberNew = numberRows_ + numberColumns_ + numberExtraRows_; unsigned char * newStatus = new unsigned char [numberNew]; memset(newStatus + numberOld, 0, numberExtraRows_); CoinMemcpyN(status_, numberOld, newStatus); delete [] status_; status_ = newStatus; } } int numberRows2 = numberRows_ + numberExtraRows_; int numberTotal = numberRows2 + numberColumns_; if ((specialOptions_ & 65536) != 0) { assert (!numberExtraRows_); if (!cost_ || numberRows2 > maximumInternalRows_ || numberColumns_ > maximumInternalColumns_) { newArrays = true; keepPivots = false; COIN_DETAIL_PRINT(printf("createrim a %d rows, %d maximum rows %d maxinternal\n", numberRows_, maximumRows_, maximumInternalRows_)); int oldMaximumRows = maximumInternalRows_; int oldMaximumColumns = maximumInternalColumns_; if (cost_) { if (numberRows2 > maximumInternalRows_) maximumInternalRows_ = numberRows2; if (numberColumns_ > maximumInternalColumns_) maximumInternalColumns_ = numberColumns_; } else { maximumInternalRows_ = numberRows2; maximumInternalColumns_ = numberColumns_; } //maximumRows_=CoinMax(maximumInternalRows_,maximumRows_); //maximumColumns_=CoinMax(maximumInternalColumns_,maximumColumns_); assert(maximumInternalRows_ == maximumRows_); assert(maximumInternalColumns_ == maximumColumns_); COIN_DETAIL_PRINT(printf("createrim b %d rows, %d maximum rows, %d maxinternal\n", numberRows_, maximumRows_, maximumInternalRows_)); int numberTotal2 = (maximumInternalRows_ + maximumInternalColumns_) * 2; delete [] cost_; cost_ = new double[numberTotal2]; delete [] lower_; delete [] upper_; lower_ = new double[numberTotal2]; upper_ = new double[numberTotal2]; delete [] dj_; dj_ = new double[numberTotal2]; delete [] solution_; solution_ = new double[numberTotal2]; // ***** should be non NULL but seems to be too much //printf("resize %d savedRowScale %x\n",maximumRows_,savedRowScale_); if (savedRowScale_) { assert (oldMaximumRows > 0); double * temp; temp = new double [4*maximumRows_]; CoinFillN(temp, 4 * maximumRows_, 1.0); CoinMemcpyN(savedRowScale_, numberRows_, temp); CoinMemcpyN(savedRowScale_ + oldMaximumRows, numberRows_, temp + maximumRows_); CoinMemcpyN(savedRowScale_ + 2 * oldMaximumRows, numberRows_, temp + 2 * maximumRows_); CoinMemcpyN(savedRowScale_ + 3 * oldMaximumRows, numberRows_, temp + 3 * maximumRows_); delete [] savedRowScale_; savedRowScale_ = temp; temp = new double [4*maximumColumns_]; CoinFillN(temp, 4 * maximumColumns_, 1.0); CoinMemcpyN(savedColumnScale_, numberColumns_, temp); CoinMemcpyN(savedColumnScale_ + oldMaximumColumns, numberColumns_, temp + maximumColumns_); CoinMemcpyN(savedColumnScale_ + 2 * oldMaximumColumns, numberColumns_, temp + 2 * maximumColumns_); CoinMemcpyN(savedColumnScale_ + 3 * oldMaximumColumns, numberColumns_, temp + 3 * maximumColumns_); delete [] savedColumnScale_; savedColumnScale_ = temp; } } } int i; bool doSanityCheck = true; if (what == 63) { // We may want to switch stuff off for speed if ((specialOptions_ & 256) != 0) makeRowCopy = false; // no row copy if ((specialOptions_ & 128) != 0) doSanityCheck = false; // no sanity check //check matrix if (!matrix_) matrix_ = new ClpPackedMatrix(); int checkType = (doSanityCheck) ? 15 : 14; if (oldMatrix) checkType = 14; bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; if (inCbcOrOther) checkType -= 4; // don't check for duplicates if (!matrix_->allElementsInRange(this, smallElement_, 1.0e20, checkType)) { problemStatus_ = 4; secondaryStatus_ = 8; //goodMatrix= false; return false; } bool rowCopyIsScaled; if (makeRowCopy) { if(!oldMatrix || !rowCopy_) { delete rowCopy_; // may return NULL if can't give row copy rowCopy_ = matrix_->reverseOrderedCopy(); rowCopyIsScaled = false; } else { rowCopyIsScaled = true; } } #if 0 if (what == 63) { int k = rowScale_ ? 1 : 0; if (oldMatrix) k += 2; scale_times[k]++; if ((scale_times[0] + scale_times[1] + scale_times[2] + scale_times[3]) % 1000 == 0) printf("scale counts %d %d %d %d\n", scale_times[0], scale_times[1], scale_times[2], scale_times[3]); } #endif // do scaling if needed if (!oldMatrix && scalingFlag_ < 0) { if (scalingFlag_ < 0 && rowScale_) { //if (handler_->logLevel()>0) printf("How did we get scalingFlag_ %d and non NULL rowScale_? - switching off scaling\n", scalingFlag_); scalingFlag_ = 0; } delete [] rowScale_; delete [] columnScale_; rowScale_ = NULL; columnScale_ = NULL; } inverseRowScale_ = NULL; inverseColumnScale_ = NULL; if (scalingFlag_ > 0 &&(specialOptions_ & 65536) != 0&& rowScale_&&rowScale_==savedRowScale_) rowScale_=NULL; if (scalingFlag_ > 0 && !rowScale_) { if ((specialOptions_ & 65536) != 0) { assert (!rowScale_); rowScale_ = savedRowScale_; columnScale_ = savedColumnScale_; // put back original if (savedRowScale_) { inverseRowScale_ = savedRowScale_ + maximumInternalRows_; inverseColumnScale_ = savedColumnScale_ + maximumInternalColumns_; CoinMemcpyN(savedRowScale_ + 2 * maximumInternalRows_, numberRows2, savedRowScale_); CoinMemcpyN(savedRowScale_ + 3 * maximumInternalRows_, numberRows2, inverseRowScale_); CoinMemcpyN(savedColumnScale_ + 2 * maximumColumns_, numberColumns_, savedColumnScale_); CoinMemcpyN(savedColumnScale_ + 3 * maximumColumns_, numberColumns_, inverseColumnScale_); } } if (matrix_->scale(this)) scalingFlag_ = -scalingFlag_; // not scaled after all if (rowScale_ && automaticScale_) { if (!savedRowScale_) { inverseRowScale_ = rowScale_ + numberRows2; inverseColumnScale_ = columnScale_ + numberColumns_; } // try automatic scaling double smallestObj = 1.0e100; double largestObj = 0.0; double largestRhs = 0.0; const double * obj = objective(); for (i = 0; i < numberColumns_; i++) { double value = fabs(obj[i]); value *= columnScale_[i]; if (value && columnLower_[i] != columnUpper_[i]) { smallestObj = CoinMin(smallestObj, value); largestObj = CoinMax(largestObj, value); } if (columnLower_[i] > 0.0 || columnUpper_[i] < 0.0) { double scale = 1.0 * inverseColumnScale_[i]; //printf("%d %g %g %g %g\n",i,scale,lower_[i],upper_[i],largestRhs); if (columnLower_[i] > 0) largestRhs = CoinMax(largestRhs, columnLower_[i] * scale); if (columnUpper_[i] < 0.0) largestRhs = CoinMax(largestRhs, -columnUpper_[i] * scale); } } for (i = 0; i < numberRows_; i++) { if (rowLower_[i] > 0.0 || rowUpper_[i] < 0.0) { double scale = rowScale_[i]; //printf("%d %g %g %g %g\n",i,scale,lower_[i],upper_[i],largestRhs); if (rowLower_[i] > 0) largestRhs = CoinMax(largestRhs, rowLower_[i] * scale); if (rowUpper_[i] < 0.0) largestRhs = CoinMax(largestRhs, -rowUpper_[i] * scale); } } COIN_DETAIL_PRINT(printf("small obj %g, large %g - rhs %g\n", smallestObj, largestObj, largestRhs)); bool scalingDone = false; // look at element range double smallestNegative; double largestNegative; double smallestPositive; double largestPositive; matrix_->rangeOfElements(smallestNegative, largestNegative, smallestPositive, largestPositive); smallestPositive = CoinMin(fabs(smallestNegative), smallestPositive); largestPositive = CoinMax(fabs(largestNegative), largestPositive); if (largestObj) { double ratio = largestObj / smallestObj; double scale = 1.0; if (ratio < 1.0e8) { // reasonable if (smallestObj < 1.0e-4) { // may as well scale up scalingDone = true; scale = 1.0e-3 / smallestObj; } else if (largestObj < 1.0e6 || (algorithm_ > 0 && largestObj < 1.0e-4 * infeasibilityCost_)) { //done=true; } else { scalingDone = true; if (algorithm_ < 0) { scale = 1.0e6 / largestObj; } else { scale = CoinMax(1.0e6, 1.0e-4 * infeasibilityCost_) / largestObj; } } } else if (ratio < 1.0e12) { // not so good if (smallestObj < 1.0e-7) { // may as well scale up scalingDone = true; scale = 1.0e-6 / smallestObj; } else if (largestObj < 1.0e7 || (algorithm_ > 0 && largestObj < 1.0e-3 * infeasibilityCost_)) { //done=true; } else { scalingDone = true; if (algorithm_ < 0) { scale = 1.0e7 / largestObj; } else { scale = CoinMax(1.0e7, 1.0e-3 * infeasibilityCost_) / largestObj; } } } else { // Really nasty problem if (smallestObj < 1.0e-8) { // may as well scale up scalingDone = true; scale = 1.0e-7 / smallestObj; largestObj *= scale; } if (largestObj < 1.0e7 || (algorithm_ > 0 && largestObj < 1.0e-3 * infeasibilityCost_)) { //done=true; } else { scalingDone = true; if (algorithm_ < 0) { scale = 1.0e7 / largestObj; } else { scale = CoinMax(1.0e7, 1.0e-3 * infeasibilityCost_) / largestObj; } } } objectiveScale_ = scale; } if (largestRhs > 1.0e12) { scalingDone = true; rhsScale_ = 1.0e9 / largestRhs; } else if (largestPositive > 1.0e-14 * smallestPositive && largestRhs > 1.0e6) { scalingDone = true; rhsScale_ = 1.0e6 / largestRhs; } else { rhsScale_ = 1.0; } if (scalingDone) { handler_->message(CLP_RIM_SCALE, messages_) << objectiveScale_ << rhsScale_ << CoinMessageEol; } } } else if (makeRowCopy && scalingFlag_ > 0 && !rowCopyIsScaled) { matrix_->scaleRowCopy(this); } if (rowScale_ && !savedRowScale_) { inverseRowScale_ = rowScale_ + numberRows2; inverseColumnScale_ = columnScale_ + numberColumns_; } // See if we can try for faster row copy if (makeRowCopy && !oldMatrix) { ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix_); if (clpMatrix && numberThreads_) clpMatrix->specialRowCopy(this, rowCopy_); if (clpMatrix) clpMatrix->specialColumnCopy(this); } } if (what == 63) { #if 0 { x_gaps[0]++; ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix_); if (clpMatrix) { if (!clpMatrix->getPackedMatrix()->hasGaps()) x_gaps[1]++; if ((clpMatrix->flags() & 2) == 0) x_gaps[3]++; } else { x_gaps[2]++; } if ((x_gaps[0] % 1000) == 0) printf("create %d times, no gaps %d times - not clp %d times - flagged %d\n", x_gaps[0], x_gaps[1], x_gaps[2], x_gaps[3]); } #endif if (newArrays && (specialOptions_ & 65536) == 0) { delete [] cost_; cost_ = new double[2*numberTotal]; delete [] lower_; delete [] upper_; lower_ = new double[numberTotal]; upper_ = new double[numberTotal]; delete [] dj_; dj_ = new double[numberTotal]; delete [] solution_; solution_ = new double[numberTotal]; } reducedCostWork_ = dj_; rowReducedCost_ = dj_ + numberColumns_; columnActivityWork_ = solution_; rowActivityWork_ = solution_ + numberColumns_; objectiveWork_ = cost_; rowObjectiveWork_ = cost_ + numberColumns_; rowLowerWork_ = lower_ + numberColumns_; columnLowerWork_ = lower_; rowUpperWork_ = upper_ + numberColumns_; columnUpperWork_ = upper_; } if ((what & 4) != 0) { double direction = optimizationDirection_ * objectiveScale_; const double * obj = objective(); const double * rowScale = rowScale_; const double * columnScale = columnScale_; // and also scale by scale factors if (rowScale) { if (rowObjective_) { for (i = 0; i < numberRows_; i++) rowObjectiveWork_[i] = rowObjective_[i] * direction / rowScale[i]; } else { memset(rowObjectiveWork_, 0, numberRows_ * sizeof(double)); } // If scaled then do all columns later in one loop if (what != 63) { for (i = 0; i < numberColumns_; i++) { CoinAssert(fabs(obj[i]) < 1.0e25); objectiveWork_[i] = obj[i] * direction * columnScale[i]; } } } else { if (rowObjective_) { for (i = 0; i < numberRows_; i++) rowObjectiveWork_[i] = rowObjective_[i] * direction; } else { memset(rowObjectiveWork_, 0, numberRows_ * sizeof(double)); } for (i = 0; i < numberColumns_; i++) { CoinAssert(fabs(obj[i]) < 1.0e25); objectiveWork_[i] = obj[i] * direction; } } } if ((what & 1) != 0) { const double * rowScale = rowScale_; // clean up any mismatches on infinity // and fix any variables with tiny gaps double primalTolerance = dblParam_[ClpPrimalTolerance]; if(rowScale) { // If scaled then do all columns later in one loop if (what != 63) { const double * inverseScale = inverseColumnScale_; for (i = 0; i < numberColumns_; i++) { double multiplier = rhsScale_ * inverseScale[i]; double lowerValue = columnLower_[i]; double upperValue = columnUpper_[i]; if (lowerValue > -1.0e20) { columnLowerWork_[i] = lowerValue * multiplier; if (upperValue >= 1.0e20) { columnUpperWork_[i] = COIN_DBL_MAX; } else { columnUpperWork_[i] = upperValue * multiplier; if (fabs(columnUpperWork_[i] - columnLowerWork_[i]) <= primalTolerance) { if (columnLowerWork_[i] >= 0.0) { columnUpperWork_[i] = columnLowerWork_[i]; } else if (columnUpperWork_[i] <= 0.0) { columnLowerWork_[i] = columnUpperWork_[i]; } else { columnUpperWork_[i] = 0.0; columnLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = upperValue * multiplier; } else { // free columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = COIN_DBL_MAX; } } } for (i = 0; i < numberRows_; i++) { double multiplier = rhsScale_ * rowScale[i]; double lowerValue = rowLower_[i]; double upperValue = rowUpper_[i]; if (lowerValue > -1.0e20) { rowLowerWork_[i] = lowerValue * multiplier; if (upperValue >= 1.0e20) { rowUpperWork_[i] = COIN_DBL_MAX; } else { rowUpperWork_[i] = upperValue * multiplier; if (fabs(rowUpperWork_[i] - rowLowerWork_[i]) <= primalTolerance) { if (rowLowerWork_[i] >= 0.0) { rowUpperWork_[i] = rowLowerWork_[i]; } else if (rowUpperWork_[i] <= 0.0) { rowLowerWork_[i] = rowUpperWork_[i]; } else { rowUpperWork_[i] = 0.0; rowLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = upperValue * multiplier; } else { // free rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = COIN_DBL_MAX; } } } else if (rhsScale_ != 1.0) { for (i = 0; i < numberColumns_; i++) { double lowerValue = columnLower_[i]; double upperValue = columnUpper_[i]; if (lowerValue > -1.0e20) { columnLowerWork_[i] = lowerValue * rhsScale_; if (upperValue >= 1.0e20) { columnUpperWork_[i] = COIN_DBL_MAX; } else { columnUpperWork_[i] = upperValue * rhsScale_; if (fabs(columnUpperWork_[i] - columnLowerWork_[i]) <= primalTolerance) { if (columnLowerWork_[i] >= 0.0) { columnUpperWork_[i] = columnLowerWork_[i]; } else if (columnUpperWork_[i] <= 0.0) { columnLowerWork_[i] = columnUpperWork_[i]; } else { columnUpperWork_[i] = 0.0; columnLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = upperValue * rhsScale_; } else { // free columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = COIN_DBL_MAX; } } for (i = 0; i < numberRows_; i++) { double lowerValue = rowLower_[i]; double upperValue = rowUpper_[i]; if (lowerValue > -1.0e20) { rowLowerWork_[i] = lowerValue * rhsScale_; if (upperValue >= 1.0e20) { rowUpperWork_[i] = COIN_DBL_MAX; } else { rowUpperWork_[i] = upperValue * rhsScale_; if (fabs(rowUpperWork_[i] - rowLowerWork_[i]) <= primalTolerance) { if (rowLowerWork_[i] >= 0.0) { rowUpperWork_[i] = rowLowerWork_[i]; } else if (rowUpperWork_[i] <= 0.0) { rowLowerWork_[i] = rowUpperWork_[i]; } else { rowUpperWork_[i] = 0.0; rowLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = upperValue * rhsScale_; } else { // free rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = COIN_DBL_MAX; } } } else { for (i = 0; i < numberColumns_; i++) { double lowerValue = columnLower_[i]; double upperValue = columnUpper_[i]; if (lowerValue > -1.0e20) { columnLowerWork_[i] = lowerValue; if (upperValue >= 1.0e20) { columnUpperWork_[i] = COIN_DBL_MAX; } else { columnUpperWork_[i] = upperValue; if (fabs(columnUpperWork_[i] - columnLowerWork_[i]) <= primalTolerance) { if (columnLowerWork_[i] >= 0.0) { columnUpperWork_[i] = columnLowerWork_[i]; } else if (columnUpperWork_[i] <= 0.0) { columnLowerWork_[i] = columnUpperWork_[i]; } else { columnUpperWork_[i] = 0.0; columnLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = upperValue; } else { // free columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = COIN_DBL_MAX; } } for (i = 0; i < numberRows_; i++) { double lowerValue = rowLower_[i]; double upperValue = rowUpper_[i]; if (lowerValue > -1.0e20) { rowLowerWork_[i] = lowerValue; if (upperValue >= 1.0e20) { rowUpperWork_[i] = COIN_DBL_MAX; } else { rowUpperWork_[i] = upperValue; if (fabs(rowUpperWork_[i] - rowLowerWork_[i]) <= primalTolerance) { if (rowLowerWork_[i] >= 0.0) { rowUpperWork_[i] = rowLowerWork_[i]; } else if (rowUpperWork_[i] <= 0.0) { rowLowerWork_[i] = rowUpperWork_[i]; } else { rowUpperWork_[i] = 0.0; rowLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = upperValue; } else { // free rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = COIN_DBL_MAX; } } } } if (what == 63) { // move information to work arrays double direction = optimizationDirection_; // direction is actually scale out not scale in if (direction) direction = 1.0 / direction; if (direction != 1.0) { // reverse all dual signs for (i = 0; i < numberColumns_; i++) reducedCost_[i] *= direction; for (i = 0; i < numberRows_; i++) dual_[i] *= direction; } for (i = 0; i < numberRows_ + numberColumns_; i++) { setFakeBound(i, noFake); } if (rowScale_) { const double * obj = objective(); double direction = optimizationDirection_ * objectiveScale_; // clean up any mismatches on infinity // and fix any variables with tiny gaps double primalTolerance = dblParam_[ClpPrimalTolerance]; // on entry const double * inverseScale = inverseColumnScale_; for (i = 0; i < numberColumns_; i++) { CoinAssert(fabs(obj[i]) < 1.0e25); double scaleFactor = columnScale_[i]; double multiplier = rhsScale_ * inverseScale[i]; scaleFactor *= direction; objectiveWork_[i] = obj[i] * scaleFactor; reducedCostWork_[i] = reducedCost_[i] * scaleFactor; double lowerValue = columnLower_[i]; double upperValue = columnUpper_[i]; if (lowerValue > -1.0e20) { columnLowerWork_[i] = lowerValue * multiplier; if (upperValue >= 1.0e20) { columnUpperWork_[i] = COIN_DBL_MAX; } else { columnUpperWork_[i] = upperValue * multiplier; if (fabs(columnUpperWork_[i] - columnLowerWork_[i]) <= primalTolerance) { if (columnLowerWork_[i] >= 0.0) { columnUpperWork_[i] = columnLowerWork_[i]; } else if (columnUpperWork_[i] <= 0.0) { columnLowerWork_[i] = columnUpperWork_[i]; } else { columnUpperWork_[i] = 0.0; columnLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = upperValue * multiplier; } else { // free columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = COIN_DBL_MAX; } double value = columnActivity_[i] * multiplier; if (fabs(value) > 1.0e20) { //printf("bad value of %g for column %d\n",value,i); setColumnStatus(i, superBasic); if (columnUpperWork_[i] < 0.0) { value = columnUpperWork_[i]; } else if (columnLowerWork_[i] > 0.0) { value = columnLowerWork_[i]; } else { value = 0.0; } } columnActivityWork_[i] = value; } inverseScale = inverseRowScale_; for (i = 0; i < numberRows_; i++) { dual_[i] *= inverseScale[i]; dual_[i] *= objectiveScale_; rowReducedCost_[i] = dual_[i]; double multiplier = rhsScale_ * rowScale_[i]; double value = rowActivity_[i] * multiplier; if (fabs(value) > 1.0e20) { //printf("bad value of %g for row %d\n",value,i); setRowStatus(i, superBasic); if (rowUpperWork_[i] < 0.0) { value = rowUpperWork_[i]; } else if (rowLowerWork_[i] > 0.0) { value = rowLowerWork_[i]; } else { value = 0.0; } } rowActivityWork_[i] = value; } } else if (objectiveScale_ != 1.0 || rhsScale_ != 1.0) { // on entry for (i = 0; i < numberColumns_; i++) { double value = columnActivity_[i]; value *= rhsScale_; if (fabs(value) > 1.0e20) { //printf("bad value of %g for column %d\n",value,i); setColumnStatus(i, superBasic); if (columnUpperWork_[i] < 0.0) { value = columnUpperWork_[i]; } else if (columnLowerWork_[i] > 0.0) { value = columnLowerWork_[i]; } else { value = 0.0; } } columnActivityWork_[i] = value; reducedCostWork_[i] = reducedCost_[i] * objectiveScale_; } for (i = 0; i < numberRows_; i++) { double value = rowActivity_[i]; value *= rhsScale_; if (fabs(value) > 1.0e20) { //printf("bad value of %g for row %d\n",value,i); setRowStatus(i, superBasic); if (rowUpperWork_[i] < 0.0) { value = rowUpperWork_[i]; } else if (rowLowerWork_[i] > 0.0) { value = rowLowerWork_[i]; } else { value = 0.0; } } rowActivityWork_[i] = value; dual_[i] *= objectiveScale_; rowReducedCost_[i] = dual_[i]; } } else { // on entry for (i = 0; i < numberColumns_; i++) { double value = columnActivity_[i]; if (fabs(value) > 1.0e20) { //printf("bad value of %g for column %d\n",value,i); setColumnStatus(i, superBasic); if (columnUpperWork_[i] < 0.0) { value = columnUpperWork_[i]; } else if (columnLowerWork_[i] > 0.0) { value = columnLowerWork_[i]; } else { value = 0.0; } } columnActivityWork_[i] = value; reducedCostWork_[i] = reducedCost_[i]; } for (i = 0; i < numberRows_; i++) { double value = rowActivity_[i]; if (fabs(value) > 1.0e20) { //printf("bad value of %g for row %d\n",value,i); setRowStatus(i, superBasic); if (rowUpperWork_[i] < 0.0) { value = rowUpperWork_[i]; } else if (rowLowerWork_[i] > 0.0) { value = rowLowerWork_[i]; } else { value = 0.0; } } rowActivityWork_[i] = value; rowReducedCost_[i] = dual_[i]; } } } if (what == 63 && doSanityCheck) { // check rim of problem okay if (!sanityCheck()) goodMatrix = false; } // we need to treat matrix as if each element by rowScaleIn and columnScaleout?? // maybe we need to move scales to SimplexModel for factorization? if ((what == 63 && !pivotVariable_) || (newArrays && !keepPivots)) { delete [] pivotVariable_; pivotVariable_ = new int[numberRows2]; for (int i = 0; i < numberRows2; i++) pivotVariable_[i] = -1; } else if (what == 63 && !keepPivots) { // just reset for (int i = 0; i < numberRows2; i++) pivotVariable_[i] = -1; } else if (what == 63) { // check pivots for (int i = 0; i < numberRows2; i++) { int iSequence = pivotVariable_[i]; if (iSequence<0||(iSequence < numberRows_ + numberColumns_ && getStatus(iSequence) != basic)) { keepPivots = false; break; } } if (!keepPivots) { // reset for (int i = 0; i < numberRows2; i++) pivotVariable_[i] = -1; } else { // clean for (int i = 0; i < numberColumns_ + numberRows_; i++) { Status status = getStatus(i); if (status != basic) { if (upper_[i] == lower_[i]) { setStatus(i, isFixed); solution_[i] = lower_[i]; } else if (status == atLowerBound) { if (lower_[i] > -1.0e20) { solution_[i] = lower_[i]; } else { //printf("seq %d at lower of %g\n",i,lower_[i]); if (upper_[i] < 1.0e20) { solution_[i] = upper_[i]; setStatus(i, atUpperBound); } else { setStatus(i, isFree); } } } else if (status == atUpperBound) { if (upper_[i] < 1.0e20) { solution_[i] = upper_[i]; } else { //printf("seq %d at upper of %g\n",i,upper_[i]); if (lower_[i] > -1.0e20) { solution_[i] = lower_[i]; setStatus(i, atLowerBound); } else { setStatus(i, isFree); } } } else if (status == isFixed && upper_[i] > lower_[i]) { // was fixed - not now if (solution_[i] <= lower_[i]+primalTolerance_) { setStatus(i, atLowerBound); } else if (solution_[i] >= upper_[i]-primalTolerance_) { setStatus(i, atUpperBound); } else { setStatus(i, superBasic); } } } } } } if (what == 63) { if (newArrays) { // get some arrays int iRow, iColumn; // these are "indexed" arrays so we always know where nonzeros are /********************************************************** rowArray_[3] is long enough for rows+columns rowArray_[1] is long enough for max(rows,columns) *********************************************************/ for (iRow = 0; iRow < 4; iRow++) { int length = numberRows2 + factorization_->maximumPivots(); if (iRow == 3 || objective_->type() > 1) length += numberColumns_; else if (iRow == 1) length = CoinMax(length, numberColumns_); if ((specialOptions_ & 65536) == 0 || !rowArray_[iRow]) { delete rowArray_[iRow]; rowArray_[iRow] = new CoinIndexedVector(); } rowArray_[iRow]->reserve(length); } for (iColumn = 0; iColumn < 2; iColumn++) { if ((specialOptions_ & 65536) == 0 || !columnArray_[iColumn]) { delete columnArray_[iColumn]; columnArray_[iColumn] = new CoinIndexedVector(); } columnArray_[iColumn]->reserve(numberColumns_+numberRows2); } } else { int iRow, iColumn; for (iRow = 0; iRow < 4; iRow++) { int length = numberRows2 + factorization_->maximumPivots(); if (iRow == 3 || objective_->type() > 1) length += numberColumns_; if(rowArray_[iRow]->capacity() >= length) { rowArray_[iRow]->clear(); } else { // model size or maxinv changed rowArray_[iRow]->reserve(length); } #ifndef NDEBUG rowArray_[iRow]->checkClear(); #endif } for (iColumn = 0; iColumn < 2; iColumn++) { int length = numberColumns_; if (iColumn) length = CoinMax(numberRows2, numberColumns_); if(columnArray_[iColumn]->capacity() >= length) { columnArray_[iColumn]->clear(); } else { // model size or maxinv changed columnArray_[iColumn]->reserve(length); } #ifndef NDEBUG columnArray_[iColumn]->checkClear(); #endif } } } if (problemStatus_ == 10) { problemStatus_ = -1; handler_->setLogLevel(saveLevel); // switch back messages } if ((what & 5) != 0) matrix_->generalExpanded(this, 9, what); // update costs and bounds if necessary if (goodMatrix && (specialOptions_ & 65536) != 0) { int save = maximumColumns_ + maximumRows_; CoinMemcpyN(cost_, numberTotal, cost_ + save); CoinMemcpyN(lower_, numberTotal, lower_ + save); CoinMemcpyN(upper_, numberTotal, upper_ + save); CoinMemcpyN(dj_, numberTotal, dj_ + save); CoinMemcpyN(solution_, numberTotal, solution_ + save); if (rowScale_ && !savedRowScale_) { double * temp; temp = new double [4*maximumRows_]; CoinFillN(temp, 4 * maximumRows_, 1.0); CoinMemcpyN(rowScale_, numberRows2, temp); CoinMemcpyN(rowScale_ + numberRows2, numberRows2, temp + maximumRows_); CoinMemcpyN(rowScale_, numberRows2, temp + 2 * maximumRows_); CoinMemcpyN(rowScale_ + numberRows2, numberRows2, temp + 3 * maximumRows_); delete [] rowScale_; savedRowScale_ = temp; rowScale_ = savedRowScale_; inverseRowScale_ = savedRowScale_ + maximumInternalRows_; temp = new double [4*maximumColumns_]; CoinFillN(temp, 4 * maximumColumns_, 1.0); CoinMemcpyN(columnScale_, numberColumns_, temp); CoinMemcpyN(columnScale_ + numberColumns_, numberColumns_, temp + maximumColumns_); CoinMemcpyN(columnScale_, numberColumns_, temp + 2 * maximumColumns_); CoinMemcpyN(columnScale_ + numberColumns_, numberColumns_, temp + 3 * maximumColumns_); delete [] columnScale_; savedColumnScale_ = temp; columnScale_ = savedColumnScale_; inverseColumnScale_ = savedColumnScale_ + maximumInternalColumns_; } } #ifdef CLP_USER_DRIVEN eventHandler_->event(ClpEventHandler::endOfCreateRim); #endif return goodMatrix; } // Does rows and columns void ClpSimplex::createRim1(bool initial) { int i; int numberRows2 = numberRows_ + numberExtraRows_; int numberTotal = numberRows2 + numberColumns_; if ((specialOptions_ & 65536) != 0 && true) { assert (!initial); int save = maximumColumns_ + maximumRows_; CoinMemcpyN(lower_ + save, numberTotal, lower_); CoinMemcpyN(upper_ + save, numberTotal, upper_); return; } const double * rowScale = rowScale_; // clean up any mismatches on infinity // and fix any variables with tiny gaps double primalTolerance = dblParam_[ClpPrimalTolerance]; if(rowScale) { // If scaled then do all columns later in one loop if (!initial) { const double * inverseScale = inverseColumnScale_; for (i = 0; i < numberColumns_; i++) { double multiplier = rhsScale_ * inverseScale[i]; double lowerValue = columnLower_[i]; double upperValue = columnUpper_[i]; if (lowerValue > -1.0e20) { columnLowerWork_[i] = lowerValue * multiplier; if (upperValue >= 1.0e20) { columnUpperWork_[i] = COIN_DBL_MAX; } else { columnUpperWork_[i] = upperValue * multiplier; if (fabs(columnUpperWork_[i] - columnLowerWork_[i]) <= primalTolerance) { if (columnLowerWork_[i] >= 0.0) { columnUpperWork_[i] = columnLowerWork_[i]; } else if (columnUpperWork_[i] <= 0.0) { columnLowerWork_[i] = columnUpperWork_[i]; } else { columnUpperWork_[i] = 0.0; columnLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = upperValue * multiplier; } else { // free columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = COIN_DBL_MAX; } } } for (i = 0; i < numberRows_; i++) { double multiplier = rhsScale_ * rowScale[i]; double lowerValue = rowLower_[i]; double upperValue = rowUpper_[i]; if (lowerValue > -1.0e20) { rowLowerWork_[i] = lowerValue * multiplier; if (upperValue >= 1.0e20) { rowUpperWork_[i] = COIN_DBL_MAX; } else { rowUpperWork_[i] = upperValue * multiplier; if (fabs(rowUpperWork_[i] - rowLowerWork_[i]) <= primalTolerance) { if (rowLowerWork_[i] >= 0.0) { rowUpperWork_[i] = rowLowerWork_[i]; } else if (rowUpperWork_[i] <= 0.0) { rowLowerWork_[i] = rowUpperWork_[i]; } else { rowUpperWork_[i] = 0.0; rowLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = upperValue * multiplier; } else { // free rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = COIN_DBL_MAX; } } } else if (rhsScale_ != 1.0) { for (i = 0; i < numberColumns_; i++) { double lowerValue = columnLower_[i]; double upperValue = columnUpper_[i]; if (lowerValue > -1.0e20) { columnLowerWork_[i] = lowerValue * rhsScale_; if (upperValue >= 1.0e20) { columnUpperWork_[i] = COIN_DBL_MAX; } else { columnUpperWork_[i] = upperValue * rhsScale_; if (fabs(columnUpperWork_[i] - columnLowerWork_[i]) <= primalTolerance) { if (columnLowerWork_[i] >= 0.0) { columnUpperWork_[i] = columnLowerWork_[i]; } else if (columnUpperWork_[i] <= 0.0) { columnLowerWork_[i] = columnUpperWork_[i]; } else { columnUpperWork_[i] = 0.0; columnLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = upperValue * rhsScale_; } else { // free columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = COIN_DBL_MAX; } } for (i = 0; i < numberRows_; i++) { double lowerValue = rowLower_[i]; double upperValue = rowUpper_[i]; if (lowerValue > -1.0e20) { rowLowerWork_[i] = lowerValue * rhsScale_; if (upperValue >= 1.0e20) { rowUpperWork_[i] = COIN_DBL_MAX; } else { rowUpperWork_[i] = upperValue * rhsScale_; if (fabs(rowUpperWork_[i] - rowLowerWork_[i]) <= primalTolerance) { if (rowLowerWork_[i] >= 0.0) { rowUpperWork_[i] = rowLowerWork_[i]; } else if (rowUpperWork_[i] <= 0.0) { rowLowerWork_[i] = rowUpperWork_[i]; } else { rowUpperWork_[i] = 0.0; rowLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = upperValue * rhsScale_; } else { // free rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = COIN_DBL_MAX; } } } else { for (i = 0; i < numberColumns_; i++) { double lowerValue = columnLower_[i]; double upperValue = columnUpper_[i]; if (lowerValue > -1.0e20) { columnLowerWork_[i] = lowerValue; if (upperValue >= 1.0e20) { columnUpperWork_[i] = COIN_DBL_MAX; } else { columnUpperWork_[i] = upperValue; if (fabs(columnUpperWork_[i] - columnLowerWork_[i]) <= primalTolerance) { if (columnLowerWork_[i] >= 0.0) { columnUpperWork_[i] = columnLowerWork_[i]; } else if (columnUpperWork_[i] <= 0.0) { columnLowerWork_[i] = columnUpperWork_[i]; } else { columnUpperWork_[i] = 0.0; columnLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = upperValue; } else { // free columnLowerWork_[i] = -COIN_DBL_MAX; columnUpperWork_[i] = COIN_DBL_MAX; } } for (i = 0; i < numberRows_; i++) { double lowerValue = rowLower_[i]; double upperValue = rowUpper_[i]; if (lowerValue > -1.0e20) { rowLowerWork_[i] = lowerValue; if (upperValue >= 1.0e20) { rowUpperWork_[i] = COIN_DBL_MAX; } else { rowUpperWork_[i] = upperValue; if (fabs(rowUpperWork_[i] - rowLowerWork_[i]) <= primalTolerance) { if (rowLowerWork_[i] >= 0.0) { rowUpperWork_[i] = rowLowerWork_[i]; } else if (rowUpperWork_[i] <= 0.0) { rowLowerWork_[i] = rowUpperWork_[i]; } else { rowUpperWork_[i] = 0.0; rowLowerWork_[i] = 0.0; } } } } else if (upperValue < 1.0e20) { rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = upperValue; } else { // free rowLowerWork_[i] = -COIN_DBL_MAX; rowUpperWork_[i] = COIN_DBL_MAX; } } } #ifndef NDEBUG if ((specialOptions_ & 65536) != 0 && false) { assert (!initial); int save = maximumColumns_ + maximumRows_; for (int i = 0; i < numberTotal; i++) { assert (fabs(lower_[i] - lower_[i+save]) < 1.0e-5); assert (fabs(upper_[i] - upper_[i+save]) < 1.0e-5); } } #endif } // Does objective void ClpSimplex::createRim4(bool initial) { int i; int numberRows2 = numberRows_ + numberExtraRows_; int numberTotal = numberRows2 + numberColumns_; if ((specialOptions_ & 65536) != 0 && true) { assert (!initial); int save = maximumColumns_ + maximumRows_; CoinMemcpyN(cost_ + save, numberTotal, cost_); return; } double direction = optimizationDirection_ * objectiveScale_; const double * obj = objective(); const double * rowScale = rowScale_; const double * columnScale = columnScale_; // and also scale by scale factors if (rowScale) { if (rowObjective_) { for (i = 0; i < numberRows_; i++) rowObjectiveWork_[i] = rowObjective_[i] * direction / rowScale[i]; } else { memset(rowObjectiveWork_, 0, numberRows_ * sizeof(double)); } // If scaled then do all columns later in one loop if (!initial) { for (i = 0; i < numberColumns_; i++) { CoinAssert(fabs(obj[i]) < 1.0e25); objectiveWork_[i] = obj[i] * direction * columnScale[i]; } } } else { if (rowObjective_) { for (i = 0; i < numberRows_; i++) rowObjectiveWork_[i] = rowObjective_[i] * direction; } else { memset(rowObjectiveWork_, 0, numberRows_ * sizeof(double)); } for (i = 0; i < numberColumns_; i++) { CoinAssert(fabs(obj[i]) < 1.0e25); objectiveWork_[i] = obj[i] * direction; } } } // Does rows and columns and objective void ClpSimplex::createRim5(bool initial) { createRim4(initial); createRim1(initial); } void ClpSimplex::deleteRim(int getRidOfFactorizationData) { // Just possible empty problem int numberRows = numberRows_; int numberColumns = numberColumns_; if (!numberRows || !numberColumns) { numberRows = 0; if (objective_->type() < 2) numberColumns = 0; } int i; if (problemStatus_ != 1 && problemStatus_ != 2) { delete [] ray_; ray_ = NULL; } // set upperOut_ to furthest away from bound so can use in dual for dualBound_ upperOut_ = 1.0; #if 0 { int nBad = 0; for (i = 0; i < numberColumns; i++) { if (lower_[i] == upper_[i] && getColumnStatus(i) == basic) nBad++; } if (nBad) printf("yy %d basic fixed\n", nBad); } #endif if ((moreSpecialOptions_&4194304)!=0) { // preset tolerances were changed moreSpecialOptions_ &= ~4194304; primalTolerance_=1.0e-7; dblParam_[ClpPrimalTolerance]=primalTolerance_; dualTolerance_=1.0e-7; dblParam_[ClpDualTolerance]=dualTolerance_; } // ray may be null if in branch and bound if (rowScale_) { // Collect infeasibilities int numberPrimalScaled = 0; int numberPrimalUnscaled = 0; int numberDualScaled = 0; int numberDualUnscaled = 0; double scaleC = 1.0 / objectiveScale_; double scaleR = 1.0 / rhsScale_; const double * inverseScale = inverseColumnScale_; for (i = 0; i < numberColumns; i++) { double scaleFactor = columnScale_[i]; double valueScaled = columnActivityWork_[i]; double lowerScaled = columnLowerWork_[i]; double upperScaled = columnUpperWork_[i]; if (lowerScaled > -1.0e20 || upperScaled < 1.0e20) { if (valueScaled < lowerScaled - primalTolerance_ || valueScaled > upperScaled + primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_, CoinMin(valueScaled - lowerScaled, upperScaled - valueScaled)); } columnActivity_[i] = valueScaled * scaleFactor * scaleR; double value = columnActivity_[i]; if (value < columnLower_[i] - primalTolerance_) numberPrimalUnscaled++; else if (value > columnUpper_[i] + primalTolerance_) numberPrimalUnscaled++; double valueScaledDual = reducedCostWork_[i]; if (valueScaled > columnLowerWork_[i] + primalTolerance_ && valueScaledDual > dualTolerance_) numberDualScaled++; if (valueScaled < columnUpperWork_[i] - primalTolerance_ && valueScaledDual < -dualTolerance_) numberDualScaled++; reducedCost_[i] = (valueScaledDual * scaleC) * inverseScale[i]; double valueDual = reducedCost_[i]; if (value > columnLower_[i] + primalTolerance_ && valueDual > dualTolerance_) numberDualUnscaled++; if (value < columnUpper_[i] - primalTolerance_ && valueDual < -dualTolerance_) numberDualUnscaled++; } inverseScale = inverseRowScale_; for (i = 0; i < numberRows; i++) { double scaleFactor = rowScale_[i]; double valueScaled = rowActivityWork_[i]; double lowerScaled = rowLowerWork_[i]; double upperScaled = rowUpperWork_[i]; if (lowerScaled > -1.0e20 || upperScaled < 1.0e20) { if (valueScaled < lowerScaled - primalTolerance_ || valueScaled > upperScaled + primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_, CoinMin(valueScaled - lowerScaled, upperScaled - valueScaled)); } rowActivity_[i] = (valueScaled * scaleR) * inverseScale[i]; double value = rowActivity_[i]; if (value < rowLower_[i] - primalTolerance_) numberPrimalUnscaled++; else if (value > rowUpper_[i] + primalTolerance_) numberPrimalUnscaled++; double valueScaledDual = dual_[i] + rowObjectiveWork_[i];; if (valueScaled > rowLowerWork_[i] + primalTolerance_ && valueScaledDual > dualTolerance_) numberDualScaled++; if (valueScaled < rowUpperWork_[i] - primalTolerance_ && valueScaledDual < -dualTolerance_) numberDualScaled++; dual_[i] *= scaleFactor * scaleC; double valueDual = dual_[i]; if (rowObjective_) valueDual += rowObjective_[i]; if (value > rowLower_[i] + primalTolerance_ && valueDual > dualTolerance_) numberDualUnscaled++; if (value < rowUpper_[i] - primalTolerance_ && valueDual < -dualTolerance_) numberDualUnscaled++; } if (!problemStatus_ && !secondaryStatus_) { // See if we need to set secondary status if (numberPrimalUnscaled) { if (numberDualUnscaled) secondaryStatus_ = 4; else secondaryStatus_ = 2; } else { if (numberDualUnscaled) secondaryStatus_ = 3; } } if (problemStatus_ == 2 && ray_) { for (i = 0; i < numberColumns; i++) { ray_[i] *= columnScale_[i]; } } else if (problemStatus_ == 1 && ray_) { for (i = 0; i < numberRows; i++) { ray_[i] *= rowScale_[i]; } } } else if (rhsScale_ != 1.0 || objectiveScale_ != 1.0) { // Collect infeasibilities int numberPrimalScaled = 0; int numberPrimalUnscaled = 0; int numberDualScaled = 0; int numberDualUnscaled = 0; double scaleC = 1.0 / objectiveScale_; double scaleR = 1.0 / rhsScale_; for (i = 0; i < numberColumns; i++) { double valueScaled = columnActivityWork_[i]; double lowerScaled = columnLowerWork_[i]; double upperScaled = columnUpperWork_[i]; if (lowerScaled > -1.0e20 || upperScaled < 1.0e20) { if (valueScaled < lowerScaled - primalTolerance_ || valueScaled > upperScaled + primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_, CoinMin(valueScaled - lowerScaled, upperScaled - valueScaled)); } columnActivity_[i] = valueScaled * scaleR; double value = columnActivity_[i]; if (value < columnLower_[i] - primalTolerance_) numberPrimalUnscaled++; else if (value > columnUpper_[i] + primalTolerance_) numberPrimalUnscaled++; double valueScaledDual = reducedCostWork_[i]; if (valueScaled > columnLowerWork_[i] + primalTolerance_ && valueScaledDual > dualTolerance_) numberDualScaled++; if (valueScaled < columnUpperWork_[i] - primalTolerance_ && valueScaledDual < -dualTolerance_) numberDualScaled++; reducedCost_[i] = valueScaledDual * scaleC; double valueDual = reducedCost_[i]; if (value > columnLower_[i] + primalTolerance_ && valueDual > dualTolerance_) numberDualUnscaled++; if (value < columnUpper_[i] - primalTolerance_ && valueDual < -dualTolerance_) numberDualUnscaled++; } for (i = 0; i < numberRows; i++) { double valueScaled = rowActivityWork_[i]; double lowerScaled = rowLowerWork_[i]; double upperScaled = rowUpperWork_[i]; if (lowerScaled > -1.0e20 || upperScaled < 1.0e20) { if (valueScaled < lowerScaled - primalTolerance_ || valueScaled > upperScaled + primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_, CoinMin(valueScaled - lowerScaled, upperScaled - valueScaled)); } rowActivity_[i] = valueScaled * scaleR; double value = rowActivity_[i]; if (value < rowLower_[i] - primalTolerance_) numberPrimalUnscaled++; else if (value > rowUpper_[i] + primalTolerance_) numberPrimalUnscaled++; double valueScaledDual = dual_[i] + rowObjectiveWork_[i];; if (valueScaled > rowLowerWork_[i] + primalTolerance_ && valueScaledDual > dualTolerance_) numberDualScaled++; if (valueScaled < rowUpperWork_[i] - primalTolerance_ && valueScaledDual < -dualTolerance_) numberDualScaled++; dual_[i] *= scaleC; double valueDual = dual_[i]; if (rowObjective_) valueDual += rowObjective_[i]; if (value > rowLower_[i] + primalTolerance_ && valueDual > dualTolerance_) numberDualUnscaled++; if (value < rowUpper_[i] - primalTolerance_ && valueDual < -dualTolerance_) numberDualUnscaled++; } if (!problemStatus_ && !secondaryStatus_) { // See if we need to set secondary status if (numberPrimalUnscaled) { if (numberDualUnscaled) secondaryStatus_ = 4; else secondaryStatus_ = 2; } else { if (numberDualUnscaled) secondaryStatus_ = 3; } } } else { if (columnActivityWork_) { for (i = 0; i < numberColumns; i++) { double value = columnActivityWork_[i]; double lower = columnLowerWork_[i]; double upper = columnUpperWork_[i]; if (lower > -1.0e20 || upper < 1.0e20) { if (value > lower && value < upper) upperOut_ = CoinMax(upperOut_, CoinMin(value - lower, upper - value)); } columnActivity_[i] = columnActivityWork_[i]; reducedCost_[i] = reducedCostWork_[i]; } for (i = 0; i < numberRows; i++) { double value = rowActivityWork_[i]; double lower = rowLowerWork_[i]; double upper = rowUpperWork_[i]; if (lower > -1.0e20 || upper < 1.0e20) { if (value > lower && value < upper) upperOut_ = CoinMax(upperOut_, CoinMin(value - lower, upper - value)); } rowActivity_[i] = rowActivityWork_[i]; } } } // switch off scalefactor if auto if (automaticScale_) { rhsScale_ = 1.0; objectiveScale_ = 1.0; } if (optimizationDirection_ != 1.0) { // and modify all dual signs for (i = 0; i < numberColumns; i++) reducedCost_[i] *= optimizationDirection_; for (i = 0; i < numberRows; i++) dual_[i] *= optimizationDirection_; } // scaling may have been turned off scalingFlag_ = abs(scalingFlag_); if(getRidOfFactorizationData > 0) { gutsOfDelete(getRidOfFactorizationData + 1); } else { // at least get rid of nonLinearCost_ delete nonLinearCost_; nonLinearCost_ = NULL; } if (!rowObjective_ && problemStatus_ == 0 && objective_->type() == 1 && numberRows && numberColumns) { // Redo objective value double objectiveValue = 0.0; const double * cost = objective(); for (int i = 0; i < numberColumns; i++) { double value = columnActivity_[i]; objectiveValue += value * cost[i]; } //if (fabs(objectiveValue_ -objectiveValue*optimizationDirection())>1.0e-5) //printf("old obj %g new %g\n",objectiveValue_, objectiveValue*optimizationDirection()); objectiveValue_ = objectiveValue * optimizationDirection(); } // get rid of data matrix_->generalExpanded(this, 13, scalingFlag_); } void ClpSimplex::setDualBound(double value) { if (value > 0.0) dualBound_ = value; } void ClpSimplex::setInfeasibilityCost(double value) { if (value > 0.0) infeasibilityCost_ = value; } void ClpSimplex::setNumberRefinements( int value) { if (value >= 0 && value < 10) numberRefinements_ = value; } // Sets row pivot choice algorithm in dual void ClpSimplex::setDualRowPivotAlgorithm(ClpDualRowPivot & choice) { delete dualRowPivot_; dualRowPivot_ = choice.clone(true); dualRowPivot_->setModel(this); } // Sets column pivot choice algorithm in primal void ClpSimplex::setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot & choice) { delete primalColumnPivot_; primalColumnPivot_ = choice.clone(true); primalColumnPivot_->setModel(this); } void ClpSimplex::setFactorization( ClpFactorization & factorization) { if (factorization_) factorization_->setFactorization(factorization); else factorization_ = new ClpFactorization(factorization, numberRows_); } // Swaps factorization ClpFactorization * ClpSimplex::swapFactorization( ClpFactorization * factorization) { ClpFactorization * swap = factorization_; factorization_ = factorization; return swap; } // Copies in factorization to existing one void ClpSimplex::copyFactorization( ClpFactorization & factorization) { *factorization_ = factorization; } /* Perturbation: -50 to +50 - perturb by this power of ten (-6 sounds good) 100 - auto perturb if takes too long (1.0e-6 largest nonzero) 101 - we are perturbed 102 - don't try perturbing again default is 100 */ void ClpSimplex::setPerturbation(int value) { if(value <= 100 && value >= -1000) { perturbation_ = value; } } // Sparsity on or off bool ClpSimplex::sparseFactorization() const { return factorization_->sparseThreshold() != 0; } void ClpSimplex::setSparseFactorization(bool value) { if (value) { if (!factorization_->sparseThreshold()) factorization_->goSparse(); } else { factorization_->sparseThreshold(0); } } void checkCorrect(ClpSimplex * /*model*/, int iRow, const double * element, const int * rowStart, const int * rowLength, const int * column, const double * columnLower_, const double * columnUpper_, int /*infiniteUpperC*/, int /*infiniteLowerC*/, double &maximumUpC, double &maximumDownC) { int infiniteUpper = 0; int infiniteLower = 0; double maximumUp = 0.0; double maximumDown = 0.0; CoinBigIndex rStart = rowStart[iRow]; CoinBigIndex rEnd = rowStart[iRow] + rowLength[iRow]; CoinBigIndex j; double large = 1.0e15; int iColumn; // Compute possible lower and upper ranges for (j = rStart; j < rEnd; ++j) { double value = element[j]; iColumn = column[j]; if (value > 0.0) { if (columnUpper_[iColumn] >= large) { ++infiniteUpper; } else { maximumUp += columnUpper_[iColumn] * value; } if (columnLower_[iColumn] <= -large) { ++infiniteLower; } else { maximumDown += columnLower_[iColumn] * value; } } else if (value < 0.0) { if (columnUpper_[iColumn] >= large) { ++infiniteLower; } else { maximumDown += columnUpper_[iColumn] * value; } if (columnLower_[iColumn] <= -large) { ++infiniteUpper; } else { maximumUp += columnLower_[iColumn] * value; } } } //assert (infiniteLowerC==infiniteLower); //assert (infiniteUpperC==infiniteUpper); if (fabs(maximumUp - maximumUpC) > 1.0e-12 * CoinMax(fabs(maximumUp), fabs(maximumUpC))) COIN_DETAIL_PRINT(printf("row %d comp up %g, true up %g\n", iRow, maximumUpC, maximumUp)); if (fabs(maximumDown - maximumDownC) > 1.0e-12 * CoinMax(fabs(maximumDown), fabs(maximumDownC))) COIN_DETAIL_PRINT(printf("row %d comp down %g, true down %g\n", iRow, maximumDownC, maximumDown)); maximumUpC = maximumUp; maximumDownC = maximumDown; } /* Tightens primal bounds to make dual faster. Unless fixed, bounds are slightly looser than they could be. This is to make dual go faster and is probably not needed with a presolve. Returns non-zero if problem infeasible Fudge for branch and bound - put bounds on columns of factor * largest value (at continuous) - should improve stability in branch and bound on infeasible branches (0.0 is off) */ int ClpSimplex::tightenPrimalBounds(double factor, int doTight, bool tightIntegers) { // Get a row copy in standard format CoinPackedMatrix copy; copy.setExtraGap(0.0); copy.setExtraMajor(0.0); copy.reverseOrderedCopyOf(*matrix()); // Matrix may have been created so get rid of it matrix_->releasePackedMatrix(); // get matrix data pointers const int * column = copy.getIndices(); const CoinBigIndex * rowStart = copy.getVectorStarts(); const int * rowLength = copy.getVectorLengths(); const double * element = copy.getElements(); int numberChanged = 1, iPass = 0; double large = largeValue(); // treat bounds > this as infinite #ifndef NDEBUG double large2 = 1.0e10 * large; #endif int numberInfeasible = 0; int totalTightened = 0; double tolerance = primalTolerance(); // Save column bounds double * saveLower = new double [numberColumns_]; CoinMemcpyN(columnLower_, numberColumns_, saveLower); double * saveUpper = new double [numberColumns_]; CoinMemcpyN(columnUpper_, numberColumns_, saveUpper); int iRow, iColumn; // If wanted compute a reasonable dualBound_ if (factor == COIN_DBL_MAX) { factor = 0.0; if (dualBound_ == 1.0e10) { // get largest scaled away from bound double largest = 1.0e-12; double largestScaled = 1.0e-12; int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { double value = rowActivity_[iRow]; double above = value - rowLower_[iRow]; double below = rowUpper_[iRow] - value; if (above < 1.0e12) { largest = CoinMax(largest, above); } if (below < 1.0e12) { largest = CoinMax(largest, below); } if (rowScale_) { double multiplier = rowScale_[iRow]; above *= multiplier; below *= multiplier; } if (above < 1.0e12) { largestScaled = CoinMax(largestScaled, above); } if (below < 1.0e12) { largestScaled = CoinMax(largestScaled, below); } } int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double value = columnActivity_[iColumn]; double above = value - columnLower_[iColumn]; double below = columnUpper_[iColumn] - value; if (above < 1.0e12) { largest = CoinMax(largest, above); } if (below < 1.0e12) { largest = CoinMax(largest, below); } if (columnScale_) { double multiplier = 1.0 / columnScale_[iColumn]; above *= multiplier; below *= multiplier; } if (above < 1.0e12) { largestScaled = CoinMax(largestScaled, above); } if (below < 1.0e12) { largestScaled = CoinMax(largestScaled, below); } } std::cout << "Largest (scaled) away from bound " << largestScaled << " unscaled " << largest << std::endl; dualBound_ = CoinMax(1.0001e7, CoinMin(100.0 * largest, 1.00001e10)); } } // If wanted - tighten column bounds using solution if (factor) { double largest = 0.0; if (factor > 0.0) { assert (factor > 1.0); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnUpper_[iColumn] - columnLower_[iColumn] > tolerance) { largest = CoinMax(largest, fabs(columnActivity_[iColumn])); } } largest *= factor; } else { // absolute largest = - factor; } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnUpper_[iColumn] - columnLower_[iColumn] > tolerance) { columnUpper_[iColumn] = CoinMin(columnUpper_[iColumn], largest); columnLower_[iColumn] = CoinMax(columnLower_[iColumn], -largest); } } } #define MAXPASS 10 // Loop round seeing if we can tighten bounds // Would be faster to have a stack of possible rows // and we put altered rows back on stack int numberCheck = -1; while(numberChanged > numberCheck) { numberChanged = 0; // Bounds tightened this pass if (iPass == MAXPASS) break; iPass++; for (iRow = 0; iRow < numberRows_; iRow++) { if (rowLower_[iRow] > -large || rowUpper_[iRow] < large) { // possible row int infiniteUpper = 0; int infiniteLower = 0; double maximumUp = 0.0; double maximumDown = 0.0; double newBound; CoinBigIndex rStart = rowStart[iRow]; CoinBigIndex rEnd = rowStart[iRow] + rowLength[iRow]; CoinBigIndex j; // Compute possible lower and upper ranges for (j = rStart; j < rEnd; ++j) { double value = element[j]; iColumn = column[j]; if (value > 0.0) { if (columnUpper_[iColumn] >= large) { ++infiniteUpper; } else { maximumUp += columnUpper_[iColumn] * value; } if (columnLower_[iColumn] <= -large) { ++infiniteLower; } else { maximumDown += columnLower_[iColumn] * value; } } else if (value < 0.0) { if (columnUpper_[iColumn] >= large) { ++infiniteLower; } else { maximumDown += columnUpper_[iColumn] * value; } if (columnLower_[iColumn] <= -large) { ++infiniteUpper; } else { maximumUp += columnLower_[iColumn] * value; } } } // Build in a margin of error maximumUp += 1.0e-8 * fabs(maximumUp); maximumDown -= 1.0e-8 * fabs(maximumDown); double maxUp = maximumUp + infiniteUpper * 1.0e31; double maxDown = maximumDown - infiniteLower * 1.0e31; if (maxUp <= rowUpper_[iRow] + tolerance && maxDown >= rowLower_[iRow] - tolerance) { // Row is redundant - make totally free // NO - can't do this for postsolve // rowLower_[iRow]=-COIN_DBL_MAX; // rowUpper_[iRow]=COIN_DBL_MAX; //printf("Redundant row in presolveX %d\n",iRow); } else { if (maxUp < rowLower_[iRow] - 100.0 * tolerance || maxDown > rowUpper_[iRow] + 100.0 * tolerance) { // problem is infeasible - exit at once numberInfeasible++; break; } double lower = rowLower_[iRow]; double upper = rowUpper_[iRow]; for (j = rStart; j < rEnd; ++j) { double value = element[j]; iColumn = column[j]; double nowLower = columnLower_[iColumn]; double nowUpper = columnUpper_[iColumn]; if (value > 0.0) { // positive value if (lower > -large) { if (!infiniteUpper) { assert(nowUpper < large2); newBound = nowUpper + (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumUp); } else if (infiniteUpper == 1 && nowUpper > large) { newBound = (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumUp); } else { newBound = -COIN_DBL_MAX; } if (newBound > nowLower + 1.0e-12 && newBound > -large) { // Tighten the lower bound numberChanged++; // check infeasible (relaxed) if (nowUpper < newBound) { if (nowUpper - newBound < -100.0 * tolerance) numberInfeasible++; else newBound = nowUpper; } columnLower_[iColumn] = newBound; // adjust double now; if (nowLower < -large) { now = 0.0; infiniteLower--; } else { now = nowLower; } maximumDown += (newBound - now) * value; nowLower = newBound; #ifdef DEBUG checkCorrect(this, iRow, element, rowStart, rowLength, column, columnLower_, columnUpper_, infiniteUpper, infiniteLower, maximumUp, maximumDown); #endif } } if (upper < large) { if (!infiniteLower) { assert(nowLower > - large2); newBound = nowLower + (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound += 1.0e-12 * fabs(maximumDown); } else if (infiniteLower == 1 && nowLower < -large) { newBound = (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound += 1.0e-12 * fabs(maximumDown); } else { newBound = COIN_DBL_MAX; } if (newBound < nowUpper - 1.0e-12 && newBound < large) { // Tighten the upper bound numberChanged++; // check infeasible (relaxed) if (nowLower > newBound) { if (newBound - nowLower < -100.0 * tolerance) numberInfeasible++; else newBound = nowLower; } columnUpper_[iColumn] = newBound; // adjust double now; if (nowUpper > large) { now = 0.0; infiniteUpper--; } else { now = nowUpper; } maximumUp += (newBound - now) * value; nowUpper = newBound; #ifdef DEBUG checkCorrect(this, iRow, element, rowStart, rowLength, column, columnLower_, columnUpper_, infiniteUpper, infiniteLower, maximumUp, maximumDown); #endif } } } else { // negative value if (lower > -large) { if (!infiniteUpper) { assert(nowLower < large2); newBound = nowLower + (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound += 1.0e-12 * fabs(maximumUp); } else if (infiniteUpper == 1 && nowLower < -large) { newBound = (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound += 1.0e-12 * fabs(maximumUp); } else { newBound = COIN_DBL_MAX; } if (newBound < nowUpper - 1.0e-12 && newBound < large) { // Tighten the upper bound numberChanged++; // check infeasible (relaxed) if (nowLower > newBound) { if (newBound - nowLower < -100.0 * tolerance) numberInfeasible++; else newBound = nowLower; } columnUpper_[iColumn] = newBound; // adjust double now; if (nowUpper > large) { now = 0.0; infiniteLower--; } else { now = nowUpper; } maximumDown += (newBound - now) * value; nowUpper = newBound; #ifdef DEBUG checkCorrect(this, iRow, element, rowStart, rowLength, column, columnLower_, columnUpper_, infiniteUpper, infiniteLower, maximumUp, maximumDown); #endif } } if (upper < large) { if (!infiniteLower) { assert(nowUpper < large2); newBound = nowUpper + (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumDown); } else if (infiniteLower == 1 && nowUpper > large) { newBound = (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumDown); } else { newBound = -COIN_DBL_MAX; } if (newBound > nowLower + 1.0e-12 && newBound > -large) { // Tighten the lower bound numberChanged++; // check infeasible (relaxed) if (nowUpper < newBound) { if (nowUpper - newBound < -100.0 * tolerance) numberInfeasible++; else newBound = nowUpper; } columnLower_[iColumn] = newBound; // adjust double now; if (nowLower < -large) { now = 0.0; infiniteUpper--; } else { now = nowLower; } maximumUp += (newBound - now) * value; nowLower = newBound; #ifdef DEBUG checkCorrect(this, iRow, element, rowStart, rowLength, column, columnLower_, columnUpper_, infiniteUpper, infiniteLower, maximumUp, maximumDown); #endif } } } } } } } totalTightened += numberChanged; if (iPass == 1) numberCheck = numberChanged >> 4; if (numberInfeasible) break; } if (!numberInfeasible) { handler_->message(CLP_SIMPLEX_BOUNDTIGHTEN, messages_) << totalTightened << CoinMessageEol; // Set bounds slightly loose double useTolerance = 1.0e-3; if (doTight > 0) { if (doTight > 10) { useTolerance = 0.0; } else { while (doTight) { useTolerance *= 0.1; doTight--; } } } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (saveUpper[iColumn] > saveLower[iColumn] + useTolerance) { // Make large bounds stay infinite if (saveUpper[iColumn] > 1.0e30 && columnUpper_[iColumn] > 1.0e10) { columnUpper_[iColumn] = COIN_DBL_MAX; } if (saveLower[iColumn] < -1.0e30 && columnLower_[iColumn] < -1.0e10) { columnLower_[iColumn] = -COIN_DBL_MAX; } #ifdef KEEP_GOING_IF_FIXED double multiplier = 5.0e-3 * floor(100.0 * randomNumberGenerator_.randomDouble()) + 1.0; multiplier *= 100.0; #else double multiplier = 100.0; #endif if (columnUpper_[iColumn] - columnLower_[iColumn] < useTolerance + 1.0e-8) { // relax enough so will have correct dj #if 1 columnLower_[iColumn] = CoinMax(saveLower[iColumn], columnLower_[iColumn] - multiplier * useTolerance); columnUpper_[iColumn] = CoinMin(saveUpper[iColumn], columnUpper_[iColumn] + multiplier * useTolerance); #else if (fabs(columnUpper_[iColumn]) < fabs(columnLower_[iColumn])) { if (columnUpper_[iColumn] - multiplier * useTolerance > saveLower[iColumn]) { columnLower_[iColumn] = columnUpper_[iColumn] - multiplier * useTolerance; } else { columnLower_[iColumn] = saveLower[iColumn]; columnUpper_[iColumn] = CoinMin(saveUpper[iColumn], saveLower[iColumn] + multiplier * useTolerance); } } else { if (columnLower_[iColumn] + multiplier * useTolerance < saveUpper[iColumn]) { columnUpper_[iColumn] = columnLower_[iColumn] + multiplier * useTolerance; } else { columnUpper_[iColumn] = saveUpper[iColumn]; columnLower_[iColumn] = CoinMax(saveLower[iColumn], saveUpper[iColumn] - multiplier * useTolerance); } } #endif } else { if (columnUpper_[iColumn] < saveUpper[iColumn]) { // relax a bit columnUpper_[iColumn] = CoinMin(columnUpper_[iColumn] + multiplier * useTolerance, saveUpper[iColumn]); } if (columnLower_[iColumn] > saveLower[iColumn]) { // relax a bit columnLower_[iColumn] = CoinMax(columnLower_[iColumn] - multiplier * useTolerance, saveLower[iColumn]); } } } } if (tightIntegers && integerType_) { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (integerType_[iColumn]) { double value; value = floor(columnLower_[iColumn] + 0.5); if (fabs(value - columnLower_[iColumn]) > primalTolerance_) value = ceil(columnLower_[iColumn]); columnLower_[iColumn] = value; value = floor(columnUpper_[iColumn] + 0.5); if (fabs(value - columnUpper_[iColumn]) > primalTolerance_) value = floor(columnUpper_[iColumn]); columnUpper_[iColumn] = value; if (columnLower_[iColumn] > columnUpper_[iColumn]) numberInfeasible++; } } if (numberInfeasible) { handler_->message(CLP_SIMPLEX_INFEASIBILITIES, messages_) << numberInfeasible << CoinMessageEol; // restore column bounds CoinMemcpyN(saveLower, numberColumns_, columnLower_); CoinMemcpyN(saveUpper, numberColumns_, columnUpper_); } } } else { handler_->message(CLP_SIMPLEX_INFEASIBILITIES, messages_) << numberInfeasible << CoinMessageEol; // restore column bounds CoinMemcpyN(saveLower, numberColumns_, columnLower_); CoinMemcpyN(saveUpper, numberColumns_, columnUpper_); } delete [] saveLower; delete [] saveUpper; return (numberInfeasible); } //#define SAVE_AND_RESTORE // dual #include "ClpSimplexDual.hpp" #include "ClpSimplexPrimal.hpp" #ifndef SAVE_AND_RESTORE int ClpSimplex::dual (int ifValuesPass , int startFinishOptions) #else int ClpSimplex::dual (int ifValuesPass , int startFinishOptions) { // May be empty problem if (numberRows_ && numberColumns_) { // Save on file for debug int returnCode; returnCode = saveModel("debug.sav"); if (returnCode) { printf("** Unable to save model to debug.sav\n"); abort(); } ClpSimplex temp; returnCode = temp.restoreModel("debug.sav"); if (returnCode) { printf("** Unable to restore model from debug.sav\n"); abort(); } temp.setLogLevel(handler_->logLevel()); // Now do dual returnCode = temp.dualDebug(ifValuesPass, startFinishOptions); // Move status and solution back int numberTotal = numberRows_ + numberColumns_; CoinMemcpyN(temp.statusArray(), numberTotal, status_); CoinMemcpyN(temp.primalColumnSolution(), numberColumns_, columnActivity_); CoinMemcpyN(temp.primalRowSolution(), numberRows_, rowActivity_); CoinMemcpyN(temp.dualColumnSolution(), numberColumns_, reducedCost_); CoinMemcpyN(temp.dualRowSolution(), numberRows_, dual_); problemStatus_ = temp.problemStatus_; setObjectiveValue(temp.objectiveValue()); setSumDualInfeasibilities(temp.sumDualInfeasibilities()); setNumberDualInfeasibilities(temp.numberDualInfeasibilities()); setSumPrimalInfeasibilities(temp.sumPrimalInfeasibilities()); setNumberPrimalInfeasibilities(temp.numberPrimalInfeasibilities()); setNumberIterations(temp.numberIterations()); onStopped(); // set secondary status if stopped return returnCode; } else { // empty return dualDebug(ifValuesPass, startFinishOptions); } } int ClpSimplex::dualDebug (int ifValuesPass , int startFinishOptions) #endif { //double savedPivotTolerance = factorization_->pivotTolerance(); int saveQuadraticActivated = 0; if (objective_) { saveQuadraticActivated = objective_->activated(); objective_->setActivated(0); } else { // create dummy stuff assert (!numberColumns_); if (!numberRows_) problemStatus_ = 0; // say optimal return 0; } ClpObjective * saveObjective = objective_; CoinAssert (ifValuesPass >= 0 && ifValuesPass < 3); /* Note use of "down casting". The only class the user sees is ClpSimplex. Classes ClpSimplexDual, ClpSimplexPrimal, (ClpSimplexNonlinear) and ClpSimplexOther all exist and inherit from ClpSimplex but have no additional data and have no destructor or (non-default) constructor. This is to stop classes becoming too unwieldy and so I (JJF) can use e.g. "perturb" in primal and dual. As far as I can see this is perfectly safe. */ #ifdef COIN_DEVELOP //#define EXPENSIVE #endif for (int i=0;i (this)->dual(ifValuesPass, startFinishOptions); #ifdef EXPENSIVE if (problemStatus_ == 1) { saveModel.allSlackBasis(true); static_cast (&saveModel)->dual(0, 0); if (saveModel.problemStatus_ == 0) { if (saveModel.objectiveValue() < dblParam_[0] - 1.0e-8 * (1.0 + fabs(dblParam_[0]))) { if (objectiveValue() < dblParam_[0] - 1.0e-6 * (1.0 + fabs(dblParam_[0]))) { printf("BAD dual - objs %g ,savemodel %g cutoff %g at count %d\n", objectiveValue(), saveModel.objectiveValue(), dblParam_[0], dualCount); saveModel = *this; saveModel.setLogLevel(63); static_cast (&saveModel)->dual(0, 0); // flatten solution and try again int iRow, iColumn; for (iRow = 0; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) != basic) { setRowStatus(iRow, superBasic); // but put to bound if close if (fabs(rowActivity_[iRow] - rowLower_[iRow]) <= primalTolerance_) { rowActivity_[iRow] = rowLower_[iRow]; setRowStatus(iRow, atLowerBound); } else if (fabs(rowActivity_[iRow] - rowUpper_[iRow]) <= primalTolerance_) { rowActivity_[iRow] = rowUpper_[iRow]; setRowStatus(iRow, atUpperBound); } } } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (getColumnStatus(iColumn) != basic) { setColumnStatus(iColumn, superBasic); // but put to bound if close if (fabs(columnActivity_[iColumn] - columnLower_[iColumn]) <= primalTolerance_) { columnActivity_[iColumn] = columnLower_[iColumn]; setColumnStatus(iColumn, atLowerBound); } else if (fabs(columnActivity_[iColumn] - columnUpper_[iColumn]) <= primalTolerance_) { columnActivity_[iColumn] = columnUpper_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } } static_cast (&saveModel)->primal(0, 0); } else { printf("bad? dual - objs %g ,savemodel %g cutoff %g at count %d\n", objectiveValue(), saveModel.objectiveValue(), dblParam_[0], dualCount); } if (dualCount > dualCheckCount && dualCheckCount >= 0) abort(); } } } #endif //int lastAlgorithm = -1; if ((specialOptions_ & 2048) != 0 && problemStatus_ == 10 && !numberPrimalInfeasibilities_ && sumDualInfeasibilities_ < 1000.0 * dualTolerance_ && perturbation_ >= 100) problemStatus_ = 0; // ignore if (problemStatus_==1&&((specialOptions_&(1024 | 4096)) == 0 || (specialOptions_ & 32) != 0) &&numberFake_) { problemStatus_ = 10; // clean up in primal as fake bounds } if ((moreSpecialOptions_&524288)!=0&& (!nonLinearCost_||!nonLinearCost_->numberInfeasibilities())&& fabs(dblParam_[ClpDualObjectiveLimit])>1.0e30) { problemStatus_=0; } if (problemStatus_ == 10) { //printf("Cleaning up with primal\n"); #ifdef COIN_DEVELOP int saveNumberIterations = numberIterations_; #endif //lastAlgorithm=1; int savePerturbation = perturbation_; int saveLog = handler_->logLevel(); //handler_->setLogLevel(63); perturbation_ = 100; bool denseFactorization = initialDenseFactorization(); // It will be safe to allow dense setInitialDenseFactorization(true); // Allow for catastrophe int saveMax = intParam_[ClpMaxNumIteration]; if (numberIterations_) { // normal if (intParam_[ClpMaxNumIteration] > 100000 + numberIterations_) intParam_[ClpMaxNumIteration] = numberIterations_ + 1000 + 2 * numberRows_ + numberColumns_; } else { // Not normal allow more baseIteration_ += 2 * (numberRows_ + numberColumns_); } // check which algorithms allowed int dummy; ClpPackedMatrix * ordinary = dynamic_cast< ClpPackedMatrix*>(matrix_); if (problemStatus_ == 10 && saveObjective == objective_ && ordinary) startFinishOptions |= 2; baseIteration_ = numberIterations_; // Say second call moreSpecialOptions_ |= 256; if ((matrix_->generalExpanded(this, 4, dummy) & 1) != 0) returnCode = static_cast (this)->primal(1, startFinishOptions); else returnCode = static_cast (this)->dual(0, startFinishOptions); // Say not second call moreSpecialOptions_ &= ~256; baseIteration_ = 0; bool inCbcOrOther = (specialOptions_ & 0x03000000) != 0; if (inCbcOrOther) { delete [] ray_; ray_ = NULL; } if (saveObjective != objective_) { // We changed objective to see if infeasible delete objective_; objective_ = saveObjective; if (!problemStatus_) { // carry on returnCode = static_cast (this)->primal(1, startFinishOptions); } } if (problemStatus_ == 3 && numberIterations_ < saveMax) { #ifdef COIN_DEVELOP if (handler_->logLevel() > 0) printf("looks like trouble - too many iterations in clean up - trying again\n"); #endif // flatten solution and try again int iRow, iColumn; for (iRow = 0; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) != basic) { setRowStatus(iRow, superBasic); // but put to bound if close if (fabs(rowActivity_[iRow] - rowLower_[iRow]) <= primalTolerance_) { rowActivity_[iRow] = rowLower_[iRow]; setRowStatus(iRow, atLowerBound); } else if (fabs(rowActivity_[iRow] - rowUpper_[iRow]) <= primalTolerance_) { rowActivity_[iRow] = rowUpper_[iRow]; setRowStatus(iRow, atUpperBound); } } } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (getColumnStatus(iColumn) != basic) { setColumnStatus(iColumn, superBasic); // but put to bound if close if (fabs(columnActivity_[iColumn] - columnLower_[iColumn]) <= primalTolerance_) { columnActivity_[iColumn] = columnLower_[iColumn]; setColumnStatus(iColumn, atLowerBound); } else if (fabs(columnActivity_[iColumn] - columnUpper_[iColumn]) <= primalTolerance_) { columnActivity_[iColumn] = columnUpper_[iColumn]; setColumnStatus(iColumn, atUpperBound); } } } problemStatus_ = -1; intParam_[ClpMaxNumIteration] = CoinMin(numberIterations_ + 1000 + 2 * numberRows_ + numberColumns_, saveMax); perturbation_ = savePerturbation; baseIteration_ = numberIterations_; // Say second call moreSpecialOptions_ |= 256; returnCode = static_cast (this)->primal(0, startFinishOptions); // Say not second call moreSpecialOptions_ &= ~256; baseIteration_ = 0; computeObjectiveValue(); // can't rely on djs either memset(reducedCost_, 0, numberColumns_ * sizeof(double)); #ifdef COIN_DEVELOP if (problemStatus_ == 3 && numberIterations_ < saveMax && handler_->logLevel() > 0) printf("looks like real trouble - too many iterations in second clean up - giving up\n"); #endif } intParam_[ClpMaxNumIteration] = saveMax; setInitialDenseFactorization(denseFactorization); perturbation_ = savePerturbation; if (problemStatus_ == 10) { if (!numberPrimalInfeasibilities_) problemStatus_ = 0; else problemStatus_ = 4; } handler_->setLogLevel(saveLog); #ifdef COIN_DEVELOP if (numberIterations_ > 200) printf("after primal status %d - %d iterations (save %d)\n", problemStatus_, numberIterations_, saveNumberIterations); #endif } objective_->setActivated(saveQuadraticActivated); //factorization_->pivotTolerance(savedPivotTolerance); onStopped(); // set secondary status if stopped //if (problemStatus_==1&&lastAlgorithm==1) //returnCode=10; // so will do primal after postsolve return returnCode; } // primal int ClpSimplex::primal (int ifValuesPass , int startFinishOptions) { //double savedPivotTolerance = factorization_->pivotTolerance(); #ifndef SLIM_CLP // See if nonlinear if (objective_->type() > 1 && objective_->activated()) return reducedGradient(); #endif CoinAssert ((ifValuesPass >= 0 && ifValuesPass < 3) || (ifValuesPass >= 12 && ifValuesPass < 100) || (ifValuesPass >= 112 && ifValuesPass < 200)); if (ifValuesPass >= 12) { int numberProblems = (ifValuesPass - 10) % 100; ifValuesPass = (ifValuesPass < 100) ? 1 : 2; // Go parallel to do solve // Only if all slack basis int i; for ( i = 0; i < numberColumns_; i++) { if (getColumnStatus(i) == basic) break; } if (i == numberColumns_) { // try if vaguely feasible CoinZeroN(rowActivity_, numberRows_); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * element = matrix_->getElements(); for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex j; double value = columnActivity_[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (j = start; j < end; j++) { int iRow = row[j]; rowActivity_[iRow] += value * element[j]; } } } checkSolutionInternal(); if (sumPrimalInfeasibilities_ * sqrt(static_cast(numberRows_)) < 1.0) { // Could do better if can decompose // correction to get feasible double scaleFactor = 1.0 / numberProblems; double * correction = new double [numberRows_]; for (int iRow = 0; iRow < numberRows_; iRow++) { double value = rowActivity_[iRow]; if (value > rowUpper_[iRow]) value = rowUpper_[iRow] - value; else if (value < rowLower_[iRow]) value = rowLower_[iRow] - value; else value = 0.0; correction[iRow] = value * scaleFactor; } int numberColumns = (numberColumns_ + numberProblems - 1) / numberProblems; int * whichRows = new int [numberRows_]; for (int i = 0; i < numberRows_; i++) whichRows[i] = i; int * whichColumns = new int [numberColumns_]; ClpSimplex ** model = new ClpSimplex * [numberProblems]; int startColumn = 0; double * saveLower = CoinCopyOfArray(rowLower_, numberRows_); double * saveUpper = CoinCopyOfArray(rowUpper_, numberRows_); for (int i = 0; i < numberProblems; i++) { int endColumn = CoinMin(startColumn + numberColumns, numberColumns_); CoinZeroN(rowActivity_, numberRows_); for (int iColumn = startColumn; iColumn < endColumn; iColumn++) { whichColumns[iColumn-startColumn] = iColumn; CoinBigIndex j; double value = columnActivity_[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (j = start; j < end; j++) { int iRow = row[j]; rowActivity_[iRow] += value * element[j]; } } } // adjust rhs for (int iRow = 0; iRow < numberRows_; iRow++) { double value = rowActivity_[iRow] + correction[iRow]; if (saveUpper[iRow] < 1.0e30) rowUpper_[iRow] = value; if (saveLower[iRow] > -1.0e30) rowLower_[iRow] = value; } model[i] = new ClpSimplex(this, numberRows_, whichRows, endColumn - startColumn, whichColumns); //#define FEB_TRY #ifdef FEB_TRY model[i]->setPerturbation(perturbation_); #endif startColumn = endColumn; } memcpy(rowLower_, saveLower, numberRows_ * sizeof(double)); memcpy(rowUpper_, saveUpper, numberRows_ * sizeof(double)); delete [] saveLower; delete [] saveUpper; delete [] correction; // solve (in parallel) for (int i = 0; i < numberProblems; i++) { model[i]->primal(1/*ifValuesPass*/); } startColumn = 0; int numberBasic = 0; // use whichRows as counter for (int iRow = 0; iRow < numberRows_; iRow++) { int startValue = 0; if (rowUpper_[iRow] > rowLower_[iRow]) startValue++; if (rowUpper_[iRow] > 1.0e30) startValue++; if (rowLower_[iRow] < -1.0e30) startValue++; whichRows[iRow] = 1000 * startValue; } for (int i = 0; i < numberProblems; i++) { int endColumn = CoinMin(startColumn + numberColumns, numberColumns_); ClpSimplex * simplex = model[i]; const double * solution = simplex->columnActivity_; for (int iColumn = startColumn; iColumn < endColumn; iColumn++) { columnActivity_[iColumn] = solution[iColumn-startColumn]; Status status = simplex->getColumnStatus(iColumn - startColumn); setColumnStatus(iColumn, status); if (status == basic) numberBasic++; } for (int iRow = 0; iRow < numberRows_; iRow++) { if (simplex->getRowStatus(iRow) == basic) whichRows[iRow]++; } delete model[i]; startColumn = endColumn; } delete [] model; for (int iRow = 0; iRow < numberRows_; iRow++) setRowStatus(iRow, superBasic); CoinZeroN(rowActivity_, numberRows_); for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex j; double value = columnActivity_[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (j = start; j < end; j++) { int iRow = row[j]; rowActivity_[iRow] += value * element[j]; } } } checkSolutionInternal(); if (numberBasic < numberRows_) { int * order = new int [numberRows_]; for (int iRow = 0; iRow < numberRows_; iRow++) { setRowStatus(iRow, superBasic); int nTimes = whichRows[iRow] % 1000; if (nTimes) nTimes += whichRows[iRow] / 500; whichRows[iRow] = -nTimes; order[iRow] = iRow; } CoinSort_2(whichRows, whichRows + numberRows_, order); int nPut = numberRows_ - numberBasic; for (int i = 0; i < nPut; i++) { int iRow = order[i]; setRowStatus(iRow, basic); } delete [] order; } else if (numberBasic > numberRows_) { double * away = new double [numberBasic]; numberBasic = 0; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (getColumnStatus(iColumn) == basic) { double value = columnActivity_[iColumn]; value = CoinMin(value - columnLower_[iColumn], columnUpper_[iColumn] - value); away[numberBasic] = value; whichColumns[numberBasic++] = iColumn; } } CoinSort_2(away, away + numberBasic, whichColumns); int nPut = numberBasic - numberRows_; for (int i = 0; i < nPut; i++) { int iColumn = whichColumns[i]; double value = columnActivity_[iColumn]; if (value - columnLower_[iColumn] < columnUpper_[iColumn] - value) setColumnStatus(iColumn, atLowerBound); else setColumnStatus(iColumn, atUpperBound); } delete [] away; } delete [] whichColumns; delete [] whichRows; } } } //firstFree_=-1; /* Note use of "down casting". The only class the user sees is ClpSimplex. Classes ClpSimplexDual, ClpSimplexPrimal, (ClpSimplexNonlinear) and ClpSimplexOther all exist and inherit from ClpSimplex but have no additional data and have no destructor or (non-default) constructor. This is to stop classes becoming too unwieldy and so I (JJF) can use e.g. "perturb" in primal and dual. As far as I can see this is perfectly safe. */ int returnCode = static_cast (this)->primal(ifValuesPass, startFinishOptions); //int lastAlgorithm=1; if (problemStatus_ == 10) { //lastAlgorithm=-1; //printf("Cleaning up with dual\n"); int savePerturbation = perturbation_; perturbation_ = 100; bool denseFactorization = initialDenseFactorization(); // It will be safe to allow dense setInitialDenseFactorization(true); // check which algorithms allowed int dummy; baseIteration_ = numberIterations_; // Say second call moreSpecialOptions_ |= 256; if ((matrix_->generalExpanded(this, 4, dummy) & 2) != 0 && (specialOptions_ & 8192) == 0) { double saveBound = dualBound_; // upperOut_ has largest away from bound dualBound_ = CoinMin(CoinMax(2.0 * upperOut_, 1.0e8), dualBound_); returnCode = static_cast (this)->dual(0, startFinishOptions); dualBound_ = saveBound; } else { returnCode = static_cast (this)->primal(0, startFinishOptions); } // Say not second call moreSpecialOptions_ &= ~256; baseIteration_ = 0; setInitialDenseFactorization(denseFactorization); perturbation_ = savePerturbation; if (problemStatus_ == 10) { if (!numberPrimalInfeasibilities_) { problemStatus_ = 0; numberDualInfeasibilities_ = 0; } else { problemStatus_ = 4; } } } //factorization_->pivotTolerance(savedPivotTolerance); onStopped(); // set secondary status if stopped //if (problemStatus_==1&&lastAlgorithm==1) //returnCode=10; // so will do primal after postsolve return returnCode; } #ifndef SLIM_CLP #include "ClpQuadraticObjective.hpp" /* Dual ranging. This computes increase/decrease in cost for each given variable and corresponding sequence numbers which would change basis. Sequence numbers are 0..numberColumns and numberColumns.. for artificials/slacks. For non-basic variables the sequence number will be that of the non-basic variables. Up to user to provide correct length arrays. Returns non-zero if infeasible unbounded etc */ #include "ClpSimplexOther.hpp" int ClpSimplex::dualRanging(int numberCheck, const int * which, double * costIncrease, int * sequenceIncrease, double * costDecrease, int * sequenceDecrease, double * valueIncrease, double * valueDecrease) { int savePerturbation = perturbation_; perturbation_ = 100; /*int returnCode =*/ static_cast (this)->primal(0, 1); if (problemStatus_ == 10) { //printf("Cleaning up with dual\n"); bool denseFactorization = initialDenseFactorization(); // It will be safe to allow dense setInitialDenseFactorization(true); // check which algorithms allowed int dummy; if ((matrix_->generalExpanded(this, 4, dummy) & 2) != 0) { // upperOut_ has largest away from bound double saveBound = dualBound_; if (upperOut_ > 0.0) dualBound_ = 2.0 * upperOut_; /*returnCode =*/ static_cast (this)->dual(0, 1); dualBound_ = saveBound; } else { /*returnCode =*/ static_cast (this)->primal(0, 1); } setInitialDenseFactorization(denseFactorization); if (problemStatus_ == 10) problemStatus_ = 0; } perturbation_ = savePerturbation; if (problemStatus_ || secondaryStatus_ == 6) { finish(); // get rid of arrays return 1; // odd status } static_cast (this)->dualRanging(numberCheck, which, costIncrease, sequenceIncrease, costDecrease, sequenceDecrease, valueIncrease, valueDecrease); finish(); // get rid of arrays return 0; } /* Primal ranging. This computes increase/decrease in value for each given variable and corresponding sequence numbers which would change basis. Sequence numbers are 0..numberColumns and numberColumns.. for artificials/slacks. For basic variables the sequence number will be that of the basic variables. Up to user to providen correct length arrays. Returns non-zero if infeasible unbounded etc */ int ClpSimplex::primalRanging(int numberCheck, const int * which, double * valueIncrease, int * sequenceIncrease, double * valueDecrease, int * sequenceDecrease) { int savePerturbation = perturbation_; perturbation_ = 100; /*int returnCode =*/ static_cast (this)->primal(0, 1); if (problemStatus_ == 10) { //printf("Cleaning up with dual\n"); bool denseFactorization = initialDenseFactorization(); // It will be safe to allow dense setInitialDenseFactorization(true); // check which algorithms allowed int dummy; if ((matrix_->generalExpanded(this, 4, dummy) & 2) != 0) { // upperOut_ has largest away from bound double saveBound = dualBound_; if (upperOut_ > 0.0) dualBound_ = 2.0 * upperOut_; /*returnCode =*/ static_cast (this)->dual(0, 1); dualBound_ = saveBound; } else { /*returnCode =*/ static_cast (this)->primal(0, 1); } setInitialDenseFactorization(denseFactorization); if (problemStatus_ == 10) problemStatus_ = 0; } perturbation_ = savePerturbation; if (problemStatus_ || secondaryStatus_ == 6) { finish(); // get rid of arrays return 1; // odd status } static_cast (this)->primalRanging(numberCheck, which, valueIncrease, sequenceIncrease, valueDecrease, sequenceDecrease); finish(); // get rid of arrays return 0; } /* Write the basis in MPS format to the specified file. If writeValues true writes values of structurals (and adds VALUES to end of NAME card) Row and column names may be null. formatType is
    • 0 - normal
    • 1 - extra accuracy
    • 2 - IEEE hex (later)
    Returns non-zero on I/O error */ int ClpSimplex::writeBasis(const char *filename, bool writeValues, int formatType) const { return static_cast (this)->writeBasis(filename, writeValues, formatType); } // Read a basis from the given filename int ClpSimplex::readBasis(const char *filename) { return static_cast (this)->readBasis(filename); } #include "ClpSimplexNonlinear.hpp" /* Solves nonlinear problem using SLP - may be used as crash for other algorithms when number of iterations small */ int ClpSimplex::nonlinearSLP(int numberPasses, double deltaTolerance) { return static_cast (this)->primalSLP(numberPasses, deltaTolerance); } /* Solves problem with nonlinear constraints using SLP - may be used as crash for other algorithms when number of iterations small. Also exits if all problematical variables are changing less than deltaTolerance */ int ClpSimplex::nonlinearSLP(int numberConstraints, ClpConstraint ** constraints, int numberPasses, double deltaTolerance) { return static_cast (this)->primalSLP(numberConstraints, constraints, numberPasses, deltaTolerance); } // Solves non-linear using reduced gradient int ClpSimplex::reducedGradient(int phase) { if (objective_->type() < 2 || !objective_->activated()) { // no quadratic part return primal(0); } // get feasible if ((this->status() < 0 || numberPrimalInfeasibilities()) && phase == 0) { objective_->setActivated(0); double saveDirection = optimizationDirection(); setOptimizationDirection(0.0); primal(1); setOptimizationDirection(saveDirection); objective_->setActivated(1); // still infeasible if (numberPrimalInfeasibilities()) return 0; } // Now enter method int returnCode = static_cast (this)->primal(); return returnCode; } #include "ClpPredictorCorrector.hpp" #include "ClpCholeskyBase.hpp" // Preference is WSSMP, UFL (just ordering), MUMPS, TAUCS then base #include "ClpCholeskyWssmp.hpp" #include "ClpCholeskyWssmpKKT.hpp" #include "ClpCholeskyUfl.hpp" #include "ClpCholeskyMumps.hpp" #if TAUCS_BARRIER #include "ClpCholeskyTaucs.hpp" #endif #include "ClpPresolve.hpp" /* Solves using barrier (assumes you have good cholesky factor code). Does crossover to simplex if asked*/ int ClpSimplex::barrier(bool crossover) { ClpSimplex * model2 = this; int savePerturbation = perturbation_; ClpInterior barrier; barrier.borrowModel(*model2); // See if quadratic objective ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); // If Quadratic we need KKT bool doKKT = (quadraticObj != NULL); // Preference is WSSMP, UFL, MUMPS, TAUCS then base #ifdef WSSMP_BARRIER if (!doKKT) { ClpCholeskyWssmp * cholesky = new ClpCholeskyWssmp(CoinMax(100, model2->numberRows() / 10)); barrier.setCholesky(cholesky); } else { //ClpCholeskyWssmp * cholesky = new ClpCholeskyWssmp(); ClpCholeskyWssmpKKT * cholesky = new ClpCholeskyWssmpKKT(CoinMax(100, model2->numberRows() / 10)); barrier.setCholesky(cholesky); } #elif defined(COIN_HAS_AMD) || defined(COIN_HAS_CHOLMOD) if (!doKKT) { ClpCholeskyUfl * cholesky = new ClpCholeskyUfl(); barrier.setCholesky(cholesky); } else { ClpCholeskyBase * cholesky = new ClpCholeskyBase(); // not yetClpCholeskyUfl * cholesky = new ClpCholeskyUfl(); cholesky->setKKT(true); barrier.setCholesky(cholesky); } #elif TAUCS_BARRIER assert (!doKKT); ClpCholeskyTaucs * cholesky = new ClpCholeskyTaucs(); barrier.setCholesky(cholesky); #elifdef COIN_HAS_MUMPS if (!doKKT) { ClpCholeskyMumps * cholesky = new ClpCholeskyMumps(); barrier.setCholesky(cholesky); } else { printf("***** Unable to do Mumps with KKT\n"); ClpCholeskyBase * cholesky = new ClpCholeskyBase(); cholesky->setKKT(true); barrier.setCholesky(cholesky); } #else if (!doKKT) { ClpCholeskyBase * cholesky = new ClpCholeskyBase(); barrier.setCholesky(cholesky); } else { ClpCholeskyBase * cholesky = new ClpCholeskyBase(); cholesky->setKKT(true); barrier.setCholesky(cholesky); } #endif barrier.setDiagonalPerturbation(1.0e-14); int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); int saveMaxIts = model2->maximumIterations(); if (saveMaxIts < 1000) { barrier.setMaximumBarrierIterations(saveMaxIts); model2->setMaximumIterations(1000000); } barrier.primalDual(); int barrierStatus = barrier.status(); double gap = static_cast(barrier.complementarityGap()); // get which variables are fixed double * saveLower = NULL; double * saveUpper = NULL; ClpPresolve pinfo2; ClpSimplex * saveModel2 = NULL; int numberFixed = barrier.numberFixed(); if (numberFixed * 20 > barrier.numberRows() && numberFixed > 5000 && crossover && 0) { // may as well do presolve int numberRows = barrier.numberRows(); int numberColumns = barrier.numberColumns(); int numberTotal = numberRows + numberColumns; saveLower = new double [numberTotal]; saveUpper = new double [numberTotal]; CoinMemcpyN(barrier.columnLower(), numberColumns, saveLower); CoinMemcpyN(barrier.rowLower(), numberRows, saveLower + numberColumns); CoinMemcpyN(barrier.columnUpper(), numberColumns, saveUpper); CoinMemcpyN(barrier.rowUpper(), numberRows, saveUpper + numberColumns); barrier.fixFixed(); saveModel2 = model2; } barrier.returnModel(*model2); double * rowPrimal = new double [numberRows]; double * columnPrimal = new double [numberColumns]; double * rowDual = new double [numberRows]; double * columnDual = new double [numberColumns]; // move solutions other way CoinMemcpyN(model2->primalRowSolution(), numberRows, rowPrimal); CoinMemcpyN(model2->dualRowSolution(), numberRows, rowDual); CoinMemcpyN(model2->primalColumnSolution(), numberColumns, columnPrimal); CoinMemcpyN(model2->dualColumnSolution(), numberColumns, columnDual); if (saveModel2) { // do presolve model2 = pinfo2.presolvedModel(*model2, 1.0e-8, false, 5, true); } if (barrierStatus < 4 && crossover) { // make sure no status left model2->createStatus(); // solve model2->setPerturbation(100); // throw some into basis { int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); double * dsort = new double[numberColumns]; int * sort = new int[numberColumns]; int n = 0; const double * columnLower = model2->columnLower(); const double * columnUpper = model2->columnUpper(); const double * primalSolution = model2->primalColumnSolution(); double tolerance = 10.0 * primalTolerance_; int i; for ( i = 0; i < numberRows; i++) model2->setRowStatus(i, superBasic); for ( i = 0; i < numberColumns; i++) { double distance = CoinMin(columnUpper[i] - primalSolution[i], primalSolution[i] - columnLower[i]); if (distance > tolerance) { dsort[n] = -distance; sort[n++] = i; model2->setStatus(i, superBasic); } else if (distance > primalTolerance_) { model2->setStatus(i, superBasic); } else if (primalSolution[i] <= columnLower[i] + primalTolerance_) { model2->setStatus(i, atLowerBound); } else { model2->setStatus(i, atUpperBound); } } CoinSort_2(dsort, dsort + n, sort); n = CoinMin(numberRows, n); for ( i = 0; i < n; i++) { int iColumn = sort[i]; model2->setStatus(iColumn, basic); } delete [] sort; delete [] dsort; } if (gap < 1.0e-3 * (static_cast (numberRows + numberColumns))) { int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); // just primal values pass double saveScale = model2->objectiveScale(); model2->setObjectiveScale(1.0e-3); model2->primal(2); model2->setObjectiveScale(saveScale); // save primal solution and copy back dual CoinMemcpyN(model2->primalRowSolution(), numberRows, rowPrimal); CoinMemcpyN(rowDual, numberRows, model2->dualRowSolution()); CoinMemcpyN(model2->primalColumnSolution(), numberColumns, columnPrimal); CoinMemcpyN(columnDual, numberColumns, model2->dualColumnSolution()); //model2->primal(1); // clean up reduced costs and flag variables { double * dj = model2->dualColumnSolution(); double * cost = model2->objective(); double * saveCost = new double[numberColumns]; CoinMemcpyN(cost, numberColumns, saveCost); double * saveLower = new double[numberColumns]; double * lower = model2->columnLower(); CoinMemcpyN(lower, numberColumns, saveLower); double * saveUpper = new double[numberColumns]; double * upper = model2->columnUpper(); CoinMemcpyN(upper, numberColumns, saveUpper); int i; double tolerance = 10.0 * dualTolerance_; for ( i = 0; i < numberColumns; i++) { if (model2->getStatus(i) == basic) { dj[i] = 0.0; } else if (model2->getStatus(i) == atLowerBound) { if (optimizationDirection_ * dj[i] < tolerance) { if (optimizationDirection_ * dj[i] < 0.0) { //if (dj[i]<-1.0e-3) //printf("bad dj at lb %d %g\n",i,dj[i]); cost[i] -= dj[i]; dj[i] = 0.0; } } else { upper[i] = lower[i]; } } else if (model2->getStatus(i) == atUpperBound) { if (optimizationDirection_ * dj[i] > tolerance) { if (optimizationDirection_ * dj[i] > 0.0) { //if (dj[i]>1.0e-3) //printf("bad dj at ub %d %g\n",i,dj[i]); cost[i] -= dj[i]; dj[i] = 0.0; } } else { lower[i] = upper[i]; } } } // just dual values pass //model2->setLogLevel(63); //model2->setFactorizationFrequency(1); model2->dual(2); CoinMemcpyN(saveCost, numberColumns, cost); delete [] saveCost; CoinMemcpyN(saveLower, numberColumns, lower); delete [] saveLower; CoinMemcpyN(saveUpper, numberColumns, upper); delete [] saveUpper; } // and finish // move solutions CoinMemcpyN(rowPrimal, numberRows, model2->primalRowSolution()); CoinMemcpyN(columnPrimal, numberColumns, model2->primalColumnSolution()); } // double saveScale = model2->objectiveScale(); // model2->setObjectiveScale(1.0e-3); // model2->primal(2); // model2->setObjectiveScale(saveScale); model2->primal(1); } else if (barrierStatus == 4 && crossover) { // memory problems model2->setPerturbation(savePerturbation); model2->createStatus(); model2->dual(); } model2->setMaximumIterations(saveMaxIts); delete [] rowPrimal; delete [] columnPrimal; delete [] rowDual; delete [] columnDual; if (saveLower) { pinfo2.postsolve(true); delete model2; model2 = saveModel2; int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); CoinMemcpyN(saveLower, numberColumns, model2->columnLower()); CoinMemcpyN(saveLower + numberColumns, numberRows, model2->rowLower()); delete [] saveLower; CoinMemcpyN(saveUpper, numberColumns, model2->columnUpper()); CoinMemcpyN(saveUpper + numberColumns, numberRows, model2->rowUpper()); delete [] saveUpper; model2->primal(1); } model2->setPerturbation(savePerturbation); return model2->status(); } typedef struct { char * spareArrays_; ClpFactorization * factorization_; int logLevel_; } ClpHotSaveData; // Create a hotstart point of the optimization process void ClpSimplex::markHotStart(void * &saveStuff) { ClpHotSaveData * saveData = new ClpHotSaveData; saveStuff = saveData; setProblemStatus(0); saveData->logLevel_=logLevel(); if (logLevel()<2) setLogLevel(0); // Get space for strong branching int size = static_cast((1+4*(numberRows_+numberColumns_))*sizeof(double)); // and for save of original column bounds size += static_cast(2*numberColumns_*sizeof(double)); size += static_cast((1+4*numberRows_+2*numberColumns_)*sizeof(int)); size += numberRows_+numberColumns_; saveData->spareArrays_ = new char[size]; // Setup for strong branching saveData->factorization_ = static_cast(this)->setupForStrongBranching(saveData->spareArrays_,numberRows_,numberColumns_,true); double * arrayD = reinterpret_cast (saveData->spareArrays_); arrayD[0]=objectiveValue()* optimizationDirection(); double * saveSolution = arrayD+1; double * saveLower = saveSolution + (numberRows_+numberColumns_); double * saveUpper = saveLower + (numberRows_+numberColumns_); double * saveObjective = saveUpper + (numberRows_+numberColumns_); double * saveLowerOriginal = saveObjective + (numberRows_+numberColumns_); double * saveUpperOriginal = saveLowerOriginal + numberColumns_; CoinMemcpyN( columnLower(),numberColumns_, saveLowerOriginal); CoinMemcpyN( columnUpper(),numberColumns_, saveUpperOriginal); } // Optimize starting from the hotstart void ClpSimplex::solveFromHotStart(void * saveStuff) { ClpHotSaveData * saveData = reinterpret_cast(saveStuff); int iterationLimit = intParam_[ClpMaxNumIteration]; intParam_[ClpMaxNumIteration] = intParam_[ClpMaxNumIterationHotStart]; double * arrayD = reinterpret_cast (saveData->spareArrays_); double saveObjectiveValue = arrayD[0]; double * saveSolution = arrayD+1; int number = numberRows_+numberColumns_; CoinMemcpyN(saveSolution,number,solutionRegion()); double * saveLower = saveSolution + (numberRows_+numberColumns_); CoinMemcpyN(saveLower,number,lowerRegion()); double * saveUpper = saveLower + (numberRows_+numberColumns_); CoinMemcpyN(saveUpper,number,upperRegion()); double * saveObjective = saveUpper + (numberRows_+numberColumns_); CoinMemcpyN(saveObjective,number,costRegion()); double * saveLowerOriginal = saveObjective + (numberRows_+numberColumns_); double * saveUpperOriginal = saveLowerOriginal + numberColumns_; arrayD = saveUpperOriginal + numberColumns_; int * savePivot = reinterpret_cast (arrayD); CoinMemcpyN(savePivot,numberRows_,pivotVariable()); int * whichRow = savePivot+numberRows_; int * whichColumn = whichRow + 3*numberRows_; int * arrayI = whichColumn + 2*numberColumns_; unsigned char * saveStatus = reinterpret_cast (arrayI+1); CoinMemcpyN(saveStatus,number,statusArray()); setFactorization(*saveData->factorization_); // make sure whatsChanged_ has 1 set setWhatsChanged(511); double * lowerInternal = lowerRegion(); double * upperInternal = upperRegion(); double rhsScale = this->rhsScale(); const double * columnScale = NULL; // and do bounds in case dual needs them int iColumn; for (iColumn=0;iColumnsaveLowerOriginal[iColumn]) { double value = columnLower_[iColumn]; value *= rhsScale; if (columnScale_) value /= columnScale_[iColumn]; lowerInternal[iColumn]=value; } if (columnUpper_[iColumn](dualRowPivot_)) { // new copy (should think about keeping around) ClpDualRowSteepest steepest; setDualRowPivotAlgorithm(steepest); } #endif // Start of fast iterations bool alwaysFinish = true; //((specialOptions_&32)==0) ? true : false; int saveNumberFake = (static_cast(this))->numberFake_; int status = (static_cast(this))->fastDual(alwaysFinish); (static_cast(this))->numberFake_ = saveNumberFake; int probStatus = problemStatus(); double objValue =objectiveValue() * optimizationDirection(); CoinAssert (probStatus||objValue<1.0e50); // make sure plausible double obj = CoinMax(objValue,saveObjectiveValue); if (status==10||status<0) { // was trying to clean up or something odd status=1; } if (status) { // not finished - might be optimal checkPrimalSolution(solutionRegion(0), solutionRegion(1)); objValue =objectiveValue() * optimizationDirection(); obj = CoinMax(objValue,saveObjectiveValue); if (!numberDualInfeasibilities()) { double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if (secondaryStatus()==1&&!probStatus&&obj(saveStuff); setLogLevel(saveData->logLevel_); deleteRim(0); delete saveData->factorization_; delete [] saveData->spareArrays_; delete saveData; } /* For strong branching. On input lower and upper are new bounds while on output they are objective function values (>1.0e50 infeasible). Return code is 0 if nothing interesting, -1 if infeasible both ways and +1 if infeasible one way (check values to see which one(s)) */ int ClpSimplex::strongBranching(int numberVariables, const int * variables, double * newLower, double * newUpper, double ** outputSolution, int * outputStatus, int * outputIterations, bool stopOnFirstInfeasible, bool alwaysFinish, int startFinishOptions) { return static_cast (this)->strongBranching(numberVariables, variables, newLower, newUpper, outputSolution, outputStatus, outputIterations, stopOnFirstInfeasible, alwaysFinish, startFinishOptions); } #endif /* Borrow model. This is so we dont have to copy large amounts of data around. It assumes a derived class wants to overwrite an empty model with a real one - while it does an algorithm. This is same as ClpModel one, but sets scaling on etc. */ void ClpSimplex::borrowModel(ClpModel & otherModel) { ClpModel::borrowModel(otherModel); createStatus(); //ClpDualRowSteepest steep1; //setDualRowPivotAlgorithm(steep1); //ClpPrimalColumnSteepest steep2; //setPrimalColumnPivotAlgorithm(steep2); } void ClpSimplex::borrowModel(ClpSimplex & otherModel) { ClpModel::borrowModel(otherModel); createStatus(); dualBound_ = otherModel.dualBound_; dualTolerance_ = otherModel.dualTolerance_; primalTolerance_ = otherModel.primalTolerance_; delete dualRowPivot_; dualRowPivot_ = otherModel.dualRowPivot_->clone(true); dualRowPivot_->setModel(this); delete primalColumnPivot_; primalColumnPivot_ = otherModel.primalColumnPivot_->clone(true); primalColumnPivot_->setModel(this); perturbation_ = otherModel.perturbation_; moreSpecialOptions_ = otherModel.moreSpecialOptions_; automaticScale_ = otherModel.automaticScale_; maximumPerturbationSize_ = otherModel.maximumPerturbationSize_; perturbationArray_ = otherModel.perturbationArray_; } /// Saves scalars for ClpSimplex typedef struct { double optimizationDirection; double dblParam[ClpLastDblParam]; double objectiveValue; double dualBound; double dualTolerance; double primalTolerance; double sumDualInfeasibilities; double sumPrimalInfeasibilities; double infeasibilityCost; int numberRows; int numberColumns; int intParam[ClpLastIntParam]; int numberIterations; int problemStatus; int maximumIterations; int lengthNames; int numberDualInfeasibilities; int numberDualInfeasibilitiesWithoutFree; int numberPrimalInfeasibilities; int numberRefinements; int scalingFlag; int algorithm; unsigned int specialOptions; int dualPivotChoice; int primalPivotChoice; int matrixStorageChoice; } Clp_scalars; #ifndef SLIM_NOIO int outDoubleArray(double * array, int length, FILE * fp) { size_t numberWritten; if (array && length) { numberWritten = fwrite(&length, sizeof(int), 1, fp); if (numberWritten != 1) return 1; numberWritten = fwrite(array, sizeof(double), length, fp); if (numberWritten != static_cast(length)) return 1; } else { length = 0; numberWritten = fwrite(&length, sizeof(int), 1, fp); if (numberWritten != 1) return 1; } return 0; } // Save model to file, returns 0 if success int ClpSimplex::saveModel(const char * fileName) { FILE * fp = fopen(fileName, "wb"); if (fp) { Clp_scalars scalars; size_t numberWritten; // Fill in scalars scalars.optimizationDirection = optimizationDirection_; CoinMemcpyN( dblParam_, ClpLastDblParam, scalars.dblParam); scalars.objectiveValue = objectiveValue_; scalars.dualBound = dualBound_; scalars.dualTolerance = dualTolerance_; scalars.primalTolerance = primalTolerance_; scalars.sumDualInfeasibilities = sumDualInfeasibilities_; scalars.sumPrimalInfeasibilities = sumPrimalInfeasibilities_; scalars.infeasibilityCost = infeasibilityCost_; scalars.numberRows = numberRows_; scalars.numberColumns = numberColumns_; CoinMemcpyN( intParam_, ClpLastIntParam, scalars.intParam); scalars.numberIterations = numberIterations_; scalars.problemStatus = problemStatus_; scalars.maximumIterations = maximumIterations(); scalars.lengthNames = lengthNames_; scalars.numberDualInfeasibilities = numberDualInfeasibilities_; scalars.numberDualInfeasibilitiesWithoutFree = numberDualInfeasibilitiesWithoutFree_; scalars.numberPrimalInfeasibilities = numberPrimalInfeasibilities_; scalars.numberRefinements = numberRefinements_; scalars.scalingFlag = scalingFlag_; scalars.algorithm = algorithm_; scalars.specialOptions = specialOptions_; scalars.dualPivotChoice = dualRowPivot_->type(); scalars.primalPivotChoice = primalColumnPivot_->type(); scalars.matrixStorageChoice = matrix_->type(); // put out scalars numberWritten = fwrite(&scalars, sizeof(Clp_scalars), 1, fp); if (numberWritten != 1) return 1; size_t length; #ifndef CLP_NO_STD int i; // strings for (i = 0; i < ClpLastStrParam; i++) { length = strParam_[i].size(); numberWritten = fwrite(&length, sizeof(int), 1, fp); if (numberWritten != 1) return 1; if (length) { numberWritten = fwrite(strParam_[i].c_str(), length, 1, fp); if (numberWritten != 1) return 1; } } #endif // arrays - in no particular order if (outDoubleArray(rowActivity_, numberRows_, fp)) return 1; if (outDoubleArray(columnActivity_, numberColumns_, fp)) return 1; if (outDoubleArray(dual_, numberRows_, fp)) return 1; if (outDoubleArray(reducedCost_, numberColumns_, fp)) return 1; if (outDoubleArray(rowLower_, numberRows_, fp)) return 1; if (outDoubleArray(rowUpper_, numberRows_, fp)) return 1; if (outDoubleArray(objective(), numberColumns_, fp)) return 1; if (outDoubleArray(rowObjective_, numberRows_, fp)) return 1; if (outDoubleArray(columnLower_, numberColumns_, fp)) return 1; if (outDoubleArray(columnUpper_, numberColumns_, fp)) return 1; if (ray_) { if (problemStatus_ == 1) { if (outDoubleArray(ray_, numberRows_, fp)) return 1; } else if (problemStatus_ == 2) { if (outDoubleArray(ray_, numberColumns_, fp)) return 1; } else { if (outDoubleArray(NULL, 0, fp)) return 1; } } else { if (outDoubleArray(NULL, 0, fp)) return 1; } if (status_ && (numberRows_ + numberColumns_) > 0) { length = numberRows_ + numberColumns_; numberWritten = fwrite(&length, sizeof(int), 1, fp); if (numberWritten != 1) return 1; numberWritten = fwrite(status_, sizeof(char), length, fp); if (numberWritten != length) return 1; } else { length = 0; numberWritten = fwrite(&length, sizeof(int), 1, fp); if (numberWritten != 1) return 1; } #ifndef CLP_NO_STD if (lengthNames_) { char * array = new char[CoinMax(numberRows_, numberColumns_)*(lengthNames_+1)]; char * put = array; CoinAssert (numberRows_ == static_cast (rowNames_.size())); for (i = 0; i < numberRows_; i++) { assert(static_cast(rowNames_[i].size()) <= lengthNames_); strcpy(put, rowNames_[i].c_str()); put += lengthNames_ + 1; } numberWritten = fwrite(array, lengthNames_ + 1, numberRows_, fp); if (numberWritten != static_cast(numberRows_)) return 1; put = array; CoinAssert (numberColumns_ == static_cast (columnNames_.size())); for (i = 0; i < numberColumns_; i++) { assert(static_cast (columnNames_[i].size()) <= lengthNames_); strcpy(put, columnNames_[i].c_str()); put += lengthNames_ + 1; } numberWritten = fwrite(array, lengthNames_ + 1, numberColumns_, fp); if (numberWritten != static_cast(numberColumns_)) return 1; delete [] array; } #endif // integers if (integerType_) { int marker = 1; numberWritten = fwrite(&marker, sizeof(int), 1, fp); numberWritten = fwrite(integerType_, 1, numberColumns_, fp); if (numberWritten != static_cast(numberColumns_)) return 1; } else { int marker = 0; numberWritten = fwrite(&marker, sizeof(int), 1, fp); } // just standard type at present assert (matrix_->type() == 1); CoinAssert (matrix_->getNumCols() == numberColumns_); CoinAssert (matrix_->getNumRows() == numberRows_); // we are going to save with gaps length = matrix_->getVectorStarts()[numberColumns_-1] + matrix_->getVectorLengths()[numberColumns_-1]; numberWritten = fwrite(&length, sizeof(int), 1, fp); if (numberWritten != 1) return 1; numberWritten = fwrite(matrix_->getElements(), sizeof(double), length, fp); if (numberWritten != length) return 1; numberWritten = fwrite(matrix_->getIndices(), sizeof(int), length, fp); if (numberWritten != length) return 1; numberWritten = fwrite(matrix_->getVectorStarts(), sizeof(int), numberColumns_ + 1, fp); if (numberWritten != static_cast(numberColumns_) + 1) return 1; numberWritten = fwrite(matrix_->getVectorLengths(), sizeof(int), numberColumns_, fp); if (numberWritten != static_cast(numberColumns_)) return 1; // finished fclose(fp); return 0; } else { return -1; } } int inDoubleArray(double * &array, int length, FILE * fp) { size_t numberRead; int length2; numberRead = fread(&length2, sizeof(int), 1, fp); if (numberRead != 1) return 1; if (length2) { // lengths must match if (length != length2) return 2; array = new double[length]; numberRead = fread(array, sizeof(double), length, fp); if (numberRead != static_cast(length)) return 1; } return 0; } /* Restore model from file, returns 0 if success, deletes current model */ int ClpSimplex::restoreModel(const char * fileName) { FILE * fp = fopen(fileName, "rb"); if (fp) { // Get rid of current model // save event handler in case already set ClpEventHandler * handler = eventHandler_->clone(); ClpModel::gutsOfDelete(0); eventHandler_ = handler; gutsOfDelete(0); int i; for (i = 0; i < 6; i++) { rowArray_[i] = NULL; columnArray_[i] = NULL; } // get an empty factorization so we can set tolerances etc getEmptyFactorization(); // Say sparse factorization_->sparseThreshold(1); Clp_scalars scalars; size_t numberRead; // get scalars numberRead = fread(&scalars, sizeof(Clp_scalars), 1, fp); if (numberRead != 1) return 1; // Fill in scalars optimizationDirection_ = scalars.optimizationDirection; CoinMemcpyN( scalars.dblParam, ClpLastDblParam, dblParam_); objectiveValue_ = scalars.objectiveValue; dualBound_ = scalars.dualBound; dualTolerance_ = scalars.dualTolerance; primalTolerance_ = scalars.primalTolerance; sumDualInfeasibilities_ = scalars.sumDualInfeasibilities; sumPrimalInfeasibilities_ = scalars.sumPrimalInfeasibilities; infeasibilityCost_ = scalars.infeasibilityCost; numberRows_ = scalars.numberRows; numberColumns_ = scalars.numberColumns; CoinMemcpyN( scalars.intParam, ClpLastIntParam, intParam_); numberIterations_ = scalars.numberIterations; problemStatus_ = scalars.problemStatus; setMaximumIterations(scalars.maximumIterations); lengthNames_ = scalars.lengthNames; numberDualInfeasibilities_ = scalars.numberDualInfeasibilities; numberDualInfeasibilitiesWithoutFree_ = scalars.numberDualInfeasibilitiesWithoutFree; numberPrimalInfeasibilities_ = scalars.numberPrimalInfeasibilities; numberRefinements_ = scalars.numberRefinements; scalingFlag_ = scalars.scalingFlag; algorithm_ = scalars.algorithm; specialOptions_ = scalars.specialOptions; // strings CoinBigIndex length; #ifndef CLP_NO_STD for (i = 0; i < ClpLastStrParam; i++) { numberRead = fread(&length, sizeof(int), 1, fp); if (numberRead != 1) return 1; if (length) { char * array = new char[length+1]; numberRead = fread(array, length, 1, fp); if (numberRead != 1) return 1; array[length] = '\0'; strParam_[i] = array; delete [] array; } } #endif // arrays - in no particular order if (inDoubleArray(rowActivity_, numberRows_, fp)) return 1; if (inDoubleArray(columnActivity_, numberColumns_, fp)) return 1; if (inDoubleArray(dual_, numberRows_, fp)) return 1; if (inDoubleArray(reducedCost_, numberColumns_, fp)) return 1; if (inDoubleArray(rowLower_, numberRows_, fp)) return 1; if (inDoubleArray(rowUpper_, numberRows_, fp)) return 1; double * objective = NULL; if (inDoubleArray(objective, numberColumns_, fp)) return 1; delete objective_; objective_ = new ClpLinearObjective(objective, numberColumns_); delete [] objective; if (inDoubleArray(rowObjective_, numberRows_, fp)) return 1; if (inDoubleArray(columnLower_, numberColumns_, fp)) return 1; if (inDoubleArray(columnUpper_, numberColumns_, fp)) return 1; if (problemStatus_ == 1) { if (inDoubleArray(ray_, numberRows_, fp)) return 1; } else if (problemStatus_ == 2) { if (inDoubleArray(ray_, numberColumns_, fp)) return 1; } else { // ray should be null numberRead = fread(&length, sizeof(int), 1, fp); if (numberRead != 1) return 1; if (length) return 2; } delete [] status_; status_ = NULL; // status region numberRead = fread(&length, sizeof(int), 1, fp); if (numberRead != 1) return 1; if (length) { if (length != numberRows_ + numberColumns_) return 1; status_ = new char unsigned[length]; numberRead = fread(status_, sizeof(char), length, fp); if (numberRead != static_cast(length)) return 1; } #ifndef CLP_NO_STD if (lengthNames_) { char * array = new char[CoinMax(numberRows_, numberColumns_)*(lengthNames_+1)]; char * get = array; numberRead = fread(array, lengthNames_ + 1, numberRows_, fp); if (numberRead != static_cast(numberRows_)) return 1; rowNames_ = std::vector (); rowNames_.resize(numberRows_); for (i = 0; i < numberRows_; i++) { rowNames_.push_back(get); get += lengthNames_ + 1; } get = array; numberRead = fread(array, lengthNames_ + 1, numberColumns_, fp); if (numberRead != static_cast(numberColumns_)) return 1; columnNames_ = std::vector (); columnNames_.resize(numberColumns_); for (i = 0; i < numberColumns_; i++) { columnNames_.push_back(get); get += lengthNames_ + 1; } delete [] array; } #endif // integers int ifInteger; delete [] integerType_; numberRead = fread(&ifInteger, sizeof(int), 1, fp); // But try and stay compatible with previous version bool alreadyGotLength = false; if (numberRead != 1) return 1; if (ifInteger == 1) { integerType_ = new char [numberColumns_]; numberRead = fread(integerType_, 1, numberColumns_, fp); if (numberRead != static_cast(numberColumns_)) return 1; } else { integerType_ = NULL; if (ifInteger) { // probably old style save alreadyGotLength = true; length = ifInteger; } } // Pivot choices assert(scalars.dualPivotChoice > 0 && (scalars.dualPivotChoice & 63) < 3); delete dualRowPivot_; switch ((scalars.dualPivotChoice & 63)) { default: printf("Need another dualPivot case %d\n", scalars.dualPivotChoice & 63); case 1: // Dantzig dualRowPivot_ = new ClpDualRowDantzig(); break; case 2: // Steepest - use mode dualRowPivot_ = new ClpDualRowSteepest(scalars.dualPivotChoice >> 6); break; } assert(scalars.primalPivotChoice > 0 && (scalars.primalPivotChoice & 63) < 3); delete primalColumnPivot_; switch ((scalars.primalPivotChoice & 63)) { default: printf("Need another primalPivot case %d\n", scalars.primalPivotChoice & 63); case 1: // Dantzig primalColumnPivot_ = new ClpPrimalColumnDantzig(); break; case 2: // Steepest - use mode primalColumnPivot_ = new ClpPrimalColumnSteepest(scalars.primalPivotChoice >> 6); break; } assert(scalars.matrixStorageChoice == 1); delete matrix_; // get arrays if (!alreadyGotLength) { numberRead = fread(&length, sizeof(int), 1, fp); if (numberRead != 1) return 1; } double * elements = new double[length]; int * indices = new int[length]; CoinBigIndex * starts = new CoinBigIndex[numberColumns_+1]; int * lengths = new int[numberColumns_]; numberRead = fread(elements, sizeof(double), length, fp); if (numberRead != static_cast(length)) return 1; numberRead = fread(indices, sizeof(int), length, fp); if (numberRead != static_cast(length)) return 1; numberRead = fread(starts, sizeof(int), numberColumns_ + 1, fp); if (numberRead != static_cast(numberColumns_) + 1) return 1; numberRead = fread(lengths, sizeof(int), numberColumns_, fp); if (numberRead != static_cast(numberColumns_)) return 1; // assign matrix CoinPackedMatrix * matrix = new CoinPackedMatrix(); matrix->setExtraGap(0.0); matrix->setExtraMajor(0.0); // Pack down length = 0; for (i = 0; i < numberColumns_; i++) { int start = starts[i]; starts[i] = length; for (CoinBigIndex j = start; j < start + lengths[i]; j++) { elements[length] = elements[j]; indices[length++] = indices[j]; } lengths[i] = length - starts[i]; } starts[numberColumns_] = length; matrix->assignMatrix(true, numberRows_, numberColumns_, length, elements, indices, starts, lengths); // and transfer to Clp matrix_ = new ClpPackedMatrix(matrix); // finished fclose(fp); return 0; } else { return -1; } return 0; } #endif // value of incoming variable (in Dual) double ClpSimplex::valueIncomingDual() const { // Need value of incoming for list of infeasibilities as may be infeasible double valueIncoming = (dualOut_ / alpha_) * directionOut_; if (directionIn_ == -1) valueIncoming = upperIn_ - valueIncoming; else valueIncoming = lowerIn_ - valueIncoming; return valueIncoming; } // Sanity check on input data - returns true if okay bool ClpSimplex::sanityCheck() { // bad if empty if (!numberColumns_ || ((!numberRows_ || !matrix_->getNumElements()) && objective_->type() < 2)) { int infeasNumber[2]; double infeasSum[2]; problemStatus_ = emptyProblem(infeasNumber, infeasSum, false); numberDualInfeasibilities_ = infeasNumber[0]; sumDualInfeasibilities_ = infeasSum[0]; numberPrimalInfeasibilities_ = infeasNumber[1]; sumPrimalInfeasibilities_ = infeasSum[1]; return false; } int numberBad ; double largestBound, smallestBound, minimumGap; double smallestObj, largestObj; int firstBad; int modifiedBounds = 0; int i; numberBad = 0; firstBad = -1; minimumGap = 1.0e100; smallestBound = 1.0e100; largestBound = 0.0; smallestObj = 1.0e100; largestObj = 0.0; // If bounds are too close - fix double fixTolerance = primalTolerance_; if (fixTolerance < 2.0e-8) fixTolerance *= 1.1; for (i = numberColumns_; i < numberColumns_ + numberRows_; i++) { double value; value = fabs(cost_[i]); if (value > 1.0e100) { numberBad++; if (firstBad < 0) firstBad = i; } else if (value) { if (value > largestObj) largestObj = value; if (value < smallestObj) smallestObj = value; } value = upper_[i] - lower_[i]; if (value < -primalTolerance_) { numberBad++; if (firstBad < 0) firstBad = i; } else if (value <= fixTolerance) { if (value) { // modify upper_[i] = lower_[i]; modifiedBounds++; } } else { if (value < minimumGap) minimumGap = value; } if (lower_[i] > -1.0e100 && lower_[i]) { value = fabs(lower_[i]); if (value > largestBound) largestBound = value; if (value < smallestBound) smallestBound = value; } if (upper_[i] < 1.0e100 && upper_[i]) { value = fabs(upper_[i]); if (value > largestBound) largestBound = value; if (value < smallestBound) smallestBound = value; } } if (largestBound) handler_->message(CLP_RIMSTATISTICS3, messages_) << smallestBound << largestBound << minimumGap << CoinMessageEol; minimumGap = 1.0e100; smallestBound = 1.0e100; largestBound = 0.0; for (i = 0; i < numberColumns_; i++) { double value; value = fabs(cost_[i]); if (value > 1.0e100) { numberBad++; if (firstBad < 0) firstBad = i; } else if (value) { if (value > largestObj) largestObj = value; if (value < smallestObj) smallestObj = value; } value = upper_[i] - lower_[i]; if (value < -primalTolerance_) { numberBad++; if (firstBad < 0) firstBad = i; } else if (value <= fixTolerance) { if (value) { // modify upper_[i] = lower_[i]; modifiedBounds++; } } else { if (value < minimumGap) minimumGap = value; } if (lower_[i] > -1.0e100 && lower_[i]) { value = fabs(lower_[i]); if (value > largestBound) largestBound = value; if (value < smallestBound) smallestBound = value; } if (upper_[i] < 1.0e100 && upper_[i]) { value = fabs(upper_[i]); if (value > largestBound) largestBound = value; if (value < smallestBound) smallestBound = value; } } char rowcol[] = {'R', 'C'}; if (numberBad) { handler_->message(CLP_BAD_BOUNDS, messages_) << numberBad << rowcol[isColumn(firstBad)] << sequenceWithin(firstBad) << CoinMessageEol; problemStatus_ = 4; return false; } if (modifiedBounds) handler_->message(CLP_MODIFIEDBOUNDS, messages_) << modifiedBounds << CoinMessageEol; handler_->message(CLP_RIMSTATISTICS1, messages_) << smallestObj << largestObj << CoinMessageEol; if (largestBound) handler_->message(CLP_RIMSTATISTICS2, messages_) << smallestBound << largestBound << minimumGap << CoinMessageEol; return true; } // Set up status array (for OsiClp) void ClpSimplex::createStatus() { if(!status_) status_ = new unsigned char [numberColumns_+numberRows_]; memset(status_, 0, (numberColumns_ + numberRows_)*sizeof(char)); int i; // set column status to one nearest zero for (i = 0; i < numberColumns_; i++) { #if 0 if (columnLower_[i] >= 0.0) { setColumnStatus(i, atLowerBound); } else if (columnUpper_[i] <= 0.0) { setColumnStatus(i, atUpperBound); } else if (columnLower_[i] < -1.0e20 && columnUpper_[i] > 1.0e20) { // free setColumnStatus(i, isFree); } else if (fabs(columnLower_[i]) < fabs(columnUpper_[i])) { setColumnStatus(i, atLowerBound); } else { setColumnStatus(i, atUpperBound); } #else setColumnStatus(i, atLowerBound); #endif } for (i = 0; i < numberRows_; i++) { setRowStatus(i, basic); } } /* Sets up all slack basis and resets solution to as it was after initial load or readMps */ void ClpSimplex::allSlackBasis(bool resetSolution) { createStatus(); if (resetSolution) { // put back to as it was originally int i; // set column status to one nearest zero // But set value to zero if lb <0.0 and ub>0.0 for (i = 0; i < numberColumns_; i++) { if (columnLower_[i] >= 0.0) { columnActivity_[i] = columnLower_[i]; setColumnStatus(i, atLowerBound); } else if (columnUpper_[i] <= 0.0) { columnActivity_[i] = columnUpper_[i]; setColumnStatus(i, atUpperBound); } else if (columnLower_[i] < -1.0e20 && columnUpper_[i] > 1.0e20) { // free columnActivity_[i] = 0.0; setColumnStatus(i, isFree); } else if (fabs(columnLower_[i]) < fabs(columnUpper_[i])) { columnActivity_[i] = 0.0; setColumnStatus(i, atLowerBound); } else { columnActivity_[i] = 0.0; setColumnStatus(i, atUpperBound); } } if (solution_) { // do that as well if (!columnScale_) { for (i = 0; i < numberColumns_; i++) { solution_[i] = columnActivity_[i]; } } else { double * inverseColumnScale = columnScale_ + numberColumns_; for (i = 0; i < numberColumns_; i++) { solution_[i] = columnActivity_[i] * (rhsScale_ * inverseColumnScale[i]); } } } } } /* Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ void ClpSimplex::loadProblem ( const ClpMatrixBase& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpModel::loadProblem(matrix, collb, colub, obj, rowlb, rowub, rowObjective); createStatus(); } void ClpSimplex::loadProblem ( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpModel::loadProblem(matrix, collb, colub, obj, rowlb, rowub, rowObjective); createStatus(); } /* Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ void ClpSimplex::loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpModel::loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub, rowObjective); createStatus(); } #ifndef SLIM_NOIO // This loads a model from a coinModel object - returns number of errors int ClpSimplex::loadProblem ( CoinModel & modelObject, bool /*keepSolution*/) { unsigned char * status = NULL; double * psol = NULL; double * dsol = NULL; if (status_ && numberRows_ && numberRows_ == modelObject.numberRows() && numberColumns_ == modelObject.numberColumns()) { status = new unsigned char [numberRows_+numberColumns_]; CoinMemcpyN(status_, numberRows_ + numberColumns_, status); psol = new double [numberRows_+numberColumns_]; CoinMemcpyN(columnActivity_, numberColumns_, psol); CoinMemcpyN(rowActivity_, numberRows_, psol + numberColumns_); dsol = new double [numberRows_+numberColumns_]; CoinMemcpyN(reducedCost_, numberColumns_, dsol); CoinMemcpyN(dual_, numberRows_, dsol + numberColumns_); } int returnCode = ClpModel::loadProblem(modelObject); const int * integerType = modelObject.integerTypeArray(); if (integerType) { for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (integerType[iColumn]) setInteger(iColumn); } } createStatus(); if (status) { // copy back CoinMemcpyN(status, numberRows_ + numberColumns_, status_); CoinMemcpyN(psol, numberColumns_, columnActivity_); CoinMemcpyN(psol + numberColumns_, numberRows_, rowActivity_); CoinMemcpyN(dsol, numberColumns_, reducedCost_); CoinMemcpyN(dsol + numberColumns_, numberRows_, dual_); delete [] status; delete [] psol; delete [] dsol; } optimizationDirection_ = modelObject.optimizationDirection(); return returnCode; } #endif void ClpSimplex::loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const int * length, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpModel::loadProblem(numcols, numrows, start, index, value, length, collb, colub, obj, rowlb, rowub, rowObjective); createStatus(); } #ifndef SLIM_NOIO // Read an mps file from the given filename int ClpSimplex::readMps(const char *filename, bool keepNames, bool ignoreErrors) { int status = ClpModel::readMps(filename, keepNames, ignoreErrors); createStatus(); return status; } // Read GMPL files from the given filenames int ClpSimplex::readGMPL(const char *filename, const char * dataName, bool keepNames) { int status = ClpModel::readGMPL(filename, dataName, keepNames); createStatus(); return status; } // Read file in LP format from file with name filename. int ClpSimplex::readLp(const char *filename, const double epsilon ) { FILE *fp; if (strcmp(filename,"-")) fp = fopen(filename, "r"); else fp = stdin; if(!fp) { printf("### ERROR: ClpSimplex::readLp(): Unable to open file %s for reading\n", filename); return(1); } CoinLpIO m; m.readLp(fp, epsilon); fclose(fp); // set problem name setStrParam(ClpProbName, m.getProblemName()); // no errors loadProblem(*m.getMatrixByRow(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); if (m.integerColumns()) { integerType_ = new char[numberColumns_]; CoinMemcpyN(m.integerColumns(), numberColumns_, integerType_); } else { integerType_ = NULL; } createStatus(); unsigned int maxLength = 0; int iRow; rowNames_ = std::vector (); columnNames_ = std::vector (); rowNames_.reserve(numberRows_); for (iRow = 0; iRow < numberRows_; iRow++) { const char * name = m.rowName(iRow); if (name) { maxLength = CoinMax(maxLength, static_cast (strlen(name))); rowNames_.push_back(name); } else { rowNames_.push_back(""); } } int iColumn; columnNames_.reserve(numberColumns_); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { const char * name = m.columnName(iColumn); if (name) { maxLength = CoinMax(maxLength, static_cast (strlen(name))); columnNames_.push_back(name); } else { columnNames_.push_back(""); } } lengthNames_ = static_cast (maxLength); return 0; } #endif // Just check solution (for external use) void ClpSimplex::checkSolution(int setToBounds) { if (setToBounds) { // Set all ones that look at bounds to bounds bool changed = false; int i; for (i = 0; i < numberRows_; i++) { double newValue = 0.0; switch(getRowStatus(i)) { case basic: newValue = rowActivity_[i]; break; case atUpperBound: newValue = rowUpper_[i]; if (newValue > largeValue_) { if (rowLower_[i] > -largeValue_) { newValue = rowLower_[i]; setRowStatus(i, atLowerBound); } else { // say free setRowStatus(i, isFree); newValue = 0.0; } } break; case ClpSimplex::isFixed: case atLowerBound: newValue = rowLower_[i]; if (newValue < -largeValue_) { if (rowUpper_[i] < largeValue_) { newValue = rowUpper_[i]; setRowStatus(i, atUpperBound); } else { // say free setRowStatus(i, isFree); newValue = 0.0; } } break; case isFree: newValue = rowActivity_[i]; break; // not really free - fall through to superbasic case superBasic: if (rowUpper_[i] > largeValue_) { if (rowLower_[i] > -largeValue_) { newValue = rowLower_[i]; setRowStatus(i, atLowerBound); } else { // say free setRowStatus(i, isFree); newValue = 0.0; } } else { if (rowLower_[i] > -largeValue_) { // set to nearest if (fabs(newValue - rowLower_[i]) < fabs(newValue - rowUpper_[i])) { newValue = rowLower_[i]; setRowStatus(i, atLowerBound); } else { newValue = rowUpper_[i]; setRowStatus(i, atUpperBound); } } else { newValue = rowUpper_[i]; setRowStatus(i, atUpperBound); } } break; } if (fabs(newValue - rowActivity_[i]) > 1.0e-12) { changed = true; rowActivity_[i] = newValue; } } for (i = 0; i < numberColumns_; i++) { double newValue = 0.0; switch(getColumnStatus(i)) { case basic: newValue = columnActivity_[i]; break; case atUpperBound: newValue = columnUpper_[i]; if (newValue > largeValue_) { if (columnLower_[i] > -largeValue_) { newValue = columnLower_[i]; setColumnStatus(i, atLowerBound); } else { // say free setColumnStatus(i, isFree); newValue = 0.0; } } break; case ClpSimplex::isFixed: case atLowerBound: newValue = columnLower_[i]; if (newValue < -largeValue_) { if (columnUpper_[i] < largeValue_) { newValue = columnUpper_[i]; setColumnStatus(i, atUpperBound); } else { // say free setColumnStatus(i, isFree); newValue = 0.0; } } break; case isFree: newValue = columnActivity_[i]; break; // not really free - fall through to superbasic case superBasic: if (columnUpper_[i] > largeValue_) { if (columnLower_[i] > -largeValue_) { newValue = columnLower_[i]; setColumnStatus(i, atLowerBound); } else { // say free setColumnStatus(i, isFree); newValue = 0.0; } } else { if (columnLower_[i] > -largeValue_) { // set to nearest if (fabs(newValue - columnLower_[i]) < fabs(newValue - columnUpper_[i])) { newValue = columnLower_[i]; setColumnStatus(i, atLowerBound); } else { newValue = columnUpper_[i]; setColumnStatus(i, atUpperBound); } } else { newValue = columnUpper_[i]; setColumnStatus(i, atUpperBound); } } break; } if (fabs(newValue - columnActivity_[i]) > 1.0e-12) { changed = true; columnActivity_[i] = newValue; } } if (!changed && setToBounds == 1) // no need to do anything setToBounds = 0; } if (!setToBounds) { // Just use column solution CoinZeroN(rowActivity_, numberRows_); matrix()->times(columnActivity_, rowActivity_) ; // put in standard form createRim(7 + 8 + 16 + 32); dualTolerance_ = dblParam_[ClpDualTolerance]; primalTolerance_ = dblParam_[ClpPrimalTolerance]; checkPrimalSolution( rowActivityWork_, columnActivityWork_); checkDualSolution(); } else { startup(0, 0); gutsOfSolution(NULL, NULL); } if (!numberDualInfeasibilities_ && !numberPrimalInfeasibilities_) problemStatus_ = 0; else problemStatus_ = -1; #ifdef CLP_DEBUG int i; double value = 0.0; for (i = 0; i < numberRows_ + numberColumns_; i++) value += dj_[i] * solution_[i]; printf("dual value %g, primal %g\n", value, objectiveValue()); #endif // release extra memory deleteRim(0); } // Check unscaled primal solution but allow for rounding error void ClpSimplex::checkUnscaledSolution() { if (problemStatus_==1 && matrix_->getNumElements()) { const double * element = matrix_->getElements(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const int * row = matrix_->getIndices(); memset(rowActivity_,0,numberRows_*sizeof(double)); double * sum = new double [numberRows_+100000]; memset(sum,0,numberRows_*sizeof(double)); // clean column activity for (int i=0;i=0&&iRowrowUpper_[i]) { sumPrimalInfeasibilities2 += value - rowUpper_[i]; numberPrimalInfeasibilities2++; if (value>rowUpper_[i]+useTolerance) { sumPrimalInfeasibilities_ += value - (rowUpper_[i]+useTolerance); numberPrimalInfeasibilities_++; } } else if (valuemessage(CLP_GENERAL, messages_) << line << CoinMessageEol; } if (!numberPrimalInfeasibilities_) { if (!numberDualInfeasibilities_) problemStatus_=0; } else { sprintf(line,"%d relaxed row infeasibilities - summing to %g", numberPrimalInfeasibilities_, sumPrimalInfeasibilities_); handler_->message(CLP_GENERAL, messages_) << line << CoinMessageEol; } delete [] sum; } } /* Crash - at present just aimed at dual, returns -2 if dual preferred and crash basis created -1 if dual preferred and all slack basis preferred 0 if basis going in was not all slack 1 if primal preferred and all slack basis preferred 2 if primal preferred and crash basis created. if gap between bounds <="gap" variables can be flipped ( If pivot -1 then can be made super basic!) If "pivot" is -1 No pivoting - always primal 0 No pivoting (so will just be choice of algorithm) 1 Simple pivoting e.g. gub 2 Mini iterations 3 Just throw all free variables in basis */ int ClpSimplex::crash(double gap, int pivot) { //CoinAssert(!rowObjective_); // not coded int iColumn; int numberBad = 0; int numberBasic = 0; double dualTolerance = dblParam_[ClpDualTolerance]; //double primalTolerance=dblParam_[ClpPrimalTolerance]; int returnCode = 0; // If no basis then make all slack one if (!status_) createStatus(); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (getColumnStatus(iColumn) == basic) numberBasic++; } if (!numberBasic || pivot == 3) { #if 0 int nFree=0; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnLower_[iColumn] < -1.0e20 && columnUpper_[iColumn] > 1.0e20) nFree++; } if (nFree>numberColumns_/10) pivot=3; #endif if (pivot == 3) { // Get column copy CoinPackedMatrix * columnCopy = matrix(); const int * row = columnCopy->getIndices(); const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); const int * columnLength = columnCopy->getVectorLengths(); const double * element = columnCopy->getElements(); int nFree=0; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnLower_[iColumn] < -1.0e20 && columnUpper_[iColumn] > 1.0e20) { // find triangular row int kRow=-1; double largest=0.0; double largestOther=0.0; for (CoinBigIndex j=columnStart[iColumn]; jlargest) { kRow=row[j]; largest=fabs(element[j]); } } else { if (fabs(element[j])>largestOther) { largestOther=fabs(element[j]); } } } if (kRow>=0&&largest*2.5>=largestOther) { nFree++; setColumnStatus(iColumn, basic); if (fabs(rowLower_[kRow]) < fabs(rowUpper_[kRow])) setRowStatus(kRow, atLowerBound); else setRowStatus(kRow, atUpperBound); for (CoinBigIndex j=columnStart[iColumn]; j -1.0e20 || upperBound < 1.0e20) { bool atLower; if (fabs(upperBound) < fabs(lowerBound)) { atLower = false; setColumnStatus(iColumn, atUpperBound); solution[iColumn] = upperBound; } else { atLower = true; setColumnStatus(iColumn, atLowerBound); solution[iColumn] = lowerBound; } if (dj[iColumn] < -dualTolerance_) { // should be at upper bound if (atLower) { // can we flip if (upperBound - lowerBound <= gap) { columnActivity_[iColumn] = upperBound; setColumnStatus(iColumn, atUpperBound); } else if (pivot < 0) { // set superbasic columnActivity_[iColumn] = lowerBound + gap; setColumnStatus(iColumn, superBasic); } else if (dj[iColumn] < -dualTolerance) { numberBad++; } } } else if (dj[iColumn] > dualTolerance_) { // should be at lower bound if (!atLower) { // can we flip if (upperBound - lowerBound <= gap) { columnActivity_[iColumn] = lowerBound; setColumnStatus(iColumn, atLowerBound); } else if (pivot < 0) { // set superbasic columnActivity_[iColumn] = upperBound - gap; setColumnStatus(iColumn, superBasic); } else if (dj[iColumn] > dualTolerance) { numberBad++; } } } } else { // free setColumnStatus(iColumn, isFree); if (fabs(dj[iColumn]) > dualTolerance) numberBad++; } } if (numberBad || pivot) { if (pivot <= 0) { delete [] dj; returnCode = 1; } else { // see if can be made dual feasible with gubs etc double * pi = new double[numberRows_]; memset (pi, 0, numberRows_ * sizeof(double)); int * way = new int[numberColumns_]; int numberIn = 0; // Get column copy CoinPackedMatrix * columnCopy = matrix(); // Get a row copy in standard format CoinPackedMatrix copy; copy.setExtraGap(0.0); copy.setExtraMajor(0.0); copy.reverseOrderedCopyOf(*columnCopy); // get matrix data pointers const int * column = copy.getIndices(); const CoinBigIndex * rowStart = copy.getVectorStarts(); const int * rowLength = copy.getVectorLengths(); const double * elementByRow = copy.getElements(); //const int * row = columnCopy->getIndices(); //const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); //const int * columnLength = columnCopy->getVectorLengths(); //const double * element = columnCopy->getElements(); // if equality row and bounds mean artificial in basis bad // then do anyway for (iColumn = 0; iColumn < numberColumns_; iColumn++) { // - if we want to reduce dj, + if we want to increase int thisWay = 100; double lowerBound = columnLower_[iColumn]; double upperBound = columnUpper_[iColumn]; if (upperBound > lowerBound) { switch(getColumnStatus(iColumn)) { case basic: thisWay = 0; case ClpSimplex::isFixed: break; case isFree: case superBasic: if (dj[iColumn] < -dualTolerance) thisWay = 1; else if (dj[iColumn] > dualTolerance) thisWay = -1; else thisWay = 0; break; case atUpperBound: if (dj[iColumn] > dualTolerance) thisWay = -1; else if (dj[iColumn] < -dualTolerance) thisWay = -3; else thisWay = -2; break; case atLowerBound: if (dj[iColumn] < -dualTolerance) thisWay = 1; else if (dj[iColumn] > dualTolerance) thisWay = 3; else thisWay = 2; break; } } way[iColumn] = thisWay; } /*if (!numberBad) printf("Was dual feasible before passes - rows %d\n", numberRows_);*/ int lastNumberIn = -100000; int numberPasses = 5; while (numberIn > lastNumberIn + numberRows_ / 100) { lastNumberIn = numberIn; // we need to maximize chance of doing good int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { double lowerBound = rowLower_[iRow]; double upperBound = rowUpper_[iRow]; if (getRowStatus(iRow) == basic) { // see if we can find a column to pivot on int j; // down is amount pi can go down double maximumDown = COIN_DBL_MAX; double maximumUp = COIN_DBL_MAX; double minimumDown = 0.0; double minimumUp = 0.0; int iUp = -1; int iDown = -1; int iUpB = -1; int iDownB = -1; if (lowerBound < -1.0e20) maximumUp = -1.0; if (upperBound > 1.0e20) maximumDown = -1.0; for (j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; double value = elementByRow[j]; double djValue = dj[iColumn]; /* way - -3 - okay at upper bound with negative dj -2 - marginal at upper bound with zero dj - can only decrease -1 - bad at upper bound 0 - we can never pivot on this row 1 - bad at lower bound 2 - marginal at lower bound with zero dj - can only increase 3 - okay at lower bound with positive dj 100 - fine we can just ignore */ if (way[iColumn] != 100) { switch(way[iColumn]) { case -3: if (value > 0.0) { if (maximumDown * value > -djValue) { maximumDown = -djValue / value; iDown = iColumn; } } else { if (-maximumUp * value > -djValue) { maximumUp = djValue / value; iUp = iColumn; } } break; case -2: if (value > 0.0) { maximumDown = 0.0; } else { maximumUp = 0.0; } break; case -1: // see if could be satisfied // dj value > 0 if (value > 0.0) { maximumDown = 0.0; if (maximumUp * value < djValue - dualTolerance) { maximumUp = 0.0; // would improve but not enough } else { if (minimumUp * value < djValue) { minimumUp = djValue / value; iUpB = iColumn; } } } else { maximumUp = 0.0; if (-maximumDown * value < djValue - dualTolerance) { maximumDown = 0.0; // would improve but not enough } else { if (-minimumDown * value < djValue) { minimumDown = -djValue / value; iDownB = iColumn; } } } break; case 0: maximumDown = -1.0; maximumUp = -1.0; break; case 1: // see if could be satisfied // dj value < 0 if (value > 0.0) { maximumUp = 0.0; if (maximumDown * value < -djValue - dualTolerance) { maximumDown = 0.0; // would improve but not enough } else { if (minimumDown * value < -djValue) { minimumDown = -djValue / value; iDownB = iColumn; } } } else { maximumDown = 0.0; if (-maximumUp * value < -djValue - dualTolerance) { maximumUp = 0.0; // would improve but not enough } else { if (-minimumUp * value < -djValue) { minimumUp = djValue / value; iUpB = iColumn; } } } break; case 2: if (value > 0.0) { maximumUp = 0.0; } else { maximumDown = 0.0; } break; case 3: if (value > 0.0) { if (maximumUp * value > djValue) { maximumUp = djValue / value; iUp = iColumn; } } else { if (-maximumDown * value > djValue) { maximumDown = -djValue / value; iDown = iColumn; } } break; default: break; } } } if (iUpB >= 0) iUp = iUpB; if (maximumUp <= dualTolerance || maximumUp < minimumUp) iUp = -1; if (iDownB >= 0) iDown = iDownB; if (maximumDown <= dualTolerance || maximumDown < minimumDown) iDown = -1; if (iUp >= 0 || iDown >= 0) { // do something if (iUp >= 0 && iDown >= 0) { if (maximumDown > maximumUp) iUp = -1; } double change; int kColumn; if (iUp >= 0) { kColumn = iUp; change = maximumUp; // just do minimum if was dual infeasible // ? only if maximum large? if (minimumUp > 0.0) change = minimumUp; setRowStatus(iRow, atUpperBound); } else { kColumn = iDown; change = -maximumDown; // just do minimum if was dual infeasible // ? only if maximum large? if (minimumDown > 0.0) change = -minimumDown; setRowStatus(iRow, atLowerBound); } assert (fabs(change) < 1.0e200); setColumnStatus(kColumn, basic); numberIn++; pi[iRow] = change; for (j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; double value = elementByRow[j]; double djValue = dj[iColumn] - change * value; dj[iColumn] = djValue; if (abs(way[iColumn]) == 1) { numberBad--; /*if (!numberBad) printf("Became dual feasible at row %d out of %d\n", iRow, numberRows_);*/ lastNumberIn = -1000000; } int thisWay = 100; double lowerBound = columnLower_[iColumn]; double upperBound = columnUpper_[iColumn]; if (upperBound > lowerBound) { switch(getColumnStatus(iColumn)) { case basic: thisWay = 0; case isFixed: break; case isFree: case superBasic: if (djValue < -dualTolerance) thisWay = 1; else if (djValue > dualTolerance) thisWay = -1; else { thisWay = 0; } break; case atUpperBound: if (djValue > dualTolerance) { thisWay = -1; } else if (djValue < -dualTolerance) thisWay = -3; else thisWay = -2; break; case atLowerBound: if (djValue < -dualTolerance) { thisWay = 1; } else if (djValue > dualTolerance) thisWay = 3; else thisWay = 2; break; } } way[iColumn] = thisWay; } } } } if (numberIn == lastNumberIn || numberBad || pivot < 2) break; if (!(--numberPasses)) break; //printf("%d put in so far\n",numberIn); } // last attempt to flip for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double lowerBound = columnLower_[iColumn]; double upperBound = columnUpper_[iColumn]; if (upperBound - lowerBound <= gap && upperBound > lowerBound) { double djValue = dj[iColumn]; switch(getColumnStatus(iColumn)) { case basic: case ClpSimplex::isFixed: break; case isFree: case superBasic: break; case atUpperBound: if (djValue > dualTolerance) { setColumnStatus(iColumn, atUpperBound); solution[iColumn] = upperBound; } break; case atLowerBound: if (djValue < -dualTolerance) { setColumnStatus(iColumn, atUpperBound); solution[iColumn] = upperBound; } break; } } } delete [] pi; delete [] dj; delete [] way; handler_->message(CLP_CRASH, messages_) << numberIn << numberBad << CoinMessageEol; // could do elsewhere and could even if something done // see if some MUST be in basis if (!numberIn) { } returnCode = -1; } } else { delete [] dj; returnCode = -1; } //cleanStatus(); } return returnCode; } /* Pivot in a variable and out a variable. Returns 0 if okay, 1 if inaccuracy forced re-factorization, -1 if would be singular. Also updates primal/dual infeasibilities. Assumes sequenceIn_ and pivotRow_ set and also directionIn and Out. */ int ClpSimplex::pivot() { // scaling not allowed assert (!scalingFlag_); // assume In_ and Out_ are correct and directionOut_ set // (or In_ if flip lowerIn_ = lower_[sequenceIn_]; valueIn_ = solution_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; lowerOut_ = lower_[sequenceOut_]; valueOut_ = solution_[sequenceOut_]; upperOut_ = upper_[sequenceOut_]; // for now assume primal is feasible (or in dual) dualOut_ = dj_[sequenceOut_]; assert(fabs(dualOut_) < 1.0e-5); bool roundAgain = true; int returnCode = 0; bool updateSolution = true; while (roundAgain) { roundAgain = false; unpack(rowArray_[1]); factorization_->updateColumnFT(rowArray_[2], rowArray_[1]); alpha_ = 0.0; int i; int * index = rowArray_[1]->getIndices(); int number = rowArray_[1]->getNumElements(); double * element = rowArray_[1]->denseVector(); assert ( !rowArray_[3]->getNumElements()); double * saveSolution = rowArray_[3]->denseVector(); for (i = 0; i < number; i++) { int ii = index[i]; if ( pivotVariable_[ii] == sequenceOut_) { pivotRow_ = ii; alpha_ = element[pivotRow_]; break; } } if (fabs(alpha_) < 1.0e-8) { // be on safe side and clear arrays rowArray_[0]->clear(); rowArray_[1]->clear(); return -1; // will be singular } // we are going to subtract movement from current basic double movement; // see where incoming will go to if (sequenceOut_ < 0 || sequenceIn_ == sequenceOut_) { // flip so go to bound movement = ((directionIn_ > 0) ? upperIn_ : lowerIn_) - valueIn_; } else { // get where outgoing needs to get to double outValue = (directionOut_ < 0) ? upperOut_ : lowerOut_; // solutionOut_ - movement*alpha_ == outValue movement = (valueOut_ - outValue) / alpha_; // set directionIn_ correctly directionIn_ = (movement > 0) ? 1 : -1; } theta_ = movement; double oldValueIn = valueIn_; // update primal solution for (i = 0; i < number; i++) { int ii = index[i]; // get column int ij = pivotVariable_[ii]; double value = element[ii]; saveSolution[ii] = solution_[ij]; solution_[ij] -= movement * value; } //rowArray_[1]->setNumElements(0); // see where something went to #ifndef NDEBUG CoinRelFltEq eq(1.0e-7); #endif if (sequenceOut_ < 0) { if (directionIn_ < 0) { assert (eq(solution_[sequenceIn_], upperIn_)); solution_[sequenceIn_] = upperIn_; } else { assert (eq(solution_[sequenceIn_], lowerIn_)); solution_[sequenceIn_] = lowerIn_; } } else { if (directionOut_ < 0) { assert (eq(solution_[sequenceOut_], upperOut_)); solution_[sequenceOut_] = upperOut_; } else { assert (eq(solution_[sequenceOut_], lowerOut_)); solution_[sequenceOut_] = lowerOut_; } valueOut_ = solution_[sequenceOut_]; solution_[sequenceIn_] = valueIn_ + movement; } valueIn_ = solution_[sequenceIn_]; double objectiveChange = dualIn_ * movement; // update duals if (pivotRow_ >= 0) { if (fabs(alpha_) < 1.0e-8) { // be on safe side and clear arrays rowArray_[0]->clear(); rowArray_[1]->clear(); return -1; // will be singular } double multiplier = dualIn_ / alpha_; rowArray_[0]->insert(pivotRow_, multiplier); factorization_->updateColumnTranspose(rowArray_[2], rowArray_[0]); // put row of tableau in rowArray[0] and columnArray[0] matrix_->transposeTimes(this, -1.0, rowArray_[0], columnArray_[1], columnArray_[0]); // update column djs int i; int * index = columnArray_[0]->getIndices(); int number = columnArray_[0]->getNumElements(); double * element = columnArray_[0]->denseVector(); for (i = 0; i < number; i++) { int ii = index[i]; dj_[ii] += element[ii]; reducedCost_[ii] = dj_[ii]; element[ii] = 0.0; } columnArray_[0]->setNumElements(0); // and row djs index = rowArray_[0]->getIndices(); number = rowArray_[0]->getNumElements(); element = rowArray_[0]->denseVector(); for (i = 0; i < number; i++) { int ii = index[i]; dj_[ii+numberColumns_] += element[ii]; dual_[ii] = dj_[ii+numberColumns_]; element[ii] = 0.0; } rowArray_[0]->setNumElements(0); // check incoming assert (fabs(dj_[sequenceIn_]) < 1.0e-6 || CoinAbs(solveType_) == 2); } // if stable replace in basis int updateStatus = factorization_->replaceColumn(this, rowArray_[2], rowArray_[1], pivotRow_, alpha_); bool takePivot = true; // See if Factorization updated if (updateStatus) { updateSolution = false; returnCode = 1; } // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && lastGoodIteration_ == numberIterations_ && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4 || fabs(alpha_) < 1.0e-6) { // slight error if (factorization_->pivots() > 5 || updateStatus == 4) { returnCode = 1; } } else if (updateStatus == 2) { // major error - put back solution valueIn_ = oldValueIn; solution_[sequenceIn_] = valueIn_; int * index = rowArray_[1]->getIndices(); int number = rowArray_[1]->getNumElements(); for (i = 0; i < number; i++) { int ii = index[i]; // get column int ij = pivotVariable_[ii]; solution_[ij] = saveSolution[ii]; } if (sequenceOut_ >= 0) valueOut_ = solution_[sequenceOut_]; takePivot = false; if (factorization_->pivots()) { // refactorize here int factorStatus = internalFactorize(1); if (factorStatus) { printf("help in user pivot\n"); abort(); } gutsOfSolution(NULL, NULL); valueIn_ = solution_[sequenceIn_]; if (sequenceOut_ >= 0) valueOut_ = solution_[sequenceOut_]; roundAgain = true; } else { returnCode = -1; } } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (factorization_->pivots() < 0.5 * factorization_->maximumPivots() && factorization_->pivots() < 200) factorization_->areaFactor( factorization_->areaFactor() * 1.1); returnCode = 1; // factorize now } { // clear saveSolution int * index = rowArray_[1]->getIndices(); int number = rowArray_[1]->getNumElements(); for (i = 0; i < number; i++) { int ii = index[i]; saveSolution[ii] = 0.0; } } rowArray_[1]->clear(); if (takePivot) { int save = algorithm_; // make simple so always primal algorithm_ = 1; housekeeping(objectiveChange); algorithm_ = save; } } if (returnCode == 1) { // refactorize here int factorStatus = internalFactorize(1); if (factorStatus) { printf("help in user pivot\n"); abort(); } updateSolution = true; } if (updateSolution) { // just for now - recompute anyway gutsOfSolution(NULL, NULL); } return returnCode; } /* Pivot in a variable and choose an outgoing one. Assumes primal feasible - will not go through a bound. Returns step length in theta Returns ray in ray_ (or NULL if no pivot) Return codes as before but -1 means no acceptable pivot */ int ClpSimplex::primalPivotResult() { assert (sequenceIn_ >= 0); valueIn_ = solution_[sequenceIn_]; lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; if (!nonLinearCost_) nonLinearCost_ = new ClpNonLinearCost(this); int returnCode = static_cast (this)->pivotResult(); if (returnCode < 0 && returnCode > -4) { return 0; } else { COIN_DETAIL_PRINT(printf("Return code of %d from ClpSimplexPrimal::pivotResult\n", returnCode)); return -1; } } // Factorization frequency int ClpSimplex::factorizationFrequency() const { if (factorization_) return factorization_->maximumPivots(); else return -1; } void ClpSimplex::setFactorizationFrequency(int value) { if (factorization_) factorization_->maximumPivots(value); } // Common bits of coding for dual and primal int ClpSimplex::startup(int ifValuesPass, int startFinishOptions) { // Get rid of some arrays and empty factorization int useFactorization = false; if ((startFinishOptions & 2) != 0 && (whatsChanged_&(2 + 512)) == 2 + 512) useFactorization = true; // Keep factorization if possible #if 0 // seems to be needed if rows deleted later in CbcModel! if (!solution_ && scaledMatrix_) { // get rid of scaled matrix if (scaledMatrix_->getNumRows() != numberRows_) { delete scaledMatrix_; scaledMatrix_ = NULL; } } #endif // sanity check // bad if empty (trap here to avoid using bad matrix_) #if 0 // but also check bounds { int badProblem = 0; int i; for (i = 0; i < numberColumns_; i++) { if (columnLower_[i] > columnUpper_[i]) badProblem++; } for (i = 0; i < numberRows_; i++) { if (rowLower_[i] > rowUpper_[i]) badProblem++; } if (badProblem) { numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = badProblem; sumPrimalInfeasibilities_ = badProblem; secondaryStatus_ = 6; // so user can see something odd problemStatus_ = 1; bool printIt = (specialOptions_ & 32768) == 0 ? true : false; // no message if from Osi if (printIt) handler_->message(CLP_INFEASIBLE, messages_) << CoinMessageEol; return 2; } } #endif if (!matrix_ || (!matrix_->getNumElements() && objective_->type() < 2)) { int infeasNumber[2]; double infeasSum[2]; bool printIt = (specialOptions_ & 32768) == 0 ? true : false; // no message if from Osi problemStatus_ = emptyProblem(infeasNumber, infeasSum, printIt); if ((startFinishOptions & 1) != 0) { // User may expect user data - fill in as required if (numberRows_) { if (!pivotVariable_) pivotVariable_ = new int [numberRows_]; CoinIotaN(pivotVariable_, numberRows_, numberColumns_); } } numberDualInfeasibilities_ = infeasNumber[0]; sumDualInfeasibilities_ = infeasSum[0]; numberPrimalInfeasibilities_ = infeasNumber[1]; sumPrimalInfeasibilities_ = infeasSum[1]; return 2; } pivotRow_ = -1; sequenceIn_ = -1; sequenceOut_ = -1; secondaryStatus_ = 0; primalTolerance_ = dblParam_[ClpPrimalTolerance]; dualTolerance_ = dblParam_[ClpDualTolerance]; if (problemStatus_ != 10) numberIterations_ = 0; // put in standard form (and make row copy) // create modifiable copies of model rim and do optional scaling bool goodMatrix = createRim(7 + 8 + 16 + 32, true, startFinishOptions); if (goodMatrix) { // switch off factorization if bad if (pivotVariable_[0] < 0) useFactorization = false; // Model looks okay // Do initial factorization // and set certain stuff // We can either set increasing rows so ...IsBasic gives pivot row // or we can just increment iBasic one by one // for now let ...iBasic give pivot row int saveThreshold = factorization_->denseThreshold(); if (!useFactorization || factorization_->numberRows() != numberRows_) { useFactorization = false; factorization_->setDefaultValues(); // Switch off dense (unless special option set) if ((specialOptions_ & 8) == 0) factorization_->setDenseThreshold(-saveThreshold); } // If values pass then perturb (otherwise may be optimal so leave a bit) if (ifValuesPass) { // do perturbation if asked for if (perturbation_ < 100) { if (algorithm_ > 0 && (objective_->type() < 2 || !objective_->activated())) { #ifndef FEB_TRY //static_cast (this)->perturb(0); #endif } else if (algorithm_ < 0) { static_cast (this)->perturb(); } } } // for primal we will change bounds using infeasibilityCost_ if (nonLinearCost_ == NULL && algorithm_ > 0) { // get a valid nonlinear cost function nonLinearCost_ = new ClpNonLinearCost(this); } // loop round to clean up solution if values pass int numberThrownOut = -1; int totalNumberThrownOut = 0; problemStatus_ = -1; // see if we are re-using factorization if (!useFactorization) { while(numberThrownOut) { int status = internalFactorize(ifValuesPass ? 10 : 0); if (status < 0) return 1; // some error else numberThrownOut = status; // for this we need clean basis so it is after factorize if (!numberThrownOut || numberThrownOut == numberRows_ + 1) { // solution will be done again - skip if absolutely sure if ((specialOptions_ & 512) == 0 || numberThrownOut == numberRows_ + 1) { //int saveFirstFree=firstFree_; numberThrownOut = gutsOfSolution( NULL, NULL, ifValuesPass != 0); //firstFree_=saveFirstFree; bool badBasis = (largestPrimalError_ > 10.0); if (algorithm_>0 && largestDualError_ > 10.0 * infeasibilityCost_) badBasis=true; if (badBasis && !numberThrownOut) { // throw out up to 1000 structurals int iRow; int * sort = new int[numberRows_]; double * array = rowArray_[0]->denseVector(); memset(array, 0, numberRows_ * sizeof(double)); times(-1.0, columnActivityWork_, array); int numberBasic = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (iPivot < numberColumns_) { // column double difference = fabs(array[iRow] + rowActivityWork_[iRow]); if (difference > 1.0e-4) { sort[numberThrownOut] = iPivot; array[numberThrownOut++] = difference; if (getStatus(iPivot) == basic) numberBasic++; } } } if (!numberBasic) { allSlackBasis(true); numberThrownOut = 1; // force another go } else { CoinSort_2(array, array + numberThrownOut, sort); numberThrownOut = CoinMin(1000, numberThrownOut); for (iRow = 0; iRow < numberThrownOut; iRow++) { int iColumn = sort[iRow]; setColumnStatus(iColumn, superBasic); if (fabs(solution_[iColumn]) > 1.0e10) { if (upper_[iColumn] < 0.0) { solution_[iColumn] = upper_[iColumn]; } else if (lower_[iColumn] > 0.0) { solution_[iColumn] = lower_[iColumn]; } else { solution_[iColumn] = 0.0; } } } } CoinZeroN(array, numberRows_); delete [] sort; } } else { // make sure not optimal at once numberPrimalInfeasibilities_ = 1; numberThrownOut = 0; } } else { matrix_->rhsOffset(this, true); // redo rhs offset } totalNumberThrownOut += numberThrownOut; } } else { // using previous factorization - we assume fine if ((moreSpecialOptions_ & 8) == 0) { // but we need to say not optimal numberPrimalInfeasibilities_ = 1; numberDualInfeasibilities_ = 1; } matrix_->rhsOffset(this, true); // redo rhs offset } if (totalNumberThrownOut) handler_->message(CLP_SINGULARITIES, messages_) << totalNumberThrownOut << CoinMessageEol; // Switch back dense factorization_->setDenseThreshold(saveThreshold); if (!numberPrimalInfeasibilities_ && !numberDualInfeasibilities_ && !ifValuesPass && (!nonLinearCost_ || !nonLinearCost_->numberInfeasibilities())) problemStatus_ = 0; else assert(problemStatus_ == -1); // number of times we have declared optimality numberTimesOptimal_ = 0; if (disasterArea_) disasterArea_->intoSimplex(); return 0; } else { // bad matrix return 2; } } /* Get a clean factorization - i.e. throw out singularities may do more later */ int ClpSimplex::cleanFactorization(int ifValuesPass) { int status = internalFactorize(ifValuesPass ? 10 : 0); if (status < 0) { return 1; // some error } else { firstFree_=0; return 0; } } void ClpSimplex::finish(int startFinishOptions) { // Get rid of some arrays and empty factorization int getRidOfData = 1; if (upper_ && ((startFinishOptions & 1) != 0 || problemStatus_ == 10)) { getRidOfData = 0; // Keep stuff // mark all as current whatsChanged_ = 0x3ffffff; } else { whatsChanged_ &= ~0xffff; } double saveObjValue = objectiveValue_; deleteRim(getRidOfData); if (matrix_->type()>=15) objectiveValue_ = saveObjValue; // Skip message if changing algorithms if (problemStatus_ != 10) { if (problemStatus_ == -1) problemStatus_ = 4; assert(problemStatus_ >= 0 && problemStatus_ < 6); if (handler_->detail(CLP_SIMPLEX_FINISHED, messages_) < 100) { handler_->message(CLP_SIMPLEX_FINISHED + problemStatus_, messages_) << objectiveValue() << CoinMessageEol; } } factorization_->relaxAccuracyCheck(1.0); // get rid of any network stuff - could do more factorization_->cleanUp(); } // Save data ClpDataSave ClpSimplex::saveData() { ClpDataSave saved; saved.dualBound_ = dualBound_; saved.infeasibilityCost_ = infeasibilityCost_; saved.sparseThreshold_ = factorization_->sparseThreshold(); saved.pivotTolerance_ = factorization_->pivotTolerance(); saved.zeroFactorizationTolerance_ = factorization_->zeroTolerance(); saved.zeroSimplexTolerance_ = zeroTolerance_; saved.perturbation_ = perturbation_; saved.forceFactorization_ = forceFactorization_; saved.acceptablePivot_ = acceptablePivot_; saved.objectiveScale_ = objectiveScale_; // Progress indicator progress_.fillFromModel (this); return saved; } // Restore data void ClpSimplex::restoreData(ClpDataSave saved) { //factorization_->sparseThreshold(saved.sparseThreshold_); factorization_->pivotTolerance(saved.pivotTolerance_); factorization_->zeroTolerance(saved.zeroFactorizationTolerance_); zeroTolerance_ = saved.zeroSimplexTolerance_; perturbation_ = saved.perturbation_; infeasibilityCost_ = saved.infeasibilityCost_; dualBound_ = saved.dualBound_; forceFactorization_ = saved.forceFactorization_; objectiveScale_ = saved.objectiveScale_; acceptablePivot_ = saved.acceptablePivot_; } // To flag a variable (not inline to allow for column generation) void ClpSimplex::setFlagged( int sequence) { status_[sequence] |= 64; matrix_->generalExpanded(this, 7, sequence); lastFlaggedIteration_ = numberIterations_; } /* Factorizes and returns true if optimal. Used by user */ bool ClpSimplex::statusOfProblem(bool initial) { // We don't want scaling int saveFlag = scalingFlag_; if (!rowScale_) scalingFlag_ = 0; bool goodMatrix = createRim(7 + 8 + 16 + 32); if (!goodMatrix) { problemStatus_ = 4; scalingFlag_ = saveFlag; return false; } // is factorization okay? if (initial) { // First time - allow singularities int numberThrownOut = -1; int totalNumberThrownOut = 0; while(numberThrownOut) { int status = internalFactorize(0); if (status == numberRows_ + 1) status = 0; // all slack if (status < 0) { deleteRim(-1); scalingFlag_ = saveFlag; return false; // some error } else { numberThrownOut = status; } // for this we need clean basis so it is after factorize //if (!numberThrownOut) //numberThrownOut = gutsOfSolution( NULL,NULL, // false); //else //matrix_->rhsOffset(this,true); // redo rhs offset totalNumberThrownOut += numberThrownOut; } if (totalNumberThrownOut) handler_->message(CLP_SINGULARITIES, messages_) << totalNumberThrownOut << CoinMessageEol; } else { #ifndef NDEBUG int returnCode = internalFactorize(1); assert (!returnCode); #else internalFactorize(1); #endif } CoinMemcpyN(rowActivity_, numberRows_, rowActivityWork_); CoinMemcpyN(columnActivity_, numberColumns_, columnActivityWork_); gutsOfSolution(NULL, NULL); CoinMemcpyN(rowActivityWork_, numberRows_, rowActivity_); CoinMemcpyN(columnActivityWork_, numberColumns_, columnActivity_); CoinMemcpyN(dj_, numberColumns_, reducedCost_); deleteRim(-1); scalingFlag_ = saveFlag; return (primalFeasible() && dualFeasible()); } /* Return model - updates any scalars */ void ClpSimplex::returnModel(ClpSimplex & otherModel) { ClpModel::returnModel(otherModel); otherModel.bestPossibleImprovement_ = bestPossibleImprovement_; otherModel.columnPrimalSequence_ = columnPrimalSequence_; otherModel.zeroTolerance_ = zeroTolerance_; otherModel.rowPrimalSequence_ = rowPrimalSequence_; otherModel.bestObjectiveValue_ = bestObjectiveValue_; otherModel.moreSpecialOptions_ = moreSpecialOptions_; otherModel.baseIteration_ = baseIteration_; otherModel.primalToleranceToGetOptimal_ = primalToleranceToGetOptimal_; otherModel.largestPrimalError_ = largestPrimalError_; otherModel.largestDualError_ = largestDualError_; otherModel.alphaAccuracy_ = alphaAccuracy_; otherModel.alpha_ = alpha_; otherModel.theta_ = theta_; otherModel.lowerIn_ = lowerIn_; otherModel.valueIn_ = valueIn_; otherModel.upperIn_ = upperIn_; otherModel.dualIn_ = dualIn_; otherModel.sequenceIn_ = sequenceIn_; otherModel.directionIn_ = directionIn_; otherModel.lowerOut_ = lowerOut_; otherModel.valueOut_ = valueOut_; otherModel.upperOut_ = upperOut_; otherModel.dualOut_ = dualOut_; otherModel.sequenceOut_ = sequenceOut_; otherModel.directionOut_ = directionOut_; otherModel.pivotRow_ = pivotRow_; otherModel.algorithm_ = algorithm_; otherModel.sumDualInfeasibilities_ = sumDualInfeasibilities_; otherModel.numberDualInfeasibilities_ = numberDualInfeasibilities_; otherModel.numberDualInfeasibilitiesWithoutFree_ = numberDualInfeasibilitiesWithoutFree_; otherModel.sumPrimalInfeasibilities_ = sumPrimalInfeasibilities_; otherModel.numberPrimalInfeasibilities_ = numberPrimalInfeasibilities_; otherModel.numberTimesOptimal_ = numberTimesOptimal_; otherModel.disasterArea_ = NULL; otherModel.sumOfRelaxedDualInfeasibilities_ = sumOfRelaxedDualInfeasibilities_; otherModel.sumOfRelaxedPrimalInfeasibilities_ = sumOfRelaxedPrimalInfeasibilities_; if (perturbationArray_ != otherModel.perturbationArray_) delete [] perturbationArray_; perturbationArray_ = NULL; } /* Constructs a non linear cost from list of non-linearities (columns only) First lower of each column is taken as real lower Last lower is taken as real upper and cost ignored Returns nonzero if bad data e.g. lowers not monotonic */ int ClpSimplex::createPiecewiseLinearCosts(const int * starts, const double * lower, const double * gradient) { delete nonLinearCost_; // Set up feasible bounds and check monotonicity int iColumn; int returnCode = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { int iIndex = starts[iColumn]; int end = starts[iColumn+1] - 1; columnLower_[iColumn] = lower[iIndex]; columnUpper_[iColumn] = lower[end]; double value = columnLower_[iColumn]; iIndex++; for (; iIndex < end; iIndex++) { if (lower[iIndex] < value) returnCode++; // not monotonic value = lower[iIndex]; } } nonLinearCost_ = new ClpNonLinearCost(this, starts, lower, gradient); specialOptions_ |= 2; // say keep return returnCode; } /* For advanced use. When doing iterative solves things can get nasty so on values pass if incoming solution has largest infeasibility < incomingInfeasibility throw out variables from basis until largest infeasibility < allowedInfeasibility or incoming largest infeasibility. If allowedInfeasibility>= incomingInfeasibility this is always possible altough you may end up with an all slack basis. Defaults are 1.0,10.0 */ void ClpSimplex::setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility) { incomingInfeasibility_ = incomingInfeasibility; allowedInfeasibility_ = allowedInfeasibility; CoinAssert(incomingInfeasibility_ >= 0.0); CoinAssert(allowedInfeasibility_ >= incomingInfeasibility_); } // Allow initial dense factorization void ClpSimplex::setInitialDenseFactorization(bool onOff) { if (onOff) specialOptions_ |= 8; else specialOptions_ &= ~8; } bool ClpSimplex::initialDenseFactorization() const { return (specialOptions_ & 8) != 0; } /* This constructor modifies original ClpSimplex and stores original stuff in created ClpSimplex. It is only to be used in conjunction with originalModel */ ClpSimplex::ClpSimplex (ClpSimplex * wholeModel, int numberColumns, const int * whichColumns) { // Set up dummy row selection list numberRows_ = wholeModel->numberRows_; int * whichRow = new int [numberRows_]; int iRow; for (iRow = 0; iRow < numberRows_; iRow++) whichRow[iRow] = iRow; // ClpModel stuff (apart from numberColumns_) matrix_ = wholeModel->matrix_; rowCopy_ = wholeModel->rowCopy_; if (wholeModel->rowCopy_) { // note reversal of order wholeModel->rowCopy_ = wholeModel->rowCopy_->subsetClone(numberRows_, whichRow, numberColumns, whichColumns); } else { wholeModel->rowCopy_ = NULL; } whatsChanged_ &= ~0xffff; CoinAssert (wholeModel->matrix_); wholeModel->matrix_ = wholeModel->matrix_->subsetClone(numberRows_, whichRow, numberColumns, whichColumns); delete [] whichRow; numberColumns_ = wholeModel->numberColumns_; // Now ClpSimplex stuff and status_ delete wholeModel->primalColumnPivot_; wholeModel->primalColumnPivot_ = new ClpPrimalColumnSteepest(0); nonLinearCost_ = wholeModel->nonLinearCost_; // Now main arrays int iColumn; int numberTotal = numberRows_ + numberColumns; COIN_DETAIL_PRINT(printf("%d %d %d\n", numberTotal, numberRows_, numberColumns)); // mapping int * mapping = new int[numberRows_+numberColumns_]; for (iColumn = 0; iColumn < numberColumns_; iColumn++) mapping[iColumn] = -1; for (iRow = 0; iRow < numberRows_; iRow++) mapping[iRow+numberColumns_] = iRow + numberColumns; // Redo costs and bounds of whole model wholeModel->createRim(1 + 4, false); lower_ = wholeModel->lower_; wholeModel->lower_ = new double [numberTotal]; CoinMemcpyN(lower_ + numberColumns_, numberRows_, wholeModel->lower_ + numberColumns); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = whichColumns[iColumn]; wholeModel->lower_[iColumn] = lower_[jColumn]; // and pointer back mapping[jColumn] = iColumn; } #ifdef CLP_DEBUG for (iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) printf("mapx %d %d\n", iColumn, mapping[iColumn]); #endif // Re-define pivotVariable_ for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = wholeModel->pivotVariable_[iRow]; wholeModel->pivotVariable_[iRow] = mapping[iPivot]; #ifdef CLP_DEBUG printf("p row %d, pivot %d -> %d\n", iRow, iPivot, mapping[iPivot]); #endif assert (wholeModel->pivotVariable_[iRow] >= 0); } // Reverse mapping (so extended version of whichColumns) for (iColumn = 0; iColumn < numberColumns; iColumn++) mapping[iColumn] = whichColumns[iColumn]; for (; iColumn < numberRows_ + numberColumns; iColumn++) mapping[iColumn] = iColumn + (numberColumns_ - numberColumns); #ifdef CLP_DEBUG for (iColumn = 0; iColumn < numberRows_ + numberColumns; iColumn++) printf("map %d %d\n", iColumn, mapping[iColumn]); #endif // Save mapping somewhere - doesn't matter rowUpper_ = reinterpret_cast (mapping); upper_ = wholeModel->upper_; wholeModel->upper_ = new double [numberTotal]; for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; wholeModel->upper_[iColumn] = upper_[jColumn]; } cost_ = wholeModel->cost_; wholeModel->cost_ = new double [numberTotal]; for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; wholeModel->cost_[iColumn] = cost_[jColumn]; } dj_ = wholeModel->dj_; wholeModel->dj_ = new double [numberTotal]; for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; wholeModel->dj_[iColumn] = dj_[jColumn]; } solution_ = wholeModel->solution_; wholeModel->solution_ = new double [numberTotal]; for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; wholeModel->solution_[iColumn] = solution_[jColumn]; } // now see what variables left out do to row solution double * rowSolution = wholeModel->solution_ + numberColumns; double * fullSolution = solution_; double * sumFixed = new double[numberRows_]; memset (sumFixed, 0, numberRows_ * sizeof(double)); // zero out ones in small problem for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = mapping[iColumn]; fullSolution[jColumn] = 0.0; } // Get objective offset double originalOffset; wholeModel->getDblParam(ClpObjOffset, originalOffset); double offset = 0.0; const double * cost = cost_; for (iColumn = 0; iColumn < numberColumns_; iColumn++) offset += fullSolution[iColumn] * cost[iColumn]; wholeModel->setDblParam(ClpObjOffset, originalOffset - offset); setDblParam(ClpObjOffset, originalOffset); matrix_->times(1.0, fullSolution, sumFixed, wholeModel->rowScale_, wholeModel->columnScale_); double * lower = lower_ + numberColumns; double * upper = upper_ + numberColumns; double fixed = 0.0; for (iRow = 0; iRow < numberRows_; iRow++) { fixed += fabs(sumFixed[iRow]); if (lower[iRow] > -1.0e50) lower[iRow] -= sumFixed[iRow]; if (upper[iRow] < 1.0e50) upper[iRow] -= sumFixed[iRow]; rowSolution[iRow] -= sumFixed[iRow]; } COIN_DETAIL_PRINT(printf("offset %g sumfixed %g\n", offset, fixed)); delete [] sumFixed; columnScale_ = wholeModel->columnScale_; if (columnScale_) { wholeModel->columnScale_ = new double [numberTotal]; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int jColumn = mapping[iColumn]; wholeModel->columnScale_[iColumn] = columnScale_[jColumn]; } } status_ = wholeModel->status_; wholeModel->status_ = new unsigned char [numberTotal]; for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; wholeModel->status_[iColumn] = status_[jColumn]; } savedSolution_ = wholeModel->savedSolution_; if (savedSolution_) { wholeModel->savedSolution_ = new double [numberTotal]; for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; wholeModel->savedSolution_[iColumn] = savedSolution_[jColumn]; } } saveStatus_ = wholeModel->saveStatus_; if (saveStatus_) { wholeModel->saveStatus_ = new unsigned char [numberTotal]; for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; wholeModel->saveStatus_[iColumn] = saveStatus_[jColumn]; } } wholeModel->numberColumns_ = numberColumns; // Initialize weights wholeModel->primalColumnPivot_->saveWeights(wholeModel, 2); // Costs wholeModel->nonLinearCost_ = new ClpNonLinearCost(wholeModel); wholeModel->nonLinearCost_->checkInfeasibilities(); COIN_DETAIL_PRINT(printf("after contraction %d infeasibilities summing to %g\n", nonLinearCost_->numberInfeasibilities(), nonLinearCost_->sumInfeasibilities())); // Redo some stuff wholeModel->reducedCostWork_ = wholeModel->dj_; wholeModel->rowReducedCost_ = wholeModel->dj_ + wholeModel->numberColumns_; wholeModel->columnActivityWork_ = wholeModel->solution_; wholeModel->rowActivityWork_ = wholeModel->solution_ + wholeModel->numberColumns_; wholeModel->objectiveWork_ = wholeModel->cost_; wholeModel->rowObjectiveWork_ = wholeModel->cost_ + wholeModel->numberColumns_; wholeModel->rowLowerWork_ = wholeModel->lower_ + wholeModel->numberColumns_; wholeModel->columnLowerWork_ = wholeModel->lower_; wholeModel->rowUpperWork_ = wholeModel->upper_ + wholeModel->numberColumns_; wholeModel->columnUpperWork_ = wholeModel->upper_; #ifndef NDEBUG // Check status ClpSimplex * xxxx = wholeModel; int nBasic = 0; for (iColumn = 0; iColumn < xxxx->numberRows_ + xxxx->numberColumns_; iColumn++) if (xxxx->getStatus(iColumn) == basic) nBasic++; assert (nBasic == xxxx->numberRows_); for (iRow = 0; iRow < xxxx->numberRows_; iRow++) { int iPivot = xxxx->pivotVariable_[iRow]; assert (xxxx->getStatus(iPivot) == basic); } #endif } /* This copies back stuff from miniModel and then deletes miniModel. Only to be used with mini constructor */ void ClpSimplex::originalModel(ClpSimplex * miniModel) { int numberSmall = numberColumns_; numberColumns_ = miniModel->numberColumns_; int numberTotal = numberSmall + numberRows_; // copy back int iColumn; int * mapping = reinterpret_cast (miniModel->rowUpper_); #ifdef CLP_DEBUG for (iColumn = 0; iColumn < numberRows_ + numberColumns_; iColumn++) printf("mapb %d %d\n", iColumn, mapping[iColumn]); #endif // miniModel actually has full arrays // now see what variables left out do to row solution double * fullSolution = miniModel->solution_; double * sumFixed = new double[numberRows_]; memset (sumFixed, 0, numberRows_ * sizeof(double)); miniModel->matrix_->times(1.0, fullSolution, sumFixed, rowScale_, miniModel->columnScale_); for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; miniModel->lower_[jColumn] = lower_[iColumn]; miniModel->upper_[jColumn] = upper_[iColumn]; miniModel->cost_[jColumn] = cost_[iColumn]; miniModel->dj_[jColumn] = dj_[iColumn]; miniModel->solution_[jColumn] = solution_[iColumn]; miniModel->status_[jColumn] = status_[iColumn]; #ifdef CLP_DEBUG printf("%d in small -> %d in original\n", iColumn, jColumn); #endif } delete [] lower_; lower_ = miniModel->lower_; delete [] upper_; upper_ = miniModel->upper_; delete [] cost_; cost_ = miniModel->cost_; delete [] dj_; dj_ = miniModel->dj_; delete [] solution_; solution_ = miniModel->solution_; delete [] status_; status_ = miniModel->status_; if (columnScale_) { for (iColumn = 0; iColumn < numberSmall; iColumn++) { int jColumn = mapping[iColumn]; miniModel->columnScale_[jColumn] = columnScale_[iColumn]; } delete [] columnScale_; columnScale_ = miniModel->columnScale_; } if (savedSolution_) { if (!miniModel->savedSolution_) { miniModel->savedSolution_ = ClpCopyOfArray(solution_, numberColumns_ + numberRows_); } else { for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; miniModel->savedSolution_[jColumn] = savedSolution_[iColumn]; } } delete [] savedSolution_; savedSolution_ = miniModel->savedSolution_; } if (saveStatus_) { if (!miniModel->saveStatus_) { miniModel->saveStatus_ = ClpCopyOfArray(status_, numberColumns_ + numberRows_); } else { for (iColumn = 0; iColumn < numberTotal; iColumn++) { int jColumn = mapping[iColumn]; miniModel->saveStatus_[jColumn] = saveStatus_[iColumn]; } } delete [] saveStatus_; saveStatus_ = miniModel->saveStatus_; } // Re-define pivotVariable_ int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; #ifdef CLP_DEBUG printf("pb row %d, pivot %d -> %d\n", iRow, iPivot, mapping[iPivot]); #endif pivotVariable_[iRow] = mapping[iPivot]; assert (pivotVariable_[iRow] >= 0); } // delete stuff and move back delete matrix_; delete rowCopy_; delete primalColumnPivot_; delete nonLinearCost_; matrix_ = miniModel->matrix_; rowCopy_ = miniModel->rowCopy_; nonLinearCost_ = miniModel->nonLinearCost_; double originalOffset; miniModel->getDblParam(ClpObjOffset, originalOffset); setDblParam(ClpObjOffset, originalOffset); // Redo some stuff reducedCostWork_ = dj_; rowReducedCost_ = dj_ + numberColumns_; columnActivityWork_ = solution_; rowActivityWork_ = solution_ + numberColumns_; objectiveWork_ = cost_; rowObjectiveWork_ = cost_ + numberColumns_; rowLowerWork_ = lower_ + numberColumns_; columnLowerWork_ = lower_; rowUpperWork_ = upper_ + numberColumns_; columnUpperWork_ = upper_; // Cleanup for (iRow = 0; iRow < numberRows_; iRow++) { double value = rowActivityWork_[iRow] + sumFixed[iRow]; rowActivityWork_[iRow] = value; switch(getRowStatus(iRow)) { case basic: break; case atUpperBound: //rowActivityWork_[iRow]=rowUpperWork_[iRow]; break; case ClpSimplex::isFixed: case atLowerBound: //rowActivityWork_[iRow]=rowLowerWork_[iRow]; break; case isFree: break; // superbasic case superBasic: break; } } delete [] sumFixed; nonLinearCost_->checkInfeasibilities(); COIN_DETAIL_PRINT(printf("in original %d infeasibilities summing to %g\n", nonLinearCost_->numberInfeasibilities(), nonLinearCost_->sumInfeasibilities())); // Initialize weights primalColumnPivot_ = new ClpPrimalColumnSteepest(10); primalColumnPivot_->saveWeights(this, 2); #ifndef NDEBUG // Check status ClpSimplex * xxxx = this; int nBasic = 0; for (iColumn = 0; iColumn < xxxx->numberRows_ + xxxx->numberColumns_; iColumn++) if (xxxx->getStatus(iColumn) == basic) nBasic++; assert (nBasic == xxxx->numberRows_); for (iRow = 0; iRow < xxxx->numberRows_; iRow++) { int iPivot = xxxx->pivotVariable_[iRow]; assert (xxxx->getStatus(iPivot) == basic); } #endif } // Pass in Event handler (cloned and deleted at end) void ClpSimplex::passInEventHandler(const ClpEventHandler * eventHandler) { delete eventHandler_; eventHandler_ = eventHandler->clone(); eventHandler_->setSimplex(this); } #ifndef NDEBUG // For errors to make sure print to screen // only called in debug mode static void indexError(int index, std::string methodName) { std::cerr << "Illegal index " << index << " in ClpSimplex::" << methodName << std::endl; throw CoinError("Illegal index", methodName, "ClpSimplex"); } #endif // These are only to be used using startFinishOptions (ClpSimplexDual, ClpSimplexPrimal) //Get a row of the tableau (slack part in slack if not NULL) void ClpSimplex::getBInvARow(int row, double* z, double * slack) { #ifndef NDEBUG int n = numberRows(); if (row < 0 || row >= n) { indexError(row, "getBInvARow"); } #endif if (!rowArray_[0]) { printf("ClpSimplexPrimal or ClpSimplexDual must have been called with correct startFinishOption\n"); abort(); } CoinIndexedVector * rowArray0 = rowArray(0); CoinIndexedVector * rowArray1 = rowArray(1); CoinIndexedVector * columnArray0 = columnArray(0); CoinIndexedVector * columnArray1 = columnArray(1); rowArray0->clear(); rowArray1->clear(); columnArray0->clear(); columnArray1->clear(); // put +1 in row // But swap if pivot variable was slack as clp stores slack as -1.0 int pivot = pivotVariable_[row]; double value; // And if scaled then adjust if (!rowScale_) { if (pivot < numberColumns_) value = 1.0; else value = -1.0; } else { if (pivot < numberColumns_) value = columnScale_[pivot]; else value = -1.0 * inverseRowScale_[pivot-numberColumns_]; } rowArray1->insert(row, value); factorization_->updateColumnTranspose(rowArray0, rowArray1); // put row of tableau in rowArray1 and columnArray0 clpMatrix()->transposeTimes(this, 1.0, rowArray1, columnArray1, columnArray0); if (!rowScale_) { CoinMemcpyN(columnArray0->denseVector(), numberColumns_, z); } else { double * array = columnArray0->denseVector(); for (int i = 0; i < numberColumns_; i++) z[i] = array[i] * inverseColumnScale_[i]; } if (slack) { if (!rowScale_) { CoinMemcpyN(rowArray1->denseVector(), numberRows_, slack); } else { double * array = rowArray1->denseVector(); for (int i = 0; i < numberRows_; i++) slack[i] = array[i] * rowScale_[i]; } } // don't need to clear everything always, but doesn't cost rowArray0->clear(); rowArray1->clear(); columnArray0->clear(); columnArray1->clear(); } //Get a row of the basis inverse void ClpSimplex::getBInvRow(int row, double* z) { #ifndef NDEBUG int n = numberRows(); if (row < 0 || row >= n) { indexError(row, "getBInvRow"); } #endif if (!rowArray_[0]) { printf("ClpSimplexPrimal or ClpSimplexDual must have been called with correct startFinishOption\n"); abort(); } ClpFactorization * factorization = factorization_; CoinIndexedVector * rowArray0 = rowArray(0); CoinIndexedVector * rowArray1 = rowArray(1); rowArray0->clear(); rowArray1->clear(); // put +1 in row // But swap if pivot variable was slack as clp stores slack as -1.0 double value = (pivotVariable_[row] < numberColumns_) ? 1.0 : -1.0; // but scale if (rowScale_) { int pivot = pivotVariable_[row]; if (pivot < numberColumns_) value *= columnScale_[pivot]; else value /= rowScale_[pivot-numberColumns_]; } rowArray1->insert(row, value); factorization->updateColumnTranspose(rowArray0, rowArray1); if (!rowScale_) { CoinMemcpyN(rowArray1->denseVector(), numberRows_, z); } else { double * array = rowArray1->denseVector(); for (int i = 0; i < numberRows_; i++) { z[i] = array[i] * rowScale_[i]; } } rowArray1->clear(); } //Get a column of the tableau void ClpSimplex::getBInvACol(int col, double* vec) { if (!rowArray_[0]) { printf("ClpSimplexPrimal or ClpSimplexDual should have been called with correct startFinishOption\n"); abort(); } CoinIndexedVector * rowArray0 = rowArray(0); CoinIndexedVector * rowArray1 = rowArray(1); rowArray0->clear(); rowArray1->clear(); // get column of matrix #ifndef NDEBUG int n = numberColumns_ + numberRows_; if (col < 0 || col >= n) { indexError(col, "getBInvACol"); } #endif if (!rowScale_) { if (col < numberColumns_) { unpack(rowArray1, col); } else { rowArray1->insert(col - numberColumns_, 1.0); } } else { if (col < numberColumns_) { unpack(rowArray1, col); double multiplier = 1.0 * inverseColumnScale_[col]; int number = rowArray1->getNumElements(); int * index = rowArray1->getIndices(); double * array = rowArray1->denseVector(); for (int i = 0; i < number; i++) { int iRow = index[i]; // make sure not packed assert (array[iRow]); array[iRow] *= multiplier; } } else { rowArray1->insert(col - numberColumns_, rowScale_[col-numberColumns_]); } } factorization_->updateColumn(rowArray0, rowArray1, false); // But swap if pivot variable was slack as clp stores slack as -1.0 double * array = rowArray1->denseVector(); if (!rowScale_) { for (int i = 0; i < numberRows_; i++) { double multiplier = (pivotVariable_[i] < numberColumns_) ? 1.0 : -1.0; vec[i] = multiplier * array[i]; } } else { for (int i = 0; i < numberRows_; i++) { int pivot = pivotVariable_[i]; if (pivot < numberColumns_) vec[i] = array[i] * columnScale_[pivot]; else vec[i] = - array[i] / rowScale_[pivot-numberColumns_]; } } rowArray1->clear(); } //Get a column of the basis inverse void ClpSimplex::getBInvCol(int col, double* vec) { if (!rowArray_[0]) { printf("ClpSimplexPrimal or ClpSimplexDual must have been called with correct startFinishOption\n"); abort(); } CoinIndexedVector * rowArray0 = rowArray(0); CoinIndexedVector * rowArray1 = rowArray(1); rowArray0->clear(); rowArray1->clear(); #ifndef NDEBUG int n = numberRows(); if (col < 0 || col >= n) { indexError(col, "getBInvCol"); } #endif // put +1 in row // but scale double value; if (!rowScale_) { value = 1.0; } else { value = rowScale_[col]; } rowArray1->insert(col, value); factorization_->updateColumn(rowArray0, rowArray1, false); // But swap if pivot variable was slack as clp stores slack as -1.0 double * array = rowArray1->denseVector(); if (!rowScale_) { for (int i = 0; i < numberRows_; i++) { double multiplier = (pivotVariable_[i] < numberColumns_) ? 1.0 : -1.0; vec[i] = multiplier * array[i]; } } else { for (int i = 0; i < numberRows_; i++) { int pivot = pivotVariable_[i]; double value = array[i]; if (pivot < numberColumns_) vec[i] = value * columnScale_[pivot]; else vec[i] = - value / rowScale_[pivot-numberColumns_]; } } rowArray1->clear(); } /* Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBInvACol() and getBInvCol()). */ void ClpSimplex::getBasics(int* index) { if (!rowArray_[0]) { printf("ClpSimplexPrimal or ClpSimplexDual must have been called with correct startFinishOption\n"); abort(); } CoinAssert (index); CoinMemcpyN(pivotVariable(), numberRows(), index); } /* Set an objective function coefficient */ void ClpSimplex::setObjectiveCoefficient( int elementIndex, double elementValue ) { #ifndef NDEBUG if (elementIndex < 0 || elementIndex >= numberColumns_) { indexError(elementIndex, "setObjectiveCoefficient"); } #endif if (objective()[elementIndex] != elementValue) { objective()[elementIndex] = elementValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~64; double direction = optimizationDirection_ * objectiveScale_; if (!rowScale_) { objectiveWork_[elementIndex] = direction * elementValue; } else { objectiveWork_[elementIndex] = direction * elementValue * columnScale_[elementIndex]; } } } } /* Set a single row lower bound
    Use -DBL_MAX for -infinity. */ void ClpSimplex::setRowLower( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberRows_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setRowLower"); } #endif if (elementValue < -1.0e27) elementValue = -COIN_DBL_MAX; if (rowLower_[elementIndex] != elementValue) { rowLower_[elementIndex] = elementValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~16; if (rowLower_[elementIndex] == -COIN_DBL_MAX) { rowLowerWork_[elementIndex] = -COIN_DBL_MAX; } else if (!rowScale_) { rowLowerWork_[elementIndex] = elementValue * rhsScale_; } else { rowLowerWork_[elementIndex] = elementValue * rhsScale_ * rowScale_[elementIndex]; } } } } /* Set a single row upper bound
    Use DBL_MAX for infinity. */ void ClpSimplex::setRowUpper( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberRows_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setRowUpper"); } #endif if (elementValue > 1.0e27) elementValue = COIN_DBL_MAX; if (rowUpper_[elementIndex] != elementValue) { rowUpper_[elementIndex] = elementValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~32; if (rowUpper_[elementIndex] == COIN_DBL_MAX) { rowUpperWork_[elementIndex] = COIN_DBL_MAX; } else if (!rowScale_) { rowUpperWork_[elementIndex] = elementValue * rhsScale_; } else { rowUpperWork_[elementIndex] = elementValue * rhsScale_ * rowScale_[elementIndex]; } } } } /* Set a single row lower and upper bound */ void ClpSimplex::setRowBounds( int elementIndex, double lowerValue, double upperValue ) { #ifndef NDEBUG int n = numberRows_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setRowBounds"); } #endif if (lowerValue < -1.0e27) lowerValue = -COIN_DBL_MAX; if (upperValue > 1.0e27) upperValue = COIN_DBL_MAX; //CoinAssert (upperValue>=lowerValue); if (rowLower_[elementIndex] != lowerValue) { rowLower_[elementIndex] = lowerValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~16; if (rowLower_[elementIndex] == -COIN_DBL_MAX) { rowLowerWork_[elementIndex] = -COIN_DBL_MAX; } else if (!rowScale_) { rowLowerWork_[elementIndex] = lowerValue * rhsScale_; } else { rowLowerWork_[elementIndex] = lowerValue * rhsScale_ * rowScale_[elementIndex]; } } } if (rowUpper_[elementIndex] != upperValue) { rowUpper_[elementIndex] = upperValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~32; if (rowUpper_[elementIndex] == COIN_DBL_MAX) { rowUpperWork_[elementIndex] = COIN_DBL_MAX; } else if (!rowScale_) { rowUpperWork_[elementIndex] = upperValue * rhsScale_; } else { rowUpperWork_[elementIndex] = upperValue * rhsScale_ * rowScale_[elementIndex]; } } } } void ClpSimplex::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { #ifndef NDEBUG int n = numberRows_; #endif int numberChanged = 0; const int * saveFirst = indexFirst; while (indexFirst != indexLast) { const int iRow = *indexFirst++; #ifndef NDEBUG if (iRow < 0 || iRow >= n) { indexError(iRow, "setRowSetBounds"); } #endif double lowerValue = *boundList++; double upperValue = *boundList++; if (lowerValue < -1.0e27) lowerValue = -COIN_DBL_MAX; if (upperValue > 1.0e27) upperValue = COIN_DBL_MAX; //CoinAssert (upperValue>=lowerValue); if (rowLower_[iRow] != lowerValue) { rowLower_[iRow] = lowerValue; whatsChanged_ &= ~16; numberChanged++; } if (rowUpper_[iRow] != upperValue) { rowUpper_[iRow] = upperValue; whatsChanged_ &= ~32; numberChanged++; } } if (numberChanged && (whatsChanged_ & 1) != 0) { indexFirst = saveFirst; while (indexFirst != indexLast) { const int iRow = *indexFirst++; if (rowLower_[iRow] == -COIN_DBL_MAX) { rowLowerWork_[iRow] = -COIN_DBL_MAX; } else if (!rowScale_) { rowLowerWork_[iRow] = rowLower_[iRow] * rhsScale_; } else { rowLowerWork_[iRow] = rowLower_[iRow] * rhsScale_ * rowScale_[iRow]; } if (rowUpper_[iRow] == COIN_DBL_MAX) { rowUpperWork_[iRow] = COIN_DBL_MAX; } else if (!rowScale_) { rowUpperWork_[iRow] = rowUpper_[iRow] * rhsScale_; } else { rowUpperWork_[iRow] = rowUpper_[iRow] * rhsScale_ * rowScale_[iRow]; } } } } //----------------------------------------------------------------------------- /* Set a single column lower bound
    Use -DBL_MAX for -infinity. */ void ClpSimplex::setColumnLower( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnLower"); } #endif if (elementValue < -1.0e27) elementValue = -COIN_DBL_MAX; if (columnLower_[elementIndex] != elementValue) { columnLower_[elementIndex] = elementValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~128; double value; if (columnLower_[elementIndex] == -COIN_DBL_MAX) { value = -COIN_DBL_MAX; } else if (!columnScale_) { value = elementValue * rhsScale_; } else { value = elementValue * rhsScale_ / columnScale_[elementIndex]; } lower_[elementIndex] = value; if (maximumRows_ >= 0) lower_[elementIndex+maximumRows_+maximumColumns_] = value; } } } /* Set a single column upper bound
    Use DBL_MAX for infinity. */ void ClpSimplex::setColumnUpper( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnUpper"); } #endif if (elementValue > 1.0e27) elementValue = COIN_DBL_MAX; if (columnUpper_[elementIndex] != elementValue) { columnUpper_[elementIndex] = elementValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~256; double value; if (columnUpper_[elementIndex] == COIN_DBL_MAX) { value = COIN_DBL_MAX; } else if (!columnScale_) { value = elementValue * rhsScale_; } else { value = elementValue * rhsScale_ / columnScale_[elementIndex]; } //assert (columnUpperWork_==upper_); upper_[elementIndex] = value; if (maximumRows_ >= 0) upper_[elementIndex+maximumRows_+maximumColumns_] = value; } } } /* Set a single column lower and upper bound */ void ClpSimplex::setColumnBounds( int elementIndex, double lowerValue, double upperValue ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnBounds"); } #endif if (lowerValue < -1.0e27) lowerValue = -COIN_DBL_MAX; if (columnLower_[elementIndex] != lowerValue) { columnLower_[elementIndex] = lowerValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~128; if (columnLower_[elementIndex] == -COIN_DBL_MAX) { lower_[elementIndex] = -COIN_DBL_MAX; } else if (!columnScale_) { lower_[elementIndex] = lowerValue * rhsScale_; } else { lower_[elementIndex] = lowerValue * rhsScale_ / columnScale_[elementIndex]; } } } if (upperValue > 1.0e27) upperValue = COIN_DBL_MAX; //CoinAssert (upperValue>=lowerValue); if (columnUpper_[elementIndex] != upperValue) { columnUpper_[elementIndex] = upperValue; if ((whatsChanged_ & 1) != 0) { // work arrays exist - update as well whatsChanged_ &= ~256; if (columnUpper_[elementIndex] == COIN_DBL_MAX) { upper_[elementIndex] = COIN_DBL_MAX; } else if (!columnScale_) { upper_[elementIndex] = upperValue * rhsScale_; } else { upper_[elementIndex] = upperValue * rhsScale_ / columnScale_[elementIndex]; } } } } void ClpSimplex::setColumnSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { #ifndef NDEBUG int n = numberColumns_; #endif int numberChanged = 0; const int * saveFirst = indexFirst; while (indexFirst != indexLast) { const int iColumn = *indexFirst++; #ifndef NDEBUG if (iColumn < 0 || iColumn >= n) { indexError(iColumn, "setColumnSetBounds"); } #endif double lowerValue = *boundList++; double upperValue = *boundList++; if (lowerValue < -1.0e27) lowerValue = -COIN_DBL_MAX; if (upperValue > 1.0e27) upperValue = COIN_DBL_MAX; //CoinAssert (upperValue>=lowerValue); if (columnLower_[iColumn] != lowerValue) { columnLower_[iColumn] = lowerValue; whatsChanged_ &= ~16; numberChanged++; } if (columnUpper_[iColumn] != upperValue) { columnUpper_[iColumn] = upperValue; whatsChanged_ &= ~32; numberChanged++; } } if (numberChanged && (whatsChanged_ & 1) != 0) { indexFirst = saveFirst; while (indexFirst != indexLast) { const int iColumn = *indexFirst++; if (columnLower_[iColumn] == -COIN_DBL_MAX) { lower_[iColumn] = -COIN_DBL_MAX; } else if (!columnScale_) { lower_[iColumn] = columnLower_[iColumn] * rhsScale_; } else { lower_[iColumn] = columnLower_[iColumn] * rhsScale_ / columnScale_[iColumn]; } if (columnUpper_[iColumn] == COIN_DBL_MAX) { upper_[iColumn] = COIN_DBL_MAX; } else if (!columnScale_) { upper_[iColumn] = columnUpper_[iColumn] * rhsScale_; } else { upper_[iColumn] = columnUpper_[iColumn] * rhsScale_ / columnScale_[iColumn]; } } } } /* Just check solution (for internal use) - sets sum of infeasibilities etc. */ void ClpSimplex::checkSolutionInternal() { double dualTolerance = dblParam_[ClpDualTolerance]; double primalTolerance = dblParam_[ClpPrimalTolerance]; double nonLinearOffset = 0.0; const double * objective = objective_->gradient(this, columnActivity_, nonLinearOffset, true); int iRow, iColumn; assert (!rowObjective_); objectiveValue_ = -nonLinearOffset; // now look at solution sumPrimalInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; double maxmin = optimizationDirection_; for (iRow = 0; iRow < numberRows_; iRow++) { double dualValue = dual_[iRow] * maxmin; double primalValue = rowActivity_[iRow]; double lower = rowLower_[iRow]; double upper = rowUpper_[iRow]; ClpSimplex::Status status = getRowStatus(iRow); if (status != basic) { if (lower == upper) { status = ClpSimplex::isFixed; } else if (primalValue > upper - primalTolerance) { status = ClpSimplex::atUpperBound; } else if (primalValue < lower + primalTolerance) { status = ClpSimplex::atLowerBound; } setRowStatus(iRow, status); } if (primalValue > upper + primalTolerance) { sumPrimalInfeasibilities_ += primalValue - upper - primalTolerance; numberPrimalInfeasibilities_ ++; } else if (primalValue < lower - primalTolerance) { sumPrimalInfeasibilities_ += lower - primalValue - primalTolerance; numberPrimalInfeasibilities_ ++; } else { switch(status) { case basic: case ClpSimplex::isFixed: break; case atUpperBound: // dual should not be positive if (dualValue > dualTolerance) { sumDualInfeasibilities_ += dualValue - dualTolerance_; numberDualInfeasibilities_ ++; } break; case atLowerBound: // dual should not be negative if (dualValue < -dualTolerance) { sumDualInfeasibilities_ -= dualValue + dualTolerance_; numberDualInfeasibilities_ ++; } break; case superBasic: case isFree: if (primalValue < upper - primalTolerance) { // dual should not be negative if (dualValue < -dualTolerance) { sumDualInfeasibilities_ -= dualValue + dualTolerance_; numberDualInfeasibilities_ ++; } } if (primalValue > lower + primalTolerance) { // dual should not be positive if (dualValue > dualTolerance) { sumDualInfeasibilities_ += dualValue - dualTolerance_; numberDualInfeasibilities_ ++; } } break; } } } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double dualValue = reducedCost_[iColumn] * maxmin; double primalValue = columnActivity_[iColumn]; objectiveValue_ += objective[iColumn] * primalValue; double lower = columnLower_[iColumn]; double upper = columnUpper_[iColumn]; ClpSimplex::Status status = getColumnStatus(iColumn); if (status != basic && lower == upper) { status = ClpSimplex::isFixed; setColumnStatus(iColumn, ClpSimplex::isFixed); } if (primalValue > upper + primalTolerance) { sumPrimalInfeasibilities_ += primalValue - upper - primalTolerance; numberPrimalInfeasibilities_ ++; } else if (primalValue < lower - primalTolerance) { sumPrimalInfeasibilities_ += lower - primalValue - primalTolerance; numberPrimalInfeasibilities_ ++; } else { switch(status) { case basic: // dual should be zero if (fabs(dualValue) > 10.0 * dualTolerance) { sumDualInfeasibilities_ += fabs(dualValue) - dualTolerance_; numberDualInfeasibilities_ ++; //if (fabs(dualValue) > 1000.0 * dualTolerance) //setColumnStatus(iColumn,superBasic); Maybe on a switch } break; case ClpSimplex::isFixed: break; case atUpperBound: // dual should not be positive if (dualValue > dualTolerance) { sumDualInfeasibilities_ += dualValue - dualTolerance_; numberDualInfeasibilities_ ++; } break; case atLowerBound: // dual should not be negative if (dualValue < -dualTolerance) { sumDualInfeasibilities_ -= dualValue + dualTolerance_; numberDualInfeasibilities_ ++; } break; case superBasic: case isFree: if (primalValue < upper - primalTolerance) { // dual should not be negative if (dualValue < -dualTolerance) { sumDualInfeasibilities_ -= dualValue + dualTolerance_; numberDualInfeasibilities_ ++; } } if (primalValue > lower + primalTolerance) { // dual should not be positive if (dualValue > dualTolerance) { sumDualInfeasibilities_ += dualValue - dualTolerance_; numberDualInfeasibilities_ ++; } } break; } } } objectiveValue_ += objective_->nonlinearOffset(); // But do direction objectiveValue_ *= optimizationDirection_; if (!numberDualInfeasibilities_ && !numberPrimalInfeasibilities_) problemStatus_ = 0; else problemStatus_ = -1; } /* When scaling is on it is possible that the scaled problem is feasible but the unscaled is not. Clp returns a secondary status code to that effect. This option allows for a cleanup. If you use it I would suggest 1. This only affects actions when scaled optimal 0 - no action 1 - clean up using dual if primal infeasibility 2 - clean up using dual if dual infeasibility 3 - clean up using dual if primal or dual infeasibility 11,12,13 - as 1,2,3 but use primal */ #ifdef COUNT_CLEANUPS static int n1 = 0; static int n2 = 0; static int n3 = 0; #endif int ClpSimplex::cleanup(int cleanupScaling) { #ifdef COUNT_CLEANUPS n1++; #endif int returnCode = 0; if (!problemStatus_ && cleanupScaling) { int check = cleanupScaling % 10; bool primal = (secondaryStatus_ == 2 || secondaryStatus_ == 4); bool dual = (secondaryStatus_ == 3 || secondaryStatus_ == 4); if (((check & 1) != 0 && primal) || (((check & 2) != 0) && dual)) { // need cleanup int saveScalingFlag = scalingFlag_; // say matrix changed whatsChanged_ |= 1; scaling(0); if (cleanupScaling < 10) { // dual returnCode = this->dual(); } else { // primal returnCode = this->primal(); } #ifdef COUNT_CLEANUPS n2++; n3 += numberIterations_; //printf("**cleanup took %d iterations\n",numberIterations_); #endif scaling(saveScalingFlag); } } return returnCode; } #ifdef COUNT_CLEANUPS void printHowMany() { printf("There were %d cleanups out of %d solves and %d iterations\n", n2, n1, n3); } #endif #ifndef SLIM_CLP #include "CoinWarmStartBasis.hpp" // Returns a basis (to be deleted by user) CoinWarmStartBasis * ClpSimplex::getBasis() const { int iRow, iColumn; CoinWarmStartBasis * basis = new CoinWarmStartBasis(); basis->setSize(numberColumns_, numberRows_); if (statusExists()) { // Flip slacks int lookupA[] = {0, 1, 3, 2, 0, 2}; for (iRow = 0; iRow < numberRows_; iRow++) { int iStatus = getRowStatus(iRow); iStatus = lookupA[iStatus]; basis->setArtifStatus(iRow, static_cast (iStatus)); } int lookupS[] = {0, 1, 2, 3, 0, 3}; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { int iStatus = getColumnStatus(iColumn); iStatus = lookupS[iStatus]; basis->setStructStatus(iColumn, static_cast (iStatus)); } } return basis; } #endif // Compute objective value from solution void ClpSimplex::computeObjectiveValue(bool useInternalArrays) { int iSequence; objectiveValue_ = 0.0; const double * obj = objective(); if (!useInternalArrays) { for (iSequence = 0; iSequence < numberColumns_; iSequence++) { double value = columnActivity_[iSequence]; objectiveValue_ += value * obj[iSequence]; } // But remember direction as we are using external objective objectiveValue_ *= optimizationDirection_; } else if (!columnScale_) { for (iSequence = 0; iSequence < numberColumns_; iSequence++) { double value = columnActivityWork_[iSequence]; objectiveValue_ += value * obj[iSequence]; } // But remember direction as we are using external objective objectiveValue_ *= optimizationDirection_; objectiveValue_ += objective_->nonlinearOffset(); objectiveValue_ /= (objectiveScale_ * rhsScale_); } else { for (iSequence = 0; iSequence < numberColumns_; iSequence++) { double scaleFactor = columnScale_[iSequence]; double valueScaled = columnActivityWork_[iSequence]; objectiveValue_ += valueScaled * scaleFactor * obj[iSequence]; } // But remember direction as we are using external objective objectiveValue_ *= optimizationDirection_; objectiveValue_ += objective_->nonlinearOffset(); objectiveValue_ /= (objectiveScale_ * rhsScale_); } } // Compute minimization objective value from internal solution double ClpSimplex::computeInternalObjectiveValue() { int iSequence; //double oldObj = objectiveValue_; double objectiveValue = 0.0; const double * obj = objective(); if (!columnScale_) { for (iSequence = 0; iSequence < numberColumns_; iSequence++) { double value = solution_[iSequence]; objectiveValue += value * obj[iSequence]; } } else { for (iSequence = 0; iSequence < numberColumns_; iSequence++) { double value = solution_[iSequence] * columnScale_[iSequence]; objectiveValue += value * obj[iSequence]; } } objectiveValue *= optimizationDirection_ / rhsScale_; objectiveValue -= dblParam_[ClpObjOffset]; return objectiveValue; } // Infeasibility/unbounded ray (NULL returned if none/wrong) double * ClpSimplex::infeasibilityRay(bool fullRay) const { double * array = NULL; if (problemStatus_ == 1 && ray_) { if (!fullRay) { array = ClpCopyOfArray(ray_, numberRows_); } else { array = new double [numberRows_+numberColumns_]; memcpy(array,ray_,numberRows_*sizeof(double)); memset(array+numberRows_,0,numberColumns_*sizeof(double)); transposeTimes(-1.0,array,array+numberRows_); } #ifdef PRINT_RAY_METHOD printf("Infeasibility ray obtained by algorithm %s - direction out %d\n",algorithm_>0 ? "primal" : "dual",directionOut_); #endif } return array; } // If user left factorization frequency then compute void ClpSimplex::defaultFactorizationFrequency() { if (factorizationFrequency() == 200) { // User did not touch preset const int cutoff1 = 10000; const int base = 75; const int freq0 = 50; int frequency; #if ABC_CLP_DEFAULTS const int cutoff2 = 100000; const int freq1 = 200; const int freq2 = 400; const int maximum = 1000; if (numberRows_ < cutoff1) frequency = base + numberRows_ / freq0; else if (numberRows_ < cutoff2) frequency = base + cutoff1 / freq0 + (numberRows_ - cutoff1) / freq1; else frequency = base + cutoff1 / freq0 + (cutoff2 - cutoff1) / freq1 + (numberRows_ - cutoff2) / freq2; #else const int freq1 = 150; const int maximum = 10000; if (numberRows_ < cutoff1) frequency = base + numberRows_ / freq0; else frequency = base + cutoff1 / freq0 + (numberRows_ - cutoff1) / freq1; #endif //frequency *= 1.05; setFactorizationFrequency(CoinMin(maximum, frequency)); } } // Gets clean and emptyish factorization ClpFactorization * ClpSimplex::getEmptyFactorization() { if ((specialOptions_ & 65536) == 0) { assert (!factorization_); factorization_ = new ClpFactorization(); } else if (!factorization_) { factorization_ = new ClpFactorization(); factorization_->setPersistenceFlag(1); } return factorization_; } // May delete or may make clean and emptyish factorization void ClpSimplex::setEmptyFactorization() { if (factorization_) { factorization_->cleanUp(); if ((specialOptions_ & 65536) == 0) { delete factorization_; factorization_ = NULL; } else if (factorization_) { factorization_->almostDestructor(); } } } /* Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 but give a bit extra if bigger needed */ void ClpSimplex::setPersistenceFlag(int value) { if (value) { //specialOptions_|=65536; startPermanentArrays(); } else { specialOptions_ &= ~65536; } if (factorization_) factorization_->setPersistenceFlag(value); } // Move status and solution across void ClpSimplex::moveInfo(const ClpSimplex & rhs, bool justStatus) { objectiveValue_ = rhs.objectiveValue_; numberIterations_ = rhs. numberIterations_; problemStatus_ = rhs. problemStatus_; secondaryStatus_ = rhs. secondaryStatus_; if (numberRows_ == rhs.numberRows_ && numberColumns_ == rhs.numberColumns_ && !justStatus) { if (rhs.status_) { if (status_) CoinMemcpyN(rhs.status_, numberRows_ + numberColumns_, status_); else status_ = CoinCopyOfArray(rhs.status_, numberRows_ + numberColumns_); } else { delete [] status_; status_ = NULL; } CoinMemcpyN(rhs.columnActivity_, numberColumns_, columnActivity_); CoinMemcpyN(rhs.reducedCost_, numberColumns_, reducedCost_); CoinMemcpyN(rhs.rowActivity_, numberRows_, rowActivity_); CoinMemcpyN(rhs.dual_, numberRows_, dual_); } } // Save a copy of model with certain state - normally without cuts void ClpSimplex::makeBaseModel() { delete baseModel_; baseModel_ = new ClpSimplex(*this); } // Switch off base model void ClpSimplex::deleteBaseModel() { delete baseModel_; baseModel_ = NULL; } // Reset to base model void ClpSimplex::setToBaseModel(ClpSimplex * model) { if (!model) model = baseModel_; assert (model); int multiplier = ((model->specialOptions_ & 65536) != 0) ? 2 : 1; assert (multiplier == 2); if (multiplier == 2) { assert (model->maximumRows_ >= 0); if (maximumRows_ < 0) { specialOptions_ |= 65536; maximumRows_ = model->maximumRows_; maximumColumns_ = model->maximumColumns_; } } COIN_DETAIL_PRINT(printf("resetbase a %d rows, %d maximum rows\n", numberRows_, maximumRows_)); // temporary - later use maximumRows_ for rowUpper_ etc assert (numberRows_ >= model->numberRows_); abort(); } // Start or reset using maximumRows_ and Columns_ bool ClpSimplex::startPermanentArrays() { int maximumRows = maximumRows_; int maximumColumns = maximumColumns_; ClpModel::startPermanentArrays(); if (maximumRows != maximumRows_ || maximumColumns != maximumColumns_) { #if 0 maximumInternalRows_ = maximumRows_; maximumInternalColumns_ = maximumColumns_; int numberTotal2 = (maximumRows_ + maximumColumns_) * 2; delete [] cost_; cost_ = new double[numberTotal2]; delete [] lower_; delete [] upper_; lower_ = new double[numberTotal2]; upper_ = new double[numberTotal2]; delete [] dj_; dj_ = new double[numberTotal2]; delete [] solution_; solution_ = new double[numberTotal2]; assert (scalingFlag_ > 0); if (rowScale_ && rowScale_ != savedRowScale_) delete [] rowScale_; rowScale_ = NULL; // Do initial scaling delete [] savedRowScale_; savedRowScale_ = new double [4*maximumRows_]; delete [] savedColumnScale_; savedColumnScale_ = new double [4*maximumColumns_]; if (scalingFlag_ > 0) { rowScale_ = savedRowScale_; columnScale_ = savedColumnScale_; if (matrix_->scale(this)) { scalingFlag_ = -scalingFlag_; // not scaled after all assert (!rowScale_); } int numberRows2 = numberRows_ + numberExtraRows_; if (rowScale_) { CoinMemcpyN(rowScale_, 2 * numberRows2, savedRowScale_ + 2 * maximumRows_); CoinMemcpyN(columnScale_, 2 * numberColumns_, savedColumnScale_ + 2 * maximumColumns_); } else { abort(); CoinFillN(savedRowScale_ + 2 * maximumRows_, 2 * numberRows2, 1.0); CoinFillN(savedColumnScale_ + 2 * maximumColumns_, 2 * numberColumns_, 1.0); } } #else createRim(63); #endif return true; } else { return false; } } #include "ClpNode.hpp" //#define COIN_DEVELOP // Fathom - 1 if solution int ClpSimplex::fathom(void * stuff) { assert (stuff); ClpNodeStuff * info = reinterpret_cast (stuff); info->nNodes_ = 0; // say can declare optimal moreSpecialOptions_ |= 8; int saveMaxIterations = maximumIterations(); setMaximumIterations((((moreSpecialOptions_&2048)==0) ? 200 : 2000) + 2 * (numberRows_ + numberColumns_)); double saveObjLimit; getDblParam(ClpDualObjectiveLimit, saveObjLimit); if (perturbation_<100) { double limit = saveObjLimit * optimizationDirection_; setDblParam(ClpDualObjectiveLimit, (limit+1.0e-2+1.0e-7*fabs(limit))*optimizationDirection_); } #if 0 bool onOptimal = (numberColumns_==100); double optVal[133]; { memset(optVal, 0, sizeof(optVal)); #if 0 int intIndicesV[] = {61, 62, 65, 66, 67, 68, 69, 70}; double intSolnV[] = {4., 21., 4., 4., 6., 1., 25., 8.}; int vecLen = sizeof(intIndicesV) / sizeof(int); for (int i = 0; i < vecLen; i++) { optVal[intIndicesV[i]] = intSolnV[i]; } #else int intIndicesAt1[] = { 0, 18, 25, 36, 44, 59, 61, 77, 82, 93 }; int vecLen = sizeof(intIndicesAt1) / sizeof(int); for (int i = 0; i < vecLen; i++) { optVal[intIndicesAt1[i]] = 1; } #endif } if (numberColumns_ == 100) { const char * integerType = integerInformation(); for (int i = 0; i < 100; i++) { if (integerType[i]) { if (columnLower_[i] > optVal[i] || columnUpper_[i] < optVal[i]) { onOptimal = false; break; } } } if (onOptimal) { printf("On optimal path fathom\n"); } } #endif if (info->presolveType_) { // crunch down bool feasible = true; // Use dual region double * rhs = dual_; int * whichRow = new int[3*numberRows_]; int * whichColumn = new int[2*numberColumns_]; int nBound; bool tightenBounds = ((specialOptions_ & 64) == 0) ? false : true; ClpSimplex * small = static_cast (this)->crunch(rhs, whichRow, whichColumn, nBound, false, tightenBounds); if (small) { //double limit = 0.0; //getDblParam(ClpDualObjectiveLimit, limit); //printf("objlimit a %g",limit); //small->getDblParam(ClpDualObjectiveLimit, limit); //printf(" %g\n",limit); // pack down pseudocosts small->moreSpecialOptions_ = moreSpecialOptions_; if (info->upPseudo_) { const char * integerType2 = small->integerInformation(); int n = small->numberColumns(); int k = 0; int jColumn = 0; int j = 0; for (int i = 0; i < n; i++) { if (integerType2[i]) { int iColumn = whichColumn[i]; // find while (jColumn != iColumn) { if (integerType_[jColumn]) j++; jColumn++; } info->priority_[k] = info->priority_[j]; info->upPseudo_[k] = info->upPseudo_[j]; info->numberUp_[k] = info->numberUp_[j]; info->numberUpInfeasible_[k] = info->numberUpInfeasible_[j]; info->downPseudo_[k] = info->downPseudo_[j]; info->numberDown_[k] = info->numberDown_[j]; info->numberDownInfeasible_[k] = info->numberDownInfeasible_[j]; assert (info->upPseudo_[k] > 1.0e-40 && info->upPseudo_[k] < 1.0e40); assert (info->downPseudo_[k] > 1.0e-40 && info->downPseudo_[k] < 1.0e40); k++; } } } #if 0 small->dual(); if (small->problemStatus() == 0) { //problemStatus_ = 0; } else if (small->problemStatus() != 3) { feasible = false; } else { if (small->problemStatus_ == 3) { // may be problems printf("need coding from OsiClp for crunch\n"); abort(); } } #endif } else { feasible = false; } int returnCode = 0; if (feasible) { info->presolveType_ = 0; // save and move pseudo costs returnCode = small->fathom(stuff); // restore pseudocosts if (info->upPseudo_) { int n = small->numberColumns(); int * back = new int [numberColumns_]; int numberIntegers = 0; for (int i = 0; i < numberColumns_; i++) { if (integerType_[i]) { back[i] = -10 - numberIntegers; numberIntegers++; } else { back[i] = -1; } } const char * integerType2 = small->integerInformation(); int numberIntegers2 = 0; for (int i = 0; i < n; i++) { int iColumn = whichColumn[i]; if (integerType2[i]) { int iBack = -back[iColumn]; assert (iBack >= 10); iBack -= 10; back[iColumn] = iBack; numberIntegers2++; } } int k = numberIntegers2; for (int i = numberColumns_ - 1; i >= 0; i--) { int iBack = back[i]; if (iBack <= -10) { // fixed integer numberIntegers--; info->numberUp_[numberIntegers] = -1; // say not updated } else if (iBack >= 0) { // not fixed integer numberIntegers--; k--; assert (info->upPseudo_[k] > 1.0e-40 && info->upPseudo_[k] < 1.0e40); assert (info->downPseudo_[k] > 1.0e-40 && info->downPseudo_[k] < 1.0e40); info->upPseudo_[numberIntegers] = info->upPseudo_[k]; info->numberUp_[numberIntegers] = info->numberUp_[k]; info->numberUpInfeasible_[numberIntegers] = info->numberUpInfeasible_[k]; info->downPseudo_[numberIntegers] = info->downPseudo_[k]; info->numberDown_[numberIntegers] = info->numberDown_[k]; info->numberDownInfeasible_[numberIntegers] = info->numberDownInfeasible_[k]; } } delete [] back; } if (returnCode) { bool fixBounds = (info->nNodes_ >= 0) ? true : false; //check this does everything static_cast (this)->afterCrunch(*small, whichRow, whichColumn, nBound); bool badSolution = false; for (int i = 0; i < numberColumns_; i++) { if (integerType_[i]) { double value = columnActivity_[i]; double value2 = floor(value + 0.5); if (fabs(value - value2) >= 1.0e-4) { // Very odd - can't use badSolution = true; } columnActivity_[i] = value2; if (fixBounds) { columnLower_[i] = value2; columnUpper_[i] = value2; } } } if (badSolution) { info->nNodes_ = -1; returnCode = 0; } //setLogLevel(63); //double objectiveValue=doubleCheck(); //printf("Solution of %g\n",objectiveValue); } delete small; } delete [] whichRow; delete [] whichColumn; setMaximumIterations(saveMaxIterations); setDblParam(ClpDualObjectiveLimit, saveObjLimit); return returnCode; } int returnCode = startFastDual2(info); if (returnCode) { stopFastDual2(info); setMaximumIterations(saveMaxIterations); setDblParam(ClpDualObjectiveLimit, saveObjLimit); return returnCode; } // Get fake bounds correctly //(static_cast(this))->resetFakeBounds(1); gutsOfSolution ( NULL, NULL); double dummyChange; (static_cast(this))->changeBounds(3, NULL, dummyChange); int saveNumberFake = numberFake_; int status = fastDual2(info); #if 0 { int iPivot; double * array = rowArray_[3]->denseVector(); int i; for (iPivot = 0; iPivot < numberRows_; iPivot++) { int iSequence = pivotVariable_[iPivot]; unpack(rowArray_[3], iSequence); factorization_->updateColumn(rowArray_[2], rowArray_[3]); assert (fabs(array[iPivot] - 1.0) < 1.0e-4); array[iPivot] = 0.0; for (i = 0; i < numberRows_; i++) assert (fabs(array[i]) < 1.0e-4); rowArray_[3]->clear(); } } #endif CoinAssert (problemStatus_ || objectiveValue_ < 1.0e50); if (status && problemStatus_ != 3) { // not finished - might be optimal checkPrimalSolution(rowActivityWork_, columnActivityWork_); double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); //printf("objlimit b %g\n",limit); if (!numberPrimalInfeasibilities_ && objectiveValue()*optimizationDirection_ < limit) { problemStatus_ = 0; } status = problemStatus_; } if (problemStatus_ != 0 && problemStatus_ != 1) { #ifdef COIN_DEVELOP printf("bad status %d on initial fast dual %d its\n", problemStatus_, numberIterations_); #endif info->nNodes_ = -1; setMaximumIterations(saveMaxIterations); setDblParam(ClpDualObjectiveLimit, saveObjLimit); return 0; } int numberNodes = 1; int numberIterations = numberIterations_; #if defined(COIN_DEVELOP) || !defined(NO_FATHOM_PRINT) int printFrequency = 2000; #endif if (problemStatus_ == 1) { //printf("fathom infeasible on initial\n"); stopFastDual2(info); info->numberNodesExplored_ = 1; info->numberIterations_ = numberIterations; setMaximumIterations(saveMaxIterations); setDblParam(ClpDualObjectiveLimit, saveObjLimit); return 0; } else if (problemStatus_ != 0) { stopFastDual2(info); info->numberNodesExplored_ = 1; info->numberIterations_ = numberIterations; setMaximumIterations(saveMaxIterations); setDblParam(ClpDualObjectiveLimit, saveObjLimit); // say bad info->nNodes_ = -1; return 0; } if (!columnScale_) { CoinMemcpyN(solution_, numberColumns_, columnActivity_); } else { assert(columnActivity_); assert(columnScale_); assert(solution_); int j; for (j = 0; j < numberColumns_; j++) columnActivity_[j] = solution_[j] * columnScale_[j]; } double increment = info->integerIncrement_; int maxDepthSize = 10; int maxDepth = 0; int depth = 0; // Get fake bounds correctly (static_cast(this))->changeBounds(3, NULL, dummyChange); saveNumberFake = numberFake_; ClpNode ** nodes = new ClpNode * [maxDepthSize]; int numberTotal = numberRows_ + numberColumns_; double * saveLower = CoinCopyOfArray(columnLower_, numberColumns_); double * saveUpper = CoinCopyOfArray(columnUpper_, numberColumns_); double * saveLowerInternal = CoinCopyOfArray(lower_, numberTotal); double * saveUpperInternal = CoinCopyOfArray(upper_, numberTotal); double * bestLower = NULL; double * bestUpper = NULL; int * back = new int [numberColumns_]; int numberIntegers = 0; double sumChanges = 1.0e-5; int numberChanges = 1; for (int i = 0; i < numberColumns_; i++) { if (integerType_[i]) back[i] = numberIntegers++; else back[i] = -1; } unsigned char * bestStatus = NULL; double bestObjective; getDblParam(ClpDualObjectiveLimit, bestObjective); double saveBestObjective = bestObjective; bool backtrack = false; bool printing = handler_->logLevel() > 0; // Say can stop without cleaning up in primal moreSpecialOptions_ |= 2097152; while (depth >= 0) { // If backtrack get to correct depth if (backtrack) { depth--; while (depth >= 0) { if (!nodes[depth]->fathomed()) { nodes[depth]->changeState(); break; } //if (printing) //printf("deleting node at depth %d\n",depth); //delete nodes[depth]; //nodes[depth]=NULL; depth--; } if (depth < 0) break; // apply // First if backtracking we need to restore factorization, bounds and weights CoinMemcpyN(saveLowerInternal, numberTotal, lower_); CoinMemcpyN(saveUpperInternal, numberTotal, upper_); CoinMemcpyN(saveLower, numberColumns_, columnLower_); CoinMemcpyN(saveUpper, numberColumns_, columnUpper_); for (int i = 0; i < depth; i++) { nodes[i]->applyNode(this, 0); } nodes[depth]->applyNode(this, 1); int iColumn = nodes[depth]->sequence(); if (printing) printf("after backtracking - applying node at depth %d - variable %d (%g,%g)\n", depth, iColumn, columnLower_[iColumn], columnUpper_[iColumn]); depth++; } else { // just bounds if (depth > 0) { nodes[depth-1]->applyNode(this, 0); int iColumn = nodes[depth-1]->sequence(); if (printing) printf("No backtracking - applying node at depth-m %d - variable %d (%g,%g)\n", depth - 1, iColumn, columnLower_[iColumn], columnUpper_[iColumn]); } } // solve #if 0 { int iPivot; double * array = rowArray_[3]->denseVector(); int i; for (iPivot = 0; iPivot < numberRows_; iPivot++) { int iSequence = pivotVariable_[iPivot]; unpack(rowArray_[3], iSequence); factorization_->updateColumn(rowArray_[2], rowArray_[3]); assert (fabs(array[iPivot] - 1.0) < 1.0e-4); array[iPivot] = 0.0; for (i = 0; i < numberRows_; i++) assert (fabs(array[i]) < 1.0e-4); rowArray_[3]->clear(); } } #endif #ifdef COIN_DEVELOP static int zzzzzz=0; zzzzzz++; if ((zzzzzz%100000)==0) printf("%d fathom solves\n",zzzzzz); if (zzzzzz==-1) { printf("TROUBLE\n"); } #endif // Get fake bounds correctly (static_cast(this))->changeBounds(3, NULL, dummyChange); int statusWeights = fastDual2(info); #if 0 if (statusWeights==100) printf("weights ok\n"); else printf("weights not ok\n"); #endif #if 0 { int iPivot; double * array = rowArray_[3]->denseVector(); int i; for (iPivot = 0; iPivot < numberRows_; iPivot++) { int iSequence = pivotVariable_[iPivot]; unpack(rowArray_[3], iSequence); factorization_->updateColumn(rowArray_[2], rowArray_[3]); assert (fabs(array[iPivot] - 1.0) < 1.0e-4); array[iPivot] = 0.0; for (i = 0; i < numberRows_; i++) assert (fabs(array[i]) < 1.0e-4); rowArray_[3]->clear(); } } #endif // give up if odd numberNodes++; numberIterations += numberIterations_; if (problemStatus_ > 1) { info->nNodes_ = -1; #ifdef COIN_DEVELOP printf("OUCH giving up on loop! %d %d %d %d - zzzzzz %d - max %d\n", numberNodes, numberIterations, problemStatus_, numberIterations_,zzzzzz,intParam_[0]); printf("xx %d\n", numberIterations*(numberRows_ + numberColumns_)); //abort(); #endif #ifdef CLP_USEFUL_PRINTOUT printf("too long in one solve (%d iterations) average %d iterations %d nodes\n", numberIterations_,numberIterations,numberNodes); #endif break; } if (numberNodes>20) { if (numberIterations>200*numberNodes) { info->nNodes_ = -2; #ifdef CLP_USEFUL_PRINTOUT printf("too long average %d iterations %d nodes\n", numberIterations,numberNodes); #endif break; } } else { if (numberIterations>4000) { info->nNodes_ = -2; #ifdef CLP_USEFUL_PRINTOUT printf("too long average %d iterations %d nodes\n", numberIterations,numberNodes); #endif break; } } if ((numberNodes % 1000) == 0) { #ifdef COIN_DEVELOP if ((numberNodes % printFrequency) == 0) { printf("Fathoming from node %d - %d nodes (%d iterations) - current depth %d\n", info->nodeCalled_,numberNodes, numberIterations, depth+info->startingDepth_); printFrequency *= 2; } #elif !defined(NO_FATHOM_PRINT) if ((numberNodes % printFrequency) == 0) { if ((moreSpecialOptions_&2048)!=0) info->handler_->message(CLP_FATHOM_STATUS, messages_) << info->nodeCalled_ << numberNodes << numberIterations << depth+info->startingDepth_ << CoinMessageEol; printFrequency *= 2; } #endif if ((numberIterations*(numberRows_ + numberColumns_) > 5.0e10 || numberNodes > 1.5e4) && (moreSpecialOptions_&4096)==0) { // give up info->nNodes_ = -10; #ifdef COIN_DEVELOP printf("OUCH giving up on nodes %d %d\n", numberNodes, numberIterations); printf("xx %d\n", numberIterations*(numberRows_ + numberColumns_)); //abort(); #endif break; } } if (problemStatus_ == 1 || (problemStatus_ == 0 && objectiveValue()*optimizationDirection_ > bestObjective)) { backtrack = true; if (printing) printf("infeasible at depth %d\n", depth); if (depth > 0) { int way = nodes[depth-1]->way(); int sequence = nodes[depth-1]->sequence(); #ifndef NDEBUG double branchingValue = nodes[depth-1]->branchingValue(); if (way > 0) assert (columnLower_[sequence] == ceil(branchingValue)); else assert (columnUpper_[sequence] == floor(branchingValue)); #endif sequence = back[sequence]; double change = bestObjective - nodes[depth-1]->objectiveValue(); if (change > 1.0e10) change = 10.0 * sumChanges / (1.0 + numberChanges); info->update(way, sequence, change, false); } } else if (problemStatus_ != 0) { abort(); } else { // Create node ClpNode * node; computeDuals(NULL); if (depth > 0) { int way = nodes[depth-1]->way(); int sequence = nodes[depth-1]->sequence(); #ifndef NDEBUG double branchingValue = nodes[depth-1]->branchingValue(); if (way > 0) assert (columnLower_[sequence] == ceil(branchingValue)); else assert (columnUpper_[sequence] == floor(branchingValue)); #endif sequence = back[sequence]; info->update(way, sequence, objectiveValue() - nodes[depth-1]->objectiveValue(), true); numberChanges++; sumChanges += objectiveValue() - nodes[depth-1]->objectiveValue(); } if (depth < maxDepth) { node = nodes[depth]; node->gutsOfConstructor(this, info, 1, depth); } else { node = new ClpNode(this, info, depth); if (depth == maxDepthSize) { maxDepthSize = 2 * maxDepthSize + 10; ClpNode ** temp = new ClpNode * [maxDepthSize]; for (int i = 0; i < depth; i++) temp[i] = nodes[i]; delete [] nodes; nodes = temp; } nodes[maxDepth++] = node; } #if 0 if (numberColumns_ == 100 && onOptimal) { const char * integerType = integerInformation(); bool localOptimal=true; for (int i = 0; i < 100; i++) { if (integerType[i]) { if (columnLower_[i] > optVal[i] || columnUpper_[i] < optVal[i]) { localOptimal = false; printf("bad %d %g %g %g\n", i, columnLower_[i], optVal[i], columnUpper_[i]); break; } } } if (localOptimal) { printf("still on optimal\n"); } assert (onOptimal); } #endif double objectiveValue=0.0; if (node->sequence() < 0) { objectiveValue = doubleCheck(); node->gutsOfConstructor(this, info, 1, depth); } if (node->sequence() < 0) { // solution //double objectiveValue = doubleCheck(); if (objectiveValue < bestObjective) { #ifdef COIN_DEVELOP printf("Fathoming from node %d - solution of %g after %d nodes at depth %d\n", info->nodeCalled_,objectiveValue, numberNodes, depth+info->startingDepth_); #elif !defined(NO_FATHOM_PRINT) if ((moreSpecialOptions_&2048)!=0) info->handler_->message(CLP_FATHOM_SOLUTION, messages_) << info->nodeCalled_ << objectiveValue << numberNodes << depth+info->startingDepth_ << CoinMessageEol; #endif // later then lower_ not columnLower_ (and total?) delete [] bestLower; bestLower = CoinCopyOfArray(columnLower_, numberColumns_); delete [] bestUpper; bestUpper = CoinCopyOfArray(columnUpper_, numberColumns_); delete [] bestStatus; bestStatus = CoinCopyOfArray(status_, numberTotal); bestObjective = objectiveValue - increment; if (perturbation_<100) { // be safer - but still cut off others bestObjective += 1.0e-5+1.0e-7*fabs(bestObjective); bestObjective = CoinMin(bestObjective, objectiveValue-1.0e-5); } setDblParam(ClpDualObjectiveLimit, bestObjective * optimizationDirection_); } else { //#define CLP_INVESTIGATE #ifdef COIN_DEVELOP printf("why bad solution feasible\n"); #endif } //delete node; backtrack = true; } else { if (printing) printf("depth %d variable %d\n", depth, node->sequence()); depth++; backtrack = false; //nodes[depth++] = new ClpNode (this,info); } } } if (!info->nNodes_) assert (depth == -1); for (int i = 0; i < maxDepth; i++) delete nodes[i]; delete [] nodes; delete [] back; stopFastDual2(info); #ifndef NO_FATHOM_PRINT if ((moreSpecialOptions_&2048)!=0 && numberNodes >= 10000) info->handler_->message(CLP_FATHOM_FINISH, messages_) << info->nodeCalled_ << info->startingDepth_ << numberNodes << numberIterations << maxDepth+info->startingDepth_ << CoinMessageEol; #endif //printf("fathom finished after %d nodes\n",numberNodes); if (bestStatus) { CoinMemcpyN(bestLower, numberColumns_, columnLower_); CoinMemcpyN(bestUpper, numberColumns_, columnUpper_); CoinMemcpyN(bestStatus, numberTotal, status_); delete [] bestLower; delete [] bestUpper; delete [] bestStatus; setDblParam(ClpDualObjectiveLimit, saveBestObjective); saveObjLimit = saveBestObjective; int saveOptions = specialOptions_; specialOptions_ &= ~65536; dual(); specialOptions_ = saveOptions; info->numberNodesExplored_ = numberNodes; info->numberIterations_ = numberIterations; returnCode = 1; } else { info->numberNodesExplored_ = numberNodes; info->numberIterations_ = numberIterations; returnCode = 0; } if (info->nNodes_ < 0) { if (lower_) { CoinMemcpyN(saveLowerInternal, numberTotal, lower_); CoinMemcpyN(saveUpperInternal, numberTotal, upper_); numberFake_ = saveNumberFake; } CoinMemcpyN(saveLower, numberColumns_, columnLower_); CoinMemcpyN(saveUpper, numberColumns_, columnUpper_); } delete [] saveLower; delete [] saveUpper; delete [] saveLowerInternal; delete [] saveUpperInternal; setMaximumIterations(saveMaxIterations); setDblParam(ClpDualObjectiveLimit, saveObjLimit); return returnCode; } //#define CHECK_PATH #ifdef CHECK_PATH const double * debuggerSolution_Z = NULL; int numberColumns_Z = -1; int gotGoodNode_Z = -1; #endif /* Do up to N deep - returns -1 - no solution nNodes_ valid nodes >= if solution and that node gives solution ClpNode array is 2**N long. Values for N and array are in stuff (nNodes_ also in stuff) */ int ClpSimplex::fathomMany(void * stuff) { assert (stuff); ClpNodeStuff * info = reinterpret_cast (stuff); int nNodes = info->maximumNodes(); int putNode = info->maximumSpace(); int goodNodes = 0; info->nNodes_ = 0; ClpNode ** nodeInfo = info->nodeInfo_; assert (nodeInfo); // say can declare optimal moreSpecialOptions_ |= 8; double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); for (int j = 0; j < putNode; j++) { if (nodeInfo[j]) { nodeInfo[j]->setObjectiveValue(limit); if (info->large_) nodeInfo[j]->cleanUpForCrunch(); } } #ifdef CHECK_PATH // Note - if code working can get assert on startOptimal==2 (if finds) int startOptimal = 0; if (numberColumns_ == numberColumns_Z) { assert (debuggerSolution_Z); startOptimal = 1; for (int i = 0; i < numberColumns_; i++) { if (columnUpper_[i] < debuggerSolution_Z[i] || columnLower_[i] > debuggerSolution_Z[i]) { startOptimal = 0; break; } } if (startOptimal) { printf("starting on optimal\n"); } } else if (info->large_ && info->large_->numberColumns_ == numberColumns_Z) { assert (debuggerSolution_Z); startOptimal = 1; for (int i = 0; i < info->large_->numberColumns_; i++) { if (info->large_->columnUpper_[i] < debuggerSolution_Z[i] || info->large_->columnLower_[i] > debuggerSolution_Z[i]) { startOptimal = 0; break; } } if (startOptimal) { printf("starting on optimal (presolved) %d\n", numberColumns_); } } #endif int whichSolution = -1; if (info->presolveType_) { // crunch down bool feasible = true; // Use dual region double * rhs = dual_; int * whichRow = new int[3*numberRows_]; int * whichColumn = new int[2*numberColumns_]; int nBound; bool tightenBounds = ((specialOptions_ & 64) == 0) ? false : true; ClpSimplex * small = static_cast (this)->crunch(rhs, whichRow, whichColumn, nBound, false, tightenBounds); if (small) { info->large_ = this; info->whichRow_ = whichRow; info->whichColumn_ = whichColumn; info->nBound_ = nBound; //double limit = 0.0; //getDblParam(ClpDualObjectiveLimit, limit); //printf("objlimit a %g",limit); //small->getDblParam(ClpDualObjectiveLimit, limit); //printf(" %g\n",limit); // pack down pseudocosts if (info->upPseudo_) { const char * integerType2 = small->integerInformation(); int n = small->numberColumns(); int k = 0; int jColumn = 0; int j = 0; for (int i = 0; i < n; i++) { if (integerType2[i]) { int iColumn = whichColumn[i]; // find while (jColumn != iColumn) { if (integerType_[jColumn]) j++; jColumn++; } info->upPseudo_[k] = info->upPseudo_[j]; info->numberUp_[k] = info->numberUp_[j]; info->numberUpInfeasible_[k] = info->numberUpInfeasible_[j]; info->downPseudo_[k] = info->downPseudo_[j]; info->numberDown_[k] = info->numberDown_[j]; info->numberDownInfeasible_[k] = info->numberDownInfeasible_[j]; assert (info->upPseudo_[k] > 1.0e-40 && info->upPseudo_[k] < 1.0e40); assert (info->downPseudo_[k] > 1.0e-40 && info->downPseudo_[k] < 1.0e40); k++; } } } } else { feasible = false; } if (feasible) { info->presolveType_ = 0; // save and move pseudo costs whichSolution = small->fathomMany(stuff); // restore pseudocosts if (info->upPseudo_) { int n = small->numberColumns(); int * back = new int [numberColumns_]; int numberIntegers = 0; for (int i = 0; i < numberColumns_; i++) { if (integerType_[i]) { back[i] = -10 - numberIntegers; numberIntegers++; } else { back[i] = -1; } } const char * integerType2 = small->integerInformation(); int numberIntegers2 = 0; for (int i = 0; i < n; i++) { int iColumn = whichColumn[i]; if (integerType2[i]) { int iBack = -back[iColumn]; assert (iBack >= 10); iBack -= 10; back[iColumn] = iBack; numberIntegers2++; } } int k = numberIntegers2; for (int i = numberColumns_ - 1; i >= 0; i--) { int iBack = back[i]; if (iBack <= -10) { // fixed integer numberIntegers--; info->numberUp_[numberIntegers] = -1; // say not updated } else if (iBack >= 0) { // not fixed integer numberIntegers--; k--; assert (info->upPseudo_[k] > 1.0e-40 && info->upPseudo_[k] < 1.0e40); assert (info->downPseudo_[k] > 1.0e-40 && info->downPseudo_[k] < 1.0e40); info->upPseudo_[numberIntegers] = info->upPseudo_[k]; info->numberUp_[numberIntegers] = info->numberUp_[k]; info->numberUpInfeasible_[numberIntegers] = info->numberUpInfeasible_[k]; info->downPseudo_[numberIntegers] = info->downPseudo_[k]; info->numberDown_[numberIntegers] = info->numberDown_[k]; info->numberDownInfeasible_[numberIntegers] = info->numberDownInfeasible_[k]; } } delete [] back; } delete small; } info->large_ = NULL; info->whichRow_ = NULL; info->whichColumn_ = NULL; delete [] whichRow; delete [] whichColumn; return whichSolution; } #ifndef DEBUG { int nBasic = 0; int i; for (i = 0; i < numberRows_ + numberColumns_; i++) { if (getColumnStatus(i) == basic) nBasic++; } assert (nBasic == numberRows_); } #endif int returnCode = startFastDual2(info); if (returnCode) { stopFastDual2(info); abort(); return -1; } gutsOfSolution ( NULL, NULL); int status = fastDual2(info); CoinAssert (problemStatus_ || objectiveValue_ < 1.0e50); if (status && problemStatus_ != 3) { // not finished - might be optimal checkPrimalSolution(rowActivityWork_, columnActivityWork_); double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); //printf("objlimit b %g\n",limit); if (!numberPrimalInfeasibilities_ && objectiveValue()*optimizationDirection_ < limit) { problemStatus_ = 0; } status = problemStatus_; } assert (problemStatus_ == 0 || problemStatus_ == 1); //(static_cast this)->dual(0,0); if (problemStatus_ == 10) { printf("Cleaning up with primal - need coding without createRim!\n"); abort(); } int numberNodes = 0; int numberIterations = numberIterations_; if (problemStatus_ == 1) { //printf("fathom infeasible on initial\n"); stopFastDual2(info); info->nNodes_ = 0; info->numberNodesExplored_ = 0; info->numberIterations_ = numberIterations; return -1; } else if (problemStatus_ != 0) { abort(); } if (!columnScale_) { CoinMemcpyN(solution_, numberColumns_, columnActivity_); } else { assert(columnActivity_); assert(columnScale_); assert(solution_); int j; for (j = 0; j < numberColumns_; j++) columnActivity_[j] = solution_[j] * columnScale_[j]; } double increment = info->integerIncrement_; int depth = 0; int numberTotal = numberRows_ + numberColumns_; double * saveLower = CoinCopyOfArray(columnLower_, numberColumns_); double * saveUpper = CoinCopyOfArray(columnUpper_, numberColumns_); double * saveLowerInternal = CoinCopyOfArray(lower_, numberTotal); double * saveUpperInternal = CoinCopyOfArray(upper_, numberTotal); //double * bestLower = NULL; //double * bestUpper = NULL; int * back = new int [numberColumns_]; int numberIntegers = 0; double sumChanges = 1.0e-5; int numberChanges = 1; for (int i = 0; i < numberColumns_; i++) { if (integerType_[i]) back[i] = numberIntegers++; else back[i] = -1; } //unsigned char * bestStatus = NULL; double bestObjective; getDblParam(ClpDualObjectiveLimit, bestObjective); double saveBestObjective = bestObjective; bool backtrack = false; bool printing = handler_->logLevel() > 0; // Say can stop without cleaning up in primal moreSpecialOptions_ |= 2097152; #ifdef CHECK_PATH if (startOptimal) printing = true; #endif /* Use nodeInfo for storage depth 0 will be putNode-1, 1 putNode-2 etc */ int useDepth = putNode - 1; bool justDive = (info->solverOptions_ & 32) != 0; //printf("putNode %d nDepth %d\n"); while (depth >= 0) { bool stopAtOnce = false; // If backtrack get to correct depth if (backtrack) { depth--; useDepth++; while (depth >= 0) { if (!nodeInfo[useDepth]->fathomed()) { nodeInfo[useDepth]->changeState(); break; } //if (printing) //printf("deleting node at depth %d\n",depth); //delete nodes[useDepth]; //nodes[useDepth]=NULL; depth--; useDepth++; } if (depth < 0) break; // apply // First if backtracking we need to restore factorization, bounds and weights CoinMemcpyN(saveLowerInternal, numberTotal, lower_); CoinMemcpyN(saveUpperInternal, numberTotal, upper_); CoinMemcpyN(saveLower, numberColumns_, columnLower_); CoinMemcpyN(saveUpper, numberColumns_, columnUpper_); for (int i = 0; i < depth; i++) { nodeInfo[putNode-1-i]->applyNode(this, 0); } nodeInfo[useDepth]->applyNode(this, 1); if (justDive) stopAtOnce = true; int iColumn = nodeInfo[useDepth]->sequence(); if (printing) printf("after backtracking - applying node at depth %d - variable %d (%g,%g)\n", depth, iColumn, columnLower_[iColumn], columnUpper_[iColumn]); depth++; useDepth--; } else { // just bounds if (depth > 0) { // Choose variable here!! nodeInfo[useDepth+1]->chooseVariable(this, info); nodeInfo[useDepth+1]->applyNode(this, 0); int iColumn = nodeInfo[useDepth+1]->sequence(); if (printing) printf("No backtracking - applying node at depth-m %d - variable %d (%g,%g)\n", depth - 1, iColumn, columnLower_[iColumn], columnUpper_[iColumn]); } } // solve double dummyChange; (static_cast(this))->changeBounds(3, NULL, dummyChange); //int saveNumberFake = numberFake_; fastDual2(info); numberNodes++; numberIterations += numberIterations_; if ((numberNodes % 1000) == 0 && printing) printf("After %d nodes (%d iterations) - best solution %g - current depth %d\n", numberNodes, numberIterations, bestObjective, depth); if (problemStatus_ == 1 || (problemStatus_ == 0 && objectiveValue()*optimizationDirection_ > bestObjective)) { backtrack = true; if (printing) printf("infeasible at depth %d\n", depth); #ifdef CHECK_PATH if (startOptimal && numberColumns_ == numberColumns_Z) { bool onOptimal = true; for (int i = 0; i < numberColumns_; i++) { if (columnUpper_[i] < debuggerSolution_Z[i] || columnLower_[i] > debuggerSolution_Z[i]) { onOptimal = false; break; } } if (onOptimal) { printf("INF on optimal fathom at depth %d\n", depth); abort(); } } else if (info->large_ && startOptimal && info->large_->numberColumns_ == numberColumns_Z) { bool onOptimal = true; for (int i = 0; i < info->large_->numberColumns_; i++) { if (info->large_->columnUpper_[i] < debuggerSolution_Z[i] || info->large_->columnLower_[i] > debuggerSolution_Z[i]) { onOptimal = false; break; } } if (onOptimal) { printf("INF on optimal (pre) fathom at depth %d\n", depth); writeMps("fathom_pre.mps"); abort(); } } #endif if (depth > 0) { int way = nodeInfo[useDepth+1]->way(); int sequence = nodeInfo[useDepth+1]->sequence(); #ifndef NDEBUG double branchingValue = nodeInfo[useDepth+1]->branchingValue(); if (way > 0) assert (columnLower_[sequence] == ceil(branchingValue)); else assert (columnUpper_[sequence] == floor(branchingValue)); #endif sequence = back[sequence]; double change = bestObjective - nodeInfo[useDepth+1]->objectiveValue(); if (change > 1.0e10) change = 10.0 * sumChanges / (1.0 + numberChanges); info->update(way, sequence, change, false); } } else if (problemStatus_ != 0) { abort(); } else { // Create node ClpNode * node; computeDuals(NULL); if (depth > 0) { int way = nodeInfo[useDepth+1]->way(); int sequence = nodeInfo[useDepth+1]->sequence(); #ifndef NDEBUG double branchingValue = nodeInfo[useDepth+1]->branchingValue(); if (way > 0) assert (columnLower_[sequence] == ceil(branchingValue)); else assert (columnUpper_[sequence] == floor(branchingValue)); #endif sequence = back[sequence]; info->update(way, sequence, objectiveValue() - nodeInfo[useDepth+1]->objectiveValue(), true); numberChanges++; sumChanges += objectiveValue() - nodeInfo[useDepth+1]->objectiveValue(); } #ifdef CHECK_PATH if (startOptimal && numberColumns_ == numberColumns_Z) { bool onOptimal = true; for (int i = 0; i < numberColumns_; i++) { if (columnUpper_[i] < debuggerSolution_Z[i] || columnLower_[i] > debuggerSolution_Z[i]) { onOptimal = false; break; } } if (onOptimal) { if (depth >= info->nDepth_) { printf("on optimal fathom at full depth %d %d %g\n", depth, goodNodes, objectiveValue()); gotGoodNode_Z = goodNodes; startOptimal = 2; } else { printf("on optimal fathom at depth %d\n", depth); } } } else if (info->large_ && startOptimal && info->large_->numberColumns_ == numberColumns_Z) { bool onOptimal = true; // Fix bounds in large for (int i = 0; i < numberColumns_; i++) { if (integerType_[i]) { int iColumn = info->whichColumn_[i]; info->large_->columnUpper_[iColumn] = columnUpper_[i]; info->large_->columnLower_[iColumn] = columnLower_[i]; COIN_DETAIL_PRINT(printf("%d dj %g dual %g scale %g\n", iColumn, dj_[i], reducedCost_[i], columnScale_[i])); } } for (int i = 0; i < info->large_->numberColumns_; i++) { if (info->large_->columnUpper_[i] < debuggerSolution_Z[i] || info->large_->columnLower_[i] > debuggerSolution_Z[i]) { onOptimal = false; break; } } if (onOptimal) { if (depth >= info->nDepth_) { printf("on (pre) tentative optimal fathom at full depth %d %d %g\n", depth, goodNodes, objectiveValue()); for (int i = 0; i < info->large_->numberColumns_; i++) printf("fathomA %d %g %g\n", i, info->large_->columnLower_[i], info->large_->columnUpper_[i]); } else { printf("on (pre) optimal fathom at depth %d\n", depth); } } } #endif if (depth < info->nDepth_ && !stopAtOnce) { node = nodeInfo[useDepth]; if (node) { node->gutsOfConstructor(this, info, 1, depth); } else { node = new ClpNode(this, info, depth); nodeInfo[useDepth] = node; } } else { // save node = nodeInfo[goodNodes]; if (!node) { node = new ClpNode(this, info, depth); nodeInfo[goodNodes] = node; } if (!node->oddArraysExist()) node->createArrays(this); node->gutsOfConstructor(this, info, 2, depth); } if (node->sequence() < 0) { // solution double objectiveValue = doubleCheck(); if (printing) printf("Solution of %g after %d nodes at depth %d\n", objectiveValue, numberNodes, depth); if (objectiveValue < bestObjective && !problemStatus_) { // make sure node exists node = nodeInfo[goodNodes]; if (!node) { node = new ClpNode(this, info, depth); nodeInfo[goodNodes] = node; } if (info->large_) { //check this does everything // Fix bounds in large for (int i = 0; i < numberColumns_; i++) { if (integerType_[i]) { int iColumn = info->whichColumn_[i]; info->large_->columnUpper_[iColumn] = columnUpper_[i]; info->large_->columnLower_[iColumn] = columnLower_[i]; } } static_cast (info->large_)->afterCrunch(*this, info->whichRow_, info->whichColumn_, info->nBound_); // do as for large if (!node->oddArraysExist()) node->createArrays(info->large_); node->gutsOfConstructor(info->large_, info, 2, depth); } else { if (!node->oddArraysExist()) node->createArrays(this); node->gutsOfConstructor(this, info, 2, depth); } whichSolution = goodNodes; goodNodes++; if (goodNodes >= nNodes) justDive = true; // clean up phase assert (node->sequence() < 0); bestObjective = objectiveValue - increment; setDblParam(ClpDualObjectiveLimit, bestObjective * optimizationDirection_); } else { #ifdef CLP_INVESTIGATE printf("why bad solution feasible\n"); abort(); #endif } backtrack = true; } else { //if (printing) //printf("depth %d variable %d\n",depth,node->sequence()); if (depth == info->nDepth_ || stopAtOnce) { if (info->large_) { //check this does everything // Fix bounds in large for (int i = 0; i < numberColumns_; i++) { if (integerType_[i]) { int iColumn = info->whichColumn_[i]; info->large_->columnUpper_[iColumn] = columnUpper_[i]; info->large_->columnLower_[iColumn] = columnLower_[i]; } } #ifdef CHECK_PATH if (startOptimal) for (int i = 0; i < info->large_->numberColumns_; i++) printf("fathomB %d %g %g %g\n", i, info->large_->columnLower_[i], info->large_->columnUpper_[i], node->dualSolution()[i]); #endif static_cast (info->large_)->afterCrunch(*this, info->whichRow_, info->whichColumn_, info->nBound_); #ifdef CHECK_PATH if (startOptimal) { bool onOptimal = true; for (int i = 0; i < info->large_->numberColumns_; i++) printf("fathomC %d %g %g\n", i, info->large_->columnLower_[i], info->large_->columnUpper_[i]); for (int i = 0; i < info->large_->numberColumns_; i++) { if (info->large_->columnUpper_[i] < debuggerSolution_Z[i] || info->large_->columnLower_[i] > debuggerSolution_Z[i]) { onOptimal = false; break; } } if (onOptimal) { printf("on (pre) optimal fathom at full depth %d %d %g\n", depth, goodNodes, info->large_->objectiveValue()); startOptimal = 2; gotGoodNode_Z = goodNodes; for (int i = 0; i < info->large_->numberColumns_; i++) printf("fathom %d %g %g\n", i, info->large_->columnLower_[i], info->large_->columnUpper_[i]); } } #endif // do as for large node->gutsOfConstructor(info->large_, info, 2, depth); } goodNodes++; if (goodNodes >= nNodes) justDive = true; // clean up phase backtrack = true; } else { depth++; useDepth--; backtrack = false; } } } } //printf("nNodes %d nDepth %d, useDepth %d goodNodes %d\n", // nNodes,info->nDepth_,useDepth,goodNodes); #ifdef CHECK_PATH if (startOptimal) { assert(startOptimal == 2); printf("got fathomed optimal at end %d\n", startOptimal); if (startOptimal != 2) abort(); } #endif assert (depth == -1); delete [] saveLower; delete [] saveUpper; delete [] saveLowerInternal; delete [] saveUpperInternal; delete [] back; //printf("fathom finished after %d nodes\n",numberNodes); if (whichSolution >= 0) { setDblParam(ClpDualObjectiveLimit, saveBestObjective); } stopFastDual2(info); info->nNodes_ = goodNodes; info->numberNodesExplored_ = numberNodes; info->numberIterations_ = numberIterations; return whichSolution; } // Double checks OK double ClpSimplex::doubleCheck() { #if 0 double * solution = CoinCopyOfArray(solution_, numberColumns_ + numberRows_); gutsOfSolution ( NULL, NULL); for (int i = 0; i < numberColumns_; i++) { if (fabs(solution[i] - solution_[i]) > 1.0e-7) printf("bada %d bad %g good %g\n", i, solution[i], solution_[i]); } //abort(); #endif // make sure clean whatsChanged_=0; dual(0, 7); #if 0 for (int i = 0; i < numberColumns_; i++) { if (fabs(solution[i] - solution_[i]) > 1.0e-7) printf("badb %d bad %g good %g\n", i, solution[i], solution_[i]); } dual(0, 1); for (int i = 0; i < numberColumns_; i++) { if (fabs(solution[i] - solution_[i]) > 1.0e-7) printf("badc %d bad %g good %g\n", i, solution[i], solution_[i]); } delete [] solution; #endif computeObjectiveValue(); // without perturbation return objectiveValue() * optimizationDirection_; } // Start Fast dual int ClpSimplex::startFastDual2(ClpNodeStuff * info) { info->saveOptions_ = specialOptions_; assert ((info->solverOptions_ & 65536) == 0); info->solverOptions_ |= 65536; if ((specialOptions_ & 65536) == 0) { factorization_->setPersistenceFlag(2); } else { factorization_->setPersistenceFlag(2); startPermanentArrays(); } //assert (!lower_); // create modifiable copies of model rim and do optional scaling createRim(7 + 8 + 16 + 32, true, 0); #ifndef NDEBUG ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix_); assert (clpMatrix && (clpMatrix->flags() & 1) == 0); #endif // mark all as current whatsChanged_ = 0x3ffffff; // change newLower and newUpper if scaled // Do initial factorization // and set certain stuff // We can either set increasing rows so ...IsBasic gives pivot row // or we can just increment iBasic one by one // for now let ...iBasic give pivot row int factorizationStatus = internalFactorize(0); if (factorizationStatus < 0 || (factorizationStatus && factorizationStatus <= numberRows_)) { // some error #if 0 // we should either debug or ignore #ifdef CLP_INVESTIGATE //#ifndef NDEBUG printf("***** ClpDual strong branching factorization error - debug\n"); abort(); //#endif #endif return -2; #else dual(0, 7); createRim(7 + 8 + 16 + 32, true, 0); int factorizationStatus = internalFactorize(0); assert (factorizationStatus == 0); if (factorizationStatus) abort(); #endif } // Start of fast iterations factorization_->sparseThreshold(0); factorization_->goSparse(); assert (!info->saveCosts_); int numberTotal = numberRows_ + numberColumns_; double * save = new double [4*numberTotal]; CoinMemcpyN(cost_, numberTotal, save+3*numberTotal); if (perturbation_<100) { int saveIterations = numberIterations_; //int saveOptions = moreSpecialOptions_; int savePerturbation = perturbation_; numberIterations_ = 0; //moreSpecialOptions_ |= 128; bool allZero = true; for (int i=0;ilower_[i]) { allZero=false; break; } } } if (allZero) perturbation_ = 58; static_cast< ClpSimplexDual *>(this)->perturb(); numberIterations_ = saveIterations; //moreSpecialOptions_ = saveOptions; perturbation_ = savePerturbation; } info->saveCosts_ = save; CoinMemcpyN(cost_, numberTotal, save); return 0; } // Like Fast dual int ClpSimplex::fastDual2(ClpNodeStuff * info) { assert ((info->solverOptions_ & 65536) != 0); int numberTotal = numberRows_ + numberColumns_; assert (info->saveCosts_); double * save = info->saveCosts_; CoinMemcpyN(save, numberTotal, cost_); save += numberTotal; CoinMemcpyN(lower_, numberTotal, save); save += numberTotal; CoinMemcpyN(upper_, numberTotal, save); double dummyChange; (static_cast(this))->changeBounds(3, NULL, dummyChange); numberPrimalInfeasibilities_ = 1; sumPrimalInfeasibilities_ = 0.5; sumOfRelaxedDualInfeasibilities_ = 0.0; sumOfRelaxedPrimalInfeasibilities_ = 0.5; checkDualSolution(); //if (xxxxxx) //checkPrimalSolution(rowActivityWork_,columnActivityWork_); assert((specialOptions_ & 16384) == 0); specialOptions_ |= 524288; // say use solution ClpObjective * saveObjective = objective_; #ifndef NDEBUG //(static_cast(this))->resetFakeBounds(-1); #endif //int saveNumberFake = numberFake_; int status = static_cast (this)->fastDual(true); bool goodWeights=true; //numberFake_ = saveNumberFake; specialOptions_ &= ~524288; // say dont use solution CoinAssert (problemStatus_ || objectiveValue_ < 1.0e50); if (status && problemStatus_ != 3) { // not finished - might be optimal checkPrimalSolution(rowActivityWork_, columnActivityWork_); double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if (!numberPrimalInfeasibilities_ && objectiveValue()*optimizationDirection_ < limit) { problemStatus_ = 0; } } else if (problemStatus_==10 && (moreSpecialOptions_&2097152) != 0) { // not finished - may want to use anyway checkPrimalSolution(rowActivityWork_, columnActivityWork_); double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if (!numberPrimalInfeasibilities_ && objectiveValue()*optimizationDirection_ < limit) { problemStatus_ = 11; } } if (problemStatus_ == 10) { // Say second call moreSpecialOptions_ |= 256; //printf("Cleaning up with primal\n"); //lastAlgorithm=1; goodWeights=false; int savePerturbation = perturbation_; int saveLog = handler_->logLevel(); //handler_->setLogLevel(63); perturbation_ = 100; bool denseFactorization = initialDenseFactorization(); // It will be safe to allow dense setInitialDenseFactorization(true); // Allow for catastrophe int saveMax = intParam_[ClpMaxNumIteration]; if (intParam_[ClpMaxNumIteration] > 100000 + numberIterations_) intParam_[ClpMaxNumIteration] = numberIterations_ + 1000 + 2 * numberRows_ + numberColumns_; // check which algorithms allowed baseIteration_ = numberIterations_; status = static_cast (this)->primal(1, 7); baseIteration_ = 0; if (saveObjective != objective_) { // We changed objective to see if infeasible delete objective_; objective_ = saveObjective; if (!problemStatus_) { // carry on status = static_cast (this)->primal(1, 7); } } if (problemStatus_ == 3 && numberIterations_ < saveMax) { #ifdef COIN_DEVELOP if (handler_->logLevel() > 0) printf("looks like trouble - too many iterations in clean up - trying again\n"); #endif // flatten solution and try again int iColumn; for (iColumn = 0; iColumn < numberTotal; iColumn++) { if (getStatus(iColumn) != basic) { setStatus(iColumn, superBasic); // but put to bound if close if (fabs(solution_[iColumn] - lower_[iColumn]) <= primalTolerance_) { solution_[iColumn] = lower_[iColumn]; setStatus(iColumn, atLowerBound); } else if (fabs(solution_[iColumn] - upper_[iColumn]) <= primalTolerance_) { solution_[iColumn] = upper_[iColumn]; setStatus(iColumn, atUpperBound); } } } problemStatus_ = -1; intParam_[ClpMaxNumIteration] = CoinMin(numberIterations_ + 1000 + 2 * numberRows_ + numberColumns_, saveMax); perturbation_ = savePerturbation; baseIteration_ = numberIterations_; goodWeights=false; status = static_cast (this)->primal(0); baseIteration_ = 0; computeObjectiveValue(); // can't rely on djs either memset(reducedCost_, 0, numberColumns_ * sizeof(double)); #ifdef COIN_DEVELOP if (problemStatus_ == 3 && numberIterations_ < saveMax && handler_->logLevel() > 0) printf("looks like real trouble - too many iterations in second clean up - giving up\n"); #endif } // Say not second call moreSpecialOptions_ &= ~256; intParam_[ClpMaxNumIteration] = saveMax; setInitialDenseFactorization(denseFactorization); perturbation_ = savePerturbation; if (problemStatus_ == 10) { if (!numberPrimalInfeasibilities_) problemStatus_ = 0; else problemStatus_ = 4; } handler_->setLogLevel(saveLog); // if done primal arrays may be rubbish save = info->saveCosts_ + numberTotal; CoinMemcpyN(save, numberTotal, lower_); save += numberTotal; CoinMemcpyN(save, numberTotal, upper_); } status = problemStatus_; if (!problemStatus_||problemStatus_==11) { int j; // Move solution to external array if (!columnScale_) { CoinMemcpyN(solution_, numberColumns_, columnActivity_); } else { for (j = 0; j < numberColumns_; j++) columnActivity_[j] = solution_[j] * columnScale_[j]; } if ((info->solverOptions_ & 1) != 0) { // reduced costs if (!problemStatus_) { if (!columnScale_) { CoinMemcpyN(dj_, numberColumns_, reducedCost_); } else { for (j = 0; j < numberColumns_; j++) reducedCost_[j] = dj_[j] * columnScale_[j+numberColumns_]; } } else { // zero djs memset(reducedCost_,0,numberColumns_*sizeof(double)); problemStatus_=0; } } if ((info->solverOptions_ & 2) != 0) { // dual if (!rowScale_) { //CoinMemcpyN(dual_,numberRows_,dj_+numberColumns_); } else { for (j = 0; j < numberRows_; j++) dual_[j] = dj_[j+numberColumns_] * rowScale_[j]; } } if ((info->solverOptions_ & 4) != 0) { // row activity if (!rowScale_) { CoinMemcpyN(solution_ + numberColumns_, numberRows_, rowActivity_); } else { for (j = 0; j < numberRows_; j++) rowActivity_[j] = solution_[j+numberColumns_] * rowScale_[j+numberRows_]; } } } save = info->saveCosts_; CoinMemcpyN(save, numberTotal, cost_); #if 0 save += numberTotal; CoinMemcpyN(save, numberTotal, lower_); save += numberTotal; CoinMemcpyN(save, numberTotal, upper_); #endif if (goodWeights) status=100; return status; } // Stop Fast dual void ClpSimplex::stopFastDual2(ClpNodeStuff * info) { delete [] info->saveCosts_; info->saveCosts_ = NULL; specialOptions_ = info->saveOptions_; // try just factorization if ((specialOptions_ & 65536) == 0) factorization_->setPersistenceFlag(0); deleteRim(1); whatsChanged_ &= ~0xffff; assert ((info->solverOptions_ & 65536) != 0); info->solverOptions_ &= ~65536; } // Deals with crunch aspects ClpSimplex * ClpSimplex::fastCrunch(ClpNodeStuff * info, int mode) { ClpSimplex * small = NULL; if (mode == 0) { // before crunch // crunch down // Use dual region double * rhs = dual_; int * whichRow = new int[3*numberRows_]; int * whichColumn = new int[2*numberColumns_]; int nBound; bool tightenBounds = ((specialOptions_ & 64) == 0) ? false : true; small = static_cast (this)->crunch(rhs, whichRow, whichColumn, nBound, false, tightenBounds); if (small) { info->large_ = this; info->whichRow_ = whichRow; info->whichColumn_ = whichColumn; info->nBound_ = nBound; if (info->upPseudo_) { const char * integerType2 = small->integerInformation(); int n = small->numberColumns(); int k = 0; int jColumn = 0; int j = 0; for (int i = 0; i < n; i++) { if (integerType2[i]) { int iColumn = whichColumn[i]; // find while (jColumn != iColumn) { if (integerType_[jColumn]) j++; jColumn++; } info->upPseudo_[k] = info->upPseudo_[j]; info->numberUp_[k] = info->numberUp_[j]; info->numberUpInfeasible_[k] = info->numberUpInfeasible_[j]; info->downPseudo_[k] = info->downPseudo_[j]; info->numberDown_[k] = info->numberDown_[j]; info->numberDownInfeasible_[k] = info->numberDownInfeasible_[j]; assert (info->upPseudo_[k] > 1.0e-40 && info->upPseudo_[k] < 1.0e40); assert (info->downPseudo_[k] > 1.0e-40 && info->downPseudo_[k] < 1.0e40); k++; } } } } else { delete [] whichRow; delete [] whichColumn; } } else { // after crunch if (mode == 1) { // has solution ClpSimplex * other = info->large_; assert (other != this); static_cast (other)->afterCrunch(*this, info->whichRow_, info->whichColumn_, info->nBound_); for (int i = 0; i < other->numberColumns_; i++) { if (other->integerType_[i]) { double value = other->columnActivity_[i]; double value2 = floor(value + 0.5); assert (fabs(value - value2) < 1.0e-4); other->columnActivity_[i] = value2; other->columnLower_[i] = value2; other->columnUpper_[i] = value2; } } } delete [] info->whichRow_; delete [] info->whichColumn_; } return small; } // Resizes rim part of model void ClpSimplex::resize (int newNumberRows, int newNumberColumns) { ClpModel::resize(newNumberRows, newNumberColumns); delete [] perturbationArray_; perturbationArray_ = NULL; maximumPerturbationSize_=0; if (saveStatus_) { // delete arrays int saveOptions = specialOptions_; specialOptions_ = 0; gutsOfDelete(2); specialOptions_ = saveOptions; } } // Return true if the objective limit test can be relied upon bool ClpSimplex::isObjectiveLimitTestValid() const { if (problemStatus_ == 0) { return true; } else if (problemStatus_ == 1) { // ok if dual return (algorithm_ < 0); } else if (problemStatus_ == 2) { // ok if primal return (algorithm_ > 0); } else { return false; } } // Create C++ lines to get to current state void ClpSimplex::generateCpp( FILE * fp, bool defaultFactor) { ClpModel::generateCpp(fp); ClpSimplex defaultModel; ClpSimplex * other = &defaultModel; int iValue1, iValue2; double dValue1, dValue2; // Stuff that can't be done easily if (factorizationFrequency() == other->factorizationFrequency()) { if (defaultFactor) { fprintf(fp, "3 // For branchAndBound this may help\n"); fprintf(fp, "3 clpModel->defaultFactorizationFrequency();\n"); } else { // tell user about default fprintf(fp, "3 // For initialSolve you don't need below but ...\n"); fprintf(fp, "3 // clpModel->defaultFactorizationFrequency();\n"); } } iValue1 = this->factorizationFrequency(); iValue2 = other->factorizationFrequency(); fprintf(fp, "%d int save_factorizationFrequency = clpModel->factorizationFrequency();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setFactorizationFrequency(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d clpModel->setFactorizationFrequency(save_factorizationFrequency);\n", iValue1 == iValue2 ? 7 : 6); dValue1 = this->dualBound(); dValue2 = other->dualBound(); fprintf(fp, "%d double save_dualBound = clpModel->dualBound();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setDualBound(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setDualBound(save_dualBound);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->infeasibilityCost(); dValue2 = other->infeasibilityCost(); fprintf(fp, "%d double save_infeasibilityCost = clpModel->infeasibilityCost();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setInfeasibilityCost(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setInfeasibilityCost(save_infeasibilityCost);\n", dValue1 == dValue2 ? 7 : 6); iValue1 = this->perturbation(); iValue2 = other->perturbation(); fprintf(fp, "%d int save_perturbation = clpModel->perturbation();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setPerturbation(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d clpModel->setPerturbation(save_perturbation);\n", iValue1 == iValue2 ? 7 : 6); } // Copy across enabled stuff from one solver to another void ClpSimplex::copyEnabledStuff(const ClpSimplex * rhs) { solveType_=rhs->solveType_; if (rhs->solution_) { int numberTotal = numberRows_+numberColumns_; assert (!solution_); solution_ = CoinCopyOfArray(rhs->solution_,numberTotal); lower_ = CoinCopyOfArray(rhs->lower_,numberTotal); upper_ = CoinCopyOfArray(rhs->upper_,numberTotal); dj_ = CoinCopyOfArray(rhs->dj_,numberTotal); cost_ = CoinCopyOfArray(rhs->cost_,2*numberTotal); reducedCostWork_ = dj_; rowReducedCost_ = dj_ + numberColumns_; columnActivityWork_ = solution_; rowActivityWork_ = solution_ + numberColumns_; objectiveWork_ = cost_; rowObjectiveWork_ = cost_ + numberColumns_; rowLowerWork_ = lower_ + numberColumns_; columnLowerWork_ = lower_; rowUpperWork_ = upper_ + numberColumns_; columnUpperWork_ = upper_; } if (rhs->factorization_) { delete factorization_; factorization_ = new ClpFactorization(*rhs->factorization_); delete [] pivotVariable_; pivotVariable_ = CoinCopyOfArray(rhs->pivotVariable_,numberRows_); } for (int i = 0; i < 6; i++) { if (rhs->rowArray_[i]) rowArray_[i] = new CoinIndexedVector(*rhs->rowArray_[i]); if (rhs->columnArray_[i]) columnArray_[i] = new CoinIndexedVector(*rhs->columnArray_[i]); } if (rhs->nonLinearCost_) nonLinearCost_=new ClpNonLinearCost(*rhs->nonLinearCost_); if (rhs->dualRowPivot_) dualRowPivot_ = rhs->dualRowPivot_->clone(); if (rhs->primalColumnPivot_) primalColumnPivot_ = rhs->primalColumnPivot_->clone(); } CoinMP-1.8.3/Clp/src/ClpSolve.hpp0000644000175000017500000003430612452503025015065 0ustar renerene/* $Id: ClpSolve.hpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef ClpSolve_H #define ClpSolve_H /** This is a very simple class to guide algorithms. It is used to tidy up passing parameters to initialSolve and maybe for output from that */ class ClpSolve { public: /** enums for solve function */ enum SolveType { useDual = 0, usePrimal, usePrimalorSprint, useBarrier, useBarrierNoCross, automatic, tryDantzigWolfe, tryBenders, notImplemented }; enum PresolveType { presolveOn = 0, presolveOff, presolveNumber, presolveNumberCost }; /**@name Constructors and destructor and copy */ //@{ /// Default constructor ClpSolve ( ); /// Constructor when you really know what you are doing ClpSolve ( SolveType method, PresolveType presolveType, int numberPasses, int options[6], int extraInfo[6], int independentOptions[3]); /// Generates code for above constructor void generateCpp(FILE * fp); /// Copy constructor. ClpSolve(const ClpSolve &); /// Assignment operator. This copies the data ClpSolve & operator=(const ClpSolve & rhs); /// Destructor ~ClpSolve ( ); //@} /**@name Functions most useful to user */ //@{ /** Special options - bits 0 4 - use crash (default allslack in dual, idiot in primal) 8 - all slack basis in primal 2 16 - switch off interrupt handling 3 32 - do not try and make plus minus one matrix 64 - do not use sprint even if problem looks good */ /** which translation is: which: 0 - startup in Dual (nothing if basis exists).: 0 - no basis 1 - crash 2 - use initiative about idiot! but no crash 1 - startup in Primal (nothing if basis exists): 0 - use initiative 1 - use crash 2 - use idiot and look at further info 3 - use sprint and look at further info 4 - use all slack 5 - use initiative but no idiot 6 - use initiative but no sprint 7 - use initiative but no crash 8 - do allslack or idiot 9 - do allslack or sprint 10 - slp before 11 - no nothing and primal(0) 2 - interrupt handling - 0 yes, 1 no (for threadsafe) 3 - whether to make +- 1matrix - 0 yes, 1 no 4 - for barrier 0 - dense cholesky 1 - Wssmp allowing some long columns 2 - Wssmp not allowing long columns 3 - Wssmp using KKT 4 - Using Florida ordering 8 - bit set to do scaling 16 - set to be aggressive with gamma/delta? 32 - Use KKT 5 - for presolve 1 - switch off dual stuff 6 - extra switches */ void setSpecialOption(int which, int value, int extraInfo = -1); int getSpecialOption(int which) const; /// Solve types void setSolveType(SolveType method, int extraInfo = -1); SolveType getSolveType(); // Presolve types void setPresolveType(PresolveType amount, int extraInfo = -1); PresolveType getPresolveType(); int getPresolvePasses() const; /// Extra info for idiot (or sprint) int getExtraInfo(int which) const; /** Say to return at once if infeasible, default is to solve */ void setInfeasibleReturn(bool trueFalse); inline bool infeasibleReturn() const { return independentOptions_[0] != 0; } /// Whether we want to do dual part of presolve inline bool doDual() const { return (independentOptions_[1] & 1) == 0; } inline void setDoDual(bool doDual_) { if (doDual_) independentOptions_[1] &= ~1; else independentOptions_[1] |= 1; } /// Whether we want to do singleton part of presolve inline bool doSingleton() const { return (independentOptions_[1] & 2) == 0; } inline void setDoSingleton(bool doSingleton_) { if (doSingleton_) independentOptions_[1] &= ~2; else independentOptions_[1] |= 2; } /// Whether we want to do doubleton part of presolve inline bool doDoubleton() const { return (independentOptions_[1] & 4) == 0; } inline void setDoDoubleton(bool doDoubleton_) { if (doDoubleton_) independentOptions_[1] &= ~4; else independentOptions_[1] |= 4; } /// Whether we want to do tripleton part of presolve inline bool doTripleton() const { return (independentOptions_[1] & 8) == 0; } inline void setDoTripleton(bool doTripleton_) { if (doTripleton_) independentOptions_[1] &= ~8; else independentOptions_[1] |= 8; } /// Whether we want to do tighten part of presolve inline bool doTighten() const { return (independentOptions_[1] & 16) == 0; } inline void setDoTighten(bool doTighten_) { if (doTighten_) independentOptions_[1] &= ~16; else independentOptions_[1] |= 16; } /// Whether we want to do forcing part of presolve inline bool doForcing() const { return (independentOptions_[1] & 32) == 0; } inline void setDoForcing(bool doForcing_) { if (doForcing_) independentOptions_[1] &= ~32; else independentOptions_[1] |= 32; } /// Whether we want to do impliedfree part of presolve inline bool doImpliedFree() const { return (independentOptions_[1] & 64) == 0; } inline void setDoImpliedFree(bool doImpliedfree) { if (doImpliedfree) independentOptions_[1] &= ~64; else independentOptions_[1] |= 64; } /// Whether we want to do dupcol part of presolve inline bool doDupcol() const { return (independentOptions_[1] & 128) == 0; } inline void setDoDupcol(bool doDupcol_) { if (doDupcol_) independentOptions_[1] &= ~128; else independentOptions_[1] |= 128; } /// Whether we want to do duprow part of presolve inline bool doDuprow() const { return (independentOptions_[1] & 256) == 0; } inline void setDoDuprow(bool doDuprow_) { if (doDuprow_) independentOptions_[1] &= ~256; else independentOptions_[1] |= 256; } /// Whether we want to do singleton column part of presolve inline bool doSingletonColumn() const { return (independentOptions_[1] & 512) == 0; } inline void setDoSingletonColumn(bool doSingleton_) { if (doSingleton_) independentOptions_[1] &= ~512; else independentOptions_[1] |= 512; } /// Whether we want to kill small substitutions inline bool doKillSmall() const { return (independentOptions_[1] & 8192) == 0; } inline void setDoKillSmall(bool doKill) { if (doKill) independentOptions_[1] &= ~8192; else independentOptions_[1] |= 8192; } /// Set whole group inline int presolveActions() const { return independentOptions_[1] & 0xffff; } inline void setPresolveActions(int action) { independentOptions_[1] = (independentOptions_[1] & 0xffff0000) | (action & 0xffff); } /// Largest column for substitution (normally 3) inline int substitution() const { return independentOptions_[2]; } inline void setSubstitution(int value) { independentOptions_[2] = value; } inline void setIndependentOption(int type,int value) { independentOptions_[type] = value; } inline int independentOption(int type) const { return independentOptions_[type]; } //@} ////////////////// data ////////////////// private: /**@name data. */ //@{ /// Solve type SolveType method_; /// Presolve type PresolveType presolveType_; /// Amount of presolve int numberPasses_; /// Options - last is switch for OsiClp int options_[7]; /// Extra information int extraInfo_[7]; /** Extra algorithm dependent options 0 - if set return from clpsolve if infeasible 1 - To be copied over to presolve options 2 - max substitution level If Dantzig Wolfe/benders 0 is number blocks, 2 is #passes (notional) */ int independentOptions_[3]; //@} }; /// For saving extra information to see if looping. class ClpSimplexProgress { public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor ClpSimplexProgress ( ); /// Constructor from model ClpSimplexProgress ( ClpSimplex * model ); /// Copy constructor. ClpSimplexProgress(const ClpSimplexProgress &); /// Assignment operator. This copies the data ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs); /// Destructor ~ClpSimplexProgress ( ); /// Resets as much as possible void reset(); /// Fill from model void fillFromModel ( ClpSimplex * model ); //@} /**@name Check progress */ //@{ /** Returns -1 if okay, -n+1 (n number of times bad) if bad but action taken, >=0 if give up and use as problem status */ int looping ( ); /// Start check at beginning of whileIterating void startCheck(); /// Returns cycle length in whileIterating int cycle(int in, int out, int wayIn, int wayOut); /// Returns previous objective (if -1) - current if (0) double lastObjective(int back = 1) const; /// Set real primal infeasibility and move back void setInfeasibility(double value); /// Returns real primal infeasibility (if -1) - current if (0) double lastInfeasibility(int back = 1) const; /// Returns number of primal infeasibilities (if -1) - current if (0) int numberInfeasibilities(int back = 1) const; /// Modify objective e.g. if dual infeasible in dual void modifyObjective(double value); /// Returns previous iteration number (if -1) - current if (0) int lastIterationNumber(int back = 1) const; /// clears all iteration numbers (to switch off panic) void clearIterationNumbers(); /// Odd state inline void newOddState() { oddState_ = - oddState_ - 1; } inline void endOddState() { oddState_ = abs(oddState_); } inline void clearOddState() { oddState_ = 0; } inline int oddState() const { return oddState_; } /// number of bad times inline int badTimes() const { return numberBadTimes_; } inline void clearBadTimes() { numberBadTimes_ = 0; } /// number of really bad times inline int reallyBadTimes() const { return numberReallyBadTimes_; } inline void incrementReallyBadTimes() { numberReallyBadTimes_++; } /// number of times flagged inline int timesFlagged() const { return numberTimesFlagged_; } inline void clearTimesFlagged() { numberTimesFlagged_ = 0; } inline void incrementTimesFlagged() { numberTimesFlagged_++; } //@} /**@name Data */ #define CLP_PROGRESS 5 //#define CLP_PROGRESS_WEIGHT 10 //@{ /// Objective values double objective_[CLP_PROGRESS]; /// Sum of infeasibilities for algorithm double infeasibility_[CLP_PROGRESS]; /// Sum of real primal infeasibilities for primal double realInfeasibility_[CLP_PROGRESS]; #ifdef CLP_PROGRESS_WEIGHT /// Objective values for weights double objectiveWeight_[CLP_PROGRESS_WEIGHT]; /// Sum of infeasibilities for algorithm for weights double infeasibilityWeight_[CLP_PROGRESS_WEIGHT]; /// Sum of real primal infeasibilities for primal for weights double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT]; /// Drop for weights double drop_; /// Best? for weights double best_; #endif /// Initial weight for weights double initialWeight_; #define CLP_CYCLE 12 /// For cycle checking //double obj_[CLP_CYCLE]; int in_[CLP_CYCLE]; int out_[CLP_CYCLE]; char way_[CLP_CYCLE]; /// Pointer back to model so we can get information ClpSimplex * model_; /// Number of infeasibilities int numberInfeasibilities_[CLP_PROGRESS]; /// Iteration number at which occurred int iterationNumber_[CLP_PROGRESS]; #ifdef CLP_PROGRESS_WEIGHT /// Number of infeasibilities for weights int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT]; /// Iteration number at which occurred for weights int iterationNumberWeight_[CLP_PROGRESS_WEIGHT]; #endif /// Number of times checked (so won't stop too early) int numberTimes_; /// Number of times it looked like loop int numberBadTimes_; /// Number really bad times int numberReallyBadTimes_; /// Number of times no iterations as flagged int numberTimesFlagged_; /// If things are in an odd state int oddState_; //@} }; #include "ClpConfig.h" #if CLP_HAS_ABC #include "AbcCommon.hpp" /// For saving extra information to see if looping. class AbcSimplexProgress : public ClpSimplexProgress { public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor AbcSimplexProgress ( ); /// Constructor from model AbcSimplexProgress ( ClpSimplex * model ); /// Copy constructor. AbcSimplexProgress(const AbcSimplexProgress &); /// Assignment operator. This copies the data AbcSimplexProgress & operator=(const AbcSimplexProgress & rhs); /// Destructor ~AbcSimplexProgress ( ); //@} /**@name Check progress */ //@{ /** Returns -1 if okay, -n+1 (n number of times bad) if bad but action taken, >=0 if give up and use as problem status */ int looping ( ); //@} /**@name Data */ //@} }; #endif #endif CoinMP-1.8.3/Clp/src/ClpHelperFunctions.cpp0000644000175000017500000002117311654457077017120 0ustar renerene/* $Id: ClpHelperFunctions.cpp 1817 2011-11-03 09:26:23Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Note (JJF) I have added some operations on arrays even though they may duplicate CoinDenseVector. I think the use of templates was a mistake as I don't think inline generic code can take as much advantage of parallelism or machine architectures or memory hierarchies. */ #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinTypes.hpp" double maximumAbsElement(const double * region, int size) { int i; double maxValue = 0.0; for (i = 0; i < size; i++) maxValue = CoinMax(maxValue, fabs(region[i])); return maxValue; } void setElements(double * region, int size, double value) { int i; for (i = 0; i < size; i++) region[i] = value; } void multiplyAdd(const double * region1, int size, double multiplier1, double * region2, double multiplier2) { int i; if (multiplier1 == 1.0) { if (multiplier2 == 1.0) { for (i = 0; i < size; i++) region2[i] = region1[i] + region2[i]; } else if (multiplier2 == -1.0) { for (i = 0; i < size; i++) region2[i] = region1[i] - region2[i]; } else if (multiplier2 == 0.0) { for (i = 0; i < size; i++) region2[i] = region1[i] ; } else { for (i = 0; i < size; i++) region2[i] = region1[i] + multiplier2 * region2[i]; } } else if (multiplier1 == -1.0) { if (multiplier2 == 1.0) { for (i = 0; i < size; i++) region2[i] = -region1[i] + region2[i]; } else if (multiplier2 == -1.0) { for (i = 0; i < size; i++) region2[i] = -region1[i] - region2[i]; } else if (multiplier2 == 0.0) { for (i = 0; i < size; i++) region2[i] = -region1[i] ; } else { for (i = 0; i < size; i++) region2[i] = -region1[i] + multiplier2 * region2[i]; } } else if (multiplier1 == 0.0) { if (multiplier2 == 1.0) { // nothing to do } else if (multiplier2 == -1.0) { for (i = 0; i < size; i++) region2[i] = -region2[i]; } else if (multiplier2 == 0.0) { for (i = 0; i < size; i++) region2[i] = 0.0; } else { for (i = 0; i < size; i++) region2[i] = multiplier2 * region2[i]; } } else { if (multiplier2 == 1.0) { for (i = 0; i < size; i++) region2[i] = multiplier1 * region1[i] + region2[i]; } else if (multiplier2 == -1.0) { for (i = 0; i < size; i++) region2[i] = multiplier1 * region1[i] - region2[i]; } else if (multiplier2 == 0.0) { for (i = 0; i < size; i++) region2[i] = multiplier1 * region1[i] ; } else { for (i = 0; i < size; i++) region2[i] = multiplier1 * region1[i] + multiplier2 * region2[i]; } } } double innerProduct(const double * region1, int size, const double * region2) { int i; double value = 0.0; for (i = 0; i < size; i++) value += region1[i] * region2[i]; return value; } void getNorms(const double * region, int size, double & norm1, double & norm2) { norm1 = 0.0; norm2 = 0.0; int i; for (i = 0; i < size; i++) { norm2 += region[i] * region[i]; norm1 = CoinMax(norm1, fabs(region[i])); } } #ifndef NDEBUG #include "ClpModel.hpp" #include "ClpMessage.hpp" ClpModel * clpTraceModel=NULL; // Set to trap messages void ClpTracePrint(std::string fileName, std::string message, int lineNumber) { if (!clpTraceModel) { std::cout<messageHandler()->message(CLP_GENERAL_WARNING, clpTraceModel->messages()) << line << CoinMessageEol; } } #endif #if COIN_LONG_WORK // For long double versions CoinWorkDouble maximumAbsElement(const CoinWorkDouble * region, int size) { int i; CoinWorkDouble maxValue = 0.0; for (i = 0; i < size; i++) maxValue = CoinMax(maxValue, CoinAbs(region[i])); return maxValue; } void setElements(CoinWorkDouble * region, int size, CoinWorkDouble value) { int i; for (i = 0; i < size; i++) region[i] = value; } void multiplyAdd(const CoinWorkDouble * region1, int size, CoinWorkDouble multiplier1, CoinWorkDouble * region2, CoinWorkDouble multiplier2) { int i; if (multiplier1 == 1.0) { if (multiplier2 == 1.0) { for (i = 0; i < size; i++) region2[i] = region1[i] + region2[i]; } else if (multiplier2 == -1.0) { for (i = 0; i < size; i++) region2[i] = region1[i] - region2[i]; } else if (multiplier2 == 0.0) { for (i = 0; i < size; i++) region2[i] = region1[i] ; } else { for (i = 0; i < size; i++) region2[i] = region1[i] + multiplier2 * region2[i]; } } else if (multiplier1 == -1.0) { if (multiplier2 == 1.0) { for (i = 0; i < size; i++) region2[i] = -region1[i] + region2[i]; } else if (multiplier2 == -1.0) { for (i = 0; i < size; i++) region2[i] = -region1[i] - region2[i]; } else if (multiplier2 == 0.0) { for (i = 0; i < size; i++) region2[i] = -region1[i] ; } else { for (i = 0; i < size; i++) region2[i] = -region1[i] + multiplier2 * region2[i]; } } else if (multiplier1 == 0.0) { if (multiplier2 == 1.0) { // nothing to do } else if (multiplier2 == -1.0) { for (i = 0; i < size; i++) region2[i] = -region2[i]; } else if (multiplier2 == 0.0) { for (i = 0; i < size; i++) region2[i] = 0.0; } else { for (i = 0; i < size; i++) region2[i] = multiplier2 * region2[i]; } } else { if (multiplier2 == 1.0) { for (i = 0; i < size; i++) region2[i] = multiplier1 * region1[i] + region2[i]; } else if (multiplier2 == -1.0) { for (i = 0; i < size; i++) region2[i] = multiplier1 * region1[i] - region2[i]; } else if (multiplier2 == 0.0) { for (i = 0; i < size; i++) region2[i] = multiplier1 * region1[i] ; } else { for (i = 0; i < size; i++) region2[i] = multiplier1 * region1[i] + multiplier2 * region2[i]; } } } CoinWorkDouble innerProduct(const CoinWorkDouble * region1, int size, const CoinWorkDouble * region2) { int i; CoinWorkDouble value = 0.0; for (i = 0; i < size; i++) value += region1[i] * region2[i]; return value; } void getNorms(const CoinWorkDouble * region, int size, CoinWorkDouble & norm1, CoinWorkDouble & norm2) { norm1 = 0.0; norm2 = 0.0; int i; for (i = 0; i < size; i++) { norm2 += region[i] * region[i]; norm1 = CoinMax(norm1, CoinAbs(region[i])); } } #endif #ifdef DEBUG_MEMORY #include #include #include typedef void (*NEW_HANDLER)(); static NEW_HANDLER new_handler; // function to call if `new' fails (cf. ARM p. 281) // Allocate storage. void * operator new(size_t size) { void * p; for (;;) { p = malloc(size); if (p) break; // success else if (new_handler) new_handler(); // failure - try again (allow user to release some storage first) else break; // failure - no retry } if (size > 1000000) printf("Allocating memory of size %d\n", size); return p; } // Deallocate storage. void operator delete(void *p) { free(p); return; } void operator delete [] (void *p) { free(p); return; } #endif CoinMP-1.8.3/Clp/src/AbcDualRowPivot.hpp0000644000175000017500000000730012101105055016325 0ustar renerene/* $Id: AbcDualRowPivot.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef AbcDualRowPivot_H #define AbcDualRowPivot_H #include "AbcCommon.hpp" class AbcSimplex; class CoinIndexedVector; //############################################################################# /** Dual Row Pivot Abstract Base Class Abstract Base Class for describing an interface to an algorithm to choose row pivot in dual simplex algorithm. For some algorithms e.g. Dantzig choice then some functions may be null. */ class AbcDualRowPivot { public: ///@name Algorithmic methods //@{ /// Returns pivot row, -1 if none virtual int pivotRow() = 0; /** Does most of work for weights and returns pivot alpha. Also does FT update */ virtual double updateWeights1(CoinIndexedVector & input,CoinIndexedVector & updateColumn) = 0; virtual void updateWeightsOnly(CoinIndexedVector & input) = 0; virtual double updateWeights(CoinIndexedVector & input,CoinIndexedVector & updateColumn) = 0; /// Actually updates weights virtual void updateWeights2(CoinIndexedVector & input,CoinIndexedVector & updateColumn) = 0; /** Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Would be faster if we kept basic regions, but on other hand it means everything is always in sync */ virtual void updatePrimalSolution(CoinIndexedVector & updateColumn, double theta) = 0; virtual void updatePrimalSolutionAndWeights(CoinIndexedVector & weightsVector, CoinIndexedVector & updateColumn, double theta); /** Saves any weights round factorization as pivot rows may change Will be empty unless steepest edge (will save model) May also recompute infeasibility stuff 1) before factorization 2) after good factorization (if weights empty may initialize) 3) after something happened but no factorization (e.g. check for infeasible) 4) as 2 but restore weights from previous snapshot 5) for strong branching - initialize , infeasibilities */ virtual void saveWeights(AbcSimplex * model, int mode); /// Recompute infeasibilities virtual void recomputeInfeasibilities(); /// checks accuracy and may re-initialize (may be empty) virtual void checkAccuracy(); /// Gets rid of all arrays (may be empty) virtual void clearArrays(); /// Returns true if would not find any row virtual bool looksOptimal() const { return false; } //@} ///@name Constructors and destructors //@{ /// Default Constructor AbcDualRowPivot(); /// Copy constructor AbcDualRowPivot(const AbcDualRowPivot &); /// Assignment operator AbcDualRowPivot & operator=(const AbcDualRowPivot& rhs); /// Destructor virtual ~AbcDualRowPivot (); /// Clone virtual AbcDualRowPivot * clone(bool copyData = true) const = 0; //@} ///@name Other //@{ /// Returns model inline AbcSimplex * model() { return model_; } /// Sets model (normally to NULL) inline void setModel(AbcSimplex * newmodel) { model_ = newmodel; } /// Returns type (above 63 is extra information) inline int type() { return type_; } //@} //--------------------------------------------------------------------------- protected: ///@name Protected member data //@{ /// Pointer to model AbcSimplex * model_; /// Type of row pivot algorithm int type_; //@} }; #ifndef CLP_DUAL_COLUMN_MULTIPLIER //#define CLP_DUAL_COLUMN_MULTIPLIER 0.99999 #endif #endif CoinMP-1.8.3/Clp/src/ClpDualRowDantzig.cpp0000644000175000017500000001343011571121105016655 0ustar renerene/* $Id: ClpDualRowDantzig.cpp 1732 2011-05-31 08:09:41Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #ifndef CLP_DUAL_COLUMN_MULTIPLIER #define CLP_DUAL_COLUMN_MULTIPLIER 1.01 #endif //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpDualRowDantzig::ClpDualRowDantzig () : ClpDualRowPivot() { type_ = 1; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpDualRowDantzig::ClpDualRowDantzig (const ClpDualRowDantzig & source) : ClpDualRowPivot(source) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpDualRowDantzig::~ClpDualRowDantzig () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpDualRowDantzig & ClpDualRowDantzig::operator=(const ClpDualRowDantzig& rhs) { if (this != &rhs) { ClpDualRowPivot::operator=(rhs); } return *this; } // Returns pivot row, -1 if none int ClpDualRowDantzig::pivotRow() { assert(model_); int iRow; const int * pivotVariable = model_->pivotVariable(); double tolerance = model_->currentPrimalTolerance(); // we can't really trust infeasibilities if there is primal error if (model_->largestPrimalError() > 1.0e-8) tolerance *= model_->largestPrimalError() / 1.0e-8; double largest = 0.0; int chosenRow = -1; int numberRows = model_->numberRows(); #ifdef CLP_DUAL_COLUMN_MULTIPLIER int numberColumns = model_->numberColumns(); #endif for (iRow = 0; iRow < numberRows; iRow++) { int iSequence = pivotVariable[iRow]; double value = model_->solution(iSequence); double lower = model_->lower(iSequence); double upper = model_->upper(iSequence); double infeas = CoinMax(value - upper , lower - value); if (infeas > tolerance) { #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iSequence < numberColumns) infeas *= CLP_DUAL_COLUMN_MULTIPLIER; #endif if (infeas > largest) { if (!model_->flagged(iSequence)) { chosenRow = iRow; largest = infeas; } } } } return chosenRow; } // FT update and returns pivot alpha double ClpDualRowDantzig::updateWeights(CoinIndexedVector * /*input*/, CoinIndexedVector * spare, CoinIndexedVector * /*spare2*/, CoinIndexedVector * updatedColumn) { // Do FT update model_->factorization()->updateColumnFT(spare, updatedColumn); // pivot element double alpha = 0.0; // look at updated column double * work = updatedColumn->denseVector(); int number = updatedColumn->getNumElements(); int * which = updatedColumn->getIndices(); int i; int pivotRow = model_->pivotRow(); if (updatedColumn->packedMode()) { for (i = 0; i < number; i++) { int iRow = which[i]; if (iRow == pivotRow) { alpha = work[i]; break; } } } else { alpha = work[pivotRow]; } return alpha; } /* Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Computes change in objective function */ void ClpDualRowDantzig::updatePrimalSolution(CoinIndexedVector * primalUpdate, double primalRatio, double & objectiveChange) { double * work = primalUpdate->denseVector(); int number = primalUpdate->getNumElements(); int * which = primalUpdate->getIndices(); int i; double changeObj = 0.0; const int * pivotVariable = model_->pivotVariable(); if (primalUpdate->packedMode()) { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; double & value = model_->solutionAddress(iPivot); double cost = model_->cost(iPivot); double change = primalRatio * work[i]; value -= change; changeObj -= change * cost; work[i] = 0.0; } } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; double & value = model_->solutionAddress(iPivot); double cost = model_->cost(iPivot); double change = primalRatio * work[iRow]; value -= change; changeObj -= change * cost; work[iRow] = 0.0; } } primalUpdate->setNumElements(0); objectiveChange += changeObj; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpDualRowPivot * ClpDualRowDantzig::clone(bool CopyData) const { if (CopyData) { return new ClpDualRowDantzig(*this); } else { return new ClpDualRowDantzig(); } } CoinMP-1.8.3/Clp/src/ClpNetworkBasis.cpp0000644000175000017500000012412411571121105016375 0ustar renerene/* $Id: ClpNetworkBasis.cpp 1732 2011-05-31 08:09:41Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpNetworkBasis.hpp" #include "CoinHelperFunctions.hpp" #include "ClpSimplex.hpp" #include "ClpMatrixBase.hpp" #include "CoinIndexedVector.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpNetworkBasis::ClpNetworkBasis () { #ifndef COIN_FAST_CODE slackValue_ = -1.0; #endif numberRows_ = 0; numberColumns_ = 0; parent_ = NULL; descendant_ = NULL; pivot_ = NULL; rightSibling_ = NULL; leftSibling_ = NULL; sign_ = NULL; stack_ = NULL; permute_ = NULL; permuteBack_ = NULL; stack2_ = NULL; depth_ = NULL; mark_ = NULL; model_ = NULL; } // Constructor from CoinFactorization ClpNetworkBasis::ClpNetworkBasis(const ClpSimplex * model, int numberRows, const CoinFactorizationDouble * pivotRegion, const int * permuteBack, const CoinBigIndex * startColumn, const int * numberInColumn, const int * indexRow, const CoinFactorizationDouble * /*element*/) { #ifndef COIN_FAST_CODE slackValue_ = -1.0; #endif numberRows_ = numberRows; numberColumns_ = numberRows; parent_ = new int [ numberRows_+1]; descendant_ = new int [ numberRows_+1]; pivot_ = new int [ numberRows_+1]; rightSibling_ = new int [ numberRows_+1]; leftSibling_ = new int [ numberRows_+1]; sign_ = new double [ numberRows_+1]; stack_ = new int [ numberRows_+1]; stack2_ = new int[numberRows_+1]; depth_ = new int[numberRows_+1]; mark_ = new char[numberRows_+1]; permute_ = new int [numberRows_ + 1]; permuteBack_ = new int [numberRows_ + 1]; int i; for (i = 0; i < numberRows_ + 1; i++) { parent_[i] = -1; descendant_[i] = -1; pivot_[i] = -1; rightSibling_[i] = -1; leftSibling_[i] = -1; sign_[i] = -1.0; stack_[i] = -1; permute_[i] = i; permuteBack_[i] = i; stack2_[i] = -1; depth_[i] = -1; mark_[i] = 0; } mark_[numberRows_] = 1; // pivotColumnBack gives order of pivoting into basis // so pivotColumnback[0] is first slack in basis and // it pivots on row permuteBack[0] // a known root is given by permuteBack[numberRows_-1] for (i = 0; i < numberRows_; i++) { int iPivot = permuteBack[i]; double sign; if (pivotRegion[i] > 0.0) sign = 1.0; else sign = -1.0; int other; if (numberInColumn[i] > 0) { int iRow = indexRow[startColumn[i]]; other = permuteBack[iRow]; //assert (parent_[other]!=-1); } else { other = numberRows_; } sign_[iPivot] = sign; int iParent = other; parent_[iPivot] = other; if (descendant_[iParent] >= 0) { // we have a sibling int iRight = descendant_[iParent]; rightSibling_[iPivot] = iRight; leftSibling_[iRight] = iPivot; } else { rightSibling_[iPivot] = -1; } descendant_[iParent] = iPivot; leftSibling_[iPivot] = -1; } // do depth int nStack = 1; stack_[0] = descendant_[numberRows_]; depth_[numberRows_] = -1; // root while (nStack) { // take off int iNext = stack_[--nStack]; if (iNext >= 0) { depth_[iNext] = nStack; int iRight = rightSibling_[iNext]; stack_[nStack++] = iRight; if (descendant_[iNext] >= 0) stack_[nStack++] = descendant_[iNext]; } } model_ = model; check(); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpNetworkBasis::ClpNetworkBasis (const ClpNetworkBasis & rhs) { #ifndef COIN_FAST_CODE slackValue_ = rhs.slackValue_; #endif numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; if (rhs.parent_) { parent_ = new int [numberRows_+1]; CoinMemcpyN(rhs.parent_, (numberRows_ + 1), parent_); } else { parent_ = NULL; } if (rhs.descendant_) { descendant_ = new int [numberRows_+1]; CoinMemcpyN(rhs.descendant_, (numberRows_ + 1), descendant_); } else { descendant_ = NULL; } if (rhs.pivot_) { pivot_ = new int [numberRows_+1]; CoinMemcpyN(rhs.pivot_, (numberRows_ + 1), pivot_); } else { pivot_ = NULL; } if (rhs.rightSibling_) { rightSibling_ = new int [numberRows_+1]; CoinMemcpyN(rhs.rightSibling_, (numberRows_ + 1), rightSibling_); } else { rightSibling_ = NULL; } if (rhs.leftSibling_) { leftSibling_ = new int [numberRows_+1]; CoinMemcpyN(rhs.leftSibling_, (numberRows_ + 1), leftSibling_); } else { leftSibling_ = NULL; } if (rhs.sign_) { sign_ = new double [numberRows_+1]; CoinMemcpyN(rhs.sign_, (numberRows_ + 1), sign_); } else { sign_ = NULL; } if (rhs.stack_) { stack_ = new int [numberRows_+1]; CoinMemcpyN(rhs.stack_, (numberRows_ + 1), stack_); } else { stack_ = NULL; } if (rhs.permute_) { permute_ = new int [numberRows_+1]; CoinMemcpyN(rhs.permute_, (numberRows_ + 1), permute_); } else { permute_ = NULL; } if (rhs.permuteBack_) { permuteBack_ = new int [numberRows_+1]; CoinMemcpyN(rhs.permuteBack_, (numberRows_ + 1), permuteBack_); } else { permuteBack_ = NULL; } if (rhs.stack2_) { stack2_ = new int [numberRows_+1]; CoinMemcpyN(rhs.stack2_, (numberRows_ + 1), stack2_); } else { stack2_ = NULL; } if (rhs.depth_) { depth_ = new int [numberRows_+1]; CoinMemcpyN(rhs.depth_, (numberRows_ + 1), depth_); } else { depth_ = NULL; } if (rhs.mark_) { mark_ = new char [numberRows_+1]; CoinMemcpyN(rhs.mark_, (numberRows_ + 1), mark_); } else { mark_ = NULL; } model_ = rhs.model_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpNetworkBasis::~ClpNetworkBasis () { delete [] parent_; delete [] descendant_; delete [] pivot_; delete [] rightSibling_; delete [] leftSibling_; delete [] sign_; delete [] stack_; delete [] permute_; delete [] permuteBack_; delete [] stack2_; delete [] depth_; delete [] mark_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpNetworkBasis & ClpNetworkBasis::operator=(const ClpNetworkBasis& rhs) { if (this != &rhs) { delete [] parent_; delete [] descendant_; delete [] pivot_; delete [] rightSibling_; delete [] leftSibling_; delete [] sign_; delete [] stack_; delete [] permute_; delete [] permuteBack_; delete [] stack2_; delete [] depth_; delete [] mark_; #ifndef COIN_FAST_CODE slackValue_ = rhs.slackValue_; #endif numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; if (rhs.parent_) { parent_ = new int [numberRows_+1]; CoinMemcpyN(rhs.parent_, (numberRows_ + 1), parent_); } else { parent_ = NULL; } if (rhs.descendant_) { descendant_ = new int [numberRows_+1]; CoinMemcpyN(rhs.descendant_, (numberRows_ + 1), descendant_); } else { descendant_ = NULL; } if (rhs.pivot_) { pivot_ = new int [numberRows_+1]; CoinMemcpyN(rhs.pivot_, (numberRows_ + 1), pivot_); } else { pivot_ = NULL; } if (rhs.rightSibling_) { rightSibling_ = new int [numberRows_+1]; CoinMemcpyN(rhs.rightSibling_, (numberRows_ + 1), rightSibling_); } else { rightSibling_ = NULL; } if (rhs.leftSibling_) { leftSibling_ = new int [numberRows_+1]; CoinMemcpyN(rhs.leftSibling_, (numberRows_ + 1), leftSibling_); } else { leftSibling_ = NULL; } if (rhs.sign_) { sign_ = new double [numberRows_+1]; CoinMemcpyN(rhs.sign_, (numberRows_ + 1), sign_); } else { sign_ = NULL; } if (rhs.stack_) { stack_ = new int [numberRows_+1]; CoinMemcpyN(rhs.stack_, (numberRows_ + 1), stack_); } else { stack_ = NULL; } if (rhs.permute_) { permute_ = new int [numberRows_+1]; CoinMemcpyN(rhs.permute_, (numberRows_ + 1), permute_); } else { permute_ = NULL; } if (rhs.permuteBack_) { permuteBack_ = new int [numberRows_+1]; CoinMemcpyN(rhs.permuteBack_, (numberRows_ + 1), permuteBack_); } else { permuteBack_ = NULL; } if (rhs.stack2_) { stack2_ = new int [numberRows_+1]; CoinMemcpyN(rhs.stack2_, (numberRows_ + 1), stack2_); } else { stack2_ = NULL; } if (rhs.depth_) { depth_ = new int [numberRows_+1]; CoinMemcpyN(rhs.depth_, (numberRows_ + 1), depth_); } else { depth_ = NULL; } if (rhs.mark_) { mark_ = new char [numberRows_+1]; CoinMemcpyN(rhs.mark_, (numberRows_ + 1), mark_); } else { mark_ = NULL; } } return *this; } // checks looks okay void ClpNetworkBasis::check() { // check depth int nStack = 1; stack_[0] = descendant_[numberRows_]; depth_[numberRows_] = -1; // root while (nStack) { // take off int iNext = stack_[--nStack]; if (iNext >= 0) { //assert (depth_[iNext]==nStack); depth_[iNext] = nStack; int iRight = rightSibling_[iNext]; stack_[nStack++] = iRight; if (descendant_[iNext] >= 0) stack_[nStack++] = descendant_[iNext]; } } } // prints void ClpNetworkBasis::print() { int i; printf(" parent descendant left right sign depth\n"); for (i = 0; i < numberRows_ + 1; i++) printf("%4d %7d %8d %7d %7d %5g %7d\n", i, parent_[i], descendant_[i], leftSibling_[i], rightSibling_[i], sign_[i], depth_[i]); } /* Replaces one Column to basis, returns 0=OK */ int ClpNetworkBasis::replaceColumn ( CoinIndexedVector * regionSparse, int pivotRow) { // When things have settled down then redo this to make more elegant // I am sure lots of loops can be combined // regionSparse is empty assert (!regionSparse->getNumElements()); model_->unpack(regionSparse, model_->sequenceIn()); // arc given by pivotRow is leaving basis //int kParent = parent_[pivotRow]; // arc coming in has these two nodes int * indices = regionSparse->getIndices(); int iRow0 = indices[0]; int iRow1; if (regionSparse->getNumElements() == 2) iRow1 = indices[1]; else iRow1 = numberRows_; double sign = -regionSparse->denseVector()[iRow0]; regionSparse->clear(); // and outgoing model_->unpack(regionSparse, model_->pivotVariable()[pivotRow]); int jRow0 = indices[0]; int jRow1; if (regionSparse->getNumElements() == 2) jRow1 = indices[1]; else jRow1 = numberRows_; regionSparse->clear(); // get correct pivotRow //#define FULL_DEBUG #ifdef FULL_DEBUG printf ("irow %d %d, jrow %d %d\n", iRow0, iRow1, jRow0, jRow1); #endif if (parent_[jRow0] == jRow1) { int newPivot = jRow0; if (newPivot != pivotRow) { #ifdef FULL_DEBUG printf("pivot row of %d permuted to %d\n", pivotRow, newPivot); #endif pivotRow = newPivot; } } else { //assert (parent_[jRow1]==jRow0); int newPivot = jRow1; if (newPivot != pivotRow) { #ifdef FULL_DEBUG printf("pivot row of %d permuted to %d\n", pivotRow, newPivot); #endif pivotRow = newPivot; } } bool extraPrint = (model_->numberIterations() > -3) && (model_->logLevel() > 10); if (extraPrint) print(); #ifdef FULL_DEBUG printf("In %d (region= %g, stored %g) %d (%g) pivoting on %d (%g)\n", iRow1, sign, sign_[iRow1], iRow0, sign_[iRow0] , pivotRow, sign_[pivotRow]); #endif // see which path outgoing pivot is on int kRow = -1; int jRow = iRow1; while (jRow != numberRows_) { if (jRow == pivotRow) { kRow = iRow1; break; } else { jRow = parent_[jRow]; } } if (kRow < 0) { jRow = iRow0; while (jRow != numberRows_) { if (jRow == pivotRow) { kRow = iRow0; break; } else { jRow = parent_[jRow]; } } } //assert (kRow>=0); if (iRow0 == kRow) { iRow0 = iRow1; iRow1 = kRow; sign = -sign; } // pivot row is on path from iRow1 back to root // get stack of nodes to change // Also get precursors for cleaning order int nStack = 1; stack_[0] = iRow0; while (kRow != pivotRow) { stack_[nStack++] = kRow; if (sign * sign_[kRow] < 0.0) { sign_[kRow] = -sign_[kRow]; } else { sign = -sign; } kRow = parent_[kRow]; //sign *= sign_[kRow]; } stack_[nStack++] = pivotRow; if (sign * sign_[pivotRow] < 0.0) { sign_[pivotRow] = -sign_[pivotRow]; } else { sign = -sign; } int iParent = parent_[pivotRow]; while (nStack > 1) { int iLeft; int iRight; kRow = stack_[--nStack]; int newParent = stack_[nStack-1]; #ifdef FULL_DEBUG printf("row %d, old parent %d, new parent %d, pivotrow %d\n", kRow, iParent, newParent, pivotRow); #endif int i1 = permuteBack_[pivotRow]; int i2 = permuteBack_[kRow]; permuteBack_[pivotRow] = i2; permuteBack_[kRow] = i1; // do Btran permutation permute_[i1] = kRow; permute_[i2] = pivotRow; pivotRow = kRow; // Take out of old parent iLeft = leftSibling_[kRow]; iRight = rightSibling_[kRow]; if (iLeft < 0) { // take out of tree if (iRight >= 0) { leftSibling_[iRight] = iLeft; descendant_[iParent] = iRight; } else { #ifdef FULL_DEBUG printf("Saying %d (old parent of %d) has no descendants\n", iParent, kRow); #endif descendant_[iParent] = -1; } } else { // take out of tree rightSibling_[iLeft] = iRight; if (iRight >= 0) leftSibling_[iRight] = iLeft; } leftSibling_[kRow] = -1; rightSibling_[kRow] = -1; // now insert new one // make this descendant of that if (descendant_[newParent] >= 0) { // we will have a sibling int jRight = descendant_[newParent]; rightSibling_[kRow] = jRight; leftSibling_[jRight] = kRow; } else { rightSibling_[kRow] = -1; } descendant_[newParent] = kRow; leftSibling_[kRow] = -1; parent_[kRow] = newParent; iParent = kRow; } // now redo all depths from stack_[1] // This must be possible to combine - but later { int iPivot = stack_[1]; int iDepth = depth_[parent_[iPivot]]; //depth of parent iDepth ++; //correct for this one int nStack = 1; stack_[0] = iPivot; while (nStack) { // take off int iNext = stack_[--nStack]; if (iNext >= 0) { // add stack level depth_[iNext] = nStack + iDepth; stack_[nStack++] = rightSibling_[iNext]; if (descendant_[iNext] >= 0) stack_[nStack++] = descendant_[iNext]; } } } if (extraPrint) print(); //check(); return 0; } /* Updates one column (FTRAN) from region2 */ double ClpNetworkBasis::updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, int pivotRow) { regionSparse->clear ( ); double *region = regionSparse->denseVector ( ); double *region2 = regionSparse2->denseVector ( ); int *regionIndex2 = regionSparse2->getIndices ( ); int numberNonZero = regionSparse2->getNumElements ( ); int *regionIndex = regionSparse->getIndices ( ); int i; bool doTwo = (numberNonZero == 2); int i0 = -1; int i1 = -1; if (doTwo) { i0 = regionIndex2[0]; i1 = regionIndex2[1]; } double returnValue = 0.0; bool packed = regionSparse2->packedMode(); if (packed) { if (doTwo && region2[0]*region2[1] < 0.0) { region[i0] = region2[0]; region2[0] = 0.0; region[i1] = region2[1]; region2[1] = 0.0; int iDepth0 = depth_[i0]; int iDepth1 = depth_[i1]; if (iDepth1 > iDepth0) { int temp = i0; i0 = i1; i1 = temp; temp = iDepth0; iDepth0 = iDepth1; iDepth1 = temp; } numberNonZero = 0; if (pivotRow < 0) { while (iDepth0 > iDepth1) { double pivotValue = region[i0]; // put back now ? int iBack = permuteBack_[i0]; region2[numberNonZero] = pivotValue * sign_[i0]; regionIndex2[numberNonZero++] = iBack; int otherRow = parent_[i0]; region[i0] = 0.0; region[otherRow] += pivotValue; iDepth0--; i0 = otherRow; } while (i0 != i1) { double pivotValue = region[i0]; // put back now ? int iBack = permuteBack_[i0]; region2[numberNonZero] = pivotValue * sign_[i0]; regionIndex2[numberNonZero++] = iBack; int otherRow = parent_[i0]; region[i0] = 0.0; region[otherRow] += pivotValue; i0 = otherRow; double pivotValue1 = region[i1]; // put back now ? int iBack1 = permuteBack_[i1]; region2[numberNonZero] = pivotValue1 * sign_[i1]; regionIndex2[numberNonZero++] = iBack1; int otherRow1 = parent_[i1]; region[i1] = 0.0; region[otherRow1] += pivotValue1; i1 = otherRow1; } } else { while (iDepth0 > iDepth1) { double pivotValue = region[i0]; // put back now ? int iBack = permuteBack_[i0]; double value = pivotValue * sign_[i0]; region2[numberNonZero] = value; regionIndex2[numberNonZero++] = iBack; if (iBack == pivotRow) returnValue = value; int otherRow = parent_[i0]; region[i0] = 0.0; region[otherRow] += pivotValue; iDepth0--; i0 = otherRow; } while (i0 != i1) { double pivotValue = region[i0]; // put back now ? int iBack = permuteBack_[i0]; double value = pivotValue * sign_[i0]; region2[numberNonZero] = value; regionIndex2[numberNonZero++] = iBack; if (iBack == pivotRow) returnValue = value; int otherRow = parent_[i0]; region[i0] = 0.0; region[otherRow] += pivotValue; i0 = otherRow; double pivotValue1 = region[i1]; // put back now ? int iBack1 = permuteBack_[i1]; value = pivotValue1 * sign_[i1]; region2[numberNonZero] = value; regionIndex2[numberNonZero++] = iBack1; if (iBack1 == pivotRow) returnValue = value; int otherRow1 = parent_[i1]; region[i1] = 0.0; region[otherRow1] += pivotValue1; i1 = otherRow1; } } } else { // set up linked lists at each depth // stack2 is start, stack is next int greatestDepth = -1; //mark_[numberRows_]=1; for (i = 0; i < numberNonZero; i++) { int j = regionIndex2[i]; double value = region2[i]; region2[i] = 0.0; region[j] = value; regionIndex[i] = j; int iDepth = depth_[j]; if (iDepth > greatestDepth) greatestDepth = iDepth; // and back until marked while (!mark_[j]) { int iNext = stack2_[iDepth]; stack2_[iDepth] = j; stack_[j] = iNext; mark_[j] = 1; iDepth--; j = parent_[j]; } } numberNonZero = 0; if (pivotRow < 0) { for (; greatestDepth >= 0; greatestDepth--) { int iPivot = stack2_[greatestDepth]; stack2_[greatestDepth] = -1; while (iPivot >= 0) { mark_[iPivot] = 0; double pivotValue = region[iPivot]; if (pivotValue) { // put back now ? int iBack = permuteBack_[iPivot]; region2[numberNonZero] = pivotValue * sign_[iPivot]; regionIndex2[numberNonZero++] = iBack; int otherRow = parent_[iPivot]; region[iPivot] = 0.0; region[otherRow] += pivotValue; } iPivot = stack_[iPivot]; } } } else { for (; greatestDepth >= 0; greatestDepth--) { int iPivot = stack2_[greatestDepth]; stack2_[greatestDepth] = -1; while (iPivot >= 0) { mark_[iPivot] = 0; double pivotValue = region[iPivot]; if (pivotValue) { // put back now ? int iBack = permuteBack_[iPivot]; double value = pivotValue * sign_[iPivot]; region2[numberNonZero] = value; regionIndex2[numberNonZero++] = iBack; if (iBack == pivotRow) returnValue = value; int otherRow = parent_[iPivot]; region[iPivot] = 0.0; region[otherRow] += pivotValue; } iPivot = stack_[iPivot]; } } } } } else { if (doTwo && region2[i0]*region2[i1] < 0.0) { // If just +- 1 then could go backwards on depth until join region[i0] = region2[i0]; region2[i0] = 0.0; region[i1] = region2[i1]; region2[i1] = 0.0; int iDepth0 = depth_[i0]; int iDepth1 = depth_[i1]; if (iDepth1 > iDepth0) { int temp = i0; i0 = i1; i1 = temp; temp = iDepth0; iDepth0 = iDepth1; iDepth1 = temp; } numberNonZero = 0; while (iDepth0 > iDepth1) { double pivotValue = region[i0]; // put back now ? int iBack = permuteBack_[i0]; regionIndex2[numberNonZero++] = iBack; int otherRow = parent_[i0]; region2[iBack] = pivotValue * sign_[i0]; region[i0] = 0.0; region[otherRow] += pivotValue; iDepth0--; i0 = otherRow; } while (i0 != i1) { double pivotValue = region[i0]; // put back now ? int iBack = permuteBack_[i0]; regionIndex2[numberNonZero++] = iBack; int otherRow = parent_[i0]; region2[iBack] = pivotValue * sign_[i0]; region[i0] = 0.0; region[otherRow] += pivotValue; i0 = otherRow; double pivotValue1 = region[i1]; // put back now ? int iBack1 = permuteBack_[i1]; regionIndex2[numberNonZero++] = iBack1; int otherRow1 = parent_[i1]; region2[iBack1] = pivotValue1 * sign_[i1]; region[i1] = 0.0; region[otherRow1] += pivotValue1; i1 = otherRow1; } } else { // set up linked lists at each depth // stack2 is start, stack is next int greatestDepth = -1; //mark_[numberRows_]=1; for (i = 0; i < numberNonZero; i++) { int j = regionIndex2[i]; double value = region2[j]; region2[j] = 0.0; region[j] = value; regionIndex[i] = j; int iDepth = depth_[j]; if (iDepth > greatestDepth) greatestDepth = iDepth; // and back until marked while (!mark_[j]) { int iNext = stack2_[iDepth]; stack2_[iDepth] = j; stack_[j] = iNext; mark_[j] = 1; iDepth--; j = parent_[j]; } } numberNonZero = 0; for (; greatestDepth >= 0; greatestDepth--) { int iPivot = stack2_[greatestDepth]; stack2_[greatestDepth] = -1; while (iPivot >= 0) { mark_[iPivot] = 0; double pivotValue = region[iPivot]; if (pivotValue) { // put back now ? int iBack = permuteBack_[iPivot]; regionIndex2[numberNonZero++] = iBack; int otherRow = parent_[iPivot]; region2[iBack] = pivotValue * sign_[iPivot]; region[iPivot] = 0.0; region[otherRow] += pivotValue; } iPivot = stack_[iPivot]; } } } if (pivotRow >= 0) returnValue = region2[pivotRow]; } region[numberRows_] = 0.0; regionSparse2->setNumElements(numberNonZero); #ifdef FULL_DEBUG { int i; for (i = 0; i < numberRows_; i++) { assert(!mark_[i]); assert (stack2_[i] == -1); } } #endif return returnValue; } /* Updates one column (FTRAN) to/from array ** For large problems you should ALWAYS know where the nonzeros are, so please try and migrate to previous method after you have got code working using this simple method - thank you! (the only exception is if you know input is dense e.g. rhs) */ int ClpNetworkBasis::updateColumn ( CoinIndexedVector * regionSparse, double region2[] ) const { regionSparse->clear ( ); double *region = regionSparse->denseVector ( ); int numberNonZero = 0; int *regionIndex = regionSparse->getIndices ( ); int i; // set up linked lists at each depth // stack2 is start, stack is next int greatestDepth = -1; for (i = 0; i < numberRows_; i++) { double value = region2[i]; if (value) { region2[i] = 0.0; region[i] = value; regionIndex[numberNonZero++] = i; int j = i; int iDepth = depth_[j]; if (iDepth > greatestDepth) greatestDepth = iDepth; // and back until marked while (!mark_[j]) { int iNext = stack2_[iDepth]; stack2_[iDepth] = j; stack_[j] = iNext; mark_[j] = 1; iDepth--; j = parent_[j]; } } } numberNonZero = 0; for (; greatestDepth >= 0; greatestDepth--) { int iPivot = stack2_[greatestDepth]; stack2_[greatestDepth] = -1; while (iPivot >= 0) { mark_[iPivot] = 0; double pivotValue = region[iPivot]; if (pivotValue) { // put back now ? int iBack = permuteBack_[iPivot]; numberNonZero++; int otherRow = parent_[iPivot]; region2[iBack] = pivotValue * sign_[iPivot]; region[iPivot] = 0.0; region[otherRow] += pivotValue; } iPivot = stack_[iPivot]; } } region[numberRows_] = 0.0; return numberNonZero; } /* Updates one column transpose (BTRAN) For large problems you should ALWAYS know where the nonzeros are, so please try and migrate to previous method after you have got code working using this simple method - thank you! (the only exception is if you know input is dense e.g. dense objective) returns number of nonzeros */ int ClpNetworkBasis::updateColumnTranspose ( CoinIndexedVector * regionSparse, double region2[] ) const { // permute in after copying // so will end up in right place double *region = regionSparse->denseVector ( ); int *regionIndex = regionSparse->getIndices ( ); int i; int numberNonZero = 0; CoinMemcpyN(region2, numberRows_, region); for (i = 0; i < numberRows_; i++) { double value = region[i]; if (value) { int k = permute_[i]; region[i] = 0.0; region2[k] = value; regionIndex[numberNonZero++] = k; mark_[k] = 1; } } // copy back // set up linked lists at each depth // stack2 is start, stack is next int greatestDepth = -1; int smallestDepth = numberRows_; for (i = 0; i < numberNonZero; i++) { int j = regionIndex[i]; // add in int iDepth = depth_[j]; smallestDepth = CoinMin(iDepth, smallestDepth) ; greatestDepth = CoinMax(iDepth, greatestDepth) ; int jNext = stack2_[iDepth]; stack2_[iDepth] = j; stack_[j] = jNext; // and put all descendants on list int iChild = descendant_[j]; while (iChild >= 0) { if (!mark_[iChild]) { regionIndex[numberNonZero++] = iChild; mark_[iChild] = 1; } iChild = rightSibling_[iChild]; } } numberNonZero = 0; region2[numberRows_] = 0.0; int iDepth; for (iDepth = smallestDepth; iDepth <= greatestDepth; iDepth++) { int iPivot = stack2_[iDepth]; stack2_[iDepth] = -1; while (iPivot >= 0) { mark_[iPivot] = 0; double pivotValue = region2[iPivot]; int otherRow = parent_[iPivot]; double otherValue = region2[otherRow]; pivotValue = sign_[iPivot] * pivotValue + otherValue; region2[iPivot] = pivotValue; if (pivotValue) numberNonZero++; iPivot = stack_[iPivot]; } } return numberNonZero; } /* Updates one column (BTRAN) from region2 */ int ClpNetworkBasis::updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { // permute in - presume small number so copy back // so will end up in right place regionSparse->clear ( ); double *region = regionSparse->denseVector ( ); double *region2 = regionSparse2->denseVector ( ); int *regionIndex2 = regionSparse2->getIndices ( ); int numberNonZero2 = regionSparse2->getNumElements ( ); int *regionIndex = regionSparse->getIndices ( ); int i; int numberNonZero = 0; bool packed = regionSparse2->packedMode(); if (packed) { for (i = 0; i < numberNonZero2; i++) { int k = regionIndex2[i]; int j = permute_[k]; double value = region2[i]; region2[i] = 0.0; region[j] = value; mark_[j] = 1; regionIndex[numberNonZero++] = j; } // set up linked lists at each depth // stack2 is start, stack is next int greatestDepth = -1; int smallestDepth = numberRows_; //mark_[numberRows_]=1; for (i = 0; i < numberNonZero2; i++) { int j = regionIndex[i]; regionIndex2[i] = j; // add in int iDepth = depth_[j]; smallestDepth = CoinMin(iDepth, smallestDepth) ; greatestDepth = CoinMax(iDepth, greatestDepth) ; int jNext = stack2_[iDepth]; stack2_[iDepth] = j; stack_[j] = jNext; // and put all descendants on list int iChild = descendant_[j]; while (iChild >= 0) { if (!mark_[iChild]) { regionIndex2[numberNonZero++] = iChild; mark_[iChild] = 1; } iChild = rightSibling_[iChild]; } } for (; i < numberNonZero; i++) { int j = regionIndex2[i]; // add in int iDepth = depth_[j]; smallestDepth = CoinMin(iDepth, smallestDepth) ; greatestDepth = CoinMax(iDepth, greatestDepth) ; int jNext = stack2_[iDepth]; stack2_[iDepth] = j; stack_[j] = jNext; // and put all descendants on list int iChild = descendant_[j]; while (iChild >= 0) { if (!mark_[iChild]) { regionIndex2[numberNonZero++] = iChild; mark_[iChild] = 1; } iChild = rightSibling_[iChild]; } } numberNonZero2 = 0; region[numberRows_] = 0.0; int iDepth; for (iDepth = smallestDepth; iDepth <= greatestDepth; iDepth++) { int iPivot = stack2_[iDepth]; stack2_[iDepth] = -1; while (iPivot >= 0) { mark_[iPivot] = 0; double pivotValue = region[iPivot]; int otherRow = parent_[iPivot]; double otherValue = region[otherRow]; pivotValue = sign_[iPivot] * pivotValue + otherValue; region[iPivot] = pivotValue; if (pivotValue) { region2[numberNonZero2] = pivotValue; regionIndex2[numberNonZero2++] = iPivot; } iPivot = stack_[iPivot]; } } // zero out for (i = 0; i < numberNonZero2; i++) { int k = regionIndex2[i]; region[k] = 0.0; } } else { for (i = 0; i < numberNonZero2; i++) { int k = regionIndex2[i]; int j = permute_[k]; double value = region2[k]; region2[k] = 0.0; region[j] = value; mark_[j] = 1; regionIndex[numberNonZero++] = j; } // copy back // set up linked lists at each depth // stack2 is start, stack is next int greatestDepth = -1; int smallestDepth = numberRows_; //mark_[numberRows_]=1; for (i = 0; i < numberNonZero2; i++) { int j = regionIndex[i]; double value = region[j]; region[j] = 0.0; region2[j] = value; regionIndex2[i] = j; // add in int iDepth = depth_[j]; smallestDepth = CoinMin(iDepth, smallestDepth) ; greatestDepth = CoinMax(iDepth, greatestDepth) ; int jNext = stack2_[iDepth]; stack2_[iDepth] = j; stack_[j] = jNext; // and put all descendants on list int iChild = descendant_[j]; while (iChild >= 0) { if (!mark_[iChild]) { regionIndex2[numberNonZero++] = iChild; mark_[iChild] = 1; } iChild = rightSibling_[iChild]; } } for (; i < numberNonZero; i++) { int j = regionIndex2[i]; // add in int iDepth = depth_[j]; smallestDepth = CoinMin(iDepth, smallestDepth) ; greatestDepth = CoinMax(iDepth, greatestDepth) ; int jNext = stack2_[iDepth]; stack2_[iDepth] = j; stack_[j] = jNext; // and put all descendants on list int iChild = descendant_[j]; while (iChild >= 0) { if (!mark_[iChild]) { regionIndex2[numberNonZero++] = iChild; mark_[iChild] = 1; } iChild = rightSibling_[iChild]; } } numberNonZero2 = 0; region2[numberRows_] = 0.0; int iDepth; for (iDepth = smallestDepth; iDepth <= greatestDepth; iDepth++) { int iPivot = stack2_[iDepth]; stack2_[iDepth] = -1; while (iPivot >= 0) { mark_[iPivot] = 0; double pivotValue = region2[iPivot]; int otherRow = parent_[iPivot]; double otherValue = region2[otherRow]; pivotValue = sign_[iPivot] * pivotValue + otherValue; region2[iPivot] = pivotValue; if (pivotValue) regionIndex2[numberNonZero2++] = iPivot; iPivot = stack_[iPivot]; } } } regionSparse2->setNumElements(numberNonZero2); #ifdef FULL_DEBUG { int i; for (i = 0; i < numberRows_; i++) { assert(!mark_[i]); assert (stack2_[i] == -1); } } #endif return numberNonZero2; } CoinMP-1.8.3/Clp/src/ClpPdcoBase.cpp0000644000175000017500000000313212131041005015426 0ustar renerene/* $Id: ClpPdcoBase.cpp 1938 2013-04-09 16:29:57Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include "ClpPdcoBase.hpp" #include "ClpPdco.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpPdcoBase::ClpPdcoBase () : d1_(0.0), d2_(0.0), type_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpPdcoBase::ClpPdcoBase (const ClpPdcoBase & source) : d1_(source.d1_), d2_(source.d2_), type_(source.type_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpPdcoBase::~ClpPdcoBase () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpPdcoBase & ClpPdcoBase::operator=(const ClpPdcoBase& rhs) { if (this != &rhs) { d1_ = rhs.d1_; d2_ = rhs.d2_; type_ = rhs.type_; } return *this; } CoinMP-1.8.3/Clp/src/CoinAbcOrderedFactorization5.cpp0000644000175000017500000000107712101105055020745 0ustar renerene/* $Id: CoinAbcOrderedFactorization5.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcOrderedFactorization #define ABC_SMALL -1 #define ABC_ORDERED_FACTORIZATION #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization5.cpp" #endif CoinMP-1.8.3/Clp/src/ClpConstraintLinear.hpp0000644000175000017500000000631211510657452017260 0ustar renerene/* $Id: ClpConstraintLinear.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpConstraintLinear_H #define ClpConstraintLinear_H #include "ClpConstraint.hpp" //############################################################################# /** Linear Constraint Class */ class ClpConstraintLinear : public ClpConstraint { public: ///@name Stuff //@{ /** Fills gradient. If Linear then solution may be NULL, also returns true value of function and offset so we can use x not deltaX in constraint If refresh is false then uses last solution Uses model for scaling Returns non-zero if gradient udefined at current solution */ virtual int gradient(const ClpSimplex * model, const double * solution, double * gradient, double & functionValue , double & offset, bool useScaling = false, bool refresh = true) const ; /// Resize constraint virtual void resize(int newNumberColumns) ; /// Delete columns in constraint virtual void deleteSome(int numberToDelete, const int * which) ; /// Scale constraint virtual void reallyScale(const double * columnScale) ; /** Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ virtual int markNonlinear(char * which) const ; /** Given a zeroed array sets possible nonzero coefficients to 1. Returns number of nonzeros */ virtual int markNonzero(char * which) const; //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpConstraintLinear(); /// Constructor from constraint ClpConstraintLinear(int row, int numberCoefficients, int numberColumns, const int * column, const double * element); /** Copy constructor . */ ClpConstraintLinear(const ClpConstraintLinear & rhs); /// Assignment operator ClpConstraintLinear & operator=(const ClpConstraintLinear& rhs); /// Destructor virtual ~ClpConstraintLinear (); /// Clone virtual ClpConstraint * clone() const; //@} ///@name Gets and sets //@{ /// Number of coefficients virtual int numberCoefficients() const; /// Number of columns in linear constraint inline int numberColumns() const { return numberColumns_; } /// Columns inline const int * column() const { return column_; } /// Coefficients inline const double * coefficient() const { return coefficient_; } //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// Column int * column_; /// Coefficients double * coefficient_; /// Useful to have number of columns about int numberColumns_; /// Number of coefficients int numberCoefficients_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpSolver.cpp0000644000175000017500000067310212503570327015253 0ustar renerene/* $Id: ClpMain.cpp 1975 2013-08-06 16:04:43Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include #include #include #include #include #include int boundary_sort = 1000; int boundary_sort2 = 1000; int boundary_sort3 = 10000; // for printing #ifndef CLP_OUTPUT_FORMAT #define CLP_OUTPUT_FORMAT %15.8g #endif #define CLP_QUOTE(s) CLP_STRING(s) #define CLP_STRING(s) #s #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinSort.hpp" // History since 1.0 at end #include "ClpConfig.h" #include "CoinMpsIO.hpp" #include "CoinFileIO.hpp" #ifdef COIN_HAS_GLPK #include "glpk.h" extern glp_tran* cbc_glp_tran; extern glp_prob* cbc_glp_prob; #else #define GLP_UNDEF 1 #define GLP_FEAS 2 #define GLP_INFEAS 3 #define GLP_NOFEAS 4 #define GLP_OPT 5 #endif #include "AbcCommon.hpp" #include "ClpFactorization.hpp" #include "CoinTime.hpp" #include "CoinWarmStartBasis.hpp" #include "ClpSimplex.hpp" #include "ClpSimplexOther.hpp" #include "ClpSolve.hpp" #include "ClpMessage.hpp" #include "ClpPackedMatrix.hpp" #include "ClpPlusMinusOneMatrix.hpp" #include "ClpNetworkMatrix.hpp" #include "ClpDualRowSteepest.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpLinearObjective.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "ClpPrimalColumnDantzig.hpp" #include "ClpPresolve.hpp" #include "CbcOrClpParam.hpp" #include "CoinSignal.hpp" #ifdef ABC_INHERIT #include "AbcSimplex.hpp" #include "AbcSimplexFactorization.hpp" #include "AbcDualRowSteepest.hpp" #include "AbcDualRowDantzig.hpp" #endif #ifdef COIN_HAS_ASL #include "Clp_ampl.h" #endif #ifdef DMALLOC #include "dmalloc.h" #endif #ifdef CLP_USEFUL_PRINTOUT static double startElapsed=0.0; static double startCpu=0.0; static std::string mpsFile=""; extern double debugDouble[10]; extern int debugInt[24]; #endif #if defined(COIN_HAS_WSMP) || defined(COIN_HAS_AMD) || defined(COIN_HAS_CHOLMOD) || defined(TAUCS_BARRIER) || defined(COIN_HAS_MUMPS) #define FOREIGN_BARRIER #endif static double totalTime = 0.0; static bool maskMatches(const int * starts, char ** masks, std::string & check); #ifndef ABC_INHERIT static ClpSimplex * currentModel = NULL; #else static AbcSimplex * currentModel = NULL; #endif extern "C" { static void #if defined(_MSC_VER) __cdecl #endif // _MSC_VER signal_handler(int /*whichSignal*/) { if (currentModel != NULL) currentModel->setMaximumIterations(0); // stop at next iterations return; } void openblas_set_num_threads(int num_threads); } //############################################################################# #ifdef NDEBUG #undef NDEBUG #endif #ifndef ABC_INHERIT int mainTest (int argc, const char *argv[], int algorithm, ClpSimplex empty, ClpSolve solveOptions, int switchOff, bool doVector); #else int mainTest (int argc, const char *argv[], int algorithm, AbcSimplex empty, ClpSolve solveOptions, int switchOff, bool doVector); #endif static void statistics(ClpSimplex * originalModel, ClpSimplex * model); static void generateCode(const char * fileName, int type); // Returns next valid field int CbcOrClpRead_mode = 1; FILE * CbcOrClpReadCommand = stdin; extern int CbcOrClpEnvironmentIndex; #ifdef CLP_USER_DRIVEN1 /* Returns true if variable sequenceOut can leave basis when model->sequenceIn() enters. This function may be entered several times for each sequenceOut. The first time realAlpha will be positive if going to lower bound and negative if going to upper bound (scaled bounds in lower,upper) - then will be zero. currentValue is distance to bound. currentTheta is current theta. alpha is fabs(pivot element). Variable will change theta if currentValue - currentTheta*alpha < 0.0 */ bool userChoiceValid1(const ClpSimplex * model, int sequenceOut, double currentValue, double currentTheta, double alpha, double realAlpha) { return true; } /* This returns true if chosen in/out pair valid. The main thing to check would be variable flipping bounds may be OK. This would be signaled by reasonable theta_ and valueOut_. If you return false sequenceIn_ will be flagged as ineligible. */ bool userChoiceValid2(const ClpSimplex * model) { return true; } /* If a good pivot then you may wish to unflag some variables. */ void userChoiceWasGood(ClpSimplex * model) { } #endif #ifndef ABC_INHERIT void ClpMain0(ClpSimplex * models) #else void ClpMain0(AbcSimplex * models) #endif { models->setPerturbation(50); models->messageHandler()->setPrefix(false); #if CLP_INHERIT_MODE>1 models->setDualTolerance(1.0e-6); models->setPrimalTolerance(1.0e-6); #endif } #ifndef ABC_INHERIT int ClpMain1(int argc, const char *argv[],ClpSimplex * models) #else int ClpMain1(int argc, const char *argv[],AbcSimplex * models) #endif { double time1 = CoinCpuTime(), time2; // Set up all non-standard stuff //int numberModels=1; #ifdef CLP_USEFUL_PRINTOUT startElapsed=CoinGetTimeOfDay(); startCpu=CoinCpuTime(); memset(debugInt,0,sizeof(debugInt)); memset(debugDouble,0,sizeof(debugDouble)); #endif #if 0 #ifndef ABC_INHERIT ClpSimplex * models = new ClpSimplex[1]; #else AbcSimplex * models = new AbcSimplex[1]; #endif #endif // default action on import int allowImportErrors = 0; int keepImportNames = 1; int doIdiot = -1; int outputFormat = 2; int slpValue = -1; int cppValue = -1; int printOptions = 0; int printMode = 0; int presolveOptions = 0; int doCrash = 0; int doVector = 0; int doSprint = -1; // set reasonable defaults #if CLP_INHERIT_MODE>1 #define DEFAULT_PRESOLVE_PASSES 20 #else #define DEFAULT_PRESOLVE_PASSES 10 #endif int preSolve = DEFAULT_PRESOLVE_PASSES; bool preSolveFile = false; const char dirsep = CoinFindDirSeparator(); std::string directory; std::string dirSample; std::string dirNetlib; std::string dirMiplib; if (dirsep == '/') { directory = "./"; dirSample = "../../Data/Sample/"; dirNetlib = "../../Data/Netlib/"; dirMiplib = "../../Data/miplib3/"; } else { directory = ".\\"; # ifdef COIN_MSVS // Visual Studio builds are deeper dirSample = "..\\..\\..\\..\\Data\\Sample\\"; dirNetlib = "..\\..\\..\\..\\Data\\Netlib\\"; dirMiplib = "..\\..\\..\\..\\Data\\miplib3\\"; # else dirSample = "..\\..\\Data\\Sample\\"; dirNetlib = "..\\..\\Data\\Netlib\\"; dirMiplib = "..\\..\\Data\\miplib3\\"; # endif } std::string defaultDirectory = directory; std::string importFile = ""; std::string exportFile = "default.mps"; std::string importBasisFile = ""; int basisHasValues = 0; int substitution = 3; int dualize = 3; // dualize if looks promising std::string exportBasisFile = "default.bas"; std::string saveFile = "default.prob"; std::string restoreFile = "default.prob"; std::string solutionFile = "stdout"; std::string solutionSaveFile = "solution.file"; std::string printMask = ""; CbcOrClpParam parameters[CBCMAXPARAMETERS]; int numberParameters ; establishParams(numberParameters, parameters) ; parameters[whichParam(CLP_PARAM_ACTION_BASISIN, numberParameters, parameters)].setStringValue(importBasisFile); parameters[whichParam(CLP_PARAM_ACTION_BASISOUT, numberParameters, parameters)].setStringValue(exportBasisFile); parameters[whichParam(CLP_PARAM_ACTION_PRINTMASK, numberParameters, parameters)].setStringValue(printMask); parameters[whichParam(CLP_PARAM_ACTION_DIRECTORY, numberParameters, parameters)].setStringValue(directory); parameters[whichParam(CLP_PARAM_ACTION_DIRSAMPLE, numberParameters, parameters)].setStringValue(dirSample); parameters[whichParam(CLP_PARAM_ACTION_DIRNETLIB, numberParameters, parameters)].setStringValue(dirNetlib); parameters[whichParam(CBC_PARAM_ACTION_DIRMIPLIB, numberParameters, parameters)].setStringValue(dirMiplib); parameters[whichParam(CLP_PARAM_DBL_DUALBOUND, numberParameters, parameters)].setDoubleValue(models->dualBound()); parameters[whichParam(CLP_PARAM_DBL_DUALTOLERANCE, numberParameters, parameters)].setDoubleValue(models->dualTolerance()); parameters[whichParam(CLP_PARAM_ACTION_EXPORT, numberParameters, parameters)].setStringValue(exportFile); parameters[whichParam(CLP_PARAM_INT_IDIOT, numberParameters, parameters)].setIntValue(doIdiot); parameters[whichParam(CLP_PARAM_ACTION_IMPORT, numberParameters, parameters)].setStringValue(importFile); parameters[whichParam(CLP_PARAM_INT_SOLVERLOGLEVEL, numberParameters, parameters)].setIntValue(models->logLevel()); parameters[whichParam(CLP_PARAM_INT_MAXFACTOR, numberParameters, parameters)].setIntValue(models->factorizationFrequency()); parameters[whichParam(CLP_PARAM_INT_MAXITERATION, numberParameters, parameters)].setIntValue(models->maximumIterations()); parameters[whichParam(CLP_PARAM_INT_OUTPUTFORMAT, numberParameters, parameters)].setIntValue(outputFormat); parameters[whichParam(CLP_PARAM_INT_PRESOLVEPASS, numberParameters, parameters)].setIntValue(preSolve); parameters[whichParam(CLP_PARAM_INT_PERTVALUE, numberParameters, parameters)].setIntValue(models->perturbation()); parameters[whichParam(CLP_PARAM_DBL_PRIMALTOLERANCE, numberParameters, parameters)].setDoubleValue(models->primalTolerance()); parameters[whichParam(CLP_PARAM_DBL_PRIMALWEIGHT, numberParameters, parameters)].setDoubleValue(models->infeasibilityCost()); parameters[whichParam(CLP_PARAM_ACTION_RESTORE, numberParameters, parameters)].setStringValue(restoreFile); parameters[whichParam(CLP_PARAM_ACTION_SAVE, numberParameters, parameters)].setStringValue(saveFile); parameters[whichParam(CLP_PARAM_DBL_TIMELIMIT, numberParameters, parameters)].setDoubleValue(models->maximumSeconds()); parameters[whichParam(CLP_PARAM_ACTION_SOLUTION, numberParameters, parameters)].setStringValue(solutionFile); parameters[whichParam(CLP_PARAM_ACTION_SAVESOL, numberParameters, parameters)].setStringValue(solutionSaveFile); parameters[whichParam(CLP_PARAM_INT_SPRINT, numberParameters, parameters)].setIntValue(doSprint); parameters[whichParam(CLP_PARAM_INT_SUBSTITUTION, numberParameters, parameters)].setIntValue(substitution); parameters[whichParam(CLP_PARAM_INT_DUALIZE, numberParameters, parameters)].setIntValue(dualize); parameters[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters, parameters)].setDoubleValue(1.0e-8); int verbose = 0; // total number of commands read int numberGoodCommands = 0; bool * goodModels = new bool[1]; goodModels[0] = false; if (models[0].numberRows()||models[0].numberColumns()) { // model already built goodModels[0]=true; numberGoodCommands=1; } #ifdef COIN_HAS_ASL ampl_info info; int usingAmpl=0; CoinMessageHandler * generalMessageHandler = models->messageHandler(); generalMessageHandler->setPrefix(false); CoinMessages generalMessages = models->messages(); char generalPrint[10000]; { bool noPrinting_=false; memset(&info, 0, sizeof(info)); if (argc > 2 && !strcmp(argv[2], "-AMPL")) { usingAmpl = 1; // see if log in list noPrinting_ = true; for (int i = 1; i < argc; i++) { if (!strncmp(argv[i], "log", 3)) { const char * equals = strchr(argv[i], '='); if (equals && atoi(equals + 1) > 0) { noPrinting_ = false; info.logLevel = atoi(equals + 1); int log = whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters, parameters); parameters[log].setIntValue(info.logLevel); // mark so won't be overWritten info.numberRows = -1234567; break; } } } union { void * voidModel; CoinModel * model; } coinModelStart; coinModelStart.model = NULL; int returnCode = readAmpl(&info, argc, const_cast(argv), & coinModelStart.voidModel); if (returnCode) return returnCode; if (info.numberBinary+info.numberIntegers+info.numberSos &&!info.starts) { printf("Unable to handle integer problems\n"); return 1; } CbcOrClpRead_mode = 2; // so will start with parameters // see if log in list (including environment) for (int i = 1; i < info.numberArguments; i++) { if (!strcmp(info.arguments[i], "log")) { if (i < info.numberArguments - 1 && atoi(info.arguments[i+1]) > 0) noPrinting_ = false; break; } } if (noPrinting_) { models->messageHandler()->setLogLevel(0); setCbcOrClpPrinting(false); } if (!noPrinting_) printf("%d rows, %d columns and %d elements\n", info.numberRows, info.numberColumns, info.numberElements); if (!coinModelStart.model) { // linear models->loadProblem(info.numberColumns, info.numberRows, info.starts, info.rows, info.elements, info.columnLower, info.columnUpper, info.objective, info.rowLower, info.rowUpper); } else { // QP models->loadProblem(*(coinModelStart.model)); } // If we had a solution use it if (info.primalSolution) { models->setColSolution(info.primalSolution); } // status if (info.rowStatus) { unsigned char * statusArray = models->statusArray(); int i; for (i = 0; i < info.numberColumns; i++) statusArray[i] = static_cast(info.columnStatus[i]); statusArray += info.numberColumns; for (i = 0; i < info.numberRows; i++) statusArray[i] = static_cast(info.rowStatus[i]); } freeArrays1(&info); // modify objective if necessary models->setOptimizationDirection(info.direction); models->setObjectiveOffset(-info.offset); if (info.offset) { sprintf(generalPrint, "Ampl objective offset is %g", info.offset); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; } goodModels[0] = true; // change argc etc argc = info.numberArguments; argv = const_cast(info.arguments); } } #endif // Hidden stuff for barrier int choleskyType = 0; int gamma = 0; parameters[whichParam(CLP_PARAM_STR_BARRIERSCALE, numberParameters, parameters)].setCurrentOption(2); int scaleBarrier = 2; int doKKT = 0; int crossover = 2; // do crossover unless quadratic int iModel = 0; //models[0].scaling(1); //models[0].setDualBound(1.0e6); //models[0].setDualTolerance(1.0e-7); //ClpDualRowSteepest steep; //models[0].setDualRowPivotAlgorithm(steep); //ClpPrimalColumnSteepest steepP; //models[0].setPrimalColumnPivotAlgorithm(steepP); std::string field; while (1) { // next command field = CoinReadGetCommand(argc, argv); // exit if null or similar if (!field.length()) { if (numberGoodCommands == 1 && goodModels[0]) { // we just had file name - do dual or primal field = "either"; } else if (!numberGoodCommands) { // let's give the sucker a hint std::cout << "Clp takes input from arguments ( - switches to stdin)" << std::endl << "Enter ? for list of commands or help" << std::endl; field = "-"; } else { break; } } // see if ? at end int numberQuery = 0; if (field != "?" && field != "???") { size_t length = field.length(); size_t i; for (i = length - 1; i > 0; i--) { if (field[i] == '?') numberQuery++; else break; } field = field.substr(0, length - numberQuery); } // find out if valid command int iParam; int numberMatches = 0; int firstMatch = -1; for ( iParam = 0; iParam < numberParameters; iParam++ ) { int match = parameters[iParam].matches(field); if (match == 1) { numberMatches = 1; firstMatch = iParam; break; } else { if (match && firstMatch < 0) firstMatch = iParam; numberMatches += match >> 1; } } ClpSimplex * thisModel=models+iModel; if (iParam < numberParameters && !numberQuery) { // found CbcOrClpParam found = parameters[iParam]; CbcOrClpParameterType type = found.type(); int valid; numberGoodCommands++; if (type == CBC_PARAM_GENERALQUERY) { std::cout << "In argument list keywords have leading - " ", -stdin or just - switches to stdin" << std::endl; std::cout << "One command per line (and no -)" << std::endl; std::cout << "abcd? gives list of possibilities, if only one + explanation" << std::endl; std::cout << "abcd?? adds explanation, if only one fuller help" << std::endl; std::cout << "abcd without value (where expected) gives current value" << std::endl; std::cout << "abcd value sets value" << std::endl; std::cout << "Commands are:" << std::endl; int maxAcross = 10; bool evenHidden = false; int printLevel = parameters[whichParam(CLP_PARAM_STR_ALLCOMMANDS, numberParameters, parameters)].currentOptionAsInteger(); int convertP[] = {2, 1, 0}; printLevel = convertP[printLevel]; if ((verbose & 8) != 0) { // even hidden evenHidden = true; verbose &= ~8; } #ifdef COIN_HAS_ASL if (verbose < 4 && usingAmpl) verbose += 4; #endif if (verbose) maxAcross = 1; int limits[] = {1, 101, 201, 301, 401}; std::vector types; types.push_back("Double parameters:"); types.push_back("Int parameters:"); types.push_back("Keyword parameters:"); types.push_back("Actions or string parameters:"); int iType; for (iType = 0; iType < 4; iType++) { int across = 0; int lengthLine = 0; if ((verbose % 4) != 0) std::cout << std::endl; std::cout << types[iType] << std::endl; if ((verbose & 2) != 0) std::cout << std::endl; for ( iParam = 0; iParam < numberParameters; iParam++ ) { int type = parameters[iParam].type(); //printf("%d type %d limits %d %d display %d\n",iParam, // type,limits[iType],limits[iType+1],parameters[iParam].displayThis()); if ((parameters[iParam].displayThis() >= printLevel || evenHidden) && type >= limits[iType] && type < limits[iType+1]) { if (!across) { if ((verbose & 2) != 0) std::cout << "Command "; } int length = parameters[iParam].lengthMatchName() + 1; if (lengthLine + length > 80) { std::cout << std::endl; across = 0; lengthLine = 0; } std::cout << " " << parameters[iParam].matchName(); lengthLine += length ; across++; if (across == maxAcross) { across = 0; if (verbose) { // put out description as well if ((verbose & 1) != 0) std::cout << parameters[iParam].shortHelp(); std::cout << std::endl; if ((verbose & 2) != 0) { std::cout << "---- description" << std::endl; parameters[iParam].printLongHelp(); std::cout << "----" << std::endl << std::endl; } } else { std::cout << std::endl; } } } } if (across) std::cout << std::endl; } } else if (type == CBC_PARAM_FULLGENERALQUERY) { std::cout << "Full list of commands is:" << std::endl; int maxAcross = 5; int limits[] = {1, 101, 201, 301, 401}; std::vector types; types.push_back("Double parameters:"); types.push_back("Int parameters:"); types.push_back("Keyword parameters and others:"); types.push_back("Actions:"); int iType; for (iType = 0; iType < 4; iType++) { int across = 0; std::cout << types[iType] << std::endl; for ( iParam = 0; iParam < numberParameters; iParam++ ) { int type = parameters[iParam].type(); if (type >= limits[iType] && type < limits[iType+1]) { if (!across) std::cout << " "; std::cout << parameters[iParam].matchName() << " "; across++; if (across == maxAcross) { std::cout << std::endl; across = 0; } } } if (across) std::cout << std::endl; } } else if (type < 101) { // get next field as double double value = CoinReadGetDoubleField(argc, argv, &valid); if (!valid) { parameters[iParam].setDoubleParameter(thisModel, value); } else if (valid == 1) { std::cout << " is illegal for double parameter " << parameters[iParam].name() << " value remains " << parameters[iParam].doubleValue() << std::endl; } else { std::cout << parameters[iParam].name() << " has value " << parameters[iParam].doubleValue() << std::endl; } } else if (type < 201) { // get next field as int int value = CoinReadGetIntField(argc, argv, &valid); if (!valid) { if (parameters[iParam].type() == CLP_PARAM_INT_PRESOLVEPASS) preSolve = value; else if (parameters[iParam].type() == CLP_PARAM_INT_IDIOT) doIdiot = value; else if (parameters[iParam].type() == CLP_PARAM_INT_SPRINT) doSprint = value; else if (parameters[iParam].type() == CLP_PARAM_INT_OUTPUTFORMAT) outputFormat = value; else if (parameters[iParam].type() == CLP_PARAM_INT_SLPVALUE) slpValue = value; else if (parameters[iParam].type() == CLP_PARAM_INT_CPP) cppValue = value; else if (parameters[iParam].type() == CLP_PARAM_INT_PRESOLVEOPTIONS) presolveOptions = value; else if (parameters[iParam].type() == CLP_PARAM_INT_PRINTOPTIONS) printOptions = value; else if (parameters[iParam].type() == CLP_PARAM_INT_SUBSTITUTION) substitution = value; else if (parameters[iParam].type() == CLP_PARAM_INT_DUALIZE) dualize = value; else if (parameters[iParam].type() == CLP_PARAM_INT_VERBOSE) verbose = value; parameters[iParam].setIntParameter(thisModel, value); } else if (valid == 1) { std::cout << " is illegal for integer parameter " << parameters[iParam].name() << " value remains " << parameters[iParam].intValue() << std::endl; } else { std::cout << parameters[iParam].name() << " has value " << parameters[iParam].intValue() << std::endl; } } else if (type < 301) { // one of several strings std::string value = CoinReadGetString(argc, argv); int action = parameters[iParam].parameterOption(value); if (action < 0) { if (value != "EOL") { // no match parameters[iParam].printOptions(); } else { // print current value std::cout << parameters[iParam].name() << " has value " << parameters[iParam].currentOption() << std::endl; } } else { parameters[iParam].setCurrentOption(action); // for now hard wired switch (type) { case CLP_PARAM_STR_DIRECTION: if (action == 0) { models[iModel].setOptimizationDirection(1); #ifdef ABC_INHERIT thisModel->setOptimizationDirection(1); #endif } else if (action == 1) { models[iModel].setOptimizationDirection(-1); #ifdef ABC_INHERIT thisModel->setOptimizationDirection(-1); #endif } else { models[iModel].setOptimizationDirection(0); #ifdef ABC_INHERIT thisModel->setOptimizationDirection(0); #endif } break; case CLP_PARAM_STR_DUALPIVOT: if (action == 0) { ClpDualRowSteepest steep(3); thisModel->setDualRowPivotAlgorithm(steep); #ifdef ABC_INHERIT AbcDualRowSteepest steep2(3); models[iModel].setDualRowPivotAlgorithm(steep2); #endif } else if (action == 1) { //ClpDualRowDantzig dantzig; ClpDualRowDantzig dantzig; thisModel->setDualRowPivotAlgorithm(dantzig); #ifdef ABC_INHERIT AbcDualRowDantzig dantzig2; models[iModel].setDualRowPivotAlgorithm(dantzig2); #endif } else if (action == 2) { // partial steep ClpDualRowSteepest steep(2); thisModel->setDualRowPivotAlgorithm(steep); #ifdef ABC_INHERIT AbcDualRowSteepest steep2(2); models[iModel].setDualRowPivotAlgorithm(steep2); #endif } else { ClpDualRowSteepest steep; thisModel->setDualRowPivotAlgorithm(steep); #ifdef ABC_INHERIT AbcDualRowSteepest steep2; models[iModel].setDualRowPivotAlgorithm(steep2); #endif } break; case CLP_PARAM_STR_PRIMALPIVOT: if (action == 0) { ClpPrimalColumnSteepest steep(3); thisModel->setPrimalColumnPivotAlgorithm(steep); } else if (action == 1) { ClpPrimalColumnSteepest steep(0); thisModel->setPrimalColumnPivotAlgorithm(steep); } else if (action == 2) { ClpPrimalColumnDantzig dantzig; thisModel->setPrimalColumnPivotAlgorithm(dantzig); } else if (action == 3) { ClpPrimalColumnSteepest steep(4); thisModel->setPrimalColumnPivotAlgorithm(steep); } else if (action == 4) { ClpPrimalColumnSteepest steep(1); thisModel->setPrimalColumnPivotAlgorithm(steep); } else if (action == 5) { ClpPrimalColumnSteepest steep(2); thisModel->setPrimalColumnPivotAlgorithm(steep); } else if (action == 6) { ClpPrimalColumnSteepest steep(10); thisModel->setPrimalColumnPivotAlgorithm(steep); } break; case CLP_PARAM_STR_SCALING: thisModel->scaling(action); break; case CLP_PARAM_STR_AUTOSCALE: thisModel->setAutomaticScaling(action != 0); break; case CLP_PARAM_STR_SPARSEFACTOR: thisModel->setSparseFactorization((1 - action) != 0); break; case CLP_PARAM_STR_BIASLU: thisModel->factorization()->setBiasLU(action); break; case CLP_PARAM_STR_PERTURBATION: if (action == 0) thisModel->setPerturbation(50); else thisModel->setPerturbation(100); break; case CLP_PARAM_STR_ERRORSALLOWED: allowImportErrors = action; break; case CLP_PARAM_STR_ABCWANTED: models[iModel].setAbcState(action); break; case CLP_PARAM_STR_INTPRINT: printMode = action; break; case CLP_PARAM_STR_KEEPNAMES: keepImportNames = 1 - action; break; case CLP_PARAM_STR_PRESOLVE: if (action == 0) preSolve = DEFAULT_PRESOLVE_PASSES; else if (action == 1) preSolve = 0; else if (action == 2) preSolve = 10; else preSolveFile = true; break; case CLP_PARAM_STR_PFI: thisModel->factorization()->setForrestTomlin(action == 0); break; case CLP_PARAM_STR_FACTORIZATION: models[iModel].factorization()->forceOtherFactorization(action); #ifdef ABC_INHERIT thisModel->factorization()->forceOtherFactorization(action); #endif break; case CLP_PARAM_STR_CRASH: doCrash = action; break; case CLP_PARAM_STR_VECTOR: doVector = action; break; case CLP_PARAM_STR_MESSAGES: models[iModel].messageHandler()->setPrefix(action != 0); #ifdef ABC_INHERIT thisModel->messageHandler()->setPrefix(action != 0); #endif break; case CLP_PARAM_STR_CHOLESKY: choleskyType = action; break; case CLP_PARAM_STR_GAMMA: gamma = action; break; case CLP_PARAM_STR_BARRIERSCALE: scaleBarrier = action; break; case CLP_PARAM_STR_KKT: doKKT = action; break; case CLP_PARAM_STR_CROSSOVER: crossover = action; break; default: //abort(); break; } } } else { // action if (type == CLP_PARAM_ACTION_EXIT) { #ifdef COIN_HAS_ASL if (usingAmpl) { writeAmpl(&info); freeArrays2(&info); freeArgs(&info); } #endif break; // stop all } switch (type) { case CLP_PARAM_ACTION_DUALSIMPLEX: case CLP_PARAM_ACTION_PRIMALSIMPLEX: case CLP_PARAM_ACTION_EITHERSIMPLEX: case CLP_PARAM_ACTION_BARRIER: // synonym for dual case CBC_PARAM_ACTION_BAB: if (goodModels[iModel]) { //openblas_set_num_threads(4); if (type==CLP_PARAM_ACTION_EITHERSIMPLEX|| type==CBC_PARAM_ACTION_BAB) models[iModel].setMoreSpecialOptions(16384| models[iModel].moreSpecialOptions()); double objScale = parameters[whichParam(CLP_PARAM_DBL_OBJSCALE2, numberParameters, parameters)].doubleValue(); if (objScale != 1.0) { int iColumn; int numberColumns = models[iModel].numberColumns(); double * dualColumnSolution = models[iModel].dualColumnSolution(); ClpObjective * obj = models[iModel].objectiveAsObject(); assert(dynamic_cast (obj)); double offset; double * objective = obj->gradient(NULL, NULL, offset, true); for (iColumn = 0; iColumn < numberColumns; iColumn++) { dualColumnSolution[iColumn] *= objScale; objective[iColumn] *= objScale;; } int iRow; int numberRows = models[iModel].numberRows(); double * dualRowSolution = models[iModel].dualRowSolution(); for (iRow = 0; iRow < numberRows; iRow++) dualRowSolution[iRow] *= objScale; models[iModel].setObjectiveOffset(objScale * models[iModel].objectiveOffset()); } ClpSolve::SolveType method; ClpSolve::PresolveType presolveType; ClpSolve solveOptions; #ifndef ABC_INHERIT ClpSimplex * model2 = models + iModel; #else AbcSimplex * model2 = models + iModel; #endif if (type==CLP_PARAM_ACTION_EITHERSIMPLEX|| type==CBC_PARAM_ACTION_BAB) solveOptions.setSpecialOption(3,0); // allow +-1 if (dualize==4) { solveOptions.setSpecialOption(4, 77); dualize=0; } if (dualize) { bool tryIt = true; double fractionColumn = 1.0; double fractionRow = 1.0; if (dualize == 3) { dualize = 1; int numberColumns = model2->numberColumns(); int numberRows = model2->numberRows(); #ifndef ABC_INHERIT if (numberRows < 50000 || 5 * numberColumns > numberRows) { #else if (numberRows < 500 || 4 * numberColumns > numberRows) { #endif tryIt = false; } else { fractionColumn = 0.1; fractionRow = 0.3; } } if (tryIt) { ClpSimplex * thisModel=model2; thisModel = static_cast (thisModel)->dualOfModel(fractionRow, fractionColumn); if (thisModel) { printf("Dual of model has %d rows and %d columns\n", thisModel->numberRows(), thisModel->numberColumns()); thisModel->setOptimizationDirection(1.0); #ifndef ABC_INHERIT model2=thisModel; #else int abcState=model2->abcState(); model2=new AbcSimplex(*thisModel); model2->setAbcState(abcState); delete thisModel; #endif } else { thisModel = models + iModel; dualize = 0; } } else { dualize = 0; } } if (preSolveFile) presolveOptions |= 0x40000000; // allow dependency presolveOptions |= 32768; solveOptions.setPresolveActions(presolveOptions); solveOptions.setSubstitution(substitution); if (preSolve != DEFAULT_PRESOLVE_PASSES && preSolve) { presolveType = ClpSolve::presolveNumber; if (preSolve < 0) { preSolve = - preSolve; if (preSolve <= 100) { presolveType = ClpSolve::presolveNumber; printf("Doing %d presolve passes - picking up non-costed slacks\n", preSolve); solveOptions.setDoSingletonColumn(true); } else { preSolve -= 100; presolveType = ClpSolve::presolveNumberCost; printf("Doing %d presolve passes - picking up costed slacks\n", preSolve); } } } else if (preSolve) { presolveType = ClpSolve::presolveOn; } else { presolveType = ClpSolve::presolveOff; } solveOptions.setPresolveType(presolveType, preSolve); if (type == CLP_PARAM_ACTION_DUALSIMPLEX || type == CBC_PARAM_ACTION_BAB) { method = ClpSolve::useDual; } else if (type == CLP_PARAM_ACTION_PRIMALSIMPLEX) { method = ClpSolve::usePrimalorSprint; } else if (type == CLP_PARAM_ACTION_EITHERSIMPLEX) { method = ClpSolve::automatic; if (doCrash>3) { solveOptions.setSpecialOption(6, 1,doCrash-3); doCrash=0; } if (doIdiot > 0) solveOptions.setSpecialOption(1, 2, doIdiot); } else { method = ClpSolve::useBarrier; #ifdef ABC_INHERIT if (doIdiot > 0) solveOptions.setSpecialOption(1, 2, doIdiot); // dense threshold #endif if (crossover == 1) { method = ClpSolve::useBarrierNoCross; } else if (crossover == 2) { ClpObjective * obj = models[iModel].objectiveAsObject(); if (obj->type() > 1) { method = ClpSolve::useBarrierNoCross; presolveType = ClpSolve::presolveOff; solveOptions.setPresolveType(presolveType, preSolve); } } } solveOptions.setSolveType(method); solveOptions.setSpecialOption(5, printOptions & 1); if (doVector) { ClpMatrixBase * matrix = models[iModel].clpMatrix(); if (dynamic_cast< ClpPackedMatrix*>(matrix)) { ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); clpMatrix->makeSpecialColumnCopy(); } } if (method == ClpSolve::useDual) { // dual if (doCrash&&doCrash<4) solveOptions.setSpecialOption(0, 1, doCrash); // crash else if (doIdiot) solveOptions.setSpecialOption(0, 2, doIdiot); // possible idiot } else if (method == ClpSolve::usePrimalorSprint) { // primal // if slp turn everything off if (slpValue > 0) { doCrash = false; doSprint = 0; doIdiot = -1; solveOptions.setSpecialOption(1, 10, slpValue); // slp method = ClpSolve::usePrimal; } if (doCrash>3) { solveOptions.setSpecialOption(6, 1,doCrash-3); doCrash=0; } if (doCrash>0) { solveOptions.setSpecialOption(1, 1, doCrash); // crash } else if (doSprint > 0) { // sprint overrides idiot solveOptions.setSpecialOption(1, 3, doSprint); // sprint } else if (doIdiot > 0) { solveOptions.setSpecialOption(1, 2, doIdiot); // idiot } else if (slpValue <= 0) { if (doIdiot == 0) { if (doSprint == 0) solveOptions.setSpecialOption(1, 4); // all slack else solveOptions.setSpecialOption(1, 9); // all slack or sprint } else { if (doSprint == 0) solveOptions.setSpecialOption(1, 8); // all slack or idiot else solveOptions.setSpecialOption(1, 7); // initiative } } if (basisHasValues == -1) solveOptions.setSpecialOption(1, 11); // switch off values } else if (method == ClpSolve::useBarrier || method == ClpSolve::useBarrierNoCross) { int barrierOptions = choleskyType; if (scaleBarrier) { if ((scaleBarrier & 1) != 0) barrierOptions |= 8; barrierOptions |= 2048 * (scaleBarrier >> 1); } if (doKKT) barrierOptions |= 16; if (gamma) barrierOptions |= 32 * gamma; if (crossover == 3) barrierOptions |= 256; // try presolve in crossover solveOptions.setSpecialOption(4, barrierOptions); } int status; if (cppValue >= 0) { // generate code FILE * fp = fopen("user_driver.cpp", "w"); if (fp) { // generate enough to do solveOptions model2->generateCpp(fp); solveOptions.generateCpp(fp); fclose(fp); // now call generate code generateCode("user_driver.cpp", cppValue); } else { std::cout << "Unable to open file user_driver.cpp" << std::endl; } } #ifdef CLP_MULTIPLE_FACTORIZATIONS int denseCode = parameters[whichParam(CBC_PARAM_INT_DENSE, numberParameters, parameters)].intValue(); if (denseCode!=-1) model2->factorization()->setGoDenseThreshold(denseCode); int smallCode = parameters[whichParam(CBC_PARAM_INT_SMALLFACT, numberParameters, parameters)].intValue(); if (smallCode!=-1) model2->factorization()->setGoSmallThreshold(smallCode); model2->factorization()->goDenseOrSmall(model2->numberRows()); #endif try { status = model2->initialSolve(solveOptions); #ifdef COIN_HAS_ASL if (usingAmpl) { double value = model2->getObjValue() * model2->getObjSense(); char buf[300]; int pos = 0; int iStat = model2->status(); if (iStat == 0) { pos += sprintf(buf + pos, "optimal," ); } else if (iStat == 1) { // infeasible pos += sprintf(buf + pos, "infeasible,"); } else if (iStat == 2) { // unbounded pos += sprintf(buf + pos, "unbounded,"); } else if (iStat == 3) { pos += sprintf(buf + pos, "stopped on iterations or time,"); } else if (iStat == 4) { iStat = 7; pos += sprintf(buf + pos, "stopped on difficulties,"); } else if (iStat == 5) { iStat = 3; pos += sprintf(buf + pos, "stopped on ctrl-c,"); } else if (iStat == 6) { // bab infeasible pos += sprintf(buf + pos, "integer infeasible,"); iStat = 1; } else { pos += sprintf(buf + pos, "status unknown,"); iStat = 6; } info.problemStatus = iStat; info.objValue = value; pos += sprintf(buf + pos, " objective %.*g", ampl_obj_prec(), value); sprintf(buf + pos, "\n%d iterations", model2->getIterationCount()); free(info.primalSolution); int numberColumns = model2->numberColumns(); info.primalSolution = reinterpret_cast (malloc(numberColumns * sizeof(double))); CoinCopyN(model2->primalColumnSolution(), numberColumns, info.primalSolution); int numberRows = model2->numberRows(); free(info.dualSolution); info.dualSolution = reinterpret_cast (malloc(numberRows * sizeof(double))); CoinCopyN(model2->dualRowSolution(), numberRows, info.dualSolution); CoinWarmStartBasis * basis = model2->getBasis(); free(info.rowStatus); info.rowStatus = reinterpret_cast (malloc(numberRows * sizeof(int))); free(info.columnStatus); info.columnStatus = reinterpret_cast (malloc(numberColumns * sizeof(int))); // Put basis in int i; // free,basic,ub,lb are 0,1,2,3 for (i = 0; i < numberRows; i++) { CoinWarmStartBasis::Status status = basis->getArtifStatus(i); info.rowStatus[i] = status; } for (i = 0; i < numberColumns; i++) { CoinWarmStartBasis::Status status = basis->getStructStatus(i); info.columnStatus[i] = status; } // put buffer into info strcpy(info.buffer, buf); delete basis; } #endif #ifndef NDEBUG // if infeasible check ray if (model2->status()==1) { ClpSimplex * simplex = model2; if(simplex->ray()) { // make sure we use non-scaled versions ClpPackedMatrix * saveMatrix = simplex->swapScaledMatrix(NULL); double * saveScale = simplex->swapRowScale(NULL); // could use existing arrays int numberRows=simplex->numberRows(); int numberColumns=simplex->numberColumns(); double * farkas = new double [2*numberColumns+numberRows]; double * bound = farkas + numberColumns; double * effectiveRhs = bound + numberColumns; // get ray as user would double * ray = simplex->infeasibilityRay(); // get farkas row memset(farkas,0,(2*numberColumns+numberRows)*sizeof(double)); simplex->transposeTimes(-1.0,ray,farkas); // Put nonzero bounds in bound const double * columnLower = simplex->columnLower(); const double * columnUpper = simplex->columnUpper(); int numberBad=0; for (int i=0;igetStatus(i)==ClpSimplex::basic) { // treat as zero if small if (fabs(value)<1.0e-8) { value=0.0; farkas[i]=0.0; } if (value) { //printf("basic %d direction %d farkas %g\n", // i,simplex->directionOut(),value); if (value<0.0) boundValue=columnLower[i]; else boundValue=columnUpper[i]; } } else if (fabs(value)>1.0e-10) { if (value<0.0) boundValue=columnLower[i]; else boundValue=columnUpper[i]; } bound[i]=boundValue; if (fabs(boundValue)>1.0e10) numberBad++; } const double * rowLower = simplex->rowLower(); const double * rowUpper = simplex->rowUpper(); //int pivotRow = simplex->spareIntArray_[3]; //bool badPivot=pivotRow<0; for (int i=0;igetRowStatus(i)==ClpSimplex::basic) { // treat as zero if small if (fabs(value)<1.0e-8) { value=0.0; ray[i]=0.0; } if (value) { //printf("row basic %d direction %d ray %g\n", // i,simplex->directionOut(),value); if (value<0.0) rhsValue=rowLower[i]; else rhsValue=rowUpper[i]; } } else if (fabs(value)>1.0e-10) { if (value<0.0) rhsValue=rowLower[i]; else rhsValue=rowUpper[i]; } effectiveRhs[i]=rhsValue; if (fabs(effectiveRhs[i])>1.0e10) printf("Large rhs row %d %g\n", i,effectiveRhs[i]); } simplex->times(-1.0,bound,effectiveRhs); double bSum=0.0; for (int i=0;i1.0e10) printf("Large rhs row %d %g after\n", i,effectiveRhs[i]); } if (numberBad||bSum>1.0e-6) { printf("Bad infeasibility ray %g - %d bad\n", bSum,numberBad); } else { //printf("Good ray - infeasibility %g\n", // -bSum); } delete [] ray; delete [] farkas; simplex->swapRowScale(saveScale); simplex->swapScaledMatrix(saveMatrix); } else { //printf("No dual ray\n"); } } #endif } catch (CoinError e) { e.print(); status = -1; } if (dualize) { ClpSimplex * thisModel=models+iModel; int returnCode = static_cast (thisModel)->restoreFromDual(model2); if (model2->status() == 3) returnCode = 0; delete model2; if (returnCode && dualize != 2) { currentModel = models + iModel; // register signal handler signal(SIGINT, signal_handler); thisModel->primal(1); currentModel = NULL; } #ifndef COIN_HAS_ASL CoinMessageHandler * generalMessageHandler = models->messageHandler(); generalMessageHandler->setPrefix(false); CoinMessages generalMessages = models->messages(); char generalPrint[100]; #endif sprintf(generalPrint, "After translating dual back to primal - objective value is %g", thisModel->objectiveValue()); generalMessageHandler->message(CLP_GENERAL, generalMessages) << generalPrint << CoinMessageEol; // switch off (user can switch back on) parameters[whichParam(CLP_PARAM_INT_DUALIZE, numberParameters, parameters)].setIntValue(dualize); } if (status >= 0) basisHasValues = 1; } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_STATISTICS: if (goodModels[iModel]) { // If presolve on look at presolved bool deleteModel2 = false; ClpSimplex * model2 = models + iModel; if (preSolve) { ClpPresolve pinfo; int presolveOptions2 = presolveOptions&~0x40000000; if ((presolveOptions2 & 0xffff) != 0) pinfo.setPresolveActions(presolveOptions2); pinfo.setSubstitution(substitution); if ((printOptions & 1) != 0) pinfo.statistics(); double presolveTolerance = parameters[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters, parameters)].doubleValue(); model2 = pinfo.presolvedModel(models[iModel], presolveTolerance, true, preSolve); if (model2) { printf("Statistics for presolved model\n"); deleteModel2 = true; } else { printf("Presolved model looks infeasible - will use unpresolved\n"); model2 = models + iModel; } } else { printf("Statistics for unpresolved model\n"); model2 = models + iModel; } statistics(models + iModel, model2); if (deleteModel2) delete model2; } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_TIGHTEN: if (goodModels[iModel]) { int numberInfeasibilities = models[iModel].tightenPrimalBounds(); if (numberInfeasibilities) std::cout << "** Analysis indicates model infeasible" << std::endl; } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_PLUSMINUS: if (goodModels[iModel]) { ClpMatrixBase * saveMatrix = models[iModel].clpMatrix(); ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(saveMatrix); if (clpMatrix) { ClpPlusMinusOneMatrix * newMatrix = new ClpPlusMinusOneMatrix(*(clpMatrix->matrix())); if (newMatrix->getIndices()) { models[iModel].replaceMatrix(newMatrix); delete saveMatrix; std::cout << "Matrix converted to +- one matrix" << std::endl; } else { std::cout << "Matrix can not be converted to +- 1 matrix" << std::endl; } } else { std::cout << "Matrix not a ClpPackedMatrix" << std::endl; } } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_NETWORK: if (goodModels[iModel]) { ClpMatrixBase * saveMatrix = models[iModel].clpMatrix(); ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(saveMatrix); if (clpMatrix) { ClpNetworkMatrix * newMatrix = new ClpNetworkMatrix(*(clpMatrix->matrix())); if (newMatrix->getIndices()) { models[iModel].replaceMatrix(newMatrix); delete saveMatrix; std::cout << "Matrix converted to network matrix" << std::endl; } else { std::cout << "Matrix can not be converted to network matrix" << std::endl; } } else { std::cout << "Matrix not a ClpPackedMatrix" << std::endl; } } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_IMPORT: { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; // See if gmpl file int gmpl = 0; std::string gmplData; if (field == "-") { // stdin canOpen = true; fileName = "-"; } else { // See if .lp { const char * c_name = field.c_str(); size_t length = strlen(c_name); if (length > 3 && !strncmp(c_name + length - 3, ".lp", 3)) gmpl = -1; // .lp } bool absolutePath; if (dirsep == '/') { // non Windows (or cygwin) absolutePath = (field[0] == '/'); } else { //Windows (non cycgwin) absolutePath = (field[0] == '\\'); // but allow for : if (strchr(field.c_str(), ':')) absolutePath = true; } if (absolutePath) { fileName = field; size_t length = field.size(); size_t percent = field.find('%'); if (percent < length && percent > 0) { gmpl = 1; fileName = field.substr(0, percent); gmplData = field.substr(percent + 1); if (percent < length - 1) gmpl = 2; // two files printf("GMPL model file %s and data file %s\n", fileName.c_str(), gmplData.c_str()); } } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; // See if gmpl (model & data) - or even lp file size_t length = field.size(); size_t percent = field.find('%'); if (percent < length && percent > 0) { gmpl = 1; fileName = directory + field.substr(0, percent); gmplData = directory + field.substr(percent + 1); if (percent < length - 1) gmpl = 2; // two files printf("GMPL model file %s and data file %s\n", fileName.c_str(), gmplData.c_str()); } } std::string name = fileName; if (fileCoinReadable(name)) { // can open - lets go for it canOpen = true; if (gmpl == 2) { FILE *fp; fp = fopen(gmplData.c_str(), "r"); if (fp) { fclose(fp); } else { canOpen = false; std::cout << "Unable to open file " << gmplData << std::endl; } } } else { std::cout << "Unable to open file " << fileName << std::endl; } } if (canOpen) { int status; #ifdef CLP_USEFUL_PRINTOUT mpsFile=fileName; #endif if (!gmpl) status = models[iModel].readMps(fileName.c_str(), keepImportNames != 0, allowImportErrors != 0); else if (gmpl > 0) status = models[iModel].readGMPL(fileName.c_str(), (gmpl == 2) ? gmplData.c_str() : NULL, keepImportNames != 0); else #ifdef KILL_ZERO_READLP status = models[iModel].readLp(fileName.c_str(), models[iModel].getSmallElementValue()); #else status = models[iModel].readLp(fileName.c_str(), 1.0e-12); #endif if (!status || (status > 0 && allowImportErrors)) { goodModels[iModel] = true; // sets to all slack (not necessary?) thisModel->createStatus(); time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; // Go to canned file if just input file if (CbcOrClpRead_mode == 2 && argc == 2) { // only if ends .mps char * find = const_cast(strstr(fileName.c_str(), ".mps")); if (find && find[4] == '\0') { find[1] = 'p'; find[2] = 'a'; find[3] = 'r'; FILE *fp = fopen(fileName.c_str(), "r"); if (fp) { CbcOrClpReadCommand = fp; // Read from that file CbcOrClpRead_mode = -1; } } } } else { // errors std::cout << "There were " << status << " errors on input" << std::endl; } } } break; case CLP_PARAM_ACTION_EXPORT: if (goodModels[iModel]) { double objScale = parameters[whichParam(CLP_PARAM_DBL_OBJSCALE2, numberParameters, parameters)].doubleValue(); if (objScale != 1.0) { int iColumn; int numberColumns = models[iModel].numberColumns(); double * dualColumnSolution = models[iModel].dualColumnSolution(); ClpObjective * obj = models[iModel].objectiveAsObject(); assert(dynamic_cast (obj)); double offset; double * objective = obj->gradient(NULL, NULL, offset, true); for (iColumn = 0; iColumn < numberColumns; iColumn++) { dualColumnSolution[iColumn] *= objScale; objective[iColumn] *= objScale;; } int iRow; int numberRows = models[iModel].numberRows(); double * dualRowSolution = models[iModel].dualRowSolution(); for (iRow = 0; iRow < numberRows; iRow++) dualRowSolution[iRow] *= objScale; models[iModel].setObjectiveOffset(objScale * models[iModel].objectiveOffset()); } // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "w"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { std::cout << "Unable to open file " << fileName << std::endl; } if (canOpen) { // If presolve on then save presolved bool deleteModel2 = false; ClpSimplex * model2 = models + iModel; if (dualize && dualize < 3) { model2 = static_cast (model2)->dualOfModel(); printf("Dual of model has %d rows and %d columns\n", model2->numberRows(), model2->numberColumns()); model2->setOptimizationDirection(1.0); preSolve = 0; // as picks up from model } if (preSolve) { ClpPresolve pinfo; int presolveOptions2 = presolveOptions&~0x40000000; if ((presolveOptions2 & 0xffff) != 0) pinfo.setPresolveActions(presolveOptions2); pinfo.setSubstitution(substitution); if ((printOptions & 1) != 0) pinfo.statistics(); double presolveTolerance = parameters[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters, parameters)].doubleValue(); model2 = pinfo.presolvedModel(models[iModel], presolveTolerance, true, preSolve, false, false); if (model2) { printf("Saving presolved model on %s\n", fileName.c_str()); deleteModel2 = true; } else { printf("Presolved model looks infeasible - saving original on %s\n", fileName.c_str()); deleteModel2 = false; model2 = models + iModel; } } else { printf("Saving model on %s\n", fileName.c_str()); } #if 0 // Convert names int iRow; int numberRows = model2->numberRows(); int iColumn; int numberColumns = model2->numberColumns(); char ** rowNames = NULL; char ** columnNames = NULL; if (model2->lengthNames()) { rowNames = new char * [numberRows]; for (iRow = 0; iRow < numberRows; iRow++) { rowNames[iRow] = CoinStrdup(model2->rowName(iRow).c_str()); #ifdef STRIPBLANKS char * xx = rowNames[iRow]; int i; int length = strlen(xx); int n = 0; for (i = 0; i < length; i++) { if (xx[i] != ' ') xx[n++] = xx[i]; } xx[n] = '\0'; #endif } columnNames = new char * [numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) { columnNames[iColumn] = CoinStrdup(model2->columnName(iColumn).c_str()); #ifdef STRIPBLANKS char * xx = columnNames[iColumn]; int i; int length = strlen(xx); int n = 0; for (i = 0; i < length; i++) { if (xx[i] != ' ') xx[n++] = xx[i]; } xx[n] = '\0'; #endif } } CoinMpsIO writer; writer.setMpsData(*model2->matrix(), COIN_DBL_MAX, model2->getColLower(), model2->getColUpper(), model2->getObjCoefficients(), (const char*) 0 /*integrality*/, model2->getRowLower(), model2->getRowUpper(), columnNames, rowNames); // Pass in array saying if each variable integer writer.copyInIntegerInformation(model2->integerInformation()); writer.setObjectiveOffset(model2->objectiveOffset()); writer.writeMps(fileName.c_str(), 0, 1, 1); if (rowNames) { for (iRow = 0; iRow < numberRows; iRow++) { free(rowNames[iRow]); } delete [] rowNames; for (iColumn = 0; iColumn < numberColumns; iColumn++) { free(columnNames[iColumn]); } delete [] columnNames; } #else model2->writeMps(fileName.c_str(), (outputFormat - 1) / 2, 1 + ((outputFormat - 1) & 1)); #endif if (deleteModel2) delete model2; time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_BASISIN: if (goodModels[iModel]) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field == "-") { // stdin canOpen = true; fileName = "-"; } else { if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "r"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { std::cout << "Unable to open file " << fileName << std::endl; } } if (canOpen) { int values = thisModel->readBasis(fileName.c_str()); if (values == 0) basisHasValues = -1; else basisHasValues = 1; } } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_PRINTMASK: // get next field { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { parameters[iParam].setStringValue(name); printMask = name; } else { parameters[iParam].printString(); } } break; case CLP_PARAM_ACTION_BASISOUT: if (goodModels[iModel]) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "w"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { std::cout << "Unable to open file " << fileName << std::endl; } if (canOpen) { ClpSimplex * model2 = models + iModel; model2->writeBasis(fileName.c_str(), outputFormat > 1, outputFormat - 2); time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_PARAMETRICS: if (goodModels[iModel]) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; //bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } ClpSimplex * model2 = models + iModel; static_cast (model2)->parametrics(fileName.c_str()); time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_SAVE: { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "wb"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { std::cout << "Unable to open file " << fileName << std::endl; } if (canOpen) { int status; // If presolve on then save presolved bool deleteModel2 = false; ClpSimplex * model2 = models + iModel; if (preSolve) { ClpPresolve pinfo; double presolveTolerance = parameters[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters, parameters)].doubleValue(); model2 = pinfo.presolvedModel(models[iModel], presolveTolerance, false, preSolve); if (model2) { printf("Saving presolved model on %s\n", fileName.c_str()); deleteModel2 = true; } else { printf("Presolved model looks infeasible - saving original on %s\n", fileName.c_str()); deleteModel2 = false; model2 = models + iModel; } } else { printf("Saving model on %s\n", fileName.c_str()); } status = model2->saveModel(fileName.c_str()); if (deleteModel2) delete model2; if (!status) { goodModels[iModel] = true; time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } else { // errors std::cout << "There were errors on output" << std::endl; } } } break; case CLP_PARAM_ACTION_RESTORE: { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; bool canOpen = false; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } FILE *fp = fopen(fileName.c_str(), "rb"); if (fp) { // can open - lets go for it fclose(fp); canOpen = true; } else { std::cout << "Unable to open file " << fileName << std::endl; } if (canOpen) { int status = models[iModel].restoreModel(fileName.c_str()); if (!status) { goodModels[iModel] = true; time2 = CoinCpuTime(); totalTime += time2 - time1; time1 = time2; } else { // errors std::cout << "There were errors on input" << std::endl; } } } break; case CLP_PARAM_ACTION_MAXIMIZE: models[iModel].setOptimizationDirection(-1); #ifdef ABC_INHERIT thisModel->setOptimizationDirection(-1); #endif break; case CLP_PARAM_ACTION_MINIMIZE: models[iModel].setOptimizationDirection(1); #ifdef ABC_INHERIT thisModel->setOptimizationDirection(1); #endif break; case CLP_PARAM_ACTION_ALLSLACK: thisModel->allSlackBasis(true); #ifdef ABC_INHERIT models[iModel].allSlackBasis(); #endif break; case CLP_PARAM_ACTION_REVERSE: if (goodModels[iModel]) { int iColumn; int numberColumns = models[iModel].numberColumns(); double * dualColumnSolution = models[iModel].dualColumnSolution(); ClpObjective * obj = models[iModel].objectiveAsObject(); assert(dynamic_cast (obj)); double offset; double * objective = obj->gradient(NULL, NULL, offset, true); for (iColumn = 0; iColumn < numberColumns; iColumn++) { dualColumnSolution[iColumn] = -dualColumnSolution[iColumn]; objective[iColumn] = -objective[iColumn]; } int iRow; int numberRows = models[iModel].numberRows(); double * dualRowSolution = models[iModel].dualRowSolution(); for (iRow = 0; iRow < numberRows; iRow++) { dualRowSolution[iRow] = -dualRowSolution[iRow]; } models[iModel].setObjectiveOffset(-models[iModel].objectiveOffset()); } break; case CLP_PARAM_ACTION_DIRECTORY: { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { size_t length = name.length(); if (length > 0 && name[length-1] == dirsep) { directory = name; } else { directory = name + dirsep; } parameters[iParam].setStringValue(directory); } else { parameters[iParam].printString(); } } break; case CLP_PARAM_ACTION_DIRSAMPLE: { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { size_t length = name.length(); if (length > 0 && name[length-1] == dirsep) { dirSample = name; } else { dirSample = name + dirsep; } parameters[iParam].setStringValue(dirSample); } else { parameters[iParam].printString(); } } break; case CLP_PARAM_ACTION_DIRNETLIB: { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { size_t length = name.length(); if (length > 0 && name[length-1] == dirsep) { dirNetlib = name; } else { dirNetlib = name + dirsep; } parameters[iParam].setStringValue(dirNetlib); } else { parameters[iParam].printString(); } } break; case CBC_PARAM_ACTION_DIRMIPLIB: { std::string name = CoinReadGetString(argc, argv); if (name != "EOL") { size_t length = name.length(); if (length > 0 && name[length-1] == dirsep) { dirMiplib = name; } else { dirMiplib = name + dirsep; } parameters[iParam].setStringValue(dirMiplib); } else { parameters[iParam].printString(); } } break; case CLP_PARAM_ACTION_STDIN: CbcOrClpRead_mode = -1; break; case CLP_PARAM_ACTION_NETLIB_DUAL: case CLP_PARAM_ACTION_NETLIB_EITHER: case CLP_PARAM_ACTION_NETLIB_BARRIER: case CLP_PARAM_ACTION_NETLIB_PRIMAL: case CLP_PARAM_ACTION_NETLIB_TUNE: { // create fields for unitTest const char * fields[4]; int nFields = 4; fields[0] = "fake main from unitTest"; std::string mpsfield = "-dirSample="; mpsfield += dirSample.c_str(); fields[1] = mpsfield.c_str(); std::string netfield = "-dirNetlib="; netfield += dirNetlib.c_str(); fields[2] = netfield.c_str(); fields[3] = "-netlib"; int algorithm; if (type == CLP_PARAM_ACTION_NETLIB_DUAL) { std::cerr << "Doing netlib with dual algorithm" << std::endl; algorithm = 0; models[iModel].setMoreSpecialOptions(models[iModel].moreSpecialOptions()|32768); } else if (type == CLP_PARAM_ACTION_NETLIB_BARRIER) { std::cerr << "Doing netlib with barrier algorithm" << std::endl; algorithm = 2; } else if (type == CLP_PARAM_ACTION_NETLIB_EITHER) { std::cerr << "Doing netlib with dual or primal algorithm" << std::endl; algorithm = 3; } else if (type == CLP_PARAM_ACTION_NETLIB_TUNE) { std::cerr << "Doing netlib with best algorithm!" << std::endl; algorithm = 5; // uncomment next to get active tuning // algorithm=6; } else { std::cerr << "Doing netlib with primal algorithm" << std::endl; algorithm = 1; } //int specialOptions = models[iModel].specialOptions(); models[iModel].setSpecialOptions(0); ClpSolve solveOptions; ClpSolve::PresolveType presolveType; if (preSolve) presolveType = ClpSolve::presolveOn; else presolveType = ClpSolve::presolveOff; solveOptions.setPresolveType(presolveType, 5); if (doSprint >= 0 || doIdiot >= 0) { if (doSprint > 0) { // sprint overrides idiot solveOptions.setSpecialOption(1, 3, doSprint); // sprint } else if (doIdiot > 0) { solveOptions.setSpecialOption(1, 2, doIdiot); // idiot } else { if (doIdiot == 0) { if (doSprint == 0) solveOptions.setSpecialOption(1, 4); // all slack else solveOptions.setSpecialOption(1, 9); // all slack or sprint } else { if (doSprint == 0) solveOptions.setSpecialOption(1, 8); // all slack or idiot else solveOptions.setSpecialOption(1, 7); // initiative } } } #if FACTORIZATION_STATISTICS { extern int loSizeX; extern int hiSizeX; for (int i=0;i0) loSizeX=size; } if (!strcmp(argv[i],"-hisize")) { int size=atoi(argv[i+1]); if (size>loSizeX) hiSizeX=size; } } if (loSizeX!=-1||hiSizeX!=1000000) printf("Solving problems %d<= and <%d\n",loSizeX,hiSizeX); } #endif // for moment then back to models[iModel] #ifndef ABC_INHERIT int specialOptions = models[iModel].specialOptions(); mainTest(nFields, fields, algorithm, *thisModel, solveOptions, specialOptions, doVector != 0); #else //if (!processTune) { //specialOptions=0; //models->setSpecialOptions(models->specialOptions()&~65536); // } mainTest(nFields, fields, algorithm, *models, solveOptions, 0, doVector != 0); #endif } break; case CLP_PARAM_ACTION_UNITTEST: { // create fields for unitTest const char * fields[2]; int nFields = 2; fields[0] = "fake main from unitTest"; std::string dirfield = "-dirSample="; dirfield += dirSample.c_str(); fields[1] = dirfield.c_str(); int specialOptions = models[iModel].specialOptions(); models[iModel].setSpecialOptions(0); int algorithm = -1; if (models[iModel].numberRows()) algorithm = 7; ClpSolve solveOptions; ClpSolve::PresolveType presolveType; if (preSolve) presolveType = ClpSolve::presolveOn; else presolveType = ClpSolve::presolveOff; solveOptions.setPresolveType(presolveType, 5); #ifndef ABC_INHERIT mainTest(nFields, fields, algorithm, *thisModel, solveOptions, specialOptions, doVector != 0); #else mainTest(nFields, fields, algorithm, *models, solveOptions, specialOptions, doVector != 0); #endif } break; case CLP_PARAM_ACTION_FAKEBOUND: if (goodModels[iModel]) { // get bound double value = CoinReadGetDoubleField(argc, argv, &valid); if (!valid) { std::cout << "Setting " << parameters[iParam].name() << " to DEBUG " << value << std::endl; int iRow; int numberRows = models[iModel].numberRows(); double * rowLower = models[iModel].rowLower(); double * rowUpper = models[iModel].rowUpper(); for (iRow = 0; iRow < numberRows; iRow++) { // leave free ones for now if (rowLower[iRow] > -1.0e20 || rowUpper[iRow] < 1.0e20) { rowLower[iRow] = CoinMax(rowLower[iRow], -value); rowUpper[iRow] = CoinMin(rowUpper[iRow], value); } } int iColumn; int numberColumns = models[iModel].numberColumns(); double * columnLower = models[iModel].columnLower(); double * columnUpper = models[iModel].columnUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { // leave free ones for now if (columnLower[iColumn] > -1.0e20 || columnUpper[iColumn] < 1.0e20) { columnLower[iColumn] = CoinMax(columnLower[iColumn], -value); columnUpper[iColumn] = CoinMin(columnUpper[iColumn], value); } } } else if (valid == 1) { abort(); } else { std::cout << "enter value for " << parameters[iParam].name() << std::endl; } } break; case CLP_PARAM_ACTION_REALLY_SCALE: if (goodModels[iModel]) { ClpSimplex newModel(models[iModel], models[iModel].scalingFlag()); printf("model really really scaled\n"); models[iModel] = newModel; } break; case CLP_PARAM_ACTION_USERCLP: // Replace the sample code by whatever you want if (goodModels[iModel]) { ClpSimplex * thisModel = &models[iModel]; printf("Dummy user code - model has %d rows and %d columns\n", thisModel->numberRows(), thisModel->numberColumns()); } break; case CLP_PARAM_ACTION_HELP: std::cout << "Coin LP version " << CLP_VERSION << ", build " << __DATE__ << std::endl; std::cout << "Non default values:-" << std::endl; std::cout << "Perturbation " << models[0].perturbation() << " (default 100)" << std::endl; CoinReadPrintit( "Presolve being done with 5 passes\n\ Dual steepest edge steep/partial on matrix shape and factorization density\n\ Clpnnnn taken out of messages\n\ If Factorization frequency default then done on size of matrix\n\n\ (-)unitTest, (-)netlib or (-)netlibp will do standard tests\n\n\ You can switch to interactive mode at any time so\n\ clp watson.mps -scaling off -primalsimplex\nis the same as\n\ clp watson.mps -\nscaling off\nprimalsimplex" ); break; case CLP_PARAM_ACTION_SOLUTION: case CLP_PARAM_ACTION_GMPL_SOLUTION: if (goodModels[iModel]) { // get next field field = CoinReadGetString(argc, argv); bool append = false; if (field == "append$") { field = "$"; append = true; } if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; FILE *fp = NULL; if (field == "-" || field == "EOL" || field == "stdout") { // stdout fp = stdout; fprintf(fp, "\n"); } else if (field == "stderr") { // stderr fp = stderr; fprintf(fp, "\n"); } else { if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } if (!append) fp = fopen(fileName.c_str(), "w"); else fp = fopen(fileName.c_str(), "a"); } if (fp) { // See if Glpk if (type == CLP_PARAM_ACTION_GMPL_SOLUTION) { int numberRows = models[iModel].getNumRows(); int numberColumns = models[iModel].getNumCols(); int numberGlpkRows=numberRows+1; #ifdef COIN_HAS_GLPK if (cbc_glp_prob) { // from gmpl numberGlpkRows=glp_get_num_rows(cbc_glp_prob); if (numberGlpkRows!=numberRows) printf("Mismatch - cbc %d rows, glpk %d\n", numberRows,numberGlpkRows); } #endif fprintf(fp,"%d %d\n",numberGlpkRows, numberColumns); int iStat = models[iModel].status(); int iStat2 = GLP_UNDEF; if (iStat == 0) { // optimal iStat2 = GLP_FEAS; } else if (iStat == 1) { // infeasible iStat2 = GLP_NOFEAS; } else if (iStat == 2) { // unbounded // leave as 1 } else if (iStat >= 3 && iStat <= 5) { iStat2 = GLP_FEAS; } double objValue = models[iModel].getObjValue() * models[iModel].getObjSense(); fprintf(fp,"%d 2 %g\n",iStat2,objValue); if (numberGlpkRows > numberRows) { // objective as row fprintf(fp,"4 %g 1.0\n",objValue); } int lookup[6]= {4,1,3,2,4,5}; const double * primalRowSolution = models[iModel].primalRowSolution(); const double * dualRowSolution = models[iModel].dualRowSolution(); for (int i=0;iupper-1.0e-6) { numberAtUpper++; } else { numberBetween++; largestAway=CoinMax(largestAway, CoinMin(primal-lower,upper-primal)); } } printf("For rows %d at lower, %d between, %d at upper - lowest %g, highest %g most away %g - highest dual %g lowest %g\n", numberAtLower,numberBetween,numberAtUpper, lowestPrimal,highestPrimal,largestAway, lowestDual,highestDual); int numberColumns = models[iModel].numberColumns(); double * dualColumnSolution = models[iModel].dualColumnSolution(); double * primalColumnSolution = models[iModel].primalColumnSolution(); double * columnLower = models[iModel].columnLower(); double * columnUpper = models[iModel].columnUpper(); highestPrimal=-COIN_DBL_MAX; lowestPrimal=COIN_DBL_MAX; highestDual=-COIN_DBL_MAX; lowestDual=COIN_DBL_MAX; largestAway=0.0;; numberAtLower=0; numberAtUpper=0; numberBetween=0; for (int iColumn=0;iColumnupper-1.0e-6) { numberAtUpper++; } else { numberBetween++; largestAway=CoinMax(largestAway, CoinMin(primal-lower,upper-primal)); } } printf("For columns %d at lower, %d between, %d at upper - lowest %g, highest %g most away %g - highest dual %g lowest %g\n", numberAtLower,numberBetween,numberAtUpper, lowestPrimal,highestPrimal,largestAway, lowestDual,highestDual); break; } // make fancy later on int iRow; int numberRows = models[iModel].numberRows(); int lengthName = models[iModel].lengthNames(); // 0 if no names int lengthPrint = CoinMax(lengthName, 8); // in general I don't want to pass around massive // amounts of data but seems simpler here std::vector rowNames = *(models[iModel].rowNames()); std::vector columnNames = *(models[iModel].columnNames()); double * dualRowSolution = models[iModel].dualRowSolution(); double * primalRowSolution = models[iModel].primalRowSolution(); double * rowLower = models[iModel].rowLower(); double * rowUpper = models[iModel].rowUpper(); double primalTolerance = models[iModel].primalTolerance(); bool doMask = (printMask != "" && lengthName); int * maskStarts = NULL; int maxMasks = 0; char ** masks = NULL; if (doMask) { int nAst = 0; const char * pMask2 = printMask.c_str(); char pMask[100]; size_t lengthMask = strlen(pMask2); assert (lengthMask < 100); if (*pMask2 == '"') { if (pMask2[lengthMask-1] != '"') { printf("mismatched \" in mask %s\n", pMask2); break; } else { strcpy(pMask, pMask2 + 1); *strchr(pMask, '"') = '\0'; } } else if (*pMask2 == '\'') { if (pMask2[lengthMask-1] != '\'') { printf("mismatched ' in mask %s\n", pMask2); break; } else { strcpy(pMask, pMask2 + 1); *strchr(pMask, '\'') = '\0'; } } else { strcpy(pMask, pMask2); } if (lengthMask > static_cast(lengthName)) { printf("mask %s too long - skipping\n", pMask); break; } maxMasks = 1; for (size_t iChar = 0; iChar < lengthMask; iChar++) { if (pMask[iChar] == '*') { nAst++; maxMasks *= (lengthName + 1); } } int nEntries = 1; maskStarts = new int[lengthName+2]; masks = new char * [maxMasks]; char ** newMasks = new char * [maxMasks]; int i; for (i = 0; i < maxMasks; i++) { masks[i] = new char[lengthName+1]; newMasks[i] = new char[lengthName+1]; } strcpy(masks[0], pMask); for (int iAst = 0; iAst < nAst; iAst++) { int nOldEntries = nEntries; nEntries = 0; for (int iEntry = 0; iEntry < nOldEntries; iEntry++) { char * oldMask = masks[iEntry]; char * ast = strchr(oldMask, '*'); assert (ast); size_t length = strlen(oldMask) - 1; size_t nBefore = ast - oldMask; size_t nAfter = length - nBefore; // and add null nAfter++; for (size_t i = 0; i <= lengthName - length; i++) { char * maskOut = newMasks[nEntries]; CoinMemcpyN(oldMask, static_cast(nBefore), maskOut); for (size_t k = 0; k < i; k++) maskOut[k+nBefore] = '?'; CoinMemcpyN(ast + 1, static_cast(nAfter), maskOut + nBefore + i); nEntries++; assert (nEntries <= maxMasks); } } char ** temp = masks; masks = newMasks; newMasks = temp; } // Now extend and sort int * sort = new int[nEntries]; for (i = 0; i < nEntries; i++) { char * maskThis = masks[i]; size_t length = strlen(maskThis); while (length > 0 && maskThis[length-1] == ' ') length--; maskThis[length] = '\0'; sort[i] = static_cast(length); } CoinSort_2(sort, sort + nEntries, masks); int lastLength = -1; for (i = 0; i < nEntries; i++) { int length = sort[i]; while (length > lastLength) maskStarts[++lastLength] = i; } maskStarts[++lastLength] = nEntries; delete [] sort; for (i = 0; i < maxMasks; i++) delete [] newMasks[i]; delete [] newMasks; } if (printMode > 5) { int numberColumns = models[iModel].numberColumns(); // column length unless rhs ranging int number = numberColumns; switch (printMode) { // bound ranging case 6: fprintf(fp,"Bound ranging"); break; // rhs ranging case 7: fprintf(fp,"Rhs ranging"); number = numberRows; break; // objective ranging case 8: fprintf(fp,"Objective ranging"); break; } if (lengthName) fprintf(fp,",name"); fprintf(fp,",increase,variable,decrease,variable\n"); int * which = new int [ number]; if (printMode != 7) { if (!doMask) { for (int i = 0; i < number;i ++) which[i]=i; } else { int n = 0; for (int i = 0; i < number;i ++) { if (maskMatches(maskStarts,masks,columnNames[i])) which[n++]=i; } if (n) { number=n; } else { printf("No names match - doing all\n"); for (int i = 0; i < number;i ++) which[i]=i; } } } else { if (!doMask) { for (int i = 0; i < number;i ++) which[i]=i+numberColumns; } else { int n = 0; for (int i = 0; i < number;i ++) { if (maskMatches(maskStarts,masks,rowNames[i])) which[n++]=i+numberColumns; } if (n) { number=n; } else { printf("No names match - doing all\n"); for (int i = 0; i < number;i ++) which[i]=i+numberColumns; } } } double * valueIncrease = new double [ number]; int * sequenceIncrease = new int [ number]; double * valueDecrease = new double [ number]; int * sequenceDecrease = new int [ number]; switch (printMode) { // bound or rhs ranging case 6: case 7: models[iModel].primalRanging(numberRows, which, valueIncrease, sequenceIncrease, valueDecrease, sequenceDecrease); break; // objective ranging case 8: models[iModel].dualRanging(number, which, valueIncrease, sequenceIncrease, valueDecrease, sequenceDecrease); break; } for (int i = 0; i < number; i++) { int iWhich = which[i]; fprintf(fp, "%d,", (iWhich 2) { for (iRow = 0; iRow < numberRows; iRow++) { int type = printMode - 3; if (primalRowSolution[iRow] > rowUpper[iRow] + primalTolerance || primalRowSolution[iRow] < rowLower[iRow] - primalTolerance) { fprintf(fp, "** "); type = 2; } else if (fabs(primalRowSolution[iRow]) > 1.0e-8) { type = 1; } else if (numberRows < 50) { type = 3; } if (doMask && !maskMatches(maskStarts, masks, rowNames[iRow])) type = 0; if (type) { fprintf(fp, "%7d ", iRow); if (lengthName) { const char * name = rowNames[iRow].c_str(); size_t n = strlen(name); size_t i; for (i = 0; i < n; i++) fprintf(fp, "%c", name[i]); for (; i < static_cast(lengthPrint); i++) fprintf(fp, " "); } fprintf(fp, printFormat, primalRowSolution[iRow], dualRowSolution[iRow]); } } } int iColumn; int numberColumns = models[iModel].numberColumns(); double * dualColumnSolution = models[iModel].dualColumnSolution(); double * primalColumnSolution = models[iModel].primalColumnSolution(); double * columnLower = models[iModel].columnLower(); double * columnUpper = models[iModel].columnUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int type = (printMode > 3) ? 1 : 0; if (primalColumnSolution[iColumn] > columnUpper[iColumn] + primalTolerance || primalColumnSolution[iColumn] < columnLower[iColumn] - primalTolerance) { fprintf(fp, "** "); type = 2; } else if (fabs(primalColumnSolution[iColumn]) > 1.0e-8) { type = 1; } else if (numberColumns < 50) { type = 3; } if (doMask && !maskMatches(maskStarts, masks, columnNames[iColumn])) type = 0; if (type) { fprintf(fp, "%7d ", iColumn); if (lengthName) { const char * name = columnNames[iColumn].c_str(); size_t n = strlen(name); size_t i; for (i = 0; i < n; i++) fprintf(fp, "%c", name[i]); for (; i < static_cast(lengthPrint); i++) fprintf(fp, " "); } fprintf(fp, printFormat, primalColumnSolution[iColumn], dualColumnSolution[iColumn]); } } if (fp != stdout) fclose(fp); if (masks) { delete [] maskStarts; for (int i = 0; i < maxMasks; i++) delete [] masks[i]; delete [] masks; } } else { std::cout << "Unable to open file " << fileName << std::endl; } } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_SAVESOL: if (goodModels[iModel]) { // get next field field = CoinReadGetString(argc, argv); if (field == "$") { field = parameters[iParam].stringValue(); } else if (field == "EOL") { parameters[iParam].printString(); break; } else { parameters[iParam].setStringValue(field); } std::string fileName; if (field[0] == '/' || field[0] == '\\') { fileName = field; } else if (field[0] == '~') { char * environVar = getenv("HOME"); if (environVar) { std::string home(environVar); field = field.erase(0, 1); fileName = home + field; } else { fileName = field; } } else { fileName = directory + field; } saveSolution(models + iModel, fileName); } else { std::cout << "** Current model not valid" << std::endl; } break; case CLP_PARAM_ACTION_ENVIRONMENT: CbcOrClpEnvironmentIndex = 0; break; default: abort(); } } } else if (!numberMatches) { std::cout << "No match for " << field << " - ? for list of commands" << std::endl; } else if (numberMatches == 1) { if (!numberQuery) { std::cout << "Short match for " << field << " - completion: "; std::cout << parameters[firstMatch].matchName() << std::endl; } else if (numberQuery) { std::cout << parameters[firstMatch].matchName() << " : "; std::cout << parameters[firstMatch].shortHelp() << std::endl; if (numberQuery >= 2) parameters[firstMatch].printLongHelp(); } } else { if (!numberQuery) std::cout << "Multiple matches for " << field << " - possible completions:" << std::endl; else std::cout << "Completions of " << field << ":" << std::endl; for ( iParam = 0; iParam < numberParameters; iParam++ ) { int match = parameters[iParam].matches(field); if (match && parameters[iParam].displayThis()) { std::cout << parameters[iParam].matchName(); if (numberQuery >= 2) std::cout << " : " << parameters[iParam].shortHelp(); std::cout << std::endl; } } } } delete [] goodModels; #ifdef COIN_HAS_GLPK if (cbc_glp_prob) { // free up as much as possible glp_free(cbc_glp_prob); glp_mpl_free_wksp(cbc_glp_tran); glp_free_env(); cbc_glp_prob = NULL; cbc_glp_tran = NULL; } #endif // By now all memory should be freed #ifdef DMALLOC dmalloc_log_unfreed(); dmalloc_shutdown(); #endif #ifdef CLP_USEFUL_PRINTOUT printf("BENCHMARK_RESULT %s took %g cpu seconds (%g elapsed - %d iterations) - %d row, %d columns, %d elements - reduced to %d, %d, %d\n", mpsFile.c_str(),CoinCpuTime()-startCpu,CoinGetTimeOfDay()-startElapsed, debugInt[23], debugInt[0],debugInt[1],debugInt[2], debugInt[3],debugInt[4],debugInt[5]); const char * method[]={"","Dual","Primal","Sprint","Idiot"}; printf("BENCHMARK using method %s (%d)\n", method[debugInt[6]],debugInt[7]); #endif return 0; } static void breakdown(const char * name, int numberLook, const double * region) { double range[] = { -COIN_DBL_MAX, -1.0e15, -1.0e11, -1.0e8, -1.0e5, -1.0e4, -1.0e3, -1.0e2, -1.0e1, -1.0, -1.0e-1, -1.0e-2, -1.0e-3, -1.0e-4, -1.0e-5, -1.0e-8, -1.0e-11, -1.0e-15, 0.0, 1.0e-15, 1.0e-11, 1.0e-8, 1.0e-5, 1.0e-4, 1.0e-3, 1.0e-2, 1.0e-1, 1.0, 1.0e1, 1.0e2, 1.0e3, 1.0e4, 1.0e5, 1.0e8, 1.0e11, 1.0e15, COIN_DBL_MAX }; int nRanges = static_cast (sizeof(range) / sizeof(double)); int * number = new int[nRanges]; memset(number, 0, nRanges * sizeof(int)); int * numberExact = new int[nRanges]; memset(numberExact, 0, nRanges * sizeof(int)); int i; for ( i = 0; i < numberLook; i++) { double value = region[i]; for (int j = 0; j < nRanges; j++) { if (value == range[j]) { numberExact[j]++; break; } else if (value < range[j]) { number[j]++; break; } } } printf("\n%s has %d entries\n", name, numberLook); for (i = 0; i < nRanges; i++) { if (number[i]) printf("%d between %g and %g", number[i], range[i-1], range[i]); if (numberExact[i]) { if (number[i]) printf(", "); printf("%d exactly at %g", numberExact[i], range[i]); } if (number[i] + numberExact[i]) printf("\n"); } delete [] number; delete [] numberExact; } void sortOnOther(int * column, const CoinBigIndex * rowStart, int * order, int * other, int nRow, int nInRow, int where) { if (nRow < 2 || where >= nInRow) return; // do initial sort int kRow; int iRow; for ( kRow = 0; kRow < nRow; kRow++) { iRow = order[kRow]; other[kRow] = column[rowStart[iRow] + where]; } CoinSort_2(other, other + nRow, order); int first = 0; iRow = order[0]; int firstC = column[rowStart[iRow] + where]; kRow = 1; while (kRow < nRow) { int lastC = 9999999;; for (; kRow < nRow + 1; kRow++) { if (kRow < nRow) { iRow = order[kRow]; lastC = column[rowStart[iRow] + where]; } else { lastC = 9999999; } if (lastC > firstC) break; } // sort sortOnOther(column, rowStart, order + first, other, kRow - first, nInRow, where + 1); firstC = lastC; first = kRow; } } static void statistics(ClpSimplex * originalModel, ClpSimplex * model) { int numberColumns = originalModel->numberColumns(); const char * integerInformation = originalModel->integerInformation(); const double * columnLower = originalModel->columnLower(); const double * columnUpper = originalModel->columnUpper(); int numberIntegers = 0; int numberBinary = 0; int iRow, iColumn; if (integerInformation) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerInformation[iColumn]) { if (columnUpper[iColumn] > columnLower[iColumn]) { numberIntegers++; if (columnLower[iColumn] == 0.0 && columnUpper[iColumn] == 1) numberBinary++; } } } printf("Original problem has %d integers (%d of which binary)\n", numberIntegers,numberBinary); } numberColumns = model->numberColumns(); int numberRows = model->numberRows(); columnLower = model->columnLower(); columnUpper = model->columnUpper(); const double * rowLower = model->rowLower(); const double * rowUpper = model->rowUpper(); const double * objective = model->objective(); if (model->integerInformation()) { const char * integerInformation = model->integerInformation(); int numberIntegers = 0; int numberBinary = 0; double * obj = new double [numberColumns]; int * which = new int [numberColumns]; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn]) { if (integerInformation[iColumn]) { numberIntegers++; if (columnLower[iColumn] == 0.0 && columnUpper[iColumn] == 1) numberBinary++; } } } if(numberColumns != originalModel->numberColumns()) printf("Presolved problem has %d integers (%d of which binary)\n", numberIntegers,numberBinary); for (int ifInt=0;ifInt<2;ifInt++) { for (int ifAbs=0;ifAbs<2;ifAbs++) { int numberSort=0; int numberZero=0; int numberDifferentObj=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] > columnLower[iColumn]) { if (!ifInt||integerInformation[iColumn]) { obj[numberSort]=(ifAbs) ? fabs(objective[iColumn]) : objective[iColumn]; which[numberSort++]=iColumn; if (!objective[iColumn]) numberZero++; } } } CoinSort_2(obj,obj+numberSort,which); double last=obj[0]; for (int jColumn = 1; jColumn < numberSort; jColumn++) { if (fabs(obj[jColumn]-last)>1.0e-12) { numberDifferentObj++; last=obj[jColumn]; } } numberDifferentObj++; printf("==== "); if (ifInt) printf("for integers "); if (!ifAbs) printf("%d zero objective ",numberZero); else printf("absolute objective values "); printf("%d different\n",numberDifferentObj); bool saveModel=false; int target=model->logLevel(); if (target>10000) { if (ifInt&&!ifAbs) saveModel=true; target-=10000; } if (target<=100) target=12; else target-=100; if (numberDifferentObj1.0e-12) { printf("%d variables have objective of %g\n", jColumn-iLast,last); iLast=jColumn; last=obj[jColumn]; } } printf("%d variables have objective of %g\n", numberSort-iLast,last); if (saveModel) { int spaceNeeded=numberSort+numberDifferentObj; int * columnAdd = new int[spaceNeeded+numberDifferentObj+1]; double * elementAdd = new double[spaceNeeded]; int * rowAdd = new int[2*numberDifferentObj+1]; int * newIsInteger = rowAdd+numberDifferentObj+1; double * objectiveNew = new double[3*numberDifferentObj]; double * lowerNew = objectiveNew+numberDifferentObj; double * upperNew = lowerNew+numberDifferentObj; memset(columnAdd+spaceNeeded,0, (numberDifferentObj+1)*sizeof(int)); ClpSimplex tempModel=*model; int iLast=0; double last=obj[0]; numberDifferentObj=0; int numberElements=0; rowAdd[0]=0; double * objective = tempModel.objective(); for (int jColumn = 1; jColumn < numberSort+1; jColumn++) { if (jColumn==numberSort||fabs(obj[jColumn]-last)>1.0e-12) { // not if just one if (jColumn-iLast>1) { bool allInteger=integerInformation!=NULL; int iColumn=which[iLast]; objectiveNew[numberDifferentObj]=objective[iColumn]; double lower=0.0; double upper=0.0; for (int kColumn=iLast;kColumnproblemName(); if (ifInt) tempName += "_int"; if (ifAbs) tempName += "_abs"; tempName += ".mps"; tempModel.writeMps(tempName.c_str()); } } } } delete [] which; delete [] obj; printf("===== end objective counts\n"); } CoinPackedMatrix * matrix = model->matrix(); CoinBigIndex numberElements = matrix->getNumElements(); const int * columnLength = matrix->getVectorLengths(); //const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); int * number = new int[numberRows+1]; memset(number, 0, (numberRows + 1)*sizeof(int)); int numberObjSingletons = 0; /* cType 0 0/inf, 1 0/up, 2 lo/inf, 3 lo/up, 4 free, 5 fix, 6 -inf/0, 7 -inf/up, 8 0/1 */ int cType[9]; std::string cName[] = {"0.0->inf,", "0.0->up,", "lo->inf,", "lo->up,", "free,", "fixed,", "-inf->0.0,", "-inf->up,", "0.0->1.0" }; int nObjective = 0; memset(cType, 0, sizeof(cType)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; if (length == 1 && objective[iColumn]) numberObjSingletons++; number[length]++; if (objective[iColumn]) nObjective++; if (columnLower[iColumn] > -1.0e20) { if (columnLower[iColumn] == 0.0) { if (columnUpper[iColumn] > 1.0e20) cType[0]++; else if (columnUpper[iColumn] == 1.0) cType[8]++; else if (columnUpper[iColumn] == 0.0) cType[5]++; else cType[1]++; } else { if (columnUpper[iColumn] > 1.0e20) cType[2]++; else if (columnUpper[iColumn] == columnLower[iColumn]) cType[5]++; else cType[3]++; } } else { if (columnUpper[iColumn] > 1.0e20) cType[4]++; else if (columnUpper[iColumn] == 0.0) cType[6]++; else cType[7]++; } } /* rType 0 E 0, 1 E 1, 2 E -1, 3 E other, 4 G 0, 5 G 1, 6 G other, 7 L 0, 8 L 1, 9 L other, 10 Range 0/1, 11 Range other, 12 free */ int rType[13]; std::string rName[] = {"E 0.0,", "E 1.0,", "E -1.0,", "E other,", "G 0.0,", "G 1.0,", "G other,", "L 0.0,", "L 1.0,", "L other,", "Range 0.0->1.0,", "Range other,", "Free" }; memset(rType, 0, sizeof(rType)); for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow] > -1.0e20) { if (rowLower[iRow] == 0.0) { if (rowUpper[iRow] > 1.0e20) rType[4]++; else if (rowUpper[iRow] == 1.0) rType[10]++; else if (rowUpper[iRow] == 0.0) rType[0]++; else rType[11]++; } else if (rowLower[iRow] == 1.0) { if (rowUpper[iRow] > 1.0e20) rType[5]++; else if (rowUpper[iRow] == rowLower[iRow]) rType[1]++; else rType[11]++; } else if (rowLower[iRow] == -1.0) { if (rowUpper[iRow] > 1.0e20) rType[6]++; else if (rowUpper[iRow] == rowLower[iRow]) rType[2]++; else rType[11]++; } else { if (rowUpper[iRow] > 1.0e20) rType[6]++; else if (rowUpper[iRow] == rowLower[iRow]) rType[3]++; else rType[11]++; } } else { if (rowUpper[iRow] > 1.0e20) rType[12]++; else if (rowUpper[iRow] == 0.0) rType[7]++; else if (rowUpper[iRow] == 1.0) rType[8]++; else rType[9]++; } } // Basic statistics printf("\n\nProblem has %d rows, %d columns (%d with objective) and %d elements\n", numberRows, numberColumns, nObjective, numberElements); if (number[0] + number[1]) { printf("There are "); if (numberObjSingletons) printf("%d singletons with objective ", numberObjSingletons); int numberNoObj = number[1] - numberObjSingletons; if (numberNoObj) printf("%d singletons with no objective ", numberNoObj); if (number[0]) printf("** %d columns have no entries", number[0]); printf("\n"); } printf("Column breakdown:\n"); int k; for (k = 0; k < static_cast (sizeof(cType) / sizeof(int)); k++) { printf("%d of type %s ", cType[k], cName[k].c_str()); if (((k + 1) % 3) == 0) printf("\n"); } if ((k % 3) != 0) printf("\n"); printf("Row breakdown:\n"); for (k = 0; k < static_cast (sizeof(rType) / sizeof(int)); k++) { printf("%d of type %s ", rType[k], rName[k].c_str()); if (((k + 1) % 3) == 0) printf("\n"); } if ((k % 3) != 0) printf("\n"); //#define SYM #ifndef SYM if (model->logLevel() < 2) return ; #endif int kMax = model->logLevel() > 3 ? 1000000 : 10; k = 0; for (iRow = 1; iRow <= numberRows; iRow++) { if (number[iRow]) { k++; printf("%d columns have %d entries\n", number[iRow], iRow); if (k == kMax) break; } } if (k < numberRows) { int kk = k; k = 0; for (iRow = numberRows; iRow >= 1; iRow--) { if (number[iRow]) { k++; if (k == kMax) break; } } if (k > kk) { printf("\n .........\n\n"); iRow = k; k = 0; for (; iRow < numberRows; iRow++) { if (number[iRow]) { k++; printf("%d columns have %d entries\n", number[iRow], iRow); if (k == kMax) break; } } } } delete [] number; printf("\n\n"); if (model->logLevel() == 63 #ifdef SYM || true #endif ) { // get column copy CoinPackedMatrix columnCopy = *matrix; const int * columnLength = columnCopy.getVectorLengths(); number = new int[numberRows+1]; memset(number, 0, (numberRows + 1)*sizeof(int)); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; number[length]++; } k = 0; for (iRow = 1; iRow <= numberRows; iRow++) { if (number[iRow]) { k++; } } int * row = columnCopy.getMutableIndices(); const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); double * element = columnCopy.getMutableElements(); int * order = new int[numberColumns]; int * other = new int[numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; order[iColumn] = iColumn; other[iColumn] = length; CoinBigIndex start = columnStart[iColumn]; CoinSort_2(row + start, row + start + length, element + start); } CoinSort_2(other, other + numberColumns, order); int jColumn = number[0] + number[1]; for (iRow = 2; iRow <= numberRows; iRow++) { if (number[iRow]) { printf("XX %d columns have %d entries\n", number[iRow], iRow); int kColumn = jColumn + number[iRow]; sortOnOther(row, columnStart, order + jColumn, other, number[iRow], iRow, 0); // Now print etc if (iRow < 500000) { for (int lColumn = jColumn; lColumn < kColumn; lColumn++) { iColumn = order[lColumn]; CoinBigIndex start = columnStart[iColumn]; if (model->logLevel() == 63) { printf("column %d %g <= ", iColumn, columnLower[iColumn]); for (CoinBigIndex i = start; i < start + iRow; i++) printf("( %d, %g) ", row[i], element[i]); printf("<= %g\n", columnUpper[iColumn]); } } } jColumn = kColumn; } } delete [] order; delete [] other; delete [] number; } // get row copy CoinPackedMatrix rowCopy = *matrix; rowCopy.reverseOrdering(); const int * rowLength = rowCopy.getVectorLengths(); number = new int[numberColumns+1]; memset(number, 0, (numberColumns + 1)*sizeof(int)); if (model->logLevel() > 3) { // get column copy CoinPackedMatrix columnCopy = *matrix; const int * columnLength = columnCopy.getVectorLengths(); const int * row = columnCopy.getIndices(); const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); const double * element = columnCopy.getElements(); const double * elementByRow = rowCopy.getElements(); const int * rowStart = rowCopy.getVectorStarts(); const int * column = rowCopy.getIndices(); int nPossibleZeroCost=0; int nPossibleNonzeroCost=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; if (columnLower[iColumn]<-1.0e30&&columnUpper[iColumn]>1.0e30) { if (length==1) { printf("Singleton free %d - cost %g\n",iColumn,objective[iColumn]); } else if (length==2) { int iRow0=row[columnStart[iColumn]]; int iRow1=row[columnStart[iColumn]+1]; double element0=element[columnStart[iColumn]]; double element1=element[columnStart[iColumn]+1]; int n0=rowLength[iRow0]; int n1=rowLength[iRow1]; printf("Doubleton free %d - cost %g - %g in %srow with %d entries and %g in %srow with %d entries\n", iColumn,objective[iColumn],element0,(rowLower[iRow0]==rowUpper[iRow0]) ? "==" : "",n0, element1,(rowLower[iRow1]==rowUpper[iRow1]) ? "==" : "",n1); } } if (length==1) { int iRow=row[columnStart[iColumn]]; double value=COIN_DBL_MAX; for (int i=rowStart[iRow];ilogLevel() > 4) printf("Singleton %d with no objective in row with %d elements - rhs %g,%g\n",iColumn,rowLength[iRow],rowLower[iRow],rowUpper[iRow]); nPossibleZeroCost++; } else if (value!=-COIN_DBL_MAX) { if (model->logLevel() > 4) printf("Singleton %d (%s) with objective in row %d (%s) with %d equal elements - rhs %g,%g\n",iColumn,model->getColumnName(iColumn).c_str(), iRow,model->getRowName(iRow).c_str(), rowLength[iRow],rowLower[iRow],rowUpper[iRow]); nPossibleNonzeroCost++; } } } if (nPossibleZeroCost||nPossibleNonzeroCost) printf("%d singletons with zero cost, %d with valid cost\n", nPossibleZeroCost,nPossibleNonzeroCost); // look for DW int * blockStart = new int [3*(numberRows+numberColumns)+1]; int * columnBlock = blockStart+numberRows; int * nextColumn = columnBlock+numberColumns; int * blockCount = nextColumn+numberColumns; int * blockEls = blockCount+numberRows+1; int * countIntegers = blockEls+numberRows; memset(countIntegers,0,numberColumns*sizeof(int)); int direction[2]={-1,1}; int bestBreak=-1; double bestValue=0.0; int iPass=0; int halfway=(numberRows+1)/2; int firstMaster=-1; int lastMaster=-2; while (iPass<2) { int increment=direction[iPass]; int start= increment>0 ? 0 : numberRows-1; int stop=increment>0 ? numberRows : -1; int numberBlocks=0; int thisBestBreak=-1; double thisBestValue=COIN_DBL_MAX; int numberRowsDone=0; int numberMarkedColumns=0; int maximumBlockSize=0; for (int i=0;i=0) { // column marked if (iBlock<0) { // put row in that block iBlock=whichColumnBlock; } else if (iBlock!=whichColumnBlock) { // merge blockCount[iBlock]+=blockCount[whichColumnBlock]; blockCount[whichColumnBlock]=0; int jColumn=blockStart[whichColumnBlock]; while (jColumn>=0) { columnBlock[jColumn]=iBlock; iColumn=jColumn; jColumn=nextColumn[jColumn]; } nextColumn[iColumn]=blockStart[iBlock]; blockStart[iBlock]=blockStart[whichColumnBlock]; blockStart[whichColumnBlock]=-1; } } } int n=numberMarkedColumns; if (iBlock<0) { //new block if (rowLength[iRow]) { numberBlocks++; iBlock=numberBlocks; int jColumn=column[rowStart[iRow]]; columnBlock[jColumn]=iBlock; blockStart[iBlock]=jColumn; numberMarkedColumns++; for (CoinBigIndex j=rowStart[iRow]+1;j maximumBlockSize&&numberRowsDone>halfway) { thisBestBreak=iRow; thisBestValue=static_cast(maximumBlockSize)/ static_cast(numberRowsDone); } } if (thisBestBreak==stop) thisBestValue=COIN_DBL_MAX; iPass++; if (iPass==1) { bestBreak=thisBestBreak; bestValue=thisBestValue; } else { if (bestValue=0) { blockCount[iBlock]++; blockEls[iBlock]+=rowLength[iRow]; } else { if (iBlock==-2) numberMaster++; else numberEmpty++; } } int numberEmptyColumns=0; int numberMasterColumns=0; int numberMasterIntegers=0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { int iBlock=columnBlock[iColumn]; bool isInteger = (model->isInteger(iColumn)); if (iBlock>=0) { nextColumn[iBlock]++; if (isInteger) countIntegers[iBlock]++; } else { if (isInteger) numberMasterIntegers++; if (columnLength[iColumn]) numberMasterColumns++; else numberEmptyColumns++; } } int largestRows=0; int largestColumns=0; for (int i=0;ilargestRows+largestColumns) { largestRows=blockCount[i]; largestColumns=nextColumn[i]; } } bool useful=true; if (numberMaster>halfway||largestRows*3>numberRows) useful=false; printf("%s %d blocks (largest %d,%d), %d master rows (%d empty) out of %d, %d master columns (%d empty, %d integer) out of %d\n", useful ? "**Useful" : "NoGood", numberBlocks,largestRows,largestColumns,numberMaster,numberEmpty,numberRows, numberMasterColumns,numberEmptyColumns,numberMasterIntegers, numberColumns); for (int i=0;ilogLevel() == 17) { int * whichRows=new int[numberRows+numberColumns]; int * whichColumns=whichRows+numberRows; char name[20]; for (int iBlock=0;iBlockgetRowName(iRow); subset.setRowName(jRow,name); } for (int jColumn=0;jColumnisInteger(iColumn)) subset.setInteger(jColumn); std::string name = model->getColumnName(iColumn); subset.setColumnName(jColumn,name); } subset.writeMps(name,0,1); } delete [] whichRows; } } delete [] blockStart; } for (iRow = 0; iRow < numberRows; iRow++) { int length = rowLength[iRow]; number[length]++; } if (number[0]) printf("** %d rows have no entries\n", number[0]); k = 0; for (iColumn = 1; iColumn <= numberColumns; iColumn++) { if (number[iColumn]) { k++; printf("%d rows have %d entries\n", number[iColumn], iColumn); if (k == kMax) break; } } if (k < numberColumns) { int kk = k; k = 0; for (iColumn = numberColumns; iColumn >= 1; iColumn--) { if (number[iColumn]) { k++; if (k == kMax) break; } } if (k > kk) { printf("\n .........\n\n"); iColumn = k; k = 0; for (; iColumn < numberColumns; iColumn++) { if (number[iColumn]) { k++; printf("%d rows have %d entries\n", number[iColumn], iColumn); if (k == kMax) break; } } } } if (model->logLevel() == 63 #ifdef SYM || true #endif ) { int * column = rowCopy.getMutableIndices(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); double * element = rowCopy.getMutableElements(); int * order = new int[numberRows]; int * other = new int[numberRows]; for (iRow = 0; iRow < numberRows; iRow++) { int length = rowLength[iRow]; order[iRow] = iRow; other[iRow] = length; CoinBigIndex start = rowStart[iRow]; CoinSort_2(column + start, column + start + length, element + start); } CoinSort_2(other, other + numberRows, order); int jRow = number[0] + number[1]; double * weight = new double[numberRows]; double * randomColumn = new double[numberColumns+1]; double * randomRow = new double [numberRows+1]; int * sortRow = new int [numberRows]; int * possibleRow = new int [numberRows]; int * backRow = new int [numberRows]; int * stackRow = new int [numberRows]; int * sortColumn = new int [numberColumns]; int * possibleColumn = new int [numberColumns]; int * backColumn = new int [numberColumns]; int * backColumn2 = new int [numberColumns]; int * mapRow = new int [numberRows]; int * mapColumn = new int [numberColumns]; int * stackColumn = new int [numberColumns]; double randomLower = CoinDrand48(); double randomUpper = CoinDrand48(); double randomInteger = CoinDrand48(); int * startAdd = new int[numberRows+1]; int * columnAdd = new int [2*numberElements]; double * elementAdd = new double[2*numberElements]; int nAddRows = 0; startAdd[0] = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { randomColumn[iColumn] = CoinDrand48(); backColumn2[iColumn] = -1; } for (iColumn = 2; iColumn <= numberColumns; iColumn++) { if (number[iColumn]) { printf("XX %d rows have %d entries\n", number[iColumn], iColumn); int kRow = jRow + number[iColumn]; sortOnOther(column, rowStart, order + jRow, other, number[iColumn], iColumn, 0); // Now print etc if (iColumn < 500000) { int nLook = 0; for (int lRow = jRow; lRow < kRow; lRow++) { iRow = order[lRow]; CoinBigIndex start = rowStart[iRow]; if (model->logLevel() == 63) { printf("row %d %g <= ", iRow, rowLower[iRow]); for (CoinBigIndex i = start; i < start + iColumn; i++) printf("( %d, %g) ", column[i], element[i]); printf("<= %g\n", rowUpper[iRow]); } int first = column[start]; double sum = 0.0; for (CoinBigIndex i = start; i < start + iColumn; i++) { int jColumn = column[i]; double value = element[i]; jColumn -= first; assert (jColumn >= 0); sum += value * randomColumn[jColumn]; } if (rowLower[iRow] > -1.0e30 && rowLower[iRow]) sum += rowLower[iRow] * randomLower; else if (!rowLower[iRow]) sum += 1.234567e-7 * randomLower; if (rowUpper[iRow] < 1.0e30 && rowUpper[iRow]) sum += rowUpper[iRow] * randomUpper; else if (!rowUpper[iRow]) sum += 1.234567e-7 * randomUpper; sortRow[nLook] = iRow; randomRow[nLook++] = sum; // best way is to number unique elements and bounds and use if (fabs(sum) > 1.0e4) sum *= 1.0e-6; weight[iRow] = sum; } assert (nLook <= numberRows); CoinSort_2(randomRow, randomRow + nLook, sortRow); randomRow[nLook] = COIN_DBL_MAX; double last = -COIN_DBL_MAX; int iLast = -1; for (int iLook = 0; iLook < nLook + 1; iLook++) { if (randomRow[iLook] > last) { if (iLast >= 0) { int n = iLook - iLast; if (n > 1) { //printf("%d rows possible?\n",n); } } iLast = iLook; last = randomRow[iLook]; } } } jRow = kRow; } } CoinPackedMatrix columnCopy = *matrix; const int * columnLength = columnCopy.getVectorLengths(); const int * row = columnCopy.getIndices(); const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); const double * elementByColumn = columnCopy.getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; CoinBigIndex start = columnStart[iColumn]; double sum = objective[iColumn]; if (columnLower[iColumn] > -1.0e30 && columnLower[iColumn]) sum += columnLower[iColumn] * randomLower; else if (!columnLower[iColumn]) sum += 1.234567e-7 * randomLower; if (columnUpper[iColumn] < 1.0e30 && columnUpper[iColumn]) sum += columnUpper[iColumn] * randomUpper; else if (!columnUpper[iColumn]) sum += 1.234567e-7 * randomUpper; if (model->isInteger(iColumn)) sum += 9.87654321e-6 * randomInteger; for (CoinBigIndex i = start; i < start + length; i++) { int iRow = row[i]; sum += elementByColumn[i] * weight[iRow]; } sortColumn[iColumn] = iColumn; randomColumn[iColumn] = sum; } { CoinSort_2(randomColumn, randomColumn + numberColumns, sortColumn); for (iColumn = 0; iColumn < numberColumns; iColumn++) { int i = sortColumn[iColumn]; backColumn[i] = iColumn; } randomColumn[numberColumns] = COIN_DBL_MAX; double last = -COIN_DBL_MAX; int iLast = -1; for (int iLook = 0; iLook < numberColumns + 1; iLook++) { if (randomColumn[iLook] > last) { if (iLast >= 0) { int n = iLook - iLast; if (n > 1) { //printf("%d columns possible?\n",n); } for (int i = iLast; i < iLook; i++) { possibleColumn[sortColumn[i]] = n; } } iLast = iLook; last = randomColumn[iLook]; } } for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex start = rowStart[iRow]; double sum = 0.0; int length = rowLength[iRow]; for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; double value = element[i]; jColumn = backColumn[jColumn]; sum += value * randomColumn[jColumn]; //if (iColumn==23089||iRow==23729) //printf("row %d cola %d colb %d value %g rand %g sum %g\n", // iRow,jColumn,column[i],value,randomColumn[jColumn],sum); } sortRow[iRow] = iRow; randomRow[iRow] = weight[iRow]; randomRow[iRow] = sum; } CoinSort_2(randomRow, randomRow + numberRows, sortRow); for (iRow = 0; iRow < numberRows; iRow++) { int i = sortRow[iRow]; backRow[i] = iRow; } randomRow[numberRows] = COIN_DBL_MAX; last = -COIN_DBL_MAX; iLast = -1; // Do backward indices from order for (iRow = 0; iRow < numberRows; iRow++) { other[order[iRow]] = iRow; } for (int iLook = 0; iLook < numberRows + 1; iLook++) { if (randomRow[iLook] > last) { if (iLast >= 0) { int n = iLook - iLast; if (n > 1) { //printf("%d rows possible?\n",n); // Within group sort as for original "order" for (int i = iLast; i < iLook; i++) { int jRow = sortRow[i]; order[i] = other[jRow]; } CoinSort_2(order + iLast, order + iLook, sortRow + iLast); } for (int i = iLast; i < iLook; i++) { possibleRow[sortRow[i]] = n; } } iLast = iLook; last = randomRow[iLook]; } } // Temp out for (int iLook = 0; iLook < numberRows - 1000000; iLook++) { iRow = sortRow[iLook]; CoinBigIndex start = rowStart[iRow]; int length = rowLength[iRow]; int numberPossible = possibleRow[iRow]; for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; if (possibleColumn[jColumn] != numberPossible) numberPossible = -1; } int n = numberPossible; if (numberPossible > 1) { //printf("pppppossible %d\n",numberPossible); for (int jLook = iLook + 1; jLook < iLook + numberPossible; jLook++) { int jRow = sortRow[jLook]; CoinBigIndex start2 = rowStart[jRow]; assert (numberPossible == possibleRow[jRow]); assert(length == rowLength[jRow]); for (CoinBigIndex i = start2; i < start2 + length; i++) { int jColumn = column[i]; if (possibleColumn[jColumn] != numberPossible) numberPossible = -1; } } if (numberPossible < 2) { // switch off for (int jLook = iLook; jLook < iLook + n; jLook++) possibleRow[sortRow[jLook]] = -1; } // skip rest iLook += n - 1; } else { possibleRow[iRow] = -1; } } for (int iLook = 0; iLook < numberRows; iLook++) { iRow = sortRow[iLook]; int numberPossible = possibleRow[iRow]; // Only if any integers int numberIntegers = 0; CoinBigIndex start = rowStart[iRow]; int length = rowLength[iRow]; for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; if (model->isInteger(jColumn)) numberIntegers++; } if (numberPossible > 1 && !numberIntegers) { //printf("possible %d - but no integers\n",numberPossible); } if (numberPossible > 1 && (numberIntegers || false)) { // printf("possible %d - %d integers\n", numberPossible, numberIntegers); int lastLook = iLook; int nMapRow = -1; for (int jLook = iLook + 1; jLook < iLook + numberPossible; jLook++) { // stop if too many failures if (jLook > iLook + 10 && nMapRow < 0) break; // Create identity mapping int i; for (i = 0; i < numberRows; i++) mapRow[i] = i; for (i = 0; i < numberColumns; i++) mapColumn[i] = i; int offset = jLook - iLook; int nStackC = 0; // build up row and column mapping int nStackR = 1; stackRow[0] = iLook; bool good = true; while (nStackR) { nStackR--; int look1 = stackRow[nStackR]; int look2 = look1 + offset; assert (randomRow[look1] == randomRow[look2]); int row1 = sortRow[look1]; int row2 = sortRow[look2]; assert (mapRow[row1] == row1); assert (mapRow[row2] == row2); mapRow[row1] = row2; mapRow[row2] = row1; CoinBigIndex start1 = rowStart[row1]; CoinBigIndex offset2 = rowStart[row2] - start1; int length = rowLength[row1]; assert( length == rowLength[row2]); for (CoinBigIndex i = start1; i < start1 + length; i++) { int jColumn1 = column[i]; int jColumn2 = column[i+offset2]; if (randomColumn[backColumn[jColumn1]] != randomColumn[backColumn[jColumn2]]) { good = false; break; } if (mapColumn[jColumn1] == jColumn1) { // not touched assert (mapColumn[jColumn2] == jColumn2); if (jColumn1 != jColumn2) { // Put on stack mapColumn[jColumn1] = jColumn2; mapColumn[jColumn2] = jColumn1; stackColumn[nStackC++] = jColumn1; } } else { if (mapColumn[jColumn1] != jColumn2 || mapColumn[jColumn2] != jColumn1) { // bad good = false; printf("bad col\n"); break; } } } if (!good) break; while (nStackC) { nStackC--; int iColumn = stackColumn[nStackC]; int iColumn2 = mapColumn[iColumn]; assert (iColumn != iColumn2); int length = columnLength[iColumn]; assert (length == columnLength[iColumn2]); CoinBigIndex start = columnStart[iColumn]; CoinBigIndex offset2 = columnStart[iColumn2] - start; for (CoinBigIndex i = start; i < start + length; i++) { int iRow = row[i]; int iRow2 = row[i+offset2]; if (mapRow[iRow] == iRow) { // First (but be careful) if (iRow != iRow2) { //mapRow[iRow]=iRow2; //mapRow[iRow2]=iRow; int iBack = backRow[iRow]; int iBack2 = backRow[iRow2]; if (randomRow[iBack] == randomRow[iBack2] && iBack2 - iBack == offset) { stackRow[nStackR++] = iBack; } else { //printf("randomRow diff - weights %g %g\n", // weight[iRow],weight[iRow2]); // bad good = false; break; } } } else { if (mapRow[iRow] != iRow2 || mapRow[iRow2] != iRow) { // bad good = false; printf("bad row\n"); break; } } } if (!good) break; } } // then check OK if (good) { for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex start = rowStart[iRow]; int length = rowLength[iRow]; if (mapRow[iRow] == iRow) { for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; backColumn2[jColumn] = i - start; } for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; if (mapColumn[jColumn] != jColumn) { int jColumn2 = mapColumn[jColumn]; CoinBigIndex i2 = backColumn2[jColumn2]; if (i2 < 0) { good = false; } else if (element[i] != element[i2+start]) { good = false; } } } for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; backColumn2[jColumn] = -1; } } else { int row2 = mapRow[iRow]; assert (iRow = mapRow[row2]); if (rowLower[iRow] != rowLower[row2] || rowLower[row2] != rowLower[iRow]) good = false; CoinBigIndex offset2 = rowStart[row2] - start; for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; double value = element[i]; int jColumn2 = column[i+offset2]; double value2 = element[i+offset2]; if (value != value2 || mapColumn[jColumn] != jColumn2 || mapColumn[jColumn2] != jColumn) good = false; } } } if (good) { // check rim for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (mapColumn[iColumn] != iColumn) { int iColumn2 = mapColumn[iColumn]; if (objective[iColumn] != objective[iColumn2]) good = false; if (columnLower[iColumn] != columnLower[iColumn2]) good = false; if (columnUpper[iColumn] != columnUpper[iColumn2]) good = false; if (model->isInteger(iColumn) != model->isInteger(iColumn2)) good = false; } } } if (good) { // temp if (nMapRow < 0) { //const double * solution = model->primalColumnSolution(); // find mapped int nMapColumn = 0; for (int i = 0; i < numberColumns; i++) { if (mapColumn[i] > i) nMapColumn++; } nMapRow = 0; int kRow = -1; for (int i = 0; i < numberRows; i++) { if (mapRow[i] > i) { nMapRow++; kRow = i; } } printf("%d columns, %d rows\n", nMapColumn, nMapRow); if (nMapRow == 1) { CoinBigIndex start = rowStart[kRow]; int length = rowLength[kRow]; printf("%g <= ", rowLower[kRow]); for (CoinBigIndex i = start; i < start + length; i++) { int jColumn = column[i]; if (mapColumn[jColumn] != jColumn) printf("* "); printf("%d,%g ", jColumn, element[i]); } printf("<= %g\n", rowUpper[kRow]); } } // temp int row1 = sortRow[lastLook]; int row2 = sortRow[jLook]; lastLook = jLook; CoinBigIndex start1 = rowStart[row1]; CoinBigIndex offset2 = rowStart[row2] - start1; int length = rowLength[row1]; assert( length == rowLength[row2]); CoinBigIndex put = startAdd[nAddRows]; double multiplier = length < 11 ? 2.0 : 1.125; double value = 1.0; for (CoinBigIndex i = start1; i < start1 + length; i++) { int jColumn1 = column[i]; int jColumn2 = column[i+offset2]; columnAdd[put] = jColumn1; elementAdd[put++] = value; columnAdd[put] = jColumn2; elementAdd[put++] = -value; value *= multiplier; } nAddRows++; startAdd[nAddRows] = put; } else { printf("ouch - did not check out as good\n"); } } } // skip rest iLook += numberPossible - 1; } } } if (nAddRows) { double * lower = new double [nAddRows]; double * upper = new double[nAddRows]; int i; //const double * solution = model->primalColumnSolution(); for (i = 0; i < nAddRows; i++) { lower[i] = 0.0; upper[i] = COIN_DBL_MAX; } printf("Adding %d rows with %d elements\n", nAddRows, startAdd[nAddRows]); //ClpSimplex newModel(*model); //newModel.addRows(nAddRows,lower,upper,startAdd,columnAdd,elementAdd); //newModel.writeMps("modified.mps"); delete [] lower; delete [] upper; } delete [] startAdd; delete [] columnAdd; delete [] elementAdd; delete [] order; delete [] other; delete [] randomColumn; delete [] weight; delete [] randomRow; delete [] sortRow; delete [] backRow; delete [] possibleRow; delete [] sortColumn; delete [] backColumn; delete [] backColumn2; delete [] possibleColumn; delete [] mapRow; delete [] mapColumn; delete [] stackRow; delete [] stackColumn; } delete [] number; // Now do breakdown of ranges breakdown("Elements", numberElements, elementByColumn); breakdown("RowLower", numberRows, rowLower); breakdown("RowUpper", numberRows, rowUpper); breakdown("ColumnLower", numberColumns, columnLower); breakdown("ColumnUpper", numberColumns, columnUpper); breakdown("Objective", numberColumns, objective); // do integer objective double * obj = CoinCopyOfArray(objective,numberColumns); int n=0; //#define FIX_COSTS 1.0 #ifdef FIX_COSTS double * obj2 = originalModel->objective(); double * upper2 = originalModel->columnUpper(); #endif for (int i=0;iFIX_COSTS) upper2[i]=0.0; #endif } } if (n) { breakdown("Integer objective", n, obj); } } static bool maskMatches(const int * starts, char ** masks, std::string & check) { // back to char as I am old fashioned const char * checkC = check.c_str(); size_t length = strlen(checkC); while (checkC[length-1] == ' ') length--; for (int i = starts[length]; i < starts[length+1]; i++) { char * thisMask = masks[i]; size_t k; for ( k = 0; k < length; k++) { if (thisMask[k] != '?' && thisMask[k] != checkC[k]) break; } if (k == length) return true; } return false; } static void clean(char * temp) { char * put = temp; while (*put >= ' ') put++; *put = '\0'; } static void generateCode(const char * fileName, int type) { FILE * fp = fopen(fileName, "r"); assert (fp); int numberLines = 0; #define MAXLINES 500 #define MAXONELINE 200 char line[MAXLINES][MAXONELINE]; while (fgets(line[numberLines], MAXONELINE, fp)) { assert (numberLines < MAXLINES); clean(line[numberLines]); numberLines++; } fclose(fp); // add in actual solve strcpy(line[numberLines], "5 clpModel->initialSolve(clpSolve);"); numberLines++; fp = fopen(fileName, "w"); assert (fp); char apo = '"'; char backslash = '\\'; fprintf(fp, "#include %cClpSimplex.hpp%c\n", apo, apo); fprintf(fp, "#include %cClpSolve.hpp%c\n", apo, apo); fprintf(fp, "\nint main (int argc, const char *argv[])\n{\n"); fprintf(fp, " ClpSimplex model;\n"); fprintf(fp, " int status=1;\n"); fprintf(fp, " if (argc<2)\n"); fprintf(fp, " fprintf(stderr,%cPlease give file name%cn%c);\n", apo, backslash, apo); fprintf(fp, " else\n"); fprintf(fp, " status=model.readMps(argv[1],true);\n"); fprintf(fp, " if (status) {\n"); fprintf(fp, " fprintf(stderr,%cBad readMps %%s%cn%c,argv[1]);\n", apo, backslash, apo); fprintf(fp, " exit(1);\n"); fprintf(fp, " }\n\n"); fprintf(fp, " // Now do requested saves and modifications\n"); fprintf(fp, " ClpSimplex * clpModel = & model;\n"); int wanted[9]; memset(wanted, 0, sizeof(wanted)); wanted[0] = wanted[3] = wanted[5] = wanted[8] = 1; if (type > 0) wanted[1] = wanted[6] = 1; if (type > 1) wanted[2] = wanted[4] = wanted[7] = 1; std::string header[9] = { "", "Save values", "Redundant save of default values", "Set changed values", "Redundant set default values", "Solve", "Restore values", "Redundant restore values", "Add to model" }; for (int iType = 0; iType < 9; iType++) { if (!wanted[iType]) continue; int n = 0; int iLine; for (iLine = 0; iLine < numberLines; iLine++) { if (line[iLine][0] == '0' + iType) { if (!n) fprintf(fp, "\n // %s\n\n", header[iType].c_str()); n++; fprintf(fp, "%s\n", line[iLine] + 1); } } } fprintf(fp, "\n // Now you would use solution etc etc\n\n"); fprintf(fp, " return 0;\n}\n"); fclose(fp); printf("C++ file written to %s\n", fileName); } CoinMP-1.8.3/Clp/src/ClpLinearObjective.cpp0000644000175000017500000002276611510657452017054 0ustar renerene/* $Id: ClpLinearObjective.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "ClpFactorization.hpp" #include "ClpSimplex.hpp" #include "ClpLinearObjective.hpp" #include "CoinHelperFunctions.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpLinearObjective::ClpLinearObjective () : ClpObjective() { type_ = 1; objective_ = NULL; numberColumns_ = 0; } //------------------------------------------------------------------- // Useful Constructor //------------------------------------------------------------------- ClpLinearObjective::ClpLinearObjective (const double * objective , int numberColumns) : ClpObjective() { type_ = 1; numberColumns_ = numberColumns; objective_ = CoinCopyOfArray(objective, numberColumns_, 0.0); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpLinearObjective::ClpLinearObjective (const ClpLinearObjective & rhs) : ClpObjective(rhs) { numberColumns_ = rhs.numberColumns_; objective_ = CoinCopyOfArray(rhs.objective_, numberColumns_); } /* Subset constructor. Duplicates are allowed and order is as given. */ ClpLinearObjective::ClpLinearObjective (const ClpLinearObjective &rhs, int numberColumns, const int * whichColumn) : ClpObjective(rhs) { objective_ = NULL; numberColumns_ = 0; if (numberColumns > 0) { // check valid lists int numberBad = 0; int i; for (i = 0; i < numberColumns; i++) if (whichColumn[i] < 0 || whichColumn[i] >= rhs.numberColumns_) numberBad++; if (numberBad) throw CoinError("bad column list", "subset constructor", "ClpLinearObjective"); numberColumns_ = numberColumns; objective_ = new double[numberColumns_]; for (i = 0; i < numberColumns_; i++) objective_[i] = rhs.objective_[whichColumn[i]]; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpLinearObjective::~ClpLinearObjective () { delete [] objective_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpLinearObjective & ClpLinearObjective::operator=(const ClpLinearObjective& rhs) { if (this != &rhs) { ClpObjective::operator=(rhs); numberColumns_ = rhs.numberColumns_; delete [] objective_; objective_ = CoinCopyOfArray(rhs.objective_, numberColumns_); } return *this; } // Returns gradient double * ClpLinearObjective::gradient(const ClpSimplex * /*model*/, const double * /*solution*/, double & offset, bool /*refresh*/, int /*includeLinear*/) { // not sure what to do about scaling //assert (!model); //assert (includeLinear==2); //otherwise need to return all zeros offset = 0.0; return objective_; } /* Returns reduced gradient.Returns an offset (to be added to current one). */ double ClpLinearObjective::reducedGradient(ClpSimplex * model, double * region, bool /*useFeasibleCosts*/) { int numberRows = model->numberRows(); //work space CoinIndexedVector * workSpace = model->rowArray(0); CoinIndexedVector arrayVector; arrayVector.reserve(numberRows + 1); int iRow; #ifdef CLP_DEBUG workSpace->checkClear(); #endif double * array = arrayVector.denseVector(); int * index = arrayVector.getIndices(); int number = 0; const double * cost = model->costRegion(); //assert (!useFeasibleCosts); const int * pivotVariable = model->pivotVariable(); for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; double value = cost[iPivot]; if (value) { array[iRow] = value; index[number++] = iRow; } } arrayVector.setNumElements(number); int numberColumns = model->numberColumns(); // Btran basic costs double * work = workSpace->denseVector(); model->factorization()->updateColumnTranspose(workSpace, &arrayVector); ClpFillN(work, numberRows, 0.0); // now look at dual solution double * rowReducedCost = region + numberColumns; double * dual = rowReducedCost; double * rowCost = model->costRegion(0); for (iRow = 0; iRow < numberRows; iRow++) { dual[iRow] = array[iRow]; } double * dj = region; ClpDisjointCopyN(model->costRegion(1), numberColumns, dj); model->transposeTimes(-1.0, dual, dj); for (iRow = 0; iRow < numberRows; iRow++) { // slack double value = dual[iRow]; value += rowCost[iRow]; rowReducedCost[iRow] = value; } return 0.0; } /* Returns step length which gives minimum of objective for solution + theta * change vector up to maximum theta. arrays are numberColumns+numberRows */ double ClpLinearObjective::stepLength(ClpSimplex * model, const double * solution, const double * change, double maximumTheta, double & currentObj, double & predictedObj, double & thetaObj) { const double * cost = model->costRegion(); double delta = 0.0; int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); currentObj = 0.0; thetaObj = 0.0; for (int iColumn = 0; iColumn < numberColumns + numberRows; iColumn++) { delta += cost[iColumn] * change[iColumn]; currentObj += cost[iColumn] * solution[iColumn]; } thetaObj = currentObj + delta * maximumTheta; predictedObj = currentObj + delta * maximumTheta; if (delta < 0.0) { return maximumTheta; } else { printf("odd linear direction %g\n", delta); return 0.0; } } // Return objective value (without any ClpModel offset) (model may be NULL) double ClpLinearObjective::objectiveValue(const ClpSimplex * model, const double * solution) const { const double * cost = objective_; if (model && model->costRegion()) cost = model->costRegion(); double currentObj = 0.0; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { currentObj += cost[iColumn] * solution[iColumn]; } return currentObj; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpObjective * ClpLinearObjective::clone() const { return new ClpLinearObjective(*this); } /* Subset clone. Duplicates are allowed and order is as given. */ ClpObjective * ClpLinearObjective::subsetClone (int numberColumns, const int * whichColumns) const { return new ClpLinearObjective(*this, numberColumns, whichColumns); } // Resize objective void ClpLinearObjective::resize(int newNumberColumns) { if (numberColumns_ != newNumberColumns) { int i; double * newArray = new double[newNumberColumns]; if (objective_) CoinMemcpyN(objective_, CoinMin(newNumberColumns, numberColumns_), newArray); delete [] objective_; objective_ = newArray; for (i = numberColumns_; i < newNumberColumns; i++) objective_[i] = 0.0; numberColumns_ = newNumberColumns; } } // Delete columns in objective void ClpLinearObjective::deleteSome(int numberToDelete, const int * which) { if (objective_) { int i ; char * deleted = new char[numberColumns_]; int numberDeleted = 0; CoinZeroN(deleted, numberColumns_); for (i = 0; i < numberToDelete; i++) { int j = which[i]; if (j >= 0 && j < numberColumns_ && !deleted[j]) { numberDeleted++; deleted[j] = 1; } } int newNumberColumns = numberColumns_ - numberDeleted; double * newArray = new double[newNumberColumns]; int put = 0; for (i = 0; i < numberColumns_; i++) { if (!deleted[i]) { newArray[put++] = objective_[i]; } } delete [] objective_; objective_ = newArray; delete [] deleted; numberColumns_ = newNumberColumns; } } // Scale objective void ClpLinearObjective::reallyScale(const double * columnScale) { for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { objective_[iColumn] *= columnScale[iColumn]; } } CoinMP-1.8.3/Clp/src/CoinAbcBaseFactorization.hpp0000644000175000017500000012156212101105055020155 0ustar renerene/* $Id: CoinAbcBaseFactorization.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ /** This deals with Factorization and Updates I am assuming that 32 bits is enough for number of rows or columns, but CoinBigIndex may be redefined to get 64 bits. */ #include "AbcCommon.hpp" #include "CoinAbcHelperFunctions.hpp" #if ABC_PARALLEL #define FACTOR_CPU 4 #else #define FACTOR_CPU 1 #endif #define LARGE_SET COIN_INT_MAX-10 #define LARGE_UNSET (LARGE_SET+1) class CoinAbcTypeFactorization : public CoinAbcAnyFactorization { friend void CoinAbcFactorizationUnitTest( const std::string & mpsDir ); public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor CoinAbcTypeFactorization ( ); /// Copy constructor CoinAbcTypeFactorization ( const CoinAbcTypeFactorization &other); /// Copy constructor CoinAbcTypeFactorization ( const CoinFactorization &other); /// Destructor virtual ~CoinAbcTypeFactorization ( ); /// Clone virtual CoinAbcAnyFactorization * clone() const ; /// Delete all stuff (leaves as after CoinAbcFactorization()) void almostDestructor(); /// Debug show object (shows one representation) void show_self ( ) const; /// Debug - sort so can compare void sort ( ) const; /// = copy CoinAbcTypeFactorization & operator = ( const CoinAbcTypeFactorization & other ); //@} /**@name Do factorization */ //@{ /// Condition number - product of pivots after factorization CoinSimplexDouble conditionNumber() const; //@} /**@name general stuff such as permutation or status */ //@{ /// Returns address of permute region inline CoinSimplexInt *permute ( ) const { return NULL; //permute_.array(); } /// Returns array to put basis indices in virtual inline CoinSimplexInt * indices() const { return indexRowU_.array();} /// Returns address of pivotColumn region (also used for permuting) virtual inline CoinSimplexInt *pivotColumn ( ) const { return pivotColumn_.array(); } /// Returns address of pivot region virtual inline CoinFactorizationDouble *pivotRegion ( ) const { return pivotRegionAddress_; } #if ABC_SMALL<2 /// Start of each row in L inline CoinBigIndex * startRowL() const { return startRowL_.array();} #endif /// Start of each column in L inline CoinBigIndex * startColumnL() const { return startColumnL_.array();} #if ABC_SMALL<2 /// Index of column in row for L inline CoinSimplexInt * indexColumnL() const { return indexColumnL_.array();} #endif /// Row indices of L inline CoinSimplexInt * indexRowL() const { return indexRowL_.array();} #if ABC_SMALL<2 /// Elements in L (row copy) inline CoinFactorizationDouble * elementByRowL() const { return elementByRowL_.array();} #endif /** Forward and backward linked lists (numberRows_+2) **/ inline CoinSimplexInt * pivotLinkedBackwards() const { return firstCount_.array()+numberRows_+1;} inline CoinSimplexInt * pivotLinkedForwards() const { return firstCount_.array()+2*numberRows_+3;} inline CoinSimplexInt * pivotLOrder() const { return firstCount_.array();} #if ABC_SMALL<0 #define ABC_USE_FUNCTION_POINTERS 0 #define SMALL_PERMUTE #endif #ifdef ABC_USE_FUNCTION_POINTERS typedef void (*scatterUpdate) (int,CoinFactorizationDouble,const CoinFactorizationDouble *, CoinFactorizationDouble *); #if ABC_USE_FUNCTION_POINTERS typedef struct { scatterUpdate functionPointer; CoinBigIndex offset; int number; } scatterStruct; #else typedef struct { CoinBigIndex offset; int number; } scatterStruct; #endif /// Array of function pointers PLUS for U Column inline scatterStruct * scatterUColumn() const { return scatterPointersUColumnAddress_;} #endif /// For equal counts in factorization /** First Row/Column with count of k, can tell which by offset - Rows then Columns actually comes before nextCount*/ inline CoinSimplexInt * firstCount() const { return firstCount_.array();} /// Next Row/Column with count inline CoinSimplexInt * nextCount() const { return firstCount_.array()+numberRows_+2;} /// Previous Row/Column with count inline CoinSimplexInt * lastCount() const { return firstCount_.array()+3*numberRows_+2;} /// Number of Rows after iterating inline CoinSimplexInt numberRowsExtra ( ) const { return numberRowsExtra_; } /// Number in L inline CoinBigIndex numberL() const { return numberL_;} /// Base of L inline CoinBigIndex baseL() const { return baseL_;} /// Maximum of Rows after iterating inline CoinSimplexInt maximumRowsExtra ( ) const { return maximumRowsExtra_; } /// Total number of elements in factorization virtual inline CoinBigIndex numberElements ( ) const { return totalElements_; } /// Length of FT vector inline CoinSimplexInt numberForrestTomlin ( ) const { return numberInColumn_.array()[numberRowsExtra_]; } /// Returns areaFactor but adjusted for dense CoinSimplexDouble adjustedAreaFactor() const; /// Level of detail of messages inline CoinSimplexInt messageLevel ( ) const { return messageLevel_ ; } void messageLevel ( CoinSimplexInt value ); /// Set maximum pivots virtual void maximumPivots ( CoinSimplexInt value ); #if ABC_SMALL<4 /// Gets dense threshold inline CoinSimplexInt denseThreshold() const { return denseThreshold_;} /// Sets dense threshold inline void setDenseThreshold(CoinSimplexInt value) { denseThreshold_ = value;} #endif /// Returns maximum absolute value in factorization CoinSimplexDouble maximumCoefficient() const; #if 0 /// true if Forrest Tomlin update, false if PFI inline bool forrestTomlin() const { return doForrestTomlin_;} inline void setForrestTomlin(bool value) { doForrestTomlin_=value;} #endif /// True if FT update and space inline bool spaceForForrestTomlin() const { CoinBigIndex start = lastEntryByColumnU_; CoinBigIndex space = lengthAreaU_ - ( start + numberRowsExtra_ ); return (space>=0); //&&doForrestTomlin_; } //@} /**@name some simple stuff */ //@{ /// Returns number in U area inline CoinBigIndex numberElementsU ( ) const { return lengthU_; } /// Setss number in U area inline void setNumberElementsU(CoinBigIndex value) { lengthU_ = value; } /// Returns length of U area inline CoinBigIndex lengthAreaU ( ) const { return lengthAreaU_; } /// Returns number in L area inline CoinBigIndex numberElementsL ( ) const { return lengthL_; } /// Returns length of L area inline CoinBigIndex lengthAreaL ( ) const { return lengthAreaL_; } /// Returns number in R area inline CoinBigIndex numberElementsR ( ) const { return lengthR_; } /// Number of compressions done inline CoinBigIndex numberCompressions() const { return numberCompressions_;} /// Returns pivot row //virtual CoinSimplexInt * pivotRow() const; /// Returns work area //virtual CoinFactorizationDouble * workArea() const; /// Returns CoinSimplexInt work area //virtual CoinSimplexInt * intWorkArea() const; /// Returns array to put basis starts in virtual inline CoinBigIndex * starts() const { return startColumnU_.array();} /// Number of entries in each row virtual inline CoinSimplexInt * numberInRow() const { return numberInRow_.array();} /// Number of entries in each column virtual inline CoinSimplexInt * numberInColumn() const { return numberInColumn_.array();} /// Returns array to put basis elements in virtual inline CoinFactorizationDouble * elements() const { return elementU_.array();} /// Start of columns for R inline CoinBigIndex * startColumnR() const {return reinterpret_cast(firstCount_.array()+3*numberRows_+4);} /// Elements of U inline CoinFactorizationDouble * elementU() const { return elementU_.array();} /// Row indices of U inline CoinSimplexInt * indexRowU() const { return indexRowU_.array();} /// Start of each column in U inline CoinBigIndex * startColumnU() const { return startColumnU_.array();} #if COIN_BIG_DOUBLE==1 /// To a work array and associate vector void toLongArray(CoinIndexedVector * vector,int which) const; /// From a work array and dis-associate vector void fromLongArray(CoinIndexedVector * vector) const; /// From a work array and dis-associate vector void fromLongArray(int which) const; /// Returns long double * associated with vector long double * denseVector(CoinIndexedVector * vector) const; /// Returns long double * associated with vector long double * denseVector(CoinIndexedVector & vector) const; /// Returns long double * associated with vector const long double * denseVector(const CoinIndexedVector * vector) const; /// Returns long double * associated with vector const long double * denseVector(const CoinIndexedVector & vector) const; /// Scans region to find nonzeros void scan(CoinIndexedVector * vector) const; /// Clear all hidden arrays void clearHiddenArrays(); #else /// Returns double * associated with vector inline double * denseVector(CoinIndexedVector * vector) const {return vector->denseVector();} inline double * denseVector(CoinIndexedVector & vector) const {return vector.denseVector();} /// Returns double * associated with vector inline const double * denseVector(const CoinIndexedVector * vector) const {return vector->denseVector();} inline const double * denseVector(const CoinIndexedVector & vector) const {return vector.denseVector();} /// To a work array and associate vector inline void toLongArray(CoinIndexedVector * vector,int which) const {} /// From a work array and dis-associate vector inline void fromLongArray(CoinIndexedVector * vector) const {} /// From a work array and dis-associate vector inline void fromLongArray(int which) const {} /// Scans region to find nonzeros inline void scan(CoinIndexedVector * vector) const {vector->scan(0,numberRows_,zeroTolerance_);} #endif #ifdef ABC_ORDERED_FACTORIZATION /// Permute in for Ftran void permuteInForFtran(CoinIndexedVector & regionSparse,bool full=false) const ; /// Permute in for Btran and multiply by pivot Region void permuteInForBtranAndMultiply(CoinIndexedVector & regionSparse, bool full=false) const ; /// Permute out for Btran void permuteOutForBtran(CoinIndexedVector & regionSparse) const ; #endif /** Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 but give a bit extra if bigger needed */ //inline CoinSimplexInt persistenceFlag() const //{ return persistenceFlag_;} //@} /**@name rank one updates which do exist */ //@{ #if 0 /** Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots Fills in region for use later partial update already in U */ virtual int checkReplace ( const AbcSimplex * model, CoinIndexedVector * regionSparse, int pivotRow, CoinSimplexDouble & pivotCheck, double acceptablePivot = 1.0e-8); /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If skipBtranU is false will do btran part partial update already in U */ virtual CoinSimplexInt replaceColumn ( CoinIndexedVector * regionSparse, CoinSimplexInt pivotRow, CoinSimplexDouble pivotCheck , bool skipBtranU=false, CoinSimplexDouble acceptablePivot=1.0e-8); #endif /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update already in U */ virtual #ifdef ABC_LONG_FACTORIZATION long #endif double checkReplacePart1 ( CoinIndexedVector * regionSparse, int pivotRow); /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update in vector */ virtual #ifdef ABC_LONG_FACTORIZATION long #endif double checkReplacePart1 ( CoinIndexedVector * regionSparse, CoinIndexedVector * partialUpdate, int pivotRow); #ifdef MOVE_REPLACE_PART1A /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update already in U */ virtual void checkReplacePart1a ( CoinIndexedVector * regionSparse, int pivotRow); virtual #ifdef ABC_LONG_FACTORIZATION long #endif double checkReplacePart1b ( CoinIndexedVector * regionSparse, int pivotRow); #endif /** Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */ virtual int checkReplacePart2 ( int pivotRow, CoinSimplexDouble btranAlpha, double ftranAlpha, #ifdef ABC_LONG_FACTORIZATION long #endif double ftAlpha, double acceptablePivot = 1.0e-8); /** Replaces one Column to basis, partial update already in U */ virtual void replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ); /** Replaces one Column to basis, partial update in vector */ virtual void replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, CoinIndexedVector * partialUpdate, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ); #ifdef EARLY_FACTORIZE /// 0 success, -1 can't +1 accuracy problems virtual int replaceColumns ( const AbcSimplex * model, CoinIndexedVector & stuff, int firstPivot,int lastPivot,bool cleanUp); #endif /// Update partial Ftran by R update void updatePartialUpdate(CoinIndexedVector & partialUpdate); /// Returns true if wants tableauColumn in replaceColumn inline virtual bool wantsTableauColumn() const {return false;} /** Combines BtranU and store which elements are to be deleted returns number to be deleted */ int replaceColumnU ( CoinIndexedVector * regionSparse, CoinBigIndex * deletedPosition, CoinSimplexInt * deletedColumns, CoinSimplexInt pivotRow); //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ /// Later take out return codes (apart from +- 1 on FT) //@{ /** Updates one column (FTRAN) from regionSparse2 Tries to do FT update number returned is negative if no room regionSparse starts as zero and is zero at end. Note - if regionSparse2 packed on input - will be packed on output */ virtual CoinSimplexInt updateColumnFT ( CoinIndexedVector & regionSparse); virtual int updateColumnFTPart1 ( CoinIndexedVector & regionSparse) ; virtual void updateColumnFTPart2 ( CoinIndexedVector & regionSparse) ; /** Updates one column (FTRAN) Tries to do FT update puts partial update in vector */ virtual void updateColumnFT ( CoinIndexedVector & regionSparseFT, CoinIndexedVector & partialUpdate, int which); /** This version has same effect as above with FTUpdate==false so number returned is always >=0 */ virtual CoinSimplexInt updateColumn ( CoinIndexedVector & regionSparse) const; /** Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room. Also updates region3 region1 starts as zero and is zero at end */ virtual CoinSimplexInt updateTwoColumnsFT ( CoinIndexedVector & regionFT, CoinIndexedVector & regionOther); /** Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - if regionSparse2 packed on input - will be packed on output */ virtual CoinSimplexInt updateColumnTranspose ( CoinIndexedVector & regionSparse) const; /** Updates one full column (FTRAN) */ virtual void updateFullColumn ( CoinIndexedVector & regionSparse) const; /** Updates one full column (BTRAN) */ virtual void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const; /** Updates one column for dual steepest edge weights (FTRAN) */ virtual void updateWeights ( CoinIndexedVector & regionSparse) const; /** Updates one column (FTRAN) */ virtual void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const; /** Updates one column (BTRAN) */ virtual void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const; void unpack ( CoinIndexedVector * regionFrom, CoinIndexedVector * regionTo) const; void pack ( CoinIndexedVector * regionFrom, CoinIndexedVector * regionTo) const; /** makes a row copy of L for speed and to allow very sparse problems */ inline void goSparse() {} void goSparse2(); #ifndef NDEBUG virtual void checkMarkArrays() const; #endif #if ABC_SMALL<2 /** get sparse threshold */ inline CoinSimplexInt sparseThreshold ( ) const { return sparseThreshold_;} #endif /** set sparse threshold */ void sparseThreshold ( CoinSimplexInt value ); //@} /// *** Below this user may not want to know about /**@name various uses of factorization (return code number elements) which user may not want to know about (left over from my LP code) */ //@{ /// Get rid of all memory inline void clearArrays() { gutsOfDestructor();} //@} /**@name used by ClpFactorization */ /// See if worth going sparse void checkSparse(); /// The real work of constructors etc 0 just scalars, 1 bit normal void gutsOfDestructor(CoinSimplexInt type=1); /// 1 bit - tolerances etc, 2 more, 4 dummy arrays void gutsOfInitialize(CoinSimplexInt type); void gutsOfCopy(const CoinAbcTypeFactorization &other); /// Reset all sparsity etc statistics void resetStatistics(); void printRegion(const CoinIndexedVector & vector, const char * where) const; //@} /**@name used by factorization */ /// Gets space for a factorization, called by constructors virtual void getAreas ( CoinSimplexInt numberRows, CoinSimplexInt numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU ); /// PreProcesses column ordered copy of basis virtual void preProcess ( ); void preProcess (CoinSimplexInt ); /// Return largest element double preProcess3 ( ); void preProcess4 ( ); /// Does most of factorization virtual CoinSimplexInt factor (AbcSimplex * model); #ifdef EARLY_FACTORIZE /// Returns -2 if can't, -1 if singular, -99 memory, 0 OK virtual int factorize (AbcSimplex * model, CoinIndexedVector & stuff); #endif /// Does post processing on valid factorization - putting variables on correct rows virtual void postProcess(const CoinSimplexInt * sequence, CoinSimplexInt * pivotVariable); /// Makes a non-singular basis by replacing variables virtual void makeNonSingular(CoinSimplexInt * sequence); protected: /** Does sparse phase of factorization return code is <0 error, 0= finished */ CoinSimplexInt factorSparse ( ); /** Does dense phase of factorization return code is <0 error, 0= finished */ CoinSimplexInt factorDense ( ); /// Pivots when just one other row so faster? bool pivotOneOtherRow ( CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn ); /// Does one pivot on Row Singleton in factorization bool pivotRowSingleton ( CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn ); /// Does one pivot on Column Singleton in factorization (can't return false) void pivotColumnSingleton ( CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn ); /// After pivoting void afterPivot( CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn ); /// After pivoting - returns true if need to go dense int wantToGoDense(); /** Gets space for one Column with given length, may have to do compression (returns True if successful), also moves existing vector, extraNeeded is over and above present */ bool getColumnSpace ( CoinSimplexInt iColumn, CoinSimplexInt extraNeeded ); /** Reorders U so contiguous and in order (if there is space) Returns true if it could */ bool reorderU(); /** getColumnSpaceIterateR. Gets space for one extra R element in Column may have to do compression (returns true) also moves existing vector */ bool getColumnSpaceIterateR ( CoinSimplexInt iColumn, CoinFactorizationDouble value, CoinSimplexInt iRow); /** getColumnSpaceIterate. Gets space for one extra U element in Column may have to do compression (returns true) also moves existing vector. Returns -1 if no memory or where element was put Used by replaceRow (turns off R version) */ CoinBigIndex getColumnSpaceIterate ( CoinSimplexInt iColumn, CoinFactorizationDouble value, CoinSimplexInt iRow); /** Gets space for one Row with given length, may have to do compression (returns True if successful), also moves existing vector */ bool getRowSpace ( CoinSimplexInt iRow, CoinSimplexInt extraNeeded ); /** Gets space for one Row with given length while iterating, may have to do compression (returns True if successful), also moves existing vector */ bool getRowSpaceIterate ( CoinSimplexInt iRow, CoinSimplexInt extraNeeded ); /// Checks that row and column copies look OK void checkConsistency ( ); //#define CHECK_LINKS #ifdef CHECK_LINKS void checkLinks(int x=0); #else # define checkLinks(x) #endif /// Adds a link in chain of equal counts inline void addLink ( CoinSimplexInt index, CoinSimplexInt count ) { CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_; CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCount(); CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_; CoinSimplexInt next = firstCount[count]; firstCount[count] = index; nextCount[index] = next; lastCount[index] = count-numberRows_-2; // points to firstCount[count] if (next>=0) lastCount[next] = index; } /// Deletes a link in chain of equal counts inline void deleteLink ( CoinSimplexInt index ) { CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_; CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_; CoinSimplexInt next = nextCount[index]; CoinSimplexInt last = lastCount[index]; assert (next!=index); assert (last!=index); if (next>=0) lastCount[next] = last; if (last>=0) { nextCount[last] = next; } else { int count=last+numberRows_+2; CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCount(); firstCount[count]=next; } } /// Modifies links in chain of equal counts inline void modifyLink ( CoinSimplexInt index, CoinSimplexInt count ) { CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_; CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_; CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCount(); CoinSimplexInt next2 = firstCount[count]; if (next2==index) return; firstCount[count] = index; CoinSimplexInt next = nextCount[index]; CoinSimplexInt last = lastCount[index]; assert (next!=index); assert (last!=index); nextCount[index] = next2; lastCount[index] = count-numberRows_-2; // points to firstCount[count] if (next>=0) lastCount[next] = last; if (next2>=0) lastCount[next2] = index; if (last>=0) { nextCount[last] = next; } else { int count=last+numberRows_+2; firstCount[count]=next; } } /// Separate out links with same row/column count void separateLinks(); void separateLinks(CoinSimplexInt,CoinSimplexInt); /// Cleans up at end of factorization void cleanup ( ); /// Set up addresses from arrays void doAddresses(); /// Updates part of column (FTRANL) void updateColumnL ( CoinIndexedVector * region #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichSparse=0 #endif ) const; /// Updates part of column (FTRANL) when densish void updateColumnLDensish ( CoinIndexedVector * region ) const; /// Updates part of column (FTRANL) when dense (i.e. do as inner products) void updateColumnLDense ( CoinIndexedVector * region ) const; /// Updates part of column (FTRANL) when sparse void updateColumnLSparse ( CoinIndexedVector * region #if ABC_PARALLEL ,int whichSparse #endif ) const; /// Updates part of column (FTRANR) without FT update void updateColumnR ( CoinIndexedVector * region #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichSparse=0 #endif ) const; /// Store update after doing L and R - retuns false if no room bool storeFT( #if ABC_SMALL<3 const #endif CoinIndexedVector * regionFT); /// Updates part of column (FTRANU) void updateColumnU ( CoinIndexedVector * region #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichSparse=0 #endif ) const; /// Updates part of column (FTRANU) when sparse void updateColumnUSparse ( CoinIndexedVector * regionSparse #if ABC_PARALLEL ,int whichSparse #endif ) const; /// Updates part of column (FTRANU) void updateColumnUDensish ( CoinIndexedVector * regionSparse) const; /// Updates part of column (FTRANU) when dense (i.e. do as inner products) void updateColumnUDense ( CoinIndexedVector * regionSparse) const; /// Updates part of 2 columns (FTRANU) real work void updateTwoColumnsUDensish ( CoinSimplexInt & numberNonZero1, CoinFactorizationDouble * COIN_RESTRICT region1, CoinSimplexInt * COIN_RESTRICT index1, CoinSimplexInt & numberNonZero2, CoinFactorizationDouble * COIN_RESTRICT region2, CoinSimplexInt * COIN_RESTRICT index2) const; /// Updates part of column PFI (FTRAN) (after rest) void updateColumnPFI ( CoinIndexedVector * regionSparse) const; /// Updates part of column transpose PFI (BTRAN) (before rest) void updateColumnTransposePFI ( CoinIndexedVector * region) const; /** Updates part of column transpose (BTRANU), assumes index is sorted i.e. region is correct */ void updateColumnTransposeU ( CoinIndexedVector * region, CoinSimplexInt smallestIndex #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichCpu #endif ) const; /** Updates part of column transpose (BTRANU) when densish, assumes index is sorted i.e. region is correct */ void updateColumnTransposeUDensish ( CoinIndexedVector * region, CoinSimplexInt smallestIndex) const; /** Updates part of column transpose (BTRANU) when sparse, assumes index is sorted i.e. region is correct */ void updateColumnTransposeUSparse ( CoinIndexedVector * region #if ABC_PARALLEL ,int whichSparse #endif ) const; /** Updates part of column transpose (BTRANU) by column assumes index is sorted i.e. region is correct */ void updateColumnTransposeUByColumn ( CoinIndexedVector * region, CoinSimplexInt smallestIndex) const; /// Updates part of column transpose (BTRANR) void updateColumnTransposeR ( CoinIndexedVector * region #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif ) const; /// Updates part of column transpose (BTRANR) when dense void updateColumnTransposeRDensish ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANR) when sparse void updateColumnTransposeRSparse ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANL) void updateColumnTransposeL ( CoinIndexedVector * region #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichSparse #endif ) const; /// Updates part of column transpose (BTRANL) when densish by column void updateColumnTransposeLDensish ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANL) when densish by row void updateColumnTransposeLByRow ( CoinIndexedVector * region ) const; /// Updates part of column transpose (BTRANL) when sparse (by Row) void updateColumnTransposeLSparse ( CoinIndexedVector * region #if ABC_PARALLEL ,int whichSparse #endif ) const; public: /** Replaces one Column to basis for PFI returns 0=OK, 1=Probably OK, 2=singular, 3=no room. In this case region is not empty - it is incoming variable (updated) */ CoinSimplexInt replaceColumnPFI ( CoinIndexedVector * regionSparse, CoinSimplexInt pivotRow, CoinSimplexDouble alpha); protected: /** Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular */ CoinSimplexInt checkPivot(CoinSimplexDouble saveFromU, CoinSimplexDouble oldPivot) const; /// 0 fine, -99 singular, 2 dense int pivot ( CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn, CoinBigIndex pivotRowPosition, CoinBigIndex pivotColumnPosition, CoinFactorizationDouble * COIN_RESTRICT work, CoinSimplexUnsignedInt * COIN_RESTRICT workArea2, CoinSimplexInt increment2, int * COIN_RESTRICT markRow ); int pivot ( CoinSimplexInt & pivotRow, CoinSimplexInt & pivotColumn, CoinBigIndex pivotRowPosition, CoinBigIndex pivotColumnPosition, int * COIN_RESTRICT markRow ); #if ABC_SMALL<2 #define CONVERTROW 2 #elif ABC_SMALL<4 #else #undef ABC_DENSE_CODE #define ABC_DENSE_CODE 0 #endif //@} ////////////////// data ////////////////// protected: /**@name data */ //@{ CoinSimplexInt * pivotColumnAddress_; CoinSimplexInt * permuteAddress_; CoinFactorizationDouble * pivotRegionAddress_; CoinFactorizationDouble * elementUAddress_; CoinSimplexInt * indexRowUAddress_; CoinSimplexInt * numberInColumnAddress_; CoinSimplexInt * numberInColumnPlusAddress_; #ifdef ABC_USE_FUNCTION_POINTERS /// Array of function pointers scatterStruct * scatterPointersUColumnAddress_; CoinFactorizationDouble * elementUColumnPlusAddress_; #endif CoinBigIndex * startColumnUAddress_; #if CONVERTROW CoinBigIndex * convertRowToColumnUAddress_; #if CONVERTROW>1 CoinBigIndex * convertColumnToRowUAddress_; #endif #endif #if ABC_SMALL<2 CoinFactorizationDouble * elementRowUAddress_; #endif CoinBigIndex * startRowUAddress_; CoinSimplexInt * numberInRowAddress_; CoinSimplexInt * indexColumnUAddress_; CoinSimplexInt * firstCountAddress_; /// Next Row/Column with count CoinSimplexInt * nextCountAddress_; /// Previous Row/Column with count CoinSimplexInt * lastCountAddress_; CoinSimplexInt * nextColumnAddress_; CoinSimplexInt * lastColumnAddress_; CoinSimplexInt * nextRowAddress_; CoinSimplexInt * lastRowAddress_; CoinSimplexInt * saveColumnAddress_; //CoinSimplexInt * saveColumnAddress2_; CoinCheckZero * markRowAddress_; CoinSimplexInt * listAddress_; CoinFactorizationDouble * elementLAddress_; CoinSimplexInt * indexRowLAddress_; CoinBigIndex * startColumnLAddress_; #if ABC_SMALL<2 CoinBigIndex * startRowLAddress_; #endif CoinSimplexInt * pivotLinkedBackwardsAddress_; CoinSimplexInt * pivotLinkedForwardsAddress_; CoinSimplexInt * pivotLOrderAddress_; CoinBigIndex * startColumnRAddress_; /// Elements of R CoinFactorizationDouble *elementRAddress_; /// Row indices for R CoinSimplexInt *indexRowRAddress_; CoinSimplexInt * indexColumnLAddress_; CoinFactorizationDouble * elementByRowLAddress_; #if ABC_SMALL<4 CoinFactorizationDouble * denseAreaAddress_; #endif CoinFactorizationDouble * workAreaAddress_; CoinSimplexUnsignedInt * workArea2Address_; mutable CoinSimplexInt * sparseAddress_; #ifdef SMALL_PERMUTE CoinSimplexInt * fromSmallToBigRow_; CoinSimplexInt * fromSmallToBigColumn_; #endif /// Number of Rows after iterating CoinSimplexInt numberRowsExtra_; /// Maximum number of Rows after iterating CoinSimplexInt maximumRowsExtra_; /// Size of small inverse CoinSimplexInt numberRowsSmall_; /// Number factorized in L CoinSimplexInt numberGoodL_; /// Number Rows left (numberRows-numberGood) CoinSimplexInt numberRowsLeft_; /// Number of elements in U (to go) /// or while iterating total overall CoinBigIndex totalElements_; /// First place in funny copy zeroed out CoinBigIndex firstZeroed_; #if ABC_SMALL<2 /// Below this use sparse technology - if 0 then no L row copy CoinSimplexInt sparseThreshold_; #endif /// Number in R CoinSimplexInt numberR_; /// Length of R stuff CoinBigIndex lengthR_; /// length of area reserved for R CoinBigIndex lengthAreaR_; /// Number in L CoinBigIndex numberL_; /// Base of L CoinBigIndex baseL_; /// Length of L CoinBigIndex lengthL_; /// Length of area reserved for L CoinBigIndex lengthAreaL_; /// Number in U CoinSimplexInt numberU_; /// Maximum space used in U CoinBigIndex maximumU_; /// Length of U CoinBigIndex lengthU_; /// Length of area reserved for U CoinBigIndex lengthAreaU_; /// Last entry by column for U CoinBigIndex lastEntryByColumnU_; #ifdef ABC_USE_FUNCTION_POINTERS /// Last entry by column for U CoinBigIndex lastEntryByColumnUPlus_; /// Length of U CoinBigIndex lengthAreaUPlus_; #endif /// Last entry by row for U CoinBigIndex lastEntryByRowU_; /// Number of trials before rejection CoinSimplexInt numberTrials_; #if ABC_SMALL<4 /// Leading dimension for dense CoinSimplexInt leadingDimension_; #endif #if COIN_BIG_DOUBLE==1 /// Work arrays mutable CoinFactorizationLongDoubleArrayWithLength longArray_[FACTOR_CPU]; /// Associated CoinIndexedVector mutable CoinIndexedVector * associatedVector_[FACTOR_CPU]; #endif /// Pivot order for each Column CoinIntArrayWithLength pivotColumn_; /// Permutation vector for pivot row order CoinIntArrayWithLength permute_; /// Start of each Row as pointer CoinBigIndexArrayWithLength startRowU_; /// Number in each Row CoinIntArrayWithLength numberInRow_; /// Number in each Column CoinIntArrayWithLength numberInColumn_; /// Number in each Column including pivoted CoinIntArrayWithLength numberInColumnPlus_; /** First Row/Column with count of k, can tell which by offset - Rows then Columns */ CoinIntArrayWithLength firstCount_; /// Next Column in memory order CoinIntArrayWithLength nextColumn_; /// Previous Column in memory order CoinIntArrayWithLength lastColumn_; /// Next Row in memory order CoinIntArrayWithLength nextRow_; /// Previous Row in memory order CoinIntArrayWithLength lastRow_; /// Columns left to do in a single pivot CoinIntArrayWithLength saveColumn_; /// Marks rows to be updated CoinIntArrayWithLength markRow_; /// Base address for U (may change) CoinIntArrayWithLength indexColumnU_; /// Inverses of pivot values CoinFactorizationDoubleArrayWithLength pivotRegion_; /// Elements of U CoinFactorizationDoubleArrayWithLength elementU_; /// Row indices of U CoinIntArrayWithLength indexRowU_; /// Start of each column in U CoinBigIndexArrayWithLength startColumnU_; #ifdef ABC_USE_FUNCTION_POINTERS /// Array of structs for U Column CoinArbitraryArrayWithLength scatterUColumn_; #endif #if CONVERTROW /// Converts rows to columns in U CoinBigIndexArrayWithLength convertRowToColumnU_; #if CONVERTROW>1 /// Converts columns to rows in U CoinBigIndexArrayWithLength convertColumnToRowU_; #endif #endif #if ABC_SMALL<2 /// Elements of U by row CoinFactorizationDoubleArrayWithLength elementRowU_; #endif /// Elements of L CoinFactorizationDoubleArrayWithLength elementL_; /// Row indices of L CoinIntArrayWithLength indexRowL_; /// Start of each column in L CoinBigIndexArrayWithLength startColumnL_; #if ABC_SMALL<4 /// Dense area CoinFactorizationDoubleArrayWithLength denseArea_; #endif /// First work area CoinFactorizationDoubleArrayWithLength workArea_; /// Second work area CoinUnsignedIntArrayWithLength workArea2_; #if ABC_SMALL<2 /// Start of each row in L CoinBigIndexArrayWithLength startRowL_; /// Index of column in row for L CoinIntArrayWithLength indexColumnL_; /// Elements in L (row copy) CoinFactorizationDoubleArrayWithLength elementByRowL_; /// Sparse regions mutable CoinIntArrayWithLength sparse_; #endif /// Detail in messages CoinSimplexInt messageLevel_; /// Number of compressions done CoinBigIndex numberCompressions_; // last slack pivot row CoinSimplexInt lastSlack_; #if ABC_SMALL<2 /// To decide how to solve mutable double ftranCountInput_; mutable double ftranCountAfterL_; mutable double ftranCountAfterR_; mutable double ftranCountAfterU_; double ftranAverageAfterL_; double ftranAverageAfterR_; double ftranAverageAfterU_; #if FACTORIZATION_STATISTICS double ftranTwiddleFactor1_; double ftranTwiddleFactor2_; #endif mutable CoinSimplexInt numberFtranCounts_; #endif /// Maximum rows (ever) (here to use double alignment) CoinSimplexInt maximumRows_; #if ABC_SMALL<2 mutable double ftranFTCountInput_; mutable double ftranFTCountAfterL_; mutable double ftranFTCountAfterR_; mutable double ftranFTCountAfterU_; double ftranFTAverageAfterL_; double ftranFTAverageAfterR_; double ftranFTAverageAfterU_; #if FACTORIZATION_STATISTICS double ftranFTTwiddleFactor1_; double ftranFTTwiddleFactor2_; #endif mutable CoinSimplexInt numberFtranFTCounts_; #endif #if ABC_SMALL<4 /// Dense threshold (here to use double alignment) CoinSimplexInt denseThreshold_; #endif #if ABC_SMALL<2 mutable double btranCountInput_; mutable double btranCountAfterU_; mutable double btranCountAfterR_; mutable double btranCountAfterL_; double btranAverageAfterU_; double btranAverageAfterR_; double btranAverageAfterL_; #if FACTORIZATION_STATISTICS double btranTwiddleFactor1_; double btranTwiddleFactor2_; #endif mutable CoinSimplexInt numberBtranCounts_; #endif /// Maximum maximum pivots CoinSimplexInt maximumMaximumPivots_; #if ABC_SMALL<2 /// To decide how to solve mutable double ftranFullCountInput_; mutable double ftranFullCountAfterL_; mutable double ftranFullCountAfterR_; mutable double ftranFullCountAfterU_; double ftranFullAverageAfterL_; double ftranFullAverageAfterR_; double ftranFullAverageAfterU_; #if FACTORIZATION_STATISTICS double ftranFullTwiddleFactor1_; double ftranFullTwiddleFactor2_; #endif mutable CoinSimplexInt numberFtranFullCounts_; #endif /// Rows first time nonzero CoinSimplexInt initialNumberRows_; #if ABC_SMALL<2 /// To decide how to solve mutable double btranFullCountInput_; mutable double btranFullCountAfterL_; mutable double btranFullCountAfterR_; mutable double btranFullCountAfterU_; double btranFullAverageAfterL_; double btranFullAverageAfterR_; double btranFullAverageAfterU_; #if FACTORIZATION_STATISTICS double btranFullTwiddleFactor1_; double btranFullTwiddleFactor2_; #endif mutable CoinSimplexInt numberBtranFullCounts_; #endif /** State of saved version and what can be done 0 - nothing saved 1 - saved and can go back to previous save by unwinding 2 - saved - getting on for a full copy higher bits - see ABC_FAC.... */ CoinSimplexInt state_; /// Size in bytes of a sparseArray CoinBigIndex sizeSparseArray_; public: #if ABC_SMALL<2 #if ABC_SMALL>=0 inline bool gotLCopy() const {return ((state_&ABC_FAC_GOT_LCOPY)!=0);} inline void setNoGotLCopy() {state_ &= ~ABC_FAC_GOT_LCOPY;} inline void setYesGotLCopy() {state_ |= ABC_FAC_GOT_LCOPY;} inline bool gotRCopy() const {return ((state_&ABC_FAC_GOT_RCOPY)!=0);} inline void setNoGotRCopy() {state_ &= ~ABC_FAC_GOT_RCOPY;} inline void setYesGotRCopy() {state_ |= ABC_FAC_GOT_RCOPY;} inline bool gotUCopy() const {return ((state_&ABC_FAC_GOT_UCOPY)!=0);} inline void setNoGotUCopy() {state_ &= ~ABC_FAC_GOT_UCOPY;} inline void setYesGotUCopy() {state_ |= ABC_FAC_GOT_UCOPY;} inline bool gotSparse() const {return ((state_&ABC_FAC_GOT_SPARSE)!=0);} inline void setNoGotSparse() {state_ &= ~ABC_FAC_GOT_SPARSE;} inline void setYesGotSparse() {state_ |= ABC_FAC_GOT_SPARSE;} #else // force use of copies inline bool gotLCopy() const {return true;} inline void setNoGotLCopy() {} inline void setYesGotLCopy() {} inline bool gotRCopy() const {return true;} inline void setNoGotRCopy() {} inline void setYesGotRCopy() {} inline bool gotUCopy() const {return true;} inline void setNoGotUCopy() {} inline void setYesGotUCopy() {} inline bool gotSparse() const {return true;} inline void setNoGotSparse() {} inline void setYesGotSparse() {} #endif #else // force no use of copies inline bool gotLCopy() const {return false;} inline void setNoGotLCopy() {} inline void setYesGotLCopy() {} inline bool gotRCopy() const {return false;} inline void setNoGotRCopy() {} inline void setYesGotRCopy() {} inline bool gotUCopy() const {return false;} inline void setNoGotUCopy() {} inline void setYesGotUCopy() {} inline bool gotSparse() const {return false;} inline void setNoGotSparse() {} inline void setYesGotSparse() {} #endif /** Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 but give a bit extra if bigger needed */ //CoinSimplexInt persistenceFlag_; //@} }; CoinMP-1.8.3/Clp/src/ClpNode.cpp0000644000175000017500000013551212101105055014646 0ustar renerene/* $Id: ClpNode.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2008, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpNode.hpp" #include "ClpFactorization.hpp" #include "ClpDualRowSteepest.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpNode::ClpNode () : branchingValue_(0.5), objectiveValue_(0.0), sumInfeasibilities_(0.0), estimatedSolution_(0.0), factorization_(NULL), weights_(NULL), status_(NULL), primalSolution_(NULL), dualSolution_(NULL), lower_(NULL), upper_(NULL), pivotVariables_(NULL), fixed_(NULL), sequence_(1), numberInfeasibilities_(0), depth_(0), numberFixed_(0), flags_(0), maximumFixed_(0), maximumRows_(0), maximumColumns_(0), maximumIntegers_(0) { branchState_.firstBranch = 0; branchState_.branch = 0; } //------------------------------------------------------------------- // Useful Constructor from model //------------------------------------------------------------------- ClpNode::ClpNode (ClpSimplex * model, const ClpNodeStuff * stuff, int depth) : branchingValue_(0.5), objectiveValue_(0.0), sumInfeasibilities_(0.0), estimatedSolution_(0.0), factorization_(NULL), weights_(NULL), status_(NULL), primalSolution_(NULL), dualSolution_(NULL), lower_(NULL), upper_(NULL), pivotVariables_(NULL), fixed_(NULL), sequence_(1), numberInfeasibilities_(0), depth_(0), numberFixed_(0), flags_(0), maximumFixed_(0), maximumRows_(0), maximumColumns_(0), maximumIntegers_(0) { branchState_.firstBranch = 0; branchState_.branch = 0; gutsOfConstructor(model, stuff, 0, depth); } //------------------------------------------------------------------- // Most of work of constructor from model //------------------------------------------------------------------- void ClpNode::gutsOfConstructor (ClpSimplex * model, const ClpNodeStuff * stuff, int arraysExist, int depth) { int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); int numberTotal = numberRows + numberColumns; int maximumTotal = maximumRows_ + maximumColumns_; depth_ = depth; // save stuff objectiveValue_ = model->objectiveValue() * model->optimizationDirection(); estimatedSolution_ = objectiveValue_; flags_ = 1; //say scaled if (!arraysExist) { maximumRows_ = CoinMax(maximumRows_, numberRows); maximumColumns_ = CoinMax(maximumColumns_, numberColumns); maximumTotal = maximumRows_ + maximumColumns_; assert (!factorization_); factorization_ = new ClpFactorization(*model->factorization(), numberRows); status_ = CoinCopyOfArrayPartial(model->statusArray(), maximumTotal, numberTotal); primalSolution_ = CoinCopyOfArrayPartial(model->solutionRegion(), maximumTotal, numberTotal); dualSolution_ = CoinCopyOfArrayPartial(model->djRegion(), maximumTotal, numberTotal); //? has duals as well? pivotVariables_ = CoinCopyOfArrayPartial(model->pivotVariable(), maximumRows_, numberRows); ClpDualRowSteepest* pivot = dynamic_cast< ClpDualRowSteepest*>(model->dualRowPivot()); if (pivot) { assert (!weights_); weights_ = new ClpDualRowSteepest(*pivot); } } else { if (arraysExist == 2) assert(lower_); if (numberRows <= maximumRows_ && numberColumns <= maximumColumns_) { CoinMemcpyN(model->statusArray(), numberTotal, status_); if (arraysExist == 1) { *factorization_ = *model->factorization(); CoinMemcpyN(model->solutionRegion(), numberTotal, primalSolution_); CoinMemcpyN(model->djRegion(), numberTotal, dualSolution_); //? has duals as well? ClpDualRowSteepest* pivot = dynamic_cast< ClpDualRowSteepest*>(model->dualRowPivot()); if (pivot) { if (weights_) { //if (weights_->numberRows()==pivot->numberRows()) { weights_->fill(*pivot); //} else { //delete weights_; //weights_ = new ClpDualRowSteepest(*pivot); //} } else { weights_ = new ClpDualRowSteepest(*pivot); } } CoinMemcpyN(model->pivotVariable(), numberRows, pivotVariables_); } else { CoinMemcpyN(model->primalColumnSolution(), numberColumns, primalSolution_); CoinMemcpyN(model->dualColumnSolution(), numberColumns, dualSolution_); flags_ = 0; CoinMemcpyN(model->dualRowSolution(), numberRows, dualSolution_ + numberColumns); } } else { // size has changed maximumRows_ = CoinMax(maximumRows_, numberRows); maximumColumns_ = CoinMax(maximumColumns_, numberColumns); maximumTotal = maximumRows_ + maximumColumns_; delete weights_; weights_ = NULL; delete [] status_; delete [] primalSolution_; delete [] dualSolution_; delete [] pivotVariables_; status_ = CoinCopyOfArrayPartial(model->statusArray(), maximumTotal, numberTotal); primalSolution_ = new double [maximumTotal*sizeof(double)]; dualSolution_ = new double [maximumTotal*sizeof(double)]; if (arraysExist == 1) { *factorization_ = *model->factorization(); // I think this is OK CoinMemcpyN(model->solutionRegion(), numberTotal, primalSolution_); CoinMemcpyN(model->djRegion(), numberTotal, dualSolution_); //? has duals as well? ClpDualRowSteepest* pivot = dynamic_cast< ClpDualRowSteepest*>(model->dualRowPivot()); if (pivot) { assert (!weights_); weights_ = new ClpDualRowSteepest(*pivot); } } else { CoinMemcpyN(model->primalColumnSolution(), numberColumns, primalSolution_); CoinMemcpyN(model->dualColumnSolution(), numberColumns, dualSolution_); flags_ = 0; CoinMemcpyN(model->dualRowSolution(), numberRows, dualSolution_ + numberColumns); } pivotVariables_ = new int [maximumRows_]; if (model->pivotVariable() && model->numberRows() == numberRows) CoinMemcpyN(model->pivotVariable(), numberRows, pivotVariables_); else CoinFillN(pivotVariables_, numberRows, -1); } } numberFixed_ = 0; const double * lower = model->columnLower(); const double * upper = model->columnUpper(); const double * solution = model->primalColumnSolution(); const char * integerType = model->integerInformation(); const double * columnScale = model->columnScale(); if (!flags_) columnScale = NULL; // as duals correct int iColumn; sequence_ = -1; double integerTolerance = stuff->integerTolerance_; double mostAway = 0.0; int bestPriority = COIN_INT_MAX; sumInfeasibilities_ = 0.0; numberInfeasibilities_ = 0; int nFix = 0; double gap = CoinMax(model->dualObjectiveLimit() - objectiveValue_, 1.0e-4); #define PSEUDO 3 #if PSEUDO==1||PSEUDO==2 // Column copy of matrix ClpPackedMatrix * matrix = model->clpScaledMatrix(); const double *objective = model->costRegion() ; if (!objective) { objective = model->objective(); //if (!matrix) matrix = dynamic_cast< ClpPackedMatrix*>(model->clpMatrix()); } else if (!matrix) { matrix = dynamic_cast< ClpPackedMatrix*>(model->clpMatrix()); } const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); double direction = model->optimizationDirection(); const double * dual = dualSolution_ + numberColumns; #if PSEUDO==2 double * activeWeight = new double [numberRows]; const double * rowLower = model->rowLower(); const double * rowUpper = model->rowUpper(); const double * rowActivity = model->primalRowSolution(); double tolerance = 1.0e-6; for (int iRow = 0; iRow < numberRows; iRow++) { // could use pi to see if active or activity if (rowActivity[iRow] > rowUpper[iRow] - tolerance || rowActivity[iRow] < rowLower[iRow] + tolerance) { activeWeight[iRow] = 0.0; } else { activeWeight[iRow] = -1.0; } } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerType[iColumn]) { double value = solution[iColumn]; if (fabs(value - floor(value + 0.5)) > 1.0e-6) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; if (activeWeight[iRow] >= 0.0) activeWeight[iRow] += 1.0; } } } } for (int iRow = 0; iRow < numberRows; iRow++) { if (activeWeight[iRow] > 0.0) { // could use pi activeWeight[iRow] = 1.0 / activeWeight[iRow]; } else { activeWeight[iRow] = 0.0; } } #endif #endif const double * downPseudo = stuff->downPseudo_; const int * numberDown = stuff->numberDown_; const int * numberDownInfeasible = stuff->numberDownInfeasible_; const double * upPseudo = stuff->upPseudo_; const int * priority = stuff->priority_; const int * numberUp = stuff->numberUp_; const int * numberUpInfeasible = stuff->numberUpInfeasible_; int numberBeforeTrust = stuff->numberBeforeTrust_; int stateOfSearch = stuff->stateOfSearch_; int iInteger = 0; // weight at 1.0 is max min (CbcBranch was 0.8,0.1) (ClpNode was 0.9,0.9) #define WEIGHT_AFTER 0.9 #define WEIGHT_BEFORE 0.2 //Stolen from Constraint Integer Programming book (with epsilon change) #define WEIGHT_PRODUCT #ifdef WEIGHT_PRODUCT double smallChange = stuff->smallChange_; #endif #ifndef INFEAS_MULTIPLIER #define INFEAS_MULTIPLIER 1.0 #endif for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerType[iColumn]) { double value = solution[iColumn]; value = CoinMax(value, static_cast (lower[iColumn])); value = CoinMin(value, static_cast (upper[iColumn])); double nearest = floor(value + 0.5); if (fabs(value - nearest) > integerTolerance) { numberInfeasibilities_++; sumInfeasibilities_ += fabs(value - nearest); #if PSEUDO==1 || PSEUDO ==2 double upValue = 0.0; double downValue = 0.0; double value2 = direction * objective[iColumn]; //double dj2=value2; if (value2) { if (value2 > 0.0) upValue += 1.5 * value2; else downValue -= 1.5 * value2; } CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; value2 = -dual[iRow]; if (value2) { value2 *= element[j]; //dj2 += value2; #if PSEUDO==2 assert (activeWeight[iRow] > 0.0 || fabs(dual[iRow]) < 1.0e-6); value2 *= activeWeight[iRow]; #endif if (value2 > 0.0) upValue += value2; else downValue -= value2; } } //assert (fabs(dj2)<1.0e-4); int nUp = numberUp[iInteger]; double upValue2 = (upPseudo[iInteger] / (1.0 + nUp)); // Extra for infeasible branches if (nUp) { double ratio = 1.0 + INFEAS_MULTIPLIER*static_cast(numberUpInfeasible[iInteger]) / static_cast(nUp); upValue2 *= ratio; } int nDown = numberDown[iInteger]; double downValue2 = (downPseudo[iInteger] / (1.0 + nDown)); if (nDown) { double ratio = 1.0 + INFEAS_MULTIPLIER*static_cast(numberDownInfeasible[iInteger]) / static_cast(nDown); downValue2 *= ratio; } //printf("col %d - downPi %g up %g, downPs %g up %g\n", // iColumn,upValue,downValue,upValue2,downValue2); upValue = CoinMax(0.1 * upValue, upValue2); downValue = CoinMax(0.1 * downValue, downValue2); //upValue = CoinMax(upValue,1.0e-8); //downValue = CoinMax(downValue,1.0e-8); upValue *= ceil(value) - value; downValue *= value - floor(value); double infeasibility; //if (depth>1000) //infeasibility = CoinMax(upValue,downValue)+integerTolerance; //else if (stateOfSearch <= 2) { // no solution infeasibility = (1.0 - WEIGHT_BEFORE) * CoinMax(upValue, downValue) + WEIGHT_BEFORE * CoinMin(upValue, downValue) + integerTolerance; } else { #ifndef WEIGHT_PRODUCT infeasibility = (1.0 - WEIGHT_AFTER) * CoinMax(upValue, downValue) + WEIGHT_AFTER * CoinMin(upValue, downValue) + integerTolerance; #else infeasibility = CoinMax(CoinMax(upValue, downValue), smallChange) * CoinMax(CoinMin(upValue, downValue), smallChange); #endif } estimatedSolution_ += CoinMin(upValue2, downValue2); #elif PSEUDO==3 int nUp = numberUp[iInteger]; int nDown = numberDown[iInteger]; // Extra 100% for infeasible branches double upValue = (ceil(value) - value) * (upPseudo[iInteger] / (1.0 + nUp)); if (nUp) { double ratio = 1.0 + INFEAS_MULTIPLIER*static_cast(numberUpInfeasible[iInteger]) / static_cast(nUp); upValue *= ratio; } double downValue = (value - floor(value)) * (downPseudo[iInteger] / (1.0 + nDown)); if (nDown) { double ratio = 1.0 + INFEAS_MULTIPLIER*static_cast(numberDownInfeasible[iInteger]) / static_cast(nDown); downValue *= ratio; } if (nUp < numberBeforeTrust || nDown < numberBeforeTrust) { upValue *= 10.0; downValue *= 10.0; } double infeasibility; //if (depth>1000) //infeasibility = CoinMax(upValue,downValue)+integerTolerance; //else if (stateOfSearch <= 2) { // no solution infeasibility = (1.0 - WEIGHT_BEFORE) * CoinMax(upValue, downValue) + WEIGHT_BEFORE * CoinMin(upValue, downValue) + integerTolerance; } else { #ifndef WEIGHT_PRODUCT infeasibility = (1.0 - WEIGHT_AFTER) * CoinMax(upValue, downValue) + WEIGHT_AFTER * CoinMin(upValue, downValue) + integerTolerance; #else infeasibility = CoinMax(CoinMax(upValue, downValue), smallChange) * CoinMax(CoinMin(upValue, downValue), smallChange); //infeasibility += CoinMin(upValue,downValue)*smallChange; #endif } //infeasibility = 0.1*CoinMax(upValue,downValue)+ //0.9*CoinMin(upValue,downValue) + integerTolerance; estimatedSolution_ += CoinMin(upValue, downValue); #else double infeasibility = fabs(value - nearest); #endif assert (infeasibility > 0.0); if (priority[iInteger] < bestPriority) { mostAway = 0.0; bestPriority = priority[iInteger]; } else if (priority[iInteger] > bestPriority) { infeasibility = 0.0; } if (infeasibility > mostAway) { mostAway = infeasibility; sequence_ = iColumn; branchingValue_ = value; branchState_.branch = 0; #if PSEUDO>0 if (upValue <= downValue) branchState_.firstBranch = 1; // up else branchState_.firstBranch = 0; // down #else if (value <= nearest) branchState_.firstBranch = 1; // up else branchState_.firstBranch = 0; // down #endif } } else if (model->getColumnStatus(iColumn) == ClpSimplex::atLowerBound) { bool fix = false; if (columnScale) { if (dualSolution_[iColumn] > gap * columnScale[iColumn]) fix = true; } else { if (dualSolution_[iColumn] > gap) fix = true; } if (fix) { nFix++; //printf("fixed %d to zero gap %g dj %g %g\n",iColumn, // gap,dualSolution_[iColumn], columnScale ? columnScale[iColumn]:1.0); model->setColumnStatus(iColumn, ClpSimplex::isFixed); } } else if (model->getColumnStatus(iColumn) == ClpSimplex::atUpperBound) { bool fix = false; if (columnScale) { if (-dualSolution_[iColumn] > gap * columnScale[iColumn]) fix = true; } else { if (-dualSolution_[iColumn] > gap) fix = true; } if (fix) { nFix++; //printf("fixed %d to one gap %g dj %g %g\n",iColumn, // gap,dualSolution_[iColumn], columnScale ? columnScale[iColumn]:1.0); model->setColumnStatus(iColumn, ClpSimplex::isFixed); } } iInteger++; } } //printf("Choosing %d inf %g pri %d\n", // sequence_,mostAway,bestPriority); #if PSEUDO == 2 delete [] activeWeight; #endif if (lower_) { // save bounds if (iInteger > maximumIntegers_) { delete [] lower_; delete [] upper_; maximumIntegers_ = iInteger; lower_ = new int [maximumIntegers_]; upper_ = new int [maximumIntegers_]; } iInteger = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerType[iColumn]) { lower_[iInteger] = static_cast (lower[iColumn]); upper_[iInteger] = static_cast (upper[iColumn]); iInteger++; } } } // Could omit save of fixed if doing full save of bounds if (sequence_ >= 0 && nFix) { if (nFix > maximumFixed_) { delete [] fixed_; fixed_ = new int [nFix]; maximumFixed_ = nFix; } numberFixed_ = 0; unsigned char * status = model->statusArray(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (status[iColumn] != status_[iColumn]) { if (solution[iColumn] <= lower[iColumn] + 2.0 * integerTolerance) { model->setColumnUpper(iColumn, lower[iColumn]); fixed_[numberFixed_++] = iColumn; } else { assert (solution[iColumn] >= upper[iColumn] - 2.0 * integerTolerance); model->setColumnLower(iColumn, upper[iColumn]); fixed_[numberFixed_++] = iColumn | 0x10000000; } } } //printf("%d fixed\n",numberFixed_); } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpNode::ClpNode (const ClpNode & ) { printf("ClpNode copy not implemented\n"); abort(); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpNode::~ClpNode () { delete factorization_; delete weights_; delete [] status_; delete [] primalSolution_; delete [] dualSolution_; delete [] lower_; delete [] upper_; delete [] pivotVariables_; delete [] fixed_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpNode & ClpNode::operator=(const ClpNode& rhs) { if (this != &rhs) { printf("ClpNode = not implemented\n"); abort(); } return *this; } // Create odd arrays void ClpNode::createArrays(ClpSimplex * model) { int numberColumns = model->numberColumns(); const char * integerType = model->integerInformation(); int iColumn; int numberIntegers = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerType[iColumn]) numberIntegers++; } if (numberIntegers > maximumIntegers_ || !lower_) { delete [] lower_; delete [] upper_; maximumIntegers_ = numberIntegers; lower_ = new int [numberIntegers]; upper_ = new int [numberIntegers]; } } // Clean up as crunch is different model void ClpNode::cleanUpForCrunch() { delete weights_; weights_ = NULL; } /* Applies node to model 0 - just tree bounds 1 - tree bounds and basis etc 2 - saved bounds and basis etc */ void ClpNode::applyNode(ClpSimplex * model, int doBoundsEtc ) { int numberColumns = model->numberColumns(); const double * lower = model->columnLower(); const double * upper = model->columnUpper(); if (doBoundsEtc < 2) { // current bound int way = branchState_.firstBranch; if (branchState_.branch > 0) way = 1 - way; if (!way) { // This should also do underlying internal bound model->setColumnUpper(sequence_, floor(branchingValue_)); } else { // This should also do underlying internal bound model->setColumnLower(sequence_, ceil(branchingValue_)); } // apply dj fixings for (int i = 0; i < numberFixed_; i++) { int iColumn = fixed_[i]; if ((iColumn & 0x10000000) != 0) { iColumn &= 0xfffffff; model->setColumnLower(iColumn, upper[iColumn]); } else { model->setColumnUpper(iColumn, lower[iColumn]); } } } else { // restore bounds assert (lower_); int iInteger = -1; const char * integerType = model->integerInformation(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerType[iColumn]) { iInteger++; if (lower_[iInteger] != static_cast (lower[iColumn])) model->setColumnLower(iColumn, lower_[iInteger]); if (upper_[iInteger] != static_cast (upper[iColumn])) model->setColumnUpper(iColumn, upper_[iInteger]); } } } if (doBoundsEtc && doBoundsEtc < 3) { //model->copyFactorization(*factorization_); model->copyFactorization(*factorization_); ClpDualRowSteepest* pivot = dynamic_cast< ClpDualRowSteepest*>(model->dualRowPivot()); if (pivot && weights_) { pivot->fill(*weights_); } int numberRows = model->numberRows(); int numberTotal = numberRows + numberColumns; CoinMemcpyN(status_, numberTotal, model->statusArray()); if (doBoundsEtc < 2) { CoinMemcpyN(primalSolution_, numberTotal, model->solutionRegion()); CoinMemcpyN(dualSolution_, numberTotal, model->djRegion()); CoinMemcpyN(pivotVariables_, numberRows, model->pivotVariable()); CoinMemcpyN(dualSolution_ + numberColumns, numberRows, model->dualRowSolution()); } else { CoinMemcpyN(primalSolution_, numberColumns, model->primalColumnSolution()); CoinMemcpyN(dualSolution_, numberColumns, model->dualColumnSolution()); CoinMemcpyN(dualSolution_ + numberColumns, numberRows, model->dualRowSolution()); if (model->columnScale()) { // See if just primal will work double * solution = model->primalColumnSolution(); const double * columnScale = model->columnScale(); int i; for (i = 0; i < numberColumns; i++) { solution[i] *= columnScale[i]; } } } model->setObjectiveValue(objectiveValue_); } } // Choose a new variable void ClpNode::chooseVariable(ClpSimplex * , ClpNodeStuff * /*info*/) { #if 0 int way = branchState_.firstBranch; if (branchState_.branch > 0) way = 1 - way; assert (!branchState_.branch); // We need to use pseudo costs to choose a variable int numberColumns = model->numberColumns(); #endif } // Fix on reduced costs int ClpNode::fixOnReducedCosts(ClpSimplex * ) { return 0; } /* Way for integer variable -1 down , +1 up */ int ClpNode::way() const { int way = branchState_.firstBranch; if (branchState_.branch > 0) way = 1 - way; return way == 0 ? -1 : +1; } // Return true if branch exhausted bool ClpNode::fathomed() const { return branchState_.branch >= 1 ; } // Change state of variable i.e. go other way void ClpNode::changeState() { branchState_.branch++; assert (branchState_.branch <= 2); } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpNodeStuff::ClpNodeStuff () : integerTolerance_(1.0e-7), integerIncrement_(1.0e-8), smallChange_(1.0e-8), downPseudo_(NULL), upPseudo_(NULL), priority_(NULL), numberDown_(NULL), numberUp_(NULL), numberDownInfeasible_(NULL), numberUpInfeasible_(NULL), saveCosts_(NULL), nodeInfo_(NULL), large_(NULL), whichRow_(NULL), whichColumn_(NULL), #ifndef NO_FATHOM_PRINT handler_(NULL), #endif nBound_(0), saveOptions_(0), solverOptions_(0), maximumNodes_(0), numberBeforeTrust_(0), stateOfSearch_(0), nDepth_(-1), nNodes_(0), numberNodesExplored_(0), numberIterations_(0), presolveType_(0) #ifndef NO_FATHOM_PRINT ,startingDepth_(-1), nodeCalled_(-1) #endif { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpNodeStuff::ClpNodeStuff (const ClpNodeStuff & rhs) : integerTolerance_(rhs.integerTolerance_), integerIncrement_(rhs.integerIncrement_), smallChange_(rhs.smallChange_), downPseudo_(NULL), upPseudo_(NULL), priority_(NULL), numberDown_(NULL), numberUp_(NULL), numberDownInfeasible_(NULL), numberUpInfeasible_(NULL), saveCosts_(NULL), nodeInfo_(NULL), large_(NULL), whichRow_(NULL), whichColumn_(NULL), #ifndef NO_FATHOM_PRINT handler_(rhs.handler_), #endif nBound_(0), saveOptions_(rhs.saveOptions_), solverOptions_(rhs.solverOptions_), maximumNodes_(rhs.maximumNodes_), numberBeforeTrust_(rhs.numberBeforeTrust_), stateOfSearch_(rhs.stateOfSearch_), nDepth_(rhs.nDepth_), nNodes_(rhs.nNodes_), numberNodesExplored_(rhs.numberNodesExplored_), numberIterations_(rhs.numberIterations_), presolveType_(rhs.presolveType_) #ifndef NO_FATHOM_PRINT ,startingDepth_(rhs.startingDepth_), nodeCalled_(rhs.nodeCalled_) #endif { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpNodeStuff & ClpNodeStuff::operator=(const ClpNodeStuff& rhs) { if (this != &rhs) { integerTolerance_ = rhs.integerTolerance_; integerIncrement_ = rhs.integerIncrement_; smallChange_ = rhs.smallChange_; downPseudo_ = NULL; upPseudo_ = NULL; priority_ = NULL; numberDown_ = NULL; numberUp_ = NULL; numberDownInfeasible_ = NULL; numberUpInfeasible_ = NULL; saveCosts_ = NULL; nodeInfo_ = NULL; large_ = NULL; whichRow_ = NULL; whichColumn_ = NULL; nBound_ = 0; saveOptions_ = rhs.saveOptions_; solverOptions_ = rhs.solverOptions_; maximumNodes_ = rhs.maximumNodes_; numberBeforeTrust_ = rhs.numberBeforeTrust_; stateOfSearch_ = rhs.stateOfSearch_; int n = maximumNodes(); if (n) { for (int i = 0; i < n; i++) delete nodeInfo_[i]; } delete [] nodeInfo_; nodeInfo_ = NULL; nDepth_ = rhs.nDepth_; nNodes_ = rhs.nNodes_; numberNodesExplored_ = rhs.numberNodesExplored_; numberIterations_ = rhs.numberIterations_; presolveType_ = rhs.presolveType_; #ifndef NO_FATHOM_PRINT handler_ = rhs.handler_; startingDepth_ = rhs.startingDepth_; nodeCalled_ = rhs.nodeCalled_; #endif } return *this; } // Zaps stuff 1 - arrays, 2 ints, 3 both void ClpNodeStuff::zap(int type) { if ((type & 1) != 0) { downPseudo_ = NULL; upPseudo_ = NULL; priority_ = NULL; numberDown_ = NULL; numberUp_ = NULL; numberDownInfeasible_ = NULL; numberUpInfeasible_ = NULL; saveCosts_ = NULL; nodeInfo_ = NULL; large_ = NULL; whichRow_ = NULL; whichColumn_ = NULL; } if ((type & 2) != 0) { nBound_ = 0; saveOptions_ = 0; solverOptions_ = 0; maximumNodes_ = 0; numberBeforeTrust_ = 0; stateOfSearch_ = 0; nDepth_ = -1; nNodes_ = 0; presolveType_ = 0; numberNodesExplored_ = 0; numberIterations_ = 0; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpNodeStuff::~ClpNodeStuff () { delete [] downPseudo_; delete [] upPseudo_; delete [] priority_; delete [] numberDown_; delete [] numberUp_; delete [] numberDownInfeasible_; delete [] numberUpInfeasible_; int n = maximumNodes(); if (n) { for (int i = 0; i < n; i++) delete nodeInfo_[i]; } delete [] nodeInfo_; #ifdef CLP_INVESTIGATE // Should be NULL - find out why not? assert (!saveCosts_); #endif delete [] saveCosts_; } // Return maximum number of nodes int ClpNodeStuff::maximumNodes() const { int n = 0; #if 0 if (nDepth_ != -1) { if ((solverOptions_ & 32) == 0) n = (1 << nDepth_); else if (nDepth_) n = 1; } assert (n == maximumNodes_ - (1 + nDepth_) || n == 0); #else if (nDepth_ != -1) { n = maximumNodes_ - (1 + nDepth_); assert (n > 0); } #endif return n; } // Return maximum space for nodes int ClpNodeStuff::maximumSpace() const { return maximumNodes_; } /* Fill with pseudocosts */ void ClpNodeStuff::fillPseudoCosts(const double * down, const double * up, const int * priority, const int * numberDown, const int * numberUp, const int * numberDownInfeasible, const int * numberUpInfeasible, int number) { delete [] downPseudo_; delete [] upPseudo_; delete [] priority_; delete [] numberDown_; delete [] numberUp_; delete [] numberDownInfeasible_; delete [] numberUpInfeasible_; downPseudo_ = CoinCopyOfArray(down, number); upPseudo_ = CoinCopyOfArray(up, number); priority_ = CoinCopyOfArray(priority, number); numberDown_ = CoinCopyOfArray(numberDown, number); numberUp_ = CoinCopyOfArray(numberUp, number); numberDownInfeasible_ = CoinCopyOfArray(numberDownInfeasible, number); numberUpInfeasible_ = CoinCopyOfArray(numberUpInfeasible, number); // scale for (int i = 0; i < number; i++) { int n; n = numberDown_[i]; if (n) downPseudo_[i] *= n; n = numberUp_[i]; if (n) upPseudo_[i] *= n; } } // Update pseudo costs void ClpNodeStuff::update(int way, int sequence, double change, bool feasible) { assert (numberDown_[sequence] >= numberDownInfeasible_[sequence]); assert (numberUp_[sequence] >= numberUpInfeasible_[sequence]); if (way < 0) { numberDown_[sequence]++; if (!feasible) numberDownInfeasible_[sequence]++; downPseudo_[sequence] += CoinMax(change, 1.0e-12); } else { numberUp_[sequence]++; if (!feasible) numberUpInfeasible_[sequence]++; upPseudo_[sequence] += CoinMax(change, 1.0e-12); } } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpHashValue::ClpHashValue () : hash_(NULL), numberHash_(0), maxHash_(0), lastUsed_(-1) { } //------------------------------------------------------------------- // Useful Constructor from model //------------------------------------------------------------------- ClpHashValue::ClpHashValue (ClpSimplex * model) : hash_(NULL), numberHash_(0), maxHash_(0), lastUsed_(-1) { maxHash_ = 1000; int numberColumns = model->numberColumns(); const double * columnLower = model->columnLower(); const double * columnUpper = model->columnUpper(); int numberRows = model->numberRows(); const double * rowLower = model->rowLower(); const double * rowUpper = model->rowUpper(); const double * objective = model->objective(); CoinPackedMatrix * matrix = model->matrix(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); int i; int ipos; hash_ = new CoinHashLink[maxHash_]; for ( i = 0; i < maxHash_; i++ ) { hash_[i].value = -1.0e-100; hash_[i].index = -1; hash_[i].next = -1; } // Put in +0 hash_[0].value = 0.0; hash_[0].index = 0; numberHash_ = 1; /* * Initialize the hash table. Only the index of the first value that * hashes to a value is entered in the table; subsequent values that * collide with it are not entered. */ for ( i = 0; i < numberColumns; i++ ) { int length = columnLength[i]; CoinBigIndex start = columnStart[i]; for (CoinBigIndex i = start; i < start + length; i++) { double value = elementByColumn[i]; ipos = hash ( value); if ( hash_[ipos].index == -1 ) { hash_[ipos].index = numberHash_; numberHash_++; hash_[ipos].value = elementByColumn[i]; } } } /* * Now take care of the values that collided in the preceding loop, * Also do other stuff */ for ( i = 0; i < numberRows; i++ ) { if (numberHash_ * 2 > maxHash_) resize(true); double value; value = rowLower[i]; ipos = index(value); if (ipos < 0) addValue(value); value = rowUpper[i]; ipos = index(value); if (ipos < 0) addValue(value); } for ( i = 0; i < numberColumns; i++ ) { int length = columnLength[i]; CoinBigIndex start = columnStart[i]; if (numberHash_ * 2 > maxHash_) resize(true); double value; value = objective[i]; ipos = index(value); if (ipos < 0) addValue(value); value = columnLower[i]; ipos = index(value); if (ipos < 0) addValue(value); value = columnUpper[i]; ipos = index(value); if (ipos < 0) addValue(value); for (CoinBigIndex j = start; j < start + length; j++) { if (numberHash_ * 2 > maxHash_) resize(true); value = elementByColumn[j]; ipos = index(value); if (ipos < 0) addValue(value); } } resize(false); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpHashValue::ClpHashValue (const ClpHashValue & rhs) : hash_(NULL), numberHash_(rhs.numberHash_), maxHash_(rhs.maxHash_), lastUsed_(rhs.lastUsed_) { if (maxHash_) { CoinHashLink * newHash = new CoinHashLink[maxHash_]; int i; for ( i = 0; i < maxHash_; i++ ) { newHash[i].value = rhs.hash_[i].value; newHash[i].index = rhs.hash_[i].index; newHash[i].next = rhs.hash_[i].next; } } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpHashValue::~ClpHashValue () { delete [] hash_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpHashValue & ClpHashValue::operator=(const ClpHashValue& rhs) { if (this != &rhs) { numberHash_ = rhs.numberHash_; maxHash_ = rhs.maxHash_; lastUsed_ = rhs.lastUsed_; delete [] hash_; if (maxHash_) { CoinHashLink * newHash = new CoinHashLink[maxHash_]; int i; for ( i = 0; i < maxHash_; i++ ) { newHash[i].value = rhs.hash_[i].value; newHash[i].index = rhs.hash_[i].index; newHash[i].next = rhs.hash_[i].next; } } else { hash_ = NULL; } } return *this; } // Return index or -1 if not found int ClpHashValue::index(double value) const { if (!value) return 0; int ipos = hash ( value); int returnCode = -1; while ( hash_[ipos].index >= 0 ) { if (value == hash_[ipos].value) { returnCode = hash_[ipos].index; break; } else { int k = hash_[ipos].next; if ( k == -1 ) { break; } else { ipos = k; } } } return returnCode; } // Add value to list and return index int ClpHashValue::addValue(double value) { int ipos = hash ( value); assert (value != hash_[ipos].value); if (hash_[ipos].index == -1) { // can put in here hash_[ipos].index = numberHash_; numberHash_++; hash_[ipos].value = value; return numberHash_ - 1; } int k = hash_[ipos].next; while (k != -1) { ipos = k; k = hash_[ipos].next; } while ( true ) { ++lastUsed_; assert (lastUsed_ <= maxHash_); if ( hash_[lastUsed_].index == -1 ) { break; } } hash_[ipos].next = lastUsed_; hash_[lastUsed_].index = numberHash_; numberHash_++; hash_[lastUsed_].value = value; return numberHash_ - 1; } namespace { /* Originally a local static variable in ClpHashValue::hash. Local static variables are a problem when building DLLs on Windows, but file-local constants seem to be ok. -- lh, 101016 -- */ const int mmult_for_hash[] = { 262139, 259459, 256889, 254291, 251701, 249133, 246709, 244247, 241667, 239179, 236609, 233983, 231289, 228859, 226357, 223829, 221281, 218849, 216319, 213721, 211093, 208673, 206263, 203773, 201233, 198637, 196159, 193603, 191161, 188701, 186149, 183761, 181303, 178873, 176389, 173897, 171469, 169049, 166471, 163871, 161387, 158941, 156437, 153949, 151531, 149159, 146749, 144299, 141709, 139369, 136889, 134591, 132169, 129641, 127343, 124853, 122477, 120163, 117757, 115361, 112979, 110567, 108179, 105727, 103387, 101021, 98639, 96179, 93911, 91583, 89317, 86939, 84521, 82183, 79939, 77587, 75307, 72959, 70793, 68447, 66103 }; } int ClpHashValue::hash ( double value) const { union { double d; char c[8]; } v1; assert (sizeof(double) == 8); v1.d = value; int n = 0; int j; for ( j = 0; j < 8; ++j ) { int ichar = v1.c[j]; n += mmult_for_hash[j] * ichar; } return ( abs ( n ) % maxHash_ ); /* integer abs */ } void ClpHashValue::resize(bool increaseMax) { int newSize = increaseMax ? ((3 * maxHash_) >> 1) + 1000 : maxHash_; CoinHashLink * newHash = new CoinHashLink[newSize]; int i; for ( i = 0; i < newSize; i++ ) { newHash[i].value = -1.0e-100; newHash[i].index = -1; newHash[i].next = -1; } // swap CoinHashLink * oldHash = hash_; hash_ = newHash; int oldSize = maxHash_; maxHash_ = newSize; /* * Initialize the hash table. Only the index of the first value that * hashes to a value is entered in the table; subsequent values that * collide with it are not entered. */ int ipos; int n = 0; for ( i = 0; i < oldSize; i++ ) { if (oldHash[i].index >= 0) { ipos = hash ( oldHash[i].value); if ( hash_[ipos].index == -1 ) { hash_[ipos].index = n; n++; hash_[ipos].value = oldHash[i].value; // unmark oldHash[i].index = -1; } } } /* * Now take care of the values that collided in the preceding loop, * by finding some other entry in the table for them. * Since there are as many entries in the table as there are values, * there must be room for them. */ lastUsed_ = -1; for ( i = 0; i < oldSize; ++i ) { if (oldHash[i].index >= 0) { double value = oldHash[i].value; ipos = hash ( value); int k; while ( true ) { assert (value != hash_[ipos].value); k = hash_[ipos].next; if ( k == -1 ) { while ( true ) { ++lastUsed_; assert (lastUsed_ <= maxHash_); if ( hash_[lastUsed_].index == -1 ) { break; } } hash_[ipos].next = lastUsed_; hash_[lastUsed_].index = n; n++; hash_[lastUsed_].value = value; break; } else { ipos = k; } } } } assert (n == numberHash_); delete [] oldHash; } CoinMP-1.8.3/Clp/src/ClpConstraint.hpp0000644000175000017500000000724111510657452016127 0ustar renerene/* $Id: ClpConstraint.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpConstraint_H #define ClpConstraint_H //############################################################################# class ClpSimplex; class ClpModel; /** Constraint Abstract Base Class Abstract Base Class for describing a constraint or objective function */ class ClpConstraint { public: ///@name Stuff //@{ /** Fills gradient. If Linear then solution may be NULL, also returns true value of function and offset so we can use x not deltaX in constraint If refresh is false then uses last solution Uses model for scaling Returns non-zero if gradient undefined at current solution */ virtual int gradient(const ClpSimplex * model, const double * solution, double * gradient, double & functionValue , double & offset, bool useScaling = false, bool refresh = true) const = 0; /// Constraint function value virtual double functionValue (const ClpSimplex * model, const double * solution, bool useScaling = false, bool refresh = true) const ; /// Resize constraint virtual void resize(int newNumberColumns) = 0; /// Delete columns in constraint virtual void deleteSome(int numberToDelete, const int * which) = 0; /// Scale constraint virtual void reallyScale(const double * columnScale) = 0; /** Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ virtual int markNonlinear(char * which) const = 0; /** Given a zeroed array sets possible nonzero coefficients to 1. Returns number of nonzeros */ virtual int markNonzero(char * which) const = 0; //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpConstraint(); /// Copy constructor ClpConstraint(const ClpConstraint &); /// Assignment operator ClpConstraint & operator=(const ClpConstraint& rhs); /// Destructor virtual ~ClpConstraint (); /// Clone virtual ClpConstraint * clone() const = 0; //@} ///@name Other //@{ /// Returns type, 0 linear, 1 nonlinear inline int type() { return type_; } /// Row number (-1 is objective) inline int rowNumber() const { return rowNumber_; } /// Number of possible coefficients in gradient virtual int numberCoefficients() const = 0; /// Stored constraint function value inline double functionValue () const { return functionValue_; } /// Constraint offset inline double offset () const { return offset_; } /// Say we have new primal solution - so may need to recompute virtual void newXValues() {} //@} //--------------------------------------------------------------------------- protected: ///@name Protected member data //@{ /// Gradient at last evaluation mutable double * lastGradient_; /// Value of non-linear part of constraint mutable double functionValue_; /// Value of offset for constraint mutable double offset_; /// Type of constraint - linear is 1 int type_; /// Row number (-1 is objective) int rowNumber_; //@} }; #endif CoinMP-1.8.3/Clp/src/AbcDualRowDantzig.cpp0000644000175000017500000003122112101105055016616 0ustar renerene/* $Id: AbcDualRowDantzig.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "AbcSimplex.hpp" #include "AbcDualRowDantzig.hpp" #include "AbcSimplexFactorization.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #ifndef CLP_DUAL_COLUMN_MULTIPLIER #define CLP_DUAL_COLUMN_MULTIPLIER 1.01 #endif //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcDualRowDantzig::AbcDualRowDantzig () : AbcDualRowPivot(), infeasible_(NULL) { type_ = 1; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcDualRowDantzig::AbcDualRowDantzig (const AbcDualRowDantzig & rhs) : AbcDualRowPivot(rhs), infeasible_(NULL) { model_ = rhs.model_; if ((model_ && model_->whatsChanged() & 1) != 0) { if (rhs.infeasible_) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcDualRowDantzig::~AbcDualRowDantzig () { delete infeasible_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcDualRowDantzig & AbcDualRowDantzig::operator=(const AbcDualRowDantzig& rhs) { if (this != &rhs) { AbcDualRowPivot::operator=(rhs); delete infeasible_; if (rhs.infeasible_ != NULL) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } } return *this; } /* 1) before factorization 2) after factorization 3) just redo infeasibilities 4) restore weights */ void AbcDualRowDantzig::saveWeights(AbcSimplex * model, int mode) { model_ = model; int numberRows = model_->numberRows(); if (mode == 1) { // Check if size has changed if (infeasible_&&infeasible_->capacity() != numberRows) { // size has changed - clear everything delete infeasible_; infeasible_ = NULL; } } else if (mode !=3 && !infeasible_) { infeasible_ = new CoinIndexedVector(); infeasible_->reserve(numberRows); } if (mode >= 2) { recomputeInfeasibilities(); } } // Recompute infeasibilities void AbcDualRowDantzig::recomputeInfeasibilities() { int numberRows = model_->numberRows(); infeasible_->clear(); double tolerance = model_->currentPrimalTolerance(); const double * COIN_RESTRICT solutionBasic = model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic = model_->lowerBasic(); const double * COIN_RESTRICT upperBasic = model_->upperBasic(); for (int iRow = 0; iRow < numberRows; iRow++) { double value = solutionBasic[iRow]; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; if (value < lower - tolerance) { value -= lower; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store in list infeasible_->quickAdd(iRow, fabs(value)); } else if (value > upper + tolerance) { value -= upper; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store in list infeasible_->quickAdd(iRow, fabs(value)); } } } #if ABC_PARALLEL==2 static void choose(CoinIndexedVector * infeasible, int & chosenRowSave,double & largestSave, int first, int last, double tolerance) { if (last-first>256) { int mid=(last+first)>>1; int chosenRow2=chosenRowSave; double largest2=largestSave; cilk_spawn choose(infeasible,chosenRow2,largest2, first, mid, tolerance); choose(infeasible,chosenRowSave,largestSave, mid, last, tolerance); cilk_sync; if (largest2>largestSave) { largestSave=largest2; chosenRowSave=chosenRow2; } } else { const int * index=infeasible->getIndices(); const double * infeas=infeasible->denseVector(); double largest=largestSave; int chosenRow=chosenRowSave; for (int i = first; i < last; i++) { int iRow = index[i]; double value = infeas[iRow]; if (value > largest) { largest=value; chosenRow=iRow; } } chosenRowSave=chosenRow; largestSave=largest; } } #endif // Returns pivot row, -1 if none int AbcDualRowDantzig::pivotRow() { assert(model_); double * COIN_RESTRICT infeas = infeasible_->denseVector(); int * COIN_RESTRICT index = infeasible_->getIndices(); int number = infeasible_->getNumElements(); double tolerance = model_->currentPrimalTolerance(); // we can't really trust infeasibilities if there is primal error if (model_->largestPrimalError() > 1.0e-8) tolerance *= model_->largestPrimalError() / 1.0e-8; int numberRows = model_->numberRows(); const double * COIN_RESTRICT solutionBasic=model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic=model_->lowerBasic(); const double * COIN_RESTRICT upperBasic=model_->upperBasic(); const int * pivotVariable = model_->pivotVariable(); // code so has list of infeasibilities (like steepest) int numberWanted=CoinMax(2000,numberRows>>4); numberWanted=CoinMax(numberWanted,number>>2); if (model_->largestPrimalError() > 1.0e-3) numberWanted = number + 1; // be safe // Setup two passes int start[4]; start[1] = number; start[2] = 0; double dstart = static_cast (number) * model_->randomNumberGenerator()->randomDouble(); start[0] = static_cast (dstart); start[3] = start[0]; double largest = tolerance; int chosenRow = -1; int saveNumberWanted=numberWanted; #ifdef DO_REDUCE bool doReduce=true; int lastChosen=-1; double lastLargest=0.0; #endif for (int iPass = 0; iPass < 2; iPass++) { int endThis = start[2*iPass+1]; int startThis=start[2*iPass]; while (startThis=0); if (model_->flagged(pivotVariable[chosenRow])|| (solutionBasic[chosenRow] <= upperBasic[chosenRow] + tolerance && solutionBasic[chosenRow] >= lowerBasic[chosenRow] - tolerance)) { doReduce=false; chosenRow=lastChosen; largest=lastLargest; } else { lastChosen=chosenRow; lastLargest=largest; } } } if (!doReduce) { #endif for (int i = startThis; i < end; i++) { int iRow = index[i]; double value = infeas[iRow]; if (value > largest) { if (!model_->flagged(pivotVariable[iRow])) { if (solutionBasic[iRow] > upperBasic[iRow] + tolerance || solutionBasic[iRow] < lowerBasic[iRow] - tolerance) { chosenRow = iRow; largest = value; } } } } #ifdef DO_REDUCE } #endif numberWanted-=(end-startThis); if (!numberWanted) { if(chosenRow>=0) break; else numberWanted=(saveNumberWanted+1)>>1; } startThis=end; } if (!numberWanted) { if(chosenRow>=0) break; else numberWanted=(saveNumberWanted+1)>>1; } } return chosenRow; } // FT update and returns pivot alpha double AbcDualRowDantzig::updateWeights(CoinIndexedVector & input,CoinIndexedVector & updatedColumn) { // Do FT update model_->factorization()->updateColumnFT(updatedColumn); // pivot element double alpha = 0.0; // look at updated column double * work = updatedColumn.denseVector(); int pivotRow = model_->lastPivotRow(); assert (pivotRow == model_->pivotRow()); assert (!updatedColumn.packedMode()); alpha = work[pivotRow]; return alpha; } double AbcDualRowDantzig::updateWeights1(CoinIndexedVector & input,CoinIndexedVector & updateColumn) { return updateWeights(input,updateColumn); } #if ABC_PARALLEL==2 static void update(int first, int last, const int * COIN_RESTRICT which, double * COIN_RESTRICT work, const double * COIN_RESTRICT lowerBasic,double * COIN_RESTRICT solutionBasic, const double * COIN_RESTRICT upperBasic,double theta,double tolerance) { if (last-first>256) { int mid=(last+first)>>1; cilk_spawn update(first,mid,which,work,lowerBasic,solutionBasic, upperBasic,theta,tolerance); update(mid,last,which,work,lowerBasic,solutionBasic, upperBasic,theta,tolerance); cilk_sync; } else { for (int i = first; i < last; i++) { int iRow = which[i]; double updateValue = work[iRow]; double value = solutionBasic[iRow]; double change = theta * updateValue; value -= change; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; solutionBasic[iRow] = value; if (value < lower - tolerance) { value -= lower; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif } else if (value > upper + tolerance) { value -= upper; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif } else { // feasible value=0.0; } // store work[iRow]=fabs(value); } } } #endif /* Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Computes change in objective function */ void AbcDualRowDantzig::updatePrimalSolution(CoinIndexedVector & primalUpdate, double theta) { double * COIN_RESTRICT work = primalUpdate.denseVector(); int numberNonZero = primalUpdate.getNumElements(); int * which = primalUpdate.getIndices(); double tolerance = model_->currentPrimalTolerance(); double * COIN_RESTRICT infeas = infeasible_->denseVector(); double * COIN_RESTRICT solutionBasic = model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic = model_->lowerBasic(); const double * COIN_RESTRICT upperBasic = model_->upperBasic(); assert (!primalUpdate.packedMode()); #if 0 //ABC_PARALLEL==2 update(0,numberNonZero,which,work, lowerBasic,solutionBasic,upperBasic, theta,tolerance); for (int i = 0; i < numberNonZero; i++) { int iRow = which[i]; double infeasibility=work[iRow]; work[iRow]=0.0; if (infeasibility) { if (infeas[iRow]) infeas[iRow] = infeasibility; // already there else infeasible_->quickAdd(iRow, infeasibility); } else { // feasible - was it infeasible - if so set tiny if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } #else for (int i = 0; i < numberNonZero; i++) { int iRow = which[i]; double updateValue = work[iRow]; work[iRow]=0.0; double value = solutionBasic[iRow]; double change = theta * updateValue; value -= change; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; solutionBasic[iRow] = value; if (value < lower - tolerance) { value -= lower; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store in list if (infeas[iRow]) infeas[iRow] = fabs(value); // already there else infeasible_->quickAdd(iRow, fabs(value)); } else if (value > upper + tolerance) { value -= upper; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store in list if (infeas[iRow]) infeas[iRow] = fabs(value); // already there else infeasible_->quickAdd(iRow, fabs(value)); } else { // feasible - was it infeasible - if so set tiny if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } #endif primalUpdate.setNumElements(0); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- AbcDualRowPivot * AbcDualRowDantzig::clone(bool CopyData) const { if (CopyData) { return new AbcDualRowDantzig(*this); } else { return new AbcDualRowDantzig(); } } CoinMP-1.8.3/Clp/src/ClpEventHandler.cpp0000644000175000017500000000673511662222261016356 0ustar renerene/* $Id: ClpEventHandler.cpp 1825 2011-11-20 16:02:57Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpEventHandler.hpp" #include "ClpSimplex.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpEventHandler::ClpEventHandler (ClpSimplex * model) : model_(model) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpEventHandler::ClpEventHandler (const ClpEventHandler & rhs) : model_(rhs.model_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpEventHandler::~ClpEventHandler () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpEventHandler & ClpEventHandler::operator=(const ClpEventHandler& rhs) { if (this != &rhs) { model_ = rhs.model_; } return *this; } // Clone ClpEventHandler * ClpEventHandler::clone() const { return new ClpEventHandler(*this); } // Event int ClpEventHandler::event(Event whichEvent) { if (whichEvent != theta) return -1; // do nothing else return 0; // say normal exit } /* This can do whatever it likes. Return code -1 means no action. This passes in something */ int ClpEventHandler::eventWithInfo(Event whichEvent, void * info) { return -1; } /* set model. */ void ClpEventHandler::setSimplex(ClpSimplex * model) { model_ = model; } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpDisasterHandler::ClpDisasterHandler (ClpSimplex * model) : model_(model) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpDisasterHandler::ClpDisasterHandler (const ClpDisasterHandler & rhs) : model_(rhs.model_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpDisasterHandler::~ClpDisasterHandler () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpDisasterHandler & ClpDisasterHandler::operator=(const ClpDisasterHandler& rhs) { if (this != &rhs) { model_ = rhs.model_; } return *this; } /* set model. */ void ClpDisasterHandler::setSimplex(ClpSimplex * model) { model_ = model; } // Type of disaster 0 can fix, 1 abort int ClpDisasterHandler::typeOfDisaster() { return 0; } CoinMP-1.8.3/Clp/src/ClpCholeskyMumps.cpp0000644000175000017500000004033612130037657016601 0ustar renerene/* $Id: ClpCholeskyMumps.cpp 1929 2013-04-06 15:30:55Z stefan $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpConfig.h" #define MPI_COMM_WORLD CLP_MPI_COMM_WORLD #define JOB_INIT -1 #define JOB_END -2 #define USE_COMM_WORLD -987654 extern "C" { #include "dmumps_c.h" #include "mpi.h" } #include "ClpCholeskyMumps.hpp" #include "ClpMessage.hpp" #include "ClpInterior.hpp" #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpCholeskyMumps::ClpCholeskyMumps (int denseThreshold) : ClpCholeskyBase(denseThreshold) { mumps_ = (DMUMPS_STRUC_C*)malloc(sizeof(DMUMPS_STRUC_C)); type_ = 16; mumps_->n = 0; mumps_->nz = 0; mumps_->a = NULL; mumps_->jcn = NULL; mumps_->irn = NULL; mumps_->job = JOB_INIT;//initialize mumps mumps_->par = 1;//working host for sequential version mumps_->sym = 2;//general symmetric matrix mumps_->comm_fortran = USE_COMM_WORLD; int myid; int justName; MPI_Init(&justName, NULL); #ifndef NDEBUG int ierr = MPI_Comm_rank(MPI_COMM_WORLD, &myid); assert (!ierr); #else MPI_Comm_rank(MPI_COMM_WORLD, &myid); #endif dmumps_c(mumps_); #define ICNTL(I) icntl[(I)-1] /* macro s.t. indices match documentation */ #define CNTL(I) cntl[(I)-1] /* macro s.t. indices match documentation */ mumps_->ICNTL(5) = 1; // say compressed format mumps_->ICNTL(4) = 2; // log messages mumps_->ICNTL(24) = 1; // Deal with zeros on diagonal mumps_->CNTL(3) = 1.0e-20; // drop if diagonal less than this // output off mumps_->ICNTL(1) = -1; mumps_->ICNTL(2) = -1; mumps_->ICNTL(3) = -1; mumps_->ICNTL(4) = 0; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpCholeskyMumps::ClpCholeskyMumps (const ClpCholeskyMumps & rhs) : ClpCholeskyBase(rhs) { abort(); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpCholeskyMumps::~ClpCholeskyMumps () { mumps_->job = JOB_END; dmumps_c(mumps_); /* Terminate instance */ MPI_Finalize(); free(mumps_); } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpCholeskyMumps & ClpCholeskyMumps::operator=(const ClpCholeskyMumps& rhs) { if (this != &rhs) { ClpCholeskyBase::operator=(rhs); abort(); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpCholeskyBase * ClpCholeskyMumps::clone() const { return new ClpCholeskyMumps(*this); } /* Orders rows and saves pointer to matrix.and model */ int ClpCholeskyMumps::order(ClpInterior * model) { numberRows_ = model->numberRows(); if (doKKT_) { numberRows_ += numberRows_ + model->numberColumns(); printf("finish coding MUMPS KKT!\n"); abort(); } rowsDropped_ = new char [numberRows_]; memset(rowsDropped_, 0, numberRows_); numberRowsDropped_ = 0; model_ = model; rowCopy_ = model->clpMatrix()->reverseOrderedCopy(); const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); // We need two arrays for counts int * which = new int [numberRows_]; int * used = new int[numberRows_+1]; CoinZeroN(used, numberRows_); int iRow; sizeFactor_ = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; } } delete [] which; // NOT COMPRESSED FOR NOW ??? - Space for starts mumps_->ICNTL(5) = 0; // say NOT compressed format try { choleskyStart_ = new CoinBigIndex[numberRows_+1+sizeFactor_]; } catch (...) { // no memory return -1; } // Now we have size - create arrays and fill in try { choleskyRow_ = new int [sizeFactor_]; } catch (...) { // no memory delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } try { sparseFactor_ = new double[sizeFactor_]; } catch (...) { // no memory delete [] choleskyRow_; choleskyRow_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } sizeFactor_ = 0; which = choleskyRow_; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; choleskyStart_[iRow] = sizeFactor_; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; // Sort std::sort(which, which + number); // move which on which += number; } } choleskyStart_[numberRows_] = sizeFactor_; delete [] used; permuteInverse_ = new int [numberRows_]; permute_ = new int[numberRows_]; // To Fortran and fake for (iRow = 0; iRow < numberRows_ + 1; iRow++) { int k = choleskyStart_[iRow]; int kEnd = choleskyStart_[iRow+1]; k += numberRows_ + 1; kEnd += numberRows_ + 1; for (; k < kEnd; k++) choleskyStart_[k] = iRow + 1; choleskyStart_[iRow]++; } mumps_->nz = sizeFactor_; mumps_->irn = choleskyStart_ + numberRows_ + 1; mumps_->jcn = choleskyRow_; mumps_->a = NULL; for (CoinBigIndex i = 0; i < sizeFactor_; i++) { choleskyRow_[i]++; #ifndef NDEBUG assert (mumps_->irn[i] >= 1 && mumps_->irn[i] <= numberRows_); assert (mumps_->jcn[i] >= 1 && mumps_->jcn[i] <= numberRows_); #endif } // validate //mumps code here mumps_->n = numberRows_; mumps_->nelt = numberRows_; mumps_->eltptr = choleskyStart_; mumps_->eltvar = choleskyRow_; mumps_->a_elt = NULL; mumps_->rhs = NULL; mumps_->job = 1; // order dmumps_c(mumps_); mumps_->a = sparseFactor_; if (mumps_->infog[0]) { COIN_DETAIL_PRINT(printf("MUMPS ordering failed -error %d %d\n", mumps_->infog[0], mumps_->infog[1])); return 1; } else { double size = mumps_->infog[19]; if (size < 0) size *= -1000000; COIN_DETAIL_PRINT(printf("%g nonzeros, flop count %g\n", size, mumps_->rinfog[0])); } for (iRow = 0; iRow < numberRows_; iRow++) { permuteInverse_[iRow] = iRow; permute_[iRow] = iRow; } return 0; } /* Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ int ClpCholeskyMumps::symbolic() { return 0; } /* Factorize - filling in rowsDropped and returning number dropped */ int ClpCholeskyMumps::factorize(const double * diagonal, int * rowsDropped) { const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const double * element = model_->clpMatrix()->getElements(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); const double * elementByRow = rowCopy_->getElements(); int numberColumns = model_->clpMatrix()->getNumCols(); int iRow; double * work = new double[numberRows_]; CoinZeroN(work, numberRows_); const double * diagonalSlack = diagonal + numberColumns; int newDropped = 0; //double smallest; //perturbation double perturbation = model_->diagonalPerturbation() * model_->diagonalNorm(); perturbation = 0.0; perturbation = perturbation * perturbation; if (perturbation > 1.0) { #ifdef COIN_DEVELOP //if (model_->model()->logLevel()&4) std::cout << "large perturbation " << perturbation << std::endl; #endif perturbation = sqrt(perturbation);; perturbation = 1.0; } double delta2 = model_->delta(); // add delta*delta to diagonal delta2 *= delta2; for (iRow = 0; iRow < numberRows_; iRow++) { double * put = sparseFactor_ + choleskyStart_[iRow] - 1; // Fortran int * which = choleskyRow_ + choleskyStart_[iRow] - 1; // Fortran int number = choleskyStart_[iRow+1] - choleskyStart_[iRow]; if (!rowLength[iRow]) rowsDropped_[iRow] = 1; if (!rowsDropped_[iRow]) { CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; work[iRow] = diagonalSlack[iRow] + delta2; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; double multiplier = diagonal[iColumn] * elementByRow[k]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow && !rowsDropped_[jRow]) { double value = element[j] * multiplier; work[jRow] += value; } } } } int j; for (j = 0; j < number; j++) { int jRow = which[j] - 1; // to Fortran put[j] = work[jRow]; work[jRow] = 0.0; } } else { // dropped int j; for (j = 1; j < number; j++) { put[j] = 0.0; } put[0] = 1.0; } } //check sizes double largest2 = maximumAbsElement(sparseFactor_, sizeFactor_); largest2 *= 1.0e-20; int numberDroppedBefore = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int dropped = rowsDropped_[iRow]; // Move to int array rowsDropped[iRow] = dropped; if (!dropped) { CoinBigIndex start = choleskyStart_[iRow] - 1; // to Fortran double diagonal = sparseFactor_[start]; if (diagonal > largest2) { sparseFactor_[start] = CoinMax(diagonal, 1.0e-10); } else { sparseFactor_[start] = CoinMax(diagonal, 1.0e-10); rowsDropped[iRow] = 2; numberDroppedBefore++; } } } delete [] work; // code here mumps_->a_elt = sparseFactor_; mumps_->rhs = NULL; mumps_->job = 2; // factorize dmumps_c(mumps_); if (mumps_->infog[0]) { COIN_DETAIL_PRINT(printf("MUMPS factorization failed -error %d %d\n", mumps_->infog[0], mumps_->infog[1])); } choleskyCondition_ = 1.0; bool cleanCholesky; if (model_->numberIterations() < 2000) cleanCholesky = true; else cleanCholesky = false; if (cleanCholesky) { //drop fresh makes some formADAT easier //int oldDropped=numberRowsDropped_; if (newDropped || numberRowsDropped_) { //std::cout <<"Rank "<oldDropped) //std::cout<<" ( "<rhs = region; mumps_->job = 3; // solve dmumps_c(mumps_); } CoinMP-1.8.3/Clp/src/ClpEventHandler.hpp0000644000175000017500000001264612561142776016374 0ustar renerene/* $Id: ClpEventHandler.hpp 2156 2015-08-07 14:51:42Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpEventHandler_H #define ClpEventHandler_H #include "ClpSimplex.hpp" /** Base class for Clp event handling This is just here to allow for event handling. By event I mean a Clp event e.g. end of values pass. One use would be to let a user handle a system event e.g. Control-C. This could be done by deriving a class MyEventHandler which knows about such events. If one occurs MyEventHandler::event() could clear event status and return 3 (stopped). Clp would then return to user code. As it is called every iteration this should be fine grained enough. User can derive and construct from CbcModel - not pretty */ class ClpEventHandler { public: /** enums for what sort of event. These will also be returned in ClpModel::secondaryStatus() as int */ enum Event { endOfIteration = 100, // used to set secondary status endOfFactorization, // after gutsOfSolution etc endOfValuesPass, node, // for Cbc treeStatus, // for Cbc solution, // for Cbc theta, // hit in parametrics pivotRow, // used to choose pivot row presolveStart, // ClpSolve presolve start presolveSize, // sees if ClpSolve presolve too big or too small presolveInfeasible, // ClpSolve presolve infeasible presolveBeforeSolve, // ClpSolve presolve before solve presolveAfterFirstSolve, // ClpSolve presolve after solve presolveAfterSolve, // ClpSolve presolve after solve presolveEnd, // ClpSolve presolve end goodFactorization, // before gutsOfSolution complicatedPivotIn, // in modifyCoefficients noCandidateInPrimal, // tentative end looksEndInPrimal, // About to declare victory (or defeat) endInPrimal, // Victory (or defeat) beforeStatusOfProblemInPrimal, startOfStatusOfProblemInPrimal, complicatedPivotOut, // in modifyCoefficients noCandidateInDual, // tentative end looksEndInDual, // About to declare victory (or defeat) endInDual, // Victory (or defeat) beforeStatusOfProblemInDual, startOfStatusOfProblemInDual, startOfIterationInDual, updateDualsInDual, endOfCreateRim, slightlyInfeasible, modifyMatrixInMiniPresolve, moreMiniPresolve, modifyMatrixInMiniPostsolve, startOfCrossover, // in Idiot noTheta // At end (because no pivot) }; /**@name Virtual method that the derived classes should provide. The base class instance does nothing and as event() is only useful method it would not be very useful NOT providing one! */ //@{ /** This can do whatever it likes. If return code -1 then carries on if 0 sets ClpModel::status() to 5 (stopped by event) and will return to user. At present if <-1 carries on and if >0 acts as if 0 - this may change. For ClpSolve 2 -> too big return status of -2 and -> too small 3 */ virtual int event(Event whichEvent); /** This can do whatever it likes. Return code -1 means no action. This passes in something */ virtual int eventWithInfo(Event whichEvent, void * info) ; //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpEventHandler(ClpSimplex * model = NULL); /** Destructor */ virtual ~ClpEventHandler(); // Copy ClpEventHandler(const ClpEventHandler&); // Assignment ClpEventHandler& operator=(const ClpEventHandler&); /// Clone virtual ClpEventHandler * clone() const; //@} /**@name Sets/gets */ //@{ /** set model. */ void setSimplex(ClpSimplex * model); /// Get model inline ClpSimplex * simplex() const { return model_; } //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer to simplex ClpSimplex * model_; //@} }; /** Base class for Clp disaster handling This is here to allow for disaster handling. By disaster I mean that Clp would otherwise give up */ class ClpDisasterHandler { public: /**@name Virtual methods that the derived classe should provide. */ //@{ /// Into simplex virtual void intoSimplex() = 0; /// Checks if disaster virtual bool check() const = 0; /// saves information for next attempt virtual void saveInfo() = 0; /// Type of disaster 0 can fix, 1 abort virtual int typeOfDisaster(); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpDisasterHandler(ClpSimplex * model = NULL); /** Destructor */ virtual ~ClpDisasterHandler(); // Copy ClpDisasterHandler(const ClpDisasterHandler&); // Assignment ClpDisasterHandler& operator=(const ClpDisasterHandler&); /// Clone virtual ClpDisasterHandler * clone() const = 0; //@} /**@name Sets/gets */ //@{ /** set model. */ void setSimplex(ClpSimplex * model); /// Get model inline ClpSimplex * simplex() const { return model_; } //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer to simplex ClpSimplex * model_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpPrimalColumnPivot.hpp0000644000175000017500000001146311571121105017414 0ustar renerene/* $Id: ClpPrimalColumnPivot.hpp 1732 2011-05-31 08:09:41Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpPrimalcolumnPivot_H #define ClpPrimalcolumnPivot_H class ClpSimplex; class CoinIndexedVector; //############################################################################# /** Primal Column Pivot Abstract Base Class Abstract Base Class for describing an interface to an algorithm to choose column pivot in primal simplex algorithm. For some algorithms e.g. Dantzig choice then some functions may be null. For Dantzig the only one of any importance is pivotColumn. If you wish to inherit from this look at ClpPrimalColumnDantzig.cpp as that is simplest version. */ class ClpPrimalColumnPivot { public: ///@name Algorithmic methods //@{ /** Returns pivot column, -1 if none Normally updates reduced costs using result of last iteration before selecting incoming column. The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row Inside pivotColumn the pivotRow_ and reduced cost from last iteration are also used. So in the simplest case i.e. feasible we compute the row of the tableau corresponding to last pivot and add a multiple of this to current reduced costs. We can use other arrays to help updates */ virtual int pivotColumn(CoinIndexedVector * updates, CoinIndexedVector * spareRow1, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) = 0; /// Updates weights - part 1 (may be empty) virtual void updateWeights(CoinIndexedVector * input); /** Saves any weights round factorization as pivot rows may change Will be empty unless steepest edge (will save model) May also recompute infeasibility stuff 1) before factorization 2) after good factorization (if weights empty may initialize) 3) after something happened but no factorization (e.g. check for infeasible) 4) as 2 but restore weights from previous snapshot 5) forces some initialization e.g. weights Also sets model */ virtual void saveWeights(ClpSimplex * model, int mode) = 0; /** Signals pivot row choice: -2 (default) - use normal pivot row choice -1 to numberRows-1 - use this (will be checked) way should be -1 to go to lower bound, +1 to upper bound */ virtual int pivotRow(double & way) { way = 0; return -2; } /// Gets rid of all arrays (may be empty) virtual void clearArrays(); /// Returns true if would not find any column virtual bool looksOptimal() const { return looksOptimal_; } /// Sets optimality flag (for advanced use) virtual void setLooksOptimal(bool flag) { looksOptimal_ = flag; } //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpPrimalColumnPivot(); /// Copy constructor ClpPrimalColumnPivot(const ClpPrimalColumnPivot &); /// Assignment operator ClpPrimalColumnPivot & operator=(const ClpPrimalColumnPivot& rhs); /// Destructor virtual ~ClpPrimalColumnPivot (); /// Clone virtual ClpPrimalColumnPivot * clone(bool copyData = true) const = 0; //@} ///@name Other //@{ /// Returns model inline ClpSimplex * model() { return model_; } /// Sets model inline void setModel(ClpSimplex * newmodel) { model_ = newmodel; } /// Returns type (above 63 is extra information) inline int type() { return type_; } /** Returns number of extra columns for sprint algorithm - 0 means off. Also number of iterations before recompute */ virtual int numberSprintColumns(int & numberIterations) const; /// Switch off sprint idea virtual void switchOffSprint(); /// Called when maximum pivots changes virtual void maximumPivotsChanged() {} //@} //--------------------------------------------------------------------------- protected: ///@name Protected member data //@{ /// Pointer to model ClpSimplex * model_; /// Type of column pivot algorithm int type_; /// Says if looks optimal (normally computed) bool looksOptimal_; //@} }; #ifndef CLP_PRIMAL_SLACK_MULTIPLIER #define CLP_PRIMAL_SLACK_MULTIPLIER 1.01 #endif #endif CoinMP-1.8.3/Clp/src/CoinAbcHelperFunctions.cpp0000644000175000017500000020223312363765626017676 0ustar renerene/* $Id: CoinAbcHelperFunctions.cpp 2043 2014-07-23 17:06:30Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #include "CoinTypes.hpp" #include "CoinFinite.hpp" #include "CoinAbcCommon.hpp" //#define AVX2 1 #if AVX2==1 #define set_const_v2df(bb,b) {double * temp=reinterpret_cast(&bb);temp[0]=b;temp[1]=b;} #endif #if INLINE_SCATTER==0 void CoinAbcScatterUpdate(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { #if UNROLL_SCATTER==0 for (CoinBigIndex j=number-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #elif UNROLL_SCATTER==1 if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } #elif UNROLL_SCATTER==2 if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } if ((number&2)!=0) { CoinSimplexInt iRow0 = thisIndex[number-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble value0 = thisElement[number-1]; CoinSimplexInt iRow1 = thisIndex[number-2]; CoinFactorizationDouble regionValue1 = region[iRow1]; CoinFactorizationDouble value1 = thisElement[number-2]; region[iRow0] = regionValue0 - value0 * pivotValue; region[iRow1] = regionValue1 - value1 * pivotValue; number-=2; } for (CoinBigIndex j=number-1 ; j >=0; j-=4 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; CoinSimplexInt iRow2 = thisIndex[j-2]; CoinSimplexInt iRow3 = thisIndex[j-3]; CoinFactorizationDouble regionValue2 = region[iRow2]; CoinFactorizationDouble regionValue3 = region[iRow3]; region[iRow2] = regionValue2 - thisElement[j-2] * pivotValue; region[iRow3] = regionValue3 - thisElement[j-3] * pivotValue; } #elif UNROLL_SCATTER==3 CoinSimplexInt iRow0; CoinSimplexInt iRow1; CoinFactorizationDouble regionValue0; CoinFactorizationDouble regionValue1; switch(static_cast(number)) { case 0: break; case 1: iRow0 = thisIndex[0]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; break; case 2: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; break; case 3: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; break; case 4: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; break; case 5: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; break; case 6: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; break; case 7: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; break; case 8: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; iRow1 = thisIndex[7]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; region[iRow1] = regionValue1 - thisElement[7] * pivotValue; break; default: if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } break; } #endif } #endif #if INLINE_GATHER==0 CoinFactorizationDouble CoinAbcGatherUpdate(CoinSimplexInt number, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { #if UNROLL_GATHER==0 CoinFactorizationDouble pivotValue=0.0; for (CoinBigIndex j = 0; j < number; j ++ ) { CoinFactorizationDouble value = thisElement[j]; CoinSimplexInt jRow = thisIndex[j]; value *= region[jRow]; pivotValue -= value; } return pivotValue; #else #error code #endif } #endif #if INLINE_MULTIPLY_ADD==0 void CoinAbcMultiplyIndexed(int number, const CoinFactorizationDouble * COIN_RESTRICT multiplier, const int * COIN_RESTRICT thisIndex, CoinSimplexDouble * COIN_RESTRICT region) { #ifndef INTEL_COMPILER // was #pragma simd #endif #if UNROLL_MULTIPLY_ADD==0 for (CoinSimplexInt i = 0; i < number; i ++ ) { CoinSimplexInt iRow = thisIndex[i]; CoinSimplexDouble value = region[iRow]; value *= multiplier[iRow]; region[iRow] = value; } #else #error code #endif } void CoinAbcMultiplyIndexed(int number, const long double * COIN_RESTRICT multiplier, const int * COIN_RESTRICT thisIndex, long double * COIN_RESTRICT region) { #ifndef INTEL_COMPILER // was #pragma simd #endif #if UNROLL_MULTIPLY_ADD==0 for (CoinSimplexInt i = 0; i < number; i ++ ) { CoinSimplexInt iRow = thisIndex[i]; long double value = region[iRow]; value *= multiplier[iRow]; region[iRow] = value; } #else #error code #endif } #endif double CoinAbcMaximumAbsElement(const double * region, int sizeIn) { int size=sizeIn; double maxValue = 0.0; //printf("a\n"); #ifndef INTEL_COMPILER // was #pragma simd #endif /*cilk_*/ for (int i = 0; i < size; i++) maxValue = CoinMax(maxValue, fabs(region[i])); return maxValue; } void CoinAbcMinMaxAbsElement(const double * region, int sizeIn,double & minimum , double & maximum) { double minValue=minimum; double maxValue=maximum; int size=sizeIn; //printf("b\n"); #ifndef INTEL_COMPILER // was #pragma simd #endif /*cilk_*/ for (int i=0;iNORMAL_LOW_VALUE&&valuekillIfLessThanThis) { if (value!=COIN_DBL_MAX) { value *= multiplier; if (value>killIfLessThanThis) region[i] *= multiplier; else region[i]=0.0; } } else { region[i]=0.0; } } } // maximum fabs(region[i]) and then region[i]*=multiplier double CoinAbcMaximumAbsElementAndScale(double * region, double multiplier,int sizeIn) { double maxValue=0.0; int size=sizeIn; //printf("f\n"); #ifndef INTEL_COMPILER // was #pragma simd #endif /*cilk_*/ for (int i=0;i=0); memmove(array,arrayFrom,size*sizeof(double)); double * endArray = array+size; double * endArrayFrom = arrayFrom+size; double * startZero = CoinMax(arrayFrom,endArray); memset(startZero,0,(endArrayFrom-startZero)*sizeof(double)); } // This compacts several sections and zeroes out end int CoinAbcCompact(int numberSections,int alreadyDone,double * array,const int * starts, const int * lengths) { int totalLength=alreadyDone; for (int i=0;itotalLength) { start=CoinMax(start,totalLength); memset(array+start,0,(end-start)*sizeof(double)); } alreadyDone += length; } return totalLength; } // This compacts several sections int CoinAbcCompact(int numberSections,int alreadyDone,int * array,const int * starts, const int * lengths) { for (int i=0;i=0; j-=4 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; iRow0 = thisIndex[j-2]; iRow1 = thisIndex[j-3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j-2] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-3] * pivotValue; } } void CoinAbcScatterUpdate4NPlus1(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { assert ((number&3)==1); int iRow0 = thisIndex[number-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[number-1] * pivotValue; number -= 1; for (CoinBigIndex j=number-1 ; j >=0; j-=4 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; iRow0 = thisIndex[j-2]; iRow1 = thisIndex[j-3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j-2] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-3] * pivotValue; } } void CoinAbcScatterUpdate4NPlus2(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { assert ((number&3)==2); int iRow0 = thisIndex[number-1]; int iRow1 = thisIndex[number-2]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[number-1] * pivotValue; region[iRow1] = regionValue1 - thisElement[number-2] * pivotValue; number -= 2; for (CoinBigIndex j=number-1 ; j >=0; j-=4 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; iRow0 = thisIndex[j-2]; iRow1 = thisIndex[j-3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j-2] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-3] * pivotValue; } } void CoinAbcScatterUpdate4NPlus3(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { assert ((number&3)==3); int iRow0 = thisIndex[number-1]; int iRow1 = thisIndex[number-2]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[number-1] * pivotValue; region[iRow1] = regionValue1 - thisElement[number-2] * pivotValue; iRow0 = thisIndex[number-3]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[number-3] * pivotValue; number -= 3; for (CoinBigIndex j=number-1 ; j >=0; j-=4 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; iRow0 = thisIndex[j-2]; iRow1 = thisIndex[j-3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j-2] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-3] * pivotValue; } } void CoinAbcScatterUpdate0(int numberIn, CoinFactorizationDouble /*multiplier*/, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT /*region*/) { #ifndef NDEBUG assert (numberIn==0); #endif } // start alternatives #if 0 void CoinAbcScatterUpdate1(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==1); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); element++; int iColumn0=thisColumn[0]; CoinFactorizationDouble value0=region[iColumn0]; value0 += multiplier*element[0]; region[iColumn0]=value0; } void CoinAbcScatterUpdate2(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==2); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); #if NEW_CHUNK_SIZE==2 int nFull=2&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } #endif #if NEW_CHUNK_SIZE==4 element++; int iColumn0=thisColumn[0]; int iColumn1=thisColumn[1]; CoinFactorizationDouble value0=region[iColumn0]; CoinFactorizationDouble value1=region[iColumn1]; value0 += multiplier*element[0]; value1 += multiplier*element[1]; region[iColumn0]=value0; region[iColumn1]=value1; #endif } void CoinAbcScatterUpdate3(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==3); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); #if NEW_CHUNK_SIZE==2 int nFull=3&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } #endif #if NEW_CHUNK_SIZE==2 element++; int iColumn0=thisColumn[0]; CoinFactorizationDouble value0=region[iColumn0]; value0 += multiplier*element[0]; region[iColumn0]=value0; #else element+=2; int iColumn0=thisColumn[0]; int iColumn1=thisColumn[1]; int iColumn2=thisColumn[2]; CoinFactorizationDouble value0=region[iColumn0]; CoinFactorizationDouble value1=region[iColumn1]; CoinFactorizationDouble value2=region[iColumn2]; value0 += multiplier*element[0]; value1 += multiplier*element[1]; value2 += multiplier*element[2]; region[iColumn0]=value0; region[iColumn1]=value1; region[iColumn2]=value2; #endif } void CoinAbcScatterUpdate4(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==4); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=4&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } } void CoinAbcScatterUpdate5(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==5); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=5&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } element++; int iColumn0=thisColumn[0]; CoinFactorizationDouble value0=region[iColumn0]; value0 += multiplier*element[0]; region[iColumn0]=value0; } void CoinAbcScatterUpdate6(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==6); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=6&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } #if NEW_CHUNK_SIZE==4 element++; int iColumn0=thisColumn[0]; int iColumn1=thisColumn[1]; CoinFactorizationDouble value0=region[iColumn0]; CoinFactorizationDouble value1=region[iColumn1]; value0 += multiplier*element[0]; value1 += multiplier*element[1]; region[iColumn0]=value0; region[iColumn1]=value1; #endif } void CoinAbcScatterUpdate7(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==7); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=7&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } #if NEW_CHUNK_SIZE==2 element++; int iColumn0=thisColumn[0]; CoinFactorizationDouble value0=region[iColumn0]; value0 += multiplier*element[0]; region[iColumn0]=value0; #else element+=2; int iColumn0=thisColumn[0]; int iColumn1=thisColumn[1]; int iColumn2=thisColumn[2]; CoinFactorizationDouble value0=region[iColumn0]; CoinFactorizationDouble value1=region[iColumn1]; CoinFactorizationDouble value2=region[iColumn2]; value0 += multiplier*element[0]; value1 += multiplier*element[1]; value2 += multiplier*element[2]; region[iColumn0]=value0; region[iColumn1]=value1; region[iColumn2]=value2; #endif } void CoinAbcScatterUpdate8(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==8); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=8&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } } void CoinAbcScatterUpdate4N(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { assert ((numberIn&3)==0); const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=numberIn&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } } void CoinAbcScatterUpdate4NPlus1(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { assert ((numberIn&3)==1); const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=numberIn&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } element++; int iColumn0=thisColumn[0]; CoinFactorizationDouble value0=region[iColumn0]; value0 += multiplier*element[0]; region[iColumn0]=value0; } void CoinAbcScatterUpdate4NPlus2(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { assert ((numberIn&3)==2); const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=numberIn&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } #if NEW_CHUNK_SIZE==4 element++; int iColumn0=thisColumn[0]; int iColumn1=thisColumn[1]; CoinFactorizationDouble value0=region[iColumn0]; CoinFactorizationDouble value1=region[iColumn1]; value0 += multiplier*element[0]; value1 += multiplier*element[1]; region[iColumn0]=value0; region[iColumn1]=value1; #endif } void CoinAbcScatterUpdate4NPlus3(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { assert ((numberIn&3)==3); const int * COIN_RESTRICT thisColumn = reinterpret_cast(element); int nFull=numberIn&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } #if NEW_CHUNK_SIZE==2 element++; int iColumn0=thisColumn[0]; CoinFactorizationDouble value0=region[iColumn0]; value0 += multiplier*element[0]; region[iColumn0]=value0; #else element+=2; int iColumn0=thisColumn[0]; int iColumn1=thisColumn[1]; int iColumn2=thisColumn[2]; CoinFactorizationDouble value0=region[iColumn0]; CoinFactorizationDouble value1=region[iColumn1]; CoinFactorizationDouble value2=region[iColumn2]; value0 += multiplier*element[0]; value1 += multiplier*element[1]; value2 += multiplier*element[2]; region[iColumn0]=value0; region[iColumn1]=value1; region[iColumn2]=value2; #endif } #else // alternative #define CACHE_LINE_SIZE 16 #define OPERATION += #define functionName(zname) CoinAbc##zname #define ABC_CREATE_SCATTER_FUNCTION 1 #include "CoinAbcHelperFunctions.hpp" #undef OPERATION #undef functionName #define OPERATION -= #define functionName(zname) CoinAbc##zname##Subtract #include "CoinAbcHelperFunctions.hpp" #undef OPERATION #undef functionName #define OPERATION += #define functionName(zname) CoinAbc##zname##Add #include "CoinAbcHelperFunctions.hpp" scatterUpdate AbcScatterLow[]={ &CoinAbcScatterUpdate0, &CoinAbcScatterUpdate1, &CoinAbcScatterUpdate2, &CoinAbcScatterUpdate3, &CoinAbcScatterUpdate4, &CoinAbcScatterUpdate5, &CoinAbcScatterUpdate6, &CoinAbcScatterUpdate7, &CoinAbcScatterUpdate8}; scatterUpdate AbcScatterHigh[]={ &CoinAbcScatterUpdate4N, &CoinAbcScatterUpdate4NPlus1, &CoinAbcScatterUpdate4NPlus2, &CoinAbcScatterUpdate4NPlus3}; scatterUpdate AbcScatterLowSubtract[]={ &CoinAbcScatterUpdate0, &CoinAbcScatterUpdate1Subtract, &CoinAbcScatterUpdate2Subtract, &CoinAbcScatterUpdate3Subtract, &CoinAbcScatterUpdate4Subtract, &CoinAbcScatterUpdate5Subtract, &CoinAbcScatterUpdate6Subtract, &CoinAbcScatterUpdate7Subtract, &CoinAbcScatterUpdate8Subtract}; scatterUpdate AbcScatterHighSubtract[]={ &CoinAbcScatterUpdate4NSubtract, &CoinAbcScatterUpdate4NPlus1Subtract, &CoinAbcScatterUpdate4NPlus2Subtract, &CoinAbcScatterUpdate4NPlus3Subtract}; scatterUpdate AbcScatterLowAdd[]={ &CoinAbcScatterUpdate0, &CoinAbcScatterUpdate1Add, &CoinAbcScatterUpdate2Add, &CoinAbcScatterUpdate3Add, &CoinAbcScatterUpdate4Add, &CoinAbcScatterUpdate5Add, &CoinAbcScatterUpdate6Add, &CoinAbcScatterUpdate7Add, &CoinAbcScatterUpdate8Add}; scatterUpdate AbcScatterHighAdd[]={ &CoinAbcScatterUpdate4NAdd, &CoinAbcScatterUpdate4NPlus1Add, &CoinAbcScatterUpdate4NPlus2Add, &CoinAbcScatterUpdate4NPlus3Add}; #endif #include "CoinPragma.hpp" #include #include #include #include #include #include #include "CoinAbcCommonFactorization.hpp" #if 1 #if AVX2==1 #include "emmintrin.h" #elif AVX2==2 #include #elif AVX2==3 #include "avx2intrin.h" #endif #endif // cilk seems a bit fragile #define CILK_FRAGILE 0 #if CILK_FRAGILE>1 #undef cilk_spawn #undef cilk_sync #define cilk_spawn #define cilk_sync #define ONWARD 0 #elif CILK_FRAGILE==1 #define ONWARD 0 #else #define ONWARD 1 #endif #define BLOCKING1 8 // factorization strip #define BLOCKING2 8 // dgemm recursive #define BLOCKING3 32 // dgemm parallel void CoinAbcDgemm(int m, int n, int k, double * COIN_RESTRICT a,int lda, double * COIN_RESTRICT b,double * COIN_RESTRICT c #if ABC_PARALLEL==2 ,int parallelMode #endif ) { assert ((m&(BLOCKING8-1))==0&&(n&(BLOCKING8-1))==0&&(k&(BLOCKING8-1))==0); /* entry for column j and row i (when multiple of BLOCKING8) is at aBlocked+j*m+i*BLOCKING8 */ // k is always smallish if (m<=BLOCKING8&&n<=BLOCKING8) { assert (m==BLOCKING8&&n==BLOCKING8&&k==BLOCKING8); double * COIN_RESTRICT aBase2=a; double * COIN_RESTRICT bBase2=b; double * COIN_RESTRICT cBase2=c; for (int j=0;j(cBase2); //__m256d c1=_mm256_load_pd(cBase2+4); __m256d c1=*reinterpret_cast<__m256d *>(cBase2+4); for (int l=0;l (__builtin_ia32_vbroadcastsd256 (bBase2+l)); //__m256d a0 = _mm256_load_pd(aBase); __m256d a0=*reinterpret_cast<__m256d *>(aBase); //__m256d a1 = _mm256_load_pd(aBase+4); __m256d a1=*reinterpret_cast<__m256d *>(aBase+4); c0 -= bb*a0; c1 -= bb*a1; aBase += BLOCKING8; } //_mm256_store_pd (cBase2, c0); *reinterpret_cast<__m256d *>(cBase2)=c0; //_mm256_store_pd (cBase2+4, c1); *reinterpret_cast<__m256d *>(cBase2+4)=c1; #endif bBase2 += BLOCKING8; cBase2 += BLOCKING8; } } else if (m>n) { // make sure mNew1 multiple of BLOCKING8 #if BLOCKING8==8 int mNew1=((m+15)>>4)<<3; #elif BLOCKING8==4 int mNew1=((m+7)>>3)<<2; #elif BLOCKING8==2 int mNew1=((m+3)>>2)<<1; #else abort(); #endif assert (mNew1>0&&m-mNew1>0); #if ABC_PARALLEL==2 if (mNew1<=BLOCKING3||!parallelMode) { #endif //printf("splitMa mNew1 %d\n",mNew1); CoinAbcDgemm(mNew1,n,k,a,lda,b,c #if ABC_PARALLEL==2 ,0 #endif ); //printf("splitMb mNew1 %d\n",mNew1); CoinAbcDgemm(m-mNew1,n,k,a+mNew1*BLOCKING8,lda,b,c+mNew1*BLOCKING8 #if ABC_PARALLEL==2 ,0 #endif ); #if ABC_PARALLEL==2 } else { //printf("splitMa mNew1 %d\n",mNew1); cilk_spawn CoinAbcDgemm(mNew1,n,k,a,lda,b,c,ONWARD); //printf("splitMb mNew1 %d\n",mNew1); CoinAbcDgemm(m-mNew1,n,k,a+mNew1*BLOCKING8,lda,b,c+mNew1*BLOCKING8,ONWARD); cilk_sync; } #endif } else { // make sure nNew1 multiple of BLOCKING8 #if BLOCKING8==8 int nNew1=((n+15)>>4)<<3; #elif BLOCKING8==4 int nNew1=((n+7)>>3)<<2; #elif BLOCKING8==2 int nNew1=((n+3)>>2)<<1; #else abort(); #endif assert (nNew1>0&&n-nNew1>0); #if ABC_PARALLEL==2 if (nNew1<=BLOCKING3||!parallelMode) { #endif //printf("splitNa nNew1 %d\n",nNew1); CoinAbcDgemm(m,nNew1,k,a,lda,b,c #if ABC_PARALLEL==2 ,0 #endif ); //printf("splitNb nNew1 %d\n",nNew1); CoinAbcDgemm(m,n-nNew1,k,a,lda,b+lda*nNew1,c+lda*nNew1 #if ABC_PARALLEL==2 ,0 #endif ); #if ABC_PARALLEL==2 } else { //printf("splitNa nNew1 %d\n",nNew1); cilk_spawn CoinAbcDgemm(m,nNew1,k,a,lda,b,c,ONWARD); //printf("splitNb nNew1 %d\n",nNew1); CoinAbcDgemm(m,n-nNew1,k,a,lda,b+lda*nNew1,c+lda*nNew1,ONWARD); cilk_sync; } #endif } } #ifdef ABC_LONG_FACTORIZATION // Start long double version void CoinAbcDgemm(int m, int n, int k, long double * COIN_RESTRICT a,int lda, long double * COIN_RESTRICT b,long double * COIN_RESTRICT c #if ABC_PARALLEL==2 ,int parallelMode #endif ) { assert ((m&(BLOCKING8-1))==0&&(n&(BLOCKING8-1))==0&&(k&(BLOCKING8-1))==0); /* entry for column j and row i (when multiple of BLOCKING8) is at aBlocked+j*m+i*BLOCKING8 */ // k is always smallish if (m<=BLOCKING8&&n<=BLOCKING8) { assert (m==BLOCKING8&&n==BLOCKING8&&k==BLOCKING8); long double * COIN_RESTRICT aBase2=a; long double * COIN_RESTRICT bBase2=b; long double * COIN_RESTRICT cBase2=c; for (int j=0;j(cBase2); //__m256d c1=_mm256_load_pd(cBase2+4); __m256d c1=*reinterpret_cast<__m256d *>(cBase2+4); for (int l=0;l (__builtin_ia32_vbroadcastsd256 (bBase2+l)); //__m256d a0 = _mm256_load_pd(aBase); __m256d a0=*reinterpret_cast<__m256d *>(aBase); //__m256d a1 = _mm256_load_pd(aBase+4); __m256d a1=*reinterpret_cast<__m256d *>(aBase+4); c0 -= bb*a0; c1 -= bb*a1; aBase += BLOCKING8; } //_mm256_store_pd (cBase2, c0); *reinterpret_cast<__m256d *>(cBase2)=c0; //_mm256_store_pd (cBase2+4, c1); *reinterpret_cast<__m256d *>(cBase2+4)=c1; #endif bBase2 += BLOCKING8; cBase2 += BLOCKING8; } } else if (m>n) { // make sure mNew1 multiple of BLOCKING8 #if BLOCKING8==8 int mNew1=((m+15)>>4)<<3; #elif BLOCKING8==4 int mNew1=((m+7)>>3)<<2; #elif BLOCKING8==2 int mNew1=((m+3)>>2)<<1; #else abort(); #endif assert (mNew1>0&&m-mNew1>0); #if ABC_PARALLEL==2 if (mNew1<=BLOCKING3||!parallelMode) { #endif //printf("splitMa mNew1 %d\n",mNew1); CoinAbcDgemm(mNew1,n,k,a,lda,b,c #if ABC_PARALLEL==2 ,0 #endif ); //printf("splitMb mNew1 %d\n",mNew1); CoinAbcDgemm(m-mNew1,n,k,a+mNew1*BLOCKING8,lda,b,c+mNew1*BLOCKING8 #if ABC_PARALLEL==2 ,0 #endif ); #if ABC_PARALLEL==2 } else { //printf("splitMa mNew1 %d\n",mNew1); cilk_spawn CoinAbcDgemm(mNew1,n,k,a,lda,b,c,ONWARD); //printf("splitMb mNew1 %d\n",mNew1); CoinAbcDgemm(m-mNew1,n,k,a+mNew1*BLOCKING8,lda,b,c+mNew1*BLOCKING8,ONWARD); cilk_sync; } #endif } else { // make sure nNew1 multiple of BLOCKING8 #if BLOCKING8==8 int nNew1=((n+15)>>4)<<3; #elif BLOCKING8==4 int nNew1=((n+7)>>3)<<2; #elif BLOCKING8==2 int nNew1=((n+3)>>2)<<1; #else abort(); #endif assert (nNew1>0&&n-nNew1>0); #if ABC_PARALLEL==2 if (nNew1<=BLOCKING3||!parallelMode) { #endif //printf("splitNa nNew1 %d\n",nNew1); CoinAbcDgemm(m,nNew1,k,a,lda,b,c #if ABC_PARALLEL==2 ,0 #endif ); //printf("splitNb nNew1 %d\n",nNew1); CoinAbcDgemm(m,n-nNew1,k,a,lda,b+lda*nNew1,c+lda*nNew1 #if ABC_PARALLEL==2 ,0 #endif ); #if ABC_PARALLEL==2 } else { //printf("splitNa nNew1 %d\n",nNew1); cilk_spawn CoinAbcDgemm(m,nNew1,k,a,lda,b,c,ONWARD); //printf("splitNb nNew1 %d\n",nNew1); CoinAbcDgemm(m,n-nNew1,k,a,lda,b+lda*nNew1,c+lda*nNew1,ONWARD); cilk_sync; } #endif } } #endif #if 0 // From Intel site // get AVX intrinsics #include // get CPUID capability //#include #define cpuid(func,ax,bx,cx,dx)\ __asm__ __volatile__ ("cpuid":\ "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func)); // written for clarity, not conciseness #define OSXSAVEFlag (1UL<<27) #define AVXFlag ((1UL<<28)|OSXSAVEFlag) #define VAESFlag ((1UL<<25)|AVXFlag|OSXSAVEFlag) #define FMAFlag ((1UL<<12)|AVXFlag|OSXSAVEFlag) #define CLMULFlag ((1UL<< 1)|AVXFlag|OSXSAVEFlag) bool DetectFeature(unsigned int feature) { int CPUInfo[4]; //, InfoType=1, ECX = 1; //__cpuidex(CPUInfo, 1, 1); // read the desired CPUID format cpuid(1,CPUInfo[0],CPUInfo[1],CPUInfo[2],CPUInfo[3]); unsigned int ECX = CPUInfo[2]; // the output of CPUID in the ECX register. if ((ECX & feature) != feature) // Missing feature return false; #if 0 long int val = _xgetbv(0); // read XFEATURE_ENABLED_MASK register if ((val&6) != 6) // check OS has enabled both XMM and YMM support. return false; #endif return true; } #endif CoinMP-1.8.3/Clp/src/ClpInterior.hpp0000644000175000017500000004621311510657452015600 0ustar renerene/* $Id: ClpInterior.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Tomlin (pdco) John Forrest (standard predictor-corrector) Note JJF has added arrays - this takes more memory but makes flow easier to understand and hopefully easier to extend */ #ifndef ClpInterior_H #define ClpInterior_H #include #include #include "ClpModel.hpp" #include "ClpMatrixBase.hpp" #include "ClpSolve.hpp" #include "CoinDenseVector.hpp" class ClpLsqr; class ClpPdcoBase; /// ******** DATA to be moved into protected section of ClpInterior typedef struct { double atolmin; double r3norm; double LSdamp; double* deltay; } Info; /// ******** DATA to be moved into protected section of ClpInterior typedef struct { double atolold; double atolnew; double r3ratio; int istop; int itncg; } Outfo; /// ******** DATA to be moved into protected section of ClpInterior typedef struct { double gamma; double delta; int MaxIter; double FeaTol; double OptTol; double StepTol; double x0min; double z0min; double mu0; int LSmethod; // 1=Cholesky 2=QR 3=LSQR int LSproblem; // See below int LSQRMaxIter; double LSQRatol1; // Initial atol double LSQRatol2; // Smallest atol (unless atol1 is smaller) double LSQRconlim; int wait; } Options; class Lsqr; class ClpCholeskyBase; // ***** END /** This solves LPs using interior point methods It inherits from ClpModel and all its arrays are created at algorithm time. */ class ClpInterior : public ClpModel { friend void ClpInteriorUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor ClpInterior ( ); /// Copy constructor. ClpInterior(const ClpInterior &); /// Copy constructor from model. ClpInterior(const ClpModel &); /** Subproblem constructor. A subset of whole model is created from the row and column lists given. The new order is given by list order and duplicates are allowed. Name and integer information can be dropped */ ClpInterior (const ClpModel * wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns, bool dropNames = true, bool dropIntegers = true); /// Assignment operator. This copies the data ClpInterior & operator=(const ClpInterior & rhs); /// Destructor ~ClpInterior ( ); // Ones below are just ClpModel with some changes /** Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ void loadProblem ( const ClpMatrixBase& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); void loadProblem ( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /** Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ void loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /// This one is for after presolve to save memory void loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const int * length, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective = NULL); /// Read an mps file from the given filename int readMps(const char *filename, bool keepNames = false, bool ignoreErrors = false); /** Borrow model. This is so we dont have to copy large amounts of data around. It assumes a derived class wants to overwrite an empty model with a real one - while it does an algorithm. This is same as ClpModel one. */ void borrowModel(ClpModel & otherModel); /** Return model - updates any scalars */ void returnModel(ClpModel & otherModel); //@} /**@name Functions most useful to user */ //@{ /** Pdco algorithm - see ClpPdco.hpp for method */ int pdco(); // ** Temporary version int pdco( ClpPdcoBase * stuff, Options &options, Info &info, Outfo &outfo); /// Primal-Dual Predictor-Corrector barrier int primalDual(); //@} /**@name most useful gets and sets */ //@{ /// If problem is primal feasible inline bool primalFeasible() const { return (sumPrimalInfeasibilities_ <= 1.0e-5); } /// If problem is dual feasible inline bool dualFeasible() const { return (sumDualInfeasibilities_ <= 1.0e-5); } /// Current (or last) algorithm inline int algorithm() const { return algorithm_; } /// Set algorithm inline void setAlgorithm(int value) { algorithm_ = value; } /// Sum of dual infeasibilities inline CoinWorkDouble sumDualInfeasibilities() const { return sumDualInfeasibilities_; } /// Sum of primal infeasibilities inline CoinWorkDouble sumPrimalInfeasibilities() const { return sumPrimalInfeasibilities_; } /// dualObjective. inline CoinWorkDouble dualObjective() const { return dualObjective_; } /// primalObjective. inline CoinWorkDouble primalObjective() const { return primalObjective_; } /// diagonalNorm inline CoinWorkDouble diagonalNorm() const { return diagonalNorm_; } /// linearPerturbation inline CoinWorkDouble linearPerturbation() const { return linearPerturbation_; } inline void setLinearPerturbation(CoinWorkDouble value) { linearPerturbation_ = value; } /// projectionTolerance inline CoinWorkDouble projectionTolerance() const { return projectionTolerance_; } inline void setProjectionTolerance(CoinWorkDouble value) { projectionTolerance_ = value; } /// diagonalPerturbation inline CoinWorkDouble diagonalPerturbation() const { return diagonalPerturbation_; } inline void setDiagonalPerturbation(CoinWorkDouble value) { diagonalPerturbation_ = value; } /// gamma inline CoinWorkDouble gamma() const { return gamma_; } inline void setGamma(CoinWorkDouble value) { gamma_ = value; } /// delta inline CoinWorkDouble delta() const { return delta_; } inline void setDelta(CoinWorkDouble value) { delta_ = value; } /// ComplementarityGap inline CoinWorkDouble complementarityGap() const { return complementarityGap_; } //@} /**@name most useful gets and sets */ //@{ /// Largest error on Ax-b inline CoinWorkDouble largestPrimalError() const { return largestPrimalError_; } /// Largest error on basic duals inline CoinWorkDouble largestDualError() const { return largestDualError_; } /// Maximum iterations inline int maximumBarrierIterations() const { return maximumBarrierIterations_; } inline void setMaximumBarrierIterations(int value) { maximumBarrierIterations_ = value; } /// Set cholesky (and delete present one) void setCholesky(ClpCholeskyBase * cholesky); /// Return number fixed to see if worth presolving int numberFixed() const; /** fix variables interior says should be. If reallyFix false then just set values to exact bounds */ void fixFixed(bool reallyFix = true); /// Primal erturbation vector inline CoinWorkDouble * primalR() const { return primalR_; } /// Dual erturbation vector inline CoinWorkDouble * dualR() const { return dualR_; } //@} protected: /**@name protected methods */ //@{ /// Does most of deletion void gutsOfDelete(); /// Does most of copying void gutsOfCopy(const ClpInterior & rhs); /// Returns true if data looks okay, false if not bool createWorkingData(); void deleteWorkingData(); /// Sanity check on input rim data bool sanityCheck(); /// This does housekeeping int housekeeping(); //@} public: /**@name public methods */ //@{ /// Raw objective value (so always minimize) inline CoinWorkDouble rawObjectiveValue() const { return objectiveValue_; } /// Returns 1 if sequence indicates column inline int isColumn(int sequence) const { return sequence < numberColumns_ ? 1 : 0; } /// Returns sequence number within section inline int sequenceWithin(int sequence) const { return sequence < numberColumns_ ? sequence : sequence - numberColumns_; } /// Checks solution void checkSolution(); /** Modifies djs to allow for quadratic. returns quadratic offset */ CoinWorkDouble quadraticDjs(CoinWorkDouble * djRegion, const CoinWorkDouble * solution, CoinWorkDouble scaleFactor); /// To say a variable is fixed inline void setFixed( int sequence) { status_[sequence] = static_cast(status_[sequence] | 1) ; } inline void clearFixed( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~1) ; } inline bool fixed(int sequence) const { return ((status_[sequence] & 1) != 0); } /// To flag a variable inline void setFlagged( int sequence) { status_[sequence] = static_cast(status_[sequence] | 2) ; } inline void clearFlagged( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~2) ; } inline bool flagged(int sequence) const { return ((status_[sequence] & 2) != 0); } /// To say a variable is fixed OR free inline void setFixedOrFree( int sequence) { status_[sequence] = static_cast(status_[sequence] | 4) ; } inline void clearFixedOrFree( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~4) ; } inline bool fixedOrFree(int sequence) const { return ((status_[sequence] & 4) != 0); } /// To say a variable has lower bound inline void setLowerBound( int sequence) { status_[sequence] = static_cast(status_[sequence] | 8) ; } inline void clearLowerBound( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~8) ; } inline bool lowerBound(int sequence) const { return ((status_[sequence] & 8) != 0); } /// To say a variable has upper bound inline void setUpperBound( int sequence) { status_[sequence] = static_cast(status_[sequence] | 16) ; } inline void clearUpperBound( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~16) ; } inline bool upperBound(int sequence) const { return ((status_[sequence] & 16) != 0); } /// To say a variable has fake lower bound inline void setFakeLower( int sequence) { status_[sequence] = static_cast(status_[sequence] | 32) ; } inline void clearFakeLower( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~32) ; } inline bool fakeLower(int sequence) const { return ((status_[sequence] & 32) != 0); } /// To say a variable has fake upper bound inline void setFakeUpper( int sequence) { status_[sequence] = static_cast(status_[sequence] | 64) ; } inline void clearFakeUpper( int sequence) { status_[sequence] = static_cast(status_[sequence] & ~64) ; } inline bool fakeUpper(int sequence) const { return ((status_[sequence] & 64) != 0); } //@} ////////////////// data ////////////////// protected: /**@name data. Many arrays have a row part and a column part. There is a single array with both - columns then rows and then normally two arrays pointing to rows and columns. The single array is the owner of memory */ //@{ /// Largest error on Ax-b CoinWorkDouble largestPrimalError_; /// Largest error on basic duals CoinWorkDouble largestDualError_; /// Sum of dual infeasibilities CoinWorkDouble sumDualInfeasibilities_; /// Sum of primal infeasibilities CoinWorkDouble sumPrimalInfeasibilities_; /// Worst complementarity CoinWorkDouble worstComplementarity_; /// public: CoinWorkDouble xsize_; CoinWorkDouble zsize_; protected: /// Working copy of lower bounds (Owner of arrays below) CoinWorkDouble * lower_; /// Row lower bounds - working copy CoinWorkDouble * rowLowerWork_; /// Column lower bounds - working copy CoinWorkDouble * columnLowerWork_; /// Working copy of upper bounds (Owner of arrays below) CoinWorkDouble * upper_; /// Row upper bounds - working copy CoinWorkDouble * rowUpperWork_; /// Column upper bounds - working copy CoinWorkDouble * columnUpperWork_; /// Working copy of objective CoinWorkDouble * cost_; public: /// Rhs CoinWorkDouble * rhs_; CoinWorkDouble * x_; CoinWorkDouble * y_; CoinWorkDouble * dj_; protected: /// Pointer to Lsqr object ClpLsqr * lsqrObject_; /// Pointer to stuff ClpPdcoBase * pdcoStuff_; /// Below here is standard barrier stuff /// mu. CoinWorkDouble mu_; /// objectiveNorm. CoinWorkDouble objectiveNorm_; /// rhsNorm. CoinWorkDouble rhsNorm_; /// solutionNorm. CoinWorkDouble solutionNorm_; /// dualObjective. CoinWorkDouble dualObjective_; /// primalObjective. CoinWorkDouble primalObjective_; /// diagonalNorm. CoinWorkDouble diagonalNorm_; /// stepLength CoinWorkDouble stepLength_; /// linearPerturbation CoinWorkDouble linearPerturbation_; /// diagonalPerturbation CoinWorkDouble diagonalPerturbation_; // gamma from Saunders and Tomlin regularized CoinWorkDouble gamma_; // delta from Saunders and Tomlin regularized CoinWorkDouble delta_; /// targetGap CoinWorkDouble targetGap_; /// projectionTolerance CoinWorkDouble projectionTolerance_; /// maximumRHSError. maximum Ax CoinWorkDouble maximumRHSError_; /// maximumBoundInfeasibility. CoinWorkDouble maximumBoundInfeasibility_; /// maximumDualError. CoinWorkDouble maximumDualError_; /// diagonalScaleFactor. CoinWorkDouble diagonalScaleFactor_; /// scaleFactor. For scaling objective CoinWorkDouble scaleFactor_; /// actualPrimalStep CoinWorkDouble actualPrimalStep_; /// actualDualStep CoinWorkDouble actualDualStep_; /// smallestInfeasibility CoinWorkDouble smallestInfeasibility_; /// historyInfeasibility. #define LENGTH_HISTORY 5 CoinWorkDouble historyInfeasibility_[LENGTH_HISTORY]; /// complementarityGap. CoinWorkDouble complementarityGap_; /// baseObjectiveNorm CoinWorkDouble baseObjectiveNorm_; /// worstDirectionAccuracy CoinWorkDouble worstDirectionAccuracy_; /// maximumRHSChange CoinWorkDouble maximumRHSChange_; /// errorRegion. i.e. Ax CoinWorkDouble * errorRegion_; /// rhsFixRegion. CoinWorkDouble * rhsFixRegion_; /// upperSlack CoinWorkDouble * upperSlack_; /// lowerSlack CoinWorkDouble * lowerSlack_; /// diagonal CoinWorkDouble * diagonal_; /// solution CoinWorkDouble * solution_; /// work array CoinWorkDouble * workArray_; /// delta X CoinWorkDouble * deltaX_; /// delta Y CoinWorkDouble * deltaY_; /// deltaZ. CoinWorkDouble * deltaZ_; /// deltaW. CoinWorkDouble * deltaW_; /// deltaS. CoinWorkDouble * deltaSU_; CoinWorkDouble * deltaSL_; /// Primal regularization array CoinWorkDouble * primalR_; /// Dual regularization array CoinWorkDouble * dualR_; /// rhs B CoinWorkDouble * rhsB_; /// rhsU. CoinWorkDouble * rhsU_; /// rhsL. CoinWorkDouble * rhsL_; /// rhsZ. CoinWorkDouble * rhsZ_; /// rhsW. CoinWorkDouble * rhsW_; /// rhs C CoinWorkDouble * rhsC_; /// zVec CoinWorkDouble * zVec_; /// wVec CoinWorkDouble * wVec_; /// cholesky. ClpCholeskyBase * cholesky_; /// numberComplementarityPairs i.e. ones with lower and/or upper bounds (not fixed) int numberComplementarityPairs_; /// numberComplementarityItems_ i.e. number of active bounds int numberComplementarityItems_; /// Maximum iterations int maximumBarrierIterations_; /// gonePrimalFeasible. bool gonePrimalFeasible_; /// goneDualFeasible. bool goneDualFeasible_; /// Which algorithm being used int algorithm_; //@} }; //############################################################################# /** A function that tests the methods in the ClpInterior class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. It also does some testing of ClpFactorization class */ void ClpInteriorUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Clp/src/CoinAbcSmallFactorization3.cpp0000644000175000017500000000103012101105055020414 0ustar renerene/* $Id: CoinAbcSmallFactorization3.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcSmallFactorization #define ABC_SMALL 4 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization3.cpp" #endif CoinMP-1.8.3/Clp/src/ClpCholeskyBase.cpp0000644000175000017500000051173612323253043016352 0ustar renerene/* $Id: ClpCholeskyBase.cpp 2030 2014-04-15 15:54:11Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /*----------------------------------------------------------------------------*/ /* Ordering code - courtesy of Anshul Gupta */ /* (C) Copyright IBM Corporation 1997, 2009. All Rights Reserved. */ /*----------------------------------------------------------------------------*/ /* A compact no-frills Approximate Minimum Local Fill ordering code. References: [1] Ordering Sparse Matrices Using Approximate Minimum Local Fill. Edward Rothberg, SGI Manuscript, April 1996. [2] An Approximate Minimum Degree Ordering Algorithm. T. Davis, P. Amestoy, and I. Duff, TR-94-039, CIS Department, University of Florida, December 1994. */ /*----------------------------------------------------------------------------*/ #include "CoinPragma.hpp" #include #include "ClpCholeskyBase.hpp" #include "ClpInterior.hpp" #include "ClpHelperFunctions.hpp" #include "CoinHelperFunctions.hpp" #include "CoinSort.hpp" #include "ClpCholeskyDense.hpp" #include "ClpMessage.hpp" #include "ClpQuadraticObjective.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpCholeskyBase::ClpCholeskyBase (int denseThreshold) : type_(0), doKKT_(false), goDense_(0.7), choleskyCondition_(0.0), model_(NULL), numberTrials_(), numberRows_(0), status_(0), rowsDropped_(NULL), permuteInverse_(NULL), permute_(NULL), numberRowsDropped_(0), sparseFactor_(NULL), choleskyStart_(NULL), choleskyRow_(NULL), indexStart_(NULL), diagonal_(NULL), workDouble_(NULL), link_(NULL), workInteger_(NULL), clique_(NULL), sizeFactor_(0), sizeIndex_(0), firstDense_(0), rowCopy_(NULL), whichDense_(NULL), denseColumn_(NULL), dense_(NULL), denseThreshold_(denseThreshold) { memset(integerParameters_, 0, 64 * sizeof(int)); memset(doubleParameters_, 0, 64 * sizeof(double)); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpCholeskyBase::ClpCholeskyBase (const ClpCholeskyBase & rhs) : type_(rhs.type_), doKKT_(rhs.doKKT_), goDense_(rhs.goDense_), choleskyCondition_(rhs.choleskyCondition_), model_(rhs.model_), numberTrials_(rhs.numberTrials_), numberRows_(rhs.numberRows_), status_(rhs.status_), numberRowsDropped_(rhs.numberRowsDropped_) { rowsDropped_ = ClpCopyOfArray(rhs.rowsDropped_, numberRows_); permuteInverse_ = ClpCopyOfArray(rhs.permuteInverse_, numberRows_); permute_ = ClpCopyOfArray(rhs.permute_, numberRows_); sizeFactor_ = rhs.sizeFactor_; sizeIndex_ = rhs.sizeIndex_; firstDense_ = rhs.firstDense_; sparseFactor_ = ClpCopyOfArray(rhs.sparseFactor_, rhs.sizeFactor_); choleskyStart_ = ClpCopyOfArray(rhs.choleskyStart_, numberRows_ + 1); indexStart_ = ClpCopyOfArray(rhs.indexStart_, numberRows_); choleskyRow_ = ClpCopyOfArray(rhs.choleskyRow_, sizeIndex_); diagonal_ = ClpCopyOfArray(rhs.diagonal_, numberRows_); #if CLP_LONG_CHOLESKY!=1 workDouble_ = ClpCopyOfArray(rhs.workDouble_, numberRows_); #else // actually long double workDouble_ = reinterpret_cast (ClpCopyOfArray(reinterpret_cast (rhs.workDouble_), numberRows_)); #endif link_ = ClpCopyOfArray(rhs.link_, numberRows_); workInteger_ = ClpCopyOfArray(rhs.workInteger_, numberRows_); clique_ = ClpCopyOfArray(rhs.clique_, numberRows_); CoinMemcpyN(rhs.integerParameters_, 64, integerParameters_); CoinMemcpyN(rhs.doubleParameters_, 64, doubleParameters_); rowCopy_ = rhs.rowCopy_->clone(); whichDense_ = NULL; denseColumn_ = NULL; dense_ = NULL; denseThreshold_ = rhs.denseThreshold_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpCholeskyBase::~ClpCholeskyBase () { delete [] rowsDropped_; delete [] permuteInverse_; delete [] permute_; delete [] sparseFactor_; delete [] choleskyStart_; delete [] choleskyRow_; delete [] indexStart_; delete [] diagonal_; delete [] workDouble_; delete [] link_; delete [] workInteger_; delete [] clique_; delete rowCopy_; delete [] whichDense_; delete [] denseColumn_; delete dense_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpCholeskyBase & ClpCholeskyBase::operator=(const ClpCholeskyBase& rhs) { if (this != &rhs) { type_ = rhs.type_; doKKT_ = rhs.doKKT_; goDense_ = rhs.goDense_; choleskyCondition_ = rhs.choleskyCondition_; model_ = rhs.model_; numberTrials_ = rhs.numberTrials_; numberRows_ = rhs.numberRows_; status_ = rhs.status_; numberRowsDropped_ = rhs.numberRowsDropped_; delete [] rowsDropped_; delete [] permuteInverse_; delete [] permute_; delete [] sparseFactor_; delete [] choleskyStart_; delete [] choleskyRow_; delete [] indexStart_; delete [] diagonal_; delete [] workDouble_; delete [] link_; delete [] workInteger_; delete [] clique_; delete rowCopy_; delete [] whichDense_; delete [] denseColumn_; delete dense_; rowsDropped_ = ClpCopyOfArray(rhs.rowsDropped_, numberRows_); permuteInverse_ = ClpCopyOfArray(rhs.permuteInverse_, numberRows_); permute_ = ClpCopyOfArray(rhs.permute_, numberRows_); sizeFactor_ = rhs.sizeFactor_; sizeIndex_ = rhs.sizeIndex_; firstDense_ = rhs.firstDense_; sparseFactor_ = ClpCopyOfArray(rhs.sparseFactor_, rhs.sizeFactor_); choleskyStart_ = ClpCopyOfArray(rhs.choleskyStart_, numberRows_ + 1); choleskyRow_ = ClpCopyOfArray(rhs.choleskyRow_, rhs.sizeFactor_); indexStart_ = ClpCopyOfArray(rhs.indexStart_, numberRows_); choleskyRow_ = ClpCopyOfArray(rhs.choleskyRow_, sizeIndex_); diagonal_ = ClpCopyOfArray(rhs.diagonal_, numberRows_); #if CLP_LONG_CHOLESKY!=1 workDouble_ = ClpCopyOfArray(rhs.workDouble_, numberRows_); #else // actually long double workDouble_ = reinterpret_cast (ClpCopyOfArray(reinterpret_cast (rhs.workDouble_), numberRows_)); #endif link_ = ClpCopyOfArray(rhs.link_, numberRows_); workInteger_ = ClpCopyOfArray(rhs.workInteger_, numberRows_); clique_ = ClpCopyOfArray(rhs.clique_, numberRows_); rowCopy_ = rhs.rowCopy_->clone(); whichDense_ = NULL; denseColumn_ = NULL; dense_ = NULL; denseThreshold_ = rhs.denseThreshold_; } return *this; } // reset numberRowsDropped and rowsDropped. void ClpCholeskyBase::resetRowsDropped() { numberRowsDropped_ = 0; memset(rowsDropped_, 0, numberRows_); } /* Uses factorization to solve. - given as if KKT. region1 is rows+columns, region2 is rows */ void ClpCholeskyBase::solveKKT (CoinWorkDouble * region1, CoinWorkDouble * region2, const CoinWorkDouble * diagonal, CoinWorkDouble diagonalScaleFactor) { if (!doKKT_) { int iColumn; int numberColumns = model_->numberColumns(); int numberTotal = numberRows_ + numberColumns; CoinWorkDouble * region1Save = new CoinWorkDouble[numberTotal]; for (iColumn = 0; iColumn < numberTotal; iColumn++) { region1[iColumn] *= diagonal[iColumn]; region1Save[iColumn] = region1[iColumn]; } multiplyAdd(region1 + numberColumns, numberRows_, -1.0, region2, 1.0); model_->clpMatrix()->times(1.0, region1, region2); CoinWorkDouble maximumRHS = maximumAbsElement(region2, numberRows_); CoinWorkDouble scale = 1.0; CoinWorkDouble unscale = 1.0; if (maximumRHS > 1.0e-30) { if (maximumRHS <= 0.5) { CoinWorkDouble factor = 2.0; while (maximumRHS <= 0.5) { maximumRHS *= factor; scale *= factor; } /* endwhile */ } else if (maximumRHS >= 2.0 && maximumRHS <= COIN_DBL_MAX) { CoinWorkDouble factor = 0.5; while (maximumRHS >= 2.0) { maximumRHS *= factor; scale *= factor; } /* endwhile */ } unscale = diagonalScaleFactor / scale; } else { //effectively zero scale = 0.0; unscale = 0.0; } multiplyAdd(NULL, numberRows_, 0.0, region2, scale); solve(region2); multiplyAdd(NULL, numberRows_, 0.0, region2, unscale); multiplyAdd(region2, numberRows_, -1.0, region1 + numberColumns, 0.0); CoinZeroN(region1, numberColumns); model_->clpMatrix()->transposeTimes(1.0, region2, region1); for (iColumn = 0; iColumn < numberTotal; iColumn++) region1[iColumn] = region1[iColumn] * diagonal[iColumn] - region1Save[iColumn]; delete [] region1Save; } else { // KKT int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; CoinWorkDouble * array = new CoinWorkDouble [numberRows_]; CoinMemcpyN(region1, numberTotal, array); CoinMemcpyN(region2, numberRowsModel, array + numberTotal); assert (numberRows_ >= numberRowsModel + numberTotal); solve(array); int iRow; for (iRow = 0; iRow < numberTotal; iRow++) { if (rowsDropped_[iRow] && CoinAbs(array[iRow]) > 1.0e-8) { COIN_DETAIL_PRINT(printf("row region1 %d dropped %g\n", iRow, array[iRow])); } } for (; iRow < numberRows_; iRow++) { if (rowsDropped_[iRow] && CoinAbs(array[iRow]) > 1.0e-8) { COIN_DETAIL_PRINT(printf("row region2 %d dropped %g\n", iRow, array[iRow])); } } CoinMemcpyN(array + numberTotal, numberRowsModel, region2); CoinMemcpyN(array, numberTotal, region1); delete [] array; } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpCholeskyBase * ClpCholeskyBase::clone() const { return new ClpCholeskyBase(*this); } // Forms ADAT - returns nonzero if not enough memory int ClpCholeskyBase::preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT) { delete rowCopy_; rowCopy_ = model_->clpMatrix()->reverseOrderedCopy(); if (!doKKT) { numberRows_ = model_->numberRows(); rowsDropped_ = new char [numberRows_]; memset(rowsDropped_, 0, numberRows_); numberRowsDropped_ = 0; // Space for starts choleskyStart_ = new CoinBigIndex[numberRows_+1]; const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); // We need two arrays for counts int * which = new int [numberRows_]; int * used = new int[numberRows_+1]; CoinZeroN(used, numberRows_); int iRow; sizeFactor_ = 0; int numberColumns = model_->numberColumns(); int numberDense = 0; //denseThreshold_=3; if (denseThreshold_ > 0) { delete [] whichDense_; delete [] denseColumn_; delete dense_; whichDense_ = new char[numberColumns]; int iColumn; used[numberRows_] = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; used[length] += 1; } int nLong = 0; int stop = CoinMax(denseThreshold_ / 2, 100); for (iRow = numberRows_; iRow >= stop; iRow--) { if (used[iRow]) COIN_DETAIL_PRINT(printf("%d columns are of length %d\n", used[iRow], iRow)); nLong += used[iRow]; if (nLong > 50 || nLong > (numberColumns >> 2)) break; } CoinZeroN(used, numberRows_); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLength[iColumn] < denseThreshold_) { whichDense_[iColumn] = 0; } else { whichDense_[iColumn] = 1; numberDense++; } } if (!numberDense || numberDense > 100) { // free delete [] whichDense_; whichDense_ = NULL; denseColumn_ = NULL; dense_ = NULL; } else { // space for dense columns denseColumn_ = new longDouble [numberDense*numberRows_]; // dense cholesky dense_ = new ClpCholeskyDense(); dense_->reserveSpace(NULL, numberDense); COIN_DETAIL_PRINT(printf("Taking %d columns as dense\n", numberDense)); } } int offset = includeDiagonal ? 0 : 1; if (lowerTriangular) offset = -offset; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 0; // make sure diagonal exists if includeDiagonal if (!offset) { which[0] = iRow; used[iRow] = 1; number = 1; } CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; if (lowerTriangular) { for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow <= iRow + offset) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } } } else { for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow + offset) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; } delete [] which; // Now we have size - create arrays and fill in try { choleskyRow_ = new int [sizeFactor_]; } catch (...) { // no memory delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } sizeFactor_ = 0; which = choleskyRow_; for (iRow = 0; iRow < numberRows_; iRow++) { int number = 0; // make sure diagonal exists if includeDiagonal if (!offset) { which[0] = iRow; used[iRow] = 1; number = 1; } choleskyStart_[iRow] = sizeFactor_; CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; if (lowerTriangular) { for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow <= iRow + offset) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } } } else { for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow >= iRow + offset) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; } } } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; // Sort std::sort(which, which + number); // move which on which += number; } choleskyStart_[numberRows_] = sizeFactor_; delete [] used; return 0; } else { int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; numberRows_ = 2 * numberRowsModel + numberColumns; rowsDropped_ = new char [numberRows_]; memset(rowsDropped_, 0, numberRows_); numberRowsDropped_ = 0; CoinPackedMatrix * quadratic = NULL; ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(model_->objectiveAsObject())); if (quadraticObj) quadratic = quadraticObj->quadraticObjective(); int numberElements = model_->clpMatrix()->getNumElements(); numberElements = numberElements + 2 * numberRowsModel + numberTotal; if (quadratic) numberElements += quadratic->getNumElements(); // Space for starts choleskyStart_ = new CoinBigIndex[numberRows_+1]; const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); //const double * element = model_->clpMatrix()->getElements(); // Now we have size - create arrays and fill in try { choleskyRow_ = new int [numberElements]; } catch (...) { // no memory delete [] choleskyStart_; choleskyStart_ = NULL; return -1; } int iRow, iColumn; sizeFactor_ = 0; // matrix if (lowerTriangular) { if (!quadratic) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { choleskyStart_[iColumn] = sizeFactor_; choleskyRow_[sizeFactor_++] = iColumn; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; if (!includeDiagonal) start++; for (CoinBigIndex j = start; j < end; j++) { choleskyRow_[sizeFactor_++] = row[j] + numberTotal; } } } else { // Quadratic const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); //const double * quadraticElement = quadratic->getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { choleskyStart_[iColumn] = sizeFactor_; if (includeDiagonal) choleskyRow_[sizeFactor_++] = iColumn; CoinBigIndex j; for ( j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; if (jColumn > iColumn) choleskyRow_[sizeFactor_++] = jColumn; } CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for ( j = start; j < end; j++) { choleskyRow_[sizeFactor_++] = row[j] + numberTotal; } } } // slacks for (; iColumn < numberTotal; iColumn++) { choleskyStart_[iColumn] = sizeFactor_; if (includeDiagonal) choleskyRow_[sizeFactor_++] = iColumn; choleskyRow_[sizeFactor_++] = iColumn - numberColumns + numberTotal; } // Transpose - nonzero diagonal (may regularize) for (iRow = 0; iRow < numberRowsModel; iRow++) { choleskyStart_[iRow+numberTotal] = sizeFactor_; // diagonal if (includeDiagonal) choleskyRow_[sizeFactor_++] = iRow + numberTotal; } choleskyStart_[numberRows_] = sizeFactor_; } else { // transpose ClpMatrixBase * rowCopy = model_->clpMatrix()->reverseOrderedCopy(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const int * column = rowCopy->getIndices(); if (!quadratic) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { choleskyStart_[iColumn] = sizeFactor_; if (includeDiagonal) choleskyRow_[sizeFactor_++] = iColumn; } } else { // Quadratic // transpose CoinPackedMatrix quadraticT; quadraticT.reverseOrderedCopyOf(*quadratic); const int * columnQuadratic = quadraticT.getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticT.getVectorStarts(); const int * columnQuadraticLength = quadraticT.getVectorLengths(); //const double * quadraticElement = quadraticT.getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { choleskyStart_[iColumn] = sizeFactor_; for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; if (jColumn < iColumn) choleskyRow_[sizeFactor_++] = jColumn; } if (includeDiagonal) choleskyRow_[sizeFactor_++] = iColumn; } } int iRow; // slacks for (iRow = 0; iRow < numberRowsModel; iRow++) { choleskyStart_[iRow+numberColumns] = sizeFactor_; if (includeDiagonal) choleskyRow_[sizeFactor_++] = iRow + numberColumns; } for (iRow = 0; iRow < numberRowsModel; iRow++) { choleskyStart_[iRow+numberTotal] = sizeFactor_; CoinBigIndex start = rowStart[iRow]; CoinBigIndex end = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex j = start; j < end; j++) { choleskyRow_[sizeFactor_++] = column[j]; } // slack choleskyRow_[sizeFactor_++] = numberColumns + iRow; if (includeDiagonal) choleskyRow_[sizeFactor_++] = iRow + numberTotal; } choleskyStart_[numberRows_] = sizeFactor_; } } return 0; } /* Orders rows and saves pointer to matrix.and model */ int ClpCholeskyBase::order(ClpInterior * model) { model_ = model; #define BASE_ORDER 2 #if BASE_ORDER>0 if (model_->numberRows() > 6 ) { if (preOrder(doKKT_, true, doKKT_)) return -1; //rowsDropped_ = new char [numberRows_]; numberRowsDropped_ = 0; memset(rowsDropped_, 0, numberRows_); //rowCopy_ = model->clpMatrix()->reverseOrderedCopy(); // approximate minimum degree return orderAMD(); } #endif int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; CoinPackedMatrix * quadratic = NULL; ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(model_->objectiveAsObject())); if (quadraticObj) quadratic = quadraticObj->quadraticObjective(); if (!doKKT_) { numberRows_ = model->numberRows(); } else { numberRows_ = 2 * numberRowsModel + numberColumns; } rowsDropped_ = new char [numberRows_]; numberRowsDropped_ = 0; memset(rowsDropped_, 0, numberRows_); rowCopy_ = model->clpMatrix()->reverseOrderedCopy(); const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); // We need arrays for counts int * which = new int [numberRows_]; int * used = new int[numberRows_+1]; int * count = new int[numberRows_]; CoinZeroN(count, numberRows_); CoinZeroN(used, numberRows_); int iRow; sizeFactor_ = 0; permute_ = new int[numberRows_]; for (iRow = 0; iRow < numberRows_; iRow++) permute_[iRow] = iRow; if (!doKKT_) { int numberDense = 0; if (denseThreshold_ > 0) { delete [] whichDense_; delete [] denseColumn_; delete dense_; whichDense_ = new char[numberColumns]; int iColumn; used[numberRows_] = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int length = columnLength[iColumn]; used[length] += 1; } int nLong = 0; int stop = CoinMax(denseThreshold_ / 2, 100); for (iRow = numberRows_; iRow >= stop; iRow--) { if (used[iRow]) COIN_DETAIL_PRINT(printf("%d columns are of length %d\n", used[iRow], iRow)); nLong += used[iRow]; if (nLong > 50 || nLong > (numberColumns >> 2)) break; } CoinZeroN(used, numberRows_); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLength[iColumn] < denseThreshold_) { whichDense_[iColumn] = 0; } else { whichDense_[iColumn] = 1; numberDense++; } } if (!numberDense || numberDense > 100) { // free delete [] whichDense_; whichDense_ = NULL; denseColumn_ = NULL; dense_ = NULL; } else { // space for dense columns denseColumn_ = new longDouble [numberDense*numberRows_]; // dense cholesky dense_ = new ClpCholeskyDense(); dense_->reserveSpace(NULL, numberDense); COIN_DETAIL_PRINT(printf("Taking %d columns as dense\n", numberDense)); } } /* Get row counts and size */ for (iRow = 0; iRow < numberRows_; iRow++) { int number = 1; // make sure diagonal exists which[0] = iRow; used[iRow] = 1; CoinBigIndex startRow = rowStart[iRow]; CoinBigIndex endRow = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; if (jRow < iRow) { if (!used[jRow]) { used[jRow] = 1; which[number++] = jRow; count[jRow]++; } } } } } sizeFactor_ += number; count[iRow] += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; } CoinSort_2(count, count + numberRows_, permute_); } else { // KKT int numberElements = model_->clpMatrix()->getNumElements(); numberElements = numberElements + 2 * numberRowsModel + numberTotal; if (quadratic) numberElements += quadratic->getNumElements(); // off diagonal numberElements -= numberRows_; sizeFactor_ = numberElements; // If we sort we need to redo symbolic etc } delete [] which; delete [] used; delete [] count; permuteInverse_ = new int [numberRows_]; for (iRow = 0; iRow < numberRows_; iRow++) { //permute_[iRow]=iRow; // force no permute //permute_[iRow]=numberRows_-1-iRow; // force odd permute //permute_[iRow]=(iRow+1)%numberRows_; // force odd permute permuteInverse_[permute_[iRow]] = iRow; } return 0; } #if BASE_ORDER==1 /* Orders rows and saves pointer to matrix.and model */ int ClpCholeskyBase::orderAMD() { permuteInverse_ = new int [numberRows_]; permute_ = new int[numberRows_]; // Do ordering int returnCode = 0; // get more space and full matrix int space = 6 * sizeFactor_ + 100000; int * temp = new int [space]; int * which = new int[2*numberRows_]; CoinBigIndex * tempStart = new CoinBigIndex [numberRows_+1]; memset(which, 0, numberRows_ * sizeof(int)); for (int iRow = 0; iRow < numberRows_; iRow++) { which[iRow] += choleskyStart_[iRow+1] - choleskyStart_[iRow] - 1; for (CoinBigIndex j = choleskyStart_[iRow] + 1; j < choleskyStart_[iRow+1]; j++) { int jRow = choleskyRow_[j]; which[jRow]++; } } CoinBigIndex sizeFactor = 0; for (int iRow = 0; iRow < numberRows_; iRow++) { int length = which[iRow]; permute_[iRow] = length; tempStart[iRow] = sizeFactor; which[iRow] = sizeFactor; sizeFactor += length; } for (int iRow = 0; iRow < numberRows_; iRow++) { assert (choleskyRow_[choleskyStart_[iRow]] == iRow); for (CoinBigIndex j = choleskyStart_[iRow] + 1; j < choleskyStart_[iRow+1]; j++) { int jRow = choleskyRow_[j]; int put = which[iRow]; temp[put] = jRow; which[iRow]++; put = which[jRow]; temp[put] = iRow; which[jRow]++; } } for (int iRow = 1; iRow < numberRows_; iRow++) assert (which[iRow-1] == tempStart[iRow]); CoinBigIndex lastSpace = sizeFactor; delete [] choleskyRow_; choleskyRow_ = temp; delete [] choleskyStart_; choleskyStart_ = tempStart; // linked lists of sizes and lengths int * first = new int [numberRows_]; int * next = new int [numberRows_]; int * previous = new int [numberRows_]; char * mark = new char[numberRows_]; memset(mark, 0, numberRows_); CoinBigIndex * sort = new CoinBigIndex [numberRows_]; int * order = new int [numberRows_]; for (int iRow = 0; iRow < numberRows_; iRow++) { first[iRow] = -1; next[iRow] = -1; previous[iRow] = -1; permuteInverse_[iRow] = -1; } int large = 1000 + 2 * numberRows_; for (int iRow = 0; iRow < numberRows_; iRow++) { int n = permute_[iRow]; if (first[n] < 0) { first[n] = iRow; previous[iRow] = n + large; next[iRow] = n + 2 * large; } else { int k = first[n]; assert (k < numberRows_); first[n] = iRow; previous[iRow] = n + large; assert (previous[k] == n + large); next[iRow] = k; previous[k] = iRow; } } int smallest = 0; int done = 0; int numberCompressions = 0; int numberExpansions = 0; while (smallest < numberRows_) { if (first[smallest] < 0 || first[smallest] > numberRows_) { smallest++; continue; } int iRow = first[smallest]; if (false) { int kRow = -1; int ss = 999999; for (int jRow = numberRows_ - 1; jRow >= 0; jRow--) { if (permuteInverse_[jRow] < 0) { int length = permute_[jRow]; assert (length > 0); for (CoinBigIndex j = choleskyStart_[jRow]; j < choleskyStart_[jRow] + length; j++) { int jjRow = choleskyRow_[j]; assert (permuteInverse_[jjRow] < 0); } if (length < ss) { ss = length; kRow = jRow; } } } assert (smallest == ss); printf("list chose %d - full chose %d - length %d\n", iRow, kRow, ss); } int kNext = next[iRow]; first[smallest] = kNext; if (kNext < numberRows_) previous[kNext] = previous[iRow]; previous[iRow] = -1; next[iRow] = -1; permuteInverse_[iRow] = done; done++; // Now add edges CoinBigIndex start = choleskyStart_[iRow]; CoinBigIndex end = choleskyStart_[iRow] + permute_[iRow]; int nSave = 0; for (CoinBigIndex k = start; k < end; k++) { int kRow = choleskyRow_[k]; assert (permuteInverse_[kRow] < 0); //if (permuteInverse_[kRow]<0) which[nSave++] = kRow; } for (int i = 0; i < nSave; i++) { int kRow = which[i]; int length = permute_[kRow]; CoinBigIndex start = choleskyStart_[kRow]; CoinBigIndex end = choleskyStart_[kRow] + length; for (CoinBigIndex j = start; j < end; j++) { int jRow = choleskyRow_[j]; mark[jRow] = 1; } mark[kRow] = 1; int n = nSave; for (int j = 0; j < nSave; j++) { int jRow = which[j]; if (!mark[jRow]) { which[n++] = jRow; } } for (CoinBigIndex j = start; j < end; j++) { int jRow = choleskyRow_[j]; mark[jRow] = 0; } mark[kRow] = 0; if (n > nSave) { bool inPlace = (n - nSave == 1); if (!inPlace) { // extend int length = n - nSave + end - start; if (length + lastSpace > space) { // need to compress numberCompressions++; int newN = 0; for (int iRow = 0; iRow < numberRows_; iRow++) { CoinBigIndex start = choleskyStart_[iRow]; if (permuteInverse_[iRow] < 0) { sort[newN] = start; order[newN++] = iRow; } else { choleskyStart_[iRow] = -1; permute_[iRow] = 0; } } CoinSort_2(sort, sort + newN, order); sizeFactor = 0; for (int k = 0; k < newN; k++) { int iRow = order[k]; int length = permute_[iRow]; CoinBigIndex start = choleskyStart_[iRow]; choleskyStart_[iRow] = sizeFactor; for (int j = 0; j < length; j++) choleskyRow_[sizeFactor+j] = choleskyRow_[start+j]; sizeFactor += length; } lastSpace = sizeFactor; if ((sizeFactor + numberRows_ + 1000) * 4 > 3 * space) { // need to expand numberExpansions++; space = (3 * space) / 2; int * temp = new int [space]; memcpy(temp, choleskyRow_, sizeFactor * sizeof(int)); delete [] choleskyRow_; choleskyRow_ = temp; } } } // Now add start = choleskyStart_[kRow]; end = choleskyStart_[kRow] + permute_[kRow]; if (!inPlace) choleskyStart_[kRow] = lastSpace; CoinBigIndex put = choleskyStart_[kRow]; for (CoinBigIndex j = start; j < end; j++) { int jRow = choleskyRow_[j]; if (permuteInverse_[jRow] < 0) choleskyRow_[put++] = jRow; } for (int j = nSave; j < n; j++) { int jRow = which[j]; choleskyRow_[put++] = jRow; } if (!inPlace) { permute_[kRow] = put - lastSpace; lastSpace = put; } else { permute_[kRow] = put - choleskyStart_[kRow]; } } else { // pack down for new counts CoinBigIndex put = start; for (CoinBigIndex j = start; j < end; j++) { int jRow = choleskyRow_[j]; if (permuteInverse_[jRow] < 0) choleskyRow_[put++] = jRow; } permute_[kRow] = put - start; } // take out int iNext = next[kRow]; int iPrevious = previous[kRow]; if (iPrevious < numberRows_) { next[iPrevious] = iNext; } else { assert (iPrevious == length + large); first[length] = iNext; } if (iNext < numberRows_) { previous[iNext] = iPrevious; } else { assert (iNext == length + 2 * large); } // put in length = permute_[kRow]; smallest = CoinMin(smallest, length); if (first[length] < 0 || first[length] > numberRows_) { first[length] = kRow; previous[kRow] = length + large; next[kRow] = length + 2 * large; } else { int k = first[length]; assert (k < numberRows_); first[length] = kRow; previous[kRow] = length + large; assert (previous[k] == length + large); next[kRow] = k; previous[k] = kRow; } } } // do rest for (int iRow = 0; iRow < numberRows_; iRow++) { if (permuteInverse_[iRow] < 0) permuteInverse_[iRow] = done++; } COIN_DETAIL_PRINT(printf("%d compressions, %d expansions\n", numberCompressions, numberExpansions)); assert (done == numberRows_); delete [] sort; delete [] order; delete [] which; delete [] mark; delete [] first; delete [] next; delete [] previous; delete [] choleskyRow_; choleskyRow_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; #ifndef NDEBUG for (int iRow = 0; iRow < numberRows_; iRow++) { permute_[iRow] = -1; } #endif for (int iRow = 0; iRow < numberRows_; iRow++) { permute_[permuteInverse_[iRow]] = iRow; } #ifndef NDEBUG for (int iRow = 0; iRow < numberRows_; iRow++) { assert(permute_[iRow] >= 0 && permute_[iRow] < numberRows_); } #endif return returnCode; } #elif BASE_ORDER==2 /*----------------------------------------------------------------------------*/ /* (C) Copyright IBM Corporation 1997, 2009. All Rights Reserved. */ /*----------------------------------------------------------------------------*/ /* A compact no-frills Approximate Minimum Local Fill ordering code. References: [1] Ordering Sparse Matrices Using Approximate Minimum Local Fill. Edward Rothberg, SGI Manuscript, April 1996. [2] An Approximate Minimum Degree Ordering Algorithm. T. Davis, P. Amestoy, and I. Duff, TR-94-039, CIS Department, University of Florida, December 1994. */ #include #include typedef int WSI; #define NORDTHRESH 7 #define MAXIW 2147000000 //#define WSSMP_DBG #ifdef WSSMP_DBG static void chk (WSI ind, WSI i, WSI lim) { if (i <= 0 || i > lim) { printf("%d: chk: myamlf: WAR**: i, lim = %d, %d\n", ind, i, lim); } } #endif static void myamlf(WSI n, WSI xadj[], WSI adjncy[], WSI dgree[], WSI varbl[], WSI snxt[], WSI perm[], WSI invp[], WSI head[], WSI lsize[], WSI flag[], WSI erscore[], WSI locaux, WSI adjln, WSI speed) { WSI l, i, j, k; double x, y; WSI maxmum, fltag, nodeg, scln, nm1, deg, tn, locatns, ipp, jpp, nnode, numpiv, node, nodeln, currloc, counter, numii, mindeg, i0, i1, i2, i4, i5, i6, i7, i9, j0, j1, j2, j3, j4, j5, j6, j7, j8, j9; /* n cannot be less than NORDTHRESH if (n < 3) { if (n > 0) perm[0] = invp[0] = 1; if (n > 1) perm[1] = invp[1] = 2; return; } */ #ifdef WSSMP_DBG printf("Myamlf: n, locaux, adjln, speed = %d,%d,%d,%d\n", n, locaux, adjln, speed); for (i = 0; i < n; i++) flag[i] = 0; k = xadj[0]; for (i = 1; i <= n; i++) { j = k + dgree[i-1]; if (j < k || k < 1) printf("ERR**: myamlf: i, j, k = %d,%d,%d\n", i, j, k); for (l = k; l < j; l++) { if (adjncy[l - 1] < 1 || adjncy[l - 1] > n || adjncy[l - 1] == i) printf("ERR**: myamlf: i, l, adjj[l] = %d,%d,%d\n", i, l, adjncy[l - 1]); if (flag[adjncy[l - 1] - 1] == i) printf("ERR**: myamlf: duplicate entry: %d - %d\n", i, adjncy[l - 1]); flag[adjncy[l - 1] - 1] = i; nm1 = adjncy[l - 1] - 1; for (fltag = xadj[nm1]; fltag < xadj[nm1] + dgree[nm1]; fltag++) { if (adjncy[fltag - 1] == i) goto L100; } printf("ERR**: Unsymmetric %d %d\n", i, fltag); L100: ; } k = j; if (k > locaux) printf("ERR**: i, j, k, locaux = %d, %d, %d, %d\n", i, j, k, locaux); } if (n*(n - 1) < locaux - 1) printf("ERR**: myamlf: too many nnz, n, ne = %d, %d\n", n, adjln); for (i = 0; i < n; i++) flag[i] = 1; if (n > 10000) printf ("Finished error checking in AMF\n"); for (i = locaux; i <= adjln; i++) adjncy[i - 1] = -22; #endif maxmum = 0; mindeg = 1; fltag = 2; locatns = locaux - 1; nm1 = n - 1; counter = 1; for (l = 0; l < n; l++) { j = erscore[l]; #ifdef WSSMP_DBG chk(1, j, n); #endif if (j > 0) { nnode = head[j - 1]; if (nnode) perm[nnode - 1] = l + 1; snxt[l] = nnode; head[j - 1] = l + 1; } else { invp[l] = -(counter++); flag[l] = xadj[l] = 0; } } while (counter <= n) { for (deg = mindeg; head[deg - 1] < 1; deg++) {}; nodeg = 0; #ifdef WSSMP_DBG chk(2, deg, n - 1); #endif node = head[deg - 1]; #ifdef WSSMP_DBG chk(3, node, n); #endif mindeg = deg; nnode = snxt[node - 1]; if (nnode) perm[nnode - 1] = 0; head[deg - 1] = nnode; nodeln = invp[node - 1]; numpiv = varbl[node - 1]; invp[node - 1] = -counter; counter += numpiv; varbl[node - 1] = -numpiv; if (nodeln) { j4 = locaux; i5 = lsize[node - 1] - nodeln; i2 = nodeln + 1; l = xadj[node - 1]; for (i6 = 1; i6 <= i2; ++i6) { if (i6 == i2) { tn = node, i0 = l, scln = i5; } else { #ifdef WSSMP_DBG chk(4, l, adjln); #endif tn = adjncy[l-1]; l++; #ifdef WSSMP_DBG chk(5, tn, n); #endif i0 = xadj[tn - 1]; scln = lsize[tn - 1]; } for (i7 = 1; i7 <= scln; ++i7) { #ifdef WSSMP_DBG chk(6, i0, adjln); #endif i = adjncy[i0 - 1]; i0++; #ifdef WSSMP_DBG chk(7, i, n); #endif numii = varbl[i - 1]; if (numii > 0) { if (locaux > adjln) { lsize[node - 1] -= i6; xadj[node - 1] = l; if (!lsize[node - 1]) xadj[node - 1] = 0; xadj[tn - 1] = i0; lsize[tn - 1] = scln - i7; if (!lsize[tn - 1]) xadj[tn - 1] = 0; for (j = 1; j <= n; j++) { i4 = xadj[j - 1]; if (i4 > 0) { xadj[j - 1] = adjncy[i4 - 1]; #ifdef WSSMP_DBG chk(8, i4, adjln); #endif adjncy[i4 - 1] = -j; } } i9 = j4 - 1; j6 = j7 = 1; while (j6 <= i9) { #ifdef WSSMP_DBG chk(9, j6, adjln); #endif j = -adjncy[j6 - 1]; j6++; if (j > 0) { #ifdef WSSMP_DBG chk(10, j7, adjln); chk(11, j, n); #endif adjncy[j7 - 1] = xadj[j - 1]; xadj[j - 1] = j7++; j8 = lsize[j - 1] - 1 + j7; for (; j7 < j8; j7++, j6++) adjncy[j7-1] = adjncy[j6-1]; } } for (j0 = j7; j4 < locaux; j4++, j7++) { #ifdef WSSMP_DBG chk(12, j4, adjln); #endif adjncy[j7 - 1] = adjncy[j4 - 1]; } j4 = j0; locaux = j7; i0 = xadj[tn - 1]; l = xadj[node - 1]; } adjncy[locaux-1] = i; locaux++; varbl[i - 1] = -numii; nodeg += numii; ipp = perm[i - 1]; nnode = snxt[i - 1]; #ifdef WSSMP_DBG if (ipp) chk(13, ipp, n); if (nnode) chk(14, nnode, n); #endif if (ipp) snxt[ipp - 1] = nnode; else head[erscore[i - 1] - 1] = nnode; if (nnode) perm[nnode - 1] = ipp; } } if (tn != node) { flag[tn - 1] = 0, xadj[tn - 1] = -node; } } currloc = (j5 = locaux) - j4; locatns += currloc; } else { i1 = (j4 = xadj[node - 1]) + lsize[node - 1]; for (j = j5 = j4; j < i1; j++) { #ifdef WSSMP_DBG chk(15, j, adjln); #endif i = adjncy[j - 1]; #ifdef WSSMP_DBG chk(16, i, n); #endif numii = varbl[i - 1]; if (numii > 0) { nodeg += numii; varbl[i - 1] = -numii; #ifdef WSSMP_DBG chk(17, j5, adjln); #endif adjncy[j5-1] = i; ipp = perm[i - 1]; nnode = snxt[i - 1]; j5++; #ifdef WSSMP_DBG if (ipp) chk(18, ipp, n); if (nnode) chk(19, nnode, n); #endif if (ipp) snxt[ipp - 1] = nnode; else head[erscore[i - 1] - 1] = nnode; if (nnode) perm[nnode - 1] = ipp; } } currloc = 0; } #ifdef WSSMP_DBG chk(20, node, n); #endif lsize[node - 1] = j5 - (xadj[node - 1] = j4); dgree[node - 1] = nodeg; if (fltag + n < 0 || fltag + n > MAXIW) { for (i = 1; i <= n; i++) if (flag[i - 1]) flag[i - 1] = 1; fltag = 2; } for (j3 = j4; j3 < j5; j3++) { #ifdef WSSMP_DBG chk(21, j3, adjln); #endif i = adjncy[j3 - 1]; #ifdef WSSMP_DBG chk(22, i, n); #endif j = invp[i - 1]; if (j > 0) { i4 = fltag - (numii = -varbl[i - 1]); i2 = xadj[i - 1] + j; for (l = xadj[i - 1]; l < i2; l++) { #ifdef WSSMP_DBG chk(23, l, adjln); #endif tn = adjncy[l - 1]; #ifdef WSSMP_DBG chk(24, tn, n); #endif j9 = flag[tn - 1]; if (j9 >= fltag) j9 -= numii; else if (j9) j9 = dgree[tn - 1] + i4; flag[tn - 1] = j9; } } } for (j3 = j4; j3 < j5; j3++) { #ifdef WSSMP_DBG chk(25, j3, adjln); #endif i = adjncy[j3 - 1]; i5 = deg = 0; #ifdef WSSMP_DBG chk(26, i, n); #endif j1 = (i4 = xadj[i - 1]) + invp[i - 1]; for (l = j0 = i4; l < j1; l++) { #ifdef WSSMP_DBG chk(27, l, adjln); #endif tn = adjncy[l - 1]; #ifdef WSSMP_DBG chk(70, tn, n); #endif j8 = flag[tn - 1]; if (j8) { deg += (j8 - fltag); #ifdef WSSMP_DBG chk(28, i4, adjln); #endif adjncy[i4-1] = tn; i5 += tn; i4++; while (i5 >= nm1) i5 -= nm1; } } invp[i - 1] = (j2 = i4) - j0 + 1; i2 = j0 + lsize[i - 1]; for (l = j1; l < i2; l++) { #ifdef WSSMP_DBG chk(29, l, adjln); #endif j = adjncy[l - 1]; #ifdef WSSMP_DBG chk(30, j, n); #endif numii = varbl[j - 1]; if (numii > 0) { deg += numii; #ifdef WSSMP_DBG chk(31, i4, adjln); #endif adjncy[i4-1] = j; i5 += j; i4++; while (i5 >= nm1) i5 -= nm1; } } if (invp[i - 1] == 1 && j2 == i4) { numii = -varbl[i - 1]; xadj[i - 1] = -node; nodeg -= numii; counter += numii; numpiv += numii; invp[i - 1] = varbl[i - 1] = 0; } else { if (dgree[i - 1] > deg) dgree[i - 1] = deg; #ifdef WSSMP_DBG chk(32, j2, adjln); chk(33, j0, adjln); #endif adjncy[i4 - 1] = adjncy[j2 - 1]; adjncy[j2 - 1] = adjncy[j0 - 1]; adjncy[j0 - 1] = node; lsize[i - 1] = i4 - j0 + 1; i5++; #ifdef WSSMP_DBG chk(35, i5, n); #endif j = head[i5 - 1]; if (j > 0) { snxt[i - 1] = perm[j - 1]; perm[j - 1] = i; } else { snxt[i - 1] = -j; head[i5 - 1] = -i; } perm[i - 1] = i5; } } #ifdef WSSMP_DBG chk(36, node, n); #endif dgree[node - 1] = nodeg; if (maxmum < nodeg) maxmum = nodeg; fltag += maxmum; #ifdef WSSMP_DBG if (fltag + n + 1 < 0) printf("ERR**: fltag = %d (A)\n", fltag); #endif for (j3 = j4; j3 < j5; ++j3) { #ifdef WSSMP_DBG chk(37, j3, adjln); #endif i = adjncy[j3 - 1]; #ifdef WSSMP_DBG chk(38, i, n); #endif if (varbl[i - 1] < 0) { i5 = perm[i - 1]; #ifdef WSSMP_DBG chk(39, i5, n); #endif j = head[i5 - 1]; if (j) { if (j < 0) { head[i5 - 1] = 0, i = -j; } else { #ifdef WSSMP_DBG chk(40, j, n); #endif i = perm[j - 1]; perm[j - 1] = 0; } while (i) { #ifdef WSSMP_DBG chk(41, i, n); #endif if (!snxt[i - 1]) { i = 0; } else { k = invp[i - 1]; i2 = xadj[i - 1] + (scln = lsize[i - 1]); for (l = xadj[i - 1] + 1; l < i2; l++) { #ifdef WSSMP_DBG chk(42, l, adjln); chk(43, adjncy[l - 1], n); #endif flag[adjncy[l - 1] - 1] = fltag; } jpp = i; j = snxt[i - 1]; while (j) { #ifdef WSSMP_DBG chk(44, j, n); #endif if (lsize[j - 1] == scln && invp[j - 1] == k) { i2 = xadj[j - 1] + scln; j8 = 1; for (l = xadj[j - 1] + 1; l < i2; l++) { #ifdef WSSMP_DBG chk(45, l, adjln); chk(46, adjncy[l - 1], n); #endif if (flag[adjncy[l - 1] - 1] != fltag) { j8 = 0; break; } } if (j8) { xadj[j - 1] = -i; varbl[i - 1] += varbl[j - 1]; varbl[j - 1] = invp[j - 1] = 0; #ifdef WSSMP_DBG chk(47, j, n); chk(48, jpp, n); #endif j = snxt[j - 1]; snxt[jpp - 1] = j; } else { jpp = j; #ifdef WSSMP_DBG chk(49, j, n); #endif j = snxt[j - 1]; } } else { jpp = j; #ifdef WSSMP_DBG chk(50, j, n); #endif j = snxt[j - 1]; } } fltag++; #ifdef WSSMP_DBG if (fltag + n + 1 < 0) printf("ERR**: fltag = %d (B)\n", fltag); #endif #ifdef WSSMP_DBG chk(51, i, n); #endif i = snxt[i - 1]; } } } } } j8 = nm1 - counter; switch (speed) { case 1: for (j = j3 = j4; j3 < j5; j3++) { #ifdef WSSMP_DBG chk(52, j3, adjln); #endif i = adjncy[j3 - 1]; #ifdef WSSMP_DBG chk(53, i, n); #endif numii = varbl[i - 1]; if (numii < 0) { k = 0; i4 = (l = xadj[i - 1]) + invp[i - 1]; for (; l < i4; l++) { #ifdef WSSMP_DBG chk(54, l, adjln); chk(55, adjncy[l - 1], n); #endif i5 = dgree[adjncy[l - 1] - 1]; if (k < i5) k = i5; } x = static_cast (k - 1); varbl[i - 1] = abs(numii); j9 = dgree[i - 1] + nodeg; deg = (j8 > j9 ? j9 : j8) + numii; if (deg < 1) deg = 1; y = static_cast (deg); dgree[i - 1] = deg; /* printf("%i %f should >= %i %f\n",deg,y,k-1,x); if (y < x) printf("** \n"); else printf("\n"); */ y = y * y - y; x = y - (x * x - x); if (x < 1.1) x = 1.1; deg = static_cast(sqrt(x)); /* if (deg < 1) deg = 1; */ erscore[i - 1] = deg; #ifdef WSSMP_DBG chk(56, deg, n - 1); #endif nnode = head[deg - 1]; if (nnode) perm[nnode - 1] = i; snxt[i - 1] = nnode; perm[i - 1] = 0; #ifdef WSSMP_DBG chk(57, j, adjln); #endif head[deg - 1] = adjncy[j-1] = i; j++; if (deg < mindeg) mindeg = deg; } } break; case 2: for (j = j3 = j4; j3 < j5; j3++) { #ifdef WSSMP_DBG chk(58, j3, adjln); #endif i = adjncy[j3 - 1]; #ifdef WSSMP_DBG chk(59, i, n); #endif numii = varbl[i - 1]; if (numii < 0) { x = static_cast (dgree[adjncy[xadj[i - 1] - 1] - 1] - 1); varbl[i - 1] = abs(numii); j9 = dgree[i - 1] + nodeg; deg = (j8 > j9 ? j9 : j8) + numii; if (deg < 1) deg = 1; y = static_cast (deg); dgree[i - 1] = deg; /* printf("%i %f should >= %i %f",deg,y,dgree[adjncy[xadj[i - 1] - 1] - 1]-1,x); if (y < x) printf("** \n"); else printf("\n"); */ y = y * y - y; x = y - (x * x - x); if (x < 1.1) x = 1.1; deg = static_cast(sqrt(x)); /* if (deg < 1) deg = 1; */ erscore[i - 1] = deg; #ifdef WSSMP_DBG chk(60, deg, n - 1); #endif nnode = head[deg - 1]; if (nnode) perm[nnode - 1] = i; snxt[i - 1] = nnode; perm[i - 1] = 0; #ifdef WSSMP_DBG chk(61, j, adjln); #endif head[deg - 1] = adjncy[j-1] = i; j++; if (deg < mindeg) mindeg = deg; } } break; default: for (j = j3 = j4; j3 < j5; j3++) { #ifdef WSSMP_DBG chk(62, j3, adjln); #endif i = adjncy[j3 - 1]; #ifdef WSSMP_DBG chk(63, i, n); #endif numii = varbl[i - 1]; if (numii < 0) { varbl[i - 1] = abs(numii); j9 = dgree[i - 1] + nodeg; deg = (j8 > j9 ? j9 : j8) + numii; if (deg < 1) deg = 1; dgree[i - 1] = deg; #ifdef WSSMP_DBG chk(64, deg, n - 1); #endif nnode = head[deg - 1]; if (nnode) perm[nnode - 1] = i; snxt[i - 1] = nnode; perm[i - 1] = 0; #ifdef WSSMP_DBG chk(65, j, adjln); #endif head[deg - 1] = adjncy[j-1] = i; j++; if (deg < mindeg) mindeg = deg; } } break; } if (currloc) { #ifdef WSSMP_DBG chk(66, node, n); #endif locatns += (lsize[node - 1] - currloc), locaux = j; } varbl[node - 1] = numpiv + nodeg; lsize[node - 1] = j - j4; if (!lsize[node - 1]) flag[node - 1] = xadj[node - 1] = 0; } for (l = 1; l <= n; l++) { if (!invp[l - 1]) { for (i = -xadj[l - 1]; invp[i - 1] >= 0; i = -xadj[i - 1]) {}; tn = i; #ifdef WSSMP_DBG chk(67, tn, n); #endif k = -invp[tn - 1]; i = l; #ifdef WSSMP_DBG chk(68, i, n); #endif while (invp[i - 1] >= 0) { nnode = -xadj[i - 1]; xadj[i - 1] = -tn; if (!invp[i - 1]) invp[i - 1] = k++; i = nnode; } invp[tn - 1] = -k; } } for (l = 0; l < n; l++) { i = abs(invp[l]); #ifdef WSSMP_DBG chk(69, i, n); #endif invp[l] = i; perm[i - 1] = l + 1; } return; } // This code is not needed, but left in in case needed sometime #if 0 /*C--------------------------------------------------------------------------*/ void amlfdr(WSI *n, WSI xadj[], WSI adjncy[], WSI dgree[], WSI *adjln, WSI *locaux, WSI varbl[], WSI snxt[], WSI perm[], WSI head[], WSI invp[], WSI lsize[], WSI flag[], WSI *ispeed) { WSI nn, nlocaux, nadjln, speed, i, j, mx, mxj, *erscore; #ifdef WSSMP_DBG printf("Calling amlfdr for n, speed = %d, %d\n", *n, *ispeed); #endif if ((nn = *n) == 0) return; #ifdef WSSMP_DBG if (nn == 31) { printf("n = %d; adjln = %d; locaux = %d; ispeed = %d\n", *n, *adjln, *locaux, *ispeed); } #endif if (nn < NORDTHRESH) { for (i = 0; i < nn; i++) lsize[i] = i; for (i = nn; i > 0; i--) { mx = dgree[0]; mxj = 0; for (j = 1; j < i; j++) if (dgree[j] > mx) { mx = dgree[j]; mxj = j; } invp[lsize[mxj]] = i; dgree[mxj] = dgree[i-1]; lsize[mxj] = lsize[i-1]; } return; } speed = *ispeed; if (speed < 3) { /* erscore = (WSI *)malloc(nn * sizeof(WSI)); if (erscore == NULL) speed = 3; */ wscmal (&nn, &i, &erscore); if (i != 0) speed = 3; } if (speed > 2) erscore = dgree; if (speed < 3) { for (i = 0; i < nn; i++) { perm[i] = 0; invp[i] = 0; head[i] = 0; flag[i] = 1; varbl[i] = 1; lsize[i] = dgree[i]; erscore[i] = dgree[i]; } } else { for (i = 0; i < nn; i++) { perm[i] = 0; invp[i] = 0; head[i] = 0; flag[i] = 1; varbl[i] = 1; lsize[i] = dgree[i]; } } nlocaux = *locaux; nadjln = *adjln; myamlf(nn, xadj, adjncy, dgree, varbl, snxt, perm, invp, head, lsize, flag, erscore, nlocaux, nadjln, speed); /* if (speed < 3) free(erscore); */ if (speed < 3) wscfr(&erscore); return; } #endif // end of taking out amlfdr /*C--------------------------------------------------------------------------*/ #endif // Orders rows int ClpCholeskyBase::orderAMD() { permuteInverse_ = new int [numberRows_]; permute_ = new int[numberRows_]; // Do ordering int returnCode = 0; // get full matrix int space = 2 * sizeFactor_ + 10000 + 4 * numberRows_; int * temp = new int [space]; CoinBigIndex * count = new CoinBigIndex [numberRows_]; CoinBigIndex * tempStart = new CoinBigIndex [numberRows_+1]; memset(count, 0, numberRows_ * sizeof(int)); for (int iRow = 0; iRow < numberRows_; iRow++) { count[iRow] += choleskyStart_[iRow+1] - choleskyStart_[iRow] - 1; for (CoinBigIndex j = choleskyStart_[iRow] + 1; j < choleskyStart_[iRow+1]; j++) { int jRow = choleskyRow_[j]; count[jRow]++; } } #define OFFSET 1 CoinBigIndex sizeFactor = 0; for (int iRow = 0; iRow < numberRows_; iRow++) { int length = count[iRow]; permute_[iRow] = length; // add 1 to starts tempStart[iRow] = sizeFactor + OFFSET; count[iRow] = sizeFactor; sizeFactor += length; } tempStart[numberRows_] = sizeFactor + OFFSET; // add 1 to rows for (int iRow = 0; iRow < numberRows_; iRow++) { assert (choleskyRow_[choleskyStart_[iRow]] == iRow); for (CoinBigIndex j = choleskyStart_[iRow] + 1; j < choleskyStart_[iRow+1]; j++) { int jRow = choleskyRow_[j]; int put = count[iRow]; temp[put] = jRow + OFFSET; count[iRow]++; put = count[jRow]; temp[put] = iRow + OFFSET; count[jRow]++; } } for (int iRow = 1; iRow < numberRows_; iRow++) assert (count[iRow-1] == tempStart[iRow] - OFFSET); delete [] choleskyRow_; choleskyRow_ = temp; delete [] choleskyStart_; choleskyStart_ = tempStart; int locaux = sizeFactor + OFFSET; delete [] count; int speed = integerParameters_[0]; if (speed < 1 || speed > 2) speed = 3; int * use = new int [((speed<3) ? 7 : 6)*numberRows_]; int * dgree = use; int * varbl = dgree + numberRows_; int * snxt = varbl + numberRows_; int * head = snxt + numberRows_; int * lsize = head + numberRows_; int * flag = lsize + numberRows_; int * erscore; for (int i = 0; i < numberRows_; i++) { dgree[i] = choleskyStart_[i+1] - choleskyStart_[i]; head[i] = dgree[i]; snxt[i] = 0; permute_[i] = 0; permuteInverse_[i] = 0; head[i] = 0; flag[i] = 1; varbl[i] = 1; lsize[i] = dgree[i]; } if (speed < 3) { erscore = flag + numberRows_; for (int i = 0; i < numberRows_; i++) erscore[i] = dgree[i]; } else { erscore = dgree; } myamlf(numberRows_, choleskyStart_, choleskyRow_, dgree, varbl, snxt, permute_, permuteInverse_, head, lsize, flag, erscore, locaux, space, speed); for (int iRow = 0; iRow < numberRows_; iRow++) { permute_[iRow]--; } for (int iRow = 0; iRow < numberRows_; iRow++) { permuteInverse_[permute_[iRow]] = iRow; } for (int iRow = 0; iRow < numberRows_; iRow++) { assert (permuteInverse_[iRow] >= 0 && permuteInverse_[iRow] < numberRows_); } delete [] use; delete [] choleskyRow_; choleskyRow_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; return returnCode; } /* Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ int ClpCholeskyBase::symbolic() { const CoinBigIndex * columnStart = model_->clpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; CoinPackedMatrix * quadratic = NULL; ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(model_->objectiveAsObject())); if (quadraticObj) quadratic = quadraticObj->quadraticObjective(); // We need an array for counts int * used = new int[numberRows_+1]; // If KKT then re-order so negative first if (doKKT_) { int nn = 0; int np = 0; int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int originalRow = permute_[iRow]; if (originalRow < numberTotal) permute_[nn++] = originalRow; else used[np++] = originalRow; } CoinMemcpyN(used, np, permute_ + nn); for (iRow = 0; iRow < numberRows_; iRow++) permuteInverse_[permute_[iRow]] = iRow; } CoinZeroN(used, numberRows_); int iRow; int iColumn; bool noMemory = false; CoinBigIndex * Astart = new CoinBigIndex[numberRows_+1]; int * Arow = NULL; try { Arow = new int [sizeFactor_]; } catch (...) { // no memory delete [] Astart; return -1; } choleskyStart_ = new int[numberRows_+1]; link_ = new int[numberRows_]; workInteger_ = new CoinBigIndex[numberRows_]; indexStart_ = new CoinBigIndex[numberRows_]; clique_ = new int[numberRows_]; // Redo so permuted upper triangular sizeFactor_ = 0; int * which = Arow; if (!doKKT_) { for (iRow = 0; iRow < numberRows_; iRow++) { int number = 0; int iOriginalRow = permute_[iRow]; Astart[iRow] = sizeFactor_; CoinBigIndex startRow = rowStart[iOriginalRow]; CoinBigIndex endRow = rowStart[iOriginalRow] + rowLength[iOriginalRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow < iRow) { if (!used[jNewRow]) { used[jNewRow] = 1; which[number++] = jNewRow; } } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; // Sort std::sort(which, which + number); // move which on which += number; } } else { // KKT // transpose ClpMatrixBase * rowCopy = model_->clpMatrix()->reverseOrderedCopy(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); const int * rowLength = rowCopy->getVectorLengths(); const int * column = rowCopy->getIndices(); // temp bool permuted = false; for (iRow = 0; iRow < numberRows_; iRow++) { if (permute_[iRow] != iRow) { permuted = true; break; } } if (permuted) { // Need to permute - ugly if (!quadratic) { for (iRow = 0; iRow < numberRows_; iRow++) { Astart[iRow] = sizeFactor_; int iOriginalRow = permute_[iRow]; if (iOriginalRow < numberColumns) { // A may be upper triangular by mistake iColumn = iOriginalRow; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int kRow = row[j] + numberTotal; kRow = permuteInverse_[kRow]; if (kRow < iRow) Arow[sizeFactor_++] = kRow; } } else if (iOriginalRow < numberTotal) { int kRow = permuteInverse_[iOriginalRow+numberRowsModel]; if (kRow < iRow) Arow[sizeFactor_++] = kRow; } else { int kRow = iOriginalRow - numberTotal; CoinBigIndex start = rowStart[kRow]; CoinBigIndex end = rowStart[kRow] + rowLength[kRow]; for (CoinBigIndex j = start; j < end; j++) { int jRow = column[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow < iRow) Arow[sizeFactor_++] = jNewRow; } // slack - should it be permute kRow = permuteInverse_[kRow+numberColumns]; if (kRow < iRow) Arow[sizeFactor_++] = kRow; } // Sort std::sort(Arow + Astart[iRow], Arow + sizeFactor_); } } else { // quadratic // transpose CoinPackedMatrix quadraticT; quadraticT.reverseOrderedCopyOf(*quadratic); const int * columnQuadratic = quadraticT.getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticT.getVectorStarts(); const int * columnQuadraticLength = quadraticT.getVectorLengths(); for (iRow = 0; iRow < numberRows_; iRow++) { Astart[iRow] = sizeFactor_; int iOriginalRow = permute_[iRow]; if (iOriginalRow < numberColumns) { // Quadratic bit CoinBigIndex j; for ( j = columnQuadraticStart[iOriginalRow]; j < columnQuadraticStart[iOriginalRow] + columnQuadraticLength[iOriginalRow]; j++) { int jColumn = columnQuadratic[j]; int jNewColumn = permuteInverse_[jColumn]; if (jNewColumn < iRow) Arow[sizeFactor_++] = jNewColumn; } // A may be upper triangular by mistake iColumn = iOriginalRow; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (j = start; j < end; j++) { int kRow = row[j] + numberTotal; kRow = permuteInverse_[kRow]; if (kRow < iRow) Arow[sizeFactor_++] = kRow; } } else if (iOriginalRow < numberTotal) { int kRow = permuteInverse_[iOriginalRow+numberRowsModel]; if (kRow < iRow) Arow[sizeFactor_++] = kRow; } else { int kRow = iOriginalRow - numberTotal; CoinBigIndex start = rowStart[kRow]; CoinBigIndex end = rowStart[kRow] + rowLength[kRow]; for (CoinBigIndex j = start; j < end; j++) { int jRow = column[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow < iRow) Arow[sizeFactor_++] = jNewRow; } // slack - should it be permute kRow = permuteInverse_[kRow+numberColumns]; if (kRow < iRow) Arow[sizeFactor_++] = kRow; } // Sort std::sort(Arow + Astart[iRow], Arow + sizeFactor_); } } } else { if (!quadratic) { for (iRow = 0; iRow < numberRows_; iRow++) { Astart[iRow] = sizeFactor_; } } else { // Quadratic // transpose CoinPackedMatrix quadraticT; quadraticT.reverseOrderedCopyOf(*quadratic); const int * columnQuadratic = quadraticT.getIndices(); const CoinBigIndex * columnQuadraticStart = quadraticT.getVectorStarts(); const int * columnQuadraticLength = quadraticT.getVectorLengths(); //const double * quadraticElement = quadraticT.getElements(); for (iRow = 0; iRow < numberColumns; iRow++) { int iOriginalRow = permute_[iRow]; Astart[iRow] = sizeFactor_; for (CoinBigIndex j = columnQuadraticStart[iOriginalRow]; j < columnQuadraticStart[iOriginalRow] + columnQuadraticLength[iOriginalRow]; j++) { int jColumn = columnQuadratic[j]; int jNewColumn = permuteInverse_[jColumn]; if (jNewColumn < iRow) Arow[sizeFactor_++] = jNewColumn; } } } int iRow; // slacks for (iRow = 0; iRow < numberRowsModel; iRow++) { Astart[iRow+numberColumns] = sizeFactor_; } for (iRow = 0; iRow < numberRowsModel; iRow++) { Astart[iRow+numberTotal] = sizeFactor_; CoinBigIndex start = rowStart[iRow]; CoinBigIndex end = rowStart[iRow] + rowLength[iRow]; for (CoinBigIndex j = start; j < end; j++) { Arow[sizeFactor_++] = column[j]; } // slack Arow[sizeFactor_++] = numberColumns + iRow; } } delete rowCopy; } Astart[numberRows_] = sizeFactor_; firstDense_ = numberRows_; symbolic1(Astart, Arow); // Now fill in indices try { // too big choleskyRow_ = new int[sizeFactor_]; } catch (...) { // no memory noMemory = true; } double sizeFactor = sizeFactor_; if (!noMemory) { // Do lower triangular sizeFactor_ = 0; int * which = Arow; if (!doKKT_) { for (iRow = 0; iRow < numberRows_; iRow++) { int number = 0; int iOriginalRow = permute_[iRow]; Astart[iRow] = sizeFactor_; if (!rowsDropped_[iOriginalRow]) { CoinBigIndex startRow = rowStart[iOriginalRow]; CoinBigIndex endRow = rowStart[iOriginalRow] + rowLength[iOriginalRow]; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow > iRow && !rowsDropped_[jRow]) { if (!used[jNewRow]) { used[jNewRow] = 1; which[number++] = jNewRow; } } } } } sizeFactor_ += number; int j; for (j = 0; j < number; j++) used[which[j]] = 0; // Sort std::sort(which, which + number); // move which on which += number; } } } else { // KKT // temp bool permuted = false; for (iRow = 0; iRow < numberRows_; iRow++) { if (permute_[iRow] != iRow) { permuted = true; break; } } // but fake it for (iRow = 0; iRow < numberRows_; iRow++) { //permute_[iRow]=iRow; // force no permute //permuteInverse_[permute_[iRow]]=iRow; } if (permuted) { // Need to permute - ugly if (!quadratic) { for (iRow = 0; iRow < numberRows_; iRow++) { Astart[iRow] = sizeFactor_; int iOriginalRow = permute_[iRow]; if (iOriginalRow < numberColumns) { iColumn = iOriginalRow; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int kRow = row[j] + numberTotal; kRow = permuteInverse_[kRow]; if (kRow > iRow) Arow[sizeFactor_++] = kRow; } } else if (iOriginalRow < numberTotal) { int kRow = permuteInverse_[iOriginalRow+numberRowsModel]; if (kRow > iRow) Arow[sizeFactor_++] = kRow; } else { int kRow = iOriginalRow - numberTotal; CoinBigIndex start = rowStart[kRow]; CoinBigIndex end = rowStart[kRow] + rowLength[kRow]; for (CoinBigIndex j = start; j < end; j++) { int jRow = column[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow > iRow) Arow[sizeFactor_++] = jNewRow; } // slack - should it be permute kRow = permuteInverse_[kRow+numberColumns]; if (kRow > iRow) Arow[sizeFactor_++] = kRow; } // Sort std::sort(Arow + Astart[iRow], Arow + sizeFactor_); } } else { // quadratic const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); for (iRow = 0; iRow < numberRows_; iRow++) { Astart[iRow] = sizeFactor_; int iOriginalRow = permute_[iRow]; if (iOriginalRow < numberColumns) { // Quadratic bit CoinBigIndex j; for ( j = columnQuadraticStart[iOriginalRow]; j < columnQuadraticStart[iOriginalRow] + columnQuadraticLength[iOriginalRow]; j++) { int jColumn = columnQuadratic[j]; int jNewColumn = permuteInverse_[jColumn]; if (jNewColumn > iRow) Arow[sizeFactor_++] = jNewColumn; } iColumn = iOriginalRow; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (j = start; j < end; j++) { int kRow = row[j] + numberTotal; kRow = permuteInverse_[kRow]; if (kRow > iRow) Arow[sizeFactor_++] = kRow; } } else if (iOriginalRow < numberTotal) { int kRow = permuteInverse_[iOriginalRow+numberRowsModel]; if (kRow > iRow) Arow[sizeFactor_++] = kRow; } else { int kRow = iOriginalRow - numberTotal; CoinBigIndex start = rowStart[kRow]; CoinBigIndex end = rowStart[kRow] + rowLength[kRow]; for (CoinBigIndex j = start; j < end; j++) { int jRow = column[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow > iRow) Arow[sizeFactor_++] = jNewRow; } // slack - should it be permute kRow = permuteInverse_[kRow+numberColumns]; if (kRow > iRow) Arow[sizeFactor_++] = kRow; } // Sort std::sort(Arow + Astart[iRow], Arow + sizeFactor_); } } } else { if (!quadratic) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { Astart[iColumn] = sizeFactor_; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { Arow[sizeFactor_++] = row[j] + numberTotal; } } } else { // Quadratic const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); //const double * quadraticElement = quadratic->getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { Astart[iColumn] = sizeFactor_; CoinBigIndex j; for ( j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; if (jColumn > iColumn) Arow[sizeFactor_++] = jColumn; } CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for ( j = start; j < end; j++) { Arow[sizeFactor_++] = row[j] + numberTotal; } } } // slacks for (iRow = 0; iRow < numberRowsModel; iRow++) { Astart[iRow+numberColumns] = sizeFactor_; Arow[sizeFactor_++] = iRow + numberTotal; } // Transpose - nonzero diagonal (may regularize) for (iRow = 0; iRow < numberRowsModel; iRow++) { Astart[iRow+numberTotal] = sizeFactor_; } } Astart[numberRows_] = sizeFactor_; } symbolic2(Astart, Arow); if (sizeIndex_ < sizeFactor_) { int * indices = NULL; try { indices = new int[sizeIndex_]; } catch (...) { // no memory noMemory = true; } if (!noMemory) { CoinMemcpyN(choleskyRow_, sizeIndex_, indices); delete [] choleskyRow_; choleskyRow_ = indices; } } } delete [] used; // Use cholesky regions delete [] Astart; delete [] Arow; double flops = 0.0; for (iRow = 0; iRow < numberRows_; iRow++) { int length = choleskyStart_[iRow+1] - choleskyStart_[iRow]; flops += static_cast (length) * (length + 2.0); } if (model_->messageHandler()->logLevel() > 0) std::cout << sizeFactor << " elements in sparse Cholesky, flop count " << flops << std::endl; try { sparseFactor_ = new longDouble [sizeFactor_]; #if CLP_LONG_CHOLESKY!=1 workDouble_ = new longDouble[numberRows_]; #else // actually long double workDouble_ = reinterpret_cast (new CoinWorkDouble[numberRows_]); #endif diagonal_ = new longDouble[numberRows_]; } catch (...) { // no memory noMemory = true; } if (noMemory) { delete [] choleskyRow_; choleskyRow_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; delete [] permuteInverse_; permuteInverse_ = NULL; delete [] permute_; permute_ = NULL; delete [] choleskyStart_; choleskyStart_ = NULL; delete [] indexStart_; indexStart_ = NULL; delete [] link_; link_ = NULL; delete [] workInteger_; workInteger_ = NULL; delete [] sparseFactor_; sparseFactor_ = NULL; delete [] workDouble_; workDouble_ = NULL; delete [] diagonal_; diagonal_ = NULL; delete [] clique_; clique_ = NULL; return -1; } return 0; } int ClpCholeskyBase::symbolic1(const CoinBigIndex * Astart, const int * Arow) { int * marked = reinterpret_cast (workInteger_); int iRow; // may not need to do this here but makes debugging easier for (iRow = 0; iRow < numberRows_; iRow++) { marked[iRow] = -1; link_[iRow] = -1; choleskyStart_[iRow] = 0; // counts } for (iRow = 0; iRow < numberRows_; iRow++) { marked[iRow] = iRow; for (CoinBigIndex j = Astart[iRow]; j < Astart[iRow+1]; j++) { int kRow = Arow[j]; while (marked[kRow] != iRow ) { if (link_[kRow] < 0 ) link_[kRow] = iRow; choleskyStart_[kRow]++; marked[kRow] = iRow; kRow = link_[kRow]; } } } sizeFactor_ = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int number = choleskyStart_[iRow]; choleskyStart_[iRow] = sizeFactor_; sizeFactor_ += number; } choleskyStart_[numberRows_] = sizeFactor_; return sizeFactor_;; } void ClpCholeskyBase::symbolic2(const CoinBigIndex * Astart, const int * Arow) { int * mergeLink = clique_; int * marker = reinterpret_cast (workInteger_); int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { marker[iRow] = -1; mergeLink[iRow] = -1; link_[iRow] = -1; // not needed but makes debugging easier } int start = 0; int end = 0; choleskyStart_[0] = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int nz = 0; int merge = mergeLink[iRow]; bool marked = false; if (merge < 0) marker[iRow] = iRow; else marker[iRow] = merge; start = end; int startSub = start; link_[iRow] = numberRows_; CoinBigIndex j; for ( j = Astart[iRow]; j < Astart[iRow+1]; j++) { int kRow = Arow[j]; int k = iRow; int linked = link_[iRow]; #ifndef NDEBUG int count = 0; #endif while (linked <= kRow) { k = linked; linked = link_[k]; #ifndef NDEBUG count++; assert (count < numberRows_); #endif } nz++; link_[k] = kRow; link_[kRow] = linked; if (marker[kRow] != marker[iRow]) marked = true; } bool reuse = false; // Check if we can re-use indices if (!marked && merge >= 0 && mergeLink[merge] < 0) { // can re-use all startSub = indexStart_[merge] + 1; nz = choleskyStart_[merge+1] - (choleskyStart_[merge] + 1); reuse = true; } else { // See if we can re-use any int k = mergeLink[iRow]; int maxLength = 0; while (k >= 0) { int length = choleskyStart_[k+1] - (choleskyStart_[k] + 1); int start = indexStart_[k] + 1; int stop = start + length; if (length > maxLength) { maxLength = length; startSub = start; } int linked = iRow; for (CoinBigIndex j = start; j < stop; j++) { int kRow = choleskyRow_[j]; int kk = linked; linked = link_[kk]; while (linked < kRow) { kk = linked; linked = link_[kk]; } if (linked != kRow) { nz++; link_[kk] = kRow; link_[kRow] = linked; linked = kRow; } } k = mergeLink[k]; } if (nz == maxLength) reuse = true; // can re-use } //reuse=false; //temp if (!reuse) { end += nz; startSub = start; int kRow = iRow; for (int j = start; j < end; j++) { kRow = link_[kRow]; choleskyRow_[j] = kRow; assert (kRow < numberRows_); marker[kRow] = iRow; } marker[iRow] = iRow; } indexStart_[iRow] = startSub; choleskyStart_[iRow+1] = choleskyStart_[iRow] + nz; if (nz > 1) { int kRow = choleskyRow_[startSub]; mergeLink[iRow] = mergeLink[kRow]; mergeLink[kRow] = iRow; } // should not be needed //std::sort(choleskyRow_+indexStart_[iRow] // ,choleskyRow_+indexStart_[iRow]+nz); //#define CLP_DEBUG #ifdef CLP_DEBUG int last = -1; for ( j = indexStart_[iRow]; j < indexStart_[iRow] + nz; j++) { int kRow = choleskyRow_[j]; assert (kRow > last); last = kRow; } #endif } sizeFactor_ = choleskyStart_[numberRows_]; sizeIndex_ = start; // find dense segment here int numberleft = numberRows_; for (iRow = 0; iRow < numberRows_; iRow++) { CoinBigIndex left = sizeFactor_ - choleskyStart_[iRow]; double n = numberleft; double threshold = n * (n - 1.0) * 0.5 * goDense_; if ( left >= threshold) break; numberleft--; } //iRow=numberRows_; int nDense = numberRows_ - iRow; #define DENSE_THRESHOLD 8 // don't do if dense columns if (nDense >= DENSE_THRESHOLD && !dense_) { COIN_DETAIL_PRINT(printf("Going dense for last %d rows\n", nDense)); // make sure we don't disturb any indices CoinBigIndex k = 0; for (int jRow = 0; jRow < iRow; jRow++) { int nz = choleskyStart_[jRow+1] - choleskyStart_[jRow]; k = CoinMax(k, indexStart_[jRow] + nz); } indexStart_[iRow] = k; int j; for (j = iRow + 1; j < numberRows_; j++) { choleskyRow_[k++] = j; indexStart_[j] = k; } sizeIndex_ = k; assert (k <= sizeFactor_); // can't happen with any reasonable defaults k = choleskyStart_[iRow]; for (j = iRow + 1; j <= numberRows_; j++) { k += numberRows_ - j; choleskyStart_[j] = k; } // allow for blocked dense ClpCholeskyDense dense; sizeFactor_ = choleskyStart_[iRow] + dense.space(nDense); firstDense_ = iRow; if (doKKT_) { // redo permute so negative ones first int putN = firstDense_; int putP = 0; int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; for (iRow = firstDense_; iRow < numberRows_; iRow++) { int originalRow = permute_[iRow]; if (originalRow < numberTotal) permute_[putN++] = originalRow; else permuteInverse_[putP++] = originalRow; } for (iRow = putN; iRow < numberRows_; iRow++) { permute_[iRow] = permuteInverse_[iRow-putN]; } for (iRow = 0; iRow < numberRows_; iRow++) { permuteInverse_[permute_[iRow]] = iRow; } } } // Clean up clique info for (iRow = 0; iRow < numberRows_; iRow++) clique_[iRow] = 0; int lastClique = -1; bool inClique = false; for (iRow = 1; iRow < firstDense_; iRow++) { int sizeLast = choleskyStart_[iRow] - choleskyStart_[iRow-1]; int sizeThis = choleskyStart_[iRow+1] - choleskyStart_[iRow]; if (indexStart_[iRow] == indexStart_[iRow-1] + 1 && sizeThis == sizeLast - 1 && sizeThis) { // in clique if (!inClique) { inClique = true; lastClique = iRow - 1; } } else if (inClique) { int sizeClique = iRow - lastClique; for (int i = lastClique; i < iRow; i++) { clique_[i] = sizeClique; sizeClique--; } inClique = false; } } if (inClique) { int sizeClique = iRow - lastClique; for (int i = lastClique; i < iRow; i++) { clique_[i] = sizeClique; sizeClique--; } } //for (iRow=0;iRowclpMatrix()->getVectorStarts(); const int * columnLength = model_->clpMatrix()->getVectorLengths(); const int * row = model_->clpMatrix()->getIndices(); const double * element = model_->clpMatrix()->getElements(); const CoinBigIndex * rowStart = rowCopy_->getVectorStarts(); const int * rowLength = rowCopy_->getVectorLengths(); const int * column = rowCopy_->getIndices(); const double * elementByRow = rowCopy_->getElements(); int numberColumns = model_->clpMatrix()->getNumCols(); //perturbation CoinWorkDouble perturbation = model_->diagonalPerturbation() * model_->diagonalNorm(); //perturbation=perturbation*perturbation*100000000.0; if (perturbation > 1.0) { #ifdef COIN_DEVELOP //if (model_->model()->logLevel()&4) std::cout << "large perturbation " << perturbation << std::endl; #endif perturbation = CoinSqrt(perturbation); perturbation = 1.0; } int iRow; int iColumn; longDouble * work = workDouble_; CoinZeroN(work, numberRows_); int newDropped = 0; CoinWorkDouble largest = 1.0; CoinWorkDouble smallest = COIN_DBL_MAX; int numberDense = 0; if (!doKKT_) { const CoinWorkDouble * diagonalSlack = diagonal + numberColumns; if (dense_) numberDense = dense_->numberRows(); if (whichDense_) { longDouble * denseDiagonal = dense_->diagonal(); longDouble * dense = denseColumn_; int iDense = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (whichDense_[iColumn]) { CoinZeroN(dense, numberRows_); CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; if (diagonal[iColumn]) { denseDiagonal[iDense++] = 1.0 / diagonal[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; dense[jRow] = element[j]; } } else { denseDiagonal[iDense++] = 1.0; } dense += numberRows_; } } } CoinWorkDouble delta2 = model_->delta(); // add delta*delta to diagonal delta2 *= delta2; // largest in initial matrix CoinWorkDouble largest2 = 1.0e-20; for (iRow = 0; iRow < numberRows_; iRow++) { longDouble * put = sparseFactor_ + choleskyStart_[iRow]; int * which = choleskyRow_ + indexStart_[iRow]; int iOriginalRow = permute_[iRow]; int number = choleskyStart_[iRow+1] - choleskyStart_[iRow]; if (!rowLength[iOriginalRow]) rowsDropped_[iOriginalRow] = 1; if (!rowsDropped_[iOriginalRow]) { CoinBigIndex startRow = rowStart[iOriginalRow]; CoinBigIndex endRow = rowStart[iOriginalRow] + rowLength[iOriginalRow]; work[iRow] = diagonalSlack[iOriginalRow] + delta2; for (CoinBigIndex k = startRow; k < endRow; k++) { int iColumn = column[k]; if (!whichDense_ || !whichDense_[iColumn]) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; CoinWorkDouble multiplier = diagonal[iColumn] * elementByRow[k]; for (CoinBigIndex j = start; j < end; j++) { int jRow = row[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow >= iRow && !rowsDropped_[jRow]) { CoinWorkDouble value = element[j] * multiplier; work[jNewRow] += value; } } } } diagonal_[iRow] = work[iRow]; largest2 = CoinMax(largest2, CoinAbs(work[iRow])); work[iRow] = 0.0; int j; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; largest2 = CoinMax(largest2, CoinAbs(work[jRow])); work[jRow] = 0.0; } } else { // dropped diagonal_[iRow] = 1.0; int j; for (j = 1; j < number; j++) { put[j] = 0.0; } } } //check sizes largest2 *= 1.0e-20; largest = CoinMin(largest2, CHOL_SMALL_VALUE); int numberDroppedBefore = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int dropped = rowsDropped_[iRow]; // Move to int array rowsDropped[iRow] = dropped; if (!dropped) { CoinWorkDouble diagonal = diagonal_[iRow]; if (diagonal > largest2) { diagonal_[iRow] = diagonal + perturbation; } else { diagonal_[iRow] = diagonal + perturbation; rowsDropped[iRow] = 2; numberDroppedBefore++; //printf("dropped - small diagonal %g\n",diagonal); } } } doubleParameters_[10] = CoinMax(1.0e-20, largest); integerParameters_[20] = 0; doubleParameters_[3] = 0.0; doubleParameters_[4] = COIN_DBL_MAX; integerParameters_[34] = 0; // say all must be positive factorizePart2(rowsDropped); newDropped = integerParameters_[20] + numberDroppedBefore; largest = doubleParameters_[3]; smallest = doubleParameters_[4]; if (model_->messageHandler()->logLevel() > 1) std::cout << "Cholesky - largest " << largest << " smallest " << smallest << std::endl; choleskyCondition_ = largest / smallest; if (whichDense_) { int i; for ( i = 0; i < numberRows_; i++) { assert (diagonal_[i] >= 0.0); diagonal_[i] = CoinSqrt(diagonal_[i]); } // Update dense columns (just L) // Zero out dropped rows for (i = 0; i < numberDense; i++) { longDouble * a = denseColumn_ + i * numberRows_; for (int j = 0; j < numberRows_; j++) { if (rowsDropped[j]) a[j] = 0.0; } for (i = 0; i < numberRows_; i++) { int iRow = permute_[i]; workDouble_[i] = a[iRow]; } for (i = 0; i < numberRows_; i++) { CoinWorkDouble value = workDouble_[i]; CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; CoinBigIndex j; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; workDouble_[iRow] -= sparseFactor_[j] * value; } } for (i = 0; i < numberRows_; i++) { int iRow = permute_[i]; a[iRow] = workDouble_[i] * diagonal_[i]; } } dense_->resetRowsDropped(); longDouble * denseBlob = dense_->aMatrix(); longDouble * denseDiagonal = dense_->diagonal(); // Update dense matrix for (i = 0; i < numberDense; i++) { const longDouble * a = denseColumn_ + i * numberRows_; // do diagonal CoinWorkDouble value = denseDiagonal[i]; const longDouble * b = denseColumn_ + i * numberRows_; for (int k = 0; k < numberRows_; k++) value += a[k] * b[k]; denseDiagonal[i] = value; for (int j = i + 1; j < numberDense; j++) { CoinWorkDouble value = 0.0; const longDouble * b = denseColumn_ + j * numberRows_; for (int k = 0; k < numberRows_; k++) value += a[k] * b[k]; *denseBlob = value; denseBlob++; } } // dense cholesky (? long double) int * dropped = new int [numberDense]; dense_->factorizePart2(dropped); delete [] dropped; } // try allowing all every time //printf("trying ?\n"); //for (iRow=0;iRownumberIterations()<20||(model_->numberIterations()&1)==0) if (model_->numberIterations() < 2000) cleanCholesky = true; else cleanCholesky = false; if (cleanCholesky) { //drop fresh makes some formADAT easier if (newDropped || numberRowsDropped_) { newDropped = 0; for (int i = 0; i < numberRows_; i++) { char dropped = static_cast(rowsDropped[i]); rowsDropped_[i] = dropped; rowsDropped_[i] = 0; if (dropped == 2) { //dropped this time rowsDropped[newDropped++] = i; rowsDropped_[i] = 0; } } numberRowsDropped_ = newDropped; newDropped = -(2 + newDropped); } } else { if (newDropped) { newDropped = 0; for (int i = 0; i < numberRows_; i++) { char dropped = static_cast(rowsDropped[i]); rowsDropped_[i] = dropped; if (dropped == 2) { //dropped this time rowsDropped[newDropped++] = i; rowsDropped_[i] = 1; } } } numberRowsDropped_ += newDropped; if (numberRowsDropped_ && 0) { std::cout << "Rank " << numberRows_ - numberRowsDropped_ << " ( " << numberRowsDropped_ << " dropped)"; if (newDropped) { std::cout << " ( " << newDropped << " dropped this time)"; } std::cout << std::endl; } } } else { //KKT CoinPackedMatrix * quadratic = NULL; ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(model_->objectiveAsObject())); if (quadraticObj) quadratic = quadraticObj->quadraticObjective(); // matrix int numberRowsModel = model_->numberRows(); int numberColumns = model_->numberColumns(); int numberTotal = numberColumns + numberRowsModel; // temp bool permuted = false; for (iRow = 0; iRow < numberRows_; iRow++) { if (permute_[iRow] != iRow) { permuted = true; break; } } // but fake it for (iRow = 0; iRow < numberRows_; iRow++) { //permute_[iRow]=iRow; // force no permute //permuteInverse_[permute_[iRow]]=iRow; } if (permuted) { CoinWorkDouble delta2 = model_->delta(); // add delta*delta to bottom delta2 *= delta2; // Need to permute - ugly if (!quadratic) { for (iRow = 0; iRow < numberRows_; iRow++) { longDouble * put = sparseFactor_ + choleskyStart_[iRow]; int * which = choleskyRow_ + indexStart_[iRow]; int iOriginalRow = permute_[iRow]; if (iOriginalRow < numberColumns) { iColumn = iOriginalRow; CoinWorkDouble value = diagonal[iColumn]; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, CoinAbs(value)); diagonal_[iRow] = -value; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { int kRow = row[j] + numberTotal; kRow = permuteInverse_[kRow]; if (kRow > iRow) { work[kRow] = element[j]; largest = CoinMax(largest, CoinAbs(element[j])); } } } else { diagonal_[iRow] = -value; } } else if (iOriginalRow < numberTotal) { CoinWorkDouble value = diagonal[iOriginalRow]; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, CoinAbs(value)); } else { value = 1.0e100; } diagonal_[iRow] = -value; int kRow = permuteInverse_[iOriginalRow+numberRowsModel]; if (kRow > iRow) work[kRow] = -1.0; } else { diagonal_[iRow] = delta2; int kRow = iOriginalRow - numberTotal; CoinBigIndex start = rowStart[kRow]; CoinBigIndex end = rowStart[kRow] + rowLength[kRow]; for (CoinBigIndex j = start; j < end; j++) { int jRow = column[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow > iRow) { work[jNewRow] = elementByRow[j]; largest = CoinMax(largest, CoinAbs(elementByRow[j])); } } // slack - should it be permute kRow = permuteInverse_[kRow+numberColumns]; if (kRow > iRow) work[kRow] = -1.0; } CoinBigIndex j; int number = choleskyStart_[iRow+1] - choleskyStart_[iRow]; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; work[jRow] = 0.0; } } } else { // quadratic const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); const double * quadraticElement = quadratic->getElements(); for (iRow = 0; iRow < numberRows_; iRow++) { longDouble * put = sparseFactor_ + choleskyStart_[iRow]; int * which = choleskyRow_ + indexStart_[iRow]; int iOriginalRow = permute_[iRow]; if (iOriginalRow < numberColumns) { CoinBigIndex j; iColumn = iOriginalRow; CoinWorkDouble value = diagonal[iColumn]; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; int jNewColumn = permuteInverse_[jColumn]; if (jNewColumn > iRow) { work[jNewColumn] = -quadraticElement[j]; } else if (iColumn == jColumn) { value += quadraticElement[j]; } } largest = CoinMax(largest, CoinAbs(value)); diagonal_[iRow] = -value; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (j = start; j < end; j++) { int kRow = row[j] + numberTotal; kRow = permuteInverse_[kRow]; if (kRow > iRow) { work[kRow] = element[j]; largest = CoinMax(largest, CoinAbs(element[j])); } } } else { diagonal_[iRow] = -value; } } else if (iOriginalRow < numberTotal) { CoinWorkDouble value = diagonal[iOriginalRow]; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, CoinAbs(value)); } else { value = 1.0e100; } diagonal_[iRow] = -value; int kRow = permuteInverse_[iOriginalRow+numberRowsModel]; if (kRow > iRow) work[kRow] = -1.0; } else { diagonal_[iRow] = delta2; int kRow = iOriginalRow - numberTotal; CoinBigIndex start = rowStart[kRow]; CoinBigIndex end = rowStart[kRow] + rowLength[kRow]; for (CoinBigIndex j = start; j < end; j++) { int jRow = column[j]; int jNewRow = permuteInverse_[jRow]; if (jNewRow > iRow) { work[jNewRow] = elementByRow[j]; largest = CoinMax(largest, CoinAbs(elementByRow[j])); } } // slack - should it be permute kRow = permuteInverse_[kRow+numberColumns]; if (kRow > iRow) work[kRow] = -1.0; } CoinBigIndex j; int number = choleskyStart_[iRow+1] - choleskyStart_[iRow]; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; work[jRow] = 0.0; } for (j = 0; j < numberRows_; j++) assert (!work[j]); } } } else { if (!quadratic) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { longDouble * put = sparseFactor_ + choleskyStart_[iColumn]; int * which = choleskyRow_ + indexStart_[iColumn]; CoinWorkDouble value = diagonal[iColumn]; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, CoinAbs(value)); diagonal_[iColumn] = -value; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (CoinBigIndex j = start; j < end; j++) { //choleskyRow_[numberElements]=row[j]+numberTotal; //sparseFactor_[numberElements++]=element[j]; work[row[j] + numberTotal] = element[j]; largest = CoinMax(largest, CoinAbs(element[j])); } } else { diagonal_[iColumn] = -value; } CoinBigIndex j; int number = choleskyStart_[iColumn+1] - choleskyStart_[iColumn]; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; work[jRow] = 0.0; } } } else { // Quadratic const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); const double * quadraticElement = quadratic->getElements(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { longDouble * put = sparseFactor_ + choleskyStart_[iColumn]; int * which = choleskyRow_ + indexStart_[iColumn]; int number = choleskyStart_[iColumn+1] - choleskyStart_[iColumn]; CoinWorkDouble value = diagonal[iColumn]; CoinBigIndex j; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; for (j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; if (jColumn > iColumn) { work[jColumn] = -quadraticElement[j]; } else if (iColumn == jColumn) { value += quadraticElement[j]; } } largest = CoinMax(largest, CoinAbs(value)); diagonal_[iColumn] = -value; CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn] + columnLength[iColumn]; for (j = start; j < end; j++) { work[row[j] + numberTotal] = element[j]; largest = CoinMax(largest, CoinAbs(element[j])); } for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; work[jRow] = 0.0; } } else { value = 1.0e100; diagonal_[iColumn] = -value; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; } } } } // slacks for (iColumn = numberColumns; iColumn < numberTotal; iColumn++) { longDouble * put = sparseFactor_ + choleskyStart_[iColumn]; int * which = choleskyRow_ + indexStart_[iColumn]; CoinWorkDouble value = diagonal[iColumn]; if (CoinAbs(value) > 1.0e-100) { value = 1.0 / value; largest = CoinMax(largest, CoinAbs(value)); } else { value = 1.0e100; } diagonal_[iColumn] = -value; work[iColumn-numberColumns+numberTotal] = -1.0; CoinBigIndex j; int number = choleskyStart_[iColumn+1] - choleskyStart_[iColumn]; for (j = 0; j < number; j++) { int jRow = which[j]; put[j] = work[jRow]; work[jRow] = 0.0; } } // Finish diagonal CoinWorkDouble delta2 = model_->delta(); // add delta*delta to bottom delta2 *= delta2; for (iRow = 0; iRow < numberRowsModel; iRow++) { longDouble * put = sparseFactor_ + choleskyStart_[iRow+numberTotal]; diagonal_[iRow+numberTotal] = delta2; CoinBigIndex j; int number = choleskyStart_[iRow+numberTotal+1] - choleskyStart_[iRow+numberTotal]; for (j = 0; j < number; j++) { put[j] = 0.0; } } } //check sizes largest *= 1.0e-20; largest = CoinMin(largest, CHOL_SMALL_VALUE); doubleParameters_[10] = CoinMax(1.0e-20, largest); integerParameters_[20] = 0; doubleParameters_[3] = 0.0; doubleParameters_[4] = COIN_DBL_MAX; // Set up LDL cutoff integerParameters_[34] = numberTotal; // KKT int * rowsDropped2 = new int[numberRows_]; CoinZeroN(rowsDropped2, numberRows_); factorizePart2(rowsDropped2); newDropped = integerParameters_[20]; largest = doubleParameters_[3]; smallest = doubleParameters_[4]; if (model_->messageHandler()->logLevel() > 1) std::cout << "Cholesky - largest " << largest << " smallest " << smallest << std::endl; choleskyCondition_ = largest / smallest; // Should save adjustments in ..R_ int n1 = 0, n2 = 0; CoinWorkDouble * primalR = model_->primalR(); CoinWorkDouble * dualR = model_->dualR(); for (iRow = 0; iRow < numberTotal; iRow++) { if (rowsDropped2[iRow]) { n1++; //printf("row region1 %d dropped\n",iRow); //rowsDropped_[iRow]=1; rowsDropped_[iRow] = 0; primalR[iRow] = doubleParameters_[20]; } else { rowsDropped_[iRow] = 0; primalR[iRow] = 0.0; } } for (; iRow < numberRows_; iRow++) { if (rowsDropped2[iRow]) { n2++; //printf("row region2 %d dropped\n",iRow); //rowsDropped_[iRow]=1; rowsDropped_[iRow] = 0; dualR[iRow-numberTotal] = doubleParameters_[34]; } else { rowsDropped_[iRow] = 0; dualR[iRow-numberTotal] = 0.0; } } delete [] rowsDropped2; } status_ = 0; return newDropped; } /* Factorize - filling in rowsDropped and returning number dropped in integerParam. */ void ClpCholeskyBase::factorizePart2(int * rowsDropped) { CoinWorkDouble largest = doubleParameters_[3]; CoinWorkDouble smallest = doubleParameters_[4]; // probably done before largest = 0.0; smallest = COIN_DBL_MAX; double dropValue = doubleParameters_[10]; int firstPositive = integerParameters_[34]; longDouble * d = ClpCopyOfArray(diagonal_, numberRows_); int iRow; // minimum size before clique done //#define MINCLIQUE INT_MAX #define MINCLIQUE 3 longDouble * work = workDouble_; CoinBigIndex * first = workInteger_; for (iRow = 0; iRow < numberRows_; iRow++) { link_[iRow] = -1; work[iRow] = 0.0; first[iRow] = choleskyStart_[iRow]; } int lastClique = -1; bool inClique = false; bool newClique = false; bool endClique = false; int lastRow = 0; int nextRow2 = -1; for (iRow = 0; iRow < firstDense_ + 1; iRow++) { if (iRow < firstDense_) { endClique = false; if (clique_[iRow] > 0) { // this is in a clique inClique = true; if (clique_[iRow] > lastClique) { // new Clique newClique = true; // If we have clique going then signal to do old one endClique = (lastClique > 0); } else { // Still in clique newClique = false; } } else { // not in clique inClique = false; newClique = false; // If we have clique going then signal to do old one endClique = (lastClique > 0); } lastClique = clique_[iRow]; } else if (inClique) { // Finish off endClique = true; } else { break; } if (endClique) { // We have just finished updating a clique - do block pivot and clean up int jRow; for ( jRow = lastRow; jRow < iRow; jRow++) { int jCount = jRow - lastRow; CoinWorkDouble diagonalValue = diagonal_[jRow]; CoinBigIndex start = choleskyStart_[jRow]; CoinBigIndex end = choleskyStart_[jRow+1]; for (int kRow = lastRow; kRow < jRow; kRow++) { jCount--; CoinBigIndex get = choleskyStart_[kRow] + jCount; CoinWorkDouble a_jk = sparseFactor_[get]; CoinWorkDouble value1 = d[kRow] * a_jk; diagonalValue -= a_jk * value1; for (CoinBigIndex j = start; j < end; j++) sparseFactor_[j] -= value1 * sparseFactor_[++get]; } // check int originalRow = permute_[jRow]; if (originalRow < firstPositive) { // must be negative if (diagonalValue <= -dropValue) { smallest = CoinMin(smallest, -diagonalValue); largest = CoinMax(largest, -diagonalValue); d[jRow] = diagonalValue; diagonalValue = 1.0 / diagonalValue; } else { rowsDropped[originalRow] = 2; d[jRow] = -1.0e100; diagonalValue = 0.0; integerParameters_[20]++; } } else { // must be positive if (diagonalValue >= dropValue) { smallest = CoinMin(smallest, diagonalValue); largest = CoinMax(largest, diagonalValue); d[jRow] = diagonalValue; diagonalValue = 1.0 / diagonalValue; } else { rowsDropped[originalRow] = 2; d[jRow] = 1.0e100; diagonalValue = 0.0; integerParameters_[20]++; } } diagonal_[jRow] = diagonalValue; for (CoinBigIndex j = start; j < end; j++) { sparseFactor_[j] *= diagonalValue; } } if (nextRow2 >= 0) { for ( jRow = lastRow; jRow < iRow - 1; jRow++) { link_[jRow] = jRow + 1; } link_[iRow-1] = link_[nextRow2]; link_[nextRow2] = lastRow; } } if (iRow == firstDense_) break; // we were just cleaning up if (newClique) { // initialize new clique lastRow = iRow; } // for each column L[*,kRow] that affects L[*,iRow] CoinWorkDouble diagonalValue = diagonal_[iRow]; int nextRow = link_[iRow]; int kRow = 0; while (1) { kRow = nextRow; if (kRow < 0) break; // out of loop nextRow = link_[kRow]; // Modify by outer product of L[*,irow] by L[*,krow] from first CoinBigIndex k = first[kRow]; CoinBigIndex end = choleskyStart_[kRow+1]; assert(k < end); CoinWorkDouble a_ik = sparseFactor_[k++]; CoinWorkDouble value1 = d[kRow] * a_ik; // update first first[kRow] = k; diagonalValue -= value1 * a_ik; CoinBigIndex offset = indexStart_[kRow] - choleskyStart_[kRow]; if (k < end) { int jRow = choleskyRow_[k+offset]; if (clique_[kRow] < MINCLIQUE) { link_[kRow] = link_[jRow]; link_[jRow] = kRow; for (; k < end; k++) { int jRow = choleskyRow_[k+offset]; work[jRow] += sparseFactor_[k] * value1; } } else { // Clique CoinBigIndex currentIndex = k + offset; int linkSave = link_[jRow]; link_[jRow] = kRow; work[kRow] = value1; // ? or a_jk int last = kRow + clique_[kRow]; for (int kkRow = kRow + 1; kkRow < last; kkRow++) { CoinBigIndex j = first[kkRow]; //int iiRow = choleskyRow_[j+indexStart_[kkRow]-choleskyStart_[kkRow]]; CoinWorkDouble a = sparseFactor_[j]; CoinWorkDouble dValue = d[kkRow] * a; diagonalValue -= a * dValue; work[kkRow] = dValue; first[kkRow]++; link_[kkRow-1] = kkRow; } nextRow = link_[last-1]; link_[last-1] = linkSave; int length = end - k; for (int i = 0; i < length; i++) { int lRow = choleskyRow_[currentIndex++]; CoinWorkDouble t0 = work[lRow]; for (int kkRow = kRow; kkRow < last; kkRow++) { CoinBigIndex j = first[kkRow] + i; t0 += work[kkRow] * sparseFactor_[j]; } work[lRow] = t0; } } } } // Now apply if (inClique) { // in clique diagonal_[iRow] = diagonalValue; CoinBigIndex start = choleskyStart_[iRow]; CoinBigIndex end = choleskyStart_[iRow+1]; CoinBigIndex currentIndex = indexStart_[iRow]; nextRow2 = -1; CoinBigIndex get = start + clique_[iRow] - 1; if (get < end) { nextRow2 = choleskyRow_[currentIndex+get-start]; first[iRow] = get; } for (CoinBigIndex j = start; j < end; j++) { int kRow = choleskyRow_[currentIndex++]; sparseFactor_[j] -= work[kRow]; // times? work[kRow] = 0.0; } } else { // not in clique int originalRow = permute_[iRow]; if (originalRow < firstPositive) { // must be negative if (diagonalValue <= -dropValue) { smallest = CoinMin(smallest, -diagonalValue); largest = CoinMax(largest, -diagonalValue); d[iRow] = diagonalValue; diagonalValue = 1.0 / diagonalValue; } else { rowsDropped[originalRow] = 2; d[iRow] = -1.0e100; diagonalValue = 0.0; integerParameters_[20]++; } } else { // must be positive if (diagonalValue >= dropValue) { smallest = CoinMin(smallest, diagonalValue); largest = CoinMax(largest, diagonalValue); d[iRow] = diagonalValue; diagonalValue = 1.0 / diagonalValue; } else { rowsDropped[originalRow] = 2; d[iRow] = 1.0e100; diagonalValue = 0.0; integerParameters_[20]++; } } diagonal_[iRow] = diagonalValue; CoinBigIndex offset = indexStart_[iRow] - choleskyStart_[iRow]; CoinBigIndex start = choleskyStart_[iRow]; CoinBigIndex end = choleskyStart_[iRow+1]; assert (first[iRow] == start); if (start < end) { int nextRow = choleskyRow_[start+offset]; link_[iRow] = link_[nextRow]; link_[nextRow] = iRow; for (CoinBigIndex j = start; j < end; j++) { int jRow = choleskyRow_[j+offset]; CoinWorkDouble value = sparseFactor_[j] - work[jRow]; work[jRow] = 0.0; sparseFactor_[j] = diagonalValue * value; } } } } if (firstDense_ < numberRows_) { // do dense // update dense part updateDense(d,/*work,*/first); ClpCholeskyDense dense; // just borrow space int nDense = numberRows_ - firstDense_; if (doKKT_) { for (iRow = firstDense_; iRow < numberRows_; iRow++) { int originalRow = permute_[iRow]; if (originalRow >= firstPositive) { firstPositive = iRow - firstDense_; break; } } } dense.reserveSpace(this, nDense); int * dropped = new int[nDense]; memset(dropped, 0, nDense * sizeof(int)); dense.setDoubleParameter(3, largest); dense.setDoubleParameter(4, smallest); dense.setDoubleParameter(10, dropValue); dense.setIntegerParameter(20, 0); dense.setIntegerParameter(34, firstPositive); dense.setModel(model_); dense.factorizePart2(dropped); largest = dense.getDoubleParameter(3); smallest = dense.getDoubleParameter(4); integerParameters_[20] += dense.getIntegerParameter(20); for (iRow = firstDense_; iRow < numberRows_; iRow++) { int originalRow = permute_[iRow]; rowsDropped[originalRow] = dropped[iRow-firstDense_]; } delete [] dropped; } delete [] d; doubleParameters_[3] = largest; doubleParameters_[4] = smallest; return; } // Updates dense part (broken out for profiling) void ClpCholeskyBase::updateDense(longDouble * d, /*longDouble * work,*/ int * first) { for (int iRow = 0; iRow < firstDense_; iRow++) { CoinBigIndex start = first[iRow]; CoinBigIndex end = choleskyStart_[iRow+1]; if (start < end) { CoinBigIndex offset = indexStart_[iRow] - choleskyStart_[iRow]; if (clique_[iRow] < 2) { CoinWorkDouble dValue = d[iRow]; for (CoinBigIndex k = start; k < end; k++) { int kRow = choleskyRow_[k+offset]; assert(kRow >= firstDense_); CoinWorkDouble a_ik = sparseFactor_[k]; CoinWorkDouble value1 = dValue * a_ik; diagonal_[kRow] -= value1 * a_ik; CoinBigIndex base = choleskyStart_[kRow] - kRow - 1; for (CoinBigIndex j = k + 1; j < end; j++) { int jRow = choleskyRow_[j+offset]; CoinWorkDouble a_jk = sparseFactor_[j]; sparseFactor_[base+jRow] -= a_jk * value1; } } } else if (clique_[iRow] < 3) { // do as pair CoinWorkDouble dValue0 = d[iRow]; CoinWorkDouble dValue1 = d[iRow+1]; int offset1 = first[iRow+1] - start; // skip row iRow++; for (CoinBigIndex k = start; k < end; k++) { int kRow = choleskyRow_[k+offset]; assert(kRow >= firstDense_); CoinWorkDouble a_ik0 = sparseFactor_[k]; CoinWorkDouble value0 = dValue0 * a_ik0; CoinWorkDouble a_ik1 = sparseFactor_[k+offset1]; CoinWorkDouble value1 = dValue1 * a_ik1; diagonal_[kRow] -= value0 * a_ik0 + value1 * a_ik1; CoinBigIndex base = choleskyStart_[kRow] - kRow - 1; for (CoinBigIndex j = k + 1; j < end; j++) { int jRow = choleskyRow_[j+offset]; CoinWorkDouble a_jk0 = sparseFactor_[j]; CoinWorkDouble a_jk1 = sparseFactor_[j+offset1]; sparseFactor_[base+jRow] -= a_jk0 * value0 + a_jk1 * value1; } } #define MANY_REGISTERS #ifdef MANY_REGISTERS } else if (clique_[iRow] == 3) { #else } else { #endif // do as clique // maybe later get fancy on big cliques and do transpose copy // seems only worth going to 3 on Intel CoinWorkDouble dValue0 = d[iRow]; CoinWorkDouble dValue1 = d[iRow+1]; CoinWorkDouble dValue2 = d[iRow+2]; // get offsets and skip rows int offset1 = first[++iRow] - start; int offset2 = first[++iRow] - start; for (CoinBigIndex k = start; k < end; k++) { int kRow = choleskyRow_[k+offset]; assert(kRow >= firstDense_); CoinWorkDouble diagonalValue = diagonal_[kRow]; CoinWorkDouble a_ik0 = sparseFactor_[k]; CoinWorkDouble value0 = dValue0 * a_ik0; CoinWorkDouble a_ik1 = sparseFactor_[k+offset1]; CoinWorkDouble value1 = dValue1 * a_ik1; CoinWorkDouble a_ik2 = sparseFactor_[k+offset2]; CoinWorkDouble value2 = dValue2 * a_ik2; CoinBigIndex base = choleskyStart_[kRow] - kRow - 1; diagonal_[kRow] = diagonalValue - value0 * a_ik0 - value1 * a_ik1 - value2 * a_ik2; for (CoinBigIndex j = k + 1; j < end; j++) { int jRow = choleskyRow_[j+offset]; CoinWorkDouble a_jk0 = sparseFactor_[j]; CoinWorkDouble a_jk1 = sparseFactor_[j+offset1]; CoinWorkDouble a_jk2 = sparseFactor_[j+offset2]; sparseFactor_[base+jRow] -= a_jk0 * value0 + a_jk1 * value1 + a_jk2 * value2; } } #ifdef MANY_REGISTERS } else { // do as clique // maybe later get fancy on big cliques and do transpose copy // maybe only worth going to 3 on Intel (but may have hidden registers) CoinWorkDouble dValue0 = d[iRow]; CoinWorkDouble dValue1 = d[iRow+1]; CoinWorkDouble dValue2 = d[iRow+2]; CoinWorkDouble dValue3 = d[iRow+3]; // get offsets and skip rows int offset1 = first[++iRow] - start; int offset2 = first[++iRow] - start; int offset3 = first[++iRow] - start; for (CoinBigIndex k = start; k < end; k++) { int kRow = choleskyRow_[k+offset]; assert(kRow >= firstDense_); CoinWorkDouble diagonalValue = diagonal_[kRow]; CoinWorkDouble a_ik0 = sparseFactor_[k]; CoinWorkDouble value0 = dValue0 * a_ik0; CoinWorkDouble a_ik1 = sparseFactor_[k+offset1]; CoinWorkDouble value1 = dValue1 * a_ik1; CoinWorkDouble a_ik2 = sparseFactor_[k+offset2]; CoinWorkDouble value2 = dValue2 * a_ik2; CoinWorkDouble a_ik3 = sparseFactor_[k+offset3]; CoinWorkDouble value3 = dValue3 * a_ik3; CoinBigIndex base = choleskyStart_[kRow] - kRow - 1; diagonal_[kRow] = diagonalValue - (value0 * a_ik0 + value1 * a_ik1 + value2 * a_ik2 + value3 * a_ik3); for (CoinBigIndex j = k + 1; j < end; j++) { int jRow = choleskyRow_[j+offset]; CoinWorkDouble a_jk0 = sparseFactor_[j]; CoinWorkDouble a_jk1 = sparseFactor_[j+offset1]; CoinWorkDouble a_jk2 = sparseFactor_[j+offset2]; CoinWorkDouble a_jk3 = sparseFactor_[j+offset3]; sparseFactor_[base+jRow] -= a_jk0 * value0 + a_jk1 * value1 + a_jk2 * value2 + a_jk3 * value3; } } #endif } } } } /* Uses factorization to solve. */ void ClpCholeskyBase::solve (CoinWorkDouble * region) { if (!whichDense_) { solve(region, 3); } else { // dense columns int i; solve(region, 1); // do change; int numberDense = dense_->numberRows(); CoinWorkDouble * change = new CoinWorkDouble[numberDense]; for (i = 0; i < numberDense; i++) { const longDouble * a = denseColumn_ + i * numberRows_; CoinWorkDouble value = 0.0; for (int iRow = 0; iRow < numberRows_; iRow++) value += a[iRow] * region[iRow]; change[i] = value; } // solve dense_->solve(change); for (i = 0; i < numberDense; i++) { const longDouble * a = denseColumn_ + i * numberRows_; CoinWorkDouble value = change[i]; for (int iRow = 0; iRow < numberRows_; iRow++) region[iRow] -= value * a[iRow]; } delete [] change; // and finish off solve(region, 2); } } /* solve - 1 just first half, 2 just second half - 3 both. If 1 and 2 then diagonal has sqrt of inverse otherwise inverse */ void ClpCholeskyBase::solve(CoinWorkDouble * region, int type) { #ifdef CLP_DEBUG double * regionX = NULL; if (sizeof(CoinWorkDouble) != sizeof(double) && type == 3) { regionX = ClpCopyOfArray(region, numberRows_); } #endif CoinWorkDouble * work = reinterpret_cast (workDouble_); int i; CoinBigIndex j; for (i = 0; i < numberRows_; i++) { int iRow = permute_[i]; work[i] = region[iRow]; } switch (type) { case 1: for (i = 0; i < numberRows_; i++) { CoinWorkDouble value = work[i]; CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; work[iRow] -= sparseFactor_[j] * value; } } for (i = 0; i < numberRows_; i++) { int iRow = permute_[i]; region[iRow] = work[i] * diagonal_[i]; } break; case 2: for (i = numberRows_ - 1; i >= 0; i--) { CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; CoinWorkDouble value = work[i] * diagonal_[i]; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; value -= sparseFactor_[j] * work[iRow]; } work[i] = value; int iRow = permute_[i]; region[iRow] = value; } break; case 3: for (i = 0; i < firstDense_; i++) { CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; CoinWorkDouble value = work[i]; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; work[iRow] -= sparseFactor_[j] * value; } } if (firstDense_ < numberRows_) { // do dense ClpCholeskyDense dense; // just borrow space int nDense = numberRows_ - firstDense_; dense.reserveSpace(this, nDense); dense.solve(work + firstDense_); for (i = numberRows_ - 1; i >= firstDense_; i--) { CoinWorkDouble value = work[i]; int iRow = permute_[i]; region[iRow] = value; } } for (i = firstDense_ - 1; i >= 0; i--) { CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; CoinWorkDouble value = work[i] * diagonal_[i]; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; value -= sparseFactor_[j] * work[iRow]; } work[i] = value; int iRow = permute_[i]; region[iRow] = value; } break; } #ifdef CLP_DEBUG if (regionX) { longDouble * work = workDouble_; int i; CoinBigIndex j; double largestO = 0.0; for (i = 0; i < numberRows_; i++) { largestO = CoinMax(largestO, CoinAbs(regionX[i])); } for (i = 0; i < numberRows_; i++) { int iRow = permute_[i]; work[i] = regionX[iRow]; } for (i = 0; i < firstDense_; i++) { CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; CoinWorkDouble value = work[i]; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; work[iRow] -= sparseFactor_[j] * value; } } if (firstDense_ < numberRows_) { // do dense ClpCholeskyDense dense; // just borrow space int nDense = numberRows_ - firstDense_; dense.reserveSpace(this, nDense); dense.solve(work + firstDense_); for (i = numberRows_ - 1; i >= firstDense_; i--) { CoinWorkDouble value = work[i]; int iRow = permute_[i]; regionX[iRow] = value; } } for (i = firstDense_ - 1; i >= 0; i--) { CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; CoinWorkDouble value = work[i] * diagonal_[i]; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; value -= sparseFactor_[j] * work[iRow]; } work[i] = value; int iRow = permute_[i]; regionX[iRow] = value; } double largest = 0.0; double largestV = 0.0; for (i = 0; i < numberRows_; i++) { largest = CoinMax(largest, CoinAbs(region[i] - regionX[i])); largestV = CoinMax(largestV, CoinAbs(region[i])); } printf("largest difference %g, largest %g, largest original %g\n", largest, largestV, largestO); delete [] regionX; } #endif } #if 0 //CLP_LONG_CHOLESKY /* Uses factorization to solve. */ void ClpCholeskyBase::solve (CoinWorkDouble * region) { assert (!whichDense_) ; CoinWorkDouble * work = reinterpret_cast (workDouble_); int i; CoinBigIndex j; for (i = 0; i < numberRows_; i++) { int iRow = permute_[i]; work[i] = region[iRow]; } for (i = 0; i < firstDense_; i++) { CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; CoinWorkDouble value = work[i]; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; work[iRow] -= sparseFactor_[j] * value; } } if (firstDense_ < numberRows_) { // do dense ClpCholeskyDense dense; // just borrow space int nDense = numberRows_ - firstDense_; dense.reserveSpace(this, nDense); dense.solve(work + firstDense_); for (i = numberRows_ - 1; i >= firstDense_; i--) { CoinWorkDouble value = work[i]; int iRow = permute_[i]; region[iRow] = value; } } for (i = firstDense_ - 1; i >= 0; i--) { CoinBigIndex offset = indexStart_[i] - choleskyStart_[i]; CoinWorkDouble value = work[i] * diagonal_[i]; for (j = choleskyStart_[i]; j < choleskyStart_[i+1]; j++) { int iRow = choleskyRow_[j+offset]; value -= sparseFactor_[j] * work[iRow]; } work[i] = value; int iRow = permute_[i]; region[iRow] = value; } } #endif CoinMP-1.8.3/Clp/src/ClpCholeskyTaucs.hpp0000644000175000017500000000456511510657452016572 0ustar renerene/* $Id: ClpCholeskyTaucs.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpCholeskyTaucs_H #define ClpCholeskyTaucs_H #include "taucs.h" #include "ClpCholeskyBase.hpp" class ClpMatrixBase; /** Taucs class for Clp Cholesky factorization If you wish to use Sivan Toledo's TAUCS code see http://www.tau.ac.il/~stoledo/taucs/ for terms of use The taucs.h file was modified to put #ifdef __cplusplus extern "C"{ #endif after line 440 (#endif) and #ifdef __cplusplus } #endif at end I also modified LAPACK dpotf2.f (two places) to change the GO TO 30 on AJJ.Lt.0.0 to IF( AJJ.LE.1.0e-20 ) THEN AJJ = 1.0e100; ELSE AJJ = SQRT( AJJ ) END IF */ class ClpCholeskyTaucs : public ClpCholeskyBase { public: /**@name Virtual methods that the derived classes provides */ //@{ /** Orders rows and saves pointer to matrix.and model. Returns non-zero if not enough memory */ virtual int order(ClpInterior * model) ; /// Dummy virtual int symbolic(); /** Factorize - filling in rowsDropped and returning number dropped. If return code negative then out of memory */ virtual int factorize(const double * diagonal, int * rowsDropped) ; /** Uses factorization to solve. */ virtual void solve (double * region) ; //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpCholeskyTaucs(); /** Destructor */ virtual ~ClpCholeskyTaucs(); // Copy ClpCholeskyTaucs(const ClpCholeskyTaucs&); // Assignment ClpCholeskyTaucs& operator=(const ClpCholeskyTaucs&); /// Clone virtual ClpCholeskyBase * clone() const ; //@} private: /**@name Data members */ //@{ /// Taucs matrix (== sparseFactor etc) taucs_ccs_matrix * matrix_; /// Taucs factor void * factorization_; /// sparseFactor. double * sparseFactorT_; /// choleskyStart CoinBigIndex * choleskyStartT_; /// choleskyRow int * choleskyRowT_; /// sizeFactor. CoinBigIndex sizeFactorT_; /// Row copy of matrix ClpMatrixBase * rowCopyT_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpModel.cpp0000644000175000017500000052205412502502056015031 0ustar renerene/* $Id: ClpModel.cpp 2131 2015-03-19 08:09:18Z forrest $ */ // copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include #include #include #include #include #include /* CLP_NO_VECTOR There's no hint of the motivation for this, so here's a bit of speculation. CLP_NO_VECTOR excises CoinPackedVector from the code. Looking over affected code here, and the much more numerous occurrences of affected code in CoinUtils, it looks to be an efficiency issue. One good example is CoinPackedMatrix.isEquivalent. The default version tests equivalence of major dimension vectors by retrieving them as CPVs and invoking CPV.isEquivalent. As pointed out in the documention, CPV.isEquivalent implicitly sorts the nonzeros of each vector (insertion in a map) prior to comparison. As a one-off, this is arguably more efficient than allocating and clearing a full vector, then dropping in the nonzeros, then checking against the second vector (in fact, this is the algorithm for testing a packed vector against a full vector). In CPM.isEquivalent, we have a whole sequence of vectors to compare. Better to allocate a full vector sized to match, clear it (one time cost), then edit nonzeros in and out while doing comparisons. The cost of allocating and clearing the full vector is amortised over all columns. */ #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinTime.hpp" #include "ClpModel.hpp" #include "ClpEventHandler.hpp" #include "ClpPackedMatrix.hpp" #ifndef SLIM_CLP #include "ClpPlusMinusOneMatrix.hpp" #endif #ifndef CLP_NO_VECTOR #include "CoinPackedVector.hpp" #endif #include "CoinIndexedVector.hpp" #if SLIM_CLP==2 #define SLIM_NOIO #endif #ifndef SLIM_NOIO #include "CoinMpsIO.hpp" #include "CoinFileIO.hpp" #include "CoinModel.hpp" #endif #include "ClpMessage.hpp" #include "CoinMessage.hpp" #include "ClpLinearObjective.hpp" #ifndef SLIM_CLP #include "ClpQuadraticObjective.hpp" #include "CoinBuild.hpp" #endif //############################################################################# ClpModel::ClpModel (bool emptyMessages) : optimizationDirection_(1), objectiveValue_(0.0), smallElement_(1.0e-20), objectiveScale_(1.0), rhsScale_(1.0), numberRows_(0), numberColumns_(0), rowActivity_(NULL), columnActivity_(NULL), dual_(NULL), reducedCost_(NULL), rowLower_(NULL), rowUpper_(NULL), objective_(NULL), rowObjective_(NULL), columnLower_(NULL), columnUpper_(NULL), matrix_(NULL), rowCopy_(NULL), scaledMatrix_(NULL), ray_(NULL), rowScale_(NULL), columnScale_(NULL), inverseRowScale_(NULL), inverseColumnScale_(NULL), scalingFlag_(3), status_(NULL), integerType_(NULL), userPointer_(NULL), trustedUserPointer_(NULL), numberIterations_(0), solveType_(0), whatsChanged_(0), problemStatus_(-1), secondaryStatus_(0), lengthNames_(0), numberThreads_(0), specialOptions_(0), #ifndef CLP_NO_STD defaultHandler_(true), rowNames_(), columnNames_(), #else defaultHandler_(true), #endif maximumColumns_(-1), maximumRows_(-1), maximumInternalColumns_(-1), maximumInternalRows_(-1), savedRowScale_(NULL), savedColumnScale_(NULL) { intParam_[ClpMaxNumIteration] = 2147483647; intParam_[ClpMaxNumIterationHotStart] = 9999999; intParam_[ClpNameDiscipline] = 1; dblParam_[ClpDualObjectiveLimit] = COIN_DBL_MAX; dblParam_[ClpPrimalObjectiveLimit] = COIN_DBL_MAX; dblParam_[ClpDualTolerance] = 1e-7; dblParam_[ClpPrimalTolerance] = 1e-7; dblParam_[ClpObjOffset] = 0.0; dblParam_[ClpMaxSeconds] = -1.0; dblParam_[ClpMaxWallSeconds] = -1.0; dblParam_[ClpPresolveTolerance] = 1.0e-8; #ifndef CLP_NO_STD strParam_[ClpProbName] = "ClpDefaultName"; #endif handler_ = new CoinMessageHandler(); handler_->setLogLevel(1); eventHandler_ = new ClpEventHandler(); if (!emptyMessages) { messages_ = ClpMessage(); coinMessages_ = CoinMessage(); } randomNumberGenerator_.setSeed(1234567); } //----------------------------------------------------------------------------- ClpModel::~ClpModel () { if (defaultHandler_) { delete handler_; handler_ = NULL; } gutsOfDelete(0); } // Does most of deletion (0 = all, 1 = most) void ClpModel::gutsOfDelete(int type) { if (!type || !permanentArrays()) { maximumRows_ = -1; maximumColumns_ = -1; delete [] rowActivity_; rowActivity_ = NULL; delete [] columnActivity_; columnActivity_ = NULL; delete [] dual_; dual_ = NULL; delete [] reducedCost_; reducedCost_ = NULL; delete [] rowLower_; delete [] rowUpper_; delete [] rowObjective_; rowLower_ = NULL; rowUpper_ = NULL; rowObjective_ = NULL; delete [] columnLower_; delete [] columnUpper_; delete objective_; columnLower_ = NULL; columnUpper_ = NULL; objective_ = NULL; delete [] savedRowScale_; if (rowScale_ == savedRowScale_) rowScale_ = NULL; savedRowScale_ = NULL; delete [] savedColumnScale_; if (columnScale_ == savedColumnScale_) columnScale_ = NULL; savedColumnScale_ = NULL; delete [] rowScale_; rowScale_ = NULL; delete [] columnScale_; columnScale_ = NULL; delete [] integerType_; integerType_ = NULL; delete [] status_; status_ = NULL; delete eventHandler_; eventHandler_ = NULL; } whatsChanged_ = 0; delete matrix_; matrix_ = NULL; delete rowCopy_; rowCopy_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL, delete [] ray_; ray_ = NULL; specialOptions_ = 0; } void ClpModel::setRowScale(double * scale) { if (!savedRowScale_) { delete [] reinterpret_cast (rowScale_); rowScale_ = scale; } else { assert (!scale); rowScale_ = NULL; } } void ClpModel::setColumnScale(double * scale) { if (!savedColumnScale_) { delete [] reinterpret_cast (columnScale_); columnScale_ = scale; } else { assert (!scale); columnScale_ = NULL; } } //############################################################################# void ClpModel::setPrimalTolerance( double value) { if (value > 0.0 && value < 1.0e10) dblParam_[ClpPrimalTolerance] = value; } void ClpModel::setDualTolerance( double value) { if (value > 0.0 && value < 1.0e10) dblParam_[ClpDualTolerance] = value; } void ClpModel::setOptimizationDirection( double value) { optimizationDirection_ = value; } void ClpModel::gutsOfLoadModel (int numberRows, int numberColumns, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { // save event handler in case already set ClpEventHandler * handler = eventHandler_->clone(); // Save specialOptions int saveOptions = specialOptions_; gutsOfDelete(0); specialOptions_ = saveOptions; eventHandler_ = handler; numberRows_ = numberRows; numberColumns_ = numberColumns; rowActivity_ = new double[numberRows_]; columnActivity_ = new double[numberColumns_]; dual_ = new double[numberRows_]; reducedCost_ = new double[numberColumns_]; CoinZeroN(dual_, numberRows_); CoinZeroN(reducedCost_, numberColumns_); int iRow, iColumn; rowLower_ = ClpCopyOfArray(rowlb, numberRows_, -COIN_DBL_MAX); rowUpper_ = ClpCopyOfArray(rowub, numberRows_, COIN_DBL_MAX); double * objective = ClpCopyOfArray(obj, numberColumns_, 0.0); objective_ = new ClpLinearObjective(objective, numberColumns_); delete [] objective; rowObjective_ = ClpCopyOfArray(rowObjective, numberRows_); columnLower_ = ClpCopyOfArray(collb, numberColumns_, 0.0); columnUpper_ = ClpCopyOfArray(colub, numberColumns_, COIN_DBL_MAX); // set default solution and clean bounds for (iRow = 0; iRow < numberRows_; iRow++) { if (rowLower_[iRow] > 0.0) { rowActivity_[iRow] = rowLower_[iRow]; } else if (rowUpper_[iRow] < 0.0) { rowActivity_[iRow] = rowUpper_[iRow]; } else { rowActivity_[iRow] = 0.0; } if (rowLower_[iRow] < -1.0e27) rowLower_[iRow] = -COIN_DBL_MAX; if (rowUpper_[iRow] > 1.0e27) rowUpper_[iRow] = COIN_DBL_MAX; } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnLower_[iColumn] > 0.0) { columnActivity_[iColumn] = columnLower_[iColumn]; } else if (columnUpper_[iColumn] < 0.0) { columnActivity_[iColumn] = columnUpper_[iColumn]; } else { columnActivity_[iColumn] = 0.0; } if (columnLower_[iColumn] < -1.0e27) columnLower_[iColumn] = -COIN_DBL_MAX; if (columnUpper_[iColumn] > 1.0e27) columnUpper_[iColumn] = COIN_DBL_MAX; } } // This just loads up a row objective void ClpModel::setRowObjective(const double * rowObjective) { delete [] rowObjective_; rowObjective_ = ClpCopyOfArray(rowObjective, numberRows_); whatsChanged_ = 0; } void ClpModel::loadProblem ( const ClpMatrixBase& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { gutsOfLoadModel(matrix.getNumRows(), matrix.getNumCols(), collb, colub, obj, rowlb, rowub, rowObjective); if (matrix.isColOrdered()) { matrix_ = matrix.clone(); } else { // later may want to keep as unknown class CoinPackedMatrix matrix2; matrix2.setExtraGap(0.0); matrix2.setExtraMajor(0.0); matrix2.reverseOrderedCopyOf(*matrix.getPackedMatrix()); matrix.releasePackedMatrix(); matrix_ = new ClpPackedMatrix(matrix2); } matrix_->setDimensions(numberRows_, numberColumns_); } void ClpModel::loadProblem ( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix_); bool special = (clpMatrix) ? clpMatrix->wantsSpecialColumnCopy() : false; gutsOfLoadModel(matrix.getNumRows(), matrix.getNumCols(), collb, colub, obj, rowlb, rowub, rowObjective); if (matrix.isColOrdered()) { matrix_ = new ClpPackedMatrix(matrix); if (special) { clpMatrix = static_cast< ClpPackedMatrix*>(matrix_); clpMatrix->makeSpecialColumnCopy(); } } else { CoinPackedMatrix matrix2; matrix2.setExtraGap(0.0); matrix2.setExtraMajor(0.0); matrix2.reverseOrderedCopyOf(matrix); matrix_ = new ClpPackedMatrix(matrix2); } matrix_->setDimensions(numberRows_, numberColumns_); } void ClpModel::loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { gutsOfLoadModel(numrows, numcols, collb, colub, obj, rowlb, rowub, rowObjective); int numberElements = start ? start[numcols] : 0; CoinPackedMatrix matrix(true, numrows, numrows ? numcols : 0, numberElements, value, index, start, NULL); matrix_ = new ClpPackedMatrix(matrix); matrix_->setDimensions(numberRows_, numberColumns_); } void ClpModel::loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const int* length, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { gutsOfLoadModel(numrows, numcols, collb, colub, obj, rowlb, rowub, rowObjective); // Compute number of elements int numberElements = 0; int i; for (i = 0; i < numcols; i++) numberElements += length[i]; CoinPackedMatrix matrix(true, numrows, numcols, numberElements, value, index, start, length); matrix_ = new ClpPackedMatrix(matrix); } #ifndef SLIM_NOIO // This loads a model from a coinModel object - returns number of errors int ClpModel::loadProblem ( CoinModel & modelObject, bool tryPlusMinusOne) { if (modelObject.numberColumns() == 0 && modelObject.numberRows() == 0) return 0; int numberErrors = 0; // Set arrays for normal use double * rowLower = modelObject.rowLowerArray(); double * rowUpper = modelObject.rowUpperArray(); double * columnLower = modelObject.columnLowerArray(); double * columnUpper = modelObject.columnUpperArray(); double * objective = modelObject.objectiveArray(); int * integerType = modelObject.integerTypeArray(); double * associated = modelObject.associatedArray(); // If strings then do copies if (modelObject.stringsExist()) { numberErrors = modelObject.createArrays(rowLower, rowUpper, columnLower, columnUpper, objective, integerType, associated); } int numberRows = modelObject.numberRows(); int numberColumns = modelObject.numberColumns(); gutsOfLoadModel(numberRows, numberColumns, columnLower, columnUpper, objective, rowLower, rowUpper, NULL); setObjectiveOffset(modelObject.objectiveOffset()); CoinBigIndex * startPositive = NULL; CoinBigIndex * startNegative = NULL; delete matrix_; if (tryPlusMinusOne) { startPositive = new CoinBigIndex[numberColumns+1]; startNegative = new CoinBigIndex[numberColumns]; modelObject.countPlusMinusOne(startPositive, startNegative, associated); if (startPositive[0] < 0) { // no good tryPlusMinusOne = false; delete [] startPositive; delete [] startNegative; } } #ifndef SLIM_CLP if (!tryPlusMinusOne) { #endif CoinPackedMatrix matrix; modelObject.createPackedMatrix(matrix, associated); matrix_ = new ClpPackedMatrix(matrix); #ifndef SLIM_CLP } else { // create +-1 matrix CoinBigIndex size = startPositive[numberColumns]; int * indices = new int[size]; modelObject.createPlusMinusOne(startPositive, startNegative, indices, associated); // Get good object ClpPlusMinusOneMatrix * matrix = new ClpPlusMinusOneMatrix(); matrix->passInCopy(numberRows, numberColumns, true, indices, startPositive, startNegative); matrix_ = matrix; } #endif #ifndef CLP_NO_STD // Do names if wanted int numberItems; numberItems = modelObject.rowNames()->numberItems(); if (numberItems) { const char *const * rowNames = modelObject.rowNames()->names(); copyRowNames(rowNames, 0, numberItems); } numberItems = modelObject.columnNames()->numberItems(); if (numberItems) { const char *const * columnNames = modelObject.columnNames()->names(); copyColumnNames(columnNames, 0, numberItems); } #endif // Do integers if wanted assert(integerType); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerType[iColumn]) setInteger(iColumn); } if (rowLower != modelObject.rowLowerArray() || columnLower != modelObject.columnLowerArray()) { delete [] rowLower; delete [] rowUpper; delete [] columnLower; delete [] columnUpper; delete [] objective; delete [] integerType; delete [] associated; if (numberErrors) handler_->message(CLP_BAD_STRING_VALUES, messages_) << numberErrors << CoinMessageEol; } matrix_->setDimensions(numberRows_, numberColumns_); return numberErrors; } #endif void ClpModel::getRowBound(int iRow, double& lower, double& upper) const { lower = -COIN_DBL_MAX; upper = COIN_DBL_MAX; if (rowUpper_) upper = rowUpper_[iRow]; if (rowLower_) lower = rowLower_[iRow]; } //------------------------------------------------------------------ #ifndef NDEBUG // For errors to make sure print to screen // only called in debug mode static void indexError(int index, std::string methodName) { std::cerr << "Illegal index " << index << " in ClpModel::" << methodName << std::endl; throw CoinError("Illegal index", methodName, "ClpModel"); } #endif /* Set an objective function coefficient */ void ClpModel::setObjectiveCoefficient( int elementIndex, double elementValue ) { #ifndef NDEBUG if (elementIndex < 0 || elementIndex >= numberColumns_) { indexError(elementIndex, "setObjectiveCoefficient"); } #endif objective()[elementIndex] = elementValue; whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) } /* Set a single row lower bound
    Use -DBL_MAX for -infinity. */ void ClpModel::setRowLower( int elementIndex, double elementValue ) { if (elementValue < -1.0e27) elementValue = -COIN_DBL_MAX; rowLower_[elementIndex] = elementValue; whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) } /* Set a single row upper bound
    Use DBL_MAX for infinity. */ void ClpModel::setRowUpper( int elementIndex, double elementValue ) { if (elementValue > 1.0e27) elementValue = COIN_DBL_MAX; rowUpper_[elementIndex] = elementValue; whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) } /* Set a single row lower and upper bound */ void ClpModel::setRowBounds( int elementIndex, double lower, double upper ) { if (lower < -1.0e27) lower = -COIN_DBL_MAX; if (upper > 1.0e27) upper = COIN_DBL_MAX; CoinAssert (upper >= lower); rowLower_[elementIndex] = lower; rowUpper_[elementIndex] = upper; whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) } void ClpModel::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { #ifndef NDEBUG int n = numberRows_; #endif double * lower = rowLower_; double * upper = rowUpper_; whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) while (indexFirst != indexLast) { const int iRow = *indexFirst++; #ifndef NDEBUG if (iRow < 0 || iRow >= n) { indexError(iRow, "setRowSetBounds"); } #endif lower[iRow] = *boundList++; upper[iRow] = *boundList++; if (lower[iRow] < -1.0e27) lower[iRow] = -COIN_DBL_MAX; if (upper[iRow] > 1.0e27) upper[iRow] = COIN_DBL_MAX; CoinAssert (upper[iRow] >= lower[iRow]); } } //----------------------------------------------------------------------------- /* Set a single column lower bound
    Use -DBL_MAX for -infinity. */ void ClpModel::setColumnLower( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnLower"); } #endif if (elementValue < -1.0e27) elementValue = -COIN_DBL_MAX; columnLower_[elementIndex] = elementValue; whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) } /* Set a single column upper bound
    Use DBL_MAX for infinity. */ void ClpModel::setColumnUpper( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnUpper"); } #endif if (elementValue > 1.0e27) elementValue = COIN_DBL_MAX; columnUpper_[elementIndex] = elementValue; whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) } /* Set a single column lower and upper bound */ void ClpModel::setColumnBounds( int elementIndex, double lower, double upper ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnBounds"); } #endif if (lower < -1.0e27) lower = -COIN_DBL_MAX; if (upper > 1.0e27) upper = COIN_DBL_MAX; columnLower_[elementIndex] = lower; columnUpper_[elementIndex] = upper; CoinAssert (upper >= lower); whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) } void ClpModel::setColumnSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { double * lower = columnLower_; double * upper = columnUpper_; whatsChanged_ = 0; // Can't be sure (use ClpSimplex to keep) #ifndef NDEBUG int n = numberColumns_; #endif while (indexFirst != indexLast) { const int iColumn = *indexFirst++; #ifndef NDEBUG if (iColumn < 0 || iColumn >= n) { indexError(iColumn, "setColumnSetBounds"); } #endif lower[iColumn] = *boundList++; upper[iColumn] = *boundList++; CoinAssert (upper[iColumn] >= lower[iColumn]); if (lower[iColumn] < -1.0e27) lower[iColumn] = -COIN_DBL_MAX; if (upper[iColumn] > 1.0e27) upper[iColumn] = COIN_DBL_MAX; } } //----------------------------------------------------------------------------- //############################################################################# // Copy constructor. ClpModel::ClpModel(const ClpModel &rhs, int scalingMode) : optimizationDirection_(rhs.optimizationDirection_), numberRows_(rhs.numberRows_), numberColumns_(rhs.numberColumns_), specialOptions_(rhs.specialOptions_), maximumColumns_(-1), maximumRows_(-1), maximumInternalColumns_(-1), maximumInternalRows_(-1), savedRowScale_(NULL), savedColumnScale_(NULL) { gutsOfCopy(rhs); if (scalingMode >= 0 && matrix_ && matrix_->allElementsInRange(this, smallElement_, 1.0e20)) { // really do scaling scalingFlag_ = scalingMode; setRowScale(NULL); setColumnScale(NULL); delete rowCopy_; // in case odd rowCopy_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; if (scalingMode && !matrix_->scale(this)) { // scaling worked - now apply inverseRowScale_ = rowScale_ + numberRows_; inverseColumnScale_ = columnScale_ + numberColumns_; gutsOfScaling(); // pretend not scaled scalingFlag_ = -scalingFlag_; } else { // not scaled scalingFlag_ = 0; } } //randomNumberGenerator_.setSeed(1234567); } // Assignment operator. This copies the data ClpModel & ClpModel::operator=(const ClpModel & rhs) { if (this != &rhs) { if (defaultHandler_) { //delete handler_; //handler_ = NULL; } gutsOfDelete(1); optimizationDirection_ = rhs.optimizationDirection_; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; gutsOfCopy(rhs, -1); } return *this; } /* Does most of copying If trueCopy 0 then just points to arrays If -1 leaves as much as possible */ void ClpModel::gutsOfCopy(const ClpModel & rhs, int trueCopy) { defaultHandler_ = rhs.defaultHandler_; randomNumberGenerator_ = rhs.randomNumberGenerator_; if (trueCopy >= 0) { if (defaultHandler_) handler_ = new CoinMessageHandler(*rhs.handler_); else handler_ = rhs.handler_; eventHandler_ = rhs.eventHandler_->clone(); messages_ = rhs.messages_; coinMessages_ = rhs.coinMessages_; } else { if (!eventHandler_ && rhs.eventHandler_) eventHandler_ = rhs.eventHandler_->clone(); } intParam_[ClpMaxNumIteration] = rhs.intParam_[ClpMaxNumIteration]; intParam_[ClpMaxNumIterationHotStart] = rhs.intParam_[ClpMaxNumIterationHotStart]; intParam_[ClpNameDiscipline] = rhs.intParam_[ClpNameDiscipline] ; dblParam_[ClpDualObjectiveLimit] = rhs.dblParam_[ClpDualObjectiveLimit]; dblParam_[ClpPrimalObjectiveLimit] = rhs.dblParam_[ClpPrimalObjectiveLimit]; dblParam_[ClpDualTolerance] = rhs.dblParam_[ClpDualTolerance]; dblParam_[ClpPrimalTolerance] = rhs.dblParam_[ClpPrimalTolerance]; dblParam_[ClpObjOffset] = rhs.dblParam_[ClpObjOffset]; dblParam_[ClpMaxSeconds] = rhs.dblParam_[ClpMaxSeconds]; dblParam_[ClpMaxWallSeconds] = rhs.dblParam_[ClpMaxWallSeconds]; dblParam_[ClpPresolveTolerance] = rhs.dblParam_[ClpPresolveTolerance]; #ifndef CLP_NO_STD strParam_[ClpProbName] = rhs.strParam_[ClpProbName]; #endif optimizationDirection_ = rhs.optimizationDirection_; objectiveValue_ = rhs.objectiveValue_; smallElement_ = rhs.smallElement_; objectiveScale_ = rhs.objectiveScale_; rhsScale_ = rhs.rhsScale_; numberIterations_ = rhs.numberIterations_; solveType_ = rhs.solveType_; whatsChanged_ = rhs.whatsChanged_; problemStatus_ = rhs.problemStatus_; secondaryStatus_ = rhs.secondaryStatus_; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; userPointer_ = rhs.userPointer_; trustedUserPointer_ = rhs.trustedUserPointer_; scalingFlag_ = rhs.scalingFlag_; specialOptions_ = rhs.specialOptions_; if (trueCopy) { #ifndef CLP_NO_STD lengthNames_ = rhs.lengthNames_; if (lengthNames_) { rowNames_ = rhs.rowNames_; columnNames_ = rhs.columnNames_; } #endif numberThreads_ = rhs.numberThreads_; if (maximumRows_ < 0) { specialOptions_ &= ~65536; savedRowScale_ = NULL; savedColumnScale_ = NULL; integerType_ = CoinCopyOfArray(rhs.integerType_, numberColumns_); rowActivity_ = ClpCopyOfArray(rhs.rowActivity_, numberRows_); columnActivity_ = ClpCopyOfArray(rhs.columnActivity_, numberColumns_); dual_ = ClpCopyOfArray(rhs.dual_, numberRows_); reducedCost_ = ClpCopyOfArray(rhs.reducedCost_, numberColumns_); rowLower_ = ClpCopyOfArray ( rhs.rowLower_, numberRows_ ); rowUpper_ = ClpCopyOfArray ( rhs.rowUpper_, numberRows_ ); columnLower_ = ClpCopyOfArray ( rhs.columnLower_, numberColumns_ ); columnUpper_ = ClpCopyOfArray ( rhs.columnUpper_, numberColumns_ ); rowScale_ = ClpCopyOfArray(rhs.rowScale_, numberRows_ * 2); columnScale_ = ClpCopyOfArray(rhs.columnScale_, numberColumns_ * 2); if (rhs.objective_) objective_ = rhs.objective_->clone(); else objective_ = NULL; rowObjective_ = ClpCopyOfArray ( rhs.rowObjective_, numberRows_ ); status_ = ClpCopyOfArray( rhs.status_, numberColumns_ + numberRows_); ray_ = NULL; if (problemStatus_ == 1) ray_ = ClpCopyOfArray (rhs.ray_, numberRows_); else if (problemStatus_ == 2) ray_ = ClpCopyOfArray (rhs.ray_, numberColumns_); if (rhs.rowCopy_) { rowCopy_ = rhs.rowCopy_->clone(); } else { rowCopy_ = NULL; } if (rhs.scaledMatrix_) { scaledMatrix_ = new ClpPackedMatrix(*rhs.scaledMatrix_); } else { scaledMatrix_ = NULL; } matrix_ = NULL; if (rhs.matrix_) { matrix_ = rhs.matrix_->clone(); } } else { // This already has arrays - just copy savedRowScale_ = NULL; savedColumnScale_ = NULL; startPermanentArrays(); if (rhs.integerType_) { assert (integerType_); ClpDisjointCopyN(rhs.integerType_, numberColumns_, integerType_); } else { integerType_ = NULL; } if (rhs.rowActivity_) { ClpDisjointCopyN ( rhs.rowActivity_, numberRows_ , rowActivity_); ClpDisjointCopyN ( rhs.columnActivity_, numberColumns_ , columnActivity_); ClpDisjointCopyN ( rhs.dual_, numberRows_ , dual_); ClpDisjointCopyN ( rhs.reducedCost_, numberColumns_ , reducedCost_); } else { rowActivity_ = NULL; columnActivity_ = NULL; dual_ = NULL; reducedCost_ = NULL; } ClpDisjointCopyN ( rhs.rowLower_, numberRows_, rowLower_ ); ClpDisjointCopyN ( rhs.rowUpper_, numberRows_, rowUpper_ ); ClpDisjointCopyN ( rhs.columnLower_, numberColumns_, columnLower_ ); assert ((specialOptions_ & 131072) == 0); abort(); ClpDisjointCopyN ( rhs.columnUpper_, numberColumns_, columnUpper_ ); if (rhs.objective_) { abort(); //check if same objective_ = rhs.objective_->clone(); } else { objective_ = NULL; } assert (!rhs.rowObjective_); ClpDisjointCopyN( rhs.status_, numberColumns_ + numberRows_, status_); ray_ = NULL; if (problemStatus_ == 1) ray_ = ClpCopyOfArray (rhs.ray_, numberRows_); else if (problemStatus_ == 2) ray_ = ClpCopyOfArray (rhs.ray_, numberColumns_); assert (!ray_); delete rowCopy_; if (rhs.rowCopy_) { rowCopy_ = rhs.rowCopy_->clone(); } else { rowCopy_ = NULL; } delete scaledMatrix_; if (rhs.scaledMatrix_) { scaledMatrix_ = new ClpPackedMatrix(*rhs.scaledMatrix_); } else { scaledMatrix_ = NULL; } delete matrix_; matrix_ = NULL; if (rhs.matrix_) { matrix_ = rhs.matrix_->clone(); } if (rhs.savedRowScale_) { assert (savedRowScale_); assert (!rowScale_); ClpDisjointCopyN(rhs.savedRowScale_, 4 * maximumInternalRows_, savedRowScale_); ClpDisjointCopyN(rhs.savedColumnScale_, 4 * maximumInternalColumns_, savedColumnScale_); } else { assert (!savedRowScale_); if (rowScale_) { ClpDisjointCopyN(rhs.rowScale_, numberRows_, rowScale_); ClpDisjointCopyN(rhs.columnScale_, numberColumns_, columnScale_); } else { rowScale_ = NULL; columnScale_ = NULL; } } abort(); // look at resizeDouble and resize } } else { savedRowScale_ = rhs.savedRowScale_; assert (!savedRowScale_); savedColumnScale_ = rhs.savedColumnScale_; rowActivity_ = rhs.rowActivity_; columnActivity_ = rhs.columnActivity_; dual_ = rhs.dual_; reducedCost_ = rhs.reducedCost_; rowLower_ = rhs.rowLower_; rowUpper_ = rhs.rowUpper_; objective_ = rhs.objective_; rowObjective_ = rhs.rowObjective_; columnLower_ = rhs.columnLower_; columnUpper_ = rhs.columnUpper_; matrix_ = rhs.matrix_; rowCopy_ = NULL; scaledMatrix_ = NULL; ray_ = rhs.ray_; //rowScale_ = rhs.rowScale_; //columnScale_ = rhs.columnScale_; lengthNames_ = 0; numberThreads_ = rhs.numberThreads_; #ifndef CLP_NO_STD rowNames_ = std::vector (); columnNames_ = std::vector (); #endif integerType_ = NULL; status_ = rhs.status_; } inverseRowScale_ = NULL; inverseColumnScale_ = NULL; } // Copy contents - resizing if necessary - otherwise re-use memory void ClpModel::copy(const ClpMatrixBase * from, ClpMatrixBase * & to) { assert (from); const ClpPackedMatrix * matrixFrom = (dynamic_cast(from)); ClpPackedMatrix * matrixTo = (dynamic_cast< ClpPackedMatrix*>(to)); if (matrixFrom && matrixTo) { matrixTo->copy(matrixFrom); } else { delete to; to = from->clone(); } #if 0 delete modelPtr_->matrix_; if (continuousModel_->matrix_) { modelPtr_->matrix_ = continuousModel_->matrix_->clone(); } else { modelPtr_->matrix_ = NULL; } #endif } /* Borrow model. This is so we dont have to copy large amounts of data around. It assumes a derived class wants to overwrite an empty model with a real one - while it does an algorithm */ void ClpModel::borrowModel(ClpModel & rhs) { if (defaultHandler_) { delete handler_; handler_ = NULL; } gutsOfDelete(1); optimizationDirection_ = rhs.optimizationDirection_; numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; delete [] rhs.ray_; rhs.ray_ = NULL; // make sure scaled matrix not copied ClpPackedMatrix * save = rhs.scaledMatrix_; rhs.scaledMatrix_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; gutsOfCopy(rhs, 0); rhs.scaledMatrix_ = save; specialOptions_ = rhs.specialOptions_ & ~65536; savedRowScale_ = NULL; savedColumnScale_ = NULL; inverseRowScale_ = NULL; inverseColumnScale_ = NULL; } // Return model - nulls all arrays so can be deleted safely void ClpModel::returnModel(ClpModel & otherModel) { otherModel.objectiveValue_ = objectiveValue_; otherModel.numberIterations_ = numberIterations_; otherModel.problemStatus_ = problemStatus_; otherModel.secondaryStatus_ = secondaryStatus_; rowActivity_ = NULL; columnActivity_ = NULL; dual_ = NULL; reducedCost_ = NULL; rowLower_ = NULL; rowUpper_ = NULL; objective_ = NULL; rowObjective_ = NULL; columnLower_ = NULL; columnUpper_ = NULL; matrix_ = NULL; if (rowCopy_ != otherModel.rowCopy_) delete rowCopy_; rowCopy_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; delete [] otherModel.ray_; otherModel.ray_ = ray_; ray_ = NULL; if (rowScale_ && otherModel.rowScale_ != rowScale_) { delete [] rowScale_; delete [] columnScale_; } rowScale_ = NULL; columnScale_ = NULL; //rowScale_=NULL; //columnScale_=NULL; // do status if (otherModel.status_ != status_) { delete [] otherModel.status_; otherModel.status_ = status_; } status_ = NULL; if (defaultHandler_) { delete handler_; handler_ = NULL; } inverseRowScale_ = NULL; inverseColumnScale_ = NULL; } //############################################################################# // Parameter related methods //############################################################################# bool ClpModel::setIntParam(ClpIntParam key, int value) { switch (key) { case ClpMaxNumIteration: if (value < 0) return false; break; case ClpMaxNumIterationHotStart: if (value < 0) return false; break; case ClpNameDiscipline: if (value < 0) return false; break; default: return false; } intParam_[key] = value; return true; } //----------------------------------------------------------------------------- bool ClpModel::setDblParam(ClpDblParam key, double value) { switch (key) { case ClpDualObjectiveLimit: break; case ClpPrimalObjectiveLimit: break; case ClpDualTolerance: if (value <= 0.0 || value > 1.0e10) return false; break; case ClpPrimalTolerance: if (value <= 0.0 || value > 1.0e10) return false; break; case ClpObjOffset: break; case ClpMaxSeconds: if(value >= 0) value += CoinCpuTime(); else value = -1.0; break; case ClpMaxWallSeconds: if(value >= 0) value += CoinWallclockTime(); else value = -1.0; break; case ClpPresolveTolerance: if (value <= 0.0 || value > 1.0e10) return false; break; default: return false; } dblParam_[key] = value; return true; } //----------------------------------------------------------------------------- #ifndef CLP_NO_STD bool ClpModel::setStrParam(ClpStrParam key, const std::string & value) { switch (key) { case ClpProbName: break; default: return false; } strParam_[key] = value; return true; } #endif // Useful routines // Returns resized array and deletes incoming double * resizeDouble(double * array , int size, int newSize, double fill, bool createArray) { if ((array || createArray) && size < newSize) { int i; double * newArray = new double[newSize]; if (array) CoinMemcpyN(array, CoinMin(newSize, size), newArray); delete [] array; array = newArray; for (i = size; i < newSize; i++) array[i] = fill; } return array; } // Returns resized array and updates size double * deleteDouble(double * array , int size, int number, const int * which, int & newSize) { if (array) { int i ; char * deleted = new char[size]; int numberDeleted = 0; CoinZeroN(deleted, size); for (i = 0; i < number; i++) { int j = which[i]; if (j >= 0 && j < size && !deleted[j]) { numberDeleted++; deleted[j] = 1; } } newSize = size - numberDeleted; double * newArray = new double[newSize]; int put = 0; for (i = 0; i < size; i++) { if (!deleted[i]) { newArray[put++] = array[i]; } } delete [] array; array = newArray; delete [] deleted; } return array; } char * deleteChar(char * array , int size, int number, const int * which, int & newSize, bool ifDelete) { if (array) { int i ; char * deleted = new char[size]; int numberDeleted = 0; CoinZeroN(deleted, size); for (i = 0; i < number; i++) { int j = which[i]; if (j >= 0 && j < size && !deleted[j]) { numberDeleted++; deleted[j] = 1; } } newSize = size - numberDeleted; char * newArray = new char[newSize]; int put = 0; for (i = 0; i < size; i++) { if (!deleted[i]) { newArray[put++] = array[i]; } } if (ifDelete) delete [] array; array = newArray; delete [] deleted; } return array; } // Create empty ClpPackedMatrix void ClpModel::createEmptyMatrix() { delete matrix_; whatsChanged_ = 0; CoinPackedMatrix matrix2; matrix_ = new ClpPackedMatrix(matrix2); } /* Really clean up matrix. a) eliminate all duplicate AND small elements in matrix b) remove all gaps and set extraGap_ and extraMajor_ to 0.0 c) reallocate arrays and make max lengths equal to lengths d) orders elements returns number of elements eliminated or -1 if not ClpMatrix */ int ClpModel::cleanMatrix(double threshold) { ClpPackedMatrix * matrix = (dynamic_cast< ClpPackedMatrix*>(matrix_)); if (matrix) { return matrix->getPackedMatrix()->cleanMatrix(threshold); } else { return -1; } } // Resizes void ClpModel::resize (int newNumberRows, int newNumberColumns) { if (newNumberRows == numberRows_ && newNumberColumns == numberColumns_) return; // nothing to do whatsChanged_ = 0; int numberRows2 = newNumberRows; int numberColumns2 = newNumberColumns; if (numberRows2 < maximumRows_) numberRows2 = maximumRows_; if (numberColumns2 < maximumColumns_) numberColumns2 = maximumColumns_; if (numberRows2 > maximumRows_) { rowActivity_ = resizeDouble(rowActivity_, numberRows_, newNumberRows, 0.0, true); dual_ = resizeDouble(dual_, numberRows_, newNumberRows, 0.0, true); rowObjective_ = resizeDouble(rowObjective_, numberRows_, newNumberRows, 0.0, false); rowLower_ = resizeDouble(rowLower_, numberRows_, newNumberRows, -COIN_DBL_MAX, true); rowUpper_ = resizeDouble(rowUpper_, numberRows_, newNumberRows, COIN_DBL_MAX, true); } if (numberColumns2 > maximumColumns_) { columnActivity_ = resizeDouble(columnActivity_, numberColumns_, newNumberColumns, 0.0, true); reducedCost_ = resizeDouble(reducedCost_, numberColumns_, newNumberColumns, 0.0, true); } if (savedRowScale_ && numberRows2 > maximumInternalRows_) { double * temp; temp = new double [4*newNumberRows]; CoinFillN(temp, 4 * newNumberRows, 1.0); CoinMemcpyN(savedRowScale_, numberRows_, temp); CoinMemcpyN(savedRowScale_ + maximumInternalRows_, numberRows_, temp + newNumberRows); CoinMemcpyN(savedRowScale_ + 2 * maximumInternalRows_, numberRows_, temp + 2 * newNumberRows); CoinMemcpyN(savedRowScale_ + 3 * maximumInternalRows_, numberRows_, temp + 3 * newNumberRows); delete [] savedRowScale_; savedRowScale_ = temp; } if (savedColumnScale_ && numberColumns2 > maximumInternalColumns_) { double * temp; temp = new double [4*newNumberColumns]; CoinFillN(temp, 4 * newNumberColumns, 1.0); CoinMemcpyN(savedColumnScale_, numberColumns_, temp); CoinMemcpyN(savedColumnScale_ + maximumInternalColumns_, numberColumns_, temp + newNumberColumns); CoinMemcpyN(savedColumnScale_ + 2 * maximumInternalColumns_, numberColumns_, temp + 2 * newNumberColumns); CoinMemcpyN(savedColumnScale_ + 3 * maximumInternalColumns_, numberColumns_, temp + 3 * newNumberColumns); delete [] savedColumnScale_; savedColumnScale_ = temp; } if (objective_ && numberColumns2 > maximumColumns_) objective_->resize(newNumberColumns); else if (!objective_) objective_ = new ClpLinearObjective(NULL, newNumberColumns); if (numberColumns2 > maximumColumns_) { columnLower_ = resizeDouble(columnLower_, numberColumns_, newNumberColumns, 0.0, true); columnUpper_ = resizeDouble(columnUpper_, numberColumns_, newNumberColumns, COIN_DBL_MAX, true); } if (newNumberRows < numberRows_) { int * which = new int[numberRows_-newNumberRows]; int i; for (i = newNumberRows; i < numberRows_; i++) which[i-newNumberRows] = i; matrix_->deleteRows(numberRows_ - newNumberRows, which); delete [] which; } if (numberRows_ != newNumberRows || numberColumns_ != newNumberColumns) { // set state back to unknown problemStatus_ = -1; secondaryStatus_ = 0; delete [] ray_; ray_ = NULL; } setRowScale(NULL); setColumnScale(NULL); if (status_) { if (newNumberColumns + newNumberRows) { if (newNumberColumns + newNumberRows > maximumRows_ + maximumColumns_) { unsigned char * tempC = new unsigned char [newNumberColumns+newNumberRows]; unsigned char * tempR = tempC + newNumberColumns; memset(tempC, 3, newNumberColumns * sizeof(unsigned char)); memset(tempR, 1, newNumberRows * sizeof(unsigned char)); CoinMemcpyN(status_, CoinMin(newNumberColumns, numberColumns_), tempC); CoinMemcpyN(status_ + numberColumns_, CoinMin(newNumberRows, numberRows_), tempR); delete [] status_; status_ = tempC; } else if (newNumberColumns < numberColumns_) { memmove(status_ + newNumberColumns, status_ + numberColumns_, newNumberRows); } else if (newNumberColumns > numberColumns_) { memset(status_ + numberColumns_, 3, newNumberColumns - numberColumns_); memmove(status_ + newNumberColumns, status_ + numberColumns_, newNumberRows); } } else { // empty model - some systems don't like new [0] delete [] status_; status_ = NULL; } } #ifndef CLP_NO_STD if (lengthNames_) { // redo row and column names (make sure clean) int numberRowNames = CoinMin(static_cast(rowNames_.size()),numberRows_); if (numberRowNames < newNumberRows) { rowNames_.resize(newNumberRows); lengthNames_ = CoinMax(lengthNames_, 8); char name[9]; for (int iRow = numberRowNames; iRow < newNumberRows; iRow++) { sprintf(name, "R%7.7d", iRow); rowNames_[iRow] = name; } } int numberColumnNames = CoinMin(static_cast(columnNames_.size()),numberColumns_); if (numberColumnNames < newNumberColumns) { columnNames_.resize(newNumberColumns); lengthNames_ = CoinMax(lengthNames_, 8); char name[9]; for (int iColumn = numberColumnNames; iColumn < newNumberColumns; iColumn++) { sprintf(name, "C%7.7d", iColumn); columnNames_[iColumn] = name; } } } #endif numberRows_ = newNumberRows; if (newNumberColumns < numberColumns_ && matrix_->getNumCols()) { int * which = new int[numberColumns_-newNumberColumns]; int i; for (i = newNumberColumns; i < numberColumns_; i++) which[i-newNumberColumns] = i; matrix_->deleteCols(numberColumns_ - newNumberColumns, which); delete [] which; } if (integerType_ && numberColumns2 > maximumColumns_) { char * temp = new char [newNumberColumns]; CoinZeroN(temp, newNumberColumns); CoinMemcpyN(integerType_, CoinMin(newNumberColumns, numberColumns_), temp); delete [] integerType_; integerType_ = temp; } numberColumns_ = newNumberColumns; if ((specialOptions_ & 65536) != 0) { // leave until next create rim to up numbers } if (maximumRows_ >= 0) { if (numberRows_ > maximumRows_) COIN_DETAIL_PRINT(printf("resize %d rows, %d old maximum rows\n", numberRows_, maximumRows_)); maximumRows_ = CoinMax(maximumRows_, numberRows_); maximumColumns_ = CoinMax(maximumColumns_, numberColumns_); } } // Deletes rows void ClpModel::deleteRows(int number, const int * which) { if (!number) return; // nothing to do whatsChanged_ &= ~(1 + 2 + 4 + 8 + 16 + 32); // all except columns changed int newSize = 0; #define CLP_TIDY_DELETE_ROWS #ifdef CLP_TIDY_DELETE_ROWS if (status_) { // try and get right number of basic int nChange=0; unsigned char * rowStatus = status_+numberColumns_; for (int i=0;igetNumRows()) matrix_->deleteRows(number, which); //matrix_->removeGaps(); // status if (status_) { if (numberColumns_ + newSize) { unsigned char * tempR = reinterpret_cast (deleteChar(reinterpret_cast(status_) + numberColumns_, numberRows_, number, which, newSize, false)); unsigned char * tempC = new unsigned char [numberColumns_+newSize]; CoinMemcpyN(status_, numberColumns_, tempC); CoinMemcpyN(tempR, newSize, tempC + numberColumns_); delete [] tempR; delete [] status_; status_ = tempC; } else { // empty model - some systems don't like new [0] delete [] status_; status_ = NULL; } } } else { char * deleted = new char [numberRows_]; int i; int numberDeleted = 0; CoinZeroN(deleted, numberRows_); for (i = 0; i < number; i++) { int j = which[i]; if (j >= 0 && j < numberRows_ && !deleted[j]) { numberDeleted++; deleted[j] = 1; } } assert (!rowObjective_); unsigned char * status2 = status_ + numberColumns_; for (i = 0; i < numberRows_; i++) { if (!deleted[i]) { rowActivity_[newSize] = rowActivity_[i]; dual_[newSize] = dual_[i]; rowLower_[newSize] = rowLower_[i]; rowUpper_[newSize] = rowUpper_[i]; status2[newSize] = status2[i]; newSize++; } } if (matrix_->getNumRows()) matrix_->deleteRows(number, which); //matrix_->removeGaps(); delete [] deleted; } #ifndef CLP_NO_STD // Now works if which out of order if (lengthNames_) { char * mark = new char [numberRows_]; CoinZeroN(mark, numberRows_); int i; for (i = 0; i < number; i++) mark[which[i]] = 1; int k = 0; for ( i = 0; i < numberRows_; ++i) { if (!mark[i]) rowNames_[k++] = rowNames_[i]; } rowNames_.erase(rowNames_.begin() + k, rowNames_.end()); delete [] mark; } #endif numberRows_ = newSize; // set state back to unknown problemStatus_ = -1; secondaryStatus_ = 0; delete [] ray_; ray_ = NULL; if (savedRowScale_ != rowScale_) { delete [] rowScale_; delete [] columnScale_; } rowScale_ = NULL; columnScale_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; } // Deletes columns void ClpModel::deleteColumns(int number, const int * which) { if (!number) return; // nothing to do assert (maximumColumns_ < 0); whatsChanged_ &= ~(1 + 2 + 4 + 8 + 64 + 128 + 256); // all except rows changed int newSize = 0; columnActivity_ = deleteDouble(columnActivity_, numberColumns_, number, which, newSize); reducedCost_ = deleteDouble(reducedCost_, numberColumns_, number, which, newSize); objective_->deleteSome(number, which); columnLower_ = deleteDouble(columnLower_, numberColumns_, number, which, newSize); columnUpper_ = deleteDouble(columnUpper_, numberColumns_, number, which, newSize); // possible matrix is not full if (matrix_->getNumCols() < numberColumns_) { int * which2 = new int [number]; int n = 0; int nMatrix = matrix_->getNumCols(); for (int i = 0; i < number; i++) { if (which[i] < nMatrix) which2[n++] = which[i]; } matrix_->deleteCols(n, which2); delete [] which2; } else { matrix_->deleteCols(number, which); } //matrix_->removeGaps(); // status if (status_) { if (numberRows_ + newSize) { unsigned char * tempC = reinterpret_cast (deleteChar(reinterpret_cast(status_), numberColumns_, number, which, newSize, false)); unsigned char * temp = new unsigned char [numberRows_+newSize]; CoinMemcpyN(tempC, newSize, temp); CoinMemcpyN(status_ + numberColumns_, numberRows_, temp + newSize); delete [] tempC; delete [] status_; status_ = temp; } else { // empty model - some systems don't like new [0] delete [] status_; status_ = NULL; } } integerType_ = deleteChar(integerType_, numberColumns_, number, which, newSize, true); #ifndef CLP_NO_STD // Now works if which out of order if (lengthNames_) { char * mark = new char [numberColumns_]; CoinZeroN(mark, numberColumns_); int i; for (i = 0; i < number; i++) mark[which[i]] = 1; int k = 0; for ( i = 0; i < numberColumns_; ++i) { if (!mark[i]) columnNames_[k++] = columnNames_[i]; } columnNames_.erase(columnNames_.begin() + k, columnNames_.end()); delete [] mark; } #endif numberColumns_ = newSize; // set state back to unknown problemStatus_ = -1; secondaryStatus_ = 0; delete [] ray_; ray_ = NULL; setRowScale(NULL); setColumnScale(NULL); } // Deletes rows AND columns (does not reallocate) void ClpModel::deleteRowsAndColumns(int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) { if (!numberColumns) { deleteRows(numberRows,whichRows); } else if (!numberRows) { deleteColumns(numberColumns,whichColumns); } else { whatsChanged_ &= ~511; // all changed bool doStatus = status_!=NULL; int numberTotal=numberRows_+numberColumns_; int * backRows = new int [numberTotal]; int * backColumns = backRows+numberRows_; memset(backRows,0,numberTotal*sizeof(int)); int newNumberColumns=0; for (int i=0;i=0&&iColumntype()==1); double * obj = objective(); for (int i=0;i=0&&iRow(matrix_); CoinPackedMatrix * matrix = clpMatrix ? clpMatrix->matrix() : NULL; if (matrix_->getNumCols() < numberColumns_) { assert (matrix); CoinBigIndex nel=matrix->getNumElements(); int n=matrix->getNumCols(); matrix->reserve(numberColumns_,nel); CoinBigIndex * columnStart = matrix->getMutableVectorStarts(); int * columnLength = matrix->getMutableVectorLengths(); for (int i=n;isetExtraMajor(0.1); //CoinPackedMatrix temp(*matrix); matrix->setExtraGap(0.0); matrix->setExtraMajor(0.0); int * row = matrix->getMutableIndices(); CoinBigIndex * columnStart = matrix->getMutableVectorStarts(); int * columnLength = matrix->getMutableVectorLengths(); double * element = matrix->getMutableElements(); newNumberColumns=0; CoinBigIndex n=0; for (int iColumn=0;iColumn=0) { CoinBigIndex start = columnStart[iColumn]; int nSave=n; columnStart[newNumberColumns]=n; for (CoinBigIndex j=start;j=0) { row[n]=iRow; element[n++]=element[j]; } } columnLength[newNumberColumns++]=n-nSave; } } columnStart[newNumberColumns]=n; matrix->setNumElements(n); matrix->setMajorDim(newNumberColumns); matrix->setMinorDim(newNumberRows); clpMatrix->setNumberActiveColumns(newNumberColumns); //temp.deleteRows(numberRows, whichRows); //temp.deleteCols(numberColumns, whichColumns); //assert(matrix->isEquivalent2(temp)); //*matrix=temp; } else { matrix_->deleteRows(numberRows, whichRows); matrix_->deleteCols(numberColumns, whichColumns); } numberColumns_ = newNumberColumns; numberRows_ = newNumberRows; delete [] backRows; // set state back to unknown problemStatus_ = -1; secondaryStatus_ = 0; delete [] ray_; ray_ = NULL; if (savedRowScale_ != rowScale_) { delete [] rowScale_; delete [] columnScale_; } rowScale_ = NULL; columnScale_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; delete rowCopy_; rowCopy_ = NULL; } } // Add one row void ClpModel::addRow(int numberInRow, const int * columns, const double * elements, double rowLower, double rowUpper) { CoinBigIndex starts[2]; starts[0] = 0; starts[1] = numberInRow; addRows(1, &rowLower, &rowUpper, starts, columns, elements); } // Add rows void ClpModel::addRows(int number, const double * rowLower, const double * rowUpper, const CoinBigIndex * rowStarts, const int * columns, const double * elements) { if (number) { whatsChanged_ &= ~(1 + 2 + 8 + 16 + 32); // all except columns changed int numberRowsNow = numberRows_; resize(numberRowsNow + number, numberColumns_); double * lower = rowLower_ + numberRowsNow; double * upper = rowUpper_ + numberRowsNow; int iRow; if (rowLower) { for (iRow = 0; iRow < number; iRow++) { double value = rowLower[iRow]; if (value < -1.0e20) value = -COIN_DBL_MAX; lower[iRow] = value; } } else { for (iRow = 0; iRow < number; iRow++) { lower[iRow] = -COIN_DBL_MAX; } } if (rowUpper) { for (iRow = 0; iRow < number; iRow++) { double value = rowUpper[iRow]; if (value > 1.0e20) value = COIN_DBL_MAX; upper[iRow] = value; } } else { for (iRow = 0; iRow < number; iRow++) { upper[iRow] = COIN_DBL_MAX; } } // Deal with matrix delete rowCopy_; rowCopy_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; if (!matrix_) createEmptyMatrix(); setRowScale(NULL); setColumnScale(NULL); #ifndef CLP_NO_STD if (lengthNames_) { rowNames_.resize(numberRows_); } #endif if (rowStarts) { // Make sure matrix has correct number of columns matrix_->getPackedMatrix()->reserve(numberColumns_, 0, true); matrix_->appendMatrix(number, 0, rowStarts, columns, elements); } } } // Add rows void ClpModel::addRows(int number, const double * rowLower, const double * rowUpper, const CoinBigIndex * rowStarts, const int * rowLengths, const int * columns, const double * elements) { if (number) { CoinBigIndex numberElements = 0; int iRow; for (iRow = 0; iRow < number; iRow++) numberElements += rowLengths[iRow]; int * newStarts = new int[number+1]; int * newIndex = new int[numberElements]; double * newElements = new double[numberElements]; numberElements = 0; newStarts[0] = 0; for (iRow = 0; iRow < number; iRow++) { int iStart = rowStarts[iRow]; int length = rowLengths[iRow]; CoinMemcpyN(columns + iStart, length, newIndex + numberElements); CoinMemcpyN(elements + iStart, length, newElements + numberElements); numberElements += length; newStarts[iRow+1] = numberElements; } addRows(number, rowLower, rowUpper, newStarts, newIndex, newElements); delete [] newStarts; delete [] newIndex; delete [] newElements; } } #ifndef CLP_NO_VECTOR void ClpModel::addRows(int number, const double * rowLower, const double * rowUpper, const CoinPackedVectorBase * const * rows) { if (!number) return; whatsChanged_ &= ~(1 + 2 + 8 + 16 + 32); // all except columns changed int numberRowsNow = numberRows_; resize(numberRowsNow + number, numberColumns_); double * lower = rowLower_ + numberRowsNow; double * upper = rowUpper_ + numberRowsNow; int iRow; if (rowLower) { for (iRow = 0; iRow < number; iRow++) { double value = rowLower[iRow]; if (value < -1.0e20) value = -COIN_DBL_MAX; lower[iRow] = value; } } else { for (iRow = 0; iRow < number; iRow++) { lower[iRow] = -COIN_DBL_MAX; } } if (rowUpper) { for (iRow = 0; iRow < number; iRow++) { double value = rowUpper[iRow]; if (value > 1.0e20) value = COIN_DBL_MAX; upper[iRow] = value; } } else { for (iRow = 0; iRow < number; iRow++) { upper[iRow] = COIN_DBL_MAX; } } // Deal with matrix delete rowCopy_; rowCopy_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; if (!matrix_) createEmptyMatrix(); if (rows) matrix_->appendRows(number, rows); setRowScale(NULL); setColumnScale(NULL); if (lengthNames_) { rowNames_.resize(numberRows_); } } #endif #ifndef SLIM_CLP // Add rows from a build object int ClpModel::addRows(const CoinBuild & buildObject, bool tryPlusMinusOne, bool checkDuplicates) { CoinAssertHint (buildObject.type() == 0, "Looks as if both addRows and addCols being used"); // check correct int number = buildObject.numberRows(); int numberErrors = 0; if (number) { CoinBigIndex size = 0; int iRow; double * lower = new double [number]; double * upper = new double [number]; if ((!matrix_ || !matrix_->getNumElements()) && tryPlusMinusOne) { // See if can be +-1 for (iRow = 0; iRow < number; iRow++) { const int * columns; const double * elements; int numberElements = buildObject.row(iRow, lower[iRow], upper[iRow], columns, elements); for (int i = 0; i < numberElements; i++) { // allow for zero elements if (elements[i]) { if (fabs(elements[i]) == 1.0) { size++; } else { // bad tryPlusMinusOne = false; } } } if (!tryPlusMinusOne) break; } } else { // Will add to whatever sort of matrix exists tryPlusMinusOne = false; } if (!tryPlusMinusOne) { CoinBigIndex numberElements = buildObject.numberElements(); CoinBigIndex * starts = new CoinBigIndex [number+1]; int * column = new int[numberElements]; double * element = new double[numberElements]; starts[0] = 0; numberElements = 0; for (iRow = 0; iRow < number; iRow++) { const int * columns; const double * elements; int numberElementsThis = buildObject.row(iRow, lower[iRow], upper[iRow], columns, elements); CoinMemcpyN(columns, numberElementsThis, column + numberElements); CoinMemcpyN(elements, numberElementsThis, element + numberElements); numberElements += numberElementsThis; starts[iRow+1] = numberElements; } addRows(number, lower, upper, NULL); // make sure matrix has enough columns matrix_->setDimensions(-1, numberColumns_); numberErrors = matrix_->appendMatrix(number, 0, starts, column, element, checkDuplicates ? numberColumns_ : -1); delete [] starts; delete [] column; delete [] element; } else { char * which = NULL; // for duplicates if (checkDuplicates) { which = new char[numberColumns_]; CoinZeroN(which, numberColumns_); } // build +-1 matrix // arrays already filled in addRows(number, lower, upper, NULL); CoinBigIndex * startPositive = new CoinBigIndex [numberColumns_+1]; CoinBigIndex * startNegative = new CoinBigIndex [numberColumns_]; int * indices = new int [size]; CoinZeroN(startPositive, numberColumns_); CoinZeroN(startNegative, numberColumns_); int maxColumn = -1; // need two passes for (iRow = 0; iRow < number; iRow++) { const int * columns; const double * elements; int numberElements = buildObject.row(iRow, lower[iRow], upper[iRow], columns, elements); for (int i = 0; i < numberElements; i++) { int iColumn = columns[i]; if (checkDuplicates) { if (iColumn >= numberColumns_) { if(which[iColumn]) numberErrors++; else which[iColumn] = 1; } else { numberErrors++; // and may as well switch off checkDuplicates = false; } } maxColumn = CoinMax(maxColumn, iColumn); if (elements[i] == 1.0) { startPositive[iColumn]++; } else if (elements[i] == -1.0) { startNegative[iColumn]++; } } if (checkDuplicates) { for (int i = 0; i < numberElements; i++) { int iColumn = columns[i]; which[iColumn] = 0; } } } // check size int numberColumns = maxColumn + 1; CoinAssertHint (numberColumns <= numberColumns_, "rows having column indices >= numberColumns_"); size = 0; int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex n = startPositive[iColumn]; startPositive[iColumn] = size; size += n; n = startNegative[iColumn]; startNegative[iColumn] = size; size += n; } startPositive[numberColumns_] = size; for (iRow = 0; iRow < number; iRow++) { const int * columns; const double * elements; int numberElements = buildObject.row(iRow, lower[iRow], upper[iRow], columns, elements); for (int i = 0; i < numberElements; i++) { int iColumn = columns[i]; maxColumn = CoinMax(maxColumn, iColumn); if (elements[i] == 1.0) { CoinBigIndex position = startPositive[iColumn]; indices[position] = iRow; startPositive[iColumn]++; } else if (elements[i] == -1.0) { CoinBigIndex position = startNegative[iColumn]; indices[position] = iRow; startNegative[iColumn]++; } } } // and now redo starts for (iColumn = numberColumns_ - 1; iColumn >= 0; iColumn--) { startPositive[iColumn+1] = startNegative[iColumn]; startNegative[iColumn] = startPositive[iColumn]; } startPositive[0] = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinBigIndex start = startPositive[iColumn]; CoinBigIndex end = startNegative[iColumn]; std::sort(indices + start, indices + end); start = startNegative[iColumn]; end = startPositive[iColumn+1]; std::sort(indices + start, indices + end); } // Get good object delete matrix_; ClpPlusMinusOneMatrix * matrix = new ClpPlusMinusOneMatrix(); matrix->passInCopy(numberRows_, numberColumns, true, indices, startPositive, startNegative); matrix_ = matrix; delete [] which; } delete [] lower; delete [] upper; // make sure matrix correct size matrix_->setDimensions(numberRows_, numberColumns_); } return numberErrors; } #endif #ifndef SLIM_NOIO // Add rows from a model object int ClpModel::addRows( CoinModel & modelObject, bool tryPlusMinusOne, bool checkDuplicates) { if (modelObject.numberElements() == 0) return 0; bool goodState = true; int numberErrors = 0; if (modelObject.columnLowerArray()) { // some column information exists int numberColumns2 = modelObject.numberColumns(); const double * columnLower = modelObject.columnLowerArray(); const double * columnUpper = modelObject.columnUpperArray(); const double * objective = modelObject.objectiveArray(); const int * integerType = modelObject.integerTypeArray(); for (int i = 0; i < numberColumns2; i++) { if (columnLower[i] != 0.0) goodState = false; if (columnUpper[i] != COIN_DBL_MAX) goodState = false; if (objective[i] != 0.0) goodState = false; if (integerType[i] != 0) goodState = false; } } if (goodState) { // can do addRows // Set arrays for normal use double * rowLower = modelObject.rowLowerArray(); double * rowUpper = modelObject.rowUpperArray(); double * columnLower = modelObject.columnLowerArray(); double * columnUpper = modelObject.columnUpperArray(); double * objective = modelObject.objectiveArray(); int * integerType = modelObject.integerTypeArray(); double * associated = modelObject.associatedArray(); // If strings then do copies if (modelObject.stringsExist()) { numberErrors = modelObject.createArrays(rowLower, rowUpper, columnLower, columnUpper, objective, integerType, associated); } int numberRows = numberRows_; // save number of rows int numberRows2 = modelObject.numberRows(); if (numberRows2 && !numberErrors) { CoinBigIndex * startPositive = NULL; CoinBigIndex * startNegative = NULL; int numberColumns = modelObject.numberColumns(); if ((!matrix_ || !matrix_->getNumElements()) && !numberRows && tryPlusMinusOne) { startPositive = new CoinBigIndex[numberColumns+1]; startNegative = new CoinBigIndex[numberColumns]; modelObject.countPlusMinusOne(startPositive, startNegative, associated); if (startPositive[0] < 0) { // no good tryPlusMinusOne = false; delete [] startPositive; delete [] startNegative; } } else { // Will add to whatever sort of matrix exists tryPlusMinusOne = false; } assert (rowLower); addRows(numberRows2, rowLower, rowUpper, NULL, NULL, NULL); #ifndef SLIM_CLP if (!tryPlusMinusOne) { #endif CoinPackedMatrix matrix; modelObject.createPackedMatrix(matrix, associated); assert (!matrix.getExtraGap()); if (matrix_->getNumRows()) { // matrix by rows matrix.reverseOrdering(); assert (!matrix.getExtraGap()); const int * column = matrix.getIndices(); //const int * rowLength = matrix.getVectorLengths(); const CoinBigIndex * rowStart = matrix.getVectorStarts(); const double * element = matrix.getElements(); // make sure matrix has enough columns matrix_->setDimensions(-1, numberColumns_); numberErrors += matrix_->appendMatrix(numberRows2, 0, rowStart, column, element, checkDuplicates ? numberColumns_ : -1); } else { delete matrix_; matrix_ = new ClpPackedMatrix(matrix); } #ifndef SLIM_CLP } else { // create +-1 matrix CoinBigIndex size = startPositive[numberColumns]; int * indices = new int[size]; modelObject.createPlusMinusOne(startPositive, startNegative, indices, associated); // Get good object ClpPlusMinusOneMatrix * matrix = new ClpPlusMinusOneMatrix(); matrix->passInCopy(numberRows2, numberColumns, true, indices, startPositive, startNegative); delete matrix_; matrix_ = matrix; } // Do names if wanted if (modelObject.rowNames()->numberItems()) { const char *const * rowNames = modelObject.rowNames()->names(); copyRowNames(rowNames, numberRows, numberRows_); } #endif } if (rowLower != modelObject.rowLowerArray()) { delete [] rowLower; delete [] rowUpper; delete [] columnLower; delete [] columnUpper; delete [] objective; delete [] integerType; delete [] associated; if (numberErrors) handler_->message(CLP_BAD_STRING_VALUES, messages_) << numberErrors << CoinMessageEol; } return numberErrors; } else { // not suitable for addRows handler_->message(CLP_COMPLICATED_MODEL, messages_) << modelObject.numberRows() << modelObject.numberColumns() << CoinMessageEol; return -1; } } #endif // Add one column void ClpModel::addColumn(int numberInColumn, const int * rows, const double * elements, double columnLower, double columnUpper, double objective) { CoinBigIndex starts[2]; starts[0] = 0; starts[1] = numberInColumn; addColumns(1, &columnLower, &columnUpper, &objective, starts, rows, elements); } // Add columns void ClpModel::addColumns(int number, const double * columnLower, const double * columnUpper, const double * objIn, const int * columnStarts, const int * rows, const double * elements) { // Create a list of CoinPackedVectors if (number) { whatsChanged_ &= ~(1 + 2 + 4 + 64 + 128 + 256); // all except rows changed int numberColumnsNow = numberColumns_; resize(numberRows_, numberColumnsNow + number); double * lower = columnLower_ + numberColumnsNow; double * upper = columnUpper_ + numberColumnsNow; double * obj = objective() + numberColumnsNow; int iColumn; if (columnLower) { for (iColumn = 0; iColumn < number; iColumn++) { double value = columnLower[iColumn]; if (value < -1.0e20) value = -COIN_DBL_MAX; lower[iColumn] = value; } } else { for (iColumn = 0; iColumn < number; iColumn++) { lower[iColumn] = 0.0; } } if (columnUpper) { for (iColumn = 0; iColumn < number; iColumn++) { double value = columnUpper[iColumn]; if (value > 1.0e20) value = COIN_DBL_MAX; upper[iColumn] = value; } } else { for (iColumn = 0; iColumn < number; iColumn++) { upper[iColumn] = COIN_DBL_MAX; } } if (objIn) { for (iColumn = 0; iColumn < number; iColumn++) { obj[iColumn] = objIn[iColumn]; } } else { for (iColumn = 0; iColumn < number; iColumn++) { obj[iColumn] = 0.0; } } // Deal with matrix delete rowCopy_; rowCopy_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; if (!matrix_) createEmptyMatrix(); setRowScale(NULL); setColumnScale(NULL); #ifndef CLP_NO_STD if (lengthNames_) { columnNames_.resize(numberColumns_); } #endif // Do even if elements NULL (to resize) matrix_->appendMatrix(number, 1, columnStarts, rows, elements); } } // Add columns void ClpModel::addColumns(int number, const double * columnLower, const double * columnUpper, const double * objIn, const int * columnStarts, const int * columnLengths, const int * rows, const double * elements) { if (number) { CoinBigIndex numberElements = 0; int iColumn; for (iColumn = 0; iColumn < number; iColumn++) numberElements += columnLengths[iColumn]; int * newStarts = new int[number+1]; int * newIndex = new int[numberElements]; double * newElements = new double[numberElements]; numberElements = 0; newStarts[0] = 0; for (iColumn = 0; iColumn < number; iColumn++) { int iStart = columnStarts[iColumn]; int length = columnLengths[iColumn]; CoinMemcpyN(rows + iStart, length, newIndex + numberElements); CoinMemcpyN(elements + iStart, length, newElements + numberElements); numberElements += length; newStarts[iColumn+1] = numberElements; } addColumns(number, columnLower, columnUpper, objIn, newStarts, newIndex, newElements); delete [] newStarts; delete [] newIndex; delete [] newElements; } } #ifndef CLP_NO_VECTOR void ClpModel::addColumns(int number, const double * columnLower, const double * columnUpper, const double * objIn, const CoinPackedVectorBase * const * columns) { if (!number) return; whatsChanged_ &= ~(1 + 2 + 4 + 64 + 128 + 256); // all except rows changed int numberColumnsNow = numberColumns_; resize(numberRows_, numberColumnsNow + number); double * lower = columnLower_ + numberColumnsNow; double * upper = columnUpper_ + numberColumnsNow; double * obj = objective() + numberColumnsNow; int iColumn; if (columnLower) { for (iColumn = 0; iColumn < number; iColumn++) { double value = columnLower[iColumn]; if (value < -1.0e20) value = -COIN_DBL_MAX; lower[iColumn] = value; } } else { for (iColumn = 0; iColumn < number; iColumn++) { lower[iColumn] = 0.0; } } if (columnUpper) { for (iColumn = 0; iColumn < number; iColumn++) { double value = columnUpper[iColumn]; if (value > 1.0e20) value = COIN_DBL_MAX; upper[iColumn] = value; } } else { for (iColumn = 0; iColumn < number; iColumn++) { upper[iColumn] = COIN_DBL_MAX; } } if (objIn) { for (iColumn = 0; iColumn < number; iColumn++) { obj[iColumn] = objIn[iColumn]; } } else { for (iColumn = 0; iColumn < number; iColumn++) { obj[iColumn] = 0.0; } } // Deal with matrix delete rowCopy_; rowCopy_ = NULL; delete scaledMatrix_; scaledMatrix_ = NULL; if (!matrix_) createEmptyMatrix(); if (columns) matrix_->appendCols(number, columns); setRowScale(NULL); setColumnScale(NULL); if (lengthNames_) { columnNames_.resize(numberColumns_); } } #endif #ifndef SLIM_CLP // Add columns from a build object int ClpModel::addColumns(const CoinBuild & buildObject, bool tryPlusMinusOne, bool checkDuplicates) { CoinAssertHint (buildObject.type() == 1, "Looks as if both addRows and addCols being used"); // check correct int number = buildObject.numberColumns(); int numberErrors = 0; if (number) { CoinBigIndex size = 0; int maximumLength = 0; double * lower = new double [number]; double * upper = new double [number]; int iColumn; double * objective = new double [number]; if ((!matrix_ || !matrix_->getNumElements()) && tryPlusMinusOne) { // See if can be +-1 for (iColumn = 0; iColumn < number; iColumn++) { const int * rows; const double * elements; int numberElements = buildObject.column(iColumn, lower[iColumn], upper[iColumn], objective[iColumn], rows, elements); maximumLength = CoinMax(maximumLength, numberElements); for (int i = 0; i < numberElements; i++) { // allow for zero elements if (elements[i]) { if (fabs(elements[i]) == 1.0) { size++; } else { // bad tryPlusMinusOne = false; } } } if (!tryPlusMinusOne) break; } } else { // Will add to whatever sort of matrix exists tryPlusMinusOne = false; } if (!tryPlusMinusOne) { CoinBigIndex numberElements = buildObject.numberElements(); CoinBigIndex * starts = new CoinBigIndex [number+1]; int * row = new int[numberElements]; double * element = new double[numberElements]; starts[0] = 0; numberElements = 0; for (iColumn = 0; iColumn < number; iColumn++) { const int * rows; const double * elements; int numberElementsThis = buildObject.column(iColumn, lower[iColumn], upper[iColumn], objective[iColumn], rows, elements); CoinMemcpyN(rows, numberElementsThis, row + numberElements); CoinMemcpyN(elements, numberElementsThis, element + numberElements); numberElements += numberElementsThis; starts[iColumn+1] = numberElements; } addColumns(number, lower, upper, objective, NULL); // make sure matrix has enough rows matrix_->setDimensions(numberRows_, -1); numberErrors = matrix_->appendMatrix(number, 1, starts, row, element, checkDuplicates ? numberRows_ : -1); delete [] starts; delete [] row; delete [] element; } else { // arrays already filled in addColumns(number, lower, upper, objective, NULL); char * which = NULL; // for duplicates if (checkDuplicates) { which = new char[numberRows_]; CoinZeroN(which, numberRows_); } // build +-1 matrix CoinBigIndex * startPositive = new CoinBigIndex [number+1]; CoinBigIndex * startNegative = new CoinBigIndex [number]; int * indices = new int [size]; int * neg = new int[maximumLength]; startPositive[0] = 0; size = 0; int maxRow = -1; for (iColumn = 0; iColumn < number; iColumn++) { const int * rows; const double * elements; int numberElements = buildObject.column(iColumn, lower[iColumn], upper[iColumn], objective[iColumn], rows, elements); int nNeg = 0; CoinBigIndex start = size; for (int i = 0; i < numberElements; i++) { int iRow = rows[i]; if (checkDuplicates) { if (iRow < numberRows_) { if(which[iRow]) numberErrors++; else which[iRow] = 1; } else { numberErrors++; // and may as well switch off checkDuplicates = false; } } maxRow = CoinMax(maxRow, iRow); if (elements[i] == 1.0) { indices[size++] = iRow; } else if (elements[i] == -1.0) { neg[nNeg++] = iRow; } } std::sort(indices + start, indices + size); std::sort(neg, neg + nNeg); startNegative[iColumn] = size; CoinMemcpyN(neg, nNeg, indices + size); size += nNeg; startPositive[iColumn+1] = size; } delete [] neg; // check size assert (maxRow + 1 <= numberRows_); // Get good object delete matrix_; ClpPlusMinusOneMatrix * matrix = new ClpPlusMinusOneMatrix(); matrix->passInCopy(numberRows_, number, true, indices, startPositive, startNegative); matrix_ = matrix; delete [] which; } delete [] objective; delete [] lower; delete [] upper; } return 0; } #endif #ifndef SLIM_NOIO // Add columns from a model object int ClpModel::addColumns( CoinModel & modelObject, bool tryPlusMinusOne, bool checkDuplicates) { if (modelObject.numberElements() == 0) return 0; bool goodState = true; if (modelObject.rowLowerArray()) { // some row information exists int numberRows2 = modelObject.numberRows(); const double * rowLower = modelObject.rowLowerArray(); const double * rowUpper = modelObject.rowUpperArray(); for (int i = 0; i < numberRows2; i++) { if (rowLower[i] != -COIN_DBL_MAX) goodState = false; if (rowUpper[i] != COIN_DBL_MAX) goodState = false; } } if (goodState) { // can do addColumns int numberErrors = 0; // Set arrays for normal use double * rowLower = modelObject.rowLowerArray(); double * rowUpper = modelObject.rowUpperArray(); double * columnLower = modelObject.columnLowerArray(); double * columnUpper = modelObject.columnUpperArray(); double * objective = modelObject.objectiveArray(); int * integerType = modelObject.integerTypeArray(); double * associated = modelObject.associatedArray(); // If strings then do copies if (modelObject.stringsExist()) { numberErrors = modelObject.createArrays(rowLower, rowUpper, columnLower, columnUpper, objective, integerType, associated); } int numberColumns = numberColumns_; // save number of columns int numberColumns2 = modelObject.numberColumns(); if (numberColumns2 && !numberErrors) { CoinBigIndex * startPositive = NULL; CoinBigIndex * startNegative = NULL; if ((!matrix_ || !matrix_->getNumElements()) && !numberColumns && tryPlusMinusOne) { startPositive = new CoinBigIndex[numberColumns2+1]; startNegative = new CoinBigIndex[numberColumns2]; modelObject.countPlusMinusOne(startPositive, startNegative, associated); if (startPositive[0] < 0) { // no good tryPlusMinusOne = false; delete [] startPositive; delete [] startNegative; } } else { // Will add to whatever sort of matrix exists tryPlusMinusOne = false; } assert (columnLower); #ifndef SLIM_CLP if (!tryPlusMinusOne) { #endif CoinPackedMatrix matrix; modelObject.createPackedMatrix(matrix, associated); assert (!matrix.getExtraGap()); const int * row = matrix.getIndices(); //const int * columnLength = matrix.getVectorLengths(); const CoinBigIndex * columnStart = matrix.getVectorStarts(); const double * element = matrix.getElements(); // make sure matrix has enough rows matrix_->setDimensions(numberRows_, -1); addColumns(numberColumns2, columnLower, columnUpper, objective, columnStart, row, element); #ifndef SLIM_CLP } else { addColumns(numberColumns2, columnLower, columnUpper, objective, NULL, NULL, NULL); // create +-1 matrix CoinBigIndex size = startPositive[numberColumns2]; int * indices = new int[size]; modelObject.createPlusMinusOne(startPositive, startNegative, indices, associated); // Get good object ClpPlusMinusOneMatrix * matrix = new ClpPlusMinusOneMatrix(); matrix->passInCopy(numberRows_, numberColumns2, true, indices, startPositive, startNegative); delete matrix_; matrix_ = matrix; } #endif #ifndef CLP_NO_STD // Do names if wanted if (modelObject.columnNames()->numberItems()) { const char *const * columnNames = modelObject.columnNames()->names(); copyColumnNames(columnNames, numberColumns, numberColumns_); } #endif // Do integers if wanted assert(integerType); for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { if (integerType[iColumn]) setInteger(iColumn + numberColumns); } } if (columnLower != modelObject.columnLowerArray()) { delete [] rowLower; delete [] rowUpper; delete [] columnLower; delete [] columnUpper; delete [] objective; delete [] integerType; delete [] associated; if (numberErrors) handler_->message(CLP_BAD_STRING_VALUES, messages_) << numberErrors << CoinMessageEol; } return numberErrors; } else { // not suitable for addColumns handler_->message(CLP_COMPLICATED_MODEL, messages_) << modelObject.numberRows() << modelObject.numberColumns() << CoinMessageEol; return -1; } } #endif // chgRowLower void ClpModel::chgRowLower(const double * rowLower) { int numberRows = numberRows_; int iRow; whatsChanged_ = 0; // Use ClpSimplex stuff to keep if (rowLower) { for (iRow = 0; iRow < numberRows; iRow++) { double value = rowLower[iRow]; if (value < -1.0e20) value = -COIN_DBL_MAX; rowLower_[iRow] = value; } } else { for (iRow = 0; iRow < numberRows; iRow++) { rowLower_[iRow] = -COIN_DBL_MAX; } } } // chgRowUpper void ClpModel::chgRowUpper(const double * rowUpper) { whatsChanged_ = 0; // Use ClpSimplex stuff to keep int numberRows = numberRows_; int iRow; if (rowUpper) { for (iRow = 0; iRow < numberRows; iRow++) { double value = rowUpper[iRow]; if (value > 1.0e20) value = COIN_DBL_MAX; rowUpper_[iRow] = value; } } else { for (iRow = 0; iRow < numberRows; iRow++) { rowUpper_[iRow] = COIN_DBL_MAX;; } } } // chgColumnLower void ClpModel::chgColumnLower(const double * columnLower) { whatsChanged_ = 0; // Use ClpSimplex stuff to keep int numberColumns = numberColumns_; int iColumn; if (columnLower) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = columnLower[iColumn]; if (value < -1.0e20) value = -COIN_DBL_MAX; columnLower_[iColumn] = value; } } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) { columnLower_[iColumn] = 0.0; } } } // chgColumnUpper void ClpModel::chgColumnUpper(const double * columnUpper) { whatsChanged_ = 0; // Use ClpSimplex stuff to keep int numberColumns = numberColumns_; int iColumn; if (columnUpper) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = columnUpper[iColumn]; if (value > 1.0e20) value = COIN_DBL_MAX; columnUpper_[iColumn] = value; } } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) { columnUpper_[iColumn] = COIN_DBL_MAX;; } } } // chgObjCoefficients void ClpModel::chgObjCoefficients(const double * objIn) { whatsChanged_ = 0; // Use ClpSimplex stuff to keep double * obj = objective(); int numberColumns = numberColumns_; int iColumn; if (objIn) { for (iColumn = 0; iColumn < numberColumns; iColumn++) { obj[iColumn] = objIn[iColumn]; } } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) { obj[iColumn] = 0.0; } } } // Infeasibility/unbounded ray (NULL returned if none/wrong) double * ClpModel::infeasibilityRay(bool fullRay) const { double * array = NULL; if (problemStatus_ == 1 && ray_) { if (!fullRay) { array = ClpCopyOfArray(ray_, numberRows_); } else { array = new double [numberRows_+numberColumns_]; memcpy(array,ray_,numberRows_*sizeof(double)); memset(array+numberRows_,0,numberColumns_*sizeof(double)); transposeTimes(-1.0,array,array+numberRows_); } } return array; } double * ClpModel::unboundedRay() const { double * array = NULL; if (problemStatus_ == 2) array = ClpCopyOfArray(ray_, numberColumns_); return array; } void ClpModel::setMaximumIterations(int value) { if(value >= 0) intParam_[ClpMaxNumIteration] = value; } void ClpModel::setMaximumSeconds(double value) { if(value >= 0) dblParam_[ClpMaxSeconds] = value + CoinCpuTime(); else dblParam_[ClpMaxSeconds] = -1.0; } void ClpModel::setMaximumWallSeconds(double value) { if(value >= 0) dblParam_[ClpMaxWallSeconds] = value + CoinWallclockTime(); else dblParam_[ClpMaxWallSeconds] = -1.0; } // Returns true if hit maximum iterations (or time) bool ClpModel::hitMaximumIterations() const { // replaced - compiler error? bool hitMax= (numberIterations_>=maximumIterations()); bool hitMax = (numberIterations_ >= intParam_[ClpMaxNumIteration]); if (dblParam_[ClpMaxSeconds] >= 0.0 && !hitMax) { hitMax = (CoinCpuTime() >= dblParam_[ClpMaxSeconds]); } if (dblParam_[ClpMaxWallSeconds] >= 0.0 && !hitMax) { hitMax = (CoinWallclockTime() >= dblParam_[ClpMaxWallSeconds]); } return hitMax; } // On stopped - sets secondary status void ClpModel::onStopped() { if (problemStatus_ == 3) { secondaryStatus_ = 0; if ((CoinCpuTime() >= dblParam_[ClpMaxSeconds] && dblParam_[ClpMaxSeconds] >= 0.0) || (CoinWallclockTime() >= dblParam_[ClpMaxWallSeconds] && dblParam_[ClpMaxWallSeconds] >= 0.0)) secondaryStatus_ = 9; } } // Pass in Message handler (not deleted at end) void ClpModel::passInMessageHandler(CoinMessageHandler * handler) { if (defaultHandler_) delete handler_; defaultHandler_ = false; handler_ = handler; } // Pass in Message handler (not deleted at end) and return current CoinMessageHandler * ClpModel::pushMessageHandler(CoinMessageHandler * handler, bool & oldDefault) { CoinMessageHandler * returnValue = handler_; oldDefault = defaultHandler_; defaultHandler_ = false; handler_ = handler; return returnValue; } // back to previous message handler void ClpModel::popMessageHandler(CoinMessageHandler * oldHandler, bool oldDefault) { if (defaultHandler_) delete handler_; defaultHandler_ = oldDefault; handler_ = oldHandler; } // Overrides message handler with a default one void ClpModel::setDefaultMessageHandler() { int logLevel = handler_->logLevel(); if (defaultHandler_) delete handler_; defaultHandler_ = true; handler_ = new CoinMessageHandler(); handler_->setLogLevel(logLevel); } // Set language void ClpModel::newLanguage(CoinMessages::Language language) { messages_ = ClpMessage(language); } #ifndef SLIM_NOIO // Read an mps file from the given filename int ClpModel::readMps(const char *fileName, bool keepNames, bool ignoreErrors) { if (!strcmp(fileName, "-") || !strcmp(fileName, "stdin")) { // stdin } else { std::string name = fileName; bool readable = fileCoinReadable(name); if (!readable) { handler_->message(CLP_UNABLE_OPEN, messages_) << fileName << CoinMessageEol; return -1; } } CoinMpsIO m; m.passInMessageHandler(handler_); *m.messagesPointer() = coinMessages(); bool savePrefix = m.messageHandler()->prefix(); m.messageHandler()->setPrefix(handler_->prefix()); m.setSmallElementValue(CoinMax(smallElement_, m.getSmallElementValue())); double time1 = CoinCpuTime(), time2; int status = 0; try { status = m.readMps(fileName, ""); } catch (CoinError e) { e.print(); status = -1; } m.messageHandler()->setPrefix(savePrefix); if (!status || (ignoreErrors && (status > 0 && status < 100000))) { loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); if (m.integerColumns()) { integerType_ = new char[numberColumns_]; CoinMemcpyN(m.integerColumns(), numberColumns_, integerType_); } else { integerType_ = NULL; } #ifndef SLIM_CLP // get quadratic part if (m.reader()->whichSection ( ) == COIN_QUAD_SECTION ) { int * start = NULL; int * column = NULL; double * element = NULL; status = m.readQuadraticMps(NULL, start, column, element, 2); if (!status || ignoreErrors) loadQuadraticObjective(numberColumns_, start, column, element); delete [] start; delete [] column; delete [] element; } #endif #ifndef CLP_NO_STD // set problem name setStrParam(ClpProbName, m.getProblemName()); // do names if (keepNames) { unsigned int maxLength = 0; int iRow; rowNames_ = std::vector (); columnNames_ = std::vector (); rowNames_.reserve(numberRows_); for (iRow = 0; iRow < numberRows_; iRow++) { const char * name = m.rowName(iRow); maxLength = CoinMax(maxLength, static_cast (strlen(name))); rowNames_.push_back(name); } int iColumn; columnNames_.reserve(numberColumns_); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { const char * name = m.columnName(iColumn); maxLength = CoinMax(maxLength, static_cast (strlen(name))); columnNames_.push_back(name); } lengthNames_ = static_cast (maxLength); } else { lengthNames_ = 0; } #endif setDblParam(ClpObjOffset, m.objectiveOffset()); time2 = CoinCpuTime(); handler_->message(CLP_IMPORT_RESULT, messages_) << fileName << time2 - time1 << CoinMessageEol; } else { // errors handler_->message(CLP_IMPORT_ERRORS, messages_) << status << fileName << CoinMessageEol; } return status; } // Read GMPL files from the given filenames int ClpModel::readGMPL(const char *fileName, const char * dataName, bool keepNames) { FILE *fp = fopen(fileName, "r"); if (fp) { // can open - lets go for it fclose(fp); if (dataName) { fp = fopen(dataName, "r"); if (fp) { fclose(fp); } else { handler_->message(CLP_UNABLE_OPEN, messages_) << dataName << CoinMessageEol; return -1; } } } else { handler_->message(CLP_UNABLE_OPEN, messages_) << fileName << CoinMessageEol; return -1; } CoinMpsIO m; m.passInMessageHandler(handler_); *m.messagesPointer() = coinMessages(); bool savePrefix = m.messageHandler()->prefix(); m.messageHandler()->setPrefix(handler_->prefix()); double time1 = CoinCpuTime(), time2; int status = m.readGMPL(fileName, dataName, keepNames); m.messageHandler()->setPrefix(savePrefix); if (!status) { loadProblem(*m.getMatrixByCol(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); if (m.integerColumns()) { integerType_ = new char[numberColumns_]; CoinMemcpyN(m.integerColumns(), numberColumns_, integerType_); } else { integerType_ = NULL; } #ifndef CLP_NO_STD // set problem name setStrParam(ClpProbName, m.getProblemName()); // do names if (keepNames) { unsigned int maxLength = 0; int iRow; rowNames_ = std::vector (); columnNames_ = std::vector (); rowNames_.reserve(numberRows_); for (iRow = 0; iRow < numberRows_; iRow++) { const char * name = m.rowName(iRow); maxLength = CoinMax(maxLength, static_cast (strlen(name))); rowNames_.push_back(name); } int iColumn; columnNames_.reserve(numberColumns_); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { const char * name = m.columnName(iColumn); maxLength = CoinMax(maxLength, static_cast (strlen(name))); columnNames_.push_back(name); } lengthNames_ = static_cast (maxLength); } else { lengthNames_ = 0; } #endif setDblParam(ClpObjOffset, m.objectiveOffset()); time2 = CoinCpuTime(); handler_->message(CLP_IMPORT_RESULT, messages_) << fileName << time2 - time1 << CoinMessageEol; } else { // errors handler_->message(CLP_IMPORT_ERRORS, messages_) << status << fileName << CoinMessageEol; } return status; } #endif bool ClpModel::isPrimalObjectiveLimitReached() const { double limit = 0.0; getDblParam(ClpPrimalObjectiveLimit, limit); if (limit > 1e30) { // was not ever set return false; } const double obj = objectiveValue(); const double maxmin = optimizationDirection(); if (problemStatus_ == 0) // optimal return maxmin > 0 ? (obj < limit) /*minim*/ : (-obj < limit) /*maxim*/; else if (problemStatus_ == 2) return true; else return false; } bool ClpModel::isDualObjectiveLimitReached() const { double limit = 0.0; getDblParam(ClpDualObjectiveLimit, limit); if (limit > 1e30) { // was not ever set return false; } const double obj = objectiveValue(); const double maxmin = optimizationDirection(); if (problemStatus_ == 0) // optimal return maxmin > 0 ? (obj > limit) /*minim*/ : (-obj > limit) /*maxim*/; else if (problemStatus_ == 1) return true; else return false; } void ClpModel::copyInIntegerInformation(const char * information) { delete [] integerType_; if (information) { integerType_ = new char[numberColumns_]; CoinMemcpyN(information, numberColumns_, integerType_); } else { integerType_ = NULL; } } void ClpModel::setContinuous(int index) { if (integerType_) { #ifndef NDEBUG if (index < 0 || index >= numberColumns_) { indexError(index, "setContinuous"); } #endif integerType_[index] = 0; } } //----------------------------------------------------------------------------- void ClpModel::setInteger(int index) { if (!integerType_) { integerType_ = new char[numberColumns_]; CoinZeroN ( integerType_, numberColumns_); } #ifndef NDEBUG if (index < 0 || index >= numberColumns_) { indexError(index, "setInteger"); } #endif integerType_[index] = 1; } /* Return true if the index-th variable is an integer variable */ bool ClpModel::isInteger(int index) const { if (!integerType_) { return false; } else { #ifndef NDEBUG if (index < 0 || index >= numberColumns_) { indexError(index, "isInteger"); } #endif return (integerType_[index] != 0); } } #ifndef CLP_NO_STD // Drops names - makes lengthnames 0 and names empty void ClpModel::dropNames() { lengthNames_ = 0; rowNames_ = std::vector (); columnNames_ = std::vector (); } #endif // Drop integer informations void ClpModel::deleteIntegerInformation() { delete [] integerType_; integerType_ = NULL; } /* Return copy of status array (char[numberRows+numberColumns]), use delete [] */ unsigned char * ClpModel::statusCopy() const { return ClpCopyOfArray(status_, numberRows_ + numberColumns_); } // Copy in status vector void ClpModel::copyinStatus(const unsigned char * statusArray) { delete [] status_; if (statusArray) { status_ = new unsigned char [numberRows_+numberColumns_]; CoinMemcpyN(statusArray, (numberRows_ + numberColumns_), status_); } else { status_ = NULL; } } #ifndef SLIM_CLP // Load up quadratic objective void ClpModel::loadQuadraticObjective(const int numberColumns, const CoinBigIndex * start, const int * column, const double * element) { whatsChanged_ = 0; // Use ClpSimplex stuff to keep CoinAssert (numberColumns == numberColumns_); assert ((dynamic_cast< ClpLinearObjective*>(objective_))); double offset; ClpObjective * obj = new ClpQuadraticObjective(objective_->gradient(NULL, NULL, offset, false), numberColumns, start, column, element); delete objective_; objective_ = obj; } void ClpModel::loadQuadraticObjective ( const CoinPackedMatrix& matrix) { whatsChanged_ = 0; // Use ClpSimplex stuff to keep CoinAssert (matrix.getNumCols() == numberColumns_); assert ((dynamic_cast< ClpLinearObjective*>(objective_))); double offset; ClpQuadraticObjective * obj = new ClpQuadraticObjective(objective_->gradient(NULL, NULL, offset, false), numberColumns_, NULL, NULL, NULL); delete objective_; objective_ = obj; obj->loadQuadraticObjective(matrix); } // Get rid of quadratic objective void ClpModel::deleteQuadraticObjective() { whatsChanged_ = 0; // Use ClpSimplex stuff to keep ClpQuadraticObjective * obj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); if (obj) obj->deleteQuadraticObjective(); } #endif void ClpModel::setObjective(ClpObjective * objective) { whatsChanged_ = 0; // Use ClpSimplex stuff to keep delete objective_; objective_ = objective->clone(); } // Returns resized array and updates size double * whichDouble(double * array , int number, const int * which) { double * newArray = NULL; if (array && number) { int i ; newArray = new double[number]; for (i = 0; i < number; i++) newArray[i] = array[which[i]]; } return newArray; } char * whichChar(char * array , int number, const int * which) { char * newArray = NULL; if (array && number) { int i ; newArray = new char[number]; for (i = 0; i < number; i++) newArray[i] = array[which[i]]; } return newArray; } unsigned char * whichUnsignedChar(unsigned char * array , int number, const int * which) { unsigned char * newArray = NULL; if (array && number) { int i ; newArray = new unsigned char[number]; for (i = 0; i < number; i++) newArray[i] = array[which[i]]; } return newArray; } // Replace Clp Matrix (current is not deleted) void ClpModel::replaceMatrix( ClpMatrixBase * matrix, bool deleteCurrent) { if (deleteCurrent) delete matrix_; matrix_ = matrix; whatsChanged_ = 0; // Too big a change } // Subproblem constructor ClpModel::ClpModel ( const ClpModel * rhs, int numberRows, const int * whichRow, int numberColumns, const int * whichColumn, bool dropNames, bool dropIntegers) : specialOptions_(rhs->specialOptions_), maximumColumns_(-1), maximumRows_(-1), maximumInternalColumns_(-1), maximumInternalRows_(-1), savedRowScale_(NULL), savedColumnScale_(NULL) { defaultHandler_ = rhs->defaultHandler_; if (defaultHandler_) handler_ = new CoinMessageHandler(*rhs->handler_); else handler_ = rhs->handler_; eventHandler_ = rhs->eventHandler_->clone(); randomNumberGenerator_ = rhs->randomNumberGenerator_; messages_ = rhs->messages_; coinMessages_ = rhs->coinMessages_; maximumColumns_ = -1; maximumRows_ = -1; maximumInternalColumns_ = -1; maximumInternalRows_ = -1; savedRowScale_ = NULL; savedColumnScale_ = NULL; intParam_[ClpMaxNumIteration] = rhs->intParam_[ClpMaxNumIteration]; intParam_[ClpMaxNumIterationHotStart] = rhs->intParam_[ClpMaxNumIterationHotStart]; intParam_[ClpNameDiscipline] = rhs->intParam_[ClpNameDiscipline] ; dblParam_[ClpDualObjectiveLimit] = rhs->dblParam_[ClpDualObjectiveLimit]; dblParam_[ClpPrimalObjectiveLimit] = rhs->dblParam_[ClpPrimalObjectiveLimit]; dblParam_[ClpDualTolerance] = rhs->dblParam_[ClpDualTolerance]; dblParam_[ClpPrimalTolerance] = rhs->dblParam_[ClpPrimalTolerance]; dblParam_[ClpObjOffset] = rhs->dblParam_[ClpObjOffset]; dblParam_[ClpMaxSeconds] = rhs->dblParam_[ClpMaxSeconds]; dblParam_[ClpMaxWallSeconds] = rhs->dblParam_[ClpMaxWallSeconds]; dblParam_[ClpPresolveTolerance] = rhs->dblParam_[ClpPresolveTolerance]; #ifndef CLP_NO_STD strParam_[ClpProbName] = rhs->strParam_[ClpProbName]; #endif specialOptions_ = rhs->specialOptions_; optimizationDirection_ = rhs->optimizationDirection_; objectiveValue_ = rhs->objectiveValue_; smallElement_ = rhs->smallElement_; objectiveScale_ = rhs->objectiveScale_; rhsScale_ = rhs->rhsScale_; numberIterations_ = rhs->numberIterations_; solveType_ = rhs->solveType_; whatsChanged_ = 0; // Too big a change problemStatus_ = rhs->problemStatus_; secondaryStatus_ = rhs->secondaryStatus_; // check valid lists int numberBad = 0; int i; for (i = 0; i < numberRows; i++) if (whichRow[i] < 0 || whichRow[i] >= rhs->numberRows_) numberBad++; CoinAssertHint(!numberBad, "Bad row list for subproblem constructor"); numberBad = 0; for (i = 0; i < numberColumns; i++) if (whichColumn[i] < 0 || whichColumn[i] >= rhs->numberColumns_) numberBad++; CoinAssertHint(!numberBad, "Bad Column list for subproblem constructor"); numberRows_ = numberRows; numberColumns_ = numberColumns; userPointer_ = rhs->userPointer_; trustedUserPointer_ = rhs->trustedUserPointer_; numberThreads_ = 0; #ifndef CLP_NO_STD if (!dropNames) { unsigned int maxLength = 0; int iRow; rowNames_ = std::vector (); columnNames_ = std::vector (); rowNames_.reserve(numberRows_); for (iRow = 0; iRow < numberRows_; iRow++) { rowNames_.push_back(rhs->rowNames_[whichRow[iRow]]); maxLength = CoinMax(maxLength, static_cast (strlen(rowNames_[iRow].c_str()))); } int iColumn; columnNames_.reserve(numberColumns_); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { columnNames_.push_back(rhs->columnNames_[whichColumn[iColumn]]); maxLength = CoinMax(maxLength, static_cast (strlen(columnNames_[iColumn].c_str()))); } lengthNames_ = static_cast (maxLength); } else { lengthNames_ = 0; rowNames_ = std::vector (); columnNames_ = std::vector (); } #endif if (rhs->integerType_ && !dropIntegers) { integerType_ = whichChar(rhs->integerType_, numberColumns, whichColumn); } else { integerType_ = NULL; } if (rhs->rowActivity_) { rowActivity_ = whichDouble(rhs->rowActivity_, numberRows, whichRow); dual_ = whichDouble(rhs->dual_, numberRows, whichRow); columnActivity_ = whichDouble(rhs->columnActivity_, numberColumns, whichColumn); reducedCost_ = whichDouble(rhs->reducedCost_, numberColumns, whichColumn); } else { rowActivity_ = NULL; columnActivity_ = NULL; dual_ = NULL; reducedCost_ = NULL; } rowLower_ = whichDouble(rhs->rowLower_, numberRows, whichRow); rowUpper_ = whichDouble(rhs->rowUpper_, numberRows, whichRow); columnLower_ = whichDouble(rhs->columnLower_, numberColumns, whichColumn); columnUpper_ = whichDouble(rhs->columnUpper_, numberColumns, whichColumn); if (rhs->objective_) objective_ = rhs->objective_->subsetClone(numberColumns, whichColumn); else objective_ = NULL; rowObjective_ = whichDouble(rhs->rowObjective_, numberRows, whichRow); // status has to be done in two stages if (rhs->status_) { status_ = new unsigned char[numberColumns_+numberRows_]; unsigned char * rowStatus = whichUnsignedChar(rhs->status_ + rhs->numberColumns_, numberRows_, whichRow); unsigned char * columnStatus = whichUnsignedChar(rhs->status_, numberColumns_, whichColumn); CoinMemcpyN(rowStatus, numberRows_, status_ + numberColumns_); delete [] rowStatus; CoinMemcpyN(columnStatus, numberColumns_, status_); delete [] columnStatus; } else { status_=NULL; } ray_ = NULL; if (problemStatus_ == 1) ray_ = whichDouble (rhs->ray_, numberRows, whichRow); else if (problemStatus_ == 2) ray_ = whichDouble (rhs->ray_, numberColumns, whichColumn); rowScale_ = NULL; columnScale_ = NULL; inverseRowScale_ = NULL; inverseColumnScale_ = NULL; scalingFlag_ = rhs->scalingFlag_; rowCopy_ = NULL; scaledMatrix_ = NULL; matrix_ = NULL; if (rhs->matrix_) { matrix_ = rhs->matrix_->subsetClone(numberRows, whichRow, numberColumns, whichColumn); } randomNumberGenerator_ = rhs->randomNumberGenerator_; } #ifndef CLP_NO_STD // Copies in names void ClpModel::copyNames(const std::vector & rowNames, const std::vector & columnNames) { unsigned int maxLength = 0; int iRow; rowNames_ = std::vector (); columnNames_ = std::vector (); rowNames_.reserve(numberRows_); for (iRow = 0; iRow < numberRows_; iRow++) { rowNames_.push_back(rowNames[iRow]); maxLength = CoinMax(maxLength, static_cast (strlen(rowNames_[iRow].c_str()))); } int iColumn; columnNames_.reserve(numberColumns_); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { columnNames_.push_back(columnNames[iColumn]); maxLength = CoinMax(maxLength, static_cast (strlen(columnNames_[iColumn].c_str()))); } lengthNames_ = static_cast (maxLength); } // Return name or Rnnnnnnn std::string ClpModel::getRowName(int iRow) const { #ifndef NDEBUG if (iRow < 0 || iRow >= numberRows_) { indexError(iRow, "getRowName"); } #endif int size = static_cast(rowNames_.size()); if (size > iRow) { return rowNames_[iRow]; } else { char name[9]; sprintf(name, "R%7.7d", iRow); std::string rowName(name); return rowName; } } // Set row name void ClpModel::setRowName(int iRow, std::string &name) { #ifndef NDEBUG if (iRow < 0 || iRow >= numberRows_) { indexError(iRow, "setRowName"); } #endif unsigned int maxLength = lengthNames_; int size = static_cast(rowNames_.size()); if (size <= iRow) rowNames_.resize(iRow + 1); rowNames_[iRow] = name; maxLength = CoinMax(maxLength, static_cast (strlen(name.c_str()))); // May be too big - but we would have to check both rows and columns to be exact lengthNames_ = static_cast (maxLength); } // Return name or Cnnnnnnn std::string ClpModel::getColumnName(int iColumn) const { #ifndef NDEBUG if (iColumn < 0 || iColumn >= numberColumns_) { indexError(iColumn, "getColumnName"); } #endif int size = static_cast(columnNames_.size()); if (size > iColumn) { return columnNames_[iColumn]; } else { char name[9]; sprintf(name, "C%7.7d", iColumn); std::string columnName(name); return columnName; } } // Set column name void ClpModel::setColumnName(int iColumn, std::string &name) { #ifndef NDEBUG if (iColumn < 0 || iColumn >= numberColumns_) { indexError(iColumn, "setColumnName"); } #endif unsigned int maxLength = lengthNames_; int size = static_cast(columnNames_.size()); if (size <= iColumn) columnNames_.resize(iColumn + 1); columnNames_[iColumn] = name; maxLength = CoinMax(maxLength, static_cast (strlen(name.c_str()))); // May be too big - but we would have to check both columns and columns to be exact lengthNames_ = static_cast (maxLength); } // Copies in Row names - modifies names first .. last-1 void ClpModel::copyRowNames(const std::vector & rowNames, int first, int last) { // Do column names if necessary if (!lengthNames_&&numberColumns_) { lengthNames_=8; copyColumnNames(NULL,0,numberColumns_); } unsigned int maxLength = lengthNames_; int size = static_cast(rowNames_.size()); if (size != numberRows_) rowNames_.resize(numberRows_); int iRow; for (iRow = first; iRow < last; iRow++) { rowNames_[iRow] = rowNames[iRow-first]; maxLength = CoinMax(maxLength, static_cast (strlen(rowNames_[iRow-first].c_str()))); } // May be too big - but we would have to check both rows and columns to be exact lengthNames_ = static_cast (maxLength); } // Copies in Column names - modifies names first .. last-1 void ClpModel::copyColumnNames(const std::vector & columnNames, int first, int last) { // Do row names if necessary if (!lengthNames_&&numberRows_) { lengthNames_=8; copyRowNames(NULL,0,numberRows_); } unsigned int maxLength = lengthNames_; int size = static_cast(columnNames_.size()); if (size != numberColumns_) columnNames_.resize(numberColumns_); int iColumn; for (iColumn = first; iColumn < last; iColumn++) { columnNames_[iColumn] = columnNames[iColumn-first]; maxLength = CoinMax(maxLength, static_cast (strlen(columnNames_[iColumn-first].c_str()))); } // May be too big - but we would have to check both rows and columns to be exact lengthNames_ = static_cast (maxLength); } // Copies in Row names - modifies names first .. last-1 void ClpModel::copyRowNames(const char * const * rowNames, int first, int last) { // Do column names if necessary if (!lengthNames_&&numberColumns_) { lengthNames_=8; copyColumnNames(NULL,0,numberColumns_); } unsigned int maxLength = lengthNames_; int size = static_cast(rowNames_.size()); if (size != numberRows_) rowNames_.resize(numberRows_); int iRow; for (iRow = first; iRow < last; iRow++) { if (rowNames && rowNames[iRow-first] && strlen(rowNames[iRow-first])) { rowNames_[iRow] = rowNames[iRow-first]; maxLength = CoinMax(maxLength, static_cast (strlen(rowNames[iRow-first]))); } else { maxLength = CoinMax(maxLength, static_cast (8)); char name[9]; sprintf(name, "R%7.7d", iRow); rowNames_[iRow] = name; } } // May be too big - but we would have to check both rows and columns to be exact lengthNames_ = static_cast (maxLength); } // Copies in Column names - modifies names first .. last-1 void ClpModel::copyColumnNames(const char * const * columnNames, int first, int last) { // Do row names if necessary if (!lengthNames_&&numberRows_) { lengthNames_=8; copyRowNames(NULL,0,numberRows_); } unsigned int maxLength = lengthNames_; int size = static_cast(columnNames_.size()); if (size != numberColumns_) columnNames_.resize(numberColumns_); int iColumn; for (iColumn = first; iColumn < last; iColumn++) { if (columnNames && columnNames[iColumn-first] && strlen(columnNames[iColumn-first])) { columnNames_[iColumn] = columnNames[iColumn-first]; maxLength = CoinMax(maxLength, static_cast (strlen(columnNames[iColumn-first]))); } else { maxLength = CoinMax(maxLength, static_cast (8)); char name[9]; sprintf(name, "C%7.7d", iColumn); columnNames_[iColumn] = name; } } // May be too big - but we would have to check both rows and columns to be exact lengthNames_ = static_cast (maxLength); } #endif // Primal objective limit void ClpModel::setPrimalObjectiveLimit(double value) { dblParam_[ClpPrimalObjectiveLimit] = value; } // Dual objective limit void ClpModel::setDualObjectiveLimit(double value) { dblParam_[ClpDualObjectiveLimit] = value; } // Objective offset void ClpModel::setObjectiveOffset(double value) { dblParam_[ClpObjOffset] = value; } // Solve a problem with no elements - return status int ClpModel::emptyProblem(int * infeasNumber, double * infeasSum, bool printMessage) { secondaryStatus_ = 6; // so user can see something odd if (printMessage) handler_->message(CLP_EMPTY_PROBLEM, messages_) << numberRows_ << numberColumns_ << 0 << CoinMessageEol; int returnCode = 0; if (numberRows_ || numberColumns_) { if (!status_) { status_ = new unsigned char[numberRows_+numberColumns_]; CoinZeroN(status_, numberRows_ + numberColumns_); } } // status is set directly (as can be used by Interior methods) // check feasible int numberPrimalInfeasibilities = 0; double sumPrimalInfeasibilities = 0.0; int numberDualInfeasibilities = 0; double sumDualInfeasibilities = 0.0; if (numberRows_) { for (int i = 0; i < numberRows_; i++) { dual_[i] = 0.0; if (rowLower_[i] <= rowUpper_[i]) { if (rowLower_[i] > -1.0e30 || rowUpper_[i] < 1.0e30) { if (rowLower_[i] <= 0.0 && rowUpper_[i] >= 0.0) { if (fabs(rowLower_[i]) < fabs(rowUpper_[i])) rowActivity_[i] = rowLower_[i]; else rowActivity_[i] = rowUpper_[i]; } else { rowActivity_[i] = 0.0; numberPrimalInfeasibilities++; sumPrimalInfeasibilities += CoinMin(rowLower_[i], -rowUpper_[i]); returnCode = 1; } } else { rowActivity_[i] = 0.0; } } else { rowActivity_[i] = 0.0; numberPrimalInfeasibilities++; sumPrimalInfeasibilities += rowLower_[i] - rowUpper_[i]; returnCode = 1; } status_[i+numberColumns_] = 1; } } objectiveValue_ = 0.0; if (numberColumns_) { const double * cost = objective(); for (int i = 0; i < numberColumns_; i++) { reducedCost_[i] = cost[i]; double objValue = cost[i] * optimizationDirection_; if (columnLower_[i] <= columnUpper_[i]) { if (columnLower_[i] > -1.0e30 || columnUpper_[i] < 1.0e30) { if (!objValue) { if (fabs(columnLower_[i]) < fabs(columnUpper_[i])) { columnActivity_[i] = columnLower_[i]; status_[i] = 3; } else { columnActivity_[i] = columnUpper_[i]; status_[i] = 2; } } else if (objValue > 0.0) { if (columnLower_[i] > -1.0e30) { columnActivity_[i] = columnLower_[i]; status_[i] = 3; } else { columnActivity_[i] = columnUpper_[i]; status_[i] = 2; numberDualInfeasibilities++;; sumDualInfeasibilities += fabs(objValue); returnCode |= 2; } objectiveValue_ += columnActivity_[i] * objValue; } else { if (columnUpper_[i] < 1.0e30) { columnActivity_[i] = columnUpper_[i]; status_[i] = 2; } else { columnActivity_[i] = columnLower_[i]; status_[i] = 3; numberDualInfeasibilities++;; sumDualInfeasibilities += fabs(objValue); returnCode |= 2; } objectiveValue_ += columnActivity_[i] * objValue; } } else { columnActivity_[i] = 0.0; if (objValue) { numberDualInfeasibilities++;; sumDualInfeasibilities += fabs(objValue); returnCode |= 2; } status_[i] = 0; } } else { if (fabs(columnLower_[i]) < fabs(columnUpper_[i])) { columnActivity_[i] = columnLower_[i]; status_[i] = 3; } else { columnActivity_[i] = columnUpper_[i]; status_[i] = 2; } numberPrimalInfeasibilities++; sumPrimalInfeasibilities += columnLower_[i] - columnUpper_[i]; returnCode |= 1; } } } objectiveValue_ /= (objectiveScale_ * rhsScale_); if (infeasNumber) { infeasNumber[0] = numberDualInfeasibilities; infeasSum[0] = sumDualInfeasibilities; infeasNumber[1] = numberPrimalInfeasibilities; infeasSum[1] = sumPrimalInfeasibilities; } if (returnCode == 3) returnCode = 4; return returnCode; } #ifndef SLIM_NOIO /* Write the problem in MPS format to the specified file. Row and column names may be null. formatType is
    • 0 - normal
    • 1 - extra accuracy
    • 2 - IEEE hex (later)
    Returns non-zero on I/O error */ int ClpModel::writeMps(const char *filename, int formatType, int numberAcross, double objSense) const { matrix_->setDimensions(numberRows_, numberColumns_); // Get multiplier for objective function - default 1.0 double * objective = new double[numberColumns_]; CoinMemcpyN(getObjCoefficients(), numberColumns_, objective); if (objSense * getObjSense() < 0.0) { for (int i = 0; i < numberColumns_; ++i) objective [i] = - objective[i]; } // get names const char * const * const rowNames = rowNamesAsChar(); const char * const * const columnNames = columnNamesAsChar(); CoinMpsIO writer; writer.passInMessageHandler(handler_); *writer.messagesPointer() = coinMessages(); writer.setMpsData(*(matrix_->getPackedMatrix()), COIN_DBL_MAX, getColLower(), getColUpper(), objective, reinterpret_cast (NULL) /*integrality*/, getRowLower(), getRowUpper(), columnNames, rowNames); // Pass in array saying if each variable integer writer.copyInIntegerInformation(integerInformation()); writer.setObjectiveOffset(objectiveOffset()); // set name writer.setProblemName(problemName().c_str()); delete [] objective; CoinPackedMatrix * quadratic = NULL; #ifndef SLIM_CLP // allow for quadratic objective #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif if (quadraticObj) quadratic = quadraticObj->quadraticObjective(); #endif int returnCode = writer.writeMps(filename, 0 /* do not gzip it*/, formatType, numberAcross, quadratic); if (rowNames) { deleteNamesAsChar(rowNames, numberRows_ + 1); deleteNamesAsChar(columnNames, numberColumns_); } return returnCode; } #ifndef CLP_NO_STD // Create row names as char ** const char * const * ClpModel::rowNamesAsChar() const { char ** rowNames = NULL; if (lengthNames()) { rowNames = new char * [numberRows_+1]; int numberNames = static_cast(rowNames_.size()); numberNames = CoinMin(numberRows_, numberNames); int iRow; for (iRow = 0; iRow < numberNames; iRow++) { if (rowName(iRow) != "") { rowNames[iRow] = CoinStrdup(rowName(iRow).c_str()); } else { char name[9]; sprintf(name, "R%7.7d", iRow); rowNames[iRow] = CoinStrdup(name); } #ifdef STRIPBLANKS char * xx = rowNames[iRow]; int i; int length = strlen(xx); int n = 0; for (i = 0; i < length; i++) { if (xx[i] != ' ') xx[n++] = xx[i]; } xx[n] = '\0'; #endif } char name[9]; for ( ; iRow < numberRows_; iRow++) { sprintf(name, "R%7.7d", iRow); rowNames[iRow] = CoinStrdup(name); } rowNames[numberRows_] = CoinStrdup("OBJROW"); } return reinterpret_cast(rowNames); } // Create column names as char ** const char * const * ClpModel::columnNamesAsChar() const { char ** columnNames = NULL; if (lengthNames()) { columnNames = new char * [numberColumns_]; int numberNames = static_cast(columnNames_.size()); numberNames = CoinMin(numberColumns_, numberNames); int iColumn; for (iColumn = 0; iColumn < numberNames; iColumn++) { if (columnName(iColumn) != "") { columnNames[iColumn] = CoinStrdup(columnName(iColumn).c_str()); } else { char name[9]; sprintf(name, "C%7.7d", iColumn); columnNames[iColumn] = CoinStrdup(name); } #ifdef STRIPBLANKS char * xx = columnNames[iColumn]; int i; int length = strlen(xx); int n = 0; for (i = 0; i < length; i++) { if (xx[i] != ' ') xx[n++] = xx[i]; } xx[n] = '\0'; #endif } char name[9]; for ( ; iColumn < numberColumns_; iColumn++) { sprintf(name, "C%7.7d", iColumn); columnNames[iColumn] = CoinStrdup(name); } } return /*reinterpret_cast*/(columnNames); } // Delete char * version of names void ClpModel::deleteNamesAsChar(const char * const * names, int number) const { for (int i = 0; i < number; i++) { free(const_cast(names[i])); } delete [] const_cast(names); } #endif #endif // Pass in Event handler (cloned and deleted at end) void ClpModel::passInEventHandler(const ClpEventHandler * eventHandler) { delete eventHandler_; eventHandler_ = eventHandler->clone(); } // Sets or unsets scaling, 0 -off, 1 on, 2 dynamic(later) void ClpModel::scaling(int mode) { // If mode changes then we treat as new matrix (need new row copy) if (mode != scalingFlag_) { whatsChanged_ &= ~(2 + 4 + 8); // Get rid of scaled matrix setClpScaledMatrix(NULL); } if (mode > 0 && mode < 6) { scalingFlag_ = mode; } else if (!mode) { scalingFlag_ = 0; setRowScale(NULL); setColumnScale(NULL); } } void ClpModel::times(double scalar, const double * x, double * y) const { if (!scaledMatrix_ || !rowScale_) { if (rowScale_) matrix_->times(scalar, x, y, rowScale_, columnScale_); else matrix_->times(scalar, x, y); } else { scaledMatrix_->times(scalar, x, y); } } void ClpModel::transposeTimes(double scalar, const double * x, double * y) const { if (!scaledMatrix_ || !rowScale_) { if (rowScale_) matrix_->transposeTimes(scalar, x, y, rowScale_, columnScale_, NULL); else matrix_->transposeTimes(scalar, x, y); } else { scaledMatrix_->transposeTimes(scalar, x, y); } } // Does much of scaling void ClpModel::gutsOfScaling() { int i; if (rowObjective_) { for (i = 0; i < numberRows_; i++) rowObjective_[i] /= rowScale_[i]; } for (i = 0; i < numberRows_; i++) { double multiplier = rowScale_[i]; double inverseMultiplier = 1.0 / multiplier; rowActivity_[i] *= multiplier; dual_[i] *= inverseMultiplier; if (rowLower_[i] > -1.0e30) rowLower_[i] *= multiplier; else rowLower_[i] = -COIN_DBL_MAX; if (rowUpper_[i] < 1.0e30) rowUpper_[i] *= multiplier; else rowUpper_[i] = COIN_DBL_MAX; } for (i = 0; i < numberColumns_; i++) { double multiplier = 1.0 * inverseColumnScale_[i]; columnActivity_[i] *= multiplier; reducedCost_[i] *= columnScale_[i]; if (columnLower_[i] > -1.0e30) columnLower_[i] *= multiplier; else columnLower_[i] = -COIN_DBL_MAX; if (columnUpper_[i] < 1.0e30) columnUpper_[i] *= multiplier; else columnUpper_[i] = COIN_DBL_MAX; } //now replace matrix //and objective matrix_->reallyScale(rowScale_, columnScale_); objective_->reallyScale(columnScale_); } /* If we constructed a "really" scaled model then this reverses the operation. Quantities may not be exactly as they were before due to rounding errors */ void ClpModel::unscale() { if (rowScale_) { int i; // reverse scaling for (i = 0; i < numberRows_; i++) rowScale_[i] = 1.0 * inverseRowScale_[i]; for (i = 0; i < numberColumns_; i++) columnScale_[i] = 1.0 * inverseColumnScale_[i]; gutsOfScaling(); } scalingFlag_ = 0; setRowScale(NULL); setColumnScale(NULL); } void ClpModel::setSpecialOptions(unsigned int value) { specialOptions_ = value; } /* This creates a coinModel object */ CoinModel * ClpModel::createCoinModel() const { CoinModel * coinModel = new CoinModel(); CoinPackedMatrix matrixByRow; matrixByRow.setExtraGap(0.0); matrixByRow.setExtraMajor(0.0); matrixByRow.reverseOrderedCopyOf(*matrix()); coinModel->setObjectiveOffset(objectiveOffset()); coinModel->setProblemName(problemName().c_str()); // Build by row from scratch const double * element = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); int i; for (i = 0; i < numberRows_; i++) { coinModel->addRow(rowLength[i], column + rowStart[i], element + rowStart[i], rowLower_[i], rowUpper_[i]); } // Now do column part const double * objective = this->objective(); for (i = 0; i < numberColumns_; i++) { coinModel->setColumnBounds(i, columnLower_[i], columnUpper_[i]); coinModel->setColumnObjective(i, objective[i]); } for ( i = 0; i < numberColumns_; i++) { if (isInteger(i)) coinModel->setColumnIsInteger(i, true); } // do names - clear out coinModel->zapRowNames(); coinModel->zapColumnNames(); for (i = 0; i < numberRows_; i++) { char temp[30]; strcpy(temp, rowName(i).c_str()); size_t length = strlen(temp); for (size_t j = 0; j < length; j++) { if (temp[j] == '-') temp[j] = '_'; } coinModel->setRowName(i, temp); } for (i = 0; i < numberColumns_; i++) { char temp[30]; strcpy(temp, columnName(i).c_str()); size_t length = strlen(temp); for (size_t j = 0; j < length; j++) { if (temp[j] == '-') temp[j] = '_'; } coinModel->setColumnName(i, temp); } ClpQuadraticObjective * obj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); if (obj) { const CoinPackedMatrix * quadObj = obj->quadraticObjective(); // add in quadratic const double * element = quadObj->getElements(); const int * row = quadObj->getIndices(); const CoinBigIndex * columnStart = quadObj->getVectorStarts(); const int * columnLength = quadObj->getVectorLengths(); for (i = 0; i < numberColumns_; i++) { int nels = columnLength[i]; if (nels) { CoinBigIndex start = columnStart[i]; double constant = coinModel->getColumnObjective(i); char temp[100000]; char temp2[30]; sprintf(temp, "%g", constant); for (CoinBigIndex k = start; k < start + nels; k++) { int kColumn = row[k]; double value = element[k]; #if 1 // ampl gives twice with assumed 0.5 if (kColumn < i) continue; else if (kColumn == i) value *= 0.5; #endif if (value == 1.0) sprintf(temp2, "+%s", coinModel->getColumnName(kColumn)); else if (value == -1.0) sprintf(temp2, "-%s", coinModel->getColumnName(kColumn)); else if (value > 0.0) sprintf(temp2, "+%g*%s", value, coinModel->getColumnName(kColumn)); else sprintf(temp2, "%g*%s", value, coinModel->getColumnName(kColumn)); strcat(temp, temp2); assert (strlen(temp) < 100000); } coinModel->setObjective(i, temp); if (logLevel() > 2) printf("el for objective column %s is %s\n", coinModel->getColumnName(i), temp); } } } return coinModel; } // Start or reset using maximumRows_ and Columns_ void ClpModel::startPermanentArrays() { COIN_DETAIL_PRINT(printf("startperm a %d rows, %d maximum rows\n", numberRows_, maximumRows_)); if ((specialOptions_ & 65536) != 0) { if (numberRows_ > maximumRows_ || numberColumns_ > maximumColumns_) { if (numberRows_ > maximumRows_) { if (maximumRows_ > 0) maximumRows_ = numberRows_ + 10 + numberRows_ / 100; else maximumRows_ = numberRows_; } if (numberColumns_ > maximumColumns_) { if (maximumColumns_ > 0) maximumColumns_ = numberColumns_ + 10 + numberColumns_ / 100; else maximumColumns_ = numberColumns_; } // need to make sure numberRows_ OK and size of matrices resize(maximumRows_, maximumColumns_); COIN_DETAIL_PRINT(printf("startperm b %d rows, %d maximum rows\n", numberRows_, maximumRows_)); } else { return; } } else { specialOptions_ |= 65536; maximumRows_ = numberRows_; maximumColumns_ = numberColumns_; baseMatrix_ = *matrix(); baseMatrix_.cleanMatrix(); baseRowCopy_.setExtraGap(0.0); baseRowCopy_.setExtraMajor(0.0); baseRowCopy_.reverseOrderedCopyOf(baseMatrix_); COIN_DETAIL_PRINT(printf("startperm c %d rows, %d maximum rows\n", numberRows_, maximumRows_)); } } // Stop using maximumRows_ and Columns_ void ClpModel::stopPermanentArrays() { specialOptions_ &= ~65536; maximumRows_ = -1; maximumColumns_ = -1; if (rowScale_ != savedRowScale_) { delete [] savedRowScale_; delete [] savedColumnScale_; } savedRowScale_ = NULL; savedColumnScale_ = NULL; } // Set new row matrix void ClpModel::setNewRowCopy(ClpMatrixBase * newCopy) { delete rowCopy_; rowCopy_ = newCopy; } /* Find a network subset. rotate array should be numberRows. On output -1 not in network 0 in network as is 1 in network with signs swapped Returns number of network rows (positive if exact network, negative if needs extra row) From Gulpinar, Gutin, Maros and Mitra */ int ClpModel::findNetwork(char * rotate, double fractionNeeded) { int * mapping = new int [numberRows_]; // Get column copy CoinPackedMatrix * columnCopy = matrix(); // Get a row copy in standard format CoinPackedMatrix * copy = new CoinPackedMatrix(); copy->setExtraGap(0.0); copy->setExtraMajor(0.0); copy->reverseOrderedCopyOf(*columnCopy); // make sure ordered and no gaps copy->cleanMatrix(); // get matrix data pointers const int * columnIn = copy->getIndices(); const CoinBigIndex * rowStartIn = copy->getVectorStarts(); const int * rowLength = copy->getVectorLengths(); const double * elementByRowIn = copy->getElements(); int iRow, iColumn; int numberEligible = 0; int numberIn = 0; int numberElements = 0; for (iRow = 0; iRow < numberRows_; iRow++) { bool possible = true; mapping[iRow] = -1; rotate[iRow] = -1; for (CoinBigIndex j = rowStartIn[iRow]; j < rowStartIn[iRow] + rowLength[iRow]; j++) { //int iColumn = column[j]; double value = elementByRowIn[j]; if (fabs(value) != 1.0) { possible = false; break; } } if (rowLength[iRow] && possible) { mapping[iRow] = numberEligible; numberEligible++; numberElements += rowLength[iRow]; } } if (numberEligible < fractionNeeded * numberRows_) { delete [] mapping; delete copy; return 0; } // create arrays int * eligible = new int [numberRows_]; int * column = new int [numberElements]; CoinBigIndex * rowStart = new CoinBigIndex [numberEligible+1]; char * elementByRow = new char [numberElements]; numberEligible = 0; numberElements = 0; rowStart[0] = 0; for (iRow = 0; iRow < numberRows_; iRow++) { if (mapping[iRow] < 0) continue; assert (numberEligible == mapping[iRow]); rotate[numberEligible] = 0; for (CoinBigIndex j = rowStartIn[iRow]; j < rowStartIn[iRow] + rowLength[iRow]; j++) { column[numberElements] = columnIn[j]; double value = elementByRowIn[j]; if (value == 1.0) elementByRow[numberElements++] = 1; else elementByRow[numberElements++] = -1; } numberEligible++; rowStart[numberEligible] = numberElements; } // get rid of copy to save space delete copy; const int * rowIn = columnCopy->getIndices(); const CoinBigIndex * columnStartIn = columnCopy->getVectorStarts(); const int * columnLengthIn = columnCopy->getVectorLengths(); const double * elementByColumnIn = columnCopy->getElements(); int * columnLength = new int [numberColumns_]; // May just be that is a network - worth checking bool isNetworkAlready = true; bool trueNetwork = true; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double product = 1.0; int n = 0; for (CoinBigIndex j = columnStartIn[iColumn]; j < columnStartIn[iColumn] + columnLengthIn[iColumn]; j++) { iRow = mapping[rowIn[j]]; if (iRow >= 0) { n++; product *= elementByColumnIn[j]; } } if (n >= 2) { if (product != -1.0 || n > 2) isNetworkAlready = false; } else if (n == 1) { trueNetwork = false; } columnLength[iColumn] = n; } if (!isNetworkAlready) { // For sorting double * count = new double [numberRows_]; int * which = new int [numberRows_]; int numberLast = -1; // Count for columns char * columnCount = new char[numberColumns_]; memset(columnCount, 0, numberColumns_); char * currentColumnCount = new char[numberColumns_]; // Now do main loop while (numberIn > numberLast) { numberLast = numberIn; int numberLeft = 0; for (iRow = 0; iRow < numberEligible; iRow++) { if (rotate[iRow] == 0 && rowStart[iRow+1] > rowStart[iRow]) { which[numberLeft] = iRow; int merit = 0; bool OK = true; bool reflectionOK = true; for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { iColumn = column[j]; int iCount = columnCount[iColumn]; int absCount = CoinAbs(iCount); if (absCount < 2) { merit = CoinMax(columnLength[iColumn] - absCount - 1, merit); if (elementByRow[j] == iCount) OK = false; else if (elementByRow[j] == -iCount) reflectionOK = false; } else { merit = -2; break; } } if (merit > -2 && (OK || reflectionOK) && (!OK || !reflectionOK || !numberIn)) { //if (!numberLast) merit=1; count[numberLeft++] = (rowStart[iRow+1] - rowStart[iRow] - 1) * (static_cast(merit)); if (OK) rotate[iRow] = 0; else rotate[iRow] = 1; } else { // no good rotate[iRow] = -1; } } } CoinSort_2(count, count + numberLeft, which); // Get G memset(currentColumnCount, 0, numberColumns_); for (iRow = 0; iRow < numberLeft; iRow++) { int jRow = which[iRow]; bool possible = true; for (int i = 0; i < numberIn; i++) { for (CoinBigIndex j = rowStart[jRow]; j < rowStart[jRow+1]; j++) { if (currentColumnCount[column[j]]) { possible = false; break; } } } if (possible) { rotate[jRow] = static_cast(rotate[jRow] + 2); eligible[numberIn++] = jRow; char multiplier = static_cast((rotate[jRow] == 2) ? 1 : -1); for (CoinBigIndex j = rowStart[jRow]; j < rowStart[jRow+1]; j++) { iColumn = column[j]; currentColumnCount[iColumn]++; int iCount = columnCount[iColumn]; int absCount = CoinAbs(iCount); if (!absCount) { columnCount[iColumn] = static_cast(elementByRow[j] * multiplier); } else { columnCount[iColumn] = 2; } } } } } #ifndef NDEBUG for (iRow = 0; iRow < numberIn; iRow++) { int kRow = eligible[iRow]; assert (rotate[kRow] >= 2); } #endif trueNetwork = true; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (CoinAbs(static_cast(columnCount[iColumn])) == 1) { trueNetwork = false; break; } } delete [] currentColumnCount; delete [] columnCount; delete [] which; delete [] count; } else { numberIn = numberEligible; for (iRow = 0; iRow < numberRows_; iRow++) { int kRow = mapping[iRow]; if (kRow >= 0) { rotate[kRow] = 2; } } } if (!trueNetwork) numberIn = - numberIn; delete [] column; delete [] rowStart; delete [] elementByRow; delete [] columnLength; // redo rotate char * rotate2 = CoinCopyOfArray(rotate, numberEligible); for (iRow = 0; iRow < numberRows_; iRow++) { int kRow = mapping[iRow]; if (kRow >= 0) { int iState = rotate2[kRow]; if (iState > 1) iState -= 2; else iState = -1; rotate[iRow] = static_cast(iState); } else { rotate[iRow] = -1; } } delete [] rotate2; delete [] eligible; delete [] mapping; return numberIn; } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpDataSave::ClpDataSave () { dualBound_ = 0.0; infeasibilityCost_ = 0.0; sparseThreshold_ = 0; pivotTolerance_ = 0.0; zeroFactorizationTolerance_ = 1.0e13; zeroSimplexTolerance_ = 1.0e-13; acceptablePivot_ = 0.0; objectiveScale_ = 1.0; perturbation_ = 0; forceFactorization_ = -1; scalingFlag_ = 0; specialOptions_ = 0; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpDataSave::ClpDataSave (const ClpDataSave & rhs) { dualBound_ = rhs.dualBound_; infeasibilityCost_ = rhs.infeasibilityCost_; pivotTolerance_ = rhs.pivotTolerance_; zeroFactorizationTolerance_ = rhs.zeroFactorizationTolerance_; zeroSimplexTolerance_ = rhs.zeroSimplexTolerance_; acceptablePivot_ = rhs.acceptablePivot_; objectiveScale_ = rhs.objectiveScale_; sparseThreshold_ = rhs.sparseThreshold_; perturbation_ = rhs.perturbation_; forceFactorization_ = rhs.forceFactorization_; scalingFlag_ = rhs.scalingFlag_; specialOptions_ = rhs.specialOptions_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpDataSave::~ClpDataSave () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpDataSave & ClpDataSave::operator=(const ClpDataSave& rhs) { if (this != &rhs) { dualBound_ = rhs.dualBound_; infeasibilityCost_ = rhs.infeasibilityCost_; pivotTolerance_ = rhs.pivotTolerance_; zeroFactorizationTolerance_ = rhs.zeroFactorizationTolerance_; zeroSimplexTolerance_ = rhs.zeroSimplexTolerance_; acceptablePivot_ = rhs.acceptablePivot_; objectiveScale_ = rhs.objectiveScale_; sparseThreshold_ = rhs.sparseThreshold_; perturbation_ = rhs.perturbation_; forceFactorization_ = rhs.forceFactorization_; scalingFlag_ = rhs.scalingFlag_; specialOptions_ = rhs.specialOptions_; } return *this; } // Create C++ lines to get to current state void ClpModel::generateCpp( FILE * fp) { // Stuff that can't be done easily if (!lengthNames_) { // no names fprintf(fp, " clpModel->dropNames();\n"); } ClpModel defaultModel; ClpModel * other = &defaultModel; int iValue1, iValue2; double dValue1, dValue2; iValue1 = this->maximumIterations(); iValue2 = other->maximumIterations(); fprintf(fp, "%d int save_maximumIterations = clpModel->maximumIterations();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setMaximumIterations(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d clpModel->setMaximumIterations(save_maximumIterations);\n", iValue1 == iValue2 ? 7 : 6); dValue1 = this->primalTolerance(); dValue2 = other->primalTolerance(); fprintf(fp, "%d double save_primalTolerance = clpModel->primalTolerance();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setPrimalTolerance(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setPrimalTolerance(save_primalTolerance);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->dualTolerance(); dValue2 = other->dualTolerance(); fprintf(fp, "%d double save_dualTolerance = clpModel->dualTolerance();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setDualTolerance(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setDualTolerance(save_dualTolerance);\n", dValue1 == dValue2 ? 7 : 6); iValue1 = this->numberIterations(); iValue2 = other->numberIterations(); fprintf(fp, "%d int save_numberIterations = clpModel->numberIterations();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setNumberIterations(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d clpModel->setNumberIterations(save_numberIterations);\n", iValue1 == iValue2 ? 7 : 6); dValue1 = this->maximumSeconds(); dValue2 = other->maximumSeconds(); fprintf(fp, "%d double save_maximumSeconds = clpModel->maximumSeconds();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setMaximumSeconds(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setMaximumSeconds(save_maximumSeconds);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->optimizationDirection(); dValue2 = other->optimizationDirection(); fprintf(fp, "%d double save_optimizationDirection = clpModel->optimizationDirection();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setOptimizationDirection(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setOptimizationDirection(save_optimizationDirection);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->objectiveScale(); dValue2 = other->objectiveScale(); fprintf(fp, "%d double save_objectiveScale = clpModel->objectiveScale();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setObjectiveScale(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setObjectiveScale(save_objectiveScale);\n", dValue1 == dValue2 ? 7 : 6); dValue1 = this->rhsScale(); dValue2 = other->rhsScale(); fprintf(fp, "%d double save_rhsScale = clpModel->rhsScale();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setRhsScale(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setRhsScale(save_rhsScale);\n", dValue1 == dValue2 ? 7 : 6); iValue1 = this->scalingFlag(); iValue2 = other->scalingFlag(); fprintf(fp, "%d int save_scalingFlag = clpModel->scalingFlag();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d clpModel->scaling(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d clpModel->scaling(save_scalingFlag);\n", iValue1 == iValue2 ? 7 : 6); dValue1 = this->getSmallElementValue(); dValue2 = other->getSmallElementValue(); fprintf(fp, "%d double save_getSmallElementValue = clpModel->getSmallElementValue();\n", dValue1 == dValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setSmallElementValue(%g);\n", dValue1 == dValue2 ? 4 : 3, dValue1); fprintf(fp, "%d clpModel->setSmallElementValue(save_getSmallElementValue);\n", dValue1 == dValue2 ? 7 : 6); iValue1 = this->logLevel(); iValue2 = other->logLevel(); fprintf(fp, "%d int save_logLevel = clpModel->logLevel();\n", iValue1 == iValue2 ? 2 : 1); fprintf(fp, "%d clpModel->setLogLevel(%d);\n", iValue1 == iValue2 ? 4 : 3, iValue1); fprintf(fp, "%d clpModel->setLogLevel(save_logLevel);\n", iValue1 == iValue2 ? 7 : 6); } CoinMP-1.8.3/Clp/src/ClpDummyMatrix.cpp0000644000175000017500000002007011510657452016251 0ustar renerene/* $Id: ClpDummyMatrix.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpDummyMatrix.hpp" #include "ClpFactorization.hpp" #include "ClpMessage.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpDummyMatrix::ClpDummyMatrix () : ClpMatrixBase() { setType(14); numberRows_ = 0; numberColumns_ = 0; numberElements_ = 0; } /* Constructor from data */ ClpDummyMatrix::ClpDummyMatrix(int numberColumns, int numberRows, int numberElements) : ClpMatrixBase() { setType(14); numberRows_ = numberRows; numberColumns_ = numberColumns; numberElements_ = numberElements; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpDummyMatrix::ClpDummyMatrix (const ClpDummyMatrix & rhs) : ClpMatrixBase(rhs) { numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; numberElements_ = rhs.numberElements_; } ClpDummyMatrix::ClpDummyMatrix (const CoinPackedMatrix & ) : ClpMatrixBase() { std::cerr << "Constructor from CoinPackedMatrix nnot supported - ClpDummyMatrix" << std::endl; abort(); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpDummyMatrix::~ClpDummyMatrix () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpDummyMatrix & ClpDummyMatrix::operator=(const ClpDummyMatrix& rhs) { if (this != &rhs) { ClpMatrixBase::operator=(rhs); numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; numberElements_ = rhs.numberElements_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpMatrixBase * ClpDummyMatrix::clone() const { return new ClpDummyMatrix(*this); } /* Returns a new matrix in reverse order without gaps */ ClpMatrixBase * ClpDummyMatrix::reverseOrderedCopy() const { std::cerr << "reverseOrderedCopy not supported - ClpDummyMatrix" << std::endl; abort(); return NULL; } //unscaled versions void ClpDummyMatrix::times(double , const double * , double * ) const { std::cerr << "times not supported - ClpDummyMatrix" << std::endl; abort(); } void ClpDummyMatrix::transposeTimes(double , const double * , double * ) const { std::cerr << "transposeTimes not supported - ClpDummyMatrix" << std::endl; abort(); } void ClpDummyMatrix::times(double , const double * , double * , const double * , const double * ) const { std::cerr << "timesnot supported - ClpDummyMatrix" << std::endl; abort(); } void ClpDummyMatrix::transposeTimes( double, const double * , double * , const double * , const double * ) const { std::cerr << "transposeTimesnot supported - ClpDummyMatrix" << std::endl; abort(); } /* Return x * A + y in z. Squashes small elements and knows about ClpSimplex */ void ClpDummyMatrix::transposeTimes(const ClpSimplex * , double , const CoinIndexedVector * , CoinIndexedVector * , CoinIndexedVector * ) const { std::cerr << "transposeTimes not supported - ClpDummyMatrix" << std::endl; abort(); } /* Return x *A in z but just for indices in y */ void ClpDummyMatrix::subsetTransposeTimes(const ClpSimplex * , const CoinIndexedVector * , const CoinIndexedVector * , CoinIndexedVector * ) const { std::cerr << "subsetTransposeTimes not supported - ClpDummyMatrix" << std::endl; abort(); } /// returns number of elements in column part of basis, CoinBigIndex ClpDummyMatrix::countBasis(const int * , int & ) { std::cerr << "countBasis not supported - ClpDummyMatrix" << std::endl; abort(); return 0; } void ClpDummyMatrix::fillBasis(ClpSimplex * , const int * , int & , int * , int * , int * , int * , CoinFactorizationDouble * ) { std::cerr << "fillBasis not supported - ClpDummyMatrix" << std::endl; abort(); } /* Unpacks a column into an CoinIndexedvector */ void ClpDummyMatrix::unpack(const ClpSimplex * , CoinIndexedVector * , int ) const { std::cerr << "unpack not supported - ClpDummyMatrix" << std::endl; abort(); } /* Unpacks a column into an CoinIndexedvector ** in packed foramt Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ void ClpDummyMatrix::unpackPacked(ClpSimplex * , CoinIndexedVector * , int ) const { std::cerr << "unpackPacked not supported - ClpDummyMatrix" << std::endl; abort(); } /* Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ void ClpDummyMatrix::add(const ClpSimplex * , CoinIndexedVector * , int , double ) const { std::cerr << "add not supported - ClpDummyMatrix" << std::endl; abort(); } /* Adds multiple of a column into an array */ void ClpDummyMatrix::add(const ClpSimplex * , double * , int , double ) const { std::cerr << "add not supported - ClpDummyMatrix" << std::endl; abort(); } // Return a complete CoinPackedMatrix CoinPackedMatrix * ClpDummyMatrix::getPackedMatrix() const { std::cerr << "getPackedMatrix not supported - ClpDummyMatrix" << std::endl; abort(); return NULL; } /* A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ const double * ClpDummyMatrix::getElements() const { std::cerr << "getElements not supported - ClpDummyMatrix" << std::endl; abort(); return NULL; } const CoinBigIndex * ClpDummyMatrix::getVectorStarts() const { std::cerr << "getVectorStarts not supported - ClpDummyMatrix" << std::endl; abort(); return NULL; } /* The lengths of the major-dimension vectors. */ const int * ClpDummyMatrix::getVectorLengths() const { std::cerr << "get VectorLengths not supported - ClpDummyMatrix" << std::endl; abort(); return NULL; } /* Delete the columns whose indices are listed in indDel. */ void ClpDummyMatrix::deleteCols(const int , const int * ) { std::cerr << "deleteCols not supported - ClpDummyMatrix" << std::endl; abort(); } /* Delete the rows whose indices are listed in indDel. */ void ClpDummyMatrix::deleteRows(const int , const int * ) { std::cerr << "deleteRows not supported - ClpDummyMatrix" << std::endl; abort(); } const int * ClpDummyMatrix::getIndices() const { std::cerr << "getIndices not supported - ClpDummyMatrix" << std::endl; abort(); return NULL; } CoinMP-1.8.3/Clp/src/config_clp_default.h0000644000175000017500000000110512600050735016574 0ustar renerene /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC PUBLIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Version number of project */ #define CLP_VERSION "1.16.8" /* Major Version number of project */ #define CLP_VERSION_MAJOR 1 /* Minor Version number of project */ #define CLP_VERSION_MINOR 16 /* Release Version number of project */ #define CLP_VERSION_RELEASE 8 CoinMP-1.8.3/Clp/src/CoinAbcBaseFactorization3.cpp0000644000175000017500000023761212101105055020237 0ustar renerene/* $Id: CoinAbcBaseFactorization3.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef ABC_JUST_ONE_FACTORIZATION #include "CoinAbcCommonFactorization.hpp" #define CoinAbcTypeFactorization CoinAbcBaseFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #endif #ifdef CoinAbcTypeFactorization #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #if CILK_CONFLICT>0 // for conflicts extern int cilk_conflict; #endif //:class CoinAbcTypeFactorization. Deals with Factorization and Updates /* Updates one column for dual steepest edge weights (FTRAN) */ void CoinAbcTypeFactorization::updateWeights ( CoinIndexedVector & regionSparse) const { toLongArray(®ionSparse,1); #ifdef ABC_ORDERED_FACTORIZATION // Permute in for Ftran permuteInForFtran(regionSparse); #endif // ******* L updateColumnL ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranCountInput_) #endif #if ABC_PARALLEL // can re-use 0 which would have been used for btran ,0 #endif ); //row bits here updateColumnR ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranCountInput_) #endif #if ABC_PARALLEL ,0 #endif ); //update counts // ******* U updateColumnU ( ®ionSparse #if ABC_SMALL<2 , reinterpret_cast(ftranCountInput_) #endif #if ABC_PARALLEL ,0 #endif ); #if ABC_DEBUG regionSparse.checkClean(); #endif } CoinSimplexInt CoinAbcTypeFactorization::updateColumn ( CoinIndexedVector & regionSparse) const { toLongArray(®ionSparse,0); #ifdef ABC_ORDERED_FACTORIZATION // Permute in for Ftran permuteInForFtran(regionSparse); #endif // ******* L updateColumnL ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranCountInput_) #endif ); //row bits here updateColumnR ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranCountInput_) #endif ); //update counts // ******* U updateColumnU ( ®ionSparse #if ABC_SMALL<2 , reinterpret_cast(ftranCountInput_) #endif ); #if ABC_DEBUG regionSparse.checkClean(); #endif return regionSparse.getNumElements(); } /* Updates one full column (FTRAN) */ void CoinAbcTypeFactorization::updateFullColumn ( CoinIndexedVector & regionSparse) const { #ifndef ABC_ORDERED_FACTORIZATION regionSparse.setNumElements(0); regionSparse.scan(0,numberRows_); #else permuteInForFtran(regionSparse,true); #endif if (regionSparse.getNumElements()) { toLongArray(®ionSparse,1); // ******* L updateColumnL ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranFullCountInput_) #endif #if ABC_PARALLEL ,1 #endif ); //row bits here updateColumnR ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranFullCountInput_) #endif #if ABC_PARALLEL ,1 #endif ); //update counts // ******* U updateColumnU ( ®ionSparse #if ABC_SMALL<2 , reinterpret_cast(ftranFullCountInput_) #endif #if ABC_PARALLEL ,1 #endif ); fromLongArray(1); #if ABC_DEBUG regionSparse.checkClean(); #endif } } // move stuff like this into CoinAbcHelperFunctions.hpp inline void multiplyIndexed(CoinSimplexInt number, const CoinFactorizationDouble * COIN_RESTRICT multiplier, const CoinSimplexInt * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { for (CoinSimplexInt i = 0; i < number; i ++ ) { CoinSimplexInt iRow = thisIndex[i]; CoinSimplexDouble value = region[iRow]; value *= multiplier[iRow]; region[iRow] = value; } } /* Updates one full column (BTRAN) */ void CoinAbcTypeFactorization::updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const { int numberNonZero=0; // Should pass in statistics toLongArray(®ionSparse,0); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse.getIndices(); #ifndef ABC_ORDERED_FACTORIZATION const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; for (int iRow=0;iRow (numberNonZero*btranFullAverageAfterU_*twiddleBtranFullFactor1()); if (newNumber< sparseThreshold_) goSparse = true; } #endif if (numberNonZero<40&&(numberNonZero<<4)(btranFullCountInput_) #endif #if ABC_PARALLEL ,0 #endif ); //row bits here updateColumnTransposeR ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(btranFullCountInput_) #endif ); // ******* L updateColumnTransposeL ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(btranFullCountInput_) #endif #if ABC_PARALLEL ,0 #endif ); fromLongArray(0); #if ABC_SMALL<3 #ifdef ABC_ORDERED_FACTORIZATION permuteOutForBtran(regionSparse); #endif #if ABC_DEBUG regionSparse.checkClean(); #endif #else numberNonZero=0; for (CoinSimplexInt i=0;i0 #if ABC_PARALLEL // for conflicts #if CILK_CONFLICT>1 printf("file %s line %d which %d\n",__FILE__,__LINE__,whichSparse); #endif abc_assert((cilk_conflict&(1<getNumElements ( ); if (factorizationStatistics()) { statistics.numberCounts_++; statistics.countInput_ += number; } #endif if (numberL_) { #if ABC_SMALL<2 int goSparse; // Guess at number at end if (gotSparse()) { double average = statistics.averageAfterL_*twiddleFactor1S(); assert (average); CoinSimplexInt newNumber = static_cast (number*average); if (newNumber< sparseThreshold_&&(numberL_<<2)>newNumber*1.0*twiddleFactor2S()) goSparse = 1; else if (3*newNumber < numberRows_) goSparse = 0; else goSparse = -1; } else { goSparse=0; } //if(goSparse==1) goSparse=0; if (!goSparse) { // densish updateColumnLDensish(regionSparse); } else if (goSparse<0) { // densish updateColumnLDense(regionSparse); } else { // sparse updateColumnLSparse(regionSparse #if ABC_PARALLEL ,whichSparse #endif ); } #else updateColumnLDensish(regionSparse); #endif } #if ABC_SMALL<4 #if ABC_DENSE_CODE>0 if (numberDense_) { instrument_do("CoinAbcFactorizationDense",0.3*numberDense_*numberDense_); //take off list CoinSimplexInt lastSparse = numberRows_-numberDense_; CoinFactorizationDouble * COIN_RESTRICT region = denseVector (regionSparse); CoinFactorizationDouble * COIN_RESTRICT denseArea = denseAreaAddress_; CoinFactorizationDouble * COIN_RESTRICT denseRegion = denseArea+leadingDimension_*numberDense_; CoinSimplexInt * COIN_RESTRICT densePermute= reinterpret_cast(denseRegion+FACTOR_CPU*numberDense_); //for (int i=0;i=0&&densePermute[i](densePermute+numberDense_)-lastSparse; short * COIN_RESTRICT forFtran2 = reinterpret_cast(densePermute+numberDense_)+2*numberDense_; #else const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_; #endif CoinSimplexInt number = regionSparse->getNumElements(); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices(); CoinSimplexInt i=0; while (i=lastSparse) { doDense=true; regionIndex[i] = regionIndex[--number]; densePut[jRow]=region[iRow]; #endif region[iRow]=0.0; } else { i++; } } #else CoinSimplexInt * COIN_RESTRICT forFtran = densePermute+numberDense_-lastSparse; const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_; for (CoinSimplexInt jRow=lastSparse;jRowsetNumElements(number); #endif } } //printRegion(*regionSparse,"After FtranL"); #endif #endif #if ABC_SMALL<2 if (factorizationStatistics()) statistics.countAfterL_ += regionSparse->getNumElements(); #endif #if CILK_CONFLICT>0 #if ABC_PARALLEL // for conflicts abc_assert((cilk_conflict&(1<=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #elif UNROLL==1 if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } #elif UNROLL==2 CoinSimplexInt iRow0; CoinSimplexInt iRow1; CoinFactorizationDouble regionValue0; CoinFactorizationDouble regionValue1; switch(static_cast(number)) { case 0: break; case 1: iRow0 = thisIndex[0]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; break; case 2: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; break; case 3: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; break; case 4: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; break; case 5: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; break; case 6: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; break; case 7: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; break; case 8: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; iRow1 = thisIndex[7]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; region[iRow1] = regionValue1 - thisElement[7] * pivotValue; break; default: if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } break; } #endif } inline CoinFactorizationDouble gatherUpdate(CoinSimplexInt number, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const CoinSimplexInt * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { CoinFactorizationDouble pivotValue=0.0; for (CoinBigIndex j = 0; j < number; j ++ ) { CoinFactorizationDouble value = thisElement[j]; CoinSimplexInt jRow = thisIndex[j]; value *= region[jRow]; pivotValue -= value; } return pivotValue; } // Updates part of column (FTRANL) when densish void CoinAbcTypeFactorization::updateColumnLDensish ( CoinIndexedVector * regionSparse) const { CoinSimplexInt * COIN_RESTRICT regionIndex=regionSparse->getIndices(); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt number = regionSparse->getNumElements ( ); #if ABC_SMALL<3 CoinSimplexInt numberNonZero = 0; #endif const CoinBigIndex * COIN_RESTRICT startColumn = startColumnLAddress_; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowLAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementLAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_; CoinSimplexInt last = numberRows_; assert ( last == baseL_ + numberL_); #if ABC_DENSE_CODE>0 //can take out last bit of sparse L as empty last -= numberDense_; #endif CoinSimplexInt smallestIndex = numberRowsExtra_; // do easy ones for (CoinSimplexInt k=0;k=baseL_) smallestIndex = CoinMin(jPivot,smallestIndex); else regionIndex[numberNonZero++]=iPivot; #else if (jPivot>=baseL_) smallestIndex = CoinMin(jPivot,smallestIndex); #endif } instrument_start("CoinAbcFactorizationUpdateLDensish",number+(last-smallestIndex)); // now others for (CoinSimplexInt k = smallestIndex; k < last; k++ ) { #if 0 for (int j=0;jsetNumElements ( numberNonZero ); #endif instrument_end(); } // Updates part of column (FTRANL) when dense void CoinAbcTypeFactorization::updateColumnLDense ( CoinIndexedVector * regionSparse) const { CoinSimplexInt * COIN_RESTRICT regionIndex=regionSparse->getIndices(); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt number = regionSparse->getNumElements ( ); #if ABC_SMALL<3 CoinSimplexInt numberNonZero = 0; #endif const CoinBigIndex * COIN_RESTRICT startColumn = startColumnLAddress_; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowLAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementLAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_; CoinSimplexInt last = numberRows_; assert ( last == baseL_ + numberL_); #if ABC_DENSE_CODE>0 //can take out last bit of sparse L as empty last -= numberDense_; #endif CoinSimplexInt smallestIndex = numberRowsExtra_; // do easy ones for (CoinSimplexInt k=0;k=baseL_) smallestIndex = CoinMin(jPivot,smallestIndex); else regionIndex[numberNonZero++]=iPivot; #else if (jPivot>=baseL_) smallestIndex = CoinMin(jPivot,smallestIndex); #endif } instrument_start("CoinAbcFactorizationUpdateLDensish",number+(last-smallestIndex)); // now others for (CoinSimplexInt k = smallestIndex; k < last; k++ ) { #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt i=pivotLOrder[k]; #else CoinSimplexInt i=k; #endif CoinExponent expValue=ABC_EXPONENT(region[i]); if (expValue) { if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) { CoinBigIndex start = startColumn[k]; CoinBigIndex end = startColumn[k + 1]; instrument_add(end-start); if (TEST_INT_NONZERO(end-start)) { CoinFactorizationDouble pivotValue = region[i]; #ifndef INLINE_IT for (CoinBigIndex j = start; j < end; j ++ ) { CoinSimplexInt iRow = indexRow[j]; CoinFactorizationDouble result = region[iRow]; CoinFactorizationDouble value = element[j]; region[iRow] = result - value * pivotValue; } #else CoinAbcScatterUpdate(end-start,pivotValue,element+start,indexRow+start,region); #endif } #if ABC_SMALL<3 regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; #endif } } } // and dense #if ABC_SMALL<3 for (CoinSimplexInt k = last; k < numberRows_; k++ ) { #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt i=pivotLOrder[k]; #else CoinSimplexInt i=k; #endif CoinExponent expValue=ABC_EXPONENT(region[i]); if (expValue) { if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) { regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } } regionSparse->setNumElements ( numberNonZero ); #endif instrument_end(); } #if ABC_SMALL<2 // Updates part of column (FTRANL) when sparse void CoinAbcTypeFactorization::updateColumnLSparse ( CoinIndexedVector * regionSparse #if ABC_PARALLEL ,int whichSparse #endif ) const { CoinSimplexInt * COIN_RESTRICT regionIndex=regionSparse->getIndices(); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt number = regionSparse->getNumElements ( ); CoinSimplexInt numberNonZero; numberNonZero = 0; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnLAddress_; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowLAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementLAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_; CoinSimplexInt nList; // use sparse_ as temporary area // need to redo if this fails (just means using CoinAbcStack to compute sizes) assert (sizeof(CoinSimplexInt)==sizeof(CoinBigIndex)); CoinAbcStack * COIN_RESTRICT stackList = reinterpret_cast(sparseAddress_); CoinSimplexInt * COIN_RESTRICT list = listAddress_; #define DO_CHAR1 1 #if DO_CHAR1 // CHAR CoinCheckZero * COIN_RESTRICT mark = markRowAddress_; #else //BIT CoinSimplexUnsignedInt * COIN_RESTRICT mark = reinterpret_cast (markRowAddress_); #endif #if ABC_PARALLEL //printf("PP %d %d %s\n",whichSparse,__LINE__,__FILE__); if (whichSparse) { //printf("alternative sparse\n"); int addAmount=whichSparse*sizeSparseArray_; stackList=reinterpret_cast(reinterpret_cast(stackList)+addAmount); list=reinterpret_cast(reinterpret_cast(list)+addAmount); #if DO_CHAR1 // CHAR mark=reinterpret_cast(reinterpret_cast(mark)+addAmount); #else mark=reinterpret_cast(reinterpret_cast(mark)+addAmount); #endif } #endif // mark known to be zero #ifdef COIN_DEBUG #if DO_CHAR1 // CHAR for (CoinSimplexInt i=0;i>COINFACTORIZATION_SHIFT_PER_INT;i++) { assert (!mark[i]); } #endif #endif nList=0; for (CoinSimplexInt k=0;k=baseL_) { #if DO_CHAR1 // CHAR CoinCheckZero mark_k = mark[kPivot]; #else CoinSimplexUnsignedInt wordK = kPivot >> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexUnsignedInt bitK = (kPivot & COINFACTORIZATION_MASK_PER_INT); CoinSimplexUnsignedInt mark_k=(mark[wordK]>>bitK)&1; #endif if(!mark_k) { CoinBigIndex j=startColumn[iPivot+1]-1; stackList[0].stack=kPivot; CoinBigIndex start=startColumn[iPivot]; stackList[0].next=j; stackList[0].start=start; CoinSimplexInt nStack=0; while (nStack>=0) { /* take off stack */ #ifndef ABC_ORDERED_FACTORIZATION iPivot=pivotLBackwardOrder[kPivot]; // put startColumn on stackstuff #else iPivot=kPivot; #endif #if 1 //0 // what went wrong?? CoinBigIndex startThis=startColumn[iPivot]; for (;j>=startThis;j--) { CoinSimplexInt jPivot=indexRow[j]; #if DO_CHAR1 // CHAR CoinCheckZero mark_j = mark[jPivot]; #else CoinSimplexUnsignedInt word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexUnsignedInt bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT); CoinSimplexUnsignedInt mark_j=(mark[word0]>>bit0)&1; #endif if (!mark_j) { #if DO_CHAR1 // CHAR mark[jPivot]=1; #else mark[word0]|=(1<=startThis) { /* put back on stack */ stackList[nStack].next =j-1; #ifndef ABC_ORDERED_FACTORIZATION iPivot=pivotLBackwardOrder[kPivot]; #else iPivot=kPivot; #endif j = startColumn[iPivot+1]-1; nStack++; stackList[nStack].stack=kPivot; assert (kPivot=startColumn[iPivot]/*stackList[nStack].start*/) { CoinSimplexInt jPivot=indexRow[j--]; /* put back on stack */ stackList[nStack].next =j; #if DO_CHAR1 // CHAR CoinCheckZero mark_j = mark[jPivot]; #else CoinSimplexUnsignedInt word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexUnsignedInt bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT); CoinSimplexUnsignedInt mark_j=(mark[word0]>>bit0)&1; #endif if (!mark_j) { /* and new one */ kPivot=jPivot; #ifndef ABC_ORDERED_FACTORIZATION iPivot=pivotLBackwardOrder[kPivot]; #else iPivot=kPivot; #endif j = startColumn[iPivot+1]-1; nStack++; stackList[nStack].stack=kPivot; assert (kPivot> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT); mark[wordB]|=(1<=0) { kPivot=stackList[nStack].stack; #ifndef ABC_ORDERED_FACTORIZATION iPivot=pivotLBackwardOrder[kPivot]; #else iPivot=kPivot; #endif assert (kPivot=0;i--) { CoinSimplexInt iPivot = list[i]; test[iPivot]=1; CoinSimplexInt kPivot=pivotLBackwardOrder[iPivot]; CoinBigIndex start=startColumn[kPivot]; CoinBigIndex end=startColumn[kPivot+1]; for (CoinBigIndex j = start;j < end; j ++ ) { CoinSimplexInt iRow = indexRow[j]; assert (test[iRow]<=0); } } delete [] test; #endif for (CoinSimplexInt i=nList-1;i>=0;i--) { CoinSimplexInt iPivot = list[i]; #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt kPivot=pivotLBackwardOrder[iPivot]; #else CoinSimplexInt kPivot=iPivot; #endif #if DO_CHAR1 // CHAR mark[iPivot]=0; #else CoinSimplexUnsignedInt word0 = iPivot >> COINFACTORIZATION_SHIFT_PER_INT; //CoinSimplexUnsignedInt bit0 = (iPivot & COINFACTORIZATION_MASK_PER_INT); //mark[word0]&=(~(1<setNumElements ( numberNonZero ); instrument_end_and_adjust(1.3); } #endif #if FACTORIZATION_STATISTICS extern double twoThresholdX; #endif CoinSimplexInt CoinAbcTypeFactorization::updateTwoColumnsFT ( CoinIndexedVector & regionFTX, CoinIndexedVector & regionOtherX) { CoinIndexedVector * regionFT = ®ionFTX; CoinIndexedVector * regionOther = ®ionOtherX; #if ABC_DEBUG regionFT->checkClean(); regionOther->checkClean(); #endif toLongArray(regionFT,0); toLongArray(regionOther,1); #ifdef ABC_ORDERED_FACTORIZATION // Permute in for Ftran permuteInForFtran(regionFTX); permuteInForFtran(regionOtherX); #endif CoinSimplexInt numberNonZero=regionOther->getNumElements(); CoinSimplexInt numberNonZeroFT=regionFT->getNumElements(); // ******* L updateColumnL ( regionFT #if ABC_SMALL<2 ,reinterpret_cast(ftranFTCountInput_) #endif ); updateColumnL ( regionOther #if ABC_SMALL<2 ,reinterpret_cast(ftranCountInput_) #endif ); //row bits here updateColumnR ( regionFT #if ABC_SMALL<2 ,reinterpret_cast(ftranFTCountInput_) #endif ); updateColumnR ( regionOther #if ABC_SMALL<2 ,reinterpret_cast(ftranCountInput_) #endif ); bool doFT=storeFT(regionFT); //update counts // ******* U - see if densish #if ABC_SMALL<2 // Guess at number at end CoinSimplexInt goSparse=0; if (gotSparse()) { CoinSimplexInt numberNonZero = (regionOther->getNumElements ( )+ regionFT->getNumElements())>>1; double average = 0.25*(ftranAverageAfterL_*twiddleFtranFactor1() + ftranFTAverageAfterL_*twiddleFtranFTFactor1()); assert (average); CoinSimplexInt newNumber = static_cast (numberNonZero*average); if (newNumber< sparseThreshold_) goSparse = 2; } #if FACTORIZATION_STATISTICS int twoThreshold=twoThresholdX; #else #define twoThreshold 1000 #endif #else #define goSparse false #define twoThreshold 1000 #endif if (!goSparse&&numberRows_getIndices(); CoinFactorizationDouble * COIN_RESTRICT arrayUpdate = denseVector (regionOther); CoinSimplexInt * COIN_RESTRICT indexUpdate = regionOther->getIndices(); updateTwoColumnsUDensish(numberNonZeroFT,arrayFT,indexFT, numberNonZero,arrayUpdate,indexUpdate); regionFT->setNumElements ( numberNonZeroFT ); regionOther->setNumElements ( numberNonZero ); } else { // sparse updateColumnU ( regionFT #if ABC_SMALL<2 , reinterpret_cast(ftranFTCountInput_) #endif ); numberNonZeroFT=regionFT->getNumElements(); updateColumnU ( regionOther #if ABC_SMALL<2 , reinterpret_cast(ftranCountInput_) #endif ); numberNonZero=regionOther->getNumElements(); } fromLongArray(0); fromLongArray(1); #if ABC_DEBUG regionFT->checkClean(); regionOther->checkClean(); #endif if ( doFT ) return numberNonZeroFT; else return -numberNonZeroFT; } // Updates part of 2 columns (FTRANU) real work void CoinAbcTypeFactorization::updateTwoColumnsUDensish ( CoinSimplexInt & numberNonZero1, CoinFactorizationDouble * COIN_RESTRICT region1, CoinSimplexInt * COIN_RESTRICT index1, CoinSimplexInt & numberNonZero2, CoinFactorizationDouble * COIN_RESTRICT region2, CoinSimplexInt * COIN_RESTRICT index2) const { #ifdef ABC_USE_FUNCTION_POINTERS scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn(); CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; #else const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; #endif CoinSimplexInt numberNonZeroA = 0; CoinSimplexInt numberNonZeroB = 0; const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_; CoinSimplexInt jRow=pivotLinked[numberRows_]; instrument_start("CoinAbcFactorizationUpdateTwoUDense",2*numberRows_); #if 1 //def DONT_USE_SLACKS while (jRow!=-1/*lastSlack_*/) { #else // would need extra code while (jRow!=lastSlack_) { #endif bool nonZero2 = (TEST_DOUBLE_NONZERO(region2[jRow])); bool nonZero1 = (TEST_DOUBLE_NONZERO(region1[jRow])); #ifndef ABC_USE_FUNCTION_POINTERS int numberIn=numberInColumn[jRow]; #else scatterStruct & COIN_RESTRICT scatter = scatterPointer[jRow]; CoinSimplexInt numberIn = scatter.number; #endif if (nonZero1||nonZero2) { #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex start = startColumn[jRow]; const CoinFactorizationDouble * COIN_RESTRICT thisElement = element+start; const CoinSimplexInt * COIN_RESTRICT thisIndex = indexRow+start; #else const CoinFactorizationDouble * COIN_RESTRICT thisElement = elementUColumnPlus+scatter.offset; const CoinSimplexInt * COIN_RESTRICT thisIndex = reinterpret_cast(thisElement+numberIn); #endif CoinFactorizationDouble pivotValue2 = region2[jRow]; CoinFactorizationDouble pivotMult = pivotRegion[jRow]; assert (pivotMult); CoinFactorizationDouble pivotValue2a = pivotValue2 * pivotMult; bool do2 = !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2 ); region2[jRow] = 0.0; CoinFactorizationDouble pivotValue1 = region1[jRow]; region1[jRow] = 0.0; CoinFactorizationDouble pivotValue1a = pivotValue1 * pivotMult; bool do1 = !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue1 ); if (do2) { if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2a ) ) { region2[jRow]=pivotValue2a; index2[numberNonZeroB++]=jRow; } } if (do1) { if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue1a ) ) { region1[jRow]=pivotValue1a; index1[numberNonZeroA++]=jRow; } } instrument_add(numberIn); if (numberIn) { if (do2) { if (!do1) { // just region 2 for (CoinBigIndex j=numberIn-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble value = thisElement[j]; assert (value); #ifdef NO_LOAD region2[iRow] -= value * pivotValue2; #else CoinFactorizationDouble regionValue2 = region2[iRow]; region2[iRow] = regionValue2 - value * pivotValue2; #endif } } else { // both instrument_add(numberIn); for (CoinBigIndex j=numberIn-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble value = thisElement[j]; #ifdef NO_LOAD region1[iRow] -= value * pivotValue1; region2[iRow] -= value * pivotValue2; #else CoinFactorizationDouble regionValue1 = region1[iRow]; CoinFactorizationDouble regionValue2 = region2[iRow]; region1[iRow] = regionValue1 - value * pivotValue1; region2[iRow] = regionValue2 - value * pivotValue2; #endif } } } else if (do1 ) { // just region 1 for (CoinBigIndex j=numberIn-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble value = thisElement[j]; assert (value); #ifdef NO_LOAD region1[iRow] -= value * pivotValue1; #else CoinFactorizationDouble regionValue1 = region1[iRow]; region1[iRow] = regionValue1 - value * pivotValue1; #endif } } } else { // no elements in column } } jRow=pivotLinked[jRow]; } numberNonZero1=numberNonZeroA; numberNonZero2=numberNonZeroB; #if ABC_SMALL<2 if (factorizationStatistics()) { ftranFTCountAfterU_ += numberNonZeroA; ftranCountAfterU_ += numberNonZeroB; } #endif instrument_end(); } // updateColumnU. Updates part of column (FTRANU) void CoinAbcTypeFactorization::updateColumnU ( CoinIndexedVector * regionSparse #if ABC_SMALL<2 ,CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichSparse #endif ) const { #if CILK_CONFLICT>0 #if ABC_PARALLEL // for conflicts #if CILK_CONFLICT>1 printf("file %s line %d which %d\n",__FILE__,__LINE__,whichSparse); #endif abc_assert((cilk_conflict&(1<getNumElements ( ); int goSparse; // Guess at number at end if (gotSparse()) { double average = statistics.averageAfterU_*twiddleFactor1S(); assert (average); CoinSimplexInt newNumber = static_cast (numberNonZero*average); if (newNumber< sparseThreshold_) goSparse = 1; else if (numberNonZero*3getNumElements ( ); } #endif #if CILK_CONFLICT>0 #if ABC_PARALLEL // for conflicts abc_assert((cilk_conflict&(1<getIndices(); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt numberNonZero = 0; const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; #ifdef ABC_USE_FUNCTION_POINTERS scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn(); CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; #else const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; #endif const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_; CoinSimplexInt jRow=pivotLinked[numberRows_]; #define ETAS_1 2 #define TEST_BEFORE #ifdef TEST_BEFORE CoinExponent expValue=ABC_EXPONENT(region[jRow]); #endif #ifdef DONT_USE_SLACKS while (jRow!=-1/*lastSlack_*/) { #else while (jRow!=lastSlack_) { #endif #ifndef TEST_BEFORE CoinExponent expValue=ABC_EXPONENT(region[jRow]); #endif if (expValue) { if (!TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(expValue)) { CoinFactorizationDouble pivotValue = region[jRow]; #if ETAS_1>1 CoinFactorizationDouble pivotValue2 = pivotValue*pivotRegion[jRow]; #endif #ifndef ABC_USE_FUNCTION_POINTERS int number=numberInColumn[jRow]; #else scatterStruct & COIN_RESTRICT scatter = scatterPointer[jRow]; CoinSimplexInt number = scatter.number; #endif instrument_add(number); if (TEST_INT_NONZERO(number)) { #ifdef COUNT_U { int k=numberInColumn[jRow]; if (k>10) k=11; nUDense[k]++; int kk=0; for (int k=0;k<12;k++) kk+=nUDense[k]; if (kk%1000000==0) { printf("ZZ"); for (int k=0;k<12;k++) printf(" %d",nUDense[k]); printf("\n"); } } #endif #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex start = startColumn[jRow]; #ifndef INLINE_IT const CoinFactorizationDouble * COIN_RESTRICT thisElement = element+start; const CoinSimplexInt * COIN_RESTRICT thisIndex = indexRow+start; for (CoinBigIndex j=number-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #else CoinAbcScatterUpdate(number,pivotValue,element+start,indexRow+start,region); #endif #else CoinBigIndex start = scatter.offset; #if ABC_USE_FUNCTION_POINTERS (*(scatter.functionPointer))(number,pivotValue,elementUColumnPlus+start,region); #else CoinAbcScatterUpdate(number,pivotValue,elementUColumnPlus+start,region); #endif #endif } CoinSimplexInt kRow=jRow; jRow=pivotLinked[jRow]; #ifdef TEST_BEFORE expValue=ABC_EXPONENT(region[jRow]); #endif #if ETAS_1<2 pivotValue *= pivotRegion[kRow]; if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) { region[kRow]=pivotValue; regionIndex[numberNonZero++]=kRow; } else { region[kRow]=0.0; } #else if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2 ) ) { region[kRow]=pivotValue2; regionIndex[numberNonZero++]=kRow; } else { region[kRow]=0.0; } #endif } else { CoinSimplexInt kRow=jRow; jRow=pivotLinked[jRow]; #ifdef TEST_BEFORE expValue=ABC_EXPONENT(region[jRow]); #endif region[kRow]=0.0; } } else { jRow=pivotLinked[jRow]; #ifdef TEST_BEFORE expValue=ABC_EXPONENT(region[jRow]); #endif } } #ifndef DONT_USE_SLACKS while (jRow!=-1) { #ifndef TEST_BEFORE CoinExponent expValue=ABC_EXPONENT(region[jRow]); #endif if (expValue) { if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) { #if SLACK_VALUE==-1 CoinFactorizationDouble pivotValue = region[jRow]; assert (pivotRegion[jRow]==SLACK_VALUE); region[jRow]=-pivotValue; #endif regionIndex[numberNonZero++]=jRow; } else { region[jRow] = 0.0; } } jRow=pivotLinked[jRow]; #ifdef TEST_BEFORE expValue=ABC_EXPONENT(region[jRow]); #endif } #endif regionSparse->setNumElements ( numberNonZero ); instrument_end(); } // updateColumnU. Updates part of column (FTRANU) // Updates part of column (FTRANU) real work void CoinAbcTypeFactorization::updateColumnUDense ( CoinIndexedVector * regionSparse ) const { instrument_start("CoinAbcFactorizationUpdateUDensish",2*numberRows_); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices(); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinSimplexInt numberNonZero = 0; const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; #ifdef ABC_USE_FUNCTION_POINTERS scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn(); CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; #else const CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; #endif const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_; CoinSimplexInt jRow=pivotLinked[numberRows_]; #define ETAS_1 2 #define TEST_BEFORE #ifdef TEST_BEFORE CoinExponent expValue=ABC_EXPONENT(region[jRow]); #endif //int ixxxxxx=0; #ifdef DONT_USE_SLACKS while (jRow!=-1/*lastSlack_*/) { #else while (jRow!=lastSlack_) { #endif #if 0 double largest=1.0; int iLargest=-1; ixxxxxx++; for (int i=0;ilargest) { largest=fabs(region[i]); iLargest=i; } } if (iLargest>=0) printf("largest %g on row %d after %d\n",largest,iLargest,ixxxxxx); #endif #ifndef TEST_BEFORE CoinExponent expValue=ABC_EXPONENT(region[jRow]); #endif if (expValue) { if (!TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(expValue)) { CoinFactorizationDouble pivotValue = region[jRow]; #if ETAS_1>1 CoinFactorizationDouble pivotValue2 = pivotValue*pivotRegion[jRow]; #endif #ifndef ABC_USE_FUNCTION_POINTERS int number=numberInColumn[jRow]; #else scatterStruct & COIN_RESTRICT scatter = scatterPointer[jRow]; CoinSimplexInt number = scatter.number; #endif instrument_add(number); if (TEST_INT_NONZERO(number)) { #ifdef COUNT_U { int k=numberInColumn[jRow]; if (k>10) k=11; nUDense[k]++; int kk=0; for (int k=0;k<12;k++) kk+=nUDense[k]; if (kk%1000000==0) { printf("ZZ"); for (int k=0;k<12;k++) printf(" %d",nUDense[k]); printf("\n"); } } #endif #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex start = startColumn[jRow]; #ifndef INLINE_IT const CoinFactorizationDouble * COIN_RESTRICT thisElement = element+start; const CoinSimplexInt * COIN_RESTRICT thisIndex = indexRow+start; for (CoinBigIndex j=number-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #else CoinAbcScatterUpdate(number,pivotValue,element+start,indexRow+start,region); #endif #else CoinBigIndex start = scatter.offset; #if ABC_USE_FUNCTION_POINTERS (*(scatter.functionPointer))(number,pivotValue,elementUColumnPlus+start,region); #else CoinAbcScatterUpdate(number,pivotValue,elementUColumnPlus+start,region); #endif #endif } CoinSimplexInt kRow=jRow; jRow=pivotLinked[jRow]; #ifdef TEST_BEFORE expValue=ABC_EXPONENT(region[jRow]); #endif #if ETAS_1<2 pivotValue *= pivotRegion[kRow]; if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) { region[kRow]=pivotValue; regionIndex[numberNonZero++]=kRow; } else { region[kRow]=0.0; } #else if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2 ) ) { region[kRow]=pivotValue2; regionIndex[numberNonZero++]=kRow; } else { region[kRow]=0.0; } #endif } else { CoinSimplexInt kRow=jRow; jRow=pivotLinked[jRow]; #ifdef TEST_BEFORE expValue=ABC_EXPONENT(region[jRow]); #endif region[kRow]=0.0; } } else { jRow=pivotLinked[jRow]; #ifdef TEST_BEFORE expValue=ABC_EXPONENT(region[jRow]); #endif } } #ifndef DONT_USE_SLACKS while (jRow!=-1) { #ifndef TEST_BEFORE CoinExponent expValue=ABC_EXPONENT(region[jRow]); #endif if (expValue) { if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) { #if SLACK_VALUE==-1 CoinFactorizationDouble pivotValue = region[jRow]; assert (pivotRegion[jRow]==SLACK_VALUE); region[jRow]=-pivotValue; #endif regionIndex[numberNonZero++]=jRow; } else { region[jRow] = 0.0; } } jRow=pivotLinked[jRow]; #ifdef TEST_BEFORE expValue=ABC_EXPONENT(region[jRow]); #endif } #endif regionSparse->setNumElements ( numberNonZero ); instrument_end(); } #if ABC_SMALL<2 // updateColumnU. Updates part of column (FTRANU) /* Since everything is in order I should be able to do a better job of marking stuff - think. Also as L is static maybe I can do something better there (I know I could if I marked the depth of every element but that would lead to other inefficiencies. */ void CoinAbcTypeFactorization::updateColumnUSparse ( CoinIndexedVector * regionSparse #if ABC_PARALLEL ,int whichSparse #endif ) const { CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices(); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt numberNonZero = regionSparse->getNumElements ( ); //const CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_; //const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; //const CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; // use sparse_ as temporary area // mark known to be zero #define COINFACTORIZATION_SHIFT_PER_INT2 (COINFACTORIZATION_SHIFT_PER_INT-1) #define COINFACTORIZATION_MASK_PER_INT2 (COINFACTORIZATION_MASK_PER_INT>>1) // need to redo if this fails (just means using CoinAbcStack to compute sizes) assert (sizeof(CoinSimplexInt)==sizeof(CoinBigIndex)); CoinAbcStack * COIN_RESTRICT stackList = reinterpret_cast(sparseAddress_); CoinSimplexInt * COIN_RESTRICT list = listAddress_; #ifndef ABC_USE_FUNCTION_POINTERS const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; #else scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn(); const CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; const CoinSimplexInt * COIN_RESTRICT indexRow = reinterpret_cast(elementUColumnPlusAddress_); #endif //#define DO_CHAR2 1 #if DO_CHAR2 // CHAR CoinCheckZero * COIN_RESTRICT mark = markRowAddress_; #else //BIT CoinSimplexUnsignedInt * COIN_RESTRICT mark = reinterpret_cast (markRowAddress_); #endif #if ABC_PARALLEL //printf("PP %d %d %s\n",whichSparse,__LINE__,__FILE__); if (whichSparse) { int addAmount=whichSparse*sizeSparseArray_; stackList=reinterpret_cast(reinterpret_cast(stackList)+addAmount); list=reinterpret_cast(reinterpret_cast(list)+addAmount); #if DO_CHAR2 // CHAR mark=reinterpret_cast(reinterpret_cast(mark)+addAmount); #else mark=reinterpret_cast(reinterpret_cast(mark)+addAmount); #endif } #endif #ifdef COIN_DEBUG #if DO_CHAR2 // CHAR for (CoinSimplexInt i=0;i>COINFACTORIZATION_SHIFT_PER_INT;i++) { assert (!mark[i]); } #endif #endif CoinSimplexInt nList = 0; // move slacks to end of stack list int * COIN_RESTRICT putLast = list+numberRows_; int * COIN_RESTRICT put = putLast; for (CoinSimplexInt i=0;i> COINFACTORIZATION_SHIFT_PER_INT2; CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT2)<<1; CoinSimplexUnsignedInt mark_B=(mark[wordB]>>bitB)&3; #endif if (!mark_B) { #if DO_CHAR2 // CHAR mark[kPivot]=1; #else mark[wordB]|=(1<=0) { /* take off stack */ CoinBigIndex j=stackList[nStack].next-1; CoinBigIndex start=stackList[nStack].start; #if DO_CHAR2==0 // CHAR CoinSimplexUnsignedInt word0; CoinSimplexUnsignedInt bit0; #endif CoinSimplexInt jPivot; for (;j>=start;j--) { jPivot=indexRow[j]; #if DO_CHAR2 // CHAR CoinCheckZero mark_j = mark[jPivot]; #else word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT2; bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT2)<<1; CoinSimplexUnsignedInt mark_j=(mark[word0]>>bit0)&3; #endif if (!mark_j) break; } if (j>=start) { /* put back on stack */ stackList[nStack].next =j; /* and new one */ #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex start=startColumn[jPivot]; CoinSimplexInt number=numberInColumn[jPivot]; #else scatterStruct & COIN_RESTRICT scatter = scatterPointer[jPivot]; CoinSimplexInt number = scatter.number; CoinBigIndex start = (scatter.offset+number)<<1; #endif if (number) { nStack++; stackList[nStack].stack=jPivot; stackList[nStack].next=start+number; stackList[nStack].start=start; #if DO_CHAR2 // CHAR mark[jPivot]=1; #else mark[word0]|=(1<>bit0)&3; #endif assert (mark_j!=3); #endif #if ABC_SMALL<2 if (!start) { // slack - put at end --put; *put=jPivot; assert(pivotRegion[jPivot]==1.0); } else { list[nList++]=jPivot; } #else list[nList++]=jPivot; #endif #if DO_CHAR2 // CHAR mark[jPivot]=3; #else mark[word0]|=(3<> COINFACTORIZATION_SHIFT_PER_INT2; CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT2)<<1; CoinSimplexUnsignedInt mark_B=(mark[wordB]>>bitB)&3; #endif assert (mark_B!=3); //if (mark_B!=3) { list[nList++]=kPivot; #if DO_CHAR2 // CHAR mark[kPivot]=3; #else mark[wordB]|=(3<=0;i--) { CoinSimplexInt iPivot = list[i]; CoinExponent expValue=ABC_EXPONENT(region[iPivot]); #if DO_CHAR2 // CHAR mark[iPivot]=0; #else CoinSimplexInt word0 = iPivot >> COINFACTORIZATION_SHIFT_PER_INT2; mark[word0]=0; #endif if (expValue) { if (!TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(expValue)) { CoinFactorizationDouble pivotValue = region[iPivot]; #if ETAS_1>1 CoinFactorizationDouble pivotValue2 = pivotValue*pivotRegion[iPivot]; #endif #ifndef ABC_USE_FUNCTION_POINTERS CoinSimplexInt number = numberInColumn[iPivot]; #else scatterStruct & COIN_RESTRICT scatter = scatterPointer[iPivot]; CoinSimplexInt number = scatter.number; #endif if (TEST_INT_NONZERO(number)) { #ifdef COUNT_U { int k=numberInColumn[iPivot]; if (k>10) k=11; nUSparse[k]++; int kk=0; for (int k=0;k<12;k++) kk+=nUSparse[k]; if (kk%1000000==0) { printf("ZZsparse"); for (int k=0;k<12;k++) printf(" %d",nUSparse[k]); printf("\n"); } } #endif #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex start = startColumn[iPivot]; #else //CoinBigIndex start = startColumn[iPivot]; CoinBigIndex start = scatter.offset; #endif instrument_add(number); #ifndef INLINE_IT CoinBigIndex j; for ( j = start; j < start+number; j++ ) { CoinFactorizationDouble value = element[j]; assert (value); CoinSimplexInt iRow = indexRow[j]; region[iRow] -= value * pivotValue; } #else #ifdef ABC_USE_FUNCTION_POINTERS #if ABC_USE_FUNCTION_POINTERS (*(scatter.functionPointer))(number,pivotValue,elementUColumnPlus+start,region); #else CoinAbcScatterUpdate(number,pivotValue,elementUColumnPlus+start,region); #endif #else CoinAbcScatterUpdate(number,pivotValue,element+start,indexRow+start,region); #endif #endif } #if ETAS_1<2 pivotValue *= pivotRegion[iPivot]; if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) { region[iPivot]=pivotValue; regionIndex[numberNonZero++]=iPivot; } #else if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2 ) ) { region[iPivot]=pivotValue2; regionIndex[numberNonZero++]=iPivot; } else { region[iPivot]=0.0; } #endif } else { region[iPivot]=0.0; } } } #if ABC_SMALL<2 // slacks for (;put> COINFACTORIZATION_SHIFT_PER_INT2; mark[word0]=0; #endif if (expValue) { if (!TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(expValue)) { CoinFactorizationDouble pivotValue = region[iPivot]; if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) { region[iPivot]=pivotValue; regionIndex[numberNonZero++]=iPivot; } } else { region[iPivot]=0.0; } } } #endif #ifdef COIN_DEBUG for (CoinSimplexInt i=0;i>COINFACTORIZATION_SHIFT_PER_INT2;i++) { assert (!mark[i]); } #endif regionSparse->setNumElements ( numberNonZero ); instrument_end_and_adjust(1.3); } #endif // Store update after doing L and R - retuns false if no room bool CoinAbcTypeFactorization::storeFT( #if ABC_SMALL<3 const #endif CoinIndexedVector * updateFT) { #if ABC_SMALL<3 CoinSimplexInt numberNonZero = updateFT->getNumElements ( ); #else CoinSimplexInt numberNonZero = numberRows_; #endif #ifndef ABC_USE_FUNCTION_POINTERS if (lengthAreaU_>=lastEntryByColumnU_+numberNonZero) { #else if (lengthAreaUPlus_>=lastEntryByColumnUPlus_+(3*numberNonZero+1)/2) { scatterStruct & scatter = scatterUColumn()[numberRows_]; CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; #endif #if ABC_SMALL<3 const CoinFactorizationDouble * COIN_RESTRICT region = denseVector(updateFT); const CoinSimplexInt * COIN_RESTRICT regionIndex = updateFT->getIndices(); #else CoinSimplexDouble * COIN_RESTRICT region = updateFT->denseVector ( ); #endif #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; //we are going to save at end of U startColumnU[numberRows_] = lastEntryByColumnU_; CoinSimplexInt * COIN_RESTRICT putIndex = indexRowUAddress_ + lastEntryByColumnU_; CoinFactorizationDouble * COIN_RESTRICT putElement = elementUAddress_ + lastEntryByColumnU_; #else scatter.offset=lastEntryByColumnUPlus_; CoinFactorizationDouble * COIN_RESTRICT putElement = elementUColumnPlus + lastEntryByColumnUPlus_; CoinSimplexInt * COIN_RESTRICT putIndex = reinterpret_cast(putElement+numberNonZero); #endif #if ABC_SMALL<3 for (CoinSimplexInt i=0;igetNumElements(); toLongArray(regionSparse,0); #ifdef ABC_ORDERED_FACTORIZATION // Permute in for Ftran permuteInForFtran(regionSparseX); #endif // ******* L //printf("a\n"); //regionSparse->checkClean(); updateColumnL ( regionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranFTCountInput_) #endif ); //printf("b\n"); //regionSparse->checkClean(); //row bits here updateColumnR ( regionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranFTCountInput_) #endif ); //printf("c\n"); //regionSparse->checkClean(); bool doFT=storeFT(regionSparse); //printf("d\n"); //regionSparse->checkClean(); //update counts // ******* U updateColumnU ( regionSparse #if ABC_SMALL<2 , reinterpret_cast(ftranFTCountInput_) #endif ); //printf("e\n"); #if ABC_DEBUG regionSparse->checkClean(); #endif numberNonZero=regionSparse->getNumElements(); // will be negative if no room if ( doFT ) return numberNonZero; else return -numberNonZero; } void CoinAbcTypeFactorization::updateColumnFT ( CoinIndexedVector & regionSparseX, CoinIndexedVector & partialUpdate, int whichSparse) { CoinIndexedVector * regionSparse = ®ionSparseX; CoinSimplexInt numberNonZero=regionSparse->getNumElements(); toLongArray(regionSparse,whichSparse); #ifdef ABC_ORDERED_FACTORIZATION // Permute in for Ftran permuteInForFtran(regionSparseX); #endif // ******* L //printf("a\n"); //regionSparse->checkClean(); updateColumnL ( regionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranFTCountInput_) #endif #if ABC_PARALLEL ,whichSparse #endif ); //printf("b\n"); //regionSparse->checkClean(); //row bits here updateColumnR ( regionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranFTCountInput_) #endif #if ABC_PARALLEL ,whichSparse #endif ); numberNonZero = regionSparse->getNumElements ( ); CoinSimplexInt * COIN_RESTRICT indexSave=partialUpdate.getIndices(); CoinSimplexDouble * COIN_RESTRICT regionSave=partialUpdate.denseVector(); partialUpdate.setNumElements(numberNonZero); memcpy(indexSave,regionSparse->getIndices(),numberNonZero*sizeof(CoinSimplexInt)); partialUpdate.setPackedMode(false); CoinFactorizationDouble * COIN_RESTRICT region=denseVector(regionSparse); for (int i=0;i(ftranFTCountInput_) #endif #if ABC_PARALLEL ,whichSparse #endif ); //printf("e\n"); #if ABC_DEBUG regionSparse->checkClean(); #endif } int CoinAbcTypeFactorization::updateColumnFTPart1 ( CoinIndexedVector & regionSparse) { toLongArray(®ionSparse,0); #ifdef ABC_ORDERED_FACTORIZATION // Permute in for Ftran permuteInForFtran(regionSparse); #endif //CoinSimplexInt numberNonZero=regionSparse.getNumElements(); // ******* L //regionSparse.checkClean(); updateColumnL ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranFTCountInput_) #endif #if ABC_PARALLEL ,2 #endif ); //regionSparse.checkClean(); //row bits here updateColumnR ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranFTCountInput_) #endif #if ABC_PARALLEL ,2 #endif ); //regionSparse.checkClean(); bool doFT=storeFT(®ionSparse); // will be negative if no room if ( doFT ) return 1; else return -1; } void CoinAbcTypeFactorization::updateColumnFTPart2 ( CoinIndexedVector & regionSparse) { toLongArray(®ionSparse,0); //CoinSimplexInt numberNonZero=regionSparse.getNumElements(); // ******* U updateColumnU ( ®ionSparse #if ABC_SMALL<2 , reinterpret_cast(ftranFTCountInput_) #endif #if ABC_PARALLEL ,2 #endif ); #if ABC_DEBUG regionSparse.checkClean(); #endif } /* Updates one column (FTRAN) */ void CoinAbcTypeFactorization::updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const { toLongArray(®ionSparse,whichCpu); #ifdef ABC_ORDERED_FACTORIZATION // Permute in for Ftran permuteInForFtran(regionSparse); #endif // ******* L updateColumnL ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranCountInput_) #endif #if ABC_PARALLEL ,whichCpu #endif ); //row bits here updateColumnR ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(ftranCountInput_) #endif #if ABC_PARALLEL ,whichCpu #endif ); //update counts // ******* U updateColumnU ( ®ionSparse #if ABC_SMALL<2 , reinterpret_cast(ftranCountInput_) #endif #if ABC_PARALLEL ,whichCpu #endif ); fromLongArray(whichCpu); #if ABC_DEBUG regionSparse.checkClean(); #endif } /* Updates one column (BTRAN) */ void CoinAbcTypeFactorization::updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const { toLongArray(®ionSparse,whichCpu); CoinSimplexDouble * COIN_RESTRICT region = regionSparse.denseVector(); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse.getIndices(); CoinSimplexInt numberNonZero = regionSparse.getNumElements(); //#if COIN_BIG_DOUBLE==1 //const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegion_.array()+1; //#else const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; //#endif #ifndef ABC_ORDERED_FACTORIZATION // can I move this #ifndef INLINE_IT3 for (CoinSimplexInt i = 0; i < numberNonZero; i ++ ) { CoinSimplexInt iRow = regionIndex[i]; CoinSimplexDouble value = region[iRow]; value *= pivotRegion[iRow]; region[iRow] = value; } #else multiplyIndexed(numberNonZero,pivotRegion, regionIndex,region); #endif #else // Permute in for Btran permuteInForBtranAndMultiply(regionSparse); #endif // ******* U // Apply pivot region - could be combined for speed // Can only combine/move inside vector for sparse CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1]; #if ABC_SMALL<2 // copy of code inside transposeU bool goSparse=false; #else #define goSparse false #endif #if ABC_SMALL<2 // Guess at number at end if (gotUCopy()) { assert (btranAverageAfterU_); CoinSimplexInt newNumber = static_cast (numberNonZero*btranAverageAfterU_*twiddleBtranFactor1()); if (newNumber< sparseThreshold_) goSparse = true; } #endif if (numberNonZero<40&&(numberNonZero<<4)(btranCountInput_) #endif #if ABC_PARALLEL ,whichCpu #endif ); //row bits here updateColumnTransposeR ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif ); // ******* L updateColumnTransposeL ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif #if ABC_PARALLEL , whichCpu #endif ); #if ABC_SMALL<3 #ifdef ABC_ORDERED_FACTORIZATION // Permute out for Btran permuteOutForBtran(regionSparse); #endif #if ABC_DEBUG regionSparse.checkClean(); #endif numberNonZero = regionSparse.getNumElements ( ); #else numberNonZero=0; for (CoinSimplexInt i=0;i2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; CoinBigIndex space = lengthAreaU_ - lastEntryByRowU_; CoinSimplexInt * COIN_RESTRICT nextRow = nextRowAddress_; CoinSimplexInt * COIN_RESTRICT lastRow = lastRowAddress_; if ( space < extraNeeded + number + 2 ) { //compression CoinSimplexInt iRow = nextRow[numberRows_]; CoinBigIndex put = 0; while ( iRow != numberRows_ ) { //move CoinBigIndex get = startRow[iRow]; CoinBigIndex getEnd = startRow[iRow] + numberInRow[iRow]; startRow[iRow] = put; CoinBigIndex i; for ( i = get; i < getEnd; i++ ) { indexColumnU[put] = indexColumnU[i]; #if CONVERTROW convertRowToColumn[put] = convertRowToColumn[i]; #if CONVERTROW>2 convertColumnToRow[i] = convertColumnToRow[put]; #endif #endif elementRowU[put] = elementRowU[i]; put++; } iRow = nextRow[iRow]; } /* endwhile */ numberCompressions_++; lastEntryByRowU_ = put; space = lengthAreaU_ - put; if ( space < extraNeeded + number + 2 ) { //need more space //if we can allocate bigger then do so and copy //if not then return so code can start again status_ = -99; return false; } } CoinBigIndex put = lastEntryByRowU_; CoinSimplexInt next = nextRow[iRow]; CoinSimplexInt last = lastRow[iRow]; //out nextRow[last] = next; lastRow[next] = last; //in at end last = lastRow[numberRows_]; nextRow[last] = iRow; lastRow[numberRows_] = iRow; lastRow[iRow] = last; nextRow[iRow] = numberRows_; //move CoinBigIndex get = startRow[iRow]; startRow[iRow] = put; while ( number ) { number--; indexColumnU[put] = indexColumnU[get]; #if CONVERTROW convertRowToColumn[put] = convertRowToColumn[get]; #if CONVERTROW>2 convertColumnToRow[get] = convertColumnToRow[put]; #endif #endif elementRowU[put] = elementRowU[get]; put++; get++; } /* endwhile */ //add four for luck lastEntryByRowU_ = put + extraNeeded + 4; return true; } #endif void CoinAbcTypeFactorization::printRegion(const CoinIndexedVector & vector,const char * where) const { //return; CoinSimplexInt numberNonZero = vector.getNumElements ( ); //CoinSimplexInt * COIN_RESTRICT regionIndex = vector.getIndices ( ); const CoinSimplexDouble * COIN_RESTRICT region = vector.denseVector ( ); int n=0; for (int i=0;igetIndices ( ); CoinSimplexInt numberNonZero = regionFrom->getNumElements(); CoinSimplexInt * COIN_RESTRICT index = regionFrom->getIndices(); CoinSimplexDouble * COIN_RESTRICT region = regionTo->denseVector(); CoinSimplexDouble * COIN_RESTRICT array = regionFrom->denseVector(); for (CoinSimplexInt j = 0; j < numberNonZero; j ++ ) { CoinSimplexInt iRow = index[j]; CoinSimplexDouble value = array[j]; array[j]=0.0; region[iRow] = value; regionIndex[j] = iRow; } regionTo->setNumElements(numberNonZero); } void CoinAbcTypeFactorization::pack ( CoinIndexedVector * regionFrom, CoinIndexedVector * regionTo) const { // move CoinSimplexInt * COIN_RESTRICT regionIndex = regionFrom->getIndices ( ); CoinSimplexInt numberNonZero = regionFrom->getNumElements(); CoinSimplexInt * COIN_RESTRICT index = regionTo->getIndices(); CoinSimplexDouble * COIN_RESTRICT region = regionFrom->denseVector(); CoinSimplexDouble * COIN_RESTRICT array = regionTo->denseVector(); for (CoinSimplexInt j = 0; j < numberNonZero; j ++ ) { CoinSimplexInt iRow = regionIndex[j]; CoinSimplexDouble value = region[iRow]; region[iRow]=0.0; array[j] = value; index[j] = iRow; } regionTo->setNumElements(numberNonZero); } // Set up addresses from arrays void CoinAbcTypeFactorization::doAddresses() { pivotColumnAddress_ = pivotColumn_.array(); permuteAddress_ = permute_.array(); pivotRegionAddress_ = pivotRegion_.array()+1; elementUAddress_ = elementU_.array(); indexRowUAddress_ = indexRowU_.array(); numberInColumnAddress_ = numberInColumn_.array(); numberInColumnPlusAddress_ = numberInColumnPlus_.array(); #ifdef ABC_USE_FUNCTION_POINTERS scatterPointersUColumnAddress_ = reinterpret_cast(scatterUColumn_.array()); #endif startColumnUAddress_ = startColumnU_.array(); #if CONVERTROW convertRowToColumnUAddress_ = convertRowToColumnU_.array(); #if CONVERTROW>1 convertColumnToRowUAddress_ = convertColumnToRowU_.array(); #endif #endif #if ABC_SMALL<2 elementRowUAddress_ = elementRowU_.array(); #endif startRowUAddress_ = startRowU_.array(); numberInRowAddress_ = numberInRow_.array(); indexColumnUAddress_ = indexColumnU_.array(); firstCountAddress_ = firstCount_.array(); nextCountAddress_ = nextCount(); lastCountAddress_ = lastCount(); nextColumnAddress_ = nextColumn_.array(); lastColumnAddress_ = lastColumn_.array(); nextRowAddress_ = nextRow_.array(); lastRowAddress_ = lastRow_.array(); saveColumnAddress_ = saveColumn_.array(); //saveColumnAddress2_ = saveColumn_.array()+numberRows_; elementLAddress_ = elementL_.array(); indexRowLAddress_ = indexRowL_.array(); startColumnLAddress_ = startColumnL_.array(); #if ABC_SMALL<2 startRowLAddress_ = startRowL_.array(); #endif pivotLinkedBackwardsAddress_ = pivotLinkedBackwards(); pivotLinkedForwardsAddress_ = pivotLinkedForwards(); pivotLOrderAddress_ = pivotLOrder(); startColumnRAddress_ = startColumnR(); // next two are recomputed cleanup elementRAddress_ = elementL_.array() + lengthL_; indexRowRAddress_ = indexRowL_.array() + lengthL_; #if ABC_SMALL<2 indexColumnLAddress_ = indexColumnL_.array(); elementByRowLAddress_ = elementByRowL_.array(); #endif #if ABC_DENSE_CODE denseAreaAddress_ = denseArea_.array(); #endif workAreaAddress_ = workArea_.array(); workArea2Address_ = workArea2_.array(); #if ABC_SMALL<2 sparseAddress_ = sparse_.array(); CoinAbcStack * stackList = reinterpret_cast(sparseAddress_); listAddress_ = reinterpret_cast(stackList+numberRows_); markRowAddress_ = reinterpret_cast (listAddress_ + numberRows_); #endif } #endif CoinMP-1.8.3/Clp/src/CoinAbcFactorization3.cpp0000644000175000017500000000101712101105055017430 0ustar renerene/* $Id: CoinAbcFactorization3.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization3.cpp" #endif CoinMP-1.8.3/Clp/src/ClpQuadraticObjective.hpp0000644000175000017500000001267211510657452017557 0ustar renerene/* $Id: ClpQuadraticObjective.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpQuadraticObjective_H #define ClpQuadraticObjective_H #include "ClpObjective.hpp" #include "CoinPackedMatrix.hpp" //############################################################################# /** Quadratic Objective Class */ class ClpQuadraticObjective : public ClpObjective { public: ///@name Stuff //@{ /** Returns gradient. If Quadratic then solution may be NULL, also returns an offset (to be added to current one) If refresh is false then uses last solution Uses model for scaling includeLinear 0 - no, 1 as is, 2 as feasible */ virtual double * gradient(const ClpSimplex * model, const double * solution, double & offset, bool refresh, int includeLinear = 2); /// Resize objective /** Returns reduced gradient.Returns an offset (to be added to current one). */ virtual double reducedGradient(ClpSimplex * model, double * region, bool useFeasibleCosts); /** Returns step length which gives minimum of objective for solution + theta * change vector up to maximum theta. arrays are numberColumns+numberRows Also sets current objective, predicted and at maximumTheta */ virtual double stepLength(ClpSimplex * model, const double * solution, const double * change, double maximumTheta, double & currentObj, double & predictedObj, double & thetaObj); /// Return objective value (without any ClpModel offset) (model may be NULL) virtual double objectiveValue(const ClpSimplex * model, const double * solution) const ; virtual void resize(int newNumberColumns) ; /// Delete columns in objective virtual void deleteSome(int numberToDelete, const int * which) ; /// Scale objective virtual void reallyScale(const double * columnScale) ; /** Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ virtual int markNonlinear(char * which); //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpQuadraticObjective(); /// Constructor from objective ClpQuadraticObjective(const double * linearObjective, int numberColumns, const CoinBigIndex * start, const int * column, const double * element, int numberExtendedColumns_ = -1); /** Copy constructor . If type is -1 then make sure half symmetric, if +1 then make sure full */ ClpQuadraticObjective(const ClpQuadraticObjective & rhs, int type = 0); /** Subset constructor. Duplicates are allowed and order is as given. */ ClpQuadraticObjective (const ClpQuadraticObjective &rhs, int numberColumns, const int * whichColumns) ; /// Assignment operator ClpQuadraticObjective & operator=(const ClpQuadraticObjective& rhs); /// Destructor virtual ~ClpQuadraticObjective (); /// Clone virtual ClpObjective * clone() const; /** Subset clone. Duplicates are allowed and order is as given. */ virtual ClpObjective * subsetClone (int numberColumns, const int * whichColumns) const; /** Load up quadratic objective. This is stored as a CoinPackedMatrix */ void loadQuadraticObjective(const int numberColumns, const CoinBigIndex * start, const int * column, const double * element, int numberExtendedColumns = -1); void loadQuadraticObjective ( const CoinPackedMatrix& matrix); /// Get rid of quadratic objective void deleteQuadraticObjective(); //@} ///@name Gets and sets //@{ /// Quadratic objective inline CoinPackedMatrix * quadraticObjective() const { return quadraticObjective_; } /// Linear objective inline double * linearObjective() const { return objective_; } /// Length of linear objective which could be bigger inline int numberExtendedColumns() const { return numberExtendedColumns_; } /// Number of columns in quadratic objective inline int numberColumns() const { return numberColumns_; } /// If a full or half matrix inline bool fullMatrix() const { return fullMatrix_; } //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// Quadratic objective CoinPackedMatrix * quadraticObjective_; /// Objective double * objective_; /// Gradient double * gradient_; /// Useful to have number of columns about int numberColumns_; /// Also length of linear objective which could be bigger int numberExtendedColumns_; /// True if full symmetric matrix, false if half bool fullMatrix_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpMatrixBase.cpp0000644000175000017500000005344511510657452016044 0ustar renerene/* $Id: ClpMatrixBase.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "ClpMatrixBase.hpp" #include "ClpSimplex.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpMatrixBase::ClpMatrixBase () : rhsOffset_(NULL), startFraction_(0.0), endFraction_(1.0), savedBestDj_(0.0), originalWanted_(0), currentWanted_(0), savedBestSequence_(-1), type_(-1), lastRefresh_(-1), refreshFrequency_(0), minimumObjectsScan_(-1), minimumGoodReducedCosts_(-1), trueSequenceIn_(-1), trueSequenceOut_(-1), skipDualCheck_(false) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpMatrixBase::ClpMatrixBase (const ClpMatrixBase & rhs) : type_(rhs.type_), skipDualCheck_(rhs.skipDualCheck_) { startFraction_ = rhs.startFraction_; endFraction_ = rhs.endFraction_; savedBestDj_ = rhs.savedBestDj_; originalWanted_ = rhs.originalWanted_; currentWanted_ = rhs.currentWanted_; savedBestSequence_ = rhs.savedBestSequence_; lastRefresh_ = rhs.lastRefresh_; refreshFrequency_ = rhs.refreshFrequency_; minimumObjectsScan_ = rhs.minimumObjectsScan_; minimumGoodReducedCosts_ = rhs.minimumGoodReducedCosts_; trueSequenceIn_ = rhs.trueSequenceIn_; trueSequenceOut_ = rhs.trueSequenceOut_; skipDualCheck_ = rhs.skipDualCheck_; int numberRows = rhs.getNumRows(); if (rhs.rhsOffset_ && numberRows) { rhsOffset_ = ClpCopyOfArray(rhs.rhsOffset_, numberRows); } else { rhsOffset_ = NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpMatrixBase::~ClpMatrixBase () { delete [] rhsOffset_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpMatrixBase & ClpMatrixBase::operator=(const ClpMatrixBase& rhs) { if (this != &rhs) { type_ = rhs.type_; delete [] rhsOffset_; int numberRows = rhs.getNumRows(); if (rhs.rhsOffset_ && numberRows) { rhsOffset_ = ClpCopyOfArray(rhs.rhsOffset_, numberRows); } else { rhsOffset_ = NULL; } startFraction_ = rhs.startFraction_; endFraction_ = rhs.endFraction_; savedBestDj_ = rhs.savedBestDj_; originalWanted_ = rhs.originalWanted_; currentWanted_ = rhs.currentWanted_; savedBestSequence_ = rhs.savedBestSequence_; lastRefresh_ = rhs.lastRefresh_; refreshFrequency_ = rhs.refreshFrequency_; minimumObjectsScan_ = rhs.minimumObjectsScan_; minimumGoodReducedCosts_ = rhs.minimumGoodReducedCosts_; trueSequenceIn_ = rhs.trueSequenceIn_; trueSequenceOut_ = rhs.trueSequenceOut_; skipDualCheck_ = rhs.skipDualCheck_; } return *this; } // And for scaling - default aborts for when scaling not supported void ClpMatrixBase::times(double scalar, const double * x, double * y, const double * rowScale, const double * /*columnScale*/) const { if (rowScale) { std::cerr << "Scaling not supported - ClpMatrixBase" << std::endl; abort(); } else { times(scalar, x, y); } } // And for scaling - default aborts for when scaling not supported void ClpMatrixBase::transposeTimes(double scalar, const double * x, double * y, const double * rowScale, const double * /*columnScale*/, double * /*spare*/) const { if (rowScale) { std::cerr << "Scaling not supported - ClpMatrixBase" << std::endl; abort(); } else { transposeTimes(scalar, x, y); } } /* Subset clone (without gaps). Duplicates are allowed and order is as given. Derived classes need not provide this as it may not always make sense */ ClpMatrixBase * ClpMatrixBase::subsetClone ( int /*numberRows*/, const int * /*whichRows*/, int /*numberColumns*/, const int * /*whichColumns*/) const { std::cerr << "subsetClone not supported - ClpMatrixBase" << std::endl; abort(); return NULL; } /* Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector Default returns vector of ones */ CoinBigIndex * ClpMatrixBase::dubiousWeights(const ClpSimplex * model, int * /*inputWeights*/) const { int number = model->numberRows() + model->numberColumns(); CoinBigIndex * weights = new CoinBigIndex[number]; int i; for (i = 0; i < number; i++) weights[i] = 1; return weights; } #ifndef CLP_NO_VECTOR // Append Columns void ClpMatrixBase::appendCols(int /*number*/, const CoinPackedVectorBase * const * /*columns*/) { std::cerr << "appendCols not supported - ClpMatrixBase" << std::endl; abort(); } // Append Rows void ClpMatrixBase::appendRows(int /*number*/, const CoinPackedVectorBase * const * /*rows*/) { std::cerr << "appendRows not supported - ClpMatrixBase" << std::endl; abort(); } #endif /* Returns largest and smallest elements of both signs. Largest refers to largest absolute value. */ void ClpMatrixBase::rangeOfElements(double & smallestNegative, double & largestNegative, double & smallestPositive, double & largestPositive) { smallestNegative = 0.0; largestNegative = 0.0; smallestPositive = 0.0; largestPositive = 0.0; } /* The length of a major-dimension vector. */ int ClpMatrixBase::getVectorLength(int index) const { return getVectorLengths()[index]; } // Says whether it can do partial pricing bool ClpMatrixBase::canDoPartialPricing() const { return false; // default is no } /* Return x *A in z but just for number indices in y. Default cheats with fake CoinIndexedVector and then calls subsetTransposeTimes */ void ClpMatrixBase::listTransposeTimes(const ClpSimplex * model, double * x, int * y, int number, double * z) const { CoinIndexedVector pi; CoinIndexedVector list; CoinIndexedVector output; int * saveIndices = list.getIndices(); list.setNumElements(number); list.setIndexVector(y); double * savePi = pi.denseVector(); pi.setDenseVector(x); double * saveOutput = output.denseVector(); output.setDenseVector(z); output.setPacked(); subsetTransposeTimes(model, &pi, &list, &output); // restore settings list.setIndexVector(saveIndices); pi.setDenseVector(savePi); output.setDenseVector(saveOutput); } // Partial pricing void ClpMatrixBase::partialPricing(ClpSimplex * , double , double , int & , int & ) { std::cerr << "partialPricing not supported - ClpMatrixBase" << std::endl; abort(); } /* expands an updated column to allow for extra rows which the main solver does not know about and returns number added. If the arrays are NULL then returns number of extra entries needed. This will normally be a no-op - it is in for GUB! */ int ClpMatrixBase::extendUpdated(ClpSimplex * , CoinIndexedVector * , int ) { return 0; } /* utility primal function for dealing with dynamic constraints mode=n see ClpGubMatrix.hpp for definition Remember to update here when settled down */ void ClpMatrixBase::primalExpanded(ClpSimplex * , int ) { } /* utility dual function for dealing with dynamic constraints mode=n see ClpGubMatrix.hpp for definition Remember to update here when settled down */ void ClpMatrixBase::dualExpanded(ClpSimplex * , CoinIndexedVector * , double * , int ) { } /* general utility function for dealing with dynamic constraints mode=n see ClpGubMatrix.hpp for definition Remember to update here when settled down */ int ClpMatrixBase::generalExpanded(ClpSimplex * model, int mode, int &number) { int returnCode = 0; switch (mode) { // Fill in pivotVariable but not for key variables case 0: { int i; int numberBasic = number; int numberColumns = model->numberColumns(); // Use different array so can build from true pivotVariable_ //int * pivotVariable = model->pivotVariable(); int * pivotVariable = model->rowArray(0)->getIndices(); for (i = 0; i < numberColumns; i++) { if (model->getColumnStatus(i) == ClpSimplex::basic) pivotVariable[numberBasic++] = i; } number = numberBasic; } break; // Do initial extra rows + maximum basic case 2: { number = model->numberRows(); } break; // To see if can dual or primal case 4: { returnCode = 3; } break; default: break; } return returnCode; } // Sets up an effective RHS void ClpMatrixBase::useEffectiveRhs(ClpSimplex * ) { std::cerr << "useEffectiveRhs not supported - ClpMatrixBase" << std::endl; abort(); } /* Returns effective RHS if it is being used. This is used for long problems or big gub or anywhere where going through full columns is expensive. This may re-compute */ double * ClpMatrixBase::rhsOffset(ClpSimplex * model, bool forceRefresh, bool #ifdef CLP_DEBUG check #endif ) { if (rhsOffset_) { #ifdef CLP_DEBUG if (check) { // no need - but check anyway // zero out basic int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); double * solution = new double [numberColumns]; double * rhs = new double[numberRows]; const double * solutionSlack = model->solutionRegion(0); CoinMemcpyN(model->solutionRegion(), numberColumns, solution); int iRow; for (iRow = 0; iRow < numberRows; iRow++) { if (model->getRowStatus(iRow) != ClpSimplex::basic) rhs[iRow] = solutionSlack[iRow]; else rhs[iRow] = 0.0; } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) == ClpSimplex::basic) solution[iColumn] = 0.0; } times(-1.0, solution, rhs); delete [] solution; for (iRow = 0; iRow < numberRows; iRow++) { if (fabs(rhs[iRow] - rhsOffset_[iRow]) > 1.0e-3) printf("** bad effective %d - true %g old %g\n", iRow, rhs[iRow], rhsOffset_[iRow]); } } #endif if (forceRefresh || (refreshFrequency_ && model->numberIterations() >= lastRefresh_ + refreshFrequency_)) { // zero out basic int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); double * solution = new double [numberColumns]; const double * solutionSlack = model->solutionRegion(0); CoinMemcpyN(model->solutionRegion(), numberColumns, solution); for (int iRow = 0; iRow < numberRows; iRow++) { if (model->getRowStatus(iRow) != ClpSimplex::basic) rhsOffset_[iRow] = solutionSlack[iRow]; else rhsOffset_[iRow] = 0.0; } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) == ClpSimplex::basic) solution[iColumn] = 0.0; } times(-1.0, solution, rhsOffset_); delete [] solution; lastRefresh_ = model->numberIterations(); } } return rhsOffset_; } /* update information for a pivot (and effective rhs) */ int ClpMatrixBase::updatePivot(ClpSimplex * model, double oldInValue, double ) { if (rhsOffset_) { // update effective rhs int sequenceIn = model->sequenceIn(); int sequenceOut = model->sequenceOut(); double * solution = model->solutionRegion(); int numberColumns = model->numberColumns(); if (sequenceIn == sequenceOut) { if (sequenceIn < numberColumns) add(model, rhsOffset_, sequenceIn, oldInValue - solution[sequenceIn]); } else { if (sequenceIn < numberColumns) add(model, rhsOffset_, sequenceIn, oldInValue); if (sequenceOut < numberColumns) add(model, rhsOffset_, sequenceOut, -solution[sequenceOut]); } } return 0; } int ClpMatrixBase::hiddenRows() const { return 0; } /* Creates a variable. This is called after partial pricing and may modify matrix. May update bestSequence. */ void ClpMatrixBase::createVariable(ClpSimplex *, int &) { } // Returns reduced cost of a variable double ClpMatrixBase::reducedCost(ClpSimplex * model, int sequence) const { int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); if (sequence < numberRows + numberColumns) return model->djRegion()[sequence]; else return savedBestDj_; } /* Just for debug if odd type matrix. Returns number and sum of primal infeasibilities. */ int ClpMatrixBase::checkFeasible(ClpSimplex * model, double & sum) const { int numberRows = model->numberRows(); double * rhs = new double[numberRows]; int numberColumns = model->numberColumns(); int iRow; CoinZeroN(rhs, numberRows); times(1.0, model->solutionRegion(), rhs, model->rowScale(), model->columnScale()); int iColumn; int logLevel = model->messageHandler()->logLevel(); int numberInfeasible = 0; const double * rowLower = model->lowerRegion(0); const double * rowUpper = model->upperRegion(0); const double * solution; solution = model->solutionRegion(0); double tolerance = model->primalTolerance() * 1.01; sum = 0.0; for (iRow = 0; iRow < numberRows; iRow++) { double value = rhs[iRow]; double value2 = solution[iRow]; if (logLevel > 3) { if (fabs(value - value2) > 1.0e-8) printf("Row %d stored %g, computed %g\n", iRow, value2, value); } if (value < rowLower[iRow] - tolerance || value > rowUpper[iRow] + tolerance) { numberInfeasible++; sum += CoinMax(rowLower[iRow] - value, value - rowUpper[iRow]); } if (value2 > rowLower[iRow] + tolerance && value2 < rowUpper[iRow] - tolerance && model->getRowStatus(iRow) != ClpSimplex::basic) { assert (model->getRowStatus(iRow) == ClpSimplex::superBasic); } } const double * columnLower = model->lowerRegion(1); const double * columnUpper = model->upperRegion(1); solution = model->solutionRegion(1); for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; if (value < columnLower[iColumn] - tolerance || value > columnUpper[iColumn] + tolerance) { numberInfeasible++; sum += CoinMax(columnLower[iColumn] - value, value - columnUpper[iColumn]); } if (value > columnLower[iColumn] + tolerance && value < columnUpper[iColumn] - tolerance && model->getColumnStatus(iColumn) != ClpSimplex::basic) { assert (model->getColumnStatus(iColumn) == ClpSimplex::superBasic); } } delete [] rhs; return numberInfeasible; } // These have to match ClpPrimalColumnSteepest version #define reference(i) (((reference[i>>5]>>(i&31))&1)!=0) // Updates second array for steepest and does devex weights (need not be coded) void ClpMatrixBase::subsetTimes2(const ClpSimplex * model, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * dj2, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor) { // get subset which have nonzero tableau elements subsetTransposeTimes(model, pi2, dj1, dj2); bool killDjs = (scaleFactor == 0.0); if (!scaleFactor) scaleFactor = 1.0; // columns int number = dj1->getNumElements(); const int * index = dj1->getIndices(); double * updateBy = dj1->denseVector(); double * updateBy2 = dj2->denseVector(); for (int j = 0; j < number; j++) { double thisWeight; double pivot; double pivotSquared; int iSequence = index[j]; double value2 = updateBy[j]; if (killDjs) updateBy[j] = 0.0; double modification = updateBy2[j]; updateBy2[j] = 0.0; ClpSimplex::Status status = model->getStatus(iSequence); if (status != ClpSimplex::basic && status != ClpSimplex::isFixed) { thisWeight = weights[iSequence]; pivot = value2 * scaleFactor; pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iSequence] = thisWeight; } } dj2->setNumElements(0); } // Correct sequence in and out to give true value void ClpMatrixBase::correctSequence(const ClpSimplex * , int & , int & ) { } // Really scale matrix void ClpMatrixBase::reallyScale(const double * , const double * ) { std::cerr << "reallyScale not supported - ClpMatrixBase" << std::endl; abort(); } // Updates two arrays for steepest void ClpMatrixBase::transposeTimes2(const ClpSimplex * , const CoinIndexedVector * , CoinIndexedVector *, const CoinIndexedVector * , CoinIndexedVector * , double , double , // Array for exact devex to say what is in reference framework unsigned int * , double * , double ) { std::cerr << "transposeTimes2 not supported - ClpMatrixBase" << std::endl; abort(); } /* Set the dimensions of the matrix. In effect, append new empty columns/rows to the matrix. A negative number for either dimension means that that dimension doesn't change. Otherwise the new dimensions MUST be at least as large as the current ones otherwise an exception is thrown. */ void ClpMatrixBase::setDimensions(int , int ) { // If odd matrix assume user knows what they are doing } /* Append a set of rows/columns to the end of the matrix. Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns */ int ClpMatrixBase::appendMatrix(int , int , const CoinBigIndex * , const int * , const double * , int ) { std::cerr << "appendMatrix not supported - ClpMatrixBase" << std::endl; abort(); return -1; } /* Modify one element of packed matrix. An element may be added. This works for either ordering If the new element is zero it will be deleted unless keepZero true */ void ClpMatrixBase::modifyCoefficient(int , int , double , bool ) { std::cerr << "modifyCoefficient not supported - ClpMatrixBase" << std::endl; abort(); } #if COIN_LONG_WORK // For long double versions (aborts if not supported) void ClpMatrixBase::times(CoinWorkDouble scalar, const CoinWorkDouble * x, CoinWorkDouble * y) const { std::cerr << "long times not supported - ClpMatrixBase" << std::endl; abort(); } void ClpMatrixBase::transposeTimes(CoinWorkDouble scalar, const CoinWorkDouble * x, CoinWorkDouble * y) const { std::cerr << "long transposeTimes not supported - ClpMatrixBase" << std::endl; abort(); } #endif CoinMP-1.8.3/Clp/src/AbcNonLinearCost.cpp0000644000175000017500000007754012101105055016454 0ustar renerene/* $Id: AbcNonLinearCost.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include #include "CoinIndexedVector.hpp" #include "AbcSimplex.hpp" #include "CoinHelperFunctions.hpp" #include "AbcNonLinearCost.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcNonLinearCost::AbcNonLinearCost () : changeCost_(0.0), feasibleCost_(0.0), infeasibilityWeight_(-1.0), largestInfeasibility_(0.0), sumInfeasibilities_(0.0), averageTheta_(0.0), numberRows_(0), numberColumns_(0), model_(NULL), numberInfeasibilities_(-1), status_(NULL), bound_(NULL), cost_(NULL) { } //#define VALIDATE #ifdef VALIDATE static double * saveLowerV = NULL; static double * saveUpperV = NULL; #ifdef NDEBUG Validate should not be set if no debug #endif #endif /* Constructor from simplex. This will just set up wasteful arrays for linear, but later may do dual analysis and even finding duplicate columns */ AbcNonLinearCost::AbcNonLinearCost ( AbcSimplex * model) { model_ = model; numberRows_ = model_->numberRows(); numberColumns_ = model_->numberColumns(); // If gub then we need this extra int numberTotal = numberRows_ + numberColumns_; numberInfeasibilities_ = 0; changeCost_ = 0.0; feasibleCost_ = 0.0; infeasibilityWeight_ = -1.0; double * cost = model_->costRegion(); // check if all 0 int iSequence; bool allZero = true; for (iSequence = 0; iSequence < numberTotal; iSequence++) { if (cost[iSequence]) { allZero = false; break; } } if (allZero) model_->setInfeasibilityCost(1.0); sumInfeasibilities_ = 0.0; averageTheta_ = 0.0; largestInfeasibility_ = 0.0; bound_ = new double[numberTotal]; cost_ = new double[numberTotal]; status_ = new unsigned char[numberTotal]; for (iSequence = 0; iSequence < numberTotal; iSequence++) { bound_[iSequence] = 0.0; cost_[iSequence] = cost[iSequence]; setInitialStatus(status_[iSequence]); } } // Refresh - assuming regions OK void AbcNonLinearCost::refresh() { int numberTotal = numberRows_ + numberColumns_; numberInfeasibilities_ = 0; sumInfeasibilities_ = 0.0; largestInfeasibility_ = 0.0; double infeasibilityCost = model_->infeasibilityCost(); double primalTolerance = model_->currentPrimalTolerance(); double * cost = model_->costRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * solution = model_->solutionRegion(); for (int iSequence = 0; iSequence < numberTotal; iSequence++) { cost_[iSequence] = cost[iSequence]; double value = solution[iSequence]; double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible status_[iSequence] = static_cast(CLP_FEASIBLE | (CLP_SAME << 4)); bound_[iSequence] = 0.0; } else { // below double infeasibility = lowerValue - value - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); cost[iSequence] -= infeasibilityCost; numberInfeasibilities_++; status_[iSequence] = static_cast(CLP_BELOW_LOWER | (CLP_SAME << 4)); bound_[iSequence] = upperValue; upper[iSequence] = lowerValue; lower[iSequence] = -COIN_DBL_MAX; } } else { // above double infeasibility = value - upperValue - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); cost[iSequence] += infeasibilityCost; numberInfeasibilities_++; status_[iSequence] = static_cast(CLP_ABOVE_UPPER | (CLP_SAME << 4)); bound_[iSequence] = lowerValue; lower[iSequence] = upperValue; upper[iSequence] = COIN_DBL_MAX; } } // checkInfeasibilities(model_->primalTolerance()); } // Refresh - from original void AbcNonLinearCost::refreshFromPerturbed(double tolerance) { // original costs and perturbed bounds model_->copyFromSaved(32+2); refresh(); //checkInfeasibilities(tolerance); } // Refreshes costs always makes row costs zero void AbcNonLinearCost::refreshCosts(const double * columnCosts) { double * cost = model_->costRegion(); // zero row costs memset(cost + numberColumns_, 0, numberRows_ * sizeof(double)); // copy column costs CoinMemcpyN(columnCosts, numberColumns_, cost); for (int iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { cost_[iSequence] = cost[iSequence]; } } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcNonLinearCost::AbcNonLinearCost (const AbcNonLinearCost & rhs) : changeCost_(0.0), feasibleCost_(0.0), infeasibilityWeight_(-1.0), largestInfeasibility_(0.0), sumInfeasibilities_(0.0), averageTheta_(0.0), numberRows_(rhs.numberRows_), numberColumns_(rhs.numberColumns_), model_(NULL), numberInfeasibilities_(-1), status_(NULL), bound_(NULL), cost_(NULL) { if (numberRows_) { int numberTotal = numberRows_ + numberColumns_; model_ = rhs.model_; numberInfeasibilities_ = rhs.numberInfeasibilities_; changeCost_ = rhs.changeCost_; feasibleCost_ = rhs.feasibleCost_; infeasibilityWeight_ = rhs.infeasibilityWeight_; largestInfeasibility_ = rhs.largestInfeasibility_; sumInfeasibilities_ = rhs.sumInfeasibilities_; averageTheta_ = rhs.averageTheta_; bound_ = CoinCopyOfArray(rhs.bound_, numberTotal); cost_ = CoinCopyOfArray(rhs.cost_, numberTotal); status_ = CoinCopyOfArray(rhs.status_, numberTotal); } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcNonLinearCost::~AbcNonLinearCost () { delete [] status_; delete [] bound_; delete [] cost_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcNonLinearCost & AbcNonLinearCost::operator=(const AbcNonLinearCost& rhs) { if (this != &rhs) { numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; delete [] status_; delete [] bound_; delete [] cost_; status_ = NULL; bound_ = NULL; cost_ = NULL; if (numberRows_) { int numberTotal = numberRows_ + numberColumns_; bound_ = CoinCopyOfArray(rhs.bound_, numberTotal); cost_ = CoinCopyOfArray(rhs.cost_, numberTotal); status_ = CoinCopyOfArray(rhs.status_, numberTotal); } model_ = rhs.model_; numberInfeasibilities_ = rhs.numberInfeasibilities_; changeCost_ = rhs.changeCost_; feasibleCost_ = rhs.feasibleCost_; infeasibilityWeight_ = rhs.infeasibilityWeight_; largestInfeasibility_ = rhs.largestInfeasibility_; sumInfeasibilities_ = rhs.sumInfeasibilities_; averageTheta_ = rhs.averageTheta_; } return *this; } // Changes infeasible costs and computes number and cost of infeas // We will need to re-think objective offsets later // We will also need a 2 bit per variable array for some // purpose which will come to me later void AbcNonLinearCost::checkInfeasibilities(double oldTolerance) { numberInfeasibilities_ = 0; double infeasibilityCost = model_->infeasibilityCost(); changeCost_ = 0.0; largestInfeasibility_ = 0.0; sumInfeasibilities_ = 0.0; double primalTolerance = model_->currentPrimalTolerance(); int iSequence; double * solution = model_->solutionRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); bool toNearest = oldTolerance <= 0.0; feasibleCost_ = 0.0; //bool checkCosts = (infeasibilityWeight_ != infeasibilityCost); infeasibilityWeight_ = infeasibilityCost; int numberTotal = numberColumns_ + numberRows_; // nonbasic should be at a valid bound for (iSequence = 0; iSequence < numberTotal; iSequence++) { double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost_[iSequence]; double trueCost = costValue; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; costValue -= infeasibilityCost; } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; costValue += infeasibilityCost; } // get correct place int newWhere = CLP_FEASIBLE; AbcSimplex::Status status = model_->getInternalStatus(iSequence); if (upperValue == lowerValue && status != AbcSimplex::isFixed) { if (status != AbcSimplex::basic) { model_->setInternalStatus(iSequence, AbcSimplex::isFixed); status = AbcSimplex::isFixed; } } switch(status) { case AbcSimplex::basic: case AbcSimplex::superBasic: if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; assert (fabs(lowerValue) < 1.0e100); double infeasibility = lowerValue - value - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); costValue = trueCost - infeasibilityCost; changeCost_ -= lowerValue * (costValue - cost[iSequence]); numberInfeasibilities_++; } } else { // above newWhere = CLP_ABOVE_UPPER; double infeasibility = value - upperValue - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); costValue = trueCost + infeasibilityCost; changeCost_ -= upperValue * (costValue - cost[iSequence]); numberInfeasibilities_++; } break; case AbcSimplex::isFree: break; case AbcSimplex::atUpperBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place if (fabs(value - upperValue) > oldTolerance * 1.0001) { if (fabs(value - lowerValue) <= oldTolerance * 1.0001) { if (fabs(value - lowerValue) > primalTolerance) { solution[iSequence] = lowerValue; value = lowerValue; } model_->setInternalStatus(iSequence, AbcSimplex::atLowerBound); } else { if (value < upperValue) { if (value > lowerValue) { model_->setInternalStatus(iSequence, AbcSimplex::superBasic); } else { // set to lower bound as infeasible solution[iSequence] = lowerValue; value = lowerValue; model_->setInternalStatus(iSequence, AbcSimplex::atLowerBound); } } else { // set to upper bound as infeasible solution[iSequence] = upperValue; value = upperValue; } } } else if (fabs(value - upperValue) > primalTolerance) { solution[iSequence] = upperValue; value = upperValue; } } else { // Set to nearest and make at bound if (fabs(value - lowerValue) < fabs(value - upperValue)) { solution[iSequence] = lowerValue; value = lowerValue; model_->setInternalStatus(iSequence, AbcSimplex::atLowerBound); } else { solution[iSequence] = upperValue; value = upperValue; } } break; case AbcSimplex::atLowerBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place if (fabs(value - lowerValue) > oldTolerance * 1.0001) { if (fabs(value - upperValue) <= oldTolerance * 1.0001) { if (fabs(value - upperValue) > primalTolerance) { solution[iSequence] = upperValue; value = upperValue; } model_->setInternalStatus(iSequence, AbcSimplex::atUpperBound); } else { if (value < upperValue) { if (value > lowerValue) { model_->setInternalStatus(iSequence, AbcSimplex::superBasic); } else { // set to lower bound as infeasible solution[iSequence] = lowerValue; value = lowerValue; } } else { // set to upper bound as infeasible solution[iSequence] = upperValue; value = upperValue; model_->setInternalStatus(iSequence, AbcSimplex::atUpperBound); } } } else if (fabs(value - lowerValue) > primalTolerance) { solution[iSequence] = lowerValue; value = lowerValue; } } else { // Set to nearest and make at bound if (fabs(value - lowerValue) < fabs(value - upperValue)) { solution[iSequence] = lowerValue; value = lowerValue; } else { solution[iSequence] = upperValue; value = upperValue; model_->setInternalStatus(iSequence, AbcSimplex::atUpperBound); } } break; case AbcSimplex::isFixed: solution[iSequence] = lowerValue; value = lowerValue; break; } if (iWhere != newWhere) { setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; costValue = trueCost - infeasibilityCost; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; costValue = trueCost + infeasibilityCost; } else { costValue = trueCost; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; } // always do as other things may change cost[iSequence] = costValue; feasibleCost_ += trueCost * value; } model_->moveToBasic(14); // all except solution } // Puts feasible bounds into lower and upper void AbcNonLinearCost::feasibleBounds() { int iSequence; double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); int numberTotal = numberColumns_ + numberRows_; for (iSequence = 0; iSequence < numberTotal; iSequence++) { unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; } setOriginalStatus(status_[iSequence], CLP_FEASIBLE); lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } } void AbcNonLinearCost::goBackAll(const CoinIndexedVector * update) { assert (model_ != NULL); const int * pivotVariable = model_->pivotVariable(); int number = update->getNumElements(); const int * index = update->getIndices(); for (int i = 0; i < number; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; setSameStatus(status_[iSequence]); } } void AbcNonLinearCost::checkInfeasibilities(int numberInArray, const int * index) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); const int * pivotVariable = model_->pivotVariable(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); double * solutionBasic = model_->solutionBasic(); double * upperBasic = model_->upperBasic(); double * lowerBasic = model_->lowerBasic(); double * costBasic = model_->costBasic(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double value = solutionBasic[iRow]; unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lowerBasic[iRow]; double upperValue = upperBasic[iRow]; double costValue = cost_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; assert (fabs(lowerValue) < 1.0e100); costValue -= infeasibilityWeight_; numberInfeasibilities_++; } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; lowerBasic[iRow] = lowerValue; upperBasic[iRow] = upperValue; costBasic[iRow] = costValue; } } } /* Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. On input array is empty (but indices exist). On exit just changed costs will be stored as normal CoinIndexedVector */ void AbcNonLinearCost::checkChanged(int numberInArray, CoinIndexedVector * update) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); const int * pivotVariable = model_->pivotVariable(); int number = 0; int * index = update->getIndices(); double * work = update->denseVector(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); double * solutionBasic = model_->solutionBasic(); double * upperBasic = model_->upperBasic(); double * lowerBasic = model_->lowerBasic(); double * costBasic = model_->costBasic(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double value = solutionBasic[iRow]; unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lowerBasic[iRow]; double upperValue = upperBasic[iRow]; double costValue = cost_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { work[iRow] = cost[iSequence] - costValue; index[number++] = iRow; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; lowerBasic[iRow] = lowerValue; upperBasic[iRow] = upperValue; costBasic[iRow] = costValue; } } update->setNumElements(number); } /* Sets bounds and cost for one variable - returns change in cost*/ double AbcNonLinearCost::setOne(int iSequence, double value) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); // difference in cost double difference = 0.0; double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { difference = cost[iSequence] - costValue; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } AbcSimplex::Status status = model_->getInternalStatus(iSequence); if (upperValue == lowerValue) { model_->setInternalStatus(iSequence, AbcSimplex::isFixed); } switch(status) { case AbcSimplex::basic: case AbcSimplex::superBasic: case AbcSimplex::isFree: break; case AbcSimplex::atUpperBound: case AbcSimplex::atLowerBound: case AbcSimplex::isFixed: // set correctly if (fabs(value - lowerValue) <= primalTolerance * 1.001) { model_->setInternalStatus(iSequence, AbcSimplex::atLowerBound); } else if (fabs(value - upperValue) <= primalTolerance * 1.001) { model_->setInternalStatus(iSequence, AbcSimplex::atUpperBound); } else { // set superBasic model_->setInternalStatus(iSequence, AbcSimplex::superBasic); } break; } changeCost_ += value * difference; return difference; } /* Sets bounds and cost for one variable - returns change in cost*/ double AbcNonLinearCost::setOneBasic(int iRow, double value) { assert (model_ != NULL); int iSequence=model_->pivotVariable()[iRow]; double primalTolerance = model_->currentPrimalTolerance(); // difference in cost double difference = 0.0; double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); double * upperBasic = model_->upperBasic(); double * lowerBasic = model_->lowerBasic(); double * costBasic = model_->costBasic(); unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lowerBasic[iRow]; double upperValue = upperBasic[iRow]; double costValue = cost_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { difference = cost[iSequence] - costValue; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; lowerBasic[iRow] = lowerValue; upperBasic[iRow] = upperValue; costBasic[iRow] = costValue; } changeCost_ += value * difference; return difference; } /* Sets bounds and cost for outgoing variable may change value Returns direction */ int AbcNonLinearCost::setOneOutgoing(int iRow, double & value) { assert (model_ != NULL); int iSequence=model_->pivotVariable()[iRow]; double primalTolerance = model_->currentPrimalTolerance(); // difference in cost double difference = 0.0; int direction = 0; double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); double * upperBasic = model_->upperBasic(); double * lowerBasic = model_->lowerBasic(); unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lowerBasic[iRow]; double upperValue = upperBasic[iRow]; double costValue = cost_[iSequence]; // Set perceived direction out if (value <= lowerValue + 1.001 * primalTolerance) { direction = 1; } else if (value >= upperValue - 1.001 * primalTolerance) { direction = -1; } else { // odd direction = 0; } int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place // If fixed give benefit of doubt if (lowerValue == upperValue) value = lowerValue; int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { difference = cost[iSequence] - costValue; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upper[iSequence] = lowerValue; lower[iSequence] = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lower[iSequence] = upperValue; upper[iSequence] = COIN_DBL_MAX; } else { lower[iSequence] = lowerValue; upper[iSequence] = upperValue; } cost[iSequence] = costValue; } // set correctly if (fabs(value - lowerValue) <= primalTolerance * 1.001) { value = CoinMin(value, lowerValue + primalTolerance); } else if (fabs(value - upperValue) <= primalTolerance * 1.001) { value = CoinMax(value, upperValue - primalTolerance); } else { //printf("*** variable wandered off bound %g %g %g!\n", // lowerValue,value,upperValue); if (value - lowerValue <= upperValue - value) value = lowerValue + primalTolerance; else value = upperValue - primalTolerance; } changeCost_ += value * difference; return direction; } // Returns nearest bound double AbcNonLinearCost::nearest(int iRow, double solutionValue) { assert (model_ != NULL); int iSequence=model_->pivotVariable()[iRow]; double nearest = 0.0; const double * upperBasic = model_->upperBasic(); const double * lowerBasic = model_->lowerBasic(); double lowerValue = lowerBasic[iRow]; double upperValue = upperBasic[iRow]; int iWhere = originalStatus(status_[iSequence]); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; } if (fabs(solutionValue - lowerValue) < fabs(solutionValue - upperValue)) nearest = lowerValue; else nearest = upperValue; return nearest; } /// Feasible cost with offset and direction (i.e. for reporting) double AbcNonLinearCost::feasibleReportCost() const { double value; model_->getDblParam(ClpObjOffset, value); return (feasibleCost_ + model_->objectiveAsObject()->nonlinearOffset()) * model_->optimizationDirection() / (model_->objectiveScale() * model_->rhsScale()) - value; } // Get rid of real costs (just for moment) void AbcNonLinearCost::zapCosts() { } #ifdef VALIDATE // For debug void AbcNonLinearCost::validate() { double primalTolerance = model_->currentPrimalTolerance(); int iSequence; const double * solution = model_->solutionRegion(); const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); const double * cost = model_->costRegion(); double infeasibilityCost = model_->infeasibilityCost(); int numberTotal = numberRows_ + numberColumns_; int numberInfeasibilities = 0; double sumInfeasibilities = 0.0; for (iSequence = 0; iSequence < numberTotal; iSequence++) { double value = solution[iSequence]; int iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); costValue -= infeasibilityCost; assert (value <= lowerValue - primalTolerance); numberInfeasibilities++; sumInfeasibilities += lowerValue - value - primalTolerance; assert (model_->getInternalStatus(iSequence) == AbcSimplex::basic); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; costValue += infeasibilityCost; assert (value >= upperValue + primalTolerance); numberInfeasibilities++; sumInfeasibilities += value - upperValue - primalTolerance; assert (model_->getInternalStatus(iSequence) == AbcSimplex::basic); } else { assert (value >= lowerValue - primalTolerance && value <= upperValue + primalTolerance); } assert (lowerValue == saveLowerV[iSequence]); assert (upperValue == saveUpperV[iSequence]); assert (costValue == cost[iSequence]); } if (numberInfeasibilities) printf("JJ %d infeasibilities summing to %g\n", numberInfeasibilities, sumInfeasibilities); } #endif CoinMP-1.8.3/Clp/src/CoinAbcSmallFactorization5.cpp0000644000175000017500000000103012101105055020416 0ustar renerene/* $Id: CoinAbcSmallFactorization5.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcSmallFactorization #define ABC_SMALL 4 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization5.cpp" #endif CoinMP-1.8.3/Clp/src/AbcMatrix.cpp0000644000175000017500000035634112442012732015210 0ustar renerene/* $Id: AbcMatrix.cpp 2074 2014-12-10 09:43:54Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #include "AbcSimplexFactorization.hpp" #include "AbcPrimalColumnDantzig.hpp" #include "AbcPrimalColumnSteepest.hpp" #include "CoinTime.hpp" #include "AbcSimplex.hpp" #include "AbcSimplexDual.hpp" // at end to get min/max! #include "AbcMatrix.hpp" #include "ClpMessage.hpp" #ifdef INTEL_MKL #include "mkl_spblas.h" #endif #if ABC_INSTRUMENT>1 extern int abcPricing[20]; extern int abcPricingDense[20]; #endif //============================================================================= //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcMatrix::AbcMatrix () : matrix_(NULL), model_(NULL), rowStart_(NULL), element_(NULL), column_(NULL), numberColumnBlocks_(0), numberRowBlocks_(0), #ifdef COUNT_COPY countRealColumn_(NULL), countStartLarge_(NULL), countRow_(NULL), countElement_(NULL), smallestCount_(0), largestCount_(0), #endif startFraction_(0.0), endFraction_(1.0), savedBestDj_(0.0), originalWanted_(0), currentWanted_(0), savedBestSequence_(-1), minimumObjectsScan_(-1), minimumGoodReducedCosts_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcMatrix::AbcMatrix (const AbcMatrix & rhs) { #ifndef COIN_SPARSE_MATRIX matrix_ = new CoinPackedMatrix(*(rhs.matrix_), -1, -1); #else matrix_ = new CoinPackedMatrix(*(rhs.matrix_), -0, -0); #endif model_=rhs.model_; rowStart_ = NULL; element_ = NULL; column_ = NULL; #ifdef COUNT_COPY countRealColumn_ = NULL; countStartLarge_ = NULL; countRow_ = NULL; countElement_ = NULL; #endif numberColumnBlocks_ = rhs.numberColumnBlocks_; CoinAbcMemcpy(startColumnBlock_,rhs.startColumnBlock_,numberColumnBlocks_+1); numberRowBlocks_ = rhs.numberRowBlocks_; if (numberRowBlocks_) { assert (model_); int numberRows=model_->numberRows(); int numberElements = matrix_->getNumElements(); memcpy(blockStart_,rhs.blockStart_,sizeof(blockStart_)); rowStart_=CoinCopyOfArray(rhs.rowStart_,numberRows*(numberRowBlocks_+2)); element_=CoinCopyOfArray(rhs.element_,numberElements); column_=CoinCopyOfArray(rhs.column_,numberElements); #ifdef COUNT_COPY smallestCount_ = rhs.smallestCount_; largestCount_ = rhs.largestCount_; int numberColumns=model_->numberColumns(); countRealColumn_=CoinCopyOfArray(rhs.countRealColumn_,numberColumns); memcpy(countStart_,rhs.countStart_,reinterpret_cast(&countRealColumn_)- reinterpret_cast(countStart_)); int numberLarge = numberColumns-countStart_[MAX_COUNT]; countStartLarge_=CoinCopyOfArray(rhs.countStartLarge_,numberLarge+1); numberElements=countStartLarge_[numberLarge]; countElement_=CoinCopyOfArray(rhs.countElement_,numberElements); countRow_=CoinCopyOfArray(rhs.countRow_,numberElements); #endif } } AbcMatrix::AbcMatrix (const CoinPackedMatrix & rhs) { #ifndef COIN_SPARSE_MATRIX matrix_ = new CoinPackedMatrix(rhs, -1, -1); #else matrix_ = new CoinPackedMatrix(rhs, -0, -0); #endif matrix_->cleanMatrix(); model_=NULL; rowStart_ = NULL; element_ = NULL; column_ = NULL; #ifdef COUNT_COPY countRealColumn_ = NULL; countStartLarge_ = NULL; countRow_ = NULL; countElement_ = NULL; smallestCount_ = 0; largestCount_ = 0; #endif numberColumnBlocks_=1; startColumnBlock_[0]=0; startColumnBlock_[1]=0; numberRowBlocks_ = 0; startFraction_ = 0; endFraction_ = 1.0; savedBestDj_ = 0; originalWanted_ = 0; currentWanted_ = 0; savedBestSequence_ = -1; minimumObjectsScan_ = -1; minimumGoodReducedCosts_ = -1; } #ifdef ABC_SPRINT /* Subset constructor (without gaps). */ AbcMatrix::AbcMatrix (const AbcMatrix & wholeMatrix, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) { #ifndef COIN_SPARSE_MATRIX matrix_ = new CoinPackedMatrix(*wholeMatrix.matrix_,numberRows,whichRows, numberColumns,whichColumns); #else matrix_ = new CoinPackedMatrix(rhs, -0, -0); abort(); #endif matrix_->cleanMatrix(); model_=NULL; rowStart_ = NULL; element_ = NULL; column_ = NULL; #ifdef COUNT_COPY countRealColumn_ = NULL; countStartLarge_ = NULL; countRow_ = NULL; countElement_ = NULL; smallestCount_ = 0; largestCount_ = 0; #endif numberColumnBlocks_=1; startColumnBlock_[0]=0; startColumnBlock_[1]=0; numberRowBlocks_ = 0; startFraction_ = 0; endFraction_ = 1.0; savedBestDj_ = 0; originalWanted_ = 0; currentWanted_ = 0; savedBestSequence_ = -1; minimumObjectsScan_ = -1; minimumGoodReducedCosts_ = -1; } #endif //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcMatrix::~AbcMatrix () { delete matrix_; delete [] rowStart_; delete [] element_; delete [] column_; #ifdef COUNT_COPY delete [] countRealColumn_; delete [] countStartLarge_; delete [] countRow_; delete [] countElement_; #endif } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcMatrix & AbcMatrix::operator=(const AbcMatrix& rhs) { if (this != &rhs) { delete matrix_; #ifndef COIN_SPARSE_MATRIX matrix_ = new CoinPackedMatrix(*(rhs.matrix_)); #else matrix_ = new CoinPackedMatrix(*(rhs.matrix_), -0, -0); #endif model_=rhs.model_; delete [] rowStart_; delete [] element_; delete [] column_; #ifdef COUNT_COPY delete [] countRealColumn_; delete [] countStartLarge_; delete [] countRow_; delete [] countElement_; #endif rowStart_ = NULL; element_ = NULL; column_ = NULL; #ifdef COUNT_COPY countRealColumn_ = NULL; countStartLarge_ = NULL; countRow_ = NULL; countElement_ = NULL; #endif numberColumnBlocks_ = rhs.numberColumnBlocks_; CoinAbcMemcpy(startColumnBlock_,rhs.startColumnBlock_,numberColumnBlocks_+1); numberRowBlocks_ = rhs.numberRowBlocks_; if (numberRowBlocks_) { assert (model_); int numberRows=model_->numberRows(); int numberElements = matrix_->getNumElements(); memcpy(blockStart_,rhs.blockStart_,sizeof(blockStart_)); rowStart_=CoinCopyOfArray(rhs.rowStart_,numberRows*(numberRowBlocks_+2)); element_=CoinCopyOfArray(rhs.element_,numberElements); column_=CoinCopyOfArray(rhs.column_,numberElements); #ifdef COUNT_COPY smallestCount_ = rhs.smallestCount_; largestCount_ = rhs.largestCount_; int numberColumns=model_->numberColumns(); countRealColumn_=CoinCopyOfArray(rhs.countRealColumn_,numberColumns); memcpy(countStart_,rhs.countStart_,reinterpret_cast(&countRealColumn_)- reinterpret_cast(countStart_)); int numberLarge = numberColumns-countStart_[MAX_COUNT]; countStartLarge_=CoinCopyOfArray(rhs.countStartLarge_,numberLarge+1); numberElements=countStartLarge_[numberLarge]; countElement_=CoinCopyOfArray(rhs.countElement_,numberElements); countRow_=CoinCopyOfArray(rhs.countRow_,numberElements); #endif } startFraction_ = rhs.startFraction_; endFraction_ = rhs.endFraction_; savedBestDj_ = rhs.savedBestDj_; originalWanted_ = rhs.originalWanted_; currentWanted_ = rhs.currentWanted_; savedBestSequence_ = rhs.savedBestSequence_; minimumObjectsScan_ = rhs.minimumObjectsScan_; minimumGoodReducedCosts_ = rhs.minimumGoodReducedCosts_; } return *this; } // Sets model void AbcMatrix::setModel(AbcSimplex * model) { model_=model; int numberColumns=model_->numberColumns(); bool needExtension=numberColumns>matrix_->getNumCols(); if (needExtension) { CoinBigIndex lastElement = matrix_->getNumElements(); matrix_->reserve(numberColumns,lastElement,true); CoinBigIndex * columnStart = matrix_->getMutableVectorStarts(); for (int i=numberColumns;i>=0;i--) { if (columnStart[i]==0) columnStart[i]=lastElement; else break; } assert (lastElement==columnStart[numberColumns]); } } /* Returns a new matrix in reverse order without gaps */ CoinPackedMatrix * AbcMatrix::reverseOrderedCopy() const { CoinPackedMatrix * matrix = new CoinPackedMatrix(); matrix->setExtraGap(0.0); matrix->setExtraMajor(0.0); matrix->reverseOrderedCopyOf(*matrix_); return matrix; } /// returns number of elements in column part of basis, CoinBigIndex AbcMatrix::countBasis( const int * whichColumn, int & numberColumnBasic) { const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); CoinBigIndex numberElements = 0; int numberRows=model_->numberRows(); // just count - can be over so ignore zero problem for (int i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]-numberRows; numberElements += columnLength[iColumn]; } return numberElements; } void AbcMatrix::fillBasis(const int * COIN_RESTRICT whichColumn, int & numberColumnBasic, int * COIN_RESTRICT indexRowU, int * COIN_RESTRICT start, int * COIN_RESTRICT rowCount, int * COIN_RESTRICT columnCount, CoinFactorizationDouble * COIN_RESTRICT elementU) { const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); CoinBigIndex numberElements = start[0]; // fill const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT row = matrix_->getIndices(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); int numberRows=model_->numberRows(); for (int i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]-numberRows; int length = columnLength[iColumn]; CoinBigIndex startThis = columnStart[iColumn]; columnCount[i] = length; CoinBigIndex endThis = startThis + length; for (CoinBigIndex j = startThis; j < endThis; j++) { int iRow = row[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; assert (elementByColumn[j]); elementU[numberElements++] = elementByColumn[j]; } start[i+1] = numberElements; } } #ifdef ABC_LONG_FACTORIZATION void AbcMatrix::fillBasis(const int * COIN_RESTRICT whichColumn, int & numberColumnBasic, int * COIN_RESTRICT indexRowU, int * COIN_RESTRICT start, int * COIN_RESTRICT rowCount, int * COIN_RESTRICT columnCount, long double * COIN_RESTRICT elementU) { const int * COIN_RESTRICT columnLength = matrix_->getVectorLengths(); CoinBigIndex numberElements = start[0]; // fill const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const int * COIN_RESTRICT row = matrix_->getIndices(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); int numberRows=model_->numberRows(); for (int i = 0; i < numberColumnBasic; i++) { int iColumn = whichColumn[i]-numberRows; int length = columnLength[iColumn]; CoinBigIndex startThis = columnStart[iColumn]; columnCount[i] = length; CoinBigIndex endThis = startThis + length; for (CoinBigIndex j = startThis; j < endThis; j++) { int iRow = row[j]; indexRowU[numberElements] = iRow; rowCount[iRow]++; assert (elementByColumn[j]); elementU[numberElements++] = elementByColumn[j]; } start[i+1] = numberElements; } } #endif #if 0 /// Move largest in column to beginning void AbcMatrix::moveLargestToStart() { // get matrix data pointers int * COIN_RESTRICT row = matrix_->getMutableIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); double * COIN_RESTRICT elementByColumn = matrix_->getMutableElements(); int numberColumns=model_->numberColumns(); CoinBigIndex start = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinBigIndex end = columnStart[iColumn+1]; double largest=0.0; int position=-1; for (CoinBigIndex j = start; j < end; j++) { double value = fabs(elementByColumn[j]); if (value>largest) { largest=value; position=j; } } assert (position>=0); // ? empty column if (position>start) { double value=elementByColumn[start]; elementByColumn[start]=elementByColumn[position]; elementByColumn[position]=value; int iRow=row[start]; row[start]=row[position]; row[position]=iRow; } start=end; } } #endif // Creates row copy void AbcMatrix::createRowCopy() { #if ABC_PARALLEL if (model_->parallelMode()==0) #endif numberRowBlocks_=1; #if ABC_PARALLEL else numberRowBlocks_=CoinMin(NUMBER_ROW_BLOCKS,model_->numberCpus()); #endif int maximumRows=model_->maximumAbcNumberRows(); int numberRows=model_->numberRows(); int numberColumns=model_->numberColumns(); int numberElements = matrix_->getNumElements(); assert (!rowStart_); char * whichBlock_=new char [numberColumns]; rowStart_=new CoinBigIndex[numberRows*(numberRowBlocks_+2)]; element_ = new double [numberElements]; column_ = new int [numberElements]; const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); memset(blockStart_,0,sizeof(blockStart_)); int ecount[10]; assert (numberRowBlocks_<16); CoinAbcMemset0(ecount,10); // allocate to blocks (put a bit less in first as will be dealing with slacks) LATER CoinBigIndex start=0; int block=0; CoinBigIndex work=(2*numberColumns+matrix_->getNumElements()+numberRowBlocks_-1)/numberRowBlocks_; CoinBigIndex thisWork=work; for (int iColumn=0;iColumn=0&&block(block); thisWork -= 2+end-start; ecount[block]+=end-start; start=end; blockStart_[block]++; if (thisWork<=0) { block++; thisWork=work; } } #if 0 printf("Blocks "); for (int i=0;igetIndices(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); // counts CoinAbcMemset0(rowStart_,numberRows*(numberRowBlocks_+2)); int * COIN_RESTRICT last = rowStart_+numberRows*(numberRowBlocks_+1); for (int iColumn=0;iColumn=0;iBlock--) blockStart_[iBlock+1]=blockStart_[iBlock]; blockStart_[0]=0; CoinBigIndex put=0; for (int iRow=1;iRow=0;iBlock--) { blockStart_[iBlock+1]=blockStart_[iBlock]+maximumRows; CoinAbcMemcpy(rowStart_+base,rowStart_+base-numberRows,numberRows); base -= numberRows; } blockStart_[0]=0;//maximumRows; delete [] whichBlock_; // and move CoinAbcMemcpy(rowStart_,last,numberRows); // All in useful CoinAbcMemcpy(rowStart_+(numberRowBlocks_+1)*numberRows, rowStart_+(numberRowBlocks_)*numberRows,numberRows); #ifdef COUNT_COPY // now blocked by element count countRealColumn_=new int [numberColumns]; int counts [2*MAX_COUNT]; memset(counts,0,sizeof(counts)); //memset(countFirst_,0,sizeof(countFirst_)); int numberLarge=0; for (int iColumn=0;iColumn=SMALL_COUNT) { n &= 3; int extra=(4-n)&3; numberExtra+= i*extra; } else { // treat as large numberLarge+=n; } } countElement_= new double [numberElements+numberExtra]; countRow_=new int [numberElements+numberExtra]; countStartLarge_ = new CoinBigIndex [numberLarge+1]; countStartLarge_[numberLarge]=numberElements+numberExtra; //return; CoinInt64 xx = reinterpret_cast(countElement_); int iBottom = static_cast(xx & 31); int offset = iBottom>>3; CoinBigIndex firstElementLarge=0; if (offset) firstElementLarge=4-offset; //countStart_[0]=firstElementLarge; int positionLarge=0; smallestCount_=0; largestCount_=0; for (int i=0;i=SMALL_COUNT) { counts[i+MAX_COUNT]=1; if (smallestCount_==0) smallestCount_=i; largestCount_=i; positionLarge+=n; firstElementLarge+=n*i; n &= 3; int extra=(4-n)&3; firstElementLarge+= i*extra; } counts[i]=0; } largestCount_++; countFirst_[MAX_COUNT]=positionLarge; countStart_[MAX_COUNT]=firstElementLarge; numberLarge=0; for (int iColumn=0;iColumnnumberRows(); CoinBigIndex * COIN_RESTRICT rowEnd = rowStart_+numberRows; const CoinBigIndex * COIN_RESTRICT rowReallyEnd = rowStart_+2*numberRows; for (int iRow=0;iRownumberRows(); bool inBranchAndBound=(model_->specialOptions(),0x1000000)!=0; bool doScaling=numberAlreadyScaled>=0; if (!doScaling) numberAlreadyScaled=0; if (numberAlreadyScaled==numberRows) return; // no need to do anything int numberColumns=model_->numberColumns(); double * COIN_RESTRICT rowScale=model_->rowScale2(); double * COIN_RESTRICT inverseRowScale=model_->inverseRowScale2(); double * COIN_RESTRICT columnScale=model_->columnScale2(); double * COIN_RESTRICT inverseColumnScale=model_->inverseColumnScale2(); // we are going to mark bits we are interested in int whichArray=model_->getAvailableArrayPublic(); char * COIN_RESTRICT usefulColumn = reinterpret_cast(model_->usefulArray(whichArray)->getIndices()); memset(usefulColumn,1,numberColumns); const double * COIN_RESTRICT rowLower = model_->rowLower(); const double * COIN_RESTRICT rowUpper = model_->rowUpper(); const double * COIN_RESTRICT columnLower = model_->columnLower(); const double * COIN_RESTRICT columnUpper = model_->columnUpper(); //#define LEAVE_FIXED // mark empty and fixed columns // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); double * COIN_RESTRICT elementByColumn = matrix_->getMutableElements(); CoinPackedMatrix * COIN_RESTRICT rowCopy = reverseOrderedCopy(); const int * column = rowCopy->getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = rowCopy->getVectorStarts(); const double * COIN_RESTRICT element = rowCopy->getElements(); assert (numberAlreadyScaled>=0&&numberAlreadyScaledstart) { for (CoinBigIndex j = start; j < end; j++) { double value = fabs(elementByColumn[j]); overallLargest = CoinMax(overallLargest, value); overallSmallest = CoinMin(overallSmallest, value); } } else { usefulColumn[iColumn]=0; } } start=end; } } else { CoinBigIndex start = rowStart[numberAlreadyScaled]; for (int iRow = numberAlreadyScaled; iRow < numberRows; iRow++) { rowScale[iRow]=1.0; CoinBigIndex end = rowStart[iRow+1]; for (CoinBigIndex j = start; j < end; j++) { int iColumn=column[j]; if (usefulColumn[iColumn]) { double value = fabs(elementByColumn[j])*columnScale[iColumn]; overallLargest = CoinMax(overallLargest, value); overallSmallest = CoinMin(overallSmallest, value); } } } } if ((overallSmallest >= 0.5 && overallLargest <= 2.0)||!doScaling) { //printf("no scaling\n"); delete rowCopy; model_->clearArraysPublic(whichArray); CoinFillN(inverseRowScale+numberAlreadyScaled,numberRows-numberAlreadyScaled,1.0); if (!numberAlreadyScaled) CoinFillN(inverseColumnScale,numberColumns,1.0); //moveLargestToStart(); return ; } // need to scale double largest; double smallest; int scalingMethod=model_->scalingFlag(); if (scalingMethod == 4) { // As auto scalingMethod = 3; } else if (scalingMethod == 5) { // As geometric scalingMethod = 2; } double savedOverallRatio = 0.0; double tolerance = 5.0 * model_->primalTolerance(); bool finished = false; // if scalingMethod 3 then may change bool extraDetails = (model_->logLevel() > 2); bool secondTime=false; while (!finished) { int numberPass = !numberAlreadyScaled ? 3 : 1; overallLargest = -1.0e-20; overallSmallest = 1.0e20; if (!secondTime) { secondTime=true; } else { CoinFillN ( rowScale, numberRows, 1.0); CoinFillN ( columnScale, numberColumns, 1.0); } if (scalingMethod == 1 || scalingMethod == 3) { // Maximum in each row for (int iRow = numberAlreadyScaled; iRow < numberRows; iRow++) { largest = 1.0e-10; for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { double value = fabs(element[j]); largest = CoinMax(largest, value); assert (largest < 1.0e40); } } rowScale[iRow] = 1.0 / largest; #ifdef COIN_DEVELOP if (extraDetails) { overallLargest = CoinMax(overallLargest, largest); overallSmallest = CoinMin(overallSmallest, largest); } #endif } } else { while (numberPass) { overallLargest = 0.0; overallSmallest = 1.0e50; numberPass--; // Geometric mean on row scales for (int iRow = numberAlreadyScaled; iRow < numberRows; iRow++) { largest = 1.0e-50; smallest = 1.0e50; for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow+1]; j++) { int iColumn = column[j]; if (usefulColumn[iColumn]) { double value = fabs(element[j]); value *= columnScale[iColumn]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } #ifdef SQRT_ARRAY rowScale[iRow] = smallest * largest; #else rowScale[iRow] = 1.0 / sqrt(smallest * largest); #endif if (extraDetails) { overallLargest = CoinMax(largest * rowScale[iRow], overallLargest); overallSmallest = CoinMin(smallest * rowScale[iRow], overallSmallest); } } if (model_->scalingFlag() == 5) break; // just scale rows #ifdef SQRT_ARRAY CoinAbcInverseSqrts(rowScale, numberRows); #endif if (!inBranchAndBound) model_->messageHandler()->message(CLP_PACKEDSCALE_WHILE, *model_->messagesPointer()) << overallSmallest << overallLargest << CoinMessageEol; // skip last column round if (numberPass == 1) break; // Geometric mean on column scales for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { largest = 1.0e-50; smallest = 1.0e50; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; double value = fabs(elementByColumn[j]); value *= rowScale[iRow]; largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } #ifdef SQRT_ARRAY columnScale[iColumn] = smallest * largest; #else columnScale[iColumn] = 1.0 / sqrt(smallest * largest); #endif } } #ifdef SQRT_ARRAY CoinAbcInverseSqrts(columnScale, numberColumns); #endif } } // If ranges will make horrid then scale for (int iRow = numberAlreadyScaled; iRow < numberRows; iRow++) { double difference = rowUpper[iRow] - rowLower[iRow]; double scaledDifference = difference * rowScale[iRow]; if (scaledDifference > tolerance && scaledDifference < 1.0e-4) { // make gap larger rowScale[iRow] *= 1.0e-4 / scaledDifference; rowScale[iRow] = CoinMax(1.0e-10, CoinMin(1.0e10, rowScale[iRow])); //printf("Row %d difference %g scaled diff %g => %g\n",iRow,difference, // scaledDifference,difference*rowScale[iRow]); } } // final pass to scale columns so largest is reasonable // See what smallest will be if largest is 1.0 if (model_->scalingFlag() != 5) { overallSmallest = 1.0e50; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { largest = 1.0e-20; smallest = 1.0e50; for (CoinBigIndex j = columnStart[iColumn];j < columnStart[iColumn+1]; j++) { int iRow = row[j]; double value = fabs(elementByColumn[j] * rowScale[iRow]); largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } if (overallSmallest * largest > smallest) overallSmallest = smallest / largest; } } } if (scalingMethod == 1 || scalingMethod == 2) { finished = true; } else if (savedOverallRatio == 0.0 && scalingMethod != 4) { savedOverallRatio = overallSmallest; scalingMethod = 4; } else { assert (scalingMethod == 4); if (overallSmallest > 2.0 * savedOverallRatio) { finished = true; // geometric was better if (model_->scalingFlag() == 4) { // If in Branch and bound change if ((model_->specialOptions() & 1024) != 0) { model_->scaling(2); } } } else { scalingMethod = 1; // redo equilibrium if (model_->scalingFlag() == 4) { // If in Branch and bound change if ((model_->specialOptions() & 1024) != 0) { model_->scaling(1); } } } #if 0 if (extraDetails) { if (finished) printf("equilibrium ratio %g, geometric ratio %g , geo chosen\n", savedOverallRatio, overallSmallest); else printf("equilibrium ratio %g, geometric ratio %g , equi chosen\n", savedOverallRatio, overallSmallest); } #endif } } //#define RANDOMIZE #ifdef RANDOMIZE // randomize by up to 10% for (int iRow = numberAlreadyScaled; iRow < numberRows; iRow++) { double value = 0.5 - randomNumberGenerator_.randomDouble(); //between -0.5 to + 0.5 rowScale[iRow] *= (1.0 + 0.1 * value); } #endif overallLargest = 1.0; if (overallSmallest < 1.0e-1) overallLargest = 1.0 / sqrt(overallSmallest); overallLargest = CoinMin(100.0, overallLargest); overallSmallest = 1.0e50; char * COIN_RESTRICT usedRow = reinterpret_cast(inverseRowScale); memset(usedRow, 0, numberRows); //printf("scaling %d\n",model_->scalingFlag()); if (model_->scalingFlag() != 5) { for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (usefulColumn[iColumn]) { largest = 1.0e-20; smallest = 1.0e50; for (CoinBigIndex j = columnStart[iColumn];j < columnStart[iColumn+1]; j++) { int iRow = row[j]; usedRow[iRow] = 1; double value = fabs(elementByColumn[j] * rowScale[iRow]); largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } columnScale[iColumn] = overallLargest / largest; //columnScale[iColumn]=CoinMax(1.0e-10,CoinMin(1.0e10,columnScale[iColumn])); #ifdef RANDOMIZE if (!numberAlreadyScaled) { double value = 0.5 - randomNumberGenerator_.randomDouble(); //between -0.5 to + 0.5 columnScale[iColumn] *= (1.0 + 0.1 * value); } #endif double difference = columnUpper[iColumn] - columnLower[iColumn]; if (difference < 1.0e-5 * columnScale[iColumn]) { // make gap larger columnScale[iColumn] = difference / 1.0e-5; //printf("Column %d difference %g scaled diff %g => %g\n",iColumn,difference, // scaledDifference,difference*columnScale[iColumn]); } double value = smallest * columnScale[iColumn]; if (overallSmallest > value) overallSmallest = value; //overallSmallest = CoinMin(overallSmallest,smallest*columnScale[iColumn]); } else { assert(columnScale[iColumn] == 1.0); //columnScale[iColumn]=1.0; } } for (int iRow = numberAlreadyScaled; iRow < numberRows; iRow++) { if (!usedRow[iRow]) { rowScale[iRow] = 1.0; } } } if (!inBranchAndBound) model_->messageHandler()->message(CLP_PACKEDSCALE_FINAL, *model_->messagesPointer()) << overallSmallest << overallLargest << CoinMessageEol; if (overallSmallest < 1.0e-13) { // Change factorization zero tolerance double newTolerance = CoinMax(1.0e-15 * (overallSmallest / 1.0e-13), 1.0e-18); if (model_->factorization()->zeroTolerance() > newTolerance) model_->factorization()->zeroTolerance(newTolerance); newTolerance = CoinMax(overallSmallest * 0.5, 1.0e-18); model_->setZeroTolerance(newTolerance); #ifndef NDEBUG assert (newTolerance<0.0); // just so we can fix #endif } // make copy (could do faster by using previous values) // could just do partial CoinAbcReciprocal(inverseRowScale+numberAlreadyScaled,numberRows-numberAlreadyScaled, rowScale+numberAlreadyScaled); if (!numberAlreadyScaled) CoinAbcReciprocal(inverseColumnScale,numberColumns,columnScale); // Do scaled copy //NO and move largest to start CoinBigIndex start = 0; for (int iColumn = 0; iColumn < numberColumns; iColumn++) { double scale=columnScale[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; for (CoinBigIndex j = start; j < end; j++) { double value=elementByColumn[j]; int iRow = row[j]; if (iRow>=numberAlreadyScaled) { value*= scale*rowScale[iRow]; elementByColumn[j]= value; } } start=end; } delete rowCopy; #if 0 if (model_->rowCopy()) { // need to replace row by row CoinPackedMatrix * rowCopy = NULL; //static_cast< AbcMatrix*>(model_->rowCopy()); double * element = rowCopy->getMutableElements(); const int * column = rowCopy->getIndices(); const CoinBigIndex * rowStart = rowCopy->getVectorStarts(); // scale row copy for (iRow = 0; iRow < numberRows; iRow++) { CoinBigIndex j; double scale = rowScale[iRow]; double * elementsInThisRow = element + rowStart[iRow]; const int * columnsInThisRow = column + rowStart[iRow]; int number = rowStart[iRow+1] - rowStart[iRow]; assert (number <= numberColumns); for (j = 0; j < number; j++) { int iColumn = columnsInThisRow[j]; elementsInThisRow[j] *= scale * columnScale[iColumn]; } } } #endif model_->clearArraysPublic(whichArray); } /* Return y + A * scalar *x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ //scaled versions void AbcMatrix::timesModifyExcludingSlacks(double scalar, const double * x, double * y) const { int numberTotal = model_->numberTotal(); int maximumRows = model_->maximumAbcNumberRows(); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); for (int iColumn = maximumRows; iColumn < numberTotal; iColumn++) { double value = x[iColumn]; if (value) { CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = columnStart[iColumn+1]; value *= scalar; for (CoinBigIndex j = start; j < end; j++) { int iRow = row[j]; y[iRow] += value * elementByColumn[j]; } } } } /* Return y + A * scalar(+-1) *x in y. @pre x must be of size numColumns()+numRows() @pre y must be of size numRows() */ void AbcMatrix::timesModifyIncludingSlacks(double scalar, const double * x, double * y) const { int numberRows=model_->numberRows(); int numberTotal = model_->numberTotal(); int maximumRows = model_->maximumAbcNumberRows(); // makes no sense for x==y?? assert (x!=y); // For now just by column and assumes already scaled (use reallyScale) // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); if (scalar==1.0) { // add if (x!=y) { for (int i=0;i in y. @pre x must be of size numColumns()+numRows() @pre y must be of size numRows() */ void AbcMatrix::timesIncludingSlacks(double scalar, const double * x, double * y) const { int numberRows=model_->numberRows(); int numberTotal = model_->numberTotal(); int maximumRows = model_->maximumAbcNumberRows(); // For now just by column and assumes already scaled (use reallyScale) // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); if (scalar==1.0) { // add if (x!=y) { for (int i=0;idjRegion(); const unsigned char * COIN_RESTRICT internalStatus = model->internalStatus(); // do first pass to get possibles double bestPossible = 0.0; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; // try with this much smaller as guess double acceptablePivot = model->currentAcceptablePivot(); double dualT=-model->currentDualTolerance(); // fixed will have been taken out by now const double multiplier[] = { 1.0, -1.0}; freeSequence=-1; int firstIn=model->abcMatrix()->blockStart(iBlock); int numberNonZero=tableauRow.getNumElements(iBlock)+firstIn; int numberRemaining=firstIn; //first=tableauRow.getNumElements(); // could pass in last and if numberNonZero==last-firstIn scan as well if (model->ordinaryVariables()) { for (int i = firstIn; i < numberNonZero; i++) { int iSequence = index[i]; double tableauValue=array[i]; unsigned char iStatus=internalStatus[iSequence]&7; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } else { double badFree = 0.0; double freeAlpha = model->currentAcceptablePivot(); int freeSequenceIn=model->freeSequenceIn(); double currentDualTolerance = model->currentDualTolerance(); for (int i = firstIn; i < numberNonZero; i++) { int iSequence = index[i]; double tableauValue=array[i]; unsigned char iStatus=internalStatus[iSequence]&7; if ((iStatus&4)==0) { double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } else { bool keep; bestPossible = CoinMax(bestPossible, fabs(tableauValue)); double oldValue = abcDj[iSequence]; // If free has to be very large - should come in via dualRow //if (getInternalStatus(iSequence+addSequence)==isFree&&fabs(tableauValue)<1.0e-3) //break; if (oldValue > currentDualTolerance) { keep = true; } else if (oldValue < -currentDualTolerance) { keep = true; } else { if (fabs(tableauValue) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) { keep = true; } else { keep = false; badFree = CoinMax(badFree, fabs(tableauValue)); } } if (keep) { #ifdef PAN if (model->fakeSuperBasic(iSequence)>=0) { #endif if (iSequence==freeSequenceIn) tableauValue=COIN_DBL_MAX; // free - choose largest if (fabs(tableauValue) > fabs(freeAlpha)) { freeAlpha = tableauValue; freeSequence = iSequence; } #ifdef PAN } #endif } } } } //firstInX=numberNonZero-firstIn; //lastInX=-1;//numberRemaining-lastInX; tableauRow.setNumElementsPartition(iBlock,numberNonZero-firstIn); candidateList.setNumElementsPartition(iBlock,numberRemaining-firstIn); return upperTheta; } // gets sorted tableau row and a possible value of theta double AbcMatrix::dualColumn1Row(int iBlock, double upperTheta, int & freeSequence, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const { int maximumRows = model_->maximumAbcNumberRows(); int number=update.getNumElements(); const double * COIN_RESTRICT pi=update.denseVector(); const int * COIN_RESTRICT piIndex = update.getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = rowStart_; int numberRows=model_->numberRows(); const CoinBigIndex * COIN_RESTRICT rowEnd = rowStart+numberRows*numberRowBlocks_; // count down int nColumns; int firstIn=blockStart_[iBlock]; int first=firstIn; if (!first) first=maximumRows; int last=blockStart_[iBlock+1]; nColumns=last-first; int target=nColumns; rowStart += iBlock*numberRows; rowEnd = rowStart+numberRows; for (int i=0;i0) { //printf("going to few %d ops %d\n",number,nColumns-target); return dualColumn1RowFew(iBlock, upperTheta, freeSequence, update, tableauRow, candidateList); } const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); const double * COIN_RESTRICT element = element_; const int * COIN_RESTRICT column = column_; for (int i=0;i=first&&iColumn(model_)->dualColumn1A(); numberNonZero=tableauRow.getNumElements(0); numberRemaining=candidateList.getNumElements(0); #else numberNonZero=0; for (int i=0;idjRegion(); // do first pass to get possibles double bestPossible = 0.0; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; // try with this much smaller as guess double acceptablePivot = model_->currentAcceptablePivot(); double dualT=-model_->currentDualTolerance(); const double multiplier[] = { 1.0, -1.0}; double zeroTolerance = model_->zeroTolerance(); freeSequence=-1; if (model_->ordinaryVariables()) { for (int iSequence = first; iSequence < last; iSequence++) { double tableauValue=array[iSequence]; if (tableauValue) { array[iSequence]=0.0; if (fabs(tableauValue)>zeroTolerance) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<4) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } } } } else { double badFree = 0.0; double freeAlpha = model_->currentAcceptablePivot(); int freeSequenceIn=model_->freeSequenceIn(); //printf("block %d freeSequence %d acceptable %g\n",iBlock,freeSequenceIn,freeAlpha); double currentDualTolerance = model_->currentDualTolerance(); for (int iSequence = first; iSequence < last; iSequence++) { double tableauValue=array[iSequence]; if (tableauValue) { array[iSequence]=0.0; if (fabs(tableauValue)>zeroTolerance) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<6) { if ((iStatus&4)==0) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } else { bool keep; index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; bestPossible = CoinMax(bestPossible, fabs(tableauValue)); double oldValue = abcDj[iSequence]; // If free has to be very large - should come in via dualRow //if (getInternalStatus(iSequence+addSequence)==isFree&&fabs(tableauValue)<1.0e-3) //break; // may be fake super basic if (oldValue > currentDualTolerance) { keep = true; } else if (oldValue < -currentDualTolerance) { keep = true; } else { if (fabs(tableauValue) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) { keep = true; } else { keep = false; badFree = CoinMax(badFree, fabs(tableauValue)); } } #if 0 if (iSequence==freeSequenceIn) assert (keep); #endif if (keep) { #ifdef PAN if (model_->fakeSuperBasic(iSequence)>=0) { #endif if (iSequence==freeSequenceIn) tableauValue=COIN_DBL_MAX; // free - choose largest if (fabs(tableauValue) > fabs(freeAlpha)) { freeAlpha = tableauValue; freeSequence = iSequence; } #ifdef PAN } #endif } } } } } } } #if 0 if (model_->freeSequenceIn()>=first&&model_->freeSequenceIn()freeSequenceIn()); extern int xxInfo[6][8]; xxInfo[0][iBlock]=first; xxInfo[1][iBlock]=last; xxInfo[2][iBlock]=firstIn; xxInfo[3][iBlock]=numberNonZero-firstIn; xxInfo[4][iBlock]=numberRemaining-firstIn; #endif tableauRow.setNumElementsPartition(iBlock,numberNonZero-firstIn); candidateList.setNumElementsPartition(iBlock,numberRemaining-firstIn); return upperTheta; } // gets sorted tableau row and a possible value of theta double AbcMatrix::dualColumn1Row2(double upperTheta, int & freeSequence, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const { //int first=model_->maximumAbcNumberRows(); assert(update.getNumElements()==2); const double * COIN_RESTRICT pi=update.denseVector(); const int * COIN_RESTRICT piIndex = update.getIndices(); int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); const CoinBigIndex * COIN_RESTRICT rowStart = rowStart_; int numberRows=model_->numberRows(); const CoinBigIndex * COIN_RESTRICT rowEnd = rowStart+numberRows*numberRowBlocks_; const double * COIN_RESTRICT element = element_; const int * COIN_RESTRICT column = column_; int iRow0 = piIndex[0]; int iRow1 = piIndex[1]; CoinBigIndex end0 = rowEnd[iRow0]; CoinBigIndex end1 = rowEnd[iRow1]; if (end0-rowStart[iRow0]>end1-rowStart[iRow1]) { int temp=iRow0; iRow0=iRow1; iRow1=temp; } CoinBigIndex start = rowStart[iRow0]; CoinBigIndex end = rowEnd[iRow0]; double piValue = pi[iRow0]; double * COIN_RESTRICT arrayCandidate=candidateList.denseVector(); int numberNonZero; numberNonZero=tableauRow.getNumElements(0); int n=numberNonZero; for (CoinBigIndex j=start;jinternalStatus(); double zeroTolerance = model_->zeroTolerance(); while (numberNonZerozeroTolerance&&iStatus<6) { index[numberNonZero]=iSequence; array[numberNonZero++]=value; } else { // kill n--; index[numberNonZero]=index[n]; } } tableauRow.setNumElementsPartition(0,numberNonZero); return firstPass(model_,0, upperTheta, freeSequence, tableauRow, candidateList) ; } //static int ixxxxxx=1; // gets sorted tableau row and a possible value of theta double AbcMatrix::dualColumn1RowFew(int iBlock, double upperTheta, int & freeSequence, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const { //int first=model_->maximumAbcNumberRows(); int number = update.getNumElements(); const double * COIN_RESTRICT pi=update.denseVector(); const int * COIN_RESTRICT piIndex = update.getIndices(); int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); const CoinBigIndex * COIN_RESTRICT rowStart = rowStart_; int numberRows=model_->numberRows(); const CoinBigIndex * COIN_RESTRICT rowEnd = rowStart+numberRows*numberRowBlocks_; const double * COIN_RESTRICT element = element_; const int * COIN_RESTRICT column = column_; double * COIN_RESTRICT arrayCandidate=candidateList.denseVector(); int numberNonZero; assert (iBlock>=0); const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); int firstIn=blockStart_[iBlock]; if (iBlock==0) { numberNonZero=0; for (int i=0;izeroTolerance(); while (numberNonZerozeroTolerance&&iStatus<6) { index[numberNonZero]=iSequence; array[numberNonZero++]=value; } else { // kill n--; index[numberNonZero]=index[n]; } } tableauRow.setNumElementsPartition(iBlock,numberNonZero-firstIn); upperTheta = firstPass(model_,iBlock, upperTheta, freeSequence, tableauRow, candidateList) ; return upperTheta; } // gets sorted tableau row and a possible value of theta double AbcMatrix::dualColumn1Row1(double upperTheta, int & freeSequence, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const { assert(update.getNumElements()==1); int iRow = update.getIndices()[0]; double piValue = update.denseVector()[iRow]; int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); const CoinBigIndex * COIN_RESTRICT rowStart = rowStart_; int numberRows=model_->numberRows(); const CoinBigIndex * COIN_RESTRICT rowEnd = rowStart+numberRows*numberRowBlocks_; CoinBigIndex start = rowStart[iRow]; CoinBigIndex end = rowEnd[iRow]; const double * COIN_RESTRICT element = element_; const int * COIN_RESTRICT column = column_; int numberNonZero; int numberRemaining; numberNonZero=tableauRow.getNumElements(0); numberRemaining = candidateList.getNumElements(0); double * COIN_RESTRICT arrayCandidate=candidateList.denseVector(); int * COIN_RESTRICT indexCandidate = candidateList.getIndices(); const double * COIN_RESTRICT abcDj = model_->djRegion(); const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); // do first pass to get possibles double bestPossible = 0.0; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; // try with this much smaller as guess double acceptablePivot = model_->currentAcceptablePivot(); double dualT=-model_->currentDualTolerance(); const double multiplier[] = { 1.0, -1.0}; double zeroTolerance = model_->zeroTolerance(); freeSequence=-1; if (model_->ordinaryVariables()) { for (CoinBigIndex j=start;jzeroTolerance) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<4) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } } } else { double badFree = 0.0; double freeAlpha = model_->currentAcceptablePivot(); int freeSequenceIn=model_->freeSequenceIn(); double currentDualTolerance = model_->currentDualTolerance(); for (CoinBigIndex j=start;jzeroTolerance) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<6) { if ((iStatus&4)==0) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } else { bool keep; index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; bestPossible = CoinMax(bestPossible, fabs(tableauValue)); double oldValue = abcDj[iSequence]; // If free has to be very large - should come in via dualRow //if (getInternalStatus(iSequence+addSequence)==isFree&&fabs(tableauValue)<1.0e-3) //break; if (oldValue > currentDualTolerance) { keep = true; } else if (oldValue < -currentDualTolerance) { keep = true; } else { if (fabs(tableauValue) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) { keep = true; } else { keep = false; badFree = CoinMax(badFree, fabs(tableauValue)); } } if (keep) { #ifdef PAN if (model_->fakeSuperBasic(iSequence)>=0) { #endif if (iSequence==freeSequenceIn) tableauValue=COIN_DBL_MAX; // free - choose largest if (fabs(tableauValue) > fabs(freeAlpha)) { freeAlpha = tableauValue; freeSequence = iSequence; } #ifdef PAN } #endif } } } } } } tableauRow.setNumElementsPartition(0,numberNonZero); candidateList.setNumElementsPartition(0,numberRemaining); return upperTheta; } //#define PARALLEL2 #ifdef PARALLEL2 #undef cilk_for #undef cilk_spawn #undef cilk_sync #include #include #endif #if 0 static void compact(int numberBlocks,CoinIndexedVector * vector,const int * starts,const int * lengths) { int numberNonZeroIn=vector->getNumElements(); int * index = vector->getIndices(); double * array = vector->denseVector(); CoinAbcCompact(numberBlocks,numberNonZeroIn, array,starts,lengths); int numberNonZero = CoinAbcCompact(numberBlocks,numberNonZeroIn, index,starts,lengths); vector->setNumElements(numberNonZero); } static void compactBoth(int numberBlocks,CoinIndexedVector * vector1,CoinIndexedVector * vector2, const int * starts,const int * lengths1, const int * lengths2) { cilk_spawn compact(numberBlocks,vector1,starts,lengths1); compact(numberBlocks,vector2,starts,lengths2); cilk_sync; } #endif void AbcMatrix::rebalance() const { int maximumRows = model_->maximumAbcNumberRows(); int numberTotal = model_->numberTotal(); /* rebalance For non-vector version each basic etc column is 1 each real column is 5+2*nel each basic slack is 0 each real slack is 3 */ #if ABC_PARALLEL int howOften=CoinMax(model_->factorization()->maximumPivots(),200); if ((model_->numberIterations()%howOften)==0||!startColumnBlock_[1]) { int numberCpus=model_->numberCpus(); if (numberCpus>1) { const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); int numberRows=model_->numberRows(); int total=0; for (int iSequence=0;iSequencechunk) { iCpu++; total=0; startColumnBlock_[iCpu]=iSequence; } } assert(iCpunumberTotal(); // rebalance rebalance(); tableauRow.setPackedMode(true); candidateList.setPackedMode(true); int number=update.getNumElements(); double upperTheta; if (rowStart_&&number<3) { #if ABC_INSTRUMENT>1 { int n=update.getNumElements(); abcPricing[n<19 ? n : 19]++; } #endif // always do serially // do slacks first int starts[2]; starts[0]=0; starts[1]=numberTotal; tableauRow.setPartitions(1,starts); candidateList.setPartitions(1,starts); upperTheta = static_cast(model_)->dualColumn1A(); //assert (upperTheta>-100*model_->dualTolerance()||model_->sequenceIn()>=0||model_->lastFirstFree()>=0); int freeSequence=-1; // worth using row copy assert (number); if (number==2) { upperTheta=dualColumn1Row2(upperTheta,freeSequence,update,tableauRow,candidateList); } else { upperTheta=dualColumn1Row1(upperTheta,freeSequence,update,tableauRow,candidateList); } if (freeSequence>=0) { int numberNonZero=tableauRow.getNumElements(0); const int * COIN_RESTRICT index = tableauRow.getIndices(); const double * COIN_RESTRICT array = tableauRow.denseVector(); // search for free coming in double freeAlpha=0.0; int bestSequence=model_->sequenceIn(); if (bestSequence>=0) freeAlpha=model_->alpha(); index = tableauRow.getIndices(); array = tableauRow.denseVector(); // free variable - search for (int k=0;ksequenceIn()<0||fabs(freeAlpha)>fabs(model_->alpha())) { double oldValue = model_->djRegion()[freeSequence]; model_->setSequenceIn(freeSequence); model_->setAlpha(freeAlpha); model_->setTheta(oldValue / freeAlpha); } } } else { // three or more // need to do better job on dividing up (but wait until vector or by row) upperTheta = parallelDual4(static_cast(model_)); } //tableauRow.compact(); //candidateList.compact(); #if 0 //ndef NDEBUG model_->checkArrays(); #endif candidateList.computeNumberElements(); int numberRemaining=candidateList.getNumElements(); if (!numberRemaining&&model_->sequenceIn()<0) { return COIN_DBL_MAX; // Looks infeasible } else { return upperTheta; } } #define _mm256_broadcast_sd(x) static_cast<__m256d> (__builtin_ia32_vbroadcastsd256 (x)) #define _mm256_load_pd(x) *(__m256d *)(x) #define _mm256_store_pd (s, x) *((__m256d *)s)=x void AbcMatrix::dualColumn1Part(int iBlock, int & sequenceIn, double & upperThetaResult, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow,CoinPartitionedVector & candidateList) const { double upperTheta=upperThetaResult; #if 0 double time0=CoinCpuTime(); #endif int maximumRows = model_->maximumAbcNumberRows(); int firstIn=startColumnBlock_[iBlock]; int last = startColumnBlock_[iBlock+1]; int numberNonZero; int numberRemaining; int first; if (firstIn==0) { upperTheta=static_cast(model_)->dualColumn1A(); numberNonZero=tableauRow.getNumElements(0); numberRemaining = candidateList.getNumElements(0); first=maximumRows; } else { first=firstIn; numberNonZero=first; numberRemaining=first; } sequenceIn=-1; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT pi=update.denseVector(); //const int * COIN_RESTRICT piIndex = update.getIndices(); int * COIN_RESTRICT index = tableauRow.getIndices(); double * COIN_RESTRICT array = tableauRow.denseVector(); // pivot elements double * COIN_RESTRICT arrayCandidate=candidateList.denseVector(); // indices int * COIN_RESTRICT indexCandidate = candidateList.getIndices(); const double * COIN_RESTRICT abcDj = model_->djRegion(); const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); // do first pass to get possibles double bestPossible = 0.0; // We can also see if infeasible or pivoting on free double tentativeTheta = 1.0e25; // try with this much smaller as guess double acceptablePivot = model_->currentAcceptablePivot(); double dualT=-model_->currentDualTolerance(); const double multiplier[] = { 1.0, -1.0}; double zeroTolerance = model_->zeroTolerance(); if (model_->ordinaryVariables()) { #ifdef COUNT_COPY if (first>maximumRows||lastnumberTotal()||false) { #endif #if 1 for (int iSequence = first; iSequence < last; iSequence++) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<4) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; double tableauValue = 0.0; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; tableauValue += pi[jRow] * elementByColumn[j]; } if (fabs(tableauValue)>zeroTolerance) { #else cilk_for (int iSequence = first; iSequence < last; iSequence++) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<4) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; double tableauValue = 0.0; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; tableauValue += pi[jRow] * elementByColumn[j]; } array[iSequence]=tableauValue; } } //printf("time %.6g\n",CoinCpuTime()-time0); for (int iSequence = first; iSequence < last; iSequence++) { double tableauValue=array[iSequence]; if (tableauValue) { array[iSequence]=0.0; if (fabs(tableauValue)>zeroTolerance) { unsigned char iStatus=internalStatus[iSequence]&7; #endif index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } } #ifdef COUNT_COPY } else { const double * COIN_RESTRICT element = countElement_; const int * COIN_RESTRICT row = countRow_; double temp[4] __attribute__ ((aligned (32))); memset(temp,0,sizeof(temp)); for (int iCount=smallestCount_;iCount>2; number &= 3; for (int iBlock=0;iBlockzeroTolerance) { int iSequence=sequence[0]; unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<4) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue0; double mult = multiplier[iStatus]; double alpha = tableauValue0 * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } if (fabs(tableauValue1)>zeroTolerance) { int iSequence=sequence[1]; unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<4) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue1; double mult = multiplier[iStatus]; double alpha = tableauValue1 * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } if (fabs(tableauValue2)>zeroTolerance) { int iSequence=sequence[2]; unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<4) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue2; double mult = multiplier[iStatus]; double alpha = tableauValue2 * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } if (fabs(tableauValue3)>zeroTolerance) { int iSequence=sequence[3]; unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<4) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue3; double mult = multiplier[iStatus]; double alpha = tableauValue3 * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } sequence+=4; } for (int i=0;izeroTolerance) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } blockRow++; blockElement++; } } int numberColumns=model_->numberColumns(); // large ones const CoinBigIndex * COIN_RESTRICT largeStart = countStartLarge_-countFirst_[MAX_COUNT]; for (int i=countFirst_[MAX_COUNT];izeroTolerance) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } } } } #endif } else { double badFree = 0.0; double freePivot = model_->currentAcceptablePivot(); int freeSequenceIn=model_->freeSequenceIn(); double currentDualTolerance = model_->currentDualTolerance(); for (int iSequence = first; iSequence < last; iSequence++) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<6) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; double tableauValue = 0.0; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; tableauValue += pi[jRow] * elementByColumn[j]; } if (fabs(tableauValue)>zeroTolerance) { if ((iStatus&4)==0) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = abcDj[iSequence] * mult; double value = oldValue - tentativeTheta * alpha; if (value < dualT) { bestPossible = CoinMax(bestPossible, alpha); value = oldValue - upperTheta * alpha; if (value < dualT && alpha >= acceptablePivot) { upperTheta = (oldValue - dualT) / alpha; } // add to list arrayCandidate[numberRemaining] = alpha; indexCandidate[numberRemaining++] = iSequence; } } else { bool keep; index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; bestPossible = CoinMax(bestPossible, fabs(tableauValue)); double oldValue = abcDj[iSequence]; // If free has to be very large - should come in via dualRow //if (getInternalStatus(iSequence+addSequence)==isFree&&fabs(tableauValue)<1.0e-3) //break; if (oldValue > currentDualTolerance) { keep = true; } else if (oldValue < -currentDualTolerance) { keep = true; } else { if (fabs(tableauValue) > CoinMax(10.0 * acceptablePivot, 1.0e-5)) { keep = true; } else { keep = false; badFree = CoinMax(badFree, fabs(tableauValue)); } } if (keep) { #ifdef PAN if (model_->fakeSuperBasic(iSequence)>=0) { #endif if (iSequence==freeSequenceIn) tableauValue=COIN_DBL_MAX; // free - choose largest if (fabs(tableauValue) > fabs(freePivot)) { freePivot = tableauValue; sequenceIn = iSequence; } #ifdef PAN } #endif } } } } } } // adjust numberNonZero -= firstIn; numberRemaining -= firstIn; tableauRow.setNumElementsPartition(iBlock,numberNonZero); candidateList.setNumElementsPartition(iBlock,numberRemaining); if (!numberRemaining&&model_->sequenceIn()<0) { upperThetaResult=COIN_DBL_MAX; // Looks infeasible } else { upperThetaResult=upperTheta; } } // gets tableau row - returns number of slacks in block int AbcMatrix::primalColumnRow(int iBlock,bool doByRow,const CoinIndexedVector & updates, CoinPartitionedVector & tableauRow) const { int maximumRows = model_->maximumAbcNumberRows(); int first=tableauRow.startPartition(iBlock); int last=tableauRow.startPartition(iBlock+1); if (doByRow) { assert(first==blockStart_[iBlock]); assert(last==blockStart_[iBlock+1]); } else { assert(first==startColumnBlock_[iBlock]); assert(last==startColumnBlock_[iBlock+1]); } int numberSlacks=updates.getNumElements(); int numberNonZero=0; const double * COIN_RESTRICT pi=updates.denseVector(); const int * COIN_RESTRICT piIndex = updates.getIndices(); int * COIN_RESTRICT index = tableauRow.getIndices()+first; double * COIN_RESTRICT array = tableauRow.denseVector()+first; const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); if (!iBlock) { numberNonZero=numberSlacks; for (int i=0;izeroTolerance(); if (doByRow) { int numberRows=model_->numberRows(); const CoinBigIndex * COIN_RESTRICT rowStart = rowStart_+iBlock*numberRows; const CoinBigIndex * COIN_RESTRICT rowEnd = rowStart+numberRows; const double * COIN_RESTRICT element = element_; const int * COIN_RESTRICT column = column_; if (numberSlacks>1) { double * COIN_RESTRICT arrayTemp = tableauRow.denseVector(); for (int i=0;izeroTolerance) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<6) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; } } } } } else { int iRow=piIndex[0]; double piValue = pi[iRow]; CoinBigIndex end = rowEnd[iRow]; for (CoinBigIndex j=rowStart[iRow];jzeroTolerance) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<6) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; } } } } } else { // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT pi=updates.denseVector(); for (int iSequence = first; iSequence < last; iSequence++) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<6) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; double tableauValue = 0.0; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; tableauValue += pi[jRow] * elementByColumn[j]; } if (fabs(tableauValue)>zeroTolerance) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; } } } } tableauRow.setNumElementsPartition(iBlock,numberNonZero); return numberSlacks; } // Get sequenceIn when Dantzig int AbcMatrix::pivotColumnDantzig(const CoinIndexedVector & updates, CoinPartitionedVector & spare) const { int maximumRows = model_->maximumAbcNumberRows(); // rebalance rebalance(); spare.setPackedMode(true); bool useRowCopy=false; if (rowStart_) { // see if worth using row copy int number=updates.getNumElements(); assert (number); useRowCopy = (number<<2)numberCpus()); #else #define NUMBER_BLOCKS 1 int numberBlocks=NUMBER_BLOCKS; #endif #if ABC_PARALLEL if (model_->parallelMode()==0) numberBlocks=1; #endif spare.setPartitions(numberBlocks,starts); int which[NUMBER_BLOCKS]; double best[NUMBER_BLOCKS]; for (int i=0;idualTolerance(); for (int i=0;ibestValue) { bestValue=best[i]; bestSequence=which[i]; } } return bestSequence; } // Get sequenceIn when Dantzig (One block) int AbcMatrix::pivotColumnDantzig(int iBlock, bool doByRow,const CoinIndexedVector & updates, CoinPartitionedVector & spare, double & bestValue) const { // could rewrite to do more directly int numberSlacks=primalColumnRow(iBlock,doByRow,updates,spare); double * COIN_RESTRICT reducedCost = model_->djRegion(); int first=spare.startPartition(iBlock); int last=spare.startPartition(iBlock+1); int * COIN_RESTRICT index = spare.getIndices()+first; double * COIN_RESTRICT array = spare.denseVector()+first; int numberNonZero=spare.getNumElements(iBlock); int bestSequence=-1; double bestDj=model_->dualTolerance(); double bestFreeDj = model_->dualTolerance(); int bestFreeSequence = -1; // redo LOTS so signs for slacks and columns same if (!first) { first = model_->maximumAbcNumberRows(); for (int i=0;inumberRows(); for (int iSequence=0 ; iSequence < numberRows; iSequence++) { // check flagged variable if (!model_->flagged(iSequence)) { double value = reducedCost[iSequence] * CLP_PRIMAL_SLACK_MULTIPLIER; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > bestFreeDj) { bestFreeDj = fabs(value); bestFreeSequence = iSequence; } break; case AbcSimplex::atUpperBound: if (value > bestDj) { bestDj = value; bestSequence = iSequence; } break; case AbcSimplex::atLowerBound: if (value < -bestDj) { bestDj = -value; bestSequence = iSequence; } } } } } for (int i=numberSlacks;iflagged(iSequence)) { double value = reducedCost[iSequence]; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > bestFreeDj) { bestFreeDj = fabs(value); bestFreeSequence = iSequence; } break; case AbcSimplex::atUpperBound: if (value > bestDj) { bestDj = value; bestSequence = iSequence; } break; case AbcSimplex::atLowerBound: if (value < -bestDj) { bestDj = -value; bestSequence = iSequence; } } } } spare.setNumElementsPartition(iBlock,0); // bias towards free if (bestFreeSequence >= 0 && bestFreeDj > 0.1 * bestDj) { bestSequence = bestFreeSequence; bestDj=10.0*bestFreeDj; } bestValue=bestDj; return bestSequence; } // gets tableau row and dj row - returns number of slacks in block int AbcMatrix::primalColumnRowAndDjs(int iBlock,const CoinIndexedVector & updateTableau, const CoinIndexedVector & updateDjs, CoinPartitionedVector & tableauRow) const { int maximumRows = model_->maximumAbcNumberRows(); int first=tableauRow.startPartition(iBlock); int last=tableauRow.startPartition(iBlock+1); assert(first==startColumnBlock_[iBlock]); assert(last==startColumnBlock_[iBlock+1]); int numberSlacks=updateTableau.getNumElements(); int numberNonZero=0; const double * COIN_RESTRICT piTableau=updateTableau.denseVector(); const double * COIN_RESTRICT pi=updateDjs.denseVector(); int * COIN_RESTRICT index = tableauRow.getIndices()+first; double * COIN_RESTRICT array = tableauRow.denseVector()+first; const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); double * COIN_RESTRICT reducedCost = model_->djRegion(); if (!iBlock) { const int * COIN_RESTRICT piIndexTableau = updateTableau.getIndices(); numberNonZero=numberSlacks; for (int i=0;izeroTolerance(); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); for (int iSequence = first; iSequence < last; iSequence++) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<6) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; double tableauValue = 0.0; double djValue=reducedCost[iSequence]; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; tableauValue += piTableau[jRow] * elementByColumn[j]; djValue -= pi[jRow] * elementByColumn[j]; // sign? } reducedCost[iSequence]=djValue; if (fabs(tableauValue)>zeroTolerance) { index[numberNonZero]=iSequence; array[numberNonZero++]=tableauValue; } } } tableauRow.setNumElementsPartition(iBlock,numberNonZero); return numberSlacks; } /* does steepest edge double or triple update If scaleFactor!=0 then use with tableau row to update djs otherwise use updateForDjs */ int AbcMatrix::primalColumnDouble(int iBlock,CoinPartitionedVector & updateForTableauRow, CoinPartitionedVector & updateForDjs, const CoinIndexedVector & updateForWeights, CoinPartitionedVector & spareColumn1, double * infeasibilities, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor) const { int maximumRows = model_->maximumAbcNumberRows(); int first=startColumnBlock_[iBlock]; int last=startColumnBlock_[iBlock+1]; const double * COIN_RESTRICT piTableau=updateForTableauRow.denseVector(); const double * COIN_RESTRICT pi=updateForDjs.denseVector(); const double * COIN_RESTRICT piWeights=updateForWeights.denseVector(); const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); double * COIN_RESTRICT reducedCost = model_->djRegion(); double tolerance = model_->currentDualTolerance(); // use spareColumn to track new infeasibilities int * COIN_RESTRICT newInfeas = spareColumn1.getIndices()+first; int numberNewInfeas=0; // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; double mult[2]={1.0,-1.0}; bool updateWeights=devex!=0.0; #define isReference(i) (((reference[i>>5] >> (i & 31)) & 1) != 0) // Scale factor is other way round so tableau row is 1.0* while dj update is scaleFactor* if (!iBlock) { int numberSlacks=updateForTableauRow.getNumElements(); const int * COIN_RESTRICT piIndexTableau = updateForTableauRow.getIndices(); if (!scaleFactor) { const int * COIN_RESTRICT piIndex = updateForDjs.getIndices(); int number=updateForDjs.getNumElements(); for (int i=0;izeroTolerance(); double freeTolerance = FREE_ACCEPT * tolerance;; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); bool updateDjs=scaleFactor!=COIN_DBL_MAX; for (int iSequence = first; iSequence < last; iSequence++) { unsigned char iStatus=internalStatus[iSequence]&7; if (iStatus<6) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; double tableauValue = 0.0; double djValue=reducedCost[iSequence]; if (!scaleFactor) { for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; tableauValue += piTableau[jRow] * elementByColumn[j]; djValue += pi[jRow] * elementByColumn[j]; } } else { for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; tableauValue += piTableau[jRow] * elementByColumn[j]; } djValue += tableauValue*scaleFactor; // sign? } if (updateDjs) { reducedCost[iSequence]=djValue; if (iStatus<4) { djValue *= mult[iStatus]; if (djValue<0.0) { if (!infeasibilities[iSequence]) newInfeas[numberNewInfeas++]=iSequence; infeasibilities[iSequence]=djValue*djValue; } else { if (infeasibilities[iSequence]) infeasibilities[iSequence]=COIN_INDEXED_REALLY_TINY_ELEMENT; } } else { if (fabs(djValue) > freeTolerance) { // we are going to bias towards free (but only if reasonable) djValue *= FREE_BIAS; if (!infeasibilities[iSequence]) newInfeas[numberNewInfeas++]=iSequence; // store square in list infeasibilities[iSequence] = djValue * djValue; } else { if (infeasibilities[iSequence]) infeasibilities[iSequence]=COIN_INDEXED_REALLY_TINY_ELEMENT; } } } if (fabs(tableauValue)>zeroTolerance&&updateWeights) { double modification=0.0; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; modification += piWeights[jRow] * elementByColumn[j]; } double thisWeight = weights[iSequence]; double pivot = tableauValue; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex - pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (isReference(iSequence)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iSequence] = thisWeight; } } } spareColumn1.setTempNumElementsPartition(iBlock,numberNewInfeas); int bestSequence=-1; #if 0 if (!iBlock) first=0; // not at present - maybe later double bestDj=tolerance*tolerance; for (int iSequence=first;iSequencebestDj*weights[iSequence]) { int iStatus=internalStatus[iSequence]&7; assert (iStatus<6); bestSequence=iSequence; bestDj=infeasibilities[iSequence]/weights[iSequence]; } } #endif return bestSequence; } /* does steepest edge double or triple update If scaleFactor!=0 then use with tableau row to update djs otherwise use updateForDjs */ int AbcMatrix::primalColumnSparseDouble(int iBlock,CoinPartitionedVector & updateForTableauRow, CoinPartitionedVector & updateForDjs, const CoinIndexedVector & updateForWeights, CoinPartitionedVector & spareColumn1, double * infeasibilities, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor) const { int maximumRows = model_->maximumAbcNumberRows(); int first=blockStart_[iBlock]; //int last=blockStart_[iBlock+1]; const double * COIN_RESTRICT piTableau=updateForTableauRow.denseVector(); //const double * COIN_RESTRICT pi=updateForDjs.denseVector(); const double * COIN_RESTRICT piWeights=updateForWeights.denseVector(); const unsigned char * COIN_RESTRICT internalStatus = model_->internalStatus(); double * COIN_RESTRICT reducedCost = model_->djRegion(); double tolerance = model_->currentDualTolerance(); // use spareColumn to track new infeasibilities int * COIN_RESTRICT newInfeas = spareColumn1.getIndices()+first; int numberNewInfeas=0; // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; double mult[2]={1.0,-1.0}; bool updateWeights=devex!=0.0; int numberSlacks=updateForTableauRow.getNumElements(); const int * COIN_RESTRICT piIndexTableau = updateForTableauRow.getIndices(); #define isReference(i) (((reference[i>>5] >> (i & 31)) & 1) != 0) // Scale factor is other way round so tableau row is 1.0* while dj update is scaleFactor* assert (scaleFactor); if (!iBlock) { if (scaleFactor!=COIN_DBL_MAX) { for (int i=0;izeroTolerance(); double freeTolerance = FREE_ACCEPT * tolerance;; // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); // get tableau row int * COIN_RESTRICT index = updateForTableauRow.getIndices()+first; double * COIN_RESTRICT array = updateForTableauRow.denseVector(); int numberRows=model_->numberRows(); const CoinBigIndex * COIN_RESTRICT rowStart = rowStart_+iBlock*numberRows; const CoinBigIndex * COIN_RESTRICT rowEnd = rowStart+numberRows; const double * COIN_RESTRICT element = element_; const int * COIN_RESTRICT column = column_; int numberInRow=0; if (numberSlacks>2) { for (int i=0;iend1-rowStart[iRow1]) { int temp=iRow0; iRow0=iRow1; iRow1=temp; } CoinBigIndex start = rowStart[iRow0]; CoinBigIndex end = rowEnd[iRow0]; double piValue = piTableau[iRow0]; for (CoinBigIndex j=start;j freeTolerance) { // we are going to bias towards free (but only if reasonable) djValue *= FREE_BIAS; if (!infeasibilities[iSequence]) newInfeas[numberNewInfeas++]=iSequence; // store square in list infeasibilities[iSequence] = djValue * djValue; } else { if (infeasibilities[iSequence]) infeasibilities[iSequence]=COIN_INDEXED_REALLY_TINY_ELEMENT; } } } if (fabs(tableauValue)>zeroTolerance&&updateWeights) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; double modification=0.0; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; modification += piWeights[jRow] * elementByColumn[j]; } double thisWeight = weights[iSequence]; double pivot = tableauValue; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex - pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (isReference(iSequence)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iSequence] = thisWeight; } } else { array[iSequence]=0.0; } } spareColumn1.setTempNumElementsPartition(iBlock,numberNewInfeas); int bestSequence=-1; #if 0 if (!iBlock) first=0; // not at present - maybe later double bestDj=tolerance*tolerance; for (int iSequence=first;iSequencebestDj*weights[iSequence]) { int iStatus=internalStatus[iSequence]&7; assert (iStatus<6); bestSequence=iSequence; bestDj=infeasibilities[iSequence]/weights[iSequence]; } } #endif return bestSequence; } #if 0 /* Chooses best weighted dj */ int AbcMatrix::chooseBestDj(int iBlock,const CoinIndexedVector & infeasibilities, const double * weights) const { return 0; } #endif /* does steepest edge double or triple update If scaleFactor!=0 then use with tableau row to update djs otherwise use updateForDjs Returns best */ int AbcMatrix::primalColumnDouble(CoinPartitionedVector & updateForTableauRow, CoinPartitionedVector & updateForDjs, const CoinIndexedVector & updateForWeights, CoinPartitionedVector & spareColumn1, CoinIndexedVector & infeasible, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor) const { //int maximumRows = model_->maximumAbcNumberRows(); // rebalance rebalance(); #ifdef PRICE_IN_ABC_MATRIX int which[NUMBER_BLOCKS]; #endif double * infeasibilities=infeasible.denseVector(); int bestSequence=-1; // see if worth using row copy int maximumRows=model_->maximumAbcNumberRows(); int number=updateForTableauRow.getNumElements(); #ifdef GCC_4_9 assert (number); #else if (!number) { printf("Null tableau row!\n"); } #endif bool useRowCopy = (gotRowCopy()&&(number<<2)dualTolerance(); int sequenceIn[8]={-1,-1,-1,-1,-1,-1,-1,-1}; #endif assert (numberColumnBlocks_<=8); #ifdef PRICE_IN_ABC_MATRIX double weightedDj[8]; int nPossible=0; #endif //const double * reducedCost = model_->djRegion(); // use spareColumn to track new infeasibilities int numberInfeas=infeasible.getNumElements(); int * COIN_RESTRICT infeas = infeasible.getIndices(); const int * COIN_RESTRICT newInfeasAll = spareColumn1.getIndices(); for (int i=0;i=0) { int iSequence=which[i]; double value=fabs(infeasibilities[iSequence]/weights[iSequence]); if (value>bestValue) { bestValue=value; bestSequence=which[i]; } weightedDj[nPossible]=-value; sequenceIn[nPossible++]=iSequence; } #endif } infeasible.setNumElements(numberInfeas); #ifdef PRICE_IN_ABC_MATRIX CoinSort_2(weightedDj,weightedDj+nPossible,sequenceIn); //model_->setMultipleSequenceIn(sequenceIn); #endif return bestSequence; } // Partial pricing void AbcMatrix::partialPricing(double startFraction, double endFraction, int & bestSequence, int & numberWanted) { numberWanted = currentWanted_; int maximumRows = model_->maximumAbcNumberRows(); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); int numberColumns=model_->numberColumns(); int start = static_cast (startFraction * numberColumns); int end = CoinMin(static_cast (endFraction * numberColumns + 1), numberColumns); // adjust start += maximumRows; end += maximumRows; double tolerance = model_->currentDualTolerance(); double * reducedCost = model_->djRegion(); const double * duals = model_->dualRowSolution(); const double * cost = model_->costRegion(); double bestDj; if (bestSequence >= 0) bestDj = fabs(reducedCost[bestSequence]); else bestDj = tolerance; int sequenceOut = model_->sequenceOut(); int saveSequence = bestSequence; int lastScan = minimumObjectsScan_ < 0 ? end : start + minimumObjectsScan_; int minNeg = minimumGoodReducedCosts_ == -1 ? numberWanted : minimumGoodReducedCosts_; for (int iSequence = start; iSequence < end; iSequence++) { if (iSequence != sequenceOut) { double value; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: value = cost[iSequence]; for (CoinBigIndex j = columnStart[iSequence]; j < columnStart[iSequence+1]; j++) { int jRow = row[j]; value -= duals[jRow] * elementByColumn[j]; } value = fabs(value); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case AbcSimplex::atUpperBound: value = cost[iSequence]; // scaled for (CoinBigIndex j = columnStart[iSequence]; j < columnStart[iSequence+1]; j++) { int jRow = row[j]; value -= duals[jRow] * elementByColumn[j]; } if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case AbcSimplex::atLowerBound: value = cost[iSequence]; for (CoinBigIndex j = columnStart[iSequence]; j < columnStart[iSequence+1]; j++) { int jRow = row[j]; value -= duals[jRow] * elementByColumn[j]; } value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (numberWanted + minNeg < originalWanted_ && iSequence > lastScan) { // give up break; } if (!numberWanted) break; } if (bestSequence != saveSequence) { // recompute dj double value = cost[bestSequence]; for (CoinBigIndex j = columnStart[bestSequence]; j < columnStart[bestSequence+1]; j++) { int jRow = row[j]; value -= duals[jRow] * elementByColumn[j]; } reducedCost[bestSequence] = value; savedBestSequence_ = bestSequence; savedBestDj_ = reducedCost[savedBestSequence_]; } currentWanted_ = numberWanted; } /* Return x *A in z but just for indices Already in z. Note - z always packed mode */ void AbcMatrix::subsetTransposeTimes(const CoinIndexedVector & x, CoinIndexedVector & z) const { int maximumRows = model_->maximumAbcNumberRows(); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT other=x.denseVector(); int numberNonZero = z.getNumElements(); int * COIN_RESTRICT index = z.getIndices(); double * COIN_RESTRICT array = z.denseVector(); int numberRows=model_->numberRows(); for (int i=0;i=numberRows) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; double value = 0.0; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; value -= other[jRow] * elementByColumn[j]; } array[i]=value; } else { array[i]=-other[iSequence]; } } } // Return -x *A in z void AbcMatrix::transposeTimes(const CoinIndexedVector & x, CoinIndexedVector & z) const { int maximumRows = model_->maximumAbcNumberRows(); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const double * COIN_RESTRICT other=x.denseVector(); int numberNonZero = 0; int * COIN_RESTRICT index = z.getIndices(); double * COIN_RESTRICT array = z.denseVector(); int numberColumns=model_->numberColumns(); double zeroTolerance=model_->zeroTolerance(); for (int iSequence=maximumRows;iSequencezeroTolerance) { // TEMP array[iSequence-maximumRows]=value; index[numberNonZero++]=iSequence-maximumRows; } } z.setNumElements(numberNonZero); } /* Return A * scalar(+-1) *x + y in y. @pre x must be of size numRows() @pre y must be of size numRows()+numColumns() */ void AbcMatrix::transposeTimesNonBasic(double scalar, const double * pi, double * y) const { int numberTotal = model_->numberTotal(); int maximumRows = model_->maximumAbcNumberRows(); assert (scalar==-1.0); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); int numberRows=model_->numberRows(); const unsigned char * COIN_RESTRICT status=model_->internalStatus(); for (int i=0;i in y. @pre x must be of size numRows() @pre y must be of size numRows()+numColumns() */ void AbcMatrix::transposeTimesAll(const double * pi, double * y) const { int numberTotal = model_->numberTotal(); int maximumRows = model_->maximumAbcNumberRows(); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-maximumRows; const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); int numberRows=model_->numberRows(); for (int i=0;i in y. @pre x must be of size numRows() @pre y must be of size numRows() */ void AbcMatrix::transposeTimesBasic(double scalar, const double * pi, double * y) const { assert (scalar==-1.0); int numberRows=model_->numberRows(); //AbcMemset0(y,numberRows); // get matrix data pointers const int * COIN_RESTRICT row = matrix_->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts()-model_->maximumAbcNumberRows(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); const int * COIN_RESTRICT pivotVariable = model_->pivotVariable(); for (int i=0;i=numberRows) { CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; value = 0.0; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; value += pi[jRow] * elementByColumn[j]; } } else { value=pi[iSequence]; } y[i]+=scalar*value; } } // Adds multiple of a column (or slack) into an CoinIndexedvector void AbcMatrix::add(CoinIndexedVector & rowArray, int iSequence, double multiplier) const { int maximumRows=model_->maximumAbcNumberRows(); if (iSequence>=maximumRows) { const int * COIN_RESTRICT row = matrix_->getIndices(); iSequence -= maximumRows; const CoinBigIndex * COIN_RESTRICT columnStart = matrix_->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = matrix_->getElements(); CoinBigIndex start = columnStart[iSequence]; CoinBigIndex next = columnStart[iSequence+1]; for (CoinBigIndex j = start; j < next; j++) { int jRow = row[j]; rowArray.quickAdd(jRow,elementByColumn[j]*multiplier); } } else { rowArray.quickAdd(iSequence,multiplier); } } /* Unpacks a column into an CoinIndexedVector */ void AbcMatrix::unpack(CoinIndexedVector & usefulArray, int sequence) const { usefulArray.clear(); int maximumRows=model_->maximumAbcNumberRows(); if (sequence < maximumRows) { //slack usefulArray.insert(sequence , 1.0); } else { // column const CoinBigIndex * COIN_RESTRICT columnStart = matrix()->getVectorStarts()-maximumRows; CoinBigIndex start=columnStart[sequence]; CoinBigIndex end=columnStart[sequence+1]; const int * COIN_RESTRICT row = matrix()->getIndices()+start; const double * COIN_RESTRICT elementByColumn = matrix()->getElements()+start; int * COIN_RESTRICT index = usefulArray.getIndices(); double * COIN_RESTRICT array = usefulArray.denseVector(); int numberNonZero=end-start; for (int j=0; jnumberRows()*(numberRowBlocks_+1); //} } // Row elements double * AbcMatrix::rowElements() const { return element_; } // Row columnss CoinSimplexInt * AbcMatrix::rowColumns() const { return column_; } CoinMP-1.8.3/Clp/src/ClpSimplexPrimal.hpp0000644000175000017500000002164411510657452016574 0ustar renerene/* $Id: ClpSimplexPrimal.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef ClpSimplexPrimal_H #define ClpSimplexPrimal_H #include "ClpSimplex.hpp" /** This solves LPs using the primal simplex method It inherits from ClpSimplex. It has no data of its own and is never created - only cast from a ClpSimplex object at algorithm time. */ class ClpSimplexPrimal : public ClpSimplex { public: /**@name Description of algorithm */ //@{ /** Primal algorithm Method It tries to be a single phase approach with a weight of 1.0 being given to getting optimal and a weight of infeasibilityCost_ being given to getting primal feasible. In this version I have tried to be clever in a stupid way. The idea of fake bounds in dual seems to work so the primal analogue would be that of getting bounds on reduced costs (by a presolve approach) and using these for being above or below feasible region. I decided to waste memory and keep these explicitly. This allows for non-linear costs! I have not tested non-linear costs but will be glad to do something if a reasonable example is provided. The code is designed to take advantage of sparsity so arrays are seldom zeroed out from scratch or gone over in their entirety. The only exception is a full scan to find incoming variable for Dantzig row choice. For steepest edge we keep an updated list of dual infeasibilities (actually squares). On easy problems we don't need full scan - just pick first reasonable. This method has not been coded. One problem is how to tackle degeneracy and accuracy. At present I am using the modification of costs which I put in OSL and which was extended by Gill et al. I am still not sure whether we will also need explicit perturbation. The flow of primal is three while loops as follows: while (not finished) { while (not clean solution) { Factorize and/or clean up solution by changing bounds so primal feasible. If looks finished check fake primal bounds. Repeat until status is iterating (-1) or finished (0,1,2) } while (status==-1) { Iterate until no pivot in or out or time to re-factorize. Flow is: choose pivot column (incoming variable). if none then we are primal feasible so looks as if done but we need to break and check bounds etc. Get pivot column in tableau Choose outgoing row. If we don't find one then we look primal unbounded so break and check bounds etc. (Also the pivot tolerance is larger after any iterations so that may be reason) If we do find outgoing row, we may have to adjust costs to keep going forwards (anti-degeneracy). Check pivot will be stable and if unstable throw away iteration and break to re-factorize. If minor error re-factorize after iteration. Update everything (this may involve changing bounds on variables to stay primal feasible. } } TODO's (or maybe not) At present we never check we are going forwards. I overdid that in OSL so will try and make a last resort. Needs partial scan pivot in option. May need other anti-degeneracy measures, especially if we try and use loose tolerances as a way to solve in fewer iterations. I like idea of dynamic scaling. This gives opportunity to decouple different implications of scaling for accuracy, iteration count and feasibility tolerance. for use of exotic parameter startFinishoptions see Clpsimplex.hpp */ int primal(int ifValuesPass = 0, int startFinishOptions = 0); //@} /**@name For advanced users */ //@{ /// Do not change infeasibility cost and always say optimal void alwaysOptimal(bool onOff); bool alwaysOptimal() const; /** Normally outgoing variables can go out to slightly negative values (but within tolerance) - this is to help stability and and degeneracy. This can be switched off */ void exactOutgoing(bool onOff); bool exactOutgoing() const; //@} /**@name Functions used in primal */ //@{ /** This has the flow between re-factorizations Returns a code to say where decision to exit was made Problem status set to: -2 re-factorize -4 Looks optimal/infeasible -5 Looks unbounded +3 max iterations valuesOption has original value of valuesPass */ int whileIterating(int valuesOption); /** Do last half of an iteration. This is split out so people can force incoming variable. If solveType_ is 2 then this may re-factorize while normally it would exit to re-factorize. Return codes Reasons to come out (normal mode/user mode): -1 normal -2 factorize now - good iteration/ NA -3 slight inaccuracy - refactorize - iteration done/ same but factor done -4 inaccuracy - refactorize - no iteration/ NA -5 something flagged - go round again/ pivot not possible +2 looks unbounded +3 max iterations (iteration done) With solveType_ ==2 this should Pivot in a variable and choose an outgoing one. Assumes primal feasible - will not go through a bound. Returns step length in theta Returns ray in ray_ */ int pivotResult(int ifValuesPass = 0); /** The primals are updated by the given array. Returns number of infeasibilities. After rowArray will have cost changes for use next iteration */ int updatePrimalsInPrimal(CoinIndexedVector * rowArray, double theta, double & objectiveChange, int valuesPass); /** Row array has pivot column This chooses pivot row. Rhs array is used for distance to next bound (for speed) For speed, we may need to go to a bucket approach when many variables go through bounds If valuesPass non-zero then compute dj for direction */ void primalRow(CoinIndexedVector * rowArray, CoinIndexedVector * rhsArray, CoinIndexedVector * spareArray, int valuesPass); /** Chooses primal pivot column updateArray has cost updates (also use pivotRow_ from last iteration) Would be faster with separate region to scan and will have this (with square of infeasibility) when steepest For easy problems we can just choose one of the first columns we look at */ void primalColumn(CoinIndexedVector * updateArray, CoinIndexedVector * spareRow1, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /** Checks if tentative optimal actually means unbounded in primal Returns -3 if not, 2 if is unbounded */ int checkUnbounded(CoinIndexedVector * ray, CoinIndexedVector * spare, double changeCost); /** Refactorizes if necessary Checks if finished. Updates status. lastCleaned refers to iteration at which some objective/feasibility cleaning too place. type - 0 initial so set up save arrays etc - 1 normal -if good update save - 2 restoring from saved saveModel is normally NULL but may not be if doing Sprint */ void statusOfProblemInPrimal(int & lastCleaned, int type, ClpSimplexProgress * progress, bool doFactorization, int ifValuesPass, ClpSimplex * saveModel = NULL); /// Perturbs problem (method depends on perturbation()) void perturb(int type); /// Take off effect of perturbation and say whether to try dual bool unPerturb(); /// Unflag all variables and return number unflagged int unflag(); /** Get next superbasic -1 if none, Normal type is 1 If type is 3 then initializes sorted list if 2 uses list. */ int nextSuperBasic(int superBasicType, CoinIndexedVector * columnArray); /// Create primal ray void primalRay(CoinIndexedVector * rowArray); /// Clears all bits and clears rowArray[1] etc void clearAll(); /// Sort of lexicographic resolve int lexSolve(); //@} }; #endif CoinMP-1.8.3/Clp/src/CoinAbcOrderedFactorization3.cpp0000644000175000017500000000107712101105055020743 0ustar renerene/* $Id: CoinAbcOrderedFactorization3.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcOrderedFactorization #define ABC_SMALL -1 #define ABC_ORDERED_FACTORIZATION #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization3.cpp" #endif CoinMP-1.8.3/Clp/src/ClpSimplexNonlinear.hpp0000644000175000017500000001004612312311163017252 0ustar renerene/* $Id: ClpSimplexNonlinear.hpp 2025 2014-03-19 12:49:55Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef ClpSimplexNonlinear_H #define ClpSimplexNonlinear_H class ClpNonlinearInfo; class ClpQuadraticObjective; class ClpConstraint; #include "ClpSimplexPrimal.hpp" /** This solves non-linear LPs using the primal simplex method It inherits from ClpSimplexPrimal. It has no data of its own and is never created - only cast from a ClpSimplexPrimal object at algorithm time. If needed create new class and pass around */ class ClpSimplexNonlinear : public ClpSimplexPrimal { public: /**@name Description of algorithm */ //@{ /** Primal algorithms for reduced gradient At present we have two algorithms: */ /// A reduced gradient method. int primal(); /** Primal algorithm for quadratic Using a semi-trust region approach as for pooling problem This is in because I have it lying around */ int primalSLP(int numberPasses, double deltaTolerance, int otherOptions=0); /// May use a cut approach for solving any LP int primalDualCuts(char * rowsIn, int startUp, int algorithm); /** Primal algorithm for nonlinear constraints Using a semi-trust region approach as for pooling problem This is in because I have it lying around */ int primalSLP(int numberConstraints, ClpConstraint ** constraints, int numberPasses, double deltaTolerance); /** Creates direction vector. note longArray is long enough for rows and columns. If numberNonBasic 0 then is updated otherwise mode is ignored and those are used. Norms are only for those > 1.0e3*dualTolerance If mode is nonzero then just largest dj */ void directionVector (CoinIndexedVector * longArray, CoinIndexedVector * spare1, CoinIndexedVector * spare2, int mode, double & normFlagged, double & normUnflagged, int & numberNonBasic); /// Main part. int whileIterating (int & pivotMode); /** longArray has direction pivotMode - 0 - use all dual infeasible variables 1 - largest dj while >= 10 trying startup phase Returns 0 - can do normal iteration (basis change) 1 - no basis change 2 - if wants singleton 3 - if time to re-factorize If sequenceIn_ >=0 then that will be incoming variable */ int pivotColumn(CoinIndexedVector * longArray, CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, CoinIndexedVector * spare, int & pivotMode, double & solutionError, double * array1); /** Refactorizes if necessary Checks if finished. Updates status. lastCleaned refers to iteration at which some objective/feasibility cleaning too place. type - 0 initial so set up save arrays etc - 1 normal -if good update save - 2 restoring from saved */ void statusOfProblemInPrimal(int & lastCleaned, int type, ClpSimplexProgress * progress, bool doFactorization, double & bestObjectiveWhenFlagged); /** Do last half of an iteration. Return codes Reasons to come out normal mode -1 normal -2 factorize now - good iteration -3 slight inaccuracy - refactorize - iteration done -4 inaccuracy - refactorize - no iteration -5 something flagged - go round again +2 looks unbounded +3 max iterations (iteration done) */ int pivotNonlinearResult(); //@} }; #endif CoinMP-1.8.3/Clp/src/ClpDualRowSteepest.cpp0000644000175000017500000013777212547436603017111 0ustar renerene/* $Id: ClpDualRowSteepest.cpp 2151 2015-07-09 09:23:15Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpDualRowSteepest.hpp" #include "CoinIndexedVector.hpp" #include "ClpFactorization.hpp" #include "CoinHelperFunctions.hpp" #include #if defined(ABOCA_LITE) || defined(CILK_OVERLAP) #include #endif //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //#define CLP_DEBUG 4 //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpDualRowSteepest::ClpDualRowSteepest (int mode) : ClpDualRowPivot(), state_(-1), mode_(mode), persistence_(normal), weights_(NULL), infeasible_(NULL), alternateWeights_(NULL), savedWeights_(NULL), dubiousWeights_(NULL) { type_ = 2 + 64 * mode; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpDualRowSteepest::ClpDualRowSteepest (const ClpDualRowSteepest & rhs) : ClpDualRowPivot(rhs) { state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; model_ = rhs.model_; if ((model_ && model_->whatsChanged() & 1) != 0) { int number = model_->numberRows(); if (rhs.savedWeights_) number = CoinMin(number, rhs.savedWeights_->capacity()); if (rhs.infeasible_) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } if (rhs.weights_) { weights_ = new double[number]; ClpDisjointCopyN(rhs.weights_, number, weights_); } else { weights_ = NULL; } if (rhs.alternateWeights_) { alternateWeights_ = new CoinIndexedVector(rhs.alternateWeights_); } else { alternateWeights_ = NULL; } if (rhs.savedWeights_) { savedWeights_ = new CoinIndexedVector(rhs.savedWeights_); } else { savedWeights_ = NULL; } if (rhs.dubiousWeights_) { assert(model_); int number = model_->numberRows(); dubiousWeights_ = new int[number]; ClpDisjointCopyN(rhs.dubiousWeights_, number, dubiousWeights_); } else { dubiousWeights_ = NULL; } } else { infeasible_ = NULL; weights_ = NULL; alternateWeights_ = NULL; savedWeights_ = NULL; dubiousWeights_ = NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpDualRowSteepest::~ClpDualRowSteepest () { delete [] weights_; delete [] dubiousWeights_; delete infeasible_; delete alternateWeights_; delete savedWeights_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpDualRowSteepest & ClpDualRowSteepest::operator=(const ClpDualRowSteepest& rhs) { if (this != &rhs) { ClpDualRowPivot::operator=(rhs); state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; model_ = rhs.model_; delete [] weights_; delete [] dubiousWeights_; delete infeasible_; delete alternateWeights_; delete savedWeights_; assert(model_); int number = model_->numberRows(); if (rhs.savedWeights_) number = CoinMin(number, rhs.savedWeights_->capacity()); if (rhs.infeasible_ != NULL) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } if (rhs.weights_ != NULL) { weights_ = new double[number]; ClpDisjointCopyN(rhs.weights_, number, weights_); } else { weights_ = NULL; } if (rhs.alternateWeights_ != NULL) { alternateWeights_ = new CoinIndexedVector(rhs.alternateWeights_); } else { alternateWeights_ = NULL; } if (rhs.savedWeights_ != NULL) { savedWeights_ = new CoinIndexedVector(rhs.savedWeights_); } else { savedWeights_ = NULL; } if (rhs.dubiousWeights_) { assert(model_); int number = model_->numberRows(); dubiousWeights_ = new int[number]; ClpDisjointCopyN(rhs.dubiousWeights_, number, dubiousWeights_); } else { dubiousWeights_ = NULL; } } return *this; } // Fill most values void ClpDualRowSteepest::fill(const ClpDualRowSteepest& rhs) { state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; assert (model_->numberRows() == rhs.model_->numberRows()); model_ = rhs.model_; assert(model_); int number = model_->numberRows(); if (rhs.savedWeights_) number = CoinMin(number, rhs.savedWeights_->capacity()); if (rhs.infeasible_ != NULL) { if (!infeasible_) infeasible_ = new CoinIndexedVector(rhs.infeasible_); else *infeasible_ = *rhs.infeasible_; } else { delete infeasible_; infeasible_ = NULL; } if (rhs.weights_ != NULL) { if (!weights_) weights_ = new double[number]; ClpDisjointCopyN(rhs.weights_, number, weights_); } else { delete [] weights_; weights_ = NULL; } if (rhs.alternateWeights_ != NULL) { if (!alternateWeights_) alternateWeights_ = new CoinIndexedVector(rhs.alternateWeights_); else *alternateWeights_ = *rhs.alternateWeights_; } else { delete alternateWeights_; alternateWeights_ = NULL; } if (rhs.savedWeights_ != NULL) { if (!savedWeights_) savedWeights_ = new CoinIndexedVector(rhs.savedWeights_); else *savedWeights_ = *rhs.savedWeights_; } else { delete savedWeights_; savedWeights_ = NULL; } if (rhs.dubiousWeights_) { assert(model_); int number = model_->numberRows(); if (!dubiousWeights_) dubiousWeights_ = new int[number]; ClpDisjointCopyN(rhs.dubiousWeights_, number, dubiousWeights_); } else { delete [] dubiousWeights_; dubiousWeights_ = NULL; } } // Returns pivot row, -1 if none int ClpDualRowSteepest::pivotRow() { assert(model_); int i, iRow; double * infeas = infeasible_->denseVector(); double largest = 0.0; int * index = infeasible_->getIndices(); int number = infeasible_->getNumElements(); const int * pivotVariable = model_->pivotVariable(); int chosenRow = -1; int lastPivotRow = model_->pivotRow(); assert (lastPivotRow < model_->numberRows()); double tolerance = model_->currentPrimalTolerance(); // we can't really trust infeasibilities if there is primal error // this coding has to mimic coding in checkPrimalSolution double error = CoinMin(1.0e-2, model_->largestPrimalError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; // But cap tolerance = CoinMin(1000.0, tolerance); tolerance *= tolerance; // as we are using squares bool toleranceChanged = false; double * solution = model_->solutionRegion(); double * lower = model_->lowerRegion(); double * upper = model_->upperRegion(); // do last pivot row one here //#define CLP_DUAL_FIXED_COLUMN_MULTIPLIER 10.0 if (lastPivotRow >= 0 && lastPivotRow < model_->numberRows()) { #ifdef CLP_DUAL_COLUMN_MULTIPLIER int numberColumns = model_->numberColumns(); #endif int iPivot = pivotVariable[lastPivotRow]; double value = solution[iPivot]; double lower = model_->lower(iPivot); double upper = model_->upper(iPivot); if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif // store square in list if (infeas[lastPivotRow]) infeas[lastPivotRow] = value; // already there else infeasible_->quickAdd(lastPivotRow, value); } else if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif // store square in list if (infeas[lastPivotRow]) infeas[lastPivotRow] = value; // already there else infeasible_->add(lastPivotRow, value); } else { // feasible - was it infeasible - if so set tiny if (infeas[lastPivotRow]) infeas[lastPivotRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } number = infeasible_->getNumElements(); } if(model_->numberIterations() < model_->lastBadIteration() + 200) { // we can't really trust infeasibilities if there is dual error if (model_->largestDualError() > model_->largestPrimalError()) { tolerance *= CoinMin(model_->largestDualError() / model_->largestPrimalError(), 1000.0); toleranceChanged = true; } } int numberWanted; if (mode_ < 2 ) { numberWanted = number + 1; } else if (mode_ == 2) { numberWanted = CoinMax(2000, number / 8); } else { int numberElements = model_->factorization()->numberElements(); double ratio = static_cast (numberElements) / static_cast (model_->numberRows()); numberWanted = CoinMax(2000, number / 8); if (ratio < 1.0) { numberWanted = CoinMax(2000, number / 20); } else if (ratio > 10.0) { ratio = number * (ratio / 80.0); if (ratio > number) numberWanted = number + 1; else numberWanted = CoinMax(2000, static_cast (ratio)); } } if (model_->largestPrimalError() > 1.0e-3) numberWanted = number + 1; // be safe int iPass; // Setup two passes int start[4]; start[1] = number; start[2] = 0; double dstart = static_cast (number) * model_->randomNumberGenerator()->randomDouble(); start[0] = static_cast (dstart); start[3] = start[0]; //double largestWeight=0.0; //double smallestWeight=1.0e100; for (iPass = 0; iPass < 2; iPass++) { int end = start[2*iPass+1]; for (i = start[2*iPass]; i < end; i++) { iRow = index[i]; double value = infeas[iRow]; if (value > tolerance) { //#define OUT_EQ #ifdef OUT_EQ { int iSequence = pivotVariable[iRow]; if (upper[iSequence] == lower[iSequence]) value *= 2.0; } #endif double weight = CoinMin(weights_[iRow], 1.0e50); //largestWeight = CoinMax(largestWeight,weight); //smallestWeight = CoinMin(smallestWeight,weight); //double dubious = dubiousWeights_[iRow]; //weight *= dubious; //if (value>2.0*largest*weight||(value>0.5*largest*weight&&value*largestWeight>dubious*largest*weight)) { if (value > largest * weight) { // make last pivot row last resort choice if (iRow == lastPivotRow) { if (value * 1.0e-10 < largest * weight) continue; else value *= 1.0e-10; } int iSequence = pivotVariable[iRow]; if (!model_->flagged(iSequence)) { //#define CLP_DEBUG 3 #ifdef CLP_DEBUG double value2 = 0.0; if (solution[iSequence] > upper[iSequence] + tolerance) value2 = solution[iSequence] - upper[iSequence]; else if (solution[iSequence] < lower[iSequence] - tolerance) value2 = solution[iSequence] - lower[iSequence]; assert(fabs(value2 * value2 - infeas[iRow]) < 1.0e-8 * CoinMin(value2 * value2, infeas[iRow])); #endif if (solution[iSequence] > upper[iSequence] + tolerance || solution[iSequence] < lower[iSequence] - tolerance) { chosenRow = iRow; largest = value / weight; //largestWeight = dubious; } } else { // just to make sure we don't exit before got something numberWanted++; } } numberWanted--; if (!numberWanted) break; } } if (!numberWanted) break; } //printf("smallest %g largest %g\n",smallestWeight,largestWeight); if (chosenRow < 0 && toleranceChanged) { // won't line up with checkPrimalSolution - do again double saveError = model_->largestDualError(); model_->setLargestDualError(0.0); // can't loop chosenRow = pivotRow(); model_->setLargestDualError(saveError); } if (chosenRow < 0 && lastPivotRow < 0) { int nLeft = 0; for (int i = 0; i < number; i++) { int iRow = index[i]; if (fabs(infeas[iRow]) > 1.0e-50) { index[nLeft++] = iRow; } else { infeas[iRow] = 0.0; } } infeasible_->setNumElements(nLeft); model_->setNumberPrimalInfeasibilities(nLeft); } return chosenRow; } #if 0 static double ft_count = 0.0; static double up_count = 0.0; static double ft_count_in = 0.0; static double up_count_in = 0.0; static int xx_count = 0; #endif /* Updates weights and returns pivot alpha. Also does FT update */ double ClpDualRowSteepest::updateWeights(CoinIndexedVector * input, CoinIndexedVector * spare, CoinIndexedVector * spare2, CoinIndexedVector * updatedColumn) { //#define CLP_DEBUG 3 #if CLP_DEBUG>2 // Very expensive debug { int numberRows = model_->numberRows(); CoinIndexedVector * temp = new CoinIndexedVector(); temp->reserve(numberRows + model_->factorization()->maximumPivots()); double * array = alternateWeights_->denseVector(); int * which = alternateWeights_->getIndices(); alternateWeights_->clear(); int i; for (i = 0; i < numberRows; i++) { double value = 0.0; array[i] = 1.0; which[0] = i; alternateWeights_->setNumElements(1); model_->factorization()->updateColumnTranspose(temp, alternateWeights_); int number = alternateWeights_->getNumElements(); int j; for (j = 0; j < number; j++) { int iRow = which[j]; value += array[iRow] * array[iRow]; array[iRow] = 0.0; } alternateWeights_->setNumElements(0); double w = CoinMax(weights_[i], value) * .1; if (fabs(weights_[i] - value) > w) { printf("%d old %g, true %g\n", i, weights_[i], value); weights_[i] = value; // to reduce printout } //else //printf("%d matches %g\n",i,value); } delete temp; } #endif assert (input->packedMode()); if (!updatedColumn->packedMode()) { // I think this means empty #ifdef COIN_DEVELOP printf("updatedColumn not packed mode ClpDualRowSteepest::updateWeights\n"); #endif return 0.0; } double alpha = 0.0; if (!model_->factorization()->networkBasis()) { // clear other region alternateWeights_->clear(); double norm = 0.0; int i; double * work = input->denseVector(); int numberNonZero = input->getNumElements(); int * which = input->getIndices(); double * work2 = spare->denseVector(); int * which2 = spare->getIndices(); // ftran //permute and move indices into index array //also compute norm //int *regionIndex = alternateWeights_->getIndices ( ); const int *permute = model_->factorization()->permute(); //double * region = alternateWeights_->denseVector(); if (permute) { for ( i = 0; i < numberNonZero; i ++ ) { int iRow = which[i]; double value = work[i]; norm += value * value; iRow = permute[iRow]; work2[iRow] = value; which2[i] = iRow; } } else { for ( i = 0; i < numberNonZero; i ++ ) { int iRow = which[i]; double value = work[i]; norm += value * value; //iRow = permute[iRow]; work2[iRow] = value; which2[i] = iRow; } } spare->setNumElements ( numberNonZero ); // Do FT update #if 0 ft_count_in += updatedColumn->getNumElements(); up_count_in += spare->getNumElements(); #endif if (permute || true) { #if CLP_DEBUG>2 printf("REGION before %d els\n", spare->getNumElements()); spare->print(); #endif model_->factorization()->updateTwoColumnsFT(spare2, updatedColumn, spare, permute != NULL); #if CLP_DEBUG>2 printf("REGION after %d els\n", spare->getNumElements()); spare->print(); #endif } else { // Leave as old way model_->factorization()->updateColumnFT(spare2, updatedColumn); model_->factorization()->updateColumn(spare2, spare, false); } #undef CLP_DEBUG #if 0 ft_count += updatedColumn->getNumElements(); up_count += spare->getNumElements(); xx_count++; if ((xx_count % 1000) == 0) printf("zz %d ft %g up %g (in %g %g)\n", xx_count, ft_count, up_count, ft_count_in, up_count_in); #endif numberNonZero = spare->getNumElements(); // alternateWeights_ should still be empty int pivotRow = model_->pivotRow(); #ifdef CLP_DEBUG if ( model_->logLevel ( ) > 4 && fabs(norm - weights_[pivotRow]) > 1.0e-3 * (1.0 + norm)) printf("on row %d, true weight %g, old %g\n", pivotRow, sqrt(norm), sqrt(weights_[pivotRow])); #endif // could re-initialize here (could be expensive) norm /= model_->alpha() * model_->alpha(); assert(model_->alpha()); assert(norm); // pivot element alpha = 0.0; double multiplier = 2.0 / model_->alpha(); // look at updated column work = updatedColumn->denseVector(); numberNonZero = updatedColumn->getNumElements(); which = updatedColumn->getIndices(); int nSave = 0; double * work3 = alternateWeights_->denseVector(); int * which3 = alternateWeights_->getIndices(); const int * pivotColumn = model_->factorization()->pivotColumn(); for (i = 0; i < numberNonZero; i++) { int iRow = which[i]; double theta = work[i]; if (iRow == pivotRow) alpha = theta; double devex = weights_[iRow]; work3[nSave] = devex; // save old which3[nSave++] = iRow; // transform to match spare int jRow = permute ? pivotColumn[iRow] : iRow; double value = work2[jRow]; devex += theta * (theta * norm + value * multiplier); if (devex < DEVEX_TRY_NORM) devex = DEVEX_TRY_NORM; weights_[iRow] = devex; } alternateWeights_->setPackedMode(true); alternateWeights_->setNumElements(nSave); if (norm < DEVEX_TRY_NORM) norm = DEVEX_TRY_NORM; // Try this to make less likely will happen again and stop cycling //norm *= 1.02; weights_[pivotRow] = norm; spare->clear(); #ifdef CLP_DEBUG spare->checkClear(); #endif } else { // Do FT update model_->factorization()->updateColumnFT(spare, updatedColumn); // clear other region alternateWeights_->clear(); double norm = 0.0; int i; double * work = input->denseVector(); int number = input->getNumElements(); int * which = input->getIndices(); double * work2 = spare->denseVector(); int * which2 = spare->getIndices(); for (i = 0; i < number; i++) { int iRow = which[i]; double value = work[i]; norm += value * value; work2[iRow] = value; which2[i] = iRow; } spare->setNumElements(number); // ftran #ifndef NDEBUG alternateWeights_->checkClear(); #endif model_->factorization()->updateColumn(alternateWeights_, spare); // alternateWeights_ should still be empty #ifndef NDEBUG alternateWeights_->checkClear(); #endif int pivotRow = model_->pivotRow(); #ifdef CLP_DEBUG if ( model_->logLevel ( ) > 4 && fabs(norm - weights_[pivotRow]) > 1.0e-3 * (1.0 + norm)) printf("on row %d, true weight %g, old %g\n", pivotRow, sqrt(norm), sqrt(weights_[pivotRow])); #endif // could re-initialize here (could be expensive) norm /= model_->alpha() * model_->alpha(); assert(norm); //if (norm < DEVEX_TRY_NORM) //norm = DEVEX_TRY_NORM; // pivot element alpha = 0.0; double multiplier = 2.0 / model_->alpha(); // look at updated column work = updatedColumn->denseVector(); number = updatedColumn->getNumElements(); which = updatedColumn->getIndices(); int nSave = 0; double * work3 = alternateWeights_->denseVector(); int * which3 = alternateWeights_->getIndices(); for (i = 0; i < number; i++) { int iRow = which[i]; double theta = work[i]; if (iRow == pivotRow) alpha = theta; double devex = weights_[iRow]; work3[nSave] = devex; // save old which3[nSave++] = iRow; double value = work2[iRow]; devex += theta * (theta * norm + value * multiplier); if (devex < DEVEX_TRY_NORM) devex = DEVEX_TRY_NORM; weights_[iRow] = devex; } if (!alpha) { // error - but carry on alpha = 1.0e-50; } alternateWeights_->setPackedMode(true); alternateWeights_->setNumElements(nSave); if (norm < DEVEX_TRY_NORM) norm = DEVEX_TRY_NORM; weights_[pivotRow] = norm; spare->clear(); } #ifdef CLP_DEBUG spare->checkClear(); #endif return alpha; } #if ABOCA_LITE typedef struct { double tolerance; double primalRatio; double changeObj; const double * cost; double * solution; const double * lower; const double * upper; double * work; int * which; double * infeas; const int * pivotVariable; int numberAdded; int numberToDo; #ifdef CLP_DUAL_COLUMN_MULTIPLIER int numberColumns; #endif } update_primals; static void updatePrimalBit(update_primals & info) { int numberAdded = 0; double tolerance = info.tolerance; double primalRatio = info.primalRatio; double changeObj=0.0; const double * COIN_RESTRICT costModel = info.cost; const double * COIN_RESTRICT lowerModel = info.lower; const double * COIN_RESTRICT upperModel = info.upper; double * COIN_RESTRICT solution = info.solution; double * COIN_RESTRICT infeas = info.infeas; const int * COIN_RESTRICT pivotVariable = info.pivotVariable; double * COIN_RESTRICT work = info.work; int number = info.numberToDo; int * COIN_RESTRICT which = info.which; #ifdef CLP_DUAL_COLUMN_MULTIPLIER int numberColumns = info.numberColumns; #endif for (int i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; double value = solution[iPivot]; double cost = costModel[iPivot]; double change = primalRatio * work[i]; work[i] = 0.0; value -= change; changeObj -= change * cost; double lower = lowerModel[iPivot]; double upper = upperModel[iPivot]; solution[iPivot] = value; if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (!infeas[iRow]) which[numberAdded++]=iRow; infeas[iRow] = value; } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (!infeas[iRow]) which[numberAdded++]=iRow; infeas[iRow] = value; } else { // feasible - was it infeasible - if so set tiny if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } info.numberAdded = numberAdded; info.changeObj = changeObj; } #endif /* Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Computes change in objective function */ void ClpDualRowSteepest::updatePrimalSolution( CoinIndexedVector * primalUpdate, double primalRatio, double & objectiveChange) { double * COIN_RESTRICT work = primalUpdate->denseVector(); int number = primalUpdate->getNumElements(); int * COIN_RESTRICT which = primalUpdate->getIndices(); int i; double changeObj = 0.0; double tolerance = model_->currentPrimalTolerance(); const int * COIN_RESTRICT pivotVariable = model_->pivotVariable(); double * COIN_RESTRICT infeas = infeasible_->denseVector(); double * COIN_RESTRICT solution = model_->solutionRegion(); const double * COIN_RESTRICT costModel = model_->costRegion(); const double * COIN_RESTRICT lowerModel = model_->lowerRegion(); const double * COIN_RESTRICT upperModel = model_->upperRegion(); #ifdef CLP_DUAL_COLUMN_MULTIPLIER int numberColumns = model_->numberColumns(); #endif if (primalUpdate->packedMode()) { #if ABOCA_LITE == 0 for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; double value = solution[iPivot]; double cost = costModel[iPivot]; double change = primalRatio * work[i]; work[i] = 0.0; value -= change; changeObj -= change * cost; double lower = lowerModel[iPivot]; double upper = upperModel[iPivot]; solution[iPivot] = value; if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (infeas[iRow]) infeas[iRow] = value; // already there else infeasible_->quickAdd(iRow, value); } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (infeas[iRow]) infeas[iRow] = value; // already there else infeasible_->quickAdd(iRow, value); } else { // feasible - was it infeasible - if so set tiny if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } #else update_primals info[ABOCA_LITE]; int chunk = (number+ABOCA_LITE-1)/ABOCA_LITE; int n=0; for (i=0;igetNumElements(); int * COIN_RESTRICT index = infeasible_->getIndices(); for (i=0;isetNumElements(n); #endif } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; double value = solution[iPivot]; double cost = costModel[iPivot]; double change = primalRatio * work[iRow]; value -= change; changeObj -= change * cost; double lower = lowerModel[iPivot]; double upper = upperModel[iPivot]; solution[iPivot] = value; if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (infeas[iRow]) infeas[iRow] = value; // already there else infeasible_->quickAdd(iRow, value); } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (infeas[iRow]) infeas[iRow] = value; // already there else infeasible_->quickAdd(iRow, value); } else { // feasible - was it infeasible - if so set tiny if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } work[iRow] = 0.0; } } // Do pivot row { int iRow = model_->pivotRow(); // feasible - was it infeasible - if so set tiny //assert (infeas[iRow]); if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } primalUpdate->setNumElements(0); objectiveChange += changeObj; } /* Saves any weights round factorization as pivot rows may change 1) before factorization 2) after factorization 3) just redo infeasibilities 4) as 2 but restore weights from previous snapshot 5) for strong branching - initialize to 1 , infeasibilities 6) scale back 7) for strong branching - initialize full weights , infeasibilities */ void ClpDualRowSteepest::saveWeights(ClpSimplex * model, int mode) { // alternateWeights_ is defined as indexed but is treated oddly model_ = model; int numberRows = model_->numberRows(); int numberColumns = model_->numberColumns(); const int * pivotVariable = model_->pivotVariable(); int i; if (mode == 1) { if(weights_) { // Check if size has changed if (infeasible_->capacity() == numberRows) { alternateWeights_->clear(); // change from row numbers to sequence numbers int * which = alternateWeights_->getIndices(); for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; which[i] = iPivot; } state_ = 1; // clear marker on savedWeights_ assert (savedWeights_); if (savedWeights_->packedMode()) { savedWeights_->setPackedMode(false); savedWeights_->setNumElements(0); } } else { // size has changed - clear everything delete [] weights_; weights_ = NULL; delete [] dubiousWeights_; dubiousWeights_ = NULL; delete infeasible_; infeasible_ = NULL; delete alternateWeights_; alternateWeights_ = NULL; delete savedWeights_; savedWeights_ = NULL; state_ = -1; } } } else if (mode == 2 || mode == 4 || mode >= 5) { // restore if (!weights_ || state_ == -1 || mode == 5 || mode == 7) { // initialize weights delete [] weights_; delete alternateWeights_; weights_ = new double[numberRows]; // initialize to 1.0 (can we do better?) for (i = 0; i < numberRows; i++) { weights_[i] = 1.0; } alternateWeights_ = new CoinIndexedVector(); // enough space so can use it for factorization alternateWeights_->reserve(numberRows + model_->factorization()->maximumPivots()); if (mode_ != 1 || mode == 5) { } else { CoinIndexedVector * temp = new CoinIndexedVector(); temp->reserve(numberRows + model_->factorization()->maximumPivots()); double * array = alternateWeights_->denseVector(); int * which = alternateWeights_->getIndices(); int firstRow=0; int lastRow=numberRows; if (mode==7) { // use info passed in firstRow=model->spareIntArray_[0]; lastRow=model->spareIntArray_[1]; } for (i = firstRow; i < lastRow; i++) { double value = 0.0; array[0] = 1.0; which[0] = i; alternateWeights_->setNumElements(1); alternateWeights_->setPackedMode(true); model_->factorization()->updateColumnTranspose(temp, alternateWeights_); int number = alternateWeights_->getNumElements(); int j; for (j = 0; j < number; j++) { value += array[j] * array[j]; array[j] = 0.0; } alternateWeights_->setNumElements(0); weights_[i] = value; } delete temp; } // create saved weights (not really indexedvector) savedWeights_ = new CoinIndexedVector(); savedWeights_->reserve(numberRows); for (int i=0;inumberRows();i++) savedWeights_->denseVector()[i]=1.0; double * array = savedWeights_->denseVector(); int * which = savedWeights_->getIndices(); for (int i = 0; i < numberRows; i++) { array[i] = weights_[i]; which[i] = pivotVariable[i]; } if (mode==7) { savedWeights_->setNumElements(numberRows); //flag as special savedWeights_->setPackedMode(true); } } else if (mode != 6) { int * which = alternateWeights_->getIndices(); CoinIndexedVector * rowArray3 = model_->rowArray(3); rowArray3->clear(); int * back = rowArray3->getIndices(); // In case something went wrong for (i = 0; i < numberRows + numberColumns; i++) back[i] = -1; if (mode != 4) { // save CoinMemcpyN(which, numberRows, savedWeights_->getIndices()); CoinMemcpyN(weights_, numberRows, savedWeights_->denseVector()); } else { // restore //memcpy(which,savedWeights_->getIndices(), // numberRows*sizeof(int)); //memcpy(weights_,savedWeights_->denseVector(), // numberRows*sizeof(double)); which = savedWeights_->getIndices(); } // restore (a bit slow - but only every re-factorization) double * array = savedWeights_->denseVector(); for (i = 0; i < numberRows; i++) { int iSeq = which[i]; back[iSeq] = i; } int firstRow=0; int lastRow=numberRows; if (mode==7) { // use info passed in firstRow=model->spareIntArray_[0]; lastRow=model->spareIntArray_[1]; } for (i = firstRow; i < lastRow; i++) { int iPivot = pivotVariable[i]; iPivot = back[iPivot]; if (iPivot >= 0) { weights_[i] = array[iPivot]; if (weights_[i] < DEVEX_TRY_NORM) weights_[i] = DEVEX_TRY_NORM; // may need to check more } else { // odd weights_[i] = 1.0; //printf("bad pivot row %d (%d->%d) iPivot %d\n",i,firstRow,lastRow,iPivot); } } #if 0 printf("mode %d mode_ %d state_ %d\n",mode,mode_,state_); if (!model_->numberIterations()) { for (int k=0;klargestPrimalError(); double allowed ; if (primalError > 1.0e3) allowed = 10.0; else if (primalError > 1.0e2) allowed = 50.0; else if (primalError > 1.0e1) allowed = 100.0; else allowed = 1000.0; double allowedInv = 1.0 / allowed; for (i = 0; i < numberRows; i++) { double value = weights_[i]; if (value < allowedInv) value = allowedInv; else if (value > allowed) value = allowed; weights_[i] = allowed; } } state_ = 0; // set up infeasibilities if (!infeasible_) { infeasible_ = new CoinIndexedVector(); infeasible_->reserve(numberRows); } } if (mode >= 2) { // Get dubious weights //if (!dubiousWeights_) //dubiousWeights_=new int[numberRows]; //model_->factorization()->getWeights(dubiousWeights_); infeasible_->clear(); int iRow; const int * pivotVariable = model_->pivotVariable(); double tolerance = model_->currentPrimalTolerance(); for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; double value = model_->solution(iPivot); double lower = model_->lower(iPivot); double upper = model_->upper(iPivot); if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list infeasible_->quickAdd(iRow, value); } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_COLUMN_MULTIPLIER if (iPivot < numberColumns) value *= CLP_DUAL_COLUMN_MULTIPLIER; // bias towards columns #endif #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list infeasible_->quickAdd(iRow, value); } } } // see where coming from if (mode==2&&!model->numberIterations()) { int options=model->specialOptions(); if ((options&16384)!=0&&true) { // fast of some sort - could be clever??? // for now initialize if ((options&524288)!=0&&false) { // fathom for (int i = 0; i < numberRows; i++) weights_[i] = 1.0; } else if (true) { // strong for (int i = 0; i < numberRows; i++) weights_[i] = 1.0; } } } } // Pass in saved weights void ClpDualRowSteepest::passInSavedWeights(const CoinIndexedVector * saved) { delete savedWeights_; savedWeights_=new CoinIndexedVector(*saved); } // Gets rid of last update void ClpDualRowSteepest::unrollWeights() { double * saved = alternateWeights_->denseVector(); int number = alternateWeights_->getNumElements(); int * which = alternateWeights_->getIndices(); int i; if (alternateWeights_->packedMode()) { for (i = 0; i < number; i++) { int iRow = which[i]; weights_[iRow] = saved[i]; saved[i] = 0.0; } } else { for (i = 0; i < number; i++) { int iRow = which[i]; weights_[iRow] = saved[iRow]; saved[iRow] = 0.0; } } alternateWeights_->setNumElements(0); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpDualRowPivot * ClpDualRowSteepest::clone(bool CopyData) const { if (CopyData) { return new ClpDualRowSteepest(*this); } else { return new ClpDualRowSteepest(); } } // Gets rid of all arrays void ClpDualRowSteepest::clearArrays() { if (persistence_ == normal) { delete [] weights_; weights_ = NULL; delete [] dubiousWeights_; dubiousWeights_ = NULL; delete infeasible_; infeasible_ = NULL; delete alternateWeights_; alternateWeights_ = NULL; delete savedWeights_; savedWeights_ = NULL; } state_ = -1; } // Returns true if would not find any row bool ClpDualRowSteepest::looksOptimal() const { int iRow; const int * pivotVariable = model_->pivotVariable(); double tolerance = model_->currentPrimalTolerance(); // we can't really trust infeasibilities if there is primal error // this coding has to mimic coding in checkPrimalSolution double error = CoinMin(1.0e-2, model_->largestPrimalError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; // But cap tolerance = CoinMin(1000.0, tolerance); int numberRows = model_->numberRows(); int numberInfeasible = 0; for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; double value = model_->solution(iPivot); double lower = model_->lower(iPivot); double upper = model_->upper(iPivot); if (value < lower - tolerance) { numberInfeasible++; } else if (value > upper + tolerance) { numberInfeasible++; } } return (numberInfeasible == 0); } // Called when maximum pivots changes void ClpDualRowSteepest::maximumPivotsChanged() { if (alternateWeights_ && alternateWeights_->capacity() != model_->numberRows() + model_->factorization()->maximumPivots()) { delete alternateWeights_; alternateWeights_ = new CoinIndexedVector(); // enough space so can use it for factorization alternateWeights_->reserve(model_->numberRows() + model_->factorization()->maximumPivots()); } } CoinMP-1.8.3/Clp/src/ClpObjective.hpp0000644000175000017500000001026311662222261015705 0ustar renerene/* $Id: ClpObjective.hpp 1825 2011-11-20 16:02:57Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpObjective_H #define ClpObjective_H //############################################################################# class ClpSimplex; class ClpModel; /** Objective Abstract Base Class Abstract Base Class for describing an objective function */ class ClpObjective { public: ///@name Stuff //@{ /** Returns gradient. If Linear then solution may be NULL, also returns an offset (to be added to current one) If refresh is false then uses last solution Uses model for scaling includeLinear 0 - no, 1 as is, 2 as feasible */ virtual double * gradient(const ClpSimplex * model, const double * solution, double & offset, bool refresh, int includeLinear = 2) = 0; /** Returns reduced gradient.Returns an offset (to be added to current one). */ virtual double reducedGradient(ClpSimplex * model, double * region, bool useFeasibleCosts) = 0; /** Returns step length which gives minimum of objective for solution + theta * change vector up to maximum theta. arrays are numberColumns+numberRows Also sets current objective, predicted and at maximumTheta */ virtual double stepLength(ClpSimplex * model, const double * solution, const double * change, double maximumTheta, double & currentObj, double & predictedObj, double & thetaObj) = 0; /// Return objective value (without any ClpModel offset) (model may be NULL) virtual double objectiveValue(const ClpSimplex * model, const double * solution) const = 0; /// Resize objective virtual void resize(int newNumberColumns) = 0; /// Delete columns in objective virtual void deleteSome(int numberToDelete, const int * which) = 0; /// Scale objective virtual void reallyScale(const double * columnScale) = 0; /** Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ virtual int markNonlinear(char * which); /// Say we have new primal solution - so may need to recompute virtual void newXValues() {} //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpObjective(); /// Copy constructor ClpObjective(const ClpObjective &); /// Assignment operator ClpObjective & operator=(const ClpObjective& rhs); /// Destructor virtual ~ClpObjective (); /// Clone virtual ClpObjective * clone() const = 0; /** Subset clone. Duplicates are allowed and order is as given. Derived classes need not provide this as it may not always make sense */ virtual ClpObjective * subsetClone (int numberColumns, const int * whichColumns) const; //@} ///@name Other //@{ /// Returns type (above 63 is extra information) inline int type() const { return type_; } /// Sets type (above 63 is extra information) inline void setType(int value) { type_ = value; } /// Whether activated inline int activated() const { return activated_; } /// Set whether activated inline void setActivated(int value) { activated_ = value; } /// Objective offset inline double nonlinearOffset () const { return offset_; } //@} //--------------------------------------------------------------------------- protected: ///@name Protected member data //@{ /// Value of non-linear part of objective double offset_; /// Type of objective - linear is 1 int type_; /// Whether activated int activated_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpPrimalColumnSteepest.cpp0000644000175000017500000050447212547436603020131 0ustar renerene/* $Id: ClpPrimalColumnSteepest.cpp 2151 2015-07-09 09:23:15Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "CoinIndexedVector.hpp" #include "ClpFactorization.hpp" #include "ClpNonLinearCost.hpp" #include "ClpMessage.hpp" #include "CoinHelperFunctions.hpp" #include //#define CLP_DEBUG //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpPrimalColumnSteepest::ClpPrimalColumnSteepest (int mode) : ClpPrimalColumnPivot(), devex_(0.0), weights_(NULL), infeasible_(NULL), alternateWeights_(NULL), savedWeights_(NULL), reference_(NULL), state_(-1), mode_(mode), persistence_(normal), numberSwitched_(0), pivotSequence_(-1), savedPivotSequence_(-1), savedSequenceOut_(-1), sizeFactorization_(0) { type_ = 2 + 64 * mode; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpPrimalColumnSteepest::ClpPrimalColumnSteepest (const ClpPrimalColumnSteepest & rhs) : ClpPrimalColumnPivot(rhs) { state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; numberSwitched_ = rhs.numberSwitched_; model_ = rhs.model_; pivotSequence_ = rhs.pivotSequence_; savedPivotSequence_ = rhs.savedPivotSequence_; savedSequenceOut_ = rhs.savedSequenceOut_; sizeFactorization_ = rhs.sizeFactorization_; devex_ = rhs.devex_; if ((model_ && model_->whatsChanged() & 1) != 0) { if (rhs.infeasible_) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } reference_ = NULL; if (rhs.weights_) { assert(model_); int number = model_->numberRows() + model_->numberColumns(); assert (number == rhs.model_->numberRows() + rhs.model_->numberColumns()); weights_ = new double[number]; CoinMemcpyN(rhs.weights_, number, weights_); savedWeights_ = new double[number]; CoinMemcpyN(rhs.savedWeights_, number, savedWeights_); if (mode_ != 1) { reference_ = CoinCopyOfArray(rhs.reference_, (number + 31) >> 5); } } else { weights_ = NULL; savedWeights_ = NULL; } if (rhs.alternateWeights_) { alternateWeights_ = new CoinIndexedVector(rhs.alternateWeights_); } else { alternateWeights_ = NULL; } } else { infeasible_ = NULL; reference_ = NULL; weights_ = NULL; savedWeights_ = NULL; alternateWeights_ = NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpPrimalColumnSteepest::~ClpPrimalColumnSteepest () { delete [] weights_; delete infeasible_; delete alternateWeights_; delete [] savedWeights_; delete [] reference_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpPrimalColumnSteepest & ClpPrimalColumnSteepest::operator=(const ClpPrimalColumnSteepest& rhs) { if (this != &rhs) { ClpPrimalColumnPivot::operator=(rhs); state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; numberSwitched_ = rhs.numberSwitched_; model_ = rhs.model_; pivotSequence_ = rhs.pivotSequence_; savedPivotSequence_ = rhs.savedPivotSequence_; savedSequenceOut_ = rhs.savedSequenceOut_; sizeFactorization_ = rhs.sizeFactorization_; devex_ = rhs.devex_; delete [] weights_; delete [] reference_; reference_ = NULL; delete infeasible_; delete alternateWeights_; delete [] savedWeights_; savedWeights_ = NULL; if (rhs.infeasible_ != NULL) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } if (rhs.weights_ != NULL) { assert(model_); int number = model_->numberRows() + model_->numberColumns(); assert (number == rhs.model_->numberRows() + rhs.model_->numberColumns()); weights_ = new double[number]; CoinMemcpyN(rhs.weights_, number, weights_); savedWeights_ = new double[number]; CoinMemcpyN(rhs.savedWeights_, number, savedWeights_); if (mode_ != 1) { reference_ = CoinCopyOfArray(rhs.reference_, (number + 31) >> 5); } } else { weights_ = NULL; } if (rhs.alternateWeights_ != NULL) { alternateWeights_ = new CoinIndexedVector(rhs.alternateWeights_); } else { alternateWeights_ = NULL; } } return *this; } // These have to match ClpPackedMatrix version #define TRY_NORM 1.0e-4 #define ADD_ONE 1.0 // Returns pivot column, -1 if none /* The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row*/ int ClpPrimalColumnSteepest::pivotColumn(CoinIndexedVector * updates, CoinIndexedVector * spareRow1, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { assert(model_); if (model_->nonLinearCost()->lookBothWays() || model_->algorithm() == 2) { // Do old way updates->expand(); return pivotColumnOldMethod(updates, spareRow1, spareRow2, spareColumn1, spareColumn2); } int number = 0; int * index; double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); int anyUpdates; double * infeas = infeasible_->denseVector(); // Local copy of mode so can decide what to do int switchType; if (mode_ == 4) switchType = 5 - numberSwitched_; else if (mode_ >= 10) switchType = 3; else switchType = mode_; /* switchType - 0 - all exact devex 1 - all steepest 2 - some exact devex 3 - auto some exact devex 4 - devex 5 - dantzig 10 - can go to mini-sprint */ // Look at gub #if 1 model_->clpMatrix()->dualExpanded(model_, updates, NULL, 4); #else updates->clear(); model_->computeDuals(NULL); #endif if (updates->getNumElements() > 1) { // would have to have two goes for devex, three for steepest anyUpdates = 2; } else if (updates->getNumElements()) { if (updates->getIndices()[0] == pivotRow && fabs(updates->denseVector()[0]) > 1.0e-6) { // reasonable size anyUpdates = 1; //if (fabs(model_->dualIn())<1.0e-4||fabs(fabs(model_->dualIn())-fabs(updates->denseVector()[0]))>1.0e-5) //printf("dualin %g pivot %g\n",model_->dualIn(),updates->denseVector()[0]); } else { // too small anyUpdates = 2; } } else if (pivotSequence_ >= 0) { // just after re-factorization anyUpdates = -1; } else { // sub flip - nothing to do anyUpdates = 0; } int sequenceOut = model_->sequenceOut(); if (switchType == 5) { // If known matrix then we will do partial pricing if (model_->clpMatrix()->canDoPartialPricing()) { pivotSequence_ = -1; pivotRow = -1; // See if to switch int numberRows = model_->numberRows(); int numberWanted = 10; int numberColumns = model_->numberColumns(); int numberHiddenRows = model_->clpMatrix()->hiddenRows(); double ratio = static_cast (sizeFactorization_ + numberHiddenRows) / static_cast (numberRows + 2 * numberHiddenRows); // Number of dual infeasibilities at last invert int numberDual = model_->numberDualInfeasibilities(); int numberLook = CoinMin(numberDual, numberColumns / 10); if (ratio < 1.0) { numberWanted = 100; numberLook /= 20; numberWanted = CoinMax(numberWanted, numberLook); } else if (ratio < 3.0) { numberWanted = 500; numberLook /= 15; numberWanted = CoinMax(numberWanted, numberLook); } else if (ratio < 4.0 || mode_ == 5) { numberWanted = 1000; numberLook /= 10; numberWanted = CoinMax(numberWanted, numberLook); } else if (mode_ != 5) { switchType = 4; // initialize numberSwitched_++; // Make sure will re-do delete [] weights_; weights_ = NULL; model_->computeDuals(NULL); saveWeights(model_, 4); anyUpdates = 0; COIN_DETAIL_PRINT(printf("switching to devex %d nel ratio %g\n", sizeFactorization_, ratio)); } if (switchType == 5) { numberLook *= 5; // needs tuning for gub if (model_->numberIterations() % 1000 == 0 && model_->logLevel() > 1) { COIN_DETAIL_PRINT(printf("numels %d ratio %g wanted %d look %d\n", sizeFactorization_, ratio, numberWanted, numberLook)); } // Update duals and row djs // Do partial pricing return partialPricing(updates, spareRow2, numberWanted, numberLook); } } } if (switchType == 5) { if (anyUpdates > 0) { justDjs(updates, spareRow2, spareColumn1, spareColumn2); } } else if (anyUpdates == 1) { if (switchType < 4) { // exact etc when can use dj djsAndSteepest(updates, spareRow2, spareColumn1, spareColumn2); } else { // devex etc when can use dj djsAndDevex(updates, spareRow2, spareColumn1, spareColumn2); } } else if (anyUpdates == -1) { if (switchType < 4) { // exact etc when djs okay justSteepest(updates, spareRow2, spareColumn1, spareColumn2); } else { // devex etc when djs okay justDevex(updates, spareRow2, spareColumn1, spareColumn2); } } else if (anyUpdates == 2) { if (switchType < 4) { // exact etc when have to use pivot djsAndSteepest2(updates, spareRow2, spareColumn1, spareColumn2); } else { // devex etc when have to use pivot djsAndDevex2(updates, spareRow2, spareColumn1, spareColumn2); } } #ifdef CLP_DEBUG alternateWeights_->checkClear(); #endif // make sure outgoing from last iteration okay if (sequenceOut >= 0) { ClpSimplex::Status status = model_->getStatus(sequenceOut); double value = model_->reducedCost(sequenceOut); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } } } // update of duals finished - now do pricing // See what sort of pricing int numberWanted = 10; number = infeasible_->getNumElements(); int numberColumns = model_->numberColumns(); if (switchType == 5) { pivotSequence_ = -1; pivotRow = -1; // See if to switch int numberRows = model_->numberRows(); // ratio is done on number of columns here //double ratio = static_cast sizeFactorization_/static_cast numberColumns; double ratio = static_cast (sizeFactorization_) / static_cast (numberRows); //double ratio = static_cast sizeFactorization_/static_cast model_->clpMatrix()->getNumElements(); if (ratio < 1.0) { numberWanted = CoinMax(100, number / 200); } else if (ratio < 2.0 - 1.0) { numberWanted = CoinMax(500, number / 40); } else if (ratio < 4.0 - 3.0 || mode_ == 5) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 30); } else if (mode_ != 5) { switchType = 4; // initialize numberSwitched_++; // Make sure will re-do delete [] weights_; weights_ = NULL; saveWeights(model_, 4); COIN_DETAIL_PRINT(printf("switching to devex %d nel ratio %g\n", sizeFactorization_, ratio)); } //if (model_->numberIterations()%1000==0) //printf("numels %d ratio %g wanted %d\n",sizeFactorization_,ratio,numberWanted); } int numberRows = model_->numberRows(); // ratio is done on number of rows here double ratio = static_cast (sizeFactorization_) / static_cast (numberRows); if(switchType == 4) { // Still in devex mode // Go to steepest if lot of iterations? if (ratio < 5.0) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 20); } else if (ratio < 7.0) { numberWanted = CoinMax(2000, number / 5); numberWanted = CoinMax(numberWanted, numberColumns / 10); } else { // we can zero out updates->clear(); spareColumn1->clear(); switchType = 3; // initialize pivotSequence_ = -1; pivotRow = -1; numberSwitched_++; // Make sure will re-do delete [] weights_; weights_ = NULL; saveWeights(model_, 4); COIN_DETAIL_PRINT(printf("switching to exact %d nel ratio %g\n", sizeFactorization_, ratio)); updates->clear(); } if (model_->numberIterations() % 1000 == 0) COIN_DETAIL_PRINT(printf("numels %d ratio %g wanted %d type x\n", sizeFactorization_, ratio, numberWanted)); } if (switchType < 4) { if (switchType < 2 ) { numberWanted = number + 1; } else if (switchType == 2) { numberWanted = CoinMax(2000, number / 8); } else { if (ratio < 1.0) { numberWanted = CoinMax(2000, number / 20); } else if (ratio < 5.0) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 40); } else if (ratio < 10.0) { numberWanted = CoinMax(2000, number / 8); numberWanted = CoinMax(numberWanted, numberColumns / 20); } else { ratio = number * (ratio / 80.0); if (ratio > number) { numberWanted = number + 1; } else { numberWanted = CoinMax(2000, static_cast (ratio)); numberWanted = CoinMax(numberWanted, numberColumns / 10); } } } //if (model_->numberIterations()%1000==0) //printf("numels %d ratio %g wanted %d type %d\n",sizeFactorization_,ratio,numberWanted, //switchType); } double bestDj = 1.0e-30; int bestSequence = -1; int i, iSequence; index = infeasible_->getIndices(); number = infeasible_->getNumElements(); // Re-sort infeasible every 100 pivots // Not a good idea if (0 && model_->factorization()->pivots() > 0 && (model_->factorization()->pivots() % 100) == 0) { int nLook = model_->numberRows() + numberColumns; number = 0; for (i = 0; i < nLook; i++) { if (infeas[i]) { if (fabs(infeas[i]) > COIN_INDEXED_TINY_ELEMENT) index[number++] = i; else infeas[i] = 0.0; } } infeasible_->setNumElements(number); } if(model_->numberIterations() < model_->lastBadIteration() + 200 && model_->factorization()->pivots() > 10) { // we can't really trust infeasibilities if there is dual error double checkTolerance = 1.0e-8; if (model_->largestDualError() > checkTolerance) tolerance *= model_->largestDualError() / checkTolerance; // But cap tolerance = CoinMin(1000.0, tolerance); } #ifdef CLP_DEBUG if (model_->numberDualInfeasibilities() == 1) printf("** %g %g %g %x %x %d\n", tolerance, model_->dualTolerance(), model_->largestDualError(), model_, model_->messageHandler(), number); #endif // stop last one coming immediately double saveOutInfeasibility = 0.0; if (sequenceOut >= 0) { saveOutInfeasibility = infeas[sequenceOut]; infeas[sequenceOut] = 0.0; } if (model_->factorization()->pivots() && model_->numberPrimalInfeasibilities()) tolerance = CoinMax(tolerance, 1.0e-15 * model_->infeasibilityCost()); tolerance *= tolerance; // as we are using squares int iPass; // Setup two passes int start[4]; start[1] = number; start[2] = 0; double dstart = static_cast (number) * model_->randomNumberGenerator()->randomDouble(); start[0] = static_cast (dstart); start[3] = start[0]; //double largestWeight=0.0; //double smallestWeight=1.0e100; for (iPass = 0; iPass < 2; iPass++) { int end = start[2*iPass+1]; if (switchType < 5) { for (i = start[2*iPass]; i < end; i++) { iSequence = index[i]; double value = infeas[iSequence]; double weight = weights_[iSequence]; if (value > tolerance) { //weight=1.0; if (value > bestDj * weight) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value / weight; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } numberWanted--; } if (!numberWanted) break; } } else { // Dantzig for (i = start[2*iPass]; i < end; i++) { iSequence = index[i]; double value = infeas[iSequence]; if (value > tolerance) { if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } numberWanted--; } if (!numberWanted) break; } } if (!numberWanted) break; } model_->clpMatrix()->setSavedBestSequence(bestSequence); if (bestSequence >= 0) model_->clpMatrix()->setSavedBestDj(model_->djRegion()[bestSequence]); if (sequenceOut >= 0) { infeas[sequenceOut] = saveOutInfeasibility; } /*if (model_->numberIterations()%100==0) printf("%d best %g\n",bestSequence,bestDj);*/ #ifndef NDEBUG if (bestSequence >= 0) { if (model_->getStatus(bestSequence) == ClpSimplex::atLowerBound) assert(model_->reducedCost(bestSequence) < 0.0); if (model_->getStatus(bestSequence) == ClpSimplex::atUpperBound) { assert(model_->reducedCost(bestSequence) > 0.0); } } #endif #if 0 for (int i=0;icurrentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); double * infeas = infeasible_->denseVector(); //updates->scanAndPack(); model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray (packed mode) model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); // normal for (iSection = 0; iSection < 2; iSection++) { reducedCost = model_->djRegion(iSection); int addSequence; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER double slack_multiplier; #endif if (!iSection) { number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); addSequence = model_->numberColumns(); #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = CLP_PRIMAL_SLACK_MULTIPLIER; #endif } else { number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); addSequence = 0; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = 1.0; #endif } for (j = 0; j < number; j++) { int iSequence = index[j]; double value = reducedCost[iSequence]; value -= updateBy[j]; updateBy[j] = 0.0; reducedCost[iSequence] = value; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: iSequence += addSequence; if (value > tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atLowerBound: iSequence += addSequence; if (value < -tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } } } } updates->setNumElements(0); spareColumn1->setNumElements(0); if (pivotRow >= 0) { // make sure infeasibility on incoming is 0.0 int sequenceIn = model_->sequenceIn(); infeasible_->zero(sequenceIn); } } // Update djs, weights for Devex void ClpPrimalColumnSteepest::djsAndDevex(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { int j; int number = 0; int * index; double * updateBy; double * reducedCost; double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; // for weights update we use pivotSequence // unset in case sub flip assert (pivotSequence_ >= 0); assert (model_->pivotVariable()[pivotSequence_] == model_->sequenceIn()); pivotSequence_ = -1; double * infeas = infeasible_->denseVector(); //updates->scanAndPack(); model_->factorization()->updateColumnTranspose(spareRow2, updates); // and we can see if reference //double referenceIn = 0.0; int sequenceIn = model_->sequenceIn(); //if (mode_ != 1 && reference(sequenceIn)) // referenceIn = 1.0; // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; double scaleFactor = 1.0 / updates->denseVector()[0]; // as formula is with 1.0 // put row of tableau in rowArray and columnArray (packed mode) model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); // update weights double * weight; int numberColumns = model_->numberColumns(); // rows reducedCost = model_->djRegion(0); int addSequence = model_->numberColumns();; number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_ + numberColumns; // Devex for (j = 0; j < number; j++) { double thisWeight; double pivot; double value3; int iSequence = index[j]; double value = reducedCost[iSequence]; double value2 = updateBy[j]; updateBy[j] = 0.0; value -= value2; reducedCost[iSequence] = value; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence + numberColumns)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence + numberColumns)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); iSequence += addSequence; if (value > tolerance) { // store square in list #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*CLP_PRIMAL_SLACK_MULTIPLIER; #else value *= value; #endif if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence , value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atLowerBound: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence + numberColumns)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); iSequence += addSequence; if (value < -tolerance) { // store square in list #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*CLP_PRIMAL_SLACK_MULTIPLIER; #else value *= value; #endif if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence , value); } else { infeasible_->zero(iSequence); } } } // columns weight = weights_; scaleFactor = -scaleFactor; reducedCost = model_->djRegion(1); number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); // Devex for (j = 0; j < number; j++) { double thisWeight; double pivot; double value3; int iSequence = index[j]; double value = reducedCost[iSequence]; double value2 = updateBy[j]; value -= value2; updateBy[j] = 0.0; reducedCost[iSequence] = value; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atUpperBound: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (value > tolerance) { // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atLowerBound: thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; value3 = pivot * pivot * devex_; if (reference(iSequence)) value3 += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value3); if (value < -tolerance) { // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } } } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; // make sure infeasibility on incoming is 0.0 infeasible_->zero(sequenceIn); spareRow2->setNumElements(0); //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getStatus(iCheck) != ClpSimplex::basic && !model_->getStatus(iCheck) != ClpSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates, spareRow2); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } // Update djs, weights for Steepest void ClpPrimalColumnSteepest::djsAndSteepest(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { int j; int number = 0; int * index; double * updateBy; double * reducedCost; double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; // for weights update we use pivotSequence // unset in case sub flip assert (pivotSequence_ >= 0); assert (model_->pivotVariable()[pivotSequence_] == model_->sequenceIn()); double * infeas = infeasible_->denseVector(); double scaleFactor = 1.0 / updates->denseVector()[0]; // as formula is with 1.0 assert (updates->getIndices()[0] == pivotSequence_); pivotSequence_ = -1; //updates->scanAndPack(); model_->factorization()->updateColumnTranspose(spareRow2, updates); //alternateWeights_->scanAndPack(); model_->factorization()->updateColumnTranspose(spareRow2, alternateWeights_); // and we can see if reference int sequenceIn = model_->sequenceIn(); double referenceIn; if (mode_ != 1) { if(reference(sequenceIn)) referenceIn = 1.0; else referenceIn = 0.0; } else { referenceIn = -1.0; } // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; // update row weights here so we can scale alternateWeights_ // update weights double * weight; double * other = alternateWeights_->denseVector(); int numberColumns = model_->numberColumns(); // rows reducedCost = model_->djRegion(0); int addSequence = model_->numberColumns();; number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_ + numberColumns; for (j = 0; j < number; j++) { double thisWeight; double pivot; double modification; double pivotSquared; int iSequence = index[j]; double value2 = updateBy[j]; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); double value; switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); reducedCost[iSequence] = 0.0; case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = reducedCost[iSequence] - value2; modification = other[iSequence]; thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; reducedCost[iSequence] = value; if (thisWeight < TRY_NORM) { if (mode_ == 1) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence + numberColumns)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: value = reducedCost[iSequence] - value2; modification = other[iSequence]; thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; reducedCost[iSequence] = value; if (thisWeight < TRY_NORM) { if (mode_ == 1) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence + numberColumns)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; iSequence += addSequence; if (value > tolerance) { // store square in list #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*CLP_PRIMAL_SLACK_MULTIPLIER; #else value *= value; #endif if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence , value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atLowerBound: value = reducedCost[iSequence] - value2; modification = other[iSequence]; thisWeight = weight[iSequence]; // row has -1 pivot = value2 * scaleFactor; pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; reducedCost[iSequence] = value; if (thisWeight < TRY_NORM) { if (mode_ == 1) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence + numberColumns)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; iSequence += addSequence; if (value < -tolerance) { // store square in list #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*CLP_PRIMAL_SLACK_MULTIPLIER; #else value *= value; #endif if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } } } // put row of tableau in rowArray and columnArray (packed) // get subset which have nonzero tableau elements transposeTimes2(updates, spareColumn1, alternateWeights_, spareColumn2, spareRow2, -scaleFactor); // zero updateBy CoinZeroN(updateBy, number); alternateWeights_->clear(); // columns assert (scaleFactor); reducedCost = model_->djRegion(1); number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); for (j = 0; j < number; j++) { int iSequence = index[j]; double value = reducedCost[iSequence]; double value2 = updateBy[j]; updateBy[j] = 0.0; value -= value2; reducedCost[iSequence] = value; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { // store square in list if (infeas[iSequence]) infeas[iSequence] = value * value; // already there else infeasible_->quickAdd(iSequence, value * value); } else { infeasible_->zero(iSequence); } } } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; // make sure infeasibility on incoming is 0.0 infeasible_->zero(sequenceIn); spareColumn2->setNumElements(0); //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getStatus(iCheck) != ClpSimplex::basic && !model_->getStatus(iCheck) != ClpSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates, spareRow2); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } // Update djs, weights for Devex void ClpPrimalColumnSteepest::djsAndDevex2(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { int iSection, j; int number = 0; int * index; double * updateBy; double * reducedCost; // dj could be very small (or even zero - take care) double dj = model_->dualIn(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); double * infeas = infeasible_->denseVector(); //updates->scanAndPack(); model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); // normal for (iSection = 0; iSection < 2; iSection++) { reducedCost = model_->djRegion(iSection); int addSequence; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER double slack_multiplier; #endif if (!iSection) { number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); addSequence = model_->numberColumns(); #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = CLP_PRIMAL_SLACK_MULTIPLIER; #endif } else { number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); addSequence = 0; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = 1.0; #endif } for (j = 0; j < number; j++) { int iSequence = index[j]; double value = reducedCost[iSequence]; value -= updateBy[j]; updateBy[j] = 0.0; reducedCost[iSequence] = value; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: iSequence += addSequence; if (value > tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atLowerBound: iSequence += addSequence; if (value < -tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } } } } // They are empty updates->setNumElements(0); spareColumn1->setNumElements(0); // make sure infeasibility on incoming is 0.0 int sequenceIn = model_->sequenceIn(); infeasible_->zero(sequenceIn); // for weights update we use pivotSequence if (pivotSequence_ >= 0) { pivotRow = pivotSequence_; // unset in case sub flip pivotSequence_ = -1; // make sure infeasibility on incoming is 0.0 const int * pivotVariable = model_->pivotVariable(); sequenceIn = pivotVariable[pivotRow]; infeasible_->zero(sequenceIn); // and we can see if reference //double referenceIn = 0.0; //if (mode_ != 1 && reference(sequenceIn)) // referenceIn = 1.0; // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; // update weights updates->setNumElements(0); spareColumn1->setNumElements(0); // might as well set dj to 1 dj = 1.0; updates->insert(pivotRow, -dj); model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); double * weight; int numberColumns = model_->numberColumns(); // rows number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_ + numberColumns; assert (devex_ > 0.0); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = - updateBy[iSequence]; updateBy[iSequence] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence + numberColumns)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } // columns weight = weights_; number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = updateBy[iSequence]; updateBy[iSequence] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; spareColumn2->setNumElements(0); //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getStatus(iCheck) != ClpSimplex::basic && !model_->getStatus(iCheck) != ClpSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates, spareRow2); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } } // Update djs, weights for Steepest void ClpPrimalColumnSteepest::djsAndSteepest2(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { int iSection, j; int number = 0; int * index; double * updateBy; double * reducedCost; // dj could be very small (or even zero - take care) double dj = model_->dualIn(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); double * infeas = infeasible_->denseVector(); //updates->scanAndPack(); model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); // normal for (iSection = 0; iSection < 2; iSection++) { reducedCost = model_->djRegion(iSection); int addSequence; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER double slack_multiplier; #endif if (!iSection) { number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); addSequence = model_->numberColumns(); #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = CLP_PRIMAL_SLACK_MULTIPLIER; #endif } else { number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); addSequence = 0; #ifdef CLP_PRIMAL_SLACK_MULTIPLIER slack_multiplier = 1.0; #endif } for (j = 0; j < number; j++) { int iSequence = index[j]; double value = reducedCost[iSequence]; value -= updateBy[j]; updateBy[j] = 0.0; reducedCost[iSequence] = value; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: iSequence += addSequence; if (value > tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } break; case ClpSimplex::atLowerBound: iSequence += addSequence; if (value < -tolerance) { #ifdef CLP_PRIMAL_SLACK_MULTIPLIER value *= value*slack_multiplier; #else value *= value; #endif // store square in list if (infeas[iSequence]) infeas[iSequence] = value; // already there else infeasible_->quickAdd(iSequence, value); } else { infeasible_->zero(iSequence); } } } } // we can zero out as will have to get pivot row // ***** move updates->setNumElements(0); spareColumn1->setNumElements(0); if (pivotRow >= 0) { // make sure infeasibility on incoming is 0.0 int sequenceIn = model_->sequenceIn(); infeasible_->zero(sequenceIn); } // for weights update we use pivotSequence pivotRow = pivotSequence_; // unset in case sub flip pivotSequence_ = -1; if (pivotRow >= 0) { // make sure infeasibility on incoming is 0.0 const int * pivotVariable = model_->pivotVariable(); int sequenceIn = pivotVariable[pivotRow]; assert (sequenceIn == model_->sequenceIn()); infeasible_->zero(sequenceIn); // and we can see if reference double referenceIn; if (mode_ != 1) { if(reference(sequenceIn)) referenceIn = 1.0; else referenceIn = 0.0; } else { referenceIn = -1.0; } // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; // update weights updates->setNumElements(0); spareColumn1->setNumElements(0); // might as well set dj to 1 dj = -1.0; updates->createPacked(1, &pivotRow, &dj); model_->factorization()->updateColumnTranspose(spareRow2, updates); bool needSubset = (mode_ < 4 || numberSwitched_ > 1 || mode_ >= 10); double * weight; double * other = alternateWeights_->denseVector(); int numberColumns = model_->numberColumns(); // rows number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_ + numberColumns; if (needSubset) { // now update weight update array model_->factorization()->updateColumnTranspose(spareRow2, alternateWeights_); // do alternateWeights_ here so can scale for (j = 0; j < number; j++) { int iSequence = index[j]; assert (iSequence >= 0 && iSequence < model_->numberRows()); double thisWeight = weight[iSequence]; // row has -1 double pivot = - updateBy[j]; double modification = other[iSequence]; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; if (thisWeight < TRY_NORM) { if (mode_ == 1) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence + numberColumns)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; } transposeTimes2(updates, spareColumn1, alternateWeights_, spareColumn2, spareRow2, 0.0); } else { // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); } if (needSubset) { CoinZeroN(updateBy, number); } else if (mode_ == 4) { // Devex assert (devex_ > 0.0); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = -updateBy[j]; updateBy[j] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence + numberColumns)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } } // columns weight = weights_; number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); if (needSubset) { // Exact - already done } else if (mode_ == 4) { // Devex for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = updateBy[j]; updateBy[j] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; alternateWeights_->clear(); spareColumn2->setNumElements(0); //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getStatus(iCheck) != ClpSimplex::basic && !model_->getStatus(iCheck) != ClpSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates, spareRow2); } #endif } updates->setNumElements(0); spareColumn1->setNumElements(0); } // Updates two arrays for steepest void ClpPrimalColumnSteepest::transposeTimes2(const CoinIndexedVector * pi1, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * dj2, CoinIndexedVector * spare, double scaleFactor) { // see if reference int sequenceIn = model_->sequenceIn(); double referenceIn; if (mode_ != 1) { if(reference(sequenceIn)) referenceIn = 1.0; else referenceIn = 0.0; } else { referenceIn = -1.0; } if (model_->clpMatrix()->canCombine(model_, pi1)) { // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes2(model_, pi1, dj1, pi2, spare, referenceIn, devex_, reference_, weights_, scaleFactor); } else { // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, pi1, dj2, dj1); // get subset which have nonzero tableau elements model_->clpMatrix()->subsetTransposeTimes(model_, pi2, dj1, dj2); bool killDjs = (scaleFactor == 0.0); if (!scaleFactor) scaleFactor = 1.0; // columns double * weight = weights_; int number = dj1->getNumElements(); const int * index = dj1->getIndices(); double * updateBy = dj1->denseVector(); double * updateBy2 = dj2->denseVector(); for (int j = 0; j < number; j++) { double thisWeight; double pivot; double pivotSquared; int iSequence = index[j]; double value2 = updateBy[j]; if (killDjs) updateBy[j] = 0.0; double modification = updateBy2[j]; updateBy2[j] = 0.0; ClpSimplex::Status status = model_->getStatus(iSequence); if (status != ClpSimplex::basic && status != ClpSimplex::isFixed) { thisWeight = weight[iSequence]; pivot = value2 * scaleFactor; pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; if (thisWeight < TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; } } } dj2->setNumElements(0); } // Update weights for Devex void ClpPrimalColumnSteepest::justDevex(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { int j; int number = 0; int * index; double * updateBy; // dj could be very small (or even zero - take care) double dj = model_->dualIn(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); // for weights update we use pivotSequence pivotRow = pivotSequence_; assert (pivotRow >= 0); // make sure infeasibility on incoming is 0.0 const int * pivotVariable = model_->pivotVariable(); int sequenceIn = pivotVariable[pivotRow]; infeasible_->zero(sequenceIn); // and we can see if reference //double referenceIn = 0.0; //if (mode_ != 1 && reference(sequenceIn)) // referenceIn = 1.0; // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; assert (!updates->getNumElements()); assert (!spareColumn1->getNumElements()); // unset in case sub flip pivotSequence_ = -1; // might as well set dj to 1 dj = -1.0; updates->createPacked(1, &pivotRow, &dj); model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); double * weight; int numberColumns = model_->numberColumns(); // rows number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_ + numberColumns; // Devex assert (devex_ > 0.0); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = - updateBy[j]; updateBy[j] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence + numberColumns)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } // columns weight = weights_; number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); // Devex for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = updateBy[j]; updateBy[j] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; spareColumn2->setNumElements(0); //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getStatus(iCheck) != ClpSimplex::basic && !model_->getStatus(iCheck) != ClpSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates, spareRow2); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } // Update weights for Steepest void ClpPrimalColumnSteepest::justSteepest(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { int j; int number = 0; int * index; double * updateBy; // dj could be very small (or even zero - take care) double dj = model_->dualIn(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); // for weights update we use pivotSequence pivotRow = pivotSequence_; // unset in case sub flip pivotSequence_ = -1; assert (pivotRow >= 0); // make sure infeasibility on incoming is 0.0 const int * pivotVariable = model_->pivotVariable(); int sequenceIn = pivotVariable[pivotRow]; infeasible_->zero(sequenceIn); // and we can see if reference double referenceIn = 0.0; if (mode_ != 1 && reference(sequenceIn)) referenceIn = 1.0; // save outgoing weight round update double outgoingWeight = 0.0; int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; assert (!updates->getNumElements()); assert (!spareColumn1->getNumElements()); // update weights //updates->setNumElements(0); //spareColumn1->setNumElements(0); // might as well set dj to 1 dj = -1.0; updates->createPacked(1, &pivotRow, &dj); model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); double * weight; double * other = alternateWeights_->denseVector(); int numberColumns = model_->numberColumns(); // rows number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_ + numberColumns; // Exact // now update weight update array //alternateWeights_->scanAndPack(); model_->factorization()->updateColumnTranspose(spareRow2, alternateWeights_); // get subset which have nonzero tableau elements model_->clpMatrix()->subsetTransposeTimes(model_, alternateWeights_, spareColumn1, spareColumn2); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = -updateBy[j]; updateBy[j] = 0.0; double modification = other[iSequence]; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; if (thisWeight < TRY_NORM) { if (mode_ == 1) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence + numberColumns)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; } // columns weight = weights_; number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); // Exact double * updateBy2 = spareColumn2->denseVector(); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; double pivot = updateBy[j]; updateBy[j] = 0.0; double modification = updateBy2[j]; updateBy2[j] = 0.0; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; if (thisWeight < TRY_NORM) { if (mode_ == 1) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; alternateWeights_->clear(); spareColumn2->setNumElements(0); //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getStatus(iCheck) != ClpSimplex::basic && !model_->getStatus(iCheck) != ClpSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates, spareRow2); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } // Returns pivot column, -1 if none int ClpPrimalColumnSteepest::pivotColumnOldMethod(CoinIndexedVector * updates, CoinIndexedVector * , CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { assert(model_); int iSection, j; int number = 0; int * index; double * updateBy; double * reducedCost; // dj could be very small (or even zero - take care) double dj = model_->dualIn(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; int pivotRow = model_->pivotRow(); int anyUpdates; double * infeas = infeasible_->denseVector(); // Local copy of mode so can decide what to do int switchType; if (mode_ == 4) switchType = 5 - numberSwitched_; else if (mode_ >= 10) switchType = 3; else switchType = mode_; /* switchType - 0 - all exact devex 1 - all steepest 2 - some exact devex 3 - auto some exact devex 4 - devex 5 - dantzig */ if (updates->getNumElements()) { // would have to have two goes for devex, three for steepest anyUpdates = 2; // add in pivot contribution if (pivotRow >= 0) updates->add(pivotRow, -dj); } else if (pivotRow >= 0) { if (fabs(dj) > 1.0e-15) { // some dj updates->insert(pivotRow, -dj); if (fabs(dj) > 1.0e-6) { // reasonable size anyUpdates = 1; } else { // too small anyUpdates = 2; } } else { // zero dj anyUpdates = -1; } } else if (pivotSequence_ >= 0) { // just after re-factorization anyUpdates = -1; } else { // sub flip - nothing to do anyUpdates = 0; } if (anyUpdates > 0) { model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); // normal for (iSection = 0; iSection < 2; iSection++) { reducedCost = model_->djRegion(iSection); int addSequence; if (!iSection) { number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); addSequence = model_->numberColumns(); } else { number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); addSequence = 0; } if (!model_->nonLinearCost()->lookBothWays()) { for (j = 0; j < number; j++) { int iSequence = index[j]; double value = reducedCost[iSequence]; value -= updateBy[iSequence]; reducedCost[iSequence] = value; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } } } } else { ClpNonLinearCost * nonLinear = model_->nonLinearCost(); // We can go up OR down for (j = 0; j < number; j++) { int iSequence = index[j]; double value = reducedCost[iSequence]; value -= updateBy[iSequence]; reducedCost[iSequence] = value; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { // look other way - change up should be negative value -= nonLinear->changeUpInCost(iSequence + addSequence); if (value > -tolerance) { infeasible_->zero(iSequence + addSequence); } else { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { // look other way - change down should be positive value -= nonLinear->changeDownInCost(iSequence + addSequence); if (value < tolerance) { infeasible_->zero(iSequence + addSequence); } else { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } } } } } } if (anyUpdates == 2) { // we can zero out as will have to get pivot row updates->clear(); spareColumn1->clear(); } if (pivotRow >= 0) { // make sure infeasibility on incoming is 0.0 int sequenceIn = model_->sequenceIn(); infeasible_->zero(sequenceIn); } } // make sure outgoing from last iteration okay int sequenceOut = model_->sequenceOut(); if (sequenceOut >= 0) { ClpSimplex::Status status = model_->getStatus(sequenceOut); double value = model_->reducedCost(sequenceOut); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { // store square in list if (infeas[sequenceOut]) infeas[sequenceOut] = value * value; // already there else infeasible_->quickAdd(sequenceOut, value * value); } else { infeasible_->zero(sequenceOut); } } } // If in quadratic re-compute all if (model_->algorithm() == 2) { for (iSection = 0; iSection < 2; iSection++) { reducedCost = model_->djRegion(iSection); int addSequence; int iSequence; if (!iSection) { number = model_->numberRows(); addSequence = model_->numberColumns(); } else { number = model_->numberColumns(); addSequence = 0; } if (!model_->nonLinearCost()->lookBothWays()) { for (iSequence = 0; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } } } } else { // we can go both ways ClpNonLinearCost * nonLinear = model_->nonLinearCost(); for (iSequence = 0; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence + addSequence); switch(status) { case ClpSimplex::basic: infeasible_->zero(iSequence + addSequence); case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { infeasible_->zero(iSequence + addSequence); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { // look other way - change up should be negative value -= nonLinear->changeUpInCost(iSequence + addSequence); if (value > -tolerance) { infeasible_->zero(iSequence + addSequence); } else { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } else { // look other way - change down should be positive value -= nonLinear->changeDownInCost(iSequence + addSequence); if (value < tolerance) { infeasible_->zero(iSequence + addSequence); } else { // store square in list if (infeas[iSequence+addSequence]) infeas[iSequence+addSequence] = value * value; // already there else infeasible_->quickAdd(iSequence + addSequence, value * value); } } } } } } } // See what sort of pricing int numberWanted = 10; number = infeasible_->getNumElements(); int numberColumns = model_->numberColumns(); if (switchType == 5) { // we can zero out updates->clear(); spareColumn1->clear(); pivotSequence_ = -1; pivotRow = -1; // See if to switch int numberRows = model_->numberRows(); // ratio is done on number of columns here //double ratio = static_cast sizeFactorization_/static_cast numberColumns; double ratio = static_cast (sizeFactorization_) / static_cast (numberRows); //double ratio = static_cast sizeFactorization_/static_cast model_->clpMatrix()->getNumElements(); if (ratio < 0.1) { numberWanted = CoinMax(100, number / 200); } else if (ratio < 0.3) { numberWanted = CoinMax(500, number / 40); } else if (ratio < 0.5 || mode_ == 5) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 30); } else if (mode_ != 5) { switchType = 4; // initialize numberSwitched_++; // Make sure will re-do delete [] weights_; weights_ = NULL; saveWeights(model_, 4); COIN_DETAIL_PRINT(printf("switching to devex %d nel ratio %g\n", sizeFactorization_, ratio)); updates->clear(); } if (model_->numberIterations() % 1000 == 0) COIN_DETAIL_PRINT(printf("numels %d ratio %g wanted %d\n", sizeFactorization_, ratio, numberWanted)); } if(switchType == 4) { // Still in devex mode int numberRows = model_->numberRows(); // ratio is done on number of rows here double ratio = static_cast (sizeFactorization_) / static_cast (numberRows); // Go to steepest if lot of iterations? if (ratio < 1.0) { numberWanted = CoinMax(2000, number / 20); } else if (ratio < 5.0) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 20); } else { // we can zero out updates->clear(); spareColumn1->clear(); switchType = 3; // initialize pivotSequence_ = -1; pivotRow = -1; numberSwitched_++; // Make sure will re-do delete [] weights_; weights_ = NULL; saveWeights(model_, 4); COIN_DETAIL_PRINT(printf("switching to exact %d nel ratio %g\n", sizeFactorization_, ratio)); updates->clear(); } if (model_->numberIterations() % 1000 == 0) COIN_DETAIL_PRINT(printf("numels %d ratio %g wanted %d\n", sizeFactorization_, ratio, numberWanted)); } if (switchType < 4) { if (switchType < 2 ) { numberWanted = number + 1; } else if (switchType == 2) { numberWanted = CoinMax(2000, number / 8); } else { double ratio = static_cast (sizeFactorization_) / static_cast (model_->numberRows()); if (ratio < 1.0) { numberWanted = CoinMax(2000, number / 20); } else if (ratio < 5.0) { numberWanted = CoinMax(2000, number / 10); numberWanted = CoinMax(numberWanted, numberColumns / 20); } else if (ratio < 10.0) { numberWanted = CoinMax(2000, number / 8); numberWanted = CoinMax(numberWanted, numberColumns / 20); } else { ratio = number * (ratio / 80.0); if (ratio > number) { numberWanted = number + 1; } else { numberWanted = CoinMax(2000, static_cast (ratio)); numberWanted = CoinMax(numberWanted, numberColumns / 10); } } } } // for weights update we use pivotSequence pivotRow = pivotSequence_; // unset in case sub flip pivotSequence_ = -1; if (pivotRow >= 0) { // make sure infeasibility on incoming is 0.0 const int * pivotVariable = model_->pivotVariable(); int sequenceIn = pivotVariable[pivotRow]; infeasible_->zero(sequenceIn); // and we can see if reference double referenceIn = 0.0; if (switchType != 1 && reference(sequenceIn)) referenceIn = 1.0; // save outgoing weight round update double outgoingWeight = 0.0; if (sequenceOut >= 0) outgoingWeight = weights_[sequenceOut]; // update weights if (anyUpdates != 1) { updates->setNumElements(0); spareColumn1->setNumElements(0); // might as well set dj to 1 dj = 1.0; updates->insert(pivotRow, -dj); model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); } double * weight; double * other = alternateWeights_->denseVector(); int numberColumns = model_->numberColumns(); double scaleFactor = -1.0 / dj; // as formula is with 1.0 // rows number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); weight = weights_ + numberColumns; if (switchType < 4) { // Exact // now update weight update array model_->factorization()->updateColumnTranspose(spareRow2, alternateWeights_); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = updateBy[iSequence] * scaleFactor; updateBy[iSequence] = 0.0; double modification = other[iSequence]; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; if (thisWeight < TRY_NORM) { if (switchType == 1) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence + numberColumns)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; } } else if (switchType == 4) { // Devex assert (devex_ > 0.0); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = updateBy[iSequence] * scaleFactor; updateBy[iSequence] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence + numberColumns)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } } // columns weight = weights_; scaleFactor = -scaleFactor; number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); if (switchType < 4) { // Exact // get subset which have nonzero tableau elements model_->clpMatrix()->subsetTransposeTimes(model_, alternateWeights_, spareColumn1, spareColumn2); double * updateBy2 = spareColumn2->denseVector(); for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; double pivot = updateBy[iSequence] * scaleFactor; updateBy[iSequence] = 0.0; double modification = updateBy2[j]; updateBy2[j] = 0.0; double pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex_ + pivot * modification; if (thisWeight < TRY_NORM) { if (switchType == 1) { // steepest thisWeight = CoinMax(TRY_NORM, ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, TRY_NORM); } } weight[iSequence] = thisWeight; } } else if (switchType == 4) { // Devex for (j = 0; j < number; j++) { int iSequence = index[j]; double thisWeight = weight[iSequence]; // row has -1 double pivot = updateBy[iSequence] * scaleFactor; updateBy[iSequence] = 0.0; double value = pivot * pivot * devex_; if (reference(iSequence)) value += 1.0; weight[iSequence] = CoinMax(0.99 * thisWeight, value); } } // restore outgoing weight if (sequenceOut >= 0) weights_[sequenceOut] = outgoingWeight; alternateWeights_->clear(); spareColumn2->setNumElements(0); //#define SOME_DEBUG_1 #ifdef SOME_DEBUG_1 // check for accuracy int iCheck = 892; //printf("weight for iCheck is %g\n",weights_[iCheck]); int numberRows = model_->numberRows(); //int numberColumns = model_->numberColumns(); for (iCheck = 0; iCheck < numberRows + numberColumns; iCheck++) { if (model_->getStatus(iCheck) != ClpSimplex::basic && !model_->getStatus(iCheck) != ClpSimplex::isFixed) checkAccuracy(iCheck, 1.0e-1, updates, spareRow2); } #endif updates->setNumElements(0); spareColumn1->setNumElements(0); } // update of duals finished - now do pricing double bestDj = 1.0e-30; int bestSequence = -1; int i, iSequence; index = infeasible_->getIndices(); number = infeasible_->getNumElements(); if(model_->numberIterations() < model_->lastBadIteration() + 200) { // we can't really trust infeasibilities if there is dual error double checkTolerance = 1.0e-8; if (!model_->factorization()->pivots()) checkTolerance = 1.0e-6; if (model_->largestDualError() > checkTolerance) tolerance *= model_->largestDualError() / checkTolerance; // But cap tolerance = CoinMin(1000.0, tolerance); } #ifdef CLP_DEBUG if (model_->numberDualInfeasibilities() == 1) printf("** %g %g %g %x %x %d\n", tolerance, model_->dualTolerance(), model_->largestDualError(), model_, model_->messageHandler(), number); #endif // stop last one coming immediately double saveOutInfeasibility = 0.0; if (sequenceOut >= 0) { saveOutInfeasibility = infeas[sequenceOut]; infeas[sequenceOut] = 0.0; } tolerance *= tolerance; // as we are using squares int iPass; // Setup two passes int start[4]; start[1] = number; start[2] = 0; double dstart = static_cast (number) * model_->randomNumberGenerator()->randomDouble(); start[0] = static_cast (dstart); start[3] = start[0]; //double largestWeight=0.0; //double smallestWeight=1.0e100; for (iPass = 0; iPass < 2; iPass++) { int end = start[2*iPass+1]; if (switchType < 5) { for (i = start[2*iPass]; i < end; i++) { iSequence = index[i]; double value = infeas[iSequence]; if (value > tolerance) { double weight = weights_[iSequence]; //weight=1.0; if (value > bestDj * weight) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value / weight; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } numberWanted--; if (!numberWanted) break; } } else { // Dantzig for (i = start[2*iPass]; i < end; i++) { iSequence = index[i]; double value = infeas[iSequence]; if (value > tolerance) { if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } numberWanted--; if (!numberWanted) break; } } if (!numberWanted) break; } if (sequenceOut >= 0) { infeas[sequenceOut] = saveOutInfeasibility; } /*if (model_->numberIterations()%100==0) printf("%d best %g\n",bestSequence,bestDj);*/ reducedCost = model_->djRegion(); model_->clpMatrix()->setSavedBestSequence(bestSequence); if (bestSequence >= 0) model_->clpMatrix()->setSavedBestDj(reducedCost[bestSequence]); #ifdef CLP_DEBUG if (bestSequence >= 0) { if (model_->getStatus(bestSequence) == ClpSimplex::atLowerBound) assert(model_->reducedCost(bestSequence) < 0.0); if (model_->getStatus(bestSequence) == ClpSimplex::atUpperBound) assert(model_->reducedCost(bestSequence) > 0.0); } #endif return bestSequence; } // Called when maximum pivots changes void ClpPrimalColumnSteepest::maximumPivotsChanged() { if (alternateWeights_ && alternateWeights_->capacity() != model_->numberRows() + model_->factorization()->maximumPivots()) { delete alternateWeights_; alternateWeights_ = new CoinIndexedVector(); // enough space so can use it for factorization alternateWeights_->reserve(model_->numberRows() + model_->factorization()->maximumPivots()); } } /* 1) before factorization 2) after factorization 3) just redo infeasibilities 4) restore weights 5) at end of values pass (so need initialization) */ void ClpPrimalColumnSteepest::saveWeights(ClpSimplex * model, int mode) { model_ = model; if (mode==6) { // If incoming weight is 1.0 then return else as 5 assert (weights_); int sequenceIn = model_->sequenceIn(); assert (sequenceIn>=0&&sequenceInnumberRows()+model_->numberColumns()); if (weights_[sequenceIn]==((mode_!=1) ? 1.0 : 1.0+ADD_ONE)) return; else mode=5; } if (mode_ == 4 || mode_ == 5) { if (mode == 1 && !weights_) numberSwitched_ = 0; // Reset } // alternateWeights_ is defined as indexed but is treated oddly // at times int numberRows = model_->numberRows(); int numberColumns = model_->numberColumns(); const int * pivotVariable = model_->pivotVariable(); bool doInfeasibilities = true; if (mode == 1) { if(weights_) { // Check if size has changed if (infeasible_->capacity() == numberRows + numberColumns && alternateWeights_->capacity() == numberRows + model_->factorization()->maximumPivots()) { //alternateWeights_->clear(); if (pivotSequence_ >= 0 && pivotSequence_ < numberRows) { // save pivot order CoinMemcpyN(pivotVariable, numberRows, alternateWeights_->getIndices()); // change from pivot row number to sequence number pivotSequence_ = pivotVariable[pivotSequence_]; } else { pivotSequence_ = -1; } state_ = 1; } else { // size has changed - clear everything delete [] weights_; weights_ = NULL; delete infeasible_; infeasible_ = NULL; delete alternateWeights_; alternateWeights_ = NULL; delete [] savedWeights_; savedWeights_ = NULL; delete [] reference_; reference_ = NULL; state_ = -1; pivotSequence_ = -1; } } } else if (mode == 2 || mode == 4 || mode == 5) { // restore if (!weights_ || state_ == -1 || mode == 5) { // Partial is only allowed with certain types of matrix if ((mode_ != 4 && mode_ != 5) || numberSwitched_ || !model_->clpMatrix()->canDoPartialPricing()) { // initialize weights delete [] weights_; delete alternateWeights_; weights_ = new double[numberRows+numberColumns]; alternateWeights_ = new CoinIndexedVector(); // enough space so can use it for factorization alternateWeights_->reserve(numberRows + model_->factorization()->maximumPivots()); initializeWeights(); // create saved weights delete [] savedWeights_; savedWeights_ = CoinCopyOfArray(weights_, numberRows + numberColumns); // just do initialization mode = 3; } else { // Partial pricing // use region as somewhere to save non-fixed slacks // set up infeasibilities if (!infeasible_) { infeasible_ = new CoinIndexedVector(); infeasible_->reserve(numberColumns + numberRows); } infeasible_->clear(); int number = model_->numberRows() + model_->numberColumns(); int iSequence; int numberLook = 0; int * which = infeasible_->getIndices(); for (iSequence = model_->numberColumns(); iSequence < number; iSequence++) { ClpSimplex::Status status = model_->getStatus(iSequence); if (status != ClpSimplex::isFixed) which[numberLook++] = iSequence; } infeasible_->setNumElements(numberLook); doInfeasibilities = false; } savedPivotSequence_ = -2; savedSequenceOut_ = -2; if (pivotSequence_ < 0 || pivotSequence_ >= numberRows+numberColumns) pivotSequence_ = -1; } else { if (mode != 4) { // save CoinMemcpyN(weights_, (numberRows + numberColumns), savedWeights_); savedPivotSequence_ = pivotSequence_; savedSequenceOut_ = model_->sequenceOut(); } else { // restore CoinMemcpyN(savedWeights_, (numberRows + numberColumns), weights_); // was - but I think should not be //pivotSequence_= savedPivotSequence_; //model_->setSequenceOut(savedSequenceOut_); pivotSequence_ = -1; model_->setSequenceOut(-1); // indices are wrong so clear by hand //alternateWeights_->clear(); CoinZeroN(alternateWeights_->denseVector(), alternateWeights_->capacity()); alternateWeights_->setNumElements(0); } } state_ = 0; // set up infeasibilities if (!infeasible_) { infeasible_ = new CoinIndexedVector(); infeasible_->reserve(numberColumns + numberRows); } } if (mode >= 2 && mode != 5) { if (mode != 3) { if (pivotSequence_ >= 0) { // restore pivot row int iRow; // permute alternateWeights double * temp = model_->rowArray(3)->denseVector();; double * work = alternateWeights_->denseVector(); int * savePivotOrder = model_->rowArray(3)->getIndices(); int * oldPivotOrder = alternateWeights_->getIndices(); for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = oldPivotOrder[iRow]; temp[iPivot] = work[iRow]; savePivotOrder[iRow] = iPivot; } int number = 0; int found = -1; int * which = oldPivotOrder; // find pivot row and re-create alternateWeights for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; if (iPivot == pivotSequence_) found = iRow; work[iRow] = temp[iPivot]; if (work[iRow]) which[number++] = iRow; } alternateWeights_->setNumElements(number); #ifdef CLP_DEBUG // Can happen but I should clean up assert(found >= 0); #endif pivotSequence_ = found; for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = savePivotOrder[iRow]; temp[iPivot] = 0.0; } } else { // Just clean up if (alternateWeights_) alternateWeights_->clear(); } } // Save size of factorization if (!model->factorization()->pivots()) sizeFactorization_ = model_->factorization()->numberElements(); if(!doInfeasibilities) return; // don't disturb infeasibilities infeasible_->clear(); double tolerance = model_->currentDualTolerance(); int number = model_->numberRows() + model_->numberColumns(); int iSequence; double * reducedCost = model_->djRegion(); const double * lower = model_->lowerRegion(); const double * upper = model_->upperRegion(); const double * solution = model_->solutionRegion(); double primalTolerance = model_->currentPrimalTolerance(); if (!model_->nonLinearCost()->lookBothWays()) { #ifndef CLP_PRIMAL_SLACK_MULTIPLIER for (iSequence = 0; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list infeasible_->quickAdd(iSequence, value * value); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { infeasible_->quickAdd(iSequence, value * value); } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { infeasible_->quickAdd(iSequence, value * value); } } } #else // Columns int numberColumns = model_->numberColumns(); for (iSequence = 0; iSequence < numberColumns; iSequence++) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // check hasn't slipped through if (solution[iSequence]setStatus(iSequence,ClpSimplex::atLowerBound); if (value < -tolerance) { infeasible_->quickAdd(iSequence, value * value); } } else if (solution[iSequence]>upper[iSequence]-primalTolerance) { model_->setStatus(iSequence,ClpSimplex::atUpperBound); if (value > tolerance) { infeasible_->quickAdd(iSequence, value * value); } } else { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list infeasible_->quickAdd(iSequence, value * value); } } break; case ClpSimplex::atUpperBound: if (value > tolerance) { infeasible_->quickAdd(iSequence, value * value); } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { infeasible_->quickAdd(iSequence, value * value); } } } // Rows for ( ; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list infeasible_->quickAdd(iSequence, value * value); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { infeasible_->quickAdd(iSequence, value * value * CLP_PRIMAL_SLACK_MULTIPLIER); } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { infeasible_->quickAdd(iSequence, value * value * CLP_PRIMAL_SLACK_MULTIPLIER); } } } #endif } else { ClpNonLinearCost * nonLinear = model_->nonLinearCost(); // can go both ways for (iSequence = 0; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) { // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; // store square in list infeasible_->quickAdd(iSequence, value * value); } break; case ClpSimplex::atUpperBound: if (value > tolerance) { infeasible_->quickAdd(iSequence, value * value); } else { // look other way - change up should be negative value -= nonLinear->changeUpInCost(iSequence); if (value < -tolerance) { // store square in list infeasible_->quickAdd(iSequence, value * value); } } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { infeasible_->quickAdd(iSequence, value * value); } else { // look other way - change down should be positive value -= nonLinear->changeDownInCost(iSequence); if (value > tolerance) { // store square in list infeasible_->quickAdd(iSequence, value * value); } } } } } } } // Gets rid of last update void ClpPrimalColumnSteepest::unrollWeights() { if ((mode_ == 4 || mode_ == 5) && !numberSwitched_) return; double * saved = alternateWeights_->denseVector(); int number = alternateWeights_->getNumElements(); int * which = alternateWeights_->getIndices(); int i; for (i = 0; i < number; i++) { int iRow = which[i]; weights_[iRow] = saved[iRow]; saved[iRow] = 0.0; } alternateWeights_->setNumElements(0); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpPrimalColumnPivot * ClpPrimalColumnSteepest::clone(bool CopyData) const { if (CopyData) { return new ClpPrimalColumnSteepest(*this); } else { return new ClpPrimalColumnSteepest(); } } void ClpPrimalColumnSteepest::updateWeights(CoinIndexedVector * input) { // Local copy of mode so can decide what to do int switchType = mode_; if (mode_ == 4 && numberSwitched_) switchType = 3; else if (mode_ == 4 || mode_ == 5) return; int number = input->getNumElements(); int * which = input->getIndices(); double * work = input->denseVector(); int newNumber = 0; int * newWhich = alternateWeights_->getIndices(); double * newWork = alternateWeights_->denseVector(); int i; int sequenceIn = model_->sequenceIn(); int sequenceOut = model_->sequenceOut(); const int * pivotVariable = model_->pivotVariable(); int pivotRow = model_->pivotRow(); pivotSequence_ = pivotRow; devex_ = 0.0; // Can't create alternateWeights_ as packed as needed unpacked if (!input->packedMode()) { if (pivotRow >= 0) { if (switchType == 1) { for (i = 0; i < number; i++) { int iRow = which[i]; devex_ += work[iRow] * work[iRow]; newWork[iRow] = -2.0 * work[iRow]; } newWork[pivotRow] = -2.0 * CoinMax(devex_, 0.0); devex_ += ADD_ONE; weights_[sequenceOut] = 1.0 + ADD_ONE; CoinMemcpyN(which, number, newWhich); alternateWeights_->setNumElements(number); } else { if ((mode_ != 4 && mode_ != 5) || numberSwitched_ > 1) { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) { devex_ += work[iRow] * work[iRow]; newWork[iRow] = -2.0 * work[iRow]; newWhich[newNumber++] = iRow; } } if (!newWork[pivotRow] && devex_ > 0.0) newWhich[newNumber++] = pivotRow; // add if not already in newWork[pivotRow] = -2.0 * CoinMax(devex_, 0.0); } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) devex_ += work[iRow] * work[iRow]; } } if (reference(sequenceIn)) { devex_ += 1.0; } else { } if (reference(sequenceOut)) { weights_[sequenceOut] = 1.0 + 1.0; } else { weights_[sequenceOut] = 1.0; } alternateWeights_->setNumElements(newNumber); } } else { if (switchType == 1) { for (i = 0; i < number; i++) { int iRow = which[i]; devex_ += work[iRow] * work[iRow]; } devex_ += ADD_ONE; } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) { devex_ += work[iRow] * work[iRow]; } } if (reference(sequenceIn)) devex_ += 1.0; } } } else { // packed input if (pivotRow >= 0) { if (switchType == 1) { for (i = 0; i < number; i++) { int iRow = which[i]; devex_ += work[i] * work[i]; newWork[iRow] = -2.0 * work[i]; } newWork[pivotRow] = -2.0 * CoinMax(devex_, 0.0); devex_ += ADD_ONE; weights_[sequenceOut] = 1.0 + ADD_ONE; CoinMemcpyN(which, number, newWhich); alternateWeights_->setNumElements(number); } else { if ((mode_ != 4 && mode_ != 5) || numberSwitched_ > 1) { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) { devex_ += work[i] * work[i]; newWork[iRow] = -2.0 * work[i]; newWhich[newNumber++] = iRow; } } if (!newWork[pivotRow] && devex_ > 0.0) newWhich[newNumber++] = pivotRow; // add if not already in newWork[pivotRow] = -2.0 * CoinMax(devex_, 0.0); } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) devex_ += work[i] * work[i]; } } if (reference(sequenceIn)) { devex_ += 1.0; } else { } if (reference(sequenceOut)) { weights_[sequenceOut] = 1.0 + 1.0; } else { weights_[sequenceOut] = 1.0; } alternateWeights_->setNumElements(newNumber); } } else { if (switchType == 1) { for (i = 0; i < number; i++) { devex_ += work[i] * work[i]; } devex_ += ADD_ONE; } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) { devex_ += work[i] * work[i]; } } if (reference(sequenceIn)) devex_ += 1.0; } } } double oldDevex = weights_[sequenceIn]; #ifdef CLP_DEBUG if ((model_->messageHandler()->logLevel() & 32)) printf("old weight %g, new %g\n", oldDevex, devex_); #endif double check = CoinMax(devex_, oldDevex) + 0.1; weights_[sequenceIn] = devex_; double testValue = 0.1; if (mode_ == 4 && numberSwitched_ == 1) testValue = 0.5; if ( fabs ( devex_ - oldDevex ) > testValue * check ) { #ifdef CLP_DEBUG if ((model_->messageHandler()->logLevel() & 48) == 16) printf("old weight %g, new %g\n", oldDevex, devex_); #endif //printf("old weight %g, new %g\n",oldDevex,devex_); testValue = 0.99; if (mode_ == 1) testValue = 1.01e1; // make unlikely to do if steepest else if (mode_ == 4 && numberSwitched_ == 1) testValue = 0.9; double difference = fabs(devex_ - oldDevex); if ( difference > testValue * check ) { // need to redo model_->messageHandler()->message(CLP_INITIALIZE_STEEP, *model_->messagesPointer()) << oldDevex << devex_ << CoinMessageEol; initializeWeights(); } } if (pivotRow >= 0) { // set outgoing weight here weights_[model_->sequenceOut()] = devex_ / (model_->alpha() * model_->alpha()); } } // Checks accuracy - just for debug void ClpPrimalColumnSteepest::checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector * rowArray1, CoinIndexedVector * rowArray2) { if ((mode_ == 4 || mode_ == 5) && !numberSwitched_) return; model_->unpack(rowArray1, sequence); model_->factorization()->updateColumn(rowArray2, rowArray1); int number = rowArray1->getNumElements(); int * which = rowArray1->getIndices(); double * work = rowArray1->denseVector(); const int * pivotVariable = model_->pivotVariable(); double devex = 0.0; int i; if (mode_ == 1) { for (i = 0; i < number; i++) { int iRow = which[i]; devex += work[iRow] * work[iRow]; work[iRow] = 0.0; } devex += ADD_ONE; } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iPivot = pivotVariable[iRow]; if (reference(iPivot)) { devex += work[iRow] * work[iRow]; } work[iRow] = 0.0; } if (reference(sequence)) devex += 1.0; } double oldDevex = weights_[sequence]; double check = CoinMax(devex, oldDevex);; if ( fabs ( devex - oldDevex ) > relativeTolerance * check ) { COIN_DETAIL_PRINT(printf("check %d old weight %g, new %g\n", sequence, oldDevex, devex)); // update so won't print again weights_[sequence] = devex; } rowArray1->setNumElements(0); } // Initialize weights void ClpPrimalColumnSteepest::initializeWeights() { int numberRows = model_->numberRows(); int numberColumns = model_->numberColumns(); int number = numberRows + numberColumns; int iSequence; if (mode_ != 1) { // initialize to 1.0 // and set reference framework if (!reference_) { int nWords = (number + 31) >> 5; reference_ = new unsigned int[nWords]; CoinZeroN(reference_, nWords); } for (iSequence = 0; iSequence < number; iSequence++) { weights_[iSequence] = 1.0; if (model_->getStatus(iSequence) == ClpSimplex::basic) { setReference(iSequence, false); } else { setReference(iSequence, true); } } } else { CoinIndexedVector * temp = new CoinIndexedVector(); temp->reserve(numberRows + model_->factorization()->maximumPivots()); double * array = alternateWeights_->denseVector(); int * which = alternateWeights_->getIndices(); for (iSequence = 0; iSequence < number; iSequence++) { weights_[iSequence] = 1.0 + ADD_ONE; if (model_->getStatus(iSequence) != ClpSimplex::basic && model_->getStatus(iSequence) != ClpSimplex::isFixed) { model_->unpack(alternateWeights_, iSequence); double value = ADD_ONE; model_->factorization()->updateColumn(temp, alternateWeights_); int number = alternateWeights_->getNumElements(); int j; for (j = 0; j < number; j++) { int iRow = which[j]; value += array[iRow] * array[iRow]; array[iRow] = 0.0; } alternateWeights_->setNumElements(0); weights_[iSequence] = value; } } delete temp; } } // Gets rid of all arrays void ClpPrimalColumnSteepest::clearArrays() { if (persistence_ == normal) { delete [] weights_; weights_ = NULL; delete infeasible_; infeasible_ = NULL; delete alternateWeights_; alternateWeights_ = NULL; delete [] savedWeights_; savedWeights_ = NULL; delete [] reference_; reference_ = NULL; } pivotSequence_ = -1; state_ = -1; savedPivotSequence_ = -1; savedSequenceOut_ = -1; devex_ = 0.0; } // Returns true if would not find any column bool ClpPrimalColumnSteepest::looksOptimal() const { if (looksOptimal_) return true; // user overrode //**** THIS MUST MATCH the action coding above double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; if(model_->numberIterations() < model_->lastBadIteration() + 200) { // we can't really trust infeasibilities if there is dual error double checkTolerance = 1.0e-8; if (!model_->factorization()->pivots()) checkTolerance = 1.0e-6; if (model_->largestDualError() > checkTolerance) tolerance *= model_->largestDualError() / checkTolerance; // But cap tolerance = CoinMin(1000.0, tolerance); } int number = model_->numberRows() + model_->numberColumns(); int iSequence; double * reducedCost = model_->djRegion(); int numberInfeasible = 0; if (!model_->nonLinearCost()->lookBothWays()) { for (iSequence = 0; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) numberInfeasible++; break; case ClpSimplex::atUpperBound: if (value > tolerance) numberInfeasible++; break; case ClpSimplex::atLowerBound: if (value < -tolerance) numberInfeasible++; } } } else { ClpNonLinearCost * nonLinear = model_->nonLinearCost(); // can go both ways for (iSequence = 0; iSequence < number; iSequence++) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > FREE_ACCEPT * tolerance) numberInfeasible++; break; case ClpSimplex::atUpperBound: if (value > tolerance) { numberInfeasible++; } else { // look other way - change up should be negative value -= nonLinear->changeUpInCost(iSequence); if (value < -tolerance) numberInfeasible++; } break; case ClpSimplex::atLowerBound: if (value < -tolerance) { numberInfeasible++; } else { // look other way - change down should be positive value -= nonLinear->changeDownInCost(iSequence); if (value > tolerance) numberInfeasible++; } } } } return numberInfeasible == 0; } /* Returns number of extra columns for sprint algorithm - 0 means off. Also number of iterations before recompute */ int ClpPrimalColumnSteepest::numberSprintColumns(int & numberIterations) const { numberIterations = 0; int numberAdd = 0; if (!numberSwitched_ && mode_ >= 10) { numberIterations = CoinMin(2000, model_->numberRows() / 5); numberIterations = CoinMax(numberIterations, model_->factorizationFrequency()); numberIterations = CoinMax(numberIterations, 500); if (mode_ == 10) { numberAdd = CoinMax(300, model_->numberColumns() / 10); numberAdd = CoinMax(numberAdd, model_->numberRows() / 5); // fake all //numberAdd=1000000; numberAdd = CoinMin(numberAdd, model_->numberColumns()); } else { abort(); } } return numberAdd; } // Switch off sprint idea void ClpPrimalColumnSteepest::switchOffSprint() { numberSwitched_ = 10; } // Update djs doing partial pricing (dantzig) int ClpPrimalColumnSteepest::partialPricing(CoinIndexedVector * updates, CoinIndexedVector * spareRow2, int numberWanted, int numberLook) { int number = 0; int * index; double * updateBy; double * reducedCost; double saveTolerance = model_->currentDualTolerance(); double tolerance = model_->currentDualTolerance(); // we can't really trust infeasibilities if there is dual error // this coding has to mimic coding in checkDualSolution double error = CoinMin(1.0e-2, model_->largestDualError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; if(model_->numberIterations() < model_->lastBadIteration() + 200) { // we can't really trust infeasibilities if there is dual error double checkTolerance = 1.0e-8; if (!model_->factorization()->pivots()) checkTolerance = 1.0e-6; if (model_->largestDualError() > checkTolerance) tolerance *= model_->largestDualError() / checkTolerance; // But cap tolerance = CoinMin(1000.0, tolerance); } if (model_->factorization()->pivots() && model_->numberPrimalInfeasibilities()) tolerance = CoinMax(tolerance, 1.0e-15 * model_->infeasibilityCost()); // So partial pricing can use model_->setCurrentDualTolerance(tolerance); model_->factorization()->updateColumnTranspose(spareRow2, updates); int numberColumns = model_->numberColumns(); // Rows reducedCost = model_->djRegion(0); number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); int j; double * duals = model_->dualRowSolution(); for (j = 0; j < number; j++) { int iSequence = index[j]; double value = duals[iSequence]; value -= updateBy[j]; updateBy[j] = 0.0; duals[iSequence] = value; } //#define CLP_DEBUG #ifdef CLP_DEBUG // check duals { int numberRows = model_->numberRows(); //work space CoinIndexedVector arrayVector; arrayVector.reserve(numberRows + 1000); CoinIndexedVector workSpace; workSpace.reserve(numberRows + 1000); int iRow; double * array = arrayVector.denseVector(); int * index = arrayVector.getIndices(); int number = 0; int * pivotVariable = model_->pivotVariable(); double * cost = model_->costRegion(); for (iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; double value = cost[iPivot]; if (value) { array[iRow] = value; index[number++] = iRow; } } arrayVector.setNumElements(number); // Extended duals before "updateTranspose" model_->clpMatrix()->dualExpanded(model_, &arrayVector, NULL, 0); // Btran basic costs model_->factorization()->updateColumnTranspose(&workSpace, &arrayVector); // now look at dual solution for (iRow = 0; iRow < numberRows; iRow++) { // slack double value = array[iRow]; if (fabs(duals[iRow] - value) > 1.0e-3) printf("bad row %d old dual %g new %g\n", iRow, duals[iRow], value); //duals[iRow]=value; } } #endif #undef CLP_DEBUG double bestDj = tolerance; int bestSequence = -1; const double * cost = model_->costRegion(1); model_->clpMatrix()->setOriginalWanted(numberWanted); model_->clpMatrix()->setCurrentWanted(numberWanted); int iPassR = 0, iPassC = 0; // Setup two passes // This biases towards picking row variables // This probably should be fixed int startR[4]; const int * which = infeasible_->getIndices(); int nSlacks = infeasible_->getNumElements(); startR[1] = nSlacks; startR[2] = 0; double randomR = model_->randomNumberGenerator()->randomDouble(); double dstart = static_cast (nSlacks) * randomR; startR[0] = static_cast (dstart); startR[3] = startR[0]; double startC[4]; startC[1] = 1.0; startC[2] = 0; double randomC = model_->randomNumberGenerator()->randomDouble(); startC[0] = randomC; startC[3] = randomC; reducedCost = model_->djRegion(1); int sequenceOut = model_->sequenceOut(); double * duals2 = duals - numberColumns; int chunk = CoinMin(1024, (numberColumns + nSlacks) / 32); #ifdef COIN_DETAIL if (model_->numberIterations() % 1000 == 0 && model_->logLevel() > 1) { printf("%d wanted, nSlacks %d, chunk %d\n", numberWanted, nSlacks, chunk); int i; for (i = 0; i < 4; i++) printf("start R %d C %g ", startR[i], startC[i]); printf("\n"); } #endif chunk = CoinMax(chunk, 256); bool finishedR = false, finishedC = false; bool doingR = randomR > randomC; //doingR=false; int saveNumberWanted = numberWanted; while (!finishedR || !finishedC) { if (finishedR) doingR = false; if (doingR) { int saveSequence = bestSequence; int start = startR[iPassR]; int end = CoinMin(startR[iPassR+1], start + chunk / 2); int jSequence; for (jSequence = start; jSequence < end; jSequence++) { int iSequence = which[jSequence]; if (iSequence != sequenceOut) { double value; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: value = fabs(cost[iSequence] + duals2[iSequence]); if (value > FREE_ACCEPT * tolerance) { numberWanted--; // we are going to bias towards free (but only if reasonable) value *= FREE_BIAS; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atUpperBound: value = cost[iSequence] + duals2[iSequence]; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; case ClpSimplex::atLowerBound: value = -(cost[iSequence] + duals2[iSequence]); if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!model_->flagged(iSequence)) { bestDj = value; bestSequence = iSequence; } else { // just to make sure we don't exit before got something numberWanted++; } } } break; } } if (!numberWanted) break; } numberLook -= (end - start); if (numberLook < 0 && (10 * (saveNumberWanted - numberWanted) > saveNumberWanted)) numberWanted = 0; // give up if (saveSequence != bestSequence) { // dj reducedCost[bestSequence] = cost[bestSequence] + duals[bestSequence-numberColumns]; bestDj = fabs(reducedCost[bestSequence]); model_->clpMatrix()->setSavedBestSequence(bestSequence); model_->clpMatrix()->setSavedBestDj(reducedCost[bestSequence]); } model_->clpMatrix()->setCurrentWanted(numberWanted); if (!numberWanted) break; doingR = false; // update start startR[iPassR] = jSequence; if (jSequence >= startR[iPassR+1]) { if (iPassR) finishedR = true; else iPassR = 2; } } if (finishedC) doingR = true; if (!doingR) { int saveSequence = bestSequence; // Columns double start = startC[iPassC]; // If we put this idea back then each function needs to update endFraction ** #if 0 double dchunk = (static_cast chunk) / (static_cast numberColumns); double end = CoinMin(startC[iPassC+1], start + dchunk);; #else double end = startC[iPassC+1]; // force end #endif model_->clpMatrix()->partialPricing(model_, start, end, bestSequence, numberWanted); numberWanted = model_->clpMatrix()->currentWanted(); numberLook -= static_cast ((end - start) * numberColumns); if (numberLook < 0 && (10 * (saveNumberWanted - numberWanted) > saveNumberWanted)) numberWanted = 0; // give up if (saveSequence != bestSequence) { // dj bestDj = fabs(model_->clpMatrix()->reducedCost(model_, bestSequence)); } if (!numberWanted) break; doingR = true; // update start startC[iPassC] = end; if (end >= startC[iPassC+1] - 1.0e-8) { if (iPassC) finishedC = true; else iPassC = 2; } } } updates->setNumElements(0); // Restore tolerance model_->setCurrentDualTolerance(saveTolerance); // Now create variable if column generation model_->clpMatrix()->createVariable(model_, bestSequence); #ifndef NDEBUG if (bestSequence >= 0) { if (model_->getStatus(bestSequence) == ClpSimplex::atLowerBound) assert(model_->reducedCost(bestSequence) < 0.0); if (model_->getStatus(bestSequence) == ClpSimplex::atUpperBound) assert(model_->reducedCost(bestSequence) > 0.0); } #endif return bestSequence; } CoinMP-1.8.3/Clp/src/ClpConstraintLinear.cpp0000644000175000017500000001555511510657452017264 0ustar renerene/* $Id: ClpConstraintLinear.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "ClpSimplex.hpp" #include "ClpConstraintLinear.hpp" #include "CoinSort.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpConstraintLinear::ClpConstraintLinear () : ClpConstraint() { type_ = 0; column_ = NULL; coefficient_ = NULL; numberColumns_ = 0; numberCoefficients_ = 0; } //------------------------------------------------------------------- // Useful Constructor //------------------------------------------------------------------- ClpConstraintLinear::ClpConstraintLinear (int row, int numberCoefficents , int numberColumns, const int * column, const double * coefficient) : ClpConstraint() { type_ = 0; rowNumber_ = row; numberColumns_ = numberColumns; numberCoefficients_ = numberCoefficents; column_ = CoinCopyOfArray(column, numberCoefficients_); coefficient_ = CoinCopyOfArray(coefficient, numberCoefficients_); CoinSort_2(column_, column_ + numberCoefficients_, coefficient_); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpConstraintLinear::ClpConstraintLinear (const ClpConstraintLinear & rhs) : ClpConstraint(rhs) { numberColumns_ = rhs.numberColumns_; numberCoefficients_ = rhs.numberCoefficients_; column_ = CoinCopyOfArray(rhs.column_, numberCoefficients_); coefficient_ = CoinCopyOfArray(rhs.coefficient_, numberCoefficients_); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpConstraintLinear::~ClpConstraintLinear () { delete [] column_; delete [] coefficient_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpConstraintLinear & ClpConstraintLinear::operator=(const ClpConstraintLinear& rhs) { if (this != &rhs) { delete [] column_; delete [] coefficient_; numberColumns_ = rhs.numberColumns_; numberCoefficients_ = rhs.numberCoefficients_; column_ = CoinCopyOfArray(rhs.column_, numberCoefficients_); coefficient_ = CoinCopyOfArray(rhs.coefficient_, numberCoefficients_); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpConstraint * ClpConstraintLinear::clone() const { return new ClpConstraintLinear(*this); } // Returns gradient int ClpConstraintLinear::gradient(const ClpSimplex * model, const double * solution, double * gradient, double & functionValue, double & offset, bool useScaling, bool refresh) const { if (refresh || !lastGradient_) { functionValue_ = 0.0; if (!lastGradient_) lastGradient_ = new double[numberColumns_]; CoinZeroN(lastGradient_, numberColumns_); bool scaling = (model && model->rowScale() && useScaling); if (!scaling) { for (int i = 0; i < numberCoefficients_; i++) { int iColumn = column_[i]; double value = solution[iColumn]; double coefficient = coefficient_[i]; functionValue_ += value * coefficient; lastGradient_[iColumn] = coefficient; } } else { // do scaling const double * columnScale = model->columnScale(); for (int i = 0; i < numberCoefficients_; i++) { int iColumn = column_[i]; double value = solution[iColumn]; // already scaled double coefficient = coefficient_[i] * columnScale[iColumn]; functionValue_ += value * coefficient; lastGradient_[iColumn] = coefficient; } } } functionValue = functionValue_; offset = 0.0; CoinMemcpyN(lastGradient_, numberColumns_, gradient); return 0; } // Resize constraint void ClpConstraintLinear::resize(int newNumberColumns) { if (numberColumns_ != newNumberColumns) { #ifndef NDEBUG int lastColumn = column_[numberCoefficients_-1]; #endif assert (newNumberColumns > lastColumn); delete [] lastGradient_; lastGradient_ = NULL; numberColumns_ = newNumberColumns; } } // Delete columns in constraint void ClpConstraintLinear::deleteSome(int numberToDelete, const int * which) { if (numberToDelete) { int i ; char * deleted = new char[numberColumns_]; memset(deleted, 0, numberColumns_ * sizeof(char)); for (i = 0; i < numberToDelete; i++) { int j = which[i]; if (j >= 0 && j < numberColumns_ && !deleted[j]) { deleted[j] = 1; } } int n = 0; for (i = 0; i < numberCoefficients_; i++) { int iColumn = column_[i]; if (!deleted[iColumn]) { column_[n] = iColumn; coefficient_[n++] = coefficient_[i]; } } numberCoefficients_ = n; } } // Scale constraint void ClpConstraintLinear::reallyScale(const double * columnScale) { for (int i = 0; i < numberCoefficients_; i++) { int iColumn = column_[i]; coefficient_[i] *= columnScale[iColumn]; } } /* Given a zeroed array sets nonlinear columns to 1. Returns number of nonlinear columns */ int ClpConstraintLinear::markNonlinear(char *) const { return 0; } /* Given a zeroed array sets possible nonzero coefficients to 1. Returns number of nonzeros */ int ClpConstraintLinear::markNonzero(char * which) const { for (int i = 0; i < numberCoefficients_; i++) { int iColumn = column_[i]; which[iColumn] = 1; } return numberCoefficients_; } // Number of coefficients int ClpConstraintLinear::numberCoefficients() const { return numberCoefficients_; } CoinMP-1.8.3/Clp/src/ClpFactorization.hpp0000644000175000017500000003737712452503025016624 0ustar renerene/* $Id: ClpFactorization.hpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpFactorization_H #define ClpFactorization_H #include "CoinPragma.hpp" #include "CoinFactorization.hpp" class ClpMatrixBase; class ClpSimplex; class ClpNetworkBasis; class CoinOtherFactorization; #ifndef CLP_MULTIPLE_FACTORIZATIONS #define CLP_MULTIPLE_FACTORIZATIONS 4 #endif #ifdef CLP_MULTIPLE_FACTORIZATIONS #include "CoinDenseFactorization.hpp" #include "ClpSimplex.hpp" #endif #ifndef COIN_FAST_CODE #define COIN_FAST_CODE #endif #ifndef CLP_FACTORIZATION_NEW_TIMING #define CLP_FACTORIZATION_NEW_TIMING 1 #endif /** This just implements CoinFactorization when an ClpMatrixBase object is passed. If a network then has a dummy CoinFactorization and a genuine ClpNetworkBasis object */ class ClpFactorization #ifndef CLP_MULTIPLE_FACTORIZATIONS : public CoinFactorization #endif { //friend class CoinFactorization; public: /**@name factorization */ //@{ /** When part of LP - given by basic variables. Actually does factorization. Arrays passed in have non negative value to say basic. If status is okay, basic variables have pivot row - this is only needed if increasingRows_ >1. Allows scaling If status is singular, then basic variables have pivot row and ones thrown out have -1 returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */ int factorize (ClpSimplex * model, int solveType, bool valuesPass); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpFactorization(); /** Destructor */ ~ClpFactorization(); //@} /**@name Copy method */ //@{ /** The copy constructor from an CoinFactorization. */ ClpFactorization(const CoinFactorization&); /** The copy constructor. */ ClpFactorization(const ClpFactorization&, int denseIfSmaller = 0); #ifdef CLP_MULTIPLE_FACTORIZATIONS /** The copy constructor from an CoinOtherFactorization. */ ClpFactorization(const CoinOtherFactorization&); #endif ClpFactorization& operator=(const ClpFactorization&); //@} /* **** below here is so can use networkish basis */ /**@name rank one updates which do exist */ //@{ /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U */ int replaceColumn ( const ClpSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, double pivotCheck , bool checkBeforeModifying = false, double acceptablePivot = 1.0e-8); //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room region1 starts as zero and is zero at end */ int updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2); /** Updates one column (FTRAN) from region2 region1 starts as zero and is zero at end */ int updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute = false) const; /** Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room. Also updates region3 region1 starts as zero and is zero at end */ int updateTwoColumnsFT ( CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermuteRegion3 = false) ; /// For debug (no statistics update) int updateColumnForDebug ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute = false) const; /** Updates one column (BTRAN) from region2 region1 starts as zero and is zero at end */ int updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; //@} #ifdef CLP_MULTIPLE_FACTORIZATIONS /**@name Lifted from CoinFactorization */ //@{ /// Total number of elements in factorization inline int numberElements ( ) const { if (coinFactorizationA_) return coinFactorizationA_->numberElements(); else return coinFactorizationB_->numberElements() ; } /// Returns address of permute region inline int *permute ( ) const { if (coinFactorizationA_) return coinFactorizationA_->permute(); else return coinFactorizationB_->permute() ; } /// Returns address of pivotColumn region (also used for permuting) inline int *pivotColumn ( ) const { if (coinFactorizationA_) return coinFactorizationA_->pivotColumn(); else return coinFactorizationB_->permute() ; } /// Maximum number of pivots between factorizations inline int maximumPivots ( ) const { if (coinFactorizationA_) return coinFactorizationA_->maximumPivots(); else return coinFactorizationB_->maximumPivots() ; } /// Set maximum number of pivots between factorizations inline void maximumPivots ( int value) { if (coinFactorizationA_) coinFactorizationA_->maximumPivots(value); else coinFactorizationB_->maximumPivots(value); } /// Returns number of pivots since factorization inline int pivots ( ) const { if (coinFactorizationA_) return coinFactorizationA_->pivots(); else return coinFactorizationB_->pivots() ; } /// Whether larger areas needed inline double areaFactor ( ) const { if (coinFactorizationA_) return coinFactorizationA_->areaFactor(); else return 0.0 ; } /// Set whether larger areas needed inline void areaFactor ( double value) { if (coinFactorizationA_) coinFactorizationA_->areaFactor(value); } /// Zero tolerance inline double zeroTolerance ( ) const { if (coinFactorizationA_) return coinFactorizationA_->zeroTolerance(); else return coinFactorizationB_->zeroTolerance() ; } /// Set zero tolerance inline void zeroTolerance ( double value) { if (coinFactorizationA_) coinFactorizationA_->zeroTolerance(value); else coinFactorizationB_->zeroTolerance(value); } /// Set tolerances to safer of existing and given void saferTolerances ( double zeroTolerance, double pivotTolerance); /** get sparse threshold */ inline int sparseThreshold ( ) const { if (coinFactorizationA_) return coinFactorizationA_->sparseThreshold(); else return 0 ; } /** Set sparse threshold */ inline void sparseThreshold ( int value) { if (coinFactorizationA_) coinFactorizationA_->sparseThreshold(value); } /// Returns status inline int status ( ) const { if (coinFactorizationA_) return coinFactorizationA_->status(); else return coinFactorizationB_->status() ; } /// Sets status inline void setStatus ( int value) { if (coinFactorizationA_) coinFactorizationA_->setStatus(value); else coinFactorizationB_->setStatus(value) ; } /// Returns number of dense rows inline int numberDense() const { if (coinFactorizationA_) return coinFactorizationA_->numberDense(); else return 0 ; } #if 1 /// Returns number in U area inline CoinBigIndex numberElementsU ( ) const { if (coinFactorizationA_) return coinFactorizationA_->numberElementsU(); else return -1 ; } /// Returns number in L area inline CoinBigIndex numberElementsL ( ) const { if (coinFactorizationA_) return coinFactorizationA_->numberElementsL(); else return -1 ; } /// Returns number in R area inline CoinBigIndex numberElementsR ( ) const { if (coinFactorizationA_) return coinFactorizationA_->numberElementsR(); else return 0 ; } #endif bool timeToRefactorize() const; #if CLP_FACTORIZATION_NEW_TIMING>1 void statsRefactor(char when) const; #endif /// Level of detail of messages inline int messageLevel ( ) const { if (coinFactorizationA_) return coinFactorizationA_->messageLevel(); else return 1 ; } /// Set level of detail of messages inline void messageLevel ( int value) { if (coinFactorizationA_) coinFactorizationA_->messageLevel(value); } /// Get rid of all memory inline void clearArrays() { if (coinFactorizationA_) coinFactorizationA_->clearArrays(); else if (coinFactorizationB_) coinFactorizationB_->clearArrays(); } /// Number of Rows after factorization inline int numberRows ( ) const { if (coinFactorizationA_) return coinFactorizationA_->numberRows(); else return coinFactorizationB_->numberRows() ; } /// Gets dense threshold inline int denseThreshold() const { if (coinFactorizationA_) return coinFactorizationA_->denseThreshold(); else return 0 ; } /// Sets dense threshold inline void setDenseThreshold(int value) { if (coinFactorizationA_) coinFactorizationA_->setDenseThreshold(value); } /// Pivot tolerance inline double pivotTolerance ( ) const { if (coinFactorizationA_) return coinFactorizationA_->pivotTolerance(); else if (coinFactorizationB_) return coinFactorizationB_->pivotTolerance(); return 1.0e-8 ; } /// Set pivot tolerance inline void pivotTolerance ( double value) { if (coinFactorizationA_) coinFactorizationA_->pivotTolerance(value); else if (coinFactorizationB_) coinFactorizationB_->pivotTolerance(value); } /// Allows change of pivot accuracy check 1.0 == none >1.0 relaxed inline void relaxAccuracyCheck(double value) { if (coinFactorizationA_) coinFactorizationA_->relaxAccuracyCheck(value); } /** Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 but give a bit extra if bigger needed */ inline int persistenceFlag() const { if (coinFactorizationA_) return coinFactorizationA_->persistenceFlag(); else return 0 ; } inline void setPersistenceFlag(int value) { if (coinFactorizationA_) coinFactorizationA_->setPersistenceFlag(value); } /// Delete all stuff (leaves as after CoinFactorization()) inline void almostDestructor() { if (coinFactorizationA_) coinFactorizationA_->almostDestructor(); else if (coinFactorizationB_) coinFactorizationB_->clearArrays(); } /// Returns areaFactor but adjusted for dense inline double adjustedAreaFactor() const { if (coinFactorizationA_) return coinFactorizationA_->adjustedAreaFactor(); else return 0.0 ; } inline void setBiasLU(int value) { if (coinFactorizationA_) coinFactorizationA_->setBiasLU(value); } /// true if Forrest Tomlin update, false if PFI inline void setForrestTomlin(bool value) { if (coinFactorizationA_) coinFactorizationA_->setForrestTomlin(value); } /// Sets default values inline void setDefaultValues() { if (coinFactorizationA_) { // row activities have negative sign #ifndef COIN_FAST_CODE coinFactorizationA_->slackValue(-1.0); #endif coinFactorizationA_->zeroTolerance(1.0e-13); } } /// If nonzero force use of 1,dense 2,small 3,osl void forceOtherFactorization(int which); /// Get switch to osl if number rows <= this inline int goOslThreshold() const { return goOslThreshold_; } /// Set switch to osl if number rows <= this inline void setGoOslThreshold(int value) { goOslThreshold_ = value; } /// Get switch to dense if number rows <= this inline int goDenseThreshold() const { return goDenseThreshold_; } /// Set switch to dense if number rows <= this inline void setGoDenseThreshold(int value) { goDenseThreshold_ = value; } /// Get switch to small if number rows <= this inline int goSmallThreshold() const { return goSmallThreshold_; } /// Set switch to small if number rows <= this inline void setGoSmallThreshold(int value) { goSmallThreshold_ = value; } /// Go over to dense or small code if small enough void goDenseOrSmall(int numberRows) ; /// Sets factorization void setFactorization(ClpFactorization & factorization); /// Return 1 if dense code inline int isDenseOrSmall() const { return coinFactorizationB_ ? 1 : 0; } #else inline bool timeToRefactorize() const { return (pivots() * 3 > maximumPivots() * 2 && numberElementsR() * 3 > (numberElementsL() + numberElementsU()) * 2 + 1000 && !numberDense()); } /// Sets default values inline void setDefaultValues() { // row activities have negative sign #ifndef COIN_FAST_CODE slackValue(-1.0); #endif zeroTolerance(1.0e-13); } /// Go over to dense code inline void goDense() {} #endif //@} /**@name other stuff */ //@{ /** makes a row copy of L for speed and to allow very sparse problems */ void goSparse(); /// Cleans up i.e. gets rid of network basis void cleanUp(); /// Says whether to redo pivot order bool needToReorder() const; #ifndef SLIM_CLP /// Says if a network basis inline bool networkBasis() const { return (networkBasis_ != NULL); } #else /// Says if a network basis inline bool networkBasis() const { return false; } #endif /// Fills weighted row list void getWeights(int * weights) const; //@} ////////////////// data ////////////////// private: /**@name data */ //@{ /// Pointer to network basis #ifndef SLIM_CLP ClpNetworkBasis * networkBasis_; #endif #ifdef CLP_MULTIPLE_FACTORIZATIONS /// Pointer to CoinFactorization CoinFactorization * coinFactorizationA_; /// Pointer to CoinOtherFactorization CoinOtherFactorization * coinFactorizationB_; #ifdef CLP_REUSE_ETAS /// Pointer to model ClpSimplex * model_; #endif /// If nonzero force use of 1,dense 2,small 3,osl int forceB_; /// Switch to osl if number rows <= this int goOslThreshold_; /// Switch to small if number rows <= this int goSmallThreshold_; /// Switch to dense if number rows <= this int goDenseThreshold_; #endif #ifdef CLP_FACTORIZATION_NEW_TIMING /// For guessing when to re-factorize mutable double shortestAverage_; mutable double totalInR_; mutable double totalInIncreasingU_; mutable int endLengthU_; mutable int lastNumberPivots_; mutable int effectiveStartNumberU_; #endif //@} }; #endif CoinMP-1.8.3/Clp/src/CbcOrClpParam.cpp0000644000175000017500000053306412542032201015737 0ustar renerene/* $Id: CbcOrClpParam.cpp 2148 2015-06-22 16:14:57Z tkr $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinTime.hpp" #include "CbcOrClpParam.hpp" #include #include #include #ifdef COIN_HAS_CBC #ifdef COIN_HAS_CLP #include "OsiClpSolverInterface.hpp" #include "ClpSimplex.hpp" #endif #include "CbcModel.hpp" #endif #include "CoinHelperFunctions.hpp" #ifdef COIN_HAS_CLP #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" #endif #ifdef COIN_HAS_READLINE #include #include #endif #ifdef COIN_HAS_CBC // from CoinSolve static char coin_prompt[] = "Coin:"; #else static char coin_prompt[] = "Clp:"; #endif #ifdef CLP_CILK #ifndef CBC_THREAD #define CBC_THREAD #endif #endif #if defined(COIN_HAS_WSMP) && ! defined(USE_EKKWSSMP) #ifndef CBC_THREAD #define CBC_THREAD #endif #endif #include "ClpConfig.h" #ifdef CLP_HAS_ABC #include "AbcCommon.hpp" #endif static bool doPrinting = true; static std::string afterEquals = ""; static char printArray[200]; #if COIN_INT_MAX==0 #undef COIN_INT_MAX #define COIN_INT_MAX 2147483647 #endif void setCbcOrClpPrinting(bool yesNo) { doPrinting = yesNo; } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- CbcOrClpParam::CbcOrClpParam () : type_(CBC_PARAM_NOTUSED_INVALID), lowerDoubleValue_(0.0), upperDoubleValue_(0.0), lowerIntValue_(0), upperIntValue_(0), lengthName_(0), lengthMatch_(0), definedKeyWords_(), name_(), shortHelp_(), longHelp_(), action_(CBC_PARAM_NOTUSED_INVALID), currentKeyWord_(-1), display_(0), intValue_(-1), doubleValue_(-1.0), stringValue_(""), whereUsed_(7), fakeKeyWord_(-1), fakeValue_(0) { } // Other constructors CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, double lower, double upper, CbcOrClpParameterType type, int display) : type_(type), lowerIntValue_(0), upperIntValue_(0), definedKeyWords_(), name_(name), shortHelp_(help), longHelp_(), action_(type), currentKeyWord_(-1), display_(display), intValue_(-1), doubleValue_(-1.0), stringValue_(""), whereUsed_(7), fakeKeyWord_(-1), fakeValue_(0) { lowerDoubleValue_ = lower; upperDoubleValue_ = upper; gutsOfConstructor(); } CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, int lower, int upper, CbcOrClpParameterType type, int display) : type_(type), lowerDoubleValue_(0.0), upperDoubleValue_(0.0), definedKeyWords_(), name_(name), shortHelp_(help), longHelp_(), action_(type), currentKeyWord_(-1), display_(display), intValue_(-1), doubleValue_(-1.0), stringValue_(""), whereUsed_(7), fakeKeyWord_(-1), fakeValue_(0) { gutsOfConstructor(); lowerIntValue_ = lower; upperIntValue_ = upper; } // Other strings will be added by append CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, std::string firstValue, CbcOrClpParameterType type, int whereUsed, int display) : type_(type), lowerDoubleValue_(0.0), upperDoubleValue_(0.0), lowerIntValue_(0), upperIntValue_(0), definedKeyWords_(), name_(name), shortHelp_(help), longHelp_(), action_(type), currentKeyWord_(0), display_(display), intValue_(-1), doubleValue_(-1.0), stringValue_(""), whereUsed_(whereUsed), fakeKeyWord_(-1), fakeValue_(0) { gutsOfConstructor(); definedKeyWords_.push_back(firstValue); } // Action CbcOrClpParam::CbcOrClpParam (std::string name, std::string help, CbcOrClpParameterType type, int whereUsed, int display) : type_(type), lowerDoubleValue_(0.0), upperDoubleValue_(0.0), lowerIntValue_(0), upperIntValue_(0), definedKeyWords_(), name_(name), shortHelp_(help), longHelp_(), action_(type), currentKeyWord_(-1), display_(display), intValue_(-1), doubleValue_(-1.0), stringValue_(""), fakeKeyWord_(-1), fakeValue_(0) { whereUsed_ = whereUsed; gutsOfConstructor(); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- CbcOrClpParam::CbcOrClpParam (const CbcOrClpParam & rhs) { type_ = rhs.type_; lowerDoubleValue_ = rhs.lowerDoubleValue_; upperDoubleValue_ = rhs.upperDoubleValue_; lowerIntValue_ = rhs.lowerIntValue_; upperIntValue_ = rhs.upperIntValue_; lengthName_ = rhs.lengthName_; lengthMatch_ = rhs.lengthMatch_; definedKeyWords_ = rhs.definedKeyWords_; name_ = rhs.name_; shortHelp_ = rhs.shortHelp_; longHelp_ = rhs.longHelp_; action_ = rhs.action_; currentKeyWord_ = rhs.currentKeyWord_; display_ = rhs.display_; intValue_ = rhs.intValue_; doubleValue_ = rhs.doubleValue_; stringValue_ = rhs.stringValue_; whereUsed_ = rhs.whereUsed_; fakeKeyWord_ = rhs.fakeKeyWord_; fakeValue_ = rhs.fakeValue_; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- CbcOrClpParam::~CbcOrClpParam () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- CbcOrClpParam & CbcOrClpParam::operator=(const CbcOrClpParam & rhs) { if (this != &rhs) { type_ = rhs.type_; lowerDoubleValue_ = rhs.lowerDoubleValue_; upperDoubleValue_ = rhs.upperDoubleValue_; lowerIntValue_ = rhs.lowerIntValue_; upperIntValue_ = rhs.upperIntValue_; lengthName_ = rhs.lengthName_; lengthMatch_ = rhs.lengthMatch_; definedKeyWords_ = rhs.definedKeyWords_; name_ = rhs.name_; shortHelp_ = rhs.shortHelp_; longHelp_ = rhs.longHelp_; action_ = rhs.action_; currentKeyWord_ = rhs.currentKeyWord_; display_ = rhs.display_; intValue_ = rhs.intValue_; doubleValue_ = rhs.doubleValue_; stringValue_ = rhs.stringValue_; whereUsed_ = rhs.whereUsed_; fakeKeyWord_ = rhs.fakeKeyWord_; fakeValue_ = rhs.fakeValue_; } return *this; } void CbcOrClpParam::gutsOfConstructor() { std::string::size_type shriekPos = name_.find('!'); lengthName_ = static_cast(name_.length()); if ( shriekPos == std::string::npos ) { //does not contain '!' lengthMatch_ = lengthName_; } else { lengthMatch_ = static_cast(shriekPos); name_ = name_.substr(0, shriekPos) + name_.substr(shriekPos + 1); lengthName_--; } } // Sets value of fake keyword to current size of keywords void CbcOrClpParam::setFakeKeyWord(int fakeValue) { fakeKeyWord_ = static_cast(definedKeyWords_.size()); assert (fakeKeyWord_>0); fakeValue_ = fakeValue; assert (fakeValue_>=0); } /* Returns current parameter option position but if fake keyword returns fakeValue_ */ int CbcOrClpParam::currentOptionAsInteger ( ) const { int fakeInteger; return currentOptionAsInteger(fakeInteger); } /* Returns current parameter option position but if fake keyword returns fakeValue_ and sets fakeInteger to value */ int CbcOrClpParam::currentOptionAsInteger ( int & fakeInteger ) const { fakeInteger=-COIN_INT_MAX; if (fakeKeyWord_<0) { return currentKeyWord_; } else if (currentKeyWord_>=0&¤tKeyWord_ lengthName_) { return 0; } else { unsigned int i; for (i = 0; i < input.length(); i++) { if (tolower(name_[i]) != tolower(input[i])) break; } if (i < input.length()) { return 0; } else if (i >= lengthMatch_) { return 1; } else { // matched but too short return 2; } } } // Returns name which could match std::string CbcOrClpParam::matchName ( ) const { if (lengthMatch_ == lengthName_) return name_; else return name_.substr(0, lengthMatch_) + "(" + name_.substr(lengthMatch_) + ")"; } // Returns parameter option which matches (-1 if none) int CbcOrClpParam::parameterOption ( std::string check ) const { int numberItems = static_cast(definedKeyWords_.size()); if (!numberItems) { return -1; } else { int whichItem = 0; unsigned int it; for (it = 0; it < definedKeyWords_.size(); it++) { std::string thisOne = definedKeyWords_[it]; std::string::size_type shriekPos = thisOne.find('!'); size_t length1 = thisOne.length(); size_t length2 = length1; if ( shriekPos != std::string::npos ) { //contains '!' length2 = shriekPos; thisOne = thisOne.substr(0, shriekPos) + thisOne.substr(shriekPos + 1); length1 = thisOne.length(); } if (check.length() <= length1 && length2 <= check.length()) { unsigned int i; for (i = 0; i < check.length(); i++) { if (tolower(thisOne[i]) != tolower(check[i])) break; } if (i < check.length()) { whichItem++; } else if (i >= length2) { break; } } else { whichItem++; } } if (whichItem < numberItems) { return whichItem; } else { if (fakeKeyWord_<=0) return -1; // allow plus or minus int n; if (check.substr(0,4)=="plus"||check.substr(0,4)=="PLUS") { n = 4; } else if (check.substr(0,5)=="minus"||check.substr(0,5)=="MINUS") { n = 5; } else { return -1; } int value = 0; std::string field=check.substr(n); if (field != "EOL") { const char * start = field.c_str(); char * endPointer = NULL; // check valid value = static_cast(strtol(start, &endPointer, 10)); if (*endPointer != '\0') { return -1; } if (n==4) return value + 1000; else return -value - 1000; } else { return -1; } } } } // Prints parameter options void CbcOrClpParam::printOptions ( ) const { std::cout << "= 0 && currentKeyWord_ < static_cast(definedKeyWords_.size())); std::string current = definedKeyWords_[currentKeyWord_]; std::string::size_type shriekPos = current.find('!'); if ( shriekPos != std::string::npos ) { //contains '!' current = current.substr(0, shriekPos) + "(" + current.substr(shriekPos + 1) + ")"; } std::cout << ";\n\tcurrent " << current << ">" << std::endl; } // Print action and string void CbcOrClpParam::printString() const { if (name_ == "directory") std::cout << "Current working directory is " << stringValue_ << std::endl; else if (name_.substr(0, 6) == "printM") std::cout << "Current value of printMask is " << stringValue_ << std::endl; else std::cout << "Current default (if $ as parameter) for " << name_ << " is " << stringValue_ << std::endl; } void CoinReadPrintit(const char * input) { int length = static_cast(strlen(input)); char temp[101]; int i; int n = 0; for (i = 0; i < length; i++) { if (input[i] == '\n') { temp[n] = '\0'; std::cout << temp << std::endl; n = 0; } else if (n >= 65 && input[i] == ' ') { temp[n] = '\0'; std::cout << temp << std::endl; n = 0; } else if (n || input[i] != ' ') { temp[n++] = input[i]; } } if (n) { temp[n] = '\0'; std::cout << temp << std::endl; } } // Print Long help void CbcOrClpParam::printLongHelp() const { if (type_ >= 1 && type_ < 400) { CoinReadPrintit(longHelp_.c_str()); if (type_ < CLP_PARAM_INT_SOLVERLOGLEVEL) { printf("\n", lowerDoubleValue_, upperDoubleValue_, doubleValue_); assert (upperDoubleValue_ > lowerDoubleValue_); } else if (type_ < CLP_PARAM_STR_DIRECTION) { printf("\n", lowerIntValue_, upperIntValue_, intValue_); assert (upperIntValue_ > lowerIntValue_); } else if (type_ < CLP_PARAM_ACTION_DIRECTORY) { printOptions(); } } } #ifdef COIN_HAS_CBC int CbcOrClpParam::setDoubleParameter (OsiSolverInterface * model, double value) { int returnCode; setDoubleParameterWithMessage(model, value, returnCode); if (doPrinting && strlen(printArray)) std::cout << printArray << std::endl; return returnCode; } // Sets double parameter and returns printable string and error code const char * CbcOrClpParam::setDoubleParameterWithMessage ( OsiSolverInterface * model, double value , int & returnCode) { if (value < lowerDoubleValue_ || value > upperDoubleValue_) { sprintf(printArray, "%g was provided for %s - valid range is %g to %g", value, name_.c_str(), lowerDoubleValue_, upperDoubleValue_); std::cout << value << " was provided for " << name_ << " - valid range is " << lowerDoubleValue_ << " to " << upperDoubleValue_ << std::endl; returnCode = 1; } else { double oldValue = doubleValue_; doubleValue_ = value; switch (type_) { case CLP_PARAM_DBL_DUALTOLERANCE: model->getDblParam(OsiDualTolerance, oldValue); model->setDblParam(OsiDualTolerance, value); break; case CLP_PARAM_DBL_PRIMALTOLERANCE: model->getDblParam(OsiPrimalTolerance, oldValue); model->setDblParam(OsiPrimalTolerance, value); break; default: break; } sprintf(printArray, "%s was changed from %g to %g", name_.c_str(), oldValue, value); returnCode = 0; } return printArray; } #endif #ifdef COIN_HAS_CLP int CbcOrClpParam::setDoubleParameter (ClpSimplex * model, double value) { int returnCode; setDoubleParameterWithMessage(model, value, returnCode); if (doPrinting && strlen(printArray)) std::cout << printArray << std::endl; return returnCode; } // Sets int parameter and returns printable string and error code const char * CbcOrClpParam::setDoubleParameterWithMessage ( ClpSimplex * model, double value , int & returnCode) { double oldValue = doubleValue_; if (value < lowerDoubleValue_ || value > upperDoubleValue_) { sprintf(printArray, "%g was provided for %s - valid range is %g to %g", value, name_.c_str(), lowerDoubleValue_, upperDoubleValue_); returnCode = 1; } else { sprintf(printArray, "%s was changed from %g to %g", name_.c_str(), oldValue, value); returnCode = 0; doubleValue_ = value; switch (type_) { case CLP_PARAM_DBL_DUALTOLERANCE: model->setDualTolerance(value); break; case CLP_PARAM_DBL_PRIMALTOLERANCE: model->setPrimalTolerance(value); break; case CLP_PARAM_DBL_ZEROTOLERANCE: model->setSmallElementValue(value); break; case CLP_PARAM_DBL_DUALBOUND: model->setDualBound(value); break; case CLP_PARAM_DBL_PRIMALWEIGHT: model->setInfeasibilityCost(value); break; #ifndef COIN_HAS_CBC case CLP_PARAM_DBL_TIMELIMIT: model->setMaximumSeconds(value); break; #endif case CLP_PARAM_DBL_OBJSCALE: model->setObjectiveScale(value); break; case CLP_PARAM_DBL_RHSSCALE: model->setRhsScale(value); break; case CLP_PARAM_DBL_PRESOLVETOLERANCE: model->setDblParam(ClpPresolveTolerance, value); break; default: break; } } return printArray; } double CbcOrClpParam::doubleParameter (ClpSimplex * model) const { double value; switch (type_) { #ifndef COIN_HAS_CBC case CLP_PARAM_DBL_DUALTOLERANCE: value = model->dualTolerance(); break; case CLP_PARAM_DBL_PRIMALTOLERANCE: value = model->primalTolerance(); break; #endif case CLP_PARAM_DBL_ZEROTOLERANCE: value = model->getSmallElementValue(); break; case CLP_PARAM_DBL_DUALBOUND: value = model->dualBound(); break; case CLP_PARAM_DBL_PRIMALWEIGHT: value = model->infeasibilityCost(); break; #ifndef COIN_HAS_CBC case CLP_PARAM_DBL_TIMELIMIT: value = model->maximumSeconds(); break; #endif case CLP_PARAM_DBL_OBJSCALE: value = model->objectiveScale(); break; case CLP_PARAM_DBL_RHSSCALE: value = model->rhsScale(); break; default: value = doubleValue_; break; } return value; } int CbcOrClpParam::setIntParameter (ClpSimplex * model, int value) { int returnCode; setIntParameterWithMessage(model, value, returnCode); if (doPrinting && strlen(printArray)) std::cout << printArray << std::endl; return returnCode; } // Sets int parameter and returns printable string and error code const char * CbcOrClpParam::setIntParameterWithMessage ( ClpSimplex * model, int value , int & returnCode) { int oldValue = intValue_; if (value < lowerIntValue_ || value > upperIntValue_) { sprintf(printArray, "%d was provided for %s - valid range is %d to %d", value, name_.c_str(), lowerIntValue_, upperIntValue_); returnCode = 1; } else { intValue_ = value; sprintf(printArray, "%s was changed from %d to %d", name_.c_str(), oldValue, value); returnCode = 0; switch (type_) { case CLP_PARAM_INT_SOLVERLOGLEVEL: model->setLogLevel(value); if (value > 2) model->factorization()->messageLevel(8); else model->factorization()->messageLevel(0); break; case CLP_PARAM_INT_MAXFACTOR: model->factorization()->maximumPivots(value); break; case CLP_PARAM_INT_PERTVALUE: model->setPerturbation(value); break; case CLP_PARAM_INT_MAXITERATION: model->setMaximumIterations(value); break; case CLP_PARAM_INT_SPECIALOPTIONS: model->setSpecialOptions(value); break; case CLP_PARAM_INT_RANDOMSEED: { if (value==0) { double time = fabs(CoinGetTimeOfDay()); while (time>=COIN_INT_MAX) time *= 0.5; value = static_cast(time); sprintf(printArray, "using time of day %s was changed from %d to %d", name_.c_str(), oldValue, value); } model->setRandomSeed(value); } break; case CLP_PARAM_INT_MORESPECIALOPTIONS: model->setMoreSpecialOptions(value); break; #ifndef COIN_HAS_CBC #ifdef CBC_THREAD case CBC_PARAM_INT_THREADS: model->setNumberThreads(value); break; #endif #endif default: break; } } return printArray; } int CbcOrClpParam::intParameter (ClpSimplex * model) const { int value; switch (type_) { #ifndef COIN_HAS_CBC case CLP_PARAM_INT_SOLVERLOGLEVEL: value = model->logLevel(); break; #endif case CLP_PARAM_INT_MAXFACTOR: value = model->factorization()->maximumPivots(); break; break; case CLP_PARAM_INT_PERTVALUE: value = model->perturbation(); break; case CLP_PARAM_INT_MAXITERATION: value = model->maximumIterations(); break; case CLP_PARAM_INT_SPECIALOPTIONS: value = model->specialOptions(); break; case CLP_PARAM_INT_RANDOMSEED: value = model->randomNumberGenerator()->getSeed(); break; case CLP_PARAM_INT_MORESPECIALOPTIONS: value = model->moreSpecialOptions(); break; #ifndef COIN_HAS_CBC #ifdef CBC_THREAD case CBC_PARAM_INT_THREADS: value = model->numberThreads(); break; #endif #endif default: value = intValue_; break; } return value; } #endif int CbcOrClpParam::checkDoubleParameter (double value) const { if (value < lowerDoubleValue_ || value > upperDoubleValue_) { std::cout << value << " was provided for " << name_ << " - valid range is " << lowerDoubleValue_ << " to " << upperDoubleValue_ << std::endl; return 1; } else { return 0; } } #ifdef COIN_HAS_CBC double CbcOrClpParam::doubleParameter (OsiSolverInterface * #ifndef NDEBUG model #endif ) const { double value = 0.0; switch (type_) { case CLP_PARAM_DBL_DUALTOLERANCE: assert(model->getDblParam(OsiDualTolerance, value)); break; case CLP_PARAM_DBL_PRIMALTOLERANCE: assert(model->getDblParam(OsiPrimalTolerance, value)); break; default: return doubleValue_; break; } return value; } int CbcOrClpParam::setIntParameter (OsiSolverInterface * model, int value) { int returnCode; setIntParameterWithMessage(model, value, returnCode); if (doPrinting && strlen(printArray)) std::cout << printArray << std::endl; return returnCode; } // Sets int parameter and returns printable string and error code const char * CbcOrClpParam::setIntParameterWithMessage ( OsiSolverInterface * model, int value , int & returnCode) { if (value < lowerIntValue_ || value > upperIntValue_) { sprintf(printArray, "%d was provided for %s - valid range is %d to %d", value, name_.c_str(), lowerIntValue_, upperIntValue_); returnCode = 1; } else { int oldValue = intValue_; intValue_ = oldValue; switch (type_) { case CLP_PARAM_INT_SOLVERLOGLEVEL: model->messageHandler()->setLogLevel(value); break; default: break; } sprintf(printArray, "%s was changed from %d to %d", name_.c_str(), oldValue, value); returnCode = 0; } return printArray; } int CbcOrClpParam::intParameter (OsiSolverInterface * model) const { int value = 0; switch (type_) { case CLP_PARAM_INT_SOLVERLOGLEVEL: value = model->messageHandler()->logLevel(); break; default: value = intValue_; break; } return value; } int CbcOrClpParam::setDoubleParameter (CbcModel &model, double value) { int returnCode=0; setDoubleParameterWithMessage(model, value, returnCode); if (doPrinting && strlen(printArray)) std::cout << printArray << std::endl; return returnCode; } // Sets double parameter and returns printable string and error code const char * CbcOrClpParam::setDoubleParameterWithMessage ( CbcModel & model, double value , int & returnCode) { if (value < lowerDoubleValue_ || value > upperDoubleValue_) { sprintf(printArray, "%g was provided for %s - valid range is %g to %g", value, name_.c_str(), lowerDoubleValue_, upperDoubleValue_); returnCode = 1; } else { double oldValue = doubleValue_; doubleValue_ = value; switch (type_) { case CBC_PARAM_DBL_INFEASIBILITYWEIGHT: oldValue = model.getDblParam(CbcModel::CbcInfeasibilityWeight); model.setDblParam(CbcModel::CbcInfeasibilityWeight, value); break; case CBC_PARAM_DBL_INTEGERTOLERANCE: oldValue = model.getDblParam(CbcModel::CbcIntegerTolerance); model.setDblParam(CbcModel::CbcIntegerTolerance, value); break; case CBC_PARAM_DBL_INCREMENT: oldValue = model.getDblParam(CbcModel::CbcCutoffIncrement); model.setDblParam(CbcModel::CbcCutoffIncrement, value); case CBC_PARAM_DBL_ALLOWABLEGAP: oldValue = model.getDblParam(CbcModel::CbcAllowableGap); model.setDblParam(CbcModel::CbcAllowableGap, value); break; case CBC_PARAM_DBL_GAPRATIO: oldValue = model.getDblParam(CbcModel::CbcAllowableFractionGap); model.setDblParam(CbcModel::CbcAllowableFractionGap, value); break; case CBC_PARAM_DBL_CUTOFF: oldValue = model.getCutoff(); model.setCutoff(value); break; case CBC_PARAM_DBL_TIMELIMIT_BAB: oldValue = model.getDblParam(CbcModel::CbcMaximumSeconds) ; { //OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model.solver()); //ClpSimplex * lpSolver = clpSolver->getModelPtr(); //lpSolver->setMaximumSeconds(value); model.setDblParam(CbcModel::CbcMaximumSeconds, value) ; } break ; case CLP_PARAM_DBL_DUALTOLERANCE: case CLP_PARAM_DBL_PRIMALTOLERANCE: setDoubleParameter(model.solver(), value); return 0; // to avoid message default: break; } sprintf(printArray, "%s was changed from %g to %g", name_.c_str(), oldValue, value); returnCode = 0; } return printArray; } double CbcOrClpParam::doubleParameter (CbcModel &model) const { double value; switch (type_) { case CBC_PARAM_DBL_INFEASIBILITYWEIGHT: value = model.getDblParam(CbcModel::CbcInfeasibilityWeight); break; case CBC_PARAM_DBL_INTEGERTOLERANCE: value = model.getDblParam(CbcModel::CbcIntegerTolerance); break; case CBC_PARAM_DBL_INCREMENT: value = model.getDblParam(CbcModel::CbcCutoffIncrement); break; case CBC_PARAM_DBL_ALLOWABLEGAP: value = model.getDblParam(CbcModel::CbcAllowableGap); break; case CBC_PARAM_DBL_GAPRATIO: value = model.getDblParam(CbcModel::CbcAllowableFractionGap); break; case CBC_PARAM_DBL_CUTOFF: value = model.getCutoff(); break; case CBC_PARAM_DBL_TIMELIMIT_BAB: value = model.getDblParam(CbcModel::CbcMaximumSeconds) ; break ; case CLP_PARAM_DBL_DUALTOLERANCE: case CLP_PARAM_DBL_PRIMALTOLERANCE: value = doubleParameter(model.solver()); break; default: value = doubleValue_; break; } return value; } int CbcOrClpParam::setIntParameter (CbcModel &model, int value) { int returnCode; setIntParameterWithMessage(model, value, returnCode); if (doPrinting && strlen(printArray)) std::cout << printArray << std::endl; return returnCode; } // Sets int parameter and returns printable string and error code const char * CbcOrClpParam::setIntParameterWithMessage ( CbcModel & model, int value , int & returnCode) { if (value < lowerIntValue_ || value > upperIntValue_) { sprintf(printArray, "%d was provided for %s - valid range is %d to %d", value, name_.c_str(), lowerIntValue_, upperIntValue_); returnCode = 1; } else { printArray[0] = '\0'; if (value==intValue_) return printArray; int oldValue = intValue_; intValue_ = value; switch (type_) { case CLP_PARAM_INT_LOGLEVEL: oldValue = model.messageHandler()->logLevel(); model.messageHandler()->setLogLevel(CoinAbs(value)); break; case CLP_PARAM_INT_SOLVERLOGLEVEL: oldValue = model.solver()->messageHandler()->logLevel(); model.solver()->messageHandler()->setLogLevel(value); break; case CBC_PARAM_INT_MAXNODES: oldValue = model.getIntParam(CbcModel::CbcMaxNumNode); model.setIntParam(CbcModel::CbcMaxNumNode, value); break; case CBC_PARAM_INT_MAXSOLS: oldValue = model.getIntParam(CbcModel::CbcMaxNumSol); model.setIntParam(CbcModel::CbcMaxNumSol, value); break; case CBC_PARAM_INT_MAXSAVEDSOLS: oldValue = model.maximumSavedSolutions(); model.setMaximumSavedSolutions(value); break; case CBC_PARAM_INT_STRONGBRANCHING: oldValue = model.numberStrong(); model.setNumberStrong(value); break; case CBC_PARAM_INT_NUMBERBEFORE: oldValue = model.numberBeforeTrust(); model.setNumberBeforeTrust(value); break; case CBC_PARAM_INT_NUMBERANALYZE: oldValue = model.numberAnalyzeIterations(); model.setNumberAnalyzeIterations(value); break; case CBC_PARAM_INT_CUTPASSINTREE: oldValue = model.getMaximumCutPasses(); model.setMaximumCutPasses(value); break; case CBC_PARAM_INT_CUTPASS: oldValue = model.getMaximumCutPassesAtRoot(); model.setMaximumCutPassesAtRoot(value); break; #ifdef COIN_HAS_CBC #ifdef CBC_THREAD case CBC_PARAM_INT_THREADS: oldValue = model.getNumberThreads(); model.setNumberThreads(value); break; #endif case CBC_PARAM_INT_RANDOMSEED: oldValue = model.getRandomSeed(); model.setRandomSeed(value); break; #endif default: break; } sprintf(printArray, "%s was changed from %d to %d", name_.c_str(), oldValue, value); returnCode = 0; } return printArray; } int CbcOrClpParam::intParameter (CbcModel &model) const { int value; switch (type_) { case CLP_PARAM_INT_LOGLEVEL: value = model.messageHandler()->logLevel(); break; case CLP_PARAM_INT_SOLVERLOGLEVEL: value = model.solver()->messageHandler()->logLevel(); break; case CBC_PARAM_INT_MAXNODES: value = model.getIntParam(CbcModel::CbcMaxNumNode); break; case CBC_PARAM_INT_MAXSOLS: value = model.getIntParam(CbcModel::CbcMaxNumSol); break; case CBC_PARAM_INT_MAXSAVEDSOLS: value = model.maximumSavedSolutions(); break; case CBC_PARAM_INT_STRONGBRANCHING: value = model.numberStrong(); break; case CBC_PARAM_INT_NUMBERBEFORE: value = model.numberBeforeTrust(); break; case CBC_PARAM_INT_NUMBERANALYZE: value = model.numberAnalyzeIterations(); break; case CBC_PARAM_INT_CUTPASSINTREE: value = model.getMaximumCutPasses(); break; case CBC_PARAM_INT_CUTPASS: value = model.getMaximumCutPassesAtRoot(); break; #ifdef COIN_HAS_CBC #ifdef CBC_THREAD case CBC_PARAM_INT_THREADS: value = model.getNumberThreads(); #endif case CBC_PARAM_INT_RANDOMSEED: value = model.getRandomSeed(); break; #endif default: value = intValue_; break; } return value; } #endif // Sets current parameter option using string void CbcOrClpParam::setCurrentOption ( const std::string value ) { int action = parameterOption(value); if (action >= 0) currentKeyWord_ = action; } // Sets current parameter option void CbcOrClpParam::setCurrentOption ( int value , bool printIt) { if (printIt && value != currentKeyWord_) std::cout << "Option for " << name_ << " changed from " << definedKeyWords_[currentKeyWord_] << " to " << definedKeyWords_[value] << std::endl; currentKeyWord_ = value; } // Sets current parameter option and returns printable string const char * CbcOrClpParam::setCurrentOptionWithMessage ( int value ) { if (value != currentKeyWord_) { char current[100]; char newString[100]; if (currentKeyWord_>=0&&(fakeKeyWord_<=0||currentKeyWord_=0&&(fakeKeyWord_<=0||value= 0) { if (action == currentKeyWord_) return NULL; if (currentKeyWord_>=0&&(fakeKeyWord_<=0||currentKeyWord_ upperIntValue_) { std::cout << value << " was provided for " << name_ << " - valid range is " << lowerIntValue_ << " to " << upperIntValue_ << std::endl; } else { intValue_ = value; } } const char * CbcOrClpParam::setIntValueWithMessage ( int value ) { printArray[0] = '\0'; if (value < lowerIntValue_ || value > upperIntValue_) { sprintf(printArray, "%d was provided for %s - valid range is %d to %d", value,name_.c_str(),lowerIntValue_,upperIntValue_); } else { if (value==intValue_) return NULL; sprintf(printArray, "%s was changed from %d to %d", name_.c_str(), intValue_, value); intValue_ = value; } return printArray; } void CbcOrClpParam::setDoubleValue ( double value ) { if (value < lowerDoubleValue_ || value > upperDoubleValue_) { std::cout << value << " was provided for " << name_ << " - valid range is " << lowerDoubleValue_ << " to " << upperDoubleValue_ << std::endl; } else { doubleValue_ = value; } } const char * CbcOrClpParam::setDoubleValueWithMessage ( double value ) { printArray[0] = '\0'; if (value < lowerDoubleValue_ || value > upperDoubleValue_) { sprintf(printArray, "%g was provided for %s - valid range is %g to %g", value,name_.c_str(),lowerDoubleValue_,upperDoubleValue_); } else { if (value==doubleValue_) return NULL; sprintf(printArray, "%s was changed from %g to %g", name_.c_str(), doubleValue_, value); doubleValue_ = value; } return printArray; } void CbcOrClpParam::setStringValue ( std::string value ) { stringValue_ = value; } static char line[1000]; static char * where = NULL; extern int CbcOrClpRead_mode; int CbcOrClpEnvironmentIndex = -1; static size_t fillEnv() { #if defined(_MSC_VER) || defined(__MSVCRT__) return 0; #else // Don't think it will work on Windows char * environ = getenv("CBC_CLP_ENVIRONMENT"); size_t length = 0; if (environ) { length = strlen(environ); if (CbcOrClpEnvironmentIndex < static_cast(length)) { // find next non blank char * whereEnv = environ + CbcOrClpEnvironmentIndex; // munch white space while (*whereEnv == ' ' || *whereEnv == '\t' || *whereEnv < ' ') whereEnv++; // copy char * put = line; while ( *whereEnv != '\0' ) { if ( *whereEnv == ' ' || *whereEnv == '\t' || *whereEnv < ' ' ) { break; } *put = *whereEnv; put++; assert (put - line < 1000); whereEnv++; } CbcOrClpEnvironmentIndex = static_cast(whereEnv - environ); *put = '\0'; length = strlen(line); } else { length = 0; } } if (!length) CbcOrClpEnvironmentIndex = -1; return length; #endif } extern FILE * CbcOrClpReadCommand; // Simple read stuff std::string CoinReadNextField() { std::string field; if (!where) { // need new line #ifdef COIN_HAS_READLINE if (CbcOrClpReadCommand == stdin) { // Get a line from the user. where = readline (coin_prompt); // If the line has any text in it, save it on the history. if (where) { if ( *where) add_history (where); strcpy(line, where); free(where); } } else { where = fgets(line, 1000, CbcOrClpReadCommand); } #else if (CbcOrClpReadCommand == stdin) { fputs(coin_prompt,stdout); fflush(stdout); } where = fgets(line, 1000, CbcOrClpReadCommand); #endif if (!where) return field; // EOF where = line; // clean image char * lastNonBlank = line - 1; while ( *where != '\0' ) { if ( *where != '\t' && *where < ' ' ) { break; } else if ( *where != '\t' && *where != ' ') { lastNonBlank = where; } where++; } where = line; *(lastNonBlank + 1) = '\0'; } // munch white space while (*where == ' ' || *where == '\t') where++; char * saveWhere = where; while (*where != ' ' && *where != '\t' && *where != '\0') where++; if (where != saveWhere) { char save = *where; *where = '\0'; //convert to string field = saveWhere; *where = save; } else { where = NULL; field = "EOL"; } return field; } std::string CoinReadGetCommand(int argc, const char *argv[]) { std::string field = "EOL"; // say no = afterEquals = ""; while (field == "EOL") { if (CbcOrClpRead_mode > 0) { if ((CbcOrClpRead_mode < argc && argv[CbcOrClpRead_mode]) || CbcOrClpEnvironmentIndex >= 0) { if (CbcOrClpEnvironmentIndex < 0) { field = argv[CbcOrClpRead_mode++]; } else { if (fillEnv()) { field = line; } else { // not there continue; } } if (field == "-") { std::cout << "Switching to line mode" << std::endl; CbcOrClpRead_mode = -1; field = CoinReadNextField(); } else if (field[0] != '-') { if (CbcOrClpRead_mode != 2) { // now allow std::cout<<"skipping non-command "< 0) { if (CbcOrClpRead_mode < argc || CbcOrClpEnvironmentIndex >= 0) { if (CbcOrClpEnvironmentIndex < 0) { if (argv[CbcOrClpRead_mode][0] != '-') { field = argv[CbcOrClpRead_mode++]; } else if (!strcmp(argv[CbcOrClpRead_mode], "--")) { field = argv[CbcOrClpRead_mode++]; // -- means import from stdin field = "-"; } } else { fillEnv(); field = line; } } } else { field = CoinReadNextField(); } } else { field = afterEquals; afterEquals = ""; } //std::cout< 0) { if (CbcOrClpRead_mode < argc || CbcOrClpEnvironmentIndex >= 0) { if (CbcOrClpEnvironmentIndex < 0) { // may be negative value so do not check for - field = argv[CbcOrClpRead_mode++]; } else { fillEnv(); field = line; } } } else { field = CoinReadNextField(); } } else { field = afterEquals; afterEquals = ""; } long int value = 0; //std::cout<(value); } double CoinReadGetDoubleField(int argc, const char *argv[], int * valid) { std::string field = "EOL"; if (afterEquals == "") { if (CbcOrClpRead_mode > 0) { if (CbcOrClpRead_mode < argc || CbcOrClpEnvironmentIndex >= 0) { if (CbcOrClpEnvironmentIndex < 0) { // may be negative value so do not check for - field = argv[CbcOrClpRead_mode++]; } else { fillEnv(); field = line; } } } else { field = CoinReadNextField(); } } else { field = afterEquals; afterEquals = ""; } double value = 0.0; //std::cout<= this treated as artificials in feasibility pump", 0.0, COIN_DBL_MAX, CBC_PARAM_DBL_ARTIFICIALCOST, 1); parameters[numberParameters-1].setDoubleValue(0.0); parameters[numberParameters-1].setLonghelp ( "0.0 off - otherwise variables with costs >= this are treated as artificials and fixed to lower bound in feasibility pump" ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("auto!Scale", "Whether to scale objective, rhs and bounds of problem if they look odd", "off", CLP_PARAM_STR_AUTOSCALE, 7, 0); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setLonghelp ( "If you think you may get odd objective values or large equality rows etc then\ it may be worth setting this true. It is still experimental and you may prefer\ to use objective!Scale and rhs!Scale." ); parameters[numberParameters++] = CbcOrClpParam("barr!ier", "Solve using primal dual predictor corrector algorithm", CLP_PARAM_ACTION_BARRIER); parameters[numberParameters-1].setLonghelp ( "This command solves the current model using the primal dual predictor \ corrector algorithm. You may want to link in an alternative \ ordering and factorization. It will also solve models \ with quadratic objectives." ); parameters[numberParameters++] = CbcOrClpParam("basisI!n", "Import basis from bas file", CLP_PARAM_ACTION_BASISIN, 3); parameters[numberParameters-1].setLonghelp ( "This will read an MPS format basis file from the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to '', i.e. it must be set. If you have libz then it can read compressed\ files 'xxxxxxxx.gz' or xxxxxxxx.bz2." ); parameters[numberParameters++] = CbcOrClpParam("basisO!ut", "Export basis as bas file", CLP_PARAM_ACTION_BASISOUT); parameters[numberParameters-1].setLonghelp ( "This will write an MPS format basis file to the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'default.bas'." ); parameters[numberParameters++] = CbcOrClpParam("biasLU", "Whether factorization biased towards U", "UU", CLP_PARAM_STR_BIASLU, 2, 0); parameters[numberParameters-1].append("UX"); parameters[numberParameters-1].append("LX"); parameters[numberParameters-1].append("LL"); parameters[numberParameters-1].setCurrentOption("LX"); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("branch!AndCut", "Do Branch and Cut", CBC_PARAM_ACTION_BAB); parameters[numberParameters-1].setLonghelp ( "This does branch and cut. There are many parameters which can affect the performance. \ First just try with default settings and look carefully at the log file. Did cuts help? Did they take too long? \ Look at output to see which cuts were effective and then do some tuning. You will see that the \ options for cuts are off, on, root and ifmove, forceon. Off is \ obvious, on means that this cut generator will be tried in the branch and cut tree (you can fine tune using \ 'depth'). Root means just at the root node while 'ifmove' means that cuts will be used in the tree if they \ look as if they are doing some good and moving the objective value. Forceon is same as on but forces code to use \ cut generator at every node. For probing forceonbut just does fixing probing in tree - not strengthening etc. \ If pre-processing reduced the size of the \ problem or strengthened many coefficients then it is probably wise to leave it on. Switch off heuristics \ which did not provide solutions. The other major area to look at is the search. Hopefully good solutions \ were obtained fairly early in the search so the important point is to select the best variable to branch on. \ See whether strong branching did a good job - or did it just take a lot of iterations. Adjust the strongBranching \ and trustPseudoCosts parameters. If cuts did a good job, then you may wish to \ have more rounds of cuts - see passC!uts and passT!ree." ); #endif parameters[numberParameters++] = CbcOrClpParam("bscale", "Whether to scale in barrier (and ordering speed)", "off", CLP_PARAM_STR_BARRIERSCALE, 7, 0); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("off1"); parameters[numberParameters-1].append("on1"); parameters[numberParameters-1].append("off2"); parameters[numberParameters-1].append("on2"); parameters[numberParameters++] = CbcOrClpParam("chol!esky", "Which cholesky algorithm", "native", CLP_PARAM_STR_CHOLESKY, 7); parameters[numberParameters-1].append("dense"); //#ifdef FOREIGN_BARRIER #ifdef COIN_HAS_WSMP parameters[numberParameters-1].append("fudge!Long"); parameters[numberParameters-1].append("wssmp"); #else parameters[numberParameters-1].append("fudge!Long_dummy"); parameters[numberParameters-1].append("wssmp_dummy"); #endif #if defined(COIN_HAS_AMD) || defined(COIN_HAS_CHOLMOD) || defined(COIN_HAS_GLPK) parameters[numberParameters-1].append("Uni!versityOfFlorida"); #else parameters[numberParameters-1].append("Uni!versityOfFlorida_dummy"); #endif #ifdef TAUCS_BARRIER parameters[numberParameters-1].append("Taucs"); #else parameters[numberParameters-1].append("Taucs_dummy"); #endif #ifdef COIN_HAS_MUMPS parameters[numberParameters-1].append("Mumps"); #else parameters[numberParameters-1].append("Mumps_dummy"); #endif parameters[numberParameters-1].setLonghelp ( "For a barrier code to be effective it needs a good Cholesky ordering and factorization. \ The native ordering and factorization is not state of the art, although acceptable. \ You may want to link in one from another source. See Makefile.locations for some \ possibilities." ); //#endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("clique!Cuts", "Whether to use Clique cuts", "off", CBC_PARAM_STR_CLIQUECUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("onglobal"); parameters[numberParameters-1].setLonghelp ( "This switches on clique cuts (either at root or in entire tree) \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("combine!Solutions", "Whether to use combine solution heuristic", "off", CBC_PARAM_STR_COMBINE); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].append("onquick"); parameters[numberParameters-1].append("bothquick"); parameters[numberParameters-1].append("beforequick"); parameters[numberParameters-1].setLonghelp ( "This switches on a heuristic which does branch and cut on the problem given by just \ using variables which have appeared in one or more solutions. \ It obviously only tries after two or more solutions. \ See Rounding for meaning of on,both,before" ); parameters[numberParameters++] = CbcOrClpParam("combine2!Solutions", "Whether to use crossover solution heuristic", "off", CBC_PARAM_STR_CROSSOVER2); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "This switches on a heuristic which does branch and cut on the problem given by \ fixing variables which have same value in two or more solutions. \ It obviously only tries after two or more solutions. \ See Rounding for meaning of on,both,before" ); parameters[numberParameters++] = CbcOrClpParam("constraint!fromCutoff", "Whether to use cutoff as constraint", "off", CBC_PARAM_STR_CUTOFF_CONSTRAINT); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("variable"); parameters[numberParameters-1].append("forcevariable"); parameters[numberParameters-1].append("conflict"); parameters[numberParameters-1].setLonghelp ( "This adds the objective as a constraint with best solution as RHS" ); parameters[numberParameters++] = CbcOrClpParam("cost!Strategy", "How to use costs as priorities", "off", CBC_PARAM_STR_COSTSTRATEGY); parameters[numberParameters-1].append("pri!orities"); parameters[numberParameters-1].append("column!Order?"); parameters[numberParameters-1].append("01f!irst?"); parameters[numberParameters-1].append("01l!ast?"); parameters[numberParameters-1].append("length!?"); parameters[numberParameters-1].append("singletons"); parameters[numberParameters-1].append("nonzero"); parameters[numberParameters-1].append("general!Force?"); parameters[numberParameters-1].setLonghelp ( "This orders the variables in order of their absolute costs - with largest cost ones being branched on \ first. This primitive strategy can be surprsingly effective. The column order\ option is obviously not on costs but easy to code here." ); parameters[numberParameters++] = CbcOrClpParam("cplex!Use", "Whether to use Cplex!", "off", CBC_PARAM_STR_CPX); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setLonghelp ( " If the user has Cplex, but wants to use some of Cbc's heuristics \ then you can! If this is on, then Cbc will get to the root node and then \ hand over to Cplex. If heuristics find a solution this can be significantly \ quicker. You will probably want to switch off Cbc's cuts as Cplex thinks \ they are genuine constraints. It is also probable that you want to switch \ off preprocessing, although for difficult problems it is worth trying \ both." ); #endif parameters[numberParameters++] = CbcOrClpParam("cpp!Generate", "Generates C++ code", -1, 50000, CLP_PARAM_INT_CPP, 1); parameters[numberParameters-1].setLonghelp ( "Once you like what the stand-alone solver does then this allows \ you to generate user_driver.cpp which approximates the code. \ 0 gives simplest driver, 1 generates saves and restores, 2 \ generates saves and restores even for variables at default value. \ 4 bit in cbc generates size dependent code rather than computed values. \ This is now deprecated as you can call stand-alone solver - see \ Cbc/examples/driver4.cpp." ); #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("crash", "Whether to create basis for problem", "off", CLP_PARAM_STR_CRASH); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("so!low_halim"); parameters[numberParameters-1].append("lots"); #ifdef CLP_INHERIT_MODE parameters[numberParameters-1].append("dual"); parameters[numberParameters-1].append("dw"); parameters[numberParameters-1].append("idiot"); #else parameters[numberParameters-1].append("idiot1"); parameters[numberParameters-1].append("idiot2"); parameters[numberParameters-1].append("idiot3"); parameters[numberParameters-1].append("idiot4"); parameters[numberParameters-1].append("idiot5"); parameters[numberParameters-1].append("idiot6"); parameters[numberParameters-1].append("idiot7"); #endif parameters[numberParameters-1].setLonghelp ( "If crash is set on and there is an all slack basis then Clp will flip or put structural\ variables into basis with the aim of getting dual feasible. On the whole dual seems to be\ better without it and there are alternative types of 'crash' for primal e.g. 'idiot' or 'sprint'. \ I have also added a variant due to Solow and Halim which is as on but just flip."); parameters[numberParameters++] = CbcOrClpParam("cross!over", "Whether to get a basic solution after barrier", "on", CLP_PARAM_STR_CROSSOVER); parameters[numberParameters-1].append("off"); parameters[numberParameters-1].append("maybe"); parameters[numberParameters-1].append("presolve"); parameters[numberParameters-1].setLonghelp ( "Interior point algorithms do not obtain a basic solution (and \ the feasibility criterion is a bit suspect (JJF)). This option will crossover \ to a basic solution suitable for ranging or branch and cut. With the current state \ of quadratic it may be a good idea to switch off crossover for quadratic (and maybe \ presolve as well) - the option maybe does this." ); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("csv!Statistics", "Create one line of statistics", CLP_PARAM_ACTION_CSVSTATISTICS, 2, 1); parameters[numberParameters-1].setLonghelp ( "This appends statistics to given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to '', i.e. it must be set. Adds header if file empty or does not exist." ); parameters[numberParameters++] = CbcOrClpParam("cutD!epth", "Depth in tree at which to do cuts", -1, 999999, CBC_PARAM_INT_CUTDEPTH); parameters[numberParameters-1].setLonghelp ( "Cut generators may be - off, on only at root, on if they look possible \ and on. If they are done every node then that is that, but it may be worth doing them \ every so often. The original method was every so many nodes but it is more logical \ to do it whenever depth in tree is a multiple of K. This option does that and defaults \ to -1 (off -> code decides)." ); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters++] = CbcOrClpParam("cutL!ength", "Length of a cut", -1, COIN_INT_MAX, CBC_PARAM_INT_CUTLENGTH); parameters[numberParameters-1].setLonghelp ( "At present this only applies to Gomory cuts. -1 (default) leaves as is. \ Any value >0 says that all cuts <= this length can be generated both at \ root node and in tree. 0 says to use some dynamic lengths. If value >=10,000,000 \ then the length in tree is value%10000000 - so 10000100 means unlimited length \ at root and 100 in tree." ); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters++] = CbcOrClpParam("cuto!ff", "All solutions must be better than this", -1.0e60, 1.0e60, CBC_PARAM_DBL_CUTOFF); parameters[numberParameters-1].setDoubleValue(1.0e50); parameters[numberParameters-1].setLonghelp ( "All solutions must be better than this value (in a minimization sense). \ This is also set by code whenever it obtains a solution and is set to value of \ objective for solution minus cutoff increment." ); parameters[numberParameters++] = CbcOrClpParam("cuts!OnOff", "Switches all cuts on or off", "off", CBC_PARAM_STR_CUTSSTRATEGY); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].setLonghelp ( "This can be used to switch on or off all cuts (apart from Reduce and Split). Then you can do \ individual ones off or on \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("debug!In", "read valid solution from file", CLP_PARAM_ACTION_DEBUG, 7, 1); parameters[numberParameters-1].setLonghelp ( "This will read a solution file from the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to '', i.e. it must be set.\n\n\ If set to create it will create a file called debug.file after search.\n\n\ The idea is that if you suspect a bad cut generator \ you can do a good run with debug set to 'create' and then switch on the cuts you suspect and \ re-run with debug set to 'debug.file' The create case has same effect as saveSolution." ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("decomp!ose", "Whether to try decomposition", -COIN_INT_MAX, COIN_INT_MAX, CLP_PARAM_INT_DECOMPOSE_BLOCKS, 1); parameters[numberParameters-1].setLonghelp ( "0 - off, 1 choose blocks >1 use as blocks \ Dantzig Wolfe if primal, Benders if dual \ - uses sprint pass for number of passes" ); parameters[numberParameters-1].setIntValue(0); #if CLP_MULTIPLE_FACTORIZATIONS >0 parameters[numberParameters++] = CbcOrClpParam("dense!Threshold", "Whether to use dense factorization", -1, 10000, CBC_PARAM_INT_DENSE, 1); parameters[numberParameters-1].setLonghelp ( "If processed problem <= this use dense factorization" ); parameters[numberParameters-1].setIntValue(-1); #endif #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("depth!MiniBab", "Depth at which to try mini BAB", -COIN_INT_MAX, COIN_INT_MAX, CBC_PARAM_INT_DEPTHMINIBAB); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters-1].setLonghelp ( "Rather a complicated parameter but can be useful. -1 means off for large problems but on as if -12 for problems where rows+columns<500, -2 \ means use Cplex if it is linked in. Otherwise if negative then go into depth first complete search fast branch and bound when depth>= -value-2 (so -3 will use this at depth>=1). This mode is only switched on after 500 nodes. If you really want to switch it off for small problems then set this to -999. If >=0 the value doesn't matter very much. The code will do approximately 100 nodes of fast branch and bound every now and then at depth>=5. The actual logic is too twisted to describe here." ); parameters[numberParameters++] = CbcOrClpParam("dextra3", "Extra double parameter 3", -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_DEXTRA3, 0); parameters[numberParameters-1].setDoubleValue(0.0); parameters[numberParameters++] = CbcOrClpParam("dextra4", "Extra double parameter 4", -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_DEXTRA4, 0); parameters[numberParameters-1].setDoubleValue(0.0); parameters[numberParameters++] = CbcOrClpParam("dextra5", "Extra double parameter 5", -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_DEXTRA5, 0); parameters[numberParameters-1].setDoubleValue(0.0); parameters[numberParameters++] = CbcOrClpParam("Dins", "Whether to try Distance Induced Neighborhood Search", "off", CBC_PARAM_STR_DINS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].append("often"); parameters[numberParameters-1].setLonghelp ( "This switches on Distance induced neighborhood Search. \ See Rounding for meaning of on,both,before" ); #endif parameters[numberParameters++] = CbcOrClpParam("direction", "Minimize or Maximize", "min!imize", CLP_PARAM_STR_DIRECTION); parameters[numberParameters-1].append("max!imize"); parameters[numberParameters-1].append("zero"); parameters[numberParameters-1].setLonghelp ( "The default is minimize - use 'direction maximize' for maximization.\n\ You can also use the parameters 'maximize' or 'minimize'." ); parameters[numberParameters++] = CbcOrClpParam("directory", "Set Default directory for import etc.", CLP_PARAM_ACTION_DIRECTORY); parameters[numberParameters-1].setLonghelp ( "This sets the directory which import, export, saveModel, restoreModel etc will use.\ It is initialized to './'" ); parameters[numberParameters++] = CbcOrClpParam("dirSample", "Set directory where the COIN-OR sample problems are.", CLP_PARAM_ACTION_DIRSAMPLE, 7, 1); parameters[numberParameters-1].setLonghelp ( "This sets the directory where the COIN-OR sample problems reside. It is\ used only when -unitTest is passed to clp. clp will pick up the test problems\ from this directory.\ It is initialized to '../../Data/Sample'" ); parameters[numberParameters++] = CbcOrClpParam("dirNetlib", "Set directory where the netlib problems are.", CLP_PARAM_ACTION_DIRNETLIB, 7, 1); parameters[numberParameters-1].setLonghelp ( "This sets the directory where the netlib problems reside. One can get\ the netlib problems from COIN-OR or from the main netlib site. This\ parameter is used only when -netlib is passed to clp. clp will pick up the\ netlib problems from this directory. If clp is built without zlib support\ then the problems must be uncompressed.\ It is initialized to '../../Data/Netlib'" ); parameters[numberParameters++] = CbcOrClpParam("dirMiplib", "Set directory where the miplib 2003 problems are.", CBC_PARAM_ACTION_DIRMIPLIB, 7, 1); parameters[numberParameters-1].setLonghelp ( "This sets the directory where the miplib 2003 problems reside. One can\ get the miplib problems from COIN-OR or from the main miplib site. This\ parameter is used only when -miplib is passed to cbc. cbc will pick up the\ miplib problems from this directory. If cbc is built without zlib support\ then the problems must be uncompressed.\ It is initialized to '../../Data/miplib3'" ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("diveO!pt", "Diving options", -1, 200000, CBC_PARAM_INT_DIVEOPT, 1); parameters[numberParameters-1].setLonghelp ( "If >2 && <20 then modify diving options - \ \n\t3 only at root and if no solution, \ \n\t4 only at root and if this heuristic has not got solution, \ \n\t5 decay only if no solution, \ \n\t6 if depth <3 or decay, \ \n\t7 run up to 2 times if solution found 4 otherwise, \ \n\t>10 All only at root (DivingC normal as value-10), \ \n\t>20 All with value-20)." ); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters++] = CbcOrClpParam("diveS!olves", "Diving solve option", -1, 200000, CBC_PARAM_INT_DIVEOPTSOLVES, 1); parameters[numberParameters-1].setLonghelp ( "If >0 then do up to this many solves. Last digit is ignored \ and used for extra options - \ \n\t1-3 allow fixing of satisfied integers (but not at bound) \ \n\t1 switch off above for that dive if goes infeasible \ \n\t2 switch off above permanently if goes infeasible" ); parameters[numberParameters-1].setIntValue(100); parameters[numberParameters++] = CbcOrClpParam("DivingS!ome", "Whether to try Diving heuristics", "off", CBC_PARAM_STR_DIVINGS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "This switches on a random diving heuristic at various times. \ C - Coefficient, F - Fractional, G - Guided, L - LineSearch, P - PseudoCost, V - VectorLength. \ You may prefer to use individual on/off \ See Rounding for meaning of on,both,before" ); parameters[numberParameters++] = CbcOrClpParam("DivingC!oefficient", "Whether to try DiveCoefficient", "off", CBC_PARAM_STR_DIVINGC); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters++] = CbcOrClpParam("DivingF!ractional", "Whether to try DiveFractional", "off", CBC_PARAM_STR_DIVINGF); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters++] = CbcOrClpParam("DivingG!uided", "Whether to try DiveGuided", "off", CBC_PARAM_STR_DIVINGG); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters++] = CbcOrClpParam("DivingL!ineSearch", "Whether to try DiveLineSearch", "off", CBC_PARAM_STR_DIVINGL); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters++] = CbcOrClpParam("DivingP!seudoCost", "Whether to try DivePseudoCost", "off", CBC_PARAM_STR_DIVINGP); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters++] = CbcOrClpParam("DivingV!ectorLength", "Whether to try DiveVectorLength", "off", CBC_PARAM_STR_DIVINGV); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters++] = CbcOrClpParam("doH!euristic", "Do heuristics before any preprocessing", CBC_PARAM_ACTION_DOHEURISTIC, 3); parameters[numberParameters-1].setLonghelp ( "Normally heuristics are done in branch and bound. It may be useful to do them outside. \ Only those heuristics with 'both' or 'before' set will run. \ Doing this may also set cutoff, which can help with preprocessing." ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("dualB!ound", "Initially algorithm acts as if no \ gap between bounds exceeds this value", 1.0e-20, 1.0e12, CLP_PARAM_DBL_DUALBOUND); parameters[numberParameters-1].setLonghelp ( "The dual algorithm in Clp is a single phase algorithm as opposed to a two phase\ algorithm where you first get feasible then optimal. If a problem has both upper and\ lower bounds then it is trivial to get dual feasible by setting non basic variables\ to correct bound. If the gap between the upper and lower bounds of a variable is more\ than the value of dualBound Clp introduces fake bounds so that it can make the problem\ dual feasible. This has the same effect as a composite objective function in the\ primal algorithm. Too high a value may mean more iterations, while too low a bound means\ the code may go all the way and then have to increase the bounds. OSL had a heuristic to\ adjust bounds, maybe we need that here." ); parameters[numberParameters++] = CbcOrClpParam("dualize", "Solves dual reformulation", 0, 4, CLP_PARAM_INT_DUALIZE, 1); parameters[numberParameters-1].setLonghelp ( "Don't even think about it." ); parameters[numberParameters++] = CbcOrClpParam("dualP!ivot", "Dual pivot choice algorithm", "auto!matic", CLP_PARAM_STR_DUALPIVOT, 7, 1); parameters[numberParameters-1].append("dant!zig"); parameters[numberParameters-1].append("partial"); parameters[numberParameters-1].append("steep!est"); parameters[numberParameters-1].setLonghelp ( "Clp can use any pivot selection algorithm which the user codes as long as it\ implements the features in the abstract pivot base class. The Dantzig method is implemented\ to show a simple method but its use is deprecated. Steepest is the method of choice and there\ are two variants which keep all weights updated but only scan a subset each iteration.\ Partial switches this on while automatic decides at each iteration based on information\ about the factorization." ); parameters[numberParameters++] = CbcOrClpParam("dualS!implex", "Do dual simplex algorithm", CLP_PARAM_ACTION_DUALSIMPLEX); parameters[numberParameters-1].setLonghelp ( "This command solves the continuous relaxation of the current model using the dual steepest edge algorithm.\ The time and iterations may be affected by settings such as presolve, scaling, crash\ and also by dual pivot method, fake bound on variables and dual and primal tolerances." ); #endif parameters[numberParameters++] = CbcOrClpParam("dualT!olerance", "For an optimal solution \ no dual infeasibility may exceed this value", 1.0e-20, 1.0e12, CLP_PARAM_DBL_DUALTOLERANCE); parameters[numberParameters-1].setLonghelp ( "Normally the default tolerance is fine, but you may want to increase it a\ bit if a dual run seems to be having a hard time. One method which can be faster is \ to use a large tolerance e.g. 1.0e-4 and dual and then clean up problem using primal and the \ correct tolerance (remembering to switch off presolve for this final short clean up phase)." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("dw!Heuristic", "Whether to try DW heuristic", "off", CBC_PARAM_STR_DW); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "See Rounding for meaning of on,both,before" ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("either!Simplex", "Do dual or primal simplex algorithm", CLP_PARAM_ACTION_EITHERSIMPLEX); parameters[numberParameters-1].setLonghelp ( "This command solves the continuous relaxation of the current model using the dual or primal algorithm,\ based on a dubious analysis of model." ); #endif parameters[numberParameters++] = CbcOrClpParam("end", "Stops clp execution", CLP_PARAM_ACTION_EXIT); parameters[numberParameters-1].setLonghelp ( "This stops execution ; end, exit, quit and stop are synonyms" ); parameters[numberParameters++] = CbcOrClpParam("environ!ment", "Read commands from environment", CLP_PARAM_ACTION_ENVIRONMENT, 7, 0); parameters[numberParameters-1].setLonghelp ( "This starts reading from environment variable CBC_CLP_ENVIRONMENT." ); parameters[numberParameters++] = CbcOrClpParam("error!sAllowed", "Whether to allow import errors", "off", CLP_PARAM_STR_ERRORSALLOWED, 3); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setLonghelp ( "The default is not to use any model which had errors when reading the mps file.\ Setting this to 'on' will allow all errors from which the code can recover\ simply by ignoring the error. There are some errors from which the code can not recover \ e.g. no ENDATA. This has to be set before import i.e. -errorsAllowed on -import xxxxxx.mps." ); parameters[numberParameters++] = CbcOrClpParam("exit", "Stops clp execution", CLP_PARAM_ACTION_EXIT); parameters[numberParameters-1].setLonghelp ( "This stops the execution of Clp, end, exit, quit and stop are synonyms" ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("exper!iment", "Whether to use testing features", -1, 200, CBC_PARAM_INT_EXPERIMENT, 0); parameters[numberParameters-1].setLonghelp ( "Defines how adventurous you want to be in using new ideas. \ 0 then no new ideas, 1 fairly sensible, 2 a bit dubious, 3 you are on your own!" ); parameters[numberParameters-1].setIntValue(0); parameters[numberParameters++] = CbcOrClpParam("expensive!Strong", "Whether to do even more strong branching", 0, COIN_INT_MAX, CBC_PARAM_INT_STRONG_STRATEGY, 0); parameters[numberParameters-1].setLonghelp ( "Strategy for extra strong branching \n\ \n\t0 - normal\n\ \n\twhen to do all fractional\n\ \n\t1 - root node\n\ \n\t2 - depth less than modifier\n\ \n\t4 - if objective == best possible\n\ \n\t6 - as 2+4\n\ \n\twhen to do all including satisfied\n\ \n\t10 - root node etc.\n\ \n\tIf >=100 then do when depth <= strategy/100 (otherwise 5)" ); parameters[numberParameters-1].setIntValue(0); #endif parameters[numberParameters++] = CbcOrClpParam("export", "Export model as mps file", CLP_PARAM_ACTION_EXPORT); parameters[numberParameters-1].setLonghelp ( "This will write an MPS format file to the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'default.mps'. \ It can be useful to get rid of the original names and go over to using Rnnnnnnn and Cnnnnnnn. This can be done by setting 'keepnames' off before importing mps file." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("extra1", "Extra integer parameter 1", -COIN_INT_MAX, COIN_INT_MAX, CBC_PARAM_INT_EXTRA1, 0); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters++] = CbcOrClpParam("extra2", "Extra integer parameter 2", -100, COIN_INT_MAX, CBC_PARAM_INT_EXTRA2, 0); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters++] = CbcOrClpParam("extra3", "Extra integer parameter 3", -1, COIN_INT_MAX, CBC_PARAM_INT_EXTRA3, 0); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters++] = CbcOrClpParam("extra4", "Extra integer parameter 4", -1, COIN_INT_MAX, CBC_PARAM_INT_EXTRA4, 0); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters-1].setLonghelp ( "This switches on yet more special options!! \ The bottom digit is a strategy when to used shadow price stuff e.g. 3 \ means use until a solution is found. The next two digits say what sort \ of dual information to use. After that it goes back to powers of 2 so -\n\ \n\t1000 - switches on experimental hotstart\n\ \n\t2,4,6000 - switches on experimental methods of stopping cuts\n\ \n\t8000 - increase minimum drop gradually\n\ \n\t16000 - switches on alternate gomory criterion" ); parameters[numberParameters++] = CbcOrClpParam("extraV!ariables", "Allow creation of extra integer variables", -COIN_INT_MAX, COIN_INT_MAX, CBC_PARAM_INT_EXTRA_VARIABLES, 0); parameters[numberParameters-1].setIntValue(0); parameters[numberParameters-1].setLonghelp ( "This switches on creation of extra integer variables \ to gather all variables with same cost." ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("fact!orization", "Which factorization to use", "normal", CLP_PARAM_STR_FACTORIZATION); parameters[numberParameters-1].append("dense"); parameters[numberParameters-1].append("simple"); parameters[numberParameters-1].append("osl"); parameters[numberParameters-1].setLonghelp ( #ifndef ABC_INHERIT "The default is to use the normal CoinFactorization, but \ other choices are a dense one, osl's or one designed for small problems." #else "Normally the default is to use the normal CoinFactorization, but \ other choices are a dense one, osl's or one designed for small problems. \ However if at Aboca then the default is CoinAbcFactorization and other choices are \ a dense one, one designed for small problems or if enabled a long factorization." #endif ); parameters[numberParameters++] = CbcOrClpParam("fakeB!ound", "All bounds <= this value - DEBUG", 1.0, 1.0e15, CLP_PARAM_ACTION_FAKEBOUND, 0); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("feas!ibilityPump", "Whether to try Feasibility Pump", "off", CBC_PARAM_STR_FPUMP); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "This switches on feasibility pump heuristic at root. This is due to Fischetti, Lodi and Glover \ and uses a sequence of Lps to try and get an integer feasible solution. \ Some fine tuning is available by passFeasibilityPump and also pumpTune. \ See Rounding for meaning of on,both,before" ); parameters[numberParameters++] = CbcOrClpParam("fix!OnDj", "Try heuristic based on fixing variables with \ reduced costs greater than this", -1.0e20, 1.0e20, CBC_PARAM_DBL_DJFIX, 1); parameters[numberParameters-1].setLonghelp ( "If this is set integer variables with reduced costs greater than this will be fixed \ before branch and bound - use with extreme caution!" ); parameters[numberParameters++] = CbcOrClpParam("flow!CoverCuts", "Whether to use Flow Cover cuts", "off", CBC_PARAM_STR_FLOWCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("onglobal"); parameters[numberParameters-1].setFakeKeyWord(3); parameters[numberParameters-1].setLonghelp ( "This switches on flow cover cuts (either at root or in entire tree) \ See branchAndCut for information on options. \ Can also enter testing values by plusnn (==ifmove)" ); parameters[numberParameters++] = CbcOrClpParam("force!Solution", "Whether to use given solution as crash for BAB", -1, 20000000, CLP_PARAM_INT_USESOLUTION); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters-1].setLonghelp ( "-1 off. If 1 then tries to branch to solution given by AMPL or priorities file. \ If 0 then just tries to set as best solution \ If >1 then also does that many nodes on fixed problem." ); parameters[numberParameters++] = CbcOrClpParam("fraction!forBAB", "Fraction in feasibility pump", 1.0e-5, 1.1, CBC_PARAM_DBL_SMALLBAB, 1); parameters[numberParameters-1].setDoubleValue(0.5); parameters[numberParameters-1].setLonghelp ( "After a pass in feasibility pump, variables which have not moved \ about are fixed and if the preprocessed model is small enough a few nodes \ of branch and bound are done on reduced problem. Small problem has to be less than this fraction of original." ); #endif parameters[numberParameters++] = CbcOrClpParam("gamma!(Delta)", "Whether to regularize barrier", "off", CLP_PARAM_STR_GAMMA, 7, 1); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("gamma"); parameters[numberParameters-1].append("delta"); parameters[numberParameters-1].append("onstrong"); parameters[numberParameters-1].append("gammastrong"); parameters[numberParameters-1].append("deltastrong"); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("GMI!Cuts", "Whether to use alternative Gomory cuts", "off", CBC_PARAM_STR_GMICUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("endonly"); parameters[numberParameters-1].append("long"); parameters[numberParameters-1].append("longroot"); parameters[numberParameters-1].append("longifmove"); parameters[numberParameters-1].append("forceLongOn"); parameters[numberParameters-1].append("longendonly"); parameters[numberParameters-1].setLonghelp ( "This switches on an alternative Gomory cut generator (either at root or in entire tree) \ This version is by Giacomo Nannicini and may be more robust \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("gomory!Cuts", "Whether to use Gomory cuts", "off", CBC_PARAM_STR_GOMORYCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("onglobal"); parameters[numberParameters-1].append("forceandglobal"); parameters[numberParameters-1].append("forceLongOn"); parameters[numberParameters-1].append("long"); parameters[numberParameters-1].setLonghelp ( "The original cuts - beware of imitations! Having gone out of favor, they are now more \ fashionable as LP solvers are more robust and they interact well with other cuts. They will almost always \ give cuts (although in this executable they are limited as to number of variables in cut). \ However the cuts may be dense so it is worth experimenting (Long allows any length). \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("greedy!Heuristic", "Whether to use a greedy heuristic", "off", CBC_PARAM_STR_GREEDY); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); //parameters[numberParameters-1].append("root"); parameters[numberParameters-1].setLonghelp ( "Switches on a greedy heuristic which will try and obtain a solution. It may just fix a \ percentage of variables and then try a small branch and cut run. \ See Rounding for meaning of on,both,before" ); #endif parameters[numberParameters++] = CbcOrClpParam("gsolu!tion", "Puts glpk solution to file", CLP_PARAM_ACTION_GMPL_SOLUTION); parameters[numberParameters-1].setLonghelp ( "Will write a glpk solution file to the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'stdout' (this defaults to ordinary solution if stdout). \ If problem created from gmpl model - will do any reports." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("heur!isticsOnOff", "Switches most heuristics on or off", "off", CBC_PARAM_STR_HEURISTICSTRATEGY); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setLonghelp ( "This can be used to switch on or off all heuristics. Then you can do \ individual ones off or on. CbcTreeLocal is not included as it dramatically \ alters search." ); #endif parameters[numberParameters++] = CbcOrClpParam("help", "Print out version, non-standard options and some help", CLP_PARAM_ACTION_HELP, 3); parameters[numberParameters-1].setLonghelp ( "This prints out some help to get user started. If you have printed this then \ you should be past that stage:-)" ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("hOp!tions", "Heuristic options", -9999999, 9999999, CBC_PARAM_INT_HOPTIONS, 1); parameters[numberParameters-1].setLonghelp ( "1 says stop heuristic immediately allowable gap reached. \ Others are for feasibility pump - \ 2 says do exact number of passes given, \ 4 only applies if initial cutoff given and says relax after 50 passes, \ while 8 will adapt cutoff rhs after first solution if it looks as if code is stalling." ); parameters[numberParameters-1].setIntValue(0); parameters[numberParameters++] = CbcOrClpParam("hot!StartMaxIts", "Maximum iterations on hot start", 0, COIN_INT_MAX, CBC_PARAM_INT_MAXHOTITS); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("idiot!Crash", "Whether to try idiot crash", -1, 99999999, CLP_PARAM_INT_IDIOT); parameters[numberParameters-1].setLonghelp ( "This is a type of 'crash' which works well on some homogeneous problems.\ It works best on problems with unit elements and rhs but will do something to any model. It should only be\ used before primal. It can be set to -1 when the code decides for itself whether to use it,\ 0 to switch off or n > 0 to do n passes." ); #endif parameters[numberParameters++] = CbcOrClpParam("import", "Import model from mps file", CLP_PARAM_ACTION_IMPORT, 3); parameters[numberParameters-1].setLonghelp ( "This will read an MPS format file from the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to '', i.e. it must be set. If you have libgz then it can read compressed\ files 'xxxxxxxx.gz' or 'xxxxxxxx.bz2'. \ If 'keepnames' is off, then names are dropped -> Rnnnnnnn and Cnnnnnnn." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("inc!rement", "A valid solution must be at least this \ much better than last integer solution", -1.0e20, 1.0e20, CBC_PARAM_DBL_INCREMENT); parameters[numberParameters-1].setLonghelp ( "Whenever a solution is found the bound on solutions is set to solution (in a minimization\ sense) plus this. If it is not set then the code will try and work one out e.g. if \ all objective coefficients are multiples of 0.01 and only integer variables have entries in \ objective then this can be set to 0.01. Be careful if you set this negative!" ); parameters[numberParameters++] = CbcOrClpParam("inf!easibilityWeight", "Each integer infeasibility is expected \ to cost this much", 0.0, 1.0e20, CBC_PARAM_DBL_INFEASIBILITYWEIGHT, 1); parameters[numberParameters-1].setLonghelp ( "A primitive way of deciding which node to explore next. Satisfying each integer infeasibility is \ expected to cost this much." ); parameters[numberParameters++] = CbcOrClpParam("initialS!olve", "Solve to continuous", CLP_PARAM_ACTION_SOLVECONTINUOUS); parameters[numberParameters-1].setLonghelp ( "This just solves the problem to continuous - without adding any cuts" ); parameters[numberParameters++] = CbcOrClpParam("integerT!olerance", "For an optimal solution \ no integer variable may be this away from an integer value", 1.0e-20, 0.5, CBC_PARAM_DBL_INTEGERTOLERANCE); parameters[numberParameters-1].setLonghelp ( "Beware of setting this smaller than the primal tolerance." ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("keepN!ames", "Whether to keep names from import", "on", CLP_PARAM_STR_KEEPNAMES); parameters[numberParameters-1].append("off"); parameters[numberParameters-1].setLonghelp ( "It saves space to get rid of names so if you need to you can set this to off. \ This needs to be set before the import of model - so -keepnames off -import xxxxx.mps." ); parameters[numberParameters++] = CbcOrClpParam("KKT", "Whether to use KKT factorization", "off", CLP_PARAM_STR_KKT, 7, 1); parameters[numberParameters-1].append("on"); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("knapsack!Cuts", "Whether to use Knapsack cuts", "off", CBC_PARAM_STR_KNAPSACKCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("onglobal"); parameters[numberParameters-1].append("forceandglobal"); parameters[numberParameters-1].setLonghelp ( "This switches on knapsack cuts (either at root or in entire tree) \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("lagomory!Cuts", "Whether to use Lagrangean Gomory cuts", "off", CBC_PARAM_STR_LAGOMORYCUTS); parameters[numberParameters-1].append("endonlyroot"); parameters[numberParameters-1].append("endcleanroot"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("endonly"); parameters[numberParameters-1].append("endclean"); parameters[numberParameters-1].append("endboth"); parameters[numberParameters-1].append("onlyaswell"); parameters[numberParameters-1].append("cleanaswell"); parameters[numberParameters-1].append("bothaswell"); parameters[numberParameters-1].append("onlyinstead"); parameters[numberParameters-1].append("cleaninstead"); parameters[numberParameters-1].append("bothinstead"); parameters[numberParameters-1].append("onlyaswellroot"); parameters[numberParameters-1].append("cleanaswellroot"); parameters[numberParameters-1].append("bothaswellroot"); parameters[numberParameters-1].setLonghelp ( "This is a gross simplification of 'A Relax-and-Cut Framework for Gomory's Mixed-Integer Cuts' \ by Matteo Fischetti & Domenico Salvagnin. This simplification \ just uses original constraints while modifying objective using other cuts. \ So you don't use messy constraints generated by Gomory etc. \ A variant is to allow non messy cuts e.g. clique cuts. \ So 'only' does this while clean also allows integral valued cuts. \ 'End' is recommended which waits until other cuts have finished and then \ does a few passes. \ The length options for gomory cuts are used." ); parameters[numberParameters++] = CbcOrClpParam("latwomir!Cuts", "Whether to use Lagrangean TwoMir cuts", "off", CBC_PARAM_STR_LATWOMIRCUTS); parameters[numberParameters-1].append("endonlyroot"); parameters[numberParameters-1].append("endcleanroot"); parameters[numberParameters-1].append("endbothroot"); parameters[numberParameters-1].append("endonly"); parameters[numberParameters-1].append("endclean"); parameters[numberParameters-1].append("endboth"); parameters[numberParameters-1].append("onlyaswell"); parameters[numberParameters-1].append("cleanaswell"); parameters[numberParameters-1].append("bothaswell"); parameters[numberParameters-1].append("onlyinstead"); parameters[numberParameters-1].append("cleaninstead"); parameters[numberParameters-1].append("bothinstead"); parameters[numberParameters-1].setLonghelp ( "This is a lagrangean relaxation for TwoMir cuts. See \ lagomoryCuts for description of options." ); parameters[numberParameters++] = CbcOrClpParam("lift!AndProjectCuts", "Whether to use Lift and Project cuts", "off", CBC_PARAM_STR_LANDPCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].setLonghelp ( "Lift and project cuts. \ May be slow \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("local!TreeSearch", "Whether to use local treesearch", "off", CBC_PARAM_STR_LOCALTREE); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setLonghelp ( "This switches on a local search algorithm when a solution is found. This is from \ Fischetti and Lodi and is not really a heuristic although it can be used as one. \ When used from Coin solve it has limited functionality. It is not switched on when \ heuristics are switched on." ); #endif #ifndef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("log!Level", "Level of detail in Solver output", -1, 999999, CLP_PARAM_INT_SOLVERLOGLEVEL); #else parameters[numberParameters++] = CbcOrClpParam("log!Level", "Level of detail in Coin branch and Cut output", -63, 63, CLP_PARAM_INT_LOGLEVEL); parameters[numberParameters-1].setIntValue(1); #endif parameters[numberParameters-1].setLonghelp ( "If 0 then there should be no output in normal circumstances. 1 is probably the best\ value for most uses, while 2 and 3 give more information." ); parameters[numberParameters++] = CbcOrClpParam("max!imize", "Set optimization direction to maximize", CLP_PARAM_ACTION_MAXIMIZE, 7); parameters[numberParameters-1].setLonghelp ( "The default is minimize - use 'maximize' for maximization.\n\ You can also use the parameters 'direction maximize'." ); #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("maxF!actor", "Maximum number of iterations between \ refactorizations", 1, 999999, CLP_PARAM_INT_MAXFACTOR); parameters[numberParameters-1].setLonghelp ( "If this is at its initial value of 200 then in this executable clp will guess at a\ value to use. Otherwise the user can set a value. The code may decide to re-factorize\ earlier for accuracy." ); parameters[numberParameters++] = CbcOrClpParam("maxIt!erations", "Maximum number of iterations before \ stopping", 0, 2147483647, CLP_PARAM_INT_MAXITERATION); parameters[numberParameters-1].setLonghelp ( "This can be used for testing purposes. The corresponding library call\n\ \tsetMaximumIterations(value)\n can be useful. If the code stops on\ seconds or by an interrupt this will be treated as stopping on maximum iterations. This is ignored in branchAndCut - use maxN!odes." ); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("maxN!odes", "Maximum number of nodes to do", -1, 2147483647, CBC_PARAM_INT_MAXNODES); parameters[numberParameters-1].setLonghelp ( "This is a repeatable way to limit search. Normally using time is easier \ but then the results may not be repeatable." ); parameters[numberParameters++] = CbcOrClpParam("maxSaved!Solutions", "Maximum number of solutions to save", 0, 2147483647, CBC_PARAM_INT_MAXSAVEDSOLS); parameters[numberParameters-1].setLonghelp ( "Number of solutions to save." ); parameters[numberParameters++] = CbcOrClpParam("maxSo!lutions", "Maximum number of solutions to get", 1, 2147483647, CBC_PARAM_INT_MAXSOLS); parameters[numberParameters-1].setLonghelp ( "You may want to stop after (say) two solutions or an hour. \ This is checked every node in tree, so it is possible to get more solutions from heuristics." ); #endif parameters[numberParameters++] = CbcOrClpParam("min!imize", "Set optimization direction to minimize", CLP_PARAM_ACTION_MINIMIZE, 7); parameters[numberParameters-1].setLonghelp ( "The default is minimize - use 'maximize' for maximization.\n\ This should only be necessary if you have previously set maximization \ You can also use the parameters 'direction minimize'." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("mipO!ptions", "Dubious options for mip", 0, COIN_INT_MAX, CBC_PARAM_INT_MIPOPTIONS, 0); parameters[numberParameters++] = CbcOrClpParam("more!MipOptions", "More dubious options for mip", -1, COIN_INT_MAX, CBC_PARAM_INT_MOREMIPOPTIONS, 0); parameters[numberParameters++] = CbcOrClpParam("more2!MipOptions", "More more dubious options for mip", -1, COIN_INT_MAX, CBC_PARAM_INT_MOREMOREMIPOPTIONS, 0); parameters[numberParameters-1].setIntValue(0); parameters[numberParameters++] = CbcOrClpParam("mixed!IntegerRoundingCuts", "Whether to use Mixed Integer Rounding cuts", "off", CBC_PARAM_STR_MIXEDCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("onglobal"); parameters[numberParameters-1].setLonghelp ( "This switches on mixed integer rounding cuts (either at root or in entire tree) \ See branchAndCut for information on options." ); #endif parameters[numberParameters++] = CbcOrClpParam("mess!ages", "Controls if Clpnnnn is printed", "off", CLP_PARAM_STR_MESSAGES); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setLonghelp ("The default behavior is to put out messages such as:\n\ Clp0005 2261 Objective 109.024 Primal infeas 944413 (758)\n\ but this program turns this off to make it look more friendly. It can be useful\ to turn them back on if you want to be able to 'grep' for particular messages or if\ you intend to override the behavior of a particular message. This only affects Clp not Cbc." ); parameters[numberParameters++] = CbcOrClpParam("miplib", "Do some of miplib test set", CBC_PARAM_ACTION_MIPLIB, 3, 1); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("mips!tart", "reads an initial feasible solution from file", CBC_PARAM_ACTION_MIPSTART); parameters[numberParameters-1].setLonghelp ("\ The MIPStart allows one to enter an initial integer feasible solution \ to CBC. Values of the main decision variables which are active (have \ non-zero values) in this solution are specified in a text file. The \ text file format used is the same of the solutions saved by CBC, but \ not all fields are required to be filled. First line may contain the \ solution status and will be ignored, remaining lines contain column \ indexes, names and values as in this example:\n\ \n\ Stopped on iterations - objective value 57597.00000000\n\ 0 x(1,1,2,2) 1 \n\ 1 x(3,1,3,2) 1 \n\ 5 v(5,1) 2 \n\ 33 x(8,1,5,2) 1 \n\ ...\n\ \n\ Column indexes are also ignored since pre-processing can change them. \ There is no need to include values for continuous or integer auxiliary \ variables, since they can be computed based on main decision variables. \ Starting CBC with an integer feasible solution can dramatically improve \ its performance: several MIP heuristics (e.g. RINS) rely on having at \ least one feasible solution available and can start immediately if the \ user provides one. Feasibility Pump (FP) is a heuristic which tries to \ overcome the problem of taking too long to find feasible solution (or \ not finding at all), but it not always succeeds. If you provide one \ starting solution you will probably save some time by disabling FP. \ \n\n\ Knowledge specific to your problem can be considered to write an \ external module to quickly produce an initial feasible solution - some \ alternatives are the implementation of simple greedy heuristics or the \ solution (by CBC for example) of a simpler model created just to find \ a feasible solution. \ \n\n\ Question and suggestions regarding MIPStart can be directed to\n\ haroldo.santos@gmail.com.\ "); #endif parameters[numberParameters++] = CbcOrClpParam("moreS!pecialOptions", "Yet more dubious options for Simplex - see ClpSimplex.hpp", 0, COIN_INT_MAX, CLP_PARAM_INT_MORESPECIALOPTIONS, 0); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("moreT!une", "Yet more dubious ideas for feasibility pump", 0, 100000000, CBC_PARAM_INT_FPUMPTUNE2, 0); parameters[numberParameters-1].setLonghelp ( "Yet more ideas for Feasibility Pump \n\ \t/100000 == 1 use box constraints and original obj in cleanup\n\ \t/1000 == 1 Pump will run twice if no solution found\n\ \t/1000 == 2 Pump will only run after root cuts if no solution found\n\ \t/1000 >10 as above but even if solution found\n\ \t/100 == 1,3.. exact 1.0 for objective values\n\ \t/100 == 2,3.. allow more iterations per pass\n\ \t n fix if value of variable same for last n iterations." ); parameters[numberParameters-1].setIntValue(0); parameters[numberParameters++] = CbcOrClpParam("multiple!RootPasses", "Do multiple root passes to collect cuts and solutions", 0, 100000000, CBC_PARAM_INT_MULTIPLEROOTS, 0); parameters[numberParameters-1].setIntValue(0); parameters[numberParameters-1].setLonghelp ( "Do (in parallel if threads enabled) the root phase this number of times \ and collect all solutions and cuts generated. The actual format is aabbcc \ where aa is number of extra passes, if bb is non zero \ then it is number of threads to use (otherwise uses threads setting) and \ cc is number of times to do root phase. Yet another one from the Italian idea factory \ (This time - Andrea Lodi , Matteo Fischetti , Michele Monaci , Domenico Salvagnin , \ and Andrea Tramontani). \ The solvers do not interact with each other. However if extra passes are specified \ then cuts are collected and used in later passes - so there is interaction there." ); parameters[numberParameters++] = CbcOrClpParam("naive!Heuristics", "Whether to try some stupid heuristic", "off", CBC_PARAM_STR_NAIVE, 7, 1); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "Really silly stuff e.g. fix all integers with costs to zero!. \ Doh option does heuristic before preprocessing" ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("netlib", "Solve entire netlib test set", CLP_PARAM_ACTION_NETLIB_EITHER, 3, 1); parameters[numberParameters-1].setLonghelp ( "This exercises the unit test for clp and then solves the netlib test set using dual or primal.\ The user can set options before e.g. clp -presolve off -netlib" ); parameters[numberParameters++] = CbcOrClpParam("netlibB!arrier", "Solve entire netlib test set with barrier", CLP_PARAM_ACTION_NETLIB_BARRIER, 3, 1); parameters[numberParameters-1].setLonghelp ( "This exercises the unit test for clp and then solves the netlib test set using barrier.\ The user can set options before e.g. clp -kkt on -netlib" ); parameters[numberParameters++] = CbcOrClpParam("netlibD!ual", "Solve entire netlib test set (dual)", CLP_PARAM_ACTION_NETLIB_DUAL, 3, 1); parameters[numberParameters-1].setLonghelp ( "This exercises the unit test for clp and then solves the netlib test set using dual.\ The user can set options before e.g. clp -presolve off -netlib" ); parameters[numberParameters++] = CbcOrClpParam("netlibP!rimal", "Solve entire netlib test set (primal)", CLP_PARAM_ACTION_NETLIB_PRIMAL, 3, 1); parameters[numberParameters-1].setLonghelp ( "This exercises the unit test for clp and then solves the netlib test set using primal.\ The user can set options before e.g. clp -presolve off -netlibp" ); parameters[numberParameters++] = CbcOrClpParam("netlibT!une", "Solve entire netlib test set with 'best' algorithm", CLP_PARAM_ACTION_NETLIB_TUNE, 3, 1); parameters[numberParameters-1].setLonghelp ( "This exercises the unit test for clp and then solves the netlib test set using whatever \ works best. I know this is cheating but it also stresses the code better by doing a \ mixture of stuff. The best algorithm was chosen on a Linux ThinkPad using native cholesky \ with University of Florida ordering." ); parameters[numberParameters++] = CbcOrClpParam("network", "Tries to make network matrix", CLP_PARAM_ACTION_NETWORK, 7, 0); parameters[numberParameters-1].setLonghelp ( "Clp will go faster if the matrix can be converted to a network. The matrix\ operations may be a bit faster with more efficient storage, but the main advantage\ comes from using a network factorization. It will probably not be as fast as a \ specialized network code." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("nextB!estSolution", "Prints next best saved solution to file", CLP_PARAM_ACTION_NEXTBESTSOLUTION); parameters[numberParameters-1].setLonghelp ( "To write best solution, just use solution. This prints next best (if exists) \ and then deletes it. \ This will write a primitive solution file to the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'stdout'. The amount of output can be varied using printi!ngOptions or printMask." ); parameters[numberParameters++] = CbcOrClpParam("node!Strategy", "What strategy to use to select nodes", "hybrid", CBC_PARAM_STR_NODESTRATEGY); parameters[numberParameters-1].append("fewest"); parameters[numberParameters-1].append("depth"); parameters[numberParameters-1].append("upfewest"); parameters[numberParameters-1].append("downfewest"); parameters[numberParameters-1].append("updepth"); parameters[numberParameters-1].append("downdepth"); parameters[numberParameters-1].setLonghelp ( "Normally before a solution the code will choose node with fewest infeasibilities. \ You can choose depth as the criterion. You can also say if up or down branch must \ be done first (the up down choice will carry on after solution). \ Default has now been changed to hybrid which is breadth first on small depth nodes then fewest." ); parameters[numberParameters++] = CbcOrClpParam("numberA!nalyze", "Number of analysis iterations", -COIN_INT_MAX, COIN_INT_MAX, CBC_PARAM_INT_NUMBERANALYZE, 0); parameters[numberParameters-1].setLonghelp ( "This says how many iterations to spend at root node analyzing problem. \ This is a first try and will hopefully become more sophisticated." ); #endif parameters[numberParameters++] = CbcOrClpParam("objective!Scale", "Scale factor to apply to objective", -1.0e20, 1.0e20, CLP_PARAM_DBL_OBJSCALE, 1); parameters[numberParameters-1].setLonghelp ( "If the objective function has some very large values, you may wish to scale them\ internally by this amount. It can also be set by autoscale. It is applied after scaling. You are unlikely to need this." ); parameters[numberParameters-1].setDoubleValue(1.0); #endif #ifdef COIN_HAS_CBC #ifdef COIN_HAS_NTY parameters[numberParameters++] = CbcOrClpParam("Orbit!alBranching", "Whether to try orbital branching", "off", CBC_PARAM_STR_ORBITAL); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("strong"); parameters[numberParameters-1].append("force"); parameters[numberParameters-1].setLonghelp ( "This switches on Orbital branching. \ On just adds orbital, strong tries extra fixing in strong branching"); #endif parameters[numberParameters++] = CbcOrClpParam("outDup!licates", "takes duplicate rows etc out of integer model", CLP_PARAM_ACTION_OUTDUPROWS, 7, 0); #endif parameters[numberParameters++] = CbcOrClpParam("output!Format", "Which output format to use", 1, 6, CLP_PARAM_INT_OUTPUTFORMAT); parameters[numberParameters-1].setLonghelp ( "Normally export will be done using normal representation for numbers and two values\ per line. You may want to do just one per line (for grep or suchlike) and you may wish\ to save with absolute accuracy using a coded version of the IEEE value. A value of 2 is normal.\ otherwise odd values gives one value per line, even two. Values 1,2 give normal format, 3,4\ gives greater precision, while 5,6 give IEEE values. When used for exporting a basis 1 does not save \ values, 2 saves values, 3 with greater accuracy and 4 in IEEE." ); #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("para!metrics", "Import data from file and do parametrics", CLP_PARAM_ACTION_PARAMETRICS, 3); parameters[numberParameters-1].setLonghelp ( "This will read a file with parametric data from the given file name \ and then do parametrics. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to '', i.e. it must be set. This can not read from compressed files. \ File is in modified csv format - a line ROWS will be followed by rows data \ while a line COLUMNS will be followed by column data. The last line \ should be ENDATA. The ROWS line must exist and is in the format \ ROWS, inital theta, final theta, interval theta, n where n is 0 to get \ CLPI0062 message at interval or at each change of theta \ and 1 to get CLPI0063 message at each iteration. If interval theta is 0.0 \ or >= final theta then no interval reporting. n may be missed out when it is \ taken as 0. If there is Row data then \ there is a headings line with allowed headings - name, number, \ lower(rhs change), upper(rhs change), rhs(change). Either the lower and upper \ fields should be given or the rhs field. \ The optional COLUMNS line is followed by a headings line with allowed \ headings - name, number, objective(change), lower(change), upper(change). \ Exactly one of name and number must be given for either section and \ missing ones have value 0.0." ); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("passC!uts", "Number of cut passes at root node", -9999999, 9999999, CBC_PARAM_INT_CUTPASS); parameters[numberParameters-1].setLonghelp ( "The default is 100 passes if less than 500 columns, 100 passes (but \ stop if drop small if less than 5000 columns, 20 otherwise" ); parameters[numberParameters++] = CbcOrClpParam("passF!easibilityPump", "How many passes in feasibility pump", 0, 10000, CBC_PARAM_INT_FPUMPITS); parameters[numberParameters-1].setLonghelp ( "This fine tunes Feasibility Pump by doing more or fewer passes." ); parameters[numberParameters-1].setIntValue(20); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("passP!resolve", "How many passes in presolve", -200, 100, CLP_PARAM_INT_PRESOLVEPASS, 1); parameters[numberParameters-1].setLonghelp ( "Normally Presolve does 10 passes but you may want to do less to make it\ more lightweight or do more if improvements are still being made. As Presolve will return\ if nothing is being taken out, you should not normally need to use this fine tuning." ); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("passT!reeCuts", "Number of cut passes in tree", -9999999, 9999999, CBC_PARAM_INT_CUTPASSINTREE); parameters[numberParameters-1].setLonghelp ( "The default is one pass" ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("pertV!alue", "Method of perturbation", -5000, 102, CLP_PARAM_INT_PERTVALUE, 1); parameters[numberParameters++] = CbcOrClpParam("perturb!ation", "Whether to perturb problem", "on", CLP_PARAM_STR_PERTURBATION); parameters[numberParameters-1].append("off"); parameters[numberParameters-1].setLonghelp ( "Perturbation helps to stop cycling, but Clp uses other measures for this.\ However large problems and especially ones with unit elements and unit rhs or costs\ benefit from perturbation. Normally Clp tries to be intelligent, but you can switch this off.\ The Clp library has this off by default. This program has it on by default." ); parameters[numberParameters++] = CbcOrClpParam("PFI", "Whether to use Product Form of Inverse in simplex", "off", CLP_PARAM_STR_PFI, 7, 0); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setLonghelp ( "By default clp uses Forrest-Tomlin L-U update. If you are masochistic you can switch it off." ); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("pivotAndC!omplement", "Whether to try Pivot and Complement heuristic", "off", CBC_PARAM_STR_PIVOTANDCOMPLEMENT); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "stuff needed. \ Doh option does heuristic before preprocessing" ); parameters[numberParameters++] = CbcOrClpParam("pivotAndF!ix", "Whether to try Pivot and Fix heuristic", "off", CBC_PARAM_STR_PIVOTANDFIX); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "stuff needed. \ Doh option does heuristic before preprocessing" ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("plus!Minus", "Tries to make +- 1 matrix", CLP_PARAM_ACTION_PLUSMINUS, 7, 0); parameters[numberParameters-1].setLonghelp ( "Clp will go slightly faster if the matrix can be converted so that the elements are\ not stored and are known to be unit. The main advantage is memory use. Clp may automatically\ see if it can convert the problem so you should not need to use this." ); parameters[numberParameters++] = CbcOrClpParam("pO!ptions", "Dubious print options", 0, COIN_INT_MAX, CLP_PARAM_INT_PRINTOPTIONS, 1); parameters[numberParameters-1].setIntValue(0); parameters[numberParameters-1].setLonghelp ( "If this is > 0 then presolve will give more information and branch and cut will give statistics" ); parameters[numberParameters++] = CbcOrClpParam("preO!pt", "Presolve options", 0, COIN_INT_MAX, CLP_PARAM_INT_PRESOLVEOPTIONS, 0); #endif parameters[numberParameters++] = CbcOrClpParam("presolve", "Whether to presolve problem", "on", CLP_PARAM_STR_PRESOLVE); parameters[numberParameters-1].append("off"); parameters[numberParameters-1].append("more"); parameters[numberParameters-1].append("file"); parameters[numberParameters-1].setLonghelp ( "Presolve analyzes the model to find such things as redundant equations, equations\ which fix some variables, equations which can be transformed into bounds etc etc. For the\ initial solve of any problem this is worth doing unless you know that it will have no effect. \ on will normally do 5 passes while using 'more' will do 10. If the problem is very large you may need \ to write the original to file using 'file'." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("preprocess", "Whether to use integer preprocessing", "off", CBC_PARAM_STR_PREPROCESS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("save"); parameters[numberParameters-1].append("equal"); parameters[numberParameters-1].append("sos"); parameters[numberParameters-1].append("trysos"); parameters[numberParameters-1].append("equalall"); parameters[numberParameters-1].append("strategy"); parameters[numberParameters-1].append("aggregate"); parameters[numberParameters-1].append("forcesos"); parameters[numberParameters-1].setLonghelp ( "This tries to reduce size of model in a similar way to presolve and \ it also tries to strengthen the model - this can be very useful and is worth trying. \ Save option saves on file presolved.mps. equal will turn <= cliques into \ ==. sos will create sos sets if all 0-1 in sets (well one extra is allowed) \ and no overlaps. trysos is same but allows any number extra. equalall will turn all \ valid inequalities into equalities with integer slacks. strategy is as \ on but uses CbcStrategy." ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("preT!olerance", "Tolerance to use in presolve", 1.0e-20, 1.0e12, CLP_PARAM_DBL_PRESOLVETOLERANCE); parameters[numberParameters-1].setLonghelp ( "The default is 1.0e-8 - you may wish to try 1.0e-7 if presolve says the problem is \ infeasible and you have awkward numbers and you are sure the problem is really feasible." ); parameters[numberParameters++] = CbcOrClpParam("primalP!ivot", "Primal pivot choice algorithm", "auto!matic", CLP_PARAM_STR_PRIMALPIVOT, 7, 1); parameters[numberParameters-1].append("exa!ct"); parameters[numberParameters-1].append("dant!zig"); parameters[numberParameters-1].append("part!ial"); parameters[numberParameters-1].append("steep!est"); parameters[numberParameters-1].append("change"); parameters[numberParameters-1].append("sprint"); parameters[numberParameters-1].setLonghelp ( "Clp can use any pivot selection algorithm which the user codes as long as it\ implements the features in the abstract pivot base class. The Dantzig method is implemented\ to show a simple method but its use is deprecated. Exact devex is the method of choice and there\ are two variants which keep all weights updated but only scan a subset each iteration.\ Partial switches this on while change initially does dantzig until the factorization\ becomes denser. This is still a work in progress." ); parameters[numberParameters++] = CbcOrClpParam("primalS!implex", "Do primal simplex algorithm", CLP_PARAM_ACTION_PRIMALSIMPLEX); parameters[numberParameters-1].setLonghelp ( "This command solves the continuous relaxation of the current model using the primal algorithm.\ The default is to use exact devex.\ The time and iterations may be affected by settings such as presolve, scaling, crash\ and also by column selection method, infeasibility weight and dual and primal tolerances." ); #endif parameters[numberParameters++] = CbcOrClpParam("primalT!olerance", "For an optimal solution \ no primal infeasibility may exceed this value", 1.0e-20, 1.0e12, CLP_PARAM_DBL_PRIMALTOLERANCE); parameters[numberParameters-1].setLonghelp ( "Normally the default tolerance is fine, but you may want to increase it a\ bit if a primal run seems to be having a hard time" ); #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("primalW!eight", "Initially algorithm acts as if it \ costs this much to be infeasible", 1.0e-20, 1.0e20, CLP_PARAM_DBL_PRIMALWEIGHT); parameters[numberParameters-1].setLonghelp ( "The primal algorithm in Clp is a single phase algorithm as opposed to a two phase\ algorithm where you first get feasible then optimal. So Clp is minimizing this weight times\ the sum of primal infeasibilities plus the true objective function (in minimization sense).\ Too high a value may mean more iterations, while too low a bound means\ the code may go all the way and then have to increase the weight in order to get feasible.\ OSL had a heuristic to\ adjust bounds, maybe we need that here." ); #endif parameters[numberParameters++] = CbcOrClpParam("printi!ngOptions", "Print options", "normal", CLP_PARAM_STR_INTPRINT, 3); parameters[numberParameters-1].append("integer"); parameters[numberParameters-1].append("special"); parameters[numberParameters-1].append("rows"); parameters[numberParameters-1].append("all"); parameters[numberParameters-1].append("csv"); parameters[numberParameters-1].append("bound!ranging"); parameters[numberParameters-1].append("rhs!ranging"); parameters[numberParameters-1].append("objective!ranging"); parameters[numberParameters-1].append("stats"); parameters[numberParameters-1].append("boundsint"); parameters[numberParameters-1].append("boundsall"); parameters[numberParameters-1].setLonghelp ( "This changes the amount and format of printing a solution:\nnormal - nonzero column variables \n\ integer - nonzero integer column variables\n\ special - in format suitable for OsiRowCutDebugger\n\ rows - nonzero column variables and row activities\n\ all - all column variables and row activities.\n\ \nFor non-integer problems 'integer' and 'special' act like 'normal'. \ Also see printMask for controlling output." ); parameters[numberParameters++] = CbcOrClpParam("printM!ask", "Control printing of solution on a mask", CLP_PARAM_ACTION_PRINTMASK, 3); parameters[numberParameters-1].setLonghelp ( "If set then only those names which match mask are printed in a solution. \ '?' matches any character and '*' matches any set of characters. \ The default is '' i.e. unset so all variables are printed. \ This is only active if model has names." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("prio!rityIn", "Import priorities etc from file", CBC_PARAM_ACTION_PRIORITYIN, 3); parameters[numberParameters-1].setLonghelp ( "This will read a file with priorities from the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to '', i.e. it must be set. This can not read from compressed files. \ File is in csv format with allowed headings - name, number, priority, direction, up, down, solution. Exactly one of\ name and number must be given." ); parameters[numberParameters++] = CbcOrClpParam("probing!Cuts", "Whether to use Probing cuts", "off", CBC_PARAM_STR_PROBINGCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("onglobal"); parameters[numberParameters-1].append("forceonglobal"); parameters[numberParameters-1].append("forceOnBut"); parameters[numberParameters-1].append("forceOnStrong"); parameters[numberParameters-1].append("forceOnButStrong"); parameters[numberParameters-1].append("strongRoot"); parameters[numberParameters-1].setLonghelp ( "This switches on probing cuts (either at root or in entire tree) \ See branchAndCut for information on options. \ but strong options do more probing" ); parameters[numberParameters++] = CbcOrClpParam("proximity!Search", "Whether to do proximity search heuristic", "off", CBC_PARAM_STR_PROXIMITY); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].append("10"); parameters[numberParameters-1].append("100"); parameters[numberParameters-1].append("300"); // but allow numbers after this (returning 1) parameters[numberParameters-1].setFakeKeyWord(1); parameters[numberParameters-1].setLonghelp ( "This switches on a heuristic which looks for a solution close \ to incumbent solution (Fischetti and Monaci). \ See Rounding for meaning of on,both,before. \ Can also set different maxNode settings by plusnnnn (and are 'on'(on==30))." ); parameters[numberParameters++] = CbcOrClpParam("pumpC!utoff", "Fake cutoff for use in feasibility pump", -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_FAKECUTOFF); parameters[numberParameters-1].setDoubleValue(0.0); parameters[numberParameters-1].setLonghelp ( "0.0 off - otherwise add a constraint forcing objective below this value\ in feasibility pump" ); parameters[numberParameters++] = CbcOrClpParam("pumpI!ncrement", "Fake increment for use in feasibility pump", -COIN_DBL_MAX, COIN_DBL_MAX, CBC_PARAM_DBL_FAKEINCREMENT, 1); parameters[numberParameters-1].setDoubleValue(0.0); parameters[numberParameters-1].setLonghelp ( "0.0 off - otherwise use as absolute increment to cutoff \ when solution found in feasibility pump" ); parameters[numberParameters++] = CbcOrClpParam("pumpT!une", "Dubious ideas for feasibility pump", 0, 100000000, CBC_PARAM_INT_FPUMPTUNE); parameters[numberParameters-1].setLonghelp ( "This fine tunes Feasibility Pump \n\ \t>=10000000 use as objective weight switch\n\ \t>=1000000 use as accumulate switch\n\ \t>=1000 use index+1 as number of large loops\n\ \t==100 use objvalue +0.05*fabs(objvalue) as cutoff OR fakeCutoff if set\n\ \t%100 == 10,20 affects how each solve is done\n\ \t1 == fix ints at bounds, 2 fix all integral ints, 3 and continuous at bounds. \ If accumulate is on then after a major pass, variables which have not moved \ are fixed and a small branch and bound is tried." ); parameters[numberParameters-1].setIntValue(0); #endif parameters[numberParameters++] = CbcOrClpParam("quit", "Stops clp execution", CLP_PARAM_ACTION_EXIT); parameters[numberParameters-1].setLonghelp ( "This stops the execution of Clp, end, exit, quit and stop are synonyms" ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("randomC!bcSeed", "Random seed for Cbc", -1, COIN_INT_MAX, CBC_PARAM_INT_RANDOMSEED); parameters[numberParameters-1].setLonghelp ( "This sets a random seed for Cbc \ - 0 says use time of day, -1 is as now." ); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters++] = CbcOrClpParam("randomi!zedRounding", "Whether to try randomized rounding heuristic", "off", CBC_PARAM_STR_RANDROUND); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "stuff needed. \ Doh option does heuristic before preprocessing" ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("randomS!eed", "Random seed for Clp", 0, COIN_INT_MAX, CLP_PARAM_INT_RANDOMSEED); parameters[numberParameters-1].setLonghelp ( "This sets a random seed for Clp \ - 0 says use time of day." ); parameters[numberParameters-1].setIntValue(1234567); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("ratio!Gap", "Stop when gap between best possible and \ best less than this fraction of larger of two", 0.0, 1.0e20, CBC_PARAM_DBL_GAPRATIO); parameters[numberParameters-1].setDoubleValue(0.0); parameters[numberParameters-1].setLonghelp ( "If the gap between best solution and best possible solution is less than this fraction \ of the objective value at the root node then the search will terminate. See 'allowableGap' for a \ way of using absolute value rather than fraction." ); #endif parameters[numberParameters++] = CbcOrClpParam("restoreS!olution", "reads solution from file", CLP_PARAM_ACTION_RESTORESOL); parameters[numberParameters-1].setLonghelp ( "This will read a binary solution file from the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'solution.file'. This reads in a file from saveSolution" ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("readSt!ored", "Import stored cuts from file", CLP_PARAM_ACTION_STOREDFILE, 3, 0); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("reallyO!bjectiveScale", "Scale factor to apply to objective in place", -1.0e20, 1.0e20, CLP_PARAM_DBL_OBJSCALE2, 0); parameters[numberParameters-1].setLonghelp ( "You can set this to -1.0 to test maximization or other to stress code" ); parameters[numberParameters-1].setDoubleValue(1.0); parameters[numberParameters++] = CbcOrClpParam("reallyS!cale", "Scales model in place", CLP_PARAM_ACTION_REALLY_SCALE, 7, 0); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("reduce!AndSplitCuts", "Whether to use Reduce-and-Split cuts", "off", CBC_PARAM_STR_REDSPLITCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].setLonghelp ( "This switches on reduce and split cuts (either at root or in entire tree). \ May be slow \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("reduce2!AndSplitCuts", "Whether to use Reduce-and-Split cuts - style 2", "off", CBC_PARAM_STR_REDSPLIT2CUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("longOn"); parameters[numberParameters-1].append("longRoot"); parameters[numberParameters-1].setLonghelp ( "This switches on reduce and split cuts (either at root or in entire tree) \ This version is by Giacomo Nannicini based on Francois Margot's version \ Standard setting only uses rows in tableau <=256, long uses all \ May be slow \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("reduce2!AndSplitCuts", "Whether to use Reduce-and-Split cuts - style 2", "off", CBC_PARAM_STR_REDSPLIT2CUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("longOn"); parameters[numberParameters-1].append("longRoot"); parameters[numberParameters-1].setLonghelp ( "This switches on reduce and split cuts (either at root or in entire tree) \ This version is by Giacomo Nannicini based on Francois Margot's version \ Standard setting only uses rows in tableau <=256, long uses all \ See branchAndCut for information on options." ); parameters[numberParameters++] = CbcOrClpParam("residual!CapacityCuts", "Whether to use Residual Capacity cuts", "off", CBC_PARAM_STR_RESIDCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].setLonghelp ( "Residual capacity cuts. \ See branchAndCut for information on options." ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("restore!Model", "Restore model from binary file", CLP_PARAM_ACTION_RESTORE, 7, 1); parameters[numberParameters-1].setLonghelp ( "This reads data save by saveModel from the given file. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'default.prob'." ); parameters[numberParameters++] = CbcOrClpParam("reverse", "Reverses sign of objective", CLP_PARAM_ACTION_REVERSE, 7, 0); parameters[numberParameters-1].setLonghelp ( "Useful for testing if maximization works correctly" ); parameters[numberParameters++] = CbcOrClpParam("rhs!Scale", "Scale factor to apply to rhs and bounds", -1.0e20, 1.0e20, CLP_PARAM_DBL_RHSSCALE, 0); parameters[numberParameters-1].setLonghelp ( "If the rhs or bounds have some very large meaningful values, you may wish to scale them\ internally by this amount. It can also be set by autoscale. This should not be needed." ); parameters[numberParameters-1].setDoubleValue(1.0); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("Rens", "Whether to try Relaxation Enforced Neighborhood Search", "off", CBC_PARAM_STR_RENS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].append("200"); parameters[numberParameters-1].append("1000"); parameters[numberParameters-1].append("10000"); parameters[numberParameters-1].append("dj"); parameters[numberParameters-1].append("djbefore"); parameters[numberParameters-1].append("usesolution"); parameters[numberParameters-1].setLonghelp ( "This switches on Relaxation enforced neighborhood Search. \ on just does 50 nodes \ 200 or 1000 does that many nodes. \ Doh option does heuristic before preprocessing" ); parameters[numberParameters++] = CbcOrClpParam("Rins", "Whether to try Relaxed Induced Neighborhood Search", "off", CBC_PARAM_STR_RINS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].append("often"); parameters[numberParameters-1].setLonghelp ( "This switches on Relaxed induced neighborhood Search. \ Doh option does heuristic before preprocessing" ); parameters[numberParameters++] = CbcOrClpParam("round!ingHeuristic", "Whether to use Rounding heuristic", "off", CBC_PARAM_STR_ROUNDING); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].setLonghelp ( "This switches on a simple (but effective) rounding heuristic at each node of tree. \ On means do in solve i.e. after preprocessing, \ Before means do if doHeuristics used, off otherwise, \ and both means do if doHeuristics and in solve." ); #endif parameters[numberParameters++] = CbcOrClpParam("saveM!odel", "Save model to binary file", CLP_PARAM_ACTION_SAVE, 7, 1); parameters[numberParameters-1].setLonghelp ( "This will save the problem to the given file name for future use\ by restoreModel. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'default.prob'." ); parameters[numberParameters++] = CbcOrClpParam("saveS!olution", "saves solution to file", CLP_PARAM_ACTION_SAVESOL); parameters[numberParameters-1].setLonghelp ( "This will write a binary solution file to the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'solution.file'. To read the file use fread(int) twice to pick up number of rows \ and columns, then fread(double) to pick up objective value, then pick up row activities, row duals, column \ activities and reduced costs - see bottom of CbcOrClpParam.cpp for code that reads or writes file. \ If name contains '_fix_read_' then does not write but reads and will fix all variables" ); parameters[numberParameters++] = CbcOrClpParam("scal!ing", "Whether to scale problem", "off", CLP_PARAM_STR_SCALING); parameters[numberParameters-1].append("equi!librium"); parameters[numberParameters-1].append("geo!metric"); parameters[numberParameters-1].append("auto!matic"); parameters[numberParameters-1].append("dynamic"); parameters[numberParameters-1].append("rows!only"); parameters[numberParameters-1].setLonghelp ( "Scaling can help in solving problems which might otherwise fail because of lack of\ accuracy. It can also reduce the number of iterations. It is not applied if the range\ of elements is small. When unscaled it is possible that there may be small primal and/or\ infeasibilities." ); parameters[numberParameters-1].setCurrentOption(3); // say auto #ifndef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("sec!onds", "Maximum seconds", -1.0, 1.0e12, CLP_PARAM_DBL_TIMELIMIT); parameters[numberParameters-1].setLonghelp ( "After this many seconds clp will act as if maximum iterations had been reached \ (if value >=0)." ); #else parameters[numberParameters++] = CbcOrClpParam("sec!onds", "maximum seconds", -1.0, 1.0e12, CBC_PARAM_DBL_TIMELIMIT_BAB); parameters[numberParameters-1].setLonghelp ( "After this many seconds coin solver will act as if maximum nodes had been reached." ); #endif parameters[numberParameters++] = CbcOrClpParam("sleep", "for debug", CLP_PARAM_ACTION_DUMMY, 7, 0); parameters[numberParameters-1].setLonghelp ( "If passed to solver fom ampl, then ampl will wait so that you can copy .nl file for debug." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("slow!cutpasses", "Maximum number of tries for slower cuts", -1, COIN_INT_MAX, CBC_PARAM_INT_MAX_SLOW_CUTS); parameters[numberParameters-1].setLonghelp ( "Some cut generators are fairly slow - this limits the number of times they are tried." ); parameters[numberParameters-1].setIntValue(10); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("slp!Value", "Number of slp passes before primal", -50000, 50000, CLP_PARAM_INT_SLPVALUE, 1); parameters[numberParameters-1].setLonghelp ( "If you are solving a quadratic problem using primal then it may be helpful to do some \ sequential Lps to get a good approximate solution." ); #if CLP_MULTIPLE_FACTORIZATIONS > 0 parameters[numberParameters++] = CbcOrClpParam("small!Factorization", "Whether to use small factorization", -1, 10000, CBC_PARAM_INT_SMALLFACT, 1); parameters[numberParameters-1].setLonghelp ( "If processed problem <= this use small factorization" ); parameters[numberParameters-1].setIntValue(-1); #endif #endif parameters[numberParameters++] = CbcOrClpParam("solu!tion", "Prints solution to file", CLP_PARAM_ACTION_SOLUTION); parameters[numberParameters-1].setLonghelp ( "This will write a primitive solution file to the given file name. It will use the default\ directory given by 'directory'. A name of '$' will use the previous value for the name. This\ is initialized to 'stdout'. The amount of output can be varied using printi!ngOptions or printMask." ); #ifdef COIN_HAS_CLP #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("solv!e", "Solve problem", CBC_PARAM_ACTION_BAB); parameters[numberParameters-1].setLonghelp ( "If there are no integer variables then this just solves LP. If there are integer variables \ this does branch and cut." ); parameters[numberParameters++] = CbcOrClpParam("sos!Options", "Whether to use SOS from AMPL", "off", CBC_PARAM_STR_SOS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setCurrentOption("on"); parameters[numberParameters-1].setLonghelp ( "Normally if AMPL says there are SOS variables they should be used, but sometime sthey should\ be turned off - this does so." ); parameters[numberParameters++] = CbcOrClpParam("slog!Level", "Level of detail in (LP) Solver output", -1, 63, CLP_PARAM_INT_SOLVERLOGLEVEL); parameters[numberParameters-1].setLonghelp ( "If 0 then there should be no output in normal circumstances. 1 is probably the best\ value for most uses, while 2 and 3 give more information. This parameter is only used inside MIP - for Clp use 'log'" ); #else // allow solve as synonym for possible dual parameters[numberParameters++] = CbcOrClpParam("solv!e", "Solve problem using dual simplex (probably)", CLP_PARAM_ACTION_EITHERSIMPLEX); parameters[numberParameters-1].setLonghelp ( "Just so can use solve for clp as well as in cbc" ); #endif #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("spars!eFactor", "Whether factorization treated as sparse", "on", CLP_PARAM_STR_SPARSEFACTOR, 7, 0); parameters[numberParameters-1].append("off"); parameters[numberParameters++] = CbcOrClpParam("special!Options", "Dubious options for Simplex - see ClpSimplex.hpp", 0, COIN_INT_MAX, CLP_PARAM_INT_SPECIALOPTIONS, 0); parameters[numberParameters++] = CbcOrClpParam("sprint!Crash", "Whether to try sprint crash", -1, 5000000, CLP_PARAM_INT_SPRINT); parameters[numberParameters-1].setLonghelp ( "For long and thin problems this program may solve a series of small problems\ created by taking a subset of the columns. I introduced the idea as 'Sprint' after\ an LP code of that name of the 60's which tried the same tactic (not totally successfully).\ Cplex calls it 'sifting'. -1 is automatic choice, 0 is off, n is number of passes" ); parameters[numberParameters++] = CbcOrClpParam("stat!istics", "Print some statistics", CLP_PARAM_ACTION_STATISTICS); parameters[numberParameters-1].setLonghelp ( "This command prints some statistics for the current model.\ If log level >1 then more is printed.\ These are for presolved model if presolve on (and unscaled)." ); #endif parameters[numberParameters++] = CbcOrClpParam("stop", "Stops clp execution", CLP_PARAM_ACTION_EXIT); parameters[numberParameters-1].setLonghelp ( "This stops the execution of Clp, end, exit, quit and stop are synonyms" ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("strat!egy", "Switches on groups of features", 0, 2, CBC_PARAM_INT_STRATEGY); parameters[numberParameters-1].setLonghelp ( "This turns on newer features. \ Use 0 for easy problems, 1 is default, 2 is aggressive. \ 1 uses Gomory cuts using tolerance of 0.01 at root, \ does a possible restart after 100 nodes if can fix many \ and activates a diving and RINS heuristic and makes feasibility pump \ more aggressive. \ This does not apply to unit tests (where 'experiment' may have similar effects)." ); parameters[numberParameters-1].setIntValue(1); #ifdef CBC_KEEP_DEPRECATED parameters[numberParameters++] = CbcOrClpParam("strengthen", "Create strengthened problem", CBC_PARAM_ACTION_STRENGTHEN, 3); parameters[numberParameters-1].setLonghelp ( "This creates a new problem by applying the root node cuts. All tight constraints \ will be in resulting problem" ); #endif parameters[numberParameters++] = CbcOrClpParam("strong!Branching", "Number of variables to look at in strong branching", 0, COIN_INT_MAX, CBC_PARAM_INT_STRONGBRANCHING); parameters[numberParameters-1].setLonghelp ( "In order to decide which variable to branch on, the code will choose up to this number \ of unsatisfied variables to do mini up and down branches on. Then the most effective one is chosen. \ If a variable is branched on many times then the previous average up and down costs may be used - \ see number before trust." ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("subs!titution", "How long a column to substitute for in presolve", 0, 10000, CLP_PARAM_INT_SUBSTITUTION, 0); parameters[numberParameters-1].setLonghelp ( "Normally Presolve gets rid of 'free' variables when there are no more than 3 \ variables in column. If you increase this the number of rows may decrease but number of \ elements may increase." ); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("testO!si", "Test OsiObject stuff", -1, COIN_INT_MAX, CBC_PARAM_INT_TESTOSI, 0); #endif #ifdef CBC_THREAD parameters[numberParameters++] = CbcOrClpParam("thread!s", "Number of threads to try and use", -100, 100000, CBC_PARAM_INT_THREADS, 1); parameters[numberParameters-1].setLonghelp ( "To use multiple threads, set threads to number wanted. It may be better \ to use one or two more than number of cpus available. If 100+n then n threads and \ search is repeatable (maybe be somewhat slower), \ if 200+n use threads for root cuts, 400+n threads used in sub-trees." ); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("tighten!Factor", "Tighten bounds using this times largest \ activity at continuous solution", 1.0e-3, 1.0e20, CBC_PARAM_DBL_TIGHTENFACTOR, 0); parameters[numberParameters-1].setLonghelp ( "This sleazy trick can help on some problems." ); #endif #ifdef COIN_HAS_CLP parameters[numberParameters++] = CbcOrClpParam("tightLP", "Poor person's preSolve for now", CLP_PARAM_ACTION_TIGHTEN, 7, 0); #endif parameters[numberParameters++] = CbcOrClpParam("timeM!ode", "Whether to use CPU or elapsed time", "cpu", CLP_PARAM_STR_TIME_MODE); parameters[numberParameters-1].append("elapsed"); parameters[numberParameters-1].setLonghelp ( "cpu uses CPU time for stopping, while elapsed uses elapsed time. \ (On Windows, elapsed time is always used)." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("trust!PseudoCosts", "Number of branches before we trust pseudocosts", -3, 2000000000, CBC_PARAM_INT_NUMBERBEFORE); parameters[numberParameters-1].setLonghelp ( "Using strong branching computes pseudo-costs. After this many times for a variable we just \ trust the pseudo costs and do not do any more strong branching." ); #endif #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("tune!PreProcess", "Dubious tuning parameters", 0, 2000000000, CLP_PARAM_INT_PROCESSTUNE, 1); parameters[numberParameters-1].setLonghelp ( "Format aabbcccc - \n If aa then this is number of major passes (i.e. with presolve) \n \ If bb and bb>0 then this is number of minor passes (if unset or 0 then 10) \n \ cccc is bit set \n 0 - 1 Heavy probing \n 1 - 2 Make variables integer if possible (if obj value)\n \ 2 - 4 As above but even if zero objective value\n \ 7 - 128 Try and create cliques\n 8 - 256 If all +1 try hard for dominated rows\n \ 10 - 1024 Use a larger feasibility tolerance in presolve\n \ 11 - 2048 Try probing before creating cliques" ); parameters[numberParameters++] = CbcOrClpParam("two!MirCuts", "Whether to use Two phase Mixed Integer Rounding cuts", "off", CBC_PARAM_STR_TWOMIRCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("onglobal"); parameters[numberParameters-1].append("forceandglobal"); parameters[numberParameters-1].append("forceLongOn"); parameters[numberParameters-1].setLonghelp ( "This switches on two phase mixed integer rounding cuts (either at root or in entire tree) \ See branchAndCut for information on options." ); #endif parameters[numberParameters++] = CbcOrClpParam("unitTest", "Do unit test", CLP_PARAM_ACTION_UNITTEST, 3, 1); parameters[numberParameters-1].setLonghelp ( "This exercises the unit test for clp" ); parameters[numberParameters++] = CbcOrClpParam("userClp", "Hand coded Clp stuff", CLP_PARAM_ACTION_USERCLP, 0, 0); parameters[numberParameters-1].setLonghelp ( "There are times e.g. when using AMPL interface when you may wish to do something unusual. \ Look for USERCLP in main driver and modify sample code." ); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("userCbc", "Hand coded Cbc stuff", CBC_PARAM_ACTION_USERCBC, 0, 0); parameters[numberParameters-1].setLonghelp ( "There are times e.g. when using AMPL interface when you may wish to do something unusual. \ Look for USERCBC in main driver and modify sample code. \ It is possible you can get same effect by using example driver4.cpp." ); parameters[numberParameters++] = CbcOrClpParam("Vnd!VariableNeighborhoodSearch", "Whether to try Variable Neighborhood Search", "off", CBC_PARAM_STR_VND); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("both"); parameters[numberParameters-1].append("before"); parameters[numberParameters-1].append("intree"); parameters[numberParameters-1].setLonghelp ( "This switches on variable neighborhood Search. \ Doh option does heuristic before preprocessing" ); #endif parameters[numberParameters++] = CbcOrClpParam("vector", "Whether to use vector? Form of matrix in simplex", "off", CLP_PARAM_STR_VECTOR, 7, 0); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].setLonghelp ( "If this is on ClpPackedMatrix uses extra column copy in odd format." ); parameters[numberParameters++] = CbcOrClpParam("verbose", "Switches on longer help on single ?", 0, 31, CLP_PARAM_INT_VERBOSE, 0); parameters[numberParameters-1].setLonghelp ( "Set to 1 to get short help with ? list, 2 to get long help, 3 for both. (add 4 to just get ampl ones)." ); parameters[numberParameters-1].setIntValue(0); #ifdef COIN_HAS_CBC parameters[numberParameters++] = CbcOrClpParam("vub!heuristic", "Type of vub heuristic", -2, 20, CBC_PARAM_INT_VUBTRY, 0); parameters[numberParameters-1].setLonghelp ( "If set will try and fix some integer variables" ); parameters[numberParameters-1].setIntValue(-1); parameters[numberParameters++] = CbcOrClpParam("zero!HalfCuts", "Whether to use zero half cuts", "off", CBC_PARAM_STR_ZEROHALFCUTS); parameters[numberParameters-1].append("on"); parameters[numberParameters-1].append("root"); parameters[numberParameters-1].append("ifmove"); parameters[numberParameters-1].append("forceOn"); parameters[numberParameters-1].append("onglobal"); parameters[numberParameters-1].setLonghelp ( "This switches on zero-half cuts (either at root or in entire tree) \ See branchAndCut for information on options. This implementation was written by \ Alberto Caprara." ); #endif parameters[numberParameters++] = CbcOrClpParam("zeroT!olerance", "Kill all coefficients \ whose absolute value is less than this value", 1.0e-100, 1.0e-5, CLP_PARAM_DBL_ZEROTOLERANCE); parameters[numberParameters-1].setLonghelp ( "This applies to reading mps files (and also lp files \ if KILL_ZERO_READLP defined)" ); parameters[numberParameters-1].setDoubleValue(1.0e-20); assert(numberParameters < CBCMAXPARAMETERS); } // Given a parameter type - returns its number in list int whichParam (CbcOrClpParameterType name, int numberParameters, CbcOrClpParam *const parameters) { int i; for (i = 0; i < numberParameters; i++) { if (parameters[i].type() == name) break; } assert (i < numberParameters); return i; } #ifdef COIN_HAS_CLP /* Restore a solution from file. mode 0 normal, 1 swap rows and columns and primal and dual if 2 set then also change signs */ void restoreSolution(ClpSimplex * lpSolver, std::string fileName, int mode) { FILE * fp = fopen(fileName.c_str(), "rb"); if (fp) { int numberRows = lpSolver->numberRows(); int numberColumns = lpSolver->numberColumns(); int numberRowsFile; int numberColumnsFile; double objectiveValue; size_t nRead; nRead = fread(&numberRowsFile, sizeof(int), 1, fp); if (nRead != 1) throw("Error in fread"); nRead = fread(&numberColumnsFile, sizeof(int), 1, fp); if (nRead != 1) throw("Error in fread"); nRead = fread(&objectiveValue, sizeof(double), 1, fp); if (nRead != 1) throw("Error in fread"); double * dualRowSolution = lpSolver->dualRowSolution(); double * primalRowSolution = lpSolver->primalRowSolution(); double * dualColumnSolution = lpSolver->dualColumnSolution(); double * primalColumnSolution = lpSolver->primalColumnSolution(); if (mode) { // swap int k = numberRows; numberRows = numberColumns; numberColumns = k; double * temp; temp = dualRowSolution; dualRowSolution = primalColumnSolution; primalColumnSolution = temp; temp = dualColumnSolution; dualColumnSolution = primalRowSolution; primalRowSolution = temp; } if (numberRows > numberRowsFile || numberColumns > numberColumnsFile) { std::cout << "Mismatch on rows and/or columns - giving up" << std::endl; } else { lpSolver->setObjectiveValue(objectiveValue); if (numberRows == numberRowsFile && numberColumns == numberColumnsFile) { nRead = fread(primalRowSolution, sizeof(double), numberRows, fp); if (nRead != static_cast(numberRows)) throw("Error in fread"); nRead = fread(dualRowSolution, sizeof(double), numberRows, fp); if (nRead != static_cast(numberRows)) throw("Error in fread"); nRead = fread(primalColumnSolution, sizeof(double), numberColumns, fp); if (nRead != static_cast(numberColumns)) throw("Error in fread"); nRead = fread(dualColumnSolution, sizeof(double), numberColumns, fp); if (nRead != static_cast(numberColumns)) throw("Error in fread"); } else { std::cout << "Mismatch on rows and/or columns - truncating" << std::endl; double * temp = new double [CoinMax(numberRowsFile, numberColumnsFile)]; nRead = fread(temp, sizeof(double), numberRowsFile, fp); if (nRead != static_cast(numberRowsFile)) throw("Error in fread"); CoinMemcpyN(temp, numberRows, primalRowSolution); nRead = fread(temp, sizeof(double), numberRowsFile, fp); if (nRead != static_cast(numberRowsFile)) throw("Error in fread"); CoinMemcpyN(temp, numberRows, dualRowSolution); nRead = fread(temp, sizeof(double), numberColumnsFile, fp); if (nRead != static_cast(numberColumnsFile)) throw("Error in fread"); CoinMemcpyN(temp, numberColumns, primalColumnSolution); nRead = fread(temp, sizeof(double), numberColumnsFile, fp); if (nRead != static_cast(numberColumnsFile)) throw("Error in fread"); CoinMemcpyN(temp, numberColumns, dualColumnSolution); delete [] temp; } if (mode == 3) { int i; for (i = 0; i < numberRows; i++) { primalRowSolution[i] = -primalRowSolution[i]; dualRowSolution[i] = -dualRowSolution[i]; } for (i = 0; i < numberColumns; i++) { primalColumnSolution[i] = -primalColumnSolution[i]; dualColumnSolution[i] = -dualColumnSolution[i]; } } } fclose(fp); } else { std::cout << "Unable to open file " << fileName << std::endl; } } // Dump a solution to file void saveSolution(const ClpSimplex * lpSolver, std::string fileName) { if (strstr(fileName.c_str(), "_fix_read_")) { FILE * fp = fopen(fileName.c_str(), "rb"); if (fp) { ClpSimplex * solver = const_cast(lpSolver); restoreSolution(solver, fileName, 0); // fix all int logLevel = solver->logLevel(); int iColumn; int numberColumns = solver->numberColumns(); double * primalColumnSolution = solver->primalColumnSolution(); double * columnLower = solver->columnLower(); double * columnUpper = solver->columnUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = primalColumnSolution[iColumn]; if (value > columnUpper[iColumn]) { if (value > columnUpper[iColumn] + 1.0e-6 && logLevel > 1) printf("%d value of %g - bounds %g %g\n", iColumn, value, columnLower[iColumn], columnUpper[iColumn]); value = columnUpper[iColumn]; } else if (value < columnLower[iColumn]) { if (value < columnLower[iColumn] - 1.0e-6 && logLevel > 1) printf("%d value of %g - bounds %g %g\n", iColumn, value, columnLower[iColumn], columnUpper[iColumn]); value = columnLower[iColumn]; } columnLower[iColumn] = value; columnUpper[iColumn] = value; } return; } } FILE * fp = fopen(fileName.c_str(), "wb"); if (fp) { int numberRows = lpSolver->numberRows(); int numberColumns = lpSolver->numberColumns(); double objectiveValue = lpSolver->objectiveValue(); size_t nWrite; nWrite = fwrite(&numberRows, sizeof(int), 1, fp); if (nWrite != 1) throw("Error in fwrite"); nWrite = fwrite(&numberColumns, sizeof(int), 1, fp); if (nWrite != 1) throw("Error in fwrite"); nWrite = fwrite(&objectiveValue, sizeof(double), 1, fp); if (nWrite != 1) throw("Error in fwrite"); double * dualRowSolution = lpSolver->dualRowSolution(); double * primalRowSolution = lpSolver->primalRowSolution(); nWrite = fwrite(primalRowSolution, sizeof(double), numberRows, fp); if (nWrite != static_cast(numberRows)) throw("Error in fwrite"); nWrite = fwrite(dualRowSolution, sizeof(double), numberRows, fp); if (nWrite != static_cast(numberRows)) throw("Error in fwrite"); double * dualColumnSolution = lpSolver->dualColumnSolution(); double * primalColumnSolution = lpSolver->primalColumnSolution(); nWrite = fwrite(primalColumnSolution, sizeof(double), numberColumns, fp); if (nWrite != static_cast(numberColumns)) throw("Error in fwrite"); nWrite = fwrite(dualColumnSolution, sizeof(double), numberColumns, fp); if (nWrite != static_cast(numberColumns)) throw("Error in fwrite"); fclose(fp); } else { std::cout << "Unable to open file " << fileName << std::endl; } } #endif CoinMP-1.8.3/Clp/src/ClpNetworkMatrix.hpp0000644000175000017500000002312411510657452016617 0ustar renerene/* $Id: ClpNetworkMatrix.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpNetworkMatrix_H #define ClpNetworkMatrix_H #include "CoinPragma.hpp" #include "ClpMatrixBase.hpp" /** This implements a simple network matrix as derived from ClpMatrixBase. If you want more sophisticated version then you could inherit from this. Also you might want to allow networks with gain */ class ClpNetworkMatrix : public ClpMatrixBase { public: /**@name Useful methods */ //@{ /// Return a complete CoinPackedMatrix virtual CoinPackedMatrix * getPackedMatrix() const; /** Whether the packed matrix is column major ordered or not. */ virtual bool isColOrdered() const { return true; } /** Number of entries in the packed matrix. */ virtual CoinBigIndex getNumElements() const { return 2 * numberColumns_; } /** Number of columns. */ virtual int getNumCols() const { return numberColumns_; } /** Number of rows. */ virtual int getNumRows() const { return numberRows_; } /** A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const double * getElements() const; /** A vector containing the minor indices of the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const int * getIndices() const { return indices_; } virtual const CoinBigIndex * getVectorStarts() const; /** The lengths of the major-dimension vectors. */ virtual const int * getVectorLengths() const; /** Delete the columns whose indices are listed in indDel. */ virtual void deleteCols(const int numDel, const int * indDel); /** Delete the rows whose indices are listed in indDel. */ virtual void deleteRows(const int numDel, const int * indDel); /// Append Columns virtual void appendCols(int number, const CoinPackedVectorBase * const * columns); /// Append Rows virtual void appendRows(int number, const CoinPackedVectorBase * const * rows); #ifndef SLIM_CLP /** Append a set of rows/columns to the end of the matrix. Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns */ virtual int appendMatrix(int number, int type, const CoinBigIndex * starts, const int * index, const double * element, int numberOther = -1); #endif /** Returns a new matrix in reverse order without gaps */ virtual ClpMatrixBase * reverseOrderedCopy() const; /// Returns number of elements in column part of basis virtual CoinBigIndex countBasis( const int * whichColumn, int & numberColumnBasic); /// Fills in column part of basis virtual void fillBasis(ClpSimplex * model, const int * whichColumn, int & numberColumnBasic, int * row, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * element); /** Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector */ virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const; /** Returns largest and smallest elements of both signs. Largest refers to largest absolute value. */ virtual void rangeOfElements(double & smallestNegative, double & largestNegative, double & smallestPositive, double & largestPositive); /** Unpacks a column into an CoinIndexedvector */ virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray, int column) const ; /** Unpacks a column into an CoinIndexedvector ** in packed format Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ virtual void unpackPacked(ClpSimplex * model, CoinIndexedVector * rowArray, int column) const; /** Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray, int column, double multiplier) const ; /** Adds multiple of a column into an array */ virtual void add(const ClpSimplex * model, double * array, int column, double multiplier) const; /// Allow any parts of a created CoinMatrix to be deleted virtual void releasePackedMatrix() const ; /// Says whether it can do partial pricing virtual bool canDoPartialPricing() const; /// Partial pricing virtual void partialPricing(ClpSimplex * model, double start, double end, int & bestSequence, int & numberWanted); //@} /**@name Matrix times vector methods */ //@{ /** Return y + A * scalar *x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ virtual void times(double scalar, const double * x, double * y) const; /// And for scaling virtual void times(double scalar, const double * x, double * y, const double * rowScale, const double * columnScale) const; /** Return y + x * scalar * A in y. @pre x must be of size numRows() @pre y must be of size numColumns() */ virtual void transposeTimes(double scalar, const double * x, double * y) const; /// And for scaling virtual void transposeTimes(double scalar, const double * x, double * y, const double * rowScale, const double * columnScale, double * spare = NULL) const; /** Return x * scalar * A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex */ virtual void transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x *A in z but just for indices in y. Note - z always packed mode */ virtual void subsetTransposeTimes(const ClpSimplex * model, const CoinIndexedVector * x, const CoinIndexedVector * y, CoinIndexedVector * z) const; //@} /**@name Other */ //@{ /// Return true if really network, false if has slacks inline bool trueNetwork() const { return trueNetwork_; } //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpNetworkMatrix(); /** Constructor from two arrays */ ClpNetworkMatrix(int numberColumns, const int * head, const int * tail); /** Destructor */ virtual ~ClpNetworkMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpNetworkMatrix(const ClpNetworkMatrix&); /** The copy constructor from an CoinNetworkMatrix. */ ClpNetworkMatrix(const CoinPackedMatrix&); ClpNetworkMatrix& operator=(const ClpNetworkMatrix&); /// Clone virtual ClpMatrixBase * clone() const ; /** Subset constructor (without gaps). Duplicates are allowed and order is as given */ ClpNetworkMatrix (const ClpNetworkMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); /** Subset clone (without gaps). Duplicates are allowed and order is as given */ virtual ClpMatrixBase * subsetClone ( int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const ; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// For fake CoinPackedMatrix mutable CoinPackedMatrix * matrix_; mutable int * lengths_; /// Data -1, then +1 rows in pairs (row==-1 if one entry) int * indices_; /// Number of rows int numberRows_; /// Number of columns int numberColumns_; /// True if all entries have two elements bool trueNetwork_; //@} }; #endif CoinMP-1.8.3/Clp/src/AbcSimplex.hpp0000644000175000017500000013073412432624666015404 0ustar renerene/* $Id: AbcSimplex.hpp 2070 2014-11-18 11:12:54Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef AbcSimplex_H #define AbcSimplex_H #include #include #include "ClpModel.hpp" #include "ClpMatrixBase.hpp" #include "CoinIndexedVector.hpp" #include "AbcCommon.hpp" class AbcSimplex; #include "ClpSolve.hpp" #include "CoinAbcCommon.hpp" #include "ClpSimplex.hpp" class AbcDualRowPivot; class AbcPrimalColumnPivot; class AbcSimplexFactorization; class AbcNonLinearCost; class OsiAbcSolverInterface; class CoinWarmStartBasis; class ClpDisasterHandler; class AbcSimplexProgress; class AbcMatrix; class AbcTolerancesEtc; /** This solves LPs using the simplex method It inherits from ClpModel and all its arrays are created at algorithm time. Originally I tried to work with model arrays but for simplicity of coding I changed to single arrays with structural variables then row variables. Some coding is still based on old style and needs cleaning up. For a description of algorithms: for dual see AbcSimplexDual.hpp and at top of AbcSimplexDual.cpp for primal see AbcSimplexPrimal.hpp and at top of AbcSimplexPrimal.cpp There is an algorithm data member. + for primal variations and - for dual variations */ #define PAN #if ABC_NORMAL_DEBUG>0 #define PRINT_PAN 1 #endif #define TRY_ABC_GUS #define HEAVY_PERTURBATION 57 #if ABC_PARALLEL==1 // Use pthreads #include #endif class AbcSimplex : public ClpSimplex { friend void AbcSimplexUnitTest(const std::string & mpsDir); public: /** enums for status of various sorts. ClpModel order (and warmstart) is isFree = 0x00, basic = 0x01, atUpperBound = 0x02, atLowerBound = 0x03, isFixed means fixed at lower bound and out of basis */ enum Status { atLowerBound = 0x00, // so we can use bottom two bits to sort and swap signs atUpperBound = 0x01, isFree = 0x04, superBasic = 0x05, basic = 0x06, isFixed = 0x07 }; // For Dual enum FakeBound { noFake = 0x00, lowerFake = 0x01, upperFake = 0x02, bothFake = 0x03 }; /**@name Constructors and destructor and copy */ //@{ /// Default constructor AbcSimplex (bool emptyMessages = false ); /** Copy constructor. */ AbcSimplex(const AbcSimplex & rhs); /** Copy constructor from model. */ AbcSimplex(const ClpSimplex & rhs); /** Subproblem constructor. A subset of whole model is created from the row and column lists given. The new order is given by list order and duplicates are allowed. Name and integer information can be dropped Can optionally modify rhs to take into account variables NOT in list in this case duplicates are not allowed (also see getbackSolution) */ AbcSimplex (const ClpSimplex * wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns, bool dropNames = true, bool dropIntegers = true, bool fixOthers = false); /** Subproblem constructor. A subset of whole model is created from the row and column lists given. The new order is given by list order and duplicates are allowed. Name and integer information can be dropped Can optionally modify rhs to take into account variables NOT in list in this case duplicates are not allowed (also see getbackSolution) */ AbcSimplex (const AbcSimplex * wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns, bool dropNames = true, bool dropIntegers = true, bool fixOthers = false); /** This constructor modifies original AbcSimplex and stores original stuff in created AbcSimplex. It is only to be used in conjunction with originalModel */ AbcSimplex (AbcSimplex * wholeModel, int numberColumns, const int * whichColumns); /** This copies back stuff from miniModel and then deletes miniModel. Only to be used with mini constructor */ void originalModel(AbcSimplex * miniModel); /** This constructor copies from ClpSimplex */ AbcSimplex (const ClpSimplex * clpSimplex); /// Put back solution into ClpSimplex void putBackSolution(ClpSimplex * simplex); /** Array persistence flag If 0 then as now (delete/new) 1 then only do arrays if bigger needed 2 as 1 but give a bit extra if bigger needed */ //void setPersistenceFlag(int value); /// Save a copy of model with certain state - normally without cuts void makeBaseModel(); /// Switch off base model void deleteBaseModel(); /// See if we have base model inline AbcSimplex * baseModel() const { return abcBaseModel_; } /** Reset to base model (just size and arrays needed) If model NULL use internal copy */ void setToBaseModel(AbcSimplex * model = NULL); /// Assignment operator. This copies the data AbcSimplex & operator=(const AbcSimplex & rhs); /// Destructor ~AbcSimplex ( ); //@} /**@name Functions most useful to user */ //@{ /** Dual algorithm - see AbcSimplexDual.hpp for method. */ int dual(); int doAbcDual(); /** Primal algorithm - see AbcSimplexPrimal.hpp for method. */ int primal(int ifValuesPass); int doAbcPrimal(int ifValuesPass); /// Returns a basis (to be deleted by user) CoinWarmStartBasis * getBasis() const; /// Passes in factorization void setFactorization( AbcSimplexFactorization & factorization); /// Swaps factorization AbcSimplexFactorization * swapFactorization( AbcSimplexFactorization * factorization); /// Gets clean and emptyish factorization AbcSimplexFactorization * getEmptyFactorization(); /** Tightens primal bounds to make dual faster. Unless fixed or doTight>10, bounds are slightly looser than they could be. This is to make dual go faster and is probably not needed with a presolve. Returns non-zero if problem infeasible. Fudge for branch and bound - put bounds on columns of factor * largest value (at continuous) - should improve stability in branch and bound on infeasible branches (0.0 is off) */ int tightenPrimalBounds(); /// Sets row pivot choice algorithm in dual void setDualRowPivotAlgorithm(AbcDualRowPivot & choice); /// Sets column pivot choice algorithm in primal void setPrimalColumnPivotAlgorithm(AbcPrimalColumnPivot & choice); //@} /// If user left factorization frequency then compute void defaultFactorizationFrequency(); //@} /**@name most useful gets and sets */ //@{ /// factorization inline AbcSimplexFactorization * factorization() const { return reinterpret_cast(abcFactorization_); } #ifdef EARLY_FACTORIZE /// Early factorization inline AbcSimplexFactorization * earlyFactorization() const { return reinterpret_cast(abcEarlyFactorization_); } #endif /// Factorization frequency int factorizationFrequency() const; void setFactorizationFrequency(int value); /// Maximum rows inline int maximumAbcNumberRows() const { return maximumAbcNumberRows_;} /// Maximum Total inline int maximumNumberTotal() const { return maximumNumberTotal_;} inline int maximumTotal() const { return maximumNumberTotal_;} /// Return true if the objective limit test can be relied upon bool isObjectiveLimitTestValid() const ; /// Number of variables (includes spare rows) inline int numberTotal() const { return numberTotal_;} /// Number of variables without fixed to zero (includes spare rows) inline int numberTotalWithoutFixed() const { return numberTotalWithoutFixed_;} /// Useful arrays (0,1,2,3,4,5,6,7) inline CoinPartitionedVector * usefulArray(int index) { return & usefulArray_[index]; } inline CoinPartitionedVector * usefulArray(int index) const { return const_cast(&usefulArray_[index]); } //@} /******************** End of most useful part **************/ /**@name Functions less likely to be useful to casual user */ //@{ /** Given an existing factorization computes and checks primal and dual solutions. Uses current problem arrays for bounds. Returns feasibility states */ int getSolution (); /// Sets objectiveValue_ from rawObjectiveValue_ void setClpSimplexObjectiveValue(); /** Sets dual values pass djs using unscaled duals type 1 - values pass type 2 - just use as infeasibility weights type 3 - as 2 but crash */ void setupDualValuesPass(const double * fakeDuals, const double * fakePrimals, int type); /// Gets objective value with all offsets but as for minimization inline double minimizationObjectiveValue() const { return objectiveValue_-dblParam_[ClpObjOffset];} /// Current dualTolerance (will end up as dualTolerance_) inline double currentDualTolerance() const { return currentDualTolerance_;} inline void setCurrentDualTolerance(double value) { currentDualTolerance_ = value; } /// Return pointer to details of costs inline AbcNonLinearCost * abcNonLinearCost() const { return abcNonLinearCost_; } /// Perturbation (fixed) - is just scaled random numbers double * perturbationSaved() const { return perturbationSaved_;} /// Acceptable pivot for this iteration inline double acceptablePivot() const { return acceptablePivot_;} /// Set to 1 if no free or super basic inline int ordinaryVariables() const { return ordinaryVariables_;} /// Number of ordinary (lo/up) in tableau row inline int numberOrdinary() const { return numberOrdinary_;} /// Set number of ordinary (lo/up) in tableau row inline void setNumberOrdinary(int number) { numberOrdinary_=number;} /// Current dualBound (will end up as dualBound_) inline double currentDualBound() const { return currentDualBound_;} /// dual row pivot choice inline AbcDualRowPivot * dualRowPivot() const { return abcDualRowPivot_; } /// primal column pivot choice inline AbcPrimalColumnPivot * primalColumnPivot() const { return abcPrimalColumnPivot_; } /// Abc Matrix inline AbcMatrix * abcMatrix() const { return abcMatrix_; } /** Factorizes using current basis. solveType - 1 iterating, 0 initial, -1 external If 10 added then in primal values pass Return codes are as from AbcSimplexFactorization unless initial factorization when total number of singularities is returned. Special case is numberRows_+1 -> all slack basis. if initial should be before permute in pivotVariable may be same as toExternal */ int internalFactorize(int solveType); /** Permutes in from ClpModel data - assumes scale factors done and AbcMatrix exists but is in original order (including slacks) For now just add basicArray at end == But could partition into normal (i.e. reasonable lower/upper) abnormal - free, odd bounds fixed == sets a valid pivotVariable Slacks always shifted by offset Fixed variables always shifted by offset Recode to allow row objective so can use pi from idiot etc */ void permuteIn(); /// deals with new basis and puts in abcPivotVariable_ void permuteBasis(); /// Permutes out - bit settings same as stateOfProblem void permuteOut(int whatsWanted); /// Save data ClpDataSave saveData() ; /// Restore data void restoreData(ClpDataSave saved); /// Clean up status - make sure no superbasic etc void cleanStatus(bool valuesPass=false); /** Computes duals from scratch. If givenDjs then allows for nonzero basic djs. Returns number of refinements */ int computeDuals(double * givenDjs, CoinIndexedVector * array1, CoinIndexedVector * array2); /// Computes primals from scratch. Returns number of refinements int computePrimals (CoinIndexedVector * array1, CoinIndexedVector * array2); /// Computes nonbasic cost and total cost void computeObjective (); /// set multiple sequence in void setMultipleSequenceIn(int sequenceIn[4]); /** Unpacks one column of the matrix into indexed array Uses sequenceIn_ */ inline void unpack(CoinIndexedVector & rowArray) const {unpack(rowArray,sequenceIn_);} /** Unpacks one column of the matrix into indexed array */ void unpack(CoinIndexedVector & rowArray, int sequence) const; /** This does basis housekeeping and does values for in/out variables. Can also decide to re-factorize */ int housekeeping(/*double objectiveChange*/); /** This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Primal) */ void checkPrimalSolution(bool justBasic); /** This sets largest infeasibility and most infeasible and sum and number of infeasibilities (Dual) */ void checkDualSolution(); /** This sets largest infeasibility and most infeasible and sum and number of infeasibilities AND sumFakeInfeasibilites_ (Dual) */ void checkDualSolutionPlusFake(); /** This sets sum and number of infeasibilities (Dual and Primal) */ void checkBothSolutions(); /// Computes solutions - 1 do duals, 2 do primals, 3 both (returns number of refinements) int gutsOfSolution(int type); /// Computes solutions - 1 do duals, 2 do primals, 3 both (returns number of refinements) int gutsOfPrimalSolution(int type); /// Saves good status etc void saveGoodStatus(); /// Restores previous good status and says trouble void restoreGoodStatus(int type); #define rowUseScale_ scaleFromExternal_ #define inverseRowUseScale_ scaleToExternal_ /// After modifying first copy refreshes second copy and marks as updated void refreshCosts(); void refreshLower(unsigned int type=~(ROW_LOWER_SAME|COLUMN_UPPER_SAME)); void refreshUpper(unsigned int type=~(ROW_LOWER_SAME|COLUMN_LOWER_SAME)); /// Sets up all extra pointers void setupPointers(int maxRows,int maxColumns); /// Copies all saved versions to working versions and may do something for perturbation void copyFromSaved(int type=31); /// fills in perturbationSaved_ from start with 0.5+random void fillPerturbation(int start, int number); /// For debug - prints summary of arrays which are out of kilter void checkArrays(int ignoreEmpty=0) const; /// For debug - summarizes dj situation (1 recomputes duals first, 2 checks duals as well) void checkDjs(int type=1) const; /// For debug - checks solutionBasic void checkSolutionBasic() const; /// For debug - moves solution back to external and computes stuff (always checks djs) void checkMoveBack(bool checkDuals); public: /** For advanced use. When doing iterative solves things can get nasty so on values pass if incoming solution has largest infeasibility < incomingInfeasibility throw out variables from basis until largest infeasibility < allowedInfeasibility or incoming largest infeasibility. If allowedInfeasibility>= incomingInfeasibility this is always possible altough you may end up with an all slack basis. Defaults are 1.0,10.0 */ void setValuesPassAction(double incomingInfeasibility, double allowedInfeasibility); /** Get a clean factorization - i.e. throw out singularities may do more later */ int cleanFactorization(int ifValuesPass); /// Move status and solution to ClpSimplex void moveStatusToClp(ClpSimplex * clpModel); /// Move status and solution from ClpSimplex void moveStatusFromClp(ClpSimplex * clpModel); //@} /**@name most useful gets and sets */ //@{ public: /// Objective value inline double clpObjectiveValue() const { return (objectiveValue_+objectiveOffset_-bestPossibleImprovement_)*optimizationDirection_ - dblParam_[ClpObjOffset]; } /** Basic variables pivoting on which rows may be same as toExternal but may be as at invert */ inline int * pivotVariable() const { return abcPivotVariable_; } /// State of problem inline int stateOfProblem() const { return stateOfProblem_;} /// State of problem inline void setStateOfProblem(int value) { stateOfProblem_=value;} /// Points from external to internal //inline int * fromExternal() const //{ return fromExternal_;} /// Points from internal to external //inline int * toExternal() const //{return toExternal_;} /** Scale from primal external to internal (in external order) Or other way for dual */ inline double * scaleFromExternal() const {return scaleFromExternal_;} /** Scale from primal internal to external (in external order) Or other way for dual */ inline double * scaleToExternal() const {return scaleToExternal_;} /// corresponds to rowScale etc inline double * rowScale2() const {return rowUseScale_;} inline double * inverseRowScale2() const {return inverseRowUseScale_;} inline double * inverseColumnScale2() const {return inverseColumnUseScale_;} inline double * columnScale2() const {return columnUseScale_;} inline int arrayForDualColumn() const {return arrayForDualColumn_;} /// upper theta from dual column inline double upperTheta() const {return upperTheta_;} inline int arrayForReplaceColumn() const { return arrayForReplaceColumn_;} inline int arrayForFlipBounds() const { return arrayForFlipBounds_;} inline int arrayForFlipRhs() const { return arrayForFlipRhs_;} inline int arrayForBtran() const { return arrayForBtran_;} inline int arrayForFtran() const { return arrayForFtran_;} inline int arrayForTableauRow() const { return arrayForTableauRow_;} /// value of incoming variable (in Dual) double valueIncomingDual() const; /// Get pointer to array[getNumCols()] of primal solution vector const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ const double * getRowActivity() const; //@} /**@name protected methods */ //@{ /** May change basis and then returns number changed. Computation of solutions may be overriden by given pi and solution */ int gutsOfSolution ( double * givenDuals, const double * givenPrimals, bool valuesPass = false); /// Does most of deletion for arrays etc(0 just null arrays, 1 delete first) void gutsOfDelete(int type); /// Does most of copying void gutsOfCopy(const AbcSimplex & rhs); /// Initializes arrays void gutsOfInitialize(int numberRows,int numberColumns,bool doMore); /// resizes arrays void gutsOfResize(int numberRows,int numberColumns); /** Translates ClpModel to AbcSimplex See DO_ bits in stateOfProblem_ for type e.g. DO_BASIS_AND_ORDER */ void translate(int type); /// Moves basic stuff to basic area void moveToBasic(int which=15); //@} public: /**@name public methods */ //@{ /// Return region inline double * solutionRegion() const { return abcSolution_; } inline double * djRegion() const { return abcDj_; } inline double * lowerRegion() const { return abcLower_; } inline double * upperRegion() const { return abcUpper_; } inline double * costRegion() const { return abcCost_; } /// Return region inline double * solutionRegion(int which) const { return abcSolution_+which*maximumAbcNumberRows_; } inline double * djRegion(int which) const { return abcDj_+which*maximumAbcNumberRows_; } inline double * lowerRegion(int which) const { return abcLower_+which*maximumAbcNumberRows_; } inline double * upperRegion(int which) const { return abcUpper_+which*maximumAbcNumberRows_; } inline double * costRegion(int which) const { return abcCost_+which*maximumAbcNumberRows_; } /// Return region inline double * solutionBasic() const { return solutionBasic_; } inline double * djBasic() const { return djBasic_; } inline double * lowerBasic() const { return lowerBasic_; } inline double * upperBasic() const { return upperBasic_; } inline double * costBasic() const { return costBasic_; } /// Perturbation inline double * abcPerturbation() const { return abcPerturbation_;} /// Fake djs inline double * fakeDjs() const { return djSaved_;} inline unsigned char * internalStatus() const { return internalStatus_;} inline AbcSimplex::Status getInternalStatus(int sequence) const { return static_cast (internalStatus_[sequence] & 7); } inline AbcSimplex::Status getInternalColumnStatus(int sequence) const { return static_cast (internalStatus_[sequence+maximumAbcNumberRows_] & 7); } inline void setInternalStatus(int sequence, AbcSimplex::Status newstatus) { unsigned char & st_byte = internalStatus_[sequence]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | newstatus); } inline void setInternalColumnStatus(int sequence, AbcSimplex::Status newstatus) { unsigned char & st_byte = internalStatus_[sequence+maximumAbcNumberRows_]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | newstatus); } /** Normally the first factorization does sparse coding because the factorization could be singular. This allows initial dense factorization when it is known to be safe */ void setInitialDenseFactorization(bool onOff); bool initialDenseFactorization() const; /** Return sequence In or Out */ inline int sequenceIn() const { return sequenceIn_; } inline int sequenceOut() const { return sequenceOut_; } /** Set sequenceIn or Out */ inline void setSequenceIn(int sequence) { sequenceIn_ = sequence; } inline void setSequenceOut(int sequence) { sequenceOut_ = sequence; } #if 0 /** Return sequenceInternal In or Out */ inline int sequenceInternalIn() const { return sequenceInternalIn_; } inline int sequenceInternalOut() const { return sequenceInternalOut_; } /** Set sequenceInternalIn or Out */ inline void setSequenceInternalIn(int sequence) { sequenceInternalIn_ = sequence; } inline void setSequenceInternalOut(int sequence) { sequenceInternalOut_ = sequence; } #endif /// Returns 1 if sequence indicates column inline int isColumn(int sequence) const { return sequence >= maximumAbcNumberRows_ ? 1 : 0; } /// Returns sequence number within section inline int sequenceWithin(int sequence) const { return sequence < maximumAbcNumberRows_ ? sequence : sequence - maximumAbcNumberRows_; } /// Current/last pivot row (set after END of choosing pivot row in dual) inline int lastPivotRow() const { return lastPivotRow_;} /// First Free_ inline int firstFree() const { return firstFree_;} /// Last firstFree_ inline int lastFirstFree() const { return lastFirstFree_;} /// Free chosen vector inline int freeSequenceIn() const { return freeSequenceIn_;} /// Acceptable pivot for this iteration inline double currentAcceptablePivot() const { return currentAcceptablePivot_;} #ifdef PAN /** Returns 1 if fake superbasic 0 if free or true superbasic -1 if was fake but has cleaned itself up (sets status) -2 if wasn't fake */ inline int fakeSuperBasic(int iSequence) { if ((internalStatus_[iSequence]&7)==4) return 0; // free if ((internalStatus_[iSequence]&7)!=5) return -2; double value=abcSolution_[iSequence]; if (value=-currentDualTolerance_) { setInternalStatus(iSequence,atLowerBound); #if PRINT_PAN>1 printf("Pansetting %d to lb\n",iSequence); #endif return -1; } else { return 1; } } else if (value>abcUpper_[iSequence]-primalTolerance_) { if (abcDj_[iSequence]<=currentDualTolerance_) { setInternalStatus(iSequence,atUpperBound); #if PRINT_PAN>1 printf("Pansetting %d to ub\n",iSequence); #endif return -1; } else { return 1; } } else { return 0; } } #endif /// Return row or column values inline double solution(int sequence) { return abcSolution_[sequence]; } /// Return address of row or column values inline double & solutionAddress(int sequence) { return abcSolution_[sequence]; } inline double reducedCost(int sequence) { return abcDj_[sequence]; } inline double & reducedCostAddress(int sequence) { return abcDj_[sequence]; } inline double lower(int sequence) { return abcLower_[sequence]; } /// Return address of row or column lower bound inline double & lowerAddress(int sequence) { return abcLower_[sequence]; } inline double upper(int sequence) { return abcUpper_[sequence]; } /// Return address of row or column upper bound inline double & upperAddress(int sequence) { return abcUpper_[sequence]; } inline double cost(int sequence) { return abcCost_[sequence]; } /// Return address of row or column cost inline double & costAddress(int sequence) { return abcCost_[sequence]; } /// Return original lower bound inline double originalLower(int iSequence) const { if (iSequence < numberColumns_) return columnLower_[iSequence]; else return rowLower_[iSequence-numberColumns_]; } /// Return original lower bound inline double originalUpper(int iSequence) const { if (iSequence < numberColumns_) return columnUpper_[iSequence]; else return rowUpper_[iSequence-numberColumns_]; } /// For dealing with all issues of cycling etc inline AbcSimplexProgress * abcProgress() { return &abcProgress_;} #ifdef ABC_SPRINT /// Overwrite to create sub problem (just internal arrays) - save full stuff AbcSimplex * createSubProblem(int numberColumns,const int * whichColumn); /// Restore stuff from sub problem (and delete sub problem) void restoreFromSubProblem(AbcSimplex * fullProblem, const int * whichColumn); #endif public: /** Clears an array and says available (-1 does all) when no possibility of going parallel */ inline void clearArraysPublic(int which) { clearArrays(which);} /** Returns first available empty array (and sets flag) when no possibility of going parallel */ inline int getAvailableArrayPublic() const { return getAvailableArray();} #if ABC_PARALLEL /// get parallel mode inline int parallelMode() const { return parallelMode_;} /// set parallel mode inline void setParallelMode(int value) { parallelMode_=value;} /// Number of cpus inline int numberCpus() const { return parallelMode_+1;} #if ABC_PARALLEL==1 /// set stop start inline void setStopStart(int value) { stopStart_=value;} #endif #endif //protected: /// Clears an array and says available (-1 does all) void clearArrays(int which); /// Clears an array and says available void clearArrays(CoinPartitionedVector * which); /// Returns first available empty array (and sets flag) int getAvailableArray() const; /// Say array going to be used inline void setUsedArray(int which) const {int check=1<(st_byte & ~24); st_byte = static_cast(st_byte | (fakeBound << 3)); } inline FakeBound getFakeBound(int sequence) const { return static_cast ((internalStatus_[sequence] >> 3) & 3); } bool atFakeBound(int sequence) const; inline void setPivoted( int sequence) { internalStatus_[sequence] = static_cast(internalStatus_[sequence] | 32); } inline void clearPivoted( int sequence) { internalStatus_[sequence] = static_cast(internalStatus_[sequence] & ~32); } inline bool pivoted(int sequence) const { return (((internalStatus_[sequence] >> 5) & 1) != 0); } public: /// Swaps two variables void swap(int pivotRow,int nonBasicPosition); /// To flag a variable void setFlagged( int sequence); inline void clearFlagged( int sequence) { internalStatus_[sequence] = static_cast(internalStatus_[sequence] & ~64); } inline bool flagged(int sequence) const { return ((internalStatus_[sequence] & 64) != 0); } protected: /// To say row active in primal pivot row choice inline void setActive( int iRow) { internalStatus_[iRow] = static_cast(internalStatus_[iRow] | 128); } inline void clearActive( int iRow) { internalStatus_[iRow] = static_cast(internalStatus_[iRow] & ~128); } inline bool active(int iRow) const { return ((internalStatus_[iRow] & 128) != 0); } public: /** Set up status array (can be used by OsiAbc). Also can be used to set up all slack basis */ void createStatus() ; /// Does sort of crash void crash(int type); /** Puts more stuff in basis 1 bit set - do even if basis exists 2 bit set - don't bother staying triangular */ void putStuffInBasis(int type); /** Sets up all slack basis and resets solution to as it was after initial load or readMps */ void allSlackBasis(); /// For debug - check pivotVariable consistent void checkConsistentPivots() const; /// Print stuff void printStuff() const; /// Common bits of coding for dual and primal int startup(int ifValuesPass); /// Raw objective value (so always minimize in primal) inline double rawObjectiveValue() const { return objectiveValue_; } /// Compute objective value from solution and put in objectiveValue_ void computeObjectiveValue(bool useWorkingSolution = false); /// Compute minimization objective value from internal solution without perturbation double computeInternalObjectiveValue(); /// Move status and solution across void moveInfo(const AbcSimplex & rhs, bool justStatus = false); #ifndef NUMBER_THREADS #define NUMBER_THREADS 3 #endif #if ABC_PARALLEL==1 // For waking up thread inline pthread_mutex_t * mutexPointer(int which,int thread=0) { return mutex_+which+3*thread;} inline pthread_barrier_t * barrierPointer() { return &barrier_;} inline int whichLocked(int thread=0) const { return locked_[thread];} inline CoinThreadInfo * threadInfoPointer(int thread=0) { return threadInfo_+thread;} void startParallelStuff(int type); int stopParallelStuff(int type); /// so thread can find out which one it is int whichThread() const; #elif ABC_PARALLEL==2 //inline CoinThreadInfo * threadInfoPointer(int thread=0) //{ return threadInfo_+thread;} #endif //@} //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ void setObjectiveCoefficient( int elementIndex, double elementValue ); /** Set an objective function coefficient */ inline void setObjCoeff( int elementIndex, double elementValue ) { setObjectiveCoefficient( elementIndex, elementValue); } /** Set a single column lower bound
    Use -DBL_MAX for -infinity. */ void setColumnLower( int elementIndex, double elementValue ); /** Set a single column upper bound
    Use DBL_MAX for infinity. */ void setColumnUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound */ void setColumnBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
    The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ void setColumnSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single column lower bound
    Use -DBL_MAX for -infinity. */ inline void setColLower( int elementIndex, double elementValue ) { setColumnLower(elementIndex, elementValue); } /** Set a single column upper bound
    Use DBL_MAX for infinity. */ inline void setColUpper( int elementIndex, double elementValue ) { setColumnUpper(elementIndex, elementValue); } /** Set a single column lower and upper bound */ inline void setColBounds( int elementIndex, double newlower, double newupper ) { setColumnBounds(elementIndex, newlower, newupper); } /** Set the bounds on a number of columns simultaneously
    @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ inline void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { setColumnSetBounds(indexFirst, indexLast, boundList); } /** Set a single row lower bound
    Use -DBL_MAX for -infinity. */ void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
    Use DBL_MAX for infinity. */ void setRowUpper( int elementIndex, double elementValue ) ; /** Set a single row lower and upper bound */ void setRowBounds( int elementIndex, double lower, double upper ) ; /** Set the bounds on a number of rows simultaneously
    @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /// Resizes rim part of model void resize (int newNumberRows, int newNumberColumns); //@} ////////////////// data ////////////////// protected: /**@name data. Many arrays have a row part and a column part. There is a single array with both - columns then rows and then normally two arrays pointing to rows and columns. The single array is the owner of memory */ //@{ /// Sum of nonbasic costs double sumNonBasicCosts_; /// Sum of costs (raw objective value) double rawObjectiveValue_; /// Objective offset (from offset_) double objectiveOffset_; /** Perturbation factor If <0.0 then virtual if 0.0 none if >0.0 use this as factor */ double perturbationFactor_; /// Current dualTolerance (will end up as dualTolerance_) double currentDualTolerance_; /// Current dualBound (will end up as dualBound_) double currentDualBound_; /// Largest gap double largestGap_; /// Last dual bound double lastDualBound_; /// Sum of infeasibilities when using fake perturbation tolerance double sumFakeInfeasibilities_; /// Last primal error double lastPrimalError_; /// Last dual error double lastDualError_; /// Acceptable pivot for this iteration double currentAcceptablePivot_; /// Movement of variable double movement_; /// Objective change double objectiveChange_; /// Btran alpha double btranAlpha_; /// FT alpha #ifdef ABC_LONG_FACTORIZATION long #endif double ftAlpha_; /// Minimum theta movement double minimumThetaMovement_; /// Initial sum of infeasibilities double initialSumInfeasibilities_; public: /// Where we are in iteration int stateOfIteration_; protected: /// Last firstFree_ int lastFirstFree_; /// Free chosen vector int freeSequenceIn_; /// Maximum number rows int maximumAbcNumberRows_; /// Maximum number columns int maximumAbcNumberColumns_; /// Maximum numberTotal int maximumNumberTotal_; /// Current number of variables flagged int numberFlagged_; /// Iteration at which to do relaxed dualColumn int normalDualColumnIteration_; /** State of dual waffle -2 - in initial large tolerance phase -1 - in medium tolerance phase n - in correct tolerance phase and thought optimal n times */ int stateDualColumn_; /* May want to put some arrays into struct Two arrays point to/from external Order is basic,unused basic, at lower, at upper, superbasic, free, fixed with starts */ /// Number of variables (includes spare rows) int numberTotal_; /// Number of variables without fixed to zero (includes spare rows) int numberTotalWithoutFixed_; /// Start of variables at lower bound with no upper #define startAtLowerNoOther_ maximumAbcNumberRows_ /// Start of variables at lower bound with upper int startAtLowerOther_; /// Start of variables at upper bound with no lower int startAtUpperNoOther_; /// Start of variables at upper bound with lower int startAtUpperOther_; /// Start of superBasic, free or awkward bounds variables int startOther_; /// Start of fixed variables int startFixed_; #ifdef EARLY_FACTORIZE /// Number of iterations to try factorizing early int numberEarly_; #endif /** State of problem State of external arrays 2048 - status OK 4096 - row primal solution OK 8192 - row dual solution OK 16384 - column primal solution OK 32768 - column dual solution OK 65536 - Everything not going smoothly (when smooth we forget about tiny bad djs) 131072 - when increasing rows add a bit 262144 - scale matrix and create new one 524288 - do basis and order 1048576 - just status (and check if order needed) 2097152 - just solution 4194304 - just redo bounds (and offset) Bottom bits say if usefulArray in use */ #define ALL_STATUS_OK 2048 #define ROW_PRIMAL_OK 4096 #define ROW_DUAL_OK 8192 #define COLUMN_PRIMAL_OK 16384 #define COLUMN_DUAL_OK 32768 #define PESSIMISTIC 65536 #define ADD_A_BIT 131072 #define DO_SCALE_AND_MATRIX 262144 #define DO_BASIS_AND_ORDER 524288 #define DO_STATUS 1048576 #define DO_SOLUTION 2097152 #define DO_JUST_BOUNDS 0x400000 #define NEED_BASIS_SORT 0x800000 #define FAKE_SUPERBASIC 0x1000000 #define VALUES_PASS 0x2000000 #define VALUES_PASS2 0x4000000 mutable int stateOfProblem_; #if ABC_PARALLEL public: /// parallel mode int parallelMode_; protected: #endif /// Number of ordinary (lo/up) in tableau row int numberOrdinary_; /// Set to 1 if no free or super basic int ordinaryVariables_; /// Number of free nonbasic variables int numberFreeNonBasic_; /// Last time cleaned up int lastCleaned_; /// Current/last pivot row (set after END of choosing pivot row in dual) int lastPivotRow_; /// Nonzero (probably 10) if swapped algorithms int swappedAlgorithm_; /// Initial number of infeasibilities int initialNumberInfeasibilities_; /// Points from external to internal //int * fromExternal_; /// Points from internal to external //int * toExternal_; /** Scale from primal external to internal (in external order) Or other way for dual */ double * scaleFromExternal_; /** Scale from primal internal to external (in external order) Or other way for dual */ double * scaleToExternal_; /// use this instead of columnScale double * columnUseScale_; /// use this instead of inverseColumnScale double * inverseColumnUseScale_; /** Primal offset (in external order) So internal value is (external-offset)*scaleFromExternal */ double * offset_; /// Offset for accumulated offsets*matrix double * offsetRhs_; /// Useful array of numberTotal length double * tempArray_; /** Working status ? may be signed ? link pi_ to an indexed array? may have saved from last factorization at end */ unsigned char * internalStatus_; /// Saved status unsigned char * internalStatusSaved_; /** Perturbation (fixed) - is just scaled random numbers If perturbationFactor_<0 then virtual perturbation */ double * abcPerturbation_; /// saved perturbation double * perturbationSaved_; /// basic perturbation double * perturbationBasic_; /// Working matrix AbcMatrix * abcMatrix_; /** Working scaled copy of lower bounds has original scaled copy at end */ double * abcLower_; /** Working scaled copy of upper bounds has original scaled copy at end */ double * abcUpper_; /** Working scaled copy of objective ? where perturbed copy or can we always work with perturbed copy (in B&B) if we adjust increments/cutoffs ? should we save a fixed perturbation offset array has original scaled copy at end */ double * abcCost_; /** Working scaled primal solution may have saved from last factorization at end */ double * abcSolution_; /** Working scaled dual solution may have saved from last factorization at end */ double * abcDj_; /// Saved scaled copy of lower bounds double * lowerSaved_; /// Saved scaled copy of upper bounds double * upperSaved_; /// Saved scaled copy of objective double * costSaved_; /// Saved scaled primal solution double * solutionSaved_; /// Saved scaled dual solution double * djSaved_; /// Working scaled copy of basic lower bounds double * lowerBasic_; /// Working scaled copy of basic upper bounds double * upperBasic_; /// Working scaled copy of basic objective double * costBasic_; /// Working scaled basic primal solution double * solutionBasic_; /// Working scaled basic dual solution (want it to be zero) double * djBasic_; /// dual row pivot choice AbcDualRowPivot * abcDualRowPivot_; /// primal column pivot choice AbcPrimalColumnPivot * abcPrimalColumnPivot_; /** Basic variables pivoting on which rows followed by atLo/atUp then free/superbasic then fixed */ int * abcPivotVariable_; /// Reverse abcPivotVariable_ for moving around int * reversePivotVariable_; /// factorization AbcSimplexFactorization * abcFactorization_; #ifdef EARLY_FACTORIZE /// Alternative factorization AbcSimplexFactorization * abcEarlyFactorization_; #endif #ifdef TEMPORARY_FACTORIZATION /// Alternative factorization AbcSimplexFactorization * abcOtherFactorization_; #endif /// Saved version of solution //double * savedSolution_; /// A copy of model with certain state - normally without cuts AbcSimplex * abcBaseModel_; /// A copy of model as ClpSimplex with certain state ClpSimplex * clpModel_; /** Very wasteful way of dealing with infeasibilities in primal. However it will allow non-linearities and use of dual analysis. If it doesn't work it can easily be replaced. */ AbcNonLinearCost * abcNonLinearCost_; /// Useful arrays (all of row+column+2 length) /* has secondary offset and counts so row goes first then column Probably back to CoinPartitionedVector as AbcMatrix has slacks also says if in use - so we can just get next available one */ #define ABC_NUMBER_USEFUL 8 mutable CoinPartitionedVector usefulArray_[ABC_NUMBER_USEFUL]; /// For dealing with all issues of cycling etc AbcSimplexProgress abcProgress_; /// For saving stuff at beginning ClpDataSave saveData_; /// upper theta from dual column double upperTheta_; /// Multiple sequence in int multipleSequenceIn_[4]; public: int arrayForDualColumn_; int arrayForReplaceColumn_; int arrayForFlipBounds_; //2 int arrayForFlipRhs_; // if sequential can re-use int arrayForBtran_; // 0 int arrayForFtran_; // 1 int arrayForTableauRow_; //3 protected: int numberFlipped_; int numberDisasters_; //int nextCleanNonBasicIteration_; #if ABC_PARALLEL==1 // For waking up thread pthread_mutex_t mutex_[3*NUMBER_THREADS]; pthread_barrier_t barrier_; CoinThreadInfo threadInfo_[NUMBER_THREADS]; pthread_t abcThread_[NUMBER_THREADS]; int locked_[NUMBER_THREADS]; int stopStart_; #elif ABC_PARALLEL==2 //CoinThreadInfo threadInfo_[NUMBER_THREADS]; #endif //@} }; //############################################################################# /** A function that tests the methods in the AbcSimplex class. The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. It also does some testing of AbcSimplexFactorization class */ void AbcSimplexUnitTest(const std::string & mpsDir); #endif CoinMP-1.8.3/Clp/src/AbcSimplexPrimal.hpp0000644000175000017500000002407512101105055016524 0ustar renerene/* $Id: AbcSimplexPrimal.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef AbcSimplexPrimal_H #define AbcSimplexPrimal_H #include "AbcSimplex.hpp" /** This solves LPs using the primal simplex method It inherits from AbcSimplex. It has no data of its own and is never created - only cast from a AbcSimplex object at algorithm time. */ class AbcSimplexPrimal : public AbcSimplex { public: /**@name Description of algorithm */ //@{ /** Primal algorithm Method It tries to be a single phase approach with a weight of 1.0 being given to getting optimal and a weight of infeasibilityCost_ being given to getting primal feasible. In this version I have tried to be clever in a stupid way. The idea of fake bounds in dual seems to work so the primal analogue would be that of getting bounds on reduced costs (by a presolve approach) and using these for being above or below feasible region. I decided to waste memory and keep these explicitly. This allows for non-linear costs! I have not tested non-linear costs but will be glad to do something if a reasonable example is provided. The code is designed to take advantage of sparsity so arrays are seldom zeroed out from scratch or gone over in their entirety. The only exception is a full scan to find incoming variable for Dantzig row choice. For steepest edge we keep an updated list of dual infeasibilities (actually squares). On easy problems we don't need full scan - just pick first reasonable. This method has not been coded. One problem is how to tackle degeneracy and accuracy. At present I am using the modification of costs which I put in OSL and which was extended by Gill et al. I am still not sure whether we will also need explicit perturbation. The flow of primal is three while loops as follows: while (not finished) { while (not clean solution) { Factorize and/or clean up solution by changing bounds so primal feasible. If looks finished check fake primal bounds. Repeat until status is iterating (-1) or finished (0,1,2) } while (status==-1) { Iterate until no pivot in or out or time to re-factorize. Flow is: choose pivot column (incoming variable). if none then we are primal feasible so looks as if done but we need to break and check bounds etc. Get pivot column in tableau Choose outgoing row. If we don't find one then we look primal unbounded so break and check bounds etc. (Also the pivot tolerance is larger after any iterations so that may be reason) If we do find outgoing row, we may have to adjust costs to keep going forwards (anti-degeneracy). Check pivot will be stable and if unstable throw away iteration and break to re-factorize. If minor error re-factorize after iteration. Update everything (this may involve changing bounds on variables to stay primal feasible. } } TODO's (or maybe not) At present we never check we are going forwards. I overdid that in OSL so will try and make a last resort. Needs partial scan pivot in option. May need other anti-degeneracy measures, especially if we try and use loose tolerances as a way to solve in fewer iterations. I like idea of dynamic scaling. This gives opportunity to decouple different implications of scaling for accuracy, iteration count and feasibility tolerance. for use of exotic parameter startFinishoptions see Clpsimplex.hpp */ int primal(int ifValuesPass = 0, int startFinishOptions = 0); //@} /**@name For advanced users */ //@{ /// Do not change infeasibility cost and always say optimal void alwaysOptimal(bool onOff); bool alwaysOptimal() const; /** Normally outgoing variables can go out to slightly negative values (but within tolerance) - this is to help stability and and degeneracy. This can be switched off */ void exactOutgoing(bool onOff); bool exactOutgoing() const; //@} /**@name Functions used in primal */ //@{ /** This has the flow between re-factorizations Returns a code to say where decision to exit was made Problem status set to: -2 re-factorize -4 Looks optimal/infeasible -5 Looks unbounded +3 max iterations valuesOption has original value of valuesPass */ int whileIterating(int valuesOption); /** Do last half of an iteration. This is split out so people can force incoming variable. If solveType_ is 2 then this may re-factorize while normally it would exit to re-factorize. Return codes Reasons to come out (normal mode/user mode): -1 normal -2 factorize now - good iteration/ NA -3 slight inaccuracy - refactorize - iteration done/ same but factor done -4 inaccuracy - refactorize - no iteration/ NA -5 something flagged - go round again/ pivot not possible +2 looks unbounded +3 max iterations (iteration done) With solveType_ ==2 this should Pivot in a variable and choose an outgoing one. Assumes primal feasible - will not go through a bound. Returns step length in theta Returns ray in ray_ */ int pivotResult(int ifValuesPass = 0); int pivotResult4(int ifValuesPass = 0); /** The primals are updated by the given array. Returns number of infeasibilities. After rowArray will have cost changes for use next iteration */ int updatePrimalsInPrimal(CoinIndexedVector * rowArray, double theta, double & objectiveChange, int valuesPass); /** The primals are updated by the given array. costs are changed */ void updatePrimalsInPrimal(CoinIndexedVector & rowArray, double theta,bool valuesPass); /** After rowArray will have cost changes for use next iteration */ void createUpdateDuals(CoinIndexedVector & rowArray, const double * originalCost, const double extraCost[4], double & objectiveChange, int valuesPass); /** Update minor candidate vector - new reduced cost returned later try and get change in reduced cost (then may not need sequence in)*/ double updateMinorCandidate(const CoinIndexedVector & updateBy, CoinIndexedVector & candidate, int sequenceIn); /// Update partial Ftran by R update void updatePartialUpdate(CoinIndexedVector & partialUpdate); /// Do FT update as separate function for minor iterations (nonzero return code on problems) int doFTUpdate(CoinIndexedVector * vector[4]); /** Row array has pivot column This chooses pivot row. Rhs array is used for distance to next bound (for speed) For speed, we may need to go to a bucket approach when many variables go through bounds If valuesPass non-zero then compute dj for direction */ void primalRow(CoinIndexedVector * rowArray, CoinIndexedVector * rhsArray, CoinIndexedVector * spareArray, int valuesPass); typedef struct { double theta_; double alpha_; double saveDualIn_; double dualIn_; double lowerIn_; double upperIn_; double valueIn_; int sequenceIn_; int directionIn_; double dualOut_; double lowerOut_; double upperOut_; double valueOut_; int sequenceOut_; int directionOut_; int pivotRow_; int valuesPass_; } pivotStruct; void primalRow(CoinIndexedVector * rowArray, CoinIndexedVector * rhsArray, CoinIndexedVector * spareArray, pivotStruct & stuff); /** Chooses primal pivot column updateArray has cost updates (also use pivotRow_ from last iteration) Would be faster with separate region to scan and will have this (with square of infeasibility) when steepest For easy problems we can just choose one of the first columns we look at */ void primalColumn(CoinPartitionedVector * updateArray, CoinPartitionedVector * spareRow2, CoinPartitionedVector * spareColumn1); /** Checks if tentative optimal actually means unbounded in primal Returns -3 if not, 2 if is unbounded */ int checkUnbounded(CoinIndexedVector * ray, CoinIndexedVector * spare, double changeCost); /** Refactorizes if necessary Checks if finished. Updates status. lastCleaned refers to iteration at which some objective/feasibility cleaning too place. type - 0 initial so set up save arrays etc - 1 normal -if good update save - 2 restoring from saved */ void statusOfProblemInPrimal(int type); /// Perturbs problem (method depends on perturbation()) void perturb(int type); /// Take off effect of perturbation and say whether to try dual bool unPerturb(); /// Unflag all variables and return number unflagged int unflag(); /** Get next superbasic -1 if none, Normal type is 1 If type is 3 then initializes sorted list if 2 uses list. */ int nextSuperBasic(int superBasicType, CoinIndexedVector * columnArray); /// Create primal ray void primalRay(CoinIndexedVector * rowArray); /// Clears all bits and clears rowArray[1] etc void clearAll(); /// Sort of lexicographic resolve int lexSolve(); //@} }; #endif CoinMP-1.8.3/Clp/src/AbcDualRowSteepest.cpp0000644000175000017500000013420712101105055017022 0ustar renerene/* $Id: AbcDualRowSteepest.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "AbcSimplex.hpp" #include "ClpMessage.hpp" #include "AbcDualRowSteepest.hpp" #include "CoinIndexedVector.hpp" #include "AbcSimplexFactorization.hpp" #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #include //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //#define CLP_DEBUG 2 //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcDualRowSteepest::AbcDualRowSteepest (int mode) : AbcDualRowPivot(), norm_(0.0), factorizationRatio_(10.0), state_(-1), mode_(mode), persistence_(normal), weights_(NULL), infeasible_(NULL), savedWeights_(NULL) { type_ = 2 + 64 * mode; //printf("XX %x AbcDualRowSteepest constructor\n",this); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcDualRowSteepest::AbcDualRowSteepest (const AbcDualRowSteepest & rhs) : AbcDualRowPivot(rhs) { //printf("XX %x AbcDualRowSteepest constructor from %x\n",this,&rhs); norm_ = rhs.norm_; factorizationRatio_ = rhs.factorizationRatio_; state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; model_ = rhs.model_; if ((model_ && model_->whatsChanged() & 1) != 0) { int number = model_->numberRows(); if (rhs.savedWeights_) number = CoinMin(number, rhs.savedWeights_->capacity()); if (rhs.infeasible_) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } if (rhs.weights_) { weights_ = new CoinIndexedVector(rhs.weights_); } else { weights_ = NULL; } if (rhs.savedWeights_) { savedWeights_ = new CoinIndexedVector(rhs.savedWeights_); } else { savedWeights_ = NULL; } } else { infeasible_ = NULL; weights_ = NULL; savedWeights_ = NULL; } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcDualRowSteepest::~AbcDualRowSteepest () { //printf("XX %x AbcDualRowSteepest destructor\n",this); delete weights_; delete infeasible_; delete savedWeights_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcDualRowSteepest & AbcDualRowSteepest::operator=(const AbcDualRowSteepest& rhs) { if (this != &rhs) { AbcDualRowPivot::operator=(rhs); norm_ = rhs.norm_; factorizationRatio_ = rhs.factorizationRatio_; state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; model_ = rhs.model_; delete weights_; delete infeasible_; delete savedWeights_; assert(model_); int number = model_->numberRows(); if (rhs.savedWeights_) number = CoinMin(number, rhs.savedWeights_->capacity()); if (rhs.infeasible_ != NULL) { infeasible_ = new CoinIndexedVector(rhs.infeasible_); } else { infeasible_ = NULL; } if (rhs.weights_ != NULL) { weights_ = new CoinIndexedVector(rhs.weights_); } else { weights_ = NULL; } if (rhs.savedWeights_ != NULL) { savedWeights_ = new CoinIndexedVector(rhs.savedWeights_); } else { savedWeights_ = NULL; } } return *this; } // Fill most values void AbcDualRowSteepest::fill(const AbcDualRowSteepest& rhs) { norm_ = rhs.norm_; factorizationRatio_ = rhs.factorizationRatio_; state_ = rhs.state_; mode_ = rhs.mode_; persistence_ = rhs.persistence_; assert (model_->numberRows() == rhs.model_->numberRows()); model_ = rhs.model_; assert(model_); int number = model_->numberRows(); if (rhs.savedWeights_) number = CoinMin(number, rhs.savedWeights_->capacity()); if (rhs.infeasible_ != NULL) { if (!infeasible_) infeasible_ = new CoinIndexedVector(rhs.infeasible_); else *infeasible_ = *rhs.infeasible_; } else { delete infeasible_; infeasible_ = NULL; } if (rhs.weights_ != NULL) { if (!weights_) weights_ = new CoinIndexedVector(rhs.weights_); } else { delete weights_; weights_ = NULL; } if (rhs.savedWeights_ != NULL) { if (!savedWeights_) savedWeights_ = new CoinIndexedVector(rhs.savedWeights_); else *savedWeights_ = *rhs.savedWeights_; } else { delete savedWeights_; savedWeights_ = NULL; } } #ifdef CHECK_NUMBER_WANTED static int xTimes=0; static int xWanted=0; #endif #if ABC_PARALLEL==2 #define DO_REDUCE 2 #ifdef DO_REDUCE #if DO_REDUCE==1 #include static void choose(int & chosenRow,double & largest, int n, const int * index, const double * infeas, const double * weights,double tolerance) { cilk::reducer_max_index maximumIndex(chosenRow,largest); #pragma cilk_grainsize=128 cilk_for (int i = 0; i < n; i++) { int iRow = index[i]; double value = infeas[iRow]; if (value > tolerance) { double thisWeight = CoinMin(weights[iRow], 1.0e50); maximumIndex.calc_max(iRow,value/thisWeight); } } chosenRow=maximumIndex.get_index(); largest=maximumIndex.get_value(); } #else static void choose(AbcDualRowSteepest * steepest, int & chosenRowSave,double & largestSave, int first, int last, double tolerance) { if (last-first>256) { int mid=(last+first)>>1; int chosenRow2=chosenRowSave; double largest2=largestSave; cilk_spawn choose(steepest,chosenRow2,largest2, first, mid, tolerance); choose(steepest,chosenRowSave,largestSave, mid, last, tolerance); cilk_sync; if (largest2>largestSave) { largestSave=largest2; chosenRowSave=chosenRow2; } } else { const int * index=steepest->infeasible()->getIndices(); const double * infeas=steepest->infeasible()->denseVector(); const double * weights=steepest->weights()->denseVector(); double largest=largestSave; int chosenRow=chosenRowSave; if ((steepest->model()->stateOfProblem()&VALUES_PASS2)==0) { for (int i = first; i < last; i++) { int iRow = index[i]; double value = infeas[iRow]; if (value > tolerance) { double thisWeight = CoinMin(weights[iRow], 1.0e50); if (value>largest*thisWeight) { largest=value/thisWeight; chosenRow=iRow; } } } } else { const double * fakeDjs = steepest->model()->fakeDjs(); const int * pivotVariable = steepest->model()->pivotVariable(); for (int i = first; i < last; i++) { int iRow = index[i]; double value = infeas[iRow]; if (value > tolerance) { int iSequence=pivotVariable[iRow]; value *=(fabs(fakeDjs[iSequence])+1.0e-6); double thisWeight = CoinMin(weights[iRow], 1.0e50); /* Ideas always use fake use fake until chosen if successful would move djs to basic region? how to switch off if cilking - easiest at saveWeights */ if (value>largest*thisWeight) { largest=value/thisWeight; chosenRow=iRow; } } } } chosenRowSave=chosenRow; largestSave=largest; } } static void choose2(AbcDualRowSteepest * steepest, int & chosenRowSave,double & largestSave, int first, int last, double tolerance) { if (last-first>256) { int mid=(last+first)>>1; int chosenRow2=chosenRowSave; double largest2=largestSave; cilk_spawn choose2(steepest,chosenRow2,largest2, first, mid, tolerance); choose2(steepest,chosenRowSave,largestSave, mid, last, tolerance); cilk_sync; if (largest2>largestSave) { largestSave=largest2; chosenRowSave=chosenRow2; } } else { const int * index=steepest->infeasible()->getIndices(); const double * infeas=steepest->infeasible()->denseVector(); double largest=largestSave; int chosenRow=chosenRowSave; for (int i = first; i < last; i++) { int iRow = index[i]; double value = infeas[iRow]; if (value > largest) { largest=value; chosenRow=iRow; } } chosenRowSave=chosenRow; largestSave=largest; } } #endif #endif #endif // Returns pivot row, -1 if none int AbcDualRowSteepest::pivotRow() { assert(model_); double * COIN_RESTRICT infeas = infeasible_->denseVector(); int * COIN_RESTRICT index = infeasible_->getIndices(); int number = infeasible_->getNumElements(); int lastPivotRow = model_->lastPivotRow(); assert (lastPivotRow < model_->numberRows()); double tolerance = model_->currentPrimalTolerance(); // we can't really trust infeasibilities if there is primal error // this coding has to mimic coding in checkPrimalSolution double error = CoinMin(1.0e-2, model_->largestPrimalError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; // But cap tolerance = CoinMin(1000.0, tolerance); tolerance *= tolerance; // as we are using squares bool toleranceChanged = false; const double * COIN_RESTRICT solutionBasic = model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic = model_->lowerBasic(); const double * COIN_RESTRICT upperBasic = model_->upperBasic(); // do last pivot row one here if (lastPivotRow >= 0 && lastPivotRow < model_->numberRows()) { double value = solutionBasic[lastPivotRow]; double lower = lowerBasic[lastPivotRow]; double upper = upperBasic[lastPivotRow]; if (value > upper + tolerance) { value -= upper; value *= value; // store square in list if (infeas[lastPivotRow]) infeas[lastPivotRow] = value; // already there else infeasible_->quickAdd(lastPivotRow, value); } else if (value < lower - tolerance) { value -= lower; value *= value; // store square in list if (infeas[lastPivotRow]) infeas[lastPivotRow] = value; // already there else infeasible_->add(lastPivotRow, value); } else { // feasible - was it infeasible - if so set tiny if (infeas[lastPivotRow]) infeas[lastPivotRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } number = infeasible_->getNumElements(); } if(model_->numberIterations() < model_->lastBadIteration() + 200) { // we can't really trust infeasibilities if there is dual error if (model_->largestDualError() > model_->largestPrimalError()) { tolerance *= CoinMin(model_->largestDualError() / model_->largestPrimalError(), 1000.0); toleranceChanged = true; } } int numberWanted; if (mode_ < 2 ) { numberWanted = number + 1; } else { if (model_->factorization()->pivots()==0) { int numberElements = model_->factorization()->numberElements(); int numberRows = model_->numberRows(); #if 0 int numberSlacks = model_->factorization()->numberSlacks(); factorizationRatio_ = static_cast (numberElements+1) / static_cast (numberRows+1-numberSlacks); #else factorizationRatio_ = static_cast (numberElements) / static_cast (numberRows); #endif //printf("%d iterations, numberElements %d ratio %g\n", // model_->numberIterations(),numberElements,factorizationRatio_); // Bias so less likely to go to steepest if large double weights[]={1.0,2.0,5.0}; double modifier; if (numberRows<100000) modifier=weights[0]; else if (numberRows<200000) modifier=weights[1]; else modifier=weights[2]; if (mode_==2&&factorizationRatio_>modifier) { // switch from dantzig to steepest mode_=3; saveWeights(model_,5); } } #if 0 // look at this and modify numberWanted = number+1; if (factorizationRatio_ < 1.0) { numberWanted = CoinMax(2000, numberRows / 20); #if 0 } else if (factorizationRatio_ > 10.0) { double ratio = number * (factorizationRatio_ / 80.0); if (ratio > number) numberWanted = number + 1; else numberWanted = CoinMax(2000, static_cast (ratio)); #else } else { //double multiplier=CoinMin(factorizationRatio_*0.1,1.0) #endif } #else numberWanted = CoinMax(2000, number / 8); if (factorizationRatio_ < 1.5) { numberWanted = CoinMax(2000, number / 20); } else if (factorizationRatio_ > 5.0) { numberWanted = number + 1; } #endif numberWanted=CoinMin(numberWanted,number+1); } if (model_->largestPrimalError() > 1.0e-3) numberWanted = number + 1; // be safe #ifdef CHECK_NUMBER_WANTED xWanted+=numberWanted; xTimes++; if ((xTimes%1000)==0) printf("time %d average wanted %g\n",xTimes,static_cast(xWanted)/xTimes); #endif int iPass; // Setup two passes int start[4]; start[1] = number; start[2] = 0; double dstart = static_cast (number) * model_->randomNumberGenerator()->randomDouble(); start[0] = static_cast (dstart); start[3] = start[0]; //double largestWeight=0.0; //double smallestWeight=1.0e100; const double * weights = weights_->denseVector(); const int * pivotVariable = model_->pivotVariable(); double savePivotWeight=weights_->denseVector()[lastPivotRow]; weights_->denseVector()[lastPivotRow] *= 1.0e10; double largest = 0.0; int chosenRow = -1; int saveNumberWanted=numberWanted; #ifdef DO_REDUCE bool doReduce=true; int lastChosen=-1; double lastLargest=0.0; #endif for (iPass = 0; iPass < 2; iPass++) { int endThis = start[2*iPass+1]; int startThis=start[2*iPass]; while (startThis=0); if (model_->flagged(pivotVariable[chosenRow])|| (solutionBasic[chosenRow] <= upperBasic[chosenRow] + tolerance && solutionBasic[chosenRow] >= lowerBasic[chosenRow] - tolerance)) { doReduce=false; chosenRow=lastChosen; largest=lastLargest; } else { lastChosen=chosenRow; lastLargest=largest; } } } if (!doReduce) { #endif for (int i = startThis; i < end; i++) { int iRow = index[i]; double value = infeas[iRow]; if (value > tolerance) { //#define OUT_EQ #ifdef OUT_EQ if (upper[iRow] == lower[iRow]) value *= 2.0; #endif double thisWeight = CoinMin(weights[iRow], 1.0e50); //largestWeight = CoinMax(largestWeight,weight); //smallestWeight = CoinMin(smallestWeight,weight); //double dubious = dubiousWeights_[iRow]; //weight *= dubious; //if (value>2.0*largest*weight||(value>0.5*largest*weight&&value*largestWeight>dubious*largest*weight)) { if (value > largest * thisWeight) { // make last pivot row last resort choice //if (iRow == lastPivotRow) { //if (value * 1.0e-10 < largest * thisWeight) // continue; //else // value *= 1.0e-10; //} if (!model_->flagged(pivotVariable[iRow])) { //#define CLP_DEBUG 3 #ifdef CLP_DEBUG double value2 = 0.0; if (solutionBasic[iRow] > upperBasic[iRow] + tolerance) value2 = solutionBasic[iRow] - upperBasic[iRow]; else if (solutionBasic[iRow] < lowerBasic[iRow] - tolerance) value2 = solutionBasic[iRow] - lowerBasic[iRow]; assert(fabs(value2 * value2 - infeas[iRow]) < 1.0e-8 * CoinMin(value2 * value2, infeas[iRow])); #endif if (solutionBasic[iRow] > upperBasic[iRow] + tolerance || solutionBasic[iRow] < lowerBasic[iRow] - tolerance) { chosenRow = iRow; largest = value / thisWeight; //largestWeight = dubious; } } } } } #ifdef DO_REDUCE } #endif numberWanted-=(end-startThis); if (!numberWanted) { if(chosenRow>=0) break; else numberWanted=(saveNumberWanted+1)>>1; } startThis=end; } if (!numberWanted) { if(chosenRow>=0) break; else numberWanted=(saveNumberWanted+1)>>1; } } weights_->denseVector()[lastPivotRow]=savePivotWeight; //printf("smallest %g largest %g\n",smallestWeight,largestWeight); if (chosenRow < 0 && toleranceChanged) { // won't line up with checkPrimalSolution - do again double saveError = model_->largestDualError(); model_->setLargestDualError(0.0); // can't loop chosenRow = pivotRow(); model_->setLargestDualError(saveError); } if (chosenRow < 0 && lastPivotRow < 0) { int nLeft = 0; for (int i = 0; i < number; i++) { int iRow = index[i]; if (fabs(infeas[iRow]) > 1.0e-50) { index[nLeft++] = iRow; } else { infeas[iRow] = 0.0; } } infeasible_->setNumElements(nLeft); model_->setNumberPrimalInfeasibilities(nLeft); } if (true&&(model_->stateOfProblem()&VALUES_PASS2)!=0) { if (chosenRow>=0) { double * fakeDjs = model_->fakeDjs(); //const int * pivotVariable = model_->pivotVariable(); fakeDjs[pivotVariable[chosenRow]]=0.0; } } return chosenRow; } //#define PRINT_WEIGHTS_FREQUENCY #ifdef PRINT_WEIGHTS_FREQUENCY int xweights1=0; int xweights2=0; int xweights3=0; #endif /* Updates weights and returns pivot alpha. Also does FT update */ double AbcDualRowSteepest::updateWeights(CoinIndexedVector & input, CoinIndexedVector & updateColumn) { double * COIN_RESTRICT weights = weights_->denseVector(); #if CLP_DEBUG>2 // Very expensive debug { int numberRows = model_->numberRows(); CoinIndexedVector temp; temp.reserve(numberRows); double * array = temp.denseVector(); int * which = temp.getIndices(); for (int i = 0; i < numberRows; i++) { double value = 0.0; array[i] = 1.0; which[0] = i; temp.setNumElements(1); model_->factorization()->updateColumnTranspose(temp); int number = temp.getNumElements(); for (int j = 0; j < number; j++) { int iRow = which[j]; value += array[iRow] * array[iRow]; array[iRow] = 0.0; } temp.setNumElements(0); double w = CoinMax(weights[i], value) * .1; if (fabs(weights[i] - value) > w) { printf("%d old %g, true %g\n", i, weights[i], value); weights[i] = value; // to reduce printout } } } #endif double alpha = 0.0; double norm = 0.0; int i; double * COIN_RESTRICT work2 = input.denseVector(); int numberNonZero = input.getNumElements(); int * COIN_RESTRICT which = input.getIndices(); //compute norm for (int i = 0; i < numberNonZero; i ++ ) { int iRow = which[i]; double value = work2[iRow]; norm += value * value; } // Do FT update if (true) { model_->factorization()->updateTwoColumnsFT(updateColumn,input); #if CLP_DEBUG>3 printf("REGION after %d els\n", input.getNumElements()); input.print(); #endif } else { // Leave as old way model_->factorization()->updateColumnFT(updateColumn); model_->factorization()->updateColumn(input); } //#undef CLP_DEBUG numberNonZero = input.getNumElements(); int pivotRow = model_->lastPivotRow(); assert (model_->pivotRow()==model_->lastPivotRow()); #ifdef CLP_DEBUG if ( model_->logLevel ( ) > 4 && fabs(norm - weights[pivotRow]) > 1.0e-2 * (1.0 + norm)) printf("on row %d, true weight %g, old %g\n", pivotRow, sqrt(norm), sqrt(weights[pivotRow])); #endif // could re-initialize here (could be expensive) norm /= model_->alpha() * model_->alpha(); assert(model_->alpha()); assert(norm); double multiplier = 2.0 / model_->alpha(); #ifdef PRINT_WEIGHTS_FREQUENCY xweights1++; if ((xweights1+xweights2+xweights3)%100==0) { printf("ZZ iteration %d sum weights %d - %d %d %d\n", model_->numberIterations(),xweights1+xweights2+xweights3,xweights1,xweights2,xweights3); assert(abs(model_->numberIterations()-(xweights1+xweights2+xweights3))<=1); } #endif // look at updated column double * COIN_RESTRICT work = updateColumn.denseVector(); numberNonZero = updateColumn.getNumElements(); which = updateColumn.getIndices(); // pivot element alpha=work[pivotRow]; for (i = 0; i < numberNonZero; i++) { int iRow = which[i]; double theta = work[iRow]; double devex = weights[iRow]; //work3[iRow] = devex; // save old //which3[nSave++] = iRow; double value = work2[iRow]; devex += theta * (theta * norm + value * multiplier); if (devex < DEVEX_TRY_NORM) devex = DEVEX_TRY_NORM; weights[iRow] = devex; } if (norm < DEVEX_TRY_NORM) norm = DEVEX_TRY_NORM; // Try this to make less likely will happen again and stop cycling //norm *= 1.02; weights[pivotRow] = norm; input.clear(); #ifdef CLP_DEBUG input.checkClear(); #endif #ifdef CLP_DEBUG input.checkClear(); #endif return alpha; } double AbcDualRowSteepest::updateWeights1(CoinIndexedVector & input,CoinIndexedVector & updateColumn) { if (mode_==2) { abort(); // no update // Do FT update model_->factorization()->updateColumnFT(updateColumn); // pivot element double alpha = 0.0; // look at updated column double * work = updateColumn.denseVector(); int pivotRow = model_->lastPivotRow(); assert (pivotRow == model_->pivotRow()); assert (!updateColumn.packedMode()); alpha = work[pivotRow]; return alpha; } #if CLP_DEBUG>2 // Very expensive debug { double * weights = weights_->denseVector(); int numberRows = model_->numberRows(); const int * pivotVariable = model_->pivotVariable(); CoinIndexedVector temp; temp.reserve(numberRows); double * array = temp.denseVector(); int * which = temp.getIndices(); for (int i = 0; i < numberRows; i++) { double value = 0.0; array[i] = 1.0; which[0] = i; temp.setNumElements(1); model_->factorization()->updateColumnTranspose(temp); int number = temp.getNumElements(); for (int j = 0; j < number; j++) { int iRow = which[j]; value += array[iRow] * array[iRow]; array[iRow] = 0.0; } temp.setNumElements(0); double w = CoinMax(weights[i], value) * .1; if (fabs(weights[i] - value) > w) { printf("XX row %d (variable %d) old %g, true %g\n", i, pivotVariable[i], weights[i], value); weights[i] = value; // to reduce printout } } } #endif norm_ = 0.0; double * COIN_RESTRICT work2 = input.denseVector(); int numberNonZero = input.getNumElements(); int * COIN_RESTRICT which = input.getIndices(); //compute norm for (int i = 0; i < numberNonZero; i ++ ) { int iRow = which[i]; double value = work2[iRow]; norm_ += value * value; } // Do FT update if (true) { model_->factorization()->updateTwoColumnsFT(updateColumn,input); #if CLP_DEBUG>3 printf("REGION after %d els\n", input.getNumElements()); input.print(); #endif } else { // Leave as old way model_->factorization()->updateColumnFT(updateColumn); model_->factorization()->updateWeights(input); } // pivot element assert (model_->pivotRow()==model_->lastPivotRow()); return updateColumn.denseVector()[model_->lastPivotRow()]; } void AbcDualRowSteepest::updateWeightsOnly(CoinIndexedVector & input) { if (mode_==2) return; norm_ = 0.0; double * COIN_RESTRICT work2 = input.denseVector(); int numberNonZero = input.getNumElements(); int * COIN_RESTRICT which = input.getIndices(); //compute norm for (int i = 0; i < numberNonZero; i ++ ) { int iRow = which[i]; double value = work2[iRow]; norm_ += value * value; } model_->factorization()->updateWeights(input); } // Actually updates weights void AbcDualRowSteepest::updateWeights2(CoinIndexedVector & input,CoinIndexedVector & updateColumn) { if (mode_==2) return; double * COIN_RESTRICT weights = weights_->denseVector(); const double * COIN_RESTRICT work2 = input.denseVector(); int pivotRow = model_->lastPivotRow(); assert (model_->pivotRow()==model_->lastPivotRow()); #ifdef CLP_DEBUG if ( model_->logLevel ( ) > 4 && fabs(norm_ - weights[pivotRow]) > 1.0e-2 * (1.0 + norm_)) printf("on row %d, true weight %g, old %g\n", pivotRow, sqrt(norm_), sqrt(weights[pivotRow])); #endif // pivot element double alpha=model_->alpha(); // could re-initialize here (could be expensive) norm_ /= alpha * alpha; assert(alpha); assert(norm_); double multiplier = 2.0 / alpha; // look at updated column const double * COIN_RESTRICT work = updateColumn.denseVector(); int numberNonZero = updateColumn.getNumElements(); const int * which = updateColumn.getIndices(); double multiplier2=1.0; #ifdef PRINT_WEIGHTS_FREQUENCY xweights2++; if ((xweights1+xweights2+xweights3)%100==0) { printf("ZZ iteration %d sum weights %d - %d %d %d\n", model_->numberIterations(),xweights1+xweights2+xweights3,xweights1,xweights2,xweights3); assert(abs(model_->numberIterations()-(xweights1+xweights2+xweights3))<=1); } #endif if (model_->directionOut()<0) { #ifdef ABC_DEBUG printf("Minus out in %d %d, out %d %d\n",model_->sequenceIn(),model_->directionIn(), model_->sequenceOut(),model_->directionOut()); #endif multiplier2=-1.0; } for (int i = 0; i < numberNonZero; i++) { int iRow = which[i]; double theta = multiplier2*work[iRow]; double devex = weights[iRow]; double value = work2[iRow]; devex += theta * (theta * norm_ + value * multiplier); if (devex < DEVEX_TRY_NORM) devex = DEVEX_TRY_NORM; weights[iRow] = devex; } if (norm_ < DEVEX_TRY_NORM) norm_ = DEVEX_TRY_NORM; // Try this to make less likely will happen again and stop cycling //norm_ *= 1.02; weights[pivotRow] = norm_; input.clear(); #ifdef CLP_DEBUG input.checkClear(); #endif } /* Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Computes change in objective function */ void AbcDualRowSteepest::updatePrimalSolution( CoinIndexedVector & primalUpdate, double primalRatio) { double * COIN_RESTRICT work = primalUpdate.denseVector(); int number = primalUpdate.getNumElements(); int * COIN_RESTRICT which = primalUpdate.getIndices(); double tolerance = model_->currentPrimalTolerance(); double * COIN_RESTRICT infeas = infeasible_->denseVector(); double * COIN_RESTRICT solutionBasic = model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic = model_->lowerBasic(); const double * COIN_RESTRICT upperBasic = model_->upperBasic(); assert (!primalUpdate.packedMode()); for (int i = 0; i < number; i++) { int iRow = which[i]; double value = solutionBasic[iRow]; double change = primalRatio * work[iRow]; // no need to keep for steepest edge work[iRow] = 0.0; value -= change; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; solutionBasic[iRow] = value; if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (infeas[iRow]) infeas[iRow] = value; // already there else infeasible_->quickAdd(iRow, value); } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (infeas[iRow]) infeas[iRow] = value; // already there else infeasible_->quickAdd(iRow, value); } else { // feasible - was it infeasible - if so set tiny if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } // Do pivot row int iRow = model_->lastPivotRow(); assert (model_->pivotRow()==model_->lastPivotRow()); // feasible - was it infeasible - if so set tiny //assert (infeas[iRow]); if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; primalUpdate.setNumElements(0); } #if ABC_PARALLEL==2 static void update(int first, int last, const int * COIN_RESTRICT which, double * COIN_RESTRICT work, const double * COIN_RESTRICT work2, double * COIN_RESTRICT weights, const double * COIN_RESTRICT lowerBasic,double * COIN_RESTRICT solutionBasic, const double * COIN_RESTRICT upperBasic, double multiplier,double multiplier2, double norm,double theta,double tolerance) { if (last-first>256) { int mid=(last+first)>>1; cilk_spawn update(first,mid,which,work,work2,weights,lowerBasic,solutionBasic, upperBasic,multiplier,multiplier2,norm,theta,tolerance); update(mid,last,which,work,work2,weights,lowerBasic,solutionBasic, upperBasic,multiplier,multiplier2,norm,theta,tolerance); cilk_sync; } else { for (int i = first; i < last; i++) { int iRow = which[i]; double updateValue = work[iRow]; double thetaDevex = multiplier2*updateValue; double devex = weights[iRow]; double valueDevex = work2[iRow]; devex += thetaDevex * (thetaDevex * norm + valueDevex * multiplier); if (devex < DEVEX_TRY_NORM) devex = DEVEX_TRY_NORM; weights[iRow] = devex; double value = solutionBasic[iRow]; double change = theta * updateValue; value -= change; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; solutionBasic[iRow] = value; if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif } else { // feasible value=0.0; } // store square work[iRow]=value; } } } #endif void AbcDualRowSteepest::updatePrimalSolutionAndWeights(CoinIndexedVector & weightsVector, CoinIndexedVector & primalUpdate, double theta) { //printf("updatePrimal iteration %d - weightsVector has %d, primalUpdate has %d\n", // model_->numberIterations(),weightsVector.getNumElements(),primalUpdate.getNumElements()); double * COIN_RESTRICT weights = weights_->denseVector(); double * COIN_RESTRICT work2 = weightsVector.denseVector(); int pivotRow = model_->lastPivotRow(); assert (model_->pivotRow()==model_->lastPivotRow()); double * COIN_RESTRICT work = primalUpdate.denseVector(); int numberNonZero = primalUpdate.getNumElements(); int * COIN_RESTRICT which = primalUpdate.getIndices(); double tolerance = model_->currentPrimalTolerance(); double * COIN_RESTRICT infeas = infeasible_->denseVector(); double * COIN_RESTRICT solutionBasic = model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic = model_->lowerBasic(); const double * COIN_RESTRICT upperBasic = model_->upperBasic(); assert (!primalUpdate.packedMode()); #ifdef CLP_DEBUG if ( model_->logLevel ( ) > 4 && fabs(norm_ - weights[pivotRow]) > 1.0e-2 * (1.0 + norm_)) printf("on row %d, true weight %g, old %g\n", pivotRow, sqrt(norm_), sqrt(weights[pivotRow])); #endif // pivot element double alpha=model_->alpha(); // could re-initialize here (could be expensive) norm_ /= alpha * alpha; assert(alpha); assert(norm_); double multiplier = 2.0 / alpha; #ifdef PRINT_WEIGHTS_FREQUENCY // only weights3 is used? - slightly faster to just update weights if going to invert xweights3++; if ((xweights1+xweights2+xweights3)%1000==0) { printf("ZZ iteration %d sum weights %d - %d %d %d\n", model_->numberIterations(),xweights1+xweights2+xweights3,xweights1,xweights2,xweights3); assert(abs(model_->numberIterations()-(xweights1+xweights2+xweights3))<=1); } #endif // look at updated column double multiplier2=1.0; if (model_->directionOut()<0) { #ifdef ABC_DEBUG printf("Minus out in %d %d, out %d %d\n",model_->sequenceIn(),model_->directionIn(), model_->sequenceOut(),model_->directionOut()); #endif multiplier2=-1.0; } #if ABC_PARALLEL==2 update(0,numberNonZero,which,work,work2,weights, lowerBasic,solutionBasic,upperBasic, multiplier,multiplier2,norm_,theta,tolerance); for (int i = 0; i < numberNonZero; i++) { int iRow = which[i]; double infeasibility=work[iRow]; work[iRow]=0.0; if (infeasibility) { if (infeas[iRow]) infeas[iRow] = infeasibility; // already there else infeasible_->quickAdd(iRow, infeasibility); } else { // feasible - was it infeasible - if so set tiny if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } #else for (int i = 0; i < numberNonZero; i++) { int iRow = which[i]; double updateValue = work[iRow]; work[iRow]=0.0; double thetaDevex = multiplier2*updateValue; double devex = weights[iRow]; double valueDevex = work2[iRow]; devex += thetaDevex * (thetaDevex * norm_ + valueDevex * multiplier); if (devex < DEVEX_TRY_NORM) devex = DEVEX_TRY_NORM; weights[iRow] = devex; double value = solutionBasic[iRow]; double change = theta * updateValue; value -= change; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; solutionBasic[iRow] = value; if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (infeas[iRow]) infeas[iRow] = value; // already there else infeasible_->quickAdd(iRow, value); } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list if (infeas[iRow]) infeas[iRow] = value; // already there else infeasible_->quickAdd(iRow, value); } else { // feasible - was it infeasible - if so set tiny if (infeas[iRow]) infeas[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } #endif weightsVector.clear(); primalUpdate.setNumElements(0); #ifdef CLP_DEBUG weightsVector.checkClear(); #endif // Do pivot row if (norm_ < DEVEX_TRY_NORM) norm_ = DEVEX_TRY_NORM; // Try this to make less likely will happen again and stop cycling //norm_ *= 1.02; weights[pivotRow] = norm_; // feasible - was it infeasible - if so set tiny //assert (infeas[iRow]); if (infeas[pivotRow]) infeas[pivotRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; // see 1/2 above primalUpdate.setNumElements(0); } extern void parallelDual5(AbcSimplexFactorization * factorization, CoinIndexedVector ** whichVector, int numberCpu, int whichCpu, double * weights); /* Saves any weights round factorization as pivot rows may change 1) before factorization 2) after factorization 3) just redo infeasibilities 4) restore weights */ void AbcDualRowSteepest::saveWeights(AbcSimplex * model, int mode) { model_ = model; int numberRows = model_->numberRows(); // faster to save indices in array numberTotal in length const int * pivotVariable = model_->pivotVariable(); double * weights = weights_ ? weights_->denseVector() : NULL; // see if we need to switch //if (mode_==2&&mode==2) { // switch //mode=5; //} if (mode == 1) { if(weights_) { // Check if size has changed if (infeasible_->capacity() == numberRows) { // change from row numbers to sequence numbers CoinAbcMemcpy(weights_->getIndices(),pivotVariable,numberRows); state_ = 1; } else { // size has changed - clear everything delete weights_; weights_ = NULL; delete infeasible_; infeasible_ = NULL; delete savedWeights_; savedWeights_ = NULL; state_ = -1; } } } else if (mode !=3) { // restore if (!weights_ || state_ == -1 || mode == 5) { // see if crash basis??? int numberBasicSlacks=0; bool initializeNorms=false; for (int i=0;igetInternalStatus(i)==AbcSimplex::basic) numberBasicSlacks++; } if (numberBasicSlacksnumberIterations()) { char line[100]; if (numberBasicSlacks>numberRows-(numberRows>>1)&&mode_==3&& (model_->moreSpecialOptions()&256)==0) { sprintf(line,"Steep initial basis has %d structurals out of %d - initializing norms\n",numberRows-numberBasicSlacks,numberRows); initializeNorms=true; } else { sprintf(line,"Steep initial basis has %d structurals out of %d - too many\n",numberRows-numberBasicSlacks,numberRows); } model_->messageHandler()->message(CLP_GENERAL2,*model_->messagesPointer()) << line << CoinMessageEol; } // initialize weights delete weights_; delete savedWeights_; delete infeasible_; weights_ = new CoinIndexedVector(); weights_->reserve(numberRows); savedWeights_ = new CoinIndexedVector(); // allow for dense multiple of 8! savedWeights_->reserve(numberRows+((initializeNorms) ? 8 : 0)); infeasible_ = new CoinIndexedVector(); infeasible_->reserve(numberRows); weights = weights_->denseVector(); if (mode == 5||(mode_!=1&&!initializeNorms)) { // initialize to 1.0 (can we do better?) for (int i = 0; i < numberRows; i++) { weights[i] = 1.0; } } else { double * COIN_RESTRICT array = savedWeights_->denseVector(); int * COIN_RESTRICT which = savedWeights_->getIndices(); // Later look at factorization to see which can be skipped // also use threads to parallelize #if 0 // use infeasible to collect row counts int * COIN_RESTRICT counts = infeasible_->getIndices(); CoinAbcMemset0(counts,numberRows); // get matrix data pointers int maximumRows = model_->maximumAbcNumberRows(); const CoinBigIndex * columnStart = model_->abcMatrix()->getPackedMatrix()->getVectorStarts()-maximumRows; //const int * columnLength = model_->abcMatrix()->getPackedMatrix()->getVectorLengths()-maximumRows; const int * row = model_->abcMatrix()->getPackedMatrix()->getIndices(); const int * pivotVariable = model_->pivotVariable(); for (int i = 0; i < numberRows; i++) { int iSequence = pivotVariable[i]; if (iSequence>=numberRows) { for (CoinBigIndex j=columnStart[iSequence];jparallelMode()==0) { #endif for (int i = 0; i < numberRows; i++) { double value = 0.0; array[i] = 1.0; which[0] = i; savedWeights_->setNumElements(1); model_->factorization()->updateColumnTranspose(*savedWeights_); int number = savedWeights_->getNumElements(); for (int j = 0; j < number; j++) { int k= which[j]; value += array[k] * array[k]; array[k] = 0.0; } #if 0 if (!counts[i]) { assert (value==1.0); nSlack++; } #endif savedWeights_->setNumElements(0); weights[i] = value; } #if ABC_PARALLEL==2 } else { // parallel // get arrays int numberCpuMinusOne=CoinMin(model_->parallelMode(),3); int which[3]; CoinIndexedVector * whichVector[4]; for (int i=0;igetAvailableArray(); whichVector[i]=model_->usefulArray(which[i]); assert(!whichVector[i]->packedMode()); } whichVector[numberCpuMinusOne]=savedWeights_; parallelDual5(model_->factorization(),whichVector,numberCpuMinusOne+1,numberCpuMinusOne,weights); for (int i=0;iclearArrays(which[i]); } #endif #if 0 printf("Steep %d can be skipped\n",nSlack); #endif } } else { int useArray=model_->getAvailableArrayPublic(); CoinIndexedVector * usefulArray = model_->usefulArray(useArray); int * COIN_RESTRICT which = usefulArray->getIndices(); double * COIN_RESTRICT element = usefulArray->denseVector(); if (mode!=4) { CoinAbcMemcpy(which,weights_->getIndices(),numberRows); CoinAbcScatterTo(weights_->denseVector(),element,which,numberRows); } else { // restore weights CoinAbcMemcpy(which,savedWeights_->getIndices(),numberRows); CoinAbcScatterTo(savedWeights_->denseVector(),element,which,numberRows); } for (int i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; double thisWeight=element[iPivot]; if (thisWeight) { if (thisWeight < DEVEX_TRY_NORM) thisWeight = DEVEX_TRY_NORM; // may need to check more weights[i] = thisWeight; } else { // odd weights[i] = 1.0; } } if (0) { double w[1000]; int s[1000]; assert (numberRows<=1000); memcpy(w,weights,numberRows*sizeof(double)); memcpy(s,pivotVariable,numberRows*sizeof(int)); CoinSort_2(s,s+numberRows,w); printf("Weights===========\n"); for (int i=0;isetNumElements(numberRows); usefulArray->clear(); // won't be done in parallel model_->clearArraysPublic(useArray); } state_ = 0; CoinAbcMemcpy(savedWeights_->denseVector(),weights_->denseVector(),numberRows); CoinAbcMemcpy(savedWeights_->getIndices(),pivotVariable,numberRows); } if (mode >= 2) { infeasible_->clear(); double tolerance = model_->currentPrimalTolerance(); const double * COIN_RESTRICT solutionBasic = model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic = model_->lowerBasic(); const double * COIN_RESTRICT upperBasic = model_->upperBasic(); if ((model_->stateOfProblem()&VALUES_PASS2)==0) { for (int iRow = 0; iRow < numberRows; iRow++) { double value = solutionBasic[iRow]; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list infeasible_->quickAdd(iRow, value); } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list infeasible_->quickAdd(iRow, value); } } } else { // check values pass const double * fakeDjs = model_->fakeDjs(); int numberFake=0; for (int iRow = 0; iRow < numberRows; iRow++) { double value = solutionBasic[iRow]; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; if (value < lower - tolerance) { value -= lower; } else if (value > upper + tolerance) { value -= upper; } else { value=0.0; } if (value) { value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list infeasible_->quickAdd(iRow, value); int iSequence=pivotVariable[iRow]; double fakeDj=fakeDjs[iSequence]; if (fabs(fakeDj)>10.0*tolerance) numberFake++; } } if (numberFake) printf("%d fake basic djs\n",numberFake); else model_->setStateOfProblem(model_->stateOfProblem()&~VALUES_PASS2); } } } // Recompute infeasibilities void AbcDualRowSteepest::recomputeInfeasibilities() { int numberRows = model_->numberRows(); infeasible_->clear(); double tolerance = model_->currentPrimalTolerance(); const double * COIN_RESTRICT solutionBasic = model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic = model_->lowerBasic(); const double * COIN_RESTRICT upperBasic = model_->upperBasic(); for (int iRow = 0; iRow < numberRows; iRow++) { double value = solutionBasic[iRow]; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; if (value < lower - tolerance) { value -= lower; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list infeasible_->quickAdd(iRow, value); } else if (value > upper + tolerance) { value -= upper; value *= value; #ifdef CLP_DUAL_FIXED_COLUMN_MULTIPLIER if (lower == upper) value *= CLP_DUAL_FIXED_COLUMN_MULTIPLIER; // bias towards taking out fixed variables #endif // store square in list infeasible_->quickAdd(iRow, value); } } } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- AbcDualRowPivot * AbcDualRowSteepest::clone(bool CopyData) const { if (CopyData) { return new AbcDualRowSteepest(*this); } else { return new AbcDualRowSteepest(); } } // Gets rid of all arrays void AbcDualRowSteepest::clearArrays() { if (persistence_ == normal) { delete weights_; weights_ = NULL; delete infeasible_; infeasible_ = NULL; delete savedWeights_; savedWeights_ = NULL; } state_ = -1; } // Returns true if would not find any row bool AbcDualRowSteepest::looksOptimal() const { int iRow; double tolerance = model_->currentPrimalTolerance(); // we can't really trust infeasibilities if there is primal error // this coding has to mimic coding in checkPrimalSolution double error = CoinMin(1.0e-2, model_->largestPrimalError()); // allow tolerance at least slightly bigger than standard tolerance = tolerance + error; // But cap tolerance = CoinMin(1000.0, tolerance); int numberRows = model_->numberRows(); int numberInfeasible = 0; const double * COIN_RESTRICT solutionBasic = model_->solutionBasic(); const double * COIN_RESTRICT lowerBasic = model_->lowerBasic(); const double * COIN_RESTRICT upperBasic = model_->upperBasic(); for (iRow = 0; iRow < numberRows; iRow++) { double value = solutionBasic[iRow]; double lower = lowerBasic[iRow]; double upper = upperBasic[iRow]; if (value < lower - tolerance) { numberInfeasible++; } else if (value > upper + tolerance) { numberInfeasible++; } } return (numberInfeasible == 0); } CoinMP-1.8.3/Clp/src/ClpConfig.h0000644000175000017500000000242411573730475014654 0ustar renerene/* Copyright (C) 2011 * All Rights Reserved. * This code is published under the Eclipse Public License. * * $Id: ClpConfig.h 1734 2011-06-08 17:28:29Z stefan $ * * Include file for the configuration of Clp. * * On systems where the code is configured with the configure script * (i.e., compilation is always done with HAVE_CONFIG_H defined), this * header file includes the automatically generated header file. * * On systems that are compiled in other ways (e.g., with the * Developer Studio), a header files is included to define those * macros that depend on the operating system and the compiler. The * macros that define the configuration of the particular user setting * (e.g., presence of other COIN-OR packages or third party code) are set * by the files config_*default.h. The project maintainer needs to remember * to update these file and choose reasonable defines. * A user can modify the default setting by editing the config_*default.h files. */ #ifndef __CLPCONFIG_H__ #define __CLPCONFIG_H__ #ifdef HAVE_CONFIG_H #ifdef CLP_BUILD #include "config.h" #else #include "config_clp.h" #endif #else /* HAVE_CONFIG_H */ #ifdef CLP_BUILD #include "config_default.h" #else #include "config_clp_default.h" #endif #endif /* HAVE_CONFIG_H */ #endif /*__CLPCONFIG_H__*/ CoinMP-1.8.3/Clp/src/AbcSimplex.cpp0000644000175000017500000064364712452503025015376 0ustar renerene/* $Id: AbcSimplex.cpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2000, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "ClpConfig.h" #include "CoinPragma.hpp" #include //#define ABC_DEBUG 2 #if SLIM_CLP==2 #define SLIM_NOIO #endif #include "CoinHelperFunctions.hpp" #include "CoinFloatEqual.hpp" #include "ClpSimplex.hpp" #include "AbcSimplex.hpp" #include "AbcSimplexDual.hpp" #include "AbcSimplexFactorization.hpp" #include "AbcNonLinearCost.hpp" #include "CoinAbcCommon.hpp" #include "AbcMatrix.hpp" #include "CoinIndexedVector.hpp" #include "AbcDualRowDantzig.hpp" #include "AbcDualRowSteepest.hpp" #include "AbcPrimalColumnDantzig.hpp" #include "AbcPrimalColumnSteepest.hpp" #include "ClpMessage.hpp" #include "ClpEventHandler.hpp" #include "ClpLinearObjective.hpp" #include "CoinAbcHelperFunctions.hpp" #include "CoinModel.hpp" #include "CoinLpIO.hpp" #include #include #include #include //############################################################################# AbcSimplex::AbcSimplex (bool emptyMessages) : ClpSimplex(emptyMessages) { gutsOfDelete(0); gutsOfInitialize(0,0,true); assert (maximumAbcNumberRows_>=0); //printf("XX %x AbcSimplex constructor\n",this); } //----------------------------------------------------------------------------- AbcSimplex::~AbcSimplex () { //printf("XX %x AbcSimplex destructor\n",this); gutsOfDelete(1); } // Copy constructor. AbcSimplex::AbcSimplex(const AbcSimplex &rhs) : ClpSimplex(rhs) { //printf("XX %x AbcSimplex constructor from %x\n",this,&rhs); gutsOfDelete(0); gutsOfInitialize(numberRows_,numberColumns_,false); gutsOfCopy(rhs); assert (maximumAbcNumberRows_>=0); } #include "ClpDualRowSteepest.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "ClpFactorization.hpp" // Copy constructor from model AbcSimplex::AbcSimplex(const ClpSimplex &rhs) : ClpSimplex(rhs) { //printf("XX %x AbcSimplex constructor from ClpSimplex\n",this); gutsOfDelete(0); gutsOfInitialize(numberRows_,numberColumns_,true); gutsOfResize(numberRows_,numberColumns_); // Set up row/column selection and factorization type ClpDualRowSteepest * pivot = dynamic_cast(rhs.dualRowPivot()); if (pivot) { AbcDualRowSteepest steep(pivot->mode()); setDualRowPivotAlgorithm(steep); } else { AbcDualRowDantzig dantzig; setDualRowPivotAlgorithm(dantzig); } ClpPrimalColumnSteepest * pivotColumn = dynamic_cast(rhs.primalColumnPivot()); if (pivotColumn) { AbcPrimalColumnSteepest steep(pivotColumn->mode()); setPrimalColumnPivotAlgorithm(steep); } else { AbcPrimalColumnDantzig dantzig; setPrimalColumnPivotAlgorithm(dantzig); } //if (rhs.factorization()->) //factorization_->forceOtherFactorization(); factorization()->synchronize(rhs.factorization(),this); //factorization_->setGoDenseThreshold(rhs.factorization()->goDenseThreshold()); //factorization_->setGoSmallThreshold(rhs.factorization()->goSmallThreshold()); translate(DO_SCALE_AND_MATRIX|DO_BASIS_AND_ORDER|DO_STATUS|DO_SOLUTION); assert (maximumAbcNumberRows_>=0); } // Assignment operator. This copies the data AbcSimplex & AbcSimplex::operator=(const AbcSimplex & rhs) { if (this != &rhs) { gutsOfDelete(1); ClpSimplex::operator=(rhs); gutsOfCopy(rhs); assert (maximumAbcNumberRows_>=0); } return *this; } // fills in perturbationSaved_ from start with 0.5+random void AbcSimplex::fillPerturbation(int start, int number) { double * array = perturbationSaved_+start; for (int i=0;i= numberRows_); //assert (maximumInternalColumns_ >= numberColumns_); // Copy all scalars CoinAbcMemcpy(reinterpret_cast(&sumNonBasicCosts_), reinterpret_cast(&rhs.sumNonBasicCosts_), (&swappedAlgorithm_-reinterpret_cast(&sumNonBasicCosts_))+1); // could add 2 so can go off end int sizeArray=2*maximumNumberTotal_+maximumAbcNumberRows_; internalStatus_ = ClpCopyOfArray(rhs.internalStatus_,sizeArray+maximumNumberTotal_); abcLower_ = ClpCopyOfArray(rhs.abcLower_, sizeArray); abcUpper_ = ClpCopyOfArray(rhs.abcUpper_, sizeArray); abcCost_ = ClpCopyOfArray(rhs.abcCost_, sizeArray+maximumNumberTotal_); abcDj_ = ClpCopyOfArray(rhs.abcDj_, sizeArray); abcSolution_ = ClpCopyOfArray(rhs.abcSolution_, sizeArray+maximumNumberTotal_); abcPerturbation_ = ClpCopyOfArray(rhs.abcPerturbation_,sizeArray); abcPivotVariable_ = ClpCopyOfArray(rhs.abcPivotVariable_,maximumAbcNumberRows_); //fromExternal_ = ClpCopyOfArray(rhs.fromExternal_,sizeArray); //toExternal_ = ClpCopyOfArray(rhs.toExternal_,sizeArray); scaleFromExternal_ = ClpCopyOfArray(rhs.scaleFromExternal_,sizeArray); offset_ = ClpCopyOfArray(rhs.offset_,sizeArray); setupPointers(maximumAbcNumberRows_,maximumAbcNumberColumns_); if (rhs.abcMatrix_) abcMatrix_ = new AbcMatrix(*rhs.abcMatrix_); else abcMatrix_ = NULL; for (int i = 0; i < ABC_NUMBER_USEFUL; i++) { usefulArray_[i] = rhs.usefulArray_[i]; } if (rhs.abcFactorization_) { setFactorization(*rhs.abcFactorization_); } else { delete abcFactorization_; abcFactorization_ = NULL; } #ifdef EARLY_FACTORIZE delete abcEarlyFactorization_; if (rhs.abcEarlyFactorization_) { abcEarlyFactorization_ = new AbcSimplexFactorization(*rhs.abcEarlyFactorization_); } else { abcEarlyFactorization_ = NULL; } #endif abcDualRowPivot_ = rhs.abcDualRowPivot_->clone(true); abcDualRowPivot_->setModel(this); abcPrimalColumnPivot_ = rhs.abcPrimalColumnPivot_->clone(true); abcPrimalColumnPivot_->setModel(this); if (rhs.abcBaseModel_) { abcBaseModel_ = new AbcSimplex(*rhs.abcBaseModel_); } else { abcBaseModel_ = NULL; } if (rhs.clpModel_) { clpModel_ = new ClpSimplex(*rhs.clpModel_); } else { clpModel_ = NULL; } abcProgress_ = rhs.abcProgress_; solveType_ = rhs.solveType_; } // type == 0 nullify, 1 also delete void AbcSimplex::gutsOfDelete(int type) { if (type) { delete [] abcLower_; delete [] abcUpper_; delete [] abcCost_; delete [] abcDj_; delete [] abcSolution_; //delete [] fromExternal_ ; //delete [] toExternal_ ; delete [] scaleFromExternal_ ; //delete [] scaleToExternal_ ; delete [] offset_ ; delete [] internalStatus_ ; delete [] abcPerturbation_ ; delete abcMatrix_ ; delete abcFactorization_; #ifdef EARLY_FACTORIZE delete abcEarlyFactorization_; #endif delete [] abcPivotVariable_; delete abcDualRowPivot_; delete abcPrimalColumnPivot_; delete abcBaseModel_; delete clpModel_; delete abcNonLinearCost_; } CoinAbcMemset0(reinterpret_cast(&scaleToExternal_), reinterpret_cast(&usefulArray_[0])-reinterpret_cast(&scaleToExternal_)); } template T * newArray(T * /*nullArray*/, int size) { if (size) { T * arrayNew = new T[size]; #ifndef NDEBUG memset(arrayNew,'A',(size)*sizeof(T)); #endif return arrayNew; } else { return NULL; } } template T * resizeArray( T * array, int oldSize1, int oldSize2, int newSize1, int newSize2,int extra) { if ((array||!oldSize1)&&(newSize1!=oldSize1||newSize2!=oldSize2)) { int newTotal=newSize1+newSize2; int oldTotal=oldSize1+oldSize2; T * arrayNew; if (newSize1>oldSize1||newSize2>oldSize2) { arrayNew = new T[2*newTotal+newSize1+extra]; #ifndef NDEBUG memset(arrayNew,'A',(2*newTotal+newSize1+extra)*sizeof(T)); #endif CoinAbcMemcpy(arrayNew,array,oldSize1); CoinAbcMemcpy(arrayNew+newSize1,array+oldSize1,oldSize2); // and second half CoinAbcMemcpy(arrayNew+newTotal,array,oldSize1+oldTotal); CoinAbcMemcpy(arrayNew+newSize1+newTotal,array+oldSize1+oldTotal,oldSize2); delete [] array; } else { arrayNew=array; for (int i=0;i(&usefulArray_[0])-&sumNonBasicCosts_)); zeroTolerance_ = 1.0e-13; bestObjectiveValue_ = -COIN_DBL_MAX; primalToleranceToGetOptimal_ = -1.0; primalTolerance_ = 1.0e-6; //dualTolerance_ = 1.0e-6; alphaAccuracy_ = -1.0; upperIn_ = -COIN_DBL_MAX; lowerOut_ = -1; valueOut_ = -1; upperOut_ = -1; dualOut_ = -1; acceptablePivot_ = 1.0e-8; //dualBound_=1.0e9; sequenceIn_ = -1; directionIn_ = -1; sequenceOut_ = -1; directionOut_ = -1; pivotRow_ = -1; lastGoodIteration_ = -100; numberPrimalInfeasibilities_ = 100; numberRefinements_=1; changeMade_ = 1; forceFactorization_ = -1; if (perturbation_<50||(perturbation_>60&&perturbation_<100)) perturbation_ = 50; lastBadIteration_ = -999999; lastFlaggedIteration_ = -999999; // doesn't seem to be used firstFree_ = -1; incomingInfeasibility_ = 1.0; allowedInfeasibility_ = 10.0; solveType_ = 1; // say simplex based life form //specialOptions_|=65536; //ClpModel::startPermanentArrays(); maximumInternalRows_ =0; maximumInternalColumns_ =0; numberRows_=numberRows; numberColumns_=numberColumns; numberTotal_=numberRows_+numberColumns_; maximumAbcNumberRows_=numberRows; maximumAbcNumberColumns_=numberColumns; maximumNumberTotal_=numberTotal_; int sizeArray=2*maximumNumberTotal_+maximumAbcNumberRows_; if (doMore) { // say Steepest pricing abcDualRowPivot_ = new AbcDualRowSteepest(); abcPrimalColumnPivot_ = new AbcPrimalColumnSteepest(); internalStatus_ = newArray(reinterpret_cast(NULL), sizeArray+maximumNumberTotal_); abcLower_ = newArray(reinterpret_cast(NULL),sizeArray); abcUpper_ = newArray(reinterpret_cast(NULL),sizeArray); abcCost_ = newArray(reinterpret_cast(NULL),sizeArray+maximumNumberTotal_); abcDj_ = newArray(reinterpret_cast(NULL),sizeArray); abcSolution_ = newArray(reinterpret_cast(NULL),sizeArray+maximumNumberTotal_); //fromExternal_ = newArray(reinterpret_cast(NULL),sizeArray); //toExternal_ = newArray(reinterpret_cast(NULL),sizeArray); scaleFromExternal_ = newArray(reinterpret_cast(NULL),sizeArray); offset_ = newArray(reinterpret_cast(NULL),sizeArray); abcPerturbation_ = newArray(reinterpret_cast(NULL),sizeArray); abcPivotVariable_ = newArray(reinterpret_cast(NULL),maximumAbcNumberRows_); // Fill perturbation array setupPointers(maximumAbcNumberRows_,maximumAbcNumberColumns_); fillPerturbation(0,maximumNumberTotal_); } // get an empty factorization so we can set tolerances etc getEmptyFactorization(); for (int i=0;imaximumAbcNumberRows_) newSize1=CoinMax(numberRows,maximumAbcNumberRows_+CoinMin(100,numberRows_/10)); int newSize2=CoinMax(numberColumns,maximumAbcNumberColumns_); numberRows_=numberRows; numberColumns_=numberColumns; numberTotal_=numberRows_+numberColumns_; //fromExternal_ = resizeArray(fromExternal_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,1); //toExternal_ = resizeArray(toExternal_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,1,0); scaleFromExternal_ = resizeArray(scaleFromExternal_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0); //scaleToExternal_ = resizeArray(scaleToExternal_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,1,0); internalStatus_ = resizeArray(internalStatus_,maximumAbcNumberRows_, maximumAbcNumberColumns_, newSize1,newSize2,numberTotal_); abcLower_ = resizeArray(abcLower_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0); abcUpper_ = resizeArray(abcUpper_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0); abcCost_ = resizeArray(abcCost_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,numberTotal_); abcDj_ = resizeArray(abcDj_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0); abcSolution_ = resizeArray(abcSolution_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,numberTotal_); abcPerturbation_ = resizeArray(abcPerturbation_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0); offset_ = resizeArray(offset_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0); setupPointers(newSize1,newSize2); // Fill gaps in perturbation array fillPerturbation(maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_); fillPerturbation(newSize1+maximumAbcNumberColumns_,newSize2-maximumAbcNumberColumns_); // Clean gap //CoinIotaN(fromExternal_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,maximumAbcNumberRows_); //CoinIotaN(toExternal_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,maximumAbcNumberRows_); CoinFillN(scaleFromExternal_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,1.0); CoinFillN(scaleToExternal_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,1.0); CoinFillN(internalStatusSaved_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,static_cast(1)); CoinFillN(lowerSaved_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,-COIN_DBL_MAX); CoinFillN(upperSaved_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,COIN_DBL_MAX); CoinFillN(costSaved_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,0.0); CoinFillN(djSaved_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,0.0); CoinFillN(solutionSaved_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,0.0); CoinFillN(offset_+maximumAbcNumberRows_,newSize1-maximumAbcNumberRows_,0.0); maximumAbcNumberRows_=newSize1; maximumAbcNumberColumns_=newSize2; maximumNumberTotal_=newSize1+newSize2; delete [] abcPivotVariable_; abcPivotVariable_ = new int[maximumAbcNumberRows_]; for (int i=0;isetModel(this); abcMatrix_->scale(scalingFlag_ ? 0 : -1); } if ((type&DO_STATUS)!=0&&(type&DO_BASIS_AND_ORDER)==0) { // from Clp enum to Abc enum (and bound flip) unsigned char lookupToAbcSlack[6]={4,6,0/*1*/,1/*0*/,5,7}; unsigned char * COIN_RESTRICT statusAbc=internalStatus_; const unsigned char * COIN_RESTRICT statusClp=status_; int i; for (i=numberRows_-1;i>=0;i--) { unsigned char status=statusClp[i]&7; bool basicClp=status==1; bool basicAbc=(statusAbc[i]&7)==4; if (basicClp==basicAbc) statusAbc[i]=lookupToAbcSlack[status]; else break; } if (!i) { // from Clp enum to Abc enum unsigned char lookupToAbc[6]={4,6,1,0,5,7}; statusAbc+=maximumAbcNumberRows_; statusClp+=maximumAbcNumberRows_; for (i=numberColumns_-1;i>=0;i--) { unsigned char status=statusClp[i]&7; bool basicClp=status==1; bool basicAbc=(statusAbc[i]&7)==4; if (basicClp==basicAbc) statusAbc[i]=lookupToAbc[status]; else break; } if (i) type |=DO_BASIS_AND_ORDER; } else { type |=DO_BASIS_AND_ORDER; } stateOfProblem_ |= DO_STATUS; } if ((type&DO_BASIS_AND_ORDER)!=0) { permuteIn(); permuteBasis(); stateOfProblem_ |= DO_BASIS_AND_ORDER; type &= ~DO_SOLUTION; } if ((type&DO_SOLUTION)!=0) { permuteBasis(); stateOfProblem_ |= DO_SOLUTION; } if ((type&DO_JUST_BOUNDS)!=0) { stateOfProblem_ |= DO_JUST_BOUNDS; } if (!type) { // just move stuff down CoinAbcMemcpy(abcLower_,abcLower_+maximumNumberTotal_,numberTotal_); CoinAbcMemcpy(abcUpper_,abcUpper_+maximumNumberTotal_,numberTotal_); CoinAbcMemcpy(abcCost_,abcCost_+maximumNumberTotal_,numberTotal_); } } #ifdef ABC_SPRINT // Overwrite to create sub problem (just internal arrays) - save full stuff AbcSimplex * AbcSimplex::createSubProblem(int numberColumns,const int * whichColumn) { int numberFullColumns = numberColumns_; numberColumns_ = numberColumns; AbcSimplex * subProblem = this; AbcSimplex * fullProblem = reinterpret_cast(new char[sizeof(AbcSimplex)]); memset(fullProblem,0,sizeof(AbcSimplex)); fullProblem->maximumAbcNumberRows_ = maximumAbcNumberRows_; fullProblem->numberColumns_ = numberFullColumns; fullProblem->numberTotal_ = numberTotal_; fullProblem->maximumNumberTotal_ = maximumNumberTotal_; fullProblem->numberTotalWithoutFixed_ = numberTotalWithoutFixed_; fullProblem->abcPrimalColumnPivot_ = abcPrimalColumnPivot_; fullProblem->internalStatus_ = internalStatus_; fullProblem->abcLower_ = abcLower_; fullProblem->abcUpper_ = abcUpper_; fullProblem->abcCost_ = abcCost_; fullProblem->abcDj_ = abcDj_; fullProblem->abcSolution_ = abcSolution_; fullProblem->scaleFromExternal_ = scaleFromExternal_; fullProblem->offset_ = offset_; fullProblem->abcPerturbation_ = abcPerturbation_; fullProblem->abcPivotVariable_ = abcPivotVariable_; fullProblem->abcMatrix_ = abcMatrix_; fullProblem->abcNonLinearCost_ = abcNonLinearCost_; fullProblem->setupPointers(maximumAbcNumberRows_,numberFullColumns); subProblem->numberTotal_= maximumAbcNumberRows_+numberColumns; subProblem->maximumNumberTotal_= maximumAbcNumberRows_+numberColumns; subProblem->numberTotalWithoutFixed_= subProblem->numberTotal_; int sizeArray=2*subProblem->maximumNumberTotal_+maximumAbcNumberRows_; subProblem->internalStatus_ = newArray(reinterpret_cast(NULL), sizeArray+subProblem->maximumNumberTotal_); subProblem->abcLower_ = newArray(reinterpret_cast(NULL),sizeArray); subProblem->abcUpper_ = newArray(reinterpret_cast(NULL),sizeArray); subProblem->abcCost_ = newArray(reinterpret_cast(NULL),sizeArray+subProblem->maximumNumberTotal_); subProblem->abcDj_ = newArray(reinterpret_cast(NULL),sizeArray); subProblem->abcSolution_ = newArray(reinterpret_cast(NULL),sizeArray+subProblem->maximumNumberTotal_); //fromExternal_ = newArray(reinterpret_cast(NULL),sizeArray); //toExternal_ = newArray(reinterpret_cast(NULL),sizeArray); subProblem->scaleFromExternal_ = newArray(reinterpret_cast(NULL),sizeArray); subProblem->offset_ = newArray(reinterpret_cast(NULL),sizeArray); subProblem->abcPerturbation_ = newArray(reinterpret_cast(NULL),sizeArray); subProblem->abcPivotVariable_ = newArray(reinterpret_cast(NULL),maximumAbcNumberRows_); subProblem->setupPointers(maximumAbcNumberRows_,numberColumns); // could use arrays - but for now be safe int * backward = new int [numberFullColumns+numberRows_]; int * whichRow = backward+numberFullColumns; for (int i=0;iabcPivotVariable_[i]; if (iPivotabcPivotVariable_[i]=iPivot; } else { assert(backward[iPivot-numberRows_]>=0); subProblem->abcPivotVariable_[i]=backward[iPivot-numberRows_]; } subProblem->internalStatus_[i] = fullProblem->internalStatus_[i]; subProblem->abcLower_[i] = fullProblem->abcLower_[i]; subProblem->abcUpper_[i] = fullProblem->abcUpper_[i]; subProblem->abcCost_[i] = fullProblem->abcCost_[i]; subProblem->abcDj_[i] = fullProblem->abcDj_[i]; subProblem->abcSolution_[i] = fullProblem->abcSolution_[i]; subProblem->abcPerturbation_[i] = fullProblem->abcPerturbation_[i]; subProblem->internalStatusSaved_[i] = fullProblem->internalStatusSaved_[i]; subProblem->perturbationSaved_[i] = fullProblem->perturbationSaved_[i]; subProblem->lowerSaved_[i] = fullProblem->lowerSaved_[i]; subProblem->upperSaved_[i] = fullProblem->upperSaved_[i]; subProblem->costSaved_[i] = fullProblem->costSaved_[i]; subProblem->djSaved_[i] = fullProblem->djSaved_[i]; subProblem->solutionSaved_[i] = fullProblem->solutionSaved_[i]; subProblem->offset_[i] = fullProblem->offset_[i]; subProblem->lowerBasic_[i] = fullProblem->lowerBasic_[i]; subProblem->upperBasic_[i] = fullProblem->upperBasic_[i]; subProblem->costBasic_[i] = fullProblem->costBasic_[i]; subProblem->solutionBasic_[i] = fullProblem->solutionBasic_[i]; subProblem->djBasic_[i] = fullProblem->djBasic_[i]; } for (int i=0;iinternalStatus_[maximumAbcNumberRows_+i] = fullProblem->internalStatus_[maximumAbcNumberRows_+k]; subProblem->internalStatus_[maximumAbcNumberRows_+i] = fullProblem->internalStatus_[maximumAbcNumberRows_+k]; subProblem->abcLower_[maximumAbcNumberRows_+i] = fullProblem->abcLower_[maximumAbcNumberRows_+k]; subProblem->abcUpper_[maximumAbcNumberRows_+i] = fullProblem->abcUpper_[maximumAbcNumberRows_+k]; subProblem->abcCost_[maximumAbcNumberRows_+i] = fullProblem->abcCost_[maximumAbcNumberRows_+k]; subProblem->abcDj_[maximumAbcNumberRows_+i] = fullProblem->abcDj_[maximumAbcNumberRows_+k]; subProblem->abcSolution_[maximumAbcNumberRows_+i] = fullProblem->abcSolution_[maximumAbcNumberRows_+k]; subProblem->abcPerturbation_[maximumAbcNumberRows_+i] = fullProblem->abcPerturbation_[maximumAbcNumberRows_+k]; subProblem->internalStatusSaved_[maximumAbcNumberRows_+i] = fullProblem->internalStatusSaved_[maximumAbcNumberRows_+k]; subProblem->perturbationSaved_[maximumAbcNumberRows_+i] = fullProblem->perturbationSaved_[maximumAbcNumberRows_+k]; subProblem->lowerSaved_[maximumAbcNumberRows_+i] = fullProblem->lowerSaved_[maximumAbcNumberRows_+k]; subProblem->upperSaved_[maximumAbcNumberRows_+i] = fullProblem->upperSaved_[maximumAbcNumberRows_+k]; subProblem->costSaved_[maximumAbcNumberRows_+i] = fullProblem->costSaved_[maximumAbcNumberRows_+k]; subProblem->djSaved_[maximumAbcNumberRows_+i] = fullProblem->djSaved_[maximumAbcNumberRows_+k]; subProblem->solutionSaved_[maximumAbcNumberRows_+i] = fullProblem->solutionSaved_[maximumAbcNumberRows_+k]; subProblem->offset_[maximumAbcNumberRows_+i] = fullProblem->offset_[maximumAbcNumberRows_+k]; } subProblem->abcNonLinearCost_=new AbcNonLinearCost(subProblem); subProblem->abcNonLinearCost_->checkInfeasibilities(0.0); subProblem->abcMatrix_ = new AbcMatrix(*fullProblem->abcMatrix_,numberRows_,whichRow, numberColumns,whichColumn); subProblem->abcMatrix_->setModel(subProblem); subProblem->abcMatrix_->rebalance(); subProblem->abcPrimalColumnPivot_ = new AbcPrimalColumnSteepest(); subProblem->abcPrimalColumnPivot_->saveWeights(subProblem,2); delete [] backward; // swap return fullProblem; } // Restore stuff from sub problem (and delete sub problem) void AbcSimplex::restoreFromSubProblem(AbcSimplex * fullProblem, const int * whichColumn) { AbcSimplex * subProblem = this; for (int i=0;iabcPivotVariable_[i]; if (iPivotabcPivotVariable_[i]=iPivot; } else { fullProblem->abcPivotVariable_[i]=whichColumn[iPivot-numberRows_]+numberRows_; } fullProblem->internalStatus_[i] = subProblem->internalStatus_[i]; fullProblem->abcLower_[i] = subProblem->abcLower_[i]; fullProblem->abcUpper_[i] = subProblem->abcUpper_[i]; fullProblem->abcCost_[i] = subProblem->abcCost_[i]; fullProblem->abcDj_[i] = subProblem->abcDj_[i]; fullProblem->abcSolution_[i] = subProblem->abcSolution_[i]; fullProblem->abcPerturbation_[i] = subProblem->abcPerturbation_[i]; fullProblem->internalStatusSaved_[i] = subProblem->internalStatusSaved_[i]; fullProblem->perturbationSaved_[i] = subProblem->perturbationSaved_[i]; fullProblem->lowerSaved_[i] = subProblem->lowerSaved_[i]; fullProblem->upperSaved_[i] = subProblem->upperSaved_[i]; fullProblem->costSaved_[i] = subProblem->costSaved_[i]; fullProblem->djSaved_[i] = subProblem->djSaved_[i]; fullProblem->solutionSaved_[i] = subProblem->solutionSaved_[i]; fullProblem->offset_[i] = subProblem->offset_[i]; fullProblem->lowerBasic_[i] = subProblem->lowerBasic_[i]; fullProblem->upperBasic_[i] = subProblem->upperBasic_[i]; fullProblem->costBasic_[i] = subProblem->costBasic_[i]; fullProblem->solutionBasic_[i] = subProblem->solutionBasic_[i]; fullProblem->djBasic_[i] = subProblem->djBasic_[i]; } int numberColumns = subProblem->numberColumns_; for (int i=0;iinternalStatus_[maximumAbcNumberRows_+k] = subProblem->internalStatus_[maximumAbcNumberRows_+i]; fullProblem->abcLower_[maximumAbcNumberRows_+k] = subProblem->abcLower_[maximumAbcNumberRows_+i]; fullProblem->abcUpper_[maximumAbcNumberRows_+k] = subProblem->abcUpper_[maximumAbcNumberRows_+i]; fullProblem->abcCost_[maximumAbcNumberRows_+k] = subProblem->abcCost_[maximumAbcNumberRows_+i]; fullProblem->abcDj_[maximumAbcNumberRows_+k] = subProblem->abcDj_[maximumAbcNumberRows_+i]; fullProblem->abcSolution_[maximumAbcNumberRows_+k] = subProblem->abcSolution_[maximumAbcNumberRows_+i]; fullProblem->abcPerturbation_[maximumAbcNumberRows_+k] = subProblem->abcPerturbation_[maximumAbcNumberRows_+i]; fullProblem->internalStatusSaved_[maximumAbcNumberRows_+k] = subProblem->internalStatusSaved_[maximumAbcNumberRows_+i]; fullProblem->perturbationSaved_[maximumAbcNumberRows_+k] = subProblem->perturbationSaved_[maximumAbcNumberRows_+i]; fullProblem->lowerSaved_[maximumAbcNumberRows_+k] = subProblem->lowerSaved_[maximumAbcNumberRows_+i]; fullProblem->upperSaved_[maximumAbcNumberRows_+k] = subProblem->upperSaved_[maximumAbcNumberRows_+i]; fullProblem->costSaved_[maximumAbcNumberRows_+k] = subProblem->costSaved_[maximumAbcNumberRows_+i]; fullProblem->djSaved_[maximumAbcNumberRows_+k] = subProblem->djSaved_[maximumAbcNumberRows_+i]; fullProblem->solutionSaved_[maximumAbcNumberRows_+k] = subProblem->solutionSaved_[maximumAbcNumberRows_+i]; fullProblem->offset_[maximumAbcNumberRows_+k] = subProblem->offset_[maximumAbcNumberRows_+i]; } delete [] subProblem->internalStatus_; delete [] subProblem->abcPerturbation_; delete subProblem->abcMatrix_; delete [] subProblem->abcLower_; delete [] subProblem->abcUpper_; delete [] subProblem->abcCost_; delete [] subProblem->abcSolution_; delete [] subProblem->abcDj_; delete subProblem->abcPrimalColumnPivot_; delete [] subProblem->scaleFromExternal_; delete [] subProblem->offset_; delete [] subProblem->abcPivotVariable_; delete [] subProblem->reversePivotVariable_; delete subProblem->abcNonLinearCost_; numberColumns_ = fullProblem->numberColumns_; numberTotal_ = fullProblem->numberTotal_; maximumNumberTotal_ = fullProblem->maximumNumberTotal_; numberTotalWithoutFixed_ = fullProblem->numberTotalWithoutFixed_; abcPrimalColumnPivot_ = fullProblem->abcPrimalColumnPivot_; internalStatus_ = fullProblem->internalStatus_; abcLower_ = fullProblem->abcLower_; abcUpper_ = fullProblem->abcUpper_; abcCost_ = fullProblem->abcCost_; abcDj_ = fullProblem->abcDj_; abcSolution_ = fullProblem->abcSolution_; scaleFromExternal_ = fullProblem->scaleFromExternal_; offset_ = fullProblem->offset_; abcPerturbation_ = fullProblem->abcPerturbation_; abcPivotVariable_ = fullProblem->abcPivotVariable_; abcMatrix_ = fullProblem->abcMatrix_; setupPointers(maximumAbcNumberRows_,numberColumns); // ? redo nonlinearcost abcNonLinearCost_ = fullProblem->abcNonLinearCost_; abcNonLinearCost_->refresh(); delete [] reinterpret_cast(fullProblem); } #endif /* Sets dual values pass djs using unscaled duals type 1 - values pass type 2 - just use as infeasibility weights type 3 - as 2 but crash */ void AbcSimplex::setupDualValuesPass(const double * fakeDuals, const double * fakePrimals, int type) { // allslack basis memset(internalStatus_,6,numberRows_); // temp if (type==1) { bool allEqual=true; for (int i=0;irowLower_[i]) { allEqual=false; break; } } if (allEqual) { // just modify costs transposeTimes(-1.0,fakeDuals,objective()); return; } } // compute unscaled djs CoinAbcMemcpy(djSaved_+maximumAbcNumberRows_,objective(),numberColumns_); matrix_->transposeTimes(-1.0,fakeDuals,djSaved_+maximumAbcNumberRows_); // save fake solution assert (solution_); //solution_ = new double[numberTotal_]; CoinAbcMemset0(solution_,numberRows_); CoinAbcMemcpy(solution_+maximumAbcNumberRows_,fakePrimals,numberColumns_); // adjust for (int iSequence=maximumAbcNumberRows_;iSequencetimes(-1.0,solution_+maximumAbcNumberRows_,solution_); double direction = optimizationDirection_; const double * COIN_RESTRICT rowScale=scaleFromExternal_; const double * COIN_RESTRICT inverseRowScale=scaleToExternal_; for (int iRow=0;iRow-1.0e30) { if (thisUpper<1.0e30) { double gapUp=thisUpper-thisValue; double gapDown=thisValue-thisLower; bool goUp; if (gapUp>gapDown&&thisDj>-dualTolerance_) { goUp=false; } else if (gapUpgapDown) { badUp=gapUp*dualTolerance_; badDown=-gapDown*thisDj; } else { badUp=gapUp*thisDj; badDown=gapDown*dualTolerance_; } goUp=badDown>badUp; } if (goUp) { solution[iColumn]=upper[iColumn]; setInternalStatus(iColumn+maximumAbcNumberRows_,atUpperBound); setStatus(iColumn,ClpSimplex::atUpperBound); } else { solution[iColumn]=lower[iColumn]; setInternalStatus(iColumn+maximumAbcNumberRows_,atLowerBound); setStatus(iColumn,ClpSimplex::atLowerBound); } } else { solution[iColumn]=lower[iColumn]; setInternalStatus(iColumn+maximumAbcNumberRows_,atLowerBound); setStatus(iColumn,ClpSimplex::atLowerBound); } } else if (thisUpper<1.0e30) { solution[iColumn]=upper[iColumn]; setInternalStatus(iColumn+maximumAbcNumberRows_,atUpperBound); setStatus(iColumn,ClpSimplex::atUpperBound); } else { // free solution[iColumn]=thisValue*inverseColumnScale[iColumn]; setInternalStatus(iColumn+maximumAbcNumberRows_,isFree); setStatus(iColumn,ClpSimplex::isFree); } } switch (type) { case 1: stateOfProblem_ |= VALUES_PASS; break; case 2: stateOfProblem_ |= VALUES_PASS2; delete [] solution_; solution_=NULL; break; case 3: stateOfProblem_ |= VALUES_PASS2; break; } } //############################################################################# int AbcSimplex::computePrimals(CoinIndexedVector * arrayVector, CoinIndexedVector * previousVector) { arrayVector->clear(); previousVector->clear(); // accumulate non basic stuff double * COIN_RESTRICT array = arrayVector->denseVector(); CoinAbcScatterZeroTo(abcSolution_,abcPivotVariable_,numberRows_); abcMatrix_->timesIncludingSlacks(-1.0, abcSolution_, array); #if 0 static int xxxxxx=0; if (xxxxxx==0) for (int i=0;iscan(0,numberRows_,zeroTolerance_); // Ftran adjusted RHS and iterate to improve accuracy double lastError = COIN_DBL_MAX; CoinIndexedVector * thisVector = arrayVector; CoinIndexedVector * lastVector = previousVector; //if (arrayVector->getNumElements()) #if 0 double largest=0.0; int iLargest=-1; for (int i=0;ilargest) { largest=array[i]; iLargest=i; } } printf("largest %g at row %d\n",array[iLargest],iLargest); #endif abcFactorization_->updateFullColumn(*thisVector); #if 0 largest=0.0; iLargest=-1; for (int i=0;ilargest) { largest=array[i]; iLargest=i; } } printf("after largest %g at row %d\n",array[iLargest],iLargest); #endif #if 0 if (xxxxxx==0) for (int i=0;i300) exit(0); #endif int numberRefinements=0; for (int iRefine = 0; iRefine < numberRefinements_ + 1; iRefine++) { int numberIn = thisVector->getNumElements(); const int * COIN_RESTRICT indexIn = thisVector->getIndices(); const double * COIN_RESTRICT arrayIn = thisVector->denseVector(); CoinAbcScatterToList(arrayIn,abcSolution_,indexIn,abcPivotVariable_,numberIn); // check Ax == b (for all) abcMatrix_->timesIncludingSlacks(-1.0, abcSolution_, solutionBasic_); #if 0 if (xxxxxx==0) for (int i=0;imaxValue) { #if 0 if (xxxxxx==0) printf("larger %.19gg at row %d\n",value,i); maxValue=value; #endif } } if (largestPrimalError_ >= lastError) { // restore CoinIndexedVector * temp = thisVector; thisVector = lastVector; lastVector = temp; //goodSolution = false; break; } if (iRefine < numberRefinements_ && largestPrimalError_ > 1.0e-10) { // try and make better numberRefinements++; // save this CoinIndexedVector * temp = thisVector; thisVector = lastVector; lastVector = temp; int * COIN_RESTRICT indexOut = thisVector->getIndices(); int number = 0; array = thisVector->denseVector(); thisVector->clear(); for (int iRow = 0; iRow < numberRows_; iRow++) { double value = solutionBasic_[iRow]; if (value) { array[iRow] = value; indexOut[number++] = iRow; solutionBasic_[iRow] = 0.0; } } thisVector->setNumElements(number); lastError = largestPrimalError_; abcFactorization_->updateFullColumn(*thisVector); double * previous = lastVector->denseVector(); number = 0; multiplier=1.0/multiplier; for (int iRow = 0; iRow < numberRows_; iRow++) { double value = previous[iRow] + multiplier * array[iRow]; if (value) { array[iRow] = value; indexOut[number++] = iRow; } else { array[iRow] = 0.0; } } thisVector->setNumElements(number); } else { break; } } // solution as accurate as we are going to get //if (!goodSolution) { CoinAbcMemcpy(solutionBasic_,thisVector->denseVector(),numberRows_); CoinAbcScatterTo(solutionBasic_,abcSolution_,abcPivotVariable_,numberRows_); arrayVector->clear(); previousVector->clear(); return numberRefinements; } // Moves basic stuff to basic area void AbcSimplex::moveToBasic(int which) { if ((which&1)!=0) CoinAbcGatherFrom(abcSolution_,solutionBasic_,abcPivotVariable_,numberRows_); if ((which&2)!=0) CoinAbcGatherFrom(abcCost_,costBasic_,abcPivotVariable_,numberRows_); if ((which&4)!=0) CoinAbcGatherFrom(abcLower_,lowerBasic_,abcPivotVariable_,numberRows_); if ((which&8)!=0) CoinAbcGatherFrom(abcUpper_,upperBasic_,abcPivotVariable_,numberRows_); } // now dual side int AbcSimplex::computeDuals(double * givenDjs, CoinIndexedVector * arrayVector, CoinIndexedVector * previousVector) { double * COIN_RESTRICT array = arrayVector->denseVector(); int * COIN_RESTRICT index = arrayVector->getIndices(); int number = 0; if (!givenDjs) { for (int iRow = 0; iRow < numberRows_; iRow++) { double value = costBasic_[iRow]; if (value) { array[iRow] = value; index[number++] = iRow; } } } else { // dual values pass - djs may not be zero for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; // make sure zero if done if (!pivoted(iPivot)) givenDjs[iPivot] = 0.0; double value = abcCost_[iPivot] - givenDjs[iPivot]; if (value) { array[iRow] = value; index[number++] = iRow; } } } arrayVector->setNumElements(number); // Btran basic costs and get as accurate as possible double lastError = COIN_DBL_MAX; CoinIndexedVector * thisVector = arrayVector; CoinIndexedVector * lastVector = previousVector; abcFactorization_->updateFullColumnTranspose(*thisVector); int numberRefinements=0; for (int iRefine = 0; iRefine < numberRefinements_+1; iRefine++) { // check basic reduced costs zero // put reduced cost of basic into djBasic_ CoinAbcMemcpy(djBasic_,costBasic_,numberRows_); abcMatrix_->transposeTimesBasic(-1.0,thisVector->denseVector(),djBasic_); largestDualError_ = CoinAbcMaximumAbsElement(djBasic_,numberRows_); if (largestDualError_ >= lastError) { // restore CoinIndexedVector * temp = thisVector; thisVector = lastVector; lastVector = temp; break; } if (iRefine < numberRefinements_ && largestDualError_ > 1.0e-10 && !givenDjs) { numberRefinements++; // try and make better // save this CoinIndexedVector * temp = thisVector; thisVector = lastVector; lastVector = temp; array = thisVector->denseVector(); double multiplier = 131072.0; //array=djBasic_*multiplier CoinAbcMultiplyAdd(djBasic_,numberRows_,multiplier,array,0.0); lastError = largestDualError_; abcFactorization_->updateFullColumnTranspose( *thisVector); #if ABC_DEBUG thisVector->checkClean(); #endif multiplier = 1.0 / multiplier; double * COIN_RESTRICT previous = lastVector->denseVector(); // array = array*multiplier+previous CoinAbcMultiplyAdd(previous,numberRows_,1.0,array,multiplier); } else { break; } } // now look at dual solution CoinAbcMemcpy(dual_,thisVector->denseVector(),numberRows_); CoinAbcMemset0(thisVector->denseVector(),numberRows_); thisVector->setNumElements(0); if (numberRefinements) { CoinAbcMemset0(lastVector->denseVector(),numberRows_); lastVector->setNumElements(0); } CoinAbcMemcpy(abcDj_,abcCost_,numberTotal_); abcMatrix_->transposeTimesNonBasic(-1.0, dual_,abcDj_); // If necessary - override results if (givenDjs) { // restore accurate duals CoinMemcpyN(abcDj_, numberTotal_, givenDjs); } //arrayVector->clear(); //previousVector->clear(); #if ABC_DEBUG arrayVector->checkClean(); previousVector->checkClean(); #endif return numberRefinements; } /* Factorizes using current basis. solveType - 1 iterating, 0 initial, -1 external - 2 then iterating but can throw out of basis If 10 added then in primal values pass Return codes are as from AbcSimplexFactorization unless initial factorization when total number of singularities is returned. Special case is numberRows_+1 -> all slack basis. */ int AbcSimplex::internalFactorize ( int solveType) { assert (status_); bool valuesPass = false; if (solveType >= 10) { valuesPass = true; solveType -= 10; } #if 0 // Make sure everything is clean for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if(getInternalStatus(iSequence) == isFixed) { // double check fixed assert (abcUpper_[iSequence] == abcLower_[iSequence]); assert (fabs(abcSolution_[iSequence]-abcLower_[iSequence])<100.0*primalTolerance_); } else if (getInternalStatus(iSequence) == isFree) { assert (abcUpper_[iSequence] == COIN_DBL_MAX && abcLower_[iSequence]==-COIN_DBL_MAX); } else if (getInternalStatus(iSequence) == atLowerBound) { assert (fabs(abcSolution_[iSequence]-abcLower_[iSequence])<1000.0*primalTolerance_); } else if (getInternalStatus(iSequence) == atUpperBound) { assert (fabs(abcSolution_[iSequence]-abcUpper_[iSequence])<1000.0*primalTolerance_); } else if (getInternalStatus(iSequence) == superBasic) { assert (!valuesPass); } } #endif #if 0 //ndef NDEBUG // Make sure everything is clean double sumOutside=0.0; int numberOutside=0; //double sumOutsideLarge=0.0; int numberOutsideLarge=0; double sumInside=0.0; int numberInside=0; //double sumInsideLarge=0.0; int numberInsideLarge=0; char rowcol[] = {'R', 'C'}; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if(getInternalStatus(iSequence) == isFixed) { // double check fixed assert (abcUpper_[iSequence] == abcLower_[iSequence]); assert (fabs(abcSolution_[iSequence]-abcLower_[iSequence])1 if (handler_->logLevel()==63) printf("%c%d below by %g\n",rowcol[isColumn(iSequence)],sequenceWithin(iSequence), abcLower_[iSequence]-abcSolution_[iSequence]); #endif sumOutside-=abcSolution_[iSequence]-abcLower_[iSequence]; if (abcSolution_[iSequence]abcLower_[iSequence]) { numberInside++; sumInside+=abcSolution_[iSequence]-abcLower_[iSequence]; if (abcSolution_[iSequence]>abcLower_[iSequence]+primalTolerance_) numberInsideLarge++; } } else if (getInternalStatus(iSequence) == atUpperBound) { assert (fabs(abcSolution_[iSequence]-abcUpper_[iSequence])<1000.0*primalTolerance_); if (abcSolution_[iSequence]>abcUpper_[iSequence]) { numberOutside++; #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel()==63) printf("%c%d above by %g\n",rowcol[isColumn(iSequence)],sequenceWithin(iSequence), -(abcUpper_[iSequence]-abcSolution_[iSequence])); #endif sumOutside+=abcSolution_[iSequence]-abcUpper_[iSequence]; if (abcSolution_[iSequence]>abcUpper_[iSequence]+primalTolerance_) numberOutsideLarge++; } else if (abcSolution_[iSequence]0 if (numberInside+numberOutside) printf("%d outside summing to %g (%d large), %d inside summing to %g (%d large)\n", numberOutside,sumOutside,numberOutsideLarge, numberInside,sumInside,numberInsideLarge); #endif #endif // *** replace below by cleanStatus for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { AbcSimplex::Status status=getInternalStatus(iSequence); if (status!= basic&&status!=isFixed&&abcUpper_[iSequence] == abcLower_[iSequence]) setInternalStatus(iSequence,isFixed); } if (numberIterations_==baseIteration_&&!valuesPass) { double largeValue = this->largeValue(); double * COIN_RESTRICT solution = abcSolution_; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { AbcSimplex::Status status=getInternalStatus(iSequence); if (status== superBasic) { double lower = abcLower_[iSequence]; double upper = abcUpper_[iSequence]; double value = solution[iSequence]; AbcSimplex::Status thisStatus=isFree; if (lower > -largeValue || upper < largeValue) { if (lower!=upper) { if (fabs(value - lower) < fabs(value - upper)) { thisStatus=AbcSimplex::atLowerBound; solution[iSequence] = lower; } else { thisStatus= AbcSimplex::atUpperBound; solution[iSequence] = upper; } } else { thisStatus= AbcSimplex::isFixed; solution[iSequence] = upper; } setInternalStatus(iSequence,thisStatus); } } } } int status = abcFactorization_->factorize(this, solveType, valuesPass); if (status) { handler_->message(CLP_SIMPLEX_BADFACTOR, messages_) << status << CoinMessageEol; return -1; } else if (!solveType) { // Initial basis - return number of singularities int numberSlacks = 0; for (int iRow = 0; iRow < numberRows_; iRow++) { if (getInternalStatus(iRow) == basic) numberSlacks++; } status = CoinMax(numberSlacks - numberRows_, 0); if (status) printf("%d singularities\n",status); // special case if all slack if (numberSlacks == numberRows_) { status = numberRows_ + 1; } } #ifdef ABC_USE_COIN_FACTORIZATION // sparse methods abcFactorization_->goSparse(); #endif return status; } // Make sure no superbasic etc void AbcSimplex::cleanStatus(bool valuesPass) { for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { AbcSimplex::Status status=getInternalStatus(iSequence); if (status!= basic&&status!=isFixed&&abcUpper_[iSequence] == abcLower_[iSequence]) setInternalStatus(iSequence,isFixed); } if (numberIterations_==baseIteration_&&!valuesPass) { double largeValue = this->largeValue(); double * COIN_RESTRICT solution = abcSolution_; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { AbcSimplex::Status status=getInternalStatus(iSequence); if (status== superBasic) { double lower = abcLower_[iSequence]; double upper = abcUpper_[iSequence]; double value = solution[iSequence]; AbcSimplex::Status thisStatus=isFree; if (lower > -largeValue || upper < largeValue) { if (lower!=upper) { if (fabs(value - lower) < fabs(value - upper)) { thisStatus=AbcSimplex::atLowerBound; solution[iSequence] = lower; } else { thisStatus= AbcSimplex::atUpperBound; solution[iSequence] = upper; } } else { thisStatus= AbcSimplex::isFixed; solution[iSequence] = upper; } setInternalStatus(iSequence,thisStatus); } } } } } // Sets objectiveValue_ from rawObjectiveValue_ void AbcSimplex::setClpSimplexObjectiveValue() { objectiveValue_ = rawObjectiveValue_/(objectiveScale_ * rhsScale_); objectiveValue_ += objectiveOffset_; } /* This does basis housekeeping and does values for in/out variables. Can also decide to re-factorize */ int AbcSimplex::housekeeping() { #define DELAYED_UPDATE #ifdef DELAYED_UPDATE if (algorithm_<0) { // modify dualout dualOut_ /= alpha_; dualOut_ *= -directionOut_; //double oldValue = valueIn_; if (directionIn_ == -1) { // as if from upper bound valueIn_ = upperIn_ + dualOut_; #if 0 //def ABC_DEBUG printf("In from upper dualout_ %g movement %g (old %g) valueIn_ %g using movement %g\n", dualOut_,movement_,movementOld,valueIn_,upperIn_+movement_); #endif } else { // as if from lower bound valueIn_ = lowerIn_ + dualOut_; #if 0 //def ABC_DEBUG printf("In from lower dualout_ %g movement %g (old %g) valueIn_ %g using movement %g\n", dualOut_,movement_,movementOld,valueIn_,lowerIn_+movement_); #endif } // outgoing if (directionOut_ > 0) { valueOut_ = lowerOut_; } else { valueOut_ = upperOut_; } #if ABC_NORMAL_DEBUG>3 if (rawObjectiveValue_ < oldobj - 1.0e-5 && (handler_->logLevel() & 16)) printf("obj backwards %g %g\n", rawObjectiveValue_, oldobj); #endif } #endif #if 0 //ndef NDEBUG { int numberFlagged=0; for (int iRow = 0; iRow < numberRows_; iRow++) { int iPivot = abcPivotVariable_[iRow]; if (flagged(iPivot)) numberFlagged++; } assert (numberFlagged==numberFlagged_); } #endif // save value of incoming and outgoing numberIterations_++; changeMade_++; // something has happened // incoming variable if (handler_->logLevel() > 7) { //if (handler_->detail(CLP_SIMPLEX_HOUSE1,messages_)<100) { handler_->message(CLP_SIMPLEX_HOUSE1, messages_) << directionOut_ << directionIn_ << theta_ << dualOut_ << dualIn_ << alpha_ << CoinMessageEol; if (getInternalStatus(sequenceIn_) == isFree) { handler_->message(CLP_SIMPLEX_FREEIN, messages_) << sequenceIn_ << CoinMessageEol; } } // change of incoming char rowcol[] = {'R', 'C'}; if (abcUpper_[sequenceIn_] > 1.0e20 && abcLower_[sequenceIn_] < -1.0e20) progressFlag_ |= 2; // making real progress #ifndef DELAYED_UPDATE abcSolution_[sequenceIn_] = valueIn_; #endif if (abcUpper_[sequenceOut_] - abcLower_[sequenceOut_] < 1.0e-12) progressFlag_ |= 1; // making real progress if (sequenceIn_ != sequenceOut_) { if (alphaAccuracy_ > 0.0) { double value = fabs(alpha_); if (value > 1.0) alphaAccuracy_ *= value; else alphaAccuracy_ /= value; } setInternalStatus(sequenceIn_, basic); if (abcUpper_[sequenceOut_] - abcLower_[sequenceOut_] > 0) { // As Nonlinear costs may have moved bounds (to more feasible) // Redo using value if (fabs(valueOut_ - abcLower_[sequenceOut_]) < fabs(valueOut_ - abcUpper_[sequenceOut_])) { // going to lower setInternalStatus(sequenceOut_, atLowerBound); } else { // going to upper setInternalStatus(sequenceOut_, atUpperBound); } } else { // fixed setInternalStatus(sequenceOut_, isFixed); } #ifndef DELAYED_UPDATE abcSolution_[sequenceOut_] = valueOut_; #endif #if PARTITION_ROW_COPY==1 // move in row copy abcMatrix_->inOutUseful(sequenceIn_,sequenceOut_); #endif } else { //if (objective_->type()<2) //assert (fabs(theta_)>1.0e-13); // flip from bound to bound // As Nonlinear costs may have moved bounds (to more feasible) // Redo using value if (fabs(valueIn_ - abcLower_[sequenceIn_]) < fabs(valueIn_ - abcUpper_[sequenceIn_])) { // as if from upper bound setInternalStatus(sequenceIn_, atLowerBound); } else { // as if from lower bound setInternalStatus(sequenceIn_, atUpperBound); } } setClpSimplexObjectiveValue(); if (handler_->logLevel() > 7) { //if (handler_->detail(CLP_SIMPLEX_HOUSE2,messages_)<100) { handler_->message(CLP_SIMPLEX_HOUSE2, messages_) << numberIterations_ << objectiveValue() << rowcol[isColumn(sequenceIn_)] << sequenceWithin(sequenceIn_) << rowcol[isColumn(sequenceOut_)] << sequenceWithin(sequenceOut_); handler_->printing(algorithm_ < 0) << dualOut_ << theta_; handler_->printing(algorithm_ > 0) << dualIn_ << theta_; handler_->message() << CoinMessageEol; } #if 0 if (numberIterations_ > 10000) printf(" it %d %g %c%d %c%d\n" , numberIterations_, objectiveValue() , rowcol[isColumn(sequenceIn_)], sequenceWithin(sequenceIn_) , rowcol[isColumn(sequenceOut_)], sequenceWithin(sequenceOut_)); #endif if (hitMaximumIterations()) return 2; // check for small cycles int in = sequenceIn_; int out = sequenceOut_; int cycle = abcProgress_.cycle(in, out, directionIn_, directionOut_); if (cycle > 0 ) { #if ABC_NORMAL_DEBUG>0 if (handler_->logLevel() >= 63) printf("Cycle of %d\n", cycle); #endif // reset abcProgress_.startCheck(); double random = randomNumberGenerator_.randomDouble(); int extra = static_cast (9.999 * random); int off[] = {1, 1, 1, 1, 2, 2, 2, 3, 3, 4}; if (abcFactorization_->pivots() > cycle) { forceFactorization_ = CoinMax(1, cycle - off[extra]); } else { // need to reject something int iSequence; if (algorithm_<0) { iSequence = sequenceIn_; } else { /* should be better if don't reject incoming as it is in basis */ iSequence = sequenceOut_; // so can't happen immediately again sequenceOut_=-1; } char x = isColumn(iSequence) ? 'C' : 'R'; if (handler_->logLevel() >= 63) handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(iSequence) << CoinMessageEol; setFlagged(iSequence); //printf("flagging %d\n",iSequence); } return 1; } int invertNow=0; // only time to re-factorize if one before real time // this is so user won't be surprised that maximumPivots has exact meaning int numberPivots = abcFactorization_->pivots(); if (algorithm_<0) numberPivots++; // allow for update not done int maximumPivots = abcFactorization_->maximumPivots(); int numberDense = 0; //abcFactorization_->numberDense(); bool dontInvert = ((specialOptions_ & 16384) != 0 && numberIterations_ * 3 > 2 * maximumIterations()); if (numberPivots == maximumPivots || maximumPivots < 2) { // If dense then increase if (maximumPivots > 100 && numberDense > 1.5 * maximumPivots && false) { abcFactorization_->maximumPivots(numberDense); } //printf("ZZ maxpivots %d its %d\n",numberPivots,maximumPivots); #if CLP_FACTORIZATION_NEW_TIMING>1 abcFactorization_->statsRefactor('M'); #endif return 1; } else if ((abcFactorization_->timeToRefactorize() && !dontInvert) ||invertNow) { //printf("ZZ time invertNow %s its %d\n",invertNow ? "yes":"no",numberPivots); #if CLP_FACTORIZATION_NEW_TIMING>1 abcFactorization_->statsRefactor('T'); #endif return 1; } else if (forceFactorization_ > 0 && #ifndef DELAYED_UPDATE abcFactorization_->pivots() #else abcFactorization_->pivots()+1 #endif >= forceFactorization_) { // relax forceFactorization_ = (3 + 5 * forceFactorization_) / 4; if (forceFactorization_ > abcFactorization_->maximumPivots()) forceFactorization_ = -1; //off //printf("ZZ forceFactor %d its %d\n",forceFactorization_,numberPivots); #if CLP_FACTORIZATION_NEW_TIMING>1 abcFactorization_->statsRefactor('F'); #endif return 1; } else if (numberIterations_ > 1000 + 10 * (numberRows_ + (numberColumns_ >> 2))) { // A bit worried problem may be cycling - lets factorize at random intervals for a short period int numberTooManyIterations = numberIterations_ - 10 * (numberRows_ + (numberColumns_ >> 2)); double random = randomNumberGenerator_.randomDouble(); int window = numberTooManyIterations%5000; if (window<2*maximumPivots) random = 0.2*random+0.8; // randomly re-factorize but not too soon else random=1.0; // switch off if not in window of opportunity int maxNumber = (forceFactorization_ < 0) ? maximumPivots : CoinMin(forceFactorization_, maximumPivots); if (abcFactorization_->pivots() >= random * maxNumber) { //printf("ZZ cycling a %d\n",numberPivots); return 1; } else if (numberIterations_ > 1000000 + 10 * (numberRows_ + (numberColumns_ >> 2)) && numberIterations_ < 1000010 + 10 * (numberRows_ + (numberColumns_ >> 2))) { //printf("ZZ cycling b %d\n",numberPivots); return 1; } else { // carry on iterating return 0; } } else { // carry on iterating return 0; } } // Swaps primal stuff void AbcSimplex::swapPrimalStuff() { if (sequenceOut_<0) return; assert (sequenceIn_>=0); abcSolution_[sequenceOut_] = valueOut_; abcSolution_[sequenceIn_] = valueIn_; solutionBasic_[pivotRow_]=valueIn_; if (algorithm_<0) { // and set bounds correctly static_cast (this)->originalBound(sequenceIn_); static_cast (this)->changeBound(sequenceOut_); } else { #if ABC_NORMAL_DEBUG>2 if (handler_->logLevel()==63) printf("Code swapPrimalStuff for primal\n"); #endif } if (pivotRow_>=0) { // may be flip in primal lowerBasic_[pivotRow_]=abcLower_[sequenceIn_]; upperBasic_[pivotRow_]=abcUpper_[sequenceIn_]; costBasic_[pivotRow_]=abcCost_[sequenceIn_]; abcPivotVariable_[pivotRow_] = sequenceIn_; } } // Swaps dual stuff void AbcSimplex::swapDualStuff(int lastSequenceOut,int lastDirectionOut) { // outgoing // set dj to zero unless values pass if (lastSequenceOut>=0) { if ((stateOfProblem_&VALUES_PASS)==0) { if (lastDirectionOut > 0) { abcDj_[lastSequenceOut] = theta_; } else { abcDj_[lastSequenceOut] = -theta_; } } else { if (lastDirectionOut > 0) { abcDj_[lastSequenceOut] -= theta_; } else { abcDj_[lastSequenceOut] += theta_; } } } if (sequenceIn_>=0) { abcDj_[sequenceIn_]=0.0; //costBasic_[pivotRow_]=abcCost_[sequenceIn_]; } } static void solveMany(int number,ClpSimplex ** simplex) { for (int i=0;idual(0); simplex[number-1]->dual(0); cilk_sync; } void AbcSimplex::crash (int type) { int i; for (i=0;igotRowCopy()) abcMatrix_->createRowCopy(); //const double * element = abcMatrix_->getPackedMatrix()->getElements(); const CoinBigIndex * columnStart = abcMatrix_->getPackedMatrix()->getVectorStarts(); const int * row = abcMatrix_->getPackedMatrix()->getIndices(); //const double * elementByRow = abcMatrix_->rowElements(); const CoinBigIndex * rowStart = abcMatrix_->rowStart(); const CoinBigIndex * rowEnd = abcMatrix_->rowEnd(); const int * column = abcMatrix_->rowColumns(); int * blockStart = usefulArray_[0].getIndices(); int * columnBlock = blockStart+numberRows_; int * nextColumn = usefulArray_[1].getIndices(); int * blockCount = nextColumn+numberColumns_; int direction[2]={-1,1}; int bestBreak=-1; double bestValue=0.0; int iPass=0; int halfway=(numberRows_+1)/2; int firstMaster=-1; int lastMaster=-2; int numberBlocks=0; int largestRows=0; int largestColumns=0; int numberEmpty=0; int numberMaster=0; int numberEmptyColumns=0; int numberMasterColumns=0; while (iPass<2) { int increment=direction[iPass]; int start= increment>0 ? 0 : numberRows_-1; int stop=increment>0 ? numberRows_ : -1; numberBlocks=0; int thisBestBreak=-1; double thisBestValue=COIN_DBL_MAX; int numberRowsDone=0; int numberMarkedColumns=0; int maximumBlockSize=0; for (int i=0;i=0) { // column marked if (iBlock<0) { // put row in that block iBlock=whichColumnBlock; } else if (iBlock!=whichColumnBlock) { // merge blockCount[iBlock]+=blockCount[whichColumnBlock]; blockCount[whichColumnBlock]=0; int jColumn=blockStart[whichColumnBlock]; #ifndef NDEBUG int iiColumn=iColumn; #endif while (jColumn>=0) { assert (columnBlock[jColumn]==whichColumnBlock); columnBlock[jColumn]=iBlock; #ifndef NDEBUG if (jColumn==iiColumn) iiColumn=-1; #endif iColumn=jColumn; jColumn=nextColumn[jColumn]; } #ifndef NDEBUG assert (iiColumn==-1); #endif nextColumn[iColumn]=blockStart[iBlock]; blockStart[iBlock]=blockStart[whichColumnBlock]; blockStart[whichColumnBlock]=-1; } } } int n=numberMarkedColumns; if (iBlock<0) { //new block if (rowEnd[iRow]>rowStart[iRow]) { numberBlocks++; iBlock=numberBlocks; int jColumn=column[rowStart[iRow]]-maximumAbcNumberRows_; columnBlock[jColumn]=iBlock; blockStart[iBlock]=jColumn; numberMarkedColumns++; for (CoinBigIndex j=rowStart[iRow]+1;j=0) maximumBlockSize=CoinMax(maximumBlockSize,blockCount[iBlock]); numberRowsDone++; if (thisBestValue*numberRowsDone > maximumBlockSize&&numberRowsDone>halfway) { thisBestBreak=iRow; thisBestValue=static_cast(maximumBlockSize)/ static_cast(numberRowsDone); } } if (thisBestBreak==stop) thisBestValue=COIN_DBL_MAX; iPass++; if (iPass==1) { bestBreak=thisBestBreak; bestValue=thisBestValue; } else { if (bestValue=0) { blockCount[iBlock]++; } else { if (iBlock==-2) numberMaster++; else numberEmpty++; } } for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { int iBlock=columnBlock[iColumn]; if (iBlock>=0) { nextColumn[iBlock]++; } else { if (columnStart[iColumn+1]>columnStart[iColumn]) numberMasterColumns++; else numberEmptyColumns++; } } for (int i=0;ilargestRows+largestColumns) { largestRows=blockCount[i]; largestColumns=nextColumn[i]; } } useful=true; if (numberMaster>halfway||largestRows*3>numberRows_) useful=false; } if (useful) { #if ABC_NORMAL_DEBUG>0 if (logLevel()>=2) printf("%d master rows %d <= < %d\n",lastMaster-firstMaster, firstMaster,lastMaster); printf("%s %d blocks (largest %d,%d), %d master rows (%d empty) out of %d, %d master columns (%d empty) out of %d\n", useful ? "**Useful" : "NoGood", numberBlocks,largestRows,largestColumns,numberMaster,numberEmpty,numberRows_, numberMasterColumns,numberEmptyColumns,numberColumns_); if (logLevel()>=2) { for (int i=0;iminSize2 or sum >minSize1; int n=0; for (int i=0;i0&&i=0;i--) { int originalBlock=nextColumn[i]; if (blockCount[originalBlock]>0) n--; blockCount[originalBlock]=n; } assert (!n); for (int iRow = 0; iRow < numberRows_; iRow++) { int iBlock=blockStart[iRow]; if (iBlock>=0) blockStart[iRow]=blockCount[iBlock]; } for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { int iBlock=columnBlock[iColumn]; if (iBlock>=0) columnBlock[iColumn]=blockCount[iBlock]; } // stick to Clp for now ClpSimplex ** simplex = new ClpSimplex * [numberBlocks]; for (int iBlock=0;iBlocksetSpecialOptions(simplex[iBlock]->specialOptions()&(~65536)); if (logLevel()<2) simplex[iBlock]->setLogLevel(0); } solveMany(numberBlocks,simplex); int numberBasic=numberMaster; int numberStructurals=0; for (int i=0;istatusArray()+ simplex[iBlock]->numberColumns(); double * COIN_RESTRICT solutionSaved=solutionSaved_; double * COIN_RESTRICT lowerSaved=lowerSaved_; double * COIN_RESTRICT upperSaved=upperSaved_; for (int iRow=0;iRow(lookupToAbcSlack[status]); if (status!=ClpSimplex::basic) { double lowerValue=lowerSaved[iRow]; double upperValue=upperSaved[iRow]; if (lowerValue==-COIN_DBL_MAX) { if(upperValue==COIN_DBL_MAX) { // free abcStatus=isFree; } else { abcStatus=atUpperBound; } } else if (upperValue==COIN_DBL_MAX) { abcStatus=atLowerBound; } else if (lowerValue==upperValue) { abcStatus=isFixed; } switch (abcStatus) { case isFixed: case atLowerBound: solutionSaved[iRow]=lowerValue; break; case atUpperBound: solutionSaved[iRow]=upperValue; break; default: break; } } else { // basic abcPivotVariable_[numberBasic++]=iRow; } internalStatus_[iRow]=abcStatus; } } // from Clp enum to Abc enum unsigned char lookupToAbc[6]={4,6,1,0,5,7}; unsigned char * COIN_RESTRICT putStatus=internalStatus_+maximumAbcNumberRows_; getStatus = simplex[iBlock]->statusArray(); solutionSaved+= maximumAbcNumberRows_; lowerSaved+= maximumAbcNumberRows_; upperSaved+= maximumAbcNumberRows_; int numberSaved=numberBasic; for (int iColumn=0;iColumn(lookupToAbc[status]); if (status!=ClpSimplex::basic) { double lowerValue=lowerSaved[iColumn]; double upperValue=upperSaved[iColumn]; if (lowerValue==-COIN_DBL_MAX) { if(upperValue==COIN_DBL_MAX) { // free abcStatus=isFree; } else { abcStatus=atUpperBound; } } else if (upperValue==COIN_DBL_MAX) { abcStatus=atLowerBound; } else if (lowerValue==upperValue) { abcStatus=isFixed; } else if (abcStatus==isFree) { abcStatus=superBasic; } switch (abcStatus) { case isFixed: case atLowerBound: solutionSaved[iColumn]=lowerValue; break; case atUpperBound: solutionSaved[iColumn]=upperValue; break; default: break; } } else { // basic if (numberBasic0 printf("%d structurals put into basis\n",numberStructurals); #endif if (numberBasicn2); n2=abcPivotVariable_[i]; } #endif delete [] simplex; return; } else { // try another type=2; } } if (type==1) { const double * linearObjective = abcCost_+maximumAbcNumberRows_; double gamma=0.0; int numberTotal=numberRows_+numberColumns_; double * q = new double [numberTotal]; double * v = q+numberColumns_; int * which = new int [numberTotal+3*numberRows_]; int * ii = which+numberColumns_; int * r = ii+numberRows_; int * pivoted = r+numberRows_; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { gamma=CoinMax(gamma,linearObjective[iColumn]); } for (int iRow = 0; iRow < numberRows_; iRow++) { double lowerBound = abcLower_[iRow]; double upperBound = abcUpper_[iRow]; pivoted[iRow]=-1; ii[iRow]=0; r[iRow]=0; v[iRow]=COIN_DBL_MAX; if (lowerBound==upperBound) continue; if (lowerBound<=0.0&&upperBound>=0.0) { pivoted[iRow]=iRow; ii[iRow]=1; r[iRow]=1; } } int nPossible=0; int lastPossible=0; double cMaxDiv; if (gamma) cMaxDiv=1.0/(1000.0*gamma); else cMaxDiv=1.0; const double * columnLower = abcLower_+maximumAbcNumberRows_; const double * columnUpper = abcUpper_+maximumAbcNumberRows_; for (int iPass=0;iPass<3;iPass++) { for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double lowerBound = columnLower[iColumn]; double upperBound = columnUpper[iColumn]; if (lowerBound==upperBound) continue; double qValue; if (lowerBound > -1.0e20 ) { if (upperBound < 1.0e20) { // both qValue=lowerBound-upperBound; if (iPass!=2) qValue=COIN_DBL_MAX; } else { // just lower qValue=lowerBound; if (iPass!=1) qValue=COIN_DBL_MAX; } } else { if (upperBound < 1.0e20) { // just upper qValue=-upperBound; if (iPass!=1) qValue=COIN_DBL_MAX; } else { // free qValue=0.0; if (iPass!=0) qValue=COIN_DBL_MAX; } } if (qValue!=COIN_DBL_MAX) { which[nPossible]=iColumn; q[nPossible++]=qValue+linearObjective[iColumn]*cMaxDiv;; } } CoinSort_2(q+lastPossible,q+nPossible,which+lastPossible); lastPossible=nPossible; } const double * element = abcMatrix_->getPackedMatrix()->getElements(); const CoinBigIndex * columnStart = abcMatrix_->getPackedMatrix()->getVectorStarts(); //const int * columnLength = abcMatrix_->getPackedMatrix()->getVectorLengths(); const int * row = abcMatrix_->getPackedMatrix()->getIndices(); int nPut=0; for (int i=0;i0.01*v[iRow]) { canTake=false; } else if (!ii[iRow]&&alpha>alternativeAlpha) { alternativeAlpha=alpha; jRow=iRow; } if (!r[iRow]&&alpha>maxAlpha) { maxAlpha=alpha; kRow=iRow; } } // only really works if scaled if (maxAlpha>0.99) { pivoted[kRow]=iColumn+maximumAbcNumberRows_; v[kRow]=maxAlpha; ii[kRow]=1; for (CoinBigIndex j=columnStart[iColumn];j=0) { pivoted[jRow]=iColumn+maximumAbcNumberRows_; v[jRow]=maxAlpha; ii[jRow]=1; for (CoinBigIndex j=columnStart[iColumn];j=0&&iSequence0 printf("%d put into basis\n",nPut); #endif delete [] q; delete [] which; } else if (type==2) { //return; int numberBad=0; CoinAbcMemcpy(abcDj_,abcCost_,numberTotal_); // Work on savedSolution and current int iVector=getAvailableArray(); #define ALLOW_BAD_DJS #ifdef ALLOW_BAD_DJS double * modDj = usefulArray_[iVector].denseVector(); #endif for (int iSequence=maximumAbcNumberRows_;iSequencedualTolerance_) { double costThru=dj*(abcUpper_[iSequence]-abcLower_[iSequence]); if (costThrugotRowCopy()) abcMatrix_->createRowCopy(); //const double * element = abcMatrix_->getPackedMatrix()->getElements(); const CoinBigIndex * columnStart = abcMatrix_->getPackedMatrix()->getVectorStarts()-maximumAbcNumberRows_; const int * row = abcMatrix_->getPackedMatrix()->getIndices(); const double * elementByRow = abcMatrix_->rowElements(); const CoinBigIndex * rowStart = abcMatrix_->rowStart(); const CoinBigIndex * rowEnd = abcMatrix_->rowEnd(); const int * column = abcMatrix_->rowColumns(); CoinAbcMemset0(solutionBasic_,numberRows_); CoinAbcMemcpy(lowerBasic_,abcLower_,numberRows_); CoinAbcMemcpy(upperBasic_,abcUpper_,numberRows_); abcMatrix_->timesIncludingSlacks(-1.0,solutionSaved_,solutionBasic_); const double multiplier[] = { 1.0, -1.0}; int nBasic=0; int * index=usefulArray_[iVector].getIndices(); int iVector2=getAvailableArray(); int * index2=usefulArray_[iVector2].getIndices(); double * sort =usefulArray_[iVector2].denseVector(); int average = CoinMax(5,rowEnd[numberRows_-1]/(8*numberRows_)); int nPossible=0; if (numberRows_>10000) { // allow more for (int iRow=0;iRowupperValue+primalTolerance_) { infeasibility=upperValue-solutionValue; } int length=rowEnd[iRow]-rowStart[iRow]; if (infeasibility) index2[nPossible++]=length; } std::sort(index2,index2+nPossible); // see how much we need to get numberRows/10 or nPossible/3 average=CoinMax(average,index2[CoinMin(numberRows_/10,nPossible/3)]); nPossible=0; } for (int iRow=0;iRowupperValue+primalTolerance_) { infeasibility=upperValue-solutionValue; } int length=rowEnd[iRow]-rowStart[iRow]; if (infeasibility&&lengthupperValue+primalTolerance_) { infeasibility=upperValue-solutionValue; } assert (infeasibility); double direction = infeasibility >0 ? 1.0 : -1.0; infeasibility *= direction; int whichColumn=-1; double upperTheta=1.0e30; int whichColumn2=-1; double upperTheta2=1.0e30; double costThru=0.0; int nThru=0; for (CoinBigIndex j=rowStart[iRow];j=maximumAbcNumberRows_); double dj = abcDj_[iSequence]; double tableauValue=-elementByRow[j]*direction; unsigned char iStatus=internalStatus_[iSequence]&7; if ((iStatus&4)==0) { double mult = multiplier[iStatus]; double alpha = tableauValue * mult; double oldValue = dj * mult; assert (oldValue>-1.0e-2); double value = oldValue - upperTheta * alpha; if (value < 0.0) { upperTheta2=upperTheta; whichColumn2=whichColumn; costThru=alpha*(abcUpper_[iSequence]-abcLower_[iSequence]); nThru=0; upperTheta = oldValue / alpha; whichColumn=iSequence; } else if (oldValue-upperTheta2*alpha<0.0) { costThru+=alpha*(abcUpper_[iSequence]-abcLower_[iSequence]); index[nThru++]=iSequence; } } else if (iStatus<6) { upperTheta=-1.0; upperTheta2=elementByRow[j]; whichColumn=iSequence; break; } } if (whichColumn<0) continue; if (upperTheta!=-1.0) { assert (upperTheta>=0.0); if (costThru=0) { index[nThru++]=whichColumn; for (int i=0;i-1.0e-2); dj = CoinMax(dj,0.0); #ifdef ALLOW_BAD_DJS if (numberBad&&modDj[iSequence]) { double bad=modDj[iSequence]; if (dj+bad>=0.0) { numberBad--; modDj[iSequence]=0.0; dj += bad; } else { modDj[iSequence]+=dj; dj =0.0; } } #endif } else { assert (dj<1.0e-2); dj = CoinMin(dj,0.0); #ifdef ALLOW_BAD_DJS if (numberBad&&modDj[iSequence]) { double bad=modDj[iSequence]; if (dj+bad<=0.0) { numberBad--; modDj[iSequence]=0.0; dj += bad; } else { modDj[iSequence]+=dj; dj =0.0; } } #endif } } else if (iStatus<6) { assert (fabs(dj)<1.0e-4); dj = 0.0; } abcDj_[iSequence]=dj; } // do basis if (direction>0.0) { if (upperBasic_[iRow]>lowerBasic_[iRow]) setInternalStatus(iRow,atLowerBound); else setInternalStatus(iRow,isFixed); solutionSaved_[iRow]=abcLower_[iRow]; abcSolution_[iRow]=abcLower_[iRow]; } else { if (upperBasic_[iRow]>lowerBasic_[iRow]) setInternalStatus(iRow,atUpperBound); else setInternalStatus(iRow,isFixed); solutionSaved_[iRow]=abcUpper_[iRow]; abcSolution_[iRow]=abcUpper_[iRow]; } setInternalStatus(whichColumn,basic); abcPivotVariable_[iRow]=whichColumn; nBasic++; // mark rows for (CoinBigIndex j=columnStart[whichColumn];j0 printf("dual crash put %d in basis\n",nBasic); #endif } else { assert ((stateOfProblem_&VALUES_PASS2)!=0); // The idea is to put as many likely variables into basis as possible int n=0; int iVector=getAvailableArray(); int * index=usefulArray_[iVector].getIndices(); double * array = usefulArray_[iVector].denseVector(); int iVector2=getAvailableArray(); int * index2=usefulArray_[iVector].getIndices(); for (int iSequence=0;iSequence=-1.0e-3); gapUp=CoinMax(gapUp,0.0); double gapDown=CoinMin(1.0e3,value-lower); assert (gapDown>=-1.0e-3); gapDown=CoinMax(gapDown,0.0); double measure = (CoinMin(gapUp,gapDown)+1.0e-6)/(fabs(dj)+1.0e-6); if (gapUp-dualTolerance_) { // set to lb setInternalStatus(iSequence,atLowerBound); solutionSaved_[iSequence]=abcLower_[iSequence]; abcSolution_[iSequence]=abcLower_[iSequence]; } else if (upper>lower) { // set to nearest if (gapUpgetPackedMatrix()->getVectorStarts()- maximumAbcNumberRows_; //const int * columnLength = abcMatrix_->getPackedMatrix()->getVectorLengths(); const int * row = abcMatrix_->getPackedMatrix()->getIndices(); if (!abcMatrix_->gotRowCopy()) abcMatrix_->createRowCopy(); //const CoinBigIndex * rowStart = abcMatrix_->rowStart(); //const CoinBigIndex * rowEnd = abcMatrix_->rowEnd(); for (int i=0;igotRowCopy()) abcMatrix_->createRowCopy(); const CoinBigIndex * rowStart = abcMatrix_->rowStart(); const CoinBigIndex * rowEnd = abcMatrix_->rowEnd(); if (!index2[iRow]) { int length=rowEnd[iRow]-rowStart[iRow]; if (length=0) { numberIn++; for (CoinBigIndex j=columnStart[iSequence];j-dualTolerance_) { // set to lb setInternalStatus(bestRow,atLowerBound); solutionSaved_[bestRow]=abcLower_[bestRow]; abcSolution_[bestRow]=abcLower_[bestRow]; } else if (upper>lower) { // set to nearest if (gapUp0 printf("Idiot crash put %d in basis\n",numberIn); #endif setAvailableArray(iVector); setAvailableArray(iVector2); delete [] solution_; solution_=NULL; } } /* Puts more stuff in basis 1 bit set - do even if basis exists 2 bit set - don't bother staying triangular */ void AbcSimplex::putStuffInBasis(int type) { int i; for (i=0;igotRowCopy()) abcMatrix_->createRowCopy(); const double * elementByRow = abcMatrix_->rowElements(); const CoinBigIndex * rowStart = abcMatrix_->rowStart(); const CoinBigIndex * rowEnd = abcMatrix_->rowEnd(); const int * column = abcMatrix_->rowColumns(); for (int i=0;iabcLower_[iRow]||getInternalStatus(iRow)!=basic) { mustRowOut[iRow]=-2; continue; } int chooseColumn[2]={-1,-1}; for (CoinBigIndex j=rowStart[iRow];j0.0) { if (chooseColumn[0]==-1) chooseColumn[0]=iColumn; else chooseColumn[0]=-2; } else { if (chooseColumn[1]==-1) chooseColumn[1]=iColumn; else chooseColumn[1]=-2; } } for (int iTry=0;iTry<2;iTry++) { int jColumn=chooseColumn[iTry]; if (jColumn>=0&&getInternalStatus(jColumn)!=basic) { // see if has to be basic double lowerValue=-abcUpper_[iRow]; // check swap double upperValue=-abcLower_[iRow]; int lowerInf=0; int upperInf=0; double alpha=0.0; for (CoinBigIndex j=rowStart[iRow];j-1.0e20) lowerValue -= abcLower_[iColumn]*elementByRow[j]; else lowerInf ++; if (abcUpper_[iColumn]<1.0e20) upperValue -= abcUpper_[iColumn]*elementByRow[j]; else upperInf ++; } else { alpha=elementByRow[j]; } } // find values column must lie between (signs again) if (upperInf) upperValue=COIN_DBL_MAX; else upperValue /=alpha; if (lowerInf) lowerValue=-COIN_DBL_MAX; else lowerValue /=alpha; if (iTry) { // swap double temp=lowerValue; lowerValue=upperValue; upperValue=temp; } if (lowerValue>abcLower_[jColumn]+10.0*primalTolerance_&& upperValue=0) { // choose one ??? //printf("Column %d already selected on row %d now on %d\n", // jColumn,mustRowOut[jColumn],iRow); continue; } mustRowOut[jColumn]=iRow; mustRowOut[iRow]=jColumn; } } } } if (nPossible) { #if ABC_NORMAL_DEBUG>0 printf("%d possible candidates\n",nPossible); #endif if ((type&2)==0) { // triangular int iVector2=getAvailableArray(); int * COIN_RESTRICT counts = usefulArray_[iVector2].getIndices(); CoinAbcMemset0(counts,numberRows_); for (int iRow=0;iRowgetPackedMatrix()->getVectorStarts() -maximumAbcNumberRows_; const int * row = abcMatrix_->getPackedMatrix()->getIndices(); for (int iRow=0;iRow=0) { setInternalStatus(iRow,isFixed); solutionSaved_[iRow]=abcLower_[iRow]; setInternalStatus(iColumn,basic); for (CoinBigIndex j=columnStart[iColumn];j=0) { setInternalStatus(iRow,isFixed); solutionSaved_[iRow]=abcLower_[iRow]; setInternalStatus(iColumn,basic); } } } // redo pivot array int numberBasic=0; for (int iSequence=0;iSequence upperBasic[iRow]) { infeasibility = solutionBasic[iRow] - upperBasic[iRow]; } else if (solutionBasic[iRow] < lowerBasic[iRow]) { infeasibility = lowerBasic[iRow] - solutionBasic[iRow]; } if (infeasibility > primalTolerance) { sumPrimalInfeasibilities_ += infeasibility - primalTolerance_; if (infeasibility > relaxedTolerance) sumOfRelaxedPrimalInfeasibilities_ += infeasibility - relaxedTolerance; numberPrimalInfeasibilities_ ++; } } } else { for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { double infeasibility = 0.0; if (abcSolution_[iSequence] > abcUpper_[iSequence]) { infeasibility = abcSolution_[iSequence] - abcUpper_[iSequence]; } else if (abcSolution_[iSequence] < abcLower_[iSequence]) { infeasibility = abcLower_[iSequence] - abcSolution_[iSequence]; } if (infeasibility > primalTolerance) { //assert (getInternalStatus(iSequence)==basic); sumPrimalInfeasibilities_ += infeasibility - primalTolerance_; if (infeasibility > relaxedTolerance) sumOfRelaxedPrimalInfeasibilities_ += infeasibility - relaxedTolerance; numberPrimalInfeasibilities_ ++; } } } } void AbcSimplex::checkDualSolution() { sumDualInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; int firstFreePrimal = -1; int firstFreeDual = -1; int numberSuperBasicWithDj = 0; bestPossibleImprovement_ = 0.0; // we can't really trust infeasibilities if there is dual error double error = CoinMin(1.0e-2, CoinMax(largestDualError_,5.0*dualTolerance_)); // allow tolerance at least slightly bigger than standard double relaxedTolerance = currentDualTolerance_ + error; // allow bigger tolerance for possible improvement double possTolerance = 5.0 * relaxedTolerance; sumOfRelaxedDualInfeasibilities_ = 0.0; int numberNeedToMove=0; for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if (getInternalStatus(iSequence) != basic && !flagged(iSequence)) { // not basic double distanceUp = abcUpper_[iSequence] - abcSolution_[iSequence]; double distanceDown = abcSolution_[iSequence] - abcLower_[iSequence]; double value = abcDj_[iSequence]; if (distanceUp > primalTolerance_) { // Check if "free" if (distanceDown <= primalTolerance_) { // should not be negative if (value < 0.0) { value = - value; if (value > currentDualTolerance_) { sumDualInfeasibilities_ += value - currentDualTolerance_; if (value > possTolerance) bestPossibleImprovement_ += CoinMin(distanceUp, 1.0e10) * value; if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; } } } else { // free value=fabs(value); if (value > 1.0 * relaxedTolerance) { numberSuperBasicWithDj++; if (firstFreeDual < 0) firstFreeDual = iSequence; } if (value > currentDualTolerance_||getInternalStatus(iSequence)!=AbcSimplex::isFree) { numberNeedToMove++; if (firstFreePrimal < 0) firstFreePrimal = iSequence; sumDualInfeasibilities_ += value - currentDualTolerance_; if (value > possTolerance) bestPossibleImprovement_ += CoinMin(distanceUp, 1.0e10) * value; if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; } } } else if (distanceDown > primalTolerance_) { // should not be positive if (value > 0.0) { if (value > currentDualTolerance_) { sumDualInfeasibilities_ += value - currentDualTolerance_; if (value > possTolerance) bestPossibleImprovement_ += value * CoinMin(distanceDown, 1.0e10); if (value > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += value - relaxedTolerance; numberDualInfeasibilities_ ++; } } } } } numberDualInfeasibilitiesWithoutFree_ = numberDualInfeasibilities_-numberSuperBasicWithDj; if (algorithm_ < 0 && firstFreeDual >= 0) { // dual firstFree_ = firstFreeDual; } else if (numberSuperBasicWithDj||numberNeedToMove) { //(abcProgress_.lastIterationNumber(0) <= 0)) { firstFree_ = firstFreePrimal; if (!sumDualInfeasibilities_) sumDualInfeasibilities_=1.0e-8; } } /* This sets sum and number of infeasibilities (Dual and Primal) */ void AbcSimplex::checkBothSolutions() { // old way checkPrimalSolution(true); checkDualSolution(); } /* Unpacks one column of the matrix into indexed array */ void AbcSimplex::unpack(CoinIndexedVector & rowArray, int sequence) const { abcMatrix_->unpack(rowArray,sequence); } // Sets row pivot choice algorithm in dual void AbcSimplex::setDualRowPivotAlgorithm(AbcDualRowPivot & choice) { delete abcDualRowPivot_; abcDualRowPivot_ = choice.clone(true); abcDualRowPivot_->setModel(this); } // Sets column pivot choice algorithm in primal void AbcSimplex::setPrimalColumnPivotAlgorithm(AbcPrimalColumnPivot & choice) { delete abcPrimalColumnPivot_; abcPrimalColumnPivot_ = choice.clone(true); abcPrimalColumnPivot_->setModel(this); } void AbcSimplex::setFactorization( AbcSimplexFactorization & factorization) { if (abcFactorization_) abcFactorization_->setFactorization(factorization); else abcFactorization_ = new AbcSimplexFactorization(factorization, numberRows_); } // Swaps factorization AbcSimplexFactorization * AbcSimplex::swapFactorization( AbcSimplexFactorization * factorization) { AbcSimplexFactorization * swap = abcFactorization_; abcFactorization_ = factorization; return swap; } /* Tightens primal bounds to make dual faster. Unless fixed, bounds are slightly looser than they could be. This is to make dual go faster and is probably not needed with a presolve. Returns non-zero if problem infeasible */ int AbcSimplex::tightenPrimalBounds() { int tightenType=1; if (maximumIterations()>=1000000&&maximumIterations()<1000010) tightenType=maximumIterations()-1000000; if (!tightenType) return 0; if (integerType_) { #if ABC_NORMAL_DEBUG>0 printf("Redo tighten to relax by 1 for integers (and don't be shocked by infeasibility)\n"); #endif return 0; } // This needs to work on scaled matrix - then replace // Get a row copy in standard format CoinPackedMatrix copy; copy.setExtraGap(0.0); copy.setExtraMajor(0.0); copy.reverseOrderedCopyOf(*abcMatrix_->matrix()); // get matrix data pointers const int * COIN_RESTRICT column = copy.getIndices(); const CoinBigIndex * COIN_RESTRICT rowStart = copy.getVectorStarts(); const int * COIN_RESTRICT rowLength = copy.getVectorLengths(); const double * COIN_RESTRICT element = copy.getElements(); int numberChanged = 1, iPass = 0; double large = largeValue(); // treat bounds > this as infinite #ifndef NDEBUG double large2 = 1.0e10 * large; #endif int numberInfeasible = 0; int totalTightened = 0; double tolerance = primalTolerance(); // A copy of bounds is up at top translate(0); // move down #define MAXPASS 10 // Loop round seeing if we can tighten bounds // Would be faster to have a stack of possible rows // and we put altered rows back on stack int numberCheck = -1; // temp swap signs so can use existing code double * COIN_RESTRICT rowLower=abcLower_; double * COIN_RESTRICT rowUpper=abcUpper_; for (int iRow=0;iRow(usefulArray_[whichArray[2]].getIndices()); // -1 no infinite, -2 more than one infinite >=0 column int * COIN_RESTRICT whichInfiniteDown = usefulArray_[whichArray[3]].getIndices(); int * COIN_RESTRICT whichInfiniteUp = usefulArray_[whichArray[3]].getIndices(); int numberToDoNext=0; for (int iRow=0;iRow -large || rowUpper[iRow] < large) { changedListNext[numberToDoNext++]=iRow; whichInfiniteDown[iRow]=-1; whichInfiniteUp[iRow]=-1; } else { minRhs[iRow]=-COIN_DBL_MAX; maxRhs[iRow]=COIN_DBL_MAX; whichInfiniteDown[iRow]=-2; whichInfiniteUp[iRow]=-2; } } const int * COIN_RESTRICT row = abcMatrix_->matrix()->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = abcMatrix_->matrix()->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = abcMatrix_->matrix()->getElements(); double * COIN_RESTRICT columnLower=abcLower_+maximumAbcNumberRows_; double * COIN_RESTRICT columnUpper=abcUpper_+maximumAbcNumberRows_; while(numberChanged > numberCheck) { int numberToDo=numberToDoNext; numberToDoNext=0; int * COIN_RESTRICT temp=changedList; changedList=changedListNext; changedListNext=temp; CoinAbcMemset0(changed,numberRows_); numberChanged = 0; // Bounds tightened this pass if (iPass == MAXPASS) break; iPass++; for (int k=0;k 0.0) { if (columnUpper[iColumn] >= large) { firstInfiniteUpper=iColumn; ++infiniteUpper; } else { maximumUp += columnUpper[iColumn] * value; } if (columnLower[iColumn] <= -large) { firstInfiniteLower=iColumn; ++infiniteLower; } else { maximumDown += columnLower[iColumn] * value; } } else if (value < 0.0) { if (columnUpper[iColumn] >= large) { firstInfiniteLower=iColumn; ++infiniteLower; } else { maximumDown += columnUpper[iColumn] * value; } if (columnLower[iColumn] <= -large) { firstInfiniteUpper=iColumn; ++infiniteUpper; } else { maximumUp += columnLower[iColumn] * value; } } } // Build in a margin of error maximumUp += 1.0e-8 * fabs(maximumUp); maximumDown -= 1.0e-8 * fabs(maximumDown); double maxUp = maximumUp + infiniteUpper * 1.0e31; double maxDown = maximumDown - infiniteLower * 1.0e31; minRhs[iRow]=infiniteLower ? -COIN_DBL_MAX : maximumDown; maxRhs[iRow]=infiniteUpper ? COIN_DBL_MAX : maximumUp; if (infiniteLower==0) whichInfiniteDown[iRow]=-1; else if (infiniteLower==1) whichInfiniteDown[iRow]=firstInfiniteLower; else whichInfiniteDown[iRow]=-2; if (infiniteUpper==0) whichInfiniteUp[iRow]=-1; else if (infiniteUpper==1) whichInfiniteUp[iRow]=firstInfiniteUpper; else whichInfiniteUp[iRow]=-2; if (maxUp <= rowUpper[iRow] + tolerance && maxDown >= rowLower[iRow] - tolerance) { // Row is redundant - make totally free // NO - can't do this for postsolve // rowLower[iRow]=-COIN_DBL_MAX; // rowUpper[iRow]=COIN_DBL_MAX; //printf("Redundant row in presolveX %d\n",iRow); } else { if (maxUp < rowLower[iRow] - 100.0 * tolerance || maxDown > rowUpper[iRow] + 100.0 * tolerance) { // problem is infeasible - exit at once numberInfeasible++; break; } double lower = rowLower[iRow]; double upper = rowUpper[iRow]; for (j = rStart; j < rEnd; ++j) { double value = element[j]; int iColumn = column[j]; double nowLower = columnLower[iColumn]; double nowUpper = columnUpper[iColumn]; if (value > 0.0) { // positive value if (lower > -large) { if (!infiniteUpper) { assert(nowUpper < large2); newBound = nowUpper + (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumUp); } else if (infiniteUpper == 1 && nowUpper > large) { newBound = (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumUp); } else { newBound = -COIN_DBL_MAX; } if (newBound > nowLower + 1.0e-12 && newBound > -large) { // Tighten the lower bound numberChanged++; // check infeasible (relaxed) if (nowUpper < newBound) { if (nowUpper - newBound < -100.0 * tolerance) numberInfeasible++; else newBound = nowUpper; } columnLower[iColumn] = newBound; for (CoinBigIndex j1=columnStart[iColumn];j1 - large2); newBound = nowLower + (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound += 1.0e-12 * fabs(maximumDown); } else if (infiniteLower == 1 && nowLower < -large) { newBound = (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound += 1.0e-12 * fabs(maximumDown); } else { newBound = COIN_DBL_MAX; } if (newBound < nowUpper - 1.0e-12 && newBound < large) { // Tighten the upper bound numberChanged++; // check infeasible (relaxed) if (nowLower > newBound) { if (newBound - nowLower < -100.0 * tolerance) numberInfeasible++; else newBound = nowLower; } columnUpper[iColumn] = newBound; for (CoinBigIndex j1=columnStart[iColumn];j1 large) { now = 0.0; infiniteUpper--; } else { now = nowUpper; } maximumUp += (newBound - now) * value; nowUpper = newBound; } } } else { // negative value if (lower > -large) { if (!infiniteUpper) { assert(nowLower < large2); newBound = nowLower + (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound += 1.0e-12 * fabs(maximumUp); } else if (infiniteUpper == 1 && nowLower < -large) { newBound = (lower - maximumUp) / value; // relax if original was large if (fabs(maximumUp) > 1.0e8) newBound += 1.0e-12 * fabs(maximumUp); } else { newBound = COIN_DBL_MAX; } if (newBound < nowUpper - 1.0e-12 && newBound < large) { // Tighten the upper bound numberChanged++; // check infeasible (relaxed) if (nowLower > newBound) { if (newBound - nowLower < -100.0 * tolerance) numberInfeasible++; else newBound = nowLower; } columnUpper[iColumn] = newBound; for (CoinBigIndex j1=columnStart[iColumn];j1 large) { now = 0.0; infiniteLower--; } else { now = nowUpper; } maximumDown += (newBound - now) * value; nowUpper = newBound; } } if (upper < large) { if (!infiniteLower) { assert(nowUpper < large2); newBound = nowUpper + (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumDown); } else if (infiniteLower == 1 && nowUpper > large) { newBound = (upper - maximumDown) / value; // relax if original was large if (fabs(maximumDown) > 1.0e8) newBound -= 1.0e-12 * fabs(maximumDown); } else { newBound = -COIN_DBL_MAX; } if (newBound > nowLower + 1.0e-12 && newBound > -large) { // Tighten the lower bound numberChanged++; // check infeasible (relaxed) if (nowUpper < newBound) { if (nowUpper - newBound < -100.0 * tolerance) numberInfeasible++; else newBound = nowUpper; } columnLower[iColumn] = newBound; for (CoinBigIndex j1=columnStart[iColumn];j1matrix()->getElements(); for (int iColumn=0;iColumn> 4; if (numberInfeasible) break; } const double * COIN_RESTRICT saveLower = abcLower_+maximumNumberTotal_+maximumAbcNumberRows_; const double * COIN_RESTRICT saveUpper = abcUpper_+maximumNumberTotal_+maximumAbcNumberRows_; if (!numberInfeasible) { handler_->message(CLP_SIMPLEX_BOUNDTIGHTEN, messages_) << totalTightened << CoinMessageEol; int numberLowerChanged=0; int numberUpperChanged=0; if (!integerType_) { // Set bounds slightly loose // tighten rows as well //#define PRINT_TIGHTEN_PROGRESS 0 for (int iRow = 0; iRow < numberRows_; iRow++) { assert (maxRhs[iRow]>=rowLower[iRow]); assert (minRhs[iRow]<=rowUpper[iRow]); rowLower[iRow]=CoinMax(rowLower[iRow],minRhs[iRow]); rowUpper[iRow]=CoinMin(rowUpper[iRow],maxRhs[iRow]); #if PRINT_TIGHTEN_PROGRESS>3 if (handler_->logLevel()>5) printf("Row %d min %g max %g lower %g upper %g\n", iRow,minRhs[iRow],maxRhs[iRow],rowLower[iRow],rowUpper[iRow]); #endif } #if 0 double useTolerance = 1.0e-4; double multiplier = 100.0; // To do this we need to compute min and max JUST for no costs? const double * COIN_RESTRICT cost = abcCost_+maximumAbcNumberRows_; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (saveUpper[iColumn] > saveLower[iColumn] + useTolerance) { double awayFromLower=0.0; double awayFromUpper=0.0; //double gap=columnUpper[iColumn]-columnLower[iColumn]; for (CoinBigIndex j=columnStart[iColumn];j3 if (handler_->logLevel()>5) printf("row %d element %g\n",iRow,value); #endif if (value>0.0) { if (minRhs[iRow]+value*awayFromLower-1.0e10&&awayFromLower<1.0e10) awayFromLower = CoinMax(awayFromLower,(rowLower[iRow]-minRhs[iRow])/value); else awayFromLower=COIN_DBL_MAX; } if (maxRhs[iRow]-value*awayFromUpper>rowUpper[iRow]) { if (maxRhs[iRow]<1.0e10&&awayFromUpper<1.0e10) awayFromUpper = CoinMax(awayFromUpper,(maxRhs[iRow]-rowUpper[iRow])/value); else awayFromUpper=COIN_DBL_MAX; } } else { if (maxRhs[iRow]+value*awayFromLower>rowUpper[iRow]) { if (maxRhs[iRow]<1.0e10&&awayFromLower<1.0e10) awayFromLower = CoinMax(awayFromLower,(rowUpper[iRow]-maxRhs[iRow])/value); else awayFromLower=COIN_DBL_MAX; } if (minRhs[iRow]-value*awayFromUpper-1.0e10&&awayFromUpper<1.0e10) awayFromUpper = CoinMin(awayFromUpper,(minRhs[iRow]-rowLower[iRow])/value); else awayFromUpper=COIN_DBL_MAX; } } } // Might have to go as high as double upper = CoinMin(columnLower[iColumn]+awayFromLower,columnUpper[iColumn]); // and as low as double lower = CoinMax(columnUpper[iColumn]-awayFromUpper,columnLower[iColumn]); // but be sensible double gap=0.999*(CoinMin(columnUpper[iColumn]-columnLower[iColumn],1.0e10)); if (awayFromLower>gap||awayFromUpper>gap) { if (fabs(columnUpper[iColumn]-upper)>1.0e-5) { #if PRINT_TIGHTEN_PROGRESS>1 printf("YYchange upper bound on %d from %g (original %g) to %g (awayFromLower %g) - cost %g\n",iColumn, columnUpper[iColumn],saveUpper[iColumn],upper,awayFromLower,cost[iColumn]); #endif upper=columnUpper[iColumn]; } if (fabs(columnLower[iColumn]-lower)>1.0e-5) { #if PRINT_TIGHTEN_PROGRESS>1 printf("YYchange lower bound on %d from %g (original %g) to %g (awayFromUpper %g) - cost %g\n",iColumn, columnLower[iColumn],saveLower[iColumn],lower,awayFromUpper,cost[iColumn]); #endif lower=columnLower[iColumn]; } } if (lower>upper) { #if PRINT_TIGHTEN_PROGRESS printf("XXchange upper bound on %d from %g (original %g) to %g (awayFromLower %g) - cost %g\n",iColumn, columnUpper[iColumn],saveUpper[iColumn],upper,awayFromLower,cost[iColumn]); printf("XXchange lower bound on %d from %g (original %g) to %g (awayFromUpper %g) - cost %g\n",iColumn, columnLower[iColumn],saveLower[iColumn],lower,awayFromUpper,cost[iColumn]); #endif lower=columnLower[iColumn]; upper=columnUpper[iColumn]; } //upper=CoinMax(upper,0.0); //upper=CoinMax(upper,0.0); if (cost[iColumn]>=0.0&&awayFromLower<1.0e10&&columnLower[iColumn]>-1.0e10) { // doesn't want to be too positive if (fabs(columnUpper[iColumn]-upper)>1.0e-5) { #if PRINT_TIGHTEN_PROGRESS>2 if (handler_->logLevel()>1) printf("change upper bound on %d from %g (original %g) to %g (awayFromLower %g) - cost %g\n",iColumn, columnUpper[iColumn],saveUpper[iColumn],upper,awayFromLower,cost[iColumn]); #endif double difference=columnUpper[iColumn]-upper; for (CoinBigIndex j=columnStart[iColumn];j0.0) { assert (difference*value>=0.0); maxRhs[iRow]-=difference*value; } else { assert (difference*value<=0.0); minRhs[iRow]-=difference*value; } } columnUpper[iColumn]=upper; numberUpperChanged++; } } if (cost[iColumn]<=0.0&&awayFromUpper<1.0e10&&columnUpper[iColumn]<1.0e10) { // doesn't want to be too negative if (fabs(columnLower[iColumn]-lower)>1.0e-5) { #if PRINT_TIGHTEN_PROGRESS>2 if (handler_->logLevel()>1) printf("change lower bound on %d from %g (original %g) to %g (awayFromUpper %g) - cost %g\n",iColumn, columnLower[iColumn],saveLower[iColumn],lower,awayFromUpper,cost[iColumn]); #endif double difference=columnLower[iColumn]-lower; for (CoinBigIndex j=columnStart[iColumn];j0.0) { assert (difference*value<=0.0); minRhs[iRow]-=difference*value; } else { assert (difference*value>=0.0); maxRhs[iRow]-=difference*value; } } columnLower[iColumn]=lower; numberLowerChanged++; } } // Make large bounds stay infinite if (saveUpper[iColumn] > 1.0e30 && columnUpper[iColumn] > 1.0e10) { columnUpper[iColumn] = COIN_DBL_MAX; } if (saveLower[iColumn] < -1.0e30 && columnLower[iColumn] < -1.0e10) { columnLower[iColumn] = -COIN_DBL_MAX; } if (columnUpper[iColumn] - columnLower[iColumn] < useTolerance + 1.0e-8) { // relax enough so will have correct dj columnLower[iColumn] = CoinMax(saveLower[iColumn], columnLower[iColumn] - multiplier * useTolerance); columnUpper[iColumn] = CoinMin(saveUpper[iColumn], columnUpper[iColumn] + multiplier * useTolerance); } else { if (columnUpper[iColumn] < saveUpper[iColumn]) { // relax a bit columnUpper[iColumn] = CoinMin(columnUpper[iColumn] + multiplier * useTolerance, saveUpper[iColumn]); } if (columnLower[iColumn] > saveLower[iColumn]) { // relax a bit columnLower[iColumn] = CoinMax(columnLower[iColumn] - multiplier * useTolerance, saveLower[iColumn]); } } if (0) { // debug // tighten rows as well for (int iRow = 0; iRow < numberRows_; iRow++) { if (rowLower[iRow] > -large || rowUpper[iRow] < large) { // possible row int infiniteUpper = 0; int infiniteLower = 0; double maximumUp = 0.0; double maximumDown = 0.0; CoinBigIndex rStart = rowStart[iRow]; CoinBigIndex rEnd = rowStart[iRow] + rowLength[iRow]; CoinBigIndex j; // Compute possible lower and upper ranges for (j = rStart; j < rEnd; ++j) { double value = element[j]; int iColumn = column[j]; if (value > 0.0) { if (columnUpper[iColumn] >= large) { ++infiniteUpper; } else { maximumUp += columnUpper[iColumn] * value; } if (columnLower[iColumn] <= -large) { ++infiniteLower; } else { maximumDown += columnLower[iColumn] * value; } } else if (value < 0.0) { if (columnUpper[iColumn] >= large) { ++infiniteLower; } else { maximumDown += columnUpper[iColumn] * value; } if (columnLower[iColumn] <= -large) { ++infiniteUpper; } else { maximumUp += columnLower[iColumn] * value; } } } // Build in a margin of error double maxUp = maximumUp+1.0e-8 * fabs(maximumUp); double maxDown = maximumDown-1.0e-8 * fabs(maximumDown); double rLower=rowLower[iRow]; double rUpper=rowUpper[iRow]; if (!infiniteUpper&&maxUp < rUpper - tolerance) { if (rUpper!=COIN_DBL_MAX||maximumUp<1.0e5) rUpper=maximumUp; } if (!infiniteLower&&maxDown > rLower + tolerance) { if (rLower!=-COIN_DBL_MAX||maximumDown>-1.0e5) rLower=maximumDown; } if (infiniteUpper) maxUp=COIN_DBL_MAX; if (fabs(maxUp-maxRhs[iRow])>1.0e-3*(1.0+fabs(maxUp))) printf("bad Maxup row %d maxUp %g maxRhs %g\n",iRow,maxUp,maxRhs[iRow]); maxRhs[iRow]=maxUp; if (infiniteLower) maxDown=-COIN_DBL_MAX; if (fabs(maxDown-minRhs[iRow])>1.0e-3*(1.0+fabs(maxDown))) printf("bad Maxdown row %d maxDown %g minRhs %g\n",iRow,maxDown,minRhs[iRow]); minRhs[iRow]=maxDown; assert(rLower<=rUpper); } } // end debug } } } if (tightenType>1) { // relax for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { // relax enough so will have correct dj double lower=saveLower[iColumn]; double upper=saveUpper[iColumn]; columnLower[iColumn] = CoinMax(lower,columnLower[iColumn] - multiplier); columnUpper[iColumn] = CoinMin(upper,columnUpper[iColumn] + multiplier); } } #endif } else { #if ABC_NORMAL_DEBUG>0 printf("Redo tighten to relax by 1 for integers\n"); #endif } #if ABC_NORMAL_DEBUG>0 printf("Tighten - phase1 %d bounds changed, phase2 %d lower, %d upper\n", totalTightened,numberLowerChanged,numberUpperChanged); #endif if (integerType_) { const double * columnScale=scaleToExternal_+maximumAbcNumberRows_; const double * inverseColumnScale=scaleFromExternal_+maximumAbcNumberRows_; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (integerType_[iColumn]) { double value; double lower = columnLower[iColumn]*inverseColumnScale[iColumn]; double upper = columnUpper[iColumn]*inverseColumnScale[iColumn]; value = floor(lower + 0.5); if (fabs(value - lower) > primalTolerance_) value = ceil(lower); columnLower_[iColumn] = value; columnLower[iColumn]=value*columnScale[iColumn]; value = floor(upper + 0.5); if (fabs(value - upper) > primalTolerance_) value = floor(upper); columnUpper_[iColumn] = value; columnUpper[iColumn]=value*columnScale[iColumn]; if (columnLower_[iColumn] > columnUpper_[iColumn]) numberInfeasible++; } } if (numberInfeasible) { handler_->message(CLP_SIMPLEX_INFEASIBILITIES, messages_) << numberInfeasible << CoinMessageEol; // restore column bounds CoinMemcpyN(saveLower, numberColumns_, columnLower_); CoinMemcpyN(saveUpper, numberColumns_, columnUpper_); } } } else { handler_->message(CLP_SIMPLEX_INFEASIBILITIES, messages_) << numberInfeasible << CoinMessageEol; // restore column bounds CoinMemcpyN(saveLower, numberColumns_, columnLower_); CoinMemcpyN(saveUpper, numberColumns_, columnUpper_); } if (!numberInfeasible) { // tighten rows as well for (int iRow = 0; iRow < numberRows_; iRow++) { if (rowLower[iRow] > -large || rowUpper[iRow] < large) { // possible row int infiniteUpper = 0; int infiniteLower = 0; double maximumUp = 0.0; double maximumDown = 0.0; CoinBigIndex rStart = rowStart[iRow]; CoinBigIndex rEnd = rowStart[iRow] + rowLength[iRow]; CoinBigIndex j; // Compute possible lower and upper ranges for (j = rStart; j < rEnd; ++j) { double value = element[j]; int iColumn = column[j]; if (value > 0.0) { if (columnUpper[iColumn] >= large) { ++infiniteUpper; } else { maximumUp += columnUpper[iColumn] * value; } if (columnLower[iColumn] <= -large) { ++infiniteLower; } else { maximumDown += columnLower[iColumn] * value; } } else if (value < 0.0) { if (columnUpper[iColumn] >= large) { ++infiniteLower; } else { maximumDown += columnUpper[iColumn] * value; } if (columnLower[iColumn] <= -large) { ++infiniteUpper; } else { maximumUp += columnLower[iColumn] * value; } } } // Build in a margin of error double maxUp = maximumUp+1.0e-8 * fabs(maximumUp); double maxDown = maximumDown-1.0e-8 * fabs(maximumDown); if (!infiniteUpper&&maxUp < rowUpper[iRow] - tolerance) { if (rowUpper[iRow]!=COIN_DBL_MAX||maximumUp<1.0e5) rowUpper[iRow]=maximumUp; } if (!infiniteLower&&maxDown > rowLower[iRow] + tolerance) { if (rowLower[iRow]!=-COIN_DBL_MAX||maximumDown>-1.0e5) rowLower[iRow]=maximumDown; } assert(rowLower[iRow]<=rowUpper[iRow]); if(rowUpper[iRow]-rowLower[iRow]<1.0e-12) { if (fabs(rowLower[iRow])>fabs(rowUpper[iRow])) rowLower[iRow]=rowUpper[iRow]; else rowUpper[iRow]=rowLower[iRow]; } } } // flip back for (int iRow=0;iRowabcUpper_[i+maximumNumberTotal_]+1.0e-5) printf ("above %d %g %g\n",i, abcSolution_[i+maximumNumberTotal_],abcUpper_[i+maximumNumberTotal_]); if (abcSolution_[i+maximumNumberTotal_]>8)&7; if (crashState&&crashState<4) { switch (crashState) { case 1: crash(1000.0,1); break; case 2: crash(abcSimplex_->dualBound(),0); break; case 3: crash(0.0,3); break; } } // this and abcSimplex_ are approximately same pointer if ((abcState_&CLP_ABC_FULL_DONE)==0) { abcSimplex_->gutsOfResize(numberRows_,numberColumns_); abcSimplex_->translate(DO_SCALE_AND_MATRIX|DO_BASIS_AND_ORDER|DO_STATUS|DO_SOLUTION); //abcSimplex_->permuteIn(); int maximumPivotsAbc=CoinMin(abcSimplex_->factorization()->maximumPivots(),numberColumns_+200); abcSimplex_->factorization()->maximumPivots(maximumPivotsAbc); if (numberColumns_) abcSimplex_->tightenPrimalBounds(); } if ((abcSimplex_->stateOfProblem()&VALUES_PASS2)!=0) { if (solution_) crashState=6; } if (crashState&&crashState>3) { abcSimplex_->crash(crashState-2); } if (crashState&&crashState<4) { abcSimplex_->putStuffInBasis(1+2); } int returnCode = abcSimplex_->doAbcDual(); //set to force crossover test returnCode=1; abcSimplex_->permuteOut(ROW_PRIMAL_OK|ROW_DUAL_OK|COLUMN_PRIMAL_OK|COLUMN_DUAL_OK|ALL_STATUS_OK); if (returnCode) { // fix as this model is all messed up e.g. scaling scalingFlag_ = abs(scalingFlag_); //delete [] rowScale_; //delete [] columnScale_; rowScale_ = NULL; columnScale_ = NULL; #if 0 delete [] savedRowScale_; delete [] savedColumnScale_; savedRowScale_ = NULL; savedColumnScale_ = NULL; inverseRowScale_ = NULL; inverseColumnScale_ = NULL; #endif if (perturbation_==50) perturbation_=51; //perturbation_=100; #if ABC_NORMAL_DEBUG>0 printf("Bad exit with status of %d\n",problemStatus_); #endif //problemStatus_=10; int status=problemStatus_; //problemStatus_=-1; if (status!=10) { dual(); // Do ClpSimplexDual } else { moreSpecialOptions_ |= 256; primal(1); } } else { // double check objective //printf("%g %g\n",objectiveValue(),abcSimplex_->objectiveValue()); perturbation_=100; moreSpecialOptions_ |= 256; //primal(1); } return returnCode; } } #endif #include "AbcSimplexPrimal.hpp" // Do dual (return 1 if cleanup needed) int AbcSimplex::doAbcDual() { if (objective_) { objective_->setActivated(0); } else { // create dummy stuff assert (!numberColumns_); if (!numberRows_) problemStatus_ = 0; // say optimal return 0; } /* Note use of "down casting". The only class the user sees is AbcSimplex. Classes AbcSimplexDual, AbcSimplexPrimal, (AbcSimplexNonlinear) and AbcSimplexOther all exist and inherit from AbcSimplex but have no additional data and have no destructor or (non-default) constructor. This is to stop classes becoming too unwieldy and so I (JJHF) can use e.g. "perturb" in primal and dual. As far as I can see this is perfectly safe. */ algorithm_=-1; baseIteration_=numberIterations_; if (!abcMatrix_->gotRowCopy()) abcMatrix_->createRowCopy(); #ifdef EARLY_FACTORIZE if (maximumIterations()>1000000&&maximumIterations()<1000999) { numberEarly_=maximumIterations()-1000000; #if ABC_NORMAL_DEBUG>0 printf("Setting numberEarly_ to %d\n",numberEarly_); #endif numberEarly_+=numberEarly_<<16; } #endif minimumThetaMovement_=1.0e-10; if (fabs(infeasibilityCost_-1.0e10)<1.1e9 &&fabs(infeasibilityCost_-1.0e10)>1.0e5&&false) { minimumThetaMovement_=1.0e-3/fabs(infeasibilityCost_-1.0e10); printf("trying minimum theta movement of %g\n",minimumThetaMovement_); infeasibilityCost_=1.0e10; } int savePerturbation=perturbation_; static_cast (this)->dual(); minimumThetaMovement_=1.0e-10; if ((specialOptions_&2048)!=0 && problemStatus_==10 && !numberPrimalInfeasibilities_ && sumDualInfeasibilities_ < 1000.0* dualTolerance_) problemStatus_ = 0; // ignore onStopped(); // set secondary status if stopped if (problemStatus_==1&&numberFlagged_) { problemStatus_=10; static_cast (this)->unflag(); } if (perturbation_<101) { //printf("Perturbed djs?\n"); double * save=abcCost_; abcCost_=costSaved_; computeInternalObjectiveValue(); abcCost_=save; } int totalNumberIterations=numberIterations_; if (problemStatus_ == 10 && (moreSpecialOptions_&32768)!=0 &&sumDualInfeasibilities_ < 0.1) { problemStatus_=0; } #ifndef TRY_ABC_GUS if (problemStatus_==10) { int savePerturbation=perturbation_; perturbation_=100; copyFromSaved(2); minimumThetaMovement_=1.0e-12; baseIteration_=numberIterations_; static_cast (this)->primal(0); totalNumberIterations+=numberIterations_-baseIteration_; perturbation_=savePerturbation; } #else int iPass=0; while (problemStatus_==10&&minimumThetaMovement_>0.99999e-12) { iPass++; if (initialSumInfeasibilities_>=0.0) { if (savePerturbation>=100) { perturbation_=100; } else { if (savePerturbation==50) perturbation_=CoinMax(51,HEAVY_PERTURBATION-4-iPass); //smaller else perturbation_=CoinMax(51,savePerturbation-1-iPass); //smaller } } else { perturbation_=savePerturbation; abcFactorization_->setPivots(100000); // force factorization initialSumInfeasibilities_=1.23456789e-5; // clean pivots int numberBasic=0; int * pivot=pivotVariable(); for (int i=0;i3) moreSpecialOptions_ |= 256; if (iPass>2) perturbation_=101; baseIteration_=numberIterations_; static_cast (this)->primal(0); totalNumberIterations+=numberIterations_-baseIteration_; if (problemStatus_==10) { // reduce minimumThetaMovement_*=1.0e-1; copyFromSaved(14); baseIteration_=numberIterations_; static_cast (this)->dual(); totalNumberIterations+=numberIterations_-baseIteration_; } perturbation_=savePerturbation; } #endif numberIterations_=totalNumberIterations; return (problemStatus_<0||problemStatus_==4||problemStatus_==10) ? 1 : 0; } int AbcSimplex::dual () { if (!abcMatrix_->gotRowCopy()) abcMatrix_->createRowCopy(); assert (!numberFlagged_); baseIteration_=numberIterations_; //double savedPivotTolerance = abcFactorization_->pivotTolerance(); if (objective_) { objective_->setActivated(0); } else { // create dummy stuff assert (!numberColumns_); if (!numberRows_) problemStatus_ = 0; // say optimal return 0; } /* Note use of "down casting". The only class the user sees is AbcSimplex. Classes AbcSimplexDual, AbcSimplexPrimal, (AbcSimplexNonlinear) and AbcSimplexOther all exist and inherit from AbcSimplex but have no additional data and have no destructor or (non-default) constructor. This is to stop classes becoming too unwieldy and so I (JJF) can use e.g. "perturb" in primal and dual. As far as I can see this is perfectly safe. */ minimumThetaMovement_=1.0e-12; int returnCode = static_cast (this)->dual(); if ((specialOptions_ & 2048) != 0 && problemStatus_ == 10 && !numberPrimalInfeasibilities_ && sumDualInfeasibilities_ < 1000.0 * dualTolerance_ && perturbation_ >= 100) problemStatus_ = 0; // ignore if (problemStatus_ == 10) { #if 1 //ABC_NORMAL_DEBUG>0 printf("return and use ClpSimplexPrimal\n"); abort(); #else //printf("Cleaning up with primal\n"); //lastAlgorithm=1; int savePerturbation = perturbation_; int saveLog = handler_->logLevel(); //handler_->setLogLevel(63); perturbation_ = 101; bool denseFactorization = initialDenseFactorization(); // It will be safe to allow dense setInitialDenseFactorization(true); // Allow for catastrophe int saveMax = intParam_[ClpMaxNumIteration]; if (numberIterations_) { // normal if (intParam_[ClpMaxNumIteration] > 100000 + numberIterations_) intParam_[ClpMaxNumIteration] = numberIterations_ + 1000 + 2 * numberRows_ + numberColumns_; } else { // Not normal allow more baseIteration_ += 2 * (numberRows_ + numberColumns_); } // check which algorithms allowed int dummy; if (problemStatus_ == 10 && saveObjective == objective_) startFinishOptions |= 2; baseIteration_ = numberIterations_; // Say second call moreSpecialOptions_ |= 256; minimumThetaMovement_=1.0e-12; returnCode = static_cast (this)->primal(1, startFinishOptions); // Say not second call moreSpecialOptions_ &= ~256; baseIteration_ = 0; if (saveObjective != objective_) { // We changed objective to see if infeasible delete objective_; objective_ = saveObjective; if (!problemStatus_) { // carry on returnCode = static_cast (this)->primal(1, startFinishOptions); } } if (problemStatus_ == 3 && numberIterations_ < saveMax) { // flatten solution and try again for (int iSequence = 0; iSequence < numberTotal_; iSequence++) { if (getInternalStatus(iSequence) != basic) { setInternalStatus(iSequence, superBasic); // but put to bound if close if (fabs(rowActivity_[iSequence] - rowLower_[iSequence]) <= primalTolerance_) { abcSolution_[iSequence] = abcLower_[iSequence]; setInternalStatus(iSequence, atLowerBound); } else if (fabs(rowActivity_[iSequence] - rowUpper_[iSequence]) <= primalTolerance_) { abcSolution_[iSequence] = abcUpper_[iSequence]; setInternalStatus(iSequence, atUpperBound); } } } problemStatus_ = -1; intParam_[ClpMaxNumIteration] = CoinMin(numberIterations_ + 1000 + 2 * numberRows_ + numberColumns_, saveMax); perturbation_ = savePerturbation; baseIteration_ = numberIterations_; // Say second call moreSpecialOptions_ |= 256; returnCode = static_cast (this)->primal(0, startFinishOptions); // Say not second call moreSpecialOptions_ &= ~256; baseIteration_ = 0; computeObjectiveValue(); // can't rely on djs either memset(reducedCost_, 0, numberColumns_ * sizeof(double)); } intParam_[ClpMaxNumIteration] = saveMax; setInitialDenseFactorization(denseFactorization); perturbation_ = savePerturbation; if (problemStatus_ == 10) { if (!numberPrimalInfeasibilities_) problemStatus_ = 0; else problemStatus_ = 4; } handler_->setLogLevel(saveLog); #endif } onStopped(); // set secondary status if stopped return returnCode; } #ifdef ABC_INHERIT // primal // Returns 0 if primal can be skipped int ClpSimplex::doAbcPrimal(int ifValuesPass) { if ((abcState_&CLP_ABC_WANTED)==0) { return 1; // not wanted } else { assert (abcSimplex_); if (ifValuesPass) abcSimplex_->setStateOfProblem(abcSimplex_->stateOfProblem()|VALUES_PASS); int crashState=(abcState_>>8)&7; if (crashState&&crashState<4) { switch (crashState) { case 1: crash(1000.0,1); break; case 2: crash(abcSimplex_->dualBound(),0); break; case 3: crash(0.0,3); break; } } // this and abcSimplex_ are approximately same pointer if ((abcState_&CLP_ABC_FULL_DONE)==0) { abcSimplex_->gutsOfResize(numberRows_,numberColumns_); abcSimplex_->translate(DO_SCALE_AND_MATRIX|DO_BASIS_AND_ORDER|DO_STATUS|DO_SOLUTION); //abcSimplex_->permuteIn(); int maximumPivotsAbc=CoinMin(abcSimplex_->factorization()->maximumPivots(),numberColumns_+200); abcSimplex_->factorization()->maximumPivots(maximumPivotsAbc); abcSimplex_->copyFromSaved(1); } if ((abcSimplex_->stateOfProblem()&VALUES_PASS2)!=0) { if (solution_) crashState=6; } if (crashState&&crashState>3) { abcSimplex_->crash(crashState-2); } if (crashState&&crashState<4) { abcSimplex_->putStuffInBasis(1+2); } int returnCode = abcSimplex_->doAbcPrimal(ifValuesPass); //set to force crossover test returnCode=1; abcSimplex_->permuteOut(ROW_PRIMAL_OK|ROW_DUAL_OK|COLUMN_PRIMAL_OK|COLUMN_DUAL_OK|ALL_STATUS_OK); if (returnCode && problemStatus_ < 3) { // fix as this model is all messed up e.g. scaling scalingFlag_ = abs(scalingFlag_); //delete [] rowScale_; //delete [] columnScale_; rowScale_ = NULL; columnScale_ = NULL; #if 0 delete [] savedRowScale_; delete [] savedColumnScale_; savedRowScale_ = NULL; savedColumnScale_ = NULL; inverseRowScale_ = NULL; inverseColumnScale_ = NULL; #endif if (perturbation_==50) perturbation_=51; //perturbation_=100; #if ABC_NORMAL_DEBUG>0 if (problemStatus_) printf("Bad exit with status of %d\n",problemStatus_); #endif //problemStatus_=10; int status=problemStatus_; // should not be using for (int i = 0; i < 6; i++) { if (rowArray_[i]) rowArray_[i]->clear(); if (columnArray_[i]) columnArray_[i]->clear(); } //problemStatus_=-1; if (status<3&&status!=0) { if (status!=10) { primal(); // Do ClpSimplexPrimal } else { moreSpecialOptions_ |= 256; dual(); } } } else { // double check objective //printf("%g %g\n",objectiveValue(),abcSimplex_->objectiveValue()); } numberIterations_=abcSimplex_->numberIterations(); return returnCode; } } #endif // Do primal (return 1 if cleanup needed) int AbcSimplex::doAbcPrimal(int ifValuesPass) { if (objective_) { objective_->setActivated(0); } else { // create dummy stuff assert (!numberColumns_); if (!numberRows_) problemStatus_ = 0; // say optimal return 0; } /* Note use of "down casting". The only class the user sees is AbcSimplex. Classes AbcSimplexDual, AbcSimplexPrimal, (AbcSimplexNonlinear) and AbcSimplexOther all exist and inherit from AbcSimplex but have no additional data and have no destructor or (non-default) constructor. This is to stop classes becoming too unwieldy and so I (JJHF) can use e.g. "perturb" in primal and dual. As far as I can see this is perfectly safe. */ algorithm_=-1; int savePerturbation=perturbation_; baseIteration_=numberIterations_; if (!abcMatrix_->gotRowCopy()) abcMatrix_->createRowCopy(); #ifdef EARLY_FACTORIZE if (maximumIterations()>1000000&&maximumIterations()<1000999) { numberEarly_=maximumIterations()-1000000; #if ABC_NORMAL_DEBUG>0 printf("Setting numberEarly_ to %d\n",numberEarly_); #endif numberEarly_+=numberEarly_<<16; } #endif // add values pass options minimumThetaMovement_=1.0e-12; if ((specialOptions_&8192)!=0) minimumThetaMovement_=1.0e-15; int returnCode=static_cast (this)->primal(ifValuesPass); stateOfProblem_ &= ~VALUES_PASS; #ifndef TRY_ABC_GUS if (returnCode==10) { copyFromSaved(14); int savePerturbation=perturbation_; perturbation_=51; minimumThetaMovement_=1.0e-12; returnCode=static_cast (this)->dual(); perturbation_=savePerturbation; } #else minimumThetaMovement_=1.0e-12; int iPass=0; while (problemStatus_==10&&minimumThetaMovement_>1.0e-15) { iPass++; if (minimumThetaMovement_==1.0e-12) perturbation_=CoinMin(savePerturbation,55); else perturbation_=100; copyFromSaved(14); // reduce ? // Say second call // Say second call if (iPass>3) moreSpecialOptions_ |= 256; if (iPass>2) perturbation_=101; baseIteration_=numberIterations_; // make sure no superbasic cleanStatus(); if ((specialOptions_&8192)==0) static_cast (this)->dual(); baseIteration_=numberIterations_; if (problemStatus_==10) { if (initialSumInfeasibilities_>=0.0) { if (savePerturbation>=100) { perturbation_=100; } else { if (savePerturbation==50) perturbation_=CoinMax(51,HEAVY_PERTURBATION-4-iPass); //smaller else perturbation_=CoinMax(51,savePerturbation-1-iPass); //smaller } } else { specialOptions_ |= 8192; // stop going to dual perturbation_=savePerturbation; abcFactorization_->setPivots(100000); // force factorization initialSumInfeasibilities_=1.23456789e-5; // clean pivots int numberBasic=0; int * pivot=pivotVariable(); for (int i=0;i2) perturbation_=100; copyFromSaved(14); baseIteration_=numberIterations_; static_cast (this)->primal(0); } minimumThetaMovement_*=0.5; perturbation_=savePerturbation; } #endif return returnCode; } /* Sets up all slack basis and resets solution to as it was after initial load or readMps */ void AbcSimplex::allSlackBasis() { // set column status to one nearest zero CoinFillN(internalStatus_,numberRows_,static_cast(basic)); const double * COIN_RESTRICT lower = abcLower_; const double * COIN_RESTRICT upper = abcUpper_; double * COIN_RESTRICT solution = abcSolution_; // But set value to zero if lb <0.0 and ub>0.0 for (int i = maximumAbcNumberRows_; i < numberTotal_; i++) { if (lower[i] >= 0.0) { solution[i] = lower[i]; setInternalStatus(i, atLowerBound); } else if (upper[i] <= 0.0) { solution[i] = upper[i]; setInternalStatus(i, atUpperBound); } else if (lower[i] < -1.0e20 && upper[i] > 1.0e20) { // free solution[i] = 0.0; setInternalStatus(i, isFree); } else if (fabs(lower[i]) < fabs(upper[i])) { solution[i] = 0.0; setInternalStatus(i, atLowerBound); } else { solution[i] = 0.0; setInternalStatus(i, atUpperBound); } } } #if 0 //ndef SLIM_NOIO // Read an mps file from the given filename int AbcSimplex::readMps(const char *filename, bool keepNames, bool ignoreErrors) { int status = ClpSimplex::readMps(filename, keepNames, ignoreErrors); ClpSimplex * thisModel=this; gutsOfResize(thisModel->numberRows(),thisModel->numberColumns()); translate(DO_SCALE_AND_MATRIX|DO_BASIS_AND_ORDER|DO_STATUS|DO_SOLUTION); return status; } // Read GMPL files from the given filenames int AbcSimplex::readGMPL(const char *filename, const char * dataName, bool keepNames) { int status = ClpSimplex::readGMPL(filename, dataName, keepNames); translate(DO_SCALE_AND_MATRIX|DO_BASIS_AND_ORDER|DO_STATUS|DO_SOLUTION); return status; } // Read file in LP format from file with name filename. int AbcSimplex::readLp(const char *filename, const double epsilon ) { FILE *fp = fopen(filename, "r"); if(!fp) { printf("### ERROR: AbcSimplex::readLp(): Unable to open file %s for reading\n", filename); return(1); } CoinLpIO m; m.readLp(fp, epsilon); fclose(fp); // set problem name setStrParam(ClpProbName, m.getProblemName()); // no errors loadProblem(*m.getMatrixByRow(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); if (m.integerColumns()) { integerType_ = new char[numberColumns_]; CoinMemcpyN(m.integerColumns(), numberColumns_, integerType_); } else { integerType_ = NULL; } translate(DO_SCALE_AND_MATRIX|DO_BASIS_AND_ORDER|DO_STATUS|DO_SOLUTION); unsigned int maxLength = 0; int iRow; rowNames_ = std::vector (); columnNames_ = std::vector (); rowNames_.reserve(numberRows_); for (iRow = 0; iRow < numberRows_; iRow++) { const char * name = m.rowName(iRow); if (name) { maxLength = CoinMax(maxLength, static_cast (strlen(name))); rowNames_.push_back(name); } else { rowNames_.push_back(""); } } int iColumn; columnNames_.reserve(numberColumns_); for (iColumn = 0; iColumn < numberColumns_; iColumn++) { const char * name = m.columnName(iColumn); if (name) { maxLength = CoinMax(maxLength, static_cast (strlen(name))); columnNames_.push_back(name); } else { columnNames_.push_back(""); } } lengthNames_ = static_cast (maxLength); return 0; } #endif // Factorization frequency int AbcSimplex::factorizationFrequency() const { if (abcFactorization_) return abcFactorization_->maximumPivots(); else return -1; } void AbcSimplex::setFactorizationFrequency(int value) { if (abcFactorization_) abcFactorization_->maximumPivots(value); } /* Get a clean factorization - i.e. throw out singularities may do more later */ int AbcSimplex::cleanFactorization(int ifValuesPass) { int status = internalFactorize(ifValuesPass ? 10 : 0); if (status < 0) { return 1; // some error } else { firstFree_=0; return 0; } } // Save data ClpDataSave AbcSimplex::saveData() { ClpDataSave saved; saved.dualBound_ = dualBound_; saved.infeasibilityCost_ = infeasibilityCost_; saved.pivotTolerance_ = abcFactorization_->pivotTolerance(); saved.zeroFactorizationTolerance_ = abcFactorization_->zeroTolerance(); saved.zeroSimplexTolerance_ = zeroTolerance_; saved.perturbation_ = perturbation_; saved.forceFactorization_ = forceFactorization_; saved.acceptablePivot_ = acceptablePivot_; saved.objectiveScale_ = objectiveScale_; // Progress indicator abcProgress_.fillFromModel (this); return saved; } // Restore data void AbcSimplex::restoreData(ClpDataSave saved) { //abcFactorization_->sparseThreshold(saved.sparseThreshold_); abcFactorization_->pivotTolerance(saved.pivotTolerance_); abcFactorization_->zeroTolerance(saved.zeroFactorizationTolerance_); zeroTolerance_ = saved.zeroSimplexTolerance_; perturbation_ = saved.perturbation_; infeasibilityCost_ = saved.infeasibilityCost_; dualBound_ = saved.dualBound_; forceFactorization_ = saved.forceFactorization_; objectiveScale_ = saved.objectiveScale_; acceptablePivot_ = saved.acceptablePivot_; } // To flag a variable void AbcSimplex::setFlagged( int sequence) { assert (sequence>=0&&sequence=0) { internalStatus_[sequence] |= 64; // use for real disaster lastFlaggedIteration_ = numberIterations_; numberFlagged_++; } } #ifndef NDEBUG // For errors to make sure print to screen // only called in debug mode static void indexError(int index, std::string methodName) { std::cerr << "Illegal index " << index << " in AbcSimplex::" << methodName << std::endl; throw CoinError("Illegal index", methodName, "AbcSimplex"); } #endif // After modifying first copy refreshes second copy and marks as updated void AbcSimplex::refreshCosts() { whatsChanged_ &= ~OBJECTIVE_SAME; CoinAbcMemcpy(abcCost_,costSaved_,numberTotal_); } void AbcSimplex::refreshLower(unsigned int type) { if (type) whatsChanged_ &= type; CoinAbcMemcpy(abcLower_,lowerSaved_,numberTotal_); } void AbcSimplex::refreshUpper(unsigned int type) { if (type) whatsChanged_ &= type; CoinAbcMemcpy(abcUpper_,upperSaved_,numberTotal_); } /* Set an objective function coefficient */ void AbcSimplex::setObjectiveCoefficient( int elementIndex, double elementValue ) { #ifndef NDEBUG if (elementIndex < 0 || elementIndex >= numberColumns_) { indexError(elementIndex, "setObjectiveCoefficient"); } #endif if (objective()[elementIndex] != elementValue) { objective()[elementIndex] = elementValue; // work arrays exist - update as well whatsChanged_ &= ~OBJECTIVE_SAME; double direction = optimizationDirection_ * objectiveScale_; costSaved_[elementIndex+maximumAbcNumberRows_] = direction * elementValue * columnUseScale_[elementIndex+maximumAbcNumberRows_]; } } /* Set a single row lower bound
    Use -DBL_MAX for -infinity. */ void AbcSimplex::setRowLower( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberRows_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setRowLower"); } #endif if (elementValue < -1.0e27) elementValue = -COIN_DBL_MAX; if (rowLower_[elementIndex] != elementValue) { rowLower_[elementIndex] = elementValue; // work arrays exist - update as well whatsChanged_ &= ~ROW_LOWER_SAME; if (rowLower_[elementIndex] == -COIN_DBL_MAX) { lowerSaved_[elementIndex] = -COIN_DBL_MAX; } else { lowerSaved_[elementIndex] = elementValue * rhsScale_ * rowUseScale_[elementIndex]; } } } /* Set a single row upper bound
    Use DBL_MAX for infinity. */ void AbcSimplex::setRowUpper( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberRows_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setRowUpper"); } #endif if (elementValue > 1.0e27) elementValue = COIN_DBL_MAX; if (rowUpper_[elementIndex] != elementValue) { rowUpper_[elementIndex] = elementValue; // work arrays exist - update as well whatsChanged_ &= ~ROW_UPPER_SAME; if (rowUpper_[elementIndex] == COIN_DBL_MAX) { upperSaved_[elementIndex] = COIN_DBL_MAX; } else { upperSaved_[elementIndex] = elementValue * rhsScale_ * rowUseScale_[elementIndex]; } } } /* Set a single row lower and upper bound */ void AbcSimplex::setRowBounds( int elementIndex, double lowerValue, double upperValue ) { #ifndef NDEBUG int n = numberRows_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setRowBounds"); } #endif if (lowerValue < -1.0e27) lowerValue = -COIN_DBL_MAX; if (upperValue > 1.0e27) upperValue = COIN_DBL_MAX; //CoinAssert (upperValue>=lowerValue); if (rowLower_[elementIndex] != lowerValue) { rowLower_[elementIndex] = lowerValue; // work arrays exist - update as well whatsChanged_ &= ~ROW_LOWER_SAME; if (rowLower_[elementIndex] == -COIN_DBL_MAX) { lowerSaved_[elementIndex] = -COIN_DBL_MAX; } else { lowerSaved_[elementIndex] = lowerValue * rhsScale_ * rowUseScale_[elementIndex]; } } if (rowUpper_[elementIndex] != upperValue) { rowUpper_[elementIndex] = upperValue; // work arrays exist - update as well whatsChanged_ &= ~ROW_UPPER_SAME; if (rowUpper_[elementIndex] == COIN_DBL_MAX) { upperSaved_[elementIndex] = COIN_DBL_MAX; } else { upperSaved_[elementIndex] = upperValue * rhsScale_ * rowUseScale_[elementIndex]; } } } void AbcSimplex::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { #ifndef NDEBUG int n = numberRows_; #endif int numberChanged = 0; const int * saveFirst = indexFirst; while (indexFirst != indexLast) { const int iRow = *indexFirst++; #ifndef NDEBUG if (iRow < 0 || iRow >= n) { indexError(iRow, "setRowSetBounds"); } #endif double lowerValue = *boundList++; double upperValue = *boundList++; if (lowerValue < -1.0e27) lowerValue = -COIN_DBL_MAX; if (upperValue > 1.0e27) upperValue = COIN_DBL_MAX; //CoinAssert (upperValue>=lowerValue); if (rowLower_[iRow] != lowerValue) { rowLower_[iRow] = lowerValue; whatsChanged_ &= ~ROW_LOWER_SAME; numberChanged++; } if (rowUpper_[iRow] != upperValue) { rowUpper_[iRow] = upperValue; whatsChanged_ &= ~ROW_UPPER_SAME; numberChanged++; } } if (numberChanged) { indexFirst = saveFirst; while (indexFirst != indexLast) { const int iRow = *indexFirst++; if (rowLower_[iRow] == -COIN_DBL_MAX) { lowerSaved_[iRow] = -COIN_DBL_MAX; } else { lowerSaved_[iRow] = rowLower_[iRow] * rhsScale_ * rowUseScale_[iRow]; } if (rowUpper_[iRow] == COIN_DBL_MAX) { upperSaved_[iRow] = COIN_DBL_MAX; } else { upperSaved_[iRow] = rowUpper_[iRow] * rhsScale_ * rowUseScale_[iRow]; } } } } //----------------------------------------------------------------------------- /* Set a single column lower bound
    Use -DBL_MAX for -infinity. */ void AbcSimplex::setColumnLower( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnLower"); } #endif if (elementValue < -1.0e27) elementValue = -COIN_DBL_MAX; if (columnLower_[elementIndex] != elementValue) { columnLower_[elementIndex] = elementValue; // work arrays exist - update as well whatsChanged_ &= ~COLUMN_LOWER_SAME; double value; if (columnLower_[elementIndex] == -COIN_DBL_MAX) { value = -COIN_DBL_MAX; } else { value = elementValue * rhsScale_ * inverseColumnUseScale_[elementIndex]; } lowerSaved_[elementIndex+maximumAbcNumberRows_] = value; } } /* Set a single column upper bound
    Use DBL_MAX for infinity. */ void AbcSimplex::setColumnUpper( int elementIndex, double elementValue ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnUpper"); } #endif if (elementValue > 1.0e27) elementValue = COIN_DBL_MAX; if (columnUpper_[elementIndex] != elementValue) { columnUpper_[elementIndex] = elementValue; // work arrays exist - update as well whatsChanged_ &= ~COLUMN_UPPER_SAME; double value; if (columnUpper_[elementIndex] == COIN_DBL_MAX) { value = COIN_DBL_MAX; } else { value = elementValue * rhsScale_ * inverseColumnUseScale_[elementIndex]; } upperSaved_[elementIndex+maximumAbcNumberRows_] = value; } } /* Set a single column lower and upper bound */ void AbcSimplex::setColumnBounds( int elementIndex, double lowerValue, double upperValue ) { #ifndef NDEBUG int n = numberColumns_; if (elementIndex < 0 || elementIndex >= n) { indexError(elementIndex, "setColumnBounds"); } #endif if (lowerValue < -1.0e27) lowerValue = -COIN_DBL_MAX; if (columnLower_[elementIndex] != lowerValue) { columnLower_[elementIndex] = lowerValue; // work arrays exist - update as well whatsChanged_ &= ~COLUMN_LOWER_SAME; if (columnLower_[elementIndex] == -COIN_DBL_MAX) { lowerSaved_[elementIndex+maximumAbcNumberRows_] = -COIN_DBL_MAX; } else { lowerSaved_[elementIndex+maximumAbcNumberRows_] = lowerValue * rhsScale_ * inverseColumnUseScale_[elementIndex]; } } if (upperValue > 1.0e27) upperValue = COIN_DBL_MAX; if (columnUpper_[elementIndex] != upperValue) { columnUpper_[elementIndex] = upperValue; // work arrays exist - update as well whatsChanged_ &= ~COLUMN_UPPER_SAME; if (columnUpper_[elementIndex] == COIN_DBL_MAX) { upperSaved_[elementIndex+maximumAbcNumberRows_] = COIN_DBL_MAX; } else { upperSaved_[elementIndex+maximumAbcNumberRows_] = upperValue * rhsScale_ * inverseColumnUseScale_[elementIndex]; } } } void AbcSimplex::setColumnSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { #ifndef NDEBUG int n = numberColumns_; #endif int numberChanged = 0; const int * saveFirst = indexFirst; while (indexFirst != indexLast) { const int iColumn = *indexFirst++; #ifndef NDEBUG if (iColumn < 0 || iColumn >= n) { indexError(iColumn, "setColumnSetBounds"); } #endif double lowerValue = *boundList++; double upperValue = *boundList++; if (lowerValue < -1.0e27) lowerValue = -COIN_DBL_MAX; if (upperValue > 1.0e27) upperValue = COIN_DBL_MAX; //CoinAssert (upperValue>=lowerValue); if (columnLower_[iColumn] != lowerValue) { columnLower_[iColumn] = lowerValue; whatsChanged_ &= ~COLUMN_LOWER_SAME; numberChanged++; } if (columnUpper_[iColumn] != upperValue) { columnUpper_[iColumn] = upperValue; whatsChanged_ &= ~COLUMN_UPPER_SAME; numberChanged++; } } if (numberChanged) { indexFirst = saveFirst; while (indexFirst != indexLast) { const int iColumn = *indexFirst++; if (columnLower_[iColumn] == -COIN_DBL_MAX) { lowerSaved_[iColumn+maximumAbcNumberRows_] = -COIN_DBL_MAX; } else { lowerSaved_[iColumn+maximumAbcNumberRows_] = columnLower_[iColumn] * rhsScale_ * inverseColumnUseScale_[iColumn]; } if (columnUpper_[iColumn] == COIN_DBL_MAX) { upperSaved_[iColumn+maximumAbcNumberRows_] = COIN_DBL_MAX; } else { upperSaved_[iColumn+maximumAbcNumberRows_] = columnUpper_[iColumn] * rhsScale_ * inverseColumnUseScale_[iColumn]; } } } } #ifndef SLIM_CLP #include "CoinWarmStartBasis.hpp" // Returns a basis (to be deleted by user) CoinWarmStartBasis * AbcSimplex::getBasis() const { CoinWarmStartBasis * basis = new CoinWarmStartBasis(); basis->setSize(numberColumns_, numberRows_); unsigned char lookup[8]={2,3,255,255,0,0,1,3}; for (int iRow = 0; iRow < numberRows_; iRow++) { int iStatus = getInternalStatus(iRow); iStatus = lookup[iStatus]; basis->setArtifStatus(iRow, static_cast (iStatus)); } for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { int iStatus = getInternalStatus(iColumn+maximumAbcNumberRows_); iStatus = lookup[iStatus]; basis->setStructStatus(iColumn, static_cast (iStatus)); } return basis; } #endif // Compute objective value from solution void AbcSimplex::computeObjectiveValue(bool useInternalArrays) { const double * obj = objective(); if (!useInternalArrays) { objectiveValue_ = 0.0; for (int iSequence = 0; iSequence < numberColumns_; iSequence++) { double value = columnActivity_[iSequence]; objectiveValue_ += value * obj[iSequence]; } // But remember direction as we are using external objective objectiveValue_ *= optimizationDirection_; } else { rawObjectiveValue_ = 0.0; for (int iSequence = maximumAbcNumberRows_; iSequence < numberTotal_; iSequence++) { double value = abcSolution_[iSequence]; rawObjectiveValue_ += value * abcCost_[iSequence]; } setClpSimplexObjectiveValue(); } } // Compute minimization objective value from internal solution double AbcSimplex::computeInternalObjectiveValue() { rawObjectiveValue_ = 0.0; for (int iSequence = maximumAbcNumberRows_; iSequence < numberTotal_; iSequence++) { double value = abcSolution_[iSequence]; rawObjectiveValue_ += value * abcCost_[iSequence]; } setClpSimplexObjectiveValue(); return objectiveValue_-dblParam_[ClpObjOffset]; } // If user left factorization frequency then compute void AbcSimplex::defaultFactorizationFrequency() { if (factorizationFrequency() == 200) { // User did not touch preset const int cutoff1 = 10000; const int cutoff2 = 100000; const int base = 75; const int freq0 = 50; const int freq1 = 150; const int maximum = 10000; int frequency; if (numberRows_ < cutoff1) frequency = base + numberRows_ / freq0; else frequency = base + cutoff1 / freq0 + (numberRows_ - cutoff1) / freq1; setFactorizationFrequency(CoinMin(maximum, frequency)); } } // Gets clean and emptyish factorization AbcSimplexFactorization * AbcSimplex::getEmptyFactorization() { if ((specialOptions_ & 65536) == 0) { assert (!abcFactorization_); abcFactorization_ = new AbcSimplexFactorization(); } else if (!abcFactorization_) { abcFactorization_ = new AbcSimplexFactorization(); } return abcFactorization_; } // Resizes rim part of model void AbcSimplex::resize (int newNumberRows, int newNumberColumns) { assert (maximumAbcNumberRows_>=0); // save int numberRows=numberRows_; int numberColumns=numberColumns_; ClpSimplex::resize(newNumberRows, newNumberColumns); // back out numberRows_=numberRows; numberColumns_=numberColumns; gutsOfResize(newNumberRows,newNumberColumns); } // Return true if the objective limit test can be relied upon bool AbcSimplex::isObjectiveLimitTestValid() const { if (problemStatus_ == 0) { return true; } else if (problemStatus_ == 1) { // ok if dual return (algorithm_ < 0); } else if (problemStatus_ == 2) { // ok if primal return (algorithm_ > 0); } else { return false; } } /* Permutes in from ClpModel data - assumes scale factors done and AbcMatrix exists but is in original order (including slacks) For now just add basicArray at end == But could partition into normal (i.e. reasonable lower/upper) abnormal - free, odd bounds fixed == sets a valid pivotVariable Slacks always shifted by offset Fixed variables always shifted by offset Recode to allow row objective so can use pi from idiot etc */ void AbcSimplex::permuteIn() { // for now only if maximumAbcNumberRows_==numberRows_ //assert(maximumAbcNumberRows_==numberRows_); numberTotal_=maximumAbcNumberRows_+numberColumns_; double direction = optimizationDirection_; // all this could use cilk // move primal stuff to end const double * COIN_RESTRICT rowScale=scaleFromExternal_; const double * COIN_RESTRICT inverseRowScale=scaleToExternal_; const double * COIN_RESTRICT columnScale=scaleToExternal_+maximumAbcNumberRows_; const double * COIN_RESTRICT inverseColumnScale=scaleFromExternal_+maximumAbcNumberRows_; double * COIN_RESTRICT offsetRhs=offsetRhs_; double * COIN_RESTRICT saveLower=lowerSaved_+maximumAbcNumberRows_; double * COIN_RESTRICT saveUpper=upperSaved_+maximumAbcNumberRows_; double * COIN_RESTRICT saveCost=costSaved_+maximumAbcNumberRows_; double * COIN_RESTRICT saveSolution=solutionSaved_+maximumAbcNumberRows_; CoinAbcMemset0(offsetRhs,maximumAbcNumberRows_); const double * COIN_RESTRICT objective=this->objective(); objectiveOffset_=0.0; double * COIN_RESTRICT offset=offset_+maximumAbcNumberRows_; const int * COIN_RESTRICT row = abcMatrix_->matrix()->getIndices(); const CoinBigIndex * COIN_RESTRICT columnStart = abcMatrix_->matrix()->getVectorStarts(); const double * COIN_RESTRICT elementByColumn = abcMatrix_->matrix()->getElements(); largestGap_=1.0e-12; for (int iColumn=0;iColumnupperValue2) thisOffset=upperValue; else thisOffset=lowerValue; } #endif offset[iColumn]=thisOffset; if (thisOffset) { objectiveOffset_ += thisOffset*objective[iColumn]*optimizationDirection_; double scaledOffset = thisOffset*scale; for (CoinBigIndex j=columnStart[iColumn];j-1.0e30) lowerValue*=scale; saveLower[iColumn]=lowerValue; upperValue-=thisOffset; if (upperValue<1.0e30) upperValue*=scale; saveUpper[iColumn]=upperValue; largestGap_=CoinMax(largestGap_,upperValue-lowerValue); saveSolution[iColumn]=scale*(columnActivity_[iColumn]-thisOffset); saveCost[iColumn]=objective[iColumn]*direction*columnScale[iColumn]; } CoinAbcMemset0(offset_,maximumAbcNumberRows_); saveLower-=maximumAbcNumberRows_; saveUpper-=maximumAbcNumberRows_; saveCost-=maximumAbcNumberRows_; saveSolution-=maximumAbcNumberRows_; for (int iRow=0;iRow-1.0e30) lowerValue=lowerValue*scale+thisOffset; saveLower[iRow]=lowerValue; if (upperValue<1.0e30) upperValue=upperValue*scale+thisOffset; saveUpper[iRow]=upperValue; largestGap_=CoinMax(largestGap_,upperValue-lowerValue); saveCost[iRow]=0.0; dual_[iRow]*=direction*inverseRowScale[iRow]; saveSolution[iRow]=0.0; // not necessary } dualBound_=CoinMin(dualBound_,largestGap_); // Compute rhsScale_ and objectiveScale_ double minValue=COIN_DBL_MAX; double maxValue=0.0; CoinAbcMinMaxAbsNormalValues(costSaved_+maximumAbcNumberRows_,numberTotal_-maximumAbcNumberRows_,minValue,maxValue); // scale to 1000.0 ? if (minValue&&false) { objectiveScale_= 1000.0/sqrt(minValue*maxValue); objectiveScale_=CoinMin(1.0,1000.0/maxValue); #ifndef NDEBUG double smallestNormal=COIN_DBL_MAX; double smallestAny=COIN_DBL_MAX; double largestAny=0.0; for (int i=0;i1.0e-8) smallestNormal=CoinMin(smallestNormal,value); smallestAny=CoinMin(smallestAny,value); largestAny=CoinMax(largestAny,value); } } printf("objectiveScale_ %g min_used %g (min_reasonable %g, min_any %g) max_used %g (max_any %g)\n", objectiveScale_,minValue,smallestNormal,smallestAny,maxValue,largestAny); #endif } else { //objectiveScale_=1.0; } CoinAbcScale(costSaved_,objectiveScale_,numberTotal_); minValue=COIN_DBL_MAX; maxValue=0.0; CoinAbcMinMaxAbsNormalValues(lowerSaved_,numberTotal_,minValue,maxValue); CoinAbcMinMaxAbsNormalValues(upperSaved_,numberTotal_,minValue,maxValue); // scale to 100.0 ? if (minValue&&false) { rhsScale_= 100.0/sqrt(minValue*maxValue); #ifndef NDEBUG double smallestNormal=COIN_DBL_MAX; double smallestAny=COIN_DBL_MAX; double largestAny=0.0; for (int i=0;i1.0e-8) smallestNormal=CoinMin(smallestNormal,value); smallestAny=CoinMin(smallestAny,value); largestAny=CoinMax(largestAny,value); } } for (int i=0;i1.0e-8) smallestNormal=CoinMin(smallestNormal,value); smallestAny=CoinMin(smallestAny,value); largestAny=CoinMax(largestAny,value); } } printf("rhsScale_ %g min_used %g (min_reasonable %g, min_any %g) max_used %g (max_any %g)\n", rhsScale_,minValue,smallestNormal,smallestAny,maxValue,largestAny); #endif } else { rhsScale_=1.0; } CoinAbcScaleNormalValues(lowerSaved_,rhsScale_,1.0e-13,numberTotal_); CoinAbcScaleNormalValues(upperSaved_,rhsScale_,1.0e-13,numberTotal_); // copy CoinAbcMemcpy(abcLower_,abcLower_+maximumNumberTotal_,numberTotal_); CoinAbcMemcpy(abcUpper_,abcUpper_+maximumNumberTotal_,numberTotal_); CoinAbcMemcpy(abcSolution_,abcSolution_+maximumNumberTotal_,numberTotal_); CoinAbcMemcpy(abcCost_,abcCost_+maximumNumberTotal_,numberTotal_); } void AbcSimplex::permuteBasis() { assert (abcPivotVariable_||(!numberRows_&&!numberColumns_)); int numberBasic=0; // from Clp enum to Abc enum (and bound flip) unsigned char lookupToAbcSlack[6]={4,6,0/*1*/,1/*0*/,5,7}; unsigned char * COIN_RESTRICT getStatus = status_+numberColumns_; double * COIN_RESTRICT solutionSaved=solutionSaved_; double * COIN_RESTRICT lowerSaved=lowerSaved_; double * COIN_RESTRICT upperSaved=upperSaved_; bool ordinaryVariables=true; bool valuesPass=(stateOfProblem_&VALUES_PASS)!=0; if (valuesPass) { // get solution CoinAbcMemset0(abcSolution_,numberRows_); abcMatrix_->timesIncludingSlacks(-1.0,abcSolution_,abcSolution_); //double * temp = new double[numberRows_]; //memset(temp,0,numberRows_*sizeof(double)); //matrix_->times(1.0,columnActivity_,temp); CoinAbcMemcpy(solutionSaved_,abcSolution_,numberRows_); int n=0; for (int i=0;iupperSaved_[i]+1.0e-5) n++; else if (solutionSaved_[i]0 if (n) printf("%d infeasibilities\n",n); #endif } // dual at present does not like superbasic for (int iRow=0;iRow(lookupToAbcSlack[status]); if (status!=ClpSimplex::basic) { double lowerValue=lowerSaved[iRow]; double upperValue=upperSaved[iRow]; if (lowerValue==-COIN_DBL_MAX) { if(upperValue==COIN_DBL_MAX) { // free abcStatus=isFree; ordinaryVariables=false; } else { abcStatus=atUpperBound; } } else if (upperValue==COIN_DBL_MAX) { abcStatus=atLowerBound; } else if (lowerValue==upperValue) { abcStatus=isFixed; } else if (abcStatus==isFixed) { double value=solutionSaved[iRow]; if (value-lowerValuelowerValue+primalTolerance_&&value(lookupToAbc[status]); if (status!=ClpSimplex::basic) { double lowerValue=lowerSaved[iColumn]; double upperValue=upperSaved[iColumn]; if (lowerValue==-COIN_DBL_MAX) { if(upperValue==COIN_DBL_MAX) { // free abcStatus=isFree; ordinaryVariables=false; } else { abcStatus=atUpperBound; } } else if (upperValue==COIN_DBL_MAX) { abcStatus=atLowerBound; } else if (lowerValue==upperValue) { abcStatus=isFixed; } else if (abcStatus==isFixed) { double value=solutionSaved[iColumn]; if (value-lowerValuelowerValue+primalTolerance_) { if(value -1.0e20 || upperScaled < 1.0e20) { if (valueScaled < lowerScaled - primalTolerance_ || valueScaled > upperScaled + primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_, CoinMin(valueScaled - lowerScaled, upperScaled - valueScaled)); } double value = (offsetRhs[i]-valueScaled * scaleR) * scaleFactor; putSolution[i]=value; if (value < rowLower[i] - primalTolerance_) numberPrimalUnscaled++; else if (value > rowUpper[i] + primalTolerance_) numberPrimalUnscaled++; } } if ((whatsWanted&COLUMN_PRIMAL_OK)!=0&&(stateOfProblem_&COLUMN_PRIMAL_OK)==0) { stateOfProblem_ |= COLUMN_PRIMAL_OK; // Collect infeasibilities if (!filledInSolution) { filledInSolution=true; CoinAbcScatterTo(solutionBasic_,abcSolution_,abcPivotVariable_,numberRows_); CoinAbcScatterZeroTo(abcDj_,abcPivotVariable_,numberRows_); } // Collect infeasibilities double * COIN_RESTRICT putSolution = columnActivity_-maximumAbcNumberRows_; const double * COIN_RESTRICT columnLower=columnLower_-maximumAbcNumberRows_; const double * COIN_RESTRICT columnUpper=columnUpper_-maximumAbcNumberRows_; for (int i = maximumAbcNumberRows_; i < numberTotal_; i++) { double scaleFactor = columnScale[i]; double valueScaled = abcSolution_[i]; double lowerScaled = abcLower_[i]; double upperScaled = abcUpper_[i]; if (lowerScaled > -1.0e20 || upperScaled < 1.0e20) { if (valueScaled < lowerScaled - primalTolerance_ || valueScaled > upperScaled + primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_, CoinMin(valueScaled - lowerScaled, upperScaled - valueScaled)); } double value = (valueScaled * scaleR) * scaleFactor+offset_[i]; putSolution[i]=value; if (value < columnLower[i] - primalTolerance_) numberPrimalUnscaled++; else if (value > columnUpper[i] + primalTolerance_) numberPrimalUnscaled++; } } if ((whatsWanted&COLUMN_DUAL_OK)!=0&&(stateOfProblem_&COLUMN_DUAL_OK)==0) { // Get fixed djs CoinAbcMemcpy(abcDj_,abcCost_,numberTotal_); abcMatrix_->transposeTimesAll( dual_,abcDj_); stateOfProblem_ |= COLUMN_DUAL_OK; // Collect infeasibilities double * COIN_RESTRICT putDj=reducedCost_-maximumAbcNumberRows_; for (int i = maximumAbcNumberRows_; i < numberTotal_; i++) { double scaleFactor = inverseColumnScale[i]; double valueDual = abcDj_[i]; double value=abcSolution_[i]; bool aboveLower= value>abcLower_[i]+primalTolerance_; bool belowUpper= value dualTolerance_) numberDualScaled++; if (belowUpper && valueDual < -dualTolerance_) numberDualScaled++; valueDual *= scaleFactor * scaleC; putDj[i]=valueDual; if (aboveLower&& valueDual > dualTolerance_) numberDualUnscaled++; if (belowUpper && valueDual < -dualTolerance_) numberDualUnscaled++; } } if ((whatsWanted&ROW_DUAL_OK)!=0&&(stateOfProblem_&ROW_DUAL_OK)==0) { stateOfProblem_ |= ROW_DUAL_OK; // Collect infeasibilities for (int i = 0; i < numberRows_; i++) { double scaleFactor = rowScale[i]; double valueDual = abcDj_[i]; // ? +- and direction double value=abcSolution_[i]; bool aboveLower= value>abcLower_[i]+primalTolerance_; bool belowUpper= value dualTolerance_) numberDualScaled++; if (belowUpper && valueDual < -dualTolerance_) numberDualScaled++; valueDual *= scaleFactor * scaleC; dual_[i]=-(valueDual-abcCost_[i]); // sign if (aboveLower&& valueDual > dualTolerance_) numberDualUnscaled++; if (belowUpper && valueDual < -dualTolerance_) numberDualUnscaled++; } } // do after djs if (!problemStatus_ && (!secondaryStatus_||secondaryStatus_==2||secondaryStatus_==3)) { // See if we need to set secondary status if (numberPrimalUnscaled) { if (numberDualUnscaled||secondaryStatus_==3) secondaryStatus_ = 4; else secondaryStatus_ = 2; } else if (numberDualUnscaled) { if (secondaryStatus_==0) secondaryStatus_ = 3; else secondaryStatus_ = 4; } } if (scalingFlag_) { if (problemStatus_ == 2) { for (int i = 0; i < numberColumns_; i++) { ray_[i] *= columnScale[i]; } } else if (problemStatus_ == 1 && ray_) { for (int i = 0; i < numberRows_; i++) { ray_[i] *= rowScale[i]; } } } } #if ABC_DEBUG>1 // For debug - moves solution back to external and computes stuff void AbcSimplex::checkMoveBack(bool checkDuals) { stateOfProblem_ &= ~(ROW_PRIMAL_OK|ROW_DUAL_OK|COLUMN_PRIMAL_OK|COLUMN_DUAL_OK|ALL_STATUS_OK); permuteOut(ROW_PRIMAL_OK|ROW_DUAL_OK|COLUMN_PRIMAL_OK|COLUMN_DUAL_OK|ALL_STATUS_OK); ClpSimplex::computeObjectiveValue(false); #if ABC_NORMAL_DEBUG>0 printf("Check objective %g\n",objectiveValue()-objectiveOffset_); #endif double * region = new double [numberRows_+numberColumns_]; CoinAbcMemset0(region,numberRows_); ClpModel::times(1.0,columnActivity_,region); int numberInf; double sumInf; numberInf=0; sumInf=0.0; for (int i=0;icolumnUpper_[i]+1.0e-7) { numberInf++; sumInf+=columnActivity_[i]-columnUpper_[i]; } else if (columnActivity_[i]0 if (numberInf) printf("Check column infeasibilities %d sum %g\n",numberInf,sumInf); #endif numberInf=0; sumInf=0.0; for (int i=0;irowUpper_[i]+1.0e-7) { numberInf++; sumInf+=rowActivity_[i]-rowUpper_[i]; } else if (rowActivity_[i]0 if (numberInf) printf("Check row infeasibilities %d sum %g\n",numberInf,sumInf); #endif CoinAbcMemcpy(region,objective(),numberColumns_); ClpModel::transposeTimes(-1.0,dual_,region); numberInf=0; sumInf=0.0; for (int i=0;icolumnLower_[i]) { if (getColumnStatus(i)==ClpSimplex::atLowerBound) { if (region[i]<-1.0e-7) { numberInf++; sumInf-=region[i]; } } else if (getColumnStatus(i)==ClpSimplex::atUpperBound) { if (region[i]>1.0e-7) { numberInf++; sumInf+=region[i]; } } } } #if ABC_NORMAL_DEBUG>0 if (numberInf) printf("Check column dj infeasibilities %d sum %g\n",numberInf,sumInf); #endif if (checkDuals) { numberInf=0; sumInf=0.0; for (int i=0;irowLower_[i]) { if (getRowStatus(i)==ClpSimplex::atLowerBound) { if (dual_[i]<-1.0e-7) { numberInf++; sumInf-=region[i]; } } else if (getRowStatus(i)==ClpSimplex::atUpperBound) { if (dual_[i]>1.0e-7) { numberInf++; sumInf+=region[i]; } } } } #if ABC_NORMAL_DEBUG>0 if (numberInf) printf("Check row dual infeasibilities %d sum %g\n",numberInf,sumInf); #endif } delete [] region; } #if 0 void xxxxxx(const char * where) { printf("xxxxx %s\n",where); } #endif // For debug - checks solutionBasic void AbcSimplex::checkSolutionBasic() const { //work space int whichArray[2]; for (int i=0;i<2;i++) whichArray[i]=getAvailableArray(); CoinIndexedVector * arrayVector = &usefulArray_[whichArray[0]]; double * solution = usefulArray_[whichArray[1]].denseVector(); CoinAbcMemcpy(solution,abcSolution_,numberTotal_); // accumulate non basic stuff double * array = arrayVector->denseVector(); CoinAbcScatterZeroTo(solution,abcPivotVariable_,numberRows_); abcMatrix_->timesIncludingSlacks(-1.0, solution, array); //arrayVector->scan(0,numberRows_,zeroTolerance_); // Ftran adjusted RHS //if (arrayVector->getNumElements()) abcFactorization_->updateFullColumn(*arrayVector); CoinAbcScatterTo(array,solution,abcPivotVariable_,numberRows_); double largestDifference=0.0; int whichDifference=-1; for (int i=0;i1.0e-5&&numberRows_<100) printf("solutionBasic difference is %g on row %d solutionBasic_ %g computed %g\n", difference,i,solutionBasic_[i],array[i]); if (difference>largestDifference) { largestDifference=difference; whichDifference=i; } } if (largestDifference>1.0e-9) printf("Debug largest solutionBasic difference is %g on row %d solutionBasic_ %g computed %g\n", largestDifference,whichDifference,solutionBasic_[whichDifference],array[whichDifference]); arrayVector->clear(); CoinAbcMemset0(solution,numberTotal_); for (int i=0;i<2;i++) setAvailableArray(whichArray[i]); } // For debug - summarizes dj situation void AbcSimplex::checkDjs(int type) const { if (type) { //work space int whichArrays[2]; for (int i=0;i<2;i++) whichArrays[i]=getAvailableArray(); CoinIndexedVector * arrayVector = &usefulArray_[whichArrays[0]]; double * array = arrayVector->denseVector(); int * index = arrayVector->getIndices(); int number = 0; for (int iRow = 0; iRow < numberRows_; iRow++) { double value = costBasic_[iRow]; if (value) { array[iRow] = value; index[number++] = iRow; } } arrayVector->setNumElements(number); // Btran basic costs abcFactorization_->updateFullColumnTranspose(*arrayVector); double largestDifference=0.0; int whichDifference=-1; if (type==2) { for (int i=0;ilargestDifference) { largestDifference=difference; whichDifference=i; } } if (largestDifference>1.0e-9) printf("Debug largest dual difference is %g on row %d dual_ %g computed %g\n", largestDifference,whichDifference,dual_[whichDifference],array[whichDifference]); } // now look at djs double * djs=usefulArray_[whichArrays[1]].denseVector(); CoinAbcMemcpy(djs,abcCost_,numberTotal_); abcMatrix_->transposeTimesNonBasic(-1.0, array,djs); largestDifference=0.0; whichDifference=-1; for (int i=0;i1.0e-5&&numberTotal_<200) printf("Debug dj difference is %g on column %d abcDj_ %g computed %g\n", difference,i,abcDj_[i],djs[i]); if (difference>largestDifference) { largestDifference=difference; whichDifference=i; } break; } } if (largestDifference>1.0e-9) printf("Debug largest dj difference is %g on column %d abcDj_ %g computed %g\n", largestDifference,whichDifference,abcDj_[whichDifference],djs[whichDifference]); CoinAbcMemset0(djs,numberTotal_); arrayVector->clear(); for (int i=0;i<2;i++) setAvailableArray(whichArrays[i]); } int state[8]={0,0,0,0,0,0,0,0}; int badT[8]={0,0,0,0,0,0,0,0}; //int badP[8]={0,0,0,0,0,0,0,0}; int numberInfeasibilities=0; for (int i=0;icurrentDualTolerance_) badT[iStatus]++; //if(fabs(djValue)>perturbationValue) //badP[iStatus]++; break; case AbcSimplex::isFixed: break; case isFree: case superBasic: if(fabs(djValue)>currentDualTolerance_) badT[iStatus]++; //if(fabs(djValue)>perturbationValue) //badP[iStatus]++; break; case atUpperBound: if (fabs(value - upperValue) > primalTolerance_) numberInfeasibilities++; if(djValue>currentDualTolerance_) badT[iStatus]++; //if(djValue>perturbationValue) //badP[iStatus]++; break; case atLowerBound: if (fabs(value - lowerValue) > primalTolerance_) numberInfeasibilities++; if(-djValue>currentDualTolerance_) badT[iStatus]++; //if(-djValue>perturbationValue) //badP[iStatus]++; break; } } if (numberInfeasibilities) printf("Debug %d variables away from bound when should be\n",numberInfeasibilities); int numberBad=0; for (int i=0;i<8;i++) { numberBad += badT[i]/*+badP[i]*/; } if (numberBad) { const char * type[]={"atLowerBound", "atUpperBound", "??", "??", "isFree", "superBasic", "basic", "isFixed"}; for (int i=0;i<8;i++) { if (state[i]) printf("Debug - %s %d total %d bad with tolerance %d bad with perturbation\n", type[i],state[i],badT[i],0/*badP[i]*/); } } } #else // For debug - moves solution back to external and computes stuff void AbcSimplex::checkMoveBack(bool ) { } // For debug - checks solutionBasic void AbcSimplex::checkSolutionBasic() const { } // For debug - summarizes dj situation void AbcSimplex::checkDjs(int) const { } #endif #ifndef EARLY_FACTORIZE #define ABC_NUMBER_USEFUL_NORMAL ABC_NUMBER_USEFUL #else #define ABC_NUMBER_USEFUL_NORMAL ABC_NUMBER_USEFUL-1 #endif static double * elAddress[ABC_NUMBER_USEFUL_NORMAL]; // For debug - prints summary of arrays which are out of kilter void AbcSimplex::checkArrays(int ignoreEmpty) const { if (!numberIterations_||!elAddress[0]) { for (int i=0;imaximumPivots(data.maximumPivots_); } // Loads tolerances etc void ClpSimplex::unloadTolerancesEtc(AbcTolerancesEtc & data) { data.zeroTolerance_ = zeroTolerance_; data.primalToleranceToGetOptimal_ = primalToleranceToGetOptimal_; data.largeValue_ = largeValue_; data.alphaAccuracy_ = alphaAccuracy_; data.dualBound_ = dualBound_; data.dualTolerance_ = dualTolerance_; data.primalTolerance_ = primalTolerance_; data.infeasibilityCost_ = infeasibilityCost_; data.incomingInfeasibility_ = incomingInfeasibility_; data.allowedInfeasibility_ = allowedInfeasibility_; data.baseIteration_ = baseIteration_; data.numberRefinements_ = numberRefinements_; data.forceFactorization_ = forceFactorization_; data.perturbation_ = perturbation_; data.dontFactorizePivots_ = dontFactorizePivots_; /// For factorization data.maximumPivots_ = abcFactorization_->maximumPivots(); } // Loads tolerances etc void AbcSimplex::loadTolerancesEtc(const AbcTolerancesEtc & data) { zeroTolerance_ = data.zeroTolerance_; primalToleranceToGetOptimal_ = data.primalToleranceToGetOptimal_; largeValue_ = data.largeValue_; alphaAccuracy_ = data.alphaAccuracy_; dualBound_ = data.dualBound_; dualTolerance_ = data.dualTolerance_; primalTolerance_ = data.primalTolerance_; infeasibilityCost_ = data.infeasibilityCost_; incomingInfeasibility_ = data.incomingInfeasibility_; allowedInfeasibility_ = data.allowedInfeasibility_; baseIteration_ = data.baseIteration_; numberRefinements_ = data.numberRefinements_; forceFactorization_ = data.forceFactorization_; perturbation_ = data.perturbation_; dontFactorizePivots_ = data.dontFactorizePivots_; /// For factorization abcFactorization_->maximumPivots(data.maximumPivots_); } // Loads tolerances etc void AbcSimplex::unloadTolerancesEtc(AbcTolerancesEtc & data) { data.zeroTolerance_ = zeroTolerance_; data.primalToleranceToGetOptimal_ = primalToleranceToGetOptimal_; data.largeValue_ = largeValue_; data.alphaAccuracy_ = alphaAccuracy_; data.dualBound_ = dualBound_; data.dualTolerance_ = dualTolerance_; data.primalTolerance_ = primalTolerance_; data.infeasibilityCost_ = infeasibilityCost_; data.incomingInfeasibility_ = incomingInfeasibility_; data.allowedInfeasibility_ = allowedInfeasibility_; data.baseIteration_ = baseIteration_; data.numberRefinements_ = numberRefinements_; data.forceFactorization_ = forceFactorization_; data.perturbation_ = perturbation_; data.dontFactorizePivots_ = dontFactorizePivots_; /// For factorization data.maximumPivots_ = abcFactorization_->maximumPivots(); } #endif // Swaps two variables (for now just updates basic list) and sets status void AbcSimplex::swap(int pivotRow,int nonBasicPosition,Status newStatus) { // set status setInternalStatus(nonBasicPosition,newStatus); solutionBasic_[pivotRow]=abcSolution_[nonBasicPosition]; lowerBasic_[pivotRow]=abcLower_[nonBasicPosition]; upperBasic_[pivotRow]=abcUpper_[nonBasicPosition]; costBasic_[pivotRow]=abcCost_[nonBasicPosition]; } // Swaps two variables (for now just updates basic list) void AbcSimplex::swap(int pivotRow,int nonBasicPosition) { solutionBasic_[pivotRow]=abcSolution_[nonBasicPosition]; lowerBasic_[pivotRow]=lowerSaved_[nonBasicPosition]; upperBasic_[pivotRow]=upperSaved_[nonBasicPosition]; costBasic_[pivotRow]=abcCost_[nonBasicPosition]; } // Move status and solution to ClpSimplex void AbcSimplex::moveStatusToClp(ClpSimplex * clpModel) { assert (clpModel); if (algorithm_<0) clpModel->setObjectiveValue(clpObjectiveValue()); else clpModel->setObjectiveValue(objectiveValue()); clpModel->setProblemStatus(problemStatus_); clpModel->setSecondaryStatus(secondaryStatus_); clpModel->setNumberIterations(numberIterations_); clpModel->setSumDualInfeasibilities(sumDualInfeasibilities_); clpModel->setSumOfRelaxedDualInfeasibilities(sumOfRelaxedDualInfeasibilities_); clpModel->setNumberDualInfeasibilities(numberDualInfeasibilities_); clpModel->setSumPrimalInfeasibilities(sumPrimalInfeasibilities_); clpModel->setSumOfRelaxedPrimalInfeasibilities(sumOfRelaxedPrimalInfeasibilities_); clpModel->setNumberPrimalInfeasibilities(numberPrimalInfeasibilities_); permuteOut(ROW_PRIMAL_OK|ROW_DUAL_OK|COLUMN_PRIMAL_OK|COLUMN_DUAL_OK|ALL_STATUS_OK); CoinAbcMemcpy(clpModel->primalColumnSolution(),primalColumnSolution(),numberColumns_); CoinAbcMemcpy(clpModel->dualColumnSolution(),dualColumnSolution(),numberColumns_); CoinAbcMemcpy(clpModel->primalRowSolution(),primalRowSolution(),numberRows_); CoinAbcMemcpy(clpModel->dualRowSolution(),dualRowSolution(),numberRows_); CoinAbcMemcpy(clpModel->statusArray(),statusArray(),numberTotal_); } // Move status and solution from ClpSimplex void AbcSimplex::moveStatusFromClp(ClpSimplex * clpModel) { assert (clpModel); problemStatus_=clpModel->problemStatus(); secondaryStatus_=clpModel->secondaryStatus(); numberIterations_=clpModel->numberIterations(); sumDualInfeasibilities_ = clpModel->sumDualInfeasibilities(); sumOfRelaxedDualInfeasibilities_ = clpModel->sumOfRelaxedDualInfeasibilities(); numberDualInfeasibilities_ = clpModel->numberDualInfeasibilities(); sumPrimalInfeasibilities_ = clpModel->sumPrimalInfeasibilities(); sumOfRelaxedPrimalInfeasibilities_ = clpModel->sumOfRelaxedPrimalInfeasibilities(); numberPrimalInfeasibilities_ = clpModel->numberPrimalInfeasibilities(); CoinAbcMemcpy(primalColumnSolution(),clpModel->primalColumnSolution(),numberColumns_); CoinAbcMemcpy(dualColumnSolution(),clpModel->dualColumnSolution(),numberColumns_); CoinAbcMemcpy(primalRowSolution(),clpModel->primalRowSolution(),numberRows_); CoinAbcMemcpy(dualRowSolution(),clpModel->dualRowSolution(),numberRows_); CoinAbcMemcpy(statusArray(),clpModel->statusArray(),numberTotal_); translate(DO_SCALE_AND_MATRIX|DO_BASIS_AND_ORDER|DO_STATUS|DO_SOLUTION); } // Clears an array and says available (-1 does all) void AbcSimplex::clearArrays(int which) { if (which>=0) { if (usefulArray_[which].getNumElements()) usefulArray_[which].clear(); int check=1<abcSimplex(); #else AbcSimplex * model; return -1; #endif double objective; if (model_->algorithm() < 0) { objective = model_->rawObjectiveValue(); objective -= model_->bestPossibleImprovement(); } else { objective = model->abcNonLinearCost()->feasibleReportCost(); } double infeasibility; double realInfeasibility = 0.0; int numberInfeasibilities; int iterationNumber = model->numberIterations(); //numberTimesFlagged_ = 0; if (model->algorithm() < 0) { // dual infeasibility = model->sumPrimalInfeasibilities(); numberInfeasibilities = model->numberPrimalInfeasibilities(); } else { //primal infeasibility = model->sumDualInfeasibilities(); realInfeasibility = model->abcNonLinearCost()->sumInfeasibilities(); numberInfeasibilities = model->numberDualInfeasibilities(); } int i; int numberMatched = 0; int matched = 0; int nsame = 0; for (i = 0; i < CLP_PROGRESS; i++) { bool matchedOnObjective = objective == objective_[i]; bool matchedOnInfeasibility = infeasibility == infeasibility_[i]; bool matchedOnInfeasibilities = (numberInfeasibilities == numberInfeasibilities_[i]); if (matchedOnObjective && matchedOnInfeasibility && matchedOnInfeasibilities) { matched |= (1 << i); // Check not same iteration if (iterationNumber != iterationNumber_[i]) { numberMatched++; #if ABC_NORMAL_DEBUG>0 // here mainly to get over compiler bug? if (model->messageHandler()->logLevel() > 10) printf("%d %d %d %d %d loop check\n", i, numberMatched, matchedOnObjective, matchedOnInfeasibility, matchedOnInfeasibilities); #endif } else { // stuck but code should notice nsame++; } } if (i) { objective_[i-1] = objective_[i]; infeasibility_[i-1] = infeasibility_[i]; realInfeasibility_[i-1] = realInfeasibility_[i]; numberInfeasibilities_[i-1] = numberInfeasibilities_[i]; iterationNumber_[i-1] = iterationNumber_[i]; } } objective_[CLP_PROGRESS-1] = objective; infeasibility_[CLP_PROGRESS-1] = infeasibility; realInfeasibility_[CLP_PROGRESS-1] = realInfeasibility; numberInfeasibilities_[CLP_PROGRESS-1] = numberInfeasibilities; iterationNumber_[CLP_PROGRESS-1] = iterationNumber; if (nsame == CLP_PROGRESS) numberMatched = CLP_PROGRESS; // really stuck if (model->progressFlag()) numberMatched = 0; numberTimes_++; if (numberTimes_ < 10) numberMatched = 0; // skip if just last time as may be checking something if (matched == (1 << (CLP_PROGRESS - 1))) numberMatched = 0; if (numberMatched) { model->messageHandler()->message(CLP_POSSIBLELOOP, model->messages()) << numberMatched << matched << numberTimes_ << CoinMessageEol; printf("loop detected %d times out of %d\n",numberBadTimes_,numberTimes_); numberBadTimes_++; if (numberBadTimes_ < 10) { // make factorize every iteration model->forceFactorization(1); if (numberBadTimes_ < 2) { startCheck(); // clear other loop check if (model->algorithm() < 0) { // dual - change tolerance model->setCurrentDualTolerance(model->currentDualTolerance() * 1.05); // if infeasible increase dual bound if (model->currentDualBound() < 1.0e17) { model->setDualBound(model->currentDualBound() * 1.1); static_cast(model)->bounceTolerances(100); } } else { // primal - change tolerance if (numberBadTimes_ > 3) model->setCurrentPrimalTolerance(model->currentPrimalTolerance() * 1.05); // if infeasible increase infeasibility cost //if (model->nonLinearCost()->numberInfeasibilities() && // model->infeasibilityCost() < 1.0e17) { // model->setInfeasibilityCost(model->infeasibilityCost() * 1.1); //} } } else { // flag int iSequence; if (model->algorithm() < 0) { // dual if (model->currentDualBound() > 1.0e14) model->setDualBound(1.0e14); iSequence = in_[CLP_CYCLE-1]; } else { // primal if (model->infeasibilityCost() > 1.0e14) model->setInfeasibilityCost(1.0e14); iSequence = out_[CLP_CYCLE-1]; } if (iSequence >= 0) { char x = model->isColumn(iSequence) ? 'C' : 'R'; if (model->messageHandler()->logLevel() >= 63) model->messageHandler()->message(CLP_SIMPLEX_FLAG, model->messages()) << x << model->sequenceWithin(iSequence) << CoinMessageEol; // if Gub then needs to be sequenceIn_ int save = model->sequenceIn(); model->setSequenceIn(iSequence); model->setFlagged(iSequence); model->setLastBadIteration(model->numberIterations()); model->setSequenceIn(save); //printf("flagging %d from loop\n",iSequence); startCheck(); } else { // Give up #if ABC_NORMAL_DEBUG>0 if (model->messageHandler()->logLevel() >= 63) printf("***** All flagged?\n"); #endif return 4; } // reset numberBadTimes_ = 2; } return -2; } else { // look at solution and maybe declare victory if (infeasibility < 1.0e-4) { return 0; } else { model->messageHandler()->message(CLP_LOOP, model->messages()) << CoinMessageEol; #ifndef NDEBUG printf("debug loop AbcSimplex A\n"); abort(); #endif return 3; } } } return -1; } #if 0 void AbcSimplex::loadProblem ( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpSimplex::loadProblem(matrix, collb, colub, obj, rowlb, rowub, rowObjective); translate(DO_SCALE_AND_MATRIX|DO_BASIS_AND_ORDER|DO_STATUS|DO_SOLUTION); } #endif // For debug - check pivotVariable consistent void AbcSimplex::checkConsistentPivots() const { unsigned char * copyStatus = CoinCopyOfArray(internalStatus_,numberTotal_); int nBad=0; for (int i=0;i=0&&knumberTotal();i++) { if (this->getInternalStatus(i)!=AbcSimplex::basic) printf("%d status %d primal %g dual %g lb %g ub %g\n", i,this->getInternalStatus(i),this->solutionRegion()[i], this->djRegion()[i],this->lowerRegion()[i],this->upperRegion()[i]); } for (int i=0;inumberRows();i++) { printf("%d %g <= %g <= %g -pivot %d cost %g\n", i,this->lowerBasic()[i],this->solutionBasic()[i], this->upperBasic()[i],this->pivotVariable()[i],this->costBasic()[i]); } printf("XXend\n"); } #if ABC_PARALLEL==1 // so thread can find out which one it is int AbcSimplex::whichThread() const { pthread_t thisThread=pthread_self(); int whichThread; for (whichThread=0;whichThread1. Allows scaling If status is singular, then basic variables have pivot row and ones thrown out have -1 returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */ int factorize (AbcSimplex * model, int solveType, bool valuesPass); #ifdef EARLY_FACTORIZE /// Returns -2 if can't, -1 if singular, -99 memory, 0 OK inline int factorize (AbcSimplex * model, CoinIndexedVector & stuff) { return coinAbcFactorization_->factorize(model,stuff);} #endif //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ AbcSimplexFactorization(int numberRows=0); /** Destructor */ ~AbcSimplexFactorization(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ AbcSimplexFactorization(const AbcSimplexFactorization&, int denseIfSmaller = 0); AbcSimplexFactorization& operator=(const AbcSimplexFactorization&); /// Sets factorization void setFactorization(AbcSimplexFactorization & rhs); //@} /* **** below here is so can use networkish basis */ /**@name rank one updates which do exist */ //@{ /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update already in U */ inline #ifdef ABC_LONG_FACTORIZATION long #endif double checkReplacePart1 ( CoinIndexedVector * regionSparse, int pivotRow) {return coinAbcFactorization_->checkReplacePart1(regionSparse,pivotRow);} /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update in vector */ inline #ifdef ABC_LONG_FACTORIZATION long #endif double checkReplacePart1 ( CoinIndexedVector * regionSparse, CoinIndexedVector * partialUpdate, int pivotRow) {return coinAbcFactorization_->checkReplacePart1(regionSparse,partialUpdate,pivotRow);} #ifdef MOVE_REPLACE_PART1A /** Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update already in U */ inline void checkReplacePart1a ( CoinIndexedVector * regionSparse, int pivotRow) {coinAbcFactorization_->checkReplacePart1a(regionSparse,pivotRow);} inline double checkReplacePart1b (CoinIndexedVector * regionSparse, int pivotRow) {return coinAbcFactorization_->checkReplacePart1b(regionSparse,pivotRow);} #endif /** Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */ inline int checkReplacePart2 ( int pivotRow, double btranAlpha, double ftranAlpha, #ifdef ABC_LONG_FACTORIZATION long #endif double ftAlpha) {return coinAbcFactorization_->checkReplacePart2(pivotRow,btranAlpha,ftranAlpha,ftAlpha);} #ifdef ABC_LONG_FACTORIZATION /// Clear all hidden arrays inline void clearHiddenArrays() { coinAbcFactorization_->clearHiddenArrays();} #endif /** Replaces one Column to basis, partial update already in U */ void replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ); /** Replaces one Column to basis, partial update in vector */ void replaceColumnPart3 ( const AbcSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, CoinIndexedVector * partialUpdate, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ); #ifdef EARLY_FACTORIZE /// 0 success, -1 can't +1 accuracy problems inline int replaceColumns ( const AbcSimplex * model, CoinIndexedVector & stuff, int firstPivot,int lastPivot,bool cleanUp) { return coinAbcFactorization_->replaceColumns(model,stuff,firstPivot,lastPivot,cleanUp);} #endif //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ #if 0 /** Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room region1 starts as zero and is zero at end */ int updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2); /** Updates one column (FTRAN) from region2 region1 starts as zero and is zero at end */ int updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; /** Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room. Also updates region3 region1 starts as zero and is zero at end */ int updateTwoColumnsFT ( CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3) ; /** Updates one column (BTRAN) from region2 region1 starts as zero and is zero at end */ int updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; #endif /** Updates one column (FTRAN) Tries to do FT update number returned is negative if no room */ inline int updateColumnFT ( CoinIndexedVector & regionSparseFT) { return coinAbcFactorization_->updateColumnFT(regionSparseFT);} inline int updateColumnFTPart1 ( CoinIndexedVector & regionSparseFT) { return coinAbcFactorization_->updateColumnFTPart1(regionSparseFT);} inline void updateColumnFTPart2 ( CoinIndexedVector & regionSparseFT) { coinAbcFactorization_->updateColumnFTPart2(regionSparseFT);} /** Updates one column (FTRAN) Tries to do FT update puts partial update in vector */ inline void updateColumnFT ( CoinIndexedVector & regionSparseFT, CoinIndexedVector & partialUpdate, int which) { coinAbcFactorization_->updateColumnFT(regionSparseFT,partialUpdate,which);} /** Updates one column (FTRAN) */ inline int updateColumn ( CoinIndexedVector & regionSparse) const { return coinAbcFactorization_->updateColumn(regionSparse);} /** Updates one column (FTRAN) from regionFT Tries to do FT update number returned is negative if no room. Also updates regionOther */ inline int updateTwoColumnsFT ( CoinIndexedVector & regionSparseFT, CoinIndexedVector & regionSparseOther) { return coinAbcFactorization_->updateTwoColumnsFT(regionSparseFT,regionSparseOther);} /** Updates one column (BTRAN) */ inline int updateColumnTranspose ( CoinIndexedVector & regionSparse) const { return coinAbcFactorization_->updateColumnTranspose(regionSparse);} /** Updates one column (FTRAN) */ inline void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const #ifndef ABC_USE_COIN_FACTORIZATION { coinAbcFactorization_->updateColumnCpu(regionSparse,whichCpu);} #else { coinAbcFactorization_->updateColumn(regionSparse);} #endif /** Updates one column (BTRAN) */ inline void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const #ifndef ABC_USE_COIN_FACTORIZATION { coinAbcFactorization_->updateColumnTransposeCpu(regionSparse,whichCpu);} #else { coinAbcFactorization_->updateColumnTranspose(regionSparse);} #endif /** Updates one full column (FTRAN) */ inline void updateFullColumn ( CoinIndexedVector & regionSparse) const { coinAbcFactorization_->updateFullColumn(regionSparse);} /** Updates one full column (BTRAN) */ inline void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const { coinAbcFactorization_->updateFullColumnTranspose(regionSparse);} /** Updates one column for dual steepest edge weights (FTRAN) */ void updateWeights ( CoinIndexedVector & regionSparse) const #ifndef ABC_USE_COIN_FACTORIZATION { coinAbcFactorization_->updateWeights(regionSparse);} #else { coinAbcFactorization_->updateColumn(regionSparse);} #endif //@} /**@name Lifted from CoinFactorization */ //@{ /// Total number of elements in factorization inline int numberElements ( ) const { return coinAbcFactorization_->numberElements() ; } /// Maximum number of pivots between factorizations inline int maximumPivots ( ) const { return coinAbcFactorization_->maximumPivots() ; } /// Set maximum number of pivots between factorizations inline void maximumPivots ( int value) { coinAbcFactorization_->maximumPivots(value); } /// Returns true if doing FT inline bool usingFT() const { return !coinAbcFactorization_->wantsTableauColumn();} /// Returns number of pivots since factorization inline int pivots ( ) const { return coinAbcFactorization_->pivots() ; } /// Sets model inline void setModel(AbcSimplex * model) {model_ = model;} /// Sets number of pivots since factorization inline void setPivots ( int value ) const { coinAbcFactorization_->setPivots(value) ; } /// Whether larger areas needed inline double areaFactor ( ) const { return coinAbcFactorization_->areaFactor() ; } /// Set whether larger areas needed inline void areaFactor ( double value) { coinAbcFactorization_->areaFactor(value); } /// Zero tolerance inline double zeroTolerance ( ) const { return coinAbcFactorization_->zeroTolerance() ; } /// Set zero tolerance inline void zeroTolerance ( double value) { coinAbcFactorization_->zeroTolerance(value); } /// Set tolerances to safer of existing and given void saferTolerances ( double zeroTolerance, double pivotTolerance); /// Returns status inline int status ( ) const { return coinAbcFactorization_->status() ; } /// Sets status inline void setStatus ( int value) { coinAbcFactorization_->setStatus(value) ; } #if ABC_PARALLEL==2 /// Says parallel inline void setParallelMode(int value) {coinAbcFactorization_->setParallelMode(value);}; #endif /// Returns number of dense rows inline int numberDense() const { return coinAbcFactorization_->numberDense() ; } bool timeToRefactorize() const; #if CLP_FACTORIZATION_NEW_TIMING>1 void statsRefactor(char when) const; #endif /// Get rid of all memory inline void clearArrays() { coinAbcFactorization_->clearArrays(); } /// Number of Rows after factorization inline int numberRows ( ) const { return coinAbcFactorization_->numberRows() ; } /// Number of slacks at last factorization inline int numberSlacks() const { return numberSlacks_;} /// Pivot tolerance inline double pivotTolerance ( ) const { return coinAbcFactorization_->pivotTolerance(); } /// Set pivot tolerance inline void pivotTolerance ( double value) { coinAbcFactorization_->pivotTolerance(value); } /// Minimum pivot tolerance inline double minimumPivotTolerance ( ) const { return coinAbcFactorization_->minimumPivotTolerance(); } /// Set minimum pivot tolerance inline void minimumPivotTolerance ( double value) { coinAbcFactorization_->minimumPivotTolerance(value); } /// pivot region inline double * pivotRegion() const { return coinAbcFactorization_->pivotRegion();} /// Allows change of pivot accuracy check 1.0 == none >1.0 relaxed //inline void relaxAccuracyCheck(double /*value*/) { //abort(); //} /// Delete all stuff (leaves as after CoinFactorization()) inline void almostDestructor() { coinAbcFactorization_->clearArrays(); } /// So we can temporarily switch off dense void setDenseThreshold(int number); int getDenseThreshold() const; /// If nonzero force use of 1,dense 2,small 3,long void forceOtherFactorization(int which); /// Go over to dense code void goDenseOrSmall(int numberRows); /// Get switch to dense if number rows <= this inline int goDenseThreshold() const { return goDenseThreshold_; } /// Set switch to dense if number rows <= this inline void setGoDenseThreshold(int value) { goDenseThreshold_ = value; } /// Get switch to small if number rows <= this inline int goSmallThreshold() const { return goSmallThreshold_; } /// Set switch to small if number rows <= this inline void setGoSmallThreshold(int value) { goSmallThreshold_ = value; } /// Get switch to long/ordered if number rows >= this inline int goLongThreshold() const { return goLongThreshold_; } /// Set switch to long/ordered if number rows >= this inline void setGoLongThreshold(int value) { goLongThreshold_ = value; } /// Returns type inline int typeOfFactorization() const { return forceB_;} /// Synchronize stuff void synchronize(const ClpFactorization * otherFactorization,const AbcSimplex * model); //@} /**@name other stuff */ //@{ /** makes a row copy of L for speed and to allow very sparse problems */ void goSparse(); #ifndef NDEBUG #ifndef ABC_USE_COIN_FACTORIZATION inline void checkMarkArrays() const { coinAbcFactorization_->checkMarkArrays();} #else inline void checkMarkArrays() const { } #endif #endif /// Says whether to redo pivot order inline bool needToReorder() const {abort();return true;} /// Pointer to factorization #ifndef ABC_USE_COIN_FACTORIZATION CoinAbcAnyFactorization * factorization() const { return coinAbcFactorization_;} #else CoinFactorization * factorization() const { return coinAbcFactorization_;} #endif //@} ////////////////// data ////////////////// private: /**@name data */ //@{ /// Pointer to model AbcSimplex * model_; /// Pointer to factorization #ifndef ABC_USE_COIN_FACTORIZATION CoinAbcAnyFactorization * coinAbcFactorization_; #else CoinFactorization * coinAbcFactorization_; #endif #ifdef CLP_FACTORIZATION_NEW_TIMING /// For guessing when to re-factorize mutable double shortestAverage_; mutable double totalInR_; mutable double totalInIncreasingU_; mutable int endLengthU_; mutable int lastNumberPivots_; mutable int effectiveStartNumberU_; #endif /// If nonzero force use of 1,dense 2,small 3,long int forceB_; /// Switch to dense if number rows <= this int goDenseThreshold_; /// Switch to small if number rows <= this int goSmallThreshold_; /// Switch to long/ordered if number rows >= this int goLongThreshold_; /// Number of slacks at last factorization int numberSlacks_; //@} }; #endif CoinMP-1.8.3/Clp/src/IdiSolve.cpp0000644000175000017500000016237712452503025015061 0ustar renerene/* $Id: IdiSolve.cpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include #include #include #include "CoinHelperFunctions.hpp" #include "Idiot.hpp" #define FIT #ifdef FIT #define HISTORY 8 #else #define HISTORY 7 #endif #define NSOLVE HISTORY-1 static void solveSmall(int nsolve, double **aIn, double **a, double * b) { int i, j; /* copy */ for (i = 0; i < nsolve; i++) { for (j = 0; j < nsolve; j++) { a[i][j] = aIn[i][j]; } } for (i = 0; i < nsolve; i++) { /* update using all previous */ double diagonal; int j; for (j = i; j < nsolve; j++) { int k; double value = a[i][j]; for (k = 0; k < i; k++) { value -= a[k][i] * a[k][j]; } a[i][j] = value; } diagonal = a[i][i]; if (diagonal < 1.0e-20) { diagonal = 0.0; } else { diagonal = 1.0 / sqrt(diagonal); } a[i][i] = diagonal; for (j = i + 1; j < nsolve; j++) { a[i][j] *= diagonal; } } /* update */ for (i = 0; i < nsolve; i++) { int j; double value = b[i]; for (j = 0; j < i; j++) { value -= b[j] * a[j][i]; } value *= a[i][i]; b[i] = value; } for (i = nsolve - 1; i >= 0; i--) { int j; double value = b[i]; for (j = i + 1; j < nsolve; j++) { value -= b[j] * a[i][j]; } value *= a[i][i]; b[i] = value; } } IdiotResult Idiot::objval(int nrows, int ncols, double * rowsol , double * colsol, double * pi, double * /*djs*/, const double * cost , const double * /*rowlower*/, const double * rowupper, const double * /*lower*/, const double * /*upper*/, const double * elemnt, const int * row, const CoinBigIndex * columnStart, const int * length, int extraBlock, int * rowExtra, double * solExtra, double * elemExtra, double * /*upperExtra*/, double * costExtra, double weight) { IdiotResult result; double objvalue = 0.0; double sum1 = 0.0, sum2 = 0.0; int i; for (i = 0; i < nrows; i++) { rowsol[i] = -rowupper[i]; } for (i = 0; i < ncols; i++) { CoinBigIndex j; double value = colsol[i]; if (value) { objvalue += value * cost[i]; if (elemnt) { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; rowsol[irow] += elemnt[j] * value; } } else { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; rowsol[irow] += value; } } } } /* adjust to make as feasible as possible */ /* no */ if (extraBlock) { for (i = 0; i < extraBlock; i++) { double element = elemExtra[i]; int irow = rowExtra[i]; objvalue += solExtra[i] * costExtra[i]; rowsol[irow] += solExtra[i] * element; } } for (i = 0; i < nrows; i++) { double value = rowsol[i]; sum1 += fabs(value); sum2 += value * value; pi[i] = -2.0 * weight * value; } result.infeas = sum1; result.objval = objvalue; result.weighted = objvalue + weight * sum2; result.dropThis = 0.0; result.sumSquared = sum2; return result; } IdiotResult Idiot::IdiSolve( int nrows, int ncols, double * COIN_RESTRICT rowsol , double * COIN_RESTRICT colsol, double * COIN_RESTRICT pi, double * COIN_RESTRICT djs, const double * COIN_RESTRICT origcost , double * COIN_RESTRICT rowlower, double * COIN_RESTRICT rowupper, const double * COIN_RESTRICT lower, const double * COIN_RESTRICT upper, const double * COIN_RESTRICT elemnt, const int * row, const CoinBigIndex * columnStart, const int * length, double * COIN_RESTRICT lambda, int maxIts, double mu, double drop, double maxmin, double offset, int strategy, double djTol, double djExit, double djFlag, CoinThreadRandom * randomNumberGenerator) { IdiotResult result; int i, j, k, iter; double value = 0.0, objvalue = 0.0, weightedObj = 0.0; double tolerance = 1.0e-8; double * history[HISTORY+1]; int ncolx; int nChange; int extraBlock = 0; int * rowExtra = NULL; double * COIN_RESTRICT solExtra = NULL; double * COIN_RESTRICT elemExtra = NULL; double * COIN_RESTRICT upperExtra = NULL; double * COIN_RESTRICT costExtra = NULL; double * COIN_RESTRICT useCostExtra = NULL; double * COIN_RESTRICT saveExtra = NULL; double * COIN_RESTRICT cost = NULL; double saveValue = 1.0e30; double saveOffset = offset; double useOffset = offset; /*#define NULLVECTOR*/ #ifndef NULLVECTOR int nsolve = NSOLVE; #else int nsolve = NSOLVE + 1; /* allow for null vector */ #endif int nflagged; double * COIN_RESTRICT thetaX; double * COIN_RESTRICT djX; double * COIN_RESTRICT bX; double * COIN_RESTRICT vX; double ** aX; double **aworkX; double ** allsum; double * COIN_RESTRICT saveSol = 0; const double * COIN_RESTRICT useCost = cost; double bestSol = 1.0e60; double weight = 0.5 / mu; char * statusSave = new char[2*ncols]; char * statusWork = statusSave + ncols; #define DJTEST 5 double djSave[DJTEST]; double largestDj = 0.0; double smallestDj = 1.0e60; double maxDj = 0.0; int doFull = 0; #define SAVEHISTORY 10 #define EVERY (2*SAVEHISTORY) #define AFTER SAVEHISTORY*(HISTORY+1) #define DROP 5 double after = AFTER; double obj[DROP]; double kbad = 0, kgood = 0; if (strategy & 128) after = 999999; /* no acceleration at all */ for (i = 0; i < DROP; i++) { obj[i] = 1.0e70; } //#define FOUR_GOES 2 #ifdef FOUR_GOES double * COIN_RESTRICT pi2 = new double [3*nrows]; double * COIN_RESTRICT rowsol2 = new double [3*nrows]; double * COIN_RESTRICT piX[4]; double * COIN_RESTRICT rowsolX[4]; int startsX[2][5]; int nChangeX[4]; double maxDjX[4]; double objvalueX[4]; int nflaggedX[4]; piX[0]=pi; piX[1]=pi2; piX[2]=pi2+nrows; piX[3]=piX[2]+nrows; rowsolX[0]=rowsol; rowsolX[1]=rowsol2; rowsolX[2]=rowsol2+nrows; rowsolX[3]=rowsolX[2]+nrows; #endif allsum = new double * [nsolve]; aX = new double * [nsolve]; aworkX = new double * [nsolve]; thetaX = new double[nsolve]; vX = new double[nsolve]; bX = new double[nsolve]; djX = new double[nsolve]; allsum[0] = pi; for (i = 0; i < nsolve; i++) { if (i) allsum[i] = new double[nrows]; aX[i] = new double[nsolve]; aworkX[i] = new double[nsolve]; } /* check = rows */ for (i = 0; i < nrows; i++) { if (rowupper[i] - rowlower[i] > tolerance) { extraBlock++; } } cost = new double[ncols]; memset(rowsol, 0, nrows * sizeof(double)); for (i = 0; i < ncols; i++) { CoinBigIndex j; double value = origcost[i] * maxmin; double value2 = colsol[i]; if (elemnt) { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; value += elemnt[j] * lambda[irow]; rowsol[irow] += elemnt[j] * value2; } } else { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; value += lambda[irow]; rowsol[irow] += value2; } } cost[i] = value; } if (extraBlock) { rowExtra = new int[extraBlock]; solExtra = new double[extraBlock]; elemExtra = new double[extraBlock]; upperExtra = new double[extraBlock]; costExtra = new double[extraBlock]; saveExtra = new double[extraBlock]; extraBlock = 0; int nbad = 0; for (i = 0; i < nrows; i++) { if (rowupper[i] - rowlower[i] > tolerance) { double smaller, difference; double value; saveExtra[extraBlock] = rowupper[i]; if (fabs(rowupper[i]) > fabs(rowlower[i])) { smaller = rowlower[i]; value = -1.0; } else { smaller = rowupper[i]; value = 1.0; } if (fabs(smaller) > 1.0e10) { if (!nbad) COIN_DETAIL_PRINT(printf("Can't handle rows where both bounds >1.0e10 %d %g\n", i, smaller)); nbad++; if (rowupper[i] < 0.0 || rowlower[i] > 0.0) abort(); if (fabs(rowupper[i]) > fabs(rowlower[i])) { rowlower[i] = -0.9e10; smaller = rowlower[i]; value = -1.0; } else { rowupper[i] = 0.9e10; saveExtra[extraBlock] = rowupper[i]; smaller = rowupper[i]; value = 1.0; } } difference = rowupper[i] - rowlower[i]; difference = CoinMin(difference, 1.0e31); rowupper[i] = smaller; elemExtra[extraBlock] = value; solExtra[extraBlock] = (rowupper[i] - rowsol[i]) / value; if (solExtra[extraBlock] < 0.0) solExtra[extraBlock] = 0.0; if (solExtra[extraBlock] > difference) solExtra[extraBlock] = difference; costExtra[extraBlock] = lambda[i] * value; upperExtra[extraBlock] = difference; rowsol[i] += value * solExtra[extraBlock]; rowExtra[extraBlock++] = i; } } if (nbad) COIN_DETAIL_PRINT(printf("%d bad values - results may be wrong\n", nbad)); } for (i = 0; i < nrows; i++) { offset += lambda[i] * rowsol[i]; } if ((strategy & 256) != 0) { /* save best solution */ saveSol = new double[ncols]; CoinMemcpyN(colsol, ncols, saveSol); if (extraBlock) { useCostExtra = new double[extraBlock]; memset(useCostExtra, 0, extraBlock * sizeof(double)); } useCost = origcost; useOffset = saveOffset; } else { useCostExtra = costExtra; useCost = cost; useOffset = offset; } ncolx = ncols + extraBlock; for (i = 0; i < HISTORY + 1; i++) { history[i] = new double[ncolx]; } for (i = 0; i < DJTEST; i++) { djSave[i] = 1.0e30; } #ifndef OSI_IDIOT int numberColumns = model_->numberColumns(); for (int i=0;igetColumnStatus(i)!=ClpSimplex::isFixed) statusSave[i] = 0; else statusSave[i] = 2; } memset(statusSave+numberColumns,0,ncols-numberColumns); if ((strategy_&131072)==0) { for (int i=0;igetColumnStatus(i)==ClpSimplex::isFixed) { assert (colsol[i]upper[i]-tolerance); } } } #else for (i = 0; i < ncols; i++) { if (upper[i] - lower[i]) { statusSave[i] = 0; } else { statusSave[i] = 1; } } #endif // for two pass method int start[2]; int stop[2]; int direction = -1; start[0] = 0; stop[0] = ncols; start[1] = 0; stop[1] = 0; iter = 0; for (; iter < maxIts; iter++) { double sum1 = 0.0, sum2 = 0.0; double lastObj = 1.0e70; int good = 0, doScale = 0; if (strategy & 16) { int ii = iter / EVERY + 1; ii = ii * EVERY; if (iter > ii - HISTORY * 2 && (iter & 1) == 0) { double * COIN_RESTRICT x = history[HISTORY-1]; for (i = HISTORY - 1; i > 0; i--) { history[i] = history[i-1]; } history[0] = x; CoinMemcpyN(colsol, ncols, history[0]); CoinMemcpyN(solExtra, extraBlock, history[0] + ncols); } } if ((iter % SAVEHISTORY) == 0 || doFull) { if ((strategy & 16) == 0) { double * COIN_RESTRICT x = history[HISTORY-1]; for (i = HISTORY - 1; i > 0; i--) { history[i] = history[i-1]; } history[0] = x; CoinMemcpyN(colsol, ncols, history[0]); CoinMemcpyN(solExtra, extraBlock, history[0] + ncols); } } /* start full try */ if ((iter % EVERY) == 0 || doFull) { // for next pass direction = - direction; // randomize. // The cast is to avoid gcc compiler warning int kcol = static_cast(ncols * randomNumberGenerator->randomDouble()); if (kcol == ncols) kcol = ncols - 1; if (direction > 0) { start[0] = kcol; stop[0] = ncols; start[1] = 0; stop[1] = kcol; #ifdef FOUR_GOES for (int itry=0;itry<2;itry++) { int chunk=(stop[itry]-start[itry]+FOUR_GOES-1)/FOUR_GOES; startsX[itry][0]=start[itry]; for (int i=1;i<5;i++) startsX[itry][i]=CoinMin(stop[itry],startsX[itry][i-1]+chunk); } #endif } else { start[0] = kcol; stop[0] = -1; start[1] = ncols - 1; stop[1] = kcol; #ifdef FOUR_GOES for (int itry=0;itry<2;itry++) { int chunk=(start[itry]-stop[itry]+FOUR_GOES-1)/FOUR_GOES; startsX[itry][0]=start[itry]; for (int i=1;i<5;i++) startsX[itry][i]=CoinMax(stop[itry],startsX[itry][i-1]-chunk); } #endif } int itry = 0; /*if ((strategy&16)==0) { double * COIN_RESTRICT x=history[HISTORY-1]; for (i=HISTORY-1;i>0;i--) { history[i]=history[i-1]; } history[0]=x; CoinMemcpyN(colsol,ncols,history[0]); CoinMemcpyN(solExtra,extraBlock,history[0]+ncols); }*/ while (!good) { itry++; #define MAXTRY 5 if (iter > after && doScale < 2 && itry < MAXTRY) { /* now full one */ for (i = 0; i < nrows; i++) { rowsol[i] = -rowupper[i]; } sum2 = 0.0; objvalue = 0.0; memset(pi, 0, nrows * sizeof(double)); { double * COIN_RESTRICT theta = thetaX; double * COIN_RESTRICT dj = djX; double * COIN_RESTRICT b = bX; double ** a = aX; double ** awork = aworkX; double * COIN_RESTRICT v = vX; double c; #ifdef FIT int ntot = 0, nsign = 0, ngood = 0, mgood[4] = {0, 0, 0, 0}; double diff1, diff2, val0, val1, val2, newValue; CoinMemcpyN(colsol, ncols, history[HISTORY-1]); CoinMemcpyN(solExtra, extraBlock, history[HISTORY-1] + ncols); #endif dj[0] = 0.0; for (i = 1; i < nsolve; i++) { dj[i] = 0.0; memset(allsum[i], 0, nrows * sizeof(double)); } for (i = 0; i < ncols; i++) { double value2 = colsol[i]; if (value2 > lower[i] + tolerance) { if(value2 < (upper[i] - tolerance)) { int k; objvalue += value2 * cost[i]; #ifdef FIT ntot++; val0 = history[0][i]; val1 = history[1][i]; val2 = history[2][i]; diff1 = val0 - val1; diff2 = val1 - val2; if (diff1*diff2 >= 0.0) { nsign++; if (fabs(diff1) < fabs(diff2)) { int ii = static_cast(fabs(4.0 * diff1 / diff2)); if (ii == 4) ii = 3; mgood[ii]++; ngood++; } if (fabs(diff1) < 0.75 * fabs(diff2)) { newValue = val1 + (diff1 * diff2) / (diff2 - diff1); } else { newValue = val1 + 4.0 * diff1; } } else { newValue = 0.333333333 * (val0 + val1 + val2); } if (newValue > upper[i] - tolerance) { newValue = upper[i]; } else if (newValue < lower[i] + tolerance) { newValue = lower[i]; } history[HISTORY-1][i] = newValue; #endif for (k = 0; k < HISTORY - 1; k++) { value = history[k][i] - history[k+1][i]; dj[k] += value * cost[i]; v[k] = value; } if (elemnt) { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; for (k = 0; k < HISTORY - 1; k++) { allsum[k][irow] += elemnt[j] * v[k]; } rowsol[irow] += elemnt[j] * value2; } } else { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; for (k = 0; k < HISTORY - 1; k++) { allsum[k][irow] += v[k]; } rowsol[irow] += value2; } } } else { /* at ub */ colsol[i] = upper[i]; value2 = colsol[i]; objvalue += value2 * cost[i]; if (elemnt) { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; rowsol[irow] += elemnt[j] * value2; } } else { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; rowsol[irow] += value2; } } } } else { /* at lb */ if (value2) { objvalue += value2 * cost[i]; if (elemnt) { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; rowsol[irow] += elemnt[j] * value2; } } else { for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; rowsol[irow] += value2; } } } } } #ifdef FIT /*printf("total %d, same sign %d, good %d %d %d %d %d\n", ntot,nsign,ngood,mgood[0],mgood[1],mgood[2],mgood[3]);*/ #endif if (extraBlock) { for (i = 0; i < extraBlock; i++) { double element = elemExtra[i]; int irow = rowExtra[i]; objvalue += solExtra[i] * costExtra[i]; if (solExtra[i] > tolerance && solExtra[i] < (upperExtra[i] - tolerance)) { double value2 = solExtra[i]; int k; for (k = 0; k < HISTORY - 1; k++) { value = history[k][i+ncols] - history[k+1][i+ncols]; dj[k] += value * costExtra[i]; allsum[k][irow] += element * value; } rowsol[irow] += element * value2; } else { double value2 = solExtra[i]; double element = elemExtra[i]; int irow = rowExtra[i]; rowsol[irow] += element * value2; } } } #ifdef NULLVECTOR if ((strategy & 64)) { double djVal = dj[0]; for (i = 0; i < ncols - nrows; i++) { double value2 = colsol[i]; if (value2 > lower[i] + tolerance && value2 < upper[i] - tolerance) { value = history[0][i] - history[1][i]; } else { value = 0.0; } history[HISTORY][i] = value; } for (; i < ncols; i++) { double value2 = colsol[i]; double delta; int irow = i - (ncols - nrows); double oldSum = allsum[0][irow];; if (value2 > lower[i] + tolerance && value2 < upper[i] - tolerance) { delta = history[0][i] - history[1][i]; } else { delta = 0.0; } djVal -= delta * cost[i]; oldSum -= delta; delta = - oldSum; djVal += delta * cost[i]; history[HISTORY][i] = delta; } dj[HISTORY-1] = djVal; djVal = 0.0; for (i = 0; i < ncols; i++) { double value2 = colsol[i]; if (value2 > lower[i] + tolerance && value2 < upper[i] - tolerance || i >= ncols - nrows) { int k; value = history[HISTORY][i]; djVal += value * cost[i]; for (j = columnStart[i]; j < columnStart[i] + length[i]; j++) { int irow = row[j]; allsum[nsolve-1][irow] += value; } } } printf("djs %g %g\n", dj[HISTORY-1], djVal); } #endif for (i = 0; i < nsolve; i++) { int j; b[i] = 0.0; for (j = 0; j < nsolve; j++) { a[i][j] = 0.0; } } c = 0.0; for (i = 0; i < nrows; i++) { double value = rowsol[i]; for (k = 0; k < nsolve; k++) { v[k] = allsum[k][i]; b[k] += v[k] * value; } c += value * value; for (k = 0; k < nsolve; k++) { for (j = k; j < nsolve; j++) { a[k][j] += v[k] * v[j]; } } } sum2 = c; if (itry == 1) { lastObj = objvalue + weight * sum2; } for (k = 0; k < nsolve; k++) { b[k] = - (weight * b[k] + 0.5 * dj[k]); for (j = k; j < nsolve; j++) { a[k][j] *= weight; a[j][k] = a[k][j]; } } c *= weight; for (k = 0; k < nsolve; k++) { theta[k] = b[k]; } solveSmall(nsolve, a, awork, theta); if ((strategy & 64) != 0) { value = 10.0; for (k = 0; k < nsolve; k++) { value = CoinMax(value, fabs(theta[k])); } if (value > 10.0 && ((logLevel_ & 4) != 0)) { printf("theta %g %g %g\n", theta[0], theta[1], theta[2]); } value = 10.0 / value; for (k = 0; k < nsolve; k++) { theta[k] *= value; } } for (i = 0; i < ncolx; i++) { double valueh = 0.0; for (k = 0; k < HISTORY - 1; k++) { value = history[k][i] - history[k+1][i]; valueh += value * theta[k]; } #ifdef NULLVECTOR value = history[HISTORY][i]; valueh += value * theta[HISTORY-1]; #endif history[HISTORY][i] = valueh; } } #ifdef NULLVECTOR if ((strategy & 64)) { for (i = 0; i < ncols - nrows; i++) { if (colsol[i] <= lower[i] + tolerance || colsol[i] >= (upper[i] - tolerance)) { history[HISTORY][i] = 0.0;; } } tolerance = -tolerance; /* switch off test */ } #endif if (!doScale) { for (i = 0; i < ncols; i++) { if (colsol[i] > lower[i] + tolerance && colsol[i] < (upper[i] - tolerance)) { value = history[HISTORY][i]; colsol[i] += value; if (colsol[i] < lower[i] + tolerance) { colsol[i] = lower[i]; } else if (colsol[i] > upper[i] - tolerance) { colsol[i] = upper[i]; } } } if (extraBlock) { for (i = 0; i < extraBlock; i++) { if (solExtra[i] > tolerance && solExtra[i] < (upperExtra[i] - tolerance)) { value = history[HISTORY][i+ncols]; solExtra[i] += value; if (solExtra[i] < 0.0) { solExtra[i] = 0.0; } else if (solExtra[i] > upperExtra[i]) { solExtra[i] = upperExtra[i]; } } } } } else { double theta = 1.0; double saveTheta = theta; for (i = 0; i < ncols; i++) { if (colsol[i] > lower[i] + tolerance && colsol[i] < (upper[i] - tolerance)) { value = history[HISTORY][i]; if (value > 0) { if (theta * value + colsol[i] > upper[i]) { theta = (upper[i] - colsol[i]) / value; } } else if (value < 0) { if (colsol[i] + theta * value < lower[i]) { theta = (lower[i] - colsol[i]) / value; } } } } if (extraBlock) { for (i = 0; i < extraBlock; i++) { if (solExtra[i] > tolerance && solExtra[i] < (upperExtra[i] - tolerance)) { value = history[HISTORY][i+ncols]; if (value > 0) { if (theta * value + solExtra[i] > upperExtra[i]) { theta = (upperExtra[i] - solExtra[i]) / value; } } else if (value < 0) { if (solExtra[i] + theta * value < 0.0) { theta = -solExtra[i] / value; } } } } } if ((iter % 100 == 0) && (logLevel_ & 8) != 0) { if (theta < saveTheta) { printf(" - modified theta %g\n", theta); } } for (i = 0; i < ncols; i++) { if (colsol[i] > lower[i] + tolerance && colsol[i] < (upper[i] - tolerance)) { value = history[HISTORY][i]; colsol[i] += value * theta; } } if (extraBlock) { for (i = 0; i < extraBlock; i++) { if (solExtra[i] > tolerance && solExtra[i] < (upperExtra[i] - tolerance)) { value = history[HISTORY][i+ncols]; solExtra[i] += value * theta; } } } } #ifdef NULLVECTOR tolerance = fabs(tolerance); /* switch back on */ #endif if ((iter % 100) == 0 && (logLevel_ & 8) != 0) { printf("\n"); } } good = 1; result = objval(nrows, ncols, rowsol, colsol, pi, djs, useCost, rowlower, rowupper, lower, upper, elemnt, row, columnStart, length, extraBlock, rowExtra, solExtra, elemExtra, upperExtra, useCostExtra, weight); weightedObj = result.weighted; if (!iter) saveValue = weightedObj; objvalue = result.objval; sum1 = result.infeas; if (saveSol) { if (result.weighted < bestSol) { COIN_DETAIL_PRINT(printf("%d %g better than %g\n", iter, result.weighted * maxmin - useOffset, bestSol * maxmin - useOffset)); bestSol = result.weighted; CoinMemcpyN(colsol, ncols, saveSol); } } #ifdef FITz if (iter > after) { IdiotResult result2; double ww, oo, ss; if (extraBlock) abort(); result2 = objval(nrows, ncols, row2, sol2, pi2, djs, cost, rowlower, rowupper, lower, upper, elemnt, row, columnStart, extraBlock, rowExtra, solExtra, elemExtra, upperExtra, costExtra, weight); ww = result2.weighted; oo = result2.objval; ss = result2.infeas; printf("wobj %g obj %g inf %g last %g\n", ww, oo, ss, lastObj); if (ww < weightedObj && ww < lastObj) { printf(" taken"); ntaken++; saving += weightedObj - ww; weightedObj = ww; objvalue = oo; sum1 = ss; CoinMemcpyN(row2, nrows, rowsol); CoinMemcpyN(pi2, nrows, pi); CoinMemcpyN(sol2, ncols, colsol); result = objval(nrows, ncols, rowsol, colsol, pi, djs, cost, rowlower, rowupper, lower, upper, elemnt, row, columnStart, extraBlock, rowExtra, solExtra, elemExtra, upperExtra, costExtra, weight); weightedObj = result.weighted; objvalue = result.objval; sum1 = result.infeas; if (ww < weightedObj) abort(); } else { printf(" not taken"); nottaken++; } } #endif /*printf("%d %g %g %g %g\n",itry,lastObj,weightedObj,objvalue,sum1);*/ if (weightedObj > lastObj + 1.0e-4 && itry < MAXTRY) { if((logLevel_ & 16) != 0 && doScale) { printf("Weighted objective from %g to %g **** bad move\n", lastObj, weightedObj); } if (doScale) { good = 1; } if ((strategy & 3) == 1) { good = 0; if (weightedObj > lastObj + djExit) { if ((logLevel_ & 16) != 0) { printf("Weighted objective from %g to %g ?\n", lastObj, weightedObj); } CoinMemcpyN(history[0], ncols, colsol); CoinMemcpyN(history[0] + ncols, extraBlock, solExtra); good = 1; } } else if ((strategy & 3) == 2) { if (weightedObj > lastObj + 0.1 * maxDj) { CoinMemcpyN(history[0], ncols, colsol); CoinMemcpyN(history[0] + ncols, extraBlock, solExtra); doScale++; good = 0; } } else if ((strategy & 3) == 3) { if (weightedObj > lastObj + 0.001 * maxDj) { /*doScale++;*/ good = 0; } } } } if ((iter % checkFrequency_) == 0) { double best = weightedObj; double test = obj[0]; for (i = 1; i < DROP; i++) { obj[i-1] = obj[i]; if (best > obj[i]) best = obj[i]; } obj[DROP-1] = best; if (test - best < drop && (strategy & 8) == 0) { if ((logLevel_ & 8) != 0) { printf("Exiting as drop in %d its is %g after %d iterations\n", DROP * checkFrequency_, test - best, iter); } goto RETURN; } } if ((iter % logFreq_) == 0) { double piSum = 0.0; for (i = 0; i < nrows; i++) { piSum += (rowsol[i] + rowupper[i]) * pi[i]; } if ((logLevel_ & 2) != 0) { printf("%d Infeas %g, obj %g - wtObj %g dual %g maxDj %g\n", iter, sum1, objvalue * maxmin - useOffset, weightedObj - useOffset, piSum * maxmin - useOffset, maxDj); } } CoinMemcpyN(statusSave, ncols, statusWork); nflagged = 0; } nChange = 0; doFull = 0; maxDj = 0.0; // go through forwards or backwards and starting at odd places #ifdef FOUR_GOES for (int i=1;i>1; } else { istart=(start[itry]+stop[itry])>>1; istop = stop[itry]; } #endif #if 0 printf("istart %d istop %d direction %d array %d %d new %d %d\n", istart,istop,direction,start[itry],stop[itry], startsX[itry][iPar],startsX[itry][iPar+1]); #endif istart=startsX[itry][iPar]; istop=startsX[itry][iPar+1]; #else for (int itry = 0; itry < 2; itry++) { int istart = start[itry]; int istop = stop[itry]; #endif for (int icol=istart; icol != istop; icol += direction) { if (!statusWork[icol]) { CoinBigIndex j; double value = colsol[icol]; double djval = cost[icol]; double djval2, value2; double theta, a, b, c; if (elemnt) { for (j = columnStart[icol]; j < columnStart[icol] + length[icol]; j++) { int irow = row[j]; djval -= elemnt[j] * pi[irow]; } } else { for (j = columnStart[icol]; j < columnStart[icol] + length[icol]; j++) { int irow = row[j]; djval -= pi[irow]; } } /*printf("xx iter %d seq %d djval %g value %g\n", iter,i,djval,value);*/ if (djval > 1.0e-5) { value2 = (lower[icol] - value); } else { value2 = (upper[icol] - value); } djval2 = djval * value2; djval = fabs(djval); if (djval > djTol) { if (djval2 < -1.0e-4) { #ifndef FOUR_GOES nChange++; if (djval > maxDj) maxDj = djval; #else nChangeX[iPar]++; if (djval > maxDjX[iPar]) maxDjX[iPar] = djval; #endif /*if (djval>3.55e6) { printf("big\n"); }*/ a = 0.0; b = 0.0; c = 0.0; djval2 = cost[icol]; if (elemnt) { for (j = columnStart[icol]; j < columnStart[icol] + length[icol]; j++) { int irow = row[j]; double value = rowsol[irow]; c += value * value; a += elemnt[j] * elemnt[j]; b += value * elemnt[j]; } } else { for (j = columnStart[icol]; j < columnStart[icol] + length[icol]; j++) { int irow = row[j]; double value = rowsol[irow]; c += value * value; a += 1.0; b += value; } } a *= weight; b = b * weight + 0.5 * djval2; c *= weight; /* solve */ theta = -b / a; #ifndef FOUR_GOES if ((strategy & 4) != 0) { double valuep, thetap; value2 = a * theta * theta + 2.0 * b * theta; thetap = 2.0 * theta; valuep = a * thetap * thetap + 2.0 * b * thetap; if (valuep < value2 + djTol) { theta = thetap; kgood++; } else { kbad++; } } #endif if (theta > 0.0) { if (theta < upper[icol] - colsol[icol]) { value2 = theta; } else { value2 = upper[icol] - colsol[icol]; } } else { if (theta > lower[icol] - colsol[icol]) { value2 = theta; } else { value2 = lower[icol] - colsol[icol]; } } colsol[icol] += value2; #ifndef FOUR_GOES objvalue += cost[icol] * value2; #else objvalueX[iPar] += cost[icol] * value2; #endif if (elemnt) { for (j = columnStart[icol]; j < columnStart[icol] + length[icol]; j++) { int irow = row[j]; double value; rowsol[irow] += elemnt[j] * value2; value = rowsol[irow]; pi[irow] = -2.0 * weight * value; } } else { for (j = columnStart[icol]; j < columnStart[icol] + length[icol]; j++) { int irow = row[j]; double value; rowsol[irow] += value2; value = rowsol[irow]; pi[irow] = -2.0 * weight * value; } } } else { /* dj but at bound */ if (djval > djFlag) { statusWork[icol] = 1; #ifndef FOUR_GOES nflagged++; #else nflaggedX[iPar]++; #endif } } } } } #ifdef FOUR_GOES } #endif } #ifdef FOUR_GOES for (int i=0;i 1.0e-5) { value2 = -value; } else { value2 = (upperExtra[i] - value); } djval2 = djval * value2; if (djval2 < -1.0e-4 && fabs(djval) > djTol) { nChange++; a = 0.0; b = 0.0; c = 0.0; djval2 = costExtra[i]; value = rowsol[irow]; c += value * value; a += element * element; b += element * value; a *= weight; b = b * weight + 0.5 * djval2; c *= weight; /* solve */ theta = -b / a; if (theta > 0.0) { value2 = CoinMin(theta, upperExtra[i] - solExtra[i]); } else { value2 = CoinMax(theta, -solExtra[i]); } solExtra[i] += value2; rowsol[irow] += element * value2; value = rowsol[irow]; pi[irow] = -2.0 * weight * value; } } } if ((iter % 10) == 2) { for (int i = DJTEST - 1; i > 0; i--) { djSave[i] = djSave[i-1]; } djSave[0] = maxDj; largestDj = CoinMax(largestDj, maxDj); smallestDj = CoinMin(smallestDj, maxDj); for (int i = DJTEST - 1; i > 0; i--) { maxDj += djSave[i]; } maxDj = maxDj / static_cast (DJTEST); if (maxDj < djExit && iter > 50) { //printf("Exiting on low dj %g after %d iterations\n",maxDj,iter); break; } if (nChange < 100) { djTol *= 0.5; } } } RETURN: if (kgood || kbad) { COIN_DETAIL_PRINT(printf("%g good %g bad\n", kgood, kbad)); } result = objval(nrows, ncols, rowsol, colsol, pi, djs, useCost, rowlower, rowupper, lower, upper, elemnt, row, columnStart, length, extraBlock, rowExtra, solExtra, elemExtra, upperExtra, useCostExtra, weight); result.djAtBeginning = largestDj; result.djAtEnd = smallestDj; result.dropThis = saveValue - result.weighted; if (saveSol) { if (result.weighted < bestSol) { bestSol = result.weighted; CoinMemcpyN(colsol, ncols, saveSol); } else { COIN_DETAIL_PRINT(printf("restoring previous - now %g best %g\n", result.weighted * maxmin - useOffset, bestSol * maxmin - useOffset)); } } if (saveSol) { if (extraBlock) { delete [] useCostExtra; } CoinMemcpyN(saveSol, ncols, colsol); delete [] saveSol; } for (i = 0; i < nsolve; i++) { if (i) delete [] allsum[i]; delete [] aX[i]; delete [] aworkX[i]; } delete [] thetaX; delete [] djX; delete [] bX; delete [] vX; delete [] aX; delete [] aworkX; delete [] allsum; delete [] cost; #ifdef FOUR_GOES delete [] pi2 ; delete [] rowsol2 ; #endif for (i = 0; i < HISTORY + 1; i++) { delete [] history[i]; } delete [] statusSave; /* do original costs objvalue*/ result.objval = 0.0; for (i = 0; i < ncols; i++) { result.objval += colsol[i] * origcost[i]; } if (extraBlock) { for (i = 0; i < extraBlock; i++) { int irow = rowExtra[i]; rowupper[irow] = saveExtra[i]; } delete [] rowExtra; delete [] solExtra; delete [] elemExtra; delete [] upperExtra; delete [] costExtra; delete [] saveExtra; } result.iteration = iter; result.objval -= saveOffset; result.weighted = result.objval + weight * result.sumSquared; return result; } CoinMP-1.8.3/Clp/src/ClpNetworkBasis.hpp0000644000175000017500000001112511552534715016414 0ustar renerene/* $Id: ClpNetworkBasis.hpp 1722 2011-04-17 09:58:37Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef ClpNetworkBasis_H #define ClpNetworkBasis_H class ClpMatrixBase; class CoinIndexedVector; class ClpSimplex; #include "CoinTypes.hpp" #ifndef COIN_FAST_CODE #define COIN_FAST_CODE #endif /** This deals with Factorization and Updates for network structures */ class ClpNetworkBasis { public: /**@name Constructors and destructor and copy */ //@{ /// Default constructor ClpNetworkBasis ( ); /// Constructor from CoinFactorization ClpNetworkBasis(const ClpSimplex * model, int numberRows, const CoinFactorizationDouble * pivotRegion, const int * permuteBack, const CoinBigIndex * startColumn, const int * numberInColumn, const int * indexRow, const CoinFactorizationDouble * element); /// Copy constructor ClpNetworkBasis ( const ClpNetworkBasis &other); /// Destructor ~ClpNetworkBasis ( ); /// = copy ClpNetworkBasis & operator = ( const ClpNetworkBasis & other ); //@} /**@name Do factorization */ //@{ /** When part of LP - given by basic variables. Actually does factorization. Arrays passed in have non negative value to say basic. If status is okay, basic variables have pivot row - this is only needed if increasingRows_ >1. If status is singular, then basic variables have pivot row and ones thrown out have -1 returns 0 -okay, -1 singular, -2 too many in basis */ int factorize ( const ClpMatrixBase * matrix, int rowIsBasic[], int columnIsBasic[]); //@} /**@name rank one updates which do exist */ //@{ /** Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular!! */ int replaceColumn ( CoinIndexedVector * column, int pivotRow); //@} /**@name various uses of factorization (return code number elements) which user may want to know about */ //@{ /** Updates one column (FTRAN) from region, Returns pivot value if "pivotRow" >=0 */ double updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, int pivotRow); /** Updates one column (FTRAN) to/from array ** For large problems you should ALWAYS know where the nonzeros are, so please try and migrate to previous method after you have got code working using this simple method - thank you! (the only exception is if you know input is dense e.g. rhs) */ int updateColumn ( CoinIndexedVector * regionSparse, double array[] ) const; /** Updates one column transpose (BTRAN) ** For large problems you should ALWAYS know where the nonzeros are, so please try and migrate to previous method after you have got code working using this simple method - thank you! (the only exception is if you know input is dense e.g. dense objective) returns number of nonzeros */ int updateColumnTranspose ( CoinIndexedVector * regionSparse, double array[] ) const; /** Updates one column (BTRAN) from region2 */ int updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const; //@} ////////////////// data ////////////////// private: // checks looks okay void check(); // prints data void print(); /**@name data */ //@{ #ifndef COIN_FAST_CODE /// Whether slack value is +1 or -1 double slackValue_; #endif /// Number of Rows in factorization int numberRows_; /// Number of Columns in factorization int numberColumns_; /// model const ClpSimplex * model_; /// Parent for each column int * parent_; /// Descendant int * descendant_; /// Pivot row int * pivot_; /// Right sibling int * rightSibling_; /// Left sibling int * leftSibling_; /// Sign of pivot double * sign_; /// Stack int * stack_; /// Permute into array int * permute_; /// Permute back array int * permuteBack_; /// Second stack int * stack2_; /// Depth int * depth_; /// To mark rows char * mark_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpPrimalColumnDantzig.cpp0000644000175000017500000002043411571121105017704 0ustar renerene/* $Id: ClpPrimalColumnDantzig.cpp 1732 2011-05-31 08:09:41Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include "CoinIndexedVector.hpp" #include "ClpSimplex.hpp" #include "ClpPrimalColumnDantzig.hpp" #include "ClpFactorization.hpp" #include "ClpPackedMatrix.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpPrimalColumnDantzig::ClpPrimalColumnDantzig () : ClpPrimalColumnPivot() { type_ = 1; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpPrimalColumnDantzig::ClpPrimalColumnDantzig (const ClpPrimalColumnDantzig & source) : ClpPrimalColumnPivot(source) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpPrimalColumnDantzig::~ClpPrimalColumnDantzig () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpPrimalColumnDantzig & ClpPrimalColumnDantzig::operator=(const ClpPrimalColumnDantzig& rhs) { if (this != &rhs) { ClpPrimalColumnPivot::operator=(rhs); } return *this; } // Returns pivot column, -1 if none int ClpPrimalColumnDantzig::pivotColumn(CoinIndexedVector * updates, CoinIndexedVector * /*spareRow1*/, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2) { assert(model_); int iSection, j; int number; int * index; double * updateBy; double * reducedCost; bool anyUpdates; if (updates->getNumElements()) { anyUpdates = true; } else { // sub flip - nothing to do anyUpdates = false; } if (anyUpdates) { model_->factorization()->updateColumnTranspose(spareRow2, updates); // put row of tableau in rowArray and columnArray model_->clpMatrix()->transposeTimes(model_, -1.0, updates, spareColumn2, spareColumn1); for (iSection = 0; iSection < 2; iSection++) { reducedCost = model_->djRegion(iSection); if (!iSection) { number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); } else { number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); } for (j = 0; j < number; j++) { int iSequence = index[j]; double value = reducedCost[iSequence]; value -= updateBy[j]; updateBy[j] = 0.0; reducedCost[iSequence] = value; } } updates->setNumElements(0); spareColumn1->setNumElements(0); } // update of duals finished - now do pricing double largest = model_->currentPrimalTolerance(); // we can't really trust infeasibilities if there is primal error if (model_->largestDualError() > 1.0e-8) largest *= model_->largestDualError() / 1.0e-8; double bestDj = model_->dualTolerance(); int bestSequence = -1; double bestFreeDj = model_->dualTolerance(); int bestFreeSequence = -1; number = model_->numberRows() + model_->numberColumns(); int iSequence; reducedCost = model_->djRegion(); #ifndef CLP_PRIMAL_SLACK_MULTIPLIER for (iSequence = 0; iSequence < number; iSequence++) { // check flagged variable if (!model_->flagged(iSequence)) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > bestFreeDj) { bestFreeDj = fabs(value); bestFreeSequence = iSequence; } break; case ClpSimplex::atUpperBound: if (value > bestDj) { bestDj = value; bestSequence = iSequence; } break; case ClpSimplex::atLowerBound: if (value < -bestDj) { bestDj = -value; bestSequence = iSequence; } } } } #else // Columns int numberColumns = model_->numberColumns(); for (iSequence = 0; iSequence < numberColumns; iSequence++) { // check flagged variable if (!model_->flagged(iSequence)) { double value = reducedCost[iSequence]; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > bestFreeDj) { bestFreeDj = fabs(value); bestFreeSequence = iSequence; } break; case ClpSimplex::atUpperBound: if (value > bestDj) { bestDj = value; bestSequence = iSequence; } break; case ClpSimplex::atLowerBound: if (value < -bestDj) { bestDj = -value; bestSequence = iSequence; } } } } // Rows for ( ; iSequence < number; iSequence++) { // check flagged variable if (!model_->flagged(iSequence)) { double value = reducedCost[iSequence] * CLP_PRIMAL_SLACK_MULTIPLIER; ClpSimplex::Status status = model_->getStatus(iSequence); switch(status) { case ClpSimplex::basic: case ClpSimplex::isFixed: break; case ClpSimplex::isFree: case ClpSimplex::superBasic: if (fabs(value) > bestFreeDj) { bestFreeDj = fabs(value); bestFreeSequence = iSequence; } break; case ClpSimplex::atUpperBound: if (value > bestDj) { bestDj = value; bestSequence = iSequence; } break; case ClpSimplex::atLowerBound: if (value < -bestDj) { bestDj = -value; bestSequence = iSequence; } } } } #endif // bias towards free if (bestFreeSequence >= 0 && bestFreeDj > 0.1 * bestDj) bestSequence = bestFreeSequence; return bestSequence; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpPrimalColumnPivot * ClpPrimalColumnDantzig::clone(bool CopyData) const { if (CopyData) { return new ClpPrimalColumnDantzig(*this); } else { return new ClpPrimalColumnDantzig(); } } CoinMP-1.8.3/Clp/src/config_default.h0000644000175000017500000000145012101105055015731 0ustar renerene /* include the COIN-OR-wide system specific configure header */ #include "configall_system.h" /* include the public project specific macros */ #include "config_clp_default.h" /***************************************************************************/ /* HERE DEFINE THE PROJECT SPECIFIC MACROS */ /* These are only in effect in a setting that doesn't use configure */ /***************************************************************************/ /* Define to the debug sanity check level (0 is no test) */ #define COIN_CLP_CHECKLEVEL 0 /* Define to the debug verbosity level (0 is no output) */ #define COIN_CLP_VERBOSITY 0 /* Define to 1 if the CoinUtils package is used */ #define COIN_HAS_COINUTILS 1 /* Define to 1 if Clp is used */ #define COIN_HAS_CLP 1 CoinMP-1.8.3/Clp/src/ClpDynamicMatrix.hpp0000644000175000017500000003337011602416137016551 0ustar renerene/* $Id: ClpDynamicMatrix.hpp 1755 2011-06-28 18:24:31Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpDynamicMatrix_H #define ClpDynamicMatrix_H #include "CoinPragma.hpp" #include "ClpPackedMatrix.hpp" class ClpSimplex; /** This implements a dynamic matrix when we have a limit on the number of "interesting rows". This version inherits from ClpPackedMatrix and knows that the real matrix is gub. A later version could use shortest path to generate columns. */ class ClpDynamicMatrix : public ClpPackedMatrix { public: /// enums for status of various sorts enum DynamicStatus { soloKey = 0x00, inSmall = 0x01, atUpperBound = 0x02, atLowerBound = 0x03 }; /**@name Main functions provided */ //@{ /// Partial pricing virtual void partialPricing(ClpSimplex * model, double start, double end, int & bestSequence, int & numberWanted); /** update information for a pivot (and effective rhs) */ virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue); /** Returns effective RHS offset if it is being used. This is used for long problems or big dynamic or anywhere where going through full columns is expensive. This may re-compute */ virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false, bool check = false); using ClpPackedMatrix::times ; /** Return y + A * scalar *x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ virtual void times(double scalar, const double * x, double * y) const; /// Modifies rhs offset void modifyOffset(int sequence, double amount); /// Gets key value when none in small double keyValue(int iSet) const; /** mode=0 - Set up before "updateTranspose" and "transposeTimes" for duals using extended updates array (and may use other if dual values pass) mode=1 - Update dual solution after "transposeTimes" using extended rows. mode=2 - Compute all djs and compute key dual infeasibilities mode=3 - Report on key dual infeasibilities mode=4 - Modify before updateTranspose in partial pricing */ virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array, double * other, int mode); /** mode=0 - Create list of non-key basics in pivotVariable_ using number as numberBasic in and out mode=1 - Set all key variables as basic mode=2 - return number extra rows needed, number gives maximum number basic mode=3 - before replaceColumn mode=4 - return 1 if can do primal, 2 if dual, 3 if both mode=5 - save any status stuff (when in good state) mode=6 - restore status stuff mode=7 - flag given variable (normally sequenceIn) mode=8 - unflag all variables mode=9 - synchronize costs mode=10 - return 1 if there may be changing bounds on variable (column generation) mode=11 - make sure set is clean (used when a variable rejected - but not flagged) mode=12 - after factorize but before permute stuff mode=13 - at end of simplex to delete stuff */ virtual int generalExpanded(ClpSimplex * model, int mode, int & number); /** Purely for column generation and similar ideas. Allows matrix and any bounds or costs to be updated (sensibly). Returns non-zero if any changes. */ virtual int refresh(ClpSimplex * model); /** Creates a variable. This is called after partial pricing and will modify matrix. Will update bestSequence. */ virtual void createVariable(ClpSimplex * model, int & bestSequence); /// Returns reduced cost of a variable virtual double reducedCost( ClpSimplex * model, int sequence) const; /// Does gub crash void gubCrash(); /// Writes out model (without names) void writeMps(const char * name); /// Populates initial matrix from dynamic status void initialProblem(); /** Adds in a column to gub structure (called from descendant) and returns sequence */ int addColumn(int numberEntries, const int * row, const double * element, double cost, double lower, double upper, int iSet, DynamicStatus status); /** If addColumn forces compression then this allows descendant to know what to do. If >=0 then entry stayed in, if -1 then entry went out to lower bound.of zero. Entries at upper bound (really nonzero) never go out (at present). */ virtual void packDown(const int * , int ) {} /// Gets lower bound (to simplify coding) inline double columnLower(int sequence) const { if (columnLower_) return columnLower_[sequence]; else return 0.0; } /// Gets upper bound (to simplify coding) inline double columnUpper(int sequence) const { if (columnUpper_) return columnUpper_[sequence]; else return COIN_DBL_MAX; } //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpDynamicMatrix(); /** This is the real constructor. It assumes factorization frequency will not be changed. This resizes model !!!! The contents of original matrix in model will be taken over and original matrix will be sanitized so can be deleted (to avoid a very small memory leak) */ ClpDynamicMatrix(ClpSimplex * model, int numberSets, int numberColumns, const int * starts, const double * lower, const double * upper, const CoinBigIndex * startColumn, const int * row, const double * element, const double * cost, const double * columnLower = NULL, const double * columnUpper = NULL, const unsigned char * status = NULL, const unsigned char * dynamicStatus = NULL); /** Destructor */ virtual ~ClpDynamicMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpDynamicMatrix(const ClpDynamicMatrix&); /** The copy constructor from an CoinPackedMatrix. */ ClpDynamicMatrix(const CoinPackedMatrix&); ClpDynamicMatrix& operator=(const ClpDynamicMatrix&); /// Clone virtual ClpMatrixBase * clone() const ; //@} /**@name gets and sets */ //@{ /// Status of row slacks inline ClpSimplex::Status getStatus(int sequence) const { return static_cast (status_[sequence] & 7); } inline void setStatus(int sequence, ClpSimplex::Status status) { unsigned char & st_byte = status_[sequence]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | status); } /// Whether flagged slack inline bool flaggedSlack(int i) const { return (status_[i] & 8) != 0; } inline void setFlaggedSlack(int i) { status_[i] = static_cast(status_[i] | 8); } inline void unsetFlaggedSlack(int i) { status_[i] = static_cast(status_[i] & ~8); } /// Number of sets (dynamic rows) inline int numberSets() const { return numberSets_; } /// Number of possible gub variables inline int numberGubEntries() const { return startSet_[numberSets_];} /// Sets inline int * startSets() const { return startSet_;} /// Whether flagged inline bool flagged(int i) const { return (dynamicStatus_[i] & 8) != 0; } inline void setFlagged(int i) { dynamicStatus_[i] = static_cast(dynamicStatus_[i] | 8); } inline void unsetFlagged(int i) { dynamicStatus_[i] = static_cast(dynamicStatus_[i] & ~8); } inline void setDynamicStatus(int sequence, DynamicStatus status) { unsigned char & st_byte = dynamicStatus_[sequence]; st_byte = static_cast(st_byte & ~7); st_byte = static_cast(st_byte | status); } inline DynamicStatus getDynamicStatus(int sequence) const { return static_cast (dynamicStatus_[sequence] & 7); } /// Saved value of objective offset inline double objectiveOffset() const { return objectiveOffset_; } /// Starts of each column inline CoinBigIndex * startColumn() const { return startColumn_; } /// rows inline int * row() const { return row_; } /// elements inline double * element() const { return element_; } /// costs inline double * cost() const { return cost_; } /// ids of active columns (just index here) inline int * id() const { return id_; } /// Optional lower bounds on columns inline double * columnLower() const { return columnLower_; } /// Optional upper bounds on columns inline double * columnUpper() const { return columnUpper_; } /// Lower bounds on sets inline double * lowerSet() const { return lowerSet_; } /// Upper bounds on sets inline double * upperSet() const { return upperSet_; } /// size inline int numberGubColumns() const { return numberGubColumns_; } /// first free inline int firstAvailable() const { return firstAvailable_; } /// first dynamic inline int firstDynamic() const { return firstDynamic_; } /// number of columns in dynamic model inline int lastDynamic() const { return lastDynamic_; } /// number of rows in original model inline int numberStaticRows() const { return numberStaticRows_; } /// size of working matrix (max) inline int numberElements() const { return numberElements_; } inline int * keyVariable() const { return keyVariable_; } /// Switches off dj checking each factorization (for BIG models) void switchOffCheck(); /// Status region for gub slacks inline unsigned char * gubRowStatus() const { return status_; } /// Status region for gub variables inline unsigned char * dynamicStatus() const { return dynamicStatus_; } /// Returns which set a variable is in int whichSet (int sequence) const; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Sum of dual infeasibilities double sumDualInfeasibilities_; /// Sum of primal infeasibilities double sumPrimalInfeasibilities_; /// Sum of Dual infeasibilities using tolerance based on error in duals double sumOfRelaxedDualInfeasibilities_; /// Sum of Primal infeasibilities using tolerance based on error in primals double sumOfRelaxedPrimalInfeasibilities_; /// Saved best dual on gub row in pricing double savedBestGubDual_; /// Saved best set in pricing int savedBestSet_; /// Backward pointer to pivot row !!! int * backToPivotRow_; /// Key variable of set (only accurate if none in small problem) mutable int * keyVariable_; /// Backward pointer to extra row int * toIndex_; // Reverse pointer from index to set int * fromIndex_; /// Number of sets (dynamic rows) int numberSets_; /// Number of active sets int numberActiveSets_; /// Saved value of objective offset double objectiveOffset_; /// Lower bounds on sets double * lowerSet_; /// Upper bounds on sets double * upperSet_; /// Status of slack on set unsigned char * status_; /// Pointer back to model ClpSimplex * model_; /// first free int firstAvailable_; /// first free when iteration started int firstAvailableBefore_; /// first dynamic int firstDynamic_; /// number of columns in dynamic model int lastDynamic_; /// number of rows in original model int numberStaticRows_; /// size of working matrix (max) int numberElements_; /// Number of dual infeasibilities int numberDualInfeasibilities_; /// Number of primal infeasibilities int numberPrimalInfeasibilities_; /** If pricing will declare victory (i.e. no check every factorization). -1 - always check 0 - don't check 1 - in don't check mode but looks optimal */ int noCheck_; /// Infeasibility weight when last full pass done double infeasibilityWeight_; /// size int numberGubColumns_; /// current maximum number of columns (then compress) int maximumGubColumns_; /// current maximum number of elemnts (then compress) int maximumElements_; /// Start of each set int * startSet_; /// next in chain int * next_; /// Starts of each column CoinBigIndex * startColumn_; /// rows int * row_; /// elements double * element_; /// costs double * cost_; /// ids of active columns (just index here) int * id_; /// for status and which bound unsigned char * dynamicStatus_; /// Optional lower bounds on columns double * columnLower_; /// Optional upper bounds on columns double * columnUpper_; //@} }; #endif CoinMP-1.8.3/Clp/src/Idiot.cpp0000644000175000017500000026602112561142776014417 0ustar renerene/* $Id: Idiot.cpp 2156 2015-08-07 14:51:42Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include #include #include #include "ClpPresolve.hpp" #include "Idiot.hpp" #include "CoinTime.hpp" #include "CoinSort.hpp" #include "CoinFactorization.hpp" #include "CoinMessageHandler.hpp" #include "CoinHelperFunctions.hpp" #include "AbcCommon.hpp" #include "ClpEventHandler.hpp" // Redefine stuff for Clp #ifndef OSI_IDIOT #include "ClpMessage.hpp" #define OsiObjOffset ClpObjOffset #endif /**** strategy 4 - drop, exitDrop and djTolerance all relative: For first two major iterations these are small. Then: drop - exit a major iteration if drop over 5*checkFrequency < this is used as info->drop*(10.0+fabs(last weighted objective)) exitDrop - exit idiot if feasible and drop < this is used as info->exitDrop*(10.0+fabs(last objective)) djExit - exit a major iteration if largest dj (averaged over 5 checks) drops below this - used as info->djTolerance*(10.0+fabs(last weighted objective) djFlag - mostly skip variables with bad dj worse than this => 2*djExit djTol - only look at variables with dj better than this => 0.01*djExit ****************/ #define IDIOT_FIX_TOLERANCE 1e-6 #define SMALL_IDIOT_FIX_TOLERANCE 1e-10 int Idiot::dropping(IdiotResult result, double tolerance, double small, int *nbad) { if (result.infeas <= small) { double value = CoinMax(fabs(result.objval), fabs(result.dropThis)) + 1.0; if (result.dropThis > tolerance * value) { *nbad = 0; return 1; } else { (*nbad)++; if (*nbad > 4) { return 0; } else { return 1; } } } else { *nbad = 0; return 1; } } // Deals with whenUsed and slacks int Idiot::cleanIteration(int iteration, int ordinaryStart, int ordinaryEnd, double * colsol, const double * lower, const double * upper, const double * rowLower, const double * rowUpper, const double * cost, const double * element, double fixTolerance, double & objValue, double & infValue, double & maxInfeasibility) { int n = 0; if ((strategy_ & 16384) == 0) { for (int i = ordinaryStart; i < ordinaryEnd; i++) { if (colsol[i] > lower[i] + fixTolerance) { if (colsol[i] < upper[i] - fixTolerance) { n++; } else { colsol[i] = upper[i]; } whenUsed_[i] = iteration; } else { colsol[i] = lower[i]; } } return n; } else { #ifdef COIN_DEVELOP printf("entering inf %g, obj %g\n", infValue, objValue); #endif int nrows = model_->getNumRows(); int ncols = model_->getNumCols(); int * posSlack = whenUsed_ + ncols; int * negSlack = posSlack + nrows; int * nextSlack = negSlack + nrows; double * rowsol = reinterpret_cast (nextSlack + ncols); memset(rowsol, 0, nrows * sizeof(double)); #ifdef OSI_IDIOT const CoinPackedMatrix * matrix = model_->getMatrixByCol(); #else ClpMatrixBase * matrix = model_->clpMatrix(); #endif const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); //const double * element = matrix->getElements(); int i; objValue = 0.0; infValue = 0.0; maxInfeasibility = 0.0; for ( i = 0; i < ncols; i++) { if (nextSlack[i] == -1) { // not a slack if (colsol[i] > lower[i] + fixTolerance) { if (colsol[i] < upper[i] - fixTolerance) { n++; whenUsed_[i] = iteration; } else { colsol[i] = upper[i]; } whenUsed_[i] = iteration; } else { colsol[i] = lower[i]; } double value = colsol[i]; if (value) { objValue += cost[i] * value; CoinBigIndex j; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int iRow = row[j]; rowsol[iRow] += value * element[j]; } } } } // temp fix for infinite lbs - just limit to -1000 for (i = 0; i < nrows; i++) { double rowSave = rowsol[i]; int iCol; iCol = posSlack[i]; if (iCol >= 0) { // slide all slack down double rowValue = rowsol[i]; CoinBigIndex j = columnStart[iCol]; double lowerValue = CoinMax(CoinMin(colsol[iCol], 0.0) - 1000.0, lower[iCol]); rowSave += (colsol[iCol] - lowerValue) * element[j]; colsol[iCol] = lowerValue; while (nextSlack[iCol] >= 0) { iCol = nextSlack[iCol]; double lowerValue = CoinMax(CoinMin(colsol[iCol], 0.0) - 1000.0, lower[iCol]); j = columnStart[iCol]; rowSave += (colsol[iCol] - lowerValue) * element[j]; colsol[iCol] = lowerValue; } iCol = posSlack[i]; while (rowValue < rowLower[i] && iCol >= 0) { // want to increase double distance = rowLower[i] - rowValue; double value = element[columnStart[iCol]]; double thisCost = cost[iCol]; if (distance <= value*(upper[iCol] - colsol[iCol])) { // can get there double movement = distance / value; objValue += movement * thisCost; rowValue = rowLower[i]; colsol[iCol] += movement; } else { // can't get there double movement = upper[iCol] - colsol[iCol]; objValue += movement * thisCost; rowValue += movement * value; colsol[iCol] = upper[iCol]; iCol = nextSlack[iCol]; } } if (iCol >= 0) { // may want to carry on - because of cost? while (iCol >= 0 && cost[iCol] < 0 && rowValue < rowUpper[i]) { // want to increase double distance = rowUpper[i] - rowValue; double value = element[columnStart[iCol]]; double thisCost = cost[iCol]; if (distance <= value*(upper[iCol] - colsol[iCol])) { // can get there double movement = distance / value; objValue += movement * thisCost; rowValue = rowUpper[i]; colsol[iCol] += movement; iCol = -1; } else { // can't get there double movement = upper[iCol] - colsol[iCol]; objValue += movement * thisCost; rowValue += movement * value; colsol[iCol] = upper[iCol]; iCol = nextSlack[iCol]; } } if (iCol >= 0 && colsol[iCol] > lower[iCol] + fixTolerance && colsol[iCol] < upper[iCol] - fixTolerance) { whenUsed_[i] = iteration; n++; } } rowsol[i] = rowValue; } iCol = negSlack[i]; if (iCol >= 0) { // slide all slack down double rowValue = rowsol[i]; CoinBigIndex j = columnStart[iCol]; double lowerValue = CoinMax(CoinMin(colsol[iCol], 0.0) - 1000.0, lower[iCol]); rowSave += (colsol[iCol] - lowerValue) * element[j]; colsol[iCol] = lowerValue; while (nextSlack[iCol] >= 0) { iCol = nextSlack[iCol]; j = columnStart[iCol]; double lowerValue = CoinMax(CoinMin(colsol[iCol], 0.0) - 1000.0, lower[iCol]); rowSave += (colsol[iCol] - lowerValue) * element[j]; colsol[iCol] = lowerValue; } iCol = negSlack[i]; while (rowValue > rowUpper[i] && iCol >= 0) { // want to increase double distance = -(rowUpper[i] - rowValue); double value = -element[columnStart[iCol]]; double thisCost = cost[iCol]; if (distance <= value*(upper[iCol] - lower[iCol])) { // can get there double movement = distance / value; objValue += movement * thisCost; rowValue = rowUpper[i]; colsol[iCol] += movement; } else { // can't get there double movement = upper[iCol] - lower[iCol]; objValue += movement * thisCost; rowValue -= movement * value; colsol[iCol] = upper[iCol]; iCol = nextSlack[iCol]; } } if (iCol >= 0) { // may want to carry on - because of cost? while (iCol >= 0 && cost[iCol] < 0 && rowValue > rowLower[i]) { // want to increase double distance = -(rowLower[i] - rowValue); double value = -element[columnStart[iCol]]; double thisCost = cost[iCol]; if (distance <= value*(upper[iCol] - colsol[iCol])) { // can get there double movement = distance / value; objValue += movement * thisCost; rowValue = rowLower[i]; colsol[iCol] += movement; iCol = -1; } else { // can't get there double movement = upper[iCol] - colsol[iCol]; objValue += movement * thisCost; rowValue -= movement * value; colsol[iCol] = upper[iCol]; iCol = nextSlack[iCol]; } } if (iCol >= 0 && colsol[iCol] > lower[iCol] + fixTolerance && colsol[iCol] < upper[iCol] - fixTolerance) { whenUsed_[i] = iteration; n++; } } rowsol[i] = rowValue; } double infeasibility = CoinMax(CoinMax(0.0, rowLower[i] - rowsol[i]), rowsol[i] - rowUpper[i]); infValue += infeasibility; maxInfeasibility=CoinMax(maxInfeasibility,infeasibility); // just change rowsol[i] -= rowSave; } return n; } } /* returns -1 if none or start of costed slacks or -2 if there are costed slacks but it is messy */ static int countCostedSlacks(OsiSolverInterface * model) { #ifdef OSI_IDIOT const CoinPackedMatrix * matrix = model->getMatrixByCol(); #else ClpMatrixBase * matrix = model->clpMatrix(); #endif const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * element = matrix->getElements(); const double * rowupper = model->getRowUpper(); int nrows = model->getNumRows(); int ncols = model->getNumCols(); int slackStart = ncols - nrows; int nSlacks = nrows; int i; if (ncols <= nrows) return -1; while (1) { for (i = 0; i < nrows; i++) { int j = i + slackStart; CoinBigIndex k = columnStart[j]; if (columnLength[j] == 1) { if (row[k] != i || element[k] != 1.0) { nSlacks = 0; break; } } else { nSlacks = 0; break; } if (rowupper[i] <= 0.0) { nSlacks = 0; break; } } if (nSlacks || !slackStart) break; slackStart = 0; } if (!nSlacks) slackStart = -1; return slackStart; } void Idiot::crash(int numberPass, CoinMessageHandler * handler, const CoinMessages *messages, bool doCrossover) { // lightweight options int numberColumns = model_->getNumCols(); const double * objective = model_->getObjCoefficients(); int nnzero = 0; double sum = 0.0; int i; for (i = 0; i < numberColumns; i++) { if (objective[i]) { sum += fabs(objective[i]); nnzero++; } } sum /= static_cast (nnzero + 1); if (maxIts_ == 5) maxIts_ = 2; if (numberPass <= 0) majorIterations_ = static_cast(2 + log10(static_cast(numberColumns + 1))); else majorIterations_ = numberPass; // If mu not changed then compute if (mu_ == 1e-4) mu_ = CoinMax(1.0e-3, sum * 1.0e-5); if (maxIts2_ == 100) { if (!lightWeight_) { maxIts2_ = 105; } else if (lightWeight_ == 1) { mu_ *= 1000.0; maxIts2_ = 23; } else if (lightWeight_ == 2) { maxIts2_ = 11; } else { maxIts2_ = 23; } } //printf("setting mu to %g and doing %d passes\n",mu_,majorIterations_); solve2(handler, messages); #ifndef OSI_IDIOT if (doCrossover) { double averageInfeas = model_->sumPrimalInfeasibilities() / static_cast (model_->numberRows()); if ((averageInfeas < 0.01 && (strategy_ & 512) != 0) || (strategy_ & 8192) != 0) crossOver(16 + 1); else crossOver(majorIterations_ < 1000000 ? 3 : 2); } #endif } void Idiot::solve() { CoinMessages dummy; solve2(NULL, &dummy); } void Idiot::solve2(CoinMessageHandler * handler, const CoinMessages * messages) { int strategy = 0; double d2; int i, n; int allOnes = 1; int iteration = 0; int iterationTotal = 0; int nTry = 0; /* number of tries at same weight */ double fixTolerance = IDIOT_FIX_TOLERANCE; int maxBigIts = maxBigIts_; int maxIts = maxIts_; int logLevel = logLevel_; int saveMajorIterations = majorIterations_; majorIterations_ = majorIterations_ % 1000000; if (handler) { if (handler->logLevel() > 0 && handler->logLevel() < 3) logLevel = 1; else if (!handler->logLevel()) logLevel = 0; else logLevel = 7; } double djExit = djTolerance_; double djFlag = 1.0 + 100.0 * djExit; double djTol = 0.00001; double mu = mu_; double drop = drop_; int maxIts2 = maxIts2_; double factor = muFactor_; double smallInfeas = smallInfeas_; double reasonableInfeas = reasonableInfeas_; double stopMu = stopMu_; double maxmin, offset; double lastWeighted = 1.0e50; double exitDrop = exitDrop_; double fakeSmall = smallInfeas; double firstInfeas; int badIts = 0; int slackStart, ordStart, ordEnd; int checkIteration = 0; int lambdaIteration = 0; int belowReasonable = 0; /* set if ever gone below reasonable infeas */ double bestWeighted = 1.0e60; double bestFeasible = 1.0e60; /* best solution while feasible */ IdiotResult result, lastResult; int saveStrategy = strategy_; const int strategies[] = {0, 2, 128}; double saveLambdaScale = 0.0; if ((saveStrategy & 128) != 0) { fixTolerance = SMALL_IDIOT_FIX_TOLERANCE; } #ifdef OSI_IDIOT const CoinPackedMatrix * matrix = model_->getMatrixByCol(); #else ClpMatrixBase * matrix = model_->clpMatrix(); #endif const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * element = matrix->getElements(); int nrows = model_->getNumRows(); int ncols = model_->getNumCols(); double * rowsol, * colsol; double * pi, * dj; #ifndef OSI_IDIOT double * cost = model_->objective(); double * lower = model_->columnLower(); double * upper = model_->columnUpper(); #else double * cost = new double [ncols]; CoinMemcpyN( model_->getObjCoefficients(), ncols, cost); const double * lower = model_->getColLower(); const double * upper = model_->getColUpper(); #endif const double *elemXX; double * saveSol; double * rowupper = new double[nrows]; // not const as modified CoinMemcpyN(model_->getRowUpper(), nrows, rowupper); double * rowlower = new double[nrows]; // not const as modified CoinMemcpyN(model_->getRowLower(), nrows, rowlower); CoinThreadRandom * randomNumberGenerator = model_->randomNumberGenerator(); int * whenUsed; double * lambda; saveSol = new double[ncols]; lambda = new double [nrows]; rowsol = new double[nrows]; colsol = new double [ncols]; CoinMemcpyN(model_->getColSolution(), ncols, colsol); pi = new double[nrows]; dj = new double[ncols]; #ifndef OSI_IDIOT bool fixAfterSome = false; //(model_->specialOptions()&8388608)!=0; int exitAfter = 50; //(model_->specialOptions()&8388608)!=0 ? 50 : 1000000; { int numberColumns = model_->numberColumns(); for (int i=0;isetColumnStatus(i,ClpSimplex::isFixed); } } #endif delete [] whenUsed_; bool oddSlacks = false; // See if any costed slacks int numberSlacks = 0; for (i = 0; i < ncols; i++) { if (columnLength[i] == 1) numberSlacks++; } if (!numberSlacks || (strategy_&524288)!=0) { whenUsed_ = new int[ncols]; } else { #ifdef COIN_DEVELOP printf("%d slacks\n", numberSlacks); #endif oddSlacks = true; int extra = static_cast (nrows * sizeof(double) / sizeof(int)); whenUsed_ = new int[2*ncols+2*nrows+extra]; int * posSlack = whenUsed_ + ncols; int * negSlack = posSlack + nrows; int * nextSlack = negSlack + nrows; for (i = 0; i < nrows; i++) { posSlack[i] = -1; negSlack[i] = -1; } for (i = 0; i < ncols; i++) nextSlack[i] = -1; for (i = 0; i < ncols; i++) { if (columnLength[i] == 1) { CoinBigIndex j = columnStart[i]; int iRow = row[j]; if (element[j] > 0.0) { if (posSlack[iRow] == -1) { posSlack[iRow] = i; } else { int iCol = posSlack[iRow]; while (nextSlack[iCol] >= 0) iCol = nextSlack[iCol]; nextSlack[iCol] = i; } } else { if (negSlack[iRow] == -1) { negSlack[iRow] = i; } else { int iCol = negSlack[iRow]; while (nextSlack[iCol] >= 0) iCol = nextSlack[iCol]; nextSlack[iCol] = i; } } } } // now sort for (i = 0; i < nrows; i++) { int iCol; iCol = posSlack[i]; if (iCol >= 0) { CoinBigIndex j = columnStart[iCol]; #ifndef NDEBUG int iRow = row[j]; #endif assert (element[j] > 0.0); assert (iRow == i); dj[0] = cost[iCol] / element[j]; whenUsed_[0] = iCol; int n = 1; while (nextSlack[iCol] >= 0) { iCol = nextSlack[iCol]; CoinBigIndex j = columnStart[iCol]; #ifndef NDEBUG int iRow = row[j]; #endif assert (element[j] > 0.0); assert (iRow == i); dj[n] = cost[iCol] / element[j]; whenUsed_[n++] = iCol; } for (j = 0; j < n; j++) { int jCol = whenUsed_[j]; nextSlack[jCol] = -2; } CoinSort_2(dj, dj + n, whenUsed_); // put back iCol = whenUsed_[0]; posSlack[i] = iCol; for (j = 1; j < n; j++) { int jCol = whenUsed_[j]; nextSlack[iCol] = jCol; iCol = jCol; } } iCol = negSlack[i]; if (iCol >= 0) { CoinBigIndex j = columnStart[iCol]; #ifndef NDEBUG int iRow = row[j]; #endif assert (element[j] < 0.0); assert (iRow == i); dj[0] = -cost[iCol] / element[j]; whenUsed_[0] = iCol; int n = 1; while (nextSlack[iCol] >= 0) { iCol = nextSlack[iCol]; CoinBigIndex j = columnStart[iCol]; #ifndef NDEBUG int iRow = row[j]; #endif assert (element[j] < 0.0); assert (iRow == i); dj[n] = -cost[iCol] / element[j]; whenUsed_[n++] = iCol; } for (j = 0; j < n; j++) { int jCol = whenUsed_[j]; nextSlack[jCol] = -2; } CoinSort_2(dj, dj + n, whenUsed_); // put back iCol = whenUsed_[0]; negSlack[i] = iCol; for (j = 1; j < n; j++) { int jCol = whenUsed_[j]; nextSlack[iCol] = jCol; iCol = jCol; } } } } whenUsed = whenUsed_; if (model_->getObjSense() == -1.0) { maxmin = -1.0; } else { maxmin = 1.0; } model_->getDblParam(OsiObjOffset, offset); if (!maxIts2) maxIts2 = maxIts; strategy = strategy_; strategy &= 3; memset(lambda, 0, nrows * sizeof(double)); slackStart = countCostedSlacks(model_); // redo in case odd matrix row = matrix->getIndices(); columnStart = matrix->getVectorStarts(); columnLength = matrix->getVectorLengths(); element = matrix->getElements(); if (slackStart >= 0) { COIN_DETAIL_PRINT(printf("This model has costed slacks\n")); if (slackStart) { ordStart = 0; ordEnd = slackStart; } else { ordStart = nrows; ordEnd = ncols; } } else { ordStart = 0; ordEnd = ncols; } if (offset && logLevel > 2) { printf("** Objective offset is %g\n", offset); } /* compute reasonable solution cost */ for (i = 0; i < nrows; i++) { rowsol[i] = 1.0e31; } for (i = 0; i < ncols; i++) { CoinBigIndex j; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { if (element[j] != 1.0) { allOnes = 0; break; } } } if (allOnes) { elemXX = NULL; } else { elemXX = element; } // Do scaling if wanted bool scaled = false; #ifndef OSI_IDIOT if ((strategy_ & 32) != 0 && !allOnes) { if (model_->scalingFlag() > 0) scaled = model_->clpMatrix()->scale(model_) == 0; if (scaled) { #define IDIOT_SCALE 2 #ifndef IDIOT_SCALE const double * rowScale = model_->rowScale(); #else double * rowScale = model_->mutableRowScale(); #endif const double * columnScale = model_->columnScale(); double * oldLower = lower; double * oldUpper = upper; double * oldCost = cost; lower = new double[ncols]; upper = new double[ncols]; cost = new double[ncols]; CoinMemcpyN(oldLower, ncols, lower); CoinMemcpyN(oldUpper, ncols, upper); CoinMemcpyN(oldCost, ncols, cost); int icol, irow; #if IDIOT_SCALE<0 for (irow = 0; irow < nrows; irow++) { rowlower[irow]=1.0e100; rowupper[irow]=1.0e-100; } #endif for (icol = 0; icol < ncols; icol++) { double multiplier = 1.0 / columnScale[icol]; if (lower[icol] > -1.0e50) lower[icol] *= multiplier; if (upper[icol] < 1.0e50) upper[icol] *= multiplier; colsol[icol] *= multiplier; cost[icol] *= columnScale[icol]; #if IDIOT_SCALE<0 CoinBigIndex j; double scale = columnScale[i]; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int jrow = row[j]; double scaledValue = fabs(scale*element[j]); rowlower[jrow]=CoinMin(rowlower[jrow],scaledValue); rowupper[jrow]=CoinMax(rowupper[jrow],scaledValue); } #endif } #ifdef IDIOT_SCALE #if IDIOT_SCALE>1||IDIOT_SCALE<-1 const double * rowLower=model_->rowLower(); const double * rowUpper=model_->rowUpper(); #endif for (irow = 0; irow < nrows; irow++) { #if IDIOT_SCALE<0 double multiplier = 1.0/sqrt(rowlower[irow]*rowupper[irow]); #else double multiplier = rowScale[irow]; #endif #if IDIOT_SCALE>1||IDIOT_SCALE<-1 #define EQUALITY_MULTIPLIER 2 if (rowLower[irow]==rowUpper[irow]) multiplier *= EQUALITY_MULTIPLIER; #if IDIOT_SCALE>2||IDIOT_SCALE<-2 if (rowLower[irow]==rowUpper[irow]&&!rowlower[irow]) multiplier *= EQUALITY_MULTIPLIER; #endif #endif rowScale[irow]=multiplier; } CoinMemcpyN(model_->rowUpper(), nrows, rowupper); #endif CoinMemcpyN(model_->rowLower(), nrows, rowlower); for (irow = 0; irow < nrows; irow++) { double multiplier = rowScale[irow]; if (rowlower[irow] > -1.0e50) rowlower[irow] *= multiplier; if (rowupper[irow] < 1.0e50) rowupper[irow] *= multiplier; rowsol[irow] *= multiplier; } int length = columnStart[ncols-1] + columnLength[ncols-1]; double * elemYY = new double[length]; for (i = 0; i < ncols; i++) { CoinBigIndex j; double scale = columnScale[i]; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int irow = row[j]; elemYY[j] = element[j] * scale * rowScale[irow]; } } elemXX = elemYY; } } #endif if ((strategy_&131072)!=0) { // going to mess with cost if (cost==model_->objective()) cost=CoinCopyOfArray(cost,ncols); } for (i = 0; i < ncols; i++) { CoinBigIndex j; double dd = columnLength[i]; dd = cost[i] / dd; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int irow = row[j]; if (dd < rowsol[irow]) { rowsol[irow] = dd; } } } d2 = 0.0; for (i = 0; i < nrows; i++) { d2 += rowsol[i]; } d2 *= 2.0; /* for luck */ d2 = d2 / static_cast (4 * nrows + 8000); d2 *= 0.5; /* halve with more flexible method */ if (d2 < 5.0) d2 = 5.0; if (djExit == 0.0) { djExit = d2; } if ((saveStrategy & 4) != 0) { /* go to relative tolerances - first small */ djExit = 1.0e-10; djFlag = 1.0e-5; drop = 1.0e-10; } memset(whenUsed, 0, ncols * sizeof(int)); strategy = strategies[strategy]; if ((saveStrategy & 8) != 0) strategy |= 64; /* don't allow large theta */ CoinMemcpyN(colsol, ncols, saveSol); lastResult = IdiSolve(nrows, ncols, rowsol , colsol, pi, dj, cost, rowlower, rowupper, lower, upper, elemXX, row, columnStart, columnLength, lambda, 0, mu, drop, maxmin, offset, strategy, djTol, djExit, djFlag, randomNumberGenerator); // update whenUsed_ double maxInfeasibility=COIN_DBL_MAX; n = cleanIteration(iteration, ordStart, ordEnd, colsol, lower, upper, rowlower, rowupper, cost, elemXX, fixTolerance, lastResult.objval, lastResult.infeas, maxInfeasibility); if ((strategy_ & 16384) != 0) { int * posSlack = whenUsed_ + ncols; int * negSlack = posSlack + nrows; int * nextSlack = negSlack + nrows; double * rowsol2 = reinterpret_cast (nextSlack + ncols); for (i = 0; i < nrows; i++) rowsol[i] += rowsol2[i]; } if ((logLevel_ & 1) != 0) { #ifndef OSI_IDIOT if (!handler) { #endif printf("Iteration %d infeasibility %g, objective %g - mu %g, its %d, %d interior\n", iteration, lastResult.infeas, lastResult.objval, mu, lastResult.iteration, n); #ifndef OSI_IDIOT } else { handler->message(CLP_IDIOT_ITERATION, *messages) << iteration << lastResult.infeas << lastResult.objval << mu << lastResult.iteration << n << CoinMessageEol; } #endif } int numberBaseTrys = 0; // for first time int numberAway = -1; iterationTotal = lastResult.iteration; firstInfeas = lastResult.infeas; if ((strategy_ & 1024) != 0) reasonableInfeas = 0.5 * firstInfeas; if (lastResult.infeas < reasonableInfeas) lastResult.infeas = reasonableInfeas; double keepinfeas = 1.0e31; double lastInfeas = 1.0e31; double bestInfeas = 1.0e31; while ((mu > stopMu && lastResult.infeas > smallInfeas) || (lastResult.infeas <= smallInfeas && dropping(lastResult, exitDrop, smallInfeas, &badIts)) || checkIteration < 2 || lambdaIteration < lambdaIterations_) { if (lastResult.infeas <= exitFeasibility_) break; iteration++; //if (iteration>=exitAfter) //break; checkIteration++; if (lastResult.infeas <= smallInfeas && lastResult.objval < bestFeasible) { bestFeasible = lastResult.objval; } if (lastResult.infeas + mu * lastResult.objval < bestWeighted) { bestWeighted = lastResult.objval + mu * lastResult.objval; } if ((saveStrategy & 4096)) strategy |= 256; if ((saveStrategy & 4) != 0 && iteration > 2) { /* go to relative tolerances */ double weighted = 10.0 + fabs(lastWeighted); djExit = djTolerance_ * weighted; djFlag = 2.0 * djExit; drop = drop_ * weighted; djTol = 0.01 * djExit; } CoinMemcpyN(colsol, ncols, saveSol); result = IdiSolve(nrows, ncols, rowsol , colsol, pi, dj, cost, rowlower, rowupper, lower, upper, elemXX, row, columnStart, columnLength, lambda, maxIts, mu, drop, maxmin, offset, strategy, djTol, djExit, djFlag, randomNumberGenerator); n = cleanIteration(iteration, ordStart, ordEnd, colsol, lower, upper, rowlower, rowupper, cost, elemXX, fixTolerance, result.objval, result.infeas, maxInfeasibility); if ((strategy_ & 16384) != 0) { int * posSlack = whenUsed_ + ncols; int * negSlack = posSlack + nrows; int * nextSlack = negSlack + nrows; double * rowsol2 = reinterpret_cast (nextSlack + ncols); for (i = 0; i < nrows; i++) rowsol[i] += rowsol2[i]; } else { maxInfeasibility=0.0; for (i = 0; i < nrows; i++) { double infeasibility = CoinMax(CoinMax(0.0, rowlower[i] - rowsol[i]), rowsol[i] - rowupper[i]); maxInfeasibility=CoinMax(maxInfeasibility,infeasibility); } } if ((logLevel_ & 1) != 0) { #ifndef OSI_IDIOT if (!handler) { #endif printf("Iteration %d infeasibility %g, objective %g - mu %g, its %d, %d interior\n", iteration, result.infeas, result.objval, mu, result.iteration, n); #ifndef OSI_IDIOT } else { handler->message(CLP_IDIOT_ITERATION, *messages) << iteration << result.infeas << result.objval << mu << result.iteration << n << CoinMessageEol; } #endif } #ifndef OSI_IDIOT if (fixAfterSome) { if (result.infeas<0.01*nrows&&iteration>10&&(3*n>2*nrows||4*n>2*ncols)) { // flag int numberColumns = model_->numberColumns(); printf("Flagging satisfied\n"); fixAfterSome=false; for (int i=0;iupper[i]-1.0e-7|| colsol[i]setColumnStatus(i,ClpSimplex::isFixed); } } } #endif if (iteration > exitAfter ) { if((result.infeas < 1.0e-4 && majorIterations_<200 && n == numberAway)||result.infeas<1.0e-8||maxInfeasibility<1.0e-8) { #ifdef CLP_INVESTIGATE printf("infeas small %g\n", result.infeas); #endif if ((strategy_&131072)==0) { break; // not much happening } else { int n=0; for (int i=0;iupper[i]-1.0e-9) { cost[i]=0.0; model_->setColumnStatus(i,ClpSimplex::isFixed); } else { cost[i]=0.0; double gap = upper[i]-lower[i]; if (colsol[i]>upper[i]-0.25*gap) { cost[i]=gap/(colsol[i]-upper[i]); } else if (colsol[i] 10 && result.infeas > 1.0 && maxIts != 7) { if (lastInfeas != bestInfeas && CoinMin(result.infeas, lastInfeas) > 0.95 * bestInfeas) majorIterations_ = CoinMin(majorIterations_, iteration); // not getting feasible } lastInfeas = result.infeas; numberAway = n; keepinfeas = result.infeas; lastWeighted = result.weighted; iterationTotal += result.iteration; if (iteration == 1) { if ((strategy_ & 1024) != 0 && mu < 1.0e-10) result.infeas = firstInfeas * 0.8; if (majorIterations_ >= 50 || dropEnoughFeasibility_ <= 0.0) result.infeas *= 0.8; if (result.infeas > firstInfeas * 0.9 && result.infeas > reasonableInfeas) { iteration--; if (majorIterations_ < 50) mu *= 1.0e-1; else mu *= 0.7; bestFeasible = 1.0e31; bestWeighted = 1.0e60; numberBaseTrys++; if (mu < 1.0e-30 || (numberBaseTrys > 10 && lightWeight_)) { // back to all slack basis lightWeight_ = 2; break; } CoinMemcpyN(saveSol, ncols, colsol); } else { maxIts = maxIts2; checkIteration = 0; if ((strategy_ & 1024) != 0) mu *= 1.0e-1; } } else { } bestInfeas = CoinMin(bestInfeas, result.infeas); if (majorIterations_>100&&majorIterations_<200) { if (iteration==majorIterations_-100) { // redo double muX=mu*10.0; bestInfeas=1.0e3; mu=muX; nTry=0; } } if (iteration) { /* this code is in to force it to terminate sometime */ double changeMu = factor; if ((saveStrategy & 64) != 0) { keepinfeas = 0.0; /* switch off ranga's increase */ fakeSmall = smallInfeas; } else { fakeSmall = -1.0; } saveLambdaScale = 0.0; if (result.infeas > reasonableInfeas || (nTry + 1 == maxBigIts && result.infeas > fakeSmall)) { if (result.infeas > lastResult.infeas*(1.0 - dropEnoughFeasibility_) || nTry + 1 == maxBigIts || (result.infeas > lastResult.infeas * 0.9 && result.weighted > lastResult.weighted - dropEnoughWeighted_ * CoinMax(fabs(lastResult.weighted), fabs(result.weighted)))) { mu *= changeMu; if ((saveStrategy & 32) != 0 && result.infeas < reasonableInfeas && 0) { reasonableInfeas = CoinMax(smallInfeas, reasonableInfeas * sqrt(changeMu)); COIN_DETAIL_PRINT(printf("reasonable infeas now %g\n", reasonableInfeas)); } result.weighted = 1.0e60; nTry = 0; bestFeasible = 1.0e31; bestWeighted = 1.0e60; checkIteration = 0; lambdaIteration = 0; #define LAMBDA #ifdef LAMBDA if ((saveStrategy & 2048) == 0) { memset(lambda, 0, nrows * sizeof(double)); } #else memset(lambda, 0, nrows * sizeof(double)); #endif } else { nTry++; } } else if (lambdaIterations_ >= 0) { /* update lambda */ double scale = 1.0 / mu; int i, nnz = 0; saveLambdaScale = scale; lambdaIteration++; if ((saveStrategy & 4) == 0) drop = drop_ / 50.0; if (lambdaIteration > 4 && (((lambdaIteration % 10) == 0 && smallInfeas < keepinfeas) || ((lambdaIteration % 5) == 0 && 1.5 * smallInfeas < keepinfeas))) { //printf(" Increasing smallInfeas from %f to %f\n",smallInfeas,1.5*smallInfeas); smallInfeas *= 1.5; } if ((saveStrategy & 2048) == 0) { for (i = 0; i < nrows; i++) { if (lambda[i]) nnz++; lambda[i] += scale * rowsol[i]; } } else { nnz = 1; #ifdef LAMBDA for (i = 0; i < nrows; i++) { lambda[i] += scale * rowsol[i]; } #else for (i = 0; i < nrows; i++) { lambda[i] = scale * rowsol[i]; } for (i = 0; i < ncols; i++) { CoinBigIndex j; double value = cost[i] * maxmin; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int irow = row[j]; value += element[j] * lambda[irow]; } cost[i] = value * maxmin; } for (i = 0; i < nrows; i++) { offset += lambda[i] * rowupper[i]; lambda[i] = 0.0; } #ifdef DEBUG printf("offset %g\n", offset); #endif model_->setDblParam(OsiObjOffset, offset); #endif } nTry++; if (!nnz) { bestFeasible = 1.0e32; bestWeighted = 1.0e60; checkIteration = 0; result.weighted = 1.0e31; } #ifdef DEBUG double trueCost = 0.0; for (i = 0; i < ncols; i++) { int j; trueCost += cost[i] * colsol[i]; } printf("True objective %g\n", trueCost - offset); #endif } else { nTry++; } lastResult = result; if (result.infeas < reasonableInfeas && !belowReasonable) { belowReasonable = 1; bestFeasible = 1.0e32; bestWeighted = 1.0e60; checkIteration = 0; result.weighted = 1.0e31; } } if (iteration >= majorIterations_) { // If not feasible and crash then dive dive dive if (mu > 1.0e-12 && result.infeas > 1.0 && majorIterations_ < 40) { mu = 1.0e-30; majorIterations_ = iteration + 1; stopMu = 0.0; } else { if (logLevel > 2) printf("Exiting due to number of major iterations\n"); break; } } } majorIterations_ = saveMajorIterations; #ifndef OSI_IDIOT if (scaled) { // Scale solution and free arrays const double * rowScale = model_->rowScale(); const double * columnScale = model_->columnScale(); int icol, irow; for (icol = 0; icol < ncols; icol++) { colsol[icol] *= columnScale[icol]; saveSol[icol] *= columnScale[icol]; dj[icol] /= columnScale[icol]; } for (irow = 0; irow < nrows; irow++) { rowsol[irow] /= rowScale[irow]; pi[irow] *= rowScale[irow]; } // Don't know why getting Microsoft problems #if defined (_MSC_VER) delete [] ( double *) elemXX; #else delete [] elemXX; #endif model_->setRowScale(NULL); model_->setColumnScale(NULL); delete [] lower; delete [] upper; delete [] cost; lower = model_->columnLower(); upper = model_->columnUpper(); cost = model_->objective(); //rowlower = model_->rowLower(); } else if (cost != model_->objective()) { delete [] cost; cost = model_->objective(); } #endif #define TRYTHIS #ifdef TRYTHIS if ((saveStrategy & 2048) != 0) { double offset; model_->getDblParam(OsiObjOffset, offset); for (i = 0; i < ncols; i++) { CoinBigIndex j; double djval = cost[i] * maxmin; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int irow = row[j]; djval -= element[j] * lambda[irow]; } cost[i] = djval; } for (i = 0; i < nrows; i++) { offset += lambda[i] * rowupper[i]; } model_->setDblParam(OsiObjOffset, offset); } #endif if (saveLambdaScale) { /* back off last update */ for (i = 0; i < nrows; i++) { lambda[i] -= saveLambdaScale * rowsol[i]; } } muAtExit_ = mu; // For last iteration make as feasible as possible if (oddSlacks) strategy_ |= 16384; // not scaled n = cleanIteration(iteration, ordStart, ordEnd, colsol, lower, upper, model_->rowLower(), model_->rowUpper(), cost, element, fixTolerance, lastResult.objval, lastResult.infeas, maxInfeasibility); #if 0 if ((logLevel & 1) == 0 || (strategy_ & 16384) != 0) { printf( "%d - mu %g, infeasibility %g, objective %g, %d interior\n", iteration, mu, lastResult.infeas, lastResult.objval, n); } #endif #ifndef OSI_IDIOT model_->setSumPrimalInfeasibilities(lastResult.infeas); #endif // Put back more feasible solution double saveInfeas[] = {0.0, 0.0}; for (int iSol = 0; iSol < 3; iSol++) { const double * solution = iSol ? colsol : saveSol; if (iSol == 2 && saveInfeas[0] < saveInfeas[1]) { // put back best solution CoinMemcpyN(saveSol, ncols, colsol); } double large = 0.0; int i; memset(rowsol, 0, nrows * sizeof(double)); for (i = 0; i < ncols; i++) { CoinBigIndex j; double value = solution[i]; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int irow = row[j]; rowsol[irow] += element[j] * value; } } for (i = 0; i < nrows; i++) { if (rowsol[i] > rowupper[i]) { double diff = rowsol[i] - rowupper[i]; if (diff > large) large = diff; } else if (rowsol[i] < rowlower[i]) { double diff = rowlower[i] - rowsol[i]; if (diff > large) large = diff; } } if (iSol < 2) saveInfeas[iSol] = large; if (logLevel > 2) printf("largest infeasibility is %g\n", large); } /* subtract out lambda */ for (i = 0; i < nrows; i++) { pi[i] -= lambda[i]; } for (i = 0; i < ncols; i++) { CoinBigIndex j; double djval = cost[i] * maxmin; for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int irow = row[j]; djval -= element[j] * pi[irow]; } dj[i] = djval; } if ((strategy_ & 1024) != 0) { double ratio = static_cast (ncols) / static_cast (nrows); COIN_DETAIL_PRINT(printf("col/row ratio %g infeas ratio %g\n", ratio, lastResult.infeas / firstInfeas)); if (lastResult.infeas > 0.01 * firstInfeas * ratio) { strategy_ &= (~1024); COIN_DETAIL_PRINT(printf(" - layer off\n")); } else { COIN_DETAIL_PRINT(printf(" - layer on\n")); } } delete [] saveSol; delete [] lambda; // save solution // duals not much use - but save anyway #ifndef OSI_IDIOT CoinMemcpyN(rowsol, nrows, model_->primalRowSolution()); CoinMemcpyN(colsol, ncols, model_->primalColumnSolution()); CoinMemcpyN(pi, nrows, model_->dualRowSolution()); CoinMemcpyN(dj, ncols, model_->dualColumnSolution()); #else model_->setColSolution(colsol); model_->setRowPrice(pi); delete [] cost; #endif delete [] rowsol; delete [] colsol; delete [] pi; delete [] dj; delete [] rowlower; delete [] rowupper; return ; } #ifndef OSI_IDIOT void Idiot::crossOver(int mode) { if (lightWeight_ == 2) { // total failure model_->allSlackBasis(); return; } double fixTolerance = IDIOT_FIX_TOLERANCE; #ifdef COIN_DEVELOP double startTime = CoinCpuTime(); #endif ClpSimplex * saveModel = NULL; ClpMatrixBase * matrix = model_->clpMatrix(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * element = matrix->getElements(); const double * rowupper = model_->getRowUpper(); model_->eventHandler()->event(ClpEventHandler::startOfCrossover); int nrows = model_->getNumRows(); int ncols = model_->getNumCols(); double * rowsol, * colsol; // different for Osi double * lower = model_->columnLower(); double * upper = model_->columnUpper(); const double * rowlower = model_->getRowLower(); int * whenUsed = whenUsed_; rowsol = model_->primalRowSolution(); colsol = model_->primalColumnSolution();; double * cost = model_->objective(); int slackEnd, ordStart, ordEnd; int slackStart = countCostedSlacks(model_); int addAll = mode & 7; int presolve = 0; double djTolerance = djTolerance_; if (djTolerance > 0.0 && djTolerance < 1.0) djTolerance = 1.0; int iteration; int i, n = 0; double ratio = 1.0; double objValue = 0.0; if ((strategy_ & 128) != 0) { fixTolerance = SMALL_IDIOT_FIX_TOLERANCE; } if ((mode & 16) != 0 && addAll < 3) presolve = 1; double * saveUpper = NULL; double * saveLower = NULL; double * saveRowUpper = NULL; double * saveRowLower = NULL; bool allowInfeasible = ((strategy_ & 8192) != 0) || (majorIterations_ > 1000000); if (addAll < 3) { saveUpper = new double [ncols]; saveLower = new double [ncols]; CoinMemcpyN(upper, ncols, saveUpper); CoinMemcpyN(lower, ncols, saveLower); if (allowInfeasible) { saveRowUpper = new double [nrows]; saveRowLower = new double [nrows]; CoinMemcpyN(rowupper, nrows, saveRowUpper); CoinMemcpyN(rowlower, nrows, saveRowLower); double averageInfeas = model_->sumPrimalInfeasibilities() / static_cast (model_->numberRows()); fixTolerance = CoinMax(fixTolerance, 1.0e-5 * averageInfeas); } } if (slackStart >= 0) { slackEnd = slackStart + nrows; if (slackStart) { ordStart = 0; ordEnd = slackStart; } else { ordStart = nrows; ordEnd = ncols; } } else { slackEnd = slackStart; ordStart = 0; ordEnd = ncols; } /* get correct rowsol (without known slacks) */ memset(rowsol, 0, nrows * sizeof(double)); for (i = ordStart; i < ordEnd; i++) { CoinBigIndex j; double value = colsol[i]; if (value < lower[i] + fixTolerance) { value = lower[i]; colsol[i] = value; } for (j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { int irow = row[j]; rowsol[irow] += value * element[j]; } } if (slackStart >= 0) { for (i = 0; i < nrows; i++) { if (ratio * rowsol[i] > rowlower[i] && rowsol[i] > 1.0e-8) { ratio = rowlower[i] / rowsol[i]; } } for (i = 0; i < nrows; i++) { rowsol[i] *= ratio; } for (i = ordStart; i < ordEnd; i++) { double value = colsol[i] * ratio; colsol[i] = value; objValue += value * cost[i]; } for (i = 0; i < nrows; i++) { double value = rowlower[i] - rowsol[i]; colsol[i+slackStart] = value; objValue += value * cost[i+slackStart]; } COIN_DETAIL_PRINT(printf("New objective after scaling %g\n", objValue)); } #if 0 //maybe put back - but just get feasible ? // If not many fixed then just exit int numberFixed = 0; for (i = ordStart; i < ordEnd; i++) { if (colsol[i] < lower[i] + fixTolerance) numberFixed++; else if (colsol[i] > upper[i] - fixTolerance) numberFixed++; } if (numberFixed < ncols / 3) { addAll = 3; presolve = 0; } #endif #define FEB_TRY #ifdef FEB_TRY int savePerturbation = model_->perturbation(); int saveOptions = model_->specialOptions(); model_->setSpecialOptions(saveOptions | 8192); //if (savePerturbation_ == 50) // model_->setPerturbation(56); #endif model_->createStatus(); /* addAll 0 - chosen,all used, all 1 - chosen, all 2 - all 3 - do not do anything - maybe basis */ for (i = ordStart; i < ordEnd; i++) { if (addAll < 2) { if (colsol[i] < lower[i] + fixTolerance) { upper[i] = lower[i]; colsol[i] = lower[i]; } else if (colsol[i] > upper[i] - fixTolerance) { lower[i] = upper[i]; colsol[i] = upper[i]; } } model_->setColumnStatus(i, ClpSimplex::superBasic); } if ((strategy_ & 16384) != 0) { // put in basis int * posSlack = whenUsed_ + ncols; int * negSlack = posSlack + nrows; int * nextSlack = negSlack + nrows; /* Laci - try both ways - to see what works - you can change second part as much as you want */ #ifndef LACI_TRY // was #if 1 // Array for sorting out slack values double * ratio = new double [ncols]; int * which = new int [ncols]; for (i = 0; i < nrows; i++) { if (posSlack[i] >= 0 || negSlack[i] >= 0) { int iCol; int nPlus = 0; int nMinus = 0; bool possible = true; // Get sum double sum = 0.0; iCol = posSlack[i]; while (iCol >= 0) { double value = element[columnStart[iCol]]; sum += value * colsol[iCol]; if (lower[iCol]) { possible = false; break; } else { nPlus++; } iCol = nextSlack[iCol]; } iCol = negSlack[i]; while (iCol >= 0) { double value = -element[columnStart[iCol]]; sum -= value * colsol[iCol]; if (lower[iCol]) { possible = false; break; } else { nMinus++; } iCol = nextSlack[iCol]; } //printf("%d plus, %d minus",nPlus,nMinus); //printf("\n"); if ((rowsol[i] - rowlower[i] < 1.0e-7 || rowupper[i] - rowsol[i] < 1.0e-7) && nPlus + nMinus < 2) possible = false; if (possible) { // Amount contributed by other varaibles sum = rowsol[i] - sum; double lo = rowlower[i]; if (lo > -1.0e20) lo -= sum; double up = rowupper[i]; if (up < 1.0e20) up -= sum; //printf("row bounds %g %g\n",lo,up); if (0) { double sum = 0.0; double x = 0.0; for (int k = 0; k < ncols; k++) { CoinBigIndex j; double value = colsol[k]; x += value * cost[k]; for (j = columnStart[k]; j < columnStart[k] + columnLength[k]; j++) { int irow = row[j]; if (irow == i) sum += element[j] * value; } } printf("Before sum %g <= %g <= %g cost %.18g\n", rowlower[i], sum, rowupper[i], x); } // set all to zero iCol = posSlack[i]; while (iCol >= 0) { colsol[iCol] = 0.0; iCol = nextSlack[iCol]; } iCol = negSlack[i]; while (iCol >= 0) { colsol[iCol] = 0.0; iCol = nextSlack[iCol]; } { int iCol; iCol = posSlack[i]; while (iCol >= 0) { //printf("col %d el %g sol %g bounds %g %g cost %g\n", // iCol,element[columnStart[iCol]], // colsol[iCol],lower[iCol],upper[iCol],cost[iCol]); iCol = nextSlack[iCol]; } iCol = negSlack[i]; while (iCol >= 0) { //printf("col %d el %g sol %g bounds %g %g cost %g\n", // iCol,element[columnStart[iCol]], // colsol[iCol],lower[iCol],upper[iCol],cost[iCol]); iCol = nextSlack[iCol]; } } //printf("now what?\n"); int n = 0; bool basic = false; if (lo > 0.0) { // Add in positive iCol = posSlack[i]; while (iCol >= 0) { double value = element[columnStart[iCol]]; ratio[n] = cost[iCol] / value; which[n++] = iCol; iCol = nextSlack[iCol]; } CoinSort_2(ratio, ratio + n, which); for (int i = 0; i < n; i++) { iCol = which[i]; double value = element[columnStart[iCol]]; if (lo >= upper[iCol]*value) { value *= upper[iCol]; sum += value; lo -= value; colsol[iCol] = upper[iCol]; } else { value = lo / value; sum += lo; lo = 0.0; colsol[iCol] = value; model_->setColumnStatus(iCol, ClpSimplex::basic); basic = true; } if (lo < 1.0e-7) break; } } else if (up < 0.0) { // Use lo so coding is more similar lo = -up; // Add in negative iCol = negSlack[i]; while (iCol >= 0) { double value = -element[columnStart[iCol]]; ratio[n] = cost[iCol] / value; which[n++] = iCol; iCol = nextSlack[iCol]; } CoinSort_2(ratio, ratio + n, which); for (int i = 0; i < n; i++) { iCol = which[i]; double value = -element[columnStart[iCol]]; if (lo >= upper[iCol]*value) { value *= upper[iCol]; sum += value; lo -= value; colsol[iCol] = upper[iCol]; } else { value = lo / value; sum += lo; lo = 0.0; colsol[iCol] = value; model_->setColumnStatus(iCol, ClpSimplex::basic); basic = true; } if (lo < 1.0e-7) break; } } if (0) { double sum2 = 0.0; double x = 0.0; for (int k = 0; k < ncols; k++) { CoinBigIndex j; double value = colsol[k]; x += value * cost[k]; for (j = columnStart[k]; j < columnStart[k] + columnLength[k]; j++) { int irow = row[j]; if (irow == i) sum2 += element[j] * value; } } printf("after sum %g <= %g <= %g cost %.18g (sum = %g)\n", rowlower[i], sum2, rowupper[i], x, sum); } rowsol[i] = sum; if (basic) { if (fabs(rowsol[i] - rowlower[i]) < fabs(rowsol[i] - rowupper[i])) model_->setRowStatus(i, ClpSimplex::atLowerBound); else model_->setRowStatus(i, ClpSimplex::atUpperBound); } } else { int n = 0; int iCol; iCol = posSlack[i]; while (iCol >= 0) { if (colsol[iCol] > lower[iCol] + 1.0e-8 && colsol[iCol] < upper[iCol] - 1.0e-8) { model_->setColumnStatus(iCol, ClpSimplex::basic); n++; } iCol = nextSlack[iCol]; } iCol = negSlack[i]; while (iCol >= 0) { if (colsol[iCol] > lower[iCol] + 1.0e-8 && colsol[iCol] < upper[iCol] - 1.0e-8) { model_->setColumnStatus(iCol, ClpSimplex::basic); n++; } iCol = nextSlack[iCol]; } if (n) { if (fabs(rowsol[i] - rowlower[i]) < fabs(rowsol[i] - rowupper[i])) model_->setRowStatus(i, ClpSimplex::atLowerBound); else model_->setRowStatus(i, ClpSimplex::atUpperBound); #ifdef CLP_INVESTIGATE if (n > 1) printf("%d basic on row %d!\n", n, i); #endif } } } } delete [] ratio; delete [] which; #else for (i = 0; i < nrows; i++) { int n = 0; int iCol; iCol = posSlack[i]; while (iCol >= 0) { if (colsol[iCol] > lower[iCol] + 1.0e-8 && colsol[iCol] < upper[iCol] - 1.0e-8) { model_->setColumnStatus(iCol, ClpSimplex::basic); n++; } iCol = nextSlack[iCol]; } iCol = negSlack[i]; while (iCol >= 0) { if (colsol[iCol] > lower[iCol] + 1.0e-8 && colsol[iCol] < upper[iCol] - 1.0e-8) { model_->setColumnStatus(iCol, ClpSimplex::basic); n++; } iCol = nextSlack[iCol]; } if (n) { if (fabs(rowsol[i] - rowlower[i]) < fabs(rowsol[i] - rowupper[i])) model_->setRowStatus(i, ClpSimplex::atLowerBound); else model_->setRowStatus(i, ClpSimplex::atUpperBound); #ifdef CLP_INVESTIGATE if (n > 1) printf("%d basic on row %d!\n", n, i); #endif } } #endif } double maxmin; if (model_->getObjSense() == -1.0) { maxmin = -1.0; } else { maxmin = 1.0; } bool justValuesPass = majorIterations_ > 1000000; if (slackStart >= 0) { for (i = 0; i < nrows; i++) { model_->setRowStatus(i, ClpSimplex::superBasic); } for (i = slackStart; i < slackEnd; i++) { model_->setColumnStatus(i, ClpSimplex::basic); } } else { /* still try and put singletons rather than artificials in basis */ for (i = 0; i < nrows; i++) { model_->setRowStatus(i, ClpSimplex::basic); } int ninbas = 0; for (i = 0; i < ncols; i++) { if (columnLength[i] == 1 && upper[i] > lower[i] + 1.0e-5) { CoinBigIndex j = columnStart[i]; double value = element[j]; int irow = row[j]; double rlo = rowlower[irow]; double rup = rowupper[irow]; double clo = lower[i]; double cup = upper[i]; double csol = colsol[i]; /* adjust towards feasibility */ double move = 0.0; if (rowsol[irow] > rup) { move = (rup - rowsol[irow]) / value; if (value > 0.0) { /* reduce */ if (csol + move < clo) move = CoinMin(0.0, clo - csol); } else { /* increase */ if (csol + move > cup) move = CoinMax(0.0, cup - csol); } } else if (rowsol[irow] < rlo) { move = (rlo - rowsol[irow]) / value; if (value > 0.0) { /* increase */ if (csol + move > cup) move = CoinMax(0.0, cup - csol); } else { /* reduce */ if (csol + move < clo) move = CoinMin(0.0, clo - csol); } } else { /* move to improve objective */ if (cost[i]*maxmin > 0.0) { if (value > 0.0) { move = (rlo - rowsol[irow]) / value; /* reduce */ if (csol + move < clo) move = CoinMin(0.0, clo - csol); } else { move = (rup - rowsol[irow]) / value; /* increase */ if (csol + move > cup) move = CoinMax(0.0, cup - csol); } } else if (cost[i]*maxmin < 0.0) { if (value > 0.0) { move = (rup - rowsol[irow]) / value; /* increase */ if (csol + move > cup) move = CoinMax(0.0, cup - csol); } else { move = (rlo - rowsol[irow]) / value; /* reduce */ if (csol + move < clo) move = CoinMin(0.0, clo - csol); } } } rowsol[irow] += move * value; colsol[i] += move; /* put in basis if row was artificial */ if (rup - rlo < 1.0e-7 && model_->getRowStatus(irow) == ClpSimplex::basic) { model_->setRowStatus(irow, ClpSimplex::superBasic); model_->setColumnStatus(i, ClpSimplex::basic); ninbas++; } } } /*printf("%d in basis\n",ninbas);*/ } bool wantVector = false; if (dynamic_cast< ClpPackedMatrix*>(model_->clpMatrix())) { // See if original wanted vector ClpPackedMatrix * clpMatrixO = dynamic_cast< ClpPackedMatrix*>(model_->clpMatrix()); wantVector = clpMatrixO->wantsSpecialColumnCopy(); } if ((strategy_&262144)!=0) { //justValuesPass=true; assert (addAll<3); assert (presolve); //allowInfeasible=true; } if ((strategy_&32768)!=0) allowInfeasible=true; if ((strategy_&65536)!=0) justValuesPass=true; //double * saveBounds=NULL; if (addAll < 3) { ClpPresolve pinfo; if (presolve) { double * rhs = new double[nrows]; double * saveBounds=new double[2*ncols]; char line[200]; memcpy(saveBounds,lower,ncols*sizeof(double)); memcpy(saveBounds+ncols,upper,ncols*sizeof(double)); if (allowInfeasible) { // fix up so will be feasible const double * dual = model_->dualRowSolution(); for (i = 0; i < nrows; i++) rhs[i]=fabs(dual[i]); std::sort(rhs,rhs+nrows); int nSmall=nrows; int nMedium=nrows; double largest=rhs[nrows-1]; double small=CoinMax(1.0e-4,1.0e-5*largest); small = CoinMin(small,1.0e-2); double medium=small*100.0; double * rowupper = model_->rowUpper(); double * rowlower = model_->rowLower(); // if tiny then drop row?? for (i = 0; i < nrows; i++) { if (rhs[i]>=small) { nSmall=i-1; break; } } for (; i < nrows; i++) { if (rhs[i]>=medium) { nMedium=i-1; break; } } printf("%d < %g, %d < %g, %d <= %g\n", nSmall,small,nMedium-nSmall,medium,nrows-nMedium,largest); memset(rhs, 0, nrows * sizeof(double)); int nFixed=0; for (i = 0; i < ncols; i++) { if (colsol[i]upper[i]-1.0e-8) { lower[i]=upper[i]; colsol[i]=lower[i]; nFixed++; } } model_->clpMatrix()->times(1.0, colsol, rhs); saveRowUpper = CoinCopyOfArray(rowupper, nrows); saveRowLower = CoinCopyOfArray(rowlower, nrows); double sum = 0.0; for (i = 0; i < nrows; i++) { if (rhs[i] > rowupper[i]) { sum += rhs[i] - rowupper[i]; } if (rhs[i] < rowlower[i]) { sum += rowlower[i] - rhs[i]; } } double averageInfeasibility=sum/nrows; double check=CoinMin(1.0e-3,0.1*averageInfeasibility); int nFixedRows=0; int nFreed=0; #define MESS_UP 0 for (i = 0; i < nrows; i++) { if (rowupper[i]>rowlower[i]+check) { // look at distance and sign of dual if (dual[i]<-medium&&rowupper[i]-rhs[i]medium&&rhs[i]-rowlower[i]check&& rowupper[i]-rhs[i]>check) { nFreed++; #if MESS_UP ==1 || MESS_UP ==2 rowupper[i]=COIN_DBL_MAX; rowlower[i]=-COIN_DBL_MAX; #endif } } if (rhs[i] > rowupper[i]) { rowupper[i] = rhs[i]; // maybe make equality #if MESS_UP ==2 || MESS_UP ==3 rowlower[i] = rhs[i]; #endif } if (rhs[i] < rowlower[i]) { rowlower[i] = rhs[i]; // maybe make equality #if MESS_UP ==2 || MESS_UP ==3 rowupper[i] = rhs[i]; #endif } } sprintf(line,"sum of infeasibilities %g - %d fixed rows, %d fixed columns - might free %d rows", sum,nFixedRows,nFixed,nFreed); } else { memset(rhs, 0, nrows * sizeof(double)); int nFixed=0; for (i = 0; i < ncols; i++) { if (colsol[i]upper[i]-1.0e-8) { lower[i]=upper[i]; colsol[i]=lower[i]; nFixed++; } } model_->clpMatrix()->times(1.0, colsol, rhs); double sum = 0.0; for (i = 0; i < nrows; i++) { if (rhs[i] > rowupper[i]) { sum += rhs[i] - rowupper[i]; } if (rhs[i] < rowlower[i]) { sum += rowlower[i] - rhs[i]; } } double averageInfeasibility=sum/nrows; sprintf(line,"sum of infeasibilities %g - average %g, %d fixed columns", sum,averageInfeasibility,nFixed); } const CoinMessages * messages = model_->messagesPointer(); model_->messageHandler()->message(CLP_GENERAL, *messages) << line << CoinMessageEol; delete [] rhs; saveModel = model_; pinfo.setPresolveActions(pinfo.presolveActions() | 16384); model_ = pinfo.presolvedModel(*model_, 1.0e-8, false, 5); if (saveBounds) { memcpy(saveModel->columnLower(),saveBounds,ncols*sizeof(double)); memcpy(saveModel->columnUpper(),saveBounds+ncols,ncols*sizeof(double)); delete [] saveBounds; } if (model_&&(strategy_&262144)!=0) { int nrows = model_->getNumRows(); int ncols = model_->getNumCols(); double * lower = model_->columnLower(); double * upper = model_->columnUpper(); const double * rowlower = model_->getRowLower(); const double * rowupper = model_->getRowUpper(); double * rowsol = model_->primalRowSolution(); double * colsol = model_->primalColumnSolution();; int ninbas = 0; int * which = new int[2*ncols+nrows]; double * dj = model_->dualColumnSolution(); for (int i=0;imatrix(); while (status) { status=factor.factorize(*matrix,rowIsBasic,columnIsBasic,areaFactor); if (status==-99) { // put all slacks in for (int i=0;i=0) rowIsBasic[iRow]=-1; // out } } } delete [] which; for (int i = 0; i < nrows; i++) { if (rowIsBasic[i]>=0) { model_->setRowStatus(i, ClpSimplex::basic); } else if (rowlower[i]==rowupper[i]) { model_->setRowStatus(i, ClpSimplex::isFixed); } else if (rowsol[i]-rowlower[i]setRowStatus(i, ClpSimplex::atLowerBound); } else { model_->setRowStatus(i, ClpSimplex::atUpperBound); } } for (int i=0;iupper[i]-1.0e-7|| colsol[i]setColumnStatus(i,ClpSimplex::isFixed); } else if (columnIsBasic[i]>=0) { model_->setColumnStatus(i,ClpSimplex::basic); } else { model_->setColumnStatus(i,ClpSimplex::superBasic); } } } } if (model_) { // See if we want to go all way int oldSize=2*saveModel->numberRows()+saveModel->numberColumns(); int newSize=2*model_->numberRows()+model_->numberColumns(); if (oldSize*2>newSize*3) justValuesPass=false; if (!wantVector) { //#define TWO_GOES #ifdef ABC_INHERIT #ifndef TWO_GOES model_->dealWithAbc(1,justValuesPass ? 3 : 1); #else model_->dealWithAbc(1,1 + 11); #endif #else #ifndef TWO_GOES model_->primal(justValuesPass ? 2 : 1); #else model_->primal(1 + 11); #endif #endif } else { ClpMatrixBase * matrix = model_->clpMatrix(); ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); assert (clpMatrix); clpMatrix->makeSpecialColumnCopy(); #ifdef ABC_INHERIT model_->dealWithAbc(1,1); #else model_->primal(1); #endif clpMatrix->releaseSpecialColumnCopy(); } if (presolve) { if (!justValuesPass) model_->primal(1); pinfo.postsolve(true); delete model_; model_ = saveModel; saveModel = NULL; } } else { // not feasible addAll = 1; presolve = 0; model_ = saveModel; saveModel = NULL; if (justValuesPass) #ifdef ABC_INHERIT model_->dealWithAbc(1,3); #else model_->primal(2); #endif } if (allowInfeasible) { CoinMemcpyN(saveRowUpper, nrows, model_->rowUpper()); CoinMemcpyN(saveRowLower, nrows, model_->rowLower()); delete [] saveRowUpper; delete [] saveRowLower; saveRowUpper = NULL; saveRowLower = NULL; } if (addAll < 2) { n = 0; if (!addAll ) { /* could do scans to get a good number */ iteration = 1; for (i = ordStart; i < ordEnd; i++) { if (whenUsed[i] >= iteration) { if (upper[i] - lower[i] < 1.0e-5 && saveUpper[i] - saveLower[i] > 1.0e-5) { n++; upper[i] = saveUpper[i]; lower[i] = saveLower[i]; } } } } else { for (i = ordStart; i < ordEnd; i++) { if (upper[i] - lower[i] < 1.0e-5 && saveUpper[i] - saveLower[i] > 1.0e-5) { n++; upper[i] = saveUpper[i]; lower[i] = saveLower[i]; } } delete [] saveUpper; delete [] saveLower; saveUpper = NULL; saveLower = NULL; } #ifdef COIN_DEVELOP printf("Time so far %g, %d now added from previous iterations\n", CoinCpuTime() - startTime, n); #endif if (justValuesPass) return; if (addAll) presolve = 0; if (presolve) { saveModel = model_; model_ = pinfo.presolvedModel(*model_, 1.0e-8, false, 5); } else { presolve = 0; } if (!wantVector) { #ifdef ABC_INHERIT model_->dealWithAbc(1,1); #else model_->primal(1); #endif } else { ClpMatrixBase * matrix = model_->clpMatrix(); ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); assert (clpMatrix); clpMatrix->makeSpecialColumnCopy(); #ifdef ABC_INHERIT model_->dealWithAbc(1,1); #else model_->primal(1); #endif clpMatrix->releaseSpecialColumnCopy(); } if (presolve) { pinfo.postsolve(true); delete model_; model_ = saveModel; saveModel = NULL; } if (!addAll) { n = 0; for (i = ordStart; i < ordEnd; i++) { if (upper[i] - lower[i] < 1.0e-5 && saveUpper[i] - saveLower[i] > 1.0e-5) { n++; upper[i] = saveUpper[i]; lower[i] = saveLower[i]; } } delete [] saveUpper; delete [] saveLower; saveUpper = NULL; saveLower = NULL; #ifdef COIN_DEVELOP printf("Time so far %g, %d now added from previous iterations\n", CoinCpuTime() - startTime, n); #endif } if (presolve) { saveModel = model_; model_ = pinfo.presolvedModel(*model_, 1.0e-8, false, 5); } else { presolve = 0; } if (!wantVector) { #ifdef ABC_INHERIT model_->dealWithAbc(1,1); #else model_->primal(1); #endif } else { ClpMatrixBase * matrix = model_->clpMatrix(); ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); assert (clpMatrix); clpMatrix->makeSpecialColumnCopy(); #ifdef ABC_INHERIT model_->dealWithAbc(1,1); #else model_->primal(1); #endif clpMatrix->releaseSpecialColumnCopy(); } if (presolve) { pinfo.postsolve(true); delete model_; model_ = saveModel; saveModel = NULL; } } #ifdef COIN_DEVELOP printf("Total time in crossover %g\n", CoinCpuTime() - startTime); #endif delete [] saveUpper; delete [] saveLower; } #ifdef FEB_TRY model_->setSpecialOptions(saveOptions); model_->setPerturbation(savePerturbation); #endif return ; } #endif /*****************************************************************************/ // Default contructor Idiot::Idiot() { model_ = NULL; maxBigIts_ = 3; maxIts_ = 5; logLevel_ = 1; logFreq_ = 100; maxIts2_ = 100; djTolerance_ = 1e-1; mu_ = 1e-4; drop_ = 5.0; exitDrop_ = -1.0e20; muFactor_ = 0.3333; stopMu_ = 1e-12; smallInfeas_ = 1e-1; reasonableInfeas_ = 1e2; muAtExit_ = 1.0e31; strategy_ = 8; lambdaIterations_ = 0; checkFrequency_ = 100; whenUsed_ = NULL; majorIterations_ = 30; exitFeasibility_ = -1.0; dropEnoughFeasibility_ = 0.02; dropEnoughWeighted_ = 0.01; // adjust double nrows = 10000.0; int baseIts = static_cast (sqrt(static_cast(nrows))); baseIts = baseIts / 10; baseIts *= 10; maxIts2_ = 200 + baseIts + 5; maxIts2_ = 100; reasonableInfeas_ = static_cast (nrows) * 0.05; lightWeight_ = 0; } // Constructor from model Idiot::Idiot(OsiSolverInterface &model) { model_ = & model; maxBigIts_ = 3; maxIts_ = 5; logLevel_ = 1; logFreq_ = 100; maxIts2_ = 100; djTolerance_ = 1e-1; mu_ = 1e-4; drop_ = 5.0; exitDrop_ = -1.0e20; muFactor_ = 0.3333; stopMu_ = 1e-12; smallInfeas_ = 1e-1; reasonableInfeas_ = 1e2; muAtExit_ = 1.0e31; strategy_ = 8; lambdaIterations_ = 0; checkFrequency_ = 100; whenUsed_ = NULL; majorIterations_ = 30; exitFeasibility_ = -1.0; dropEnoughFeasibility_ = 0.02; dropEnoughWeighted_ = 0.01; // adjust double nrows; if (model_) nrows = model_->getNumRows(); else nrows = 10000.0; int baseIts = static_cast (sqrt(static_cast(nrows))); baseIts = baseIts / 10; baseIts *= 10; maxIts2_ = 200 + baseIts + 5; maxIts2_ = 100; reasonableInfeas_ = static_cast (nrows) * 0.05; lightWeight_ = 0; } // Copy constructor. Idiot::Idiot(const Idiot &rhs) { model_ = rhs.model_; if (model_ && rhs.whenUsed_) { int numberColumns = model_->getNumCols(); whenUsed_ = new int [numberColumns]; CoinMemcpyN(rhs.whenUsed_, numberColumns, whenUsed_); } else { whenUsed_ = NULL; } djTolerance_ = rhs.djTolerance_; mu_ = rhs.mu_; drop_ = rhs.drop_; muFactor_ = rhs.muFactor_; stopMu_ = rhs.stopMu_; smallInfeas_ = rhs.smallInfeas_; reasonableInfeas_ = rhs.reasonableInfeas_; exitDrop_ = rhs.exitDrop_; muAtExit_ = rhs.muAtExit_; exitFeasibility_ = rhs.exitFeasibility_; dropEnoughFeasibility_ = rhs.dropEnoughFeasibility_; dropEnoughWeighted_ = rhs.dropEnoughWeighted_; maxBigIts_ = rhs.maxBigIts_; maxIts_ = rhs.maxIts_; majorIterations_ = rhs.majorIterations_; logLevel_ = rhs.logLevel_; logFreq_ = rhs.logFreq_; checkFrequency_ = rhs.checkFrequency_; lambdaIterations_ = rhs.lambdaIterations_; maxIts2_ = rhs.maxIts2_; strategy_ = rhs.strategy_; lightWeight_ = rhs.lightWeight_; } // Assignment operator. This copies the data Idiot & Idiot::operator=(const Idiot & rhs) { if (this != &rhs) { delete [] whenUsed_; model_ = rhs.model_; if (model_ && rhs.whenUsed_) { int numberColumns = model_->getNumCols(); whenUsed_ = new int [numberColumns]; CoinMemcpyN(rhs.whenUsed_, numberColumns, whenUsed_); } else { whenUsed_ = NULL; } djTolerance_ = rhs.djTolerance_; mu_ = rhs.mu_; drop_ = rhs.drop_; muFactor_ = rhs.muFactor_; stopMu_ = rhs.stopMu_; smallInfeas_ = rhs.smallInfeas_; reasonableInfeas_ = rhs.reasonableInfeas_; exitDrop_ = rhs.exitDrop_; muAtExit_ = rhs.muAtExit_; exitFeasibility_ = rhs.exitFeasibility_; dropEnoughFeasibility_ = rhs.dropEnoughFeasibility_; dropEnoughWeighted_ = rhs.dropEnoughWeighted_; maxBigIts_ = rhs.maxBigIts_; maxIts_ = rhs.maxIts_; majorIterations_ = rhs.majorIterations_; logLevel_ = rhs.logLevel_; logFreq_ = rhs.logFreq_; checkFrequency_ = rhs.checkFrequency_; lambdaIterations_ = rhs.lambdaIterations_; maxIts2_ = rhs.maxIts2_; strategy_ = rhs.strategy_; lightWeight_ = rhs.lightWeight_; } return *this; } Idiot::~Idiot() { delete [] whenUsed_; } CoinMP-1.8.3/Clp/src/ClpSolve.cpp0000644000175000017500000111500512455700177015067 0ustar renerene/* $Id: ClpSolve.cpp 2086 2015-01-15 08:55:27Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). // This file has higher level solve functions #include "CoinPragma.hpp" #include "ClpConfig.h" // check already here if COIN_HAS_GLPK is defined, since we do not want to get confused by a COIN_HAS_GLPK in config_coinutils.h #if defined(COIN_HAS_AMD) || defined(COIN_HAS_CHOLMOD) || defined(COIN_HAS_GLPK) #define UFL_BARRIER #endif #include #ifdef _MSC_VER #include // for Sleep() #ifdef small #undef small #endif #else #include // for usleep() #endif #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" #include "CoinSort.hpp" #include "ClpFactorization.hpp" #include "ClpSimplex.hpp" #include "ClpSimplexOther.hpp" #include "ClpSimplexDual.hpp" #ifndef SLIM_CLP #include "ClpQuadraticObjective.hpp" #include "ClpInterior.hpp" #include "ClpCholeskyDense.hpp" #include "ClpCholeskyBase.hpp" #include "ClpPlusMinusOneMatrix.hpp" #include "ClpNetworkMatrix.hpp" #endif #include "ClpEventHandler.hpp" #include "ClpLinearObjective.hpp" #include "ClpSolve.hpp" #include "ClpPackedMatrix.hpp" #include "ClpMessage.hpp" #include "CoinTime.hpp" #if CLP_HAS_ABC #include "CoinAbcCommon.hpp" #endif #ifdef ABC_INHERIT #include "AbcSimplex.hpp" #include "AbcSimplexFactorization.hpp" #endif #include "CoinStructuredModel.hpp" double zz_slack_value=0.0; #ifdef CLP_USEFUL_PRINTOUT double debugDouble[10]; int debugInt[24]; #endif #include "ClpPresolve.hpp" #ifndef SLIM_CLP #include "Idiot.hpp" #ifdef COIN_HAS_WSMP #include "ClpCholeskyWssmp.hpp" #include "ClpCholeskyWssmpKKT.hpp" #endif #include "ClpCholeskyUfl.hpp" #ifdef TAUCS_BARRIER #include "ClpCholeskyTaucs.hpp" #endif #include "ClpCholeskyMumps.hpp" #ifdef COIN_HAS_VOL #include "VolVolume.hpp" #include "CoinHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinMpsIO.hpp" //############################################################################# class lpHook : public VOL_user_hooks { private: lpHook(const lpHook&); lpHook& operator=(const lpHook&); private: /// Pointer to dense vector of structural variable upper bounds double *colupper_; /// Pointer to dense vector of structural variable lower bounds double *collower_; /// Pointer to dense vector of objective coefficients double *objcoeffs_; /// Pointer to dense vector of right hand sides double *rhs_; /// Pointer to dense vector of senses char *sense_; /// The problem matrix in a row ordered form CoinPackedMatrix rowMatrix_; /// The problem matrix in a column ordered form CoinPackedMatrix colMatrix_; public: lpHook(double* clb, double* cub, double* obj, double* rhs, char* sense, const CoinPackedMatrix& mat); virtual ~lpHook(); public: // for all hooks: return value of -1 means that volume should quit /** compute reduced costs @param u (IN) the dual variables @param rc (OUT) the reduced cost with respect to the dual values */ virtual int compute_rc(const VOL_dvector& u, VOL_dvector& rc); /** Solve the subproblem for the subgradient step. @param dual (IN) the dual variables @param rc (IN) the reduced cost with respect to the dual values @param lcost (OUT) the lagrangean cost with respect to the dual values @param x (OUT) the primal result of solving the subproblem @param v (OUT) b-Ax for the relaxed constraints @param pcost (OUT) the primal objective value of x */ virtual int solve_subproblem(const VOL_dvector& dual, const VOL_dvector& rc, double& lcost, VOL_dvector& x, VOL_dvector& v, double& pcost); /** Starting from the primal vector x, run a heuristic to produce an integer solution @param x (IN) the primal vector @param heur_val (OUT) the value of the integer solution (return DBL_MAX here if no feas sol was found */ virtual int heuristics(const VOL_problem& p, const VOL_dvector& x, double& heur_val) { return 0; } }; //############################################################################# lpHook::lpHook(double* clb, double* cub, double* obj, double* rhs, char* sense, const CoinPackedMatrix& mat) { colupper_ = cub; collower_ = clb; objcoeffs_ = obj; rhs_ = rhs; sense_ = sense; assert (mat.isColOrdered()); colMatrix_.copyOf(mat); rowMatrix_.reverseOrderedCopyOf(mat); } //----------------------------------------------------------------------------- lpHook::~lpHook() { } //############################################################################# int lpHook::compute_rc(const VOL_dvector& u, VOL_dvector& rc) { rowMatrix_.transposeTimes(u.v, rc.v); const int psize = rowMatrix_.getNumCols(); for (int i = 0; i < psize; ++i) rc[i] = objcoeffs_[i] - rc[i]; return 0; } //----------------------------------------------------------------------------- int lpHook::solve_subproblem(const VOL_dvector& dual, const VOL_dvector& rc, double& lcost, VOL_dvector& x, VOL_dvector& v, double& pcost) { int i; const int psize = x.size(); const int dsize = v.size(); // compute the lagrangean solution corresponding to the reduced costs for (i = 0; i < psize; ++i) x[i] = (rc[i] >= 0.0) ? collower_[i] : colupper_[i]; // compute the lagrangean value (rhs*dual + primal*rc) lcost = 0; for (i = 0; i < dsize; ++i) lcost += rhs_[i] * dual[i]; for (i = 0; i < psize; ++i) lcost += x[i] * rc[i]; // compute the rhs - lhs colMatrix_.times(x.v, v.v); for (i = 0; i < dsize; ++i) v[i] = rhs_[i] - v[i]; // compute the lagrangean primal objective pcost = 0; for (i = 0; i < psize; ++i) pcost += x[i] * objcoeffs_[i]; return 0; } //############################################################################# /** A quick inlined function to convert from lb/ub style constraint definition to sense/rhs/range style */ inline void convertBoundToSense(const double lower, const double upper, char& sense, double& right, double& range) { range = 0.0; if (lower > -1.0e20) { if (upper < 1.0e20) { right = upper; if (upper == lower) { sense = 'E'; } else { sense = 'R'; range = upper - lower; } } else { sense = 'G'; right = lower; } } else { if (upper < 1.0e20) { sense = 'L'; right = upper; } else { sense = 'N'; right = 0.0; } } } static int solveWithVolume(ClpSimplex * model, int numberPasses, int doIdiot) { VOL_problem volprob; volprob.parm.gap_rel_precision = 0.00001; volprob.parm.maxsgriters = 3000; if(numberPasses > 3000) { volprob.parm.maxsgriters = numberPasses; volprob.parm.primal_abs_precision = 0.0; volprob.parm.minimum_rel_ascent = 0.00001; } else if (doIdiot > 0) { volprob.parm.maxsgriters = doIdiot; } if (model->logLevel() < 2) volprob.parm.printflag = 0; else volprob.parm.printflag = 3; const CoinPackedMatrix* mat = model->matrix(); int psize = model->numberColumns(); int dsize = model->numberRows(); char * sense = new char[dsize]; double * rhs = new double [dsize]; // Set the lb/ub on the duals volprob.dsize = dsize; volprob.psize = psize; volprob.dual_lb.allocate(dsize); volprob.dual_ub.allocate(dsize); int i; const double * rowLower = model->rowLower(); const double * rowUpper = model->rowUpper(); for (i = 0; i < dsize; ++i) { double range; convertBoundToSense(rowLower[i], rowUpper[i], sense[i], rhs[i], range); switch (sense[i]) { case 'E': volprob.dual_lb[i] = -1.0e31; volprob.dual_ub[i] = 1.0e31; break; case 'L': volprob.dual_lb[i] = -1.0e31; volprob.dual_ub[i] = 0.0; break; case 'G': volprob.dual_lb[i] = 0.0; volprob.dual_ub[i] = 1.0e31; break; default: printf("Volume Algorithm can't work if there is a non ELG row\n"); return 1; } } // Check bounds double * saveLower = model->columnLower(); double * saveUpper = model->columnUpper(); bool good = true; for (i = 0; i < psize; i++) { if (saveLower[i] < -1.0e20 || saveUpper[i] > 1.0e20) { good = false; break; } } if (!good) { saveLower = CoinCopyOfArray(model->columnLower(), psize); saveUpper = CoinCopyOfArray(model->columnUpper(), psize); for (i = 0; i < psize; i++) { if (saveLower[i] < -1.0e20) saveLower[i] = -1.0e20; if(saveUpper[i] > 1.0e20) saveUpper[i] = 1.0e20; } } lpHook myHook(saveLower, saveUpper, model->objective(), rhs, sense, *mat); volprob.solve(myHook, false /* no warmstart */); if (saveLower != model->columnLower()) { delete [] saveLower; delete [] saveUpper; } //------------- extract the solution --------------------------- //printf("Best lagrangean value: %f\n", volprob.value); double avg = 0; for (i = 0; i < dsize; ++i) { switch (sense[i]) { case 'E': avg += CoinAbs(volprob.viol[i]); break; case 'L': if (volprob.viol[i] < 0) avg += (-volprob.viol[i]); break; case 'G': if (volprob.viol[i] > 0) avg += volprob.viol[i]; break; } } //printf("Average primal constraint violation: %f\n", avg/dsize); // volprob.dsol contains the dual solution (dual feasible) // volprob.psol contains the primal solution // (NOT necessarily primal feasible) CoinMemcpyN(volprob.dsol.v, dsize, model->dualRowSolution()); CoinMemcpyN(volprob.psol.v, psize, model->primalColumnSolution()); return 0; } #endif static ClpInterior * currentModel2 = NULL; #endif //############################################################################# // Allow for interrupts // But is this threadsafe ? (so switched off by option) #include "CoinSignal.hpp" static ClpSimplex * currentModel = NULL; #ifdef ABC_INHERIT static AbcSimplex * currentAbcModel = NULL; #endif extern "C" { static void #if defined(_MSC_VER) __cdecl #endif // _MSC_VER signal_handler(int /*whichSignal*/) { if (currentModel != NULL) currentModel->setMaximumIterations(0); // stop at next iterations #ifdef ABC_INHERIT if (currentAbcModel != NULL) currentAbcModel->setMaximumIterations(0); // stop at next iterations #endif #ifndef SLIM_CLP if (currentModel2 != NULL) currentModel2->setMaximumBarrierIterations(0); // stop at next iterations #endif return; } } #if ABC_INSTRUMENT>1 int abcPricing[20]; int abcPricingDense[20]; static int trueNumberRows; static int numberTypes; #define MAX_TYPES 25 #define MAX_COUNT 20 #define MAX_FRACTION 101 static char * types[MAX_TYPES]; static double counts[MAX_TYPES][MAX_COUNT]; static double countsFraction[MAX_TYPES][MAX_FRACTION]; static double * currentCounts; static double * currentCountsFraction; static int currentType; static double workMultiplier[MAX_TYPES]; static double work[MAX_TYPES]; static double currentWork; static double otherWork[MAX_TYPES]; static int timesCalled[MAX_TYPES]; static int timesStarted[MAX_TYPES]; static int fractionDivider; void instrument_initialize(int numberRows) { trueNumberRows=numberRows; numberTypes=0; memset(counts,0,sizeof(counts)); currentCounts=NULL; memset(countsFraction,0,sizeof(countsFraction)); currentCountsFraction=NULL; memset(workMultiplier,0,sizeof(workMultiplier)); memset(work,0,sizeof(work)); memset(otherWork,0,sizeof(otherWork)); memset(timesCalled,0,sizeof(timesCalled)); memset(timesStarted,0,sizeof(timesStarted)); currentType=-1; fractionDivider=(numberRows+MAX_FRACTION-2)/(MAX_FRACTION-1); } void instrument_start(const char * type,int numberRowsEtc) { if (currentType>=0) instrument_end(); currentType=-1; currentWork=0.0; for (int i=0;i(numberRowsEtc)/static_cast(trueNumberRows); } void instrument_add(int count) { assert (currentType>=0); currentWork+=count; timesCalled[currentType]++; if (count=0&&count/fractionDivider=%d els,%.0f times) ",MAX_COUNT-1,currentCounts[MAX_COUNT-1]); } printf("\n"); int largestFraction; int nBig=0; for (largestFraction=MAX_FRACTION-1;largestFraction>=10;largestFraction--) { double count = currentCountsFraction[largestFraction]; if (count&&largestFraction>10) nBig++; if (nBig>4) break; } int chunk=(largestFraction+5)/10; int lo=0; for (int iChunk=0;iChunk #endif #endif #ifdef ABC_INHERIT AbcSimplex * ClpSimplex::dealWithAbc(int solveType, int startUp, bool interrupt) { bool keepAbc = startUp>=10; startUp=startUp%10; AbcSimplex * abcModel2 = NULL; if (!this->abcState()||!numberRows_||!numberColumns_) { //this->readBasis("aaa.bas"); if (!solveType) { this->dual(0); } else if (solveType==1) { int ifValuesPass=startUp ? 1 : 0; if (startUp==3) ifValuesPass=2; this->primal(ifValuesPass); } //this->writeBasis("a.bas",true); } else { abcModel2=new AbcSimplex(*this); if (interrupt) currentAbcModel = abcModel2; //if (abcSimplex_) { // move factorization stuff abcModel2->factorization()->synchronize(this->factorization(),abcModel2); //} //abcModel2->startPermanentArrays(); int crashState=abcModel2->abcState()&(256+512+1024); abcModel2->setAbcState(CLP_ABC_WANTED|crashState|(abcModel2->abcState()&15)); int ifValuesPass=startUp ? 1 : 0; if (startUp==3) ifValuesPass=2; // temp if (fabs(this->primalTolerance()-1.001e-6)<0.999e-9) { int type=1; double diff=this->primalTolerance()-1.001e-6; printf("Diff %g\n",diff); if (fabs(diff-1.0e-10)<1.0e-13) type=2; else if (fabs(diff-1.0e-11)<1.0e-13) type=3; #if 0 ClpSimplex * thisModel = static_cast (this)->dualOfModel(1.0,1.0); if (thisModel) { printf("Dual of model has %d rows and %d columns\n", thisModel->numberRows(), thisModel->numberColumns()); thisModel->setOptimizationDirection(1.0); Idiot info(*thisModel); info.setStrategy(512 | info.getStrategy()); // Allow for scaling info.setStrategy(32 | info.getStrategy()); info.setStartingWeight(1.0e3); info.setReduceIterations(6); info.crash(50, this->messageHandler(), this->messagesPointer(),false); // make sure later that primal solution in correct place // and has correct sign abcModel2->setupDualValuesPass(thisModel->primalColumnSolution(), thisModel->dualRowSolution(),type); //thisModel->dual(); delete thisModel; } #else if (!solveType) { this->dual(0); abcModel2->setupDualValuesPass(this->dualRowSolution(), this->primalColumnSolution(),type); } else if (solveType==1) { ifValuesPass=1; abcModel2->setStateOfProblem(abcModel2->stateOfProblem() | VALUES_PASS); Idiot info(*abcModel2); info.setStrategy(512 | info.getStrategy()); // Allow for scaling info.setStrategy(32 | info.getStrategy()); info.setStartingWeight(1.0e3); info.setReduceIterations(6); info.crash(200, abcModel2->messageHandler(), abcModel2->messagesPointer(),false); //memcpy(abcModel2->primalColumnSolution(),this->primalColumnSolution(), // this->numberColumns()*sizeof(double)); } #endif } int numberCpu=this->abcState()&15; if (numberCpu==9) { numberCpu=1; #if ABC_PARALLEL==2 #ifndef FAKE_CILK if (number_cilk_workers>1) numberCpu=CoinMin(2*number_cilk_workers,8); #endif #endif } else if (numberCpu==10) { // maximum numberCpu=4; } else if (numberCpu==10) { // decide if (abcModel2->getNumElements()<5000) numberCpu=1; #if ABC_PARALLEL==2 #ifndef FAKE_CILK else if (number_cilk_workers>1) numberCpu=CoinMin(2*number_cilk_workers,8); #endif #endif else numberCpu=1; } else { #if ABC_PARALLEL==2 #ifndef FAKE_CILK char temp[3]; sprintf(temp,"%d",numberCpu); __cilkrts_set_param("nworkers",temp); printf("setting cilk workers to %d\n",numberCpu); number_cilk_workers=numberCpu; #endif #endif } char line[200]; #if ABC_PARALLEL #if ABC_PARALLEL==2 #ifndef FAKE_CILK if (!number_cilk_workers) { number_cilk_workers=__cilkrts_get_nworkers(); sprintf(line,"%d cilk workers",number_cilk_workers); handler_->message(CLP_GENERAL, messages_) << line << CoinMessageEol; } #endif #endif abcModel2->setParallelMode(numberCpu-1); #endif //if (abcState()==3||abcState()==4) { //abcModel2->setMoreSpecialOptions((131072*2)|abcModel2->moreSpecialOptions()); //} //if (processTune>0&&processTune<8) //abcModel2->setMoreSpecialOptions(abcModel2->moreSpecialOptions()|131072*processTune); #if ABC_INSTRUMENT double startTimeCpu=CoinCpuTime(); double startTimeElapsed=CoinGetTimeOfDay(); #if ABC_INSTRUMENT>1 memset(abcPricing,0,sizeof(abcPricing)); memset(abcPricingDense,0,sizeof(abcPricing)); instrument_initialize(abcModel2->numberRows()); #endif #endif if (!solveType) { abcModel2->ClpSimplex::doAbcDual(); } else if (solveType==1) { int saveOptions=abcModel2->specialOptions(); //if (startUp==2) //abcModel2->setSpecialOptions(8192|saveOptions); abcModel2->ClpSimplex::doAbcPrimal(ifValuesPass); abcModel2->setSpecialOptions(saveOptions); } #if ABC_INSTRUMENT if (solveType<2) { double timeCpu=CoinCpuTime()-startTimeCpu; double timeElapsed=CoinGetTimeOfDay()-startTimeElapsed; sprintf(line,"Cpu time for %s (%d rows, %d columns %d elements) %g elapsed %g ratio %g - %d iterations", this->problemName().c_str(),this->numberRows(),this->numberColumns(), this->getNumElements(), timeCpu,timeElapsed,timeElapsed ? timeCpu/timeElapsed : 1.0,abcModel2->numberIterations()); handler_->message(CLP_GENERAL, messages_) << line << CoinMessageEol; #if ABC_INSTRUMENT>1 { int n; n=0; for (int i=0;i<20;i++) n+= abcPricing[i]; printf("CCSparse pricing done %d times",n); int n2=0; for (int i=0;i<20;i++) n2+= abcPricingDense[i]; if (n2) printf(" and dense pricing done %d times\n",n2); else printf("\n"); n=0; printf ("CCS"); for (int i=0;i<19;i++) { if (abcPricing[i]) { if (n==5) { n=0; printf("\nCCS"); } n++; printf("(%d els,%d times) ",i,abcPricing[i]); } } if (abcPricing[19]) { if (n==5) { n=0; printf("\nCCS"); } n++; printf("(>=19 els,%d times) ",abcPricing[19]); } if (n2) { printf ("CCD"); for (int i=0;i<19;i++) { if (abcPricingDense[i]) { if (n==5) { n=0; printf("\nCCD"); } n++; int k1=(numberRows_/16)*i;; int k2=CoinMin(numberRows_,k1+(numberRows_/16)-1); printf("(%d-%d els,%d times) ",k1,k2,abcPricingDense[i]); } } } printf("\n"); } instrument_print(); #endif } #endif abcModel2->moveStatusToClp(this); #if 1 if (!problemStatus_) { double offset; CoinMemcpyN(this->objectiveAsObject()->gradient(this, this->primalColumnSolution(), offset, true), numberColumns_, this->dualColumnSolution()); this->clpMatrix()->transposeTimes(-1.0, this->dualRowSolution(), this->dualColumnSolution()); memset(this->primalRowSolution(), 0, numberRows_ * sizeof(double)); this->clpMatrix()->times(1.0, this->primalColumnSolution(), this->primalRowSolution()); this->checkSolutionInternal(); if (sumDualInfeasibilities_>100.0*dualTolerance_) { #if CBC_USEFUL_PRINTING>0 printf("internal check on duals failed %d %g\n", numberDualInfeasibilities_,sumDualInfeasibilities_); #endif } else { sumDualInfeasibilities_=0.0; numberDualInfeasibilities_=0; } if (sumPrimalInfeasibilities_>100.0*primalTolerance_) { #if CBC_USEFUL_PRINTING>0 printf("internal check on primals failed %d %g\n", numberPrimalInfeasibilities_,sumPrimalInfeasibilities_); #endif } else { sumPrimalInfeasibilities_=0.0; numberPrimalInfeasibilities_=0; } problemStatus_=0; } #endif //ClpModel::stopPermanentArrays(); this->setSpecialOptions(this->specialOptions()&~65536); #if 0 this->writeBasis("a.bas",true); for (int i=0;inumberRows();i++) printf("%d %g\n",i,this->dualRowSolution()[i]); this->dual(); this->writeBasis("b.bas",true); for (int i=0;inumberRows();i++) printf("%d %g\n",i,this->dualRowSolution()[i]); #endif // switch off initialSolve flag moreSpecialOptions_ &= ~16384; //this->setNumberIterations(abcModel2->numberIterations()+this->numberIterations()); if (!keepAbc) { delete abcModel2; abcModel2=NULL; } } return abcModel2; } #endif /** General solve algorithm which can do presolve special options (bits) 1 - do not perturb 2 - do not scale 4 - use crash (default allslack in dual, idiot in primal) 8 - all slack basis in primal 16 - switch off interrupt handling 32 - do not try and make plus minus one matrix 64 - do not use sprint even if problem looks good */ int ClpSimplex::initialSolve(ClpSolve & options) { ClpSolve::SolveType method = options.getSolveType(); //ClpSolve::SolveType originalMethod=method; ClpSolve::PresolveType presolve = options.getPresolveType(); int saveMaxIterations = maximumIterations(); int finalStatus = -1; int numberIterations = 0; double time1 = CoinCpuTime(); double timeX = time1; double time2=0.0; ClpMatrixBase * saveMatrix = NULL; ClpObjective * savedObjective = NULL; int idiotOptions=0; if(options.getSpecialOption(6)) idiotOptions=options.getExtraInfo(6)*32768; #ifdef CLP_USEFUL_PRINTOUT debugInt[0]=numberRows(); debugInt[1]=numberColumns(); debugInt[2]=matrix()->getNumElements(); #endif if (!objective_ || !matrix_) { // totally empty handler_->message(CLP_EMPTY_PROBLEM, messages_) << 0 << 0 << 0 << CoinMessageEol; return -1; } else if (!numberRows_ || !numberColumns_ || !getNumElements()) { presolve = ClpSolve::presolveOff; } if (objective_->type() >= 2 && optimizationDirection_ == 0) { // pretend linear savedObjective = objective_; // make up objective double * obj = new double[numberColumns_]; for (int i = 0; i < numberColumns_; i++) { double l = fabs(columnLower_[i]); double u = fabs(columnUpper_[i]); obj[i] = 0.0; if (CoinMin(l, u) < 1.0e20) { if (l < u) obj[i] = 1.0 + randomNumberGenerator_.randomDouble() * 1.0e-2; else obj[i] = -1.0 - randomNumberGenerator_.randomDouble() * 1.0e-2; } } objective_ = new ClpLinearObjective(obj, numberColumns_); delete [] obj; } ClpSimplex * model2 = this; bool interrupt = (options.getSpecialOption(2) == 0); CoinSighandler_t saveSignal = static_cast (0); if (interrupt) { currentModel = model2; // register signal handler saveSignal = signal(SIGINT, signal_handler); } // If no status array - set up basis if (!status_) allSlackBasis(); ClpPresolve * pinfo = new ClpPresolve(); pinfo->setSubstitution(options.substitution()); int presolveOptions = options.presolveActions(); bool presolveToFile = (presolveOptions & 0x40000000) != 0; presolveOptions &= ~0x40000000; if ((presolveOptions & 0xffff) != 0) pinfo->setPresolveActions(presolveOptions); // switch off singletons to slacks //pinfo->setDoSingletonColumn(false); // done by bits int printOptions = options.getSpecialOption(5); if ((printOptions & 1) != 0) pinfo->statistics(); double timePresolve = 0.0; double timeIdiot = 0.0; double timeCore = 0.0; eventHandler()->event(ClpEventHandler::presolveStart); int savePerturbation = perturbation_; int saveScaling = scalingFlag_; #ifndef SLIM_CLP #ifndef NO_RTTI if (dynamic_cast< ClpNetworkMatrix*>(matrix_)) { // network - switch off stuff presolve = ClpSolve::presolveOff; } #else if (matrix_->type() == 11) { // network - switch off stuff presolve = ClpSolve::presolveOff; } #endif #endif #ifndef CLPSOLVE_ACTIONS #define CLPSOLVE_ACTIONS 2 #endif #if CLPSOLVE_ACTIONS bool wasAutomatic = (method==ClpSolve::automatic); #endif if (presolve != ClpSolve::presolveOff) { bool costedSlacks = false; #if CLP_INHERIT_MODE>1 int numberPasses = 20; #else int numberPasses = 5; #endif if (presolve == ClpSolve::presolveNumber) { numberPasses = options.getPresolvePasses(); presolve = ClpSolve::presolveOn; } else if (presolve == ClpSolve::presolveNumberCost) { numberPasses = options.getPresolvePasses(); presolve = ClpSolve::presolveOn; costedSlacks = true; // switch on singletons to slacks pinfo->setDoSingletonColumn(true); // gub stuff for testing //pinfo->setDoGubrow(true); } #ifndef CLP_NO_STD if (presolveToFile) { // PreSolve to file - not fully tested printf("Presolving to file - presolve.save\n"); pinfo->presolvedModelToFile(*this, "presolve.save", dblParam_[ClpPresolveTolerance], false, numberPasses); model2 = this; } else { #endif model2 = pinfo->presolvedModel(*this, dblParam_[ClpPresolveTolerance], false, numberPasses, true, costedSlacks); #ifndef CLP_NO_STD } #endif time2 = CoinCpuTime(); timePresolve = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Presolve" << timePresolve << time2 - time1 << CoinMessageEol; timeX = time2; if (!model2) { handler_->message(CLP_INFEASIBLE, messages_) << CoinMessageEol; model2 = this; eventHandler()->event(ClpEventHandler::presolveInfeasible); problemStatus_ = pinfo->presolveStatus(); if (options.infeasibleReturn() || (moreSpecialOptions_ & 1) != 0) { delete pinfo; return -1; } presolve = ClpSolve::presolveOff; } else { #if 0 //def ABC_INHERIT { AbcSimplex * abcModel2=new AbcSimplex(*model2); delete model2; model2=abcModel2; pinfo->setPresolvedModel(model2); } #else //ClpModel::stopPermanentArrays(); //setSpecialOptions(specialOptions()&~65536); // try setting tolerances up #if CLPSOLVE_ACTIONS bool changeTolerances=wasAutomatic; #if CLPSOLVE_ACTIONS>1 changeTolerances=true; #endif if (changeTolerances && model2 != this) { #define CLP_NEW_TOLERANCE 1.0e-6 if (model2->primalTolerance()==1.0e-7&&model2->dualTolerance()==1.0e-7) { model2->setPrimalTolerance(CLP_NEW_TOLERANCE); model2->setDualTolerance(CLP_NEW_TOLERANCE); } } #endif #endif model2->eventHandler()->setSimplex(model2); int rcode=model2->eventHandler()->event(ClpEventHandler::presolveSize); // see if too big or small if (rcode==2) { delete model2; delete pinfo; return -2; } else if (rcode==3) { delete model2; delete pinfo; return -3; } } model2->setMoreSpecialOptions(model2->moreSpecialOptions()&(~1024)); model2->eventHandler()->setSimplex(model2); // We may be better off using original (but if dual leave because of bounds) if (presolve != ClpSolve::presolveOff && numberRows_ < 1.01 * model2->numberRows_ && numberColumns_ < 1.01 * model2->numberColumns_ && model2 != this) { if(method != ClpSolve::useDual || (numberRows_ == model2->numberRows_ && numberColumns_ == model2->numberColumns_)) { delete model2; model2 = this; presolve = ClpSolve::presolveOff; } } } #ifdef CLP_USEFUL_PRINTOUT debugInt[3]=model2->numberRows(); debugInt[4]=model2->numberColumns(); debugInt[5]=model2->matrix()->getNumElements(); // analyze { double time1 =CoinCpuTime(); int numberColumns = model2->numberColumns(); const double * columnLower = model2->columnLower(); const double * columnUpper = model2->columnUpper(); int numberRows = model2->numberRows(); const double * rowLower = model2->rowLower(); const double * rowUpper = model2->rowUpper(); const double * objective = model2->objective(); CoinPackedMatrix * matrix = model2->matrix(); CoinBigIndex numberElements = matrix->getNumElements(); const int * columnLength = matrix->getVectorLengths(); //const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); const int * row = matrix->getIndices(); int * rowCount = new int [numberRows]; memset(rowCount,0,numberRows*sizeof(int)); int n=CoinMax (2*numberRows,numberElements); n= CoinMax(2*numberColumns,n); double * check = new double[n]; memcpy(check,elementByColumn,numberElements*sizeof(double)); for (int i=0;i1.0e-12) { nDifferent++; last=check[i]; } if (check[i]==1.0) nAtOne++; } debugInt[10]=nDifferent; debugInt[15]=nAtOne; int nInf=0; int nZero=0; n=0; for (int i=0;i1.0e-12) { nDifferent++; last=check[i]; } if (check[i]==1.0) nAtOne++; } debugInt[8]=nDifferent; debugInt[13]=nAtOne; nZero=0; n=0; for (int i=0;i1.0e-12) { nDifferent++; last=check[i]; } if (check[i]==1.0) nAtOne++; } debugInt[9]=nDifferent; debugInt[14]=nAtOne; nInf=0; nZero=0; n=0; for (int i=0;i1.0e-12) { nDifferent++; last=check[i]; } if (check[i]==1.0) nAtOne++; } //debugInt[8]=nDifferent; //debugInt[13]=nAtOne; printf("BENCHMARK_STATS rhs %d different - %g -> %g (%d at one, %d infinite, %d zero)\n", debugInt[8],debugDouble[0],debugDouble[1],debugInt[13],debugInt[16],debugInt[20]); printf("BENCHMARK_STATS col %d different - %g -> %g (%d at one, %d infinite, %d zero)\n", nDifferent,smallestColBound,largestColBound,nAtOne,nInf,nZero); printf("BENCHMARK_STATS els %d different - %g -> %g (%d at one) - longest r,c %d,%d\n", debugInt[10],debugDouble[4],debugDouble[5],debugInt[15], debugInt[11],debugInt[12]); printf("BENCHMARK_STATS obj %d different - %g -> %g (%d at one, %d zero) - time %g\n", debugInt[9],debugDouble[2],debugDouble[3],debugInt[14],debugInt[21], CoinCpuTime()-time1); delete [] check; } #endif if (interrupt) currentModel = model2; int saveMoreOptions = moreSpecialOptions_; // For below >0 overrides // 0 means no, -1 means maybe int doIdiot = 0; int doCrash = 0; int doSprint = 0; int doSlp = 0; int primalStartup = 1; model2->eventHandler()->event(ClpEventHandler::presolveBeforeSolve); int tryItSave = 0; #if CLPSOLVE_ACTIONS if (method == ClpSolve::automatic ) model2->moreSpecialOptions_ |= 8192; // stop switch over #endif // switch to primal from automatic if just one cost entry if (method == ClpSolve::automatic && model2->numberColumns() > 5000 #ifndef CLPSOLVE_ACTIONS && (specialOptions_ & 1024) != 0 #endif ) { // look at original model for objective int numberColumns = model2->numberColumns(); int numberRows = model2->numberRows(); int numberColumnsOrig = this->numberColumns(); const double * obj = this->objective(); int nNon = 0; bool allOnes=true; for (int i = 0; i < numberColumnsOrig; i++) { if (obj[i]) { nNon++; if (fabs(obj[i])!=1.0) allOnes=false; } } if (nNon <= 1 || allOnes || (options.getExtraInfo(1) > 0 && options.getSpecialOption(1)==2)) { #ifdef COIN_DEVELOP printf("Forcing primal\n"); #endif method = ClpSolve::usePrimal; #ifndef CLPSOLVE_ACTIONS tryItSave = (numberRows > 200 && numberColumns > 2000 && (numberColumns > 2 * numberRows || (specialOptions_ & 1024) != 0)) ? 3 : 0; #else if (numberRows > 200 && numberColumns > 2000 && numberColumns > 2 * numberRows) { tryItSave= 3; } else { // If rhs also rubbish then maybe int numberRowsOrig = this->numberRows(); const double * rowLower = this->rowLower(); const double * rowUpper = this->rowUpper(); double last=COIN_DBL_MAX; int nDifferent=0; for (int i=0;i 0) doCrash = options.getExtraInfo(1); doSprint = 0; break; case 2: doIdiot = 1; if (options.getExtraInfo(1) > 0) doIdiot = options.getExtraInfo(1); doCrash = 0; doSprint = 0; break; case 3: doIdiot = 0; doCrash = 0; doSprint = 1; break; case 4: doIdiot = 0; doCrash = 0; doSprint = 0; break; case 5: doIdiot = 0; doCrash = -1; doSprint = -1; break; case 6: doIdiot = -1; doCrash = -1; doSprint = 0; break; case 7: doIdiot = -1; doCrash = 0; doSprint = -1; break; case 8: doIdiot = -1; doCrash = 0; doSprint = 0; break; case 9: doIdiot = 0; doCrash = 0; doSprint = -1; break; case 10: doIdiot = 0; doCrash = 0; doSprint = 0; if (options.getExtraInfo(1) ) doSlp = options.getExtraInfo(1); break; case 11: doIdiot = 0; doCrash = 0; doSprint = 0; primalStartup = 0; break; default: abort(); } } else if (method != ClpSolve::tryBenders && method != ClpSolve::tryDantzigWolfe) { // Dual switch (options.getSpecialOption(0)) { case 0: doIdiot = 0; doCrash = 0; doSprint = 0; break; case 1: doIdiot = 0; doCrash = 1; if (options.getExtraInfo(0) > 0) doCrash = options.getExtraInfo(0); doSprint = 0; break; case 2: doIdiot = -1; if (options.getExtraInfo(0) > 0) doIdiot = options.getExtraInfo(0); doCrash = 0; doSprint = 0; break; default: abort(); } } else { // decomposition } #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objectiveAsObject())); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif // If quadratic then primal or barrier or slp if (quadraticObj) { doSprint = 0; //doIdiot = 0; // off if (method == ClpSolve::useBarrier) method = ClpSolve::useBarrierNoCross; else if (method != ClpSolve::useBarrierNoCross) method = ClpSolve::usePrimal; } #ifdef COIN_HAS_VOL // Save number of idiot int saveDoIdiot = doIdiot; #endif // Just do this number of passes in Sprint int maxSprintPass = 100; // See if worth trying +- one matrix bool plusMinus = false; int numberElements = model2->getNumElements(); #ifndef SLIM_CLP #ifndef NO_RTTI if (dynamic_cast< ClpNetworkMatrix*>(matrix_)) { // network - switch off stuff doIdiot = 0; if (doSprint < 0) doSprint = 0; } #else if (matrix_->type() == 11) { // network - switch off stuff doIdiot = 0; //doSprint=0; } #endif #endif int numberColumns = model2->numberColumns(); int numberRows = model2->numberRows(); // If not all slack basis - switch off all except sprint int numberRowsBasic = 0; int iRow; for (iRow = 0; iRow < numberRows; iRow++) if (model2->getRowStatus(iRow) == basic) numberRowsBasic++; if (numberRowsBasic < numberRows && objective_->type()<2) { doIdiot = 0; doCrash = 0; //doSprint=0; } if (options.getSpecialOption(3) == 0) { if(numberElements > 100000) plusMinus = true; if(numberElements > 10000 && (doIdiot || doSprint)) plusMinus = true; } else if ((specialOptions_ & 1024) != 0) { plusMinus = true; } #ifndef SLIM_CLP // Statistics (+1,-1, other) - used to decide on strategy if not +-1 CoinBigIndex statistics[3] = { -1, 0, 0}; if (plusMinus) { saveMatrix = model2->clpMatrix(); #ifndef NO_RTTI ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(saveMatrix); #else ClpPackedMatrix* clpMatrix = NULL; if (saveMatrix->type() == 1) clpMatrix = static_cast< ClpPackedMatrix*>(saveMatrix); #endif if (clpMatrix) { ClpPlusMinusOneMatrix * newMatrix = new ClpPlusMinusOneMatrix(*(clpMatrix->matrix())); if (newMatrix->getIndices()) { // CHECKME This test of specialOptions and the one above // don't seem compatible. #ifndef ABC_INHERIT if ((specialOptions_ & 1024) == 0) { model2->replaceMatrix(newMatrix); } else { #endif // in integer (or abc) - just use for sprint/idiot saveMatrix = NULL; delete newMatrix; #ifndef ABC_INHERIT } #endif } else { handler_->message(CLP_MATRIX_CHANGE, messages_) << "+- 1" << CoinMessageEol; CoinMemcpyN(newMatrix->startPositive(), 3, statistics); saveMatrix = NULL; plusMinus = false; delete newMatrix; } } else { saveMatrix = NULL; plusMinus = false; } } #endif if (this->factorizationFrequency() == 200) { // User did not touch preset model2->defaultFactorizationFrequency(); } else if (model2 != this) { // make sure model2 has correct value model2->setFactorizationFrequency(this->factorizationFrequency()); } if (method == ClpSolve::automatic) { if (doSprint == 0 && doIdiot == 0) { // off method = ClpSolve::useDual; } else { // only do primal if sprint or idiot if (doSprint > 0) { method = ClpSolve::usePrimalorSprint; } else if (doIdiot > 0) { method = ClpSolve::usePrimal; } else { if (numberElements < 500000) { // Small problem if(numberRows * 10 > numberColumns || numberColumns < 6000 || (numberRows * 20 > numberColumns && !plusMinus)) doSprint = 0; // switch off sprint } else { // larger problem if(numberRows * 8 > numberColumns) doSprint = 0; // switch off sprint } // switch off idiot or sprint if any free variable // switch off sprint if very few with costs // or great variation in cost int iColumn; const double * columnLower = model2->columnLower(); const double * columnUpper = model2->columnUpper(); const double * objective = model2->objective(); int nObj=0; int nFree=0; double smallestObj=COIN_DBL_MAX; double largestObj=0.0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLower[iColumn] < -1.0e10 && columnUpper[iColumn] > 1.0e10) { nFree++; } else if (objective[iColumn]) { nObj++; smallestObj=CoinMin(smallestObj,objective[iColumn]); largestObj=CoinMax(largestObj,objective[iColumn]); } } if (nObj*10numberRows) doSprint=0; int nPasses = 0; // look at rhs int iRow; double largest = 0.0; double smallest = 1.0e30; double largestGap = 0.0; int numberNotE = 0; bool notInteger = false; for (iRow = 0; iRow < numberRows; iRow++) { double value1 = model2->rowLower_[iRow]; if (value1 && value1 > -1.0e31) { largest = CoinMax(largest, fabs(value1)); smallest = CoinMin(smallest, fabs(value1)); if (fabs(value1 - floor(value1 + 0.5)) > 1.0e-8) { notInteger = true; break; } } double value2 = model2->rowUpper_[iRow]; if (value2 && value2 < 1.0e31) { largest = CoinMax(largest, fabs(value2)); smallest = CoinMin(smallest, fabs(value2)); if (fabs(value2 - floor(value2 + 0.5)) > 1.0e-8) { notInteger = true; break; } } // CHECKME This next bit can't be right... if (value2 > value1) { numberNotE++; //if (value2 > 1.0e31 || value1 < -1.0e31) // largestGap = COIN_DBL_MAX; //else // largestGap = value2 - value1; } } int tryIt = (numberRows > 200 && numberColumns > 2000 && (numberColumns > 2 * numberRows || (method != ClpSolve::useDual && (specialOptions_ & 1024) != 0))) ? 3 : 0; tryItSave = tryIt; if (numberRows < 1000 && numberColumns < 3000) tryIt = 0; if (notInteger) tryIt = 0; if (largest / smallest > 10 || (largest / smallest > 2.0 && largest > 50)) tryIt = 0; if (tryIt) { if (largest / smallest > 2.0) { nPasses = 10 + numberColumns / 100000; nPasses = CoinMin(nPasses, 50); nPasses = CoinMax(nPasses, 15); if (numberRows > 20000 && nPasses > 5) { // Might as well go for it nPasses = CoinMax(nPasses, 71); } else if (numberRows > 2000 && nPasses > 5) { nPasses = CoinMax(nPasses, 50); } else if (numberElements < 3 * numberColumns) { nPasses = CoinMin(nPasses, 10); // probably not worh it } } else if (largest / smallest > 1.01 || numberElements <= 3 * numberColumns) { nPasses = 10 + numberColumns / 1000; nPasses = CoinMin(nPasses, 100); nPasses = CoinMax(nPasses, 30); if (numberRows > 25000) { // Might as well go for it nPasses = CoinMax(nPasses, 71); } if (!largestGap) nPasses *= 2; } else { nPasses = 10 + numberColumns / 1000; nPasses = CoinMax(nPasses, 100); if (!largestGap) nPasses *= 2; nPasses = CoinMin(nPasses, 200); } } //printf("%d rows %d cols plus %c tryIt %c largest %g smallest %g largestGap %g npasses %d sprint %c\n", // numberRows,numberColumns,plusMinus ? 'Y' : 'N', // tryIt ? 'Y' :'N',largest,smallest,largestGap,nPasses,doSprint ? 'Y' :'N'); //exit(0); if (!tryIt || nPasses <= 5) doIdiot = 0; #if CLPSOLVE_ACTIONS if (doIdiot&&doSprint<0&&wasAutomatic && 20*model2->numberRows()>model2->numberColumns()) doSprint=0; // switch off sprint #endif if (doSprint) { method = ClpSolve::usePrimalorSprint; } else if (doIdiot) { method = ClpSolve::usePrimal; } else { method = ClpSolve::useDual; } } } } if (method == ClpSolve::tryBenders) { // Now build model int lengthNames=model2->lengthNames(); model2->setLengthNames(0); CoinModel * build = model2->createCoinModel(); model2->setLengthNames(lengthNames); CoinStructuredModel benders; build->convertMatrix(); int numberBlocks = options.independentOption(0); benders.setMessageHandler(handler_); numberBlocks=benders.decompose(*build,2,numberBlocks,NULL); delete build; //exit(0); if (numberBlocks) { options.setIndependentOption(1,1); // don't do final clean up model2->solveBenders(&benders,options); //move solution method=ClpSolve::notImplemented; time2 = CoinCpuTime(); timeCore = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Crossover" << timeCore << time2 - time1 << CoinMessageEol; timeX = time2; } else { printf("No structure\n"); method=ClpSolve::useDual; } } else if (method == ClpSolve::tryDantzigWolfe) { abort(); } if (method == ClpSolve::usePrimalorSprint) { if (doSprint < 0) { if (numberElements < 500000) { // Small problem if(numberRows * 10 > numberColumns || numberColumns < 6000 || (numberRows * 20 > numberColumns && !plusMinus)) method = ClpSolve::usePrimal; // switch off sprint } else { // larger problem if(numberRows * 8 > numberColumns) method = ClpSolve::usePrimal; // switch off sprint // but make lightweight if(numberRows * 10 > numberColumns || numberColumns < 6000 || (numberRows * 20 > numberColumns && !plusMinus)) maxSprintPass = 10; } } else if (doSprint == 0) { method = ClpSolve::usePrimal; // switch off sprint } } if (method == ClpSolve::useDual) { #ifdef CLP_USEFUL_PRINTOUT debugInt[6]=1; #endif double * saveLower = NULL; double * saveUpper = NULL; if (presolve == ClpSolve::presolveOn) { int numberInfeasibilities = model2->tightenPrimalBounds(0.0, 0); if (numberInfeasibilities) { handler_->message(CLP_INFEASIBLE, messages_) << CoinMessageEol; delete model2; model2 = this; presolve = ClpSolve::presolveOff; } } else if (numberRows_ + numberColumns_ > 5000) { // do anyway saveLower = new double[numberRows_+numberColumns_]; CoinMemcpyN(model2->columnLower(), numberColumns_, saveLower); CoinMemcpyN(model2->rowLower(), numberRows_, saveLower + numberColumns_); saveUpper = new double[numberRows_+numberColumns_]; CoinMemcpyN(model2->columnUpper(), numberColumns_, saveUpper); CoinMemcpyN(model2->rowUpper(), numberRows_, saveUpper + numberColumns_); int numberInfeasibilities = model2->tightenPrimalBounds(); if (numberInfeasibilities) { handler_->message(CLP_INFEASIBLE, messages_) << CoinMessageEol; CoinMemcpyN(saveLower, numberColumns_, model2->columnLower()); CoinMemcpyN(saveLower + numberColumns_, numberRows_, model2->rowLower()); delete [] saveLower; saveLower = NULL; CoinMemcpyN(saveUpper, numberColumns_, model2->columnUpper()); CoinMemcpyN(saveUpper + numberColumns_, numberRows_, model2->rowUpper()); delete [] saveUpper; saveUpper = NULL; } } #ifndef COIN_HAS_VOL // switch off idiot and volume for now doIdiot = 0; #endif // pick up number passes int nPasses = 0; int numberNotE = 0; #ifndef SLIM_CLP if ((doIdiot < 0 && plusMinus) || doIdiot > 0) { // See if candidate for idiot nPasses = 0; Idiot info(*model2); info.setStrategy(idiotOptions | info.getStrategy()); // Get average number of elements per column double ratio = static_cast (numberElements) / static_cast (numberColumns); // look at rhs int iRow; double largest = 0.0; double smallest = 1.0e30; for (iRow = 0; iRow < numberRows; iRow++) { double value1 = model2->rowLower_[iRow]; if (value1 && value1 > -1.0e31) { largest = CoinMax(largest, fabs(value1)); smallest = CoinMin(smallest, fabs(value1)); } double value2 = model2->rowUpper_[iRow]; if (value2 && value2 < 1.0e31) { largest = CoinMax(largest, fabs(value2)); smallest = CoinMin(smallest, fabs(value2)); } if (value2 > value1) { numberNotE++; } } if (doIdiot < 0) { if (numberRows > 200 && numberColumns > 5000 && ratio >= 3.0 && largest / smallest < 1.1 && !numberNotE) { nPasses = 71; } } if (doIdiot > 0) { nPasses = CoinMax(nPasses, doIdiot); if (nPasses > 70) { info.setStartingWeight(1.0e3); info.setDropEnoughFeasibility(0.01); } } if (nPasses > 20) { #ifdef COIN_HAS_VOL int returnCode = solveWithVolume(model2, nPasses, saveDoIdiot); if (!returnCode) { time2 = CoinCpuTime(); timeIdiot = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Idiot Crash" << timeIdiot << time2 - time1 << CoinMessageEol; timeX = time2; } else { nPasses = 0; } #else nPasses = 0; #endif } else { nPasses = 0; } } #endif if (doCrash) { #ifdef ABC_INHERIT if (!model2->abcState()) { #endif switch(doCrash) { // standard case 1: model2->crash(1000, 1); break; // As in paper by Solow and Halim (approx) case 2: case 3: model2->crash(model2->dualBound(), 0); break; // Just put free in basis case 4: model2->crash(0.0, 3); break; } #ifdef ABC_INHERIT } else if (doCrash>=0) { model2->setAbcState(model2->abcState()|256*doCrash); } #endif } if (!nPasses) { int saveOptions = model2->specialOptions(); if (model2->numberRows() > 100) model2->setSpecialOptions(saveOptions | 64); // go as far as possible //int numberRows = model2->numberRows(); //int numberColumns = model2->numberColumns(); if (dynamic_cast< ClpPackedMatrix*>(matrix_)) { // See if original wanted vector ClpPackedMatrix * clpMatrixO = dynamic_cast< ClpPackedMatrix*>(matrix_); ClpMatrixBase * matrix = model2->clpMatrix(); if (dynamic_cast< ClpPackedMatrix*>(matrix) && clpMatrixO->wantsSpecialColumnCopy()) { ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); clpMatrix->makeSpecialColumnCopy(); //model2->setSpecialOptions(model2->specialOptions()|256); // to say no row copy for comparisons model2->dual(0); clpMatrix->releaseSpecialColumnCopy(); } else { #ifndef ABC_INHERIT model2->dual(0); #else model2->dealWithAbc(0,0,interrupt); #endif } } else { model2->dual(0); } } else if (!numberNotE && 0) { // E so we can do in another way double * pi = model2->dualRowSolution(); int i; int numberColumns = model2->numberColumns(); int numberRows = model2->numberRows(); double * saveObj = new double[numberColumns]; CoinMemcpyN(model2->objective(), numberColumns, saveObj); CoinMemcpyN(model2->objective(), numberColumns, model2->dualColumnSolution()); model2->clpMatrix()->transposeTimes(-1.0, pi, model2->dualColumnSolution()); CoinMemcpyN(model2->dualColumnSolution(), numberColumns, model2->objective()); const double * rowsol = model2->primalRowSolution(); double offset = 0.0; for (i = 0; i < numberRows; i++) { offset += pi[i] * rowsol[i]; } double value2; model2->getDblParam(ClpObjOffset, value2); //printf("Offset %g %g\n",offset,value2); model2->setDblParam(ClpObjOffset, value2 - offset); model2->setPerturbation(51); //model2->setRowObjective(pi); // zero out pi //memset(pi,0,numberRows*sizeof(double)); // Could put some in basis - only partially tested model2->allSlackBasis(); //model2->factorization()->maximumPivots(200); //model2->setLogLevel(63); // solve model2->dual(0); model2->setDblParam(ClpObjOffset, value2); CoinMemcpyN(saveObj, numberColumns, model2->objective()); // zero out pi //memset(pi,0,numberRows*sizeof(double)); //model2->setRowObjective(pi); delete [] saveObj; //model2->dual(0); model2->setPerturbation(50); model2->primal(); } else { // solve model2->setPerturbation(100); model2->dual(2); model2->setPerturbation(50); model2->dual(0); } if (saveLower) { CoinMemcpyN(saveLower, numberColumns_, model2->columnLower()); CoinMemcpyN(saveLower + numberColumns_, numberRows_, model2->rowLower()); delete [] saveLower; saveLower = NULL; CoinMemcpyN(saveUpper, numberColumns_, model2->columnUpper()); CoinMemcpyN(saveUpper + numberColumns_, numberRows_, model2->rowUpper()); delete [] saveUpper; saveUpper = NULL; } time2 = CoinCpuTime(); timeCore = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Dual" << timeCore << time2 - time1 << CoinMessageEol; timeX = time2; } else if (method == ClpSolve::usePrimal) { #ifdef CLP_USEFUL_PRINTOUT debugInt[6]=2; #endif #ifndef SLIM_CLP if (doIdiot) { int nPasses = 0; Idiot info(*model2); info.setStrategy(idiotOptions | info.getStrategy()); // Get average number of elements per column double ratio = static_cast (numberElements) / static_cast (numberColumns); // look at rhs int iRow; double largest = 0.0; double smallest = 1.0e30; double largestGap = 0.0; int numberNotE = 0; for (iRow = 0; iRow < numberRows; iRow++) { double value1 = model2->rowLower_[iRow]; if (value1 && value1 > -1.0e31) { largest = CoinMax(largest, fabs(value1)); smallest = CoinMin(smallest, fabs(value1)); } double value2 = model2->rowUpper_[iRow]; if (value2 && value2 < 1.0e31) { largest = CoinMax(largest, fabs(value2)); smallest = CoinMin(smallest, fabs(value2)); } if (value2 > value1) { numberNotE++; if (value2 > 1.0e31 || value1 < -1.0e31) largestGap = COIN_DBL_MAX; else largestGap = value2 - value1; } } bool increaseSprint = plusMinus; if ((specialOptions_ & 1024) != 0) increaseSprint = false; if (!plusMinus) { // If 90% +- 1 then go for sprint if (statistics[0] >= 0 && 10 * statistics[2] < statistics[0] + statistics[1]) increaseSprint = true; } int tryIt = tryItSave; if (numberRows < 1000 && numberColumns < 3000) tryIt = 0; if (tryIt) { if (increaseSprint) { info.setStartingWeight(1.0e3); info.setReduceIterations(6); // also be more lenient on infeasibilities info.setDropEnoughFeasibility(0.5 * info.getDropEnoughFeasibility()); info.setDropEnoughWeighted(-2.0); if (largest / smallest > 2.0) { nPasses = 10 + numberColumns / 100000; nPasses = CoinMin(nPasses, 50); nPasses = CoinMax(nPasses, 15); if (numberRows > 20000 && nPasses > 5) { // Might as well go for it nPasses = CoinMax(nPasses, 71); } else if (numberRows > 2000 && nPasses > 5) { nPasses = CoinMax(nPasses, 50); } else if (numberElements < 3 * numberColumns) { nPasses = CoinMin(nPasses, 10); // probably not worh it if (doIdiot < 0) info.setLightweight(1); // say lightweight idiot } else { if (doIdiot < 0) info.setLightweight(1); // say lightweight idiot } } else if (largest / smallest > 1.01 || numberElements <= 3 * numberColumns) { nPasses = 10 + numberColumns / 1000; nPasses = CoinMin(nPasses, 100); nPasses = CoinMax(nPasses, 30); if (numberRows > 25000) { // Might as well go for it nPasses = CoinMax(nPasses, 71); } if (!largestGap) nPasses *= 2; } else { nPasses = 10 + numberColumns / 1000; nPasses = CoinMin(nPasses, 200); nPasses = CoinMax(nPasses, 100); info.setStartingWeight(1.0e-1); info.setReduceIterations(6); if (!largestGap) nPasses *= 2; //info.setFeasibilityTolerance(1.0e-7); } // If few passes - don't bother if (nPasses <= 5 && !plusMinus) nPasses = 0; } else { if (doIdiot < 0) info.setLightweight(1); // say lightweight idiot if (largest / smallest > 1.01 || numberNotE || statistics[2] > statistics[0] + statistics[1]) { if (numberRows > 25000 || numberColumns > 5 * numberRows) { nPasses = 50; } else if (numberColumns > 4 * numberRows) { nPasses = 20; } else { nPasses = 5; } } else { if (numberRows > 25000 || numberColumns > 5 * numberRows) { nPasses = 50; info.setLightweight(0); // say not lightweight idiot } else if (numberColumns > 4 * numberRows) { nPasses = 20; } else { nPasses = 15; } } if (ratio < 3.0) { nPasses = static_cast (ratio * static_cast (nPasses) / 4.0); // probably not worth it } else { nPasses = CoinMax(nPasses, 5); } if (numberRows > 25000 && nPasses > 5) { // Might as well go for it nPasses = CoinMax(nPasses, 71); } else if (increaseSprint) { nPasses *= 2; nPasses = CoinMin(nPasses, 71); } else if (nPasses == 5 && ratio > 5.0) { nPasses = static_cast (static_cast (nPasses) * (ratio / 5.0)); // increase if lots of elements per column } if (nPasses <= 5 && !plusMinus) nPasses = 0; //info.setStartingWeight(1.0e-1); } if (tryIt==1) { idiotOptions |= 262144; info.setStrategy(idiotOptions | info.getStrategy()); //model2->setSpecialOptions(model2->specialOptions() // |8388608); } } if (doIdiot > 0) { // pick up number passes nPasses = options.getExtraInfo(1) % 1000000; #ifdef COIN_HAS_VOL int returnCode = solveWithVolume(model2, nPasses, saveDoIdiot); nPasses=0; if (!returnCode) { time2 = CoinCpuTime(); timeIdiot = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Idiot Crash" << timeIdiot << time2 - time1 << CoinMessageEol; timeX = time2; } #endif #ifdef CLP_USEFUL_PRINTOUT debugInt[6]=4; debugInt[7]=nPasses; #endif if (nPasses > 70) { info.setStartingWeight(1.0e3); info.setReduceIterations(6); //if (nPasses > 200) //info.setFeasibilityTolerance(1.0e-9); //if (nPasses > 1900) //info.setWeightFactor(0.93); if (nPasses > 900) { double reductions=nPasses/6.0; if (nPasses<5000) { reductions /= 12.0; } else { reductions /= 13.0; info.setStartingWeight(1.0e4); } double ratio=1.0/std::pow(10.0,(1.0/reductions)); printf("%d passes reduction factor %g\n",nPasses,ratio); info.setWeightFactor(ratio); } else if (nPasses > 500) { info.setWeightFactor(0.7); } else if (nPasses > 200) { info.setWeightFactor(0.5); } if (maximumIterations()setMaximumIterations(COIN_INT_MAX); } if (nPasses >= 10000&&nPasses<100000) { int k = nPasses % 100; nPasses /= 200; info.setReduceIterations(3); if (k) info.setStartingWeight(1.0e2); } // also be more lenient on infeasibilities info.setDropEnoughFeasibility(0.5 * info.getDropEnoughFeasibility()); info.setDropEnoughWeighted(-2.0); } else if (nPasses >= 50) { info.setStartingWeight(1.0e3); //info.setReduceIterations(6); } // For experimenting if (nPasses < 70 && (nPasses % 10) > 0 && (nPasses % 10) < 4) { info.setStartingWeight(1.0e3); info.setLightweight(nPasses % 10); // special testing #ifdef COIN_DEVELOP printf("warning - odd lightweight %d\n", nPasses % 10); //info.setReduceIterations(6); #endif } } if (options.getExtraInfo(1) > 1000000) nPasses += 1000000; if (nPasses) { doCrash = 0; #if 0 double * solution = model2->primalColumnSolution(); int iColumn; double * saveLower = new double[numberColumns]; CoinMemcpyN(model2->columnLower(), numberColumns, saveLower); double * saveUpper = new double[numberColumns]; CoinMemcpyN(model2->columnUpper(), numberColumns, saveUpper); printf("doing tighten before idiot\n"); model2->tightenPrimalBounds(); // Move solution double * columnLower = model2->columnLower(); double * columnUpper = model2->columnUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnLower[iColumn] > 0.0) solution[iColumn] = columnLower[iColumn]; else if (columnUpper[iColumn] < 0.0) solution[iColumn] = columnUpper[iColumn]; else solution[iColumn] = 0.0; } CoinMemcpyN(saveLower, numberColumns, columnLower); CoinMemcpyN(saveUpper, numberColumns, columnUpper); delete [] saveLower; delete [] saveUpper; #else // Allow for crossover //#define LACI_TRY #ifndef LACI_TRY //if (doIdiot>0) #if 0 //def ABC_INHERIT if (!model2->abcState()) #endif info.setStrategy(512 | info.getStrategy()); #endif // Allow for scaling info.setStrategy(32 | info.getStrategy()); int saveScalingFlag=model2->scalingFlag(); bool linearObjective = objective_->type()<2; if (!linearObjective) model2->scaling(0); #define CLP_DUAL_IDIOT #ifdef CLP_DUAL_IDIOT bool doubleIdiot=false; if (nPasses==99&&linearObjective) doubleIdiot=true; if (doubleIdiot) { ClpSimplex * dualModel2 = static_cast (model2)->dualOfModel(1.0,1.0); if (dualModel2) { printf("Dual of model has %d rows and %d columns\n", dualModel2->numberRows(), dualModel2->numberColumns()); dualModel2->setOptimizationDirection(1.0); Idiot infoDual(info); infoDual.setModel(dualModel2); #if 0 info.setStrategy(512 | info.getStrategy()); // Allow for scaling info.setStrategy(32 | info.getStrategy()); info.setStartingWeight(1.0e3); info.setReduceIterations(6); #endif info.crash(nPasses, model2->messageHandler(), model2->messagesPointer(),false); infoDual.crash(nPasses, model2->messageHandler(), model2->messagesPointer(),false); // two copies of solutions ClpSimplex temp(*model2); #if 0 static_cast (&temp)->restoreFromDual(dualModel2); #else // move duals and just copy primal memcpy(temp.dualRowSolution(),dualModel2->primalColumnSolution(), numberRows*sizeof(double)); memcpy(temp.primalColumnSolution(),model2->primalColumnSolution(), numberColumns*sizeof(double)); #endif delete dualModel2; int numberRows=model2->numberRows(); int numberColumns=model2->numberColumns(); ClpSimplex * tempModel[2]; tempModel[0]=model2; tempModel[1]=&temp; const double * primalColumn[2]; const double * dualRow[2]; double * dualColumn[2]; double * primalRow[2]; for (int i=0;i<2;i++) { primalColumn[i]=tempModel[i]->primalColumnSolution(); dualRow[i]=tempModel[i]->dualRowSolution(); dualColumn[i]=tempModel[i]->dualColumnSolution(); primalRow[i]=tempModel[i]->primalRowSolution(); memcpy(dualColumn[i],model2->objective(), numberColumns*sizeof(double)); memset(primalRow[i], 0, numberRows * sizeof(double)); tempModel[i]->clpMatrix()->transposeTimes(-1.0, dualRow[i], dualColumn[i]); tempModel[i]->clpMatrix()->times(1.0, primalColumn[i], primalRow[i]); tempModel[i]->checkSolutionInternal(); printf("model %d - dual inf %g primal inf %g\n", i,tempModel[i]->sumDualInfeasibilities(), tempModel[i]->sumPrimalInfeasibilities()); } printf("What now\n"); } else { doubleIdiot=false; } } if (!doubleIdiot) info.crash(nPasses, model2->messageHandler(), model2->messagesPointer(), (objective_->type() <2)); #else info.crash(nPasses, model2->messageHandler(), model2->messagesPointer(),(objective_->type() <2)); #endif model2->scaling(saveScalingFlag); #endif time2 = CoinCpuTime(); timeIdiot = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Idiot Crash" << timeIdiot << time2 - time1 << CoinMessageEol; timeX = time2; if (nPasses>100000&&nPasses<100500) { // make sure no status left model2->createStatus(); // solve if (model2->factorizationFrequency() == 200) { // User did not touch preset model2->defaultFactorizationFrequency(); } //int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); // save duals //double * saveDuals = CoinCopyOfArray(model2->dualRowSolution(),numberRows); // for moment this only works on nug etc (i.e. all ==) // needs row objective double * saveObj = CoinCopyOfArray(model2->objective(),numberColumns); double * pi = model2->dualRowSolution(); model2->clpMatrix()->transposeTimes(-1.0, pi, model2->objective()); // just primal values pass double saveScale = model2->objectiveScale(); model2->setObjectiveScale(1.0e-3); model2->primal(2); model2->writeMps("xx.mps"); double * solution = model2->primalColumnSolution(); double * upper = model2->columnUpper(); for (int i=0;isetProblemStatus(-1); model2->setObjectiveScale(saveScale); #ifdef ABC_INHERIT AbcSimplex * abcModel2=new AbcSimplex(*model2); if (interrupt) currentAbcModel = abcModel2; if (abcSimplex_) { // move factorization stuff abcModel2->factorization()->synchronize(model2->factorization(),abcModel2); } abcModel2->startPermanentArrays(); abcModel2->setAbcState(CLP_ABC_WANTED); #if ABC_PARALLEL int parallelMode=1; printf("Parallel mode %d\n",parallelMode); abcModel2->setParallelMode(parallelMode); #endif //if (processTune>0&&processTune<8) //abcModel2->setMoreSpecialOptions(abcModel2->moreSpecialOptions()|65536*processTune); abcModel2->doAbcDual(); abcModel2->moveStatusToClp(model2); //ClpModel::stopPermanentArrays(); model2->setSpecialOptions(model2->specialOptions()&~65536); //model2->dual(); //model2->setNumberIterations(abcModel2->numberIterations()+model2->numberIterations()); delete abcModel2; #endif memcpy(model2->objective(),saveObj,numberColumns*sizeof(double)); //delete [] saveDuals; delete [] saveObj; model2->dual(2); } // end dubious idiot } } #endif // ? if (doCrash) { switch(doCrash) { // standard case 1: model2->crash(1000, 1); break; // As in paper by Solow and Halim (approx) case 2: model2->crash(model2->dualBound(), 0); break; // My take on it case 3: model2->crash(model2->dualBound(), -1); break; // Just put free in basis case 4: model2->crash(0.0, 3); break; } } #ifndef SLIM_CLP if (doSlp && objective_->type() == 2) { model2->nonlinearSLP(doSlp, 1.0e-5); } #endif #ifndef LACI_TRY if (options.getSpecialOption(1) != 2 || options.getExtraInfo(1) < 1000000) { if (dynamic_cast< ClpPackedMatrix*>(matrix_)) { // See if original wanted vector ClpPackedMatrix * clpMatrixO = dynamic_cast< ClpPackedMatrix*>(matrix_); ClpMatrixBase * matrix = model2->clpMatrix(); if (dynamic_cast< ClpPackedMatrix*>(matrix) && clpMatrixO->wantsSpecialColumnCopy()) { ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); clpMatrix->makeSpecialColumnCopy(); //model2->setSpecialOptions(model2->specialOptions()|256); // to say no row copy for comparisons model2->primal(primalStartup); clpMatrix->releaseSpecialColumnCopy(); } else { #ifndef ABC_INHERIT model2->primal(primalStartup); #else model2->dealWithAbc(1,primalStartup,interrupt); #endif } } else { #ifndef ABC_INHERIT model2->primal(primalStartup); #else model2->dealWithAbc(1,primalStartup,interrupt); #endif } } #endif time2 = CoinCpuTime(); timeCore = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Primal" << timeCore << time2 - time1 << CoinMessageEol; timeX = time2; } else if (method == ClpSolve::usePrimalorSprint) { // Sprint /* This driver implements what I called Sprint when I introduced the idea many years ago. Cplex calls it "sifting" which I think is just as silly. When I thought of this trivial idea it reminded me of an LP code of the 60's called sprint which after every factorization took a subset of the matrix into memory (all 64K words!) and then iterated very fast on that subset. On the problems of those days it did not work very well, but it worked very well on aircrew scheduling problems where there were very large numbers of columns all with the same flavor. */ /* The idea works best if you can get feasible easily. To make it more general we can add in costed slacks */ int originalNumberColumns = model2->numberColumns(); int numberRows = model2->numberRows(); ClpSimplex * originalModel2 = model2; // We will need arrays to choose variables. These are too big but .. double * weight = new double [numberRows+originalNumberColumns]; int * sort = new int [numberRows+originalNumberColumns]; int numberSort = 0; // We are going to add slacks to get feasible. // initial list will just be artificials int iColumn; const double * columnLower = model2->columnLower(); const double * columnUpper = model2->columnUpper(); double * columnSolution = model2->primalColumnSolution(); // See if we have costed slacks int * negSlack = new int[numberRows]; int * posSlack = new int[numberRows]; int iRow; for (iRow = 0; iRow < numberRows; iRow++) { negSlack[iRow] = -1; posSlack[iRow] = -1; } const double * element = model2->matrix()->getElements(); const int * row = model2->matrix()->getIndices(); const CoinBigIndex * columnStart = model2->matrix()->getVectorStarts(); const int * columnLength = model2->matrix()->getVectorLengths(); //bool allSlack = (numberRowsBasic==numberRows); for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) { if (!columnSolution[iColumn] || fabs(columnSolution[iColumn]) > 1.0e20) { double value = 0.0; if (columnLower[iColumn] > 0.0) value = columnLower[iColumn]; else if (columnUpper[iColumn] < 0.0) value = columnUpper[iColumn]; columnSolution[iColumn] = value; } if (columnLength[iColumn] == 1) { int jRow = row[columnStart[iColumn]]; if (!columnLower[iColumn]) { if (element[columnStart[iColumn]] > 0.0 && posSlack[jRow] < 0) posSlack[jRow] = iColumn; else if (element[columnStart[iColumn]] < 0.0 && negSlack[jRow] < 0) negSlack[jRow] = iColumn; } else if (!columnUpper[iColumn]) { if (element[columnStart[iColumn]] < 0.0 && posSlack[jRow] < 0) posSlack[jRow] = iColumn; else if (element[columnStart[iColumn]] > 0.0 && negSlack[jRow] < 0) negSlack[jRow] = iColumn; } } } // now see what that does to row solution double * rowSolution = model2->primalRowSolution(); CoinZeroN (rowSolution, numberRows); model2->clpMatrix()->times(1.0, columnSolution, rowSolution); // See if we can adjust using costed slacks double penalty = CoinMax(1.0e5, CoinMin(infeasibilityCost_ * 0.01, 1.0e10)) * optimizationDirection_; const double * lower = model2->rowLower(); const double * upper = model2->rowUpper(); for (iRow = 0; iRow < numberRows; iRow++) { if (lower[iRow] > rowSolution[iRow] + 1.0e-8) { int jColumn = posSlack[iRow]; if (jColumn >= 0) { if (columnSolution[jColumn]) continue; double difference = lower[iRow] - rowSolution[iRow]; double elementValue = element[columnStart[jColumn]]; if (elementValue > 0.0) { double movement = CoinMin(difference / elementValue, columnUpper[jColumn]); columnSolution[jColumn] = movement; rowSolution[iRow] += movement * elementValue; } else { double movement = CoinMax(difference / elementValue, columnLower[jColumn]); columnSolution[jColumn] = movement; rowSolution[iRow] += movement * elementValue; } } } else if (upper[iRow] < rowSolution[iRow] - 1.0e-8) { int jColumn = negSlack[iRow]; if (jColumn >= 0) { if (columnSolution[jColumn]) continue; double difference = upper[iRow] - rowSolution[iRow]; double elementValue = element[columnStart[jColumn]]; if (elementValue < 0.0) { double movement = CoinMin(difference / elementValue, columnUpper[jColumn]); columnSolution[jColumn] = movement; rowSolution[iRow] += movement * elementValue; } else { double movement = CoinMax(difference / elementValue, columnLower[jColumn]); columnSolution[jColumn] = movement; rowSolution[iRow] += movement * elementValue; } } } } delete [] negSlack; delete [] posSlack; int nRow = numberRows; bool network = false; if (dynamic_cast< ClpNetworkMatrix*>(matrix_)) { network = true; nRow *= 2; } int * addStarts = new int [nRow+1]; int * addRow = new int[nRow]; double * addElement = new double[nRow]; addStarts[0] = 0; int numberArtificials = 0; int numberAdd = 0; double * addCost = new double [numberRows]; for (iRow = 0; iRow < numberRows; iRow++) { if (lower[iRow] > rowSolution[iRow] + 1.0e-8) { addRow[numberAdd] = iRow; addElement[numberAdd++] = 1.0; if (network) { addRow[numberAdd] = numberRows; addElement[numberAdd++] = -1.0; } addCost[numberArtificials] = penalty; numberArtificials++; addStarts[numberArtificials] = numberAdd; } else if (upper[iRow] < rowSolution[iRow] - 1.0e-8) { addRow[numberAdd] = iRow; addElement[numberAdd++] = -1.0; if (network) { addRow[numberAdd] = numberRows; addElement[numberAdd++] = 1.0; } addCost[numberArtificials] = penalty; numberArtificials++; addStarts[numberArtificials] = numberAdd; } } if (numberArtificials) { // need copy so as not to disturb original model2 = new ClpSimplex(*model2); if (network) { // network - add a null row model2->addRow(0, NULL, NULL, -COIN_DBL_MAX, COIN_DBL_MAX); numberRows++; } model2->addColumns(numberArtificials, NULL, NULL, addCost, addStarts, addRow, addElement); } delete [] addStarts; delete [] addRow; delete [] addElement; delete [] addCost; // look at rhs to see if to perturb double largest = 0.0; double smallest = 1.0e30; for (iRow = 0; iRow < numberRows; iRow++) { double value; value = fabs(model2->rowLower_[iRow]); if (value && value < 1.0e30) { largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } value = fabs(model2->rowUpper_[iRow]); if (value && value < 1.0e30) { largest = CoinMax(largest, value); smallest = CoinMin(smallest, value); } } double * saveLower = NULL; double * saveUpper = NULL; if (largest < 2.01 * smallest) { // perturb - so switch off standard model2->setPerturbation(100); saveLower = new double[numberRows]; CoinMemcpyN(model2->rowLower_, numberRows, saveLower); saveUpper = new double[numberRows]; CoinMemcpyN(model2->rowUpper_, numberRows, saveUpper); double * lower = model2->rowLower(); double * upper = model2->rowUpper(); for (iRow = 0; iRow < numberRows; iRow++) { double lowerValue = lower[iRow], upperValue = upper[iRow]; double value = randomNumberGenerator_.randomDouble(); if (upperValue > lowerValue + primalTolerance_) { if (lowerValue > -1.0e20 && lowerValue) lowerValue -= value * 1.0e-4 * fabs(lowerValue); if (upperValue < 1.0e20 && upperValue) upperValue += value * 1.0e-4 * fabs(upperValue); } else if (upperValue > 0.0) { upperValue -= value * 1.0e-4 * fabs(lowerValue); lowerValue -= value * 1.0e-4 * fabs(lowerValue); } else if (upperValue < 0.0) { upperValue += value * 1.0e-4 * fabs(lowerValue); lowerValue += value * 1.0e-4 * fabs(lowerValue); } else { } lower[iRow] = lowerValue; upper[iRow] = upperValue; } } int i; // Just do this number of passes in Sprint if (doSprint > 0) maxSprintPass = options.getExtraInfo(1); // but if big use to get ratio double ratio = 3; #ifdef CLP_USEFUL_PRINTOUT debugInt[6]=3; debugInt[7]=maxSprintPass; #endif if (maxSprintPass > 1000) { ratio = static_cast (maxSprintPass) * 0.0001; ratio = CoinMax(ratio, 1.1); maxSprintPass = maxSprintPass % 1000; #ifdef COIN_DEVELOP printf("%d passes wanted with ratio of %g\n", maxSprintPass, ratio); #endif } // Just take this number of columns in small problem int smallNumberColumns = static_cast (CoinMin(ratio * numberRows, static_cast (numberColumns))); smallNumberColumns = CoinMax(smallNumberColumns, 3000); smallNumberColumns = CoinMin(smallNumberColumns, numberColumns); //int smallNumberColumns = CoinMin(12*numberRows/10,numberColumns); //smallNumberColumns = CoinMax(smallNumberColumns,3000); //smallNumberColumns = CoinMax(smallNumberColumns,numberRows+1000); // redo as may have changed columnLower = model2->columnLower(); columnUpper = model2->columnUpper(); columnSolution = model2->primalColumnSolution(); // Set up initial list numberSort = 0; if (numberArtificials) { numberSort = numberArtificials; for (i = 0; i < numberSort; i++) sort[i] = i + originalNumberColumns; } // put in free // maybe a solution there already for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) { if (model2->getColumnStatus(iColumn) == basic|| (columnLower[iColumn]<-1.0e30&&columnUpper[iColumn]>1.0e30)) sort[numberSort++] = iColumn; } for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) { if (model2->getColumnStatus(iColumn) != basic) { if (columnSolution[iColumn] > columnLower[iColumn] && columnSolution[iColumn] < columnUpper[iColumn] && columnSolution[iColumn]) sort[numberSort++] = iColumn; } } numberSort = CoinMin(numberSort, smallNumberColumns); int numberColumns = model2->numberColumns(); double * fullSolution = model2->primalColumnSolution(); int iPass; double lastObjective[] = {1.0e31,1.0e31}; // It will be safe to allow dense model2->setInitialDenseFactorization(true); // We will be using all rows int * whichRows = new int [numberRows]; for (iRow = 0; iRow < numberRows; iRow++) whichRows[iRow] = iRow; double originalOffset; model2->getDblParam(ClpObjOffset, originalOffset); int totalIterations = 0; double lastSumArtificials = COIN_DBL_MAX; int originalMaxSprintPass = maxSprintPass; maxSprintPass = 20; // so we do that many if infeasible for (iPass = 0; iPass < maxSprintPass; iPass++) { //printf("Bug until submodel new version\n"); //CoinSort_2(sort,sort+numberSort,weight); // Create small problem ClpSimplex small(model2, numberRows, whichRows, numberSort, sort); small.setPerturbation(model2->perturbation()); small.setInfeasibilityCost(model2->infeasibilityCost()); if (model2->factorizationFrequency() == 200) { // User did not touch preset small.defaultFactorizationFrequency(); } // now see what variables left out do to row solution double * rowSolution = model2->primalRowSolution(); double * sumFixed = new double[numberRows]; CoinZeroN (sumFixed, numberRows); int iRow, iColumn; // zero out ones in small problem for (iColumn = 0; iColumn < numberSort; iColumn++) { int kColumn = sort[iColumn]; fullSolution[kColumn] = 0.0; } // Get objective offset const double * objective = model2->objective(); double offset = 0.0; for (iColumn = 0; iColumn < originalNumberColumns; iColumn++) offset += fullSolution[iColumn] * objective[iColumn]; #if 0 // Set artificials to zero if first time close to zero for (iColumn = originalNumberColumns; iColumn < numberColumns; iColumn++) { if (fullSolution[iColumn]objective()[iColumn]=2.0*penalty; fullSolution[iColumn]=0.0; } } #endif small.setDblParam(ClpObjOffset, originalOffset - offset); model2->clpMatrix()->times(1.0, fullSolution, sumFixed); double * lower = small.rowLower(); double * upper = small.rowUpper(); for (iRow = 0; iRow < numberRows; iRow++) { if (lower[iRow] > -1.0e50) lower[iRow] -= sumFixed[iRow]; if (upper[iRow] < 1.0e50) upper[iRow] -= sumFixed[iRow]; rowSolution[iRow] -= sumFixed[iRow]; } delete [] sumFixed; // Solve if (interrupt) currentModel = &small; small.defaultFactorizationFrequency(); if (dynamic_cast< ClpPackedMatrix*>(matrix_)) { // See if original wanted vector ClpPackedMatrix * clpMatrixO = dynamic_cast< ClpPackedMatrix*>(matrix_); ClpMatrixBase * matrix = small.clpMatrix(); if (dynamic_cast< ClpPackedMatrix*>(matrix) && clpMatrixO->wantsSpecialColumnCopy()) { ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); clpMatrix->makeSpecialColumnCopy(); small.primal(1); clpMatrix->releaseSpecialColumnCopy(); } else { #if 1 #ifdef ABC_INHERIT //small.writeMps("try.mps"); if (iPass||!numberArtificials) small.dealWithAbc(1,1); else small.dealWithAbc(0,0); #else if (iPass||!numberArtificials) small.primal(1); else small.dual(0); #endif if (small.problemStatus()) small.dual(0); #else int numberColumns = small.numberColumns(); int numberRows = small.numberRows(); // Use dual region double * rhs = small.dualRowSolution(); int * whichRow = new int[3*numberRows]; int * whichColumn = new int[2*numberColumns]; int nBound; ClpSimplex * small2 = ((ClpSimplexOther *) (&small))->crunch(rhs, whichRow, whichColumn, nBound, false, false); if (small2) { #ifdef ABC_INHERIT small2->dealWithAbc(1,1); #else small.primal(1); #endif if (small2->problemStatus() == 0) { small.setProblemStatus(0); ((ClpSimplexOther *) (&small))->afterCrunch(*small2, whichRow, whichColumn, nBound); } else { #ifdef ABC_INHERIT small2->dealWithAbc(1,1); #else small.primal(1); #endif if (small2->problemStatus()) small.primal(1); } delete small2; } else { small.primal(1); } delete [] whichRow; delete [] whichColumn; #endif } } else { small.primal(1); } totalIterations += small.numberIterations(); // move solution back const double * solution = small.primalColumnSolution(); for (iColumn = 0; iColumn < numberSort; iColumn++) { int kColumn = sort[iColumn]; model2->setColumnStatus(kColumn, small.getColumnStatus(iColumn)); fullSolution[kColumn] = solution[iColumn]; } for (iRow = 0; iRow < numberRows; iRow++) model2->setRowStatus(iRow, small.getRowStatus(iRow)); CoinMemcpyN(small.primalRowSolution(), numberRows, model2->primalRowSolution()); double sumArtificials = 0.0; for (i = 0; i < numberArtificials; i++) sumArtificials += fullSolution[i + originalNumberColumns]; if (sumArtificials && iPass > 5 && sumArtificials >= lastSumArtificials) { // increase costs double * cost = model2->objective() + originalNumberColumns; double newCost = CoinMin(1.0e10, cost[0] * 1.5); for (i = 0; i < numberArtificials; i++) cost[i] = newCost; } lastSumArtificials = sumArtificials; // get reduced cost for large problem double * djs = model2->dualColumnSolution(); CoinMemcpyN(model2->objective(), numberColumns, djs); model2->clpMatrix()->transposeTimes(-1.0, small.dualRowSolution(), djs); int numberNegative = 0; double sumNegative = 0.0; // now massage weight so all basic in plus good djs // first count and do basic numberSort = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double dj = djs[iColumn] * optimizationDirection_; double value = fullSolution[iColumn]; if (model2->getColumnStatus(iColumn) == ClpSimplex::basic) { sort[numberSort++] = iColumn; } else if (dj < -dualTolerance_ && value < columnUpper[iColumn]) { numberNegative++; sumNegative -= dj; } else if (dj > dualTolerance_ && value > columnLower[iColumn]) { numberNegative++; sumNegative += dj; } } handler_->message(CLP_SPRINT, messages_) << iPass + 1 << small.numberIterations() << small.objectiveValue() << sumNegative << numberNegative << CoinMessageEol; if (sumArtificials < 1.0e-8 && originalMaxSprintPass >= 0) { maxSprintPass = iPass + originalMaxSprintPass; originalMaxSprintPass = -1; } if (iPass > 20) sumArtificials = 0.0; if ((small.objectiveValue()*optimizationDirection_ > lastObjective[1] - 1.0e-7 && iPass > 5 && sumArtificials < 1.0e-8) || (!small.numberIterations() && iPass) || iPass == maxSprintPass - 1 || small.status() == 3) { break; // finished } else { lastObjective[1] = lastObjective[0]; lastObjective[0] = small.objectiveValue() * optimizationDirection_; double tolerance; double averageNegDj = sumNegative / static_cast (numberNegative + 1); if (numberNegative + numberSort > smallNumberColumns) tolerance = -dualTolerance_; else tolerance = 10.0 * averageNegDj; int saveN = numberSort; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double dj = djs[iColumn] * optimizationDirection_; double value = fullSolution[iColumn]; if (model2->getColumnStatus(iColumn) != ClpSimplex::basic) { if (dj < -dualTolerance_ && value < columnUpper[iColumn]) dj = dj; else if (dj > dualTolerance_ && value > columnLower[iColumn]) dj = -dj; else if (columnUpper[iColumn] > columnLower[iColumn]) dj = fabs(dj); else dj = 1.0e50; if (dj < tolerance) { weight[numberSort] = dj; sort[numberSort++] = iColumn; } } } // sort CoinSort_2(weight + saveN, weight + numberSort, sort + saveN); numberSort = CoinMin(smallNumberColumns, numberSort); } } if (interrupt) currentModel = model2; for (i = 0; i < numberArtificials; i++) sort[i] = i + originalNumberColumns; model2->deleteColumns(numberArtificials, sort); if (network) { int iRow = numberRows - 1; model2->deleteRows(1, &iRow); } delete [] weight; delete [] sort; delete [] whichRows; if (saveLower) { // unperturb and clean for (iRow = 0; iRow < numberRows; iRow++) { double diffLower = saveLower[iRow] - model2->rowLower_[iRow]; double diffUpper = saveUpper[iRow] - model2->rowUpper_[iRow]; model2->rowLower_[iRow] = saveLower[iRow]; model2->rowUpper_[iRow] = saveUpper[iRow]; if (diffLower) assert (!diffUpper || fabs(diffLower - diffUpper) < 1.0e-5); else diffLower = diffUpper; model2->rowActivity_[iRow] += diffLower; } delete [] saveLower; delete [] saveUpper; } #ifdef ABC_INHERIT model2->dealWithAbc(1,1); #else model2->primal(1); #endif model2->setPerturbation(savePerturbation); if (model2 != originalModel2) { originalModel2->moveInfo(*model2); delete model2; model2 = originalModel2; } time2 = CoinCpuTime(); timeCore = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Sprint" << timeCore << time2 - time1 << CoinMessageEol; timeX = time2; model2->setNumberIterations(model2->numberIterations() + totalIterations); } else if (method == ClpSolve::useBarrier || method == ClpSolve::useBarrierNoCross) { #ifndef SLIM_CLP //printf("***** experimental pretty crude barrier\n"); //#define SAVEIT 2 #ifndef SAVEIT #define BORROW #endif #ifdef BORROW ClpInterior barrier; barrier.borrowModel(*model2); #else ClpInterior barrier(*model2); #endif if (interrupt) currentModel2 = &barrier; if (barrier.numberRows()+barrier.numberColumns()>10000) barrier.setMaximumBarrierIterations(1000); int barrierOptions = options.getSpecialOption(4); int aggressiveGamma = 0; bool presolveInCrossover = false; bool scale = false; bool doKKT = false; bool forceFixing = false; int speed = 0; if (barrierOptions & 16) { barrierOptions &= ~16; doKKT = true; } if (barrierOptions&(32 + 64 + 128)) { aggressiveGamma = (barrierOptions & (32 + 64 + 128)) >> 5; barrierOptions &= ~(32 + 64 + 128); } if (barrierOptions & 256) { barrierOptions &= ~256; presolveInCrossover = true; } if (barrierOptions & 512) { barrierOptions &= ~512; forceFixing = true; } if (barrierOptions & 1024) { barrierOptions &= ~1024; barrier.setProjectionTolerance(1.0e-9); } if (barrierOptions&(2048 | 4096)) { speed = (barrierOptions & (2048 | 4096)) >> 11; barrierOptions &= ~(2048 | 4096); } if (barrierOptions & 8) { barrierOptions &= ~8; scale = true; } // If quadratic force KKT if (quadraticObj) { doKKT = true; } switch (barrierOptions) { case 0: default: if (!doKKT) { ClpCholeskyBase * cholesky = new ClpCholeskyBase(options.getExtraInfo(1)); cholesky->setIntegerParameter(0, speed); barrier.setCholesky(cholesky); } else { ClpCholeskyBase * cholesky = new ClpCholeskyBase(); cholesky->setKKT(true); barrier.setCholesky(cholesky); } break; case 1: if (!doKKT) { ClpCholeskyDense * cholesky = new ClpCholeskyDense(); barrier.setCholesky(cholesky); } else { ClpCholeskyDense * cholesky = new ClpCholeskyDense(); cholesky->setKKT(true); barrier.setCholesky(cholesky); } break; #ifdef COIN_HAS_WSMP case 2: { if (!doKKT) { ClpCholeskyWssmp * cholesky = new ClpCholeskyWssmp(CoinMax(100, model2->numberRows() / 10)); barrier.setCholesky(cholesky); } else { ClpCholeskyWssmpKKT * cholesky = new ClpCholeskyWssmpKKT(CoinMax(100, model2->numberRows() / 10)); barrier.setCholesky(cholesky); } } break; case 3: if (!doKKT) { ClpCholeskyWssmp * cholesky = new ClpCholeskyWssmp(); barrier.setCholesky(cholesky); } else { ClpCholeskyWssmpKKT * cholesky = new ClpCholeskyWssmpKKT(CoinMax(100, model2->numberRows() / 10)); barrier.setCholesky(cholesky); } break; #endif #ifdef UFL_BARRIER case 4: if (!doKKT) { ClpCholeskyUfl * cholesky = new ClpCholeskyUfl(); barrier.setCholesky(cholesky); } else { ClpCholeskyUfl * cholesky = new ClpCholeskyUfl(); cholesky->setKKT(true); barrier.setCholesky(cholesky); } break; #endif #ifdef TAUCS_BARRIER case 5: { ClpCholeskyTaucs * cholesky = new ClpCholeskyTaucs(); barrier.setCholesky(cholesky); assert (!doKKT); } break; #endif #ifdef COIN_HAS_MUMPS case 6: { if (!doKKT) { ClpCholeskyMumps * cholesky = new ClpCholeskyMumps(); barrier.setCholesky(cholesky); } else { ClpCholeskyMumps * cholesky = new ClpCholeskyMumps(); cholesky->setKKT(true); barrier.setCholesky(cholesky); } } break; #endif } int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); int saveMaxIts = model2->maximumIterations(); if (saveMaxIts < 1000) { barrier.setMaximumBarrierIterations(saveMaxIts); model2->setMaximumIterations(10000000); } #ifndef SAVEIT //barrier.setDiagonalPerturbation(1.0e-25); if (aggressiveGamma) { switch (aggressiveGamma) { case 1: barrier.setGamma(1.0e-5); barrier.setDelta(1.0e-5); break; case 2: barrier.setGamma(1.0e-7); break; case 3: barrier.setDelta(1.0e-5); break; case 4: barrier.setGamma(1.0e-3); barrier.setDelta(1.0e-3); break; case 5: barrier.setGamma(1.0e-3); break; case 6: barrier.setDelta(1.0e-3); break; } } if (scale) barrier.scaling(1); else barrier.scaling(0); barrier.primalDual(); #elif SAVEIT==1 barrier.primalDual(); #else model2->restoreModel("xx.save"); // move solutions CoinMemcpyN(model2->primalRowSolution(), numberRows, barrier.primalRowSolution()); CoinMemcpyN(model2->dualRowSolution(), numberRows, barrier.dualRowSolution()); CoinMemcpyN(model2->primalColumnSolution(), numberColumns, barrier.primalColumnSolution()); CoinMemcpyN(model2->dualColumnSolution(), numberColumns, barrier.dualColumnSolution()); #endif time2 = CoinCpuTime(); timeCore = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Barrier" << timeCore << time2 - time1 << CoinMessageEol; timeX = time2; int maxIts = barrier.maximumBarrierIterations(); int barrierStatus = barrier.status(); double gap = barrier.complementarityGap(); // get which variables are fixed double * saveLower = NULL; double * saveUpper = NULL; ClpPresolve pinfo2; ClpSimplex * saveModel2 = NULL; bool extraPresolve = false; int numberFixed = barrier.numberFixed(); if (numberFixed) { int numberRows = barrier.numberRows(); int numberColumns = barrier.numberColumns(); int numberTotal = numberRows + numberColumns; saveLower = new double [numberTotal]; saveUpper = new double [numberTotal]; CoinMemcpyN(barrier.columnLower(), numberColumns, saveLower); CoinMemcpyN(barrier.rowLower(), numberRows, saveLower + numberColumns); CoinMemcpyN(barrier.columnUpper(), numberColumns, saveUpper); CoinMemcpyN(barrier.rowUpper(), numberRows, saveUpper + numberColumns); } if (((numberFixed * 20 > barrier.numberRows() && numberFixed > 5000) || forceFixing) && presolveInCrossover) { // may as well do presolve if (!forceFixing) { barrier.fixFixed(); } else { // Fix int n = barrier.numberColumns(); double * lower = barrier.columnLower(); double * upper = barrier.columnUpper(); double * solution = barrier.primalColumnSolution(); int nFix = 0; for (int i = 0; i < n; i++) { if (barrier.fixedOrFree(i) && lower[i] < upper[i]) { double value = solution[i]; if (value < lower[i] + 1.0e-6 && value - lower[i] < upper[i] - value) { solution[i] = lower[i]; upper[i] = lower[i]; nFix++; } else if (value > upper[i] - 1.0e-6 && value - lower[i] > upper[i] - value) { solution[i] = upper[i]; lower[i] = upper[i]; nFix++; } } } #ifdef CLP_INVESTIGATE printf("%d columns fixed\n", nFix); #endif int nr = barrier.numberRows(); lower = barrier.rowLower(); upper = barrier.rowUpper(); solution = barrier.primalRowSolution(); nFix = 0; for (int i = 0; i < nr; i++) { if (barrier.fixedOrFree(i + n) && lower[i] < upper[i]) { double value = solution[i]; if (value < lower[i] + 1.0e-6 && value - lower[i] < upper[i] - value) { solution[i] = lower[i]; upper[i] = lower[i]; nFix++; } else if (value > upper[i] - 1.0e-6 && value - lower[i] > upper[i] - value) { solution[i] = upper[i]; lower[i] = upper[i]; nFix++; } } } #ifdef CLP_INVESTIGATE printf("%d row slacks fixed\n", nFix); #endif } saveModel2 = model2; extraPresolve = true; } else if (numberFixed) { // Set fixed to bounds (may have restored earlier solution) if (!forceFixing) { barrier.fixFixed(false); } else { // Fix int n = barrier.numberColumns(); double * lower = barrier.columnLower(); double * upper = barrier.columnUpper(); double * solution = barrier.primalColumnSolution(); int nFix = 0; for (int i = 0; i < n; i++) { if (barrier.fixedOrFree(i) && lower[i] < upper[i]) { double value = solution[i]; if (value < lower[i] + 1.0e-8 && value - lower[i] < upper[i] - value) { solution[i] = lower[i]; upper[i] = lower[i]; nFix++; } else if (value > upper[i] - 1.0e-8 && value - lower[i] > upper[i] - value) { solution[i] = upper[i]; lower[i] = upper[i]; nFix++; } else { //printf("fixcol %d %g <= %g <= %g\n", // i,lower[i],solution[i],upper[i]); } } } #ifdef CLP_INVESTIGATE printf("%d columns fixed\n", nFix); #endif int nr = barrier.numberRows(); lower = barrier.rowLower(); upper = barrier.rowUpper(); solution = barrier.primalRowSolution(); nFix = 0; for (int i = 0; i < nr; i++) { if (barrier.fixedOrFree(i + n) && lower[i] < upper[i]) { double value = solution[i]; if (value < lower[i] + 1.0e-5 && value - lower[i] < upper[i] - value) { solution[i] = lower[i]; upper[i] = lower[i]; nFix++; } else if (value > upper[i] - 1.0e-5 && value - lower[i] > upper[i] - value) { solution[i] = upper[i]; lower[i] = upper[i]; nFix++; } else { //printf("fixrow %d %g <= %g <= %g\n", // i,lower[i],solution[i],upper[i]); } } } #ifdef CLP_INVESTIGATE printf("%d row slacks fixed\n", nFix); #endif } } #ifdef BORROW int saveNumberIterations = barrier.numberIterations(); barrier.returnModel(*model2); double * rowPrimal = new double [numberRows]; double * columnPrimal = new double [numberColumns]; double * rowDual = new double [numberRows]; double * columnDual = new double [numberColumns]; // move solutions other way CoinMemcpyN(model2->primalRowSolution(), numberRows, rowPrimal); CoinMemcpyN(model2->dualRowSolution(), numberRows, rowDual); CoinMemcpyN(model2->primalColumnSolution(), numberColumns, columnPrimal); CoinMemcpyN(model2->dualColumnSolution(), numberColumns, columnDual); #else double * rowPrimal = barrier.primalRowSolution(); double * columnPrimal = barrier.primalColumnSolution(); double * rowDual = barrier.dualRowSolution(); double * columnDual = barrier.dualColumnSolution(); // move solutions CoinMemcpyN(rowPrimal, numberRows, model2->primalRowSolution()); CoinMemcpyN(rowDual, numberRows, model2->dualRowSolution()); CoinMemcpyN(columnPrimal, numberColumns, model2->primalColumnSolution()); CoinMemcpyN(columnDual, numberColumns, model2->dualColumnSolution()); #endif if (saveModel2) { // do presolve model2 = pinfo2.presolvedModel(*model2, dblParam_[ClpPresolveTolerance], false, 5, true); if (!model2) { model2 = saveModel2; saveModel2 = NULL; int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); CoinMemcpyN(saveLower, numberColumns, model2->columnLower()); CoinMemcpyN(saveLower + numberColumns, numberRows, model2->rowLower()); delete [] saveLower; CoinMemcpyN(saveUpper, numberColumns, model2->columnUpper()); CoinMemcpyN(saveUpper + numberColumns, numberRows, model2->rowUpper()); delete [] saveUpper; saveLower = NULL; saveUpper = NULL; } } if (method == ClpSolve::useBarrier || barrierStatus < 0) { if (maxIts && barrierStatus < 4 && !quadraticObj) { //printf("***** crossover - needs more thought on difficult models\n"); #if SAVEIT==1 model2->ClpSimplex::saveModel("xx.save"); #endif // make sure no status left model2->createStatus(); // solve if (!forceFixing) model2->setPerturbation(100); if (model2->factorizationFrequency() == 200) { // User did not touch preset model2->defaultFactorizationFrequency(); } #if 1 //ndef ABC_INHERIT //#if 1 // throw some into basis if(!forceFixing) { int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); double * dsort = new double[numberColumns]; int * sort = new int[numberColumns]; int n = 0; const double * columnLower = model2->columnLower(); const double * columnUpper = model2->columnUpper(); double * primalSolution = model2->primalColumnSolution(); const double * dualSolution = model2->dualColumnSolution(); double tolerance = 10.0 * primalTolerance_; int i; for ( i = 0; i < numberRows; i++) model2->setRowStatus(i, superBasic); for ( i = 0; i < numberColumns; i++) { double distance = CoinMin(columnUpper[i] - primalSolution[i], primalSolution[i] - columnLower[i]); if (distance > tolerance) { if (fabs(dualSolution[i]) < 1.0e-5) distance *= 100.0; dsort[n] = -distance; sort[n++] = i; model2->setStatus(i, superBasic); } else if (distance > primalTolerance_) { model2->setStatus(i, superBasic); } else if (primalSolution[i] <= columnLower[i] + primalTolerance_) { model2->setStatus(i, atLowerBound); primalSolution[i] = columnLower[i]; } else { model2->setStatus(i, atUpperBound); primalSolution[i] = columnUpper[i]; } } CoinSort_2(dsort, dsort + n, sort); n = CoinMin(numberRows, n); for ( i = 0; i < n; i++) { int iColumn = sort[i]; model2->setStatus(iColumn, basic); } delete [] sort; delete [] dsort; // model2->allSlackBasis(); if (gap < 1.0e-3 * static_cast (numberRows + numberColumns)) { if (saveUpper) { int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); CoinMemcpyN(saveLower, numberColumns, model2->columnLower()); CoinMemcpyN(saveLower + numberColumns, numberRows, model2->rowLower()); CoinMemcpyN(saveUpper, numberColumns, model2->columnUpper()); CoinMemcpyN(saveUpper + numberColumns, numberRows, model2->rowUpper()); delete [] saveLower; delete [] saveUpper; saveLower = NULL; saveUpper = NULL; } //int numberRows = model2->numberRows(); //int numberColumns = model2->numberColumns(); #ifdef ABC_INHERIT model2->checkSolution(0); printf("%d primal infeasibilities summing to %g\n", model2->numberPrimalInfeasibilities(), model2->sumPrimalInfeasibilities()); model2->dealWithAbc(1,1); } } #else // just primal values pass double saveScale = model2->objectiveScale(); model2->setObjectiveScale(1.0e-3); model2->primal(2); model2->setObjectiveScale(saveScale); // save primal solution and copy back dual CoinMemcpyN(model2->primalRowSolution(), numberRows, rowPrimal); CoinMemcpyN(rowDual, numberRows, model2->dualRowSolution()); CoinMemcpyN(model2->primalColumnSolution(), numberColumns, columnPrimal); CoinMemcpyN(columnDual, numberColumns, model2->dualColumnSolution()); //model2->primal(1); // clean up reduced costs and flag variables { double * dj = model2->dualColumnSolution(); double * cost = model2->objective(); double * saveCost = new double[numberColumns]; CoinMemcpyN(cost, numberColumns, saveCost); double * saveLower = new double[numberColumns]; double * lower = model2->columnLower(); CoinMemcpyN(lower, numberColumns, saveLower); double * saveUpper = new double[numberColumns]; double * upper = model2->columnUpper(); CoinMemcpyN(upper, numberColumns, saveUpper); int i; double tolerance = 10.0 * dualTolerance_; for ( i = 0; i < numberColumns; i++) { if (model2->getStatus(i) == basic) { dj[i] = 0.0; } else if (model2->getStatus(i) == atLowerBound) { if (optimizationDirection_ * dj[i] < tolerance) { if (optimizationDirection_ * dj[i] < 0.0) { //if (dj[i]<-1.0e-3) //printf("bad dj at lb %d %g\n",i,dj[i]); cost[i] -= dj[i]; dj[i] = 0.0; } } else { upper[i] = lower[i]; } } else if (model2->getStatus(i) == atUpperBound) { if (optimizationDirection_ * dj[i] > tolerance) { if (optimizationDirection_ * dj[i] > 0.0) { //if (dj[i]>1.0e-3) //printf("bad dj at ub %d %g\n",i,dj[i]); cost[i] -= dj[i]; dj[i] = 0.0; } } else { lower[i] = upper[i]; } } } // just dual values pass //model2->setLogLevel(63); //model2->setFactorizationFrequency(1); model2->dual(2); CoinMemcpyN(saveCost, numberColumns, cost); delete [] saveCost; CoinMemcpyN(saveLower, numberColumns, lower); delete [] saveLower; CoinMemcpyN(saveUpper, numberColumns, upper); delete [] saveUpper; } } // and finish // move solutions CoinMemcpyN(rowPrimal, numberRows, model2->primalRowSolution()); CoinMemcpyN(columnPrimal, numberColumns, model2->primalColumnSolution()); } double saveScale = model2->objectiveScale(); model2->setObjectiveScale(1.0e-3); model2->primal(2); model2->setObjectiveScale(saveScale); model2->primal(1); #endif #else // just primal #ifdef ABC_INHERIT model2->checkSolution(0); printf("%d primal infeasibilities summing to %g\n", model2->numberPrimalInfeasibilities(), model2->sumPrimalInfeasibilities()); model2->dealWithAbc(1,1); #else model2->primal(1); #endif //model2->primal(1); #endif } else if (barrierStatus == 4) { // memory problems model2->setPerturbation(savePerturbation); model2->createStatus(); model2->dual(); } else if (maxIts && quadraticObj) { // make sure no status left model2->createStatus(); // solve model2->setPerturbation(100); model2->reducedGradient(1); } } //model2->setMaximumIterations(saveMaxIts); #ifdef BORROW model2->setNumberIterations(model2->numberIterations()+saveNumberIterations); delete [] rowPrimal; delete [] columnPrimal; delete [] rowDual; delete [] columnDual; #endif if (extraPresolve) { pinfo2.postsolve(true); delete model2; model2 = saveModel2; } if (saveUpper) { if (!forceFixing) { int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); CoinMemcpyN(saveLower, numberColumns, model2->columnLower()); CoinMemcpyN(saveLower + numberColumns, numberRows, model2->rowLower()); CoinMemcpyN(saveUpper, numberColumns, model2->columnUpper()); CoinMemcpyN(saveUpper + numberColumns, numberRows, model2->rowUpper()); } delete [] saveLower; delete [] saveUpper; saveLower = NULL; saveUpper = NULL; if (method != ClpSolve::useBarrierNoCross) model2->primal(1); } model2->setPerturbation(savePerturbation); time2 = CoinCpuTime(); timeCore = time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Crossover" << timeCore << time2 - time1 << CoinMessageEol; timeX = time2; #else abort(); #endif } else if (method == ClpSolve::notImplemented) { printf("done decomposition\n"); } else { assert (method != ClpSolve::automatic); // later time2 = 0.0; } if (saveMatrix) { if (model2 == this) { // delete and replace delete model2->clpMatrix(); model2->replaceMatrix(saveMatrix); } else { delete saveMatrix; } } numberIterations = model2->numberIterations(); finalStatus = model2->status(); int finalSecondaryStatus = model2->secondaryStatus(); if (presolve == ClpSolve::presolveOn) { int saveLevel = logLevel(); if ((specialOptions_ & 1024) == 0) setLogLevel(CoinMin(1, saveLevel)); else setLogLevel(CoinMin(0, saveLevel)); pinfo->postsolve(true); numberIterations_ = 0; delete pinfo; pinfo = NULL; factorization_->areaFactor(model2->factorization()->adjustedAreaFactor()); time2 = CoinCpuTime(); timePresolve += time2 - timeX; handler_->message(CLP_INTERVAL_TIMING, messages_) << "Postsolve" << time2 - timeX << time2 - time1 << CoinMessageEol; timeX = time2; if (!presolveToFile) { #if 1 //ndef ABC_INHERIT delete model2; #else if (model2->abcSimplex()) delete model2->abcSimplex(); else delete model2; #endif } if (interrupt) currentModel = this; // checkSolution(); already done by postSolve setLogLevel(saveLevel); int oldStatus=problemStatus_; setProblemStatus(finalStatus); setSecondaryStatus(finalSecondaryStatus); int rcode=eventHandler()->event(ClpEventHandler::presolveAfterFirstSolve); if (finalStatus != 3 && rcode < 0 && (finalStatus || oldStatus == -1)) { double sumPrimal=sumPrimalInfeasibilities_; double sumDual=sumDualInfeasibilities_; // ignore some parts of solution if (finalStatus == 1) { // infeasible sumDual=0.0; } else if (finalStatus == 2) { sumPrimal=0.0; } int savePerturbation = perturbation(); if (savePerturbation==50) setPerturbation(51); // small if (!finalStatus || finalStatus == 2 ||(moreSpecialOptions_ & 2) == 0 || fabs(sumDual)+ fabs(sumPrimal)<1.0e-3) { if (finalStatus == 2) { if (sumDual>1.0e-4) { // unbounded - get feasible first double save = optimizationDirection_; optimizationDirection_ = 0.0; primal(1); optimizationDirection_ = save; } primal(1); } else if (finalStatus == 1) { dual(); } else { if ((moreSpecialOptions_&65536)==0) { if (numberRows_<10000||true) setPerturbation(100); // probably better to perturb after n its else if (savePerturbation<100) setPerturbation(51); // probably better to perturb after n its } #ifndef ABC_INHERIT primal(1); #else dealWithAbc(1,2,interrupt); #endif } } else { // just set status problemStatus_ = finalStatus; } setPerturbation(savePerturbation); numberIterations += numberIterations_; numberIterations_ = numberIterations; finalStatus = status(); time2 = CoinCpuTime(); handler_->message(CLP_INTERVAL_TIMING, messages_) << "Cleanup" << time2 - timeX << time2 - time1 << CoinMessageEol; timeX = time2; } else if (rcode >= 0) { #ifdef ABC_INHERIT dealWithAbc(1,2,true); #else primal(1); #endif } else { secondaryStatus_ = finalSecondaryStatus; } } else if (model2 != this) { // not presolved - but different model used (sprint probably) CoinMemcpyN(model2->primalRowSolution(), numberRows_, this->primalRowSolution()); CoinMemcpyN(model2->dualRowSolution(), numberRows_, this->dualRowSolution()); CoinMemcpyN(model2->primalColumnSolution(), numberColumns_, this->primalColumnSolution()); CoinMemcpyN(model2->dualColumnSolution(), numberColumns_, this->dualColumnSolution()); CoinMemcpyN(model2->statusArray(), numberColumns_ + numberRows_, this->statusArray()); objectiveValue_ = model2->objectiveValue_; numberIterations_ = model2->numberIterations_; problemStatus_ = model2->problemStatus_; secondaryStatus_ = model2->secondaryStatus_; delete model2; } if (method != ClpSolve::useBarrierNoCross && method != ClpSolve::useBarrier) setMaximumIterations(saveMaxIterations); std::string statusMessage[] = {"Unknown", "Optimal", "PrimalInfeasible", "DualInfeasible", "Stopped", "Errors", "User stopped" }; assert (finalStatus >= -1 && finalStatus <= 5); numberIterations_ = numberIterations; handler_->message(CLP_TIMING, messages_) << statusMessage[finalStatus+1] << objectiveValue() << numberIterations << time2 - time1; handler_->printing(presolve == ClpSolve::presolveOn) << timePresolve; handler_->printing(timeIdiot != 0.0) << timeIdiot; handler_->message() << CoinMessageEol; if (interrupt) signal(SIGINT, saveSignal); perturbation_ = savePerturbation; scalingFlag_ = saveScaling; // If faking objective - put back correct one if (savedObjective) { delete objective_; objective_ = savedObjective; } if (options.getSpecialOption(1) == 2 && options.getExtraInfo(1) > 1000000) { ClpObjective * savedObjective = objective_; // make up zero objective double * obj = new double[numberColumns_]; for (int i = 0; i < numberColumns_; i++) obj[i] = 0.0; objective_ = new ClpLinearObjective(obj, numberColumns_); delete [] obj; primal(1); delete objective_; objective_ = savedObjective; finalStatus = status(); } eventHandler()->event(ClpEventHandler::presolveEnd); delete pinfo; moreSpecialOptions_= saveMoreOptions; #ifdef CLP_USEFUL_PRINTOUT debugInt[23]=numberIterations_; #endif return finalStatus; } // General solve int ClpSimplex::initialSolve() { // Default so use dual ClpSolve options; return initialSolve(options); } // General dual solve int ClpSimplex::initialDualSolve() { ClpSolve options; // Use dual options.setSolveType(ClpSolve::useDual); return initialSolve(options); } // General primal solve int ClpSimplex::initialPrimalSolve() { ClpSolve options; // Use primal options.setSolveType(ClpSolve::usePrimal); return initialSolve(options); } // barrier solve, not to be followed by crossover int ClpSimplex::initialBarrierNoCrossSolve() { ClpSolve options; // Use primal options.setSolveType(ClpSolve::useBarrierNoCross); return initialSolve(options); } // General barrier solve int ClpSimplex::initialBarrierSolve() { ClpSolve options; // Use primal options.setSolveType(ClpSolve::useBarrier); return initialSolve(options); } // Default constructor ClpSolve::ClpSolve ( ) { method_ = automatic; presolveType_ = presolveOn; numberPasses_ = 5; int i; for (i = 0; i < 7; i++) options_[i] = 0; // say no +-1 matrix options_[3] = 1; for (i = 0; i < 7; i++) extraInfo_[i] = -1; independentOptions_[0] = 0; // But switch off slacks independentOptions_[1] = 512; // Substitute up to 3 independentOptions_[2] = 3; } // Constructor when you really know what you are doing ClpSolve::ClpSolve ( SolveType method, PresolveType presolveType, int numberPasses, int options[6], int extraInfo[6], int independentOptions[3]) { method_ = method; presolveType_ = presolveType; numberPasses_ = numberPasses; int i; for (i = 0; i < 6; i++) options_[i] = options[i]; options_[6] = 0; for (i = 0; i < 6; i++) extraInfo_[i] = extraInfo[i]; extraInfo_[6] = 0; for (i = 0; i < 3; i++) independentOptions_[i] = independentOptions[i]; } // Copy constructor. ClpSolve::ClpSolve(const ClpSolve & rhs) { method_ = rhs.method_; presolveType_ = rhs.presolveType_; numberPasses_ = rhs.numberPasses_; int i; for ( i = 0; i < 7; i++) options_[i] = rhs.options_[i]; for ( i = 0; i < 7; i++) extraInfo_[i] = rhs.extraInfo_[i]; for (i = 0; i < 3; i++) independentOptions_[i] = rhs.independentOptions_[i]; } // Assignment operator. This copies the data ClpSolve & ClpSolve::operator=(const ClpSolve & rhs) { if (this != &rhs) { method_ = rhs.method_; presolveType_ = rhs.presolveType_; numberPasses_ = rhs.numberPasses_; int i; for (i = 0; i < 7; i++) options_[i] = rhs.options_[i]; for (i = 0; i < 7; i++) extraInfo_[i] = rhs.extraInfo_[i]; for (i = 0; i < 3; i++) independentOptions_[i] = rhs.independentOptions_[i]; } return *this; } // Destructor ClpSolve::~ClpSolve ( ) { } // See header file for details void ClpSolve::setSpecialOption(int which, int value, int extraInfo) { options_[which] = value; extraInfo_[which] = extraInfo; } int ClpSolve::getSpecialOption(int which) const { return options_[which]; } // Solve types void ClpSolve::setSolveType(SolveType method, int /*extraInfo*/) { method_ = method; } ClpSolve::SolveType ClpSolve::getSolveType() { return method_; } // Presolve types void ClpSolve::setPresolveType(PresolveType amount, int extraInfo) { presolveType_ = amount; numberPasses_ = extraInfo; } ClpSolve::PresolveType ClpSolve::getPresolveType() { return presolveType_; } // Extra info for idiot (or sprint) int ClpSolve::getExtraInfo(int which) const { return extraInfo_[which]; } int ClpSolve::getPresolvePasses() const { return numberPasses_; } /* Say to return at once if infeasible, default is to solve */ void ClpSolve::setInfeasibleReturn(bool trueFalse) { independentOptions_[0] = trueFalse ? 1 : 0; } #include // Generates code for above constructor void ClpSolve::generateCpp(FILE * fp) { std::string solveType[] = { "ClpSolve::useDual", "ClpSolve::usePrimal", "ClpSolve::usePrimalorSprint", "ClpSolve::useBarrier", "ClpSolve::useBarrierNoCross", "ClpSolve::automatic", "ClpSolve::notImplemented" }; std::string presolveType[] = { "ClpSolve::presolveOn", "ClpSolve::presolveOff", "ClpSolve::presolveNumber", "ClpSolve::presolveNumberCost" }; fprintf(fp, "3 ClpSolve::SolveType method = %s;\n", solveType[method_].c_str()); fprintf(fp, "3 ClpSolve::PresolveType presolveType = %s;\n", presolveType[presolveType_].c_str()); fprintf(fp, "3 int numberPasses = %d;\n", numberPasses_); fprintf(fp, "3 int options[] = {%d,%d,%d,%d,%d,%d};\n", options_[0], options_[1], options_[2], options_[3], options_[4], options_[5]); fprintf(fp, "3 int extraInfo[] = {%d,%d,%d,%d,%d,%d};\n", extraInfo_[0], extraInfo_[1], extraInfo_[2], extraInfo_[3], extraInfo_[4], extraInfo_[5]); fprintf(fp, "3 int independentOptions[] = {%d,%d,%d};\n", independentOptions_[0], independentOptions_[1], independentOptions_[2]); fprintf(fp, "3 ClpSolve clpSolve(method,presolveType,numberPasses,\n"); fprintf(fp, "3 options,extraInfo,independentOptions);\n"); } //############################################################################# #include "ClpNonLinearCost.hpp" ClpSimplexProgress::ClpSimplexProgress () { int i; for (i = 0; i < CLP_PROGRESS; i++) { objective_[i] = COIN_DBL_MAX; infeasibility_[i] = -1.0; // set to an impossible value realInfeasibility_[i] = COIN_DBL_MAX; numberInfeasibilities_[i] = -1; iterationNumber_[i] = -1; } #ifdef CLP_PROGRESS_WEIGHT for (i = 0; i < CLP_PROGRESS_WEIGHT; i++) { objectiveWeight_[i] = COIN_DBL_MAX; infeasibilityWeight_[i] = -1.0; // set to an impossible value realInfeasibilityWeight_[i] = COIN_DBL_MAX; numberInfeasibilitiesWeight_[i] = -1; iterationNumberWeight_[i] = -1; } drop_ = 0.0; best_ = 0.0; #endif initialWeight_ = 0.0; for (i = 0; i < CLP_CYCLE; i++) { //obj_[i]=COIN_DBL_MAX; in_[i] = -1; out_[i] = -1; way_[i] = 0; } numberTimes_ = 0; numberBadTimes_ = 0; numberReallyBadTimes_ = 0; numberTimesFlagged_ = 0; model_ = NULL; oddState_ = 0; } //----------------------------------------------------------------------------- ClpSimplexProgress::~ClpSimplexProgress () { } // Copy constructor. ClpSimplexProgress::ClpSimplexProgress(const ClpSimplexProgress &rhs) { int i; for (i = 0; i < CLP_PROGRESS; i++) { objective_[i] = rhs.objective_[i]; infeasibility_[i] = rhs.infeasibility_[i]; realInfeasibility_[i] = rhs.realInfeasibility_[i]; numberInfeasibilities_[i] = rhs.numberInfeasibilities_[i]; iterationNumber_[i] = rhs.iterationNumber_[i]; } #ifdef CLP_PROGRESS_WEIGHT for (i = 0; i < CLP_PROGRESS_WEIGHT; i++) { objectiveWeight_[i] = rhs.objectiveWeight_[i]; infeasibilityWeight_[i] = rhs.infeasibilityWeight_[i]; realInfeasibilityWeight_[i] = rhs.realInfeasibilityWeight_[i]; numberInfeasibilitiesWeight_[i] = rhs.numberInfeasibilitiesWeight_[i]; iterationNumberWeight_[i] = rhs.iterationNumberWeight_[i]; } drop_ = rhs.drop_; best_ = rhs.best_; #endif initialWeight_ = rhs.initialWeight_; for (i = 0; i < CLP_CYCLE; i++) { //obj_[i]=rhs.obj_[i]; in_[i] = rhs.in_[i]; out_[i] = rhs.out_[i]; way_[i] = rhs.way_[i]; } numberTimes_ = rhs.numberTimes_; numberBadTimes_ = rhs.numberBadTimes_; numberReallyBadTimes_ = rhs.numberReallyBadTimes_; numberTimesFlagged_ = rhs.numberTimesFlagged_; model_ = rhs.model_; oddState_ = rhs.oddState_; } // Copy constructor.from model ClpSimplexProgress::ClpSimplexProgress(ClpSimplex * model) { model_ = model; reset(); initialWeight_ = 0.0; } // Fill from model void ClpSimplexProgress::fillFromModel ( ClpSimplex * model ) { model_ = model; reset(); initialWeight_ = 0.0; } // Assignment operator. This copies the data ClpSimplexProgress & ClpSimplexProgress::operator=(const ClpSimplexProgress & rhs) { if (this != &rhs) { int i; for (i = 0; i < CLP_PROGRESS; i++) { objective_[i] = rhs.objective_[i]; infeasibility_[i] = rhs.infeasibility_[i]; realInfeasibility_[i] = rhs.realInfeasibility_[i]; numberInfeasibilities_[i] = rhs.numberInfeasibilities_[i]; iterationNumber_[i] = rhs.iterationNumber_[i]; } #ifdef CLP_PROGRESS_WEIGHT for (i = 0; i < CLP_PROGRESS_WEIGHT; i++) { objectiveWeight_[i] = rhs.objectiveWeight_[i]; infeasibilityWeight_[i] = rhs.infeasibilityWeight_[i]; realInfeasibilityWeight_[i] = rhs.realInfeasibilityWeight_[i]; numberInfeasibilitiesWeight_[i] = rhs.numberInfeasibilitiesWeight_[i]; iterationNumberWeight_[i] = rhs.iterationNumberWeight_[i]; } drop_ = rhs.drop_; best_ = rhs.best_; #endif initialWeight_ = rhs.initialWeight_; for (i = 0; i < CLP_CYCLE; i++) { //obj_[i]=rhs.obj_[i]; in_[i] = rhs.in_[i]; out_[i] = rhs.out_[i]; way_[i] = rhs.way_[i]; } numberTimes_ = rhs.numberTimes_; numberBadTimes_ = rhs.numberBadTimes_; numberReallyBadTimes_ = rhs.numberReallyBadTimes_; numberTimesFlagged_ = rhs.numberTimesFlagged_; model_ = rhs.model_; oddState_ = rhs.oddState_; } return *this; } // Seems to be something odd about exact comparison of doubles on linux static bool equalDouble(double value1, double value2) { union { double d; int i[2]; } v1, v2; v1.d = value1; v2.d = value2; if (sizeof(int) * 2 == sizeof(double)) return (v1.i[0] == v2.i[0] && v1.i[1] == v2.i[1]); else return (v1.i[0] == v2.i[0]); } int ClpSimplexProgress::looping() { if (!model_) return -1; double objective; if (model_->algorithm() < 0) { objective = model_->rawObjectiveValue(); objective -= model_->bestPossibleImprovement(); } else { objective = model_->nonLinearCost()->feasibleReportCost(); } double infeasibility; double realInfeasibility = 0.0; int numberInfeasibilities; int iterationNumber = model_->numberIterations(); //numberTimesFlagged_ = 0; if (model_->algorithm() < 0) { // dual infeasibility = model_->sumPrimalInfeasibilities(); numberInfeasibilities = model_->numberPrimalInfeasibilities(); } else { //primal infeasibility = model_->sumDualInfeasibilities(); realInfeasibility = model_->nonLinearCost()->sumInfeasibilities(); numberInfeasibilities = model_->numberDualInfeasibilities(); } int i; int numberMatched = 0; int matched = 0; int nsame = 0; for (i = 0; i < CLP_PROGRESS; i++) { bool matchedOnObjective = equalDouble(objective, objective_[i]); bool matchedOnInfeasibility = equalDouble(infeasibility, infeasibility_[i]); bool matchedOnInfeasibilities = (numberInfeasibilities == numberInfeasibilities_[i]); if (matchedOnObjective && matchedOnInfeasibility && matchedOnInfeasibilities) { matched |= (1 << i); // Check not same iteration if (iterationNumber != iterationNumber_[i]) { numberMatched++; // here mainly to get over compiler bug? if (model_->messageHandler()->logLevel() > 10) printf("%d %d %d %d %d loop check\n", i, numberMatched, matchedOnObjective, matchedOnInfeasibility, matchedOnInfeasibilities); } else { // stuck but code should notice nsame++; } } if (i) { objective_[i-1] = objective_[i]; infeasibility_[i-1] = infeasibility_[i]; realInfeasibility_[i-1] = realInfeasibility_[i]; numberInfeasibilities_[i-1] = numberInfeasibilities_[i]; iterationNumber_[i-1] = iterationNumber_[i]; } } objective_[CLP_PROGRESS-1] = objective; infeasibility_[CLP_PROGRESS-1] = infeasibility; realInfeasibility_[CLP_PROGRESS-1] = realInfeasibility; numberInfeasibilities_[CLP_PROGRESS-1] = numberInfeasibilities; iterationNumber_[CLP_PROGRESS-1] = iterationNumber; if (nsame == CLP_PROGRESS) numberMatched = CLP_PROGRESS; // really stuck if (model_->progressFlag()) numberMatched = 0; numberTimes_++; if (numberTimes_ < 10) numberMatched = 0; // skip if just last time as may be checking something if (matched == (1 << (CLP_PROGRESS - 1))) numberMatched = 0; if (numberMatched && model_->clpMatrix()->type() < 15) { model_->messageHandler()->message(CLP_POSSIBLELOOP, model_->messages()) << numberMatched << matched << numberTimes_ << CoinMessageEol; numberBadTimes_++; if (numberBadTimes_ < 10) { // make factorize every iteration model_->forceFactorization(1); if (numberBadTimes_ < 2) { startCheck(); // clear other loop check if (model_->algorithm() < 0) { // dual - change tolerance model_->setCurrentDualTolerance(model_->currentDualTolerance() * 1.05); // if infeasible increase dual bound if (model_->dualBound() < 1.0e17) { model_->setDualBound(model_->dualBound() * 1.1); static_cast(model_)->resetFakeBounds(0); } } else { // primal - change tolerance if (numberBadTimes_ > 3) model_->setCurrentPrimalTolerance(model_->currentPrimalTolerance() * 1.05); // if infeasible increase infeasibility cost if (model_->nonLinearCost()->numberInfeasibilities() && model_->infeasibilityCost() < 1.0e17) { model_->setInfeasibilityCost(model_->infeasibilityCost() * 1.1); } } } else { // flag int iSequence; if (model_->algorithm() < 0) { // dual if (model_->dualBound() > 1.0e14) model_->setDualBound(1.0e14); iSequence = in_[CLP_CYCLE-1]; } else { // primal if (model_->infeasibilityCost() > 1.0e14) model_->setInfeasibilityCost(1.0e14); iSequence = out_[CLP_CYCLE-1]; } if (iSequence >= 0) { char x = model_->isColumn(iSequence) ? 'C' : 'R'; if (model_->messageHandler()->logLevel() >= 63) model_->messageHandler()->message(CLP_SIMPLEX_FLAG, model_->messages()) << x << model_->sequenceWithin(iSequence) << CoinMessageEol; // if Gub then needs to be sequenceIn_ int save = model_->sequenceIn(); model_->setSequenceIn(iSequence); model_->setFlagged(iSequence); model_->setSequenceIn(save); //printf("flagging %d from loop\n",iSequence); startCheck(); } else { // Give up if (model_->messageHandler()->logLevel() >= 63) printf("***** All flagged?\n"); return 4; } // reset numberBadTimes_ = 2; } return -2; } else { // look at solution and maybe declare victory if (infeasibility < 1.0e-4) { return 0; } else { model_->messageHandler()->message(CLP_LOOP, model_->messages()) << CoinMessageEol; #ifndef NDEBUG printf("debug loop ClpSimplex A\n"); abort(); #endif return 3; } } } return -1; } // Resets as much as possible void ClpSimplexProgress::reset() { int i; for (i = 0; i < CLP_PROGRESS; i++) { if (model_->algorithm() >= 0) objective_[i] = COIN_DBL_MAX; else objective_[i] = -COIN_DBL_MAX; infeasibility_[i] = -1.0; // set to an impossible value realInfeasibility_[i] = COIN_DBL_MAX; numberInfeasibilities_[i] = -1; iterationNumber_[i] = -1; } #ifdef CLP_PROGRESS_WEIGHT for (i = 0; i < CLP_PROGRESS_WEIGHT; i++) { objectiveWeight_[i] = COIN_DBL_MAX; infeasibilityWeight_[i] = -1.0; // set to an impossible value realInfeasibilityWeight_[i] = COIN_DBL_MAX; numberInfeasibilitiesWeight_[i] = -1; iterationNumberWeight_[i] = -1; } drop_ = 0.0; best_ = 0.0; #endif for (i = 0; i < CLP_CYCLE; i++) { //obj_[i]=COIN_DBL_MAX; in_[i] = -1; out_[i] = -1; way_[i] = 0; } numberTimes_ = 0; numberBadTimes_ = 0; numberReallyBadTimes_ = 0; numberTimesFlagged_ = 0; oddState_ = 0; } // Returns previous objective (if -1) - current if (0) double ClpSimplexProgress::lastObjective(int back) const { return objective_[CLP_PROGRESS-1-back]; } // Returns previous infeasibility (if -1) - current if (0) double ClpSimplexProgress::lastInfeasibility(int back) const { return realInfeasibility_[CLP_PROGRESS-1-back]; } // Sets real primal infeasibility void ClpSimplexProgress::setInfeasibility(double value) { for (int i = 1; i < CLP_PROGRESS; i++) realInfeasibility_[i-1] = realInfeasibility_[i]; realInfeasibility_[CLP_PROGRESS-1] = value; } // Returns number of primal infeasibilities (if -1) - current if (0) int ClpSimplexProgress::numberInfeasibilities(int back) const { return numberInfeasibilities_[CLP_PROGRESS-1-back]; } // Modify objective e.g. if dual infeasible in dual void ClpSimplexProgress::modifyObjective(double value) { objective_[CLP_PROGRESS-1] = value; } // Returns previous iteration number (if -1) - current if (0) int ClpSimplexProgress::lastIterationNumber(int back) const { return iterationNumber_[CLP_PROGRESS-1-back]; } // clears iteration numbers (to switch off panic) void ClpSimplexProgress::clearIterationNumbers() { for (int i = 0; i < CLP_PROGRESS; i++) iterationNumber_[i] = -1; } // Start check at beginning of whileIterating void ClpSimplexProgress::startCheck() { int i; for (i = 0; i < CLP_CYCLE; i++) { //obj_[i]=COIN_DBL_MAX; in_[i] = -1; out_[i] = -1; way_[i] = 0; } } // Returns cycle length in whileIterating int ClpSimplexProgress::cycle(int in, int out, int wayIn, int wayOut) { int i; #if 0 if (model_->numberIterations() > 206571) { printf("in %d out %d\n", in, out); for (i = 0; i < CLP_CYCLE; i++) printf("cy %d in %d out %d\n", i, in_[i], out_[i]); } #endif int matched = 0; // first see if in matches any out for (i = 1; i < CLP_CYCLE; i++) { if (in == out_[i]) { // even if flip then suspicious matched = -1; break; } } #if 0 if (!matched || in_[0] < 0) { // can't be cycle for (i = 0; i < CLP_CYCLE - 1; i++) { //obj_[i]=obj_[i+1]; in_[i] = in_[i+1]; out_[i] = out_[i+1]; way_[i] = way_[i+1]; } } else { // possible cycle matched = 0; for (i = 0; i < CLP_CYCLE - 1; i++) { int k; char wayThis = way_[i]; int inThis = in_[i]; int outThis = out_[i]; //double objThis = obj_[i]; for(k = i + 1; k < CLP_CYCLE; k++) { if (inThis == in_[k] && outThis == out_[k] && wayThis == way_[k]) { int distance = k - i; if (k + distance < CLP_CYCLE) { // See if repeats int j = k + distance; if (inThis == in_[j] && outThis == out_[j] && wayThis == way_[j]) { matched = distance; break; } } else { matched = distance; break; } } } //obj_[i]=obj_[i+1]; in_[i] = in_[i+1]; out_[i] = out_[i+1]; way_[i] = way_[i+1]; } } #else if (matched && in_[0] >= 0) { // possible cycle - only check [0] against all matched = 0; int nMatched = 0; char way0 = way_[0]; int in0 = in_[0]; int out0 = out_[0]; //double obj0 = obj_[i]; for(int k = 1; k < CLP_CYCLE - 4; k++) { if (in0 == in_[k] && out0 == out_[k] && way0 == way_[k]) { nMatched++; // See if repeats int end = CLP_CYCLE - k; int j; for ( j = 1; j < end; j++) { if (in_[j+k] != in_[j] || out_[j+k] != out_[j] || way_[j+k] != way_[j]) break; } if (j == end) { matched = k; break; } } } // If three times then that is too much even if not regular if (matched <= 0 && nMatched > 1) matched = 100; } for (i = 0; i < CLP_CYCLE - 1; i++) { //obj_[i]=obj_[i+1]; in_[i] = in_[i+1]; out_[i] = out_[i+1]; way_[i] = way_[i+1]; } #endif int way = 1 - wayIn + 4 * (1 - wayOut); //obj_[i]=model_->objectiveValue(); in_[CLP_CYCLE-1] = in; out_[CLP_CYCLE-1] = out; way_[CLP_CYCLE-1] = static_cast(way); return matched; } #include "CoinStructuredModel.hpp" // Solve using structure of model and maybe in parallel int ClpSimplex::solve(CoinStructuredModel * model) { // analyze structure int numberRowBlocks = model->numberRowBlocks(); int numberColumnBlocks = model->numberColumnBlocks(); int numberElementBlocks = model->numberElementBlocks(); if (numberElementBlocks == 1) { loadProblem(*model, false); return dual(); } // For now just get top level structure CoinModelBlockInfo * blockInfo = new CoinModelBlockInfo [numberElementBlocks]; for (int i = 0; i < numberElementBlocks; i++) { CoinStructuredModel * subModel = dynamic_cast(model->block(i)); CoinModel * thisBlock; if (subModel) { thisBlock = subModel->coinModelBlock(blockInfo[i]); model->setCoinModel(thisBlock, i); } else { thisBlock = dynamic_cast(model->block(i)); assert (thisBlock); // just fill in info CoinModelBlockInfo info = CoinModelBlockInfo(); int whatsSet = thisBlock->whatIsSet(); info.matrix = static_cast(((whatsSet & 1) != 0) ? 1 : 0); info.rhs = static_cast(((whatsSet & 2) != 0) ? 1 : 0); info.rowName = static_cast(((whatsSet & 4) != 0) ? 1 : 0); info.integer = static_cast(((whatsSet & 32) != 0) ? 1 : 0); info.bounds = static_cast(((whatsSet & 8) != 0) ? 1 : 0); info.columnName = static_cast(((whatsSet & 16) != 0) ? 1 : 0); // Which block int iRowBlock = model->rowBlock(thisBlock->getRowBlock()); info.rowBlock = iRowBlock; int iColumnBlock = model->columnBlock(thisBlock->getColumnBlock()); info.columnBlock = iColumnBlock; blockInfo[i] = info; } } int * rowCounts = new int [numberRowBlocks]; CoinZeroN(rowCounts, numberRowBlocks); int * columnCounts = new int [numberColumnBlocks+1]; CoinZeroN(columnCounts, numberColumnBlocks); int decomposeType = 0; for (int i = 0; i < numberElementBlocks; i++) { int iRowBlock = blockInfo[i].rowBlock; int iColumnBlock = blockInfo[i].columnBlock; rowCounts[iRowBlock]++; columnCounts[iColumnBlock]++; } if (numberRowBlocks == numberColumnBlocks || numberRowBlocks == numberColumnBlocks + 1) { // could be Dantzig-Wolfe int numberG1 = 0; for (int i = 0; i < numberRowBlocks; i++) { if (rowCounts[i] > 1) numberG1++; } bool masterColumns = (numberColumnBlocks == numberRowBlocks); if ((masterColumns && numberElementBlocks == 2 * numberRowBlocks - 1) || (!masterColumns && numberElementBlocks == 2 * numberRowBlocks)) { if (numberG1 < 2) decomposeType = 1; } } if (!decomposeType && (numberRowBlocks == numberColumnBlocks || numberRowBlocks == numberColumnBlocks - 1)) { // could be Benders int numberG1 = 0; for (int i = 0; i < numberColumnBlocks; i++) { if (columnCounts[i] > 1) numberG1++; } bool masterRows = (numberColumnBlocks == numberRowBlocks); if ((masterRows && numberElementBlocks == 2 * numberColumnBlocks - 1) || (!masterRows && numberElementBlocks == 2 * numberColumnBlocks)) { if (numberG1 < 2) decomposeType = 2; } } delete [] rowCounts; delete [] columnCounts; delete [] blockInfo; // decide what to do ClpSolve options; options.setIndependentOption(2,100); switch (decomposeType) { // No good case 0: loadProblem(*model, false); return dual(); // DW case 1: return solveDW(model,options); // Benders case 2: return solveBenders(model,options); } return 0; // to stop compiler warning } /* This loads a model from a CoinStructuredModel object - returns number of errors. If originalOrder then keep to order stored in blocks, otherwise first column/rows correspond to first block - etc. If keepSolution true and size is same as current then keeps current status and solution */ int ClpSimplex::loadProblem ( CoinStructuredModel & coinModel, bool originalOrder, bool keepSolution) { unsigned char * status = NULL; double * psol = NULL; double * dsol = NULL; int numberRows = coinModel.numberRows(); int numberColumns = coinModel.numberColumns(); int numberRowBlocks = coinModel.numberRowBlocks(); int numberColumnBlocks = coinModel.numberColumnBlocks(); int numberElementBlocks = coinModel.numberElementBlocks(); if (status_ && numberRows_ && numberRows_ == numberRows && numberColumns_ == numberColumns && keepSolution) { status = new unsigned char [numberRows_+numberColumns_]; CoinMemcpyN(status_, numberRows_ + numberColumns_, status); psol = new double [numberRows_+numberColumns_]; CoinMemcpyN(columnActivity_, numberColumns_, psol); CoinMemcpyN(rowActivity_, numberRows_, psol + numberColumns_); dsol = new double [numberRows_+numberColumns_]; CoinMemcpyN(reducedCost_, numberColumns_, dsol); CoinMemcpyN(dual_, numberRows_, dsol + numberColumns_); } int returnCode = 0; double * rowLower = new double [numberRows]; double * rowUpper = new double [numberRows]; double * columnLower = new double [numberColumns]; double * columnUpper = new double [numberColumns]; double * objective = new double [numberColumns]; int * integerType = new int [numberColumns]; CoinBigIndex numberElements = 0; // Bases for blocks int * rowBase = new int[numberRowBlocks]; CoinFillN(rowBase, numberRowBlocks, -1); // And row to put it int * whichRow = new int [numberRows+numberRowBlocks]; int * columnBase = new int[numberColumnBlocks]; CoinFillN(columnBase, numberColumnBlocks, -1); // And column to put it int * whichColumn = new int [numberColumns+numberColumnBlocks]; for (int iBlock = 0; iBlock < numberElementBlocks; iBlock++) { CoinModel * block = coinModel.coinBlock(iBlock); numberElements += block->numberElements(); //and set up elements etc double * associated = block->associatedArray(); // If strings then do copies if (block->stringsExist()) returnCode += block->createArrays(rowLower, rowUpper, columnLower, columnUpper, objective, integerType, associated); const CoinModelBlockInfo & info = coinModel.blockType(iBlock); int iRowBlock = info.rowBlock; int iColumnBlock = info.columnBlock; if (rowBase[iRowBlock] < 0) { rowBase[iRowBlock] = block->numberRows(); // Save block number whichRow[numberRows+iRowBlock] = iBlock; } else { assert(rowBase[iRowBlock] == block->numberRows()); } if (columnBase[iColumnBlock] < 0) { columnBase[iColumnBlock] = block->numberColumns(); // Save block number whichColumn[numberColumns+iColumnBlock] = iBlock; } else { assert(columnBase[iColumnBlock] == block->numberColumns()); } } // Fill arrays with defaults CoinFillN(rowLower, numberRows, -COIN_DBL_MAX); CoinFillN(rowUpper, numberRows, COIN_DBL_MAX); CoinFillN(columnLower, numberColumns, 0.0); CoinFillN(columnUpper, numberColumns, COIN_DBL_MAX); CoinFillN(objective, numberColumns, 0.0); CoinFillN(integerType, numberColumns, 0); int n = 0; for (int iBlock = 0; iBlock < numberRowBlocks; iBlock++) { int k = rowBase[iBlock]; rowBase[iBlock] = n; assert (k >= 0); // block number int jBlock = whichRow[numberRows+iBlock]; if (originalOrder) { memcpy(whichRow + n, coinModel.coinBlock(jBlock)->originalRows(), k * sizeof(int)); } else { CoinIotaN(whichRow + n, k, n); } n += k; } assert (n == numberRows); n = 0; for (int iBlock = 0; iBlock < numberColumnBlocks; iBlock++) { int k = columnBase[iBlock]; columnBase[iBlock] = n; assert (k >= 0); if (k) { // block number int jBlock = whichColumn[numberColumns+iBlock]; if (originalOrder) { memcpy(whichColumn + n, coinModel.coinBlock(jBlock)->originalColumns(), k * sizeof(int)); } else { CoinIotaN(whichColumn + n, k, n); } n += k; } } assert (n == numberColumns); bool gotIntegers = false; for (int iBlock = 0; iBlock < numberElementBlocks; iBlock++) { CoinModel * block = coinModel.coinBlock(iBlock); const CoinModelBlockInfo & info = coinModel.blockType(iBlock); int iRowBlock = info.rowBlock; int iRowBase = rowBase[iRowBlock]; int iColumnBlock = info.columnBlock; int iColumnBase = columnBase[iColumnBlock]; if (info.rhs) { int nRows = block->numberRows(); const double * lower = block->rowLowerArray(); const double * upper = block->rowUpperArray(); for (int i = 0; i < nRows; i++) { int put = whichRow[i+iRowBase]; rowLower[put] = lower[i]; rowUpper[put] = upper[i]; } } if (info.bounds) { int nColumns = block->numberColumns(); const double * lower = block->columnLowerArray(); const double * upper = block->columnUpperArray(); const double * obj = block->objectiveArray(); for (int i = 0; i < nColumns; i++) { int put = whichColumn[i+iColumnBase]; columnLower[put] = lower[i]; columnUpper[put] = upper[i]; objective[put] = obj[i]; } } if (info.integer) { gotIntegers = true; int nColumns = block->numberColumns(); const int * type = block->integerTypeArray(); for (int i = 0; i < nColumns; i++) { int put = whichColumn[i+iColumnBase]; integerType[put] = type[i]; } } } gutsOfLoadModel(numberRows, numberColumns, columnLower, columnUpper, objective, rowLower, rowUpper, NULL); delete [] rowLower; delete [] rowUpper; delete [] columnLower; delete [] columnUpper; delete [] objective; // Do integers if wanted if (gotIntegers) { for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (integerType[iColumn]) setInteger(iColumn); } } delete [] integerType; setObjectiveOffset(coinModel.objectiveOffset()); // Space for elements int * row = new int[numberElements]; int * column = new int[numberElements]; double * element = new double[numberElements]; numberElements = 0; for (int iBlock = 0; iBlock < numberElementBlocks; iBlock++) { CoinModel * block = coinModel.coinBlock(iBlock); const CoinModelBlockInfo & info = coinModel.blockType(iBlock); int iRowBlock = info.rowBlock; int iRowBase = rowBase[iRowBlock]; int iColumnBlock = info.columnBlock; int iColumnBase = columnBase[iColumnBlock]; if (info.rowName) { int numberItems = block->rowNames()->numberItems(); assert( block->numberRows() >= numberItems); if (numberItems) { const char *const * rowNames = block->rowNames()->names(); for (int i = 0; i < numberItems; i++) { int put = whichRow[i+iRowBase]; std::string name = rowNames[i]; setRowName(put, name); } } } if (info.columnName) { int numberItems = block->columnNames()->numberItems(); assert( block->numberColumns() >= numberItems); if (numberItems) { const char *const * columnNames = block->columnNames()->names(); for (int i = 0; i < numberItems; i++) { int put = whichColumn[i+iColumnBase]; std::string name = columnNames[i]; setColumnName(put, name); } } } if (info.matrix) { CoinPackedMatrix matrix2; const CoinPackedMatrix * matrix = block->packedMatrix(); if (!matrix) { double * associated = block->associatedArray(); block->createPackedMatrix(matrix2, associated); matrix = &matrix2; } // get matrix data pointers const int * row2 = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); const int * columnLength = matrix->getVectorLengths(); int n = matrix->getNumCols(); assert (matrix->isColOrdered()); for (int iColumn = 0; iColumn < n; iColumn++) { CoinBigIndex j; int jColumn = whichColumn[iColumn+iColumnBase]; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { row[numberElements] = whichRow[row2[j] + iRowBase]; column[numberElements] = jColumn; element[numberElements++] = elementByColumn[j]; } } } } delete [] whichRow; delete [] whichColumn; delete [] rowBase; delete [] columnBase; CoinPackedMatrix * matrix = new CoinPackedMatrix (true, row, column, element, numberElements); matrix_ = new ClpPackedMatrix(matrix); matrix_->setDimensions(numberRows, numberColumns); delete [] row; delete [] column; delete [] element; createStatus(); if (status) { // copy back CoinMemcpyN(status, numberRows_ + numberColumns_, status_); CoinMemcpyN(psol, numberColumns_, columnActivity_); CoinMemcpyN(psol + numberColumns_, numberRows_, rowActivity_); CoinMemcpyN(dsol, numberColumns_, reducedCost_); CoinMemcpyN(dsol + numberColumns_, numberRows_, dual_); delete [] status; delete [] psol; delete [] dsol; } optimizationDirection_ = coinModel.optimizationDirection(); return returnCode; } /* If input negative scales objective so maximum <= -value and returns scale factor used. If positive unscales and also redoes dual stuff */ double ClpSimplex::scaleObjective(double value) { double * obj = objective(); double largest = 0.0; if (value < 0.0) { value = - value; for (int i = 0; i < numberColumns_; i++) { largest = CoinMax(largest, fabs(obj[i])); } if (largest > value) { double scaleFactor = value / largest; for (int i = 0; i < numberColumns_; i++) { obj[i] *= scaleFactor; reducedCost_[i] *= scaleFactor; } for (int i = 0; i < numberRows_; i++) { dual_[i] *= scaleFactor; } largest /= value; } else { // no need largest = 1.0; } } else { // at end if (value != 1.0) { for (int i = 0; i < numberColumns_; i++) { obj[i] *= value; reducedCost_[i] *= value; } for (int i = 0; i < numberRows_; i++) { dual_[i] *= value; } computeObjectiveValue(); } } return largest; } // Solve using Dantzig-Wolfe decomposition and maybe in parallel int ClpSimplex::solveDW(CoinStructuredModel * model,ClpSolve & options) { double time1 = CoinCpuTime(); int numberColumns = model->numberColumns(); int numberRowBlocks = model->numberRowBlocks(); int numberColumnBlocks = model->numberColumnBlocks(); int numberElementBlocks = model->numberElementBlocks(); // We already have top level structure CoinModelBlockInfo * blockInfo = new CoinModelBlockInfo [numberElementBlocks]; for (int i = 0; i < numberElementBlocks; i++) { CoinModel * thisBlock = model->coinBlock(i); assert (thisBlock); // just fill in info CoinModelBlockInfo info = CoinModelBlockInfo(); int whatsSet = thisBlock->whatIsSet(); info.matrix = static_cast(((whatsSet & 1) != 0) ? 1 : 0); info.rhs = static_cast(((whatsSet & 2) != 0) ? 1 : 0); info.rowName = static_cast(((whatsSet & 4) != 0) ? 1 : 0); info.integer = static_cast(((whatsSet & 32) != 0) ? 1 : 0); info.bounds = static_cast(((whatsSet & 8) != 0) ? 1 : 0); info.columnName = static_cast(((whatsSet & 16) != 0) ? 1 : 0); // Which block int iRowBlock = model->rowBlock(thisBlock->getRowBlock()); info.rowBlock = iRowBlock; int iColumnBlock = model->columnBlock(thisBlock->getColumnBlock()); info.columnBlock = iColumnBlock; blockInfo[i] = info; } // make up problems int numberBlocks = numberRowBlocks - 1; // Find master rows and columns int * rowCounts = new int [numberRowBlocks]; CoinZeroN(rowCounts, numberRowBlocks); int * columnCounts = new int [numberColumnBlocks+1]; CoinZeroN(columnCounts, numberColumnBlocks); int iBlock; for (iBlock = 0; iBlock < numberElementBlocks; iBlock++) { int iRowBlock = blockInfo[iBlock].rowBlock; rowCounts[iRowBlock]++; int iColumnBlock = blockInfo[iBlock].columnBlock; columnCounts[iColumnBlock]++; } int * whichBlock = new int [numberElementBlocks]; int masterRowBlock = -1; for (iBlock = 0; iBlock < numberRowBlocks; iBlock++) { if (rowCounts[iBlock] > 1) { if (masterRowBlock == -1) { masterRowBlock = iBlock; } else { // Can't decode masterRowBlock = -2; break; } } } int masterColumnBlock = -1; int kBlock = 0; for (iBlock = 0; iBlock < numberColumnBlocks; iBlock++) { int count = columnCounts[iBlock]; columnCounts[iBlock] = kBlock; kBlock += count; } for (iBlock = 0; iBlock < numberElementBlocks; iBlock++) { int iColumnBlock = blockInfo[iBlock].columnBlock; whichBlock[columnCounts[iColumnBlock]] = iBlock; columnCounts[iColumnBlock]++; } for (iBlock = numberColumnBlocks - 1; iBlock >= 0; iBlock--) columnCounts[iBlock+1] = columnCounts[iBlock]; columnCounts[0] = 0; for (iBlock = 0; iBlock < numberColumnBlocks; iBlock++) { int count = columnCounts[iBlock+1] - columnCounts[iBlock]; if (count == 1) { int kBlock = whichBlock[columnCounts[iBlock]]; int iRowBlock = blockInfo[kBlock].rowBlock; if (iRowBlock == masterRowBlock) { if (masterColumnBlock == -1) { masterColumnBlock = iBlock; } else { // Can't decode masterColumnBlock = -2; break; } } } } if (masterRowBlock < 0 || masterColumnBlock == -2) { // What now abort(); } delete [] rowCounts; // create all data const CoinPackedMatrix ** top = new const CoinPackedMatrix * [numberColumnBlocks]; ClpSimplex * sub = new ClpSimplex [numberBlocks]; ClpSimplex master; // Set offset master.setObjectiveOffset(model->objectiveOffset()); bool reducePrint = logLevel()==7; if (reducePrint) { // special setLogLevel(1); master.setLogLevel(1); } kBlock = 0; int masterBlock = -1; for (iBlock = 0; iBlock < numberColumnBlocks; iBlock++) { top[kBlock] = NULL; int start = columnCounts[iBlock]; int end = columnCounts[iBlock+1]; assert (end - start <= 2); for (int j = start; j < end; j++) { int jBlock = whichBlock[j]; int iRowBlock = blockInfo[jBlock].rowBlock; int iColumnBlock = blockInfo[jBlock].columnBlock; assert (iColumnBlock == iBlock); if (iColumnBlock != masterColumnBlock && iRowBlock == masterRowBlock) { // top matrix top[kBlock] = model->coinBlock(jBlock)->packedMatrix(); } else { const CoinPackedMatrix * matrix = model->coinBlock(jBlock)->packedMatrix(); // Get pointers to arrays const double * rowLower; const double * rowUpper; const double * columnLower; const double * columnUpper; const double * objective; model->block(iRowBlock, iColumnBlock, rowLower, rowUpper, columnLower, columnUpper, objective); if (iColumnBlock != masterColumnBlock) { // diagonal block sub[kBlock].loadProblem(*matrix, columnLower, columnUpper, objective, rowLower, rowUpper); if (true) { double * lower = sub[kBlock].columnLower(); double * upper = sub[kBlock].columnUpper(); int n = sub[kBlock].numberColumns(); for (int i = 0; i < n; i++) { lower[i] = CoinMax(-1.0e8, lower[i]); upper[i] = CoinMin(1.0e8, upper[i]); } } if (optimizationDirection_ < 0.0) { double * obj = sub[kBlock].objective(); int n = sub[kBlock].numberColumns(); for (int i = 0; i < n; i++) obj[i] = - obj[i]; } if (this->factorizationFrequency() == 200) { // User did not touch preset sub[kBlock].defaultFactorizationFrequency(); } else { // make sure model has correct value sub[kBlock].setFactorizationFrequency(this->factorizationFrequency()); } sub[kBlock].setPerturbation(50); // Set columnCounts to be diagonal block index for cleanup columnCounts[kBlock] = jBlock; } else { // master masterBlock = jBlock; master.loadProblem(*matrix, columnLower, columnUpper, objective, rowLower, rowUpper); if (optimizationDirection_ < 0.0) { double * obj = master.objective(); int n = master.numberColumns(); for (int i = 0; i < n; i++) obj[i] = - obj[i]; } } } } if (iBlock != masterColumnBlock) kBlock++; } delete [] whichBlock; delete [] blockInfo; // For now master must have been defined (does not have to have columns) assert (master.numberRows()); assert (masterBlock >= 0); int numberMasterRows = master.numberRows(); // Overkill in terms of space int spaceNeeded = CoinMax(numberBlocks * (numberMasterRows + 1), 2 * numberMasterRows); int * rowAdd = new int[spaceNeeded]; double * elementAdd = new double[spaceNeeded]; spaceNeeded = numberBlocks; int * columnAdd = new int[spaceNeeded+1]; double * objective = new double[spaceNeeded]; // Add in costed slacks int firstArtificial = master.numberColumns(); int lastArtificial = firstArtificial; if (true) { const double * lower = master.rowLower(); const double * upper = master.rowUpper(); int kCol = 0; for (int iRow = 0; iRow < numberMasterRows; iRow++) { if (lower[iRow] > -1.0e10) { rowAdd[kCol] = iRow; elementAdd[kCol++] = 1.0; } if (upper[iRow] < 1.0e10) { rowAdd[kCol] = iRow; elementAdd[kCol++] = -1.0; } } if (kCol > spaceNeeded) { spaceNeeded = kCol; delete [] columnAdd; delete [] objective; columnAdd = new int[spaceNeeded+1]; objective = new double[spaceNeeded]; } for (int i = 0; i < kCol; i++) { columnAdd[i] = i; objective[i] = 1.0e13; } columnAdd[kCol] = kCol; master.addColumns(kCol, NULL, NULL, objective, columnAdd, rowAdd, elementAdd); lastArtificial = master.numberColumns(); } int maxPass = options.independentOption(2); if (maxPass<2) maxPass=100; int iPass; double lastObjective = 1.0e31; // Create convexity rows for proposals int numberMasterColumns = master.numberColumns(); master.resize(numberMasterRows + numberBlocks, numberMasterColumns); if (this->factorizationFrequency() == 200) { // User did not touch preset master.defaultFactorizationFrequency(); } else { // make sure model has correct value master.setFactorizationFrequency(this->factorizationFrequency()); } master.setPerturbation(50); // Arrays to say which block and when created int maximumColumns = 2 * numberMasterRows + 10 * numberBlocks; whichBlock = new int[maximumColumns]; int * when = new int[maximumColumns]; int numberColumnsGenerated = numberBlocks; // fill in rhs and add in artificials { double * rowLower = master.rowLower(); double * rowUpper = master.rowUpper(); int iBlock; columnAdd[0] = 0; for (iBlock = 0; iBlock < numberBlocks; iBlock++) { int iRow = iBlock + numberMasterRows;; rowLower[iRow] = 1.0; rowUpper[iRow] = 1.0; rowAdd[iBlock] = iRow; elementAdd[iBlock] = 1.0; objective[iBlock] = 1.0e13; columnAdd[iBlock+1] = iBlock + 1; when[iBlock] = -1; whichBlock[iBlock] = iBlock; } master.addColumns(numberBlocks, NULL, NULL, objective, columnAdd, rowAdd, elementAdd); } char generalPrint[200]; // and resize matrix to double check clp will be happy //master.matrix()->setDimensions(numberMasterRows+numberBlocks, // numberMasterColumns+numberBlocks); sprintf(generalPrint,"Time to decompose %.2f seconds",CoinCpuTime() - time1); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; for (iPass = 0; iPass < maxPass; iPass++) { sprintf(generalPrint,"Start of pass %d", iPass); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; // Solve master - may be infeasible //master.scaling(0); if (0) { master.writeMps("yy.mps"); } // Correct artificials double sumArtificials = 0.0; if (iPass) { double * upper = master.columnUpper(); double * solution = master.primalColumnSolution(); double * obj = master.objective(); sumArtificials = 0.0; for (int i = firstArtificial; i < lastArtificial; i++) { sumArtificials += solution[i]; //assert (solution[i]>-1.0e-2); if (solution[i] < 1.0e-6) { #if 0 // Could take out obj[i] = 0.0; upper[i] = 0.0; #else obj[i] = 1.0e7; upper[i] = 1.0e-1; #endif solution[i] = 0.0; master.setColumnStatus(i, isFixed); } else { upper[i] = solution[i] + 1.0e-5 * (1.0 + solution[i]); } } sprintf(generalPrint,"Sum of artificials before solve is %g", sumArtificials); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; } // scale objective to be reasonable double scaleFactor = master.scaleObjective(-1.0e9); { double * dual = master.dualRowSolution(); int n = master.numberRows(); memset(dual, 0, n * sizeof(double)); double * solution = master.primalColumnSolution(); master.clpMatrix()->times(1.0, solution, dual); double sum = 0.0; double * lower = master.rowLower(); double * upper = master.rowUpper(); for (int iRow = 0; iRow < n; iRow++) { double value = dual[iRow]; if (value > upper[iRow]) sum += value - upper[iRow]; else if (value < lower[iRow]) sum -= value - lower[iRow]; } printf("** suminf %g\n", sum); lower = master.columnLower(); upper = master.columnUpper(); n = master.numberColumns(); for (int iColumn = 0; iColumn < n; iColumn++) { double value = solution[iColumn]; if (value > upper[iColumn] + 1.0e-5) sum += value - upper[iColumn]; else if (value < lower[iColumn] - 1.0e-5) sum -= value - lower[iColumn]; } printf("** suminf %g\n", sum); } master.primal(1); // Correct artificials sumArtificials = 0.0; { double * solution = master.primalColumnSolution(); for (int i = firstArtificial; i < lastArtificial; i++) { sumArtificials += solution[i]; } printf("** Sum of artificials after solve is %g\n", sumArtificials); } master.scaleObjective(scaleFactor); int problemStatus = master.status(); // do here as can change (delcols) if (problemStatus == 2 && master.numberColumns()) { master.primal(1); if (problemStatus==2) { int numberColumns = master.numberColumns(); double * lower = master.columnLower(); double * upper = master.columnUpper(); for (int i=0;i lastObjective - 1.0e-7 && iPass > 555) break; // finished lastObjective = master.objectiveValue(); // mark basic ones and delete if necessary int iColumn; numberColumnsGenerated = master.numberColumns() - numberMasterColumns; for (iColumn = 0; iColumn < numberColumnsGenerated; iColumn++) { if (master.getStatus(iColumn + numberMasterColumns) == ClpSimplex::basic) when[iColumn] = iPass; } if (numberColumnsGenerated + numberBlocks > maximumColumns) { // delete int numberKeep = 0; int numberDelete = 0; int * whichDelete = new int[numberColumnsGenerated]; for (iColumn = 0; iColumn < numberColumnsGenerated; iColumn++) { if (when[iColumn] > iPass - 7) { // keep when[numberKeep] = when[iColumn]; whichBlock[numberKeep++] = whichBlock[iColumn]; } else { // delete whichDelete[numberDelete++] = iColumn + numberMasterColumns; } } numberColumnsGenerated -= numberDelete; master.deleteColumns(numberDelete, whichDelete); delete [] whichDelete; } const double * dual = NULL; bool deleteDual = false; if (problemStatus == 0) { dual = master.dualRowSolution(); } else if (problemStatus == 1) { // could do composite objective dual = master.infeasibilityRay(); deleteDual = true; printf("** The sum of infeasibilities is %g\n", master.sumPrimalInfeasibilities()); } else if (!master.numberColumns()) { assert(!iPass); dual = master.dualRowSolution(); memset(master.dualRowSolution(), 0, (numberMasterRows + numberBlocks)*sizeof(double)); } else { master.writeMps("unbounded.mps"); abort(); } // Scale back on first time if (!iPass) { double * dual2 = master.dualRowSolution(); for (int i = 0; i < numberMasterRows + numberBlocks; i++) { dual2[i] *= 1.0e-7; } dual = master.dualRowSolution(); } // Create objective for sub problems and solve columnAdd[0] = 0; int numberProposals = 0; for (iBlock = 0; iBlock < numberBlocks; iBlock++) { int numberColumns2 = sub[iBlock].numberColumns(); double * saveObj = new double [numberColumns2]; double * objective2 = sub[iBlock].objective(); memcpy(saveObj, objective2, numberColumns2 * sizeof(double)); // new objective top[iBlock]->transposeTimes(dual, objective2); int i; if (problemStatus == 0) { for (i = 0; i < numberColumns2; i++) objective2[i] = saveObj[i] - objective2[i]; } else { for (i = 0; i < numberColumns2; i++) objective2[i] = -objective2[i]; } // scale objective to be reasonable double scaleFactor = sub[iBlock].scaleObjective((sumArtificials > 1.0e-5) ? -1.0e-4 : -1.0e9); if (reducePrint) sub[iBlock].setLogLevel(0); if (iPass) { sub[iBlock].primal(); } else { sub[iBlock].dual(); } sub[iBlock].scaleObjective(scaleFactor); if (!sub[iBlock].isProvenOptimal() && !sub[iBlock].isProvenDualInfeasible()) { memset(objective2, 0, numberColumns2 * sizeof(double)); sub[iBlock].primal(); if (problemStatus == 0) { for (i = 0; i < numberColumns2; i++) objective2[i] = saveObj[i] - objective2[i]; } else { for (i = 0; i < numberColumns2; i++) objective2[i] = -objective2[i]; } double scaleFactor = sub[iBlock].scaleObjective(-1.0e9); sub[iBlock].primal(1); sub[iBlock].scaleObjective(scaleFactor); } memcpy(objective2, saveObj, numberColumns2 * sizeof(double)); // get proposal if (sub[iBlock].numberIterations() || !iPass) { double objValue = 0.0; int start = columnAdd[numberProposals]; // proposal if (sub[iBlock].isProvenOptimal()) { const double * solution = sub[iBlock].primalColumnSolution(); top[iBlock]->times(solution, elementAdd + start); for (i = 0; i < numberColumns2; i++) objValue += solution[i] * saveObj[i]; // See if good dj and pack down int number = start; double dj = objValue; if (problemStatus) dj = 0.0; double smallest = 1.0e100; double largest = 0.0; for (i = 0; i < numberMasterRows; i++) { double value = elementAdd[start+i]; if (fabs(value) > 1.0e-15) { dj -= dual[i] * value; smallest = CoinMin(smallest, fabs(value)); largest = CoinMax(largest, fabs(value)); rowAdd[number] = i; elementAdd[number++] = value; } } // and convexity dj -= dual[numberMasterRows+iBlock]; rowAdd[number] = numberMasterRows + iBlock; elementAdd[number++] = 1.0; // if elements large then scale? //if (largest>1.0e8||smallest<1.0e-8) sprintf(generalPrint,"For subproblem %d smallest - %g, largest %g - dj %g", iBlock, smallest, largest, dj); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; if (dj < -1.0e-6 || !iPass) { // take objective[numberProposals] = objValue; columnAdd[++numberProposals] = number; when[numberColumnsGenerated] = iPass; whichBlock[numberColumnsGenerated++] = iBlock; } } else if (sub[iBlock].isProvenDualInfeasible()) { // use ray const double * solution = sub[iBlock].unboundedRay(); top[iBlock]->times(solution, elementAdd + start); for (i = 0; i < numberColumns2; i++) objValue += solution[i] * saveObj[i]; // See if good dj and pack down int number = start; double dj = objValue; double smallest = 1.0e100; double largest = 0.0; for (i = 0; i < numberMasterRows; i++) { double value = elementAdd[start+i]; if (fabs(value) > 1.0e-15) { dj -= dual[i] * value; smallest = CoinMin(smallest, fabs(value)); largest = CoinMax(largest, fabs(value)); rowAdd[number] = i; elementAdd[number++] = value; } } // if elements large or small then scale? //if (largest>1.0e8||smallest<1.0e-8) sprintf(generalPrint,"For subproblem ray %d smallest - %g, largest %g - dj %g", iBlock, smallest, largest, dj); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; if (dj < -1.0e-6) { // take objective[numberProposals] = objValue; columnAdd[++numberProposals] = number; when[numberColumnsGenerated] = iPass; whichBlock[numberColumnsGenerated++] = iBlock; } } else { abort(); } } delete [] saveObj; } if (deleteDual) delete [] dual; if (numberProposals) master.addColumns(numberProposals, NULL, NULL, objective, columnAdd, rowAdd, elementAdd); } sprintf(generalPrint,"Time at end of D-W %.2f seconds",CoinCpuTime() - time1); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; //master.scaling(0); //master.primal(1); loadProblem(*model); // now put back a good solution double * lower = new double[numberMasterRows+numberBlocks]; double * upper = new double[numberMasterRows+numberBlocks]; numberColumnsGenerated += numberMasterColumns; double * sol = new double[numberColumnsGenerated]; const double * solution = master.primalColumnSolution(); const double * masterLower = master.rowLower(); const double * masterUpper = master.rowUpper(); double * fullSolution = primalColumnSolution(); const double * fullLower = columnLower(); const double * fullUpper = columnUpper(); const double * rowSolution = master.primalRowSolution(); double * fullRowSolution = primalRowSolution(); const int * rowBack = model->coinBlock(masterBlock)->originalRows(); int numberRows2 = model->coinBlock(masterBlock)->numberRows(); const int * columnBack = model->coinBlock(masterBlock)->originalColumns(); int numberColumns2 = model->coinBlock(masterBlock)->numberColumns(); for (int iRow = 0; iRow < numberRows2; iRow++) { int kRow = rowBack[iRow]; setRowStatus(kRow, master.getRowStatus(iRow)); fullRowSolution[kRow] = rowSolution[iRow]; } for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { int kColumn = columnBack[iColumn]; setStatus(kColumn, master.getStatus(iColumn)); fullSolution[kColumn] = solution[iColumn]; } for (iBlock = 0; iBlock < numberBlocks; iBlock++) { // move basis int kBlock = columnCounts[iBlock]; const int * rowBack = model->coinBlock(kBlock)->originalRows(); int numberRows2 = model->coinBlock(kBlock)->numberRows(); const int * columnBack = model->coinBlock(kBlock)->originalColumns(); int numberColumns2 = model->coinBlock(kBlock)->numberColumns(); for (int iRow = 0; iRow < numberRows2; iRow++) { int kRow = rowBack[iRow]; setRowStatus(kRow, sub[iBlock].getRowStatus(iRow)); } for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { int kColumn = columnBack[iColumn]; setStatus(kColumn, sub[iBlock].getStatus(iColumn)); } // convert top bit to by rows CoinPackedMatrix topMatrix = *top[iBlock]; topMatrix.reverseOrdering(); // zero solution memset(sol, 0, numberColumnsGenerated * sizeof(double)); for (int i = numberMasterColumns; i < numberColumnsGenerated; i++) { if (whichBlock[i-numberMasterColumns] == iBlock) sol[i] = solution[i]; } memset(lower, 0, (numberMasterRows + numberBlocks)*sizeof(double)); master.clpMatrix()->times(1.0, sol, lower); for (int iRow = 0; iRow < numberMasterRows; iRow++) { double value = lower[iRow]; if (masterUpper[iRow] < 1.0e20) upper[iRow] = value; else upper[iRow] = COIN_DBL_MAX; if (masterLower[iRow] > -1.0e20) lower[iRow] = value; else lower[iRow] = -COIN_DBL_MAX; } sub[iBlock].addRows(numberMasterRows, lower, upper, topMatrix.getVectorStarts(), topMatrix.getVectorLengths(), topMatrix.getIndices(), topMatrix.getElements()); sub[iBlock].primal(1); const double * subSolution = sub[iBlock].primalColumnSolution(); const double * subRowSolution = sub[iBlock].primalRowSolution(); // move solution for (int iRow = 0; iRow < numberRows2; iRow++) { int kRow = rowBack[iRow]; fullRowSolution[kRow] = subRowSolution[iRow]; } for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { int kColumn = columnBack[iColumn]; fullSolution[kColumn] = subSolution[iColumn]; } } for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (fullSolution[iColumn] < fullUpper[iColumn] - 1.0e-8 && fullSolution[iColumn] > fullLower[iColumn] + 1.0e-8) { if (getStatus(iColumn) != ClpSimplex::basic) { if (columnLower_[iColumn] > -1.0e30 || columnUpper_[iColumn] < 1.0e30) setStatus(iColumn, ClpSimplex::superBasic); else setStatus(iColumn, ClpSimplex::isFree); } } else if (fullSolution[iColumn] >= fullUpper[iColumn] - 1.0e-8) { // may help to make rest non basic if (getStatus(iColumn) != ClpSimplex::basic) setStatus(iColumn, ClpSimplex::atUpperBound); } else if (fullSolution[iColumn] <= fullLower[iColumn] + 1.0e-8) { // may help to make rest non basic if (getStatus(iColumn) != ClpSimplex::basic) setStatus(iColumn, ClpSimplex::atLowerBound); } } //int numberRows=model->numberRows(); //for (int iRow=0;iRowmessage(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; primal(1); sprintf(generalPrint,"Total time %.2f seconds",CoinCpuTime() - time1); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; delete [] columnCounts; delete [] sol; delete [] lower; delete [] upper; delete [] whichBlock; delete [] when; delete [] columnAdd; delete [] rowAdd; delete [] elementAdd; delete [] objective; delete [] top; delete [] sub; return 0; } static ClpSimplex * deBound(ClpSimplex * oldModel) { ClpSimplex * model = new ClpSimplex(*oldModel); int numberRows = model->numberRows(); CoinPackedMatrix * matrix = model->matrix(); const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); double * elementByColumn = matrix->getMutableElements(); int numberColumns = model->numberColumns(); double * rowLower = model->rowLower(); double * rowUpper = model->rowUpper(); double * columnLower = model->columnLower(); double * columnUpper = model->columnUpper(); double * objective = model->objective(); double * change = new double[CoinMax(numberRows,numberColumns)+numberColumns]; int * rowStart = new int [2*numberColumns+1]; memset(change,0,numberRows*sizeof(double)); // first swap ones with infinite lower bounds for (int iColumn=0;iColumn-COIN_DBL_MAX) rowLower[iRow]-=value; if (rowUpper[iRow]addRows(nExtra, NULL, change, rowStart, columnNew, elementNew); delete [] rowStart; delete [] change; return model; } #if defined(ABC_INHERIT) || defined(CBC_THREAD) || defined(THREADS_IN_ANALYZE) void * clp_parallelManager(void * stuff) { CoinPthreadStuff * driver = reinterpret_cast(stuff); int whichThread=driver->whichThread(); CoinThreadInfo * threadInfo = driver->threadInfoPointer(whichThread); threadInfo->status=-1; int * which = threadInfo->stuff; #ifdef PTHREAD_BARRIER_SERIAL_THREAD pthread_barrier_wait(driver->barrierPointer()); #endif #if 0 int status=-1; while (status!=100) status=timedWait(driver,1000,2); pthread_cond_signal(driver->conditionPointer(1)); pthread_mutex_unlock(driver->mutexPointer(1,whichThread)); #endif // so now mutex_ is locked int whichLocked=0; while (true) { pthread_mutex_t * mutexPointer = driver->mutexPointer(whichLocked,whichThread); // wait //printf("Child waiting for %d - status %d %d %d\n", // whichLocked,lockedX[0],lockedX[1],lockedX[2]); #ifdef DETAIL_THREAD printf("thread %d about to lock mutex %d\n",whichThread,whichLocked); #endif pthread_mutex_lock (mutexPointer); whichLocked++; if (whichLocked==3) whichLocked=0; int unLock=whichLocked+1; if (unLock==3) unLock=0; //printf("child pointer %x status %d\n",threadInfo,threadInfo->status); assert(threadInfo->status>=0); if (threadInfo->status==1000) pthread_exit(NULL); int type=threadInfo->status; int & returnCode=which[0]; int iPass=which[1]; ClpSimplex * clpSimplex = reinterpret_cast(threadInfo->extraInfo); //CoinIndexedVector * array; //double dummy; switch(type) { // dummy case 0: break; case 1: if (!clpSimplex->problemStatus()||!iPass) returnCode=clpSimplex->dual(); else returnCode=clpSimplex->primal(); break; case 100: // initialization break; } threadInfo->status=-1; #ifdef DETAIL_THREAD printf("thread %d about to unlock mutex %d\n",whichThread,unLock); #endif pthread_mutex_unlock (driver->mutexPointer(unLock,whichThread)); } } CoinPthreadStuff::CoinPthreadStuff(int numberThreads, void * parallelManager(void * stuff)) { numberThreads_=numberThreads; if (numberThreads>8) numberThreads=1; // For waking up thread memset(mutex_,0,sizeof(mutex_)); for (int iThread=0;iThread(this)); } #ifdef PTHREAD_BARRIER_SERIAL_THREAD pthread_barrier_wait(&barrier_); pthread_barrier_destroy(&barrier_); #endif for (int iThread=0;iThread=3) locked-=3; #ifdef DETAIL_THREAD printf("Main do thread %d about to lock mutex %d\n",iThread,locked); #endif pthread_mutex_lock(&mutex_[locked+iThread*3]); locked_[iThread]++; if (locked_[iThread]==3) locked_[iThread]=0; threadInfo_[iThread].stuff[3]=1; // say idle return threadInfo_[iThread].stuff[0]; } void CoinPthreadStuff::waitAllTasks() { int nWait=0; for (int iThread=0;iThreadwriteMps("nobounds.mps"); //delete xxxx; //int numberColumns = model->numberColumns(); int numberRowBlocks = model->numberRowBlocks(); int numberColumnBlocks = model->numberColumnBlocks(); int numberElementBlocks = model->numberElementBlocks(); char generalPrint[200]; // We already have top level structure CoinModelBlockInfo * blockInfo = new CoinModelBlockInfo [numberElementBlocks]; for (int i = 0; i < numberElementBlocks; i++) { CoinModel * thisBlock = model->coinBlock(i); assert (thisBlock); // just fill in info CoinModelBlockInfo info = CoinModelBlockInfo(); int whatsSet = thisBlock->whatIsSet(); info.matrix = static_cast(((whatsSet & 1) != 0) ? 1 : 0); info.rhs = static_cast(((whatsSet & 2) != 0) ? 1 : 0); info.rowName = static_cast(((whatsSet & 4) != 0) ? 1 : 0); info.integer = static_cast(((whatsSet & 32) != 0) ? 1 : 0); info.bounds = static_cast(((whatsSet & 8) != 0) ? 1 : 0); info.columnName = static_cast(((whatsSet & 16) != 0) ? 1 : 0); // Which block int iRowBlock = model->rowBlock(thisBlock->getRowBlock()); info.rowBlock = iRowBlock; int iColumnBlock = model->columnBlock(thisBlock->getColumnBlock()); info.columnBlock = iColumnBlock; blockInfo[i] = info; } // make up problems int numberBlocks = numberColumnBlocks - 1; // Find master columns and rows int * columnCounts = new int [numberColumnBlocks]; CoinZeroN(columnCounts, numberColumnBlocks); int * rowCounts = new int [numberRowBlocks+1]; CoinZeroN(rowCounts, numberRowBlocks); int iBlock; for (iBlock = 0; iBlock < numberElementBlocks; iBlock++) { int iColumnBlock = blockInfo[iBlock].columnBlock; columnCounts[iColumnBlock]++; int iRowBlock = blockInfo[iBlock].rowBlock; rowCounts[iRowBlock]++; } int * whichBlock = new int [numberElementBlocks]; int masterColumnBlock = -1; for (iBlock = 0; iBlock < numberColumnBlocks; iBlock++) { if (columnCounts[iBlock] > 1) { if (masterColumnBlock == -1) { masterColumnBlock = iBlock; } else { // Can't decode masterColumnBlock = -2; break; } } } int masterRowBlock = -1; int kBlock = 0; for (iBlock = 0; iBlock < numberRowBlocks; iBlock++) { int count = rowCounts[iBlock]; rowCounts[iBlock] = kBlock; kBlock += count; } for (iBlock = 0; iBlock < numberElementBlocks; iBlock++) { int iRowBlock = blockInfo[iBlock].rowBlock; whichBlock[rowCounts[iRowBlock]] = iBlock; rowCounts[iRowBlock]++; } for (iBlock = numberRowBlocks - 1; iBlock >= 0; iBlock--) rowCounts[iBlock+1] = rowCounts[iBlock]; rowCounts[0] = 0; for (iBlock = 0; iBlock < numberRowBlocks; iBlock++) { int count = rowCounts[iBlock+1] - rowCounts[iBlock]; if (count == 1) { int kBlock = whichBlock[rowCounts[iBlock]]; int iColumnBlock = blockInfo[kBlock].columnBlock; if (iColumnBlock == masterColumnBlock) { if (masterRowBlock == -1) { masterRowBlock = iBlock; } else { // Can't decode masterRowBlock = -2; break; } } } } if (masterColumnBlock < 0 || masterRowBlock == -2) { // What now abort(); } delete [] columnCounts; // create all data const CoinPackedMatrix ** first = new const CoinPackedMatrix * [numberRowBlocks]; ClpSimplex * sub = new ClpSimplex [numberBlocks]; ClpSimplex masterModel; // Set offset masterModel.setObjectiveOffset(model->objectiveOffset()); kBlock = 0; #define ADD_ARTIFICIALS #ifdef ADD_ARTIFICIALS int * originalSubColumns = new int [numberBlocks]; for (iBlock = 0; iBlock < numberBlocks; iBlock++) originalSubColumns[iBlock]=9999999; #endif int masterBlock = -1; for (iBlock = 0; iBlock < numberRowBlocks; iBlock++) { first[kBlock] = NULL; int start = rowCounts[iBlock]; int end = rowCounts[iBlock+1]; assert (end - start <= 2); for (int j = start; j < end; j++) { int jBlock = whichBlock[j]; int iColumnBlock = blockInfo[jBlock].columnBlock; int iRowBlock = blockInfo[jBlock].rowBlock; assert (iRowBlock == iBlock); if (iRowBlock != masterRowBlock && iColumnBlock == masterColumnBlock) { // first matrix first[kBlock] = model->coinBlock(jBlock)->packedMatrix(); } else { const CoinPackedMatrix * matrix = model->coinBlock(jBlock)->packedMatrix(); // Get pointers to arrays const double * columnLower; const double * columnUpper; const double * rowLower; const double * rowUpper; const double * objective; model->block(iRowBlock, iColumnBlock, rowLower, rowUpper, columnLower, columnUpper, objective); if (iRowBlock != masterRowBlock) { // diagonal block sub[kBlock].loadProblem(*matrix, columnLower, columnUpper, objective, rowLower, rowUpper); if (optimizationDirection_ < 0.0) { double * obj = sub[kBlock].objective(); int n = sub[kBlock].numberColumns(); for (int i = 0; i < n; i++) obj[i] = - obj[i]; } if (this->factorizationFrequency() == 200) { // User did not touch preset sub[kBlock].defaultFactorizationFrequency(); } else { // make sure model has correct value sub[kBlock].setFactorizationFrequency(this->factorizationFrequency()); } sub[kBlock].setPerturbation(50); #ifdef ADD_ARTIFICIALS originalSubColumns[kBlock]=sub[kBlock].numberColumns(); if (intParam_[0]<1000000) { printf("** Adding artificials\n"); int nRow = sub[kBlock].numberRows(); int * addStarts = new int [2*nRow+1]; int * addRow = new int[2*nRow]; double * addElement = new double[2*nRow]; addStarts[0] = 0; int numberArtificials = 0; double penalty =1.0e5; double * addCost = new double [2*nRow]; const double * lower = sub[kBlock].rowLower(); const double * upper = sub[kBlock].rowUpper(); for (int iRow = 0; iRow < nRow; iRow++) { if (lower[iRow] > -1.0e20) { addRow[numberArtificials] = iRow; addElement[numberArtificials] = 1.0; addCost[numberArtificials] = penalty; numberArtificials++; addStarts[numberArtificials] = numberArtificials; } if (upper[iRow] < 1.0e20) { addRow[numberArtificials] = iRow; addElement[numberArtificials] = -1.0; addCost[numberArtificials] = penalty; numberArtificials++; addStarts[numberArtificials] = numberArtificials; } } if (numberArtificials) { sub[kBlock].addColumns(numberArtificials, NULL, NULL, addCost, addStarts, addRow, addElement); } delete [] addStarts; delete [] addRow; delete [] addElement; delete [] addCost; } #endif // Set rowCounts to be diagonal block index for cleanup rowCounts[kBlock] = jBlock; } else { // master masterBlock = jBlock; masterModel.loadProblem(*matrix, columnLower, columnUpper, objective, rowLower, rowUpper); if (optimizationDirection_ < 0.0) { double * obj = masterModel.objective(); int n = masterModel.numberColumns(); for (int i = 0; i < n; i++) obj[i] = - obj[i]; } } } } if (iBlock != masterRowBlock) kBlock++; } delete [] whichBlock; delete [] blockInfo; assert (masterBlock >= 0); int numberMasterColumns = masterModel.numberColumns(); masterModel.setStrParam(ClpProbName,"Master"); // Overkill in terms of space int spaceNeeded = CoinMax(numberBlocks * (numberMasterColumns + 1), 2 * numberMasterColumns); int * columnAdd = new int[spaceNeeded]; double * elementAdd = new double[spaceNeeded]; spaceNeeded = numberBlocks; int * rowAdd = new int[2*spaceNeeded+1]; // temp for block info int * blockPrint = rowAdd+spaceNeeded+1; double * objective = new double[spaceNeeded]; int logLevel=handler_->logLevel(); //#define TEST_MODEL #ifdef TEST_MODEL double goodValue=COIN_DBL_MAX; ClpSimplex goodModel; if (logLevel>3) { // temp - create copy with master at front const int * columnBack = model->coinBlock(masterBlock)->originalColumns(); int numberColumns2 = model->coinBlock(masterBlock)->numberColumns(); const int * rowBack = model->coinBlock(masterBlock)->originalRows(); int numberRows2 = model->coinBlock(masterBlock)->numberRows(); int * whichColumn = new int [numberColumns_+numberBlocks]; int * whichRow = new int [numberRows_]; int nColumn=0; for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { int kColumn = columnBack[iColumn]; whichColumn[nColumn++]=kColumn; } int nRow=0; for (int iRow = 0; iRow < numberRows2; iRow++) { int kRow = rowBack[iRow]; whichRow[nRow++]=kRow; } for (iBlock = 0; iBlock < numberBlocks; iBlock++) { int kBlock = rowCounts[iBlock]; const int * columnBack = model->coinBlock(kBlock)->originalColumns(); int numberColumns2 = model->coinBlock(kBlock)->numberColumns(); const int * rowBack = model->coinBlock(kBlock)->originalRows(); int numberRows2 = model->coinBlock(kBlock)->numberRows(); for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { int kColumn = columnBack[iColumn]; whichColumn[nColumn++]=kColumn; } for (int iRow = 0; iRow < numberRows2; iRow++) { int kRow = rowBack[iRow]; whichRow[nRow++]=kRow; } } ClpSimplex temp(this,nRow,whichRow,nColumn,whichColumn); temp.writeMps("ordered.mps"); for (int i=numberMasterColumns;ifactorizationFrequency() == 200) { // User did not touch preset masterModel.defaultFactorizationFrequency(); } else { // make sure model has correct value masterModel.setFactorizationFrequency(this->factorizationFrequency()); } masterModel.setPerturbation(50); // temp bounds if (0) { printf("temp bounds\n"); double * lower = masterModel.columnLower(); double * upper = masterModel.columnUpper(); for (int i=0;isetDetailMessage(2,6); sub[iBlock].messagesPointer()->setDetailMessage(2,14); sub[iBlock].messagesPointer()->setDetailMessage(2,0); } // scaling sub[iBlock].scaling(scalingFlag_); //sub[iBlock].scaling(0); } masterModel.addColumns(numberBlocks, NULL, NULL, objective, columnAdd, rowAdd, elementAdd); sprintf(generalPrint,"Time to decompose %.2f seconds",CoinCpuTime() - time1); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; int ixxxxxx=0; if (intParam_[0]>=100000&&intParam_[0]<100999) { ixxxxxx=intParam_[0]-100000; printf("ixxxxxx %d\n",ixxxxxx); } #ifdef ADD_ARTIFICIALS double ** saveObjective = new double * [numberBlocks]; for (int i=0;i0) { for (iBlock = 0; iBlock < CoinMin(numberBlocks,ixxxxxx); iBlock++) { ClpSimplex * temp = deBound(sub+iBlock); sub[iBlock]=*temp; delete temp; delete [] modification[iBlock]; int numberRows2 = sub[iBlock].numberRows(); int numberColumns2 = sub[iBlock].numberColumns(); int numberTotal2 = numberRows2+numberColumns2; modification[iBlock]=new double [2*numberTotal2+numberRows2]; double * save = modification[iBlock]; memcpy(save,sub[iBlock].rowLower(),numberRows2*sizeof(double)); save += numberRows2; memcpy(save,sub[iBlock].columnLower(),numberColumns2*sizeof(double)); save += numberColumns2; memcpy(save,sub[iBlock].rowUpper(),numberRows2*sizeof(double)); save += numberRows2; memcpy(save,sub[iBlock].columnUpper(),numberColumns2*sizeof(double)); } } #ifdef ABC_INHERIT //AbcSimplex abcMaster; //if (!this->abcState()) //setAbcState(1); int numberCpu=CoinMin((this->abcState()&15),4); CoinPthreadStuff threadInfo(numberCpu,clp_parallelManager); masterModel.setAbcState(this->abcState()); //AbcSimplex * tempMaster=masterModel.dealWithAbc(2,10,true); //abcMaster=*tempMaster; //delete tempMaster; //abcMaster.startThreads(numberCpu); //#define masterModel abcMaster #endif double treatSubAsFeasible=1.0e-6; int numberSubInfeasible=0; bool canSkipSubSolve=false; int numberProposals=999; for (iPass = 0; iPass < maxPass; iPass++) { sprintf(generalPrint,"Start of pass %d", iPass); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; // Solve master - may be unbounded //masterModel.scaling(0); // get obj for debug double objSum=masterModel.objectiveValue(); for (int i=0;imessage(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; #ifndef UNBOUNDED if(masterStatus==2) { // unbounded masterModel.writeMps("unbounded.mps"); // get primal feasible #ifdef ABC_INHERIT masterModel.dealWithAbc(1,1,true); #else masterModel.primal(); #endif const double * fullLower = columnLower(); const double * fullUpper = columnUpper(); double * lower = masterModel.columnLower(); double * upper = masterModel.columnUpper(); double * solution = masterModel.primalColumnSolution(); const int * columnBack = model->coinBlock(masterBlock)->originalColumns(); if (!numberTimesUnbounded) { for (int iColumn = 0; iColumn < numberMasterColumns; iColumn++) { int kColumn = columnBack[iColumn]; double value = solution[iColumn]; double lowerValue=CoinMax(fullLower[kColumn], CoinMin(value,fullUpper[kColumn])-trust); lower[iColumn]=lowerValue; double upperValue=CoinMin(fullUpper[kColumn], CoinMax(value,fullLower[kColumn])+trust); upper[iColumn]=upperValue; } #ifdef TEST_MODEL if (logLevel>3) { //use ones from solved const double * solutionGood = goodModel.primalColumnSolution(); for (int iColumn = 0; iColumn < numberMasterColumns; iColumn++) { double value = solutionGood[iColumn]; lower[iColumn]=CoinMin(value,-trust); upper[iColumn]=CoinMax(value,trust); } } #endif } else { abort(); // probably can happen } numberTimesUnbounded++; #ifdef ABC_INHERIT masterModel.dealWithAbc(0,0,true); #else masterModel.dual(); #endif masterStatus = masterModel.status(); assert (!masterStatus); masterModel.setNumberIterations(1); // so will continue } if (numberTimesUnbounded>1&&trust>0.0) { assert (!masterStatus); const double * fullLower = columnLower(); const double * fullUpper = columnUpper(); double * lower = masterModel.columnLower(); double * upper = masterModel.columnUpper(); //double * solution = masterModel.primalColumnSolution(); const int * columnBack = model->coinBlock(masterBlock)->originalColumns(); int nTrusted=0; for (int iColumn = 0; iColumn < numberMasterColumns; iColumn++) { int kColumn = columnBack[iColumn]; if (lower[iColumn]>fullLower[kColumn]) { if(masterModel.getColumnStatus(iColumn)!=atLowerBound) { lower[iColumn]=fullLower[kColumn]; } else { nTrusted++; } } if (upper[iColumn]message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; } #endif if (!masterStatus) { if (masterModel.numberIterations() == 0 && iPass ) { if ((!numberSubInfeasible&&!numberProposals)||treatSubAsFeasible>1.0e-2||iPass>5555) break; // finished if (!numberProposals&&numberSubInfeasible) { treatSubAsFeasible *= 2.0; printf("Doubling sub primal tolerance to %g\n",treatSubAsFeasible); } else { treatSubAsFeasible *= 1.2; printf("Increasing sub primal tolerance to %g\n",treatSubAsFeasible); } canSkipSubSolve=false; } else if (!numberSubInfeasible) { if (treatSubAsFeasible>1.0e-6) { treatSubAsFeasible = CoinMax(0.9*treatSubAsFeasible,1.0e-6); printf("Reducing sub primal tolerance to %g\n",treatSubAsFeasible); } } if (masterModel.objectiveValue() < lastObjective + 1.0e-7 && iPass > 5555) break; // finished lastObjective = masterModel.objectiveValue(); } // mark non-basic rows and delete if necessary int iRow; numberRowsGenerated = masterModel.numberRows() - numberMasterRows; for (iRow = 0; iRow < numberRowsGenerated; iRow++) { if (masterModel.getStatus(iRow + numberMasterRows) != ClpSimplex::basic) when[iRow] = iPass; } if (numberRowsGenerated > maximumRows-numberBlocks) { // delete int numberKeep = 0; int numberDelete = 0; int * whichDelete = new int[numberRowsGenerated]; for (iRow = 0; iRow < numberRowsGenerated; iRow++) { if (masterModel.getRowStatus(iRow+numberMasterRows)!= basic) { // keep when[numberKeep] = when[iRow]; whichBlock[numberKeep++] = whichBlock[iRow]; } else { // delete whichDelete[numberDelete++] = iRow + numberMasterRows; } } if (numberRowsGenerated-numberDelete > maximumRows-numberBlocks) { for (iRow = 0; iRow < numberRowsGenerated; iRow++) { if (when[iRow] > iPass - 7 ) { // keep when[numberKeep] = when[iRow]; whichBlock[numberKeep++] = whichBlock[iRow]; } else { // delete whichDelete[numberDelete++] = iRow + numberMasterRows; } } } numberRowsGenerated -= numberDelete; masterModel.deleteRows(numberDelete, whichDelete); delete [] whichDelete; } double * primal = NULL; bool deletePrimal = false; if (masterStatus == 0) { primal = masterModel.primalColumnSolution(); } else if (masterStatus == 2 && masterModel.numberRows()) { // scale back ray (1.0e20?) primal = masterModel.ray(); //deletePrimal = true; sprintf(generalPrint,"The sum of dual infeasibilities is %g", masterModel.sumDualInfeasibilities()); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; #if 0 const double * primal2 = masterModel.primalColumnSolution(); #ifndef UNBOUNDED for (int i=0;igetVectorLengths(); const double * lower = masterModel.columnLower(); const double * upper = masterModel.columnUpper(); const double * obj = masterModel.objective(); for (int i=0;i0.0) value -= 1.0e10; } // make sure feasible primal[i]=CoinMax(-1.0e10,CoinMin(1.0e10,value)); primal[i]=CoinMax(lower[i],CoinMin(upper[i],primal[i])); } } #endif // Create rhs for sub problems and solve for (iBlock = 0; iBlock < numberBlocks; iBlock++) { #ifdef ADD_ARTIFICIALS { double * columnUpper2=sub[iBlock].columnUpper(); double * obj = sub[iBlock].objective(); int start=originalSubColumns[iBlock]; int numberColumns2=sub[iBlock].numberColumns(); if (iFudge>=lowFudge&&iFudge<=abs(highFudge)) { for (int i=start;i-COIN_DBL_MAX) lower2[i]=0.0; if (upper2[i]-COIN_DBL_MAX) columnLower2[i]=0.0; if (columnUpper2[i]times(primal, rhs); for (int i = 0; i < numberRows2; i++) { double value = rhs[i]; if (lower2[i] > -1.0e30) lower2[i] -= value; if (upper2[i] < 1.0e30) upper2[i] -= value; } bool canSkip=false; if (canSkipSubSolve) { canSkip=true; const double * rowSolution = sub[iBlock].primalRowSolution(); for (int i = 0; i < numberRows2; i++) { double value = lastMod[i]-rhs[i]; if (fabs(value)>primalTolerance_) { // see if we can adjust double rowValue=rowSolution[i]; if (rowValueupper2[i]+primalTolerance_) { canSkip=false; break; } else if (sub[iBlock].getRowStatus(i)!=basic) { canSkip=false; break; } } } } if (!canSkip) { memcpy(lastMod,rhs,numberRows2*sizeof(double)); } else { // mark sub[iBlock].setSecondaryStatus(99); } } canSkipSubSolve=true; if (!iPass) { // do first and then copy status? #ifdef TRY_NO_SCALING sub[0].scaling(0); #endif #ifdef ABC_INHERIT sub[0].setAbcState(numberCpu); //sub[0].dealWithAbc(0,0,true); sub[0].dealWithAbc(1,1,true); sub[0].setAbcState(0); #else sub[0].dual(); #endif if ((maxPass==5000&&scalingFlag_)||(maxPass==4000&&!scalingFlag_)) { int n=sub[0].numberIterations(); sub[0].scaling(0); sub[0].primal(); sub[0].setNumberIterations(n+sub[0].numberIterations()); sub[0].scaling(scalingFlag_); } int numberIterations=sub[0].numberIterations(); if (sub[0].problemStatus()) { sub[0].primal(); #if 0 sub[0].writeMps("first.mps"); sub[0].writeBasis("first.bas",true); sub[0].readBasis("first.bas"); sub[0].primal(); #endif numberIterations+=sub[0].numberIterations(); } sprintf(generalPrint,"First block - initial solve - %d iterations, objective %g", numberIterations,sub[0].objectiveValue()); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; // copy status if same size int numberRows2 = sub[0].numberRows(); int numberColumns2 = sub[0].numberColumns(); for (int iBlock = 1; iBlock < numberBlocks; iBlock++) { int numberRows2a = sub[iBlock].numberRows(); int numberColumns2a = sub[iBlock].numberColumns(); if (numberRows2==numberRows2a&& numberColumns2==numberColumns2a) { memcpy(sub[iBlock].primalColumnSolution(), sub[0].primalColumnSolution(), numberColumns2*sizeof(double)); memcpy(sub[iBlock].statusArray(),sub[0].statusArray(), numberRows2+numberColumns2); } } // mark sub[0].setSecondaryStatus(99); } #ifdef ABC_INHERIT if (numberCpu<2) { #endif numberSubInfeasible=0; for (iBlock = 0; iBlock < numberBlocks; iBlock++) { #ifdef TRY_NO_SCALING sub[iBlock].scaling(0); #endif if (sub[iBlock].secondaryStatus()!=99||false) { //int ix=sub[iBlock].secondaryStatus(); int lastStatus = sub[iBlock].problemStatus(); // was do dual unless unbounded double saveTolerance=sub[iBlock].primalTolerance(); if (lastStatus==0||!iPass) { //if (lastStatus<2||!iPass) { //sub[iBlock].dual(); sub[iBlock].primal(); if (!sub[iBlock].isProvenOptimal()&& sub[iBlock].sumPrimalInfeasibilities()1) { sprintf(generalPrint,"Block %d - %d iterations, objective %g", iBlock,sub[iBlock].numberIterations(), sub[iBlock].objectiveValue()); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; } if (sub[iBlock].problemStatus()&&sub[iBlock].algorithm()<0&&false) { int numberRows2=sub[iBlock].numberRows(); double * ray = sub[iBlock].infeasibilityRay(); double * saveRay=CoinCopyOfArray(ray,numberRows2); #if 0 int directionOut = sub[iBlock].directionOut(); sub[iBlock].allSlackBasis(true); sub[iBlock].dual(); printf("old dir %d new %d\n",directionOut,sub[iBlock].directionOut()); #else double * obj = sub[iBlock].objective(); int numberColumns2=sub[iBlock].numberColumns(); double * saveObj = CoinCopyOfArray(obj,numberColumns2); memset(obj,0,numberColumns2*sizeof(double)); sub[iBlock].allSlackBasis(true); sub[iBlock].primal(); memcpy(obj,saveObj,numberColumns2*sizeof(double)); delete [] saveObj; #endif ray = sub[iBlock].infeasibilityRay(); for (int i=0;i1.0e-4+1.0e20) printf("** diffray block %d row %d first %g second %g\n", iBlock,i,saveRay[i],ray[i]); } delete [] saveRay; } } } if (!iPass) sub[0].setSecondaryStatus(0); if (logLevel>2) { for (iBlock = 0; iBlock < numberBlocks; iBlock++) { printf("block %d obj %g thetaC %g\n",iBlock,sub[iBlock].objectiveValue(),masterModel.primalColumnSolution()[numberMasterColumns+iBlock]); } } rowAdd[0] = 0; numberProposals = 0; for (iBlock = 0; iBlock < numberBlocks; iBlock++) { int numberRows2 = sub[iBlock].numberRows(); int numberColumns2 = sub[iBlock].numberColumns(); double * saveLower = modification[iBlock]; double * lower2 = sub[iBlock].rowLower(); double * saveUpper = saveLower+numberRows2+numberColumns2; double * upper2 = sub[iBlock].rowUpper(); int typeRun=sub[iBlock].secondaryStatus(); sub[iBlock].setSecondaryStatus(0); if (typeRun!=99) { if (0) { double objValue = 0.0; const double * solution = sub[iBlock].dualRowSolution(); for (int i = 0; i < numberRows2; i++) { if (solution[i] < -dualTolerance_) { // at upper assert (saveUpper[i] < 1.0e30); objValue += solution[i] * upper2[i]; } else if (solution[i] > dualTolerance_) { // at lower assert (saveLower[i] > -1.0e30); objValue += solution[i] * lower2[i]; } } //printf("obj %g\n",objValue); } // temp if (sub[iBlock].isProvenPrimalInfeasible()&&!sub[iBlock].numberIterations()) problemState[iBlock] |= 4; // get proposal if (sub[iBlock].numberIterations()||(problemState[iBlock]&4)!=0) { double objValue = 0.0; int start = rowAdd[numberProposals]; // proposal if (sub[iBlock].isProvenOptimal()) { double * solution = sub[iBlock].dualRowSolution(); first[iBlock]->transposeTimes(solution, elementAdd + start); for (int i = 0; i < numberRows2; i++) { if (sub[iBlock].getRowStatus(i)==basic) solution[i]=0.0; if (saveUpper[i]>saveLower[i]) { if (sub[iBlock].getRowStatus(i)==atUpperBound) objValue += solution[i] * saveUpper[i]; else objValue += solution[i] * saveLower[i]; } else { // fixed objValue += solution[i] * saveLower[i]; } } const double * dj = sub[iBlock].dualColumnSolution(); const double * columnLower = sub[iBlock].columnLower(); const double * columnUpper = sub[iBlock].columnUpper(); double objValue2=0.0; int numberColumns2 = sub[iBlock].numberColumns(); for (int i=0;i2) { if (sub[iBlock].getColumnStatus(i)!=basic&& fabs(sub[iBlock].primalColumnSolution()[i])>1.0e-5) printf("zz %d has value %g\n",i,sub[iBlock].primalColumnSolution()[i]); } if (sub[iBlock].getColumnStatus(i)==isFixed) { objValue2+=columnLower[i]*dj[i]; } else if (sub[iBlock].getColumnStatus(i)==atLowerBound) { objValue2+=columnLower[i]*dj[i]; } else if (sub[iBlock].getColumnStatus(i)==atUpperBound) { objValue2+=columnUpper[i]*dj[i]; } } #if 1 double objValue3=0.0; const double * cost = sub[iBlock].objective(); for (int i=0;i3) { printf("objValue %g from lp %g, obj2 %g, obj3 %g\n", objValue,sub[iBlock].objectiveValue(), objValue2,objValue3); } objValue += objValue2; //objValue=sub[iBlock].objectiveValue(); // See if cuts off and pack down int number = start; double infeas = -objValue; double smallest = 1.0e100; double largest = 0.0; for (int i = 0; i < numberMasterColumns; i++) { double value = elementAdd[start+i]; if (fabs(value) > 1.0e-12) { infeas += primal[i] * value; smallest = CoinMin(smallest, fabs(value)); largest = CoinMax(largest, fabs(value)); columnAdd[number] = i; elementAdd[number++] = -value; } } infeas += primal[numberMasterColumns+iBlock]; columnAdd[number] = numberMasterColumns + iBlock; elementAdd[number++] = -1.0; // if elements large then scale? if (largest>1.0e8||smallest<1.0e-8) { sprintf(generalPrint,"For subproblem %d smallest - %g, largest %g - infeas %g", iBlock, smallest, largest, infeas); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; if (smallest<1.0e-12*largest) { sprintf(generalPrint,"Removing small elements"); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; double target=1.0e-12*largest; smallest=largest; int number2=number-1; number = start; for (int i = start; i < number2; i++) { double value = elementAdd[i]; if (fabs(value) > target) { smallest=CoinMin(smallest,fabs(value)); columnAdd[number] = columnAdd[i]; elementAdd[number++] = value; } } columnAdd[number] = numberMasterColumns + iBlock; elementAdd[number++] = -1.0; } } // if smallest >1.0 then scale if ((smallest>1.0e6||fabs(objValue)>0.01*largeValue_) &&number>start+1) { double scale = 1.0/smallest; if (fabs(scale*objValue)>0.01*largeValue_) { printf("** scale before obj scale %g\n",scale); scale =(0.01*largeValue_)/fabs(objValue); } printf("** scale %g infeas %g\n",scale,infeas); objValue *= scale; infeas = -objValue; for (int i = start; i < number-1; i++) { double value = elementAdd[i]*scale; elementAdd[i]=value; int iColumn=columnAdd[i]; infeas -= primal[iColumn] * value; } elementAdd[number-1]*=scale; infeas += primal[numberMasterColumns+iBlock]*scale; printf("** new infeas %g - scales to %g\n",infeas,infeas/scale); } if (infeas < -1.0e-6 || (problemState[iBlock]&4)!=0) { // take // double check infeasibility if (logLevel>3) printf("objValue %g objectiveValue() %g\n", objValue,sub[iBlock].objectiveValue()); double sum=0.0; for (int i=start;i3) printf("Sum %g rhs %g\n",sum,-objValue); if (logLevel>1) printf("Cut for block %d has %d elements\n",iBlock,number-1-start); blockPrint[numberProposals]=iBlock; objective[numberProposals] = -objValue; rowAdd[++numberProposals] = number; when[numberRowsGenerated] = iPass; whichBlock[numberRowsGenerated++] = iBlock; } } else if (sub[iBlock].isProvenPrimalInfeasible()) { // use ray double * solution = sub[iBlock].infeasibilityRay(); if (0) { double trueOffset=0.0; int numberRows=sub[iBlock].numberRows(); int numberColumns=sub[iBlock].numberColumns(); double * farkas = new double [CoinMax(2*numberColumns+numberRows,numberMasterColumns)]; double * bound = farkas + numberColumns; double * effectiveRhs = bound + numberColumns; // get ray as user would double * ray = solution; //sub[iBlock].infeasibilityRay(); // get farkas row memset(farkas,0,(2*numberColumns+numberRows)*sizeof(double)); // Looks to me as if ray should be flipped according to mosek sub[iBlock].clpMatrix()->transposeTimes(-1.0,ray,farkas); // now farkas has A_T_y // Put nonzero bounds in bound const double * columnLower = sub[iBlock].columnLower(); const double * columnUpper = sub[iBlock].columnUpper(); int numberBad=0; // For sum in mosek double ySum=0.0; for (int i=0;i1.0e-8) { if (value<0.0) boundValue=columnLower[i]; else boundValue=columnUpper[i]; if (fabs(boundValue)>1.0e12&&fabs(value)<1.0e-8) { boundValue=0.0; value=0.0; } } else { value=0.0; } if (fabs(boundValue)>1.0e20) { numberBad++; boundValue=0.0; value=0.0; farkas[i]=0.0; } // mosek way // A_T_y + s_x_l -s_x_u == 0 // So if value >0 s_x_l->0 s_x_u->value // otherwise s_x_l->-value, s_x_u->0 double s_x_l=0.0; double s_x_u=0.0; if (value>0) s_x_u=value; else s_x_l=-value; ySum += columnLower[i]*s_x_l; ySum -= columnUpper[i]*s_x_u; bound[i]=boundValue; } const double * rowLower = sub[iBlock].rowLower(); const double * rowUpper = sub[iBlock].rowUpper(); //int pivotRow = sub[iBlock].spareIntArray_[3]; //bool badPivot=pivotRow<0; for (int i=0;i1.0e-10) { if (value<0.0) rhsValue=rowLower[i]; else rhsValue=rowUpper[i]; } else { value=0.0; } if (fabs(rhsValue)>1.0e20) { numberBad++; value=0.0; } ray[i]=value; if (!value) rhsValue=0.0; // for mosek flip value back double yvalue = -value; // -y + s_c_l - s_c_u==0 double s_c_l=0.0; double s_c_u=0.0; if (yvalue>0) s_c_l=yvalue; else s_c_u=-yvalue; ySum += rowLower[i]*s_c_l; ySum -= rowUpper[i]*s_c_u; effectiveRhs[i]=rhsValue; if (fabs(effectiveRhs[i])>1.0e10) printf("Large rhs row %d %g\n", i,effectiveRhs[i]); } sub[iBlock].clpMatrix()->times(-1.0,bound,effectiveRhs); double bSum=0.0; for (int i=0;i1.0e10) printf("Large rhs row %d %g after\n", i,effectiveRhs[i]); } if (logLevel>1) printf("Block %d Mosek user manual wants %g to be positive so bSum should be negative %g\n", iBlock,ySum,bSum); if (numberBad||bSum>1.0e-6) { printf("Bad infeasibility ray %g - %d bad\n", bSum,numberBad); } else { //printf("Good ray - infeasibility %g\n", // -bSum); } /* wanted cut is plus or minus! (temp2 * x - temp2 *x_bar) <= bSum first[iBlock]->transposeTimes(ray, temp2); */ memset(farkas,0,numberColumns*sizeof(double)); first[iBlock]->transposeTimes(ray,farkas); double offset=0.0; const double * masterSolution = masterModel.primalColumnSolution(); for (int i=0;i1.0e-9) { offset += value*masterSolution[i]; if (logLevel>2) printf("(%d,%g) ",i,value); } else { farkas[i]=0.0; } } trueOffset = bSum+offset; if (sub[iBlock].algorithm()>0) trueOffset *= 1.0e-5; if (logLevel>2) printf(" - offset %g - ? rhs of %g\n",offset,trueOffset); //delete [] ray; delete [] farkas; } // if primal then scale if (sub[iBlock].algorithm()>0) { for (int i = 0; i < numberRows2; i++) solution[i] = -1.0e-5*solution[i]; } else { for (int i = 0; i < numberRows2; i++) solution[i] = -solution[i]; } first[iBlock]->transposeTimes(solution, elementAdd + start); for (int i = 0; i < numberRows2; i++) solution[i] = -solution[i]; for (int i = 0; i < numberRows2; i++) { if (sub[iBlock].getRowStatus(i)==basic && fabs(solution[i])<1.0e-7) solution[i]=0.0; if (solution[i] > dualTolerance_) { // at upper if (saveUpper[i] > 1.0e20) solution[i]=0.0; objValue += solution[i] * saveUpper[i]; } else if (solution[i] < -dualTolerance_) { // at lower if (saveLower[i] < -1.0e20); solution[i]=0.0; objValue += solution[i] * saveLower[i]; } else { solution[i]=0.0; } } //objValue=-objValue; { int numberColumns2=sub[iBlock].numberColumns(); double * temp = new double[numberColumns2]; memset(temp,0,numberColumns2*sizeof(double)); sub[iBlock].clpMatrix()->transposeTimes(-1.0,solution, temp); double loX=0.0; double upX=0.0; const double * lower = sub[iBlock].columnLower(); const double * upper = sub[iBlock].columnUpper(); const double * primal = sub[iBlock].primalColumnSolution(); for (int i=0;i2) { //if (sub[iBlock].getColumnStatus(i)!=basic&& // primal[i]>1.0e-5) //printf("zz_inf %d has value %g\n",i,primal[i]); } if (sub[iBlock].getStatus(i)==atLowerBound|| sub[iBlock].getStatus(i)==isFixed) { loX += lower[i]*value; } else if (sub[iBlock].getStatus(i)==atUpperBound) { upX += upper[i]*value; } else if (sub[iBlock].getStatus(i)==basic) { double value2 = primal[i]*value; if (logLevel>2) { if (fabs(value2)>1.0e-3) printf("Basic %d arrayval %g primal %g bounds %g %g\n", i,value,primal[i], lower[i],upper[i]); } if (value<0.0) { assert (primal[i]0.0) { assert (primal[i]>upper[i]); if (primal[i]-upper[i]<1.0e-3) { if (logLevel>2) printf("small diff %g\n",primal[i]-upper[i]); //handler_->message(CLP_GENERAL2, messages_) //<< generalPrint //<< CoinMessageEol; //value=0.0; //elementAdd[start+i]=0.0; } value2 = value*upper[i]; } loX += value2; } } objValue += loX+upX; if (logLevel>2) printf("Inf Offsets %g %g - new Objvalue %g\n",loX,upX,objValue); #define OBJ_OFFSET 0 #if OBJ_OFFSET==1 objValue -= loX+upX; objValue -= loX+upX; #elif OBJ_OFFSET==2 objValue -= loX+upX; objValue = -objValue; objValue += loX+upX; #elif OBJ_OFFSET==3 objValue -= loX+upX; objValue = -objValue; objValue -= loX+upX; #endif if (iBlock==-3) { ClpSimplex * temp = deBound(sub+iBlock); //temp->allSlackBasis(); temp->primal(); // use ray double * solution = temp->infeasibilityRay(); int numberRows2=temp->numberRows(); // bug somewhere - if primal then flip if (temp->algorithm_>0) { for (int i = 0; i < numberRows2; i++) solution[i] = - 1.0e-5 * solution[i]; } double objValue7=0.0; const double * lower = temp->rowLower(); const double * upper = temp->rowUpper(); for (int i = 0; i < numberRows2; i++) { if (solution[i] < -dualTolerance_) { // at upper assert (upper[i] < 1.0e30); if (i dualTolerance_) { // at lower assert (lower[i] > -1.0e30); if (imessage(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; //objValue=-objValue7; //loX=1.0e-2*objValue; //first[iBlock]->transposeTimes(solution, elementAdd + start); double * temp2 = new double [numberMasterColumns]; memset(temp2,0,numberMasterColumns*sizeof(double)); first[iBlock]->transposeTimes(solution, temp2); double * temp3 = elementAdd+start; for (int i=0;i1.0e-4) printf("** %d bound el %g nobound %g\n",i,temp3[i],temp2[i]); } memcpy(temp3,temp2,numberMasterColumns*sizeof(double)); delete [] temp2; delete temp; } // relax slightly objValue += 1.0e-9*fabs(loX); delete [] temp; } delete [] solution; // See if good infeas and pack down (signs on infeas,value changed) int number = start; //printf("Not changing objValue from %g to %g\n",objValue,trueOffset); //printf("Changing objValue from %g to %g\n",objValue,trueOffset); //objValue=trueOffset; double infeas = objValue; double smallest = 1.0e100; double largest = 0.0; for (int i = 0; i < numberMasterColumns; i++) { double value = -elementAdd[start+i]; if (fabs(value) > 1.0e-12) { infeas -= primal[i] * value; smallest = CoinMin(smallest, fabs(value)); largest = CoinMax(largest, fabs(value)); columnAdd[number] = i; elementAdd[number++] = value; } } // if elements large or small then scale? if (largest>1.0e8||smallest<1.0e-8) { sprintf(generalPrint,"For subproblem ray %d smallest - %g, largest %g - infeas %g", iBlock, smallest, largest, infeas); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; } if (smallest<1.0e-12*largest) { sprintf(generalPrint,"Removing small elements"); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; smallest=1.0e-12*largest; int number2=number-1; number = start; for (int i = start; i < number2; i++) { double value = elementAdd[i]; if (fabs(value) > smallest) { columnAdd[number] = columnAdd[i]; elementAdd[number++] = value; } } columnAdd[number] = numberMasterColumns + iBlock; elementAdd[number++] = -1.0; } if (infeas < -1.0e-6||false) { double sum=0.0; for (int i=start;i2) printf("Sum %g rhs %g\n",sum,objValue); if (logLevel>1) printf("Cut for block %d has %d elements (infeasibility)\n",iBlock,number-start); blockPrint[numberProposals]=iBlock; // take objective[numberProposals] = objValue; rowAdd[++numberProposals] = number; when[numberRowsGenerated] = iPass; whichBlock[numberRowsGenerated++] = iBlock; } } else { abort(); } } } else { //printf("Can skip\n"); } problemState[iBlock] &= ~4; } if (deletePrimal) delete [] primal; if (numberProposals) { sprintf(generalPrint,"%d cuts added with %d elements", numberProposals,rowAdd[numberProposals]); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; if (logLevel>2) { for (int i=0;i3) { const double * solution = goodModel.primalColumnSolution(); const double * solution2 = masterModel.primalColumnSolution(); for (int i=0;imessage(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; } #define FIXUP_RHS 0 if (sum>objective[i]+1.0e-4) { sprintf(generalPrint,"Rhs for cut %d (from block %d) is %g too low (rhs is %g)", i,blockPrint[i],sum-objective[i],objective[i]); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; #if FIXUP_RHS == 1 || FIXUP_RHS ==3 objective[i]=sum; #endif } else if (summessage(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; #if FIXUP_RHS == 2 || FIXUP_RHS ==3 objective[i]=sum; #endif } } } if (logLevel>3) { goodModel.addRows(numberProposals, NULL, objective, rowAdd, columnAdd, elementAdd); goodModel.dual(); if (goodModel.problemStatus()==1||goodModel.objectiveValue()>goodValue+1.0e-5*fabs(goodValue)) { int numberRows=goodModel.numberRows(); int numberStart=numberRows-numberProposals; double * upper = goodModel.rowUpper(); for (int iRow=numberStart;iRowmessage(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; } else if (goodModel.objectiveValue()>goodValue+1.0e-5*fabs(goodValue)) { sprintf(generalPrint,"Cut %d makes too expensive - upper=%g", iRow-numberStart,upper[iRow]); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; int iBlock=blockPrint[iRow-numberStart]; ClpSimplex * temp = deBound(sub+iBlock); temp->allSlackBasis(); temp->primal(); // use ray double * solution = temp->infeasibilityRay(); int numberRows2=temp->numberRows(); // bug somewhere - if primal then flip if (true) { for (int i = 0; i < numberRows2; i++) solution[i] = - 1.0e-5 * solution[i]; } double objValue=0.0; const double * lower = temp->rowLower(); const double * upper = temp->rowUpper(); for (int i = 0; i < numberRows2; i++) { if (solution[i] < -dualTolerance_) { // at upper assert (upper[i] < 1.0e30); objValue += solution[i] * upper[i]; } else if (solution[i] > dualTolerance_) { // at lower assert (lower[i] > -1.0e30); objValue += solution[i] * lower[i]; } } //printf("new objValue %g\n",objValue); int numberColumns2=sub[iBlock].numberColumns(); double * temp2 = new double[numberColumns2]; memset(temp2,0,numberColumns2*sizeof(double)); sub[iBlock].clpMatrix()->transposeTimes(1.0,sub[iBlock].infeasibilityRay(), temp2); double loX=0.0; double upX=0.0; const double * lower2 = sub[iBlock].columnLower(); const double * upper2 = sub[iBlock].columnUpper(); for (int i=0;i1.0e-5) printf("zz_inf %d has value %g\n",i,sub[iBlock].primalColumnSolution()[i]); if (sub[iBlock].getStatus(i)==atLowerBound) { loX += lower2[i]*temp2[i]; } else if (sub[iBlock].getStatus(i)==atUpperBound) { upX += upper2[i]*temp2[i]; } } printf("Offsets %g %g\n",loX,upX); memset(temp2,0,numberColumns2*sizeof(double)); temp->clpMatrix()->transposeTimes(1.0,solution, temp2); loX=0.0; upX=0.0; lower2 = temp->columnLower(); upper2 = temp->columnUpper(); for (int i=0;igetColumnStatus(i)!=basic&& fabs(temp->primalColumnSolution()[i])>1.0e-5) printf("zz_inf %d has value %g\n",i,temp->primalColumnSolution()[i]); if (temp->getStatus(i)==atLowerBound) { loX += lower2[i]*temp2[i]; } else if (temp->getStatus(i)==atUpperBound) { upX += upper2[i]*temp2[i]; } } printf("Offsets %g %g\n",loX,upX); delete [] temp2; delete temp; } upper[iRow]=COIN_DBL_MAX; } } double objValue=goodModel.objectiveValue(); const double * obj = goodModel.objective(); const double * solution = goodModel.primalColumnSolution(); double obj1=0.0; for (int i=0;imessage(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; delete [] problemState; for (int iBlock = 0; iBlock < numberBlocks; iBlock++) { delete [] modification[iBlock]; } delete [] modification; #ifdef ADD_ARTIFICIALS delete [] originalSubColumns; for (int i=0;icoinBlock(masterBlock)->originalColumns(); int numberColumns2 = model->coinBlock(masterBlock)->numberColumns(); const int * rowBack = model->coinBlock(masterBlock)->originalRows(); int numberRows2 = model->coinBlock(masterBlock)->numberRows(); #ifndef NDEBUG for (int iColumn = 0; iColumn < numberColumns_; iColumn++) fullColumnSolution[iColumn]=COIN_DBL_MAX; #endif for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { int kColumn = columnBack[iColumn]; setColumnStatus(kColumn, masterModel.getColumnStatus(iColumn)); fullColumnSolution[kColumn] = columnSolution[iColumn]; } for (int iRow = 0; iRow < numberRows2; iRow++) { int kRow = rowBack[iRow]; setRowStatus(kRow, masterModel.getRowStatus(iRow)); //fullSolution[kRow]=solution[iRow]; } for (iBlock = 0; iBlock < numberBlocks; iBlock++) { // move basis int kBlock = rowCounts[iBlock]; const int * columnBack = model->coinBlock(kBlock)->originalColumns(); int numberColumns2 = model->coinBlock(kBlock)->numberColumns(); const int * rowBack = model->coinBlock(kBlock)->originalRows(); int numberRows2 = model->coinBlock(kBlock)->numberRows(); const double * subColumnSolution = sub[iBlock].primalColumnSolution(); for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { int kColumn = columnBack[iColumn]; setColumnStatus(kColumn, sub[iBlock].getColumnStatus(iColumn)); #ifndef NDEBUG assert(fullColumnSolution[kColumn]==COIN_DBL_MAX); #endif fullColumnSolution[kColumn] = subColumnSolution[iColumn]; } for (int iRow = 0; iRow < numberRows2; iRow++) { int kRow = rowBack[iRow]; setRowStatus(kRow, sub[iBlock].getRowStatus(iRow)); //setStatus(kRow, atLowerBound); } } #ifndef NDEBUG for (int iColumn = 0; iColumn < numberColumns_; iColumn++) assert(fullColumnSolution[iColumn]!=COIN_DBL_MAX); #endif double * fullSolution = primalRowSolution(); CoinZeroN(fullSolution, numberRows_); times(1.0, fullColumnSolution, fullSolution); int numberRowBasic=0; #ifndef NDEBUG int numberInfeasibilities=0; double sumInfeasibilities=0.0; #endif for (int iRow=0;iRowrowUpper_[iRow]+primalTolerance_) { numberInfeasibilities++; sumInfeasibilities += fullSolution[iRow]-rowUpper_[iRow]; if (getRowStatus(iRow)!=basic) setRowStatus(iRow,superBasic); } #endif } int numberColumnBasic=0; for (int iColumn=0;iColumnmessage(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; #ifndef NDEBUG sprintf(generalPrint,"%d infeasibilities summing to %g", numberInfeasibilities,sumInfeasibilities); handler_->message(CLP_GENERAL2, messages_) << generalPrint << CoinMessageEol; #endif //for (int i=0;imessage(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; #ifdef ABC_INHERIT this->dealWithAbc(1,1,true); #else this->primal(1); #endif sprintf(generalPrint,"Total time %.2f seconds",CoinCpuTime() - time1); handler_->message(CLP_GENERAL, messages_) << generalPrint << CoinMessageEol; delete [] rowCounts; //delete [] sol; //delete [] lower; //delete [] upper; delete [] whichBlock; delete [] when; delete [] rowAdd; delete [] columnAdd; delete [] elementAdd; delete [] objective; delete [] first; delete [] sub; return 0; } CoinMP-1.8.3/Clp/src/ClpSimplexNonlinear.cpp0000644000175000017500000060316012501515412017255 0ustar renerene/* $Id: ClpSimplexNonlinear.cpp 2128 2015-03-16 08:57:46Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" #include "ClpSimplexNonlinear.hpp" #include "ClpSimplexOther.hpp" #include "ClpSimplexDual.hpp" #include "ClpFactorization.hpp" #include "ClpNonLinearCost.hpp" #include "ClpLinearObjective.hpp" #include "ClpConstraint.hpp" #include "ClpPresolve.hpp" #include "ClpQuadraticObjective.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "ClpPrimalColumnPivot.hpp" #include "ClpMessage.hpp" #include "ClpEventHandler.hpp" #include #include #include #include #include #ifndef NDEBUG #define CLP_DEBUG 1 #endif // primal int ClpSimplexNonlinear::primal () { int ifValuesPass = 1; algorithm_ = +3; // save data ClpDataSave data = saveData(); matrix_->refresh(this); // make sure matrix okay // Save objective ClpObjective * saveObjective = NULL; if (objective_->type() > 1) { // expand to full if quadratic #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif // for moment only if no scaling // May be faster if switched off - but can't see why if (!quadraticObj->fullMatrix() && (!rowScale_ && !scalingFlag_) && objectiveScale_ == 1.0) { saveObjective = objective_; objective_ = new ClpQuadraticObjective(*quadraticObj, 1); } } double bestObjectiveWhenFlagged = COIN_DBL_MAX; int pivotMode = 15; //pivotMode=20; // initialize - maybe values pass and algorithm_ is +1 // true does something (? perturbs) if (!startup(true)) { // Set average theta nonLinearCost_->setAverageTheta(1.0e3); int lastCleaned = 0; // last time objective or bounds cleaned up // Say no pivot has occurred (for steepest edge and updates) pivotRow_ = -2; // This says whether to restore things etc int factorType = 0; // Start check for cycles progress_.startCheck(); /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible -5 - looks unbounded */ while (problemStatus_ < 0) { int iRow, iColumn; // clear for (iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // give matrix (and model costs and bounds a chance to be // refreshed (normally null) matrix_->refresh(this); // If getting nowhere - why not give it a kick // If we have done no iterations - special if (lastGoodIteration_ == numberIterations_ && factorType) factorType = 3; // may factorize, checks if problem finished if (objective_->type() > 1 && lastFlaggedIteration_ >= 0 && numberIterations_ > lastFlaggedIteration_ + 507) { unflag(); lastFlaggedIteration_ = numberIterations_; if (pivotMode >= 10) { pivotMode--; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("pivot mode now %d\n", pivotMode); #endif if (pivotMode == 9) pivotMode = 0; // switch off fast attempt } } statusOfProblemInPrimal(lastCleaned, factorType, &progress_, true, bestObjectiveWhenFlagged); // Say good factorization factorType = 1; // Say no pivot has occurred (for steepest edge and updates) pivotRow_ = -2; // exit if victory declared if (problemStatus_ >= 0) break; // test for maximum iterations if (hitMaximumIterations() || (ifValuesPass == 2 && firstFree_ < 0)) { problemStatus_ = 3; break; } if (firstFree_ < 0) { if (ifValuesPass) { // end of values pass ifValuesPass = 0; int status = eventHandler_->event(ClpEventHandler::endOfValuesPass); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfValuesPass; break; } } } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfFactorization); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } } // Iterate whileIterating(pivotMode); } } // if infeasible get real values if (problemStatus_ == 1) { infeasibilityCost_ = 0.0; createRim(1 + 4); delete nonLinearCost_; nonLinearCost_ = new ClpNonLinearCost(this); nonLinearCost_->checkInfeasibilities(0.0); sumPrimalInfeasibilities_ = nonLinearCost_->sumInfeasibilities(); numberPrimalInfeasibilities_ = nonLinearCost_->numberInfeasibilities(); // and get good feasible duals computeDuals(NULL); } // correct objective value if (numberColumns_) objectiveValue_ = nonLinearCost_->feasibleCost() + objective_->nonlinearOffset(); objectiveValue_ /= (objectiveScale_ * rhsScale_); // clean up unflag(); finish(); restoreData(data); // restore objective if full if (saveObjective) { delete objective_; objective_ = saveObjective; } return problemStatus_; } /* Refactorizes if necessary Checks if finished. Updates status. lastCleaned refers to iteration at which some objective/feasibility cleaning too place. type - 0 initial so set up save arrays etc - 1 normal -if good update save - 2 restoring from saved */ void ClpSimplexNonlinear::statusOfProblemInPrimal(int & lastCleaned, int type, ClpSimplexProgress * progress, bool doFactorization, double & bestObjectiveWhenFlagged) { int dummy; // for use in generalExpanded if (type == 2) { // trouble - restore solution CoinMemcpyN(saveStatus_, (numberColumns_ + numberRows_), status_ ); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff matrix_->generalExpanded(this, 6, dummy); forceFactorization_ = 1; // a bit drastic but .. pivotRow_ = -1; // say no weights update changeMade_++; // say change made } int saveThreshold = factorization_->sparseThreshold(); int tentativeStatus = problemStatus_; int numberThrownOut = 1; // to loop round on bad factorization in values pass while (numberThrownOut) { if (problemStatus_ > -3 || problemStatus_ == -4) { // factorize // later on we will need to recover from singularities // also we could skip if first time // do weights // This may save pivotRow_ for use if (doFactorization) primalColumnPivot_->saveWeights(this, 1); if (type && doFactorization) { // is factorization okay? int factorStatus = internalFactorize(1); if (factorStatus) { if (type != 1 || largestPrimalError_ > 1.0e3 || largestDualError_ > 1.0e3) { // was ||largestDualError_>1.0e3||objective_->type()>1) { // switch off dense int saveDense = factorization_->denseThreshold(); factorization_->setDenseThreshold(0); // make sure will do safe factorization pivotVariable_[0] = -1; internalFactorize(2); factorization_->setDenseThreshold(saveDense); // Go to safe factorization_->pivotTolerance(0.99); // restore extra stuff matrix_->generalExpanded(this, 6, dummy); } else { // no - restore previous basis CoinMemcpyN(saveStatus_, (numberColumns_ + numberRows_), status_ ); CoinMemcpyN(savedSolution_ + numberColumns_ , numberRows_, rowActivityWork_); CoinMemcpyN(savedSolution_ , numberColumns_, columnActivityWork_); // restore extra stuff matrix_->generalExpanded(this, 6, dummy); matrix_->generalExpanded(this, 5, dummy); forceFactorization_ = 1; // a bit drastic but .. type = 2; // Go to safe factorization_->pivotTolerance(0.99); if (internalFactorize(1) != 0) largestPrimalError_ = 1.0e4; // force other type } // flag incoming if (sequenceIn_ >= 0 && getStatus(sequenceIn_) != basic) { setFlagged(sequenceIn_); saveStatus_[sequenceIn_] = status_[sequenceIn_]; } changeMade_++; // say change made } } if (problemStatus_ != -4) problemStatus_ = -3; } // at this stage status is -3 or -5 if looks unbounded // get primal and dual solutions // put back original costs and then check createRim(4); // May need to do more if column generation dummy = 4; matrix_->generalExpanded(this, 9, dummy); numberThrownOut = gutsOfSolution(NULL, NULL, (firstFree_ >= 0)); if (numberThrownOut) { problemStatus_ = tentativeStatus; doFactorization = true; } } // Double check reduced costs if no action if (progress->lastIterationNumber(0) == numberIterations_) { if (primalColumnPivot_->looksOptimal()) { numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; } } // Check if looping int loop; if (type != 2) loop = progress->looping(); else loop = -1; if (loop >= 0) { if (!problemStatus_) { // declaring victory numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } else { problemStatus_ = loop; //exit if in loop problemStatus_ = 10; // instead - try other algorithm } problemStatus_ = 10; // instead - try other algorithm return ; } else if (loop < -1) { // Is it time for drastic measures if (nonLinearCost_->numberInfeasibilities() && progress->badTimes() > 5 && progress->oddState() < 10 && progress->oddState() >= 0) { progress->newOddState(); nonLinearCost_->zapCosts(); } // something may have changed gutsOfSolution(NULL, NULL, true); } // If progress then reset costs if (loop == -1 && !nonLinearCost_->numberInfeasibilities() && progress->oddState() < 0) { createRim(4, false); // costs back delete nonLinearCost_; nonLinearCost_ = new ClpNonLinearCost(this); progress->endOddState(); gutsOfSolution(NULL, NULL, true); } // Flag to say whether to go to dual to clean up //bool goToDual = false; // really for free variables in //if((progressFlag_&2)!=0) //problemStatus_=-1;; progressFlag_ = 0; //reset progress flag handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << nonLinearCost_->feasibleReportCost(); handler_->printing(nonLinearCost_->numberInfeasibilities() > 0) << nonLinearCost_->sumInfeasibilities() << nonLinearCost_->numberInfeasibilities(); handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; if (!primalFeasible()) { nonLinearCost_->checkInfeasibilities(primalTolerance_); gutsOfSolution(NULL, NULL, true); nonLinearCost_->checkInfeasibilities(primalTolerance_); } double trueInfeasibility = nonLinearCost_->sumInfeasibilities(); if (trueInfeasibility > 1.0) { // If infeasibility going up may change weights double testValue = trueInfeasibility - 1.0e-4 * (10.0 + trueInfeasibility); if(progress->lastInfeasibility() < testValue) { if (infeasibilityCost_ < 1.0e14) { infeasibilityCost_ *= 1.5; if (handler_->logLevel() == 63) printf("increasing weight to %g\n", infeasibilityCost_); gutsOfSolution(NULL, NULL, true); } } } // we may wish to say it is optimal even if infeasible bool alwaysOptimal = (specialOptions_ & 1) != 0; // give code benefit of doubt if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0) { // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } // had ||(type==3&&problemStatus_!=-5) -- ??? why ???? if (dualFeasible() || problemStatus_ == -4) { // see if extra helps if (nonLinearCost_->numberInfeasibilities() && (nonLinearCost_->sumInfeasibilities() > 1.0e-3 || sumOfRelaxedPrimalInfeasibilities_) && !alwaysOptimal) { //may need infeasiblity cost changed // we can see if we can construct a ray // make up a new objective double saveWeight = infeasibilityCost_; // save nonlinear cost as we are going to switch off costs ClpNonLinearCost * nonLinear = nonLinearCost_; // do twice to make sure Primal solution has settled // put non-basics to bounds in case tolerance moved // put back original costs createRim(4); nonLinearCost_->checkInfeasibilities(0.0); gutsOfSolution(NULL, NULL, true); infeasibilityCost_ = 1.0e100; // put back original costs createRim(4); nonLinearCost_->checkInfeasibilities(primalTolerance_); // may have fixed infeasibilities - double check if (nonLinearCost_->numberInfeasibilities() == 0) { // carry on problemStatus_ = -1; infeasibilityCost_ = saveWeight; nonLinearCost_->checkInfeasibilities(primalTolerance_); } else { nonLinearCost_ = NULL; // scale int i; for (i = 0; i < numberRows_ + numberColumns_; i++) cost_[i] *= 1.0e-95; gutsOfSolution(NULL, NULL, false); nonLinearCost_ = nonLinear; infeasibilityCost_ = saveWeight; if ((infeasibilityCost_ >= 1.0e18 || numberDualInfeasibilities_ == 0) && perturbation_ == 101) { /* goToDual = unPerturb(); // stop any further perturbation if (nonLinearCost_->sumInfeasibilities() > 1.0e-1) goToDual = false; */ unPerturb(); nonLinearCost_->checkInfeasibilities(primalTolerance_); numberDualInfeasibilities_ = 1; // carry on problemStatus_ = -1; } if (infeasibilityCost_ >= 1.0e20 || numberDualInfeasibilities_ == 0) { // we are infeasible - use as ray delete [] ray_; ray_ = new double [numberRows_]; CoinMemcpyN(dual_, numberRows_, ray_); // and get feasible duals infeasibilityCost_ = 0.0; createRim(4); nonLinearCost_->checkInfeasibilities(primalTolerance_); gutsOfSolution(NULL, NULL, true); // so will exit infeasibilityCost_ = 1.0e30; // reset infeasibilities sumPrimalInfeasibilities_ = nonLinearCost_->sumInfeasibilities();; numberPrimalInfeasibilities_ = nonLinearCost_->numberInfeasibilities(); } if (infeasibilityCost_ < 1.0e20) { infeasibilityCost_ *= 5.0; changeMade_++; // say change made unflag(); handler_->message(CLP_PRIMAL_WEIGHT, messages_) << infeasibilityCost_ << CoinMessageEol; // put back original costs and then check createRim(4); nonLinearCost_->checkInfeasibilities(0.0); gutsOfSolution(NULL, NULL, true); problemStatus_ = -1; //continue //goToDual = false; } else { // say infeasible problemStatus_ = 1; } } } else { // may be optimal if (perturbation_ == 101) { /* goToDual =*/ unPerturb(); // stop any further perturbation lastCleaned = -1; // carry on } bool unflagged = unflag() != 0; if ( lastCleaned != numberIterations_ || unflagged) { handler_->message(CLP_PRIMAL_OPTIMAL, messages_) << primalTolerance_ << CoinMessageEol; double current = nonLinearCost_->feasibleReportCost(); if (numberTimesOptimal_ < 4) { if (bestObjectiveWhenFlagged <= current) { numberTimesOptimal_++; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("%d times optimal, current %g best %g\n", numberTimesOptimal_, current, bestObjectiveWhenFlagged); #endif } else { bestObjectiveWhenFlagged = current; } changeMade_++; // say change made if (numberTimesOptimal_ == 1) { // better to have small tolerance even if slower factorization_->zeroTolerance(CoinMin(factorization_->zeroTolerance(), 1.0e-15)); } lastCleaned = numberIterations_; if (primalTolerance_ != dblParam_[ClpPrimalTolerance]) handler_->message(CLP_PRIMAL_ORIGINAL, messages_) << CoinMessageEol; double oldTolerance = primalTolerance_; primalTolerance_ = dblParam_[ClpPrimalTolerance]; // put back original costs and then check createRim(4); nonLinearCost_->checkInfeasibilities(oldTolerance); gutsOfSolution(NULL, NULL, true); if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0) { // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } if (dualFeasible() && !nonLinearCost_->numberInfeasibilities() && lastCleaned >= 0) problemStatus_ = 0; else problemStatus_ = -1; } else { problemStatus_ = 0; // optimal if (lastCleaned < numberIterations_) { handler_->message(CLP_SIMPLEX_GIVINGUP, messages_) << CoinMessageEol; } } } else { problemStatus_ = 0; // optimal } } } else { // see if looks unbounded if (problemStatus_ == -5) { if (nonLinearCost_->numberInfeasibilities()) { if (infeasibilityCost_ > 1.0e18 && perturbation_ == 101) { // back off weight infeasibilityCost_ = 1.0e13; unPerturb(); // stop any further perturbation } //we need infeasiblity cost changed if (infeasibilityCost_ < 1.0e20) { infeasibilityCost_ *= 5.0; changeMade_++; // say change made unflag(); handler_->message(CLP_PRIMAL_WEIGHT, messages_) << infeasibilityCost_ << CoinMessageEol; // put back original costs and then check createRim(4); gutsOfSolution(NULL, NULL, true); problemStatus_ = -1; //continue } else { // say unbounded problemStatus_ = 2; } } else { // say unbounded problemStatus_ = 2; } } else { if(type == 3 && problemStatus_ != -5) unflag(); // odd // carry on problemStatus_ = -1; } } // save extra stuff matrix_->generalExpanded(this, 5, dummy); if (type == 0 || type == 1) { if (type != 1 || !saveStatus_) { // create save arrays delete [] saveStatus_; delete [] savedSolution_; saveStatus_ = new unsigned char [numberRows_+numberColumns_]; savedSolution_ = new double [numberRows_+numberColumns_]; } // save arrays CoinMemcpyN(status_, (numberColumns_ + numberRows_), saveStatus_); CoinMemcpyN(rowActivityWork_, numberRows_, savedSolution_ + numberColumns_ ); CoinMemcpyN(columnActivityWork_, numberColumns_, savedSolution_ ); } if (doFactorization) { // restore weights (if saved) - also recompute infeasibility list if (tentativeStatus > -3) primalColumnPivot_->saveWeights(this, (type < 2) ? 2 : 4); else primalColumnPivot_->saveWeights(this, 3); if (saveThreshold) { // use default at present factorization_->sparseThreshold(0); factorization_->goSparse(); } } if (problemStatus_ < 0 && !changeMade_) { problemStatus_ = 4; // unknown } lastGoodIteration_ = numberIterations_; //if (goToDual) //problemStatus_=10; // try dual // Allow matrices to be sorted etc int fake = -999; // signal sort matrix_->correctSequence(this, fake, fake); } /* Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) -4 end of values pass and done iterations +0 looks optimal (might be infeasible - but we will investigate) +2 looks unbounded +3 max iterations */ int ClpSimplexNonlinear::whileIterating(int & pivotMode) { // Say if values pass //int ifValuesPass=(firstFree_>=0) ? 1 : 0; int ifValuesPass = 1; int returnCode = -1; // status stays at -1 while iterating, >=0 finished, -2 to invert // status -3 to go to top without an invert int numberInterior = 0; int nextUnflag = 10; int nextUnflagIteration = numberIterations_ + 10; // get two arrays double * array1 = new double[2*(numberRows_+numberColumns_)]; double solutionError = -1.0; while (problemStatus_ == -1) { int result; rowArray_[1]->clear(); //#define CLP_DEBUG #if CLP_DEBUG > 1 rowArray_[0]->checkClear(); rowArray_[1]->checkClear(); rowArray_[2]->checkClear(); rowArray_[3]->checkClear(); columnArray_[0]->checkClear(); #endif if (numberInterior >= 5) { // this can go when we have better minimization if (pivotMode < 10) pivotMode = 1; unflag(); #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("interior unflag\n"); #endif numberInterior = 0; nextUnflag = 10; nextUnflagIteration = numberIterations_ + 10; } else { if (numberInterior > nextUnflag && numberIterations_ > nextUnflagIteration) { nextUnflagIteration = numberIterations_ + 10; nextUnflag += 10; unflag(); #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("unflagging as interior\n"); #endif } } pivotRow_ = -1; result = pivotColumn(rowArray_[3], rowArray_[0], columnArray_[0], rowArray_[1], pivotMode, solutionError, array1); if (result) { if (result == 2 && sequenceIn_ < 0) { // does not look good double currentObj; double thetaObj; double predictedObj; objective_->stepLength(this, solution_, solution_, 0.0, currentObj, thetaObj, predictedObj); if (currentObj == predictedObj) { #ifdef CLP_INVESTIGATE printf("looks bad - no change in obj %g\n", currentObj); #endif if (factorization_->pivots()) result = 3; else problemStatus_ = 0; } } if (result == 3) break; // null vector not accurate #ifdef CLP_DEBUG if (handler_->logLevel() & 32) { double currentObj; double thetaObj; double predictedObj; objective_->stepLength(this, solution_, solution_, 0.0, currentObj, thetaObj, predictedObj); printf("obj %g after interior move\n", currentObj); } #endif // just move and try again if (pivotMode < 10) { pivotMode = result - 1; numberInterior++; } continue; } else { if (pivotMode < 10) { if (theta_ > 0.001) pivotMode = 0; else if (pivotMode == 2) pivotMode = 1; } numberInterior = 0; nextUnflag = 10; nextUnflagIteration = numberIterations_ + 10; } sequenceOut_ = -1; rowArray_[1]->clear(); if (sequenceIn_ >= 0) { // we found a pivot column assert (!flagged(sequenceIn_)); #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) { char x = isColumn(sequenceIn_) ? 'C' : 'R'; std::cout << "pivot column " << x << sequenceWithin(sequenceIn_) << std::endl; } #endif // do second half of iteration if (pivotRow_ < 0 && theta_ < 1.0e-8) { assert (sequenceIn_ >= 0); returnCode = pivotResult(ifValuesPass); } else { // specialized code returnCode = pivotNonlinearResult(); //printf("odd pivrow %d\n",sequenceOut_); if (sequenceOut_ >= 0 && theta_ < 1.0e-5) { if (getStatus(sequenceOut_) != isFixed) { if (getStatus(sequenceOut_) == atUpperBound) solution_[sequenceOut_] = upper_[sequenceOut_]; else if (getStatus(sequenceOut_) == atLowerBound) solution_[sequenceOut_] = lower_[sequenceOut_]; setFlagged(sequenceOut_); } } } if (returnCode < -1 && returnCode > -5) { problemStatus_ = -2; // } else if (returnCode == -5) { // something flagged - continue; } else if (returnCode == 2) { problemStatus_ = -5; // looks unbounded } else if (returnCode == 4) { problemStatus_ = -2; // looks unbounded but has iterated } else if (returnCode != -1) { assert(returnCode == 3); problemStatus_ = 3; } } else { // no pivot column #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("** no column pivot\n"); #endif if (pivotMode < 10) { // looks optimal primalColumnPivot_->setLooksOptimal(true); } else { pivotMode--; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("pivot mode now %d\n", pivotMode); #endif if (pivotMode == 9) pivotMode = 0; // switch off fast attempt unflag(); } if (nonLinearCost_->numberInfeasibilities()) problemStatus_ = -4; // might be infeasible returnCode = 0; break; } } delete [] array1; return returnCode; } // Creates direction vector void ClpSimplexNonlinear::directionVector (CoinIndexedVector * vectorArray, CoinIndexedVector * spare1, CoinIndexedVector * spare2, int pivotMode2, double & normFlagged, double & normUnflagged, int & numberNonBasic) { #if CLP_DEBUG > 1 vectorArray->checkClear(); spare1->checkClear(); spare2->checkClear(); #endif double *array = vectorArray->denseVector(); int * index = vectorArray->getIndices(); int number = 0; sequenceIn_ = -1; normFlagged = 0.0; normUnflagged = 1.0; double dualTolerance2 = CoinMin(1.0e-8, 1.0e-2 * dualTolerance_); double dualTolerance3 = CoinMin(1.0e-2, 1.0e3 * dualTolerance_); if (!numberNonBasic) { //if (nonLinearCost_->sumInfeasibilities()>1.0e-4) //printf("infeasible\n"); if (!pivotMode2 || pivotMode2 >= 10) { normUnflagged = 0.0; double bestDj = 0.0; double bestSuper = 0.0; double sumSuper = 0.0; sequenceIn_ = -1; int nSuper = 0; for (int iSequence = 0; iSequence < numberColumns_ + numberRows_; iSequence++) { array[iSequence] = 0.0; if (flagged(iSequence)) { // accumulate norm switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case atUpperBound: if (dj_[iSequence] > dualTolerance3) normFlagged += dj_[iSequence] * dj_[iSequence]; break; case atLowerBound: if (dj_[iSequence] < -dualTolerance3) normFlagged += dj_[iSequence] * dj_[iSequence]; break; case isFree: case superBasic: if (fabs(dj_[iSequence]) > dualTolerance3) normFlagged += dj_[iSequence] * dj_[iSequence]; break; } continue; } switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case atUpperBound: if (dj_[iSequence] > dualTolerance_) { if (dj_[iSequence] > dualTolerance3) normUnflagged += dj_[iSequence] * dj_[iSequence]; if (pivotMode2 < 10) { array[iSequence] = -dj_[iSequence]; index[number++] = iSequence; } else { if (dj_[iSequence] > bestDj) { bestDj = dj_[iSequence]; sequenceIn_ = iSequence; } } } break; case atLowerBound: if (dj_[iSequence] < -dualTolerance_) { if (dj_[iSequence] < -dualTolerance3) normUnflagged += dj_[iSequence] * dj_[iSequence]; if (pivotMode2 < 10) { array[iSequence] = -dj_[iSequence]; index[number++] = iSequence; } else { if (-dj_[iSequence] > bestDj) { bestDj = -dj_[iSequence]; sequenceIn_ = iSequence; } } } break; case isFree: case superBasic: //#define ALLSUPER #define NOSUPER #ifndef ALLSUPER if (fabs(dj_[iSequence]) > dualTolerance_) { if (fabs(dj_[iSequence]) > dualTolerance3) normUnflagged += dj_[iSequence] * dj_[iSequence]; nSuper++; bestSuper = CoinMax(fabs(dj_[iSequence]), bestSuper); sumSuper += fabs(dj_[iSequence]); } if (fabs(dj_[iSequence]) > dualTolerance2) { array[iSequence] = -dj_[iSequence]; index[number++] = iSequence; } #else array[iSequence] = -dj_[iSequence]; index[number++] = iSequence; if (pivotMode2 >= 10) bestSuper = CoinMax(fabs(dj_[iSequence]), bestSuper); #endif break; } } #ifdef NOSUPER // redo bestSuper = sumSuper; if(sequenceIn_ >= 0 && bestDj > bestSuper) { int j; // get rid of superbasics for (j = 0; j < number; j++) { int iSequence = index[j]; array[iSequence] = 0.0; } number = 0; array[sequenceIn_] = -dj_[sequenceIn_]; index[number++] = sequenceIn_; } else { sequenceIn_ = -1; } #else if (pivotMode2 >= 10 || !nSuper) { bool takeBest = true; if (pivotMode2 == 100 && nSuper > 1) takeBest = false; if(sequenceIn_ >= 0 && takeBest) { if (fabs(dj_[sequenceIn_]) > bestSuper) { array[sequenceIn_] = -dj_[sequenceIn_]; index[number++] = sequenceIn_; } else { sequenceIn_ = -1; } } else { sequenceIn_ = -1; } } #endif #ifdef CLP_DEBUG if (handler_->logLevel() & 32) { if (sequenceIn_ >= 0) printf("%d superBasic, chosen %d - dj %g\n", nSuper, sequenceIn_, dj_[sequenceIn_]); else printf("%d superBasic - none chosen\n", nSuper); } #endif } else { double bestDj = 0.0; double saveDj = 0.0; if (sequenceOut_ >= 0) { saveDj = dj_[sequenceOut_]; dj_[sequenceOut_] = 0.0; switch(getStatus(sequenceOut_)) { case basic: sequenceOut_ = -1; case ClpSimplex::isFixed: break; case atUpperBound: if (dj_[sequenceOut_] > dualTolerance_) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("after pivot out %d values %g %g %g, dj %g\n", sequenceOut_, lower_[sequenceOut_], solution_[sequenceOut_], upper_[sequenceOut_], dj_[sequenceOut_]); #endif } break; case atLowerBound: if (dj_[sequenceOut_] < -dualTolerance_) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("after pivot out %d values %g %g %g, dj %g\n", sequenceOut_, lower_[sequenceOut_], solution_[sequenceOut_], upper_[sequenceOut_], dj_[sequenceOut_]); #endif } break; case isFree: case superBasic: if (dj_[sequenceOut_] > dualTolerance_) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("after pivot out %d values %g %g %g, dj %g\n", sequenceOut_, lower_[sequenceOut_], solution_[sequenceOut_], upper_[sequenceOut_], dj_[sequenceOut_]); #endif } else if (dj_[sequenceOut_] < -dualTolerance_) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("after pivot out %d values %g %g %g, dj %g\n", sequenceOut_, lower_[sequenceOut_], solution_[sequenceOut_], upper_[sequenceOut_], dj_[sequenceOut_]); #endif } break; } } // Go for dj pivotMode2 = 3; for (int iSequence = 0; iSequence < numberColumns_ + numberRows_; iSequence++) { array[iSequence] = 0.0; if (flagged(iSequence)) continue; switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case atUpperBound: if (dj_[iSequence] > dualTolerance_) { double distance = CoinMin(1.0e-2, solution_[iSequence] - lower_[iSequence]); double merit = distance * dj_[iSequence]; if (pivotMode2 == 1) merit *= 1.0e-20; // discourage if (pivotMode2 == 3) merit = fabs(dj_[iSequence]); if (merit > bestDj) { sequenceIn_ = iSequence; bestDj = merit; } } break; case atLowerBound: if (dj_[iSequence] < -dualTolerance_) { double distance = CoinMin(1.0e-2, upper_[iSequence] - solution_[iSequence]); double merit = -distance * dj_[iSequence]; if (pivotMode2 == 1) merit *= 1.0e-20; // discourage if (pivotMode2 == 3) merit = fabs(dj_[iSequence]); if (merit > bestDj) { sequenceIn_ = iSequence; bestDj = merit; } } break; case isFree: case superBasic: if (dj_[iSequence] > dualTolerance_) { double distance = CoinMin(1.0e-2, solution_[iSequence] - lower_[iSequence]); distance = CoinMin(solution_[iSequence] - lower_[iSequence], upper_[iSequence] - solution_[iSequence]); double merit = distance * dj_[iSequence]; if (pivotMode2 == 1) merit = distance; if (pivotMode2 == 3) merit = fabs(dj_[iSequence]); if (merit > bestDj) { sequenceIn_ = iSequence; bestDj = merit; } } else if (dj_[iSequence] < -dualTolerance_) { double distance = CoinMin(1.0e-2, upper_[iSequence] - solution_[iSequence]); distance = CoinMin(solution_[iSequence] - lower_[iSequence], upper_[iSequence] - solution_[iSequence]); double merit = -distance * dj_[iSequence]; if (pivotMode2 == 1) merit = distance; if (pivotMode2 == 3) merit = fabs(dj_[iSequence]); if (merit > bestDj) { sequenceIn_ = iSequence; bestDj = merit; } } break; } } if (sequenceOut_ >= 0) { dj_[sequenceOut_] = saveDj; sequenceOut_ = -1; } if (sequenceIn_ >= 0) { array[sequenceIn_] = -dj_[sequenceIn_]; index[number++] = sequenceIn_; } } numberNonBasic = number; } else { // compute norms normUnflagged = 0.0; for (int iSequence = 0; iSequence < numberColumns_ + numberRows_; iSequence++) { if (flagged(iSequence)) { // accumulate norm switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case atUpperBound: if (dj_[iSequence] > dualTolerance_) normFlagged += dj_[iSequence] * dj_[iSequence]; break; case atLowerBound: if (dj_[iSequence] < -dualTolerance_) normFlagged += dj_[iSequence] * dj_[iSequence]; break; case isFree: case superBasic: if (fabs(dj_[iSequence]) > dualTolerance_) normFlagged += dj_[iSequence] * dj_[iSequence]; break; } } } // re-use list number = 0; int j; for (j = 0; j < numberNonBasic; j++) { int iSequence = index[j]; if (flagged(iSequence)) continue; switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: continue; //abort(); break; case atUpperBound: if (dj_[iSequence] > dualTolerance_) { number++; normUnflagged += dj_[iSequence] * dj_[iSequence]; } break; case atLowerBound: if (dj_[iSequence] < -dualTolerance_) { number++; normUnflagged += dj_[iSequence] * dj_[iSequence]; } break; case isFree: case superBasic: if (fabs(dj_[iSequence]) > dualTolerance_) { number++; normUnflagged += dj_[iSequence] * dj_[iSequence]; } break; } array[iSequence] = -dj_[iSequence]; } // switch to large normUnflagged = 1.0; if (!number) { for (j = 0; j < numberNonBasic; j++) { int iSequence = index[j]; array[iSequence] = 0.0; } numberNonBasic = 0; } number = numberNonBasic; } if (number) { int j; // Now do basic ones - how do I compensate for small basic infeasibilities? int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; double value = 0.0; if (solution_[iPivot] > upper_[iPivot]) { value = upper_[iPivot] - solution_[iPivot]; } else if (solution_[iPivot] < lower_[iPivot]) { value = lower_[iPivot] - solution_[iPivot]; } //if (value) //printf("inf %d %g %g %g\n",iPivot,lower_[iPivot],solution_[iPivot], // upper_[iPivot]); //value=0.0; value *= -1.0e0; if (value) { array[iPivot] = value; index[number++] = iPivot; } } double * array2 = spare1->denseVector(); int * index2 = spare1->getIndices(); int number2 = 0; times(-1.0, array, array2); array = array + numberColumns_; for (iRow = 0; iRow < numberRows_; iRow++) { double value = array2[iRow] + array[iRow]; if (value) { array2[iRow] = value; index2[number2++] = iRow; } else { array2[iRow] = 0.0; } } array -= numberColumns_; spare1->setNumElements(number2); // Ftran factorization_->updateColumn(spare2, spare1); number2 = spare1->getNumElements(); for (j = 0; j < number2; j++) { int iSequence = index2[j]; double value = array2[iSequence]; array2[iSequence] = 0.0; if (value) { int iPivot = pivotVariable_[iSequence]; double oldValue = array[iPivot]; if (!oldValue) { array[iPivot] = value; index[number++] = iPivot; } else { // something already there array[iPivot] = value + oldValue; } } } spare1->setNumElements(0); } vectorArray->setNumElements(number); } #define MINTYPE 1 #if MINTYPE==2 static double innerProductIndexed(const double * region1, int size, const double * region2, const int * which) { int i; double value = 0.0; for (i = 0; i < size; i++) { int j = which[i]; value += region1[j] * region2[j]; } return value; } #endif /* Row array and column array have direction Returns 0 - can do normal iteration (basis change) 1 - no basis change */ int ClpSimplexNonlinear::pivotColumn(CoinIndexedVector * longArray, CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, CoinIndexedVector * spare, int & pivotMode, double & solutionError, double * dArray) { // say not optimal primalColumnPivot_->setLooksOptimal(false); double acceptablePivot = 1.0e-10; int lastSequenceIn = -1; if (pivotMode && pivotMode < 10) { acceptablePivot = 1.0e-6; if (factorization_->pivots()) acceptablePivot = 1.0e-5; // if we have iterated be more strict } double acceptableBasic = 1.0e-7; int number = longArray->getNumElements(); int numberTotal = numberRows_ + numberColumns_; int bestSequence = -1; int bestBasicSequence = -1; double eps = 1.0e-1; eps = 1.0e-6; double basicTheta = 1.0e30; double objTheta = 0.0; bool finished = false; sequenceIn_ = -1; int nPasses = 0; int nTotalPasses = 0; int nBigPasses = 0; double djNorm0 = 0.0; double djNorm = 0.0; double normFlagged = 0.0; double normUnflagged = 0.0; int localPivotMode = pivotMode; bool allFinished = false; bool justOne = false; int returnCode = 1; double currentObj; double predictedObj; double thetaObj; objective_->stepLength(this, solution_, solution_, 0.0, currentObj, predictedObj, thetaObj); double saveObj = currentObj; #if MINTYPE ==2 // try Shanno's method //would be memory leak //double * saveY=new double[numberTotal]; //double * saveS=new double[numberTotal]; //double * saveY2=new double[numberTotal]; //double * saveS2=new double[numberTotal]; double saveY[100]; double saveS[100]; double saveY2[100]; double saveS2[100]; double zz[10000]; #endif double * dArray2 = dArray + numberTotal; // big big loop while (!allFinished) { double * work = longArray->denseVector(); int * which = longArray->getIndices(); allFinished = true; // CONJUGATE 0 - never, 1 as pivotMode, 2 as localPivotMode, 3 always //#define SMALLTHETA1 1.0e-25 //#define SMALLTHETA2 1.0e-25 #define SMALLTHETA1 1.0e-10 #define SMALLTHETA2 1.0e-10 #define CONJUGATE 2 #if CONJUGATE == 0 int conjugate = 0; #elif CONJUGATE == 1 int conjugate = (pivotMode < 10) ? MINTYPE : 0; #elif CONJUGATE == 2 int conjugate = MINTYPE; #else int conjugate = MINTYPE; #endif //if (pivotMode==1) //localPivotMode=11;; #if CLP_DEBUG > 1 longArray->checkClear(); #endif int numberNonBasic = 0; int startLocalMode = -1; while (!finished) { double simpleObjective = COIN_DBL_MAX; returnCode = 1; int iSequence; objective_->reducedGradient(this, dj_, false); // get direction vector in longArray longArray->clear(); // take out comment to try slightly different idea if (nPasses + nTotalPasses > 3000 || nBigPasses > 100) { if (factorization_->pivots()) returnCode = 3; break; } if (!nPasses) { numberNonBasic = 0; nBigPasses++; } // just do superbasic if in cleanup mode int local = localPivotMode; if (!local && pivotMode >= 10 && nBigPasses < 10) { local = 100; } else if (local == -1 || nBigPasses >= 10) { local = 0; localPivotMode = 0; } if (justOne) { local = 2; //local=100; justOne = false; } if (!nPasses) startLocalMode = local; directionVector(longArray, spare, rowArray, local, normFlagged, normUnflagged, numberNonBasic); { // check null vector double * rhs = spare->denseVector(); #if CLP_DEBUG > 1 spare->checkClear(); #endif int iRow; multiplyAdd(solution_ + numberColumns_, numberRows_, -1.0, rhs, 0.0); matrix_->times(1.0, solution_, rhs, rowScale_, columnScale_); double largest = 0.0; #if CLP_DEBUG > 0 int iLargest = -1; #endif for (iRow = 0; iRow < numberRows_; iRow++) { double value = fabs(rhs[iRow]); rhs[iRow] = 0.0; if (value > largest) { largest = value; #if CLP_DEBUG > 0 iLargest = iRow; #endif } } #if CLP_DEBUG > 0 if ((handler_->logLevel() & 32) && largest > 1.0e-8) printf("largest rhs error %g on row %d\n", largest, iLargest); #endif if (solutionError < 0.0) { solutionError = largest; } else if (largest > CoinMax(1.0e-8, 1.0e2 * solutionError) && factorization_->pivots()) { longArray->clear(); pivotRow_ = -1; theta_ = 0.0; return 3; } } if (sequenceIn_ >= 0) lastSequenceIn = sequenceIn_; #if MINTYPE!=2 double djNormSave = djNorm; #endif djNorm = 0.0; int iIndex; for (iIndex = 0; iIndex < numberNonBasic; iIndex++) { int iSequence = which[iIndex]; double alpha = work[iSequence]; djNorm += alpha * alpha; } // go to conjugate gradient if necessary if (numberNonBasic && localPivotMode >= 10 && (nPasses > 4 || sequenceIn_ < 0)) { localPivotMode = 0; nTotalPasses += nPasses; nPasses = 0; } #if CONJUGATE == 2 conjugate = (localPivotMode < 10) ? MINTYPE : 0; #endif //printf("bigP %d pass %d nBasic %d norm %g normI %g normF %g\n", // nBigPasses,nPasses,numberNonBasic,normUnflagged,normFlagged); if (!nPasses) { //printf("numberNon %d\n",numberNonBasic); #if MINTYPE==2 assert (numberNonBasic < 100); memset(zz, 0, numberNonBasic * numberNonBasic * sizeof(double)); int put = 0; for (int iVariable = 0; iVariable < numberNonBasic; iVariable++) { zz[put] = 1.0; put += numberNonBasic + 1; } #endif djNorm0 = CoinMax(djNorm, 1.0e-20); CoinMemcpyN(work, numberTotal, dArray); CoinMemcpyN(work, numberTotal, dArray2); if (sequenceIn_ >= 0 && numberNonBasic == 1) { // see if simple move double objTheta2 = objective_->stepLength(this, solution_, work, 1.0e30, currentObj, predictedObj, thetaObj); rowArray->clear(); // update the incoming column unpackPacked(rowArray); factorization_->updateColumnFT(spare, rowArray); theta_ = 0.0; double * work2 = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which2 = rowArray->getIndices(); int iIndex; bool easyMove = false; double way; if (dj_[sequenceIn_] > 0.0) way = -1.0; else way = 1.0; double largest = COIN_DBL_MAX; #ifdef CLP_DEBUG int kPivot = -1; #endif for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which2[iIndex]; double alpha = way * work2[iIndex]; int iPivot = pivotVariable_[iRow]; if (alpha < -1.0e-5) { double distance = upper_[iPivot] - solution_[iPivot]; if (distance < -largest * alpha) { #ifdef CLP_DEBUG kPivot = iPivot; #endif largest = CoinMax(0.0, -distance / alpha); } if (distance < -1.0e-12 * alpha) { easyMove = true; break; } } else if (alpha > 1.0e-5) { double distance = solution_[iPivot] - lower_[iPivot]; if (distance < largest * alpha) { #ifdef CLP_DEBUG kPivot = iPivot; #endif largest = CoinMax(0.0, distance / alpha); } if (distance < 1.0e-12 * alpha) { easyMove = true; break; } } } // But largest has to match up with change assert (work[sequenceIn_]); largest /= fabs(work[sequenceIn_]); if (largest < objTheta2) { easyMove = true; } else if (!easyMove) { double objDrop = currentObj - predictedObj; double th = objective_->stepLength(this, solution_, work, largest, currentObj, predictedObj, simpleObjective); simpleObjective = CoinMax(simpleObjective, predictedObj); double easyDrop = currentObj - simpleObjective; if (easyDrop > 1.0e-8 && easyDrop > 0.5 * objDrop) { easyMove = true; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("easy - obj drop %g, easy drop %g\n", objDrop, easyDrop); #endif if (easyDrop > objDrop) { // debug printf("****** th %g simple %g\n", th, simpleObjective); objective_->stepLength(this, solution_, work, 1.0e30, currentObj, predictedObj, simpleObjective); objective_->stepLength(this, solution_, work, largest, currentObj, predictedObj, simpleObjective); } } } rowArray->clear(); #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("largest %g piv %d\n", largest, kPivot); #endif if (easyMove) { valueIn_ = solution_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; if (dualIn_ > 0.0) directionIn_ = -1; else directionIn_ = 1; longArray->clear(); pivotRow_ = -1; theta_ = 0.0; return 0; } } } else { #if MINTYPE==1 if (conjugate) { double djNorm2 = djNorm; if (numberNonBasic && false) { int iIndex; djNorm2 = 0.0; for (iIndex = 0; iIndex < numberNonBasic; iIndex++) { int iSequence = which[iIndex]; double alpha = work[iSequence]; //djNorm2 += alpha*alpha; double alpha2 = work[iSequence] - dArray2[iSequence]; djNorm2 += alpha * alpha2; } //printf("a %.18g b %.18g\n",djNorm,djNorm2); } djNorm = djNorm2; double beta = djNorm2 / djNormSave; // reset beta every so often //if (numberNonBasic&&nPasses>numberNonBasic&&(nPasses%(3*numberNonBasic))==1) //beta=0.0; //printf("current norm %g, old %g - beta %g\n", // djNorm,djNormSave,beta); for (iSequence = 0; iSequence < numberTotal; iSequence++) { dArray[iSequence] = work[iSequence] + beta * dArray[iSequence]; dArray2[iSequence] = work[iSequence]; } } else { for (iSequence = 0; iSequence < numberTotal; iSequence++) dArray[iSequence] = work[iSequence]; } #else int number2 = numberNonBasic; if (number2) { // pack down into dArray int jLast = -1; for (iSequence = 0; iSequence < numberNonBasic; iSequence++) { int j = which[iSequence]; assert(j > jLast); jLast = j; double value = work[j]; dArray[iSequence] = -value; } // see whether to restart // check signs - gradient double g1 = innerProduct(dArray, number2, dArray); double g2 = innerProduct(dArray, number2, saveY2); // Get differences for (iSequence = 0; iSequence < numberNonBasic; iSequence++) { saveY2[iSequence] = dArray[iSequence] - saveY2[iSequence]; saveS2[iSequence] = solution_[iSequence] - saveS2[iSequence]; } double g3 = innerProduct(saveS2, number2, saveY2); printf("inner %g\n", g3); //assert(g3>0); double zzz[10000]; int iVariable; g2 = 1.0e50; // temp if (fabs(g2) >= 0.2 * fabs(g1)) { // restart double delta = innerProduct(saveY2, number2, saveS2) / innerProduct(saveY2, number2, saveY2); delta = 1.0; //temp memset(zz, 0, number2 * sizeof(double)); int put = 0; for (iVariable = 0; iVariable < number2; iVariable++) { zz[put] = delta; put += number2 + 1; } } else { } CoinMemcpyN(zz, number2 * number2, zzz); double ww[100]; // get sk -Hkyk for (iVariable = 0; iVariable < number2; iVariable++) { double value = 0.0; for (int jVariable = 0; jVariable < number2; jVariable++) { value += saveY2[jVariable] * zzz[iVariable+number2*jVariable]; } ww[iVariable] = saveS2[iVariable] - value; } double ys = innerProduct(saveY2, number2, saveS2); double multiplier1 = 1.0 / ys; double multiplier2 = innerProduct(saveY2, number2, ww) / (ys * ys); #if 1 // and second way // Hy double h[100]; for (iVariable = 0; iVariable < number2; iVariable++) { double value = 0.0; for (int jVariable = 0; jVariable < number2; jVariable++) { value += saveY2[jVariable] * zzz[iVariable+number2*jVariable]; } h[iVariable] = value; } double hh[10000]; double yhy1 = innerProduct(h, number2, saveY2) * multiplier1 + 1.0; yhy1 *= multiplier1; for (iVariable = 0; iVariable < number2; iVariable++) { for (int jVariable = 0; jVariable < number2; jVariable++) { int put = iVariable + number2 * jVariable; double value = zzz[put]; value += yhy1 * saveS2[iVariable] * saveS2[jVariable]; hh[put] = value; } } for (iVariable = 0; iVariable < number2; iVariable++) { for (int jVariable = 0; jVariable < number2; jVariable++) { int put = iVariable + number2 * jVariable; double value = hh[put]; value -= multiplier1 * (saveS2[iVariable] * h[jVariable]); value -= multiplier1 * (saveS2[jVariable] * h[iVariable]); hh[put] = value; } } #endif // now update H for (iVariable = 0; iVariable < number2; iVariable++) { for (int jVariable = 0; jVariable < number2; jVariable++) { int put = iVariable + number2 * jVariable; double value = zzz[put]; value += multiplier1 * (ww[iVariable] * saveS2[jVariable] + ww[jVariable] * saveS2[iVariable]); value -= multiplier2 * saveS2[iVariable] * saveS2[jVariable]; zzz[put] = value; } } //memcpy(zzz,hh,size*sizeof(double)); // do search direction memset(dArray, 0, numberTotal * sizeof(double)); for (iVariable = 0; iVariable < numberNonBasic; iVariable++) { double value = 0.0; for (int jVariable = 0; jVariable < number2; jVariable++) { int k = which[jVariable]; value += work[k] * zzz[iVariable+number2*jVariable]; } int i = which[iVariable]; dArray[i] = value; } // Now fill out dArray { int j; // Now do basic ones int iRow; CoinIndexedVector * spare1 = spare; CoinIndexedVector * spare2 = rowArray; #if CLP_DEBUG > 1 spare1->checkClear(); spare2->checkClear(); #endif double * array2 = spare1->denseVector(); int * index2 = spare1->getIndices(); int number2 = 0; times(-1.0, dArray, array2); dArray = dArray + numberColumns_; for (iRow = 0; iRow < numberRows_; iRow++) { double value = array2[iRow] + dArray[iRow]; if (value) { array2[iRow] = value; index2[number2++] = iRow; } else { array2[iRow] = 0.0; } } dArray -= numberColumns_; spare1->setNumElements(number2); // Ftran factorization_->updateColumn(spare2, spare1); number2 = spare1->getNumElements(); for (j = 0; j < number2; j++) { int iSequence = index2[j]; double value = array2[iSequence]; array2[iSequence] = 0.0; if (value) { int iPivot = pivotVariable_[iSequence]; double oldValue = dArray[iPivot]; dArray[iPivot] = value + oldValue; } } spare1->setNumElements(0); } //assert (innerProductIndexed(dArray,number2,work,which)>0); //printf ("innerP1 %g\n",innerProduct(dArray,numberTotal,work)); printf ("innerP1 %g innerP2 %g\n", innerProduct(dArray, numberTotal, work), innerProductIndexed(dArray, numberNonBasic, work, which)); assert (innerProduct(dArray, numberTotal, work) > 0); #if 1 { // check null vector int iRow; double qq[10]; memset(qq, 0, numberRows_ * sizeof(double)); multiplyAdd(dArray + numberColumns_, numberRows_, -1.0, qq, 0.0); matrix_->times(1.0, dArray, qq, rowScale_, columnScale_); double largest = 0.0; int iLargest = -1; for (iRow = 0; iRow < numberRows_; iRow++) { double value = fabs(qq[iRow]); if (value > largest) { largest = value; iLargest = iRow; } } printf("largest null error %g on row %d\n", largest, iLargest); for (iSequence = 0; iSequence < numberTotal; iSequence++) { if (getStatus(iSequence) == basic) assert (fabs(dj_[iSequence]) < 1.0e-3); } } #endif CoinMemcpyN(saveY2, numberNonBasic, saveY); CoinMemcpyN(saveS2, numberNonBasic, saveS); } #endif } #if MINTYPE==2 for (iSequence = 0; iSequence < numberNonBasic; iSequence++) { int j = which[iSequence]; saveY2[iSequence] = -work[j]; saveS2[iSequence] = solution_[j]; } #endif if (djNorm < eps * djNorm0 || (nPasses > 100 && djNorm < CoinMin(1.0e-1 * djNorm0, 1.0e-12))) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("dj norm reduced from %g to %g\n", djNorm0, djNorm); #endif if (pivotMode < 10 || !numberNonBasic) { finished = true; } else { localPivotMode = pivotMode; nTotalPasses += nPasses; nPasses = 0; continue; } } //if (nPasses==100||nPasses==50) //printf("pass %d dj norm reduced from %g to %g - flagged norm %g\n",nPasses,djNorm0,djNorm, // normFlagged); if (nPasses > 100 && djNorm < 1.0e-2 * normFlagged && !startLocalMode) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("dj norm reduced from %g to %g - flagged norm %g - unflagging\n", djNorm0, djNorm, normFlagged); #endif unflag(); localPivotMode = 0; nTotalPasses += nPasses; nPasses = 0; continue; } if (djNorm > 0.99 * djNorm0 && nPasses > 1500) { finished = true; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("dj norm NOT reduced from %g to %g\n", djNorm0, djNorm); #endif djNorm = 1.2345e-20; } number = longArray->getNumElements(); if (!numberNonBasic) { // looks optimal // check if any dj look plausible int nSuper = 0; int nFlagged = 0; int nNormal = 0; for (int iSequence = 0; iSequence < numberColumns_ + numberRows_; iSequence++) { if (flagged(iSequence)) { switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case atUpperBound: if (dj_[iSequence] > dualTolerance_) nFlagged++; break; case atLowerBound: if (dj_[iSequence] < -dualTolerance_) nFlagged++; break; case isFree: case superBasic: if (fabs(dj_[iSequence]) > dualTolerance_) nFlagged++; break; } continue; } switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case atUpperBound: if (dj_[iSequence] > dualTolerance_) nNormal++; break; case atLowerBound: if (dj_[iSequence] < -dualTolerance_) nNormal++; break; case isFree: case superBasic: if (fabs(dj_[iSequence]) > dualTolerance_) nSuper++; break; } } #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("%d super, %d normal, %d flagged\n", nSuper, nNormal, nFlagged); #endif int nFlagged2 = 1; if (lastSequenceIn < 0 && !nNormal && !nSuper) { nFlagged2 = unflag(); if (pivotMode >= 10) { pivotMode--; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("pivot mode now %d\n", pivotMode); #endif if (pivotMode == 9) pivotMode = 0; // switch off fast attempt } } else { lastSequenceIn = -1; } if (!nFlagged2 || (normFlagged + normUnflagged < 1.0e-8)) { primalColumnPivot_->setLooksOptimal(true); return 0; } else { localPivotMode = -1; nTotalPasses += nPasses; nPasses = 0; finished = false; continue; } } bestSequence = -1; bestBasicSequence = -1; // temp nPasses++; if (nPasses > 2000) finished = true; double theta = 1.0e30; basicTheta = 1.0e30; theta_ = 1.0e30; double basicTolerance = 1.0e-4 * primalTolerance_; for (iSequence = 0; iSequence < numberTotal; iSequence++) { //if (flagged(iSequence) // continue; double alpha = dArray[iSequence]; Status thisStatus = getStatus(iSequence); double oldValue = solution_[iSequence]; if (thisStatus != basic) { if (fabs(alpha) >= acceptablePivot) { if (alpha < 0.0) { // variable going towards lower bound double bound = lower_[iSequence]; oldValue -= bound; if (oldValue + theta * alpha < 0.0) { bestSequence = iSequence; theta = CoinMax(0.0, oldValue / (-alpha)); } } else { // variable going towards upper bound double bound = upper_[iSequence]; oldValue = bound - oldValue; if (oldValue - theta * alpha < 0.0) { bestSequence = iSequence; theta = CoinMax(0.0, oldValue / alpha); } } } } else { if (fabs(alpha) >= acceptableBasic) { if (alpha < 0.0) { // variable going towards lower bound double bound = lower_[iSequence]; oldValue -= bound; if (oldValue + basicTheta * alpha < -basicTolerance) { bestBasicSequence = iSequence; basicTheta = CoinMax(0.0, (oldValue + basicTolerance) / (-alpha)); } } else { // variable going towards upper bound double bound = upper_[iSequence]; oldValue = bound - oldValue; if (oldValue - basicTheta * alpha < -basicTolerance) { bestBasicSequence = iSequence; basicTheta = CoinMax(0.0, (oldValue + basicTolerance) / alpha); } } } } } theta_ = CoinMin(theta, basicTheta); // Now find minimum of function double objTheta2 = objective_->stepLength(this, solution_, dArray, CoinMin(theta, basicTheta), currentObj, predictedObj, thetaObj); #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("current obj %g thetaObj %g, predictedObj %g\n", currentObj, thetaObj, predictedObj); #endif objTheta2=CoinMin(objTheta2,1.0e29); #if MINTYPE==1 if (conjugate) { double offset; const double * gradient = objective_->gradient(this, dArray, offset, true, 0); double product = 0.0; for (iSequence = 0; iSequence < numberColumns_; iSequence++) { double alpha = dArray[iSequence]; double value = alpha * gradient[iSequence]; product += value; } //#define INCLUDESLACK #ifdef INCLUDESLACK for (; iSequence < numberColumns_ + numberRows_; iSequence++) { double alpha = dArray[iSequence]; double value = alpha * cost_[iSequence]; product += value; } #endif if (product > 0.0) objTheta = djNorm / product; else objTheta = COIN_DBL_MAX; #ifndef NDEBUG if (product < -1.0e-8 && handler_->logLevel() > 1) printf("bad product %g\n", product); #endif product = CoinMax(product, 0.0); } else { objTheta = objTheta2; } #else objTheta = objTheta2; #endif // if very small difference then take pivot (depends on djNorm?) // distinguish between basic and non-basic bool chooseObjTheta = objTheta < theta_; if (chooseObjTheta) { if (thetaObj < currentObj - 1.0e-12 && objTheta + 1.0e-10 > theta_) chooseObjTheta = false; //if (thetaObjtheta_) //chooseObjTheta=false; } //if (objTheta+SMALLTHETA1currentObj+difference&&objThetabasicTheta) { //theta = CoinMax(theta,1.00000001*basicTheta); //theta_ = basicTheta; //} } // always out if one variable in and zero move if (theta_ == basicTheta || (sequenceIn_ >= 0 && theta_ < 1.0e-10)) finished = true; // come out #ifdef CLP_DEBUG if (handler_->logLevel() & 32) { printf("%d pass,", nPasses); if (sequenceIn_ >= 0) printf (" Sin %d,", sequenceIn_); if (basicTheta == theta_) printf(" X(%d) basicTheta %g", bestBasicSequence, basicTheta); else printf(" basicTheta %g", basicTheta); if (theta == theta_) printf(" X(%d) non-basicTheta %g", bestSequence, theta); else printf(" non-basicTheta %g", theta); printf(" %s objTheta %g", objTheta == theta_ ? "X" : "", objTheta); printf(" djNorm %g\n", djNorm); } #endif if (handler_->logLevel() > 3 && objTheta != theta_) { printf("%d pass obj %g,", nPasses, currentObj); if (sequenceIn_ >= 0) printf (" Sin %d,", sequenceIn_); if (basicTheta == theta_) printf(" X(%d) basicTheta %g", bestBasicSequence, basicTheta); else printf(" basicTheta %g", basicTheta); if (theta == theta_) printf(" X(%d) non-basicTheta %g", bestSequence, theta); else printf(" non-basicTheta %g", theta); printf(" %s objTheta %g", objTheta == theta_ ? "X" : "", objTheta); printf(" djNorm %g\n", djNorm); } if (objTheta != theta_) { //printf("hit boundary after %d passes\n",nPasses); nTotalPasses += nPasses; nPasses = 0; // start again } if (localPivotMode < 10 || lastSequenceIn == bestSequence) { if (theta_ == theta && theta_ < basicTheta && theta_ < 1.0e-5) setFlagged(bestSequence); // out of active set } // Update solution for (iSequence = 0; iSequence < numberTotal; iSequence++) { //for (iIndex=0;iIndexsetOne(iSequence, value); break; case superBasic: // To get correct action setStatus(iSequence, isFixed); nonLinearCost_->setOne(iSequence, value); //assert (getStatus(iSequence)!=isFixed); break; } } } if (objTheta < SMALLTHETA2 && objTheta == theta_) { if (sequenceIn_ >= 0 && basicTheta < 1.0e-9) { // try just one localPivotMode = 0; sequenceIn_ = -1; nTotalPasses += nPasses; nPasses = 0; //finished=true; //objTheta=0.0; //theta_=0.0; } else if (sequenceIn_ < 0 && nTotalPasses > 10) { if (objTheta < 1.0e-10) { finished = true; //printf("zero move\n"); break; } } } #ifdef CLP_DEBUG if (handler_->logLevel() & 32) { objective_->stepLength(this, solution_, work, 0.0, currentObj, predictedObj, thetaObj); printf("current obj %g after update - simple was %g\n", currentObj, simpleObjective); } #endif if (sequenceIn_ >= 0 && !finished && objTheta > 1.0e-4) { // we made some progress - back to normal if (localPivotMode < 10) { localPivotMode = 0; sequenceIn_ = -1; nTotalPasses += nPasses; nPasses = 0; } #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("some progress?\n"); #endif } #if CLP_DEBUG > 1 longArray->checkClean(); #endif } #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("out of loop after %d (%d) passes\n", nPasses, nTotalPasses); #endif if (nTotalPasses >= 1000 || (nTotalPasses > 10 && sequenceIn_ < 0 && theta_ < 1.0e-10)) returnCode = 2; bool ordinaryDj = false; //if(sequenceIn_>=0&&numberNonBasic==1&&theta_<1.0e-7&&theta_==basicTheta) //printf("could try ordinary iteration %g\n",theta_); if(sequenceIn_ >= 0 && numberNonBasic == 1 && theta_ < 1.0e-15) { //printf("trying ordinary iteration\n"); ordinaryDj = true; } if (!basicTheta && !ordinaryDj) { //returnCode=2; //objTheta=-1.0; // so we fall through } assert (theta_ < 1.0e30); // for now // See if we need to pivot if (theta_ == basicTheta || ordinaryDj) { if (!ordinaryDj) { // find an incoming column which will force pivot int iRow; pivotRow_ = -1; for (iRow = 0; iRow < numberRows_; iRow++) { if (pivotVariable_[iRow] == bestBasicSequence) { pivotRow_ = iRow; break; } } assert (pivotRow_ >= 0); // Get good size for pivot double acceptablePivot = 1.0e-7; if (factorization_->pivots() > 10) acceptablePivot = 1.0e-5; // if we have iterated be more strict else if (factorization_->pivots() > 5) acceptablePivot = 1.0e-6; // if we have iterated be slightly more strict // should be dArray but seems better this way! double direction = work[bestBasicSequence] > 0.0 ? -1.0 : 1.0; // create as packed rowArray->createPacked(1, &pivotRow_, &direction); factorization_->updateColumnTranspose(spare, rowArray); // put row of tableau in rowArray and columnArray matrix_->transposeTimes(this, -1.0, rowArray, spare, columnArray); // choose one futhest away from bound which has reasonable pivot // If increasing we want negative alpha double * work2; int iSection; sequenceIn_ = -1; double bestValue = -1.0; double bestDirection = 0.0; // First pass we take correct direction and large pivots // then correct direction // then any double check[] = {1.0e-8, -1.0e-12, -1.0e30}; double mult[] = {100.0, 1.0, 1.0}; for (int iPass = 0; iPass < 3; iPass++) { //if (!bestValue&&iPass==2) //bestValue=-1.0; double acceptable = acceptablePivot * mult[iPass]; double checkValue = check[iPass]; for (iSection = 0; iSection < 2; iSection++) { int addSequence; if (!iSection) { work2 = rowArray->denseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); addSequence = numberColumns_; } else { work2 = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); addSequence = 0; } int i; for (i = 0; i < number; i++) { int iSequence = which[i] + addSequence; if (flagged(iSequence)) continue; //double distance = CoinMin(solution_[iSequence]-lower_[iSequence], // upper_[iSequence]-solution_[iSequence]); double alpha = work2[i]; // should be dArray but seems better this way! double change = work[iSequence]; Status thisStatus = getStatus(iSequence); double direction = 0;; switch(thisStatus) { case basic: case ClpSimplex::isFixed: break; case isFree: case superBasic: if (alpha < -acceptable && change > checkValue) direction = 1.0; else if (alpha > acceptable && change < -checkValue) direction = -1.0; break; case atUpperBound: if (alpha > acceptable && change < -checkValue) direction = -1.0; else if (iPass == 2 && alpha < -acceptable && change < -checkValue) direction = 1.0; break; case atLowerBound: if (alpha < -acceptable && change > checkValue) direction = 1.0; else if (iPass == 2 && alpha > acceptable && change > checkValue) direction = -1.0; break; } if (direction) { if (sequenceIn_ != lastSequenceIn || localPivotMode < 10) { if (CoinMin(solution_[iSequence] - lower_[iSequence], upper_[iSequence] - solution_[iSequence]) > bestValue) { bestValue = CoinMin(solution_[iSequence] - lower_[iSequence], upper_[iSequence] - solution_[iSequence]); sequenceIn_ = iSequence; bestDirection = direction; } } else { // choose bestValue = COIN_DBL_MAX; sequenceIn_ = iSequence; bestDirection = direction; } } } } if (sequenceIn_ >= 0 && bestValue > 0.0) break; } if (sequenceIn_ >= 0) { valueIn_ = solution_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; if (bestDirection < 0.0) { // we want positive dj if (dualIn_ <= 0.0) { //printf("bad dj - xx %g\n",dualIn_); dualIn_ = 1.0; } } else { // we want negative dj if (dualIn_ >= 0.0) { //printf("bad dj - xx %g\n",dualIn_); dualIn_ = -1.0; } } lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; if (dualIn_ > 0.0) directionIn_ = -1; else directionIn_ = 1; } else { //ordinaryDj=true; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) { printf("no easy pivot - norm %g mode %d\n", djNorm, localPivotMode); if (rowArray->getNumElements() + columnArray->getNumElements() < 12) { for (iSection = 0; iSection < 2; iSection++) { int addSequence; if (!iSection) { work2 = rowArray->denseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); addSequence = numberColumns_; } else { work2 = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); addSequence = 0; } int i; char section[] = {'R', 'C'}; for (i = 0; i < number; i++) { int iSequence = which[i] + addSequence; if (flagged(iSequence)) { printf("%c%d flagged\n", section[iSection], which[i]); continue; } else { printf("%c%d status %d sol %g %g %g alpha %g change %g\n", section[iSection], which[i], status_[iSequence], lower_[iSequence], solution_[iSequence], upper_[iSequence], work2[i], work[iSequence]); } } } } } #endif assert (sequenceIn_ < 0); justOne = true; allFinished = false; // Round again finished = false; nTotalPasses += nPasses; nPasses = 0; if (djNorm < 0.9 * djNorm0 && djNorm < 1.0e-3 && !localPivotMode) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("no pivot - mode %d norms %g %g - unflagging\n", localPivotMode, djNorm0, djNorm); #endif unflag(); //unflagging returnCode = 1; } else { returnCode = 2; // do single incoming returnCode = 1; } } } rowArray->clear(); columnArray->clear(); longArray->clear(); if (ordinaryDj) { valueIn_ = solution_[sequenceIn_]; dualIn_ = dj_[sequenceIn_]; lowerIn_ = lower_[sequenceIn_]; upperIn_ = upper_[sequenceIn_]; if (dualIn_ > 0.0) directionIn_ = -1; else directionIn_ = 1; } if (returnCode == 1) returnCode = 0; } else { // round again longArray->clear(); if (djNorm < 1.0e-3 && !localPivotMode) { if (djNorm == 1.2345e-20 && djNorm0 > 1.0e-4) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("slow convergence djNorm0 %g, %d passes, mode %d, result %d\n", djNorm0, nPasses, localPivotMode, returnCode); #endif //if (!localPivotMode) //returnCode=2; // force singleton } else { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("unflagging as djNorm %g %g, %d passes\n", djNorm, djNorm0, nPasses); #endif if (pivotMode >= 10) { pivotMode--; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("pivot mode now %d\n", pivotMode); #endif if (pivotMode == 9) pivotMode = 0; // switch off fast attempt } bool unflagged = unflag() != 0; if (!unflagged && djNorm < 1.0e-10) { // ? declare victory sequenceIn_ = -1; returnCode = 0; } } } } } if (djNorm0 < 1.0e-12 * normFlagged) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("unflagging as djNorm %g %g and flagged norm %g\n", djNorm, djNorm0, normFlagged); #endif unflag(); } if (saveObj - currentObj < 1.0e-5 && nTotalPasses > 2000) { normUnflagged = 0.0; double dualTolerance3 = CoinMin(1.0e-2, 1.0e3 * dualTolerance_); for (int iSequence = 0; iSequence < numberColumns_ + numberRows_; iSequence++) { switch(getStatus(iSequence)) { case basic: case ClpSimplex::isFixed: break; case atUpperBound: if (dj_[iSequence] > dualTolerance3) normFlagged += dj_[iSequence] * dj_[iSequence]; break; case atLowerBound: if (dj_[iSequence] < -dualTolerance3) normFlagged += dj_[iSequence] * dj_[iSequence]; break; case isFree: case superBasic: if (fabs(dj_[iSequence]) > dualTolerance3) normFlagged += dj_[iSequence] * dj_[iSequence]; break; } } if (handler_->logLevel() > 2) printf("possible optimal %d %d %g %g\n", nBigPasses, nTotalPasses, saveObj - currentObj, normFlagged); if (normFlagged < 1.0e-5) { unflag(); primalColumnPivot_->setLooksOptimal(true); returnCode = 0; } } return returnCode; } /* Do last half of an iteration. Return codes Reasons to come out normal mode -1 normal -2 factorize now - good iteration -3 slight inaccuracy - refactorize - iteration done -4 inaccuracy - refactorize - no iteration -5 something flagged - go round again +2 looks unbounded +3 max iterations (iteration done) */ int ClpSimplexNonlinear::pivotNonlinearResult() { int returnCode = -1; rowArray_[1]->clear(); // we found a pivot column // update the incoming column unpackPacked(rowArray_[1]); factorization_->updateColumnFT(rowArray_[2], rowArray_[1]); theta_ = 0.0; double * work = rowArray_[1]->denseVector(); int number = rowArray_[1]->getNumElements(); int * which = rowArray_[1]->getIndices(); bool keepValue = false; double saveValue = 0.0; if (pivotRow_ >= 0) { sequenceOut_ = pivotVariable_[pivotRow_];; valueOut_ = solution(sequenceOut_); keepValue = true; saveValue = valueOut_; lowerOut_ = lower_[sequenceOut_]; upperOut_ = upper_[sequenceOut_]; int iIndex; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; if (iRow == pivotRow_) { alpha_ = work[iIndex]; break; } } } else { int iIndex; double smallest = COIN_DBL_MAX; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iIndex]; if (fabs(alpha) > 1.0e-6) { int iPivot = pivotVariable_[iRow]; double distance = CoinMin(upper_[iPivot] - solution_[iPivot], solution_[iPivot] - lower_[iPivot]); if (distance < smallest) { pivotRow_ = iRow; alpha_ = alpha; smallest = distance; } } } if (smallest > primalTolerance_) { smallest = COIN_DBL_MAX; for (iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; double alpha = work[iIndex]; if (fabs(alpha) > 1.0e-6) { double distance = randomNumberGenerator_.randomDouble(); if (distance < smallest) { pivotRow_ = iRow; alpha_ = alpha; smallest = distance; } } } } assert (pivotRow_ >= 0); sequenceOut_ = pivotVariable_[pivotRow_];; valueOut_ = solution(sequenceOut_); lowerOut_ = lower_[sequenceOut_]; upperOut_ = upper_[sequenceOut_]; } double newValue = valueOut_ - theta_ * alpha_; bool isSuperBasic = false; if (valueOut_ >= upperOut_ - primalTolerance_) { directionOut_ = -1; // to upper bound upperOut_ = nonLinearCost_->nearest(sequenceOut_, newValue); upperOut_ = newValue; } else if (valueOut_ <= lowerOut_ + primalTolerance_) { directionOut_ = 1; // to lower bound lowerOut_ = nonLinearCost_->nearest(sequenceOut_, newValue); } else { lowerOut_ = valueOut_; upperOut_ = valueOut_; isSuperBasic = true; //printf("XX superbasic out\n"); } dualOut_ = dj_[sequenceOut_]; // if stable replace in basis int updateStatus = factorization_->replaceColumn(this, rowArray_[2], rowArray_[1], pivotRow_, alpha_); // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && lastGoodIteration_ == numberIterations_ && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4) { // slight error if (factorization_->pivots() > 5 || updateStatus == 4) { returnCode = -3; } } else if (updateStatus == 2) { // major error // better to have small tolerance even if slower factorization_->zeroTolerance(CoinMin(factorization_->zeroTolerance(), 1.0e-15)); int maxFactor = factorization_->maximumPivots(); if (maxFactor > 10) { if (forceFactorization_ < 0) forceFactorization_ = maxFactor; forceFactorization_ = CoinMax(1, (forceFactorization_ >> 1)); } // later we may need to unwind more e.g. fake bounds if(lastGoodIteration_ != numberIterations_) { clearAll(); pivotRow_ = -1; returnCode = -4; } else { // need to reject something char x = isColumn(sequenceIn_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceIn_) << CoinMessageEol; setFlagged(sequenceIn_); progress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious clearAll(); pivotRow_ = -1; sequenceOut_ = -1; returnCode = -5; } return returnCode; } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (factorization_->pivots() < 0.5 * factorization_->maximumPivots() && factorization_->pivots() < 200) factorization_->areaFactor( factorization_->areaFactor() * 1.1); returnCode = -2; // factorize now } else if (updateStatus == 5) { problemStatus_ = -2; // factorize now } // update primal solution double objectiveChange = 0.0; // after this rowArray_[1] is not empty - used to update djs // If pivot row >= numberRows then may be gub updatePrimalsInPrimal(rowArray_[1], theta_, objectiveChange, 1); double oldValue = valueIn_; if (directionIn_ == -1) { // as if from upper bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ -= fabs(theta_); } else { valueIn_ = lowerIn_; } } else { // as if from lower bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ += fabs(theta_); } else { valueIn_ = upperIn_; } } objectiveChange += dualIn_ * (valueIn_ - oldValue); // outgoing if (sequenceIn_ != sequenceOut_) { if (directionOut_ > 0) { valueOut_ = lowerOut_; } else { valueOut_ = upperOut_; } if(valueOut_ < lower_[sequenceOut_] - primalTolerance_) valueOut_ = lower_[sequenceOut_] - 0.9 * primalTolerance_; else if (valueOut_ > upper_[sequenceOut_] + primalTolerance_) valueOut_ = upper_[sequenceOut_] + 0.9 * primalTolerance_; // may not be exactly at bound and bounds may have changed // Make sure outgoing looks feasible if (!isSuperBasic) directionOut_ = nonLinearCost_->setOneOutgoing(sequenceOut_, valueOut_); solution_[sequenceOut_] = valueOut_; } // change cost and bounds on incoming if primal nonLinearCost_->setOne(sequenceIn_, valueIn_); int whatNext = housekeeping(objectiveChange); if (keepValue) solution_[sequenceOut_] = saveValue; if (isSuperBasic) setStatus(sequenceOut_, superBasic); //#define CLP_DEBUG #if CLP_DEBUG > 1 { int ninf = matrix_->checkFeasible(this); if (ninf) printf("infeas %d\n", ninf); } #endif if (whatNext == 1) { returnCode = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent returnCode = 3; } else if(numberIterations_ == lastGoodIteration_ + 2 * factorization_->maximumPivots()) { // done a lot of flips - be safe returnCode = -2; // refactorize } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 4; } } return returnCode; } // May use a cut approach for solving any LP int ClpSimplexNonlinear::primalDualCuts(char * rowsIn, int startUp,int algorithm) { if (!rowsIn) { if (algorithm>0) return ClpSimplex::primal(startUp); else //return static_cast(static_cast(this))->dual(startUp); return ClpSimplex::dual(startUp); } else { int numberUsed=0; int rowsThreshold=CoinMax(100,numberRows_/2); //int rowsTry=CoinMax(50,numberRows_/4); // Just add this number of rows each time in small problem int smallNumberRows = 2 * numberColumns_; smallNumberRows = CoinMin(smallNumberRows, numberRows_ / 20); // We will need arrays to choose rows to add double * weight = new double [numberRows_]; int * sort = new int [numberRows_+numberColumns_]; int * whichColumns = sort+numberRows_; int numberSort = 0; for (int i=0;i10.0*primalTolerance_) { numberPrimalInfeasibilities_++; if (lowerDifference<0.0) sumPrimalInfeasibilities_ -= lowerDifference; else sumPrimalInfeasibilities_ += upperDifference; rowsIn[i]=1; } else if (getRowStatus(i)!=basic) { numberBinding++; rowsIn[i]=1; } } if (numberBinding10.0*primalTolerance_) { if (lowerDifference<0.0) sumPrimalInfeasibilities_ -= lowerDifference; else sumPrimalInfeasibilities_ += upperDifference; numberPrimalInfeasibilities_++; } } printf("Initial infeasibilities - %g (%d)\n", sumPrimalInfeasibilities_,numberPrimalInfeasibilities_); // Just do this number of passes int maxPass = 50; // And take out slack rows until this pass int takeOutPass = 30; int iPass; const int * start = this->clpMatrix()->getVectorStarts(); const int * length = this->clpMatrix()->getVectorLengths(); const int * row = this->clpMatrix()->getIndices(); problemStatus_=1; for (iPass = 0; iPass < maxPass; iPass++) { printf("Start of pass %d\n", iPass); int numberSmallColumns = 0; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { int n = 0; for (CoinBigIndex j = start[iColumn]; j < start[iColumn] + length[iColumn]; j++) { int iRow = row[j]; if (rowsIn[iRow]) n++; } if (n) whichColumns[numberSmallColumns++] = iColumn; } numberSort=0; for (int i=0;i20) { if (sumPrimalInfeasibilities_>1.0e-1) { small.dual(); } else { small.primal(1); } } else { // presolve #if 0 ClpSolve::SolveType method; ClpSolve::PresolveType presolveType = ClpSolve::presolveOn; ClpSolve solveOptions; solveOptions.setPresolveType(presolveType, 5); if (sumPrimalInfeasibilities_>1.0e-1) method = ClpSolve::useDual; else method = ClpSolve::usePrimalorSprint; solveOptions.setSolveType(method); small.initialSolve(solveOptions); #else #if 1 ClpPresolve * pinfo = new ClpPresolve(); ClpSimplex * small2 = pinfo->presolvedModel(small,1.0e-5); assert (small2); if (sumPrimalInfeasibilities_>1.0e-1) { small2->dual(); } else { small2->primal(1); } pinfo->postsolve(true); delete pinfo; #else char * types = new char[small.numberRows()+small.numberColumns()]; memset(types,0,small.numberRows()+small.numberColumns()); if (sumPrimalInfeasibilities_>1.0e-1) { small.miniSolve(types,types+small.numberRows(), -1,0); } else { small.miniSolve(types,types+small.numberRows(), 1,1); } delete [] types; #endif if (small.sumPrimalInfeasibilities()>1.0) small.primal(1); #endif } bool dualInfeasible = (small.status() == 2); // move solution back const double * smallSolution = small.primalColumnSolution(); for (int j = 0; j < numberSmallColumns; j++) { int iColumn = whichColumns[j]; columnActivity_[iColumn] = smallSolution[j]; this->setColumnStatus(iColumn, small.getColumnStatus(j)); } for (int iRow = 0; iRow < numberSort; iRow++) { int kRow = sort[iRow]; this->setRowStatus(kRow, small.getRowStatus(iRow)); } // compute full solution memset(rowActivity_, 0, numberRows_ * sizeof(double)); times(1.0, columnActivity_, rowActivity_); if (iPass != maxPass - 1) { // Mark row as not looked at for (int iRow = 0; iRow < numberRows_; iRow++) weight[iRow] = 1.123e50; // Look at rows already in small problem int iSort; int numberDropped = 0; int numberKept = 0; int numberBinding = 0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; bool allFeasible = small.numberIterations()==0; for (iSort = 0; iSort < numberSort; iSort++) { int iRow = sort[iSort]; //printf("%d %g %g\n",iRow,rowActivity_[iRow],small.primalRowSolution()[iSort]); if (getRowStatus(iRow) == ClpSimplex::basic) { // Basic - we can get rid of if early on if (iPass < takeOutPass && !dualInfeasible) { double infeasibility = CoinMax(rowActivity_[iRow] - rowUpper_[iRow], rowLower_[iRow] - rowActivity_[iRow]); weight[iRow] = -infeasibility; if (infeasibility > primalTolerance_&&!allFeasible) { numberPrimalInfeasibilities_++; sumPrimalInfeasibilities_ += infeasibility; } else { weight[iRow] = 1.0; numberDropped++; } } else { // keep weight[iRow] = -1.0e40; numberKept++; } } else { // keep weight[iRow] = -1.0e50; numberKept++; numberBinding++; } } // Now rest for (int iRow = 0; iRow < numberRows_; iRow++) { sort[iRow] = iRow; if (weight[iRow] == 1.123e50) { // not looked at yet double infeasibility = CoinMax(rowActivity_[iRow] - rowUpper_[iRow], rowLower_[iRow] - rowActivity_[iRow]); weight[iRow] = -infeasibility; if (infeasibility > primalTolerance_) { numberPrimalInfeasibilities_++; sumPrimalInfeasibilities_ += infeasibility; } } } // sort CoinSort_2(weight, weight + numberRows_, sort); numberSort = CoinMin(numberRows_, smallNumberRows + numberKept); memset(rowsIn, 0, numberRows_); for (int iRow = 0; iRow < numberSort; iRow++) rowsIn[sort[iRow]] = 1; printf("%d rows binding, %d rows kept, %d rows dropped - new size %d rows, %d columns\n", numberBinding, numberKept, numberDropped, numberSort, numberSmallColumns); printf("%d rows are infeasible - sum is %g\n", numberPrimalInfeasibilities_, sumPrimalInfeasibilities_); if (!numberPrimalInfeasibilities_) { problemStatus_=0; printf("Exiting as looks optimal\n"); break; } numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; for (iSort = 0; iSort < numberSort; iSort++) { if (weight[iSort] > -1.0e30 && weight[iSort] < -1.0e-8) { numberPrimalInfeasibilities_++; sumPrimalInfeasibilities_ += -weight[iSort]; } } printf("in small model %d rows are infeasible - sum is %g\n", numberPrimalInfeasibilities_, sumPrimalInfeasibilities_); } else { // out of passes problemStatus_=-1; } } delete [] weight; delete [] sort; return 0; } } // A sequential LP method int ClpSimplexNonlinear::primalSLP(int numberPasses, double deltaTolerance, int otherOptions) { // Are we minimizing or maximizing double whichWay = optimizationDirection(); if (whichWay < 0.0) whichWay = -1.0; else if (whichWay > 0.0) whichWay = 1.0; int numberColumns = this->numberColumns(); int numberRows = this->numberRows(); double * columnLower = this->columnLower(); double * columnUpper = this->columnUpper(); double * solution = this->primalColumnSolution(); if (objective_->type() < 2) { // no nonlinear part return ClpSimplex::primal(0); } // Get list of non linear columns char * markNonlinear = new char[numberColumns]; memset(markNonlinear, 0, numberColumns); int numberNonLinearColumns = objective_->markNonlinear(markNonlinear); if (!numberNonLinearColumns) { delete [] markNonlinear; // no nonlinear part return ClpSimplex::primal(0); } int iColumn; int * listNonLinearColumn = new int[numberNonLinearColumns]; numberNonLinearColumns = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if(markNonlinear[iColumn]) listNonLinearColumn[numberNonLinearColumns++] = iColumn; } // Replace objective ClpObjective * trueObjective = objective_; objective_ = new ClpLinearObjective(NULL, numberColumns); double * objective = this->objective(); // See if user wants to use cuts char * rowsIn=NULL; if ((otherOptions&1)!=0||numberPasses<0) { numberPasses=abs(numberPasses); rowsIn=new char[numberRows_]; memset(rowsIn,0,numberRows_); } // get feasible if (this->status() < 0 || numberPrimalInfeasibilities()) primalDualCuts(rowsIn,1,1); // still infeasible if (problemStatus_) { delete [] listNonLinearColumn; return 0; } algorithm_ = 1; int jNon; int * last[3]; double * trust = new double[numberNonLinearColumns]; double * trueLower = new double[numberNonLinearColumns]; double * trueUpper = new double[numberNonLinearColumns]; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; trust[jNon] = 0.5; trueLower[jNon] = columnLower[iColumn]; trueUpper[jNon] = columnUpper[iColumn]; if (solution[iColumn] < trueLower[jNon]) solution[iColumn] = trueLower[jNon]; else if (solution[iColumn] > trueUpper[jNon]) solution[iColumn] = trueUpper[jNon]; } int saveLogLevel = logLevel(); int iPass; double lastObjective = 1.0e31; double * saveSolution = new double [numberColumns]; double * saveRowSolution = new double [numberRows]; memset(saveRowSolution, 0, numberRows * sizeof(double)); double * savePi = new double [numberRows]; double * safeSolution = new double [numberColumns]; unsigned char * saveStatus = new unsigned char[numberRows+numberColumns]; #define MULTIPLE 0 #if MULTIPLE>2 // Duplication but doesn't really matter double * saveSolutionM[MULTIPLE }; for (jNon=0; jNonnewXValues(); double theta = -1.0; double maxTheta = COIN_DBL_MAX; //maxTheta=1.0; if (iPass) { int jNon = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { changeRegion[iColumn] = solution[iColumn] - saveSolution[iColumn]; double alpha = changeRegion[iColumn]; double oldValue = saveSolution[iColumn]; if (markNonlinear[iColumn] == 0) { // linear if (alpha < -1.0e-15) { // variable going towards lower bound double bound = columnLower[iColumn]; oldValue -= bound; if (oldValue + maxTheta * alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / (-alpha)); } } else if (alpha > 1.0e-15) { // variable going towards upper bound double bound = columnUpper[iColumn]; oldValue = bound - oldValue; if (oldValue - maxTheta * alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / alpha); } } } else { // nonlinear if (alpha < -1.0e-15) { // variable going towards lower bound double bound = trueLower[jNon]; oldValue -= bound; if (oldValue + maxTheta * alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / (-alpha)); } } else if (alpha > 1.0e-15) { // variable going towards upper bound double bound = trueUpper[jNon]; oldValue = bound - oldValue; if (oldValue - maxTheta * alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / alpha); } } jNon++; } } // make sure both accurate memset(rowActivity_, 0, numberRows_ * sizeof(double)); times(1.0, solution, rowActivity_); memset(saveRowSolution, 0, numberRows_ * sizeof(double)); times(1.0, saveSolution, saveRowSolution); for (int iRow = 0; iRow < numberRows; iRow++) { double alpha = rowActivity_[iRow] - saveRowSolution[iRow]; double oldValue = saveRowSolution[iRow]; if (alpha < -1.0e-15) { // variable going towards lower bound double bound = rowLower_[iRow]; oldValue -= bound; if (oldValue + maxTheta * alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / (-alpha)); } } else if (alpha > 1.0e-15) { // variable going towards upper bound double bound = rowUpper_[iRow]; oldValue = bound - oldValue; if (oldValue - maxTheta * alpha < 0.0) { maxTheta = CoinMax(0.0, oldValue / alpha); } } } } else { for (iColumn = 0; iColumn < numberColumns; iColumn++) { changeRegion[iColumn] = 0.0; saveSolution[iColumn] = solution[iColumn]; } CoinMemcpyN(rowActivity_, numberRows, saveRowSolution); } // get current value anyway double predictedObj, thetaObj; double maxTheta2 = 2.0; // to work out a b c double theta2 = trueObjective->stepLength(this, saveSolution, changeRegion, maxTheta2, objValue, predictedObj, thetaObj); int lastMoveStatus = goodMove; if (goodMove >= 0) { theta = CoinMin(theta2, maxTheta); #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("theta %g, current %g, at maxtheta %g, predicted %g\n", theta, objValue, thetaObj, predictedObj); #endif if (theta > 0.0 && theta <= 1.0) { // update solution double lambda = 1.0 - theta; for (iColumn = 0; iColumn < numberColumns; iColumn++) solution[iColumn] = lambda * saveSolution[iColumn] + theta * solution[iColumn]; memset(rowActivity_, 0, numberRows_ * sizeof(double)); times(1.0, solution, rowActivity_); if (lambda > 0.999) { CoinMemcpyN(savePi, numberRows, this->dualRowSolution()); CoinMemcpyN(saveStatus, numberRows + numberColumns, status_); } // Do local minimization #define LOCAL #ifdef LOCAL bool absolutelyOptimal = false; int saveScaling = scalingFlag(); scaling(0); int savePerturbation = perturbation_; perturbation_ = 100; if (saveLogLevel == 1) setLogLevel(0); int status = startup(1); if (!status) { int numberTotal = numberRows_ + numberColumns_; // resize arrays for (int i = 0; i < 4; i++) { rowArray_[i]->reserve(CoinMax(numberRows_ + numberColumns_, rowArray_[i]->capacity())); } CoinIndexedVector * longArray = rowArray_[3]; CoinIndexedVector * rowArray = rowArray_[0]; //CoinIndexedVector * columnArray = columnArray_[0]; CoinIndexedVector * spare = rowArray_[1]; double * work = longArray->denseVector(); int * which = longArray->getIndices(); int nPass = 100; //bool conjugate=false; // Put back true bounds for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { int iColumn = listNonLinearColumn[jNon]; double value; value = trueLower[jNon]; trueLower[jNon] = lower_[iColumn]; lower_[iColumn] = value; value = trueUpper[jNon]; trueUpper[jNon] = upper_[iColumn]; upper_[iColumn] = value; switch(getStatus(iColumn)) { case basic: case isFree: case superBasic: break; case isFixed: case atUpperBound: case atLowerBound: if (solution_[iColumn] > lower_[iColumn] + primalTolerance_) { if(solution_[iColumn] < upper_[iColumn] - primalTolerance_) { setStatus(iColumn, superBasic); } else { setStatus(iColumn, atUpperBound); } } else { if(solution_[iColumn] < upper_[iColumn] - primalTolerance_) { setStatus(iColumn, atLowerBound); } else { setStatus(iColumn, isFixed); } } break; } } for (int jPass = 0; jPass < nPass; jPass++) { trueObjective->reducedGradient(this, dj_, true); // get direction vector in longArray longArray->clear(); double normFlagged = 0.0; double normUnflagged = 0.0; int numberNonBasic = 0; directionVector(longArray, spare, rowArray, 0, normFlagged, normUnflagged, numberNonBasic); if (normFlagged + normUnflagged < 1.0e-8) { absolutelyOptimal = true; break; //looks optimal } double djNorm = 0.0; int iIndex; for (iIndex = 0; iIndex < numberNonBasic; iIndex++) { int iSequence = which[iIndex]; double alpha = work[iSequence]; djNorm += alpha * alpha; } //if (!jPass) //printf("dj norm %g - %d \n",djNorm,numberNonBasic); //int number=longArray->getNumElements(); if (!numberNonBasic) { // looks optimal absolutelyOptimal = true; break; } double theta = 1.0e30; int iSequence; for (iSequence = 0; iSequence < numberTotal; iSequence++) { double alpha = work[iSequence]; double oldValue = solution_[iSequence]; if (alpha < -1.0e-15) { // variable going towards lower bound double bound = lower_[iSequence]; oldValue -= bound; if (oldValue + theta * alpha < 0.0) { theta = CoinMax(0.0, oldValue / (-alpha)); } } else if (alpha > 1.0e-15) { // variable going towards upper bound double bound = upper_[iSequence]; oldValue = bound - oldValue; if (oldValue - theta * alpha < 0.0) { theta = CoinMax(0.0, oldValue / alpha); } } } // Now find minimum of function double currentObj; double predictedObj; double thetaObj; // need to use true objective double * saveCost = cost_; cost_ = NULL; double objTheta = trueObjective->stepLength(this, solution_, work, theta, currentObj, predictedObj, thetaObj); cost_ = saveCost; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("current obj %g thetaObj %g, predictedObj %g\n", currentObj, thetaObj, predictedObj); #endif //printf("current obj %g thetaObj %g, predictedObj %g\n",currentObj,thetaObj,predictedObj); //printf("objTheta %g theta %g\n",objTheta,theta); if (theta > objTheta) { theta = objTheta; thetaObj = predictedObj; } // update one used outside objValue = currentObj; if (theta > 1.0e-9 && (currentObj - thetaObj < -CoinMax(1.0e-8, 1.0e-15 * fabs(currentObj)) || jPass < 5)) { // Update solution for (iSequence = 0; iSequence < numberTotal; iSequence++) { double alpha = work[iSequence]; if (alpha) { double value = solution_[iSequence] + theta * alpha; solution_[iSequence] = value; switch(getStatus(iSequence)) { case basic: case isFixed: case isFree: break; case atUpperBound: case atLowerBound: case superBasic: if (value > lower_[iSequence] + primalTolerance_) { if(value < upper_[iSequence] - primalTolerance_) { setStatus(iSequence, superBasic); } else { setStatus(iSequence, atUpperBound); } } else { if(value < upper_[iSequence] - primalTolerance_) { setStatus(iSequence, atLowerBound); } else { setStatus(iSequence, isFixed); } } break; } } } } else { break; } } // Put back fake bounds for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { int iColumn = listNonLinearColumn[jNon]; double value; value = trueLower[jNon]; trueLower[jNon] = lower_[iColumn]; lower_[iColumn] = value; value = trueUpper[jNon]; trueUpper[jNon] = upper_[iColumn]; upper_[iColumn] = value; } } problemStatus_ = 0; finish(); scaling(saveScaling); perturbation_ = savePerturbation; setLogLevel(saveLogLevel); #endif // redo rowActivity memset(rowActivity_, 0, numberRows_ * sizeof(double)); times(1.0, solution, rowActivity_); if (theta > 0.99999 && theta2 < 1.9 && !absolutelyOptimal) { // If big changes then tighten /* thetaObj is objvalue + a*2*2 +b*2 predictedObj is objvalue + a*theta2*theta2 +b*theta2 */ double rhs1 = thetaObj - objValue; double rhs2 = predictedObj - objValue; double subtractB = theta2 * 0.5; double a = (rhs2 - subtractB * rhs1) / (theta2 * theta2 - 4.0 * subtractB); double b = 0.5 * (rhs1 - 4.0 * a); if (fabs(a + b) > 1.0e-2) { // tighten all goodMove = -1; } } } } CoinMemcpyN(trueObjective->gradient(this, solution, offset, true, 2), numberColumns, objective); //printf("offset comp %g orig %g\n",offset,objectiveOffset); // could do faster trueObjective->stepLength(this, solution, changeRegion, 0.0, objValue, predictedObj, thetaObj); #ifdef CLP_INVESTIGATE printf("offset comp %g orig %g - obj from stepLength %g\n", offset, objectiveOffset, objValue); #endif setDblParam(ClpObjOffset, objectiveOffset + offset); int * temp = last[2]; last[2] = last[1]; last[1] = last[0]; last[0] = temp; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; double change = solution[iColumn] - saveSolution[iColumn]; if (change < -1.0e-5) { if (fabs(change + trust[jNon]) < 1.0e-5) temp[jNon] = -1; else temp[jNon] = -2; } else if(change > 1.0e-5) { if (fabs(change - trust[jNon]) < 1.0e-5) temp[jNon] = 1; else temp[jNon] = 2; } else { temp[jNon] = 0; } } // goodMove +1 yes, 0 no, -1 last was bad - just halve gaps, -2 do nothing double maxDelta = 0.0; if (goodMove >= 0) { if (objValue - lastObjective <= 1.0e-15 * fabs(lastObjective)) goodMove = 1; else goodMove = 0; } else { maxDelta = 1.0e10; } double maxGap = 0.0; int numberSmaller = 0; int numberSmaller2 = 0; int numberLarger = 0; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; maxDelta = CoinMax(maxDelta, fabs(solution[iColumn] - saveSolution[iColumn])); if (goodMove > 0) { if (last[0][jNon]*last[1][jNon] < 0) { // halve trust[jNon] *= 0.5; numberSmaller2++; } else { if (last[0][jNon] == last[1][jNon] && last[0][jNon] == last[2][jNon]) trust[jNon] = CoinMin(1.5 * trust[jNon], 1.0e6); numberLarger++; } } else if (goodMove != -2 && trust[jNon] > 10.0 * deltaTolerance) { trust[jNon] *= 0.2; numberSmaller++; } maxGap = CoinMax(maxGap, trust[jNon]); } #ifdef CLP_DEBUG if (handler_->logLevel() & 32) std::cout << "largest gap is " << maxGap << " " << numberSmaller + numberSmaller2 << " reduced (" << numberSmaller << " badMove ), " << numberLarger << " increased" << std::endl; #endif if (iPass > 10000) { for (jNon = 0; jNon < numberNonLinearColumns; jNon++) trust[jNon] *= 0.0001; } if(lastMoveStatus == -1 && goodMove == -1) goodMove = 1; // to force solve if (goodMove > 0) { double drop = lastObjective - objValue; handler_->message(CLP_SLP_ITER, messages_) << iPass << objValue - objectiveOffset << drop << maxDelta << CoinMessageEol; if (iPass > 20 && drop < 1.0e-12 * fabs(objValue)) drop = 0.999e-4; // so will exit if (maxDelta < deltaTolerance && drop < 1.0e-4 && goodMove && theta < 0.99999) { if (handler_->logLevel() > 1) std::cout << "Exiting as maxDelta < tolerance and small drop" << std::endl; break; } } else if (!numberSmaller && iPass > 1) { if (handler_->logLevel() > 1) std::cout << "Exiting as all gaps small" << std::endl; break; } if (!iPass) goodMove = 1; targetDrop = 0.0; double * r = this->dualColumnSolution(); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); } if (iPass) { // get reduced costs this->matrix()->transposeTimes(savePi, this->dualColumnSolution()); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; double dj = objective[iColumn] - r[iColumn]; r[iColumn] = dj; if (dj < -dualTolerance_) targetDrop -= dj * (columnUpper[iColumn] - solution[iColumn]); else if (dj > dualTolerance_) targetDrop -= dj * (columnLower[iColumn] - solution[iColumn]); } } else { memset(r, 0, numberColumns * sizeof(double)); } #if 0 for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; if (statusCheck[iColumn] == 'L' && r[iColumn] < -1.0e-4) { columnLower[iColumn] = CoinMax(solution[iColumn], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); } else if (statusCheck[iColumn] == 'U' && r[iColumn] > 1.0e-4) { columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn], trueUpper[jNon]); } else { columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); } } #endif if (goodMove > 0) { CoinMemcpyN(solution, numberColumns, saveSolution); CoinMemcpyN(rowActivity_, numberRows, saveRowSolution); CoinMemcpyN(this->dualRowSolution(), numberRows, savePi); CoinMemcpyN(status_, numberRows + numberColumns, saveStatus); #if MULTIPLE>2 double * tempSol = saveSolutionM[0]; for (jNon = 0; jNon < MULTIPLE - 1; jNon++) { saveSolutionM[jNon] = saveSolutionM[jNon+1]; } saveSolutionM[MULTIPLE-1] = tempSol; CoinMemcpyN(solution, numberColumns, tempSol); #endif #ifdef CLP_DEBUG if (handler_->logLevel() & 32) std::cout << "Pass - " << iPass << ", target drop is " << targetDrop << std::endl; #endif lastObjective = objValue; if (targetDrop < CoinMax(1.0e-8, CoinMin(1.0e-6, 1.0e-6 * fabs(objValue))) && goodMove && iPass > 3) { if (handler_->logLevel() > 1) printf("Exiting on target drop %g\n", targetDrop); break; } #ifdef CLP_DEBUG { double * r = this->dualColumnSolution(); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; if (handler_->logLevel() & 32) printf("Trust %d %g - solution %d %g obj %g dj %g state %c - bounds %g %g\n", jNon, trust[jNon], iColumn, solution[iColumn], objective[iColumn], r[iColumn], statusCheck[iColumn], columnLower[iColumn], columnUpper[iColumn]); } } #endif //setLogLevel(63); this->scaling(false); if (saveLogLevel == 1) setLogLevel(0); primalDualCuts(rowsIn,1,1); algorithm_ = 1; setLogLevel(saveLogLevel); #ifdef CLP_DEBUG if (this->status()) { writeMps("xx.mps"); } #endif if (this->status() == 1) { // not feasible ! - backtrack and exit // use safe solution CoinMemcpyN(safeSolution, numberColumns, solution); CoinMemcpyN(solution, numberColumns, saveSolution); memset(rowActivity_, 0, numberRows_ * sizeof(double)); times(1.0, solution, rowActivity_); CoinMemcpyN(rowActivity_, numberRows, saveRowSolution); CoinMemcpyN(savePi, numberRows, this->dualRowSolution()); CoinMemcpyN(saveStatus, numberRows + numberColumns, status_); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); } break; } else { // save in case problems CoinMemcpyN(solution, numberColumns, safeSolution); } if (problemStatus_ == 3) break; // probably user interrupt goodMove = 1; } else { // bad pass - restore solution #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("Backtracking\n"); #endif CoinMemcpyN(saveSolution, numberColumns, solution); CoinMemcpyN(saveRowSolution, numberRows, rowActivity_); CoinMemcpyN(savePi, numberRows, this->dualRowSolution()); CoinMemcpyN(saveStatus, numberRows + numberColumns, status_); iPass--; assert (exitPass > 0); goodMove = -1; } } #if MULTIPLE>2 for (jNon = 0; jNon < MULTIPLE; jNon++) { delete [] saveSolutionM[jNon]; } #endif // restore solution CoinMemcpyN(saveSolution, numberColumns, solution); CoinMemcpyN(saveRowSolution, numberRows, rowActivity_); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = CoinMax(solution[iColumn], trueLower[jNon]); columnUpper[iColumn] = CoinMin(solution[iColumn], trueUpper[jNon]); } delete [] markNonlinear; delete [] statusCheck; delete [] savePi; delete [] saveStatus; // redo objective CoinMemcpyN(trueObjective->gradient(this, solution, offset, true, 2), numberColumns, objective); primalDualCuts(rowsIn,1,1); delete objective_; delete [] rowsIn; objective_ = trueObjective; // redo values setDblParam(ClpObjOffset, objectiveOffset); objectiveValue_ += whichWay * offset; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = trueLower[jNon]; columnUpper[iColumn] = trueUpper[jNon]; } delete [] saveSolution; delete [] safeSolution; delete [] saveRowSolution; for (iPass = 0; iPass < 3; iPass++) delete [] last[iPass]; delete [] trust; delete [] trueUpper; delete [] trueLower; delete [] listNonLinearColumn; delete [] changeRegion; // temp //setLogLevel(63); return 0; } /* Primal algorithm for nonlinear constraints Using a semi-trust region approach as for pooling problem This is in because I have it lying around */ int ClpSimplexNonlinear::primalSLP(int numberConstraints, ClpConstraint ** constraints, int numberPasses, double deltaTolerance) { if (!numberConstraints) { // no nonlinear constraints - may be nonlinear objective return primalSLP(numberPasses, deltaTolerance); } // Are we minimizing or maximizing double whichWay = optimizationDirection(); if (whichWay < 0.0) whichWay = -1.0; else if (whichWay > 0.0) whichWay = 1.0; // check all matrix for odd rows is empty int iConstraint; int numberBad = 0; CoinPackedMatrix * columnCopy = matrix(); // Get a row copy in standard format CoinPackedMatrix copy; copy.reverseOrderedCopyOf(*columnCopy); // get matrix data pointers //const int * column = copy.getIndices(); //const CoinBigIndex * rowStart = copy.getVectorStarts(); const int * rowLength = copy.getVectorLengths(); //const double * elementByRow = copy.getElements(); int numberArtificials = 0; // We could use nonlinearcost to do segments - maybe later #define SEGMENTS 3 // Penalties may be adjusted by duals // Both these should be modified depending on problem // Possibly start with big bounds //double penalties[]={1.0e-3,1.0e7,1.0e9}; double penalties[] = {1.0e7, 1.0e8, 1.0e9}; double bounds[] = {1.0e-2, 1.0e2, COIN_DBL_MAX}; // see how many extra we need CoinBigIndex numberExtra = 0; for (iConstraint = 0; iConstraint < numberConstraints; iConstraint++) { ClpConstraint * constraint = constraints[iConstraint]; int iRow = constraint->rowNumber(); assert (iRow >= 0); int n = constraint->numberCoefficients() - rowLength[iRow]; numberExtra += n; if (iRow >= numberRows_) numberBad++; else if (rowLength[iRow] && n) numberBad++; if (rowLower_[iRow] > -1.0e20) numberArtificials++; if (rowUpper_[iRow] < 1.0e20) numberArtificials++; } if (numberBad) return numberBad; ClpObjective * trueObjective = NULL; if (objective_->type() >= 2) { // Replace objective trueObjective = objective_; objective_ = new ClpLinearObjective(NULL, numberColumns_); } ClpSimplex newModel(*this); // we can put back true objective if (trueObjective) { // Replace objective delete objective_; objective_ = trueObjective; } int numberColumns2 = numberColumns_; int numberSmallGap = numberArtificials; if (numberArtificials) { numberArtificials *= SEGMENTS; numberColumns2 += numberArtificials; int * addStarts = new int [numberArtificials+1]; int * addRow = new int[numberArtificials]; double * addElement = new double[numberArtificials]; double * addUpper = new double[numberArtificials]; addStarts[0] = 0; double * addCost = new double [numberArtificials]; numberArtificials = 0; for (iConstraint = 0; iConstraint < numberConstraints; iConstraint++) { ClpConstraint * constraint = constraints[iConstraint]; int iRow = constraint->rowNumber(); if (rowLower_[iRow] > -1.0e20) { for (int k = 0; k < SEGMENTS; k++) { addRow[numberArtificials] = iRow; addElement[numberArtificials] = 1.0; addCost[numberArtificials] = penalties[k]; addUpper[numberArtificials] = bounds[k]; numberArtificials++; addStarts[numberArtificials] = numberArtificials; } } if (rowUpper_[iRow] < 1.0e20) { for (int k = 0; k < SEGMENTS; k++) { addRow[numberArtificials] = iRow; addElement[numberArtificials] = -1.0; addCost[numberArtificials] = penalties[k]; addUpper[numberArtificials] = bounds[k]; numberArtificials++; addStarts[numberArtificials] = numberArtificials; } } } newModel.addColumns(numberArtificials, NULL, addUpper, addCost, addStarts, addRow, addElement); delete [] addStarts; delete [] addRow; delete [] addElement; delete [] addUpper; delete [] addCost; // newModel.primal(1); } // find nonlinear columns int * listNonLinearColumn = new int [numberColumns_+numberSmallGap]; char * mark = new char[numberColumns_]; memset(mark, 0, numberColumns_); for (iConstraint = 0; iConstraint < numberConstraints; iConstraint++) { ClpConstraint * constraint = constraints[iConstraint]; constraint->markNonlinear(mark); } if (trueObjective) trueObjective->markNonlinear(mark); int iColumn; int numberNonLinearColumns = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (mark[iColumn]) listNonLinearColumn[numberNonLinearColumns++] = iColumn; } // and small gap artificials for (iColumn = numberColumns_; iColumn < numberColumns2; iColumn += SEGMENTS) { listNonLinearColumn[numberNonLinearColumns++] = iColumn; } // build row copy of matrix with space for nonzeros // Get column copy columnCopy = newModel.matrix(); copy.reverseOrderedCopyOf(*columnCopy); // get matrix data pointers const int * column = copy.getIndices(); const CoinBigIndex * rowStart = copy.getVectorStarts(); rowLength = copy.getVectorLengths(); const double * elementByRow = copy.getElements(); numberExtra += copy.getNumElements(); CoinBigIndex * newStarts = new CoinBigIndex [numberRows_+1]; int * newColumn = new int[numberExtra]; double * newElement = new double[numberExtra]; newStarts[0] = 0; int * backRow = new int [numberRows_]; int iRow; for (iRow = 0; iRow < numberRows_; iRow++) backRow[iRow] = -1; for (iConstraint = 0; iConstraint < numberConstraints; iConstraint++) { ClpConstraint * constraint = constraints[iConstraint]; iRow = constraint->rowNumber(); backRow[iRow] = iConstraint; } numberExtra = 0; for (iRow = 0; iRow < numberRows_; iRow++) { if (backRow[iRow] < 0) { // copy normal for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { newColumn[numberExtra] = column[j]; newElement[numberExtra++] = elementByRow[j]; } } else { ClpConstraint * constraint = constraints[backRow[iRow]]; assert(iRow == constraint->rowNumber()); int numberArtificials = 0; if (rowLower_[iRow] > -1.0e20) numberArtificials += SEGMENTS; if (rowUpper_[iRow] < 1.0e20) numberArtificials += SEGMENTS; if (numberArtificials == rowLength[iRow]) { // all possible memset(mark, 0, numberColumns_); constraint->markNonzero(mark); for (int k = 0; k < numberColumns_; k++) { if (mark[k]) { newColumn[numberExtra] = k; newElement[numberExtra++] = 1.0; } } // copy artificials for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { newColumn[numberExtra] = column[j]; newElement[numberExtra++] = elementByRow[j]; } } else { // there already // copy for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { newColumn[numberExtra] = column[j]; assert (elementByRow[j]); newElement[numberExtra++] = elementByRow[j]; } } } newStarts[iRow+1] = numberExtra; } delete [] backRow; CoinPackedMatrix saveMatrix(false, numberColumns2, numberRows_, numberExtra, newElement, newColumn, newStarts, NULL, 0.0, 0.0); delete [] newStarts; delete [] newColumn; delete [] newElement; delete [] mark; // get feasible if (whichWay < 0.0) { newModel.setOptimizationDirection(1.0); double * objective = newModel.objective(); for (int iColumn = 0; iColumn < numberColumns_; iColumn++) objective[iColumn] = - objective[iColumn]; } newModel.primal(1); // still infeasible if (newModel.problemStatus() == 1) { delete [] listNonLinearColumn; return 0; } else if (newModel.problemStatus() == 2) { // unbounded - add bounds double * columnLower = newModel.columnLower(); double * columnUpper = newModel.columnUpper(); for (int i = 0; i < numberColumns_; i++) { columnLower[i] = CoinMax(-1.0e8, columnLower[i]); columnUpper[i] = CoinMin(1.0e8, columnUpper[i]); } newModel.primal(1); } int numberRows = newModel.numberRows(); double * columnLower = newModel.columnLower(); double * columnUpper = newModel.columnUpper(); double * objective = newModel.objective(); double * rowLower = newModel.rowLower(); double * rowUpper = newModel.rowUpper(); double * solution = newModel.primalColumnSolution(); int jNon; int * last[3]; double * trust = new double[numberNonLinearColumns]; double * trueLower = new double[numberNonLinearColumns]; double * trueUpper = new double[numberNonLinearColumns]; double objectiveOffset; double objectiveOffset2; getDblParam(ClpObjOffset, objectiveOffset); objectiveOffset *= whichWay; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; double upper = columnUpper[iColumn]; double lower = columnLower[iColumn]; if (solution[iColumn] < lower) solution[iColumn] = lower; else if (solution[iColumn] > upper) solution[iColumn] = upper; #if 0 double large = CoinMax(1000.0, 10.0 * fabs(solution[iColumn])); if (upper > 1.0e10) upper = solution[iColumn] + large; if (lower < -1.0e10) lower = solution[iColumn] - large; #else upper = solution[iColumn] + 0.5; lower = solution[iColumn] - 0.5; #endif //columnUpper[iColumn]=upper; trust[jNon] = 0.05 * (1.0 + upper - lower); trueLower[jNon] = columnLower[iColumn]; //trueUpper[jNon]=upper; trueUpper[jNon] = columnUpper[iColumn]; } bool tryFix = false; int iPass; double lastObjective = 1.0e31; double lastGoodObjective = 1.0e31; double * bestSolution = NULL; double * saveSolution = new double [numberColumns2+numberRows]; char * saveStatus = new char [numberColumns2+numberRows]; double targetDrop = 1.0e31; // 1 bound up, 2 up, -1 bound down, -2 down, 0 no change for (iPass = 0; iPass < 3; iPass++) { last[iPass] = new int[numberNonLinearColumns]; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) last[iPass][jNon] = 0; } int numberZeroPasses = 0; bool zeroTargetDrop = false; double * gradient = new double [numberColumns_]; bool goneFeasible = false; // keep sum of artificials #define KEEP_SUM 5 double sumArt[KEEP_SUM]; for (jNon = 0; jNon < KEEP_SUM; jNon++) sumArt[jNon] = COIN_DBL_MAX; #define SMALL_FIX 0.0 for (iPass = 0; iPass < numberPasses; iPass++) { objectiveOffset2 = objectiveOffset; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; if (solution[iColumn] < trueLower[jNon]) solution[iColumn] = trueLower[jNon]; else if (solution[iColumn] > trueUpper[jNon]) solution[iColumn] = trueUpper[jNon]; columnLower[iColumn] = CoinMax(solution[iColumn] - trust[jNon], trueLower[jNon]); if (!trueLower[jNon] && columnLower[iColumn] < SMALL_FIX) columnLower[iColumn] = SMALL_FIX; columnUpper[iColumn] = CoinMin(solution[iColumn] + trust[jNon], trueUpper[jNon]); if (!trueLower[jNon]) columnUpper[iColumn] = CoinMax(columnUpper[iColumn], columnLower[iColumn] + SMALL_FIX); if (!trueLower[jNon] && tryFix && columnLower[iColumn] == SMALL_FIX && columnUpper[iColumn] < 3.0 * SMALL_FIX) { columnLower[iColumn] = 0.0; solution[iColumn] = 0.0; columnUpper[iColumn] = 0.0; printf("fixing %d\n", iColumn); } } // redo matrix double offset; CoinPackedMatrix newMatrix(saveMatrix); // get matrix data pointers column = newMatrix.getIndices(); rowStart = newMatrix.getVectorStarts(); rowLength = newMatrix.getVectorLengths(); // make sure x updated if (numberConstraints) constraints[0]->newXValues(); else trueObjective->newXValues(); double * changeableElement = newMatrix.getMutableElements(); if (trueObjective) { CoinMemcpyN(trueObjective->gradient(this, solution, offset, true, 2), numberColumns_, objective); } else { CoinMemcpyN(objective_->gradient(this, solution, offset, true, 2), numberColumns_, objective); } if (whichWay < 0.0) { for (int iColumn = 0; iColumn < numberColumns_; iColumn++) objective[iColumn] = - objective[iColumn]; } for (iConstraint = 0; iConstraint < numberConstraints; iConstraint++) { ClpConstraint * constraint = constraints[iConstraint]; int iRow = constraint->rowNumber(); double functionValue; #ifndef NDEBUG int numberErrors = #endif constraint->gradient(&newModel, solution, gradient, functionValue, offset); assert (!numberErrors); // double dualValue = newModel.dualRowSolution()[iRow]; int numberCoefficients = constraint->numberCoefficients(); for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + numberCoefficients; j++) { int iColumn = column[j]; changeableElement[j] = gradient[iColumn]; //objective[iColumn] -= dualValue*gradient[iColumn]; gradient[iColumn] = 0.0; } for (int k = 0; k < numberColumns_; k++) assert (!gradient[k]); if (rowLower_[iRow] > -1.0e20) rowLower[iRow] = rowLower_[iRow] - offset; if (rowUpper_[iRow] < 1.0e20) rowUpper[iRow] = rowUpper_[iRow] - offset; } // Replace matrix // Get a column copy in standard format CoinPackedMatrix * columnCopy = new CoinPackedMatrix();; columnCopy->reverseOrderedCopyOf(newMatrix); newModel.replaceMatrix(columnCopy, true); // solve newModel.primal(1); if (newModel.status() == 1) { // Infeasible! newModel.allSlackBasis(); newModel.primal(); newModel.writeMps("infeas.mps"); assert(!newModel.status()); } double sumInfeas = 0.0; int numberInfeas = 0; for (iColumn = numberColumns_; iColumn < numberColumns2; iColumn++) { if (solution[iColumn] > 1.0e-8) { numberInfeas++; sumInfeas += solution[iColumn]; } } printf("%d artificial infeasibilities - summing to %g\n", numberInfeas, sumInfeas); for (jNon = 0; jNon < KEEP_SUM - 1; jNon++) sumArt[jNon] = sumArt[jNon+1]; sumArt[KEEP_SUM-1] = sumInfeas; if (sumInfeas > 0.01 && sumInfeas * 1.1 > sumArt[0] && penalties[1] < 1.0e7) { // not doing very well - increase - be more sophisticated later lastObjective = COIN_DBL_MAX; for (jNon = 0; jNon < KEEP_SUM; jNon++) sumArt[jNon] = COIN_DBL_MAX; //for (iColumn=numberColumns_;iColumn 0.1) trust[jNon] *= 2.0; else trust[jNon] = 0.1; } if (sumInfeas < 0.001 && !goneFeasible) { goneFeasible = true; penalties[0] = 1.0e-3; penalties[1] = 1.0e6; printf("Got feasible\n"); } double infValue = 0.0; double objValue = 0.0; // make sure x updated if (numberConstraints) constraints[0]->newXValues(); else trueObjective->newXValues(); if (trueObjective) { objValue = trueObjective->objectiveValue(this, solution); printf("objective offset %g\n", offset); objectiveOffset2 = objectiveOffset + offset; // ? sign newModel.setObjectiveOffset(objectiveOffset2); } else { objValue = objective_->objectiveValue(this, solution); } objValue *= whichWay; double infPenalty = 0.0; // This penalty is for target drop double infPenalty2 = 0.0; //const int * row = columnCopy->getIndices(); //const CoinBigIndex * columnStart = columnCopy->getVectorStarts(); //const int * columnLength = columnCopy->getVectorLengths(); //const double * element = columnCopy->getElements(); double * cost = newModel.objective(); column = newMatrix.getIndices(); rowStart = newMatrix.getVectorStarts(); rowLength = newMatrix.getVectorLengths(); elementByRow = newMatrix.getElements(); int jColumn = numberColumns_; double objectiveAdjustment = 0.0; for (iConstraint = 0; iConstraint < numberConstraints; iConstraint++) { ClpConstraint * constraint = constraints[iConstraint]; int iRow = constraint->rowNumber(); double functionValue = constraint->functionValue(this, solution); double dualValue = newModel.dualRowSolution()[iRow]; if (numberConstraints < -50) printf("For row %d current value is %g (row activity %g) , dual is %g\n", iRow, functionValue, newModel.primalRowSolution()[iRow], dualValue); double movement = newModel.primalRowSolution()[iRow] + constraint->offset(); movement = fabs((movement - functionValue) * dualValue); infPenalty2 += movement; double sumOfActivities = 0.0; for (CoinBigIndex j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; sumOfActivities += fabs(solution[iColumn] * elementByRow[j]); } if (rowLower_[iRow] > -1.0e20) { if (functionValue < rowLower_[iRow] - 1.0e-5) { double infeasibility = rowLower_[iRow] - functionValue; double thisPenalty = 0.0; infValue += infeasibility; int k; assert (dualValue >= -1.0e-5); dualValue = CoinMax(dualValue, 0.0); for ( k = 0; k < SEGMENTS; k++) { if (infeasibility <= 0) break; double thisPart = CoinMin(infeasibility, bounds[k]); thisPenalty += thisPart * cost[jColumn+k]; infeasibility -= thisPart; } infeasibility = functionValue - rowUpper_[iRow]; double newPenalty = 0.0; for ( k = 0; k < SEGMENTS; k++) { double thisPart = CoinMin(infeasibility, bounds[k]); cost[jColumn+k] = CoinMax(penalties[k], dualValue + 1.0e-3); newPenalty += thisPart * cost[jColumn+k]; infeasibility -= thisPart; } infPenalty += thisPenalty; objectiveAdjustment += CoinMax(0.0, newPenalty - thisPenalty); } jColumn += SEGMENTS; } if (rowUpper_[iRow] < 1.0e20) { if (functionValue > rowUpper_[iRow] + 1.0e-5) { double infeasibility = functionValue - rowUpper_[iRow]; double thisPenalty = 0.0; infValue += infeasibility; int k; dualValue = -dualValue; assert (dualValue >= -1.0e-5); dualValue = CoinMax(dualValue, 0.0); for ( k = 0; k < SEGMENTS; k++) { if (infeasibility <= 0) break; double thisPart = CoinMin(infeasibility, bounds[k]); thisPenalty += thisPart * cost[jColumn+k]; infeasibility -= thisPart; } infeasibility = functionValue - rowUpper_[iRow]; double newPenalty = 0.0; for ( k = 0; k < SEGMENTS; k++) { double thisPart = CoinMin(infeasibility, bounds[k]); cost[jColumn+k] = CoinMax(penalties[k], dualValue + 1.0e-3); newPenalty += thisPart * cost[jColumn+k]; infeasibility -= thisPart; } infPenalty += thisPenalty; objectiveAdjustment += CoinMax(0.0, newPenalty - thisPenalty); } jColumn += SEGMENTS; } } // adjust last objective value lastObjective += objectiveAdjustment; if (infValue) printf("Sum infeasibilities %g - penalty %g ", infValue, infPenalty); if (objectiveOffset2) printf("offset2 %g ", objectiveOffset2); objValue -= objectiveOffset2; printf("True objective %g or maybe %g (with penalty %g) -pen2 %g %g\n", objValue, objValue + objectiveOffset2, objValue + objectiveOffset2 + infPenalty, infPenalty2, penalties[1]); double useObjValue = objValue + objectiveOffset2 + infPenalty; objValue += infPenalty + infPenalty2; objValue = useObjValue; if (iPass) { double drop = lastObjective - objValue; std::cout << "True drop was " << drop << std::endl; if (drop < -0.05 * fabs(objValue) - 1.0e-4) { // pretty bad - go back and halve CoinMemcpyN(saveSolution, numberColumns2, solution); CoinMemcpyN(saveSolution + numberColumns2, numberRows, newModel.primalRowSolution()); CoinMemcpyN(reinterpret_cast (saveStatus), numberColumns2 + numberRows, newModel.statusArray()); for (jNon = 0; jNon < numberNonLinearColumns; jNon++) if (trust[jNon] > 0.1) trust[jNon] *= 0.5; else trust[jNon] *= 0.9; printf("** Halving trust\n"); objValue = lastObjective; continue; } else if ((iPass % 25) == -1) { for (jNon = 0; jNon < numberNonLinearColumns; jNon++) trust[jNon] *= 2.0; printf("** Doubling trust\n"); } int * temp = last[2]; last[2] = last[1]; last[1] = last[0]; last[0] = temp; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; double change = solution[iColumn] - saveSolution[iColumn]; if (change < -1.0e-5) { if (fabs(change + trust[jNon]) < 1.0e-5) temp[jNon] = -1; else temp[jNon] = -2; } else if(change > 1.0e-5) { if (fabs(change - trust[jNon]) < 1.0e-5) temp[jNon] = 1; else temp[jNon] = 2; } else { temp[jNon] = 0; } } double maxDelta = 0.0; double smallestTrust = 1.0e31; double smallestNonLinearGap = 1.0e31; double smallestGap = 1.0e31; bool increasing = false; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double gap = columnUpper[iColumn] - columnLower[iColumn]; assert (gap >= 0.0); if (gap) smallestGap = CoinMin(smallestGap, gap); } for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; double gap = columnUpper[iColumn] - columnLower[iColumn]; assert (gap >= 0.0); if (gap) { smallestNonLinearGap = CoinMin(smallestNonLinearGap, gap); if (gap < 1.0e-7 && iPass == 1) { printf("Small gap %d %d %g %g %g\n", jNon, iColumn, columnLower[iColumn], columnUpper[iColumn], gap); //trueUpper[jNon]=trueLower[jNon]; //columnUpper[iColumn]=columnLower[iColumn]; } } maxDelta = CoinMax(maxDelta, fabs(solution[iColumn] - saveSolution[iColumn])); if (last[0][jNon]*last[1][jNon] < 0) { // halve if (trust[jNon] > 1.0) trust[jNon] *= 0.5; else trust[jNon] *= 0.7; } else { // ? only increase if +=1 ? if (last[0][jNon] == last[1][jNon] && last[0][jNon] == last[2][jNon] && last[0][jNon]) { trust[jNon] *= 1.8; increasing = true; } } smallestTrust = CoinMin(smallestTrust, trust[jNon]); } std::cout << "largest delta is " << maxDelta << ", smallest trust is " << smallestTrust << ", smallest gap is " << smallestGap << ", smallest nonlinear gap is " << smallestNonLinearGap << std::endl; if (iPass > 200) { //double useObjValue = objValue+objectiveOffset2+infPenalty; if (useObjValue + 1.0e-4 > lastGoodObjective && iPass > 250) { std::cout << "Exiting as objective not changing much" << std::endl; break; } else if (useObjValue < lastGoodObjective) { lastGoodObjective = useObjValue; if (!bestSolution) bestSolution = new double [numberColumns2]; CoinMemcpyN(solution, numberColumns2, bestSolution); } } if (maxDelta < deltaTolerance && !increasing && iPass > 100) { numberZeroPasses++; if (numberZeroPasses == 3) { if (tryFix) { std::cout << "Exiting" << std::endl; break; } else { tryFix = true; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) trust[jNon] = CoinMax(trust[jNon], 1.0e-1); numberZeroPasses = 0; } } } else { numberZeroPasses = 0; } } CoinMemcpyN(solution, numberColumns2, saveSolution); CoinMemcpyN(newModel.primalRowSolution(), numberRows, saveSolution + numberColumns2); CoinMemcpyN(newModel.statusArray(), numberColumns2 + numberRows, reinterpret_cast (saveStatus)); targetDrop = infPenalty + infPenalty2; if (iPass) { // get reduced costs const double * pi = newModel.dualRowSolution(); newModel.matrix()->transposeTimes(pi, newModel.dualColumnSolution()); double * r = newModel.dualColumnSolution(); for (iColumn = 0; iColumn < numberColumns_; iColumn++) r[iColumn] = objective[iColumn] - r[iColumn]; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; double dj = r[iColumn]; if (dj < -1.0e-6) { double drop = -dj * (columnUpper[iColumn] - solution[iColumn]); //double upper = CoinMin(trueUpper[jNon],solution[iColumn]+0.1); //double drop2 = -dj*(upper-solution[iColumn]); #if 0 if (drop > 1.0e8 || drop2 > 100.0 * drop || (drop > 1.0e-2 && iPass > 100)) printf("Big drop %d %g %g %g %g T %g\n", iColumn, columnLower[iColumn], solution[iColumn], columnUpper[iColumn], dj, trueUpper[jNon]); #endif targetDrop += drop; if (dj < -1.0e-1 && trust[jNon] < 1.0e-3 && trueUpper[jNon] - solution[iColumn] > 1.0e-2) { trust[jNon] *= 1.5; //printf("Increasing trust on %d to %g\n", // iColumn,trust[jNon]); } } else if (dj > 1.0e-6) { double drop = -dj * (columnLower[iColumn] - solution[iColumn]); //double lower = CoinMax(trueLower[jNon],solution[iColumn]-0.1); //double drop2 = -dj*(lower-solution[iColumn]); #if 0 if (drop > 1.0e8 || drop2 > 100.0 * drop || (drop > 1.0e-2)) printf("Big drop %d %g %g %g %g T %g\n", iColumn, columnLower[iColumn], solution[iColumn], columnUpper[iColumn], dj, trueLower[jNon]); #endif targetDrop += drop; if (dj > 1.0e-1 && trust[jNon] < 1.0e-3 && solution[iColumn] - trueLower[jNon] > 1.0e-2) { trust[jNon] *= 1.5; printf("Increasing trust on %d to %g\n", iColumn, trust[jNon]); } } } } std::cout << "Pass - " << iPass << ", target drop is " << targetDrop << std::endl; if (iPass > 1 && targetDrop < 1.0e-5 && zeroTargetDrop) break; if (iPass > 1 && targetDrop < 1.0e-5) zeroTargetDrop = true; else zeroTargetDrop = false; //if (iPass==5) //newModel.setLogLevel(63); lastObjective = objValue; // take out when ClpPackedMatrix changed //newModel.scaling(false); #if 0 CoinMpsIO writer; writer.setMpsData(*newModel.matrix(), COIN_DBL_MAX, newModel.getColLower(), newModel.getColUpper(), newModel.getObjCoefficients(), (const char*) 0 /*integrality*/, newModel.getRowLower(), newModel.getRowUpper(), NULL, NULL); writer.writeMps("xx.mps"); #endif } delete [] saveSolution; delete [] saveStatus; for (iPass = 0; iPass < 3; iPass++) delete [] last[iPass]; for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; columnLower[iColumn] = trueLower[jNon]; columnUpper[iColumn] = trueUpper[jNon]; } delete [] trust; delete [] trueUpper; delete [] trueLower; objectiveValue_ = newModel.objectiveValue(); if (bestSolution) { CoinMemcpyN(bestSolution, numberColumns2, solution); delete [] bestSolution; printf("restoring objective of %g\n", lastGoodObjective); objectiveValue_ = lastGoodObjective; } // Simplest way to get true row activity ? double * rowActivity = newModel.primalRowSolution(); for (iRow = 0; iRow < numberRows; iRow++) { double difference; if (fabs(rowLower_[iRow]) < fabs(rowUpper_[iRow])) difference = rowLower_[iRow] - rowLower[iRow]; else difference = rowUpper_[iRow] - rowUpper[iRow]; rowLower[iRow] = rowLower_[iRow]; rowUpper[iRow] = rowUpper_[iRow]; if (difference) { if (numberRows < 50) printf("For row %d activity changes from %g to %g\n", iRow, rowActivity[iRow], rowActivity[iRow] + difference); rowActivity[iRow] += difference; } } delete [] listNonLinearColumn; delete [] gradient; printf("solution still in newModel - do objective etc!\n"); numberIterations_ = newModel.numberIterations(); problemStatus_ = newModel.problemStatus(); secondaryStatus_ = newModel.secondaryStatus(); CoinMemcpyN(newModel.primalColumnSolution(), numberColumns_, columnActivity_); // should do status region CoinZeroN(rowActivity_, numberRows_); matrix_->times(1.0, columnActivity_, rowActivity_); return 0; } CoinMP-1.8.3/Clp/src/CoinAbcFactorization4.cpp0000644000175000017500000000101712101105055017431 0ustar renerene/* $Id: CoinAbcFactorization4.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization4.cpp" #endif CoinMP-1.8.3/Clp/src/ClpMatrixBase.hpp0000644000175000017500000005626312452503025016042 0ustar renerene/* $Id: ClpMatrixBase.hpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpMatrixBase_H #define ClpMatrixBase_H #include "CoinPragma.hpp" #include "CoinTypes.hpp" #include "CoinPackedMatrix.hpp" class CoinIndexedVector; class ClpSimplex; class ClpModel; // Compilers can produce better code if they know about __restrict #ifndef COIN_RESTRICT #ifdef COIN_USE_RESTRICT #define COIN_RESTRICT __restrict #else #define COIN_RESTRICT #endif #endif /** Abstract base class for Clp Matrices Since this class is abstract, no object of this type can be created. If a derived class provides all methods then all Clp algorithms should work. Some can be very inefficient e.g. getElements etc is only used for tightening bounds for dual and the copies are deleted. Many methods can just be dummy i.e. abort(); if not all features are being used. So if column generation was being done then it makes no sense to do steepest edge so there would be no point providing subsetTransposeTimes. */ class ClpMatrixBase { public: /**@name Virtual methods that the derived classes must provide */ //@{ /// Return a complete CoinPackedMatrix virtual CoinPackedMatrix * getPackedMatrix() const = 0; /** Whether the packed matrix is column major ordered or not. */ virtual bool isColOrdered() const = 0; /** Number of entries in the packed matrix. */ virtual CoinBigIndex getNumElements() const = 0; /** Number of columns. */ virtual int getNumCols() const = 0; /** Number of rows. */ virtual int getNumRows() const = 0; /** A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const double * getElements() const = 0; /** A vector containing the minor indices of the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const int * getIndices() const = 0; virtual const CoinBigIndex * getVectorStarts() const = 0; /** The lengths of the major-dimension vectors. */ virtual const int * getVectorLengths() const = 0 ; /** The length of a single major-dimension vector. */ virtual int getVectorLength(int index) const ; /** Delete the columns whose indices are listed in indDel. */ virtual void deleteCols(const int numDel, const int * indDel) = 0; /** Delete the rows whose indices are listed in indDel. */ virtual void deleteRows(const int numDel, const int * indDel) = 0; #ifndef CLP_NO_VECTOR /// Append Columns virtual void appendCols(int number, const CoinPackedVectorBase * const * columns); /// Append Rows virtual void appendRows(int number, const CoinPackedVectorBase * const * rows); #endif /** Modify one element of packed matrix. An element may be added. This works for either ordering If the new element is zero it will be deleted unless keepZero true */ virtual void modifyCoefficient(int row, int column, double newElement, bool keepZero = false); /** Append a set of rows/columns to the end of the matrix. Returns number of errors i.e. if any of the new rows/columns contain an index that's larger than the number of columns-1/rows-1 (if numberOther>0) or duplicates If 0 then rows, 1 if columns */ virtual int appendMatrix(int number, int type, const CoinBigIndex * starts, const int * index, const double * element, int numberOther = -1); /** Returns a new matrix in reverse order without gaps Is allowed to return NULL if doesn't want to have row copy */ virtual ClpMatrixBase * reverseOrderedCopy() const { return NULL; } /// Returns number of elements in column part of basis virtual CoinBigIndex countBasis(const int * whichColumn, int & numberColumnBasic) = 0; /// Fills in column part of basis virtual void fillBasis(ClpSimplex * model, const int * whichColumn, int & numberColumnBasic, int * row, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * element) = 0; /** Creates scales for column copy (rowCopy in model may be modified) default does not allow scaling returns non-zero if no scaling done */ virtual int scale(ClpModel * , const ClpSimplex * = NULL) const { return 1; } /** Scales rowCopy if column copy scaled Only called if scales already exist */ virtual void scaleRowCopy(ClpModel * ) const { } /// Returns true if can create row copy virtual bool canGetRowCopy() const { return true; } /** Realy really scales column copy Only called if scales already exist. Up to user to delete */ inline virtual ClpMatrixBase * scaledColumnCopy(ClpModel * ) const { return this->clone(); } /** Checks if all elements are in valid range. Can just return true if you are not paranoid. For Clp I will probably expect no zeros. Code can modify matrix to get rid of small elements. check bits (can be turned off to save time) : 1 - check if matrix has gaps 2 - check if zero elements 4 - check and compress duplicates 8 - report on large and small */ virtual bool allElementsInRange(ClpModel * , double , double , int = 15) { return true; } /** Set the dimensions of the matrix. In effect, append new empty columns/rows to the matrix. A negative number for either dimension means that that dimension doesn't change. Otherwise the new dimensions MUST be at least as large as the current ones otherwise an exception is thrown. */ virtual void setDimensions(int numrows, int numcols); /** Returns largest and smallest elements of both signs. Largest refers to largest absolute value. If returns zeros then can't tell anything */ virtual void rangeOfElements(double & smallestNegative, double & largestNegative, double & smallestPositive, double & largestPositive); /** Unpacks a column into an CoinIndexedvector */ virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray, int column) const = 0; /** Unpacks a column into an CoinIndexedvector ** in packed format Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ virtual void unpackPacked(ClpSimplex * model, CoinIndexedVector * rowArray, int column) const = 0; /** Purely for column generation and similar ideas. Allows matrix and any bounds or costs to be updated (sensibly). Returns non-zero if any changes. */ virtual int refresh(ClpSimplex * ) { return 0; } // Really scale matrix virtual void reallyScale(const double * rowScale, const double * columnScale); /** Given positive integer weights for each row fills in sum of weights for each column (and slack). Returns weights vector Default returns vector of ones */ virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const; /** Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray, int column, double multiplier) const = 0; /** Adds multiple of a column into an array */ virtual void add(const ClpSimplex * model, double * array, int column, double multiplier) const = 0; /// Allow any parts of a created CoinPackedMatrix to be deleted virtual void releasePackedMatrix() const = 0; /// Says whether it can do partial pricing virtual bool canDoPartialPricing() const; /// Returns number of hidden rows e.g. gub virtual int hiddenRows() const; /// Partial pricing virtual void partialPricing(ClpSimplex * model, double start, double end, int & bestSequence, int & numberWanted); /** expands an updated column to allow for extra rows which the main solver does not know about and returns number added. This will normally be a no-op - it is in for GUB but may get extended to general non-overlapping and embedded networks. mode 0 - extend mode 1 - delete etc */ virtual int extendUpdated(ClpSimplex * model, CoinIndexedVector * update, int mode); /** utility primal function for dealing with dynamic constraints mode=0 - Set up before "update" and "times" for primal solution using extended rows mode=1 - Cleanup primal solution after "times" using extended rows. mode=2 - Check (or report on) primal infeasibilities */ virtual void primalExpanded(ClpSimplex * model, int mode); /** utility dual function for dealing with dynamic constraints mode=0 - Set up before "updateTranspose" and "transposeTimes" for duals using extended updates array (and may use other if dual values pass) mode=1 - Update dual solution after "transposeTimes" using extended rows. mode=2 - Compute all djs and compute key dual infeasibilities mode=3 - Report on key dual infeasibilities mode=4 - Modify before updateTranspose in partial pricing */ virtual void dualExpanded(ClpSimplex * model, CoinIndexedVector * array, double * other, int mode); /** general utility function for dealing with dynamic constraints mode=0 - Create list of non-key basics in pivotVariable_ using number as numberBasic in and out mode=1 - Set all key variables as basic mode=2 - return number extra rows needed, number gives maximum number basic mode=3 - before replaceColumn mode=4 - return 1 if can do primal, 2 if dual, 3 if both mode=5 - save any status stuff (when in good state) mode=6 - restore status stuff mode=7 - flag given variable (normally sequenceIn) mode=8 - unflag all variables mode=9 - synchronize costs and bounds mode=10 - return 1 if there may be changing bounds on variable (column generation) mode=11 - make sure set is clean (used when a variable rejected - but not flagged) mode=12 - after factorize but before permute stuff mode=13 - at end of simplex to delete stuff */ virtual int generalExpanded(ClpSimplex * model, int mode, int & number); /** update information for a pivot (and effective rhs) */ virtual int updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue); /** Creates a variable. This is called after partial pricing and may modify matrix. May update bestSequence. */ virtual void createVariable(ClpSimplex * model, int & bestSequence); /** Just for debug if odd type matrix. Returns number of primal infeasibilities. */ virtual int checkFeasible(ClpSimplex * model, double & sum) const ; /// Returns reduced cost of a variable double reducedCost(ClpSimplex * model, int sequence) const; /// Correct sequence in and out to give true value (if both -1 maybe do whole matrix) virtual void correctSequence(const ClpSimplex * model, int & sequenceIn, int & sequenceOut) ; //@} //--------------------------------------------------------------------------- /**@name Matrix times vector methods They can be faster if scalar is +- 1 Also for simplex I am not using basic/non-basic split */ //@{ /** Return y + A * x * scalar in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ virtual void times(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y) const = 0; /** And for scaling - default aborts for when scaling not supported (unless pointers NULL when as normal) */ virtual void times(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y, const double * COIN_RESTRICT rowScale, const double * COIN_RESTRICT columnScale) const; /** Return y + x * scalar * A in y. @pre x must be of size numRows() @pre y must be of size numColumns() */ virtual void transposeTimes(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y) const = 0; /** And for scaling - default aborts for when scaling not supported (unless pointers NULL when as normal) */ virtual void transposeTimes(double scalar, const double * COIN_RESTRICT x, double * COIN_RESTRICT y, const double * COIN_RESTRICT rowScale, const double * COIN_RESTRICT columnScale, double * COIN_RESTRICT spare = NULL) const; #if COIN_LONG_WORK // For long double versions (aborts if not supported) virtual void times(CoinWorkDouble scalar, const CoinWorkDouble * COIN_RESTRICT x, CoinWorkDouble * COIN_RESTRICT y) const ; virtual void transposeTimes(CoinWorkDouble scalar, const CoinWorkDouble * COIN_RESTRICT x, CoinWorkDouble * COIN_RESTRICT y) const ; #endif /** Return x * scalar *A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex */ virtual void transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const = 0; /** Return x *A in z but just for indices in y. This is only needed for primal steepest edge. Note - z always packed mode */ virtual void subsetTransposeTimes(const ClpSimplex * model, const CoinIndexedVector * x, const CoinIndexedVector * y, CoinIndexedVector * z) const = 0; /** Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster */ virtual bool canCombine(const ClpSimplex * , const CoinIndexedVector * ) const { return false; } /// Updates two arrays for steepest and does devex weights (need not be coded) virtual void transposeTimes2(const ClpSimplex * model, const CoinIndexedVector * pi1, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * spare, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor); /// Updates second array for steepest and does devex weights (need not be coded) virtual void subsetTimes2(const ClpSimplex * model, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * dj2, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor); /** Return x *A in z but just for number indices in y. Default cheats with fake CoinIndexedVector and then calls subsetTransposeTimes */ virtual void listTransposeTimes(const ClpSimplex * model, double * x, int * y, int number, double * z) const; //@} //@{ ///@name Other /// Clone virtual ClpMatrixBase * clone() const = 0; /** Subset clone (without gaps). Duplicates are allowed and order is as given. Derived classes need not provide this as it may not always make sense */ virtual ClpMatrixBase * subsetClone ( int numberRows, const int * whichRows, int numberColumns, const int * whichColumns) const; /// Gets rid of any mutable by products virtual void backToBasics() {} /** Returns type. The types which code may need to know about are: 1 - ClpPackedMatrix 11 - ClpNetworkMatrix 12 - ClpPlusMinusOneMatrix */ inline int type() const { return type_; } /// Sets type void setType(int newtype) { type_ = newtype; } /// Sets up an effective RHS void useEffectiveRhs(ClpSimplex * model); /** Returns effective RHS offset if it is being used. This is used for long problems or big gub or anywhere where going through full columns is expensive. This may re-compute */ virtual double * rhsOffset(ClpSimplex * model, bool forceRefresh = false, bool check = false); /// If rhsOffset used this is iteration last refreshed inline int lastRefresh() const { return lastRefresh_; } /// If rhsOffset used this is refresh frequency (0==off) inline int refreshFrequency() const { return refreshFrequency_; } inline void setRefreshFrequency(int value) { refreshFrequency_ = value; } /// whether to skip dual checks most of time inline bool skipDualCheck() const { return skipDualCheck_; } inline void setSkipDualCheck(bool yes) { skipDualCheck_ = yes; } /** Partial pricing tuning parameter - minimum number of "objects" to scan. e.g. number of Gub sets but could be number of variables */ inline int minimumObjectsScan() const { return minimumObjectsScan_; } inline void setMinimumObjectsScan(int value) { minimumObjectsScan_ = value; } /// Partial pricing tuning parameter - minimum number of negative reduced costs to get inline int minimumGoodReducedCosts() const { return minimumGoodReducedCosts_; } inline void setMinimumGoodReducedCosts(int value) { minimumGoodReducedCosts_ = value; } /// Current start of search space in matrix (as fraction) inline double startFraction() const { return startFraction_; } inline void setStartFraction(double value) { startFraction_ = value; } /// Current end of search space in matrix (as fraction) inline double endFraction() const { return endFraction_; } inline void setEndFraction(double value) { endFraction_ = value; } /// Current best reduced cost inline double savedBestDj() const { return savedBestDj_; } inline void setSavedBestDj(double value) { savedBestDj_ = value; } /// Initial number of negative reduced costs wanted inline int originalWanted() const { return originalWanted_; } inline void setOriginalWanted(int value) { originalWanted_ = value; } /// Current number of negative reduced costs which we still need inline int currentWanted() const { return currentWanted_; } inline void setCurrentWanted(int value) { currentWanted_ = value; } /// Current best sequence inline int savedBestSequence() const { return savedBestSequence_; } inline void setSavedBestSequence(int value) { savedBestSequence_ = value; } //@} protected: /**@name Constructors, destructor
    NOTE: All constructors are protected. There's no need to expose them, after all, this is an abstract class. */ //@{ /** Default constructor. */ ClpMatrixBase(); /** Destructor (has to be public) */ public: virtual ~ClpMatrixBase(); protected: // Copy ClpMatrixBase(const ClpMatrixBase&); // Assignment ClpMatrixBase& operator=(const ClpMatrixBase&); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /** Effective RHS offset if it is being used. This is used for long problems or big gub or anywhere where going through full columns is expensive */ double * rhsOffset_; /// Current start of search space in matrix (as fraction) double startFraction_; /// Current end of search space in matrix (as fraction) double endFraction_; /// Best reduced cost so far double savedBestDj_; /// Initial number of negative reduced costs wanted int originalWanted_; /// Current number of negative reduced costs which we still need int currentWanted_; /// Saved best sequence in pricing int savedBestSequence_; /// type (may be useful) int type_; /// If rhsOffset used this is iteration last refreshed int lastRefresh_; /// If rhsOffset used this is refresh frequency (0==off) int refreshFrequency_; /// Partial pricing tuning parameter - minimum number of "objects" to scan int minimumObjectsScan_; /// Partial pricing tuning parameter - minimum number of negative reduced costs to get int minimumGoodReducedCosts_; /// True sequence in (i.e. from larger problem) int trueSequenceIn_; /// True sequence out (i.e. from larger problem) int trueSequenceOut_; /// whether to skip dual checks most of time bool skipDualCheck_; //@} }; // bias for free variables #define FREE_BIAS 1.0e1 // Acceptance criteria for free variables #define FREE_ACCEPT 1.0e2 #endif CoinMP-1.8.3/Clp/src/ClpNonLinearCost.hpp0000644000175000017500000003422311613504607016516 0ustar renerene/* $Id: ClpNonLinearCost.hpp 1769 2011-07-26 09:31:51Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpNonLinearCost_H #define ClpNonLinearCost_H #include "CoinPragma.hpp" class ClpSimplex; class CoinIndexedVector; /** Trivial class to deal with non linear costs I don't make any explicit assumptions about convexity but I am sure I do make implicit ones. One interesting idea for normal LP's will be to allow non-basic variables to come into basis as infeasible i.e. if variable at lower bound has very large positive reduced cost (when problem is infeasible) could it reduce overall problem infeasibility more by bringing it into basis below its lower bound. Another feature would be to automatically discover when problems are convex piecewise linear and re-formulate to use non-linear. I did some work on this many years ago on "grade" problems, but while it improved primal interior point algorithms were much better for that particular problem. */ /* status has original status and current status 0 - below lower so stored is upper 1 - in range 2 - above upper so stored is lower 4 - (for current) - same as original */ #define CLP_BELOW_LOWER 0 #define CLP_FEASIBLE 1 #define CLP_ABOVE_UPPER 2 #define CLP_SAME 4 inline int originalStatus(unsigned char status) { return (status & 15); } inline int currentStatus(unsigned char status) { return (status >> 4); } inline void setOriginalStatus(unsigned char & status, int value) { status = static_cast(status & ~15); status = static_cast(status | value); } inline void setCurrentStatus(unsigned char &status, int value) { status = static_cast(status & ~(15 << 4)); status = static_cast(status | (value << 4)); } inline void setInitialStatus(unsigned char &status) { status = static_cast(CLP_FEASIBLE | (CLP_SAME << 4)); } inline void setSameStatus(unsigned char &status) { status = static_cast(status & ~(15 << 4)); status = static_cast(status | (CLP_SAME << 4)); } // Use second version to get more speed //#define FAST_CLPNON #ifndef FAST_CLPNON #define CLP_METHOD1 ((method_&1)!=0) #define CLP_METHOD2 ((method_&2)!=0) #else #define CLP_METHOD1 (false) #define CLP_METHOD2 (true) #endif class ClpNonLinearCost { public: public: /**@name Constructors, destructor */ //@{ /// Default constructor. ClpNonLinearCost(); /** Constructor from simplex. This will just set up wasteful arrays for linear, but later may do dual analysis and even finding duplicate columns . */ ClpNonLinearCost(ClpSimplex * model, int method = 1); /** Constructor from simplex and list of non-linearities (columns only) First lower of each column has to match real lower Last lower has to be <= upper (if == then cost ignored) This could obviously be changed to make more user friendly */ ClpNonLinearCost(ClpSimplex * model, const int * starts, const double * lower, const double * cost); /// Destructor ~ClpNonLinearCost(); // Copy ClpNonLinearCost(const ClpNonLinearCost&); // Assignment ClpNonLinearCost& operator=(const ClpNonLinearCost&); //@} /**@name Actual work in primal */ //@{ /** Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variables to bounds and all free variables to zero if oldTolerance is non-zero - but does not move those <= oldTolerance away*/ void checkInfeasibilities(double oldTolerance = 0.0); /** Changes infeasible costs for each variable The indices are row indices and need converting to sequences */ void checkInfeasibilities(int numberInArray, const int * index); /** Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. On input array is empty (but indices exist). On exit just changed costs will be stored as normal CoinIndexedVector */ void checkChanged(int numberInArray, CoinIndexedVector * update); /** Goes through one bound for each variable. If multiplier*work[iRow]>0 goes down, otherwise up. The indices are row indices and need converting to sequences Temporary offsets may be set Rhs entries are increased */ void goThru(int numberInArray, double multiplier, const int * index, const double * work, double * rhs); /** Takes off last iteration (i.e. offsets closer to 0) */ void goBack(int numberInArray, const int * index, double * rhs); /** Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. At the end of this all temporary offsets are zero */ void goBackAll(const CoinIndexedVector * update); /// Temporary zeroing of feasible costs void zapCosts(); /// Refreshes costs always makes row costs zero void refreshCosts(const double * columnCosts); /// Puts feasible bounds into lower and upper void feasibleBounds(); /// Refresh - assuming regions OK void refresh(); /** Sets bounds and cost for one variable Returns change in cost May need to be inline for speed */ double setOne(int sequence, double solutionValue); /** Sets bounds and infeasible cost and true cost for one variable This is for gub and column generation etc */ void setOne(int sequence, double solutionValue, double lowerValue, double upperValue, double costValue = 0.0); /** Sets bounds and cost for outgoing variable may change value Returns direction */ int setOneOutgoing(int sequence, double &solutionValue); /// Returns nearest bound double nearest(int sequence, double solutionValue); /** Returns change in cost - one down if alpha >0.0, up if <0.0 Value is current - new */ inline double changeInCost(int sequence, double alpha) const { double returnValue = 0.0; if (CLP_METHOD1) { int iRange = whichRange_[sequence] + offset_[sequence]; if (alpha > 0.0) returnValue = cost_[iRange] - cost_[iRange-1]; else returnValue = cost_[iRange] - cost_[iRange+1]; } if (CLP_METHOD2) { returnValue = (alpha > 0.0) ? infeasibilityWeight_ : -infeasibilityWeight_; } return returnValue; } inline double changeUpInCost(int sequence) const { double returnValue = 0.0; if (CLP_METHOD1) { int iRange = whichRange_[sequence] + offset_[sequence]; if (iRange + 1 != start_[sequence+1] && !infeasible(iRange + 1)) returnValue = cost_[iRange] - cost_[iRange+1]; else returnValue = -1.0e100; } if (CLP_METHOD2) { returnValue = -infeasibilityWeight_; } return returnValue; } inline double changeDownInCost(int sequence) const { double returnValue = 0.0; if (CLP_METHOD1) { int iRange = whichRange_[sequence] + offset_[sequence]; if (iRange != start_[sequence] && !infeasible(iRange - 1)) returnValue = cost_[iRange] - cost_[iRange-1]; else returnValue = 1.0e100; } if (CLP_METHOD2) { returnValue = infeasibilityWeight_; } return returnValue; } /// This also updates next bound inline double changeInCost(int sequence, double alpha, double &rhs) { double returnValue = 0.0; #ifdef NONLIN_DEBUG double saveRhs = rhs; #endif if (CLP_METHOD1) { int iRange = whichRange_[sequence] + offset_[sequence]; if (alpha > 0.0) { assert(iRange - 1 >= start_[sequence]); offset_[sequence]--; rhs += lower_[iRange] - lower_[iRange-1]; returnValue = alpha * (cost_[iRange] - cost_[iRange-1]); } else { assert(iRange + 1 < start_[sequence+1] - 1); offset_[sequence]++; rhs += lower_[iRange+2] - lower_[iRange+1]; returnValue = alpha * (cost_[iRange] - cost_[iRange+1]); } } if (CLP_METHOD2) { #ifdef NONLIN_DEBUG double saveRhs1 = rhs; rhs = saveRhs; #endif unsigned char iStatus = status_[sequence]; int iWhere = currentStatus(iStatus); if (iWhere == CLP_SAME) iWhere = originalStatus(iStatus); // rhs always increases if (iWhere == CLP_FEASIBLE) { if (alpha > 0.0) { // going below iWhere = CLP_BELOW_LOWER; rhs = COIN_DBL_MAX; } else { // going above iWhere = CLP_ABOVE_UPPER; rhs = COIN_DBL_MAX; } } else if (iWhere == CLP_BELOW_LOWER) { assert (alpha < 0); // going feasible iWhere = CLP_FEASIBLE; rhs += bound_[sequence] - model_->upperRegion()[sequence]; } else { assert (iWhere == CLP_ABOVE_UPPER); // going feasible iWhere = CLP_FEASIBLE; rhs += model_->lowerRegion()[sequence] - bound_[sequence]; } setCurrentStatus(status_[sequence], iWhere); #ifdef NONLIN_DEBUG assert(saveRhs1 == rhs); #endif returnValue = fabs(alpha) * infeasibilityWeight_; } return returnValue; } /// Returns current lower bound inline double lower(int sequence) const { return lower_[whichRange_[sequence] + offset_[sequence]]; } /// Returns current upper bound inline double upper(int sequence) const { return lower_[whichRange_[sequence] + offset_[sequence] + 1]; } /// Returns current cost inline double cost(int sequence) const { return cost_[whichRange_[sequence] + offset_[sequence]]; } //@} /**@name Gets and sets */ //@{ /// Number of infeasibilities inline int numberInfeasibilities() const { return numberInfeasibilities_; } /// Change in cost inline double changeInCost() const { return changeCost_; } /// Feasible cost inline double feasibleCost() const { return feasibleCost_; } /// Feasible cost with offset and direction (i.e. for reporting) double feasibleReportCost() const; /// Sum of infeasibilities inline double sumInfeasibilities() const { return sumInfeasibilities_; } /// Largest infeasibility inline double largestInfeasibility() const { return largestInfeasibility_; } /// Average theta inline double averageTheta() const { return averageTheta_; } inline void setAverageTheta(double value) { averageTheta_ = value; } inline void setChangeInCost(double value) { changeCost_ = value; } inline void setMethod(int value) { method_ = value; } /// See if may want to look both ways inline bool lookBothWays() const { return bothWays_; } //@} ///@name Private functions to deal with infeasible regions inline bool infeasible(int i) const { return ((infeasible_[i>>5] >> (i & 31)) & 1) != 0; } inline void setInfeasible(int i, bool trueFalse) { unsigned int & value = infeasible_[i>>5]; int bit = i & 31; if (trueFalse) value |= (1 << bit); else value &= ~(1 << bit); } inline unsigned char * statusArray() const { return status_; } /// For debug void validate(); //@} private: /**@name Data members */ //@{ /// Change in cost because of infeasibilities double changeCost_; /// Feasible cost double feasibleCost_; /// Current infeasibility weight double infeasibilityWeight_; /// Largest infeasibility double largestInfeasibility_; /// Sum of infeasibilities double sumInfeasibilities_; /// Average theta - kept here as only for primal double averageTheta_; /// Number of rows (mainly for checking and copy) int numberRows_; /// Number of columns (mainly for checking and copy) int numberColumns_; /// Starts for each entry (columns then rows) int * start_; /// Range for each entry (columns then rows) int * whichRange_; /// Temporary range offset for each entry (columns then rows) int * offset_; /** Lower bound for each range (upper bound is next lower). For various reasons there is always an infeasible range at bottom - even if lower bound is - infinity */ double * lower_; /// Cost for each range double * cost_; /// Model ClpSimplex * model_; // Array to say which regions are infeasible unsigned int * infeasible_; /// Number of infeasibilities found int numberInfeasibilities_; // new stuff /// Contains status at beginning and current unsigned char * status_; /// Bound which has been replaced in lower_ or upper_ double * bound_; /// Feasible cost array double * cost2_; /// Method 1 old, 2 new, 3 both! int method_; /// If all non-linear costs convex bool convex_; /// If we should look both ways for djs bool bothWays_; //@} }; #endif CoinMP-1.8.3/Clp/src/CoinAbcSmallFactorization1.cpp0000644000175000017500000000103012101105055020412 0ustar renerene/* $Id: CoinAbcSmallFactorization1.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinAbcCommonFactorization.hpp" #ifndef ABC_JUST_ONE_FACTORIZATION #define CoinAbcTypeFactorization CoinAbcSmallFactorization #define ABC_SMALL 4 #include "CoinAbcBaseFactorization.hpp" #include "CoinAbcBaseFactorization1.cpp" #endif CoinMP-1.8.3/Clp/src/MyMessageHandler.hpp0000644000175000017500000000433511510657452016535 0ustar renerene/* $Id: MyMessageHandler.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef MyMessageHandler_H #define MyMessageHandler_H #include #include "CoinPragma.hpp" #include #include "CoinMessageHandler.hpp" /** This just adds a model to CoinMessage and a void pointer so user can trap messages and do useful stuff. This is used in Clp/Test/unitTest.cpp The file pointer is just there as an example of user stuff. In practice you might have */ class ClpSimplex; typedef std::vector StdVectorDouble; class MyMessageHandler : public CoinMessageHandler { public: /**@name Overrides */ //@{ virtual int print(); //@} /**@name set and get */ //@{ /// Model const ClpSimplex * model() const; void setModel(ClpSimplex * model); /// Get queue of feasible extreme points const std::deque & getFeasibleExtremePoints() const; /// Empty queue of feasible extreme points void clearFeasibleExtremePoints(); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ MyMessageHandler(); /// Constructor with pointer to model MyMessageHandler(ClpSimplex * model, FILE * userPointer = NULL); /** Destructor */ virtual ~MyMessageHandler(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ MyMessageHandler(const MyMessageHandler&); /** The copy constructor from an CoinSimplexMessageHandler. */ MyMessageHandler(const CoinMessageHandler&); MyMessageHandler& operator=(const MyMessageHandler&); /// Clone virtual CoinMessageHandler * clone() const ; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer back to model ClpSimplex * model_; /// Saved extreme points std::deque feasibleExtremePoints_; /// Iteration number so won't do same one twice int iterationNumber_; //@} }; #endif CoinMP-1.8.3/Clp/src/AbcDualRowSteepest.hpp0000644000175000017500000001115012101105055017016 0ustar renerene/* $Id: AbcDualRowSteepest.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef AbcDualRowSteepest_H #define AbcDualRowSteepest_H #include "AbcDualRowPivot.hpp" class CoinIndexedVector; //############################################################################# /** Dual Row Pivot Steepest Edge Algorithm Class See Forrest-Goldfarb paper for algorithm */ class AbcDualRowSteepest : public AbcDualRowPivot { public: ///@name Algorithmic methods //@{ /// Returns pivot row, -1 if none virtual int pivotRow(); /** Updates weights and returns pivot alpha. Also does FT update */ virtual double updateWeights(CoinIndexedVector & input,CoinIndexedVector & updatedColumn); virtual double updateWeights1(CoinIndexedVector & input,CoinIndexedVector & updateColumn); virtual void updateWeightsOnly(CoinIndexedVector & input); /// Actually updates weights virtual void updateWeights2(CoinIndexedVector & input,CoinIndexedVector & updateColumn); /** Updates primal solution (and maybe list of candidates) Uses input vector which it deletes */ virtual void updatePrimalSolution(CoinIndexedVector & input, double theta); virtual void updatePrimalSolutionAndWeights(CoinIndexedVector & weightsVector, CoinIndexedVector & updateColumn, double theta); /** Saves any weights round factorization as pivot rows may change Save model May also recompute infeasibility stuff 1) before factorization 2) after good factorization (if weights empty may initialize) 3) after something happened but no factorization (e.g. check for infeasible) 4) as 2 but restore weights from previous snapshot 5) for strong branching - initialize (uninitialized) , infeasibilities */ virtual void saveWeights(AbcSimplex * model, int mode); /// Recompute infeasibilities virtual void recomputeInfeasibilities(); /// Gets rid of all arrays virtual void clearArrays(); /// Returns true if would not find any row virtual bool looksOptimal() const; //@} /** enums for persistence */ enum Persistence { normal = 0x00, // create (if necessary) and destroy keep = 0x01 // create (if necessary) and leave }; ///@name Constructors and destructors //@{ /** Default Constructor 0 is uninitialized, 1 full, 2 is partial uninitialized, 3 starts as 2 but may switch to 1. By partial is meant that the weights are updated as normal but only part of the infeasible basic variables are scanned. This can be faster on very easy problems. */ AbcDualRowSteepest(int mode = 3); /// Copy constructor AbcDualRowSteepest(const AbcDualRowSteepest &); /// Assignment operator AbcDualRowSteepest & operator=(const AbcDualRowSteepest& rhs); /// Fill most values void fill(const AbcDualRowSteepest& rhs); /// Destructor virtual ~AbcDualRowSteepest (); /// Clone virtual AbcDualRowPivot * clone(bool copyData = true) const; //@} /**@name gets and sets */ //@{ /// Mode inline int mode() const { return mode_; } /// Set/ get persistence inline void setPersistence(Persistence life) { persistence_ = life; } inline Persistence persistence() const { return persistence_ ; } /// Infeasible vector inline CoinIndexedVector * infeasible() const { return infeasible_;} /// Weights vector inline CoinIndexedVector * weights() const { return weights_;} /// Model inline AbcSimplex * model() const { return model_;} //@} //--------------------------------------------------------------------------- private: ///@name Private member data /// norm saved before going into update double norm_; /// Ratio of size of factorization to number of rows double factorizationRatio_; /** Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number */ int state_; /** If 0 then we are using uninitialized weights, 1 then full, if 2 then uninitialized partial, 3 switchable */ int mode_; /// Life of weights Persistence persistence_; /// weight array CoinIndexedVector * weights_; /// square of infeasibility array (just for infeasible rows) CoinIndexedVector * infeasible_; /// save weight array (so we can use checkpoint) CoinIndexedVector * savedWeights_; //@} }; // For Devex stuff #undef DEVEX_TRY_NORM #define DEVEX_TRY_NORM 1.0e-8 #define DEVEX_ADD_ONE 1.0 #endif CoinMP-1.8.3/Clp/src/ClpCholeskyBase.hpp0000644000175000017500000002150111552534715016354 0ustar renerene/* $Id: ClpCholeskyBase.hpp 1722 2011-04-17 09:58:37Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpCholeskyBase_H #define ClpCholeskyBase_H #include "CoinPragma.hpp" #include "CoinTypes.hpp" //#define CLP_LONG_CHOLESKY 0 #ifndef CLP_LONG_CHOLESKY #define CLP_LONG_CHOLESKY 0 #endif /* valid combinations are CLP_LONG_CHOLESKY 0 and COIN_LONG_WORK 0 CLP_LONG_CHOLESKY 1 and COIN_LONG_WORK 1 CLP_LONG_CHOLESKY 2 and COIN_LONG_WORK 1 */ #if COIN_LONG_WORK==0 #if CLP_LONG_CHOLESKY>0 #define CHOLESKY_BAD_COMBINATION #endif #else #if CLP_LONG_CHOLESKY==0 #define CHOLESKY_BAD_COMBINATION #endif #endif #ifdef CHOLESKY_BAD_COMBINATION # warning("Bad combination of CLP_LONG_CHOLESKY and COIN_BIG_DOUBLE/COIN_LONG_WORK"); "Bad combination of CLP_LONG_CHOLESKY and COIN_LONG_WORK" #endif #if CLP_LONG_CHOLESKY>1 typedef long double longDouble; #define CHOL_SMALL_VALUE 1.0e-15 #elif CLP_LONG_CHOLESKY==1 typedef double longDouble; #define CHOL_SMALL_VALUE 1.0e-11 #else typedef double longDouble; #define CHOL_SMALL_VALUE 1.0e-11 #endif class ClpInterior; class ClpCholeskyDense; class ClpMatrixBase; /** Base class for Clp Cholesky factorization Will do better factorization. very crude ordering Derived classes may be using more sophisticated methods */ class ClpCholeskyBase { public: /**@name Virtual methods that the derived classes may provide */ //@{ /** Orders rows and saves pointer to matrix.and model. returns non-zero if not enough memory. You can use preOrder to set up ADAT If using default symbolic etc then must set sizeFactor_ to size of input matrix to order (and to symbolic). Also just permute_ and permuteInverse_ should be created */ virtual int order(ClpInterior * model); /** Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ virtual int symbolic(); /** Factorize - filling in rowsDropped and returning number dropped. If return code negative then out of memory */ virtual int factorize(const CoinWorkDouble * diagonal, int * rowsDropped) ; /** Uses factorization to solve. */ virtual void solve (CoinWorkDouble * region) ; /** Uses factorization to solve. - given as if KKT. region1 is rows+columns, region2 is rows */ virtual void solveKKT (CoinWorkDouble * region1, CoinWorkDouble * region2, const CoinWorkDouble * diagonal, CoinWorkDouble diagonalScaleFactor); private: /// AMD ordering int orderAMD(); public: //@} /**@name Gets */ //@{ /// status. Returns status inline int status() const { return status_; } /// numberRowsDropped. Number of rows gone inline int numberRowsDropped() const { return numberRowsDropped_; } /// reset numberRowsDropped and rowsDropped. void resetRowsDropped(); /// rowsDropped - which rows are gone inline char * rowsDropped() const { return rowsDropped_; } /// choleskyCondition. inline double choleskyCondition() const { return choleskyCondition_; } /// goDense i.e. use dense factoriaztion if > this (default 0.7). inline double goDense() const { return goDense_; } /// goDense i.e. use dense factoriaztion if > this (default 0.7). inline void setGoDense(double value) { goDense_ = value; } /// rank. Returns rank inline int rank() const { return numberRows_ - numberRowsDropped_; } /// Return number of rows inline int numberRows() const { return numberRows_; } /// Return size inline CoinBigIndex size() const { return sizeFactor_; } /// Return sparseFactor inline longDouble * sparseFactor() const { return sparseFactor_; } /// Return diagonal inline longDouble * diagonal() const { return diagonal_; } /// Return workDouble inline longDouble * workDouble() const { return workDouble_; } /// If KKT on inline bool kkt() const { return doKKT_; } /// Set KKT inline void setKKT(bool yesNo) { doKKT_ = yesNo; } /// Set integer parameter inline void setIntegerParameter(int i, int value) { integerParameters_[i] = value; } /// get integer parameter inline int getIntegerParameter(int i) { return integerParameters_[i]; } /// Set double parameter inline void setDoubleParameter(int i, double value) { doubleParameters_[i] = value; } /// get double parameter inline double getDoubleParameter(int i) { return doubleParameters_[i]; } //@} public: /**@name Constructors, destructor */ //@{ /** Constructor which has dense columns activated. Default is off. */ ClpCholeskyBase(int denseThreshold = -1); /** Destructor (has to be public) */ virtual ~ClpCholeskyBase(); /// Copy ClpCholeskyBase(const ClpCholeskyBase&); /// Assignment ClpCholeskyBase& operator=(const ClpCholeskyBase&); //@} //@{ ///@name Other /// Clone virtual ClpCholeskyBase * clone() const; /// Returns type inline int type() const { if (doKKT_) return 100; else return type_; } protected: /// Sets type inline void setType(int type) { type_ = type; } /// model. inline void setModel(ClpInterior * model) { model_ = model; } //@} /**@name Symbolic, factor and solve */ //@{ /** Symbolic1 - works out size without clever stuff. Uses upper triangular as much easier. Returns size */ int symbolic1(const CoinBigIndex * Astart, const int * Arow); /** Symbolic2 - Fills in indices Uses lower triangular so can do cliques etc */ void symbolic2(const CoinBigIndex * Astart, const int * Arow); /** Factorize - filling in rowsDropped and returning number dropped in integerParam. */ void factorizePart2(int * rowsDropped) ; /** solve - 1 just first half, 2 just second half - 3 both. If 1 and 2 then diagonal has sqrt of inverse otherwise inverse */ void solve(CoinWorkDouble * region, int type); /// Forms ADAT - returns nonzero if not enough memory int preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT); /// Updates dense part (broken out for profiling) void updateDense(longDouble * d, /*longDouble * work,*/ int * first); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// type (may be useful) if > 20 do KKT int type_; /// Doing full KKT (only used if default symbolic and factorization) bool doKKT_; /// Go dense at this fraction double goDense_; /// choleskyCondition. double choleskyCondition_; /// model. ClpInterior * model_; /// numberTrials. Number of trials before rejection int numberTrials_; /// numberRows. Number of Rows in factorization int numberRows_; /// status. Status of factorization int status_; /// rowsDropped char * rowsDropped_; /// permute inverse. int * permuteInverse_; /// main permute. int * permute_; /// numberRowsDropped. Number of rows gone int numberRowsDropped_; /// sparseFactor. longDouble * sparseFactor_; /// choleskyStart - element starts CoinBigIndex * choleskyStart_; /// choleskyRow (can be shorter than sparsefactor) int * choleskyRow_; /// Index starts CoinBigIndex * indexStart_; /// Diagonal longDouble * diagonal_; /// double work array longDouble * workDouble_; /// link array int * link_; // Integer work array CoinBigIndex * workInteger_; // Clique information int * clique_; /// sizeFactor. CoinBigIndex sizeFactor_; /// Size of index array CoinBigIndex sizeIndex_; /// First dense row int firstDense_; /// integerParameters int integerParameters_[64]; /// doubleParameters; double doubleParameters_[64]; /// Row copy of matrix ClpMatrixBase * rowCopy_; /// Dense indicators char * whichDense_; /// Dense columns (updated) longDouble * denseColumn_; /// Dense cholesky ClpCholeskyDense * dense_; /// Dense threshold (for taking out of Cholesky) int denseThreshold_; //@} }; #endif CoinMP-1.8.3/Clp/src/AbcMatrix.hpp0000644000175000017500000005232312101105055015177 0ustar renerene/* $Id: AbcMatrix.hpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef AbcMatrix_H #define AbcMatrix_H #include "CoinPragma.hpp" #include "ClpMatrixBase.hpp" #include "AbcSimplex.hpp" #include "CoinAbcHelperFunctions.hpp" /** This implements a scaled version of CoinPackedMatrix It may have THREE! copies 1) scaled CoinPackedMatrix without gaps 2) row copy non-basic,basic, fixed 3) vector copy */ class AbcMatrix2; class AbcMatrix3; class AbcMatrix { public: /**@name Useful methods */ //@{ /// Return a complete CoinPackedMatrix inline CoinPackedMatrix * getPackedMatrix() const { return matrix_; } /** Whether the packed matrix is column major ordered or not. */ inline bool isColOrdered() const { return true; } /** Number of entries in the packed matrix. */ inline CoinBigIndex getNumElements() const { return matrix_->getNumElements(); } /** Number of columns. */ inline int getNumCols() const { assert(matrix_->getNumCols()==model_->numberColumns());return matrix_->getNumCols(); } /** Number of rows. */ inline int getNumRows() const { assert(matrix_->getNumRows()==model_->numberRows());return matrix_->getNumRows(); } /// Sets model void setModel(AbcSimplex * model); /// A vector containing the elements in the packed matrix. inline const double * getElements() const { return matrix_->getElements(); } /// Mutable elements inline double * getMutableElements() const { return matrix_->getMutableElements(); } /// A vector containing the minor indices of the elements in the packed matrix. inline const int * getIndices() const { return matrix_->getIndices(); } /// A vector containing the minor indices of the elements in the packed matrix. inline int * getMutableIndices() const { return matrix_->getMutableIndices(); } /// Starts inline const CoinBigIndex * getVectorStarts() const { return matrix_->getVectorStarts(); } inline CoinBigIndex * getMutableVectorStarts() const { return matrix_->getMutableVectorStarts(); } /** The lengths of the major-dimension vectors. */ inline const int * getVectorLengths() const { return matrix_->getVectorLengths(); } /** The lengths of the major-dimension vectors. */ inline int * getMutableVectorLengths() const { return matrix_->getMutableVectorLengths(); } /// Row starts CoinBigIndex * rowStart() const; /// Row ends CoinBigIndex * rowEnd() const; /// Row elements double * rowElements() const; /// Row columns CoinSimplexInt * rowColumns() const; /** Returns a new matrix in reverse order without gaps */ CoinPackedMatrix * reverseOrderedCopy() const; /// Returns number of elements in column part of basis CoinBigIndex countBasis(const int * whichColumn, int & numberColumnBasic); /// Fills in column part of basis void fillBasis(const int * whichColumn, int & numberColumnBasic, int * row, int * start, int * rowCount, int * columnCount, CoinSimplexDouble * element); /// Fills in column part of basis void fillBasis(const int * whichColumn, int & numberColumnBasic, int * row, int * start, int * rowCount, int * columnCount, long double * element); /** Scales and creates row copy */ void scale(int numberRowsAlreadyScaled); /// Creates row copy void createRowCopy(); /// Take out of useful void takeOutOfUseful(int sequence,CoinIndexedVector & spare); /// Put into useful void putIntofUseful(int sequence,CoinIndexedVector & spare); /// Put in and out for useful void inOutUseful(int sequenceIn,int sequenceOut); /// Make all useful void makeAllUseful(CoinIndexedVector & spare); /// Sort into useful void sortUseful(CoinIndexedVector & spare); /// Move largest in column to beginning (not used as doesn't help factorization) void moveLargestToStart(); /** Unpacks a column into an CoinIndexedVector */ void unpack(CoinIndexedVector & rowArray, int column) const ; /** Adds multiple of a column (or slack) into an CoinIndexedvector You can use quickAdd to add to vector */ void add(CoinIndexedVector & rowArray, int column, double multiplier) const ; //@} /**@name Matrix times vector methods */ //@{ /** Return y + A * scalar *x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ void timesModifyExcludingSlacks(double scalar, const double * x, double * y) const; /** Return y + A * scalar(+-1) *x in y. @pre x must be of size numColumns()+numRows() @pre y must be of size numRows() */ void timesModifyIncludingSlacks(double scalar, const double * x, double * y) const; /** Return A * scalar(+-1) *x in y. @pre x must be of size numColumns()+numRows() @pre y must be of size numRows() */ void timesIncludingSlacks(double scalar, const double * x, double * y) const; /** Return A * scalar(+-1) *x + y
    in y. @pre x must be of size numRows() @pre y must be of size numRows()+numColumns() */ void transposeTimesNonBasic(double scalar, const double * x, double * y) const; /** Return y - A * x
    in y. @pre x must be of size numRows() @pre y must be of size numRows()+numColumns() */ void transposeTimesAll(const double * x, double * y) const; /** Return y + A * scalar(+-1) *x in y. @pre x must be of size numRows() @pre y must be of size numRows() */ void transposeTimesBasic(double scalar, const double * x, double * y) const; /** Return x * scalar * A/code> in z. Note - x unpacked mode - z packed mode including slacks All these return atLo/atUp first then free/superbasic number of first set returned pivotVariable is extended to have that order reversePivotVariable used to update that list free/superbasic only stored in normal format can use spare array to get this effect may put djs alongside atLo/atUp Squashes small elements and knows about AbcSimplex */ int transposeTimesNonBasic(double scalar, const CoinIndexedVector & x, CoinIndexedVector & z) const; /// gets sorted tableau row and a possible value of theta double dualColumn1(const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const; /// gets sorted tableau row and a possible value of theta double dualColumn1Row(int iBlock, double upperThetaSlack, int & freeSequence, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const; /// gets sorted tableau row and a possible value of theta double dualColumn1RowFew(int iBlock, double upperThetaSlack, int & freeSequence, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const; /// gets sorted tableau row and a possible value of theta double dualColumn1Row2(double upperThetaSlack, int & freeSequence, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const; /// gets sorted tableau row and a possible value of theta double dualColumn1Row1(double upperThetaSlack, int & freeSequence, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const; /** gets sorted tableau row and a possible value of theta On input first,last give what to scan On output is number in tableauRow and candidateList */ void dualColumn1Part(int iBlock,int & sequenceIn, double & upperTheta, const CoinIndexedVector & update, CoinPartitionedVector & tableauRow, CoinPartitionedVector & candidateList) const; /// rebalance for parallel void rebalance() const; /// Get sequenceIn when Dantzig int pivotColumnDantzig(const CoinIndexedVector & updates, CoinPartitionedVector & spare) const; /// Get sequenceIn when Dantzig (One block) int pivotColumnDantzig(int iBlock,bool doByRow,const CoinIndexedVector & updates, CoinPartitionedVector & spare, double & bestValue) const; /// gets tableau row - returns number of slacks in block int primalColumnRow(int iBlock,bool doByRow,const CoinIndexedVector & update, CoinPartitionedVector & tableauRow) const; /// gets tableau row and dj row - returns number of slacks in block int primalColumnRowAndDjs(int iBlock,const CoinIndexedVector & updateTableau, const CoinIndexedVector & updateDjs, CoinPartitionedVector & tableauRow) const; /** Chooses best weighted dj */ int chooseBestDj(int iBlock,const CoinIndexedVector & infeasibilities, const double * weights) const; /** does steepest edge double or triple update If scaleFactor!=0 then use with tableau row to update djs otherwise use updateForDjs Returns best sequence */ int primalColumnDouble(int iBlock,CoinPartitionedVector & updateForTableauRow, CoinPartitionedVector & updateForDjs, const CoinIndexedVector & updateForWeights, CoinPartitionedVector & spareColumn1, double * infeasibilities, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor) const; /** does steepest edge double or triple update If scaleFactor!=0 then use with tableau row to update djs otherwise use updateForDjs Returns best sequence */ int primalColumnSparseDouble(int iBlock,CoinPartitionedVector & updateForTableauRow, CoinPartitionedVector & updateForDjs, const CoinIndexedVector & updateForWeights, CoinPartitionedVector & spareColumn1, double * infeasibilities, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor) const; /** does steepest edge double or triple update If scaleFactor!=0 then use with tableau row to update djs otherwise use updateForDjs Returns best sequence */ int primalColumnDouble(CoinPartitionedVector & updateForTableauRow, CoinPartitionedVector & updateForDjs, const CoinIndexedVector & updateForWeights, CoinPartitionedVector & spareColumn1, CoinIndexedVector & infeasible, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor) const; /// gets subset updates void primalColumnSubset(int iBlock,const CoinIndexedVector & update, const CoinPartitionedVector & tableauRow, CoinPartitionedVector & weights) const; /// Partial pricing void partialPricing(double startFraction, double endFraction, int & bestSequence, int & numberWanted); /** Return x *A in z but just for indices Already in z. Note - z always packed mode */ void subsetTransposeTimes(const CoinIndexedVector & x, CoinIndexedVector & z) const; /// Return -x *A in z void transposeTimes(const CoinIndexedVector & x, CoinIndexedVector & z) const; //@} /**@name Other */ //@{ /// Returns CoinPackedMatrix (non const) inline CoinPackedMatrix * matrix() const { return matrix_; } /** Partial pricing tuning parameter - minimum number of "objects" to scan. e.g. number of Gub sets but could be number of variables */ inline int minimumObjectsScan() const { return minimumObjectsScan_; } inline void setMinimumObjectsScan(int value) { minimumObjectsScan_ = value; } /// Partial pricing tuning parameter - minimum number of negative reduced costs to get inline int minimumGoodReducedCosts() const { return minimumGoodReducedCosts_; } inline void setMinimumGoodReducedCosts(int value) { minimumGoodReducedCosts_ = value; } /// Current start of search space in matrix (as fraction) inline double startFraction() const { return startFraction_; } inline void setStartFraction(double value) { startFraction_ = value; } /// Current end of search space in matrix (as fraction) inline double endFraction() const { return endFraction_; } inline void setEndFraction(double value) { endFraction_ = value; } /// Current best reduced cost inline double savedBestDj() const { return savedBestDj_; } inline void setSavedBestDj(double value) { savedBestDj_ = value; } /// Initial number of negative reduced costs wanted inline int originalWanted() const { return originalWanted_; } inline void setOriginalWanted(int value) { originalWanted_ = value; } /// Current number of negative reduced costs which we still need inline int currentWanted() const { return currentWanted_; } inline void setCurrentWanted(int value) { currentWanted_ = value; } /// Current best sequence inline int savedBestSequence() const { return savedBestSequence_; } inline void setSavedBestSequence(int value) { savedBestSequence_ = value; } /// Start of each column block inline int * startColumnBlock() const {return startColumnBlock_;} /// Start of each block (in stored) inline const int * blockStart() const { return blockStart_;} inline bool gotRowCopy() const { return rowStart_!=0;} /// Start of each block (in stored) inline int blockStart(int block) const { return blockStart_[block];} /// Number of actual column blocks inline int numberColumnBlocks() const { return numberColumnBlocks_;} /// Number of actual row blocks inline int numberRowBlocks() const { return numberRowBlocks_;} //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ AbcMatrix(); /** Destructor */ ~AbcMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ AbcMatrix(const AbcMatrix&); /** The copy constructor from an CoinPackedMatrix. */ AbcMatrix(const CoinPackedMatrix&); /** Subset constructor (without gaps). Duplicates are allowed and order is as given */ AbcMatrix (const AbcMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); AbcMatrix (const CoinPackedMatrix & wholeModel, int numberRows, const int * whichRows, int numberColumns, const int * whichColumns); AbcMatrix& operator=(const AbcMatrix&); /// Copy contents - resizing if necessary - otherwise re-use memory void copy(const AbcMatrix * from); //@} private: protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Data CoinPackedMatrix * matrix_; /// Model mutable AbcSimplex * model_; #if ABC_PARALLEL==0 #define NUMBER_ROW_BLOCKS 1 #define NUMBER_COLUMN_BLOCKS 1 #elif ABC_PARALLEL==1 #define NUMBER_ROW_BLOCKS 4 #define NUMBER_COLUMN_BLOCKS 4 #else #define NUMBER_ROW_BLOCKS 8 #define NUMBER_COLUMN_BLOCKS 8 #endif /** Start of each row (per block) - last lot are useless first all row starts for block 0, then for block2 so NUMBER_ROW_BLOCKS+2 times number rows */ CoinBigIndex * rowStart_; /// Values by row double * element_; /// Columns int * column_; /// Start of each column block mutable int startColumnBlock_[NUMBER_COLUMN_BLOCKS+1]; /// Start of each block (in stored) int blockStart_[NUMBER_ROW_BLOCKS+1]; /// Number of actual column blocks mutable int numberColumnBlocks_; /// Number of actual row blocks int numberRowBlocks_; //#define COUNT_COPY #ifdef COUNT_COPY #define MAX_COUNT 13 /// Start in elements etc CoinBigIndex countStart_[MAX_COUNT+1]; /// First column int countFirst_[MAX_COUNT+1]; // later int countEndUseful_[MAX_COUNT+1]; int * countRealColumn_; // later int * countInverseRealColumn_; CoinBigIndex * countStartLarge_; int * countRow_; double * countElement_; int smallestCount_; int largestCount_; #endif /// Special row copy //AbcMatrix2 * rowCopy_; /// Special column copy //AbcMatrix3 * columnCopy_; /// Current start of search space in matrix (as fraction) double startFraction_; /// Current end of search space in matrix (as fraction) double endFraction_; /// Best reduced cost so far double savedBestDj_; /// Initial number of negative reduced costs wanted int originalWanted_; /// Current number of negative reduced costs which we still need int currentWanted_; /// Saved best sequence in pricing int savedBestSequence_; /// Partial pricing tuning parameter - minimum number of "objects" to scan int minimumObjectsScan_; /// Partial pricing tuning parameter - minimum number of negative reduced costs to get int minimumGoodReducedCosts_; //@} }; #ifdef THREAD #include typedef struct { double acceptablePivot; const AbcSimplex * model; double * spare; int * spareIndex; double * arrayTemp; int * indexTemp; int * numberInPtr; double * bestPossiblePtr; double * upperThetaPtr; int * posFreePtr; double * freePivotPtr; int * numberOutPtr; const unsigned short * count; const double * pi; const CoinBigIndex * rowStart; const double * element; const unsigned short * column; int offset; int numberInRowArray; int numberLook; } dualColumn0Struct; #endif class AbcMatrix2 { public: /**@name Useful methods */ //@{ /** Return x * -1 * A in z. Note - x packed and z will be packed mode Squashes small elements and knows about AbcSimplex */ void transposeTimes(const AbcSimplex * model, const CoinPackedMatrix * rowCopy, const CoinIndexedVector & x, CoinIndexedVector & spareArray, CoinIndexedVector & z) const; /// Returns true if copy has useful information inline bool usefulInfo() const { return rowStart_ != NULL; } //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ AbcMatrix2(); /** Constructor from copy. */ AbcMatrix2(AbcSimplex * model, const CoinPackedMatrix * rowCopy); /** Destructor */ ~AbcMatrix2(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ AbcMatrix2(const AbcMatrix2&); AbcMatrix2& operator=(const AbcMatrix2&); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Number of blocks int numberBlocks_; /// Number of rows int numberRows_; /// Column offset for each block (plus one at end) int * offset_; /// Counts of elements in each part of row mutable unsigned short * count_; /// Row starts mutable CoinBigIndex * rowStart_; /// columns within block unsigned short * column_; /// work arrays double * work_; #ifdef THREAD pthread_t * threadId_; dualColumn0Struct * info_; #endif //@} }; typedef struct { CoinBigIndex startElements_; // point to data int startIndices_; // point to column_ int numberInBlock_; int numberPrice_; // at beginning int numberElements_; // number elements per column } blockStruct3; class AbcMatrix3 { public: /**@name Useful methods */ //@{ /** Return x * -1 * A in z. Note - x packed and z will be packed mode Squashes small elements and knows about AbcSimplex */ void transposeTimes(const AbcSimplex * model, const double * pi, CoinIndexedVector & output) const; /// Updates two arrays for steepest void transposeTimes2(const AbcSimplex * model, const double * pi, CoinIndexedVector & dj1, const double * piWeight, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ AbcMatrix3(); /** Constructor from copy. */ AbcMatrix3(AbcSimplex * model, const CoinPackedMatrix * columnCopy); /** Destructor */ ~AbcMatrix3(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ AbcMatrix3(const AbcMatrix3&); AbcMatrix3& operator=(const AbcMatrix3&); //@} /**@name Sort methods */ //@{ /** Sort blocks */ void sortBlocks(const AbcSimplex * model); /// Swap one variable void swapOne(const AbcSimplex * model, const AbcMatrix * matrix, int iColumn); //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Number of blocks int numberBlocks_; /// Number of columns int numberColumns_; /// Column indices and reverse lookup (within block) int * column_; /// Starts for odd/long vectors CoinBigIndex * start_; /// Rows int * row_; /// Elements double * element_; /// Blocks (ordinary start at 0 and go to first block) blockStruct * block_; //@} }; #endif CoinMP-1.8.3/Clp/src/MyEventHandler.cpp0000644000175000017500000000516211510657452016224 0ustar renerene/* $Id: MyEventHandler.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #if defined(_MSC_VER) #pragma warning(disable:4786) #pragma warning(disable:4503) #endif #include "MyEventHandler.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- MyEventHandler::MyEventHandler () : ClpEventHandler() { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- MyEventHandler::MyEventHandler (const MyEventHandler & rhs) : ClpEventHandler(rhs) { } // Constructor with pointer to model MyEventHandler::MyEventHandler(ClpSimplex * model) : ClpEventHandler(model) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- MyEventHandler::~MyEventHandler () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- MyEventHandler & MyEventHandler::operator=(const MyEventHandler& rhs) { if (this != &rhs) { ClpEventHandler::operator=(rhs); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpEventHandler * MyEventHandler::clone() const { return new MyEventHandler(*this); } int MyEventHandler::event(Event whichEvent) { if (whichEvent == endOfValuesPass) return 0; // say optimal else return -1; // carry on #if 0 // This is how one can get some progress information at the end of each iteration. if (whichEvent == endOfIteration) { int numIter = model_->getIterationCount(); double sumDualInfeas = model_->sumDualInfeasibilities(); double sumPrimalInfeas = model_->sumPrimalInfeasibilities(); double obj = model_->getObjValue(); } // This is how one can tell CLP to stop now. // The value of cancelAsap needs to come from the application using CLP. if ( cancelAsap ) return 5; else return -1; #endif } CoinMP-1.8.3/Clp/src/CoinAbcHelperFunctions.hpp0000644000175000017500000016473712363437455017717 0ustar renerene/* $Id: CoinAbcHelperFunctions.hpp 2042 2014-07-22 10:38:37Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef CoinAbcHelperFunctions_H #define CoinAbcHelperFunctions_H #include "ClpConfig.h" #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # else # include # endif #endif #include "CoinAbcCommon.hpp" #ifndef abc_assert #define abc_assert(condition) \ { if (!condition) {printf("abc_assert in %s at line %d - %s is false\n", \ __FILE__, __LINE__, __STRING(condition)); abort();} } #endif // cilk_for granularity. #define CILK_FOR_GRAINSIZE 128 //#define AVX2 2 #if AVX2==1 #include "emmintrin.h" #elif AVX2==2 #include #elif AVX2==3 #include "avx2intrin.h" #endif //#define __AVX__ 1 //#define __AVX2__ 1 /** Note (JJF) I have added some operations on arrays even though they may duplicate CoinDenseVector. */ #define UNROLL_SCATTER 2 #define INLINE_SCATTER 1 #if INLINE_SCATTER==0 void CoinAbcScatterUpdate(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region); #else void ABC_INLINE inline CoinAbcScatterUpdate(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { #if UNROLL_SCATTER==0 for (CoinBigIndex j=number-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #elif UNROLL_SCATTER==1 if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } #elif UNROLL_SCATTER==2 if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } if ((number&2)!=0) { CoinSimplexInt iRow0 = thisIndex[number-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble value0 = thisElement[number-1]; CoinSimplexInt iRow1 = thisIndex[number-2]; CoinFactorizationDouble regionValue1 = region[iRow1]; CoinFactorizationDouble value1 = thisElement[number-2]; region[iRow0] = regionValue0 - value0 * pivotValue; region[iRow1] = regionValue1 - value1 * pivotValue; number-=2; } #pragma cilk grainsize=CILK_FOR_GRAINSIZE cilk_for (CoinBigIndex j=number-1 ; j >=0; j-=4 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; CoinSimplexInt iRow2 = thisIndex[j-2]; CoinSimplexInt iRow3 = thisIndex[j-3]; CoinFactorizationDouble regionValue2 = region[iRow2]; CoinFactorizationDouble regionValue3 = region[iRow3]; region[iRow2] = regionValue2 - thisElement[j-2] * pivotValue; region[iRow3] = regionValue3 - thisElement[j-3] * pivotValue; } #elif UNROLL_SCATTER==3 CoinSimplexInt iRow0; CoinSimplexInt iRow1; CoinFactorizationDouble regionValue0; CoinFactorizationDouble regionValue1; switch(static_cast(number)) { case 0: break; case 1: iRow0 = thisIndex[0]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; break; case 2: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; break; case 3: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; break; case 4: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; break; case 5: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; break; case 6: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; break; case 7: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; break; case 8: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; iRow1 = thisIndex[7]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; region[iRow1] = regionValue1 - thisElement[7] * pivotValue; break; default: if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } break; } #endif } void ABC_INLINE inline CoinAbcScatterUpdate(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) { #if UNROLL_SCATTER==0 const int * COIN_RESTRICT thisIndex = reinterpret_cast(thisElement+number); for (CoinBigIndex j=number-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #elif UNROLL_SCATTER==1 const int * COIN_RESTRICT thisIndex = reinterpret_cast(thisElement+number); if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } #elif UNROLL_SCATTER==2 const int * COIN_RESTRICT thisIndex = reinterpret_cast(thisElement+number); if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } if ((number&2)!=0) { CoinSimplexInt iRow0 = thisIndex[number-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble value0 = thisElement[number-1]; CoinSimplexInt iRow1 = thisIndex[number-2]; CoinFactorizationDouble regionValue1 = region[iRow1]; CoinFactorizationDouble value1 = thisElement[number-2]; region[iRow0] = regionValue0 - value0 * pivotValue; region[iRow1] = regionValue1 - value1 * pivotValue; number-=2; } #if AVX2==22 CoinFactorizationDouble temp[4] __attribute__ ((aligned (32))); __m256d pv = _mm256_broadcast_sd(&pivotValue); for (CoinBigIndex j=number-1 ; j >=0; j-=4 ) { __m256d elements=_mm256_loadu_pd(thisElement+j-3); CoinSimplexInt iRow0 = thisIndex[j-3]; CoinSimplexInt iRow1 = thisIndex[j-2]; CoinSimplexInt iRow2 = thisIndex[j-1]; CoinSimplexInt iRow3 = thisIndex[j-0]; temp[0] = region[iRow0]; temp[1] = region[iRow1]; temp[2] = region[iRow2]; temp[3] = region[iRow3]; __m256d t0=_mm256_load_pd(temp); t0 -= pv*elements; _mm256_store_pd (temp, t0); region[iRow0] = temp[0]; region[iRow1] = temp[1]; region[iRow2] = temp[2]; region[iRow3] = temp[3]; } #else #pragma cilk grainsize=CILK_FOR_GRAINSIZE cilk_for (CoinBigIndex j=number-1 ; j >=0; j-=4 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; CoinSimplexInt iRow2 = thisIndex[j-2]; CoinSimplexInt iRow3 = thisIndex[j-3]; CoinFactorizationDouble regionValue2 = region[iRow2]; CoinFactorizationDouble regionValue3 = region[iRow3]; region[iRow2] = regionValue2 - thisElement[j-2] * pivotValue; region[iRow3] = regionValue3 - thisElement[j-3] * pivotValue; } #endif #elif UNROLL_SCATTER==3 const int * COIN_RESTRICT thisIndex = reinterpret_cast(thisElement+number); CoinSimplexInt iRow0; CoinSimplexInt iRow1; CoinFactorizationDouble regionValue0; CoinFactorizationDouble regionValue1; switch(static_cast(number)) { case 0: break; case 1: iRow0 = thisIndex[0]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; break; case 2: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; break; case 3: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; break; case 4: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; break; case 5: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; break; case 6: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; break; case 7: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; break; case 8: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; iRow1 = thisIndex[7]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; region[iRow1] = regionValue1 - thisElement[7] * pivotValue; break; default: if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } break; } #endif } #endif //#define COIN_PREFETCH #ifdef COIN_PREFETCH #if 1 #define coin_prefetch(mem) \ __asm__ __volatile__ ("prefetchnta %0" : : "m" (*(reinterpret_cast(mem)))) #define coin_prefetch_const(mem) \ __asm__ __volatile__ ("prefetchnta %0" : : "m" (*(reinterpret_cast(mem)))) #else #define coin_prefetch(mem) \ __asm__ __volatile__ ("prefetch %0" : : "m" (*(reinterpret_cast(mem)))) #define coin_prefetch_const(mem) \ __asm__ __volatile__ ("prefetch %0" : : "m" (*(reinterpret_cast(mem)))) #endif #else // dummy #define coin_prefetch(mem) #define coin_prefetch_const(mem) #endif #define NEW_CHUNK_SIZE 4 #define NEW_CHUNK_SIZE_INCREMENT (NEW_CHUNK_SIZE+NEW_CHUNK_SIZE/2); #define NEW_CHUNK_SIZE_OFFSET (NEW_CHUNK_SIZE/2) // leaf, pure, nothrow and hot give warnings // fastcall and sseregparm give wrong results //#define SCATTER_ATTRIBUTE __attribute__ ((leaf,fastcall,pure,sseregparm,nothrow,hot)) #define SCATTER_ATTRIBUTE typedef void (*scatterUpdate) (int,CoinFactorizationDouble,const CoinFactorizationDouble *, double *) SCATTER_ATTRIBUTE ; typedef struct { scatterUpdate functionPointer; CoinBigIndex offset; int number; } scatterStruct; void CoinAbcScatterUpdate0(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate1(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate2(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate3(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate5(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate6(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate7(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate8(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4N(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus1(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus2(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus3(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate1Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate2Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate3Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate5Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate6Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate7Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate8Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NSubtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus1Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus2Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus3Subtract(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate1Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate2Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate3Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate5Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate6Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate7Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate8Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NAdd(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus1Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus2Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; void CoinAbcScatterUpdate4NPlus3Add(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT thisElement, CoinFactorizationDouble * COIN_RESTRICT region) SCATTER_ATTRIBUTE ; #if INLINE_SCATTER==0 void CoinAbcScatterUpdate(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region, double * COIN_RESTRICT work); #else #if 0 void ABC_INLINE inline CoinAbcScatterUpdate(int number,CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region, double * COIN_RESTRICT /*work*/) { #if UNROLL_SCATTER==0 for (CoinBigIndex j=number-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #elif UNROLL_SCATTER==1 if ((number&1)!=0) { CoinSimplexInt iRow = thisIndex[0]; thisIndex++; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[0]; thisElement++; region[iRow] = regionValue - value * pivotValue; } number = number>>1; CoinFactorizationDouble work2[4]; for ( ; number !=0; number-- ) { CoinSimplexInt iRow0 = thisIndex[0]; CoinSimplexInt iRow1 = thisIndex[1]; work2[0] = region[iRow0]; work2[1] = region[iRow1]; #if 0 work2[2] = region[iRow0]; work2[3] = region[iRow1]; //__v4df b = __builtin_ia32_maskloadpd256(work2); __v4df b = __builtin_ia32_loadupd256(work2); //__v4df b = _mm256_load_pd(work2); #endif work2[0] -= thisElement[0] * pivotValue; work2[1] -= thisElement[1] * pivotValue; region[iRow0] = work2[0]; region[iRow1] = work2[1]; thisIndex+=2; thisElement+=2; } #endif } #endif #endif #define UNROLL_GATHER 0 #define INLINE_GATHER 1 #if INLINE_GATHER==0 CoinFactorizationDouble CoinAbcGatherUpdate(CoinSimplexInt number, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region); #else CoinFactorizationDouble ABC_INLINE inline CoinAbcGatherUpdate(CoinSimplexInt number, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { #if UNROLL_GATHER==0 CoinFactorizationDouble pivotValue=0.0; for (CoinBigIndex j = 0; j < number; j ++ ) { CoinFactorizationDouble value = thisElement[j]; CoinSimplexInt jRow = thisIndex[j]; value *= region[jRow]; pivotValue -= value; } return pivotValue; #else #error code #endif } #endif #define UNROLL_MULTIPLY_INDEXED 0 #define INLINE_MULTIPLY_INDEXED 0 #if INLINE_MULTIPLY_INDEXED==0 void CoinAbcMultiplyIndexed(int number, const double * COIN_RESTRICT multiplier, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region); void CoinAbcMultiplyIndexed(int number, const long double * COIN_RESTRICT multiplier, const int * COIN_RESTRICT thisIndex, long double * COIN_RESTRICT region); #else void ABC_INLINE inline CoinAbcMultiplyIndexed(int number, const double * COIN_RESTRICT multiplier, const int * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { } #endif double CoinAbcMaximumAbsElement(const double * region, int size); void CoinAbcMinMaxAbsElement(const double * region, int size,double & minimum , double & maximum); void CoinAbcMinMaxAbsNormalValues(const double * region, int size,double & minimum , double & maximum); void CoinAbcScale(double * region, double multiplier,int size); void CoinAbcScaleNormalValues(double * region, double multiplier,double killIfLessThanThis,int size); /// maximum fabs(region[i]) and then region[i]*=multiplier double CoinAbcMaximumAbsElementAndScale(double * region, double multiplier,int size); void CoinAbcSetElements(double * region, int size, double value); void CoinAbcMultiplyAdd(const double * region1, int size, double multiplier1, double * regionChanged, double multiplier2); double CoinAbcInnerProduct(const double * region1, int size, const double * region2); void CoinAbcGetNorms(const double * region, int size, double & norm1, double & norm2); /// regionTo[index[i]]=regionFrom[i] void CoinAbcScatterTo(const double * regionFrom, double * regionTo, const int * index,int number); /// regionTo[i]=regionFrom[index[i]] void CoinAbcGatherFrom(const double * regionFrom, double * regionTo, const int * index,int number); /// regionTo[index[i]]=0.0 void CoinAbcScatterZeroTo(double * regionTo, const int * index,int number); /// regionTo[indexScatter[indexList[i]]]=regionFrom[indexList[i]] void CoinAbcScatterToList(const double * regionFrom, double * regionTo, const int * indexList, const int * indexScatter ,int number); /// array[i]=1.0/sqrt(array[i]) void CoinAbcInverseSqrts(double * array, int n); void CoinAbcReciprocal(double * array, int n, const double *input); void CoinAbcMemcpyLong(double * array,const double * arrayFrom,int size); void CoinAbcMemcpyLong(int * array,const int * arrayFrom,int size); void CoinAbcMemcpyLong(unsigned char * array,const unsigned char * arrayFrom,int size); void CoinAbcMemset0Long(double * array,int size); void CoinAbcMemset0Long(int * array,int size); void CoinAbcMemset0Long(unsigned char * array,int size); void CoinAbcMemmove(double * array,const double * arrayFrom,int size); void CoinAbcMemmove(int * array,const int * arrayFrom,int size); void CoinAbcMemmove(unsigned char * array,const unsigned char * arrayFrom,int size); /// This moves down and zeroes out end void CoinAbcMemmoveAndZero(double * array,double * arrayFrom,int size); /// This compacts several sections and zeroes out end (returns number) int CoinAbcCompact(int numberSections,int alreadyDone,double * array,const int * starts, const int * lengths); /// This compacts several sections (returns number) int CoinAbcCompact(int numberSections,int alreadyDone,int * array,const int * starts, const int * lengths); #endif #if ABC_CREATE_SCATTER_FUNCTION SCATTER_ATTRIBUTE void functionName(ScatterUpdate1)(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==1); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element+1); int iColumn0=thisColumn[0]; double value0=region[iColumn0]; value0 OPERATION multiplier*element[0]; region[iColumn0]=value0; } SCATTER_ATTRIBUTE void functionName(ScatterUpdate2)(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==2); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element+2); #if NEW_CHUNK_SIZE==2 int nFull=2&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element); } #endif #if NEW_CHUNK_SIZE==4 int iColumn0=thisColumn[0]; int iColumn1=thisColumn[1]; CoinFactorizationDouble value0=region[iColumn0]; CoinFactorizationDouble value1=region[iColumn1]; value0 OPERATION multiplier*element[0]; value1 OPERATION multiplier*element[1]; region[iColumn0]=value0; region[iColumn1]=value1; #endif } SCATTER_ATTRIBUTE void functionName(ScatterUpdate3)(int numberIn, CoinFactorizationDouble multiplier, const CoinFactorizationDouble * COIN_RESTRICT element, CoinFactorizationDouble * COIN_RESTRICT region) { #ifndef NDEBUG assert (numberIn==3); #endif const int * COIN_RESTRICT thisColumn = reinterpret_cast(element+3); #if AVX2==1 double temp[2]; #endif #if NEW_CHUNK_SIZE==2 int nFull=3&(~(NEW_CHUNK_SIZE-1)); for (int j=0;j(element+4); int nFull=4&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j(element+5); int nFull=5&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j(element+6); int nFull=6&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j(element+7); int nFull=7&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j(element+8); int nFull=8&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j(element+numberIn); int nFull=numberIn&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j(element+numberIn); int nFull=numberIn&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j(element+numberIn); int nFull=numberIn&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j(element+numberIn); int nFull=numberIn&(~(NEW_CHUNK_SIZE-1)); #if AVX2==1 double temp[4]; #endif for (int j=0;j #include /* so decodePhrase and clpCheck can access */ static ampl_info * saveInfo = NULL; // Set to 1 if algorithm found static char algFound[20] = ""; static char* checkPhrase(Option_Info *oi, keyword *kw, char *v) { if (strlen(v)) printf("string %s\n", v); // Say algorithm found strcpy(algFound, kw->desc); return v; } static char* checkPhrase2(Option_Info *oi, keyword *kw, char *v) { if (strlen(v)) printf("string %s\n", v); // put out keyword saveInfo->arguments = (char **) realloc(saveInfo->arguments, (saveInfo->numberArguments + 1) * sizeof(char *)); saveInfo->arguments[saveInfo->numberArguments++] = strdup(kw->desc); return v; } static fint decodePhrase(char * phrase, ftnlen length) { char * blank = strchr(phrase, ' '); if (blank) { /* split arguments */ *blank = '\0'; saveInfo->arguments = (char **) realloc(saveInfo->arguments, (saveInfo->numberArguments + 2) * sizeof(char *)); saveInfo->arguments[saveInfo->numberArguments++] = strdup(phrase); *blank = ' '; phrase = blank + 1; /* move on */ if (strlen(phrase)) saveInfo->arguments[saveInfo->numberArguments++] = strdup(phrase); } else if (strlen(phrase)) { saveInfo->arguments = (char **) realloc(saveInfo->arguments, (saveInfo->numberArguments + 1) * sizeof(char *)); saveInfo->arguments[saveInfo->numberArguments++] = strdup(phrase); } return 0; } static void sos_kludge(int nsos, int *sosbeg, double *sosref, int * sosind) { // Adjust sosref if necessary to make monotonic increasing int i, j, k; // first sort for (i = 0; i < nsos; i++) { k = sosbeg[i]; int end = sosbeg[i+1]; CoinSort_2(sosref + k, sosref + end, sosind + k); } double t, t1; for (i = j = 0; i++ < nsos; ) { k = sosbeg[i]; t = sosref[j]; while (++j < k) { t1 = sosref[j]; t += 1e-10; if (t1 <= t) sosref[j] = t1 = t + 1e-10; t = t1; } } } static char xxxxxx[20]; #define VP (char*) static keyword keywds[] = { /* must be sorted */ { const_cast("barrier"), checkPhrase, (char *) xxxxxx , const_cast("-barrier")}, { const_cast("dual"), checkPhrase, (char *) xxxxxx , const_cast("-dualsimplex")}, { const_cast("help"), checkPhrase2, (char *) xxxxxx , const_cast("-?")}, { const_cast("initial"), checkPhrase, (char *) xxxxxx , const_cast("-initialsolve")}, { const_cast("max"), checkPhrase2, (char *) xxxxxx , const_cast("-maximize")}, { const_cast("maximize"), checkPhrase2, (char *) xxxxxx , const_cast("-maximize")}, { const_cast("primal"), checkPhrase, (char *) xxxxxx , const_cast("-primalsimplex")}, { const_cast("quit"), checkPhrase2, (char *) xxxxxx , const_cast("-quit")}, { const_cast("wantsol"), WS_val, NULL, const_cast("write .sol file (without -AMPL)")} }; static Option_Info Oinfo = { const_cast("clp"), const_cast("CLP " CLP_VERSION), const_cast("clp_options"), keywds, nkeywds, 0, 0, 0, decodePhrase, 0, 0, 0, 20130502 }; // strdup used to avoid g++ compiler warning static SufDecl suftab[] = { #ifdef JJF_ZERO { const_cast("current"), 0, ASL_Sufkind_con | ASL_Sufkind_outonly }, { const_cast("current"), 0, ASL_Sufkind_var | ASL_Sufkind_outonly }, { const_cast("direction"), 0, ASL_Sufkind_var }, { const_cast("down"), 0, ASL_Sufkind_con | ASL_Sufkind_outonly }, { const_cast("down"), 0, ASL_Sufkind_var | ASL_Sufkind_outonly }, { const_cast("priority"), 0, ASL_Sufkind_var }, #endif { const_cast("cut"), 0, ASL_Sufkind_con }, { const_cast("direction"), 0, ASL_Sufkind_var }, { const_cast("downPseudocost"), 0, ASL_Sufkind_var | ASL_Sufkind_real }, { const_cast("priority"), 0, ASL_Sufkind_var }, { const_cast("ref"), 0, ASL_Sufkind_var | ASL_Sufkind_real }, { const_cast("sos"), 0, ASL_Sufkind_var }, { const_cast("sos"), 0, ASL_Sufkind_con }, { const_cast("sosno"), 0, ASL_Sufkind_var | ASL_Sufkind_real }, { const_cast("sosref"), 0, ASL_Sufkind_var | ASL_Sufkind_real }, { const_cast("special"), 0, ASL_Sufkind_var }, { const_cast("special"), 0, ASL_Sufkind_con }, /*{ const_cast("special"), 0, ASL_Sufkind_con },*/ { const_cast("sstatus"), 0, ASL_Sufkind_var, 0 }, { const_cast("sstatus"), 0, ASL_Sufkind_con, 0 }, { const_cast("upPseudocost"), 0, ASL_Sufkind_var | ASL_Sufkind_real } #ifdef JJF_ZERO { const_cast("unbdd"), 0, ASL_Sufkind_var | ASL_Sufkind_outonly}, { const_cast("up"), 0, ASL_Sufkind_con | ASL_Sufkind_outonly }, { const_cast("up"), 0, ASL_Sufkind_var | ASL_Sufkind_outonly } #endif }; #include "float.h" #include "limits.h" static ASL *asl = NULL; static FILE *nl = NULL; static void mip_stuff(void) { int i; double *pseudoUp, *pseudoDown; int *priority, *direction; // To label cuts (there will be other uses for special) int *cut; // To label special variables - at present 1= must be >= 1 or <= -1 int * special; SufDesc *dpup, *dpdown, *dpri, *ddir, *dcut, *dspecial; ddir = suf_get("direction", ASL_Sufkind_var); direction = ddir->u.i; dpri = suf_get("priority", ASL_Sufkind_var); priority = dpri->u.i; dspecial = suf_get("special", ASL_Sufkind_con); dcut = suf_get("cut", ASL_Sufkind_con); cut = dcut->u.i; if (!cut) { // try special dcut = suf_get("special", ASL_Sufkind_con); cut = dcut->u.i; } dspecial = suf_get("special", ASL_Sufkind_var); special = dspecial->u.i; dpdown = suf_get("downPseudocost", ASL_Sufkind_var); pseudoDown = dpdown->u.r; dpup = suf_get("upPseudocost", ASL_Sufkind_var); pseudoUp = dpup->u.r; assert(saveInfo); int numberColumns = saveInfo->numberColumns; if (direction) { int baddir = 0; saveInfo->branchDirection = (int *) malloc(numberColumns * sizeof(int)); for (i = 0; i < numberColumns; i++) { int value = direction[i]; if (value < -1 || value > 1) { baddir++; value = 0; } saveInfo->branchDirection[i] = value; } if (baddir) fprintf(Stderr, "Treating %d .direction values outside [-1, 1] as 0.\n", baddir); } if (priority) { int badpri = 0; saveInfo->priorities = (int *) malloc(numberColumns * sizeof(int)); for (i = 0; i < numberColumns; i++) { int value = priority[i]; if (value < 0) { badpri++; value = 0; } saveInfo->priorities[i] = value; } if (badpri) fprintf(Stderr, "Treating %d negative .priority values as 0\n", badpri); } if (special) { int badspecial = 0; saveInfo->special = (int *) malloc(numberColumns * sizeof(int)); for (i = 0; i < numberColumns; i++) { int value = special[i]; if (value < 0) { badspecial++; value = 0; } saveInfo->special[i] = value; } if (badspecial) fprintf(Stderr, "Treating %d negative special values as 0\n", badspecial); } int numberRows = saveInfo->numberRows; if (cut) { int badcut = 0; saveInfo->cut = (int *) malloc(numberRows * sizeof(int)); for (i = 0; i < numberRows; i++) { int value = cut[i]; if (value < 0) { badcut++; value = 0; } saveInfo->cut[i] = value; } if (badcut) fprintf(Stderr, "Treating %d negative cut values as 0\n", badcut); } if (pseudoDown || pseudoUp) { int badpseudo = 0; if (!pseudoDown || !pseudoUp) fprintf(Stderr, "Only one set of pseudocosts - assumed same\n"); saveInfo->pseudoDown = (double *) malloc(numberColumns * sizeof(double)); saveInfo->pseudoUp = (double *) malloc(numberColumns * sizeof(double)); for (i = 0; i < numberColumns; i++) { double valueD = 0.0, valueU = 0.0; if (pseudoDown) { valueD = pseudoDown[i]; if (valueD < 0) { badpseudo++; valueD = 0.0; } } if (pseudoUp) { valueU = pseudoUp[i]; if (valueU < 0) { badpseudo++; valueU = 0.0; } } if (!valueD) valueD = valueU; if (!valueU) valueU = valueD; saveInfo->pseudoDown[i] = valueD; saveInfo->pseudoUp[i] = valueU; } if (badpseudo) fprintf(Stderr, "Treating %d negative pseudoCosts as 0.0\n", badpseudo); } } static void stat_map(int *stat, int n, int *map, int mx, const char *what) { int bad, i, i1 = 0, j, j1 = 0; static char badfmt[] = "Coin driver: %s[%d] = %d\n"; for (i = bad = 0; i < n; i++) { if ((j = stat[i]) >= 0 && j <= mx) stat[i] = map[j]; else { stat[i] = 0; i1 = i; j1 = j; if (!bad++) fprintf(Stderr, badfmt, what, i, j); } } if (bad > 1) { if (bad == 2) fprintf(Stderr, badfmt, what, i1, j1); else fprintf(Stderr, "Coin driver: %d messages about bad %s values suppressed.\n", bad - 1, what); } } int readAmpl(ampl_info * info, int argc, char **argv, void ** coinModel) { char *stub; ograd *og; int i; SufDesc *csd; SufDesc *rsd; /*bool *basis, *lower;*/ /*double *LU, *c, lb, objadj, *rshift, *shift, t, ub, *x, *x0, *x1;*/ char * environment = getenv("clp_options"); char tempBuffer[20]; double * obj; double * columnLower; double * columnUpper; double * rowLower; double * rowUpper; char ** saveArgv = argv; char fileName[1000]; if (argc > 1) strcpy(fileName, argv[1]); else fileName[0] = '\0'; int nonLinearType = -1; // testosi parameter - if >= 10 then go in through coinModel for (i = 1; i < argc; i++) { if (!strncmp(argv[i], "testosi", 7)) { char * equals = strchr(argv[i], '='); if (equals && atoi(equals + 1) >= 10 && atoi(equals + 1) <= 20) { nonLinearType = atoi(equals + 1); break; } } } int saveArgc = argc; if (info->numberRows != -1234567) memset(info, 0, sizeof(ampl_info)); // overwrite unless magic number set /* save so can be accessed by decodePhrase */ saveInfo = info; info->numberArguments = 0; info->arguments = (char **) malloc(2 * sizeof(char *)); info->arguments[info->numberArguments++] = strdup("ampl"); info->arguments[info->numberArguments++] = strdup("clp"); asl = ASL_alloc(ASL_read_f); stub = getstub(&argv, &Oinfo); if (!stub) usage_ASL(&Oinfo, 1); nl = jac0dim(stub, 0); suf_declare(suftab, sizeof(suftab) / sizeof(SufDecl)); /* set A_vals to get the constraints column-wise (malloc so can be freed) */ A_vals = (double *) malloc(nzc * sizeof(double)); if (!A_vals) { printf("no memory\n"); return 1; } /* say we want primal solution */ want_xpi0 = 1; /* for basis info */ info->columnStatus = (int *) malloc(n_var * sizeof(int)); for (int i=0;icolumnStatus[i]=3; info->rowStatus = (int *) malloc(n_con * sizeof(int)); for (int i=0;irowStatus[i]=1; csd = suf_iput("sstatus", ASL_Sufkind_var, info->columnStatus); rsd = suf_iput("sstatus", ASL_Sufkind_con, info->rowStatus); if (!(nlvc + nlvo) && nonLinearType < 10) { /* read linear model*/ f_read(nl, 0); // see if any sos if (true) { char *sostype; int nsosnz, *sosbeg, *sosind, * sospri; double *sosref; int nsos; int i = ASL_suf_sos_explict_free; int copri[2], **p_sospri; copri[0] = 0; copri[1] = 0; p_sospri = &sospri; nsos = suf_sos(i, &nsosnz, &sostype, p_sospri, copri, &sosbeg, &sosind, &sosref); if (nsos) { info->numberSos = nsos; info->sosType = (char *) malloc(nsos); info->sosPriority = (int *) malloc(nsos * sizeof(int)); info->sosStart = (int *) malloc((nsos + 1) * sizeof(int)); info->sosIndices = (int *) malloc(nsosnz * sizeof(int)); info->sosReference = (double *) malloc(nsosnz * sizeof(double)); sos_kludge(nsos, sosbeg, sosref, sosind); for (int i = 0; i < nsos; i++) { char ichar = sostype[i]; assert (ichar == '1' || ichar == '2'); info->sosType[i] = static_cast(ichar - '0'); } memcpy(info->sosPriority, sospri, nsos*sizeof(int)); memcpy(info->sosStart, sosbeg, (nsos + 1)*sizeof(int)); memcpy(info->sosIndices, sosind, nsosnz*sizeof(int)); memcpy(info->sosReference, sosref, nsosnz*sizeof(double)); } } /*sos_finish(&specialOrderedInfo, 0, &j, 0, 0, 0, 0, 0);*/ Oinfo.uinfo = tempBuffer; if (getopts(argv, &Oinfo)) return 1; /* objective*/ obj = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) obj[i] = 0.0; if (n_obj) { for (og = Ograd[0]; og; og = og->next) obj[og->varno] = og->coef; } if (objtype[0]) info->direction = -1.0; else info->direction = 1.0; info->offset = objconst(0); /* Column bounds*/ columnLower = (double *) malloc(n_var * sizeof(double)); columnUpper = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) { columnLower[i] = LUv[2*i]; if (columnLower[i] <= negInfinity) columnLower[i] = -COIN_DBL_MAX; columnUpper[i] = LUv[2*i+1]; if (columnUpper[i] >= Infinity) columnUpper[i] = COIN_DBL_MAX; } /* Row bounds*/ rowLower = (double *) malloc(n_con * sizeof(double)); rowUpper = (double *) malloc(n_con * sizeof(double)); for (i = 0; i < n_con; i++) { rowLower[i] = LUrhs[2*i]; if (rowLower[i] <= negInfinity) rowLower[i] = -COIN_DBL_MAX; rowUpper[i] = LUrhs[2*i+1]; if (rowUpper[i] >= Infinity) rowUpper[i] = COIN_DBL_MAX; } info->numberRows = n_con; info->numberColumns = n_var; info->numberElements = nzc; info->numberBinary = nbv; info->numberIntegers = niv + nbv; info->objective = obj; info->rowLower = rowLower; info->rowUpper = rowUpper; info->columnLower = columnLower; info->columnUpper = columnUpper; info->starts = A_colstarts; /*A_colstarts=NULL;*/ info->rows = A_rownos; /*A_rownos=NULL;*/ info->elements = A_vals; /*A_vals=NULL;*/ info->primalSolution = NULL; /* put in primalSolution if exists */ if (X0) { info->primalSolution = (double *) malloc(n_var * sizeof(double)); memcpy(info->primalSolution, X0, n_var*sizeof(double)); } info->dualSolution = NULL; if (niv + nbv > 0) mip_stuff(); // get any extra info if ((!(niv + nbv) && (csd->kind & ASL_Sufkind_input)) || (rsd->kind & ASL_Sufkind_input)) { /* convert status - need info on map */ static int map[] = {1, 3, 1, 1, 2, 1, 1}; stat_map(info->columnStatus, n_var, map, 6, "incoming columnStatus"); stat_map(info->rowStatus, n_con, map, 6, "incoming rowStatus"); } else { /* all slack basis */ // leave status for output */ #ifdef JJF_ZERO free(info->rowStatus); info->rowStatus = NULL; free(info->columnStatus); info->columnStatus = NULL; #endif } } else { // QP // Add .nl if not there if (!strstr(fileName, ".nl")) strcat(fileName, ".nl"); CoinModel * model = new CoinModel((nonLinearType > 10) ? 2 : 1, fileName, info); if (model->numberRows() > 0 || model->numberColumns() > 0) *coinModel = (void *) model; Oinfo.uinfo = tempBuffer; if (getopts(argv, &Oinfo)) return 1; Oinfo.wantsol = 1; if (objtype[0]) info->direction = -1.0; else info->direction = 1.0; model->setOptimizationDirection(info->direction); info->offset = objconst(0); info->numberRows = n_con; info->numberColumns = n_var; info->numberElements = nzc; info->numberBinary = nbv; int numberIntegers = niv + nlvci + nlvoi + nbv; if (nlvci + nlvoi + nlvc + nlvo) { // Non linear // No idea if there are overlaps so compute int numberIntegers = 0; for ( i = 0; i < n_var; i++) { if (model->columnIsInteger(i)) numberIntegers++; } } info->numberIntegers = numberIntegers; // Say nonlinear if it is info->nonLinear = nlvc + nlvo; if (numberIntegers > 0) { mip_stuff(); // get any extra info if (info->cut) model->setCutMarker(info->numberRows, info->cut); if (info->priorities) model->setPriorities(info->numberColumns, info->priorities); } } /* add -solve - unless something there already - also check for sleep=yes */ { int found = 0; int foundLog = 0; int foundSleep = 0; const char * something[] = {"solve", "branch", "duals", "primals", "user"}; for (i = 0; i < info->numberArguments; i++) { unsigned int j; const char * argument = info->arguments[i]; for (j = 0; j < sizeof(something) / sizeof(char *); j++) { const char * check = something[j]; if (!strncmp(argument, check, sizeof(check))) { found = (int)(j + 1); } else if (!strncmp(argument, "log", 3)) { foundLog = 1; } else if (!strncmp(argument, "sleep", 5)) { foundSleep = 1; } } } if (foundLog) { /* print options etc */ for (i = 0; i < saveArgc; i++) printf("%s ", saveArgv[i]); printf("\n"); if (environment) printf("env %s\n", environment); /*printf("%d rows %d columns %d elements\n",n_con,n_var,nzc);*/ } if (!found) { if (!strlen(algFound)) { info->arguments = (char **) realloc(info->arguments, (info->numberArguments + 1) * sizeof(char *)); info->arguments[info->numberArguments++] = strdup("-solve"); } else { // use algorithm from keyword info->arguments = (char **) realloc(info->arguments, (info->numberArguments + 1) * sizeof(char *)); info->arguments[info->numberArguments++] = strdup(algFound); } } if (foundSleep) { /* let user copy .nl file */ fprintf(stderr, "You can copy .nl file %s for debug purposes or attach debugger\n", saveArgv[1]); fprintf(stderr, "Type q to quit, anything else to continue\n"); int getChar = getc(stdin); if (getChar == 'q' || getChar == 'Q') exit(1); } } /* add -quit */ info->arguments = (char **) realloc(info->arguments, (info->numberArguments + 1) * sizeof(char *)); info->arguments[info->numberArguments++] = strdup("-quit"); return 0; } void freeArrays1(ampl_info * info) { free(info->objective); info->objective = NULL; free(info->rowLower); info->rowLower = NULL; free(info->rowUpper); info->rowUpper = NULL; free(info->columnLower); info->columnLower = NULL; free(info->columnUpper); info->columnUpper = NULL; /* this one not freed by ASL_free */ free(info->elements); info->elements = NULL; free(info->primalSolution); info->primalSolution = NULL; free(info->dualSolution); info->dualSolution = NULL; /*free(info->rowStatus); info->rowStatus=NULL; free(info->columnStatus); info->columnStatus=NULL;*/ } void freeArrays2(ampl_info * info) { free(info->primalSolution); info->primalSolution = NULL; free(info->dualSolution); info->dualSolution = NULL; free(info->rowStatus); info->rowStatus = NULL; free(info->columnStatus); info->columnStatus = NULL; free(info->priorities); info->priorities = NULL; free(info->branchDirection); info->branchDirection = NULL; free(info->pseudoDown); info->pseudoDown = NULL; free(info->pseudoUp); info->pseudoUp = NULL; free(info->sosType); info->sosType = NULL; free(info->sosPriority); info->sosPriority = NULL; free(info->sosStart); info->sosStart = NULL; free(info->sosIndices); info->sosIndices = NULL; free(info->sosReference); info->sosReference = NULL; free(info->cut); info->cut = NULL; ASL_free(&asl); } void freeArgs(ampl_info * info) { int i; for ( i = 0; i < info->numberArguments; i++) free(info->arguments[i]); free(info->arguments); } int ampl_obj_prec() { int precision = obj_prec(); if (precision<=0) precision=15; return precision; } void writeAmpl(ampl_info * info) { char buf[1000]; typedef struct { const char *msg; int code; int wantObj; } Sol_info; static Sol_info solinfo[] = { { "optimal solution", 000, 1 }, { "infeasible", 200, 1 }, { "unbounded", 300, 0 }, { "iteration limit etc", 400, 1 }, { "solution limit", 401, 1 }, { "ran out of space", 500, 0 }, { "status unknown", 501, 1 }, { "bug!", 502, 0 }, { "best MIP solution so far restored", 101, 1 }, { "failed to restore best MIP solution", 503, 1 }, { "optimal (?) solution", 100, 1 } }; /* convert status - need info on map */ static int map[] = {0, 3, 4, 1}; sprintf(buf, "%s %s", Oinfo.bsname, info->buffer); solve_result_num = solinfo[info->problemStatus].code; if (info->columnStatus) { stat_map(info->columnStatus, n_var, map, 4, "outgoing columnStatus"); stat_map(info->rowStatus, n_con, map, 4, "outgoing rowStatus"); suf_iput("sstatus", ASL_Sufkind_var, info->columnStatus); suf_iput("sstatus", ASL_Sufkind_con, info->rowStatus); } write_sol(buf, info->primalSolution, info->dualSolution, &Oinfo); } /* Read a problem from AMPL nl file */ CoinModel::CoinModel( int nonLinear, const char * fileName, const void * info) : CoinBaseModel(), maximumRows_(0), maximumColumns_(0), numberElements_(0), maximumElements_(0), numberQuadraticElements_(0), maximumQuadraticElements_(0), rowLower_(NULL), rowUpper_(NULL), rowType_(NULL), objective_(NULL), columnLower_(NULL), columnUpper_(NULL), integerType_(NULL), columnType_(NULL), start_(NULL), elements_(NULL), packedMatrix_(NULL), quadraticElements_(NULL), sortIndices_(NULL), sortElements_(NULL), sortSize_(0), sizeAssociated_(0), associated_(NULL), numberSOS_(0), startSOS_(NULL), memberSOS_(NULL), typeSOS_(NULL), prioritySOS_(NULL), referenceSOS_(NULL), priority_(NULL), cut_(NULL), moreInfo_(NULL), type_(-1), noNames_(false), links_(0) { problemName_ = ""; int status = 0; if (!strcmp(fileName, "-") || !strcmp(fileName, "stdin")) { // stdin } else { std::string name = fileName; bool readable = fileCoinReadable(name); if (!readable) { std::cerr << "Unable to open file " << fileName << std::endl; status = -1; } } if (!status) { gdb(nonLinear, fileName, info); } } #ifdef JJF_ZERO static real qterm(ASL *asl, fint *colq, fint *rowq, real *delsq) { double t, t1, *x, *x0, *xe; fint *rq0, *rqe; t = 0.; x0 = x = X0; xe = x + n_var; rq0 = rowq; while (x < xe) { t1 = *x++; rqe = rq0 + *++colq; while (rowq < rqe) t += t1 * x0[*rowq++]**delsq++; } return 0.5 * t; } #endif // stolen from IPopt with changes typedef struct { double obj_sign_; ASL_pfgh * asl_; double * non_const_x_; int * column_; // for jacobian int * rowStart_; double * gradient_; double * constraintValues_; int nz_h_full_; // number of nonzeros in hessian int nerror_; bool objval_called_with_current_x_; bool conval_called_with_current_x_; bool jacval_called_with_current_x_; } ClpAmplInfo; void CoinModel::gdb( int nonLinear, const char * fileName, const void * info) { const ampl_info * amplInfo = (const ampl_info *) info; ograd *og = NULL; int i; SufDesc *csd = NULL; SufDesc *rsd = NULL; /*bool *basis, *lower;*/ /*double *LU, *c, lb, objadj, *rshift, *shift, t, ub, *x, *x0, *x1;*/ //char tempBuffer[20]; double * objective = NULL; double * columnLower = NULL; double * columnUpper = NULL; double * rowLower = NULL; double * rowUpper = NULL; int * columnStatus = NULL; int * rowStatus = NULL; int numberRows = -1; int numberColumns = -1; int numberElements = -1; int numberBinary = -1; int numberIntegers = -1; int numberAllNonLinearBoth = 0; int numberIntegerNonLinearBoth = 0; int numberAllNonLinearConstraints = 0; int numberIntegerNonLinearConstraints = 0; int numberAllNonLinearObjective = 0; int numberIntegerNonLinearObjective = 0; double * primalSolution = NULL; double direction = 1.0; char * stub = strdup(fileName); CoinPackedMatrix matrixByRow; fint ** colqp = NULL; int *z = NULL; if (nonLinear == 0) { // linear asl = ASL_alloc(ASL_read_f); nl = jac0dim(stub, 0); free(stub); suf_declare(suftab, sizeof(suftab) / sizeof(SufDecl)); /* set A_vals to get the constraints column-wise (malloc so can be freed) */ A_vals = (double *) malloc(nzc * sizeof(double)); if (!A_vals) { printf("no memory\n"); return ; } /* say we want primal solution */ want_xpi0 = 1; /* for basis info */ columnStatus = (int *) malloc(n_var * sizeof(int)); rowStatus = (int *) malloc(n_con * sizeof(int)); csd = suf_iput("sstatus", ASL_Sufkind_var, columnStatus); rsd = suf_iput("sstatus", ASL_Sufkind_con, rowStatus); /* read linear model*/ f_read(nl, 0); // see if any sos if (true) { char *sostype; int nsosnz, *sosbeg, *sosind, * sospri; double *sosref; int nsos; int i = ASL_suf_sos_explict_free; int copri[2], **p_sospri; copri[0] = 0; copri[1] = 0; p_sospri = &sospri; nsos = suf_sos(i, &nsosnz, &sostype, p_sospri, copri, &sosbeg, &sosind, &sosref); if (nsos) { abort(); #ifdef JJF_ZERO info->numberSos = nsos; info->sosType = (char *) malloc(nsos); info->sosPriority = (int *) malloc(nsos * sizeof(int)); info->sosStart = (int *) malloc((nsos + 1) * sizeof(int)); info->sosIndices = (int *) malloc(nsosnz * sizeof(int)); info->sosReference = (double *) malloc(nsosnz * sizeof(double)); sos_kludge(nsos, sosbeg, sosref, sosind); for (int i = 0; i < nsos; i++) { int ichar = sostype[i]; assert (ichar == '1' || ichar == '2'); info->sosType[i] = ichar - '0'; } memcpy(info->sosPriority, sospri, nsos*sizeof(int)); memcpy(info->sosStart, sosbeg, (nsos + 1)*sizeof(int)); memcpy(info->sosIndices, sosind, nsosnz*sizeof(int)); memcpy(info->sosReference, sosref, nsosnz*sizeof(double)); #endif } } /*sos_finish(&specialOrderedInfo, 0, &j, 0, 0, 0, 0, 0);*/ //Oinfo.uinfo = tempBuffer; //if (getopts(argv, &Oinfo)) //return 1; /* objective*/ objective = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) objective[i] = 0.0; if (n_obj) { for (og = Ograd[0]; og; og = og->next) objective[og->varno] = og->coef; } if (objtype[0]) direction = -1.0; else direction = 1.0; objectiveOffset_ = objconst(0); /* Column bounds*/ columnLower = (double *) malloc(n_var * sizeof(double)); columnUpper = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) { columnLower[i] = LUv[2*i]; if (columnLower[i] <= negInfinity) columnLower[i] = -COIN_DBL_MAX; columnUpper[i] = LUv[2*i+1]; if (columnUpper[i] >= Infinity) columnUpper[i] = COIN_DBL_MAX; } /* Row bounds*/ rowLower = (double *) malloc(n_con * sizeof(double)); rowUpper = (double *) malloc(n_con * sizeof(double)); for (i = 0; i < n_con; i++) { rowLower[i] = LUrhs[2*i]; if (rowLower[i] <= negInfinity) rowLower[i] = -COIN_DBL_MAX; rowUpper[i] = LUrhs[2*i+1]; if (rowUpper[i] >= Infinity) rowUpper[i] = COIN_DBL_MAX; } numberRows = n_con; numberColumns = n_var; numberElements = nzc; numberBinary = nbv; numberIntegers = niv; /* put in primalSolution if exists */ if (X0) { primalSolution = (double *) malloc(n_var * sizeof(double)); memcpy( primalSolution, X0, n_var*sizeof(double)); } //double * dualSolution=NULL; if (niv + nbv > 0) mip_stuff(); // get any extra info if ((!(niv + nbv) && (csd->kind & ASL_Sufkind_input)) || (rsd->kind & ASL_Sufkind_input)) { /* convert status - need info on map */ static int map[] = {1, 3, 1, 1, 2, 1, 1}; stat_map(columnStatus, n_var, map, 6, "incoming columnStatus"); stat_map(rowStatus, n_con, map, 6, "incoming rowStatus"); } else { /* all slack basis */ // leave status for output */ #ifdef JJF_ZERO free(rowStatus); rowStatus = NULL; free(columnStatus); columnStatus = NULL; #endif } CoinPackedMatrix columnCopy(true, numberRows, numberColumns, numberElements, A_vals, A_rownos, A_colstarts, NULL); matrixByRow.reverseOrderedCopyOf(columnCopy); } else if (nonLinear == 1) { // quadratic asl = ASL_alloc(ASL_read_fg); nl = jac0dim(stub, (ftnlen) strlen(stub)); free(stub); suf_declare(suftab, sizeof(suftab) / sizeof(SufDecl)); /* read model*/ X0 = (double*) malloc(n_var * sizeof(double)); CoinZeroN(X0, n_var); qp_read(nl, 0); assert (n_obj == 1); int nz = 1 + n_con; colqp = (fint**) malloc(nz * (2 * sizeof(int*) + sizeof(double*))); fint ** rowqp = colqp + nz; double ** delsqp = (double **)(rowqp + nz); z = (int*) malloc(nz * sizeof(int)); for (i = 0; i <= n_con; i++) { z[i] = nqpcheck(-i, rowqp + i, colqp + i, delsqp + i); } qp_opify(); /* objective*/ objective = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) objective[i] = 0.0; if (n_obj) { for (og = Ograd[0]; og; og = og->next) objective[og->varno] = og->coef; } if (objtype[0]) direction = -1.0; else direction = 1.0; objectiveOffset_ = objconst(0); /* Column bounds*/ columnLower = (double *) malloc(n_var * sizeof(double)); columnUpper = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) { columnLower[i] = LUv[2*i]; if (columnLower[i] <= negInfinity) columnLower[i] = -COIN_DBL_MAX; columnUpper[i] = LUv[2*i+1]; if (columnUpper[i] >= Infinity) columnUpper[i] = COIN_DBL_MAX; } // Build by row from scratch //matrixByRow.reserve(n_var,nzc,true); // say row orderded matrixByRow.transpose(); /* Row bounds*/ rowLower = (double *) malloc(n_con * sizeof(double)); rowUpper = (double *) malloc(n_con * sizeof(double)); CoinBigIndex * rowStart = new CoinBigIndex [n_con+1]; int * column = new int [nzc]; double * element = new double [nzc]; rowStart[0] = 0; numberElements = 0; for (i = 0; i < n_con; i++) { rowLower[i] = LUrhs[2*i]; if (rowLower[i] <= negInfinity) rowLower[i] = -COIN_DBL_MAX; rowUpper[i] = LUrhs[2*i+1]; if (rowUpper[i] >= Infinity) rowUpper[i] = COIN_DBL_MAX; for (cgrad * cg = Cgrad[i]; cg; cg = cg->next) { column[numberElements] = cg->varno; element[numberElements++] = cg->coef; } rowStart[i+1] = numberElements; } assert (numberElements == nzc); matrixByRow.appendRows(n_con, rowStart, column, element); delete [] rowStart; delete [] column; delete [] element; numberRows = n_con; numberColumns = n_var; //numberElements=nzc; numberBinary = nbv; numberIntegers = niv; numberAllNonLinearBoth = nlvb; numberIntegerNonLinearBoth = nlvbi; numberAllNonLinearConstraints = nlvc; numberIntegerNonLinearConstraints = nlvci; numberAllNonLinearObjective = nlvo; numberIntegerNonLinearObjective = nlvoi; /* say we want primal solution */ want_xpi0 = 1; //double * dualSolution=NULL; // save asl // Fix memory leak one day ClpAmplInfo * info = new ClpAmplInfo; //amplGamsData_ = info; info->asl_ = NULL; // as wrong form asl; info->nz_h_full_ = -1; // number of nonzeros in hessian info->objval_called_with_current_x_ = false; info->nerror_ = 0; info->obj_sign_ = direction; info->conval_called_with_current_x_ = false; info->non_const_x_ = NULL; info->jacval_called_with_current_x_ = false; info->rowStart_ = NULL; info->column_ = NULL; info->gradient_ = NULL; info->constraintValues_ = NULL; } else if (nonLinear == 2) { // General nonlinear! //ASL_pfgh* asl = (ASL_pfgh*)ASL_alloc(ASL_read_pfgh); asl = ASL_alloc(ASL_read_pfgh); nl = jac0dim(stub, (ftnlen) strlen(stub)); free(stub); suf_declare(suftab, sizeof(suftab) / sizeof(SufDecl)); /* read model*/ X0 = (double*) malloc(n_var * sizeof(double)); CoinZeroN(X0, n_var); // code stolen from Ipopt int retcode = pfgh_read(nl, ASL_return_read_err | ASL_findgroups); switch (retcode) { case ASL_readerr_none : {} break; case ASL_readerr_nofile : { printf( "Cannot open .nl file\n"); exit(-1); } break; case ASL_readerr_nonlin : { assert(false); // this better not be an error! printf( "model involves nonlinearities (ed0read)\n"); exit(-1); } break; case ASL_readerr_argerr : { printf( "user-defined function with bad args\n"); exit(-1); } break; case ASL_readerr_unavail : { printf( "user-defined function not available\n"); exit(-1); } break; case ASL_readerr_corrupt : { printf( "corrupt .nl file\n"); exit(-1); } break; case ASL_readerr_bug : { printf( "bug in .nl reader\n"); exit(-1); } break; case ASL_readerr_CLP : { printf( "ASL error message: \"solver cannot handle CLP extensions\"\n"); exit(-1); } break; default: { printf( "Unknown error in stub file read. retcode = %d\n", retcode); exit(-1); } break; } // see "changes" in solvers directory of ampl code... hesset(1, 0, 1, 0, nlc); assert (n_obj == 1); // find the nonzero structure for the hessian // parameters to sphsetup: int coeff_obj = 1; // coefficient of the objective fn ??? int mult_supplied = 1; // multipliers will be supplied int uptri = 1; // only need the upper triangular part // save asl // Fix memory leak one day ClpAmplInfo * info = new ClpAmplInfo; moreInfo_ = (void *) info; //amplGamsData_ = info; info->asl_ = (ASL_pfgh *) asl; // This is not easy to get from ampl so save info->nz_h_full_ = sphsetup(-1, coeff_obj, mult_supplied, uptri); info->objval_called_with_current_x_ = false; info->nerror_ = 0; info->obj_sign_ = direction; info->conval_called_with_current_x_ = false; info->non_const_x_ = NULL; info->jacval_called_with_current_x_ = false; // Look at nonlinear if (nzc) { n_conjac[1] = nlc; // just nonlinear int * rowStart = new int [nlc+1]; info->rowStart_ = rowStart; // See how many int current_nz = 0; for (int i = 0; i < nlc; i++) { for (cgrad* cg = Cgrad[i]; cg; cg = cg->next) { current_nz++; } } // setup the structure int * column = new int [current_nz]; info->column_ = column; current_nz = 0; rowStart[0] = 0; for (int i = 0; i < nlc; i++) { for (cgrad* cg = Cgrad[i]; cg; cg = cg->next) { cg->goff = current_nz; //iRow[cg->goff] = i ; //jCol[cg->goff] = cg->varno + 1; column[cg->goff] = cg->varno ; current_nz++; } rowStart[i+1] = current_nz; } info->gradient_ = new double [nzc]; info->constraintValues_ = new double [nlc]; } /* objective*/ objective = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) objective[i] = 0.0; if (n_obj) { for (og = Ograd[0]; og; og = og->next) objective[og->varno] = og->coef; } if (objtype[0]) direction = -1.0; else direction = 1.0; objectiveOffset_ = objconst(0); /* Column bounds*/ columnLower = (double *) malloc(n_var * sizeof(double)); columnUpper = (double *) malloc(n_var * sizeof(double)); for (i = 0; i < n_var; i++) { columnLower[i] = LUv[2*i]; if (columnLower[i] <= negInfinity) columnLower[i] = -COIN_DBL_MAX; columnUpper[i] = LUv[2*i+1]; if (columnUpper[i] >= Infinity) columnUpper[i] = COIN_DBL_MAX; } // Build by row from scratch //matrixByRow.reserve(n_var,nzc,true); // say row orderded matrixByRow.transpose(); CoinBigIndex * rowStart = new CoinBigIndex [n_con+1]; int * column = new int [nzc]; double * element = new double [nzc]; rowStart[0] = 0; numberElements = 0; /* Row bounds*/ rowLower = (double *) malloc(n_con * sizeof(double)); rowUpper = (double *) malloc(n_con * sizeof(double)); for (i = 0; i < n_con; i++) { rowLower[i] = LUrhs[2*i]; if (rowLower[i] <= negInfinity) rowLower[i] = -COIN_DBL_MAX; rowUpper[i] = LUrhs[2*i+1]; if (rowUpper[i] >= Infinity) rowUpper[i] = COIN_DBL_MAX; for (cgrad * cg = Cgrad[i]; cg; cg = cg->next) { column[numberElements] = cg->varno; double value = cg->coef; if (!value) value = -1.2345e-29; element[numberElements++] = value; } rowStart[i+1] = numberElements; } assert (numberElements == nzc); matrixByRow.appendRows(n_con, rowStart, column, element); delete [] rowStart; delete [] column; delete [] element; numberRows = n_con; numberColumns = n_var; numberElements = nzc; numberBinary = nbv; numberIntegers = niv; numberAllNonLinearBoth = nlvb; numberIntegerNonLinearBoth = nlvbi; numberAllNonLinearConstraints = nlvc; numberIntegerNonLinearConstraints = nlvci; numberAllNonLinearObjective = nlvo; numberIntegerNonLinearObjective = nlvoi; /* say we want primal solution */ want_xpi0 = 1; //double * dualSolution=NULL; } else { abort(); } // set problem name problemName_ = "???"; // Build by row from scratch const double * element = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); for (i = 0; i < numberRows; i++) { addRow(rowLength[i], column + rowStart[i], element + rowStart[i], rowLower[i], rowUpper[i]); } // Now do column part for (i = 0; i < numberColumns; i++) { setColumnBounds(i, columnLower[i], columnUpper[i]); setColumnObjective(i, objective[i]); } for ( i = numberColumns - numberBinary - numberIntegers; i < numberColumns; i++) { setColumnIsInteger(i, true); } // and non linear for (i = numberAllNonLinearBoth - numberIntegerNonLinearBoth; i < numberAllNonLinearBoth; i++) { setColumnIsInteger(i, true); } for (i = numberAllNonLinearConstraints - numberIntegerNonLinearConstraints; i < numberAllNonLinearConstraints; i++) { setColumnIsInteger(i, true); } for (i = numberAllNonLinearObjective - numberIntegerNonLinearObjective; i < numberAllNonLinearObjective; i++) { setColumnIsInteger(i, true); } free(columnLower); free(columnUpper); free(rowLower); free(rowUpper); free(objective); // do names int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { char name[9]; sprintf(name, "r%7.7d", iRow); setRowName(iRow, name); } int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { char name[9]; sprintf(name, "c%7.7d", iColumn); setColumnName(iColumn, name); } if (colqp) { // add in quadratic int nz = 1 + n_con; int nOdd = 0; fint ** rowqp = colqp + nz; double ** delsqp = (double **)(rowqp + nz); for (i = 0; i <= n_con; i++) { int nels = z[i]; if (nels) { double * element = delsqp[i]; int * start = (int *) colqp[i]; int * row = (int *) rowqp[i]; if (!element) { // odd row - probably not quadratic nOdd++; continue; } #ifdef JJF_ZERO printf("%d quadratic els\n", nels); for (int j = 0; j < n_var; j++) { for (int k = start[j]; k < start[j+1]; k++) printf("%d %d %g\n", j, row[k], element[k]); } #endif if (i) { int iRow = i - 1; for (int j = 0; j < n_var; j++) { for (int k = start[j]; k < start[j+1]; k++) { int kColumn = row[k]; double value = element[k]; // ampl gives twice with assumed 0.5 if (kColumn < j) continue; else if (kColumn == j) value *= 0.5; const char * expr = getElementAsString(iRow, j); double constant = 0.0; bool linear; if (expr && strcmp(expr, "Numeric")) { linear = false; } else { constant = getElement(iRow, j); linear = true; } char temp[1000]; char temp2[30]; if (value == 1.0) sprintf(temp2, "c%7.7d", kColumn); else sprintf(temp2, "%g*c%7.7d", value, kColumn); if (linear) { if (!constant) strcpy(temp, temp2); else if (value > 0.0) sprintf(temp, "%g+%s", constant, temp2); else sprintf(temp, "%g%s", constant, temp2); } else { if (value > 0.0) sprintf(temp, "%s+%s", expr, temp2); else sprintf(temp, "%s%s", expr, temp2); } assert (strlen(temp) < 1000); setElement(iRow, j, temp); if (amplInfo->logLevel > 1) printf("el for row %d column c%7.7d is %s\n", iRow, j, temp); } } } else { // objective for (int j = 0; j < n_var; j++) { for (int k = start[j]; k < start[j+1]; k++) { int kColumn = row[k]; double value = element[k]; // ampl gives twice with assumed 0.5 if (kColumn < j) continue; else if (kColumn == j) value *= 0.5; const char * expr = getColumnObjectiveAsString(j); double constant = 0.0; bool linear; if (expr && strcmp(expr, "Numeric")) { linear = false; } else { constant = getColumnObjective(j); linear = true; } char temp[1000]; char temp2[30]; if (value == 1.0) sprintf(temp2, "c%7.7d", kColumn); else sprintf(temp2, "%g*c%7.7d", value, kColumn); if (linear) { if (!constant) strcpy(temp, temp2); else if (value > 0.0) sprintf(temp, "%g+%s", constant, temp2); else sprintf(temp, "%g%s", constant, temp2); } else { if (value > 0.0) sprintf(temp, "%s+%s", expr, temp2); else sprintf(temp, "%s%s", expr, temp2); } assert (strlen(temp) < 1000); setObjective(j, temp); if (amplInfo->logLevel > 1) printf("el for objective column c%7.7d is %s\n", j, temp); } } } } } if (nOdd) { printf("%d non-linear constraints could not be converted to quadratic\n", nOdd); exit(77); } } free(colqp); free(z); // see if any sos { char *sostype; int nsosnz, *sosbeg, *sosind, * sospri; double *sosref; int nsos; int i = ASL_suf_sos_explict_free; int copri[2], **p_sospri; copri[0] = 0; copri[1] = 0; p_sospri = &sospri; nsos = suf_sos(i, &nsosnz, &sostype, p_sospri, copri, &sosbeg, &sosind, &sosref); if (nsos) { numberSOS_ = nsos; typeSOS_ = new int [numberSOS_]; prioritySOS_ = new int [numberSOS_]; startSOS_ = new int [numberSOS_+1]; memberSOS_ = new int[nsosnz]; referenceSOS_ = new double [nsosnz]; sos_kludge(nsos, sosbeg, sosref, sosind); for (int i = 0; i < nsos; i++) { int ichar = sostype[i]; assert (ichar == '1' || ichar == '2'); typeSOS_[i] = ichar - '0'; } memcpy(prioritySOS_, sospri, nsos*sizeof(int)); memcpy(startSOS_, sosbeg, (nsos + 1)*sizeof(int)); memcpy(memberSOS_, sosind, nsosnz*sizeof(int)); memcpy(referenceSOS_, sosref, nsosnz*sizeof(double)); } } } #else #include "Clp_ampl.h" int readAmpl(ampl_info * , int , char **, void ** ) { return 0; } void freeArrays1(ampl_info *) { } void freeArrays2(ampl_info *) { } void freeArgs(ampl_info * ) { } int ampl_obj_prec() { return 0; } void writeAmpl(ampl_info * ) { } #endif CoinMP-1.8.3/Clp/src/ClpCholeskyDense.hpp0000644000175000017500000001327612101105055016530 0ustar renerene/* $Id: ClpCholeskyDense.hpp 1910 2013-01-27 02:00:13Z stefan $ */ /* Copyright (C) 2003, International Business Machines Corporation and others. All Rights Reserved. This code is licensed under the terms of the Eclipse Public License (EPL). */ #ifndef ClpCholeskyDense_H #define ClpCholeskyDense_H #include "ClpCholeskyBase.hpp" class ClpMatrixBase; class ClpCholeskyDense : public ClpCholeskyBase { public: /**@name Virtual methods that the derived classes provides */ /**@{*/ /** Orders rows and saves pointer to matrix.and model. Returns non-zero if not enough memory */ virtual int order(ClpInterior * model) ; /** Does Symbolic factorization given permutation. This is called immediately after order. If user provides this then user must provide factorize and solve. Otherwise the default factorization is used returns non-zero if not enough memory */ virtual int symbolic(); /** Factorize - filling in rowsDropped and returning number dropped. If return code negative then out of memory */ virtual int factorize(const CoinWorkDouble * diagonal, int * rowsDropped) ; /** Uses factorization to solve. */ virtual void solve (CoinWorkDouble * region) ; /**@}*/ /**@name Non virtual methods for ClpCholeskyDense */ /**@{*/ /** Reserves space. If factor not NULL then just uses passed space Returns non-zero if not enough memory */ int reserveSpace(const ClpCholeskyBase * factor, int numberRows) ; /** Returns space needed */ CoinBigIndex space( int numberRows) const; /** part 2 of Factorize - filling in rowsDropped */ void factorizePart2(int * rowsDropped) ; /** part 2 of Factorize - filling in rowsDropped - blocked */ void factorizePart3(int * rowsDropped) ; /** Forward part of solve */ void solveF1(longDouble * a, int n, CoinWorkDouble * region); void solveF2(longDouble * a, int n, CoinWorkDouble * region, CoinWorkDouble * region2); /** Backward part of solve */ void solveB1(longDouble * a, int n, CoinWorkDouble * region); void solveB2(longDouble * a, int n, CoinWorkDouble * region, CoinWorkDouble * region2); int bNumber(const longDouble * array, int &, int&); /** A */ inline longDouble * aMatrix() const { return sparseFactor_; } /** Diagonal */ inline longDouble * diagonal() const { return diagonal_; } /**@}*/ /**@name Constructors, destructor */ /**@{*/ /** Default constructor. */ ClpCholeskyDense(); /** Destructor */ virtual ~ClpCholeskyDense(); /** Copy */ ClpCholeskyDense(const ClpCholeskyDense&); /** Assignment */ ClpCholeskyDense& operator=(const ClpCholeskyDense&); /** Clone */ virtual ClpCholeskyBase * clone() const ; /**@}*/ private: /**@name Data members */ /**@{*/ /** Just borrowing space */ bool borrowSpace_; /**@}*/ }; /* structure for C */ typedef struct { longDouble * diagonal_; longDouble * a; longDouble * work; int * rowsDropped; double doubleParameters_[1]; /* corresponds to 10 */ int integerParameters_[2]; /* corresponds to 34, nThreads */ int n; int numberBlocks; } ClpCholeskyDenseC; extern "C" { void ClpCholeskySpawn(void *); } /**Non leaf recursive factor */ void ClpCholeskyCfactor(ClpCholeskyDenseC * thisStruct, longDouble * a, int n, int numberBlocks, longDouble * diagonal, longDouble * work, int * rowsDropped); /**Non leaf recursive triangle rectangle update */ void ClpCholeskyCtriRec(ClpCholeskyDenseC * thisStruct, longDouble * aTri, int nThis, longDouble * aUnder, longDouble * diagonal, longDouble * work, int nLeft, int iBlock, int jBlock, int numberBlocks); /**Non leaf recursive rectangle triangle update */ void ClpCholeskyCrecTri(ClpCholeskyDenseC * thisStruct, longDouble * aUnder, int nTri, int nDo, int iBlock, int jBlock, longDouble * aTri, longDouble * diagonal, longDouble * work, int numberBlocks); /** Non leaf recursive rectangle rectangle update, nUnder is number of rows in iBlock, nUnderK is number of rows in kBlock */ void ClpCholeskyCrecRec(ClpCholeskyDenseC * thisStruct, longDouble * above, int nUnder, int nUnderK, int nDo, longDouble * aUnder, longDouble *aOther, longDouble * work, int iBlock, int jBlock, int numberBlocks); /**Leaf recursive factor */ void ClpCholeskyCfactorLeaf(ClpCholeskyDenseC * thisStruct, longDouble * a, int n, longDouble * diagonal, longDouble * work, int * rowsDropped); /**Leaf recursive triangle rectangle update */ void ClpCholeskyCtriRecLeaf(/*ClpCholeskyDenseC * thisStruct,*/ longDouble * aTri, longDouble * aUnder, longDouble * diagonal, longDouble * work, int nUnder); /**Leaf recursive rectangle triangle update */ void ClpCholeskyCrecTriLeaf(/*ClpCholeskyDenseC * thisStruct, */ longDouble * aUnder, longDouble * aTri, /*longDouble * diagonal,*/ longDouble * work, int nUnder); /** Leaf recursive rectangle rectangle update, nUnder is number of rows in iBlock, nUnderK is number of rows in kBlock */ void ClpCholeskyCrecRecLeaf(/*ClpCholeskyDenseC * thisStruct, */ const longDouble * COIN_RESTRICT above, const longDouble * COIN_RESTRICT aUnder, longDouble * COIN_RESTRICT aOther, const longDouble * COIN_RESTRICT work, int nUnder); #endif CoinMP-1.8.3/Clp/src/ClpSimplexOther.cpp0000644000175000017500000132613012501515412016411 0ustar renerene/* $Id: ClpSimplexOther.cpp 2128 2015-03-16 08:57:46Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "ClpSimplexOther.hpp" #include "ClpSimplexDual.hpp" #include "ClpSimplexPrimal.hpp" #include "ClpEventHandler.hpp" #include "ClpHelperFunctions.hpp" #include "ClpFactorization.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpNonLinearCost.hpp" #include "ClpDynamicMatrix.hpp" #include "CoinPackedMatrix.hpp" #include "CoinIndexedVector.hpp" #include "CoinBuild.hpp" #include "CoinMpsIO.hpp" #include "CoinFloatEqual.hpp" #include "ClpMessage.hpp" #include #include #include #include #include #ifdef INT_IS_8 #define COIN_ANY_BITS_PER_INT 64 #define COIN_ANY_SHIFT_PER_INT 6 #define COIN_ANY_MASK_PER_INT 0x3f #else #define COIN_ANY_BITS_PER_INT 32 #define COIN_ANY_SHIFT_PER_INT 5 #define COIN_ANY_MASK_PER_INT 0x1f #endif /* Dual ranging. This computes increase/decrease in cost for each given variable and corresponding sequence numbers which would change basis. Sequence numbers are 0..numberColumns and numberColumns.. for artificials/slacks. For non-basic variables the sequence number will be that of the non-basic variables. Up to user to provide correct length arrays. */ void ClpSimplexOther::dualRanging(int numberCheck, const int * which, double * costIncreased, int * sequenceIncreased, double * costDecreased, int * sequenceDecreased, double * valueIncrease, double * valueDecrease) { rowArray_[1]->clear(); columnArray_[1]->clear(); // long enough for rows+columns assert(rowArray_[3]->capacity() >= numberRows_ + numberColumns_); rowArray_[3]->clear(); int * backPivot = rowArray_[3]->getIndices(); int i; for ( i = 0; i < numberRows_ + numberColumns_; i++) { backPivot[i] = -1; } for (i = 0; i < numberRows_; i++) { int iSequence = pivotVariable_[i]; backPivot[iSequence] = i; } // dualTolerance may be zero if from CBC. In fact use that fact bool inCBC = !dualTolerance_; if (inCBC) assert (integerType_); dualTolerance_ = dblParam_[ClpDualTolerance]; double * arrayX = rowArray_[0]->denseVector(); for ( i = 0; i < numberCheck; i++) { rowArray_[0]->clear(); //rowArray_[0]->checkClear(); //rowArray_[1]->checkClear(); //columnArray_[1]->checkClear(); columnArray_[0]->clear(); //columnArray_[0]->checkClear(); int iSequence = which[i]; if (iSequence < 0) { costIncreased[i] = 0.0; sequenceIncreased[i] = -1; costDecreased[i] = 0.0; sequenceDecreased[i] = -1; continue; } double costIncrease = COIN_DBL_MAX; double costDecrease = COIN_DBL_MAX; int sequenceIncrease = -1; int sequenceDecrease = -1; if (valueIncrease) { assert (valueDecrease); valueIncrease[i] = iSequence < numberColumns_ ? columnActivity_[iSequence] : rowActivity_[iSequence-numberColumns_]; valueDecrease[i] = valueIncrease[i]; } switch(getStatus(iSequence)) { case basic: { // non-trvial // Get pivot row int iRow = backPivot[iSequence]; assert (iRow >= 0); #ifndef COIN_FAC_NEW double plusOne = 1.0; rowArray_[0]->createPacked(1, &iRow, &plusOne); #else rowArray_[0]->createOneUnpackedElement( iRow, 1.0); #endif factorization_->updateColumnTranspose(rowArray_[1], rowArray_[0]); // put row of tableau in rowArray[0] and columnArray[0] matrix_->transposeTimes(this, -1.0, rowArray_[0], columnArray_[1], columnArray_[0]); #ifdef COIN_FAC_NEW assert (!rowArray_[0]->packedMode()); #endif double alphaIncrease; double alphaDecrease; // do ratio test up and down checkDualRatios(rowArray_[0], columnArray_[0], costIncrease, sequenceIncrease, alphaIncrease, costDecrease, sequenceDecrease, alphaDecrease); if (!inCBC) { if (valueIncrease) { if (sequenceIncrease >= 0) valueIncrease[i] = primalRanging1(sequenceIncrease, iSequence); if (sequenceDecrease >= 0) valueDecrease[i] = primalRanging1(sequenceDecrease, iSequence); } } else { int number = rowArray_[0]->getNumElements(); #ifdef COIN_FAC_NEW const int * index = rowArray_[0]->getIndices(); #endif double scale2 = 0.0; int j; for (j = 0; j < number; j++) { #ifndef COIN_FAC_NEW scale2 += arrayX[j] * arrayX[j]; #else int iRow=index[j]; scale2 += arrayX[iRow] * arrayX[iRow]; #endif } scale2 = 1.0 / sqrt(scale2); //valueIncrease[i] = scale2; if (sequenceIncrease >= 0) { double djValue = dj_[sequenceIncrease]; if (fabs(djValue) > 10.0 * dualTolerance_) { // we are going to use for cutoff so be exact costIncrease = fabs(djValue / alphaIncrease); /* Not sure this is good idea as I don't think correct e.g. suppose a continuous variable has dj slightly greater. */ if(false && sequenceIncrease < numberColumns_ && integerType_[sequenceIncrease]) { // can improve double movement = (columnScale_ == NULL) ? 1.0 : rhsScale_ * inverseColumnScale_[sequenceIncrease]; costIncrease = CoinMax(fabs(djValue * movement), costIncrease); } } else { costIncrease = 0.0; } } if (sequenceDecrease >= 0) { double djValue = dj_[sequenceDecrease]; if (fabs(djValue) > 10.0 * dualTolerance_) { // we are going to use for cutoff so be exact costDecrease = fabs(djValue / alphaDecrease); if(sequenceDecrease < numberColumns_ && integerType_[sequenceDecrease]) { // can improve double movement = (columnScale_ == NULL) ? 1.0 : rhsScale_ * inverseColumnScale_[sequenceDecrease]; costDecrease = CoinMax(fabs(djValue * movement), costDecrease); } } else { costDecrease = 0.0; } } costIncrease *= scale2; costDecrease *= scale2; } } break; case isFixed: break; case isFree: case superBasic: costIncrease = 0.0; costDecrease = 0.0; sequenceIncrease = iSequence; sequenceDecrease = iSequence; break; case atUpperBound: costIncrease = CoinMax(0.0, -dj_[iSequence]); sequenceIncrease = iSequence; if (valueIncrease) valueIncrease[i] = primalRanging1(iSequence, iSequence); break; case atLowerBound: costDecrease = CoinMax(0.0, dj_[iSequence]); sequenceDecrease = iSequence; if (valueIncrease) valueDecrease[i] = primalRanging1(iSequence, iSequence); break; } double scaleFactor; if (rowScale_) { if (iSequence < numberColumns_) scaleFactor = 1.0 / (objectiveScale_ * columnScale_[iSequence]); else scaleFactor = rowScale_[iSequence-numberColumns_] / objectiveScale_; } else { scaleFactor = 1.0 / objectiveScale_; } if (costIncrease < 1.0e30) costIncrease *= scaleFactor; if (costDecrease < 1.0e30) costDecrease *= scaleFactor; if (optimizationDirection_ == 1.0) { costIncreased[i] = costIncrease; sequenceIncreased[i] = sequenceIncrease; costDecreased[i] = costDecrease; sequenceDecreased[i] = sequenceDecrease; } else if (optimizationDirection_ == -1.0) { costIncreased[i] = costDecrease; sequenceIncreased[i] = sequenceDecrease; costDecreased[i] = costIncrease; sequenceDecreased[i] = sequenceIncrease; if (valueIncrease) { double temp = valueIncrease[i]; valueIncrease[i] = valueDecrease[i]; valueDecrease[i] = temp; } } else if (optimizationDirection_ == 0.0) { // !!!!!! ??? costIncreased[i] = COIN_DBL_MAX; sequenceIncreased[i] = -1; costDecreased[i] = COIN_DBL_MAX; sequenceDecreased[i] = -1; } else { abort(); } } rowArray_[0]->clear(); //rowArray_[1]->clear(); //columnArray_[1]->clear(); columnArray_[0]->clear(); //rowArray_[3]->clear(); if (!optimizationDirection_) printf("*** ????? Ranging with zero optimization costs\n"); } /* Row array has row part of pivot row Column array has column part. This is used in dual ranging */ void ClpSimplexOther::checkDualRatios(CoinIndexedVector * rowArray, CoinIndexedVector * columnArray, double & costIncrease, int & sequenceIncrease, double & alphaIncrease, double & costDecrease, int & sequenceDecrease, double & alphaDecrease) { double acceptablePivot = 1.0e-9; double * work; int number; int * which; int iSection; double thetaDown = 1.0e31; double thetaUp = 1.0e31; int sequenceDown = -1; int sequenceUp = -1; double alphaDown = 0.0; double alphaUp = 0.0; int addSequence; for (iSection = 0; iSection < 2; iSection++) { int i; if (!iSection) { work = rowArray->denseVector(); number = rowArray->getNumElements(); which = rowArray->getIndices(); addSequence = numberColumns_; } else { work = columnArray->denseVector(); number = columnArray->getNumElements(); which = columnArray->getIndices(); addSequence = 0; } for (i = 0; i < number; i++) { int iSequence = which[i]; int iSequence2 = iSequence + addSequence; #ifndef COIN_FAC_NEW double alpha = work[i]; #else double alpha = !addSequence ? work[i] : work[iSequence]; #endif if (fabs(alpha) < acceptablePivot) continue; double oldValue = dj_[iSequence2]; switch(getStatus(iSequence2)) { case basic: break; case ClpSimplex::isFixed: break; case isFree: case superBasic: // treat dj as if zero thetaDown = 0.0; thetaUp = 0.0; sequenceDown = iSequence2; sequenceUp = iSequence2; break; case atUpperBound: if (alpha > 0.0) { // test up if (oldValue + thetaUp * alpha > dualTolerance_) { thetaUp = (dualTolerance_ - oldValue) / alpha; sequenceUp = iSequence2; alphaUp = alpha; } } else { // test down if (oldValue - thetaDown * alpha > dualTolerance_) { thetaDown = -(dualTolerance_ - oldValue) / alpha; sequenceDown = iSequence2; alphaDown = alpha; } } break; case atLowerBound: if (alpha < 0.0) { // test up if (oldValue + thetaUp * alpha < - dualTolerance_) { thetaUp = -(dualTolerance_ + oldValue) / alpha; sequenceUp = iSequence2; alphaUp = alpha; } } else { // test down if (oldValue - thetaDown * alpha < -dualTolerance_) { thetaDown = (dualTolerance_ + oldValue) / alpha; sequenceDown = iSequence2; alphaDown = alpha; } } break; } } } if (sequenceUp >= 0) { costIncrease = thetaUp; sequenceIncrease = sequenceUp; alphaIncrease = alphaUp; } if (sequenceDown >= 0) { costDecrease = thetaDown; sequenceDecrease = sequenceDown; alphaDecrease = alphaDown; } } /** Primal ranging. This computes increase/decrease in value for each given variable and corresponding sequence numbers which would change basis. Sequence numbers are 0..numberColumns and numberColumns.. for artificials/slacks. For basic variables the sequence number will be that of the basic variables. Up to user to provide correct length arrays. When here - guaranteed optimal */ void ClpSimplexOther::primalRanging(int numberCheck, const int * which, double * valueIncreased, int * sequenceIncreased, double * valueDecreased, int * sequenceDecreased) { rowArray_[0]->clear(); rowArray_[1]->clear(); lowerIn_ = -COIN_DBL_MAX; upperIn_ = COIN_DBL_MAX; valueIn_ = 0.0; for ( int i = 0; i < numberCheck; i++) { int iSequence = which[i]; double valueIncrease = COIN_DBL_MAX; double valueDecrease = COIN_DBL_MAX; int sequenceIncrease = -1; int sequenceDecrease = -1; switch(getStatus(iSequence)) { case basic: case isFree: case superBasic: // Easy valueDecrease = CoinMax(0.0, upper_[iSequence] - solution_[iSequence]); valueIncrease = CoinMax(0.0, solution_[iSequence] - lower_[iSequence]); sequenceDecrease = iSequence; sequenceIncrease = iSequence; break; case isFixed: case atUpperBound: case atLowerBound: { // Non trivial // Other bound is ignored #ifndef COIN_FAC_NEW unpackPacked(rowArray_[1], iSequence); #else unpack(rowArray_[1], iSequence); #endif factorization_->updateColumn(rowArray_[2], rowArray_[1]); // Get extra rows matrix_->extendUpdated(this, rowArray_[1], 0); // do ratio test checkPrimalRatios(rowArray_[1], 1); if (pivotRow_ >= 0) { valueIncrease = theta_; sequenceIncrease = pivotVariable_[pivotRow_]; } checkPrimalRatios(rowArray_[1], -1); if (pivotRow_ >= 0) { valueDecrease = theta_; sequenceDecrease = pivotVariable_[pivotRow_]; } rowArray_[1]->clear(); } break; } double scaleFactor; if (rowScale_) { if (iSequence < numberColumns_) scaleFactor = columnScale_[iSequence] / rhsScale_; else scaleFactor = 1.0 / (rowScale_[iSequence-numberColumns_] * rhsScale_); } else { scaleFactor = 1.0 / rhsScale_; } if (valueIncrease < 1.0e30) valueIncrease *= scaleFactor; else valueIncrease = COIN_DBL_MAX; if (valueDecrease < 1.0e30) valueDecrease *= scaleFactor; else valueDecrease = COIN_DBL_MAX; valueIncreased[i] = valueIncrease; sequenceIncreased[i] = sequenceIncrease; valueDecreased[i] = valueDecrease; sequenceDecreased[i] = sequenceDecrease; } } // Returns new value of whichOther when whichIn enters basis double ClpSimplexOther::primalRanging1(int whichIn, int whichOther) { rowArray_[0]->clear(); rowArray_[1]->clear(); int iSequence = whichIn; double newValue = solution_[whichOther]; double alphaOther = 0.0; Status status = getStatus(iSequence); assert (status == atLowerBound || status == atUpperBound); int wayIn = (status == atLowerBound) ? 1 : -1; switch(getStatus(iSequence)) { case basic: case isFree: case superBasic: assert (whichIn == whichOther); // Easy newValue = wayIn > 0 ? upper_[iSequence] : lower_[iSequence]; break; case isFixed: case atUpperBound: case atLowerBound: // Non trivial { // Other bound is ignored #ifndef COIN_FAC_NEW unpackPacked(rowArray_[1], iSequence); #else unpack(rowArray_[1], iSequence); #endif factorization_->updateColumn(rowArray_[2], rowArray_[1]); // Get extra rows matrix_->extendUpdated(this, rowArray_[1], 0); // do ratio test double acceptablePivot = 1.0e-7; double * work = rowArray_[1]->denseVector(); int number = rowArray_[1]->getNumElements(); int * which = rowArray_[1]->getIndices(); // we may need to swap sign double way = wayIn; double theta = 1.0e30; for (int iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; #ifndef COIN_FAC_NEW double alpha = work[iIndex] * way; #else double alpha = work[iRow] * way; #endif int iPivot = pivotVariable_[iRow]; if (iPivot == whichOther) { alphaOther = alpha; continue; } double oldValue = solution_[iPivot]; if (fabs(alpha) > acceptablePivot) { if (alpha > 0.0) { // basic variable going towards lower bound double bound = lower_[iPivot]; oldValue -= bound; if (oldValue - theta * alpha < 0.0) { theta = CoinMax(0.0, oldValue / alpha); } } else { // basic variable going towards upper bound double bound = upper_[iPivot]; oldValue = oldValue - bound; if (oldValue - theta * alpha > 0.0) { theta = CoinMax(0.0, oldValue / alpha); } } } } if (whichIn != whichOther) { if (theta < 1.0e30) newValue -= theta * alphaOther; else newValue = alphaOther > 0.0 ? -1.0e30 : 1.0e30; } else { newValue += theta * wayIn; } } rowArray_[1]->clear(); break; } double scaleFactor; if (rowScale_) { if (whichOther < numberColumns_) scaleFactor = columnScale_[whichOther] / rhsScale_; else scaleFactor = 1.0 / (rowScale_[whichOther-numberColumns_] * rhsScale_); } else { scaleFactor = 1.0 / rhsScale_; } if (newValue < 1.0e29) if (newValue > -1.0e29) newValue *= scaleFactor; else newValue = -COIN_DBL_MAX; else newValue = COIN_DBL_MAX; return newValue; } /* Row array has pivot column This is used in primal ranging */ void ClpSimplexOther::checkPrimalRatios(CoinIndexedVector * rowArray, int direction) { // sequence stays as row number until end pivotRow_ = -1; double acceptablePivot = 1.0e-7; double * work = rowArray->denseVector(); int number = rowArray->getNumElements(); int * which = rowArray->getIndices(); // we need to swap sign if going down double way = direction; theta_ = 1.0e30; for (int iIndex = 0; iIndex < number; iIndex++) { int iRow = which[iIndex]; #ifndef COIN_FAC_NEW double alpha = work[iIndex] * way; #else double alpha = work[iRow] * way; #endif int iPivot = pivotVariable_[iRow]; double oldValue = solution_[iPivot]; if (fabs(alpha) > acceptablePivot) { if (alpha > 0.0) { // basic variable going towards lower bound double bound = lower_[iPivot]; oldValue -= bound; if (oldValue - theta_ * alpha < 0.0) { pivotRow_ = iRow; theta_ = CoinMax(0.0, oldValue / alpha); } } else { // basic variable going towards upper bound double bound = upper_[iPivot]; oldValue = oldValue - bound; if (oldValue - theta_ * alpha > 0.0) { pivotRow_ = iRow; theta_ = CoinMax(0.0, oldValue / alpha); } } } } } /* Write the basis in MPS format to the specified file. If writeValues true writes values of structurals (and adds VALUES to end of NAME card) Row and column names may be null. formatType is
    • 0 - normal
    • 1 - extra accuracy
    • 2 - IEEE hex (later)
    Returns non-zero on I/O error This is based on code contributed by Thorsten Koch */ int ClpSimplexOther::writeBasis(const char *filename, bool writeValues, int formatType) const { formatType = CoinMax(0, formatType); formatType = CoinMin(2, formatType); if (!writeValues) formatType = 0; // See if INTEL if IEEE if (formatType == 2) { // test intel here and add 1 if not intel double value = 1.0; char x[8]; memcpy(x, &value, 8); if (x[0] == 63) { formatType ++; // not intel } else { assert (x[0] == 0); } } char number[20]; FILE * fp = fopen(filename, "w"); if (!fp) return -1; // NAME card if (strcmp(strParam_[ClpProbName].c_str(), "") == 0) { fprintf(fp, "NAME BLANK "); } else { fprintf(fp, "NAME %s ", strParam_[ClpProbName].c_str()); } if (formatType >= 2) fprintf(fp, "FREEIEEE"); else if (writeValues) fprintf(fp, "VALUES"); // finish off name fprintf(fp, "\n"); int iRow = 0; for(int iColumn = 0; iColumn < numberColumns_; iColumn++) { bool printit = false; if( getColumnStatus(iColumn) == ClpSimplex::basic) { printit = true; // Find non basic row for(; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) != ClpSimplex::basic) break; } if (lengthNames_) { if (iRow != numberRows_) { fprintf(fp, " %s %-8s %s", getRowStatus(iRow) == ClpSimplex::atUpperBound ? "XU" : "XL", columnNames_[iColumn].c_str(), rowNames_[iRow].c_str()); iRow++; } else { // Allow for too many basics! fprintf(fp, " BS %-8s ", columnNames_[iColumn].c_str()); // Dummy row name if values if (writeValues) fprintf(fp, " _dummy_"); } } else { // no names if (iRow != numberRows_) { fprintf(fp, " %s C%7.7d R%7.7d", getRowStatus(iRow) == ClpSimplex::atUpperBound ? "XU" : "XL", iColumn, iRow); iRow++; } else { // Allow for too many basics! fprintf(fp, " BS C%7.7d", iColumn); // Dummy row name if values if (writeValues) fprintf(fp, " _dummy_"); } } } else { if( getColumnStatus(iColumn) == ClpSimplex::atUpperBound) { printit = true; if (lengthNames_) fprintf(fp, " UL %s", columnNames_[iColumn].c_str()); else fprintf(fp, " UL C%7.7d", iColumn); // Dummy row name if values if (writeValues) fprintf(fp, " _dummy_"); } else if( (getColumnStatus(iColumn) == ClpSimplex::superBasic|| getColumnStatus(iColumn) == ClpSimplex::isFree)&& writeValues) { printit = true; if (lengthNames_) fprintf(fp, " BS %s", columnNames_[iColumn].c_str()); else fprintf(fp, " BS C%7.7d", iColumn); // Dummy row name if values if (writeValues) fprintf(fp, " _dummy_"); } } if (printit && writeValues) { // add value CoinConvertDouble(0, formatType, columnActivity_[iColumn], number); fprintf(fp, " %s", number); } if (printit) fprintf(fp, "\n"); } fprintf(fp, "ENDATA\n"); fclose(fp); return 0; } // Read a basis from the given filename int ClpSimplexOther::readBasis(const char *fileName) { int status = 0; if (strcmp(fileName, "-") != 0 && strcmp(fileName, "stdin") != 0) { FILE *fp = fopen(fileName, "r"); if (fp) { // can open - lets go for it fclose(fp); } else { handler_->message(CLP_UNABLE_OPEN, messages_) << fileName << CoinMessageEol; return -1; } } CoinMpsIO m; m.passInMessageHandler(handler_); *m.messagesPointer() = coinMessages(); bool savePrefix = m.messageHandler()->prefix(); m.messageHandler()->setPrefix(handler_->prefix()); status = m.readBasis(fileName, "", columnActivity_, status_ + numberColumns_, status_, columnNames_, numberColumns_, rowNames_, numberRows_); m.messageHandler()->setPrefix(savePrefix); if (status >= 0) { if (!status) { // set values int iColumn, iRow; for (iRow = 0; iRow < numberRows_; iRow++) { if (getRowStatus(iRow) == atLowerBound) rowActivity_[iRow] = rowLower_[iRow]; else if (getRowStatus(iRow) == atUpperBound) rowActivity_[iRow] = rowUpper_[iRow]; } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (getColumnStatus(iColumn) == atLowerBound) columnActivity_[iColumn] = columnLower_[iColumn]; else if (getColumnStatus(iColumn) == atUpperBound) columnActivity_[iColumn] = columnUpper_[iColumn]; } } else { memset(rowActivity_, 0, numberRows_ * sizeof(double)); matrix_->times(-1.0, columnActivity_, rowActivity_); } } else { // errors handler_->message(CLP_IMPORT_ERRORS, messages_) << status << fileName << CoinMessageEol; } return status; } /* Creates dual of a problem if looks plausible (defaults will always create model) fractionRowRanges is fraction of rows allowed to have ranges fractionColumnRanges is fraction of columns allowed to have ranges */ ClpSimplex * ClpSimplexOther::dualOfModel(double fractionRowRanges, double fractionColumnRanges) const { const ClpSimplex * model2 = static_cast (this); bool changed = false; int numberChanged = 0; int numberFreeColumnsInPrimal=0; int iColumn; // check if we need to change bounds to rows for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (columnUpper_[iColumn] < 1.0e20) { if (columnLower_[iColumn] > -1.0e20) { changed = true; numberChanged++; } } else if (columnLower_[iColumn] < -1.0e20) { numberFreeColumnsInPrimal++; } } int iRow; int numberExtraRows = 0; int numberFreeColumnsInDual=0; if (numberChanged <= fractionColumnRanges * numberColumns_) { for (iRow = 0; iRow < numberRows_; iRow++) { if (rowLower_[iRow] > -1.0e20 && rowUpper_[iRow] < 1.0e20) { if (rowUpper_[iRow] != rowLower_[iRow]) numberExtraRows++; else numberFreeColumnsInDual++; } } if (numberExtraRows > fractionRowRanges * numberRows_) return NULL; } else { return NULL; } printf("would have %d free columns in primal, %d in dual\n", numberFreeColumnsInPrimal,numberFreeColumnsInDual); if (4*(numberFreeColumnsInDual-numberFreeColumnsInPrimal)> numberColumns_&&fractionRowRanges<1.0) return NULL; //dangerous (well anyway in dual) if (changed) { ClpSimplex * model3 = new ClpSimplex(*model2); CoinBuild build; double one = 1.0; int numberColumns = model3->numberColumns(); const double * columnLower = model3->columnLower(); const double * columnUpper = model3->columnUpper(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] < 1.0e20 && columnLower[iColumn] > -1.0e20) { if (fabs(columnLower[iColumn]) < fabs(columnUpper[iColumn])) { double value = columnUpper[iColumn]; model3->setColumnUpper(iColumn, COIN_DBL_MAX); build.addRow(1, &iColumn, &one, -COIN_DBL_MAX, value); } else { double value = columnLower[iColumn]; model3->setColumnLower(iColumn, -COIN_DBL_MAX); build.addRow(1, &iColumn, &one, value, COIN_DBL_MAX); } } } model3->addRows(build); model2 = model3; } int numberColumns = model2->numberColumns(); const double * columnLower = model2->columnLower(); const double * columnUpper = model2->columnUpper(); int numberRows = model2->numberRows(); double * rowLower = CoinCopyOfArray(model2->rowLower(), numberRows); double * rowUpper = CoinCopyOfArray(model2->rowUpper(), numberRows); const double * objective = model2->objective(); CoinPackedMatrix * matrix = model2->matrix(); // get transpose CoinPackedMatrix rowCopy = *matrix; const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); double objOffset = 0.0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double offset = 0.0; double objValue = optimizationDirection_ * objective[iColumn]; if (columnUpper[iColumn] > 1.0e20) { if (columnLower[iColumn] > -1.0e20) offset = columnLower[iColumn]; } else if (columnLower[iColumn] < -1.0e20) { offset = columnUpper[iColumn]; } else { // taken care of before abort(); } if (offset) { objOffset += offset * objValue; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (rowLower[iRow] > -1.0e20) rowLower[iRow] -= offset * elementByColumn[j]; if (rowUpper[iRow] < 1.0e20) rowUpper[iRow] -= offset * elementByColumn[j]; } } } int * which = new int[numberRows+numberExtraRows]; rowCopy.reverseOrdering(); rowCopy.transpose(); double * fromRowsLower = new double[numberRows+numberExtraRows]; double * fromRowsUpper = new double[numberRows+numberExtraRows]; double * newObjective = new double[numberRows+numberExtraRows]; double * fromColumnsLower = new double[numberColumns]; double * fromColumnsUpper = new double[numberColumns]; for (iColumn = 0; iColumn < numberColumns; iColumn++) { double objValue = optimizationDirection_ * objective[iColumn]; // Offset is already in if (columnUpper[iColumn] > 1.0e20) { if (columnLower[iColumn] > -1.0e20) { fromColumnsLower[iColumn] = -COIN_DBL_MAX; fromColumnsUpper[iColumn] = objValue; } else { // free fromColumnsLower[iColumn] = objValue; fromColumnsUpper[iColumn] = objValue; } } else if (columnLower[iColumn] < -1.0e20) { fromColumnsLower[iColumn] = objValue; fromColumnsUpper[iColumn] = COIN_DBL_MAX; } else { abort(); } } int kRow = 0; int kExtraRow = numberRows; for (iRow = 0; iRow < numberRows; iRow++) { if (rowLower[iRow] < -1.0e20) { assert (rowUpper[iRow] < 1.0e20); newObjective[kRow] = -rowUpper[iRow]; fromRowsLower[kRow] = -COIN_DBL_MAX; fromRowsUpper[kRow] = 0.0; which[kRow] = iRow; kRow++; } else if (rowUpper[iRow] > 1.0e20) { newObjective[kRow] = -rowLower[iRow]; fromRowsLower[kRow] = 0.0; fromRowsUpper[kRow] = COIN_DBL_MAX; which[kRow] = iRow; kRow++; } else { if (rowUpper[iRow] == rowLower[iRow]) { newObjective[kRow] = -rowLower[iRow]; fromRowsLower[kRow] = -COIN_DBL_MAX;; fromRowsUpper[kRow] = COIN_DBL_MAX; which[kRow] = iRow; kRow++; } else { // range newObjective[kRow] = -rowUpper[iRow]; fromRowsLower[kRow] = -COIN_DBL_MAX; fromRowsUpper[kRow] = 0.0; which[kRow] = iRow; kRow++; newObjective[kExtraRow] = -rowLower[iRow]; fromRowsLower[kExtraRow] = 0.0; fromRowsUpper[kExtraRow] = COIN_DBL_MAX; which[kExtraRow] = iRow; kExtraRow++; } } } if (numberExtraRows) { CoinPackedMatrix newCopy; newCopy.setExtraGap(0.0); newCopy.setExtraMajor(0.0); newCopy.submatrixOfWithDuplicates(rowCopy, kExtraRow, which); rowCopy = newCopy; } ClpSimplex * modelDual = new ClpSimplex(); modelDual->loadProblem(rowCopy, fromRowsLower, fromRowsUpper, newObjective, fromColumnsLower, fromColumnsUpper); modelDual->setObjectiveOffset(objOffset); modelDual->setDualBound(model2->dualBound()); modelDual->setInfeasibilityCost(model2->infeasibilityCost()); modelDual->setDualTolerance(model2->dualTolerance()); modelDual->setPrimalTolerance(model2->primalTolerance()); modelDual->setPerturbation(model2->perturbation()); modelDual->setSpecialOptions(model2->specialOptions()); modelDual->setMoreSpecialOptions(model2->moreSpecialOptions()); modelDual->setMaximumIterations(model2->maximumIterations()); modelDual->setFactorizationFrequency(model2->factorizationFrequency()); modelDual->setLogLevel(model2->logLevel()); delete [] fromRowsLower; delete [] fromRowsUpper; delete [] fromColumnsLower; delete [] fromColumnsUpper; delete [] newObjective; delete [] which; delete [] rowLower; delete [] rowUpper; if (changed) delete model2; modelDual->createStatus(); return modelDual; } // Restores solution from dualized problem int ClpSimplexOther::restoreFromDual(const ClpSimplex * dualProblem, bool checkAccuracy) { int returnCode = 0;; createStatus(); // Number of rows in dual problem was original number of columns assert (numberColumns_ == dualProblem->numberRows()); // If slack on d-row basic then column at bound otherwise column basic // If d-column basic then rhs tight int numberBasic = 0; int iRow, iColumn = 0; // Get number of extra rows from ranges int numberExtraRows = 0; for (iRow = 0; iRow < numberRows_; iRow++) { if (rowLower_[iRow] > -1.0e20 && rowUpper_[iRow] < 1.0e20) { if (rowUpper_[iRow] != rowLower_[iRow]) numberExtraRows++; } } const double * objective = this->objective(); const double * dualDual = dualProblem->dualRowSolution(); const double * dualDj = dualProblem->dualColumnSolution(); const double * dualSol = dualProblem->primalColumnSolution(); const double * dualActs = dualProblem->primalRowSolution(); #if 0 ClpSimplex thisCopy = *this; thisCopy.dual(); // for testing const double * primalDual = thisCopy.dualRowSolution(); const double * primalDj = thisCopy.dualColumnSolution(); const double * primalSol = thisCopy.primalColumnSolution(); const double * primalActs = thisCopy.primalRowSolution(); char ss[] = {'F', 'B', 'U', 'L', 'S', 'F'}; printf ("Dual problem row info %d rows\n", dualProblem->numberRows()); for (iRow = 0; iRow < dualProblem->numberRows(); iRow++) printf("%d at %c primal %g dual %g\n", iRow, ss[dualProblem->getRowStatus(iRow)], dualActs[iRow], dualDual[iRow]); printf ("Dual problem column info %d columns\n", dualProblem->numberColumns()); for (iColumn = 0; iColumn < dualProblem->numberColumns(); iColumn++) printf("%d at %c primal %g dual %g\n", iColumn, ss[dualProblem->getColumnStatus(iColumn)], dualSol[iColumn], dualDj[iColumn]); printf ("Primal problem row info %d rows\n", thisCopy.numberRows()); for (iRow = 0; iRow < thisCopy.numberRows(); iRow++) printf("%d at %c primal %g dual %g\n", iRow, ss[thisCopy.getRowStatus(iRow)], primalActs[iRow], primalDual[iRow]); printf ("Primal problem column info %d columns\n", thisCopy.numberColumns()); for (iColumn = 0; iColumn < thisCopy.numberColumns(); iColumn++) printf("%d at %c primal %g dual %g\n", iColumn, ss[thisCopy.getColumnStatus(iColumn)], primalSol[iColumn], primalDj[iColumn]); #endif // position at bound information int jColumn = numberRows_; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double objValue = optimizationDirection_ * objective[iColumn]; Status status = dualProblem->getRowStatus(iColumn); double otherValue = COIN_DBL_MAX; if (columnUpper_[iColumn] < 1.0e20 && columnLower_[iColumn] > -1.0e20) { if (fabs(columnLower_[iColumn]) < fabs(columnUpper_[iColumn])) { otherValue = columnUpper_[iColumn] + dualDj[jColumn]; } else { otherValue = columnLower_[iColumn] + dualDj[jColumn]; } jColumn++; } if (status == basic) { // column is at bound if (otherValue == COIN_DBL_MAX) { reducedCost_[iColumn] = objValue - dualActs[iColumn]; if (columnUpper_[iColumn] > 1.0e20) { if (columnLower_[iColumn] > -1.0e20) { if (columnUpper_[iColumn] > columnLower_[iColumn]) setColumnStatus(iColumn, atLowerBound); else setColumnStatus(iColumn, isFixed); columnActivity_[iColumn] = columnLower_[iColumn]; } else { // free setColumnStatus(iColumn, isFree); columnActivity_[iColumn] = 0.0; } } else { setColumnStatus(iColumn, atUpperBound); columnActivity_[iColumn] = columnUpper_[iColumn]; } } else { reducedCost_[iColumn] = objValue - dualActs[iColumn]; //printf("other dual sol %g\n",otherValue); if (fabs(otherValue - columnLower_[iColumn]) < 1.0e-5) { if (columnUpper_[iColumn] > columnLower_[iColumn]) setColumnStatus(iColumn, atLowerBound); else setColumnStatus(iColumn, isFixed); columnActivity_[iColumn] = columnLower_[iColumn]; } else if (fabs(otherValue - columnUpper_[iColumn]) < 1.0e-5) { if (columnUpper_[iColumn] > columnLower_[iColumn]) setColumnStatus(iColumn, atUpperBound); else setColumnStatus(iColumn, isFixed); columnActivity_[iColumn] = columnUpper_[iColumn]; } else { setColumnStatus(iColumn, superBasic); columnActivity_[iColumn] = otherValue; } } } else { if (otherValue == COIN_DBL_MAX) { // column basic setColumnStatus(iColumn, basic); numberBasic++; if (columnLower_[iColumn] > -1.0e20) { columnActivity_[iColumn] = -dualDual[iColumn] + columnLower_[iColumn]; } else if (columnUpper_[iColumn] < 1.0e20) { columnActivity_[iColumn] = -dualDual[iColumn] + columnUpper_[iColumn]; } else { columnActivity_[iColumn] = -dualDual[iColumn]; } reducedCost_[iColumn] = 0.0; } else { // may be at other bound //printf("xx %d %g jcol %d\n",iColumn,otherValue,jColumn-1); if (dualProblem->getColumnStatus(jColumn - 1) != basic) { // column basic setColumnStatus(iColumn, basic); numberBasic++; //printf("Col %d otherV %g dualDual %g\n",iColumn, // otherValue,dualDual[iColumn]); columnActivity_[iColumn] = -dualDual[iColumn]; columnActivity_[iColumn] = otherValue; reducedCost_[iColumn] = 0.0; } else { reducedCost_[iColumn] = objValue - dualActs[iColumn]; if (fabs(otherValue - columnLower_[iColumn]) < 1.0e-5) { if (columnUpper_[iColumn] > columnLower_[iColumn]) setColumnStatus(iColumn, atLowerBound); else setColumnStatus(iColumn, isFixed); columnActivity_[iColumn] = columnLower_[iColumn]; } else if (fabs(otherValue - columnUpper_[iColumn]) < 1.0e-5) { if (columnUpper_[iColumn] > columnLower_[iColumn]) setColumnStatus(iColumn, atUpperBound); else setColumnStatus(iColumn, isFixed); columnActivity_[iColumn] = columnUpper_[iColumn]; } else { setColumnStatus(iColumn, superBasic); columnActivity_[iColumn] = otherValue; } } } } } // now rows int kExtraRow = jColumn; int numberRanges = 0; for (iRow = 0; iRow < numberRows_; iRow++) { Status status = dualProblem->getColumnStatus(iRow); if (status == basic) { // row is at bound dual_[iRow] = dualSol[iRow];; } else { // row basic setRowStatus(iRow, basic); numberBasic++; dual_[iRow] = 0.0; } if (rowLower_[iRow] < -1.0e20) { if (status == basic) { rowActivity_[iRow] = rowUpper_[iRow]; setRowStatus(iRow, atUpperBound); } else { // might be stopped assert (dualDj[iRow] < 1.0e-5); rowActivity_[iRow] = rowUpper_[iRow] + dualDj[iRow]; } } else if (rowUpper_[iRow] > 1.0e20) { if (status == basic) { rowActivity_[iRow] = rowLower_[iRow]; setRowStatus(iRow, atLowerBound); } else { rowActivity_[iRow] = rowLower_[iRow] + dualDj[iRow]; // might be stopped assert (dualDj[iRow] > -1.0e-5); } } else { if (rowUpper_[iRow] == rowLower_[iRow]) { rowActivity_[iRow] = rowLower_[iRow]; if (status == basic) { setRowStatus(iRow, isFixed); } } else { // range numberRanges++; Status statusL = dualProblem->getColumnStatus(kExtraRow); //printf("range row %d (%d), extra %d (%d) - dualSol %g,%g dualDj %g,%g\n", // iRow,status,kExtraRow,statusL, dualSol[iRow], // dualSol[kExtraRow],dualDj[iRow],dualDj[kExtraRow]); if (status == basic) { // might be stopped assert (statusL != basic); rowActivity_[iRow] = rowUpper_[iRow]; setRowStatus(iRow, atUpperBound); } else if (statusL == basic) { numberBasic--; // already counted rowActivity_[iRow] = rowLower_[iRow]; setRowStatus(iRow, atLowerBound); dual_[iRow] = dualSol[kExtraRow];; } else { rowActivity_[iRow] = rowLower_[iRow] - dualDj[iRow]; // might be stopped assert (dualDj[iRow] < 1.0e-5); // row basic //setRowStatus(iRow,basic); //numberBasic++; dual_[iRow] = 0.0; } kExtraRow++; } } } if (numberBasic != numberRows_) { printf("Bad basis - ranges - coding needed\n"); assert (numberRanges); abort(); } if (optimizationDirection_ < 0.0) { for (iRow = 0; iRow < numberRows_; iRow++) { dual_[iRow] = -dual_[iRow]; } } // redo row activities memset(rowActivity_, 0, numberRows_ * sizeof(double)); matrix_->times(1.0, columnActivity_, rowActivity_); // redo reduced costs memcpy(reducedCost_, this->objective(), numberColumns_ * sizeof(double)); matrix_->transposeTimes(-1.0, dual_, reducedCost_); checkSolutionInternal(); if (sumDualInfeasibilities_ > 1.0e-5 || sumPrimalInfeasibilities_ > 1.0e-5) { returnCode = 1; #ifdef CLP_INVESTIGATE printf("There are %d dual infeasibilities summing to %g ", numberDualInfeasibilities_, sumDualInfeasibilities_); printf("and %d primal infeasibilities summing to %g\n", numberPrimalInfeasibilities_, sumPrimalInfeasibilities_); #endif } // Below will go to ..DEBUG later #if 1 //ndef NDEBUG if (checkAccuracy) { // Check if correct double * columnActivity = CoinCopyOfArray(columnActivity_, numberColumns_); double * rowActivity = CoinCopyOfArray(rowActivity_, numberRows_); double * reducedCost = CoinCopyOfArray(reducedCost_, numberColumns_); double * dual = CoinCopyOfArray(dual_, numberRows_); this->dual(); //primal(); CoinRelFltEq eq(1.0e-5); for (iRow = 0; iRow < numberRows_; iRow++) { assert(eq(dual[iRow], dual_[iRow])); } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { assert(eq(columnActivity[iColumn], columnActivity_[iColumn])); } for (iRow = 0; iRow < numberRows_; iRow++) { assert(eq(rowActivity[iRow], rowActivity_[iRow])); } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { assert(eq(reducedCost[iColumn], reducedCost_[iColumn])); } delete [] columnActivity; delete [] rowActivity; delete [] reducedCost; delete [] dual; } #endif return returnCode; } /* Sets solution in dualized problem non-zero return code indicates minor problems */ int ClpSimplexOther::setInDual(ClpSimplex * dualProblem) { // Number of rows in dual problem was original number of columns assert (numberColumns_ == dualProblem->numberRows()); // out If slack on d-row basic then column at bound otherwise column basic // out If d-column basic then rhs tight // if column at bound then slack on d-row basic // if column basic then slack on d-row at bound // if rhs non-basic then d-column basic // if rhs basic then d-column ? int numberBasic = 0; int iRow, iColumn = 0; //int numberExtraRows = dualProblem->numberColumns()-numberRows_; //const double * objective = this->objective(); //double * dualDual = dualProblem->dualRowSolution(); //double * dualDj = dualProblem->dualColumnSolution(); double * dualSol = dualProblem->primalColumnSolution(); //double * dualActs = dualProblem->primalRowSolution(); const double * lower = dualProblem->columnLower(); const double * upper = dualProblem->columnUpper(); // position at bound information int jColumn = numberRows_; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { Status status = getColumnStatus(iColumn); Status statusD = dualProblem->getRowStatus(iColumn); Status statusDJ = dualProblem->getColumnStatus(jColumn); if (status==atLowerBound|| status==isFixed|| status==atUpperBound) { dualProblem->setRowStatus(iColumn,basic); numberBasic++; if (columnUpper_[iColumn] < 1.0e20 && columnLower_[iColumn] > -1.0e20) { bool mainLower =(fabs(columnLower_[iColumn]) < fabs(columnUpper_[iColumn])); // fix this if (mainLower) { if (status==atUpperBound) { dualProblem->setColumnStatus(jColumn,atUpperBound); } else { dualProblem->setColumnStatus(jColumn,atUpperBound); } } else { if (status==atUpperBound) { dualProblem->setColumnStatus(jColumn,atLowerBound); } else { dualProblem->setColumnStatus(jColumn,atLowerBound); } } assert(statusDJ == dualProblem->getColumnStatus(jColumn)); jColumn++; } } else if (status==isFree) { dualProblem->setRowStatus(iColumn,basic); numberBasic++; } else { assert (status==basic); //numberBasic++; } assert(statusD == dualProblem->getRowStatus(iColumn)); } // now rows (no ranges at first) for (iRow = 0; iRow < numberRows_; iRow++) { Status status = getRowStatus(iRow); Status statusD = dualProblem->getColumnStatus(iRow); if (status == basic) { // dual variable is at bound if (!lower[iRow]) { dualProblem->setColumnStatus(iRow,atLowerBound); } else if (!upper[iRow]) { dualProblem->setColumnStatus(iRow,atUpperBound); } else { dualProblem->setColumnStatus(iRow,isFree); dualSol[iRow]=0.0; } } else { // dual variable is basic dualProblem->setColumnStatus(iRow,basic); numberBasic++; } if (rowLower_[iRow] < -1.0e20 && rowUpper_[iRow] > 1.0e20) { if (rowUpper_[iRow] != rowLower_[iRow]) { printf("can't handle ranges yet\n"); abort(); } } assert(statusD == dualProblem->getColumnStatus(iRow)); } if (numberBasic != numberColumns_) { printf("Bad basis - ranges - coding needed ??\n"); abort(); } return 0; } /* Does very cursory presolve. rhs is numberRows, whichRows is 3*numberRows and whichColumns is 2*numberColumns */ ClpSimplex * ClpSimplexOther::crunch(double * rhs, int * whichRow, int * whichColumn, int & nBound, bool moreBounds, bool tightenBounds) { //#define CHECK_STATUS #ifdef CHECK_STATUS { int n = 0; int i; for (i = 0; i < numberColumns_; i++) if (getColumnStatus(i) == ClpSimplex::basic) n++; for (i = 0; i < numberRows_; i++) if (getRowStatus(i) == ClpSimplex::basic) n++; assert (n == numberRows_); } #endif const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); CoinZeroN(rhs, numberRows_); int iColumn; int iRow; CoinZeroN(whichRow, numberRows_); int * backColumn = whichColumn + numberColumns_; int numberRows2 = 0; int numberColumns2 = 0; double offset = 0.0; const double * objective = this->objective(); double * solution = columnActivity_; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double lower = columnLower_[iColumn]; double upper = columnUpper_[iColumn]; if (upper > lower || getColumnStatus(iColumn) == ClpSimplex::basic) { backColumn[iColumn] = numberColumns2; whichColumn[numberColumns2++] = iColumn; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; int n = whichRow[iRow]; if (n == 0 && element[j]) whichRow[iRow] = -iColumn - 1; else if (n < 0) whichRow[iRow] = 2; } } else { // fixed backColumn[iColumn] = -1; solution[iColumn] = upper; if (upper) { offset += objective[iColumn] * upper; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j]; rhs[iRow] += upper * value; } } } } int returnCode = 0; double tolerance = primalTolerance(); nBound = 2 * numberRows_; for (iRow = 0; iRow < numberRows_; iRow++) { int n = whichRow[iRow]; if (n > 0) { whichRow[numberRows2++] = iRow; } else if (n < 0) { //whichRow[numberRows2++]=iRow; //continue; // Can only do in certain circumstances as we don't know current value if (rowLower_[iRow] == rowUpper_[iRow] || getRowStatus(iRow) == ClpSimplex::basic) { // save row and column for bound whichRow[--nBound] = iRow; whichRow[nBound+numberRows_] = -n - 1; } else if (moreBounds) { // save row and column for bound whichRow[--nBound] = iRow; whichRow[nBound+numberRows_] = -n - 1; } else { whichRow[numberRows2++] = iRow; } } else { // empty double rhsValue = rhs[iRow]; if (rhsValue < rowLower_[iRow] - tolerance || rhsValue > rowUpper_[iRow] + tolerance) { returnCode = 1; // infeasible } } } ClpSimplex * small = NULL; if (!returnCode) { //printf("CRUNCH from (%d,%d) to (%d,%d)\n", // numberRows_,numberColumns_,numberRows2,numberColumns2); small = new ClpSimplex(this, numberRows2, whichRow, numberColumns2, whichColumn, true, false); #if 0 ClpPackedMatrix * rowCopy = dynamic_cast(rowCopy_); if (rowCopy) { assert(!small->rowCopy()); small->setNewRowCopy(new ClpPackedMatrix(*rowCopy, numberRows2, whichRow, numberColumns2, whichColumn)); } #endif // Set some stuff small->setDualBound(dualBound_); small->setInfeasibilityCost(infeasibilityCost_); small->setSpecialOptions(specialOptions_); small->setPerturbation(perturbation_); small->defaultFactorizationFrequency(); small->setAlphaAccuracy(alphaAccuracy_); // If no rows left then no tightening! if (!numberRows2 || !numberColumns2) tightenBounds = false; int numberElements = getNumElements(); int numberElements2 = small->getNumElements(); small->setObjectiveOffset(objectiveOffset() - offset); handler_->message(CLP_CRUNCH_STATS, messages_) << numberRows2 << -(numberRows_ - numberRows2) << numberColumns2 << -(numberColumns_ - numberColumns2) << numberElements2 << -(numberElements - numberElements2) << CoinMessageEol; // And set objective value to match small->setObjectiveValue(this->objectiveValue()); double * rowLower2 = small->rowLower(); double * rowUpper2 = small->rowUpper(); int jRow; for (jRow = 0; jRow < numberRows2; jRow++) { iRow = whichRow[jRow]; if (rowLower2[jRow] > -1.0e20) rowLower2[jRow] -= rhs[iRow]; if (rowUpper2[jRow] < 1.0e20) rowUpper2[jRow] -= rhs[iRow]; } // and bounds double * columnLower2 = small->columnLower(); double * columnUpper2 = small->columnUpper(); const char * integerInformation = integerType_; for (jRow = nBound; jRow < 2 * numberRows_; jRow++) { iRow = whichRow[jRow]; iColumn = whichRow[jRow+numberRows_]; double lowerRow = rowLower_[iRow]; if (lowerRow > -1.0e20) lowerRow -= rhs[iRow]; double upperRow = rowUpper_[iRow]; if (upperRow < 1.0e20) upperRow -= rhs[iRow]; int jColumn = backColumn[iColumn]; double lower = columnLower2[jColumn]; double upper = columnUpper2[jColumn]; double value = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (iRow == row[j]) { value = element[j]; break; } } assert (value); // convert rowLower and Upper to implied bounds on column double newLower = -COIN_DBL_MAX; double newUpper = COIN_DBL_MAX; if (value > 0.0) { if (lowerRow > -1.0e20) newLower = lowerRow / value; if (upperRow < 1.0e20) newUpper = upperRow / value; } else { if (upperRow < 1.0e20) newLower = upperRow / value; if (lowerRow > -1.0e20) newUpper = lowerRow / value; } if (integerInformation && integerInformation[iColumn]) { if (newLower - floor(newLower) < 10.0 * tolerance) newLower = floor(newLower); else newLower = ceil(newLower); if (ceil(newUpper) - newUpper < 10.0 * tolerance) newUpper = ceil(newUpper); else newUpper = floor(newUpper); } newLower = CoinMax(lower, newLower); newUpper = CoinMin(upper, newUpper); if (newLower > newUpper + tolerance) { //printf("XXYY inf on bound\n"); returnCode = 1; } columnLower2[jColumn] = newLower; columnUpper2[jColumn] = CoinMax(newLower, newUpper); if (getRowStatus(iRow) != ClpSimplex::basic) { if (getColumnStatus(iColumn) == ClpSimplex::basic) { if (columnLower2[jColumn] == columnUpper2[jColumn]) { // can only get here if will be fixed small->setColumnStatus(jColumn, ClpSimplex::isFixed); } else { // solution is valid if (fabs(columnActivity_[iColumn] - columnLower2[jColumn]) < fabs(columnActivity_[iColumn] - columnUpper2[jColumn])) small->setColumnStatus(jColumn, ClpSimplex::atLowerBound); else small->setColumnStatus(jColumn, ClpSimplex::atUpperBound); } } else { //printf("what now neither basic\n"); } } } if (returnCode) { delete small; small = NULL; } else if (tightenBounds && integerInformation) { // See if we can tighten any bounds // use rhs for upper and small duals for lower double * up = rhs; double * lo = small->dualRowSolution(); const double * element = small->clpMatrix()->getElements(); const int * row = small->clpMatrix()->getIndices(); const CoinBigIndex * columnStart = small->clpMatrix()->getVectorStarts(); //const int * columnLength = small->clpMatrix()->getVectorLengths(); CoinZeroN(lo, numberRows2); CoinZeroN(up, numberRows2); for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { double upper = columnUpper2[iColumn]; double lower = columnLower2[iColumn]; //assert (columnLength[iColumn]==columnStart[iColumn+1]-columnStart[iColumn]); for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; double value = element[j]; if (value > 0.0) { if (upper < 1.0e20) up[iRow] += upper * value; else up[iRow] = COIN_DBL_MAX; if (lower > -1.0e20) lo[iRow] += lower * value; else lo[iRow] = -COIN_DBL_MAX; } else { if (upper < 1.0e20) lo[iRow] += upper * value; else lo[iRow] = -COIN_DBL_MAX; if (lower > -1.0e20) up[iRow] += lower * value; else up[iRow] = COIN_DBL_MAX; } } } double * rowLower2 = small->rowLower(); double * rowUpper2 = small->rowUpper(); bool feasible = true; // make safer for (int iRow = 0; iRow < numberRows2; iRow++) { double lower = lo[iRow]; if (lower > rowUpper2[iRow] + tolerance) { feasible = false; break; } else { lo[iRow] = CoinMin(lower - rowUpper2[iRow], 0.0) - tolerance; } double upper = up[iRow]; if (upper < rowLower2[iRow] - tolerance) { feasible = false; break; } else { up[iRow] = CoinMax(upper - rowLower2[iRow], 0.0) + tolerance; } // tighten row bounds if (lower>-1.0e10) rowLower2[iRow] = CoinMax(rowLower2[iRow], lower - 1.0e-6*(1.0+fabs(lower))); if (upper<1.0e10) rowUpper2[iRow] = CoinMin(rowUpper2[iRow], upper + 1.0e-6*(1.0+fabs(upper))); } if (!feasible) { delete small; small = NULL; } else { // and tighten for (int iColumn = 0; iColumn < numberColumns2; iColumn++) { if (integerInformation[whichColumn[iColumn]]) { double upper = columnUpper2[iColumn]; double lower = columnLower2[iColumn]; double newUpper = upper; double newLower = lower; double difference = upper - lower; if (lower > -1000.0 && upper < 1000.0) { for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; double value = element[j]; if (value > 0.0) { double upWithOut = up[iRow] - value * difference; if (upWithOut < 0.0) { newLower = CoinMax(newLower, lower - (upWithOut + tolerance) / value); } double lowWithOut = lo[iRow] + value * difference; if (lowWithOut > 0.0) { newUpper = CoinMin(newUpper, upper - (lowWithOut - tolerance) / value); } } else { double upWithOut = up[iRow] + value * difference; if (upWithOut < 0.0) { newUpper = CoinMin(newUpper, upper - (upWithOut + tolerance) / value); } double lowWithOut = lo[iRow] - value * difference; if (lowWithOut > 0.0) { newLower = CoinMax(newLower, lower - (lowWithOut - tolerance) / value); } } } if (newLower > lower || newUpper < upper) { if (fabs(newUpper - floor(newUpper + 0.5)) > 1.0e-6) newUpper = floor(newUpper); else newUpper = floor(newUpper + 0.5); if (fabs(newLower - ceil(newLower - 0.5)) > 1.0e-6) newLower = ceil(newLower); else newLower = ceil(newLower - 0.5); // change may be too small - check if (newLower > lower || newUpper < upper) { if (newUpper >= newLower) { // Could also tighten in this //printf("%d bounds %g %g tightened to %g %g\n", // iColumn,columnLower2[iColumn],columnUpper2[iColumn], // newLower,newUpper); #if 1 columnUpper2[iColumn] = newUpper; columnLower2[iColumn] = newLower; columnUpper_[whichColumn[iColumn]] = newUpper; columnLower_[whichColumn[iColumn]] = newLower; #endif // and adjust bounds on rows newUpper -= upper; newLower -= lower; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn+1]; j++) { int iRow = row[j]; double value = element[j]; if (value > 0.0) { up[iRow] += newUpper * value; lo[iRow] += newLower * value; } else { lo[iRow] += newUpper * value; up[iRow] += newLower * value; } } } else { // infeasible //printf("%d bounds infeasible %g %g tightened to %g %g\n", // iColumn,columnLower2[iColumn],columnUpper2[iColumn], // newLower,newUpper); #if 1 delete small; small = NULL; break; #endif } } } } } } } } } #if 0 if (small) { static int which = 0; which++; char xxxx[20]; sprintf(xxxx, "bad%d.mps", which); small->writeMps(xxxx, 0, 1); sprintf(xxxx, "largebad%d.mps", which); writeMps(xxxx, 0, 1); printf("bad%d %x old size %d %d new %d %d\n", which, small, numberRows_, numberColumns_, small->numberRows(), small->numberColumns()); #if 0 for (int i = 0; i < numberColumns_; i++) printf("Bound %d %g %g\n", i, columnLower_[i], columnUpper_[i]); for (int i = 0; i < numberRows_; i++) printf("Row bound %d %g %g\n", i, rowLower_[i], rowUpper_[i]); #endif } #endif #ifdef CHECK_STATUS { int n = 0; int i; for (i = 0; i < small->numberColumns(); i++) if (small->getColumnStatus(i) == ClpSimplex::basic) n++; for (i = 0; i < small->numberRows(); i++) if (small->getRowStatus(i) == ClpSimplex::basic) n++; assert (n == small->numberRows()); } #endif return small; } /* After very cursory presolve. rhs is numberRows, whichRows is 3*numberRows and whichColumns is 2*numberColumns. */ void ClpSimplexOther::afterCrunch(const ClpSimplex & small, const int * whichRow, const int * whichColumn, int nBound) { #ifndef NDEBUG for (int i = 0; i < small.numberRows(); i++) assert (whichRow[i] >= 0 && whichRow[i] < numberRows_); for (int i = 0; i < small.numberColumns(); i++) assert (whichColumn[i] >= 0 && whichColumn[i] < numberColumns_); #endif getbackSolution(small, whichRow, whichColumn); // and deal with status for bounds const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); double tolerance = primalTolerance(); double djTolerance = dualTolerance(); for (int jRow = nBound; jRow < 2 * numberRows_; jRow++) { int iRow = whichRow[jRow]; int iColumn = whichRow[jRow+numberRows_]; if (getColumnStatus(iColumn) != ClpSimplex::basic) { double lower = columnLower_[iColumn]; double upper = columnUpper_[iColumn]; double value = columnActivity_[iColumn]; double djValue = reducedCost_[iColumn]; dual_[iRow] = 0.0; if (upper > lower) { if (value < lower + tolerance && djValue > -djTolerance) { setColumnStatus(iColumn, ClpSimplex::atLowerBound); setRowStatus(iRow, ClpSimplex::basic); } else if (value > upper - tolerance && djValue < djTolerance) { setColumnStatus(iColumn, ClpSimplex::atUpperBound); setRowStatus(iRow, ClpSimplex::basic); } else { // has to be basic setColumnStatus(iColumn, ClpSimplex::basic); reducedCost_[iColumn] = 0.0; double value = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (iRow == row[j]) { value = element[j]; break; } } dual_[iRow] = djValue / value; if (rowUpper_[iRow] > rowLower_[iRow]) { if (fabs(rowActivity_[iRow] - rowLower_[iRow]) < fabs(rowActivity_[iRow] - rowUpper_[iRow])) setRowStatus(iRow, ClpSimplex::atLowerBound); else setRowStatus(iRow, ClpSimplex::atUpperBound); } else { setRowStatus(iRow, ClpSimplex::isFixed); } } } else { // row can always be basic setRowStatus(iRow, ClpSimplex::basic); } } else { // row can always be basic setRowStatus(iRow, ClpSimplex::basic); } } //#ifndef NDEBUG #if 0 if (small.status() == 0) { int n = 0; int i; for (i = 0; i < numberColumns; i++) if (getColumnStatus(i) == ClpSimplex::basic) n++; for (i = 0; i < numberRows; i++) if (getRowStatus(i) == ClpSimplex::basic) n++; assert (n == numberRows); } #endif } /* Tightens integer bounds - returns number tightened or -1 if infeasible */ int ClpSimplexOther::tightenIntegerBounds(double * rhsSpace) { // See if we can tighten any bounds // use rhs for upper and small duals for lower double * up = rhsSpace; double * lo = dual_; const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); CoinZeroN(lo, numberRows_); CoinZeroN(up, numberRows_); for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double upper = columnUpper_[iColumn]; double lower = columnLower_[iColumn]; //assert (columnLength[iColumn]==columnStart[iColumn+1]-columnStart[iColumn]); for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j]; if (value > 0.0) { if (upper < 1.0e20) up[iRow] += upper * value; else up[iRow] = COIN_DBL_MAX; if (lower > -1.0e20) lo[iRow] += lower * value; else lo[iRow] = -COIN_DBL_MAX; } else { if (upper < 1.0e20) lo[iRow] += upper * value; else lo[iRow] = -COIN_DBL_MAX; if (lower > -1.0e20) up[iRow] += lower * value; else up[iRow] = COIN_DBL_MAX; } } } bool feasible = true; // make safer double tolerance = primalTolerance(); for (int iRow = 0; iRow < numberRows_; iRow++) { double lower = lo[iRow]; if (lower > rowUpper_[iRow] + tolerance) { feasible = false; break; } else { lo[iRow] = CoinMin(lower - rowUpper_[iRow], 0.0) - tolerance; } double upper = up[iRow]; if (upper < rowLower_[iRow] - tolerance) { feasible = false; break; } else { up[iRow] = CoinMax(upper - rowLower_[iRow], 0.0) + tolerance; } } int numberTightened = 0; if (!feasible) { return -1; } else if (integerType_) { // and tighten for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { if (integerType_[iColumn]) { double upper = columnUpper_[iColumn]; double lower = columnLower_[iColumn]; double newUpper = upper; double newLower = lower; double difference = upper - lower; if (lower > -1000.0 && upper < 1000.0) { for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j]; if (value > 0.0) { double upWithOut = up[iRow] - value * difference; if (upWithOut < 0.0) { newLower = CoinMax(newLower, lower - (upWithOut + tolerance) / value); } double lowWithOut = lo[iRow] + value * difference; if (lowWithOut > 0.0) { newUpper = CoinMin(newUpper, upper - (lowWithOut - tolerance) / value); } } else { double upWithOut = up[iRow] + value * difference; if (upWithOut < 0.0) { newUpper = CoinMin(newUpper, upper - (upWithOut + tolerance) / value); } double lowWithOut = lo[iRow] - value * difference; if (lowWithOut > 0.0) { newLower = CoinMax(newLower, lower - (lowWithOut - tolerance) / value); } } } if (newLower > lower || newUpper < upper) { if (fabs(newUpper - floor(newUpper + 0.5)) > 1.0e-6) newUpper = floor(newUpper); else newUpper = floor(newUpper + 0.5); if (fabs(newLower - ceil(newLower - 0.5)) > 1.0e-6) newLower = ceil(newLower); else newLower = ceil(newLower - 0.5); // change may be too small - check if (newLower > lower || newUpper < upper) { if (newUpper >= newLower) { numberTightened++; //printf("%d bounds %g %g tightened to %g %g\n", // iColumn,columnLower_[iColumn],columnUpper_[iColumn], // newLower,newUpper); columnUpper_[iColumn] = newUpper; columnLower_[iColumn] = newLower; // and adjust bounds on rows newUpper -= upper; newLower -= lower; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; double value = element[j]; if (value > 0.0) { up[iRow] += newUpper * value; lo[iRow] += newLower * value; } else { lo[iRow] += newUpper * value; up[iRow] += newLower * value; } } } else { // infeasible //printf("%d bounds infeasible %g %g tightened to %g %g\n", // iColumn,columnLower_[iColumn],columnUpper_[iColumn], // newLower,newUpper); return -1; } } } } } } } return numberTightened; } /* Parametrics This is an initial slow version. The code uses current bounds + theta * change (if change array not NULL) and similarly for objective. It starts at startingTheta and returns ending theta in endingTheta. If reportIncrement 0.0 it will report on any movement If reportIncrement >0.0 it will report at startingTheta+k*reportIncrement. If it can not reach input endingTheta return code will be 1 for infeasible, 2 for unbounded, if error on ranges -1, otherwise 0. Normal report is just theta and objective but if event handler exists it may do more On exit endingTheta is maximum reached (can be used for next startingTheta) */ int ClpSimplexOther::parametrics(double startingTheta, double & endingTheta, double reportIncrement, const double * lowerChangeBound, const double * upperChangeBound, const double * lowerChangeRhs, const double * upperChangeRhs, const double * changeObjective) { bool needToDoSomething = true; bool canTryQuick = (reportIncrement) ? true : false; // Save copy of model ClpSimplex copyModel = *this; int savePerturbation = perturbation_; perturbation_ = 102; // switch off while (needToDoSomething) { needToDoSomething = false; algorithm_ = -1; // save data ClpDataSave data = saveData(); // Dantzig ClpDualRowPivot * savePivot = dualRowPivot_; dualRowPivot_ = new ClpDualRowDantzig(); dualRowPivot_->setModel(this); int returnCode = reinterpret_cast (this)->startupSolve(0, NULL, 0); int iRow, iColumn; double * chgUpper = NULL; double * chgLower = NULL; double * chgObjective = NULL; if (!returnCode) { // Find theta when bounds will cross over and create arrays int numberTotal = numberRows_ + numberColumns_; chgLower = new double[numberTotal]; memset(chgLower, 0, numberTotal * sizeof(double)); chgUpper = new double[numberTotal]; memset(chgUpper, 0, numberTotal * sizeof(double)); chgObjective = new double[numberTotal]; memset(chgObjective, 0, numberTotal * sizeof(double)); assert (!rowScale_); double maxTheta = 1.0e50; if (lowerChangeRhs || upperChangeRhs) { for (iRow = 0; iRow < numberRows_; iRow++) { double lower = rowLower_[iRow]; double upper = rowUpper_[iRow]; if (lower > upper) { maxTheta = -1.0; break; } double lowerChange = (lowerChangeRhs) ? lowerChangeRhs[iRow] : 0.0; double upperChange = (upperChangeRhs) ? upperChangeRhs[iRow] : 0.0; if (lower > -1.0e20 && upper < 1.0e20) { if (lower + maxTheta * lowerChange > upper + maxTheta * upperChange) { maxTheta = (upper - lower) / (lowerChange - upperChange); } } if (lower > -1.0e20) { lower_[numberColumns_+iRow] += startingTheta * lowerChange; chgLower[numberColumns_+iRow] = lowerChange; } if (upper < 1.0e20) { upper_[numberColumns_+iRow] += startingTheta * upperChange; chgUpper[numberColumns_+iRow] = upperChange; } } } if (maxTheta > 0.0) { if (lowerChangeBound || upperChangeBound) { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { double lower = columnLower_[iColumn]; double upper = columnUpper_[iColumn]; if (lower > upper) { maxTheta = -1.0; break; } double lowerChange = (lowerChangeBound) ? lowerChangeBound[iColumn] : 0.0; double upperChange = (upperChangeBound) ? upperChangeBound[iColumn] : 0.0; if (lower > -1.0e20 && upper < 1.0e20) { if (lower + maxTheta * lowerChange > upper + maxTheta * upperChange) { maxTheta = (upper - lower) / (lowerChange - upperChange); } } if (lower > -1.0e20) { lower_[iColumn] += startingTheta * lowerChange; chgLower[iColumn] = lowerChange; } if (upper < 1.0e20) { upper_[iColumn] += startingTheta * upperChange; chgUpper[iColumn] = upperChange; } } } if (maxTheta == 1.0e50) maxTheta = COIN_DBL_MAX; } if (maxTheta < 0.0) { // bad ranges or initial returnCode = -1; } if (maxTheta < endingTheta) { char line[100]; sprintf(line,"Crossover considerations reduce ending theta from %g to %g\n", endingTheta,maxTheta); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; endingTheta = maxTheta; } if (endingTheta < startingTheta) { // bad initial returnCode = -2; } } double saveEndingTheta = endingTheta; if (!returnCode) { if (changeObjective) { for (iColumn = 0; iColumn < numberColumns_; iColumn++) { chgObjective[iColumn] = changeObjective[iColumn]; cost_[iColumn] += startingTheta * changeObjective[iColumn]; } } double * saveDuals = NULL; reinterpret_cast (this)->gutsOfDual(0, saveDuals, -1, data); assert (!problemStatus_); for (int i=0;imessage(CLP_PARAMETRICS_STATS, messages_) << startingTheta << objectiveValue() << CoinMessageEol; while (!returnCode) { //assert (reportIncrement); parametricsData paramData; paramData.startingTheta=startingTheta; paramData.endingTheta=endingTheta; paramData.maxTheta=COIN_DBL_MAX; paramData.lowerChange = chgLower; paramData.upperChange = chgUpper; returnCode = parametricsLoop(paramData, reportIncrement, chgLower, chgUpper, chgObjective, data, canTryQuick); startingTheta=paramData.startingTheta; endingTheta=paramData.endingTheta; if (!returnCode) { //double change = endingTheta-startingTheta; startingTheta = endingTheta; endingTheta = saveEndingTheta; //for (int i=0;imessage(CLP_PARAMETRICS_STATS, messages_) << startingTheta << objectiveValue() << CoinMessageEol; if (startingTheta >= endingTheta) break; } else if (returnCode == -1) { // trouble - do external solve needToDoSomething = true; } else if (problemStatus_==1) { // can't move any further if (!canTryQuick) { handler_->message(CLP_PARAMETRICS_STATS, messages_) << endingTheta << objectiveValue() << CoinMessageEol; problemStatus_=0; } } else { abort(); } } } reinterpret_cast (this)->finishSolve(0); delete dualRowPivot_; dualRowPivot_ = savePivot; // Restore any saved stuff restoreData(data); if (needToDoSomething) { double saveStartingTheta = startingTheta; // known to be feasible int cleanedUp = 1; while (cleanedUp) { // tweak if (cleanedUp == 1) { if (!reportIncrement) startingTheta = CoinMin(startingTheta + 1.0e-5, saveEndingTheta); else startingTheta = CoinMin(startingTheta + reportIncrement, saveEndingTheta); } else { // restoring to go slowly startingTheta = saveStartingTheta; } // only works if not scaled int i; const double * obj1 = objective(); double * obj2 = copyModel.objective(); const double * lower1 = columnLower_; double * lower2 = copyModel.columnLower(); const double * upper1 = columnUpper_; double * upper2 = copyModel.columnUpper(); for (i = 0; i < numberColumns_; i++) { obj2[i] = obj1[i] + startingTheta * chgObjective[i]; lower2[i] = lower1[i] + startingTheta * chgLower[i]; upper2[i] = upper1[i] + startingTheta * chgUpper[i]; } lower1 = rowLower_; lower2 = copyModel.rowLower(); upper1 = rowUpper_; upper2 = copyModel.rowUpper(); for (i = 0; i < numberRows_; i++) { lower2[i] = lower1[i] + startingTheta * chgLower[i+numberColumns_]; upper2[i] = upper1[i] + startingTheta * chgUpper[i+numberColumns_]; } copyModel.dual(); if (copyModel.problemStatus()) { char line[100]; sprintf(line,"Can not get to theta of %g\n", startingTheta); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; canTryQuick = false; // do slowly to get exact amount // back to last known good if (cleanedUp == 1) cleanedUp = 2; else abort(); } else { // and move stuff back int numberTotal = numberRows_ + numberColumns_; CoinMemcpyN(copyModel.statusArray(), numberTotal, status_); CoinMemcpyN(copyModel.primalColumnSolution(), numberColumns_, columnActivity_); CoinMemcpyN(copyModel.primalRowSolution(), numberRows_, rowActivity_); cleanedUp = 0; } } } delete [] chgLower; delete [] chgUpper; delete [] chgObjective; } perturbation_ = savePerturbation; char line[100]; sprintf(line,"Ending theta %g\n", endingTheta); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; return problemStatus_; } /* Version of parametrics which reads from file See CbcClpParam.cpp for details of format Returns -2 if unable to open file */ int ClpSimplexOther::parametrics(const char * dataFile) { int returnCode=-2; FILE *fp = fopen(dataFile, "r"); char line[200]; if (!fp) { handler_->message(CLP_UNABLE_OPEN, messages_) << dataFile << CoinMessageEol; return -2; } if (!fgets(line, 200, fp)) { sprintf(line,"Empty parametrics file %s?",dataFile); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; fclose(fp); return -2; } char * pos = line; char * put = line; while (*pos >= ' ' && *pos != '\n') { if (*pos != ' ' && *pos != '\t') { *put = static_cast(tolower(*pos)); put++; } pos++; } *put = '\0'; pos = line; double startTheta=0.0; double endTheta=0.0; double intervalTheta=COIN_DBL_MAX; int detail=0; bool good = true; while (good) { good=false; // check ROWS char * comma = strchr(pos, ','); if (!comma) break; *comma = '\0'; if (strcmp(pos,"rows")) break; *comma = ','; pos = comma+1; // check lower theta comma = strchr(pos, ','); if (!comma) break; *comma = '\0'; startTheta = atof(pos); *comma = ','; pos = comma+1; // check upper theta comma = strchr(pos, ','); good=true; if (comma) *comma = '\0'; endTheta = atof(pos); if (comma) { *comma = ','; pos = comma+1; comma = strchr(pos, ','); if (comma) *comma = '\0'; intervalTheta = atof(pos); if (comma) { *comma = ','; pos = comma+1; comma = strchr(pos, ','); if (comma) *comma = '\0'; detail = atoi(pos); if (comma) *comma = ','; } } break; } if (good) { if (startTheta<0.0|| startTheta>endTheta|| intervalTheta<0.0) good=false; if (detail<0||detail>1) good=false; } if (intervalTheta>=endTheta) intervalTheta=0.0; if (!good) { sprintf(line,"Odd first line %s on file %s?",line,dataFile); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; fclose(fp); return -2; } if (!fgets(line, 200, fp)) { sprintf(line,"Not enough records on parametrics file %s?",dataFile); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; fclose(fp); return -2; } double * lowerRowMove = NULL; double * upperRowMove = NULL; double * lowerColumnMove = NULL; double * upperColumnMove = NULL; double * objectiveMove = NULL; char saveLine[200]; saveLine[0]='\0'; std::string headingsRow[] = {"name", "number", "lower", "upper", "rhs"}; int gotRow[] = { -1, -1, -1, -1, -1}; int orderRow[5]; assert(sizeof(gotRow) == sizeof(orderRow)); int nAcross = 0; pos = line; put = line; while (*pos >= ' ' && *pos != '\n') { if (*pos != ' ' && *pos != '\t') { *put = static_cast(tolower(*pos)); put++; } pos++; } *put = '\0'; pos = line; int i; good = true; if (strncmp(line,"column",6)) { while (pos) { char * comma = strchr(pos, ','); if (comma) *comma = '\0'; for (i = 0; i < static_cast (sizeof(gotRow) / sizeof(int)); i++) { if (headingsRow[i] == pos) { if (gotRow[i] < 0) { orderRow[nAcross] = i; gotRow[i] = nAcross++; } else { // duplicate good = false; } break; } } if (i == static_cast (sizeof(gotRow) / sizeof(int))) good = false; if (comma) { *comma = ','; pos = comma + 1; } else { break; } } if (gotRow[0] < 0 && gotRow[1] < 0) good = false; if (gotRow[0] >= 0 && gotRow[1] >= 0) good = false; if (gotRow[0] >= 0 && !lengthNames()) good = false; if (gotRow[4]<0) { if (gotRow[2] < 0 && gotRow[3] >= 0) good = false; else if (gotRow[3] < 0 && gotRow[2] >= 0) good = false; } else if (gotRow[2]>=0||gotRow[3]>=0) { good = false; } if (good) { char ** rowNames = new char * [numberRows_]; int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { rowNames[iRow] = CoinStrdup(rowName(iRow).c_str()); } lowerRowMove = new double [numberRows_]; memset(lowerRowMove,0,numberRows_*sizeof(double)); upperRowMove = new double [numberRows_]; memset(upperRowMove,0,numberRows_*sizeof(double)); int nLine = 0; int nBadLine = 0; int nBadName = 0; while (fgets(line, 200, fp)) { if (!strncmp(line, "ENDATA", 6)|| !strncmp(line, "COLUMN",6)) break; nLine++; iRow = -1; double upper = 0.0; double lower = 0.0; char * pos = line; char * put = line; while (*pos >= ' ' && *pos != '\n') { if (*pos != ' ' && *pos != '\t') { *put = *pos; put++; } pos++; } *put = '\0'; pos = line; for (int i = 0; i < nAcross; i++) { char * comma = strchr(pos, ','); if (comma) { *comma = '\0'; } else if (i < nAcross - 1) { nBadLine++; break; } switch (orderRow[i]) { // name case 0: // For large problems this could be slow for (iRow = 0; iRow < numberRows_; iRow++) { if (!strcmp(rowNames[iRow], pos)) break; } if (iRow == numberRows_) iRow = -1; break; // number case 1: iRow = atoi(pos); if (iRow < 0 || iRow >= numberRows_) iRow = -1; break; // lower case 2: upper = atof(pos); break; // upper case 3: lower = atof(pos); break; // rhs case 4: lower = atof(pos); upper = lower; break; } if (comma) { *comma = ','; pos = comma + 1; } } if (iRow >= 0) { if (rowLower_[iRow]>-1.0e20) lowerRowMove[iRow] = lower; else lowerRowMove[iRow]=0.0; if (rowUpper_[iRow]<1.0e20) upperRowMove[iRow] = upper; else upperRowMove[iRow] = lower; } else { nBadName++; if(saveLine[0]=='\0') strcpy(saveLine,line); } } sprintf(line,"%d Row fields and %d records", nAcross, nLine); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; if (nBadName) { sprintf(line," ** %d records did not match on name/sequence, first bad %s", nBadName,saveLine); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; returnCode=-1; good=false; } for (iRow = 0; iRow < numberRows_; iRow++) { free(rowNames[iRow]); } delete [] rowNames; } else { sprintf(line,"Duplicate or unknown keyword - or name/number fields wrong"); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; returnCode=-1; good=false; } } if (good&&(!strncmp(line, "COLUMN",6)||!strncmp(line, "column",6))) { if (!fgets(line, 200, fp)) { sprintf(line,"Not enough records on parametrics file %s after COLUMNS?",dataFile); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; fclose(fp); return -2; } std::string headingsColumn[] = {"name", "number", "lower", "upper", "objective"}; saveLine[0]='\0'; int gotColumn[] = { -1, -1, -1, -1, -1}; int orderColumn[5]; assert(sizeof(gotColumn) == sizeof(orderColumn)); nAcross = 0; pos = line; put = line; while (*pos >= ' ' && *pos != '\n') { if (*pos != ' ' && *pos != '\t') { *put = static_cast(tolower(*pos)); put++; } pos++; } *put = '\0'; pos = line; int i; if (strncmp(line,"endata",6)&&good) { while (pos) { char * comma = strchr(pos, ','); if (comma) *comma = '\0'; for (i = 0; i < static_cast (sizeof(gotColumn) / sizeof(int)); i++) { if (headingsColumn[i] == pos) { if (gotColumn[i] < 0) { orderColumn[nAcross] = i; gotColumn[i] = nAcross++; } else { // duplicate good = false; } break; } } if (i == static_cast (sizeof(gotColumn) / sizeof(int))) good = false; if (comma) { *comma = ','; pos = comma + 1; } else { break; } } if (gotColumn[0] < 0 && gotColumn[1] < 0) good = false; if (gotColumn[0] >= 0 && gotColumn[1] >= 0) good = false; if (gotColumn[0] >= 0 && !lengthNames()) good = false; if (good) { char ** columnNames = new char * [numberColumns_]; int iColumn; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { columnNames[iColumn] = CoinStrdup(columnName(iColumn).c_str()); } lowerColumnMove = reinterpret_cast (malloc(numberColumns_ * sizeof(double))); memset(lowerColumnMove,0,numberColumns_*sizeof(double)); upperColumnMove = reinterpret_cast (malloc(numberColumns_ * sizeof(double))); memset(upperColumnMove,0,numberColumns_*sizeof(double)); objectiveMove = reinterpret_cast (malloc(numberColumns_ * sizeof(double))); memset(objectiveMove,0,numberColumns_*sizeof(double)); int nLine = 0; int nBadLine = 0; int nBadName = 0; while (fgets(line, 200, fp)) { if (!strncmp(line, "ENDATA", 6)) break; nLine++; iColumn = -1; double upper = 0.0; double lower = 0.0; double obj =0.0; char * pos = line; char * put = line; while (*pos >= ' ' && *pos != '\n') { if (*pos != ' ' && *pos != '\t') { *put = *pos; put++; } pos++; } *put = '\0'; pos = line; for (int i = 0; i < nAcross; i++) { char * comma = strchr(pos, ','); if (comma) { *comma = '\0'; } else if (i < nAcross - 1) { nBadLine++; break; } switch (orderColumn[i]) { // name case 0: // For large problems this could be slow for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (!strcmp(columnNames[iColumn], pos)) break; } if (iColumn == numberColumns_) iColumn = -1; break; // number case 1: iColumn = atoi(pos); if (iColumn < 0 || iColumn >= numberColumns_) iColumn = -1; break; // lower case 2: upper = atof(pos); break; // upper case 3: lower = atof(pos); break; // objective case 4: obj = atof(pos); upper = lower; break; } if (comma) { *comma = ','; pos = comma + 1; } } if (iColumn >= 0) { if (columnLower_[iColumn]>-1.0e20) lowerColumnMove[iColumn] = lower; else lowerColumnMove[iColumn]=0.0; if (columnUpper_[iColumn]<1.0e20) upperColumnMove[iColumn] = upper; else upperColumnMove[iColumn] = lower; objectiveMove[iColumn] = obj; } else { nBadName++; if(saveLine[0]=='\0') strcpy(saveLine,line); } } sprintf(line,"%d Column fields and %d records", nAcross, nLine); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; if (nBadName) { sprintf(line," ** %d records did not match on name/sequence, first bad %s", nBadName,saveLine); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; returnCode=-1; good=false; } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { free(columnNames[iColumn]); } delete [] columnNames; } else { sprintf(line,"Duplicate or unknown keyword - or name/number fields wrong"); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; returnCode=-1; good=false; } } } returnCode=-1; if (good) { // clean arrays if (lowerRowMove) { bool empty=true; for (int i=0;ilogLevel(); if (detail>0&&!intervalTheta) handler_->setLogLevel(3); else handler_->setLogLevel(1); returnCode = parametrics(startTheta,endTheta,intervalTheta, lowerColumnMove,upperColumnMove, lowerRowMove,upperRowMove, objectiveMove); scalingFlag_ = saveScaling; handler_->setLogLevel(saveLogLevel); } delete [] lowerRowMove; delete [] upperRowMove; delete [] lowerColumnMove; delete [] upperColumnMove; delete [] objectiveMove; fclose(fp); return returnCode; } int ClpSimplexOther::parametricsLoop(parametricsData & paramData,double reportIncrement, const double * lowerChange, const double * upperChange, const double * changeObjective, ClpDataSave & data, bool canTryQuick) { double startingTheta = paramData.startingTheta; double & endingTheta = paramData.endingTheta; // stuff is already at starting // For this crude version just try and go to end double change = 0.0; if (reportIncrement && canTryQuick) { endingTheta = CoinMin(endingTheta, startingTheta + reportIncrement); change = endingTheta - startingTheta; } int numberTotal = numberRows_ + numberColumns_; int i; for ( i = 0; i < numberTotal; i++) { lower_[i] += change * lowerChange[i]; upper_[i] += change * upperChange[i]; switch(getStatus(i)) { case basic: case isFree: case superBasic: break; case isFixed: case atUpperBound: solution_[i] = upper_[i]; break; case atLowerBound: solution_[i] = lower_[i]; break; } cost_[i] += change * changeObjective[i]; } problemStatus_ = -1; // This says whether to restore things etc // startup will have factorized so can skip int factorType = 0; // Start check for cycles progress_.startCheck(); // Say change made on first iteration changeMade_ = 1; /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible */ while (problemStatus_ < 0) { int iRow, iColumn; // clear for (iRow = 0; iRow < 4; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // give matrix (and model costs and bounds a chance to be // refreshed (normally null) matrix_->refresh(this); // may factorize, checks if problem finished statusOfProblemInParametrics(factorType, data); // Say good factorization factorType = 1; if (data.sparseThreshold_) { // use default at present factorization_->sparseThreshold(0); factorization_->goSparse(); } // exit if victory declared if (problemStatus_ >= 0 && (canTryQuick || startingTheta>=endingTheta-1.0e-7) ) break; // test for maximum iterations if (hitMaximumIterations()) { problemStatus_ = 3; break; } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfFactorization); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } } // Do iterations problemStatus_=-1; if (canTryQuick) { double * saveDuals = NULL; reinterpret_cast (this)->whileIterating(saveDuals, 0); } else { whileIterating(paramData, reportIncrement, changeObjective); startingTheta = endingTheta; } } if (!problemStatus_) { theta_ = change + startingTheta; eventHandler_->event(ClpEventHandler::theta); return 0; } else if (problemStatus_ == 10) { return -1; } else { return problemStatus_; } } /* Parametrics The code uses current bounds + theta * change (if change array not NULL) It starts at startingTheta and returns ending theta in endingTheta. If it can not reach input endingTheta return code will be 1 for infeasible, 2 for unbounded, if error on ranges -1, otherwise 0. Event handler may do more On exit endingTheta is maximum reached (can be used for next startingTheta) */ int ClpSimplexOther::parametrics(double startingTheta, double & endingTheta, const double * lowerChangeBound, const double * upperChangeBound, const double * lowerChangeRhs, const double * upperChangeRhs) { int savePerturbation = perturbation_; perturbation_ = 102; // switch off algorithm_ = -1; // extra region int maximumPivots = factorization_->maximumPivots(); int numberDense = factorization_->numberDense(); int length = numberRows_ + numberDense + maximumPivots; assert (!rowArray_[4]); rowArray_[4]=new CoinIndexedVector(length); assert (!rowArray_[5]); rowArray_[5]=new CoinIndexedVector(length); // save data ClpDataSave data = saveData(); int numberTotal = numberRows_ + numberColumns_; int ratio = static_cast((2*sizeof(int))/sizeof(double)); assert (ratio==1||ratio==2); // allow for unscaled - even if not needed int lengthArrays = 4*numberTotal+(3*numberTotal+2)*ratio+2*numberRows_+1; int unscaledChangesOffset=lengthArrays; // need extra copy of change lengthArrays += numberTotal; /* Save information and modify */ double * saveLower = new double [lengthArrays]; double * saveUpper = new double [lengthArrays]; double * lowerCopy = saveLower+2*numberTotal; double * upperCopy = saveUpper+2*numberTotal; double * lowerChange = saveLower+numberTotal; double * upperChange = saveUpper+numberTotal; double * lowerGap = saveLower+4*numberTotal; double * lowerCoefficient = lowerGap+numberRows_; double * upperGap = saveUpper+4*numberTotal; double * upperCoefficient = upperGap+numberRows_; int * lowerList = (reinterpret_cast(saveLower+4*numberTotal+2*numberRows_))+2; int * upperList = (reinterpret_cast(saveUpper+4*numberTotal+2*numberRows_))+2; int * lowerActive = lowerList+numberTotal+1; int * upperActive = upperList+numberTotal+1; // To mark as odd char * markDone = reinterpret_cast(lowerActive+numberTotal); //memset(markDone,0,numberTotal); int * backwardBasic = upperActive+numberTotal; parametricsData paramData; paramData.lowerChange = lowerChange; paramData.lowerList=lowerList; paramData.upperChange = upperChange; paramData.upperList=upperList; paramData.markDone=markDone; paramData.backwardBasic=backwardBasic; paramData.lowerActive = lowerActive; paramData.lowerGap = lowerGap; paramData.lowerCoefficient = lowerCoefficient; paramData.upperActive = upperActive; paramData.upperGap = upperGap; paramData.upperCoefficient = upperCoefficient; paramData.unscaledChangesOffset = unscaledChangesOffset-numberTotal; paramData.firstIteration=true; // Find theta when bounds will cross over and create arrays memset(lowerChange, 0, numberTotal * sizeof(double)); memset(upperChange, 0, numberTotal * sizeof(double)); if (lowerChangeBound) memcpy(lowerChange,lowerChangeBound,numberColumns_*sizeof(double)); if (upperChangeBound) memcpy(upperChange,upperChangeBound,numberColumns_*sizeof(double)); if (lowerChangeRhs) memcpy(lowerChange+numberColumns_, lowerChangeRhs,numberRows_*sizeof(double)); if (upperChangeRhs) memcpy(upperChange+numberColumns_, upperChangeRhs,numberRows_*sizeof(double)); // clean for (int iRow = 0; iRow < numberRows_; iRow++) { double lower = rowLower_[iRow]; double upper = rowUpper_[iRow]; if (lower<-1.0e30) lowerChange[numberColumns_+iRow]=0.0; if (upper>1.0e30) upperChange[numberColumns_+iRow]=0.0; } for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double lower = columnLower_[iColumn]; double upper = columnUpper_[iColumn]; if (lower<-1.0e30) lowerChange[iColumn]=0.0; if (upper>1.0e30) upperChange[iColumn]=0.0; } // save unscaled version of changes memcpy(saveLower+unscaledChangesOffset,lowerChange,numberTotal*sizeof(double)); memcpy(saveUpper+unscaledChangesOffset,upperChange,numberTotal*sizeof(double)); int nLowerChange=0; int nUpperChange=0; for (int i=0;isetModel(this); #else ClpDualRowPivot * savePivot = NULL; #endif if (!returnCode) { assert (objective_->type()==1); objective_->setType(2); // in case matrix empty returnCode = reinterpret_cast (this)->startupSolve(0, NULL, 0); objective_->setType(1); if (!returnCode) { double saveDualBound=dualBound_; dualBound_=CoinMax(dualBound_,1.0e15); swapped=true; double * temp; memcpy(saveLower,lower_,numberTotal*sizeof(double)); temp=saveLower; saveLower=lower_; lower_=temp; //columnLowerWork_ = lower_; //rowLowerWork_ = lower_ + numberColumns_; memcpy(saveUpper,upper_,numberTotal*sizeof(double)); temp=saveUpper; saveUpper=upper_; upper_=temp; //columnUpperWork_ = upper_; //rowUpperWork_ = upper_ + numberColumns_; if (rowScale_) { // scale saved and change arrays double * lowerChange = lower_+numberTotal; double * upperChange = upper_+numberTotal; double * lowerSave = lowerChange+numberTotal; double * upperSave = upperChange+numberTotal; for (int i=0;i-1.0e20) lowerSave[i] *= multiplier; if (upperSave[i]<1.0e20) upperSave[i] *= multiplier; lowerChange[i] *= multiplier; upperChange[i] *= multiplier; } lowerChange += numberColumns_; upperChange += numberColumns_; lowerSave += numberColumns_; upperSave += numberColumns_; for (int i=0;i-1.0e20) lowerSave[i] *= multiplier; if (upperSave[i]<1.0e20) upperSave[i] *= multiplier; lowerChange[i] *= multiplier; upperChange[i] *= multiplier; } } //double saveEndingTheta = endingTheta; double * saveDuals = NULL; reinterpret_cast (this)->gutsOfDual(0, saveDuals, -1, data); if (numberPrimalInfeasibilities_&&sumPrimalInfeasibilities_<1.0e-4) { // probably can get rid of this if we adjust every change in theta //printf("INFEAS_A %d %g\n",numberPrimalInfeasibilities_, // sumPrimalInfeasibilities_); int pass=100; while(sumPrimalInfeasibilities_) { pass--; if (!pass) break; problemStatus_=-1; for (int iSequence=numberColumns_;iSequenceupper_[iSequence]+1.0e-9) { upperCopy[iSequence]+=value-upper_[iSequence]; upper_[iSequence]=value; } } reinterpret_cast (this)->gutsOfDual(1, saveDuals, -1, data); } } if (!problemStatus_) { if (nLowerChange||nUpperChange) { #ifndef ALL_DANTZIG // Dantzig savePivot = dualRowPivot_; dualRowPivot_ = new ClpDualRowDantzig(); dualRowPivot_->setModel(this); #endif //for (int i=0;imessage(CLP_PARAMETRICS_STATS, messages_) << startingTheta << objectiveValue() << CoinMessageEol; bool canSkipFactorization=true; while (!returnCode) { paramData.startingTheta=startingTheta; paramData.endingTheta=endingTheta; returnCode = parametricsLoop(paramData, data,canSkipFactorization); startingTheta=paramData.startingTheta; endingTheta=paramData.endingTheta; canSkipFactorization=false; if (!returnCode) { //startingTheta = endingTheta; //endingTheta = saveEndingTheta; handler_->message(CLP_PARAMETRICS_STATS, messages_) << startingTheta << objectiveValue() << CoinMessageEol; if (startingTheta >= endingTheta-primalTolerance_ ||problemStatus_==2) break; } else if (returnCode == -1) { // trouble - do external solve abort(); //needToDoSomething = true; } else if (problemStatus_==1) { // can't move any further handler_->message(CLP_PARAMETRICS_STATS, messages_) << endingTheta << objectiveValue() << CoinMessageEol; problemStatus_=0; } } } dualBound_ = saveDualBound; //reinterpret_cast (this)->gutsOfDual(0, saveDuals, -1, data); } else { // check if empty //if (!numberRows_||!matrix_->getNumElements()) { // success #ifdef CLP_USER_DRIVEN //theta_ = endingTheta; //eventHandler_->event(ClpEventHandler::theta); #endif //} } } if (problemStatus_==2) { delete [] ray_; ray_ = new double [numberColumns_]; } if (swapped&&lower_) { double * temp=saveLower; saveLower=lower_; lower_=temp; temp=saveUpper; saveUpper=upper_; upper_=temp; } reinterpret_cast (this)->finishSolve(0); } if (!scalingFlag_) { memcpy(columnLower_,lowerCopy,numberColumns_*sizeof(double)); memcpy(columnUpper_,upperCopy,numberColumns_*sizeof(double)); memcpy(rowLower_,lowerCopy+numberColumns_, numberRows_*sizeof(double)); memcpy(rowUpper_,upperCopy+numberColumns_, numberRows_*sizeof(double)); } else { // extra for unscaled double * unscaledCopy; unscaledCopy = lowerCopy + numberTotal; memcpy(columnLower_,unscaledCopy,numberColumns_*sizeof(double)); memcpy(rowLower_,unscaledCopy+numberColumns_, numberRows_*sizeof(double)); unscaledCopy = upperCopy + numberTotal; memcpy(columnUpper_,unscaledCopy,numberColumns_*sizeof(double)); memcpy(rowUpper_,unscaledCopy+numberColumns_, numberRows_*sizeof(double)); } delete [] saveLower; delete [] saveUpper; #ifdef ALL_DANTZIG if (savePivot) { #endif delete dualRowPivot_; dualRowPivot_ = savePivot; #ifdef ALL_DANTZIG } #endif // Restore any saved stuff restoreData(data); perturbation_ = savePerturbation; delete rowArray_[4]; rowArray_[4]=NULL; delete rowArray_[5]; rowArray_[5]=NULL; char line[100]; sprintf(line,"Ending theta %g\n", endingTheta); handler_->message(CLP_GENERAL,messages_) << line << CoinMessageEol; return problemStatus_; } int ClpSimplexOther::parametricsLoop(parametricsData & paramData, ClpDataSave & data,bool canSkipFactorization) { double & startingTheta = paramData.startingTheta; double & endingTheta = paramData.endingTheta; int numberTotal = numberRows_+numberColumns_; // stuff is already at starting const int * lowerList = paramData.lowerList; const int * upperList = paramData.upperList; problemStatus_ = -1; //double saveEndingTheta=endingTheta; // This says whether to restore things etc // startup will have factorized so can skip int factorType = 0; // Start check for cycles progress_.startCheck(); // Say change made on first iteration changeMade_ = 1; /* Status of problem: 0 - optimal 1 - infeasible 2 - unbounded -1 - iterating -2 - factorization wanted -3 - redo checking without factorization -4 - looks infeasible */ while (problemStatus_ < 0) { int iRow, iColumn; // clear for (iRow = 0; iRow < 6; iRow++) { rowArray_[iRow]->clear(); } for (iColumn = 0; iColumn < 2; iColumn++) { columnArray_[iColumn]->clear(); } // give matrix (and model costs and bounds a chance to be // refreshed (normally null) matrix_->refresh(this); // may factorize, checks if problem finished if (!canSkipFactorization) statusOfProblemInParametrics(factorType, data); canSkipFactorization=false; if (numberPrimalInfeasibilities_) { if (largestPrimalError_>1.0e3&&startingTheta>1.0e10) { // treat as success problemStatus_=0; endingTheta=startingTheta; break; } // probably can get rid of this if we adjust every change in theta //printf("INFEAS %d %g\n",numberPrimalInfeasibilities_, // sumPrimalInfeasibilities_); const double * lowerChange = lower_+numberTotal; const double * upperChange = upper_+numberTotal; const double * startLower = lowerChange+numberTotal; const double * startUpper = upperChange+numberTotal; //startingTheta -= 1.0e-7; int nLowerChange = lowerList[-1]; for (int i = 0; i < nLowerChange; i++) { int iSequence = lowerList[i]; lower_[iSequence] = startLower[iSequence] + startingTheta * lowerChange[iSequence]; } int nUpperChange = upperList[-1]; for (int i = 0; i < nUpperChange; i++) { int iSequence = upperList[i]; upper_[iSequence] = startUpper[iSequence] + startingTheta * upperChange[iSequence]; } // adjust rhs in case dual uses memcpy(columnLower_,lower_,numberColumns_*sizeof(double)); memcpy(rowLower_,lower_+numberColumns_,numberRows_*sizeof(double)); memcpy(columnUpper_,upper_,numberColumns_*sizeof(double)); memcpy(rowUpper_,upper_+numberColumns_,numberRows_*sizeof(double)); if (rowScale_) { for (int i=0;i-1.0e20) columnLower_[i] *= multiplier; if (columnUpper_[i]<1.0e20) columnUpper_[i] *= multiplier; } for (int i=0;i-1.0e20) rowLower_[i] *= multiplier; if (rowUpper_[i]<1.0e20) rowUpper_[i] *= multiplier; } } double * saveDuals = NULL; problemStatus_=-1; ClpObjective * saveObjective = objective_; reinterpret_cast (this)->gutsOfDual(0, saveDuals, -1, data); if (saveObjective!=objective_) { delete objective_; objective_=saveObjective; } int pass=100; double moved=0.0; while(sumPrimalInfeasibilities_) { //printf("INFEAS pass %d %d %g\n",100-pass,numberPrimalInfeasibilities_, // sumPrimalInfeasibilities_); pass--; if (!pass) break; problemStatus_=-1; for (int iSequence=numberColumns_;iSequenceupper_[iSequence]+1.0e-9) { moved += upper_[iSequence]-value; upper_[iSequence]=value; } } if (!moved) { for (int iSequence=0;iSequenceupper_[iSequence]+1.0e-9) { moved += upper_[iSequence]-value; upper_[iSequence]=value; } } } assert (moved); reinterpret_cast (this)->gutsOfDual(1, saveDuals, -1, data); } // adjust //printf("Should adjust - moved %g\n",moved); } // Say good factorization factorType = 1; if (data.sparseThreshold_) { // use default at present factorization_->sparseThreshold(0); factorization_->goSparse(); } // exit if victory declared if (problemStatus_ >= 0 && startingTheta>=endingTheta-1.0e-7 ) break; // test for maximum iterations if (hitMaximumIterations()) { problemStatus_ = 3; break; } #ifdef CLP_USER_DRIVEN // Check event { int status = eventHandler_->event(ClpEventHandler::endOfFactorization); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfFactorization; break; } } #endif // Do iterations problemStatus_=-1; whileIterating(paramData, 0.0, NULL); //startingTheta = endingTheta; //endingTheta = saveEndingTheta; } if (!problemStatus_/*||problemStatus_==2*/) { theta_ = endingTheta; #ifdef CLP_USER_DRIVEN { double saveTheta=theta_; theta_ = endingTheta; int status=eventHandler_->event(ClpEventHandler::theta); if (status>=0&&status<10) { endingTheta=theta_; theta_=saveTheta; problemStatus_=-1; } else { if (status>=10) { problemStatus_=status-10; startingTheta=endingTheta; } theta_=saveTheta; } } #endif return 0; } else if (problemStatus_ == 10) { return -1; } else { return problemStatus_; } } /* Checks if finished. Updates status */ void ClpSimplexOther::statusOfProblemInParametrics(int type, ClpDataSave & saveData) { if (type == 2) { // trouble - go to recovery problemStatus_ = 10; return; } if (problemStatus_ > -3 || factorization_->pivots()) { // factorize // later on we will need to recover from singularities // also we could skip if first time if (type) { // is factorization okay? if (internalFactorize(1)) { // trouble - go to recovery problemStatus_ = 10; return; } } if (problemStatus_ != -4 || factorization_->pivots() > 10) problemStatus_ = -3; } // at this stage status is -3 or -4 if looks infeasible // get primal and dual solutions gutsOfSolution(NULL, NULL); double realDualInfeasibilities = sumDualInfeasibilities_; // If bad accuracy treat as singular if ((largestPrimalError_ > 1.0e15 || largestDualError_ > 1.0e15) && numberIterations_) { // trouble - go to recovery problemStatus_ = 10; return; } else if (largestPrimalError_ < 1.0e-7 && largestDualError_ < 1.0e-7) { // Can reduce tolerance double newTolerance = CoinMax(0.99 * factorization_->pivotTolerance(), saveData.pivotTolerance_); factorization_->pivotTolerance(newTolerance); } // Check if looping int loop; if (type != 2) loop = progress_.looping(); else loop = -1; if (loop >= 0) { problemStatus_ = loop; //exit if in loop if (!problemStatus_) { // declaring victory numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } else { problemStatus_ = 10; // instead - try other algorithm } return; } else if (loop < -1) { // something may have changed gutsOfSolution(NULL, NULL); } progressFlag_ = 0; //reset progress flag if (handler_->detail(CLP_SIMPLEX_STATUS, messages_) < 100) { handler_->message(CLP_SIMPLEX_STATUS, messages_) << numberIterations_ << objectiveValue(); handler_->printing(sumPrimalInfeasibilities_ > 0.0) << sumPrimalInfeasibilities_ << numberPrimalInfeasibilities_; handler_->printing(sumDualInfeasibilities_ > 0.0) << sumDualInfeasibilities_ << numberDualInfeasibilities_; handler_->printing(numberDualInfeasibilitiesWithoutFree_ < numberDualInfeasibilities_) << numberDualInfeasibilitiesWithoutFree_; handler_->message() << CoinMessageEol; } #ifdef CLP_USER_DRIVEN if (sumPrimalInfeasibilities_&&sumPrimalInfeasibilities_<1.0e-7) { int status=eventHandler_->event(ClpEventHandler::slightlyInfeasible); if (status>=0) { // fix up for (int iSequence=0;iSequence=upper_[iSequence]+primalTolerance_) { upper_[iSequence]=value; } } numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } } #endif /* If we are primal feasible and any dual infeasibilities are on free variables then it is better to go to primal */ if (!numberPrimalInfeasibilities_ && !numberDualInfeasibilitiesWithoutFree_ && numberDualInfeasibilities_) { problemStatus_ = 10; return; } // check optimal // give code benefit of doubt if (sumOfRelaxedDualInfeasibilities_ == 0.0 && sumOfRelaxedPrimalInfeasibilities_ == 0.0) { // say optimal (with these bounds etc) numberDualInfeasibilities_ = 0; sumDualInfeasibilities_ = 0.0; numberPrimalInfeasibilities_ = 0; sumPrimalInfeasibilities_ = 0.0; } if (dualFeasible() || problemStatus_ == -4) { progress_.modifyObjective(objectiveValue_ - sumDualInfeasibilities_ * dualBound_); } if (numberPrimalInfeasibilities_) { if (problemStatus_ == -4 || problemStatus_ == -5) { problemStatus_ = 1; // infeasible } } else if (numberDualInfeasibilities_) { // clean up problemStatus_ = 10; } else { problemStatus_ = 0; } lastGoodIteration_ = numberIterations_; if (problemStatus_ < 0) { sumDualInfeasibilities_ = realDualInfeasibilities; // back to say be careful if (sumDualInfeasibilities_) numberDualInfeasibilities_ = 1; } // Allow matrices to be sorted etc int fake = -999; // signal sort matrix_->correctSequence(this, fake, fake); } //static double lastThetaX=0.0; /* This has the flow between re-factorizations Reasons to come out: -1 iterations etc -2 inaccuracy -3 slight inaccuracy (and done iterations) +0 looks optimal (might be unbounded - but we will investigate) +1 looks infeasible +3 max iterations +4 accuracy problems */ int ClpSimplexOther::whileIterating(parametricsData & paramData, double /*reportIncrement*/, const double * /*changeObjective*/) { double & startingTheta = paramData.startingTheta; double & endingTheta = paramData.endingTheta; const double * lowerChange = paramData.lowerChange; const double * upperChange = paramData.upperChange; int numberTotal = numberColumns_ + numberRows_; const int * lowerList = paramData.lowerList; const int * upperList = paramData.upperList; //#define CLP_PARAMETRIC_DENSE_ARRAYS 2 #ifdef CLP_PARAMETRIC_DENSE_ARRAYS double * lowerGap = paramData.lowerGap; double * upperGap = paramData.upperGap; double * lowerCoefficient = paramData.lowerCoefficient; double * upperCoefficient = paramData.upperCoefficient; #endif // do basic pointers int * backwardBasic = paramData.backwardBasic; for (int i=0;iclear(); } for (i = 0; i < 2; i++) { columnArray_[i]->clear(); } } // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) factorization_->relaxAccuracyCheck(CoinMin(1.0e2, largestPrimalError_ / 10.0)); else factorization_->relaxAccuracyCheck(1.0); // status stays at -1 while iterating, >=0 finished, -2 to invert // status -3 to go to top without an invert int returnCode = -1; double lastTheta = startingTheta; double useTheta = startingTheta; while (problemStatus_ == -1) { double increaseTheta = CoinMin(endingTheta - lastTheta, 1.0e50); // Get theta for bounds - we know can't crossover int pivotType = nextTheta(1, increaseTheta, paramData, NULL); useTheta += theta_; double change = useTheta - lastTheta; if (paramData.firstIteration) { // redo rhs etc to make as accurate as possible paramData.firstIteration=false; if (change>1.0e-14) { startingTheta=useTheta; lastTheta=startingTheta; change=0.0; // restore rhs const double * saveLower = paramData.lowerChange+2*numberTotal; memcpy(columnLower_,saveLower,numberColumns_*sizeof(double)); memcpy(rowLower_,saveLower+numberColumns_,numberRows_*sizeof(double)); const double * saveUpper = paramData.upperChange+2*numberTotal; memcpy(columnUpper_,saveUpper,numberColumns_*sizeof(double)); memcpy(rowUpper_,saveUpper+numberColumns_,numberRows_*sizeof(double)); paramData.startingTheta=startingTheta; computeRhsEtc(paramData); redoInternalArrays(); // Update solution rowArray_[4]->clear(); for (int i=0;i1.0e-14) { int n; n=lowerList[-1]; for (int i=0;i ( this)->changeBound(iSequence); //ClpTraceDebug (fabs(lower_[iSequence]-newValue)<1.0e-5); } #endif } n=upperList[-1]; for (int i=0;i ( this)->changeBound(iSequence); //ClpTraceDebug (fabs(upper_[iSequence]-newValue)<1.0e-5); } } } sequenceIn_=-1; if (pivotType) { if (useTheta>lastTheta+1.0e-9) { handler_->message(CLP_PARAMETRICS_STATS, messages_) << useTheta << objectiveValue() << CoinMessageEol; lastTheta = useTheta; } problemStatus_ = -2; if (!factorization_->pivots()&&pivotRow_<0) problemStatus_=2; #ifdef CLP_USER_DRIVEN { double saveTheta=theta_; theta_ = endingTheta; if (problemStatus_==2&&theta_>paramData.acceptableMaxTheta) theta_=COIN_DBL_MAX; // we have finished int status=eventHandler_->event(ClpEventHandler::theta); if (status>=0&&status<10) { endingTheta=theta_; problemStatus_=-1; continue; } else { if (status>=10) problemStatus_=status-10; if (status<0) startingTheta = useTheta; } theta_=saveTheta; } #else startingTheta = useTheta; #endif return 4; } // choose row to go out //reinterpret_cast ( this)->dualRow(-1); if (pivotRow_ >= 0) { // we found a pivot row if (handler_->detail(CLP_SIMPLEX_PIVOTROW, messages_) < 100) { handler_->message(CLP_SIMPLEX_PIVOTROW, messages_) << pivotRow_ << CoinMessageEol; } // check accuracy of weights dualRowPivot_->checkAccuracy(); // do ratio test for normal iteration double bestPossiblePivot = bestPivot(); if (sequenceIn_ >= 0) { // normal iteration // update the incoming column double btranAlpha = -alpha_ * directionOut_; // for check #ifndef COIN_FAC_NEW unpackPacked(rowArray_[1]); #else unpack(rowArray_[1]); #endif // and update dual weights (can do in parallel - with extra array) rowArray_[2]->clear(); alpha_ = dualRowPivot_->updateWeights(rowArray_[0], rowArray_[2], rowArray_[3], rowArray_[1]); // see if update stable #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("btran alpha %g, ftran alpha %g\n", btranAlpha, alpha_); #endif double checkValue = 1.0e-7; // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) checkValue = CoinMin(1.0e-4, 1.0e-8 * largestPrimalError_); if (fabs(btranAlpha) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha - alpha_) > checkValue*(1.0 + fabs(alpha_))) { handler_->message(CLP_DUAL_CHECK, messages_) << btranAlpha << alpha_ << CoinMessageEol; // clear arrays rowArray_[4]->clear(); if (factorization_->pivots()) { dualRowPivot_->unrollWeights(); problemStatus_ = -2; // factorize now rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); returnCode = -2; break; } else { // take on more relaxed criterion double test; if (fabs(btranAlpha) < 1.0e-8 || fabs(alpha_) < 1.0e-8) test = 1.0e-1 * fabs(alpha_); else test = 1.0e-4 * (1.0 + fabs(alpha_)); if (fabs(btranAlpha) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha - alpha_) > test) { dualRowPivot_->unrollWeights(); // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; setFlagged(sequenceOut_); progress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); if (fabs(alpha_) < 1.0e-10 && fabs(btranAlpha) < 1.0e-8 && numberIterations_ > 100) { //printf("I think should declare infeasible\n"); problemStatus_ = 1; returnCode = 1; break; } continue; } } } // update duals BEFORE replaceColumn so can do updateColumn double objectiveChange = 0.0; // do duals first as variables may flip bounds // rowArray_[0] and columnArray_[0] may have flips // so use rowArray_[3] for work array from here on int nswapped = 0; //rowArray_[0]->cleanAndPackSafe(1.0e-60); //columnArray_[0]->cleanAndPackSafe(1.0e-60); #if CLP_CAN_HAVE_ZERO_OBJ if ((specialOptions_&2097152)==0) { #endif nswapped = reinterpret_cast ( this)->updateDualsInDual(rowArray_[0], columnArray_[0], rowArray_[2], theta_, objectiveChange, false); assert (!nswapped); #if CLP_CAN_HAVE_ZERO_OBJ } else { rowArray_[0]->clear(); rowArray_[2]->clear(); columnArray_[0]->clear(); } #endif // which will change basic solution if (nswapped) { abort(); //needs testing factorization_->updateColumn(rowArray_[3], rowArray_[2]); dualRowPivot_->updatePrimalSolution(rowArray_[2], 1.0, objectiveChange); // recompute dualOut_ valueOut_ = solution_[sequenceOut_]; if (directionOut_ < 0) { dualOut_ = valueOut_ - upperOut_; } else { dualOut_ = lowerOut_ - valueOut_; } } // amount primal will move double movement = -dualOut_ * directionOut_ / alpha_; // so objective should increase by fabs(dj)*movement // but we already have objective change - so check will be good if (objectiveChange + fabs(movement * dualIn_) < -1.0e-5) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("movement %g, swap change %g, rest %g * %g\n", objectiveChange + fabs(movement * dualIn_), objectiveChange, movement, dualIn_); #endif assert (objectiveChange + fabs(movement * dualIn_) >= -1.0e-5); if(factorization_->pivots()) { // going backwards - factorize dualRowPivot_->unrollWeights(); problemStatus_ = -2; // factorize now returnCode = -2; break; } } CoinAssert(fabs(dualOut_) < 1.0e50); // if stable replace in basis int updateStatus = factorization_->replaceColumn(this, rowArray_[2], rowArray_[1], pivotRow_, alpha_); // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && !factorization_->pivots() && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4) { // slight error if (factorization_->pivots() > 5 || updateStatus == 4) { problemStatus_ = -2; // factorize now returnCode = -3; } } else if (updateStatus == 2) { // major error dualRowPivot_->unrollWeights(); // later we may need to unwind more e.g. fake bounds if (factorization_->pivots()) { problemStatus_ = -2; // factorize now returnCode = -2; break; } else { // need to reject something char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; setFlagged(sequenceOut_); progress_.clearBadTimes(); lastBadIteration_ = numberIterations_; // say be more cautious rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); // make sure dual feasible // look at all rows and columns double objectiveChange = 0.0; reinterpret_cast ( this)->updateDualsInDual(rowArray_[0], columnArray_[0], rowArray_[1], 0.0, objectiveChange, true); continue; } } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (factorization_->pivots() < 0.5 * factorization_->maximumPivots() && factorization_->pivots() < 200) factorization_->areaFactor( factorization_->areaFactor() * 1.1); problemStatus_ = -2; // factorize now } else if (updateStatus == 5) { problemStatus_ = -2; // factorize now } #ifdef CLP_PARAMETRIC_DENSE_ARRAYS int * lowerActive = paramData.lowerActive; int * upperActive = paramData.upperActive; #endif // update change vector { double * work = rowArray_[1]->denseVector(); int number = rowArray_[1]->getNumElements(); int * which = rowArray_[1]->getIndices(); assert (!rowArray_[4]->packedMode()); #ifndef COIN_FAC_NEW assert (rowArray_[1]->packedMode()); #else assert (!rowArray_[1]->packedMode()); #endif double pivotValue = rowArray_[4]->denseVector()[pivotRow_]; double multiplier = -pivotValue/alpha_; double * array=rowArray_[4]->denseVector(); #ifdef CLP_PARAMETRIC_DENSE_ARRAYS int lowerN=lowerActive[-1]; int upperN=upperActive[-1]; #endif if (multiplier) { for (int i = 0; i < number; i++) { int iRow = which[i]; #ifndef COIN_FAC_NEW double alpha=multiplier*work[i]; #else double alpha=multiplier*work[iRow]; #endif #ifdef CLP_PARAMETRIC_DENSE_ARRAYS double alpha3 = alpha+array[iRow]; int iSequence = pivotVariable_[iRow]; double oldLower = lowerCoefficient[iRow]; double oldUpper = upperCoefficient[iRow]; if (lower_[iSequence]>-1.0e30) { //lowerGap[iRow]=value-lower_[iSequence]; double alpha2 = alpha3 + lowerChange[iSequence]; if (alpha2>1.0e-8) { lowerCoefficient[iRow]=alpha2; if (!oldLower) lowerActive[lowerN++]=iRow; } else { if (oldLower) lowerCoefficient[iRow]=COIN_DBL_MIN; } } else { if (oldLower) lowerCoefficient[iRow]=COIN_DBL_MIN; } if (upper_[iSequence]<1.0e30) { //upperGap[iRow]=-(value-upper_[iSequence]); double alpha2 = -(alpha3+upperChange[iSequence]); if (alpha2>1.0e-8) { upperCoefficient[iRow]=alpha2; if (!oldUpper) upperActive[upperN++]=iRow; } else { if (oldUpper) upperCoefficient[iRow]=COIN_DBL_MIN; } } else { if (oldUpper) upperCoefficient[iRow]=COIN_DBL_MIN; } #endif rowArray_[4]->quickAdd(iRow,alpha); } } pivotValue = array[pivotRow_]; // we want pivot to be -multiplier rowArray_[4]->quickAdd(pivotRow_,-multiplier-pivotValue); #ifdef CLP_PARAMETRIC_DENSE_ARRAYS assert (lowerN>=0&&lowerN<=numberRows_); lowerActive[-1]=lowerN; upperActive[-1]=upperN; #endif } // update primal solution #if CLP_CAN_HAVE_ZERO_OBJ if ((specialOptions_&2097152)!=0) theta_=0.0; #endif if (theta_ < 0.0) { #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("negative theta %g\n", theta_); #endif theta_ = 0.0; } // do actual flips reinterpret_cast ( this)->flipBounds(rowArray_[0], columnArray_[0]); //rowArray_[1]->expand(); #ifndef CLP_PARAMETRIC_DENSE_ARRAYS dualRowPivot_->updatePrimalSolution(rowArray_[1], movement, objectiveChange); #else // do by hand { double * work = rowArray_[1]->denseVector(); int number = rowArray_[1]->getNumElements(); int * which = rowArray_[1]->getIndices(); int i; if (rowArray_[1]->packedMode()) { for (i = 0; i < number; i++) { int iRow = which[i]; int iSequence = pivotVariable_[iRow]; double value = solution_[iSequence]; double change = movement * work[i]; value -= change; if (lower_[iSequence]>-1.0e30) lowerGap[iRow]=value-lower_[iSequence]; if (upper_[iSequence]<1.0e30) upperGap[iRow]=-(value-upper_[iSequence]); solution_[iSequence] = value; objectiveChange -= change * cost_[iSequence]; work[i] = 0.0; } } else { for (i = 0; i < number; i++) { int iRow = which[i]; int iSequence = pivotVariable_[iRow]; double value = solution_[iSequence]; double change = movement * work[iRow]; value -= change; solution_[iSequence] = value; objectiveChange -= change * cost_[iSequence]; work[iRow] = 0.0; } } rowArray_[1]->setNumElements(0); } #endif // modify dualout dualOut_ /= alpha_; dualOut_ *= -directionOut_; //setStatus(sequenceIn_,basic); dj_[sequenceIn_] = 0.0; //double oldValue = valueIn_; if (directionIn_ == -1) { // as if from upper bound valueIn_ = upperIn_ + dualOut_; } else { // as if from lower bound valueIn_ = lowerIn_ + dualOut_; } objectiveChange = 0.0; #if CLP_CAN_HAVE_ZERO_OBJ if ((specialOptions_&2097152)==0) { #endif for (int i=0;i 0) { valueOut_ = lowerOut_; dj_[sequenceOut_] = theta_; #if CLP_CAN_HAVE_ZERO_OBJ>1 #ifdef COIN_REUSE_RANDOM if ((specialOptions_&2097152)!=0) { dj_[sequenceOut_] = 1.0e-9*(1.0+CoinDrand48());; } #endif #endif } else { valueOut_ = upperOut_; dj_[sequenceOut_] = -theta_; #if CLP_CAN_HAVE_ZERO_OBJ>1 #ifdef COIN_REUSE_RANDOM if ((specialOptions_&2097152)!=0) { dj_[sequenceOut_] = -1.0e-9*(1.0+CoinDrand48());; } #endif #endif } solution_[sequenceOut_] = valueOut_; int whatNext = housekeeping(objectiveChange); reinterpret_cast(this)->originalBound(sequenceIn_); assert (backwardBasic[sequenceOut_]==pivotRow_); backwardBasic[sequenceOut_]=-1; backwardBasic[sequenceIn_]=pivotRow_; #ifdef CLP_PARAMETRIC_DENSE_ARRAYS double value = solution_[sequenceIn_]; double alpha = rowArray_[4]->denseVector()[pivotRow_]; double oldLower = lowerCoefficient[pivotRow_]; double oldUpper = upperCoefficient[pivotRow_]; if (lower_[sequenceIn_]>-1.0e30) { lowerGap[pivotRow_]=value-lower_[sequenceIn_]; double alpha2 = alpha + lowerChange[sequenceIn_]; if (alpha2>1.0e-8) { lowerCoefficient[pivotRow_]=alpha2; if (!oldLower) { int lowerN=lowerActive[-1]; assert (lowerN>=0&&lowerN1.0e-8) { upperCoefficient[pivotRow_]=alpha2; if (!oldUpper) { int upperN=upperActive[-1]; assert (upperN>=0&&upperNmessage(CLP_PARAMETRICS_STATS2, messages_) << useTheta << objectiveValue() << in << out << CoinMessageEol; } if (useTheta>lastTheta+1.0e-9) { handler_->message(CLP_PARAMETRICS_STATS, messages_) << useTheta << objectiveValue() << CoinMessageEol; lastTheta = useTheta; } // and set bounds correctly originalBound(sequenceIn_,useTheta,lowerChange,upperChange); reinterpret_cast ( this)->changeBound(sequenceOut_); if (whatNext == 1) { problemStatus_ = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent problemStatus_ = 3; returnCode = 3; break; } #ifdef CLP_USER_DRIVEN // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 4; break; } } #endif } else { // no incoming column is valid #ifdef CLP_USER_DRIVEN rowArray_[0]->clear(); columnArray_[0]->clear(); theta_ = useTheta; lastTheta = useTheta; int action = eventHandler_->event(ClpEventHandler::noTheta); if (action>=0) { endingTheta=theta_; theta_ = 0.0; //adjust [4] from handler - but //rowArray_[4]->clear(); // temp if (action>=0&&action<10) problemStatus_=-1; // carry on else if (action==15) problemStatus_ =5; // say stopped returnCode = 1; if (action==0||action>=10) break; else continue; } else { theta_ = 0.0; } #endif pivotRow_ = -1; #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("** no column pivot\n"); #endif if (factorization_->pivots() < 10) { // If we have just factorized and infeasibility reasonable say infeas if (((specialOptions_ & 4096) != 0 || bestPossiblePivot < 1.0e-11) && dualBound_ > 1.0e8) { if (valueOut_ > upperOut_ + 1.0e-3 || valueOut_ < lowerOut_ - 1.0e-3 || (specialOptions_ & 64) == 0) { // say infeasible problemStatus_ = 1; // unless primal feasible!!!! //printf("%d %g %d %g\n",numberPrimalInfeasibilities_,sumPrimalInfeasibilities_, // numberDualInfeasibilities_,sumDualInfeasibilities_); if (numberDualInfeasibilities_) problemStatus_ = 10; rowArray_[0]->clear(); columnArray_[0]->clear(); } } // If special option set - put off as long as possible if ((specialOptions_ & 64) == 0) { problemStatus_ = -4; //say looks infeasible } else { // flag char x = isColumn(sequenceOut_) ? 'C' : 'R'; handler_->message(CLP_SIMPLEX_FLAG, messages_) << x << sequenceWithin(sequenceOut_) << CoinMessageEol; setFlagged(sequenceOut_); if (!factorization_->pivots()) { rowArray_[0]->clear(); columnArray_[0]->clear(); continue; } } } rowArray_[0]->clear(); columnArray_[0]->clear(); returnCode = 1; break; } } else { // no pivot row #ifdef CLP_USER_DRIVEN { double saveTheta=theta_; theta_ = endingTheta; int status=eventHandler_->event(ClpEventHandler::theta); if (status>=0&&status<10) { endingTheta=theta_; theta_=saveTheta; continue; } else { theta_=saveTheta; } } #endif #ifdef CLP_DEBUG if (handler_->logLevel() & 32) printf("** no row pivot\n"); #endif int numberPivots = factorization_->pivots(); bool specialCase; int useNumberFake; returnCode = 0; if (numberPivots < 20 && (specialOptions_ & 2048) != 0 && !numberChanged_ && perturbation_ >= 100 && dualBound_ > 1.0e8) { specialCase = true; // as dual bound high - should be okay useNumberFake = 0; } else { specialCase = false; useNumberFake = numberFake_; } if (!numberPivots || specialCase) { // may have crept through - so may be optimal // check any flagged variables int iRow; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; if (flagged(iPivot)) break; } if (iRow < numberRows_ && numberPivots) { // try factorization returnCode = -2; } if (useNumberFake || numberDualInfeasibilities_) { // may be dual infeasible problemStatus_ = -5; } else { if (iRow < numberRows_) { problemStatus_ = -5; } else { if (numberPivots) { // objective may be wrong objectiveValue_ = innerProduct(cost_, numberColumns_ + numberRows_, solution_); objectiveValue_ += objective_->nonlinearOffset(); objectiveValue_ /= (objectiveScale_ * rhsScale_); if ((specialOptions_ & 16384) == 0) { // and dual_ may be wrong (i.e. for fixed or basic) CoinIndexedVector * arrayVector = rowArray_[1]; arrayVector->clear(); int iRow; double * array = arrayVector->denseVector(); /* Use dual_ instead of array Even though dual_ is only numberRows_ long this is okay as gets permuted to longer rowArray_[2] */ arrayVector->setDenseVector(dual_); int * index = arrayVector->getIndices(); int number = 0; for (iRow = 0; iRow < numberRows_; iRow++) { int iPivot = pivotVariable_[iRow]; double value = cost_[iPivot]; dual_[iRow] = value; if (value) { index[number++] = iRow; } } arrayVector->setNumElements(number); // Extended duals before "updateTranspose" matrix_->dualExpanded(this, arrayVector, NULL, 0); // Btran basic costs rowArray_[2]->clear(); factorization_->updateColumnTranspose(rowArray_[2], arrayVector); // and return vector arrayVector->setDenseVector(array); } } problemStatus_ = 0; sumPrimalInfeasibilities_ = 0.0; if ((specialOptions_&(1024 + 16384)) != 0) { CoinIndexedVector * arrayVector = rowArray_[1]; arrayVector->clear(); double * rhs = arrayVector->denseVector(); times(1.0, solution_, rhs); bool bad2 = false; int i; for ( i = 0; i < numberRows_; i++) { if (rhs[i] < rowLowerWork_[i] - primalTolerance_ || rhs[i] > rowUpperWork_[i] + primalTolerance_) { bad2 = true; } else if (fabs(rhs[i] - rowActivityWork_[i]) > 1.0e-3) { } rhs[i] = 0.0; } for ( i = 0; i < numberColumns_; i++) { if (solution_[i] < columnLowerWork_[i] - primalTolerance_ || solution_[i] > columnUpperWork_[i] + primalTolerance_) { bad2 = true; } } if (bad2) { problemStatus_ = -3; returnCode = -2; // Force to re-factorize early next time int numberPivots = factorization_->pivots(); forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); } } } } } else { problemStatus_ = -3; returnCode = -2; // Force to re-factorize early next time int numberPivots = factorization_->pivots(); forceFactorization_ = CoinMin(forceFactorization_, (numberPivots + 1) >> 1); } break; } } startingTheta = lastTheta+theta_; return returnCode; } // Compute new rowLower_ etc (return negative if infeasible - otherwise largest change) double ClpSimplexOther::computeRhsEtc( parametricsData & paramData) { double maxTheta = COIN_DBL_MAX; double largestChange=0.0; double startingTheta = paramData.startingTheta; const double * lowerChange = paramData.lowerChange+ paramData.unscaledChangesOffset; const double * upperChange = paramData.upperChange+ paramData.unscaledChangesOffset; for (int iRow = 0; iRow < numberRows_; iRow++) { double lower = rowLower_[iRow]; double upper = rowUpper_[iRow]; double chgLower = lowerChange[numberColumns_+iRow]; largestChange=CoinMax(largestChange,fabs(chgLower)); double chgUpper = upperChange[numberColumns_+iRow]; largestChange=CoinMax(largestChange,fabs(chgUpper)); if (lower > -1.0e30 && upper < 1.0e30) { if (lower + maxTheta * chgLower > upper + maxTheta * chgUpper) { maxTheta = (upper - lower) / (chgLower - chgUpper); } } lower+=startingTheta*chgLower; upper+=startingTheta*chgUpper; #ifndef CLP_USER_DRIVEN if (lower > upper) { maxTheta = -1.0; break; } #endif rowLower_[iRow]=lower; rowUpper_[iRow]=upper; } for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double lower = columnLower_[iColumn]; double upper = columnUpper_[iColumn]; double chgLower = lowerChange[iColumn]; largestChange=CoinMax(largestChange,fabs(chgLower)); double chgUpper = upperChange[iColumn]; largestChange=CoinMax(largestChange,fabs(chgUpper)); if (lower > -1.0e30 && upper < 1.0e30) { if (lower + maxTheta * chgLower > upper + maxTheta * chgUpper) { maxTheta = (upper - lower) / (chgLower - chgUpper); } } lower+=startingTheta*chgLower; upper+=startingTheta*chgUpper; #ifndef CLP_USER_DRIVEN if (lower > upper) { maxTheta = -1.0; break; } #endif columnLower_[iColumn]=lower; columnUpper_[iColumn]=upper; } #ifndef CLP_USER_DRIVEN paramData.maxTheta=maxTheta; if (maxTheta<0) largestChange=-1.0; // signal infeasible #else // maxTheta already set /* given largest change element choose acceptable end be safe and make sure difference < 0.1*tolerance */ double acceptableDifference=0.1*primalTolerance_/ CoinMax(largestChange,1.0); paramData.acceptableMaxTheta=maxTheta-acceptableDifference; #endif return largestChange; } // Redo lower_ from rowLower_ etc void ClpSimplexOther::redoInternalArrays() { double * lowerSave = lower_; double * upperSave = upper_; memcpy(lowerSave,columnLower_,numberColumns_*sizeof(double)); memcpy(lowerSave+numberColumns_,rowLower_,numberRows_*sizeof(double)); memcpy(upperSave,columnUpper_,numberColumns_*sizeof(double)); memcpy(upperSave+numberColumns_,rowUpper_,numberRows_*sizeof(double)); if (rowScale_) { // scale arrays for (int i=0;i-1.0e20) lowerSave[i] *= multiplier; if (upperSave[i]<1.0e20) upperSave[i] *= multiplier; } lowerSave += numberColumns_; upperSave += numberColumns_; for (int i=0;i-1.0e20) lowerSave[i] *= multiplier; if (upperSave[i]<1.0e20) upperSave[i] *= multiplier; } } } #if 0 static int zzzzzz=0; int zzzzzzOther=0; #endif // Finds best possible pivot double ClpSimplexOther::bestPivot(bool justColumns) { // Get good size for pivot // Allow first few iterations to take tiny double acceptablePivot = 1.0e-9; if (numberIterations_ > 100) acceptablePivot = 1.0e-8; if (factorization_->pivots() > 10 || (factorization_->pivots() && sumDualInfeasibilities_)) acceptablePivot = 1.0e-5; // if we have iterated be more strict else if (factorization_->pivots() > 5) acceptablePivot = 1.0e-6; // if we have iterated be slightly more strict else if (factorization_->pivots()) acceptablePivot = 1.0e-8; // relax double bestPossiblePivot = 1.0; // get sign for finding row of tableau // normal iteration // create as packed double direction = directionOut_; #ifndef COIN_FAC_NEW rowArray_[0]->createPacked(1, &pivotRow_, &direction); #else rowArray_[0]->createOneUnpackedElement(pivotRow_, direction); #endif factorization_->updateColumnTranspose(rowArray_[1], rowArray_[0]); // put row of tableau in rowArray[0] and columnArray[0] matrix_->transposeTimes(this, -1.0, rowArray_[0], rowArray_[3], columnArray_[0]); sequenceIn_=-1; if (justColumns) rowArray_[0]->clear(); // do ratio test for normal iteration bestPossiblePivot = reinterpret_cast ( this)->dualColumn(rowArray_[0], columnArray_[0], columnArray_[1], rowArray_[3], acceptablePivot, NULL); return bestPossiblePivot; } // Computes next theta and says if objective or bounds (0= bounds, 1 objective, -1 none) int ClpSimplexOther::nextTheta(int /*type*/, double maxTheta, parametricsData & paramData, const double * /*changeObjective*/) { const double * lowerChange = paramData.lowerChange; const double * upperChange = paramData.upperChange; const int * lowerList = paramData.lowerList; const int * upperList = paramData.upperList; int iSequence; bool toLower = false; //assert (type==1); // may need to decide based on model? bool needFullUpdate = rowArray_[4]->getNumElements()==0; double * array = rowArray_[4]->denseVector(); //rowArray_[4]->checkClean(); const int * row = matrix_->getIndices(); const int * columnLength = matrix_->getVectorLengths(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const double * elementByColumn = matrix_->getElements(); #if 0 double tempArray[5000]; bool checkIt=false; if (factorization_->pivots()&&!needFullUpdate&&sequenceIn_<0) { memcpy(tempArray,array,numberRows_*sizeof(double)); checkIt=true; needFullUpdate=true; } #endif #ifdef CLP_PARAMETRIC_DENSE_ARRAYS double * lowerGap = paramData.lowerGap; double * upperGap = paramData.upperGap; double * lowerCoefficient = paramData.lowerCoefficient; double * upperCoefficient = paramData.upperCoefficient; int * lowerActive=paramData.lowerActive; int * upperActive=paramData.upperActive; #endif if (!factorization_->pivots()||needFullUpdate) { //zzzzzz=0; rowArray_[4]->clear(); // get change if (!rowScale_) { int n; n=lowerList[-2]; int i; for (i=0;iquickAdd(row[j], elementByColumn[j]*value); } } } n=lowerList[-1]; const double * change = lowerChange+numberColumns_; for (;i=0); if (getRowStatus(iSequence)==atLowerBound) { double value=change[iSequence]; rowArray_[4]->quickAdd(iSequence, -value); } } n=upperList[-2]; for (i=0;iquickAdd(row[j], elementByColumn[j]*value); } } } n=upperList[-1]; change = upperChange+numberColumns_; for (;i=0); if (getRowStatus(iSequence)==atUpperBound) { double value=change[iSequence]; rowArray_[4]->quickAdd(iSequence, -value); } } } else { int n; n=lowerList[-2]; int i; for (i=0;iquickAdd(iRow, elementByColumn[j]*scale * rowScale_[iRow]*value); } } } n=lowerList[-1]; const double * change = lowerChange+numberColumns_; for (;i=0); if (getRowStatus(iSequence)==atLowerBound) { double value=change[iSequence]; rowArray_[4]->quickAdd(iSequence, -value); } } n=upperList[-2]; for (i=0;iquickAdd(iRow, elementByColumn[j]*scale * rowScale_[iRow]*value); } } } n=upperList[-1]; change = upperChange+numberColumns_; for (;i=0); if (getRowStatus(iSequence)==atUpperBound) { double value=change[iSequence]; rowArray_[4]->quickAdd(iSequence, -value); } } } // ftran it factorization_->updateColumn(rowArray_[0], rowArray_[4]); #if 0 if (checkIt) { for (int i=0;i 1.0e-8&&lower_[iSequence]>-1.0e30) { double currentLower = lower_[iSequence]; ClpTraceDebug (currentSolution >= currentLower - 100.0*primalTolerance_); double gap=currentSolution-currentLower; lowerGap[iRow]=gap; lowerCoefficient[iRow]=thetaCoefficientLower; lowerActive[lowerN++]=iRow; //} else { //lowerCoefficient[iRow]=0.0; } if (thetaCoefficientUpper < -1.0e-8&&upper_[iSequence]<1.0e30) { double currentUpper = upper_[iSequence]; ClpTraceDebug (currentSolution <= currentUpper + 100.0*primalTolerance_); double gap2=-(currentSolution-currentUpper); //positive upperGap[iRow]=gap2; upperCoefficient[iRow]=-thetaCoefficientUpper; upperActive[upperN++]=iRow; } } assert (lowerN>=0&&lowerN<=numberRows_); lowerActive[-1]=lowerN; upperActive[-1]=upperN; #endif } else if (sequenceIn_>=0) { //assert (sequenceIn_>=0); assert (sequenceOut_>=0); assert (sequenceIn_!=sequenceOut_); double change = (directionIn_>0) ? -lowerChange[sequenceIn_] : -upperChange[sequenceIn_]; int needed=0; assert (!rowArray_[5]->getNumElements()); if (change) { if (sequenceIn_quickAdd(row[i], elementByColumn[i]*change); } } else { // apply scaling double scale = columnScale_[sequenceIn_]; for (CoinBigIndex i = columnStart[sequenceIn_]; i < columnStart[sequenceIn_] + columnLength[sequenceIn_]; i++) { int iRow = row[i]; rowArray_[5]->quickAdd(iRow, elementByColumn[i]*scale * rowScale_[iRow]*change); } } } else { rowArray_[5]->insert(sequenceIn_-numberColumns_,-change); } needed++; } if (getStatus(sequenceOut_)==atLowerBound) change=lowerChange[sequenceOut_]; else change=upperChange[sequenceOut_]; if (change) { if (sequenceOut_quickAdd(row[i], elementByColumn[i]*change); } } else { // apply scaling double scale = columnScale_[sequenceOut_]; for (CoinBigIndex i = columnStart[sequenceOut_]; i < columnStart[sequenceOut_] + columnLength[sequenceOut_]; i++) { int iRow = row[i]; rowArray_[5]->quickAdd(iRow, elementByColumn[i]*scale * rowScale_[iRow]*change); } } } else { rowArray_[5]->quickAdd(sequenceOut_-numberColumns_,-change); } needed++; } //printf("seqin %d seqout %d needed %d\n", // sequenceIn_,sequenceOut_,needed); if (needed) { // ftran it factorization_->updateColumn(rowArray_[0], rowArray_[5]); // add double * array5 = rowArray_[5]->denseVector(); int * index5 = rowArray_[5]->getIndices(); int number5 = rowArray_[5]->getNumElements(); #ifdef CLP_PARAMETRIC_DENSE_ARRAYS int lowerN=lowerActive[-1]; int upperN=upperActive[-1]; int nIn4=rowArray_[4]->getNumElements(); int * index4 = rowArray_[4]->getIndices(); #endif for (int i = 0; i < number5; i++) { int iPivot = index5[i]; #ifndef CLP_PARAMETRIC_DENSE_ARRAYS rowArray_[4]->quickAdd(iPivot,array5[iPivot]); #else /* later for sparse - modify here */ int iSequence = pivotVariable_[iPivot]; double currentSolution = solution_[iSequence]; double currentAlpha = array[iPivot]; double alpha5 = array5[iPivot]; double alpha = currentAlpha+alpha5; if (currentAlpha) { if (alpha) { array[iPivot] = alpha; } else { array[iPivot] = COIN_DBL_MIN; } } else { index4[nIn4++] = iPivot; array[iPivot] = alpha; } double thetaCoefficientLower = lowerChange[iSequence] + alpha; double thetaCoefficientUpper = upperChange[iSequence] + alpha; double oldLower = lowerCoefficient[iPivot]; double oldUpper = upperCoefficient[iPivot]; if (thetaCoefficientLower > 1.0e-8&&lower_[iSequence]>-1.0e30) { double currentLower = lower_[iSequence]; ClpTraceDebug (currentSolution >= currentLower - 100.0*primalTolerance_); double gap=currentSolution-currentLower; lowerGap[iPivot]=gap; lowerCoefficient[iPivot]=thetaCoefficientLower; if (!oldLower) lowerActive[lowerN++]=iPivot; } else { if (oldLower) lowerCoefficient[iPivot]=COIN_DBL_MIN; } if (thetaCoefficientUpper < -1.0e-8&&upper_[iSequence]<1.0e30) { double currentUpper = upper_[iSequence]; ClpTraceDebug (currentSolution <= currentUpper + 100.0*primalTolerance_); double gap2=-(currentSolution-currentUpper); //positive upperGap[iPivot]=gap2; upperCoefficient[iPivot]=-thetaCoefficientUpper; if (!oldUpper) upperActive[upperN++]=iPivot; } else { if (oldUpper) upperCoefficient[iPivot]=COIN_DBL_MIN; } #endif array5[iPivot]=0.0; } rowArray_[5]->setNumElements(0); #ifdef CLP_PARAMETRIC_DENSE_ARRAYS rowArray_[4]->setNumElements(nIn4); assert (lowerN>=0&&lowerN<=numberRows_); lowerActive[-1]=lowerN; upperActive[-1]=upperN; #endif } } const int * index = rowArray_[4]->getIndices(); int number = rowArray_[4]->getNumElements(); #define TESTXX 0 #ifndef CLP_PARAMETRIC_DENSE_ARRAYS //TESTXX int * markDone = reinterpret_cast(paramData.markDone); int nToZero=(numberRows_+numberColumns_+COIN_ANY_BITS_PER_INT-1)>>COIN_ANY_SHIFT_PER_INT; memset(markDone,0,nToZero*sizeof(int)); const int * backwardBasic = paramData.backwardBasic; #endif // first ones with alpha double theta1=maxTheta; int pivotRow1=-1; #ifndef CLP_PARAMETRIC_DENSE_ARRAYS //TESTXX int pivotRow2=-1; double theta2=maxTheta; #endif #ifndef CLP_PARAMETRIC_DENSE_ARRAYS //TESTXX for (int i=0;i> COIN_ANY_SHIFT_PER_INT; int bit = iSequence & COIN_ANY_MASK_PER_INT; markDone[word] |= ( 1 << bit ); // solution value will be sol - theta*alpha // bounds will be bounds + change *theta double currentSolution = solution_[iSequence]; double alpha = array[iPivot]; double thetaCoefficientLower = lowerChange[iSequence] + alpha; double thetaCoefficientUpper = upperChange[iSequence] + alpha; if (thetaCoefficientLower > 1.0e-8) { double currentLower = lower_[iSequence]; ClpTraceDebug (currentSolution >= currentLower - 100.0*primalTolerance_); assert (currentSolution >= currentLower - 100.0*primalTolerance_); double gap=currentSolution-currentLower; if (thetaCoefficientLower*theta1>gap) { theta1 = gap/thetaCoefficientLower; //toLower=true; pivotRow1=iPivot; } } if (thetaCoefficientUpper < -1.0e-8) { double currentUpper = upper_[iSequence]; ClpTraceDebug (currentSolution <= currentUpper + 100.0*primalTolerance_); assert (currentSolution <= currentUpper + 100.0*primalTolerance_); double gap2=currentSolution-currentUpper; //negative if (thetaCoefficientUpper*theta2> COIN_ANY_SHIFT_PER_INT; int bit = iSequence & COIN_ANY_MASK_PER_INT; if (getColumnStatus(iSequence)==basic&&(markDone[word]&(1<= currentLower - 100.0*primalTolerance_); double thetaCoefficient = lowerChange[iSequence]; if (thetaCoefficient > 0.0) { double gap=currentSolution-currentLower; if (thetaCoefficient*theta1>gap) { theta1 = gap/thetaCoefficient; //toLower=true; pivotRow1 = backwardBasic[iSequence]; } } } } nLook=upperList[-1]; for (int i=0;i> COIN_ANY_SHIFT_PER_INT; int bit = iSequence & COIN_ANY_MASK_PER_INT; if (getColumnStatus(iSequence)==basic&&(markDone[word]&(1< 1.0e-8&&lower_[iSequence]>-1.0e30) { assert(fabs(checkArray[iRow]-thetaCoefficient)<1.0e-5); if(fabs(checkArray[iRow]-thetaCoefficient)>1.0e-5) { abort(); } } else { assert (fabs(checkArray[iRow])<1.0e-12); if (fabs(checkArray[iRow])>1.0e-12) { abort(); } } checkArray[iRow]=0.0; } for (int i=0;i 1.0e-8&&upper_[iSequence]<1.0e30) { assert(fabs(checkArray[iRow]-thetaCoefficient)<1.0e-5); if(fabs(checkArray[iRow]-thetaCoefficient)>1.0e-5) { abort(); } } else { assert (fabs(checkArray[iRow])<1.0e-12); if (fabs(checkArray[iRow])>1.0e-12) { abort(); } } checkArray[iRow]=0.0; } for (int i=0;igap-1.0e-8); if (lowerC*theta3gap&&lowerC!=COIN_DBL_MIN) { theta3 = gap/lowerC; pivotRow3=iRow; } } int pivotRow4=pivotRow3; double theta4=theta3; int upperN=upperActive[-1]; for (int i=0;igap-1.0e-8); if (upperC*theta3gap&&upperC!=COIN_DBL_MIN) { theta4 = gap/upperC; pivotRow4=iRow; } } bool toLower3; if (theta41.0e-8) abort(); if (toLower!=toLower3||pivotRow_!=pivotRow3) { printf("bad piv - good %d %g %s, bad %d %g %s\n",pivotRow_,theta_,toLower ? "toLower" : "toUpper", pivotRow3,theta3,toLower3 ? "toLower" : "toUpper"); //zzzzzz++; if (true/*zzzzzz>zzzzzzOther*/) { printf("Swapping\n"); pivotRow_=pivotRow3; theta_=theta3; toLower=toLower3; } } #endif #endif #else #if 0 //CLP_PARAMETRIC_DENSE_ARRAYS==2 { double * checkArray = new double[numberRows_]; memcpy(checkArray,lowerCoefficient,numberRows_*sizeof(double)); int lowerN=lowerActive[-1]; for (int i=0;igap&&lowerC!=COIN_DBL_MIN) { theta1 = gap/lowerC; pivotRow1=iRow; } } pivotRow_=pivotRow1; theta_=theta1; int upperN=upperActive[-1]; for (int i=0;igap&&upperC!=COIN_DBL_MIN) { theta1 = gap/upperC; pivotRow1=iRow; } } if (theta11.0e-15) { // update solution for (int iRow = 0; iRow < number; iRow++) { int iPivot = index[iRow]; iSequence = pivotVariable_[iPivot]; // solution value will be sol - theta*alpha double alpha = array[iPivot]; double currentSolution = solution_[iSequence] - theta_ * alpha; solution_[iSequence] =currentSolution; #ifdef CLP_PARAMETRIC_DENSE_ARRAYS if (lower_[iSequence]>-1.0e30) lowerGap[iPivot]=currentSolution-lower_[iSequence]; if (upper_[iSequence]<1.0e30) upperGap[iPivot]=-(currentSolution-upper_[iSequence]); #endif } } #ifdef CLP_PARAMETRIC_DENSE_ARRAYS if (pivotRow_>=0&&false) { double oldValue = upperCoefficient[pivotRow_]; double value = array[pivotRow_]; if (value) { if (!oldValue) { int upperN=upperActive[-1]; assert (upperN>=0&&upperN= 0) { sequenceOut_ = pivotVariable_[pivotRow_]; valueOut_ = solution_[sequenceOut_]; lowerOut_ = lower_[sequenceOut_]+theta_*lowerChange[sequenceOut_]; upperOut_ = upper_[sequenceOut_]+theta_*upperChange[sequenceOut_]; if (!toLower) { directionOut_ = -1; dualOut_ = valueOut_ - upperOut_; } else { directionOut_ = 1; dualOut_ = lowerOut_ - valueOut_; } return 0; } else { //theta_=0.0; return -1; } } // Restores bound to original bound void ClpSimplexOther::originalBound(int iSequence, double theta, const double * lowerChange, const double * upperChange) { if (getFakeBound(iSequence) != noFake) { numberFake_--; setFakeBound(iSequence, noFake); if (iSequence >= numberColumns_) { // rows int iRow = iSequence - numberColumns_; rowLowerWork_[iRow] = rowLower_[iRow]+theta*lowerChange[iSequence]; rowUpperWork_[iRow] = rowUpper_[iRow]+theta*upperChange[iSequence]; if (rowScale_) { if (rowLowerWork_[iRow] > -1.0e50) rowLowerWork_[iRow] *= rowScale_[iRow] * rhsScale_; if (rowUpperWork_[iRow] < 1.0e50) rowUpperWork_[iRow] *= rowScale_[iRow] * rhsScale_; } else if (rhsScale_ != 1.0) { if (rowLowerWork_[iRow] > -1.0e50) rowLowerWork_[iRow] *= rhsScale_; if (rowUpperWork_[iRow] < 1.0e50) rowUpperWork_[iRow] *= rhsScale_; } } else { // columns columnLowerWork_[iSequence] = columnLower_[iSequence]+theta*lowerChange[iSequence]; columnUpperWork_[iSequence] = columnUpper_[iSequence]+theta*upperChange[iSequence]; if (rowScale_) { double multiplier = 1.0 * inverseColumnScale_[iSequence]; if (columnLowerWork_[iSequence] > -1.0e50) columnLowerWork_[iSequence] *= multiplier * rhsScale_; if (columnUpperWork_[iSequence] < 1.0e50) columnUpperWork_[iSequence] *= multiplier * rhsScale_; } else if (rhsScale_ != 1.0) { if (columnLowerWork_[iSequence] > -1.0e50) columnLowerWork_[iSequence] *= rhsScale_; if (columnUpperWork_[iSequence] < 1.0e50) columnUpperWork_[iSequence] *= rhsScale_; } } } } /* Expands out all possible combinations for a knapsack If buildObj NULL then just computes space needed - returns number elements On entry numberOutput is maximum allowed, on exit it is number needed or -1 (as will be number elements) if maximum exceeded. numberOutput will have at least space to return values which reconstruct input. Rows returned will be original rows but no entries will be returned for any rows all of whose entries are in knapsack. So up to user to allow for this. If reConstruct >=0 then returns number of entrie which make up item "reConstruct" in expanded knapsack. Values in buildRow and buildElement; */ int ClpSimplexOther::expandKnapsack(int knapsackRow, int & numberOutput, double * buildObj, CoinBigIndex * buildStart, int * buildRow, double * buildElement, int reConstruct) const { int iRow; int iColumn; // Get column copy CoinPackedMatrix * columnCopy = matrix(); // Get a row copy in standard format CoinPackedMatrix matrixByRow; matrixByRow.reverseOrderedCopyOf(*columnCopy); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); CoinBigIndex j; int * whichColumn = new int [numberColumns_]; int * whichRow = new int [numberRows_]; int numJ = 0; // Get what other columns can compensate for double * lo = new double [numberRows_]; double * high = new double [numberRows_]; { // Use to get tight column bounds ClpSimplex tempModel(*this); tempModel.tightenPrimalBounds(0.0, 0, true); // Now another model without knapsacks int nCol = 0; for (iRow = 0; iRow < numberRows_; iRow++) { whichRow[iRow] = iRow; } for (iColumn = 0; iColumn < numberColumns_; iColumn++) whichColumn[iColumn] = -1; for (j = rowStart[knapsackRow]; j < rowStart[knapsackRow] + rowLength[knapsackRow]; j++) { int iColumn = column[j]; if (columnUpper_[iColumn] > columnLower_[iColumn]) { whichColumn[iColumn] = 0; } else { assert (!columnLower_[iColumn]); // fix later } } for (iColumn = 0; iColumn < numberColumns_; iColumn++) { if (whichColumn[iColumn] < 0) whichColumn[nCol++] = iColumn; } ClpSimplex tempModel2(&tempModel, numberRows_, whichRow, nCol, whichColumn, false, false, false); // Row copy CoinPackedMatrix matrixByRow; matrixByRow.reverseOrderedCopyOf(*tempModel2.matrix()); const double * elementByRow = matrixByRow.getElements(); const int * column = matrixByRow.getIndices(); const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); const int * rowLength = matrixByRow.getVectorLengths(); const double * columnLower = tempModel2.getColLower(); const double * columnUpper = tempModel2.getColUpper(); for (iRow = 0; iRow < numberRows_; iRow++) { lo[iRow] = -COIN_DBL_MAX; high[iRow] = COIN_DBL_MAX; if (rowLower_[iRow] > -1.0e20 || rowUpper_[iRow] < 1.0e20) { // possible row int infiniteUpper = 0; int infiniteLower = 0; double maximumUp = 0.0; double maximumDown = 0.0; CoinBigIndex rStart = rowStart[iRow]; CoinBigIndex rEnd = rowStart[iRow] + rowLength[iRow]; CoinBigIndex j; // Compute possible lower and upper ranges for (j = rStart; j < rEnd; ++j) { double value = elementByRow[j]; iColumn = column[j]; if (value > 0.0) { if (columnUpper[iColumn] >= 1.0e20) { ++infiniteUpper; } else { maximumUp += columnUpper[iColumn] * value; } if (columnLower[iColumn] <= -1.0e20) { ++infiniteLower; } else { maximumDown += columnLower[iColumn] * value; } } else if (value < 0.0) { if (columnUpper[iColumn] >= 1.0e20) { ++infiniteLower; } else { maximumDown += columnUpper[iColumn] * value; } if (columnLower[iColumn] <= -1.0e20) { ++infiniteUpper; } else { maximumUp += columnLower[iColumn] * value; } } } // Build in a margin of error maximumUp += 1.0e-8 * fabs(maximumUp) + 1.0e-7; maximumDown -= 1.0e-8 * fabs(maximumDown) + 1.0e-7; // we want to save effective rhs double up = (infiniteUpper) ? COIN_DBL_MAX : maximumUp; double down = (infiniteLower) ? -COIN_DBL_MAX : maximumDown; if (up == COIN_DBL_MAX || rowLower_[iRow] == -COIN_DBL_MAX) { // However low we go it doesn't matter lo[iRow] = -COIN_DBL_MAX; } else { // If we go below this then can not be feasible lo[iRow] = rowLower_[iRow] - up; } if (down == -COIN_DBL_MAX || rowUpper_[iRow] == COIN_DBL_MAX) { // However high we go it doesn't matter high[iRow] = COIN_DBL_MAX; } else { // If we go above this then can not be feasible high[iRow] = rowUpper_[iRow] - down; } } } } numJ = 0; for (iColumn = 0; iColumn < numberColumns_; iColumn++) whichColumn[iColumn] = -1; int * markRow = new int [numberRows_]; for (iRow = 0; iRow < numberRows_; iRow++) markRow[iRow] = 1; for (j = rowStart[knapsackRow]; j < rowStart[knapsackRow] + rowLength[knapsackRow]; j++) { int iColumn = column[j]; if (columnUpper_[iColumn] > columnLower_[iColumn]) { whichColumn[iColumn] = numJ; numJ++; } } /* mark rows -n in knapsack and n other variables 1 no entries n+1000 not involved in knapsack but n entries 0 only in knapsack */ for (iRow = 0; iRow < numberRows_; iRow++) { int type = 1; for (j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; if (whichColumn[iColumn] >= 0) { if (type == 1) { type = 0; } else if (type > 0) { assert (type > 1000); type = -(type - 1000); } } else if (type == 1) { type = 1001; } else if (type < 0) { type --; } else if (type == 0) { type = -1; } else { assert (type > 1000); type++; } } markRow[iRow] = type; if (type < 0 && type > -30 && false) printf("markrow on row %d is %d\n", iRow, markRow[iRow]); } int * bound = new int [numberColumns_+1]; int * stack = new int [numberColumns_+1]; int * flip = new int [numberColumns_+1]; double * offset = new double[numberColumns_+1]; double * size = new double [numberColumns_+1]; double * rhsOffset = new double[numberRows_]; int * build = new int[numberColumns_]; int maxNumber = numberOutput; numJ = 0; double minSize = rowLower_[knapsackRow]; double maxSize = rowUpper_[knapsackRow]; double knapsackOffset = 0.0; for (j = rowStart[knapsackRow]; j < rowStart[knapsackRow] + rowLength[knapsackRow]; j++) { int iColumn = column[j]; double lowerColumn = columnLower_[iColumn]; double upperColumn = columnUpper_[iColumn]; if (lowerColumn == upperColumn) continue; double gap = upperColumn - lowerColumn; if (gap > 1.0e8) gap = 1.0e8; assert (fabs(floor(gap + 0.5) - gap) < 1.0e-5); whichColumn[numJ] = iColumn; bound[numJ] = static_cast (gap); if (elementByRow[j] > 0.0) { flip[numJ] = 1; offset[numJ] = lowerColumn; size[numJ++] = elementByRow[j]; } else { flip[numJ] = -1; offset[numJ] = upperColumn; size[numJ++] = -elementByRow[j]; lowerColumn = upperColumn; } knapsackOffset += elementByRow[j] * lowerColumn; } int jRow; for (iRow = 0; iRow < numberRows_; iRow++) whichRow[iRow] = iRow; ClpSimplex smallModel(this, numberRows_, whichRow, numJ, whichColumn, true, true, true); // modify rhs to allow for nonzero lower bounds //double * rowLower = smallModel.rowLower(); //double * rowUpper = smallModel.rowUpper(); //const double * columnLower = smallModel.columnLower(); //const double * columnUpper = smallModel.columnUpper(); const CoinPackedMatrix * matrix = smallModel.matrix(); const double * element = matrix->getElements(); const int * row = matrix->getIndices(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const int * columnLength = matrix->getVectorLengths(); const double * objective = smallModel.objective(); //double objectiveOffset=0.0; // would use for fixed? CoinZeroN(rhsOffset, numberRows_); double * rowActivity = smallModel.primalRowSolution(); CoinZeroN(rowActivity, numberRows_); maxSize -= knapsackOffset; minSize -= knapsackOffset; // now generate int i; int iStack = numJ; for (i = 0; i < numJ; i++) { stack[i] = 0; } double tooMuch = 10.0 * maxSize + 10000; stack[numJ] = 1; size[numJ] = tooMuch; bound[numJ] = 0; double sum = tooMuch; // allow for all zero being OK stack[numJ-1] = -1; sum -= size[numJ-1]; numberOutput = 0; int nelCreate = 0; /* typeRun is - 0 for initial sizes 1 for build 2 for reconstruct */ int typeRun = buildObj ? 1 : 0; if (reConstruct >= 0) { assert (buildRow && buildElement); typeRun = 2; } if (typeRun == 1) buildStart[0] = 0; while (iStack >= 0) { if (sum >= minSize && sum <= maxSize) { double checkSize = 0.0; bool good = true; int nRow = 0; double obj = 0.0; CoinZeroN(rowActivity, numberRows_); for (iColumn = 0; iColumn < numJ; iColumn++) { int iValue = stack[iColumn]; if (iValue > bound[iColumn]) { good = false; break; } else { double realValue = offset[iColumn] + flip[iColumn] * iValue; if (realValue) { obj += objective[iColumn] * realValue; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { double value = element[j] * realValue; int kRow = row[j]; if (rowActivity[kRow]) { rowActivity[kRow] += value; if (!rowActivity[kRow]) rowActivity[kRow] = 1.0e-100; } else { build[nRow++] = kRow; rowActivity[kRow] = value; } } } } } if (good) { for (jRow = 0; jRow < nRow; jRow++) { int kRow = build[jRow]; double value = rowActivity[kRow]; if (value > high[kRow] || value < lo[kRow]) { good = false; break; } } } if (good) { if (typeRun == 1) { buildObj[numberOutput] = obj; for (jRow = 0; jRow < nRow; jRow++) { int kRow = build[jRow]; double value = rowActivity[kRow]; if (markRow[kRow] < 0 && fabs(value) > 1.0e-13) { buildElement[nelCreate] = value; buildRow[nelCreate++] = kRow; } } buildStart[numberOutput+1] = nelCreate; } else if (!typeRun) { for (jRow = 0; jRow < nRow; jRow++) { int kRow = build[jRow]; double value = rowActivity[kRow]; if (markRow[kRow] < 0 && fabs(value) > 1.0e-13) { nelCreate++; } } } if (typeRun == 2 && reConstruct == numberOutput) { // build and exit nelCreate = 0; for (iColumn = 0; iColumn < numJ; iColumn++) { int iValue = stack[iColumn]; double realValue = offset[iColumn] + flip[iColumn] * iValue; if (realValue) { buildRow[nelCreate] = whichColumn[iColumn]; buildElement[nelCreate++] = realValue; } } numberOutput = 1; for (i = 0; i < numJ; i++) { bound[i] = 0; } break; } numberOutput++; if (numberOutput > maxNumber) { nelCreate = -numberOutput; numberOutput = -1; for (i = 0; i < numJ; i++) { bound[i] = 0; } break; } else if (typeRun == 1 && numberOutput == maxNumber) { // On second run for (i = 0; i < numJ; i++) { bound[i] = 0; } break; } for (int j = 0; j < numJ; j++) { checkSize += stack[j] * size[j]; } assert (fabs(sum - checkSize) < 1.0e-3); } for (jRow = 0; jRow < nRow; jRow++) { int kRow = build[jRow]; rowActivity[kRow] = 0.0; } } if (sum > maxSize || stack[iStack] > bound[iStack]) { sum -= size[iStack] * stack[iStack]; stack[iStack--] = 0; if (iStack >= 0) { stack[iStack] ++; sum += size[iStack]; } } else { // must be less // add to last possible iStack = numJ - 1; sum += size[iStack]; stack[iStack]++; } } //printf("%d will be created\n",numberOutput); delete [] whichColumn; delete [] whichRow; delete [] bound; delete [] stack; delete [] flip; delete [] size; delete [] offset; delete [] rhsOffset; delete [] build; delete [] markRow; delete [] lo; delete [] high; return nelCreate; } // Quick try at cleaning up duals if postsolve gets wrong void ClpSimplexOther::cleanupAfterPostsolve() { // First mark singleton equality rows char * mark = new char [ numberRows_]; memset(mark, 0, numberRows_); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * element = matrix_->getElements(); for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (mark[iRow]) mark[iRow] = 2; else mark[iRow] = 1; } } // for now just == rows for (int iRow = 0; iRow < numberRows_; iRow++) { if (rowUpper_[iRow] > rowLower_[iRow]) mark[iRow] = 3; } double dualTolerance = dblParam_[ClpDualTolerance]; double primalTolerance = dblParam_[ClpPrimalTolerance]; int numberCleaned = 0; double maxmin = optimizationDirection_; for (int iColumn = 0; iColumn < numberColumns_; iColumn++) { double dualValue = reducedCost_[iColumn] * maxmin; double primalValue = columnActivity_[iColumn]; double lower = columnLower_[iColumn]; double upper = columnUpper_[iColumn]; int way = 0; switch(getColumnStatus(iColumn)) { case basic: // dual should be zero if (dualValue > dualTolerance) { way = -1; } else if (dualValue < -dualTolerance) { way = 1; } break; case ClpSimplex::isFixed: break; case atUpperBound: // dual should not be positive if (dualValue > dualTolerance) { way = -1; } break; case atLowerBound: // dual should not be negative if (dualValue < -dualTolerance) { way = 1; } break; case superBasic: case isFree: if (primalValue < upper - primalTolerance) { // dual should not be negative if (dualValue < -dualTolerance) { way = 1; } } if (primalValue > lower + primalTolerance) { // dual should not be positive if (dualValue > dualTolerance) { way = -1; } } break; } if (way) { // see if can find singleton row for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (mark[iRow] == 1) { double value = element[j]; // dj - addDual*value == 0.0 double addDual = dualValue / value; dual_[iRow] += addDual; reducedCost_[iColumn] = 0.0; numberCleaned++; break; } } } } delete [] mark; #ifdef CLP_INVESTIGATE printf("cleanupAfterPostsolve cleaned up %d columns\n", numberCleaned); #endif // Redo memcpy(reducedCost_, this->objective(), numberColumns_ * sizeof(double)); matrix_->transposeTimes(-1.0, dual_, reducedCost_); checkSolutionInternal(); } // Returns gub version of model or NULL ClpSimplex * ClpSimplexOther::gubVersion(int * whichRows, int * whichColumns, int neededGub, int factorizationFrequency) { // find gub int numberRows = this->numberRows(); int numberColumns = this->numberColumns(); int iRow, iColumn; int * columnIsGub = new int [numberColumns]; const double * columnLower = this->columnLower(); const double * columnUpper = this->columnUpper(); int numberFixed=0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnUpper[iColumn] == columnLower[iColumn]) { columnIsGub[iColumn]=-2; numberFixed++; } else if (columnLower[iColumn]>=0) { columnIsGub[iColumn]=-1; } else { columnIsGub[iColumn]=-3; } } CoinPackedMatrix * matrix = this->matrix(); // get row copy CoinPackedMatrix rowCopy = *matrix; rowCopy.reverseOrdering(); const int * column = rowCopy.getIndices(); const int * rowLength = rowCopy.getVectorLengths(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const double * element = rowCopy.getElements(); int numberNonGub = 0; int numberEmpty = numberRows; int * rowIsGub = new int [numberRows]; int smallestGubRow=-1; int count=numberColumns+1; double * rowLower = this->rowLower(); double * rowUpper = this->rowUpper(); // make sure we can get rid of upper bounds double * fixedRow = new double [numberRows]; for (iRow = 0 ; iRow < numberRows ; iRow++) { double sumFixed=0.0; for (int j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; double value = columnLower[iColumn]; if (value) sumFixed += element[j] * value; } fixedRow[iRow]=rowUpper[iRow]-sumFixed; } for (iRow = numberRows - 1; iRow >= 0; iRow--) { bool gubRow = true; int numberInRow=0; double sumFixed=0.0; double gap = fixedRow[iRow]-1.0e-12; for (int j = rowStart[iRow]; j < rowStart[iRow] + rowLength[iRow]; j++) { int iColumn = column[j]; if (columnIsGub[iColumn]!=-2) { if (element[j] != 1.0||columnIsGub[iColumn]==-3|| columnUpper[iColumn]-columnLower[iColumn]= 0) { gubRow = false; break; } } } else { sumFixed += columnLower[iColumn]*element[j]; } } if (!gubRow) { whichRows[numberNonGub++] = iRow; rowIsGub[iRow] = -1; } else if (numberInRow) { if (numberInRowrowUpper[iRow]+1.0e-4|| sumFixed= neededGub) { sprintf(message,"%d gub rows", numberGub); handler_->message(CLP_GENERAL2, messages_) << message << CoinMessageEol; int numberNormal = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnIsGub[iColumn] < 0 && columnIsGub[iColumn] !=-2) { whichColumns[numberNormal++] = iColumn; } } if (!numberNormal) { sprintf(message,"Putting back one gub row to make non-empty"); handler_->message(CLP_GENERAL2, messages_) << message << CoinMessageEol; rowIsGub[smallestGubRow]=-1; whichRows[numberNonGub++] = smallestGubRow; for (int j = rowStart[smallestGubRow]; j < rowStart[smallestGubRow] + rowLength[smallestGubRow]; j++) { int iColumn = column[j]; if (columnIsGub[iColumn]>=0) { columnIsGub[iColumn]=-4; whichColumns[numberNormal++] = iColumn; } } } std::sort(whichRows,whichRows+numberNonGub); std::sort(whichColumns,whichColumns+numberNormal); double * lower = CoinCopyOfArray(this->rowLower(),numberRows); double * upper = CoinCopyOfArray(this->rowUpper(),numberRows); // leave empty rows at end numberEmpty = numberRows-numberEmpty; const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); const double * elementByColumn = matrix->getElements(); // Fixed at end int put2 = numberColumns-numberFixed; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (columnIsGub[iColumn] ==-2) { whichColumns[put2++] = iColumn; double value = columnLower[iColumn]; for (int j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; if (lower[iRow]>-1.0e20) lower[iRow] -= value*element[j]; if (upper[iRow]<1.0e20) upper[iRow] -= value*element[j]; } } } int put = numberNormal; ClpSimplex * model2 = new ClpSimplex(this, numberNonGub, whichRows , numberNormal, whichColumns); // scale double * scaleArray = new double [numberRows]; for (int i=0;i-1.0e30) lower[i] *= scale; if (upper[i]<1.0e30) upper[i] *= scale; } } // scale partial matrix { CoinPackedMatrix * matrix = model2->matrix(); const int * row = matrix->getIndices(); const int * columnLength = matrix->getVectorLengths(); const CoinBigIndex * columnStart = matrix->getVectorStarts(); double * element = matrix->getMutableElements(); for (int i=0;irowLower(); double * rowUpper = model2->rowUpper(); for (int i=0;i=0) { numberElements += columnLength[iColumn]-1; temp1[iGub]++; } } /* Optional but means can eventually simplify coding could even add in fixed slacks to deal with singularities - but should not be necessary */ int numberSlacks=0; for (int i = 0; i < numberRows; i++) { if (rowIsGub[i]>=0) { if (lower[i]=0) { rowIsGub[i]=numberGub; gubStart[numberGub+1]=gubStart[numberGub]+temp1[i]; temp1[numberGub]=0; lower[numberGub]=lower[i]; upper[numberGub]=upper[i]; whichRows[numberNonGub+numberGub]=i; numberGub++; } } int numberGubColumnsPlus = numberGubColumns + numberSlacks; double * lowerColumn2 = new double [numberGubColumnsPlus]; CoinFillN(lowerColumn2, numberGubColumnsPlus, 0.0); double * upperColumn2 = new double [numberGubColumnsPlus]; CoinFillN(upperColumn2, numberGubColumnsPlus, COIN_DBL_MAX); int * start2 = new int[numberGubColumnsPlus+1]; int * row2 = new int[numberElements]; double * element2 = new double[numberElements]; double * cost2 = new double [numberGubColumnsPlus]; CoinFillN(cost2, numberGubColumnsPlus, 0.0); const double * cost = this->objective(); put = numberNormal; for (iColumn = 0; iColumn < numberColumns; iColumn++) { int iGub = columnIsGub[iColumn]; if (iGub>=0) { // TEMP //this->setColUpper(iColumn,COIN_DBL_MAX); iGub = rowIsGub[iGub]; assert (iGub>=0); int kPut = put+gubStart[iGub]+temp1[iGub]; temp1[iGub]++; whichColumns[kPut]=iColumn; } } for (int i = 0; i < numberRows; i++) { if (rowIsGub[i]>=0) { int iGub = rowIsGub[i]; if (lower[iGub]primal(1); // TEMP // redo rowIsGub to give lookup for (int i=0;i= 0) { row2[numberElements] = iRow; element2[numberElements++] = elementByColumn[j]*scaleBy; } } } else { // slack int iGub = iColumn-numberColumns; double slack = upper[iGub]-lower[iGub]; assert (upper[iGub]<1.0e20); lower[iGub]=upper[iGub]; cost2[i] = 0; lowerColumn2[i] = 0; upperColumn2[i] = slack; upperColumn2[i] = COIN_DBL_MAX; } start2[i+1] = numberElements; } // clean up bounds on variables for (int iSet=0;iSetnumberRows(), model2->numberColumns()); handler_->message(CLP_GENERAL2, messages_) << message << CoinMessageEol; delete [] scaleArray; delete [] temp1; model2->setFactorizationFrequency(factorizationFrequency); ClpDynamicMatrix * newMatrix = new ClpDynamicMatrix(model2, numberGub, numberGubColumnsPlus, gubStart, lower, upper, start2, row2, element2, cost2, lowerColumn2, upperColumn2); delete [] gubStart; delete [] lowerColumn2; delete [] upperColumn2; delete [] start2; delete [] row2; delete [] element2; delete [] cost2; delete [] lower; delete [] upper; model2->replaceMatrix(newMatrix,true); #ifdef EVERY_ITERATION { ClpDynamicMatrix * gubMatrix = dynamic_cast< ClpDynamicMatrix*>(model2->clpMatrix()); assert(gubMatrix); gubMatrix->writeMps("gub.mps"); } #endif delete [] columnIsGub; delete [] rowIsGub; newMatrix->switchOffCheck(); #ifdef EVERY_ITERATION newMatrix->setRefreshFrequency(1/*000*/); #else newMatrix->setRefreshFrequency(1000); #endif sprintf(message, "** While after adding matrix there are %d rows and %d columns", model2->numberRows(), model2->numberColumns()); handler_->message(CLP_GENERAL2, messages_) << message << CoinMessageEol; model2->setSpecialOptions(4); // exactly to bound // Scaling off (done by hand) model2->scaling(0); return model2; } else { delete [] columnIsGub; delete [] rowIsGub; return NULL; } } // Sets basis from original void ClpSimplexOther::setGubBasis(ClpSimplex &original,const int * whichRows, const int * whichColumns) { ClpDynamicMatrix * gubMatrix = dynamic_cast< ClpDynamicMatrix*>(clpMatrix()); assert(gubMatrix); int numberGubColumns = gubMatrix->numberGubColumns(); int numberNormal = gubMatrix->firstDynamic(); //int lastOdd = gubMatrix->firstAvailable(); //int numberTotalColumns = numberNormal + numberGubColumns; //assert (numberTotalColumns==numberColumns+numberSlacks); int numberRows = original.numberRows(); int numberColumns = original.numberColumns(); int * columnIsGub = new int [numberColumns]; int numberNonGub = gubMatrix->numberStaticRows(); //assert (firstOdd==numberNormal); double * solution = primalColumnSolution(); double * originalSolution = original.primalColumnSolution(); const double * upperSet = gubMatrix->upperSet(); // Column copy of GUB part int numberSets = gubMatrix->numberSets(); const int * startSet = gubMatrix->startSets(); const CoinBigIndex * columnStart = gubMatrix->startColumn(); const double * columnLower = gubMatrix->columnLower(); #ifdef TRY_IMPROVE const double * columnUpper = gubMatrix->columnUpper(); const double * lowerSet = gubMatrix->lowerSet(); const double * element = gubMatrix->element(); const int * row = gubMatrix->row(); bool allPositive=true; double * rowActivity = new double[numberNonGub]; memset(rowActivity, 0, numberNonGub*sizeof(double)); { // Non gub contribution const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); for (int i=0;isetDynamicStatus(j,ClpDynamicMatrix::atLowerBound); int iColumn = whichColumns[j+numberNormal]; if (iColumnupperSet[i]+1.0e-8) { double gap = sum-upperSet[i]; if (iSlack>=0) { double value=newSolution[iSlack]; if (value>0.0) { double down = CoinMin(gap,value); gap -= down; sum -= down; newSolution[iSlack] = value-down; } } if (gap>1.0e-8) { for (int j=startSet[i];j0.0&&iColumn=0) { double value=newSolution[iSlack]; if (value1.0e-8) { for (int j=startSet[i];j1.0e-7) printf("Sum for set %d is %g - lower %g, upper %g\n",i, sum,lowerSet[i],upperSet[i]); } if (allPositive) { // See if we can improve solution // first reduce if over double * gaps = new double [numberNonGub]; double direction = optimizationDirection_; const double * cost = gubMatrix->cost(); bool over=false; for (int i=0;irowUpper_[i]+1.0e-6) { gaps[i]=activity-rowUpper_[i]; over=true; } } double * weights = new double [numberGubColumns]; int * which = new int [numberGubColumns]; int * whichSet = new int [numberGubColumns]; if (over) { int n=0; for (int i=0;iupperSet[i]-1.0e-8) continue; double slackCost = cost[iSlack]*direction; for (int j=startSet[i];jcolumnLower[j]&&j!=iSlack) { if(thisCost=0); double move = 0.0; for (CoinBigIndex k = columnStart[j]; k < columnStart[j+1] ; k++) { int iRow = row[k]; if(rowActivity[iRow]-rowUpper_[iRow]>move*element[k]) { move = (rowActivity[iRow]-rowUpper_[iRow])/element[k]; } } move=CoinMin(move,newSolution[j]-columnLower[j]); if (move) { newSolution[j] -= move; newSolution[iSlack] += move; for (CoinBigIndex k = columnStart[j]; k < columnStart[j+1] ; k++) { int iRow = row[k]; rowActivity[iRow] -= move*element[k]; } } } } delete [] whichSet; delete [] which; delete [] weights; delete [] gaps; // redo original status! for (int i=0;icolumnLower[j]) { numberNewBasic++; j2=j; } int iOrig = whichColumns[j+numberNormal]; if (iOrigsetDynamicStatus(j,ClpDynamicMatrix::atLowerBound); int iColumn = whichColumns[j+numberNormal]; if (iColumn=0); numberKey[iRow]++; } } else { // Set slack int iSet = iOrig - numberColumns; int iRow = whichRows[iSet+numberNonGub]; if (original.getRowStatus(iRow)==ClpSimplex::basic) numberKey[iRow]++; } } /* Before going into cleanMatrix we need gub status set (inSmall just means basic and active) row status set */ for (int i = 0; i < numberSets; i++) { gubMatrix->setStatus(i,ClpSimplex::isFixed); } for (int i = 0; i < numberGubColumns; i++) { int iOrig = whichColumns[i+numberNormal]; if (iOrigsetDynamicStatus(i,ClpDynamicMatrix::atUpperBound); } else if (status==ClpSimplex::atLowerBound) { gubMatrix->setDynamicStatus(i,ClpDynamicMatrix::atLowerBound); } else if (status==ClpSimplex::basic) { int iRow = columnIsGub[iOrig]; assert (iRow>=0); assert(numberKey[iRow]); if (numberKey[iRow]==1) gubMatrix->setDynamicStatus(i,ClpDynamicMatrix::soloKey); else gubMatrix->setDynamicStatus(i,ClpDynamicMatrix::inSmall); } } else { // slack int iSet = iOrig - numberColumns; int iRow = whichRows[iSet+numberNonGub]; if (original.getRowStatus(iRow)==ClpSimplex::basic #ifdef TRY_IMPROVE ||newSolution[i]>columnLower[i]+1.0e-8 #endif ) { assert(numberKey[iRow]); if (numberKey[iRow]==1) gubMatrix->setDynamicStatus(i,ClpDynamicMatrix::soloKey); else gubMatrix->setDynamicStatus(i,ClpDynamicMatrix::inSmall); } else { gubMatrix->setDynamicStatus(i,ClpDynamicMatrix::atLowerBound); } } } // deal with sets without key for (int i = 0; i < numberSets; i++) { int iRow = whichRows[numberNonGub+i]; if (!numberKey[iRow]) { double upper = upperSet[i]-1.0e-7; if (original.getRowStatus(iRow)==ClpSimplex::basic) gubMatrix->setStatus(i,ClpSimplex::basic); // If not at lb make key otherwise one with smallest number els double largest=0.0; int fewest=numberRows+1; int chosen=-1; for (int j=startSet[i];jupper) gubMatrix->setStatus(i,ClpSimplex::atLowerBound); } else { // slack - take value as 0.0 as will win on length value=0.0; } if (value>largest+1.0e-8) { largest=value; fewest=length; chosen=j; } else if (fabs(value-largest)<=1.0e-8&&length=0); if (gubMatrix->getStatus(i)!=ClpSimplex::basic) { // set as key for (int j=startSet[i];jsetDynamicStatus(j,ClpDynamicMatrix::atLowerBound); else gubMatrix->setDynamicStatus(j,ClpDynamicMatrix::soloKey); } } } } for (int i = 0; i < numberNormal; i++) { int iOrig = whichColumns[i]; setColumnStatus(i,original.getColumnStatus(iOrig)); solution[i]=originalSolution[iOrig]; } for (int i = 0; i < numberNonGub; i++) { int iOrig = whichRows[i]; setRowStatus(i,original.getRowStatus(iOrig)); } // Fill in current matrix gubMatrix->initialProblem(); delete [] numberKey; delete [] columnIsGub; } // Restores basis to original void ClpSimplexOther::getGubBasis(ClpSimplex &original,const int * whichRows, const int * whichColumns) const { ClpDynamicMatrix * gubMatrix = dynamic_cast< ClpDynamicMatrix*>(clpMatrix()); assert(gubMatrix); int numberGubColumns = gubMatrix->numberGubColumns(); int numberNormal = gubMatrix->firstDynamic(); //int lastOdd = gubMatrix->firstAvailable(); //int numberRows = original.numberRows(); int numberColumns = original.numberColumns(); int numberNonGub = gubMatrix->numberStaticRows(); //assert (firstOdd==numberNormal); double * solution = primalColumnSolution(); double * originalSolution = original.primalColumnSolution(); int numberSets = gubMatrix->numberSets(); const double * cost = original.objective(); int lastOdd = gubMatrix->firstAvailable(); //assert (numberTotalColumns==numberColumns+numberSlacks); int numberRows = original.numberRows(); //int numberStaticRows = gubMatrix->numberStaticRows(); const int * startSet = gubMatrix->startSets(); unsigned char * status = original.statusArray(); unsigned char * rowStatus = status+numberColumns; //assert (firstOdd==numberNormal); for (int i=0;iid(); const double * columnLower = gubMatrix->columnLower(); const double * columnUpper = gubMatrix->columnUpper(); for (int i = 0; i < numberGubColumns; i++) { int iOrig = whichColumns[i+numberNormal]; if (iOriggetDynamicStatus(i) == ClpDynamicMatrix::atUpperBound) { originalSolution[iOrig] = columnUpper[i]; status[iOrig] = 2; } else if (gubMatrix->getDynamicStatus(i) == ClpDynamicMatrix::atLowerBound && columnLower) { originalSolution[iOrig] = columnLower[i]; status[iOrig] = 3; } else if (gubMatrix->getDynamicStatus(i) == ClpDynamicMatrix::soloKey) { int iSet = gubMatrix->whichSet(i); originalSolution[iOrig] = gubMatrix->keyValue(iSet); status[iOrig] = 1; } else { originalSolution[iOrig] = 0.0; status[iOrig] = 4; } } else { // slack int iSet = iOrig - numberColumns; int iRow = whichRows[iSet+numberNonGub]; if (gubMatrix->getDynamicStatus(i) == ClpDynamicMatrix::atUpperBound) { original.setRowStatus(iRow,ClpSimplex::atLowerBound); } else if (gubMatrix->getDynamicStatus(i) == ClpDynamicMatrix::atLowerBound) { original.setRowStatus(iRow,ClpSimplex::atUpperBound); } else if (gubMatrix->getDynamicStatus(i) == ClpDynamicMatrix::soloKey) { original.setRowStatus(iRow,ClpSimplex::basic); } } } for (int i = 0; i < numberNormal; i++) { int iOrig = whichColumns[i]; ClpSimplex::Status thisStatus = getStatus(i); if (thisStatus == ClpSimplex::basic) status[iOrig] = 1; else if (thisStatus == ClpSimplex::atLowerBound) status[iOrig] = 3; else if (thisStatus == ClpSimplex::atUpperBound) status[iOrig] = 2; else if (thisStatus == ClpSimplex::isFixed) status[iOrig] = 5; else abort(); originalSolution[iOrig] = solution[i]; } for (int i = numberNormal; i < lastOdd; i++) { int iOrig = whichColumns[id[i-numberNormal] + numberNormal]; if (iOrig=numberColumns are slacks (obviously no coefficients) status array is (char) Status enum */ int ClpSimplex::modifyCoefficientsAndPivot(int number, const int * which, const CoinBigIndex * start, const int * row, const double * newCoefficient, const unsigned char * newStatus, const double * newLower, const double * newUpper, const double * newObjective) { ClpPackedMatrix* clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix_); bool canPivot = lower_!=NULL && factorization_!=NULL; int returnCode=0; if (!clpMatrix) { canPivot=false; returnCode=-1; // very slow for (int i=0;imodifyCoefficient(row[j],iSequence,newCoefficient[j]); } } else { assert (start[i]==start[i+1]); } } } else { #if 0 // when in stable CoinPackedMatrix * matrix = clpMatrix->getPackedMatrix(); matrix->modifyCoefficients(number,which,start, row,newCoefficient); #else // Copy and sort which int * which2 = new int [2*number+2]; int * sort = which2+number+1; int n=0; for (int i=0;igetNumElements()) { rowVector = rowArray_[i]; break; } } bool tempVector=false; if (!rowVector) { tempVector=true; rowVector=new CoinIndexedVector(numberRows_); } CoinSort_2(which2,which2+n,sort); // Stop at end which2[n]=numberColumns_; sort[n]=n; CoinPackedMatrix * matrix = clpMatrix->getPackedMatrix(); int * rowNow = matrix->getMutableIndices(); CoinBigIndex * columnStart = matrix->getMutableVectorStarts(); int * columnLength = matrix->getMutableVectorLengths(); double * elementByColumn = matrix->getMutableElements(); double * array = rowVector->denseVector(); //int * index = rowVector->getIndices(); int needed=0; bool moveUp=false; for (int i=0;iCOIN_INDEXED_REALLY_TINY_ELEMENT) { double newValue=array[iRow]; if (oldValue!=newValue) { if (newValue) { array[iRow]=0.0; if (newValue==COIN_INDEXED_REALLY_TINY_ELEMENT) { needed--; } } } } else { nZeroOld++; } } assert (!nZeroOld); for (CoinBigIndex j=start[inWhich];j0) moveUp=true; } } } int numberElements = matrix->getNumElements(); assert (numberElements==columnStart[numberColumns_]); if (needed>0) { // need more space matrix->reserve(numberColumns_, numberElements+needed); rowNow = matrix->getMutableIndices(); elementByColumn = matrix->getMutableElements(); } if (moveUp) { // move up from top CoinBigIndex top = numberElements+needed; for (int iColumn=numberColumns_-1;iColumn>=0;iColumn--) { CoinBigIndex end = columnStart[iColumn+1]; columnStart[iColumn+1]=top; CoinBigIndex startThis = columnStart[iColumn]; for (CoinBigIndex j=end-1;j>=startThis;j--) { if (elementByColumn[j]) { top--; elementByColumn[top]=elementByColumn[j]; rowNow[top]=rowNow[j]; } } } columnStart[0]=top; } // now move down and insert CoinBigIndex put=0; int iColumn=0; for (int i=0;iCOIN_INDEXED_REALLY_TINY_ELEMENT) { rowNow[put]=iRow; elementByColumn[put++]=oldValue; } } for (CoinBigIndex j=start[inWhich];jsetNumElements(put); if (tempVector) delete rowVector; for (int i=0;ireverseOrderedCopy(); } assert (!newStatus); // do later int numberPivots = factorization_->pivots(); int needed=0; for (int i=0;istart[i]&&getStatus(iSequence)==basic) needed++; } if (needed&&numberPivots+needed<20&&needed<-2) { // update factorization int saveIn = sequenceIn_; int savePivot = pivotRow_; int nArray=0; CoinIndexedVector * vec[2]; for (int i=0;i<4;i++) { if (!rowArray_[i]->getNumElements()) { vec[nArray++]=rowArray_[i]; if (nArray==2) break; } } assert (nArray==2); // could use temp array for (int i=0;istart[i]&&getStatus(sequenceIn_)==basic) { // find pivot row for (pivotRow_=0;pivotRow_getNumElements()); #ifndef COIN_FAC_NEW unpackPacked(vec[0]); #else unpack(vec[0]); #endif // update assert(!vec[1]->getNumElements()); factorization_->updateColumnFT(vec[1], vec[0]); const double * array = vec[0]->denseVector(); #ifndef COIN_FAC_NEW // Find alpha const int * indices = vec[0]->getIndices(); int n=vec[0]->getNumElements(); alpha_=0.0; for (int i=0;i1.0e-7) updateStatus = factorization_->replaceColumn(this, vec[1], vec[0], pivotRow_, alpha_); assert(!vec[1]->getNumElements()); vec[0]->clear(); if (updateStatus) { returnCode=3; break; } } } sequenceIn_=saveIn; pivotRow_ = savePivot; if (!returnCode) returnCode=100; // say can do more } else if (needed) { returnCode=3; // refactorize } } } if (newStatus) { for (int i=0;icheckInfeasibilities(oldTolerance); delete nonLinearCost_; nonLinearCost_ = new ClpNonLinearCost(this); } gutsOfSolution(NULL,NULL,false); assert (!newStatus); printf("%d primal %d dual\n",numberPrimalInfeasibilities_, numberDualInfeasibilities_); returnCode=3; } else { // is this needed if (nonLinearCost_) { // speed up later #if 1 for (int i=0;isetOne(iSequence,solution_[iSequence], lower_[iSequence],upper_[iSequence], cost_[iSequence]); } #else //nonLinearCost_->checkInfeasibilities(oldTolerance); delete nonLinearCost_; nonLinearCost_ = new ClpNonLinearCost(this); //nonLinearCost_->checkInfeasibilities(0.0); #endif //gutsOfSolution(NULL,NULL,false); assert (!newStatus); } } } return returnCode; } /* Pivot out a variable and choose an incoing one. Assumes dual feasible - will not go through a reduced cost. Returns step length in theta Return codes as before but -1 means no acceptable pivot */ int ClpSimplex::dualPivotResultPart1() { return static_cast (this)->pivotResultPart1(); } /* Do actual pivot state is 1,3 if got tableau column in rowArray_[1] 2,3 if got tableau row in rowArray_[0] and columnArray_[0] */ int ClpSimplex::pivotResultPart2(int algorithm,int state) { if (!(state&1)) { // update the incoming column #ifndef COIN_FAC_NEW unpackPacked(rowArray_[1]); #else unpack(rowArray_[1]); #endif factorization_->updateColumnFT(rowArray_[2], rowArray_[1]); } #define CHECK_TABLEAU 0 if (!(state&2)||CHECK_TABLEAU) { // get tableau row // create as packed double direction = directionOut_; assert (!rowArray_[2]->getNumElements()); assert (!columnArray_[1]->getNumElements()); #if CHECK_TABLEAU printf("rowArray0 old\n"); rowArray_[0]->print(); rowArray_[0]->clear(); printf("columnArray0 old\n"); columnArray_[0]->print(); columnArray_[0]->clear(); #else assert (!columnArray_[0]->getNumElements()); assert (!rowArray_[0]->getNumElements()); #endif #ifndef COIN_FAC_NEW rowArray_[0]->createPacked(1, &pivotRow_, &direction); #else rowArray_[0]->createOneUnpackedElement(pivotRow_, direction); #endif factorization_->updateColumnTranspose(rowArray_[2], rowArray_[0]); rowArray_[3]->clear(); // put row of tableau in rowArray[0] and columnArray[0] assert (!rowArray_[2]->getNumElements()); matrix_->transposeTimes(this, -1.0, rowArray_[0], rowArray_[2], columnArray_[0]); #if CHECK_TABLEAU printf("rowArray0 new\n"); rowArray_[0]->print(); printf("columnArray0 new\n"); columnArray_[0]->print(); #endif } assert (pivotRow_>=0); assert (sequenceIn_>=0); assert (sequenceOut_>=0); int returnCode=-1; if (algorithm>0) { // replace in basis int updateStatus = factorization_->replaceColumn(this, rowArray_[2], rowArray_[1], pivotRow_, alpha_); if (!updateStatus) { dualIn_ = cost_[sequenceIn_]; double * work = rowArray_[1]->denseVector(); int number = rowArray_[1]->getNumElements(); int * which = rowArray_[1]->getIndices(); for (int i = 0; i < number; i++) { int iRow = which[i]; #ifndef COIN_FAC_NEW double alpha = work[i]; #else double alpha = work[iRow]; #endif int iPivot = pivotVariable_[iRow]; dualIn_ -= alpha * cost_[iPivot]; } returnCode=0; double multiplier = dualIn_ / alpha_; // update column djs int i; int * index = columnArray_[0]->getIndices(); number = columnArray_[0]->getNumElements(); double * element = columnArray_[0]->denseVector(); assert (columnArray_[0]->packedMode()); for (i = 0; i < number; i++) { int iSequence = index[i]; dj_[iSequence] += multiplier*element[i]; reducedCost_[iSequence] = dj_[iSequence]; element[i] = 0.0; } columnArray_[0]->setNumElements(0); // and row djs index = rowArray_[0]->getIndices(); number = rowArray_[0]->getNumElements(); element = rowArray_[0]->denseVector(); #ifndef COIN_FAC_NEW assert (rowArray_[0]->packedMode()); for (i = 0; i < number; i++) { int iSequence = index[i]; dj_[iSequence+numberColumns_] += multiplier*element[i]; dual_[iSequence] = dj_[iSequence+numberColumns_]; element[i] = 0.0; } #else assert (!rowArray_[0]->packedMode()); for (i = 0; i < number; i++) { int iSequence = index[i]; dj_[iSequence+numberColumns_] += multiplier*element[iSequence]; dual_[iSequence] = dj_[iSequence+numberColumns_]; element[iSequence] = 0.0; } #endif rowArray_[0]->setNumElements(0); double oldCost = cost_[sequenceOut_]; // update primal solution double objectiveChange = 0.0; // after this rowArray_[1] is not empty - used to update djs static_cast(this)->updatePrimalsInPrimal(rowArray_[1], theta_, objectiveChange, 0); double oldValue = valueIn_; if (directionIn_ == -1) { // as if from upper bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ -= fabs(theta_); } else { valueIn_ = lowerIn_; } } else { // as if from lower bound if (sequenceIn_ != sequenceOut_) { // variable becoming basic valueIn_ += fabs(theta_); } else { valueIn_ = upperIn_; } } objectiveChange += dualIn_ * (valueIn_ - oldValue); // outgoing if (sequenceIn_ != sequenceOut_) { if (directionOut_ > 0) { valueOut_ = lowerOut_; } else { valueOut_ = upperOut_; } if(valueOut_ < lower_[sequenceOut_] - primalTolerance_) valueOut_ = lower_[sequenceOut_] - 0.9 * primalTolerance_; else if (valueOut_ > upper_[sequenceOut_] + primalTolerance_) valueOut_ = upper_[sequenceOut_] + 0.9 * primalTolerance_; // may not be exactly at bound and bounds may have changed // Make sure outgoing looks feasible directionOut_ = nonLinearCost_->setOneOutgoing(sequenceOut_, valueOut_); // May have got inaccurate //if (oldCost!=cost_[sequenceOut_]) //printf("costchange on %d from %g to %g\n",sequenceOut_, // oldCost,cost_[sequenceOut_]); dj_[sequenceOut_] = cost_[sequenceOut_] - oldCost; // normally updated next iteration solution_[sequenceOut_] = valueOut_; } // change cost and bounds on incoming if primal nonLinearCost_->setOne(sequenceIn_, valueIn_); progress_.startCheck(); // make sure won't worry about cycling int whatNext = housekeeping(objectiveChange); if (whatNext == 1) { returnCode = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent returnCode = 3; } else if(numberIterations_ == lastGoodIteration_ + 2 * factorization_->maximumPivots()) { // done a lot of flips - be safe returnCode = -2; // refactorize } } else { // ? abort(); } } else { // dual // recompute dualOut_ if (directionOut_ < 0) { dualOut_ = valueOut_ - upperOut_; } else { dualOut_ = lowerOut_ - valueOut_; } // update the incoming column double btranAlpha = -alpha_ * directionOut_; // for check rowArray_[1]->clear(); #ifndef COIN_FAC_NEW unpackPacked(rowArray_[1]); #else unpack(rowArray_[1]); #endif // moved into updateWeights - factorization_->updateColumnFT(rowArray_[2],rowArray_[1]); // and update dual weights (can do in parallel - with extra array) alpha_ = dualRowPivot_->updateWeights(rowArray_[0], rowArray_[2], rowArray_[3], rowArray_[1]); // see if update stable #ifdef CLP_DEBUG if ((handler_->logLevel() & 32)) printf("btran alpha %g, ftran alpha %g\n", btranAlpha, alpha_); #endif double checkValue = 1.0e-7; // if can't trust much and long way from optimal then relax if (largestPrimalError_ > 10.0) checkValue = CoinMin(1.0e-4, 1.0e-8 * largestPrimalError_); if (fabs(btranAlpha) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha - alpha_) > checkValue*(1.0 + fabs(alpha_))) { handler_->message(CLP_DUAL_CHECK, messages_) << btranAlpha << alpha_ << CoinMessageEol; if (factorization_->pivots()) { dualRowPivot_->unrollWeights(); problemStatus_ = -2; // factorize now rowArray_[0]->clear(); rowArray_[1]->clear(); columnArray_[0]->clear(); returnCode = -2; abort(); return returnCode; } else { // take on more relaxed criterion double test; if (fabs(btranAlpha) < 1.0e-8 || fabs(alpha_) < 1.0e-8) test = 1.0e-1 * fabs(alpha_); else test = 1.0e-4 * (1.0 + fabs(alpha_)); if (fabs(btranAlpha) < 1.0e-12 || fabs(alpha_) < 1.0e-12 || fabs(btranAlpha - alpha_) > test) { abort(); } } } // update duals BEFORE replaceColumn so can do updateColumn double objectiveChange = 0.0; // do duals first as variables may flip bounds // rowArray_[0] and columnArray_[0] may have flips // so use rowArray_[3] for work array from here on int nswapped = 0; //rowArray_[0]->cleanAndPackSafe(1.0e-60); //columnArray_[0]->cleanAndPackSafe(1.0e-60); // make sure incoming doesn't count Status saveStatus = getStatus(sequenceIn_); setStatus(sequenceIn_, basic); nswapped = static_cast(this)->updateDualsInDual(rowArray_[0], columnArray_[0], rowArray_[2], theta_, objectiveChange, false); assert (!nswapped); setStatus(sequenceIn_, saveStatus); double oldDualOut = dualOut_; // which will change basic solution if (nswapped) { if (rowArray_[2]->getNumElements()) { factorization_->updateColumn(rowArray_[3], rowArray_[2]); dualRowPivot_->updatePrimalSolution(rowArray_[2], 1.0, objectiveChange); } // recompute dualOut_ valueOut_ = solution_[sequenceOut_]; if (directionOut_ < 0) { dualOut_ = valueOut_ - upperOut_; } else { dualOut_ = lowerOut_ - valueOut_; } } // amount primal will move double movement = -dualOut_ * directionOut_ / alpha_; double movementOld = oldDualOut * directionOut_ / alpha_; // so objective should increase by fabs(dj)*movement // but we already have objective change - so check will be good if (objectiveChange + fabs(movementOld * dualIn_) < -CoinMax(1.0e-5, 1.0e-12 * fabs(objectiveValue_))) { if (handler_->logLevel() & 32) printf("movement %g, swap change %g, rest %g * %g\n", objectiveChange + fabs(movement * dualIn_), objectiveChange, movement, dualIn_); } // if stable replace in basis int updateStatus = factorization_->replaceColumn(this, rowArray_[2], rowArray_[1], pivotRow_, alpha_); // If looks like bad pivot - refactorize if (fabs(dualOut_) > 1.0e50) updateStatus = 2; // if no pivots, bad update but reasonable alpha - take and invert if (updateStatus == 2 && !factorization_->pivots() && fabs(alpha_) > 1.0e-5) updateStatus = 4; if (updateStatus == 1 || updateStatus == 4) { // slight error if (factorization_->pivots() > 5 || updateStatus == 4) { problemStatus_ = -2; // factorize now returnCode = -3; } } else if (updateStatus == 2) { // major error dualRowPivot_->unrollWeights(); // later we may need to unwind more e.g. fake bounds if (factorization_->pivots() && ((moreSpecialOptions_ & 16) == 0 || factorization_->pivots() > 4)) { problemStatus_ = -2; // factorize now returnCode = -2; moreSpecialOptions_ |= 16; return returnCode; } else { // need to reject something abort(); } } else if (updateStatus == 3) { // out of memory // increase space if not many iterations if (factorization_->pivots() < 0.5 * factorization_->maximumPivots() && factorization_->pivots() < 200) factorization_->areaFactor( factorization_->areaFactor() * 1.1); problemStatus_ = -2; // factorize now } else if (updateStatus == 5) { problemStatus_ = -2; // factorize now } // update primal solution if (theta_ < 0.0) { if (handler_->logLevel() & 32) printf("negative theta %g\n", theta_); theta_ = 0.0; } // do actual flips (should not be any?) static_cast(this)->flipBounds(rowArray_[0], columnArray_[0]); //rowArray_[1]->expand(); dualRowPivot_->updatePrimalSolution(rowArray_[1], movement, objectiveChange); // modify dualout dualOut_ /= alpha_; dualOut_ *= -directionOut_; //setStatus(sequenceIn_,basic); dj_[sequenceIn_] = 0.0; double oldValue = valueIn_; if (directionIn_ == -1) { // as if from upper bound valueIn_ = upperIn_ + dualOut_; } else { // as if from lower bound valueIn_ = lowerIn_ + dualOut_; } objectiveChange += cost_[sequenceIn_] * (valueIn_ - oldValue); // outgoing // set dj to zero unless values pass if (directionOut_ > 0) { valueOut_ = lowerOut_; dj_[sequenceOut_] = theta_; } else { valueOut_ = upperOut_; dj_[sequenceOut_] = -theta_; } solution_[sequenceOut_] = valueOut_; int whatNext = housekeeping(objectiveChange); // and set bounds correctly static_cast(this)->originalBound(sequenceIn_); static_cast(this)->changeBound(sequenceOut_); if (whatNext == 1) { problemStatus_ = -2; // refactorize } else if (whatNext == 2) { // maximum iterations or equivalent problemStatus_ = 3; returnCode = 3; abort(); } } // Check event { int status = eventHandler_->event(ClpEventHandler::endOfIteration); if (status >= 0) { problemStatus_ = 5; secondaryStatus_ = ClpEventHandler::endOfIteration; returnCode = 3; } } // need to be able to refactoriza //printf("return code %d problem status %d\n", // returnCode,problemStatus_); return returnCode; } #ifdef COIN_SHORT_SORT #define USE_HASH 1 #else #define USE_HASH 0 #endif #if USE_HASH==2 static const unsigned int mmult[] = { 262139, 259459, 256889, 254291, 251701, 249133, 246709, 244247}; // Returns a hash value inline unsigned int hashValue(double value, unsigned int maxHash) { const char * name = reinterpret_cast(&value); unsigned int n = 0; for (int j = 0; j < 8; ++j ) { n += mmult[j] * name[j]; } return ( n % maxHash ); } /* */ static int sameTogether(unsigned int nin,int * which, double * weights, int * which2, double * weights2, unsigned int * hash) { if (nin<=1) return nin; // move up and fill hash unsigned int maxHash=4*nin; memset(hash,0xf0,maxHash*sizeof(int)); int * spare=which2+maxHash; int n2=0; unsigned int iNext = hashValue (weights[0],maxHash); unsigned int endMarker=0x80000000+maxHash; hash[iNext]=endMarker; unsigned int iLast=iNext; weights2[iNext]=weights[0]; which2[iNext]=which[0]; for (unsigned int i=1;i0x7fffffff) { // end if (put>savePut+1) { CoinShortSort_2(weights+savePut,weights+put,which+savePut); // keep #if 0 printf("DUP2 value %g ",weights[savePut]); for (int i=savePut;i(weights); #endif #if 0 int counts[5]={0,0,0,0,0}; int countsEq[5]={0,0,0,0,0}; #endif // get row copy CoinPackedMatrix rowCopy = *matrix(); rowCopy.reverseOrdering(); int * column = rowCopy.getMutableIndices(); CoinBigIndex * rowStart = rowCopy.getMutableVectorStarts(); int * rowLength = rowCopy.getMutableVectorLengths(); double * element = rowCopy.getMutableElements(); //double wwww[200]; //assert (numberLook<=200); //int iiii[200]; for (int i=0;i(weights2+4*numberLook); unsigned int * hash = reinterpret_cast(which2+5*numberLook); int n=sameTogether(numberLook,ind,w,which2,weights2,hash); printf("Reduced length of %d\n",n); delete [] weights2; delete [] w; delete [] ind; } #endif CoinSort_2(weights,weights+numberLook,whichRows); #if 0 { double value = weights[0]; int firstSame=-1; int lastSame=-1; for (int iLook = 1; iLook < numberLook; iLook++) { if (weights[iLook]==value) { if (firstSame<0) { /* see how many same - if >2 but < ? may be worth looking at all combinations */ firstSame=iLook-1; printf("DUPS weight %g first row %d ",value,whichRows[firstSame]); for (lastSame=iLook;lastSame(weights+i); whichRows[i]=temp->item.hash.which; weights[i]=temp->item.hash.value; //printf("iLook %d weight %g (after) - true %d %g\n", // whichRows[i],weights[i],iiii[i],wwww[i]); } #undef USE_HASH #define USE_HASH 0 #endif #else int * which2 = reinterpret_cast(weights2+4*numberLook); unsigned int * hash = reinterpret_cast(which2+5*numberLook); numberLook=sameTogether(numberLook,whichRows,weights,which2,weights2,hash); printf("Reduced length of %d\n",numberLook); #endif if (tolerance<0.0) tolerance = primalTolerance_; int nPossible=0; int nDelete=0; #if USE_HASH==1 hash * temp = reinterpret_cast(weights); int iLast=temp->item.hash.which; float value=temp->item.hash.value; #else double value = weights[0]; int iLast = whichRows[0]; #endif double inverseCleanup = (cleanUp>0.0) ? 1.0/cleanUp : 0.0; //#define PRINT_DUP #ifdef PRINT_DUP int firstSame=-1; int lastSame=-1; #endif for (int iLook = 1; iLook < numberLook; iLook++) { #if USE_HASH==1 hash * temp = reinterpret_cast(weights+iLook); int iThis=temp->item.hash.which; float valueThis=temp->item.hash.value; #else int iThis=whichRows[iLook]; double valueThis=weights[iLook]; #endif if (valueThis==value) { #ifdef PRINT_DUP if (firstSame<0) { /* see how many same - if >2 but < ? may be worth looking at all combinations */ firstSame=iLook-1; printf("DUPS weight %g first row %d ",value,whichRows[firstSame]); for (lastSame=iLook;lastSame1.0e-8) { bad=true; } #ifdef PRINT_DUP int n2=strlen(temp); if (n+n2<500) { strcat(line,temp); n += n2; } else { strcat(line,"..."); break; } #endif } } if (!bad) { #ifdef PRINT_DUP printf("%s lo (%g,%g) up (%g,%g) - multiplier %g\n",line,rowLower_[iThis],rowUpper_[iThis], rowLower_[iLast],rowUpper_[iLast],multiplier); #endif double rlo1=rowLower_[iLast]; double rup1=rowUpper_[iLast]; double rlo2=rowLower_[iThis]; double rup2=rowUpper_[iThis]; // scale rlo1 *= multiplier; rup1 *= multiplier; //swap bounds if neg if (multiplier<0.0) { double temp = rup1; rup1=rlo1; rlo1=temp; } /* now check rhs to see what is what */ #ifdef PRINT_DUP printf("duplicate row %g %g, %g %g\n", rlo1,rup1,rlo2,rup2); #endif if (!noOverlaps) { /* we always keep this and delete last later maybe keep better formed one */ rlo2 = CoinMax(rlo1,rlo2); if (rlo2<-1.0e30) rlo2=-COIN_DBL_MAX; rup2 = CoinMin(rup1,rup2); if (rup2>1.0e30) rup2=COIN_DBL_MAX; } else { /* keep better formed one */ if (rlo2>=rlo1-1.0e-8&&rup2<=rup1+1.0e-8) { // ok rlo2 = CoinMax(rlo1,rlo2); if (rlo2<-1.0e30) rlo2=-COIN_DBL_MAX; rup2 = CoinMin(rup1,rup2); if (rup2>1.0e30) rup2=COIN_DBL_MAX; } else if (rlo1>=rlo2-1.0e-8&&rup1<=rup2+1.0e-8) { rlo2 = CoinMax(rlo1,rlo2); if (rlo2<-1.0e30) rlo2=-COIN_DBL_MAX; rup2 = CoinMin(rup1,rup2); if (rup2>1.0e30) rup2=COIN_DBL_MAX; // swap int temp=iLast; iLast=iThis; iThis=temp; } else { // leave (for now) #if DEBUG_SOME>0 printf("row %d %g %g row %d %g %g\n",iLast,rlo1,rup1,iThis,rlo2,rup2); #endif iLast=iThis; continue; } } #ifdef PRINT_DUP printf("pre_duprow %dR %dR keep this\n",iLast,iThis); #endif #if 0 if (rowLength[iThis]<4) counts[rowLength[iThis]]++; else counts[4]++; #endif if (rup20.0) { /* see if close to multiple always allow integer values */ if (rlo2>-1.0e30) { double value = rlo2; double value2 = floor(value+0.5); if (fabs(value-value2)<1.0e-9) { rlo2=value2; } else { value = rlo2*inverseCleanup; value2 = floor(value+0.5); if (fabs(value-value2)<1.0e-9) rlo2=value2*cleanUp; } } if (rup2<1.0e30) { double value = rup2; double value2 = floor(value+0.5); if (fabs(value-value2)<1.0e-9) { rup2=value2; } else { value = rup2*inverseCleanup; value2 = floor(value+0.5); if (fabs(value-value2)<1.0e-9) rup2=value2*cleanUp; } } } rowLower_[iThis]=rlo2; rowUpper_[iThis]=rup2; whichRows[nDelete++]=iLast; if (getRowStatus(iLast)!=basic) { if (getRowStatus(iThis)==basic) { setRowStatus(iThis,superBasic); setRowStatus(iLast,basic); } } } else { #ifdef PRINT_DUP printf("%s lo (%g,%g) up (%g,%g) - ODD\n",line,rowLower_[iThis],rowUpper_[iThis], rowLower_[iLast],rowUpper_[iLast]); #endif } } } else { #ifdef PRINT_DUP // say no match firstSame=-1; #endif value=valueThis; } iLast=iThis; } #ifdef PRINT_DUP printf("%d possible duplicate rows - deleting %d\n", nPossible,nDelete); #endif #if 0 for (int i=0;i<5;i++) { if (counts[i]) printf("CC counts %d %d times of which %d were equalities\n",i,counts[i],countsEq[i]); } #endif delete [] weights; return nDelete; } /* Try simple crash like techniques to get closer to primal feasibility returns final sum of infeasibilities */ double ClpSimplex::moveTowardsPrimalFeasible() { memset (rowActivity_,0,numberRows_*sizeof(double)); matrix()->times(columnActivity_,rowActivity_); double sum=0.0; int * which = new int[numberRows_]; int numberLook=0; for (int iRow=0;iRowrowUpper_[iRow]+primalTolerance_) infeasibility = value-rowUpper_[iRow]; if (infeasibility) { sum += infeasibility; which[numberLook++]=iRow; } } if (numberLook) { const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * element = matrix_->getElements(); // get row copy CoinPackedMatrix rowCopy = *matrix(); rowCopy.reverseOrdering(); const int * column = rowCopy.getIndices(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const int * rowLength = rowCopy.getVectorLengths(); const double * elementByRow = rowCopy.getElements(); double lastSum=COIN_DBL_MAX; while (sum>primalTolerance_&&numberLook) { sum =0.0; double worst=primalTolerance_; int iWorst=-1; int n=numberLook; numberLook=0; for (int iLook=0;iLookrowUpper_[iRow]+primalTolerance_) infeasibility = value-rowUpper_[iRow]; if (infeasibility) { sum += infeasibility; which[numberLook++]=iRow; if (infeasibility>worst) { worst = infeasibility; iWorst=iRow; } } } if (sum==0.0||sum>=lastSum-1.0e-8) break; lastSum=sum; double direction; if (rowActivity_[iWorst]0.0) ? 1.0 : -1.0; // but allow for column bounds double currentValue = columnActivity_[iColumn]; if (multiplier>0.0) distance = CoinMin(worst,columnUpper_[iColumn]-currentValue); else distance = CoinMin(worst,currentValue-columnLower_[iColumn]); distance /= fabs(value); for (CoinBigIndex i=columnStart[iColumn]; i0.0) { double distance2 = rowUpper_[iRow]-rowActivity_[iRow]; if (value2*distance>distance2) distance = distance2/value2; } else { double distance2 = rowLower_[iRow]-rowActivity_[iRow]; if (value2*distance1.0e-12) { worst-=distance*fabs(value); distance *= multiplier; columnActivity_[iColumn] = currentValue+distance; for (CoinBigIndex i=columnStart[iColumn]; i threshold */ void ClpSimplex::removeSuperBasicSlacks(int threshold) { // could try going both ways - for first attempt to nearer bound memset (rowActivity_,0,numberRows_*sizeof(double)); matrix()->times(columnActivity_,rowActivity_); double * distance = new double [numberRows_]; int * whichRows = new int [numberRows_]; int numberLook=0; for (int iRow=0;iRowrowLower_[iRow]+primalTolerance_&& valuethreshold) { CoinSort_2(distance,distance+numberLook,whichRows); const int * row = matrix_->getIndices(); const CoinBigIndex * columnStart = matrix_->getVectorStarts(); const int * columnLength = matrix_->getVectorLengths(); const double * element = matrix_->getElements(); // get row copy CoinPackedMatrix rowCopy = *matrix(); rowCopy.reverseOrdering(); const int * column = rowCopy.getIndices(); const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); const int * rowLength = rowCopy.getVectorLengths(); const double * elementByRow = rowCopy.getElements(); int nMoved=0; for (int iLook=0;iLook0.0) ? 1.0 : -1.0; // but allow for column bounds double currentValue = columnActivity_[iColumn]; if (multiplier>0.0) distance = columnUpper_[iColumn]-currentValue; else distance = currentValue-columnLower_[iColumn]; for (CoinBigIndex i=columnStart[iColumn]; i0.0) { double distance2 = rowUpper_[iRow]-rowActivity_[iRow]; if (value2*distance>distance2) distance = distance2/value2; } else { double distance2 = rowLower_[iRow]-rowActivity_[iRow]; if (value2*distance1.0e-12) { distance *= multiplier; columnActivity_[iColumn] = currentValue+distance; for (CoinBigIndex i=columnStart[iColumn]; i0.0) { needed = rowUpper_[kRow]-rowActivity_[kRow]; } else { needed = rowActivity_[kRow]-rowLower_[kRow]; } } } if (neededmessage(CLP_GENERAL,messages_) << line << CoinMessageEol; } delete [] distance; delete [] whichRows; } /* 1 (and 4) redundant (and 8 is user) 2 sub 11 movable column 13 empty (or initially fixed) column 14 doubleton */ typedef struct { double oldRowLower; double oldRowUpper; int row; int lengthRow; } clpPresolveInfo1_4_8; // can be used instead of 1_4_8 typedef struct { double oldRowLower; double oldRowUpper; int row; int lengthRow; double * rowLowerX; double * rowUpperX; double * tempElement; int * tempIndex; int otherRow; } clpPresolveInfo8; typedef struct { double oldRowLower; double oldRowUpper; double oldColumnLower; double oldColumnUpper; double coefficient; // 2 is upper double oldRowLower2; double oldRowUpper2; double coefficient2; int row; int row2; int column; } clpPresolveInfo2; typedef struct { double oldColumnLower; double oldColumnUpper; double fixedTo; int column; int lengthColumn; } clpPresolveInfo11; typedef struct { double oldColumnLower; double oldColumnUpper; int column; } clpPresolveInfo13; typedef struct { double oldColumnLower; double oldColumnUpper; double oldColumnLower2; double oldColumnUpper2; double oldObjective2; double value1; double rhs; int type; int row; int column; int column2; int lengthColumn2; } clpPresolveInfo14; typedef struct { int infoOffset; int type; } clpPresolveInfo; typedef struct { int numberEntries; int maximumEntries; int numberInitial; clpPresolveInfo * start; } listInfo; typedef struct { char * putStuff; char * startStuff; CoinBigIndex maxStuff; } saveInfo; typedef struct { double * elements; int * indices; char * startStuff; } restoreInfo; // struct must match in handler typedef struct { ClpSimplex * model; CoinPackedMatrix * rowCopy; char * rowType; char * columnType; saveInfo * stuff; clpPresolveInfo * info; int * nActions; } clpPresolveMore; void ClpCopyToMiniSave(saveInfo & where, const char * info, unsigned int sizeInfo,int numberElements, const int * indices, const double * elements) { char * put = where.putStuff; int n = numberElements*static_cast(sizeof(int)+sizeof(double))+static_cast(sizeInfo); if (n+(put-where.startStuff)>where.maxStuff) { where.maxStuff += CoinMax(where.maxStuff/2 + 10000, 2*n); char * temp = new char[where.maxStuff]; long k = put-where.startStuff; memcpy(temp,where.startStuff,k); delete [] where.startStuff; where.startStuff=temp; put = temp+k; } memcpy(put,info,sizeInfo); put += sizeInfo; memcpy(put,indices,numberElements*sizeof(int)); put += numberElements*sizeof(int); memcpy(put,elements,numberElements*sizeof(double)); put += numberElements*sizeof(double); where.putStuff=put; } static void copyFromSave(restoreInfo & where, clpPresolveInfo & info, void * thisInfoX) { char * get = where.startStuff+info.infoOffset; int type = info.type; int n=0; switch(type) { case 1: case 4: // redundant { clpPresolveInfo1_4_8 thisInfo; memcpy(&thisInfo,get,sizeof(clpPresolveInfo1_4_8)); memcpy(thisInfoX,get,sizeof(clpPresolveInfo1_4_8)); get += sizeof(clpPresolveInfo1_4_8); n = thisInfo.lengthRow; } break; case 8: case 9: // redundant { clpPresolveInfo8 thisInfo; memcpy(&thisInfo,get,sizeof(clpPresolveInfo8)); memcpy(thisInfoX,get,sizeof(clpPresolveInfo8)); get += sizeof(clpPresolveInfo8); n = thisInfo.lengthRow; } break; case 2: // sub { clpPresolveInfo2 thisInfo; memcpy(&thisInfo,get,sizeof(clpPresolveInfo2)); memcpy(thisInfoX,get,sizeof(clpPresolveInfo2)); get += sizeof(clpPresolveInfo2); } break; case 11: // movable column { clpPresolveInfo11 thisInfo; memcpy(&thisInfo,get,sizeof(clpPresolveInfo11)); memcpy(thisInfoX,get,sizeof(clpPresolveInfo11)); get += sizeof(clpPresolveInfo11); n = thisInfo.lengthColumn; } break; case 13: // empty (or initially fixed) column { clpPresolveInfo13 thisInfo; memcpy(&thisInfo,get,sizeof(clpPresolveInfo13)); memcpy(thisInfoX,get,sizeof(clpPresolveInfo13)); get += sizeof(clpPresolveInfo13); } break; case 14: // doubleton { clpPresolveInfo14 thisInfo; memcpy(&thisInfo,get,sizeof(clpPresolveInfo14)); memcpy(thisInfoX,get,sizeof(clpPresolveInfo14)); get += sizeof(clpPresolveInfo14); n = thisInfo.lengthColumn2; } break; } if (n) { memcpy(where.indices,get,n*sizeof(int)); get += n*sizeof(int); memcpy(where.elements,get,n*sizeof(double)); } } #define DEBUG_SOME 0 // need more space static void moveAround(int numberColumns,CoinBigIndex numberElementsOriginal, int iColumn,int lengthNeeded, int * forward,int * backward, CoinBigIndex * columnStart,int * columnLength, int * row,double * element) { // we only get here if can't fit so if iColumn is last one need shuffle int last=backward[numberColumns]; bool needCompaction=false; CoinBigIndex lastElement=columnStart[numberColumns]; //assert(lastElement==2*(numberElementsOriginal+numberColumns)); // save length int length=columnLength[iColumn]; if (iColumn!=last) { CoinBigIndex put=columnStart[last]+columnLength[last]+3; if (put+lengthNeeded<=lastElement) { // copy CoinBigIndex start = columnStart[iColumn]; columnStart[iColumn]=put; memcpy(element+put,element+start,length*sizeof(double)); memcpy(row+put,row+start,length*sizeof(int)); // forward backward int iLast=backward[iColumn]; int iNext=forward[iColumn]; forward[iLast]=iNext; backward[iNext]=iLast; forward[last]=iColumn; backward[iColumn]=last; forward[iColumn]=numberColumns; backward[numberColumns]=iColumn; } else { needCompaction=true; } } else { needCompaction=true; } if (needCompaction) { printf("compacting\n"); // size is lastElement+numberElementsOriginal #ifndef NDEBUG CoinBigIndex total=lengthNeeded-columnLength[iColumn]; for (int i=0;i=0); // copy back put=0; for (int i=0;i 0 printf("moved column %d\n",iColumn); #endif } #if DEBUG_SOME > 0 #ifndef NDEBUG static void checkBasis(ClpSimplex * model,char * rowType, char * columnType) { int numberRows=model->numberRows(); int nRowBasic=0; int nRows=0; for (int i=0;igetRowStatus(i)==ClpSimplex::basic) nRowBasic++; } } int numberColumns=model->numberColumns(); int nColumnBasic=0; for (int i=0;igetColumnStatus(i)==ClpSimplex::basic) nColumnBasic++; } ClpTraceDebug (nRowBasic+nColumnBasic==nRows); } #endif #endif #if DEBUG_SOME > 0 static int xxxxxx=2999999; #endif /* Mini presolve (faster) Char arrays must be numberRows and numberColumns long on entry second part must be filled in as follows - 0 - possible >0 - take out and do something (depending on value - TBD) 1 - redundant row 2 - sub 11 - column can be moved to bound 4 - row redundant (duplicate) 13 - empty (or initially fixed) column 14 - == row (also column deleted by row) 3 - column altered by a 14 5 - temporary marker for truly redundant sub row 8 - other -1 row/column can't vanish but can have entries removed/changed -2 don't touch at all on exit <=0 ones will be in presolved problem struct will be created and will be long enough (information on length etc in first entry) user must delete struct */ ClpSimplex * ClpSimplex::miniPresolve(char * rowType, char * columnType,void ** infoOut) { // Big enough structure int numberTotal=numberRows_+numberColumns_; CoinBigIndex lastElement = matrix_->getNumElements(); int maxInfoStuff = 5*lastElement*static_cast(sizeof(double))+numberTotal*static_cast(sizeof(clpPresolveInfo2)); clpPresolveInfo * infoA = new clpPresolveInfo[numberTotal]; char * startStuff = new char [maxInfoStuff]; memset(infoA,'B',numberTotal*sizeof(clpPresolveInfo)); memset(startStuff,'B',maxInfoStuff); int nActions=0; int * whichRows = new int [2*numberRows_+numberColumns_]; int * whichColumns = whichRows + numberRows_; int * whichRows2 = whichColumns + numberColumns_; double * array = new double [numberRows_]; memset(array,0,numberRows_*sizeof(double)); // New model (put in modification to increase size of matrix) and pack bool needExtension=numberColumns_>matrix_->getNumCols(); if (needExtension) { matrix()->reserve(numberColumns_,lastElement,true); CoinBigIndex * columnStart = matrix()->getMutableVectorStarts(); for (int i=numberColumns_;i>=0;i--) { if (columnStart[i]==0) columnStart[i]=lastElement; else break; } assert (lastElement==columnStart[numberColumns_]); } #define TWOFER #ifdef TWOFER ClpSimplex * newModel = NULL; CoinBigIndex lastPossible=3*lastElement; CoinBigIndex lastGood=2*lastElement; clpPresolveMore moreInfo; moreInfo.model=NULL; moreInfo.rowType=rowType; moreInfo.columnType=columnType; int addColumns = eventHandler_->eventWithInfo(ClpEventHandler::modifyMatrixInMiniPresolve,&moreInfo); if (moreInfo.model) { newModel = moreInfo.model; } else { newModel = new ClpSimplex(*this); newModel->matrix()->reserve(numberColumns_+addColumns,lastPossible,true); } #else ClpSimplex * newModel = new ClpSimplex(*this); //newModel->matrix()->reserve(numberColumns_,lastElement,true); #endif newModel->dropNames(); double * rowLower = newModel->rowLower(); double * rowUpper = newModel->rowUpper(); //double * rowActivity = newModel->primalRowSolution(); unsigned char * rowStatus = newModel->statusArray()+numberColumns_; // use top bit of status as marker for whichRows update for (int i=0;icolumnLower(); double * columnUpper = newModel->columnUpper(); //double * columnActivity = newModel->primalColumnSolution(); //unsigned char * columnStatus = newModel->statusArray(); // Take out marked stuff saveInfo stuff; stuff.putStuff=startStuff; stuff.startStuff=startStuff; stuff.maxStuff=maxInfoStuff; CoinPackedMatrix * matrix = newModel->matrix(); int * row = matrix->getMutableIndices(); CoinBigIndex * columnStart = matrix->getMutableVectorStarts(); int * columnLength = matrix->getMutableVectorLengths(); double * element = matrix->getMutableElements(); // get row copy CoinPackedMatrix rowCopy = *matrix; rowCopy.reverseOrdering(); int * column = rowCopy.getMutableIndices(); CoinBigIndex * rowStart = rowCopy.getMutableVectorStarts(); double * elementByRow = rowCopy.getMutableElements(); int * rowLength = rowCopy.getMutableVectorLengths(); for (int iRow=0;iRow0) { clpPresolveInfo1_4_8 thisInfo; thisInfo.row=iRow; thisInfo.oldRowLower=(rowLower_[iRow]>-1.0e30) ? rowLower_[iRow]-rowLower[iRow] : rowLower[iRow]; thisInfo.oldRowUpper=(rowUpper_[iRow]<1.0e30) ? rowUpper_[iRow]-rowUpper[iRow] : rowUpper[iRow]; int n=rowLength[iRow]; CoinBigIndex start=rowStart[iRow]; thisInfo.lengthRow=n; //thisInfo.column=-1; infoA[nActions].infoOffset=static_cast(stuff.putStuff-startStuff); infoA[nActions].type=4; //rowType[iRow]; nActions++; ClpCopyToMiniSave(stuff,reinterpret_cast(&thisInfo),sizeof(clpPresolveInfo1_4_8), n,column+start,elementByRow+start); } } CoinBigIndex put=0; bool anyDeleted=false; for (int iColumn=0;iColumn0||(columnType[iColumn]==0&& (!length||columnLower_[iColumn]==columnUpper_[iColumn]))) { clpPresolveInfo13 thisInfo; //thisInfo.row=-1; thisInfo.oldColumnLower=columnLower[iColumn]; thisInfo.oldColumnUpper=columnUpper[iColumn]; thisInfo.column=iColumn; CoinBigIndex start=columnStart[iColumn]; infoA[nActions].infoOffset=static_cast(stuff.putStuff-startStuff); infoA[nActions].type=(columnType[iColumn]>0) ? columnType[iColumn] : 13; nActions++; ClpCopyToMiniSave(stuff,reinterpret_cast(&thisInfo),sizeof(clpPresolveInfo13), 0,NULL,NULL); columnType[iColumn]=13; if (length) { double solValue=columnLower[iColumn]; if (solValue) { for (int j=start;j-1.0e20) rowLower[iRow]=lower-value; double upper = rowUpper[iRow]; if (upper<1.0e20) rowUpper[iRow]=upper-value; } } anyDeleted=true; length=0; } } columnStart[iColumn]=put; for (CoinBigIndex i=start;isetNumElements(put); // get row copy if changed if (anyDeleted) { rowCopy = *matrix; rowCopy.reverseOrdering(); column = rowCopy.getMutableIndices(); rowStart = rowCopy.getMutableVectorStarts(); elementByRow = rowCopy.getMutableElements(); rowLength = rowCopy.getMutableVectorLengths(); } double * objective = newModel->objective(); double offset = objectiveOffset(); int numberRowsLook=0; #ifdef TWOFER bool orderedMatrix=true; #endif int nChanged = 1; bool feasible=true; //#define CLP_NO_SUBS for (int iRow=0;iRow0 #ifndef NDEBUG checkBasis(newModel, rowType, columnType); #endif #endif int nPoss=2; #if DEBUG_SOME > 0 xxxxxx--; if (xxxxxx<=0) nPoss=1; if (xxxxxx<-1000) nPoss=-1; if (xxxxxx==1) { printf("bad\n"); } #endif if (rowLength[iRow]<=nPoss&&!rowType[iRow]) { if (rowLength[iRow]<=1) { if (rowLength[iRow]==1) { #ifndef CLP_NO_SUBS // See if already marked if ((rowStatus[iRow]&128)==0) { rowStatus[iRow] |= 128; whichRows[numberRowsLook++]=iRow; assert (numberRowsLook<=numberRows_); } #endif } else { #if DEBUG_SOME > 0 printf("Dropping null row %d (status %d) - nActions %d\n", iRow,getRowStatus(iRow),nActions); #endif if (rowLower[iRow] > primalTolerance_ || rowUpper[iRow] <-primalTolerance_) { feasible=false; nChanged=-1; numberRowsLook=0; break; } rowType[iRow]=1; clpPresolveInfo1_4_8 thisInfo; thisInfo.oldRowLower=(rowLower_[iRow]>-1.0e30) ? rowLower_[iRow]-rowLower[iRow] : rowLower[iRow]; thisInfo.oldRowUpper=(rowUpper_[iRow]<1.0e30) ? rowUpper_[iRow]-rowUpper[iRow] : rowUpper[iRow]; thisInfo.row=iRow; int n=rowLength[iRow]; CoinBigIndex start=rowStart[iRow]; thisInfo.lengthRow=n; //thisInfo.column=-1; infoA[nActions].infoOffset=static_cast(stuff.putStuff-startStuff); infoA[nActions].type=1; nActions++; ClpCopyToMiniSave(stuff,reinterpret_cast(&thisInfo),sizeof(clpPresolveInfo1_4_8), n,column+start,elementByRow+start); } #ifdef TWOFER } else if (rowLower[iRow]==rowUpper[iRow]) { #ifndef CLP_NO_SUBS // See if already marked if ((rowStatus[iRow]&128)==0) { rowStatus[iRow] |= 128; whichRows[numberRowsLook++]=iRow; assert (numberRowsLook<=numberRows_); } #endif CoinBigIndex start = rowStart[iRow]; int iColumn1 = column[start]; double value1 = elementByRow[start]; int iColumn2 = column[start+1]; double value2 = elementByRow[start+1]; bool swap=false; double ratio = fabs(value1/value2); if (ratio<0.001||ratio>1000.0) { if (fabs(value1)0.0) { newLower = (dropUpper<1.0e30) ? rhs - multiplier*dropUpper : -COIN_DBL_MAX; newUpper = (dropLower>-1.0e30) ? rhs - multiplier*dropLower : COIN_DBL_MAX; } else { newUpper = (dropUpper<1.0e30) ? rhs - multiplier*dropUpper : COIN_DBL_MAX; newLower = (dropLower>-1.0e30) ? rhs - multiplier*dropLower : -COIN_DBL_MAX; } //columnType[iColumn1]=3; columnType[iColumn2]=14; rowType[iRow]=14; rhs = rowLower[iRow]/value2; multiplier = value1/value2; clpPresolveInfo14 thisInfo; thisInfo.oldColumnLower=columnLower[iColumn1]; thisInfo.oldColumnUpper=columnUpper[iColumn1]; thisInfo.oldColumnLower2=columnLower[iColumn2]; thisInfo.oldColumnUpper2=columnUpper[iColumn2]; thisInfo.oldObjective2=objective[iColumn2]; thisInfo.value1=value1; thisInfo.rhs=rowLower[iRow]; thisInfo.row=iRow; thisInfo.column=iColumn1; thisInfo.column2=iColumn2; int nel=columnLength[iColumn2]; CoinBigIndex startCol=columnStart[iColumn2]; thisInfo.lengthColumn2=nel; infoA[nActions].infoOffset=static_cast(stuff.putStuff-startStuff); infoA[nActions].type=14; nActions++; ClpCopyToMiniSave(stuff,reinterpret_cast(&thisInfo),sizeof(clpPresolveInfo14), nel,row+startCol,element+startCol); newLower = CoinMax(newLower,columnLower[iColumn1]); newUpper = CoinMin(newUpper,columnUpper[iColumn1]); if (newLower>newUpper+primalTolerance_) { feasible=false; nChanged=-1; numberRowsLook=0; break; } columnLower[iColumn1]=newLower; columnUpper[iColumn1]=newUpper; #if DEBUG_SOME > 0 printf("Dropping doubleton row %d (status %d) keeping column %d (status %d) dropping %d (status %d) (mult,rhs %g %g) - nActions %d\n", iRow,getRowStatus(iRow),iColumn1,getColumnStatus(iColumn1),iColumn2,getColumnStatus(iColumn2),multiplier,rhs,nActions); #endif objective[iColumn1] -= objective[iColumn2]*multiplier; offset -= rowLower[iRow]*(objective[iColumn2]*multiplier); bool needDrop=false; if (newModel->getRowStatus(iRow)!=basic) { if (newModel->getColumnStatus(iColumn2)!=basic) { // On way back may as well have column basic newModel->setColumnStatus(iColumn2,basic); // need to drop basic if (newModel->getColumnStatus(iColumn1)==basic) { //setColumnStatus(iColumn1,superBasic); newModel->setColumnStatus(iColumn1,superBasic); } else { // not much we can do #if DEBUG_SOME > 0 printf("dropping but no basic a\n"); #endif } } else { // looks good } } else { if (newModel->getColumnStatus(iColumn2)!=basic) { // looks good } else { // need to keep a basic if (newModel->getColumnStatus(iColumn1)!=basic) { //setColumnStatus(iColumn2,superBasic); //setColumnStatus(iColumn1,basic); newModel->setColumnStatus(iColumn1,basic); } else { // not much we can do #if DEBUG_SOME > 0 printf("dropping but all basic a\n"); #endif needDrop=true; //setColumnStatus(iColumn2,superBasic); } } } int n=0; start = columnStart[iColumn1]; for (int i=start;i-1.0e30) rowLower[jRow] -= rhsMod; if (rowUpper[jRow]<1.0e30) rowUpper[jRow] -= rhsMod; if (!value) { array[jRow]=valueNew; whichRows2[n++]=jRow; } else { if (!valueNew) valueNew=1.0e-100; array[jRow]=valueNew; } } } columnLength[iColumn2]=0; start = columnStart[iColumn1]; if (n>columnLength[iColumn1]) { orderedMatrix=false; if (lastElement+n>lastGood) { // pack down CoinBigIndex put=lastElement; for (int iColumn=0;iColumngetRowStatus(jRow)!=basic) { newModel->setRowStatus(jRow,basic); needDrop=false; } } // take out of row copy int startR = rowStart[jRow]; int putR=startR; for (int i=startR;i1&&jRow 0 printf("Dropping null free row %d (status %d) - nActions %d\n", iRow,getRowStatus(iRow),nActions); #endif rowType[iRow]=1; clpPresolveInfo1_4_8 thisInfo; thisInfo.oldRowLower=(rowLower_[iRow]>-1.0e30) ? rowLower_[iRow]-rowLower[iRow] : rowLower[iRow]; thisInfo.oldRowUpper=(rowUpper_[iRow]<1.0e30) ? rowUpper_[iRow]-rowUpper[iRow] : rowUpper[iRow]; thisInfo.row=iRow; int n=rowLength[iRow]; CoinBigIndex start=rowStart[iRow]; thisInfo.lengthRow=n; //thisInfo.column=-1; infoA[nActions].infoOffset=static_cast(stuff.putStuff-startStuff); infoA[nActions].type=1; nActions++; ClpCopyToMiniSave(stuff,reinterpret_cast(&thisInfo),sizeof(clpPresolveInfo1_4_8), n,column+start,elementByRow+start); // need to take out row CoinBigIndex end=start+n; rowLength[iRow]=0; for (CoinBigIndex k=start;k0 if (xxxxxx<-1000) nChanged=-1; #endif while (nChanged>0) { nChanged=0; int numberColumnsLook=0; for (int i=0;i0 #ifndef NDEBUG checkBasis(newModel, rowType, columnType); #endif #endif int iRow = whichRows[i]; // unmark assert ((rowStatus[iRow]&128)!=0); rowStatus[iRow] &= 127; if (rowLength[iRow]==1) { //rowType[iRow]=55; int iColumn = column[rowStart[iRow]]; if (/*columnType[iColumn]==14||*/columnType[iColumn]<-1) continue; if (!columnType[iColumn]) { columnType[iColumn]=55; whichColumns[numberColumnsLook++]=iColumn; nChanged++; } #if 0 } else if (rowLength[iRow]==2) { if (rowLower[iRow]==rowUpper[iRow]) { CoinBigIndex start = rowStart[iRow]; int iColumn1 = column[start]; int iColumn2 = column[start+1]; if (!columnType[iColumn1]&&!columnType[iColumn2]) { if (fabs(elementByRow[start])0 #ifndef NDEBUG checkBasis(newModel, rowType, columnType); #endif #endif nChanged++; int iColumn = whichColumns[iLook]; if (columnType[iColumn]!=55&&columnType[iColumn]>10) continue; if (columnType[iColumn]==55) columnType[iColumn]=0; CoinBigIndex start=columnStart[iColumn]; int jRowLower=-1; double newLower=columnLower[iColumn]; int jRowUpper=-1; double newUpper=columnUpper[iColumn]; double coefficientLower=0.0; double coefficientUpper=0.0; for (CoinBigIndex i=start;i=0); // adjust bounds double value = elementByRow[rowStart[iRow]]; double lower = newLower; double upper = newUpper; if (value>0.0) { if (rowUpper[iRow]<1.0e30) upper = rowUpper[iRow]/value; if (rowLower[iRow]>-1.0e30) lower = rowLower[iRow]/value; } else { if (rowUpper[iRow]<1.0e30) lower = rowUpper[iRow]/value; if (rowLower[iRow]>-1.0e30) upper = rowLower[iRow]/value; } if (lower>newLower+primalTolerance_) { if (lower>newUpper+primalTolerance_) { feasible=false; nChanged=-1; numberColumnsLook=0; break; } else if (lower>newUpper-primalTolerance_) { newLower=newUpper; } else { newLower = CoinMax(lower,newLower); } jRowLower=iRow; coefficientLower=value; } if (upper=0||jRowUpper>=0) { clpPresolveInfo2 thisInfo; if (jRowLower>=0) { thisInfo.oldRowLower=(rowLower_[jRowLower]>-1.0e30) ? rowLower_[jRowLower]-rowLower[jRowLower] : rowLower[jRowLower]; thisInfo.oldRowUpper=(rowUpper_[jRowLower]<1.0e30) ? rowUpper_[jRowLower]-rowUpper[jRowLower] : rowUpper[jRowLower]; thisInfo.row=jRowLower; thisInfo.coefficient=coefficientLower; } else { thisInfo.row=-1; #ifndef NDEBUG thisInfo.oldRowLower=COIN_DBL_MAX; thisInfo.oldRowUpper=-COIN_DBL_MAX; thisInfo.coefficient=0.0; #endif } if (jRowUpper>=0&&jRowLower!=jRowUpper) { thisInfo.oldRowLower2=(rowLower_[jRowUpper]>-1.0e30) ? rowLower_[jRowUpper]-rowLower[jRowUpper] : rowLower[jRowUpper]; thisInfo.oldRowUpper2=(rowUpper_[jRowUpper]<1.0e30) ? rowUpper_[jRowUpper]-rowUpper[jRowUpper] : rowUpper[jRowUpper]; thisInfo.row2=jRowUpper; thisInfo.coefficient2=coefficientUpper; } else { thisInfo.row2=-1; #ifndef NDEBUG thisInfo.oldRowLower2=COIN_DBL_MAX; thisInfo.oldRowUpper2=-COIN_DBL_MAX; thisInfo.coefficient2=0.0; #endif } thisInfo.oldColumnLower=columnLower[iColumn]; thisInfo.oldColumnUpper=columnUpper[iColumn]; columnLower[iColumn]=newLower; columnUpper[iColumn]=newUpper; thisInfo.column=iColumn; infoA[nActions].infoOffset=static_cast(stuff.putStuff-startStuff); ClpCopyToMiniSave(stuff,reinterpret_cast(&thisInfo),sizeof(clpPresolveInfo2), 0,NULL,NULL); infoA[nActions].type=2; nActions++; } for (CoinBigIndex i=start;i=0&&rowType[iRow]!=5) { #if DEBUG_SOME > 0 printf("Dropping singleton row %d (status %d) because of column %d (status %d) - jRow lower/upper %d/%d - nActions %d\n", iRow,getRowStatus(iRow),iColumn, getColumnStatus(iColumn),jRowLower,jRowUpper,nActions); #endif if (newModel->getRowStatus(iRow)!=basic) { //newModel->setRowStatus(iRow,basic); numberNonBasicSlacksOut++; } rowType[iRow]=1; if (iRow!=jRowLower&&iRow!=jRowUpper) { // mark as redundant infoA[nActions].infoOffset=static_cast(stuff.putStuff-startStuff); clpPresolveInfo1_4_8 thisInfo; thisInfo.oldRowLower=(rowLower_[iRow]>-1.0e30) ? rowLower_[iRow]-rowLower[iRow] : rowLower[iRow]; thisInfo.oldRowUpper=(rowUpper_[iRow]<1.0e30) ? rowUpper_[iRow]-rowUpper[iRow] : rowUpper[iRow]; thisInfo.row=iRow; int n=rowLength[iRow]; CoinBigIndex start=rowStart[iRow]; thisInfo.lengthRow=n; ClpCopyToMiniSave(stuff,reinterpret_cast(&thisInfo),sizeof(clpPresolveInfo1_4_8), n,column+start,elementByRow+start); infoA[nActions].type=1; nActions++; } rowLength[iRow]=0; } else if (rowType[iRow]<=0) { row[put]=iRow; double value = element[i]; element[put++]=value; if (rowType[iRow]>=0&&iFlag<3) { assert(rowType[iRow]==0); double lower = rowLower[iRow]; double upper = rowUpper[iRow]; if (-1.0e20 < lower && upper < 1.0e20) { // bounded - we lose iFlag=-1; //break; } else if (-1.0e20 < lower || upper < 1.0e20) { nonFree++; } // see what this particular row says // jFlag == 2 ==> up is towards feasibility int jFlag = (value > 0.0 ? (upper > 1.0e20 ? 2 : 1) : (lower < -1.0e20 ? 2 : 1)); if (iFlag) { // check that it agrees with iFlag. if (iFlag!=jFlag) { iFlag=-1; } } else { // first row -- initialize iFlag iFlag=jFlag; } } else if (rowType[iRow]<0) { iFlag=-1; // be safe } } } // Do we need to switch status of iColumn? if (numberNonBasicSlacksOut>0) { // make iColumn non basic if possible if (newModel->getColumnStatus(iColumn)==basic) { newModel->setColumnStatus(iColumn,superBasic); } } double cost = objective[iColumn]*optimizationDirection_; int length = put-columnStart[iColumn]; if (!length) { if (!cost) { // put to closest to zero if (fabs(columnLower[iColumn])0.0) { iFlag=1; } else { iFlag=2; } } else { if (cost>0.0&&iFlag==2) iFlag=-1; else if (cost<0.0&&iFlag==1) iFlag=-1; } columnLength[iColumn]=length; //#define NO_MOVABLE #ifdef NO_MOVABLE iFlag=-1; #endif if (iFlag>0&&nonFree) { double newValue; if (iFlag==2) { // fix to upper newValue =CoinMin(columnUpper[iColumn],1.0e20); } else { // fix to lower newValue =CoinMax(columnLower[iColumn],-1.0e20); } columnActivity_[iColumn]=newValue; #if DEBUG_SOME > 0 if (newModel->getColumnStatus(iColumn)== basic) { // ? move basic back onto sub if can? iFlag += 2; } printf("Dropping movable column %d - iFlag %d - jRow lower/upper %d/%d - nActions %d\n", iColumn,iFlag,jRowLower,jRowUpper,nActions); #endif columnType[iColumn]=11; if (newModel->getColumnStatus(iColumn)== basic) { // need to put status somewhere else int shortestNumber=numberColumns_; int shortest=-1; for (int j=start;jgetRowStatus(iRow)!= basic) { shortest=iRow; shortestNumber = rowLength[iRow]; } } if (shortest>=0) { // make basic newModel->setRowStatus(shortest,basic); newModel->setColumnStatus(iColumn,superBasic); } else { // put on a column shortestNumber=numberColumns_; shortest=-1; for (int j=start;jgetColumnStatus(jColumn)!= basic) { shortest=jColumn; shortestNumber = rowLength[iRow]; } } } } if (shortest>=0) { // make basic newModel->setColumnStatus(shortest,basic); } else { #if DEBUG_SOME > 0 printf("what now - dropping - basic\n"); #endif } } } clpPresolveInfo11 thisInfo; thisInfo.oldColumnLower=columnLower[iColumn]; thisInfo.oldColumnUpper=columnUpper[iColumn]; thisInfo.fixedTo=newValue; columnLower[iColumn]=newValue; columnUpper[iColumn]=newValue; thisInfo.column=iColumn; int n=columnLength[iColumn]; CoinBigIndex start=columnStart[iColumn]; thisInfo.lengthColumn=n; infoA[nActions].infoOffset=static_cast(stuff.putStuff-startStuff); infoA[nActions].type=11; nActions++; ClpCopyToMiniSave(stuff,reinterpret_cast(&thisInfo),sizeof(clpPresolveInfo11), n,row+start,element+start); // adjust rhs and take out of rows columnLength[iColumn]=0; nChanged++; for (int j=start;j-1.0e20) rowLower[iRow]=lower-value; double upper = rowUpper[iRow]; if (upper<1.0e20) rowUpper[iRow]=upper-value; // take out of row copy (and put on list) assert (rowType[iRow]<=0&&rowType[iRow]>-2); // See if already marked (will get to row later in loop if ((rowStatus[iRow]&128)==0) { rowStatus[iRow] |= 128; whichRows[numberRowsLook++]=iRow; assert (numberRowsLook<=numberRows_); } int start = rowStart[iRow]; int put=start; for (int i=start;ieventWithInfo(ClpEventHandler::moreMiniPresolve,&moreInfo); newModel->setObjectiveOffset(offset); int nChar2 = nActions*static_cast(sizeof(clpPresolveInfo))+static_cast(stuff.putStuff-startStuff); clpPresolveInfo * infoData = reinterpret_cast(new char[nChar2]); memcpy(infoData,infoA,nActions*sizeof(clpPresolveInfo)); char * info2 = reinterpret_cast(infoData+nActions); memcpy(info2,startStuff,stuff.putStuff-startStuff); listInfo * infoNew = new listInfo; infoNew->numberEntries=nActions; infoNew->maximumEntries=nActions; infoNew->start=infoData; infoNew->numberInitial=numberInitial; *infoOut=infoNew; int nRows=0; for (int iRow=0;iRow0) whichRows[nRows++]=iRow; } int nColumns=0; for (int iColumn=0;iColumn10) whichColumns[nColumns++]=iColumn; } #ifdef FUNNY_CHECK { CoinPackedMatrix rowCopy2 = *this->matrix(); rowCopy2.reverseOrdering(); int * column2 = rowCopy2.getMutableIndices(); CoinBigIndex * rowStart2 = rowCopy2.getMutableVectorStarts(); double * elementByRow2 = rowCopy2.getMutableElements(); int * rowLength2 = rowCopy2.getMutableVectorLengths(); printf("Odd rows\n"); for (int iRow=0;iRow ",iRow); for (CoinBigIndex j=start;j= %g/%g\n",rowLower[iRow],rowLower_[iRow]); } } printf("now columns\n"); for (int iColumn=0;iColumn 0 printf("%d Row types and lookup\n",nRows); int nBNew=0; int iNew=0; for (int iRow=0;iRowgetRowStatus(iRow)==basic) { nBNew++; xNew='B'; } printf("%d -> %d type %d - new status %c\n",iRow,iNew,rowType[iRow],xNew); iNew++; } } printf("%d Column types and lookup\n",nColumns); iNew=0; for (int iColumn=0;iColumngetColumnStatus(iColumn)==basic) { nBNew++; xNew='B'; } printf("%d -> %d type %d - new status %c\n",iColumn,iNew,columnType[iColumn],xNew); iNew++; } } printf("Deleting %d rows (now %d) and %d columns (%d basic)\n",nRows,numberRows_-nRows, nColumns,nBNew); #else #if DEBUG_SOME >0 printf("Deleting %d rows (now %d) and %d columns\n",nRows,numberRows_-nRows, nColumns); #endif #endif #if 0 newModel->deleteRows(nRows,whichRows); newModel->deleteColumns(nColumns,whichColumns); #else newModel->deleteRowsAndColumns(nRows,whichRows,nColumns,whichColumns); #endif } else { delete newModel; newModel=NULL; *infoOut=NULL; } delete [] whichRows; delete [] infoA; delete [] startStuff; delete [] array; return newModel; } // After mini presolve void ClpSimplex::miniPostsolve(const ClpSimplex * presolvedModel, void * infoIn) { int numberTotal=numberRows_+numberColumns_; listInfo * infoX = reinterpret_cast(infoIn); int nActions=infoX->numberEntries; #if DEBUG_SOME > 0 #ifndef NDEBUG int numberInitial=infoX->numberInitial; #endif #endif clpPresolveInfo * infoA = infoX->start; char * startStuff = reinterpret_cast(infoA+nActions); // move status and solution across int numberColumns2=presolvedModel->numberColumns(); const double * solution2 = presolvedModel->primalColumnSolution(); unsigned char * rowStatus2 = presolvedModel->statusArray()+numberColumns2; unsigned char * columnStatus2 = presolvedModel->statusArray(); unsigned char * rowStatus = status_+numberColumns_; unsigned char * columnStatus = status_; char * rowType = new char [numberTotal]; memset(rowType,0,numberTotal); char * columnType = rowType+numberRows_; double * rowLowerX = new double [3*numberRows_+3*numberColumns_+CoinMax(numberRows_,numberColumns_)]; double * rowUpperX = rowLowerX+numberRows_; double * columnLowerX = rowUpperX+numberRows_; double * columnUpperX = columnLowerX+numberColumns_; double * objectiveX = columnUpperX+numberColumns_; double * tempElement = objectiveX+numberColumns_; double * array = tempElement+CoinMax(numberRows_,numberColumns_); memset(array,0,numberRows_*sizeof(double)); int * tempIndex = new int [CoinMax(numberRows_,numberColumns_)+4+2*numberColumns_+numberRows_]; int * forward = tempIndex+CoinMax(numberRows_,numberColumns_)+1; int * backward = forward + numberColumns_+2; int * whichRows2 = backward + numberColumns_+1; for (int i=-1;igetIndices(); const CoinBigIndex * columnStart = matrix()->getVectorStarts(); const int * columnLength = matrix()->getVectorLengths(); const double * element = matrix()->getElements(); // forwards so dropped column at end for (int i=0;i(type); } break; case 2: // sub { clpPresolveInfo2 thisInfo; memcpy(&thisInfo,getStuff,sizeof(clpPresolveInfo2)); iRow = thisInfo.row; if (iRow>=0) rowType[iRow]=2; iRow = thisInfo.row2; if (iRow>=0) rowType[iRow]=2; iColumn = thisInfo.column; columnType[iColumn]=2; } break; case 11: // movable column { clpPresolveInfo11 thisInfo; memcpy(&thisInfo,getStuff,sizeof(clpPresolveInfo11)); iColumn = thisInfo.column; columnType[iColumn]=11; } break; case 13: // empty column { clpPresolveInfo13 thisInfo; memcpy(&thisInfo,getStuff,sizeof(clpPresolveInfo13)); iColumn = thisInfo.column; columnType[iColumn]=13; } break; case 14: // doubleton { clpPresolveInfo14 thisInfo; memcpy(&thisInfo,getStuff,sizeof(clpPresolveInfo14)); iRow = thisInfo.row; iColumn = thisInfo.column; int iColumn2 = thisInfo.column2; columnType[iColumn]=3; columnType[iColumn2]=14; rowType[iRow]=3; } break; } #if DEBUG_SOME > 0 printf("Action %d type %d row %d column %d\n", i,type,iRow,iColumn); #endif } int iGet=0; const double * rowLowerY = presolvedModel->rowLower(); const double * rowUpperY = presolvedModel->rowUpper(); for (int iRow=0;iRowrowActivity_[iGet]; dual_[iRow]=presolvedModel->dual_[iGet]; rowLowerX[iRow]=rowLowerY[iGet]; rowUpperX[iRow]=rowUpperY[iGet]; tempIndex[iGet]=iRow; iGet++; } else { setRowStatus(iRow,basic); } } assert (iGet==presolvedModel->numberRows()); CoinPackedMatrix matrixX; int numberElementsOriginal=matrix_->getNumElements(); const int * rowY = presolvedModel->matrix()->getIndices(); const CoinBigIndex * columnStartY = presolvedModel->matrix()->getVectorStarts(); const int * columnLengthY = presolvedModel->matrix()->getVectorLengths(); const double * elementY = presolvedModel->matrix()->getElements(); iGet=0; CoinBigIndex put=0; for (int iColumn=0;iColumncolumnLower(); const double * columnUpperY = presolvedModel->columnUpper(); iGet=0; put=0; memcpy(objectiveX,this->objective(),numberColumns_*sizeof(double)); const double * objectiveY=presolvedModel->objective(); for (int iColumn=0;iColumn=0) next += CoinMax(columnLength[iColumn]-columnLengthY[iGet],0)+spare; columnStatus[iColumn]=columnStatus2[iGet]; columnActivity_[iColumn]=solution2[iGet]; columnLowerX[iColumn]=columnLowerY[iGet]; columnUpperX[iColumn]=columnUpperY[iGet]; columnLengthX[iColumn]=columnLengthY[iGet]; objectiveX[iColumn]=objectiveY[iGet]; for (CoinBigIndex j=columnStartY[iGet];jcolumnActivity_[iGet]; iGet++; columnType[iColumn]=0; put = next; } else { put += CoinMax(columnLength[iColumn]+spare,0); columnActivity_[iColumn]=0.0; columnType[iColumn]=1; columnLengthX[iColumn]=0; setColumnStatus(iColumn,superBasic); } } assert (put<=lastElement); columnStartX[numberColumns_]=lastElement+numberElementsOriginal; assert (put<=lastElement); assert (iGet==numberColumns2); matrixX.times(columnActivity_,rowActivity_); if (optimizationDirection_<0) { for (int i=0;i 0 double * tempRhs=new double[numberRows_]; #endif #ifndef NDEBUG bool checkMatrixAtEnd=true; #endif for (int i=nActions-1;i>=0;i--) { #if DEBUG_SOME > 0 #if 1 //ndef NDEBUG memset(tempRhs,0,numberRows_*sizeof(double)); for (int iColumn=0;iColumncolumnUpper_[iColumn]+1.0e-5) //printf ("Bad column %d %g <= %g <= %g\n",iColumn, // columnLower_[iColumn],columnActivity_[iColumn],columnUpper_[iColumn]); double value=columnActivity_[iColumn]; for (CoinBigIndex j=columnStartX[iColumn]; j1.0e-4) printf("Row %d temprhs %g rowActivity_ %g\n",iRow,tempRhs[iRow], rowActivity_[iRow]); if (tempRhs[iRow]rowUpperX[iRow]+1.0e-4) { printf("Row %d %g %g %g\n",iRow,rowLowerX[iRow], tempRhs[iRow],rowUpperX[iRow]); nBadRow++; } } assert (!nBadRow); #endif #ifndef NDEBUG if (i>=numberInitial&&true) { for (int iColumn=0;iColumn10.0*dualTolerance_&& columnActivity_[iColumn]>columnLowerX[iColumn]+primalTolerance_) printf("bad dj on column %d lb dj %g in/out %c\n",iColumn,djValue,inOut); else if (djValue<-10.0*dualTolerance_&& columnActivity_[iColumn]0 printf("Action %d type %d\n",i,type); #ifndef NDEBUG checkBasis(this, rowType, columnType); #endif #endif switch (type) { case 1: case 4: case 8: case 9: // redundant { #ifndef NDEBUG if (type==4) checkMatrixAtEnd=false; #endif clpPresolveInfo8 thisInfo; copyFromSave(restore,infoA[i],&thisInfo); iRow = thisInfo.row; // Insert row and modify RHS #ifdef CLP_USER_DRIVEN if (type>=8) { thisInfo.tempElement=tempElement; thisInfo.tempIndex=tempIndex; thisInfo.rowLowerX=rowLowerX; thisInfo.rowUpperX=rowUpperX; eventHandler_->eventWithInfo(ClpEventHandler::modifyMatrixInMiniPostsolve,&thisInfo); } else { #endif if (rowLower_[iRow]>-1.0e30) rowLowerX[iRow]=rowLower_[iRow]-thisInfo.oldRowLower; else rowLowerX[iRow]=thisInfo.oldRowLower; if (rowUpper_[iRow]<1.0e30) rowUpperX[iRow]=rowUpper_[iRow]-thisInfo.oldRowUpper; else rowUpperX[iRow]=thisInfo.oldRowUpper; #ifdef CLP_USER_DRIVEN } #endif int n=thisInfo.lengthRow; double rhs=0.0; for (int i=0;i=0) { rowType[jRowLower]=0; if (rowLower_[jRowLower]>-1.0e30) rowLowerX[jRowLower]=rowLower_[jRowLower]-thisInfo.oldRowLower; else rowLowerX[jRowLower]=thisInfo.oldRowLower; if (rowUpper_[jRowLower]<1.0e30) rowUpperX[jRowLower]=rowUpper_[jRowLower]-thisInfo.oldRowUpper; else rowUpperX[jRowLower]=thisInfo.oldRowUpper; columnLengthX[iColumn]++; rowX[start+length]=jRowLower; elementX[start+length]=valueLower; rowActivity_[jRowLower]=valueLower*columnActivity_[iColumn]; // start off with slack basic setRowStatus(jRowLower,basic); length++; } if (jRowUpper>=0) { rowType[jRowUpper]=0; if (rowLower_[jRowUpper]>-1.0e30) rowLowerX[jRowUpper]=rowLower_[jRowUpper]-thisInfo.oldRowLower2; else rowLowerX[jRowUpper]=thisInfo.oldRowLower2; if (rowUpper_[jRowUpper]<1.0e30) rowUpperX[jRowUpper]=rowUpper_[jRowUpper]-thisInfo.oldRowUpper2; else rowUpperX[jRowUpper]=thisInfo.oldRowUpper2; columnLengthX[iColumn]++; rowX[start+length]=jRowUpper; elementX[start+length]=valueUpper; rowActivity_[jRowUpper]=valueUpper*columnActivity_[iColumn]; // start off with slack basic setRowStatus(jRowUpper,basic); length++; } double djValue = objectiveX[iColumn]; for (CoinBigIndex j=columnStartX[iColumn]; jthisInfo.oldColumnLower+primalTolerance_&& solValuedualTolerance_; } if (solValue<=thisInfo.oldColumnLower+primalTolerance_&&djValue<-dualTolerance_) { #if DEBUG_SOME > 1 printf("odd column %d at lb of %g has dj of %g\n", iColumn,thisInfo.oldColumnLower,djValue); #endif hasToBeBasic=true; } else if (solValue>=thisInfo.oldColumnUpper-primalTolerance_&&djValue>dualTolerance_) { #if DEBUG_SOME > 1 printf("odd column %d at ub of %g has dj of %g\n", iColumn,thisInfo.oldColumnUpper,djValue); #endif hasToBeBasic=true; } if (hasToBeBasic) { if (jRowLower>=0&&jRowUpper>=0) { // choose #if DEBUG_SOME > 1 printf("lower row %d %g <= %g <= %g\n", jRowLower,rowLowerX[jRowLower],rowActivity_[jRowLower], rowUpperX[jRowLower]); #endif double awayLower = CoinMin(rowActivity_[jRowLower]-rowLowerX[jRowLower], rowUpperX[jRowLower]-rowActivity_[jRowLower]); #if DEBUG_SOME > 1 printf("upper row %d %g <= %g <= %g\n", jRowUpper,rowLowerX[jRowUpper],rowActivity_[jRowUpper], rowUpperX[jRowUpper]); #endif double awayUpper = CoinMin(rowActivity_[jRowUpper]-rowLowerX[jRowUpper], rowUpperX[jRowUpper]-rowActivity_[jRowUpper]); if (awayLower>awayUpper) jRowLower=-1; } if (jRowLower<0) { setRowStatus(jRowUpper,superBasic); setColumnStatus(iColumn,basic); dual_[jRowUpper]=djValue/valueUpper; } else { setRowStatus(jRowLower,superBasic); setColumnStatus(iColumn,basic); dual_[jRowLower]=djValue/valueLower; } } } columnLowerX[iColumn]=thisInfo.oldColumnLower; columnUpperX[iColumn]=thisInfo.oldColumnUpper; } break; case 11: // movable column { clpPresolveInfo11 thisInfo; copyFromSave(restore,infoA[i],&thisInfo); iColumn = thisInfo.column; columnType[iColumn]=0; assert (!columnLengthX[iColumn]); int newLength=thisInfo.lengthColumn; CoinBigIndex start=columnStartX[iColumn]; int nextColumn=forward[iColumn]; CoinBigIndex startNext=columnStartX[nextColumn]; if (start+newLength>startNext) { // need more moveAround(numberColumns_,numberElementsOriginal, iColumn,newLength, forward,backward,columnStartX,columnLengthX, rowX,elementX); start=columnStartX[iColumn]; } columnLengthX[iColumn]=newLength; memcpy(rowX+start,tempIndex,newLength*sizeof(int)); memcpy(elementX+start,tempElement,newLength*sizeof(double)); double solValue=thisInfo.fixedTo; columnActivity_[iColumn]=solValue; if (solValue) { for (int j=columnStartX[iColumn]; j-1.0e30) rowLowerX[jRow] += value; if (rowUpperX[jRow]<1.0e30) rowUpperX[jRow] += value; } } double djValue = objectiveX[iColumn]; for (CoinBigIndex j=columnStartX[iColumn]; jthisInfo.oldColumnLower+primalTolerance_&& solValuedualTolerance_; } if (solValue<=thisInfo.oldColumnLower+primalTolerance_&&djValue<-dualTolerance_) { #if DEBUG_SOME > 1 printf("odd column %d at lb of %g has dj of %g\n", iColumn,thisInfo.oldColumnLower,djValue); #endif hasToBeBasic=true; } else if (solValue>=thisInfo.oldColumnUpper-primalTolerance_&&djValue>dualTolerance_) { #if DEBUG_SOME > 1 printf("odd column %d at ub of %g has dj of %g\n", iColumn,thisInfo.oldColumnUpper,djValue); #endif hasToBeBasic=true; } if (hasToBeBasic) { //abort(); //setRowStatus(iRow,superBasic); setColumnStatus(iColumn,basic); //dual_[iRow]=djValue/value; } } columnLowerX[iColumn]=thisInfo.oldColumnLower; columnUpperX[iColumn]=thisInfo.oldColumnUpper; } break; case 13: // empty (or initially fixed) column { clpPresolveInfo13 thisInfo; copyFromSave(restore,infoA[i],&thisInfo); iColumn = thisInfo.column; columnType[iColumn]=0; columnLowerX[iColumn]=thisInfo.oldColumnLower; columnUpperX[iColumn]=thisInfo.oldColumnUpper; assert (!columnLengthX[iColumn]); int newLength=columnLength[iColumn]; CoinBigIndex startOriginal = columnStart[iColumn]; double solValue=columnLower_[iColumn]; columnActivity_[iColumn]=solValue; if (newLength&&solValue) { for (int j=startOriginal;j-1.0e20) rowLowerX[iRow]=lower+value; double upper = rowUpperX[iRow]; if (upper<1.0e20) rowUpperX[iRow]=upper+value; } } #ifndef NDEBUG // copy from original CoinBigIndex start=columnStartX[iColumn]; int nextColumn=forward[iColumn]; CoinBigIndex startNext=columnStartX[nextColumn]; if (start+newLength>startNext) { // need more moveAround(numberColumns_,numberElementsOriginal, iColumn,newLength, forward,backward,columnStartX,columnLengthX, rowX,elementX); start=columnStartX[iColumn]; } columnLengthX[iColumn]=newLength; memcpy(rowX+start,row+startOriginal,newLength*sizeof(int)); memcpy(elementX+start,element+startOriginal,newLength*sizeof(double)); #endif } break; case 14: // doubleton { clpPresolveInfo14 thisInfo; copyFromSave(restore,infoA[i],&thisInfo); iRow = thisInfo.row; rowType[iRow]=0; int iColumn1 = thisInfo.column; int iColumn2 = thisInfo.column2; columnType[iColumn2]=0; double value1=thisInfo.value1; int length=columnLengthX[iColumn1]; CoinBigIndex start=columnStartX[iColumn1]; for (int i=0;istartNext) { // need more moveAround(numberColumns_,numberElementsOriginal, iColumn2,newLength, forward,backward,columnStartX,columnLengthX, rowX,elementX); start=columnStartX[iColumn2]; } columnLengthX[iColumn2]=newLength; memcpy(rowX+start,tempIndex,newLength*sizeof(int)); memcpy(elementX+start,tempElement,newLength*sizeof(double)); double value2=0.0; for (int i=0;i-1.0e30) rowLowerX[jRow] += rhsMod; if (rowUpperX[jRow]<1.0e30) rowUpperX[jRow] += rhsMod; rowActivity_[jRow] += rhsMod; if (!value) { array[jRow]=valueNew; whichRows2[n++]=jRow; } else { if (!valueNew) valueNew=1.0e-100; array[jRow]=valueNew; } } length=0; for (int i=0;istartNext) { // need more moveAround(numberColumns_,numberElementsOriginal, iColumn1,length, forward,backward,columnStartX,columnLengthX, rowX,elementX); start=columnStartX[iColumn1]; } columnLengthX[iColumn1]=length; memcpy(rowX+start,tempIndex,length*sizeof(int)); memcpy(elementX+start,tempElement,length*sizeof(double)); objectiveX[iColumn2]=thisInfo.oldObjective2; objectiveX[iColumn1] += objectiveX[iColumn2]*multiplier; //offset += rhs*(objectiveX[iColumn2]*multiplier); double value = multiplier1-columnActivity_[iColumn1]*multiplier; #if DEBUG_SOME > 0 printf("type14 column2 %d rhs %g value1 %g - value %g\n", iColumn2,thisInfo.rhs,thisInfo.value1,value); #endif columnActivity_[iColumn2]=value; double djValue1 = objectiveX[iColumn1]; for (CoinBigIndex j=columnStartX[iColumn1]; jdualTolerance_&&solValue>=upperValue-primalTolerance_) bad1=dj1; } double dj2 = djValue2-value2*pi; double bad2=0.0; if (!fixed2) { if (dj2<-dualTolerance_&&solValue2<=lowerValue2+primalTolerance_) bad2=-dj2; else if (dj2>dualTolerance_&&solValue2>=upperValue2-primalTolerance_) bad2=dj2; } if (CoinMax(bad1,bad2)lowerValue+primalTolerance_&& solValuedualTolerance_) choice=1; } else if (solValue2>lowerValue2+primalTolerance_&& solValue2dualTolerance_) choice=2; } if (choice==1) { // iColumn1 in basis setRowStatus(iRow,superBasic); setColumnStatus(iColumn1,basic); dual_[iRow]=djValue1/value1; } else if (choice==2) { // iColumn2 in basis setRowStatus(iRow,superBasic); setColumnStatus(iColumn2,basic); dual_[iRow]=djValue2/value2; } } else { if (fabs(djValue1)>10.0*dualTolerance_) { // iColumn2 in basis setRowStatus(iRow,superBasic); setColumnStatus(iColumn2,basic); dual_[iRow]=djValue2/value2; } else { // do we need iColumn2 in basis double solValue2 = columnActivity_[iColumn2]; double lowerValue2 = columnLowerX[iColumn2]; double upperValue2 = columnUpperX[iColumn2]; if (solValue2>lowerValue2+primalTolerance_&& solValue21.0e-4|| fabs(rowUpper_[iRow]-rowUpperX[iRow])>1.0e-4) printf("USER row %d lower,x %g %g upper,x %g %g\n",iRow,rowLower_[iRow],rowLowerX[iRow], rowUpper_[iRow],rowUpperX[iRow]); #endif } double * objective = this->objective(); for (int iColumn=0;iColumn0 matrix()->times(columnActivity_,rowActivity_); for (int i=0;i=columnLower_[i]-1.0e-5&& columnActivity_[i]<=columnUpper_[i]+1.0e-5); int nBad=0; for (int i=0;irowUpper_[i]+1.0e-5) { printf("Row %d %g %g %g\n",i,rowLower_[i], rowActivity_[i],rowUpper_[i]); nBad++; } } ClpTraceDebug (!nBad); #endif #if 1 //DEBUG_SOME > 0 delete [] tempRhs; #endif delete infoX; delete [] infoA; delete [] rowLowerX; } // mini presolve and solve void ClpSimplex::miniSolve(char * rowType, char *columnType,int algorithm, int startUp) { listInfo * info = NULL; ClpSimplex * small2 = miniPresolve(rowType,columnType,reinterpret_cast(&info)); if (algorithm<0) small2->dual(startUp); else small2->primal(startUp); miniPostsolve(small2,info); delete info; } CoinMP-1.8.3/Clp/src/ClpDynamicMatrix.cpp0000644000175000017500000034003212130766607016547 0ustar renerene/* $Id: ClpDynamicMatrix.cpp 1936 2013-04-09 10:29:27Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" #include "ClpQuadraticObjective.hpp" #include "ClpNonLinearCost.hpp" // at end to get min/max! #include "ClpDynamicMatrix.hpp" #include "ClpMessage.hpp" //#define CLP_DEBUG //#define CLP_DEBUG_PRINT //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpDynamicMatrix::ClpDynamicMatrix () : ClpPackedMatrix(), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), sumOfRelaxedDualInfeasibilities_(0.0), sumOfRelaxedPrimalInfeasibilities_(0.0), savedBestGubDual_(0.0), savedBestSet_(0), backToPivotRow_(NULL), keyVariable_(NULL), toIndex_(NULL), fromIndex_(NULL), numberSets_(0), numberActiveSets_(0), objectiveOffset_(0.0), lowerSet_(NULL), upperSet_(NULL), status_(NULL), model_(NULL), firstAvailable_(0), firstAvailableBefore_(0), firstDynamic_(0), lastDynamic_(0), numberStaticRows_(0), numberElements_(0), numberDualInfeasibilities_(0), numberPrimalInfeasibilities_(0), noCheck_(-1), infeasibilityWeight_(0.0), numberGubColumns_(0), maximumGubColumns_(0), maximumElements_(0), startSet_(NULL), next_(NULL), startColumn_(NULL), row_(NULL), element_(NULL), cost_(NULL), id_(NULL), dynamicStatus_(NULL), columnLower_(NULL), columnUpper_(NULL) { setType(15); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpDynamicMatrix::ClpDynamicMatrix (const ClpDynamicMatrix & rhs) : ClpPackedMatrix(rhs) { objectiveOffset_ = rhs.objectiveOffset_; numberSets_ = rhs.numberSets_; numberActiveSets_ = rhs.numberActiveSets_; firstAvailable_ = rhs.firstAvailable_; firstAvailableBefore_ = rhs.firstAvailableBefore_; firstDynamic_ = rhs.firstDynamic_; lastDynamic_ = rhs.lastDynamic_; numberStaticRows_ = rhs.numberStaticRows_; numberElements_ = rhs.numberElements_; backToPivotRow_ = ClpCopyOfArray(rhs.backToPivotRow_, lastDynamic_); keyVariable_ = ClpCopyOfArray(rhs.keyVariable_, numberSets_); toIndex_ = ClpCopyOfArray(rhs.toIndex_, numberSets_); fromIndex_ = ClpCopyOfArray(rhs.fromIndex_, getNumRows() + 1 - numberStaticRows_); lowerSet_ = ClpCopyOfArray(rhs.lowerSet_, numberSets_); upperSet_ = ClpCopyOfArray(rhs.upperSet_, numberSets_); status_ = ClpCopyOfArray(rhs.status_, static_cast(2*numberSets_+4*sizeof(int))); model_ = rhs.model_; sumDualInfeasibilities_ = rhs. sumDualInfeasibilities_; sumPrimalInfeasibilities_ = rhs.sumPrimalInfeasibilities_; sumOfRelaxedDualInfeasibilities_ = rhs.sumOfRelaxedDualInfeasibilities_; sumOfRelaxedPrimalInfeasibilities_ = rhs.sumOfRelaxedPrimalInfeasibilities_; numberDualInfeasibilities_ = rhs.numberDualInfeasibilities_; numberPrimalInfeasibilities_ = rhs.numberPrimalInfeasibilities_; savedBestGubDual_ = rhs.savedBestGubDual_; savedBestSet_ = rhs.savedBestSet_; noCheck_ = rhs.noCheck_; infeasibilityWeight_ = rhs.infeasibilityWeight_; // Now secondary data numberGubColumns_ = rhs.numberGubColumns_; maximumGubColumns_ = rhs.maximumGubColumns_; maximumElements_ = rhs.maximumElements_; startSet_ = ClpCopyOfArray(rhs.startSet_, numberSets_+1); next_ = ClpCopyOfArray(rhs.next_, maximumGubColumns_); startColumn_ = ClpCopyOfArray(rhs.startColumn_, maximumGubColumns_ + 1); row_ = ClpCopyOfArray(rhs.row_, maximumElements_); element_ = ClpCopyOfArray(rhs.element_, maximumElements_); cost_ = ClpCopyOfArray(rhs.cost_, maximumGubColumns_); id_ = ClpCopyOfArray(rhs.id_, lastDynamic_ - firstDynamic_); columnLower_ = ClpCopyOfArray(rhs.columnLower_, maximumGubColumns_); columnUpper_ = ClpCopyOfArray(rhs.columnUpper_, maximumGubColumns_); dynamicStatus_ = ClpCopyOfArray(rhs.dynamicStatus_, 2*maximumGubColumns_); } /* This is the real constructor*/ ClpDynamicMatrix::ClpDynamicMatrix(ClpSimplex * model, int numberSets, int numberGubColumns, const int * starts, const double * lower, const double * upper, const CoinBigIndex * startColumn, const int * row, const double * element, const double * cost, const double * columnLower, const double * columnUpper, const unsigned char * status, const unsigned char * dynamicStatus) : ClpPackedMatrix() { setType(15); objectiveOffset_ = model->objectiveOffset(); model_ = model; numberSets_ = numberSets; numberGubColumns_ = numberGubColumns; maximumGubColumns_ = numberGubColumns_; if (numberGubColumns_) maximumElements_ = startColumn[numberGubColumns_]; else maximumElements_ = 0; startSet_ = new int [numberSets_+1]; next_ = new int [maximumGubColumns_]; // fill in startSet and next int iSet; if (numberGubColumns_) { for (iSet = 0; iSet < numberSets_; iSet++) { int first = starts[iSet]; int last = starts[iSet+1] - 1; startSet_[iSet] = first; for (int i = first; i < last; i++) next_[i] = i + 1; next_[last] = -iSet - 1; } startSet_[numberSets_] = starts[numberSets_]; } int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); numberStaticRows_ = numberRows; savedBestGubDual_ = 0.0; savedBestSet_ = 0; // Number of columns needed int frequency = model->factorizationFrequency(); int numberGubInSmall = numberRows + frequency + CoinMin(frequency, numberSets_) + 4; // But we may have two per row + one for incoming (make it two) numberGubInSmall = CoinMax(2*numberRows+2,numberGubInSmall); // for small problems this could be too big //numberGubInSmall = CoinMin(numberGubInSmall,numberGubColumns_); int numberNeeded = numberGubInSmall + numberColumns; firstAvailable_ = numberColumns; firstAvailableBefore_ = firstAvailable_; firstDynamic_ = numberColumns; lastDynamic_ = numberNeeded; startColumn_ = ClpCopyOfArray(startColumn, numberGubColumns_ + 1); if (!numberGubColumns_) { if (!startColumn_) startColumn_ = new CoinBigIndex [1]; startColumn_[0] = 0; } CoinBigIndex numberElements = startColumn_[numberGubColumns_]; row_ = ClpCopyOfArray(row, numberElements); element_ = new double[numberElements]; CoinBigIndex i; for (i = 0; i < numberElements; i++) element_[i] = element[i]; cost_ = new double[numberGubColumns_]; for (i = 0; i < numberGubColumns_; i++) { cost_[i] = cost[i]; // I don't think I need sorted but ... CoinSort_2(row_ + startColumn_[i], row_ + startColumn_[i+1], element_ + startColumn_[i]); } if (columnLower) { columnLower_ = new double[numberGubColumns_]; for (i = 0; i < numberGubColumns_; i++) columnLower_[i] = columnLower[i]; } else { columnLower_ = NULL; } if (columnUpper) { columnUpper_ = new double[numberGubColumns_]; for (i = 0; i < numberGubColumns_; i++) columnUpper_[i] = columnUpper[i]; } else { columnUpper_ = NULL; } lowerSet_ = new double[numberSets_]; for (i = 0; i < numberSets_; i++) { if (lower[i] > -1.0e20) lowerSet_[i] = lower[i]; else lowerSet_[i] = -1.0e30; } upperSet_ = new double[numberSets_]; for (i = 0; i < numberSets_; i++) { if (upper[i] < 1.0e20) upperSet_[i] = upper[i]; else upperSet_[i] = 1.0e30; } id_ = new int[numberGubInSmall]; for (i = 0; i < numberGubInSmall; i++) id_[i] = -1; ClpPackedMatrix* originalMatrixA = dynamic_cast< ClpPackedMatrix*>(model->clpMatrix()); assert (originalMatrixA); CoinPackedMatrix * originalMatrix = originalMatrixA->getPackedMatrix(); originalMatrixA->setMatrixNull(); // so can be deleted safely // guess how much space needed double guess = numberElements; guess /= static_cast (numberColumns); guess *= 2 * numberGubInSmall; numberElements_ = static_cast (guess); numberElements_ = CoinMin(numberElements_, numberElements) + originalMatrix->getNumElements(); matrix_ = originalMatrix; //delete originalMatrixA; flags_ &= ~1; // resize model (matrix stays same) // modify frequency if (frequency>=50) frequency = 50+(frequency-50)/2; int newRowSize = numberRows + CoinMin(numberSets_, frequency+numberRows) + 1; model->resize(newRowSize, numberNeeded); for (i = numberRows; i < newRowSize; i++) model->setRowStatus(i, ClpSimplex::basic); if (columnUpper_) { // set all upper bounds so we have enough space double * columnUpper = model->columnUpper(); for(i = firstDynamic_; i < lastDynamic_; i++) columnUpper[i] = 1.0e10; } // resize matrix // extra 1 is so can keep number of elements handy originalMatrix->reserve(numberNeeded, numberElements_, true); originalMatrix->reserve(numberNeeded + 1, numberElements_, false); originalMatrix->getMutableVectorStarts()[numberColumns] = originalMatrix->getNumElements(); originalMatrix->setDimensions(newRowSize, -1); numberActiveColumns_ = firstDynamic_; // redo number of columns numberColumns = matrix_->getNumCols(); backToPivotRow_ = new int[numberNeeded]; keyVariable_ = new int[numberSets_]; if (status) { status_ = ClpCopyOfArray(status, static_cast(2*numberSets_+4*sizeof(int))); assert (dynamicStatus); dynamicStatus_ = ClpCopyOfArray(dynamicStatus, 2*numberGubColumns_); } else { status_ = new unsigned char [2*numberSets_+4*sizeof(int)]; memset(status_, 0, numberSets_); int i; for (i = 0; i < numberSets_; i++) { // make slack key setStatus(i, ClpSimplex::basic); } dynamicStatus_ = new unsigned char [2*numberGubColumns_]; memset(dynamicStatus_, 0, numberGubColumns_); // for clarity for (i = 0; i < numberGubColumns_; i++) setDynamicStatus(i, atLowerBound); } toIndex_ = new int[numberSets_]; for (iSet = 0; iSet < numberSets_; iSet++) toIndex_[iSet] = -1; fromIndex_ = new int [newRowSize-numberStaticRows_+1]; numberActiveSets_ = 0; rhsOffset_ = NULL; if (numberGubColumns_) { if (!status) { gubCrash(); } else { initialProblem(); } } noCheck_ = -1; infeasibilityWeight_ = 0.0; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpDynamicMatrix::~ClpDynamicMatrix () { delete [] backToPivotRow_; delete [] keyVariable_; delete [] toIndex_; delete [] fromIndex_; delete [] lowerSet_; delete [] upperSet_; delete [] status_; delete [] startSet_; delete [] next_; delete [] startColumn_; delete [] row_; delete [] element_; delete [] cost_; delete [] id_; delete [] dynamicStatus_; delete [] columnLower_; delete [] columnUpper_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpDynamicMatrix & ClpDynamicMatrix::operator=(const ClpDynamicMatrix& rhs) { if (this != &rhs) { ClpPackedMatrix::operator=(rhs); delete [] backToPivotRow_; delete [] keyVariable_; delete [] toIndex_; delete [] fromIndex_; delete [] lowerSet_; delete [] upperSet_; delete [] status_; delete [] startSet_; delete [] next_; delete [] startColumn_; delete [] row_; delete [] element_; delete [] cost_; delete [] id_; delete [] dynamicStatus_; delete [] columnLower_; delete [] columnUpper_; objectiveOffset_ = rhs.objectiveOffset_; numberSets_ = rhs.numberSets_; numberActiveSets_ = rhs.numberActiveSets_; firstAvailable_ = rhs.firstAvailable_; firstAvailableBefore_ = rhs.firstAvailableBefore_; firstDynamic_ = rhs.firstDynamic_; lastDynamic_ = rhs.lastDynamic_; numberStaticRows_ = rhs.numberStaticRows_; numberElements_ = rhs.numberElements_; backToPivotRow_ = ClpCopyOfArray(rhs.backToPivotRow_, lastDynamic_); keyVariable_ = ClpCopyOfArray(rhs.keyVariable_, numberSets_); toIndex_ = ClpCopyOfArray(rhs.toIndex_, numberSets_); fromIndex_ = ClpCopyOfArray(rhs.fromIndex_, getNumRows() + 1 - numberStaticRows_); lowerSet_ = ClpCopyOfArray(rhs.lowerSet_, numberSets_); upperSet_ = ClpCopyOfArray(rhs.upperSet_, numberSets_); status_ = ClpCopyOfArray(rhs.status_, static_cast(2*numberSets_+4*sizeof(int))); model_ = rhs.model_; sumDualInfeasibilities_ = rhs. sumDualInfeasibilities_; sumPrimalInfeasibilities_ = rhs.sumPrimalInfeasibilities_; sumOfRelaxedDualInfeasibilities_ = rhs.sumOfRelaxedDualInfeasibilities_; sumOfRelaxedPrimalInfeasibilities_ = rhs.sumOfRelaxedPrimalInfeasibilities_; numberDualInfeasibilities_ = rhs.numberDualInfeasibilities_; numberPrimalInfeasibilities_ = rhs.numberPrimalInfeasibilities_; savedBestGubDual_ = rhs.savedBestGubDual_; savedBestSet_ = rhs.savedBestSet_; noCheck_ = rhs.noCheck_; infeasibilityWeight_ = rhs.infeasibilityWeight_; // Now secondary data numberGubColumns_ = rhs.numberGubColumns_; maximumGubColumns_ = rhs.maximumGubColumns_; maximumElements_ = rhs.maximumElements_; startSet_ = ClpCopyOfArray(rhs.startSet_, numberSets_+1); next_ = ClpCopyOfArray(rhs.next_, maximumGubColumns_); startColumn_ = ClpCopyOfArray(rhs.startColumn_, maximumGubColumns_ + 1); row_ = ClpCopyOfArray(rhs.row_, maximumElements_); element_ = ClpCopyOfArray(rhs.element_, maximumElements_); cost_ = ClpCopyOfArray(rhs.cost_, maximumGubColumns_); id_ = ClpCopyOfArray(rhs.id_, lastDynamic_ - firstDynamic_); columnLower_ = ClpCopyOfArray(rhs.columnLower_, maximumGubColumns_); columnUpper_ = ClpCopyOfArray(rhs.columnUpper_, maximumGubColumns_); dynamicStatus_ = ClpCopyOfArray(rhs.dynamicStatus_, 2*maximumGubColumns_); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpMatrixBase * ClpDynamicMatrix::clone() const { return new ClpDynamicMatrix(*this); } // Partial pricing void ClpDynamicMatrix::partialPricing(ClpSimplex * model, double startFraction, double endFraction, int & bestSequence, int & numberWanted) { numberWanted = currentWanted_; assert(!model->rowScale()); if (numberSets_) { // Do packed part before gub // always??? //printf("normal packed price - start %d end %d (passed end %d, first %d)\n", ClpPackedMatrix::partialPricing(model, startFraction, endFraction, bestSequence, numberWanted); } else { // no gub ClpPackedMatrix::partialPricing(model, startFraction, endFraction, bestSequence, numberWanted); return; } if (numberWanted > 0) { // and do some proportion of full set int startG2 = static_cast (startFraction * numberSets_); int endG2 = static_cast (endFraction * numberSets_ + 0.1); endG2 = CoinMin(endG2, numberSets_); //printf("gub price - set start %d end %d\n", // startG2,endG2); double tolerance = model->currentDualTolerance(); double * reducedCost = model->djRegion(); const double * duals = model->dualRowSolution(); double bestDj; int numberRows = model->numberRows(); int slackOffset = lastDynamic_ + numberRows; int structuralOffset = slackOffset + numberSets_; // If nothing found yet can go all the way to end int endAll = endG2; if (bestSequence < 0 && !startG2) endAll = numberSets_; if (bestSequence >= 0) { if (bestSequence != savedBestSequence_) bestDj = fabs(reducedCost[bestSequence]); // dj from slacks or permanent else bestDj = savedBestDj_; } else { bestDj = tolerance; } int saveSequence = bestSequence; double djMod = 0.0; double bestDjMod = 0.0; //printf("iteration %d start %d end %d - wanted %d\n",model->numberIterations(), // startG2,endG2,numberWanted); int bestSet = -1; #if 0 // make sure first available is clean (in case last iteration rejected) cost[firstAvailable_] = 0.0; length[firstAvailable_] = 0; model->nonLinearCost()->setOne(firstAvailable_, 0.0, 0.0, COIN_DBL_MAX, 0.0); model->setStatus(firstAvailable_, ClpSimplex::atLowerBound); { for (int i = firstAvailable_; i < lastDynamic_; i++) assert(!cost[i]); } #endif int minSet = minimumObjectsScan_ < 0 ? 5 : minimumObjectsScan_; int minNeg = minimumGoodReducedCosts_ < 0 ? 5 : minimumGoodReducedCosts_; for (int iSet = startG2; iSet < endAll; iSet++) { if (numberWanted + minNeg < originalWanted_ && iSet > startG2 + minSet) { // give up numberWanted = 0; break; } else if (iSet == endG2 && bestSequence >= 0) { break; } int gubRow = toIndex_[iSet]; if (gubRow >= 0) { djMod = duals[gubRow+numberStaticRows_]; // have I got sign right? } else { int iBasic = keyVariable_[iSet]; if (iBasic >= maximumGubColumns_) { djMod = 0.0; // set not in } else { // get dj without djMod = 0.0; for (CoinBigIndex j = startColumn_[iBasic]; j < startColumn_[iBasic+1]; j++) { int jRow = row_[j]; djMod -= duals[jRow] * element_[j]; } djMod += cost_[iBasic]; // See if gub slack possible - dj is djMod if (getStatus(iSet) == ClpSimplex::atLowerBound) { double value = -djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = slackOffset + iSet; bestDjMod = djMod; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } else if (getStatus(iSet) == ClpSimplex::atUpperBound) { double value = djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = slackOffset + iSet; bestDjMod = djMod; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } } } int iSequence = startSet_[iSet]; while (iSequence >= 0) { DynamicStatus status = getDynamicStatus(iSequence); if (status == atLowerBound || status == atUpperBound) { double value = cost_[iSequence] - djMod; for (CoinBigIndex j = startColumn_[iSequence]; j < startColumn_[iSequence+1]; j++) { int jRow = row_[j]; value -= duals[jRow] * element_[j]; } // change sign if at lower bound if (status == atLowerBound) value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSequence)) { if (false/*status == atLowerBound &&keyValue(iSet)<1.0e-7*/) { // can't come in because // of ones at ub numberWanted++; } else { bestDj = value; bestSequence = structuralOffset + iSequence; bestDjMod = djMod; bestSet = iSet; } } else { // just to make sure we don't exit before got something numberWanted++; } } } } iSequence = next_[iSequence]; //onto next in set } if (numberWanted <= 0) { numberWanted = 0; break; } } if (bestSequence != saveSequence) { savedBestGubDual_ = bestDjMod; savedBestDj_ = bestDj; savedBestSequence_ = bestSequence; savedBestSet_ = bestSet; } // See if may be finished if (!startG2 && bestSequence < 0) infeasibilityWeight_ = model_->infeasibilityCost(); else if (bestSequence >= 0) infeasibilityWeight_ = -1.0; } currentWanted_ = numberWanted; } /* Returns effective RHS if it is being used. This is used for long problems or big gub or anywhere where going through full columns is expensive. This may re-compute */ double * ClpDynamicMatrix::rhsOffset(ClpSimplex * model, bool forceRefresh, bool #ifdef CLP_DEBUG check #endif ) { // forceRefresh=true;printf("take out forceRefresh\n"); if (!model_->numberIterations()) forceRefresh = true; //check=false; #ifdef CLP_DEBUG double * saveE = NULL; if (rhsOffset_ && check) { int numberRows = model->numberRows(); saveE = new double[numberRows]; } #endif if (rhsOffset_) { #ifdef CLP_DEBUG if (check) { // no need - but check anyway int numberRows = model->numberRows(); double * rhs = new double[numberRows]; int iRow; int iSet; CoinZeroN(rhs, numberRows); // do ones at bounds before gub const double * smallSolution = model->solutionRegion(); const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); int iColumn; double objectiveOffset = 0.0; for (iColumn = 0; iColumn < firstDynamic_; iColumn++) { if (model->getStatus(iColumn) != ClpSimplex::basic) { double value = smallSolution[iColumn]; for (CoinBigIndex j = startColumn[iColumn]; j < startColumn[iColumn] + length[iColumn]; j++) { int jRow = row[j]; rhs[jRow] -= value * element[j]; } } } if (columnLower_ || columnUpper_) { double * solution = new double [numberGubColumns_]; for (iSet = 0; iSet < numberSets_; iSet++) { int j = startSet_[iSet]; while (j >= 0) { double value = 0.0; if (getDynamicStatus(j) != inSmall) { if (getDynamicStatus(j) == atLowerBound) { if (columnLower_) value = columnLower_[j]; } else if (getDynamicStatus(j) == atUpperBound) { value = columnUpper_[j]; } else if (getDynamicStatus(j) == soloKey) { value = keyValue(iSet); } objectiveOffset += value * cost_[j]; } solution[j] = value; j = next_[j]; //onto next in set } } // ones in gub and in small problem for (iColumn = firstDynamic_; iColumn < firstAvailable_; iColumn++) { if (model_->getStatus(iColumn) != ClpSimplex::basic) { int jFull = id_[iColumn-firstDynamic_]; solution[jFull] = smallSolution[iColumn]; } } for (iSet = 0; iSet < numberSets_; iSet++) { int kRow = toIndex_[iSet]; if (kRow >= 0) kRow += numberStaticRows_; int j = startSet_[iSet]; while (j >= 0) { double value = solution[j]; if (value) { for (CoinBigIndex k = startColumn_[j]; k < startColumn_[j+1]; k++) { int iRow = row_[k]; rhs[iRow] -= element_[k] * value; } if (kRow >= 0) rhs[kRow] -= value; } j = next_[j]; //onto next in set } } delete [] solution; } else { // bounds ClpSimplex::Status iStatus; for (int iSet = 0; iSet < numberSets_; iSet++) { int kRow = toIndex_[iSet]; if (kRow < 0) { int iColumn = keyVariable_[iSet]; if (iColumn < maximumGubColumns_) { // key is not treated as basic double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lowerSet_[iSet]; else b = upperSet_[iSet]; if (b) { objectiveOffset += b * cost_[iColumn]; for (CoinBigIndex j = startColumn_[iColumn]; j < startColumn_[iColumn+1]; j++) { int iRow = row_[j]; rhs[iRow] -= element_[j] * b; } } } } } } if (fabs(model->objectiveOffset() - objectiveOffset_ - objectiveOffset) > 1.0e-1) printf("old offset %g, true %g\n", model->objectiveOffset(), objectiveOffset_ - objectiveOffset); for (iRow = 0; iRow < numberRows; iRow++) { if (fabs(rhs[iRow] - rhsOffset_[iRow]) > 1.0e-3) printf("** bad effective %d - true %g old %g\n", iRow, rhs[iRow], rhsOffset_[iRow]); } CoinMemcpyN(rhs, numberRows, saveE); delete [] rhs; } #endif if (forceRefresh || (refreshFrequency_ && model->numberIterations() >= lastRefresh_ + refreshFrequency_)) { int numberRows = model->numberRows(); int iSet; CoinZeroN(rhsOffset_, numberRows); // do ones at bounds before gub const double * smallSolution = model->solutionRegion(); const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); int iColumn; double objectiveOffset = 0.0; for (iColumn = 0; iColumn < firstDynamic_; iColumn++) { if (model->getStatus(iColumn) != ClpSimplex::basic) { double value = smallSolution[iColumn]; for (CoinBigIndex j = startColumn[iColumn]; j < startColumn[iColumn] + length[iColumn]; j++) { int jRow = row[j]; rhsOffset_[jRow] -= value * element[j]; } } } if (columnLower_ || columnUpper_) { double * solution = new double [numberGubColumns_]; for (iSet = 0; iSet < numberSets_; iSet++) { int j = startSet_[iSet]; while (j >= 0) { double value = 0.0; if (getDynamicStatus(j) != inSmall) { if (getDynamicStatus(j) == atLowerBound) { if (columnLower_) value = columnLower_[j]; } else if (getDynamicStatus(j) == atUpperBound) { value = columnUpper_[j]; assert (value<1.0e30); } else if (getDynamicStatus(j) == soloKey) { value = keyValue(iSet); } objectiveOffset += value * cost_[j]; } solution[j] = value; j = next_[j]; //onto next in set } } // ones in gub and in small problem for (iColumn = firstDynamic_; iColumn < firstAvailable_; iColumn++) { if (model_->getStatus(iColumn) != ClpSimplex::basic) { int jFull = id_[iColumn-firstDynamic_]; solution[jFull] = smallSolution[iColumn]; } } for (iSet = 0; iSet < numberSets_; iSet++) { int kRow = toIndex_[iSet]; if (kRow >= 0) kRow += numberStaticRows_; int j = startSet_[iSet]; while (j >= 0) { //? use DynamicStatus status = getDynamicStatus(j); double value = solution[j]; if (value) { for (CoinBigIndex k = startColumn_[j]; k < startColumn_[j+1]; k++) { int iRow = row_[k]; rhsOffset_[iRow] -= element_[k] * value; } if (kRow >= 0) rhsOffset_[kRow] -= value; } j = next_[j]; //onto next in set } } delete [] solution; } else { // bounds ClpSimplex::Status iStatus; for (int iSet = 0; iSet < numberSets_; iSet++) { int kRow = toIndex_[iSet]; if (kRow < 0) { int iColumn = keyVariable_[iSet]; if (iColumn < maximumGubColumns_) { // key is not treated as basic double b = 0.0; // key is structural - where is slack iStatus = getStatus(iSet); assert (iStatus != ClpSimplex::basic); if (iStatus == ClpSimplex::atLowerBound) b = lowerSet_[iSet]; else b = upperSet_[iSet]; if (b) { objectiveOffset += b * cost_[iColumn]; for (CoinBigIndex j = startColumn_[iColumn]; j < startColumn_[iColumn+1]; j++) { int iRow = row_[j]; rhsOffset_[iRow] -= element_[j] * b; } } } } } } model->setObjectiveOffset(objectiveOffset_ - objectiveOffset); #ifdef CLP_DEBUG if (saveE) { int iRow; for (iRow = 0; iRow < numberRows; iRow++) { if (fabs(saveE[iRow] - rhsOffset_[iRow]) > 1.0e-3) printf("** %d - old eff %g new %g\n", iRow, saveE[iRow], rhsOffset_[iRow]); } delete [] saveE; } #endif lastRefresh_ = model->numberIterations(); } } return rhsOffset_; } /* update information for a pivot (and effective rhs) */ int ClpDynamicMatrix::updatePivot(ClpSimplex * model, double oldInValue, double oldOutValue) { // now update working model int sequenceIn = model->sequenceIn(); int sequenceOut = model->sequenceOut(); int numberColumns = model->numberColumns(); if (sequenceIn != sequenceOut && sequenceIn < numberColumns) backToPivotRow_[sequenceIn] = model->pivotRow(); if (sequenceIn >= firstDynamic_ && sequenceIn < numberColumns) { int bigSequence = id_[sequenceIn-firstDynamic_]; if (getDynamicStatus(bigSequence) != inSmall) { firstAvailable_++; setDynamicStatus(bigSequence, inSmall); } } // make sure slack is synchronized if (sequenceIn >= numberColumns + numberStaticRows_) { int iDynamic = sequenceIn - numberColumns - numberStaticRows_; int iSet = fromIndex_[iDynamic]; setStatus(iSet, model->getStatus(sequenceIn)); } if (sequenceOut >= numberColumns + numberStaticRows_) { int iDynamic = sequenceOut - numberColumns - numberStaticRows_; int iSet = fromIndex_[iDynamic]; // out may have gone through barrier - so check double valueOut = model->lowerRegion()[sequenceOut]; if (fabs(valueOut - static_cast (lowerSet_[iSet])) < fabs(valueOut - static_cast (upperSet_[iSet]))) setStatus(iSet, ClpSimplex::atLowerBound); else setStatus(iSet, ClpSimplex::atUpperBound); if (lowerSet_[iSet] == upperSet_[iSet]) setStatus(iSet, ClpSimplex::isFixed); #if 0 if (getStatus(iSet) != model->getStatus(sequenceOut)) printf("** set %d status %d, var status %d\n", iSet, getStatus(iSet), model->getStatus(sequenceOut)); #endif } ClpMatrixBase::updatePivot(model, oldInValue, oldOutValue); #ifdef CLP_DEBUG char * inSmall = new char [numberGubColumns_]; memset(inSmall, 0, numberGubColumns_); const double * solution = model->solutionRegion(); for (int i = 0; i < numberGubColumns_; i++) if (getDynamicStatus(i) == ClpDynamicMatrix::inSmall) inSmall[i] = 1; for (int i = firstDynamic_; i < firstAvailable_; i++) { int k = id_[i-firstDynamic_]; inSmall[k] = 0; //if (k>=23289&&k<23357&&solution[i]) //printf("var %d (in small %d) has value %g\n",k,i,solution[i]); } for (int i = 0; i < numberGubColumns_; i++) assert (!inSmall[i]); delete [] inSmall; #ifndef NDEBUG for (int i = 0; i < numberActiveSets_; i++) { int iSet = fromIndex_[i]; assert (toIndex_[iSet] == i); //if (getStatus(iSet)!=model->getRowStatus(i+numberStaticRows_)) //printf("*** set %d status %d, var status %d\n",iSet, // getStatus(iSet),model->getRowStatus(i+numberStaticRows_)); //assert (model->getRowStatus(i+numberStaticRows_)==getStatus(iSet)); //if (iSet==1035) { //printf("rhs for set %d (%d) is %g %g - cost %g\n",iSet,i,model->lowerRegion(0)[i+numberStaticRows_], // model->upperRegion(0)[i+numberStaticRows_],model->costRegion(0)[i+numberStaticRows_]); //} } #endif #endif if (numberStaticRows_+numberActiveSets_numberRows()) return 0; else return 1; } /* utility dual function for dealing with dynamic constraints mode=n see ClpGubMatrix.hpp for definition Remember to update here when settled down */ void ClpDynamicMatrix::dualExpanded(ClpSimplex * model, CoinIndexedVector * /*array*/, double * /*other*/, int mode) { switch (mode) { // modify costs before transposeUpdate case 0: break; // create duals for key variables (without check on dual infeasible) case 1: break; // as 1 but check slacks and compute djs case 2: { // do pivots int * pivotVariable = model->pivotVariable(); int numberRows = numberStaticRows_ + numberActiveSets_; int numberColumns = model->numberColumns(); for (int iRow = 0; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; if (iPivot < numberColumns) backToPivotRow_[iPivot] = iRow; } if (noCheck_ >= 0) { if (infeasibilityWeight_ != model_->infeasibilityCost()) { // don't bother checking sumDualInfeasibilities_ = 100.0; numberDualInfeasibilities_ = 1; sumOfRelaxedDualInfeasibilities_ = 100.0; return; } } // In theory we should subtract out ones we have done but .... // If key slack then dual 0.0 // If not then slack could be dual infeasible // dj for key is zero so that defines dual on set int i; double * dual = model->dualRowSolution(); double dualTolerance = model->dualTolerance(); double relaxedTolerance = dualTolerance; // we can't really trust infeasibilities if there is dual error double error = CoinMin(1.0e-2, model->largestDualError()); // allow tolerance at least slightly bigger than standard relaxedTolerance = relaxedTolerance + error; // but we will be using difference relaxedTolerance -= dualTolerance; sumDualInfeasibilities_ = 0.0; numberDualInfeasibilities_ = 0; sumOfRelaxedDualInfeasibilities_ = 0.0; for (i = 0; i < numberSets_; i++) { double value = 0.0; int gubRow = toIndex_[i]; if (gubRow < 0) { int kColumn = keyVariable_[i]; if (kColumn < maximumGubColumns_) { // dj without set value = cost_[kColumn]; for (CoinBigIndex j = startColumn_[kColumn]; j < startColumn_[kColumn+1]; j++) { int iRow = row_[j]; value -= dual[iRow] * element_[j]; } double infeasibility = 0.0; if (getStatus(i) == ClpSimplex::atLowerBound) { if (-value > dualTolerance) infeasibility = -value - dualTolerance; } else if (getStatus(i) == ClpSimplex::atUpperBound) { if (value > dualTolerance) infeasibility = value - dualTolerance; } if (infeasibility > 0.0) { sumDualInfeasibilities_ += infeasibility; if (infeasibility > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += infeasibility; numberDualInfeasibilities_ ++; } } } else { value = dual[gubRow+numberStaticRows_]; } // Now subtract out from all int k = startSet_[i]; while (k >= 0) { if (getDynamicStatus(k) != inSmall) { double djValue = cost_[k] - value; for (CoinBigIndex j = startColumn_[k]; j < startColumn_[k+1]; j++) { int iRow = row_[j]; djValue -= dual[iRow] * element_[j]; } double infeasibility = 0.0; if (getDynamicStatus(k) == atLowerBound) { if (djValue < -dualTolerance) infeasibility = -djValue - dualTolerance; } else if (getDynamicStatus(k) == atUpperBound) { // at upper bound if (djValue > dualTolerance) infeasibility = djValue - dualTolerance; } if (infeasibility > 0.0) { sumDualInfeasibilities_ += infeasibility; if (infeasibility > relaxedTolerance) sumOfRelaxedDualInfeasibilities_ += infeasibility; numberDualInfeasibilities_ ++; } } k = next_[k]; //onto next in set } } } infeasibilityWeight_ = -1.0; break; // Report on infeasibilities of key variables case 3: { model->setSumDualInfeasibilities(model->sumDualInfeasibilities() + sumDualInfeasibilities_); model->setNumberDualInfeasibilities(model->numberDualInfeasibilities() + numberDualInfeasibilities_); model->setSumOfRelaxedDualInfeasibilities(model->sumOfRelaxedDualInfeasibilities() + sumOfRelaxedDualInfeasibilities_); } break; // modify costs before transposeUpdate for partial pricing case 4: break; } } /* general utility function for dealing with dynamic constraints mode=n see ClpGubMatrix.hpp for definition Remember to update here when settled down */ int ClpDynamicMatrix::generalExpanded(ClpSimplex * model, int mode, int &number) { int returnCode = 0; #if 0 //ndef NDEBUG { int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); int * pivotVariable = model->pivotVariable(); if (pivotVariable&&model->numberIterations()) { for (int i=numberStaticRows_+numberActiveSets_;inumberRows()]; rhsOffset(model, true); } int i; int numberBasic = number; int numberColumns = model->numberColumns(); // Use different array so can build from true pivotVariable_ //int * pivotVariable = model->pivotVariable(); int * pivotVariable = model->rowArray(0)->getIndices(); for (i = 0; i < numberColumns; i++) { if (model->getColumnStatus(i) == ClpSimplex::basic) pivotVariable[numberBasic++] = i; } number = numberBasic; } break; // Do initial extra rows + maximum basic case 2: { number = model->numberRows(); } break; // Before normal replaceColumn case 3: { if (numberActiveSets_ + numberStaticRows_ == model_->numberRows()) { // no space - re-factorize returnCode = 4; number = -1; // say no need for normal replaceColumn } } break; // To see if can dual or primal case 4: { returnCode = 1; } break; // save status case 5: { memcpy(status_+numberSets_,status_,numberSets_); memcpy(status_+2*numberSets_,&numberActiveSets_,sizeof(int)); memcpy(dynamicStatus_+maximumGubColumns_, dynamicStatus_,maximumGubColumns_); } break; // restore status case 6: { memcpy(status_,status_+numberSets_,numberSets_); memcpy(&numberActiveSets_,status_+2*numberSets_,sizeof(int)); memcpy(dynamicStatus_,dynamicStatus_+maximumGubColumns_, maximumGubColumns_); initialProblem(); } break; // unflag all variables case 8: { for (int i = 0; i < numberGubColumns_; i++) { if (flagged(i)) { unsetFlagged(i); returnCode++; } } } break; // redo costs in primal case 9: { double * cost = model->costRegion(); double * solution = model->solutionRegion(); double * columnLower = model->lowerRegion(); double * columnUpper = model->upperRegion(); int i; bool doCosts = (number & 4) != 0; bool doBounds = (number & 1) != 0; for ( i = firstDynamic_; i < firstAvailable_; i++) { int jColumn = id_[i-firstDynamic_]; if (doBounds) { if (!columnLower_ && !columnUpper_) { columnLower[i] = 0.0; columnUpper[i] = COIN_DBL_MAX; } else { if (columnLower_) columnLower[i] = columnLower_[jColumn]; else columnLower[i] = 0.0; if (columnUpper_) columnUpper[i] = columnUpper_[jColumn]; else columnUpper[i] = COIN_DBL_MAX; } } if (doCosts) { cost[i] = cost_[jColumn]; // Original bounds if (model->nonLinearCost()) model->nonLinearCost()->setOne(i, solution[i], this->columnLower(jColumn), this->columnUpper(jColumn), cost_[jColumn]); } } // and active sets for (i = 0; i < numberActiveSets_; i++ ) { int iSet = fromIndex_[i]; int iSequence = lastDynamic_ + numberStaticRows_ + i; if (doBounds) { if (lowerSet_[iSet] > -1.0e20) columnLower[iSequence] = lowerSet_[iSet]; else columnLower[iSequence] = -COIN_DBL_MAX; if (upperSet_[iSet] < 1.0e20) columnUpper[iSequence] = upperSet_[iSet]; else columnUpper[iSequence] = COIN_DBL_MAX; } if (doCosts) { if (model->nonLinearCost()) { double trueLower; if (lowerSet_[iSet] > -1.0e20) trueLower = lowerSet_[iSet]; else trueLower = -COIN_DBL_MAX; double trueUpper; if (upperSet_[iSet] < 1.0e20) trueUpper = upperSet_[iSet]; else trueUpper = COIN_DBL_MAX; model->nonLinearCost()->setOne(iSequence, solution[iSequence], trueLower, trueUpper, 0.0); } } } } break; // return 1 if there may be changing bounds on variable (column generation) case 10: { // return 1 as bounds on rhs will change returnCode = 1; } break; // make sure set is clean case 7: { // first flag if (number >= firstDynamic_ && number < lastDynamic_) { int sequence = id_[number-firstDynamic_]; setFlagged(sequence); //model->clearFlagged(number); } else if (number>=model_->numberColumns()+numberStaticRows_) { // slack int iSet = fromIndex_[number-model_->numberColumns()- numberStaticRows_]; setFlaggedSlack(iSet); //model->clearFlagged(number); } } case 11: { //int sequenceIn = model->sequenceIn(); if (number >= firstDynamic_ && number < lastDynamic_) { //assert (number == model->sequenceIn()); // take out variable (but leave key) double * cost = model->costRegion(); double * columnLower = model->lowerRegion(); double * columnUpper = model->upperRegion(); double * solution = model->solutionRegion(); int * length = matrix_->getMutableVectorLengths(); #ifndef NDEBUG if (length[number]) { int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int iRow = row[startColumn[number] + length[number] - 1]; int which = iRow - numberStaticRows_; assert (which >= 0); int iSet = fromIndex_[which]; assert (toIndex_[iSet] == which); } #endif // no need firstAvailable_--; solution[firstAvailable_] = 0.0; cost[firstAvailable_] = 0.0; length[firstAvailable_] = 0; model->nonLinearCost()->setOne(firstAvailable_, 0.0, 0.0, COIN_DBL_MAX, 0.0); model->setStatus(firstAvailable_, ClpSimplex::atLowerBound); columnLower[firstAvailable_] = 0.0; columnUpper[firstAvailable_] = COIN_DBL_MAX; // not really in small problem int iBig = id_[number-firstDynamic_]; if (model->getStatus(number) == ClpSimplex::atLowerBound) { setDynamicStatus(iBig, atLowerBound); if (columnLower_) modifyOffset(number, columnLower_[iBig]); } else { setDynamicStatus(iBig, atUpperBound); modifyOffset(number, columnUpper_[iBig]); } } else if (number>=model_->numberColumns()+numberStaticRows_) { // slack int iSet = fromIndex_[number-model_->numberColumns()- numberStaticRows_]; printf("what now - set %d\n",iSet); } } break; default: break; } return returnCode; } /* Purely for column generation and similar ideas. Allows matrix and any bounds or costs to be updated (sensibly). Returns non-zero if any changes. */ int ClpDynamicMatrix::refresh(ClpSimplex * model) { // If at beginning then create initial problem if (firstDynamic_ == firstAvailable_) { initialProblem(); return 1; } else if (!model->nonLinearCost()) { // will be same as last time return 1; } #ifndef NDEBUG { int numberColumns = model->numberColumns(); int numberRows = model->numberRows(); int * pivotVariable = model->pivotVariable(); for (int i=numberStaticRows_+numberActiveSets_;inumberColumns(); double * element = matrix_->getMutableElements(); int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int * length = matrix_->getMutableVectorLengths(); double * cost = model->costRegion(); double * columnLower = model->lowerRegion(); double * columnUpper = model->upperRegion(); CoinBigIndex numberElements = startColumn[firstDynamic_]; // first just do lookup and basic stuff int currentNumber = firstAvailable_; firstAvailable_ = firstDynamic_; double objectiveChange = 0.0; double * solution = model->solutionRegion(); int currentNumberActiveSets = numberActiveSets_; for (iColumn = firstDynamic_; iColumn < currentNumber; iColumn++) { int iRow = row[startColumn[iColumn] + length[iColumn] - 1]; int which = iRow - numberStaticRows_; assert (which >= 0); int iSet = fromIndex_[which]; assert (toIndex_[iSet] == which); if (model->getStatus(iColumn) == ClpSimplex::basic) { active[which]++; // may as well make key keyVariable_[iSet] = id_[iColumn-firstDynamic_]; } } int i; numberActiveSets_ = 0; int numberDeleted = 0; for (i = 0; i < currentNumberActiveSets; i++) { int iRow = i + numberStaticRows_; int numberActive = active[i]; int iSet = fromIndex_[i]; if (model->getRowStatus(iRow) == ClpSimplex::basic) { numberActive++; // may as well make key keyVariable_[iSet] = maximumGubColumns_ + iSet; } if (numberActive > 1) { // keep active[i] = numberActiveSets_; numberActiveSets_++; } else { active[i] = -1; } } for (iColumn = firstDynamic_; iColumn < currentNumber; iColumn++) { int iRow = row[startColumn[iColumn] + length[iColumn] - 1]; int which = iRow - numberStaticRows_; int jColumn = id_[iColumn-firstDynamic_]; if (model->getStatus(iColumn) == ClpSimplex::atLowerBound || model->getStatus(iColumn) == ClpSimplex::atUpperBound) { double value = solution[iColumn]; bool toLowerBound = true; assert (jColumn>=0);assert (iColumn>=0); if (columnUpper_) { if (!columnLower_) { if (fabs(value - columnUpper_[jColumn]) < fabs(value)) toLowerBound = false; } else if (fabs(value - columnUpper_[jColumn]) < fabs(value - columnLower_[jColumn])) { toLowerBound = false; } } if (toLowerBound) { // throw out to lower bound if (columnLower_) { setDynamicStatus(jColumn, atLowerBound); // treat solution as if exactly at a bound double value = columnLower[iColumn]; objectiveChange += cost[iColumn] * value; } else { setDynamicStatus(jColumn, atLowerBound); } } else { // throw out to upper bound setDynamicStatus(jColumn, atUpperBound); double value = columnUpper[iColumn]; objectiveChange += cost[iColumn] * value; } numberDeleted++; } else { assert(model->getStatus(iColumn) != ClpSimplex::superBasic); // deal with later int iPut = active[which]; if (iPut >= 0) { // move id_[firstAvailable_-firstDynamic_] = jColumn; int numberThis = startColumn_[jColumn+1] - startColumn_[jColumn] + 1; length[firstAvailable_] = numberThis; cost[firstAvailable_] = cost[iColumn]; columnLower[firstAvailable_] = columnLower[iColumn]; columnUpper[firstAvailable_] = columnUpper[iColumn]; model->nonLinearCost()->setOne(firstAvailable_, solution[iColumn], 0.0, COIN_DBL_MAX, cost_[jColumn]); CoinBigIndex base = startColumn_[jColumn]; for (int j = 0; j < numberThis - 1; j++) { row[numberElements] = row_[base+j]; element[numberElements++] = element_[base+j]; } row[numberElements] = iPut + numberStaticRows_; element[numberElements++] = 1.0; model->setStatus(firstAvailable_, model->getStatus(iColumn)); solution[firstAvailable_] = solution[iColumn]; firstAvailable_++; startColumn[firstAvailable_] = numberElements; } } } // zero solution CoinZeroN(solution + firstAvailable_, currentNumber - firstAvailable_); // zero cost CoinZeroN(cost + firstAvailable_, currentNumber - firstAvailable_); // zero lengths CoinZeroN(length + firstAvailable_, currentNumber - firstAvailable_); for ( iColumn = firstAvailable_; iColumn < currentNumber; iColumn++) { model->nonLinearCost()->setOne(iColumn, 0.0, 0.0, COIN_DBL_MAX, 0.0); model->setStatus(iColumn, ClpSimplex::atLowerBound); columnLower[iColumn] = 0.0; columnUpper[iColumn] = COIN_DBL_MAX; } // move rhs and set rest to infinite numberActiveSets_ = 0; for (i = 0; i < currentNumberActiveSets; i++) { int iSet = fromIndex_[i]; assert (toIndex_[iSet] == i); int iRow = i + numberStaticRows_; int iPut = active[i]; if (iPut >= 0) { int in = iRow + numberColumns; int out = iPut + numberColumns + numberStaticRows_; solution[out] = solution[in]; columnLower[out] = columnLower[in]; columnUpper[out] = columnUpper[in]; cost[out] = cost[in]; double trueLower; if (lowerSet_[iSet] > -1.0e20) trueLower = lowerSet_[iSet]; else trueLower = -COIN_DBL_MAX; double trueUpper; if (upperSet_[iSet] < 1.0e20) trueUpper = upperSet_[iSet]; else trueUpper = COIN_DBL_MAX; model->nonLinearCost()->setOne(out, solution[out], trueLower, trueUpper, 0.0); model->setStatus(out, model->getStatus(in)); toIndex_[iSet] = numberActiveSets_; rhsOffset_[numberActiveSets_+numberStaticRows_] = rhsOffset_[i+numberStaticRows_]; fromIndex_[numberActiveSets_++] = fromIndex_[i]; } else { // adjust offset // put out as key int jColumn = keyVariable_[iSet]; toIndex_[iSet] = -1; if (jColumn < maximumGubColumns_) { setDynamicStatus(jColumn, soloKey); double value = keyValue(iSet); objectiveChange += cost_[jColumn] * value; modifyOffset(jColumn, -value); } } } model->setObjectiveOffset(model->objectiveOffset() - objectiveChange); delete [] active; for (i = numberActiveSets_; i < currentNumberActiveSets; i++) { int iSequence = i + numberStaticRows_ + numberColumns; solution[iSequence] = 0.0; columnLower[iSequence] = -COIN_DBL_MAX; columnUpper[iSequence] = COIN_DBL_MAX; cost[iSequence] = 0.0; model->nonLinearCost()->setOne(iSequence, solution[iSequence], columnLower[iSequence], columnUpper[iSequence], 0.0); model->setStatus(iSequence, ClpSimplex::basic); rhsOffset_[i+numberStaticRows_] = 0.0; } if (currentNumberActiveSets != numberActiveSets_ || numberDeleted) { // deal with pivotVariable int * pivotVariable = model->pivotVariable(); int sequence = firstDynamic_; int iRow = 0; int base1 = firstDynamic_; int base2 = lastDynamic_; int base3 = numberColumns + numberStaticRows_; int numberRows = numberStaticRows_ + currentNumberActiveSets; while (sequence < firstAvailable_) { int iPivot = pivotVariable[iRow]; while (iPivot < base1 || (iPivot >= base2 && iPivot < base3)) { iPivot = pivotVariable[++iRow]; } pivotVariable[iRow++] = sequence; sequence++; } // move normal basic ones down int iPut = iRow; for (; iRow < numberRows; iRow++) { int iPivot = pivotVariable[iRow]; if (iPivot < base1 || (iPivot >= base2 && iPivot < base3)) { pivotVariable[iPut++] = iPivot; } } // and basic others for (i = 0; i < numberActiveSets_; i++) { if (model->getRowStatus(i + numberStaticRows_) == ClpSimplex::basic) { pivotVariable[iPut++] = i + base3; } } if (iPut= 0) { printf("var %d status %d ", jj, dynamicStatus_[jj]); jj = next_[jj]; } printf("\n"); #endif #ifdef CLP_DEBUG { // debug coding to analyze set int i; int kSet = -6; if (kSet >= 0) { int * back = new int [numberGubColumns_]; for (i = 0; i < numberGubColumns_; i++) back[i] = -1; for (i = firstDynamic_; i < firstAvailable_; i++) back[id_[i-firstDynamic_]] = i; int sequence = startSet_[kSet]; if (toIndex_[kSet] < 0) { printf("Not in - Set %d - slack status %d, key %d\n", kSet, status_[kSet], keyVariable_[kSet]); while (sequence >= 0) { printf("( %d status %d ) ", sequence, getDynamicStatus(sequence)); sequence = next_[sequence]; } } else { int iRow = numberStaticRows_ + toIndex_[kSet]; printf("In - Set %d - slack status %d, key %d offset %g slack %g\n", kSet, status_[kSet], keyVariable_[kSet], rhsOffset_[iRow], model->solutionRegion(0)[iRow]); while (sequence >= 0) { int iBack = back[sequence]; printf("( %d status %d value %g) ", sequence, getDynamicStatus(sequence), model->solutionRegion()[iBack]); sequence = next_[sequence]; } } printf("\n"); delete [] back; } } #endif int n = numberActiveSets_; for (i = 0; i < numberSets_; i++) { if (toIndex_[i] < 0) { //assert(keyValue(i)>=lowerSet_[i]&&keyValue(i)<=upperSet_[i]); n++; } int k=0; for (int j=startSet_[i];jspecialOptions() != 16) { ClpPackedMatrix::times(scalar, x, y); } else { int iRow; const double * element = matrix_->getElements(); const int * row = matrix_->getIndices(); const CoinBigIndex * startColumn = matrix_->getVectorStarts(); const int * length = matrix_->getVectorLengths(); int * pivotVariable = model_->pivotVariable(); for (iRow = 0; iRow < numberStaticRows_ + numberActiveSets_; iRow++) { y[iRow] -= scalar * rhsOffset_[iRow]; int iColumn = pivotVariable[iRow]; if (iColumn < lastDynamic_) { CoinBigIndex j; double value = scalar * x[iColumn]; if (value) { for (j = startColumn[iColumn]; j < startColumn[iColumn] + length[iColumn]; j++) { int jRow = row[j]; y[jRow] += value * element[j]; } } } } } } // Modifies rhs offset void ClpDynamicMatrix::modifyOffset(int sequence, double amount) { if (amount) { assert (rhsOffset_); CoinBigIndex j; for (j = startColumn_[sequence]; j < startColumn_[sequence+1]; j++) { int iRow = row_[j]; rhsOffset_[iRow] += amount * element_[j]; } } } // Gets key value when none in small double ClpDynamicMatrix::keyValue(int iSet) const { double value = 0.0; if (toIndex_[iSet] < 0) { int key = keyVariable_[iSet]; if (key < maximumGubColumns_) { if (getStatus(iSet) == ClpSimplex::atLowerBound) value = lowerSet_[iSet]; else value = upperSet_[iSet]; int numberKey = 0; int j = startSet_[iSet]; while (j >= 0) { DynamicStatus status = getDynamicStatus(j); assert (status != inSmall); if (status == soloKey) { numberKey++; } else if (status == atUpperBound) { value -= columnUpper_[j]; } else if (columnLower_) { value -= columnLower_[j]; } j = next_[j]; //onto next in set } assert (numberKey == 1); } else { int j = startSet_[iSet]; while (j >= 0) { DynamicStatus status = getDynamicStatus(j); assert (status != inSmall); assert (status != soloKey); if (status == atUpperBound) { value += columnUpper_[j]; } else if (columnLower_) { value += columnLower_[j]; } j = next_[j]; //onto next in set } #if 0 // slack must be feasible double oldValue=value; value = CoinMax(value,lowerSet_[iSet]); value = CoinMin(value,upperSet_[iSet]); if (value!=oldValue) printf("using %g (not %g) for slack on set %d (%g,%g)\n", value,oldValue,iSet,lowerSet_[iSet],upperSet_[iSet]); #endif } } return value; } // Switches off dj checking each factorization (for BIG models) void ClpDynamicMatrix::switchOffCheck() { noCheck_ = 0; infeasibilityWeight_ = 0.0; } /* Creates a variable. This is called after partial pricing and may modify matrix. May update bestSequence. */ void ClpDynamicMatrix::createVariable(ClpSimplex * model, int & bestSequence) { int numberRows = model->numberRows(); int slackOffset = lastDynamic_ + numberRows; int structuralOffset = slackOffset + numberSets_; int bestSequence2 = savedBestSequence_ - structuralOffset; if (bestSequence >= slackOffset) { double * columnLower = model->lowerRegion(); double * columnUpper = model->upperRegion(); double * solution = model->solutionRegion(); double * reducedCost = model->djRegion(); const double * duals = model->dualRowSolution(); if (toIndex_[savedBestSet_] < 0) { // need to put key into basis int newRow = numberActiveSets_ + numberStaticRows_; model->dualRowSolution()[newRow] = savedBestGubDual_; double valueOfKey = keyValue(savedBestSet_); // done before toIndex_ set toIndex_[savedBestSet_] = numberActiveSets_; fromIndex_[numberActiveSets_++] = savedBestSet_; int iSequence = lastDynamic_ + newRow; // we need to get lower and upper correct double shift = 0.0; int j = startSet_[savedBestSet_]; while (j >= 0) { if (getDynamicStatus(j) == atUpperBound) shift += columnUpper_[j]; else if (getDynamicStatus(j) == atLowerBound && columnLower_) shift += columnLower_[j]; j = next_[j]; //onto next in set } if (lowerSet_[savedBestSet_] > -1.0e20) columnLower[iSequence] = lowerSet_[savedBestSet_]; else columnLower[iSequence] = -COIN_DBL_MAX; if (upperSet_[savedBestSet_] < 1.0e20) columnUpper[iSequence] = upperSet_[savedBestSet_]; else columnUpper[iSequence] = COIN_DBL_MAX; #ifdef CLP_DEBUG if (model_->logLevel() == 63) { printf("%d in in set %d, key is %d rhs %g %g - keyvalue %g\n", bestSequence2, savedBestSet_, keyVariable_[savedBestSet_], columnLower[iSequence], columnUpper[iSequence], valueOfKey); int j = startSet_[savedBestSet_]; while (j >= 0) { if (getDynamicStatus(j) == atUpperBound) printf("%d atup ", j); else if (getDynamicStatus(j) == atLowerBound) printf("%d atlo ", j); else if (getDynamicStatus(j) == soloKey) printf("%d solo ", j); else abort(); j = next_[j]; //onto next in set } printf("\n"); } #endif if (keyVariable_[savedBestSet_] < maximumGubColumns_) { // slack not key model_->pivotVariable()[newRow] = firstAvailable_; backToPivotRow_[firstAvailable_] = newRow; model->setStatus(iSequence, getStatus(savedBestSet_)); model->djRegion()[iSequence] = savedBestGubDual_; solution[iSequence] = valueOfKey; // create variable and pivot in int key = keyVariable_[savedBestSet_]; setDynamicStatus(key, inSmall); double * element = matrix_->getMutableElements(); int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int * length = matrix_->getMutableVectorLengths(); CoinBigIndex numberElements = startColumn[firstAvailable_]; int numberThis = startColumn_[key+1] - startColumn_[key] + 1; if (numberElements + numberThis > numberElements_) { // need to redo numberElements_ = CoinMax(3 * numberElements_ / 2, numberElements + numberThis); matrix_->reserve(lastDynamic_, numberElements_); element = matrix_->getMutableElements(); row = matrix_->getMutableIndices(); // these probably okay but be safe startColumn = matrix_->getMutableVectorStarts(); length = matrix_->getMutableVectorLengths(); } // already set startColumn[firstAvailable_]=numberElements; length[firstAvailable_] = numberThis; model->costRegion()[firstAvailable_] = cost_[key]; CoinBigIndex base = startColumn_[key]; for (int j = 0; j < numberThis - 1; j++) { row[numberElements] = row_[base+j]; element[numberElements++] = element_[base+j]; } row[numberElements] = newRow; element[numberElements++] = 1.0; id_[firstAvailable_-firstDynamic_] = key; model->setObjectiveOffset(model->objectiveOffset() + cost_[key]* valueOfKey); model->solutionRegion()[firstAvailable_] = valueOfKey; model->setStatus(firstAvailable_, ClpSimplex::basic); // ***** need to adjust effective rhs if (!columnLower_ && !columnUpper_) { columnLower[firstAvailable_] = 0.0; columnUpper[firstAvailable_] = COIN_DBL_MAX; } else { if (columnLower_) columnLower[firstAvailable_] = columnLower_[key]; else columnLower[firstAvailable_] = 0.0; if (columnUpper_) columnUpper[firstAvailable_] = columnUpper_[key]; else columnUpper[firstAvailable_] = COIN_DBL_MAX; } model->nonLinearCost()->setOne(firstAvailable_, solution[firstAvailable_], columnLower[firstAvailable_], columnUpper[firstAvailable_], cost_[key]); startColumn[firstAvailable_+1] = numberElements; reducedCost[firstAvailable_] = 0.0; modifyOffset(key, valueOfKey); rhsOffset_[newRow] = -shift; // sign? #ifdef CLP_DEBUG model->rowArray(1)->checkClear(); #endif // now pivot in unpack(model, model->rowArray(1), firstAvailable_); model->factorization()->updateColumnFT(model->rowArray(2), model->rowArray(1)); double alpha = model->rowArray(1)->denseVector()[newRow]; int updateStatus = model->factorization()->replaceColumn(model, model->rowArray(2), model->rowArray(1), newRow, alpha); model->rowArray(1)->clear(); if (updateStatus) { if (updateStatus == 3) { // out of memory // increase space if not many iterations if (model->factorization()->pivots() < 0.5 * model->factorization()->maximumPivots() && model->factorization()->pivots() < 400) model->factorization()->areaFactor( model->factorization()->areaFactor() * 1.1); } else { printf("Bad returncode %d from replaceColumn\n", updateStatus); } bestSequence = -1; return; } // firstAvailable_ only finally updated if good pivot (in updatePivot) // otherwise it reverts to firstAvailableBefore_ firstAvailable_++; } else { // slack key model->setStatus(iSequence, ClpSimplex::basic); model->djRegion()[iSequence] = 0.0; solution[iSequence] = valueOfKey+shift; rhsOffset_[newRow] = -shift; // sign? } // correct slack model->costRegion()[iSequence] = 0.0; model->nonLinearCost()->setOne(iSequence, solution[iSequence], columnLower[iSequence], columnUpper[iSequence], 0.0); } if (savedBestSequence_ >= structuralOffset) { // recompute dj and create double value = cost_[bestSequence2] - savedBestGubDual_; for (CoinBigIndex jBigIndex = startColumn_[bestSequence2]; jBigIndex < startColumn_[bestSequence2+1]; jBigIndex++) { int jRow = row_[jBigIndex]; value -= duals[jRow] * element_[jBigIndex]; } int gubRow = toIndex_[savedBestSet_] + numberStaticRows_; double * element = matrix_->getMutableElements(); int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int * length = matrix_->getMutableVectorLengths(); CoinBigIndex numberElements = startColumn[firstAvailable_]; int numberThis = startColumn_[bestSequence2+1] - startColumn_[bestSequence2] + 1; if (numberElements + numberThis > numberElements_) { // need to redo numberElements_ = CoinMax(3 * numberElements_ / 2, numberElements + numberThis); matrix_->reserve(lastDynamic_, numberElements_); element = matrix_->getMutableElements(); row = matrix_->getMutableIndices(); // these probably okay but be safe startColumn = matrix_->getMutableVectorStarts(); length = matrix_->getMutableVectorLengths(); } // already set startColumn[firstAvailable_]=numberElements; length[firstAvailable_] = numberThis; model->costRegion()[firstAvailable_] = cost_[bestSequence2]; CoinBigIndex base = startColumn_[bestSequence2]; for (int j = 0; j < numberThis - 1; j++) { row[numberElements] = row_[base+j]; element[numberElements++] = element_[base+j]; } row[numberElements] = gubRow; element[numberElements++] = 1.0; id_[firstAvailable_-firstDynamic_] = bestSequence2; //printf("best %d\n",bestSequence2); model->solutionRegion()[firstAvailable_] = 0.0; model->clearFlagged(firstAvailable_); if (!columnLower_ && !columnUpper_) { model->setStatus(firstAvailable_, ClpSimplex::atLowerBound); columnLower[firstAvailable_] = 0.0; columnUpper[firstAvailable_] = COIN_DBL_MAX; } else { DynamicStatus status = getDynamicStatus(bestSequence2); if (columnLower_) columnLower[firstAvailable_] = columnLower_[bestSequence2]; else columnLower[firstAvailable_] = 0.0; if (columnUpper_) columnUpper[firstAvailable_] = columnUpper_[bestSequence2]; else columnUpper[firstAvailable_] = COIN_DBL_MAX; if (status == atLowerBound) { solution[firstAvailable_] = columnLower[firstAvailable_]; model->setStatus(firstAvailable_, ClpSimplex::atLowerBound); } else { solution[firstAvailable_] = columnUpper[firstAvailable_]; model->setStatus(firstAvailable_, ClpSimplex::atUpperBound); } } model->setObjectiveOffset(model->objectiveOffset() + cost_[bestSequence2]* solution[firstAvailable_]); model->nonLinearCost()->setOne(firstAvailable_, solution[firstAvailable_], columnLower[firstAvailable_], columnUpper[firstAvailable_], cost_[bestSequence2]); bestSequence = firstAvailable_; // firstAvailable_ only updated if good pivot (in updatePivot) startColumn[firstAvailable_+1] = numberElements; //printf("price struct %d - dj %g gubpi %g\n",bestSequence,value,savedBestGubDual_); reducedCost[bestSequence] = value; } else { // slack - row must just have been created assert (toIndex_[savedBestSet_] == numberActiveSets_ - 1); int newRow = numberStaticRows_ + numberActiveSets_ - 1; bestSequence = lastDynamic_ + newRow; reducedCost[bestSequence] = savedBestGubDual_; } } // clear for next iteration savedBestSequence_ = -1; } // Returns reduced cost of a variable double ClpDynamicMatrix::reducedCost(ClpSimplex * model, int sequence) const { int numberRows = model->numberRows(); int slackOffset = lastDynamic_ + numberRows; if (sequence < slackOffset) return model->djRegion()[sequence]; else return savedBestDj_; } // Does gub crash void ClpDynamicMatrix::gubCrash() { // Do basis - cheapest or slack if feasible int longestSet = 0; int iSet; for (iSet = 0; iSet < numberSets_; iSet++) { int n = 0; int j = startSet_[iSet]; while (j >= 0) { n++; j = next_[j]; } longestSet = CoinMax(longestSet, n); } double * upper = new double[longestSet+1]; double * cost = new double[longestSet+1]; double * lower = new double[longestSet+1]; double * solution = new double[longestSet+1]; int * back = new int[longestSet+1]; double tolerance = model_->primalTolerance(); double objectiveOffset = 0.0; for (iSet = 0; iSet < numberSets_; iSet++) { int iBasic = -1; double value = 0.0; // find cheapest int numberInSet = 0; int j = startSet_[iSet]; while (j >= 0) { if (!columnLower_) lower[numberInSet] = 0.0; else lower[numberInSet] = columnLower_[j]; if (!columnUpper_) upper[numberInSet] = COIN_DBL_MAX; else upper[numberInSet] = columnUpper_[j]; back[numberInSet++] = j; j = next_[j]; } CoinFillN(solution, numberInSet, 0.0); // and slack iBasic = numberInSet; solution[iBasic] = -value; lower[iBasic] = -upperSet_[iSet]; upper[iBasic] = -lowerSet_[iSet]; int kphase; if (value < lowerSet_[iSet] - tolerance || value > upperSet_[iSet] + tolerance) { // infeasible kphase = 0; // remember bounds are flipped so opposite to natural if (value < lowerSet_[iSet] - tolerance) cost[iBasic] = 1.0; else cost[iBasic] = -1.0; CoinZeroN(cost, numberInSet); double dualTolerance = model_->dualTolerance(); for (int iphase = kphase; iphase < 2; iphase++) { if (iphase) { cost[numberInSet] = 0.0; for (int j = 0; j < numberInSet; j++) cost[j] = cost_[back[j]]; } // now do one row lp bool improve = true; while (improve) { improve = false; double dual = cost[iBasic]; int chosen = -1; double best = dualTolerance; int way = 0; for (int i = 0; i <= numberInSet; i++) { double dj = cost[i] - dual; double improvement = 0.0; if (iphase || i < numberInSet) assert (solution[i] >= lower[i] && solution[i] <= upper[i]); if (dj > dualTolerance) improvement = dj * (solution[i] - lower[i]); else if (dj < -dualTolerance) improvement = dj * (solution[i] - upper[i]); if (improvement > best) { best = improvement; chosen = i; if (dj < 0.0) { way = 1; } else { way = -1; } } } if (chosen >= 0) { improve = true; // now see how far if (way > 0) { // incoming increasing so basic decreasing // if phase 0 then go to nearest bound double distance = upper[chosen] - solution[chosen]; double basicDistance; if (!iphase) { assert (iBasic == numberInSet); assert (solution[iBasic] > upper[iBasic]); basicDistance = solution[iBasic] - upper[iBasic]; } else { basicDistance = solution[iBasic] - lower[iBasic]; } // need extra coding for unbounded assert (CoinMin(distance, basicDistance) < 1.0e20); if (distance > basicDistance) { // incoming becomes basic solution[chosen] += basicDistance; if (!iphase) solution[iBasic] = upper[iBasic]; else solution[iBasic] = lower[iBasic]; iBasic = chosen; } else { // flip solution[chosen] = upper[chosen]; solution[iBasic] -= distance; } } else { // incoming decreasing so basic increasing // if phase 0 then go to nearest bound double distance = solution[chosen] - lower[chosen]; double basicDistance; if (!iphase) { assert (iBasic == numberInSet); assert (solution[iBasic] < lower[iBasic]); basicDistance = lower[iBasic] - solution[iBasic]; } else { basicDistance = upper[iBasic] - solution[iBasic]; } // need extra coding for unbounded - for now just exit if (CoinMin(distance, basicDistance) > 1.0e20) { printf("unbounded on set %d\n", iSet); iphase = 1; iBasic = numberInSet; break; } if (distance > basicDistance) { // incoming becomes basic solution[chosen] -= basicDistance; if (!iphase) solution[iBasic] = lower[iBasic]; else solution[iBasic] = upper[iBasic]; iBasic = chosen; } else { // flip solution[chosen] = lower[chosen]; solution[iBasic] += distance; } } if (!iphase) { if(iBasic < numberInSet) break; // feasible else if (solution[iBasic] >= lower[iBasic] && solution[iBasic] <= upper[iBasic]) break; // feasible (on flip) } } } } } // do solution i.e. bounds if (columnLower_ || columnUpper_) { for (int j = 0; j < numberInSet; j++) { if (j != iBasic) { objectiveOffset += solution[j] * cost[j]; if (columnLower_ && columnUpper_) { if (fabs(solution[j] - columnLower_[back[j]]) > fabs(solution[j] - columnUpper_[back[j]])) setDynamicStatus(back[j], atUpperBound); } else if (columnUpper_ && solution[j] > 0.0) { setDynamicStatus(back[j], atUpperBound); } else { setDynamicStatus(back[j], atLowerBound); assert(!solution[j]); } } } } // convert iBasic back and do bounds if (iBasic == numberInSet) { // slack basic setStatus(iSet, ClpSimplex::basic); iBasic = iSet + maximumGubColumns_; } else { iBasic = back[iBasic]; setDynamicStatus(iBasic, soloKey); // remember bounds flipped if (upper[numberInSet] == lower[numberInSet]) setStatus(iSet, ClpSimplex::isFixed); else if (solution[numberInSet] == upper[numberInSet]) setStatus(iSet, ClpSimplex::atLowerBound); else if (solution[numberInSet] == lower[numberInSet]) setStatus(iSet, ClpSimplex::atUpperBound); else abort(); } keyVariable_[iSet] = iBasic; } model_->setObjectiveOffset(objectiveOffset_ - objectiveOffset); delete [] lower; delete [] solution; delete [] upper; delete [] cost; delete [] back; // make sure matrix is in good shape matrix_->orderMatrix(); } // Populates initial matrix from dynamic status void ClpDynamicMatrix::initialProblem() { int iSet; double * element = matrix_->getMutableElements(); int * row = matrix_->getMutableIndices(); CoinBigIndex * startColumn = matrix_->getMutableVectorStarts(); int * length = matrix_->getMutableVectorLengths(); double * cost = model_->objective(); double * solution = model_->primalColumnSolution(); double * columnLower = model_->columnLower(); double * columnUpper = model_->columnUpper(); double * rowSolution = model_->primalRowSolution(); double * rowLower = model_->rowLower(); double * rowUpper = model_->rowUpper(); CoinBigIndex numberElements = startColumn[firstDynamic_]; firstAvailable_ = firstDynamic_; numberActiveSets_ = 0; for (iSet = 0; iSet < numberSets_; iSet++) { toIndex_[iSet] = -1; int numberActive = 0; int whichKey = -1; if (getStatus(iSet) == ClpSimplex::basic) { whichKey = maximumGubColumns_ + iSet; numberActive = 1; } else { whichKey = -1; } int j = startSet_[iSet]; while (j >= 0) { assert (getDynamicStatus(j) != soloKey || whichKey == -1); if (getDynamicStatus(j) == inSmall) { numberActive++; } else if (getDynamicStatus(j) == soloKey) { whichKey = j; numberActive++; } j = next_[j]; //onto next in set } if (numberActive > 1) { int iRow = numberActiveSets_ + numberStaticRows_; rowSolution[iRow] = 0.0; double lowerValue; if (lowerSet_[iSet] > -1.0e20) lowerValue = lowerSet_[iSet]; else lowerValue = -COIN_DBL_MAX; double upperValue; if (upperSet_[iSet] < 1.0e20) upperValue = upperSet_[iSet]; else upperValue = COIN_DBL_MAX; rowLower[iRow] = lowerValue; rowUpper[iRow] = upperValue; if (getStatus(iSet) == ClpSimplex::basic) { model_->setRowStatus(iRow, ClpSimplex::basic); rowSolution[iRow] = 0.0; } else if (getStatus(iSet) == ClpSimplex::atLowerBound) { model_->setRowStatus(iRow, ClpSimplex::atLowerBound); rowSolution[iRow] = lowerValue; } else { model_->setRowStatus(iRow, ClpSimplex::atUpperBound); rowSolution[iRow] = upperValue; } j = startSet_[iSet]; while (j >= 0) { DynamicStatus status = getDynamicStatus(j); if (status == inSmall) { int numberThis = startColumn_[j+1] - startColumn_[j] + 1; if (numberElements + numberThis > numberElements_) { // need to redo numberElements_ = CoinMax(3 * numberElements_ / 2, numberElements + numberThis); matrix_->reserve(lastDynamic_, numberElements_); element = matrix_->getMutableElements(); row = matrix_->getMutableIndices(); // these probably okay but be safe startColumn = matrix_->getMutableVectorStarts(); length = matrix_->getMutableVectorLengths(); } length[firstAvailable_] = numberThis; cost[firstAvailable_] = cost_[j]; CoinBigIndex base = startColumn_[j]; for (int k = 0; k < numberThis - 1; k++) { row[numberElements] = row_[base+k]; element[numberElements++] = element_[base+k]; } row[numberElements] = iRow; element[numberElements++] = 1.0; id_[firstAvailable_-firstDynamic_] = j; solution[firstAvailable_] = 0.0; model_->setStatus(firstAvailable_, ClpSimplex::basic); if (!columnLower_ && !columnUpper_) { columnLower[firstAvailable_] = 0.0; columnUpper[firstAvailable_] = COIN_DBL_MAX; } else { if (columnLower_) columnLower[firstAvailable_] = columnLower_[j]; else columnLower[firstAvailable_] = 0.0; if (columnUpper_) columnUpper[firstAvailable_] = columnUpper_[j]; else columnUpper[firstAvailable_] = COIN_DBL_MAX; if (status != atUpperBound) { solution[firstAvailable_] = columnLower[firstAvailable_]; } else { solution[firstAvailable_] = columnUpper[firstAvailable_]; } } firstAvailable_++; startColumn[firstAvailable_] = numberElements; } j = next_[j]; //onto next in set } model_->setRowStatus(numberActiveSets_ + numberStaticRows_, getStatus(iSet)); toIndex_[iSet] = numberActiveSets_; fromIndex_[numberActiveSets_++] = iSet; } else { // solo key bool needKey=false; if (numberActive) { if (whichKeyupperSet_[iSet]+1.0e-8) needKey=true; } } else { needKey = true; } if (needKey) { // all to lb then up some (slack/null if possible) int length=99999999; int which=-1; double sum=0.0; for (int iColumn=startSet_[iSet];iColumnstartColumn_[iColumn+1]-startColumn_[iColumn]) { which=iColumn; length=startColumn_[iColumn+1]-startColumn_[iColumn]; } } if (sum>lowerSet_[iSet]-1.0e-8) { // slack can be basic setStatus(iSet,ClpSimplex::basic); keyVariable_[iSet] = maximumGubColumns_ + iSet; } else { // use shortest setDynamicStatus(which,soloKey); keyVariable_[iSet] = which; setStatus(iSet,ClpSimplex::atLowerBound); } } } assert (toIndex_[iSet] >= 0 || whichKey >= 0); keyVariable_[iSet] = whichKey; } // clean up pivotVariable int numberColumns = model_->numberColumns(); int numberRows = model_->numberRows(); int * pivotVariable = model_->pivotVariable(); if (pivotVariable) { for (int i=0; igetRowStatus(i)!=ClpSimplex::basic) pivotVariable[i]=-1; else pivotVariable[i]=numberColumns+i; } for (int i=numberStaticRows_+numberActiveSets_;igetColumnStatus(i)==ClpSimplex::basic) { while(putcostRegion(); double * columnLower = model_->lowerRegion(); double * columnUpper = model_->upperRegion(); double * solution = model_->solutionRegion(); int numberRows = model_->numberRows(); for (int i = numberActiveSets_; i < numberRows-numberStaticRows_; i++) { int iSequence = i + numberStaticRows_ + numberColumns; solution[iSequence] = 0.0; columnLower[iSequence] = -COIN_DBL_MAX; columnUpper[iSequence] = COIN_DBL_MAX; cost[iSequence] = 0.0; model_->nonLinearCost()->setOne(iSequence, solution[iSequence], columnLower[iSequence], columnUpper[iSequence], 0.0); model_->setStatus(iSequence, ClpSimplex::basic); rhsOffset_[i+numberStaticRows_] = 0.0; } #if 0 for (int i=0;icolumnLower(); const double * columnUpperA = model_->columnUpper(); const double * costA = model_->objective(); const double * rowLowerA = model_->rowLower(); const double * rowUpperA = model_->rowUpper(); start[0]=0; numberElements=0; for (int i=0;i= 0) { if (startColumn_[j+1] - startColumn_[j] == numberEntries) { const int * row2 = row_ + startColumn_[j]; const double * element2 = element_ + startColumn_[j]; bool same = true; for (int k = 0; k < numberEntries; k++) { if (row[k] != row2[k] || element[k] != element2[k]) { same = false; break; } } if (same) { bool odd = false; if (cost != cost_[j]) odd = true; if (columnLower_ && lower != columnLower_[j]) odd = true; if (columnUpper_ && upper != columnUpper_[j]) odd = true; if (odd) { printf("seems odd - same els but cost,lo,up are %g,%g,%g and %g,%g,%g\n", cost, lower, upper, cost_[j], columnLower_ ? columnLower_[j] : 0.0, columnUpper_ ? columnUpper_[j] : 1.0e100); } else { setDynamicStatus(j, status); return j; } } } j = next_[j]; } if (numberGubColumns_ == maximumGubColumns_ || startColumn_[numberGubColumns_] + numberEntries > maximumElements_) { CoinBigIndex j; int i; int put = 0; int numberElements = 0; CoinBigIndex start = 0; // compress - leave ones at ub and basic int * which = new int [numberGubColumns_]; for (i = 0; i < numberGubColumns_; i++) { CoinBigIndex end = startColumn_[i+1]; // what about ubs if column generation? if (getDynamicStatus(i) != atLowerBound) { // keep in for (j = start; j < end; j++) { row_[numberElements] = row_[j]; element_[numberElements++] = element_[j]; } startColumn_[put+1] = numberElements; cost_[put] = cost_[i]; if (columnLower_) columnLower_[put] = columnLower_[i]; if (columnUpper_) columnUpper_[put] = columnUpper_[i]; dynamicStatus_[put] = dynamicStatus_[i]; id_[put] = id_[i]; which[i] = put; put++; } else { // out which[i] = -1; } start = end; } // now redo startSet_ and next_ int * newNext = new int [maximumGubColumns_]; for (int jSet = 0; jSet < numberSets_; jSet++) { int sequence = startSet_[jSet]; while (which[sequence] < 0) { // out assert (next_[sequence] >= 0); sequence = next_[sequence]; } startSet_[jSet] = which[sequence]; int last = which[sequence]; while (next_[sequence] >= 0) { sequence = next_[sequence]; if(which[sequence] >= 0) { // keep newNext[last] = which[sequence]; last = which[sequence]; } } newNext[last] = -jSet - 1; } delete [] next_; next_ = newNext; delete [] which; abort(); } CoinBigIndex start = startColumn_[numberGubColumns_]; CoinMemcpyN(row, numberEntries, row_ + start); CoinMemcpyN(element, numberEntries, element_ + start); startColumn_[numberGubColumns_+1] = start + numberEntries; cost_[numberGubColumns_] = cost; if (columnLower_) columnLower_[numberGubColumns_] = lower; else assert (!lower); if (columnUpper_) columnUpper_[numberGubColumns_] = upper; else assert (upper > 1.0e20); setDynamicStatus(numberGubColumns_, status); // Do next_ j = startSet_[iSet]; startSet_[iSet] = numberGubColumns_; next_[numberGubColumns_] = j; numberGubColumns_++; return numberGubColumns_ - 1; } // Returns which set a variable is in int ClpDynamicMatrix::whichSet (int sequence) const { while (next_[sequence] >= 0) sequence = next_[sequence]; int iSet = - next_[sequence] - 1; return iSet; } CoinMP-1.8.3/Clp/src/ClpPdco.cpp0000644000175000017500000011600312172721465014661 0ustar renerene/* $Id: ClpPdco.cpp 1972 2013-07-21 09:00:37Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Pdco algorithm Method */ #include "CoinPragma.hpp" #include #include "CoinDenseVector.hpp" #include "ClpPdco.hpp" #include "ClpPdcoBase.hpp" #include "CoinHelperFunctions.hpp" #include "ClpHelperFunctions.hpp" #include "ClpLsqr.hpp" #include "CoinTime.hpp" #include "ClpMessage.hpp" #include #include #include #include #include int ClpPdco::pdco() { printf("Dummy pdco solve\n"); return 0; } // ** Temporary version int ClpPdco::pdco( ClpPdcoBase * stuff, Options &options, Info &info, Outfo &outfo) { // D1, D2 are positive-definite diagonal matrices defined from d1, d2. // In particular, d2 indicates the accuracy required for // satisfying each row of Ax = b. // // D1 and D2 (via d1 and d2) provide primal and dual regularization // respectively. They ensure that the primal and dual solutions // (x,r) and (y,z) are unique and bounded. // // A scalar d1 is equivalent to d1 = ones(n,1), D1 = diag(d1). // A scalar d2 is equivalent to d2 = ones(m,1), D2 = diag(d2). // Typically, d1 = d2 = 1e-4. // These values perturb phi(x) only slightly (by about 1e-8) and request // that A*x = b be satisfied quite accurately (to about 1e-8). // Set d1 = 1e-4, d2 = 1 for least-squares problems with bound constraints. // The problem is then // // minimize phi(x) + 1/2 norm(d1*x)^2 + 1/2 norm(A*x - b)^2 // subject to bl <= x <= bu. // // More generally, d1 and d2 may be n and m vectors containing any positive // values (preferably not too small, and typically no larger than 1). // Bigger elements of d1 and d2 improve the stability of the solver. // // At an optimal solution, if x(j) is on its lower or upper bound, // the corresponding z(j) is positive or negative respectively. // If x(j) is between its bounds, z(j) = 0. // If bl(j) = bu(j), x(j) is fixed at that value and z(j) may have // either sign. // // Also, r and y satisfy r = D2 y, so that Ax + D2^2 y = b. // Thus if d2(i) = 1e-4, the i-th row of Ax = b will be satisfied to // approximately 1e-8. This determines how large d2(i) can safely be. // // // EXTERNAL FUNCTIONS: // options = pdcoSet; provided with pdco.m // [obj,grad,hess] = pdObj( x ); provided by user // y = pdMat( name,mode,m,n,x ); provided by user if pdMat // is a string, not a matrix // // INPUT ARGUMENTS: // pdObj is a string containing the name of a function pdObj.m // or a function_handle for such a function // such that [obj,grad,hess] = pdObj(x) defines // obj = phi(x) : a scalar, // grad = gradient of phi(x) : an n-vector, // hess = diag(Hessian of phi): an n-vector. // Examples: // If phi(x) is the linear function c"x, pdObj should return // [obj,grad,hess] = [c"*x, c, zeros(n,1)]. // If phi(x) is the entropy function E(x) = sum x(j) log x(j), // [obj,grad,hess] = [E(x), log(x)+1, 1./x]. // pdMat may be an ifexplicit m x n matrix A (preferably sparse!), // or a string containing the name of a function pdMat.m // or a function_handle for such a function // such that y = pdMat( name,mode,m,n,x ) // returns y = A*x (mode=1) or y = A"*x (mode=2). // The input parameter "name" will be the string pdMat. // b is an m-vector. // bl is an n-vector of lower bounds. Non-existent bounds // may be represented by bl(j) = -Inf or bl(j) <= -1e+20. // bu is an n-vector of upper bounds. Non-existent bounds // may be represented by bu(j) = Inf or bu(j) >= 1e+20. // d1, d2 may be positive scalars or positive vectors (see above). // options is a structure that may be set and altered by pdcoSet // (type help pdcoSet). // x0, y0, z0 provide an initial solution. // xsize, zsize are estimates of the biggest x and z at the solution. // They are used to scale (x,y,z). Good estimates // should improve the performance of the barrier method. // // // OUTPUT ARGUMENTS: // x is the primal solution. // y is the dual solution associated with Ax + D2 r = b. // z is the dual solution associated with bl <= x <= bu. // inform = 0 if a solution is found; // = 1 if too many iterations were required; // = 2 if the linesearch failed too often. // PDitns is the number of Primal-Dual Barrier iterations required. // CGitns is the number of Conjugate-Gradient iterations required // if an iterative solver is used (LSQR). // time is the cpu time used. //---------------------------------------------------------------------- // PRIVATE FUNCTIONS: // pdxxxbounds // pdxxxdistrib // pdxxxlsqr // pdxxxlsqrmat // pdxxxmat // pdxxxmerit // pdxxxresid1 // pdxxxresid2 // pdxxxstep // // GLOBAL VARIABLES: // global pdDDD1 pdDDD2 pdDDD3 // // // NOTES: // The matrix A should be reasonably well scaled: norm(A,inf) =~ 1. // The vector b and objective phi(x) may be of any size, but ensure that // xsize and zsize are reasonably close to norm(x,inf) and norm(z,inf) // at the solution. // // The files defining pdObj and pdMat // must not be called Fname.m or Aname.m!! // // // AUTHOR: // Michael Saunders, Systems Optimization Laboratory (SOL), // Stanford University, Stanford, California, USA. // saunders@stanford.edu // // CONTRIBUTORS: // Byunggyoo Kim, SOL, Stanford University. // bgkim@stanford.edu // // DEVELOPMENT: // 20 Jun 1997: Original version of pdsco.m derived from pdlp0.m. // 29 Sep 2002: Original version of pdco.m derived from pdsco.m. // Introduced D1, D2 in place of gamma*I, delta*I // and allowed for general bounds bl <= x <= bu. // 06 Oct 2002: Allowed for fixed variabes: bl(j) = bu(j) for any j. // 15 Oct 2002: Eliminated some work vectors (since m, n might be LARGE). // Modularized residuals, linesearch // 16 Oct 2002: pdxxx..., pdDDD... names rationalized. // pdAAA eliminated (global copy of A). // Aname is now used directly as an ifexplicit A or a function. // NOTE: If Aname is a function, it now has an extra parameter. // 23 Oct 2002: Fname and Aname can now be function handles. // 01 Nov 2002: Bug fixed in feval in pdxxxmat. //----------------------------------------------------------------------- // global pdDDD1 pdDDD2 pdDDD3 double inf = 1.0e30; double eps = 1.0e-15; double atolold = -1.0, r3ratio = -1.0, Pinf, Dinf, Cinf, Cinf0; printf("\n --------------------------------------------------------"); printf("\n pdco.m Version of 01 Nov 2002"); printf("\n Primal-dual barrier method to minimize a convex function"); printf("\n subject to linear constraints Ax + r = b, bl <= x <= bu"); printf("\n --------------------------------------------------------\n"); int m = numberRows_; int n = numberColumns_; bool ifexplicit = true; CoinDenseVector b(m, rhs_); CoinDenseVector x(n, x_); CoinDenseVector y(m, y_); CoinDenseVector z(n, dj_); //delete old arrays delete [] rhs_; delete [] x_; delete [] y_; delete [] dj_; rhs_ = NULL; x_ = NULL; y_ = NULL; dj_ = NULL; // Save stuff so available elsewhere pdcoStuff_ = stuff; double normb = b.infNorm(); double normx0 = x.infNorm(); double normy0 = y.infNorm(); double normz0 = z.infNorm(); printf("\nmax |b | = %8g max |x0| = %8g", normb , normx0); printf( " xsize = %8g", xsize_); printf("\nmax |y0| = %8g max |z0| = %8g", normy0, normz0); printf( " zsize = %8g", zsize_); //--------------------------------------------------------------------- // Initialize. //--------------------------------------------------------------------- //true = 1; //false = 0; //zn = zeros(n,1); //int nb = n + m; int CGitns = 0; int inform = 0; //--------------------------------------------------------------------- // Only allow scalar d1, d2 for now //--------------------------------------------------------------------- /* if (d1_->size()==1) d1_->resize(n, d1_->getElements()[0]); // Allow scalar d1, d2 if (d2_->size()==1) d2->resize(m, d2->getElements()[0]); // to mean dk * unit vector */ assert (stuff->sizeD1() == 1); double d1 = stuff->getD1(); double d2 = stuff->getD2(); //--------------------------------------------------------------------- // Grab input options. //--------------------------------------------------------------------- int maxitn = options.MaxIter; double featol = options.FeaTol; double opttol = options.OptTol; double steptol = options.StepTol; int stepSame = 1; /* options.StepSame; // 1 means stepx == stepz */ double x0min = options.x0min; double z0min = options.z0min; double mu0 = options.mu0; int LSproblem = options.LSproblem; // See below int LSmethod = options.LSmethod; // 1=Cholesky 2=QR 3=LSQR int itnlim = options.LSQRMaxIter * CoinMin(m, n); double atol1 = options.LSQRatol1; // Initial atol double atol2 = options.LSQRatol2; // Smallest atol,unless atol1 is smaller double conlim = options.LSQRconlim; //int wait = options.wait; // LSproblem: // 1 = dy 2 = dy shifted, DLS // 11 = s 12 = s shifted, DLS (dx = Ds) // 21 = dx // 31 = 3x3 system, symmetrized by Z^{1/2} // 32 = 2x2 system, symmetrized by X^{1/2} //--------------------------------------------------------------------- // Set other parameters. //--------------------------------------------------------------------- int kminor = 0; // 1 stops after each iteration double eta = 1e-4; // Linesearch tolerance for "sufficient descent" double maxf = 10; // Linesearch backtrack limit (function evaluations) double maxfail = 1; // Linesearch failure limit (consecutive iterations) double bigcenter = 1e+3; // mu is reduced if center < bigcenter. // Parameters for LSQR. double atolmin = eps; // Smallest atol if linesearch back-tracks double btol = 0; // Should be small (zero is ok) double show = false; // Controls lsqr iteration log /* double gamma = d1->infNorm(); double delta = d2->infNorm(); */ double gamma = d1; double delta = d2; printf("\n\nx0min = %8g featol = %8.1e", x0min, featol); printf( " d1max = %8.1e", gamma); printf( "\nz0min = %8g opttol = %8.1e", z0min, opttol); printf( " d2max = %8.1e", delta); printf( "\nmu0 = %8.1e steptol = %8g", mu0 , steptol); printf( " bigcenter= %8g" , bigcenter); printf("\n\nLSQR:"); printf("\natol1 = %8.1e atol2 = %8.1e", atol1 , atol2 ); printf( " btol = %8.1e", btol ); printf("\nconlim = %8.1e itnlim = %8d" , conlim, itnlim); printf( " show = %8g" , show ); // LSmethod = 3; ////// Hardwire LSQR // LSproblem = 1; ////// and LS problem defining "dy". /* if wait printf("\n\nReview parameters... then type "return"\n") keyboard end */ if (eta < 0) printf("\n\nLinesearch disabled by eta < 0"); //--------------------------------------------------------------------- // All parameters have now been set. //--------------------------------------------------------------------- double time = CoinCpuTime(); //bool useChol = (LSmethod == 1); //bool useQR = (LSmethod == 2); bool direct = (LSmethod <= 2 && ifexplicit); char solver[7]; strcpy(solver, " LSQR"); //--------------------------------------------------------------------- // Categorize bounds and allow for fixed variables by modifying b. //--------------------------------------------------------------------- int nlow, nupp, nfix; int *bptrs[3] = {0}; getBoundTypes(&nlow, &nupp, &nfix, bptrs ); int *low = bptrs[0]; int *upp = bptrs[1]; int *fix = bptrs[2]; int nU = n; if (nupp == 0) nU = 1; //Make dummy vectors if no Upper bounds //--------------------------------------------------------------------- // Get pointers to local copy of model bounds //--------------------------------------------------------------------- CoinDenseVector bl(n, columnLower_); double *bl_elts = bl.getElements(); CoinDenseVector bu(nU, columnUpper_); // this is dummy if no UB double *bu_elts = bu.getElements(); CoinDenseVector r1(m, 0.0); double *r1_elts = r1.getElements(); CoinDenseVector x1(n, 0.0); double *x1_elts = x1.getElements(); if (nfix > 0) { for (int k = 0; k < nfix; k++) x1_elts[fix[k]] = bl[fix[k]]; matVecMult(1, r1, x1); b = b - r1; // At some stage, might want to look at normfix = norm(r1,inf); } //--------------------------------------------------------------------- // Scale the input data. // The scaled variables are // xbar = x/beta, // ybar = y/zeta, // zbar = z/zeta. // Define // theta = beta*zeta; // The scaled function is // phibar = ( 1 /theta) fbar(beta*xbar), // gradient = (beta /theta) grad, // Hessian = (beta2/theta) hess. //--------------------------------------------------------------------- double beta = xsize_; if (beta == 0) beta = 1; // beta scales b, x. double zeta = zsize_; if (zeta == 0) zeta = 1; // zeta scales y, z. double theta = beta * zeta; // theta scales obj. // (theta could be anything, but theta = beta*zeta makes // scaled grad = grad/zeta = 1 approximately if zeta is chosen right.) for (int k = 0; k < nlow; k++) bl_elts[low[k]] = bl_elts[low[k]] / beta; for (int k = 0; k < nupp; k++) bu_elts[upp[k]] = bu_elts[upp[k]] / beta; d1 = d1 * ( beta / sqrt(theta) ); d2 = d2 * ( sqrt(theta) / beta ); double beta2 = beta * beta; b.scale( (1.0 / beta) ); y.scale( (1.0 / zeta) ); x.scale( (1.0 / beta) ); z.scale( (1.0 / zeta) ); //--------------------------------------------------------------------- // Initialize vectors that are not fully used if bounds are missing. //--------------------------------------------------------------------- CoinDenseVector rL(n, 0.0); CoinDenseVector cL(n, 0.0); CoinDenseVector z1(n, 0.0); CoinDenseVector dx1(n, 0.0); CoinDenseVector dz1(n, 0.0); CoinDenseVector r2(n, 0.0); // Assign upper bd regions (dummy if no UBs) CoinDenseVector rU(nU, 0.0); CoinDenseVector cU(nU, 0.0); CoinDenseVector x2(nU, 0.0); CoinDenseVector z2(nU, 0.0); CoinDenseVector dx2(nU, 0.0); CoinDenseVector dz2(nU, 0.0); //--------------------------------------------------------------------- // Initialize x, y, z, objective, etc. //--------------------------------------------------------------------- CoinDenseVector dx(n, 0.0); CoinDenseVector dy(m, 0.0); CoinDenseVector Pr(m); CoinDenseVector D(n); double *D_elts = D.getElements(); CoinDenseVector w(n); double *w_elts = w.getElements(); CoinDenseVector rhs(m + n); //--------------------------------------------------------------------- // Pull out the element array pointers for efficiency //--------------------------------------------------------------------- double *x_elts = x.getElements(); double *x2_elts = x2.getElements(); double *z_elts = z.getElements(); double *z1_elts = z1.getElements(); double *z2_elts = z2.getElements(); for (int k = 0; k < nlow; k++) { x_elts[low[k]] = CoinMax( x_elts[low[k]], bl[low[k]]); x1_elts[low[k]] = CoinMax( x_elts[low[k]] - bl[low[k]], x0min ); z1_elts[low[k]] = CoinMax( z_elts[low[k]], z0min ); } for (int k = 0; k < nupp; k++) { x_elts[upp[k]] = CoinMin( x_elts[upp[k]], bu[upp[k]]); x2_elts[upp[k]] = CoinMax(bu[upp[k]] - x_elts[upp[k]], x0min ); z2_elts[upp[k]] = CoinMax(-z_elts[upp[k]], z0min ); } //////////////////// Assume hessian is diagonal. ////////////////////// // [obj,grad,hess] = feval( Fname, (x*beta) ); x.scale(beta); double obj = getObj(x); CoinDenseVector grad(n); getGrad(x, grad); CoinDenseVector H(n); getHessian(x , H); x.scale((1.0 / beta)); //double * g_elts = grad.getElements(); double * H_elts = H.getElements(); obj /= theta; // Scaled obj. grad = grad * (beta / theta) + (d1 * d1) * x; // grad includes x regularization. H = H * (beta2 / theta) + (d1 * d1) ; // H includes x regularization. /*--------------------------------------------------------------------- // Compute primal and dual residuals: // r1 = b - Aprod(x) - d2*d2*y; // r2 = grad - Atprod(y) + z2 - z1; // rL = bl - x + x1; // rU = x + x2 - bu; */ //--------------------------------------------------------------------- // [r1,r2,rL,rU,Pinf,Dinf] = ... // pdxxxresid1( Aname,fix,low,upp, ... // b,bl,bu,d1,d2,grad,rL,rU,x,x1,x2,y,z1,z2 ); pdxxxresid1( this, nlow, nupp, nfix, low, upp, fix, b, bl_elts, bu_elts, d1, d2, grad, rL, rU, x, x1, x2, y, z1, z2, r1, r2, &Pinf, &Dinf); //--------------------------------------------------------------------- // Initialize mu and complementarity residuals: // cL = mu*e - X1*z1. // cU = mu*e - X2*z2. // // 25 Jan 2001: Now that b and obj are scaled (and hence x,y,z), // we should be able to use mufirst = mu0 (absolute value). // 0.1 worked poorly on StarTest1 with x0min = z0min = 0.1. // 29 Jan 2001: We might as well use mu0 = x0min * z0min; // so that most variables are centered after a warm start. // 29 Sep 2002: Use mufirst = mu0*(x0min * z0min), // regarding mu0 as a scaling of the initial center. //--------------------------------------------------------------------- // double mufirst = mu0*(x0min * z0min); double mufirst = mu0; // revert to absolute value double mulast = 0.1 * opttol; mulast = CoinMin( mulast, mufirst ); double mu = mufirst; double center, fmerit; pdxxxresid2( mu, nlow, nupp, low, upp, cL, cU, x1, x2, z1, z2, ¢er, &Cinf, &Cinf0 ); fmerit = pdxxxmerit(nlow, nupp, low, upp, r1, r2, rL, rU, cL, cU ); // Initialize other things. bool precon = true; double PDitns = 0; //bool converged = false; double atol = atol1; atol2 = CoinMax( atol2, atolmin ); atolmin = atol2; // pdDDD2 = d2; // Global vector for diagonal matrix D2 // Iteration log. int nf = 0; int itncg = 0; int nfail = 0; printf("\n\nItn mu stepx stepz Pinf Dinf"); printf(" Cinf Objective nf center"); if (direct) { printf("\n"); } else { printf(" atol solver Inexact\n"); } double regx = (d1 * x).twoNorm(); double regy = (d2 * y).twoNorm(); // regterm = twoNorm(d1.*x)^2 + norm(d2.*y)^2; double regterm = regx * regx + regy * regy; double objreg = obj + 0.5 * regterm; double objtrue = objreg * theta; printf("\n%3g ", PDitns ); printf("%6.1f%6.1f" , log10(Pinf ), log10(Dinf)); printf("%6.1f%15.7e", log10(Cinf0), objtrue ); printf(" %8.1f\n" , center ); /* if kminor printf("\n\nStart of first minor itn...\n"); keyboard end */ //--------------------------------------------------------------------- // Main loop. //--------------------------------------------------------------------- // Lsqr ClpLsqr thisLsqr(this); // while (converged) { while(PDitns < maxitn) { PDitns = PDitns + 1; // 31 Jan 2001: Set atol according to progress, a la Inexact Newton. // 07 Feb 2001: 0.1 not small enough for Satellite problem. Try 0.01. // 25 Apr 2001: 0.01 seems wasteful for Star problem. // Now that starting conditions are better, go back to 0.1. double r3norm = CoinMax(Pinf, CoinMax(Dinf, Cinf)); atol = CoinMin(atol, r3norm * 0.1); atol = CoinMax(atol, atolmin ); info.r3norm = r3norm; //------------------------------------------------------------------- // Define a damped Newton iteration for solving f = 0, // keeping x1, x2, z1, z2 > 0. We eliminate dx1, dx2, dz1, dz2 // to obtain the system // // [-H2 A" ] [ dx ] = [ w ], H2 = H + D1^2 + X1inv Z1 + X2inv Z2, // [ A D2^2] [ dy ] = [ r1] w = r2 - X1inv(cL + Z1 rL) // + X2inv(cU + Z2 rU), // // which is equivalent to the least-squares problem // // min || [ D A"]dy - [ D w ] ||, D = H2^{-1/2}. (*) // || [ D2 ] [D2inv r1] || //------------------------------------------------------------------- for (int k = 0; k < nlow; k++) H_elts[low[k]] = H_elts[low[k]] + z1[low[k]] / x1[low[k]]; for (int k = 0; k < nupp; k++) H[upp[k]] = H[upp[k]] + z2[upp[k]] / x2[upp[k]]; w = r2; for (int k = 0; k < nlow; k++) w[low[k]] = w[low[k]] - (cL[low[k]] + z1[low[k]] * rL[low[k]]) / x1[low[k]]; for (int k = 0; k < nupp; k++) w[upp[k]] = w[upp[k]] + (cU[upp[k]] + z2[upp[k]] * rU[upp[k]]) / x2[upp[k]]; if (LSproblem == 1) { //----------------------------------------------------------------- // Solve (*) for dy. //----------------------------------------------------------------- H = 1.0 / H; // H is now Hinv (NOTE!) for (int k = 0; k < nfix; k++) H[fix[k]] = 0; for (int k = 0; k < n; k++) D_elts[k] = sqrt(H_elts[k]); thisLsqr.borrowDiag1(D_elts); thisLsqr.diag2_ = d2; if (direct) { // Omit direct option for now } else {// Iterative solve using LSQR. //rhs = [ D.*w; r1./d2 ]; for (int k = 0; k < n; k++) rhs[k] = D_elts[k] * w_elts[k]; for (int k = 0; k < m; k++) rhs[n+k] = r1_elts[k] * (1.0 / d2); double damp = 0; if (precon) { // Construct diagonal preconditioner for LSQR matPrecon(d2, Pr, D); } /* rw(7) = precon; info.atolmin = atolmin; info.r3norm = fmerit; // Must be the 2-norm here. [ dy, istop, itncg, outfo ] = ... pdxxxlsqr( nb,m,"pdxxxlsqrmat",Aname,rw,rhs,damp, ... atol,btol,conlim,itnlim,show,info ); thisLsqr.input->rhs_vec = &rhs; thisLsqr.input->sol_vec = &dy; thisLsqr.input->rel_mat_err = atol; thisLsqr.do_lsqr(this); */ // New version of lsqr int istop; dy.clear(); show = false; info.atolmin = atolmin; info.r3norm = fmerit; // Must be the 2-norm here. thisLsqr.do_lsqr( rhs, damp, atol, btol, conlim, itnlim, show, info, dy , &istop, &itncg, &outfo, precon, Pr); if (precon) dy = dy * Pr; if (!precon && itncg > 999999) precon = true; if (istop == 3 || istop == 7 ) // conlim or itnlim printf("\n LSQR stopped early: istop = //%d", istop); atolold = outfo.atolold; atol = outfo.atolnew; r3ratio = outfo.r3ratio; }// LSproblem 1 // grad = pdxxxmat( Aname,2,m,n,dy ); // grad = A"dy grad.clear(); matVecMult(2, grad, dy); for (int k = 0; k < nfix; k++) grad[fix[k]] = 0; // grad is a work vector dx = H * (grad - w); } else { perror( "This LSproblem not yet implemented\n" ); } //------------------------------------------------------------------- CGitns += itncg; //------------------------------------------------------------------- // dx and dy are now known. Get dx1, dx2, dz1, dz2. //------------------------------------------------------------------- for (int k = 0; k < nlow; k++) { dx1[low[k]] = - rL[low[k]] + dx[low[k]]; dz1[low[k]] = (cL[low[k]] - z1[low[k]] * dx1[low[k]]) / x1[low[k]]; } for (int k = 0; k < nupp; k++) { dx2[upp[k]] = - rU[upp[k]] - dx[upp[k]]; dz2[upp[k]] = (cU[upp[k]] - z2[upp[k]] * dx2[upp[k]]) / x2[upp[k]]; } //------------------------------------------------------------------- // Find the maximum step. //-------------------------------------------------------------------- double stepx1 = pdxxxstep(nlow, low, x1, dx1 ); double stepx2 = inf; if (nupp > 0) stepx2 = pdxxxstep(nupp, upp, x2, dx2 ); double stepz1 = pdxxxstep( z1 , dz1 ); double stepz2 = inf; if (nupp > 0) stepz2 = pdxxxstep( z2 , dz2 ); double stepx = CoinMin( stepx1, stepx2 ); double stepz = CoinMin( stepz1, stepz2 ); stepx = CoinMin( steptol * stepx, 1.0 ); stepz = CoinMin( steptol * stepz, 1.0 ); if (stepSame) { // For NLPs, force same step stepx = CoinMin( stepx, stepz ); // (true Newton method) stepz = stepx; } //------------------------------------------------------------------- // Backtracking linesearch. //------------------------------------------------------------------- bool fail = true; nf = 0; while (nf < maxf) { nf = nf + 1; x = x + stepx * dx; y = y + stepz * dy; for (int k = 0; k < nlow; k++) { x1[low[k]] = x1[low[k]] + stepx * dx1[low[k]]; z1[low[k]] = z1[low[k]] + stepz * dz1[low[k]]; } for (int k = 0; k < nupp; k++) { x2[upp[k]] = x2[upp[k]] + stepx * dx2[upp[k]]; z2[upp[k]] = z2[upp[k]] + stepz * dz2[upp[k]]; } // [obj,grad,hess] = feval( Fname, (x*beta) ); x.scale(beta); obj = getObj(x); getGrad(x, grad); getHessian(x, H); x.scale((1.0 / beta)); obj /= theta; grad = grad * (beta / theta) + d1 * d1 * x; H = H * (beta2 / theta) + d1 * d1; // [r1,r2,rL,rU,Pinf,Dinf] = ... pdxxxresid1( this, nlow, nupp, nfix, low, upp, fix, b, bl_elts, bu_elts, d1, d2, grad, rL, rU, x, x1, x2, y, z1, z2, r1, r2, &Pinf, &Dinf ); //double center, Cinf, Cinf0; // [cL,cU,center,Cinf,Cinf0] = ... pdxxxresid2( mu, nlow, nupp, low, upp, cL, cU, x1, x2, z1, z2, ¢er, &Cinf, &Cinf0); double fmeritnew = pdxxxmerit(nlow, nupp, low, upp, r1, r2, rL, rU, cL, cU ); double step = CoinMin( stepx, stepz ); if (fmeritnew <= (1 - eta * step)*fmerit) { fail = false; break; } // Merit function didn"t decrease. // Restore variables to previous values. // (This introduces a little error, but save lots of space.) x = x - stepx * dx; y = y - stepz * dy; for (int k = 0; k < nlow; k++) { x1[low[k]] = x1[low[k]] - stepx * dx1[low[k]]; z1[low[k]] = z1[low[k]] - stepz * dz1[low[k]]; } for (int k = 0; k < nupp; k++) { x2[upp[k]] = x2[upp[k]] - stepx * dx2[upp[k]]; z2[upp[k]] = z2[upp[k]] - stepz * dz2[upp[k]]; } // Back-track. // If it"s the first time, // make stepx and stepz the same. if (nf == 1 && stepx != stepz) { stepx = step; } else if (nf < maxf) { stepx = stepx / 2; } stepz = stepx; } if (fail) { printf("\n Linesearch failed (nf too big)"); nfail += 1; } else { nfail = 0; } //------------------------------------------------------------------- // Set convergence measures. //-------------------------------------------------------------------- regx = (d1 * x).twoNorm(); regy = (d2 * y).twoNorm(); regterm = regx * regx + regy * regy; objreg = obj + 0.5 * regterm; objtrue = objreg * theta; bool primalfeas = Pinf <= featol; bool dualfeas = Dinf <= featol; bool complementary = Cinf0 <= opttol; bool enough = PDitns >= 4; // Prevent premature termination. bool converged = primalfeas & dualfeas & complementary & enough; //------------------------------------------------------------------- // Iteration log. //------------------------------------------------------------------- char str1[100], str2[100], str3[100], str4[100], str5[100]; sprintf(str1, "\n%3g%5.1f" , PDitns , log10(mu) ); sprintf(str2, "%8.5f%8.5f" , stepx , stepz ); if (stepx < 0.0001 || stepz < 0.0001) { sprintf(str2, " %6.1e %6.1e" , stepx , stepz ); } sprintf(str3, "%6.1f%6.1f" , log10(Pinf) , log10(Dinf)); sprintf(str4, "%6.1f%15.7e", log10(Cinf0), objtrue ); sprintf(str5, "%3d%8.1f" , nf , center ); if (center > 99999) { sprintf(str5, "%3d%8.1e" , nf , center ); } printf("%s%s%s%s%s", str1, str2, str3, str4, str5); if (direct) { // relax } else { printf(" %5.1f%7d%7.3f", log10(atolold), itncg, r3ratio); } //------------------------------------------------------------------- // Test for termination. //------------------------------------------------------------------- if (kminor) { printf( "\nStart of next minor itn...\n"); // keyboard; } if (converged) { printf("\n Converged"); break; } else if (PDitns >= maxitn) { printf("\n Too many iterations"); inform = 1; break; } else if (nfail >= maxfail) { printf("\n Too many linesearch failures"); inform = 2; break; } else { // Reduce mu, and reset certain residuals. double stepmu = CoinMin( stepx , stepz ); stepmu = CoinMin( stepmu, steptol ); double muold = mu; mu = mu - stepmu * mu; if (center >= bigcenter) mu = muold; // mutrad = mu0*(sum(Xz)/n); // 24 May 1998: Traditional value, but // mu = CoinMin(mu,mutrad ); // it seemed to decrease mu too much. mu = CoinMax(mu, mulast); // 13 Jun 1998: No need for smaller mu. // [cL,cU,center,Cinf,Cinf0] = ... pdxxxresid2( mu, nlow, nupp, low, upp, cL, cU, x1, x2, z1, z2, ¢er, &Cinf, &Cinf0 ); fmerit = pdxxxmerit( nlow, nupp, low, upp, r1, r2, rL, rU, cL, cU ); // Reduce atol for LSQR (and SYMMLQ). // NOW DONE AT TOP OF LOOP. atolold = atol; // if atol > atol2 // atolfac = (mu/mufirst)^0.25; // atol = CoinMax( atol*atolfac, atol2 ); // end // atol = CoinMin( atol, mu ); // 22 Jan 2001: a la Inexact Newton. // atol = CoinMin( atol, 0.5*mu ); // 30 Jan 2001: A bit tighter // If the linesearch took more than one function (nf > 1), // we assume the search direction needed more accuracy // (though this may be true only for LPs). // 12 Jun 1998: Ask for more accuracy if nf > 2. // 24 Nov 2000: Also if the steps are small. // 30 Jan 2001: Small steps might be ok with warm start. // 06 Feb 2001: Not necessarily. Reinstated tests in next line. if (nf > 2 || CoinMin( stepx, stepz ) <= 0.01) atol = atolold * 0.1; } //--------------------------------------------------------------------- // End of main loop. //--------------------------------------------------------------------- } for (int k = 0; k < nfix; k++) x[fix[k]] = bl[fix[k]]; z = z1; if (nupp > 0) z = z - z2; printf("\n\nmax |x| =%10.3f", x.infNorm() ); printf(" max |y| =%10.3f", y.infNorm() ); printf(" max |z| =%10.3f", z.infNorm() ); printf(" scaled"); x.scale(beta); y.scale(zeta); z.scale(zeta); // Unscale x, y, z. printf( "\nmax |x| =%10.3f", x.infNorm() ); printf(" max |y| =%10.3f", y.infNorm() ); printf(" max |z| =%10.3f", z.infNorm() ); printf(" unscaled\n"); time = CoinCpuTime() - time; char str1[100], str2[100]; sprintf(str1, "\nPDitns =%10g", PDitns ); sprintf(str2, "itns =%10d", CGitns ); // printf( [str1 " " solver str2] ); printf(" time =%10.1f\n", time); /* pdxxxdistrib( abs(x),abs(z) ); // Private function if (wait) keyboard; */ //----------------------------------------------------------------------- // End function pdco.m //----------------------------------------------------------------------- /* printf("Solution x values:\n\n"); for (int k=0; k 1; j--) printf(" %g to %g %d\n", thresh[j-1], thresh[j], counts[j]); printf(" Less than %g %d\n", thresh[2], counts[0]); return inform; } // LSQR void ClpPdco::lsqr() { } void ClpPdco::matVecMult( int mode, double* x_elts, double* y_elts) { pdcoStuff_->matVecMult(this, mode, x_elts, y_elts); } void ClpPdco::matVecMult( int mode, CoinDenseVector &x, double *y_elts) { double *x_elts = x.getElements(); matVecMult( mode, x_elts, y_elts); return; } void ClpPdco::matVecMult( int mode, CoinDenseVector &x, CoinDenseVector &y) { double *x_elts = x.getElements(); double *y_elts = y.getElements(); matVecMult( mode, x_elts, y_elts); return; } void ClpPdco::matVecMult( int mode, CoinDenseVector *x, CoinDenseVector *y) { double *x_elts = x->getElements(); double *y_elts = y->getElements(); matVecMult( mode, x_elts, y_elts); return; } void ClpPdco::matPrecon(double delta, double* x_elts, double* y_elts) { pdcoStuff_->matPrecon(this, delta, x_elts, y_elts); } void ClpPdco::matPrecon(double delta, CoinDenseVector &x, double *y_elts) { double *x_elts = x.getElements(); matPrecon(delta, x_elts, y_elts); return; } void ClpPdco::matPrecon(double delta, CoinDenseVector &x, CoinDenseVector &y) { double *x_elts = x.getElements(); double *y_elts = y.getElements(); matPrecon(delta, x_elts, y_elts); return; } void ClpPdco::matPrecon(double delta, CoinDenseVector *x, CoinDenseVector *y) { double *x_elts = x->getElements(); double *y_elts = y->getElements(); matPrecon(delta, x_elts, y_elts); return; } void ClpPdco::getBoundTypes(int *nlow, int *nupp, int *nfix, int **bptrs) { *nlow = numberColumns_; *nupp = *nfix = 0; int *low_ = (int *)malloc(numberColumns_ * sizeof(int)) ; for (int k = 0; k < numberColumns_; k++) low_[k] = k; bptrs[0] = low_; return; } double ClpPdco::getObj(CoinDenseVector &x) { return pdcoStuff_->getObj(this, x); } void ClpPdco::getGrad(CoinDenseVector &x, CoinDenseVector &g) { pdcoStuff_->getGrad(this, x, g); } void ClpPdco::getHessian(CoinDenseVector &x, CoinDenseVector &H) { pdcoStuff_->getHessian(this, x, H); } CoinMP-1.8.3/Clp/src/AbcPrimalColumnDantzig.cpp0000644000175000017500000002312412101105055017646 0ustar renerene/* $Id: AbcPrimalColumnDantzig.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include "CoinIndexedVector.hpp" #include "AbcSimplex.hpp" #include "AbcPrimalColumnDantzig.hpp" #include "AbcSimplexFactorization.hpp" #include "AbcMatrix.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcPrimalColumnDantzig::AbcPrimalColumnDantzig () : AbcPrimalColumnPivot() { type_ = 1; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcPrimalColumnDantzig::AbcPrimalColumnDantzig (const AbcPrimalColumnDantzig & source) : AbcPrimalColumnPivot(source) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcPrimalColumnDantzig::~AbcPrimalColumnDantzig () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcPrimalColumnDantzig & AbcPrimalColumnDantzig::operator=(const AbcPrimalColumnDantzig& rhs) { if (this != &rhs) { AbcPrimalColumnPivot::operator=(rhs); } return *this; } // Returns pivot column, -1 if none int AbcPrimalColumnDantzig::pivotColumn(CoinPartitionedVector * updates, CoinPartitionedVector * /*spareRow2*/, CoinPartitionedVector * spareColumn1) { assert(model_); int iSection, j; int number; double multiplier; int * index; double * updateBy; double * reducedCost; bool anyUpdates; if (updates->getNumElements()) { anyUpdates = true; } else { // sub flip - nothing to do anyUpdates = false; } if (anyUpdates) { model_->factorization()->updateColumnTranspose(*updates); int iVector=model_->getAvailableArray(); int bestSequence= model_->abcMatrix()->pivotColumnDantzig(*updates,*model_->usefulArray(iVector)); model_->setAvailableArray(iVector); int pivotRow = model_->pivotRow(); if (pivotRow >= 0) { // make sure infeasibility on incoming is 0.0 int sequenceIn = model_->sequenceIn(); double * reducedCost = model_->djRegion(); reducedCost[sequenceIn]=0.0; } #if 1 if (model_->logLevel()==127) { double * reducedCost = model_->djRegion(); int numberRows=model_->numberRows(); printf("Best sequence %d\n",bestSequence); for (int i=0;inumberColumns();i++) printf("column %d dj %g\n",i,reducedCost[i+numberRows]); } #endif looksOptimal_=bestSequence<0; return bestSequence; // put row of tableau in rowArray and columnArray model_->abcMatrix()->transposeTimes(*updates, *spareColumn1); for (iSection = 0; iSection < 2; iSection++) { reducedCost = model_->djRegion(iSection); if (!iSection) { number = updates->getNumElements(); index = updates->getIndices(); updateBy = updates->denseVector(); multiplier=-1.0; } else { number = spareColumn1->getNumElements(); index = spareColumn1->getIndices(); updateBy = spareColumn1->denseVector(); multiplier=1.0; } for (j = 0; j < number; j++) { int iSequence = index[j]; double value = reducedCost[iSequence]; value -= multiplier*updateBy[iSequence]; updateBy[iSequence] = 0.0; reducedCost[iSequence] = value; } } updates->setNumElements(0); spareColumn1->setNumElements(0); } // update of duals finished - now do pricing #if 0 double largest = model_->currentPrimalTolerance(); // we can't really trust infeasibilities if there is primal error if (model_->largestDualError() > 1.0e-8) largest *= model_->largestDualError() / 1.0e-8; #endif double bestDj = model_->dualTolerance(); int bestSequence = -1; double bestFreeDj = model_->dualTolerance(); int bestFreeSequence = -1; number = model_->numberTotal(); int iSequence; reducedCost = model_->djRegion(); #ifndef CLP_PRIMAL_SLACK_MULTIPLIER for (iSequence = 0; iSequence < number; iSequence++) { // check flagged variable if (!model_->flagged(iSequence)) { double value = reducedCost[iSequence]; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > bestFreeDj) { bestFreeDj = fabs(value); bestFreeSequence = iSequence; } break; case AbcSimplex::atUpperBound: if (value > bestDj) { bestDj = value; bestSequence = iSequence; } break; case AbcSimplex::atLowerBound: if (value < -bestDj) { bestDj = -value; bestSequence = iSequence; } } } } #else int numberColumns = model_->numberColumns(); int maximumRows=model_->maximumAbcNumberRows(); for (iSequence = maximumRows; iSequence < numberColumns+maximumRows; iSequence++) { // check flagged variable if (!model_->flagged(iSequence)) { double value = reducedCost[iSequence]; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > bestFreeDj) { bestFreeDj = fabs(value); bestFreeSequence = iSequence; } break; case AbcSimplex::atUpperBound: if (value > bestDj) { bestDj = value; bestSequence = iSequence; } break; case AbcSimplex::atLowerBound: if (value < -bestDj) { bestDj = -value; bestSequence = iSequence; } } } } // Rows number=model_->numberRows(); for (iSequence=0 ; iSequence < number; iSequence++) { // check flagged variable if (!model_->flagged(iSequence)) { double value = reducedCost[iSequence] * CLP_PRIMAL_SLACK_MULTIPLIER; AbcSimplex::Status status = model_->getInternalStatus(iSequence); switch(status) { case AbcSimplex::basic: case AbcSimplex::isFixed: break; case AbcSimplex::isFree: case AbcSimplex::superBasic: if (fabs(value) > bestFreeDj) { bestFreeDj = fabs(value); bestFreeSequence = iSequence; } break; case AbcSimplex::atUpperBound: if (value > bestDj) { bestDj = value; bestSequence = iSequence; } break; case AbcSimplex::atLowerBound: if (value < -bestDj) { bestDj = -value; bestSequence = iSequence; } } } } #endif // bias towards free if (bestFreeSequence >= 0 && bestFreeDj > 0.1 * bestDj) bestSequence = bestFreeSequence; #if 1 if (model_->logLevel()==127) { double * reducedCost = model_->djRegion(); int numberRows=model_->numberRows(); printf("Best sequence %d\n",bestSequence); for (int i=0;inumberColumns();i++) printf("column %d dj %g\n",i,reducedCost[i+numberRows]); } #endif looksOptimal_=bestSequence<0; return bestSequence; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- AbcPrimalColumnPivot * AbcPrimalColumnDantzig::clone(bool CopyData) const { if (CopyData) { return new AbcPrimalColumnDantzig(*this); } else { return new AbcPrimalColumnDantzig(); } } CoinMP-1.8.3/Clp/src/CoinAbcBaseFactorization1.cpp0000644000175000017500000046632412452503025020251 0ustar renerene/* $Id: CoinAbcBaseFactorization1.cpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef ABC_JUST_ONE_FACTORIZATION #include "CoinAbcCommonFactorization.hpp" #define CoinAbcTypeFactorization CoinAbcBaseFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #endif #ifdef CoinAbcTypeFactorization #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #include "CoinPackedMatrix.hpp" #include "CoinFinite.hpp" #define _mm256_broadcast_sd(x) static_cast<__m256d> (__builtin_ia32_vbroadcastsd256 (x)) #define _mm256_load_pd(x) *(__m256d *)(x) #define _mm256_store_pd (s, x) *((__m256d *)s)=x //:class CoinAbcTypeFactorization. Deals with Factorization and Updates // CoinAbcTypeFactorization. Constructor CoinAbcTypeFactorization::CoinAbcTypeFactorization ( ) : CoinAbcAnyFactorization() { gutsOfInitialize(7); } /// Copy constructor CoinAbcTypeFactorization::CoinAbcTypeFactorization ( const CoinAbcTypeFactorization &other) : CoinAbcAnyFactorization(other) { gutsOfInitialize(3); gutsOfCopy(other); } /// Clone CoinAbcAnyFactorization * CoinAbcTypeFactorization::clone() const { return new CoinAbcTypeFactorization(*this); } /// Copy constructor CoinAbcTypeFactorization::CoinAbcTypeFactorization ( const CoinFactorization & /*other*/) : CoinAbcAnyFactorization() { gutsOfInitialize(3); //gutsOfCopy(other); abort(); } /// The real work of constructors etc void CoinAbcTypeFactorization::gutsOfDestructor(CoinSimplexInt ) { numberCompressions_ = 0; numberRows_ = 0; numberRowsExtra_ = 0; maximumRowsExtra_ = 0; numberGoodU_ = 0; numberGoodL_ = 0; totalElements_ = 0; factorElements_ = 0; status_ = -1; numberSlacks_ = 0; lastSlack_ = 0; numberU_ = 0; maximumU_=0; lengthU_ = 0; lastEntryByColumnU_=0; lastEntryByRowU_=0; lengthAreaU_ = 0; numberL_ = 0; baseL_ = 0; lengthL_ = 0; lengthAreaL_ = 0; numberR_ = 0; lengthR_ = 0; lengthAreaR_ = 0; #if ABC_SMALL<4 numberDense_=0; #endif } #if FACTORIZATION_STATISTICS extern double denseThresholdX; #endif // type - 1 bit tolerances etc, 2 rest void CoinAbcTypeFactorization::gutsOfInitialize(CoinSimplexInt type) { if ((type&2)!=0) { numberCompressions_ = 0; numberRows_ = 0; numberRowsExtra_ = 0; maximumRowsExtra_ = 0; numberGoodU_ = 0; numberGoodL_ = 0; totalElements_ = 0; factorElements_ = 0; status_ = -1; numberPivots_ = 0; numberSlacks_ = 0; lastSlack_ = 0; numberU_ = 0; maximumU_=0; lengthU_ = 0; lastEntryByColumnU_=0; lastEntryByRowU_=0; lengthAreaU_ = 0; #ifdef ABC_USE_FUNCTION_POINTERS lengthAreaUPlus_ = 0; #endif numberL_ = 0; baseL_ = 0; lengthL_ = 0; lengthAreaL_ = 0; numberR_ = 0; lengthR_ = 0; lengthAreaR_ = 0; elementRAddress_ = NULL; indexRowRAddress_ = NULL; #if ABC_SMALL<2 // always switch off sparse sparseThreshold_=0; #endif state_= 0; // Maximum rows (ever) maximumRows_=0; // Rows first time nonzero initialNumberRows_=0; // Maximum maximum pivots maximumMaximumPivots_=0; #if ABC_SMALL<4 numberDense_=0; #endif } // after 2 if ((type&1)!=0) { areaFactor_ = 0.0; pivotTolerance_ = 1.0e-1; numberDense_=0; #ifndef USE_FIXED_ZERO_TOLERANCE zeroTolerance_ = 1.0e-13; #else zeroTolerance_ = pow(0.5,43); #endif messageLevel_=0; maximumPivots_=200; maximumMaximumPivots_=200; numberTrials_ = 4; relaxCheck_=1.0; #if ABC_SMALL<4 #if ABC_DENSE_CODE>0 //denseThreshold_=4;//16; //31; denseThreshold_=71; #else denseThreshold_=-16; #endif #if FACTORIZATION_STATISTICS denseThreshold_=denseThresholdX; #endif //denseThreshold_=0; // temp (? ABC_PARALLEL) #endif } #if ABC_SMALL<4 //denseThreshold_=10000; #endif if ((type&4)!=0) { #if COIN_BIG_DOUBLE==1 for (int i=0;i1 convertColumnToRowU_.switchOn(); #endif #endif #if ABC_SMALL<2 elementRowU_.switchOn(); #endif elementL_.switchOn(); indexRowL_.switchOn(); startColumnL_.switchOn(); #if ABC_SMALL<4 denseArea_.switchOn(7); #endif workArea_.switchOn(); workArea2_.switchOn(); #if ABC_SMALL<2 startRowL_.switchOn(); indexColumnL_.switchOn(); elementByRowL_.switchOn(); sparse_.switchOn(); // Below are all to collect ftranCountInput_=0.0; ftranCountAfterL_=0.0; ftranCountAfterR_=0.0; ftranCountAfterU_=0.0; ftranFTCountInput_=0.0; ftranFTCountAfterL_=0.0; ftranFTCountAfterR_=0.0; ftranFTCountAfterU_=0.0; btranCountInput_=0.0; btranCountAfterU_=0.0; btranCountAfterR_=0.0; btranCountAfterL_=0.0; ftranFullCountInput_=0.0; ftranFullCountAfterL_=0.0; ftranFullCountAfterR_=0.0; ftranFullCountAfterU_=0.0; btranFullCountInput_=0.0; btranFullCountAfterL_=0.0; btranFullCountAfterR_=0.0; btranFullCountAfterU_=0.0; #if FACTORIZATION_STATISTICS ftranTwiddleFactor1_=1.0; ftranFTTwiddleFactor1_=1.0; btranTwiddleFactor1_=1.0; ftranFullTwiddleFactor1_=1.0; btranFullTwiddleFactor1_=1.0; ftranTwiddleFactor2_=1.0; ftranFTTwiddleFactor2_=1.0; btranTwiddleFactor2_=1.0; ftranFullTwiddleFactor2_=1.0; btranFullTwiddleFactor2_=1.0; #endif // We can roll over factorizations numberFtranCounts_=0; numberFtranFTCounts_=0; numberBtranCounts_=0; numberFtranFullCounts_=0; numberFtranFullCounts_=0; // While these are averages collected over last ftranAverageAfterL_=INITIAL_AVERAGE; ftranAverageAfterR_=INITIAL_AVERAGE; ftranAverageAfterU_=INITIAL_AVERAGE; ftranFTAverageAfterL_=INITIAL_AVERAGE; ftranFTAverageAfterR_=INITIAL_AVERAGE; ftranFTAverageAfterU_=INITIAL_AVERAGE; btranAverageAfterU_=INITIAL_AVERAGE; btranAverageAfterR_=INITIAL_AVERAGE; btranAverageAfterL_=INITIAL_AVERAGE; ftranFullAverageAfterL_=INITIAL_AVERAGE; ftranFullAverageAfterR_=INITIAL_AVERAGE; ftranFullAverageAfterU_=INITIAL_AVERAGE; btranFullAverageAfterL_=INITIAL_AVERAGE; btranFullAverageAfterR_=INITIAL_AVERAGE; btranFullAverageAfterU_=INITIAL_AVERAGE; #endif } } // ~CoinAbcTypeFactorization. Destructor CoinAbcTypeFactorization::~CoinAbcTypeFactorization ( ) { gutsOfDestructor(); } // = CoinAbcTypeFactorization & CoinAbcTypeFactorization::operator = ( const CoinAbcTypeFactorization & other ) { if (this != &other) { gutsOfDestructor(); CoinAbcAnyFactorization::operator=(other); gutsOfInitialize(3); gutsOfCopy(other); } return *this; } void CoinAbcTypeFactorization::gutsOfCopy(const CoinAbcTypeFactorization &other) { #ifdef ABC_USE_FUNCTION_POINTERS elementU_.allocate(other.elementU_, other.lengthAreaUPlus_ *CoinSizeofAsInt(CoinFactorizationDouble)); #else elementU_.allocate(other.elementU_, other.lengthAreaU_ *CoinSizeofAsInt(CoinFactorizationDouble)); #endif indexRowU_.allocate(other.indexRowU_, (other.lengthAreaU_+1)*CoinSizeofAsInt(CoinSimplexInt) ); elementL_.allocate(other.elementL_, other.lengthAreaL_*CoinSizeofAsInt(CoinFactorizationDouble) ); indexRowL_.allocate(other.indexRowL_, other.lengthAreaL_*CoinSizeofAsInt(CoinSimplexInt) ); startColumnL_.allocate(other.startColumnL_,(other.numberRows_ + 1)*CoinSizeofAsInt(CoinBigIndex) ); pivotRegion_.allocate(other.pivotRegion_, (other.numberRows_+2 )*CoinSizeofAsInt(CoinFactorizationDouble)); #ifndef ABC_ORDERED_FACTORIZATION permute_.allocate(other.permute_,(other.maximumRowsExtra_ + 1)*CoinSizeofAsInt(CoinSimplexInt)); #else //temp permute_.allocate(other.permute_,(other.maximumRowsExtra_+2*numberRows_ + 1)*CoinSizeofAsInt(CoinSimplexInt)); #endif firstCount_.allocate(other.firstCount_, ( CoinMax(5*numberRows_,4*numberRows_+2*maximumPivots_+4)+2) *CoinSizeofAsInt(CoinSimplexInt)); nextCountAddress_=nextCount(); lastCountAddress_=lastCount(); startColumnU_.allocate(other.startColumnU_, (other.numberRows_ + 1 )*CoinSizeofAsInt(CoinBigIndex)); numberInColumn_.allocate(other.numberInColumn_, (other.numberRows_ + 1 )*CoinSizeofAsInt(CoinSimplexInt)); #if COIN_BIG_DOUBLE==1 for (int i=0;i1 convertColumnToRowU_.allocate(other.convertColumnToRowU_, other.lengthAreaU_*CoinSizeofAsInt(CoinBigIndex) ); #if CONVERTROW>2 const CoinBigIndex * convertUOther2 = other.convertColumnToRowUAddress_; #endif #endif #endif #if ABC_SMALL<2 const CoinFactorizationDouble * elementRowUOther = other.elementRowUAddress_; #if COIN_ONE_ETA_COPY if (elementRowUOther) { #endif #ifdef ABC_USE_FUNCTION_POINTERS elementRowU_.allocate(other.elementRowU_, other.lengthAreaUPlus_*CoinSizeofAsInt(CoinFactorizationDouble) ); #else elementRowU_.allocate(other.elementRowU_, other.lengthAreaU_*CoinSizeofAsInt(CoinFactorizationDouble) ); #endif startRowU_.allocate(other.startRowU_,(other.numberRows_ + 1)*CoinSizeofAsInt(CoinBigIndex)); numberInRow_.allocate(other.numberInRow_, (other.numberRows_ + 1 )*CoinSizeofAsInt(CoinSimplexInt)); #if COIN_ONE_ETA_COPY } #endif if (other.sparseThreshold_) { elementByRowL_.allocate(other.elementByRowL_, other.lengthAreaL_ ); indexColumnL_.allocate(other.indexColumnL_, other.lengthAreaL_ ); startRowL_.allocate(other.startRowL_,other.numberRows_+1); } #endif numberTrials_ = other.numberTrials_; relaxCheck_ = other.relaxCheck_; numberSlacks_ = other.numberSlacks_; lastSlack_ = other.lastSlack_; numberU_ = other.numberU_; maximumU_=other.maximumU_; lengthU_ = other.lengthU_; lastEntryByColumnU_=other.lastEntryByColumnU_; lastEntryByRowU_=other.lastEntryByRowU_; lengthAreaU_ = other.lengthAreaU_; #ifdef ABC_USE_FUNCTION_POINTERS lengthAreaUPlus_ = other.lengthAreaUPlus_; #endif numberL_ = other.numberL_; baseL_ = other.baseL_; lengthL_ = other.lengthL_; lengthAreaL_ = other.lengthAreaL_; numberR_ = other.numberR_; lengthR_ = other.lengthR_; lengthAreaR_ = other.lengthAreaR_; pivotTolerance_ = other.pivotTolerance_; zeroTolerance_ = other.zeroTolerance_; areaFactor_ = other.areaFactor_; numberRows_ = other.numberRows_; numberRowsExtra_ = other.numberRowsExtra_; maximumRowsExtra_ = other.maximumRowsExtra_; maximumPivots_=other.maximumPivots_; numberGoodU_ = other.numberGoodU_; numberGoodL_ = other.numberGoodL_; numberPivots_ = other.numberPivots_; messageLevel_ = other.messageLevel_; totalElements_ = other.totalElements_; factorElements_ = other.factorElements_; status_ = other.status_; #if ABC_SMALL<2 //doForrestTomlin_ = other.doForrestTomlin_; ftranCountInput_=other.ftranCountInput_; ftranCountAfterL_=other.ftranCountAfterL_; ftranCountAfterR_=other.ftranCountAfterR_; ftranCountAfterU_=other.ftranCountAfterU_; ftranFTCountInput_=other.ftranFTCountInput_; ftranFTCountAfterL_=other.ftranFTCountAfterL_; ftranFTCountAfterR_=other.ftranFTCountAfterR_; ftranFTCountAfterU_=other.ftranFTCountAfterU_; btranCountInput_=other.btranCountInput_; btranCountAfterU_=other.btranCountAfterU_; btranCountAfterR_=other.btranCountAfterR_; btranCountAfterL_=other.btranCountAfterL_; ftranFullCountInput_=other.ftranFullCountInput_; ftranFullCountAfterL_=other.ftranFullCountAfterL_; ftranFullCountAfterR_=other.ftranFullCountAfterR_; ftranFullCountAfterU_=other.ftranFullCountAfterU_; btranFullCountInput_=other.btranFullCountInput_; btranFullCountAfterL_=other.btranFullCountAfterL_; btranFullCountAfterR_=other.btranFullCountAfterR_; btranFullCountAfterU_=other.btranFullCountAfterU_; numberFtranCounts_=other.numberFtranCounts_; numberFtranFTCounts_=other.numberFtranFTCounts_; numberBtranCounts_=other.numberBtranCounts_; numberFtranFullCounts_=other.numberFtranFullCounts_; numberFtranFullCounts_=other.numberFtranFullCounts_; ftranAverageAfterL_=other.ftranAverageAfterL_; ftranAverageAfterR_=other.ftranAverageAfterR_; ftranAverageAfterU_=other.ftranAverageAfterU_; ftranFTAverageAfterL_=other.ftranFTAverageAfterL_; ftranFTAverageAfterR_=other.ftranFTAverageAfterR_; ftranFTAverageAfterU_=other.ftranFTAverageAfterU_; btranAverageAfterU_=other.btranAverageAfterU_; btranAverageAfterR_=other.btranAverageAfterR_; btranAverageAfterL_=other.btranAverageAfterL_; ftranFullAverageAfterL_=other.ftranFullAverageAfterL_; ftranFullAverageAfterR_=other.ftranFullAverageAfterR_; ftranFullAverageAfterU_=other.ftranFullAverageAfterU_; btranFullAverageAfterL_=other.btranFullAverageAfterL_; btranFullAverageAfterR_=other.btranFullAverageAfterR_; btranFullAverageAfterU_=other.btranFullAverageAfterU_; #if FACTORIZATION_STATISTICS ftranTwiddleFactor1_=other.ftranTwiddleFactor1_; ftranFTTwiddleFactor1_=other.ftranFTTwiddleFactor1_; btranTwiddleFactor1_=other.btranTwiddleFactor1_; ftranFullTwiddleFactor1_=other.ftranFullTwiddleFactor1_; btranFullTwiddleFactor1_=other.btranFullTwiddleFactor1_; ftranTwiddleFactor2_=other.ftranTwiddleFactor2_; ftranFTTwiddleFactor2_=other.ftranFTTwiddleFactor2_; btranTwiddleFactor2_=other.btranTwiddleFactor2_; ftranFullTwiddleFactor2_=other.ftranFullTwiddleFactor2_; btranFullTwiddleFactor2_=other.btranFullTwiddleFactor2_; #endif sparseThreshold_=other.sparseThreshold_; #endif state_=other.state_; // Maximum rows (ever) maximumRows_=other.maximumRows_; // Rows first time nonzero initialNumberRows_=other.initialNumberRows_; // Maximum maximum pivots maximumMaximumPivots_=other.maximumMaximumPivots_; CoinBigIndex space = lengthAreaL_ - lengthL_; #if ABC_SMALL<4 numberDense_ = other.numberDense_; denseThreshold_=other.denseThreshold_; #endif lengthAreaR_ = space; elementRAddress_ = elementL_.array() + lengthL_; indexRowRAddress_ = indexRowL_.array() + lengthL_; workArea_ = other.workArea_; workArea2_ = other.workArea2_; //now copy everything //assuming numberRowsExtra==numberColumnsExtra if (numberRowsExtra_) { if (startRowU_.array()) { CoinAbcMemcpy( startRowU_.array() , other.startRowU_.array(), numberRows_ + 1); CoinAbcMemcpy( numberInRow_.array() , other.numberInRow_.array(), numberRows_ + 1); //startRowU_.array()[maximumRowsExtra_] = other.startRowU_.array()[maximumRowsExtra_]; } CoinAbcMemcpy( pivotRegion_.array() , other.pivotRegion_.array(), numberRows_+2 ); #ifndef ABC_ORDERED_FACTORIZATION CoinAbcMemcpy( permute_.array() , other.permute_.array(), numberRowsExtra_ + 1); #else //temp CoinAbcMemcpy( permute_.array() , other.permute_.array(), maximumRowsExtra_+2*numberRows_ + 1); #endif CoinAbcMemcpy( firstCount_.array() , other.firstCount_.array(),CoinMax(5*numberRows_,4*numberRows_+2*maximumPivots_+4)+2); CoinAbcMemcpy( startColumnU_.array() , other.startColumnU_.array(), numberRows_ + 1); CoinAbcMemcpy( numberInColumn_.array() , other.numberInColumn_.array(), numberRows_ + 1); CoinAbcMemcpy( pivotColumn_.array() , other.pivotColumn_.array(), numberRowsExtra_ + 1); CoinAbcMemcpy( nextColumn_.array() , other.nextColumn_.array(), numberRowsExtra_ + 1); CoinAbcMemcpy( lastColumn_.array() , other.lastColumn_.array(), numberRowsExtra_ + 1); CoinAbcMemcpy (startColumnR() , other.startColumnR() , numberRowsExtra_ - numberRows_ + 1); //extra one at end //startColumnU_.array()[maximumRowsExtra_] = //other.startColumnU_.array()[maximumRowsExtra_]; nextColumn_.array()[maximumRowsExtra_] = other.nextColumn_.array()[maximumRowsExtra_]; lastColumn_.array()[maximumRowsExtra_] = other.lastColumn_.array()[maximumRowsExtra_]; CoinAbcMemcpy( nextRow_.array() , other.nextRow_.array(), numberRows_ + 1); CoinAbcMemcpy( lastRow_.array() , other.lastRow_.array(), numberRows_ + 1); nextRow_.array()[numberRows_] = other.nextRow_.array()[numberRows_]; lastRow_.array()[numberRows_] = other.lastRow_.array()[numberRows_]; } CoinAbcMemcpy( elementRAddress_ , other.elementRAddress_, lengthR_); CoinAbcMemcpy( indexRowRAddress_ , other.indexRowRAddress_, lengthR_); //row and column copies of U /* as elements of U may have been zeroed but column counts zero copy all elements */ const CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumn_.array(); #ifndef NDEBUG CoinSimplexInt maxU=0; for (CoinSimplexInt iRow = 0; iRow < numberRows_; iRow++ ) { CoinBigIndex start = startColumnU[iRow]; CoinSimplexInt numberIn = numberInColumn[iRow]; maxU = CoinMax(maxU,start+numberIn); } //assert (maximumU_>=maxU); #endif CoinAbcMemcpy( elementU_.array() , other.elementU_.array() , maximumU_); #if ABC_SMALL<2 #if COIN_ONE_ETA_COPY if (elementRowUOther) { #endif const CoinSimplexInt * COIN_RESTRICT indexColumnUOther = other.indexColumnU_.array(); #if CONVERTROW CoinBigIndex * COIN_RESTRICT convertU = convertRowToColumnU_.array(); #if CONVERTROW>2 CoinBigIndex * COIN_RESTRICT convertU2 = convertColumnToRowU_.array(); #endif #endif CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowU_.array(); CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnU_.array(); const CoinBigIndex * COIN_RESTRICT startRowU = startRowU_.array(); const CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRow_.array(); for (CoinSimplexInt iRow = 0; iRow < numberRows_; iRow++ ) { //row CoinBigIndex start = startRowU[iRow]; CoinSimplexInt numberIn = numberInRow[iRow]; CoinAbcMemcpy( indexColumnU + start , indexColumnUOther + start, numberIn); #if CONVERTROW CoinAbcMemcpy( convertU + start ,convertUOther + start , numberIn); #if CONVERTROW>2 CoinAbcMemcpy( convertU2 + start ,convertUOther2 + start , numberIn); #endif #endif CoinAbcMemcpy( elementRowU + start ,elementRowUOther + start , numberIn); } #if COIN_ONE_ETA_COPY } #endif #endif const CoinSimplexInt * COIN_RESTRICT indexRowUOther = other.indexRowU_.array(); CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowU_.array(); for (CoinSimplexInt iRow = 0; iRow < numberRows_; iRow++ ) { //column CoinBigIndex start = startColumnU[iRow]; CoinSimplexInt numberIn = numberInColumn[iRow]; if (numberIn>0) CoinAbcMemcpy( indexRowU + start , indexRowUOther + start, numberIn); } // L is contiguous if (numberRows_) CoinAbcMemcpy( startColumnL_.array() , other.startColumnL_.array(), numberRows_ + 1); CoinAbcMemcpy( elementL_.array() , other.elementL_.array(), lengthL_); CoinAbcMemcpy( indexRowL_.array() , other.indexRowL_.array(), lengthL_); #if ABC_SMALL<2 if (other.sparseThreshold_) { goSparse(); } #endif doAddresses(); } // getAreas. Gets space for a factorization //called by constructors void CoinAbcTypeFactorization::getAreas ( CoinSimplexInt numberOfRows, CoinSimplexInt /*numberOfColumns*/, CoinBigIndex maximumL, CoinBigIndex maximumU ) { gutsOfInitialize(2); numberRows_ = numberOfRows; numberRowsSmall_ = numberOfRows; maximumRows_ = CoinMax(maximumRows_,numberRows_); maximumRowsExtra_ = numberRows_ + maximumPivots_; numberRowsExtra_ = numberRows_; lengthAreaU_ = maximumU; lengthAreaL_ = maximumL; if ( !areaFactor_ ) { areaFactor_ = 1.0; } if ( areaFactor_ != 1.0 ) { if ((messageLevel_&16)!=0) printf("Increasing factorization areas by %g\n",areaFactor_); lengthAreaU_ = static_cast (areaFactor_*lengthAreaU_); lengthAreaL_ = static_cast (areaFactor_*lengthAreaL_); } #ifdef ABC_USE_FUNCTION_POINTERS lengthAreaUPlus_ = (lengthAreaU_*3)/2+maximumRowsExtra_ ; elementU_.conditionalNew( lengthAreaUPlus_ ); #else elementU_.conditionalNew( lengthAreaU_ ); #endif indexRowU_.conditionalNew( lengthAreaU_+1 ); indexColumnU_.conditionalNew( lengthAreaU_+1 ); elementL_.conditionalNew( lengthAreaL_ ); indexRowL_.conditionalNew( lengthAreaL_ ); // But we can use all we have if bigger CoinBigIndex length; length = CoinMin(elementU_.getSize(),indexRowU_.getSize()); if (length>lengthAreaU_) { lengthAreaU_=length; assert (indexColumnU_.getSize()==indexRowU_.getSize()); } length = CoinMin(elementL_.getSize(),indexRowL_.getSize()); if (length>lengthAreaL_) { lengthAreaL_=length; } startColumnL_.conditionalNew( numberRows_ + 1 ); startColumnL_.array()[0] = 0; startRowU_.conditionalNew( maximumRowsExtra_ + 1); // make sure this is valid (Needed for row links????) startRowU_.array()[maximumRowsExtra_]=0; lastEntryByRowU_ = 0; numberInRow_.conditionalNew( maximumRowsExtra_ + 1 ); markRow_.conditionalNew( numberRows_ ); nextRow_.conditionalNew( maximumRowsExtra_ + 1 ); lastRow_.conditionalNew( maximumRowsExtra_ + 1 ); #ifndef ABC_ORDERED_FACTORIZATION permute_.conditionalNew( maximumRowsExtra_ + 1 ); #else //temp permute_.conditionalNew( maximumRowsExtra_+2*numberRows_ + 1 ); #endif permuteAddress_ = permute_.array(); pivotRegion_.conditionalNew( maximumRows_ + 2 ); startColumnU_.conditionalNew( maximumRowsExtra_ + 1 ); numberInColumn_.conditionalNew( maximumRowsExtra_ + 1 ); numberInColumnPlus_.conditionalNew( maximumRowsExtra_ + 1 ); #ifdef ABC_USE_FUNCTION_POINTERS scatterUColumn_.conditionalNew(sizeof(scatterStruct), maximumRowsExtra_ + 1); elementRowU_.conditionalNew( lengthAreaUPlus_ ); elementRowUAddress_=elementRowU_.array(); firstZeroed_=0; #elif ABC_SMALL<2 elementRowU_.conditionalNew( lengthAreaU_ ); elementRowUAddress_=elementRowU_.array(); #endif #if COIN_BIG_DOUBLE==1 for (int i=0;i1 convertColumnToRowU_.conditionalNew( lengthAreaU_ ); convertColumnToRowUAddress_=convertColumnToRowU_.array(); #endif #endif #ifdef SMALL_PERMUTE assert (sizeof(CoinFactorizationDouble)>=2*sizeof(int)); denseArea_.conditionalNew(numberRows_+maximumRowsExtra_+2); fromSmallToBigRow_=reinterpret_cast(denseArea_.array()); fromSmallToBigColumn_=fromSmallToBigRow_+numberRows_; #endif doAddresses(); #if ABC_SMALL<2 // temp - use as marker for valid row/column lookup sparseThreshold_=0; #endif } #include "AbcSimplex.hpp" #include "ClpMessage.hpp" //Does most of factorization CoinSimplexInt CoinAbcTypeFactorization::factor (AbcSimplex * model) { #if ABC_DENSE_CODE int saveDense = denseThreshold_; if ((solveMode_&1)==0) denseThreshold_=0; #endif //sparse status_ = factorSparse ( ); switch ( status_ ) { case 0: //finished totalElements_ = 0; if ( numberGoodU_ < numberRows_ ) status_ = -1; break; #if ABC_DENSE_CODE #if ABC_SMALL<4 // dense case 2: status_=factorDense(); if(!status_) break; #endif #endif default: //singular ? or some error if ((messageLevel_&4)!=0) std::cout << "Error " << status_ << std::endl; if (status_==-99) { if (numberRows_-numberGoodU_<1000) { areaFactor_ *= 1.5; } else { double denseArea=(numberRows_-numberGoodU_)*(numberRows_-numberGoodU_); if (denseArea>1.5*lengthAreaU_) { areaFactor_ *= CoinMin(2.5,denseArea/1.5); } else { areaFactor_ *= 1.5; } } if (model->logLevel()>1) { char line[100]; sprintf(line,"need more memory lengthArea %d number %d done %d areaFactor %g", lengthAreaL_+lengthAreaU_,lengthU_+lengthL_,numberGoodU_,areaFactor_); model->messageHandler()->message(CLP_GENERAL2,*model->messagesPointer()) << line << CoinMessageEol; } } else if (status_==-97) { // just pivot tolerance issue status_=-99; char line[100]; sprintf(line,"Bad pivot values - increasing pivot tolerance to %g", pivotTolerance_); model->messageHandler()->message(CLP_GENERAL2,*model->messagesPointer()) << line << CoinMessageEol; } break; } /* endswitch */ //clean up if ( !status_ ) { if ( (messageLevel_ & 16)&&numberCompressions_) std::cout<<" Factorization did "< 10 ) { // but not more than 5 times final if (lengthAreaL_+lengthAreaU_<10*(lengthU_+lengthL_)) { areaFactor_ *= 1.1; if (model->logLevel()>1) { char line[100]; sprintf(line,"%d factorization compressions, lengthArea %d number %d new areaFactor %g", numberCompressions_,lengthAreaL_+lengthAreaU_,lengthU_+lengthL_,areaFactor_); model->messageHandler()->message(CLP_GENERAL2,*model->messagesPointer()) << line << CoinMessageEol; } } } numberCompressions_=0; cleanup ( ); } numberPivots_=0; #if ABC_DENSE_CODE denseThreshold_=saveDense; #endif return status_; } #define ALWAYS_GIVE_UP 0 //1 #ifdef ABC_USE_FUNCTION_POINTERS #define DENSE_TRY #ifdef DENSE_TRY static void pivotStartup(int first, int last, int numberInPivotColumn, int lengthArea,int giveUp, CoinFactorizationDouble * COIN_RESTRICT eArea,const int * COIN_RESTRICT saveColumn, const int * COIN_RESTRICT startColumnU,int * COIN_RESTRICT tempColumnCount, const CoinFactorizationDouble * COIN_RESTRICT elementU, const int * COIN_RESTRICT numberInColumn, const int * COIN_RESTRICT indexRowU) { if (last-first>giveUp && !ALWAYS_GIVE_UP) { int mid=(last+first)>>1; cilk_spawn pivotStartup(first,mid,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU); pivotStartup(mid,last,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU); cilk_sync; } else { CoinFactorizationDouble * COIN_RESTRICT area =eArea+first*lengthArea; for (int jColumn = first; jColumn < last; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; CoinBigIndex startColumn = startColumnU[iColumn]; int numberNow=tempColumnCount[jColumn]; int start=startColumn+numberNow; int end=startColumn+numberInColumn[iColumn]; CoinFactorizationDouble thisPivotValue = elementU[startColumn-1]; for (CoinBigIndex j=start;jgiveUp && !ALWAYS_GIVE_UP) { int mid=(last+first)>>1; cilk_spawn pivotWhile(first,mid,numberInPivotColumn,lengthArea,giveUp, eArea,multipliersL); pivotWhile(mid,last,numberInPivotColumn,lengthArea,giveUp, eArea,multipliersL); cilk_sync; } else { CoinFactorizationDouble * COIN_RESTRICT area =eArea+first*lengthArea; int nDo=last-first; #if AVX2==0 for (int jColumn = 0; jColumn < nDo; jColumn++ ) { CoinFactorizationDouble thisPivotValue = area[numberInPivotColumn]; area[numberInPivotColumn]=0.0; for (CoinSimplexInt j = 0; j < numberInPivotColumn; j++ ) { area[j] -= thisPivotValue * multipliersL[j]; } area+=lengthArea; } #else int n=(numberInPivotColumn+3)&(~3); // for compiler error CoinFactorizationDouble * multipliers = const_cast(multipliersL); for (int jColumn = 0; jColumn < nDo; jColumn++ ) { //CoinFactorizationDouble thisPivotValue = area[numberInPivotColumn]; __m256d pivot = _mm256_broadcast_sd(area+numberInPivotColumn); area[numberInPivotColumn]=0.0; for (CoinSimplexInt j = 0; j < n; j+=4 ) { __m256d a=_mm256_load_pd(area+j); __m256d m=_mm256_load_pd(multipliers+j); a -= pivot*m; *reinterpret_cast<__m256d *>(area+j)=a; //_mm256_store_pd ((area+j), a); //area[j] -= thisPivotValue * multipliersL[j]; //area[j+1] -= thisPivotValue * multipliersL[j+1]; //area[j+2] -= thisPivotValue * multipliersL[j+2]; //area[j+3] -= thisPivotValue * multipliersL[j+3]; } area+=lengthArea; } #endif } } static void pivotSomeAfter(int first, int last, int numberInPivotColumn,int lengthArea,int giveUp, CoinFactorizationDouble * COIN_RESTRICT eArea,const int * COIN_RESTRICT saveColumn, const int * COIN_RESTRICT startColumnU,int * COIN_RESTRICT tempColumnCount, CoinFactorizationDouble * COIN_RESTRICT elementU, int * COIN_RESTRICT numberInColumn, int * COIN_RESTRICT indexRowU, unsigned int * aBits, const int * COIN_RESTRICT indexL, const CoinFactorizationDouble * COIN_RESTRICT multipliersL, double tolerance) { if (last-first>giveUp && !ALWAYS_GIVE_UP) { int mid=(last+first)>>1; cilk_spawn pivotSomeAfter(first,mid,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU,aBits,indexL, multipliersL,tolerance); pivotSomeAfter(mid,last,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU,aBits,indexL, multipliersL,tolerance); cilk_sync; } else { int intsPerColumn = (lengthArea+31)>>5; CoinFactorizationDouble * COIN_RESTRICT area =eArea+first*lengthArea; for (int jColumn = first; jColumn < last; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; CoinBigIndex startColumn = startColumnU[iColumn]; int numberNow=tempColumnCount[jColumn]; CoinFactorizationDouble thisPivotValue = area[numberInPivotColumn]; area[numberInPivotColumn]=0.0; int n=0; int positionLargest=-1; double largest=numberNow ? fabs(elementU[startColumn]) : 0.0; unsigned int * aBitsThis = aBits+jColumn*intsPerColumn; #if AVX2==0 for (CoinSimplexInt j = 0; j < numberInPivotColumn; j++ ) { CoinFactorizationDouble value = area[j] - thisPivotValue * multipliersL[j]; CoinSimplexDouble absValue = fabs ( value ); area[j]=0.0; if ( absValue > tolerance ) { area[n] = value; if (absValue>largest) { largest=absValue; positionLargest=n; } n++; } else { // say zero int word = j>>5; int unsetBit=j-(word<<5); aBitsThis[word]&= ~(1<(multipliersL); int nDo=(numberInPivotColumn+3)&(~3); //double temp[4] __attribute__ ((aligned (32))); __m256d pivot = _mm256_broadcast_sd(&thisPivotValue); for (CoinSimplexInt j = 0; j < nDo; j+=4 ) { __m256d a=_mm256_load_pd(area+j); __m256d m=_mm256_load_pd(multipliers+j); a -= pivot*m; *reinterpret_cast<__m256d *>(area+j)=a; //_mm256_store_pd ((area+j), a); } for (CoinSimplexInt j = 0; j < numberInPivotColumn; j++ ) { CoinFactorizationDouble value = area[j]; CoinSimplexDouble absValue = fabs ( value ); area[j]=0.0; if ( absValue > tolerance ) { area[n] = value; if (absValue>largest) { largest=absValue; positionLargest=n; } n++; } else { // say zero int word = j>>5; int unsetBit=j-(word<<5); aBitsThis[word]&= ~(1<=0) positionLargest+=put+numberNow; put+=numberNow; int iA=0; for (int jj=0;jj>1; } } int numberNeeded=put-startColumn; if (positionLargest>=0) { //swap first and largest CoinBigIndex start=startColumn; int firstIndex=indexRowU[start]; CoinFactorizationDouble firstValue=elementU[start]; indexRowU[start]=indexRowU[positionLargest]; elementU[start]=elementU[positionLargest]; indexRowU[positionLargest]=firstIndex; elementU[positionLargest]=firstValue; } tempColumnCount[jColumn]=numberNeeded-numberInColumn[iColumn]; assert (numberNeeded>=0); numberInColumn[iColumn]=numberNeeded; area += lengthArea; } } } #endif static void pivotSome(int first, int last, int numberInPivotColumn,int lengthArea,int giveUp, CoinFactorizationDouble * COIN_RESTRICT eArea,const int * COIN_RESTRICT saveColumn, const int * COIN_RESTRICT startColumnU,int * COIN_RESTRICT tempColumnCount, CoinFactorizationDouble * COIN_RESTRICT elementU, int * COIN_RESTRICT numberInColumn, int * COIN_RESTRICT indexRowU, unsigned int * aBits, const int * COIN_RESTRICT indexL, const CoinFactorizationDouble * COIN_RESTRICT multipliersL, double tolerance) { if (last-first>giveUp && !ALWAYS_GIVE_UP) { int mid=(last+first)>>1; cilk_spawn pivotSome(first,mid,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU,aBits,indexL, multipliersL,tolerance); pivotSome(mid,last,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU,aBits,indexL, multipliersL,tolerance); cilk_sync; } else { int intsPerColumn = (lengthArea+31)>>5; CoinFactorizationDouble * COIN_RESTRICT area =eArea+first*lengthArea; for (int jColumn = first; jColumn < last; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; CoinBigIndex startColumn = startColumnU[iColumn]; int numberNow=tempColumnCount[jColumn]; CoinFactorizationDouble thisPivotValue = elementU[startColumn-1]; int start=startColumn+numberNow; int end=startColumn+numberInColumn[iColumn]; for (CoinBigIndex j=start;j tolerance ) { area[n] = value; if (absValue>largest) { largest=absValue; positionLargest=n; } n++; } else { // say zero int word = j>>5; int unsetBit=j-(word<<5); aBitsThis[word]&= ~(1<(multipliersL); //double temp[4] __attribute__ ((aligned (32))); __m256d pivot = _mm256_broadcast_sd(&thisPivotValue); for (CoinSimplexInt j = 0; j < nDo; j+=4 ) { __m256d a=_mm256_load_pd(area+j); __m256d m=_mm256_load_pd(multipliers+j); a -= pivot*m; *reinterpret_cast<__m256d *>(area+j)=a; //_mm256_store_pd ((area+j), a); } for (CoinSimplexInt j = 0; j < numberInPivotColumn; j++ ) { CoinFactorizationDouble value = area[j]; CoinSimplexDouble absValue = fabs ( value ); area[j]=0.0; if ( absValue > tolerance ) { area[n] = value; if (absValue>largest) { largest=absValue; positionLargest=n; } n++; } else { // say zero int word = j>>5; int unsetBit=j-(word<<5); aBitsThis[word]&= ~(1<=0) positionLargest+=put+numberNow; put+=numberNow; int iA=0; for (int jj=0;jj>1; } } int numberNeeded=put-startColumn; if (positionLargest>=0) { //swap first and largest CoinBigIndex start=startColumn; int firstIndex=indexRowU[start]; CoinFactorizationDouble firstValue=elementU[start]; indexRowU[start]=indexRowU[positionLargest]; elementU[start]=elementU[positionLargest]; indexRowU[positionLargest]=firstIndex; elementU[positionLargest]=firstValue; } tempColumnCount[jColumn]=numberNeeded-numberInColumn[iColumn]; assert (numberNeeded>=0); numberInColumn[iColumn]=numberNeeded; } } } int CoinAbcTypeFactorization::pivot ( CoinSimplexInt & pivotRow, CoinSimplexInt & pivotColumn, CoinBigIndex pivotRowPosition, CoinBigIndex pivotColumnPosition, int * COIN_RESTRICT markRow) { CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnU_.array(); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumn_.array(); CoinFactorizationDouble * COIN_RESTRICT elementU = elementU_.array(); CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowU_.array(); CoinBigIndex * COIN_RESTRICT startRowU = startRowU_.array(); CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRow_.array(); CoinFactorizationDouble * COIN_RESTRICT elementL = elementL_.array(); CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowL_.array(); CoinSimplexInt * COIN_RESTRICT saveColumn = saveColumn_.array(); CoinSimplexInt * COIN_RESTRICT nextRow = nextRow_.array(); CoinSimplexInt * COIN_RESTRICT lastRow = lastRow_.array() ; int realPivotRow=fromSmallToBigRow_[pivotRow]; //int realPivotColumn=fromSmallToBigColumn[pivotColumn]; //store pivot columns (so can easily compress) CoinSimplexInt numberInPivotRow = numberInRow[pivotRow] - 1; CoinBigIndex startColumn = startColumnU[pivotColumn]; CoinSimplexInt numberInPivotColumn = numberInColumn[pivotColumn] - 1; // temp CoinBigIndex endColumn = startColumn + numberInPivotColumn + 1; CoinBigIndex put = 0; CoinBigIndex startRow = startRowU[pivotRow]; CoinBigIndex endRow = startRow + numberInPivotRow + 1; #if ABC_SMALL<2 // temp - switch off marker for valid row/column lookup sparseThreshold_=-1; #endif if ( pivotColumnPosition < 0 ) { for ( pivotColumnPosition = startRow; pivotColumnPosition < endRow; pivotColumnPosition++ ) { CoinSimplexInt iColumn = indexColumnU[pivotColumnPosition]; if ( iColumn != pivotColumn ) { saveColumn[put++] = iColumn; } else { break; } } } else { for (CoinBigIndex i = startRow ; i < pivotColumnPosition ; i++ ) { saveColumn[put++] = indexColumnU[i]; } } assert (pivotColumnPosition lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) printf("more memory needed in middle of invert\n"); return -99; } //l+=currentAreaL_->elementByColumn-elementL; CoinBigIndex lSave = l; CoinSimplexInt saveGoodL=numberGoodL_; CoinBigIndex * COIN_RESTRICT startColumnL = startColumnL_.array(); startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; if ( pivotRowPosition < 0 ) { for ( pivotRowPosition = startColumn; pivotRowPosition < endColumn; pivotRowPosition++ ) { CoinSimplexInt iRow = indexRowU[pivotRowPosition]; if ( iRow == pivotRow ) break; } } assert (pivotRowPosition>2); spaceZeroed=CoinMax(spaceZeroed,firstZeroed_); int maxBoth=CoinMax(numberInPivotRow,numberInPivotColumn); CoinBigIndex spaceOther=numberInPivotRow+maxBoth+numberInPivotRow*((numberInPivotColumn+31)>>5); // allow for new multipliersL spaceOther += 2*numberInPivotColumn+8; // 32 byte alignment wanted CoinBigIndex spaceNeeded=spaceZeroed+((spaceOther+1)>>1)+32; #ifdef INT_IS_8 abort(); #endif if (spaceNeeded>=lengthAreaUPlus_-lastEntryByColumnUPlus_) return -99; // see if need to zero out CoinFactorizationDouble * COIN_RESTRICT eArea = elementUColumnPlusAddress_+lengthAreaUPlus_-spaceZeroed; CoinInt64 xx = reinterpret_cast(eArea); int iBottom = static_cast(xx & 255); int offset = iBottom>>3; eArea -= offset; spaceZeroed=(elementUColumnPlusAddress_+lengthAreaUPlus_)-eArea; char * COIN_RESTRICT mark = reinterpret_cast(eArea+added); CoinFactorizationDouble * COIN_RESTRICT multipliersL = eArea-numberInPivotColumn; // adjust xx = reinterpret_cast(multipliersL); iBottom = static_cast(xx & 31); offset = iBottom>>3; multipliersL -= offset; int * COIN_RESTRICT tempColumnCount = reinterpret_cast(multipliersL)-numberInPivotRow; int * COIN_RESTRICT tempCount = tempColumnCount-maxBoth; int * COIN_RESTRICT others = tempCount-numberInPivotRow; for (CoinBigIndex i = startColumn; i < endColumn; i++ ) { CoinSimplexInt iRow = indexRowU[i]; //double value=elementU[i]*pivotMultiplier; markRow[iRow] = l - lSave; indexRowL[l] = iRow; multipliersL[l-lSave] = elementU[i]; l++; } startColumnL[numberGoodL_] = l; lengthL_ = l; //use end of L for temporary space BUT AVX CoinSimplexInt * COIN_RESTRICT indexL = &indexRowL[lSave]; //CoinFactorizationDouble * COIN_RESTRICT multipliersL = &elementL[lSave]; for (int i=0;i>2)<<2; // zero out rest memset(multipliersL+numberInPivotColumn,0,(lengthArea-numberInPivotColumn)*sizeof(CoinFactorizationDouble)); int intsPerColumn = (lengthArea+31)>>5; unsigned int * COIN_RESTRICT aBits = reinterpret_cast(others-intsPerColumn*numberInPivotRow); memset(aBits,0xff,intsPerColumn*4*numberInPivotRow); if (spaceZeroed>firstZeroed_) { CoinAbcMemset0(eArea,spaceZeroed-firstZeroed_); firstZeroed_=spaceZeroed; } #ifndef NDEBUG for (int i=0;i=0); #endif cilk_for_query (int jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; CoinBigIndex startColumn = startColumnU[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumn[iColumn]; CoinFactorizationDouble thisPivotValue = 0.0; CoinBigIndex put = startColumn; CoinBigIndex positionLargest = -1; double largest=0.0; CoinBigIndex position = startColumn; int iRow = indexRowU[position]; CoinFactorizationDouble value = elementU[position]; CoinSimplexInt mark = markRow[iRow]; CoinBigIndex end=endColumn-1; while ( position < end) { if ( mark == LARGE_UNSET ) { //keep if (fabs(value)>largest) { positionLargest=put; largest=fabs(value); } indexRowU[put] = iRow; elementU[put++] = value; } else if ( mark != LARGE_SET ) { //will be updated - move to end CoinFactorizationDouble value2=value; int mark2=mark; iRow = indexRowU[end]; value = elementU[end]; mark = markRow[iRow]; indexRowU[end]=mark2; elementU[end]=value2; end--; continue; } else { thisPivotValue = value; } position++; iRow = indexRowU[position]; value = elementU[position]; mark = markRow[iRow]; } // now last in column if ( mark == LARGE_UNSET ) { //keep if (fabs(value)>largest) { positionLargest=put; largest=fabs(value); } indexRowU[put] = iRow; elementU[put++] = value; } else if ( mark != LARGE_SET ) { //will be updated - move to end indexRowU[end]=mark; elementU[end]=value; } else { thisPivotValue = value; } //swap largest if (positionLargest>=0) { double largestValue=elementU[positionLargest]; int largestIndex=indexRowU[positionLargest]; if (positionLargest!=startColumn+1&&put>startColumn+1) { elementU[positionLargest]=elementU[startColumn+1]; indexRowU[positionLargest]=indexRowU[startColumn+1]; elementU[startColumn+1] = largestValue; indexRowU[startColumn+1] = largestIndex; } int firstIndex=indexRowU[startColumn]; CoinFactorizationDouble firstValue=elementU[startColumn]; // move first to end elementU[put] = firstValue; indexRowU[put++] = firstIndex; } else { put++; } elementU[startColumn] = thisPivotValue; indexRowU[startColumn] = realPivotRow; startColumn++; startColumnU[iColumn]=startColumn; numberInColumnPlus[iColumn]++; int numberNow=put-startColumn; tempColumnCount[jColumn]=numberNow; numberInColumn[iColumn]--; #ifndef NDEBUG for (int i=startColumn+numberNow;i=0); #endif //parallel mark[pivotColumn]=1; cilk_for_query (int jRow = 0; jRow < numberInPivotColumn; jRow++ ) { CoinSimplexInt iRow = indexL[jRow]; CoinBigIndex startRow = startRowU[iRow]; CoinBigIndex endRow = startRow + numberInRow[iRow]; CoinBigIndex put=startRow; // move earlier but set numberInRow to final for (CoinBigIndex i = startRow ; i < endRow; i++ ) { int iColumn = indexColumnU[i]; if (!mark[iColumn]) indexColumnU[put++]=iColumn; } numberInRow[iRow]=put-startRow; } mark[pivotColumn]=0; #ifdef DENSE_TRY int numberZeroOther=0; for (int jRow = 0; jRow < numberInPivotColumn; jRow++ ) { CoinSimplexInt iRow = indexL[jRow]; if (numberInRow[iRow]) { //printf("Cantdo INrow %d incolumn %d nother %d\n", // numberInPivotRow,numberInPivotColumn,numberZeroOther); numberZeroOther=-1; break; } } if (!numberZeroOther) { for (int jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { if (!tempColumnCount[jColumn]) others[numberZeroOther++]=jColumn; } } #endif // serial for (int jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; CoinBigIndex startColumn = startColumnU[iColumn]; int numberNow=tempColumnCount[jColumn]; int numberNeeded=numberNow+numberInPivotColumn; tempCount[jColumn]=numberInColumn[iColumn]; //how much space have we got CoinSimplexInt next = nextColumn[iColumn]; CoinBigIndex space = startColumnU[next] - startColumn - numberInColumnPlus[next]; // do moves serially but fill in in parallel! if ( numberNeeded > space ) { //getColumnSpace also moves fixed part if ( !getColumnSpace ( iColumn, numberNeeded ) ) { return -99; } } numberInColumn[iColumn]=numberNeeded; } // move counts back for (int jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; numberInColumn[iColumn]=tempCount[jColumn]; } // giveUp should be more sophisticated and also vary in next three #if ABC_PARALLEL==2 int giveUp=CoinMax(numberInPivotRow/(parallelMode_+1+(parallelMode_>>1)),16); #else int giveUp=numberInPivotRow; #endif #ifdef DENSE_TRY // If we keep full area - then can try doing many pivots in this function // Go round if there are any others just in this block bool inAreaAlready=false; if (numberZeroOther>4) { //printf("Cando INrow %d incolumn %d nother %d\n", // numberInPivotRow,numberInPivotColumn,numberZeroOther); int numberRowsTest=(numberRowsLeft_-numberZeroOther+0)&~7; if (numberRowsLeft_-numberZeroOther<=numberRowsTest) { //see if would go dense int numberSubtracted=0; // would have to be very big for parallel for (int jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; numberSubtracted += numberInColumn[iColumn]-tempColumnCount[jColumn]; } // could do formula? - work backwards CoinBigIndex saveTotalElements=totalElements_; int saveNumberRowsLeft=numberRowsLeft_; int numberOut=numberRowsLeft_-numberRowsTest-1; numberRowsLeft_=numberRowsTest; CoinBigIndex total= totalElements_-numberSubtracted; int bestGoDense=-1; for (;numberRowsLeft_numberRowsLeft_-numberZeroOther) numberZeroOther=numberRowsLeft_-bestGoDense;; } } else { numberZeroOther=-1; } if (numberZeroOther>0) { // do all except last pivotStartup(0,numberInPivotRow,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU); assert (tempColumnCount[0]>=0); for (int iTry=numberZeroOther-1;iTry>=0;iTry--) { pivotWhile(0,numberInPivotRow,numberInPivotColumn,lengthArea,giveUp, eArea,multipliersL); assert (tempColumnCount[0]>=0); // find new pivot row int jPivotColumn=others[iTry]; CoinFactorizationDouble * COIN_RESTRICT area =eArea+jPivotColumn*lengthArea; double largest=tolerance; int jPivotRow=-1; for (CoinSimplexInt j = 0; j < numberInPivotColumn; j++ ) { CoinFactorizationDouble value = area[j]; CoinSimplexDouble absValue = fabs ( value ); if (absValue>largest) { largest=absValue; jPivotRow=j; } } if (jPivotRow>=0) { markRow[pivotRow] = LARGE_UNSET; //modify linked list for pivots deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); // put away last afterPivot(pivotRow,pivotColumn); if (reinterpret_cast(elementUColumnPlusAddress_+lastEntryByColumnUPlus_)>aBits) { #ifndef NDEBUG printf("? dense\n"); #endif return -99; } // new ones pivotRow=indexL[jPivotRow]; pivotColumn=saveColumn[jPivotColumn]; // now do stuff for pivot realPivotRow=fromSmallToBigRow_[pivotRow]; //int realPivotColumn=fromSmallToBigColumn[pivotColumn]; //store pivot columns (so can easily compress) CoinBigIndex startColumn = startColumnU[pivotColumn]; CoinBigIndex endColumn = startColumn + tempColumnCount[jPivotColumn]; CoinSimplexInt next = nextRow[pivotRow]; CoinSimplexInt last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; #ifdef SMALL_PERMUTE permuteAddress_[realPivotRow] = numberGoodU_; //use for permute #else permuteAddress_[pivotRow] = numberGoodU_; //use for permute #endif lastRow[pivotRow] = -2; numberInRow[pivotRow] = 0; assert (tempColumnCount[0]>=0); //store column in L, compress in U and take column out CoinBigIndex l = lengthL_; if ( l + numberInPivotColumn > lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) printf("more memory needed in middle of invert\n"); return -99; } //CoinBigIndex * COIN_RESTRICT startColumnL = startColumnL_.array(); numberGoodL_++; // move to L and move last numberInPivotColumn--; assert (tempColumnCount[0]>=0); if (jPivotRow!=numberInPivotColumn) { // swap for (int jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinFactorizationDouble * COIN_RESTRICT area =eArea+jColumn*lengthArea; CoinFactorizationDouble thisValue = area[jPivotRow]; area[jPivotRow]=area[numberInPivotColumn]; area[numberInPivotColumn]=thisValue; } // do indexL in last one int tempI=indexL[numberInPivotColumn]; CoinFactorizationDouble tempD=multipliersL[numberInPivotColumn]; indexL[numberInPivotColumn]=indexL[jPivotRow]; multipliersL[numberInPivotColumn]=multipliersL[jPivotRow]; indexL[jPivotRow]=tempI; multipliersL[jPivotRow]=tempD; jPivotRow=numberInPivotColumn; } assert (tempColumnCount[0]>=0); numberInPivotRow--; CoinFactorizationDouble pivotElement = area[numberInPivotColumn]; area[numberInPivotColumn]=0.0; // put last one in now CoinFactorizationDouble * COIN_RESTRICT areaLast =eArea+numberInPivotRow*lengthArea; // swap columns saveColumn[jPivotColumn]=saveColumn[numberInPivotRow]; saveColumn[numberInPivotRow]=pivotColumn; //int temp=tempColumnCount[jPivotColumn]; tempColumnCount[jPivotColumn]=tempColumnCount[numberInPivotRow]; totalElements_-=numberInColumn[pivotColumn]; mark[pivotColumn]=0; assert (tempColumnCount[0]>=0); for (int jRow=0;jRow=0); area[numberInPivotColumn]=thisPivotValue; if (fabs(thisPivotValue)>tolerance) { CoinSimplexInt iColumn = saveColumn[jColumn]; CoinBigIndex startColumn = startColumnU[iColumn]; int nKeep=tempColumnCount[jColumn]; if (nKeep) { if (nKeep>1) { // need to move one to end elementU[startColumn+nKeep]=elementU[startColumn+1]; indexRowU[startColumn+nKeep]=indexRowU[startColumn+1]; } // move largest elementU[startColumn+1]=elementU[startColumn]; indexRowU[startColumn+1]=indexRowU[startColumn]; } elementU[startColumn] = thisPivotValue; indexRowU[startColumn] = realPivotRow; startColumn++; startColumnU[iColumn]=startColumn; numberInColumnPlus[iColumn]++; //numberInColumn[iColumn]--; } } assert (tempColumnCount[0]>=0); // put away last (but remember count is one out) CoinAbcMemcpy(elementL+lSave,multipliersL,numberInPivotColumn+1); lSave=l; for (int i=0;i=0); multipliersL[l-lSave] = value; l++; } startColumnL[numberGoodL_] = l; lengthL_ = l; CoinFactorizationDouble pivotMultiplier = 1.0 / pivotElement; pivotRegionAddress_[numberGoodU_] = pivotMultiplier; numberInColumn[pivotColumn] = 0; indexL = &indexRowL[lSave]; //adjust for (CoinSimplexInt j = 0; j < numberInPivotColumn; j++ ) { multipliersL[j] *= pivotMultiplier; } // zero out last multipliersL[numberInPivotColumn]=0.0; } else { // singular // give up break; } } assert (tempColumnCount[0]>=0); #if 0 // zero out extra bits int add1=numberInPivotColumn>>5; unsigned int * aBitsThis = aBits; int left=numberInPivotColumn-(add1<<5); unsigned int mark1 = (1<<(left-1)-1); int jColumn; for (jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { memset(aBitsThis+add1,0,(intsPerColumn-add1)*sizeof(int)); aBitsThis += intsPerColumn; } for (; jColumn < numberInPivotRow+numberZeroOther; jColumn++ ) { memset(aBitsThis,0,intsPerColumn*sizeof(int)); aBitsThis += intsPerColumn; } #endif // last bit inAreaAlready=true; } #endif #if 0 for (int i=0;i=0); #endif //if (added<1000) //giveUp=CoinMax(); //?? #ifdef DENSE_TRY if (!inAreaAlready) { #endif pivotSome(0,numberInPivotRow,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU,aBits,indexL, multipliersL,tolerance); #ifdef DENSE_TRY } else { pivotSomeAfter(0,numberInPivotRow,numberInPivotColumn,lengthArea,giveUp, eArea,saveColumn,startColumnU,tempColumnCount, elementU,numberInColumn,indexRowU,aBits,indexL, multipliersL,tolerance); } #endif #if 0 for (int i=0;i=0); #endif //serial for (int jRow = 0; jRow < numberInPivotColumn; jRow++ ) { CoinSimplexInt iRow = indexL[jRow]; CoinSimplexInt next = nextRow[iRow]; CoinBigIndex space = startRowU[next] - startRowU[iRow]; // assume full int numberNeeded = numberInPivotRow+numberInRow[iRow]; tempCount[jRow]=numberInRow[iRow]; numberInRow[iRow]=numberNeeded; if ( space < numberNeeded ) { if ( !getRowSpace ( iRow, numberNeeded ) ) { return -99; } } lastEntryByRowU_ = CoinMax(startRowU[iRow]+numberNeeded,lastEntryByRowU_); // in case I got it wrong! if (lastEntryByRowU_>lengthAreaU_) { return -99; } } // move counts back for (int jRow = 0; jRow < numberInPivotColumn; jRow++ ) { CoinSimplexInt iRow = indexL[jRow]; numberInRow[iRow]=tempCount[jRow]; } // parallel cilk_for_query (int jRow = 0; jRow < numberInPivotColumn; jRow++ ) { CoinSimplexInt iRow = indexL[jRow]; CoinBigIndex startRow = startRowU[iRow]; CoinBigIndex put = startRow + numberInRow[iRow]; int iWord = jRow>>5; unsigned int setBit=1<<(jRow&31); unsigned int * aBitsThis = aBits+iWord; for (int i=0;i=0&&indexRowU[i]10000) printf("INrow %d incolumn %d nzero %d\n", numberInPivotRow,numberInPivotColumn,numberZeroOther); #endif //printf("INrow %d incolumn %d nzero %d ratio %g\n", // numberInPivotRow,numberInPivotColumn,numberZeroOther,ratio); for (int i=0;i=tolerance) ; int iRow=indexRowL[j]; indexRowL[j] = fromSmallToBigRow_[iRow]; } #endif markRow[pivotRow] = LARGE_UNSET; //modify linked list for pivots deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); totalElements_ += added; return status; } #endif // nonparallel pivot int CoinAbcTypeFactorization::pivot ( CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn, CoinBigIndex pivotRowPosition, CoinBigIndex pivotColumnPosition, CoinFactorizationDouble * COIN_RESTRICT work, CoinSimplexUnsignedInt * COIN_RESTRICT workArea2, CoinSimplexInt increment2, int * COIN_RESTRICT markRow) { CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnU_.array(); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnU_.array(); CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumn_.array(); CoinFactorizationDouble * COIN_RESTRICT elementU = elementU_.array(); CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowU_.array(); CoinBigIndex * COIN_RESTRICT startRowU = startRowU_.array(); CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRow_.array(); CoinFactorizationDouble * COIN_RESTRICT elementL = elementL_.array(); CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowL_.array(); CoinSimplexInt * COIN_RESTRICT saveColumn = saveColumn_.array(); CoinSimplexInt * COIN_RESTRICT nextRow = nextRow_.array(); CoinSimplexInt * COIN_RESTRICT lastRow = lastRow_.array() ; #ifdef SMALL_PERMUTE int realPivotRow=fromSmallToBigRow_[pivotRow]; //int realPivotColumn=fromSmallToBigColumn[pivotColumn]; #endif //store pivot columns (so can easily compress) CoinSimplexInt numberInPivotRow = numberInRow[pivotRow] - 1; CoinBigIndex startColumn = startColumnU[pivotColumn]; CoinSimplexInt numberInPivotColumn = numberInColumn[pivotColumn] - 1; // temp CoinBigIndex endColumn = startColumn + numberInPivotColumn + 1; CoinBigIndex put = 0; CoinBigIndex startRow = startRowU[pivotRow]; CoinBigIndex endRow = startRow + numberInPivotRow + 1; #if ABC_SMALL<2 // temp - switch off marker for valid row/column lookup sparseThreshold_=-1; #endif if ( pivotColumnPosition < 0 ) { for ( pivotColumnPosition = startRow; pivotColumnPosition < endRow; pivotColumnPosition++ ) { CoinSimplexInt iColumn = indexColumnU[pivotColumnPosition]; if ( iColumn != pivotColumn ) { saveColumn[put++] = iColumn; } else { #if BOTH_WAYS #endif break; } } } else { for (CoinBigIndex i = startRow ; i < pivotColumnPosition ; i++ ) { saveColumn[put++] = indexColumnU[i]; } } assert (pivotColumnPosition lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) printf("more memory needed in middle of invert\n"); return -99; } //l+=currentAreaL_->elementByColumn-elementL; CoinBigIndex lSave = l; CoinBigIndex * COIN_RESTRICT startColumnL = startColumnL_.array(); startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l + numberInPivotColumn; lengthL_ += numberInPivotColumn; if ( pivotRowPosition < 0 ) { for ( pivotRowPosition = startColumn; pivotRowPosition < endColumn; pivotRowPosition++ ) { CoinSimplexInt iRow = indexRowU[pivotRowPosition]; if ( iRow != pivotRow ) { indexRowL[l] = iRow; elementL[l] = elementU[pivotRowPosition]; markRow[iRow] = l - lSave; l++; //take out of row list CoinBigIndex start = startRowU[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif #if BOTH_WAYS #endif indexColumnU[where] = indexColumnU[end - 1]; numberInRow[iRow]--; } else { break; } } } else { CoinBigIndex i; for ( i = startColumn; i < pivotRowPosition; i++ ) { CoinSimplexInt iRow = indexRowU[i]; markRow[iRow] = l - lSave; indexRowL[l] = iRow; elementL[l] = elementU[i]; l++; //take out of row list CoinBigIndex start = startRowU[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif #if BOTH_WAYS #endif indexColumnU[where] = indexColumnU[end - 1]; numberInRow[iRow]--; assert (numberInRow[iRow]>=0); } } assert (pivotRowPosition= end ) { abort ( ); } #endif #if BOTH_WAYS #endif indexColumnU[where] = indexColumnU[end - 1]; numberInRow[iRow]--; assert (numberInRow[iRow]>=0); } markRow[pivotRow] = LARGE_SET; //compress pivot column (move pivot to front including saved) numberInColumn[pivotColumn] = 0; //use end of L for temporary space CoinSimplexInt * COIN_RESTRICT indexL = &indexRowL[lSave]; CoinFactorizationDouble * COIN_RESTRICT multipliersL = &elementL[lSave]; //adjust CoinSimplexInt j; for ( j = 0; j < numberInPivotColumn; j++ ) { multipliersL[j] *= pivotMultiplier; } CoinBigIndex added = numberInPivotRow * numberInPivotColumn; //zero out fill CoinBigIndex iErase; for ( iErase = 0; iErase < increment2 * numberInPivotRow; iErase++ ) { workArea2[iErase] = 0; } CoinSimplexUnsignedInt * COIN_RESTRICT temp2 = workArea2; CoinSimplexInt * COIN_RESTRICT nextColumn = nextColumn_.array(); //pack down and move to work CoinSimplexInt jColumn; for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; CoinBigIndex startColumn = startColumnU[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumn[iColumn]; CoinSimplexInt iRow = indexRowU[startColumn]; CoinFactorizationDouble value = elementU[startColumn]; CoinSimplexDouble largest; CoinBigIndex put = startColumn; CoinBigIndex positionLargest = -1; CoinFactorizationDouble thisPivotValue = 0.0; //compress column and find largest not updated bool checkLargest; CoinSimplexInt mark = markRow[iRow]; if ( mark == LARGE_UNSET ) { largest = fabs ( value ); positionLargest = put; put++; checkLargest = false; } else { //need to find largest largest = 0.0; checkLargest = true; if ( mark != LARGE_SET ) { //will be updated work[mark] = value; CoinSimplexInt word = mark >> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexInt bit = mark & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts added--; } else { thisPivotValue = value; } } CoinBigIndex i; for ( i = startColumn + 1; i < endColumn; i++ ) { iRow = indexRowU[i]; value = elementU[i]; CoinSimplexInt mark = markRow[iRow]; if ( mark == LARGE_UNSET ) { //keep indexRowU[put] = iRow; #if BOTH_WAYS #endif elementU[put] = value; if ( checkLargest ) { CoinSimplexDouble absValue = fabs ( value ); if ( absValue > largest ) { largest = absValue; positionLargest = put; } } put++; } else if ( mark != LARGE_SET ) { //will be updated work[mark] = value; CoinSimplexInt word = mark >> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexInt bit = mark & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts added--; } else { thisPivotValue = value; } } //slot in pivot elementU[put] = elementU[startColumn]; indexRowU[put] = indexRowU[startColumn]; #if BOTH_WAYS #endif if ( positionLargest == startColumn ) { positionLargest = put; //follow if was largest } put++; elementU[startColumn] = thisPivotValue; #ifdef SMALL_PERMUTE indexRowU[startColumn] = realPivotRow; #else indexRowU[startColumn] = pivotRow; #endif #if BOTH_WAYS #endif //clean up counts startColumn++; numberInColumn[iColumn] = put - startColumn; CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlus_.array(); numberInColumnPlus[iColumn]++; startColumnU[iColumn]++; //how much space have we got CoinSimplexInt next = nextColumn[iColumn]; CoinBigIndex space; space = startColumnU[next] - put - numberInColumnPlus[next]; //assume no zero elements if ( numberInPivotColumn > space ) { //getColumnSpace also moves fixed part if ( !getColumnSpace ( iColumn, numberInPivotColumn ) ) { return -99; } //redo starts positionLargest = positionLargest + startColumnU[iColumn] - startColumn; startColumn = startColumnU[iColumn]; put = startColumn + numberInColumn[iColumn]; } CoinSimplexDouble tolerance = zeroTolerance_; //CoinSimplexInt * COIN_RESTRICT nextCount = this->nextCount(); for ( j = 0; j < numberInPivotColumn; j++ ) { value = work[j] - thisPivotValue * multipliersL[j]; CoinSimplexDouble absValue = fabs ( value ); if ( absValue > tolerance ) { work[j] = 0.0; assert (put largest ) { largest = absValue; positionLargest = put; } put++; } else { work[j] = 0.0; added--; CoinSimplexInt word = j >> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexInt bit = j & COINFACTORIZATION_MASK_PER_INT; if ( temp2[word] & ( 1 << bit ) ) { //take out of row list iRow = indexL[j]; CoinBigIndex start = startRowU[iRow]; CoinBigIndex end = start + numberInRow[iRow]; CoinBigIndex where = start; while ( indexColumnU[where] != iColumn ) { where++; } /* endwhile */ #if DEBUG_COIN if ( where >= end ) { abort ( ); } #endif #if BOTH_WAYS #endif indexColumnU[where] = indexColumnU[end - 1]; numberInRow[iRow]--; } else { //make sure won't be added CoinSimplexInt word = j >> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexInt bit = j & COINFACTORIZATION_MASK_PER_INT; temp2[word] = temp2[word] | ( 1 << bit ); //say already in counts } } } numberInColumn[iColumn] = put - startColumn; //move largest if ( positionLargest >= 0 ) { value = elementU[positionLargest]; iRow = indexRowU[positionLargest]; elementU[positionLargest] = elementU[startColumn]; indexRowU[positionLargest] = indexRowU[startColumn]; elementU[startColumn] = value; indexRowU[startColumn] = iRow; #if BOTH_WAYS #endif } //linked list for column //if ( nextCount[iColumn + numberRows_] != -2 ) { //modify linked list //deleteLink ( iColumn + numberRows_ ); //modifyLink ( iColumn + numberRows_, numberInColumn[iColumn] ); //} temp2 += increment2; } //get space for row list CoinSimplexUnsignedInt * COIN_RESTRICT putBase = workArea2; CoinSimplexInt bigLoops = numberInPivotColumn >> COINFACTORIZATION_SHIFT_PER_INT; CoinSimplexInt i = 0; // do linked lists and update counts while ( bigLoops ) { bigLoops--; CoinSimplexInt bit; for ( bit = 0; bit < COINFACTORIZATION_BITS_PER_INT; i++, bit++ ) { CoinSimplexUnsignedInt *putThis = putBase; CoinSimplexInt iRow = indexL[i]; //get space CoinSimplexInt number = 0; CoinSimplexInt jColumn; for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexUnsignedInt test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); number += test; } CoinSimplexInt next = nextRow[iRow]; CoinBigIndex space; space = startRowU[next] - startRowU[iRow]; number += numberInRow[iRow]; if ( space < number ) { if ( !getRowSpace ( iRow, number ) ) { return -99; } } // now do putThis = putBase; next = nextRow[iRow]; number = numberInRow[iRow]; CoinBigIndex end = startRowU[iRow] + number; CoinSimplexInt saveIndex = indexColumnU[startRowU[next]]; //add in for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexUnsignedInt test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); indexColumnU[end] = saveColumn[jColumn]; #if BOTH_WAYS #endif end += test; } lastEntryByRowU_ = CoinMax(end,lastEntryByRowU_); assert (lastEntryByRowU_<=lengthAreaU_); //put back next one in case zapped indexColumnU[startRowU[next]] = saveIndex; #if BOTH_WAYS #endif markRow[iRow] = LARGE_UNSET; number = end - startRowU[iRow]; numberInRow[iRow] = number; //deleteLink ( iRow ); //modifyLink ( iRow, number ); } putBase++; } /* endwhile */ CoinSimplexInt bit; for ( bit = 0; i < numberInPivotColumn; i++, bit++ ) { CoinSimplexUnsignedInt *putThis = putBase; CoinSimplexInt iRow = indexL[i]; //get space CoinSimplexInt number = 0; CoinSimplexInt jColumn; for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexUnsignedInt test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); number += test; } CoinSimplexInt next = nextRow[iRow]; CoinBigIndex space; space = startRowU[next] - startRowU[iRow]; number += numberInRow[iRow]; if ( space < number ) { if ( !getRowSpace ( iRow, number ) ) { return -99; } } // now do putThis = putBase; next = nextRow[iRow]; number = numberInRow[iRow]; CoinBigIndex end = startRowU[iRow] + number; CoinSimplexInt saveIndex; saveIndex = indexColumnU[startRowU[next]]; //if (numberRowsSmall_==2791&&iRow==1160) //printf("start %d end %d\n",startRowU[iRow],end); //add in for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexUnsignedInt test = *putThis; putThis += increment2; test = 1 - ( ( test >> bit ) & 1 ); indexColumnU[end] = saveColumn[jColumn]; #if BOTH_WAYS #endif end += test; //if (numberRowsSmall_==2791&&iRow==1160) //printf("start %d end %d test %d col %d\n",startRowU[iRow],end,test,saveColumn[jColumn]); } indexColumnU[startRowU[next]] = saveIndex; lastEntryByRowU_ = CoinMax(end,lastEntryByRowU_); assert (lastEntryByRowU_<=lengthAreaU_); #if BOTH_WAYS #endif markRow[iRow] = LARGE_UNSET; number = end - startRowU[iRow]; numberInRow[iRow] = number; //deleteLink ( iRow ); //modifyLink ( iRow, number ); } for ( jColumn = 0; jColumn < numberInPivotRow; jColumn++ ) { CoinSimplexInt iColumn = saveColumn[jColumn]; modifyLink ( iColumn + numberRows_, numberInColumn[iColumn] ); } for (int i=0;i(elementUColumnPlusAddress_+lastEntryByColumnUPlus_),indexRow+startC,number); lastEntryByColumnUPlus_ += (number+1)>>1; #ifdef ABC_USE_FUNCTION_POINTERS if (!numberInColumnAddress_[pivotColumn]) { int iNext=nextColumnAddress_[pivotColumn]; int iLast=lastColumnAddress_[pivotColumn]; lastColumnAddress_[iNext]=iLast; assert (iLast>=0); nextColumnAddress_[iLast]=iNext; } #endif #endif numberGoodU_++; numberRowsLeft_--; #if COIN_DEBUG==2 checkConsistency ( ); #endif } #if ABC_DENSE_CODE // After pivoting - returns true if need to go dense int CoinAbcTypeFactorization::wantToGoDense() { int status=0; if (denseThreshold_) { // see whether to go dense // only if exact multiple if ((numberRowsLeft_&7)==0) { CoinSimplexDouble full = numberRowsLeft_; full *= full; assert (full>=0.0); CoinSimplexDouble leftElements = totalElements_; //if (numberRowsLeft_==100) //printf("at 100 %d elements\n",totalElements_); CoinSimplexDouble ratio; if (numberRowsLeft_>2000) ratio=3.5; else if (numberRowsLeft_>800) ratio=2.75;//3.5; else if (numberRowsLeft_>256) ratio=2.0;//2.5; //else if (numberRowsLeft_==8) //ratio=200.0; else ratio=1.5; //ratio=200.0; //ratio *=0.75; if ((ratio*leftElements>full&&numberRowsLeft_>abs(denseThreshold_))) { #if 0 //ndef NDEBUG //return to do dense CoinSimplexInt check=0; for (CoinSimplexInt iColumn=0;iColumn1 std::cout<<" Went dense at "< lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) std::cout << "more memory needed in middle of invert" << std::endl; return false; } CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; CoinFactorizationDouble * COIN_RESTRICT elementL = elementLAddress_; CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowLAddress_; startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l + numberDoColumn; lengthL_ += numberDoColumn; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinFactorizationDouble pivotElement = elementU[pivotRowPosition]; CoinFactorizationDouble pivotMultiplier = 1.0 / pivotElement; pivotRegionAddress_[numberGoodU_] = pivotMultiplier; CoinBigIndex i; CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; #ifdef SMALL_PERMUTE int realPivotRow=fromSmallToBigRow_[pivotRow]; #endif for ( i = startColumn; i < pivotRowPosition; i++ ) { CoinSimplexInt iRow = indexRowU[i]; #ifdef SMALL_PERMUTE indexRowL[l] = fromSmallToBigRow_[iRow]; #else indexRowL[l] = iRow; #endif elementL[l] = elementU[i] * pivotMultiplier; l++; //take out of row list CoinBigIndex start = startRowU[iRow]; CoinSimplexInt iNumberInRow = numberInRow[iRow]; CoinBigIndex end = start + iNumberInRow; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ assert ( where < end ); #if BOTH_WAYS #endif indexColumnU[where] = indexColumnU[end - 1]; iNumberInRow--; numberInRow[iRow] = iNumberInRow; modifyLink ( iRow, iNumberInRow ); } for ( i = pivotRowPosition + 1; i < endColumn; i++ ) { CoinSimplexInt iRow = indexRowU[i]; #ifdef SMALL_PERMUTE indexRowL[l] = fromSmallToBigRow_[iRow]; #else indexRowL[l] = iRow; #endif elementL[l] = elementU[i] * pivotMultiplier; l++; //take out of row list CoinBigIndex start = startRowU[iRow]; CoinSimplexInt iNumberInRow = numberInRow[iRow]; CoinBigIndex end = start + iNumberInRow; CoinBigIndex where = start; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ assert ( where < end ); #if BOTH_WAYS #endif indexColumnU[where] = indexColumnU[end - 1]; iNumberInRow--; numberInRow[iRow] = iNumberInRow; modifyLink ( iRow, iNumberInRow ); } numberInColumn[pivotColumn] = 0; //modify linked list for pivots numberInRow[pivotRow] = 0; deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); //take out this bit of indexColumnU CoinSimplexInt next = nextRow[pivotRow]; CoinSimplexInt last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; lastRow[pivotRow] =-2; #ifdef SMALL_PERMUTE permuteAddress_[realPivotRow]=numberGoodU_; #else permuteAddress_[pivotRow]=numberGoodU_; #endif return true; } // pivotColumnSingleton. Does one pivot on Column Singleton in factorization void CoinAbcTypeFactorization::pivotColumnSingleton ( CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn ) { CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; //store pivot columns (so can easily compress) CoinSimplexInt numberDoRow = numberInRow[pivotRow] - 1; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinBigIndex startColumn = startColumnU[pivotColumn]; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; CoinBigIndex startRow = startRowU[pivotRow]; CoinBigIndex endRow = startRow + numberDoRow + 1; CoinSimplexInt * COIN_RESTRICT nextRow = nextRowAddress_; CoinSimplexInt * COIN_RESTRICT lastRow = lastRowAddress_; //take out this bit of indexColumnU CoinSimplexInt next = nextRow[pivotRow]; CoinSimplexInt last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; lastRow[pivotRow] =-2; //mark #ifdef SMALL_PERMUTE int realPivotRow=fromSmallToBigRow_[pivotRow]; permuteAddress_[realPivotRow]=numberGoodU_; #else permuteAddress_[pivotRow]=numberGoodU_; #endif //clean up counts CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinFactorizationDouble pivotElement = elementU[startColumn]; pivotRegionAddress_[numberGoodU_] = 1.0 / pivotElement; numberInColumn[pivotColumn] = 0; CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; //CoinSimplexInt * COIN_RESTRICT saveColumn = saveColumnAddress_; CoinBigIndex i; // would I be better off doing other way first?? for ( i = startRow; i < endRow; i++ ) { CoinSimplexInt iColumn = indexColumnU[i]; if ( numberInColumn[iColumn] ) { CoinSimplexInt number = numberInColumn[iColumn] - 1; //modify linked list modifyLink ( iColumn + numberRows_, number ); //move pivot row element #ifdef SMALL_PERMUTE CoinBigIndex start = startColumnU[iColumn]; #endif if ( number ) { #ifndef SMALL_PERMUTE CoinBigIndex start = startColumnU[iColumn]; #endif CoinBigIndex pivot = start; CoinSimplexInt iRow = indexRowU[pivot]; while ( iRow != pivotRow ) { pivot++; iRow = indexRowU[pivot]; } assert (pivot < startColumnU[iColumn] + numberInColumn[iColumn]); #if BOTH_WAYS #endif if ( pivot != start ) { //move largest one up CoinFactorizationDouble value = elementU[start]; iRow = indexRowU[start]; elementU[start] = elementU[pivot]; assert (indexRowU[pivot]==pivotRow); indexRowU[start] = indexRowU[pivot]; elementU[pivot] = elementU[start + 1]; indexRowU[pivot] = indexRowU[start + 1]; elementU[start + 1] = value; indexRowU[start + 1] = iRow; #if BOTH_WAYS #endif } else { //find new largest element CoinSimplexInt iRowSave = indexRowU[start + 1]; CoinFactorizationDouble valueSave = elementU[start + 1]; CoinFactorizationDouble valueLargest = fabs ( valueSave ); CoinBigIndex end = start + numberInColumn[iColumn]; CoinBigIndex largest = start + 1; CoinBigIndex k; for ( k = start + 2; k < end; k++ ) { CoinFactorizationDouble value = elementU[k]; CoinFactorizationDouble valueAbs = fabs ( value ); if ( valueAbs > valueLargest ) { valueLargest = valueAbs; largest = k; } } indexRowU[start + 1] = indexRowU[largest]; elementU[start + 1] = elementU[largest]; indexRowU[largest] = iRowSave; elementU[largest] = valueSave; #if BOTH_WAYS #endif } } #ifdef SMALL_PERMUTE indexRowU[start]=realPivotRow; #endif //clean up counts numberInColumn[iColumn]--; numberInColumnPlus[iColumn]++; startColumnU[iColumn]++; //totalElements_--; } } //modify linked list for pivots deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); numberInRow[pivotRow] = 0; //put in dummy pivot in L CoinBigIndex l = lengthL_; CoinBigIndex * startColumnL = startColumnLAddress_; startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l; } // getColumnSpace. Gets space for one Column with given length //may have to do compression (returns true) //also moves existing vector bool CoinAbcTypeFactorization::getColumnSpace ( CoinSimplexInt iColumn, CoinSimplexInt extraNeeded ) { CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; CoinSimplexInt * COIN_RESTRICT nextColumn = nextColumnAddress_; CoinSimplexInt * COIN_RESTRICT lastColumn = lastColumnAddress_; CoinSimplexInt number = numberInColumnPlus[iColumn] + numberInColumn[iColumn]; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinBigIndex space = lengthAreaU_ - lastEntryByColumnU_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; if ( space < extraNeeded + number + 4 ) { //compression CoinSimplexInt iColumn = nextColumn[maximumRowsExtra_]; CoinBigIndex put = 0; while ( iColumn != maximumRowsExtra_ ) { //move CoinBigIndex get; CoinBigIndex getEnd; if ( startColumnU[iColumn] >= 0 ) { get = startColumnU[iColumn] - numberInColumnPlus[iColumn]; getEnd = startColumnU[iColumn] + numberInColumn[iColumn]; startColumnU[iColumn] = put + numberInColumnPlus[iColumn]; } else { get = -startColumnU[iColumn]; getEnd = get + numberInColumn[iColumn]; startColumnU[iColumn] = -put; } assert (put<=get); for (CoinBigIndex i = get; i < getEnd; i++ ) { indexRowU[put] = indexRowU[i]; elementU[put] = elementU[i]; #if BOTH_WAYS #endif put++; } iColumn = nextColumn[iColumn]; } /* endwhile */ numberCompressions_++; lastEntryByColumnU_ = put; space = lengthAreaU_ - put; if ( extraNeeded == COIN_INT_MAX >> 1 ) { return true; } if ( space < extraNeeded + number + 2 ) { //need more space //if we can allocate bigger then do so and copy //if not then return so code can start again status_ = -99; return false; } } CoinBigIndex put = lastEntryByColumnU_; CoinSimplexInt next = nextColumn[iColumn]; CoinSimplexInt last = lastColumn[iColumn]; if ( extraNeeded || next != maximumRowsExtra_ ) { //out nextColumn[last] = next; lastColumn[next] = last; //in at end last = lastColumn[maximumRowsExtra_]; nextColumn[last] = iColumn; lastColumn[maximumRowsExtra_] = iColumn; lastColumn[iColumn] = last; nextColumn[iColumn] = maximumRowsExtra_; //move CoinBigIndex get = startColumnU[iColumn] - numberInColumnPlus[iColumn]; startColumnU[iColumn] = put + numberInColumnPlus[iColumn]; CoinSimplexInt *indexRow = indexRowU; CoinFactorizationDouble *element = elementU; CoinSimplexInt i = 0; if ( ( number & 1 ) != 0 ) { element[put] = element[get]; indexRow[put] = indexRow[get]; #if BOTH_WAYS #endif i = 1; } for ( ; i < number; i += 2 ) { CoinFactorizationDouble value0 = element[get + i]; CoinFactorizationDouble value1 = element[get + i + 1]; CoinSimplexInt index0 = indexRow[get + i]; CoinSimplexInt index1 = indexRow[get + i + 1]; element[put + i] = value0; element[put + i + 1] = value1; indexRow[put + i] = index0; indexRow[put + i + 1] = index1; #if BOTH_WAYS #endif } put += number; get += number; //add 2 for luck lastEntryByColumnU_ = put + extraNeeded + 2; if (lastEntryByColumnU_>lengthAreaU_) { // get more memory #ifdef CLP_DEVELOP printf("put %d, needed %d, start %d, length %d\n", put,extraNeeded,lastEntryByColumnU_, lengthAreaU_); #endif return false; } } else { //take off space lastEntryByColumnU_ = startColumnU[last] + numberInColumn[last]; } startColumnU[maximumRowsExtra_]=lastEntryByColumnU_; return true; } // getRowSpace. Gets space for one Row with given length //may have to do compression (returns true) //also moves existing vector bool CoinAbcTypeFactorization::getRowSpace ( CoinSimplexInt iRow, CoinSimplexInt extraNeeded ) { CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; CoinSimplexInt number = numberInRow[iRow]; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; CoinBigIndex space = lengthAreaU_ - lastEntryByRowU_; CoinSimplexInt * COIN_RESTRICT nextRow = nextRowAddress_; CoinSimplexInt * COIN_RESTRICT lastRow = lastRowAddress_; CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; if ( space < extraNeeded + number + 2 ) { //compression CoinSimplexInt iRow = nextRow[numberRows_]; CoinBigIndex put = 0; while ( iRow != numberRows_ ) { //move CoinBigIndex get = startRowU[iRow]; CoinBigIndex getEnd = startRowU[iRow] + numberInRow[iRow]; startRowU[iRow] = put; if (put>get) { //need more space //if we can allocate bigger then do so and copy //if not then return so code can start again status_ = -99; return false;; } CoinBigIndex i; for ( i = get; i < getEnd; i++ ) { indexColumnU[put] = indexColumnU[i]; #if BOTH_WAYS #endif put++; } iRow = nextRow[iRow]; } /* endwhile */ numberCompressions_++; lastEntryByRowU_ = put; space = lengthAreaU_ - put; if ( space < extraNeeded + number + 2 ) { //need more space //if we can allocate bigger then do so and copy //if not then return so code can start again status_ = -99; return false;; } } CoinBigIndex put = lastEntryByRowU_; CoinSimplexInt next = nextRow[iRow]; CoinSimplexInt last = lastRow[iRow]; //out nextRow[last] = next; lastRow[next] = last; //in at end last = lastRow[numberRows_]; nextRow[last] = iRow; lastRow[numberRows_] = iRow; lastRow[iRow] = last; nextRow[iRow] = numberRows_; //move CoinBigIndex get = startRowU[iRow]; startRowU[iRow] = put; while ( number ) { number--; indexColumnU[put] = indexColumnU[get]; #if BOTH_WAYS #endif put++; get++; } /* endwhile */ //add 4 for luck lastEntryByRowU_ = put + extraNeeded + 4; return true; } // cleanup. End of factorization void CoinAbcTypeFactorization::cleanup ( ) { #ifdef ABC_USE_FUNCTION_POINTERS #define PRINT_LEVEL 0 if (PRINT_LEVEL){ printf("----------Start---------\n"); #if PRINT_LEVEL<2 double smallestP=COIN_DBL_MAX; int iPs=-1; double largestP=0.0; int iP=-1; double largestL=0.0; int iL=-1; double largestU=0.0; int iU=-1; #endif for (int i=0;i1 printf("%d permute %d pivotColumn %d pivotRegion %g\n",i,permuteAddress_[i], pivotColumnAddress_[i],pivotRegionAddress_[i]); #else if (fabs(pivotRegionAddress_[i])>largestP) { iP=i; largestP=fabs(pivotRegionAddress_[i]); } if (fabs(pivotRegionAddress_[i])1 printf("pivot %d offset %d number %d\n",i,scatter.offset,number); #endif const CoinFactorizationDouble * COIN_RESTRICT area = elementUColumnPlus+scatter.offset; const CoinBigIndex * COIN_RESTRICT indices = reinterpret_cast(area+number); #if PRINT_LEVEL>1 for (int j1 = 0; j1 < number; j1+=5 ) { for (int j = j1; j < CoinMin(number,j1+5); j++ ) printf("(%d,%g) ",indices[j],area[j]); printf("\n"); } #else for (int j = 0; j < number; j++ ) if (fabs(area[j])>largestU) { iU=i; largestU=fabs(area[j]); } #endif } printf("----------LLL---------\n"); CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowLAddress_; CoinFactorizationDouble * COIN_RESTRICT elementL = elementLAddress_; for (int i=0;i1 int * indices = indexRowL+startColumnL[i]; printf("%d has %d elements\n",i,number); for (int j1 = 0; j1 < number; j1+=5 ) { for (int j = j1; j < CoinMin(number,j1+5); j++ ) printf("(%d,%g) ",indices[j],elementL[j+startColumnL[i]]); printf("\n"); } #else for (int j = 0; j < number; j++ ) { if (fabs(elementL[j+startColumnL[i]])>largestL) { iL=i; largestL=fabs(elementL[j+startColumnL[i]]); } } #endif } } #if PRINT_LEVEL<2 printf("smallest pivot %g at %d, largest %g at %d - largestL %g at %d largestU %g at %d\n",smallestP,iPs,largestP,iP,largestL,iL,largestU,iU); #endif printf("----------End---------\n"); } #endif #ifdef ABC_ORDERED_FACTORIZATION { //int sizeL=0; //int sizeU=0; CoinSimplexInt * COIN_RESTRICT permuteA = permuteAddress_+maximumRowsExtra_+1; CoinSimplexInt * COIN_RESTRICT permuteB = permuteA + numberRows_; // one may be correct for (int i=0;i(area+number); for (int j = 0; j < number; j++ ) { int iRow=indices[j]; indices[j]=permuteA[iRow]; } } CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowLAddress_; CoinFactorizationDouble * COIN_RESTRICT elementL = elementLAddress_; for (int i=0;i=0&&permute[i]=numberRows_) printf("Bad a %d %d\n",i,k); assert(k>=0&&kpivotLOrder(); CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; bool cleanCopy=false; #if ABC_SMALL<2 assert (numberGoodU_==numberRows_); if (numberGoodU_==numberRows_) { #ifndef ABC_USE_FUNCTION_POINTERS const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnPlusAddress_; CoinFactorizationDouble * elementU = elementUAddress_; CoinFactorizationDouble * elementU2 = elementRowUAddress_; CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; CoinSimplexInt * COIN_RESTRICT indexRowU2 = indexColumnUAddress_; // so that just slacks will have start of 0 CoinBigIndex size=1; for (int i=0;i> 1 ); //compress // Redo total elements totalElements_=0; for (int i = 0; i < numberRows_; i++ ) { CoinSimplexInt number = numberInColumnPlus[i]; totalElements_ += number; startColumnU[i] -= number; } } #endif // swap arrays numberInColumn_.swap(numberInColumnPlus_); numberInColumnAddress_ = numberInColumn_.array(); numberInColumnPlusAddress_ = numberInColumnPlus_.array(); CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; #if ABC_SMALL<2 numberInColumnPlus = numberInColumnPlusAddress_; #endif //make column starts OK //for best cache behavior get in order (last pivot at bottom of space) //that will need thinking about lastEntryByRowU_ = totalElements_; CoinSimplexInt * COIN_RESTRICT back = firstCountAddress_+numberRows_; CoinBigIndex * COIN_RESTRICT startRow = startRowUAddress_; #ifndef ABC_USE_FUNCTION_POINTERS maximumU_=startColumnU[numberRows_-1]+numberInColumn[numberRows_-1]; #else maximumU_=lastEntryByColumnUPlus_; #endif #ifndef ABC_ORDERED_FACTORIZATION CoinFactorizationDouble * COIN_RESTRICT workArea = workAreaAddress_; CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; #else CoinSimplexInt * COIN_RESTRICT permuteA = permuteAddress_+maximumRowsExtra_+1; // use work area for scatter scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn(); scatterStruct * COIN_RESTRICT scatterPointerTemp = reinterpret_cast(workAreaAddress_); #endif for (CoinSimplexInt i=0;ipivotLOrder(),pivotLOrder,numberRows_*sizeof(int)); // swap later CoinAbcMemcpy(startColumnU,startRow,numberRows_); CoinAbcMemcpy(numberInColumn,numberInRow,numberRows_); #endif #if ABC_DENSE_CODE==2 if (numberDense_) { assert (numberDense_<30000); CoinFactorizationDouble * COIN_RESTRICT denseArea = denseAreaAddress_; CoinFactorizationDouble * COIN_RESTRICT denseRegion = denseArea+leadingDimension_*numberDense_; CoinSimplexInt * COIN_RESTRICT densePermute= reinterpret_cast(denseRegion+FACTOR_CPU*numberDense_); short * COIN_RESTRICT forFtran = reinterpret_cast(densePermute+numberDense_); short * COIN_RESTRICT forBtran = forFtran+numberDense_; short * COIN_RESTRICT forFtran2 = forBtran+numberDense_; // maybe could do inside dgetrf //CoinAbcMemcpy(forBtran,pivotLOrder+numberRows_-numberDense_,numberDense_); //CoinAbcMemcpy(forFtran,pivotLOrder+numberRows_-numberDense_,numberDense_); for (int i=0;i(i); forFtran[i]=static_cast(i); } for (int i=0;i=0;i--) { int ip=densePermute[i]; short temp=forFtran[i]; forFtran[i]=forFtran[ip]; forFtran[ip]=temp; } #if ABC_SMALL<3 const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_; int lastSparse=numberRows_-numberDense_; forFtran -= lastSparse; // adjust CoinFillN(forFtran2,numberRows_,static_cast(-1)); for (int i=0;i=lastSparse) { short kRow = static_cast(forFtran[jRow]); forFtran2[i]=kRow; } } #endif } #endif CoinAbcMemset0(numberInRow,numberRows_+1); if ( (messageLevel_ & 8)) { std::cout<<" length of U "<=0 if (maximumU_>10*numberRows_||numberRows_<200) { // NO numberInColumnPlus_.conditionalDelete() ; numberInColumnPlusAddress_=NULL; setNoGotRCopy(); } else { #endif setYesGotRCopy(); for (int i = 0; i < numberRows_; i++ ) { lastColumn[i] = i - 1; nextColumn[i] = i + 1; numberInColumnPlus[i]=0; #if ABC_SMALL>=0 } #endif nextColumn[numberRows_ - 1] = maximumRowsExtra_; lastColumn[maximumRowsExtra_] = numberRows_ - 1; nextColumn[maximumRowsExtra_] = 0; lastColumn[0] = maximumRowsExtra_; } #endif numberU_ = numberGoodU_; numberL_ = numberGoodL_; CoinSimplexInt firstReal = numberSlacks_; CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; // We should know how many in L //CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowLAddress_; for (firstReal = numberSlacks_; firstReal= needed ) { lengthR_ = 0; lengthAreaR_ = space; } else { lengthR_ = 0; lengthAreaR_ = space; if ((messageLevel_&4)) std::cout<<"Factorization may need some increasing area space" <1.0) { double dense = numberDense_; dense *= dense; double withoutDense = totalElements_ - dense +1.0; factor *= 1.0 +dense/withoutDense; } #endif return factor; } // checkConsistency. Checks that row and column copies look OK void CoinAbcTypeFactorization::checkConsistency ( ) { bool bad = false; CoinSimplexInt iRow; CoinBigIndex * startRowU = startRowUAddress_; CoinSimplexInt * numberInRow = numberInRowAddress_; CoinSimplexInt * numberInColumn = numberInColumnAddress_; CoinSimplexInt * indexColumnU = indexColumnUAddress_; CoinSimplexInt * indexRowU = indexRowUAddress_; CoinBigIndex * startColumnU = startColumnUAddress_; for ( iRow = 0; iRow < numberRows_; iRow++ ) { if ( numberInRow[iRow] ) { CoinBigIndex startRow = startRowU[iRow]; CoinBigIndex endRow = startRow + numberInRow[iRow]; CoinBigIndex j; for ( j = startRow; j < endRow; j++ ) { CoinSimplexInt iColumn = indexColumnU[j]; CoinBigIndex startColumn = startColumnU[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumn[iColumn]; bool found = false; CoinBigIndex k; for ( k = startColumn; k < endColumn; k++ ) { if ( indexRowU[k] == iRow ) { found = true; break; } } if ( !found ) { bad = true; std::cout << "row " << iRow << " column " << iColumn << " Rows" << std::endl; } } } } CoinSimplexInt iColumn; for ( iColumn = 0; iColumn < numberRows_; iColumn++ ) { if ( numberInColumn[iColumn] ) { CoinBigIndex startColumn = startColumnU[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumn[iColumn]; CoinBigIndex j; for ( j = startColumn; j < endColumn; j++ ) { CoinSimplexInt iRow = indexRowU[j]; CoinBigIndex startRow = startRowU[iRow]; CoinBigIndex endRow = startRow + numberInRow[iRow]; bool found = false; CoinBigIndex k; for ( k = startRow; k < endRow; k++ ) { if ( indexColumnU[k] == iColumn ) { found = true; break; } } if ( !found ) { bad = true; std::cout << "row " << iRow << " column " << iColumn << " Columns" << std::endl; } } } } if ( bad ) { abort ( ); } } // pivotOneOtherRow. When just one other row so faster bool CoinAbcTypeFactorization::pivotOneOtherRow ( CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn ) { CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; CoinSimplexInt COIN_RESTRICT numberInPivotRow = numberInRow[pivotRow] - 1; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinBigIndex startColumn = startColumnU[pivotColumn]; CoinBigIndex startRow = startRowU[pivotRow]; CoinBigIndex endRow = startRow + numberInPivotRow + 1; //take out this bit of indexColumnU CoinSimplexInt * COIN_RESTRICT nextRow = nextRowAddress_; CoinSimplexInt * COIN_RESTRICT lastRow = lastRowAddress_; CoinSimplexInt next = nextRow[pivotRow]; CoinSimplexInt last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; lastRow[pivotRow] = -2; #ifdef SMALL_PERMUTE int realPivotRow=fromSmallToBigRow_[pivotRow]; //int realPivotColumn=fromSmallToBigColumn[pivotColumn]; #endif #ifdef SMALL_PERMUTE permuteAddress_[realPivotRow]=numberGoodU_; #else permuteAddress_[pivotRow]=numberGoodU_; #endif numberInRow[pivotRow] = 0; #if ABC_SMALL<2 // temp - switch off marker for valid row/column lookup sparseThreshold_=-2; #endif //store column in L, compress in U and take column out CoinBigIndex l = lengthL_; if ( l + 1 > lengthAreaL_ ) { //need more memory if ((messageLevel_&4)!=0) std::cout << "more memory needed in middle of invert" << std::endl; return false; } //l+=currentAreaL_->elementByColumn-elementL_; //CoinBigIndex lSave=l; CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; CoinFactorizationDouble * COIN_RESTRICT elementL = elementLAddress_; CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowLAddress_; startColumnL[numberGoodL_] = l; //for luck and first time numberGoodL_++; startColumnL[numberGoodL_] = l + 1; lengthL_++; CoinFactorizationDouble pivotElement; CoinFactorizationDouble otherMultiplier; CoinSimplexInt otherRow; CoinSimplexInt * COIN_RESTRICT saveColumn = saveColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; if ( indexRowU[startColumn] == pivotRow ) { pivotElement = elementU[startColumn]; otherMultiplier = elementU[startColumn + 1]; otherRow = indexRowU[startColumn + 1]; } else { pivotElement = elementU[startColumn + 1]; otherMultiplier = elementU[startColumn]; otherRow = indexRowU[startColumn]; } CoinSimplexInt numberSave = numberInRow[otherRow]; CoinFactorizationDouble pivotMultiplier = 1.0 / pivotElement; CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; pivotRegion[numberGoodU_] = pivotMultiplier; numberInColumn[pivotColumn] = 0; otherMultiplier = otherMultiplier * pivotMultiplier; #ifdef SMALL_PERMUTE indexRowL[l] = fromSmallToBigRow_[otherRow]; #else indexRowL[l] = otherRow; #endif elementL[l] = otherMultiplier; //take out of row list CoinBigIndex start = startRowU[otherRow]; CoinBigIndex end = start + numberSave; CoinBigIndex where = start; CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; while ( indexColumnU[where] != pivotColumn ) { where++; } /* endwhile */ assert ( where < end ); #if BOTH_WAYS #endif end--; indexColumnU[where] = indexColumnU[end]; CoinSimplexInt numberAdded = 0; CoinSimplexInt numberDeleted = 0; //pack down and move to work CoinSimplexInt j; const CoinSimplexInt * COIN_RESTRICT nextCount = this->nextCountAddress_; CoinSimplexInt * COIN_RESTRICT nextColumn = nextColumnAddress_; for ( j = startRow; j < endRow; j++ ) { CoinSimplexInt iColumn = indexColumnU[j]; if ( iColumn != pivotColumn ) { CoinBigIndex startColumn = startColumnU[iColumn]; CoinSimplexInt numberInColumnIn=numberInColumn[iColumn]; CoinBigIndex endColumn = startColumn + numberInColumnIn; CoinSimplexInt iRow = indexRowU[startColumn]; CoinFactorizationDouble value = elementU[startColumn]; CoinFactorizationDouble largest; bool foundOther = false; //leave room for pivot CoinBigIndex put = startColumn + 1; CoinBigIndex positionLargest = -1; CoinFactorizationDouble thisPivotValue = 0.0; CoinFactorizationDouble otherElement = 0.0; CoinFactorizationDouble nextValue = elementU[put];; CoinSimplexInt nextIRow = indexRowU[put]; //compress column and find largest not updated if ( iRow != pivotRow ) { if ( iRow != otherRow ) { largest = fabs ( value ); elementU[put] = value; indexRowU[put] = iRow; positionLargest = put; #if BOTH_WAYS #endif put++; CoinBigIndex i; for ( i = startColumn + 1; i < endColumn; i++ ) { iRow = nextIRow; value = nextValue; nextIRow = indexRowU[i + 1]; nextValue = elementU[i + 1]; if ( iRow != pivotRow ) { if ( iRow != otherRow ) { //keep indexRowU[put] = iRow; elementU[put] = value;; #if BOTH_WAYS #endif put++; } else { otherElement = value; foundOther = true; } } else { thisPivotValue = value; } } } else { otherElement = value; foundOther = true; //need to find largest largest = 0.0; CoinBigIndex i; for ( i = startColumn + 1; i < endColumn; i++ ) { iRow = nextIRow; value = nextValue; nextIRow = indexRowU[i + 1]; nextValue = elementU[i + 1]; if ( iRow != pivotRow ) { //keep indexRowU[put] = iRow; elementU[put] = value;; #if BOTH_WAYS #endif CoinFactorizationDouble absValue = fabs ( value ); if ( absValue > largest ) { largest = absValue; positionLargest = put; } put++; } else { thisPivotValue = value; } } } } else { //need to find largest largest = 0.0; thisPivotValue = value; CoinBigIndex i; for ( i = startColumn + 1; i < endColumn; i++ ) { iRow = nextIRow; value = nextValue; nextIRow = indexRowU[i + 1]; nextValue = elementU[i + 1]; if ( iRow != otherRow ) { //keep indexRowU[put] = iRow; elementU[put] = value;; #if BOTH_WAYS #endif CoinFactorizationDouble absValue = fabs ( value ); if ( absValue > largest ) { largest = absValue; positionLargest = put; } put++; } else { otherElement = value; foundOther = true; } } } //slot in pivot elementU[startColumn] = thisPivotValue; #ifdef SMALL_PERMUTE indexRowU[startColumn] = realPivotRow; #else indexRowU[startColumn] = pivotRow; #endif //clean up counts startColumn++; numberInColumn[iColumn] = put - startColumn; numberInColumnPlus[iColumn]++; startColumnU[iColumn]++; otherElement = otherElement - thisPivotValue * otherMultiplier; CoinFactorizationDouble absValue = fabs ( otherElement ); if ( !TEST_LESS_THAN_TOLERANCE_REGISTER(absValue) ) { if ( !foundOther ) { //have we space saveColumn[numberAdded++] = iColumn; CoinSimplexInt next = nextColumn[iColumn]; CoinBigIndex space; space = startColumnU[next] - put - numberInColumnPlus[next]; if ( space <= 0 ) { //getColumnSpace also moves fixed part CoinSimplexInt number = numberInColumn[iColumn]; if ( !getColumnSpace ( iColumn, number + 1 ) ) { return false; } //redo starts positionLargest = positionLargest + startColumnU[iColumn] - startColumn; startColumn = startColumnU[iColumn]; put = startColumn + number; } } elementU[put] = otherElement; indexRowU[put] = otherRow; #if BOTH_WAYS #endif if ( absValue > largest ) { largest = absValue; positionLargest = put; } put++; } else { if ( foundOther ) { numberDeleted++; //take out of row list CoinBigIndex where = start; while ( indexColumnU[where] != iColumn ) { where++; } /* endwhile */ assert ( where < end ); #if BOTH_WAYS #endif end--; indexColumnU[where] = indexColumnU[end]; } } CoinSimplexInt numberInColumnOut = put - startColumn; numberInColumn[iColumn] = numberInColumnOut; //move largest if ( positionLargest >= 0 ) { value = elementU[positionLargest]; iRow = indexRowU[positionLargest]; elementU[positionLargest] = elementU[startColumn]; indexRowU[positionLargest] = indexRowU[startColumn]; elementU[startColumn] = value; indexRowU[startColumn] = iRow; #if BOTH_WAYS #endif } //linked list for column if ( numberInColumnIn!=numberInColumnOut&&nextCount[iColumn + numberRows_] != -2 ) { //modify linked list modifyLink ( iColumn + numberRows_, numberInColumnOut ); } } } //get space for row list next = nextRow[otherRow]; CoinBigIndex space; space = startRowU[next] - end; totalElements_ += numberAdded - numberDeleted; CoinSimplexInt number = numberAdded + ( end - start ); if ( space < numberAdded ) { numberInRow[otherRow] = end - start; if ( !getRowSpace ( otherRow, number ) ) { return false; } end = startRowU[otherRow] + end - start; } // do linked lists and update counts numberInRow[otherRow] = number; if ( number != numberSave ) { modifyLink ( otherRow, number ); } for ( j = 0; j < numberAdded; j++ ) { #if BOTH_WAYS #endif indexColumnU[end++] = saveColumn[j]; } lastEntryByRowU_ = CoinMax(end,lastEntryByRowU_); assert (lastEntryByRowU_<=lengthAreaU_); //modify linked list for pivots deleteLink ( pivotRow ); deleteLink ( pivotColumn + numberRows_ ); return true; } // Delete all stuff void CoinAbcTypeFactorization::almostDestructor() { gutsOfDestructor(1); } // PreProcesses column ordered copy of basis void CoinAbcTypeFactorization::preProcess ( ) { CoinBigIndex numberElements = startColumnUAddress_[numberRows_-1] + numberInColumnAddress_[numberRows_-1]; setNumberElementsU(numberElements); } // Return largest double CoinAbcTypeFactorization::preProcess3 ( ) { CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; CoinBigIndex * COIN_RESTRICT startRow = startRowUAddress_; CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_; totalElements_ = lengthU_; //links and initialize pivots CoinZeroN ( numberInColumn+numberRows_, maximumRowsExtra_ + 1 - numberRows_); CoinSimplexInt * COIN_RESTRICT lastRow = lastRowAddress_; CoinSimplexInt * COIN_RESTRICT nextRow = nextRowAddress_; CoinFillN ( pivotColumnAddress_, numberRows_, -1 ); CoinZeroN ( numberInColumnPlus, maximumRowsExtra_ + 1 ); CoinZeroN ( lastRow, numberRows_ ); startColumn[maximumRowsExtra_] = lengthU_; lastEntryByColumnU_=lengthU_; lastEntryByRowU_=lengthU_; //do slacks first //CoinBigIndex * startColumnU = startColumnUAddress_; CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; //CoinSimplexInt * COIN_RESTRICT indexColumn = indexColumnUAddress_; CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; CoinSimplexInt * COIN_RESTRICT pivotColumn = pivotColumnAddress_; //CoinFillN(pivotRegion,numberSlacks_,static_cast(SLACK_VALUE)); // **************** TEMP ********************* CoinFillN(pivotRegion,numberSlacks_,static_cast(1.0)); CoinZeroN(startColumnL,numberSlacks_+1); CoinZeroN(numberInColumn,numberSlacks_); CoinZeroN(numberInColumnPlus,numberSlacks_); #ifdef ABC_USE_FUNCTION_POINTERS // Use row copy elementUColumnPlusAddress_ = elementRowU_.array(); scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); #if ABC_USE_FUNCTION_POINTERS extern scatterUpdate AbcScatterLowSubtract[9]; #endif lastEntryByColumnUPlus_=1; //for (int i=0;i1 CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #ifdef SMALL_PERMUTE CoinSimplexInt * COIN_RESTRICT fromBigToSmallRow=reinterpret_cast(saveColumn_.array()); CoinSimplexInt * COIN_RESTRICT indexColumn = indexColumnUAddress_; //move largest in column to beginning // If we always compress then can combine CoinSimplexInt * COIN_RESTRICT tempIndex = firstCountAddress_; //saveColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT workArea = workAreaAddress_; // Compress int nSmall=0; // fromBig is only used at setup time for (int i=0;i=0) { // out fromBigToSmallRow[i]=-1; } else { // in fromBigToSmallRow[i]=nSmall; numberInRow[nSmall]=numberInRow[i]; lastRow[nSmall]=lastRow[i]; fromSmallToBigRow_[nSmall++]=i; } } nSmall=0; for (CoinSimplexInt iColumn = numberSlacks_; iColumn < numberRows_; iColumn++ ) { CoinSimplexInt number = numberInColumn[iColumn]; // use workArea and tempIndex for remaining elements CoinBigIndex first = startColumn[iColumn]; int saveFirst=first; fromSmallToBigColumn_[nSmall]=iColumn; CoinBigIndex largest = -1; CoinFactorizationDouble valueLargest = -1.0; CoinSimplexInt nOther=0; CoinBigIndex end = first+number; for (CoinBigIndex k = first ; k < end; k++ ) { CoinSimplexInt iRow = indexRow[k]; assert (iRow valueLargest ) { valueLargest = valueAbs; largest = nOther; } iRow=fromBigToSmallRow[iRow]; assert (iRow>=0); tempIndex[nOther]=iRow; workArea[nOther++]=value; } else { indexRow[first] = iRow; element[first++] = value; } } CoinSimplexInt nMoved = first-saveFirst; numberInColumnPlus[nSmall]=nMoved; totalElements_ -= nMoved; startColumn[nSmall]=first; //largest if (largest>=0) { indexRow[first] = tempIndex[largest]; element[first++] = workArea[largest]; } for (CoinBigIndex k=0;k valueLargest ) { valueLargest = valueAbs; largest = nOther; } tempIndex[nOther]=iRow; workArea[nOther++]=value; #if CONVERTROW<2 CoinSimplexInt iLook = startRow[iRow]; startRow[iRow] = iLook + 1; indexColumn[iLook] = iColumn; #endif #if BOTH_WAYS #endif } else { indexRow[first] = iRow; #if BOTH_WAYS #endif element[first++] = value; } } overallLargest=CoinMax(overallLargest,valueLargest); CoinSimplexInt nMoved = first-startColumn[iColumn]; numberInColumnPlus[iColumn]=nMoved; totalElements_ -= nMoved; startColumn[iColumn]=first; //largest if (largest>=0) { #if CONVERTROW>1 int iRow=tempIndex[largest]; indexRow[first] = iRow; CoinSimplexInt iLook = startRow[iRow]; startRow[iRow] = iLook + 1; indexColumn[iLook] = iColumn; convertRowToColumn[iLook]=first; convertColumnToRow[first]=iLook; #else indexRow[first] = tempIndex[largest]; #endif #if BOTH_WAYS #endif element[first++] = workArea[largest]; } for (CoinBigIndex k=0;k1 int iRow=tempIndex[k]; indexRow[first] = iRow; CoinSimplexInt iLook = startRow[iRow]; startRow[iRow] = iLook + 1; indexColumn[iLook] = iColumn; convertRowToColumn[iLook]=first; convertColumnToRow[first]=iLook; #else indexRow[first] = tempIndex[k]; #endif #if BOTH_WAYS #endif element[first++] = workArea[k]; } } numberInColumn[iColumn]=first-startColumn[iColumn]; } #else #if CONVERTROW>1 for (CoinSimplexInt iColumn = 0; iColumn < numberRowsSmall_; iColumn++ ) { CoinSimplexInt number = numberInColumn[iColumn]; CoinBigIndex first = startColumn[iColumn]; CoinBigIndex end = first+number; for (CoinBigIndex k = first ; k < end; k++ ) { CoinSimplexInt iRow = indexRow[k]; CoinSimplexInt iLook = startRow[iRow]; startRow[iRow] = iLook + 1; indexColumn[iLook] = iColumn; convertRowToColumn[iLook]=k; convertColumnToRow[k]=iLook; } } #endif #endif for (CoinSimplexInt iRow=numberRowsSmall_-1;iRow>0;iRow--) startRow[iRow]=startRow[iRow-1]; startRow[0]=0; // Do links (do backwards to get rows first?) CoinSimplexInt * firstCount=tempIndex; for (int i=0;ipivotLOrderAddress_; CoinSimplexInt * COIN_RESTRICT pivotLinkedForwards = this->pivotLinkedForwardsAddress_; CoinSimplexInt * COIN_RESTRICT pivotLinkedBackwards = this->pivotLinkedBackwardsAddress_; CoinSimplexInt iThis=-1; for (int i=0;i=0;i--) { #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt iNext=pivotLOrder[i]; #else CoinSimplexInt iNext=i; #endif pivotLinkedBackwards[iThis]=iNext; iThis=iNext; } pivotLinkedBackwards[iThis]=-1; pivotLinkedBackwards[-1]=-2; #if 0 //ndef NDEBUG { char * test = new char[numberRows_]; memset(test,0,numberRows_); CoinBigIndex * COIN_RESTRICT startColumnL = startColumnLAddress_; CoinSimplexInt * COIN_RESTRICT indexRowL = indexRowLAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_; //CoinSimplexInt * COIN_RESTRICT pivotLOrder = firstCountAddress_; //const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_; for (int i=0;i=0&&iRow(area+number); for (int j = 0; j < number; j++ ) { CoinSimplexInt iRow = indices[j]; assert (iRow>=0&&iRow2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif #ifndef ABC_USE_FUNCTION_POINTERS CoinZeroN ( numberInRow, numberRows_+1 ); for (CoinSimplexInt i = 0; i < numberRows_; i++ ) { CoinBigIndex start = startColumnU[i]; CoinBigIndex end = start + numberInColumn[i]; CoinFactorizationDouble pivotValue = pivotRegion[i]; CoinBigIndex j; for ( j = start; j < end; j++ ) { CoinSimplexInt iRow = indexRowU[j]; CoinSimplexInt iLook = numberInRow[iRow]; numberInRow[iRow] = iLook + 1; CoinBigIndex k = startRow[iRow] + iLook; indexColumnU[k] = i; #if CONVERTROW convertRowToColumn[k] = j-start; #if CONVERTROW>2 convertColumnToRow[j] = k; #endif #endif //multiply by pivot elementU[j] *= pivotValue; elementRow[k] = elementU[j]; } } #else for (CoinSimplexInt i = 0; i < numberRows_; i++ ) { scatterStruct & COIN_RESTRICT scatter = scatterPointer[i]; CoinSimplexInt number = scatter.number; const CoinFactorizationDouble * COIN_RESTRICT area = elementUColumnPlus+scatter.offset; const CoinBigIndex * COIN_RESTRICT indices = reinterpret_cast(area+number); for (int j = 0; j < number; j++ ) { CoinSimplexInt iRow = indices[j]; CoinBigIndex k = startRow[iRow]; startRow[iRow]=k+1; indexColumnU[k] = i; #if CONVERTROW convertRowToColumn[k] = j; #if CONVERTROW>2 convertColumnToRow[j+startColumnU[i]] = k; abort(); // fix #endif #endif //CoinFactorizationDouble pivotValue = pivotRegion[i]; //multiply by pivot //elementU[j+startColumnU[i]] *= pivotValue; elementRow[k] = area[j]; } } #endif //CoinSimplexInt * COIN_RESTRICT nextRow = nextRowAddress_; //CoinSimplexInt * COIN_RESTRICT lastRow = lastRowAddress_; for (int j = numberRows_-1; j >=0; j-- ) { lastRow[j] = j - 1; nextRow[j] = j + 1; #ifdef ABC_USE_FUNCTION_POINTERS startRow[j+1]=startRow[j]; #endif } startRow[0]=0; nextRow[numberRows_ - 1] = numberRows_; lastRow[numberRows_] = numberRows_ - 1; nextRow[numberRows_] = 0; lastRow[0] = numberRows_; //memcpy(firstCountAddress_+numberRows_+1,pivotLinkedBackwards-1,(numberRows_+2)*sizeof(int)); } else { #endif #ifndef ABC_USE_FUNCTION_POINTERS for (CoinSimplexInt i = 0; i < numberRows_; i++ ) { CoinBigIndex start = startColumnU[i]; CoinBigIndex end = start + numberInColumn[i]; CoinFactorizationDouble pivotValue = pivotRegion[i]; CoinBigIndex j; for ( j = start; j < end; j++ ) { //multiply by pivot elementU[j] *= pivotValue; } } #endif #if ABC_SMALL<2 } #endif #ifdef ABC_USE_FUNCTION_POINTERS #if 0 { CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); extern scatterUpdate AbcScatterLowSubtract[9]; extern scatterUpdate AbcScatterHighSubtract[4]; for (int iRow=0;iRow(area+number); CoinSimplexInt * COIN_RESTRICT indices2 = indexRow+startColumnU[iRow]; CoinFactorizationDouble * COIN_RESTRICT area2 = element+startColumnU[iRow]; assert (number==numberInColumn[iRow]); if (number<9) assert (scatter[iRow].functionPointer==AbcScatterLowSubtract[number]); else assert (scatter[iRow].functionPointer==AbcScatterHighSubtract[number&3]); for (int i=0;i=0); workArea[iOriginal]=i; } CoinSimplexInt iRow=0; for (CoinSimplexInt i=0;i=0) iRow++; assert (iRow=0&&indexRowUAddress_[j]-1.0e50&&elementUAddress_[j]<1.0e50); std::cout << indexRowUAddress_[j] << " " << elementUAddress_[j] << std::endl; } } for ( i = 0; i < numberRows_; i++ ) { std::cout << "l " << i << " " << startColumnLAddress_[i + 1] - startColumnLAddress_[i] << std::endl; CoinSort_2(indexRowLAddress_+startColumnLAddress_[i], indexRowLAddress_+startColumnLAddress_[i+1], elementLAddress_+startColumnLAddress_[i]); CoinSimplexInt j; for ( j = startColumnLAddress_[i]; j < startColumnLAddress_[i + 1]; j++ ) { std::cout << indexRowLAddress_[j] << " " << elementLAddress_[j] << std::endl; } } } // sort so can compare void CoinAbcTypeFactorization::sort ( ) const { CoinSimplexInt i; for ( i = 0; i < numberRows_; i++ ) { CoinSort_2(indexRowUAddress_+startColumnUAddress_[i], indexRowUAddress_+startColumnUAddress_[i]+numberInColumnAddress_[i], elementUAddress_+startColumnUAddress_[i]); } for ( i = 0; i < numberRows_; i++ ) { CoinSort_2(indexRowLAddress_+startColumnLAddress_[i], indexRowLAddress_+startColumnLAddress_[i+1], elementLAddress_+startColumnLAddress_[i]); } } #ifdef CHECK_LINKS //static int ixxxxxx=0; void CoinAbcTypeFactorization::checkLinks(int type) { //if (type<1) return; #if 0 //ABC_SMALL<2 if (numberRowsSmall_!=5698) return; ixxxxxx++; if (fromSmallToBigRow_[3195]==3581) { if (permuteAddress_[3581]>=0) { assert (numberInRowAddress_[3195]==0); CoinSimplexInt * numberInColumn = numberInColumnAddress_; CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_; for (int i=startColumn[1523];i=7615900) { printf("trouble ahead\n"); } return; if (ixxxxxx<406245) return; #endif CoinSimplexInt * COIN_RESTRICT nextCount = this->nextCount(); CoinSimplexInt * COIN_RESTRICT firstCount = this->firstCount(); CoinSimplexInt * COIN_RESTRICT lastCount = this->lastCount(); CoinSimplexInt * numberInColumn = numberInColumnAddress_; CoinSimplexInt * numberInRow = numberInRowAddress_; if (type) { int nBad=0; CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; CoinSimplexInt * COIN_RESTRICT indexColumn = indexColumnUAddress_; CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_; CoinBigIndex * COIN_RESTRICT startRow = startRowUAddress_; for (int i=0;i=0&&iRow=lastStart); lastStart=iStart; list1[iRow]=1; iRow=nextRow[iRow]; } for (int i=0;i=0&&iColumn=lastStart); lastStart=iStart; list1[iColumn]=1; iColumn=nextColumn[iColumn]; } int nEnd=0; for (int i=0;i1) { for (int i=0;i=0) { #if VERBOSE count++; if (iCount<=VERBOSE) { if (next=0) assert (next2==lastCount[next]); } #if VERBOSE if (count) printf("%d items have count %d\n",count,iCount); #endif } delete [] mark; } #endif #endif CoinMP-1.8.3/Clp/src/ClpFactorization.cpp0000644000175000017500000041160712466430227016617 0ustar renerene/* $Id: ClpFactorization.cpp 2116 2015-02-10 16:23:51Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpFactorization.hpp" #ifndef SLIM_CLP #include "ClpQuadraticObjective.hpp" #endif #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "ClpSimplex.hpp" #include "ClpSimplexDual.hpp" #include "ClpMatrixBase.hpp" #ifndef SLIM_CLP #include "ClpNetworkBasis.hpp" #include "ClpNetworkMatrix.hpp" //#define CHECK_NETWORK #ifdef CHECK_NETWORK const static bool doCheck = true; #else const static bool doCheck = false; #endif #endif #ifndef CLP_FACTORIZATION_NEW_TIMING #define CLP_FACTORIZATION_NEW_TIMING #endif #ifdef CLP_FACTORIZATION_INSTRUMENT #include "CoinTime.hpp" double factorization_instrument(int type) { static int times[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static double startTime = 0.0; static double totalTimes [10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; if (type < 0) { assert (!startTime); startTime = CoinCpuTime(); return 0.0; } else if (type > 0) { times[type]++; double difference = CoinCpuTime() - startTime; totalTimes[type] += difference; startTime = 0.0; return difference; } else { // report const char * types[10] = { "", "fac=rhs_etc", "factorize", "replace", "update_FT", "update", "update_transpose", "gosparse", "getWeights!", "update2_FT" }; double total = 0.0; for (int i = 1; i < 10; i++) { if (times[i]) { printf("%s was called %d times taking %g seconds\n", types[i], times[i], totalTimes[i]); total += totalTimes[i]; times[i] = 0; totalTimes[i] = 0.0; } } return total; } } #endif //############################################################################# // Constructors / Destructor / Assignment //############################################################################# #ifndef CLP_MULTIPLE_FACTORIZATIONS //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpFactorization::ClpFactorization () : CoinFactorization() { #ifndef SLIM_CLP networkBasis_ = NULL; #endif } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpFactorization::ClpFactorization (const ClpFactorization & rhs, int dummyDenseIfSmaller) : CoinFactorization(rhs) { #ifndef SLIM_CLP if (rhs.networkBasis_) networkBasis_ = new ClpNetworkBasis(*(rhs.networkBasis_)); else networkBasis_ = NULL; #endif } ClpFactorization::ClpFactorization (const CoinFactorization & rhs) : CoinFactorization(rhs) { #ifndef SLIM_CLP networkBasis_ = NULL; #endif } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpFactorization::~ClpFactorization () { #ifndef SLIM_CLP delete networkBasis_; #endif } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpFactorization & ClpFactorization::operator=(const ClpFactorization& rhs) { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif if (this != &rhs) { CoinFactorization::operator=(rhs); #ifndef SLIM_CLP delete networkBasis_; if (rhs.networkBasis_) networkBasis_ = new ClpNetworkBasis(*(rhs.networkBasis_)); else networkBasis_ = NULL; #endif } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(1); #endif return *this; } #if 0 static unsigned int saveList[10000]; int numberSave = -1; inline bool isDense(int i) { return ((saveList[i>>5] >> (i & 31)) & 1) != 0; } inline void setDense(int i) { unsigned int & value = saveList[i>>5]; int bit = i & 31; value |= (1 << bit); } #endif int ClpFactorization::factorize ( ClpSimplex * model, int solveType, bool valuesPass) { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif ClpMatrixBase * matrix = model->clpMatrix(); int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); if (!numberRows) return 0; // If too many compressions increase area if (numberPivots_ > 1 && numberCompressions_ * 10 > numberPivots_ + 10) { areaFactor_ *= 1.1; } //int numberPivots=numberPivots_; #if 0 if (model->algorithm() > 0) numberSave = -1; #endif #ifndef SLIM_CLP if (!networkBasis_ || doCheck) { #endif status_ = -99; int * pivotVariable = model->pivotVariable(); //returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */ while (status_ < -98) { int i; int numberBasic = 0; int numberRowBasic; // Move pivot variables across if they look good int * pivotTemp = model->rowArray(0)->getIndices(); assert (!model->rowArray(0)->getNumElements()); if (!matrix->rhsOffset(model)) { #if 0 if (numberSave > 0) { int nStill = 0; int nAtBound = 0; int nZeroDual = 0; CoinIndexedVector * array = model->rowArray(3); CoinIndexedVector * objArray = model->columnArray(1); array->clear(); objArray->clear(); double * cost = model->costRegion(); double tolerance = model->primalTolerance(); double offset = 0.0; for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot < numberColumns && isDense(iPivot)) { if (model->getColumnStatus(iPivot) == ClpSimplex::basic) { nStill++; double value = model->solutionRegion()[iPivot]; double dual = model->dualRowSolution()[i]; double lower = model->lowerRegion()[iPivot]; double upper = model->upperRegion()[iPivot]; ClpSimplex::Status status; if (fabs(value - lower) < tolerance) { status = ClpSimplex::atLowerBound; nAtBound++; } else if (fabs(value - upper) < tolerance) { nAtBound++; status = ClpSimplex::atUpperBound; } else if (value > lower && value < upper) { status = ClpSimplex::superBasic; } else { status = ClpSimplex::basic; } if (status != ClpSimplex::basic) { if (model->getRowStatus(i) != ClpSimplex::basic) { model->setColumnStatus(iPivot, ClpSimplex::atLowerBound); model->setRowStatus(i, ClpSimplex::basic); pivotVariable[i] = i + numberColumns; model->dualRowSolution()[i] = 0.0; model->djRegion(0)[i] = 0.0; array->add(i, dual); offset += dual * model->solutionRegion(0)[i]; } } if (fabs(dual) < 1.0e-5) nZeroDual++; } } } printf("out of %d dense, %d still in basis, %d at bound, %d with zero dual - offset %g\n", numberSave, nStill, nAtBound, nZeroDual, offset); if (array->getNumElements()) { // modify costs model->clpMatrix()->transposeTimes(model, 1.0, array, model->columnArray(0), objArray); array->clear(); int n = objArray->getNumElements(); int * indices = objArray->getIndices(); double * elements = objArray->denseVector(); for (i = 0; i < n; i++) { int iColumn = indices[i]; cost[iColumn] -= elements[iColumn]; elements[iColumn] = 0.0; } objArray->setNumElements(0); } } #endif // Seems to prefer things in order so quickest // way is to go though like this for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) pivotTemp[numberBasic++] = i; } numberRowBasic = numberBasic; /* Put column basic variables into pivotVariable This is done by ClpMatrixBase to allow override for gub */ matrix->generalExpanded(model, 0, numberBasic); } else { // Long matrix - do a different way bool fullSearch = false; for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot >= numberColumns) { pivotTemp[numberBasic++] = iPivot - numberColumns; } } numberRowBasic = numberBasic; for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot < numberColumns) { if (iPivot >= 0) { pivotTemp[numberBasic++] = iPivot; } else { // not full basis fullSearch = true; break; } } } if (fullSearch) { // do slow way numberBasic = 0; for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) pivotTemp[numberBasic++] = i; } numberRowBasic = numberBasic; /* Put column basic variables into pivotVariable This is done by ClpMatrixBase to allow override for gub */ matrix->generalExpanded(model, 0, numberBasic); } } if (numberBasic > model->maximumBasic()) { #if 0 // ndef NDEBUG printf("%d basic - should only be %d\n", numberBasic, numberRows); #endif // Take out some numberBasic = numberRowBasic; for (int i = 0; i < numberColumns; i++) { if (model->getColumnStatus(i) == ClpSimplex::basic) { if (numberBasic < numberRows) numberBasic++; else model->setColumnStatus(i, ClpSimplex::superBasic); } } numberBasic = numberRowBasic; matrix->generalExpanded(model, 0, numberBasic); } #ifndef SLIM_CLP // see if matrix a network #ifndef NO_RTTI ClpNetworkMatrix* networkMatrix = dynamic_cast< ClpNetworkMatrix*>(model->clpMatrix()); #else ClpNetworkMatrix* networkMatrix = NULL; if (model->clpMatrix()->type() == 11) networkMatrix = static_cast< ClpNetworkMatrix*>(model->clpMatrix()); #endif // If network - still allow ordinary factorization first time for laziness if (networkMatrix) biasLU_ = 0; // All to U if network //int saveMaximumPivots = maximumPivots(); delete networkBasis_; networkBasis_ = NULL; if (networkMatrix && !doCheck) maximumPivots(1); #endif //printf("L, U, R %d %d %d\n",numberElementsL(),numberElementsU(),numberElementsR()); while (status_ == -99) { // maybe for speed will be better to leave as many regions as possible gutsOfDestructor(); gutsOfInitialize(2); CoinBigIndex numberElements = numberRowBasic; // compute how much in basis int i; // can change for gub int numberColumnBasic = numberBasic - numberRowBasic; numberElements += matrix->countBasis(model, pivotTemp + numberRowBasic, numberRowBasic, numberColumnBasic); // and recompute as network side say different if (model->numberIterations()) numberRowBasic = numberBasic - numberColumnBasic; numberElements = 3 * numberBasic + 3 * numberElements + 20000; #if 0 // If iteration not zero then may be compressed getAreas ( !model->numberIterations() ? numberRows : numberBasic, numberRowBasic + numberColumnBasic, numberElements, 2 * numberElements ); #else getAreas ( numberRows, numberRowBasic + numberColumnBasic, numberElements, 2 * numberElements ); #endif //fill // Fill in counts so we can skip part of preProcess int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); CoinZeroN ( numberInRow, numberRows_ + 1 ); CoinZeroN ( numberInColumn, maximumColumnsExtra_ + 1 ); double * elementU = elementU_.array(); int * indexRowU = indexRowU_.array(); CoinBigIndex * startColumnU = startColumnU_.array(); for (i = 0; i < numberRowBasic; i++) { int iRow = pivotTemp[i]; indexRowU[i] = iRow; startColumnU[i] = i; elementU[i] = slackValue_; numberInRow[iRow] = 1; numberInColumn[i] = 1; } startColumnU[numberRowBasic] = numberRowBasic; // can change for gub so redo numberColumnBasic = numberBasic - numberRowBasic; matrix->fillBasis(model, pivotTemp + numberRowBasic, numberColumnBasic, indexRowU, startColumnU + numberRowBasic, numberInRow, numberInColumn + numberRowBasic, elementU); #if 0 { printf("%d row basic, %d column basic\n", numberRowBasic, numberColumnBasic); for (int i = 0; i < numberElements; i++) printf("row %d col %d value %g\n", indexRowU_.array()[i], indexColumnU_[i], elementU_.array()[i]); } #endif // recompute number basic numberBasic = numberRowBasic + numberColumnBasic; if (numberBasic) numberElements = startColumnU[numberBasic-1] + numberInColumn[numberBasic-1]; else numberElements = 0; lengthU_ = numberElements; //saveFactorization("dump.d"); if (biasLU_ >= 3 || numberRows_ != numberColumns_) preProcess ( 2 ); else preProcess ( 3 ); // no row copy factor ( ); if (status_ == -99) { // get more memory areaFactor(2.0 * areaFactor()); } else if (status_ == -1 && model->numberIterations() == 0 && denseThreshold_) { // Round again without dense denseThreshold_ = 0; status_ = -99; } } // If we get here status is 0 or -1 if (status_ == 0) { // We may need to tamper with order and redo - e.g. network with side int useNumberRows = numberRows; // **** we will also need to add test in dual steepest to do // as we do for network matrix->generalExpanded(model, 12, useNumberRows); const int * permuteBack = permuteBack_.array(); const int * back = pivotColumnBack_.array(); //int * pivotTemp = pivotColumn_.array(); //ClpDisjointCopyN ( pivotVariable, numberRows , pivotTemp ); // Redo pivot order for (i = 0; i < numberRowBasic; i++) { int k = pivotTemp[i]; // so rowIsBasic[k] would be permuteBack[back[i]] pivotVariable[permuteBack[back[i]]] = k + numberColumns; } for (; i < useNumberRows; i++) { int k = pivotTemp[i]; // so rowIsBasic[k] would be permuteBack[back[i]] pivotVariable[permuteBack[back[i]]] = k; } #if 0 if (numberSave >= 0) { numberSave = numberDense_; memset(saveList, 0, ((numberRows_ + 31) >> 5)*sizeof(int)); for (i = numberRows_ - numberSave; i < numberRows_; i++) { int k = pivotTemp[pivotColumn_.array()[i]]; setDense(k); } } #endif // Set up permutation vector // these arrays start off as copies of permute // (and we could use permute_ instead of pivotColumn (not back though)) ClpDisjointCopyN ( permute_.array(), useNumberRows , pivotColumn_.array() ); ClpDisjointCopyN ( permuteBack_.array(), useNumberRows , pivotColumnBack_.array() ); #ifndef SLIM_CLP if (networkMatrix) { maximumPivots(CoinMax(2000, maximumPivots())); // redo arrays for (int iRow = 0; iRow < 4; iRow++) { int length = model->numberRows() + maximumPivots(); if (iRow == 3 || model->objectiveAsObject()->type() > 1) length += model->numberColumns(); model->rowArray(iRow)->reserve(length); } // create network factorization if (doCheck) delete networkBasis_; // temp networkBasis_ = new ClpNetworkBasis(model, numberRows_, pivotRegion_.array(), permuteBack_.array(), startColumnU_.array(), numberInColumn_.array(), indexRowU_.array(), elementU_.array()); // kill off arrays in ordinary factorization if (!doCheck) { gutsOfDestructor(); // but make sure numberRows_ set numberRows_ = model->numberRows(); status_ = 0; #if 0 // but put back permute arrays so odd things will work int numberRows = model->numberRows(); pivotColumnBack_ = new int [numberRows]; permute_ = new int [numberRows]; int i; for (i = 0; i < numberRows; i++) { pivotColumnBack_[i] = i; permute_[i] = i; } #endif } } else { #endif // See if worth going sparse and when if (numberFtranCounts_ > 100) { ftranCountInput_ = CoinMax(ftranCountInput_, 1.0); ftranAverageAfterL_ = CoinMax(ftranCountAfterL_ / ftranCountInput_, 1.0); ftranAverageAfterR_ = CoinMax(ftranCountAfterR_ / ftranCountAfterL_, 1.0); ftranAverageAfterU_ = CoinMax(ftranCountAfterU_ / ftranCountAfterR_, 1.0); if (btranCountInput_ && btranCountAfterU_ && btranCountAfterR_) { btranAverageAfterU_ = CoinMax(btranCountAfterU_ / btranCountInput_, 1.0); btranAverageAfterR_ = CoinMax(btranCountAfterR_ / btranCountAfterU_, 1.0); btranAverageAfterL_ = CoinMax(btranCountAfterL_ / btranCountAfterR_, 1.0); } else { // we have not done any useful btrans (values pass?) btranAverageAfterU_ = 1.0; btranAverageAfterR_ = 1.0; btranAverageAfterL_ = 1.0; } } // scale back ftranCountInput_ *= 0.8; ftranCountAfterL_ *= 0.8; ftranCountAfterR_ *= 0.8; ftranCountAfterU_ *= 0.8; btranCountInput_ *= 0.8; btranCountAfterU_ *= 0.8; btranCountAfterR_ *= 0.8; btranCountAfterL_ *= 0.8; #ifndef SLIM_CLP } #endif } else if (status_ == -1 && (solveType == 0 || solveType == 2)) { // This needs redoing as it was merged coding - does not need array int numberTotal = numberRows + numberColumns; int * isBasic = new int [numberTotal]; int * rowIsBasic = isBasic + numberColumns; int * columnIsBasic = isBasic; for (i = 0; i < numberTotal; i++) isBasic[i] = -1; for (i = 0; i < numberRowBasic; i++) { int iRow = pivotTemp[i]; rowIsBasic[iRow] = 1; } for (; i < numberBasic; i++) { int iColumn = pivotTemp[i]; columnIsBasic[iColumn] = 1; } numberBasic = 0; for (i = 0; i < numberRows; i++) pivotVariable[i] = -1; // mark as basic or non basic const int * pivotColumn = pivotColumn_.array(); for (i = 0; i < numberRows; i++) { if (rowIsBasic[i] >= 0) { if (pivotColumn[numberBasic] >= 0) { rowIsBasic[i] = pivotColumn[numberBasic]; } else { rowIsBasic[i] = -1; model->setRowStatus(i, ClpSimplex::superBasic); } numberBasic++; } } for (i = 0; i < numberColumns; i++) { if (columnIsBasic[i] >= 0) { if (pivotColumn[numberBasic] >= 0) columnIsBasic[i] = pivotColumn[numberBasic]; else columnIsBasic[i] = -1; numberBasic++; } } // leave pivotVariable in useful form for cleaning basis int * pivotVariable = model->pivotVariable(); for (i = 0; i < numberRows; i++) { pivotVariable[i] = -1; } for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) { int iPivot = rowIsBasic[i]; if (iPivot >= 0) pivotVariable[iPivot] = i + numberColumns; } } for (i = 0; i < numberColumns; i++) { if (model->getColumnStatus(i) == ClpSimplex::basic) { int iPivot = columnIsBasic[i]; if (iPivot >= 0) pivotVariable[iPivot] = i; } } delete [] isBasic; double * columnLower = model->lowerRegion(); double * columnUpper = model->upperRegion(); double * columnActivity = model->solutionRegion(); double * rowLower = model->lowerRegion(0); double * rowUpper = model->upperRegion(0); double * rowActivity = model->solutionRegion(0); //redo basis - first take ALL columns out int iColumn; double largeValue = model->largeValue(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) == ClpSimplex::basic) { // take out if (!valuesPass) { double lower = columnLower[iColumn]; double upper = columnUpper[iColumn]; double value = columnActivity[iColumn]; if (lower > -largeValue || upper < largeValue) { if (fabs(value - lower) < fabs(value - upper)) { model->setColumnStatus(iColumn, ClpSimplex::atLowerBound); columnActivity[iColumn] = lower; } else { model->setColumnStatus(iColumn, ClpSimplex::atUpperBound); columnActivity[iColumn] = upper; } } else { model->setColumnStatus(iColumn, ClpSimplex::isFree); } } else { model->setColumnStatus(iColumn, ClpSimplex::superBasic); } } } int iRow; for (iRow = 0; iRow < numberRows; iRow++) { int iSequence = pivotVariable[iRow]; if (iSequence >= 0) { // basic if (iSequence >= numberColumns) { // slack in - leave //assert (iSequence-numberColumns==iRow); } else { assert(model->getRowStatus(iRow) != ClpSimplex::basic); // put back structural model->setColumnStatus(iSequence, ClpSimplex::basic); } } else { // put in slack model->setRowStatus(iRow, ClpSimplex::basic); } } // Put back any key variables for gub (status_ not touched) matrix->generalExpanded(model, 1, status_); // signal repeat status_ = -99; // set fixed if they are for (iRow = 0; iRow < numberRows; iRow++) { if (model->getRowStatus(iRow) != ClpSimplex::basic ) { if (rowLower[iRow] == rowUpper[iRow]) { rowActivity[iRow] = rowLower[iRow]; model->setRowStatus(iRow, ClpSimplex::isFixed); } } } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) != ClpSimplex::basic ) { if (columnLower[iColumn] == columnUpper[iColumn]) { columnActivity[iColumn] = columnLower[iColumn]; model->setColumnStatus(iColumn, ClpSimplex::isFixed); } } } } } #ifndef SLIM_CLP } else { // network - fake factorization - do nothing status_ = 0; numberPivots_ = 0; } #endif #ifndef SLIM_CLP if (!status_) { // take out part if quadratic if (model->algorithm() == 2) { ClpObjective * obj = model->objectiveAsObject(); #ifndef NDEBUG ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(obj)); assert (quadraticObj); #else ClpQuadraticObjective * quadraticObj = (static_cast< ClpQuadraticObjective*>(obj)); #endif CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); int numberXColumns = quadratic->getNumCols(); assert (numberXColumns < numberColumns); int base = numberColumns - numberXColumns; int * which = new int [numberXColumns]; int * pivotVariable = model->pivotVariable(); int * permute = pivotColumn(); int i; int n = 0; for (i = 0; i < numberRows; i++) { int iSj = pivotVariable[i] - base; if (iSj >= 0 && iSj < numberXColumns) which[n++] = permute[i]; } if (n) emptyRows(n, which); delete [] which; } } #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(2); #endif return status_; } /* Replaces one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U */ int ClpFactorization::replaceColumn ( const ClpSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, double pivotCheck , bool checkBeforeModifying, double acceptablePivot) { int returnCode; #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif // see if FT if (doForrestTomlin_) { returnCode = CoinFactorization::replaceColumn(regionSparse, pivotRow, pivotCheck, checkBeforeModifying, acceptablePivot); } else { returnCode = CoinFactorization::replaceColumnPFI(tableauColumn, pivotRow, pivotCheck); // Note array } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(3); #endif #ifndef SLIM_CLP } else { if (doCheck) { returnCode = CoinFactorization::replaceColumn(regionSparse, pivotRow, pivotCheck, checkBeforeModifying, acceptablePivot); networkBasis_->replaceColumn(regionSparse, pivotRow); } else { // increase number of pivots numberPivots_++; returnCode = networkBasis_->replaceColumn(regionSparse, pivotRow); } } #endif return returnCode; } /* Updates one column (FTRAN) from region2 number returned is negative if no room region1 starts as zero and is zero at end */ int ClpFactorization::updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) { #ifdef CLP_DEBUG regionSparse->checkClear(); #endif if (!numberRows_) return 0; #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif collectStatistics_ = true; int returnCode = CoinFactorization::updateColumnFT(regionSparse, regionSparse2); collectStatistics_ = false; #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(4); #endif return returnCode; #ifndef SLIM_CLP } else { #ifdef CHECK_NETWORK CoinIndexedVector * save = new CoinIndexedVector(*regionSparse2); double * check = new double[numberRows_]; int returnCode = CoinFactorization::updateColumnFT(regionSparse, regionSparse2); networkBasis_->updateColumn(regionSparse, save, -1); int i; double * array = regionSparse2->denseVector(); int * indices = regionSparse2->getIndices(); int n = regionSparse2->getNumElements(); memset(check, 0, numberRows_ * sizeof(double)); double * array2 = save->denseVector(); int * indices2 = save->getIndices(); int n2 = save->getNumElements(); assert (n == n2); if (save->packedMode()) { for (i = 0; i < n; i++) { check[indices[i]] = array[i]; } for (i = 0; i < n; i++) { double value2 = array2[i]; assert (check[indices2[i]] == value2); } } else { for (i = 0; i < numberRows_; i++) { double value1 = array[i]; double value2 = array2[i]; assert (value1 == value2); } } delete save; delete [] check; return returnCode; #else networkBasis_->updateColumn(regionSparse, regionSparse2, -1); return 1; #endif } #endif } /* Updates one column (FTRAN) from region2 number returned is negative if no room region1 starts as zero and is zero at end */ int ClpFactorization::updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute) const { #ifdef CLP_DEBUG if (!noPermute) regionSparse->checkClear(); #endif if (!numberRows_) return 0; #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif collectStatistics_ = true; int returnCode = CoinFactorization::updateColumn(regionSparse, regionSparse2, noPermute); collectStatistics_ = false; #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(5); #endif return returnCode; #ifndef SLIM_CLP } else { #ifdef CHECK_NETWORK CoinIndexedVector * save = new CoinIndexedVector(*regionSparse2); double * check = new double[numberRows_]; int returnCode = CoinFactorization::updateColumn(regionSparse, regionSparse2, noPermute); networkBasis_->updateColumn(regionSparse, save, -1); int i; double * array = regionSparse2->denseVector(); int * indices = regionSparse2->getIndices(); int n = regionSparse2->getNumElements(); memset(check, 0, numberRows_ * sizeof(double)); double * array2 = save->denseVector(); int * indices2 = save->getIndices(); int n2 = save->getNumElements(); assert (n == n2); if (save->packedMode()) { for (i = 0; i < n; i++) { check[indices[i]] = array[i]; } for (i = 0; i < n; i++) { double value2 = array2[i]; assert (check[indices2[i]] == value2); } } else { for (i = 0; i < numberRows_; i++) { double value1 = array[i]; double value2 = array2[i]; assert (value1 == value2); } } delete save; delete [] check; return returnCode; #else networkBasis_->updateColumn(regionSparse, regionSparse2, -1); return 1; #endif } #endif } /* Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room. Also updates region3 region1 starts as zero and is zero at end */ int ClpFactorization::updateTwoColumnsFT ( CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermuteRegion3) { int returnCode = updateColumnFT(regionSparse1, regionSparse2); updateColumn(regionSparse1, regionSparse3, noPermuteRegion3); return returnCode; } /* Updates one column (FTRAN) from region2 number returned is negative if no room region1 starts as zero and is zero at end */ int ClpFactorization::updateColumnForDebug ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute) const { if (!noPermute) regionSparse->checkClear(); if (!numberRows_) return 0; collectStatistics_ = false; int returnCode = CoinFactorization::updateColumn(regionSparse, regionSparse2, noPermute); return returnCode; } /* Updates one column (BTRAN) from region2 region1 starts as zero and is zero at end */ int ClpFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { if (!numberRows_) return 0; #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif collectStatistics_ = true; int returnCode = CoinFactorization::updateColumnTranspose(regionSparse, regionSparse2); collectStatistics_ = false; #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(6); #endif return returnCode; #ifndef SLIM_CLP } else { #ifdef CHECK_NETWORK CoinIndexedVector * save = new CoinIndexedVector(*regionSparse2); double * check = new double[numberRows_]; int returnCode = CoinFactorization::updateColumnTranspose(regionSparse, regionSparse2); networkBasis_->updateColumnTranspose(regionSparse, save); int i; double * array = regionSparse2->denseVector(); int * indices = regionSparse2->getIndices(); int n = regionSparse2->getNumElements(); memset(check, 0, numberRows_ * sizeof(double)); double * array2 = save->denseVector(); int * indices2 = save->getIndices(); int n2 = save->getNumElements(); assert (n == n2); if (save->packedMode()) { for (i = 0; i < n; i++) { check[indices[i]] = array[i]; } for (i = 0; i < n; i++) { double value2 = array2[i]; assert (check[indices2[i]] == value2); } } else { for (i = 0; i < numberRows_; i++) { double value1 = array[i]; double value2 = array2[i]; assert (value1 == value2); } } delete save; delete [] check; return returnCode; #else return networkBasis_->updateColumnTranspose(regionSparse, regionSparse2); #endif } #endif } /* makes a row copy of L for speed and to allow very sparse problems */ void ClpFactorization::goSparse() { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif #ifndef SLIM_CLP if (!networkBasis_) #endif CoinFactorization::goSparse(); #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(7); #endif } // Cleans up i.e. gets rid of network basis void ClpFactorization::cleanUp() { #ifndef SLIM_CLP delete networkBasis_; networkBasis_ = NULL; #endif resetStatistics(); } /// Says whether to redo pivot order bool ClpFactorization::needToReorder() const { #ifdef CHECK_NETWORK return true; #endif #ifndef SLIM_CLP if (!networkBasis_) #endif return true; #ifndef SLIM_CLP else return false; #endif } // Get weighted row list void ClpFactorization::getWeights(int * weights) const { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif #ifndef SLIM_CLP if (networkBasis_) { // Network - just unit for (int i = 0; i < numberRows_; i++) weights[i] = 1; return; } #endif int * numberInRow = numberInRow_.array(); int * numberInColumn = numberInColumn_.array(); int * permuteBack = pivotColumnBack_.array(); int * indexRowU = indexRowU_.array(); const CoinBigIndex * startColumnU = startColumnU_.array(); const CoinBigIndex * startRowL = startRowL_.array(); if (!startRowL || !numberInRow_.array()) { int * temp = new int[numberRows_]; memset(temp, 0, numberRows_ * sizeof(int)); int i; for (i = 0; i < numberRows_; i++) { // one for pivot temp[i]++; CoinBigIndex j; for (j = startColumnU[i]; j < startColumnU[i] + numberInColumn[i]; j++) { int iRow = indexRowU[j]; temp[iRow]++; } } CoinBigIndex * startColumnL = startColumnL_.array(); int * indexRowL = indexRowL_.array(); for (i = baseL_; i < baseL_ + numberL_; i++) { CoinBigIndex j; for (j = startColumnL[i]; j < startColumnL[i+1]; j++) { int iRow = indexRowL[j]; temp[iRow]++; } } for (i = 0; i < numberRows_; i++) { int number = temp[i]; int iPermute = permuteBack[i]; weights[iPermute] = number; } delete [] temp; } else { int i; for (i = 0; i < numberRows_; i++) { int number = startRowL[i+1] - startRowL[i] + numberInRow[i] + 1; //number = startRowL[i+1]-startRowL[i]+1; //number = numberInRow[i]+1; int iPermute = permuteBack[i]; weights[iPermute] = number; } } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(8); #endif } #else // This one allows multiple factorizations #if CLP_MULTIPLE_FACTORIZATIONS == 1 typedef CoinDenseFactorization CoinOtherFactorization; typedef CoinOslFactorization CoinOtherFactorization; #elif CLP_MULTIPLE_FACTORIZATIONS == 2 #include "CoinSimpFactorization.hpp" typedef CoinSimpFactorization CoinOtherFactorization; typedef CoinOslFactorization CoinOtherFactorization; #elif CLP_MULTIPLE_FACTORIZATIONS == 3 #include "CoinSimpFactorization.hpp" #define CoinOslFactorization CoinDenseFactorization #elif CLP_MULTIPLE_FACTORIZATIONS == 4 #include "CoinSimpFactorization.hpp" //#define CoinOslFactorization CoinDenseFactorization #include "CoinOslFactorization.hpp" #endif //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpFactorization::ClpFactorization () { #ifndef SLIM_CLP networkBasis_ = NULL; #endif //coinFactorizationA_ = NULL; coinFactorizationA_ = new CoinFactorization() ; coinFactorizationB_ = NULL; //coinFactorizationB_ = new CoinOtherFactorization(); forceB_ = 0; goOslThreshold_ = -1; goDenseThreshold_ = -1; goSmallThreshold_ = -1; memset(&shortestAverage_,0,3*(sizeof(double)+sizeof(int))); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpFactorization::ClpFactorization (const ClpFactorization & rhs, int denseIfSmaller) { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif #ifndef SLIM_CLP if (rhs.networkBasis_) networkBasis_ = new ClpNetworkBasis(*(rhs.networkBasis_)); else networkBasis_ = NULL; #endif forceB_ = rhs.forceB_; goOslThreshold_ = rhs.goOslThreshold_; goDenseThreshold_ = rhs.goDenseThreshold_; goSmallThreshold_ = rhs.goSmallThreshold_; int goDense = 0; #ifdef CLP_REUSE_ETAS model_=rhs.model_; #endif if (denseIfSmaller > 0 && denseIfSmaller <= goDenseThreshold_) { CoinDenseFactorization * denseR = dynamic_cast(rhs.coinFactorizationB_); if (!denseR) goDense = 1; } if (denseIfSmaller > 0 && !rhs.coinFactorizationB_) { if (denseIfSmaller <= goDenseThreshold_) goDense = 1; else if (denseIfSmaller <= goSmallThreshold_) goDense = 2; else if (denseIfSmaller <= goOslThreshold_) goDense = 3; } else if (denseIfSmaller < 0) { if (-denseIfSmaller <= goDenseThreshold_) goDense = 1; else if (-denseIfSmaller <= goSmallThreshold_) goDense = 2; else if (-denseIfSmaller <= goOslThreshold_) goDense = 3; } if (rhs.coinFactorizationA_ && !goDense) coinFactorizationA_ = new CoinFactorization(*(rhs.coinFactorizationA_)); else coinFactorizationA_ = NULL; if (rhs.coinFactorizationB_ && (denseIfSmaller >= 0 || !goDense)) coinFactorizationB_ = rhs.coinFactorizationB_->clone(); else coinFactorizationB_ = NULL; if (goDense) { delete coinFactorizationB_; if (goDense == 1) coinFactorizationB_ = new CoinDenseFactorization(); else if (goDense == 2) coinFactorizationB_ = new CoinSimpFactorization(); else coinFactorizationB_ = new CoinOslFactorization(); if (rhs.coinFactorizationA_) { coinFactorizationB_->maximumPivots(rhs.coinFactorizationA_->maximumPivots()); coinFactorizationB_->pivotTolerance(rhs.coinFactorizationA_->pivotTolerance()); coinFactorizationB_->zeroTolerance(rhs.coinFactorizationA_->zeroTolerance()); } else { assert (coinFactorizationB_); coinFactorizationB_->maximumPivots(rhs.coinFactorizationB_->maximumPivots()); coinFactorizationB_->pivotTolerance(rhs.coinFactorizationB_->pivotTolerance()); coinFactorizationB_->zeroTolerance(rhs.coinFactorizationB_->zeroTolerance()); } } assert (!coinFactorizationA_ || !coinFactorizationB_); #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(1); #endif memcpy(&shortestAverage_,&rhs.shortestAverage_,3*(sizeof(double)+sizeof(int))); } ClpFactorization::ClpFactorization (const CoinFactorization & rhs) { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif #ifndef SLIM_CLP networkBasis_ = NULL; #endif coinFactorizationA_ = new CoinFactorization(rhs); coinFactorizationB_ = NULL; #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(1); #endif forceB_ = 0; goOslThreshold_ = -1; goDenseThreshold_ = -1; goSmallThreshold_ = -1; assert (!coinFactorizationA_ || !coinFactorizationB_); memset(&shortestAverage_,0,3*(sizeof(double)+sizeof(int))); } ClpFactorization::ClpFactorization (const CoinOtherFactorization & rhs) { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif #ifndef SLIM_CLP networkBasis_ = NULL; #endif coinFactorizationA_ = NULL; coinFactorizationB_ = rhs.clone(); //coinFactorizationB_ = new CoinOtherFactorization(rhs); forceB_ = 0; goOslThreshold_ = -1; goDenseThreshold_ = -1; goSmallThreshold_ = -1; #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(1); #endif assert (!coinFactorizationA_ || !coinFactorizationB_); memset(&shortestAverage_,0,3*(sizeof(double)+sizeof(int))); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpFactorization::~ClpFactorization () { #ifndef SLIM_CLP delete networkBasis_; #endif delete coinFactorizationA_; delete coinFactorizationB_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpFactorization & ClpFactorization::operator=(const ClpFactorization& rhs) { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif if (this != &rhs) { #ifndef SLIM_CLP delete networkBasis_; if (rhs.networkBasis_) networkBasis_ = new ClpNetworkBasis(*(rhs.networkBasis_)); else networkBasis_ = NULL; #endif forceB_ = rhs.forceB_; #ifdef CLP_REUSE_ETAS model_=rhs.model_; #endif goOslThreshold_ = rhs.goOslThreshold_; goDenseThreshold_ = rhs.goDenseThreshold_; goSmallThreshold_ = rhs.goSmallThreshold_; memcpy(&shortestAverage_,&rhs.shortestAverage_,3*(sizeof(double)+sizeof(int))); if (rhs.coinFactorizationA_) { if (coinFactorizationA_) *coinFactorizationA_ = *(rhs.coinFactorizationA_); else coinFactorizationA_ = new CoinFactorization(*rhs.coinFactorizationA_); } else { delete coinFactorizationA_; coinFactorizationA_ = NULL; } if (rhs.coinFactorizationB_) { if (coinFactorizationB_) { CoinDenseFactorization * denseR = dynamic_cast(rhs.coinFactorizationB_); CoinDenseFactorization * dense = dynamic_cast(coinFactorizationB_); CoinOslFactorization * oslR = dynamic_cast(rhs.coinFactorizationB_); CoinOslFactorization * osl = dynamic_cast(coinFactorizationB_); CoinSimpFactorization * simpR = dynamic_cast(rhs.coinFactorizationB_); CoinSimpFactorization * simp = dynamic_cast(coinFactorizationB_); if (dense && denseR) { *dense = *denseR; } else if (osl && oslR) { *osl = *oslR; } else if (simp && simpR) { *simp = *simpR; } else { delete coinFactorizationB_; coinFactorizationB_ = rhs.coinFactorizationB_->clone(); } } else { coinFactorizationB_ = rhs.coinFactorizationB_->clone(); } } else { delete coinFactorizationB_; coinFactorizationB_ = NULL; } } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(1); #endif assert (!coinFactorizationA_ || !coinFactorizationB_); return *this; } // Go over to dense code void ClpFactorization::goDenseOrSmall(int numberRows) { if (!forceB_) { if (numberRows <= goDenseThreshold_) { delete coinFactorizationA_; delete coinFactorizationB_; coinFactorizationA_ = NULL; coinFactorizationB_ = new CoinDenseFactorization(); //printf("going dense\n"); } else if (numberRows <= goSmallThreshold_) { delete coinFactorizationA_; delete coinFactorizationB_; coinFactorizationA_ = NULL; coinFactorizationB_ = new CoinSimpFactorization(); //printf("going small\n"); } else if (numberRows <= goOslThreshold_) { delete coinFactorizationA_; delete coinFactorizationB_; coinFactorizationA_ = NULL; coinFactorizationB_ = new CoinOslFactorization(); //printf("going small\n"); } } assert (!coinFactorizationA_ || !coinFactorizationB_); } // If nonzero force use of 1,dense 2,small 3,osl void ClpFactorization::forceOtherFactorization(int which) { delete coinFactorizationB_; forceB_ = 0; coinFactorizationB_ = NULL; if (which > 0 && which < 4) { delete coinFactorizationA_; coinFactorizationA_ = NULL; forceB_ = which; switch (which) { case 1: coinFactorizationB_ = new CoinDenseFactorization(); goDenseThreshold_ = COIN_INT_MAX; break; case 2: coinFactorizationB_ = new CoinSimpFactorization(); goSmallThreshold_ = COIN_INT_MAX; break; case 3: coinFactorizationB_ = new CoinOslFactorization(); goOslThreshold_ = COIN_INT_MAX; break; } } else if (!coinFactorizationA_) { coinFactorizationA_ = new CoinFactorization(); goOslThreshold_ = -1; goDenseThreshold_ = -1; goSmallThreshold_ = -1; } } #ifdef CLP_FACTORIZATION_NEW_TIMING #ifdef CLP_FACTORIZATION_INSTRUMENT extern double externalTimeStart; extern double timeInFactorize; extern double timeInUpdate; extern double timeInFactorizeFake; extern double timeInUpdateFake1; extern double timeInUpdateFake2; extern double timeInUpdateTranspose; extern double timeInUpdateFT; extern double timeInUpdateTwoFT; extern double timeInReplace; extern int numberUpdate; extern int numberUpdateTranspose; extern int numberUpdateFT; extern int numberUpdateTwoFT; extern int numberReplace; extern int currentLengthR; extern int currentLengthU; extern int currentTakeoutU; extern double averageLengthR; extern double averageLengthL; extern double averageLengthU; extern double scaledLengthDense; extern double scaledLengthDenseSquared; extern double scaledLengthL; extern double scaledLengthR; extern double scaledLengthU; extern int startLengthU; extern int endLengthU; extern int endLengthU2; extern int numberAdded; static int average[3]; static double shortest; static int ifPrint; #else #ifdef CLP_STATIC static int endLengthU_; #endif #endif #ifdef CLP_STATIC static double shortestAverage_; static double totalInR_=0.0; static double totalInIncreasingU_=0.0; //static int lastR=0; //static int lastU=0; static int lastNumberPivots_=0; static int effectiveStartNumberU_=0; #else //#define shortestAverage shortestAverage_ //#define totalInR totalInR_ //#define totalInIncreasingU totalInIncreasingU_ //#define lastNumberPivots lastNumberPivots_ //#define effectiveStartNumberU effectiveStartNumberU_ //#define endLengthU endLengthU_ #endif #ifdef CLP_USEFUL_PRINTOUT static bool readTwiddle=false; static double weightIncU=1.0; static double weightR=2.0; static double weightRest=1.0; static double weightFactL=30.0; static double weightFactDense=0.1; static double weightNrows=10.0; static double increaseNeeded=1.1; static double constWeightIterate = 1.0; static double weightNrowsIterate = 3.0; #else #define weightIncU 1.0 #define weightR 2.0 #define weightRest 1.0 #define weightFactL 30.0 #define weightFactDense 0.1 #define weightNrows 10.0 #define increaseNeeded 1.1 #define constWeightIterate 1.0 #define weightNrowsIterate 3.0 #endif bool ClpFactorization::timeToRefactorize() const { if (coinFactorizationA_) { bool reFactor = (coinFactorizationA_->pivots() * 3 > coinFactorizationA_->maximumPivots() * 2 && coinFactorizationA_->numberElementsR() * 3 > (coinFactorizationA_->numberElementsL() + coinFactorizationA_->numberElementsU()) * 2 + 1000 && !coinFactorizationA_->numberDense()); reFactor=false; bool reFactor3=false; int numberPivots=coinFactorizationA_->pivots(); //if (coinFactorizationA_->pivots()<2) if (numberPivots>lastNumberPivots_) { if (!lastNumberPivots_) { //lastR=0; //lastU=endLengthU; totalInR_=0.0; totalInIncreasingU_=0.0; shortestAverage_=COIN_DBL_MAX; #ifdef CLP_USEFUL_PRINTOUT if (!readTwiddle) { readTwiddle=true; char * environ = getenv("CLP_TWIDDLE"); if (environ) { sscanf(environ,"%lg %lg %lg %lg %lg %lg %lg %lg %lg", &weightIncU,&weightR,&weightRest,&weightFactL, &weightFactDense,&weightNrows,&increaseNeeded, &constWeightIterate,&weightNrowsIterate); } printf("weightIncU %g, weightR %g, weightRest %g, weightFactL %g, weightFactDense %g, weightNrows %g increaseNeeded %g constWeightIterate %g weightNrowsIterate %g\n", weightIncU,weightR,weightRest,weightFactL, weightFactDense,weightNrows,increaseNeeded, constWeightIterate,weightNrowsIterate); } #endif } lastNumberPivots_=numberPivots; int numberDense=coinFactorizationA_->numberDense(); double nnd=numberDense*numberDense; int lengthL=coinFactorizationA_->numberElementsL(); int lengthR=coinFactorizationA_->numberElementsR(); int numberRows = coinFactorizationA_->numberRows(); int lengthU=coinFactorizationA_->numberElementsU()- (numberRows-numberDense); totalInR_ += lengthR; int effectiveU=lengthU-effectiveStartNumberU_; totalInIncreasingU_ += effectiveU; //lastR=lengthR; //lastU=lengthU; double rest=lengthL+0.05*nnd; double constWeightFactor = weightFactL*lengthL+weightFactDense*nnd + weightNrows*numberRows; double constWeightIterateX = constWeightIterate*(lengthL+endLengthU_) + weightNrowsIterate*numberRows; double variableWeight = weightIncU*totalInIncreasingU_+ weightR*totalInR_+weightRest*rest; double average=constWeightIterateX+ (constWeightFactor+variableWeight)/static_cast(numberPivots); #if 0 if ((numberPivots%20)==0&&!ifPrint3) printf("PIV %d nrow %d startU %d now %d L %d R %d dense %g average %g\n", numberPivots,numberRows,effectiveStartNumberU_, lengthU,lengthL,lengthR,nnd,average); #endif shortestAverage_=CoinMin(shortestAverage_,average); if (average>increaseNeeded*shortestAverage_&& coinFactorizationA_->pivots()>30) { //printf("PIVX %d nrow %d startU %d now %d L %d R %d dense %g average %g\n", //numberPivots,numberRows,effectiveStartNumberU_, //lengthU,lengthL,lengthR,nnd,average); reFactor3=true; } } if (reFactor|| reFactor3) { #if 0 printf("%c%cftranCountInput_ %g ,ftranCountAfterL_ %g ,ftranCountAfterR_ %g ,ftranCountAfterU_ %g ,btranCountInput_ %g ,btranCountAfterU_ %g ,btranCountAfterR_ %g ,btranCountAfterL_ %g ,numberFtranCounts_ %d ,numberBtranCounts_ %d ,ftranAverageAfterL_ %g ,ftranAverageAfterR_ %g ,ftranAverageAfterU_ %g ,btranAverageAfterU_ %g ,btranAverageAfterR_ %g ,btranAverageAfterL_ %g\n" ,reFactor3 ? 'Y' : 'N' ,reFactor ? 'Y' : 'N' ,coinFactorizationA_->ftranCountInput_ ,coinFactorizationA_->ftranCountAfterL_ ,coinFactorizationA_->ftranCountAfterR_ ,coinFactorizationA_->ftranCountAfterU_ ,coinFactorizationA_->btranCountInput_ ,coinFactorizationA_->btranCountAfterU_ ,coinFactorizationA_->btranCountAfterR_ ,coinFactorizationA_->btranCountAfterL_ ,coinFactorizationA_->numberFtranCounts_ ,coinFactorizationA_->numberBtranCounts_ ,coinFactorizationA_->ftranAverageAfterL_ ,coinFactorizationA_->ftranAverageAfterR_ ,coinFactorizationA_->ftranAverageAfterU_ ,coinFactorizationA_->btranAverageAfterU_ ,coinFactorizationA_->btranAverageAfterR_ ,coinFactorizationA_->btranAverageAfterL_); #endif reFactor=true; } return reFactor; } else { return coinFactorizationB_->pivots() > coinFactorizationB_->numberRows() / 2.45 + 20; } } #if CLP_FACTORIZATION_NEW_TIMING>1 void ClpFactorization::statsRefactor(char when) const { int numberPivots=coinFactorizationA_->pivots(); int numberDense=coinFactorizationA_->numberDense(); double nnd=numberDense*numberDense; int lengthL=coinFactorizationA_->numberElementsL(); int lengthR=coinFactorizationA_->numberElementsR(); int numberRows = coinFactorizationA_->numberRows(); int lengthU=coinFactorizationA_->numberElementsU()- (numberRows-numberDense); double rest=lengthL+0.05*nnd; double constWeightFactor = weightFactL*lengthL+weightFactDense*nnd + weightNrows*numberRows; double constWeightIterateX = constWeightIterate*(lengthL+endLengthU_) + weightNrowsIterate*numberRows; double variableWeight = weightIncU*totalInIncreasingU_+ weightR*totalInR_+weightRest*rest; double average=constWeightIterateX+ (constWeightFactor+variableWeight)/static_cast(numberPivots); printf("PIV%c %d nrow %d startU %d now %d L %d R %d dense %g average %g - shortest %g\n", when,numberPivots,numberRows,effectiveStartNumberU_, lengthU,lengthL,lengthR,nnd,average,shortestAverage_); } #endif #else bool ClpFactorization::timeToRefactorize() const { if (coinFactorizationA_) { return (coinFactorizationA_->pivots() * 3 > coinFactorizationA_->maximumPivots() * 2 && coinFactorizationA_->numberElementsR() * 3 > (coinFactorizationA_->numberElementsL() + coinFactorizationA_->numberElementsU()) * 2 + 1000 && !coinFactorizationA_->numberDense()); } else { return coinFactorizationB_->pivots() > coinFactorizationB_->numberRows() / 2.45 + 20; } #endif int ClpFactorization::factorize ( ClpSimplex * model, int solveType, bool valuesPass) { #ifdef CLP_REUSE_ETAS model_= model; #endif //if ((model->specialOptions()&16384)) //printf("factor at %d iterations\n",model->numberIterations()); ClpMatrixBase * matrix = model->clpMatrix(); int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); if (!numberRows) return 0; #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); if (!timeInUpdate) { printf("ZZZZ,timeInFactor,nRows,nrows_2,\ startU,endU,lengthL,dense,dense_2,nslacks\n"); printf("YYYY,time,added,dense,dense_2,averageR,averageL,averageU,\ average2R,average2L,average2U,\ scaledDense,scaledDense_2,scaledL,scaledR,scaledU\n"); printf("WWWW,time,size0,ratio1,ratio05,ratio02\n"); } #endif #ifdef CLP_FACTORIZATION_INSTRUMENT externalTimeStart=CoinCpuTime(); memset(average,0,sizeof(average)); shortest=COIN_DBL_MAX; ifPrint=0; if (!model->numberIterations()) printf("maxfactor %d\n",coinFactorizationA_->maximumPivots()); #endif bool anyChanged = false; if (coinFactorizationB_) { coinFactorizationB_->setStatus(-99); int * pivotVariable = model->pivotVariable(); //returns 0 -okay, -1 singular, -2 too many in basis */ // allow dense int solveMode = 2; if (model->numberIterations()) solveMode += 8; if (valuesPass) solveMode += 4; coinFactorizationB_->setSolveMode(solveMode); while (status() < -98) { int i; int numberBasic = 0; int numberRowBasic; // Move pivot variables across if they look good int * pivotTemp = model->rowArray(0)->getIndices(); assert (!model->rowArray(0)->getNumElements()); if (!matrix->rhsOffset(model)) { // Seems to prefer things in order so quickest // way is to go though like this for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) pivotTemp[numberBasic++] = i; } numberRowBasic = numberBasic; /* Put column basic variables into pivotVariable This is done by ClpMatrixBase to allow override for gub */ matrix->generalExpanded(model, 0, numberBasic); } else { // Long matrix - do a different way bool fullSearch = false; for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot >= numberColumns) { pivotTemp[numberBasic++] = iPivot - numberColumns; } } numberRowBasic = numberBasic; for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot < numberColumns) { if (iPivot >= 0) { pivotTemp[numberBasic++] = iPivot; } else { // not full basis fullSearch = true; break; } } } if (fullSearch) { // do slow way numberBasic = 0; for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) pivotTemp[numberBasic++] = i; } numberRowBasic = numberBasic; /* Put column basic variables into pivotVariable This is done by ClpMatrixBase to allow override for gub */ matrix->generalExpanded(model, 0, numberBasic); } } if (numberBasic > model->maximumBasic()) { // Take out some numberBasic = numberRowBasic; for (int i = 0; i < numberColumns; i++) { if (model->getColumnStatus(i) == ClpSimplex::basic) { if (numberBasic < numberRows) numberBasic++; else model->setColumnStatus(i, ClpSimplex::superBasic); } } numberBasic = numberRowBasic; matrix->generalExpanded(model, 0, numberBasic); } else if (numberBasic < numberRows) { // add in some int needed = numberRows - numberBasic; // move up columns for (i = numberBasic - 1; i >= numberRowBasic; i--) pivotTemp[i+needed] = pivotTemp[i]; numberRowBasic = 0; numberBasic = numberRows; for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) { pivotTemp[numberRowBasic++] = i; } else if (needed) { needed--; model->setRowStatus(i, ClpSimplex::basic); pivotTemp[numberRowBasic++] = i; } } } CoinBigIndex numberElements = numberRowBasic; // compute how much in basis // can change for gub int numberColumnBasic = numberBasic - numberRowBasic; numberElements += matrix->countBasis(pivotTemp + numberRowBasic, numberColumnBasic); #ifndef NDEBUG //#define CHECK_CLEAN_BASIS #ifdef CHECK_CLEAN_BASIS int saveNumberElements = numberElements; #endif #endif // Not needed for dense numberElements = 3 * numberBasic + 3 * numberElements + 20000; int numberIterations = model->numberIterations(); coinFactorizationB_->setUsefulInformation(&numberIterations, 0); coinFactorizationB_->getAreas ( numberRows, numberRowBasic + numberColumnBasic, numberElements, 2 * numberElements ); // Fill in counts so we can skip part of preProcess // This is NOT needed for dense but would be needed for later versions CoinFactorizationDouble * elementU; int * indexRowU; CoinBigIndex * startColumnU; int * numberInRow; int * numberInColumn; elementU = coinFactorizationB_->elements(); indexRowU = coinFactorizationB_->indices(); startColumnU = coinFactorizationB_->starts(); #ifdef CHECK_CLEAN_BASIS for (int i=0;islackValue(); #else #define slackValue -1.0 #endif numberInRow = coinFactorizationB_->numberInRow(); numberInColumn = coinFactorizationB_->numberInColumn(); CoinZeroN ( numberInRow, numberRows ); CoinZeroN ( numberInColumn, numberRows ); for (i = 0; i < numberRowBasic; i++) { int iRow = pivotTemp[i]; // Change pivotTemp to correct sequence pivotTemp[i] = iRow + numberColumns; indexRowU[i] = iRow; startColumnU[i] = i; elementU[i] = slackValue; numberInRow[iRow] = 1; numberInColumn[i] = 1; } startColumnU[numberRowBasic] = numberRowBasic; // can change for gub so redo numberColumnBasic = numberBasic - numberRowBasic; matrix->fillBasis(model, pivotTemp + numberRowBasic, numberColumnBasic, indexRowU, startColumnU + numberRowBasic, numberInRow, numberInColumn + numberRowBasic, elementU); // recompute number basic numberBasic = numberRowBasic + numberColumnBasic; for (i = numberBasic; i < numberRows; i++) pivotTemp[i] = -1; // mark not there if (numberBasic) numberElements = startColumnU[numberBasic-1] + numberInColumn[numberBasic-1]; else numberElements = 0; #ifdef CHECK_CLEAN_BASIS assert (!startColumnU[0]); int lastStart=0; for (int i=0;ilastStart); lastStart=startColumnU[i+1]; } assert (lastStart==saveNumberElements); for (int i=0;i=0&&indexRowU[i]preProcess ( ); coinFactorizationB_->factor ( ); if (coinFactorizationB_->status() == -1 && (coinFactorizationB_->solveMode() % 3) != 0) { int solveMode = coinFactorizationB_->solveMode(); solveMode -= solveMode % 3; // so bottom will be 0 coinFactorizationB_->setSolveMode(solveMode); coinFactorizationB_->setStatus(-99); } if (coinFactorizationB_->status() == -99) continue; // If we get here status is 0 or -1 if (coinFactorizationB_->status() == 0 && numberBasic == numberRows) { coinFactorizationB_->postProcess(pivotTemp, pivotVariable); } else if (solveType == 0 || solveType == 2/*||solveType==1*/) { // Change pivotTemp to be correct list anyChanged = true; coinFactorizationB_->makeNonSingular(pivotTemp, numberColumns); double * columnLower = model->lowerRegion(); double * columnUpper = model->upperRegion(); double * columnActivity = model->solutionRegion(); double * rowLower = model->lowerRegion(0); double * rowUpper = model->upperRegion(0); double * rowActivity = model->solutionRegion(0); //redo basis - first take ALL out int iColumn; double largeValue = model->largeValue(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) == ClpSimplex::basic) { // take out if (!valuesPass) { double lower = columnLower[iColumn]; double upper = columnUpper[iColumn]; double value = columnActivity[iColumn]; if (lower > -largeValue || upper < largeValue) { if (fabs(value - lower) < fabs(value - upper)) { model->setColumnStatus(iColumn, ClpSimplex::atLowerBound); columnActivity[iColumn] = lower; } else { model->setColumnStatus(iColumn, ClpSimplex::atUpperBound); columnActivity[iColumn] = upper; } } else { model->setColumnStatus(iColumn, ClpSimplex::isFree); } } else { model->setColumnStatus(iColumn, ClpSimplex::superBasic); } } } int iRow; for (iRow = 0; iRow < numberRows; iRow++) { if (model->getRowStatus(iRow) == ClpSimplex::basic) { // take out if (!valuesPass) { double lower = columnLower[iRow]; double upper = columnUpper[iRow]; double value = columnActivity[iRow]; if (lower > -largeValue || upper < largeValue) { if (fabs(value - lower) < fabs(value - upper)) { model->setRowStatus(iRow, ClpSimplex::atLowerBound); columnActivity[iRow] = lower; } else { model->setRowStatus(iRow, ClpSimplex::atUpperBound); columnActivity[iRow] = upper; } } else { model->setRowStatus(iRow, ClpSimplex::isFree); } } else { model->setRowStatus(iRow, ClpSimplex::superBasic); } } } for (iRow = 0; iRow < numberRows; iRow++) { int iSequence = pivotTemp[iRow]; assert (iSequence >= 0); // basic model->setColumnStatus(iSequence, ClpSimplex::basic); } // signal repeat coinFactorizationB_->setStatus(-99); // set fixed if they are for (iRow = 0; iRow < numberRows; iRow++) { if (model->getRowStatus(iRow) != ClpSimplex::basic ) { if (rowLower[iRow] == rowUpper[iRow]) { rowActivity[iRow] = rowLower[iRow]; model->setRowStatus(iRow, ClpSimplex::isFixed); } } } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) != ClpSimplex::basic ) { if (columnLower[iColumn] == columnUpper[iColumn]) { columnActivity[iColumn] = columnLower[iColumn]; model->setColumnStatus(iColumn, ClpSimplex::isFixed); } } } } } #ifdef CLP_DEBUG // check basic CoinIndexedVector region1(2 * numberRows); CoinIndexedVector region2B(2 * numberRows); int iPivot; double * arrayB = region2B.denseVector(); int i; for (iPivot = 0; iPivot < numberRows; iPivot++) { int iSequence = pivotVariable[iPivot]; model->unpack(®ion2B, iSequence); coinFactorizationB_->updateColumn(®ion1, ®ion2B); if (fabs(arrayB[iPivot] - 1.0) < 1.0e-4) { // OK? arrayB[iPivot] = 0.0; } else { assert (fabs(arrayB[iPivot]) < 1.0e-4); for (i = 0; i < numberRows; i++) { if (fabs(arrayB[i] - 1.0) < 1.0e-4) break; } assert (i < numberRows); printf("variable on row %d landed up on row %d\n", iPivot, i); arrayB[i] = 0.0; } for (i = 0; i < numberRows; i++) assert (fabs(arrayB[i]) < 1.0e-4); region2B.clear(); } #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(2); #endif if ( anyChanged && model->algorithm() < 0 && solveType > 0) { double dummyCost; static_cast (model)->changeBounds(3, NULL, dummyCost); } return coinFactorizationB_->status(); } // If too many compressions increase area if (coinFactorizationA_->pivots() > 1 && coinFactorizationA_->numberCompressions() * 10 > coinFactorizationA_->pivots() + 10) { coinFactorizationA_->areaFactor( coinFactorizationA_->areaFactor() * 1.1); } //int numberPivots=coinFactorizationA_->pivots(); #if 0 if (model->algorithm() > 0) numberSave = -1; #endif #ifndef SLIM_CLP if (!networkBasis_ || doCheck) { #endif coinFactorizationA_->setStatus(-99); int * pivotVariable = model->pivotVariable(); int nTimesRound = 0; //returns 0 -okay, -1 singular, -2 too many in basis, -99 memory */ while (coinFactorizationA_->status() < -98) { nTimesRound++; int i; int numberBasic = 0; int numberRowBasic; // Move pivot variables across if they look good int * pivotTemp = model->rowArray(0)->getIndices(); assert (!model->rowArray(0)->getNumElements()); if (!matrix->rhsOffset(model)) { #if 0 if (numberSave > 0) { int nStill = 0; int nAtBound = 0; int nZeroDual = 0; CoinIndexedVector * array = model->rowArray(3); CoinIndexedVector * objArray = model->columnArray(1); array->clear(); objArray->clear(); double * cost = model->costRegion(); double tolerance = model->primalTolerance(); double offset = 0.0; for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot < numberColumns && isDense(iPivot)) { if (model->getColumnStatus(iPivot) == ClpSimplex::basic) { nStill++; double value = model->solutionRegion()[iPivot]; double dual = model->dualRowSolution()[i]; double lower = model->lowerRegion()[iPivot]; double upper = model->upperRegion()[iPivot]; ClpSimplex::Status status; if (fabs(value - lower) < tolerance) { status = ClpSimplex::atLowerBound; nAtBound++; } else if (fabs(value - upper) < tolerance) { nAtBound++; status = ClpSimplex::atUpperBound; } else if (value > lower && value < upper) { status = ClpSimplex::superBasic; } else { status = ClpSimplex::basic; } if (status != ClpSimplex::basic) { if (model->getRowStatus(i) != ClpSimplex::basic) { model->setColumnStatus(iPivot, ClpSimplex::atLowerBound); model->setRowStatus(i, ClpSimplex::basic); pivotVariable[i] = i + numberColumns; model->dualRowSolution()[i] = 0.0; model->djRegion(0)[i] = 0.0; array->add(i, dual); offset += dual * model->solutionRegion(0)[i]; } } if (fabs(dual) < 1.0e-5) nZeroDual++; } } } printf("out of %d dense, %d still in basis, %d at bound, %d with zero dual - offset %g\n", numberSave, nStill, nAtBound, nZeroDual, offset); if (array->getNumElements()) { // modify costs model->clpMatrix()->transposeTimes(model, 1.0, array, model->columnArray(0), objArray); array->clear(); int n = objArray->getNumElements(); int * indices = objArray->getIndices(); double * elements = objArray->denseVector(); for (i = 0; i < n; i++) { int iColumn = indices[i]; cost[iColumn] -= elements[iColumn]; elements[iColumn] = 0.0; } objArray->setNumElements(0); } } #endif // Seems to prefer things in order so quickest // way is to go though like this for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) pivotTemp[numberBasic++] = i; } numberRowBasic = numberBasic; /* Put column basic variables into pivotVariable This is done by ClpMatrixBase to allow override for gub */ matrix->generalExpanded(model, 0, numberBasic); } else { // Long matrix - do a different way bool fullSearch = false; for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot >= numberColumns) { pivotTemp[numberBasic++] = iPivot - numberColumns; } } numberRowBasic = numberBasic; for (i = 0; i < numberRows; i++) { int iPivot = pivotVariable[i]; if (iPivot < numberColumns) { if (iPivot >= 0) { pivotTemp[numberBasic++] = iPivot; } else { // not full basis fullSearch = true; break; } } } if (fullSearch) { // do slow way numberBasic = 0; for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) pivotTemp[numberBasic++] = i; } numberRowBasic = numberBasic; /* Put column basic variables into pivotVariable This is done by ClpMatrixBase to allow override for gub */ matrix->generalExpanded(model, 0, numberBasic); } } if (numberBasic > model->maximumBasic()) { #if 0 // ndef NDEBUG printf("%d basic - should only be %d\n", numberBasic, numberRows); #endif // Take out some numberBasic = numberRowBasic; for (int i = 0; i < numberColumns; i++) { if (model->getColumnStatus(i) == ClpSimplex::basic) { if (numberBasic < numberRows) numberBasic++; else model->setColumnStatus(i, ClpSimplex::superBasic); } } numberBasic = numberRowBasic; matrix->generalExpanded(model, 0, numberBasic); } #ifndef SLIM_CLP // see if matrix a network #ifndef NO_RTTI ClpNetworkMatrix* networkMatrix = dynamic_cast< ClpNetworkMatrix*>(model->clpMatrix()); #else ClpNetworkMatrix* networkMatrix = NULL; if (model->clpMatrix()->type() == 11) networkMatrix = static_cast< ClpNetworkMatrix*>(model->clpMatrix()); #endif // If network - still allow ordinary factorization first time for laziness if (networkMatrix) coinFactorizationA_->setBiasLU(0); // All to U if network //int saveMaximumPivots = maximumPivots(); delete networkBasis_; networkBasis_ = NULL; if (networkMatrix && !doCheck) maximumPivots(1); #endif //printf("L, U, R %d %d %d\n",numberElementsL(),numberElementsU(),numberElementsR()); while (coinFactorizationA_->status() == -99) { // maybe for speed will be better to leave as many regions as possible coinFactorizationA_->gutsOfDestructor(); coinFactorizationA_->gutsOfInitialize(2); CoinBigIndex numberElements = numberRowBasic; // compute how much in basis int i; // can change for gub int numberColumnBasic = numberBasic - numberRowBasic; numberElements += matrix->countBasis( pivotTemp + numberRowBasic, numberColumnBasic); // and recompute as network side say different if (model->numberIterations()) numberRowBasic = numberBasic - numberColumnBasic; numberElements = 3 * numberBasic + 3 * numberElements + 20000; coinFactorizationA_->getAreas ( numberRows, numberRowBasic + numberColumnBasic, numberElements, 2 * numberElements ); //fill // Fill in counts so we can skip part of preProcess int * numberInRow = coinFactorizationA_->numberInRow(); int * numberInColumn = coinFactorizationA_->numberInColumn(); CoinZeroN ( numberInRow, coinFactorizationA_->numberRows() + 1 ); CoinZeroN ( numberInColumn, coinFactorizationA_->maximumColumnsExtra() + 1 ); CoinFactorizationDouble * elementU = coinFactorizationA_->elementU(); int * indexRowU = coinFactorizationA_->indexRowU(); CoinBigIndex * startColumnU = coinFactorizationA_->startColumnU(); #ifndef COIN_FAST_CODE double slackValue = coinFactorizationA_->slackValue(); #endif for (i = 0; i < numberRowBasic; i++) { int iRow = pivotTemp[i]; indexRowU[i] = iRow; startColumnU[i] = i; elementU[i] = slackValue; numberInRow[iRow] = 1; numberInColumn[i] = 1; } startColumnU[numberRowBasic] = numberRowBasic; // can change for gub so redo numberColumnBasic = numberBasic - numberRowBasic; matrix->fillBasis(model, pivotTemp + numberRowBasic, numberColumnBasic, indexRowU, startColumnU + numberRowBasic, numberInRow, numberInColumn + numberRowBasic, elementU); #if 0 { printf("%d row basic, %d column basic\n", numberRowBasic, numberColumnBasic); for (int i = 0; i < numberElements; i++) printf("row %d col %d value %g\n", indexRowU[i], indexColumnU_[i], elementU[i]); } #endif // recompute number basic numberBasic = numberRowBasic + numberColumnBasic; if (numberBasic) numberElements = startColumnU[numberBasic-1] + numberInColumn[numberBasic-1]; else numberElements = 0; #ifdef CLP_FACTORIZATION_NEW_TIMING lastNumberPivots_=0; effectiveStartNumberU_=numberElements-numberRows; //printf("%d slacks,%d in U at beginning\n", //numberRowBasic,numberElements); #endif coinFactorizationA_->setNumberElementsU(numberElements); //saveFactorization("dump.d"); if (coinFactorizationA_->biasLU() >= 3 || coinFactorizationA_->numberRows() != coinFactorizationA_->numberColumns()) coinFactorizationA_->preProcess ( 2 ); else coinFactorizationA_->preProcess ( 3 ); // no row copy coinFactorizationA_->factor ( ); #ifdef CLP_FACTORIZATION_NEW_TIMING endLengthU_ = coinFactorizationA_->numberElements() - coinFactorizationA_->numberDense()*coinFactorizationA_->numberDense() -coinFactorizationA_->numberElementsL(); #endif if (coinFactorizationA_->status() == -99) { // get more memory coinFactorizationA_->areaFactor(2.0 * coinFactorizationA_->areaFactor()); } else if (coinFactorizationA_->status() == -1 && (model->numberIterations() == 0 || nTimesRound > 2) && coinFactorizationA_->denseThreshold()) { // Round again without dense coinFactorizationA_->setDenseThreshold(0); coinFactorizationA_->setStatus(-99); } } // If we get here status is 0 or -1 if (coinFactorizationA_->status() == 0) { // We may need to tamper with order and redo - e.g. network with side int useNumberRows = numberRows; // **** we will also need to add test in dual steepest to do // as we do for network matrix->generalExpanded(model, 12, useNumberRows); const int * permuteBack = coinFactorizationA_->permuteBack(); const int * back = coinFactorizationA_->pivotColumnBack(); //int * pivotTemp = pivotColumn_.array(); //ClpDisjointCopyN ( pivotVariable, numberRows , pivotTemp ); #ifndef NDEBUG CoinFillN(pivotVariable, numberRows, -1); #endif // Redo pivot order for (i = 0; i < numberRowBasic; i++) { int k = pivotTemp[i]; // so rowIsBasic[k] would be permuteBack[back[i]] int j = permuteBack[back[i]]; assert (pivotVariable[j] == -1); pivotVariable[j] = k + numberColumns; } for (; i < useNumberRows; i++) { int k = pivotTemp[i]; // so rowIsBasic[k] would be permuteBack[back[i]] int j = permuteBack[back[i]]; assert (pivotVariable[j] == -1); pivotVariable[j] = k; } #if 0 if (numberSave >= 0) { numberSave = numberDense_; memset(saveList, 0, ((coinFactorizationA_->numberRows() + 31) >> 5)*sizeof(int)); for (i = coinFactorizationA_->numberRows() - numberSave; i < coinFactorizationA_->numberRows(); i++) { int k = pivotTemp[pivotColumn_.array()[i]]; setDense(k); } } #endif // Set up permutation vector // these arrays start off as copies of permute // (and we could use permute_ instead of pivotColumn (not back though)) ClpDisjointCopyN ( coinFactorizationA_->permute(), useNumberRows , coinFactorizationA_->pivotColumn() ); ClpDisjointCopyN ( coinFactorizationA_->permuteBack(), useNumberRows , coinFactorizationA_->pivotColumnBack() ); #ifndef SLIM_CLP if (networkMatrix) { maximumPivots(CoinMax(2000, maximumPivots())); // redo arrays for (int iRow = 0; iRow < 4; iRow++) { int length = model->numberRows() + maximumPivots(); if (iRow == 3 || model->objectiveAsObject()->type() > 1) length += model->numberColumns(); model->rowArray(iRow)->reserve(length); } // create network factorization if (doCheck) delete networkBasis_; // temp networkBasis_ = new ClpNetworkBasis(model, coinFactorizationA_->numberRows(), coinFactorizationA_->pivotRegion(), coinFactorizationA_->permuteBack(), coinFactorizationA_->startColumnU(), coinFactorizationA_->numberInColumn(), coinFactorizationA_->indexRowU(), coinFactorizationA_->elementU()); // kill off arrays in ordinary factorization if (!doCheck) { coinFactorizationA_->gutsOfDestructor(); // but make sure coinFactorizationA_->numberRows() set coinFactorizationA_->setNumberRows(model->numberRows()); coinFactorizationA_->setStatus(0); #if 0 // but put back permute arrays so odd things will work int numberRows = model->numberRows(); pivotColumnBack_ = new int [numberRows]; permute_ = new int [numberRows]; int i; for (i = 0; i < numberRows; i++) { pivotColumnBack_[i] = i; permute_[i] = i; } #endif } } else { #endif // See if worth going sparse and when coinFactorizationA_->checkSparse(); #ifndef SLIM_CLP } #endif } else if (coinFactorizationA_->status() == -1 && (solveType == 0 || solveType == 2)) { // This needs redoing as it was merged coding - does not need array #if 1 int numberTotal = numberRows + numberColumns; int * isBasic = new int [numberTotal]; int * rowIsBasic = isBasic + numberColumns; int * columnIsBasic = isBasic; for (i = 0; i < numberTotal; i++) isBasic[i] = -1; for (i = 0; i < numberRowBasic; i++) { int iRow = pivotTemp[i]; rowIsBasic[iRow] = 1; } for (; i < numberBasic; i++) { int iColumn = pivotTemp[i]; columnIsBasic[iColumn] = 1; } numberBasic = 0; for (i = 0; i < numberRows; i++) pivotVariable[i] = -1; // mark as basic or non basic const int * pivotColumn = coinFactorizationA_->pivotColumn(); for (i = 0; i < numberRows; i++) { if (rowIsBasic[i] >= 0) { if (pivotColumn[numberBasic] >= 0) { rowIsBasic[i] = pivotColumn[numberBasic]; } else { rowIsBasic[i] = -1; model->setRowStatus(i, ClpSimplex::superBasic); } numberBasic++; } } for (i = 0; i < numberColumns; i++) { if (columnIsBasic[i] >= 0) { if (pivotColumn[numberBasic] >= 0) columnIsBasic[i] = pivotColumn[numberBasic]; else columnIsBasic[i] = -1; numberBasic++; } } // leave pivotVariable in useful form for cleaning basis int * pivotVariable = model->pivotVariable(); for (i = 0; i < numberRows; i++) { pivotVariable[i] = -1; } for (i = 0; i < numberRows; i++) { if (model->getRowStatus(i) == ClpSimplex::basic) { int iPivot = rowIsBasic[i]; if (iPivot >= 0) pivotVariable[iPivot] = i + numberColumns; } } for (i = 0; i < numberColumns; i++) { if (model->getColumnStatus(i) == ClpSimplex::basic) { int iPivot = columnIsBasic[i]; if (iPivot >= 0) pivotVariable[iPivot] = i; } } delete [] isBasic; #else { //int * lastColumn = lastColumn_.array(); // -1 or pivot row int * lastRow = coinFactorizationA_->lastRow(); // -1 or pivot sequence (inside sequence) for ( int i=0;i=0) { pivotVariable[i]=pivotTemp[iSeq]; model->setRowStatus(i, ClpSimplex::superBasic); } else { pivotVariable[i]=i+numberColumns; } } } #endif double * columnLower = model->lowerRegion(); double * columnUpper = model->upperRegion(); double * columnActivity = model->solutionRegion(); double * rowLower = model->lowerRegion(0); double * rowUpper = model->upperRegion(0); double * rowActivity = model->solutionRegion(0); //redo basis - first take ALL columns out int iColumn; double largeValue = model->largeValue(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) == ClpSimplex::basic) { // take out if (!valuesPass) { double lower = columnLower[iColumn]; double upper = columnUpper[iColumn]; double value = columnActivity[iColumn]; if (lower > -largeValue || upper < largeValue) { if (fabs(value - lower) < fabs(value - upper)) { model->setColumnStatus(iColumn, ClpSimplex::atLowerBound); columnActivity[iColumn] = lower; } else { model->setColumnStatus(iColumn, ClpSimplex::atUpperBound); columnActivity[iColumn] = upper; } } else { model->setColumnStatus(iColumn, ClpSimplex::isFree); } } else { model->setColumnStatus(iColumn, ClpSimplex::superBasic); } } } int iRow; for (iRow = 0; iRow < numberRows; iRow++) { int iSequence = pivotVariable[iRow]; if (iSequence >= 0) { // basic if (iSequence >= numberColumns) { // slack in - leave //assert (iSequence-numberColumns==iRow); } else { assert(model->getRowStatus(iRow) != ClpSimplex::basic); // put back structural model->setColumnStatus(iSequence, ClpSimplex::basic); } } else { // put in slack model->setRowStatus(iRow, ClpSimplex::basic); } } // Put back any key variables for gub int dummy; matrix->generalExpanded(model, 1, dummy); // signal repeat coinFactorizationA_->setStatus(-99); // set fixed if they are for (iRow = 0; iRow < numberRows; iRow++) { if (model->getRowStatus(iRow) != ClpSimplex::basic ) { if (rowLower[iRow] == rowUpper[iRow]) { rowActivity[iRow] = rowLower[iRow]; model->setRowStatus(iRow, ClpSimplex::isFixed); } } } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (model->getColumnStatus(iColumn) != ClpSimplex::basic ) { if (columnLower[iColumn] == columnUpper[iColumn]) { columnActivity[iColumn] = columnLower[iColumn]; model->setColumnStatus(iColumn, ClpSimplex::isFixed); } } } } } #ifndef SLIM_CLP } else { // network - fake factorization - do nothing coinFactorizationA_->setStatus(0); coinFactorizationA_->setPivots(0); } #endif #ifndef SLIM_CLP if (!coinFactorizationA_->status()) { // take out part if quadratic if (model->algorithm() == 2) { ClpObjective * obj = model->objectiveAsObject(); #ifndef NDEBUG ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(obj)); assert (quadraticObj); #else ClpQuadraticObjective * quadraticObj = (static_cast< ClpQuadraticObjective*>(obj)); #endif CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); int numberXColumns = quadratic->getNumCols(); assert (numberXColumns < numberColumns); int base = numberColumns - numberXColumns; int * which = new int [numberXColumns]; int * pivotVariable = model->pivotVariable(); int * permute = pivotColumn(); int i; int n = 0; for (i = 0; i < numberRows; i++) { int iSj = pivotVariable[i] - base; if (iSj >= 0 && iSj < numberXColumns) which[n++] = permute[i]; } if (n) coinFactorizationA_->emptyRows(n, which); delete [] which; } } #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(2); #endif return coinFactorizationA_->status(); } /* Replaces one Column in basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room If checkBeforeModifying is true will do all accuracy checks before modifying factorization. Whether to set this depends on speed considerations. You could just do this on first iteration after factorization and thereafter re-factorize partial update already in U */ int ClpFactorization::replaceColumn ( const ClpSimplex * model, CoinIndexedVector * regionSparse, CoinIndexedVector * tableauColumn, int pivotRow, double pivotCheck , bool checkBeforeModifying, double acceptablePivot) { #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_NEW_TIMING #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif int nOld=0; int nNew=0; int seq; const CoinPackedMatrix * matrix=model->matrix(); const int * columnLength = matrix->getVectorLengths(); seq=model->sequenceIn(); if (seq>=0&&seqnumberColumns()+model->numberRows()) { if (seqnumberColumns()) nNew=columnLength[seq]; else nNew=1; } seq=model->sequenceOut(); if (seq>=0&&seqnumberColumns()+model->numberRows()) { if (seqnumberColumns()) nOld=columnLength[seq]; else nOld=1; } effectiveStartNumberU_ += nNew-nOld; #endif int returnCode; // see if FT if (!coinFactorizationA_ || coinFactorizationA_->forrestTomlin()) { if (coinFactorizationA_) { #if ABC_USE_COIN_FACTORIZATION<2 returnCode = coinFactorizationA_->replaceColumn(regionSparse, pivotRow, pivotCheck, checkBeforeModifying, acceptablePivot); #else // fake btran alpha until I understand double btranAlpha=model->alpha(); double ftAlpha = coinFactorizationA_->checkReplacePart1(regionSparse, pivotRow); returnCode = coinFactorizationA_->checkReplacePart2(pivotRow, btranAlpha, model->alpha(), ftAlpha, acceptablePivot); if (returnCode<2) coinFactorizationA_->replaceColumnPart3(regionSparse, pivotRow, model->alpha()); #endif } else { bool tab = coinFactorizationB_->wantsTableauColumn(); #ifdef CLP_REUSE_ETAS int tempInfo[2]; tempInfo[1] = model_->sequenceOut(); #else int tempInfo[1]; #endif tempInfo[0] = model->numberIterations(); coinFactorizationB_->setUsefulInformation(tempInfo, 1); returnCode = coinFactorizationB_->replaceColumn(tab ? tableauColumn : regionSparse, pivotRow, pivotCheck, checkBeforeModifying, acceptablePivot); #ifdef CLP_DEBUG // check basic int numberRows = coinFactorizationB_->numberRows(); CoinIndexedVector region1(2 * numberRows); CoinIndexedVector region2A(2 * numberRows); CoinIndexedVector region2B(2 * numberRows); int iPivot; double * arrayB = region2B.denseVector(); int * pivotVariable = model->pivotVariable(); int i; for (iPivot = 0; iPivot < numberRows; iPivot++) { int iSequence = pivotVariable[iPivot]; if (iPivot == pivotRow) iSequence = model->sequenceIn(); model->unpack(®ion2B, iSequence); coinFactorizationB_->updateColumn(®ion1, ®ion2B); assert (fabs(arrayB[iPivot] - 1.0) < 1.0e-4); arrayB[iPivot] = 0.0; for (i = 0; i < numberRows; i++) assert (fabs(arrayB[i]) < 1.0e-4); region2B.clear(); } #endif } } else { returnCode = coinFactorizationA_->replaceColumnPFI(tableauColumn, pivotRow, pivotCheck); // Note array } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(3); #endif return returnCode; #ifndef SLIM_CLP } else { if (doCheck) { int returnCode = coinFactorizationA_->replaceColumn(regionSparse, pivotRow, pivotCheck, checkBeforeModifying, acceptablePivot); networkBasis_->replaceColumn(regionSparse, pivotRow); return returnCode; } else { // increase number of pivots coinFactorizationA_->setPivots(coinFactorizationA_->pivots() + 1); return networkBasis_->replaceColumn(regionSparse, pivotRow); } } #endif } /* Updates one column (FTRAN) from region2 number returned is negative if no room region1 starts as zero and is zero at end */ int ClpFactorization::updateColumnFT ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) { #ifdef CLP_DEBUG regionSparse->checkClear(); #endif if (!numberRows()) return 0; #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif int returnCode; if (coinFactorizationA_) { coinFactorizationA_->setCollectStatistics(true); returnCode = coinFactorizationA_->updateColumnFT(regionSparse, regionSparse2); coinFactorizationA_->setCollectStatistics(false); } else { #ifdef CLP_REUSE_ETAS int tempInfo[2]; tempInfo[0] = model_->numberIterations(); tempInfo[1] = model_->sequenceIn(); coinFactorizationB_->setUsefulInformation(tempInfo, 2); #endif returnCode = coinFactorizationB_->updateColumnFT(regionSparse, regionSparse2); } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(4); #endif return returnCode; #ifndef SLIM_CLP } else { #ifdef CHECK_NETWORK CoinIndexedVector * save = new CoinIndexedVector(*regionSparse2); double * check = new double[coinFactorizationA_->numberRows()]; int returnCode = coinFactorizationA_->updateColumnFT(regionSparse, regionSparse2); networkBasis_->updateColumn(regionSparse, save, -1); int i; double * array = regionSparse2->denseVector(); int * indices = regionSparse2->getIndices(); int n = regionSparse2->getNumElements(); memset(check, 0, coinFactorizationA_->numberRows()*sizeof(double)); double * array2 = save->denseVector(); int * indices2 = save->getIndices(); int n2 = save->getNumElements(); assert (n == n2); if (save->packedMode()) { for (i = 0; i < n; i++) { check[indices[i]] = array[i]; } for (i = 0; i < n; i++) { double value2 = array2[i]; assert (check[indices2[i]] == value2); } } else { int numberRows = coinFactorizationA_->numberRows(); for (i = 0; i < numberRows; i++) { double value1 = array[i]; double value2 = array2[i]; assert (value1 == value2); } } delete save; delete [] check; return returnCode; #else networkBasis_->updateColumn(regionSparse, regionSparse2, -1); return 1; #endif } #endif } /* Updates one column (FTRAN) from region2 number returned is negative if no room region1 starts as zero and is zero at end */ int ClpFactorization::updateColumn ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute) const { #ifdef CLP_DEBUG if (!noPermute) regionSparse->checkClear(); #endif if (!numberRows()) return 0; #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif int returnCode; if (coinFactorizationA_) { coinFactorizationA_->setCollectStatistics(true); returnCode = coinFactorizationA_->updateColumn(regionSparse, regionSparse2, noPermute); coinFactorizationA_->setCollectStatistics(false); } else { returnCode = coinFactorizationB_->updateColumn(regionSparse, regionSparse2, noPermute); } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(5); #endif //#define PRINT_VECTOR #ifdef PRINT_VECTOR printf("Update\n"); regionSparse2->print(); #endif return returnCode; #ifndef SLIM_CLP } else { #ifdef CHECK_NETWORK CoinIndexedVector * save = new CoinIndexedVector(*regionSparse2); double * check = new double[coinFactorizationA_->numberRows()]; int returnCode = coinFactorizationA_->updateColumn(regionSparse, regionSparse2, noPermute); networkBasis_->updateColumn(regionSparse, save, -1); int i; double * array = regionSparse2->denseVector(); int * indices = regionSparse2->getIndices(); int n = regionSparse2->getNumElements(); memset(check, 0, coinFactorizationA_->numberRows()*sizeof(double)); double * array2 = save->denseVector(); int * indices2 = save->getIndices(); int n2 = save->getNumElements(); assert (n == n2); if (save->packedMode()) { for (i = 0; i < n; i++) { check[indices[i]] = array[i]; } for (i = 0; i < n; i++) { double value2 = array2[i]; assert (check[indices2[i]] == value2); } } else { int numberRows = coinFactorizationA_->numberRows(); for (i = 0; i < numberRows; i++) { double value1 = array[i]; double value2 = array2[i]; assert (value1 == value2); } } delete save; delete [] check; return returnCode; #else networkBasis_->updateColumn(regionSparse, regionSparse2, -1); return 1; #endif } #endif } /* Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room. Also updates region3 region1 starts as zero and is zero at end */ int ClpFactorization::updateTwoColumnsFT ( CoinIndexedVector * regionSparse1, CoinIndexedVector * regionSparse2, CoinIndexedVector * regionSparse3, bool noPermuteRegion3) { #ifdef CLP_DEBUG regionSparse1->checkClear(); #endif if (!numberRows()) return 0; int returnCode = 0; #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif if (coinFactorizationA_) { coinFactorizationA_->setCollectStatistics(true); if (coinFactorizationA_->spaceForForrestTomlin()) { assert (regionSparse2->packedMode()); assert (!regionSparse3->packedMode()); returnCode = coinFactorizationA_->updateTwoColumnsFT(regionSparse1, regionSparse2, regionSparse3, noPermuteRegion3); } else { returnCode = coinFactorizationA_->updateColumnFT(regionSparse1, regionSparse2); coinFactorizationA_->updateColumn(regionSparse1, regionSparse3, noPermuteRegion3); } coinFactorizationA_->setCollectStatistics(false); } else { #if 0 CoinSimpFactorization * fact = dynamic_cast< CoinSimpFactorization*>(coinFactorizationB_); if (!fact) { returnCode = coinFactorizationB_->updateColumnFT(regionSparse1, regionSparse2); coinFactorizationB_->updateColumn(regionSparse1, regionSparse3, noPermuteRegion3); } else { returnCode = fact->updateTwoColumnsFT(regionSparse1, regionSparse2, regionSparse3, noPermuteRegion3); } #else #ifdef CLP_REUSE_ETAS int tempInfo[2]; tempInfo[0] = model_->numberIterations(); tempInfo[1] = model_->sequenceIn(); coinFactorizationB_->setUsefulInformation(tempInfo, 3); #endif returnCode = coinFactorizationB_->updateTwoColumnsFT( regionSparse1, regionSparse2, regionSparse3, noPermuteRegion3); #endif } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(9); #endif #ifdef PRINT_VECTOR printf("UpdateTwoFT\n"); regionSparse2->print(); regionSparse3->print(); #endif return returnCode; #ifndef SLIM_CLP } else { returnCode = updateColumnFT(regionSparse1, regionSparse2); updateColumn(regionSparse1, regionSparse3, noPermuteRegion3); } #endif return returnCode; } /* Updates one column (FTRAN) from region2 number returned is negative if no room region1 starts as zero and is zero at end */ int ClpFactorization::updateColumnForDebug ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2, bool noPermute) const { if (!noPermute) regionSparse->checkClear(); if (!coinFactorizationA_->numberRows()) return 0; coinFactorizationA_->setCollectStatistics(false); int returnCode = coinFactorizationA_->updateColumn(regionSparse, regionSparse2, noPermute); return returnCode; } /* Updates one column (BTRAN) from region2 region1 starts as zero and is zero at end */ int ClpFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse, CoinIndexedVector * regionSparse2) const { if (!numberRows()) return 0; #ifndef SLIM_CLP if (!networkBasis_) { #endif #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif int returnCode; if (coinFactorizationA_) { coinFactorizationA_->setCollectStatistics(true); returnCode = coinFactorizationA_->updateColumnTranspose(regionSparse, regionSparse2); coinFactorizationA_->setCollectStatistics(false); } else { returnCode = coinFactorizationB_->updateColumnTranspose(regionSparse, regionSparse2); } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(6); #endif #ifdef PRINT_VECTOR printf("UpdateTranspose\n"); regionSparse2->print(); #endif return returnCode; #ifndef SLIM_CLP } else { #ifdef CHECK_NETWORK CoinIndexedVector * save = new CoinIndexedVector(*regionSparse2); double * check = new double[coinFactorizationA_->numberRows()]; int returnCode = coinFactorizationA_->updateColumnTranspose(regionSparse, regionSparse2); networkBasis_->updateColumnTranspose(regionSparse, save); int i; double * array = regionSparse2->denseVector(); int * indices = regionSparse2->getIndices(); int n = regionSparse2->getNumElements(); memset(check, 0, coinFactorizationA_->numberRows()*sizeof(double)); double * array2 = save->denseVector(); int * indices2 = save->getIndices(); int n2 = save->getNumElements(); assert (n == n2); if (save->packedMode()) { for (i = 0; i < n; i++) { check[indices[i]] = array[i]; } for (i = 0; i < n; i++) { double value2 = array2[i]; assert (check[indices2[i]] == value2); } } else { int numberRows = coinFactorizationA_->numberRows(); for (i = 0; i < numberRows; i++) { double value1 = array[i]; double value2 = array2[i]; assert (value1 == value2); } } delete save; delete [] check; return returnCode; #else return networkBasis_->updateColumnTranspose(regionSparse, regionSparse2); #endif } #endif } /* makes a row copy of L for speed and to allow very sparse problems */ void ClpFactorization::goSparse() { #ifndef SLIM_CLP if (!networkBasis_) { #endif if (coinFactorizationA_) { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif coinFactorizationA_->goSparse(); #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(7); #endif } } } // Cleans up i.e. gets rid of network basis void ClpFactorization::cleanUp() { #ifndef SLIM_CLP delete networkBasis_; networkBasis_ = NULL; #endif if (coinFactorizationA_) coinFactorizationA_->resetStatistics(); } /// Says whether to redo pivot order bool ClpFactorization::needToReorder() const { #ifdef CHECK_NETWORK return true; #endif #ifndef SLIM_CLP if (!networkBasis_) #endif return true; #ifndef SLIM_CLP else return false; #endif } // Get weighted row list void ClpFactorization::getWeights(int * weights) const { #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(-1); #endif #ifndef SLIM_CLP if (networkBasis_) { // Network - just unit int numberRows = coinFactorizationA_->numberRows(); for (int i = 0; i < numberRows; i++) weights[i] = 1; return; } #endif int * numberInRow = coinFactorizationA_->numberInRow(); int * numberInColumn = coinFactorizationA_->numberInColumn(); int * permuteBack = coinFactorizationA_->pivotColumnBack(); int * indexRowU = coinFactorizationA_->indexRowU(); const CoinBigIndex * startColumnU = coinFactorizationA_->startColumnU(); const CoinBigIndex * startRowL = coinFactorizationA_->startRowL(); int numberRows = coinFactorizationA_->numberRows(); if (!startRowL || !coinFactorizationA_->numberInRow()) { int * temp = new int[numberRows]; memset(temp, 0, numberRows * sizeof(int)); int i; for (i = 0; i < numberRows; i++) { // one for pivot temp[i]++; CoinBigIndex j; for (j = startColumnU[i]; j < startColumnU[i] + numberInColumn[i]; j++) { int iRow = indexRowU[j]; temp[iRow]++; } } CoinBigIndex * startColumnL = coinFactorizationA_->startColumnL(); int * indexRowL = coinFactorizationA_->indexRowL(); int numberL = coinFactorizationA_->numberL(); CoinBigIndex baseL = coinFactorizationA_->baseL(); for (i = baseL; i < baseL + numberL; i++) { CoinBigIndex j; for (j = startColumnL[i]; j < startColumnL[i+1]; j++) { int iRow = indexRowL[j]; temp[iRow]++; } } for (i = 0; i < numberRows; i++) { int number = temp[i]; int iPermute = permuteBack[i]; weights[iPermute] = number; } delete [] temp; } else { int i; for (i = 0; i < numberRows; i++) { int number = startRowL[i+1] - startRowL[i] + numberInRow[i] + 1; //number = startRowL[i+1]-startRowL[i]+1; //number = numberInRow[i]+1; int iPermute = permuteBack[i]; weights[iPermute] = number; } } #ifdef CLP_FACTORIZATION_INSTRUMENT factorization_instrument(8); #endif } // Set tolerances to safer of existing and given void ClpFactorization::saferTolerances ( double zeroValue, double pivotValue) { double newValue; // better to have small tolerance even if slower if (zeroValue > 0.0) newValue = zeroValue; else newValue = -zeroTolerance() * zeroValue; zeroTolerance(CoinMin(zeroTolerance(), zeroValue)); // better to have large tolerance even if slower if (pivotValue > 0.0) newValue = pivotValue; else newValue = -pivotTolerance() * pivotValue; pivotTolerance(CoinMin(CoinMax(pivotTolerance(), newValue), 0.999)); } // Sets factorization void ClpFactorization::setFactorization(ClpFactorization & rhs) { ClpFactorization::operator=(rhs); } #endif CoinMP-1.8.3/Clp/src/ClpDummyMatrix.hpp0000644000175000017500000001634611510657452016271 0ustar renerene/* $Id: ClpDummyMatrix.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpDummyMatrix_H #define ClpDummyMatrix_H #include "CoinPragma.hpp" #include "ClpMatrixBase.hpp" /** This implements a dummy matrix as derived from ClpMatrixBase. This is so you can do ClpPdco but may come in useful elsewhere. It just has dimensions but no data */ class ClpDummyMatrix : public ClpMatrixBase { public: /**@name Useful methods */ //@{ /// Return a complete CoinPackedMatrix virtual CoinPackedMatrix * getPackedMatrix() const; /** Whether the packed matrix is column major ordered or not. */ virtual bool isColOrdered() const { return true; } /** Number of entries in the packed matrix. */ virtual CoinBigIndex getNumElements() const { return numberElements_; } /** Number of columns. */ virtual int getNumCols() const { return numberColumns_; } /** Number of rows. */ virtual int getNumRows() const { return numberRows_; } /** A vector containing the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const double * getElements() const; /** A vector containing the minor indices of the elements in the packed matrix. Note that there might be gaps in this list, entries that do not belong to any major-dimension vector. To get the actual elements one should look at this vector together with vectorStarts and vectorLengths. */ virtual const int * getIndices() const; virtual const CoinBigIndex * getVectorStarts() const; /** The lengths of the major-dimension vectors. */ virtual const int * getVectorLengths() const; /** Delete the columns whose indices are listed in indDel. */ virtual void deleteCols(const int numDel, const int * indDel); /** Delete the rows whose indices are listed in indDel. */ virtual void deleteRows(const int numDel, const int * indDel); /** Returns a new matrix in reverse order without gaps */ virtual ClpMatrixBase * reverseOrderedCopy() const; /// Returns number of elements in column part of basis virtual CoinBigIndex countBasis(const int * whichColumn, int & numberColumnBasic); /// Fills in column part of basis virtual void fillBasis(ClpSimplex * model, const int * whichColumn, int & numberColumnBasic, int * row, int * start, int * rowCount, int * columnCount, CoinFactorizationDouble * element); /** Unpacks a column into an CoinIndexedvector */ virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray, int column) const ; /** Unpacks a column into an CoinIndexedvector ** in packed foramt Note that model is NOT const. Bounds and objective could be modified if doing column generation (just for this variable) */ virtual void unpackPacked(ClpSimplex * model, CoinIndexedVector * rowArray, int column) const; /** Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector */ virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray, int column, double multiplier) const ; /** Adds multiple of a column into an array */ virtual void add(const ClpSimplex * model, double * array, int column, double multiplier) const; /// Allow any parts of a created CoinMatrix to be deleted /// Allow any parts of a created CoinPackedMatrix to be deleted virtual void releasePackedMatrix() const {} //@} /**@name Matrix times vector methods */ //@{ /** Return y + A * scalar *x in y. @pre x must be of size numColumns() @pre y must be of size numRows() */ virtual void times(double scalar, const double * x, double * y) const; /// And for scaling virtual void times(double scalar, const double * x, double * y, const double * rowScale, const double * columnScale) const; /** Return y + x * scalar * A in y. @pre x must be of size numRows() @pre y must be of size numColumns() */ virtual void transposeTimes(double scalar, const double * x, double * y) const; /// And for scaling virtual void transposeTimes(double scalar, const double * x, double * y, const double * rowScale, const double * columnScale) const; using ClpMatrixBase::transposeTimes ; /** Return x * scalar * A + y in z. Can use y as temporary array (will be empty at end) Note - If x packed mode - then z packed mode */ virtual void transposeTimes(const ClpSimplex * model, double scalar, const CoinIndexedVector * x, CoinIndexedVector * y, CoinIndexedVector * z) const; /** Return x *A in z but just for indices in y. Note - If x packed mode - then z packed mode Squashes small elements and knows about ClpSimplex */ virtual void subsetTransposeTimes(const ClpSimplex * model, const CoinIndexedVector * x, const CoinIndexedVector * y, CoinIndexedVector * z) const; //@} /**@name Other */ //@{ //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ ClpDummyMatrix(); /// Constructor with data ClpDummyMatrix(int numberColumns, int numberRows, int numberElements); /** Destructor */ virtual ~ClpDummyMatrix(); //@} /**@name Copy method */ //@{ /** The copy constructor. */ ClpDummyMatrix(const ClpDummyMatrix&); /** The copy constructor from an CoinDummyMatrix. */ ClpDummyMatrix(const CoinPackedMatrix&); ClpDummyMatrix& operator=(const ClpDummyMatrix&); /// Clone virtual ClpMatrixBase * clone() const ; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Number of rows int numberRows_; /// Number of columns int numberColumns_; /// Number of elements int numberElements_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpConstraint.cpp0000644000175000017500000000457011510657452016124 0ustar renerene/* $Id: ClpConstraint.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "ClpSimplex.hpp" #include "ClpConstraint.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpConstraint::ClpConstraint () : lastGradient_(NULL), functionValue_(0.0), offset_(0.0), type_(-1), rowNumber_(-1) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpConstraint::ClpConstraint (const ClpConstraint & source) : lastGradient_(NULL), functionValue_(source.functionValue_), offset_(source.offset_), type_(source.type_), rowNumber_(source.rowNumber_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpConstraint::~ClpConstraint () { delete [] lastGradient_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpConstraint & ClpConstraint::operator=(const ClpConstraint& rhs) { if (this != &rhs) { functionValue_ = rhs.functionValue_; offset_ = rhs.offset_; type_ = rhs.type_; rowNumber_ = rhs.rowNumber_; delete [] lastGradient_; lastGradient_ = NULL; } return *this; } // Constraint function value double ClpConstraint::functionValue (const ClpSimplex * model, const double * solution, bool useScaling, bool refresh) const { double offset; double value; int n = model->numberColumns(); double * grad = new double [n]; gradient(model, solution, grad, value, offset, useScaling, refresh); delete [] grad; return value; } CoinMP-1.8.3/Clp/src/config_clp.h.in0000644000175000017500000000054012101105055015467 0ustar renerene/* src/config_clp.h.in. */ /* Define to 1, 2, 3, or 4 if Aboca should be build. */ #undef CLP_HAS_ABC /* Version number of project */ #undef CLP_VERSION /* Major Version number of project */ #undef CLP_VERSION_MAJOR /* Minor Version number of project */ #undef CLP_VERSION_MINOR /* Release Version number of project */ #undef CLP_VERSION_RELEASE CoinMP-1.8.3/Clp/src/ClpPrimalColumnDantzig.hpp0000644000175000017500000000403111510657452017720 0ustar renerene/* $Id: ClpPrimalColumnDantzig.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpPrimalColumnDantzig_H #define ClpPrimalColumnDantzig_H #include "ClpPrimalColumnPivot.hpp" //############################################################################# /** Primal Column Pivot Dantzig Algorithm Class This is simplest choice - choose largest infeasibility */ class ClpPrimalColumnDantzig : public ClpPrimalColumnPivot { public: ///@name Algorithmic methods //@{ /** Returns pivot column, -1 if none. Lumbers over all columns - slow The Packed CoinIndexedVector updates has cost updates - for normal LP that is just +-weight where a feasibility changed. It also has reduced cost from last iteration in pivot row Can just do full price if you really want to be slow */ virtual int pivotColumn(CoinIndexedVector * updates, CoinIndexedVector * spareRow1, CoinIndexedVector * spareRow2, CoinIndexedVector * spareColumn1, CoinIndexedVector * spareColumn2); /// Just sets model virtual void saveWeights(ClpSimplex * model, int) { model_ = model; } //@} ///@name Constructors and destructors //@{ /// Default Constructor ClpPrimalColumnDantzig(); /// Copy constructor ClpPrimalColumnDantzig(const ClpPrimalColumnDantzig &); /// Assignment operator ClpPrimalColumnDantzig & operator=(const ClpPrimalColumnDantzig& rhs); /// Destructor virtual ~ClpPrimalColumnDantzig (); /// Clone virtual ClpPrimalColumnPivot * clone(bool copyData = true) const; //@} //--------------------------------------------------------------------------- private: ///@name Private member data //@} }; #endif CoinMP-1.8.3/Clp/src/ClpDualRowSteepest.hpp0000644000175000017500000001127412432624666017103 0ustar renerene/* $Id: ClpDualRowSteepest.hpp 2070 2014-11-18 11:12:54Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpDualRowSteepest_H #define ClpDualRowSteepest_H #include "ClpDualRowPivot.hpp" class CoinIndexedVector; //############################################################################# /** Dual Row Pivot Steepest Edge Algorithm Class See Forrest-Goldfarb paper for algorithm */ class ClpDualRowSteepest : public ClpDualRowPivot { public: ///@name Algorithmic methods //@{ /// Returns pivot row, -1 if none virtual int pivotRow(); /** Updates weights and returns pivot alpha. Also does FT update */ virtual double updateWeights(CoinIndexedVector * input, CoinIndexedVector * spare, CoinIndexedVector * spare2, CoinIndexedVector * updatedColumn); /** Updates primal solution (and maybe list of candidates) Uses input vector which it deletes Computes change in objective function */ virtual void updatePrimalSolution(CoinIndexedVector * input, double theta, double & changeInObjective); /** Saves any weights round factorization as pivot rows may change Save model May also recompute infeasibility stuff 1) before factorization 2) after good factorization (if weights empty may initialize) 3) after something happened but no factorization (e.g. check for infeasible) 4) as 2 but restore weights from previous snapshot 5) for strong branching - initialize (uninitialized) , infeasibilities */ virtual void saveWeights(ClpSimplex * model, int mode); /// Pass in saved weights void passInSavedWeights(const CoinIndexedVector * saved); /// Get saved weights inline CoinIndexedVector * savedWeights() { return savedWeights_;} /// Gets rid of last update virtual void unrollWeights(); /// Gets rid of all arrays virtual void clearArrays(); /// Returns true if would not find any row virtual bool looksOptimal() const; /// Called when maximum pivots changes virtual void maximumPivotsChanged(); //@} /** enums for persistence */ enum Persistence { normal = 0x00, // create (if necessary) and destroy keep = 0x01 // create (if necessary) and leave }; ///@name Constructors and destructors //@{ /** Default Constructor 0 is uninitialized, 1 full, 2 is partial uninitialized, 3 starts as 2 but may switch to 1. By partial is meant that the weights are updated as normal but only part of the infeasible basic variables are scanned. This can be faster on very easy problems. */ ClpDualRowSteepest(int mode = 3); /// Copy constructor ClpDualRowSteepest(const ClpDualRowSteepest &); /// Assignment operator ClpDualRowSteepest & operator=(const ClpDualRowSteepest& rhs); /// Fill most values void fill(const ClpDualRowSteepest& rhs); /// Destructor virtual ~ClpDualRowSteepest (); /// Clone virtual ClpDualRowPivot * clone(bool copyData = true) const; //@} /**@name gets and sets */ //@{ /// Mode inline int mode() const { return mode_; } /// Set mode inline void setMode(int mode) { mode_ = mode; } /// Set/ get persistence inline void setPersistence(Persistence life) { persistence_ = life; } inline Persistence persistence() const { return persistence_ ; } //@} //--------------------------------------------------------------------------- private: ///@name Private member data /** Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number */ int state_; /** If 0 then we are using uninitialized weights, 1 then full, if 2 then uninitialized partial, 3 switchable */ int mode_; /// Life of weights Persistence persistence_; /// weight array double * weights_; /// square of infeasibility array (just for infeasible rows) CoinIndexedVector * infeasible_; /// alternate weight array (so we can unroll) CoinIndexedVector * alternateWeights_; /// save weight array (so we can use checkpoint) CoinIndexedVector * savedWeights_; /// Dubious weights int * dubiousWeights_; //@} }; #endif CoinMP-1.8.3/Clp/src/ClpParameters.hpp0000644000175000017500000001112212373033526016075 0ustar renerene/* $Id: ClpParameters.hpp 2046 2014-08-14 04:13:10Z tkr $ */ // Copyright (C) 2000, 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef _ClpParameters_H #define _ClpParameters_H /** This is where to put any useful stuff. */ enum ClpIntParam { /** The maximum number of iterations Clp can execute in the simplex methods */ ClpMaxNumIteration = 0, /** The maximum number of iterations Clp can execute in hotstart before terminating */ ClpMaxNumIterationHotStart, /** The name discipline; specifies how the solver will handle row and column names. - 0: Auto names: Names cannot be set by the client. Names of the form Rnnnnnnn or Cnnnnnnn are generated on demand when a name for a specific row or column is requested; nnnnnnn is derived from the row or column index. Requests for a vector of names return a vector with zero entries. - 1: Lazy names: Names supplied by the client are retained. Names of the form Rnnnnnnn or Cnnnnnnn are generated on demand if no name has been supplied by the client. Requests for a vector of names return a vector sized to the largest index of a name supplied by the client; some entries in the vector may be null strings. - 2: Full names: Names supplied by the client are retained. Names of the form Rnnnnnnn or Cnnnnnnn are generated on demand if no name has been supplied by the client. Requests for a vector of names return a vector sized to match the constraint system, and all entries will contain either the name specified by the client or a generated name. */ ClpNameDiscipline, /** Just a marker, so that we can allocate a static sized array to store parameters. */ ClpLastIntParam }; enum ClpDblParam { /** Set Dual objective limit. This is to be used as a termination criteria in methods where the dual objective monotonically changes (dual simplex). */ ClpDualObjectiveLimit, /** Primal objective limit. This is to be used as a termination criteria in methods where the primal objective monotonically changes (e.g., primal simplex) */ ClpPrimalObjectiveLimit, /** The maximum amount the dual constraints can be violated and still be considered feasible. */ ClpDualTolerance, /** The maximum amount the primal constraints can be violated and still be considered feasible. */ ClpPrimalTolerance, /** Objective function constant. This the value of the constant term in the objective function. */ ClpObjOffset, /// Maximum time in seconds - after, this action is as max iterations ClpMaxSeconds, /// Maximum wallclock running time in seconds - after, this action is as max iterations ClpMaxWallSeconds, /// Tolerance to use in presolve ClpPresolveTolerance, /** Just a marker, so that we can allocate a static sized array to store parameters. */ ClpLastDblParam }; enum ClpStrParam { /** Name of the problem. This is the found on the Name card of an mps file. */ ClpProbName = 0, /** Just a marker, so that we can allocate a static sized array to store parameters. */ ClpLastStrParam }; /// Copy (I don't like complexity of Coin version) template inline void ClpDisjointCopyN( const T * array, const int size, T * newArray) { memcpy(reinterpret_cast (newArray), array, size * sizeof(T)); } /// And set template inline void ClpFillN( T * array, const int size, T value) { int i; for (i = 0; i < size; i++) array[i] = value; } /// This returns a non const array filled with input from scalar or actual array template inline T* ClpCopyOfArray( const T * array, const int size, T value) { T * arrayNew = new T[size]; if (array) ClpDisjointCopyN(array, size, arrayNew); else ClpFillN ( arrayNew, size, value); return arrayNew; } /// This returns a non const array filled with actual array (or NULL) template inline T* ClpCopyOfArray( const T * array, const int size) { if (array) { T * arrayNew = new T[size]; ClpDisjointCopyN(array, size, arrayNew); return arrayNew; } else { return NULL; } } /// For a structure to be used by trusted code typedef struct { int typeStruct; // allocated as 1,2 etc int typeCall; void * data; } ClpTrustedData; #endif CoinMP-1.8.3/Clp/src/AbcCommon.hpp0000644000175000017500000000257412442012732015175 0ustar renerene/* $Id: AbcCommon.hpp 2074 2014-12-10 09:43:54Z forrest $ */ // Copyright (C) 2003, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Forrest */ #ifndef AbcCommon_H #define AbcCommon_H #include "ClpConfig.h" /* 0 - off 1 - build Abc serial but no inherit code 2 - build Abc serial and inherit code 3 - build Abc cilk parallel but no inherit code 4 - build Abc cilk parallel and inherit code */ #ifdef CLP_HAS_ABC #if CLP_HAS_ABC==1 #ifndef ABC_PARALLEL #define ABC_PARALLEL 0 #endif #ifndef ABC_USE_HOMEGROWN_LAPACK #define ABC_USE_HOMEGROWN_LAPACK 2 #endif #elif CLP_HAS_ABC==2 #ifndef ABC_PARALLEL #define ABC_PARALLEL 0 #endif #ifndef ABC_USE_HOMEGROWN_LAPACK #define ABC_USE_HOMEGROWN_LAPACK 2 #endif #ifndef ABC_INHERIT #define ABC_INHERIT #ifndef CLP_INHERIT_MODE #define CLP_INHERIT_MODE 2 #endif #endif #elif CLP_HAS_ABC==3 #ifndef ABC_PARALLEL #define ABC_PARALLEL 2 #endif #ifndef ABC_USE_HOMEGROWN_LAPACK #define ABC_USE_HOMEGROWN_LAPACK 2 #endif #elif CLP_HAS_ABC==4 #ifndef ABC_PARALLEL #define ABC_PARALLEL 2 #endif #ifndef ABC_USE_HOMEGROWN_LAPACK #define ABC_USE_HOMEGROWN_LAPACK 2 #endif #ifndef ABC_INHERIT #define ABC_INHERIT #endif #else #error "Valid values for CLP_HAS_ABC are 0-4" #endif #endif #endif CoinMP-1.8.3/Clp/src/ClpInterior.cpp0000644000175000017500000012673712131041005015562 0ustar renerene/* $Id: ClpInterior.cpp 1938 2013-04-09 16:29:57Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include #include "CoinHelperFunctions.hpp" #include "ClpInterior.hpp" #include "ClpMatrixBase.hpp" #include "ClpLsqr.hpp" #include "ClpPdcoBase.hpp" #include "CoinDenseVector.hpp" #include "ClpMessage.hpp" #include "ClpHelperFunctions.hpp" #include "ClpCholeskyDense.hpp" #include "ClpLinearObjective.hpp" #include "ClpQuadraticObjective.hpp" #include #include #include #include //############################################################################# ClpInterior::ClpInterior () : ClpModel(), largestPrimalError_(0.0), largestDualError_(0.0), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), worstComplementarity_(0.0), xsize_(0.0), zsize_(0.0), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rhs_(NULL), x_(NULL), y_(NULL), dj_(NULL), lsqrObject_(NULL), pdcoStuff_(NULL), mu_(0.0), objectiveNorm_(1.0e-12), rhsNorm_(1.0e-12), solutionNorm_(1.0e-12), dualObjective_(0.0), primalObjective_(0.0), diagonalNorm_(1.0e-12), stepLength_(0.995), linearPerturbation_(1.0e-12), diagonalPerturbation_(1.0e-15), gamma_(0.0), delta_(0), targetGap_(1.0e-12), projectionTolerance_(1.0e-7), maximumRHSError_(0.0), maximumBoundInfeasibility_(0.0), maximumDualError_(0.0), diagonalScaleFactor_(0.0), scaleFactor_(1.0), actualPrimalStep_(0.0), actualDualStep_(0.0), smallestInfeasibility_(0.0), complementarityGap_(0.0), baseObjectiveNorm_(0.0), worstDirectionAccuracy_(0.0), maximumRHSChange_(0.0), errorRegion_(NULL), rhsFixRegion_(NULL), upperSlack_(NULL), lowerSlack_(NULL), diagonal_(NULL), solution_(NULL), workArray_(NULL), deltaX_(NULL), deltaY_(NULL), deltaZ_(NULL), deltaW_(NULL), deltaSU_(NULL), deltaSL_(NULL), primalR_(NULL), dualR_(NULL), rhsB_(NULL), rhsU_(NULL), rhsL_(NULL), rhsZ_(NULL), rhsW_(NULL), rhsC_(NULL), zVec_(NULL), wVec_(NULL), cholesky_(NULL), numberComplementarityPairs_(0), numberComplementarityItems_(0), maximumBarrierIterations_(200), gonePrimalFeasible_(false), goneDualFeasible_(false), algorithm_(-1) { memset(historyInfeasibility_, 0, LENGTH_HISTORY * sizeof(CoinWorkDouble)); solveType_ = 3; // say interior based life form cholesky_ = new ClpCholeskyDense(); // put in placeholder } // Subproblem constructor ClpInterior::ClpInterior ( const ClpModel * rhs, int numberRows, const int * whichRow, int numberColumns, const int * whichColumn, bool dropNames, bool dropIntegers) : ClpModel(rhs, numberRows, whichRow, numberColumns, whichColumn, dropNames, dropIntegers), largestPrimalError_(0.0), largestDualError_(0.0), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), worstComplementarity_(0.0), xsize_(0.0), zsize_(0.0), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rhs_(NULL), x_(NULL), y_(NULL), dj_(NULL), lsqrObject_(NULL), pdcoStuff_(NULL), mu_(0.0), objectiveNorm_(1.0e-12), rhsNorm_(1.0e-12), solutionNorm_(1.0e-12), dualObjective_(0.0), primalObjective_(0.0), diagonalNorm_(1.0e-12), stepLength_(0.99995), linearPerturbation_(1.0e-12), diagonalPerturbation_(1.0e-15), gamma_(0.0), delta_(0), targetGap_(1.0e-12), projectionTolerance_(1.0e-7), maximumRHSError_(0.0), maximumBoundInfeasibility_(0.0), maximumDualError_(0.0), diagonalScaleFactor_(0.0), scaleFactor_(0.0), actualPrimalStep_(0.0), actualDualStep_(0.0), smallestInfeasibility_(0.0), complementarityGap_(0.0), baseObjectiveNorm_(0.0), worstDirectionAccuracy_(0.0), maximumRHSChange_(0.0), errorRegion_(NULL), rhsFixRegion_(NULL), upperSlack_(NULL), lowerSlack_(NULL), diagonal_(NULL), solution_(NULL), workArray_(NULL), deltaX_(NULL), deltaY_(NULL), deltaZ_(NULL), deltaW_(NULL), deltaSU_(NULL), deltaSL_(NULL), primalR_(NULL), dualR_(NULL), rhsB_(NULL), rhsU_(NULL), rhsL_(NULL), rhsZ_(NULL), rhsW_(NULL), rhsC_(NULL), zVec_(NULL), wVec_(NULL), cholesky_(NULL), numberComplementarityPairs_(0), numberComplementarityItems_(0), maximumBarrierIterations_(200), gonePrimalFeasible_(false), goneDualFeasible_(false), algorithm_(-1) { memset(historyInfeasibility_, 0, LENGTH_HISTORY * sizeof(CoinWorkDouble)); solveType_ = 3; // say interior based life form cholesky_ = new ClpCholeskyDense(); } //----------------------------------------------------------------------------- ClpInterior::~ClpInterior () { gutsOfDelete(); } //############################################################################# /* This does housekeeping */ int ClpInterior::housekeeping() { numberIterations_++; return 0; } // Copy constructor. ClpInterior::ClpInterior(const ClpInterior &rhs) : ClpModel(rhs), largestPrimalError_(0.0), largestDualError_(0.0), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), worstComplementarity_(0.0), xsize_(0.0), zsize_(0.0), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rhs_(NULL), x_(NULL), y_(NULL), dj_(NULL), lsqrObject_(NULL), pdcoStuff_(NULL), errorRegion_(NULL), rhsFixRegion_(NULL), upperSlack_(NULL), lowerSlack_(NULL), diagonal_(NULL), solution_(NULL), workArray_(NULL), deltaX_(NULL), deltaY_(NULL), deltaZ_(NULL), deltaW_(NULL), deltaSU_(NULL), deltaSL_(NULL), primalR_(NULL), dualR_(NULL), rhsB_(NULL), rhsU_(NULL), rhsL_(NULL), rhsZ_(NULL), rhsW_(NULL), rhsC_(NULL), zVec_(NULL), wVec_(NULL), cholesky_(NULL) { gutsOfDelete(); gutsOfCopy(rhs); solveType_ = 3; // say interior based life form } // Copy constructor from model ClpInterior::ClpInterior(const ClpModel &rhs) : ClpModel(rhs), largestPrimalError_(0.0), largestDualError_(0.0), sumDualInfeasibilities_(0.0), sumPrimalInfeasibilities_(0.0), worstComplementarity_(0.0), xsize_(0.0), zsize_(0.0), lower_(NULL), rowLowerWork_(NULL), columnLowerWork_(NULL), upper_(NULL), rowUpperWork_(NULL), columnUpperWork_(NULL), cost_(NULL), rhs_(NULL), x_(NULL), y_(NULL), dj_(NULL), lsqrObject_(NULL), pdcoStuff_(NULL), mu_(0.0), objectiveNorm_(1.0e-12), rhsNorm_(1.0e-12), solutionNorm_(1.0e-12), dualObjective_(0.0), primalObjective_(0.0), diagonalNorm_(1.0e-12), stepLength_(0.99995), linearPerturbation_(1.0e-12), diagonalPerturbation_(1.0e-15), gamma_(0.0), delta_(0), targetGap_(1.0e-12), projectionTolerance_(1.0e-7), maximumRHSError_(0.0), maximumBoundInfeasibility_(0.0), maximumDualError_(0.0), diagonalScaleFactor_(0.0), scaleFactor_(0.0), actualPrimalStep_(0.0), actualDualStep_(0.0), smallestInfeasibility_(0.0), complementarityGap_(0.0), baseObjectiveNorm_(0.0), worstDirectionAccuracy_(0.0), maximumRHSChange_(0.0), errorRegion_(NULL), rhsFixRegion_(NULL), upperSlack_(NULL), lowerSlack_(NULL), diagonal_(NULL), solution_(NULL), workArray_(NULL), deltaX_(NULL), deltaY_(NULL), deltaZ_(NULL), deltaW_(NULL), deltaSU_(NULL), deltaSL_(NULL), primalR_(NULL), dualR_(NULL), rhsB_(NULL), rhsU_(NULL), rhsL_(NULL), rhsZ_(NULL), rhsW_(NULL), rhsC_(NULL), zVec_(NULL), wVec_(NULL), cholesky_(NULL), numberComplementarityPairs_(0), numberComplementarityItems_(0), maximumBarrierIterations_(200), gonePrimalFeasible_(false), goneDualFeasible_(false), algorithm_(-1) { memset(historyInfeasibility_, 0, LENGTH_HISTORY * sizeof(CoinWorkDouble)); solveType_ = 3; // say interior based life form cholesky_ = new ClpCholeskyDense(); } // Assignment operator. This copies the data ClpInterior & ClpInterior::operator=(const ClpInterior & rhs) { if (this != &rhs) { gutsOfDelete(); ClpModel::operator=(rhs); gutsOfCopy(rhs); } return *this; } void ClpInterior::gutsOfCopy(const ClpInterior & rhs) { lower_ = ClpCopyOfArray(rhs.lower_, numberColumns_ + numberRows_); rowLowerWork_ = lower_ + numberColumns_; columnLowerWork_ = lower_; upper_ = ClpCopyOfArray(rhs.upper_, numberColumns_ + numberRows_); rowUpperWork_ = upper_ + numberColumns_; columnUpperWork_ = upper_; //cost_ = ClpCopyOfArray(rhs.cost_,2*(numberColumns_+numberRows_)); cost_ = ClpCopyOfArray(rhs.cost_, numberColumns_); rhs_ = ClpCopyOfArray(rhs.rhs_, numberRows_); x_ = ClpCopyOfArray(rhs.x_, numberColumns_); y_ = ClpCopyOfArray(rhs.y_, numberRows_); dj_ = ClpCopyOfArray(rhs.dj_, numberColumns_ + numberRows_); lsqrObject_ = rhs.lsqrObject_ != NULL ? new ClpLsqr(*rhs.lsqrObject_) : NULL; pdcoStuff_ = rhs.pdcoStuff_ != NULL ? rhs.pdcoStuff_->clone() : NULL; largestPrimalError_ = rhs.largestPrimalError_; largestDualError_ = rhs.largestDualError_; sumDualInfeasibilities_ = rhs.sumDualInfeasibilities_; sumPrimalInfeasibilities_ = rhs.sumPrimalInfeasibilities_; worstComplementarity_ = rhs.worstComplementarity_; xsize_ = rhs.xsize_; zsize_ = rhs.zsize_; solveType_ = rhs.solveType_; mu_ = rhs.mu_; objectiveNorm_ = rhs.objectiveNorm_; rhsNorm_ = rhs.rhsNorm_; solutionNorm_ = rhs.solutionNorm_; dualObjective_ = rhs.dualObjective_; primalObjective_ = rhs.primalObjective_; diagonalNorm_ = rhs.diagonalNorm_; stepLength_ = rhs.stepLength_; linearPerturbation_ = rhs.linearPerturbation_; diagonalPerturbation_ = rhs.diagonalPerturbation_; gamma_ = rhs.gamma_; delta_ = rhs.delta_; targetGap_ = rhs.targetGap_; projectionTolerance_ = rhs.projectionTolerance_; maximumRHSError_ = rhs.maximumRHSError_; maximumBoundInfeasibility_ = rhs.maximumBoundInfeasibility_; maximumDualError_ = rhs.maximumDualError_; diagonalScaleFactor_ = rhs.diagonalScaleFactor_; scaleFactor_ = rhs.scaleFactor_; actualPrimalStep_ = rhs.actualPrimalStep_; actualDualStep_ = rhs.actualDualStep_; smallestInfeasibility_ = rhs.smallestInfeasibility_; complementarityGap_ = rhs.complementarityGap_; baseObjectiveNorm_ = rhs.baseObjectiveNorm_; worstDirectionAccuracy_ = rhs.worstDirectionAccuracy_; maximumRHSChange_ = rhs.maximumRHSChange_; errorRegion_ = ClpCopyOfArray(rhs.errorRegion_, numberRows_); rhsFixRegion_ = ClpCopyOfArray(rhs.rhsFixRegion_, numberRows_); deltaY_ = ClpCopyOfArray(rhs.deltaY_, numberRows_); upperSlack_ = ClpCopyOfArray(rhs.upperSlack_, numberRows_ + numberColumns_); lowerSlack_ = ClpCopyOfArray(rhs.lowerSlack_, numberRows_ + numberColumns_); diagonal_ = ClpCopyOfArray(rhs.diagonal_, numberRows_ + numberColumns_); deltaX_ = ClpCopyOfArray(rhs.deltaX_, numberRows_ + numberColumns_); deltaZ_ = ClpCopyOfArray(rhs.deltaZ_, numberRows_ + numberColumns_); deltaW_ = ClpCopyOfArray(rhs.deltaW_, numberRows_ + numberColumns_); deltaSU_ = ClpCopyOfArray(rhs.deltaSU_, numberRows_ + numberColumns_); deltaSL_ = ClpCopyOfArray(rhs.deltaSL_, numberRows_ + numberColumns_); primalR_ = ClpCopyOfArray(rhs.primalR_, numberRows_ + numberColumns_); dualR_ = ClpCopyOfArray(rhs.dualR_, numberRows_ + numberColumns_); rhsB_ = ClpCopyOfArray(rhs.rhsB_, numberRows_); rhsU_ = ClpCopyOfArray(rhs.rhsU_, numberRows_ + numberColumns_); rhsL_ = ClpCopyOfArray(rhs.rhsL_, numberRows_ + numberColumns_); rhsZ_ = ClpCopyOfArray(rhs.rhsZ_, numberRows_ + numberColumns_); rhsW_ = ClpCopyOfArray(rhs.rhsW_, numberRows_ + numberColumns_); rhsC_ = ClpCopyOfArray(rhs.rhsC_, numberRows_ + numberColumns_); solution_ = ClpCopyOfArray(rhs.solution_, numberRows_ + numberColumns_); workArray_ = ClpCopyOfArray(rhs.workArray_, numberRows_ + numberColumns_); zVec_ = ClpCopyOfArray(rhs.zVec_, numberRows_ + numberColumns_); wVec_ = ClpCopyOfArray(rhs.wVec_, numberRows_ + numberColumns_); cholesky_ = rhs.cholesky_->clone(); numberComplementarityPairs_ = rhs.numberComplementarityPairs_; numberComplementarityItems_ = rhs.numberComplementarityItems_; maximumBarrierIterations_ = rhs.maximumBarrierIterations_; gonePrimalFeasible_ = rhs.gonePrimalFeasible_; goneDualFeasible_ = rhs.goneDualFeasible_; algorithm_ = rhs.algorithm_; } void ClpInterior::gutsOfDelete() { delete [] lower_; lower_ = NULL; rowLowerWork_ = NULL; columnLowerWork_ = NULL; delete [] upper_; upper_ = NULL; rowUpperWork_ = NULL; columnUpperWork_ = NULL; delete [] cost_; cost_ = NULL; delete [] rhs_; rhs_ = NULL; delete [] x_; x_ = NULL; delete [] y_; y_ = NULL; delete [] dj_; dj_ = NULL; delete lsqrObject_; lsqrObject_ = NULL; //delete pdcoStuff_; // FIXME pdcoStuff_ = NULL; delete [] errorRegion_; errorRegion_ = NULL; delete [] rhsFixRegion_; rhsFixRegion_ = NULL; delete [] deltaY_; deltaY_ = NULL; delete [] upperSlack_; upperSlack_ = NULL; delete [] lowerSlack_; lowerSlack_ = NULL; delete [] diagonal_; diagonal_ = NULL; delete [] deltaX_; deltaX_ = NULL; delete [] deltaZ_; deltaZ_ = NULL; delete [] deltaW_; deltaW_ = NULL; delete [] deltaSU_; deltaSU_ = NULL; delete [] deltaSL_; deltaSL_ = NULL; delete [] primalR_; primalR_ = NULL; delete [] dualR_; dualR_ = NULL; delete [] rhsB_; rhsB_ = NULL; delete [] rhsU_; rhsU_ = NULL; delete [] rhsL_; rhsL_ = NULL; delete [] rhsZ_; rhsZ_ = NULL; delete [] rhsW_; rhsW_ = NULL; delete [] rhsC_; rhsC_ = NULL; delete [] solution_; solution_ = NULL; delete [] workArray_; workArray_ = NULL; delete [] zVec_; zVec_ = NULL; delete [] wVec_; wVec_ = NULL; delete cholesky_; } bool ClpInterior::createWorkingData() { bool goodMatrix = true; //check matrix if (!matrix_->allElementsInRange(this, 1.0e-12, 1.0e20)) { problemStatus_ = 4; goodMatrix = false; } int nTotal = numberRows_ + numberColumns_; delete [] solution_; solution_ = new CoinWorkDouble[nTotal]; CoinMemcpyN(columnActivity_, numberColumns_, solution_); CoinMemcpyN(rowActivity_, numberRows_, solution_ + numberColumns_); delete [] cost_; cost_ = new CoinWorkDouble[nTotal]; int i; CoinWorkDouble direction = optimizationDirection_ * objectiveScale_; // direction is actually scale out not scale in if (direction) direction = 1.0 / direction; const double * obj = objective(); for (i = 0; i < numberColumns_; i++) cost_[i] = direction * obj[i]; memset(cost_ + numberColumns_, 0, numberRows_ * sizeof(CoinWorkDouble)); // do scaling if needed if (scalingFlag_ > 0 && !rowScale_) { if (matrix_->scale(this)) scalingFlag_ = -scalingFlag_; // not scaled after all } delete [] lower_; delete [] upper_; lower_ = new CoinWorkDouble[nTotal]; upper_ = new CoinWorkDouble[nTotal]; rowLowerWork_ = lower_ + numberColumns_; columnLowerWork_ = lower_; rowUpperWork_ = upper_ + numberColumns_; columnUpperWork_ = upper_; CoinMemcpyN(rowLower_, numberRows_, rowLowerWork_); CoinMemcpyN(rowUpper_, numberRows_, rowUpperWork_); CoinMemcpyN(columnLower_, numberColumns_, columnLowerWork_); CoinMemcpyN(columnUpper_, numberColumns_, columnUpperWork_); // clean up any mismatches on infinity for (i = 0; i < numberColumns_; i++) { if (columnLowerWork_[i] < -1.0e30) columnLowerWork_[i] = -COIN_DBL_MAX; if (columnUpperWork_[i] > 1.0e30) columnUpperWork_[i] = COIN_DBL_MAX; } // clean up any mismatches on infinity for (i = 0; i < numberRows_; i++) { if (rowLowerWork_[i] < -1.0e30) rowLowerWork_[i] = -COIN_DBL_MAX; if (rowUpperWork_[i] > 1.0e30) rowUpperWork_[i] = COIN_DBL_MAX; } // check rim of problem okay if (!sanityCheck()) goodMatrix = false; if(rowScale_) { for (i = 0; i < numberColumns_; i++) { CoinWorkDouble multiplier = rhsScale_ / columnScale_[i]; cost_[i] *= columnScale_[i]; if (columnLowerWork_[i] > -1.0e50) columnLowerWork_[i] *= multiplier; if (columnUpperWork_[i] < 1.0e50) columnUpperWork_[i] *= multiplier; } for (i = 0; i < numberRows_; i++) { CoinWorkDouble multiplier = rhsScale_ * rowScale_[i]; if (rowLowerWork_[i] > -1.0e50) rowLowerWork_[i] *= multiplier; if (rowUpperWork_[i] < 1.0e50) rowUpperWork_[i] *= multiplier; } } else if (rhsScale_ != 1.0) { for (i = 0; i < numberColumns_ + numberRows_; i++) { if (lower_[i] > -1.0e50) lower_[i] *= rhsScale_; if (upper_[i] < 1.0e50) upper_[i] *= rhsScale_; } } assert (!errorRegion_); errorRegion_ = new CoinWorkDouble [numberRows_]; assert (!rhsFixRegion_); rhsFixRegion_ = new CoinWorkDouble [numberRows_]; assert (!deltaY_); deltaY_ = new CoinWorkDouble [numberRows_]; CoinZeroN(deltaY_, numberRows_); assert (!upperSlack_); upperSlack_ = new CoinWorkDouble [nTotal]; assert (!lowerSlack_); lowerSlack_ = new CoinWorkDouble [nTotal]; assert (!diagonal_); diagonal_ = new CoinWorkDouble [nTotal]; assert (!deltaX_); deltaX_ = new CoinWorkDouble [nTotal]; CoinZeroN(deltaX_, nTotal); assert (!deltaZ_); deltaZ_ = new CoinWorkDouble [nTotal]; CoinZeroN(deltaZ_, nTotal); assert (!deltaW_); deltaW_ = new CoinWorkDouble [nTotal]; CoinZeroN(deltaW_, nTotal); assert (!deltaSU_); deltaSU_ = new CoinWorkDouble [nTotal]; CoinZeroN(deltaSU_, nTotal); assert (!deltaSL_); deltaSL_ = new CoinWorkDouble [nTotal]; CoinZeroN(deltaSL_, nTotal); assert (!primalR_); assert (!dualR_); // create arrays if we are doing KKT if (cholesky_->type() >= 20) { primalR_ = new CoinWorkDouble [nTotal]; CoinZeroN(primalR_, nTotal); dualR_ = new CoinWorkDouble [numberRows_]; CoinZeroN(dualR_, numberRows_); } assert (!rhsB_); rhsB_ = new CoinWorkDouble [numberRows_]; CoinZeroN(rhsB_, numberRows_); assert (!rhsU_); rhsU_ = new CoinWorkDouble [nTotal]; CoinZeroN(rhsU_, nTotal); assert (!rhsL_); rhsL_ = new CoinWorkDouble [nTotal]; CoinZeroN(rhsL_, nTotal); assert (!rhsZ_); rhsZ_ = new CoinWorkDouble [nTotal]; CoinZeroN(rhsZ_, nTotal); assert (!rhsW_); rhsW_ = new CoinWorkDouble [nTotal]; CoinZeroN(rhsW_, nTotal); assert (!rhsC_); rhsC_ = new CoinWorkDouble [nTotal]; CoinZeroN(rhsC_, nTotal); assert (!workArray_); workArray_ = new CoinWorkDouble [nTotal]; CoinZeroN(workArray_, nTotal); assert (!zVec_); zVec_ = new CoinWorkDouble [nTotal]; CoinZeroN(zVec_, nTotal); assert (!wVec_); wVec_ = new CoinWorkDouble [nTotal]; CoinZeroN(wVec_, nTotal); assert (!dj_); dj_ = new CoinWorkDouble [nTotal]; if (!status_) status_ = new unsigned char [numberRows_+numberColumns_]; memset(status_, 0, numberRows_ + numberColumns_); return goodMatrix; } void ClpInterior::deleteWorkingData() { int i; if (optimizationDirection_ != 1.0 || objectiveScale_ != 1.0) { CoinWorkDouble scaleC = optimizationDirection_ / objectiveScale_; // and modify all dual signs for (i = 0; i < numberColumns_; i++) reducedCost_[i] = scaleC * dj_[i]; for (i = 0; i < numberRows_; i++) dual_[i] *= scaleC; } if (rowScale_) { CoinWorkDouble scaleR = 1.0 / rhsScale_; for (i = 0; i < numberColumns_; i++) { CoinWorkDouble scaleFactor = columnScale_[i]; CoinWorkDouble valueScaled = columnActivity_[i]; columnActivity_[i] = valueScaled * scaleFactor * scaleR; CoinWorkDouble valueScaledDual = reducedCost_[i]; reducedCost_[i] = valueScaledDual / scaleFactor; } for (i = 0; i < numberRows_; i++) { CoinWorkDouble scaleFactor = rowScale_[i]; CoinWorkDouble valueScaled = rowActivity_[i]; rowActivity_[i] = (valueScaled * scaleR) / scaleFactor; CoinWorkDouble valueScaledDual = dual_[i]; dual_[i] = valueScaledDual * scaleFactor; } } else if (rhsScale_ != 1.0) { CoinWorkDouble scaleR = 1.0 / rhsScale_; for (i = 0; i < numberColumns_; i++) { CoinWorkDouble valueScaled = columnActivity_[i]; columnActivity_[i] = valueScaled * scaleR; } for (i = 0; i < numberRows_; i++) { CoinWorkDouble valueScaled = rowActivity_[i]; rowActivity_[i] = valueScaled * scaleR; } } delete [] cost_; cost_ = NULL; delete [] solution_; solution_ = NULL; delete [] lower_; lower_ = NULL; delete [] upper_; upper_ = NULL; delete [] errorRegion_; errorRegion_ = NULL; delete [] rhsFixRegion_; rhsFixRegion_ = NULL; delete [] deltaY_; deltaY_ = NULL; delete [] upperSlack_; upperSlack_ = NULL; delete [] lowerSlack_; lowerSlack_ = NULL; delete [] diagonal_; diagonal_ = NULL; delete [] deltaX_; deltaX_ = NULL; delete [] workArray_; workArray_ = NULL; delete [] zVec_; zVec_ = NULL; delete [] wVec_; wVec_ = NULL; delete [] dj_; dj_ = NULL; } // Sanity check on input data - returns true if okay bool ClpInterior::sanityCheck() { // bad if empty if (!numberColumns_ || ((!numberRows_ || !matrix_->getNumElements()) && objective_->type() < 2)) { problemStatus_ = emptyProblem(); return false; } int numberBad ; CoinWorkDouble largestBound, smallestBound, minimumGap; CoinWorkDouble smallestObj, largestObj; int firstBad; int modifiedBounds = 0; int i; numberBad = 0; firstBad = -1; minimumGap = 1.0e100; smallestBound = 1.0e100; largestBound = 0.0; smallestObj = 1.0e100; largestObj = 0.0; // If bounds are too close - fix CoinWorkDouble fixTolerance = 1.1 * primalTolerance(); for (i = numberColumns_; i < numberColumns_ + numberRows_; i++) { CoinWorkDouble value; value = CoinAbs(cost_[i]); if (value > 1.0e50) { numberBad++; if (firstBad < 0) firstBad = i; } else if (value) { if (value > largestObj) largestObj = value; if (value < smallestObj) smallestObj = value; } value = upper_[i] - lower_[i]; if (value < -primalTolerance()) { numberBad++; if (firstBad < 0) firstBad = i; } else if (value <= fixTolerance) { if (value) { // modify upper_[i] = lower_[i]; modifiedBounds++; } } else { if (value < minimumGap) minimumGap = value; } if (lower_[i] > -1.0e100 && lower_[i]) { value = CoinAbs(lower_[i]); if (value > largestBound) largestBound = value; if (value < smallestBound) smallestBound = value; } if (upper_[i] < 1.0e100 && upper_[i]) { value = CoinAbs(upper_[i]); if (value > largestBound) largestBound = value; if (value < smallestBound) smallestBound = value; } } if (largestBound) handler_->message(CLP_RIMSTATISTICS3, messages_) << static_cast(smallestBound) << static_cast(largestBound) << static_cast(minimumGap) << CoinMessageEol; minimumGap = 1.0e100; smallestBound = 1.0e100; largestBound = 0.0; for (i = 0; i < numberColumns_; i++) { CoinWorkDouble value; value = CoinAbs(cost_[i]); if (value > 1.0e50) { numberBad++; if (firstBad < 0) firstBad = i; } else if (value) { if (value > largestObj) largestObj = value; if (value < smallestObj) smallestObj = value; } value = upper_[i] - lower_[i]; if (value < -primalTolerance()) { numberBad++; if (firstBad < 0) firstBad = i; } else if (value <= fixTolerance) { if (value) { // modify upper_[i] = lower_[i]; modifiedBounds++; } } else { if (value < minimumGap) minimumGap = value; } if (lower_[i] > -1.0e100 && lower_[i]) { value = CoinAbs(lower_[i]); if (value > largestBound) largestBound = value; if (value < smallestBound) smallestBound = value; } if (upper_[i] < 1.0e100 && upper_[i]) { value = CoinAbs(upper_[i]); if (value > largestBound) largestBound = value; if (value < smallestBound) smallestBound = value; } } char rowcol[] = {'R', 'C'}; if (numberBad) { handler_->message(CLP_BAD_BOUNDS, messages_) << numberBad << rowcol[isColumn(firstBad)] << sequenceWithin(firstBad) << CoinMessageEol; problemStatus_ = 4; return false; } if (modifiedBounds) handler_->message(CLP_MODIFIEDBOUNDS, messages_) << modifiedBounds << CoinMessageEol; handler_->message(CLP_RIMSTATISTICS1, messages_) << static_cast(smallestObj) << static_cast(largestObj) << CoinMessageEol; if (largestBound) handler_->message(CLP_RIMSTATISTICS2, messages_) << static_cast(smallestBound) << static_cast(largestBound) << static_cast(minimumGap) << CoinMessageEol; return true; } /* Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ void ClpInterior::loadProblem ( const ClpMatrixBase& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpModel::loadProblem(matrix, collb, colub, obj, rowlb, rowub, rowObjective); } void ClpInterior::loadProblem ( const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpModel::loadProblem(matrix, collb, colub, obj, rowlb, rowub, rowObjective); } /* Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). */ void ClpInterior::loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpModel::loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub, rowObjective); } void ClpInterior::loadProblem ( const int numcols, const int numrows, const CoinBigIndex* start, const int* index, const double* value, const int * length, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub, const double * rowObjective) { ClpModel::loadProblem(numcols, numrows, start, index, value, length, collb, colub, obj, rowlb, rowub, rowObjective); } // Read an mps file from the given filename int ClpInterior::readMps(const char *filename, bool keepNames, bool ignoreErrors) { int status = ClpModel::readMps(filename, keepNames, ignoreErrors); return status; } #include "ClpPdco.hpp" /* Pdco algorithm - see ClpPdco.hpp for method */ int ClpInterior::pdco() { return ((ClpPdco *) this)->pdco(); } // ** Temporary version int ClpInterior::pdco( ClpPdcoBase * stuff, Options &options, Info &info, Outfo &outfo) { return ((ClpPdco *) this)->pdco(stuff, options, info, outfo); } #include "ClpPredictorCorrector.hpp" // Primal-Dual Predictor-Corrector barrier int ClpInterior::primalDual() { return (static_cast (this))->solve(); } void ClpInterior::checkSolution() { int iRow, iColumn; CoinWorkDouble * reducedCost = reinterpret_cast(reducedCost_); CoinWorkDouble * dual = reinterpret_cast(dual_); CoinMemcpyN(cost_, numberColumns_, reducedCost); matrix_->transposeTimes(-1.0, dual, reducedCost); // Now modify reduced costs for quadratic CoinWorkDouble quadraticOffset = quadraticDjs(reducedCost, solution_, scaleFactor_); objectiveValue_ = 0.0; // now look at solution sumPrimalInfeasibilities_ = 0.0; sumDualInfeasibilities_ = 0.0; CoinWorkDouble dualTolerance = 10.0 * dblParam_[ClpDualTolerance]; CoinWorkDouble primalTolerance = dblParam_[ClpPrimalTolerance]; CoinWorkDouble primalTolerance2 = 10.0 * dblParam_[ClpPrimalTolerance]; worstComplementarity_ = 0.0; complementarityGap_ = 0.0; // Done scaled - use permanent regions for output // but internal for bounds const CoinWorkDouble * lower = lower_ + numberColumns_; const CoinWorkDouble * upper = upper_ + numberColumns_; for (iRow = 0; iRow < numberRows_; iRow++) { CoinWorkDouble infeasibility = 0.0; CoinWorkDouble distanceUp = CoinMin(upper[iRow] - rowActivity_[iRow], static_cast(1.0e10)); CoinWorkDouble distanceDown = CoinMin(rowActivity_[iRow] - lower[iRow], static_cast(1.0e10)); if (distanceUp > primalTolerance2) { CoinWorkDouble value = dual[iRow]; // should not be negative if (value < -dualTolerance) { sumDualInfeasibilities_ += -dualTolerance - value; value = - value * distanceUp; if (value > worstComplementarity_) worstComplementarity_ = value; complementarityGap_ += value; } } if (distanceDown > primalTolerance2) { CoinWorkDouble value = dual[iRow]; // should not be positive if (value > dualTolerance) { sumDualInfeasibilities_ += value - dualTolerance; value = value * distanceDown; if (value > worstComplementarity_) worstComplementarity_ = value; complementarityGap_ += value; } } if (rowActivity_[iRow] > upper[iRow]) { infeasibility = rowActivity_[iRow] - upper[iRow]; } else if (rowActivity_[iRow] < lower[iRow]) { infeasibility = lower[iRow] - rowActivity_[iRow]; } if (infeasibility > primalTolerance) { sumPrimalInfeasibilities_ += infeasibility - primalTolerance; } } lower = lower_; upper = upper_; for (iColumn = 0; iColumn < numberColumns_; iColumn++) { CoinWorkDouble infeasibility = 0.0; objectiveValue_ += cost_[iColumn] * columnActivity_[iColumn]; CoinWorkDouble distanceUp = CoinMin(upper[iColumn] - columnActivity_[iColumn], static_cast(1.0e10)); CoinWorkDouble distanceDown = CoinMin(columnActivity_[iColumn] - lower[iColumn], static_cast(1.0e10)); if (distanceUp > primalTolerance2) { CoinWorkDouble value = reducedCost[iColumn]; // should not be negative if (value < -dualTolerance) { sumDualInfeasibilities_ += -dualTolerance - value; value = - value * distanceUp; if (value > worstComplementarity_) worstComplementarity_ = value; complementarityGap_ += value; } } if (distanceDown > primalTolerance2) { CoinWorkDouble value = reducedCost[iColumn]; // should not be positive if (value > dualTolerance) { sumDualInfeasibilities_ += value - dualTolerance; value = value * distanceDown; if (value > worstComplementarity_) worstComplementarity_ = value; complementarityGap_ += value; } } if (columnActivity_[iColumn] > upper[iColumn]) { infeasibility = columnActivity_[iColumn] - upper[iColumn]; } else if (columnActivity_[iColumn] < lower[iColumn]) { infeasibility = lower[iColumn] - columnActivity_[iColumn]; } if (infeasibility > primalTolerance) { sumPrimalInfeasibilities_ += infeasibility - primalTolerance; } } #if COIN_LONG_WORK // ok as packs down CoinMemcpyN(reducedCost, numberColumns_, reducedCost_); #endif // add in offset objectiveValue_ += 0.5 * quadraticOffset; } // Set cholesky (and delete present one) void ClpInterior::setCholesky(ClpCholeskyBase * cholesky) { delete cholesky_; cholesky_ = cholesky; } /* Borrow model. This is so we dont have to copy large amounts of data around. It assumes a derived class wants to overwrite an empty model with a real one - while it does an algorithm. This is same as ClpModel one. */ void ClpInterior::borrowModel(ClpModel & otherModel) { ClpModel::borrowModel(otherModel); } /* Return model - updates any scalars */ void ClpInterior::returnModel(ClpModel & otherModel) { ClpModel::returnModel(otherModel); } // Return number fixed to see if worth presolving int ClpInterior::numberFixed() const { int i; int nFixed = 0; for (i = 0; i < numberColumns_; i++) { if (columnUpper_[i] < 1.0e20 || columnLower_[i] > -1.0e20) { if (columnUpper_[i] > columnLower_[i]) { if (fixedOrFree(i)) nFixed++; } } } for (i = 0; i < numberRows_; i++) { if (rowUpper_[i] < 1.0e20 || rowLower_[i] > -1.0e20) { if (rowUpper_[i] > rowLower_[i]) { if (fixedOrFree(i + numberColumns_)) nFixed++; } } } return nFixed; } // fix variables interior says should be void ClpInterior::fixFixed(bool reallyFix) { // Arrays for change in columns and rhs CoinWorkDouble * columnChange = new CoinWorkDouble[numberColumns_]; CoinWorkDouble * rowChange = new CoinWorkDouble[numberRows_]; CoinZeroN(columnChange, numberColumns_); CoinZeroN(rowChange, numberRows_); matrix_->times(1.0, columnChange, rowChange); int i; CoinWorkDouble tolerance = primalTolerance(); for (i = 0; i < numberColumns_; i++) { if (columnUpper_[i] < 1.0e20 || columnLower_[i] > -1.0e20) { if (columnUpper_[i] > columnLower_[i]) { if (fixedOrFree(i)) { if (columnActivity_[i] - columnLower_[i] < columnUpper_[i] - columnActivity_[i]) { CoinWorkDouble change = columnLower_[i] - columnActivity_[i]; if (CoinAbs(change) < tolerance) { if (reallyFix) columnUpper_[i] = columnLower_[i]; columnChange[i] = change; columnActivity_[i] = columnLower_[i]; } } else { CoinWorkDouble change = columnUpper_[i] - columnActivity_[i]; if (CoinAbs(change) < tolerance) { if (reallyFix) columnLower_[i] = columnUpper_[i]; columnChange[i] = change; columnActivity_[i] = columnUpper_[i]; } } } } } } CoinZeroN(rowChange, numberRows_); matrix_->times(1.0, columnChange, rowChange); // If makes mess of things then don't do CoinWorkDouble newSum = 0.0; for (i = 0; i < numberRows_; i++) { CoinWorkDouble value = rowActivity_[i] + rowChange[i]; if (value > rowUpper_[i] + tolerance) newSum += value - rowUpper_[i] - tolerance; else if (value < rowLower_[i] - tolerance) newSum -= value - rowLower_[i] + tolerance; } if (newSum > 1.0e-5 + 1.5 * sumPrimalInfeasibilities_) { // put back and skip changes for (i = 0; i < numberColumns_; i++) columnActivity_[i] -= columnChange[i]; } else { CoinZeroN(rowActivity_, numberRows_); matrix_->times(1.0, columnActivity_, rowActivity_); if (reallyFix) { for (i = 0; i < numberRows_; i++) { if (rowUpper_[i] < 1.0e20 || rowLower_[i] > -1.0e20) { if (rowUpper_[i] > rowLower_[i]) { if (fixedOrFree(i + numberColumns_)) { if (rowActivity_[i] - rowLower_[i] < rowUpper_[i] - rowActivity_[i]) { CoinWorkDouble change = rowLower_[i] - rowActivity_[i]; if (CoinAbs(change) < tolerance) { if (reallyFix) rowUpper_[i] = rowLower_[i]; rowActivity_[i] = rowLower_[i]; } } else { CoinWorkDouble change = rowLower_[i] - rowActivity_[i]; if (CoinAbs(change) < tolerance) { if (reallyFix) rowLower_[i] = rowUpper_[i]; rowActivity_[i] = rowUpper_[i]; } } } } } } } } delete [] rowChange; delete [] columnChange; } /* Modifies djs to allow for quadratic. returns quadratic offset */ CoinWorkDouble ClpInterior::quadraticDjs(CoinWorkDouble * djRegion, const CoinWorkDouble * solution, CoinWorkDouble scaleFactor) { CoinWorkDouble quadraticOffset = 0.0; #ifndef NO_RTTI ClpQuadraticObjective * quadraticObj = (dynamic_cast< ClpQuadraticObjective*>(objective_)); #else ClpQuadraticObjective * quadraticObj = NULL; if (objective_->type() == 2) quadraticObj = (static_cast< ClpQuadraticObjective*>(objective_)); #endif if (quadraticObj) { CoinPackedMatrix * quadratic = quadraticObj->quadraticObjective(); const int * columnQuadratic = quadratic->getIndices(); const CoinBigIndex * columnQuadraticStart = quadratic->getVectorStarts(); const int * columnQuadraticLength = quadratic->getVectorLengths(); double * quadraticElement = quadratic->getMutableElements(); int numberColumns = quadratic->getNumCols(); for (int iColumn = 0; iColumn < numberColumns; iColumn++) { CoinWorkDouble value = 0.0; for (CoinBigIndex j = columnQuadraticStart[iColumn]; j < columnQuadraticStart[iColumn] + columnQuadraticLength[iColumn]; j++) { int jColumn = columnQuadratic[j]; CoinWorkDouble valueJ = solution[jColumn]; CoinWorkDouble elementValue = quadraticElement[j]; //value += valueI*valueJ*elementValue; value += valueJ * elementValue; quadraticOffset += solution[iColumn] * valueJ * elementValue; } djRegion[iColumn] += scaleFactor * value; } } return quadraticOffset; } CoinMP-1.8.3/Clp/src/ClpConstraintQuadratic.cpp0000644000175000017500000002471011510657452017760 0ustar renerene/* $Id: ClpConstraintQuadratic.cpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2007, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "ClpSimplex.hpp" #include "ClpConstraintQuadratic.hpp" #include "CoinSort.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpConstraintQuadratic::ClpConstraintQuadratic () : ClpConstraint() { type_ = 0; start_ = NULL; column_ = NULL; coefficient_ = NULL; numberColumns_ = 0; numberCoefficients_ = 0; numberQuadraticColumns_ = 0; } //------------------------------------------------------------------- // Useful Constructor //------------------------------------------------------------------- ClpConstraintQuadratic::ClpConstraintQuadratic (int row, int numberQuadraticColumns , int numberColumns, const CoinBigIndex * start, const int * column, const double * coefficient) : ClpConstraint() { type_ = 0; rowNumber_ = row; numberColumns_ = numberColumns; numberQuadraticColumns_ = numberQuadraticColumns; start_ = CoinCopyOfArray(start, numberQuadraticColumns + 1); int numberElements = start_[numberQuadraticColumns_]; column_ = CoinCopyOfArray(column, numberElements); coefficient_ = CoinCopyOfArray(coefficient, numberElements); char * mark = new char [numberQuadraticColumns_]; memset(mark, 0, numberQuadraticColumns_); int iColumn; for (iColumn = 0; iColumn < numberQuadraticColumns_; iColumn++) { CoinBigIndex j; for (j = start_[iColumn]; j < start_[iColumn+1]; j++) { int jColumn = column_[j]; if (jColumn >= 0) { assert (jColumn < numberQuadraticColumns_); mark[jColumn] = 1; } mark[iColumn] = 1; } } numberCoefficients_ = 0; for (iColumn = 0; iColumn < numberQuadraticColumns_; iColumn++) { if (mark[iColumn]) numberCoefficients_++; } delete [] mark; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpConstraintQuadratic::ClpConstraintQuadratic (const ClpConstraintQuadratic & rhs) : ClpConstraint(rhs) { numberColumns_ = rhs.numberColumns_; numberCoefficients_ = rhs.numberCoefficients_; numberQuadraticColumns_ = rhs.numberQuadraticColumns_; start_ = CoinCopyOfArray(rhs.start_, numberQuadraticColumns_ + 1); int numberElements = start_[numberQuadraticColumns_]; column_ = CoinCopyOfArray(rhs.column_, numberElements); coefficient_ = CoinCopyOfArray(rhs.coefficient_, numberElements); } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpConstraintQuadratic::~ClpConstraintQuadratic () { delete [] start_; delete [] column_; delete [] coefficient_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpConstraintQuadratic & ClpConstraintQuadratic::operator=(const ClpConstraintQuadratic& rhs) { if (this != &rhs) { delete [] start_; delete [] column_; delete [] coefficient_; numberColumns_ = rhs.numberColumns_; numberCoefficients_ = rhs.numberCoefficients_; numberQuadraticColumns_ = rhs.numberQuadraticColumns_; start_ = CoinCopyOfArray(rhs.start_, numberQuadraticColumns_ + 1); int numberElements = start_[numberQuadraticColumns_]; column_ = CoinCopyOfArray(rhs.column_, numberElements); coefficient_ = CoinCopyOfArray(rhs.coefficient_, numberElements); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpConstraint * ClpConstraintQuadratic::clone() const { return new ClpConstraintQuadratic(*this); } // Returns gradient int ClpConstraintQuadratic::gradient(const ClpSimplex * model, const double * solution, double * gradient, double & functionValue, double & offset, bool useScaling, bool refresh) const { if (refresh || !lastGradient_) { offset_ = 0.0; functionValue_ = 0.0; if (!lastGradient_) lastGradient_ = new double[numberColumns_]; CoinZeroN(lastGradient_, numberColumns_); bool scaling = (model && model->rowScale() && useScaling); if (!scaling) { int iColumn; for (iColumn = 0; iColumn < numberQuadraticColumns_; iColumn++) { double valueI = solution[iColumn]; CoinBigIndex j; for (j = start_[iColumn]; j < start_[iColumn+1]; j++) { int jColumn = column_[j]; if (jColumn >= 0) { double valueJ = solution[jColumn]; double elementValue = coefficient_[j]; if (iColumn != jColumn) { offset_ -= valueI * valueJ * elementValue; double gradientI = valueJ * elementValue; double gradientJ = valueI * elementValue; lastGradient_[iColumn] += gradientI; lastGradient_[jColumn] += gradientJ; } else { offset_ -= 0.5 * valueI * valueI * elementValue; double gradientI = valueI * elementValue; lastGradient_[iColumn] += gradientI; } } else { // linear part lastGradient_[iColumn] += coefficient_[j]; functionValue_ += valueI * coefficient_[j]; } } } functionValue_ -= offset_; } else { abort(); // do scaling const double * columnScale = model->columnScale(); for (int i = 0; i < numberCoefficients_; i++) { int iColumn = column_[i]; double value = solution[iColumn]; // already scaled double coefficient = coefficient_[i] * columnScale[iColumn]; functionValue_ += value * coefficient; lastGradient_[iColumn] = coefficient; } } } functionValue = functionValue_; offset = offset_; CoinMemcpyN(lastGradient_, numberColumns_, gradient); return 0; } // Resize constraint void ClpConstraintQuadratic::resize(int newNumberColumns) { if (numberColumns_ != newNumberColumns) { abort(); #ifndef NDEBUG int lastColumn = column_[numberCoefficients_-1]; #endif assert (newNumberColumns > lastColumn); delete [] lastGradient_; lastGradient_ = NULL; numberColumns_ = newNumberColumns; } } // Delete columns in constraint void ClpConstraintQuadratic::deleteSome(int numberToDelete, const int * which) { if (numberToDelete) { abort(); int i ; char * deleted = new char[numberColumns_]; memset(deleted, 0, numberColumns_ * sizeof(char)); for (i = 0; i < numberToDelete; i++) { int j = which[i]; if (j >= 0 && j < numberColumns_ && !deleted[j]) { deleted[j] = 1; } } int n = 0; for (i = 0; i < numberCoefficients_; i++) { int iColumn = column_[i]; if (!deleted[iColumn]) { column_[n] = iColumn; coefficient_[n++] = coefficient_[i]; } } numberCoefficients_ = n; } } // Scale constraint void ClpConstraintQuadratic::reallyScale(const double * ) { abort(); } /* Given a zeroed array sets nonquadratic columns to 1. Returns number of nonlinear columns */ int ClpConstraintQuadratic::markNonlinear(char * which) const { int iColumn; for (iColumn = 0; iColumn < numberQuadraticColumns_; iColumn++) { CoinBigIndex j; for (j = start_[iColumn]; j < start_[iColumn+1]; j++) { int jColumn = column_[j]; if (jColumn >= 0) { assert (jColumn < numberQuadraticColumns_); which[jColumn] = 1; which[iColumn] = 1; } } } int numberCoefficients = 0; for (iColumn = 0; iColumn < numberQuadraticColumns_; iColumn++) { if (which[iColumn]) numberCoefficients++; } return numberCoefficients; } /* Given a zeroed array sets possible nonzero coefficients to 1. Returns number of nonzeros */ int ClpConstraintQuadratic::markNonzero(char * which) const { int iColumn; for (iColumn = 0; iColumn < numberQuadraticColumns_; iColumn++) { CoinBigIndex j; for (j = start_[iColumn]; j < start_[iColumn+1]; j++) { int jColumn = column_[j]; if (jColumn >= 0) { assert (jColumn < numberQuadraticColumns_); which[jColumn] = 1; } which[iColumn] = 1; } } int numberCoefficients = 0; for (iColumn = 0; iColumn < numberQuadraticColumns_; iColumn++) { if (which[iColumn]) numberCoefficients++; } return numberCoefficients; } // Number of coefficients int ClpConstraintQuadratic::numberCoefficients() const { return numberCoefficients_; } CoinMP-1.8.3/Clp/src/OsiClp/0000755000175000017500000000000012600453455014016 5ustar renereneCoinMP-1.8.3/Clp/src/OsiClp/Makefile.in0000644000175000017500000005672012506111472016070 0ustar renerene# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. # Author: Andreas Waechter IBM 2006-04-13 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = src/OsiClp DIST_COMMON = $(includecoin_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/src/config_clp.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @DEPENDENCY_LINKING_TRUE@libOsiClp_la_DEPENDENCIES = \ @DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) ../libClp.la am_libOsiClp_la_OBJECTS = OsiClpSolverInterface.lo libOsiClp_la_OBJECTS = $(am_libOsiClp_la_OBJECTS) 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 --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOsiClp_la_SOURCES) DIST_SOURCES = $(libOsiClp_la_SOURCES) includecoinHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includecoin_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMDINCDIR = @AMDINCDIR@ AMDLIB = @AMDLIB@ AMTAR = @AMTAR@ AR = @AR@ ASL_CFLAGS = @ASL_CFLAGS@ ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ ASL_DATA = @ASL_DATA@ ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ ASL_LIBS = @ASL_LIBS@ ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AUX_DIR = @AUX_DIR@ AWK = @AWK@ BLAS_CFLAGS = @BLAS_CFLAGS@ BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ BLAS_DATA = @BLAS_DATA@ BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ BLAS_LIBS = @BLAS_LIBS@ BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ BUILDTOOLSDIR = @BUILDTOOLSDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ CHOLMODINCDIR = @CHOLMODINCDIR@ CHOLMODLIB = @CHOLMODLIB@ CLPLIB_CFLAGS = @CLPLIB_CFLAGS@ CLPLIB_CFLAGS_INSTALLED = @CLPLIB_CFLAGS_INSTALLED@ CLPLIB_DEPENDENCIES = @CLPLIB_DEPENDENCIES@ CLPLIB_LIBS = @CLPLIB_LIBS@ CLPLIB_LIBS_INSTALLED = @CLPLIB_LIBS_INSTALLED@ CLPLIB_PCLIBS = @CLPLIB_PCLIBS@ CLPLIB_PCREQUIRES = @CLPLIB_PCREQUIRES@ CLP_SVN_REV = @CLP_SVN_REV@ COINUTILS_CFLAGS = @COINUTILS_CFLAGS@ COINUTILS_CFLAGS_INSTALLED = @COINUTILS_CFLAGS_INSTALLED@ COINUTILS_DATA = @COINUTILS_DATA@ COINUTILS_DATA_INSTALLED = @COINUTILS_DATA_INSTALLED@ COINUTILS_DEPENDENCIES = @COINUTILS_DEPENDENCIES@ COINUTILS_LIBS = @COINUTILS_LIBS@ COINUTILS_LIBS_INSTALLED = @COINUTILS_LIBS_INSTALLED@ COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ COIN_HAS_ABC_FALSE = @COIN_HAS_ABC_FALSE@ COIN_HAS_ABC_TRUE = @COIN_HAS_ABC_TRUE@ COIN_HAS_AMD_FALSE = @COIN_HAS_AMD_FALSE@ COIN_HAS_AMD_TRUE = @COIN_HAS_AMD_TRUE@ COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ COIN_HAS_CHOLMOD_FALSE = @COIN_HAS_CHOLMOD_FALSE@ COIN_HAS_CHOLMOD_TRUE = @COIN_HAS_CHOLMOD_TRUE@ COIN_HAS_COINUTILS_FALSE = @COIN_HAS_COINUTILS_FALSE@ COIN_HAS_COINUTILS_TRUE = @COIN_HAS_COINUTILS_TRUE@ COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ COIN_HAS_GLPK_FALSE = @COIN_HAS_GLPK_FALSE@ COIN_HAS_GLPK_TRUE = @COIN_HAS_GLPK_TRUE@ COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ COIN_HAS_MUMPS_FALSE = @COIN_HAS_MUMPS_FALSE@ COIN_HAS_MUMPS_TRUE = @COIN_HAS_MUMPS_TRUE@ COIN_HAS_NETLIB_FALSE = @COIN_HAS_NETLIB_FALSE@ COIN_HAS_NETLIB_TRUE = @COIN_HAS_NETLIB_TRUE@ COIN_HAS_OSITESTS_FALSE = @COIN_HAS_OSITESTS_FALSE@ COIN_HAS_OSITESTS_TRUE = @COIN_HAS_OSITESTS_TRUE@ COIN_HAS_OSI_FALSE = @COIN_HAS_OSI_FALSE@ COIN_HAS_OSI_TRUE = @COIN_HAS_OSI_TRUE@ COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_HAS_SAMPLE_FALSE = @COIN_HAS_SAMPLE_FALSE@ COIN_HAS_SAMPLE_TRUE = @COIN_HAS_SAMPLE_TRUE@ COIN_HAS_WSMP_FALSE = @COIN_HAS_WSMP_FALSE@ COIN_HAS_WSMP_TRUE = @COIN_HAS_WSMP_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBG_CFLAGS = @DBG_CFLAGS@ DBG_CXXFLAGS = @DBG_CXXFLAGS@ DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FLIBS = @FLIBS@ GLPK_CFLAGS = @GLPK_CFLAGS@ GLPK_CFLAGS_INSTALLED = @GLPK_CFLAGS_INSTALLED@ GLPK_DATA = @GLPK_DATA@ GLPK_DATA_INSTALLED = @GLPK_DATA_INSTALLED@ GLPK_DEPENDENCIES = @GLPK_DEPENDENCIES@ GLPK_LIBS = @GLPK_LIBS@ GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@ HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MPICC = @MPICC@ MPICXX = @MPICXX@ MPIF77 = @MPIF77@ MUMPS_CFLAGS = @MUMPS_CFLAGS@ MUMPS_CFLAGS_INSTALLED = @MUMPS_CFLAGS_INSTALLED@ MUMPS_DATA = @MUMPS_DATA@ MUMPS_DATA_INSTALLED = @MUMPS_DATA_INSTALLED@ MUMPS_DEPENDENCIES = @MUMPS_DEPENDENCIES@ MUMPS_LIBS = @MUMPS_LIBS@ MUMPS_LIBS_INSTALLED = @MUMPS_LIBS_INSTALLED@ NETLIB_CFLAGS = @NETLIB_CFLAGS@ NETLIB_CFLAGS_INSTALLED = @NETLIB_CFLAGS_INSTALLED@ NETLIB_DATA = @NETLIB_DATA@ NETLIB_DATA_INSTALLED = @NETLIB_DATA_INSTALLED@ NETLIB_DEPENDENCIES = @NETLIB_DEPENDENCIES@ NETLIB_LIBS = @NETLIB_LIBS@ NETLIB_LIBS_INSTALLED = @NETLIB_LIBS_INSTALLED@ OBJEXT = @OBJEXT@ OPT_CFLAGS = @OPT_CFLAGS@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OPT_FFLAGS = @OPT_FFLAGS@ OSICLPLIB_CFLAGS = @OSICLPLIB_CFLAGS@ OSICLPLIB_CFLAGS_INSTALLED = @OSICLPLIB_CFLAGS_INSTALLED@ OSICLPLIB_DEPENDENCIES = @OSICLPLIB_DEPENDENCIES@ OSICLPLIB_LIBS = @OSICLPLIB_LIBS@ OSICLPLIB_LIBS_INSTALLED = @OSICLPLIB_LIBS_INSTALLED@ OSICLPLIB_PCLIBS = @OSICLPLIB_PCLIBS@ OSICLPLIB_PCREQUIRES = @OSICLPLIB_PCREQUIRES@ OSITESTS_CFLAGS = @OSITESTS_CFLAGS@ OSITESTS_CFLAGS_INSTALLED = @OSITESTS_CFLAGS_INSTALLED@ OSITESTS_DATA = @OSITESTS_DATA@ OSITESTS_DATA_INSTALLED = @OSITESTS_DATA_INSTALLED@ OSITESTS_DEPENDENCIES = @OSITESTS_DEPENDENCIES@ OSITESTS_LIBS = @OSITESTS_LIBS@ OSITESTS_LIBS_INSTALLED = @OSITESTS_LIBS_INSTALLED@ OSI_CFLAGS = @OSI_CFLAGS@ OSI_CFLAGS_INSTALLED = @OSI_CFLAGS_INSTALLED@ OSI_DATA = @OSI_DATA@ OSI_DATA_INSTALLED = @OSI_DATA_INSTALLED@ OSI_DEPENDENCIES = @OSI_DEPENDENCIES@ OSI_LIBS = @OSI_LIBS@ OSI_LIBS_INSTALLED = @OSI_LIBS_INSTALLED@ 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_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ SAMPLE_CFLAGS = @SAMPLE_CFLAGS@ SAMPLE_CFLAGS_INSTALLED = @SAMPLE_CFLAGS_INSTALLED@ SAMPLE_DATA = @SAMPLE_DATA@ SAMPLE_DATA_INSTALLED = @SAMPLE_DATA_INSTALLED@ SAMPLE_DEPENDENCIES = @SAMPLE_DEPENDENCIES@ SAMPLE_LIBS = @SAMPLE_LIBS@ SAMPLE_LIBS_INSTALLED = @SAMPLE_LIBS_INSTALLED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ abs_bin_dir = @abs_bin_dir@ abs_include_dir = @abs_include_dir@ abs_lib_dir = @abs_lib_dir@ abs_source_dir = @abs_source_dir@ ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ exec_prefix = @exec_prefix@ have_autoconf = @have_autoconf@ have_automake = @have_automake@ have_svn = @have_svn@ have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiClp # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiClp.la # List all source files for this library, including headers libOsiClp_la_SOURCES = OsiClpSolverInterface.cpp OsiClpSolverInterface.hpp # List all additionally required libraries @DEPENDENCY_LINKING_TRUE@libOsiClp_la_LIBADD = $(OSICLPLIB_LIBS) ../libClp.la # This is for libtool (on Windows) libOsiClp_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiClpSolverInterface.hpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 src/OsiClp/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/OsiClp/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_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 libOsiClp.la: $(libOsiClp_la_OBJECTS) $(libOsiClp_la_DEPENDENCIES) $(CXXLINK) -rpath $(libdir) $(libOsiClp_la_LDFLAGS) $(libOsiClp_la_OBJECTS) $(libOsiClp_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OsiClpSolverInterface.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @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 distclean-libtool: -rm -f libtool uninstall-info-am: install-includecoinHEADERS: $(includecoin_HEADERS) @$(NORMAL_INSTALL) test -z "$(includecoindir)" || $(mkdir_p) "$(DESTDIR)$(includecoindir)" @list='$(includecoin_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includecoinHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includecoindir)/$$f'"; \ $(includecoinHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includecoindir)/$$f"; \ done uninstall-includecoinHEADERS: @$(NORMAL_UNINSTALL) @list='$(includecoin_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includecoindir)/$$f'"; \ rm -f "$(DESTDIR)$(includecoindir)/$$f"; \ done 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; } \ END { 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; } \ END { 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=; \ 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; } \ END { 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)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ 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: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includecoindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includecoinHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: 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: uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool 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-exec \ install-exec-am install-includecoinHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ 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 \ uninstall-includecoinHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # 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: CoinMP-1.8.3/Clp/src/OsiClp/osi-clp-uninstalled.pc.in0000644000175000017500000000045511507672206020643 0ustar renereneprefix=@prefix@ libdir=@ABSBUILDDIR@/src/OsiClp Name: OsiClp Description: COIN-OR Open Solver Interface for CLP URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: ${libdir}/libOsiClp.la @OSICLPLIB_PCLIBS@ Cflags: -I@abs_source_dir@/src/OsiClp Requires: clp @OSICLPLIB_PCREQUIRES@ CoinMP-1.8.3/Clp/src/OsiClp/Makefile.am0000644000175000017500000000325212243462572016057 0ustar renerene# Copyright (C) 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. ## $Id: Makefile.am 1152 2007-12-28 03:59:07Z andreasw $ # Author: Andreas Waechter IBM 2006-04-13 AUTOMAKE_OPTIONS = foreign ######################################################################## # libOsiClp # ######################################################################## # Name of the library compiled in this directory. lib_LTLIBRARIES = libOsiClp.la # List all source files for this library, including headers libOsiClp_la_SOURCES = OsiClpSolverInterface.cpp OsiClpSolverInterface.hpp # List all additionally required libraries if DEPENDENCY_LINKING libOsiClp_la_LIBADD = $(OSICLPLIB_LIBS) ../libClp.la endif # This is for libtool (on Windows) libOsiClp_la_LDFLAGS = $(LT_LDFLAGS) # Here list all include flags, relative to this "srcdir" directory. This # "cygpath" stuff is necessary to compile with native compilers on Windows. AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/..` $(COINUTILS_CFLAGS) $(OSI_CFLAGS) # This line is necessary to allow VPATH compilation DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I.. ######################################################################## # Headers that need to be installed # ######################################################################## # Here list all the header files that are required by a user of the library, # and that therefore should be installed in 'include/coin' includecoindir = $(includedir)/coin includecoin_HEADERS = OsiClpSolverInterface.hpp CoinMP-1.8.3/Clp/src/OsiClp/OsiClpSolverInterface.cpp0000644000175000017500000125021212551205635020732 0ustar renerene// $Id$ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #ifdef CBC_STATISTICS extern int osi_crunch; extern int osi_primal; extern int osi_dual; extern int osi_hot; #endif #include "CoinTime.hpp" #include "CoinHelperFunctions.hpp" #include "CoinIndexedVector.hpp" #include "CoinModel.hpp" #include "CoinMpsIO.hpp" #include "CoinSort.hpp" #include "ClpDualRowSteepest.hpp" #include "ClpPrimalColumnSteepest.hpp" #include "ClpPackedMatrix.hpp" #include "ClpDualRowDantzig.hpp" #include "ClpPrimalColumnDantzig.hpp" #include "ClpFactorization.hpp" #include "ClpObjective.hpp" #include "ClpSimplex.hpp" #include "ClpSimplexOther.hpp" #include "ClpSimplexPrimal.hpp" #include "ClpSimplexDual.hpp" #include "ClpNonLinearCost.hpp" #include "OsiClpSolverInterface.hpp" #include "OsiBranchingObject.hpp" #include "OsiCuts.hpp" #include "OsiRowCut.hpp" #include "OsiColCut.hpp" #include "ClpPresolve.hpp" #include "CoinLpIO.hpp" //#define PRINT_TIME #ifdef PRINT_TIME static double totalTime=0.0; #endif //#define SAVE_MODEL 1 #ifdef SAVE_MODEL static int resolveTry=0; static int loResolveTry=0; static int hiResolveTry=9999999; #endif //############################################################################# // Solve methods //############################################################################# void OsiClpSolverInterface::initialSolve() { #define KEEP_SMALL #ifdef KEEP_SMALL if (smallModel_) { delete [] spareArrays_; spareArrays_ = NULL; delete smallModel_; smallModel_=NULL; } #endif if ((specialOptions_&2097152)!=0||(specialOptions_&4194304)!=0) { bool takeHint; OsiHintStrength strength; int algorithm = 0; getHintParam(OsiDoDualInInitial,takeHint,strength); if (strength!=OsiHintIgnore) algorithm = takeHint ? -1 : 1; if (algorithm>0||(specialOptions_&4194304)!=0) { // Gub resolveGub((9*modelPtr_->numberRows())/10); return; } } bool deleteSolver; ClpSimplex * solver; #ifdef PRINT_TIME double time1 = CoinCpuTime(); #endif int userFactorizationFrequency = modelPtr_->factorization()->maximumPivots(); int totalIterations=0; bool abortSearch=false; ClpObjective * savedObjective=NULL; double savedDualLimit=modelPtr_->dblParam_[ClpDualObjectiveLimit]; if (fakeObjective_) { // Clear (no objective, 0-1 and in B&B) modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~128)); // See if all with costs fixed int numberColumns = modelPtr_->numberColumns_; const double * obj = modelPtr_->objective(); const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); int i; for (i=0;iobjective_; modelPtr_->objective_=fakeObjective_; modelPtr_->dblParam_[ClpDualObjectiveLimit]=COIN_DBL_MAX; } else { // Set (no objective, 0-1 and in B&B) modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()|128); } } } // Check (in branch and bound) if ((specialOptions_&1024)==0) { solver = new ClpSimplex(true); deleteSolver=true; solver->borrowModel(*modelPtr_); // See if user set factorization frequency // borrowModel does not move solver->factorization()->maximumPivots(userFactorizationFrequency); } else { solver = modelPtr_; deleteSolver=false; } // Treat as if user simplex not enabled int saveSolveType=solver->solveType(); bool doingPrimal = solver->algorithm()>0; if (saveSolveType==2) { disableSimplexInterface(); solver->setSolveType(1); } int saveOptions = solver->specialOptions(); solver->setSpecialOptions(saveOptions|64|32768); // go as far as possible // get original log levels int saveMessageLevel=modelPtr_->logLevel(); int messageLevel=messageHandler()->logLevel(); int saveMessageLevel2 = messageLevel; // Set message handler if (!defaultHandler_) solver->passInMessageHandler(handler_); // But keep log level solver->messageHandler()->setLogLevel(saveMessageLevel); // set reasonable defaults bool takeHint; OsiHintStrength strength; // Switch off printing if asked to bool gotHint = (getHintParam(OsiDoReducePrint,takeHint,strength)); assert (gotHint); if (strength!=OsiHintIgnore&&takeHint) { if (messageLevel>0) messageLevel--; } if (messageLevelmessageHandler()->setLogLevel(messageLevel); // Allow for specialOptions_==1+8 forcing saving factorization int startFinishOptions=0; if ((specialOptions_&9)==(1+8)) { startFinishOptions =1+2+4; // allow re-use of factorization } bool defaultHints=true; { int hint; for (hint=OsiDoPresolveInInitial;hint (hint),yesNo,strength); if (yesNo) { defaultHints=false; break; } if (strength != OsiHintIgnore) { defaultHints=false; break; } } } } ClpPresolve * pinfo = NULL; /* If basis then do primal (as user could do dual with resolve) If not then see if dual feasible (and allow for gubs etc?) */ bool doPrimal = (basis_.numberBasicStructurals()>0); setBasis(basis_,solver); bool inCbcOrOther = (modelPtr_->specialOptions()&0x03000000)!=0; if ((!defaultHints||doPrimal)&&!solveOptions_.getSpecialOption(6)) { // scaling // save initial state const double * rowScale1 = solver->rowScale(); if (modelPtr_->solveType()==1) { gotHint = (getHintParam(OsiDoScale,takeHint,strength)); assert (gotHint); if (strength==OsiHintIgnore||takeHint) { if (!solver->scalingFlag()) solver->scaling(3); } else { solver->scaling(0); } } else { solver->scaling(0); } //solver->setDualBound(1.0e6); //solver->setDualTolerance(1.0e-7); //ClpDualRowSteepest steep; //solver->setDualRowPivotAlgorithm(steep); //solver->setPrimalTolerance(1.0e-8); //ClpPrimalColumnSteepest steepP; //solver->setPrimalColumnPivotAlgorithm(steepP); // sort out hints; // algorithm 0 whatever, -1 force dual, +1 force primal int algorithm = 0; gotHint = (getHintParam(OsiDoDualInInitial,takeHint,strength)); assert (gotHint); if (strength!=OsiHintIgnore) algorithm = takeHint ? -1 : 1; // crash 0 do lightweight if all slack, 1 do, -1 don't int doCrash=0; gotHint = (getHintParam(OsiDoCrash,takeHint,strength)); assert (gotHint); if (strength!=OsiHintIgnore) doCrash = takeHint ? 1 : -1; // doPrimal set true if any structurals in basis so switch off crash if (doPrimal) doCrash = -1; // presolve gotHint = (getHintParam(OsiDoPresolveInInitial,takeHint,strength)); assert (gotHint); if (strength!=OsiHintIgnore&&takeHint) { pinfo = new ClpPresolve(); ClpSimplex * model2 = pinfo->presolvedModel(*solver,1.0e-8); if (!model2) { // problem found to be infeasible - whats best? model2 = solver; delete pinfo; pinfo = NULL; } else { model2->setSpecialOptions(solver->specialOptions()); } // change from 200 (unless changed) if (modelPtr_->factorization()->maximumPivots()==200) model2->factorization()->maximumPivots(100+model2->numberRows()/50); else model2->factorization()->maximumPivots(userFactorizationFrequency); int savePerturbation = model2->perturbation(); if (savePerturbation==100) model2->setPerturbation(50); if (!doPrimal) { // faster if bounds tightened //int numberInfeasibilities = model2->tightenPrimalBounds(); model2->tightenPrimalBounds(); // look further bool crashResult=false; if (doCrash>0) crashResult = (solver->crash(1000.0,1)>0); else if (doCrash==0&&algorithm>0) crashResult = (solver->crash(1000.0,1)>0); doPrimal=crashResult; } if (algorithm<0) doPrimal=false; else if (algorithm>0) doPrimal=true; if (!doPrimal) { //if (numberInfeasibilities) //std::cout<<"** Analysis indicates model infeasible" // <setDualBound(1.0e11); disasterHandler_->setOsiModel(this); if (inCbcOrOther) { disasterHandler_->setSimplex(model2); disasterHandler_->setWhereFrom(4); model2->setDisasterHandler(disasterHandler_); } model2->dual(0); totalIterations += model2->numberIterations(); if (inCbcOrOther) { if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("dual trouble a\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try just going back in disasterHandler_->setPhase(1); model2->dual(); totalIterations += model2->numberIterations(); if (disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("dual trouble b\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal with original basis disasterHandler_->setPhase(2); setBasis(basis_,model2); model2->primal(); totalIterations += model2->numberIterations(); } if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } model2->setProblemStatus(1); } } // reset model2->setDisasterHandler(NULL); } // check if clp thought it was in a loop if (model2->status()==3&&!model2->hitMaximumIterations()) { // switch algorithm disasterHandler_->setOsiModel(this); if (inCbcOrOther) { disasterHandler_->setSimplex(model2); disasterHandler_->setWhereFrom(6); model2->setDisasterHandler(disasterHandler_); } model2->primal(); totalIterations += model2->numberIterations(); if (inCbcOrOther) { if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("primal trouble a\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try just going back in (but with dual) disasterHandler_->setPhase(1); model2->dual(); totalIterations += model2->numberIterations(); if (disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("primal trouble b\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal with original basis disasterHandler_->setPhase(2); setBasis(basis_,model2); model2->dual(); totalIterations += model2->numberIterations(); } if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } model2->setProblemStatus(1); } } // reset model2->setDisasterHandler(NULL); } } } else { // up infeasibility cost for safety //model2->setInfeasibilityCost(1.0e10); disasterHandler_->setOsiModel(this); if (inCbcOrOther) { disasterHandler_->setSimplex(model2); disasterHandler_->setWhereFrom(6); model2->setDisasterHandler(disasterHandler_); } model2->primal(1); totalIterations += model2->numberIterations(); if (inCbcOrOther) { if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("primal trouble a\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try just going back in (but with dual) disasterHandler_->setPhase(1); model2->dual(); totalIterations += model2->numberIterations(); if (disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("primal trouble b\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal with original basis disasterHandler_->setPhase(2); setBasis(basis_,model2); model2->dual(); totalIterations += model2->numberIterations(); } if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } model2->setProblemStatus(1); } } // reset model2->setDisasterHandler(NULL); } // check if clp thought it was in a loop if (model2->status()==3&&!model2->hitMaximumIterations()) { // switch algorithm disasterHandler_->setOsiModel(this); if (inCbcOrOther) { disasterHandler_->setSimplex(model2); disasterHandler_->setWhereFrom(4); model2->setDisasterHandler(disasterHandler_); } model2->dual(0); totalIterations += model2->numberIterations(); if (inCbcOrOther) { if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("dual trouble a\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try just going back in disasterHandler_->setPhase(1); model2->dual(); totalIterations += model2->numberIterations(); if (disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("dual trouble b\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal with original basis disasterHandler_->setPhase(2); setBasis(basis_,model2); model2->primal(); totalIterations += model2->numberIterations(); } if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } model2->setProblemStatus(1); } } // reset model2->setDisasterHandler(NULL); } } } model2->setPerturbation(savePerturbation); if (model2!=solver) { int presolvedStatus = model2->status(); pinfo->postsolve(true); delete pinfo; pinfo = NULL; delete model2; int oldStatus=solver->status(); solver->setProblemStatus(presolvedStatus); if (solver->logLevel()==63) // for gcc 4.6 bug printf("pstat %d stat %d\n",presolvedStatus,oldStatus); //printf("Resolving from postsolved model\n"); // later try without (1) and check duals before solve if (presolvedStatus!=3 &&(presolvedStatus||oldStatus==-1)) { if (!inCbcOrOther||presolvedStatus!=1) { disasterHandler_->setOsiModel(this); if (inCbcOrOther) { disasterHandler_->setSimplex(solver); // as "borrowed" disasterHandler_->setWhereFrom(6); solver->setDisasterHandler(disasterHandler_); } solver->primal(1); totalIterations += solver->numberIterations(); if (inCbcOrOther) { if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("primal trouble a\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try just going back in (but with dual) disasterHandler_->setPhase(1); solver->dual(); totalIterations += solver->numberIterations(); if (disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("primal trouble b\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal with original basis disasterHandler_->setPhase(2); setBasis(basis_,solver); solver->dual(); totalIterations += solver->numberIterations(); } if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } solver->setProblemStatus(1); } } // reset solver->setDisasterHandler(NULL); } } } } lastAlgorithm_=1; // primal //if (solver->numberIterations()) //printf("****** iterated %d\n",solver->numberIterations()); } else { // do we want crash if (doCrash>0) solver->crash(1000.0,2); else if (doCrash==0) solver->crash(1000.0,0); if (algorithm<0) doPrimal=false; else if (algorithm>0) doPrimal=true; disasterHandler_->setOsiModel(this); disasterHandler_->setSimplex(solver); // as "borrowed" bool inCbcOrOther = (modelPtr_->specialOptions()&0x03000000)!=0; if (!doPrimal) disasterHandler_->setWhereFrom(4); else disasterHandler_->setWhereFrom(6); if (inCbcOrOther) solver->setDisasterHandler(disasterHandler_); if (!doPrimal) { //printf("doing dual\n"); solver->dual(0); totalIterations += solver->numberIterations(); if (inCbcOrOther) { if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("dual trouble a\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try just going back in disasterHandler_->setPhase(1); solver->dual(); totalIterations += solver->numberIterations(); if (disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("dual trouble b\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal with original basis disasterHandler_->setPhase(2); setBasis(basis_,solver); solver->primal(); totalIterations += solver->numberIterations(); } if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } solver->setProblemStatus(1); } } // reset solver->setDisasterHandler(NULL); } lastAlgorithm_=2; // dual // check if clp thought it was in a loop if (solver->status()==3&&!solver->hitMaximumIterations()) { // switch algorithm solver->primal(0); totalIterations += solver->numberIterations(); lastAlgorithm_=1; // primal } } else { //printf("doing primal\n"); solver->primal(1); totalIterations += solver->numberIterations(); if (inCbcOrOther) { if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("primal trouble a\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try just going back in (but with dual) disasterHandler_->setPhase(1); solver->dual(); totalIterations += solver->numberIterations(); if (disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("primal trouble b\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal with original basis disasterHandler_->setPhase(2); setBasis(basis_,solver); solver->dual(); totalIterations += solver->numberIterations(); } if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } solver->setProblemStatus(1); } } // reset solver->setDisasterHandler(NULL); } lastAlgorithm_=1; // primal // check if clp thought it was in a loop if (solver->status()==3&&!solver->hitMaximumIterations()) { // switch algorithm solver->dual(0); totalIterations += solver->numberIterations(); lastAlgorithm_=2; // dual } } } // If scaled feasible but unscaled infeasible take action if (!solver->status()&&cleanupScaling_) { solver->cleanup(cleanupScaling_); } basis_ = getBasis(solver); //basis_.print(); const double * rowScale2 = solver->rowScale(); solver->setSpecialOptions(saveOptions); if (!rowScale1&&rowScale2) { // need to release memory if (!solver->savedRowScale_) { solver->setRowScale(NULL); solver->setColumnScale(NULL); } else { solver->rowScale_=NULL; solver->columnScale_=NULL; } } } else { // User doing nothing and all slack basis ClpSolve options=solveOptions_; bool yesNo; OsiHintStrength strength; getHintParam(OsiDoInBranchAndCut,yesNo,strength); if (yesNo) { solver->setSpecialOptions(solver->specialOptions()|1024); } solver->initialSolve(options); totalIterations += solver->numberIterations(); lastAlgorithm_ = 2; // say dual // If scaled feasible but unscaled infeasible take action if (!solver->status()&&cleanupScaling_) { solver->cleanup(cleanupScaling_); } basis_ = getBasis(solver); //basis_.print(); } solver->messageHandler()->setLogLevel(saveMessageLevel); disaster: if (deleteSolver) { solver->returnModel(*modelPtr_); delete solver; } if (startFinishOptions) { int save = modelPtr_->logLevel(); if (save<2) modelPtr_->setLogLevel(0); modelPtr_->dual(0,startFinishOptions); totalIterations += modelPtr_->numberIterations(); modelPtr_->setLogLevel(save); } if (saveSolveType==2) { enableSimplexInterface(doingPrimal); } if (savedObjective) { // fix up modelPtr_->dblParam_[ClpDualObjectiveLimit]=savedDualLimit; //modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~32)); modelPtr_->objective_=savedObjective; if (!modelPtr_->problemStatus_) { CoinZeroN(modelPtr_->dual_,modelPtr_->numberRows_); CoinZeroN(modelPtr_->reducedCost_,modelPtr_->numberColumns_); if (modelPtr_->dj_&&(modelPtr_->whatsChanged_&1)!=0) CoinZeroN(modelPtr_->dj_,modelPtr_->numberColumns_+modelPtr_->numberRows_); modelPtr_->computeObjectiveValue(); } } modelPtr_->setNumberIterations(totalIterations); handler_->setLogLevel(saveMessageLevel2); if (modelPtr_->problemStatus_==3&&lastAlgorithm_==2) modelPtr_->computeObjectiveValue(); // mark so we can pick up objective value quickly modelPtr_->upperIn_=0.0; #ifdef PRINT_TIME time1 = CoinCpuTime()-time1; totalTime += time1; #endif assert (!modelPtr_->disasterHandler()); if (lastAlgorithm_<1||lastAlgorithm_>2) lastAlgorithm_=1; if (abortSearch) { lastAlgorithm_=-911; modelPtr_->setProblemStatus(4); } modelPtr_->whatsChanged_ |= 0x30000; #if 0 // delete scaled matrix and rowcopy for safety delete modelPtr_->scaledMatrix_; modelPtr_->scaledMatrix_=NULL; delete modelPtr_->rowCopy_; modelPtr_->rowCopy_=NULL; #endif #ifdef PRINT_TIME std::cout<-1.0e12); } n = getNumRows(); lower = getRowLower() ; upper = getRowUpper() ; for (i=0;i-1.0e12); } } #endif if ((stuff_.solverOptions_&65536)!=0) { modelPtr_->fastDual2(&stuff_); return; } if ((specialOptions_&2097152)!=0||(specialOptions_&4194304)!=0) { bool takeHint; OsiHintStrength strength; int algorithm = 0; getHintParam(OsiDoDualInResolve,takeHint,strength); if (strength!=OsiHintIgnore) algorithm = takeHint ? -1 : 1; if (algorithm>0||(specialOptions_&4194304)!=0) { // Gub resolveGub((9*modelPtr_->numberRows())/10); return; } } //void pclp(char *); //pclp("res"); bool takeHint; OsiHintStrength strength; bool gotHint = (getHintParam(OsiDoInBranchAndCut,takeHint,strength)); assert (gotHint); // mark so we can pick up objective value quickly modelPtr_->upperIn_=0.0; if ((specialOptions_&4096)!=0) { // Quick check to see if optimal modelPtr_->checkSolutionInternal(); if (modelPtr_->problemStatus()==0) { modelPtr_->setNumberIterations(0); return; } } int totalIterations=0; bool abortSearch=false; ClpObjective * savedObjective=NULL; double savedDualLimit=modelPtr_->dblParam_[ClpDualObjectiveLimit]; if (fakeObjective_) { modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~128)); // See if all with costs fixed int numberColumns = modelPtr_->numberColumns_; const double * obj = modelPtr_->objective(); const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); int i; for (i=0;iobjective_; modelPtr_->objective_=fakeObjective_; modelPtr_->dblParam_[ClpDualObjectiveLimit]=COIN_DBL_MAX; } else { modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()|128); } } } // If using Clp initialSolve and primal - just do here gotHint = (getHintParam(OsiDoDualInResolve,takeHint,strength)); assert (gotHint); if (strength!=OsiHintIgnore&&!takeHint&&solveOptions_.getSpecialOption(6)) { ClpSolve options=solveOptions_; // presolve getHintParam(OsiDoPresolveInResolve,takeHint,strength); if (strength!=OsiHintIgnore&&!takeHint) options.setPresolveType(ClpSolve::presolveOff); int saveOptions = modelPtr_->specialOptions(); getHintParam(OsiDoInBranchAndCut,takeHint,strength); if (takeHint) { modelPtr_->setSpecialOptions(modelPtr_->specialOptions()|1024); } setBasis(basis_,modelPtr_); modelPtr_->initialSolve(options); lastAlgorithm_ = 1; // say primal // If scaled feasible but unscaled infeasible take action if (!modelPtr_->status()&&cleanupScaling_) { modelPtr_->cleanup(cleanupScaling_); } modelPtr_->setSpecialOptions(saveOptions); // restore basis_ = getBasis(modelPtr_); } int saveSolveType=modelPtr_->solveType(); bool doingPrimal = modelPtr_->algorithm()>0; if (saveSolveType==2) { disableSimplexInterface(); } int saveOptions = modelPtr_->specialOptions(); int startFinishOptions=0; if (specialOptions_!=0x80000000) { if((specialOptions_&1)==0) { startFinishOptions=0; modelPtr_->setSpecialOptions(saveOptions|(64|1024|32768)); } else { startFinishOptions=1+4; if ((specialOptions_&8)!=0) startFinishOptions +=2; // allow re-use of factorization if((specialOptions_&4)==0||!takeHint) modelPtr_->setSpecialOptions(saveOptions|(64|128|512|1024|4096|32768)); else modelPtr_->setSpecialOptions(saveOptions|(64|128|512|1024|2048|4096|32768)); } } else { modelPtr_->setSpecialOptions(saveOptions|64|32768); } //printf("options %d size %d\n",modelPtr_->specialOptions(),modelPtr_->numberColumns()); //modelPtr_->setSolveType(1); // Set message handler to have same levels etc int saveMessageLevel=modelPtr_->logLevel(); int messageLevel=messageHandler()->logLevel(); bool oldDefault; CoinMessageHandler * saveHandler = NULL; if (!defaultHandler_) saveHandler = modelPtr_->pushMessageHandler(handler_,oldDefault); //printf("basis before dual\n"); //basis_.print(); setBasis(basis_,modelPtr_); #ifdef SAVE_MODEL resolveTry++; #if SAVE_MODEL > 1 if (resolveTry>=loResolveTry&& resolveTry<=hiResolveTry) { char fileName[20]; sprintf(fileName,"save%d.mod",resolveTry); modelPtr_->saveModel(fileName); } #endif #endif // set reasonable defaults // Switch off printing if asked to gotHint = (getHintParam(OsiDoReducePrint,takeHint,strength)); assert (gotHint); if (strength!=OsiHintIgnore&&takeHint) { if (messageLevel>0) messageLevel--; } if (messageLevelmessageHandler()->logLevel()) modelPtr_->messageHandler()->setLogLevel(messageLevel); // See if user set factorization frequency int userFactorizationFrequency = modelPtr_->factorization()->maximumPivots(); // scaling if (modelPtr_->solveType()==1) { gotHint = (getHintParam(OsiDoScale,takeHint,strength)); assert (gotHint); if (strength==OsiHintIgnore||takeHint) { if (!modelPtr_->scalingFlag()) modelPtr_->scaling(3); } else { modelPtr_->scaling(0); } } else { modelPtr_->scaling(0); } // sort out hints; // algorithm -1 force dual, +1 force primal int algorithm = -1; gotHint = (getHintParam(OsiDoDualInResolve,takeHint,strength)); assert (gotHint); if (strength!=OsiHintIgnore) algorithm = takeHint ? -1 : 1; //modelPtr_->saveModel("save.bad"); // presolve gotHint = (getHintParam(OsiDoPresolveInResolve,takeHint,strength)); assert (gotHint); if (strength!=OsiHintIgnore&&takeHint) { #ifdef KEEP_SMALL if (smallModel_) { delete [] spareArrays_; spareArrays_ = NULL; delete smallModel_; smallModel_=NULL; } #endif ClpPresolve pinfo; if ((specialOptions_&128)!=0) { specialOptions_ &= ~128; } if ((modelPtr_->specialOptions()&1024)!=0) { pinfo.setDoDual(false); pinfo.setDoTripleton(false); pinfo.setDoDupcol(false); pinfo.setDoDuprow(false); pinfo.setDoSingletonColumn(false); } ClpSimplex * model2 = pinfo.presolvedModel(*modelPtr_,1.0e-8); if (!model2) { // problem found to be infeasible - whats best? model2 = modelPtr_; } // return number of rows int * stats = reinterpret_cast (getApplicationData()); if (stats) { stats[0]=model2->numberRows(); stats[1]=model2->numberColumns(); } //printf("rows %d -> %d, columns %d -> %d\n", // modelPtr_->numberRows(),model2->numberRows(), // modelPtr_->numberColumns(),model2->numberColumns()); // change from 200 if (modelPtr_->factorization()->maximumPivots()==200) model2->factorization()->maximumPivots(100+model2->numberRows()/50); else model2->factorization()->maximumPivots(userFactorizationFrequency); if (algorithm<0) { model2->dual(); totalIterations += model2->numberIterations(); // check if clp thought it was in a loop if (model2->status()==3&&!model2->hitMaximumIterations()) { // switch algorithm model2->primal(); totalIterations += model2->numberIterations(); } } else { model2->primal(1); totalIterations += model2->numberIterations(); // check if clp thought it was in a loop if (model2->status()==3&&!model2->hitMaximumIterations()) { // switch algorithm model2->dual(); totalIterations += model2->numberIterations(); } } if (model2!=modelPtr_) { int finalStatus=model2->status(); pinfo.postsolve(true); delete model2; // later try without (1) and check duals before solve if (finalStatus!=3&&(finalStatus||modelPtr_->status()==-1)) { modelPtr_->primal(1); totalIterations += modelPtr_->numberIterations(); lastAlgorithm_=1; // primal //if (modelPtr_->numberIterations()) //printf("****** iterated %d\n",modelPtr_->numberIterations()); } } } else { //modelPtr_->setLogLevel(63); //modelPtr_->setDualTolerance(1.0e-7); if (false&&modelPtr_->scalingFlag_>0&&!modelPtr_->rowScale_&& !modelPtr_->rowCopy_&&matrixByRow_) { assert (matrixByRow_->getNumElements()==modelPtr_->clpMatrix()->getNumElements()); modelPtr_->setNewRowCopy(new ClpPackedMatrix(*matrixByRow_)); } if (algorithm<0) { //writeMps("try1"); int savePerturbation = modelPtr_->perturbation(); if ((specialOptions_&2)!=0) modelPtr_->setPerturbation(100); //modelPtr_->messageHandler()->setLogLevel(1); //writeMpsNative("bad",NULL,NULL,2,1,1.0); disasterHandler_->setOsiModel(this); bool inCbcOrOther = (modelPtr_->specialOptions()&0x03000000)!=0; #if 0 // See how many integers fixed bool skipCrunch=true; const char * integerInformation = modelPtr_->integerType_; if (integerInformation) { int numberColumns = modelPtr_->numberColumns_; const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); int target=CoinMax(1,numberColumns/10000); for (int i=0;ispecialOptions_&2097152)!=0/*||skipCrunch*/) { disasterHandler_->setWhereFrom(0); // dual if (inCbcOrOther) modelPtr_->setDisasterHandler(disasterHandler_); bool specialScale; if ((specialOptions_&131072)!=0&&!modelPtr_->rowScale_) { modelPtr_->rowScale_ = rowScale_.array(); modelPtr_->columnScale_ = columnScale_.array(); specialScale=true; } else { specialScale=false; } #ifdef KEEP_SMALL if (smallModel_) { delete [] spareArrays_; spareArrays_ = NULL; delete smallModel_; smallModel_=NULL; } #endif #ifdef CBC_STATISTICS osi_dual++; #endif modelPtr_->dual(0,startFinishOptions); totalIterations += modelPtr_->numberIterations(); if (specialScale) { modelPtr_->rowScale_ = NULL; modelPtr_->columnScale_ = NULL; } } else { #ifdef CBC_STATISTICS osi_crunch++; #endif crunch(); totalIterations += modelPtr_->numberIterations(); if (modelPtr_->problemStatus()==4) goto disaster; // should have already been fixed if problems inCbcOrOther=false; } if (inCbcOrOther) { if(disasterHandler_->inTrouble()) { if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try just going back in disasterHandler_->setPhase(1); modelPtr_->dual(); totalIterations += modelPtr_->numberIterations(); if (disasterHandler_->inTrouble()) { if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal with original basis disasterHandler_->setPhase(2); setBasis(basis_,modelPtr_); modelPtr_->primal(); totalIterations += modelPtr_->numberIterations(); } if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } modelPtr_->setProblemStatus(1); } } // reset modelPtr_->setDisasterHandler(NULL); } if (modelPtr_->problemStatus()==4) { // bad bounds? modelPtr_->setProblemStatus(1); } if (!modelPtr_->problemStatus()&&0) { int numberColumns = modelPtr_->numberColumns(); const double * columnLower = modelPtr_->columnLower(); const double * columnUpper = modelPtr_->columnUpper(); int nBad=0; for (int i=0;igetColumnStatus(i)==ClpSimplex::basic) { nBad++; modelPtr_->setColumnStatus(i,ClpSimplex::isFixed); } } if (nBad) { modelPtr_->primal(1); totalIterations += modelPtr_->numberIterations(); printf("%d fixed basic - %d iterations\n",nBad,modelPtr_->numberIterations()); } } assert (modelPtr_->objectiveValue()<1.0e100); modelPtr_->setPerturbation(savePerturbation); lastAlgorithm_=2; // dual // check if clp thought it was in a loop if (modelPtr_->status()==3&&!modelPtr_->hitMaximumIterations()) { modelPtr_->setSpecialOptions(saveOptions); // switch algorithm //modelPtr_->messageHandler()->setLogLevel(63); // Allow for catastrophe int saveMax = modelPtr_->maximumIterations(); int numberIterations = modelPtr_->numberIterations(); int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); if (modelPtr_->maximumIterations()>100000+numberIterations) modelPtr_->setMaximumIterations(numberIterations + 1000 + 2*numberRows+numberColumns); modelPtr_->primal(0,startFinishOptions); totalIterations += modelPtr_->numberIterations(); modelPtr_->setMaximumIterations(saveMax); lastAlgorithm_=1; // primal if (modelPtr_->status()==3&&!modelPtr_->hitMaximumIterations()) { #ifdef COIN_DEVELOP printf("in trouble - try all slack\n"); #endif CoinWarmStartBasis allSlack; setBasis(allSlack,modelPtr_); modelPtr_->dual(); totalIterations += modelPtr_->numberIterations(); if (modelPtr_->status()==3&&!modelPtr_->hitMaximumIterations()) { if (modelPtr_->numberPrimalInfeasibilities()) { #ifdef COIN_DEVELOP printf("Real real trouble - treat as infeasible\n"); #endif modelPtr_->setProblemStatus(1); } else { #ifdef COIN_DEVELOP printf("Real real trouble - treat as optimal\n"); #endif modelPtr_->setProblemStatus(0); } } } } assert (modelPtr_->objectiveValue()<1.0e100); } else { #ifdef KEEP_SMALL if (smallModel_) { delete [] spareArrays_; spareArrays_ = NULL; delete smallModel_; smallModel_=NULL; } #endif //printf("doing primal\n"); #ifdef CBC_STATISTICS osi_primal++; #endif modelPtr_->primal(1,startFinishOptions); totalIterations += modelPtr_->numberIterations(); lastAlgorithm_=1; // primal // check if clp thought it was in a loop if (modelPtr_->status()==3&&!modelPtr_->hitMaximumIterations()) { // switch algorithm modelPtr_->dual(); totalIterations += modelPtr_->numberIterations(); lastAlgorithm_=2; // dual } } } // If scaled feasible but unscaled infeasible take action //if (!modelPtr_->status()&&cleanupScaling_) { if (cleanupScaling_) { modelPtr_->cleanup(cleanupScaling_); } basis_ = getBasis(modelPtr_); disaster: //printf("basis after dual\n"); //basis_.print(); if (!defaultHandler_) modelPtr_->popMessageHandler(saveHandler,oldDefault); modelPtr_->messageHandler()->setLogLevel(saveMessageLevel); if (saveSolveType==2) { int saveStatus = modelPtr_->problemStatus_; enableSimplexInterface(doingPrimal); modelPtr_->problemStatus_=saveStatus; } #ifdef COIN_DEVELOP_x extern bool doingDoneBranch; if (doingDoneBranch) { if (modelPtr_->numberIterations()) printf("***** done %d iterations after general\n",modelPtr_->numberIterations()); doingDoneBranch=false; } #endif modelPtr_->setNumberIterations(totalIterations); //modelPtr_->setSolveType(saveSolveType); if (abortSearch) { lastAlgorithm_=-911; modelPtr_->setProblemStatus(4); } if (savedObjective) { // fix up modelPtr_->dblParam_[ClpDualObjectiveLimit]=savedDualLimit; //modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~32)); modelPtr_->objective_=savedObjective; if (!modelPtr_->problemStatus_) { CoinZeroN(modelPtr_->dual_,modelPtr_->numberRows_); CoinZeroN(modelPtr_->reducedCost_,modelPtr_->numberColumns_); if (modelPtr_->dj_&&(modelPtr_->whatsChanged_&1)!=0) CoinZeroN(modelPtr_->dj_,modelPtr_->numberColumns_+modelPtr_->numberRows_); modelPtr_->computeObjectiveValue(); } } modelPtr_->setSpecialOptions(saveOptions); // restore if (modelPtr_->problemStatus_==3&&lastAlgorithm_==2) modelPtr_->computeObjectiveValue(); if (lastAlgorithm_<1||lastAlgorithm_>2) lastAlgorithm_=1; #ifdef SAVE_MODEL if (resolveTry>=loResolveTry&& resolveTry<=hiResolveTry) { printf("resolve %d took %d iterations - algorithm %d\n",resolveTry,modelPtr_->numberIterations(),lastAlgorithm_); } #endif // Make sure whatsChanged not out of sync if (!modelPtr_->columnUpperWork_) modelPtr_->whatsChanged_ &= ~0xffff; modelPtr_->whatsChanged_ |= 0x30000; } #include "ClpSimplexOther.hpp" // Resolve an LP relaxation after problem modification (try GUB) void OsiClpSolverInterface::resolveGub(int needed) { bool takeHint; OsiHintStrength strength; // Switch off printing if asked to getHintParam(OsiDoReducePrint,takeHint,strength); int saveMessageLevel=modelPtr_->logLevel(); if (strength!=OsiHintIgnore&&takeHint) { int messageLevel=messageHandler()->logLevel(); if (messageLevel>0) modelPtr_->messageHandler()->setLogLevel(messageLevel-1); else modelPtr_->messageHandler()->setLogLevel(0); } //modelPtr_->messageHandler()->setLogLevel(1); setBasis(basis_,modelPtr_); // find gub int numberRows = modelPtr_->numberRows(); int * which = new int[numberRows]; int numberColumns = modelPtr_->numberColumns(); int * whichC = new int[numberColumns+numberRows]; ClpSimplex * model2 = static_cast (modelPtr_)->gubVersion(which,whichC, needed,100); if (model2) { // move in solution static_cast (model2)->setGubBasis(*modelPtr_, which,whichC); model2->setLogLevel(CoinMin(1,model2->logLevel())); ClpPrimalColumnSteepest steepest(5); model2->setPrimalColumnPivotAlgorithm(steepest); //double time1 = CoinCpuTime(); model2->primal(); //printf("Primal took %g seconds\n",CoinCpuTime()-time1); static_cast (model2)->getGubBasis(*modelPtr_, which,whichC); int totalIterations = model2->numberIterations(); delete model2; //modelPtr_->setLogLevel(63); modelPtr_->primal(1); modelPtr_->setNumberIterations(totalIterations+modelPtr_->numberIterations()); } else { modelPtr_->dual(); } delete [] which; delete [] whichC; basis_ = getBasis(modelPtr_); modelPtr_->messageHandler()->setLogLevel(saveMessageLevel); } // Sort of lexicographic resolve void OsiClpSolverInterface::lexSolve() { #if 1 abort(); #else ((ClpSimplexPrimal *) modelPtr_)->lexSolve(); printf("itA %d\n",modelPtr_->numberIterations()); modelPtr_->primal(); printf("itB %d\n",modelPtr_->numberIterations()); basis_ = getBasis(modelPtr_); #endif } /* Sets up solver for repeated use by Osi interface. The normal usage does things like keeping factorization around so can be used. Will also do things like keep scaling and row copy of matrix if matrix does not change. adventure: 0 - safe stuff as above 1 - will take more risks - if it does not work then bug which will be fixed 2 - don't bother doing most extreme termination checks e.g. don't bother re-factorizing if less than 20 iterations. 3 - Actually safer than 1 (mainly just keeps factorization) printOut - -1 always skip round common messages instead of doing some work 0 skip if normal defaults 1 leaves */ void OsiClpSolverInterface::setupForRepeatedUse(int senseOfAdventure, int printOut) { // First try switch (senseOfAdventure) { case 0: specialOptions_=8; break; case 1: specialOptions_=1+2+8; break; case 2: specialOptions_=1+2+4+8; break; case 3: specialOptions_=1+8; break; } //#define NO_CRUNCH2 #ifdef NO_CRUNCH2 specialOptions_ &= ~1; #endif bool stopPrinting=false; if (printOut<0) { stopPrinting=true; } else if (!printOut) { bool takeHint; OsiHintStrength strength; getHintParam(OsiDoReducePrint,takeHint,strength); int messageLevel=messageHandler()->logLevel(); if (strength!=OsiHintIgnore&&takeHint) messageLevel--; stopPrinting = (messageLevel<=0); } #ifndef COIN_DEVELOP if (stopPrinting) { CoinMessages * messagesPointer = modelPtr_->messagesPointer(); // won't even build messages messagesPointer->setDetailMessages(100,10000,reinterpret_cast (NULL)); } #endif } #ifndef NDEBUG // For errors to make sure print to screen // only called in debug mode static void indexError(int index, std::string methodName) { std::cerr<<"Illegal index "<setIntParam(static_cast (key), value); } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::setDblParam(OsiDblParam key, double value) { if (key != OsiLastDblParam ) { if (key==OsiDualObjectiveLimit||key==OsiPrimalObjectiveLimit) value *= modelPtr_->optimizationDirection(); return modelPtr_->setDblParam(static_cast (key), value); } else { return false; } } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::setStrParam(OsiStrParam key, const std::string & value) { assert (key!=OsiSolverName); if (key != OsiLastStrParam ) { return modelPtr_->setStrParam(static_cast (key), value); } else { return false; } } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::getIntParam(OsiIntParam key, int& value) const { return modelPtr_->getIntParam(static_cast (key), value); } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::getDblParam(OsiDblParam key, double& value) const { if (key != OsiLastDblParam ) { bool condition = modelPtr_->getDblParam(static_cast (key), value); if (key==OsiDualObjectiveLimit||key==OsiPrimalObjectiveLimit) value *= modelPtr_->optimizationDirection(); return condition; } else { return false; } } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::getStrParam(OsiStrParam key, std::string & value) const { if ( key==OsiSolverName ) { value = "clp"; return true; } if (key != OsiLastStrParam ) { return modelPtr_->getStrParam(static_cast (key), value); } else { return false; } } //############################################################################# // Methods returning info on how the solution process terminated //############################################################################# bool OsiClpSolverInterface::isAbandoned() const { // not sure about -1 (should not happen) return (modelPtr_->status()==4||modelPtr_->status()==-1|| (modelPtr_->status()==1&&modelPtr_->secondaryStatus()==8)); } bool OsiClpSolverInterface::isProvenOptimal() const { const int stat = modelPtr_->status(); return (stat == 0); } bool OsiClpSolverInterface::isProvenPrimalInfeasible() const { const int stat = modelPtr_->status(); if (stat != 1) return false; return true; } bool OsiClpSolverInterface::isProvenDualInfeasible() const { const int stat = modelPtr_->status(); return stat == 2; } /* NOTE - Coding if limit > 1.0e30 says that 1.0e29 is loose bound so all maximization tests are changed */ bool OsiClpSolverInterface::isPrimalObjectiveLimitReached() const { double limit = 0.0; modelPtr_->getDblParam(ClpPrimalObjectiveLimit, limit); if (fabs(limit) > 1e30) { // was not ever set return false; } const double obj = modelPtr_->objectiveValue(); int maxmin = static_cast (modelPtr_->optimizationDirection()); switch (lastAlgorithm_) { case 0: // no simplex was needed return maxmin > 0 ? (obj < limit) /*minim*/ : (-obj < limit) /*maxim*/; case 2: // dual simplex if (modelPtr_->status() == 0) // optimal return maxmin > 0 ? (obj < limit) /*minim*/ : (-obj < limit) /*maxim*/; return false; case 1: // primal simplex return maxmin > 0 ? (obj < limit) /*minim*/ : (-obj < limit) /*maxim*/; } return false; // fake return } bool OsiClpSolverInterface::isDualObjectiveLimitReached() const { const int stat = modelPtr_->status(); if (stat == 1) return true; else if (stat<0) return false; double limit = 0.0; modelPtr_->getDblParam(ClpDualObjectiveLimit, limit); if (fabs(limit) > 1e30) { // was not ever set return false; } const double obj = modelPtr_->objectiveValue(); int maxmin = static_cast (modelPtr_->optimizationDirection()); switch (lastAlgorithm_) { case 0: // no simplex was needed return maxmin > 0 ? (obj > limit) /*minim*/ : (-obj > limit) /*maxim*/; case 1: // primal simplex if (stat == 0) // optimal return maxmin > 0 ? (obj > limit) /*minim*/ : (-obj > limit) /*maxim*/; return false; case 2: // dual simplex if (stat != 0 && stat != 3) // over dual limit return true; return maxmin > 0 ? (obj > limit) /*minim*/ : (-obj > limit) /*maxim*/; } return false; // fake return } bool OsiClpSolverInterface::isIterationLimitReached() const { const int status = modelPtr_->status(); const int secondaryStatus = modelPtr_->secondaryStatus(); return (status == 3 && secondaryStatus != 9); } //############################################################################# // WarmStart related methods //############################################################################# CoinWarmStart *OsiClpSolverInterface::getEmptyWarmStart () const { return (static_cast(new CoinWarmStartBasis())) ; } CoinWarmStart* OsiClpSolverInterface::getWarmStart() const { return new CoinWarmStartBasis(basis_); } /* Get warm start information. Return warm start information for the current state of the solver interface. If there is no valid warm start information, an empty warm start object wil be returned. This does not necessarily create an object - may just point to one. must Delete set true if user should delete returned object. OsiClp version always returns pointer and false. */ CoinWarmStart* OsiClpSolverInterface::getPointerToWarmStart(bool & mustDelete) { mustDelete = false; return &basis_; } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::setWarmStart(const CoinWarmStart* warmstart) { modelPtr_->whatsChanged_ &= 0xffff; const CoinWarmStartBasis* ws = dynamic_cast(warmstart); if (ws) { basis_ = CoinWarmStartBasis(*ws); return true; } else if (!warmstart) { // create from current basis basis_ = getBasis(modelPtr_); return true; } else { return false; } } //############################################################################# // Hotstart related methods (primarily used in strong branching) //############################################################################# void OsiClpSolverInterface::markHotStart() { #ifdef CBC_STATISTICS osi_hot++; #endif //printf("HotStart options %x changed %x, small %x spare %x\n", // specialOptions_,modelPtr_->whatsChanged_, // smallModel_,spareArrays_); modelPtr_->setProblemStatus(0); saveData_.perturbation_=0; saveData_.specialOptions_ = modelPtr_->specialOptions_; modelPtr_->specialOptions_ |= 0x1000000; modelPtr_->specialOptions_ = saveData_.specialOptions_; ClpObjective * savedObjective=NULL; double savedDualLimit=modelPtr_->dblParam_[ClpDualObjectiveLimit]; if (fakeObjective_) { modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~128)); // See if all with costs fixed int numberColumns = modelPtr_->numberColumns_; const double * obj = modelPtr_->objective(); const double * lower = modelPtr_->columnLower(); const double * upper = modelPtr_->columnUpper(); int i; for (i=0;iobjective_; modelPtr_->objective_=fakeObjective_; modelPtr_->dblParam_[ClpDualObjectiveLimit]=COIN_DBL_MAX; saveData_.perturbation_=1; } else { modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()|128); } } } #define CLEAN_HOT_START #ifdef CLEAN_HOT_START if ((specialOptions_&65536)!=0) { //specialOptions_ |= 65536; saveData_.scalingFlag_=modelPtr_->logLevel(); if (modelPtr_->logLevel()<2) modelPtr_->setLogLevel(0); assert ((specialOptions_&128)==0); // space for save arrays int numberColumns = modelPtr_->numberColumns(); int numberRows = modelPtr_->numberRows(); // Get space for strong branching int size = static_cast((1+4*(numberRows+numberColumns))*sizeof(double)); // and for save of original column bounds size += static_cast(2*numberColumns*sizeof(double)); size += static_cast((1+4*numberRows+2*numberColumns)*sizeof(int)); size += numberRows+numberColumns; assert (spareArrays_==NULL); spareArrays_ = new char[size]; //memset(spareArrays_,0x20,size); // Setup for strong branching assert (factorization_==NULL); if ((specialOptions_&131072)!=0) { assert (lastNumberRows_>=0); if (modelPtr_->rowScale_!=rowScale_.array()) { assert(modelPtr_->columnScale_!=columnScale_.array()); delete [] modelPtr_->rowScale_; modelPtr_->rowScale_=NULL; delete [] modelPtr_->columnScale_; modelPtr_->columnScale_=NULL; if (lastNumberRows_==modelPtr_->numberRows()) { // use scaling modelPtr_->rowScale_ = rowScale_.array(); modelPtr_->columnScale_ = columnScale_.array(); } else { specialOptions_ &= ~131072; } } lastNumberRows_ = -1 -lastNumberRows_; } factorization_ = static_cast(modelPtr_)->setupForStrongBranching(spareArrays_,numberRows, numberColumns,true); double * arrayD = reinterpret_cast (spareArrays_); arrayD[0]=modelPtr_->objectiveValue()* modelPtr_->optimizationDirection(); double * saveSolution = arrayD+1; double * saveLower = saveSolution + (numberRows+numberColumns); double * saveUpper = saveLower + (numberRows+numberColumns); double * saveObjective = saveUpper + (numberRows+numberColumns); double * saveLowerOriginal = saveObjective + (numberRows+numberColumns); double * saveUpperOriginal = saveLowerOriginal + numberColumns; CoinMemcpyN( modelPtr_->columnLower(),numberColumns, saveLowerOriginal); CoinMemcpyN( modelPtr_->columnUpper(),numberColumns, saveUpperOriginal); #if 0 if (whichRange_&&whichRange_[0]) { // get ranging information int numberToDo = whichRange_[0]; int * which = new int [numberToDo]; // Convert column numbers int * backColumn = whichColumn+numberColumns; for (int i=0;igutsOfSolution(NULL,NULL,false); // Tell code we can increase costs in some cases modelPtr_->setCurrentDualTolerance(0.0); ((ClpSimplexOther *) modelPtr_)->dualRanging(numberToDo,which, upRange, whichUp, downRange, whichDown); delete [] whichDown; delete [] whichUp; delete [] which; rowActivity_=upRange; columnActivity_=downRange; } #endif if (savedObjective) { // fix up modelPtr_->dblParam_[ClpDualObjectiveLimit]=savedDualLimit; //modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~32)); modelPtr_->objective_=savedObjective; if (!modelPtr_->problemStatus_) { CoinZeroN(modelPtr_->dual_,modelPtr_->numberRows_); CoinZeroN(modelPtr_->reducedCost_,modelPtr_->numberColumns_); if (modelPtr_->dj_&&(modelPtr_->whatsChanged_&1)!=0) CoinZeroN(modelPtr_->dj_,modelPtr_->numberColumns_+modelPtr_->numberRows_); modelPtr_->computeObjectiveValue(); } } return; } #endif if ((specialOptions_&8192)==0&&false) { // ||(specialOptions_&65536)!=0) { delete ws_; ws_ = dynamic_cast(getWarmStart()); int numberRows = modelPtr_->numberRows(); rowActivity_= new double[numberRows]; CoinMemcpyN(modelPtr_->primalRowSolution(),numberRows,rowActivity_); int numberColumns = modelPtr_->numberColumns(); columnActivity_= new double[numberColumns]; CoinMemcpyN(modelPtr_->primalColumnSolution(),numberColumns,columnActivity_); } else { #if 0 int saveLevel = modelPtr_->logLevel(); modelPtr_->setLogLevel(0); //modelPtr_->dual(); OsiClpSolverInterface::resolve(); if (modelPtr_->numberIterations()>0) printf("**** iterated large %d\n",modelPtr_->numberIterations()); //else //printf("no iterations\n"); modelPtr_->setLogLevel(saveLevel); #endif // called from CbcNode int numberColumns = modelPtr_->numberColumns(); int numberRows = modelPtr_->numberRows(); // Get space for crunch and strong branching (too much) int size = static_cast((1+4*(numberRows+numberColumns))*sizeof(double)); // and for save of original column bounds size += static_cast(2*numberColumns*sizeof(double)); size += static_cast((1+4*numberRows+2*numberColumns)*sizeof(int)); size += numberRows+numberColumns; #ifdef KEEP_SMALL if(smallModel_&&(modelPtr_->whatsChanged_&0x30000)!=0x30000) { //printf("Bounds changed ? %x\n",modelPtr_->whatsChanged_); delete smallModel_; smallModel_=NULL; } if (!smallModel_) { delete [] spareArrays_; spareArrays_ = NULL; } #endif if (spareArrays_==NULL) { //if (smallModel_) //printf("small model %x\n",smallModel_); delete smallModel_; smallModel_=NULL; spareArrays_ = new char[size]; //memset(spareArrays_,0x20,size); } else { double * arrayD = reinterpret_cast (spareArrays_); double * saveSolution = arrayD+1; double * saveLower = saveSolution + (numberRows+numberColumns); double * saveUpper = saveLower + (numberRows+numberColumns); double * saveObjective = saveUpper + (numberRows+numberColumns); double * saveLowerOriginal = saveObjective + (numberRows+numberColumns); double * saveUpperOriginal = saveLowerOriginal + numberColumns; double * lowerOriginal = modelPtr_->columnLower(); double * upperOriginal = modelPtr_->columnUpper(); arrayD = saveUpperOriginal + numberColumns; int * savePivot = reinterpret_cast (arrayD); int * whichRow = savePivot+numberRows; int * whichColumn = whichRow + 3*numberRows; int nSame=0; int nSub=0; for (int i=0;i1.0e-30); double up = upperOriginal[i]; double upOld = saveUpperOriginal[i]; if (lo>=loOld&&up<=upOld) { if (lo==loOld&&up==upOld) { nSame++; } else { nSub++; //if (!isInteger(i)) //nSub+=10; } } } //printf("Mark Hot %d bounds same, %d interior, %d bad\n", // nSame,nSub,numberColumns-nSame-nSub); if (nSamecolumnLower(); double * upperSmall = smallModel_->columnUpper(); int numberColumns2 = smallModel_->numberColumns(); for (int i=0;i (spareArrays_); arrayD[0]=modelPtr_->objectiveValue()* modelPtr_->optimizationDirection(); double * saveSolution = arrayD+1; double * saveLower = saveSolution + (numberRows+numberColumns); double * saveUpper = saveLower + (numberRows+numberColumns); double * saveObjective = saveUpper + (numberRows+numberColumns); double * saveLowerOriginal = saveObjective + (numberRows+numberColumns); double * saveUpperOriginal = saveLowerOriginal + numberColumns; arrayD = saveUpperOriginal + numberColumns; int * savePivot = reinterpret_cast (arrayD); int * whichRow = savePivot+numberRows; int * whichColumn = whichRow + 3*numberRows; int * arrayI = whichColumn + 2*numberColumns; //unsigned char * saveStatus = (unsigned char *) (arrayI+1); // Use dual region double * rhs = modelPtr_->dualRowSolution(); int nBound=0; ClpSimplex * small; #ifndef KEEP_SMALL assert (!smallModel_); small = static_cast (modelPtr_)->crunch(rhs,whichRow,whichColumn,nBound,true); bool needSolveInSetupHotStart=true; #else bool needSolveInSetupHotStart=true; if (!smallModel_) { #ifndef NDEBUG CoinFillN(whichRow,3*numberRows+2*numberColumns,-1); #endif small = static_cast (modelPtr_)->crunch(rhs,whichRow,whichColumn,nBound,true); #ifndef NDEBUG int nCopy = 3*numberRows+2*numberColumns; for (int i=0;i=-CoinMax(numberRows,numberColumns)&&whichRow[i]intParam_[ClpMaxNumIterationHotStart]; //if (5*small->factorization_->maximumPivots()> // 4*hotIts) //small->factorization_->maximumPivots(hotIts+1); } else { assert((modelPtr_->whatsChanged_&0x30000)==0x30000); //delete [] spareArrays_; //spareArrays_ = NULL; assert (spareArrays_); int nCopy = 3*numberRows+2*numberColumns; nBound = whichRow[nCopy]; #ifndef NDEBUG for (int i=0;i=-CoinMax(numberRows,numberColumns)&&whichRow[i]specialOptions_ |= 262144; small->specialOptions_ &= ~65536; } if (small&&(specialOptions_&131072)!=0) { assert (lastNumberRows_>=0); int numberRows2 = small->numberRows(); int numberColumns2 = small->numberColumns(); double * rowScale2 = new double [2*numberRows2]; const double * rowScale = rowScale_.array(); double * inverseScale2 = rowScale2+numberRows2; const double * inverseScale = rowScale+modelPtr_->numberRows_; int i; for (i=0;isetRowScale(rowScale2); double * columnScale2 = new double [2*numberColumns2]; const double * columnScale = columnScale_.array(); inverseScale2 = columnScale2+numberColumns2; inverseScale = columnScale+modelPtr_->numberColumns_; for (i=0;isetColumnScale(columnScale2); } if (!small) { // should never be infeasible .... but delete [] spareArrays_; spareArrays_=NULL; delete ws_; ws_ = dynamic_cast(getWarmStart()); int numberRows = modelPtr_->numberRows(); rowActivity_= new double[numberRows]; CoinMemcpyN(modelPtr_->primalRowSolution(),numberRows,rowActivity_); int numberColumns = modelPtr_->numberColumns(); columnActivity_= new double[numberColumns]; CoinMemcpyN(modelPtr_->primalColumnSolution(),numberColumns,columnActivity_); modelPtr_->setProblemStatus(1); if (savedObjective) { // fix up modelPtr_->dblParam_[ClpDualObjectiveLimit]=savedDualLimit; //modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~32)); modelPtr_->objective_=savedObjective; } return; } int clpOptions = modelPtr_->specialOptions(); clpOptions &= ~65536; if((specialOptions_&1)==0) { small->setSpecialOptions(clpOptions|(64|1024)); } else { if((specialOptions_&4)==0) small->setSpecialOptions(clpOptions|(64|128|512|1024|4096)); else small->setSpecialOptions(clpOptions|(64|128|512|1024|2048|4096)); } arrayI[0]=nBound; assert (smallModel_==NULL||small==smallModel_); if ((specialOptions_&256)!=0||1) { // only need to do this on second pass in CbcNode if (modelPtr_->logLevel()<2) small->setLogLevel(0); small->specialOptions_ |= 262144; small->moreSpecialOptions_ = modelPtr_->moreSpecialOptions_; #define SETUP_HOT #ifndef SETUP_HOT small->dual(); #else assert (factorization_==NULL); //needSolveInSetupHotStart=true; ClpFactorization * factorization = static_cast(small)->setupForStrongBranching(spareArrays_, numberRows,numberColumns, needSolveInSetupHotStart); #endif if (small->numberIterations()>0&&small->logLevel()>2) printf("**** iterated small %d\n",small->numberIterations()); //small->setLogLevel(0); // Could be infeasible if forced one way (and other way stopped on iterations) // could also be stopped on iterations if (small->status()) { #ifndef KEEP_SMALL if (small!=modelPtr_) delete small; //delete smallModel_; //smallModel_=NULL; assert (!smallModel_); #else assert (small==smallModel_); if (smallModel_!=modelPtr_) { delete smallModel_; } smallModel_=NULL; #endif delete [] spareArrays_; spareArrays_=NULL; delete ws_; ws_ = dynamic_cast(getWarmStart()); int numberRows = modelPtr_->numberRows(); rowActivity_= new double[numberRows]; CoinMemcpyN(modelPtr_->primalRowSolution(), numberRows,rowActivity_); int numberColumns = modelPtr_->numberColumns(); columnActivity_= new double[numberColumns]; CoinMemcpyN(modelPtr_->primalColumnSolution(), numberColumns,columnActivity_); modelPtr_->setProblemStatus(1); if (savedObjective) { // fix up modelPtr_->dblParam_[ClpDualObjectiveLimit]=savedDualLimit; //modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~32)); modelPtr_->objective_=savedObjective; } return; } else { // update model static_cast (modelPtr_)->afterCrunch(*small,whichRow,whichColumn,nBound); } #ifndef SETUP_HOT assert (factorization_==NULL); factorization_ = static_cast(small)->setupForStrongBranching(spareArrays_,numberRows, numberColumns,false); #else assert (factorization!=NULL || small->problemStatus_ ); factorization_ = factorization; #endif } else { assert (factorization_==NULL); factorization_ = static_cast(small)->setupForStrongBranching(spareArrays_,numberRows, numberColumns,false); } smallModel_=small; if (modelPtr_->logLevel()<2) smallModel_->setLogLevel(0); // Setup for strong branching int numberColumns2 = smallModel_->numberColumns(); CoinMemcpyN( modelPtr_->columnLower(),numberColumns, saveLowerOriginal); CoinMemcpyN( modelPtr_->columnUpper(),numberColumns, saveUpperOriginal); const double * smallLower = smallModel_->columnLower(); const double * smallUpper = smallModel_->columnUpper(); // But modify if bounds changed in small for (int i=0;isetFactorization(*factorization_); smallModel_->gutsOfSolution(NULL,NULL,false); // Tell code we can increase costs in some cases smallModel_->setCurrentDualTolerance(0.0); static_cast (smallModel_)->dualRanging(numberToDo,which, upRange, whichUp, downRange, whichDown); delete [] whichDown; delete [] whichUp; delete [] which; rowActivity_=upRange; columnActivity_=downRange; } } if (savedObjective) { // fix up modelPtr_->dblParam_[ClpDualObjectiveLimit]=savedDualLimit; //modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~32)); modelPtr_->objective_=savedObjective; if (!modelPtr_->problemStatus_) { CoinZeroN(modelPtr_->dual_,modelPtr_->numberRows_); CoinZeroN(modelPtr_->reducedCost_,modelPtr_->numberColumns_); if (modelPtr_->dj_&&(modelPtr_->whatsChanged_&1)!=0) CoinZeroN(modelPtr_->dj_,modelPtr_->numberColumns_+modelPtr_->numberRows_); modelPtr_->computeObjectiveValue(); } } } void OsiClpSolverInterface::solveFromHotStart() { #ifdef KEEP_SMALL if (!spareArrays_) { assert (!smallModel_); assert (modelPtr_->problemStatus_==1); return; } #endif ClpObjective * savedObjective=NULL; double savedDualLimit=modelPtr_->dblParam_[ClpDualObjectiveLimit]; if (saveData_.perturbation_) { // Set fake savedObjective=modelPtr_->objective_; modelPtr_->objective_=fakeObjective_; modelPtr_->dblParam_[ClpDualObjectiveLimit]=COIN_DBL_MAX; } int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); modelPtr_->getIntParam(ClpMaxNumIteration,itlimOrig_); int itlim; modelPtr_->getIntParam(ClpMaxNumIterationHotStart, itlim); // Is there an extra copy of scaled bounds int extraCopy = (modelPtr_->maximumRows_>0) ? modelPtr_->maximumRows_+modelPtr_->maximumColumns_ : 0; #ifdef CLEAN_HOT_START if ((specialOptions_&65536)!=0) { double * arrayD = reinterpret_cast (spareArrays_); double saveObjectiveValue = arrayD[0]; double * saveSolution = arrayD+1; int number = numberRows+numberColumns; CoinMemcpyN(saveSolution,number,modelPtr_->solutionRegion()); double * saveLower = saveSolution + (numberRows+numberColumns); CoinMemcpyN(saveLower,number,modelPtr_->lowerRegion()); double * saveUpper = saveLower + (numberRows+numberColumns); CoinMemcpyN(saveUpper,number,modelPtr_->upperRegion()); double * saveObjective = saveUpper + (numberRows+numberColumns); CoinMemcpyN(saveObjective,number,modelPtr_->costRegion()); double * saveLowerOriginal = saveObjective + (numberRows+numberColumns); double * saveUpperOriginal = saveLowerOriginal + numberColumns; arrayD = saveUpperOriginal + numberColumns; int * savePivot = reinterpret_cast (arrayD); CoinMemcpyN(savePivot,numberRows,modelPtr_->pivotVariable()); int * whichRow = savePivot+numberRows; int * whichColumn = whichRow + 3*numberRows; int * arrayI = whichColumn + 2*numberColumns; unsigned char * saveStatus = reinterpret_cast (arrayI+1); CoinMemcpyN(saveStatus,number,modelPtr_->statusArray()); modelPtr_->setFactorization(*factorization_); double * columnLower = modelPtr_->columnLower(); double * columnUpper = modelPtr_->columnUpper(); // make sure whatsChanged_ has 1 set modelPtr_->setWhatsChanged(511); double * lowerInternal = modelPtr_->lowerRegion(); double * upperInternal = modelPtr_->upperRegion(); double rhsScale = modelPtr_->rhsScale(); const double * columnScale = NULL; if (modelPtr_->scalingFlag()>0) columnScale = modelPtr_->columnScale() ; // and do bounds in case dual needs them int iColumn; for (iColumn=0;iColumnsaveLowerOriginal[iColumn]) { double value = columnLower[iColumn]; value *= rhsScale; if (columnScale) value /= columnScale[iColumn]; lowerInternal[iColumn]=value; if (extraCopy) lowerInternal[iColumn+extraCopy]=value; } if (columnUpper[iColumn]setLogLevel(1); modelPtr_->setIntParam(ClpMaxNumIteration,itlim); int saveNumberFake = (static_cast(modelPtr_))->numberFake_; int status = (static_cast(modelPtr_))->fastDual(alwaysFinish); (static_cast(modelPtr_))->numberFake_ = saveNumberFake; int problemStatus = modelPtr_->problemStatus(); double objectiveValue =modelPtr_->objectiveValue() * modelPtr_->optimizationDirection(); CoinAssert (modelPtr_->problemStatus()||modelPtr_->objectiveValue()<1.0e50); // make sure plausible double obj = CoinMax(objectiveValue,saveObjectiveValue); if (problemStatus==10||problemStatus<0) { // was trying to clean up or something odd if (problemStatus==10) { obj = saveObjectiveValue; lastAlgorithm_=1; // so won't fail on cutoff (in CbcNode) } status=1; } if (status) { // not finished - might be optimal modelPtr_->checkPrimalSolution(modelPtr_->solutionRegion(0), modelPtr_->solutionRegion(1)); //modelPtr_->gutsOfSolution(NULL,NULL,0); //if (problemStatus==3) //modelPtr_->computeObjectiveValue(); objectiveValue =modelPtr_->objectiveValue() * modelPtr_->optimizationDirection(); obj = CoinMax(objectiveValue,saveObjectiveValue); if (!modelPtr_->numberDualInfeasibilities()) { double limit = 0.0; modelPtr_->getDblParam(ClpDualObjectiveLimit, limit); if (modelPtr_->secondaryStatus()==1&&!problemStatus&&objnumberPrimalInfeasibilities()&&objnumberPrimalInfeasibilities()) { problemStatus=1; // infeasible } } else { // can't say much //if (problemStatus==3) //modelPtr_->computeObjectiveValue(); lastAlgorithm_=1; // so won't fail on cutoff (in CbcNode) obj = saveObjectiveValue; problemStatus=3; } } else if (!problemStatus) { if (modelPtr_->isDualObjectiveLimitReached()) problemStatus=1; // infeasible } if (status&&!problemStatus) { problemStatus=3; // can't be sure lastAlgorithm_=1; } if (problemStatus<0) problemStatus=3; modelPtr_->setProblemStatus(problemStatus); modelPtr_->setObjectiveValue(obj*modelPtr_->optimizationDirection()); double * solution = modelPtr_->primalColumnSolution(); const double * solution2 = modelPtr_->solutionRegion(); // could just do changed bounds - also try double size scale so can use * not / if (!columnScale) { for (iColumn=0;iColumncomputeObjectiveValue(); if (status&&!problemStatus) { memset(modelPtr_->primalRowSolution(),0,numberRows*sizeof(double)); modelPtr_->clpMatrix()->times(1.0,solution,modelPtr_->primalRowSolution()); modelPtr_->checkSolutionInternal(); //modelPtr_->setLogLevel(1); //modelPtr_->allSlackBasis(); //modelPtr_->primal(1); //memset(modelPtr_->primalRowSolution(),0,numberRows*sizeof(double)); //modelPtr_->clpMatrix()->times(1.0,solution,modelPtr_->primalRowSolution()); //modelPtr_->checkSolutionInternal(); assert (!modelPtr_->problemStatus()); } #endif // and back bounds CoinMemcpyN(saveLower,number,modelPtr_->lowerRegion()); CoinMemcpyN(saveUpper,number,modelPtr_->upperRegion()); if (extraCopy) { CoinMemcpyN(saveLower,number,modelPtr_->lowerRegion()+extraCopy); CoinMemcpyN(saveUpper,number,modelPtr_->upperRegion()+extraCopy); } modelPtr_->setIntParam(ClpMaxNumIteration,itlimOrig_); if (savedObjective) { // fix up modelPtr_->dblParam_[ClpDualObjectiveLimit]=savedDualLimit; //modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~32)); modelPtr_->objective_=savedObjective; if (!modelPtr_->problemStatus_) { CoinZeroN(modelPtr_->dual_,modelPtr_->numberRows_); CoinZeroN(modelPtr_->reducedCost_,modelPtr_->numberColumns_); if (modelPtr_->dj_&&(modelPtr_->whatsChanged_&1)!=0) CoinZeroN(modelPtr_->dj_,modelPtr_->numberColumns_+modelPtr_->numberRows_); modelPtr_->computeObjectiveValue(); } } return; } #endif if (smallModel_==NULL) { setWarmStart(ws_); CoinMemcpyN( rowActivity_,numberRows,modelPtr_->primalRowSolution()); CoinMemcpyN(columnActivity_,numberColumns,modelPtr_->primalColumnSolution()); modelPtr_->setIntParam(ClpMaxNumIteration,CoinMin(itlim,9999)); resolve(); } else { assert (spareArrays_); double * arrayD = reinterpret_cast (spareArrays_); double saveObjectiveValue = arrayD[0]; double * saveSolution = arrayD+1; // double check arrays exist (? for nonlinear) //if (!smallModel_->solutionRegion()) //smallModel_->createRim(63); int numberRows2 = smallModel_->numberRows(); int numberColumns2 = smallModel_->numberColumns(); int number = numberRows2+numberColumns2; CoinMemcpyN(saveSolution,number,smallModel_->solutionRegion()); double * saveLower = saveSolution + (numberRows+numberColumns); CoinMemcpyN(saveLower,number,smallModel_->lowerRegion()); double * saveUpper = saveLower + (numberRows+numberColumns); CoinMemcpyN(saveUpper,number,smallModel_->upperRegion()); double * saveObjective = saveUpper + (numberRows+numberColumns); CoinMemcpyN(saveObjective,number,smallModel_->costRegion()); double * saveLowerOriginal = saveObjective + (numberRows+numberColumns); double * saveUpperOriginal = saveLowerOriginal + numberColumns; arrayD = saveUpperOriginal + numberColumns; int * savePivot = reinterpret_cast (arrayD); CoinMemcpyN(savePivot,numberRows2,smallModel_->pivotVariable()); int * whichRow = savePivot+numberRows; int * whichColumn = whichRow + 3*numberRows; int * arrayI = whichColumn + 2*numberColumns; unsigned char * saveStatus = reinterpret_cast (arrayI+1); CoinMemcpyN(saveStatus,number,smallModel_->statusArray()); /* If factorization_ NULL then infeasible not really sure how could have slipped through. But this can't make situation worse */ if (factorization_) smallModel_->setFactorization(*factorization_); //int * backColumn = whichColumn+numberColumns; const double * lowerBig = modelPtr_->columnLower(); const double * upperBig = modelPtr_->columnUpper(); // make sure whatsChanged_ has 1 set smallModel_->setWhatsChanged(511); double * lowerSmall = smallModel_->lowerRegion(); double * upperSmall = smallModel_->upperRegion(); double * solutionSmall = smallModel_->solutionRegion(); double * lowerSmallReal = smallModel_->columnLower(); double * upperSmallReal = smallModel_->columnUpper(); int i; double rhsScale = smallModel_->rhsScale(); const double * columnScale = NULL; const double * rowScale = NULL; if (smallModel_->scalingFlag()>0) { columnScale = smallModel_->columnScale(); rowScale = smallModel_->rowScale(); } // and do bounds in case dual needs them // may be infeasible for (i=0;isaveLowerOriginal[iColumn]) { double value = lowerBig[iColumn]; lowerSmallReal[i]=value; value *= rhsScale; if (columnScale) value /= columnScale[i]; lowerSmall[i]=value; if (smallModel_->getColumnStatus(i)==ClpSimplex::atLowerBound) solutionSmall[i]=value; } if (upperBig[iColumn]getColumnStatus(i)==ClpSimplex::atUpperBound) solutionSmall[i]=value; } if (upperSmall[i]setLogLevel(1); smallModel_->setIntParam(ClpMaxNumIteration,itlim); int saveNumberFake = (static_cast(smallModel_))->numberFake_; int status; if (!infeasible) { if((modelPtr_->specialOptions()&0x011200000)==0x11200000) { smallModel_->specialOptions_|=2097152; //smallModel_->specialOptions_&=~2097152; delete [] modelPtr_->ray_; delete [] smallModel_->ray_; modelPtr_->ray_=NULL; smallModel_->ray_=NULL; } status = static_cast(smallModel_)->fastDual(alwaysFinish); if((modelPtr_->specialOptions()&0x011200000)==0x11200000&&smallModel_->ray_) { if (smallModel_->sequenceOut_numberColumns_) modelPtr_->sequenceOut_ = whichColumn[smallModel_->sequenceOut_]; else modelPtr_->sequenceOut_ = whichRow[smallModel_->sequenceOut_-smallModel_->numberColumns_]+modelPtr_->numberColumns_; if (smallModel_->rowScale_) { // scale ray double scaleFactor=1.0; if (smallModel_->sequenceOut_numberColumns_) scaleFactor = smallModel_->columnScale_[smallModel_->sequenceOut_]; for (int i = 0; i < smallModel_->numberRows_; i++) { smallModel_->ray_[i] *= smallModel_->rowScale_[i]*scaleFactor; } } } } else { status=0; smallModel_->setProblemStatus(1); } (static_cast(smallModel_))->numberFake_ = saveNumberFake; if (smallModel_->numberIterations()==-98) { printf("rrrrrrrrrrrr\n"); smallModel_->checkPrimalSolution(smallModel_->solutionRegion(0), smallModel_->solutionRegion(1)); //smallModel_->gutsOfSolution(NULL,NULL,0); //if (problemStatus==3) //smallModel_->computeObjectiveValue(); printf("robj %g\n",smallModel_->objectiveValue() * modelPtr_->optimizationDirection()); writeMps("rr.mps"); smallModel_->writeMps("rr_small.mps"); ClpSimplex temp = *smallModel_; printf("small\n"); temp.setLogLevel(63); temp.dual(); double limit = 0.0; modelPtr_->getDblParam(ClpDualObjectiveLimit, limit); if (temp.problemStatus()==0&&temp.objectiveValue()objectiveValue(), temp.objectiveValue(), smallModel_->objectiveOffset(),temp.objectiveOffset()); } printf("big\n"); temp = *modelPtr_; temp.dual(); if (temp.problemStatus()==0&&temp.objectiveValue()objectiveValue(), temp.objectiveValue(), smallModel_->objectiveOffset(),temp.objectiveOffset()); } } int problemStatus = smallModel_->problemStatus(); double objectiveValue =smallModel_->objectiveValue() * modelPtr_->optimizationDirection(); CoinAssert (smallModel_->problemStatus()||smallModel_->objectiveValue()<1.0e50); // make sure plausible double obj = CoinMax(objectiveValue,saveObjectiveValue); if (problemStatus==10||problemStatus<0) { // was trying to clean up or something odd if (problemStatus==10) lastAlgorithm_=1; // so won't fail on cutoff (in CbcNode) status=1; } if (status) { // not finished - might be optimal smallModel_->checkPrimalSolution(smallModel_->solutionRegion(0), smallModel_->solutionRegion(1)); //smallModel_->gutsOfSolution(NULL,NULL,0); //if (problemStatus==3) //smallModel_->computeObjectiveValue(); objectiveValue =smallModel_->objectiveValue() * modelPtr_->optimizationDirection(); if (problemStatus!=10) obj = CoinMax(objectiveValue,saveObjectiveValue); if (!smallModel_->numberDualInfeasibilities()) { double limit = 0.0; modelPtr_->getDblParam(ClpDualObjectiveLimit, limit); if (smallModel_->secondaryStatus()==1&&!problemStatus&&objobjectiveValue(), temp.objectiveValue(), smallModel_->objectiveOffset(),temp.objectiveOffset()); } lastAlgorithm_=1; obj=limit; problemStatus=10; #else obj=limit; problemStatus=3; #endif } if (!smallModel_->numberPrimalInfeasibilities()&&objnumberPrimalInfeasibilities()) { problemStatus=1; // infeasible } } else { // can't say much //if (problemStatus==3) //smallModel_->computeObjectiveValue(); lastAlgorithm_=1; // so won't fail on cutoff (in CbcNode) problemStatus=3; } } else if (!problemStatus) { if (smallModel_->isDualObjectiveLimitReached()) problemStatus=1; // infeasible } if (status&&!problemStatus) { problemStatus=3; // can't be sure lastAlgorithm_=1; } if (problemStatus<0) problemStatus=3; modelPtr_->setProblemStatus(problemStatus); modelPtr_->setObjectiveValue(obj*modelPtr_->optimizationDirection()); modelPtr_->setSumDualInfeasibilities(smallModel_->sumDualInfeasibilities()); modelPtr_->setNumberDualInfeasibilities(smallModel_->numberDualInfeasibilities()); modelPtr_->setSumPrimalInfeasibilities(smallModel_->sumPrimalInfeasibilities()); modelPtr_->setNumberPrimalInfeasibilities(smallModel_->numberPrimalInfeasibilities()); double * solution = modelPtr_->primalColumnSolution(); const double * solution2 = smallModel_->solutionRegion(); double * djs = modelPtr_->dualColumnSolution(); if (!columnScale) { for (i=0;idualRowSolution(); const double * dual2 = smallModel_->dualRowSolution(); if (!rowScale) { for (i=0;iobjective(),numberColumns*sizeof(double)); modelPtr_->clpMatrix()->transposeTimes(-1.0,dual,djs); // could combine with loop above if (modelPtr_==smallModel_) modelPtr_->computeObjectiveValue(); if (problemStatus==1&&smallModel_->ray_) { delete [] modelPtr_->ray_; // get ray to full problem int numberRows = modelPtr_->numberRows(); int numberRows2 = smallModel_->numberRows(); int nCopy = 3*numberRows+2*numberColumns; int nBound = whichRow[nCopy]; double * ray = new double [numberRows]; memset(ray,0,numberRows*sizeof(double)); for (int i = 0; i < numberRows2; i++) { int iRow = whichRow[i]; ray[iRow] = smallModel_->ray_[i]; } // Column copy of matrix const double * element = getMatrixByCol()->getElements(); const int * row = getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = getMatrixByCol()->getVectorStarts(); const int * columnLength = getMatrixByCol()->getVectorLengths(); // translate for (int jRow = nBound; jRow < 2 * numberRows; jRow++) { int iRow = whichRow[jRow]; int iColumn = whichRow[jRow+numberRows]; if (modelPtr_->getColumnStatus(iColumn) == ClpSimplex::basic) { double value = 0.0; double sum = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (iRow == row[j]) { value = element[j]; } else { sum += ray[row[j]]*element[j]; } } ray[iRow] = -sum / value; } } for (int i=0;inumberColumns_;i++) { if (modelPtr_->getStatus(i)!=ClpSimplex::basic&& modelPtr_->columnLower_[i]==modelPtr_->columnUpper_[i]) modelPtr_->setStatus(i,ClpSimplex::isFixed); } modelPtr_->ray_=ray; //delete [] smallModel_->ray_; //smallModel_->ray_=NULL; modelPtr_->directionOut_=smallModel_->directionOut_; lastAlgorithm_=2; // dual } #if 1 if (status&&!problemStatus) { memset(modelPtr_->primalRowSolution(),0,numberRows*sizeof(double)); modelPtr_->clpMatrix()->times(1.0,solution,modelPtr_->primalRowSolution()); modelPtr_->checkSolutionInternal(); //modelPtr_->setLogLevel(1); //modelPtr_->allSlackBasis(); //modelPtr_->primal(1); //memset(modelPtr_->primalRowSolution(),0,numberRows*sizeof(double)); //modelPtr_->clpMatrix()->times(1.0,solution,modelPtr_->primalRowSolution()); //modelPtr_->checkSolutionInternal(); assert (!modelPtr_->problemStatus()); } #endif modelPtr_->setNumberIterations(smallModel_->numberIterations()); // and back bounds CoinMemcpyN(saveLower,number,smallModel_->lowerRegion()); CoinMemcpyN(saveUpper,number,smallModel_->upperRegion()); } if (savedObjective) { // fix up modelPtr_->dblParam_[ClpDualObjectiveLimit]=savedDualLimit; //modelPtr_->setMoreSpecialOptions(modelPtr_->moreSpecialOptions()&(~32)); modelPtr_->objective_=savedObjective; if (!modelPtr_->problemStatus_) { CoinZeroN(modelPtr_->dual_,modelPtr_->numberRows_); CoinZeroN(modelPtr_->reducedCost_,modelPtr_->numberColumns_); if (modelPtr_->dj_&&(modelPtr_->whatsChanged_&1)!=0) CoinZeroN(modelPtr_->dj_,modelPtr_->numberColumns_+modelPtr_->numberRows_); modelPtr_->computeObjectiveValue(); } } modelPtr_->setIntParam(ClpMaxNumIteration,itlimOrig_); } void OsiClpSolverInterface::unmarkHotStart() { #ifdef CLEAN_HOT_START if ((specialOptions_&65536)!=0) { modelPtr_->setLogLevel(saveData_.scalingFlag_); modelPtr_->deleteRim(0); if (lastNumberRows_<0) { specialOptions_ |= 131072; lastNumberRows_ = -1 -lastNumberRows_; if (modelPtr_->rowScale_) { if (modelPtr_->rowScale_!=rowScale_.array()) { delete [] modelPtr_->rowScale_; delete [] modelPtr_->columnScale_; } modelPtr_->rowScale_=NULL; modelPtr_->columnScale_=NULL; } } delete factorization_; delete [] spareArrays_; smallModel_=NULL; spareArrays_=NULL; factorization_=NULL; delete [] rowActivity_; delete [] columnActivity_; rowActivity_=NULL; columnActivity_=NULL; return; } #endif if (smallModel_==NULL) { setWarmStart(ws_); int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); CoinMemcpyN( rowActivity_,numberRows,modelPtr_->primalRowSolution()); CoinMemcpyN(columnActivity_,numberColumns,modelPtr_->primalColumnSolution()); delete ws_; ws_ = NULL; } else { #ifndef KEEP_SMALL if (smallModel_!=modelPtr_) delete smallModel_; smallModel_=NULL; #else if (smallModel_==modelPtr_) { smallModel_=NULL; } else if (smallModel_) { if(!spareArrays_) { delete smallModel_; smallModel_=NULL; delete factorization_; factorization_=NULL; } else { static_cast (smallModel_)->cleanupAfterStrongBranching( factorization_); if ((smallModel_->specialOptions_&4096)==0) { delete factorization_; } } } #endif //delete [] spareArrays_; //spareArrays_=NULL; factorization_=NULL; } delete [] rowActivity_; delete [] columnActivity_; rowActivity_=NULL; columnActivity_=NULL; // Make sure whatsChanged not out of sync if (!modelPtr_->columnUpperWork_) modelPtr_->whatsChanged_ &= ~0xffff; modelPtr_->specialOptions_ = saveData_.specialOptions_; } #ifdef CONFLICT_CUTS // Return a conflict analysis cut from small model OsiRowCut * OsiClpSolverInterface::smallModelCut(const double * originalLower, const double * originalUpper, int numberRowsAtContinuous,const int * whichGenerator, int typeCut) { if(smallModel_&&smallModel_->ray_) { //printf("Could do small cut\n"); int numberRows = modelPtr_->numberRows(); int numberRows2 = smallModel_->numberRows(); int numberColumns = modelPtr_->numberColumns(); int numberColumns2 = smallModel_->numberColumns(); double * arrayD = reinterpret_cast (spareArrays_); double * saveSolution = arrayD+1; double * saveLower = saveSolution + (numberRows+numberColumns); double * saveUpper = saveLower + (numberRows+numberColumns); double * saveObjective = saveUpper + (numberRows+numberColumns); double * saveLowerOriginal = saveObjective + (numberRows+numberColumns); double * saveUpperOriginal = saveLowerOriginal + numberColumns; //double * lowerOriginal = modelPtr_->columnLower(); //double * upperOriginal = modelPtr_->columnUpper(); int * savePivot = reinterpret_cast (saveUpperOriginal + numberColumns); int * whichRow = savePivot+numberRows; int * whichColumn = whichRow + 3*numberRows; int nCopy = 3*numberRows+2*numberColumns; int nBound = whichRow[nCopy]; if (smallModel_->sequenceOut_>=0&&smallModel_->sequenceOut_sequenceOut_ = whichColumn[smallModel_->sequenceOut_]; else modelPtr_->sequenceOut_ = modelPtr_->numberColumns_+whichRow[smallModel_->sequenceOut_]; unsigned char * saveStatus = CoinCopyOfArray(modelPtr_->status_, numberRows+numberColumns); // get ray to full problem for (int i = 0; i < numberColumns2; i++) { int iColumn = whichColumn[i]; modelPtr_->setStatus(iColumn, smallModel_->getStatus(i)); } double * ray = new double [numberRows+numberColumns2+numberColumns]; char * mark = new char [numberRows]; memset(ray,0,(numberRows+numberColumns2+numberColumns)*sizeof(double)); double * smallFarkas = ray+numberRows; double * farkas = smallFarkas+numberColumns2; double * saveScale = smallModel_->rowScale_; smallModel_->rowScale_=NULL; smallModel_->transposeTimes(1.0,smallModel_->ray_,smallFarkas); smallModel_->rowScale_=saveScale; for (int i=0;isetRowStatus(iRow, smallModel_->getRowStatus(i)); ray[iRow] = smallModel_->ray_[i]; mark[iRow]=1; } // Column copy of matrix const double * element = getMatrixByCol()->getElements(); const int * row = getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = getMatrixByCol()->getVectorStarts(); const int * columnLength = getMatrixByCol()->getVectorLengths(); // pick up small pivot row int pivotRow = smallModel_->spareIntArray_[3]; // translate if (pivotRow>=0) pivotRow=whichRow[pivotRow]; modelPtr_->spareIntArray_[3]=pivotRow; for (int jRow = nBound; jRow < 2 * numberRows; jRow++) { int iRow = whichRow[jRow]; int iColumn = whichRow[jRow+numberRows]; if (modelPtr_->getColumnStatus(iColumn) == ClpSimplex::basic) { double value = 0.0; double sum = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (iRow == row[j]) { value = element[j]; } else if (mark[row[j]]) { sum += ray[row[j]]*element[j]; } } double target=farkas[iColumn]; if (iRow!=pivotRow) { ray[iRow] = (target-sum) / value; } else { printf("what now - direction %d wanted %g sum %g value %g\n", smallModel_->directionOut_,ray[iRow], sum,value); } mark[iRow]=1; } } delete [] mark; for (int i=0;inumberColumns_;i++) { if (modelPtr_->getStatus(i)!=ClpSimplex::basic&& modelPtr_->columnLower_[i]==modelPtr_->columnUpper_[i]) modelPtr_->setStatus(i,ClpSimplex::isFixed); } #if 0 { int nBad=0; double * fBig = new double [2*numberColumns+2*numberRows]; double * fSmall = fBig+numberColumns; double * effectiveRhs = fSmall+numberColumns; double * effectiveRhs2 = effectiveRhs+numberRows; memset(fBig,0,2*numberColumns*sizeof(double)); { memcpy(fBig,modelPtr_->columnLower_,numberColumns*sizeof(double)); const double * columnLower = modelPtr_->columnLower_; const double * columnUpper = modelPtr_->columnUpper_; for (int i=0;igetStatus(i)==ClpSimplex::atLowerBound|| smallModel_->getStatus(i)==ClpSimplex::isFixed|| columnLower[iBig]==columnUpper[iBig]) { fSmall[i]=columnLower[iBig]; } else if (smallModel_->getStatus(i)==ClpSimplex::atUpperBound) { fSmall[i]=columnUpper[iBig]; } else if (i==smallModel_->sequenceOut_) { if (smallModel_->directionOut_<0) { // above upper bound fSmall[i]=columnUpper[iBig]; } else { // below lower bound fSmall[i]=columnLower[iBig]; } } else if (smallModel_->columnLower_[i]==smallModel_->columnUpper_[i]) { fSmall[i]=smallModel_->columnLower_[i]; } fBig[whichColumn[i]]=fSmall[i]; } { // only works for one test case memcpy(effectiveRhs2,modelPtr_->rowUpper_,numberRows*sizeof(double)); double * saveScale = modelPtr_->rowScale_; ClpPackedMatrix * saveMatrix = modelPtr_->scaledMatrix_; modelPtr_->rowScale_=NULL; modelPtr_->scaledMatrix_=NULL; modelPtr_->times(-1.0,fBig,effectiveRhs2); modelPtr_->scaledMatrix_=saveMatrix; modelPtr_->rowScale_=saveScale; memset(fBig,0,numberColumns*sizeof(double)); } const double * rowLower = smallModel_->rowLower_; const double * rowUpper = smallModel_->rowUpper_; int pivotRow = smallModel_->spareIntArray_[3]; for (int i=0;igetRowStatus(i)==ClpSimplex::atLowerBound|| rowUpper[i]==rowLower[i]|| smallModel_->getRowStatus(i)==ClpSimplex::isFixed) { effectiveRhs[i]=rowLower[i]; //if (smallModel_->getRowStatus(i)==ClpSimplex::atLowerBound) //assert (ray[i]>-1.0e-3); } else if (smallModel_->getRowStatus(i)==ClpSimplex::atUpperBound) { effectiveRhs[i]=rowUpper[i]; //assert (ray[i]<1.0e-3); } else { if (smallModel_->getRowStatus(i)!=ClpSimplex::basic) { assert (rowUpper[i]>1.0e30||rowLower[i]<-1.0e30); // eventually skip if (rowUpper[i]<1.0e30) effectiveRhs[i]=rowUpper[i]; else effectiveRhs[i]=rowLower[i]; } } if (smallModel_->getRowStatus(i)==ClpSimplex::basic) { effectiveRhs[i]=0.0; // we should leave pivot row in and use direction for bound if (fabs(smallModel_->ray_[i])>1.0e-8) { printf("Basic small slack value %g on %d - pivotRow %d\n",smallModel_->ray_[i],i,pivotRow); if (i==pivotRow) { if (smallModel_->directionOut_<0) effectiveRhs[i]=rowUpper[i]; else effectiveRhs[i]=rowLower[i]; } else { //smallModel_->ray_[i]=0.0; } } } } //ClpPackedMatrix * saveMatrix = smallModel_->scaledMatrix_; double * saveScale = smallModel_->rowScale_; smallModel_->rowScale_=NULL; smallModel_->scaledMatrix_=NULL; smallModel_->times(-1.0,fSmall,effectiveRhs); double bSum=0.0; for (int i=0;iray_[i]; } printf("Small bsum %g\n",bSum); smallModel_->rowScale_=saveScale; } double * saveScale = smallModel_->rowScale_; smallModel_->rowScale_=NULL; memset(fSmall,0,numberColumns*sizeof(double)); smallModel_->transposeTimes(1.0,smallModel_->ray_,fSmall); smallModel_->rowScale_=saveScale; ClpPackedMatrix * saveMatrix = modelPtr_->scaledMatrix_; saveScale = modelPtr_->rowScale_; modelPtr_->rowScale_=NULL; modelPtr_->scaledMatrix_=NULL; modelPtr_->transposeTimes(1.0,ray,fBig); modelPtr_->scaledMatrix_=saveMatrix; modelPtr_->rowScale_=saveScale; for (int i=0;i1.0e-4) { printf("small %d %g big %d %g\n", i,fSmall[i],iBig,fBig[iBig]); nBad++; } } delete [] fBig; if (nBad) printf("Bad %d odd %d\n",nBad,2*numberRows-nBound); } #endif modelPtr_->ray_=ray; lastAlgorithm_=2; modelPtr_->directionOut_=smallModel_->directionOut_; OsiRowCut * cut = modelCut(originalLower,originalUpper, numberRowsAtContinuous,whichGenerator,typeCut); smallModel_->deleteRay(); memcpy(modelPtr_->status_,saveStatus,numberRows+numberColumns); delete [] saveStatus; if (cut) { //printf("got small cut\n"); //delete cut; //cut=NULL; } return cut; } else { return NULL; } } static int debugMode=0; // Return a conflict analysis cut from model // If type is 0 then genuine cut, if 1 then only partially processed OsiRowCut * OsiClpSolverInterface::modelCut(const double * originalLower, const double * originalUpper, int numberRowsAtContinuous,const int * whichGenerator, int typeCut) { OsiRowCut * cut=NULL; //return NULL; if(modelPtr_->ray_) { if (lastAlgorithm_==2) { //printf("Could do normal cut\n"); // could use existing arrays int numberRows=modelPtr_->numberRows_; int numberColumns=modelPtr_->numberColumns_; double * farkas = new double [2*numberColumns+numberRows]; double * bound = farkas + numberColumns; double * effectiveRhs = bound + numberColumns; /*const*/ double * ray = modelPtr_->ray_; // have to get rid of local cut rows whichGenerator -= numberRowsAtContinuous; int badRows=0; for (int iRow=numberRowsAtContinuous;iRow=0&&iType<20000)) { if (fabs(ray[iRow])>1.0e-10) { badRows++; } ray[iRow]=0.0; } } ClpSimplex debugModel; if ((debugMode&4)!=0) debugModel = *modelPtr_; if (badRows&&(debugMode&1)!=0) printf("%d rows from local cuts\n",badRows); // get farkas row ClpPackedMatrix * saveMatrix = modelPtr_->scaledMatrix_; double * saveScale = modelPtr_->rowScale_; modelPtr_->rowScale_=NULL; modelPtr_->scaledMatrix_=NULL; memset(farkas,0,(2*numberColumns+numberRows)*sizeof(double)); modelPtr_->transposeTimes(-1.0,ray,farkas); //const char * integerInformation = modelPtr_->integerType_; //assert (integerInformation); int sequenceOut = modelPtr_->sequenceOut_; // Put nonzero bounds in bound const double * columnLower = modelPtr_->columnLower_; const double * columnUpper = modelPtr_->columnUpper_; const double * columnValue = modelPtr_->columnActivity_; int numberBad=0; int nNonzeroBasic=0; for (int i=0;igetStatus(i)==ClpSimplex::basic) { // treat as zero if small if (fabs(value)<1.0e-8) { value=0.0; farkas[i]=0.0; } if (value) { //printf("basic %d direction %d farkas %g\n", //i,modelPtr_->directionOut_,value); nNonzeroBasic++; if (value<0.0) boundValue=columnLower[i]; else boundValue=columnUpper[i]; } } else if (fabs(value)>1.0e-10) { if (value<0.0) { if (columnValue[i]>columnLower[i]+1.0e-5&&value<-1.0e-7) { //printf("bad %d alpha %g not at lower\n",i,value); numberBad++; } boundValue=columnLower[i]; } else { if (columnValue[i]1.0e-7) { //printf("bad %d alpha %g not at upper\n",i,value); numberBad++; } boundValue=columnUpper[i]; } } bound[i]=boundValue; if (fabs(boundValue)>1.0e10) numberBad++; } const double * rowLower = modelPtr_->rowLower_; const double * rowUpper = modelPtr_->rowUpper_; //int pivotRow = modelPtr_->spareIntArray_[3]; //bool badPivot=pivotRow<0; for (int i=0;igetRowStatus(i)==ClpSimplex::basic) { // treat as zero if small if (fabs(value)<1.0e-8) { value=0.0; ray[i]=0.0; } if (value) { //printf("row basic %d direction %d ray %g\n", // i,modelPtr_->directionOut_,value); nNonzeroBasic++; if (value<0.0) rhsValue=rowLower[i]; else rhsValue=rowUpper[i]; } } else if (fabs(value)>1.0e-10) { if (value<0.0) rhsValue=rowLower[i]; else rhsValue=rowUpper[i]; } effectiveRhs[i]=rhsValue; } { double bSum=0.0; for (int i=0;itimes(-1.0,bound,effectiveRhs); double bSum=0.0; for (int i=0;isequenceOut_; double lower,value,upper; if (iSequencerowActivity_[iSequence]; upper=rowUpper[iSequence]; } if (valueupper) bSum2=-(value-upper); else printf("OUCHXX %g %g %g\n", lower,value,upper); } #else if (modelPtr_->valueOut_lowerOut_) bSum2=modelPtr_->valueOut_-modelPtr_->lowerOut_; else if (modelPtr_->valueOut_>modelPtr_->upperOut_) bSum2=-(modelPtr_->valueOut_-modelPtr_->upperOut_); else printf("OUCHXX %g %g %g\n", modelPtr_->lowerOut_,modelPtr_->valueOut_,modelPtr_->upperOut_); #endif #if 0 if (fabs(bSum-bSum2)>1.0e-5) printf("XX "); printf("after bounds - bSum %g - bSum2 %g\n",bSum,bSum2); #endif #endif modelPtr_->scaledMatrix_=saveMatrix; modelPtr_->rowScale_=saveScale; if (numberBad||bSum>-1.0e-4/*||nNonzeroBasic>1*/ /*||bSum2>-1.0e-4*/) { #if PRINT_CONFLICT>1 //ndef NDEBUG printf("bad BOUND bSum %g (bSum2 %g) - %d bad - %d basic\n", bSum,bSum2,numberBad,nNonzeroBasic); #endif } else { if (numberColumns<0) debugMode=-numberColumns; if ((debugMode&4)!=0) { int * tempC = new int[numberColumns]; double * temp = new double[numberColumns]; int n=0; for (int i=0;i1.0e-12) { temp[n]=farkas[i]; tempC[n++]=i; } } debugModel.addRow(n,tempC,temp,bSum,bSum); delete [] tempC; delete [] temp; } if ((debugMode&2)!=0) { ClpSimplex dual=*modelPtr_; dual.setLogLevel(63); dual.scaling(0); dual.dual(); assert (dual.problemStatus_==1); if (dual.ray_) { double * farkas2 = dual.reducedCost_; // Put nonzero bounds in farkas const double * columnLower = dual.columnLower_; const double * columnUpper = dual.columnUpper_; for (int i=0;i1.0e30||rowLower[i]<-1.0e30); // eventually skip if (rowUpper[i]<1.0e30) effectiveRhs2[i]=rowUpper[i]; else effectiveRhs2[i]=rowLower[i]; } } if (dual.getRowStatus(i)==ClpSimplex::basic) { effectiveRhs2[i]=0.0; // we should leave pivot row in and use direction for bound if (fabs(dual.ray_[i])>1.0e-8) { printf("Basic slack value %g on %d - pivotRow %d\n",ray[i],i,pivotRow); if (i==pivotRow) { if (dual.directionOut_<0) effectiveRhs[i]=rowUpper[i]; else effectiveRhs[i]=rowLower[i]; } else { dual.ray_[i]=0.0; } } } } dual.times(-1.0,farkas2,effectiveRhs2); double bSum2=0.0; for (int i=0;i1.0e-12) //printf("%d ptr farkas %g dual farkas %g\n",i,farkas[i],farkas2[i]); if (fabs(farkas[i]-farkas2[i])>1.0e-7) { nBad++; largest=CoinMax(largest,fabs(farkas[i]-farkas2[i])); smallest=CoinMin(smallest,fabs(farkas[i]-farkas2[i])); //printf("%d ptr farkas %g dual farkas %g\n",i,farkas[i],farkas2[i]); } } if (nBad) printf("%d farkas difference %g to %g\n",nBad,smallest,largest); dual.primal(); assert (dual.problemStatus_==1); assert (!nBad); } } const char * integerInformation = modelPtr_->integerType_; assert (integerInformation); int * conflict = new int[numberColumns]; double * sort = new double [numberColumns]; double relax=0.0; int nConflict=0; int nOriginal=0; int nFixed=0; for (int iColumn=0;iColumngetStatus(iColumn),columnLower[iColumn], modelPtr_->columnActivity_[iColumn],columnUpper[iColumn], originalLower[iColumn],originalUpper[iColumn], farkas[iColumn]); double gap = originalUpper[iColumn]-originalLower[iColumn]; if (!gap) continue; if (gap==columnUpper[iColumn]-columnLower[iColumn]) nOriginal++; if (columnUpper[iColumn]==columnLower[iColumn]) nFixed++; if (fabs(farkas[iColumn])<1.0e-15) { farkas[iColumn]=0.0; continue; } // temp if (gap>=20000.0&&false) { // can't use if (farkas[iColumn]<0.0) { assert(originalLower[iColumn]-columnLower[iColumn]<=0.0); // farkas is negative - relax lower bound all way relax += farkas[iColumn]*(originalLower[iColumn]-columnLower[iColumn]); } else { assert(originalUpper[iColumn]-columnUpper[iColumn]>=0.0); // farkas is positive - relax upper bound all way relax += farkas[iColumn]*(originalUpper[iColumn]-columnUpper[iColumn]); } continue; } if (originalLower[iColumn]==columnLower[iColumn]) { // may need to be careful if odd basic (due to local cut) if (farkas[iColumn]>0.0/*&&(modelPtr_->getStatus(iColumn)==ClpSimplex::atUpperBound ||modelPtr_->getStatus(iColumn)==ClpSimplex::isFixed ||iColumn==sequenceOut)*/) { // farkas is positive - add to list gap=originalUpper[iColumn]-columnUpper[iColumn]; if (gap) { sort[nConflict]=-farkas[iColumn]*gap; conflict[nConflict++]=iColumn; } //assert (gap>columnUpper[iColumn]-columnLower[iColumn]); } } else if (originalUpper[iColumn]==columnUpper[iColumn]) { // may need to be careful if odd basic (due to local cut) if (farkas[iColumn]<0.0/*&&(modelPtr_->getStatus(iColumn)==ClpSimplex::atLowerBound ||modelPtr_->getStatus(iColumn)==ClpSimplex::isFixed ||iColumn==sequenceOut)*/) { // farkas is negative - add to list gap=columnLower[iColumn]-originalLower[iColumn]; if (gap) { sort[nConflict]=farkas[iColumn]*gap; conflict[nConflict++]=iColumn; } //assert (gap>columnUpper[iColumn]-columnLower[iColumn]); } } else { // can't use if (farkas[iColumn]<0.0) { assert(originalLower[iColumn]-columnLower[iColumn]<=0.0); // farkas is negative - relax lower bound all way thisRelax = farkas[iColumn]*(originalLower[iColumn]-columnLower[iColumn]); } else { assert(originalUpper[iColumn]-columnUpper[iColumn]>=0.0); // farkas is positive - relax upper bound all way thisRelax = farkas[iColumn]*(originalUpper[iColumn]-columnUpper[iColumn]); } } } else { // not integer - but may have been got at double gap = originalUpper[iColumn]-originalLower[iColumn]; if (gap>columnUpper[iColumn]-columnLower[iColumn]) { // can't use if (farkas[iColumn]<0.0) { assert(originalLower[iColumn]-columnLower[iColumn]<=0.0); // farkas is negative - relax lower bound all way thisRelax = farkas[iColumn]*(originalLower[iColumn]-columnLower[iColumn]); } else { assert(originalUpper[iColumn]-columnUpper[iColumn]>=0.0); // farkas is positive - relax upper bound all way thisRelax = farkas[iColumn]*(originalUpper[iColumn]-columnUpper[iColumn]); } } } assert (thisRelax>=0.0); relax += thisRelax; } if (relax+bSum>-1.0e-4||!nConflict) { if (relax+bSum>-1.0e-4) { #if PRINT_CONFLICT>1 //ndef NDEBUG printf("General integers relax bSum to %g\n",relax+bSum); #endif } else { #if PRINT_CONFLICT printf("All variables relaxed and still infeasible - what does this mean?\n"); #endif int nR=0; for (int i=0;i1.0e-10) nR++; else ray[i]=0.0; } int nC=0; for (int i=0;i1.0e-10) nC++; else farkas[i]=0.0; } if (nR<3&&nC<5) { printf("BAD %d nonzero rows, %d nonzero columns\n",nR,nC); } } } else if (nConflict < 1000) { #if PRINT_CONFLICT>1 //ndef NDEBUG if (nConflict<5) printf("BOUNDS violation bSum %g (relaxed %g) - %d at original bounds, %d fixed - %d in conflict\n",bSum, relax+bSum,nOriginal,nFixed,nConflict); #endif CoinSort_2(sort,sort+nConflict,conflict); if ((debugMode&4)!=0) { double * temp = new double[numberColumns]; int * tempC = new int[numberColumns]; int n=0; for (int j=0;j1.0e-12) { temp[n]=farkas[i]; tempC[n++]=i; } } debugModel.addRow(n,tempC,temp,bSum,bSum); delete [] tempC; delete [] temp; } int nC=nConflict; for (int i=0;ilast+1.0e-5) break; totalChange += change; kConflict--; } if (bSum+totalChange>-1.0e-4) break; #if 0 //int iColumn=conflict[nConflict-1]; double change=-sort[nConflict-1]; if (bSum+change>-1.0e-4) break; nConflict--; bSum += change; #else nConflict=kConflict; bSum += totalChange; #endif } if (!nConflict) { int nR=0; for (int i=0;i1.0e-10) nR++; else ray[i]=0.0; } int nC=0; for (int i=0;i1.0e-10) nC++; else farkas[i]=0.0; } #if 1 //PRINT_CONFLICT>1 //ndef NDEBUG { printf("BAD2 - zero nConflict %d nonzero rows, %d nonzero columns\n",nR,nC); } #endif } // no point doing if no reduction (or big?) ? if (nConflictsetUb(COIN_DBL_MAX); if (!typeCut) { double lo=1.0; for (int i=0;isetLb(lo); cut->setRow(nConflict,conflict,sort); #if PRINT_CONFLICT printf("CUT has %d (started at %d) - final bSum %g\n",nConflict,nC,bSum); #endif if ((debugMode&4)!=0) { debugModel.addRow(nConflict,conflict,sort,lo,COIN_DBL_MAX); debugModel.writeMps("bad.mps"); } } else { // just save for use later // first take off small int nC2=nC; while (nC2) { //int iColumn=conflict[nConflict-1]; double change=-sort[nC2-1]; if (saveBsum+change>-1.0e-4||change>1.0e-4) break; nC2--; saveBsum += change; } cut->setLb(saveBsum); for (int i=0;isetRow(nC2,conflict,sort); // mark as globally valid cut->setGloballyValid(); #if PRINT_CONFLICT>1 //ndef NDEBUG printf("Stem CUT has %d (greedy %d - with small %d) - saved bSum %g final greedy bSum %g\n", nC2,nConflict,nC,saveBsum,bSum); #endif } } } delete [] conflict; delete [] sort; } delete [] farkas; } else { #if PRINT_CONFLICT>1 //ndef NDEBUG printf("Bad dual ray\n"); #endif } modelPtr_->deleteRay(); } return cut; } #endif //############################################################################# // Problem information methods (original data) //############################################################################# //------------------------------------------------------------------ const char * OsiClpSolverInterface::getRowSense() const { extractSenseRhsRange(); return rowsense_; } //------------------------------------------------------------------ const double * OsiClpSolverInterface::getRightHandSide() const { extractSenseRhsRange(); return rhs_; } //------------------------------------------------------------------ const double * OsiClpSolverInterface::getRowRange() const { extractSenseRhsRange(); return rowrange_; } //------------------------------------------------------------------ // Return information on integrality //------------------------------------------------------------------ bool OsiClpSolverInterface::isContinuous(int colNumber) const { if ( integerInformation_==NULL ) return true; #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (colNumber<0||colNumber>=n) { indexError(colNumber,"isContinuous"); } #endif if ( integerInformation_[colNumber]==0 ) return true; return false; } bool OsiClpSolverInterface::isBinary(int colNumber) const { #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (colNumber<0||colNumber>=n) { indexError(colNumber,"isBinary"); } #endif if ( integerInformation_==NULL || integerInformation_[colNumber]==0 ) { return false; } else { const double * cu = getColUpper(); const double * cl = getColLower(); if ((cu[colNumber]== 1 || cu[colNumber]== 0) && (cl[colNumber]== 0 || cl[colNumber]==1)) return true; else return false; } } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::isInteger(int colNumber) const { #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (colNumber<0||colNumber>=n) { indexError(colNumber,"isInteger"); } #endif if ( integerInformation_==NULL || integerInformation_[colNumber]==0 ) return false; else return true; } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::isIntegerNonBinary(int colNumber) const { #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (colNumber<0||colNumber>=n) { indexError(colNumber,"isIntegerNonBinary"); } #endif if ( integerInformation_==NULL || integerInformation_[colNumber]==0 ) { return false; } else { return !isBinary(colNumber); } } //----------------------------------------------------------------------------- bool OsiClpSolverInterface::isFreeBinary(int colNumber) const { #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (colNumber<0||colNumber>=n) { indexError(colNumber,"isFreeBinary"); } #endif if ( integerInformation_==NULL || integerInformation_[colNumber]==0 ) { return false; } else { const double * cu = getColUpper(); const double * cl = getColLower(); if ((cu[colNumber]== 1) && (cl[colNumber]== 0)) return true; else return false; } } /* Return array of column length 0 - continuous 1 - binary (may get fixed later) 2 - general integer (may get fixed later) */ const char * OsiClpSolverInterface::getColType(bool refresh) const { if (!columnType_||refresh) { const int numCols = getNumCols() ; if (!columnType_) columnType_ = new char [numCols]; if ( integerInformation_==NULL ) { memset(columnType_,0,numCols); } else { const double * cu = getColUpper(); const double * cl = getColLower(); for (int i = 0 ; i < numCols ; ++i) { if (integerInformation_[i]) { if ((cu[i]== 1 || cu[i]== 0) && (cl[i]== 0 || cl[i]==1)) columnType_[i]=1; else columnType_[i]=2; } else { columnType_[i]=0; } } } } return columnType_; } /* Return true if column is integer but does not have to be declared as such. Note: This function returns true if the the column is binary or a general integer. */ bool OsiClpSolverInterface::isOptionalInteger(int colNumber) const { #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (colNumber<0||colNumber>=n) { indexError(colNumber,"isInteger"); } #endif if ( integerInformation_==NULL || integerInformation_[colNumber]!=2 ) return false; else return true; } /* Set the index-th variable to be an optional integer variable */ void OsiClpSolverInterface::setOptionalInteger(int index) { if (!integerInformation_) { integerInformation_ = new char[modelPtr_->numberColumns()]; CoinFillN ( integerInformation_, modelPtr_->numberColumns(),static_cast (0)); } #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (index<0||index>=n) { indexError(index,"setInteger"); } #endif integerInformation_[index]=2; modelPtr_->setInteger(index); } //------------------------------------------------------------------ // Row and column copies of the matrix ... //------------------------------------------------------------------ const CoinPackedMatrix * OsiClpSolverInterface::getMatrixByRow() const { if ( matrixByRow_ == NULL || matrixByRow_->getNumElements() != modelPtr_->clpMatrix()->getNumElements() ) { delete matrixByRow_; matrixByRow_ = new CoinPackedMatrix(); matrixByRow_->setExtraGap(0.0); matrixByRow_->setExtraMajor(0.0); matrixByRow_->reverseOrderedCopyOf(*modelPtr_->matrix()); //matrixByRow_->removeGaps(); #if 0 CoinPackedMatrix back; std::cout<<"start check"<matrix()->isEquivalent2(back); std::cout<<"stop check"<getNumElements()==modelPtr_->clpMatrix()->getNumElements()); return matrixByRow_; } const CoinPackedMatrix * OsiClpSolverInterface::getMatrixByCol() const { return modelPtr_->matrix(); } // Get pointer to mutable column-wise copy of matrix (returns NULL if not meaningful) CoinPackedMatrix * OsiClpSolverInterface::getMutableMatrixByCol() const { ClpPackedMatrix * matrix = dynamic_cast(modelPtr_->matrix_) ; if (matrix) return matrix->getPackedMatrix(); else return NULL; } //------------------------------------------------------------------ std::vector OsiClpSolverInterface::getDualRays(int /*maxNumRays*/, bool fullRay) const { return std::vector(1, modelPtr_->infeasibilityRay(fullRay)); } //------------------------------------------------------------------ std::vector OsiClpSolverInterface::getPrimalRays(int /*maxNumRays*/) const { return std::vector(1, modelPtr_->unboundedRay()); } //############################################################################# void OsiClpSolverInterface::setContinuous(int index) { if (integerInformation_) { #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (index<0||index>=n) { indexError(index,"setContinuous"); } #endif integerInformation_[index]=0; } modelPtr_->setContinuous(index); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::setInteger(int index) { if (!integerInformation_) { integerInformation_ = new char[modelPtr_->numberColumns()]; CoinFillN ( integerInformation_, modelPtr_->numberColumns(),static_cast (0)); } #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (index<0||index>=n) { indexError(index,"setInteger"); } #endif integerInformation_[index]=1; modelPtr_->setInteger(index); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::setContinuous(const int* indices, int len) { if (integerInformation_) { #ifndef NDEBUG int n = modelPtr_->numberColumns(); #endif int i; for (i=0; i=n) { indexError(colNumber,"setContinuous"); } #endif integerInformation_[colNumber]=0; modelPtr_->setContinuous(colNumber); } } } //----------------------------------------------------------------------------- void OsiClpSolverInterface::setInteger(const int* indices, int len) { if (!integerInformation_) { integerInformation_ = new char[modelPtr_->numberColumns()]; CoinFillN ( integerInformation_, modelPtr_->numberColumns(),static_cast (0)); } #ifndef NDEBUG int n = modelPtr_->numberColumns(); #endif int i; for (i=0; i=n) { indexError(colNumber,"setInteger"); } #endif integerInformation_[colNumber]=1; modelPtr_->setInteger(colNumber); } } /* Set the objective coefficients for all columns array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed. */ void OsiClpSolverInterface::setObjective(const double * array) { // Say can't gurantee optimal basis etc lastAlgorithm_=999; modelPtr_->whatsChanged_ &= (0xffff&~64); int n = modelPtr_->numberColumns() ; if (fakeMinInSimplex_) { std::transform(array,array+n, modelPtr_->objective(),std::negate()) ; } else { CoinMemcpyN(array,n,modelPtr_->objective()); } } /* Set the lower bounds for all columns array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed. */ void OsiClpSolverInterface::setColLower(const double * array) { // Say can't gurantee optimal basis etc lastAlgorithm_=999; modelPtr_->whatsChanged_ &= (0x1ffff&128); CoinMemcpyN(array,modelPtr_->numberColumns(), modelPtr_->columnLower()); } /* Set the upper bounds for all columns array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed. */ void OsiClpSolverInterface::setColUpper(const double * array) { // Say can't gurantee optimal basis etc lastAlgorithm_=999; modelPtr_->whatsChanged_ &= (0x1ffff&256); CoinMemcpyN(array,modelPtr_->numberColumns(), modelPtr_->columnUpper()); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::setColSolution(const double * cs) { // Say can't gurantee optimal basis etc lastAlgorithm_=999; CoinDisjointCopyN(cs,modelPtr_->numberColumns(), modelPtr_->primalColumnSolution()); if (modelPtr_->solveType()==2) { // directly into code as well CoinDisjointCopyN(cs,modelPtr_->numberColumns(), modelPtr_->solutionRegion(1)); } // compute row activity memset(modelPtr_->primalRowSolution(),0,modelPtr_->numberRows()*sizeof(double)); modelPtr_->times(1.0,modelPtr_->primalColumnSolution(),modelPtr_->primalRowSolution()); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::setRowPrice(const double * rs) { CoinDisjointCopyN(rs,modelPtr_->numberRows(), modelPtr_->dualRowSolution()); if (modelPtr_->solveType()==2) { // directly into code as well (? sign ) CoinDisjointCopyN(rs,modelPtr_->numberRows(), modelPtr_->djRegion(0)); } // compute reduced costs memcpy(modelPtr_->dualColumnSolution(),modelPtr_->objective(), modelPtr_->numberColumns()*sizeof(double)); modelPtr_->transposeTimes(-1.0,modelPtr_->dualRowSolution(),modelPtr_->dualColumnSolution()); } //############################################################################# // Problem modifying methods (matrix) //############################################################################# void OsiClpSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj) { int numberColumns = modelPtr_->numberColumns(); modelPtr_->whatsChanged_ &= (0xffff&~(1|2|8|64|128|256)); modelPtr_->resize(modelPtr_->numberRows(),numberColumns+1); linearObjective_ = modelPtr_->objective(); basis_.resize(modelPtr_->numberRows(),numberColumns+1); setColBounds(numberColumns,collb,colub); setObjCoeff(numberColumns,obj); if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendCol(vec); if (integerInformation_) { char * temp = new char[numberColumns+1]; CoinMemcpyN(integerInformation_,numberColumns,temp); delete [] integerInformation_; integerInformation_ = temp; integerInformation_[numberColumns]=0; } freeCachedResults(); } //----------------------------------------------------------------------------- /* Add a column (primal variable) to the problem. */ void OsiClpSolverInterface::addCol(int numberElements, const int * rows, const double * elements, const double collb, const double colub, const double obj) { CoinPackedVector column(numberElements, rows, elements); addCol(column,collb,colub,obj); } // Add a named column (primal variable) to the problem. void OsiClpSolverInterface::addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj, std::string name) { int ndx = getNumCols() ; addCol(vec,collb,colub,obj) ; setColName(ndx,name) ; } //----------------------------------------------------------------------------- void OsiClpSolverInterface::addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|8|64|128|256)); int numberColumns = modelPtr_->numberColumns(); modelPtr_->resize(modelPtr_->numberRows(),numberColumns+numcols); linearObjective_ = modelPtr_->objective(); basis_.resize(modelPtr_->numberRows(),numberColumns+numcols); double * lower = modelPtr_->columnLower()+numberColumns; double * upper = modelPtr_->columnUpper()+numberColumns; double * objective = modelPtr_->objective()+numberColumns; int iCol; if (collb) { for (iCol = 0; iCol < numcols; iCol++) { lower[iCol]= forceIntoRange(collb[iCol], -OsiClpInfinity, OsiClpInfinity); if (lower[iCol]<-1.0e27) lower[iCol]=-COIN_DBL_MAX; } } else { CoinFillN ( lower, numcols,0.0); } if (colub) { for (iCol = 0; iCol < numcols; iCol++) { upper[iCol]= forceIntoRange(colub[iCol], -OsiClpInfinity, OsiClpInfinity); if (upper[iCol]>1.0e27) upper[iCol]=COIN_DBL_MAX; } } else { CoinFillN ( upper, numcols,COIN_DBL_MAX); } if (obj) { for (iCol = 0; iCol < numcols; iCol++) { objective[iCol] = obj[iCol]; } } else { CoinFillN ( objective, numcols,0.0); } if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendCols(numcols,cols); if (integerInformation_) { char * temp = new char[numberColumns+numcols]; CoinMemcpyN(integerInformation_,numberColumns,temp); delete [] integerInformation_; integerInformation_ = temp; for (iCol = 0; iCol < numcols; iCol++) integerInformation_[numberColumns+iCol]=0; } freeCachedResults(); } void OsiClpSolverInterface::addCols(const int numcols, const int * columnStarts, const int * rows, const double * elements, const double* collb, const double* colub, const double* obj) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|8|64|128|256)); int numberColumns = modelPtr_->numberColumns(); modelPtr_->resize(modelPtr_->numberRows(),numberColumns+numcols); linearObjective_ = modelPtr_->objective(); basis_.resize(modelPtr_->numberRows(),numberColumns+numcols); double * lower = modelPtr_->columnLower()+numberColumns; double * upper = modelPtr_->columnUpper()+numberColumns; double * objective = modelPtr_->objective()+numberColumns; int iCol; if (collb) { for (iCol = 0; iCol < numcols; iCol++) { lower[iCol]= forceIntoRange(collb[iCol], -OsiClpInfinity, OsiClpInfinity); if (lower[iCol]<-1.0e27) lower[iCol]=-COIN_DBL_MAX; } } else { CoinFillN ( lower, numcols,0.0); } if (colub) { for (iCol = 0; iCol < numcols; iCol++) { upper[iCol]= forceIntoRange(colub[iCol], -OsiClpInfinity, OsiClpInfinity); if (upper[iCol]>1.0e27) upper[iCol]=COIN_DBL_MAX; } } else { CoinFillN ( upper, numcols,COIN_DBL_MAX); } if (obj) { for (iCol = 0; iCol < numcols; iCol++) { objective[iCol] = obj[iCol]; } } else { CoinFillN ( objective, numcols,0.0); } if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendCols(numcols,columnStarts,rows,elements); if (integerInformation_) { char * temp = new char[numberColumns+numcols]; CoinMemcpyN(integerInformation_,numberColumns,temp); delete [] integerInformation_; integerInformation_ = temp; for (iCol = 0; iCol < numcols; iCol++) integerInformation_[numberColumns+iCol]=0; } freeCachedResults(); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::deleteCols(const int num, const int * columnIndices) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|8|64|128|256)); findIntegers(false); deleteBranchingInfo(num,columnIndices); modelPtr_->deleteColumns(num,columnIndices); int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; if (num&&nameDiscipline) { // Very clumsy (and inefficient) - need to sort and then go backwards in ? chunks int * indices = CoinCopyOfArray(columnIndices,num); std::sort(indices,indices+num); int num2=num; while(num2) { int next = indices[num2-1]; int firstDelete = num2-1; int i; for (i=num2-2;i>=0;i--) { if (indices[i]+1==next) { next --; firstDelete=i; } else { break; } } OsiSolverInterface::deleteColNames(indices[firstDelete],num2-firstDelete); num2 = firstDelete; assert (num2>=0); } delete [] indices; } // synchronize integers (again) if (integerInformation_) { int numberColumns = modelPtr_->numberColumns(); for (int i=0;iisInteger(i)) integerInformation_[i]=1; else integerInformation_[i]=0; } } basis_.deleteColumns(num,columnIndices); linearObjective_ = modelPtr_->objective(); freeCachedResults(); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|4|16|32)); freeCachedResults0(); int numberRows = modelPtr_->numberRows(); modelPtr_->resize(numberRows+1,modelPtr_->numberColumns()); basis_.resize(numberRows+1,modelPtr_->numberColumns()); setRowBounds(numberRows,rowlb,rowub); if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendRow(vec); freeCachedResults1(); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub, std::string name) { int ndx = getNumRows() ; addRow(vec,rowlb,rowub) ; setRowName(ndx,name) ; } //----------------------------------------------------------------------------- void OsiClpSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|4|16|32)); freeCachedResults0(); int numberRows = modelPtr_->numberRows(); modelPtr_->resize(numberRows+1,modelPtr_->numberColumns()); basis_.resize(numberRows+1,modelPtr_->numberColumns()); double rowlb = 0, rowub = 0; convertSenseToBound(rowsen, rowrhs, rowrng, rowlb, rowub); setRowBounds(numberRows,rowlb,rowub); if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendRow(vec); freeCachedResults1(); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::addRow(int numberElements, const int * columns, const double * elements, const double rowlb, const double rowub) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|4|16|32)); freeCachedResults0(); int numberRows = modelPtr_->numberRows(); modelPtr_->resize(numberRows+1,modelPtr_->numberColumns()); basis_.resize(numberRows+1,modelPtr_->numberColumns()); setRowBounds(numberRows,rowlb,rowub); if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendRow(numberElements, columns, elements); CoinBigIndex starts[2]; starts[0]=0; starts[1]=numberElements; redoScaleFactors( 1,starts, columns, elements); freeCachedResults1(); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|4|16|32)); freeCachedResults0(); int numberRows = modelPtr_->numberRows(); modelPtr_->resize(numberRows+numrows,modelPtr_->numberColumns()); basis_.resize(numberRows+numrows,modelPtr_->numberColumns()); double * lower = modelPtr_->rowLower()+numberRows; double * upper = modelPtr_->rowUpper()+numberRows; int iRow; for (iRow = 0; iRow < numrows; iRow++) { if (rowlb) lower[iRow]= forceIntoRange(rowlb[iRow], -OsiClpInfinity, OsiClpInfinity); else lower[iRow]=-OsiClpInfinity; if (rowub) upper[iRow]= forceIntoRange(rowub[iRow], -OsiClpInfinity, OsiClpInfinity); else upper[iRow]=OsiClpInfinity; if (lower[iRow]<-1.0e27) lower[iRow]=-COIN_DBL_MAX; if (upper[iRow]>1.0e27) upper[iRow]=COIN_DBL_MAX; } if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendRows(numrows,rows); freeCachedResults1(); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|4|16|32)); freeCachedResults0(); int numberRows = modelPtr_->numberRows(); modelPtr_->resize(numberRows+numrows,modelPtr_->numberColumns()); basis_.resize(numberRows+numrows,modelPtr_->numberColumns()); double * lower = modelPtr_->rowLower()+numberRows; double * upper = modelPtr_->rowUpper()+numberRows; int iRow; for (iRow = 0; iRow < numrows; iRow++) { double rowlb = 0, rowub = 0; convertSenseToBound(rowsen[iRow], rowrhs[iRow], rowrng[iRow], rowlb, rowub); lower[iRow]= forceIntoRange(rowlb, -OsiClpInfinity, OsiClpInfinity); upper[iRow]= forceIntoRange(rowub, -OsiClpInfinity, OsiClpInfinity); if (lower[iRow]<-1.0e27) lower[iRow]=-COIN_DBL_MAX; if (upper[iRow]>1.0e27) upper[iRow]=COIN_DBL_MAX; } if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendRows(numrows,rows); freeCachedResults1(); } void OsiClpSolverInterface::addRows(const int numrows, const int * rowStarts, const int * columns, const double * element, const double* rowlb, const double* rowub) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|4|16|32)); freeCachedResults0(); int numberRows = modelPtr_->numberRows(); modelPtr_->resize(numberRows+numrows,modelPtr_->numberColumns()); basis_.resize(numberRows+numrows,modelPtr_->numberColumns()); double * lower = modelPtr_->rowLower()+numberRows; double * upper = modelPtr_->rowUpper()+numberRows; int iRow; for (iRow = 0; iRow < numrows; iRow++) { if (rowlb) lower[iRow]= forceIntoRange(rowlb[iRow], -OsiClpInfinity, OsiClpInfinity); else lower[iRow]=-OsiClpInfinity; if (rowub) upper[iRow]= forceIntoRange(rowub[iRow], -OsiClpInfinity, OsiClpInfinity); else upper[iRow]=OsiClpInfinity; if (lower[iRow]<-1.0e27) lower[iRow]=-COIN_DBL_MAX; if (upper[iRow]>1.0e27) upper[iRow]=COIN_DBL_MAX; } if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); modelPtr_->matrix()->appendRows(numrows,rowStarts,columns,element); redoScaleFactors( numrows,rowStarts, columns, element); freeCachedResults1(); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::deleteRows(const int num, const int * rowIndices) { modelPtr_->whatsChanged_ &= (0xffff&~(1|2|4|16|32)); // will still be optimal if all rows basic bool allBasic=true; int numBasis = basis_.getNumArtificial(); for (int i=0;ideleteRows(num,rowIndices); int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; if (num&&nameDiscipline) { // Very clumsy (and inefficient) - need to sort and then go backwards in ? chunks int * indices = CoinCopyOfArray(rowIndices,num); std::sort(indices,indices+num); int num2=num; while(num2) { int next = indices[num2-1]; int firstDelete = num2-1; int i; for (i=num2-2;i>=0;i--) { if (indices[i]+1==next) { next --; firstDelete=i; } else { break; } } OsiSolverInterface::deleteRowNames(indices[firstDelete],num2-firstDelete); num2 = firstDelete; assert (num2>=0); } delete [] indices; } basis_.deleteRows(num,rowIndices); CoinPackedMatrix * saveRowCopy = matrixByRow_; matrixByRow_=NULL; freeCachedResults(); modelPtr_->setNewRowCopy(NULL); delete modelPtr_->scaledMatrix_; modelPtr_->scaledMatrix_=NULL; if (saveRowCopy) { matrixByRow_=saveRowCopy; matrixByRow_->deleteRows(num,rowIndices); if (matrixByRow_->getNumElements()!=modelPtr_->clpMatrix()->getNumElements()) { delete matrixByRow_; // odd type matrix matrixByRow_=NULL; } } lastAlgorithm_ = saveAlgorithm; if ((specialOptions_&131072)!=0) lastNumberRows_=modelPtr_->numberRows(); } //############################################################################# // Methods to input a problem //############################################################################# void OsiClpSolverInterface::loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { modelPtr_->whatsChanged_ = 0; // Get rid of integer information (modelPtr will get rid of its copy) delete [] integerInformation_; integerInformation_=NULL; modelPtr_->loadProblem(matrix, collb, colub, obj, rowlb, rowub); linearObjective_ = modelPtr_->objective(); freeCachedResults(); basis_=CoinWarmStartBasis(); if (ws_) { delete ws_; ws_ = 0; } } //----------------------------------------------------------------------------- /* Expose the method that takes ClpMatrixBase. User request. Can't hurt, given the number of non-OSI methods already here. */ void OsiClpSolverInterface::loadProblem (const ClpMatrixBase& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { modelPtr_->whatsChanged_ = 0; // Get rid of integer information (modelPtr will get rid of its copy) delete [] integerInformation_; integerInformation_=NULL; modelPtr_->loadProblem(matrix,collb,colub,obj,rowlb,rowub); linearObjective_ = modelPtr_->objective(); freeCachedResults(); basis_=CoinWarmStartBasis(); if (ws_) { delete ws_; ws_ = 0; } } //----------------------------------------------------------------------------- void OsiClpSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub) { modelPtr_->whatsChanged_ = 0; // Get rid of integer information (modelPtr will get rid of its copy) loadProblem(*matrix, collb, colub, obj, rowlb, rowub); delete matrix; matrix = NULL; delete[] collb; collb = NULL; delete[] colub; colub = NULL; delete[] obj; obj = NULL; delete[] rowlb; rowlb = NULL; delete[] rowub; rowub = NULL; } //----------------------------------------------------------------------------- void OsiClpSolverInterface::loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) { modelPtr_->whatsChanged_ = 0; // Get rid of integer information (modelPtr will get rid of its copy) // assert( rowsen != NULL ); // assert( rowrhs != NULL ); // If any of Rhs NULLs then create arrays int numrows = matrix.getNumRows(); const char * rowsenUse = rowsen; if (!rowsen) { char * rowsen = new char [numrows]; for (int i=0;i= 0; --i) { convertSenseToBound(rowsenUse[i],rowrhsUse[i],rowrngUse[i],rowlb[i],rowub[i]); } if (rowsen!=rowsenUse) delete [] rowsenUse; if (rowrhs!=rowrhsUse) delete [] rowrhsUse; if (rowrng!=rowrngUse) delete [] rowrngUse; loadProblem(matrix, collb, colub, obj, rowlb, rowub); delete [] rowlb; delete [] rowub; } //----------------------------------------------------------------------------- void OsiClpSolverInterface::assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng) { modelPtr_->whatsChanged_ = 0; // Get rid of integer information (modelPtr will get rid of its copy) loadProblem(*matrix, collb, colub, obj, rowsen, rowrhs, rowrng); delete matrix; matrix = NULL; delete[] collb; collb = NULL; delete[] colub; colub = NULL; delete[] obj; obj = NULL; delete[] rowsen; rowsen = NULL; delete[] rowrhs; rowrhs = NULL; delete[] rowrng; rowrng = NULL; } //----------------------------------------------------------------------------- void OsiClpSolverInterface::loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) { modelPtr_->whatsChanged_ = 0; // Get rid of integer information (modelPtr will get rid of its copy) delete [] integerInformation_; integerInformation_=NULL; modelPtr_->loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); linearObjective_ = modelPtr_->objective(); freeCachedResults(); basis_=CoinWarmStartBasis(); if (ws_) { delete ws_; ws_ = 0; } } //----------------------------------------------------------------------------- void OsiClpSolverInterface::loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng) { modelPtr_->whatsChanged_ = 0; // Get rid of integer information (modelPtr will get rid of its copy) // If any of Rhs NULLs then create arrays const char * rowsenUse = rowsen; if (!rowsen) { char * rowsen = new char [numrows]; for (int i=0;i= 0; --i) { convertSenseToBound(rowsenUse[i],rowrhsUse[i],rowrngUse[i],rowlb[i],rowub[i]); } if (rowsen!=rowsenUse) delete [] rowsenUse; if (rowrhs!=rowrhsUse) delete [] rowrhsUse; if (rowrng!=rowrngUse) delete [] rowrngUse; loadProblem(numcols, numrows, start, index, value, collb, colub, obj, rowlb, rowub); delete[] rowlb; delete[] rowub; } // This loads a model from a coinModel object - returns number of errors int OsiClpSolverInterface::loadFromCoinModel ( CoinModel & modelObject, bool keepSolution) { modelPtr_->whatsChanged_ = 0; int numberErrors = 0; // Set arrays for normal use double * rowLower = modelObject.rowLowerArray(); double * rowUpper = modelObject.rowUpperArray(); double * columnLower = modelObject.columnLowerArray(); double * columnUpper = modelObject.columnUpperArray(); double * objective = modelObject.objectiveArray(); int * integerType = modelObject.integerTypeArray(); double * associated = modelObject.associatedArray(); // If strings then do copies if (modelObject.stringsExist()) { numberErrors = modelObject.createArrays(rowLower, rowUpper, columnLower, columnUpper, objective, integerType,associated); } CoinPackedMatrix matrix; modelObject.createPackedMatrix(matrix,associated); int numberRows = modelObject.numberRows(); int numberColumns = modelObject.numberColumns(); CoinWarmStart * ws = getWarmStart(); bool restoreBasis = keepSolution && numberRows&&numberRows==getNumRows()&& numberColumns==getNumCols(); loadProblem(matrix, columnLower, columnUpper, objective, rowLower, rowUpper); if (restoreBasis) setWarmStart(ws); delete ws; // Do names if wanted int numberItems; numberItems = modelObject.rowNames()->numberItems(); if (numberItems) { const char *const * rowNames=modelObject.rowNames()->names(); modelPtr_->copyRowNames(rowNames,0,numberItems); } numberItems = modelObject.columnNames()->numberItems(); if (numberItems) { const char *const * columnNames=modelObject.columnNames()->names(); modelPtr_->copyColumnNames(columnNames,0,numberItems); } // Do integers if wanted assert(integerType); for (int iColumn=0;iColumnmessage(CLP_BAD_STRING_VALUES,messages_) // <optimizationDirection_ = modelObject.optimizationDirection(); return numberErrors; } //----------------------------------------------------------------------------- // Write mps files //----------------------------------------------------------------------------- void OsiClpSolverInterface::writeMps(const char * filename, const char * extension, double objSense) const { std::string f(filename); std::string e(extension); std::string fullname; if (e!="") { fullname = f + "." + e; } else { // no extension so no trailing period fullname = f; } // get names const char * const * const rowNames = modelPtr_->rowNamesAsChar(); const char * const * const columnNames = modelPtr_->columnNamesAsChar(); // Fall back on Osi version - possibly with names OsiSolverInterface::writeMpsNative(fullname.c_str(), const_cast(rowNames), const_cast(columnNames),0,2,objSense, numberSOS_,setInfo_); if (rowNames) { modelPtr_->deleteNamesAsChar(rowNames, modelPtr_->numberRows_+1); modelPtr_->deleteNamesAsChar(columnNames, modelPtr_->numberColumns_); } } int OsiClpSolverInterface::writeMpsNative(const char *filename, const char ** rowNames, const char ** columnNames, int formatType,int numberAcross,double objSense) const { return OsiSolverInterface::writeMpsNative(filename, rowNames, columnNames, formatType, numberAcross,objSense, numberSOS_,setInfo_); } //############################################################################# // CLP specific public interfaces //############################################################################# ClpSimplex * OsiClpSolverInterface::getModelPtr() const { int saveAlgorithm = lastAlgorithm_; //freeCachedResults(); lastAlgorithm_ = saveAlgorithm; //bool inCbcOrOther = (modelPtr_->specialOptions()&0x03000000)!=0; return modelPtr_; } //------------------------------------------------------------------- //############################################################################# // Constructors, destructors clone and assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiClpSolverInterface::OsiClpSolverInterface () : OsiSolverInterface(), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), ws_(NULL), rowActivity_(NULL), columnActivity_(NULL), numberSOS_(0), setInfo_(NULL), smallModel_(NULL), factorization_(NULL), smallestElementInCut_(1.0e-15), smallestChangeInCut_(1.0e-10), largestAway_(-1.0), spareArrays_(NULL), matrixByRow_(NULL), matrixByRowAtContinuous_(NULL), integerInformation_(NULL), whichRange_(NULL), fakeMinInSimplex_(false), linearObjective_(NULL), cleanupScaling_(0), specialOptions_(0x80000000), baseModel_(NULL), lastNumberRows_(0), continuousModel_(NULL), fakeObjective_(NULL) { //printf("%p %d null constructor\n",this,xxxxxx);xxxxxx++; modelPtr_=NULL; notOwned_=false; disasterHandler_ = new OsiClpDisasterHandler(); reset(); } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- OsiSolverInterface * OsiClpSolverInterface::clone(bool CopyData) const { //printf("in clone %x\n",this); OsiClpSolverInterface * newSolver; if (CopyData) { newSolver = new OsiClpSolverInterface(*this); } else { newSolver = new OsiClpSolverInterface(); } #if 0 const double * obj = newSolver->getObjCoefficients(); const double * oldObj = getObjCoefficients(); if(newSolver->getNumCols()>3787) printf("%x - obj %x (from %x) val %g\n",newSolver,obj,oldObj,obj[3787]); #endif return newSolver; } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiClpSolverInterface::OsiClpSolverInterface ( const OsiClpSolverInterface & rhs) : OsiSolverInterface(rhs), rowsense_(NULL), rhs_(NULL), rowrange_(NULL), ws_(NULL), rowActivity_(NULL), columnActivity_(NULL), stuff_(rhs.stuff_), numberSOS_(rhs.numberSOS_), setInfo_(NULL), smallModel_(NULL), factorization_(NULL), smallestElementInCut_(rhs.smallestElementInCut_), smallestChangeInCut_(rhs.smallestChangeInCut_), largestAway_(-1.0), spareArrays_(NULL), basis_(), itlimOrig_(9999999), lastAlgorithm_(0), notOwned_(false), matrixByRow_(NULL), matrixByRowAtContinuous_(NULL), integerInformation_(NULL), whichRange_(NULL), fakeMinInSimplex_(rhs.fakeMinInSimplex_) { //printf("%p %d copy constructor %p\n",this,xxxxxx,&rhs);xxxxxx++; if ( rhs.modelPtr_ ) modelPtr_ = new ClpSimplex(*rhs.modelPtr_); else modelPtr_ = new ClpSimplex(); if ( rhs.baseModel_ ) baseModel_ = new ClpSimplex(*rhs.baseModel_); else baseModel_ = NULL; if ( rhs.continuousModel_ ) continuousModel_ = new ClpSimplex(*rhs.continuousModel_); else continuousModel_ = NULL; if (rhs.matrixByRowAtContinuous_) matrixByRowAtContinuous_ = new CoinPackedMatrix(*rhs.matrixByRowAtContinuous_); if ( rhs.disasterHandler_ ) disasterHandler_ = dynamic_cast(rhs.disasterHandler_->clone()); else disasterHandler_ = NULL; if (rhs.fakeObjective_) fakeObjective_ = new ClpLinearObjective(*rhs.fakeObjective_); else fakeObjective_ = NULL; linearObjective_ = modelPtr_->objective(); if ( rhs.ws_ ) ws_ = new CoinWarmStartBasis(*rhs.ws_); basis_ = rhs.basis_; if (rhs.integerInformation_) { int numberColumns = modelPtr_->numberColumns(); integerInformation_ = new char[numberColumns]; CoinMemcpyN(rhs.integerInformation_, numberColumns,integerInformation_); } saveData_ = rhs.saveData_; solveOptions_ = rhs.solveOptions_; cleanupScaling_ = rhs.cleanupScaling_; specialOptions_ = rhs.specialOptions_; lastNumberRows_ = rhs.lastNumberRows_; rowScale_ = rhs.rowScale_; columnScale_ = rhs.columnScale_; fillParamMaps(); messageHandler()->setLogLevel(rhs.messageHandler()->logLevel()); if (numberSOS_) { setInfo_ = new CoinSet[numberSOS_]; for (int i=0;i %x\n",&rhs,this); modelPtr_ = rhs; basis_.resize(modelPtr_->numberRows(),modelPtr_->numberColumns()); linearObjective_ = modelPtr_->objective(); if (rhs) { notOwned_=!reallyOwn; if (rhs->integerInformation()) { int numberColumns = modelPtr_->numberColumns(); integerInformation_ = new char[numberColumns]; CoinMemcpyN(rhs->integerInformation(), numberColumns,integerInformation_); } } fillParamMaps(); } // Releases so won't error void OsiClpSolverInterface::releaseClp() { modelPtr_=NULL; notOwned_=false; } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiClpSolverInterface::~OsiClpSolverInterface () { //printf("%p destructor\n",this); freeCachedResults(); if (!notOwned_) delete modelPtr_; delete baseModel_; delete continuousModel_; delete disasterHandler_; delete fakeObjective_; delete ws_; delete [] rowActivity_; delete [] columnActivity_; delete [] setInfo_; #ifdef KEEP_SMALL if (smallModel_) { delete [] spareArrays_; spareArrays_ = NULL; delete smallModel_; smallModel_=NULL; } #endif assert(smallModel_==NULL); assert(factorization_==NULL); assert(spareArrays_==NULL); delete [] integerInformation_; delete matrixByRowAtContinuous_; delete matrixByRow_; } //------------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiClpSolverInterface & OsiClpSolverInterface::operator=(const OsiClpSolverInterface& rhs) { if (this != &rhs) { //printf("in = %x - > %x\n",&rhs,this); OsiSolverInterface::operator=(rhs); freeCachedResults(); if (!notOwned_) delete modelPtr_; delete ws_; if ( rhs.modelPtr_ ) modelPtr_ = new ClpSimplex(*rhs.modelPtr_); delete baseModel_; if ( rhs.baseModel_ ) baseModel_ = new ClpSimplex(*rhs.baseModel_); else baseModel_ = NULL; delete continuousModel_; if ( rhs.continuousModel_ ) continuousModel_ = new ClpSimplex(*rhs.continuousModel_); else continuousModel_ = NULL; delete matrixByRowAtContinuous_; delete matrixByRow_; matrixByRow_=NULL; if (rhs.matrixByRowAtContinuous_) matrixByRowAtContinuous_ = new CoinPackedMatrix(*rhs.matrixByRowAtContinuous_); else matrixByRowAtContinuous_=NULL; delete disasterHandler_; if ( rhs.disasterHandler_ ) disasterHandler_ = dynamic_cast(rhs.disasterHandler_->clone()); else disasterHandler_ = NULL; delete fakeObjective_; if (rhs.fakeObjective_) fakeObjective_ = new ClpLinearObjective(*rhs.fakeObjective_); else fakeObjective_ = NULL; notOwned_=false; linearObjective_ = modelPtr_->objective(); saveData_ = rhs.saveData_; solveOptions_ = rhs.solveOptions_; cleanupScaling_ = rhs.cleanupScaling_; specialOptions_ = rhs.specialOptions_; lastNumberRows_ = rhs.lastNumberRows_; rowScale_ = rhs.rowScale_; columnScale_ = rhs.columnScale_; basis_ = rhs.basis_; stuff_ = rhs.stuff_; if (rhs.integerInformation_) { int numberColumns = modelPtr_->numberColumns(); integerInformation_ = new char[numberColumns]; CoinMemcpyN(rhs.integerInformation_, numberColumns,integerInformation_); } if ( rhs.ws_ ) ws_ = new CoinWarmStartBasis(*rhs.ws_); else ws_=NULL; delete [] rowActivity_; delete [] columnActivity_; rowActivity_=NULL; columnActivity_=NULL; delete [] setInfo_; numberSOS_ = rhs.numberSOS_; setInfo_=NULL; if (numberSOS_) { setInfo_ = new CoinSet[numberSOS_]; for (int i=0;isetLogLevel(rhs.messageHandler()->logLevel()); } return *this; } //############################################################################# // Applying cuts //############################################################################# void OsiClpSolverInterface::applyRowCut( const OsiRowCut & rowCut ) { applyRowCuts(1, &rowCut); } /* Apply a collection of row cuts which are all effective. applyCuts seems to do one at a time which seems inefficient. */ void OsiClpSolverInterface::applyRowCuts(int numberCuts, const OsiRowCut * cuts) { if (numberCuts) { // Say can't gurantee optimal basis etc lastAlgorithm_=999; // Thanks to js const OsiRowCut * * cutsp = new const OsiRowCut * [numberCuts]; for (int i=0;iwhatsChanged_ &= (0xffff&~(1|2|4|16|32)); CoinPackedMatrix * saveRowCopy = matrixByRow_; matrixByRow_=NULL; #if 0 // was #ifndef NDEBUG int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; assert (!nameDiscipline); #endif freeCachedResults0(); // Say can't gurantee optimal basis etc lastAlgorithm_=999; int numberRows = modelPtr_->numberRows(); modelPtr_->resize(numberRows+numberCuts,modelPtr_->numberColumns()); basis_.resize(numberRows+numberCuts,modelPtr_->numberColumns()); // redo as relaxed - use modelPtr_-> addRows with starts etc int size = 0; for (i=0;irow().getNumElements(); CoinBigIndex * starts = new CoinBigIndex [numberCuts+1]; int * indices = new int[size]; double * elements = new double[size]; double * lower = modelPtr_->rowLower()+numberRows; double * upper = modelPtr_->rowUpper()+numberRows; const double * columnLower = modelPtr_->columnLower(); const double * columnUpper = modelPtr_->columnUpper(); size=0; for (i=0;ilb(); double rowUb = cuts[i]->ub(); int n=cuts[i]->row().getNumElements(); const int * index = cuts[i]->row().getIndices(); const double * elem = cuts[i]->row().getElements(); starts[i]=size; for (int j=0;j=smallestChangeInCut_) { // always take indices[size]=column; elements[size++]=value; } else if (fabs(value)>=smallestElementInCut_) { double lowerValue = columnLower[column]; double upperValue = columnUpper[column]; double difference = upperValue-lowerValue; if (difference<1.0e20&&difference*fabs(value)1.0e20)) { // Take out and adjust to relax //printf("small el %g adjusted\n",value); if (rowLb>-1.0e20) { // just lower bound on row if (value>0.0) { // pretend at upper rowLb -= value*upperValue; } else { // pretend at lower rowLb -= value*lowerValue; } } else { // just upper bound on row if (value>0.0) { // pretend at lower rowUb -= value*lowerValue; } else { // pretend at upper rowUb -= value*upperValue; } } } else { // take (unwillingly) indices[size]=column; elements[size++]=value; } } else { //printf("small el %g ignored\n",value); } } lower[i]= forceIntoRange(rowLb, -OsiClpInfinity, OsiClpInfinity); upper[i]= forceIntoRange(rowUb, -OsiClpInfinity, OsiClpInfinity); if (lower[i]<-1.0e27) lower[i]=-COIN_DBL_MAX; if (upper[i]>1.0e27) upper[i]=COIN_DBL_MAX; } starts[numberCuts]=size; if (!modelPtr_->clpMatrix()) modelPtr_->createEmptyMatrix(); //modelPtr_->matrix()->appendRows(numberCuts,rows); modelPtr_->clpMatrix()->appendMatrix(numberCuts,0,starts,indices,elements); modelPtr_->setNewRowCopy(NULL); modelPtr_->setClpScaledMatrix(NULL); freeCachedResults1(); redoScaleFactors( numberCuts,starts, indices, elements); if (saveRowCopy) { #if 1 matrixByRow_=saveRowCopy; matrixByRow_->appendRows(numberCuts,starts,indices,elements,0); if (matrixByRow_->getNumElements()!=modelPtr_->clpMatrix()->getNumElements()) { delete matrixByRow_; // odd type matrix matrixByRow_=NULL; } #else delete saveRowCopy; #endif } delete [] starts; delete [] indices; delete [] elements; } //############################################################################# // Apply Cuts //############################################################################# OsiSolverInterface::ApplyCutsReturnCode OsiClpSolverInterface::applyCuts( const OsiCuts & cs, double effectivenessLb ) { OsiSolverInterface::ApplyCutsReturnCode retVal; int i; // Loop once for each column cut for ( i=0; inumberRows()-numberAdd; assert (lastNumberRows_==numberRows); // ??? int iRow; int newNumberRows = numberRows + numberAdd; rowScale_.extend(static_cast(2*newNumberRows*sizeof(double))); double * rowScale = rowScale_.array(); double * oldInverseScale = rowScale + lastNumberRows_; double * inverseRowScale = rowScale + newNumberRows; for (iRow=lastNumberRows_-1;iRow>=0;iRow--) inverseRowScale[iRow] = oldInverseScale[iRow] ; //int numberColumns = baseModel_->numberColumns(); const double * columnScale = columnScale_.array(); //const double * inverseColumnScale = columnScale + numberColumns; // Geometric mean on row scales // adjust arrays rowScale += lastNumberRows_; inverseRowScale += lastNumberRows_; for (iRow=0;iRow1.0e-20) { value *= columnScale[iColumn]; largest = CoinMax(largest,value); smallest = CoinMin(smallest,value); } } double scale=sqrt(smallest*largest); scale=CoinMax(1.0e-10,CoinMin(1.0e10,scale)); inverseRowScale[iRow]=scale; rowScale[iRow]=1.0/scale; } lastNumberRows_=newNumberRows; } } // Delete all scale factor stuff and reset option void OsiClpSolverInterface::deleteScaleFactors() { delete baseModel_; baseModel_=NULL; lastNumberRows_=0; specialOptions_ &= ~131072; } //----------------------------------------------------------------------------- void OsiClpSolverInterface::applyColCut( const OsiColCut & cc ) { modelPtr_->whatsChanged_ &= (0x1ffff&~(128|256)); // Say can't gurantee optimal basis etc lastAlgorithm_=999; double * lower = modelPtr_->columnLower(); double * upper = modelPtr_->columnUpper(); const CoinPackedVector & lbs = cc.lbs(); const CoinPackedVector & ubs = cc.ubs(); int i; for ( i=0; i lower[iCol] ) lower[iCol]= value; } for ( i=0; iscaledMatrix_) { delete modelPtr_->scaledMatrix_; modelPtr_->scaledMatrix_=NULL; } if (modelPtr_->clpMatrix()) { modelPtr_->clpMatrix()->refresh(modelPtr_); // make sure all clean #ifndef NDEBUG ClpPackedMatrix * clpMatrix = dynamic_cast (modelPtr_->clpMatrix()); if (clpMatrix) { if (clpMatrix->getNumCols()) assert (clpMatrix->getNumRows()==modelPtr_->getNumRows()); if (clpMatrix->getNumRows()) assert (clpMatrix->getNumCols()==modelPtr_->getNumCols()); } #endif } } } //------------------------------------------------------------------- void OsiClpSolverInterface::freeCachedResults0() const { delete [] rowsense_; delete [] rhs_; delete [] rowrange_; rowsense_=NULL; rhs_=NULL; rowrange_=NULL; } //------------------------------------------------------------------- void OsiClpSolverInterface::freeCachedResults1() const { // Say can't gurantee optimal basis etc lastAlgorithm_=999; delete matrixByRow_; matrixByRow_=NULL; //ws_ = NULL; if (modelPtr_&&modelPtr_->clpMatrix()) { delete modelPtr_->scaledMatrix_; modelPtr_->scaledMatrix_=NULL; modelPtr_->clpMatrix()->refresh(modelPtr_); // make sure all clean #ifndef NDEBUG ClpPackedMatrix * clpMatrix = dynamic_cast (modelPtr_->clpMatrix()); if (clpMatrix) { assert (clpMatrix->getNumRows()==modelPtr_->getNumRows()); assert (clpMatrix->getNumCols()==modelPtr_->getNumCols()); } #endif } } //------------------------------------------------------------------ void OsiClpSolverInterface::extractSenseRhsRange() const { if (rowsense_ == NULL) { // all three must be NULL assert ((rhs_ == NULL) && (rowrange_ == NULL)); int nr=modelPtr_->numberRows(); if ( nr!=0 ) { rowsense_ = new char[nr]; rhs_ = new double[nr]; rowrange_ = new double[nr]; std::fill(rowrange_,rowrange_+nr,0.0); const double * lb = modelPtr_->rowLower(); const double * ub = modelPtr_->rowUpper(); int i; for ( i=0; inewLanguage(language); OsiSolverInterface::newLanguage(language); } //############################################################################# void OsiClpSolverInterface::fillParamMaps() { assert (static_cast (OsiMaxNumIteration)== static_cast(ClpMaxNumIteration)); assert (static_cast (OsiMaxNumIterationHotStart)==static_cast(ClpMaxNumIterationHotStart)); //assert (static_cast (OsiLastIntParam)== static_cast(ClpLastIntParam)); assert (static_cast (OsiDualObjectiveLimit)== static_cast(ClpDualObjectiveLimit)); assert (static_cast (OsiPrimalObjectiveLimit)==static_cast(ClpPrimalObjectiveLimit)); assert (static_cast (OsiDualTolerance)== static_cast(ClpDualTolerance)); assert (static_cast (OsiPrimalTolerance)== static_cast(ClpPrimalTolerance)); assert (static_cast (OsiObjOffset)== static_cast(ClpObjOffset)); //assert (static_cast (OsiLastDblParam)== static_cast(ClpLastDblParam)); assert (static_cast (OsiProbName)== static_cast (ClpProbName)); //strParamMap_[OsiLastStrParam] = ClpLastStrParam; } // Sets up basis void OsiClpSolverInterface::setBasis ( const CoinWarmStartBasis & basis) { setBasis(basis,modelPtr_); setWarmStart(&basis); } // Warm start CoinWarmStartBasis OsiClpSolverInterface::getBasis(ClpSimplex * model) const { int iRow,iColumn; int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); CoinWarmStartBasis basis; basis.setSize(numberColumns,numberRows); if (model->statusExists()) { // Flip slacks int lookupA[]={0,1,3,2,0,2}; for (iRow=0;iRowgetRowStatus(iRow); iStatus = lookupA[iStatus]; basis.setArtifStatus(iRow,static_cast (iStatus)); } int lookupS[]={0,1,2,3,0,3}; for (iColumn=0;iColumngetColumnStatus(iColumn); iStatus = lookupS[iStatus]; basis.setStructStatus(iColumn,static_cast (iStatus)); } } //basis.print(); return basis; } // Warm start from statusArray CoinWarmStartBasis * OsiClpSolverInterface::getBasis(const unsigned char * statusArray) const { int iRow,iColumn; int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); CoinWarmStartBasis * basis = new CoinWarmStartBasis(); basis->setSize(numberColumns,numberRows); // Flip slacks int lookupA[]={0,1,3,2,0,2}; for (iRow=0;iRowsetArtifStatus(iRow,static_cast (iStatus)); } int lookupS[]={0,1,2,3,0,3}; for (iColumn=0;iColumnsetStructStatus(iColumn,static_cast (iStatus)); } //basis->print(); return basis; } // Sets up basis void OsiClpSolverInterface::setBasis ( const CoinWarmStartBasis & basis, ClpSimplex * model) { // Say can't gurantee optimal basis etc lastAlgorithm_=999; // transform basis to status arrays int iRow,iColumn; int numberRows = model->numberRows(); int numberColumns = model->numberColumns(); if (!model->statusExists()) { /* get status arrays ClpBasis would seem to have overheads and we will need extra bits anyway. */ model->createStatus(); } if (basis.getNumArtificial()!=numberRows|| basis.getNumStructural()!=numberColumns) { CoinWarmStartBasis basis2 = basis; // resize basis2.resize(numberRows,numberColumns); // move status model->createStatus(); // For rows lower and upper are flipped for (iRow=0;iRow1) stat = 5 - stat; // so 2->3 and 3->2 model->setRowStatus(iRow, static_cast (stat)); } for (iColumn=0;iColumnsetColumnStatus(iColumn, static_cast (basis2.getStructStatus(iColumn))); } } else { // move status model->createStatus(); // For rows lower and upper are flipped for (iRow=0;iRow1) stat = 5 - stat; // so 2->3 and 3->2 model->setRowStatus(iRow, static_cast (stat)); } for (iColumn=0;iColumnsetColumnStatus(iColumn, static_cast (basis.getStructStatus(iColumn))); } } } // Warm start difference from basis_ to statusArray CoinWarmStartDiff * OsiClpSolverInterface::getBasisDiff(const unsigned char * statusArray) const { int iRow,iColumn; int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); CoinWarmStartBasis basis; basis.setSize(numberColumns,numberRows); assert (modelPtr_->statusExists()); int lookupS[]={0,1,2,3,0,3}; for (iColumn=0;iColumn (iStatus)); } statusArray += numberColumns; // Flip slacks int lookupA[]={0,1,3,2,0,2}; for (iRow=0;iRow (iStatus)); } // Now basis is what we want while basis_ is old CoinWarmStartDiff * difference = basis.generateDiff(&basis_); return difference; } /* Read an mps file from the given filename - returns number of errors (see CoinMpsIO class) */ int OsiClpSolverInterface::readMps(const char *filename, const char *extension ) { // Get rid of integer stuff delete [] integerInformation_; integerInformation_=NULL; freeCachedResults(); CoinMpsIO m; m.setInfinity(getInfinity()); m.passInMessageHandler(modelPtr_->messageHandler()); *m.messagesPointer()=modelPtr_->coinMessages(); delete [] setInfo_; setInfo_=NULL; numberSOS_=0; CoinSet ** sets=NULL; // Temporarily reduce log level to get CoinMpsIO to shut up. int saveLogLevel = modelPtr_->messageHandler()->logLevel() ; modelPtr_->messageHandler()->setLogLevel(0) ; int numberErrors = m.readMps(filename,extension,numberSOS_,sets); modelPtr_->messageHandler()->setLogLevel(saveLogLevel) ; if (numberSOS_) { setInfo_ = new CoinSet[numberSOS_]; for (int i=0;imessage(COIN_SOLVER_MPS,messages_) <copyInIntegerInformation(integer); } // set objective name setObjName(m.getObjectiveName()); // Always keep names int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; int iRow; std::vector rowNames = std::vector (); std::vector columnNames = std::vector (); rowNames.reserve(nRows); for (iRow=0;iRowcopyNames(rowNames,columnNames); } return numberErrors; } int OsiClpSolverInterface::readMps(const char *filename, const char*extension, int & numberSets, CoinSet ** & sets) { int numberErrors = readMps(filename,extension); numberSets= numberSOS_; sets = &setInfo_; return numberErrors; } /* Read an mps file from the given filename returns number of errors (see OsiMpsReader class) */ int OsiClpSolverInterface::readMps(const char *filename,bool keepNames,bool allowErrors) { // Get rid of integer stuff delete [] integerInformation_; integerInformation_=NULL; freeCachedResults(); CoinMpsIO m; m.setInfinity(getInfinity()); m.passInMessageHandler(modelPtr_->messageHandler()); *m.messagesPointer()=modelPtr_->coinMessages(); m.setSmallElementValue(CoinMax(modelPtr_->getSmallElementValue(), m.getSmallElementValue())); delete [] setInfo_; setInfo_=NULL; numberSOS_=0; CoinSet ** sets=NULL; int numberErrors = m.readMps(filename,"",numberSOS_,sets); if (numberSOS_) { setInfo_ = new CoinSet[numberSOS_]; for (int i=0;imessage(COIN_SOLVER_MPS,messages_) <0&&numberErrors<100000)&&allowErrors)) { // set objective function offest setDblParam(OsiObjOffset,m.objectiveOffset()); // set problem name setStrParam(OsiProbName,m.getProblemName()); // set objective name setObjName(m.getObjectiveName()); // no errors loadProblem(*m.getMatrixByCol(),m.getColLower(),m.getColUpper(), m.getObjCoefficients(),m.getRowSense(),m.getRightHandSide(), m.getRowRange()); int nCols=m.getNumCols(); // get quadratic part if (m.reader()->whichSection ( ) == COIN_QUAD_SECTION ) { int * start=NULL; int * column = NULL; double * element = NULL; int status=m.readQuadraticMps(NULL,start,column,element,2); if (!status) modelPtr_->loadQuadraticObjective(nCols,start,column,element); delete [] start; delete [] column; delete [] element; } const char * integer = m.integerColumns(); int nRows=m.getNumRows(); if (integer) { int i,n=0; int * index = new int [nCols]; for (i=0;icopyInIntegerInformation(integer); } if (keepNames) { // keep names int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; int iRow; std::vector rowNames = std::vector (); std::vector columnNames = std::vector (); rowNames.reserve(nRows); for (iRow=0;iRowcopyNames(rowNames,columnNames); } } return numberErrors; } // Read file in LP format (with names) int OsiClpSolverInterface::readLp(const char *filename, const double epsilon ) { CoinLpIO m; m.passInMessageHandler(modelPtr_->messageHandler()); *m.messagesPointer()=modelPtr_->coinMessages(); m.readLp(filename, epsilon); freeCachedResults(); // set objective function offest setDblParam(OsiObjOffset, 0); // set problem name setStrParam(OsiProbName, m.getProblemName()); // set objective name setObjName(m.getObjName()); // no errors loadProblem(*m.getMatrixByRow(), m.getColLower(), m.getColUpper(), m.getObjCoefficients(), m.getRowLower(), m.getRowUpper()); const char *integer = m.integerColumns(); int nCols = m.getNumCols(); int nRows = m.getNumRows(); if (integer) { int i, n = 0; int *index = new int [nCols]; for (i=0; i rowNames = std::vector (); std::vector columnNames = std::vector (); rowNames.reserve(nRows); for (iRow=0;iRowcopyNames(rowNames,columnNames); if (m.numberSets()) { // SOS numberSOS_=m.numberSets(); setInfo_ = new CoinSet[numberSOS_]; CoinSet ** sets = m.setInformation(); for (int i=0;irowNamesAsChar(); const char * const * const columnNames = modelPtr_->columnNamesAsChar(); if (!numberSOS_) { // Fall back on Osi version - possibly with names OsiSolverInterface::writeLpNative(fp, rowNames,columnNames, epsilon, numberAcross, decimals, objSense,changeNameOnRange); } else { // need own version const int numcols = getNumCols(); char *integrality = new char[numcols]; bool hasInteger = false; for (int i=0; ideleteNamesAsChar(rowNames, modelPtr_->numberRows_+1); modelPtr_->deleteNamesAsChar(columnNames, modelPtr_->numberColumns_); } } /* I (JJF) am getting incredibly annoyed because I can't just replace a matrix. The default behavior of this is do nothing so only use where that would not matter e.g. strengthening a matrix for MIP */ void OsiClpSolverInterface::replaceMatrixOptional(const CoinPackedMatrix & matrix) { modelPtr_->whatsChanged_ &= (0xffff&~(2|4|8)); replaceMatrix(matrix); } // And if it does matter (not used at present) void OsiClpSolverInterface::replaceMatrix(const CoinPackedMatrix & matrix) { modelPtr_->whatsChanged_ &= (0xffff&~(2|4|8)); delete modelPtr_->matrix_; delete modelPtr_->rowCopy_; modelPtr_->rowCopy_=NULL; if (matrix.isColOrdered()) { modelPtr_->matrix_=new ClpPackedMatrix(matrix); } else { CoinPackedMatrix matrix2; matrix2.setExtraGap(0.0); matrix2.setExtraMajor(0.0); matrix2.reverseOrderedCopyOf(matrix); modelPtr_->matrix_=new ClpPackedMatrix(matrix2); } modelPtr_->matrix_->setDimensions(modelPtr_->numberRows_,modelPtr_->numberColumns_); freeCachedResults(); } // Get pointer to array[getNumCols()] of primal solution vector const double * OsiClpSolverInterface::getColSolution() const { if (modelPtr_->solveType()!=2) { return modelPtr_->primalColumnSolution(); } else { // simplex interface return modelPtr_->solutionRegion(1); } } // Get pointer to array[getNumRows()] of dual prices const double * OsiClpSolverInterface::getRowPrice() const { if (modelPtr_->solveType()!=2) { return modelPtr_->dualRowSolution(); } else { // simplex interface //return modelPtr_->djRegion(0); return modelPtr_->dualRowSolution(); } } // Get a pointer to array[getNumCols()] of reduced costs const double * OsiClpSolverInterface::getReducedCost() const { if (modelPtr_->solveType()!=2) { return modelPtr_->dualColumnSolution(); } else { // simplex interface return modelPtr_->djRegion(1); } } /* Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ const double * OsiClpSolverInterface::getRowActivity() const { if (modelPtr_->solveType()!=2) { return modelPtr_->primalRowSolution(); } else { // simplex interface return modelPtr_->solutionRegion(0); } } double OsiClpSolverInterface::getObjValue() const { if (modelPtr_->numberIterations()||modelPtr_->upperIn_!=-COIN_DBL_MAX) { // This does not pass unitTest when getObjValue is called before solve. //printf("obj a %g %g\n",modelPtr_->objectiveValue(), // OsiSolverInterface::getObjValue()); if (fakeMinInSimplex_) return -modelPtr_->objectiveValue() ; else return modelPtr_->objectiveValue(); } else { return OsiSolverInterface::getObjValue(); } } /* Set an objective function coefficient */ void OsiClpSolverInterface::setObjCoeff( int elementIndex, double elementValue ) { modelPtr_->whatsChanged_ &= 0xffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (elementIndex<0||elementIndex>=n) { indexError(elementIndex,"setObjCoeff"); } #endif modelPtr_->setObjectiveCoefficient(elementIndex, ((fakeMinInSimplex_)?-elementValue:elementValue)); } /* Set a single column lower bound
    Use -DBL_MAX for -infinity. */ void OsiClpSolverInterface::setColLower( int index, double elementValue ) { modelPtr_->whatsChanged_ &= 0x1ffff; #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (index<0||index>=n) { indexError(index,"setColLower"); } #endif double currentValue = modelPtr_->columnActivity_[index]; bool changed=(currentValueprimalTolerance()|| index>=basis_.getNumStructural()|| basis_.getStructStatus(index)==CoinWarmStartBasis::atLowerBound); // Say can't gurantee optimal basis etc if (changed) lastAlgorithm_=999; if (!modelPtr_->lower_) modelPtr_->whatsChanged_ &= ~0xffff; // switch off modelPtr_->setColumnLower(index,elementValue); } /* Set a single column upper bound
    Use DBL_MAX for infinity. */ void OsiClpSolverInterface::setColUpper( int index, double elementValue ) { modelPtr_->whatsChanged_ &= 0x1ffff; #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (index<0||index>=n) { indexError(index,"setColUpper"); } #endif double currentValue = modelPtr_->columnActivity_[index]; bool changed=(currentValue>elementValue+modelPtr_->primalTolerance()|| index>=basis_.getNumStructural()|| basis_.getStructStatus(index)==CoinWarmStartBasis::atUpperBound); // Say can't gurantee optimal basis etc if (changed) lastAlgorithm_=999; if (!modelPtr_->upper_) modelPtr_->whatsChanged_ &= ~0xffff; // switch off modelPtr_->setColumnUpper(index,elementValue); } /* Set a single column lower and upper bound */ void OsiClpSolverInterface::setColBounds( int elementIndex, double lower, double upper ) { modelPtr_->whatsChanged_ &= 0x1ffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; #ifndef NDEBUG int n = modelPtr_->numberColumns(); if (elementIndex<0||elementIndex>=n) { indexError(elementIndex,"setColBounds"); } #endif if (!modelPtr_->lower_) modelPtr_->whatsChanged_ &= ~0xffff; // switch off modelPtr_->setColumnBounds(elementIndex,lower,upper); } void OsiClpSolverInterface::setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { modelPtr_->whatsChanged_ &= 0x1ffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; #ifndef NDEBUG int n = modelPtr_->numberColumns(); const int * indexFirst2=indexFirst; while (indexFirst2 != indexLast) { const int iColumn=*indexFirst2++; if (iColumn<0||iColumn>=n) { indexError(iColumn,"setColSetBounds"); } } #endif modelPtr_->setColSetBounds(indexFirst,indexLast,boundList); } //------------------------------------------------------------------ /* Set a single row lower bound
    Use -DBL_MAX for -infinity. */ void OsiClpSolverInterface::setRowLower( int elementIndex, double elementValue ) { // Say can't gurantee optimal basis etc lastAlgorithm_=999; modelPtr_->whatsChanged_ &= 0xffff; #ifndef NDEBUG int n = modelPtr_->numberRows(); if (elementIndex<0||elementIndex>=n) { indexError(elementIndex,"setRowLower"); } #endif modelPtr_->setRowLower(elementIndex , elementValue); if (rowsense_!=NULL) { assert ((rhs_ != NULL) && (rowrange_ != NULL)); convertBoundToSense(modelPtr_->rowLower_[elementIndex], modelPtr_->rowUpper_[elementIndex], rowsense_[elementIndex], rhs_[elementIndex], rowrange_[elementIndex]); } } /* Set a single row upper bound
    Use DBL_MAX for infinity. */ void OsiClpSolverInterface::setRowUpper( int elementIndex, double elementValue ) { modelPtr_->whatsChanged_ &= 0xffff; // Say can't guarantee optimal basis etc lastAlgorithm_=999; #ifndef NDEBUG int n = modelPtr_->numberRows(); if (elementIndex<0||elementIndex>=n) { indexError(elementIndex,"setRowUpper"); } #endif modelPtr_->setRowUpper(elementIndex , elementValue); if (rowsense_!=NULL) { assert ((rhs_ != NULL) && (rowrange_ != NULL)); convertBoundToSense(modelPtr_->rowLower_[elementIndex], modelPtr_->rowUpper_[elementIndex], rowsense_[elementIndex], rhs_[elementIndex], rowrange_[elementIndex]); } } /* Set a single row lower and upper bound */ void OsiClpSolverInterface::setRowBounds( int elementIndex, double lower, double upper ) { modelPtr_->whatsChanged_ &= 0xffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; #ifndef NDEBUG int n = modelPtr_->numberRows(); if (elementIndex<0||elementIndex>=n) { indexError(elementIndex,"setRowBounds"); } #endif modelPtr_->setRowBounds(elementIndex,lower,upper); if (rowsense_!=NULL) { assert ((rhs_ != NULL) && (rowrange_ != NULL)); convertBoundToSense(modelPtr_->rowLower_[elementIndex], modelPtr_->rowUpper_[elementIndex], rowsense_[elementIndex], rhs_[elementIndex], rowrange_[elementIndex]); } } //----------------------------------------------------------------------------- void OsiClpSolverInterface::setRowType(int i, char sense, double rightHandSide, double range) { modelPtr_->whatsChanged_ &= 0xffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; #ifndef NDEBUG int n = modelPtr_->numberRows(); if (i<0||i>=n) { indexError(i,"setRowType"); } #endif double lower = 0, upper = 0; convertSenseToBound(sense, rightHandSide, range, lower, upper); setRowBounds(i, lower, upper); // If user is using sense then set if (rowsense_) { rowsense_[i] = sense; rhs_[i] = rightHandSide; rowrange_[i] = range; } } // Set name of row void //OsiClpSolverInterface::setRowName(int rowIndex, std::string & name) OsiClpSolverInterface::setRowName(int rowIndex, std::string name) { if (rowIndex>=0&&rowIndexnumberRows()) { int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; if (nameDiscipline) { modelPtr_->setRowName(rowIndex,name); OsiSolverInterface::setRowName(rowIndex,name) ; } } } // Return name of row if one exists or Rnnnnnnn // we ignore maxLen std::string OsiClpSolverInterface::getRowName(int rowIndex, unsigned int /*maxLen*/) const { if (rowIndex == getNumRows()) return getObjName(); int useNames; getIntParam (OsiNameDiscipline,useNames); if (useNames) return modelPtr_->getRowName(rowIndex); else return dfltRowColName('r',rowIndex); } // Set name of col void //OsiClpSolverInterface::setColName(int colIndex, std::string & name) OsiClpSolverInterface::setColName(int colIndex, std::string name) { if (colIndex>=0&&colIndexnumberColumns()) { int nameDiscipline; getIntParam(OsiNameDiscipline,nameDiscipline) ; if (nameDiscipline) { modelPtr_->setColumnName(colIndex,name); OsiSolverInterface::setColName(colIndex,name) ; } } } // Return name of col if one exists or Rnnnnnnn std::string OsiClpSolverInterface::getColName(int colIndex, unsigned int /*maxLen*/) const { int useNames; getIntParam (OsiNameDiscipline,useNames); if (useNames) return modelPtr_->getColumnName(colIndex); else return dfltRowColName('c',colIndex); } //----------------------------------------------------------------------------- void OsiClpSolverInterface::setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList) { modelPtr_->whatsChanged_ &= 0xffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; #ifndef NDEBUG int n = modelPtr_->numberRows(); const int * indexFirst2=indexFirst; while (indexFirst2 != indexLast) { const int iColumn=*indexFirst2++; if (iColumn<0||iColumn>=n) { indexError(iColumn,"setColumnSetBounds"); } } #endif modelPtr_->setRowSetBounds(indexFirst,indexLast,boundList); if (rowsense_ != NULL) { assert ((rhs_ != NULL) && (rowrange_ != NULL)); double * lower = modelPtr_->rowLower(); double * upper = modelPtr_->rowUpper(); while (indexFirst != indexLast) { const int iRow=*indexFirst++; convertBoundToSense(lower[iRow], upper[iRow], rowsense_[iRow], rhs_[iRow], rowrange_[iRow]); } } } //----------------------------------------------------------------------------- void OsiClpSolverInterface::setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList) { modelPtr_->whatsChanged_ &= 0xffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; #ifndef NDEBUG int n = modelPtr_->numberRows(); #endif const int len = static_cast(indexLast - indexFirst); while (indexFirst != indexLast) { const int iRow= *indexFirst++; #ifndef NDEBUG if (iRow<0||iRow>=n) { indexError(iRow,"isContinuous"); } #endif double lowerValue = 0; double upperValue = 0; if (rangeList){ convertSenseToBound(*senseList++, *rhsList++, *rangeList++, lowerValue, upperValue); } else { convertSenseToBound(*senseList++, *rhsList++, 0, lowerValue, upperValue); } modelPtr_->setRowBounds(iRow,lowerValue,upperValue); } if (rowsense_ != NULL) { assert ((rhs_ != NULL) && (rowrange_ != NULL)); indexFirst -= len; senseList -= len; rhsList -= len; if (rangeList) rangeList -= len; while (indexFirst != indexLast) { const int iRow=*indexFirst++; rowsense_[iRow] = *senseList++; rhs_[iRow] = *rhsList++; if (rangeList) rowrange_[iRow] = *rangeList++; } } } /* Clp's copy-in/copy-out design paradigm is a challenge for the simplex modes. Normal operation goes like this: * startup() loads clp's work arrays, performing scaling for numerical stability and compensating for max. * clp solves the problem * finish() unloads the work arrays into answer arrays, undoing scaling and max compensation. There are two solutions: undo scaling and max on demand, or make them into noops. The various getBInv* methods undo scaling on demand (but see special option 512) and do not need to worry about max. Other get solution methods are not coded to do this, so the second approach is used. For simplex modes, turn off scaling (necessary for both primal and dual solutions) and temporarily convert max to min (necessary for dual solution). This makes the unscaling in getBInv* superfluous, but don't remove it. Arguably the better solution here would be to go through and add unscaling and max compensation to the get solution methods. Look for fakeMinInSimplex to see the places this propagates to. TODO: setRowPrice never has worked properly, and I didn't try to fix it in this go-round. As of 100907, change applied to [enable|disable]Factorization (mode 1). Limitation of [enable|disable]SimplexInterface (mode 2) noted in documentation. -- lh, 100907 -- */ /* Enables normal operation of subsequent functions. This method is supposed to ensure that all typical things (like reduced costs, etc.) are updated when individual pivots are executed and can be queried by other methods */ void OsiClpSolverInterface::enableSimplexInterface(bool doingPrimal) { modelPtr_->whatsChanged_ &= 0xffff; if (modelPtr_->solveType()==2) return; assert (modelPtr_->solveType()==1); int saveIts = modelPtr_->numberIterations_; modelPtr_->setSolveType(2); if (doingPrimal) modelPtr_->setAlgorithm(1); else modelPtr_->setAlgorithm(-1); // Do initialization saveData_ = modelPtr_->saveData(); saveData_.scalingFlag_=modelPtr_->scalingFlag(); modelPtr_->scaling(0); specialOptions_ = 0x80000000; // set infeasibility cost up modelPtr_->setInfeasibilityCost(1.0e12); ClpDualRowDantzig dantzig; modelPtr_->setDualRowPivotAlgorithm(dantzig); ClpPrimalColumnDantzig dantzigP; dantzigP.saveWeights(modelPtr_,0); // set modelPtr modelPtr_->setPrimalColumnPivotAlgorithm(dantzigP); int saveOptions = modelPtr_->specialOptions_; modelPtr_->specialOptions_ &= ~262144; delete modelPtr_->scaledMatrix_; modelPtr_->scaledMatrix_=NULL; // make sure using standard factorization modelPtr_->factorization()->forceOtherFactorization(4); #ifdef NDEBUG modelPtr_->startup(0); #else int returnCode=modelPtr_->startup(0); assert (!returnCode||returnCode==2); #endif modelPtr_->specialOptions_=saveOptions; modelPtr_->numberIterations_=saveIts; } //Undo whatever setting changes the above method had to make void OsiClpSolverInterface::disableSimplexInterface() { modelPtr_->whatsChanged_ &= 0xffff; assert (modelPtr_->solveType()==2); // declare optimality anyway (for message handler) modelPtr_->setProblemStatus(0); modelPtr_->setSolveType(1); // message will not appear anyway int saveMessageLevel=modelPtr_->messageHandler()->logLevel(); modelPtr_->messageHandler()->setLogLevel(0); modelPtr_->finish(); modelPtr_->messageHandler()->setLogLevel(saveMessageLevel); modelPtr_->restoreData(saveData_); modelPtr_->scaling(saveData_.scalingFlag_); ClpDualRowSteepest steepest; modelPtr_->setDualRowPivotAlgorithm(steepest); ClpPrimalColumnSteepest steepestP; modelPtr_->setPrimalColumnPivotAlgorithm(steepestP); basis_ = getBasis(modelPtr_); modelPtr_->setSolveType(1); } /* Force scaling off. If the client thinks we're maximising, arrange it so that clp sees minimisation while the client still sees maximisation. In keeping with the spirit of the getBInv methods, special option 512 will leave all work to the client. */ void OsiClpSolverInterface::enableFactorization() const { saveData_.specialOptions_=specialOptions_; // Try to preserve work regions, reuse factorization if ((specialOptions_&(1+8))!=1+8) setSpecialOptionsMutable((1+8)|specialOptions_); // Are we allowed to make the output sensible to mere mortals? if ((specialOptions_&512)==0) { // Force scaling to off saveData_.scalingFlag_ = modelPtr_->scalingFlag() ; modelPtr_->scaling(0) ; // Temporarily force to min but keep a copy of original objective. if (getObjSense() < 0.0) { fakeMinInSimplex_ = true ; modelPtr_->setOptimizationDirection(1.0) ; double *c = modelPtr_->objective() ; int n = getNumCols() ; linearObjective_ = new double[n] ; CoinMemcpyN(c,n,linearObjective_) ; std::transform(c,c+n,c,std::negate()) ; } } int saveStatus = modelPtr_->problemStatus_; #ifdef NDEBUG modelPtr_->startup(0); #else int returnCode=modelPtr_->startup(0); assert (!returnCode||returnCode==2); #endif modelPtr_->problemStatus_=saveStatus; } /* Undo enableFactorization. Retrieve the special options and scaling and remove the temporary objective used to fake minimisation in clp. */ void OsiClpSolverInterface::disableFactorization() const { specialOptions_=saveData_.specialOptions_; // declare optimality anyway (for message handler) modelPtr_->setProblemStatus(0); // message will not appear anyway int saveMessageLevel=modelPtr_->messageHandler()->logLevel(); modelPtr_->messageHandler()->setLogLevel(0); modelPtr_->finish(); modelPtr_->messageHandler()->setLogLevel(saveMessageLevel); // Client asked for transforms on the way in, so back out. if ((specialOptions_&512)==0) { modelPtr_->scaling(saveData_.scalingFlag_) ; if (fakeMinInSimplex_ == true) { fakeMinInSimplex_ = false ; modelPtr_->setOptimizationDirection(-1.0) ; double *c = modelPtr_->objective() ; int n = getNumCols() ; std::transform(c,c+n,c,std::negate()) ; delete[] linearObjective_ ; } } } /* The following two methods may be replaced by the methods of OsiSolverInterface using OsiWarmStartBasis if: 1. OsiWarmStartBasis resize operation is implemented more efficiently and 2. It is ensured that effects on the solver are the same Returns a basis status of the structural/artificial variables */ void OsiClpSolverInterface::getBasisStatus(int* cstat, int* rstat) const { int iRow,iColumn; int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); const double * pi = modelPtr_->dualRowSolution(); const double * dj = modelPtr_->dualColumnSolution(); double multiplier = modelPtr_->optimizationDirection(); // Flip slacks int lookupA[]={0,1,3,2,0,3}; for (iRow=0;iRowgetRowStatus(iRow); if (iStatus==5) { // Fixed - look at reduced cost if (pi[iRow]*multiplier>1.0e-7) iStatus = 3; } iStatus = lookupA[iStatus]; rstat[iRow]=iStatus; } int lookupS[]={0,1,2,3,0,3}; for (iColumn=0;iColumngetColumnStatus(iColumn); if (iStatus==5) { // Fixed - look at reduced cost if (dj[iColumn]*multiplier<-1.0e-7) iStatus = 2; } iStatus = lookupS[iStatus]; cstat[iColumn]=iStatus; } } //Set the status of structural/artificial variables //Returns 0 if OK, 1 if problem is bad e.g. duplicate elements, too large ... int OsiClpSolverInterface::setBasisStatus(const int* cstat, const int* rstat) { modelPtr_->whatsChanged_ &= 0xffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; modelPtr_->createStatus(); int i, n; double * lower, * upper, * solution; n=modelPtr_->numberRows(); lower = modelPtr_->rowLower(); upper = modelPtr_->rowUpper(); solution = modelPtr_->primalRowSolution(); // For rows lower and upper are flipped int lookupA[]={0,1,3,2}; for (i=0;i3) status = 3; if (lower[i]<-1.0e50&&upper[i]>1.0e50&&status!=1) status = 0; // set free if should be else if (lower[i]<-1.0e50&&status==3) status = 2; // can't be at lower bound else if (upper[i]>1.0e50&&status==2) status = 3; // can't be at upper bound switch (status) { // free or superbasic case 0: if (lower[i]<-1.0e50&&upper[i]>1.0e50) { modelPtr_->setRowStatus(i,ClpSimplex::isFree); if (fabs(solution[i])>1.0e20) solution[i]=0.0; } else { modelPtr_->setRowStatus(i,ClpSimplex::superBasic); if (fabs(solution[i])>1.0e20) solution[i]=0.0; } break; case 1: // basic modelPtr_->setRowStatus(i,ClpSimplex::basic); break; case 2: // at upper bound solution[i]=upper[i]; if (upper[i]>lower[i]) modelPtr_->setRowStatus(i,ClpSimplex::atUpperBound); else modelPtr_->setRowStatus(i,ClpSimplex::isFixed); break; case 3: // at lower bound solution[i]=lower[i]; if (upper[i]>lower[i]) modelPtr_->setRowStatus(i,ClpSimplex::atLowerBound); else modelPtr_->setRowStatus(i,ClpSimplex::isFixed); break; } } n=modelPtr_->numberColumns(); lower = modelPtr_->columnLower(); upper = modelPtr_->columnUpper(); solution = modelPtr_->primalColumnSolution(); for (i=0;i3) status = 3; if (lower[i]<-1.0e50&&upper[i]>1.0e50&&status!=1) status = 0; // set free if should be else if (lower[i]<-1.0e50&&status==3) status = 2; // can't be at lower bound else if (upper[i]>1.0e50&&status==2) status = 3; // can't be at upper bound switch (status) { // free or superbasic case 0: if (lower[i]<-1.0e50&&upper[i]>1.0e50) { modelPtr_->setColumnStatus(i,ClpSimplex::isFree); if (fabs(solution[i])>1.0e20) solution[i]=0.0; } else { modelPtr_->setColumnStatus(i,ClpSimplex::superBasic); if (fabs(solution[i])>1.0e20) solution[i]=0.0; } break; case 1: // basic modelPtr_->setColumnStatus(i,ClpSimplex::basic); break; case 2: // at upper bound solution[i]=upper[i]; if (upper[i]>lower[i]) modelPtr_->setColumnStatus(i,ClpSimplex::atUpperBound); else modelPtr_->setColumnStatus(i,ClpSimplex::isFixed); break; case 3: // at lower bound solution[i]=lower[i]; if (upper[i]>lower[i]) modelPtr_->setColumnStatus(i,ClpSimplex::atLowerBound); else modelPtr_->setColumnStatus(i,ClpSimplex::isFixed); break; } } // say first time modelPtr_->statusOfProblem(true); // May be bad model if (modelPtr_->status()==4) return 1; // Save basis_ = getBasis(modelPtr_); return 0; } // Set column status in ClpSimplex and warmStart void OsiClpSolverInterface::setColumnStatus(int iColumn, ClpSimplex::Status status) { if (status!=modelPtr_->status_[iColumn]) { modelPtr_->whatsChanged_ &= 0xffff; // Say can't gurantee optimal basis etc lastAlgorithm_=999; modelPtr_->setColumnStatus(iColumn,status); switch (status) { case ClpSimplex::basic: basis_.setStructStatus(iColumn,CoinWarmStartBasis::basic); break; case ClpSimplex::atUpperBound: basis_.setStructStatus(iColumn,CoinWarmStartBasis::atUpperBound); break; case ClpSimplex::isFixed: case ClpSimplex::atLowerBound: basis_.setStructStatus(iColumn,CoinWarmStartBasis::atLowerBound); break; case ClpSimplex::superBasic: case ClpSimplex::isFree: basis_.setStructStatus(iColumn,CoinWarmStartBasis::isFree); break; } } } /* Perform a pivot by substituting a colIn for colOut in the basis. The status of the leaving variable is given in statOut. Where 1 is to upper bound, -1 to lower bound Return code is 0 for okay, 1 if inaccuracy forced re-factorization (should be okay) and -1 for singular factorization */ int OsiClpSolverInterface::pivot(int colIn, int colOut, int outStatus) { assert (modelPtr_->solveType()==2); // convert to Clp style (what about flips?) if (colIn<0) colIn = modelPtr_->numberColumns()+(-1-colIn); if (colOut<0) colOut = modelPtr_->numberColumns()+(-1-colOut); // in clp direction of out is reversed outStatus = - outStatus; // set in clp modelPtr_->setDirectionOut(outStatus); modelPtr_->setSequenceIn(colIn); modelPtr_->setSequenceOut(colOut); // do pivot return modelPtr_->pivot(); } /* Obtain a result of the primal pivot Outputs: colOut -- leaving column, outStatus -- its status, t -- step size, and, if dx!=NULL, *dx -- primal ray direction. Inputs: colIn -- entering column, sign -- direction of its change (+/-1). Both for colIn and colOut, artificial variables are index by the negative of the row index minus 1. Return code (for now): 0 -- leaving variable found, -1 -- everything else? Clearly, more informative set of return values is required Primal and dual solutions are updated */ int OsiClpSolverInterface::primalPivotResult(int colIn, int sign, int& colOut, int& outStatus, double& t, CoinPackedVector* dx) { assert (modelPtr_->solveType()==2); // convert to Clp style if (colIn<0) colIn = modelPtr_->numberColumns()+(-1-colIn); // set in clp modelPtr_->setDirectionIn(sign); modelPtr_->setSequenceIn(colIn); modelPtr_->setSequenceOut(-1); int returnCode = modelPtr_->primalPivotResult(); t = modelPtr_->theta(); int numberColumns = modelPtr_->numberColumns(); if (dx) { double * ray = modelPtr_->unboundedRay(); if (ray) dx->setFullNonZero(numberColumns,ray); else printf("No ray?\n"); delete [] ray; } outStatus = - modelPtr_->directionOut(); colOut = modelPtr_->sequenceOut(); if (colOut>= numberColumns) colOut = -1-(colOut - numberColumns); return returnCode; } /* Obtain a result of the dual pivot (similar to the previous method) Differences: entering variable and a sign of its change are now the outputs, the leaving variable and its statuts -- the inputs If dx!=NULL, then *dx contains dual ray Return code: same */ int OsiClpSolverInterface::dualPivotResult(int& /*colIn*/, int& /*sign*/, int /*colOut*/, int /*outStatus*/, double& /*t*/, CoinPackedVector* /*dx*/) { assert (modelPtr_->solveType()==2); abort(); return 0; } /* This method should not leave a permanent change in the solver. For this reason, save a copy of the cost region and replace it after we've calculated the duals and reduced costs. On the good side, if we're maximising, we should negate the objective on the way in and negate the duals on the way out. Since clp won't be doing anything more with c, we can exploit (-1)(-1) = 1 and do nothing. */ void OsiClpSolverInterface::getReducedGradient( double* columnReducedCosts, double * duals, const double * c) const { //assert (modelPtr_->solveType()==2); // could do this faster with coding inside Clp // save current costs int numberColumns = modelPtr_->numberColumns(); double * save = new double [numberColumns]; double * obj = modelPtr_->costRegion(); CoinMemcpyN(obj,numberColumns,save); // Compute new duals and reduced costs. const double * columnScale = modelPtr_->columnScale(); if (!columnScale) { CoinMemcpyN(c,numberColumns,obj) ; } else { // need to scale for (int i=0;icomputeDuals(NULL); // Restore previous cost vector CoinMemcpyN(save,numberColumns,obj); delete [] save; // Transfer results to parameters int numberRows = modelPtr_->numberRows(); const double * dualScaled = modelPtr_->dualRowSolution(); const double * djScaled = modelPtr_->djRegion(1); if (!columnScale) { CoinMemcpyN(dualScaled,numberRows,duals) ; CoinMemcpyN(djScaled,numberColumns,columnReducedCosts) ; } else { // need to scale const double * rowScale = modelPtr_->rowScale(); for (int i=0;iwhatsChanged_ &= (0xffff&~(64)); assert (modelPtr_->solveType()==2); int numberColumns = modelPtr_->numberColumns(); CoinMemcpyN(c,numberColumns,modelPtr_->objective()); if (modelPtr_->nonLinearCost()) { modelPtr_->nonLinearCost()->refreshCosts(c); } CoinMemcpyN(c,numberColumns,modelPtr_->costRegion()); modelPtr_->computeDuals(NULL); } #endif //Get a row of the tableau (slack part in slack if not NULL) void OsiClpSolverInterface::getBInvARow(int row, double* z, double * slack) const { #ifndef NDEBUG int n = modelPtr_->numberRows(); if (row<0||row>=n) { indexError(row,"getBInvARow"); } #endif //assert (modelPtr_->solveType()==2||(specialOptions_&1)); CoinIndexedVector * rowArray0 = modelPtr_->rowArray(0); CoinIndexedVector * rowArray1 = modelPtr_->rowArray(1); CoinIndexedVector * columnArray0 = modelPtr_->columnArray(0); CoinIndexedVector * columnArray1 = modelPtr_->columnArray(1); rowArray0->clear(); rowArray1->clear(); columnArray0->clear(); columnArray1->clear(); int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); // put +1 in row // But swap if pivot variable was slack as clp stores slack as -1.0 const int * pivotVariable = modelPtr_->pivotVariable(); const double * rowScale = modelPtr_->rowScale(); const double * columnScale = modelPtr_->columnScale(); int pivot = pivotVariable[row]; double value; // And if scaled then adjust if (!rowScale) { if (pivotinsert(row,value); modelPtr_->factorization()->updateColumnTranspose(rowArray0,rowArray1); // put row of tableau in rowArray1 and columnArray0 modelPtr_->clpMatrix()->transposeTimes(modelPtr_,1.0, rowArray1,columnArray1,columnArray0); // If user is sophisticated then let her/him do work if ((specialOptions_&512)==0) { // otherwise copy and clear if (!rowScale) { CoinMemcpyN(columnArray0->denseVector(),numberColumns,z); } else { double * array = columnArray0->denseVector(); for (int i=0;idenseVector(),numberRows,slack); } else { double * array = rowArray1->denseVector(); for (int i=0;iclear(); rowArray1->clear(); } // don't need to clear everything always, but doesn't cost rowArray0->clear(); columnArray1->clear(); } //Get a row of the tableau (slack part in slack if not NULL) void OsiClpSolverInterface::getBInvARow(int row, CoinIndexedVector * columnArray0, CoinIndexedVector * slack, bool keepScaled) const { #ifndef NDEBUG int nx = modelPtr_->numberRows(); if (row<0||row>=nx) { indexError(row,"getBInvARow"); } #endif //assert (modelPtr_->solveType()==2||(specialOptions_&1)); CoinIndexedVector * rowArray0 = modelPtr_->rowArray(0); CoinIndexedVector * rowArray1 = slack ? slack : modelPtr_->rowArray(1); CoinIndexedVector * columnArray1 = modelPtr_->columnArray(1); rowArray0->clear(); rowArray1->clear(); columnArray0->clear(); columnArray1->clear(); //int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); // put +1 in row // But swap if pivot variable was slack as clp stores slack as -1.0 const int * pivotVariable = modelPtr_->pivotVariable(); const double * rowScale = modelPtr_->rowScale(); const double * columnScale = modelPtr_->columnScale(); int pivot = pivotVariable[row]; double value; // And if scaled then adjust if (!rowScale) { if (pivotinsert(row,value); modelPtr_->factorization()->updateColumnTranspose(rowArray0,rowArray1); // put row of tableau in rowArray1 and columnArray0 modelPtr_->clpMatrix()->transposeTimes(modelPtr_,1.0, rowArray1,columnArray1,columnArray0); int n; const int * which; double * array; // deal with scaling etc if (rowScale&&!keepScaled) { int j; // First columns n = columnArray0->getNumElements(); which = columnArray0->getIndices(); array = columnArray0->denseVector(); for (j=0; j < n; j++) { int k=which[j]; array[k] /= columnScale[k]; } if (slack) { n = slack->getNumElements(); which = slack->getIndices(); array = slack->denseVector(); for(j=0; j < n; j++) { int k=which[j]; array[k] *= rowScale[k]; } } } if (!slack) rowArray1->clear(); } //Get a row of the basis inverse void OsiClpSolverInterface::getBInvRow(int row, double* z) const { #ifndef NDEBUG int n = modelPtr_->numberRows(); if (row<0||row>=n) { indexError(row,"getBInvRow"); } #endif //assert (modelPtr_->solveType()==2||(specialOptions_&1)!=0); ClpFactorization * factorization = modelPtr_->factorization(); CoinIndexedVector * rowArray0 = modelPtr_->rowArray(0); CoinIndexedVector * rowArray1 = modelPtr_->rowArray(1); rowArray0->clear(); rowArray1->clear(); // put +1 in row // But swap if pivot variable was slack as clp stores slack as -1.0 double value = (modelPtr_->pivotVariable()[row]numberColumns()) ? 1.0 : -1.0; int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); const double * rowScale = modelPtr_->rowScale(); const double * columnScale = modelPtr_->columnScale(); const int * pivotVariable = modelPtr_->pivotVariable(); // but scale if (rowScale) { int pivot = pivotVariable[row]; if (pivotinsert(row,value); factorization->updateColumnTranspose(rowArray0,rowArray1); // If user is sophisticated then let her/him do work if ((specialOptions_&512)==0) { // otherwise copy and clear if (!rowScale) { CoinMemcpyN(rowArray1->denseVector(),modelPtr_->numberRows(),z); } else { double * array = rowArray1->denseVector(); for (int i=0;iclear(); } } //Get a column of the tableau void OsiClpSolverInterface::getBInvACol(int col, double* vec) const { //assert (modelPtr_->solveType()==2||(specialOptions_&1)!=0); CoinIndexedVector * rowArray0 = modelPtr_->rowArray(0); CoinIndexedVector * rowArray1 = modelPtr_->rowArray(1); rowArray0->clear(); rowArray1->clear(); // get column of matrix #ifndef NDEBUG int n = modelPtr_->numberColumns()+modelPtr_->numberRows(); if (col<0||col>=n) { indexError(col,"getBInvACol"); } #endif int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); const int * pivotVariable = modelPtr_->pivotVariable(); const double * rowScale = modelPtr_->rowScale(); const double * columnScale = modelPtr_->columnScale(); if (!rowScale) { if (colunpack(rowArray1,col); } else { rowArray1->insert(col-numberColumns,1.0); } } else { if (colunpack(rowArray1,col); double multiplier = 1.0/columnScale[col]; int number = rowArray1->getNumElements(); int * index = rowArray1->getIndices(); double * array = rowArray1->denseVector(); for (int i=0;iinsert(col-numberColumns,rowScale[col-numberColumns]); } } modelPtr_->factorization()->updateColumn(rowArray0,rowArray1,false); // If user is sophisticated then let her/him do work if ((specialOptions_&512)==0) { // otherwise copy and clear // But swap if pivot variable was slack as clp stores slack as -1.0 double * array = rowArray1->denseVector(); if (!rowScale) { for (int i=0;iclear(); } } //Get a column of the tableau void OsiClpSolverInterface::getBInvACol(int col, CoinIndexedVector * rowArray1) const { CoinIndexedVector * rowArray0 = modelPtr_->rowArray(0); rowArray0->clear(); rowArray1->clear(); // get column of matrix #ifndef NDEBUG int nx = modelPtr_->numberColumns()+modelPtr_->numberRows(); if (col<0||col>=nx) { indexError(col,"getBInvACol"); } #endif //int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); const int * pivotVariable = modelPtr_->pivotVariable(); const double * rowScale = modelPtr_->rowScale(); const double * columnScale = modelPtr_->columnScale(); if (!rowScale) { if (colunpack(rowArray1,col); } else { rowArray1->insert(col-numberColumns,1.0); } } else { if (colunpack(rowArray1,col); double multiplier = 1.0/columnScale[col]; int number = rowArray1->getNumElements(); int * index = rowArray1->getIndices(); double * array = rowArray1->denseVector(); for (int i=0;iinsert(col-numberColumns,rowScale[col-numberColumns]); } } modelPtr_->factorization()->updateColumn(rowArray0,rowArray1,false); // Deal with stuff int n = rowArray1->getNumElements(); const int * which = rowArray1->getIndices(); double * array = rowArray1->denseVector(); for(int j=0; j < n; j++){ int k=which[j]; // need to know pivot variable for +1/-1 (slack) and row/column scaling int pivot = pivotVariable[k]; if (pivotrowArray(0); rowArray0->clear(); // get column of matrix //int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); const int * pivotVariable = modelPtr_->pivotVariable(); const double * rowScale = modelPtr_->rowScale(); const double * columnScale = modelPtr_->columnScale(); // rowArray1 is not a column - so column scale can't be applied before modelPtr_->factorization()->updateColumn(rowArray0,rowArray1,false); // Deal with stuff int n = rowArray1->getNumElements(); const int * which = rowArray1->getIndices(); double * array = rowArray1->denseVector(); for(int j=0; j < n; j++){ int k=which[j]; // need to know pivot variable for +1/-1 (slack) and row/column scaling int pivot = pivotVariable[k]; if (pivotsolveType()==2||(specialOptions_&1)!=0); ClpFactorization * factorization = modelPtr_->factorization(); CoinIndexedVector * rowArray0 = modelPtr_->rowArray(0); CoinIndexedVector * rowArray1 = modelPtr_->rowArray(1); rowArray0->clear(); rowArray1->clear(); #ifndef NDEBUG int n = modelPtr_->numberRows(); if (col<0||col>=n) { indexError(col,"getBInvCol"); } #endif // put +1 in row int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); const double * rowScale = modelPtr_->rowScale(); const double * columnScale = modelPtr_->columnScale(); const int * pivotVariable = modelPtr_->pivotVariable(); // but scale double value; if (!rowScale) { value=1.0; } else { value = rowScale[col]; } rowArray1->insert(col,value); factorization->updateColumn(rowArray0,rowArray1,false); // If user is sophisticated then let her/him do work if ((specialOptions_&512)==0) { // otherwise copy and clear // But swap if pivot variable was slack as clp stores slack as -1.0 double * array = rowArray1->denseVector(); if (!rowScale) { for (int i=0;iclear(); } } /* Get basic indices (order of indices corresponds to the order of elements in a vector returned by getBInvACol() and getBInvCol()). */ void OsiClpSolverInterface::getBasics(int* index) const { //assert (modelPtr_->solveType()==2||(specialOptions_&1)!=0); assert (index); if (modelPtr_->pivotVariable()) { CoinMemcpyN(modelPtr_->pivotVariable(),modelPtr_->numberRows(),index); } else { std::cerr<<"getBasics is only available with enableSimplexInterface." <problemStatus_); } // Resets as if default constructor void OsiClpSolverInterface::reset() { setInitialData(); // clear base class freeCachedResults(); if (!notOwned_) delete modelPtr_; delete ws_; ws_ = NULL; delete [] rowActivity_; delete [] columnActivity_; assert(smallModel_==NULL); assert(factorization_==NULL); smallestElementInCut_ = 1.0e-15; smallestChangeInCut_ = 1.0e-10; largestAway_ = -1.0; assert(spareArrays_==NULL); delete [] integerInformation_; rowActivity_ = NULL; columnActivity_ = NULL; integerInformation_ = NULL; basis_ = CoinWarmStartBasis(); itlimOrig_=9999999; lastAlgorithm_=0; notOwned_=false; modelPtr_ = new ClpSimplex(); linearObjective_ = NULL; fillParamMaps(); } // Set a hint parameter bool OsiClpSolverInterface::setHintParam(OsiHintParam key, bool yesNo, OsiHintStrength strength, void * otherInformation) { if ( OsiSolverInterface::setHintParam(key,yesNo,strength,otherInformation)) { // special coding for branch and cut if (yesNo&&strength == OsiHintDo&&key==OsiDoInBranchAndCut) { if ( specialOptions_==0x80000000) { setupForRepeatedUse(0,0); specialOptions_=0; } // set normal specialOptions_ &= (2047|7*8192|15*65536|2097152|4194304); if (otherInformation!=NULL) { int * array = static_cast (otherInformation); if (array[0]>=0||array[0]<=2) specialOptions_ |= array[0]<<10; } } // Printing if (key==OsiDoReducePrint) { handler_->setLogLevel(yesNo ? 0 : 1); } return true; } else { return false; } } // Crunch down model void OsiClpSolverInterface::crunch() { //if (modelPtr_->scalingFlag_>0&&!modelPtr_->rowScale_&& // modelPtr_->rowCopy_) { //printf("BBBB could crunch2\n"); //} int numberColumns = modelPtr_->numberColumns(); int numberRows = modelPtr_->numberRows(); int totalIterations=0; bool abortSearch=false; // Use dual region double * rhs = modelPtr_->dualRowSolution(); // Get space for strong branching int size = static_cast((1+4*(numberRows+numberColumns))*sizeof(double)); // and for save of original column bounds size += static_cast(2*numberColumns*sizeof(double)); size += static_cast((1+4*numberRows+2*numberColumns)*sizeof(int)); size += numberRows+numberColumns; #ifdef KEEP_SMALL char * spareArrays = NULL; if(!(modelPtr_->whatsChanged_&0x30000)) { delete smallModel_; smallModel_ = NULL; delete [] spareArrays_; spareArrays_ = NULL; } if (!spareArrays_) { spareArrays = new char[size]; //memset(spareArrays,0x20,size); } else { spareArrays = spareArrays_; } double * arrayD = reinterpret_cast (spareArrays); double * saveSolution = arrayD+1; double * saveLower = saveSolution + (numberRows+numberColumns); double * saveUpper = saveLower + (numberRows+numberColumns); double * saveObjective = saveUpper + (numberRows+numberColumns); double * saveLowerOriginal = saveObjective + (numberRows+numberColumns); double * saveUpperOriginal = saveLowerOriginal + numberColumns; double * lowerOriginal = modelPtr_->columnLower(); double * upperOriginal = modelPtr_->columnUpper(); int * savePivot = reinterpret_cast (saveUpperOriginal + numberColumns); int * whichRow = savePivot+numberRows; int * whichColumn = whichRow + 3*numberRows; int * arrayI = whichColumn + 2*numberColumns; if (spareArrays_) { assert (smallModel_); int nSame=0; int nSub=0; for (int i=0;i1.0e-30); double up = upperOriginal[i]; double upOld = saveUpperOriginal[i]; if (lo>=loOld&&up<=upOld) { if (lo==loOld&&up==upOld) { nSame++; } else { nSub++; //if (!isInteger(i)) //nSub+=10; } } } //printf("%d bounds same, %d interior, %d bad\n", // nSame,nSub,numberColumns-nSame-nSub); if (nSame0) { delete smallModel_; smallModel_=NULL; } else { // we can fix up (but should we if large number fixed?) assert (smallModel_); double * lowerSmall = smallModel_->columnLower(); double * upperSmall = smallModel_->columnUpper(); int numberColumns2 = smallModel_->numberColumns(); for (int i=0;i (modelPtr_)->crunch(rhs,whichRow,whichColumn, nBound,moreBounds,tightenBounds); #ifndef NDEBUG int nCopy = 3*numberRows+2*numberColumns; for (int i=0;i=-CoinMax(numberRows,numberColumns)&&whichRow[i]whatsChanged_&0x30000)); //delete [] spareArrays_; //spareArrays_ = NULL; assert (spareArrays_); int nCopy = 3*numberRows+2*numberColumns; nBound = whichRow[nCopy]; #ifndef NDEBUG for (int i=0;i=-CoinMax(numberRows,numberColumns)&&whichRow[i]status_; int nr1=modelPtr_->numberRows_; int nc1=modelPtr_->numberColumns_; unsigned char * stat2=smallModel_->status_; int nr2=smallModel_->numberRows_; int nc2=smallModel_->numberColumns_; int n=0; for (int i=0;icolumnLower_; //const double * up1=modelPtr_->columnUpper_; //const double * lo2=smallModel_->columnLower_; //const double * up2=smallModel_->columnUpper_; int nBad=0; for (int i=0;i (modelPtr_)->crunch(rhs,whichRow,whichColumn, nBound,moreBounds,tightenBounds); #endif int inCbcOrOther = ((modelPtr_->specialOptions()&0x03000000)!=0) ? 1 : 0; if((modelPtr_->specialOptions()&0x01200000)==0x1200000) inCbcOrOther=2; if (small) { small->specialOptions_ |= 262144; if ((specialOptions_&131072)!=0) { assert (lastNumberRows_>=0); int numberRows2 = small->numberRows(); int numberColumns2 = small->numberColumns(); double * rowScale2 = new double [2*numberRows2]; assert (rowScale_.getSize()>=2*numberRows); const double * rowScale = rowScale_.array(); double * inverseScale2 = rowScale2+numberRows2; const double * inverseScale = rowScale+modelPtr_->numberRows_; int i; for (i=0;i=0&&iRowsetRowScale(rowScale2); double * columnScale2 = new double [2*numberColumns2]; assert (columnScale_.getSize()>=2*numberColumns); const double * columnScale = columnScale_.array(); inverseScale2 = columnScale2+numberColumns2; inverseScale = columnScale+modelPtr_->numberColumns_; for (i=0;isetColumnScale(columnScale2); } disasterHandler_->setOsiModel(this); if (inCbcOrOther) { disasterHandler_->setSimplex(small); disasterHandler_->setWhereFrom(1); // crunch small->setDisasterHandler(disasterHandler_); } #if 0 const double * obj =small->objective(); int numberColumns2 = small->numberColumns(); int iColumn; for (iColumn=0;iColumndual(); else small->primal(); // No objective - use primal! #else small->moreSpecialOptions_ = modelPtr_->moreSpecialOptions_; small->dual(0,7); #endif modelPtr_->secondaryStatus_=0; totalIterations += small->numberIterations(); int problemStatus = small->problemStatus(); if (problemStatus>=0&&problemStatus<=2) { modelPtr_->setProblemStatus(problemStatus); if (inCbcOrOther!=1||!problemStatus) { // Scaling may have changed - if so pass across if (modelPtr_->scalingFlag()==4) modelPtr_->scaling(small->scalingFlag()); static_cast (modelPtr_)->afterCrunch(*small,whichRow,whichColumn,nBound); if ((specialOptions_&1048576)==0 && !inCbcOrOther) { // get correct rays if (problemStatus==2) modelPtr_->primal(1); else if (problemStatus==1) modelPtr_->dual(); } else { delete [] modelPtr_->ray_; modelPtr_->ray_=NULL; if (problemStatus==1&&small->ray_) { // get ray to full problem int numberRows = modelPtr_->numberRows(); int numberRows2 = small->numberRows(); double * ray = new double [numberRows]; memset(ray,0,numberRows*sizeof(double)); double multiplier=1.0; if (small->rowScale_) { if (small->sequenceOut_numberColumns_) multiplier=small->columnScale_[small->sequenceOut_]; else multiplier=small->rowScale_[small->sequenceOut_-small->numberColumns_]; } for (int i = 0; i < numberRows2; i++) { small->ray_[i] *= multiplier; int iRow = whichRow[i]; ray[iRow] = small->ray_[i]; } { // Column copy of matrix const double * element = small->matrix()->getElements(); const int * row = small->matrix()->getIndices(); const CoinBigIndex * columnStart = small->matrix()->getVectorStarts(); const int * columnLength = small->matrix()->getVectorLengths(); int n=0,k=0,nn=0; for (int i=0;inumberColumns_;i++) { double sum = 0.0; for (CoinBigIndex j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { sum += small->ray_[row[j]]*element[j]; } if (fabs(sum)>1.0e-7) { if (small->getColumnStatus(i) == ClpSimplex::basic) { n++; if (fabs(1.0-fabs(sum))>1.0e-7) nn++; } else if (fabs(sum)>1.0e-7) { k++; } //printf("%d %g\n",i,sum); } } //printf("small %d basic (%d non-unit) %d non-basic\n",n,nn,k); } // Column copy of matrix const double * element = getMatrixByCol()->getElements(); const int * row = getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = getMatrixByCol()->getVectorStarts(); const int * columnLength = getMatrixByCol()->getVectorLengths(); // translate for (int jRow = nBound; jRow < 2 * numberRows; jRow++) { int iRow = whichRow[jRow]; int iColumn = whichRow[jRow+numberRows]; if (modelPtr_->getColumnStatus(iColumn) == ClpSimplex::basic) { double value = 0.0; double sum = 0.0; for (CoinBigIndex j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { if (iRow == row[j]) { value = element[j]; } else { sum += ray[row[j]]*element[j]; } } ray[iRow] = -sum / value; } } int n=0,k=0,nn=0; for (int i=0;inumberColumns_;i++) { double sum = 0.0; for (CoinBigIndex j = columnStart[i]; j < columnStart[i] + columnLength[i]; j++) { sum += ray[row[j]]*element[j]; } if (modelPtr_->getStatus(i)==ClpSimplex::basic&& fabs(sum)>1.0e-7) { n++; if (fabs(1.0-fabs(sum))>1.0e-7) nn++; } else if (fabs(sum)>1.0e-7) { k++; } if (modelPtr_->getStatus(i)!=ClpSimplex::basic&& modelPtr_->columnLower_[i]==modelPtr_->columnUpper_[i]) modelPtr_->setStatus(i,ClpSimplex::isFixed); } //printf("%d basic (%d non-unit) %d non-basic\n",n,nn,k); modelPtr_->ray_=ray; modelPtr_->directionOut_=small->directionOut_; if (small->sequenceOut_numberColumns_) modelPtr_->sequenceOut_ = whichColumn[small->sequenceOut_]; else modelPtr_->sequenceOut_ = whichRow[small->sequenceOut_-small->numberColumns_] + modelPtr_->numberColumns_; } } } #ifdef KEEP_SMALL //assert (!smallModel_); //smallModel_ = small; small=NULL; int nCopy = 3*numberRows+2*numberColumns; //int * copy = CoinCopyOfArrayPartial(whichRow,nCopy+1,nCopy); whichRow[nCopy]=nBound; assert (arrayI[0]==nBound); arrayI[0]=nBound; // same spareArrays_ = spareArrays; spareArrays=NULL; #endif } else if (problemStatus!=3) { modelPtr_->setProblemStatus(1); } else { if (problemStatus==3) { if (!inCbcOrOther) { // Calling code not Cbc - may want information from larger model static_cast (modelPtr_)->afterCrunch(*small,whichRow,whichColumn,nBound); // but may not be able to trust objective as lower bound if (small->algorithm_==1/*||small->sumDualInfeasibilities_>1.0e-5*/) modelPtr_->secondaryStatus_=10; } // may be problems if (inCbcOrOther&&disasterHandler_->inTrouble()) { if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // in case scaling bad small->setRowScale(NULL); small->setColumnScale(NULL); // try just going back in disasterHandler_->setPhase(1); small->dual(); totalIterations += small->numberIterations(); if (disasterHandler_->inTrouble()) { if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } // try primal on original model disasterHandler_->setPhase(2); disasterHandler_->setOsiModel(this); modelPtr_->setDisasterHandler(disasterHandler_); modelPtr_->primal(); totalIterations += modelPtr_->numberIterations(); if(disasterHandler_->inTrouble()) { #ifdef COIN_DEVELOP printf("disaster crunch - treat as infeasible\n"); #endif if (disasterHandler_->typeOfDisaster()) { // We want to abort abortSearch=true; goto disaster; } modelPtr_->setProblemStatus(1); } // give up for now modelPtr_->setDisasterHandler(NULL); } else { modelPtr_->setProblemStatus(small->problemStatus()); } } else { small->computeObjectiveValue(); modelPtr_->setObjectiveValue(small->objectiveValue()); modelPtr_->setProblemStatus(3); } } else { modelPtr_->setProblemStatus(3); } } disaster: delete small; #ifdef KEEP_SMALL if (small==smallModel_) { smallModel_ = NULL; delete [] spareArrays_; spareArrays_ = NULL; spareArrays = NULL; } #endif } else { modelPtr_->setProblemStatus(1); #ifdef KEEP_SMALL delete [] spareArrays_; spareArrays_ = NULL; spareArrays = NULL; #endif } modelPtr_->setNumberIterations(totalIterations); if (abortSearch) { lastAlgorithm_=-911; modelPtr_->setProblemStatus(4); } #ifdef KEEP_SMALL delete [] spareArrays; #else delete [] whichRow; #endif } // Synchronize model void OsiClpSolverInterface::synchronizeModel() { if ((specialOptions_ &128)!=0) { if (!modelPtr_->rowScale_&&(specialOptions_&131072)!=0) { assert (lastNumberRows_==modelPtr_->numberRows_); int numberRows = modelPtr_->numberRows(); int numberColumns = modelPtr_->numberColumns(); double * rowScale = CoinCopyOfArray(rowScale_.array(),2*numberRows); modelPtr_->setRowScale(rowScale); double * columnScale = CoinCopyOfArray(columnScale_.array(),2*numberColumns); modelPtr_->setColumnScale(columnScale); modelPtr_->setRowScale(NULL); modelPtr_->setColumnScale(NULL); } } } // Returns true if has OsiSimplex methods /* Returns 1 if can just do getBInv etc 2 if has all OsiSimplex methods and 0 if it has none */ int OsiClpSolverInterface::canDoSimplexInterface() const { return 2; } // Pass in sos stuff from AMPl void OsiClpSolverInterface::setSOSData(int numberSOS,const char * type, const int * start,const int * indices, const double * weights) { delete [] setInfo_; setInfo_=NULL; numberSOS_=numberSOS; if (numberSOS_) { setInfo_ = new CoinSet[numberSOS_]; for (int i=0;i(oldObject[iObject]) ; if (obj) numberSOS++; } if (numberSOS_&&!numberSOS) { // make a large enough array for new objects nObjects = numberObjects_; numberObjects_=numberSOS_+nObjects; if (numberObjects_) object_ = new OsiObject * [numberObjects_]; else object_=NULL; // copy CoinMemcpyN(oldObject,nObjects,object_); // Delete old array (just array) delete [] oldObject; for (int i=0;inumberEntries(),set->which(),set->weights(), set->setType()); } } else if (!numberSOS_&&numberSOS) { // create Coin sets assert (!setInfo_); setInfo_ = new CoinSet[numberSOS]; for (iObject = 0;iObject(oldObject[iObject]) ; if (obj) setInfo_[numberSOS_++]=CoinSosSet(obj->numberMembers(),obj->members(),obj->weights(),obj->sosType()); } } else if (numberSOS!=numberSOS_) { printf("mismatch on SOS\n"); } return numberSOS_; } // below needed for pathetic branch and bound code #include #include // Trivial class for Branch and Bound class OsiNodeSimple { public: // Default Constructor OsiNodeSimple (); // Constructor from current state (and list of integers) // Also chooses branching variable (if none set to -1) OsiNodeSimple (OsiSolverInterface &model, int numberIntegers, int * integer, CoinWarmStart * basis); void gutsOfConstructor (OsiSolverInterface &model, int numberIntegers, int * integer, CoinWarmStart * basis); // Copy constructor OsiNodeSimple ( const OsiNodeSimple &); // Assignment operator OsiNodeSimple & operator=( const OsiNodeSimple& rhs); // Destructor ~OsiNodeSimple (); // Work of destructor void gutsOfDestructor(); // Extension - true if other extension of this bool extension(const OsiNodeSimple & other, const double * originalLower, const double * originalUpper) const; inline void incrementDescendants() { descendants_++;} // Public data // Basis (should use tree, but not as wasteful as bounds!) CoinWarmStart * basis_; // Objective value (COIN_DBL_MAX) if spare node double objectiveValue_; // Branching variable (0 is first integer) int variable_; // Way to branch - -1 down (first), 1 up, -2 down (second), 2 up (second) int way_; // Number of integers (for length of arrays) int numberIntegers_; // Current value double value_; // Number of descendant nodes (so 2 is in interior) int descendants_; // Parent int parent_; // Previous in chain int previous_; // Next in chain int next_; // Now I must use tree // Bounds stored in full (for integers) int * lower_; int * upper_; }; OsiNodeSimple::OsiNodeSimple() : basis_(NULL), objectiveValue_(COIN_DBL_MAX), variable_(-100), way_(-1), numberIntegers_(0), value_(0.5), descendants_(-1), parent_(-1), previous_(-1), next_(-1), lower_(NULL), upper_(NULL) { } OsiNodeSimple::OsiNodeSimple(OsiSolverInterface & model, int numberIntegers, int * integer,CoinWarmStart * basis) { gutsOfConstructor(model,numberIntegers,integer,basis); } void OsiNodeSimple::gutsOfConstructor(OsiSolverInterface & model, int numberIntegers, int * integer,CoinWarmStart * basis) { basis_ = basis; variable_=-1; way_=-1; numberIntegers_=numberIntegers; value_=0.0; descendants_ = 0; parent_ = -1; previous_ = -1; next_ = -1; if (model.isProvenOptimal()&&!model.isDualObjectiveLimitReached()) { objectiveValue_ = model.getObjSense()*model.getObjValue(); } else { objectiveValue_ = 1.0e100; lower_ = NULL; upper_ = NULL; return; // node cutoff } lower_ = new int [numberIntegers_]; upper_ = new int [numberIntegers_]; assert (upper_!=NULL); const double * lower = model.getColLower(); const double * upper = model.getColUpper(); const double * solution = model.getColSolution(); int i; // Hard coded integer tolerance #define INTEGER_TOLERANCE 1.0e-6 ///////// Start of Strong branching code - can be ignored // Number of strong branching candidates #define STRONG_BRANCHING 5 #ifdef STRONG_BRANCHING double upMovement[STRONG_BRANCHING]; double downMovement[STRONG_BRANCHING]; double solutionValue[STRONG_BRANCHING]; int chosen[STRONG_BRANCHING]; int iSmallest=0; // initialize distance from integer for (i=0;i(lower[iColumn]); upper_[i]=static_cast(upper[iColumn]); double value = solution[iColumn]; value = CoinMax(value,static_cast (lower_[i])); value = CoinMin(value,static_cast (upper_[i])); double nearest = floor(value+0.5); if (fabs(value-nearest)>INTEGER_TOLERANCE) numberAway++; if (fabs(value-nearest)>mostAway) { double away = fabs(value-nearest); if (away>upMovement[iSmallest]) { //add to list upMovement[iSmallest]=away; solutionValue[iSmallest]=value; chosen[iSmallest]=i; int j; iSmallest=-1; double smallest = 1.0; for (j=0;j=0) { numberStrong ++; variable_ = chosen[i]; } } // out strong branching if bit set OsiClpSolverInterface* clp = dynamic_cast(&model); if (clp&&(clp->specialOptions()&16)!=0&&numberStrong>1) { int j; int iBest=-1; double best = 0.0; for (j=0;jbest) { best=upMovement[j]; iBest=j; } } numberStrong=1; variable_=chosen[iBest]; } if (numberStrong==1) { // just one - makes it easy int iColumn = integer[variable_]; double value = solution[iColumn]; value = CoinMax(value,static_cast (lower_[variable_])); value = CoinMin(value,static_cast (upper_[variable_])); double nearest = floor(value+0.5); value_=value; if (value<=nearest) way_=1; // up else way_=-1; // down } else if (numberStrong) { // more than one - choose bool chooseOne=true; model.markHotStart(); for (i=0;i=0) { int iColumn = integer[iInt]; double value = solutionValue[i]; // value of variable in original double objectiveChange; value = CoinMax(value,static_cast (lower_[iInt])); value = CoinMin(value,static_cast (upper_[iInt])); // try down model.setColUpper(iColumn,floor(value)); model.solveFromHotStart(); model.setColUpper(iColumn,upper_[iInt]); if (model.isProvenOptimal()&&!model.isDualObjectiveLimitReached()) { objectiveChange = model.getObjSense()*model.getObjValue() - objectiveValue_; } else { objectiveChange = 1.0e100; } assert (objectiveChange>-1.0e-5); objectiveChange = CoinMax(objectiveChange,0.0); downMovement[i]=objectiveChange; // try up model.setColLower(iColumn,ceil(value)); model.solveFromHotStart(); model.setColLower(iColumn,lower_[iInt]); if (model.isProvenOptimal()&&!model.isDualObjectiveLimitReached()) { objectiveChange = model.getObjSense()*model.getObjValue() - objectiveValue_; } else { objectiveChange = 1.0e100; } assert (objectiveChange>-1.0e-5); objectiveChange = CoinMax(objectiveChange,0.0); upMovement[i]=objectiveChange; /* Possibilities are: Both sides feasible - store Neither side feasible - set objective high and exit One side feasible - change bounds and resolve */ bool solveAgain=false; if (upMovement[i]<1.0e100) { if(downMovement[i]<1.0e100) { // feasible - no action } else { // up feasible, down infeasible solveAgain = true; model.setColLower(iColumn,ceil(value)); } } else { if(downMovement[i]<1.0e100) { // down feasible, up infeasible solveAgain = true; model.setColUpper(iColumn,floor(value)); } else { // neither side feasible objectiveValue_=1.0e100; chooseOne=false; break; } } if (solveAgain) { // need to solve problem again - signal this variable_ = numberIntegers; chooseOne=false; break; } } } if (chooseOne) { // choose the one that makes most difference both ways double best = -1.0; double best2 = -1.0; for (i=0;i=0) { //std::cout<<"Strong branching on " // <best) { // smaller is better better=true; } else if (CoinMin(upMovement[i],downMovement[i])>best-1.0e-5) { if (CoinMax(upMovement[i],downMovement[i])>best2+1.0e-5) { // smaller is about same, but larger is better better=true; } } if (better) { best = CoinMin(upMovement[i],downMovement[i]); best2 = CoinMax(upMovement[i],downMovement[i]); variable_ = iInt; double value = solutionValue[i]; value = CoinMax(value,static_cast (lower_[variable_])); value = CoinMin(value,static_cast (upper_[variable_])); value_=value; if (upMovement[i]<=downMovement[i]) way_=1; // up else way_=-1; // down } } } } // Delete the snapshot model.unmarkHotStart(); } ////// End of Strong branching #else variable_=-1; // This has hard coded integer tolerance double mostAway=INTEGER_TOLERANCE; int numberAway=0; for (i=0;i(lower[iColumn]); upper_[i]=static_cast(upper[iColumn]); double value = solution[iColumn]; value = CoinMax(value,(double) lower_[i]); value = CoinMin(value,(double) upper_[i]); double nearest = floor(value+0.5); if (fabs(value-nearest)>INTEGER_TOLERANCE) numberAway++; if (fabs(value-nearest)>mostAway) { mostAway=fabs(value-nearest); variable_=i; value_=value; if (value<=nearest) way_=1; // up else way_=-1; // down } } #endif } OsiNodeSimple::OsiNodeSimple(const OsiNodeSimple & rhs) { if (rhs.basis_) basis_=rhs.basis_->clone(); else basis_ = NULL; objectiveValue_=rhs.objectiveValue_; variable_=rhs.variable_; way_=rhs.way_; numberIntegers_=rhs.numberIntegers_; value_=rhs.value_; descendants_ = rhs.descendants_; parent_ = rhs.parent_; previous_ = rhs.previous_; next_ = rhs.next_; lower_=NULL; upper_=NULL; if (rhs.lower_!=NULL) { lower_ = new int [numberIntegers_]; upper_ = new int [numberIntegers_]; assert (upper_!=NULL); CoinMemcpyN(rhs.lower_,numberIntegers_,lower_); CoinMemcpyN(rhs.upper_,numberIntegers_,upper_); } } OsiNodeSimple & OsiNodeSimple::operator=(const OsiNodeSimple & rhs) { if (this != &rhs) { gutsOfDestructor(); if (rhs.basis_) basis_=rhs.basis_->clone(); objectiveValue_=rhs.objectiveValue_; variable_=rhs.variable_; way_=rhs.way_; numberIntegers_=rhs.numberIntegers_; value_=rhs.value_; descendants_ = rhs.descendants_; parent_ = rhs.parent_; previous_ = rhs.previous_; next_ = rhs.next_; if (rhs.lower_!=NULL) { lower_ = new int [numberIntegers_]; upper_ = new int [numberIntegers_]; assert (upper_!=NULL); CoinMemcpyN(rhs.lower_,numberIntegers_,lower_); CoinMemcpyN(rhs.upper_,numberIntegers_,upper_); } } return *this; } OsiNodeSimple::~OsiNodeSimple () { gutsOfDestructor(); } // Work of destructor void OsiNodeSimple::gutsOfDestructor() { delete [] lower_; delete [] upper_; delete basis_; lower_ = NULL; upper_ = NULL; basis_ = NULL; objectiveValue_ = COIN_DBL_MAX; } // Extension - true if other extension of this bool OsiNodeSimple::extension(const OsiNodeSimple & other, const double * originalLower, const double * originalUpper) const { bool ok=true; for (int i=0;ioriginalLower[i]) { if (other.upper_[i]>upper_[i]|| other.lower_[i] #define FUNNY_BRANCHING 1 #define FUNNY_TREE #ifndef FUNNY_TREE // Vector of OsiNodeSimples typedef std::vector OsiVectorNode; #else // Must code up by hand class OsiVectorNode { public: // Default Constructor OsiVectorNode (); // Copy constructor OsiVectorNode ( const OsiVectorNode &); // Assignment operator OsiVectorNode & operator=( const OsiVectorNode& rhs); // Destructor ~OsiVectorNode (); // Size inline int size() const { return size_-sizeDeferred_;} // Push void push_back(const OsiNodeSimple & node); // Last one in (or other criterion) OsiNodeSimple back() const; // Get rid of last one void pop_back(); // Works out best one int best() const; // Public data // Maximum size int maximumSize_; // Current size int size_; // Number still hanging around int sizeDeferred_; // First spare int firstSpare_; // First int first_; // Last int last_; // Chosen one mutable int chosen_; // Nodes OsiNodeSimple * nodes_; }; OsiVectorNode::OsiVectorNode() : maximumSize_(10), size_(0), sizeDeferred_(0), firstSpare_(0), first_(-1), last_(-1) { nodes_ = new OsiNodeSimple[maximumSize_]; for (int i=0;i=0) { assert (nodes_[last_].next_==-1); nodes_[last_].next_=firstSpare_; } nodes_[firstSpare_].previous_=last_; nodes_[firstSpare_].next_=-1; if (last_==-1) { assert (first_==-1); first_ = firstSpare_; } last_=firstSpare_; if (next>=0&&next=0); } #endif } return chosen_; } // Last one in (or other criterion) OsiNodeSimple OsiVectorNode::back() const { assert (last_>=0); return nodes_[best()]; } // Get rid of last one void OsiVectorNode::pop_back() { // Temporary until more sophisticated //assert (last_==chosen_); if (nodes_[chosen_].descendants_==2) sizeDeferred_--; int previous = nodes_[chosen_].previous_; int next = nodes_[chosen_].next_; nodes_[chosen_].gutsOfDestructor(); if (previous>=0) { nodes_[previous].next_=next; } else { first_ = next; } if (next>=0) { nodes_[next].previous_ = previous; } else { last_ = previous; } nodes_[chosen_].previous_=-1; if (firstSpare_>=0) { nodes_[chosen_].next_ = firstSpare_; } else { nodes_[chosen_].next_ = -1; } firstSpare_ = chosen_; chosen_ = -1; assert (size_>0); size_--; } #endif // Invoke solver's built-in enumeration algorithm void OsiClpSolverInterface::branchAndBound() { double time1 = CoinCpuTime(); // solve LP initialSolve(); int funnyBranching=FUNNY_BRANCHING; if (isProvenOptimal()&&!isDualObjectiveLimitReached()) { // Continuous is feasible - find integers int numberIntegers=0; int numberColumns = getNumCols(); int iColumn; int i; for (iColumn=0;iColumn (lower[iColumn]); if (upper[iColumn]>1.0e9) { // This is not meant to be a bulletproof code setColUpper(iColumn,1.0e9); } originalUpper[numberIntegers]=static_cast (upper[iColumn]); which[numberIntegers++]=iColumn; } } } double direction = getObjSense(); // empty tree OsiVectorNode branchingTree; // Add continuous to it; OsiNodeSimple rootNode(*this,numberIntegers,which,getWarmStart()); // something extra may have been fixed by strong branching // if so go round again while (rootNode.variable_==numberIntegers) { resolve(); rootNode = OsiNodeSimple(*this,numberIntegers,which,getWarmStart()); } if (rootNode.objectiveValue_<1.0e100) { // push on stack branchingTree.push_back(rootNode); } // For printing totals int numberIterations=0; int numberNodes =0; int nRedundantUp=0; int nRedundantDown=0; int nRedundantUp2=0; int nRedundantDown2=0; OsiNodeSimple bestNode; ////// Start main while of branch and bound // while until nothing on stack while (branchingTree.size()) { // last node OsiNodeSimple node = branchingTree.back(); int kNode = branchingTree.chosen_; branchingTree.pop_back(); assert (node.descendants_<2); numberNodes++; if (node.variable_>=0) { // branch - do bounds for (i=0;i(ws); assert (wsb!=NULL); // make sure not volume numberIterations += getIterationCount(); // fix on reduced costs int nFixed0=0,nFixed1=0; double cutoff; getDblParam(OsiDualObjectiveLimit,cutoff); double gap=(cutoff-modelPtr_->objectiveValue())*direction+1.0e-4; if (gap<1.0e10&&isProvenOptimal()&&!isDualObjectiveLimitReached()) { const double * dj = getReducedCost(); const double * lower = getColLower(); const double * upper = getColUpper(); for (i=0;ilower[iColumn]) { double djValue = dj[iColumn]*direction; if (wsb->getStructStatus(iColumn)==CoinWarmStartBasis::atLowerBound&& djValue>gap) { nFixed0++; setColUpper(iColumn,lower[iColumn]); } else if (wsb->getStructStatus(iColumn)==CoinWarmStartBasis::atUpperBound&& -djValue>gap) { nFixed1++; setColLower(iColumn,upper[iColumn]); } } } //if (nFixed0+nFixed1) //printf("%d fixed to lower, %d fixed to upper\n",nFixed0,nFixed1); } if (!isIterationLimitReached()) { if (isProvenOptimal()&&!isDualObjectiveLimitReached()) { #if FUNNY_BRANCHING // See if branched variable off bounds const double * dj = getReducedCost(); const double * lower = getColLower(); const double * upper = getColUpper(); const double * solution = getColSolution(); // Better to use "natural" value - need flag to say fixed for (i=0;i1.0e-6) { // wants to go down if (lower[iColumn]>originalLower[i]) { // Lower bound active relaxedLower[i]=static_cast (lower[iColumn]); } if (upper[iColumn]originalLower[i]) { // Lower bound NOT active } if (upper[iColumn] (upper[iColumn]); } } } // See if can do anything if (1) { /* If kNode is on second branch then a) If other feasible could free up as well b) If other infeasible could do something clever. For now - we have to give up */ int jNode=branchingTree.nodes_[kNode].parent_; bool canDelete = (branchingTree.nodes_[kNode].descendants_<2); while (jNode>=0) { OsiNodeSimple & node = branchingTree.nodes_[jNode]; int next = node.parent_; if (node.descendants_<2) { int variable = node.variable_; iColumn=which[variable]; double value = node.value_; double djValue = dj[iColumn]*direction; assert (node.way_==2||node.way_==-2); // we don't know which branch it was - look at current bounds if (upper[iColumn]upper[iColumn]) { // must have been down branch if (djValue>1.0e-3||solution[iColumn]=0) { OsiNodeSimple & node2 = branchingTree.nodes_[next]; newUpper = node2.upper_[variable]; } if (branchingTree.nodes_[jNode].parent_!=next) assert (newUpper>upper[iColumn]); setColUpper(iColumn,newUpper); int kNode2=next; int jNode2=branchingTree.nodes_[kNode].parent_; assert (newUpper>branchingTree.nodes_[kNode].upper_[variable]); branchingTree.nodes_[kNode].upper_[variable]= newUpper; while (jNode2!=kNode2) { OsiNodeSimple & node2 = branchingTree.nodes_[jNode2]; int next = node2.parent_; if (next!=kNode2) assert (newUpper>node2.upper_[variable]); node2.upper_[variable]= newUpper; jNode2=next; } } else { // can't delete but can add other way to jNode nRedundantDown2++; OsiNodeSimple & node2 = branchingTree.nodes_[kNode]; assert (node2.way_==2||node2.way_==-2); double value2 = node2.value_; int variable2 = node2.variable_; int iColumn2 = which[variable2]; if (variable != variable2) { if (node2.way_==2&&upper[iColumn2] (floor(value2)); assert (newUppervalue2) { // must have been up branch which was done - carry over int newLower = static_cast (ceil(value2)); assert (newLower>node.lower_[variable2]); node.lower_[variable2]=newLower; } if (node.lower_[variable2]>node.upper_[variable2]) { // infeasible node.descendants_=2; // ignore branchingTree.sizeDeferred_++; } } } break; } // we don't know which branch it was - look at current bounds } else if (lower[iColumn]>value&&node.lower_[variable]lower[iColumn]+1.0e-5) { if (canDelete) { nRedundantUp++; #if 1 printf("%d redundant branch up with value %g current lower %g solution %g dj %g\n", variable,node.value_,lower[iColumn],solution[iColumn],djValue); #endif node.descendants_=2; // ignore branchingTree.sizeDeferred_++; int newLower = originalLower[variable]; if (next>=0) { OsiNodeSimple & node2 = branchingTree.nodes_[next]; newLower = node2.lower_[variable]; } if (branchingTree.nodes_[jNode].parent_!=next) assert (newLower (floor(value2)); assert (newUppervalue2) { // must have been up branch which was done - carry over int newLower = static_cast (ceil(value2)); assert (newLower>node.lower_[variable2]); node.lower_[variable2]=newLower; } if (node.lower_[variable2]>node.upper_[variable2]) { // infeasible node.descendants_=2; // ignore branchingTree.sizeDeferred_++; } } } break; } } } else { break; } jNode=next; } } // solve //resolve(); //assert(!getIterationCount()); if ((numberNodes%1000)==0) printf("%d nodes, redundant down %d (%d) up %d (%d) tree size %d best solution %g\n", numberNodes,nRedundantDown,nRedundantDown2,nRedundantUp,nRedundantUp2, branchingTree.size(),bestNode.objectiveValue_); #else if ((numberNodes%1000)==0) printf("%d nodes, tree size %d\n", numberNodes,branchingTree.size()); #endif if (CoinCpuTime()-time1>3600.0) { printf("stopping after 3600 seconds\n"); exit(77); } OsiNodeSimple newNode(*this,numberIntegers,which,ws); // something extra may have been fixed by strong branching // if so go round again while (newNode.variable_==numberIntegers) { resolve(); newNode = OsiNodeSimple(*this,numberIntegers,which,getWarmStart()); } if (newNode.objectiveValue_<1.0e100) { if (newNode.variable_>=0) assert (fabs(newNode.value_-floor(newNode.value_+0.5))>1.0e-6); newNode.parent_ = kNode; // push on stack branchingTree.push_back(newNode); } } else { // infeasible // could use conflict cut code to find redundant delete ws; } } else { // maximum iterations - exit std::cout<<"Exiting on maximum iterations" <setProblemStatus(1); } delete [] which; delete [] originalLower; delete [] originalUpper; delete [] relaxedLower; delete [] relaxedUpper; } else { if(messageHandler()) *messageHandler() <<"The LP relaxation is infeasible" <setProblemStatus(1); //throw CoinError("The LP relaxation is infeasible or too expensive", //"branchAndBound", "OsiClpSolverInterface"); } } void OsiClpSolverInterface::setSpecialOptions(unsigned int value) { #ifdef NO_CRUNCH2 value &= ~1; #endif if ((value&131072)!=0&&(specialOptions_&131072)==0) { // Try and keep scaling factors around delete baseModel_; baseModel_ = new ClpSimplex(*modelPtr_); ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(baseModel_->matrix_); if (!clpMatrix||clpMatrix->scale(baseModel_)) { // switch off again delete baseModel_; baseModel_=NULL; value &= ~131072; } else { // Off current scaling modelPtr_->setRowScale(NULL); modelPtr_->setColumnScale(NULL); lastNumberRows_=baseModel_->numberRows(); rowScale_ = CoinDoubleArrayWithLength(2*lastNumberRows_,0); int i; double * scale; double * inverseScale; scale = rowScale_.array(); inverseScale = scale + lastNumberRows_; const double * rowScale = baseModel_->rowScale_; for (i=0;inumberColumns(); columnScale_ = CoinDoubleArrayWithLength(2*numberColumns,0); scale = columnScale_.array(); inverseScale = scale + numberColumns; const double * columnScale = baseModel_->columnScale_; for (i=0;isetExtraGap(0.0); matrixByRowAtContinuous_->setExtraMajor(0.0); matrixByRowAtContinuous_->reverseOrderedCopyOf(*modelPtr_->matrix()); //continuousModel_->createRim(63); } // Pass in disaster handler void OsiClpSolverInterface::passInDisasterHandler(OsiClpDisasterHandler * handler) { delete disasterHandler_; if ( handler ) disasterHandler_ = dynamic_cast(handler->clone()); else disasterHandler_ = NULL; } /* Strip off rows to get to this number of rows. If solver wants it can restore a copy of "base" (continuous) model here */ void OsiClpSolverInterface::restoreBaseModel(int numberRows) { if (continuousModel_&&continuousModel_->numberRows()==numberRows) { modelPtr_->numberRows_ = numberRows; //ClpDisjointCopyN ( continuousModel_->columnLower_, modelPtr_->numberColumns_,modelPtr_->columnLower_ ); //ClpDisjointCopyN ( continuousModel_->columnUpper_, modelPtr_->numberColumns_,modelPtr_->columnUpper_ ); // Could keep copy of scaledMatrix_ around?? delete modelPtr_->scaledMatrix_; modelPtr_->scaledMatrix_=NULL; if (continuousModel_->rowCopy_) { modelPtr_->copy(continuousModel_->rowCopy_,modelPtr_->rowCopy_); } else { delete modelPtr_->rowCopy_; modelPtr_->rowCopy_=NULL; } modelPtr_->copy(continuousModel_->matrix_,modelPtr_->matrix_); if (matrixByRowAtContinuous_) { if (matrixByRow_) { *matrixByRow_ = *matrixByRowAtContinuous_; } else { //printf("BBBB could new\n"); // matrixByRow_ = new CoinPackedMatrix(*matrixByRowAtContinuous_); } } else { delete matrixByRow_; matrixByRow_=NULL; } } else { OsiSolverInterface::restoreBaseModel(numberRows); } } // Tighten bounds - lightweight int OsiClpSolverInterface::tightenBounds(int lightweight) { #if FUNNY_BRANCHING3>100 return 0; #endif if (!integerInformation_||(specialOptions_&262144)!=0) return 0; // no integers //CoinPackedMatrix matrixByRow(*getMatrixByRow()); int numberRows = getNumRows(); int numberColumns = getNumCols(); int iRow,iColumn; // Row copy //const double * elementByRow = matrixByRow.getElements(); //const int * column = matrixByRow.getIndices(); //const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); //const int * rowLength = matrixByRow.getVectorLengths(); const double * columnUpper = getColUpper(); const double * columnLower = getColLower(); const double * rowUpper = getRowUpper(); const double * rowLower = getRowLower(); // Column copy of matrix const double * element = getMatrixByCol()->getElements(); const int * row = getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = getMatrixByCol()->getVectorStarts(); const int * columnLength = getMatrixByCol()->getVectorLengths(); const double *objective = getObjCoefficients() ; double direction = getObjSense(); double * down = new double [numberRows]; if (lightweight>0) { int * first = new int[numberRows]; CoinZeroN(first,numberRows); CoinZeroN(down,numberRows); double * sum = new double [numberRows]; CoinZeroN(sum,numberRows); int numberTightened=0; for (int iColumn=0;iColumnintegerType_; for (int iRow=0;iRow-1.0e20) lowerRow -= down[iRow]; double upperRow = rowUpper[iRow]; if (upperRow<1.0e20) upperRow -= down[iRow]; double lower = columnLower[iColumn]; double upper = columnUpper[iColumn]; double value=0.0; for (CoinBigIndex j = columnStart[iColumn]; j0.0) { if (lowerRow>-1.0e20) newLower = lowerRow/value; if (upperRow<1.0e20) newUpper = upperRow/value; } else { if (upperRow<1.0e20) newLower = upperRow/value; if (lowerRow>-1.0e20) newUpper = lowerRow/value; } double tolerance2 = 1.0e-6+1.0e-8*sum[iRow]; if (integerInformation&&integerInformation[iColumn]) { if (newLower-floor(newLower)lower+10.0*tolerance2|| newUppernewUpper+tolerance) { //printf("XXYY inf on bound\n"); numberTightened=-1; break; } setColLower(iColumn,newLower); setColUpper(iColumn,CoinMax(newLower,newUpper)); } } } } delete [] first; delete [] down; delete [] sum; return numberTightened; } double * up = new double [numberRows]; double * sum = new double [numberRows]; int * type = new int [numberRows]; CoinZeroN(down,numberRows); CoinZeroN(up,numberRows); CoinZeroN(sum,numberRows); CoinZeroN(type,numberRows); double infinity = getInfinity(); for (iColumn=0;iColumn0.0) { if ((type[iRow]&1)==0) { if (lower!=-infinity) { down[iRow] += value*lower; sum[iRow]+=fabs(value*lower); } else { type[iRow] |= 1; } } if ((type[iRow]&2)==0) { if (upper!=infinity) { up[iRow] += value*upper; sum[iRow]+=fabs(value*upper); } else { type[iRow] |= 2; } } } else { if ((type[iRow]&1)==0) { if (upper!=infinity) { down[iRow] += value*upper; sum[iRow]+=fabs(value*upper); } else { type[iRow] |= 1; } } if ((type[iRow]&2)==0) { if (lower!=-infinity) { up[iRow] += value*lower; sum[iRow]+=fabs(value*lower); } else { type[iRow] |= 2; } } } } } } int nTightened=0; double tolerance = 1.0e-6; for (iRow=0;iRowrowUpper[iRow]) { if (down[iRow]>rowUpper[iRow]+tolerance+1.0e-8*sum[iRow]) { // infeasible #ifdef COIN_DEVELOP printf("infeasible on row %d\n",iRow); #endif nTightened=-1; break; } else { down[iRow]=rowUpper[iRow]; } } if ((type[iRow]&2)!=0) up[iRow]=infinity; if (up[iRow]1.0e8) continue; // Could do severe damage to accuracy if (integerInformation_[iColumn]) { if (lower!=floor(lower+0.5)) { #ifdef COIN_DEVELOP printf("increasing lower bound on %d from %g to %g\n",iColumn, lower,ceil(lower)); #endif lower=ceil(lower); gap=upper-lower; setColLower(iColumn,lower); } if (upper!=floor(upper+0.5)) { #ifdef COIN_DEVELOP printf("decreasing upper bound on %d from %g to %g\n",iColumn, upper,floor(upper)); #endif upper=floor(upper); gap=upper-lower; setColUpper(iColumn,upper); } double newLower=lower; double newUpper=upper; for (CoinBigIndex j=start;j0.0) { if ((type[iRow]&1)==0) { // has to be at most something if (down[iRow] + value*gap > rowUpper[iRow]+tolerance) { double newGap = (rowUpper[iRow]-down[iRow])/value; // adjust newGap += 1.0e-10*sum[iRow]; newGap = floor(newGap); if (lower+newGapnewLower) newLower=upper-newGap; } } if (up[iRow]>rowUpper[iRow]) canGo |=2; // can't go up without affecting result } else { if ((type[iRow]&1)==0) { // has to be at least something if (down[iRow] - value*gap > rowUpper[iRow]+tolerance) { double newGap = -(rowUpper[iRow]-down[iRow])/value; // adjust newGap += 1.0e-10*sum[iRow]; newGap = floor(newGap); if (upper-newGap>newLower) newLower=upper-newGap; } } if (up[iRow]>rowUpper[iRow]) canGo |=1; // can't go down without affecting result if ((type[iRow]&2)==0) { // has to be at most something if (up[iRow] + value*gap < rowLower[iRow]-tolerance) { double newGap = -(up[iRow]-rowLower[iRow])/value; // adjust newGap += 1.0e-10*sum[iRow]; newGap = floor(newGap); if (lower+newGaplower) { nTightened++; if (newLower>newUpper) { // infeasible #if COIN_DEVELOP>1 printf("infeasible on column %d\n",iColumn); #endif nTightened=-1; break; } else { setColLower(iColumn,newLower); setColUpper(iColumn,newUpper); } for (CoinBigIndex j=start;j0.0) { if ((type[iRow]&1)==0) { down[iRow] += value*(newLower-lower); } if ((type[iRow]&2)==0) { up[iRow] += value*(newUpper-upper); } } else { if ((type[iRow]&1)==0) { down[iRow] += value*(newUpper-upper); } if ((type[iRow]&2)==0) { up[iRow] += value*(newLower-lower); } } } } else { if (canGo!=3) { double objValue = direction*objective[iColumn]; if (objValue>=0.0&&(canGo&1)==0) { #if COIN_DEVELOP>2 printf("dual fix down on column %d\n",iColumn); #endif // Only if won't cause numerical problems if (lower>-1.0e10) { nTightened++; setColUpper(iColumn,lower); } } else if (objValue<=0.0&&(canGo&2)==0) { #if COIN_DEVELOP>2 printf("dual fix up on column %d\n",iColumn); #endif // Only if won't cause numerical problems if (upper<1.0e10) { nTightened++; setColLower(iColumn,upper); } } } } } else { // just do dual tests for (CoinBigIndex j=start;j0.0) { if (down[iRow]rowUpper[iRow]) canGo |=2; // can't go up without affecting result } else { if (up[iRow]>rowUpper[iRow]) canGo |=1; // can't go down without affecting result if (down[iRow]=0.0&&(canGo&1)==0) { #if COIN_DEVELOP>2 printf("dual fix down on continuous column %d lower %g\n", iColumn,lower); #endif // Only if won't cause numerical problems if (lower>-1.0e10) { nTightened++; setColUpper(iColumn,lower); } } else if (objValue<=0.0&&(canGo&2)==0) { #if COIN_DEVELOP>2 printf("dual fix up on continuous column %d upper %g\n", iColumn,upper); #endif // Only if won't cause numerical problems if (upper<1.0e10) { nTightened++; setColLower(iColumn,upper); } } } } } if (lightweight<0) { // get max down and up again CoinZeroN(down,numberRows); CoinZeroN(up,numberRows); CoinZeroN(type,numberRows); int * seqDown = new int [2*numberRows]; int * seqUp=seqDown+numberRows; for (int i=0;i0.0) { if ((type[iRow]&1)==0) { if (lower>-1.0e8) { down[iRow] += value*lower; } else if (seqDown[iRow]<0) { seqDown[iRow]=iColumn; } else { type[iRow] |= 1; } } if ((type[iRow]&2)==0) { if (upper<1.0e8) { up[iRow] += value*upper; sum[iRow]+=fabs(value*upper); } else if (seqUp[iRow]<0) { seqUp[iRow]=iColumn; } else { type[iRow] |= 2; } } } else { if ((type[iRow]&1)==0) { if (upper<1.0e8) { down[iRow] += value*upper; sum[iRow]+=fabs(value*upper); } else if (seqDown[iRow]<0) { seqDown[iRow]=iColumn; } else { type[iRow] |= 1; } } if ((type[iRow]&2)==0) { if (lower>-1.0e8) { up[iRow] += value*lower; sum[iRow]+=fabs(value*lower); } else if (seqUp[iRow]<0) { seqUp[iRow]=iColumn; } else { type[iRow] |= 2; } } } } } } for (iColumn=0;iColumn1.0e8) continue; // Could do severe damage to accuracy double newLower=upper; double newUpper=lower; bool badUpper=false; bool badLower=false; double objValue = objective[iColumn]*direction; for (CoinBigIndex j=start;j0.0) { if (rowLower[iRow]>-COIN_DBL_MAX) { if (!badUpper&&(type[iRow]&1)==0&& (seqDown[iRow]<0||seqDown[iRow]==iColumn)) { double s=down[iRow]; if (seqDown[iRow]!=iColumn) s -= lower*value; if (s+newUpper*valuerowUpper[iRow]) { newLower = CoinMin(newLower,(rowUpper[iRow]-s)/value); } } else { badLower=true; } } } else { if (rowUpper[iRow]rowUpper[iRow]) { newUpper = CoinMax(newUpper,(rowUpper[iRow]-s)/value); } } else { badUpper=true; } } if (rowLower[iRow]>-COIN_DBL_MAX) { if (!badLower&&(type[iRow]&1)==0&& (seqDown[iRow]<0||seqDown[iRow]==iColumn)) { double s=down[iRow]; if (seqDown[iRow]!=iColumn) s -= lower*value; if (s+newLower*value0.0) newLower=lower; if (badUpper||objValue<0.0) newUpper=upper; if (newUpperlower) { nTightened++; if (newLower>newUpper) { // infeasible #if COIN_DEVELOP>0 printf("infeasible on column %d\n",iColumn); #endif nTightened=-1; break; } else { newLower=CoinMax(newLower,lower); newUpper=CoinMin(newUpper,upper); if (integerInformation_[iColumn]) { newLower=ceil(newLower-1.0e-5); newUpper=floor(newUpper+1.0e-5); } setColLower(iColumn,newLower); setColUpper(iColumn,newUpper); } } } delete [] seqDown; } delete [] type; delete [] down; delete [] up; delete [] sum; return nTightened; } // See if any integer variables make infeasible other way int OsiClpSolverInterface::infeasibleOtherWay(char * whichWay) { //CoinPackedMatrix matrixByRow(*getMatrixByRow()); int numberRows = getNumRows(); int numberColumns = getNumCols(); int iRow,iColumn; // Row copy //const double * elementByRow = matrixByRow.getElements(); //const int * column = matrixByRow.getIndices(); //const CoinBigIndex * rowStart = matrixByRow.getVectorStarts(); //const int * rowLength = matrixByRow.getVectorLengths(); const double * columnUpper = getColUpper(); const double * columnLower = getColLower(); const double * rowUpper = getRowUpper(); const double * rowLower = getRowLower(); // Column copy of matrix const double * element = getMatrixByCol()->getElements(); const int * row = getMatrixByCol()->getIndices(); const CoinBigIndex * columnStart = getMatrixByCol()->getVectorStarts(); const int * columnLength = getMatrixByCol()->getVectorLengths(); const double *objective = getObjCoefficients() ; double direction = getObjSense(); double tolerance = 1.0e-6; double * down = new double [3*numberRows]; double * up = down + numberRows; double * sum = up + numberRows; int * nLowerInf = new int [2*numberRows]; int * nUpperInf = nLowerInf + numberRows; CoinZeroN(down,numberRows); CoinZeroN(up,numberRows); CoinZeroN(sum,numberRows); for (int i=0;i0.0) { if (lower!=-infinity) { down[iRow] += value*lower; sum[iRow]+=fabs(value*lower); } else if (nLowerInf[iRow]==-1) { nLowerInf[iRow]=iColumn; } else { nLowerInf[iRow]=-2; } if (upper!=infinity) { up[iRow] += value*upper; sum[iRow]+=fabs(value*upper); } else if (nUpperInf[iRow]==-1) { nUpperInf[iRow]=iColumn; } else { nUpperInf[iRow]=-2; } } else { if (upper!=infinity) { down[iRow] += value*upper; sum[iRow]+=fabs(value*upper); } else if (nLowerInf[iRow]==-1) { nLowerInf[iRow]=iColumn; } else { nLowerInf[iRow]=-2; } if (lower!=-infinity) { up[iRow] += value*lower; sum[iRow]+=fabs(value*lower); } else if (nUpperInf[iRow]==-1) { nUpperInf[iRow]=iColumn; } else { nUpperInf[iRow]=-2; } } } } } int nOtherWay=0; for (iColumn=0;iColumn1.0e8) continue; // Could do severe damage to accuracy for (CoinBigIndex j=start;j0.0) { if (nLowerInf[iRow]==-1) thisDown -= value*lower; else if (nLowerInf[iRow]==-2|| (nLowerInf[iRow]!=iColumn)) thisDown = -infinity; if (nUpperInf[iRow]==-1) thisUp -= value*upper; else if (nUpperInf[iRow]==-2|| (nUpperInf[iRow]!=iColumn)) thisUp = infinity; thisDown += newLower*value; thisUp += newUpper*value; } else { if (nLowerInf[iRow]==-1) thisUp -= value*lower; else if (nLowerInf[iRow]==-2|| (nLowerInf[iRow]!=iColumn)) thisUp = infinity; if (nUpperInf[iRow]==-1) thisDown -= value*upper; else if (nUpperInf[iRow]==-2|| (nUpperInf[iRow]!=iColumn)) thisDown = -infinity; thisDown += newUpper*value; thisUp += newLower*value; } if (thisDown>rowUpper[iRow]) { if (thisDown>rowUpper[iRow]+tolerance+1.0e-8*sum[iRow]) { nOtherWay++; whichWay[iColumn] *=2; } } else if (thisUpfactorization_->numberElementsL(); } // Return number of entries in U part of current factorization CoinBigIndex OsiClpSolverInterface::getSizeU() const { return modelPtr_->factorization_->numberElementsU(); } /* Add a named row (constraint) to the problem. */ void OsiClpSolverInterface::addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng, std::string name) { int ndx = getNumRows() ; addRow(vec,rowsen,rowrhs,rowrng) ; setRowName(ndx,name) ; } /* Add a named column (primal variable) to the problem. */ void OsiClpSolverInterface::addCol(int numberElements, const int* rows, const double* elements, const double collb, const double colub, const double obj, std::string name) { int ndx = getNumCols() ; addCol(numberElements,rows,elements,collb,colub,obj) ; setColName(ndx,name) ; } /* Start faster dual - returns negative if problems 1 if infeasible, Options to pass to solver 1 - create external reduced costs for columns 2 - create external reduced costs for rows 4 - create external row activity (columns always done) Above only done if feasible When set resolve does less work */ int OsiClpSolverInterface::startFastDual(int options) { stuff_.zap(3); stuff_.solverOptions_=options; return modelPtr_->startFastDual2(&stuff_); } // Sets integer tolerance and increment void OsiClpSolverInterface::setStuff(double tolerance,double increment) { stuff_.integerTolerance_ = tolerance; stuff_.integerIncrement_ = increment; } // Stops faster dual void OsiClpSolverInterface::stopFastDual() { modelPtr_->stopFastDual2(&stuff_); } // Compute largest amount any at continuous away from bound void OsiClpSolverInterface::computeLargestAway() { // get largest scaled away from bound ClpSimplex temp=*modelPtr_; // save logLevel (in case derived message handler) int saveLogLevel=temp.logLevel(); temp.setLogLevel(0); temp.dual(); if (temp.status()==1) temp.primal(); // may mean we have optimal so continuous cutoff temp.dual(0,7); temp.setLogLevel(saveLogLevel); double largestScaled=1.0e-12; double largest=1.0e-12; int numberRows = temp.numberRows(); const double * rowPrimal = temp.primalRowSolution(); const double * rowLower = temp.rowLower(); const double * rowUpper = temp.rowUpper(); const double * rowScale = temp.rowScale(); int iRow; for (iRow=0;iRow4000) modelPtr_->setSpecialOptions(modelPtr_->specialOptions()&~(2048+4096)); } // Pass in Message handler (not deleted at end) void OsiClpSolverInterface::passInMessageHandler(CoinMessageHandler * handler) { if (defaultHandler_) { delete handler_; handler_ = NULL; } defaultHandler_=false; handler_=handler; if (modelPtr_) modelPtr_->passInMessageHandler(handler); } // Set log level (will also set underlying solver's log level) void OsiClpSolverInterface::setLogLevel(int value) { handler_->setLogLevel(value); if (modelPtr_) modelPtr_->setLogLevel(value); } // Set fake objective (and take ownership) void OsiClpSolverInterface::setFakeObjective(ClpLinearObjective * fakeObjective) { delete fakeObjective_; fakeObjective_ = fakeObjective; } // Set fake objective void OsiClpSolverInterface::setFakeObjective(double * fakeObjective) { delete fakeObjective_; if (fakeObjective) fakeObjective_ = new ClpLinearObjective(fakeObjective, modelPtr_->numberColumns_); else fakeObjective_ = NULL; } /* Solve when primal column and dual row solutions are near-optimal options - 0 no presolve (use primal and dual) 1 presolve (just use primal) 2 no presolve (just use primal) basis - 0 use all slack basis 1 try and put some in basis */ void OsiClpSolverInterface::crossover(int options,int basis) { int numberRows = modelPtr_->getNumRows(); int numberColumns = modelPtr_->getNumCols(); // Get row activities and column reduced costs const double * objective = modelPtr_->objective(); double direction = modelPtr_->optimizationDirection(); double * dual = modelPtr_->dualRowSolution(); double * dj = modelPtr_->dualColumnSolution(); CoinMemcpyN(objective,numberColumns,dj); if (direction==-1.0) { for (int i=0;iclpMatrix()->transposeTimes(-1.0,dual,dj); double * rowActivity = modelPtr_->primalRowSolution(); double * columnActivity = modelPtr_->primalColumnSolution(); CoinZeroN(rowActivity,numberRows); modelPtr_->clpMatrix()->times(1.0,columnActivity,rowActivity); modelPtr_->checkSolution(); printf("%d primal infeasibilities summing to %g\n", modelPtr_->numberPrimalInfeasibilities(), modelPtr_->sumPrimalInfeasibilities()); printf("%d dual infeasibilities summing to %g\n", modelPtr_->numberDualInfeasibilities(), modelPtr_->sumDualInfeasibilities()); // get which variables are fixed double * saveLower=NULL; double * saveUpper=NULL; ClpPresolve pinfo2; bool extraPresolve=false; bool useBoth= (options==0); // create all slack basis modelPtr_->createStatus(); // Point to model - so can use in presolved model ClpSimplex * model2 = modelPtr_; double tolerance = modelPtr_->primalTolerance()*10.0; if (options==1) { int numberTotal = numberRows+numberColumns; saveLower = new double [numberTotal]; saveUpper = new double [numberTotal]; CoinMemcpyN(modelPtr_->columnLower(),numberColumns,saveLower); CoinMemcpyN(modelPtr_->rowLower(),numberRows,saveLower+numberColumns); CoinMemcpyN(modelPtr_->columnUpper(),numberColumns,saveUpper); CoinMemcpyN(modelPtr_->rowUpper(),numberRows,saveUpper+numberColumns); double * lower = modelPtr_->columnLower(); double * upper = modelPtr_->columnUpper(); double * solution = modelPtr_->primalColumnSolution(); int nFix=0; for (int i=0;i-1.0e10||upper[i]<1.0e10)) { double value = solution[i]; if (valueupper[i]-tolerance&&value-lower[i]>upper[i]-value) { solution[i]=upper[i]; lower[i]=upper[i]; nFix++; } } } #ifdef CLP_INVESTIGATE printf("%d columns fixed\n",nFix); #endif #if 0 int nr=modelPtr_->numberRows(); lower = modelPtr_->rowLower(); upper = modelPtr_->rowUpper(); solution = modelPtr_->primalRowSolution(); nFix=0; for (int i=0;iupper[i]-tolerance&&value-lower[i]>upper[i]-value) { solution[i]=upper[i]; lower[i]=upper[i]; nFix++; } } } #ifdef CLP_INVESTIGATE printf("%d row slacks fixed\n",nFix); #endif #endif extraPresolve=true; // do presolve model2 = pinfo2.presolvedModel(*modelPtr_,modelPtr_->presolveTolerance(), false,5,true); if (!model2) { model2=modelPtr_; CoinMemcpyN(saveLower,numberColumns,model2->columnLower()); CoinMemcpyN(saveLower+numberColumns,numberRows,model2->rowLower()); delete [] saveLower; CoinMemcpyN(saveUpper,numberColumns,model2->columnUpper()); CoinMemcpyN(saveUpper+numberColumns,numberRows,model2->rowUpper()); delete [] saveUpper; saveLower=NULL; saveUpper=NULL; extraPresolve=false; } } if (model2->factorizationFrequency()==200) { // User did not touch preset model2->defaultFactorizationFrequency(); } if (basis) { // throw some into basis int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); double * dsort = new double[numberColumns]; int * sort = new int[numberColumns]; int n=0; const double * columnLower = model2->columnLower(); const double * columnUpper = model2->columnUpper(); double * primalSolution = model2->primalColumnSolution(); const double * dualSolution = model2->dualColumnSolution(); int i; for ( i=0;isetRowStatus(i,ClpSimplex::superBasic); for ( i=0;itolerance) { if (fabs(dualSolution[i])<1.0e-5) distance *= 100.0; dsort[n]=-distance; sort[n++]=i; model2->setStatus(i,ClpSimplex::superBasic); } else if (distance>tolerance) { model2->setStatus(i,ClpSimplex::superBasic); } else if (primalSolution[i]<=columnLower[i]+tolerance) { model2->setStatus(i,ClpSimplex::atLowerBound); primalSolution[i]=columnLower[i]; } else { model2->setStatus(i,ClpSimplex::atUpperBound); primalSolution[i]=columnUpper[i]; } } CoinSort_2(dsort,dsort+n,sort); n = CoinMin(numberRows,n); for ( i=0;isetStatus(iColumn,ClpSimplex::basic); } delete [] sort; delete [] dsort; } // Start crossover if (useBoth) { int numberRows = model2->numberRows(); int numberColumns = model2->numberColumns(); double * rowPrimal = new double [numberRows]; double * columnPrimal = new double [numberColumns]; double * rowDual = new double [numberRows]; double * columnDual = new double [numberColumns]; // move solutions CoinMemcpyN(model2->primalRowSolution(), numberRows,rowPrimal); CoinMemcpyN(model2->dualRowSolution(), numberRows,rowDual); CoinMemcpyN(model2->primalColumnSolution(), numberColumns,columnPrimal); CoinMemcpyN(model2->dualColumnSolution(), numberColumns,columnDual); // primal values pass double saveScale = model2->objectiveScale(); model2->setObjectiveScale(1.0e-3); model2->primal(2); model2->setObjectiveScale(saveScale); // save primal solution and copy back dual CoinMemcpyN(model2->primalRowSolution(), numberRows,rowPrimal); CoinMemcpyN(rowDual, numberRows,model2->dualRowSolution()); CoinMemcpyN(model2->primalColumnSolution(), numberColumns,columnPrimal); CoinMemcpyN(columnDual, numberColumns,model2->dualColumnSolution()); // clean up reduced costs and flag variables double * dj = model2->dualColumnSolution(); double * cost = model2->objective(); double * saveCost = new double[numberColumns]; CoinMemcpyN(cost,numberColumns,saveCost); double * saveLower = new double[numberColumns]; double * lower = model2->columnLower(); CoinMemcpyN(lower,numberColumns,saveLower); double * saveUpper = new double[numberColumns]; double * upper = model2->columnUpper(); CoinMemcpyN(upper,numberColumns,saveUpper); int i; for ( i=0;igetStatus(i)==ClpSimplex::basic) { dj[i]=0.0; } else if (model2->getStatus(i)==ClpSimplex::atLowerBound) { if (direction*dj[i]getStatus(i)==ClpSimplex::atUpperBound) { if (direction*dj[i]>tolerance) { if (direction*dj[i]>0.0) { //if (dj[i]>1.0e-3) //printf("bad dj at ub %d %g\n",i,dj[i]); cost[i] -= dj[i]; dj[i]=0.0; } } else { lower[i]=upper[i]; } } } // just dual values pass model2->dual(2); CoinMemcpyN(saveCost,numberColumns,cost); delete [] saveCost; CoinMemcpyN(saveLower,numberColumns,lower); delete [] saveLower; CoinMemcpyN(saveUpper,numberColumns,upper); delete [] saveUpper; // move solutions CoinMemcpyN(rowPrimal, numberRows,model2->primalRowSolution()); CoinMemcpyN(columnPrimal, numberColumns,model2->primalColumnSolution()); // and finish delete [] rowPrimal; delete [] columnPrimal; delete [] rowDual; delete [] columnDual; model2->setObjectiveScale(1.0e-3); model2->primal(2); model2->setObjectiveScale(saveScale); model2->primal(1); } else { // primal values pass double saveScale = model2->objectiveScale(); model2->setObjectiveScale(1.0e-3); model2->primal(2); model2->setObjectiveScale(saveScale); model2->primal(1); } if (extraPresolve) { pinfo2.postsolve(true); delete model2; modelPtr_->primal(1); CoinMemcpyN(saveLower,numberColumns,modelPtr_->columnLower()); CoinMemcpyN(saveLower+numberColumns,numberRows,modelPtr_->rowLower()); CoinMemcpyN(saveUpper,numberColumns,modelPtr_->columnUpper()); CoinMemcpyN(saveUpper+numberColumns,numberRows,modelPtr_->rowUpper()); delete [] saveLower; delete [] saveUpper; modelPtr_->primal(1); } // Save basis in Osi object setWarmStart(NULL); } //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- OsiClpDisasterHandler::OsiClpDisasterHandler (OsiClpSolverInterface * model) : ClpDisasterHandler(), osiModel_(model), whereFrom_(0), phase_(0), inTrouble_(false) { if (model) setSimplex(model->getModelPtr()); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- OsiClpDisasterHandler::OsiClpDisasterHandler (const OsiClpDisasterHandler & rhs) : ClpDisasterHandler(rhs), osiModel_(rhs.osiModel_), whereFrom_(rhs.whereFrom_), phase_(rhs.phase_), inTrouble_(rhs.inTrouble_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- OsiClpDisasterHandler::~OsiClpDisasterHandler () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- OsiClpDisasterHandler & OsiClpDisasterHandler::operator=(const OsiClpDisasterHandler& rhs) { if (this != &rhs) { ClpDisasterHandler::operator=(rhs); osiModel_ = rhs.osiModel_; whereFrom_ = rhs.whereFrom_; phase_ = rhs.phase_; inTrouble_ = rhs.inTrouble_; } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpDisasterHandler * OsiClpDisasterHandler::clone() const { return new OsiClpDisasterHandler(*this); } void OsiClpDisasterHandler::intoSimplex() { inTrouble_=false; } bool OsiClpDisasterHandler::check() const { // Exit if really large number of iterations if (model_->numberIterations()> model_->baseIteration()+100000+100*(model_->numberRows()+model_->numberColumns())) return true; if ((whereFrom_&2)==0||!model_->nonLinearCost()) { // dual if (model_->numberIterations()baseIteration()+model_->numberRows()+1000) { return false; } else if (phase_<2) { if (model_->numberIterations()> model_->baseIteration()+2*model_->numberRows()+model_->numberColumns()+100000|| model_->largestDualError()>=1.0e-1) { // had model_->numberDualInfeasibilitiesWithoutFree()|| #ifdef COIN_DEVELOP printf("trouble in phase %d\n",phase_); #endif if (osiModel_->largestAway()>0.0) { // go for safety model_->setSpecialOptions(model_->specialOptions()&~(2048+4096)); int frequency = model_->factorizationFrequency(); if (frequency>100) frequency=100; model_->setFactorizationFrequency(frequency); double oldBound = model_->dualBound(); double newBound = CoinMax(1.0001e8, CoinMin(10.0*osiModel_->largestAway(),1.e10)); if (newBound!=oldBound) { model_->setDualBound(newBound); if (model_->upperRegion()&&model_->algorithm()<0) { // need to fix up fake bounds (static_cast(model_))->resetFakeBounds(0); } } osiModel_->setLargestAway(-1.0); } return true; } else { return false; } } else { assert (phase_==2); if (model_->numberIterations()> model_->baseIteration()+3*model_->numberRows()+model_->numberColumns()+100000|| model_->largestPrimalError()>=1.0e3) { #ifdef COIN_DEVELOP printf("trouble in phase %d\n",phase_); #endif return true; } else { return false; } } } else { // primal if (model_->numberIterations()baseIteration()+2*model_->numberRows()+model_->numberColumns()+100000) { return false; } else if (phase_<2) { if (model_->numberIterations()> model_->baseIteration()+3*model_->numberRows()+20000+ model_->numberColumns()&& model_->numberDualInfeasibilitiesWithoutFree()>0&& model_->numberPrimalInfeasibilities()>0&& model_->nonLinearCost()->changeInCost()>1.0e8) { #ifdef COIN_DEVELOP printf("trouble in phase %d\n",phase_); #endif return true; } else { return false; } } else { assert (phase_==2); if (model_->numberIterations()> model_->baseIteration()+3*model_->numberRows()+20000|| model_->largestPrimalError()>=1.0e3) { #ifdef COIN_DEVELOP printf("trouble in phase %d\n",phase_); #endif return true; } else { return false; } } } } void OsiClpDisasterHandler::saveInfo() { inTrouble_=true; } // are we in trouble bool OsiClpDisasterHandler::inTrouble() const { return inTrouble_|(osiModel_->getModelPtr()->problemStatus()==4); } // Type of disaster 0 can fix, 1 abort int OsiClpDisasterHandler::typeOfDisaster() { return 0; } /* set model. */ void OsiClpDisasterHandler::setOsiModel(OsiClpSolverInterface * model) { osiModel_=model; model_=model->getModelPtr(); } // Create C++ lines to get to current state void OsiClpSolverInterface::generateCpp( FILE * fp) { modelPtr_->generateCpp(fp,true); // Stuff that can't be done easily // setupForRepeatedUse here if (!messageHandler()->prefix()) fprintf(fp,"3 clpModel->messageHandler()->setPrefix(false);\n"); OsiClpSolverInterface defaultModel; OsiClpSolverInterface * other = &defaultModel; int iValue1, iValue2; double dValue1, dValue2; bool takeHint1,takeHint2; int add; OsiHintStrength strength1,strength2; std::string strengthName[] = {"OsiHintIgnore","OsiHintTry","OsiHintDo", "OsiForceDo"}; iValue1 = this->specialOptions(); iValue2 = other->specialOptions(); fprintf(fp,"%d int save_specialOptions = osiclpModel->specialOptions();\n",iValue1==iValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->setSpecialOptions(%d);\n",iValue1==iValue2 ? 4 : 3,iValue1); fprintf(fp,"%d osiclpModel->setSpecialOptions(save_specialOptions);\n",iValue1==iValue2 ? 7 : 6); iValue1 = this->messageHandler()->logLevel(); iValue2 = other->messageHandler()->logLevel(); fprintf(fp,"%d int save_messageHandler = osiclpModel->messageHandler()->logLevel();\n",iValue1==iValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->messageHandler()->setLogLevel(%d);\n",iValue1==iValue2 ? 4 : 3,iValue1); fprintf(fp,"%d osiclpModel->messageHandler()->setLogLevel(save_messageHandler);\n",iValue1==iValue2 ? 7 : 6); iValue1 = this->cleanupScaling(); iValue2 = other->cleanupScaling(); fprintf(fp,"%d int save_cleanupScaling = osiclpModel->cleanupScaling();\n",iValue1==iValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->setCleanupScaling(%d);\n",iValue1==iValue2 ? 4 : 3,iValue1); fprintf(fp,"%d osiclpModel->setCleanupScaling(save_cleanupScaling);\n",iValue1==iValue2 ? 7 : 6); dValue1 = this->smallestElementInCut(); dValue2 = other->smallestElementInCut(); fprintf(fp,"%d double save_smallestElementInCut = osiclpModel->smallestElementInCut();\n",dValue1==dValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->setSmallestElementInCut(%g);\n",dValue1==dValue2 ? 4 : 3,dValue1); fprintf(fp,"%d osiclpModel->setSmallestElementInCut(save_smallestElementInCut);\n",dValue1==dValue2 ? 7 : 6); dValue1 = this->smallestChangeInCut(); dValue2 = other->smallestChangeInCut(); fprintf(fp,"%d double save_smallestChangeInCut = osiclpModel->smallestChangeInCut();\n",dValue1==dValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->setSmallestChangeInCut(%g);\n",dValue1==dValue2 ? 4 : 3,dValue1); fprintf(fp,"%d osiclpModel->setSmallestChangeInCut(save_smallestChangeInCut);\n",dValue1==dValue2 ? 7 : 6); this->getIntParam(OsiMaxNumIterationHotStart,iValue1); other->getIntParam(OsiMaxNumIterationHotStart,iValue2); fprintf(fp,"%d int save_OsiMaxNumIterationHotStart;\n",iValue1==iValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->getIntParam(OsiMaxNumIterationHotStart,save_OsiMaxNumIterationHotStart);\n",iValue1==iValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->setIntParam(OsiMaxNumIterationHotStart,%d);\n",iValue1==iValue2 ? 4 : 3,iValue1); fprintf(fp,"%d osiclpModel->setIntParam(OsiMaxNumIterationHotStart,save_OsiMaxNumIterationHotStart);\n",iValue1==iValue2 ? 7 : 6); this->getDblParam(OsiDualObjectiveLimit,dValue1); other->getDblParam(OsiDualObjectiveLimit,dValue2); fprintf(fp,"%d double save_OsiDualObjectiveLimit;\n",dValue1==dValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->getDblParam(OsiDualObjectiveLimit,save_OsiDualObjectiveLimit);\n",dValue1==dValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->setDblParam(OsiDualObjectiveLimit,%g);\n",dValue1==dValue2 ? 4 : 3,dValue1); fprintf(fp,"%d osiclpModel->setDblParam(OsiDualObjectiveLimit,save_OsiDualObjectiveLimit);\n",dValue1==dValue2 ? 7 : 6); this->getDblParam(OsiPrimalObjectiveLimit,dValue1); other->getDblParam(OsiPrimalObjectiveLimit,dValue2); fprintf(fp,"%d double save_OsiPrimalObjectiveLimit;\n",dValue1==dValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->getDblParam(OsiPrimalObjectiveLimit,save_OsiPrimalObjectiveLimit);\n",dValue1==dValue2 ? 2 : 1); fprintf(fp,"%d osiclpModel->setDblParam(OsiPrimalObjectiveLimit,%g);\n",dValue1==dValue2 ? 4 : 3,dValue1); fprintf(fp,"%d osiclpModel->setDblParam(OsiPrimalObjectiveLimit,save_OsiPrimalObjectiveLimit);\n",dValue1==dValue2 ? 7 : 6); this->getHintParam(OsiDoPresolveInInitial,takeHint1,strength1); other->getHintParam(OsiDoPresolveInInitial,takeHint2,strength2); add = ((takeHint1==takeHint2)&&(strength1==strength2)) ? 1 : 0; fprintf(fp,"%d bool saveHint_OsiDoPresolveInInitial;\n",add+1); fprintf(fp,"%d OsiHintStrength saveStrength_OsiDoPresolveInInitial;\n",add+1); fprintf(fp,"%d osiclpModel->getHintParam(OsiDoPresolveInInitial,saveHint_OsiDoPresolveInInitial,saveStrength_OsiDoPresolveInInitial);\n",add+1); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoPresolveInInitial,%s,%s);\n",add+3,takeHint1 ? "true" : "false",strengthName[strength1].c_str()); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoPresolveInInitial,saveHint_OsiDoPresolveInInitial,saveStrength_OsiDoPresolveInInitial);\n",add+6); this->getHintParam(OsiDoDualInInitial,takeHint1,strength1); other->getHintParam(OsiDoDualInInitial,takeHint2,strength2); add = ((takeHint1==takeHint2)&&(strength1==strength2)) ? 1 : 0; fprintf(fp,"%d bool saveHint_OsiDoDualInInitial;\n",add+1); fprintf(fp,"%d OsiHintStrength saveStrength_OsiDoDualInInitial;\n",add+1); fprintf(fp,"%d osiclpModel->getHintParam(OsiDoDualInInitial,saveHint_OsiDoDualInInitial,saveStrength_OsiDoDualInInitial);\n",add+1); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoDualInInitial,%s,%s);\n",add+3,takeHint1 ? "true" : "false",strengthName[strength1].c_str()); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoDualInInitial,saveHint_OsiDoDualInInitial,saveStrength_OsiDoDualInInitial);\n",add+6); this->getHintParam(OsiDoPresolveInResolve,takeHint1,strength1); other->getHintParam(OsiDoPresolveInResolve,takeHint2,strength2); add = ((takeHint1==takeHint2)&&(strength1==strength2)) ? 1 : 0; fprintf(fp,"%d bool saveHint_OsiDoPresolveInResolve;\n",add+1); fprintf(fp,"%d OsiHintStrength saveStrength_OsiDoPresolveInResolve;\n",add+1); fprintf(fp,"%d osiclpModel->getHintParam(OsiDoPresolveInResolve,saveHint_OsiDoPresolveInResolve,saveStrength_OsiDoPresolveInResolve);\n",add+1); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoPresolveInResolve,%s,%s);\n",add+3,takeHint1 ? "true" : "false",strengthName[strength1].c_str()); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoPresolveInResolve,saveHint_OsiDoPresolveInResolve,saveStrength_OsiDoPresolveInResolve);\n",add+6); this->getHintParam(OsiDoDualInResolve,takeHint1,strength1); other->getHintParam(OsiDoDualInResolve,takeHint2,strength2); add = ((takeHint1==takeHint2)&&(strength1==strength2)) ? 1 : 0; fprintf(fp,"%d bool saveHint_OsiDoDualInResolve;\n",add+1); fprintf(fp,"%d OsiHintStrength saveStrength_OsiDoDualInResolve;\n",add+1); fprintf(fp,"%d osiclpModel->getHintParam(OsiDoDualInResolve,saveHint_OsiDoDualInResolve,saveStrength_OsiDoDualInResolve);\n",add+1); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoDualInResolve,%s,%s);\n",add+3,takeHint1 ? "true" : "false",strengthName[strength1].c_str()); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoDualInResolve,saveHint_OsiDoDualInResolve,saveStrength_OsiDoDualInResolve);\n",add+6); this->getHintParam(OsiDoScale,takeHint1,strength1); other->getHintParam(OsiDoScale,takeHint2,strength2); add = ((takeHint1==takeHint2)&&(strength1==strength2)) ? 1 : 0; fprintf(fp,"%d bool saveHint_OsiDoScale;\n",add+1); fprintf(fp,"%d OsiHintStrength saveStrength_OsiDoScale;\n",add+1); fprintf(fp,"%d osiclpModel->getHintParam(OsiDoScale,saveHint_OsiDoScale,saveStrength_OsiDoScale);\n",add+1); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoScale,%s,%s);\n",add+3,takeHint1 ? "true" : "false",strengthName[strength1].c_str()); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoScale,saveHint_OsiDoScale,saveStrength_OsiDoScale);\n",add+6); this->getHintParam(OsiDoCrash,takeHint1,strength1); other->getHintParam(OsiDoCrash,takeHint2,strength2); add = ((takeHint1==takeHint2)&&(strength1==strength2)) ? 1 : 0; fprintf(fp,"%d bool saveHint_OsiDoCrash;\n",add+1); fprintf(fp,"%d OsiHintStrength saveStrength_OsiDoCrash;\n",add+1); fprintf(fp,"%d osiclpModel->getHintParam(OsiDoCrash,saveHint_OsiDoCrash,saveStrength_OsiDoCrash);\n",add+1); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoCrash,%s,%s);\n",add+3,takeHint1 ? "true" : "false",strengthName[strength1].c_str()); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoCrash,saveHint_OsiDoCrash,saveStrength_OsiDoCrash);\n",add+6); this->getHintParam(OsiDoReducePrint,takeHint1,strength1); other->getHintParam(OsiDoReducePrint,takeHint2,strength2); add = ((takeHint1==takeHint2)&&(strength1==strength2)) ? 1 : 0; fprintf(fp,"%d bool saveHint_OsiDoReducePrint;\n",add+1); fprintf(fp,"%d OsiHintStrength saveStrength_OsiDoReducePrint;\n",add+1); fprintf(fp,"%d osiclpModel->getHintParam(OsiDoReducePrint,saveHint_OsiDoReducePrint,saveStrength_OsiDoReducePrint);\n",add+1); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoReducePrint,%s,%s);\n",add+3,takeHint1 ? "true" : "false",strengthName[strength1].c_str()); fprintf(fp,"%d osiclpModel->setHintParam(OsiDoReducePrint,saveHint_OsiDoReducePrint,saveStrength_OsiDoReducePrint);\n",add+6); } // So unit test can find out if NDEBUG set bool OsiClpHasNDEBUG() { #ifdef NDEBUG return true; #else return false; #endif } CoinMP-1.8.3/Clp/src/OsiClp/osi-clp.pc.in0000644000175000017500000000050411510106324016301 0ustar renereneprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/coin Name: OsiClp Description: COIN-OR Open Solver Interface for CLP URL: https://projects.coin-or.org/Osi Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lOsiClp @OSICLPLIB_PCLIBS@ Cflags: -I${includedir} Requires: clp @OSICLPLIB_PCREQUIRES@ CoinMP-1.8.3/Clp/src/OsiClp/OsiClpSolverInterface.hpp0000644000175000017500000016203112432624666020746 0ustar renerene// $Id$ // Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef OsiClpSolverInterface_H #define OsiClpSolverInterface_H #include #include #include #include "ClpSimplex.hpp" #include "ClpLinearObjective.hpp" #include "CoinPackedMatrix.hpp" #include "OsiSolverInterface.hpp" #include "CoinWarmStartBasis.hpp" #include "ClpEventHandler.hpp" #include "ClpNode.hpp" #include "CoinIndexedVector.hpp" #include "CoinFinite.hpp" class OsiRowCut; class OsiClpUserSolver; class OsiClpDisasterHandler; class CoinSet; static const double OsiClpInfinity = COIN_DBL_MAX; //############################################################################# /** Clp Solver Interface Instantiation of OsiClpSolverInterface for the Model Algorithm. */ class OsiClpSolverInterface : virtual public OsiSolverInterface { friend void OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); public: //--------------------------------------------------------------------------- /**@name Solve methods */ //@{ /// Solve initial LP relaxation virtual void initialSolve(); /// Resolve an LP relaxation after problem modification virtual void resolve(); /// Resolve an LP relaxation after problem modification (try GUB) virtual void resolveGub(int needed); /// Invoke solver's built-in enumeration algorithm virtual void branchAndBound(); /** Solve when primal column and dual row solutions are near-optimal options - 0 no presolve (use primal and dual) 1 presolve (just use primal) 2 no presolve (just use primal) basis - 0 use all slack basis 1 try and put some in basis */ void crossover(int options,int basis); //@} /*! @name OsiSimplexInterface methods \brief Methods for the Osi Simplex API. The current implementation should work for both minimisation and maximisation in mode 1 (tableau access). In mode 2 (single pivot), only minimisation is supported as of 100907. */ //@{ /** \brief Simplex API capability. Returns - 0 if no simplex API - 1 if can just do getBInv etc - 2 if has all OsiSimplex methods */ virtual int canDoSimplexInterface() const; /*! \brief Enables simplex mode 1 (tableau access) Tells solver that calls to getBInv etc are about to take place. Underlying code may need mutable as this may be called from CglCut::generateCuts which is const. If that is too horrific then each solver e.g. BCP or CBC will have to do something outside main loop. */ virtual void enableFactorization() const; /*! \brief Undo any setting changes made by #enableFactorization */ virtual void disableFactorization() const; /** Returns true if a basis is available AND problem is optimal. This should be used to see if the BInvARow type operations are possible and meaningful. */ virtual bool basisIsAvailable() const; /** The following two methods may be replaced by the methods of OsiSolverInterface using OsiWarmStartBasis if: 1. OsiWarmStartBasis resize operation is implemented more efficiently and 2. It is ensured that effects on the solver are the same Returns a basis status of the structural/artificial variables At present as warm start i.e 0 free, 1 basic, 2 upper, 3 lower NOTE artificials are treated as +1 elements so for <= rhs artificial will be at lower bound if constraint is tight This means that Clpsimplex flips artificials as it works in terms of row activities */ virtual void getBasisStatus(int* cstat, int* rstat) const; /** Set the status of structural/artificial variables and factorize, update solution etc NOTE artificials are treated as +1 elements so for <= rhs artificial will be at lower bound if constraint is tight This means that Clpsimplex flips artificials as it works in terms of row activities Returns 0 if OK, 1 if problem is bad e.g. duplicate elements, too large ... */ virtual int setBasisStatus(const int* cstat, const int* rstat); ///Get the reduced gradient for the cost vector c virtual void getReducedGradient(double* columnReducedCosts, double * duals, const double * c) const ; ///Get a row of the tableau (slack part in slack if not NULL) virtual void getBInvARow(int row, double* z, double * slack=NULL) const; /** Get a row of the tableau (slack part in slack if not NULL) If keepScaled is true then scale factors not applied after so user has to use coding similar to what is in this method */ virtual void getBInvARow(int row, CoinIndexedVector * z, CoinIndexedVector * slack=NULL, bool keepScaled=false) const; ///Get a row of the basis inverse virtual void getBInvRow(int row, double* z) const; ///Get a column of the tableau virtual void getBInvACol(int col, double* vec) const ; ///Get a column of the tableau virtual void getBInvACol(int col, CoinIndexedVector * vec) const ; /** Update (i.e. ftran) the vector passed in. Unscaling is applied after - can't be applied before */ virtual void getBInvACol(CoinIndexedVector * vec) const ; ///Get a column of the basis inverse virtual void getBInvCol(int col, double* vec) const ; /** Get basic indices (order of indices corresponds to the order of elements in a vector retured by getBInvACol() and getBInvCol()). */ virtual void getBasics(int* index) const; /*! \brief Enables simplex mode 2 (individual pivot control) This method is supposed to ensure that all typical things (like reduced costs, etc.) are updated when individual pivots are executed and can be queried by other methods. */ virtual void enableSimplexInterface(bool doingPrimal); /// Copy across enabled stuff from one solver to another void copyEnabledSuff(OsiClpSolverInterface & rhs); /*! \brief Undo setting changes made by #enableSimplexInterface */ virtual void disableSimplexInterface(); /// Copy across enabled stuff from one solver to another void copyEnabledStuff(ClpSimplex & rhs); /** Perform a pivot by substituting a colIn for colOut in the basis. The status of the leaving variable is given in statOut. Where 1 is to upper bound, -1 to lower bound Return code is 0 for okay, 1 if inaccuracy forced re-factorization (should be okay) and -1 for singular factorization */ virtual int pivot(int colIn, int colOut, int outStatus); /** Obtain a result of the primal pivot Outputs: colOut -- leaving column, outStatus -- its status, t -- step size, and, if dx!=NULL, *dx -- primal ray direction. Inputs: colIn -- entering column, sign -- direction of its change (+/-1). Both for colIn and colOut, artificial variables are index by the negative of the row index minus 1. Return code (for now): 0 -- leaving variable found, -1 -- everything else? Clearly, more informative set of return values is required Primal and dual solutions are updated */ virtual int primalPivotResult(int colIn, int sign, int& colOut, int& outStatus, double& t, CoinPackedVector* dx); /** Obtain a result of the dual pivot (similar to the previous method) Differences: entering variable and a sign of its change are now the outputs, the leaving variable and its statuts -- the inputs If dx!=NULL, then *dx contains dual ray Return code: same */ virtual int dualPivotResult(int& colIn, int& sign, int colOut, int outStatus, double& t, CoinPackedVector* dx); //@} //--------------------------------------------------------------------------- /**@name Parameter set/get methods The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the clp algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false. */ //@{ // Set an integer parameter bool setIntParam(OsiIntParam key, int value); // Set an double parameter bool setDblParam(OsiDblParam key, double value); // Set a string parameter bool setStrParam(OsiStrParam key, const std::string & value); // Get an integer parameter bool getIntParam(OsiIntParam key, int& value) const; // Get an double parameter bool getDblParam(OsiDblParam key, double& value) const; // Get a string parameter bool getStrParam(OsiStrParam key, std::string& value) const; // Set a hint parameter - overrides OsiSolverInterface virtual bool setHintParam(OsiHintParam key, bool yesNo=true, OsiHintStrength strength=OsiHintTry, void * otherInformation=NULL); //@} //--------------------------------------------------------------------------- ///@name Methods returning info on how the solution process terminated //@{ /// Are there a numerical difficulties? virtual bool isAbandoned() const; /// Is optimality proven? virtual bool isProvenOptimal() const; /// Is primal infeasiblity proven? virtual bool isProvenPrimalInfeasible() const; /// Is dual infeasiblity proven? virtual bool isProvenDualInfeasible() const; /// Is the given primal objective limit reached? virtual bool isPrimalObjectiveLimitReached() const; /// Is the given dual objective limit reached? virtual bool isDualObjectiveLimitReached() const; /// Iteration limit reached? virtual bool isIterationLimitReached() const; //@} //--------------------------------------------------------------------------- /**@name WarmStart related methods */ //@{ /*! \brief Get an empty warm start object This routine returns an empty CoinWarmStartBasis object. Its purpose is to provide a way to give a client a warm start basis object of the appropriate type, which can resized and modified as desired. */ virtual CoinWarmStart *getEmptyWarmStart () const; /// Get warmstarting information virtual CoinWarmStart* getWarmStart() const; /// Get warmstarting information inline CoinWarmStartBasis* getPointerToWarmStart() { return &basis_;} /// Get warmstarting information inline const CoinWarmStartBasis* getConstPointerToWarmStart() const { return &basis_;} /** Set warmstarting information. Return true/false depending on whether the warmstart information was accepted or not. */ virtual bool setWarmStart(const CoinWarmStart* warmstart); /** \brief Get warm start information. Return warm start information for the current state of the solver interface. If there is no valid warm start information, an empty warm start object wil be returned. This does not necessarily create an object - may just point to one. must Delete set true if user should delete returned object. OsiClp version always returns pointer and false. */ virtual CoinWarmStart* getPointerToWarmStart(bool & mustDelete) ; /// Set column status in ClpSimplex and warmStart void setColumnStatus(int iColumn, ClpSimplex::Status status); //@} //--------------------------------------------------------------------------- /**@name Hotstart related methods (primarily used in strong branching). The user can create a hotstart (a snapshot) of the optimization process then reoptimize over and over again always starting from there.
    NOTE: between hotstarted optimizations only bound changes are allowed. */ //@{ /// Create a hotstart point of the optimization process virtual void markHotStart(); /// Optimize starting from the hotstart virtual void solveFromHotStart(); /// Delete the snapshot virtual void unmarkHotStart(); /** Start faster dual - returns negative if problems 1 if infeasible, Options to pass to solver 1 - create external reduced costs for columns 2 - create external reduced costs for rows 4 - create external row activity (columns always done) Above only done if feasible When set resolve does less work */ int startFastDual(int options); /// Stop fast dual void stopFastDual(); /// Sets integer tolerance and increment void setStuff(double tolerance,double increment); /// Return a conflict analysis cut from small model OsiRowCut * smallModelCut(const double * originalLower, const double * originalUpper, int numberRowsAtContinuous,const int * whichGenerator, int typeCut=0); /** Return a conflict analysis cut from model If type is 0 then genuine cut, if 1 then only partially processed */ OsiRowCut * modelCut(const double * originalLower, const double * originalUpper, int numberRowsAtContinuous,const int * whichGenerator, int typeCut=0); //@} //--------------------------------------------------------------------------- /**@name Problem information methods These methods call the solver's query routines to return information about the problem referred to by the current object. Querying a problem that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are valid as long as the data is unchanged and the solver is not called. */ //@{ /**@name Methods related to querying the input data */ //@{ /// Get number of columns virtual int getNumCols() const { return modelPtr_->numberColumns(); } /// Get number of rows virtual int getNumRows() const { return modelPtr_->numberRows(); } /// Get number of nonzero elements virtual int getNumElements() const { int retVal = 0; const CoinPackedMatrix * matrix =modelPtr_->matrix(); if ( matrix != NULL ) retVal=matrix->getNumElements(); return retVal; } /// Return name of row if one exists or Rnnnnnnn /// maxLen is currently ignored and only there to match the signature from the base class! virtual std::string getRowName(int rowIndex, unsigned maxLen = static_cast(std::string::npos)) const; /// Return name of column if one exists or Cnnnnnnn /// maxLen is currently ignored and only there to match the signature from the base class! virtual std::string getColName(int colIndex, unsigned maxLen = static_cast(std::string::npos)) const; /// Get pointer to array[getNumCols()] of column lower bounds virtual const double * getColLower() const { return modelPtr_->columnLower(); } /// Get pointer to array[getNumCols()] of column upper bounds virtual const double * getColUpper() const { return modelPtr_->columnUpper(); } /** Get pointer to array[getNumRows()] of row constraint senses.
    • 'L' <= constraint
    • 'E' = constraint
    • 'G' >= constraint
    • 'R' ranged constraint
    • 'N' free constraint
    */ virtual const char * getRowSense() const; /** Get pointer to array[getNumRows()] of rows right-hand sides
    • if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
    • if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
    • if rowsense()[i] == 'N' then rhs()[i] == 0.0
    */ virtual const double * getRightHandSide() const ; /** Get pointer to array[getNumRows()] of row ranges.
    • if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
    • if rowsense()[i] != 'R' then rowrange()[i] is undefined
    */ virtual const double * getRowRange() const ; /// Get pointer to array[getNumRows()] of row lower bounds virtual const double * getRowLower() const { return modelPtr_->rowLower(); } /// Get pointer to array[getNumRows()] of row upper bounds virtual const double * getRowUpper() const { return modelPtr_->rowUpper(); } /// Get pointer to array[getNumCols()] of objective function coefficients virtual const double * getObjCoefficients() const { if (fakeMinInSimplex_) return linearObjective_ ; else return modelPtr_->objective(); } /// Get objective function sense (1 for min (default), -1 for max) virtual double getObjSense() const { return ((fakeMinInSimplex_)?-modelPtr_->optimizationDirection(): modelPtr_->optimizationDirection()); } /// Return true if column is continuous virtual bool isContinuous(int colNumber) const; /// Return true if variable is binary virtual bool isBinary(int colIndex) const; /** Return true if column is integer. Note: This function returns true if the the column is binary or a general integer. */ virtual bool isInteger(int colIndex) const; /// Return true if variable is general integer virtual bool isIntegerNonBinary(int colIndex) const; /// Return true if variable is binary and not fixed at either bound virtual bool isFreeBinary(int colIndex) const; /** Return array of column length 0 - continuous 1 - binary (may get fixed later) 2 - general integer (may get fixed later) */ virtual const char * getColType(bool refresh=false) const; /** Return true if column is integer but does not have to be declared as such. Note: This function returns true if the the column is binary or a general integer. */ bool isOptionalInteger(int colIndex) const; /** Set the index-th variable to be an optional integer variable */ void setOptionalInteger(int index); /// Get pointer to row-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByRow() const; /// Get pointer to column-wise copy of matrix virtual const CoinPackedMatrix * getMatrixByCol() const; /// Get pointer to mutable column-wise copy of matrix virtual CoinPackedMatrix * getMutableMatrixByCol() const; /// Get solver's value for infinity virtual double getInfinity() const { return OsiClpInfinity; } //@} /**@name Methods related to querying the solution */ //@{ /// Get pointer to array[getNumCols()] of primal solution vector virtual const double * getColSolution() const; /// Get pointer to array[getNumRows()] of dual prices virtual const double * getRowPrice() const; /// Get a pointer to array[getNumCols()] of reduced costs virtual const double * getReducedCost() const; /** Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector */ virtual const double * getRowActivity() const; /// Get objective function value virtual double getObjValue() const; /** Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. */ virtual int getIterationCount() const { return modelPtr_->numberIterations(); } /** Get as many dual rays as the solver can provide. (In case of proven primal infeasibility there should be at least one.) The first getNumRows() ray components will always be associated with the row duals (as returned by getRowPrice()). If \c fullRay is true, the final getNumCols() entries will correspond to the ray components associated with the nonbasic variables. If the full ray is requested and the method cannot provide it, it will throw an exception. NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumRows() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getDualRays(int maxNumRays, bool fullRay = false) const; /** Get as many primal rays as the solver can provide. (In case of proven dual infeasibility there should be at least one.) NOTE for implementers of solver interfaces:
    The double pointers in the vector should point to arrays of length getNumCols() and they should be allocated via new[].
    NOTE for users of solver interfaces:
    It is the user's responsibility to free the double pointers in the vector using delete[]. */ virtual std::vector getPrimalRays(int maxNumRays) const; //@} //@} //--------------------------------------------------------------------------- /**@name Problem modifying methods */ //@{ //------------------------------------------------------------------------- /**@name Changing bounds on variables and constraints */ //@{ /** Set an objective function coefficient */ virtual void setObjCoeff( int elementIndex, double elementValue ); /** Set a single column lower bound
    Use -DBL_MAX for -infinity. */ virtual void setColLower( int elementIndex, double elementValue ); /** Set a single column upper bound
    Use DBL_MAX for infinity. */ virtual void setColUpper( int elementIndex, double elementValue ); /** Set a single column lower and upper bound */ virtual void setColBounds( int elementIndex, double lower, double upper ); /** Set the bounds on a number of columns simultaneously
    The default implementation just invokes setColLower() and setColUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the variables whose either bound changes @param boundList the new lower/upper bound pairs for the variables */ virtual void setColSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set a single row lower bound
    Use -DBL_MAX for -infinity. */ virtual void setRowLower( int elementIndex, double elementValue ); /** Set a single row upper bound
    Use DBL_MAX for infinity. */ virtual void setRowUpper( int elementIndex, double elementValue ) ; /** Set a single row lower and upper bound */ virtual void setRowBounds( int elementIndex, double lower, double upper ) ; /** Set the type of a single row
    */ virtual void setRowType(int index, char sense, double rightHandSide, double range); /** Set the bounds on a number of rows simultaneously
    The default implementation just invokes setRowLower() and setRowUpper() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose either bound changes @param boundList the new lower/upper bound pairs for the constraints */ virtual void setRowSetBounds(const int* indexFirst, const int* indexLast, const double* boundList); /** Set the type of a number of rows simultaneously
    The default implementation just invokes setRowType() over and over again. @param indexFirst,indexLast pointers to the beginning and after the end of the array of the indices of the constraints whose any characteristics changes @param senseList the new senses @param rhsList the new right hand sides @param rangeList the new ranges */ virtual void setRowSetTypes(const int* indexFirst, const int* indexLast, const char* senseList, const double* rhsList, const double* rangeList); /** Set the objective coefficients for all columns array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed. */ virtual void setObjective(const double * array); /** Set the lower bounds for all columns array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed. */ virtual void setColLower(const double * array); /** Set the upper bounds for all columns array [getNumCols()] is an array of values for the objective. This defaults to a series of set operations and is here for speed. */ virtual void setColUpper(const double * array); // using OsiSolverInterface::setRowName ; /// Set name of row // virtual void setRowName(int rowIndex, std::string & name) ; virtual void setRowName(int rowIndex, std::string name) ; // using OsiSolverInterface::setColName ; /// Set name of column // virtual void setColName(int colIndex, std::string & name) ; virtual void setColName(int colIndex, std::string name) ; //@} //------------------------------------------------------------------------- /**@name Integrality related changing methods */ //@{ /** Set the index-th variable to be a continuous variable */ virtual void setContinuous(int index); /** Set the index-th variable to be an integer variable */ virtual void setInteger(int index); /** Set the variables listed in indices (which is of length len) to be continuous variables */ virtual void setContinuous(const int* indices, int len); /** Set the variables listed in indices (which is of length len) to be integer variables */ virtual void setInteger(const int* indices, int len); /// Number of SOS sets inline int numberSOS() const { return numberSOS_;} /// SOS set info inline const CoinSet * setInfo() const { return setInfo_;} /** \brief Identify integer variables and SOS and create corresponding objects. Record integer variables and create an OsiSimpleInteger object for each one. All existing OsiSimpleInteger objects will be destroyed. If the solver supports SOS then do the same for SOS. If justCount then no objects created and we just store numberIntegers_ Returns number of SOS */ virtual int findIntegersAndSOS(bool justCount); //@} //------------------------------------------------------------------------- /// Set objective function sense (1 for min (default), -1 for max,) virtual void setObjSense(double s ) { modelPtr_->setOptimizationDirection( s < 0 ? -1 : 1); } /** Set the primal solution column values colsol[numcols()] is an array of values of the problem column variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of colsol() until changed by another call to setColsol() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setColSolution(const double * colsol); /** Set dual solution vector rowprice[numrows()] is an array of values of the problem row dual variables. These values are copied to memory owned by the solver object or the solver. They will be returned as the result of rowprice() until changed by another call to setRowprice() or by a call to any solver routine. Whether the solver makes use of the solution in any way is solver-dependent. */ virtual void setRowPrice(const double * rowprice); //------------------------------------------------------------------------- /**@name Methods to expand a problem.
    Note that if a column is added then by default it will correspond to a continuous variable. */ //@{ //using OsiSolverInterface::addCol ; /** */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj); /*! \brief Add a named column (primal variable) to the problem. */ virtual void addCol(const CoinPackedVectorBase& vec, const double collb, const double colub, const double obj, std::string name) ; /** Add a column (primal variable) to the problem. */ virtual void addCol(int numberElements, const int * rows, const double * elements, const double collb, const double colub, const double obj) ; /*! \brief Add a named column (primal variable) to the problem. */ virtual void addCol(int numberElements, const int* rows, const double* elements, const double collb, const double colub, const double obj, std::string name) ; /** */ virtual void addCols(const int numcols, const CoinPackedVectorBase * const * cols, const double* collb, const double* colub, const double* obj); /** */ virtual void addCols(const int numcols, const int * columnStarts, const int * rows, const double * elements, const double* collb, const double* colub, const double* obj); /** */ virtual void deleteCols(const int num, const int * colIndices); /** */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub); /** */ /*! \brief Add a named row (constraint) to the problem. The default implementation adds the row, then changes the name. This can surely be made more efficient within an OsiXXX class. */ virtual void addRow(const CoinPackedVectorBase& vec, const double rowlb, const double rowub, std::string name) ; virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng); /** Add a row (constraint) to the problem. */ virtual void addRow(int numberElements, const int * columns, const double * element, const double rowlb, const double rowub) ; /*! \brief Add a named row (constraint) to the problem. */ virtual void addRow(const CoinPackedVectorBase& vec, const char rowsen, const double rowrhs, const double rowrng, std::string name) ; /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const double* rowlb, const double* rowub); /** */ virtual void addRows(const int numrows, const CoinPackedVectorBase * const * rows, const char* rowsen, const double* rowrhs, const double* rowrng); /** */ virtual void addRows(const int numrows, const int * rowStarts, const int * columns, const double * element, const double* rowlb, const double* rowub); /// void modifyCoefficient(int row, int column, double newElement, bool keepZero=false) {modelPtr_->modifyCoefficient(row,column,newElement, keepZero);} /** */ virtual void deleteRows(const int num, const int * rowIndices); /** If solver wants it can save a copy of "base" (continuous) model here */ virtual void saveBaseModel() ; /** Strip off rows to get to this number of rows. If solver wants it can restore a copy of "base" (continuous) model here */ virtual void restoreBaseModel(int numberRows); //----------------------------------------------------------------------- /** Apply a collection of row cuts which are all effective. applyCuts seems to do one at a time which seems inefficient. */ virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts); /** Apply a collection of row cuts which are all effective. applyCuts seems to do one at a time which seems inefficient. This uses array of pointers */ virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts); /** Apply a collection of cuts. Only cuts which have an effectiveness >= effectivenessLb are applied.
    • ReturnCode.getNumineffective() -- number of cuts which were not applied because they had an effectiveness < effectivenessLb
    • ReturnCode.getNuminconsistent() -- number of invalid cuts
    • ReturnCode.getNuminconsistentWrtIntegerModel() -- number of cuts that are invalid with respect to this integer model
    • ReturnCode.getNuminfeasible() -- number of cuts that would make this integer model infeasible
    • ReturnCode.getNumApplied() -- number of integer cuts which were applied to the integer model
    • cs.size() == getNumineffective() + getNuminconsistent() + getNuminconsistentWrtIntegerModel() + getNuminfeasible() + getNumApplied()
    */ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, double effectivenessLb = 0.0); //@} //@} //--------------------------------------------------------------------------- public: /**@name Methods to input a problem */ //@{ /** Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). If a pointer is NULL then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • rowub: all rows have upper bound infinity
    • rowlb: all rows have lower bound -infinity
    • obj: all variables have 0 objective coefficient
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by lower and upper bounds). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, double*& rowlb, double*& rowub); /** Load in an problem by copying the arguments (the constraints on the rows are given by sense/rhs/range triplets). If a pointer is NULL then the following values are the default:
    • colub: all columns have upper bound infinity
    • collb: all columns have lower bound 0
    • obj: all variables have 0 objective coefficient
    • rowsen: all rows are >=
    • rowrhs: all right hand sides are 0
    • rowrng: 0 for the ranged rows
    */ virtual void loadProblem(const CoinPackedMatrix& matrix, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /** Load in an problem by assuming ownership of the arguments (the constraints on the rows are given by sense/rhs/range triplets). For default values see the previous method.
    WARNING: The arguments passed to this method will be freed using the C++ delete and delete[] functions. */ virtual void assignProblem(CoinPackedMatrix*& matrix, double*& collb, double*& colub, double*& obj, char*& rowsen, double*& rowrhs, double*& rowrng); /** Just like the other loadProblem() methods except that the matrix is given as a ClpMatrixBase. */ virtual void loadProblem(const ClpMatrixBase& matrix, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) ; /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub); /** Just like the other loadProblem() methods except that the matrix is given in a standard column major ordered format (without gaps). */ virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const char* rowsen, const double* rowrhs, const double* rowrng); /// This loads a model from a coinModel object - returns number of errors virtual int loadFromCoinModel ( CoinModel & modelObject, bool keepSolution=false); using OsiSolverInterface::readMps ; /** Read an mps file from the given filename (defaults to Osi reader) - returns number of errors (see OsiMpsReader class) */ virtual int readMps(const char *filename, const char *extension = "mps") ; /** Read an mps file from the given filename returns number of errors (see OsiMpsReader class) */ int readMps(const char *filename,bool keepNames,bool allowErrors); /// Read an mps file virtual int readMps (const char *filename, const char*extension, int & numberSets, CoinSet ** & sets); /** Write the problem into an mps file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants */ virtual void writeMps(const char *filename, const char *extension = "mps", double objSense=0.0) const; /** Write the problem into an mps file of the given filename, names may be null. formatType is 0 - normal 1 - extra accuracy 2 - IEEE hex (later) Returns non-zero on I/O error */ virtual int writeMpsNative(const char *filename, const char ** rowNames, const char ** columnNames, int formatType=0,int numberAcross=2, double objSense=0.0) const ; /// Read file in LP format (with names) virtual int readLp(const char *filename, const double epsilon = 1e-5); /** Write the problem into an Lp file of the given filename. If objSense is non zero then -1.0 forces the code to write a maximization objective and +1.0 to write a minimization one. If 0.0 then solver can do what it wants. This version calls writeLpNative with names */ virtual void writeLp(const char *filename, const char *extension = "lp", double epsilon = 1e-5, int numberAcross = 10, int decimals = 5, double objSense = 0.0, bool useRowNames = true) const; /** Write the problem into the file pointed to by the parameter fp. Other parameters are similar to those of writeLp() with first parameter filename. */ virtual void writeLp(FILE *fp, double epsilon = 1e-5, int numberAcross = 10, int decimals = 5, double objSense = 0.0, bool useRowNames = true) const; /** I (JJF) am getting annoyed because I can't just replace a matrix. The default behavior of this is do nothing so only use where that would not matter e.g. strengthening a matrix for MIP */ virtual void replaceMatrixOptional(const CoinPackedMatrix & matrix); /// And if it does matter (not used at present) virtual void replaceMatrix(const CoinPackedMatrix & matrix) ; //@} /**@name Message handling (extra for Clp messages). Normally I presume you would want the same language. If not then you could use underlying model pointer */ //@{ /** Pass in a message handler It is the client's responsibility to destroy a message handler installed by this routine; it will not be destroyed when the solver interface is destroyed. */ virtual void passInMessageHandler(CoinMessageHandler * handler); /// Set language void newLanguage(CoinMessages::Language language); void setLanguage(CoinMessages::Language language) {newLanguage(language);} /// Set log level (will also set underlying solver's log level) void setLogLevel(int value); /// Create C++ lines to get to current state void generateCpp( FILE * fp); //@} //--------------------------------------------------------------------------- /**@name Clp specific public interfaces */ //@{ /// Get pointer to Clp model ClpSimplex * getModelPtr() const ; /// Set pointer to Clp model and return old inline ClpSimplex * swapModelPtr(ClpSimplex * newModel) { ClpSimplex * model = modelPtr_; modelPtr_=newModel;return model;} /// Get special options inline unsigned int specialOptions() const { return specialOptions_;} void setSpecialOptions(unsigned int value); /// Last algorithm used , 1 = primal, 2 = dual other unknown inline int lastAlgorithm() const { return lastAlgorithm_;} /// Set last algorithm used , 1 = primal, 2 = dual other unknown inline void setLastAlgorithm(int value) { lastAlgorithm_ = value;} /// Get scaling action option inline int cleanupScaling() const { return cleanupScaling_;} /** Set Scaling option When scaling is on it is possible that the scaled problem is feasible but the unscaled is not. Clp returns a secondary status code to that effect. This option allows for a cleanup. If you use it I would suggest 1. This only affects actions when scaled optimal 0 - no action 1 - clean up using dual if primal infeasibility 2 - clean up using dual if dual infeasibility 3 - clean up using dual if primal or dual infeasibility 11,12,13 - as 1,2,3 but use primal */ inline void setCleanupScaling(int value) { cleanupScaling_=value;} /** Get smallest allowed element in cut. If smaller than this then ignored */ inline double smallestElementInCut() const { return smallestElementInCut_;} /** Set smallest allowed element in cut. If smaller than this then ignored */ inline void setSmallestElementInCut(double value) { smallestElementInCut_=value;} /** Get smallest change in cut. If (upper-lower)*element < this then element is taken out and cut relaxed. (upper-lower) is taken to be at least 1.0 and this is assumed >= smallestElementInCut_ */ inline double smallestChangeInCut() const { return smallestChangeInCut_;} /** Set smallest change in cut. If (upper-lower)*element < this then element is taken out and cut relaxed. (upper-lower) is taken to be at least 1.0 and this is assumed >= smallestElementInCut_ */ inline void setSmallestChangeInCut(double value) { smallestChangeInCut_=value;} /// Pass in initial solve options inline void setSolveOptions(const ClpSolve & options) { solveOptions_ = options;} /** Tighten bounds - lightweight or very lightweight 0 - normal, 1 lightweight but just integers, 2 lightweight and all */ virtual int tightenBounds(int lightweight=0); /// See if any integer variables make infeasible other way int infeasibleOtherWay(char * whichWay); /// Return number of entries in L part of current factorization virtual CoinBigIndex getSizeL() const; /// Return number of entries in U part of current factorization virtual CoinBigIndex getSizeU() const; /// Get disaster handler const OsiClpDisasterHandler * disasterHandler() const { return disasterHandler_;} /// Pass in disaster handler void passInDisasterHandler(OsiClpDisasterHandler * handler); /// Get fake objective ClpLinearObjective * fakeObjective() const { return fakeObjective_;} /// Set fake objective (and take ownership) void setFakeObjective(ClpLinearObjective * fakeObjective); /// Set fake objective void setFakeObjective(double * fakeObjective); /*! \brief Set up solver for repeated use by Osi interface. The normal usage does things like keeping factorization around so can be used. Will also do things like keep scaling and row copy of matrix if matrix does not change. \p senseOfAdventure: - 0 - safe stuff as above - 1 - will take more risks - if it does not work then bug which will be fixed - 2 - don't bother doing most extreme termination checks e.g. don't bother re-factorizing if less than 20 iterations. - 3 - Actually safer than 1 (mainly just keeps factorization) \p printOut - -1 always skip round common messages instead of doing some work - 0 skip if normal defaults - 1 leaves */ void setupForRepeatedUse(int senseOfAdventure=0, int printOut=0); /// Synchronize model (really if no cuts in tree) virtual void synchronizeModel(); /*! \brief Set special options in underlying clp solver. Safe as const because #modelPtr_ is mutable. */ void setSpecialOptionsMutable(unsigned int value) const; //@} //--------------------------------------------------------------------------- /**@name Constructors and destructors */ //@{ /// Default Constructor OsiClpSolverInterface (); /// Clone virtual OsiSolverInterface * clone(bool copyData = true) const; /// Copy constructor OsiClpSolverInterface (const OsiClpSolverInterface &); /// Borrow constructor - only delete one copy OsiClpSolverInterface (ClpSimplex * rhs, bool reallyOwn=false); /// Releases so won't error void releaseClp(); /// Assignment operator OsiClpSolverInterface & operator=(const OsiClpSolverInterface& rhs); /// Destructor virtual ~OsiClpSolverInterface (); /// Resets as if default constructor virtual void reset(); //@} //--------------------------------------------------------------------------- protected: ///@name Protected methods //@{ /** Apply a row cut (append to constraint matrix). */ virtual void applyRowCut(const OsiRowCut& rc); /** Apply a column cut (adjust one or more bounds). */ virtual void applyColCut(const OsiColCut& cc); //@} //--------------------------------------------------------------------------- protected: /**@name Protected methods */ //@{ /// The real work of a copy constructor (used by copy and assignment) void gutsOfDestructor(); /// Deletes all mutable stuff void freeCachedResults() const; /// Deletes all mutable stuff for row ranges etc void freeCachedResults0() const; /// Deletes all mutable stuff for matrix etc void freeCachedResults1() const; /// A method that fills up the rowsense_, rhs_ and rowrange_ arrays void extractSenseRhsRange() const; /// void fillParamMaps(); /** Warm start NOTE artificials are treated as +1 elements so for <= rhs artificial will be at lower bound if constraint is tight This means that Clpsimplex flips artificials as it works in terms of row activities */ CoinWarmStartBasis getBasis(ClpSimplex * model) const; /** Sets up working basis as a copy of input NOTE artificials are treated as +1 elements so for <= rhs artificial will be at lower bound if constraint is tight This means that Clpsimplex flips artificials as it works in terms of row activities */ void setBasis( const CoinWarmStartBasis & basis, ClpSimplex * model); /// Crunch down problem a bit void crunch(); /// Extend scale factors void redoScaleFactors(int numberRows,const CoinBigIndex * starts, const int * indices, const double * elements); public: /** Sets up working basis as a copy of input and puts in as basis */ void setBasis( const CoinWarmStartBasis & basis); /// Just puts current basis_ into ClpSimplex model inline void setBasis( ) { setBasis(basis_,modelPtr_);} /// Warm start difference from basis_ to statusArray CoinWarmStartDiff * getBasisDiff(const unsigned char * statusArray) const ; /// Warm start from statusArray CoinWarmStartBasis * getBasis(const unsigned char * statusArray) const ; /// Delete all scale factor stuff and reset option void deleteScaleFactors(); /// If doing fast hot start then ranges are computed inline const double * upRange() const { return rowActivity_;} inline const double * downRange() const { return columnActivity_;} /// Pass in range array inline void passInRanges(int * array) { whichRange_=array;} /// Pass in sos stuff from AMPl void setSOSData(int numberSOS,const char * type, const int * start,const int * indices, const double * weights=NULL); /// Compute largest amount any at continuous away from bound void computeLargestAway(); /// Get largest amount continuous away from bound inline double largestAway() const { return largestAway_;} /// Set largest amount continuous away from bound inline void setLargestAway(double value) { largestAway_ = value;} /// Sort of lexicographic resolve void lexSolve(); //@} protected: /**@name Protected member data */ //@{ /// Clp model represented by this class instance mutable ClpSimplex * modelPtr_; //@} /**@name Cached information derived from the OSL model */ //@{ /// Pointer to dense vector of row sense indicators mutable char *rowsense_; /// Pointer to dense vector of row right-hand side values mutable double *rhs_; /** Pointer to dense vector of slack upper bounds for range constraints (undefined for non-range rows) */ mutable double *rowrange_; /** A pointer to the warmstart information to be used in the hotstarts. This is NOT efficient and more thought should be given to it... */ mutable CoinWarmStartBasis* ws_; /** also save row and column information for hot starts only used in hotstarts so can be casual */ mutable double * rowActivity_; mutable double * columnActivity_; /// Stuff for fast dual ClpNodeStuff stuff_; /// Number of SOS sets int numberSOS_; /// SOS set info CoinSet * setInfo_; /// Alternate model (hot starts) - but also could be permanent and used for crunch ClpSimplex * smallModel_; /// factorization for hot starts ClpFactorization * factorization_; /** Smallest allowed element in cut. If smaller than this then ignored */ double smallestElementInCut_; /** Smallest change in cut. If (upper-lower)*element < this then element is taken out and cut relaxed. */ double smallestChangeInCut_; /// Largest amount continuous away from bound double largestAway_; /// Arrays for hot starts char * spareArrays_; /** Warmstart information to be used in resolves. */ CoinWarmStartBasis basis_; /** The original iteration limit before hotstarts started. */ int itlimOrig_; /*! \brief Last algorithm used Coded as - 0 invalid - 1 primal - 2 dual - -911 disaster in the algorithm that was attempted - 999 current solution no longer optimal due to change in problem or basis */ mutable int lastAlgorithm_; /// To say if destructor should delete underlying model bool notOwned_; /// Pointer to row-wise copy of problem matrix coefficients. mutable CoinPackedMatrix *matrixByRow_; /// Pointer to row-wise copy of continuous problem matrix coefficients. CoinPackedMatrix *matrixByRowAtContinuous_; /// Pointer to integer information char * integerInformation_; /** Pointer to variables for which we want range information The number is in [0] memory is not owned by OsiClp */ int * whichRange_; //std::map intParamMap_; //std::map dblParamMap_; //std::map strParamMap_; /*! \brief Faking min to get proper dual solution signs in simplex API */ mutable bool fakeMinInSimplex_ ; /*! \brief Linear objective Normally a pointer to the linear coefficient array in the clp objective. An independent copy when #fakeMinInSimplex_ is true, because we need something permanent to point to when #getObjCoefficients is called. */ mutable double *linearObjective_; /// To save data in OsiSimplex stuff mutable ClpDataSave saveData_; /// Options for initialSolve ClpSolve solveOptions_; /** Scaling option When scaling is on it is possible that the scaled problem is feasible but the unscaled is not. Clp returns a secondary status code to that effect. This option allows for a cleanup. If you use it I would suggest 1. This only affects actions when scaled optimal 0 - no action 1 - clean up using dual if primal infeasibility 2 - clean up using dual if dual infeasibility 3 - clean up using dual if primal or dual infeasibility 11,12,13 - as 1,2,3 but use primal */ int cleanupScaling_; /** Special options 0x80000000 off 0 simple stuff for branch and bound 1 try and keep work regions as much as possible 2 do not use any perturbation 4 allow exit before re-factorization 8 try and re-use factorization if no cuts 16 use standard strong branching rather than clp's 32 Just go to first factorization in fast dual 64 try and tighten bounds in crunch 128 Model will only change in column bounds 256 Clean up model before hot start 512 Give user direct access to Clp regions in getBInvARow etc (i.e., do not unscale, and do not return result in getBInv parameters; you have to know where to look for the answer) 1024 Don't "borrow" model in initialSolve 2048 Don't crunch 4096 quick check for optimality Bits above 8192 give where called from in Cbc At present 0 is normal, 1 doing fast hotstarts, 2 is can do quick check 65536 Keep simple i.e. no crunch etc 131072 Try and keep scaling factors around 262144 Don't try and tighten bounds (funny global cuts) 524288 Fake objective and 0-1 1048576 Don't recompute ray after crunch 2097152 */ mutable unsigned int specialOptions_; /// Copy of model when option 131072 set ClpSimplex * baseModel_; /// Number of rows when last "scaled" int lastNumberRows_; /// Continuous model ClpSimplex * continuousModel_; /// Possible disaster handler OsiClpDisasterHandler * disasterHandler_ ; /// Fake objective ClpLinearObjective * fakeObjective_; /// Row scale factors (has inverse at end) CoinDoubleArrayWithLength rowScale_; /// Column scale factors (has inverse at end) CoinDoubleArrayWithLength columnScale_; //@} }; class OsiClpDisasterHandler : public ClpDisasterHandler { public: /**@name Virtual methods that the derived classe should provide. */ //@{ /// Into simplex virtual void intoSimplex(); /// Checks if disaster virtual bool check() const ; /// saves information for next attempt virtual void saveInfo(); /// Type of disaster 0 can fix, 1 abort virtual int typeOfDisaster(); //@} /**@name Constructors, destructor */ //@{ /** Default constructor. */ OsiClpDisasterHandler(OsiClpSolverInterface * model = NULL); /** Destructor */ virtual ~OsiClpDisasterHandler(); // Copy OsiClpDisasterHandler(const OsiClpDisasterHandler&); // Assignment OsiClpDisasterHandler& operator=(const OsiClpDisasterHandler&); /// Clone virtual ClpDisasterHandler * clone() const; //@} /**@name Sets/gets */ //@{ /** set model. */ void setOsiModel(OsiClpSolverInterface * model); /// Get model inline OsiClpSolverInterface * osiModel() const { return osiModel_;} /// Set where from inline void setWhereFrom(int value) { whereFrom_=value;} /// Get where from inline int whereFrom() const { return whereFrom_;} /// Set phase inline void setPhase(int value) { phase_=value;} /// Get phase inline int phase() const { return phase_;} /// are we in trouble bool inTrouble() const; //@} protected: /**@name Data members The data members are protected to allow access for derived classes. */ //@{ /// Pointer to model OsiClpSolverInterface * osiModel_; /** Where from 0 dual (resolve) 1 crunch 2 primal (resolve) 4 dual (initialSolve) 6 primal (initialSolve) */ int whereFrom_; /** phase 0 initial 1 trying continuing with back in and maybe different perturb 2 trying continuing with back in and different scaling 3 trying dual from all slack 4 trying primal from previous stored basis */ int phase_; /// Are we in trouble bool inTrouble_; //@} }; // So unit test can find out if NDEBUG set bool OsiClpHasNDEBUG(); //############################################################################# /** A function that tests the methods in the OsiClpSolverInterface class. */ void OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); #endif CoinMP-1.8.3/Clp/src/ClpDynamicExampleMatrix.cpp0000644000175000017500000007151012130766607020065 0ustar renerene/* $Id: ClpDynamicExampleMatrix.cpp 1936 2013-04-09 10:29:27Z forrest $ */ // Copyright (C) 2004, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include #include "CoinPragma.hpp" #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "ClpSimplex.hpp" #include "ClpFactorization.hpp" #include "ClpQuadraticObjective.hpp" #include "ClpNonLinearCost.hpp" // at end to get min/max! #include "ClpDynamicExampleMatrix.hpp" #include "ClpMessage.hpp" //#define CLP_DEBUG //#define CLP_DEBUG_PRINT //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpDynamicExampleMatrix::ClpDynamicExampleMatrix () : ClpDynamicMatrix(), numberColumns_(0), startColumnGen_(NULL), rowGen_(NULL), elementGen_(NULL), costGen_(NULL), fullStartGen_(NULL), dynamicStatusGen_(NULL), idGen_(NULL), columnLowerGen_(NULL), columnUpperGen_(NULL) { setType(25); } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpDynamicExampleMatrix::ClpDynamicExampleMatrix (const ClpDynamicExampleMatrix & rhs) : ClpDynamicMatrix(rhs) { numberColumns_ = rhs.numberColumns_; startColumnGen_ = ClpCopyOfArray(rhs.startColumnGen_, numberColumns_ + 1); CoinBigIndex numberElements = startColumnGen_[numberColumns_]; rowGen_ = ClpCopyOfArray(rhs.rowGen_, numberElements);; elementGen_ = ClpCopyOfArray(rhs.elementGen_, numberElements);; costGen_ = ClpCopyOfArray(rhs.costGen_, numberColumns_); fullStartGen_ = ClpCopyOfArray(rhs.fullStartGen_, numberSets_ + 1); dynamicStatusGen_ = ClpCopyOfArray(rhs.dynamicStatusGen_, numberColumns_); idGen_ = ClpCopyOfArray(rhs.idGen_, maximumGubColumns_); columnLowerGen_ = ClpCopyOfArray(rhs.columnLowerGen_, numberColumns_); columnUpperGen_ = ClpCopyOfArray(rhs.columnUpperGen_, numberColumns_); } /* This is the real constructor*/ ClpDynamicExampleMatrix::ClpDynamicExampleMatrix(ClpSimplex * model, int numberSets, int numberGubColumns, const int * starts, const double * lower, const double * upper, const CoinBigIndex * startColumn, const int * row, const double * element, const double * cost, const double * columnLower, const double * columnUpper, const unsigned char * status, const unsigned char * dynamicStatus, int numberIds, const int *ids) : ClpDynamicMatrix(model, numberSets, 0, NULL, lower, upper, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) { setType(25); numberColumns_ = numberGubColumns; // start with safe values - then experiment maximumGubColumns_ = numberColumns_; maximumElements_ = startColumn[numberColumns_]; // delete odd stuff created by ClpDynamicMatrix constructor delete [] startSet_; startSet_ = new int [numberSets_]; delete [] next_; next_ = new int [maximumGubColumns_]; delete [] row_; delete [] element_; delete [] startColumn_; delete [] cost_; delete [] columnLower_; delete [] columnUpper_; delete [] dynamicStatus_; delete [] status_; delete [] id_; // and size correctly row_ = new int [maximumElements_]; element_ = new double [maximumElements_]; startColumn_ = new CoinBigIndex [maximumGubColumns_+1]; // say no columns yet numberGubColumns_ = 0; startColumn_[0] = 0; cost_ = new double[maximumGubColumns_]; dynamicStatus_ = new unsigned char [2*maximumGubColumns_]; memset(dynamicStatus_, 0, maximumGubColumns_); id_ = new int[maximumGubColumns_]; if (columnLower) columnLower_ = new double[maximumGubColumns_]; else columnLower_ = NULL; if (columnUpper) columnUpper_ = new double[maximumGubColumns_]; else columnUpper_ = NULL; // space for ids idGen_ = new int [maximumGubColumns_]; int iSet; for (iSet = 0; iSet < numberSets_; iSet++) startSet_[iSet] = -1; // This starts code specific to this storage method CoinBigIndex i; fullStartGen_ = ClpCopyOfArray(starts, numberSets_ + 1); startColumnGen_ = ClpCopyOfArray(startColumn, numberColumns_ + 1); CoinBigIndex numberElements = startColumnGen_[numberColumns_]; rowGen_ = ClpCopyOfArray(row, numberElements); elementGen_ = new double[numberElements]; for (i = 0; i < numberElements; i++) elementGen_[i] = element[i]; costGen_ = new double[numberColumns_]; for (i = 0; i < numberColumns_; i++) { costGen_[i] = cost[i]; // I don't think I need sorted but ... CoinSort_2(rowGen_ + startColumnGen_[i], rowGen_ + startColumnGen_[i+1], elementGen_ + startColumnGen_[i]); } if (columnLower) { columnLowerGen_ = new double[numberColumns_]; for (i = 0; i < numberColumns_; i++) { columnLowerGen_[i] = columnLower[i]; if (columnLowerGen_[i]) { printf("Non-zero lower bounds not allowed - subtract from model\n"); abort(); } } } else { columnLowerGen_ = NULL; } if (columnUpper) { columnUpperGen_ = new double[numberColumns_]; for (i = 0; i < numberColumns_; i++) columnUpperGen_[i] = columnUpper[i]; } else { columnUpperGen_ = NULL; } // end specific coding if (columnUpper_) { // set all upper bounds so we have enough space double * columnUpper = model->columnUpper(); for(i = firstDynamic_; i < lastDynamic_; i++) columnUpper[i] = 1.0e10; } status_ = new unsigned char [2*numberSets_+4]; if (status) { memcpy(status_,status, numberSets_ * sizeof(char)); assert (dynamicStatus); CoinMemcpyN(dynamicStatus, numberIds, dynamicStatus_); assert (numberIds); } else { assert (!numberIds); memset(status_, 0, numberSets_); for (i = 0; i < numberSets_; i++) { // make slack key setStatus(i, ClpSimplex::basic); } } dynamicStatusGen_ = new unsigned char [numberColumns_]; memset(dynamicStatusGen_, 0, numberColumns_); // for clarity for (i = 0; i < numberColumns_; i++) setDynamicStatusGen(i, atLowerBound); // Populate with enough columns if (!numberIds) { // This could be made more sophisticated for (iSet = 0; iSet < numberSets_; iSet++) { int sequence = fullStartGen_[iSet]; CoinBigIndex start = startColumnGen_[sequence]; addColumn(startColumnGen_[sequence+1] - start, rowGen_ + start, elementGen_ + start, costGen_[sequence], columnLowerGen_ ? columnLowerGen_[sequence] : 0, columnUpperGen_ ? columnUpperGen_[sequence] : 1.0e30, iSet, getDynamicStatusGen(sequence)); idGen_[iSet] = sequence; // say which one in setDynamicStatusGen(sequence, inSmall); } } else { // put back old ones int * set = new int[numberColumns_]; for (iSet = 0; iSet < numberSets_; iSet++) { for (CoinBigIndex j = fullStartGen_[iSet]; j < fullStartGen_[iSet+1]; j++) set[j] = iSet; } for (int i = 0; i < numberIds; i++) { int sequence = ids[i]; CoinBigIndex start = startColumnGen_[sequence]; addColumn(startColumnGen_[sequence+1] - start, rowGen_ + start, elementGen_ + start, costGen_[sequence], columnLowerGen_ ? columnLowerGen_[sequence] : 0, columnUpperGen_ ? columnUpperGen_[sequence] : 1.0e30, set[sequence], getDynamicStatus(i)); idGen_[iSet] = sequence; // say which one in setDynamicStatusGen(sequence, inSmall); } delete [] set; } if (!status) { gubCrash(); } else { initialProblem(); } } #if 0 // This constructor just takes over ownership ClpDynamicExampleMatrix::ClpDynamicExampleMatrix(ClpSimplex * model, int numberSets, int numberGubColumns, int * starts, const double * lower, const double * upper, int * startColumn, int * row, double * element, double * cost, double * columnLower, double * columnUpper, const unsigned char * status, const unsigned char * dynamicStatus, int numberIds, const int *ids) : ClpDynamicMatrix(model, numberSets, 0, NULL, lower, upper, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) { setType(25); numberColumns_ = numberGubColumns; // start with safe values - then experiment maximumGubColumns_ = numberColumns_; maximumElements_ = startColumn[numberColumns_]; // delete odd stuff created by ClpDynamicMatrix constructor delete [] startSet_; startSet_ = new int [numberSets_]; delete [] next_; next_ = new int [maximumGubColumns_]; delete [] row_; delete [] element_; delete [] startColumn_; delete [] cost_; delete [] columnLower_; delete [] columnUpper_; delete [] dynamicStatus_; delete [] status_; delete [] id_; // and size correctly row_ = new int [maximumElements_]; element_ = new double [maximumElements_]; startColumn_ = new CoinBigIndex [maximumGubColumns_+1]; // say no columns yet numberGubColumns_ = 0; startColumn_[0] = 0; cost_ = new double[maximumGubColumns_]; dynamicStatus_ = new unsigned char [2*maximumGubColumns_]; memset(dynamicStatus_, 0, maximumGubColumns_); id_ = new int[maximumGubColumns_]; if (columnLower) columnLower_ = new double[maximumGubColumns_]; else columnLower_ = NULL; if (columnUpper) columnUpper_ = new double[maximumGubColumns_]; else columnUpper_ = NULL; // space for ids idGen_ = new int [maximumGubColumns_]; int iSet; for (iSet = 0; iSet < numberSets_; iSet++) startSet_[iSet] = -1; // This starts code specific to this storage method CoinBigIndex i; fullStartGen_ = starts; startColumnGen_ = startColumn; rowGen_ = row; elementGen_ = element; costGen_ = cost; for (i = 0; i < numberColumns_; i++) { // I don't think I need sorted but ... CoinSort_2(rowGen_ + startColumnGen_[i], rowGen_ + startColumnGen_[i+1], elementGen_ + startColumnGen_[i]); } if (columnLower) { columnLowerGen_ = columnLower; for (i = 0; i < numberColumns_; i++) { if (columnLowerGen_[i]) { printf("Non-zero lower bounds not allowed - subtract from model\n"); abort(); } } } else { columnLowerGen_ = NULL; } if (columnUpper) { columnUpperGen_ = columnUpper; } else { columnUpperGen_ = NULL; } // end specific coding if (columnUpper_) { // set all upper bounds so we have enough space double * columnUpper = model->columnUpper(); for(i = firstDynamic_; i < lastDynamic_; i++) columnUpper[i] = 1.0e10; } status_ = new unsigned char [2*numberSets_+4]; if (status) { memcpy(status_,status, numberSets_ * sizeof(char)); assert (dynamicStatus); CoinMemcpyN(dynamicStatus, numberIds, dynamicStatus_); assert (numberIds); } else { assert (!numberIds); memset(status_, 0, numberSets_); for (i = 0; i < numberSets_; i++) { // make slack key setStatus(i, ClpSimplex::basic); } } dynamicStatusGen_ = new unsigned char [numberColumns_]; memset(dynamicStatusGen_, 0, numberColumns_); // for clarity for (i = 0; i < numberColumns_; i++) setDynamicStatusGen(i, atLowerBound); // Populate with enough columns if (!numberIds) { // This could be made more sophisticated for (iSet = 0; iSet < numberSets_; iSet++) { int sequence = fullStartGen_[iSet]; CoinBigIndex start = startColumnGen_[sequence]; addColumn(startColumnGen_[sequence+1] - start, rowGen_ + start, elementGen_ + start, costGen_[sequence], columnLowerGen_ ? columnLowerGen_[sequence] : 0, columnUpperGen_ ? columnUpperGen_[sequence] : 1.0e30, iSet, getDynamicStatusGen(sequence)); idGen_[iSet] = sequence; // say which one in setDynamicStatusGen(sequence, inSmall); } } else { // put back old ones int * set = new int[numberColumns_]; for (iSet = 0; iSet < numberSets_; iSet++) { for (CoinBigIndex j = fullStartGen_[iSet]; j < fullStartGen_[iSet+1]; j++) set[j] = iSet; } for (int i = 0; i < numberIds; i++) { int sequence = ids[i]; int iSet = set[sequence]; CoinBigIndex start = startColumnGen_[sequence]; addColumn(startColumnGen_[sequence+1] - start, rowGen_ + start, elementGen_ + start, costGen_[sequence], columnLowerGen_ ? columnLowerGen_[sequence] : 0, columnUpperGen_ ? columnUpperGen_[sequence] : 1.0e30, iSet, getDynamicStatus(i)); idGen_[i] = sequence; // say which one in setDynamicStatusGen(sequence, inSmall); } delete [] set; } if (!status) { gubCrash(); } else { initialProblem(); } } #endif //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpDynamicExampleMatrix::~ClpDynamicExampleMatrix () { delete [] startColumnGen_; delete [] rowGen_; delete [] elementGen_; delete [] costGen_; delete [] fullStartGen_; delete [] dynamicStatusGen_; delete [] idGen_; delete [] columnLowerGen_; delete [] columnUpperGen_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpDynamicExampleMatrix & ClpDynamicExampleMatrix::operator=(const ClpDynamicExampleMatrix& rhs) { if (this != &rhs) { ClpDynamicMatrix::operator=(rhs); numberColumns_ = rhs.numberColumns_; delete [] startColumnGen_; delete [] rowGen_; delete [] elementGen_; delete [] costGen_; delete [] fullStartGen_; delete [] dynamicStatusGen_; delete [] idGen_; delete [] columnLowerGen_; delete [] columnUpperGen_; startColumnGen_ = ClpCopyOfArray(rhs.startColumnGen_, numberColumns_ + 1); CoinBigIndex numberElements = startColumnGen_[numberColumns_]; rowGen_ = ClpCopyOfArray(rhs.rowGen_, numberElements);; elementGen_ = ClpCopyOfArray(rhs.elementGen_, numberElements);; costGen_ = ClpCopyOfArray(rhs.costGen_, numberColumns_); fullStartGen_ = ClpCopyOfArray(rhs.fullStartGen_, numberSets_ + 1); dynamicStatusGen_ = ClpCopyOfArray(rhs.dynamicStatusGen_, numberColumns_); idGen_ = ClpCopyOfArray(rhs.idGen_, maximumGubColumns_); columnLowerGen_ = ClpCopyOfArray(rhs.columnLowerGen_, numberColumns_); columnUpperGen_ = ClpCopyOfArray(rhs.columnUpperGen_, numberColumns_); } return *this; } //------------------------------------------------------------------- // Clone //------------------------------------------------------------------- ClpMatrixBase * ClpDynamicExampleMatrix::clone() const { return new ClpDynamicExampleMatrix(*this); } // Partial pricing void ClpDynamicExampleMatrix::partialPricing(ClpSimplex * model, double startFraction, double endFraction, int & bestSequence, int & numberWanted) { numberWanted = currentWanted_; assert(!model->rowScale()); if (!numberSets_) { // no gub ClpPackedMatrix::partialPricing(model, startFraction, endFraction, bestSequence, numberWanted); } else { // and do some proportion of full set int startG2 = static_cast (startFraction * numberSets_); int endG2 = static_cast (endFraction * numberSets_ + 0.1); endG2 = CoinMin(endG2, numberSets_); //printf("gub price - set start %d end %d\n", // startG2,endG2); double tolerance = model->currentDualTolerance(); double * reducedCost = model->djRegion(); const double * duals = model->dualRowSolution(); double bestDj; int numberRows = model->numberRows(); int slackOffset = lastDynamic_ + numberRows; int structuralOffset = slackOffset + numberSets_; int structuralOffset2 = structuralOffset + maximumGubColumns_; // If nothing found yet can go all the way to end int endAll = endG2; if (bestSequence < 0 && !startG2) endAll = numberSets_; if (bestSequence >= 0) { if (bestSequence != savedBestSequence_) bestDj = fabs(reducedCost[bestSequence]); // dj from slacks or permanent else bestDj = savedBestDj_; } else { bestDj = tolerance; } int saveSequence = bestSequence; double djMod = 0.0; double bestDjMod = 0.0; //printf("iteration %d start %d end %d - wanted %d\n",model->numberIterations(), // startG2,endG2,numberWanted); int bestSet = -1; int minSet = minimumObjectsScan_ < 0 ? 5 : minimumObjectsScan_; int minNeg = minimumGoodReducedCosts_ < 0 ? 5 : minimumGoodReducedCosts_; for (int iSet = startG2; iSet < endAll; iSet++) { if (numberWanted + minNeg < originalWanted_ && iSet > startG2 + minSet) { // give up numberWanted = 0; break; } else if (iSet == endG2 && bestSequence >= 0) { break; } int gubRow = toIndex_[iSet]; if (gubRow >= 0) { djMod = duals[gubRow+numberStaticRows_]; // have I got sign right? } else { int iBasic = keyVariable_[iSet]; if (iBasic >= numberColumns_) { djMod = 0.0; // set not in } else { // get dj without djMod = 0.0; for (CoinBigIndex j = startColumn_[iBasic]; j < startColumn_[iBasic+1]; j++) { int jRow = row_[j]; djMod -= duals[jRow] * element_[j]; } djMod += cost_[iBasic]; // See if gub slack possible - dj is djMod if (getStatus(iSet) == ClpSimplex::atLowerBound) { double value = -djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = slackOffset + iSet; bestDjMod = djMod; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } else if (getStatus(iSet) == ClpSimplex::atUpperBound) { double value = djMod; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSet)) { bestDj = value; bestSequence = slackOffset + iSet; bestDjMod = djMod; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; abort(); } } } } } } // do ones in small int iSequence = startSet_[iSet]; while (iSequence >= 0) { DynamicStatus status = getDynamicStatus(iSequence); if (status == atLowerBound || status == atUpperBound) { double value = cost_[iSequence] - djMod; for (CoinBigIndex j = startColumn_[iSequence]; j < startColumn_[iSequence+1]; j++) { int jRow = row_[j]; value -= duals[jRow] * element_[j]; } // change sign if at lower bound if (status == atLowerBound) value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flagged(iSequence)) { bestDj = value; bestSequence = structuralOffset + iSequence; bestDjMod = djMod; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; } } } } iSequence = next_[iSequence]; //onto next in set } // and now get best by column generation // If no upper bounds we may not need status test for (iSequence = fullStartGen_[iSet]; iSequence < fullStartGen_[iSet+1]; iSequence++) { DynamicStatus status = getDynamicStatusGen(iSequence); assert (status != atUpperBound && status != soloKey); if (status == atLowerBound) { double value = costGen_[iSequence] - djMod; for (CoinBigIndex j = startColumnGen_[iSequence]; j < startColumnGen_[iSequence+1]; j++) { int jRow = rowGen_[j]; value -= duals[jRow] * elementGen_[j]; } // change sign as at lower bound value = -value; if (value > tolerance) { numberWanted--; if (value > bestDj) { // check flagged variable and correct dj if (!flaggedGen(iSequence)) { bestDj = value; bestSequence = structuralOffset2 + iSequence; bestDjMod = djMod; bestSet = iSet; } else { // just to make sure we don't exit before got something numberWanted++; } } } } } if (numberWanted <= 0) { numberWanted = 0; break; } } if (bestSequence != saveSequence) { savedBestGubDual_ = bestDjMod; savedBestDj_ = bestDj; savedBestSequence_ = bestSequence; savedBestSet_ = bestSet; } // Do packed part before gub // always??? // Resize so just do to gub numberActiveColumns_ = firstDynamic_; int saveMinNeg = minimumGoodReducedCosts_; if (bestSequence >= 0) minimumGoodReducedCosts_ = -2; currentWanted_ = numberWanted; ClpPackedMatrix::partialPricing(model, startFraction, endFraction, bestSequence, numberWanted); numberActiveColumns_ = matrix_->getNumCols(); minimumGoodReducedCosts_ = saveMinNeg; // See if may be finished if (!startG2 && bestSequence < 0) infeasibilityWeight_ = model_->infeasibilityCost(); else if (bestSequence >= 0) infeasibilityWeight_ = -1.0; currentWanted_ = numberWanted; } } /* Creates a variable. This is called after partial pricing and may modify matrix. May update bestSequence. */ void ClpDynamicExampleMatrix::createVariable(ClpSimplex * model, int & bestSequence) { int numberRows = model->numberRows(); int slackOffset = lastDynamic_ + numberRows; int structuralOffset = slackOffset + numberSets_; int bestSequence2 = savedBestSequence_ - structuralOffset; if (bestSequence2 >= 0) { // See if needs new if (bestSequence2 >= maximumGubColumns_) { bestSequence2 -= maximumGubColumns_; int sequence = addColumn(startColumnGen_[bestSequence2+1] - startColumnGen_[bestSequence2], rowGen_ + startColumnGen_[bestSequence2], elementGen_ + startColumnGen_[bestSequence2], costGen_[bestSequence2], columnLowerGen_ ? columnLowerGen_[bestSequence2] : 0, columnUpperGen_ ? columnUpperGen_[bestSequence2] : 1.0e30, savedBestSet_, getDynamicStatusGen(bestSequence2)); savedBestSequence_ = structuralOffset + sequence; idGen_[sequence] = bestSequence2; setDynamicStatusGen(bestSequence2, inSmall); } } ClpDynamicMatrix::createVariable(model, bestSequence/*, bestSequence2*/); // clear for next iteration savedBestSequence_ = -1; } /* If addColumn forces compression then this allows descendant to know what to do. If >=0 then entry stayed in, if -1 then entry went out to lower bound.of zero. Entries at upper bound (really nonzero) never go out (at present). */ void ClpDynamicExampleMatrix::packDown(const int * in, int numberToPack) { int put = 0; for (int i = 0; i < numberToPack; i++) { int id = idGen_[i]; if (in[i] >= 0) { // stays in assert (put == in[i]); // true for now idGen_[put++] = id; } else { // out to lower bound setDynamicStatusGen(id, atLowerBound); } } assert (put == numberGubColumns_); } CoinMP-1.8.3/Clp/src/CoinAbcBaseFactorization4.cpp0000644000175000017500000045454512452503025020256 0ustar renerene/* $Id: CoinAbcBaseFactorization4.cpp 2078 2015-01-05 12:39:49Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifdef ABC_JUST_ONE_FACTORIZATION #include "CoinAbcCommonFactorization.hpp" #define CoinAbcTypeFactorization CoinAbcBaseFactorization #define ABC_SMALL -1 #include "CoinAbcBaseFactorization.hpp" #endif #ifdef CoinAbcTypeFactorization #include "CoinIndexedVector.hpp" #include "CoinHelperFunctions.hpp" #include "CoinAbcHelperFunctions.hpp" #if CILK_CONFLICT>0 // for conflicts extern int cilk_conflict; #endif //:class CoinAbcTypeFactorization. Deals with Factorization and Updates #if ABC_SMALL<2 // getColumnSpaceIterateR. Gets space for one extra R element in Column //may have to do compression (returns true) //also moves existing vector bool CoinAbcTypeFactorization::getColumnSpaceIterateR ( CoinSimplexInt iColumn, CoinFactorizationDouble value, CoinSimplexInt iRow) { CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_ + lengthAreaR_; CoinSimplexInt * COIN_RESTRICT indexRowR = indexRowRAddress_ + lengthAreaR_; CoinBigIndex * COIN_RESTRICT startR = startColumnRAddress_+maximumPivots_+1; CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; CoinSimplexInt number = numberInColumnPlus[iColumn]; //*** modify so sees if can go in //see if it can go in at end CoinSimplexInt * COIN_RESTRICT nextColumn = nextColumnAddress_; CoinSimplexInt * COIN_RESTRICT lastColumn = lastColumnAddress_; if (lengthAreaR_-startR[maximumRowsExtra_] (put + 4) ,lengthAreaR_); return true; } #endif CoinSimplexInt CoinAbcTypeFactorization::checkPivot(CoinSimplexDouble saveFromU, CoinSimplexDouble oldPivot) const { CoinSimplexInt status; if ( fabs ( saveFromU ) > 1.0e-8 ) { CoinFactorizationDouble checkTolerance; if ( numberRowsExtra_ < numberRows_ + 2 ) { checkTolerance = 1.0e-5; } else if ( numberRowsExtra_ < numberRows_ + 10 ) { checkTolerance = 1.0e-6; } else if ( numberRowsExtra_ < numberRows_ + 50 ) { checkTolerance = 1.0e-8; } else { checkTolerance = 1.0e-10; } checkTolerance *= relaxCheck_; if ( fabs ( 1.0 - fabs ( saveFromU / oldPivot ) ) < checkTolerance ) { status = 0; } else { #if COIN_DEBUG std::cout <<"inaccurate pivot "<< oldPivot << " " << saveFromU << std::endl; #endif if ( fabs ( fabs ( oldPivot ) - fabs ( saveFromU ) ) < 1.0e-12 || fabs ( 1.0 - fabs ( saveFromU / oldPivot ) ) < 1.0e-8 ) { status = 1; } else { status = 2; } } } else { //error status = 2; #if COIN_DEBUG std::cout <<"inaccurate pivot "<< saveFromU / oldPivot << " " << saveFromU << std::endl; #endif } return status; } #define INLINE_IT #define INLINE_IT2 #define INLINE_IT3 #define UNROLL 0 inline void scatterUpdateInline(CoinSimplexInt number, CoinFactorizationDouble pivotValue, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const CoinSimplexInt * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { #if UNROLL==0 for (CoinBigIndex j=number-1 ; j >=0; j-- ) { CoinSimplexInt iRow = thisIndex[j]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[j]; assert (value); region[iRow] = regionValue - value * pivotValue; } #elif UNROLL==1 if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } #elif UNROLL==2 CoinSimplexInt iRow0; CoinSimplexInt iRow1; CoinFactorizationDouble regionValue0; CoinFactorizationDouble regionValue1; switch(number) { case 0: break; case 1: iRow0 = thisIndex[0]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; break; case 2: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; break; case 3: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; break; case 4: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; break; case 5: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; break; case 6: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; break; case 7: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; regionValue0 = region[iRow0]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; break; case 8: iRow0 = thisIndex[0]; iRow1 = thisIndex[1]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[0] * pivotValue; region[iRow1] = regionValue1 - thisElement[1] * pivotValue; iRow0 = thisIndex[2]; iRow1 = thisIndex[3]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[2] * pivotValue; region[iRow1] = regionValue1 - thisElement[3] * pivotValue; iRow0 = thisIndex[4]; iRow1 = thisIndex[5]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[4] * pivotValue; region[iRow1] = regionValue1 - thisElement[5] * pivotValue; iRow0 = thisIndex[6]; iRow1 = thisIndex[7]; regionValue0 = region[iRow0]; regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[6] * pivotValue; region[iRow1] = regionValue1 - thisElement[7] * pivotValue; break; default: if ((number&1)!=0) { number--; CoinSimplexInt iRow = thisIndex[number]; CoinFactorizationDouble regionValue = region[iRow]; CoinFactorizationDouble value = thisElement[number]; region[iRow] = regionValue - value * pivotValue; } for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) { CoinSimplexInt iRow0 = thisIndex[j]; CoinSimplexInt iRow1 = thisIndex[j-1]; CoinFactorizationDouble regionValue0 = region[iRow0]; CoinFactorizationDouble regionValue1 = region[iRow1]; region[iRow0] = regionValue0 - thisElement[j] * pivotValue; region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue; } break; } #endif } inline CoinFactorizationDouble gatherUpdate(CoinSimplexInt number, const CoinFactorizationDouble * COIN_RESTRICT thisElement, const CoinSimplexInt * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { CoinFactorizationDouble pivotValue=0.0; for (CoinBigIndex j = 0; j < number; j ++ ) { CoinFactorizationDouble value = thisElement[j]; CoinSimplexInt jRow = thisIndex[j]; value *= region[jRow]; pivotValue -= value; } return pivotValue; } inline void multiplyIndexed(CoinSimplexInt number, const CoinFactorizationDouble * COIN_RESTRICT multiplier, const CoinSimplexInt * COIN_RESTRICT thisIndex, CoinFactorizationDouble * COIN_RESTRICT region) { for (CoinSimplexInt i = 0; i < number; i ++ ) { CoinSimplexInt iRow = thisIndex[i]; CoinSimplexDouble value = region[iRow]; value *= multiplier[iRow]; region[iRow] = value; } } #if 0 /* Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots Fills in region for use later partial update already in U */ int CoinAbcTypeFactorization::checkReplace ( const AbcSimplex * model, CoinIndexedVector * regionSparse, int pivotRow, CoinSimplexDouble &pivotCheck, double acceptablePivot) { if ( lengthR_+numberRows_ >= lengthAreaR_ ) { //not enough room return 3; } #ifdef ABC_USE_FUNCTION_POINTERS scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinBigIndex startU = scatter[numberRows_].offset; CoinSimplexInt numberInColumnU2 = scatter[numberRows_].number; CoinFactorizationDouble * COIN_RESTRICT elementU2 = elementUColumnPlus+startU; CoinSimplexInt * COIN_RESTRICT indexU2 = reinterpret_cast(elementU2+numberInColumnU2); #else CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinBigIndex startU = startColumnU[numberRows_]; CoinSimplexInt * COIN_RESTRICT indexU2 = &indexRowUAddress_[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU2 = &elementUAddress_[startU]; CoinSimplexInt numberInColumnU2 = numberInColumn[numberRows_]; #endif if ( lengthU_+numberInColumnU2 >= lengthAreaU_ ) { //not enough room return 3; } #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT numberInRowU = numberInRowAddress_; #endif //zeroed out region CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; CoinFactorizationDouble oldPivot = pivotRegion[pivotRow]; // for accuracy check pivotCheck = pivotCheck / oldPivot; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex saveStart = startColumnU[pivotRow]; CoinBigIndex saveEnd = saveStart + numberInColumn[pivotRow]; #endif //get entries in row (pivot not stored) CoinSimplexInt numberNonZero = 0; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; #endif #if CONVERTROW CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; #if CONVERTROW>2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif #if ABC_SMALL<2 CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; #endif CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinSimplexInt status=0; #ifndef ABC_USE_FUNCTION_POINTERS CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; #endif #ifndef NDEBUG #if CONVERTROW #define CONVERTDEBUG #endif #endif int nInRow; #if ABC_SMALL<2 CoinBigIndex start=0; CoinBigIndex end=0; if (gotUCopy()) { start=startRowU[pivotRow]; nInRow=numberInRowU[pivotRow]; end= start + nInRow; CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1]; CoinSimplexInt * COIN_RESTRICT pivotRowForward = pivotColumnAddress_; if (nInRow<10) { CoinSimplexInt smallest=numberRowsExtra_; for (CoinBigIndex i = start; i < end ; i ++ ) { CoinSimplexInt jColumn = indexColumnU[i]; if (pivotRowForward[jColumn]setNumElements ( numberNonZero ); if (numberNonZero) { assert (smallestIndex>=0); #ifndef NDEBUG const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedForwardsAddress_; CoinSimplexInt jRow=pivotLinked[-1]; if (jRow!=smallestIndex) { while (jRow>=0) { CoinFactorizationDouble pivotValue = region[jRow]; if (pivotValue) break; jRow=pivotLinked[jRow]; } assert (jRow==smallestIndex); } #endif //smallestIndex=pivotLinkedForwardsAddress_[-1]; updateColumnTransposeU ( regionSparse, smallestIndex #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif #if ABC_PARALLEL ,0 #endif ); } } else { #endif #if ABC_SMALL>=0 // No row copy check space CoinSimplexInt * COIN_RESTRICT indexRowR = indexRowRAddress_; CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_; CoinBigIndex COIN_RESTRICT * deletedPosition = reinterpret_cast(elementR+lengthR_); CoinSimplexInt COIN_RESTRICT * deletedColumns = reinterpret_cast(indexRowR+lengthR_); nInRow=replaceColumnU(regionSparse,deletedPosition,deletedColumns,pivotRow); #endif #if ABC_SMALL<2 } #endif numberNonZero = regionSparse->getNumElements ( ); //printf("replace nels %d\n",numberNonZero); CoinFactorizationDouble saveFromU = 0.0; for (CoinBigIndex i = 0; i < numberInColumnU2; i++ ) { CoinSimplexInt iRow = indexU2[i]; if ( iRow != pivotRow ) { saveFromU -= elementU2[i] * region[iRow]; } else { saveFromU += elementU2[i]; } } //check accuracy status = checkPivot(saveFromU,pivotCheck); if (status==1&&!numberPivots_) { printf("check status ok\n"); status=2; } pivotCheck=saveFromU; return status; } // replaceColumn. Replaces one Column to basis // returns 0=OK, 1=Probably OK, 2=singular, 3=no room //partial update already in U CoinSimplexInt CoinAbcTypeFactorization::replaceColumn ( CoinIndexedVector * regionSparse, CoinSimplexInt pivotRow, CoinSimplexDouble pivotCheck , bool skipBtranU, CoinSimplexDouble ) { assert (numberU_<=numberRowsExtra_); #ifndef ALWAYS_SKIP_BTRAN //return at once if too many iterations if ( numberRowsExtra_ >= maximumRowsExtra_ ) { return 5; } if ( lengthAreaU_ < lastEntryByColumnU_ ) { return 3; } #endif #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; #endif CoinSimplexInt * COIN_RESTRICT indexRowR = indexRowRAddress_; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT numberInRowU = numberInRowAddress_; #endif #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; #endif CoinSimplexInt * COIN_RESTRICT permuteLookup = pivotColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); //take out old pivot column #ifndef ABC_USE_FUNCTION_POINTERS totalElements_ -= numberInColumn[pivotRow]; #else scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); extern scatterUpdate AbcScatterLowSubtract[9]; extern scatterUpdate AbcScatterHighSubtract[4]; CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinBigIndex startU = scatter[numberRows_].offset; totalElements_ -= scatter[pivotRow].number; CoinBigIndex saveStart = scatter[pivotRow].offset; CoinBigIndex saveEnd = scatter[pivotRow].number; scatter[pivotRow].offset=startU; CoinSimplexInt numberInColumnU2 = scatter[numberRows_].number; CoinFactorizationDouble * COIN_RESTRICT elementU2 = elementUColumnPlus+startU; CoinSimplexInt * COIN_RESTRICT indexU2 = reinterpret_cast(elementU2+numberInColumnU2); #endif #ifndef ALWAYS_SKIP_BTRAN #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex saveStart = startColumnU[pivotRow]; CoinBigIndex saveEnd = saveStart + numberInColumn[pivotRow]; #endif #endif //get entries in row (pivot not stored) CoinSimplexInt numberNonZero = 0; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; #endif #if CONVERTROW CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; #if CONVERTROW>2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif #if ABC_SMALL<2 CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; #endif CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinFactorizationDouble pivotValue = 1.0; CoinSimplexInt status=0; #ifndef ABC_USE_FUNCTION_POINTERS CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; #endif CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_; #ifndef NDEBUG #if CONVERTROW #define CONVERTDEBUG #endif #endif int nInRow; #if ABC_SMALL<2 CoinBigIndex start=0; CoinBigIndex end=0; if (gotUCopy()) { start=startRowU[pivotRow]; nInRow=numberInRowU[pivotRow]; end= start + nInRow; } #endif CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; #ifndef ALWAYS_SKIP_BTRAN if (!skipBtranU) { CoinFactorizationDouble oldPivot = pivotRegion[pivotRow]; // for accuracy check pivotCheck = pivotCheck / oldPivot; #if ABC_SMALL<2 if (gotUCopy()) { CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1]; CoinSimplexInt * COIN_RESTRICT pivotRowForward = pivotColumnAddress_; if (nInRow<10) { CoinSimplexInt smallest=numberRowsExtra_; for (CoinBigIndex i = start; i < end ; i ++ ) { CoinSimplexInt jColumn = indexColumnU[i]; if (pivotRowForward[jColumn]setNumElements ( numberNonZero ); if (numberNonZero) { assert (smallestIndex>=0); #ifndef NDEBUG const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedForwardsAddress_; CoinSimplexInt jRow=pivotLinked[-1]; if (jRow!=smallestIndex) { while (jRow>=0) { CoinFactorizationDouble pivotValue = region[jRow]; if (pivotValue) break; jRow=pivotLinked[jRow]; } assert (jRow==smallestIndex); } #endif //smallestIndex=pivotLinkedForwardsAddress_[-1]; updateColumnTransposeU ( regionSparse, smallestIndex #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif #if ABC_PARALLEL ,0 #endif ); } } else { #endif #if ABC_SMALL>=0 // No row copy check space if ( lengthR_ + numberRows_>= lengthAreaR_ ) { //not enough room return 3; } CoinBigIndex COIN_RESTRICT * deletedPosition = reinterpret_cast(elementR+lengthR_); CoinSimplexInt COIN_RESTRICT * deletedColumns = reinterpret_cast(indexRowR+lengthR_); nInRow=replaceColumnU(regionSparse,deletedPosition,deletedColumns,pivotRow); #endif #if ABC_SMALL<2 } #endif } #endif numberNonZero = regionSparse->getNumElements ( ); CoinFactorizationDouble saveFromU = 0.0; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex startU = startColumnU[numberRows_]; startColumnU[pivotRow]=startU; CoinSimplexInt * COIN_RESTRICT indexU2 = &indexRowUAddress_[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU2 = &elementUAddress_[startU]; CoinSimplexInt numberInColumnU2 = numberInColumn[numberRows_]; #else //CoinSimplexInt numberInColumnU2 = scatter[numberRows_].number; #endif instrument_do("CoinAbcFactorizationReplaceColumn",2*numberRows_+4*numberInColumnU2); #ifndef ALWAYS_SKIP_BTRAN if (!skipBtranU) { for (CoinBigIndex i = 0; i < numberInColumnU2; i++ ) { CoinSimplexInt iRow = indexU2[i]; if ( iRow != pivotRow ) { saveFromU -= elementU2[i] * region[iRow]; } else { saveFromU += elementU2[i]; } } //check accuracy status = checkPivot(saveFromU,pivotCheck); } else { status=0; saveFromU=pivotCheck; } //regionSparse->print(); #endif if (status>1||(status==1&&!numberPivots_)) { // restore some things //pivotRegion[pivotRow] = oldPivot; CoinSimplexInt number = saveEnd-saveStart; totalElements_ += number; //numberInColumn[pivotRow]=number; regionSparse->clear(); return status; } else { pivotValue = 1.0 / saveFromU; // do what we would have done by now #if ABC_SMALL<2 if (gotUCopy()) { for (CoinBigIndex i = start; i < end ; i ++ ) { CoinSimplexInt jColumn = indexColumnU[i]; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex startColumn = startColumnU[jColumn]; #if CONVERTROW CoinBigIndex j = convertRowToColumn[i]; #else CoinBigIndex j; int number = numberInColumn[jColumn]; for (j=0;j(area+k+1); #if CONVERTROW CoinSimplexInt j = convertRowToColumn[i]; #else CoinSimplexInt j; for (j=0;j=0 // no row copy CoinBigIndex COIN_RESTRICT * deletedPosition = reinterpret_cast(elementR+lengthR_); CoinSimplexInt COIN_RESTRICT * deletedColumns = reinterpret_cast(indexRowR+lengthR_); for (CoinSimplexInt i = 0; i < nInRow ; i ++ ) { CoinBigIndex j = deletedPosition[i]; CoinSimplexInt jColumn = deletedColumns[i]; // swap CoinSimplexInt k = numberInColumn[jColumn]-1; numberInColumn[jColumn]=k; CoinBigIndex k2 = k+startColumnU[jColumn]; int kRow2=indexRowU[k2]; indexRowU[j]=kRow2; CoinFactorizationDouble value2=elementU[k2]; elementU[j]=value2; } #endif #if ABC_SMALL<2 } #endif } #if ABC_SMALL<2 if (gotUCopy()) { // Now zero out column of U //take out old pivot column #ifdef ABC_USE_FUNCTION_POINTERS CoinFactorizationDouble * COIN_RESTRICT elementU = elementUColumnPlus+saveStart; saveStart=0; CoinSimplexInt * COIN_RESTRICT indexRowU = reinterpret_cast(elementU+saveEnd); #endif for (CoinBigIndex i = saveStart; i < saveEnd ; i ++ ) { //elementU[i] = 0.0; // If too slow then reverse meaning of convertRowToColumn and use int jRow=indexRowU[i]; CoinBigIndex start = startRowU[jRow]; CoinBigIndex end = start + numberInRowU[jRow]; for (CoinBigIndex j = start; j < end ; j ++ ) { CoinSimplexInt jColumn = indexColumnU[j]; if (jColumn==pivotRow) { // swap numberInRowU[jRow]--; elementRowU[j]=elementRowU[end-1]; #if CONVERTROW convertRowToColumn[j]=convertRowToColumn[end-1]; #endif indexColumnU[j]=indexColumnU[end-1]; break; } } } } #endif //zero out pivot Row (before or after?) //add to R CoinBigIndex * COIN_RESTRICT startColumnR = startColumnRAddress_; CoinBigIndex putR = lengthR_; CoinSimplexInt number = numberR_; startColumnR[number] = putR; //for luck and first time number++; //assert (startColumnR+number-firstCountAddress_<( CoinMax(5*numberRows_,2*numberRows_+2*maximumPivots_)+2)); startColumnR[number] = putR + numberNonZero; numberR_ = number; lengthR_ = putR + numberNonZero; totalElements_ += numberNonZero; if ( lengthR_ >= lengthAreaR_ ) { //not enough room regionSparse->clear(); return 3; } if ( lengthU_+numberInColumnU2 >= lengthAreaU_ ) { //not enough room regionSparse->clear(); return 3; } #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT nextRow=NULL; CoinSimplexInt * COIN_RESTRICT lastRow=NULL; CoinSimplexInt next; CoinSimplexInt last; if (gotUCopy()) { //take out row nextRow = nextRowAddress_; lastRow = lastRowAddress_; next = nextRow[pivotRow]; last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; numberInRowU[pivotRow]=0; } #endif //put in pivot //add row counts int n = 0; for (CoinSimplexInt i = 0; i < numberInColumnU2; i++ ) { CoinSimplexInt iRow = indexU2[i]; CoinFactorizationDouble value=elementU2[i]; assert (value); if ( !TEST_LESS_THAN_TOLERANCE(value ) ) { if ( iRow != pivotRow ) { //modify by pivot CoinFactorizationDouble value2 = value*pivotValue; indexU2[n]=iRow; elementU2[n++] = value2; #if ABC_SMALL<2 if (gotUCopy()) { CoinSimplexInt next = nextRow[iRow]; CoinSimplexInt iNumberInRow = numberInRowU[iRow]; CoinBigIndex space; CoinBigIndex put = startRowU[iRow] + iNumberInRow; space = startRowU[next] - put; if ( space <= 0 ) { getRowSpaceIterate ( iRow, iNumberInRow + 4 ); put = startRowU[iRow] + iNumberInRow; } else if (next==numberRows_) { lastEntryByRowU_=put+1; } indexColumnU[put] = pivotRow; #if CONVERTROW convertRowToColumn[put] = i; #endif elementRowU[put] = value2; numberInRowU[iRow] = iNumberInRow + 1; } #endif } else { //swap and save indexU2[i]=indexU2[numberInColumnU2-1]; elementU2[i] = elementU2[numberInColumnU2-1]; numberInColumnU2--; i--; } } else { // swap indexU2[i]=indexU2[numberInColumnU2-1]; elementU2[i] = elementU2[numberInColumnU2-1]; numberInColumnU2--; i--; } } numberInColumnU2=n; //do permute permuteAddress_[numberRowsExtra_] = pivotRow; //and for safety permuteAddress_[numberRowsExtra_ + 1] = 0; //pivotColumnAddress_[pivotRow] = numberRowsExtra_; numberU_++; #if ABC_SMALL<2 if (gotUCopy()) { //in at end last = lastRow[numberRows_]; nextRow[last] = pivotRow; //numberRowsExtra_; lastRow[numberRows_] = pivotRow; //numberRowsExtra_; lastRow[pivotRow] = last; nextRow[pivotRow] = numberRows_; startRowU[pivotRow] = lastEntryByRowU_; } #endif #ifndef ABC_USE_FUNCTION_POINTERS numberInColumn[pivotRow]=numberInColumnU2; #else #if ABC_USE_FUNCTION_POINTERS if (numberInColumnU2<9) { scatter[pivotRow].functionPointer=AbcScatterLowSubtract[numberInColumnU2]; } else { scatter[pivotRow].functionPointer=AbcScatterHighSubtract[numberInColumnU2&3]; } #endif assert(scatter[pivotRow].offset==lastEntryByColumnUPlus_); //CoinFactorizationDouble * COIN_RESTRICT area = elementUColumnPlus+lastEntryByColumnUPlus_; //CoinSimplexInt * COIN_RESTRICT indices = reinterpret_cast(area+numberInColumnU2); if (numberInColumnU2(area)>=0); for (int i=0;i>1; #endif totalElements_ += numberInColumnU2; lengthU_ += numberInColumnU2; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT nextColumn = nextColumnAddress_; CoinSimplexInt * COIN_RESTRICT lastColumn = lastColumnAddress_; if (gotRCopy()) { //column in at beginning (as empty) next = nextColumn[maximumRowsExtra_]; lastColumn[next] = numberRowsExtra_; nextColumn[maximumRowsExtra_] = numberRowsExtra_; nextColumn[numberRowsExtra_] = next; lastColumn[numberRowsExtra_] = maximumRowsExtra_; } #endif #if 0 { int k=-1; for (int i=0;ipivotLinkedForwardsAddress_[-1]); assert (pivotLinkedBackwardsAddress_[numberRows_]>=0); numberRowsExtra_++; numberGoodU_++; numberPivots_++; if ( numberRowsExtra_ > numberRows_ + 50 ) { CoinBigIndex extra = factorElements_ >> 1; if ( numberRowsExtra_ > numberRows_ + 100 + numberRows_ / 500 ) { if ( extra < 2 * numberRows_ ) { extra = 2 * numberRows_; } } else { if ( extra < 5 * numberRows_ ) { extra = 5 * numberRows_; } } CoinBigIndex added = totalElements_ - factorElements_; if ( added > extra && added > ( factorElements_ ) << 1 && !status && 3*totalElements_ > 2*(lengthAreaU_+lengthAreaL_)) { status = 3; if ( messageLevel_ & 4 ) { std::cout << "Factorization has "<< totalElements_ << ", basis had " << factorElements_ <numberInR) { // there is space CoinBigIndex put=startRR[iRow]+numberInR; numberInColumnPlus[iRow]=numberInR+1; indexRowRR[put]=pivotRow; elementRR[put]=value; //add 4 for luck if (next==maximumRowsExtra_) startRR[maximumRowsExtra_] = CoinMin(static_cast (put + 4) ,lengthAreaR_); } else { // no space - do we shuffle? if (!getColumnSpaceIterateR(iRow,value,pivotRow)) { // printf("Need more space for R\n"); numberInColumnPlus_.conditionalDelete(); numberInColumnPlusAddress_=NULL; setNoGotRCopy(); regionSparse->clear(); #if ABC_SMALL<0 status=3; #endif break; } } } } else { #endif for (CoinBigIndex i = 0; i < numberNonZero; i++ ) { CoinSimplexInt iRow = regionIndex[i]; elementR[putR] = region[iRow]; region[iRow]=0.0; indexRowR[putR] = iRow; putR++; } #if ABC_SMALL<2 } #endif #ifdef ABC_USE_FUNCTION_POINTERS #if 0 { CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); extern scatterUpdate AbcScatterLowSubtract[9]; extern scatterUpdate AbcScatterHighSubtract[4]; printf("=============================================start\n"); for (int iRow=0;iRow(area+number); CoinSimplexInt * COIN_RESTRICT indices2 = indexRow+startColumnU[iRow]; CoinFactorizationDouble * COIN_RESTRICT area2 = element+startColumnU[iRow]; //assert (number==numberInColumn[iRow]); #if ABC_USE_FUNCTION_POINTERS if (number<9) assert (scatter[iRow].functionPointer==AbcScatterLowSubtract[number]); else assert (scatter[iRow].functionPointer==AbcScatterHighSubtract[number&3]); #endif if (number) printf("Row %d %d els\n",iRow,number); int n=0; for (int i=0;isetNumElements(0); //for (int i=0;i(elementU2+numberInColumnU2); #else CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinBigIndex startU = startColumnU[numberRows_]; CoinSimplexInt * COIN_RESTRICT indexU2 = &indexRowUAddress_[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU2 = &elementUAddress_[startU]; CoinSimplexInt numberInColumnU2 = numberInColumn[numberRows_]; #endif #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT numberInRowU = numberInRowAddress_; #endif //zeroed out region toLongArray(regionSparse,3); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); //CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex saveStart = startColumnU[pivotRow]; CoinBigIndex saveEnd = saveStart + numberInColumn[pivotRow]; #endif //get entries in row (pivot not stored) CoinSimplexInt numberNonZero = 0; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; #endif #if CONVERTROW #ifndef NDEBUG #define CONVERTDEBUG #endif #ifdef CONVERTDEBUG CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; #endif #if CONVERTROW>2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif #if ABC_SMALL<2 CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; #endif CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); //CoinSimplexInt status=0; #ifndef ABC_USE_FUNCTION_POINTERS CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; #endif int nInRow; #if ABC_SMALL<2 CoinBigIndex start=0; CoinBigIndex end=0; if (gotUCopy()) { start=startRowU[pivotRow]; nInRow=numberInRowU[pivotRow]; end= start + nInRow; CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1]; CoinSimplexInt * COIN_RESTRICT pivotRowForward = pivotColumnAddress_; if (nInRow<10) { CoinSimplexInt smallest=numberRowsExtra_; for (CoinBigIndex i = start; i < end ; i ++ ) { CoinSimplexInt jColumn = indexColumnU[i]; if (pivotRowForward[jColumn]setNumElements ( numberNonZero ); if (numberNonZero) { assert (smallestIndex>=0); #ifndef NDEBUG const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedForwardsAddress_; CoinSimplexInt jRow=pivotLinked[-1]; if (jRow!=smallestIndex) { while (jRow>=0) { CoinFactorizationDouble pivotValue = region[jRow]; if (pivotValue) break; jRow=pivotLinked[jRow]; } assert (jRow==smallestIndex); } #endif #if ABC_PARALLEL==0 //smallestIndex=pivotLinkedForwardsAddress_[-1]; updateColumnTransposeU ( regionSparse, smallestIndex #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif ); #else assert (FACTOR_CPU>3); updateColumnTransposeU ( regionSparse, smallestIndex #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif ,3 ); #endif } } else { #endif #if ABC_SMALL>=0 // No row copy check space CoinSimplexInt * COIN_RESTRICT indexRowR = indexRowRAddress_; CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_; CoinBigIndex COIN_RESTRICT * deletedPosition = reinterpret_cast(elementR+lengthR_); CoinSimplexInt COIN_RESTRICT * deletedColumns = reinterpret_cast(indexRowR+lengthR_); nInRow=replaceColumnU(regionSparse,deletedPosition,deletedColumns,pivotRow); #endif #if ABC_SMALL<2 } #endif if ( lengthR_+numberRows_ >= lengthAreaR_ ) { //not enough room return 0.0; } #ifdef ABC_USE_FUNCTION_POINTERS CoinSimplexInt * COIN_RESTRICT indexU2 = reinterpret_cast(elementU2+numberInColumnU2); #endif if ( lengthU_+numberInColumnU2 >= lengthAreaU_ ) { //not enough room return 0.0; } //CoinSimplexDouble * COIN_RESTRICT region = regionSparse->denseVector ( ); //CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); //CoinSimplexInt status=0; //int numberNonZero = regionSparse->getNumElements ( ); //printf("replace nels %d\n",numberNonZero); CoinFactorizationDouble saveFromU = 0.0; for (CoinBigIndex i = 0; i < numberInColumnU2; i++ ) { CoinSimplexInt iRow = indexU2[i]; if ( iRow != pivotRow ) { saveFromU -= elementU2[i] * region[iRow]; } else { saveFromU += elementU2[i]; } } return saveFromU; } /* Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial update in vector */ #ifdef ABC_LONG_FACTORIZATION long #endif double CoinAbcTypeFactorization::checkReplacePart1 (CoinIndexedVector * regionSparse, CoinIndexedVector * partialUpdate, int pivotRow) { #ifdef ABC_USE_FUNCTION_POINTERS scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinBigIndex startU = scatter[numberRows_].offset; #else CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; #endif CoinSimplexInt * COIN_RESTRICT indexU2 = partialUpdate->getIndices(); CoinFactorizationDouble * COIN_RESTRICT elementU2 = denseVector(partialUpdate); CoinSimplexInt numberInColumnU2 = partialUpdate->getNumElements(); #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT numberInRowU = numberInRowAddress_; #endif //zeroed out region toLongArray(regionSparse,3); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); //CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex saveStart = startColumnU[pivotRow]; CoinBigIndex saveEnd = saveStart + numberInColumn[pivotRow]; #endif //get entries in row (pivot not stored) CoinSimplexInt numberNonZero = 0; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; #endif #if CONVERTROW #ifndef NDEBUG #define CONVERTDEBUG #endif #ifdef CONVERTDEBUG CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; #endif #if CONVERTROW>2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif #if ABC_SMALL<2 CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; #endif CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); //CoinSimplexInt status=0; #ifndef ABC_USE_FUNCTION_POINTERS CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; #endif int nInRow; #if ABC_SMALL<2 CoinBigIndex start=0; CoinBigIndex end=0; if (gotUCopy()) { start=startRowU[pivotRow]; nInRow=numberInRowU[pivotRow]; end= start + nInRow; CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1]; CoinSimplexInt * COIN_RESTRICT pivotRowForward = pivotColumnAddress_; if (nInRow<10) { CoinSimplexInt smallest=numberRowsExtra_; for (CoinBigIndex i = start; i < end ; i ++ ) { CoinSimplexInt jColumn = indexColumnU[i]; if (pivotRowForward[jColumn]setNumElements ( numberNonZero ); if (numberNonZero) { assert (smallestIndex>=0); #ifndef NDEBUG const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedForwardsAddress_; CoinSimplexInt jRow=pivotLinked[-1]; if (jRow!=smallestIndex) { while (jRow>=0) { CoinFactorizationDouble pivotValue = region[jRow]; if (pivotValue) break; jRow=pivotLinked[jRow]; } assert (jRow==smallestIndex); } #endif #if ABC_PARALLEL==0 //smallestIndex=pivotLinkedForwardsAddress_[-1]; updateColumnTransposeU ( regionSparse, smallestIndex #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif ); #else assert (FACTOR_CPU>3); updateColumnTransposeU ( regionSparse, smallestIndex #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif ,3 ); #endif } } else { #endif #if ABC_SMALL>=0 // No row copy check space CoinSimplexInt * COIN_RESTRICT indexRowR = indexRowRAddress_; CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_; CoinBigIndex COIN_RESTRICT * deletedPosition = reinterpret_cast(elementR+lengthR_); CoinSimplexInt COIN_RESTRICT * deletedColumns = reinterpret_cast(indexRowR+lengthR_); nInRow=replaceColumnU(regionSparse,deletedPosition,deletedColumns,pivotRow); #endif #if ABC_SMALL<2 } #endif if ( lengthR_+numberRows_ >= lengthAreaR_ ) { //not enough room return 0.0; } if ( lengthU_+numberInColumnU2 >= lengthAreaU_ ) { //not enough room partialUpdate->clear(); return 0.0; } //CoinSimplexDouble * COIN_RESTRICT region = regionSparse->denseVector ( ); //CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); //CoinSimplexInt status=0; //int numberNonZero = regionSparse->getNumElements ( ); //printf("replace nels %d\n",numberNonZero); CoinFactorizationDouble saveFromU = 0.0; for (CoinBigIndex i = 0; i < numberInColumnU2; i++ ) { CoinSimplexInt iRow = indexU2[i]; if ( iRow != pivotRow ) { saveFromU -= elementU2[iRow] * region[iRow]; } else { saveFromU += elementU2[iRow]; } } return saveFromU; } #ifdef MOVE_REPLACE_PART1A /* Checks if can replace one Column in basis, returns update alpha Fills in region for use later partial update already in U */ void CoinAbcTypeFactorization::checkReplacePart1a (CoinIndexedVector * regionSparse, int pivotRow) { #ifdef ABC_USE_FUNCTION_POINTERS scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinBigIndex startU = scatter[numberRows_].offset; CoinSimplexInt numberInColumnU2 = scatter[numberRows_].number; CoinFactorizationDouble * COIN_RESTRICT elementU2 = elementUColumnPlus+startU; //CoinSimplexInt * COIN_RESTRICT indexU2 = reinterpret_cast(elementU2+numberInColumnU2); #else CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinBigIndex startU = startColumnU[numberRows_]; CoinSimplexInt * COIN_RESTRICT indexU2 = &indexRowUAddress_[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU2 = &elementUAddress_[startU]; CoinSimplexInt numberInColumnU2 = numberInColumn[numberRows_]; #endif #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT numberInRowU = numberInRowAddress_; #endif //zeroed out region CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); //CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex saveStart = startColumnU[pivotRow]; CoinBigIndex saveEnd = saveStart + numberInColumn[pivotRow]; #endif //get entries in row (pivot not stored) CoinSimplexInt numberNonZero = 0; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; #endif #if CONVERTROW #ifndef NDEBUG #define CONVERTDEBUG #endif #ifdef CONVERTDEBUG CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; #endif #if CONVERTROW>2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif #if ABC_SMALL<2 CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; #endif CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); //CoinSimplexInt status=0; #ifndef ABC_USE_FUNCTION_POINTERS CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; #endif int nInRow; #if ABC_SMALL<2 CoinBigIndex start=0; CoinBigIndex end=0; if (gotUCopy()) { start=startRowU[pivotRow]; nInRow=numberInRowU[pivotRow]; end= start + nInRow; CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1]; CoinSimplexInt * COIN_RESTRICT pivotRowForward = pivotColumnAddress_; if (nInRow<10) { CoinSimplexInt smallest=numberRowsExtra_; for (CoinBigIndex i = start; i < end ; i ++ ) { CoinSimplexInt jColumn = indexColumnU[i]; if (pivotRowForward[jColumn]setNumElements ( numberNonZero ); if (numberNonZero) { assert (smallestIndex>=0); #ifndef NDEBUG const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedForwardsAddress_; CoinSimplexInt jRow=pivotLinked[-1]; if (jRow!=smallestIndex) { while (jRow>=0) { CoinFactorizationDouble pivotValue = region[jRow]; if (pivotValue) break; jRow=pivotLinked[jRow]; } assert (jRow==smallestIndex); } #endif #if ABC_PARALLEL==0 //smallestIndex=pivotLinkedForwardsAddress_[-1]; updateColumnTransposeU ( regionSparse, smallestIndex #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif ); #else assert (FACTOR_CPU>3); updateColumnTransposeU ( regionSparse, smallestIndex #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif ,3 ); #endif } } else { #endif #if ABC_SMALL>=0 // No row copy check space CoinSimplexInt * COIN_RESTRICT indexRowR = indexRowRAddress_; CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_; CoinBigIndex COIN_RESTRICT * deletedPosition = reinterpret_cast(elementR+lengthR_); CoinSimplexInt COIN_RESTRICT * deletedColumns = reinterpret_cast(indexRowR+lengthR_); nInRow=replaceColumnU(regionSparse,deletedPosition,deletedColumns,pivotRow); #endif #if ABC_SMALL<2 } #endif } #ifdef ABC_LONG_FACTORIZATION long #endif double CoinAbcTypeFactorization::checkReplacePart1b (CoinIndexedVector * regionSparse, int pivotRow) { if ( lengthR_+numberRows_ >= lengthAreaR_ ) { //not enough room return 0.0; } #ifdef ABC_USE_FUNCTION_POINTERS scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinBigIndex startU = scatter[numberRows_].offset; CoinSimplexInt numberInColumnU2 = scatter[numberRows_].number; CoinFactorizationDouble * COIN_RESTRICT elementU2 = elementUColumnPlus+startU; CoinSimplexInt * COIN_RESTRICT indexU2 = reinterpret_cast(elementU2+numberInColumnU2); #else CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; CoinBigIndex startU = startColumnU[numberRows_]; CoinSimplexInt * COIN_RESTRICT indexU2 = &indexRowUAddress_[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU2 = &elementUAddress_[startU]; CoinSimplexInt numberInColumnU2 = numberInColumn[numberRows_]; #endif if ( lengthU_+numberInColumnU2 >= lengthAreaU_ ) { //not enough room return 0.0; } CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); //CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); //CoinSimplexInt status=0; //int numberNonZero = regionSparse->getNumElements ( ); //printf("replace nels %d\n",numberNonZero); CoinFactorizationDouble saveFromU = 0.0; for (CoinBigIndex i = 0; i < numberInColumnU2; i++ ) { CoinSimplexInt iRow = indexU2[i]; if ( iRow != pivotRow ) { saveFromU -= elementU2[i] * region[iRow]; } else { saveFromU += elementU2[i]; } } return saveFromU; } #endif #include "AbcSimplex.hpp" /* Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */ int CoinAbcTypeFactorization::checkReplacePart2 ( int pivotRow, CoinSimplexDouble /*btranAlpha*/, CoinSimplexDouble ftranAlpha, #ifdef ABC_LONG_FACTORIZATION long #endif double ftAlpha, double /*acceptablePivot*/) { if ( lengthR_+numberRows_ >= lengthAreaR_ ) { //not enough room return 3; } CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; CoinFactorizationDouble oldPivot = pivotRegion[pivotRow]; // for accuracy check CoinFactorizationDouble pivotCheck = ftranAlpha / oldPivot; //check accuracy int status = checkPivot(ftAlpha,pivotCheck); if (status==1&&!numberPivots_) { printf("check status ok\n"); status=2; } return status; } /* Replaces one Column to basis, partial update already in U */ void CoinAbcTypeFactorization::replaceColumnPart3 ( const AbcSimplex * /*model*/, CoinIndexedVector * regionSparse, CoinIndexedVector * /*tableauColumn*/, int pivotRow, #ifdef ABC_LONG_FACTORIZATION long #endif double alpha ) { assert (numberU_<=numberRowsExtra_); #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT elementU = elementUAddress_; #endif CoinSimplexInt * COIN_RESTRICT indexRowR = indexRowRAddress_; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT numberInRowU = numberInRowAddress_; #endif #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT numberInColumnPlus = numberInColumnPlusAddress_; #endif CoinSimplexInt * COIN_RESTRICT permuteLookup = pivotColumnAddress_; CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); //take out old pivot column #ifndef ABC_USE_FUNCTION_POINTERS totalElements_ -= numberInColumn[pivotRow]; #else scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); #if ABC_USE_FUNCTION_POINTERS extern scatterUpdate AbcScatterLowSubtract[9]; extern scatterUpdate AbcScatterHighSubtract[4]; #endif CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinBigIndex startU = scatter[numberRows_].offset; totalElements_ -= scatter[pivotRow].number; CoinBigIndex saveStart = scatter[pivotRow].offset; CoinBigIndex saveEnd = scatter[pivotRow].number; scatter[pivotRow].offset=startU; CoinSimplexInt numberInColumnU2 = scatter[numberRows_].number; CoinFactorizationDouble * COIN_RESTRICT elementU2 = elementUColumnPlus+startU; CoinSimplexInt * COIN_RESTRICT indexU2 = reinterpret_cast(elementU2+numberInColumnU2); #endif //get entries in row (pivot not stored) CoinSimplexInt numberNonZero = 0; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; #endif #if CONVERTROW CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; #if CONVERTROW>2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif #if ABC_SMALL<2 CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; #endif CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinFactorizationDouble pivotValue = 1.0; CoinSimplexInt status=0; #ifndef ABC_USE_FUNCTION_POINTERS CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; #endif CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_; #ifndef NDEBUG #if CONVERTROW #define CONVERTDEBUG #endif #endif int nInRow=9999999; // ? what if ABC_SMALL==0 or ABC_SMALL==1 #if ABC_SMALL<2 CoinBigIndex start=0; CoinBigIndex end=0; if (gotUCopy()) { start=startRowU[pivotRow]; nInRow=numberInRowU[pivotRow]; end= start + nInRow; } #endif CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; numberNonZero = regionSparse->getNumElements ( ); //CoinFactorizationDouble saveFromU = 0.0; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex startU = startColumnU[numberRows_]; startColumnU[pivotRow]=startU; CoinSimplexInt * COIN_RESTRICT indexU2 = &indexRowUAddress_[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU2 = &elementUAddress_[startU]; CoinSimplexInt numberInColumnU2 = numberInColumn[numberRows_]; #else //CoinSimplexInt numberInColumnU2 = scatter[numberRows_].number; #endif instrument_do("CoinAbcFactorizationReplaceColumn",2*numberRows_+4*numberInColumnU2); pivotValue = 1.0 / alpha; #if ABC_SMALL<2 if (gotUCopy()) { for (CoinBigIndex i = start; i < end ; i ++ ) { CoinSimplexInt jColumn = indexColumnU[i]; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex startColumn = startColumnU[jColumn]; #if CONVERTROW CoinBigIndex j = convertRowToColumn[i]; #else CoinBigIndex j; int number = numberInColumn[jColumn]; for (j=0;j(area+k+1); #if CONVERTROW CoinSimplexInt j = convertRowToColumn[i]; #else CoinSimplexInt j; for (j=0;j=0 assert(nInRow!=9999999); // ? what if ABC_SMALL==0 or ABC_SMALL==1 // no row copy CoinBigIndex COIN_RESTRICT * deletedPosition = reinterpret_cast(elementR+lengthR_); CoinSimplexInt COIN_RESTRICT * deletedColumns = reinterpret_cast(indexRowR+lengthR_); for (CoinSimplexInt i = 0; i < nInRow ; i ++ ) { CoinBigIndex j = deletedPosition[i]; CoinSimplexInt jColumn = deletedColumns[i]; // swap CoinSimplexInt k = numberInColumn[jColumn]-1; numberInColumn[jColumn]=k; CoinBigIndex k2 = k+startColumnU[jColumn]; int kRow2=indexRowU[k2]; indexRowU[j]=kRow2; CoinFactorizationDouble value2=elementU[k2]; elementU[j]=value2; } #endif #if ABC_SMALL<2 } #endif #if ABC_SMALL<2 if (gotUCopy()) { // Now zero out column of U //take out old pivot column #ifdef ABC_USE_FUNCTION_POINTERS CoinFactorizationDouble * COIN_RESTRICT elementU = elementUColumnPlus+saveStart; saveStart=0; CoinSimplexInt * COIN_RESTRICT indexRowU = reinterpret_cast(elementU+saveEnd); #endif for (CoinBigIndex i = saveStart; i < saveEnd ; i ++ ) { //elementU[i] = 0.0; // If too slow then reverse meaning of convertRowToColumn and use int jRow=indexRowU[i]; CoinBigIndex start = startRowU[jRow]; CoinBigIndex end = start + numberInRowU[jRow]; for (CoinBigIndex j = start; j < end ; j ++ ) { CoinSimplexInt jColumn = indexColumnU[j]; if (jColumn==pivotRow) { // swap numberInRowU[jRow]--; elementRowU[j]=elementRowU[end-1]; #if CONVERTROW convertRowToColumn[j]=convertRowToColumn[end-1]; #endif indexColumnU[j]=indexColumnU[end-1]; break; } } } } #endif //zero out pivot Row (before or after?) //add to R CoinBigIndex * COIN_RESTRICT startColumnR = startColumnRAddress_; CoinBigIndex putR = lengthR_; CoinSimplexInt number = numberR_; startColumnR[number] = putR; //for luck and first time number++; //assert (startColumnR+number-firstCountAddress_<( CoinMax(5*numberRows_,2*numberRows_+2*maximumPivots_)+2)); startColumnR[number] = putR + numberNonZero; numberR_ = number; lengthR_ = putR + numberNonZero; totalElements_ += numberNonZero; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT nextRow=NULL; CoinSimplexInt * COIN_RESTRICT lastRow=NULL; CoinSimplexInt next; CoinSimplexInt last; if (gotUCopy()) { //take out row nextRow = nextRowAddress_; lastRow = lastRowAddress_; next = nextRow[pivotRow]; last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; numberInRowU[pivotRow]=0; } #endif //put in pivot //add row counts int n = 0; for (CoinSimplexInt i = 0; i < numberInColumnU2; i++ ) { CoinSimplexInt iRow = indexU2[i]; CoinFactorizationDouble value=elementU2[i]; assert (value); if ( !TEST_LESS_THAN_TOLERANCE(value ) ) { if ( iRow != pivotRow ) { //modify by pivot CoinFactorizationDouble value2 = value*pivotValue; indexU2[n]=iRow; elementU2[n++] = value2; #if ABC_SMALL<2 if (gotUCopy()) { CoinSimplexInt next = nextRow[iRow]; CoinSimplexInt iNumberInRow = numberInRowU[iRow]; CoinBigIndex space; CoinBigIndex put = startRowU[iRow] + iNumberInRow; space = startRowU[next] - put; if ( space <= 0 ) { getRowSpaceIterate ( iRow, iNumberInRow + 4 ); put = startRowU[iRow] + iNumberInRow; } else if (next==numberRows_) { lastEntryByRowU_=put+1; } indexColumnU[put] = pivotRow; #if CONVERTROW convertRowToColumn[put] = i; #endif elementRowU[put] = value2; numberInRowU[iRow] = iNumberInRow + 1; } #endif } else { //swap and save indexU2[i]=indexU2[numberInColumnU2-1]; elementU2[i] = elementU2[numberInColumnU2-1]; numberInColumnU2--; i--; } } else { // swap indexU2[i]=indexU2[numberInColumnU2-1]; elementU2[i] = elementU2[numberInColumnU2-1]; numberInColumnU2--; i--; } } numberInColumnU2=n; //do permute permuteAddress_[numberRowsExtra_] = pivotRow; //and for safety permuteAddress_[numberRowsExtra_ + 1] = 0; //pivotColumnAddress_[pivotRow] = numberRowsExtra_; numberU_++; #if ABC_SMALL<2 if (gotUCopy()) { //in at end last = lastRow[numberRows_]; nextRow[last] = pivotRow; //numberRowsExtra_; lastRow[numberRows_] = pivotRow; //numberRowsExtra_; lastRow[pivotRow] = last; nextRow[pivotRow] = numberRows_; startRowU[pivotRow] = lastEntryByRowU_; } #endif #ifndef ABC_USE_FUNCTION_POINTERS numberInColumn[pivotRow]=numberInColumnU2; #else #if ABC_USE_FUNCTION_POINTERS if (numberInColumnU2<9) { scatter[pivotRow].functionPointer=AbcScatterLowSubtract[numberInColumnU2]; } else { scatter[pivotRow].functionPointer=AbcScatterHighSubtract[numberInColumnU2&3]; } #endif assert(scatter[pivotRow].offset==lastEntryByColumnUPlus_); //CoinFactorizationDouble * COIN_RESTRICT area = elementUColumnPlus+lastEntryByColumnUPlus_; //CoinSimplexInt * COIN_RESTRICT indices = reinterpret_cast(area+numberInColumnU2); if (numberInColumnU2(area)>=0); for (int i=0;i>1; #endif totalElements_ += numberInColumnU2; lengthU_ += numberInColumnU2; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT nextColumn = nextColumnAddress_; CoinSimplexInt * COIN_RESTRICT lastColumn = lastColumnAddress_; if (gotRCopy()) { //column in at beginning (as empty) next = nextColumn[maximumRowsExtra_]; lastColumn[next] = numberRowsExtra_; nextColumn[maximumRowsExtra_] = numberRowsExtra_; nextColumn[numberRowsExtra_] = next; lastColumn[numberRowsExtra_] = maximumRowsExtra_; } #endif #if 0 { int k=-1; for (int i=0;ipivotLinkedForwardsAddress_[-1]); assert (pivotLinkedBackwardsAddress_[numberRows_]>=0); numberRowsExtra_++; numberGoodU_++; numberPivots_++; if ( numberRowsExtra_ > numberRows_ + 50 ) { CoinBigIndex extra = factorElements_ >> 1; if ( numberRowsExtra_ > numberRows_ + 100 + numberRows_ / 500 ) { if ( extra < 2 * numberRows_ ) { extra = 2 * numberRows_; } } else { if ( extra < 5 * numberRows_ ) { extra = 5 * numberRows_; } } CoinBigIndex added = totalElements_ - factorElements_; if ( added > extra && added > ( factorElements_ ) << 1 && !status && 3*totalElements_ > 2*(lengthAreaU_+lengthAreaL_)) { status = 3; if ( messageLevel_ & 4 ) { std::cout << "Factorization has "<< totalElements_ << ", basis had " << factorElements_ <numberInR) { // there is space CoinBigIndex put=startRR[iRow]+numberInR; numberInColumnPlus[iRow]=numberInR+1; indexRowRR[put]=pivotRow; elementRR[put]=value; //add 4 for luck if (next==maximumRowsExtra_) startRR[maximumRowsExtra_] = CoinMin(static_cast (put + 4) ,lengthAreaR_); } else { // no space - do we shuffle? if (!getColumnSpaceIterateR(iRow,value,pivotRow)) { // printf("Need more space for R\n"); numberInColumnPlus_.conditionalDelete(); numberInColumnPlusAddress_=NULL; setNoGotRCopy(); regionSparse->clear(); #if ABC_SMALL<0 abort(); status=3; #endif break; } } } } else { #endif for (CoinBigIndex i = 0; i < numberNonZero; i++ ) { CoinSimplexInt iRow = regionIndex[i]; elementR[putR] = region[iRow]; region[iRow]=0.0; indexRowR[putR] = iRow; putR++; } #if ABC_SMALL<2 } #endif #ifdef ABC_USE_FUNCTION_POINTERS #if 0 { CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); extern scatterUpdate AbcScatterLowSubtract[9]; extern scatterUpdate AbcScatterHighSubtract[4]; printf("=============================================start\n"); for (int iRow=0;iRow(area+number); CoinSimplexInt * COIN_RESTRICT indices2 = indexRow+startColumnU[iRow]; CoinFactorizationDouble * COIN_RESTRICT area2 = element+startColumnU[iRow]; //assert (number==numberInColumn[iRow]); #if ABC_USE_FUNCTION_POINTERS if (number<9) assert (scatter[iRow].functionPointer==AbcScatterLowSubtract[number]); else assert (scatter[iRow].functionPointer==AbcScatterHighSubtract[number&3]); #endif if (number) printf("Row %d %d els\n",iRow,number); int n=0; for (int i=0;isetNumElements(0); fromLongArray(regionSparse); #if 0 static int arrayF[6]={1,1,1,1,1,1}; static int arrayB[6]={1,1,1,1,1,1}; static int arrayF1[6]={1,1,1,1,1,1}; static int arrayB1[6]={1,1,1,1,1,1}; static int itry=0; { const CoinSimplexInt * COIN_RESTRICT back = firstCountAddress_+numberRows_; const CoinSimplexInt * COIN_RESTRICT pivotColumn = pivotColumnAddress_; // no const CoinSimplexInt * COIN_RESTRICT permute = permuteAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLOrder = this->pivotLOrderAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLinkedForwards = this->pivotLinkedForwardsAddress_;//no const CoinSimplexInt * COIN_RESTRICT pivotLinkedBackwards = this->pivotLinkedBackwardsAddress_;//no itry++; int testit[6]; for (int i=0;i<6;i++) testit[i]=1; for (int i=0;igetNumElements(); //take out old pivot column #ifndef ABC_USE_FUNCTION_POINTERS totalElements_ -= numberInColumn[pivotRow]; CoinBigIndex startU = startColumnU[numberRows_]; startColumnU[pivotRow]=startU; CoinSimplexInt * COIN_RESTRICT indexU2 = &indexRowUAddress_[startU]; CoinFactorizationDouble * COIN_RESTRICT elementU2 = &elementUAddress_[startU]; numberInColumn[numberRows_]=numberInColumnU2; #else scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); #if ABC_USE_FUNCTION_POINTERS extern scatterUpdate AbcScatterLowSubtract[9]; extern scatterUpdate AbcScatterHighSubtract[4]; #endif CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinBigIndex startU = lastEntryByColumnUPlus_; totalElements_ -= scatter[pivotRow].number; CoinBigIndex saveStart = scatter[pivotRow].offset; CoinBigIndex saveEnd = scatter[pivotRow].number; scatter[pivotRow].offset=startU; scatter[numberRows_].number=numberInColumnU2; CoinFactorizationDouble * COIN_RESTRICT elementU2 = elementUColumnPlus+startU; CoinSimplexInt * COIN_RESTRICT indexU2 = reinterpret_cast(elementU2+numberInColumnU2); #endif // move CoinSimplexInt * COIN_RESTRICT indexU2Save = partialUpdate->getIndices(); CoinFactorizationDouble * COIN_RESTRICT elementU2Save = denseVector(partialUpdate); memcpy(indexU2,indexU2Save,numberInColumnU2*sizeof(CoinSimplexInt)); for (int i=0;isetNumElements(0); //get entries in row (pivot not stored) CoinSimplexInt numberNonZero = 0; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_; #endif #if CONVERTROW CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_; #if CONVERTROW>2 CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_; #endif #endif #if ABC_SMALL<2 CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; CoinBigIndex * COIN_RESTRICT startRowU = startRowUAddress_; #endif CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinFactorizationDouble pivotValue = 1.0; CoinSimplexInt status=0; #ifndef ABC_USE_FUNCTION_POINTERS CoinSimplexInt * COIN_RESTRICT indexRowU = indexRowUAddress_; #endif CoinFactorizationDouble * COIN_RESTRICT elementR = elementRAddress_; #ifndef NDEBUG #if CONVERTROW #define CONVERTDEBUG #endif #endif int nInRow=9999999; // ? what if ABC_SMALL==0 or ABC_SMALL==1 #if ABC_SMALL<2 CoinBigIndex start=0; CoinBigIndex end=0; if (gotUCopy()) { start=startRowU[pivotRow]; nInRow=numberInRowU[pivotRow]; end= start + nInRow; } #endif CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; numberNonZero = regionSparse->getNumElements ( ); //CoinFactorizationDouble saveFromU = 0.0; instrument_do("CoinAbcFactorizationReplaceColumn",2*numberRows_+4*numberInColumnU2); pivotValue = 1.0 / alpha; #if ABC_SMALL<2 if (gotUCopy()) { for (CoinBigIndex i = start; i < end ; i ++ ) { CoinSimplexInt jColumn = indexColumnU[i]; #ifndef ABC_USE_FUNCTION_POINTERS CoinBigIndex startColumn = startColumnU[jColumn]; #if CONVERTROW CoinBigIndex j = convertRowToColumn[i]; #else CoinBigIndex j; int number = numberInColumn[jColumn]; for (j=0;j(area+k+1); #if CONVERTROW CoinSimplexInt j = convertRowToColumn[i]; #else CoinSimplexInt j; for (j=0;j=0 assert(nInRow!=9999999); // ? what if ABC_SMALL==0 or ABC_SMALL==1 // no row copy CoinBigIndex COIN_RESTRICT * deletedPosition = reinterpret_cast(elementR+lengthR_); CoinSimplexInt COIN_RESTRICT * deletedColumns = reinterpret_cast(indexRowR+lengthR_); for (CoinSimplexInt i = 0; i < nInRow ; i ++ ) { CoinBigIndex j = deletedPosition[i]; CoinSimplexInt jColumn = deletedColumns[i]; // swap CoinSimplexInt k = numberInColumn[jColumn]-1; numberInColumn[jColumn]=k; CoinBigIndex k2 = k+startColumnU[jColumn]; int kRow2=indexRowU[k2]; indexRowU[j]=kRow2; CoinFactorizationDouble value2=elementU[k2]; elementU[j]=value2; } #endif #if ABC_SMALL<2 } #endif #if ABC_SMALL<2 if (gotUCopy()) { // Now zero out column of U //take out old pivot column #ifdef ABC_USE_FUNCTION_POINTERS CoinFactorizationDouble * COIN_RESTRICT elementU = elementUColumnPlus+saveStart; saveStart=0; CoinSimplexInt * COIN_RESTRICT indexRowU = reinterpret_cast(elementU+saveEnd); #endif for (CoinBigIndex i = saveStart; i < saveEnd ; i ++ ) { //elementU[i] = 0.0; // If too slow then reverse meaning of convertRowToColumn and use int jRow=indexRowU[i]; CoinBigIndex start = startRowU[jRow]; CoinBigIndex end = start + numberInRowU[jRow]; for (CoinBigIndex j = start; j < end ; j ++ ) { CoinSimplexInt jColumn = indexColumnU[j]; if (jColumn==pivotRow) { // swap numberInRowU[jRow]--; elementRowU[j]=elementRowU[end-1]; #if CONVERTROW convertRowToColumn[j]=convertRowToColumn[end-1]; #endif indexColumnU[j]=indexColumnU[end-1]; break; } } } } #endif //zero out pivot Row (before or after?) //add to R CoinBigIndex * COIN_RESTRICT startColumnR = startColumnRAddress_; CoinBigIndex putR = lengthR_; CoinSimplexInt number = numberR_; startColumnR[number] = putR; //for luck and first time number++; //assert (startColumnR+number-firstCountAddress_<( CoinMax(5*numberRows_,2*numberRows_+2*maximumPivots_)+2)); startColumnR[number] = putR + numberNonZero; numberR_ = number; lengthR_ = putR + numberNonZero; totalElements_ += numberNonZero; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT nextRow=NULL; CoinSimplexInt * COIN_RESTRICT lastRow=NULL; CoinSimplexInt next; CoinSimplexInt last; if (gotUCopy()) { //take out row nextRow = nextRowAddress_; lastRow = lastRowAddress_; next = nextRow[pivotRow]; last = lastRow[pivotRow]; nextRow[last] = next; lastRow[next] = last; numberInRowU[pivotRow]=0; } #endif //put in pivot //add row counts int n = 0; for (CoinSimplexInt i = 0; i < numberInColumnU2; i++ ) { CoinSimplexInt iRow = indexU2[i]; CoinFactorizationDouble value=elementU2[i]; assert (value); if ( !TEST_LESS_THAN_TOLERANCE(value ) ) { if ( iRow != pivotRow ) { //modify by pivot CoinFactorizationDouble value2 = value*pivotValue; indexU2[n]=iRow; elementU2[n++] = value2; #if ABC_SMALL<2 if (gotUCopy()) { CoinSimplexInt next = nextRow[iRow]; CoinSimplexInt iNumberInRow = numberInRowU[iRow]; CoinBigIndex space; CoinBigIndex put = startRowU[iRow] + iNumberInRow; space = startRowU[next] - put; if ( space <= 0 ) { getRowSpaceIterate ( iRow, iNumberInRow + 4 ); put = startRowU[iRow] + iNumberInRow; } else if (next==numberRows_) { lastEntryByRowU_=put+1; } indexColumnU[put] = pivotRow; #if CONVERTROW convertRowToColumn[put] = i; #endif elementRowU[put] = value2; numberInRowU[iRow] = iNumberInRow + 1; } #endif } else { //swap and save indexU2[i]=indexU2[numberInColumnU2-1]; elementU2[i] = elementU2[numberInColumnU2-1]; numberInColumnU2--; i--; } } else { // swap indexU2[i]=indexU2[numberInColumnU2-1]; elementU2[i] = elementU2[numberInColumnU2-1]; numberInColumnU2--; i--; } } numberInColumnU2=n; //do permute permuteAddress_[numberRowsExtra_] = pivotRow; //and for safety permuteAddress_[numberRowsExtra_ + 1] = 0; //pivotColumnAddress_[pivotRow] = numberRowsExtra_; numberU_++; #if ABC_SMALL<2 if (gotUCopy()) { //in at end last = lastRow[numberRows_]; nextRow[last] = pivotRow; //numberRowsExtra_; lastRow[numberRows_] = pivotRow; //numberRowsExtra_; lastRow[pivotRow] = last; nextRow[pivotRow] = numberRows_; startRowU[pivotRow] = lastEntryByRowU_; } #endif #ifndef ABC_USE_FUNCTION_POINTERS numberInColumn[pivotRow]=numberInColumnU2; #else #if ABC_USE_FUNCTION_POINTERS if (numberInColumnU2<9) { scatter[pivotRow].functionPointer=AbcScatterLowSubtract[numberInColumnU2]; } else { scatter[pivotRow].functionPointer=AbcScatterHighSubtract[numberInColumnU2&3]; } #endif assert(scatter[pivotRow].offset==lastEntryByColumnUPlus_); //CoinFactorizationDouble * COIN_RESTRICT area = elementUColumnPlus+lastEntryByColumnUPlus_; //CoinSimplexInt * COIN_RESTRICT indices = reinterpret_cast(area+numberInColumnU2); if (numberInColumnU2(area)>=0); for (int i=0;i>1; #endif totalElements_ += numberInColumnU2; lengthU_ += numberInColumnU2; #if ABC_SMALL<2 CoinSimplexInt * COIN_RESTRICT nextColumn = nextColumnAddress_; CoinSimplexInt * COIN_RESTRICT lastColumn = lastColumnAddress_; if (gotRCopy()) { //column in at beginning (as empty) next = nextColumn[maximumRowsExtra_]; lastColumn[next] = numberRowsExtra_; nextColumn[maximumRowsExtra_] = numberRowsExtra_; nextColumn[numberRowsExtra_] = next; lastColumn[numberRowsExtra_] = maximumRowsExtra_; } #endif #if 0 { int k=-1; for (int i=0;ipivotLinkedForwardsAddress_[-1]); assert (pivotLinkedBackwardsAddress_[numberRows_]>=0); numberRowsExtra_++; numberGoodU_++; numberPivots_++; if ( numberRowsExtra_ > numberRows_ + 50 ) { CoinBigIndex extra = factorElements_ >> 1; if ( numberRowsExtra_ > numberRows_ + 100 + numberRows_ / 500 ) { if ( extra < 2 * numberRows_ ) { extra = 2 * numberRows_; } } else { if ( extra < 5 * numberRows_ ) { extra = 5 * numberRows_; } } CoinBigIndex added = totalElements_ - factorElements_; if ( added > extra && added > ( factorElements_ ) << 1 && !status && 3*totalElements_ > 2*(lengthAreaU_+lengthAreaL_)) { status = 3; if ( messageLevel_ & 4 ) { std::cout << "Factorization has "<< totalElements_ << ", basis had " << factorElements_ <numberInR) { // there is space CoinBigIndex put=startRR[iRow]+numberInR; numberInColumnPlus[iRow]=numberInR+1; indexRowRR[put]=pivotRow; elementRR[put]=value; //add 4 for luck if (next==maximumRowsExtra_) startRR[maximumRowsExtra_] = CoinMin(static_cast (put + 4) ,lengthAreaR_); } else { // no space - do we shuffle? if (!getColumnSpaceIterateR(iRow,value,pivotRow)) { // printf("Need more space for R\n"); numberInColumnPlus_.conditionalDelete(); numberInColumnPlusAddress_=NULL; setNoGotRCopy(); regionSparse->clear(); #if ABC_SMALL<0 abort(); status=3; #endif break; } } } } else { #endif for (CoinBigIndex i = 0; i < numberNonZero; i++ ) { CoinSimplexInt iRow = regionIndex[i]; elementR[putR] = region[iRow]; region[iRow]=0.0; indexRowR[putR] = iRow; putR++; } #if ABC_SMALL<2 } #endif #ifdef ABC_USE_FUNCTION_POINTERS #if 0 { CoinFactorizationDouble * COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_; CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_; CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_; CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_; CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_; scatterStruct * COIN_RESTRICT scatter = scatterUColumn(); extern scatterUpdate AbcScatterLowSubtract[9]; extern scatterUpdate AbcScatterHighSubtract[4]; printf("=============================================start\n"); for (int iRow=0;iRow(area+number); CoinSimplexInt * COIN_RESTRICT indices2 = indexRow+startColumnU[iRow]; CoinFactorizationDouble * COIN_RESTRICT area2 = element+startColumnU[iRow]; //assert (number==numberInColumn[iRow]); #if ABC_USE_FUNCTION_POINTERS if (number<9) assert (scatter[iRow].functionPointer==AbcScatterLowSubtract[number]); else assert (scatter[iRow].functionPointer==AbcScatterHighSubtract[number&3]); #endif if (number) printf("Row %d %d els\n",iRow,number); int n=0; for (int i=0;isetNumElements(0); } #if ABC_SMALL>=0 /* Combines BtranU and store which elements are to be deleted */ int CoinAbcTypeFactorization::replaceColumnU ( CoinIndexedVector * regionSparse, CoinBigIndex * deletedPosition, CoinSimplexInt * deletedColumns, CoinSimplexInt pivotRow) { instrument_start("CoinAbcFactorizationReplaceColumnU",numberRows_); CoinSimplexDouble * COIN_RESTRICT region = regionSparse->denseVector(); int * COIN_RESTRICT regionIndex = regionSparse->getIndices(); const CoinBigIndex COIN_RESTRICT *startColumn = startColumnUAddress_; const CoinSimplexInt COIN_RESTRICT *indexRow = indexRowUAddress_; CoinFactorizationDouble COIN_RESTRICT *element = elementUAddress_; int numberNonZero = 0; const CoinSimplexInt COIN_RESTRICT *numberInColumn = numberInColumnAddress_; int nPut=0; const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedForwardsAddress_; CoinSimplexInt jRow=pivotLinked[-1]; while (jRow!=numberRows_) { assert (!region[jRow]); CoinFactorizationDouble pivotValue = 0.0; instrument_add(numberInColumn[jRow]); for (CoinBigIndex j= startColumn[jRow] ; j < startColumn[jRow]+numberInColumn[jRow]; j++ ) { int iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; if (iRow!=pivotRow) { pivotValue -= value * region[iRow]; } else { assert (!region[iRow]); pivotValue += value; deletedColumns[nPut]=jRow; deletedPosition[nPut++]=j; } } if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) { regionIndex[numberNonZero++] = jRow; region[jRow] = pivotValue; } else { region[jRow] = 0; } jRow=pivotLinked[jRow]; } regionSparse->setNumElements(numberNonZero); instrument_end(); return nPut; } /* Updates part of column transpose (BTRANU) by column assumes index is sorted i.e. region is correct */ void CoinAbcTypeFactorization::updateColumnTransposeUByColumn ( CoinIndexedVector * regionSparse, CoinSimplexInt smallestIndex) const { instrument_start("CoinAbcFactorizationUpdateTransposeUByColumn",numberRows_); CoinSimplexDouble * COIN_RESTRICT region = regionSparse->denseVector(); const CoinBigIndex COIN_RESTRICT *startColumn = startColumnUAddress_; const CoinSimplexInt COIN_RESTRICT *indexRow = indexRowUAddress_; const CoinFactorizationDouble COIN_RESTRICT *element = elementUAddress_; #if ABC_SMALL<3 int numberNonZero = 0; int * COIN_RESTRICT regionIndex = regionSparse->getIndices(); #endif const CoinSimplexInt COIN_RESTRICT *numberInColumn = numberInColumnAddress_; //const CoinFactorizationDouble COIN_RESTRICT *pivotRegion = pivotRegionAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedForwardsAddress_; CoinSimplexInt jRow=smallestIndex; while (jRow!=numberRows_) { CoinFactorizationDouble pivotValue = region[jRow]; CoinBigIndex start=startColumn[jRow]; instrument_add(numberInColumn[jRow]); #ifndef INLINE_IT2 for (CoinBigIndex j= start ; j < start+numberInColumn[jRow]; j++ ) { int iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; pivotValue -= value * region[iRow]; } #else pivotValue+=CoinAbcGatherUpdate(numberInColumn[jRow],element+start,indexRow+start,region); #endif #if ABC_SMALL<3 if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) { regionIndex[numberNonZero++] = jRow; region[jRow] = pivotValue; } else { region[jRow] = 0; } #else region[jRow] = pivotValue; #endif jRow=pivotLinked[jRow]; } #if ABC_SMALL<3 regionSparse->setNumElements(numberNonZero); #endif instrument_end(); } #endif // updateColumnTranspose. Updates one column transpose (BTRAN) CoinSimplexInt CoinAbcTypeFactorization::updateColumnTranspose ( CoinIndexedVector & regionSparse) const { toLongArray(®ionSparse,0); CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse.getIndices(); CoinSimplexInt numberNonZero = regionSparse.getNumElements(); const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_; #ifndef ABC_ORDERED_FACTORIZATION // can I move this #ifndef INLINE_IT3 for (CoinSimplexInt i = 0; i < numberNonZero; i ++ ) { CoinSimplexInt iRow = regionIndex[i]; CoinSimplexDouble value = region[iRow]; value *= pivotRegion[iRow]; region[iRow] = value; } #else multiplyIndexed(numberNonZero,pivotRegion, regionIndex,region); #endif #else // Permute in for Btran permuteInForBtranAndMultiply(regionSparse); #endif // ******* U // Apply pivot region - could be combined for speed // Can only combine/move inside vector for sparse CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1]; #if ABC_SMALL<2 // copy of code inside transposeU bool goSparse=false; #else #define goSparse false #endif #if ABC_SMALL<2 // Guess at number at end if (gotUCopy()) { assert (btranAverageAfterU_); CoinSimplexInt newNumber = static_cast (numberNonZero*btranAverageAfterU_*twiddleBtranFactor1()); if (newNumber< sparseThreshold_) goSparse = true; } #endif #if 0 static int xxxxxx=0; xxxxxx++; if (xxxxxx%20==0) { int smallestK=-1; int largestK=-1; //const CoinBigIndex COIN_RESTRICT *startColumn = startColumnUAddress_; CoinSimplexInt * COIN_RESTRICT pivotRowForward = pivotColumnAddress_; const CoinSimplexInt COIN_RESTRICT *numberInColumn = numberInColumnAddress_; for (CoinSimplexInt k = numberRows_-1 ; k >= 0; k-- ) { CoinSimplexInt i=pivotRowForward[k]; if (numberInColumn[i]) { if (largestK<0) largestK=k; smallestK=k; } } printf("UByCol %d slacks largestK %d smallestK %d\n",numberSlacks_,largestK,smallestK); //const CoinBigIndex * COIN_RESTRICT startRow = startRowUAddress_; const CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; smallestK=-1; largestK=-1; for (CoinSimplexInt k = numberRows_-1 ; k >= 0; k-- ) { CoinSimplexInt i=pivotRowForward[k]; if (numberInRow[i]) { if (largestK<0) largestK=k; smallestK=k; } } printf("and ByRow largestK %d smallestK %d\n",largestK,smallestK); } #endif if (numberNonZero<40&&(numberNonZero<<4)(btranCountInput_) #endif #if ABC_PARALLEL ,0 #endif ); //row bits here updateColumnTransposeR ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif ); // ******* L updateColumnTransposeL ( ®ionSparse #if ABC_SMALL<2 ,reinterpret_cast(btranCountInput_) #endif #if ABC_PARALLEL ,0 #endif ); #if ABC_SMALL<3 #ifdef ABC_ORDERED_FACTORIZATION // Permute out for Btran permuteOutForBtran(regionSparse); #endif #if ABC_DEBUG regionSparse.checkClean(); #endif numberNonZero = regionSparse.getNumElements ( ); #else numberNonZero=0; for (CoinSimplexInt i=0;i(0)); return numberNonZero; } #if ABC_SMALL<2 /* Updates part of column transpose (BTRANU) when densish, assumes index is sorted i.e. region is correct */ void CoinAbcTypeFactorization::updateColumnTransposeUDensish ( CoinIndexedVector * regionSparse, CoinSimplexInt smallestIndex) const { CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt numberNonZero = regionSparse->getNumElements ( ); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); const CoinBigIndex * COIN_RESTRICT startRow = startRowUAddress_; const CoinSimplexInt * COIN_RESTRICT indexColumn = indexColumnUAddress_; const CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; const CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; numberNonZero = 0; const CoinSimplexInt * COIN_RESTRICT pivotLinked = pivotLinkedForwardsAddress_; CoinSimplexInt jRow=smallestIndex ; //pivotLinked[-1]; instrument_start("CoinAbcFactorizationUpdateTransposeUDensish",numberRows_); while (jRow>=0) { if (TEST_DOUBLE_NONZERO(region[jRow])) { CoinFactorizationDouble pivotValue = region[jRow]; if ( !TEST_LESS_THAN_UPDATE_TOLERANCE(pivotValue ) ) { CoinSimplexInt numberIn = numberInRow[jRow]; instrument_add(numberIn); if (TEST_INT_NONZERO(numberIn)) { CoinBigIndex start = startRow[jRow]; CoinBigIndex end = start + numberIn; #ifndef INLINE_IT for (CoinBigIndex j = start ; j < end; j ++ ) { CoinSimplexInt iRow = indexColumn[j]; CoinFactorizationDouble value = elementRowU[j]; assert (value); // isetNumElements ( numberNonZero ); instrument_end(); } /* Updates part of column transpose (BTRANU) when sparse, assumes index is sorted i.e. region is correct */ void CoinAbcTypeFactorization::updateColumnTransposeUSparse ( CoinIndexedVector * regionSparse #if ABC_PARALLEL ,int whichSparse #endif ) const { CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt numberNonZero = regionSparse->getNumElements ( ); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); const CoinBigIndex * COIN_RESTRICT startRow = startRowUAddress_; const CoinSimplexInt * COIN_RESTRICT indexColumn = indexColumnUAddress_; const CoinSimplexInt * COIN_RESTRICT numberInRow = numberInRowAddress_; const CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_; // use sparse_ as temporary area // mark known to be zero //printf("PP 0_ %d %s\n",__LINE__,__FILE__); CoinAbcStack * COIN_RESTRICT stackList = reinterpret_cast(sparseAddress_); CoinSimplexInt * COIN_RESTRICT list = listAddress_; CoinCheckZero * COIN_RESTRICT mark = markRowAddress_; #if ABC_PARALLEL //printf("PP %d %d %s\n",whichSparse,__LINE__,__FILE__); if (whichSparse) { //printf("alternative sparse\n"); int addAmount=whichSparse*sizeSparseArray_; stackList=reinterpret_cast(reinterpret_cast(stackList)+addAmount); list=reinterpret_cast(reinterpret_cast(list)+addAmount); mark=reinterpret_cast(reinterpret_cast(mark)+addAmount); } #endif CoinSimplexInt nList; #if 0 //ndef NDEBUG for (CoinSimplexInt i=0;i=startThis;j--) { CoinSimplexInt kPivot3=indexColumn[j--]; if (!mark[kPivot3]) { kPivot=kPivot3; break; } } if (j>=startThis) { /* put back on stack */ stackList[nStack++].next =j; /* and new one */ CoinBigIndex start=startRow[kPivot]; j=start+numberInRow[kPivot]-1; stackList[nStack].stack=kPivot; stackList[nStack].start=start; mark[kPivot]=2; stackList[nStack++].next=j; #else CoinBigIndex j=stackList[nStack].next; if (j>=stackList[nStack].start) { CoinSimplexInt kPivot3=indexColumn[j--]; /* put back on stack */ stackList[nStack++].next =j; if (!mark[kPivot3]) { /* and new one */ CoinBigIndex start=startRow[kPivot3]; j=start+numberInRow[kPivot3]-1; stackList[nStack].stack=kPivot3; stackList[nStack].start=start; mark[kPivot3]=2; stackList[nStack++].next=j; } #endif } else { // finished list[nList++]=kPivot; mark[kPivot]=1; } } } } instrument_start("CoinAbcFactorizationUpdateTransposeUSparse",2*(numberNonZero+nList)); numberNonZero=0; for (CoinSimplexInt i=nList-1;i>=0;i--) { CoinSimplexInt iPivot = list[i]; assert (iPivot>=0&&iPivotsetNumElements ( numberNonZero ); instrument_end_and_adjust(1.3); } #endif // updateColumnTransposeU. Updates part of column transpose (BTRANU) //assumes index is sorted i.e. region is correct //does not sort by sign void CoinAbcTypeFactorization::updateColumnTransposeU ( CoinIndexedVector * regionSparse, CoinSimplexInt smallestIndex #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichCpu #endif ) const { #if CILK_CONFLICT>0 #if ABC_PARALLEL // for conflicts #if CILK_CONFLICT>1 printf("file %s line %d which %d\n",__FILE__,__LINE__,whichCpu); #endif abc_assert((cilk_conflict&(1<getNumElements ( ); if (factorizationStatistics()) { statistics.numberCounts_++; statistics.countInput_ += static_cast (number); } CoinSimplexInt goSparse; // Guess at number at end if (gotUCopy()) { if (gotSparse()) { assert (statistics.averageAfterU_); CoinSimplexInt newNumber = static_cast (number*statistics.averageAfterU_*twiddleBtranFactor1()); if (newNumber< sparseThreshold_) goSparse = 2; else goSparse = 0; } else { goSparse=0; } #if ABC_SMALL>=0 } else { goSparse=-1; #endif } //CoinIndexedVector temp(*regionSparse); switch (goSparse) { #if ABC_SMALL>=0 case -1: // no row copy updateColumnTransposeUByColumn(regionSparse,smallestIndex); break; #endif case 0: // densish updateColumnTransposeUDensish(regionSparse,smallestIndex); break; case 2: // sparse { updateColumnTransposeUSparse(regionSparse #if ABC_PARALLEL ,whichCpu #endif ); } break; } if (factorizationStatistics()) statistics.countAfterU_ += static_cast (regionSparse->getNumElements()); #else updateColumnTransposeUByColumn(regionSparse,smallestIndex); #endif #if CILK_CONFLICT>0 #if ABC_PARALLEL // for conflicts abc_assert((cilk_conflict&(1<getIndices ( ); CoinSimplexInt numberNonZero=0; #endif //scan for (first=numberRows_-1;first>=0;first--) { #ifndef ABC_ORDERED_FACTORIZATION if (region[pivotLOrder[first]]) break; #else if (region[first]) break; #endif } instrument_start("CoinAbcFactorizationUpdateTransposeLDensish",first); if ( first >= 0 ) { base = baseL_; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnLAddress_; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowLAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementLAddress_; CoinSimplexInt last = baseL_ + numberL_; if ( first >= last ) { first = last - 1; } CoinBigIndex end = startColumn[first+1]; for (CoinSimplexInt k = first ; k >= base; k-- ) { #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt i=pivotLOrder[k]; #else CoinSimplexInt i=k; #endif CoinFactorizationDouble pivotValue = region[i]; #ifndef INLINE_IT2 CoinBigIndex j=end-1; end=startColumn[k]; instrument_add(j-end); for ( ; j >= end; j-- ) { CoinSimplexInt iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; pivotValue -= value * region[iRow]; } #else CoinBigIndex start=startColumn[k]; instrument_add(end-start); pivotValue+=CoinAbcGatherUpdate(end-start,element+start,indexRow+start,region); end=start; #endif #if ABC_SMALL<3 if ( !TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue ) ) { region[i] = pivotValue; regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } #else region[i] = pivotValue; #endif } #if ABC_SMALL<3 //may have stopped early if ( first < base ) { base = first + 1; } for (CoinSimplexInt k = base-1 ; k >= 0; k-- ) { #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt i=pivotLOrder[k]; #else CoinSimplexInt i=k; #endif CoinExponent expValue=ABC_EXPONENT(region[i]); if (expValue) { if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) { regionIndex[numberNonZero++] = i; } else { region[i] = 0.0; } } } #endif } #if ABC_SMALL<3 //set counts regionSparse->setNumElements ( numberNonZero ); #endif instrument_end(); } #if ABC_SMALL<2 /* updateColumnTransposeLByRow. Updates part of column transpose (BTRANL) densish but by row */ void CoinAbcTypeFactorization::updateColumnTransposeLByRow ( CoinIndexedVector * regionSparse ) const { CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinSimplexInt numberNonZero; // use row copy of L const CoinFactorizationDouble * COIN_RESTRICT element = elementByRowLAddress_; const CoinBigIndex * COIN_RESTRICT startRow = startRowLAddress_; const CoinSimplexInt * COIN_RESTRICT column = indexColumnLAddress_; const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_; numberNonZero=0; instrument_start("CoinAbcFactorizationUpdateTransposeLByRow",numberRows_+numberSlacks_); // down to slacks for (CoinSimplexInt k = numberRows_-1 ; k >= numberSlacks_; k-- ) { #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt i=pivotLOrder[k]; #else CoinSimplexInt i=k; #endif if (TEST_DOUBLE_NONZERO(region[i])) { CoinFactorizationDouble pivotValue = region[i]; if ( !TEST_LESS_THAN_TOLERANCE(pivotValue ) ) { regionIndex[numberNonZero++] = i; CoinBigIndex start=startRow[i]; CoinBigIndex end=startRow[i+1]; instrument_add(end-start); if (TEST_INT_NONZERO(end-start)) { #ifndef INLINE_IT for (CoinBigIndex j = end-1;j >= start; j--) { CoinSimplexInt iRow = column[j]; CoinFactorizationDouble value = element[j]; region[iRow] -= pivotValue*value; } #else CoinAbcScatterUpdate(end-start,pivotValue,element+start,column+start,region); #endif } } else { region[i] = 0.0; } } } for (CoinSimplexInt k = numberSlacks_-1 ; k >= 0; k-- ) { #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt i=pivotLOrder[k]; #else CoinSimplexInt i=k; #endif CoinExponent expValue=ABC_EXPONENT(region[i]); if (expValue) { if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) { regionIndex[numberNonZero++]=i; } else { region[i] = 0.0; } } } //set counts regionSparse->setNumElements ( numberNonZero ); instrument_end(); } /* updateColumnTransposeLSparse. Updates part of column transpose (BTRANL) sparse */ void CoinAbcTypeFactorization::updateColumnTransposeLSparse ( CoinIndexedVector * regionSparse #if ABC_PARALLEL ,int whichSparse #endif ) const { CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); CoinSimplexInt numberNonZero = regionSparse->getNumElements ( ); // use row copy of L const CoinFactorizationDouble * COIN_RESTRICT element = elementByRowLAddress_; const CoinBigIndex * COIN_RESTRICT startRow = startRowLAddress_; const CoinSimplexInt * COIN_RESTRICT column = indexColumnLAddress_; // use sparse_ as temporary area // mark known to be zero //printf("PP 0_ %d %s\n",__LINE__,__FILE__); CoinAbcStack * COIN_RESTRICT stackList = reinterpret_cast(sparseAddress_); CoinSimplexInt * COIN_RESTRICT list = listAddress_; CoinCheckZero * COIN_RESTRICT mark = markRowAddress_; #if ABC_PARALLEL //printf("PP %d %d %s\n",whichSparse,__LINE__,__FILE__); if (whichSparse) { int addAmount=whichSparse*sizeSparseArray_; //printf("alternative sparse\n"); stackList=reinterpret_cast(reinterpret_cast(stackList)+addAmount); list=reinterpret_cast(reinterpret_cast(list)+addAmount); mark=reinterpret_cast(reinterpret_cast(mark)+addAmount); } #endif #ifndef NDEBUG for (CoinSimplexInt i=0;i=0) { /* take off stack */ if (j>=stackList[nStack].start) { CoinSimplexInt jPivot=column[j--]; /* put back on stack */ stackList[nStack].next =j; if (!mark[jPivot]) { /* and new one */ kPivot=jPivot; //iPivot=pivotLBackwardOrder[kPivot]; j = startRow[kPivot+1]-1; stackList[++nStack].stack=kPivot; mark[kPivot]=1; stackList[nStack].start=startRow[kPivot]; stackList[nStack].next=j; } } else { /* finished so mark */ list[nList++]=kPivot; mark[kPivot]=1; --nStack; if (nStack>=0) { kPivot=stackList[nStack].stack; j=stackList[nStack].next; } } } } } instrument_start("CoinAbcFactorizationUpdateTransposeLSparse",2*(numberNonZero+nList)); numberNonZero=0; for (CoinSimplexInt i=nList-1;i>=0;i--) { CoinSimplexInt iPivot = list[i]; //CoinSimplexInt kPivot=pivotLOrder[iPivot]; mark[iPivot]=0; CoinFactorizationDouble pivotValue = region[iPivot]; if ( !TEST_LESS_THAN_TOLERANCE(pivotValue ) ) { regionIndex[numberNonZero++] = iPivot; CoinBigIndex start=startRow[iPivot]; CoinBigIndex end=startRow[iPivot+1]; instrument_add(end-start); #ifndef INLINE_IT CoinBigIndex j; for ( j = start; j < end; j ++ ) { CoinSimplexInt iRow = column[j]; CoinFactorizationDouble value = element[j]; region[iRow] -= value * pivotValue; } #else CoinAbcScatterUpdate(end-start,pivotValue,element+start,column+start,region); #endif } else { region[iPivot]=0.0; } } //set counts regionSparse->setNumElements ( numberNonZero ); instrument_end_and_adjust(1.3); } #endif // updateColumnTransposeL. Updates part of column transpose (BTRANL) void CoinAbcTypeFactorization::updateColumnTransposeL ( CoinIndexedVector * regionSparse #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif #if ABC_PARALLEL ,int whichSparse #endif ) const { #if CILK_CONFLICT>0 #if ABC_PARALLEL // for conflicts #if CILK_CONFLICT>1 printf("file %s line %d which %d\n",__FILE__,__LINE__,whichSparse); #endif abc_assert((cilk_conflict&(1<getNumElements ( ); #endif if (!numberL_ #if ABC_SMALL<4 &&!numberDense_ #endif ) { #if ABC_SMALL<3 if (number>=numberRows_) { // need scan regionSparse->setNumElements(0); scan(regionSparse); } #endif #if CILK_CONFLICT>0 #if ABC_PARALLEL // for conflicts abc_assert((cilk_conflict&(1< (number*statistics.averageAfterL_*twiddleBtranFactor1()); if (newNumber< sparseThreshold_) goSparse = 2; else if (2*newNumber< numberRows_) goSparse = 0; else goSparse = -1; } else { goSparse=-1; } #endif #if ABC_SMALL<4 #if ABC_DENSE_CODE>0 if (numberDense_) { //take off list CoinSimplexInt lastSparse = numberRows_-numberDense_; CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_; CoinFactorizationDouble * COIN_RESTRICT denseArea = denseAreaAddress_; CoinFactorizationDouble * COIN_RESTRICT denseRegion = denseArea+leadingDimension_*numberDense_; CoinSimplexInt * COIN_RESTRICT densePermute= reinterpret_cast(denseRegion+FACTOR_CPU*numberDense_); #if ABC_PARALLEL //printf("PP %d %d %s\n",whichSparse,__LINE__,__FILE__); if (whichSparse) denseRegion+=whichSparse*numberDense_; #endif CoinFactorizationDouble * COIN_RESTRICT densePut = denseRegion-lastSparse; CoinZeroN(denseRegion,numberDense_); bool doDense=false; #if ABC_SMALL<3 CoinSimplexInt number = regionSparse->getNumElements(); CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices ( ); const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_; CoinSimplexInt i=0; #if ABC_SMALL<0 assert (number<=numberRows_); #else if (number<=numberRows_) { #endif while (i=lastSparse) { doDense=true; regionIndex[i] = regionIndex[--number]; densePut[jRow]=region[iRow]; region[iRow]=0.0; } else { i++; } } #endif #if ABC_SMALL>=0 #if ABC_SMALL<3 } else { #endif for (CoinSimplexInt jRow=lastSparse;jRowsetNumElements(0); scan(regionSparse); number=regionSparse->getNumElements(); } #endif #endif if (doDense) { instrument_do("CoinAbcFactorizationDenseTranspose",0.25*numberDense_*numberDense_); #if ABC_DENSE_CODE==1 #ifndef CLAPACK char trans = 'T'; CoinSimplexInt ione=1; CoinSimplexInt info; F77_FUNC(dgetrs,DGETRS)(&trans,&numberDense_,&ione,denseArea,&leadingDimension_, densePermute,denseRegion,&numberDense_,&info,1); #else clapack_dgetrs(CblasColMajor, CblasTrans,numberDense_,1, denseArea, leadingDimension_,densePermute,denseRegion,numberDense_); #endif #elif ABC_DENSE_CODE==2 CoinAbcDgetrs('T',numberDense_,denseArea,denseRegion); short * COIN_RESTRICT forBtran = reinterpret_cast(densePermute+numberDense_)+numberDense_-lastSparse; pivotLOrder += lastSparse; // adjust #endif for (CoinSimplexInt i=lastSparse;isetNumElements(number); #endif } } //printRegion(*regionSparse,"After BtranL"); #endif #endif #if ABC_SMALL<2 switch (goSparse) { case -1: // No row copy updateColumnTransposeLDensish(regionSparse); break; case 0: // densish but by row updateColumnTransposeLByRow(regionSparse); break; case 2: // sparse updateColumnTransposeLSparse(regionSparse #if ABC_PARALLEL ,whichSparse #endif ); break; } #else updateColumnTransposeLDensish(regionSparse); #endif #if CILK_CONFLICT>0 #if ABC_PARALLEL // for conflicts abc_assert((cilk_conflict&(1<=0 // Updates part of column transpose (BTRANR) when dense void CoinAbcTypeFactorization::updateColumnTransposeRDensish( CoinIndexedVector * regionSparse ) const { const CoinBigIndex * COIN_RESTRICT startColumn = startColumnRAddress_-numberRows_; CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse); #if ABC_SMALL<3 #ifdef ABC_DEBUG regionSparse->checkClean(); #endif #endif instrument_start("CoinAbcFactorizationUpdateTransposeRDensish",numberRows_); CoinSimplexInt last = numberRowsExtra_-1; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowRAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementRAddress_; const CoinSimplexInt * COIN_RESTRICT pivotRowBack = pivotColumnAddress_; for (CoinSimplexInt i = last ; i >= numberRows_; i-- ) { CoinSimplexInt putRow=pivotRowBack[i]; CoinFactorizationDouble pivotValue = region[putRow]; if ( pivotValue ) { CoinBigIndex start=startColumn[i]; CoinBigIndex end=startColumn[i+1]; instrument_add(end-start); #ifndef INLINE_IT for (CoinBigIndex j = start; j < end; j++ ) { CoinFactorizationDouble value = element[j]; CoinSimplexInt iRow = indexRow[j]; assert (iRowgetIndices ( ); CoinSimplexInt numberNonZero = regionSparse->getNumElements ( ); instrument_start("CoinAbcFactorizationUpdateTransposeRSparse",numberRows_); #if ABC_SMALL<3 #ifdef ABC_DEBUG regionSparse->checkClean(); #endif #endif CoinSimplexInt last = numberRowsExtra_-1; const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowRAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementRAddress_; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnRAddress_-numberRows_; //move using lookup const CoinSimplexInt * COIN_RESTRICT pivotRowBack = pivotColumnAddress_; // still need to do in correct order (for now) for (CoinSimplexInt i = last ; i >= numberRows_; i-- ) { CoinSimplexInt putRow = pivotRowBack[i]; CoinFactorizationDouble pivotValue = region[putRow]; if ( pivotValue ) { instrument_add(startColumn[i+1]-startColumn[i]); for (CoinBigIndex j = startColumn[i]; j < startColumn[i+1]; j++ ) { CoinFactorizationDouble value = element[j]; CoinSimplexInt iRow = indexRow[j]; assert (iRowsetNumElements(numberNonZero); } #endif // updateColumnTransposeR. Updates part of column (FTRANR) void CoinAbcTypeFactorization::updateColumnTransposeR ( CoinIndexedVector * regionSparse #if ABC_SMALL<2 , CoinAbcStatistics & statistics #endif ) const { if (numberRowsExtra_==numberRows_) return; #if ABC_SMALL<3 CoinSimplexInt numberNonZero = regionSparse->getNumElements ( ); if (numberNonZero) { #endif #if ABC_SMALL<3 const CoinBigIndex * COIN_RESTRICT startColumn = startColumnRAddress_-numberRows_; #endif // Size of R instrument_do("CoinAbcFactorizationTransposeR",startColumnRAddress_[numberR_]); #if ABC_SMALL<2 if (startColumn[numberRowsExtra_]) { #if ABC_SMALL>=0 if (numberNonZero < ((sparseThreshold_<<2)*twiddleBtranFactor2()) ||(!numberL_&&gotLCopy()&&gotRCopy())) { #endif updateColumnTransposeRSparse ( regionSparse ); if (factorizationStatistics()) statistics.countAfterR_ += regionSparse->getNumElements(); #if ABC_SMALL>=0 } else { updateColumnTransposeRDensish ( regionSparse ); // we have lost indices // make sure won't try and go sparse again if (factorizationStatistics()) statistics.countAfterR_ += CoinMin((numberNonZero<<1),numberRows_); // temp +2 (was +1) regionSparse->setNumElements (numberRows_+2); } #endif } else { if (factorizationStatistics()) statistics.countAfterR_ += numberNonZero; } #else updateColumnTransposeRDensish ( regionSparse ); #if ABC_SMALL<3 // we have lost indices // make sure won't try and go sparse again // temp +2 (was +1) regionSparse->setNumElements (numberRows_+2); #endif #endif #if ABC_SMALL<3 } #endif } // Update partial Ftran by R update void CoinAbcTypeFactorization::updatePartialUpdate(CoinIndexedVector & partialUpdate) { CoinSimplexDouble * COIN_RESTRICT region = partialUpdate.denseVector ( ); CoinSimplexInt * COIN_RESTRICT regionIndex = partialUpdate.getIndices ( ); CoinSimplexInt numberNonZero = partialUpdate.getNumElements ( ); const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowRAddress_; const CoinFactorizationDouble * COIN_RESTRICT element = elementRAddress_; const CoinSimplexInt * pivotRowBack = pivotColumnAddress_; const CoinBigIndex * COIN_RESTRICT startColumn = startColumnRAddress_-numberRows_; CoinBigIndex start = startColumn[numberRowsExtra_-1]; CoinBigIndex end = startColumn[numberRowsExtra_]; CoinSimplexInt iRow =pivotRowBack[numberRowsExtra_-1]; CoinFactorizationDouble pivotValue = region[iRow]; for (CoinBigIndex j = start; j < end; j ++ ) { CoinFactorizationDouble value = element[j]; CoinSimplexInt jRow = indexRow[j]; value *= region[jRow]; pivotValue -= value; } if ( !TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue ) ) { if (!region[iRow]) regionIndex[numberNonZero++] = iRow; region[iRow] = pivotValue; } else { if (region[iRow]) region[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } partialUpdate.setNumElements(numberNonZero); } #if FACTORIZATION_STATISTICS #ifdef ABC_JUST_ONE_FACTORIZATION #define FACTORS_HERE #endif #ifdef FACTORS_HERE double ftranTwiddleFactor1X=1.0; double ftranTwiddleFactor2X=1.0; double ftranFTTwiddleFactor1X=1.0; double ftranFTTwiddleFactor2X=1.0; double btranTwiddleFactor1X=1.0; double btranTwiddleFactor2X=1.0; double ftranFullTwiddleFactor1X=1.0; double ftranFullTwiddleFactor2X=1.0; double btranFullTwiddleFactor1X=1.0; double btranFullTwiddleFactor2X=1.0; double denseThresholdX=31; double twoThresholdX=1000; double minRowsSparse=300; double largeRowsSparse=10000; double mediumRowsDivider=6; double mediumRowsMinCount=500; double largeRowsCount=1000; #else extern double ftranTwiddleFactor1X; extern double ftranTwiddleFactor2X; extern double ftranFTTwiddleFactor1X; extern double ftranFTTwiddleFactor2X; extern double btranTwiddleFactor1X; extern double btranTwiddleFactor2X; extern double ftranFullTwiddleFactor1X; extern double ftranFullTwiddleFactor2X; extern double btranFullTwiddleFactor1X; extern double btranFullTwiddleFactor2X; extern double denseThresholdX; extern double twoThresholdX; extern double minRowsSparse; extern double largeRowsSparse; extern double mediumRowsDivider; extern double mediumRowsMinCount; extern double largeRowsCount; #endif #else #define minRowsSparse 300 #define largeRowsSparse 10000 #define mediumRowsDivider 6 #define mediumRowsMinCount 500 #define largeRowsCount 1000 #endif // makes a row copy of L void CoinAbcTypeFactorization::goSparse2 ( ) { #if ABC_SMALL<2 #if ABC_SMALL>=0 if (numberRows_>minRowsSparse) { #endif if (numberRows_>3); sparseThreshold_=500; } #if FACTORIZATION_STATISTICS ftranTwiddleFactor1_=ftranTwiddleFactor1X; ftranTwiddleFactor2_=ftranTwiddleFactor2X; ftranFTTwiddleFactor1_=ftranFTTwiddleFactor1X; ftranFTTwiddleFactor2_=ftranFTTwiddleFactor2X; btranTwiddleFactor1_=btranTwiddleFactor1X; btranTwiddleFactor2_=btranTwiddleFactor2X; ftranFullTwiddleFactor1_=ftranFullTwiddleFactor1X; ftranFullTwiddleFactor2_=ftranFullTwiddleFactor2X; btranFullTwiddleFactor1_=btranFullTwiddleFactor1X; btranFullTwiddleFactor2_=btranFullTwiddleFactor2X; #endif setYesGotLCopy(); setYesGotUCopy(); setYesGotSparse(); // allow for stack, list, next, starts and char map of mark CoinSimplexInt nRowIndex = (numberRows_+CoinSizeofAsInt(CoinSimplexInt)-1)/ CoinSizeofAsInt(char); CoinSimplexInt nInBig = static_cast(sizeof(CoinBigIndex)/sizeof(CoinSimplexInt)); assert (nInBig>=1); sizeSparseArray_ = (2+2*nInBig)*numberRows_ + nRowIndex ; sparse_.conditionalNew(FACTOR_CPU*sizeSparseArray_); sparseAddress_ = sparse_.array(); // zero out mark CoinAbcStack * stackList = reinterpret_cast(sparseAddress_); listAddress_ = reinterpret_cast(stackList+numberRows_); markRowAddress_ = reinterpret_cast (listAddress_ + numberRows_); assert(reinterpret_cast(sparseAddress_+(2+2*nInBig)*numberRows_)==markRowAddress_); CoinAbcMemset0(markRowAddress_,nRowIndex); #if ABC_PARALLEL //printf("PP 0__ %d %s\n",__LINE__,__FILE__); // convert to bytes sizeSparseArray_*=sizeof(CoinSimplexInt); char * mark=reinterpret_cast(reinterpret_cast(markRowAddress_)+sizeSparseArray_); for (int i=1;i(reinterpret_cast(mark)+sizeSparseArray_); } #endif elementByRowL_.conditionalDelete(); indexColumnL_.conditionalDelete(); startRowL_.conditionalNew(numberRows_+1); if (lengthAreaL_) { elementByRowL_.conditionalNew(lengthAreaL_); indexColumnL_.conditionalNew(lengthAreaL_); } elementByRowLAddress_=elementByRowL_.array(); indexColumnLAddress_=indexColumnL_.array(); startRowLAddress_=startRowL_.array(); // counts CoinBigIndex * COIN_RESTRICT startRowL = startRowLAddress_; CoinZeroN(startRowL,numberRows_); const CoinBigIndex * startColumnL = startColumnLAddress_; CoinFactorizationDouble * COIN_RESTRICT elementL = elementLAddress_; const CoinSimplexInt * indexRowL = indexRowLAddress_; for (CoinSimplexInt i=baseL_;i=baseL_;i--) { #ifndef ABC_ORDERED_FACTORIZATION CoinSimplexInt iPivot=pivotLOrder[i]; #else CoinSimplexInt iPivot=i; #endif for (CoinBigIndex j=startColumnL[i];j=0 } else { sparseThreshold_=0; setNoGotLCopy(); //setYesGotUCopy(); setNoGotUCopy(); setNoGotSparse(); } #endif #endif } // set sparse threshold void CoinAbcTypeFactorization::sparseThreshold ( CoinSimplexInt /*value*/ ) { return; #if 0 if (value>0&&sparseThreshold_) { sparseThreshold_=value; } else if (!value&&sparseThreshold_) { // delete copy sparseThreshold_=0; elementByRowL_.conditionalDelete(); startRowL_.conditionalDelete(); indexColumnL_.conditionalDelete(); sparse_.conditionalDelete(); } else if (value>0&&!sparseThreshold_) { if (value>1) sparseThreshold_=value; else sparseThreshold_=0; goSparse(); } #endif } void CoinAbcTypeFactorization::maximumPivots ( CoinSimplexInt value ) { if (value>0) { if (numberRows_) maximumMaximumPivots_=CoinMax(maximumMaximumPivots_,value); else maximumMaximumPivots_=value; maximumPivots_=value; } //printf("max %d maxmax %d\n",maximumPivots_,maximumMaximumPivots_); } void CoinAbcTypeFactorization::messageLevel ( CoinSimplexInt value ) { if (value>0&&value<16) { messageLevel_=value; } } // Reset all sparsity etc statistics void CoinAbcTypeFactorization::resetStatistics() { #if ABC_SMALL<2 setStatistics(true); /// Below are all to collect ftranCountInput_=0.0; ftranCountAfterL_=0.0; ftranCountAfterR_=0.0; ftranCountAfterU_=0.0; ftranFTCountInput_=0.0; ftranFTCountAfterL_=0.0; ftranFTCountAfterR_=0.0; ftranFTCountAfterU_=0.0; btranCountInput_=0.0; btranCountAfterU_=0.0; btranCountAfterR_=0.0; btranCountAfterL_=0.0; ftranFullCountInput_=0.0; ftranFullCountAfterL_=0.0; ftranFullCountAfterR_=0.0; ftranFullCountAfterU_=0.0; btranFullCountInput_=0.0; btranFullCountAfterL_=0.0; btranFullCountAfterR_=0.0; btranFullCountAfterU_=0.0; /// We can roll over factorizations numberFtranCounts_=0; numberFtranFTCounts_=0; numberBtranCounts_=0; numberFtranFullCounts_=0; numberFtranFullCounts_=0; /// While these are averages collected over last ftranAverageAfterL_=INITIAL_AVERAGE; ftranAverageAfterR_=INITIAL_AVERAGE; ftranAverageAfterU_=INITIAL_AVERAGE; ftranFTAverageAfterL_=INITIAL_AVERAGE; ftranFTAverageAfterR_=INITIAL_AVERAGE; ftranFTAverageAfterU_=INITIAL_AVERAGE; btranAverageAfterU_=INITIAL_AVERAGE; btranAverageAfterR_=INITIAL_AVERAGE; btranAverageAfterL_=INITIAL_AVERAGE; ftranFullAverageAfterL_=INITIAL_AVERAGE; ftranFullAverageAfterR_=INITIAL_AVERAGE; ftranFullAverageAfterU_=INITIAL_AVERAGE; btranFullAverageAfterL_=INITIAL_AVERAGE; btranFullAverageAfterR_=INITIAL_AVERAGE; btranFullAverageAfterU_=INITIAL_AVERAGE; #endif } // See if worth going sparse void CoinAbcTypeFactorization::checkSparse() { #if ABC_SMALL<2 // See if worth going sparse and when if (numberFtranCounts_>50) { ftranCountInput_= CoinMax(ftranCountInput_,1.0); ftranAverageAfterL_ = CoinMax(ftranCountAfterL_/ftranCountInput_,INITIAL_AVERAGE2); ftranAverageAfterR_ = CoinMax(ftranCountAfterR_/ftranCountAfterL_,INITIAL_AVERAGE2); ftranAverageAfterU_ = CoinMax(ftranCountAfterU_/ftranCountAfterR_,INITIAL_AVERAGE2); ftranFTCountInput_= CoinMax(ftranFTCountInput_,INITIAL_AVERAGE2); ftranFTAverageAfterL_ = CoinMax(ftranFTCountAfterL_/ftranFTCountInput_,INITIAL_AVERAGE2); ftranFTAverageAfterR_ = CoinMax(ftranFTCountAfterR_/ftranFTCountAfterL_,INITIAL_AVERAGE2); ftranFTAverageAfterU_ = CoinMax(ftranFTCountAfterU_/ftranFTCountAfterR_,INITIAL_AVERAGE2); if (btranCountInput_&&btranCountAfterU_&&btranCountAfterR_) { btranAverageAfterU_ = CoinMax(btranCountAfterU_/btranCountInput_,INITIAL_AVERAGE2); btranAverageAfterR_ = CoinMax(btranCountAfterR_/btranCountAfterU_,INITIAL_AVERAGE2); btranAverageAfterL_ = CoinMax(btranCountAfterL_/btranCountAfterR_,INITIAL_AVERAGE2); } else { // we have not done any useful btrans (values pass?) btranAverageAfterU_ = INITIAL_AVERAGE2; btranAverageAfterR_ = INITIAL_AVERAGE2; btranAverageAfterL_ = INITIAL_AVERAGE2; btranFullCountAfterL_ = INITIAL_AVERAGE2; btranFullCountAfterR_ = INITIAL_AVERAGE2; btranFullCountAfterU_ = INITIAL_AVERAGE2; } ftranFullCountInput_= CoinMax(ftranFullCountInput_,1.0); ftranFullAverageAfterL_ = CoinMax(ftranFullCountAfterL_/ftranFullCountInput_,INITIAL_AVERAGE2); ftranFullAverageAfterR_ = CoinMax(ftranFullCountAfterR_/ftranFullCountAfterL_,INITIAL_AVERAGE2); ftranFullAverageAfterU_ = CoinMax(ftranFullCountAfterU_/ftranFullCountAfterR_,INITIAL_AVERAGE2); btranFullCountInput_= CoinMax(btranFullCountInput_,1.0); btranFullAverageAfterL_ = CoinMax(btranFullCountAfterL_/btranFullCountInput_,INITIAL_AVERAGE2); btranFullAverageAfterR_ = CoinMax(btranFullCountAfterR_/btranFullCountAfterL_,INITIAL_AVERAGE2); btranFullAverageAfterU_ = CoinMax(btranFullCountAfterU_/btranFullCountAfterR_,INITIAL_AVERAGE2); } // scale back ftranCountInput_ *= AVERAGE_SCALE_BACK; ftranCountAfterL_ *= AVERAGE_SCALE_BACK; ftranCountAfterR_ *= AVERAGE_SCALE_BACK; ftranCountAfterU_ *= AVERAGE_SCALE_BACK; ftranFTCountInput_ *= AVERAGE_SCALE_BACK; ftranFTCountAfterL_ *= AVERAGE_SCALE_BACK; ftranFTCountAfterR_ *= AVERAGE_SCALE_BACK; ftranFTCountAfterU_ *= AVERAGE_SCALE_BACK; btranCountInput_ *= AVERAGE_SCALE_BACK; btranCountAfterU_ *= AVERAGE_SCALE_BACK; btranCountAfterR_ *= AVERAGE_SCALE_BACK; btranCountAfterL_ *= AVERAGE_SCALE_BACK; ftranFullCountInput_ *= AVERAGE_SCALE_BACK; ftranFullCountAfterL_ *= AVERAGE_SCALE_BACK; ftranFullCountAfterR_ *= AVERAGE_SCALE_BACK; ftranFullCountAfterU_ *= AVERAGE_SCALE_BACK; btranFullCountInput_ *= AVERAGE_SCALE_BACK; btranFullCountAfterL_ *= AVERAGE_SCALE_BACK; btranFullCountAfterR_ *= AVERAGE_SCALE_BACK; btranFullCountAfterU_ *= AVERAGE_SCALE_BACK; #endif } // Condition number - product of pivots after factorization CoinSimplexDouble CoinAbcTypeFactorization::conditionNumber() const { CoinSimplexDouble condition = 1.0; const CoinFactorizationDouble * pivotRegion = pivotRegionAddress_; for (CoinSimplexInt i=0;i(reinterpret_cast(mark)+sizeSparseArray_); for (CoinSimplexInt i=0;i(reinterpret_cast(mark)+sizeSparseArray_); } #endif } #endif #endif CoinMP-1.8.3/Clp/src/ClpHelperFunctions.hpp0000644000175000017500000002356012346350362017113 0ustar renerene/* $Id: ClpHelperFunctions.hpp 2034 2014-06-12 16:10:26Z stefan $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #ifndef ClpHelperFunctions_H #define ClpHelperFunctions_H #include "ClpConfig.h" #ifdef HAVE_CMATH # include #else # ifdef HAVE_MATH_H # include # else # error "don't have header file for math" # endif #endif /** Note (JJF) I have added some operations on arrays even though they may duplicate CoinDenseVector. I think the use of templates was a mistake as I don't think inline generic code can take as much advantage of parallelism or machine architectures or memory hierarchies. */ double maximumAbsElement(const double * region, int size); void setElements(double * region, int size, double value); void multiplyAdd(const double * region1, int size, double multiplier1, double * region2, double multiplier2); double innerProduct(const double * region1, int size, const double * region2); void getNorms(const double * region, int size, double & norm1, double & norm2); #if COIN_LONG_WORK // For long double versions CoinWorkDouble maximumAbsElement(const CoinWorkDouble * region, int size); void setElements(CoinWorkDouble * region, int size, CoinWorkDouble value); void multiplyAdd(const CoinWorkDouble * region1, int size, CoinWorkDouble multiplier1, CoinWorkDouble * region2, CoinWorkDouble multiplier2); CoinWorkDouble innerProduct(const CoinWorkDouble * region1, int size, const CoinWorkDouble * region2); void getNorms(const CoinWorkDouble * region, int size, CoinWorkDouble & norm1, CoinWorkDouble & norm2); inline void CoinMemcpyN(const double * from, const int size, CoinWorkDouble * to) { for (int i = 0; i < size; i++) to[i] = from[i]; } inline void CoinMemcpyN(const CoinWorkDouble * from, const int size, double * to) { for (int i = 0; i < size; i++) to[i] = static_cast(from[i]); } inline CoinWorkDouble CoinMax(const CoinWorkDouble x1, const double x2) { return (x1 > x2) ? x1 : x2; } inline CoinWorkDouble CoinMax(double x1, const CoinWorkDouble x2) { return (x1 > x2) ? x1 : x2; } inline CoinWorkDouble CoinMin(const CoinWorkDouble x1, const double x2) { return (x1 < x2) ? x1 : x2; } inline CoinWorkDouble CoinMin(double x1, const CoinWorkDouble x2) { return (x1 < x2) ? x1 : x2; } inline CoinWorkDouble CoinSqrt(CoinWorkDouble x) { return sqrtl(x); } #else inline double CoinSqrt(double x) { return sqrt(x); } #endif /// Trace # ifdef NDEBUG # define ClpTraceDebug(expression) {} # else void ClpTracePrint(std::string fileName, std::string message, int line); # define ClpTraceDebug(expression) { \ if (!(expression)) { ClpTracePrint(__FILE__,__STRING(expression),__LINE__); } \ } # endif /// Following only included if ClpPdco defined #ifdef ClpPdco_H inline double pdxxxmerit(int nlow, int nupp, int *low, int *upp, CoinDenseVector &r1, CoinDenseVector &r2, CoinDenseVector &rL, CoinDenseVector &rU, CoinDenseVector &cL, CoinDenseVector &cU ) { // Evaluate the merit function for Newton's method. // It is the 2-norm of the three sets of residuals. double sum1, sum2; CoinDenseVector f(6); f[0] = r1.twoNorm(); f[1] = r2.twoNorm(); sum1 = sum2 = 0.0; for (int k = 0; k < nlow; k++) { sum1 += rL[low[k]] * rL[low[k]]; sum2 += cL[low[k]] * cL[low[k]]; } f[2] = sqrt(sum1); f[4] = sqrt(sum2); sum1 = sum2 = 0.0; for (int k = 0; k < nupp; k++) { sum1 += rL[upp[k]] * rL[upp[k]]; sum2 += cL[upp[k]] * cL[upp[k]]; } f[3] = sqrt(sum1); f[5] = sqrt(sum2); return f.twoNorm(); } //----------------------------------------------------------------------- // End private function pdxxxmerit //----------------------------------------------------------------------- //function [r1,r2,rL,rU,Pinf,Dinf] = ... // pdxxxresid1( Aname,fix,low,upp, ... // b,bl,bu,d1,d2,grad,rL,rU,x,x1,x2,y,z1,z2 ) inline void pdxxxresid1(ClpPdco *model, const int nlow, const int nupp, const int nfix, int *low, int *upp, int *fix, CoinDenseVector &b, double *bl, double *bu, double d1, double d2, CoinDenseVector &grad, CoinDenseVector &rL, CoinDenseVector &rU, CoinDenseVector &x, CoinDenseVector &x1, CoinDenseVector &x2, CoinDenseVector &y, CoinDenseVector &z1, CoinDenseVector &z2, CoinDenseVector &r1, CoinDenseVector &r2, double *Pinf, double *Dinf) { // Form residuals for the primal and dual equations. // rL, rU are output, but we input them as full vectors // initialized (permanently) with any relevant zeros. // Get some element pointers for efficiency double *x_elts = x.getElements(); double *r2_elts = r2.getElements(); for (int k = 0; k < nfix; k++) x_elts[fix[k]] = 0; r1.clear(); r2.clear(); model->matVecMult( 1, r1, x ); model->matVecMult( 2, r2, y ); for (int k = 0; k < nfix; k++) r2_elts[fix[k]] = 0; r1 = b - r1 - d2 * d2 * y; r2 = grad - r2 - z1; // grad includes d1*d1*x if (nupp > 0) r2 = r2 + z2; for (int k = 0; k < nlow; k++) rL[low[k]] = bl[low[k]] - x[low[k]] + x1[low[k]]; for (int k = 0; k < nupp; k++) rU[upp[k]] = - bu[upp[k]] + x[upp[k]] + x2[upp[k]]; double normL = 0.0; double normU = 0.0; for (int k = 0; k < nlow; k++) if (rL[low[k]] > normL) normL = rL[low[k]]; for (int k = 0; k < nupp; k++) if (rU[upp[k]] > normU) normU = rU[upp[k]]; *Pinf = CoinMax(normL, normU); *Pinf = CoinMax( r1.infNorm() , *Pinf ); *Dinf = r2.infNorm(); *Pinf = CoinMax( *Pinf, 1e-99 ); *Dinf = CoinMax( *Dinf, 1e-99 ); } //----------------------------------------------------------------------- // End private function pdxxxresid1 //----------------------------------------------------------------------- //function [cL,cU,center,Cinf,Cinf0] = ... // pdxxxresid2( mu,low,upp,cL,cU,x1,x2,z1,z2 ) inline void pdxxxresid2(double mu, int nlow, int nupp, int *low, int *upp, CoinDenseVector &cL, CoinDenseVector &cU, CoinDenseVector &x1, CoinDenseVector &x2, CoinDenseVector &z1, CoinDenseVector &z2, double *center, double *Cinf, double *Cinf0) { // Form residuals for the complementarity equations. // cL, cU are output, but we input them as full vectors // initialized (permanently) with any relevant zeros. // Cinf is the complementarity residual for X1 z1 = mu e, etc. // Cinf0 is the same for mu=0 (i.e., for the original problem). double maxXz = -1e20; double minXz = 1e20; double *x1_elts = x1.getElements(); double *z1_elts = z1.getElements(); double *cL_elts = cL.getElements(); for (int k = 0; k < nlow; k++) { double x1z1 = x1_elts[low[k]] * z1_elts[low[k]]; cL_elts[low[k]] = mu - x1z1; if (x1z1 > maxXz) maxXz = x1z1; if (x1z1 < minXz) minXz = x1z1; } double *x2_elts = x2.getElements(); double *z2_elts = z2.getElements(); double *cU_elts = cU.getElements(); for (int k = 0; k < nupp; k++) { double x2z2 = x2_elts[upp[k]] * z2_elts[upp[k]]; cU_elts[upp[k]] = mu - x2z2; if (x2z2 > maxXz) maxXz = x2z2; if (x2z2 < minXz) minXz = x2z2; } maxXz = CoinMax( maxXz, 1e-99 ); minXz = CoinMax( minXz, 1e-99 ); *center = maxXz / minXz; double normL = 0.0; double normU = 0.0; for (int k = 0; k < nlow; k++) if (cL_elts[low[k]] > normL) normL = cL_elts[low[k]]; for (int k = 0; k < nupp; k++) if (cU_elts[upp[k]] > normU) normU = cU_elts[upp[k]]; *Cinf = CoinMax( normL, normU); *Cinf0 = maxXz; } //----------------------------------------------------------------------- // End private function pdxxxresid2 //----------------------------------------------------------------------- inline double pdxxxstep( CoinDenseVector &x, CoinDenseVector &dx ) { // Assumes x > 0. // Finds the maximum step such that x + step*dx >= 0. double step = 1e+20; int n = x.size(); double *x_elts = x.getElements(); double *dx_elts = dx.getElements(); for (int k = 0; k < n; k++) if (dx_elts[k] < 0) if ((x_elts[k] / (-dx_elts[k])) < step) step = x_elts[k] / (-dx_elts[k]); return step; } //----------------------------------------------------------------------- // End private function pdxxxstep //----------------------------------------------------------------------- inline double pdxxxstep(int nset, int *set, CoinDenseVector &x, CoinDenseVector &dx ) { // Assumes x > 0. // Finds the maximum step such that x + step*dx >= 0. double step = 1e+20; int n = x.size(); double *x_elts = x.getElements(); double *dx_elts = dx.getElements(); for (int k = 0; k < n; k++) if (dx_elts[k] < 0) if ((x_elts[k] / (-dx_elts[k])) < step) step = x_elts[k] / (-dx_elts[k]); return step; } //----------------------------------------------------------------------- // End private function pdxxxstep //----------------------------------------------------------------------- #endif #endif CoinMP-1.8.3/Clp/src/ClpPdco.hpp0000644000175000017500000000335311510657452014670 0ustar renerene/* $Id: ClpPdco.hpp 1665 2011-01-04 17:55:54Z lou $ */ // Copyright (C) 2003, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). /* Authors John Tomlin */ #ifndef ClpPdco_H #define ClpPdco_H #include "ClpInterior.hpp" /** This solves problems in Primal Dual Convex Optimization It inherits from ClpInterior. It has no data of its own and is never created - only cast from a ClpInterior object at algorithm time. */ class ClpPdco : public ClpInterior { public: /**@name Description of algorithm */ //@{ /** Pdco algorithm Method */ int pdco(); // ** Temporary version int pdco( ClpPdcoBase * stuff, Options &options, Info &info, Outfo &outfo); //@} /**@name Functions used in pdco */ //@{ /// LSQR void lsqr(); void matVecMult( int, double *, double *); void matVecMult( int, CoinDenseVector &, double *); void matVecMult( int, CoinDenseVector &, CoinDenseVector &); void matVecMult( int, CoinDenseVector *, CoinDenseVector *); void getBoundTypes( int *, int *, int *, int**); void getGrad(CoinDenseVector &x, CoinDenseVector &grad); void getHessian(CoinDenseVector &x, CoinDenseVector &H); double getObj(CoinDenseVector &x); void matPrecon( double, double *, double *); void matPrecon( double, CoinDenseVector &, double *); void matPrecon( double, CoinDenseVector &, CoinDenseVector &); void matPrecon( double, CoinDenseVector *, CoinDenseVector *); //@} }; #endif CoinMP-1.8.3/Clp/src/AbcPrimalColumnPivot.cpp0000644000175000017500000000450712101105055017353 0ustar renerene/* $Id: AbcPrimalColumnPivot.cpp 1910 2013-01-27 02:00:13Z stefan $ */ // Copyright (C) 2002, International Business Machines // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include "AbcSimplex.hpp" #include "AbcPrimalColumnPivot.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- AbcPrimalColumnPivot::AbcPrimalColumnPivot () : model_(NULL), type_(-1), looksOptimal_(false) { } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- AbcPrimalColumnPivot::AbcPrimalColumnPivot (const AbcPrimalColumnPivot & source) : model_(source.model_), type_(source.type_), looksOptimal_(source.looksOptimal_) { } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- AbcPrimalColumnPivot::~AbcPrimalColumnPivot () { } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- AbcPrimalColumnPivot & AbcPrimalColumnPivot::operator=(const AbcPrimalColumnPivot& rhs) { if (this != &rhs) { type_ = rhs.type_; model_ = rhs.model_; looksOptimal_ = rhs.looksOptimal_; } return *this; } void AbcPrimalColumnPivot::saveWeights(AbcSimplex * model, int ) { model_ = model; } // checks accuracy and may re-initialize (may be empty) void AbcPrimalColumnPivot::updateWeights(CoinIndexedVector *) { } // Gets rid of all arrays void AbcPrimalColumnPivot::clearArrays() { } /* Returns number of extra columns for sprint algorithm - 0 means off. Also number of iterations before recompute */ int AbcPrimalColumnPivot::numberSprintColumns(int & ) const { return 0; } // Switch off sprint idea void AbcPrimalColumnPivot::switchOffSprint() { } CoinMP-1.8.3/Clp/AUTHORS0000644000175000017500000000002010430454205013067 0ustar renereneForrest, John J.CoinMP-1.8.3/AUTHORS0000644000175000017500000000043111043701256012361 0ustar renereneFor CoinMP author information, please see the AUTHORS file in the CoinMP subdirectory. For author information for any other COIN-OR or third-party source code that was automatically checked out with CoinMP, please see the AUTHORS file in the appropriate subdirectories